From: support Date: Mon, 28 Nov 2022 12:35:04 +0000 (+0000) Subject: Built motion from commit aab9c2f3.|2.6.24 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.openchannel?a=commitdiff_plain;h=302860bf567a040e0d555f5a5df2a34c515bd00f;p=motion2.git Built motion from commit aab9c2f3.|2.6.24 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 5047605..51e0005 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-25T15:03:01.932Z", + "time": "2022-11-28T12:26:27.497Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index ba63bdc..a0535a9 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-11-25T15:03:01.932Z", + "time": "2022-11-28T12:26:27.497Z", "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 74096d4..4f90447 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 _0x3d68=['browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','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)]'];(function(_0x166744,_0x1ae2e6){var _0x4068b5=function(_0x5ecc92){while(--_0x5ecc92){_0x166744['push'](_0x166744['shift']());}};_0x4068b5(++_0x1ae2e6);}(_0x3d68,0x131));var _0x83d6=function(_0x4c1ffb,_0x49063a){_0x4c1ffb=_0x4c1ffb-0x0;var _0x244f55=_0x3d68[_0x4c1ffb];return _0x244f55;};'use strict';var Sequelize=require(_0x83d6('0x0'));module[_0x83d6('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x545223){return this[_0x83d6('0x2')](_0x83d6('0x3'));}},'action':{'type':Sequelize[_0x83d6('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x83d6('0x5'),_0x83d6('0x6'),_0x83d6('0x7'),_0x83d6('0x8'),_0x83d6('0x9'),_0x83d6('0xa'),_0x83d6('0xb'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x83d6('0xc')},'data1':{'type':Sequelize['STRING'](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[_0x83d6('0x4')](0x1000),'comment':_0x83d6('0xd')},'data3':{'type':Sequelize[_0x83d6('0x4')](0x1000),'comment':_0x83d6('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x83d6('0xf')},'data5':{'type':Sequelize[_0x83d6('0x4')](0x1000),'comments':_0x83d6('0x10')},'data6':{'type':Sequelize[_0x83d6('0x4')],'comments':_0x83d6('0x11')},'data7':{'type':Sequelize[_0x83d6('0x12')],'comments':_0x83d6('0x13')}}; \ No newline at end of file +var _0x8c29=['VIRTUAL','action','STRING','contactManager','motionbar','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports'];(function(_0x479e13,_0xb7475f){var _0x5ced9a=function(_0x36319){while(--_0x36319){_0x479e13['push'](_0x479e13['shift']());}};_0x5ced9a(++_0xb7475f);}(_0x8c29,0x8e));var _0x98c2=function(_0x25eb9b,_0x5e962){_0x25eb9b=_0x25eb9b-0x0;var _0x5f585c=_0x8c29[_0x25eb9b];return _0x5f585c;};'use strict';var Sequelize=require(_0x98c2('0x0'));module[_0x98c2('0x1')]={'name':{'type':Sequelize[_0x98c2('0x2')],'get':function(_0x39ad5e){return this['getDataValue'](_0x98c2('0x3'));}},'action':{'type':Sequelize[_0x98c2('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x98c2('0x5'),'integration',_0x98c2('0x6'),_0x98c2('0x7'),'urlForward',_0x98c2('0x8'),_0x98c2('0x9'),_0x98c2('0xa')]],'msg':_0x98c2('0xb')}},'comment':_0x98c2('0xb')},'data1':{'type':Sequelize[_0x98c2('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['STRING'](0x1000),'comment':_0x98c2('0xc')},'data3':{'type':Sequelize[_0x98c2('0x4')](0x1000),'comment':_0x98c2('0xd')},'data4':{'type':Sequelize[_0x98c2('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x98c2('0xe')},'data6':{'type':Sequelize[_0x98c2('0x4')],'comments':_0x98c2('0xf')},'data7':{'type':Sequelize[_0x98c2('0x10')],'comments':_0x98c2('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index e49a085..fdd48f0 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 _0x4522=['sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','name','send','body','Action','find','catch','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x30ccd0,_0x4aa875){var _0x1a8c5f=function(_0x5b3c92){while(--_0x5b3c92){_0x30ccd0['push'](_0x30ccd0['shift']());}};_0x1a8c5f(++_0x4aa875);}(_0x4522,0x10b));var _0x2452=function(_0x1aa0ee,_0x2a61de){_0x1aa0ee=_0x1aa0ee-0x0;var _0x56af4a=_0x4522[_0x1aa0ee];return _0x56af4a;};'use strict';var emlformat=require(_0x2452('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2452('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2452('0x2'));var moment=require(_0x2452('0x3'));var BPromise=require(_0x2452('0x4'));var Mustache=require(_0x2452('0x5'));var util=require(_0x2452('0x6'));var path=require(_0x2452('0x7'));var sox=require(_0x2452('0x8'));var csv=require(_0x2452('0x9'));var ejs=require(_0x2452('0xa'));var fs=require('fs');var fs_extra=require(_0x2452('0xb'));var _=require(_0x2452('0xc'));var squel=require(_0x2452('0xd'));var crypto=require('crypto');var jsforce=require(_0x2452('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2452('0xf'));var Papa=require(_0x2452('0x10'));var Redis=require(_0x2452('0x11'));var authService=require(_0x2452('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2452('0x13'));var hardwareService=require(_0x2452('0x14'));var logger=require(_0x2452('0x15'))(_0x2452('0x16'));var utils=require(_0x2452('0x17'));var config=require(_0x2452('0x18'));var licenseUtil=require(_0x2452('0x19'));var db=require(_0x2452('0x1a'))['db'];function respondWithStatusCode(_0xeea5f6,_0x4c649b){_0x4c649b=_0x4c649b||0xcc;return function(_0x4785c7){if(_0x4785c7){return _0xeea5f6[_0x2452('0x1b')](_0x4c649b);}return _0xeea5f6[_0x2452('0x1c')](_0x4c649b)['end']();};}function respondWithResult(_0x226fba,_0x578240){_0x578240=_0x578240||0xc8;return function(_0x332998){if(_0x332998){return _0x226fba[_0x2452('0x1c')](_0x578240)[_0x2452('0x1d')](_0x332998);}};}function respondWithFilteredResult(_0xb77f9a,_0x38672d){return function(_0x3448a9){if(_0x3448a9){var _0xa2defb=typeof _0x38672d['offset']==='undefined'&&typeof _0x38672d[_0x2452('0x1e')]==='undefined';var _0x20198d=_0x3448a9[_0x2452('0x1f')];var _0x325eef=_0xa2defb?0x0:_0x38672d[_0x2452('0x20')];var _0x583daf=_0xa2defb?_0x3448a9[_0x2452('0x1f')]:_0x38672d[_0x2452('0x20')]+_0x38672d[_0x2452('0x1e')];var _0x4a7d66;if(_0x583daf>=_0x20198d){_0x583daf=_0x20198d;_0x4a7d66=0xc8;}else{_0x4a7d66=0xce;}_0xb77f9a[_0x2452('0x1c')](_0x4a7d66);return _0xb77f9a[_0x2452('0x21')](_0x2452('0x22'),_0x325eef+'-'+_0x583daf+'/'+_0x20198d)[_0x2452('0x1d')](_0x3448a9);}return null;};}function patchUpdates(_0x202101){return function(_0x587bf4){try{jsonpatch[_0x2452('0x23')](_0x587bf4,_0x202101,!![]);}catch(_0x17723e){return BPromise[_0x2452('0x24')](_0x17723e);}return _0x587bf4[_0x2452('0x25')]();};}function saveUpdates(_0x579a07,_0x527ad0){return function(_0x2ebe4d){if(_0x2ebe4d){return _0x2ebe4d[_0x2452('0x26')](_0x579a07)[_0x2452('0x27')](function(_0x5d4351){return _0x5d4351;});}return null;};}function removeEntity(_0x2f1aa7,_0x1fcb78){return function(_0x4d6f36){if(_0x4d6f36){return _0x4d6f36['destroy']()[_0x2452('0x27')](function(){_0x2f1aa7[_0x2452('0x1c')](0xcc)[_0x2452('0x28')]();});}};}function handleEntityNotFound(_0x3c717c,_0x1a0c30){return function(_0x2c0985){if(!_0x2c0985){_0x3c717c[_0x2452('0x1b')](0x194);}return _0x2c0985;};}function handleError(_0x65e96e,_0x150446){_0x150446=_0x150446||0x1f4;return function(_0x4a1fd6){logger[_0x2452('0x29')](_0x4a1fd6['stack']);if(_0x4a1fd6[_0x2452('0x2a')]){delete _0x4a1fd6[_0x2452('0x2a')];}_0x65e96e[_0x2452('0x1c')](_0x150446)[_0x2452('0x2b')](_0x4a1fd6);};}exports[_0x2452('0x26')]=function(_0x3c3858,_0x5ca54c){if(_0x3c3858[_0x2452('0x2c')]['id']){delete _0x3c3858[_0x2452('0x2c')]['id'];}return db[_0x2452('0x2d')][_0x2452('0x2e')]({'where':{'id':_0x3c3858['params']['id']}})[_0x2452('0x27')](handleEntityNotFound(_0x5ca54c,null))[_0x2452('0x27')](saveUpdates(_0x3c3858['body'],null))[_0x2452('0x27')](respondWithResult(_0x5ca54c,null))[_0x2452('0x2f')](handleError(_0x5ca54c,null));};exports['destroy']=function(_0x5aef33,_0x2d3f9f){return db[_0x2452('0x2d')]['find']({'where':{'id':_0x5aef33[_0x2452('0x30')]['id']}})[_0x2452('0x27')](handleEntityNotFound(_0x2d3f9f,null))[_0x2452('0x27')](removeEntity(_0x2d3f9f,null))[_0x2452('0x2f')](handleError(_0x2d3f9f,null));}; \ No newline at end of file +var _0xcdf3=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x39df5d,_0x1ac59f){var _0x2f09e0=function(_0xdb955){while(--_0xdb955){_0x39df5d['push'](_0x39df5d['shift']());}};_0x2f09e0(++_0x1ac59f);}(_0xcdf3,0xde));var _0x3cdf=function(_0x179c9e,_0x55b3c4){_0x179c9e=_0x179c9e-0x0;var _0x3f92bf=_0xcdf3[_0x179c9e];return _0x3f92bf;};'use strict';var emlformat=require(_0x3cdf('0x0'));var rimraf=require(_0x3cdf('0x1'));var zipdir=require(_0x3cdf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3cdf('0x3'));var moment=require(_0x3cdf('0x4'));var BPromise=require(_0x3cdf('0x5'));var Mustache=require('mustache');var util=require(_0x3cdf('0x6'));var path=require(_0x3cdf('0x7'));var sox=require('sox');var csv=require(_0x3cdf('0x8'));var ejs=require(_0x3cdf('0x9'));var fs=require('fs');var fs_extra=require(_0x3cdf('0xa'));var _=require(_0x3cdf('0xb'));var squel=require(_0x3cdf('0xc'));var crypto=require(_0x3cdf('0xd'));var jsforce=require(_0x3cdf('0xe'));var deskjs=require(_0x3cdf('0xf'));var toCsv=require(_0x3cdf('0x8'));var querystring=require(_0x3cdf('0x10'));var Papa=require('papaparse');var Redis=require(_0x3cdf('0x11'));var authService=require(_0x3cdf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3cdf('0x13'));var hardwareService=require(_0x3cdf('0x14'));var logger=require(_0x3cdf('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x3cdf('0x16'));var licenseUtil=require(_0x3cdf('0x17'));var db=require(_0x3cdf('0x18'))['db'];function respondWithStatusCode(_0x50efa7,_0x52bf33){_0x52bf33=_0x52bf33||0xcc;return function(_0x2c45f9){if(_0x2c45f9){return _0x50efa7[_0x3cdf('0x19')](_0x52bf33);}return _0x50efa7[_0x3cdf('0x1a')](_0x52bf33)[_0x3cdf('0x1b')]();};}function respondWithResult(_0x311816,_0x43905b){_0x43905b=_0x43905b||0xc8;return function(_0x51a6d7){if(_0x51a6d7){return _0x311816[_0x3cdf('0x1a')](_0x43905b)[_0x3cdf('0x1c')](_0x51a6d7);}};}function respondWithFilteredResult(_0x232454,_0x2f6611){return function(_0x37733d){if(_0x37733d){var _0x18aaf0=typeof _0x2f6611[_0x3cdf('0x1d')]===_0x3cdf('0x1e')&&typeof _0x2f6611[_0x3cdf('0x1f')]===_0x3cdf('0x1e');var _0x198b54=_0x37733d[_0x3cdf('0x20')];var _0x3b995a=_0x18aaf0?0x0:_0x2f6611[_0x3cdf('0x1d')];var _0x1f0eea=_0x18aaf0?_0x37733d[_0x3cdf('0x20')]:_0x2f6611['offset']+_0x2f6611[_0x3cdf('0x1f')];var _0x4f0c72;if(_0x1f0eea>=_0x198b54){_0x1f0eea=_0x198b54;_0x4f0c72=0xc8;}else{_0x4f0c72=0xce;}_0x232454[_0x3cdf('0x1a')](_0x4f0c72);return _0x232454[_0x3cdf('0x21')](_0x3cdf('0x22'),_0x3b995a+'-'+_0x1f0eea+'/'+_0x198b54)[_0x3cdf('0x1c')](_0x37733d);}return null;};}function patchUpdates(_0x11a081){return function(_0x1191ee){try{jsonpatch[_0x3cdf('0x23')](_0x1191ee,_0x11a081,!![]);}catch(_0x1f055d){return BPromise[_0x3cdf('0x24')](_0x1f055d);}return _0x1191ee[_0x3cdf('0x25')]();};}function saveUpdates(_0x3a1e27,_0x350650){return function(_0x1cc6bf){if(_0x1cc6bf){return _0x1cc6bf[_0x3cdf('0x26')](_0x3a1e27)[_0x3cdf('0x27')](function(_0x346494){return _0x346494;});}return null;};}function removeEntity(_0x3b3fee,_0x900fe){return function(_0x47a103){if(_0x47a103){return _0x47a103[_0x3cdf('0x28')]()['then'](function(){_0x3b3fee[_0x3cdf('0x1a')](0xcc)[_0x3cdf('0x1b')]();});}};}function handleEntityNotFound(_0x1c85aa,_0x54755b){return function(_0x41d331){if(!_0x41d331){_0x1c85aa[_0x3cdf('0x19')](0x194);}return _0x41d331;};}function handleError(_0x96fcf0,_0x53312b){_0x53312b=_0x53312b||0x1f4;return function(_0x303b8d){logger[_0x3cdf('0x29')](_0x303b8d[_0x3cdf('0x2a')]);if(_0x303b8d[_0x3cdf('0x2b')]){delete _0x303b8d[_0x3cdf('0x2b')];}_0x96fcf0[_0x3cdf('0x1a')](_0x53312b)[_0x3cdf('0x2c')](_0x303b8d);};}exports[_0x3cdf('0x26')]=function(_0xb55e76,_0x4bba84){if(_0xb55e76[_0x3cdf('0x2d')]['id']){delete _0xb55e76['body']['id'];}return db[_0x3cdf('0x2e')][_0x3cdf('0x2f')]({'where':{'id':_0xb55e76[_0x3cdf('0x30')]['id']}})[_0x3cdf('0x27')](handleEntityNotFound(_0x4bba84,null))['then'](saveUpdates(_0xb55e76[_0x3cdf('0x2d')],null))[_0x3cdf('0x27')](respondWithResult(_0x4bba84,null))['catch'](handleError(_0x4bba84,null));};exports[_0x3cdf('0x28')]=function(_0x55df86,_0x316fc0){return db[_0x3cdf('0x2e')][_0x3cdf('0x2f')]({'where':{'id':_0x55df86[_0x3cdf('0x30')]['id']}})['then'](handleEntityNotFound(_0x316fc0,null))[_0x3cdf('0x27')](removeEntity(_0x316fc0,null))[_0x3cdf('0x31')](handleError(_0x316fc0,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 751ba32..6d0aeb8 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 _0xcbed=['../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0xe52152,_0x59567d){var _0x3da6bb=function(_0x120512){while(--_0x120512){_0xe52152['push'](_0xe52152['shift']());}};_0x3da6bb(++_0x59567d);}(_0xcbed,0x17f));var _0xdcbe=function(_0x1ce88e,_0x498806){_0x1ce88e=_0x1ce88e-0x0;var _0x1fd979=_0xcbed[_0x1ce88e];return _0x1fd979;};'use strict';var _=require(_0xdcbe('0x0'));var util=require(_0xdcbe('0x1'));var logger=require(_0xdcbe('0x2'))('api');var moment=require(_0xdcbe('0x3'));var BPromise=require(_0xdcbe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcbe('0x5'));var rimraf=require(_0xdcbe('0x6'));var config=require(_0xdcbe('0x7'));var attributes=require(_0xdcbe('0x8'));module[_0xdcbe('0x9')]=function(_0x11ea3d,_0x1aff03){return _0x11ea3d[_0xdcbe('0xa')](_0xdcbe('0xb'),attributes,{'tableName':_0xdcbe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f77=['exports','Action','tools_actions','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x81ad22,_0x5f399d){var _0x48bb7c=function(_0x2f8995){while(--_0x2f8995){_0x81ad22['push'](_0x81ad22['shift']());}};_0x48bb7c(++_0x5f399d);}(_0x1f77,0x7c));var _0x71f7=function(_0x2ed627,_0xb17d90){_0x2ed627=_0x2ed627-0x0;var _0x30268e=_0x1f77[_0x2ed627];return _0x30268e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x71f7('0x0'))(_0x71f7('0x1'));var moment=require(_0x71f7('0x2'));var BPromise=require(_0x71f7('0x3'));var rp=require(_0x71f7('0x4'));var fs=require('fs');var path=require(_0x71f7('0x5'));var rimraf=require(_0x71f7('0x6'));var config=require(_0x71f7('0x7'));var attributes=require('./action.attributes');module[_0x71f7('0x8')]=function(_0x576e39,_0x21c25f){return _0x576e39['define'](_0x71f7('0x9'),attributes,{'tableName':_0x71f7('0xa'),'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 5acf547..be2528c 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x401dab,_0x2af71e){var _0x31b40a=function(_0x10e7e4){while(--_0x10e7e4){_0x401dab['push'](_0x401dab['shift']());}};_0x31b40a(++_0x2af71e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xc4aa[_0x346737];return _0x1ade2e;};'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')]('Action,\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 +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x4975,0x86));var _0x5497=function(_0x23b8ff,_0x38780d){_0x23b8ff=_0x23b8ff-0x0;var _0x429da1=_0x4975[_0x23b8ff];return _0x429da1;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 2eff78f..9f52fd1 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 _0x572e=['isAuthenticated','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id'];(function(_0x38e297,_0x1dae38){var _0x94dff=function(_0x683c3){while(--_0x683c3){_0x38e297['push'](_0x38e297['shift']());}};_0x94dff(++_0x1dae38);}(_0x572e,0xa9));var _0xe572=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x572e[_0x543084];return _0x306a57;};'use strict';var multer=require(_0xe572('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe572('0x1'));var express=require(_0xe572('0x2'));var router=express[_0xe572('0x3')]();var fs_extra=require(_0xe572('0x4'));var auth=require(_0xe572('0x5'));var interaction=require(_0xe572('0x6'));var config=require(_0xe572('0x7'));var controller=require(_0xe572('0x8'));router[_0xe572('0x9')](_0xe572('0xa'),auth[_0xe572('0xb')](),controller[_0xe572('0xc')]);router[_0xe572('0xd')](_0xe572('0xa'),auth['isAuthenticated'](),controller[_0xe572('0xe')]);module['exports']=router; \ No newline at end of file +var _0x55c9=['update','delete','isAuthenticated','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id'];(function(_0x482575,_0x2a8a79){var _0x14ca68=function(_0x2e657d){while(--_0x2e657d){_0x482575['push'](_0x482575['shift']());}};_0x14ca68(++_0x2a8a79);}(_0x55c9,0x1a8));var _0x955c=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x55c9[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x955c('0x0'));var util=require(_0x955c('0x1'));var path=require('path');var timeout=require(_0x955c('0x2'));var express=require(_0x955c('0x3'));var router=express[_0x955c('0x4')]();var fs_extra=require(_0x955c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x955c('0x6'));var config=require(_0x955c('0x7'));var controller=require(_0x955c('0x8'));router[_0x955c('0x9')](_0x955c('0xa'),auth['isAuthenticated'](),controller[_0x955c('0xb')]);router[_0x955c('0xc')](_0x955c('0xa'),auth[_0x955c('0xd')](),controller[_0x955c('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 0ecf005..946a779 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 _0x5075=['exports','STRING','TEXT','sequelize'];(function(_0x17fea7,_0x102927){var _0x3150c3=function(_0x1d6bd0){while(--_0x1d6bd0){_0x17fea7['push'](_0x17fea7['shift']());}};_0x3150c3(++_0x102927);}(_0x5075,0x73));var _0x5507=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x5075[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5507('0x2')]},'parent':{'type':Sequelize[_0x5507('0x2')]},'table':{'type':Sequelize[_0x5507('0x2')]},'conditions':{'type':Sequelize[_0x5507('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x33c5=['STRING','TEXT','exports'];(function(_0x2edbe0,_0x2bf57b){var _0xd5e61e=function(_0x406aa5){while(--_0x406aa5){_0x2edbe0['push'](_0x2edbe0['shift']());}};_0xd5e61e(++_0x2bf57b);}(_0x33c5,0xe6));var _0x533c=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0x33c5[_0x2181b1];return _0x530548;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'name':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x533c('0x1')]},'table':{'type':Sequelize[_0x533c('0x1')]},'conditions':{'type':Sequelize[_0x533c('0x2')]},'joins':{'type':Sequelize[_0x533c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index cf94656..3beb9fe 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 _0x943a=['COUNT(*)','run','alias','debug','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','CustomReports','UserProfileResource','end','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','include','show','params','keys','includeAll','merge','find','catch','user','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','parse','joins','includes','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MAX(%s)','MIN(%s)','HOUR(%s)','IS\x20NOT\x20NULL','select','output','fullPath','%s-%s.%s','csv','custom','AnalyticExtractedReport','startDate','endDate','info','fork','../../components/export/','../../files/reports','savename','countTable'];(function(_0xcfa248,_0x2a7988){var _0x2b3b34=function(_0x23d8b5){while(--_0x23d8b5){_0xcfa248['push'](_0xcfa248['shift']());}};_0x2b3b34(++_0x2a7988);}(_0x943a,0xa8));var _0xa943=function(_0x514614,_0x54c16d){_0x514614=_0x514614-0x0;var _0x334409=_0x943a[_0x514614];return _0x334409;};'use strict';var emlformat=require(_0xa943('0x0'));var rimraf=require(_0xa943('0x1'));var zipdir=require(_0xa943('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa943('0x3'));var moment=require(_0xa943('0x4'));var BPromise=require(_0xa943('0x5'));var Mustache=require(_0xa943('0x6'));var util=require(_0xa943('0x7'));var path=require(_0xa943('0x8'));var sox=require('sox');var csv=require(_0xa943('0x9'));var ejs=require(_0xa943('0xa'));var fs=require('fs');var fs_extra=require(_0xa943('0xb'));var _=require(_0xa943('0xc'));var squel=require(_0xa943('0xd'));var crypto=require(_0xa943('0xe'));var jsforce=require(_0xa943('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa943('0x9'));var querystring=require(_0xa943('0x10'));var Papa=require(_0xa943('0x11'));var Redis=require(_0xa943('0x12'));var authService=require(_0xa943('0x13'));var qs=require(_0xa943('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa943('0x15'));var logger=require('../../config/logger')(_0xa943('0x16'));var utils=require(_0xa943('0x17'));var config=require(_0xa943('0x18'));var licenseUtil=require(_0xa943('0x19'));var db=require(_0xa943('0x1a'))['db'];var dbH=require(_0xa943('0x1a'))[_0xa943('0x1b')];function respondWithStatusCode(_0x3d6e11,_0x2ee2de){_0x2ee2de=_0x2ee2de||0xcc;return function(_0x55b78c){if(_0x55b78c){return _0x3d6e11[_0xa943('0x1c')](_0x2ee2de);}return _0x3d6e11[_0xa943('0x1d')](_0x2ee2de)['end']();};}function respondWithResult(_0x398886,_0x2f96fb){_0x2f96fb=_0x2f96fb||0xc8;return function(_0x167d22){if(_0x167d22){return _0x398886['status'](_0x2f96fb)[_0xa943('0x1e')](_0x167d22);}};}function respondWithFilteredResult(_0xaebd65,_0xaa7b6c){return function(_0xad9e34){if(_0xad9e34){var _0x29f244=typeof _0xaa7b6c['offset']===_0xa943('0x1f')&&typeof _0xaa7b6c[_0xa943('0x20')]===_0xa943('0x1f');var _0x15661b=_0xad9e34[_0xa943('0x21')];var _0x14211e=_0x29f244?0x0:_0xaa7b6c[_0xa943('0x22')];var _0x5c064f=_0x29f244?_0xad9e34[_0xa943('0x21')]:_0xaa7b6c[_0xa943('0x22')]+_0xaa7b6c[_0xa943('0x20')];var _0x145f7b;if(_0x5c064f>=_0x15661b){_0x5c064f=_0x15661b;_0x145f7b=0xc8;}else{_0x145f7b=0xce;}_0xaebd65['status'](_0x145f7b);return _0xaebd65[_0xa943('0x23')](_0xa943('0x24'),_0x14211e+'-'+_0x5c064f+'/'+_0x15661b)[_0xa943('0x1e')](_0xad9e34);}return null;};}function patchUpdates(_0x272413){return function(_0x1c1c19){try{jsonpatch[_0xa943('0x25')](_0x1c1c19,_0x272413,!![]);}catch(_0x21e922){return BPromise[_0xa943('0x26')](_0x21e922);}return _0x1c1c19['save']();};}function saveUpdates(_0x503b6b,_0x20a02c){return function(_0x20334e){if(_0x20334e){return _0x20334e[_0xa943('0x27')](_0x503b6b)[_0xa943('0x28')](function(_0x2349f2){return _0x2349f2;});}return null;};}function removeEntity(_0x2bfb39,_0x506b22){return function(_0x5726ed){if(_0x5726ed){return _0x5726ed[_0xa943('0x29')]()[_0xa943('0x28')](function(){var _0x1ec032=_0x5726ed[_0xa943('0x2a')]({'plain':!![]});var _0x20b9b8=_0xa943('0x2b');return db[_0xa943('0x2c')][_0xa943('0x29')]({'where':{'type':_0x20b9b8,'resourceId':_0x1ec032['id']}})['then'](function(){return _0x5726ed;});})['then'](function(){_0x2bfb39[_0xa943('0x1d')](0xcc)[_0xa943('0x2d')]();});}};}function handleEntityNotFound(_0x42a90b,_0x17636b){return function(_0x3c2ecf){if(!_0x3c2ecf){_0x42a90b[_0xa943('0x1c')](0x194);}return _0x3c2ecf;};}function handleError(_0x1d4e66,_0x537efd){_0x537efd=_0x537efd||0x1f4;return function(_0x44ae37){logger['error'](_0x44ae37[_0xa943('0x2e')]);if(_0x44ae37[_0xa943('0x2f')]){delete _0x44ae37[_0xa943('0x2f')];}_0x1d4e66[_0xa943('0x1d')](_0x537efd)[_0xa943('0x30')](_0x44ae37);};}exports[_0xa943('0x31')]=function(_0x5bcda4,_0x110c9e){var _0x47b94c={},_0x561830={},_0x371e4f={'count':0x0,'rows':[]};var _0x549862=_[_0xa943('0x32')](db[_0xa943('0x33')][_0xa943('0x34')],function(_0x58b79d){return{'name':_0x58b79d[_0xa943('0x35')],'type':_0x58b79d['type'][_0xa943('0x36')]};});_0x561830['model']=_[_0xa943('0x32')](_0x549862,_0xa943('0x2f'));_0x561830[_0xa943('0x37')]=_['keys'](_0x5bcda4[_0xa943('0x37')]);_0x561830[_0xa943('0x38')]=_[_0xa943('0x39')](_0x561830[_0xa943('0x3a')],_0x561830[_0xa943('0x37')]);_0x47b94c[_0xa943('0x3b')]=_[_0xa943('0x39')](_0x561830['model'],qs['fields'](_0x5bcda4[_0xa943('0x37')][_0xa943('0x3c')]));_0x47b94c[_0xa943('0x3b')]=_0x47b94c['attributes'][_0xa943('0x3d')]?_0x47b94c[_0xa943('0x3b')]:_0x561830['model'];if(!_0x5bcda4[_0xa943('0x37')][_0xa943('0x3e')](_0xa943('0x3f'))){_0x47b94c[_0xa943('0x20')]=qs['limit'](_0x5bcda4['query']['limit']);_0x47b94c[_0xa943('0x22')]=qs[_0xa943('0x22')](_0x5bcda4[_0xa943('0x37')][_0xa943('0x22')]);}_0x47b94c[_0xa943('0x40')]=qs[_0xa943('0x41')](_0x5bcda4[_0xa943('0x37')]['sort']);_0x47b94c[_0xa943('0x42')]=qs[_0xa943('0x38')](_[_0xa943('0x43')](_0x5bcda4['query'],_0x561830['filters']),_0x549862);if(_0x5bcda4[_0xa943('0x37')][_0xa943('0x44')]){_0x47b94c[_0xa943('0x42')]=_['merge'](_0x47b94c[_0xa943('0x42')],{'$or':_[_0xa943('0x32')](_0x549862,function(_0x4ebad5){if(_0x4ebad5[_0xa943('0x45')]!==_0xa943('0x46')){var _0x453278={};_0x453278[_0x4ebad5['name']]={'$like':'%'+_0x5bcda4[_0xa943('0x37')][_0xa943('0x44')]+'%'};return _0x453278;}})});}_0x47b94c=_['merge']({},_0x47b94c,_0x5bcda4[_0xa943('0x47')]);var _0x423682={'where':_0x47b94c['where']};return db['AnalyticCustomReport'][_0xa943('0x21')](_0x423682)[_0xa943('0x28')](function(_0x532a17){_0x371e4f[_0xa943('0x21')]=_0x532a17;if(_0x5bcda4[_0xa943('0x37')]['includeAll']){_0x47b94c[_0xa943('0x48')]=[{'all':!![]}];}return db[_0xa943('0x33')]['findAll'](_0x47b94c);})['then'](function(_0x56e6cf){_0x371e4f['rows']=_0x56e6cf;return _0x371e4f;})[_0xa943('0x28')](respondWithFilteredResult(_0x110c9e,_0x47b94c))['catch'](handleError(_0x110c9e,null));};exports[_0xa943('0x49')]=function(_0x363b35,_0x47d805){var _0x556363={'raw':![],'where':{'id':_0x363b35[_0xa943('0x4a')]['id']}},_0x1e9fb4={};_0x1e9fb4[_0xa943('0x3a')]=_[_0xa943('0x4b')](db[_0xa943('0x33')][_0xa943('0x34')]);_0x1e9fb4[_0xa943('0x37')]=_['keys'](_0x363b35[_0xa943('0x37')]);_0x1e9fb4[_0xa943('0x38')]=_[_0xa943('0x39')](_0x1e9fb4[_0xa943('0x3a')],_0x1e9fb4[_0xa943('0x37')]);_0x556363[_0xa943('0x3b')]=_[_0xa943('0x39')](_0x1e9fb4['model'],qs[_0xa943('0x3c')](_0x363b35[_0xa943('0x37')][_0xa943('0x3c')]));_0x556363['attributes']=_0x556363[_0xa943('0x3b')]['length']?_0x556363[_0xa943('0x3b')]:_0x1e9fb4[_0xa943('0x3a')];if(_0x363b35[_0xa943('0x37')][_0xa943('0x4c')]){_0x556363[_0xa943('0x48')]=[{'all':!![]}];}_0x556363=_[_0xa943('0x4d')]({},_0x556363,_0x363b35['options']);return db[_0xa943('0x33')][_0xa943('0x4e')](_0x556363)[_0xa943('0x28')](handleEntityNotFound(_0x47d805,null))[_0xa943('0x28')](respondWithResult(_0x47d805,null))[_0xa943('0x4f')](handleError(_0x47d805,null));};exports['create']=function(_0x1e4d05,_0x2e1a6e){return db[_0xa943('0x33')]['create'](_0x1e4d05['body'],{})[_0xa943('0x28')](function(_0x88939f){var _0x19baf2=_0x1e4d05[_0xa943('0x50')][_0xa943('0x2a')]({'plain':!![]});if(!_0x19baf2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19baf2['role']===_0xa943('0x50')){var _0x28bf76=_0x88939f[_0xa943('0x2a')]({'plain':!![]});var _0x1c3afa='Reports';return db['UserProfileSection'][_0xa943('0x4e')]({'where':{'name':_0x1c3afa,'userProfileId':_0x19baf2[_0xa943('0x51')]},'raw':!![]})[_0xa943('0x28')](function(_0x2a39e5){if(_0x2a39e5&&_0x2a39e5[_0xa943('0x52')]===0x0){return db[_0xa943('0x2c')][_0xa943('0x53')]({'name':_0x28bf76[_0xa943('0x2f')],'resourceId':_0x28bf76['id'],'type':_0xa943('0x2b'),'sectionId':_0x2a39e5['id']},{})[_0xa943('0x28')](function(){return _0x88939f;});}else{return _0x88939f;}})[_0xa943('0x4f')](function(_0x431a82){logger[_0xa943('0x54')](_0xa943('0x55'),_0x431a82);throw _0x431a82;});}return _0x88939f;})['then'](respondWithResult(_0x2e1a6e,0xc9))[_0xa943('0x4f')](handleError(_0x2e1a6e,null));};exports[_0xa943('0x27')]=function(_0x4f609b,_0x23e32d){if(_0x4f609b[_0xa943('0x56')]['id']){delete _0x4f609b[_0xa943('0x56')]['id'];}return db[_0xa943('0x33')]['find']({'where':{'id':_0x4f609b[_0xa943('0x4a')]['id']}})[_0xa943('0x28')](handleEntityNotFound(_0x23e32d,null))[_0xa943('0x28')](saveUpdates(_0x4f609b[_0xa943('0x56')],null))[_0xa943('0x28')](respondWithResult(_0x23e32d,null))[_0xa943('0x4f')](handleError(_0x23e32d,null));};exports[_0xa943('0x29')]=function(_0x3eb11c,_0x247f4b){return db['AnalyticCustomReport']['find']({'where':{'id':_0x3eb11c[_0xa943('0x4a')]['id']}})[_0xa943('0x28')](handleEntityNotFound(_0x247f4b,null))[_0xa943('0x28')](removeEntity(_0x247f4b,null))[_0xa943('0x4f')](handleError(_0x247f4b,null));};exports['preview']=function(_0x464bc8,_0x1500ab){var _0x2f8920=0xa;var _0x5ba7cb=[_0xa943('0x57'),_0xa943('0x58'),_0xa943('0x59'),_0xa943('0x5a')];var _0x4d409c={'SUM':_0xa943('0x5b'),'COUNT':_0xa943('0x5c'),'COUNT DISTINCT':_0xa943('0x5d'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xa943('0x5e'),'GROUP_CONCAT':_0xa943('0x5f'),'GROUP_CONCAT ASC':_0xa943('0x60'),'GROUP_CONCAT DESC':_0xa943('0x61')};var _0x1f735a={'SEC_TO_TIME':_0xa943('0x62'),'DATE':_0xa943('0x63'),'HOUR':'HOUR(%s)','ROUND':_0xa943('0x64'),'UNIX_TIMESTAMP':_0xa943('0x65')};var _0x4d0521=function(_0x39b3f1){return!_['includes']([_0xa943('0x66'),'IS\x20NOT\x20NULL',_0xa943('0x67'),'IS\x20NOT\x20EMPTY'],_0x39b3f1);};var _0x4efece=function(_0x505601){if(!_0x505601||!_0x505601[_0xa943('0x68')][_0xa943('0x3d')]){return'';}for(var _0x35c9ac='(',_0x352786=0x0;_0x352786<_0x505601['rules']['length'];_0x352786+=0x1){_0x352786>0x0&&(_0x35c9ac+='\x20'+_0x505601[_0xa943('0x69')]+'\x20');_0x35c9ac+=_0x505601[_0xa943('0x68')][_0x352786][_0xa943('0x6a')]?_0x4efece(_0x505601['rules'][_0x352786][_0xa943('0x6a')]):_0x505601[_0xa943('0x68')][_0x352786][_0xa943('0x6b')]+'\x20'+_0x505601[_0xa943('0x68')][_0x352786][_0xa943('0x6c')]+(_0x4d0521(_0x505601['rules'][_0x352786][_0xa943('0x6c')])?'\x20'+_0x505601[_0xa943('0x68')][_0x352786][_0xa943('0x6d')]:'');}return _0x35c9ac+')';};var _0x4751e3={'where':{'id':_0x464bc8[_0xa943('0x4a')]['id']}},_0x2f670f,_0x5a804c,_0x558678,_0x2b3380,_0x23f744;_0x4751e3=_[_0xa943('0x4d')]({},_0x4751e3,_0x464bc8['options']);return db[_0xa943('0x33')][_0xa943('0x4e')](_0x4751e3)[_0xa943('0x28')](function(_0x4d6c32){if(_0x4d6c32){_0x2f670f=_0x4d6c32;return _0x4d6c32[_0xa943('0x6e')]();}return null;})['then'](function(_0x7692ef){if(_0x7692ef){if(!_0x7692ef[_0xa943('0x3d')]){throw new db[(_0xa943('0x6f'))][(_0xa943('0x70'))](_0xa943('0x71'),0x193);}_0x5a804c=_0x7692ef;return db[_0xa943('0x72')][_0xa943('0x73')]({'raw':!![]});}return null;})['then'](function(_0x56237e){if(_0x56237e){_0x558678=_[_0xa943('0x74')](_0x56237e,'id');var _0x46ebf9;var _0x4b024c=squel['select']();_0x4b024c[_0xa943('0x75')](_0x2f670f[_0xa943('0x76')]);for(var _0x2fc543=0x0;_0x2fc543<_0x5a804c[_0xa943('0x3d')];_0x2fc543+=0x1){_0x46ebf9=_0x5a804c[_0x2fc543][_0xa943('0x77')]?_0x558678[_0x5a804c[_0x2fc543][_0xa943('0x77')]][_0xa943('0x78')]:_0x5a804c[_0x2fc543][_0xa943('0x6b')];_0x46ebf9=_0x5a804c[_0x2fc543][_0xa943('0x79')]?_[_0xa943('0x7a')](_0x4d409c[_0x5a804c[_0x2fc543][_0xa943('0x79')]],'%s',_0x46ebf9):_0x46ebf9;_0x46ebf9=_0x5a804c[_0x2fc543][_0xa943('0x7b')]?_[_0xa943('0x7a')](_0x1f735a[_0x5a804c[_0x2fc543][_0xa943('0x7b')]],'%s',_0x46ebf9):_0x46ebf9;if(_0x5a804c[_0x2fc543][_0xa943('0x7c')]){_0x4b024c[_0xa943('0x6a')](_0x46ebf9);}_0x5a804c[_0x2fc543][_0xa943('0x7d')]&&_0x4b024c[_0xa943('0x40')](_0x46ebf9,_0x5a804c[_0x2fc543][_0xa943('0x7d')]===_0xa943('0x7e')?![]:!![]);_0x4b024c[_0xa943('0x6b')](_0x46ebf9,_0x5a804c[_0x2fc543]['alias']||_0x46ebf9);}if(_0x2f670f['joins']){_0x2f670f['joins']=JSON[_0xa943('0x7f')](_0x2f670f[_0xa943('0x80')]);for(var _0x12710e=0x0;_0x12710e<_0x2f670f['joins'][_0xa943('0x3d')];_0x12710e+=0x1){if(_0x2f670f[_0xa943('0x80')][_0x12710e][_0xa943('0x45')]&&_[_0xa943('0x81')](_0x5ba7cb,_0x2f670f[_0xa943('0x80')][_0x12710e][_0xa943('0x45')])&&_0x2f670f[_0xa943('0x80')][_0x12710e][_0xa943('0x82')]&&_0x2f670f[_0xa943('0x80')][_0x12710e]['foreignTable']&&_0x2f670f[_0xa943('0x80')][_0x12710e][_0xa943('0x83')]){_0x4b024c[_0x2f670f[_0xa943('0x80')][_0x12710e]['type']](_0x2f670f['joins'][_0x12710e][_0xa943('0x84')],null,util[_0xa943('0x7b')](_0xa943('0x85'),_0x2f670f[_0xa943('0x76')],_0x2f670f[_0xa943('0x80')][_0x12710e]['parentKey'],_0x2f670f[_0xa943('0x80')][_0x12710e]['foreignTable'],_0x2f670f['joins'][_0x12710e][_0xa943('0x83')]));}}}if(_0x2f670f[_0xa943('0x86')]){_0x2f670f[_0xa943('0x86')]=JSON[_0xa943('0x7f')](_0x2f670f[_0xa943('0x86')]);_0x4b024c[_0xa943('0x42')](_0x4efece(_0x2f670f[_0xa943('0x86')]['group']));}_0x23f744=_0x4b024c[_0xa943('0x87')]();_0x4b024c[_0xa943('0x20')](_0x2f8920);_0x4b024c[_0xa943('0x22')](0x0);logger['debug'](_0xa943('0x88'),_0x4b024c[_0xa943('0x89')]());return dbH[_0xa943('0x8a')]['query'](_0x4b024c[_0xa943('0x89')](),{'type':dbH[_0xa943('0x8a')][_0xa943('0x8b')][_0xa943('0x8c')]});}})[_0xa943('0x28')](respondWithResult(_0x1500ab,null))[_0xa943('0x4f')](handleError(_0x1500ab,null));};function runReport(_0x25ec08,_0x3bb16b,_0x1df3ee){var _0x1cb323=_0x3bb16b[_0xa943('0x2f')];var _0xa19061=0xa;var _0x58180a=[_0xa943('0x57'),_0xa943('0x58'),'right_join',_0xa943('0x5a')];var _0x3bb3e2={'SUM':_0xa943('0x5b'),'COUNT':_0xa943('0x5c'),'COUNT DISTINCT':_0xa943('0x5d'),'MAX':_0xa943('0x8d'),'MIN':_0xa943('0x8e'),'AVG':_0xa943('0x5e'),'GROUP_CONCAT':_0xa943('0x5f'),'GROUP_CONCAT ASC':_0xa943('0x60'),'GROUP_CONCAT DESC':_0xa943('0x61')};var _0x341b29={'SEC_TO_TIME':_0xa943('0x62'),'DATE':'DATE(%s)','HOUR':_0xa943('0x8f'),'ROUND':_0xa943('0x64'),'UNIX_TIMESTAMP':_0xa943('0x65')};var _0x54f826=function(_0x3f2c5f){return!_[_0xa943('0x81')]([_0xa943('0x66'),_0xa943('0x90'),_0xa943('0x67'),'IS\x20NOT\x20EMPTY'],_0x3f2c5f);};var _0x5a3b27=function(_0xfb5c9f){if(!_0xfb5c9f||!_0xfb5c9f[_0xa943('0x68')]['length']){return'';}for(var _0x294e06='(',_0x51e6fd=0x0;_0x51e6fd<_0xfb5c9f[_0xa943('0x68')][_0xa943('0x3d')];_0x51e6fd+=0x1){_0x51e6fd>0x0&&(_0x294e06+='\x20'+_0xfb5c9f[_0xa943('0x69')]+'\x20');_0x294e06+=_0xfb5c9f[_0xa943('0x68')][_0x51e6fd][_0xa943('0x6a')]?_0x5a3b27(_0xfb5c9f['rules'][_0x51e6fd]['group']):_0xfb5c9f[_0xa943('0x68')][_0x51e6fd][_0xa943('0x6b')]+'\x20'+_0xfb5c9f[_0xa943('0x68')][_0x51e6fd][_0xa943('0x6c')]+(_0x54f826(_0xfb5c9f[_0xa943('0x68')][_0x51e6fd][_0xa943('0x6c')])?'\x20'+_0xfb5c9f[_0xa943('0x68')][_0x51e6fd][_0xa943('0x6d')]:'');}return _0x294e06+')';};var _0x3e7351={'where':{'id':_0x25ec08['id']}},_0x23569c,_0x41f439,_0xb05b10,_0x51678d,_0x144304;_0x3e7351=_[_0xa943('0x4d')]({},_0x3e7351,_0x1df3ee);return db[_0xa943('0x33')][_0xa943('0x4e')](_0x3e7351)[_0xa943('0x28')](function(_0x6ae96){if(_0x6ae96){_0x23569c=_0x6ae96;return _0x6ae96['getFields']();}return null;})['then'](function(_0x3402bd){if(_0x3402bd){if(!_0x3402bd[_0xa943('0x3d')]){throw new db['Sequelize']['ValidationErrorItem'](_0xa943('0x71'),0x193);}_0x41f439=_0x3402bd;return db[_0xa943('0x72')][_0xa943('0x73')]({'raw':!![]});}return null;})[_0xa943('0x28')](function(_0x229c25){if(_0x229c25){_0xb05b10=_[_0xa943('0x74')](_0x229c25,'id');var _0x250b94;var _0x209b5b=squel[_0xa943('0x91')]();_0x209b5b[_0xa943('0x75')](_0x23569c[_0xa943('0x76')]);for(var _0x20fa29=0x0;_0x20fa29<_0x41f439[_0xa943('0x3d')];_0x20fa29+=0x1){_0x250b94=_0x41f439[_0x20fa29][_0xa943('0x77')]?_0xb05b10[_0x41f439[_0x20fa29][_0xa943('0x77')]][_0xa943('0x78')]:_0x41f439[_0x20fa29][_0xa943('0x6b')];_0x250b94=_0x41f439[_0x20fa29]['function']?_[_0xa943('0x7a')](_0x3bb3e2[_0x41f439[_0x20fa29]['function']],'%s',_0x250b94):_0x250b94;_0x250b94=_0x41f439[_0x20fa29][_0xa943('0x7b')]?_[_0xa943('0x7a')](_0x341b29[_0x41f439[_0x20fa29][_0xa943('0x7b')]],'%s',_0x250b94):_0x250b94;if(_0x41f439[_0x20fa29][_0xa943('0x7c')]){_0x209b5b[_0xa943('0x6a')](_0x250b94);}_0x41f439[_0x20fa29][_0xa943('0x7d')]&&_0x209b5b[_0xa943('0x40')](_0x250b94,_0x41f439[_0x20fa29][_0xa943('0x7d')]===_0xa943('0x7e')?![]:!![]);_0x209b5b[_0xa943('0x6b')](_0x250b94,_0x41f439[_0x20fa29]['alias']||_0x250b94);}if(_0x23569c[_0xa943('0x80')]){_0x23569c[_0xa943('0x80')]=JSON[_0xa943('0x7f')](_0x23569c['joins']);for(var _0x7d874b=0x0;_0x7d874b<_0x23569c[_0xa943('0x80')]['length'];_0x7d874b+=0x1){if(_0x23569c['joins'][_0x7d874b][_0xa943('0x45')]&&_[_0xa943('0x81')](_0x58180a,_0x23569c[_0xa943('0x80')][_0x7d874b][_0xa943('0x45')])&&_0x23569c[_0xa943('0x80')][_0x7d874b][_0xa943('0x82')]&&_0x23569c['joins'][_0x7d874b][_0xa943('0x84')]&&_0x23569c['joins'][_0x7d874b][_0xa943('0x83')]){_0x209b5b[_0x23569c['joins'][_0x7d874b][_0xa943('0x45')]](_0x23569c['joins'][_0x7d874b][_0xa943('0x84')],null,util[_0xa943('0x7b')](_0xa943('0x85'),_0x23569c['table'],_0x23569c[_0xa943('0x80')][_0x7d874b][_0xa943('0x82')],_0x23569c['joins'][_0x7d874b][_0xa943('0x84')],_0x23569c[_0xa943('0x80')][_0x7d874b][_0xa943('0x83')]));}}}if(_0x23569c['conditions']){_0x23569c[_0xa943('0x86')]=JSON[_0xa943('0x7f')](_0x23569c[_0xa943('0x86')]);_0x209b5b['where'](_0x5a3b27(_0x23569c[_0xa943('0x86')][_0xa943('0x6a')]));}_0x144304=_0x209b5b['clone']();_0x209b5b[_0xa943('0x20')](_0xa19061);_0x209b5b[_0xa943('0x22')](0x0);return;}})[_0xa943('0x28')](function(){if(_0x3bb16b[_0xa943('0x92')]==='web'){return null;}var _0xbd6729=_[_0xa943('0x4d')](_0x3bb16b,{'name':_0x3bb16b[_0xa943('0x93')]||_0x3bb16b['name']||_0x23569c['name'],'basename':_0x1cb323,'savename':util[_0xa943('0x7b')](_0xa943('0x94'),_0x3bb16b[_0xa943('0x2f')]||_0x23569c[_0xa943('0x2f')],require('randomstring')['generate'](0x4),_0x3bb16b[_0xa943('0x92')]||_0xa943('0x95')),'reportId':_0x23569c['id'],'reportType':_0xa943('0x96')});return db[_0xa943('0x97')][_0xa943('0x53')](_0xbd6729,{'raw':!![]});})[_0xa943('0x28')](function(_0x34193a){if(_0x23569c[_0xa943('0x76')]==='cdr'){_0x144304['where'](_0x23569c[_0xa943('0x76')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3bb16b[_0xa943('0x98')],_0x3bb16b[_0xa943('0x99')]);}else{_0x144304[_0xa943('0x42')](_0x23569c['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3bb16b['startDate'],_0x3bb16b[_0xa943('0x99')]);}if(_0x34193a){logger[_0xa943('0x9a')]('Run\x20Query:',_0x144304['toString']());require('child_process')[_0xa943('0x9b')](path[_0xa943('0x57')](__dirname,_0xa943('0x9c'),_0x34193a['output']),[_0x34193a['id'],_0x144304[_0xa943('0x89')](),path['join'](__dirname,_0xa943('0x9d'),_0x34193a[_0xa943('0x9e')]),_0x1cb323]);return _0x34193a;}else{var _0xfb8bc8=squel[_0xa943('0x91')]();_0xfb8bc8[_0xa943('0x75')]('('+_0x144304[_0xa943('0x89')]()+')',_0xa943('0x9f'));_0xfb8bc8[_0xa943('0x6b')](_0xa943('0xa0'),_0xa943('0x21'));_0x144304[_0xa943('0x20')](_0x3bb16b[_0xa943('0x20')]||_0xa19061);_0x144304[_0xa943('0x22')](_0x3bb16b[_0xa943('0x22')]||0x0);return dbH[_0xa943('0x8a')][_0xa943('0x37')](_0xfb8bc8[_0xa943('0x89')](),{'type':dbH[_0xa943('0x8a')][_0xa943('0x8b')][_0xa943('0x8c')]})[_0xa943('0x28')](function(_0x2f13cb){if(!_0x2f13cb[_0xa943('0x3d')]){_0x51678d=0x0;}else{_0x51678d=_0x2f13cb[0x0][_0xa943('0x21')]||0x0;}return dbH[_0xa943('0x8a')][_0xa943('0x37')](_0x144304[_0xa943('0x89')](),{'type':dbH['sequelize'][_0xa943('0x8b')]['SELECT']});})[_0xa943('0x28')](function(_0x2f4762){return{'rows':_0x2f4762||[],'count':_0x51678d};});}});}exports[_0xa943('0xa1')]=function(_0x203a16,_0xf54b4f){return runReport(_0x203a16[_0xa943('0x4a')],_0x203a16[_0xa943('0x37')],_0x203a16[_0xa943('0x47')])[_0xa943('0x28')](respondWithResult(_0xf54b4f,null))['catch'](handleError(_0xf54b4f,null));};exports['runReport']=runReport;exports[_0xa943('0x37')]=function(_0x3424ea,_0x49aff2){var _0x220d97=0xa;var _0xcdb0af=[_0xa943('0x57'),_0xa943('0x58'),_0xa943('0x59'),_0xa943('0x5a')];var _0x4b3436={'SUM':'SUM(%s)','COUNT':_0xa943('0x5c'),'COUNT DISTINCT':_0xa943('0x5d'),'MAX':_0xa943('0x8d'),'MIN':_0xa943('0x8e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xa943('0x5f'),'GROUP_CONCAT ASC':_0xa943('0x60'),'GROUP_CONCAT DESC':_0xa943('0x61')};var _0x3b6eb6={'SEC_TO_TIME':_0xa943('0x62'),'DATE':_0xa943('0x63'),'HOUR':_0xa943('0x8f'),'ROUND':_0xa943('0x64'),'UNIX_TIMESTAMP':_0xa943('0x65')};var _0x31949e=function(_0x5f0f6d){return!_[_0xa943('0x81')]([_0xa943('0x66'),_0xa943('0x90'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x5f0f6d);};var _0x1e685a=function(_0x1ca1ac){if(!_0x1ca1ac||!_0x1ca1ac[_0xa943('0x68')][_0xa943('0x3d')]){return'';}for(var _0x3ab24b='(',_0x435212=0x0;_0x435212<_0x1ca1ac[_0xa943('0x68')][_0xa943('0x3d')];_0x435212+=0x1){_0x435212>0x0&&(_0x3ab24b+='\x20'+_0x1ca1ac[_0xa943('0x69')]+'\x20');_0x3ab24b+=_0x1ca1ac[_0xa943('0x68')][_0x435212][_0xa943('0x6a')]?_0x1e685a(_0x1ca1ac['rules'][_0x435212][_0xa943('0x6a')]):_0x1ca1ac[_0xa943('0x68')][_0x435212][_0xa943('0x6b')]+'\x20'+_0x1ca1ac['rules'][_0x435212][_0xa943('0x6c')]+(_0x31949e(_0x1ca1ac['rules'][_0x435212]['condition'])?'\x20'+_0x1ca1ac[_0xa943('0x68')][_0x435212][_0xa943('0x6d')]:'');}return _0x3ab24b+')';};var _0x3964ed={'where':{'id':_0x3424ea['params']['id']}},_0x2a4a95,_0x4279c2,_0x59f805,_0x3f1603,_0x586189;_0x3964ed=_[_0xa943('0x4d')]({},_0x3964ed,_0x3424ea[_0xa943('0x47')]);return db[_0xa943('0x33')][_0xa943('0x4e')](_0x3964ed)[_0xa943('0x28')](function(_0x2ed98){if(_0x2ed98){_0x2a4a95=_0x2ed98;return _0x2ed98['getFields']();}return null;})[_0xa943('0x28')](function(_0x28ce01){if(_0x28ce01){if(!_0x28ce01['length']){throw new db['Sequelize'][(_0xa943('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4279c2=_0x28ce01;return db[_0xa943('0x72')]['findAll']({'raw':!![]});}return null;})[_0xa943('0x28')](function(_0x44b46a){if(_0x44b46a){_0x59f805=_[_0xa943('0x74')](_0x44b46a,'id');var _0x4bb1a4;var _0x221199=squel[_0xa943('0x91')]();_0x221199['from'](_0x2a4a95[_0xa943('0x76')]);for(var _0x397151=0x0;_0x397151<_0x4279c2[_0xa943('0x3d')];_0x397151+=0x1){_0x4bb1a4=_0x4279c2[_0x397151][_0xa943('0x77')]?_0x59f805[_0x4279c2[_0x397151][_0xa943('0x77')]]['metric']:_0x4279c2[_0x397151][_0xa943('0x6b')];_0x4bb1a4=_0x4279c2[_0x397151][_0xa943('0x79')]?_['replace'](_0x4b3436[_0x4279c2[_0x397151]['function']],'%s',_0x4bb1a4):_0x4bb1a4;_0x4bb1a4=_0x4279c2[_0x397151][_0xa943('0x7b')]?_[_0xa943('0x7a')](_0x3b6eb6[_0x4279c2[_0x397151][_0xa943('0x7b')]],'%s',_0x4bb1a4):_0x4bb1a4;if(_0x4279c2[_0x397151][_0xa943('0x7c')]){_0x221199['group'](_0x4bb1a4);}_0x4279c2[_0x397151][_0xa943('0x7d')]&&_0x221199[_0xa943('0x40')](_0x4bb1a4,_0x4279c2[_0x397151][_0xa943('0x7d')]===_0xa943('0x7e')?![]:!![]);_0x221199[_0xa943('0x6b')](_0x4bb1a4,_0x4279c2[_0x397151][_0xa943('0xa2')]||_0x4bb1a4);}if(_0x2a4a95[_0xa943('0x80')]){_0x2a4a95[_0xa943('0x80')]=JSON[_0xa943('0x7f')](_0x2a4a95['joins']);for(var _0xe3fc2=0x0;_0xe3fc2<_0x2a4a95[_0xa943('0x80')][_0xa943('0x3d')];_0xe3fc2+=0x1){if(_0x2a4a95[_0xa943('0x80')][_0xe3fc2][_0xa943('0x45')]&&_[_0xa943('0x81')](_0xcdb0af,_0x2a4a95[_0xa943('0x80')][_0xe3fc2][_0xa943('0x45')])&&_0x2a4a95[_0xa943('0x80')][_0xe3fc2][_0xa943('0x82')]&&_0x2a4a95[_0xa943('0x80')][_0xe3fc2][_0xa943('0x84')]&&_0x2a4a95[_0xa943('0x80')][_0xe3fc2][_0xa943('0x83')]){_0x221199[_0x2a4a95['joins'][_0xe3fc2]['type']](_0x2a4a95[_0xa943('0x80')][_0xe3fc2]['foreignTable'],null,util[_0xa943('0x7b')](_0xa943('0x85'),_0x2a4a95[_0xa943('0x76')],_0x2a4a95[_0xa943('0x80')][_0xe3fc2][_0xa943('0x82')],_0x2a4a95[_0xa943('0x80')][_0xe3fc2]['foreignTable'],_0x2a4a95['joins'][_0xe3fc2][_0xa943('0x83')]));}}}if(_0x2a4a95[_0xa943('0x86')]){_0x2a4a95['conditions']=JSON[_0xa943('0x7f')](_0x2a4a95[_0xa943('0x86')]);_0x221199[_0xa943('0x42')](_0x1e685a(_0x2a4a95[_0xa943('0x86')]['group']));}_0x586189=_0x221199[_0xa943('0x87')]();_0x221199[_0xa943('0x20')](_0x220d97);_0x221199[_0xa943('0x22')](0x0);logger[_0xa943('0xa3')](_0xa943('0x88'),_0x221199[_0xa943('0x89')]());return dbH[_0xa943('0x8a')][_0xa943('0x37')](_0x221199[_0xa943('0x89')](),{'type':dbH[_0xa943('0x8a')]['QueryTypes'][_0xa943('0x8c')]});}})['then'](function(){return{'sql':_0x586189['toString']()};})['then'](respondWithResult(_0x49aff2,null))['catch'](handleError(_0x49aff2,null));}; \ No newline at end of file +var _0x2a6f=['generate','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','fork','../../components/export/','output','../../files/reports','countTable','QueryTypes','runReport','SUM(%s)','COUNT(%s)','HOUR(%s)','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','CustomReports','UserProfileResource','destroy','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','metric','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','parentKey','conditions','debug','Limited\x20Query:','sequelize','toString','SELECT','IS\x20NOT\x20EMPTY','getFields','from','table','MetricId','order','clone','web','%s-%s.%s','randomstring'];(function(_0x211769,_0x104592){var _0x155b68=function(_0x2cdc2c){while(--_0x2cdc2c){_0x211769['push'](_0x211769['shift']());}};_0x155b68(++_0x104592);}(_0x2a6f,0x15b));var _0xf2a6=function(_0x1e035c,_0xf906b){_0x1e035c=_0x1e035c-0x0;var _0x3a63f0=_0x2a6f[_0x1e035c];return _0x3a63f0;};'use strict';var emlformat=require(_0xf2a6('0x0'));var rimraf=require(_0xf2a6('0x1'));var zipdir=require(_0xf2a6('0x2'));var jsonpatch=require(_0xf2a6('0x3'));var rp=require('request-promise');var moment=require(_0xf2a6('0x4'));var BPromise=require(_0xf2a6('0x5'));var Mustache=require(_0xf2a6('0x6'));var util=require(_0xf2a6('0x7'));var path=require(_0xf2a6('0x8'));var sox=require(_0xf2a6('0x9'));var csv=require(_0xf2a6('0xa'));var ejs=require(_0xf2a6('0xb'));var fs=require('fs');var fs_extra=require(_0xf2a6('0xc'));var _=require(_0xf2a6('0xd'));var squel=require('squel');var crypto=require(_0xf2a6('0xe'));var jsforce=require(_0xf2a6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf2a6('0xa'));var querystring=require(_0xf2a6('0x10'));var Papa=require(_0xf2a6('0x11'));var Redis=require(_0xf2a6('0x12'));var authService=require(_0xf2a6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf2a6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2a6('0x15'))(_0xf2a6('0x16'));var utils=require('../../config/utils');var config=require(_0xf2a6('0x17'));var licenseUtil=require(_0xf2a6('0x18'));var db=require(_0xf2a6('0x19'))['db'];var dbH=require(_0xf2a6('0x19'))['dbH'];function respondWithStatusCode(_0x103156,_0x149fa9){_0x149fa9=_0x149fa9||0xcc;return function(_0x21f9e7){if(_0x21f9e7){return _0x103156[_0xf2a6('0x1a')](_0x149fa9);}return _0x103156[_0xf2a6('0x1b')](_0x149fa9)[_0xf2a6('0x1c')]();};}function respondWithResult(_0x4a04a5,_0x4f3188){_0x4f3188=_0x4f3188||0xc8;return function(_0x3ed6d1){if(_0x3ed6d1){return _0x4a04a5[_0xf2a6('0x1b')](_0x4f3188)['json'](_0x3ed6d1);}};}function respondWithFilteredResult(_0x3f24ea,_0x2bcbab){return function(_0x3a3a82){if(_0x3a3a82){var _0x343f4f=typeof _0x2bcbab[_0xf2a6('0x1d')]===_0xf2a6('0x1e')&&typeof _0x2bcbab['limit']===_0xf2a6('0x1e');var _0x545969=_0x3a3a82[_0xf2a6('0x1f')];var _0x15c02c=_0x343f4f?0x0:_0x2bcbab[_0xf2a6('0x1d')];var _0x5a59ae=_0x343f4f?_0x3a3a82[_0xf2a6('0x1f')]:_0x2bcbab[_0xf2a6('0x1d')]+_0x2bcbab[_0xf2a6('0x20')];var _0x4700a1;if(_0x5a59ae>=_0x545969){_0x5a59ae=_0x545969;_0x4700a1=0xc8;}else{_0x4700a1=0xce;}_0x3f24ea[_0xf2a6('0x1b')](_0x4700a1);return _0x3f24ea[_0xf2a6('0x21')](_0xf2a6('0x22'),_0x15c02c+'-'+_0x5a59ae+'/'+_0x545969)['json'](_0x3a3a82);}return null;};}function patchUpdates(_0x44734f){return function(_0x572b3d){try{jsonpatch[_0xf2a6('0x23')](_0x572b3d,_0x44734f,!![]);}catch(_0x53d929){return BPromise[_0xf2a6('0x24')](_0x53d929);}return _0x572b3d['save']();};}function saveUpdates(_0x2f4929,_0x12c83d){return function(_0x1bd734){if(_0x1bd734){return _0x1bd734[_0xf2a6('0x25')](_0x2f4929)[_0xf2a6('0x26')](function(_0x53a1b6){return _0x53a1b6;});}return null;};}function removeEntity(_0x5b7308,_0x1319e6){return function(_0x4f2a4f){if(_0x4f2a4f){return _0x4f2a4f['destroy']()[_0xf2a6('0x26')](function(){var _0x93f472=_0x4f2a4f['get']({'plain':!![]});var _0x2234db=_0xf2a6('0x27');return db[_0xf2a6('0x28')][_0xf2a6('0x29')]({'where':{'type':_0x2234db,'resourceId':_0x93f472['id']}})[_0xf2a6('0x26')](function(){return _0x4f2a4f;});})[_0xf2a6('0x26')](function(){_0x5b7308[_0xf2a6('0x1b')](0xcc)[_0xf2a6('0x1c')]();});}};}function handleEntityNotFound(_0x377bc2,_0x17d4e2){return function(_0x41b525){if(!_0x41b525){_0x377bc2[_0xf2a6('0x1a')](0x194);}return _0x41b525;};}function handleError(_0x2bf83b,_0x4b3955){_0x4b3955=_0x4b3955||0x1f4;return function(_0x47909f){logger[_0xf2a6('0x2a')](_0x47909f[_0xf2a6('0x2b')]);if(_0x47909f[_0xf2a6('0x2c')]){delete _0x47909f[_0xf2a6('0x2c')];}_0x2bf83b[_0xf2a6('0x1b')](_0x4b3955)[_0xf2a6('0x2d')](_0x47909f);};}exports['index']=function(_0x10d239,_0x191e44){var _0x2dad8a={},_0x59e93b={},_0x1c2c76={'count':0x0,'rows':[]};var _0x4db942=_[_0xf2a6('0x2e')](db[_0xf2a6('0x2f')][_0xf2a6('0x30')],function(_0x16adfe){return{'name':_0x16adfe['fieldName'],'type':_0x16adfe[_0xf2a6('0x31')][_0xf2a6('0x32')]};});_0x59e93b[_0xf2a6('0x33')]=_[_0xf2a6('0x2e')](_0x4db942,_0xf2a6('0x2c'));_0x59e93b[_0xf2a6('0x34')]=_[_0xf2a6('0x35')](_0x10d239[_0xf2a6('0x34')]);_0x59e93b['filters']=_[_0xf2a6('0x36')](_0x59e93b['model'],_0x59e93b[_0xf2a6('0x34')]);_0x2dad8a[_0xf2a6('0x37')]=_[_0xf2a6('0x36')](_0x59e93b[_0xf2a6('0x33')],qs[_0xf2a6('0x38')](_0x10d239[_0xf2a6('0x34')][_0xf2a6('0x38')]));_0x2dad8a[_0xf2a6('0x37')]=_0x2dad8a['attributes'][_0xf2a6('0x39')]?_0x2dad8a[_0xf2a6('0x37')]:_0x59e93b[_0xf2a6('0x33')];if(!_0x10d239[_0xf2a6('0x34')]['hasOwnProperty']('nolimit')){_0x2dad8a[_0xf2a6('0x20')]=qs[_0xf2a6('0x20')](_0x10d239[_0xf2a6('0x34')][_0xf2a6('0x20')]);_0x2dad8a[_0xf2a6('0x1d')]=qs[_0xf2a6('0x1d')](_0x10d239[_0xf2a6('0x34')][_0xf2a6('0x1d')]);}_0x2dad8a['order']=qs[_0xf2a6('0x3a')](_0x10d239[_0xf2a6('0x34')][_0xf2a6('0x3a')]);_0x2dad8a[_0xf2a6('0x3b')]=qs[_0xf2a6('0x3c')](_[_0xf2a6('0x3d')](_0x10d239[_0xf2a6('0x34')],_0x59e93b[_0xf2a6('0x3c')]),_0x4db942);if(_0x10d239[_0xf2a6('0x34')][_0xf2a6('0x3e')]){_0x2dad8a[_0xf2a6('0x3b')]=_[_0xf2a6('0x3f')](_0x2dad8a[_0xf2a6('0x3b')],{'$or':_[_0xf2a6('0x2e')](_0x4db942,function(_0xd4c2e1){if(_0xd4c2e1[_0xf2a6('0x31')]!==_0xf2a6('0x40')){var _0x50d420={};_0x50d420[_0xd4c2e1['name']]={'$like':'%'+_0x10d239[_0xf2a6('0x34')]['filter']+'%'};return _0x50d420;}})});}_0x2dad8a=_[_0xf2a6('0x3f')]({},_0x2dad8a,_0x10d239[_0xf2a6('0x41')]);var _0x5f037b={'where':_0x2dad8a['where']};return db['AnalyticCustomReport'][_0xf2a6('0x1f')](_0x5f037b)[_0xf2a6('0x26')](function(_0x51774c){_0x1c2c76['count']=_0x51774c;if(_0x10d239[_0xf2a6('0x34')][_0xf2a6('0x42')]){_0x2dad8a[_0xf2a6('0x43')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xf2a6('0x44')](_0x2dad8a);})[_0xf2a6('0x26')](function(_0x573c7f){_0x1c2c76[_0xf2a6('0x45')]=_0x573c7f;return _0x1c2c76;})['then'](respondWithFilteredResult(_0x191e44,_0x2dad8a))[_0xf2a6('0x46')](handleError(_0x191e44,null));};exports[_0xf2a6('0x47')]=function(_0x268100,_0x26b8de){var _0x13ca60={'raw':![],'where':{'id':_0x268100[_0xf2a6('0x48')]['id']}},_0x134021={};_0x134021[_0xf2a6('0x33')]=_['keys'](db[_0xf2a6('0x2f')][_0xf2a6('0x30')]);_0x134021[_0xf2a6('0x34')]=_[_0xf2a6('0x35')](_0x268100[_0xf2a6('0x34')]);_0x134021[_0xf2a6('0x3c')]=_['intersection'](_0x134021[_0xf2a6('0x33')],_0x134021[_0xf2a6('0x34')]);_0x13ca60[_0xf2a6('0x37')]=_[_0xf2a6('0x36')](_0x134021[_0xf2a6('0x33')],qs[_0xf2a6('0x38')](_0x268100['query'][_0xf2a6('0x38')]));_0x13ca60['attributes']=_0x13ca60[_0xf2a6('0x37')][_0xf2a6('0x39')]?_0x13ca60['attributes']:_0x134021[_0xf2a6('0x33')];if(_0x268100['query']['includeAll']){_0x13ca60[_0xf2a6('0x43')]=[{'all':!![]}];}_0x13ca60=_['merge']({},_0x13ca60,_0x268100[_0xf2a6('0x41')]);return db['AnalyticCustomReport'][_0xf2a6('0x49')](_0x13ca60)['then'](handleEntityNotFound(_0x26b8de,null))[_0xf2a6('0x26')](respondWithResult(_0x26b8de,null))['catch'](handleError(_0x26b8de,null));};exports[_0xf2a6('0x4a')]=function(_0x10e241,_0x236ae9){return db[_0xf2a6('0x2f')][_0xf2a6('0x4a')](_0x10e241[_0xf2a6('0x4b')],{})[_0xf2a6('0x26')](function(_0x5512c5){var _0x4d60e4=_0x10e241['user'][_0xf2a6('0x4c')]({'plain':!![]});if(!_0x4d60e4)throw new Error(_0xf2a6('0x4d'));if(_0x4d60e4[_0xf2a6('0x4e')]===_0xf2a6('0x4f')){var _0x2d56ca=_0x5512c5[_0xf2a6('0x4c')]({'plain':!![]});var _0x21f995='Reports';return db[_0xf2a6('0x50')][_0xf2a6('0x49')]({'where':{'name':_0x21f995,'userProfileId':_0x4d60e4[_0xf2a6('0x51')]},'raw':!![]})[_0xf2a6('0x26')](function(_0x28ecf6){if(_0x28ecf6&&_0x28ecf6[_0xf2a6('0x52')]===0x0){return db[_0xf2a6('0x28')]['create']({'name':_0x2d56ca[_0xf2a6('0x2c')],'resourceId':_0x2d56ca['id'],'type':_0xf2a6('0x27'),'sectionId':_0x28ecf6['id']},{})[_0xf2a6('0x26')](function(){return _0x5512c5;});}else{return _0x5512c5;}})[_0xf2a6('0x46')](function(_0x400485){logger[_0xf2a6('0x2a')](_0xf2a6('0x53'),_0x400485);throw _0x400485;});}return _0x5512c5;})[_0xf2a6('0x26')](respondWithResult(_0x236ae9,0xc9))['catch'](handleError(_0x236ae9,null));};exports[_0xf2a6('0x25')]=function(_0x4fa743,_0xbcfa7d){if(_0x4fa743[_0xf2a6('0x4b')]['id']){delete _0x4fa743[_0xf2a6('0x4b')]['id'];}return db[_0xf2a6('0x2f')][_0xf2a6('0x49')]({'where':{'id':_0x4fa743[_0xf2a6('0x48')]['id']}})[_0xf2a6('0x26')](handleEntityNotFound(_0xbcfa7d,null))[_0xf2a6('0x26')](saveUpdates(_0x4fa743[_0xf2a6('0x4b')],null))[_0xf2a6('0x26')](respondWithResult(_0xbcfa7d,null))['catch'](handleError(_0xbcfa7d,null));};exports[_0xf2a6('0x29')]=function(_0x3e6cfa,_0x3dd218){return db['AnalyticCustomReport'][_0xf2a6('0x49')]({'where':{'id':_0x3e6cfa[_0xf2a6('0x48')]['id']}})['then'](handleEntityNotFound(_0x3dd218,null))['then'](removeEntity(_0x3dd218,null))['catch'](handleError(_0x3dd218,null));};exports[_0xf2a6('0x54')]=function(_0x43fc31,_0x39c9d5){var _0x28ce9a=0xa;var _0x827349=[_0xf2a6('0x55'),_0xf2a6('0x56'),_0xf2a6('0x57'),_0xf2a6('0x58')];var _0x2eb5d4={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xf2a6('0x59'),'MAX':_0xf2a6('0x5a'),'MIN':_0xf2a6('0x5b'),'AVG':_0xf2a6('0x5c'),'GROUP_CONCAT':_0xf2a6('0x5d'),'GROUP_CONCAT ASC':_0xf2a6('0x5e'),'GROUP_CONCAT DESC':_0xf2a6('0x5f')};var _0x1dd74d={'SEC_TO_TIME':_0xf2a6('0x60'),'DATE':_0xf2a6('0x61'),'HOUR':'HOUR(%s)','ROUND':_0xf2a6('0x62'),'UNIX_TIMESTAMP':_0xf2a6('0x63')};var _0x217541=function(_0x254531){return!_[_0xf2a6('0x64')]([_0xf2a6('0x65'),_0xf2a6('0x66'),_0xf2a6('0x67'),'IS\x20NOT\x20EMPTY'],_0x254531);};var _0x3cd006=function(_0x5c42ff){if(!_0x5c42ff||!_0x5c42ff[_0xf2a6('0x68')][_0xf2a6('0x39')]){return'';}for(var _0x1ee2ba='(',_0x5a1a5e=0x0;_0x5a1a5e<_0x5c42ff[_0xf2a6('0x68')]['length'];_0x5a1a5e+=0x1){_0x5a1a5e>0x0&&(_0x1ee2ba+='\x20'+_0x5c42ff[_0xf2a6('0x69')]+'\x20');_0x1ee2ba+=_0x5c42ff[_0xf2a6('0x68')][_0x5a1a5e][_0xf2a6('0x6a')]?_0x3cd006(_0x5c42ff[_0xf2a6('0x68')][_0x5a1a5e][_0xf2a6('0x6a')]):_0x5c42ff['rules'][_0x5a1a5e]['field']+'\x20'+_0x5c42ff[_0xf2a6('0x68')][_0x5a1a5e][_0xf2a6('0x6b')]+(_0x217541(_0x5c42ff['rules'][_0x5a1a5e]['condition'])?'\x20'+_0x5c42ff['rules'][_0x5a1a5e][_0xf2a6('0x6c')]:'');}return _0x1ee2ba+')';};var _0x510d12={'where':{'id':_0x43fc31[_0xf2a6('0x48')]['id']}},_0x506c59,_0x2bc654,_0x53df00,_0x22c0c4,_0x1d15fc;_0x510d12=_[_0xf2a6('0x3f')]({},_0x510d12,_0x43fc31[_0xf2a6('0x41')]);return db[_0xf2a6('0x2f')]['find'](_0x510d12)[_0xf2a6('0x26')](function(_0x572684){if(_0x572684){_0x506c59=_0x572684;return _0x572684['getFields']();}return null;})['then'](function(_0x2f9c2a){if(_0x2f9c2a){if(!_0x2f9c2a[_0xf2a6('0x39')]){throw new db[(_0xf2a6('0x6d'))][(_0xf2a6('0x6e'))](_0xf2a6('0x6f'),0x193);}_0x2bc654=_0x2f9c2a;return db[_0xf2a6('0x70')][_0xf2a6('0x44')]({'raw':!![]});}return null;})['then'](function(_0x2dd768){if(_0x2dd768){_0x53df00=_[_0xf2a6('0x71')](_0x2dd768,'id');var _0x14dacb;var _0x563316=squel[_0xf2a6('0x72')]();_0x563316['from'](_0x506c59['table']);for(var _0xb9ad89=0x0;_0xb9ad89<_0x2bc654[_0xf2a6('0x39')];_0xb9ad89+=0x1){_0x14dacb=_0x2bc654[_0xb9ad89]['MetricId']?_0x53df00[_0x2bc654[_0xb9ad89]['MetricId']][_0xf2a6('0x73')]:_0x2bc654[_0xb9ad89][_0xf2a6('0x74')];_0x14dacb=_0x2bc654[_0xb9ad89][_0xf2a6('0x75')]?_[_0xf2a6('0x76')](_0x2eb5d4[_0x2bc654[_0xb9ad89][_0xf2a6('0x75')]],'%s',_0x14dacb):_0x14dacb;_0x14dacb=_0x2bc654[_0xb9ad89][_0xf2a6('0x77')]?_['replace'](_0x1dd74d[_0x2bc654[_0xb9ad89][_0xf2a6('0x77')]],'%s',_0x14dacb):_0x14dacb;if(_0x2bc654[_0xb9ad89][_0xf2a6('0x78')]){_0x563316[_0xf2a6('0x6a')](_0x14dacb);}_0x2bc654[_0xb9ad89][_0xf2a6('0x79')]&&_0x563316['order'](_0x14dacb,_0x2bc654[_0xb9ad89][_0xf2a6('0x79')]===_0xf2a6('0x7a')?![]:!![]);_0x563316['field'](_0x14dacb,_0x2bc654[_0xb9ad89][_0xf2a6('0x7b')]||_0x14dacb);}if(_0x506c59[_0xf2a6('0x7c')]){_0x506c59[_0xf2a6('0x7c')]=JSON[_0xf2a6('0x7d')](_0x506c59[_0xf2a6('0x7c')]);for(var _0x31009a=0x0;_0x31009a<_0x506c59[_0xf2a6('0x7c')][_0xf2a6('0x39')];_0x31009a+=0x1){if(_0x506c59[_0xf2a6('0x7c')][_0x31009a][_0xf2a6('0x31')]&&_[_0xf2a6('0x64')](_0x827349,_0x506c59[_0xf2a6('0x7c')][_0x31009a][_0xf2a6('0x31')])&&_0x506c59[_0xf2a6('0x7c')][_0x31009a]['parentKey']&&_0x506c59['joins'][_0x31009a][_0xf2a6('0x7e')]&&_0x506c59['joins'][_0x31009a][_0xf2a6('0x7f')]){_0x563316[_0x506c59[_0xf2a6('0x7c')][_0x31009a][_0xf2a6('0x31')]](_0x506c59[_0xf2a6('0x7c')][_0x31009a]['foreignTable'],null,util[_0xf2a6('0x77')]('%s.%s\x20=\x20%s.%s',_0x506c59['table'],_0x506c59['joins'][_0x31009a][_0xf2a6('0x80')],_0x506c59[_0xf2a6('0x7c')][_0x31009a]['foreignTable'],_0x506c59['joins'][_0x31009a][_0xf2a6('0x7f')]));}}}if(_0x506c59[_0xf2a6('0x81')]){_0x506c59[_0xf2a6('0x81')]=JSON[_0xf2a6('0x7d')](_0x506c59[_0xf2a6('0x81')]);_0x563316['where'](_0x3cd006(_0x506c59[_0xf2a6('0x81')][_0xf2a6('0x6a')]));}_0x1d15fc=_0x563316['clone']();_0x563316[_0xf2a6('0x20')](_0x28ce9a);_0x563316[_0xf2a6('0x1d')](0x0);logger[_0xf2a6('0x82')](_0xf2a6('0x83'),_0x563316['toString']());return dbH[_0xf2a6('0x84')]['query'](_0x563316[_0xf2a6('0x85')](),{'type':dbH['sequelize']['QueryTypes'][_0xf2a6('0x86')]});}})[_0xf2a6('0x26')](respondWithResult(_0x39c9d5,null))[_0xf2a6('0x46')](handleError(_0x39c9d5,null));};function runReport(_0x55cce8,_0x5379f0,_0x43b46a){var _0x2845f0=_0x5379f0[_0xf2a6('0x2c')];var _0x2b9ee9=0xa;var _0x4e1f47=[_0xf2a6('0x55'),_0xf2a6('0x56'),_0xf2a6('0x57'),_0xf2a6('0x58')];var _0x334d58={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xf2a6('0x59'),'MAX':_0xf2a6('0x5a'),'MIN':_0xf2a6('0x5b'),'AVG':_0xf2a6('0x5c'),'GROUP_CONCAT':_0xf2a6('0x5d'),'GROUP_CONCAT ASC':_0xf2a6('0x5e'),'GROUP_CONCAT DESC':_0xf2a6('0x5f')};var _0x21179c={'SEC_TO_TIME':_0xf2a6('0x60'),'DATE':_0xf2a6('0x61'),'HOUR':'HOUR(%s)','ROUND':_0xf2a6('0x62'),'UNIX_TIMESTAMP':_0xf2a6('0x63')};var _0xc733dc=function(_0x388ca3){return!_[_0xf2a6('0x64')]([_0xf2a6('0x65'),_0xf2a6('0x66'),'IS\x20EMPTY',_0xf2a6('0x87')],_0x388ca3);};var _0x29757f=function(_0x22e26d){if(!_0x22e26d||!_0x22e26d[_0xf2a6('0x68')][_0xf2a6('0x39')]){return'';}for(var _0x210b30='(',_0x357684=0x0;_0x357684<_0x22e26d['rules']['length'];_0x357684+=0x1){_0x357684>0x0&&(_0x210b30+='\x20'+_0x22e26d[_0xf2a6('0x69')]+'\x20');_0x210b30+=_0x22e26d['rules'][_0x357684][_0xf2a6('0x6a')]?_0x29757f(_0x22e26d['rules'][_0x357684][_0xf2a6('0x6a')]):_0x22e26d[_0xf2a6('0x68')][_0x357684][_0xf2a6('0x74')]+'\x20'+_0x22e26d[_0xf2a6('0x68')][_0x357684][_0xf2a6('0x6b')]+(_0xc733dc(_0x22e26d[_0xf2a6('0x68')][_0x357684][_0xf2a6('0x6b')])?'\x20'+_0x22e26d['rules'][_0x357684][_0xf2a6('0x6c')]:'');}return _0x210b30+')';};var _0x3f9206={'where':{'id':_0x55cce8['id']}},_0x14755b,_0x1ff797,_0x199d4d,_0x169071,_0x546a6c;_0x3f9206=_[_0xf2a6('0x3f')]({},_0x3f9206,_0x43b46a);return db['AnalyticCustomReport'][_0xf2a6('0x49')](_0x3f9206)[_0xf2a6('0x26')](function(_0x11e12e){if(_0x11e12e){_0x14755b=_0x11e12e;return _0x11e12e[_0xf2a6('0x88')]();}return null;})[_0xf2a6('0x26')](function(_0x3374fb){if(_0x3374fb){if(!_0x3374fb[_0xf2a6('0x39')]){throw new db[(_0xf2a6('0x6d'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1ff797=_0x3374fb;return db['AnalyticMetric'][_0xf2a6('0x44')]({'raw':!![]});}return null;})['then'](function(_0x1fd4b7){if(_0x1fd4b7){_0x199d4d=_[_0xf2a6('0x71')](_0x1fd4b7,'id');var _0x1be18b;var _0xbb8380=squel[_0xf2a6('0x72')]();_0xbb8380[_0xf2a6('0x89')](_0x14755b[_0xf2a6('0x8a')]);for(var _0x392f76=0x0;_0x392f76<_0x1ff797['length'];_0x392f76+=0x1){_0x1be18b=_0x1ff797[_0x392f76]['MetricId']?_0x199d4d[_0x1ff797[_0x392f76][_0xf2a6('0x8b')]][_0xf2a6('0x73')]:_0x1ff797[_0x392f76][_0xf2a6('0x74')];_0x1be18b=_0x1ff797[_0x392f76][_0xf2a6('0x75')]?_['replace'](_0x334d58[_0x1ff797[_0x392f76][_0xf2a6('0x75')]],'%s',_0x1be18b):_0x1be18b;_0x1be18b=_0x1ff797[_0x392f76]['format']?_[_0xf2a6('0x76')](_0x21179c[_0x1ff797[_0x392f76][_0xf2a6('0x77')]],'%s',_0x1be18b):_0x1be18b;if(_0x1ff797[_0x392f76][_0xf2a6('0x78')]){_0xbb8380[_0xf2a6('0x6a')](_0x1be18b);}_0x1ff797[_0x392f76][_0xf2a6('0x79')]&&_0xbb8380[_0xf2a6('0x8c')](_0x1be18b,_0x1ff797[_0x392f76][_0xf2a6('0x79')]===_0xf2a6('0x7a')?![]:!![]);_0xbb8380[_0xf2a6('0x74')](_0x1be18b,_0x1ff797[_0x392f76][_0xf2a6('0x7b')]||_0x1be18b);}if(_0x14755b[_0xf2a6('0x7c')]){_0x14755b[_0xf2a6('0x7c')]=JSON[_0xf2a6('0x7d')](_0x14755b['joins']);for(var _0x22d26f=0x0;_0x22d26f<_0x14755b[_0xf2a6('0x7c')][_0xf2a6('0x39')];_0x22d26f+=0x1){if(_0x14755b['joins'][_0x22d26f][_0xf2a6('0x31')]&&_[_0xf2a6('0x64')](_0x4e1f47,_0x14755b[_0xf2a6('0x7c')][_0x22d26f][_0xf2a6('0x31')])&&_0x14755b['joins'][_0x22d26f][_0xf2a6('0x80')]&&_0x14755b[_0xf2a6('0x7c')][_0x22d26f][_0xf2a6('0x7e')]&&_0x14755b[_0xf2a6('0x7c')][_0x22d26f][_0xf2a6('0x7f')]){_0xbb8380[_0x14755b[_0xf2a6('0x7c')][_0x22d26f]['type']](_0x14755b[_0xf2a6('0x7c')][_0x22d26f]['foreignTable'],null,util[_0xf2a6('0x77')]('%s.%s\x20=\x20%s.%s',_0x14755b['table'],_0x14755b[_0xf2a6('0x7c')][_0x22d26f][_0xf2a6('0x80')],_0x14755b[_0xf2a6('0x7c')][_0x22d26f][_0xf2a6('0x7e')],_0x14755b[_0xf2a6('0x7c')][_0x22d26f]['foreignKey']));}}}if(_0x14755b[_0xf2a6('0x81')]){_0x14755b['conditions']=JSON[_0xf2a6('0x7d')](_0x14755b[_0xf2a6('0x81')]);_0xbb8380[_0xf2a6('0x3b')](_0x29757f(_0x14755b[_0xf2a6('0x81')]['group']));}_0x546a6c=_0xbb8380[_0xf2a6('0x8d')]();_0xbb8380[_0xf2a6('0x20')](_0x2b9ee9);_0xbb8380['offset'](0x0);return;}})[_0xf2a6('0x26')](function(){if(_0x5379f0['output']===_0xf2a6('0x8e')){return null;}var _0x3ebcac=_[_0xf2a6('0x3f')](_0x5379f0,{'name':_0x5379f0['fullPath']||_0x5379f0[_0xf2a6('0x2c')]||_0x14755b[_0xf2a6('0x2c')],'basename':_0x2845f0,'savename':util[_0xf2a6('0x77')](_0xf2a6('0x8f'),_0x5379f0[_0xf2a6('0x2c')]||_0x14755b['name'],require(_0xf2a6('0x90'))[_0xf2a6('0x91')](0x4),_0x5379f0['output']||'csv'),'reportId':_0x14755b['id'],'reportType':'custom'});return db[_0xf2a6('0x92')][_0xf2a6('0x4a')](_0x3ebcac,{'raw':!![]});})[_0xf2a6('0x26')](function(_0x4867ac){if(_0x14755b[_0xf2a6('0x8a')]===_0xf2a6('0x93')){_0x546a6c['where'](_0x14755b[_0xf2a6('0x8a')]+_0xf2a6('0x94'),_0x5379f0['startDate'],_0x5379f0[_0xf2a6('0x95')]);}else{_0x546a6c[_0xf2a6('0x3b')](_0x14755b[_0xf2a6('0x8a')]+_0xf2a6('0x96'),_0x5379f0[_0xf2a6('0x97')],_0x5379f0[_0xf2a6('0x95')]);}if(_0x4867ac){logger[_0xf2a6('0x98')]('Run\x20Query:',_0x546a6c[_0xf2a6('0x85')]());require('child_process')[_0xf2a6('0x99')](path[_0xf2a6('0x55')](__dirname,_0xf2a6('0x9a'),_0x4867ac[_0xf2a6('0x9b')]),[_0x4867ac['id'],_0x546a6c[_0xf2a6('0x85')](),path[_0xf2a6('0x55')](__dirname,_0xf2a6('0x9c'),_0x4867ac['savename']),_0x2845f0]);return _0x4867ac;}else{var _0x58dfa0=squel['select']();_0x58dfa0[_0xf2a6('0x89')]('('+_0x546a6c[_0xf2a6('0x85')]()+')',_0xf2a6('0x9d'));_0x58dfa0[_0xf2a6('0x74')]('COUNT(*)',_0xf2a6('0x1f'));_0x546a6c[_0xf2a6('0x20')](_0x5379f0['limit']||_0x2b9ee9);_0x546a6c[_0xf2a6('0x1d')](_0x5379f0[_0xf2a6('0x1d')]||0x0);return dbH['sequelize'][_0xf2a6('0x34')](_0x58dfa0[_0xf2a6('0x85')](),{'type':dbH[_0xf2a6('0x84')][_0xf2a6('0x9e')][_0xf2a6('0x86')]})[_0xf2a6('0x26')](function(_0x4a3a53){if(!_0x4a3a53['length']){_0x169071=0x0;}else{_0x169071=_0x4a3a53[0x0][_0xf2a6('0x1f')]||0x0;}return dbH['sequelize'][_0xf2a6('0x34')](_0x546a6c[_0xf2a6('0x85')](),{'type':dbH[_0xf2a6('0x84')][_0xf2a6('0x9e')][_0xf2a6('0x86')]});})['then'](function(_0xc8143f){return{'rows':_0xc8143f||[],'count':_0x169071};});}});}exports['run']=function(_0x1291de,_0x16d6da){return runReport(_0x1291de[_0xf2a6('0x48')],_0x1291de['query'],_0x1291de[_0xf2a6('0x41')])[_0xf2a6('0x26')](respondWithResult(_0x16d6da,null))[_0xf2a6('0x46')](handleError(_0x16d6da,null));};exports[_0xf2a6('0x9f')]=runReport;exports[_0xf2a6('0x34')]=function(_0x10f12a,_0x26528a){var _0x989dd7=0xa;var _0x154bc8=[_0xf2a6('0x55'),_0xf2a6('0x56'),_0xf2a6('0x57'),_0xf2a6('0x58')];var _0x6b8398={'SUM':_0xf2a6('0xa0'),'COUNT':_0xf2a6('0xa1'),'COUNT DISTINCT':_0xf2a6('0x59'),'MAX':_0xf2a6('0x5a'),'MIN':_0xf2a6('0x5b'),'AVG':_0xf2a6('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf2a6('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x37bd4a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf2a6('0x61'),'HOUR':_0xf2a6('0xa2'),'ROUND':_0xf2a6('0x62'),'UNIX_TIMESTAMP':_0xf2a6('0x63')};var _0x5830c0=function(_0x35c7de){return!_[_0xf2a6('0x64')]([_0xf2a6('0x65'),_0xf2a6('0x66'),_0xf2a6('0x67'),_0xf2a6('0x87')],_0x35c7de);};var _0xbf1a42=function(_0x3f698d){if(!_0x3f698d||!_0x3f698d[_0xf2a6('0x68')][_0xf2a6('0x39')]){return'';}for(var _0x4979f9='(',_0x2b070b=0x0;_0x2b070b<_0x3f698d[_0xf2a6('0x68')][_0xf2a6('0x39')];_0x2b070b+=0x1){_0x2b070b>0x0&&(_0x4979f9+='\x20'+_0x3f698d['operator']+'\x20');_0x4979f9+=_0x3f698d['rules'][_0x2b070b][_0xf2a6('0x6a')]?_0xbf1a42(_0x3f698d[_0xf2a6('0x68')][_0x2b070b][_0xf2a6('0x6a')]):_0x3f698d[_0xf2a6('0x68')][_0x2b070b][_0xf2a6('0x74')]+'\x20'+_0x3f698d[_0xf2a6('0x68')][_0x2b070b]['condition']+(_0x5830c0(_0x3f698d['rules'][_0x2b070b][_0xf2a6('0x6b')])?'\x20'+_0x3f698d[_0xf2a6('0x68')][_0x2b070b][_0xf2a6('0x6c')]:'');}return _0x4979f9+')';};var _0x41c1a6={'where':{'id':_0x10f12a[_0xf2a6('0x48')]['id']}},_0x18820a,_0x80395a,_0x59637a,_0x4e4f10,_0x57b87b;_0x41c1a6=_['merge']({},_0x41c1a6,_0x10f12a[_0xf2a6('0x41')]);return db[_0xf2a6('0x2f')][_0xf2a6('0x49')](_0x41c1a6)['then'](function(_0x175b38){if(_0x175b38){_0x18820a=_0x175b38;return _0x175b38[_0xf2a6('0x88')]();}return null;})[_0xf2a6('0x26')](function(_0x5ec40a){if(_0x5ec40a){if(!_0x5ec40a[_0xf2a6('0x39')]){throw new db[(_0xf2a6('0x6d'))][(_0xf2a6('0x6e'))](_0xf2a6('0x6f'),0x193);}_0x80395a=_0x5ec40a;return db[_0xf2a6('0x70')][_0xf2a6('0x44')]({'raw':!![]});}return null;})['then'](function(_0x37bbf3){if(_0x37bbf3){_0x59637a=_[_0xf2a6('0x71')](_0x37bbf3,'id');var _0x49432b;var _0x49eb02=squel[_0xf2a6('0x72')]();_0x49eb02[_0xf2a6('0x89')](_0x18820a[_0xf2a6('0x8a')]);for(var _0x48d179=0x0;_0x48d179<_0x80395a[_0xf2a6('0x39')];_0x48d179+=0x1){_0x49432b=_0x80395a[_0x48d179]['MetricId']?_0x59637a[_0x80395a[_0x48d179]['MetricId']]['metric']:_0x80395a[_0x48d179][_0xf2a6('0x74')];_0x49432b=_0x80395a[_0x48d179]['function']?_[_0xf2a6('0x76')](_0x6b8398[_0x80395a[_0x48d179][_0xf2a6('0x75')]],'%s',_0x49432b):_0x49432b;_0x49432b=_0x80395a[_0x48d179][_0xf2a6('0x77')]?_[_0xf2a6('0x76')](_0x37bd4a[_0x80395a[_0x48d179][_0xf2a6('0x77')]],'%s',_0x49432b):_0x49432b;if(_0x80395a[_0x48d179][_0xf2a6('0x78')]){_0x49eb02[_0xf2a6('0x6a')](_0x49432b);}_0x80395a[_0x48d179][_0xf2a6('0x79')]&&_0x49eb02['order'](_0x49432b,_0x80395a[_0x48d179]['orderBy']===_0xf2a6('0x7a')?![]:!![]);_0x49eb02[_0xf2a6('0x74')](_0x49432b,_0x80395a[_0x48d179][_0xf2a6('0x7b')]||_0x49432b);}if(_0x18820a[_0xf2a6('0x7c')]){_0x18820a[_0xf2a6('0x7c')]=JSON[_0xf2a6('0x7d')](_0x18820a['joins']);for(var _0x3c0f2d=0x0;_0x3c0f2d<_0x18820a[_0xf2a6('0x7c')][_0xf2a6('0x39')];_0x3c0f2d+=0x1){if(_0x18820a[_0xf2a6('0x7c')][_0x3c0f2d][_0xf2a6('0x31')]&&_[_0xf2a6('0x64')](_0x154bc8,_0x18820a['joins'][_0x3c0f2d][_0xf2a6('0x31')])&&_0x18820a[_0xf2a6('0x7c')][_0x3c0f2d][_0xf2a6('0x80')]&&_0x18820a[_0xf2a6('0x7c')][_0x3c0f2d][_0xf2a6('0x7e')]&&_0x18820a[_0xf2a6('0x7c')][_0x3c0f2d][_0xf2a6('0x7f')]){_0x49eb02[_0x18820a[_0xf2a6('0x7c')][_0x3c0f2d][_0xf2a6('0x31')]](_0x18820a[_0xf2a6('0x7c')][_0x3c0f2d][_0xf2a6('0x7e')],null,util[_0xf2a6('0x77')](_0xf2a6('0xa3'),_0x18820a['table'],_0x18820a[_0xf2a6('0x7c')][_0x3c0f2d][_0xf2a6('0x80')],_0x18820a[_0xf2a6('0x7c')][_0x3c0f2d][_0xf2a6('0x7e')],_0x18820a[_0xf2a6('0x7c')][_0x3c0f2d]['foreignKey']));}}}if(_0x18820a[_0xf2a6('0x81')]){_0x18820a[_0xf2a6('0x81')]=JSON[_0xf2a6('0x7d')](_0x18820a[_0xf2a6('0x81')]);_0x49eb02[_0xf2a6('0x3b')](_0xbf1a42(_0x18820a[_0xf2a6('0x81')][_0xf2a6('0x6a')]));}_0x57b87b=_0x49eb02[_0xf2a6('0x8d')]();_0x49eb02[_0xf2a6('0x20')](_0x989dd7);_0x49eb02[_0xf2a6('0x1d')](0x0);logger[_0xf2a6('0x82')](_0xf2a6('0x83'),_0x49eb02[_0xf2a6('0x85')]());return dbH[_0xf2a6('0x84')][_0xf2a6('0x34')](_0x49eb02[_0xf2a6('0x85')](),{'type':dbH[_0xf2a6('0x84')]['QueryTypes'][_0xf2a6('0x86')]});}})[_0xf2a6('0x26')](function(){return{'sql':_0x57b87b['toString']()};})[_0xf2a6('0x26')](respondWithResult(_0x26528a,null))['catch'](handleError(_0x26528a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 85973f3..61dd5b3 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 _0x0e37=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','bluebird','request-promise','../../config/environment','./analyticCustomReport.attributes'];(function(_0x43b56c,_0x30d616){var _0x24fa06=function(_0x9fef48){while(--_0x9fef48){_0x43b56c['push'](_0x43b56c['shift']());}};_0x24fa06(++_0x30d616);}(_0x0e37,0x1bc));var _0x70e3=function(_0x149cca,_0x3bed94){_0x149cca=_0x149cca-0x0;var _0x22a5a5=_0x0e37[_0x149cca];return _0x22a5a5;};'use strict';var _=require(_0x70e3('0x0'));var util=require(_0x70e3('0x1'));var logger=require('../../config/logger')(_0x70e3('0x2'));var moment=require('moment');var BPromise=require(_0x70e3('0x3'));var rp=require(_0x70e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x70e3('0x5'));var attributes=require(_0x70e3('0x6'));module[_0x70e3('0x7')]=function(_0x4de153,_0x2ac97b){return _0x4de153[_0x70e3('0x8')](_0x70e3('0x9'),attributes,{'tableName':_0x70e3('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x114b=['analytics_custom_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport'];(function(_0x2e4eea,_0x5db9bf){var _0x3e5788=function(_0x381fc0){while(--_0x381fc0){_0x2e4eea['push'](_0x2e4eea['shift']());}};_0x3e5788(++_0x5db9bf);}(_0x114b,0x143));var _0xb114=function(_0x2ebc82,_0x3e0c84){_0x2ebc82=_0x2ebc82-0x0;var _0x4a7c60=_0x114b[_0x2ebc82];return _0x4a7c60;};'use strict';var _=require(_0xb114('0x0'));var util=require(_0xb114('0x1'));var logger=require(_0xb114('0x2'))(_0xb114('0x3'));var moment=require(_0xb114('0x4'));var BPromise=require('bluebird');var rp=require(_0xb114('0x5'));var fs=require('fs');var path=require(_0xb114('0x6'));var rimraf=require(_0xb114('0x7'));var config=require(_0xb114('0x8'));var attributes=require(_0xb114('0x9'));module[_0xb114('0xa')]=function(_0x9a8dea,_0x10c5c1){return _0x9a8dea[_0xb114('0xb')](_0xb114('0xc'),attributes,{'tableName':_0xb114('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 8fc3364..0de35c6 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 _0x6966=['code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2fa263,_0x38401e){var _0x13f4ea=function(_0x29f2a3){while(--_0x29f2a3){_0x2fa263['push'](_0x2fa263['shift']());}};_0x13f4ea(++_0x38401e);}(_0x6966,0x16c));var _0x6696=function(_0x6778ea,_0x4f0351){_0x6778ea=_0x6778ea-0x0;var _0x3c3620=_0x6966[_0x6778ea];return _0x3c3620;};'use strict';var _=require(_0x6696('0x0'));var util=require(_0x6696('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6696('0x2'));var fs=require('fs');var Redis=require(_0x6696('0x3'));var db=require(_0x6696('0x4'))['db'];var utils=require(_0x6696('0x5'));var logger=require(_0x6696('0x6'))(_0x6696('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6696('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x549d30,_0xaeca96,_0x1d175b){return new BPromise(function(_0x21864f,_0x287b41){return client[_0x6696('0x9')](_0x549d30,_0x1d175b)[_0x6696('0xa')](function(_0x432b37){logger[_0x6696('0xb')](_0x6696('0xc'),_0xaeca96,_0x6696('0xd'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0xaeca96,_0x6696('0xd'),JSON[_0x6696('0xe')](_0x432b37));if(_0x432b37[_0x6696('0xf')]){if(_0x432b37['error'][_0x6696('0x10')]===0x1f4){logger[_0x6696('0xf')](_0x6696('0xc'),_0xaeca96,_0x432b37[_0x6696('0xf')][_0x6696('0x11')]);return _0x287b41(_0x432b37['error'][_0x6696('0x11')]);}logger[_0x6696('0xf')](_0x6696('0xc'),_0xaeca96,_0x432b37[_0x6696('0xf')]['message']);return _0x21864f(_0x432b37[_0x6696('0xf')][_0x6696('0x11')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0xaeca96,_0x6696('0xd'));_0x21864f(_0x432b37[_0x6696('0x12')][_0x6696('0x11')]);}})[_0x6696('0x13')](function(_0x356938){logger[_0x6696('0xf')](_0x6696('0xc'),_0xaeca96,_0x356938);_0x287b41(_0x356938);});});} \ No newline at end of file +var _0x8d97=['AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xff3db9,_0x4a1caa){var _0x6db1db=function(_0x3987f2){while(--_0x3987f2){_0xff3db9['push'](_0xff3db9['shift']());}};_0x6db1db(++_0x4a1caa);}(_0x8d97,0x70));var _0x78d9=function(_0x3361c3,_0x36ac46){_0x3361c3=_0x3361c3-0x0;var _0x26d9c1=_0x8d97[_0x3361c3];return _0x26d9c1;};'use strict';var _=require('lodash');var util=require(_0x78d9('0x0'));var moment=require(_0x78d9('0x1'));var BPromise=require(_0x78d9('0x2'));var rs=require(_0x78d9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78d9('0x4'))['db'];var utils=require(_0x78d9('0x5'));var logger=require('../../config/logger')(_0x78d9('0x6'));var config=require(_0x78d9('0x7'));var jayson=require(_0x78d9('0x8'));var client=jayson[_0x78d9('0x9')][_0x78d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x237384,_0x2eeac5,_0x54a722){return new BPromise(function(_0x1bf064,_0x5be5a8){return client[_0x78d9('0xb')](_0x237384,_0x54a722)[_0x78d9('0xc')](function(_0x23d5f4){logger[_0x78d9('0xd')](_0x78d9('0xe'),_0x2eeac5,_0x78d9('0xf'));logger['debug'](_0x78d9('0x10'),_0x2eeac5,_0x78d9('0xf'),JSON['stringify'](_0x23d5f4));if(_0x23d5f4[_0x78d9('0x11')]){if(_0x23d5f4[_0x78d9('0x11')][_0x78d9('0x12')]===0x1f4){logger[_0x78d9('0x11')](_0x78d9('0xe'),_0x2eeac5,_0x23d5f4[_0x78d9('0x11')][_0x78d9('0x13')]);return _0x5be5a8(_0x23d5f4[_0x78d9('0x11')]['message']);}logger[_0x78d9('0x11')](_0x78d9('0xe'),_0x2eeac5,_0x23d5f4[_0x78d9('0x11')]['message']);return _0x1bf064(_0x23d5f4['error'][_0x78d9('0x13')]);}else{logger['info'](_0x78d9('0xe'),_0x2eeac5,'request\x20sent');_0x1bf064(_0x23d5f4['result']['message']);}})[_0x78d9('0x14')](function(_0x2cfa09){logger['error'](_0x78d9('0xe'),_0x2eeac5,_0x2cfa09);_0x5be5a8(_0x2cfa09);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 5ceb483..c811b19 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 _0x0afb=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','delete'];(function(_0xd85ad5,_0xf2202d){var _0x3ff8f4=function(_0x19fbe9){while(--_0x19fbe9){_0xd85ad5['push'](_0xd85ad5['shift']());}};_0x3ff8f4(++_0xf2202d);}(_0x0afb,0x161));var _0xb0af=function(_0x5665fd,_0x2c4e87){_0x5665fd=_0x5665fd-0x0;var _0x42cbf1=_0x0afb[_0x5665fd];return _0x42cbf1;};'use strict';var multer=require(_0xb0af('0x0'));var util=require(_0xb0af('0x1'));var path=require(_0xb0af('0x2'));var timeout=require(_0xb0af('0x3'));var express=require(_0xb0af('0x4'));var router=express[_0xb0af('0x5')]();var fs_extra=require(_0xb0af('0x6'));var auth=require(_0xb0af('0x7'));var interaction=require(_0xb0af('0x8'));var config=require(_0xb0af('0x9'));var controller=require(_0xb0af('0xa'));router[_0xb0af('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb0af('0xc'),auth[_0xb0af('0xd')](),controller[_0xb0af('0xe')]);router[_0xb0af('0xb')](_0xb0af('0xf'),auth[_0xb0af('0xd')](),controller[_0xb0af('0x10')]);router['get'](_0xb0af('0x11'),auth[_0xb0af('0xd')](),controller['run']);router[_0xb0af('0xb')](_0xb0af('0x12'),auth[_0xb0af('0xd')](),controller[_0xb0af('0x13')]);router[_0xb0af('0x14')]('/',auth[_0xb0af('0xd')](),controller[_0xb0af('0x15')]);router[_0xb0af('0x16')](_0xb0af('0xc'),auth[_0xb0af('0xd')](),controller[_0xb0af('0x17')]);router[_0xb0af('0x18')](_0xb0af('0xc'),auth['isAuthenticated'](),controller[_0xb0af('0x19')]);module[_0xb0af('0x1a')]=router; \ No newline at end of file +var _0x863e=['util','path','Router','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer'];(function(_0x76a8f4,_0x6b3a8a){var _0x2d9865=function(_0x380bf6){while(--_0x380bf6){_0x76a8f4['push'](_0x76a8f4['shift']());}};_0x2d9865(++_0x6b3a8a);}(_0x863e,0x197));var _0xe863=function(_0x39f211,_0x3b551b){_0x39f211=_0x39f211-0x0;var _0x1c1f5c=_0x863e[_0x39f211];return _0x1c1f5c;};'use strict';var multer=require(_0xe863('0x0'));var util=require(_0xe863('0x1'));var path=require(_0xe863('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe863('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe863('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe863('0x5'));var controller=require(_0xe863('0x6'));router[_0xe863('0x7')]('/',auth[_0xe863('0x8')](),controller[_0xe863('0x9')]);router[_0xe863('0x7')](_0xe863('0xa'),auth[_0xe863('0x8')](),controller[_0xe863('0xb')]);router[_0xe863('0x7')](_0xe863('0xc'),auth['isAuthenticated'](),controller[_0xe863('0xd')]);router[_0xe863('0x7')](_0xe863('0xe'),auth[_0xe863('0x8')](),controller['run']);router['get'](_0xe863('0xf'),auth['isAuthenticated'](),controller[_0xe863('0x10')]);router[_0xe863('0x11')]('/',auth['isAuthenticated'](),controller[_0xe863('0x12')]);router[_0xe863('0x13')](_0xe863('0xa'),auth[_0xe863('0x8')](),controller[_0xe863('0x14')]);router[_0xe863('0x15')]('/:id',auth[_0xe863('0x8')](),controller[_0xe863('0x16')]);module[_0xe863('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index cabf9c3..23bfd2d 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 _0x9c5a=['exports','STRING','TEXT','sequelize'];(function(_0x4fcfb7,_0x443608){var _0x3a69f0=function(_0xef13a7){while(--_0xef13a7){_0x4fcfb7['push'](_0x4fcfb7['shift']());}};_0x3a69f0(++_0x443608);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x1fc5b,_0x59cf5f){_0x1fc5b=_0x1fc5b-0x0;var _0x24ed82=_0x9c5a[_0x1fc5b];return _0x24ed82;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa9c5('0x2')]},'parent':{'type':Sequelize[_0xa9c5('0x2')]},'table':{'type':Sequelize[_0xa9c5('0x2')]},'conditions':{'type':Sequelize[_0xa9c5('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6f47=['TEXT','exports','STRING'];(function(_0x1af43f,_0x2850a6){var _0x51c01f=function(_0x1a19ba){while(--_0x1a19ba){_0x1af43f['push'](_0x1af43f['shift']());}};_0x51c01f(++_0x2850a6);}(_0x6f47,0xc7));var _0x76f4=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x6f47[_0x5c9307];return _0x373e29;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index dc9d92a..336f645 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 _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x3cecc6,_0x517799){var _0x3804aa=function(_0x3ed176){while(--_0x3ed176){_0x3cecc6['push'](_0x3cecc6['shift']());}};_0x3804aa(++_0x517799);}(_0x4975,0x86));var _0x5497=function(_0x389011,_0x46b8d6){_0x389011=_0x389011-0x0;var _0x562a16=_0x4975[_0x389011];return _0x562a16;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));}; \ No newline at end of file +var _0x814b=['attributes','intersection','length','nolimit','limit','order','where','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','right_join','MAX(%s)','operator','value','Sequelize','keyBy','from','groupBy','%s.%s\x20=\x20%s.%s','output','web','fullPath','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','SELECT','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','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','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','map','AnalyticDefaultReport','fieldName','type','model','query','keys','filters'];(function(_0x159b5b,_0xa14fb5){var _0x5cdc49=function(_0x447cf6){while(--_0x447cf6){_0x159b5b['push'](_0x159b5b['shift']());}};_0x5cdc49(++_0xa14fb5);}(_0x814b,0x1a2));var _0xb814=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x814b[_0x59d89e];return _0x554e93;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];var dbH=require(_0xb814('0x1a'))[_0xb814('0x1b')];function respondWithStatusCode(_0x2ce718,_0x3bde14){_0x3bde14=_0x3bde14||0xcc;return function(_0x1438e7){if(_0x1438e7){return _0x2ce718[_0xb814('0x1c')](_0x3bde14);}return _0x2ce718[_0xb814('0x1d')](_0x3bde14)[_0xb814('0x1e')]();};}function respondWithResult(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xc8;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x1d')](_0x44fb96)[_0xb814('0x1f')](_0x17f5bd);}};}function respondWithFilteredResult(_0x3a71d6,_0x45e0d0){return function(_0x265a83){if(_0x265a83){var _0x125ce2=typeof _0x45e0d0[_0xb814('0x20')]===_0xb814('0x21')&&typeof _0x45e0d0['limit']===_0xb814('0x21');var _0x55ba16=_0x265a83[_0xb814('0x22')];var _0xfac75b=_0x125ce2?0x0:_0x45e0d0['offset'];var _0x4b55a7=_0x125ce2?_0x265a83['count']:_0x45e0d0[_0xb814('0x20')]+_0x45e0d0['limit'];var _0x57c128;if(_0x4b55a7>=_0x55ba16){_0x4b55a7=_0x55ba16;_0x57c128=0xc8;}else{_0x57c128=0xce;}_0x3a71d6[_0xb814('0x1d')](_0x57c128);return _0x3a71d6[_0xb814('0x23')](_0xb814('0x24'),_0xfac75b+'-'+_0x4b55a7+'/'+_0x55ba16)['json'](_0x265a83);}return null;};}function patchUpdates(_0xf5b8aa){return function(_0x531032){try{jsonpatch[_0xb814('0x25')](_0x531032,_0xf5b8aa,!![]);}catch(_0x1808a3){return BPromise[_0xb814('0x26')](_0x1808a3);}return _0x531032[_0xb814('0x27')]();};}function saveUpdates(_0x27352e,_0x2bd039){return function(_0x1f5d40){if(_0x1f5d40){return _0x1f5d40['update'](_0x27352e)[_0xb814('0x28')](function(_0x52b7a3){return _0x52b7a3;});}return null;};}function removeEntity(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x29')]()[_0xb814('0x28')](function(){var _0xb9e57d=_0x31c7ec[_0xb814('0x2a')]({'plain':!![]});var _0x5755ea=_0xb814('0x2b');return db[_0xb814('0x2c')][_0xb814('0x29')]({'where':{'type':_0x5755ea,'resourceId':_0xb9e57d['id']}})[_0xb814('0x28')](function(){return _0x31c7ec;});})[_0xb814('0x28')](function(){_0x3f81d0[_0xb814('0x1d')](0xcc)[_0xb814('0x1e')]();});}};}function handleEntityNotFound(_0x1e4e89,_0x5a6291){return function(_0x271aa8){if(!_0x271aa8){_0x1e4e89[_0xb814('0x1c')](0x194);}return _0x271aa8;};}function handleError(_0x52ed64,_0x9008b2){_0x9008b2=_0x9008b2||0x1f4;return function(_0x37d24d){logger[_0xb814('0x2d')](_0x37d24d['stack']);if(_0x37d24d[_0xb814('0x2e')]){delete _0x37d24d[_0xb814('0x2e')];}_0x52ed64['status'](_0x9008b2)[_0xb814('0x2f')](_0x37d24d);};}exports['index']=function(_0x6efe9a,_0x5f3e9b){var _0x4cfc58={},_0x419cd9={},_0x4a4f27={'count':0x0,'rows':[]};var _0x2431e2=_[_0xb814('0x30')](db[_0xb814('0x31')]['rawAttributes'],function(_0x51d5ae){return{'name':_0x51d5ae[_0xb814('0x32')],'type':_0x51d5ae[_0xb814('0x33')]['key']};});_0x419cd9[_0xb814('0x34')]=_[_0xb814('0x30')](_0x2431e2,_0xb814('0x2e'));_0x419cd9[_0xb814('0x35')]=_[_0xb814('0x36')](_0x6efe9a[_0xb814('0x35')]);_0x419cd9[_0xb814('0x37')]=_['intersection'](_0x419cd9[_0xb814('0x34')],_0x419cd9[_0xb814('0x35')]);_0x4cfc58[_0xb814('0x38')]=_[_0xb814('0x39')](_0x419cd9[_0xb814('0x34')],qs['fields'](_0x6efe9a[_0xb814('0x35')]['fields']));_0x4cfc58[_0xb814('0x38')]=_0x4cfc58[_0xb814('0x38')][_0xb814('0x3a')]?_0x4cfc58['attributes']:_0x419cd9[_0xb814('0x34')];if(!_0x6efe9a[_0xb814('0x35')]['hasOwnProperty'](_0xb814('0x3b'))){_0x4cfc58[_0xb814('0x3c')]=qs[_0xb814('0x3c')](_0x6efe9a[_0xb814('0x35')][_0xb814('0x3c')]);_0x4cfc58[_0xb814('0x20')]=qs['offset'](_0x6efe9a[_0xb814('0x35')]['offset']);}_0x4cfc58[_0xb814('0x3d')]=qs['sort'](_0x6efe9a[_0xb814('0x35')]['sort']);_0x4cfc58[_0xb814('0x3e')]=qs[_0xb814('0x37')](_['pick'](_0x6efe9a['query'],_0x419cd9['filters']),_0x2431e2);if(_0x6efe9a['query'][_0xb814('0x3f')]){_0x4cfc58[_0xb814('0x3e')]=_[_0xb814('0x40')](_0x4cfc58[_0xb814('0x3e')],{'$or':_['map'](_0x2431e2,function(_0x47d782){if(_0x47d782[_0xb814('0x33')]!=='VIRTUAL'){var _0x2a93da={};_0x2a93da[_0x47d782[_0xb814('0x2e')]]={'$like':'%'+_0x6efe9a[_0xb814('0x35')][_0xb814('0x3f')]+'%'};return _0x2a93da;}})});}_0x4cfc58=_[_0xb814('0x40')]({},_0x4cfc58,_0x6efe9a[_0xb814('0x41')]);var _0x3b7f5a={'where':_0x4cfc58[_0xb814('0x3e')]};return db[_0xb814('0x31')]['count'](_0x3b7f5a)['then'](function(_0x5d26be){_0x4a4f27[_0xb814('0x22')]=_0x5d26be;if(_0x6efe9a['query'][_0xb814('0x42')]){_0x4cfc58['include']=[{'all':!![]}];}return db[_0xb814('0x31')][_0xb814('0x43')](_0x4cfc58);})[_0xb814('0x28')](function(_0x2e97cc){_0x4a4f27['rows']=_0x2e97cc;return _0x4a4f27;})[_0xb814('0x28')](respondWithFilteredResult(_0x5f3e9b,_0x4cfc58))[_0xb814('0x44')](handleError(_0x5f3e9b,null));};exports[_0xb814('0x45')]=function(_0x22cf27,_0x7d92aa){var _0x450a08={'raw':!![],'where':{'id':_0x22cf27[_0xb814('0x46')]['id']}},_0x534eb8={};_0x534eb8[_0xb814('0x34')]=_[_0xb814('0x36')](db[_0xb814('0x31')][_0xb814('0x47')]);_0x534eb8[_0xb814('0x35')]=_[_0xb814('0x36')](_0x22cf27['query']);_0x534eb8['filters']=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],_0x534eb8[_0xb814('0x35')]);_0x450a08[_0xb814('0x38')]=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],qs[_0xb814('0x48')](_0x22cf27[_0xb814('0x35')][_0xb814('0x48')]));_0x450a08[_0xb814('0x38')]=_0x450a08[_0xb814('0x38')]['length']?_0x450a08[_0xb814('0x38')]:_0x534eb8[_0xb814('0x34')];if(_0x22cf27['query'][_0xb814('0x42')]){_0x450a08['include']=[{'all':!![]}];}_0x450a08=_[_0xb814('0x40')]({},_0x450a08,_0x22cf27[_0xb814('0x41')]);return db[_0xb814('0x31')][_0xb814('0x49')](_0x450a08)[_0xb814('0x28')](handleEntityNotFound(_0x7d92aa,null))[_0xb814('0x28')](respondWithResult(_0x7d92aa,null))[_0xb814('0x44')](handleError(_0x7d92aa,null));};exports[_0xb814('0x4a')]=function(_0x32a397,_0x2a422a){return db['AnalyticDefaultReport']['create'](_0x32a397[_0xb814('0x4b')],{})[_0xb814('0x28')](function(_0x4156d8){var _0x3f8e29=_0x32a397[_0xb814('0x4c')][_0xb814('0x2a')]({'plain':!![]});if(!_0x3f8e29)throw new Error(_0xb814('0x4d'));if(_0x3f8e29['role']===_0xb814('0x4c')){var _0x388324=_0x4156d8[_0xb814('0x2a')]({'plain':!![]});var _0x5a916d=_0xb814('0x4e');return db['UserProfileSection'][_0xb814('0x49')]({'where':{'name':_0x5a916d,'userProfileId':_0x3f8e29['userProfileId']},'raw':!![]})[_0xb814('0x28')](function(_0x3cf8f8){if(_0x3cf8f8&&_0x3cf8f8['autoAssociation']===0x0){return db[_0xb814('0x2c')][_0xb814('0x4a')]({'name':_0x388324[_0xb814('0x2e')],'resourceId':_0x388324['id'],'type':'DefaultReports','sectionId':_0x3cf8f8['id']},{})[_0xb814('0x28')](function(){return _0x4156d8;});}else{return _0x4156d8;}})['catch'](function(_0x13bdcf){logger[_0xb814('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13bdcf);throw _0x13bdcf;});}return _0x4156d8;})[_0xb814('0x28')](respondWithResult(_0x2a422a,0xc9))['catch'](handleError(_0x2a422a,null));};exports['update']=function(_0x3b9709,_0x35f59a){if(_0x3b9709[_0xb814('0x4b')]['id']){delete _0x3b9709['body']['id'];}return db[_0xb814('0x31')]['find']({'where':{'id':_0x3b9709[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x35f59a,null))['then'](saveUpdates(_0x3b9709[_0xb814('0x4b')],null))['then'](respondWithResult(_0x35f59a,null))[_0xb814('0x44')](handleError(_0x35f59a,null));};exports[_0xb814('0x29')]=function(_0xb2bd82,_0x113fe5){return db[_0xb814('0x31')][_0xb814('0x49')]({'where':{'id':_0xb2bd82[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x113fe5,null))['then'](removeEntity(_0x113fe5,null))[_0xb814('0x44')](handleError(_0x113fe5,null));};exports[_0xb814('0x4f')]=function(_0x5d71d5,_0x29a127){var _0xe14249=0xa;var _0x4d13db=[_0xb814('0x50'),'left_join','right_join',_0xb814('0x51')];var _0x5257be={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb814('0x56'),'GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x176585={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x4d611d=function(_0x211194){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x211194);};var _0x52edfa=function(_0x135e13){if(!_0x135e13||!_0x135e13['rules'][_0xb814('0x3a')]){return'';}for(var _0x39b754='(',_0xac95cf=0x0;_0xac95cf<_0x135e13['rules'][_0xb814('0x3a')];_0xac95cf+=0x1){_0xac95cf>0x0&&(_0x39b754+='\x20'+_0x135e13['operator']+'\x20');_0x39b754+=_0x135e13[_0xb814('0x63')][_0xac95cf]['group']?_0x52edfa(_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x64')]):_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x65')]+'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x66')]+(_0x4d611d(_0x135e13[_0xb814('0x63')][_0xac95cf]['condition'])?'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf]['value']:'');}return _0x39b754+')';};var _0x255047={'where':{'id':_0x5d71d5['params']['id']}},_0x22c73f,_0x1b989d,_0x3dcaeb,_0x19fa45,_0x139531;_0x255047=_[_0xb814('0x40')]({},_0x255047,_0x5d71d5[_0xb814('0x41')]);return db['AnalyticDefaultReport'][_0xb814('0x49')](_0x255047)[_0xb814('0x28')](function(_0x263699){if(_0x263699){_0x22c73f=_0x263699;return _0x263699[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x51d834){if(_0x51d834){if(!_0x51d834[_0xb814('0x3a')]){throw new db['Sequelize'][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x1b989d=_0x51d834;return db[_0xb814('0x6a')][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x41bcaf){if(_0x41bcaf){_0x3dcaeb=_['keyBy'](_0x41bcaf,'id');var _0x506bf2;var _0x5d064b=squel[_0xb814('0x6b')]();_0x5d064b['from'](_0x22c73f[_0xb814('0x6c')]);for(var _0x1d3954=0x0;_0x1d3954<_0x1b989d[_0xb814('0x3a')];_0x1d3954+=0x1){_0x506bf2=_0x1b989d[_0x1d3954]['MetricId']?_0x3dcaeb[_0x1b989d[_0x1d3954][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x1b989d[_0x1d3954][_0xb814('0x65')];_0x506bf2=_0x1b989d[_0x1d3954]['function']?_[_0xb814('0x6f')](_0x5257be[_0x1b989d[_0x1d3954][_0xb814('0x70')]],'%s',_0x506bf2):_0x506bf2;_0x506bf2=_0x1b989d[_0x1d3954][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x176585[_0x1b989d[_0x1d3954]['format']],'%s',_0x506bf2):_0x506bf2;if(_0x1b989d[_0x1d3954]['groupBy']){_0x5d064b[_0xb814('0x64')](_0x506bf2);}_0x1b989d[_0x1d3954][_0xb814('0x72')]&&_0x5d064b[_0xb814('0x3d')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x5d064b[_0xb814('0x65')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x74')]||_0x506bf2);}if(_0x22c73f[_0xb814('0x75')]){_0x22c73f[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x22c73f[_0xb814('0x75')]);for(var _0x226b0e=0x0;_0x226b0e<_0x22c73f[_0xb814('0x75')][_0xb814('0x3a')];_0x226b0e+=0x1){if(_0x22c73f[_0xb814('0x75')][_0x226b0e]['type']&&_[_0xb814('0x5e')](_0x4d13db,_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')])&&_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')]&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignTable']&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignKey']){_0x5d064b[_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')]](_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],null,util[_0xb814('0x71')]('%s.%s\x20=\x20%s.%s',_0x22c73f['table'],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],_0x22c73f['joins'][_0x226b0e][_0xb814('0x79')]));}}}if(_0x22c73f['conditions']){_0x22c73f[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x22c73f['conditions']);_0x5d064b['where'](_0x52edfa(_0x22c73f[_0xb814('0x7a')]['group']));}_0x139531=_0x5d064b[_0xb814('0x7b')]();_0x5d064b[_0xb814('0x3c')](_0xe14249);_0x5d064b[_0xb814('0x20')](0x0);logger[_0xb814('0x7c')](_0xb814('0x7d'),_0x5d064b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')]['query'](_0x5d064b[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')]['SELECT']});}})[_0xb814('0x28')](respondWithResult(_0x29a127,null))[_0xb814('0x44')](handleError(_0x29a127,null));};function runReport(_0x58d56c,_0x10a90d,_0x583f26){var _0x37adec=_0x10a90d[_0xb814('0x2e')];var _0x4e15c2=0xa;var _0x5a0c4a=[_0xb814('0x50'),_0xb814('0x81'),_0xb814('0x82'),_0xb814('0x51')];var _0x220f8b={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':_0xb814('0x83'),'MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x52b6da={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1fb1ea=function(_0x31c072){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x31c072);};var _0x5cf5ad=function(_0x20efc3){if(!_0x20efc3||!_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x30faa0='(',_0x55ceb8=0x0;_0x55ceb8<_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')];_0x55ceb8+=0x1){_0x55ceb8>0x0&&(_0x30faa0+='\x20'+_0x20efc3[_0xb814('0x84')]+'\x20');_0x30faa0+=_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x64')]?_0x5cf5ad(_0x20efc3['rules'][_0x55ceb8]['group']):_0x20efc3[_0xb814('0x63')][_0x55ceb8]['field']+'\x20'+_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x66')]+(_0x1fb1ea(_0x20efc3['rules'][_0x55ceb8][_0xb814('0x66')])?'\x20'+_0x20efc3['rules'][_0x55ceb8][_0xb814('0x85')]:'');}return _0x30faa0+')';};var _0x520d0f={'where':{'id':_0x58d56c['id']}},_0x44e668,_0x1aff2b,_0x41867b,_0x2c3948,_0x2d8899;_0x520d0f=_[_0xb814('0x40')]({},_0x520d0f,_0x583f26);return db[_0xb814('0x31')]['find'](_0x520d0f)['then'](function(_0x21aa36){if(_0x21aa36){_0x44e668=_0x21aa36;return _0x21aa36['getFields']();}return null;})['then'](function(_0x2d0061){if(_0x2d0061){if(!_0x2d0061[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))]['ValidationErrorItem'](_0xb814('0x69'),0x193);}_0x1aff2b=_0x2d0061;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x14ec54){if(_0x14ec54){_0x41867b=_[_0xb814('0x87')](_0x14ec54,'id');var _0x4c8a00;var _0x1454b3=squel[_0xb814('0x6b')]();_0x1454b3[_0xb814('0x88')](_0x44e668['table']);for(var _0x1ebbf6=0x0;_0x1ebbf6<_0x1aff2b[_0xb814('0x3a')];_0x1ebbf6+=0x1){_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x6d')]?_0x41867b[_0x1aff2b[_0x1ebbf6]['MetricId']][_0xb814('0x6e')]:_0x1aff2b[_0x1ebbf6][_0xb814('0x65')];_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]?_[_0xb814('0x6f')](_0x220f8b[_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]],'%s',_0x4c8a00):_0x4c8a00;_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x52b6da[_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]],'%s',_0x4c8a00):_0x4c8a00;if(_0x1aff2b[_0x1ebbf6][_0xb814('0x89')]){_0x1454b3[_0xb814('0x64')](_0x4c8a00);}_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]&&_0x1454b3[_0xb814('0x3d')](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]==='DESC'?![]:!![]);_0x1454b3['field'](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x74')]||_0x4c8a00);}if(_0x44e668['joins']){_0x44e668[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x44e668[_0xb814('0x75')]);for(var _0x2bc95b=0x0;_0x2bc95b<_0x44e668[_0xb814('0x75')][_0xb814('0x3a')];_0x2bc95b+=0x1){if(_0x44e668[_0xb814('0x75')][_0x2bc95b]['type']&&_['includes'](_0x5a0c4a,_0x44e668[_0xb814('0x75')][_0x2bc95b]['type'])&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')]&&_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable']&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]){_0x1454b3[_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x33')]](_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],null,util[_0xb814('0x71')](_0xb814('0x8a'),_0x44e668['table'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')],_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]));}}}if(_0x44e668['conditions']){_0x44e668[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x44e668['conditions']);_0x1454b3[_0xb814('0x3e')](_0x5cf5ad(_0x44e668[_0xb814('0x7a')][_0xb814('0x64')]));}_0x2d8899=_0x1454b3[_0xb814('0x7b')]();_0x1454b3[_0xb814('0x3c')](_0x4e15c2);_0x1454b3[_0xb814('0x20')](0x0);return;}})[_0xb814('0x28')](function(){if(_0x10a90d[_0xb814('0x8b')]===_0xb814('0x8c')){return null;}var _0x1f8c7a=_[_0xb814('0x40')](_0x10a90d,{'name':_0x10a90d[_0xb814('0x8d')]||_0x10a90d['name']||_0x44e668['name'],'basename':_0x37adec,'savename':util[_0xb814('0x71')]('%s-%s.%s',_0x10a90d['name']||_0x44e668[_0xb814('0x2e')],require('randomstring')['generate'](0x4),_0x10a90d['output']||_0xb814('0x8e')),'reportId':_0x44e668['id'],'reportType':_0xb814('0x8f')});return db[_0xb814('0x90')]['create'](_0x1f8c7a,{'raw':!![]});})[_0xb814('0x28')](function(_0x4dbe89){if(_0x44e668[_0xb814('0x6c')]===_0xb814('0x91')){_0x2d8899['where'](_0x44e668[_0xb814('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}else{_0x2d8899[_0xb814('0x3e')](_0x44e668[_0xb814('0x6c')]+_0xb814('0x94'),_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}if(_0x4dbe89){logger[_0xb814('0x95')](_0xb814('0x96'),_0x2d8899[_0xb814('0x7e')]());require(_0xb814('0x97'))[_0xb814('0x98')](path[_0xb814('0x50')](__dirname,_0xb814('0x99'),_0x4dbe89[_0xb814('0x8b')]),[_0x4dbe89['id'],_0x2d8899['toString'](),path[_0xb814('0x50')](__dirname,_0xb814('0x9a'),_0x4dbe89['savename']),_0x37adec]);return _0x4dbe89;}else{var _0x2c7cd6=squel[_0xb814('0x6b')]();_0x2c7cd6[_0xb814('0x88')]('('+_0x2d8899['toString']()+')','countTable');_0x2c7cd6[_0xb814('0x65')]('COUNT(*)',_0xb814('0x22'));_0x2d8899['limit'](_0x10a90d[_0xb814('0x3c')]||_0x4e15c2);_0x2d8899['offset'](_0x10a90d['offset']||0x0);return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x2c7cd6[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]})[_0xb814('0x28')](function(_0x4543c3){if(!_0x4543c3[_0xb814('0x3a')]){_0x2c3948=0x0;}else{_0x2c3948=_0x4543c3[0x0][_0xb814('0x22')]||0x0;}return dbH[_0xb814('0x7f')]['query'](_0x2d8899[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')][_0xb814('0x9b')]});})[_0xb814('0x28')](function(_0x4fde6a){return{'rows':_0x4fde6a||[],'count':_0x2c3948};});}});}exports[_0xb814('0x9c')]=function(_0x18fb74,_0x371e92){return runReport(_0x18fb74[_0xb814('0x46')],_0x18fb74[_0xb814('0x35')],_0x18fb74[_0xb814('0x41')])[_0xb814('0x28')](respondWithResult(_0x371e92,null))[_0xb814('0x44')](handleError(_0x371e92,null));};exports[_0xb814('0x9d')]=runReport;exports[_0xb814('0x35')]=function(_0x3b65c0,_0x11e0c3){var _0x22c811=0xa;var _0x3fd24c=[_0xb814('0x50'),'left_join',_0xb814('0x82'),_0xb814('0x51')];var _0x3e61eb={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x5be0bb={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1bd9ab=function(_0x20e608){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),'IS\x20NOT\x20EMPTY'],_0x20e608);};var _0x2a5dff=function(_0x553635){if(!_0x553635||!_0x553635[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x35e8f7='(',_0xa7ff62=0x0;_0xa7ff62<_0x553635[_0xb814('0x63')][_0xb814('0x3a')];_0xa7ff62+=0x1){_0xa7ff62>0x0&&(_0x35e8f7+='\x20'+_0x553635[_0xb814('0x84')]+'\x20');_0x35e8f7+=_0x553635[_0xb814('0x63')][_0xa7ff62]['group']?_0x2a5dff(_0x553635['rules'][_0xa7ff62]['group']):_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x65')]+'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')]+(_0x1bd9ab(_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')])?'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x85')]:'');}return _0x35e8f7+')';};var _0x41847e={'where':{'id':_0x3b65c0[_0xb814('0x46')]['id']}},_0x1a5685,_0x51313d,_0x5c989a,_0x41486b,_0x16c05b;_0x41847e=_[_0xb814('0x40')]({},_0x41847e,_0x3b65c0[_0xb814('0x41')]);return db[_0xb814('0x31')]['find'](_0x41847e)[_0xb814('0x28')](function(_0x52899a){if(_0x52899a){_0x1a5685=_0x52899a;return _0x52899a[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x205c6c){if(_0x205c6c){if(!_0x205c6c[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x51313d=_0x205c6c;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x1f04eb){if(_0x1f04eb){_0x5c989a=_[_0xb814('0x87')](_0x1f04eb,'id');var _0x4a1c4e;var _0x17c63b=squel[_0xb814('0x6b')]();_0x17c63b[_0xb814('0x88')](_0x1a5685[_0xb814('0x6c')]);for(var _0xa66ca3=0x0;_0xa66ca3<_0x51313d['length'];_0xa66ca3+=0x1){_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x6d')]?_0x5c989a[_0x51313d[_0xa66ca3][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x51313d[_0xa66ca3]['field'];_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x70')]?_['replace'](_0x3e61eb[_0x51313d[_0xa66ca3][_0xb814('0x70')]],'%s',_0x4a1c4e):_0x4a1c4e;_0x4a1c4e=_0x51313d[_0xa66ca3]['format']?_[_0xb814('0x6f')](_0x5be0bb[_0x51313d[_0xa66ca3][_0xb814('0x71')]],'%s',_0x4a1c4e):_0x4a1c4e;if(_0x51313d[_0xa66ca3][_0xb814('0x89')]){_0x17c63b[_0xb814('0x64')](_0x4a1c4e);}_0x51313d[_0xa66ca3]['orderBy']&&_0x17c63b[_0xb814('0x3d')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x17c63b[_0xb814('0x65')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x74')]||_0x4a1c4e);}if(_0x1a5685[_0xb814('0x75')]){_0x1a5685[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x75')]);for(var _0x152260=0x0;_0x152260<_0x1a5685[_0xb814('0x75')][_0xb814('0x3a')];_0x152260+=0x1){if(_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]&&_[_0xb814('0x5e')](_0x3fd24c,_0x1a5685['joins'][_0x152260][_0xb814('0x33')])&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')]&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')]&&_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']){_0x17c63b[_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]](_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1a5685[_0xb814('0x6c')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']));}}}if(_0x1a5685[_0xb814('0x7a')]){_0x1a5685[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x7a')]);_0x17c63b['where'](_0x2a5dff(_0x1a5685[_0xb814('0x7a')][_0xb814('0x64')]));}_0x16c05b=_0x17c63b[_0xb814('0x7b')]();_0x17c63b[_0xb814('0x3c')](_0x22c811);_0x17c63b[_0xb814('0x20')](0x0);logger['debug'](_0xb814('0x7d'),_0x17c63b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x17c63b[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]});}})[_0xb814('0x28')](function(){return{'sql':_0x16c05b[_0xb814('0x7e')]()};})[_0xb814('0x28')](respondWithResult(_0x11e0c3,null))[_0xb814('0x44')](handleError(_0x11e0c3,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 4d866eb..ec66093 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 _0xd588=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x3d748b,_0x16092d){var _0x2631d6=function(_0x25dafd){while(--_0x25dafd){_0x3d748b['push'](_0x3d748b['shift']());}};_0x2631d6(++_0x16092d);}(_0xd588,0x1be));var _0x8d58=function(_0x497ee0,_0x17c87c){_0x497ee0=_0x497ee0-0x0;var _0x47c05a=_0xd588[_0x497ee0];return _0x47c05a;};'use strict';var _=require(_0x8d58('0x0'));var util=require('util');var logger=require(_0x8d58('0x1'))(_0x8d58('0x2'));var moment=require(_0x8d58('0x3'));var BPromise=require(_0x8d58('0x4'));var rp=require(_0x8d58('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8d58('0x6'));var config=require(_0x8d58('0x7'));var attributes=require(_0x8d58('0x8'));module[_0x8d58('0x9')]=function(_0xb993,_0x24a437){return _0xb993[_0x8d58('0xa')](_0x8d58('0xb'),attributes,{'tableName':_0x8d58('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfeea=['path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports','lodash','../../config/logger','bluebird'];(function(_0x4de9e8,_0x565ffa){var _0x4db0de=function(_0x12279d){while(--_0x12279d){_0x4de9e8['push'](_0x4de9e8['shift']());}};_0x4db0de(++_0x565ffa);}(_0xfeea,0x11d));var _0xafee=function(_0x3a9635,_0x1ab817){_0x3a9635=_0x3a9635-0x0;var _0x10d08c=_0xfeea[_0x3a9635];return _0x10d08c;};'use strict';var _=require(_0xafee('0x0'));var util=require('util');var logger=require(_0xafee('0x1'))('api');var moment=require('moment');var BPromise=require(_0xafee('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xafee('0x3'));var rimraf=require(_0xafee('0x4'));var config=require(_0xafee('0x5'));var attributes=require(_0xafee('0x6'));module[_0xafee('0x7')]=function(_0x3ea5eb,_0x2fcf73){return _0x3ea5eb['define']('AnalyticDefaultReport',attributes,{'tableName':_0xafee('0x8'),'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 a0218ad..ac4883b 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 _0x3bd3=['lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x3bd3,0x7e));var _0x33bd=function(_0x2a5b82,_0xc61f63){_0x2a5b82=_0x2a5b82-0x0;var _0x322e1a=_0x3bd3[_0x2a5b82];return _0x322e1a;};'use strict';var _=require(_0x33bd('0x0'));var util=require(_0x33bd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x33bd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33bd('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x33bd('0x4'))(_0x33bd('0x5'));var config=require(_0x33bd('0x6'));var jayson=require(_0x33bd('0x7'));var client=jayson[_0x33bd('0x8')][_0x33bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23ee83,_0x1954c5,_0x2e3328){return new BPromise(function(_0x136eb4,_0x25d719){return client[_0x33bd('0xa')](_0x23ee83,_0x2e3328)[_0x33bd('0xb')](function(_0x29d106){logger[_0x33bd('0xc')](_0x33bd('0xd'),_0x1954c5,'request\x20sent');logger['debug'](_0x33bd('0xe'),_0x1954c5,_0x33bd('0xf'),JSON[_0x33bd('0x10')](_0x29d106));if(_0x29d106[_0x33bd('0x11')]){if(_0x29d106[_0x33bd('0x11')]['code']===0x1f4){logger[_0x33bd('0x11')](_0x33bd('0xd'),_0x1954c5,_0x29d106[_0x33bd('0x11')][_0x33bd('0x12')]);return _0x25d719(_0x29d106[_0x33bd('0x11')][_0x33bd('0x12')]);}logger[_0x33bd('0x11')](_0x33bd('0xd'),_0x1954c5,_0x29d106[_0x33bd('0x11')]['message']);return _0x136eb4(_0x29d106[_0x33bd('0x11')][_0x33bd('0x12')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x1954c5,_0x33bd('0xf'));_0x136eb4(_0x29d106[_0x33bd('0x13')][_0x33bd('0x12')]);}})[_0x33bd('0x14')](function(_0x202be5){logger[_0x33bd('0x11')](_0x33bd('0xd'),_0x1954c5,_0x202be5);_0x25d719(_0x202be5);});});} \ No newline at end of file +var _0x421a=['client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x421a,0x124));var _0xa421=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x421a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa421('0x0'));var moment=require(_0xa421('0x1'));var BPromise=require(_0xa421('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa421('0x3'));var db=require(_0xa421('0x4'))['db'];var utils=require(_0xa421('0x5'));var logger=require(_0xa421('0x6'))(_0xa421('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa421('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa08ed4,_0x5cb04b,_0xd2764e){return new BPromise(function(_0x14efe1,_0x16df3e){return client[_0xa421('0x9')](_0xa08ed4,_0xd2764e)[_0xa421('0xa')](function(_0xcebe54){logger[_0xa421('0xb')](_0xa421('0xc'),_0x5cb04b,_0xa421('0xd'));logger[_0xa421('0xe')](_0xa421('0xf'),_0x5cb04b,_0xa421('0xd'),JSON['stringify'](_0xcebe54));if(_0xcebe54[_0xa421('0x10')]){if(_0xcebe54[_0xa421('0x10')][_0xa421('0x11')]===0x1f4){logger[_0xa421('0x10')](_0xa421('0xc'),_0x5cb04b,_0xcebe54[_0xa421('0x10')][_0xa421('0x12')]);return _0x16df3e(_0xcebe54[_0xa421('0x10')][_0xa421('0x12')]);}logger['error'](_0xa421('0xc'),_0x5cb04b,_0xcebe54['error'][_0xa421('0x12')]);return _0x14efe1(_0xcebe54[_0xa421('0x10')]['message']);}else{logger[_0xa421('0xb')](_0xa421('0xc'),_0x5cb04b,_0xa421('0xd'));_0x14efe1(_0xcebe54['result'][_0xa421('0x12')]);}})[_0xa421('0x13')](function(_0x21275c){logger[_0xa421('0x10')](_0xa421('0xc'),_0x5cb04b,_0x21275c);_0x16df3e(_0x21275c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 0e075dc..13812d8 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 _0xe1c1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','isAuthenticated','show','preview','/:id/query','query','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x50f008,_0x5abe67){var _0x5d5483=function(_0x26402a){while(--_0x26402a){_0x50f008['push'](_0x50f008['shift']());}};_0x5d5483(++_0x5abe67);}(_0xe1c1,0x14b));var _0x1e1c=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xe1c1[_0x101e7b];return _0x4995c0;};'use strict';var multer=require(_0x1e1c('0x0'));var util=require(_0x1e1c('0x1'));var path=require(_0x1e1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x1e1c('0x3'));var router=express['Router']();var fs_extra=require(_0x1e1c('0x4'));var auth=require(_0x1e1c('0x5'));var interaction=require(_0x1e1c('0x6'));var config=require(_0x1e1c('0x7'));var controller=require(_0x1e1c('0x8'));router[_0x1e1c('0x9')]('/',auth['isAuthenticated'](),controller[_0x1e1c('0xa')]);router[_0x1e1c('0x9')]('/:id',auth[_0x1e1c('0xb')](),controller[_0x1e1c('0xc')]);router['get']('/:id/preview',auth[_0x1e1c('0xb')](),controller[_0x1e1c('0xd')]);router[_0x1e1c('0x9')]('/:id/run',auth[_0x1e1c('0xb')](),controller['run']);router[_0x1e1c('0x9')](_0x1e1c('0xe'),auth[_0x1e1c('0xb')](),controller[_0x1e1c('0xf')]);router[_0x1e1c('0x10')]('/',auth[_0x1e1c('0xb')](),controller[_0x1e1c('0x11')]);router[_0x1e1c('0x12')](_0x1e1c('0x13'),auth[_0x1e1c('0xb')](),controller[_0x1e1c('0x14')]);router[_0x1e1c('0x15')](_0x1e1c('0x13'),auth[_0x1e1c('0xb')](),controller[_0x1e1c('0x16')]);module[_0x1e1c('0x17')]=router; \ No newline at end of file +var _0x3be2=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','/:id/run','/:id/query','query','post'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0x3be2,0x18d));var _0x23be=function(_0x5a7ab9,_0x3ef142){_0x5a7ab9=_0x5a7ab9-0x0;var _0x57b2d6=_0x3be2[_0x5a7ab9];return _0x57b2d6;};'use strict';var multer=require(_0x23be('0x0'));var util=require('util');var path=require(_0x23be('0x1'));var timeout=require(_0x23be('0x2'));var express=require('express');var router=express[_0x23be('0x3')]();var fs_extra=require(_0x23be('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x23be('0x5'));var controller=require(_0x23be('0x6'));router[_0x23be('0x7')]('/',auth['isAuthenticated'](),controller[_0x23be('0x8')]);router[_0x23be('0x7')](_0x23be('0x9'),auth[_0x23be('0xa')](),controller[_0x23be('0xb')]);router[_0x23be('0x7')](_0x23be('0xc'),auth[_0x23be('0xa')](),controller['preview']);router[_0x23be('0x7')](_0x23be('0xd'),auth['isAuthenticated'](),controller['run']);router[_0x23be('0x7')](_0x23be('0xe'),auth[_0x23be('0xa')](),controller[_0x23be('0xf')]);router[_0x23be('0x10')]('/',auth[_0x23be('0xa')](),controller[_0x23be('0x11')]);router[_0x23be('0x12')](_0x23be('0x9'),auth[_0x23be('0xa')](),controller[_0x23be('0x13')]);router[_0x23be('0x14')](_0x23be('0x9'),auth[_0x23be('0xa')](),controller[_0x23be('0x15')]);module[_0x23be('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index ff38b23..439af29 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 _0xa690=['manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','csv','pdf','xlsx','DATE','ENUM'];(function(_0xee4c5f,_0x1bf72d){var _0x5accbc=function(_0x5ca2aa){while(--_0x5ca2aa){_0xee4c5f['push'](_0xee4c5f['shift']());}};_0x5accbc(++_0x1bf72d);}(_0xa690,0x93));var _0x0a69=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0xa690[_0x4e1a49];return _0x136aae;};'use strict';var Sequelize=require(_0x0a69('0x0'));var moment=require(_0x0a69('0x1'));module[_0x0a69('0x2')]={'name':{'type':Sequelize[_0x0a69('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x0a69('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x0a69('0x4'),_0x0a69('0x5'),_0x0a69('0x6')),'allowNull':![],'defaultValue':_0x0a69('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x0a69('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x0a69('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x0a69('0x8')](_0x0a69('0x9'),_0x0a69('0xa')),'allowNull':![],'defaultValue':_0x0a69('0x9')},'reportId':{'type':Sequelize[_0x0a69('0xb')](0xb)[_0x0a69('0xc')]},'reportType':{'type':Sequelize[_0x0a69('0x3')]}}; \ No newline at end of file +var _0x5cb3=['manual','scheduled','INTEGER','sequelize','moment','STRING','csv','pdf','DATE','Loading','ENUM'];(function(_0x4f0206,_0x146c33){var _0x3fe5f3=function(_0x536dd9){while(--_0x536dd9){_0x4f0206['push'](_0x4f0206['shift']());}};_0x3fe5f3(++_0x146c33);}(_0x5cb3,0xb3));var _0x35cb=function(_0x3528fe,_0x543da1){_0x3528fe=_0x3528fe-0x0;var _0x529ec8=_0x5cb3[_0x3528fe];return _0x529ec8;};'use strict';var Sequelize=require(_0x35cb('0x0'));var moment=require(_0x35cb('0x1'));module['exports']={'name':{'type':Sequelize[_0x35cb('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x35cb('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x35cb('0x3'),_0x35cb('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0x35cb('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x35cb('0x5')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x35cb('0x2')],'defaultValue':_0x35cb('0x6')},'type':{'type':Sequelize[_0x35cb('0x7')](_0x35cb('0x8'),_0x35cb('0x9')),'allowNull':![],'defaultValue':_0x35cb('0x8')},'reportId':{'type':Sequelize[_0x35cb('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x35cb('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 67fa2fe..4ac5218 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 _0xd553=['server/files/reports','ValidationError','%s.%s','basename','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../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','ExtractedReports','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','download','savename','output','existsSync','join','root'];(function(_0x17158c,_0x58cb92){var _0x734f31=function(_0x2a7a84){while(--_0x2a7a84){_0x17158c['push'](_0x17158c['shift']());}};_0x734f31(++_0x58cb92);}(_0xd553,0xba));var _0x3d55=function(_0x459a0a,_0x25c46f){_0x459a0a=_0x459a0a-0x0;var _0x4ab46c=_0xd553[_0x459a0a];return _0x4ab46c;};'use strict';var emlformat=require(_0x3d55('0x0'));var rimraf=require(_0x3d55('0x1'));var zipdir=require(_0x3d55('0x2'));var jsonpatch=require(_0x3d55('0x3'));var rp=require('request-promise');var moment=require(_0x3d55('0x4'));var BPromise=require(_0x3d55('0x5'));var Mustache=require('mustache');var util=require(_0x3d55('0x6'));var path=require(_0x3d55('0x7'));var sox=require(_0x3d55('0x8'));var csv=require(_0x3d55('0x9'));var ejs=require(_0x3d55('0xa'));var fs=require('fs');var fs_extra=require(_0x3d55('0xb'));var _=require(_0x3d55('0xc'));var squel=require(_0x3d55('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3d55('0xe'));var toCsv=require(_0x3d55('0x9'));var querystring=require('querystring');var Papa=require(_0x3d55('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3d55('0x10'));var as=require(_0x3d55('0x11'));var hardwareService=require(_0x3d55('0x12'));var logger=require(_0x3d55('0x13'))(_0x3d55('0x14'));var utils=require(_0x3d55('0x15'));var config=require(_0x3d55('0x16'));var licenseUtil=require(_0x3d55('0x17'));var db=require(_0x3d55('0x18'))['db'];function respondWithStatusCode(_0x44dfd3,_0x2f401d){_0x2f401d=_0x2f401d||0xcc;return function(_0x5e8aad){if(_0x5e8aad){return _0x44dfd3[_0x3d55('0x19')](_0x2f401d);}return _0x44dfd3[_0x3d55('0x1a')](_0x2f401d)[_0x3d55('0x1b')]();};}function respondWithResult(_0x40f34c,_0x416fdf){_0x416fdf=_0x416fdf||0xc8;return function(_0x408b49){if(_0x408b49){return _0x40f34c[_0x3d55('0x1a')](_0x416fdf)[_0x3d55('0x1c')](_0x408b49);}};}function respondWithFilteredResult(_0x4616e2,_0xf42eec){return function(_0x1ded74){if(_0x1ded74){var _0x5ce2a0=typeof _0xf42eec[_0x3d55('0x1d')]===_0x3d55('0x1e')&&typeof _0xf42eec[_0x3d55('0x1f')]===_0x3d55('0x1e');var _0xc182b9=_0x1ded74['count'];var _0x48dfc5=_0x5ce2a0?0x0:_0xf42eec[_0x3d55('0x1d')];var _0x2b4794=_0x5ce2a0?_0x1ded74[_0x3d55('0x20')]:_0xf42eec[_0x3d55('0x1d')]+_0xf42eec[_0x3d55('0x1f')];var _0x41ff8b;if(_0x2b4794>=_0xc182b9){_0x2b4794=_0xc182b9;_0x41ff8b=0xc8;}else{_0x41ff8b=0xce;}_0x4616e2[_0x3d55('0x1a')](_0x41ff8b);return _0x4616e2[_0x3d55('0x21')](_0x3d55('0x22'),_0x48dfc5+'-'+_0x2b4794+'/'+_0xc182b9)[_0x3d55('0x1c')](_0x1ded74);}return null;};}function patchUpdates(_0x573199){return function(_0x2c4a2a){try{jsonpatch['apply'](_0x2c4a2a,_0x573199,!![]);}catch(_0x237a6c){return BPromise[_0x3d55('0x23')](_0x237a6c);}return _0x2c4a2a[_0x3d55('0x24')]();};}function saveUpdates(_0x5292f3,_0x592d78){return function(_0x5c81ba){if(_0x5c81ba){return _0x5c81ba[_0x3d55('0x25')](_0x5292f3)[_0x3d55('0x26')](function(_0x4353e5){return _0x4353e5;});}return null;};}function removeEntity(_0x449635,_0x3ab519){return function(_0x1390b3){if(_0x1390b3){return _0x1390b3[_0x3d55('0x27')]()[_0x3d55('0x26')](function(){var _0x1fc4ca=_0x1390b3['get']({'plain':!![]});var _0x397d75=_0x3d55('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x397d75,'resourceId':_0x1fc4ca['id']}})[_0x3d55('0x26')](function(){return _0x1390b3;});})[_0x3d55('0x26')](function(){_0x449635['status'](0xcc)[_0x3d55('0x1b')]();});}};}function handleEntityNotFound(_0xc5bf83,_0x3155fa){return function(_0x4d9631){if(!_0x4d9631){_0xc5bf83['sendStatus'](0x194);}return _0x4d9631;};}function handleError(_0x3e1854,_0x10f99a){_0x10f99a=_0x10f99a||0x1f4;return function(_0x550248){logger[_0x3d55('0x29')](_0x550248[_0x3d55('0x2a')]);if(_0x550248[_0x3d55('0x2b')]){delete _0x550248[_0x3d55('0x2b')];}_0x3e1854[_0x3d55('0x1a')](_0x10f99a)['send'](_0x550248);};}exports[_0x3d55('0x2c')]=function(_0xc0501a,_0x284cad){var _0x2ac56b={},_0x566fca={},_0x18714a={'count':0x0,'rows':[]};var _0x2f0853=_[_0x3d55('0x2d')](db[_0x3d55('0x2e')][_0x3d55('0x2f')],function(_0x3ebf1d){return{'name':_0x3ebf1d[_0x3d55('0x30')],'type':_0x3ebf1d[_0x3d55('0x31')]['key']};});_0x566fca[_0x3d55('0x32')]=_[_0x3d55('0x2d')](_0x2f0853,_0x3d55('0x2b'));_0x566fca[_0x3d55('0x33')]=_['keys'](_0xc0501a[_0x3d55('0x33')]);_0x566fca[_0x3d55('0x34')]=_[_0x3d55('0x35')](_0x566fca['model'],_0x566fca[_0x3d55('0x33')]);_0x2ac56b[_0x3d55('0x36')]=_['intersection'](_0x566fca[_0x3d55('0x32')],qs[_0x3d55('0x37')](_0xc0501a[_0x3d55('0x33')][_0x3d55('0x37')]));_0x2ac56b[_0x3d55('0x36')]=_0x2ac56b['attributes'][_0x3d55('0x38')]?_0x2ac56b[_0x3d55('0x36')]:_0x566fca[_0x3d55('0x32')];if(!_0xc0501a[_0x3d55('0x33')][_0x3d55('0x39')](_0x3d55('0x3a'))){_0x2ac56b[_0x3d55('0x1f')]=qs[_0x3d55('0x1f')](_0xc0501a['query'][_0x3d55('0x1f')]);_0x2ac56b[_0x3d55('0x1d')]=qs[_0x3d55('0x1d')](_0xc0501a['query'][_0x3d55('0x1d')]);}_0x2ac56b['order']=qs[_0x3d55('0x3b')](_0xc0501a[_0x3d55('0x33')][_0x3d55('0x3b')]);_0x2ac56b[_0x3d55('0x3c')]=qs[_0x3d55('0x34')](_['pick'](_0xc0501a[_0x3d55('0x33')],_0x566fca[_0x3d55('0x34')]),_0x2f0853);if(_0xc0501a['query'][_0x3d55('0x3d')]){_0x2ac56b['where']=_[_0x3d55('0x3e')](_0x2ac56b[_0x3d55('0x3c')],{'$or':_[_0x3d55('0x2d')](_0x2f0853,function(_0x258e15){if(_0x258e15['type']!==_0x3d55('0x3f')){var _0x53ff55={};_0x53ff55[_0x258e15[_0x3d55('0x2b')]]={'$like':'%'+_0xc0501a[_0x3d55('0x33')][_0x3d55('0x3d')]+'%'};return _0x53ff55;}})});}_0x2ac56b=_[_0x3d55('0x3e')]({},_0x2ac56b,_0xc0501a[_0x3d55('0x40')]);var _0x7321bf={'where':_0x2ac56b[_0x3d55('0x3c')]};return db[_0x3d55('0x2e')][_0x3d55('0x20')](_0x7321bf)[_0x3d55('0x26')](function(_0x235334){_0x18714a[_0x3d55('0x20')]=_0x235334;if(_0xc0501a[_0x3d55('0x33')][_0x3d55('0x41')]){_0x2ac56b[_0x3d55('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x2ac56b);})[_0x3d55('0x26')](function(_0x464d84){_0x18714a[_0x3d55('0x43')]=_0x464d84;return _0x18714a;})['then'](respondWithFilteredResult(_0x284cad,_0x2ac56b))[_0x3d55('0x44')](handleError(_0x284cad,null));};exports[_0x3d55('0x45')]=function(_0x4928f9,_0x2e7bf8){var _0x19326d={'raw':!![],'where':{'id':_0x4928f9[_0x3d55('0x46')]['id']}},_0xe21164={};_0xe21164['model']=_[_0x3d55('0x47')](db[_0x3d55('0x2e')][_0x3d55('0x2f')]);_0xe21164[_0x3d55('0x33')]=_['keys'](_0x4928f9[_0x3d55('0x33')]);_0xe21164[_0x3d55('0x34')]=_[_0x3d55('0x35')](_0xe21164[_0x3d55('0x32')],_0xe21164[_0x3d55('0x33')]);_0x19326d[_0x3d55('0x36')]=_['intersection'](_0xe21164[_0x3d55('0x32')],qs[_0x3d55('0x37')](_0x4928f9[_0x3d55('0x33')][_0x3d55('0x37')]));_0x19326d[_0x3d55('0x36')]=_0x19326d[_0x3d55('0x36')]['length']?_0x19326d[_0x3d55('0x36')]:_0xe21164[_0x3d55('0x32')];if(_0x4928f9[_0x3d55('0x33')][_0x3d55('0x41')]){_0x19326d[_0x3d55('0x42')]=[{'all':!![]}];}_0x19326d=_['merge']({},_0x19326d,_0x4928f9['options']);return db['AnalyticExtractedReport']['find'](_0x19326d)[_0x3d55('0x26')](handleEntityNotFound(_0x2e7bf8,null))[_0x3d55('0x26')](respondWithResult(_0x2e7bf8,null))['catch'](handleError(_0x2e7bf8,null));};exports[_0x3d55('0x48')]=function(_0x2f150e,_0x3dc3dd){return db['AnalyticExtractedReport'][_0x3d55('0x48')](_0x2f150e[_0x3d55('0x49')],{})[_0x3d55('0x26')](function(_0xa70b8b){var _0x19f7c6=_0x2f150e[_0x3d55('0x4a')]['get']({'plain':!![]});if(!_0x19f7c6)throw new Error(_0x3d55('0x4b'));if(_0x19f7c6[_0x3d55('0x4c')]==='user'){var _0x2b8b30=_0xa70b8b['get']({'plain':!![]});var _0x46a18c=_0x3d55('0x28');return db['UserProfileSection'][_0x3d55('0x4d')]({'where':{'name':_0x46a18c,'userProfileId':_0x19f7c6[_0x3d55('0x4e')]},'raw':!![]})[_0x3d55('0x26')](function(_0x15429e){if(_0x15429e&&_0x15429e[_0x3d55('0x4f')]===0x0){return db[_0x3d55('0x50')]['create']({'name':_0x2b8b30[_0x3d55('0x2b')],'resourceId':_0x2b8b30['id'],'type':_0x15429e[_0x3d55('0x2b')],'sectionId':_0x15429e['id']},{})[_0x3d55('0x26')](function(){return _0xa70b8b;});}else{return _0xa70b8b;}})[_0x3d55('0x44')](function(_0x42970c){logger[_0x3d55('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42970c);throw _0x42970c;});}return _0xa70b8b;})[_0x3d55('0x26')](respondWithResult(_0x3dc3dd,0xc9))[_0x3d55('0x44')](handleError(_0x3dc3dd,null));};exports['update']=function(_0xc28a25,_0x3a6832){if(_0xc28a25[_0x3d55('0x49')]['id']){delete _0xc28a25[_0x3d55('0x49')]['id'];}return db[_0x3d55('0x2e')][_0x3d55('0x4d')]({'where':{'id':_0xc28a25[_0x3d55('0x46')]['id']}})[_0x3d55('0x26')](handleEntityNotFound(_0x3a6832,null))['then'](saveUpdates(_0xc28a25[_0x3d55('0x49')],null))['then'](respondWithResult(_0x3a6832,null))[_0x3d55('0x44')](handleError(_0x3a6832,null));};exports[_0x3d55('0x27')]=function(_0x22124c,_0x3e4e0b){return db[_0x3d55('0x2e')][_0x3d55('0x4d')]({'where':{'id':_0x22124c[_0x3d55('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e4e0b,null))[_0x3d55('0x26')](removeEntity(_0x3e4e0b,null))[_0x3d55('0x44')](handleError(_0x3e4e0b,null));};exports[_0x3d55('0x51')]=function(_0x53e311,_0x62437,_0x3e538c){return db[_0x3d55('0x2e')]['find']({'where':{'id':_0x53e311['params']['id']},'attributes':[_0x3d55('0x2b'),'basename',_0x3d55('0x52'),_0x3d55('0x53')],'raw':!![]})[_0x3d55('0x26')](handleEntityNotFound(_0x62437,null))[_0x3d55('0x26')](function(_0x2daf11){if(_0x2daf11){if(!fs[_0x3d55('0x54')](path[_0x3d55('0x55')](config[_0x3d55('0x56')],_0x3d55('0x57'),_0x2daf11['savename']))){throw new db['Sequelize'][(_0x3d55('0x58'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x53e311[_0x3d55('0x33')]['exists']){return _0x62437[_0x3d55('0x19')](0xc8);}return _0x62437[_0x3d55('0x51')](path[_0x3d55('0x55')](config[_0x3d55('0x56')],_0x3d55('0x57'),_0x2daf11[_0x3d55('0x52')]),util['format'](_0x3d55('0x59'),_0x2daf11[_0x3d55('0x5a')]||_0x2daf11[_0x3d55('0x2b')],_0x2daf11[_0x3d55('0x53')]['toLowerCase']()));}})[_0x3d55('0x44')](handleError(_0x62437,null));}; \ No newline at end of file +var _0x839b=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','destroy','then','get','ExtractedReports','UserProfileResource','error','name','send','index','AnalyticExtractedReport','rawAttributes','type','key','model','map','query','filters','intersection','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','keys','fields','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','params','download','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','format','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x190681,_0x590f58){var _0x4f2ada=function(_0x4556db){while(--_0x4556db){_0x190681['push'](_0x190681['shift']());}};_0x4f2ada(++_0x590f58);}(_0x839b,0x1d5));var _0xb839=function(_0x3dfc7e,_0x1e87d1){_0x3dfc7e=_0x3dfc7e-0x0;var _0x1d45ad=_0x839b[_0x3dfc7e];return _0x1d45ad;};'use strict';var emlformat=require(_0xb839('0x0'));var rimraf=require(_0xb839('0x1'));var zipdir=require(_0xb839('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb839('0x3'));var moment=require(_0xb839('0x4'));var BPromise=require(_0xb839('0x5'));var Mustache=require(_0xb839('0x6'));var util=require(_0xb839('0x7'));var path=require(_0xb839('0x8'));var sox=require('sox');var csv=require(_0xb839('0x9'));var ejs=require(_0xb839('0xa'));var fs=require('fs');var fs_extra=require(_0xb839('0xb'));var _=require(_0xb839('0xc'));var squel=require(_0xb839('0xd'));var crypto=require(_0xb839('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb839('0xf'));var toCsv=require(_0xb839('0x9'));var querystring=require(_0xb839('0x10'));var Papa=require(_0xb839('0x11'));var Redis=require(_0xb839('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb839('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb839('0x14'));var utils=require(_0xb839('0x15'));var config=require(_0xb839('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb839('0x17'))['db'];function respondWithStatusCode(_0xec2323,_0x5dc3c2){_0x5dc3c2=_0x5dc3c2||0xcc;return function(_0x56ec57){if(_0x56ec57){return _0xec2323[_0xb839('0x18')](_0x5dc3c2);}return _0xec2323[_0xb839('0x19')](_0x5dc3c2)[_0xb839('0x1a')]();};}function respondWithResult(_0x21aa94,_0x3d58c2){_0x3d58c2=_0x3d58c2||0xc8;return function(_0x715738){if(_0x715738){return _0x21aa94['status'](_0x3d58c2)['json'](_0x715738);}};}function respondWithFilteredResult(_0x1637e9,_0x378680){return function(_0x3940cc){if(_0x3940cc){var _0x22fcf6=typeof _0x378680[_0xb839('0x1b')]===_0xb839('0x1c')&&typeof _0x378680[_0xb839('0x1d')]===_0xb839('0x1c');var _0x39e5fe=_0x3940cc['count'];var _0x2e63fd=_0x22fcf6?0x0:_0x378680[_0xb839('0x1b')];var _0x4b74a0=_0x22fcf6?_0x3940cc[_0xb839('0x1e')]:_0x378680[_0xb839('0x1b')]+_0x378680[_0xb839('0x1d')];var _0x23ee8d;if(_0x4b74a0>=_0x39e5fe){_0x4b74a0=_0x39e5fe;_0x23ee8d=0xc8;}else{_0x23ee8d=0xce;}_0x1637e9['status'](_0x23ee8d);return _0x1637e9[_0xb839('0x1f')](_0xb839('0x20'),_0x2e63fd+'-'+_0x4b74a0+'/'+_0x39e5fe)[_0xb839('0x21')](_0x3940cc);}return null;};}function patchUpdates(_0xca46ee){return function(_0x2a2f2f){try{jsonpatch['apply'](_0x2a2f2f,_0xca46ee,!![]);}catch(_0x6886ee){return BPromise[_0xb839('0x22')](_0x6886ee);}return _0x2a2f2f['save']();};}function saveUpdates(_0x517c77,_0x714c9c){return function(_0x5ab670){if(_0x5ab670){return _0x5ab670[_0xb839('0x23')](_0x517c77)['then'](function(_0x335282){return _0x335282;});}return null;};}function removeEntity(_0x186d2f,_0x1a291f){return function(_0x4f6a53){if(_0x4f6a53){return _0x4f6a53[_0xb839('0x24')]()[_0xb839('0x25')](function(){var _0x59216f=_0x4f6a53[_0xb839('0x26')]({'plain':!![]});var _0x1c787c=_0xb839('0x27');return db[_0xb839('0x28')]['destroy']({'where':{'type':_0x1c787c,'resourceId':_0x59216f['id']}})['then'](function(){return _0x4f6a53;});})[_0xb839('0x25')](function(){_0x186d2f[_0xb839('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf89712,_0x123b50){return function(_0x538b15){if(!_0x538b15){_0xf89712[_0xb839('0x18')](0x194);}return _0x538b15;};}function handleError(_0x10b8ff,_0x49ec87){_0x49ec87=_0x49ec87||0x1f4;return function(_0x40748d){logger[_0xb839('0x29')](_0x40748d['stack']);if(_0x40748d[_0xb839('0x2a')]){delete _0x40748d[_0xb839('0x2a')];}_0x10b8ff['status'](_0x49ec87)[_0xb839('0x2b')](_0x40748d);};}exports[_0xb839('0x2c')]=function(_0x32e4a5,_0x4a138b){var _0x3ca1a9={},_0x57a699={},_0x32c99e={'count':0x0,'rows':[]};var _0x1d15cb=_['map'](db[_0xb839('0x2d')][_0xb839('0x2e')],function(_0x3c10a0){return{'name':_0x3c10a0['fieldName'],'type':_0x3c10a0[_0xb839('0x2f')][_0xb839('0x30')]};});_0x57a699[_0xb839('0x31')]=_[_0xb839('0x32')](_0x1d15cb,_0xb839('0x2a'));_0x57a699[_0xb839('0x33')]=_['keys'](_0x32e4a5[_0xb839('0x33')]);_0x57a699[_0xb839('0x34')]=_[_0xb839('0x35')](_0x57a699[_0xb839('0x31')],_0x57a699[_0xb839('0x33')]);_0x3ca1a9[_0xb839('0x36')]=_[_0xb839('0x35')](_0x57a699[_0xb839('0x31')],qs['fields'](_0x32e4a5[_0xb839('0x33')]['fields']));_0x3ca1a9[_0xb839('0x36')]=_0x3ca1a9['attributes']['length']?_0x3ca1a9[_0xb839('0x36')]:_0x57a699[_0xb839('0x31')];if(!_0x32e4a5[_0xb839('0x33')]['hasOwnProperty'](_0xb839('0x37'))){_0x3ca1a9[_0xb839('0x1d')]=qs[_0xb839('0x1d')](_0x32e4a5[_0xb839('0x33')][_0xb839('0x1d')]);_0x3ca1a9[_0xb839('0x1b')]=qs[_0xb839('0x1b')](_0x32e4a5['query']['offset']);}_0x3ca1a9[_0xb839('0x38')]=qs[_0xb839('0x39')](_0x32e4a5[_0xb839('0x33')][_0xb839('0x39')]);_0x3ca1a9[_0xb839('0x3a')]=qs[_0xb839('0x34')](_[_0xb839('0x3b')](_0x32e4a5[_0xb839('0x33')],_0x57a699['filters']),_0x1d15cb);if(_0x32e4a5['query'][_0xb839('0x3c')]){_0x3ca1a9[_0xb839('0x3a')]=_[_0xb839('0x3d')](_0x3ca1a9[_0xb839('0x3a')],{'$or':_[_0xb839('0x32')](_0x1d15cb,function(_0x1a8a27){if(_0x1a8a27[_0xb839('0x2f')]!==_0xb839('0x3e')){var _0x8c5cd4={};_0x8c5cd4[_0x1a8a27[_0xb839('0x2a')]]={'$like':'%'+_0x32e4a5[_0xb839('0x33')]['filter']+'%'};return _0x8c5cd4;}})});}_0x3ca1a9=_['merge']({},_0x3ca1a9,_0x32e4a5['options']);var _0x3ad5b6={'where':_0x3ca1a9[_0xb839('0x3a')]};return db['AnalyticExtractedReport'][_0xb839('0x1e')](_0x3ad5b6)['then'](function(_0x1e858a){_0x32c99e[_0xb839('0x1e')]=_0x1e858a;if(_0x32e4a5[_0xb839('0x33')][_0xb839('0x3f')]){_0x3ca1a9[_0xb839('0x40')]=[{'all':!![]}];}return db[_0xb839('0x2d')][_0xb839('0x41')](_0x3ca1a9);})[_0xb839('0x25')](function(_0x30df8a){_0x32c99e[_0xb839('0x42')]=_0x30df8a;return _0x32c99e;})[_0xb839('0x25')](respondWithFilteredResult(_0x4a138b,_0x3ca1a9))['catch'](handleError(_0x4a138b,null));};exports['show']=function(_0x23ac6b,_0x550816){var _0x4b9f5e={'raw':!![],'where':{'id':_0x23ac6b['params']['id']}},_0x346bc2={};_0x346bc2['model']=_['keys'](db['AnalyticExtractedReport'][_0xb839('0x2e')]);_0x346bc2[_0xb839('0x33')]=_[_0xb839('0x43')](_0x23ac6b['query']);_0x346bc2[_0xb839('0x34')]=_[_0xb839('0x35')](_0x346bc2['model'],_0x346bc2[_0xb839('0x33')]);_0x4b9f5e[_0xb839('0x36')]=_[_0xb839('0x35')](_0x346bc2[_0xb839('0x31')],qs[_0xb839('0x44')](_0x23ac6b['query'][_0xb839('0x44')]));_0x4b9f5e[_0xb839('0x36')]=_0x4b9f5e[_0xb839('0x36')][_0xb839('0x45')]?_0x4b9f5e[_0xb839('0x36')]:_0x346bc2['model'];if(_0x23ac6b[_0xb839('0x33')][_0xb839('0x3f')]){_0x4b9f5e[_0xb839('0x40')]=[{'all':!![]}];}_0x4b9f5e=_[_0xb839('0x3d')]({},_0x4b9f5e,_0x23ac6b[_0xb839('0x46')]);return db[_0xb839('0x2d')][_0xb839('0x47')](_0x4b9f5e)[_0xb839('0x25')](handleEntityNotFound(_0x550816,null))[_0xb839('0x25')](respondWithResult(_0x550816,null))['catch'](handleError(_0x550816,null));};exports[_0xb839('0x48')]=function(_0x15c035,_0x1596be){return db['AnalyticExtractedReport'][_0xb839('0x48')](_0x15c035[_0xb839('0x49')],{})[_0xb839('0x25')](function(_0x2b2648){var _0x16fa32=_0x15c035[_0xb839('0x4a')][_0xb839('0x26')]({'plain':!![]});if(!_0x16fa32)throw new Error(_0xb839('0x4b'));if(_0x16fa32[_0xb839('0x4c')]==='user'){var _0x52045c=_0x2b2648['get']({'plain':!![]});var _0x584dfb=_0xb839('0x27');return db[_0xb839('0x4d')][_0xb839('0x47')]({'where':{'name':_0x584dfb,'userProfileId':_0x16fa32['userProfileId']},'raw':!![]})[_0xb839('0x25')](function(_0x40e079){if(_0x40e079&&_0x40e079[_0xb839('0x4e')]===0x0){return db['UserProfileResource'][_0xb839('0x48')]({'name':_0x52045c[_0xb839('0x2a')],'resourceId':_0x52045c['id'],'type':_0x40e079[_0xb839('0x2a')],'sectionId':_0x40e079['id']},{})[_0xb839('0x25')](function(){return _0x2b2648;});}else{return _0x2b2648;}})[_0xb839('0x4f')](function(_0x2c77ac){logger[_0xb839('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c77ac);throw _0x2c77ac;});}return _0x2b2648;})[_0xb839('0x25')](respondWithResult(_0x1596be,0xc9))[_0xb839('0x4f')](handleError(_0x1596be,null));};exports[_0xb839('0x23')]=function(_0x431039,_0x172c29){if(_0x431039[_0xb839('0x49')]['id']){delete _0x431039[_0xb839('0x49')]['id'];}return db[_0xb839('0x2d')][_0xb839('0x47')]({'where':{'id':_0x431039['params']['id']}})['then'](handleEntityNotFound(_0x172c29,null))['then'](saveUpdates(_0x431039[_0xb839('0x49')],null))[_0xb839('0x25')](respondWithResult(_0x172c29,null))[_0xb839('0x4f')](handleError(_0x172c29,null));};exports[_0xb839('0x24')]=function(_0x46e6cd,_0x4f3109){return db[_0xb839('0x2d')][_0xb839('0x47')]({'where':{'id':_0x46e6cd[_0xb839('0x50')]['id']}})['then'](handleEntityNotFound(_0x4f3109,null))['then'](removeEntity(_0x4f3109,null))['catch'](handleError(_0x4f3109,null));};exports[_0xb839('0x51')]=function(_0x14212b,_0x2d9af2,_0x2433ce){return db[_0xb839('0x2d')][_0xb839('0x47')]({'where':{'id':_0x14212b[_0xb839('0x50')]['id']},'attributes':['name','basename',_0xb839('0x52'),_0xb839('0x53')],'raw':!![]})[_0xb839('0x25')](handleEntityNotFound(_0x2d9af2,null))[_0xb839('0x25')](function(_0x44e28a){if(_0x44e28a){if(!fs[_0xb839('0x54')](path[_0xb839('0x55')](config[_0xb839('0x56')],_0xb839('0x57'),_0x44e28a[_0xb839('0x52')]))){throw new db[(_0xb839('0x58'))][(_0xb839('0x59'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x14212b[_0xb839('0x33')][_0xb839('0x5a')]){return _0x2d9af2['sendStatus'](0xc8);}return _0x2d9af2['download'](path['join'](config['root'],_0xb839('0x57'),_0x44e28a[_0xb839('0x52')]),util[_0xb839('0x5b')](_0xb839('0x5c'),_0x44e28a[_0xb839('0x5d')]||_0x44e28a[_0xb839('0x2a')],_0x44e28a[_0xb839('0x53')][_0xb839('0x5e')]()));}})[_0xb839('0x4f')](handleError(_0x2d9af2,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 7645001..cdda4bb 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 _0x8c0d=['analytics_extracted_reports','util','../../config/logger','moment','bluebird','request-promise','path','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport'];(function(_0x30bc19,_0xfcd0f1){var _0x331b0c=function(_0x3f2a16){while(--_0x3f2a16){_0x30bc19['push'](_0x30bc19['shift']());}};_0x331b0c(++_0xfcd0f1);}(_0x8c0d,0x1c4));var _0xd8c0=function(_0x2a7812,_0x1ce83a){_0x2a7812=_0x2a7812-0x0;var _0x3e1342=_0x8c0d[_0x2a7812];return _0x3e1342;};'use strict';var _=require('lodash');var util=require(_0xd8c0('0x0'));var logger=require(_0xd8c0('0x1'))('api');var moment=require(_0xd8c0('0x2'));var BPromise=require(_0xd8c0('0x3'));var rp=require(_0xd8c0('0x4'));var fs=require('fs');var path=require(_0xd8c0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd8c0('0x6'));module[_0xd8c0('0x7')]=function(_0x377140,_0x5279ab){return _0x377140[_0xd8c0('0x8')](_0xd8c0('0x9'),attributes,{'tableName':_0xd8c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71b3=['request-promise','path','rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment','bluebird'];(function(_0x3adab5,_0x3ad972){var _0x1db29e=function(_0x230b1b){while(--_0x230b1b){_0x3adab5['push'](_0x3adab5['shift']());}};_0x1db29e(++_0x3ad972);}(_0x71b3,0x1cf));var _0x371b=function(_0x432cc2,_0x415021){_0x432cc2=_0x432cc2-0x0;var _0x567692=_0x71b3[_0x432cc2];return _0x567692;};'use strict';var _=require(_0x371b('0x0'));var util=require(_0x371b('0x1'));var logger=require('../../config/logger')(_0x371b('0x2'));var moment=require(_0x371b('0x3'));var BPromise=require(_0x371b('0x4'));var rp=require(_0x371b('0x5'));var fs=require('fs');var path=require(_0x371b('0x6'));var rimraf=require(_0x371b('0x7'));var config=require('../../config/environment');var attributes=require(_0x371b('0x8'));module[_0x371b('0x9')]=function(_0x2806cb,_0x3a5c0a){return _0x2806cb[_0x371b('0xa')](_0x371b('0xb'),attributes,{'tableName':_0x371b('0xc'),'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 24c083c..bca8a4e 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 _0xeae7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird'];(function(_0x149943,_0x52045a){var _0x3a1612=function(_0x34c5a5){while(--_0x34c5a5){_0x149943['push'](_0x149943['shift']());}};_0x3a1612(++_0x52045a);}(_0xeae7,0x1a1));var _0x7eae=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0xeae7[_0x8ae98b];return _0xc30bd4;};'use strict';var _=require('lodash');var util=require(_0x7eae('0x0'));var moment=require(_0x7eae('0x1'));var BPromise=require(_0x7eae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7eae('0x3'));var db=require(_0x7eae('0x4'))['db'];var utils=require(_0x7eae('0x5'));var logger=require(_0x7eae('0x6'))(_0x7eae('0x7'));var config=require(_0x7eae('0x8'));var jayson=require(_0x7eae('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd01591,_0xfcbb05,_0x4acf71){return new BPromise(function(_0x3141b7,_0x50a3d9){return client[_0x7eae('0xa')](_0xd01591,_0x4acf71)[_0x7eae('0xb')](function(_0x1b6f32){logger[_0x7eae('0xc')](_0x7eae('0xd'),_0xfcbb05,_0x7eae('0xe'));logger[_0x7eae('0xf')](_0x7eae('0x10'),_0xfcbb05,_0x7eae('0xe'),JSON[_0x7eae('0x11')](_0x1b6f32));if(_0x1b6f32[_0x7eae('0x12')]){if(_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x13')]===0x1f4){logger['error'](_0x7eae('0xd'),_0xfcbb05,_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x14')]);return _0x50a3d9(_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x14')]);}logger[_0x7eae('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xfcbb05,_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x14')]);return _0x3141b7(_0x1b6f32[_0x7eae('0x12')]['message']);}else{logger['info'](_0x7eae('0xd'),_0xfcbb05,_0x7eae('0xe'));_0x3141b7(_0x1b6f32['result'][_0x7eae('0x14')]);}})['catch'](function(_0x477a8f){logger[_0x7eae('0x12')](_0x7eae('0xd'),_0xfcbb05,_0x477a8f);_0x50a3d9(_0x477a8f);});});} \ No newline at end of file +var _0x71a0=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','info','catch','util','moment','bluebird'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x71a0,0xba));var _0x071a=function(_0x5b4969,_0x397176){_0x5b4969=_0x5b4969-0x0;var _0x175255=_0x71a0[_0x5b4969];return _0x175255;};'use strict';var _=require('lodash');var util=require(_0x071a('0x0'));var moment=require(_0x071a('0x1'));var BPromise=require(_0x071a('0x2'));var rs=require(_0x071a('0x3'));var fs=require('fs');var Redis=require(_0x071a('0x4'));var db=require(_0x071a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x071a('0x6'))(_0x071a('0x7'));var config=require('../../config/environment');var jayson=require(_0x071a('0x8'));var client=jayson[_0x071a('0x9')][_0x071a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11fb82,_0x2d64f5,_0x5ecc54){return new BPromise(function(_0x3be655,_0x496b0b){return client[_0x071a('0xb')](_0x11fb82,_0x5ecc54)[_0x071a('0xc')](function(_0x1b6407){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x2d64f5,_0x071a('0xd'));logger['debug'](_0x071a('0xe'),_0x2d64f5,'request\x20sent',JSON[_0x071a('0xf')](_0x1b6407));if(_0x1b6407[_0x071a('0x10')]){if(_0x1b6407[_0x071a('0x10')]['code']===0x1f4){logger[_0x071a('0x10')](_0x071a('0x11'),_0x2d64f5,_0x1b6407[_0x071a('0x10')][_0x071a('0x12')]);return _0x496b0b(_0x1b6407[_0x071a('0x10')][_0x071a('0x12')]);}logger[_0x071a('0x10')](_0x071a('0x11'),_0x2d64f5,_0x1b6407[_0x071a('0x10')]['message']);return _0x3be655(_0x1b6407[_0x071a('0x10')][_0x071a('0x12')]);}else{logger[_0x071a('0x13')](_0x071a('0x11'),_0x2d64f5,_0x071a('0xd'));_0x3be655(_0x1b6407['result'][_0x071a('0x12')]);}})[_0x071a('0x14')](function(_0x4cc144){logger[_0x071a('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2d64f5,_0x4cc144);_0x496b0b(_0x4cc144);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index d1436c7..3f41446 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 _0xbd0b=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','create','update','exports'];(function(_0x418549,_0x11b13d){var _0x288826=function(_0x3c0411){while(--_0x3c0411){_0x418549['push'](_0x418549['shift']());}};_0x288826(++_0x11b13d);}(_0xbd0b,0xbb));var _0xbbd0=function(_0x36cf34,_0x335fbe){_0x36cf34=_0x36cf34-0x0;var _0x3fce54=_0xbd0b[_0x36cf34];return _0x3fce54;};'use strict';var multer=require(_0xbbd0('0x0'));var util=require(_0xbbd0('0x1'));var path=require('path');var timeout=require(_0xbbd0('0x2'));var express=require(_0xbbd0('0x3'));var router=express[_0xbbd0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbbd0('0x5'));var config=require(_0xbbd0('0x6'));var controller=require(_0xbbd0('0x7'));router[_0xbbd0('0x8')]('/',auth[_0xbbd0('0x9')](),controller[_0xbbd0('0xa')]);router[_0xbbd0('0x8')](_0xbbd0('0xb'),auth[_0xbbd0('0x9')](),controller[_0xbbd0('0xc')]);router[_0xbbd0('0x8')](_0xbbd0('0xd'),auth[_0xbbd0('0x9')](),controller['download']);router['post']('/',auth[_0xbbd0('0x9')](),controller[_0xbbd0('0xe')]);router['put'](_0xbbd0('0xb'),auth[_0xbbd0('0x9')](),controller[_0xbbd0('0xf')]);router['delete'](_0xbbd0('0xb'),auth[_0xbbd0('0x9')](),controller['destroy']);module[_0xbbd0('0x10')]=router; \ No newline at end of file +var _0x4c77=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id/download','download','post','create','put','/:id','update'];(function(_0x4dfda5,_0x56c108){var _0xd0f712=function(_0x37fcb1){while(--_0x37fcb1){_0x4dfda5['push'](_0x4dfda5['shift']());}};_0xd0f712(++_0x56c108);}(_0x4c77,0xdf));var _0x74c7=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4c77[_0x5d6456];return _0x4d66c1;};'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(_0x74c7('0x4'));var router=express[_0x74c7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x74c7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x74c7('0x7'));var controller=require(_0x74c7('0x8'));router[_0x74c7('0x9')]('/',auth[_0x74c7('0xa')](),controller[_0x74c7('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x74c7('0xc'),auth[_0x74c7('0xa')](),controller[_0x74c7('0xd')]);router[_0x74c7('0xe')]('/',auth[_0x74c7('0xa')](),controller[_0x74c7('0xf')]);router[_0x74c7('0x10')](_0x74c7('0x11'),auth[_0x74c7('0xa')](),controller[_0x74c7('0x12')]);router[_0x74c7('0x13')]('/:id',auth[_0x74c7('0xa')](),controller[_0x74c7('0x14')]);module[_0x74c7('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 08b74ed..fda61bb 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 _0x9098=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x4ee3e7,_0x1a955a){var _0x185243=function(_0x4a024d){while(--_0x4a024d){_0x4ee3e7['push'](_0x4ee3e7['shift']());}};_0x185243(++_0x1a955a);}(_0x9098,0x19a));var _0x8909=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9098[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x8909('0x0'));module[_0x8909('0x1')]={'field':{'type':Sequelize[_0x8909('0x2')]},'alias':{'type':Sequelize[_0x8909('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x8909('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x8909('0x3')]},'custom':{'type':Sequelize[_0x8909('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x732b=['TEXT','STRING','exports'];(function(_0x7f37da,_0x30a906){var _0x474378=function(_0x5f0b57){while(--_0x5f0b57){_0x7f37da['push'](_0x7f37da['shift']());}};_0x474378(++_0x30a906);}(_0x732b,0xbf));var _0xb732=function(_0x4080db,_0xffeecc){_0x4080db=_0x4080db-0x0;var _0x4d1937=_0x732b[_0x4080db];return _0x4d1937;};'use strict';var Sequelize=require('sequelize');module[_0xb732('0x0')]={'field':{'type':Sequelize[_0xb732('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xb732('0x2')]},'format':{'type':Sequelize[_0xb732('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb732('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 4765459..9e4cdf4 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 _0x06d7=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','apply','reject','update','destroy','error','name','send','index','map','AnalyticFieldReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','then','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir'];(function(_0x152e5d,_0x5c41ee){var _0x14aa0e=function(_0x4b9d43){while(--_0x4b9d43){_0x152e5d['push'](_0x152e5d['shift']());}};_0x14aa0e(++_0x5c41ee);}(_0x06d7,0x19c));var _0x706d=function(_0x520071,_0x449f4d){_0x520071=_0x520071-0x0;var _0x2c2ec6=_0x06d7[_0x520071];return _0x2c2ec6;};'use strict';var emlformat=require(_0x706d('0x0'));var rimraf=require(_0x706d('0x1'));var zipdir=require(_0x706d('0x2'));var jsonpatch=require(_0x706d('0x3'));var rp=require(_0x706d('0x4'));var moment=require(_0x706d('0x5'));var BPromise=require(_0x706d('0x6'));var Mustache=require(_0x706d('0x7'));var util=require(_0x706d('0x8'));var path=require('path');var sox=require(_0x706d('0x9'));var csv=require(_0x706d('0xa'));var ejs=require(_0x706d('0xb'));var fs=require('fs');var fs_extra=require(_0x706d('0xc'));var _=require(_0x706d('0xd'));var squel=require('squel');var crypto=require(_0x706d('0xe'));var jsforce=require(_0x706d('0xf'));var deskjs=require(_0x706d('0x10'));var toCsv=require(_0x706d('0xa'));var querystring=require(_0x706d('0x11'));var Papa=require(_0x706d('0x12'));var Redis=require(_0x706d('0x13'));var authService=require(_0x706d('0x14'));var qs=require(_0x706d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x706d('0x16'))('api');var utils=require(_0x706d('0x17'));var config=require(_0x706d('0x18'));var licenseUtil=require(_0x706d('0x19'));var db=require(_0x706d('0x1a'))['db'];function respondWithStatusCode(_0x370334,_0x3b2255){_0x3b2255=_0x3b2255||0xcc;return function(_0x42aadb){if(_0x42aadb){return _0x370334[_0x706d('0x1b')](_0x3b2255);}return _0x370334['status'](_0x3b2255)[_0x706d('0x1c')]();};}function respondWithResult(_0x245ddf,_0x1acceb){_0x1acceb=_0x1acceb||0xc8;return function(_0x5df650){if(_0x5df650){return _0x245ddf[_0x706d('0x1d')](_0x1acceb)['json'](_0x5df650);}};}function respondWithFilteredResult(_0x1b9ae8,_0x34aa9e){return function(_0x4194a1){if(_0x4194a1){var _0x322cf0=typeof _0x34aa9e['offset']===_0x706d('0x1e')&&typeof _0x34aa9e[_0x706d('0x1f')]===_0x706d('0x1e');var _0x23b596=_0x4194a1[_0x706d('0x20')];var _0x5c9b81=_0x322cf0?0x0:_0x34aa9e[_0x706d('0x21')];var _0x1f6d59=_0x322cf0?_0x4194a1[_0x706d('0x20')]:_0x34aa9e[_0x706d('0x21')]+_0x34aa9e[_0x706d('0x1f')];var _0x4d7c94;if(_0x1f6d59>=_0x23b596){_0x1f6d59=_0x23b596;_0x4d7c94=0xc8;}else{_0x4d7c94=0xce;}_0x1b9ae8['status'](_0x4d7c94);return _0x1b9ae8[_0x706d('0x22')]('Content-Range',_0x5c9b81+'-'+_0x1f6d59+'/'+_0x23b596)['json'](_0x4194a1);}return null;};}function patchUpdates(_0x4adc01){return function(_0x413608){try{jsonpatch[_0x706d('0x23')](_0x413608,_0x4adc01,!![]);}catch(_0x71bec7){return BPromise[_0x706d('0x24')](_0x71bec7);}return _0x413608['save']();};}function saveUpdates(_0x10b0ab,_0x1f52d0){return function(_0xeba428){if(_0xeba428){return _0xeba428[_0x706d('0x25')](_0x10b0ab)['then'](function(_0x204661){return _0x204661;});}return null;};}function removeEntity(_0x25f28a,_0x3bb8b4){return function(_0x165679){if(_0x165679){return _0x165679[_0x706d('0x26')]()['then'](function(){_0x25f28a['status'](0xcc)[_0x706d('0x1c')]();});}};}function handleEntityNotFound(_0x2f0124,_0x5362a0){return function(_0x5e2367){if(!_0x5e2367){_0x2f0124[_0x706d('0x1b')](0x194);}return _0x5e2367;};}function handleError(_0x400e11,_0x55d6c3){_0x55d6c3=_0x55d6c3||0x1f4;return function(_0xce7b19){logger[_0x706d('0x27')](_0xce7b19['stack']);if(_0xce7b19[_0x706d('0x28')]){delete _0xce7b19['name'];}_0x400e11[_0x706d('0x1d')](_0x55d6c3)[_0x706d('0x29')](_0xce7b19);};}exports[_0x706d('0x2a')]=function(_0x1ddbd2,_0x774899){var _0x321dbe={},_0x567a82={},_0x4972ba={'count':0x0,'rows':[]};var _0x558edf=_[_0x706d('0x2b')](db[_0x706d('0x2c')]['rawAttributes'],function(_0x39dcf8){return{'name':_0x39dcf8[_0x706d('0x2d')],'type':_0x39dcf8[_0x706d('0x2e')]['key']};});_0x567a82[_0x706d('0x2f')]=_['map'](_0x558edf,_0x706d('0x28'));_0x567a82[_0x706d('0x30')]=_[_0x706d('0x31')](_0x1ddbd2[_0x706d('0x30')]);_0x567a82[_0x706d('0x32')]=_[_0x706d('0x33')](_0x567a82['model'],_0x567a82[_0x706d('0x30')]);_0x321dbe[_0x706d('0x34')]=_[_0x706d('0x33')](_0x567a82['model'],qs['fields'](_0x1ddbd2['query'][_0x706d('0x35')]));_0x321dbe[_0x706d('0x34')]=_0x321dbe['attributes'][_0x706d('0x36')]?_0x321dbe[_0x706d('0x34')]:_0x567a82[_0x706d('0x2f')];if(!_0x1ddbd2[_0x706d('0x30')][_0x706d('0x37')](_0x706d('0x38'))){_0x321dbe[_0x706d('0x1f')]=qs[_0x706d('0x1f')](_0x1ddbd2['query'][_0x706d('0x1f')]);_0x321dbe['offset']=qs[_0x706d('0x21')](_0x1ddbd2['query'][_0x706d('0x21')]);}_0x321dbe['order']=qs[_0x706d('0x39')](_0x1ddbd2[_0x706d('0x30')]['sort']);_0x321dbe[_0x706d('0x3a')]=qs[_0x706d('0x32')](_[_0x706d('0x3b')](_0x1ddbd2['query'],_0x567a82[_0x706d('0x32')]),_0x558edf);if(_0x1ddbd2['query'][_0x706d('0x3c')]){_0x321dbe[_0x706d('0x3a')]=_[_0x706d('0x3d')](_0x321dbe[_0x706d('0x3a')],{'$or':_[_0x706d('0x2b')](_0x558edf,function(_0x36b860){if(_0x36b860[_0x706d('0x2e')]!=='VIRTUAL'){var _0x565bf4={};_0x565bf4[_0x36b860[_0x706d('0x28')]]={'$like':'%'+_0x1ddbd2[_0x706d('0x30')][_0x706d('0x3c')]+'%'};return _0x565bf4;}})});}_0x321dbe=_[_0x706d('0x3d')]({},_0x321dbe,_0x1ddbd2['options']);var _0x4c69c3={'where':_0x321dbe[_0x706d('0x3a')]};return db[_0x706d('0x2c')][_0x706d('0x20')](_0x4c69c3)[_0x706d('0x3e')](function(_0x4b53b6){_0x4972ba[_0x706d('0x20')]=_0x4b53b6;if(_0x1ddbd2[_0x706d('0x30')][_0x706d('0x3f')]){_0x321dbe[_0x706d('0x40')]=[{'all':!![]}];}return db[_0x706d('0x2c')][_0x706d('0x41')](_0x321dbe);})[_0x706d('0x3e')](function(_0x447abc){_0x4972ba[_0x706d('0x42')]=_0x447abc;return _0x4972ba;})['then'](respondWithFilteredResult(_0x774899,_0x321dbe))[_0x706d('0x43')](handleError(_0x774899,null));};exports['show']=function(_0x31fe14,_0xc8da00){var _0x382746={'raw':![],'where':{'id':_0x31fe14[_0x706d('0x44')]['id']}},_0x504767={};_0x504767[_0x706d('0x2f')]=_[_0x706d('0x31')](db[_0x706d('0x2c')][_0x706d('0x45')]);_0x504767[_0x706d('0x30')]=_['keys'](_0x31fe14['query']);_0x504767[_0x706d('0x32')]=_[_0x706d('0x33')](_0x504767['model'],_0x504767[_0x706d('0x30')]);_0x382746[_0x706d('0x34')]=_[_0x706d('0x33')](_0x504767[_0x706d('0x2f')],qs[_0x706d('0x35')](_0x31fe14[_0x706d('0x30')]['fields']));_0x382746[_0x706d('0x34')]=_0x382746[_0x706d('0x34')]['length']?_0x382746['attributes']:_0x504767['model'];if(_0x31fe14[_0x706d('0x30')]['includeAll']){_0x382746['include']=[{'all':!![]}];}_0x382746=_[_0x706d('0x3d')]({},_0x382746,_0x31fe14[_0x706d('0x46')]);return db[_0x706d('0x2c')][_0x706d('0x47')](_0x382746)[_0x706d('0x3e')](handleEntityNotFound(_0xc8da00,null))['then'](respondWithResult(_0xc8da00,null))['catch'](handleError(_0xc8da00,null));};exports[_0x706d('0x48')]=function(_0x52c8da,_0x841369){return db[_0x706d('0x2c')][_0x706d('0x48')](_0x52c8da[_0x706d('0x49')],{})[_0x706d('0x3e')](respondWithResult(_0x841369,0xc9))['catch'](handleError(_0x841369,null));};exports[_0x706d('0x4a')]=function(_0x1b130c,_0x53178f){return db[_0x706d('0x2c')][_0x706d('0x4a')](_0x1b130c['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x53178f,0xc9))[_0x706d('0x43')](handleError(_0x53178f,null));};exports[_0x706d('0x25')]=function(_0x8b0dca,_0xba2e77){if(_0x8b0dca[_0x706d('0x49')]['id']){delete _0x8b0dca['body']['id'];}return db[_0x706d('0x2c')][_0x706d('0x47')]({'where':{'id':_0x8b0dca[_0x706d('0x44')]['id']}})[_0x706d('0x3e')](handleEntityNotFound(_0xba2e77,null))[_0x706d('0x3e')](saveUpdates(_0x8b0dca['body'],null))['then'](respondWithResult(_0xba2e77,null))['catch'](handleError(_0xba2e77,null));};exports['destroy']=function(_0x117841,_0x339c6e){return db[_0x706d('0x2c')][_0x706d('0x47')]({'where':{'id':_0x117841[_0x706d('0x44')]['id']}})['then'](handleEntityNotFound(_0x339c6e,null))[_0x706d('0x3e')](removeEntity(_0x339c6e,null))[_0x706d('0x43')](handleError(_0x339c6e,null));};exports[_0x706d('0x4b')]=function(_0xe40444,_0x214a9){return db[_0x706d('0x2c')][_0x706d('0x26')]({'where':{'id':_0xe40444[_0x706d('0x30')][_0x706d('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x706d('0x3e')](respondWithResult(_0x214a9,0xcc))['catch'](handleError(_0x214a9,null));};exports[_0x706d('0x4d')]=function(_0x538e64,_0x5b0531,_0x484040){return db[_0x706d('0x4e')][_0x706d('0x4f')]({'where':{'id':_0x538e64[_0x706d('0x44')]['id']}})[_0x706d('0x3e')](handleEntityNotFound(_0x5b0531,null))['then'](function(_0x90384){if(_0x90384){return db[_0x706d('0x50')][_0x706d('0x51')](function(_0x57f322){return db[_0x706d('0x2c')][_0x706d('0x26')]({'where':{'CustomReportId':_0x538e64[_0x706d('0x44')]['id']},'transaction':_0x57f322})[_0x706d('0x3e')](function(_0x11e02d){var _0x1d0af1=_[_0x706d('0x2b')](_0x538e64['body'],function(_0x373ff8){delete _0x373ff8['id'];_0x373ff8[_0x706d('0x52')]=_0x538e64['params']['id'];return _0x373ff8;});return db[_0x706d('0x2c')][_0x706d('0x4a')](_0x1d0af1,{'transaction':_0x57f322});});})['then'](function(){return db[_0x706d('0x2c')][_0x706d('0x41')]({'where':{'CustomReportId':_0x538e64[_0x706d('0x44')]['id']}});});}})[_0x706d('0x3e')](respondWithResult(_0x5b0531,null))[_0x706d('0x43')](handleError(_0x5b0531,null));}; \ No newline at end of file +var _0xaa57=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','update','then','error','name','index','AnalyticFieldReport','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','findAll','rows','catch','show','params','includeAll','include','create','bulkCreate','body','find','destroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x41995b,_0x33282e){var _0x4a3652=function(_0x222a5a){while(--_0x222a5a){_0x41995b['push'](_0x41995b['shift']());}};_0x4a3652(++_0x33282e);}(_0xaa57,0x182));var _0x7aa5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xaa57[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x7aa5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7aa5('0x1'));var rp=require(_0x7aa5('0x2'));var moment=require(_0x7aa5('0x3'));var BPromise=require(_0x7aa5('0x4'));var Mustache=require(_0x7aa5('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7aa5('0x6'));var ejs=require(_0x7aa5('0x7'));var fs=require('fs');var fs_extra=require(_0x7aa5('0x8'));var _=require('lodash');var squel=require(_0x7aa5('0x9'));var crypto=require(_0x7aa5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7aa5('0xb'));var toCsv=require(_0x7aa5('0x6'));var querystring=require(_0x7aa5('0xc'));var Papa=require('papaparse');var Redis=require(_0x7aa5('0xd'));var authService=require(_0x7aa5('0xe'));var qs=require(_0x7aa5('0xf'));var as=require(_0x7aa5('0x10'));var hardwareService=require(_0x7aa5('0x11'));var logger=require(_0x7aa5('0x12'))(_0x7aa5('0x13'));var utils=require(_0x7aa5('0x14'));var config=require(_0x7aa5('0x15'));var licenseUtil=require(_0x7aa5('0x16'));var db=require(_0x7aa5('0x17'))['db'];function respondWithStatusCode(_0x4c897,_0x34cc9c){_0x34cc9c=_0x34cc9c||0xcc;return function(_0x424a7a){if(_0x424a7a){return _0x4c897[_0x7aa5('0x18')](_0x34cc9c);}return _0x4c897[_0x7aa5('0x19')](_0x34cc9c)[_0x7aa5('0x1a')]();};}function respondWithResult(_0x1875ef,_0x3e7d26){_0x3e7d26=_0x3e7d26||0xc8;return function(_0x4c298a){if(_0x4c298a){return _0x1875ef[_0x7aa5('0x19')](_0x3e7d26)['json'](_0x4c298a);}};}function respondWithFilteredResult(_0x54c010,_0x1a2f59){return function(_0x2e7f15){if(_0x2e7f15){var _0x396316=typeof _0x1a2f59[_0x7aa5('0x1b')]==='undefined'&&typeof _0x1a2f59[_0x7aa5('0x1c')]===_0x7aa5('0x1d');var _0x31897d=_0x2e7f15[_0x7aa5('0x1e')];var _0x4e44ec=_0x396316?0x0:_0x1a2f59[_0x7aa5('0x1b')];var _0x46bd0f=_0x396316?_0x2e7f15['count']:_0x1a2f59[_0x7aa5('0x1b')]+_0x1a2f59[_0x7aa5('0x1c')];var _0x19532a;if(_0x46bd0f>=_0x31897d){_0x46bd0f=_0x31897d;_0x19532a=0xc8;}else{_0x19532a=0xce;}_0x54c010[_0x7aa5('0x19')](_0x19532a);return _0x54c010[_0x7aa5('0x1f')]('Content-Range',_0x4e44ec+'-'+_0x46bd0f+'/'+_0x31897d)[_0x7aa5('0x20')](_0x2e7f15);}return null;};}function patchUpdates(_0x27278e){return function(_0x368f03){try{jsonpatch[_0x7aa5('0x21')](_0x368f03,_0x27278e,!![]);}catch(_0xabaf8e){return BPromise[_0x7aa5('0x22')](_0xabaf8e);}return _0x368f03['save']();};}function saveUpdates(_0x5f4720,_0x2e51b6){return function(_0x5a52a5){if(_0x5a52a5){return _0x5a52a5[_0x7aa5('0x23')](_0x5f4720)[_0x7aa5('0x24')](function(_0x25930f){return _0x25930f;});}return null;};}function removeEntity(_0x9efb5d,_0x1db12e){return function(_0x5beeea){if(_0x5beeea){return _0x5beeea['destroy']()[_0x7aa5('0x24')](function(){_0x9efb5d[_0x7aa5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x171cf6,_0x5e8730){return function(_0x1a8167){if(!_0x1a8167){_0x171cf6[_0x7aa5('0x18')](0x194);}return _0x1a8167;};}function handleError(_0x2b2365,_0xf0f1b6){_0xf0f1b6=_0xf0f1b6||0x1f4;return function(_0x40da04){logger[_0x7aa5('0x25')](_0x40da04['stack']);if(_0x40da04[_0x7aa5('0x26')]){delete _0x40da04['name'];}_0x2b2365[_0x7aa5('0x19')](_0xf0f1b6)['send'](_0x40da04);};}exports[_0x7aa5('0x27')]=function(_0x55e02d,_0x4150ab){var _0x3c5110={},_0x546d2c={},_0x963e53={'count':0x0,'rows':[]};var _0x5c5777=_['map'](db[_0x7aa5('0x28')][_0x7aa5('0x29')],function(_0xf5a0da){return{'name':_0xf5a0da[_0x7aa5('0x2a')],'type':_0xf5a0da['type'][_0x7aa5('0x2b')]};});_0x546d2c['model']=_[_0x7aa5('0x2c')](_0x5c5777,'name');_0x546d2c[_0x7aa5('0x2d')]=_[_0x7aa5('0x2e')](_0x55e02d[_0x7aa5('0x2d')]);_0x546d2c[_0x7aa5('0x2f')]=_[_0x7aa5('0x30')](_0x546d2c[_0x7aa5('0x31')],_0x546d2c[_0x7aa5('0x2d')]);_0x3c5110[_0x7aa5('0x32')]=_['intersection'](_0x546d2c[_0x7aa5('0x31')],qs['fields'](_0x55e02d['query'][_0x7aa5('0x33')]));_0x3c5110[_0x7aa5('0x32')]=_0x3c5110[_0x7aa5('0x32')][_0x7aa5('0x34')]?_0x3c5110[_0x7aa5('0x32')]:_0x546d2c[_0x7aa5('0x31')];if(!_0x55e02d[_0x7aa5('0x2d')][_0x7aa5('0x35')](_0x7aa5('0x36'))){_0x3c5110[_0x7aa5('0x1c')]=qs['limit'](_0x55e02d[_0x7aa5('0x2d')][_0x7aa5('0x1c')]);_0x3c5110['offset']=qs[_0x7aa5('0x1b')](_0x55e02d[_0x7aa5('0x2d')][_0x7aa5('0x1b')]);}_0x3c5110[_0x7aa5('0x37')]=qs['sort'](_0x55e02d['query'][_0x7aa5('0x38')]);_0x3c5110[_0x7aa5('0x39')]=qs['filters'](_[_0x7aa5('0x3a')](_0x55e02d[_0x7aa5('0x2d')],_0x546d2c[_0x7aa5('0x2f')]),_0x5c5777);if(_0x55e02d[_0x7aa5('0x2d')]['filter']){_0x3c5110['where']=_[_0x7aa5('0x3b')](_0x3c5110[_0x7aa5('0x39')],{'$or':_[_0x7aa5('0x2c')](_0x5c5777,function(_0x230ac5){if(_0x230ac5[_0x7aa5('0x3c')]!=='VIRTUAL'){var _0x283343={};_0x283343[_0x230ac5[_0x7aa5('0x26')]]={'$like':'%'+_0x55e02d['query'][_0x7aa5('0x3d')]+'%'};return _0x283343;}})});}_0x3c5110=_[_0x7aa5('0x3b')]({},_0x3c5110,_0x55e02d[_0x7aa5('0x3e')]);var _0x4c5b04={'where':_0x3c5110['where']};return db[_0x7aa5('0x28')]['count'](_0x4c5b04)[_0x7aa5('0x24')](function(_0x2033b6){_0x963e53[_0x7aa5('0x1e')]=_0x2033b6;if(_0x55e02d['query']['includeAll']){_0x3c5110['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x7aa5('0x3f')](_0x3c5110);})['then'](function(_0x18dcaa){_0x963e53[_0x7aa5('0x40')]=_0x18dcaa;return _0x963e53;})[_0x7aa5('0x24')](respondWithFilteredResult(_0x4150ab,_0x3c5110))[_0x7aa5('0x41')](handleError(_0x4150ab,null));};exports[_0x7aa5('0x42')]=function(_0x4dc340,_0x269b1a){var _0xd03d0c={'raw':![],'where':{'id':_0x4dc340[_0x7aa5('0x43')]['id']}},_0x26eaf7={};_0x26eaf7['model']=_[_0x7aa5('0x2e')](db['AnalyticFieldReport']['rawAttributes']);_0x26eaf7['query']=_[_0x7aa5('0x2e')](_0x4dc340[_0x7aa5('0x2d')]);_0x26eaf7['filters']=_[_0x7aa5('0x30')](_0x26eaf7[_0x7aa5('0x31')],_0x26eaf7['query']);_0xd03d0c[_0x7aa5('0x32')]=_[_0x7aa5('0x30')](_0x26eaf7[_0x7aa5('0x31')],qs[_0x7aa5('0x33')](_0x4dc340[_0x7aa5('0x2d')][_0x7aa5('0x33')]));_0xd03d0c[_0x7aa5('0x32')]=_0xd03d0c[_0x7aa5('0x32')][_0x7aa5('0x34')]?_0xd03d0c[_0x7aa5('0x32')]:_0x26eaf7[_0x7aa5('0x31')];if(_0x4dc340['query'][_0x7aa5('0x44')]){_0xd03d0c[_0x7aa5('0x45')]=[{'all':!![]}];}_0xd03d0c=_[_0x7aa5('0x3b')]({},_0xd03d0c,_0x4dc340['options']);return db[_0x7aa5('0x28')]['find'](_0xd03d0c)[_0x7aa5('0x24')](handleEntityNotFound(_0x269b1a,null))[_0x7aa5('0x24')](respondWithResult(_0x269b1a,null))[_0x7aa5('0x41')](handleError(_0x269b1a,null));};exports[_0x7aa5('0x46')]=function(_0x3bc54c,_0x7fdeba){return db[_0x7aa5('0x28')][_0x7aa5('0x46')](_0x3bc54c['body'],{})[_0x7aa5('0x24')](respondWithResult(_0x7fdeba,0xc9))[_0x7aa5('0x41')](handleError(_0x7fdeba,null));};exports[_0x7aa5('0x47')]=function(_0x27d18d,_0x5841d6){return db[_0x7aa5('0x28')][_0x7aa5('0x47')](_0x27d18d[_0x7aa5('0x48')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5841d6,0xc9))[_0x7aa5('0x41')](handleError(_0x5841d6,null));};exports[_0x7aa5('0x23')]=function(_0x5d0906,_0x2db372){if(_0x5d0906['body']['id']){delete _0x5d0906[_0x7aa5('0x48')]['id'];}return db['AnalyticFieldReport'][_0x7aa5('0x49')]({'where':{'id':_0x5d0906['params']['id']}})[_0x7aa5('0x24')](handleEntityNotFound(_0x2db372,null))[_0x7aa5('0x24')](saveUpdates(_0x5d0906[_0x7aa5('0x48')],null))['then'](respondWithResult(_0x2db372,null))[_0x7aa5('0x41')](handleError(_0x2db372,null));};exports[_0x7aa5('0x4a')]=function(_0x32356c,_0x480f4e){return db[_0x7aa5('0x28')][_0x7aa5('0x49')]({'where':{'id':_0x32356c[_0x7aa5('0x43')]['id']}})['then'](handleEntityNotFound(_0x480f4e,null))['then'](removeEntity(_0x480f4e,null))[_0x7aa5('0x41')](handleError(_0x480f4e,null));};exports['bulkDestroy']=function(_0x32f0d3,_0x2d5318){return db['AnalyticFieldReport'][_0x7aa5('0x4a')]({'where':{'id':_0x32f0d3[_0x7aa5('0x2d')][_0x7aa5('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x7aa5('0x24')](respondWithResult(_0x2d5318,0xcc))[_0x7aa5('0x41')](handleError(_0x2d5318,null));};exports[_0x7aa5('0x4c')]=function(_0x244e16,_0x421161,_0x2f40d3){return db[_0x7aa5('0x4d')][_0x7aa5('0x4e')]({'where':{'id':_0x244e16['params']['id']}})[_0x7aa5('0x24')](handleEntityNotFound(_0x421161,null))[_0x7aa5('0x24')](function(_0x293d16){if(_0x293d16){return db['sequelize'][_0x7aa5('0x4f')](function(_0x4afff6){return db[_0x7aa5('0x28')][_0x7aa5('0x4a')]({'where':{'CustomReportId':_0x244e16['params']['id']},'transaction':_0x4afff6})[_0x7aa5('0x24')](function(_0x7c6219){var _0x24bbf9=_[_0x7aa5('0x2c')](_0x244e16['body'],function(_0x13219b){delete _0x13219b['id'];_0x13219b[_0x7aa5('0x50')]=_0x244e16[_0x7aa5('0x43')]['id'];return _0x13219b;});return db['AnalyticFieldReport'][_0x7aa5('0x47')](_0x24bbf9,{'transaction':_0x4afff6});});})[_0x7aa5('0x24')](function(){return db['AnalyticFieldReport'][_0x7aa5('0x3f')]({'where':{'CustomReportId':_0x244e16[_0x7aa5('0x43')]['id']}});});}})['then'](respondWithResult(_0x421161,null))[_0x7aa5('0x41')](handleError(_0x421161,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 52b64a2..729b63d 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 _0xf993=['exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise','./analyticFieldReport.attributes'];(function(_0x4cebcc,_0x56253e){var _0x4d1669=function(_0x89e326){while(--_0x89e326){_0x4cebcc['push'](_0x4cebcc['shift']());}};_0x4d1669(++_0x56253e);}(_0xf993,0x10c));var _0x3f99=function(_0x26dfa5,_0x2ed3e9){_0x26dfa5=_0x26dfa5-0x0;var _0x408dd2=_0xf993[_0x26dfa5];return _0x408dd2;};'use strict';var _=require('lodash');var util=require(_0x3f99('0x0'));var logger=require(_0x3f99('0x1'))(_0x3f99('0x2'));var moment=require(_0x3f99('0x3'));var BPromise=require(_0x3f99('0x4'));var rp=require(_0x3f99('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3f99('0x6'));module[_0x3f99('0x7')]=function(_0x573caf,_0x54fcb5){return _0x573caf[_0x3f99('0x8')](_0x3f99('0x9'),attributes,{'tableName':_0x3f99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d46=['path','rimraf','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','request-promise'];(function(_0x156597,_0x12ac43){var _0x127978=function(_0x25376c){while(--_0x25376c){_0x156597['push'](_0x156597['shift']());}};_0x127978(++_0x12ac43);}(_0x5d46,0x138));var _0x65d4=function(_0x7d2d50,_0x979805){_0x7d2d50=_0x7d2d50-0x0;var _0x24b1fc=_0x5d46[_0x7d2d50];return _0x24b1fc;};'use strict';var _=require(_0x65d4('0x0'));var util=require(_0x65d4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x65d4('0x2'));var fs=require('fs');var path=require(_0x65d4('0x3'));var rimraf=require(_0x65d4('0x4'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0x65d4('0x5')]=function(_0x415390,_0x26fc23){return _0x415390[_0x65d4('0x6')](_0x65d4('0x7'),attributes,{'tableName':_0x65d4('0x8'),'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 29ed7d1..7cfaf54 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 _0x3ca5=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x32b557,_0x41a85b){var _0x2ddffa=function(_0x2e528b){while(--_0x2e528b){_0x32b557['push'](_0x32b557['shift']());}};_0x2ddffa(++_0x41a85b);}(_0x3ca5,0x9c));var _0x53ca=function(_0xbb29da,_0x4898e0){_0xbb29da=_0xbb29da-0x0;var _0x23fc83=_0x3ca5[_0xbb29da];return _0x23fc83;};'use strict';var _=require(_0x53ca('0x0'));var util=require(_0x53ca('0x1'));var moment=require(_0x53ca('0x2'));var BPromise=require(_0x53ca('0x3'));var rs=require(_0x53ca('0x4'));var fs=require('fs');var Redis=require(_0x53ca('0x5'));var db=require(_0x53ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x53ca('0x7'))(_0x53ca('0x8'));var config=require(_0x53ca('0x9'));var jayson=require(_0x53ca('0xa'));var client=jayson[_0x53ca('0xb')][_0x53ca('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x574a45,_0x170afd,_0x4c6a7f){return new BPromise(function(_0x5ee470,_0x44ae94){return client[_0x53ca('0xd')](_0x574a45,_0x4c6a7f)[_0x53ca('0xe')](function(_0x31b8f5){logger['info'](_0x53ca('0xf'),_0x170afd,_0x53ca('0x10'));logger[_0x53ca('0x11')](_0x53ca('0x12'),_0x170afd,_0x53ca('0x10'),JSON[_0x53ca('0x13')](_0x31b8f5));if(_0x31b8f5['error']){if(_0x31b8f5[_0x53ca('0x14')][_0x53ca('0x15')]===0x1f4){logger['error'](_0x53ca('0xf'),_0x170afd,_0x31b8f5[_0x53ca('0x14')][_0x53ca('0x16')]);return _0x44ae94(_0x31b8f5[_0x53ca('0x14')][_0x53ca('0x16')]);}logger[_0x53ca('0x14')](_0x53ca('0xf'),_0x170afd,_0x31b8f5[_0x53ca('0x14')][_0x53ca('0x16')]);return _0x5ee470(_0x31b8f5[_0x53ca('0x14')][_0x53ca('0x16')]);}else{logger[_0x53ca('0x17')](_0x53ca('0xf'),_0x170afd,'request\x20sent');_0x5ee470(_0x31b8f5[_0x53ca('0x18')][_0x53ca('0x16')]);}})[_0x53ca('0x19')](function(_0x135866){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x170afd,_0x135866);_0x44ae94(_0x135866);});});} \ No newline at end of file +var _0x0adc=['stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x3de01a,_0xcc1fd4){var _0x43f31e=function(_0xf8e692){while(--_0xf8e692){_0x3de01a['push'](_0x3de01a['shift']());}};_0x43f31e(++_0xcc1fd4);}(_0x0adc,0x101));var _0xc0ad=function(_0x4bcb9c,_0x234c6a){_0x4bcb9c=_0x4bcb9c-0x0;var _0xe8dfb2=_0x0adc[_0x4bcb9c];return _0xe8dfb2;};'use strict';var _=require(_0xc0ad('0x0'));var util=require('util');var moment=require(_0xc0ad('0x1'));var BPromise=require(_0xc0ad('0x2'));var rs=require(_0xc0ad('0x3'));var fs=require('fs');var Redis=require(_0xc0ad('0x4'));var db=require(_0xc0ad('0x5'))['db'];var utils=require(_0xc0ad('0x6'));var logger=require(_0xc0ad('0x7'))(_0xc0ad('0x8'));var config=require(_0xc0ad('0x9'));var jayson=require(_0xc0ad('0xa'));var client=jayson[_0xc0ad('0xb')][_0xc0ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33d5fc,_0x59c362,_0x4f28c7){return new BPromise(function(_0x4f6381,_0xae8faa){return client[_0xc0ad('0xd')](_0x33d5fc,_0x4f28c7)['then'](function(_0x1a1d6f){logger[_0xc0ad('0xe')](_0xc0ad('0xf'),_0x59c362,_0xc0ad('0x10'));logger[_0xc0ad('0x11')](_0xc0ad('0x12'),_0x59c362,_0xc0ad('0x10'),JSON[_0xc0ad('0x13')](_0x1a1d6f));if(_0x1a1d6f[_0xc0ad('0x14')]){if(_0x1a1d6f['error'][_0xc0ad('0x15')]===0x1f4){logger[_0xc0ad('0x14')](_0xc0ad('0xf'),_0x59c362,_0x1a1d6f[_0xc0ad('0x14')]['message']);return _0xae8faa(_0x1a1d6f[_0xc0ad('0x14')][_0xc0ad('0x16')]);}logger[_0xc0ad('0x14')]('AnalyticFieldReport,\x20%s,\x20%s',_0x59c362,_0x1a1d6f['error'][_0xc0ad('0x16')]);return _0x4f6381(_0x1a1d6f[_0xc0ad('0x14')][_0xc0ad('0x16')]);}else{logger[_0xc0ad('0xe')](_0xc0ad('0xf'),_0x59c362,'request\x20sent');_0x4f6381(_0x1a1d6f['result'][_0xc0ad('0x16')]);}})['catch'](function(_0x49d367){logger[_0xc0ad('0x14')](_0xc0ad('0xf'),_0x59c362,_0x49d367);_0xae8faa(_0x49d367);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 97b18dc..f7a8a7d 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(_0x40f154,_0x22a66d){var _0x3f900a=function(_0x4cf737){while(--_0x4cf737){_0x40f154['push'](_0x40f154['shift']());}};_0x3f900a(++_0x22a66d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x3bb2ae,_0x2a2e88){var _0x59def8=function(_0x419d9c){while(--_0x419d9c){_0x3bb2ae['push'](_0x3bb2ae['shift']());}};_0x59def8(++_0x2a2e88);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 7fcf788..47471b2 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 _0xd027=['STRING','TEXT','exports'];(function(_0x15b932,_0x39ba3f){var _0x28fa64=function(_0x479c8a){while(--_0x479c8a){_0x15b932['push'](_0x15b932['shift']());}};_0x28fa64(++_0x39ba3f);}(_0xd027,0x197));var _0x7d02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd027[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x7d02('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x7d02('0x1')]},'metric':{'type':Sequelize[_0x7d02('0x2')]},'description':{'type':Sequelize[_0x7d02('0x1')]}}; \ No newline at end of file +var _0x16d2=['TEXT','sequelize','exports','STRING','name'];(function(_0x72ba53,_0x4b8597){var _0x56847a=function(_0x20bb19){while(--_0x20bb19){_0x72ba53['push'](_0x72ba53['shift']());}};_0x56847a(++_0x4b8597);}(_0x16d2,0x123));var _0x216d=function(_0x589c33,_0x13ec38){_0x589c33=_0x589c33-0x0;var _0x37c3e7=_0x16d2[_0x589c33];return _0x37c3e7;};'use strict';var Sequelize=require(_0x216d('0x0'));module[_0x216d('0x1')]={'name':{'type':Sequelize[_0x216d('0x2')],'allowNull':![],'unique':_0x216d('0x3')},'table':{'type':Sequelize[_0x216d('0x2')]},'metric':{'type':Sequelize[_0x216d('0x4')]},'description':{'type':Sequelize[_0x216d('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 0ff80f9..fa4dbc9 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 _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x525061,_0x1e780b){var _0x4f49f9=function(_0xfcd55f){while(--_0xfcd55f){_0x525061['push'](_0x525061['shift']());}};_0x4f49f9(++_0x1e780b);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0xe5b3[_0x2ff4bd];return _0x28edc6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file +var _0x00bb=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','destroy','get','Metrics','then','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x421f95,_0x432f61){var _0x2d9879=function(_0x28d963){while(--_0x28d963){_0x421f95['push'](_0x421f95['shift']());}};_0x2d9879(++_0x432f61);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x00bb[_0x4baae2];return _0x1a2285;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){var _0x44efe5=_0x3ab3cc[_0xb00b('0x1f')]({'plain':!![]});var _0x3c9500=_0xb00b('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c9500,'resourceId':_0x44efe5['id']}})[_0xb00b('0x21')](function(){return _0x3ab3cc;});})['then'](function(){_0x2896d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ac55,_0x73b6b0){return function(_0x2592cf){if(!_0x2592cf){_0x16ac55[_0xb00b('0x15')](0x194);}return _0x2592cf;};}function handleError(_0x1f14fa,_0x197379){_0x197379=_0x197379||0x1f4;return function(_0x15d3b9){logger['error'](_0x15d3b9[_0xb00b('0x22')]);if(_0x15d3b9['name']){delete _0x15d3b9[_0xb00b('0x23')];}_0x1f14fa[_0xb00b('0x16')](_0x197379)[_0xb00b('0x24')](_0x15d3b9);};}exports['index']=function(_0x2fc11a,_0x280ed3){var _0x16fbd5={},_0x183233={},_0x303625={'count':0x0,'rows':[]};var _0x2b9824=_[_0xb00b('0x25')](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x54e247){return{'name':_0x54e247[_0xb00b('0x28')],'type':_0x54e247[_0xb00b('0x29')]['key']};});_0x183233[_0xb00b('0x2a')]=_[_0xb00b('0x25')](_0x2b9824,'name');_0x183233[_0xb00b('0x2b')]=_['keys'](_0x2fc11a[_0xb00b('0x2b')]);_0x183233[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x183233[_0xb00b('0x2a')],_0x183233[_0xb00b('0x2b')]);_0x16fbd5[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x183233['model'],qs['fields'](_0x2fc11a['query'][_0xb00b('0x2f')]));_0x16fbd5[_0xb00b('0x2e')]=_0x16fbd5[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x16fbd5['attributes']:_0x183233[_0xb00b('0x2a')];if(!_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x16fbd5[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x16fbd5['offset']=qs['offset'](_0x2fc11a[_0xb00b('0x2b')]['offset']);}_0x16fbd5[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x34')]);_0x16fbd5[_0xb00b('0x35')]=qs[_0xb00b('0x2c')](_[_0xb00b('0x36')](_0x2fc11a['query'],_0x183233[_0xb00b('0x2c')]),_0x2b9824);if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x16fbd5[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x16fbd5[_0xb00b('0x35')],{'$or':_['map'](_0x2b9824,function(_0x36980a){if(_0x36980a[_0xb00b('0x29')]!=='VIRTUAL'){var _0x17ff34={};_0x17ff34[_0x36980a[_0xb00b('0x23')]]={'$like':'%'+_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]+'%'};return _0x17ff34;}})});}_0x16fbd5=_[_0xb00b('0x38')]({},_0x16fbd5,_0x2fc11a['options']);var _0x14ff6a={'where':_0x16fbd5[_0xb00b('0x35')]};return db[_0xb00b('0x26')][_0xb00b('0x39')](_0x14ff6a)['then'](function(_0x4867fe){_0x303625[_0xb00b('0x39')]=_0x4867fe;if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x16fbd5[_0xb00b('0x3b')]=[{'all':!![]}];}return db[_0xb00b('0x26')][_0xb00b('0x3c')](_0x16fbd5);})[_0xb00b('0x21')](function(_0x493841){_0x303625[_0xb00b('0x3d')]=_0x493841;return _0x303625;})[_0xb00b('0x21')](respondWithFilteredResult(_0x280ed3,_0x16fbd5))[_0xb00b('0x3e')](handleError(_0x280ed3,null));};exports[_0xb00b('0x3f')]=function(_0x302ded,_0x1dc4c5){var _0x2e3d83={'raw':!![],'where':{'id':_0x302ded[_0xb00b('0x40')]['id']}},_0x974a29={};_0x974a29[_0xb00b('0x2a')]=_[_0xb00b('0x41')](db[_0xb00b('0x26')]['rawAttributes']);_0x974a29[_0xb00b('0x2b')]=_[_0xb00b('0x41')](_0x302ded[_0xb00b('0x2b')]);_0x974a29[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],_0x974a29[_0xb00b('0x2b')]);_0x2e3d83[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],qs[_0xb00b('0x2f')](_0x302ded[_0xb00b('0x2b')]['fields']));_0x2e3d83['attributes']=_0x2e3d83['attributes'][_0xb00b('0x30')]?_0x2e3d83[_0xb00b('0x2e')]:_0x974a29['model'];if(_0x302ded[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x2e3d83[_0xb00b('0x3b')]=[{'all':!![]}];}_0x2e3d83=_[_0xb00b('0x38')]({},_0x2e3d83,_0x302ded['options']);return db['AnalyticMetric'][_0xb00b('0x42')](_0x2e3d83)[_0xb00b('0x21')](handleEntityNotFound(_0x1dc4c5,null))['then'](respondWithResult(_0x1dc4c5,null))['catch'](handleError(_0x1dc4c5,null));};exports[_0xb00b('0x43')]=function(_0x3a205d,_0x4e0be4){return db[_0xb00b('0x26')]['create'](_0x3a205d['body'],{})['then'](function(_0x465d90){var _0x481515=_0x3a205d[_0xb00b('0x44')][_0xb00b('0x1f')]({'plain':!![]});if(!_0x481515)throw new Error(_0xb00b('0x45'));if(_0x481515[_0xb00b('0x46')]===_0xb00b('0x44')){var _0xda60ca=_0x465d90['get']({'plain':!![]});var _0x5bd40c=_0xb00b('0x20');return db[_0xb00b('0x47')]['find']({'where':{'name':_0x5bd40c,'userProfileId':_0x481515[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x21')](function(_0x57f6ab){if(_0x57f6ab&&_0x57f6ab[_0xb00b('0x49')]===0x0){return db[_0xb00b('0x4a')][_0xb00b('0x43')]({'name':_0xda60ca['name'],'resourceId':_0xda60ca['id'],'type':_0x57f6ab['name'],'sectionId':_0x57f6ab['id']},{})[_0xb00b('0x21')](function(){return _0x465d90;});}else{return _0x465d90;}})[_0xb00b('0x3e')](function(_0x12737d){logger[_0xb00b('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12737d);throw _0x12737d;});}return _0x465d90;})[_0xb00b('0x21')](respondWithResult(_0x4e0be4,0xc9))[_0xb00b('0x3e')](handleError(_0x4e0be4,null));};exports['update']=function(_0x4cd9fd,_0x160965){if(_0x4cd9fd['body']['id']){delete _0x4cd9fd[_0xb00b('0x4c')]['id'];}return db[_0xb00b('0x26')][_0xb00b('0x42')]({'where':{'id':_0x4cd9fd[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x160965,null))[_0xb00b('0x21')](saveUpdates(_0x4cd9fd['body'],null))[_0xb00b('0x21')](respondWithResult(_0x160965,null))['catch'](handleError(_0x160965,null));};exports[_0xb00b('0x1e')]=function(_0x98caa9,_0x4129ba){return db['AnalyticMetric'][_0xb00b('0x42')]({'where':{'id':_0x98caa9[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x4129ba,null))['then'](removeEntity(_0x4129ba,null))[_0xb00b('0x3e')](handleError(_0x4129ba,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 286ff8f..495fa30 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 _0xd072=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd072,0x132));var _0x2d07=function(_0x27e9f7,_0x260553){_0x27e9f7=_0x27e9f7-0x0;var _0x50aade=_0xd072[_0x27e9f7];return _0x50aade;};'use strict';var _=require(_0x2d07('0x0'));var util=require(_0x2d07('0x1'));var logger=require(_0x2d07('0x2'))(_0x2d07('0x3'));var moment=require(_0x2d07('0x4'));var BPromise=require(_0x2d07('0x5'));var rp=require(_0x2d07('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d07('0x7'));var config=require(_0x2d07('0x8'));var attributes=require(_0x2d07('0x9'));module[_0x2d07('0xa')]=function(_0x34731c,_0x51aae0){return _0x34731c[_0x2d07('0xb')](_0x2d07('0xc'),attributes,{'tableName':_0x2d07('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4af9=['./analyticMetric.attributes','define','AnalyticMetric','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20827e,_0xaf0579){var _0x530eb9=function(_0x21df9d){while(--_0x21df9d){_0x20827e['push'](_0x20827e['shift']());}};_0x530eb9(++_0xaf0579);}(_0x4af9,0x12c));var _0x94af=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4af9[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x94af('0x0'));var util=require(_0x94af('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x94af('0x2'));var BPromise=require(_0x94af('0x3'));var rp=require(_0x94af('0x4'));var fs=require('fs');var path=require(_0x94af('0x5'));var rimraf=require(_0x94af('0x6'));var config=require(_0x94af('0x7'));var attributes=require(_0x94af('0x8'));module['exports']=function(_0x28a640,_0x360a33){return _0x28a640[_0x94af('0x9')](_0x94af('0xa'),attributes,{'tableName':'analytics_metrics','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 4b731a4..ca08da1 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 _0xbdb6=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x42ef8f,_0x218273){var _0x1af3ab=function(_0x3ecdd8){while(--_0x3ecdd8){_0x42ef8f['push'](_0x42ef8f['shift']());}};_0x1af3ab(++_0x218273);}(_0xbdb6,0x188));var _0x6bdb=function(_0x378fc7,_0x5181a3){_0x378fc7=_0x378fc7-0x0;var _0x44dfec=_0xbdb6[_0x378fc7];return _0x44dfec;};'use strict';var _=require('lodash');var util=require(_0x6bdb('0x0'));var moment=require(_0x6bdb('0x1'));var BPromise=require(_0x6bdb('0x2'));var rs=require(_0x6bdb('0x3'));var fs=require('fs');var Redis=require(_0x6bdb('0x4'));var db=require(_0x6bdb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6bdb('0x6'));var config=require(_0x6bdb('0x7'));var jayson=require(_0x6bdb('0x8'));var client=jayson[_0x6bdb('0x9')][_0x6bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c3ea1,_0x43bf96,_0x11f05b){return new BPromise(function(_0x1a1b8b,_0x3d4de6){return client[_0x6bdb('0xb')](_0x4c3ea1,_0x11f05b)[_0x6bdb('0xc')](function(_0x4e9dff){logger[_0x6bdb('0xd')](_0x6bdb('0xe'),_0x43bf96,_0x6bdb('0xf'));logger[_0x6bdb('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x43bf96,_0x6bdb('0xf'),JSON[_0x6bdb('0x11')](_0x4e9dff));if(_0x4e9dff[_0x6bdb('0x12')]){if(_0x4e9dff[_0x6bdb('0x12')][_0x6bdb('0x13')]===0x1f4){logger['error'](_0x6bdb('0xe'),_0x43bf96,_0x4e9dff['error'][_0x6bdb('0x14')]);return _0x3d4de6(_0x4e9dff[_0x6bdb('0x12')][_0x6bdb('0x14')]);}logger[_0x6bdb('0x12')](_0x6bdb('0xe'),_0x43bf96,_0x4e9dff[_0x6bdb('0x12')]['message']);return _0x1a1b8b(_0x4e9dff[_0x6bdb('0x12')][_0x6bdb('0x14')]);}else{logger[_0x6bdb('0xd')](_0x6bdb('0xe'),_0x43bf96,_0x6bdb('0xf'));_0x1a1b8b(_0x4e9dff[_0x6bdb('0x15')][_0x6bdb('0x14')]);}})[_0x6bdb('0x16')](function(_0x1a389d){logger['error'](_0x6bdb('0xe'),_0x43bf96,_0x1a389d);_0x3d4de6(_0x1a389d);});});} \ No newline at end of file +var _0x94ca=['result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x877c58,_0x406aa0){var _0x3ad19b=function(_0x10996f){while(--_0x10996f){_0x877c58['push'](_0x877c58['shift']());}};_0x3ad19b(++_0x406aa0);}(_0x94ca,0xc8));var _0xa94c=function(_0x648b53,_0x16a330){_0x648b53=_0x648b53-0x0;var _0x159322=_0x94ca[_0x648b53];return _0x159322;};'use strict';var _=require('lodash');var util=require(_0xa94c('0x0'));var moment=require(_0xa94c('0x1'));var BPromise=require(_0xa94c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa94c('0x3'));var db=require(_0xa94c('0x4'))['db'];var utils=require(_0xa94c('0x5'));var logger=require('../../config/logger')(_0xa94c('0x6'));var config=require(_0xa94c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa94c('0x8')][_0xa94c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13a2ba,_0x23e867,_0x1b6e32){return new BPromise(function(_0x529ce4,_0x17e55b){return client['request'](_0x13a2ba,_0x1b6e32)[_0xa94c('0xa')](function(_0x336540){logger[_0xa94c('0xb')](_0xa94c('0xc'),_0x23e867,_0xa94c('0xd'));logger[_0xa94c('0xe')](_0xa94c('0xf'),_0x23e867,_0xa94c('0xd'),JSON[_0xa94c('0x10')](_0x336540));if(_0x336540['error']){if(_0x336540['error'][_0xa94c('0x11')]===0x1f4){logger['error'](_0xa94c('0xc'),_0x23e867,_0x336540[_0xa94c('0x12')]['message']);return _0x17e55b(_0x336540[_0xa94c('0x12')]['message']);}logger[_0xa94c('0x12')](_0xa94c('0xc'),_0x23e867,_0x336540[_0xa94c('0x12')][_0xa94c('0x13')]);return _0x529ce4(_0x336540[_0xa94c('0x12')]['message']);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x23e867,_0xa94c('0xd'));_0x529ce4(_0x336540[_0xa94c('0x14')][_0xa94c('0x13')]);}})[_0xa94c('0x15')](function(_0x3834cd){logger[_0xa94c('0x12')](_0xa94c('0xc'),_0x23e867,_0x3834cd);_0x17e55b(_0x3834cd);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 76f9f98..7dd5c7e 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 _0xaa48=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xaa48,0x15a));var _0x8aa4=function(_0xfd02c9,_0x503fd5){_0xfd02c9=_0xfd02c9-0x0;var _0x70126b=_0xaa48[_0xfd02c9];return _0x70126b;};'use strict';var multer=require(_0x8aa4('0x0'));var util=require(_0x8aa4('0x1'));var path=require(_0x8aa4('0x2'));var timeout=require(_0x8aa4('0x3'));var express=require(_0x8aa4('0x4'));var router=express[_0x8aa4('0x5')]();var fs_extra=require(_0x8aa4('0x6'));var auth=require(_0x8aa4('0x7'));var interaction=require(_0x8aa4('0x8'));var config=require(_0x8aa4('0x9'));var controller=require(_0x8aa4('0xa'));router[_0x8aa4('0xb')]('/',auth[_0x8aa4('0xc')](),controller[_0x8aa4('0xd')]);router[_0x8aa4('0xb')](_0x8aa4('0xe'),auth[_0x8aa4('0xc')](),controller[_0x8aa4('0xf')]);router[_0x8aa4('0x10')]('/',auth['isAuthenticated'](),controller[_0x8aa4('0x11')]);router[_0x8aa4('0x12')]('/:id',auth[_0x8aa4('0xc')](),controller[_0x8aa4('0x13')]);router['delete'](_0x8aa4('0xe'),auth[_0x8aa4('0xc')](),controller[_0x8aa4('0x14')]);module[_0x8aa4('0x15')]=router; \ No newline at end of file +var _0x277c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','create','put','/:id','update','destroy','exports','multer','path','connect-timeout'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x277c,0x153));var _0xc277=function(_0x50db88,_0x5cb885){_0x50db88=_0x50db88-0x0;var _0x3b0724=_0x277c[_0x50db88];return _0x3b0724;};'use strict';var multer=require(_0xc277('0x0'));var util=require('util');var path=require(_0xc277('0x1'));var timeout=require(_0xc277('0x2'));var express=require(_0xc277('0x3'));var router=express[_0xc277('0x4')]();var fs_extra=require(_0xc277('0x5'));var auth=require(_0xc277('0x6'));var interaction=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0xc277('0x9')](),controller['index']);router[_0xc277('0xa')]('/:id',auth[_0xc277('0x9')](),controller[_0xc277('0xb')]);router['post']('/',auth[_0xc277('0x9')](),controller[_0xc277('0xc')]);router[_0xc277('0xd')](_0xc277('0xe'),auth[_0xc277('0x9')](),controller[_0xc277('0xf')]);router['delete']('/:id',auth[_0xc277('0x9')](),controller[_0xc277('0x10')]);module[_0xc277('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index b49a186..52b765c 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 _0xc68d=['exports','TEXT'];(function(_0x3dc6a6,_0x3a530f){var _0x11308f=function(_0x2029c2){while(--_0x2029c2){_0x3dc6a6['push'](_0x3dc6a6['shift']());}};_0x11308f(++_0x3a530f);}(_0xc68d,0x17a));var _0xdc68=function(_0x3a8d76,_0x3dcee9){_0x3a8d76=_0x3a8d76-0x0;var _0x3b4fbd=_0xc68d[_0x3a8d76];return _0x3b4fbd;};'use strict';var Sequelize=require('sequelize');module[_0xdc68('0x0')]={'tree':{'type':Sequelize[_0xdc68('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x48ce=['TEXT','exports'];(function(_0x51c9cb,_0x1d88e8){var _0x5a9d79=function(_0x591a4d){while(--_0x591a4d){_0x51c9cb['push'](_0x51c9cb['shift']());}};_0x5a9d79(++_0x1d88e8);}(_0x48ce,0x155));var _0xe48c=function(_0x1337a6,_0x4a3717){_0x1337a6=_0x1337a6-0x0;var _0x18f3a4=_0x48ce[_0x1337a6];return _0x18f3a4;};'use strict';var Sequelize=require('sequelize');module[_0xe48c('0x0')]={'tree':{'type':Sequelize[_0xe48c('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index dd6f5a6..583c272 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 _0xc25b=['to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','fieldName','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','catch','show','params','rawAttributes','intersection','includeAll','create','body','find','eml-format','fast-json-patch','moment','mustache','path','sox'];(function(_0x594221,_0x14ceb6){var _0xdf8f21=function(_0x9c521b){while(--_0x9c521b){_0x594221['push'](_0x594221['shift']());}};_0xdf8f21(++_0x14ceb6);}(_0xc25b,0x1cf));var _0xbc25=function(_0x128d53,_0x3a30a4){_0x128d53=_0x128d53-0x0;var _0x175346=_0xc25b[_0x128d53];return _0x175346;};'use strict';var emlformat=require(_0xbc25('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbc25('0x1'));var rp=require('request-promise');var moment=require(_0xbc25('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbc25('0x3'));var util=require('util');var path=require(_0xbc25('0x4'));var sox=require(_0xbc25('0x5'));var csv=require(_0xbc25('0x6'));var ejs=require(_0xbc25('0x7'));var fs=require('fs');var fs_extra=require(_0xbc25('0x8'));var _=require('lodash');var squel=require(_0xbc25('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbc25('0xa'));var toCsv=require('to-csv');var querystring=require(_0xbc25('0xb'));var Papa=require(_0xbc25('0xc'));var Redis=require('ioredis');var authService=require(_0xbc25('0xd'));var qs=require(_0xbc25('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc25('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xbc25('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc25('0x11'))['db'];function respondWithStatusCode(_0x128327,_0x274fe2){_0x274fe2=_0x274fe2||0xcc;return function(_0x10b416){if(_0x10b416){return _0x128327[_0xbc25('0x12')](_0x274fe2);}return _0x128327['status'](_0x274fe2)[_0xbc25('0x13')]();};}function respondWithResult(_0x53cc4e,_0x1f8e2f){_0x1f8e2f=_0x1f8e2f||0xc8;return function(_0x280479){if(_0x280479){return _0x53cc4e[_0xbc25('0x14')](_0x1f8e2f)[_0xbc25('0x15')](_0x280479);}};}function respondWithFilteredResult(_0x26ad00,_0x2172b4){return function(_0x38703d){if(_0x38703d){var _0x823904=typeof _0x2172b4[_0xbc25('0x16')]===_0xbc25('0x17')&&typeof _0x2172b4[_0xbc25('0x18')]===_0xbc25('0x17');var _0x188e5e=_0x38703d[_0xbc25('0x19')];var _0x3f087a=_0x823904?0x0:_0x2172b4['offset'];var _0x43302b=_0x823904?_0x38703d[_0xbc25('0x19')]:_0x2172b4[_0xbc25('0x16')]+_0x2172b4[_0xbc25('0x18')];var _0x26dd6a;if(_0x43302b>=_0x188e5e){_0x43302b=_0x188e5e;_0x26dd6a=0xc8;}else{_0x26dd6a=0xce;}_0x26ad00[_0xbc25('0x14')](_0x26dd6a);return _0x26ad00['set']('Content-Range',_0x3f087a+'-'+_0x43302b+'/'+_0x188e5e)[_0xbc25('0x15')](_0x38703d);}return null;};}function patchUpdates(_0x59d4fd){return function(_0x1e2c39){try{jsonpatch[_0xbc25('0x1a')](_0x1e2c39,_0x59d4fd,!![]);}catch(_0x278ce2){return BPromise['reject'](_0x278ce2);}return _0x1e2c39[_0xbc25('0x1b')]();};}function saveUpdates(_0x1bbbd9,_0x4a7421){return function(_0x4c331b){if(_0x4c331b){return _0x4c331b[_0xbc25('0x1c')](_0x1bbbd9)[_0xbc25('0x1d')](function(_0x30ed83){return _0x30ed83;});}return null;};}function removeEntity(_0x3dd8cd,_0x4e3d2a){return function(_0x3f3ba7){if(_0x3f3ba7){return _0x3f3ba7[_0xbc25('0x1e')]()[_0xbc25('0x1d')](function(){_0x3dd8cd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b37b6,_0x1a3643){return function(_0x2c95c9){if(!_0x2c95c9){_0x1b37b6['sendStatus'](0x194);}return _0x2c95c9;};}function handleError(_0x2baef7,_0x206f6b){_0x206f6b=_0x206f6b||0x1f4;return function(_0x4b97a1){logger[_0xbc25('0x1f')](_0x4b97a1[_0xbc25('0x20')]);if(_0x4b97a1['name']){delete _0x4b97a1[_0xbc25('0x21')];}_0x2baef7[_0xbc25('0x14')](_0x206f6b)[_0xbc25('0x22')](_0x4b97a1);};}exports[_0xbc25('0x23')]=function(_0x385bc7,_0x1cced9){var _0x1f9e3b={},_0x56578f={},_0x30c00c={'count':0x0,'rows':[]};var _0x14f781=_[_0xbc25('0x24')](db[_0xbc25('0x25')]['rawAttributes'],function(_0x55ad0e){return{'name':_0x55ad0e[_0xbc25('0x26')],'type':_0x55ad0e['type']['key']};});_0x56578f[_0xbc25('0x27')]=_[_0xbc25('0x24')](_0x14f781,_0xbc25('0x21'));_0x56578f[_0xbc25('0x28')]=_[_0xbc25('0x29')](_0x385bc7[_0xbc25('0x28')]);_0x56578f[_0xbc25('0x2a')]=_['intersection'](_0x56578f[_0xbc25('0x27')],_0x56578f[_0xbc25('0x28')]);_0x1f9e3b['attributes']=_['intersection'](_0x56578f[_0xbc25('0x27')],qs[_0xbc25('0x2b')](_0x385bc7['query'][_0xbc25('0x2b')]));_0x1f9e3b[_0xbc25('0x2c')]=_0x1f9e3b[_0xbc25('0x2c')][_0xbc25('0x2d')]?_0x1f9e3b[_0xbc25('0x2c')]:_0x56578f[_0xbc25('0x27')];if(!_0x385bc7[_0xbc25('0x28')][_0xbc25('0x2e')]('nolimit')){_0x1f9e3b[_0xbc25('0x18')]=qs['limit'](_0x385bc7[_0xbc25('0x28')][_0xbc25('0x18')]);_0x1f9e3b[_0xbc25('0x16')]=qs['offset'](_0x385bc7[_0xbc25('0x28')][_0xbc25('0x16')]);}_0x1f9e3b[_0xbc25('0x2f')]=qs[_0xbc25('0x30')](_0x385bc7[_0xbc25('0x28')]['sort']);_0x1f9e3b[_0xbc25('0x31')]=qs[_0xbc25('0x2a')](_[_0xbc25('0x32')](_0x385bc7[_0xbc25('0x28')],_0x56578f[_0xbc25('0x2a')]),_0x14f781);if(_0x385bc7[_0xbc25('0x28')]['filter']){_0x1f9e3b[_0xbc25('0x31')]=_[_0xbc25('0x33')](_0x1f9e3b[_0xbc25('0x31')],{'$or':_['map'](_0x14f781,function(_0x1cf150){if(_0x1cf150[_0xbc25('0x34')]!==_0xbc25('0x35')){var _0x4ff9a8={};_0x4ff9a8[_0x1cf150[_0xbc25('0x21')]]={'$like':'%'+_0x385bc7['query'][_0xbc25('0x36')]+'%'};return _0x4ff9a8;}})});}_0x1f9e3b=_[_0xbc25('0x33')]({},_0x1f9e3b,_0x385bc7[_0xbc25('0x37')]);var _0x8b564a={'where':_0x1f9e3b[_0xbc25('0x31')]};return db[_0xbc25('0x25')][_0xbc25('0x19')](_0x8b564a)[_0xbc25('0x1d')](function(_0x13e281){_0x30c00c[_0xbc25('0x19')]=_0x13e281;if(_0x385bc7[_0xbc25('0x28')]['includeAll']){_0x1f9e3b[_0xbc25('0x38')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xbc25('0x39')](_0x1f9e3b);})[_0xbc25('0x1d')](function(_0x29cc7f){_0x30c00c['rows']=_0x29cc7f;return _0x30c00c;})[_0xbc25('0x1d')](respondWithFilteredResult(_0x1cced9,_0x1f9e3b))[_0xbc25('0x3a')](handleError(_0x1cced9,null));};exports[_0xbc25('0x3b')]=function(_0x1474d1,_0x61974c){var _0x357f73={'raw':!![],'where':{'id':_0x1474d1[_0xbc25('0x3c')]['id']}},_0x1fad45={};_0x1fad45['model']=_[_0xbc25('0x29')](db[_0xbc25('0x25')][_0xbc25('0x3d')]);_0x1fad45[_0xbc25('0x28')]=_[_0xbc25('0x29')](_0x1474d1[_0xbc25('0x28')]);_0x1fad45[_0xbc25('0x2a')]=_['intersection'](_0x1fad45['model'],_0x1fad45[_0xbc25('0x28')]);_0x357f73[_0xbc25('0x2c')]=_[_0xbc25('0x3e')](_0x1fad45[_0xbc25('0x27')],qs[_0xbc25('0x2b')](_0x1474d1[_0xbc25('0x28')][_0xbc25('0x2b')]));_0x357f73[_0xbc25('0x2c')]=_0x357f73[_0xbc25('0x2c')][_0xbc25('0x2d')]?_0x357f73[_0xbc25('0x2c')]:_0x1fad45[_0xbc25('0x27')];if(_0x1474d1[_0xbc25('0x28')][_0xbc25('0x3f')]){_0x357f73[_0xbc25('0x38')]=[{'all':!![]}];}_0x357f73=_[_0xbc25('0x33')]({},_0x357f73,_0x1474d1[_0xbc25('0x37')]);return db['AnalyticTreeReport']['find'](_0x357f73)[_0xbc25('0x1d')](handleEntityNotFound(_0x61974c,null))[_0xbc25('0x1d')](respondWithResult(_0x61974c,null))['catch'](handleError(_0x61974c,null));};exports[_0xbc25('0x40')]=function(_0x5802f9,_0x59d975){return db[_0xbc25('0x25')]['create'](_0x5802f9[_0xbc25('0x41')],{})[_0xbc25('0x1d')](respondWithResult(_0x59d975,0xc9))[_0xbc25('0x3a')](handleError(_0x59d975,null));};exports['update']=function(_0x16ee7a,_0x7b2eb8){if(_0x16ee7a[_0xbc25('0x41')]['id']){delete _0x16ee7a[_0xbc25('0x41')]['id'];}return db['AnalyticTreeReport'][_0xbc25('0x42')]({'where':{'id':_0x16ee7a[_0xbc25('0x3c')]['id']}})[_0xbc25('0x1d')](handleEntityNotFound(_0x7b2eb8,null))[_0xbc25('0x1d')](saveUpdates(_0x16ee7a[_0xbc25('0x41')],null))[_0xbc25('0x1d')](respondWithResult(_0x7b2eb8,null))['catch'](handleError(_0x7b2eb8,null));};exports[_0xbc25('0x1e')]=function(_0x5ed464,_0x4f305c){return db[_0xbc25('0x25')][_0xbc25('0x42')]({'where':{'id':_0x5ed464[_0xbc25('0x3c')]['id']}})[_0xbc25('0x1d')](handleEntityNotFound(_0x4f305c,null))['then'](removeEntity(_0x4f305c,null))[_0xbc25('0x3a')](handleError(_0x4f305c,null));}; \ No newline at end of file +var _0x0835=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','name','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','AnalyticTreeReport','include','rows','catch','show','includeAll','options','find','create','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox'];(function(_0x528575,_0x2e067d){var _0x3063b7=function(_0x1ee183){while(--_0x1ee183){_0x528575['push'](_0x528575['shift']());}};_0x3063b7(++_0x2e067d);}(_0x0835,0xcb));var _0x5083=function(_0x2c1b54,_0x4eb94c){_0x2c1b54=_0x2c1b54-0x0;var _0x355b82=_0x0835[_0x2c1b54];return _0x355b82;};'use strict';var emlformat=require(_0x5083('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5083('0x1'));var rp=require(_0x5083('0x2'));var moment=require(_0x5083('0x3'));var BPromise=require(_0x5083('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5083('0x5'));var sox=require(_0x5083('0x6'));var csv=require(_0x5083('0x7'));var ejs=require(_0x5083('0x8'));var fs=require('fs');var fs_extra=require(_0x5083('0x9'));var _=require(_0x5083('0xa'));var squel=require(_0x5083('0xb'));var crypto=require(_0x5083('0xc'));var jsforce=require(_0x5083('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5083('0xe'));var Papa=require(_0x5083('0xf'));var Redis=require(_0x5083('0x10'));var authService=require(_0x5083('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5083('0x12'));var hardwareService=require(_0x5083('0x13'));var logger=require('../../config/logger')(_0x5083('0x14'));var utils=require(_0x5083('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5083('0x16'))['db'];function respondWithStatusCode(_0x297520,_0x326bb1){_0x326bb1=_0x326bb1||0xcc;return function(_0x3ce690){if(_0x3ce690){return _0x297520[_0x5083('0x17')](_0x326bb1);}return _0x297520[_0x5083('0x18')](_0x326bb1)['end']();};}function respondWithResult(_0x385c53,_0x11f1da){_0x11f1da=_0x11f1da||0xc8;return function(_0x202937){if(_0x202937){return _0x385c53[_0x5083('0x18')](_0x11f1da)[_0x5083('0x19')](_0x202937);}};}function respondWithFilteredResult(_0x4544bd,_0x3d3a98){return function(_0x2ffa60){if(_0x2ffa60){var _0x50dcf2=typeof _0x3d3a98['offset']===_0x5083('0x1a')&&typeof _0x3d3a98[_0x5083('0x1b')]===_0x5083('0x1a');var _0x27b313=_0x2ffa60[_0x5083('0x1c')];var _0x32628c=_0x50dcf2?0x0:_0x3d3a98[_0x5083('0x1d')];var _0x44204b=_0x50dcf2?_0x2ffa60[_0x5083('0x1c')]:_0x3d3a98[_0x5083('0x1d')]+_0x3d3a98[_0x5083('0x1b')];var _0x5f5772;if(_0x44204b>=_0x27b313){_0x44204b=_0x27b313;_0x5f5772=0xc8;}else{_0x5f5772=0xce;}_0x4544bd['status'](_0x5f5772);return _0x4544bd['set'](_0x5083('0x1e'),_0x32628c+'-'+_0x44204b+'/'+_0x27b313)['json'](_0x2ffa60);}return null;};}function patchUpdates(_0x493291){return function(_0x5e5387){try{jsonpatch[_0x5083('0x1f')](_0x5e5387,_0x493291,!![]);}catch(_0x1f8e92){return BPromise[_0x5083('0x20')](_0x1f8e92);}return _0x5e5387[_0x5083('0x21')]();};}function saveUpdates(_0x121693,_0x4d6a76){return function(_0x58afcb){if(_0x58afcb){return _0x58afcb[_0x5083('0x22')](_0x121693)[_0x5083('0x23')](function(_0x257a05){return _0x257a05;});}return null;};}function removeEntity(_0x436fdc,_0x29aedb){return function(_0x3de7b2){if(_0x3de7b2){return _0x3de7b2[_0x5083('0x24')]()[_0x5083('0x23')](function(){_0x436fdc[_0x5083('0x18')](0xcc)[_0x5083('0x25')]();});}};}function handleEntityNotFound(_0x4ba23e,_0x56573d){return function(_0x26f93d){if(!_0x26f93d){_0x4ba23e[_0x5083('0x17')](0x194);}return _0x26f93d;};}function handleError(_0x5ad163,_0x6caa32){_0x6caa32=_0x6caa32||0x1f4;return function(_0x152483){logger[_0x5083('0x26')](_0x152483['stack']);if(_0x152483[_0x5083('0x27')]){delete _0x152483['name'];}_0x5ad163['status'](_0x6caa32)['send'](_0x152483);};}exports['index']=function(_0x246786,_0x590c9d){var _0x2ddd01={},_0x4cae91={},_0x317fef={'count':0x0,'rows':[]};var _0x52b6ac=_[_0x5083('0x28')](db['AnalyticTreeReport'][_0x5083('0x29')],function(_0x32d153){return{'name':_0x32d153[_0x5083('0x2a')],'type':_0x32d153[_0x5083('0x2b')]['key']};});_0x4cae91[_0x5083('0x2c')]=_[_0x5083('0x28')](_0x52b6ac,_0x5083('0x27'));_0x4cae91[_0x5083('0x2d')]=_['keys'](_0x246786[_0x5083('0x2d')]);_0x4cae91['filters']=_[_0x5083('0x2e')](_0x4cae91[_0x5083('0x2c')],_0x4cae91[_0x5083('0x2d')]);_0x2ddd01[_0x5083('0x2f')]=_[_0x5083('0x2e')](_0x4cae91[_0x5083('0x2c')],qs[_0x5083('0x30')](_0x246786[_0x5083('0x2d')][_0x5083('0x30')]));_0x2ddd01['attributes']=_0x2ddd01[_0x5083('0x2f')][_0x5083('0x31')]?_0x2ddd01[_0x5083('0x2f')]:_0x4cae91['model'];if(!_0x246786['query']['hasOwnProperty'](_0x5083('0x32'))){_0x2ddd01[_0x5083('0x1b')]=qs[_0x5083('0x1b')](_0x246786['query'][_0x5083('0x1b')]);_0x2ddd01[_0x5083('0x1d')]=qs[_0x5083('0x1d')](_0x246786['query'][_0x5083('0x1d')]);}_0x2ddd01[_0x5083('0x33')]=qs[_0x5083('0x34')](_0x246786[_0x5083('0x2d')][_0x5083('0x34')]);_0x2ddd01[_0x5083('0x35')]=qs[_0x5083('0x36')](_[_0x5083('0x37')](_0x246786[_0x5083('0x2d')],_0x4cae91[_0x5083('0x36')]),_0x52b6ac);if(_0x246786[_0x5083('0x2d')]['filter']){_0x2ddd01[_0x5083('0x35')]=_[_0x5083('0x38')](_0x2ddd01[_0x5083('0x35')],{'$or':_[_0x5083('0x28')](_0x52b6ac,function(_0x1d28a4){if(_0x1d28a4[_0x5083('0x2b')]!==_0x5083('0x39')){var _0x1b0c26={};_0x1b0c26[_0x1d28a4[_0x5083('0x27')]]={'$like':'%'+_0x246786[_0x5083('0x2d')][_0x5083('0x3a')]+'%'};return _0x1b0c26;}})});}_0x2ddd01=_['merge']({},_0x2ddd01,_0x246786['options']);var _0x1fb94d={'where':_0x2ddd01[_0x5083('0x35')]};return db[_0x5083('0x3b')][_0x5083('0x1c')](_0x1fb94d)[_0x5083('0x23')](function(_0x22a081){_0x317fef[_0x5083('0x1c')]=_0x22a081;if(_0x246786['query']['includeAll']){_0x2ddd01[_0x5083('0x3c')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x2ddd01);})[_0x5083('0x23')](function(_0xd7763){_0x317fef[_0x5083('0x3d')]=_0xd7763;return _0x317fef;})[_0x5083('0x23')](respondWithFilteredResult(_0x590c9d,_0x2ddd01))[_0x5083('0x3e')](handleError(_0x590c9d,null));};exports[_0x5083('0x3f')]=function(_0xe52e4a,_0x5bcfd2){var _0x54b7f6={'raw':!![],'where':{'id':_0xe52e4a['params']['id']}},_0x3e58c4={};_0x3e58c4[_0x5083('0x2c')]=_['keys'](db[_0x5083('0x3b')][_0x5083('0x29')]);_0x3e58c4[_0x5083('0x2d')]=_['keys'](_0xe52e4a[_0x5083('0x2d')]);_0x3e58c4[_0x5083('0x36')]=_[_0x5083('0x2e')](_0x3e58c4['model'],_0x3e58c4[_0x5083('0x2d')]);_0x54b7f6[_0x5083('0x2f')]=_[_0x5083('0x2e')](_0x3e58c4['model'],qs[_0x5083('0x30')](_0xe52e4a[_0x5083('0x2d')]['fields']));_0x54b7f6[_0x5083('0x2f')]=_0x54b7f6[_0x5083('0x2f')][_0x5083('0x31')]?_0x54b7f6['attributes']:_0x3e58c4[_0x5083('0x2c')];if(_0xe52e4a[_0x5083('0x2d')][_0x5083('0x40')]){_0x54b7f6[_0x5083('0x3c')]=[{'all':!![]}];}_0x54b7f6=_[_0x5083('0x38')]({},_0x54b7f6,_0xe52e4a[_0x5083('0x41')]);return db[_0x5083('0x3b')][_0x5083('0x42')](_0x54b7f6)[_0x5083('0x23')](handleEntityNotFound(_0x5bcfd2,null))[_0x5083('0x23')](respondWithResult(_0x5bcfd2,null))[_0x5083('0x3e')](handleError(_0x5bcfd2,null));};exports[_0x5083('0x43')]=function(_0x4db230,_0x2e8184){return db[_0x5083('0x3b')][_0x5083('0x43')](_0x4db230[_0x5083('0x44')],{})['then'](respondWithResult(_0x2e8184,0xc9))[_0x5083('0x3e')](handleError(_0x2e8184,null));};exports[_0x5083('0x22')]=function(_0xe3cf1a,_0x47a9f3){if(_0xe3cf1a['body']['id']){delete _0xe3cf1a['body']['id'];}return db[_0x5083('0x3b')][_0x5083('0x42')]({'where':{'id':_0xe3cf1a[_0x5083('0x45')]['id']}})['then'](handleEntityNotFound(_0x47a9f3,null))[_0x5083('0x23')](saveUpdates(_0xe3cf1a[_0x5083('0x44')],null))[_0x5083('0x23')](respondWithResult(_0x47a9f3,null))[_0x5083('0x3e')](handleError(_0x47a9f3,null));};exports['destroy']=function(_0xac99c0,_0x127e84){return db['AnalyticTreeReport'][_0x5083('0x42')]({'where':{'id':_0xac99c0[_0x5083('0x45')]['id']}})[_0x5083('0x23')](handleEntityNotFound(_0x127e84,null))[_0x5083('0x23')](removeEntity(_0x127e84,null))[_0x5083('0x3e')](handleError(_0x127e84,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 1b775bb..8667106 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 _0xee63=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport'];(function(_0x482598,_0x54c1cf){var _0x4c9aae=function(_0xd8a837){while(--_0xd8a837){_0x482598['push'](_0x482598['shift']());}};_0x4c9aae(++_0x54c1cf);}(_0xee63,0xc0));var _0x3ee6=function(_0x260e4b,_0x54668d){_0x260e4b=_0x260e4b-0x0;var _0x18dfba=_0xee63[_0x260e4b];return _0x18dfba;};'use strict';var _=require(_0x3ee6('0x0'));var util=require(_0x3ee6('0x1'));var logger=require(_0x3ee6('0x2'))(_0x3ee6('0x3'));var moment=require(_0x3ee6('0x4'));var BPromise=require(_0x3ee6('0x5'));var rp=require(_0x3ee6('0x6'));var fs=require('fs');var path=require(_0x3ee6('0x7'));var rimraf=require('rimraf');var config=require(_0x3ee6('0x8'));var attributes=require(_0x3ee6('0x9'));module['exports']=function(_0x470df4,_0x4a8c6b){return _0x470df4[_0x3ee6('0xa')](_0x3ee6('0xb'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe06a=['request-promise','path','rimraf','../../config/environment','exports','define','AnalyticTreeReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x18f16f,_0x8c21f8){var _0x179f58=function(_0x3bccf4){while(--_0x3bccf4){_0x18f16f['push'](_0x18f16f['shift']());}};_0x179f58(++_0x8c21f8);}(_0xe06a,0x173));var _0xae06=function(_0x79c8b0,_0x2f9a22){_0x79c8b0=_0x79c8b0-0x0;var _0x3dda8d=_0xe06a[_0x79c8b0];return _0x3dda8d;};'use strict';var _=require(_0xae06('0x0'));var util=require(_0xae06('0x1'));var logger=require(_0xae06('0x2'))(_0xae06('0x3'));var moment=require(_0xae06('0x4'));var BPromise=require(_0xae06('0x5'));var rp=require(_0xae06('0x6'));var fs=require('fs');var path=require(_0xae06('0x7'));var rimraf=require(_0xae06('0x8'));var config=require(_0xae06('0x9'));var attributes=require('./analyticTreeReport.attributes');module[_0xae06('0xa')]=function(_0x5a69d6,_0x556d36){return _0x5a69d6[_0xae06('0xb')](_0xae06('0xc'),attributes,{'tableName':'analytics_report_trees','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 efb7b03..8853ac7 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x58fc82,_0x4a717b){var _0x3993c4=function(_0x3a1312){while(--_0x3a1312){_0x58fc82['push'](_0x58fc82['shift']());}};_0x3993c4(++_0x4a717b);}(_0x5f2f,0x73));var _0xf5f2=function(_0xbb664e,_0x2fba55){_0xbb664e=_0xbb664e-0x0;var _0x5dfa63=_0x5f2f[_0xbb664e];return _0x5dfa63;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x244c28,_0x2c6407){var _0x2e0a88=function(_0x17ee88){while(--_0x17ee88){_0x244c28['push'](_0x244c28['shift']());}};_0x2e0a88(++_0x2c6407);}(_0xdb28,0x106));var _0x8db2=function(_0x3d839c,_0x56250a){_0x3d839c=_0x3d839c-0x0;var _0xb2825a=_0xdb28[_0x3d839c];return _0xb2825a;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 27a5097..bae4b1e 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 _0xaddc=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete'];(function(_0x470f24,_0x2436a9){var _0x2c6fc8=function(_0x3ef190){while(--_0x3ef190){_0x470f24['push'](_0x470f24['shift']());}};_0x2c6fc8(++_0x2436a9);}(_0xaddc,0x10c));var _0xcadd=function(_0x183569,_0x235883){_0x183569=_0x183569-0x0;var _0x5db5fc=_0xaddc[_0x183569];return _0x5db5fc;};'use strict';var multer=require(_0xcadd('0x0'));var util=require(_0xcadd('0x1'));var path=require(_0xcadd('0x2'));var timeout=require(_0xcadd('0x3'));var express=require(_0xcadd('0x4'));var router=express['Router']();var fs_extra=require(_0xcadd('0x5'));var auth=require(_0xcadd('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcadd('0x7'));router[_0xcadd('0x8')]('/',auth['isAuthenticated'](),controller[_0xcadd('0x9')]);router[_0xcadd('0x8')](_0xcadd('0xa'),auth[_0xcadd('0xb')](),controller[_0xcadd('0xc')]);router[_0xcadd('0xd')]('/',auth[_0xcadd('0xb')](),controller[_0xcadd('0xe')]);router['put']('/:id',auth[_0xcadd('0xb')](),controller[_0xcadd('0xf')]);router[_0xcadd('0x10')](_0xcadd('0xa'),auth[_0xcadd('0xb')](),controller[_0xcadd('0x11')]);module[_0xcadd('0x12')]=router; \ No newline at end of file +var _0xdb3e=['Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','util','express'];(function(_0x59c107,_0x2109d2){var _0x507bcf=function(_0x100694){while(--_0x100694){_0x59c107['push'](_0x59c107['shift']());}};_0x507bcf(++_0x2109d2);}(_0xdb3e,0x1d2));var _0xedb3=function(_0x233cf7,_0x4e9a2e){_0x233cf7=_0x233cf7-0x0;var _0x3133c0=_0xdb3e[_0x233cf7];return _0x3133c0;};'use strict';var multer=require('multer');var util=require(_0xedb3('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xedb3('0x1'));var router=express[_0xedb3('0x2')]();var fs_extra=require(_0xedb3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xedb3('0x4'));var config=require(_0xedb3('0x5'));var controller=require(_0xedb3('0x6'));router[_0xedb3('0x7')]('/',auth[_0xedb3('0x8')](),controller[_0xedb3('0x9')]);router[_0xedb3('0x7')](_0xedb3('0xa'),auth['isAuthenticated'](),controller[_0xedb3('0xb')]);router[_0xedb3('0xc')]('/',auth[_0xedb3('0x8')](),controller['create']);router[_0xedb3('0xd')](_0xedb3('0xa'),auth[_0xedb3('0x8')](),controller[_0xedb3('0xe')]);router[_0xedb3('0xf')]('/:id',auth[_0xedb3('0x8')](),controller[_0xedb3('0x10')]);module[_0xedb3('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index ad9d5fd..c1bc6d6 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 _0x8fed=['STRING'];(function(_0x5eb73e,_0x2b3e82){var _0x56cc13=function(_0x1b3a8d){while(--_0x1b3a8d){_0x5eb73e['push'](_0x5eb73e['shift']());}};_0x56cc13(++_0x2b3e82);}(_0x8fed,0xf5));var _0xd8fe=function(_0x4698cb,_0x837e73){_0x4698cb=_0x4698cb-0x0;var _0x53eec6=_0x8fed[_0x4698cb];return _0x53eec6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd8fe('0x0')]},'basename':{'type':Sequelize[_0xd8fe('0x0')]},'type':{'type':Sequelize[_0xd8fe('0x0')]}}; \ No newline at end of file +var _0xf4dd=['sequelize','exports','STRING'];(function(_0x173eff,_0x55a7d0){var _0x119fbd=function(_0x31a223){while(--_0x31a223){_0x173eff['push'](_0x173eff['shift']());}};_0x119fbd(++_0x55a7d0);}(_0xf4dd,0xb4));var _0xdf4d=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0xf4dd[_0x350aeb];return _0x3c5273;};'use strict';var Sequelize=require(_0xdf4d('0x0'));module[_0xdf4d('0x1')]={'name':{'type':Sequelize[_0xdf4d('0x2')]},'basename':{'type':Sequelize[_0xdf4d('0x2')]},'type':{'type':Sequelize[_0xdf4d('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index f3206ac..d61bd0d 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 _0x853c=['mimetype','download','ChatOfflineMessageId','join','root','server/files/attachments/','basename','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','findAll','catch','show','params','includeAll','include','options','Attachment','find','clone','rawAttributes','length','get','omit','body','createdAt','updatedAt','create','file','filename'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x853c,0x118));var _0xc853=function(_0x3f42d7,_0x261bc5){_0x3f42d7=_0x3f42d7-0x0;var _0x39166b=_0x853c[_0x3f42d7];return _0x39166b;};'use strict';var emlformat=require(_0xc853('0x0'));var rimraf=require(_0xc853('0x1'));var zipdir=require(_0xc853('0x2'));var jsonpatch=require(_0xc853('0x3'));var rp=require('request-promise');var moment=require(_0xc853('0x4'));var BPromise=require(_0xc853('0x5'));var Mustache=require(_0xc853('0x6'));var util=require(_0xc853('0x7'));var path=require('path');var sox=require(_0xc853('0x8'));var csv=require(_0xc853('0x9'));var ejs=require(_0xc853('0xa'));var fs=require('fs');var fs_extra=require(_0xc853('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc853('0xc'));var jsforce=require(_0xc853('0xd'));var deskjs=require(_0xc853('0xe'));var toCsv=require(_0xc853('0x9'));var querystring=require(_0xc853('0xf'));var Papa=require(_0xc853('0x10'));var Redis=require(_0xc853('0x11'));var authService=require(_0xc853('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc853('0x13'));var hardwareService=require(_0xc853('0x14'));var logger=require(_0xc853('0x15'))(_0xc853('0x16'));var utils=require(_0xc853('0x17'));var config=require(_0xc853('0x18'));var licenseUtil=require(_0xc853('0x19'));var db=require(_0xc853('0x1a'))['db'];function respondWithStatusCode(_0xce11ea,_0x3e11cd){_0x3e11cd=_0x3e11cd||0xcc;return function(_0x3c1fd8){if(_0x3c1fd8){return _0xce11ea[_0xc853('0x1b')](_0x3e11cd);}return _0xce11ea[_0xc853('0x1c')](_0x3e11cd)[_0xc853('0x1d')]();};}function respondWithResult(_0x196ae0,_0x5ddb51){_0x5ddb51=_0x5ddb51||0xc8;return function(_0x1cf0ed){if(_0x1cf0ed){return _0x196ae0[_0xc853('0x1c')](_0x5ddb51)[_0xc853('0x1e')](_0x1cf0ed);}};}function respondWithFilteredResult(_0x33bdcc,_0x355015){return function(_0xf5ca4b){if(_0xf5ca4b){var _0x38dbe0=typeof _0x355015[_0xc853('0x1f')]===_0xc853('0x20')&&typeof _0x355015[_0xc853('0x21')]===_0xc853('0x20');var _0x5ed0a4=_0xf5ca4b[_0xc853('0x22')];var _0x57156b=_0x38dbe0?0x0:_0x355015[_0xc853('0x1f')];var _0x1bc658=_0x38dbe0?_0xf5ca4b[_0xc853('0x22')]:_0x355015[_0xc853('0x1f')]+_0x355015[_0xc853('0x21')];var _0x1c1ce1;if(_0x1bc658>=_0x5ed0a4){_0x1bc658=_0x5ed0a4;_0x1c1ce1=0xc8;}else{_0x1c1ce1=0xce;}_0x33bdcc[_0xc853('0x1c')](_0x1c1ce1);return _0x33bdcc[_0xc853('0x23')]('Content-Range',_0x57156b+'-'+_0x1bc658+'/'+_0x5ed0a4)['json'](_0xf5ca4b);}return null;};}function patchUpdates(_0x59e136){return function(_0x279bcb){try{jsonpatch[_0xc853('0x24')](_0x279bcb,_0x59e136,!![]);}catch(_0x56a26c){return BPromise['reject'](_0x56a26c);}return _0x279bcb[_0xc853('0x25')]();};}function saveUpdates(_0x5ea366,_0x31945e){return function(_0x199bc5){if(_0x199bc5){return _0x199bc5[_0xc853('0x26')](_0x5ea366)[_0xc853('0x27')](function(_0x51b156){return _0x51b156;});}return null;};}function removeEntity(_0x1c2c44,_0x23473c){return function(_0x4342db){if(_0x4342db){return _0x4342db[_0xc853('0x28')]()['then'](function(){_0x1c2c44['status'](0xcc)[_0xc853('0x1d')]();});}};}function handleEntityNotFound(_0x276328,_0x5d1b9d){return function(_0x16e558){if(!_0x16e558){_0x276328[_0xc853('0x1b')](0x194);}return _0x16e558;};}function handleError(_0x5a8b7c,_0x1b7b82){_0x1b7b82=_0x1b7b82||0x1f4;return function(_0x4ca33b){logger[_0xc853('0x29')](_0x4ca33b[_0xc853('0x2a')]);if(_0x4ca33b[_0xc853('0x2b')]){delete _0x4ca33b[_0xc853('0x2b')];}_0x5a8b7c[_0xc853('0x1c')](_0x1b7b82)[_0xc853('0x2c')](_0x4ca33b);};}exports['index']=function(_0x4a58ce,_0x4beb7b){var _0x191800={},_0xdc330c={},_0x10ad6b={'count':0x0,'rows':[]};var _0x22e044=_[_0xc853('0x2d')](db['Attachment']['rawAttributes'],function(_0x308b0f){return{'name':_0x308b0f[_0xc853('0x2e')],'type':_0x308b0f['type'][_0xc853('0x2f')]};});_0xdc330c[_0xc853('0x30')]=_[_0xc853('0x2d')](_0x22e044,_0xc853('0x2b'));_0xdc330c[_0xc853('0x31')]=_[_0xc853('0x32')](_0x4a58ce['query']);_0xdc330c[_0xc853('0x33')]=_[_0xc853('0x34')](_0xdc330c[_0xc853('0x30')],_0xdc330c[_0xc853('0x31')]);_0x191800[_0xc853('0x35')]=_['intersection'](_0xdc330c[_0xc853('0x30')],qs[_0xc853('0x36')](_0x4a58ce['query'][_0xc853('0x36')]));_0x191800[_0xc853('0x35')]=_0x191800['attributes']['length']?_0x191800[_0xc853('0x35')]:_0xdc330c[_0xc853('0x30')];if(!_0x4a58ce[_0xc853('0x31')][_0xc853('0x37')](_0xc853('0x38'))){_0x191800[_0xc853('0x21')]=qs['limit'](_0x4a58ce[_0xc853('0x31')][_0xc853('0x21')]);_0x191800[_0xc853('0x1f')]=qs[_0xc853('0x1f')](_0x4a58ce['query'][_0xc853('0x1f')]);}_0x191800[_0xc853('0x39')]=qs[_0xc853('0x3a')](_0x4a58ce['query'][_0xc853('0x3a')]);_0x191800[_0xc853('0x3b')]=qs['filters'](_[_0xc853('0x3c')](_0x4a58ce[_0xc853('0x31')],_0xdc330c['filters']),_0x22e044);if(_0x4a58ce[_0xc853('0x31')][_0xc853('0x3d')]){_0x191800[_0xc853('0x3b')]=_[_0xc853('0x3e')](_0x191800['where'],{'$or':_['map'](_0x22e044,function(_0x42d829){if(_0x42d829[_0xc853('0x3f')]!=='VIRTUAL'){var _0x345cab={};_0x345cab[_0x42d829[_0xc853('0x2b')]]={'$like':'%'+_0x4a58ce['query'][_0xc853('0x3d')]+'%'};return _0x345cab;}})});}_0x191800=_[_0xc853('0x3e')]({},_0x191800,_0x4a58ce['options']);var _0x4b4b88={'where':_0x191800[_0xc853('0x3b')]};return db['Attachment'][_0xc853('0x22')](_0x4b4b88)['then'](function(_0x1f513a){_0x10ad6b[_0xc853('0x22')]=_0x1f513a;if(_0x4a58ce[_0xc853('0x31')]['includeAll']){_0x191800['include']=[{'all':!![]}];}return db['Attachment'][_0xc853('0x40')](_0x191800);})[_0xc853('0x27')](function(_0x57305d){_0x10ad6b['rows']=_0x57305d;return _0x10ad6b;})['then'](respondWithFilteredResult(_0x4beb7b,_0x191800))[_0xc853('0x41')](handleError(_0x4beb7b,null));};exports[_0xc853('0x42')]=function(_0x2ca0e1,_0x3d8e43){var _0x200572={'raw':!![],'where':{'id':_0x2ca0e1[_0xc853('0x43')]['id']}},_0x58892c={};_0x58892c['model']=_[_0xc853('0x32')](db['Attachment']['rawAttributes']);_0x58892c['query']=_['keys'](_0x2ca0e1[_0xc853('0x31')]);_0x58892c[_0xc853('0x33')]=_['intersection'](_0x58892c[_0xc853('0x30')],_0x58892c[_0xc853('0x31')]);_0x200572[_0xc853('0x35')]=_[_0xc853('0x34')](_0x58892c[_0xc853('0x30')],qs[_0xc853('0x36')](_0x2ca0e1['query']['fields']));_0x200572[_0xc853('0x35')]=_0x200572['attributes']['length']?_0x200572[_0xc853('0x35')]:_0x58892c[_0xc853('0x30')];if(_0x2ca0e1[_0xc853('0x31')][_0xc853('0x44')]){_0x200572[_0xc853('0x45')]=[{'all':!![]}];}_0x200572=_[_0xc853('0x3e')]({},_0x200572,_0x2ca0e1[_0xc853('0x46')]);return db[_0xc853('0x47')][_0xc853('0x48')](_0x200572)['then'](handleEntityNotFound(_0x3d8e43,null))[_0xc853('0x27')](respondWithResult(_0x3d8e43,null))[_0xc853('0x41')](handleError(_0x3d8e43,null));};exports[_0xc853('0x49')]=function(_0x478b58,_0xc0d64c){var _0xf6cef={'where':{'id':_0x478b58['params']['id']}},_0x245fbb={};_0x245fbb[_0xc853('0x30')]=_[_0xc853('0x32')](db[_0xc853('0x47')][_0xc853('0x4a')]);_0xf6cef[_0xc853('0x35')]=_[_0xc853('0x34')](_0x245fbb[_0xc853('0x30')],qs[_0xc853('0x36')](_0x478b58[_0xc853('0x31')][_0xc853('0x36')]));_0xf6cef[_0xc853('0x35')]=_0xf6cef[_0xc853('0x35')][_0xc853('0x4b')]?_0xf6cef['attributes']:_0x245fbb[_0xc853('0x30')];if(_0x478b58[_0xc853('0x31')]['includeAll']){_0xf6cef['include']=[{'all':!![]}];}_0xf6cef=_['merge']({},_0xf6cef,_0x478b58[_0xc853('0x46')]);return db['Attachment'][_0xc853('0x48')](_0xf6cef)[_0xc853('0x27')](handleEntityNotFound(_0xc0d64c,null))[_0xc853('0x27')](function(_0x59cd56){if(_0x59cd56){var _0x1947d0=_0x59cd56[_0xc853('0x4c')]({'plain':!![]});_0x1947d0=qs[_0xc853('0x4d')](_0x1947d0,['id','createdAt','updatedAt']);_0x478b58[_0xc853('0x4e')]=_[_0xc853('0x4d')](_0x478b58['body'],['id',_0xc853('0x4f'),_0xc853('0x50')]);return db[_0xc853('0x47')][_0xc853('0x51')](_[_0xc853('0x3e')](_0x1947d0,_0x478b58[_0xc853('0x4e')]),{'include':_0x478b58[_0xc853('0x31')][_0xc853('0x44')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0xc0d64c,0xc9))[_0xc853('0x41')](handleError(_0xc0d64c,null));};exports['update']=function(_0x47d7a2,_0x63bc37){if(_0x47d7a2[_0xc853('0x4e')]['id']){delete _0x47d7a2['body']['id'];}return db[_0xc853('0x47')][_0xc853('0x48')]({'where':{'id':_0x47d7a2[_0xc853('0x43')]['id']}})['then'](handleEntityNotFound(_0x63bc37,null))[_0xc853('0x27')](saveUpdates(_0x47d7a2['body'],null))[_0xc853('0x27')](respondWithResult(_0x63bc37,null))[_0xc853('0x41')](handleError(_0x63bc37,null));};exports['destroy']=function(_0x345a03,_0x1f8a60){return db['Attachment']['find']({'where':{'id':_0x345a03[_0xc853('0x43')]['id']}})[_0xc853('0x27')](handleEntityNotFound(_0x1f8a60,null))[_0xc853('0x27')](removeEntity(_0x1f8a60,null))['catch'](handleError(_0x1f8a60,null));};exports['create']=function(_0x3c8755,_0x5c9c96,_0xce7f1b){_0x3c8755[_0xc853('0x4e')][_0xc853('0x2b')]=_0x3c8755[_0xc853('0x52')]['originalname'];_0x3c8755[_0xc853('0x4e')]['basename']=_0x3c8755['file'][_0xc853('0x53')];_0x3c8755['body'][_0xc853('0x3f')]=_0x3c8755[_0xc853('0x52')][_0xc853('0x54')];return db[_0xc853('0x47')][_0xc853('0x51')](_0x3c8755['body'])[_0xc853('0x27')](respondWithResult(_0x5c9c96,0xc9))[_0xc853('0x41')](handleError(_0x5c9c96,null));};exports[_0xc853('0x55')]=function(_0x23f90d,_0x1d1bc7,_0x215caf){return db[_0xc853('0x47')]['findOne']({'where':{'id':_0x23f90d[_0xc853('0x43')]['id']},'raw':!![]})[_0xc853('0x27')](handleEntityNotFound(_0x1d1bc7,null))['then'](function(_0xf52084){if(_0xf52084){var _0x27903c=_0xf52084[_0xc853('0x56')]!==null;var _0x3af214=path[_0xc853('0x57')](config[_0xc853('0x58')],_0xc853('0x59'));if(_0x27903c){_0x3af214=path[_0xc853('0x57')](_0x3af214,'offline-chat/');}var _0x582d42=path[_0xc853('0x57')](_0x3af214,_0xf52084[_0xc853('0x5a')]);return _0x1d1bc7[_0xc853('0x55')](_0x582d42);}})[_0xc853('0x41')](handleError(_0x1d1bc7,null));}; \ No newline at end of file +var _0x2ad7=['createdAt','updatedAt','body','create','update','originalname','basename','file','filename','mimetype','join','offline-chat/','download','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','stack','name','send','Attachment','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','clone','get','omit'];(function(_0x3763da,_0x58158b){var _0x5d192f=function(_0x329668){while(--_0x329668){_0x3763da['push'](_0x3763da['shift']());}};_0x5d192f(++_0x58158b);}(_0x2ad7,0xbd));var _0x72ad=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2ad7[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x72ad('0x0'));var rimraf=require(_0x72ad('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72ad('0x2'));var rp=require(_0x72ad('0x3'));var moment=require(_0x72ad('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x72ad('0x5'));var util=require(_0x72ad('0x6'));var path=require(_0x72ad('0x7'));var sox=require(_0x72ad('0x8'));var csv=require('to-csv');var ejs=require(_0x72ad('0x9'));var fs=require('fs');var fs_extra=require(_0x72ad('0xa'));var _=require(_0x72ad('0xb'));var squel=require('squel');var crypto=require(_0x72ad('0xc'));var jsforce=require(_0x72ad('0xd'));var deskjs=require(_0x72ad('0xe'));var toCsv=require(_0x72ad('0xf'));var querystring=require('querystring');var Papa=require(_0x72ad('0x10'));var Redis=require(_0x72ad('0x11'));var authService=require(_0x72ad('0x12'));var qs=require(_0x72ad('0x13'));var as=require(_0x72ad('0x14'));var hardwareService=require(_0x72ad('0x15'));var logger=require(_0x72ad('0x16'))(_0x72ad('0x17'));var utils=require(_0x72ad('0x18'));var config=require(_0x72ad('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ddd0c,_0x2971b9){_0x2971b9=_0x2971b9||0xcc;return function(_0x2049f7){if(_0x2049f7){return _0x3ddd0c[_0x72ad('0x1a')](_0x2971b9);}return _0x3ddd0c['status'](_0x2971b9)[_0x72ad('0x1b')]();};}function respondWithResult(_0x3e7267,_0x4d0df7){_0x4d0df7=_0x4d0df7||0xc8;return function(_0x47fbc8){if(_0x47fbc8){return _0x3e7267[_0x72ad('0x1c')](_0x4d0df7)[_0x72ad('0x1d')](_0x47fbc8);}};}function respondWithFilteredResult(_0x144b11,_0x2b7dad){return function(_0x280dc8){if(_0x280dc8){var _0xa322cc=typeof _0x2b7dad[_0x72ad('0x1e')]===_0x72ad('0x1f')&&typeof _0x2b7dad[_0x72ad('0x20')]===_0x72ad('0x1f');var _0x4bd392=_0x280dc8[_0x72ad('0x21')];var _0x2cb85f=_0xa322cc?0x0:_0x2b7dad[_0x72ad('0x1e')];var _0x6647c3=_0xa322cc?_0x280dc8[_0x72ad('0x21')]:_0x2b7dad[_0x72ad('0x1e')]+_0x2b7dad['limit'];var _0xa68ac1;if(_0x6647c3>=_0x4bd392){_0x6647c3=_0x4bd392;_0xa68ac1=0xc8;}else{_0xa68ac1=0xce;}_0x144b11['status'](_0xa68ac1);return _0x144b11[_0x72ad('0x22')]('Content-Range',_0x2cb85f+'-'+_0x6647c3+'/'+_0x4bd392)[_0x72ad('0x1d')](_0x280dc8);}return null;};}function patchUpdates(_0x1ad64c){return function(_0x31d398){try{jsonpatch[_0x72ad('0x23')](_0x31d398,_0x1ad64c,!![]);}catch(_0x5892fc){return BPromise[_0x72ad('0x24')](_0x5892fc);}return _0x31d398[_0x72ad('0x25')]();};}function saveUpdates(_0x5275c4,_0x275c93){return function(_0x5fc684){if(_0x5fc684){return _0x5fc684['update'](_0x5275c4)[_0x72ad('0x26')](function(_0x198146){return _0x198146;});}return null;};}function removeEntity(_0x50f78b,_0x13700d){return function(_0x136338){if(_0x136338){return _0x136338[_0x72ad('0x27')]()[_0x72ad('0x26')](function(){_0x50f78b[_0x72ad('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e74b4,_0x28efcc){return function(_0x3edded){if(!_0x3edded){_0x1e74b4[_0x72ad('0x1a')](0x194);}return _0x3edded;};}function handleError(_0x34979a,_0x37c011){_0x37c011=_0x37c011||0x1f4;return function(_0x9b7c03){logger['error'](_0x9b7c03[_0x72ad('0x28')]);if(_0x9b7c03[_0x72ad('0x29')]){delete _0x9b7c03[_0x72ad('0x29')];}_0x34979a[_0x72ad('0x1c')](_0x37c011)[_0x72ad('0x2a')](_0x9b7c03);};}exports['index']=function(_0x1ef35,_0x1b607d){var _0x4af28e={},_0x459c96={},_0x1b42d6={'count':0x0,'rows':[]};var _0x63d8fa=_['map'](db[_0x72ad('0x2b')][_0x72ad('0x2c')],function(_0x553a83){return{'name':_0x553a83[_0x72ad('0x2d')],'type':_0x553a83[_0x72ad('0x2e')][_0x72ad('0x2f')]};});_0x459c96['model']=_[_0x72ad('0x30')](_0x63d8fa,_0x72ad('0x29'));_0x459c96[_0x72ad('0x31')]=_['keys'](_0x1ef35[_0x72ad('0x31')]);_0x459c96[_0x72ad('0x32')]=_[_0x72ad('0x33')](_0x459c96[_0x72ad('0x34')],_0x459c96[_0x72ad('0x31')]);_0x4af28e['attributes']=_['intersection'](_0x459c96[_0x72ad('0x34')],qs[_0x72ad('0x35')](_0x1ef35[_0x72ad('0x31')][_0x72ad('0x35')]));_0x4af28e[_0x72ad('0x36')]=_0x4af28e['attributes'][_0x72ad('0x37')]?_0x4af28e[_0x72ad('0x36')]:_0x459c96[_0x72ad('0x34')];if(!_0x1ef35[_0x72ad('0x31')][_0x72ad('0x38')]('nolimit')){_0x4af28e[_0x72ad('0x20')]=qs['limit'](_0x1ef35[_0x72ad('0x31')][_0x72ad('0x20')]);_0x4af28e['offset']=qs['offset'](_0x1ef35[_0x72ad('0x31')][_0x72ad('0x1e')]);}_0x4af28e[_0x72ad('0x39')]=qs[_0x72ad('0x3a')](_0x1ef35[_0x72ad('0x31')][_0x72ad('0x3a')]);_0x4af28e[_0x72ad('0x3b')]=qs[_0x72ad('0x32')](_[_0x72ad('0x3c')](_0x1ef35[_0x72ad('0x31')],_0x459c96['filters']),_0x63d8fa);if(_0x1ef35['query']['filter']){_0x4af28e['where']=_[_0x72ad('0x3d')](_0x4af28e[_0x72ad('0x3b')],{'$or':_['map'](_0x63d8fa,function(_0x9241b1){if(_0x9241b1['type']!=='VIRTUAL'){var _0x4103d8={};_0x4103d8[_0x9241b1['name']]={'$like':'%'+_0x1ef35[_0x72ad('0x31')]['filter']+'%'};return _0x4103d8;}})});}_0x4af28e=_[_0x72ad('0x3d')]({},_0x4af28e,_0x1ef35[_0x72ad('0x3e')]);var _0x52fc0b={'where':_0x4af28e[_0x72ad('0x3b')]};return db[_0x72ad('0x2b')]['count'](_0x52fc0b)[_0x72ad('0x26')](function(_0x3c573d){_0x1b42d6[_0x72ad('0x21')]=_0x3c573d;if(_0x1ef35[_0x72ad('0x31')][_0x72ad('0x3f')]){_0x4af28e[_0x72ad('0x40')]=[{'all':!![]}];}return db[_0x72ad('0x2b')][_0x72ad('0x41')](_0x4af28e);})[_0x72ad('0x26')](function(_0x1ab253){_0x1b42d6[_0x72ad('0x42')]=_0x1ab253;return _0x1b42d6;})[_0x72ad('0x26')](respondWithFilteredResult(_0x1b607d,_0x4af28e))[_0x72ad('0x43')](handleError(_0x1b607d,null));};exports[_0x72ad('0x44')]=function(_0x20e241,_0x24d332){var _0x2fa0dd={'raw':!![],'where':{'id':_0x20e241[_0x72ad('0x45')]['id']}},_0x215314={};_0x215314[_0x72ad('0x34')]=_[_0x72ad('0x46')](db['Attachment'][_0x72ad('0x2c')]);_0x215314['query']=_['keys'](_0x20e241['query']);_0x215314[_0x72ad('0x32')]=_[_0x72ad('0x33')](_0x215314[_0x72ad('0x34')],_0x215314['query']);_0x2fa0dd[_0x72ad('0x36')]=_[_0x72ad('0x33')](_0x215314['model'],qs[_0x72ad('0x35')](_0x20e241[_0x72ad('0x31')][_0x72ad('0x35')]));_0x2fa0dd[_0x72ad('0x36')]=_0x2fa0dd[_0x72ad('0x36')]['length']?_0x2fa0dd[_0x72ad('0x36')]:_0x215314[_0x72ad('0x34')];if(_0x20e241[_0x72ad('0x31')][_0x72ad('0x3f')]){_0x2fa0dd['include']=[{'all':!![]}];}_0x2fa0dd=_[_0x72ad('0x3d')]({},_0x2fa0dd,_0x20e241[_0x72ad('0x3e')]);return db[_0x72ad('0x2b')][_0x72ad('0x47')](_0x2fa0dd)[_0x72ad('0x26')](handleEntityNotFound(_0x24d332,null))[_0x72ad('0x26')](respondWithResult(_0x24d332,null))[_0x72ad('0x43')](handleError(_0x24d332,null));};exports[_0x72ad('0x48')]=function(_0x47420f,_0xd8b16c){var _0x1a542e={'where':{'id':_0x47420f['params']['id']}},_0x2d93ef={};_0x2d93ef[_0x72ad('0x34')]=_[_0x72ad('0x46')](db[_0x72ad('0x2b')][_0x72ad('0x2c')]);_0x1a542e['attributes']=_[_0x72ad('0x33')](_0x2d93ef[_0x72ad('0x34')],qs[_0x72ad('0x35')](_0x47420f['query']['fields']));_0x1a542e[_0x72ad('0x36')]=_0x1a542e[_0x72ad('0x36')]['length']?_0x1a542e[_0x72ad('0x36')]:_0x2d93ef[_0x72ad('0x34')];if(_0x47420f['query'][_0x72ad('0x3f')]){_0x1a542e[_0x72ad('0x40')]=[{'all':!![]}];}_0x1a542e=_['merge']({},_0x1a542e,_0x47420f['options']);return db[_0x72ad('0x2b')]['find'](_0x1a542e)[_0x72ad('0x26')](handleEntityNotFound(_0xd8b16c,null))[_0x72ad('0x26')](function(_0x382b8b){if(_0x382b8b){var _0xa322fe=_0x382b8b[_0x72ad('0x49')]({'plain':!![]});_0xa322fe=qs[_0x72ad('0x4a')](_0xa322fe,['id',_0x72ad('0x4b'),_0x72ad('0x4c')]);_0x47420f['body']=_['omit'](_0x47420f[_0x72ad('0x4d')],['id','createdAt',_0x72ad('0x4c')]);return db['Attachment'][_0x72ad('0x4e')](_[_0x72ad('0x3d')](_0xa322fe,_0x47420f[_0x72ad('0x4d')]),{'include':_0x47420f['query'][_0x72ad('0x3f')]?[{'all':!![]}]:undefined});}})[_0x72ad('0x26')](respondWithResult(_0xd8b16c,0xc9))[_0x72ad('0x43')](handleError(_0xd8b16c,null));};exports[_0x72ad('0x4f')]=function(_0x11187c,_0x1203f7){if(_0x11187c[_0x72ad('0x4d')]['id']){delete _0x11187c[_0x72ad('0x4d')]['id'];}return db[_0x72ad('0x2b')][_0x72ad('0x47')]({'where':{'id':_0x11187c[_0x72ad('0x45')]['id']}})[_0x72ad('0x26')](handleEntityNotFound(_0x1203f7,null))['then'](saveUpdates(_0x11187c[_0x72ad('0x4d')],null))['then'](respondWithResult(_0x1203f7,null))[_0x72ad('0x43')](handleError(_0x1203f7,null));};exports[_0x72ad('0x27')]=function(_0x111537,_0x4e255f){return db['Attachment'][_0x72ad('0x47')]({'where':{'id':_0x111537[_0x72ad('0x45')]['id']}})[_0x72ad('0x26')](handleEntityNotFound(_0x4e255f,null))[_0x72ad('0x26')](removeEntity(_0x4e255f,null))[_0x72ad('0x43')](handleError(_0x4e255f,null));};exports['create']=function(_0x4fff53,_0x2f8b83,_0xbc9d9f){_0x4fff53[_0x72ad('0x4d')]['name']=_0x4fff53['file'][_0x72ad('0x50')];_0x4fff53[_0x72ad('0x4d')][_0x72ad('0x51')]=_0x4fff53[_0x72ad('0x52')][_0x72ad('0x53')];_0x4fff53['body']['type']=_0x4fff53[_0x72ad('0x52')][_0x72ad('0x54')];return db[_0x72ad('0x2b')][_0x72ad('0x4e')](_0x4fff53[_0x72ad('0x4d')])[_0x72ad('0x26')](respondWithResult(_0x2f8b83,0xc9))['catch'](handleError(_0x2f8b83,null));};exports['download']=function(_0xd0a5b9,_0x23f639,_0x474b5d){return db[_0x72ad('0x2b')]['findOne']({'where':{'id':_0xd0a5b9[_0x72ad('0x45')]['id']},'raw':!![]})[_0x72ad('0x26')](handleEntityNotFound(_0x23f639,null))[_0x72ad('0x26')](function(_0x292cf7){if(_0x292cf7){var _0x2eec7a=_0x292cf7['ChatOfflineMessageId']!==null;var _0x5ba050=path[_0x72ad('0x55')](config['root'],'server/files/attachments/');if(_0x2eec7a){_0x5ba050=path[_0x72ad('0x55')](_0x5ba050,_0x72ad('0x56'));}var _0x1e4175=path[_0x72ad('0x55')](_0x5ba050,_0x292cf7['basename']);return _0x23f639[_0x72ad('0x57')](_0x1e4175);}})[_0x72ad('0x43')](handleError(_0x23f639,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 22d43ce..e070ce4 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 _0xb044=['lodash','../../config/logger','api','request-promise','path','rimraf','define','Attachment','attachments'];(function(_0x3a968e,_0x105c4d){var _0x9c978e=function(_0x24b2d0){while(--_0x24b2d0){_0x3a968e['push'](_0x3a968e['shift']());}};_0x9c978e(++_0x105c4d);}(_0xb044,0xcf));var _0x4b04=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb044[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4b04('0x0'));var util=require('util');var logger=require(_0x4b04('0x1'))(_0x4b04('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4b04('0x3'));var fs=require('fs');var path=require(_0x4b04('0x4'));var rimraf=require(_0x4b04('0x5'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module['exports']=function(_0x2f15c2,_0x29ecd5){return _0x2f15c2[_0x4b04('0x6')](_0x4b04('0x7'),attributes,{'tableName':_0x4b04('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7432=['Attachment','lodash','util','api','request-promise','path','rimraf','./attachment.attributes','exports','define'];(function(_0x530c29,_0x128d2d){var _0x50e44b=function(_0x466d45){while(--_0x466d45){_0x530c29['push'](_0x530c29['shift']());}};_0x50e44b(++_0x128d2d);}(_0x7432,0x155));var _0x2743=function(_0x52d811,_0x3522e1){_0x52d811=_0x52d811-0x0;var _0x37a216=_0x7432[_0x52d811];return _0x37a216;};'use strict';var _=require(_0x2743('0x0'));var util=require(_0x2743('0x1'));var logger=require('../../config/logger')(_0x2743('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2743('0x3'));var fs=require('fs');var path=require(_0x2743('0x4'));var rimraf=require(_0x2743('0x5'));var config=require('../../config/environment');var attributes=require(_0x2743('0x6'));module[_0x2743('0x7')]=function(_0x3d65eb,_0x1104de){return _0x3d65eb[_0x2743('0x8')](_0x2743('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 967cab7..68caf2a 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 _0x44a3=['create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','message','Attachment,\x20%s,\x20%s','catch','CreateAttachment','Attachment'];(function(_0x3f4f8a,_0x5057eb){var _0x28c7e8=function(_0x8eba3c){while(--_0x8eba3c){_0x3f4f8a['push'](_0x3f4f8a['shift']());}};_0x28c7e8(++_0x5057eb);}(_0x44a3,0x1a9));var _0x344a=function(_0x114bdf,_0x119ada){_0x114bdf=_0x114bdf-0x0;var _0x5658f6=_0x44a3[_0x114bdf];return _0x5658f6;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('Attachment,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('Attachment,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('Attachment,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});}exports[_0x344a('0x17')]=function(_0x277c06){var _0x49b55f=this;return new Promise(function(_0x9fe854,_0x274016){return db[_0x344a('0x18')][_0x344a('0x19')](_0x277c06[_0x344a('0x1a')],{'raw':_0x277c06[_0x344a('0x1b')]?_0x277c06[_0x344a('0x1b')][_0x344a('0x1c')]===undefined?!![]:![]:!![]})[_0x344a('0xe')](function(_0x450922){logger['info'](_0x344a('0x17'),_0x277c06);logger[_0x344a('0x11')](_0x344a('0x17'),_0x277c06,JSON[_0x344a('0x1d')](_0x450922));_0x9fe854(_0x450922);})[_0x344a('0x16')](function(_0x80ae12){logger[_0x344a('0x12')](_0x344a('0x17'),_0x80ae12[_0x344a('0x14')],_0x277c06);_0x274016(_0x49b55f[_0x344a('0x12')](0x1f4,_0x80ae12[_0x344a('0x14')]));});});}; \ No newline at end of file +var _0x2e54=['Attachment,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateAttachment','Attachment','options','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14af7c,_0x438af1){var _0x44d70a=function(_0x3074e4){while(--_0x3074e4){_0x14af7c['push'](_0x14af7c['shift']());}};_0x44d70a(++_0x438af1);}(_0x2e54,0x1dd));var _0x42e5=function(_0x385f9a,_0x4e95a8){_0x385f9a=_0x385f9a-0x0;var _0x1fc32a=_0x2e54[_0x385f9a];return _0x1fc32a;};'use strict';var _=require(_0x42e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x42e5('0x1'));var rs=require(_0x42e5('0x2'));var fs=require('fs');var Redis=require(_0x42e5('0x3'));var db=require(_0x42e5('0x4'))['db'];var utils=require(_0x42e5('0x5'));var logger=require(_0x42e5('0x6'))(_0x42e5('0x7'));var config=require('../../config/environment');var jayson=require(_0x42e5('0x8'));var client=jayson[_0x42e5('0x9')][_0x42e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bed10,_0x2af5bb,_0x56be20){return new BPromise(function(_0x335b92,_0x490b99){return client[_0x42e5('0xb')](_0x4bed10,_0x56be20)[_0x42e5('0xc')](function(_0x10ee5a){logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));logger[_0x42e5('0x10')](_0x42e5('0x11'),_0x2af5bb,_0x42e5('0xf'),JSON['stringify'](_0x10ee5a));if(_0x10ee5a[_0x42e5('0x12')]){if(_0x10ee5a[_0x42e5('0x12')]['code']===0x1f4){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x490b99(_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);}logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x10ee5a[_0x42e5('0x12')][_0x42e5('0x13')]);return _0x335b92(_0x10ee5a['error'][_0x42e5('0x13')]);}else{logger[_0x42e5('0xd')](_0x42e5('0xe'),_0x2af5bb,_0x42e5('0xf'));_0x335b92(_0x10ee5a[_0x42e5('0x14')][_0x42e5('0x13')]);}})[_0x42e5('0x15')](function(_0x3abe3d){logger[_0x42e5('0x12')](_0x42e5('0xe'),_0x2af5bb,_0x3abe3d);_0x490b99(_0x3abe3d);});});}exports[_0x42e5('0x16')]=function(_0x38282d){var _0x11550e=this;return new Promise(function(_0x23fe09,_0x54fcfc){return db[_0x42e5('0x17')]['create'](_0x38282d['body'],{'raw':_0x38282d[_0x42e5('0x18')]?_0x38282d[_0x42e5('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x42e5('0xc')](function(_0x39a3e2){logger[_0x42e5('0xd')](_0x42e5('0x16'),_0x38282d);logger[_0x42e5('0x10')](_0x42e5('0x16'),_0x38282d,JSON[_0x42e5('0x19')](_0x39a3e2));_0x23fe09(_0x39a3e2);})['catch'](function(_0x4da508){logger[_0x42e5('0x12')]('CreateAttachment',_0x4da508[_0x42e5('0x13')],_0x38282d);_0x54fcfc(_0x11550e[_0x42e5('0x12')](0x1f4,_0x4da508[_0x42e5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 20eb5c8..e0284ce 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 _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x213c6e,_0x378001){var _0x30f032=function(_0x53c08d){while(--_0x53c08d){_0x213c6e['push'](_0x213c6e['shift']());}};_0x30f032(++_0x378001);}(_0xb10b,0x12a));var _0xbb10=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xb10b[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 5ffb593..a5c7b02 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 _0x345e=['../../config/utils','../../config/environment','../../config/logger','api','activedirectory','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','then','blockDuration','minutes','clearBlockUser','getLicense','send','message','login','signToken','json','ad-login','passport','passport-local','Strategy','moment','bluebird','../../components/auth/service'];(function(_0x2c4a4e,_0x42e395){var _0x182441=function(_0x10037e){while(--_0x10037e){_0x2c4a4e['push'](_0x2c4a4e['shift']());}};_0x182441(++_0x42e395);}(_0x345e,0x12e));var _0xe345=function(_0x310dc2,_0x2299c4){_0x310dc2=_0x310dc2-0x0;var _0x24980f=_0x345e[_0x310dc2];return _0x24980f;};'use strict';var passport=require(_0xe345('0x0'));var LocalStrategy=require(_0xe345('0x1'))[_0xe345('0x2')];var moment=require(_0xe345('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xe345('0x4'));var util=require('util');var db=require('../../mysqldb')['db'];var authService=require(_0xe345('0x5'));var utils=require(_0xe345('0x6'));var config=require(_0xe345('0x7'));var logger=require(_0xe345('0x8'))(_0xe345('0x9'));function isActiveDirectoryConfigured(_0x40494c){var _0x469ced=![];if(typeof _0x40494c['activedirectory']!=='undefined'){_0x469ced=_0x40494c[_0xe345('0xa')][_0xe345('0xb')]&&_0x40494c[_0xe345('0xa')]['url']&&_0x40494c['activedirectory'][_0xe345('0xc')];}return _0x469ced;}function adAuthenticate(_0x12ef58,_0x5b2526,_0x438411){return new BPromise(function(_0x4a59ee,_0x1871a8){try{var _0x229c2f=new ActiveDirectory(_0x12ef58);_0x229c2f[_0xe345('0xd')](_0x5b2526,_0x438411,function(_0x133269,_0x4657e0){if(_0x133269){logger[_0xe345('0xe')](_0xe345('0xf'),_0x5b2526,util['inspect'](_0x133269,{'showHidden':![],'depth':null}));_0x1871a8(_0xe345('0x10'));}else if(!_0x4657e0){logger[_0xe345('0xe')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x5b2526);_0x1871a8(_0xe345('0x10'));}else{_0x4a59ee(_0x4657e0);}});}catch(_0x284db4){_0x1871a8(_0x284db4);}});}function ActiveDirectoryAuthenticate(_0x4d9756,_0x58fa55,_0x452d8d,_0x501681){var _0x3edc88,_0x54e4bc;if(!isActiveDirectoryConfigured(config)){logger[_0xe345('0xe')](_0xe345('0x11'),_0x58fa55);return _0x501681(null,![],{'message':_0xe345('0x10')});}return db[_0xe345('0x12')][_0xe345('0x13')]({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})['then'](function(_0x22256a){_0x3edc88=_0x22256a;if(!_0x3edc88[_0xe345('0x14')]){logger[_0xe345('0xe')](_0xe345('0x15'),_0x58fa55);throw new Error(_0xe345('0x10'));}return _0x4d9756['findOne']({'attributes':['id',_0xe345('0x16'),_0xe345('0x17'),_0xe345('0x18'),_0xe345('0x19'),_0xe345('0x1a'),_0xe345('0x1b'),_0xe345('0x1c'),_0xe345('0x1d')],'where':{'name':_0x58fa55,'role':{'$or':[_0xe345('0x1e'),_0xe345('0x1f'),_0xe345('0x20')]},'adSsoEnabled':!![]}});})['then'](function(_0x4c41e9){if(!_0x4c41e9||_0x4c41e9&&_0x4c41e9[_0xe345('0x16')]!==_0x58fa55){throw new Error(_0xe345('0x10'));}_0x54e4bc=_0x4c41e9;var _0x4d904a=_0x54e4bc[_0xe345('0x16')]+'@'+config[_0xe345('0xa')]['domain'];return adAuthenticate(config['activedirectory'],_0x4d904a,_0x452d8d);})[_0xe345('0x21')](function(_0x16a7af){if(_0x54e4bc[_0xe345('0x1a')]){throw new Error(_0xe345('0x10'));}if(_0x3edc88[_0xe345('0x22')]>0x0){if(_0x54e4bc[_0xe345('0x1b')]){if(moment(_0x54e4bc[_0xe345('0x1c')])['add'](_0x3edc88[_0xe345('0x22')],_0xe345('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xe345('0x24')](_0x54e4bc,0x0,![],null)[_0xe345('0x21')](function(){return utils[_0xe345('0x25')](_0x54e4bc);})[_0xe345('0x21')](function(){return _0x501681(null,_0x54e4bc);});}else{return utils['getLicense'](_0x54e4bc)[_0xe345('0x21')](function(){return _0x501681(null,_0x54e4bc);});}}else{return utils[_0xe345('0x25')](_0x54e4bc)[_0xe345('0x21')](function(){return _0x501681(null,_0x54e4bc);});}})['catch'](function(_0x4be728){return _0x501681(null,![],_0x4be728);});}function handleError(_0x378e97,_0x2097c1,_0x1ff043){return _0x378e97['status'](_0x2097c1||0x1f4)[_0xe345('0x26')]({'message':_0x1ff043?_0x1ff043[_0xe345('0x27')]||_0x1ff043:''});}exports[_0xe345('0x28')]=function(_0x2decca,_0x37f971,_0xacedc3){passport['authenticate']('ad-login',function(_0x17a953,_0x124afb,_0x5114ce){var _0x1e89da=_0x17a953||_0x5114ce;if(_0x1e89da){return handleError(_0x37f971,0x191,_0x1e89da);}if(!_0x124afb){return handleError(_0x37f971,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x401516={'payload':{'id':_0x124afb['id'],'role':_0x124afb['role']},'options':{'expiresIn':0x15180}};return authService[_0xe345('0x29')](_0x401516)[_0xe345('0x21')](function(_0x2ec58f){_0x37f971[_0xe345('0x2a')]({'id':_0x124afb['id'],'token':_0x2ec58f,'statusCall':'','isAlreadyLogged':_0x124afb['online']});});}})(_0x2decca,_0x37f971,_0xacedc3);};passport['use'](_0xe345('0x2b'),new LocalStrategy({'usernameField':_0xe345('0x16'),'passwordField':'password'},function(_0x415dc1,_0x197a15,_0x4a1b6a){return ActiveDirectoryAuthenticate(db['User'],_0x415dc1,_0x197a15,_0x4a1b6a);})); \ No newline at end of file +var _0x49bf=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','role','disabled','blocked','online','admin','user','agent','name','then','add','minutes','clearBlockUser','getLicense','catch','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','use','password','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','undefined','activedirectory','baseDN','url','domain','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','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','adSsoEnabled'];(function(_0x379c71,_0x2aafd0){var _0x3aba66=function(_0x21e148){while(--_0x21e148){_0x379c71['push'](_0x379c71['shift']());}};_0x3aba66(++_0x2aafd0);}(_0x49bf,0x1b8));var _0xf49b=function(_0x18eac7,_0x5e06e9){_0x18eac7=_0x18eac7-0x0;var _0x30ca3c=_0x49bf[_0x18eac7];return _0x30ca3c;};'use strict';var passport=require(_0xf49b('0x0'));var LocalStrategy=require(_0xf49b('0x1'))[_0xf49b('0x2')];var moment=require(_0xf49b('0x3'));var ActiveDirectory=require(_0xf49b('0x4'));var BPromise=require(_0xf49b('0x5'));var util=require(_0xf49b('0x6'));var db=require(_0xf49b('0x7'))['db'];var authService=require(_0xf49b('0x8'));var utils=require(_0xf49b('0x9'));var config=require('../../config/environment');var logger=require(_0xf49b('0xa'))(_0xf49b('0xb'));function isActiveDirectoryConfigured(_0x226e8e){var _0x44fe9b=![];if(typeof _0x226e8e['activedirectory']!==_0xf49b('0xc')){_0x44fe9b=_0x226e8e[_0xf49b('0xd')][_0xf49b('0xe')]&&_0x226e8e['activedirectory'][_0xf49b('0xf')]&&_0x226e8e[_0xf49b('0xd')][_0xf49b('0x10')];}return _0x44fe9b;}function adAuthenticate(_0x5ed458,_0x752113,_0x51fdc1){return new BPromise(function(_0x4b4a75,_0x2ebdc3){try{var _0x9cc63a=new ActiveDirectory(_0x5ed458);_0x9cc63a[_0xf49b('0x11')](_0x752113,_0x51fdc1,function(_0x527d16,_0x22559b){if(_0x527d16){logger[_0xf49b('0x12')](_0xf49b('0x13'),_0x752113,util[_0xf49b('0x14')](_0x527d16,{'showHidden':![],'depth':null}));_0x2ebdc3(_0xf49b('0x15'));}else if(!_0x22559b){logger[_0xf49b('0x12')](_0xf49b('0x16'),_0x752113);_0x2ebdc3(_0xf49b('0x15'));}else{_0x4b4a75(_0x22559b);}});}catch(_0x45ae04){_0x2ebdc3(_0x45ae04);}});}function ActiveDirectoryAuthenticate(_0x3af03c,_0x559920,_0x303283,_0x4f6f18){var _0x26d52e,_0x20d138;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xf49b('0x17'),_0x559920);return _0x4f6f18(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xf49b('0x18')][_0xf49b('0x19')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xf49b('0x1a')],'raw':!![]})['then'](function(_0x234fc5){_0x26d52e=_0x234fc5;if(!_0x26d52e[_0xf49b('0x1b')]){logger[_0xf49b('0x12')](_0xf49b('0x1c'),_0x559920);throw new Error(_0xf49b('0x15'));}return _0x3af03c['findOne']({'attributes':['id','name','password','salt',_0xf49b('0x1d'),_0xf49b('0x1e'),_0xf49b('0x1f'),'blockedAt',_0xf49b('0x20')],'where':{'name':_0x559920,'role':{'$or':[_0xf49b('0x21'),_0xf49b('0x22'),_0xf49b('0x23')]},'adSsoEnabled':!![]}});})['then'](function(_0x57d82e){if(!_0x57d82e||_0x57d82e&&_0x57d82e[_0xf49b('0x24')]!==_0x559920){throw new Error(_0xf49b('0x15'));}_0x20d138=_0x57d82e;var _0x50ba60=_0x20d138[_0xf49b('0x24')]+'@'+config['activedirectory'][_0xf49b('0x10')];return adAuthenticate(config['activedirectory'],_0x50ba60,_0x303283);})[_0xf49b('0x25')](function(_0x107072){if(_0x20d138['disabled']){throw new Error(_0xf49b('0x15'));}if(_0x26d52e['blockDuration']>0x0){if(_0x20d138[_0xf49b('0x1f')]){if(moment(_0x20d138['blockedAt'])[_0xf49b('0x26')](_0x26d52e[_0xf49b('0x1a')],_0xf49b('0x27'))>moment()){throw new Error(_0xf49b('0x15'));}return utils[_0xf49b('0x28')](_0x20d138,0x0,![],null)['then'](function(){return utils[_0xf49b('0x29')](_0x20d138);})[_0xf49b('0x25')](function(){return _0x4f6f18(null,_0x20d138);});}else{return utils[_0xf49b('0x29')](_0x20d138)['then'](function(){return _0x4f6f18(null,_0x20d138);});}}else{return utils[_0xf49b('0x29')](_0x20d138)[_0xf49b('0x25')](function(){return _0x4f6f18(null,_0x20d138);});}})[_0xf49b('0x2a')](function(_0x6ed949){return _0x4f6f18(null,![],_0x6ed949);});}function handleError(_0x3d955a,_0x30d78c,_0x55e495){return _0x3d955a[_0xf49b('0x2b')](_0x30d78c||0x1f4)[_0xf49b('0x2c')]({'message':_0x55e495?_0x55e495[_0xf49b('0x2d')]||_0x55e495:''});}exports['login']=function(_0x233979,_0x15d049,_0x14c47d){passport['authenticate'](_0xf49b('0x2e'),function(_0x2692ed,_0x4c02d4,_0x1fe454){var _0x525f39=_0x2692ed||_0x1fe454;if(_0x525f39){return handleError(_0x15d049,0x191,_0x525f39);}if(!_0x4c02d4){return handleError(_0x15d049,0x194,{'message':_0xf49b('0x2f')});}else{var _0x5553bd={'payload':{'id':_0x4c02d4['id'],'role':_0x4c02d4[_0xf49b('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0xf49b('0x30')](_0x5553bd)['then'](function(_0x2dfff8){_0x15d049['json']({'id':_0x4c02d4['id'],'token':_0x2dfff8,'statusCall':'','isAlreadyLogged':_0x4c02d4['online']});});}})(_0x233979,_0x15d049,_0x14c47d);};passport[_0xf49b('0x31')]('ad-login',new LocalStrategy({'usernameField':_0xf49b('0x24'),'passwordField':_0xf49b('0x32')},function(_0xa741d4,_0x201138,_0x3f2e1b){return ActiveDirectoryAuthenticate(db[_0xf49b('0x33')],_0xa741d4,_0x201138,_0x3f2e1b);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 444e050..2ab43c4 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 _0x48e8=['login','express','./authActiveDirectory.controller','post'];(function(_0x1f9ee0,_0x2152a2){var _0x4274b5=function(_0x4c72bd){while(--_0x4c72bd){_0x1f9ee0['push'](_0x1f9ee0['shift']());}};_0x4274b5(++_0x2152a2);}(_0x48e8,0x1b9));var _0x848e=function(_0x481d67,_0x41317c){_0x481d67=_0x481d67-0x0;var _0xbfff15=_0x48e8[_0x481d67];return _0xbfff15;};'use strict';var express=require(_0x848e('0x0'));var router=express['Router']();var controller=require(_0x848e('0x1'));router[_0x848e('0x2')]('/',controller[_0x848e('0x3')]);module['exports']=router; \ No newline at end of file +var _0xa4b4=['express','Router','./authActiveDirectory.controller','login','exports'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0xa4b4,0x118));var _0x4a4b=function(_0x3048ea,_0x3838c2){_0x3048ea=_0x3048ea-0x0;var _0x1a13c4=_0xa4b4[_0x3048ea];return _0x1a13c4;};'use strict';var express=require(_0x4a4b('0x0'));var router=express[_0x4a4b('0x1')]();var controller=require(_0x4a4b('0x2'));router['post']('/',controller[_0x4a4b('0x3')]);module[_0x4a4b('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 0026294..f7ca954 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x202703,_0x192231){var _0x201855=function(_0x453148){while(--_0x453148){_0x202703['push'](_0x202703['shift']());}};_0x201855(++_0x192231);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x526b0b,_0x1bb180){var _0xcc4084=function(_0x4cd237){while(--_0x4cd237){_0x526b0b['push'](_0x526b0b['shift']());}};_0xcc4084(++_0x1bb180);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 b951dfc..cc56007 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 _0xb218=['../../components/auth/service','get','login','/callback','callback','isMiddleware','passport','Router','./authGoogle.controller'];(function(_0x2d23e5,_0x32495a){var _0x38823a=function(_0x21809b){while(--_0x21809b){_0x2d23e5['push'](_0x2d23e5['shift']());}};_0x38823a(++_0x32495a);}(_0xb218,0x1bf));var _0x8b21=function(_0x9f833a,_0x317091){_0x9f833a=_0x9f833a-0x0;var _0x1ee10=_0xb218[_0x9f833a];return _0x1ee10;};'use strict';var express=require('express');var passport=require(_0x8b21('0x0'));var router=express[_0x8b21('0x1')]();var controller=require(_0x8b21('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x8b21('0x3'));router[_0x8b21('0x4')]('/',controller[_0x8b21('0x5')]);router[_0x8b21('0x4')](_0x8b21('0x6'),controller[_0x8b21('0x7')],authService[_0x8b21('0x8')],userController[_0x8b21('0x5')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0x52c1=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','express'];(function(_0x3aa583,_0x2f4500){var _0x57cd75=function(_0x424bb9){while(--_0x424bb9){_0x3aa583['push'](_0x3aa583['shift']());}};_0x57cd75(++_0x2f4500);}(_0x52c1,0xce));var _0x152c=function(_0xe9815e,_0x5b625f){_0xe9815e=_0xe9815e-0x0;var _0x1b8010=_0x52c1[_0xe9815e];return _0x1b8010;};'use strict';var express=require(_0x152c('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0x152c('0x1'));var userController=require(_0x152c('0x2'));var authService=require(_0x152c('0x3'));router[_0x152c('0x4')]('/',controller[_0x152c('0x5')]);router[_0x152c('0x4')](_0x152c('0x6'),controller[_0x152c('0x7')],authService[_0x152c('0x8')],userController[_0x152c('0x5')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 25c8f7a..bda6624 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 _0xdd13=['Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','save','Password\x20reset!','passport-local','lodash','randomstring','moment','../../components/auth/service','../../config/utils','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','blocked','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','add','clearBlockUser','minutes','getLicense','catch','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','Smtp','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'];(function(_0x206f38,_0x30c97e){var _0x44ac50=function(_0x4366f6){while(--_0x4366f6){_0x206f38['push'](_0x206f38['shift']());}};_0x44ac50(++_0x30c97e);}(_0xdd13,0x19c));var _0x3dd1=function(_0x482dfe,_0x483825){_0x482dfe=_0x482dfe-0x0;var _0x1d06c6=_0xdd13[_0x482dfe];return _0x1d06c6;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0x3dd1('0x0'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x3dd1('0x1'));var rs=require(_0x3dd1('0x2'));var moment=require(_0x3dd1('0x3'));var db=require('../../mysqldb')['db'];var authService=require(_0x3dd1('0x4'));var utils=require(_0x3dd1('0x5'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x84efd3,_0x2d219f,_0x1e41ef,_0x7a3b48){var _0x42a044,_0x2dd374;return db[_0x3dd1('0x6')][_0x3dd1('0x7')]({'where':{'id':0x1},'attributes':[_0x3dd1('0x8'),_0x3dd1('0x9')],'raw':!![]})[_0x3dd1('0xa')](function(_0x2a7525){_0x42a044=_0x2a7525;return _0x84efd3[_0x3dd1('0x7')]({'attributes':['id',_0x3dd1('0xb'),_0x3dd1('0xc'),_0x3dd1('0xd'),_0x3dd1('0xe'),'disabled',_0x3dd1('0xf'),_0x3dd1('0x10'),_0x3dd1('0x11')],'where':{'name':_0x2d219f,'role':{'$or':['admin',_0x3dd1('0x12'),_0x3dd1('0x13')]}}});})[_0x3dd1('0xa')](function(_0x509c41){if(!_0x509c41||_0x509c41&&_0x509c41[_0x3dd1('0xb')]!==_0x2d219f){throw new Error(_0x3dd1('0x14'));}else{_0x2dd374=_0x509c41;return _0x2dd374;}})['then'](function(){_0x2dd374['authenticate'](_0x1e41ef,function(_0x345cc3,_0x175d3b){var _0x3aa7ee=_0x2dd374[_0x3dd1('0x11')]+0x1;if(_0x345cc3){return _0x7a3b48(_0x345cc3);}else if(!_0x175d3b){if(_0x2dd374[_0x3dd1('0x15')]){return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});}else if(_0x42a044[_0x3dd1('0x8')]>0x0){if(_0x2dd374[_0x3dd1('0xf')]){if(_0x42a044['blockDuration']>0x0){if(moment(_0x2dd374[_0x3dd1('0x10')])[_0x3dd1('0x16')](_0x42a044['blockDuration'],'minutes')>moment()){return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});}else{return utils[_0x3dd1('0x17')](_0x2dd374,_0x3aa7ee,![],null)[_0x3dd1('0xa')](function(){return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});});}}else{return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});}}else{if(_0x3aa7ee>=_0x42a044[_0x3dd1('0x8')]){return utils[_0x3dd1('0x17')](_0x2dd374,0x0,!![],moment())[_0x3dd1('0xa')](function(){return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});});}else{return utils[_0x3dd1('0x17')](_0x2dd374,_0x3aa7ee,![],null)[_0x3dd1('0xa')](function(){return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});});}}}else{return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});}}else{if(_0x2dd374[_0x3dd1('0x15')]){return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});}else if(_0x42a044[_0x3dd1('0x8')]>0x0){if(_0x2dd374[_0x3dd1('0xf')]){if(_0x42a044[_0x3dd1('0x9')]>0x0){if(moment(_0x2dd374[_0x3dd1('0x10')])[_0x3dd1('0x16')](_0x42a044['blockDuration'],_0x3dd1('0x18'))>moment()){return _0x7a3b48(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x3dd1('0x17')](_0x2dd374,0x0,![],null)['then'](function(){return utils[_0x3dd1('0x19')](_0x2dd374);})[_0x3dd1('0xa')](function(){return _0x7a3b48(null,_0x2dd374);});}}else{return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});}}else{return utils[_0x3dd1('0x17')](_0x2dd374,0x0,![],null)[_0x3dd1('0xa')](function(){return utils[_0x3dd1('0x19')](_0x2dd374);})[_0x3dd1('0xa')](function(){return _0x7a3b48(null,_0x2dd374);})[_0x3dd1('0x1a')](function(_0x5d92d2){return _0x7a3b48(null,![],_0x5d92d2);});}}else{if(_0x2dd374['blocked']){return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});}else{return utils[_0x3dd1('0x19')](_0x2dd374)[_0x3dd1('0xa')](function(){return _0x7a3b48(null,_0x2dd374);});}}}});})[_0x3dd1('0x1a')](function(_0x946d50){return _0x7a3b48(null,![],_0x946d50);});}function sendServiceMail(_0x40271b){return db['MailAccount'][_0x3dd1('0x1b')]({'where':{'service':!![]},'attributes':['id',_0x3dd1('0xb'),_0x3dd1('0x1c')],'include':[{'model':db[_0x3dd1('0x1d')],'as':'Smtp','include':[{'model':db[_0x3dd1('0x1e')],'as':_0x3dd1('0x1e')}]}]})['then'](function(_0x5c1cd9){if(!_0x5c1cd9){throw new Error(_0x3dd1('0x1f'));}var _0x597c33=_0x5c1cd9[_0x3dd1('0x20')]();var _0x3c1580={'account':_0x597c33,'message':_[_0x3dd1('0x21')]({'from':util[_0x3dd1('0x22')]('\x22%s\x22\x20<%s>',_0x5c1cd9[_0x3dd1('0xb')],_0x5c1cd9[_0x3dd1('0x1c')]||_0x5c1cd9[_0x3dd1('0x23')][_0x3dd1('0x12')])},_0x40271b)};return client['request'](_0x3dd1('0x24'),_0x3c1580);})[_0x3dd1('0xa')](function(_0x2c707a){if(_0x2c707a[_0x3dd1('0x25')]){throw new Error(util[_0x3dd1('0x22')](_0x3dd1('0x26'),_0x2c707a[_0x3dd1('0x25')][_0x3dd1('0x27')]||JSON[_0x3dd1('0x28')](_0x2c707a[_0x3dd1('0x25')])));}return!![];});}function handleError(_0x17c92a,_0x459c65,_0x52601f){return _0x17c92a[_0x3dd1('0x29')](_0x459c65||0x1f4)[_0x3dd1('0x2a')]({'message':_0x52601f?_0x52601f[_0x3dd1('0x27')]||_0x52601f:''});}exports[_0x3dd1('0x2b')]=function(_0x479dab,_0x18e73d,_0x25deeb){passport[_0x3dd1('0x2c')](_0x3dd1('0x2d'),function(_0x3fbf26,_0x4cc300,_0x53865d){var _0x249b94=_0x3fbf26||_0x53865d;if(_0x249b94){return handleError(_0x18e73d,0x191,_0x249b94);}if(!_0x4cc300){return handleError(_0x18e73d,0x194,{'message':_0x3dd1('0x2e')});}else{var _0xc9d778={'payload':{'id':_0x4cc300['id'],'role':_0x4cc300[_0x3dd1('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0x3dd1('0x2f')](_0xc9d778)[_0x3dd1('0xa')](function(_0x210a91){_0x18e73d[_0x3dd1('0x30')]({'id':_0x4cc300['id'],'token':_0x210a91,'statusCall':'','isAlreadyLogged':_0x4cc300[_0x3dd1('0x31')]});});}})(_0x479dab,_0x18e73d,_0x25deeb);};exports[_0x3dd1('0x32')]=function(_0x466c97,_0x5900e3){if(!_0x466c97['body'][_0x3dd1('0x1c')]){return handleError(_0x5900e3,0x1f4,{'message':_0x3dd1('0x33')});}var _0x537c9e=rs[_0x3dd1('0x34')]();_0x466c97[_0x3dd1('0x35')]['email']=_0x466c97['body'][_0x3dd1('0x1c')][_0x3dd1('0x36')]()[_0x3dd1('0x37')]();var _0x555083;return db[_0x3dd1('0x6')]['findOne']({'where':{'id':0x1},'attributes':[_0x3dd1('0x8'),'blockDuration'],'raw':!![]})[_0x3dd1('0xa')](function(_0x19f538){_0x555083=_0x19f538;return db[_0x3dd1('0x38')][_0x3dd1('0x1b')]({'where':{'email':_0x466c97[_0x3dd1('0x35')][_0x3dd1('0x1c')]}});})[_0x3dd1('0xa')](function(_0x4cb4e8){if(!_0x4cb4e8){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x4cb4e8[_0x3dd1('0x15')]){throw new Error(_0x3dd1('0x39'));}if(_0x4cb4e8['blocked']){if(moment(_0x4cb4e8[_0x3dd1('0x10')])[_0x3dd1('0x16')](_0x555083['blockDuration'],_0x3dd1('0x18'))>moment()){throw new Error(_0x3dd1('0x3a'));}else{_0x4cb4e8[_0x3dd1('0xf')]=![];_0x4cb4e8['blockedAt']=null;}}_0x4cb4e8[_0x3dd1('0x3b')]=_0x537c9e;_0x4cb4e8[_0x3dd1('0x3c')]=Date[_0x3dd1('0x3d')]()+0x36ee80;return _0x4cb4e8['save']();})['then'](function(){return sendServiceMail({'to':_0x466c97[_0x3dd1('0x35')][_0x3dd1('0x1c')],'subject':_0x3dd1('0x3e'),'text':_0x3dd1('0x3f')+_0x3dd1('0x40')+'https://'+_0x466c97[_0x3dd1('0x41')]['host']+_0x3dd1('0x42')+_0x537c9e+'\x0a\x0a'+_0x3dd1('0x43')});})[_0x3dd1('0xa')](function(){_0x5900e3[_0x3dd1('0x29')](0xc8)[_0x3dd1('0x2a')]({'message':_0x3dd1('0x44')});})[_0x3dd1('0x1a')](function(_0x43d834){return handleError(_0x5900e3,0x1f4,_0x43d834);});};exports[_0x3dd1('0x45')]=function(_0x2af24d,_0x363261){return db[_0x3dd1('0x38')][_0x3dd1('0x1b')]({'where':{'resetPasswordToken':_0x2af24d[_0x3dd1('0x46')][_0x3dd1('0x47')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x3dd1('0xa')](function(_0x2c896d){if(!_0x2c896d){throw new Error(_0x3dd1('0x48'));}return db['Setting'][_0x3dd1('0x7')]({'attributes':['id',_0x3dd1('0x49'),_0x3dd1('0x4a'),_0x3dd1('0x4b')]})[_0x3dd1('0xa')](function(_0x26e8e3){if(_0x26e8e3[_0x3dd1('0x49')])authService['validatePasswordPattern'](_0x2af24d[_0x3dd1('0x35')][_0x3dd1('0xc')]);if(!_0x26e8e3[_0x3dd1('0x4a')]||!_0x2c896d['previousPasswords'])return _0x2c896d;authService[_0x3dd1('0x4c')](_0x2af24d['body']['password'],_0x2c896d[_0x3dd1('0x4d')],_0x26e8e3[_0x3dd1('0x4b')]);return _0x2c896d;})['then'](function(){_0x2c896d['password']=_0x2af24d['body'][_0x3dd1('0xc')];_0x2c896d[_0x3dd1('0x3b')]=null;_0x2c896d['resetPasswordExpires']=null;return _0x2c896d[_0x3dd1('0x4e')]();});})[_0x3dd1('0xa')](function(){_0x363261[_0x3dd1('0x29')](0xc8)['send']({'message':_0x3dd1('0x4f')});})[_0x3dd1('0x1a')](function(_0x3c95ad){return handleError(_0x363261,0x1f4,_0x3c95ad);});};passport['use'](_0x3dd1('0x2d'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x505124,_0x465585,_0x215166){return localAuthenticate(db[_0x3dd1('0x38')],_0x505124,_0x465585,_0x215166);})); \ No newline at end of file +var _0xed83=['now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','send','Reset\x20Email\x20sent!','reset','User','find','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','resetPasswordToken','Password\x20reset!','use','local-login','util','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','client','http','Setting','allowedLoginAttempts','findOne','name','password','salt','role','disabled','blocked','loginAttempts','user','agent','then','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','catch','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','email','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','This\x20email\x20is\x20not\x20registered.','resetPasswordExpires'];(function(_0x583ecc,_0x4e2634){var _0x37469b=function(_0x19b5c4){while(--_0x19b5c4){_0x583ecc['push'](_0x583ecc['shift']());}};_0x37469b(++_0x4e2634);}(_0xed83,0x105));var _0x3ed8=function(_0xc9396b,_0x734ceb){_0xc9396b=_0xc9396b-0x0;var _0x56d6ee=_0xed83[_0xc9396b];return _0x56d6ee;};'use strict';var util=require(_0x3ed8('0x0'));var passport=require('passport');var LocalStrategy=require(_0x3ed8('0x1'))[_0x3ed8('0x2')];var jayson=require(_0x3ed8('0x3'));var _=require(_0x3ed8('0x4'));var rs=require(_0x3ed8('0x5'));var moment=require('moment');var db=require(_0x3ed8('0x6'))['db'];var authService=require(_0x3ed8('0x7'));var utils=require('../../config/utils');var client=jayson[_0x3ed8('0x8')][_0x3ed8('0x9')]({'port':0x232b});function localAuthenticate(_0x15caf0,_0x55993d,_0x43524d,_0x37acf9){var _0x5e38bb,_0x2af37f;return db[_0x3ed8('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x3ed8('0xb'),'blockDuration'],'raw':!![]})['then'](function(_0x5a239f){_0x5e38bb=_0x5a239f;return _0x15caf0[_0x3ed8('0xc')]({'attributes':['id',_0x3ed8('0xd'),_0x3ed8('0xe'),_0x3ed8('0xf'),_0x3ed8('0x10'),_0x3ed8('0x11'),_0x3ed8('0x12'),'blockedAt',_0x3ed8('0x13')],'where':{'name':_0x55993d,'role':{'$or':['admin',_0x3ed8('0x14'),_0x3ed8('0x15')]}}});})['then'](function(_0x5b4d09){if(!_0x5b4d09||_0x5b4d09&&_0x5b4d09['name']!==_0x55993d){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2af37f=_0x5b4d09;return _0x2af37f;}})[_0x3ed8('0x16')](function(){_0x2af37f[_0x3ed8('0x17')](_0x43524d,function(_0x53e94a,_0x197ff5){var _0x5e8819=_0x2af37f[_0x3ed8('0x13')]+0x1;if(_0x53e94a){return _0x37acf9(_0x53e94a);}else if(!_0x197ff5){if(_0x2af37f[_0x3ed8('0x11')]){return _0x37acf9(null,![],{'message':_0x3ed8('0x18')});}else if(_0x5e38bb[_0x3ed8('0xb')]>0x0){if(_0x2af37f[_0x3ed8('0x12')]){if(_0x5e38bb[_0x3ed8('0x19')]>0x0){if(moment(_0x2af37f[_0x3ed8('0x1a')])[_0x3ed8('0x1b')](_0x5e38bb[_0x3ed8('0x19')],_0x3ed8('0x1c'))>moment()){return _0x37acf9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x3ed8('0x1d')](_0x2af37f,_0x5e8819,![],null)['then'](function(){return _0x37acf9(null,![],{'message':_0x3ed8('0x18')});});}}else{return _0x37acf9(null,![],{'message':_0x3ed8('0x18')});}}else{if(_0x5e8819>=_0x5e38bb[_0x3ed8('0xb')]){return utils['clearBlockUser'](_0x2af37f,0x0,!![],moment())[_0x3ed8('0x16')](function(){return _0x37acf9(null,![],{'message':_0x3ed8('0x18')});});}else{return utils[_0x3ed8('0x1d')](_0x2af37f,_0x5e8819,![],null)[_0x3ed8('0x16')](function(){return _0x37acf9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x37acf9(null,![],{'message':_0x3ed8('0x18')});}}else{if(_0x2af37f[_0x3ed8('0x11')]){return _0x37acf9(null,![],{'message':_0x3ed8('0x18')});}else if(_0x5e38bb[_0x3ed8('0xb')]>0x0){if(_0x2af37f[_0x3ed8('0x12')]){if(_0x5e38bb[_0x3ed8('0x19')]>0x0){if(moment(_0x2af37f[_0x3ed8('0x1a')])[_0x3ed8('0x1b')](_0x5e38bb[_0x3ed8('0x19')],_0x3ed8('0x1c'))>moment()){return _0x37acf9(null,![],{'message':_0x3ed8('0x18')});}else{return utils['clearBlockUser'](_0x2af37f,0x0,![],null)[_0x3ed8('0x16')](function(){return utils[_0x3ed8('0x1e')](_0x2af37f);})['then'](function(){return _0x37acf9(null,_0x2af37f);});}}else{return _0x37acf9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x3ed8('0x1d')](_0x2af37f,0x0,![],null)['then'](function(){return utils['getLicense'](_0x2af37f);})[_0x3ed8('0x16')](function(){return _0x37acf9(null,_0x2af37f);})[_0x3ed8('0x1f')](function(_0x4b721a){return _0x37acf9(null,![],_0x4b721a);});}}else{if(_0x2af37f['blocked']){return _0x37acf9(null,![],{'message':_0x3ed8('0x18')});}else{return utils[_0x3ed8('0x1e')](_0x2af37f)[_0x3ed8('0x16')](function(){return _0x37acf9(null,_0x2af37f);});}}}});})[_0x3ed8('0x1f')](function(_0x1fe6fb){return _0x37acf9(null,![],_0x1fe6fb);});}function sendServiceMail(_0x5b35fb){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0x3ed8('0xd'),'email'],'include':[{'model':db['MailServerOut'],'as':_0x3ed8('0x20'),'include':[{'model':db[_0x3ed8('0x21')],'as':_0x3ed8('0x21')}]}]})[_0x3ed8('0x16')](function(_0x5e78c1){if(!_0x5e78c1){throw new Error(_0x3ed8('0x22'));}var _0x412c47=_0x5e78c1[_0x3ed8('0x23')]();var _0x58a748={'account':_0x412c47,'message':_['merge']({'from':util[_0x3ed8('0x24')](_0x3ed8('0x25'),_0x5e78c1[_0x3ed8('0xd')],_0x5e78c1[_0x3ed8('0x26')]||_0x5e78c1['Smtp'][_0x3ed8('0x14')])},_0x5b35fb)};return client['request']('SendMail',_0x58a748);})['then'](function(_0x2505e0){if(_0x2505e0[_0x3ed8('0x27')]){throw new Error(util[_0x3ed8('0x24')](_0x3ed8('0x28'),_0x2505e0[_0x3ed8('0x27')][_0x3ed8('0x29')]||JSON[_0x3ed8('0x2a')](_0x2505e0[_0x3ed8('0x27')])));}return!![];});}function handleError(_0x2059e5,_0x55d40d,_0x1dbfa9){return _0x2059e5[_0x3ed8('0x2b')](_0x55d40d||0x1f4)['send']({'message':_0x1dbfa9?_0x1dbfa9['message']||_0x1dbfa9:''});}exports[_0x3ed8('0x2c')]=function(_0x419772,_0x40c20b,_0x5af252){passport[_0x3ed8('0x17')]('local-login',function(_0x284743,_0x1cabaf,_0x567b21){var _0x3f778d=_0x284743||_0x567b21;if(_0x3f778d){return handleError(_0x40c20b,0x191,_0x3f778d);}if(!_0x1cabaf){return handleError(_0x40c20b,0x194,{'message':_0x3ed8('0x2d')});}else{var _0x585c24={'payload':{'id':_0x1cabaf['id'],'role':_0x1cabaf[_0x3ed8('0x10')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x585c24)[_0x3ed8('0x16')](function(_0x22b4e1){_0x40c20b[_0x3ed8('0x2e')]({'id':_0x1cabaf['id'],'token':_0x22b4e1,'statusCall':'','isAlreadyLogged':_0x1cabaf[_0x3ed8('0x2f')]});});}})(_0x419772,_0x40c20b,_0x5af252);};exports[_0x3ed8('0x30')]=function(_0xcdf35f,_0x1f827e){if(!_0xcdf35f['body'][_0x3ed8('0x26')]){return handleError(_0x1f827e,0x1f4,{'message':_0x3ed8('0x31')});}var _0x4a9b6d=rs[_0x3ed8('0x32')]();_0xcdf35f['body'][_0x3ed8('0x26')]=_0xcdf35f[_0x3ed8('0x33')]['email'][_0x3ed8('0x34')]()['toLowerCase']();var _0x20ae0d;return db[_0x3ed8('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x3ed8('0xb'),'blockDuration'],'raw':!![]})[_0x3ed8('0x16')](function(_0x22a4fa){_0x20ae0d=_0x22a4fa;return db['User']['find']({'where':{'email':_0xcdf35f['body']['email']}});})[_0x3ed8('0x16')](function(_0x4d3221){if(!_0x4d3221){throw new Error(_0x3ed8('0x35'));}if(_0x4d3221[_0x3ed8('0x11')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x4d3221['blocked']){if(moment(_0x4d3221[_0x3ed8('0x1a')])[_0x3ed8('0x1b')](_0x20ae0d[_0x3ed8('0x19')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x4d3221[_0x3ed8('0x12')]=![];_0x4d3221[_0x3ed8('0x1a')]=null;}}_0x4d3221['resetPasswordToken']=_0x4a9b6d;_0x4d3221[_0x3ed8('0x36')]=Date[_0x3ed8('0x37')]()+0x36ee80;return _0x4d3221[_0x3ed8('0x38')]();})['then'](function(){return sendServiceMail({'to':_0xcdf35f['body'][_0x3ed8('0x26')],'subject':_0x3ed8('0x39'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x3ed8('0x3a')+_0x3ed8('0x3b')+_0xcdf35f[_0x3ed8('0x3c')][_0x3ed8('0x3d')]+_0x3ed8('0x3e')+_0x4a9b6d+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x3ed8('0x16')](function(){_0x1f827e[_0x3ed8('0x2b')](0xc8)[_0x3ed8('0x3f')]({'message':_0x3ed8('0x40')});})['catch'](function(_0x25267c){return handleError(_0x1f827e,0x1f4,_0x25267c);});};exports[_0x3ed8('0x41')]=function(_0x4e6105,_0x5c50c7){return db[_0x3ed8('0x42')][_0x3ed8('0x43')]({'where':{'resetPasswordToken':_0x4e6105['params']['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x3ed8('0x16')](function(_0x50fc58){if(!_0x50fc58){throw new Error(_0x3ed8('0x44'));}return db[_0x3ed8('0xa')][_0x3ed8('0xc')]({'attributes':['id',_0x3ed8('0x45'),'enforcePasswordHistory',_0x3ed8('0x46')]})['then'](function(_0x3d3816){if(_0x3d3816[_0x3ed8('0x45')])authService[_0x3ed8('0x47')](_0x4e6105['body']['password']);if(!_0x3d3816[_0x3ed8('0x48')]||!_0x50fc58[_0x3ed8('0x49')])return _0x50fc58;authService[_0x3ed8('0x4a')](_0x4e6105['body'][_0x3ed8('0xe')],_0x50fc58[_0x3ed8('0x49')],_0x3d3816[_0x3ed8('0x46')]);return _0x50fc58;})[_0x3ed8('0x16')](function(){_0x50fc58['password']=_0x4e6105['body'][_0x3ed8('0xe')];_0x50fc58[_0x3ed8('0x4b')]=null;_0x50fc58[_0x3ed8('0x36')]=null;return _0x50fc58[_0x3ed8('0x38')]();});})['then'](function(){_0x5c50c7[_0x3ed8('0x2b')](0xc8)['send']({'message':_0x3ed8('0x4c')});})[_0x3ed8('0x1f')](function(_0x127ece){return handleError(_0x5c50c7,0x1f4,_0x127ece);});};passport[_0x3ed8('0x4d')](_0x3ed8('0x4e'),new LocalStrategy({'usernameField':_0x3ed8('0xd'),'passwordField':_0x3ed8('0xe')},function(_0x2caafb,_0x3cb64d,_0x359f41){return localAuthenticate(db[_0x3ed8('0x42')],_0x2caafb,_0x3cb64d,_0x359f41);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 5772391..b9da123 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 _0xc7c7=['post','/forgot','forgot','reset','express','Router','./authLocal.controller'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc7c7,0xc8));var _0x7c7c=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0xc7c7[_0x6a0266];return _0x309e00;};'use strict';var express=require(_0x7c7c('0x0'));var router=express[_0x7c7c('0x1')]();var controller=require(_0x7c7c('0x2'));router[_0x7c7c('0x3')]('/',controller['login']);router['post'](_0x7c7c('0x4'),controller[_0x7c7c('0x5')]);router[_0x7c7c('0x3')]('/reset/:token',controller[_0x7c7c('0x6')]);module['exports']=router; \ No newline at end of file +var _0x4516=['/forgot','forgot','/reset/:token','reset','Router','./authLocal.controller','post','login'];(function(_0x456b77,_0x4fed12){var _0x118bb6=function(_0x2ea238){while(--_0x2ea238){_0x456b77['push'](_0x456b77['shift']());}};_0x118bb6(++_0x4fed12);}(_0x4516,0x9c));var _0x6451=function(_0x1c86dc,_0x231921){_0x1c86dc=_0x1c86dc-0x0;var _0x4bec54=_0x4516[_0x1c86dc];return _0x4bec54;};'use strict';var express=require('express');var router=express[_0x6451('0x0')]();var controller=require(_0x6451('0x1'));router[_0x6451('0x2')]('/',controller[_0x6451('0x3')]);router[_0x6451('0x2')](_0x6451('0x4'),controller[_0x6451('0x5')]);router[_0x6451('0x2')](_0x6451('0x6'),controller[_0x6451('0x7')]);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 a13879d..f1590fa 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 _0xd1f6=['INTEGER','STRING','BOOLEAN'];(function(_0x466e89,_0x237ae3){var _0x580986=function(_0x1ca46d){while(--_0x1ca46d){_0x466e89['push'](_0x466e89['shift']());}};_0x580986(++_0x237ae3);}(_0xd1f6,0xb2));var _0x6d1f=function(_0x5743ab,_0x2ef6e0){_0x5743ab=_0x5743ab-0x0;var _0x2ad0a8=_0xd1f6[_0x5743ab];return _0x2ad0a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6d1f('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0x6d1f('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x6d1f('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x6d1f('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x3c94=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3c94,0x164));var _0x43c9=function(_0x4a6362,_0x9e782a){_0x4a6362=_0x4a6362-0x0;var _0x2653a5=_0x3c94[_0x4a6362];return _0x2653a5;};'use strict';var Sequelize=require('sequelize');module[_0x43c9('0x0')]={'name':{'type':Sequelize[_0x43c9('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x43c9('0x1')]},'description':{'type':Sequelize[_0x43c9('0x1')]},'status':{'type':Sequelize[_0x43c9('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x43c9('0x3')],'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 e70d036..a74de5c 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 _0x792e=['fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','then','destroy','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','include','findAll','rows','catch','params','includeAll','merge','options','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','filter','Action','addActions','getActions','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x428820,_0x2e771b){var _0x4b7c95=function(_0x9859a5){while(--_0x9859a5){_0x428820['push'](_0x428820['shift']());}};_0x4b7c95(++_0x2e771b);}(_0x792e,0x1dc));var _0xe792=function(_0xde62ef,_0x4e65d8){_0xde62ef=_0xde62ef-0x0;var _0x37c24e=_0x792e[_0xde62ef];return _0x37c24e;};'use strict';var emlformat=require(_0xe792('0x0'));var rimraf=require(_0xe792('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe792('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe792('0x3'));var Mustache=require(_0xe792('0x4'));var util=require(_0xe792('0x5'));var path=require(_0xe792('0x6'));var sox=require(_0xe792('0x7'));var csv=require(_0xe792('0x8'));var ejs=require(_0xe792('0x9'));var fs=require('fs');var fs_extra=require(_0xe792('0xa'));var _=require(_0xe792('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe792('0xc'));var deskjs=require(_0xe792('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe792('0xe'));var authService=require(_0xe792('0xf'));var qs=require(_0xe792('0x10'));var as=require(_0xe792('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe792('0x12'));var utils=require(_0xe792('0x13'));var config=require(_0xe792('0x14'));var licenseUtil=require(_0xe792('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fb65f,_0x1a157b){_0x1a157b=_0x1a157b||0xcc;return function(_0xbcad2b){if(_0xbcad2b){return _0x1fb65f[_0xe792('0x16')](_0x1a157b);}return _0x1fb65f[_0xe792('0x17')](_0x1a157b)[_0xe792('0x18')]();};}function respondWithResult(_0x2698d4,_0x1ff26e){_0x1ff26e=_0x1ff26e||0xc8;return function(_0x546cd6){if(_0x546cd6){return _0x2698d4[_0xe792('0x17')](_0x1ff26e)[_0xe792('0x19')](_0x546cd6);}};}function respondWithFilteredResult(_0xe74ee1,_0x2c92dc){return function(_0x1b22c){if(_0x1b22c){var _0x35655a=typeof _0x2c92dc[_0xe792('0x1a')]===_0xe792('0x1b')&&typeof _0x2c92dc[_0xe792('0x1c')]===_0xe792('0x1b');var _0x373c8d=_0x1b22c[_0xe792('0x1d')];var _0x5c67c=_0x35655a?0x0:_0x2c92dc[_0xe792('0x1a')];var _0x1acad7=_0x35655a?_0x1b22c['count']:_0x2c92dc[_0xe792('0x1a')]+_0x2c92dc[_0xe792('0x1c')];var _0x2b1dce;if(_0x1acad7>=_0x373c8d){_0x1acad7=_0x373c8d;_0x2b1dce=0xc8;}else{_0x2b1dce=0xce;}_0xe74ee1[_0xe792('0x17')](_0x2b1dce);return _0xe74ee1['set'](_0xe792('0x1e'),_0x5c67c+'-'+_0x1acad7+'/'+_0x373c8d)[_0xe792('0x19')](_0x1b22c);}return null;};}function patchUpdates(_0x3727b1){return function(_0x533a8d){try{jsonpatch['apply'](_0x533a8d,_0x3727b1,!![]);}catch(_0x43bebd){return BPromise['reject'](_0x43bebd);}return _0x533a8d[_0xe792('0x1f')]();};}function saveUpdates(_0x5efaeb,_0x4270c7){return function(_0x3dc652){if(_0x3dc652){return _0x3dc652['update'](_0x5efaeb)[_0xe792('0x20')](function(_0xa40533){return _0xa40533;});}return null;};}function removeEntity(_0x2aede1,_0xeebc0e){return function(_0x4066c7){if(_0x4066c7){return _0x4066c7[_0xe792('0x21')]()[_0xe792('0x20')](function(){_0x2aede1[_0xe792('0x17')](0xcc)[_0xe792('0x18')]();});}};}function handleEntityNotFound(_0x4393f3,_0x489ed0){return function(_0x31251f){if(!_0x31251f){_0x4393f3[_0xe792('0x16')](0x194);}return _0x31251f;};}function handleError(_0x240fe7,_0x28bd34){_0x28bd34=_0x28bd34||0x1f4;return function(_0x1877ff){logger[_0xe792('0x22')](_0x1877ff[_0xe792('0x23')]);if(_0x1877ff[_0xe792('0x24')]){delete _0x1877ff['name'];}_0x240fe7['status'](_0x28bd34)[_0xe792('0x25')](_0x1877ff);};}exports[_0xe792('0x26')]=function(_0x1782d6,_0x31409c){var _0x344a61={},_0x5be9d3={},_0x27af07={'count':0x0,'rows':[]};var _0x1a6fbf=_[_0xe792('0x27')](db[_0xe792('0x28')][_0xe792('0x29')],function(_0x2c1d3c){return{'name':_0x2c1d3c[_0xe792('0x2a')],'type':_0x2c1d3c[_0xe792('0x2b')][_0xe792('0x2c')]};});_0x5be9d3[_0xe792('0x2d')]=_[_0xe792('0x27')](_0x1a6fbf,_0xe792('0x24'));_0x5be9d3['query']=_[_0xe792('0x2e')](_0x1782d6[_0xe792('0x2f')]);_0x5be9d3[_0xe792('0x30')]=_[_0xe792('0x31')](_0x5be9d3[_0xe792('0x2d')],_0x5be9d3[_0xe792('0x2f')]);_0x344a61['attributes']=_[_0xe792('0x31')](_0x5be9d3[_0xe792('0x2d')],qs[_0xe792('0x32')](_0x1782d6[_0xe792('0x2f')][_0xe792('0x32')]));_0x344a61[_0xe792('0x33')]=_0x344a61[_0xe792('0x33')][_0xe792('0x34')]?_0x344a61[_0xe792('0x33')]:_0x5be9d3['model'];if(!_0x1782d6[_0xe792('0x2f')][_0xe792('0x35')](_0xe792('0x36'))){_0x344a61['limit']=qs[_0xe792('0x1c')](_0x1782d6[_0xe792('0x2f')][_0xe792('0x1c')]);_0x344a61[_0xe792('0x1a')]=qs[_0xe792('0x1a')](_0x1782d6[_0xe792('0x2f')][_0xe792('0x1a')]);}_0x344a61[_0xe792('0x37')]=qs[_0xe792('0x38')](_0x1782d6[_0xe792('0x2f')][_0xe792('0x38')]);_0x344a61['where']=qs[_0xe792('0x30')](_[_0xe792('0x39')](_0x1782d6[_0xe792('0x2f')],_0x5be9d3['filters']),_0x1a6fbf);if(_0x1782d6[_0xe792('0x2f')]['filter']){_0x344a61[_0xe792('0x3a')]=_['merge'](_0x344a61['where'],{'$or':_[_0xe792('0x27')](_0x1a6fbf,function(_0x260a2e){if(_0x260a2e[_0xe792('0x2b')]!==_0xe792('0x3b')){var _0x3d4cbb={};_0x3d4cbb[_0x260a2e['name']]={'$like':'%'+_0x1782d6[_0xe792('0x2f')]['filter']+'%'};return _0x3d4cbb;}})});}_0x344a61=_['merge']({},_0x344a61,_0x1782d6['options']);var _0x2e43ec={'where':_0x344a61[_0xe792('0x3a')]};return db['Automation']['count'](_0x2e43ec)[_0xe792('0x20')](function(_0x3f54ee){_0x27af07['count']=_0x3f54ee;if(_0x1782d6[_0xe792('0x2f')]['includeAll']){_0x344a61[_0xe792('0x3c')]=[{'all':!![]}];}return db[_0xe792('0x28')][_0xe792('0x3d')](_0x344a61);})[_0xe792('0x20')](function(_0x593e7b){_0x27af07[_0xe792('0x3e')]=_0x593e7b;return _0x27af07;})[_0xe792('0x20')](respondWithFilteredResult(_0x31409c,_0x344a61))[_0xe792('0x3f')](handleError(_0x31409c,null));};exports['show']=function(_0x363332,_0x33c396){var _0x2b0261={'raw':![],'where':{'id':_0x363332[_0xe792('0x40')]['id']}},_0x1ef6db={};_0x1ef6db[_0xe792('0x2d')]=_[_0xe792('0x2e')](db['Automation']['rawAttributes']);_0x1ef6db[_0xe792('0x2f')]=_[_0xe792('0x2e')](_0x363332['query']);_0x1ef6db[_0xe792('0x30')]=_[_0xe792('0x31')](_0x1ef6db[_0xe792('0x2d')],_0x1ef6db[_0xe792('0x2f')]);_0x2b0261['attributes']=_[_0xe792('0x31')](_0x1ef6db[_0xe792('0x2d')],qs[_0xe792('0x32')](_0x363332[_0xe792('0x2f')][_0xe792('0x32')]));_0x2b0261[_0xe792('0x33')]=_0x2b0261[_0xe792('0x33')][_0xe792('0x34')]?_0x2b0261[_0xe792('0x33')]:_0x1ef6db[_0xe792('0x2d')];if(_0x363332[_0xe792('0x2f')][_0xe792('0x41')]){_0x2b0261[_0xe792('0x3c')]=[{'all':!![]}];}_0x2b0261=_[_0xe792('0x42')]({},_0x2b0261,_0x363332[_0xe792('0x43')]);return db[_0xe792('0x28')][_0xe792('0x44')](_0x2b0261)[_0xe792('0x20')](handleEntityNotFound(_0x33c396,null))[_0xe792('0x20')](respondWithResult(_0x33c396,null))[_0xe792('0x3f')](handleError(_0x33c396,null));};exports['create']=function(_0x39a289,_0x3e6713){return db['Automation'][_0xe792('0x45')](_0x39a289[_0xe792('0x46')],{})[_0xe792('0x20')](respondWithResult(_0x3e6713,0xc9))[_0xe792('0x3f')](handleError(_0x3e6713,null));};exports['update']=function(_0x12cbd8,_0x3cc9ac){if(_0x12cbd8[_0xe792('0x46')]['id']){delete _0x12cbd8[_0xe792('0x46')]['id'];}return db['Automation'][_0xe792('0x44')]({'where':{'id':_0x12cbd8[_0xe792('0x40')]['id']}})[_0xe792('0x20')](handleEntityNotFound(_0x3cc9ac,null))[_0xe792('0x20')](saveUpdates(_0x12cbd8['body'],null))[_0xe792('0x20')](respondWithResult(_0x3cc9ac,null))[_0xe792('0x3f')](handleError(_0x3cc9ac,null));};exports['destroy']=function(_0x475aa1,_0xdce4f5){return db[_0xe792('0x28')][_0xe792('0x44')]({'where':{'id':_0x475aa1[_0xe792('0x40')]['id']}})[_0xe792('0x20')](handleEntityNotFound(_0xdce4f5,null))[_0xe792('0x20')](removeEntity(_0xdce4f5,null))[_0xe792('0x3f')](handleError(_0xdce4f5,null));};exports[_0xe792('0x47')]=function(_0x5761f5,_0x3f03e5,_0x3cd732){return db[_0xe792('0x48')][_0xe792('0x44')]({'where':{'id':_0x5761f5[_0xe792('0x40')]['id']}})[_0xe792('0x20')](handleEntityNotFound(_0x3f03e5,null))[_0xe792('0x20')](function(_0x256732){if(_0x256732){return _0x256732[_0xe792('0x47')](_0x5761f5['body'][_0xe792('0x49')],_[_0xe792('0x4a')](_0x5761f5[_0xe792('0x46')],[_0xe792('0x49'),'id'])||{});}})['then'](respondWithResult(_0x3f03e5,null))[_0xe792('0x3f')](handleError(_0x3f03e5,null));};exports[_0xe792('0x4b')]=function(_0x2979c1,_0x4b7ba7,_0x29cc1c){var _0x4271c0={};var _0x64a11={};var _0x32d134;var _0x394319;return db[_0xe792('0x28')][_0xe792('0x4c')]({'where':{'id':_0x2979c1[_0xe792('0x40')]['id']}})[_0xe792('0x20')](handleEntityNotFound(_0x4b7ba7,null))[_0xe792('0x20')](function(_0x21f9d5){if(_0x21f9d5){_0x32d134=_0x21f9d5;_0x64a11['model']=_[_0xe792('0x2e')](db[_0xe792('0x48')]['rawAttributes']);_0x64a11[_0xe792('0x2f')]=_[_0xe792('0x2e')](_0x2979c1['query']);_0x64a11['filters']=_[_0xe792('0x31')](_0x64a11['model'],_0x64a11[_0xe792('0x2f')]);_0x4271c0[_0xe792('0x33')]=_[_0xe792('0x31')](_0x64a11['model'],qs[_0xe792('0x32')](_0x2979c1[_0xe792('0x2f')][_0xe792('0x32')]));_0x4271c0['attributes']=_0x4271c0[_0xe792('0x33')][_0xe792('0x34')]?_0x4271c0[_0xe792('0x33')]:_0x64a11[_0xe792('0x2d')];_0x4271c0[_0xe792('0x37')]=qs['sort'](_0x2979c1[_0xe792('0x2f')]['sort']);_0x4271c0['where']=qs[_0xe792('0x30')](_[_0xe792('0x39')](_0x2979c1[_0xe792('0x2f')],_0x64a11[_0xe792('0x30')]));if(_0x2979c1[_0xe792('0x2f')][_0xe792('0x4d')]){_0x4271c0['where']=_['merge'](_0x4271c0[_0xe792('0x3a')],{'$or':_[_0xe792('0x27')](_0x4271c0['attributes'],function(_0x2cfa94){var _0x36c7a4={};_0x36c7a4[_0x2cfa94]={'$like':'%'+_0x2979c1[_0xe792('0x2f')]['filter']+'%'};return _0x36c7a4;})});}_0x4271c0=_[_0xe792('0x42')]({},_0x4271c0,_0x2979c1['options']);return _0x32d134['getConditions'](_0x4271c0);}})[_0xe792('0x20')](function(_0x5f55b0){if(_0x5f55b0){_0x394319=_0x5f55b0['length'];if(!_0x2979c1[_0xe792('0x2f')][_0xe792('0x35')](_0xe792('0x36'))){_0x4271c0[_0xe792('0x1c')]=qs[_0xe792('0x1c')](_0x2979c1[_0xe792('0x2f')][_0xe792('0x1c')]);_0x4271c0['offset']=qs[_0xe792('0x1a')](_0x2979c1[_0xe792('0x2f')]['offset']);}return _0x32d134[_0xe792('0x4b')](_0x4271c0);}})['then'](function(_0x4f426e){if(_0x4f426e){return _0x4f426e?{'count':_0x394319,'rows':_0x4f426e}:null;}})[_0xe792('0x20')](respondWithResult(_0x4b7ba7,null))[_0xe792('0x3f')](handleError(_0x4b7ba7,null));};exports['addActions']=function(_0x2cda32,_0x467fdf,_0x340ce3){return db[_0xe792('0x4e')][_0xe792('0x44')]({'where':{'id':_0x2cda32[_0xe792('0x40')]['id']}})[_0xe792('0x20')](handleEntityNotFound(_0x467fdf,null))[_0xe792('0x20')](function(_0x2105e7){if(_0x2105e7){return _0x2105e7[_0xe792('0x4f')](_0x2cda32[_0xe792('0x46')][_0xe792('0x49')],_[_0xe792('0x4a')](_0x2cda32[_0xe792('0x46')],[_0xe792('0x49'),'id'])||{});}})[_0xe792('0x20')](respondWithResult(_0x467fdf,null))[_0xe792('0x3f')](handleError(_0x467fdf,null));};exports[_0xe792('0x50')]=function(_0xcc7258,_0xdbb21f,_0xa80071){var _0x314216={};var _0x598d3d={};var _0x22a153;var _0x1cd0bc;return db[_0xe792('0x28')]['findOne']({'where':{'id':_0xcc7258['params']['id']}})['then'](handleEntityNotFound(_0xdbb21f,null))[_0xe792('0x20')](function(_0x4f677a){if(_0x4f677a){_0x22a153=_0x4f677a;_0x598d3d[_0xe792('0x2d')]=_[_0xe792('0x2e')](db[_0xe792('0x4e')][_0xe792('0x29')]);_0x598d3d[_0xe792('0x2f')]=_[_0xe792('0x2e')](_0xcc7258['query']);_0x598d3d[_0xe792('0x30')]=_[_0xe792('0x31')](_0x598d3d[_0xe792('0x2d')],_0x598d3d[_0xe792('0x2f')]);_0x314216[_0xe792('0x33')]=_[_0xe792('0x31')](_0x598d3d['model'],qs['fields'](_0xcc7258[_0xe792('0x2f')][_0xe792('0x32')]));_0x314216[_0xe792('0x33')]=_0x314216['attributes']['length']?_0x314216[_0xe792('0x33')]:_0x598d3d[_0xe792('0x2d')];_0x314216['order']=qs['sort'](_0xcc7258[_0xe792('0x2f')]['sort']);_0x314216[_0xe792('0x3a')]=qs[_0xe792('0x30')](_['pick'](_0xcc7258[_0xe792('0x2f')],_0x598d3d['filters']));if(_0xcc7258[_0xe792('0x2f')][_0xe792('0x4d')]){_0x314216[_0xe792('0x3a')]=_[_0xe792('0x42')](_0x314216[_0xe792('0x3a')],{'$or':_[_0xe792('0x27')](_0x314216['attributes'],function(_0x46a086){var _0x3cbb45={};_0x3cbb45[_0x46a086]={'$like':'%'+_0xcc7258[_0xe792('0x2f')][_0xe792('0x4d')]+'%'};return _0x3cbb45;})});}_0x314216=_[_0xe792('0x42')]({},_0x314216,_0xcc7258[_0xe792('0x43')]);return _0x22a153[_0xe792('0x50')](_0x314216);}})[_0xe792('0x20')](function(_0x36ed69){if(_0x36ed69){_0x1cd0bc=_0x36ed69[_0xe792('0x34')];if(!_0xcc7258[_0xe792('0x2f')][_0xe792('0x35')](_0xe792('0x36'))){_0x314216[_0xe792('0x1c')]=qs[_0xe792('0x1c')](_0xcc7258[_0xe792('0x2f')][_0xe792('0x1c')]);_0x314216[_0xe792('0x1a')]=qs[_0xe792('0x1a')](_0xcc7258[_0xe792('0x2f')][_0xe792('0x1a')]);}return _0x22a153[_0xe792('0x50')](_0x314216);}})[_0xe792('0x20')](function(_0x10307b){if(_0x10307b){return _0x10307b?{'count':_0x1cd0bc,'rows':_0x10307b}:null;}})['then'](respondWithResult(_0xdbb21f,null))[_0xe792('0x3f')](handleError(_0xdbb21f,null));}; \ No newline at end of file +var _0x9590=['filter','merge','VIRTUAL','options','Automation','includeAll','include','findAll','rows','catch','show','create','body','find','params','addConditions','Condition','ids','omit','getConditions','findOne','hasOwnProperty','addActions','Action','getActions','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0xc940bf,_0x4a378f){var _0x36e7f2=function(_0x2533c5){while(--_0x2533c5){_0xc940bf['push'](_0xc940bf['shift']());}};_0x36e7f2(++_0x4a378f);}(_0x9590,0xc1));var _0x0959=function(_0x2fc5db,_0x2253b1){_0x2fc5db=_0x2fc5db-0x0;var _0x1ef11b=_0x9590[_0x2fc5db];return _0x1ef11b;};'use strict';var emlformat=require(_0x0959('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0959('0x1'));var rp=require(_0x0959('0x2'));var moment=require(_0x0959('0x3'));var BPromise=require(_0x0959('0x4'));var Mustache=require(_0x0959('0x5'));var util=require(_0x0959('0x6'));var path=require(_0x0959('0x7'));var sox=require('sox');var csv=require(_0x0959('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0959('0x9'));var _=require(_0x0959('0xa'));var squel=require(_0x0959('0xb'));var crypto=require('crypto');var jsforce=require(_0x0959('0xc'));var deskjs=require(_0x0959('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0959('0xe'));var Redis=require(_0x0959('0xf'));var authService=require(_0x0959('0x10'));var qs=require(_0x0959('0x11'));var as=require(_0x0959('0x12'));var hardwareService=require(_0x0959('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x0959('0x14'));var config=require(_0x0959('0x15'));var licenseUtil=require(_0x0959('0x16'));var db=require(_0x0959('0x17'))['db'];function respondWithStatusCode(_0xcaeed6,_0x40cb39){_0x40cb39=_0x40cb39||0xcc;return function(_0x500a32){if(_0x500a32){return _0xcaeed6[_0x0959('0x18')](_0x40cb39);}return _0xcaeed6[_0x0959('0x19')](_0x40cb39)[_0x0959('0x1a')]();};}function respondWithResult(_0x4394e4,_0x283079){_0x283079=_0x283079||0xc8;return function(_0x53a68e){if(_0x53a68e){return _0x4394e4['status'](_0x283079)[_0x0959('0x1b')](_0x53a68e);}};}function respondWithFilteredResult(_0x228117,_0x380d70){return function(_0x5e224d){if(_0x5e224d){var _0x266925=typeof _0x380d70[_0x0959('0x1c')]==='undefined'&&typeof _0x380d70['limit']===_0x0959('0x1d');var _0x23c8bf=_0x5e224d['count'];var _0x54aab8=_0x266925?0x0:_0x380d70[_0x0959('0x1c')];var _0x3804e6=_0x266925?_0x5e224d[_0x0959('0x1e')]:_0x380d70[_0x0959('0x1c')]+_0x380d70[_0x0959('0x1f')];var _0x3c230b;if(_0x3804e6>=_0x23c8bf){_0x3804e6=_0x23c8bf;_0x3c230b=0xc8;}else{_0x3c230b=0xce;}_0x228117['status'](_0x3c230b);return _0x228117['set'](_0x0959('0x20'),_0x54aab8+'-'+_0x3804e6+'/'+_0x23c8bf)[_0x0959('0x1b')](_0x5e224d);}return null;};}function patchUpdates(_0x27a7db){return function(_0x244088){try{jsonpatch[_0x0959('0x21')](_0x244088,_0x27a7db,!![]);}catch(_0xb341fd){return BPromise[_0x0959('0x22')](_0xb341fd);}return _0x244088['save']();};}function saveUpdates(_0x3c49c9,_0x276a01){return function(_0x144b9b){if(_0x144b9b){return _0x144b9b[_0x0959('0x23')](_0x3c49c9)[_0x0959('0x24')](function(_0x531d89){return _0x531d89;});}return null;};}function removeEntity(_0x1fd9a8,_0x88952b){return function(_0x50fdc1){if(_0x50fdc1){return _0x50fdc1[_0x0959('0x25')]()[_0x0959('0x24')](function(){_0x1fd9a8[_0x0959('0x19')](0xcc)[_0x0959('0x1a')]();});}};}function handleEntityNotFound(_0x2680ff,_0x477955){return function(_0x37e754){if(!_0x37e754){_0x2680ff[_0x0959('0x18')](0x194);}return _0x37e754;};}function handleError(_0x3ed913,_0x47bab9){_0x47bab9=_0x47bab9||0x1f4;return function(_0x42b5e6){logger['error'](_0x42b5e6[_0x0959('0x26')]);if(_0x42b5e6[_0x0959('0x27')]){delete _0x42b5e6['name'];}_0x3ed913[_0x0959('0x19')](_0x47bab9)['send'](_0x42b5e6);};}exports[_0x0959('0x28')]=function(_0x40e88a,_0x4ccc50){var _0x34f752={},_0x1dd143={},_0x2c2404={'count':0x0,'rows':[]};var _0x5a0734=_[_0x0959('0x29')](db['Automation'][_0x0959('0x2a')],function(_0x1e72d2){return{'name':_0x1e72d2[_0x0959('0x2b')],'type':_0x1e72d2[_0x0959('0x2c')][_0x0959('0x2d')]};});_0x1dd143[_0x0959('0x2e')]=_[_0x0959('0x29')](_0x5a0734,_0x0959('0x27'));_0x1dd143['query']=_[_0x0959('0x2f')](_0x40e88a[_0x0959('0x30')]);_0x1dd143[_0x0959('0x31')]=_[_0x0959('0x32')](_0x1dd143[_0x0959('0x2e')],_0x1dd143['query']);_0x34f752[_0x0959('0x33')]=_[_0x0959('0x32')](_0x1dd143[_0x0959('0x2e')],qs[_0x0959('0x34')](_0x40e88a[_0x0959('0x30')]['fields']));_0x34f752[_0x0959('0x33')]=_0x34f752['attributes'][_0x0959('0x35')]?_0x34f752[_0x0959('0x33')]:_0x1dd143[_0x0959('0x2e')];if(!_0x40e88a['query']['hasOwnProperty'](_0x0959('0x36'))){_0x34f752[_0x0959('0x1f')]=qs[_0x0959('0x1f')](_0x40e88a[_0x0959('0x30')][_0x0959('0x1f')]);_0x34f752[_0x0959('0x1c')]=qs[_0x0959('0x1c')](_0x40e88a[_0x0959('0x30')][_0x0959('0x1c')]);}_0x34f752[_0x0959('0x37')]=qs[_0x0959('0x38')](_0x40e88a[_0x0959('0x30')][_0x0959('0x38')]);_0x34f752[_0x0959('0x39')]=qs[_0x0959('0x31')](_[_0x0959('0x3a')](_0x40e88a[_0x0959('0x30')],_0x1dd143['filters']),_0x5a0734);if(_0x40e88a[_0x0959('0x30')][_0x0959('0x3b')]){_0x34f752['where']=_[_0x0959('0x3c')](_0x34f752[_0x0959('0x39')],{'$or':_['map'](_0x5a0734,function(_0x23a9f9){if(_0x23a9f9[_0x0959('0x2c')]!==_0x0959('0x3d')){var _0x1c7cdd={};_0x1c7cdd[_0x23a9f9[_0x0959('0x27')]]={'$like':'%'+_0x40e88a[_0x0959('0x30')]['filter']+'%'};return _0x1c7cdd;}})});}_0x34f752=_['merge']({},_0x34f752,_0x40e88a[_0x0959('0x3e')]);var _0x15149c={'where':_0x34f752['where']};return db[_0x0959('0x3f')][_0x0959('0x1e')](_0x15149c)['then'](function(_0x4673aa){_0x2c2404[_0x0959('0x1e')]=_0x4673aa;if(_0x40e88a[_0x0959('0x30')][_0x0959('0x40')]){_0x34f752[_0x0959('0x41')]=[{'all':!![]}];}return db[_0x0959('0x3f')][_0x0959('0x42')](_0x34f752);})[_0x0959('0x24')](function(_0x2fa7ba){_0x2c2404[_0x0959('0x43')]=_0x2fa7ba;return _0x2c2404;})[_0x0959('0x24')](respondWithFilteredResult(_0x4ccc50,_0x34f752))[_0x0959('0x44')](handleError(_0x4ccc50,null));};exports[_0x0959('0x45')]=function(_0x8ff245,_0x2b4417){var _0x52ce60={'raw':![],'where':{'id':_0x8ff245['params']['id']}},_0x5e8814={};_0x5e8814['model']=_[_0x0959('0x2f')](db[_0x0959('0x3f')]['rawAttributes']);_0x5e8814['query']=_[_0x0959('0x2f')](_0x8ff245[_0x0959('0x30')]);_0x5e8814[_0x0959('0x31')]=_[_0x0959('0x32')](_0x5e8814[_0x0959('0x2e')],_0x5e8814['query']);_0x52ce60['attributes']=_[_0x0959('0x32')](_0x5e8814['model'],qs[_0x0959('0x34')](_0x8ff245[_0x0959('0x30')][_0x0959('0x34')]));_0x52ce60['attributes']=_0x52ce60[_0x0959('0x33')]['length']?_0x52ce60[_0x0959('0x33')]:_0x5e8814[_0x0959('0x2e')];if(_0x8ff245[_0x0959('0x30')][_0x0959('0x40')]){_0x52ce60[_0x0959('0x41')]=[{'all':!![]}];}_0x52ce60=_[_0x0959('0x3c')]({},_0x52ce60,_0x8ff245[_0x0959('0x3e')]);return db['Automation']['find'](_0x52ce60)[_0x0959('0x24')](handleEntityNotFound(_0x2b4417,null))[_0x0959('0x24')](respondWithResult(_0x2b4417,null))['catch'](handleError(_0x2b4417,null));};exports[_0x0959('0x46')]=function(_0x5f02a0,_0x15ec0f){return db['Automation'][_0x0959('0x46')](_0x5f02a0[_0x0959('0x47')],{})[_0x0959('0x24')](respondWithResult(_0x15ec0f,0xc9))['catch'](handleError(_0x15ec0f,null));};exports[_0x0959('0x23')]=function(_0x3993e0,_0x2db3c0){if(_0x3993e0[_0x0959('0x47')]['id']){delete _0x3993e0[_0x0959('0x47')]['id'];}return db[_0x0959('0x3f')][_0x0959('0x48')]({'where':{'id':_0x3993e0[_0x0959('0x49')]['id']}})[_0x0959('0x24')](handleEntityNotFound(_0x2db3c0,null))[_0x0959('0x24')](saveUpdates(_0x3993e0[_0x0959('0x47')],null))[_0x0959('0x24')](respondWithResult(_0x2db3c0,null))[_0x0959('0x44')](handleError(_0x2db3c0,null));};exports['destroy']=function(_0x6ca3f3,_0x1b6825){return db['Automation'][_0x0959('0x48')]({'where':{'id':_0x6ca3f3[_0x0959('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b6825,null))[_0x0959('0x24')](removeEntity(_0x1b6825,null))[_0x0959('0x44')](handleError(_0x1b6825,null));};exports[_0x0959('0x4a')]=function(_0x475f94,_0x9e9525,_0x4d6929){return db[_0x0959('0x4b')][_0x0959('0x48')]({'where':{'id':_0x475f94[_0x0959('0x49')]['id']}})[_0x0959('0x24')](handleEntityNotFound(_0x9e9525,null))[_0x0959('0x24')](function(_0x319e49){if(_0x319e49){return _0x319e49[_0x0959('0x4a')](_0x475f94[_0x0959('0x47')][_0x0959('0x4c')],_[_0x0959('0x4d')](_0x475f94['body'],[_0x0959('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x9e9525,null))[_0x0959('0x44')](handleError(_0x9e9525,null));};exports[_0x0959('0x4e')]=function(_0x42dedb,_0x325eac,_0x161ddf){var _0x1de582={};var _0x13d36c={};var _0xe22943;var _0x49c15a;return db[_0x0959('0x3f')][_0x0959('0x4f')]({'where':{'id':_0x42dedb[_0x0959('0x49')]['id']}})[_0x0959('0x24')](handleEntityNotFound(_0x325eac,null))['then'](function(_0x488402){if(_0x488402){_0xe22943=_0x488402;_0x13d36c[_0x0959('0x2e')]=_[_0x0959('0x2f')](db[_0x0959('0x4b')][_0x0959('0x2a')]);_0x13d36c['query']=_['keys'](_0x42dedb[_0x0959('0x30')]);_0x13d36c[_0x0959('0x31')]=_[_0x0959('0x32')](_0x13d36c['model'],_0x13d36c[_0x0959('0x30')]);_0x1de582[_0x0959('0x33')]=_['intersection'](_0x13d36c['model'],qs[_0x0959('0x34')](_0x42dedb['query']['fields']));_0x1de582[_0x0959('0x33')]=_0x1de582[_0x0959('0x33')][_0x0959('0x35')]?_0x1de582[_0x0959('0x33')]:_0x13d36c[_0x0959('0x2e')];_0x1de582['order']=qs[_0x0959('0x38')](_0x42dedb['query']['sort']);_0x1de582[_0x0959('0x39')]=qs[_0x0959('0x31')](_[_0x0959('0x3a')](_0x42dedb['query'],_0x13d36c[_0x0959('0x31')]));if(_0x42dedb['query']['filter']){_0x1de582['where']=_[_0x0959('0x3c')](_0x1de582[_0x0959('0x39')],{'$or':_[_0x0959('0x29')](_0x1de582[_0x0959('0x33')],function(_0x983c3a){var _0x39196c={};_0x39196c[_0x983c3a]={'$like':'%'+_0x42dedb['query'][_0x0959('0x3b')]+'%'};return _0x39196c;})});}_0x1de582=_[_0x0959('0x3c')]({},_0x1de582,_0x42dedb[_0x0959('0x3e')]);return _0xe22943[_0x0959('0x4e')](_0x1de582);}})['then'](function(_0x21df28){if(_0x21df28){_0x49c15a=_0x21df28['length'];if(!_0x42dedb['query'][_0x0959('0x50')](_0x0959('0x36'))){_0x1de582[_0x0959('0x1f')]=qs['limit'](_0x42dedb['query'][_0x0959('0x1f')]);_0x1de582[_0x0959('0x1c')]=qs[_0x0959('0x1c')](_0x42dedb['query']['offset']);}return _0xe22943[_0x0959('0x4e')](_0x1de582);}})[_0x0959('0x24')](function(_0x4df46f){if(_0x4df46f){return _0x4df46f?{'count':_0x49c15a,'rows':_0x4df46f}:null;}})[_0x0959('0x24')](respondWithResult(_0x325eac,null))[_0x0959('0x44')](handleError(_0x325eac,null));};exports[_0x0959('0x51')]=function(_0x17ebee,_0x4a319d,_0xd0135e){return db[_0x0959('0x52')]['find']({'where':{'id':_0x17ebee['params']['id']}})[_0x0959('0x24')](handleEntityNotFound(_0x4a319d,null))[_0x0959('0x24')](function(_0x2739e2){if(_0x2739e2){return _0x2739e2[_0x0959('0x51')](_0x17ebee['body'][_0x0959('0x4c')],_['omit'](_0x17ebee[_0x0959('0x47')],['ids','id'])||{});}})['then'](respondWithResult(_0x4a319d,null))[_0x0959('0x44')](handleError(_0x4a319d,null));};exports['getActions']=function(_0x37259d,_0x1e253f,_0x4cb69f){var _0x11ace9={};var _0x73c0ae={};var _0x3638bf;var _0x39e315;return db[_0x0959('0x3f')][_0x0959('0x4f')]({'where':{'id':_0x37259d[_0x0959('0x49')]['id']}})[_0x0959('0x24')](handleEntityNotFound(_0x1e253f,null))[_0x0959('0x24')](function(_0x24e0e3){if(_0x24e0e3){_0x3638bf=_0x24e0e3;_0x73c0ae['model']=_['keys'](db[_0x0959('0x52')]['rawAttributes']);_0x73c0ae[_0x0959('0x30')]=_[_0x0959('0x2f')](_0x37259d[_0x0959('0x30')]);_0x73c0ae[_0x0959('0x31')]=_[_0x0959('0x32')](_0x73c0ae['model'],_0x73c0ae[_0x0959('0x30')]);_0x11ace9['attributes']=_['intersection'](_0x73c0ae[_0x0959('0x2e')],qs['fields'](_0x37259d['query']['fields']));_0x11ace9[_0x0959('0x33')]=_0x11ace9[_0x0959('0x33')][_0x0959('0x35')]?_0x11ace9[_0x0959('0x33')]:_0x73c0ae[_0x0959('0x2e')];_0x11ace9[_0x0959('0x37')]=qs[_0x0959('0x38')](_0x37259d[_0x0959('0x30')]['sort']);_0x11ace9[_0x0959('0x39')]=qs[_0x0959('0x31')](_[_0x0959('0x3a')](_0x37259d[_0x0959('0x30')],_0x73c0ae[_0x0959('0x31')]));if(_0x37259d[_0x0959('0x30')][_0x0959('0x3b')]){_0x11ace9[_0x0959('0x39')]=_[_0x0959('0x3c')](_0x11ace9[_0x0959('0x39')],{'$or':_[_0x0959('0x29')](_0x11ace9[_0x0959('0x33')],function(_0x1cca4c){var _0xea139b={};_0xea139b[_0x1cca4c]={'$like':'%'+_0x37259d[_0x0959('0x30')]['filter']+'%'};return _0xea139b;})});}_0x11ace9=_[_0x0959('0x3c')]({},_0x11ace9,_0x37259d[_0x0959('0x3e')]);return _0x3638bf[_0x0959('0x53')](_0x11ace9);}})[_0x0959('0x24')](function(_0x32b0cf){if(_0x32b0cf){_0x39e315=_0x32b0cf['length'];if(!_0x37259d[_0x0959('0x30')][_0x0959('0x50')]('nolimit')){_0x11ace9[_0x0959('0x1f')]=qs[_0x0959('0x1f')](_0x37259d[_0x0959('0x30')][_0x0959('0x1f')]);_0x11ace9[_0x0959('0x1c')]=qs[_0x0959('0x1c')](_0x37259d[_0x0959('0x30')][_0x0959('0x1c')]);}return _0x3638bf[_0x0959('0x53')](_0x11ace9);}})[_0x0959('0x24')](function(_0x443cfe){if(_0x443cfe){return _0x443cfe?{'count':_0x39e315,'rows':_0x443cfe}:null;}})[_0x0959('0x24')](respondWithResult(_0x1e253f,null))[_0x0959('0x44')](handleError(_0x1e253f,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index e287b14..c4ff0e0 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 _0x4e26=['exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x3e7986,_0x4cc723){var _0x26935e=function(_0x59e8dc){while(--_0x59e8dc){_0x3e7986['push'](_0x3e7986['shift']());}};_0x26935e(++_0x4cc723);}(_0x4e26,0x15d));var _0x64e2=function(_0x47b57b,_0x391d3d){_0x47b57b=_0x47b57b-0x0;var _0x34d2af=_0x4e26[_0x47b57b];return _0x34d2af;};'use strict';var _=require(_0x64e2('0x0'));var util=require(_0x64e2('0x1'));var logger=require(_0x64e2('0x2'))(_0x64e2('0x3'));var moment=require(_0x64e2('0x4'));var BPromise=require(_0x64e2('0x5'));var rp=require(_0x64e2('0x6'));var fs=require('fs');var path=require(_0x64e2('0x7'));var rimraf=require(_0x64e2('0x8'));var config=require(_0x64e2('0x9'));var attributes=require(_0x64e2('0xa'));module[_0x64e2('0xb')]=function(_0x58d119,_0x3523e9){return _0x58d119[_0x64e2('0xc')](_0x64e2('0xd'),attributes,{'tableName':_0x64e2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0511=['rimraf','exports','define','Automation','tools_automations','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3d1827,_0x22e218){var _0x24f28c=function(_0x32665e){while(--_0x32665e){_0x3d1827['push'](_0x3d1827['shift']());}};_0x24f28c(++_0x22e218);}(_0x0511,0x12e));var _0x1051=function(_0x27d2bf,_0x27ec74){_0x27d2bf=_0x27d2bf-0x0;var _0x5498a=_0x0511[_0x27d2bf];return _0x5498a;};'use strict';var _=require('lodash');var util=require(_0x1051('0x0'));var logger=require(_0x1051('0x1'))('api');var moment=require(_0x1051('0x2'));var BPromise=require(_0x1051('0x3'));var rp=require(_0x1051('0x4'));var fs=require('fs');var path=require(_0x1051('0x5'));var rimraf=require(_0x1051('0x6'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0x1051('0x7')]=function(_0x2258fa,_0x54302d){return _0x2258fa[_0x1051('0x8')](_0x1051('0x9'),attributes,{'tableName':_0x1051('0xa'),'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 a6b15dc..9eed845 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 _0x7af9=['../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7af9,0x95));var _0x97af=function(_0x3e5e81,_0x2dbc63){_0x3e5e81=_0x3e5e81-0x0;var _0xf6a561=_0x7af9[_0x3e5e81];return _0xf6a561;};'use strict';var _=require(_0x97af('0x0'));var util=require('util');var moment=require(_0x97af('0x1'));var BPromise=require(_0x97af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97af('0x3'));var db=require(_0x97af('0x4'))['db'];var utils=require(_0x97af('0x5'));var logger=require(_0x97af('0x6'))(_0x97af('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x97af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x966c4e,_0x265d22,_0x70b4db){return new BPromise(function(_0x52835d,_0x2c2ee4){return client[_0x97af('0x9')](_0x966c4e,_0x70b4db)[_0x97af('0xa')](function(_0x4b866a){logger[_0x97af('0xb')]('Automation,\x20%s,\x20%s',_0x265d22,_0x97af('0xc'));logger[_0x97af('0xd')](_0x97af('0xe'),_0x265d22,_0x97af('0xc'),JSON[_0x97af('0xf')](_0x4b866a));if(_0x4b866a[_0x97af('0x10')]){if(_0x4b866a[_0x97af('0x10')][_0x97af('0x11')]===0x1f4){logger[_0x97af('0x10')](_0x97af('0x12'),_0x265d22,_0x4b866a[_0x97af('0x10')]['message']);return _0x2c2ee4(_0x4b866a[_0x97af('0x10')]['message']);}logger['error'](_0x97af('0x12'),_0x265d22,_0x4b866a[_0x97af('0x10')][_0x97af('0x13')]);return _0x52835d(_0x4b866a[_0x97af('0x10')][_0x97af('0x13')]);}else{logger[_0x97af('0xb')](_0x97af('0x12'),_0x265d22,'request\x20sent');_0x52835d(_0x4b866a[_0x97af('0x14')]['message']);}})[_0x97af('0x15')](function(_0x58d967){logger[_0x97af('0x10')]('Automation,\x20%s,\x20%s',_0x265d22,_0x58d967);_0x2c2ee4(_0x58d967);});});} \ No newline at end of file +var _0x4cf8=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result'];(function(_0x4e668d,_0x409130){var _0x476a12=function(_0x498501){while(--_0x498501){_0x4e668d['push'](_0x4e668d['shift']());}};_0x476a12(++_0x409130);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x5bf2b3,_0xfcd364){_0x5bf2b3=_0x5bf2b3-0x0;var _0x5e8a9b=_0x4cf8[_0x5bf2b3];return _0x5e8a9b;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var moment=require(_0x84cf('0x2'));var BPromise=require(_0x84cf('0x3'));var rs=require(_0x84cf('0x4'));var fs=require('fs');var Redis=require(_0x84cf('0x5'));var db=require(_0x84cf('0x6'))['db'];var utils=require(_0x84cf('0x7'));var logger=require(_0x84cf('0x8'))(_0x84cf('0x9'));var config=require(_0x84cf('0xa'));var jayson=require(_0x84cf('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x455345,_0x56c5cc,_0x15ba85){return new BPromise(function(_0x2c11b0,_0x51b84c){return client[_0x84cf('0xc')](_0x455345,_0x15ba85)[_0x84cf('0xd')](function(_0x489063){logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));logger[_0x84cf('0x11')]('Automation,\x20%s,\x20%s,\x20%s',_0x56c5cc,_0x84cf('0x10'),JSON[_0x84cf('0x12')](_0x489063));if(_0x489063['error']){if(_0x489063['error'][_0x84cf('0x13')]===0x1f4){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x51b84c(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x2c11b0(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}else{logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));_0x2c11b0(_0x489063[_0x84cf('0x16')][_0x84cf('0x15')]);}})[_0x84cf('0x17')](function(_0x5b8ac8){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x5b8ac8);_0x51b84c(_0x5b8ac8);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 11350cb..000a013 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 _0x6dd6=['isAuthenticated','show','/:id/conditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6dd6,0xcc));var _0x66dd=function(_0x5da107,_0x10357c){_0x5da107=_0x5da107-0x0;var _0x224f15=_0x6dd6[_0x5da107];return _0x224f15;};'use strict';var multer=require('multer');var util=require(_0x66dd('0x0'));var path=require(_0x66dd('0x1'));var timeout=require(_0x66dd('0x2'));var express=require(_0x66dd('0x3'));var router=express[_0x66dd('0x4')]();var fs_extra=require(_0x66dd('0x5'));var auth=require(_0x66dd('0x6'));var interaction=require(_0x66dd('0x7'));var config=require(_0x66dd('0x8'));var controller=require('./automation.controller');router[_0x66dd('0x9')]('/',auth['isAuthenticated'](),controller[_0x66dd('0xa')]);router['get'](_0x66dd('0xb'),auth[_0x66dd('0xc')](),controller[_0x66dd('0xd')]);router[_0x66dd('0x9')](_0x66dd('0xe'),auth['isAuthenticated'](),controller['getConditions']);router[_0x66dd('0x9')](_0x66dd('0xf'),auth[_0x66dd('0xc')](),controller[_0x66dd('0x10')]);router[_0x66dd('0x11')]('/',auth[_0x66dd('0xc')](),controller[_0x66dd('0x12')]);router[_0x66dd('0x11')](_0x66dd('0xe'),auth[_0x66dd('0xc')](),controller[_0x66dd('0x13')]);router[_0x66dd('0x11')](_0x66dd('0xf'),auth[_0x66dd('0xc')](),controller[_0x66dd('0x14')]);router[_0x66dd('0x15')](_0x66dd('0xb'),auth['isAuthenticated'](),controller[_0x66dd('0x16')]);router[_0x66dd('0x17')]('/:id',auth[_0x66dd('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x569b=['getConditions','getActions','post','addConditions','/:id/actions','addActions','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','/:id','show','/:id/conditions'];(function(_0x522371,_0x5d58e3){var _0x3d5379=function(_0x335317){while(--_0x335317){_0x522371['push'](_0x522371['shift']());}};_0x3d5379(++_0x5d58e3);}(_0x569b,0x173));var _0xb569=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x569b[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require(_0xb569('0x0'));var util=require(_0xb569('0x1'));var path=require('path');var timeout=require(_0xb569('0x2'));var express=require(_0xb569('0x3'));var router=express[_0xb569('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb569('0x5'));var interaction=require(_0xb569('0x6'));var config=require('../../config/environment');var controller=require(_0xb569('0x7'));router[_0xb569('0x8')]('/',auth[_0xb569('0x9')](),controller['index']);router[_0xb569('0x8')](_0xb569('0xa'),auth[_0xb569('0x9')](),controller[_0xb569('0xb')]);router['get'](_0xb569('0xc'),auth['isAuthenticated'](),controller[_0xb569('0xd')]);router[_0xb569('0x8')]('/:id/actions',auth['isAuthenticated'](),controller[_0xb569('0xe')]);router[_0xb569('0xf')]('/',auth[_0xb569('0x9')](),controller['create']);router['post']('/:id/conditions',auth[_0xb569('0x9')](),controller[_0xb569('0x10')]);router[_0xb569('0xf')](_0xb569('0x11'),auth[_0xb569('0x9')](),controller[_0xb569('0x12')]);router[_0xb569('0x13')]('/:id',auth[_0xb569('0x9')](),controller[_0xb569('0x14')]);router[_0xb569('0x15')](_0xb569('0xa'),auth['isAuthenticated'](),controller[_0xb569('0x16')]);module[_0xb569('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 84c926d..2d664b3 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 _0x15a1=['#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting'];(function(_0x449fb0,_0xf691a2){var _0x10bb91=function(_0x86e613){while(--_0x86e613){_0x449fb0['push'](_0x449fb0['shift']());}};_0x10bb91(++_0xf691a2);}(_0x15a1,0x183));var _0x115a=function(_0x21c82b,_0x122eef){_0x21c82b=_0x21c82b-0x0;var _0x555b90=_0x15a1[_0x21c82b];return _0x555b90;};'use strict';var Sequelize=require(_0x115a('0x0'));module[_0x115a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x115a('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x115a('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x115a('0x4')},'description':{'type':Sequelize[_0x115a('0x5')]},'active':{'type':Sequelize[_0x115a('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x115a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x115a('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x115a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x115a('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x115a('0x9')](0x3)[_0x115a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x115a('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x115a('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x115a('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x115a('0x9')](0x3)[_0x115a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x115a('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x115a('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x115a('0x7')],'defaultValue':0x3,'comment':_0x115a('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x115a('0x9')](0x5)[_0x115a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x115a('0x9')](0x3)[_0x115a('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x115a('0xe')},'dialTimezone':{'type':Sequelize[_0x115a('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x115a('0x5')],'defaultValue':_0x115a('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x115a('0x10'),'never',_0x115a('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x115a('0x6')],'defaultValue':0x0,'comment':_0x115a('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x115a('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x115a('0x9')](0x9)[_0x115a('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x115a('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x115a('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x115a('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x115a('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x115a('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x115a('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x115a('0x9')](0x9)[_0x115a('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x115a('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x115a('0x9')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x115a('0x9')](0x5)[_0x115a('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x115a('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x115a('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x115a('0x3')](_0x115a('0x19'),_0x115a('0x1a')),'defaultValue':_0x115a('0x19')},'dialPrefix':{'type':Sequelize[_0x115a('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x115a('0x9')](0x3)[_0x115a('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x115a('0x1b')},'dialCutDigit':{'type':Sequelize[_0x115a('0x9')](0x3)[_0x115a('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x115a('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x115a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x115a('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x115a('0x9')](0x5)[_0x115a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x115a('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x115a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x115a('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x115a('0x9')](0x5)[_0x115a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x115a('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x115a('0x9')](0x3)[_0x115a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x115a('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x115a('0x9')](0x5)[_0x115a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x115a('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x115a('0x9')](0x3)[_0x115a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x115a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x115a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x115a('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x115a('0x9')](0x5)[_0x115a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x115a('0x24')}}; \ No newline at end of file +var _0xa3e7=['Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','STRING','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)'];(function(_0x19f3de,_0x53186f){var _0x279190=function(_0x5ab0ee){while(--_0x5ab0ee){_0x19f3de['push'](_0x19f3de['shift']());}};_0x279190(++_0x53186f);}(_0xa3e7,0x8b));var _0x7a3e=function(_0x1649fe,_0x5916da){_0x1649fe=_0x1649fe-0x0;var _0x473a67=_0xa3e7[_0x1649fe];return _0x473a67;};'use strict';var Sequelize=require(_0x7a3e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x7a3e('0x1')](_0x7a3e('0x2')),'allowNull':![],'defaultValue':_0x7a3e('0x2')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x7a3e('0x3')],'defaultValue':0x0,'comment':_0x7a3e('0x4')},'limitCalls':{'type':Sequelize[_0x7a3e('0x5')](0x4)[_0x7a3e('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x7a3e('0x7')]},'dialOriginateTimeout':{'type':Sequelize[_0x7a3e('0x5')](0x3)[_0x7a3e('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7a3e('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x7a3e('0x5')](0x3)[_0x7a3e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7a3e('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x7a3e('0x5')](0x3)[_0x7a3e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7a3e('0xa')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7a3e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7a3e('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x7a3e('0x5')](0x3)[_0x7a3e('0x6')],'defaultValue':0x3,'comment':_0x7a3e('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7a3e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7a3e('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7a3e('0x5')](0x3)[_0x7a3e('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7a3e('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x7a3e('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x7a3e('0x10'),_0x7a3e('0x11'),_0x7a3e('0x12')),'defaultValue':_0x7a3e('0x10')},'dialAMDActive':{'type':Sequelize[_0x7a3e('0x3')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x7a3e('0x5')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x7a3e('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7a3e('0x5')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7a3e('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x7a3e('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x7a3e('0x5')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7a3e('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7a3e('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x7a3e('0x5')](0x9)[_0x7a3e('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x7a3e('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x7a3e('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7a3e('0x5')](0x9)[_0x7a3e('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7a3e('0x16')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x7a3e('0x17'),_0x7a3e('0x18')),'defaultValue':_0x7a3e('0x17')},'dialPrefix':{'type':Sequelize[_0x7a3e('0x7')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7a3e('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7a3e('0x19')},'dialCutDigit':{'type':Sequelize[_0x7a3e('0x5')](0x3)[_0x7a3e('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7a3e('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7a3e('0x5')](0x3)[_0x7a3e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7a3e('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7a3e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7a3e('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0x7a3e('0x5')](0x3)[_0x7a3e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7a3e('0x1d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7a3e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7a3e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7a3e('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7a3e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7a3e('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0x7a3e('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7a3e('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7a3e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7a3e('0x5')](0x5)[_0x7a3e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7a3e('0x21')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 5c18272..3051d7b 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 _0x5523=['sequelize','all','removeLists','getBlackLists','addBlackLists','omit','insert','cm_hopper_black','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','IvrCampaigns','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Campaign','include','findAll','rows','catch','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','includeAll','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','CmHopper','nolimit','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','ListId','select','phone','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','ContactId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','scheduledAt','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push'];(function(_0x152e48,_0x25f775){var _0x30b1a4=function(_0x5dcbf3){while(--_0x5dcbf3){_0x152e48['push'](_0x152e48['shift']());}};_0x30b1a4(++_0x25f775);}(_0x5523,0x137));var _0x3552=function(_0x3bf282,_0x329ee6){_0x3bf282=_0x3bf282-0x0;var _0x1e9be4=_0x5523[_0x3bf282];return _0x1e9be4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3552('0x0'));var jsonpatch=require(_0x3552('0x1'));var rp=require(_0x3552('0x2'));var moment=require(_0x3552('0x3'));var BPromise=require(_0x3552('0x4'));var Mustache=require(_0x3552('0x5'));var util=require(_0x3552('0x6'));var path=require(_0x3552('0x7'));var sox=require(_0x3552('0x8'));var csv=require(_0x3552('0x9'));var ejs=require(_0x3552('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3552('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3552('0xc'));var toCsv=require(_0x3552('0x9'));var querystring=require(_0x3552('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3552('0xe'));var qs=require(_0x3552('0xf'));var as=require(_0x3552('0x10'));var hardwareService=require(_0x3552('0x11'));var logger=require(_0x3552('0x12'))(_0x3552('0x13'));var utils=require(_0x3552('0x14'));var config=require(_0x3552('0x15'));var licenseUtil=require(_0x3552('0x16'));var db=require(_0x3552('0x17'))['db'];function respondWithStatusCode(_0xae728b,_0x549df0){_0x549df0=_0x549df0||0xcc;return function(_0x295d0d){if(_0x295d0d){return _0xae728b[_0x3552('0x18')](_0x549df0);}return _0xae728b[_0x3552('0x19')](_0x549df0)['end']();};}function respondWithResult(_0x538549,_0x123c8e){_0x123c8e=_0x123c8e||0xc8;return function(_0x3e90fc){if(_0x3e90fc){return _0x538549[_0x3552('0x19')](_0x123c8e)[_0x3552('0x1a')](_0x3e90fc);}};}function respondWithFilteredResult(_0x50813d,_0x3b9f0a){return function(_0x268d39){if(_0x268d39){var _0x31dd12=typeof _0x3b9f0a[_0x3552('0x1b')]==='undefined'&&typeof _0x3b9f0a[_0x3552('0x1c')]===_0x3552('0x1d');var _0xcc111c=_0x268d39['count'];var _0x2375c9=_0x31dd12?0x0:_0x3b9f0a[_0x3552('0x1b')];var _0x586e1f=_0x31dd12?_0x268d39[_0x3552('0x1e')]:_0x3b9f0a[_0x3552('0x1b')]+_0x3b9f0a[_0x3552('0x1c')];var _0x42fe33;if(_0x586e1f>=_0xcc111c){_0x586e1f=_0xcc111c;_0x42fe33=0xc8;}else{_0x42fe33=0xce;}_0x50813d['status'](_0x42fe33);return _0x50813d[_0x3552('0x1f')](_0x3552('0x20'),_0x2375c9+'-'+_0x586e1f+'/'+_0xcc111c)['json'](_0x268d39);}return null;};}function patchUpdates(_0x26984c){return function(_0x443bab){try{jsonpatch[_0x3552('0x21')](_0x443bab,_0x26984c,!![]);}catch(_0x404b40){return BPromise[_0x3552('0x22')](_0x404b40);}return _0x443bab['save']();};}function saveUpdates(_0x2fe62c,_0x4ea201){return function(_0x42a3d3){if(_0x42a3d3){return _0x42a3d3['update'](_0x2fe62c)[_0x3552('0x23')](function(_0x3ddfb3){return _0x3ddfb3;});}return null;};}function removeEntity(_0x5355e4,_0x1f80b5){return function(_0x534c68){if(_0x534c68){return _0x534c68[_0x3552('0x24')]()['then'](function(){var _0x1972b7=_0x534c68['get']({'plain':!![]});var _0x11c23f=_0x3552('0x25');return db[_0x3552('0x26')][_0x3552('0x24')]({'where':{'type':_0x11c23f,'resourceId':_0x1972b7['id']}})[_0x3552('0x23')](function(){return _0x534c68;});})[_0x3552('0x23')](function(){_0x5355e4[_0x3552('0x19')](0xcc)[_0x3552('0x27')]();});}};}function handleEntityNotFound(_0x5028e1,_0x5d93f6){return function(_0x7d75aa){if(!_0x7d75aa){_0x5028e1['sendStatus'](0x194);}return _0x7d75aa;};}function handleError(_0x29dc07,_0x43d239){_0x43d239=_0x43d239||0x1f4;return function(_0x914ffc){logger[_0x3552('0x28')](_0x914ffc[_0x3552('0x29')]);if(_0x914ffc['name']){delete _0x914ffc[_0x3552('0x2a')];}_0x29dc07[_0x3552('0x19')](_0x43d239)[_0x3552('0x2b')](_0x914ffc);};}exports[_0x3552('0x2c')]=function(_0x212185,_0x52220d){var _0x32b45f={},_0x144d92={},_0x4bbe07={'count':0x0,'rows':[]};var _0xa8952e=_['map'](db['Campaign'][_0x3552('0x2d')],function(_0xe41ad6){return{'name':_0xe41ad6[_0x3552('0x2e')],'type':_0xe41ad6[_0x3552('0x2f')][_0x3552('0x30')]};});_0x144d92[_0x3552('0x31')]=_[_0x3552('0x32')](_0xa8952e,_0x3552('0x2a'));_0x144d92['query']=_['keys'](_0x212185['query']);_0x144d92[_0x3552('0x33')]=_[_0x3552('0x34')](_0x144d92['model'],_0x144d92['query']);_0x32b45f[_0x3552('0x35')]=_[_0x3552('0x34')](_0x144d92[_0x3552('0x31')],qs[_0x3552('0x36')](_0x212185[_0x3552('0x37')][_0x3552('0x36')]));_0x32b45f[_0x3552('0x35')]=_0x32b45f['attributes'][_0x3552('0x38')]?_0x32b45f[_0x3552('0x35')]:_0x144d92[_0x3552('0x31')];if(!_0x212185[_0x3552('0x37')][_0x3552('0x39')]('nolimit')){_0x32b45f[_0x3552('0x1c')]=qs['limit'](_0x212185[_0x3552('0x37')]['limit']);_0x32b45f[_0x3552('0x1b')]=qs[_0x3552('0x1b')](_0x212185[_0x3552('0x37')][_0x3552('0x1b')]);}_0x32b45f[_0x3552('0x3a')]=qs[_0x3552('0x3b')](_0x212185[_0x3552('0x37')][_0x3552('0x3b')]);_0x32b45f[_0x3552('0x3c')]=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x212185[_0x3552('0x37')],_0x144d92['filters']),_0xa8952e);if(_0x212185[_0x3552('0x37')][_0x3552('0x3e')]){_0x32b45f[_0x3552('0x3c')]=_[_0x3552('0x3f')](_0x32b45f[_0x3552('0x3c')],{'$or':_['map'](_0xa8952e,function(_0x36d84b){if(_0x36d84b['type']!==_0x3552('0x40')){var _0x1e8d10={};_0x1e8d10[_0x36d84b['name']]={'$like':'%'+_0x212185[_0x3552('0x37')][_0x3552('0x3e')]+'%'};return _0x1e8d10;}})});}_0x32b45f=_[_0x3552('0x3f')]({},_0x32b45f,_0x212185[_0x3552('0x41')]);var _0xaab25d={'where':_0x32b45f[_0x3552('0x3c')]};return db[_0x3552('0x42')][_0x3552('0x1e')](_0xaab25d)[_0x3552('0x23')](function(_0x142da0){_0x4bbe07[_0x3552('0x1e')]=_0x142da0;if(_0x212185[_0x3552('0x37')]['includeAll']){_0x32b45f[_0x3552('0x43')]=[{'all':!![]}];}return db[_0x3552('0x42')][_0x3552('0x44')](_0x32b45f);})[_0x3552('0x23')](function(_0x45973b){_0x4bbe07[_0x3552('0x45')]=_0x45973b;return _0x4bbe07;})[_0x3552('0x23')](respondWithFilteredResult(_0x52220d,_0x32b45f))[_0x3552('0x46')](handleError(_0x52220d,null));};exports['show']=function(_0x1631d0,_0x3e9921){var _0x200fe8={'raw':![],'where':{'id':_0x1631d0[_0x3552('0x47')]['id']}},_0x38290f={};_0x38290f[_0x3552('0x31')]=_[_0x3552('0x48')](db['Campaign'][_0x3552('0x2d')]);_0x38290f[_0x3552('0x37')]=_[_0x3552('0x48')](_0x1631d0[_0x3552('0x37')]);_0x38290f[_0x3552('0x33')]=_[_0x3552('0x34')](_0x38290f[_0x3552('0x31')],_0x38290f[_0x3552('0x37')]);_0x200fe8['attributes']=_[_0x3552('0x34')](_0x38290f[_0x3552('0x31')],qs[_0x3552('0x36')](_0x1631d0[_0x3552('0x37')][_0x3552('0x36')]));_0x200fe8[_0x3552('0x35')]=_0x200fe8[_0x3552('0x35')][_0x3552('0x38')]?_0x200fe8[_0x3552('0x35')]:_0x38290f['model'];if(_0x1631d0[_0x3552('0x37')]['includeAll']){_0x200fe8[_0x3552('0x43')]=[{'all':!![]}];}_0x200fe8=_[_0x3552('0x3f')]({},_0x200fe8,_0x1631d0['options']);return db['Campaign'][_0x3552('0x49')](_0x200fe8)[_0x3552('0x23')](handleEntityNotFound(_0x3e9921,null))['then'](respondWithResult(_0x3e9921,null))[_0x3552('0x46')](handleError(_0x3e9921,null));};exports[_0x3552('0x4a')]=function(_0x68222b,_0x71ca89){return db[_0x3552('0x42')]['create'](_0x68222b[_0x3552('0x4b')],{})[_0x3552('0x23')](function(_0x40c412){var _0x4eff7a=_0x68222b[_0x3552('0x4c')][_0x3552('0x4d')]({'plain':!![]});if(!_0x4eff7a)throw new Error(_0x3552('0x4e'));if(_0x4eff7a[_0x3552('0x4f')]===_0x3552('0x4c')){var _0x2f94e4=_0x40c412[_0x3552('0x4d')]({'plain':!![]});var _0x3b78b8=_0x3552('0x25');return db[_0x3552('0x50')][_0x3552('0x49')]({'where':{'name':_0x3b78b8,'userProfileId':_0x4eff7a[_0x3552('0x51')]},'raw':!![]})['then'](function(_0x1bfc84){if(_0x1bfc84&&_0x1bfc84[_0x3552('0x52')]===0x0){return db[_0x3552('0x26')][_0x3552('0x4a')]({'name':_0x2f94e4[_0x3552('0x2a')],'resourceId':_0x2f94e4['id'],'type':_0x1bfc84['name'],'sectionId':_0x1bfc84['id']},{})['then'](function(){return _0x40c412;});}else{return _0x40c412;}})[_0x3552('0x46')](function(_0x42c63d){logger[_0x3552('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42c63d);throw _0x42c63d;});}return _0x40c412;})['then'](respondWithResult(_0x71ca89,0xc9))['catch'](handleError(_0x71ca89,null));};exports[_0x3552('0x53')]=function(_0x4ad6e5,_0x5daef7){var _0xc7d21e={'where':{'id':_0x4ad6e5[_0x3552('0x47')]['id']}},_0x2e43eb={};_0x2e43eb[_0x3552('0x31')]=_['keys'](db[_0x3552('0x42')][_0x3552('0x2d')]);_0xc7d21e[_0x3552('0x35')]=_[_0x3552('0x34')](_0x2e43eb[_0x3552('0x31')],qs[_0x3552('0x36')](_0x4ad6e5['query'][_0x3552('0x36')]));_0xc7d21e[_0x3552('0x35')]=_0xc7d21e[_0x3552('0x35')][_0x3552('0x38')]?_0xc7d21e['attributes']:_0x2e43eb[_0x3552('0x31')];if(_0x4ad6e5[_0x3552('0x37')][_0x3552('0x54')]){_0xc7d21e[_0x3552('0x43')]=[{'all':!![]}];}_0xc7d21e=_[_0x3552('0x3f')]({},_0xc7d21e,_0x4ad6e5[_0x3552('0x41')]);return db['Campaign'][_0x3552('0x49')](_0xc7d21e)['then'](handleEntityNotFound(_0x5daef7,null))['then'](function(_0x2a7d99){if(_0x2a7d99){var _0x306e98=_0x2a7d99[_0x3552('0x4d')]({'plain':!![]});_0x306e98=qs['omit'](_0x306e98,['id','createdAt','updatedAt']);_0x4ad6e5['body']=_['omit'](_0x4ad6e5[_0x3552('0x4b')],['id',_0x3552('0x55'),_0x3552('0x56')]);return db[_0x3552('0x42')][_0x3552('0x4a')](_[_0x3552('0x3f')](_0x306e98,_0x4ad6e5['body']),{'include':_0x4ad6e5['query']['includeAll']?[{'all':!![]}]:undefined})[_0x3552('0x23')](function(_0x318e4c){var _0x4a40a3=_0x4ad6e5['user'][_0x3552('0x4d')]({'plain':!![]});if(!_0x4a40a3)throw new Error(_0x3552('0x4e'));if(_0x4a40a3['role']==='user'){var _0x1039b0=_0x318e4c[_0x3552('0x4d')]({'plain':!![]});var _0x28e503='IvrCampaigns';return db[_0x3552('0x50')][_0x3552('0x49')]({'where':{'name':_0x28e503,'userProfileId':_0x4a40a3['userProfileId']},'raw':!![]})['then'](function(_0x5e1181){if(_0x5e1181&&_0x5e1181['autoAssociation']===0x0){return db[_0x3552('0x26')][_0x3552('0x4a')]({'name':_0x1039b0[_0x3552('0x2a')],'resourceId':_0x1039b0['id'],'type':_0x5e1181[_0x3552('0x2a')],'sectionId':_0x5e1181['id']},{})[_0x3552('0x23')](function(){return _0x318e4c;});}else{return _0x318e4c;}})['catch'](function(_0x4eaaa8){logger['error'](_0x3552('0x57'),_0x4eaaa8);throw _0x4eaaa8;});}return _0x318e4c;});}})['then'](respondWithResult(_0x5daef7,0xc9))[_0x3552('0x46')](handleError(_0x5daef7,null));};exports[_0x3552('0x58')]=function(_0x8a4545,_0x4bf9ff){if(_0x8a4545[_0x3552('0x4b')]['id']){delete _0x8a4545[_0x3552('0x4b')]['id'];}return db[_0x3552('0x42')]['find']({'where':{'id':_0x8a4545[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x4bf9ff,null))[_0x3552('0x23')](saveUpdates(_0x8a4545['body'],null))[_0x3552('0x23')](respondWithResult(_0x4bf9ff,null))['catch'](handleError(_0x4bf9ff,null));};exports[_0x3552('0x24')]=function(_0x4e37d0,_0x571322){return db[_0x3552('0x42')]['find']({'where':{'id':_0x4e37d0['params']['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x571322,null))[_0x3552('0x23')](removeEntity(_0x571322,null))[_0x3552('0x46')](handleError(_0x571322,null));};exports[_0x3552('0x59')]=function(_0x763317,_0x1da9c0,_0x1d345c){var _0x4702bc={'raw':!![],'where':{}};var _0x27aa33={};var _0x1eacba={'count':0x0,'rows':[]};return db[_0x3552('0x42')][_0x3552('0x5a')]({'where':{'id':_0x763317['params']['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x1da9c0,null))[_0x3552('0x23')](function(_0x185a1a){if(_0x185a1a){_0x27aa33[_0x3552('0x31')]=_[_0x3552('0x48')](db[_0x3552('0x5b')]['rawAttributes']);_0x27aa33['query']=_[_0x3552('0x48')](_0x763317[_0x3552('0x37')]);_0x27aa33[_0x3552('0x33')]=_[_0x3552('0x34')](_0x27aa33[_0x3552('0x31')],_0x27aa33['query']);_0x4702bc[_0x3552('0x35')]=_[_0x3552('0x34')](_0x27aa33[_0x3552('0x31')],qs[_0x3552('0x36')](_0x763317[_0x3552('0x37')][_0x3552('0x36')]));_0x4702bc[_0x3552('0x35')]=_0x4702bc[_0x3552('0x35')][_0x3552('0x38')]?_0x4702bc[_0x3552('0x35')]:_0x27aa33[_0x3552('0x31')];if(!_0x763317[_0x3552('0x37')]['hasOwnProperty'](_0x3552('0x5c'))){_0x4702bc[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x763317[_0x3552('0x37')]['limit']);_0x4702bc[_0x3552('0x1b')]=qs['offset'](_0x763317[_0x3552('0x37')][_0x3552('0x1b')]);}_0x4702bc['order']=qs['sort'](_0x763317[_0x3552('0x37')][_0x3552('0x3b')]);_0x4702bc[_0x3552('0x3c')]=qs['filters'](_['pick'](_0x763317[_0x3552('0x37')],_0x27aa33[_0x3552('0x33')]));_0x4702bc[_0x3552('0x3c')][_0x3552('0x5d')]=_0x185a1a['id'];if(_0x763317[_0x3552('0x37')]['filter']){_0x4702bc[_0x3552('0x3c')]=_[_0x3552('0x3f')](_0x4702bc[_0x3552('0x3c')],{'$or':_[_0x3552('0x32')](_0x4702bc[_0x3552('0x35')],function(_0x17d06f){var _0x49f6ba={};_0x49f6ba[_0x17d06f]={'$like':'%'+_0x763317[_0x3552('0x37')]['filter']+'%'};return _0x49f6ba;})});}_0x4702bc=_[_0x3552('0x3f')]({},_0x4702bc,_0x763317[_0x3552('0x41')]);return db[_0x3552('0x5b')]['count']({'where':_0x4702bc[_0x3552('0x3c')]})['then'](function(_0x497a35){_0x1eacba[_0x3552('0x1e')]=_0x497a35;if(_0x763317[_0x3552('0x37')]['includeAll']){_0x4702bc['include']=[{'all':!![]}];}return db[_0x3552('0x5b')]['findAll'](_0x4702bc);})['then'](function(_0x1a43b4){_0x1eacba['rows']=_0x1a43b4;return _0x1eacba;});}})[_0x3552('0x23')](respondWithFilteredResult(_0x1da9c0,_0x4702bc))[_0x3552('0x46')](handleError(_0x1da9c0,null));};exports['getHopperHistories']=function(_0x2960a2,_0x53bf9e,_0x39efa7){var _0x3db63d={'raw':!![],'where':{}};var _0x1566ab={};var _0x46c6f1={'count':0x0,'rows':[]};return db[_0x3552('0x42')][_0x3552('0x5a')]({'where':{'id':_0x2960a2[_0x3552('0x47')]['id']}})['then'](handleEntityNotFound(_0x53bf9e,null))[_0x3552('0x23')](function(_0x336b58){if(_0x336b58){_0x1566ab['model']=_['keys'](db['CmHopperHistory'][_0x3552('0x2d')]);_0x1566ab[_0x3552('0x37')]=_[_0x3552('0x48')](_0x2960a2[_0x3552('0x37')]);_0x1566ab[_0x3552('0x33')]=_[_0x3552('0x34')](_0x1566ab[_0x3552('0x31')],_0x1566ab[_0x3552('0x37')]);_0x3db63d['attributes']=_[_0x3552('0x34')](_0x1566ab[_0x3552('0x31')],qs[_0x3552('0x36')](_0x2960a2['query'][_0x3552('0x36')]));_0x3db63d[_0x3552('0x35')]=_0x3db63d[_0x3552('0x35')][_0x3552('0x38')]?_0x3db63d[_0x3552('0x35')]:_0x1566ab['model'];if(!_0x2960a2['query']['hasOwnProperty'](_0x3552('0x5c'))){_0x3db63d[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x2960a2[_0x3552('0x37')]['limit']);_0x3db63d[_0x3552('0x1b')]=qs['offset'](_0x2960a2[_0x3552('0x37')][_0x3552('0x1b')]);}_0x3db63d['order']=qs[_0x3552('0x3b')](_0x2960a2[_0x3552('0x37')]['sort']);_0x3db63d['where']=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x2960a2['query'],_0x1566ab[_0x3552('0x33')]));_0x3db63d[_0x3552('0x3c')][_0x3552('0x5d')]=_0x336b58['id'];if(_0x2960a2[_0x3552('0x37')][_0x3552('0x3e')]){_0x3db63d[_0x3552('0x3c')]=_['merge'](_0x3db63d[_0x3552('0x3c')],{'$or':_[_0x3552('0x32')](_0x3db63d[_0x3552('0x35')],function(_0x88b8a2){var _0x45f44a={};_0x45f44a[_0x88b8a2]={'$like':'%'+_0x2960a2['query'][_0x3552('0x3e')]+'%'};return _0x45f44a;})});}_0x3db63d=_[_0x3552('0x3f')]({},_0x3db63d,_0x2960a2[_0x3552('0x41')]);return db[_0x3552('0x5e')][_0x3552('0x1e')]({'where':_0x3db63d[_0x3552('0x3c')]})[_0x3552('0x23')](function(_0xe4f31d){_0x46c6f1[_0x3552('0x1e')]=_0xe4f31d;if(_0x2960a2[_0x3552('0x37')][_0x3552('0x54')]){_0x3db63d[_0x3552('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x3552('0x44')](_0x3db63d);})[_0x3552('0x23')](function(_0x4044c5){_0x46c6f1[_0x3552('0x45')]=_0x4044c5;return _0x46c6f1;});}})[_0x3552('0x23')](respondWithFilteredResult(_0x53bf9e,_0x3db63d))[_0x3552('0x46')](handleError(_0x53bf9e,null));};exports[_0x3552('0x5f')]=function(_0x15ed73,_0x44ec6c,_0x126b96){var _0x36c4af={'raw':!![],'where':{}};var _0x38f38f={};var _0x29a239={'count':0x0,'rows':[]};return db[_0x3552('0x42')][_0x3552('0x5a')]({'where':{'id':_0x15ed73[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x44ec6c,null))['then'](function(_0x411efc){if(_0x411efc){_0x38f38f[_0x3552('0x31')]=_[_0x3552('0x48')](db['CmHopperFinal'][_0x3552('0x2d')]);_0x38f38f['query']=_[_0x3552('0x48')](_0x15ed73[_0x3552('0x37')]);_0x38f38f[_0x3552('0x33')]=_[_0x3552('0x34')](_0x38f38f['model'],_0x38f38f[_0x3552('0x37')]);_0x36c4af['attributes']=_[_0x3552('0x34')](_0x38f38f['model'],qs[_0x3552('0x36')](_0x15ed73[_0x3552('0x37')][_0x3552('0x36')]));_0x36c4af[_0x3552('0x35')]=_0x36c4af['attributes'][_0x3552('0x38')]?_0x36c4af[_0x3552('0x35')]:_0x38f38f[_0x3552('0x31')];if(!_0x15ed73[_0x3552('0x37')][_0x3552('0x39')](_0x3552('0x5c'))){_0x36c4af[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x15ed73['query'][_0x3552('0x1c')]);_0x36c4af[_0x3552('0x1b')]=qs['offset'](_0x15ed73['query'][_0x3552('0x1b')]);}_0x36c4af[_0x3552('0x3a')]=qs[_0x3552('0x3b')](_0x15ed73['query'][_0x3552('0x3b')]);_0x36c4af['where']=qs[_0x3552('0x33')](_['pick'](_0x15ed73[_0x3552('0x37')],_0x38f38f[_0x3552('0x33')]));_0x36c4af['where'][_0x3552('0x5d')]=_0x411efc['id'];if(_0x15ed73[_0x3552('0x37')][_0x3552('0x3e')]){_0x36c4af[_0x3552('0x3c')]=_['merge'](_0x36c4af[_0x3552('0x3c')],{'$or':_[_0x3552('0x32')](_0x36c4af[_0x3552('0x35')],function(_0x1c7c22){var _0x4edd90={};_0x4edd90[_0x1c7c22]={'$like':'%'+_0x15ed73[_0x3552('0x37')][_0x3552('0x3e')]+'%'};return _0x4edd90;})});}_0x36c4af=_[_0x3552('0x3f')]({},_0x36c4af,_0x15ed73[_0x3552('0x41')]);return db[_0x3552('0x60')][_0x3552('0x1e')]({'where':_0x36c4af[_0x3552('0x3c')]})['then'](function(_0x193c08){_0x29a239[_0x3552('0x1e')]=_0x193c08;if(_0x15ed73['query']['includeAll']){_0x36c4af['include']=[{'all':!![]}];}return db[_0x3552('0x60')][_0x3552('0x44')](_0x36c4af);})[_0x3552('0x23')](function(_0x17f128){_0x29a239[_0x3552('0x45')]=_0x17f128;return _0x29a239;});}})[_0x3552('0x23')](respondWithFilteredResult(_0x44ec6c,_0x36c4af))[_0x3552('0x46')](handleError(_0x44ec6c,null));};exports[_0x3552('0x61')]=function(_0x7f2bff,_0x41e1e1,_0x32e57c){var _0x231360={'raw':!![],'where':{}};var _0x4ff5b9={};var _0xfa805d={'count':0x0,'rows':[]};return db[_0x3552('0x42')]['findOne']({'where':{'id':_0x7f2bff['params']['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x41e1e1,null))[_0x3552('0x23')](function(_0x5d2a92){if(_0x5d2a92){_0x4ff5b9[_0x3552('0x31')]=_[_0x3552('0x48')](db[_0x3552('0x62')]['rawAttributes']);_0x4ff5b9[_0x3552('0x37')]=_['keys'](_0x7f2bff[_0x3552('0x37')]);_0x4ff5b9['filters']=_[_0x3552('0x34')](_0x4ff5b9[_0x3552('0x31')],_0x4ff5b9[_0x3552('0x37')]);_0x231360[_0x3552('0x35')]=_[_0x3552('0x34')](_0x4ff5b9[_0x3552('0x31')],qs[_0x3552('0x36')](_0x7f2bff[_0x3552('0x37')]['fields']));_0x231360['attributes']=_0x231360[_0x3552('0x35')][_0x3552('0x38')]?_0x231360[_0x3552('0x35')]:_0x4ff5b9['model'];if(!_0x7f2bff['query']['hasOwnProperty'](_0x3552('0x5c'))){_0x231360[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x7f2bff[_0x3552('0x37')][_0x3552('0x1c')]);_0x231360[_0x3552('0x1b')]=qs['offset'](_0x7f2bff[_0x3552('0x37')]['offset']);}_0x231360[_0x3552('0x3a')]=qs[_0x3552('0x3b')](_0x7f2bff[_0x3552('0x37')][_0x3552('0x3b')]);_0x231360[_0x3552('0x3c')]=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x7f2bff[_0x3552('0x37')],_0x4ff5b9[_0x3552('0x33')]));_0x231360['where']['CampaignId']=_0x5d2a92['id'];if(_0x7f2bff[_0x3552('0x37')][_0x3552('0x3e')]){_0x231360[_0x3552('0x3c')]=_[_0x3552('0x3f')](_0x231360['where'],{'$or':_[_0x3552('0x32')](_0x231360[_0x3552('0x35')],function(_0x119bf3){var _0x4e2f1b={};_0x4e2f1b[_0x119bf3]={'$like':'%'+_0x7f2bff['query'][_0x3552('0x3e')]+'%'};return _0x4e2f1b;})});}_0x231360=_['merge']({},_0x231360,_0x7f2bff['options']);return db[_0x3552('0x62')][_0x3552('0x1e')]({'where':_0x231360[_0x3552('0x3c')]})[_0x3552('0x23')](function(_0x3006b0){_0xfa805d[_0x3552('0x1e')]=_0x3006b0;if(_0x7f2bff[_0x3552('0x37')][_0x3552('0x54')]){_0x231360[_0x3552('0x43')]=[{'all':!![]}];}return db[_0x3552('0x62')]['findAll'](_0x231360);})[_0x3552('0x23')](function(_0x26c443){_0xfa805d['rows']=_0x26c443;return _0xfa805d;});}})[_0x3552('0x23')](respondWithFilteredResult(_0x41e1e1,_0x231360))[_0x3552('0x46')](handleError(_0x41e1e1,null));};exports[_0x3552('0x63')]=function(_0x702218,_0x4b8860,_0x3492b1){var _0x48f184={};var _0x1da704={};var _0x172bde;var _0x1b6bc7;return db['Campaign'][_0x3552('0x5a')]({'where':{'id':_0x702218[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x4b8860,null))[_0x3552('0x23')](function(_0x12fb89){if(_0x12fb89){_0x172bde=_0x12fb89;_0x1da704[_0x3552('0x31')]=_[_0x3552('0x48')](db[_0x3552('0x64')][_0x3552('0x2d')]);_0x1da704[_0x3552('0x37')]=_[_0x3552('0x48')](_0x702218[_0x3552('0x37')]);_0x1da704[_0x3552('0x33')]=_['intersection'](_0x1da704[_0x3552('0x31')],_0x1da704[_0x3552('0x37')]);_0x48f184[_0x3552('0x35')]=_['intersection'](_0x1da704[_0x3552('0x31')],qs[_0x3552('0x36')](_0x702218[_0x3552('0x37')][_0x3552('0x36')]));_0x48f184[_0x3552('0x35')]=_0x48f184[_0x3552('0x35')][_0x3552('0x38')]?_0x48f184[_0x3552('0x35')]:_0x1da704[_0x3552('0x31')];_0x48f184['order']=qs[_0x3552('0x3b')](_0x702218[_0x3552('0x37')][_0x3552('0x3b')]);_0x48f184[_0x3552('0x3c')]=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x702218['query'],_0x1da704[_0x3552('0x33')]));if(_0x702218[_0x3552('0x37')][_0x3552('0x3e')]){_0x48f184['where']=_[_0x3552('0x3f')](_0x48f184['where'],{'$or':_['map'](_0x48f184['attributes'],function(_0x52d5ea){var _0x288e8b={};_0x288e8b[_0x52d5ea]={'$like':'%'+_0x702218[_0x3552('0x37')]['filter']+'%'};return _0x288e8b;})});}_0x48f184=_[_0x3552('0x3f')]({},_0x48f184,_0x702218[_0x3552('0x41')]);return _0x172bde[_0x3552('0x63')](_0x48f184);}})[_0x3552('0x23')](function(_0x131ce0){if(_0x131ce0){_0x1b6bc7=_0x131ce0[_0x3552('0x38')];if(!_0x702218[_0x3552('0x37')][_0x3552('0x39')](_0x3552('0x5c'))){_0x48f184[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x702218[_0x3552('0x37')][_0x3552('0x1c')]);_0x48f184['offset']=qs[_0x3552('0x1b')](_0x702218[_0x3552('0x37')][_0x3552('0x1b')]);}return _0x172bde[_0x3552('0x63')](_0x48f184);}})[_0x3552('0x23')](function(_0x12b567){if(_0x12b567){return _0x12b567?{'count':_0x1b6bc7,'rows':_0x12b567}:null;}})[_0x3552('0x23')](respondWithResult(_0x4b8860,null))[_0x3552('0x46')](handleError(_0x4b8860,null));};exports['addLists']=function(_0x155529,_0xfdec5c,_0x5e585d){var _0x35a9bc,_0x2b6424;var _0xe15d9b=[];var _0x47d898=moment()[_0x3552('0x65')](_0x3552('0x66'));return db['Campaign'][_0x3552('0x49')]({'where':{'id':_0x155529[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0xfdec5c,null))['then'](function(_0x38d246){if(_0x38d246){_0x2b6424=_0x38d246;return _0x38d246[_0x3552('0x67')](_0x155529[_0x3552('0x4b')][_0x3552('0x68')],_['omit'](_0x155529[_0x3552('0x4b')],['ids','id'])||{});}return null;})[_0x3552('0x69')](function(_0xdc0ec3){var _0x392eb4;var _0x5dd02a;_0x35a9bc=_0xdc0ec3||[];var _0x46d1be=[];if(_0xdc0ec3){for(var _0x10638a=0x0;_0x10638a<_0xdc0ec3[_0x3552('0x38')];_0x10638a+=0x1){var _0x3721db=_0xdc0ec3[_0x10638a][_0x3552('0x4d')]({'plain':!![]});_0x2b6424[_0x3552('0x6a')]=_0x155529['body']['dialCheckDuplicateType']?_0x155529[_0x3552('0x4b')]['dialCheckDuplicateType']:_0x2b6424[_0x3552('0x6a')];switch(_0x2b6424[_0x3552('0x6a')]){case _0x3552('0x6b'):_0x392eb4=squel['insert']()[_0x3552('0x6c')](_0x3552('0x6d'))[_0x3552('0x6e')](['phone','scheduledAt','ContactId',_0x3552('0x6f'),_0x3552('0x5d'),_0x3552('0x55'),'updatedAt'],squel[_0x3552('0x70')]()['field'](_0x3552('0x71'),_0x3552('0x71'))[_0x3552('0x72')](_0x3552('0x73'),'scheduledAt')['field']('id','ContactId')[_0x3552('0x72')](_0x3721db['CmListId'][_0x3552('0x74')](),'ListId')[_0x3552('0x72')](_0x155529['params']['id'][_0x3552('0x74')](),_0x3552('0x5d'))['field']('\x27'+_0x47d898+'\x27',_0x3552('0x55'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x56'))[_0x3552('0x75')](_0x3552('0x76'))[_0x3552('0x3c')](_0x3552('0x77'))[_0x3552('0x3c')]('ListId\x20=\x20?',_0x3721db[_0x3552('0x78')][_0x3552('0x74')]())[_0x3552('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x3552('0x3c')](_0x3552('0x79'),squel[_0x3552('0x70')]()[_0x3552('0x72')]('COALESCE(calleridnum,\x27\x27)')[_0x3552('0x75')]('cm_hopper_final')[_0x3552('0x3c')]('CampaignId\x20=\x20?',_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')]()))['where'](_0x3552('0x79'),squel[_0x3552('0x70')]()[_0x3552('0x72')](_0x3552('0x7a'))['from'](_0x3552('0x6d'))[_0x3552('0x3c')](_0x3552('0x7b'),_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')]())))[_0x3552('0x74')]();break;case _0x3552('0x7c'):_0x392eb4=squel['insert']()['into'](_0x3552('0x6d'))[_0x3552('0x6e')]([_0x3552('0x71'),'scheduledAt',_0x3552('0x7d'),'ListId','CampaignId',_0x3552('0x55'),_0x3552('0x56')],squel['select']()['field'](_0x3552('0x71'),'phone')[_0x3552('0x72')]('NOW()','scheduledAt')[_0x3552('0x72')]('id','ContactId')[_0x3552('0x72')](_0x3721db[_0x3552('0x78')][_0x3552('0x74')](),_0x3552('0x6f'))['field'](_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')](),_0x3552('0x5d'))['field']('\x27'+_0x47d898+'\x27',_0x3552('0x55'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x56'))['from'](_0x3552('0x76'))[_0x3552('0x3c')](_0x3552('0x77'))[_0x3552('0x3c')](_0x3552('0x7e'),_0x3721db[_0x3552('0x78')][_0x3552('0x74')]())['where'](_0x3552('0x7f'))['where'](_0x3552('0x79'),squel[_0x3552('0x70')]()[_0x3552('0x72')](_0x3552('0x7a'))[_0x3552('0x75')](_0x3552('0x6d'))['where'](_0x3552('0x7b'),_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')]())))[_0x3552('0x74')]();break;default:_0x392eb4=squel['insert']()[_0x3552('0x6c')](_0x3552('0x6d'))['fromQuery']([_0x3552('0x71'),_0x3552('0x80'),_0x3552('0x7d'),'ListId',_0x3552('0x5d'),_0x3552('0x55'),_0x3552('0x56')],squel[_0x3552('0x70')]()['field'](_0x3552('0x71'),_0x3552('0x71'))[_0x3552('0x72')]('NOW()','scheduledAt')['field']('id',_0x3552('0x7d'))[_0x3552('0x72')](_0x3721db[_0x3552('0x78')][_0x3552('0x74')](),_0x3552('0x6f'))[_0x3552('0x72')](_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')](),_0x3552('0x5d'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x55'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x56'))[_0x3552('0x75')]('cm_contacts')[_0x3552('0x3c')](_0x3552('0x77'))[_0x3552('0x3c')]('ListId\x20=\x20?',_0x3721db[_0x3552('0x78')][_0x3552('0x74')]())['where'](_0x3552('0x7f')))[_0x3552('0x74')]();}_0x5dd02a=squel['insert']()['into'](_0x3552('0x81'))[_0x3552('0x6e')]([_0x3552('0x82'),_0x3552('0x80'),'phone',_0x3552('0x83'),_0x3552('0x55'),'updatedAt'],squel[_0x3552('0x70')]()[_0x3552('0x72')](_0x3552('0x84'),'id')[_0x3552('0x72')]('NOW()',_0x3552('0x80'))[_0x3552('0x72')](_0x3552('0x85'),_0x3552('0x71'))[_0x3552('0x72')](_0x3552('0x86'),_0x3552('0x83'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x55'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x56'))[_0x3552('0x75')](_0x3552('0x87'),'ci')[_0x3552('0x88')](_0x3552('0x6d'),'h',_0x3552('0x89'))[_0x3552('0x3c')](_0x3552('0x8a'),_0x3721db[_0x3552('0x78')][_0x3552('0x74')]())[_0x3552('0x3c')](_0x3552('0x8b'),_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')]())[_0x3552('0x3c')](_0x3552('0x8c'),_0x47d898))['toString']();_0x46d1be[_0x3552('0x8d')](db[_0x3552('0x8e')][_0x3552('0x37')](_0x392eb4));_0xe15d9b[_0x3552('0x8d')](db['sequelize'][_0x3552('0x37')](_0x5dd02a));}return BPromise[_0x3552('0x8f')](_0x46d1be);}})[_0x3552('0x23')](function(){return BPromise[_0x3552('0x8f')](_0xe15d9b);})[_0x3552('0x23')](function(){return _0x35a9bc;})[_0x3552('0x23')](respondWithResult(_0xfdec5c,null))['catch'](handleError(_0xfdec5c,null));};exports[_0x3552('0x90')]=function(_0x22f37a,_0x5809c2,_0x367601){return db['Campaign'][_0x3552('0x49')]({'where':{'id':_0x22f37a['params']['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x5809c2,null))[_0x3552('0x23')](function(_0x407720){if(_0x407720){return _0x407720[_0x3552('0x90')](_0x22f37a[_0x3552('0x37')][_0x3552('0x68')]);}})[_0x3552('0x23')](function(_0x100c3e){if(_0x100c3e){return db[_0x3552('0x5b')]['destroy']({'where':{'ListId':_0x22f37a['query']['ids'],'CampaignId':_0x22f37a[_0x3552('0x47')]['id']}})[_0x3552('0x23')](function(){return _0x100c3e;});}})[_0x3552('0x23')](respondWithStatusCode(_0x5809c2,null))[_0x3552('0x46')](handleError(_0x5809c2,null));};exports[_0x3552('0x91')]=function(_0x2fd053,_0xbdd748,_0x3cca8e){var _0x2e65fe={};var _0x3258be={};var _0x505bdf;var _0x1297a7;return db['Campaign'][_0x3552('0x5a')]({'where':{'id':_0x2fd053[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0xbdd748,null))[_0x3552('0x23')](function(_0x39d646){if(_0x39d646){_0x505bdf=_0x39d646;_0x3258be['model']=_[_0x3552('0x48')](db[_0x3552('0x64')]['rawAttributes']);_0x3258be[_0x3552('0x37')]=_[_0x3552('0x48')](_0x2fd053[_0x3552('0x37')]);_0x3258be[_0x3552('0x33')]=_[_0x3552('0x34')](_0x3258be[_0x3552('0x31')],_0x3258be[_0x3552('0x37')]);_0x2e65fe['attributes']=_[_0x3552('0x34')](_0x3258be[_0x3552('0x31')],qs[_0x3552('0x36')](_0x2fd053[_0x3552('0x37')]['fields']));_0x2e65fe['attributes']=_0x2e65fe[_0x3552('0x35')]['length']?_0x2e65fe['attributes']:_0x3258be[_0x3552('0x31')];_0x2e65fe[_0x3552('0x3a')]=qs[_0x3552('0x3b')](_0x2fd053[_0x3552('0x37')][_0x3552('0x3b')]);_0x2e65fe[_0x3552('0x3c')]=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x2fd053[_0x3552('0x37')],_0x3258be[_0x3552('0x33')]));if(_0x2fd053[_0x3552('0x37')][_0x3552('0x3e')]){_0x2e65fe[_0x3552('0x3c')]=_[_0x3552('0x3f')](_0x2e65fe[_0x3552('0x3c')],{'$or':_[_0x3552('0x32')](_0x2e65fe[_0x3552('0x35')],function(_0x1d949e){var _0x818236={};_0x818236[_0x1d949e]={'$like':'%'+_0x2fd053[_0x3552('0x37')][_0x3552('0x3e')]+'%'};return _0x818236;})});}_0x2e65fe=_['merge']({},_0x2e65fe,_0x2fd053[_0x3552('0x41')]);return _0x505bdf[_0x3552('0x91')](_0x2e65fe);}})[_0x3552('0x23')](function(_0x44cd4e){if(_0x44cd4e){_0x1297a7=_0x44cd4e[_0x3552('0x38')];if(!_0x2fd053[_0x3552('0x37')][_0x3552('0x39')]('nolimit')){_0x2e65fe[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x2fd053[_0x3552('0x37')]['limit']);_0x2e65fe[_0x3552('0x1b')]=qs[_0x3552('0x1b')](_0x2fd053[_0x3552('0x37')][_0x3552('0x1b')]);}return _0x505bdf['getBlackLists'](_0x2e65fe);}})[_0x3552('0x23')](function(_0x298650){if(_0x298650){return _0x298650?{'count':_0x1297a7,'rows':_0x298650}:null;}})[_0x3552('0x23')](respondWithResult(_0xbdd748,null))[_0x3552('0x46')](handleError(_0xbdd748,null));};exports[_0x3552('0x92')]=function(_0x1c12a3,_0x3c8eb2,_0x6bf543){var _0x4e2c47,_0x3f162a;var _0x3350fb=[];var _0x4c7e23=moment()[_0x3552('0x65')](_0x3552('0x66'));return db[_0x3552('0x42')][_0x3552('0x49')]({'where':{'id':_0x1c12a3[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x3c8eb2,null))[_0x3552('0x23')](function(_0xe92ed0){if(_0xe92ed0){_0x3f162a=_0xe92ed0;return _0xe92ed0[_0x3552('0x92')](_0x1c12a3['body'][_0x3552('0x68')],_[_0x3552('0x93')](_0x1c12a3['body'],[_0x3552('0x68'),'id'])||{});}return null;})[_0x3552('0x69')](function(_0x1d31e8){var _0x24fef4;var _0x58fc52;_0x4e2c47=_0x1d31e8||[];var _0x4e59c9=[];if(_0x1d31e8){for(var _0x273202=0x0;_0x273202<_0x1d31e8[_0x3552('0x38')];_0x273202+=0x1){var _0x55febe=_0x1d31e8[_0x273202]['get']({'plain':!![]});_0x24fef4=squel[_0x3552('0x94')]()[_0x3552('0x6c')](_0x3552('0x95'))[_0x3552('0x6e')](['phone',_0x3552('0x7d'),'ListId',_0x3552('0x5d'),_0x3552('0x55'),'updatedAt'],squel['select']()[_0x3552('0x72')]('phone',_0x3552('0x71'))[_0x3552('0x72')]('id',_0x3552('0x7d'))['field'](_0x55febe[_0x3552('0x78')][_0x3552('0x74')](),_0x3552('0x6f'))[_0x3552('0x72')](_0x1c12a3[_0x3552('0x47')]['id'][_0x3552('0x74')](),'CampaignId')[_0x3552('0x72')](_0x3552('0x73'),_0x3552('0x55'))[_0x3552('0x72')](_0x3552('0x73'),_0x3552('0x56'))['from'](_0x3552('0x76'))[_0x3552('0x3c')](_0x3552('0x77'))['where']('ListId\x20=\x20?',_0x55febe[_0x3552('0x78')][_0x3552('0x74')]())[_0x3552('0x3c')](_0x3552('0x7f')))[_0x3552('0x74')]();_0x4e59c9['push'](db['sequelize'][_0x3552('0x37')](_0x24fef4));}return BPromise[_0x3552('0x8f')](_0x4e59c9);}})[_0x3552('0x23')](function(){return _0x4e2c47;})[_0x3552('0x23')](respondWithResult(_0x3c8eb2,null))['catch'](handleError(_0x3c8eb2,null));};exports[_0x3552('0x96')]=function(_0x29acd0,_0x4c6ee0,_0x317239){return db[_0x3552('0x42')][_0x3552('0x49')]({'where':{'id':_0x29acd0[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x4c6ee0,null))[_0x3552('0x23')](function(_0x59cf51){if(_0x59cf51){return _0x59cf51[_0x3552('0x96')](_0x29acd0[_0x3552('0x37')][_0x3552('0x68')]);}})[_0x3552('0x23')](function(_0x42cd52){if(_0x42cd52){return db['CmHopperBlack'][_0x3552('0x24')]({'where':{'ListId':_0x29acd0[_0x3552('0x37')]['ids'],'CampaignId':_0x29acd0[_0x3552('0x47')]['id']}})['then'](function(){return _0x42cd52;});}})[_0x3552('0x23')](respondWithStatusCode(_0x4c6ee0,null))[_0x3552('0x46')](handleError(_0x4c6ee0,null));}; \ No newline at end of file +var _0xf865=['../../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','get','IvrCampaigns','UserProfileResource','destroy','error','stack','name','send','index','map','Campaign','fieldName','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','show','params','rawAttributes','include','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','rows','getHopperBlacks','CmHopperBlack','getLists','format','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','select','field','phone','NOW()','ContactId','CmListId','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','h.id','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','push','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0xf865,0x11a));var _0x5f86=function(_0x3f8743,_0x33973f){_0x3f8743=_0x3f8743-0x0;var _0x1f844c=_0xf865[_0x3f8743];return _0x1f844c;};'use strict';var emlformat=require(_0x5f86('0x0'));var rimraf=require(_0x5f86('0x1'));var zipdir=require(_0x5f86('0x2'));var jsonpatch=require(_0x5f86('0x3'));var rp=require(_0x5f86('0x4'));var moment=require(_0x5f86('0x5'));var BPromise=require(_0x5f86('0x6'));var Mustache=require(_0x5f86('0x7'));var util=require(_0x5f86('0x8'));var path=require(_0x5f86('0x9'));var sox=require(_0x5f86('0xa'));var csv=require('to-csv');var ejs=require(_0x5f86('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f86('0xc'));var squel=require('squel');var crypto=require(_0x5f86('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5f86('0xe'));var toCsv=require(_0x5f86('0xf'));var querystring=require(_0x5f86('0x10'));var Papa=require(_0x5f86('0x11'));var Redis=require(_0x5f86('0x12'));var authService=require(_0x5f86('0x13'));var qs=require(_0x5f86('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f86('0x15'));var logger=require(_0x5f86('0x16'))(_0x5f86('0x17'));var utils=require(_0x5f86('0x18'));var config=require(_0x5f86('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f86('0x1a'))['db'];function respondWithStatusCode(_0x3b3ecb,_0x490b06){_0x490b06=_0x490b06||0xcc;return function(_0x4acc21){if(_0x4acc21){return _0x3b3ecb[_0x5f86('0x1b')](_0x490b06);}return _0x3b3ecb[_0x5f86('0x1c')](_0x490b06)[_0x5f86('0x1d')]();};}function respondWithResult(_0x3caca5,_0x315879){_0x315879=_0x315879||0xc8;return function(_0x2848bb){if(_0x2848bb){return _0x3caca5['status'](_0x315879)[_0x5f86('0x1e')](_0x2848bb);}};}function respondWithFilteredResult(_0x4fec48,_0x51a08b){return function(_0x3e1c95){if(_0x3e1c95){var _0x1c4c4c=typeof _0x51a08b[_0x5f86('0x1f')]===_0x5f86('0x20')&&typeof _0x51a08b[_0x5f86('0x21')]===_0x5f86('0x20');var _0xa9c94c=_0x3e1c95[_0x5f86('0x22')];var _0x466990=_0x1c4c4c?0x0:_0x51a08b['offset'];var _0x4b2561=_0x1c4c4c?_0x3e1c95['count']:_0x51a08b['offset']+_0x51a08b[_0x5f86('0x21')];var _0x6b7e87;if(_0x4b2561>=_0xa9c94c){_0x4b2561=_0xa9c94c;_0x6b7e87=0xc8;}else{_0x6b7e87=0xce;}_0x4fec48[_0x5f86('0x1c')](_0x6b7e87);return _0x4fec48[_0x5f86('0x23')](_0x5f86('0x24'),_0x466990+'-'+_0x4b2561+'/'+_0xa9c94c)[_0x5f86('0x1e')](_0x3e1c95);}return null;};}function patchUpdates(_0x33a30e){return function(_0x478b7c){try{jsonpatch[_0x5f86('0x25')](_0x478b7c,_0x33a30e,!![]);}catch(_0x274507){return BPromise[_0x5f86('0x26')](_0x274507);}return _0x478b7c[_0x5f86('0x27')]();};}function saveUpdates(_0x48205d,_0x48b3b9){return function(_0x5f3a41){if(_0x5f3a41){return _0x5f3a41[_0x5f86('0x28')](_0x48205d)[_0x5f86('0x29')](function(_0x194c0e){return _0x194c0e;});}return null;};}function removeEntity(_0x312117,_0x4ec894){return function(_0x3d5778){if(_0x3d5778){return _0x3d5778['destroy']()[_0x5f86('0x29')](function(){var _0x4f4029=_0x3d5778[_0x5f86('0x2a')]({'plain':!![]});var _0x3652ee=_0x5f86('0x2b');return db[_0x5f86('0x2c')][_0x5f86('0x2d')]({'where':{'type':_0x3652ee,'resourceId':_0x4f4029['id']}})['then'](function(){return _0x3d5778;});})[_0x5f86('0x29')](function(){_0x312117['status'](0xcc)[_0x5f86('0x1d')]();});}};}function handleEntityNotFound(_0x149ab5,_0x3d00e7){return function(_0xd83b52){if(!_0xd83b52){_0x149ab5[_0x5f86('0x1b')](0x194);}return _0xd83b52;};}function handleError(_0x2a619c,_0x324fcc){_0x324fcc=_0x324fcc||0x1f4;return function(_0xd2b8f7){logger[_0x5f86('0x2e')](_0xd2b8f7[_0x5f86('0x2f')]);if(_0xd2b8f7[_0x5f86('0x30')]){delete _0xd2b8f7[_0x5f86('0x30')];}_0x2a619c[_0x5f86('0x1c')](_0x324fcc)[_0x5f86('0x31')](_0xd2b8f7);};}exports[_0x5f86('0x32')]=function(_0x451b65,_0xf2ef4c){var _0x2fc649={},_0x3bb7cf={},_0x174df2={'count':0x0,'rows':[]};var _0x1557fc=_[_0x5f86('0x33')](db[_0x5f86('0x34')]['rawAttributes'],function(_0x5eb6de){return{'name':_0x5eb6de[_0x5f86('0x35')],'type':_0x5eb6de['type']['key']};});_0x3bb7cf['model']=_[_0x5f86('0x33')](_0x1557fc,'name');_0x3bb7cf[_0x5f86('0x36')]=_[_0x5f86('0x37')](_0x451b65[_0x5f86('0x36')]);_0x3bb7cf[_0x5f86('0x38')]=_['intersection'](_0x3bb7cf[_0x5f86('0x39')],_0x3bb7cf[_0x5f86('0x36')]);_0x2fc649[_0x5f86('0x3a')]=_[_0x5f86('0x3b')](_0x3bb7cf[_0x5f86('0x39')],qs[_0x5f86('0x3c')](_0x451b65[_0x5f86('0x36')][_0x5f86('0x3c')]));_0x2fc649[_0x5f86('0x3a')]=_0x2fc649['attributes'][_0x5f86('0x3d')]?_0x2fc649[_0x5f86('0x3a')]:_0x3bb7cf[_0x5f86('0x39')];if(!_0x451b65[_0x5f86('0x36')][_0x5f86('0x3e')](_0x5f86('0x3f'))){_0x2fc649['limit']=qs[_0x5f86('0x21')](_0x451b65[_0x5f86('0x36')][_0x5f86('0x21')]);_0x2fc649['offset']=qs['offset'](_0x451b65[_0x5f86('0x36')][_0x5f86('0x1f')]);}_0x2fc649[_0x5f86('0x40')]=qs['sort'](_0x451b65[_0x5f86('0x36')][_0x5f86('0x41')]);_0x2fc649[_0x5f86('0x42')]=qs[_0x5f86('0x38')](_[_0x5f86('0x43')](_0x451b65['query'],_0x3bb7cf[_0x5f86('0x38')]),_0x1557fc);if(_0x451b65[_0x5f86('0x36')][_0x5f86('0x44')]){_0x2fc649[_0x5f86('0x42')]=_[_0x5f86('0x45')](_0x2fc649[_0x5f86('0x42')],{'$or':_[_0x5f86('0x33')](_0x1557fc,function(_0xe031ef){if(_0xe031ef[_0x5f86('0x46')]!==_0x5f86('0x47')){var _0x3b1bfa={};_0x3b1bfa[_0xe031ef[_0x5f86('0x30')]]={'$like':'%'+_0x451b65['query']['filter']+'%'};return _0x3b1bfa;}})});}_0x2fc649=_[_0x5f86('0x45')]({},_0x2fc649,_0x451b65[_0x5f86('0x48')]);var _0x5bff32={'where':_0x2fc649[_0x5f86('0x42')]};return db['Campaign'][_0x5f86('0x22')](_0x5bff32)[_0x5f86('0x29')](function(_0x5b297b){_0x174df2['count']=_0x5b297b;if(_0x451b65[_0x5f86('0x36')][_0x5f86('0x49')]){_0x2fc649['include']=[{'all':!![]}];}return db[_0x5f86('0x34')][_0x5f86('0x4a')](_0x2fc649);})[_0x5f86('0x29')](function(_0x45a496){_0x174df2['rows']=_0x45a496;return _0x174df2;})['then'](respondWithFilteredResult(_0xf2ef4c,_0x2fc649))['catch'](handleError(_0xf2ef4c,null));};exports[_0x5f86('0x4b')]=function(_0x56c5c9,_0x43bf0f){var _0x127beb={'raw':![],'where':{'id':_0x56c5c9[_0x5f86('0x4c')]['id']}},_0x1d3665={};_0x1d3665[_0x5f86('0x39')]=_[_0x5f86('0x37')](db['Campaign'][_0x5f86('0x4d')]);_0x1d3665[_0x5f86('0x36')]=_['keys'](_0x56c5c9[_0x5f86('0x36')]);_0x1d3665[_0x5f86('0x38')]=_[_0x5f86('0x3b')](_0x1d3665['model'],_0x1d3665[_0x5f86('0x36')]);_0x127beb[_0x5f86('0x3a')]=_[_0x5f86('0x3b')](_0x1d3665[_0x5f86('0x39')],qs[_0x5f86('0x3c')](_0x56c5c9[_0x5f86('0x36')][_0x5f86('0x3c')]));_0x127beb[_0x5f86('0x3a')]=_0x127beb['attributes'][_0x5f86('0x3d')]?_0x127beb['attributes']:_0x1d3665['model'];if(_0x56c5c9[_0x5f86('0x36')]['includeAll']){_0x127beb[_0x5f86('0x4e')]=[{'all':!![]}];}_0x127beb=_[_0x5f86('0x45')]({},_0x127beb,_0x56c5c9[_0x5f86('0x48')]);return db[_0x5f86('0x34')][_0x5f86('0x4f')](_0x127beb)[_0x5f86('0x29')](handleEntityNotFound(_0x43bf0f,null))[_0x5f86('0x29')](respondWithResult(_0x43bf0f,null))[_0x5f86('0x50')](handleError(_0x43bf0f,null));};exports[_0x5f86('0x51')]=function(_0x2e3784,_0x2a2e16){return db[_0x5f86('0x34')][_0x5f86('0x51')](_0x2e3784['body'],{})[_0x5f86('0x29')](function(_0x1344d6){var _0x10e4a0=_0x2e3784[_0x5f86('0x52')][_0x5f86('0x2a')]({'plain':!![]});if(!_0x10e4a0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10e4a0[_0x5f86('0x53')]==='user'){var _0x135484=_0x1344d6[_0x5f86('0x2a')]({'plain':!![]});var _0x5b19fb=_0x5f86('0x2b');return db[_0x5f86('0x54')][_0x5f86('0x4f')]({'where':{'name':_0x5b19fb,'userProfileId':_0x10e4a0[_0x5f86('0x55')]},'raw':!![]})[_0x5f86('0x29')](function(_0x207be9){if(_0x207be9&&_0x207be9[_0x5f86('0x56')]===0x0){return db['UserProfileResource'][_0x5f86('0x51')]({'name':_0x135484[_0x5f86('0x30')],'resourceId':_0x135484['id'],'type':_0x207be9['name'],'sectionId':_0x207be9['id']},{})[_0x5f86('0x29')](function(){return _0x1344d6;});}else{return _0x1344d6;}})[_0x5f86('0x50')](function(_0x3b0632){logger['error'](_0x5f86('0x57'),_0x3b0632);throw _0x3b0632;});}return _0x1344d6;})['then'](respondWithResult(_0x2a2e16,0xc9))[_0x5f86('0x50')](handleError(_0x2a2e16,null));};exports[_0x5f86('0x58')]=function(_0x498383,_0x366aab){var _0x129be3={'where':{'id':_0x498383[_0x5f86('0x4c')]['id']}},_0xf5aae3={};_0xf5aae3[_0x5f86('0x39')]=_[_0x5f86('0x37')](db[_0x5f86('0x34')]['rawAttributes']);_0x129be3[_0x5f86('0x3a')]=_[_0x5f86('0x3b')](_0xf5aae3[_0x5f86('0x39')],qs[_0x5f86('0x3c')](_0x498383['query'][_0x5f86('0x3c')]));_0x129be3[_0x5f86('0x3a')]=_0x129be3[_0x5f86('0x3a')][_0x5f86('0x3d')]?_0x129be3[_0x5f86('0x3a')]:_0xf5aae3[_0x5f86('0x39')];if(_0x498383[_0x5f86('0x36')][_0x5f86('0x49')]){_0x129be3[_0x5f86('0x4e')]=[{'all':!![]}];}_0x129be3=_[_0x5f86('0x45')]({},_0x129be3,_0x498383['options']);return db[_0x5f86('0x34')]['find'](_0x129be3)['then'](handleEntityNotFound(_0x366aab,null))[_0x5f86('0x29')](function(_0x448c26){if(_0x448c26){var _0x4b8c0a=_0x448c26[_0x5f86('0x2a')]({'plain':!![]});_0x4b8c0a=qs['omit'](_0x4b8c0a,['id',_0x5f86('0x59'),'updatedAt']);_0x498383['body']=_[_0x5f86('0x5a')](_0x498383['body'],['id',_0x5f86('0x59'),_0x5f86('0x5b')]);return db[_0x5f86('0x34')][_0x5f86('0x51')](_[_0x5f86('0x45')](_0x4b8c0a,_0x498383[_0x5f86('0x5c')]),{'include':_0x498383['query'][_0x5f86('0x49')]?[{'all':!![]}]:undefined})[_0x5f86('0x29')](function(_0x417f33){var _0x488b1a=_0x498383[_0x5f86('0x52')]['get']({'plain':!![]});if(!_0x488b1a)throw new Error(_0x5f86('0x5d'));if(_0x488b1a[_0x5f86('0x53')]==='user'){var _0x1a9800=_0x417f33['get']({'plain':!![]});var _0x5ca402=_0x5f86('0x2b');return db[_0x5f86('0x54')][_0x5f86('0x4f')]({'where':{'name':_0x5ca402,'userProfileId':_0x488b1a[_0x5f86('0x55')]},'raw':!![]})[_0x5f86('0x29')](function(_0x1792c9){if(_0x1792c9&&_0x1792c9[_0x5f86('0x56')]===0x0){return db[_0x5f86('0x2c')]['create']({'name':_0x1a9800[_0x5f86('0x30')],'resourceId':_0x1a9800['id'],'type':_0x1792c9[_0x5f86('0x30')],'sectionId':_0x1792c9['id']},{})[_0x5f86('0x29')](function(){return _0x417f33;});}else{return _0x417f33;}})[_0x5f86('0x50')](function(_0x520389){logger[_0x5f86('0x2e')](_0x5f86('0x57'),_0x520389);throw _0x520389;});}return _0x417f33;});}})['then'](respondWithResult(_0x366aab,0xc9))['catch'](handleError(_0x366aab,null));};exports[_0x5f86('0x28')]=function(_0x3b54aa,_0x39be2c){if(_0x3b54aa[_0x5f86('0x5c')]['id']){delete _0x3b54aa[_0x5f86('0x5c')]['id'];}return db['Campaign'][_0x5f86('0x4f')]({'where':{'id':_0x3b54aa[_0x5f86('0x4c')]['id']}})[_0x5f86('0x29')](handleEntityNotFound(_0x39be2c,null))[_0x5f86('0x29')](saveUpdates(_0x3b54aa[_0x5f86('0x5c')],null))[_0x5f86('0x29')](respondWithResult(_0x39be2c,null))['catch'](handleError(_0x39be2c,null));};exports[_0x5f86('0x2d')]=function(_0x2a92bb,_0xc1fb11){return db['Campaign']['find']({'where':{'id':_0x2a92bb[_0x5f86('0x4c')]['id']}})[_0x5f86('0x29')](handleEntityNotFound(_0xc1fb11,null))['then'](removeEntity(_0xc1fb11,null))[_0x5f86('0x50')](handleError(_0xc1fb11,null));};exports['getHoppers']=function(_0x1bd4d7,_0x38b722,_0x2289de){var _0x4db9bd={'raw':!![],'where':{}};var _0x21ffe5={};var _0x630208={'count':0x0,'rows':[]};return db['Campaign'][_0x5f86('0x5e')]({'where':{'id':_0x1bd4d7['params']['id']}})[_0x5f86('0x29')](handleEntityNotFound(_0x38b722,null))[_0x5f86('0x29')](function(_0x5c9002){if(_0x5c9002){_0x21ffe5[_0x5f86('0x39')]=_['keys'](db[_0x5f86('0x5f')]['rawAttributes']);_0x21ffe5[_0x5f86('0x36')]=_[_0x5f86('0x37')](_0x1bd4d7[_0x5f86('0x36')]);_0x21ffe5['filters']=_[_0x5f86('0x3b')](_0x21ffe5[_0x5f86('0x39')],_0x21ffe5['query']);_0x4db9bd['attributes']=_[_0x5f86('0x3b')](_0x21ffe5['model'],qs[_0x5f86('0x3c')](_0x1bd4d7[_0x5f86('0x36')][_0x5f86('0x3c')]));_0x4db9bd[_0x5f86('0x3a')]=_0x4db9bd['attributes'][_0x5f86('0x3d')]?_0x4db9bd[_0x5f86('0x3a')]:_0x21ffe5[_0x5f86('0x39')];if(!_0x1bd4d7[_0x5f86('0x36')][_0x5f86('0x3e')]('nolimit')){_0x4db9bd[_0x5f86('0x21')]=qs[_0x5f86('0x21')](_0x1bd4d7['query'][_0x5f86('0x21')]);_0x4db9bd[_0x5f86('0x1f')]=qs['offset'](_0x1bd4d7[_0x5f86('0x36')][_0x5f86('0x1f')]);}_0x4db9bd[_0x5f86('0x40')]=qs['sort'](_0x1bd4d7[_0x5f86('0x36')]['sort']);_0x4db9bd[_0x5f86('0x42')]=qs[_0x5f86('0x38')](_[_0x5f86('0x43')](_0x1bd4d7[_0x5f86('0x36')],_0x21ffe5['filters']));_0x4db9bd['where'][_0x5f86('0x60')]=_0x5c9002['id'];if(_0x1bd4d7['query']['filter']){_0x4db9bd[_0x5f86('0x42')]=_['merge'](_0x4db9bd['where'],{'$or':_[_0x5f86('0x33')](_0x4db9bd[_0x5f86('0x3a')],function(_0x55ec78){var _0x31aa25={};_0x31aa25[_0x55ec78]={'$like':'%'+_0x1bd4d7['query'][_0x5f86('0x44')]+'%'};return _0x31aa25;})});}_0x4db9bd=_[_0x5f86('0x45')]({},_0x4db9bd,_0x1bd4d7['options']);return db[_0x5f86('0x5f')][_0x5f86('0x22')]({'where':_0x4db9bd[_0x5f86('0x42')]})[_0x5f86('0x29')](function(_0xf9c95c){_0x630208[_0x5f86('0x22')]=_0xf9c95c;if(_0x1bd4d7[_0x5f86('0x36')][_0x5f86('0x49')]){_0x4db9bd[_0x5f86('0x4e')]=[{'all':!![]}];}return db[_0x5f86('0x5f')][_0x5f86('0x4a')](_0x4db9bd);})[_0x5f86('0x29')](function(_0x207d7d){_0x630208['rows']=_0x207d7d;return _0x630208;});}})[_0x5f86('0x29')](respondWithFilteredResult(_0x38b722,_0x4db9bd))[_0x5f86('0x50')](handleError(_0x38b722,null));};exports[_0x5f86('0x61')]=function(_0x1eef67,_0x2eed7b,_0x50a496){var _0x595eeb={'raw':!![],'where':{}};var _0x2ceded={};var _0x54ee00={'count':0x0,'rows':[]};return db[_0x5f86('0x34')]['findOne']({'where':{'id':_0x1eef67[_0x5f86('0x4c')]['id']}})[_0x5f86('0x29')](handleEntityNotFound(_0x2eed7b,null))[_0x5f86('0x29')](function(_0x5e6d58){if(_0x5e6d58){_0x2ceded[_0x5f86('0x39')]=_['keys'](db[_0x5f86('0x62')][_0x5f86('0x4d')]);_0x2ceded['query']=_[_0x5f86('0x37')](_0x1eef67[_0x5f86('0x36')]);_0x2ceded[_0x5f86('0x38')]=_[_0x5f86('0x3b')](_0x2ceded[_0x5f86('0x39')],_0x2ceded['query']);_0x595eeb['attributes']=_[_0x5f86('0x3b')](_0x2ceded['model'],qs[_0x5f86('0x3c')](_0x1eef67[_0x5f86('0x36')]['fields']));_0x595eeb['attributes']=_0x595eeb[_0x5f86('0x3a')]['length']?_0x595eeb[_0x5f86('0x3a')]:_0x2ceded[_0x5f86('0x39')];if(!_0x1eef67[_0x5f86('0x36')][_0x5f86('0x3e')]('nolimit')){_0x595eeb[_0x5f86('0x21')]=qs[_0x5f86('0x21')](_0x1eef67[_0x5f86('0x36')]['limit']);_0x595eeb[_0x5f86('0x1f')]=qs['offset'](_0x1eef67[_0x5f86('0x36')][_0x5f86('0x1f')]);}_0x595eeb[_0x5f86('0x40')]=qs[_0x5f86('0x41')](_0x1eef67[_0x5f86('0x36')][_0x5f86('0x41')]);_0x595eeb[_0x5f86('0x42')]=qs[_0x5f86('0x38')](_[_0x5f86('0x43')](_0x1eef67[_0x5f86('0x36')],_0x2ceded[_0x5f86('0x38')]));_0x595eeb[_0x5f86('0x42')][_0x5f86('0x60')]=_0x5e6d58['id'];if(_0x1eef67[_0x5f86('0x36')][_0x5f86('0x44')]){_0x595eeb[_0x5f86('0x42')]=_['merge'](_0x595eeb[_0x5f86('0x42')],{'$or':_['map'](_0x595eeb[_0x5f86('0x3a')],function(_0x479276){var _0x2acb29={};_0x2acb29[_0x479276]={'$like':'%'+_0x1eef67[_0x5f86('0x36')][_0x5f86('0x44')]+'%'};return _0x2acb29;})});}_0x595eeb=_[_0x5f86('0x45')]({},_0x595eeb,_0x1eef67[_0x5f86('0x48')]);return db[_0x5f86('0x62')][_0x5f86('0x22')]({'where':_0x595eeb['where']})[_0x5f86('0x29')](function(_0x4676e1){_0x54ee00[_0x5f86('0x22')]=_0x4676e1;if(_0x1eef67[_0x5f86('0x36')][_0x5f86('0x49')]){_0x595eeb[_0x5f86('0x4e')]=[{'all':!![]}];}return db[_0x5f86('0x62')]['findAll'](_0x595eeb);})[_0x5f86('0x29')](function(_0x4cd9af){_0x54ee00['rows']=_0x4cd9af;return _0x54ee00;});}})[_0x5f86('0x29')](respondWithFilteredResult(_0x2eed7b,_0x595eeb))[_0x5f86('0x50')](handleError(_0x2eed7b,null));};exports[_0x5f86('0x63')]=function(_0x514b76,_0x421e30,_0x4a709d){var _0x18127c={'raw':!![],'where':{}};var _0x328dca={};var _0x36e926={'count':0x0,'rows':[]};return db[_0x5f86('0x34')][_0x5f86('0x5e')]({'where':{'id':_0x514b76[_0x5f86('0x4c')]['id']}})[_0x5f86('0x29')](handleEntityNotFound(_0x421e30,null))[_0x5f86('0x29')](function(_0x3dfd90){if(_0x3dfd90){_0x328dca[_0x5f86('0x39')]=_[_0x5f86('0x37')](db[_0x5f86('0x64')][_0x5f86('0x4d')]);_0x328dca[_0x5f86('0x36')]=_[_0x5f86('0x37')](_0x514b76['query']);_0x328dca[_0x5f86('0x38')]=_['intersection'](_0x328dca[_0x5f86('0x39')],_0x328dca[_0x5f86('0x36')]);_0x18127c['attributes']=_[_0x5f86('0x3b')](_0x328dca[_0x5f86('0x39')],qs[_0x5f86('0x3c')](_0x514b76[_0x5f86('0x36')]['fields']));_0x18127c[_0x5f86('0x3a')]=_0x18127c[_0x5f86('0x3a')]['length']?_0x18127c[_0x5f86('0x3a')]:_0x328dca[_0x5f86('0x39')];if(!_0x514b76[_0x5f86('0x36')][_0x5f86('0x3e')](_0x5f86('0x3f'))){_0x18127c['limit']=qs[_0x5f86('0x21')](_0x514b76[_0x5f86('0x36')][_0x5f86('0x21')]);_0x18127c[_0x5f86('0x1f')]=qs['offset'](_0x514b76[_0x5f86('0x36')][_0x5f86('0x1f')]);}_0x18127c[_0x5f86('0x40')]=qs['sort'](_0x514b76[_0x5f86('0x36')][_0x5f86('0x41')]);_0x18127c[_0x5f86('0x42')]=qs['filters'](_[_0x5f86('0x43')](_0x514b76[_0x5f86('0x36')],_0x328dca[_0x5f86('0x38')]));_0x18127c['where'][_0x5f86('0x60')]=_0x3dfd90['id'];if(_0x514b76['query']['filter']){_0x18127c['where']=_['merge'](_0x18127c[_0x5f86('0x42')],{'$or':_['map'](_0x18127c[_0x5f86('0x3a')],function(_0x5841cf){var _0x4c18d6={};_0x4c18d6[_0x5841cf]={'$like':'%'+_0x514b76['query'][_0x5f86('0x44')]+'%'};return _0x4c18d6;})});}_0x18127c=_[_0x5f86('0x45')]({},_0x18127c,_0x514b76[_0x5f86('0x48')]);return db['CmHopperFinal']['count']({'where':_0x18127c[_0x5f86('0x42')]})[_0x5f86('0x29')](function(_0x1d2922){_0x36e926[_0x5f86('0x22')]=_0x1d2922;if(_0x514b76[_0x5f86('0x36')]['includeAll']){_0x18127c[_0x5f86('0x4e')]=[{'all':!![]}];}return db[_0x5f86('0x64')][_0x5f86('0x4a')](_0x18127c);})['then'](function(_0x5cbf69){_0x36e926[_0x5f86('0x65')]=_0x5cbf69;return _0x36e926;});}})[_0x5f86('0x29')](respondWithFilteredResult(_0x421e30,_0x18127c))[_0x5f86('0x50')](handleError(_0x421e30,null));};exports[_0x5f86('0x66')]=function(_0x43c01a,_0x3d4c11,_0x87b63a){var _0x186b73={'raw':!![],'where':{}};var _0x271b5c={};var _0x38a57a={'count':0x0,'rows':[]};return db['Campaign'][_0x5f86('0x5e')]({'where':{'id':_0x43c01a[_0x5f86('0x4c')]['id']}})[_0x5f86('0x29')](handleEntityNotFound(_0x3d4c11,null))[_0x5f86('0x29')](function(_0x5596c1){if(_0x5596c1){_0x271b5c[_0x5f86('0x39')]=_['keys'](db[_0x5f86('0x67')]['rawAttributes']);_0x271b5c[_0x5f86('0x36')]=_[_0x5f86('0x37')](_0x43c01a[_0x5f86('0x36')]);_0x271b5c[_0x5f86('0x38')]=_[_0x5f86('0x3b')](_0x271b5c['model'],_0x271b5c['query']);_0x186b73[_0x5f86('0x3a')]=_['intersection'](_0x271b5c[_0x5f86('0x39')],qs[_0x5f86('0x3c')](_0x43c01a['query']['fields']));_0x186b73[_0x5f86('0x3a')]=_0x186b73[_0x5f86('0x3a')]['length']?_0x186b73[_0x5f86('0x3a')]:_0x271b5c[_0x5f86('0x39')];if(!_0x43c01a[_0x5f86('0x36')][_0x5f86('0x3e')](_0x5f86('0x3f'))){_0x186b73[_0x5f86('0x21')]=qs['limit'](_0x43c01a['query']['limit']);_0x186b73['offset']=qs['offset'](_0x43c01a[_0x5f86('0x36')]['offset']);}_0x186b73[_0x5f86('0x40')]=qs['sort'](_0x43c01a[_0x5f86('0x36')]['sort']);_0x186b73[_0x5f86('0x42')]=qs[_0x5f86('0x38')](_[_0x5f86('0x43')](_0x43c01a[_0x5f86('0x36')],_0x271b5c[_0x5f86('0x38')]));_0x186b73[_0x5f86('0x42')][_0x5f86('0x60')]=_0x5596c1['id'];if(_0x43c01a['query']['filter']){_0x186b73[_0x5f86('0x42')]=_[_0x5f86('0x45')](_0x186b73[_0x5f86('0x42')],{'$or':_[_0x5f86('0x33')](_0x186b73[_0x5f86('0x3a')],function(_0x224f9c){var _0x302cf2={};_0x302cf2[_0x224f9c]={'$like':'%'+_0x43c01a['query']['filter']+'%'};return _0x302cf2;})});}_0x186b73=_['merge']({},_0x186b73,_0x43c01a[_0x5f86('0x48')]);return db[_0x5f86('0x67')]['count']({'where':_0x186b73[_0x5f86('0x42')]})[_0x5f86('0x29')](function(_0x36da41){_0x38a57a[_0x5f86('0x22')]=_0x36da41;if(_0x43c01a['query']['includeAll']){_0x186b73[_0x5f86('0x4e')]=[{'all':!![]}];}return db[_0x5f86('0x67')][_0x5f86('0x4a')](_0x186b73);})[_0x5f86('0x29')](function(_0x4eba8a){_0x38a57a['rows']=_0x4eba8a;return _0x38a57a;});}})[_0x5f86('0x29')](respondWithFilteredResult(_0x3d4c11,_0x186b73))['catch'](handleError(_0x3d4c11,null));};exports[_0x5f86('0x68')]=function(_0x2e6ae5,_0x1ae560,_0x1e5950){var _0x29e417={};var _0x5741df={};var _0x409be3;var _0x1f0588;return db[_0x5f86('0x34')][_0x5f86('0x5e')]({'where':{'id':_0x2e6ae5[_0x5f86('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ae560,null))[_0x5f86('0x29')](function(_0x2916a5){if(_0x2916a5){_0x409be3=_0x2916a5;_0x5741df[_0x5f86('0x39')]=_[_0x5f86('0x37')](db['CmList']['rawAttributes']);_0x5741df[_0x5f86('0x36')]=_[_0x5f86('0x37')](_0x2e6ae5[_0x5f86('0x36')]);_0x5741df[_0x5f86('0x38')]=_[_0x5f86('0x3b')](_0x5741df['model'],_0x5741df[_0x5f86('0x36')]);_0x29e417['attributes']=_[_0x5f86('0x3b')](_0x5741df['model'],qs[_0x5f86('0x3c')](_0x2e6ae5[_0x5f86('0x36')]['fields']));_0x29e417[_0x5f86('0x3a')]=_0x29e417[_0x5f86('0x3a')][_0x5f86('0x3d')]?_0x29e417[_0x5f86('0x3a')]:_0x5741df['model'];_0x29e417[_0x5f86('0x40')]=qs[_0x5f86('0x41')](_0x2e6ae5['query'][_0x5f86('0x41')]);_0x29e417[_0x5f86('0x42')]=qs[_0x5f86('0x38')](_[_0x5f86('0x43')](_0x2e6ae5[_0x5f86('0x36')],_0x5741df[_0x5f86('0x38')]));if(_0x2e6ae5[_0x5f86('0x36')][_0x5f86('0x44')]){_0x29e417['where']=_[_0x5f86('0x45')](_0x29e417[_0x5f86('0x42')],{'$or':_[_0x5f86('0x33')](_0x29e417['attributes'],function(_0x18de58){var _0x42cdf0={};_0x42cdf0[_0x18de58]={'$like':'%'+_0x2e6ae5['query'][_0x5f86('0x44')]+'%'};return _0x42cdf0;})});}_0x29e417=_[_0x5f86('0x45')]({},_0x29e417,_0x2e6ae5[_0x5f86('0x48')]);return _0x409be3['getLists'](_0x29e417);}})[_0x5f86('0x29')](function(_0x35f61e){if(_0x35f61e){_0x1f0588=_0x35f61e[_0x5f86('0x3d')];if(!_0x2e6ae5[_0x5f86('0x36')][_0x5f86('0x3e')]('nolimit')){_0x29e417['limit']=qs['limit'](_0x2e6ae5[_0x5f86('0x36')]['limit']);_0x29e417['offset']=qs[_0x5f86('0x1f')](_0x2e6ae5[_0x5f86('0x36')]['offset']);}return _0x409be3['getLists'](_0x29e417);}})[_0x5f86('0x29')](function(_0x57ffc9){if(_0x57ffc9){return _0x57ffc9?{'count':_0x1f0588,'rows':_0x57ffc9}:null;}})[_0x5f86('0x29')](respondWithResult(_0x1ae560,null))[_0x5f86('0x50')](handleError(_0x1ae560,null));};exports['addLists']=function(_0x4d86cd,_0x3d61f9,_0xb75368){var _0x18e4de,_0x23edde;var _0x302b7b=[];var _0x5505b6=moment()[_0x5f86('0x69')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x5f86('0x34')][_0x5f86('0x4f')]({'where':{'id':_0x4d86cd[_0x5f86('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3d61f9,null))[_0x5f86('0x29')](function(_0x1416c2){if(_0x1416c2){_0x23edde=_0x1416c2;return _0x1416c2[_0x5f86('0x6a')](_0x4d86cd[_0x5f86('0x5c')][_0x5f86('0x6b')],_[_0x5f86('0x5a')](_0x4d86cd['body'],['ids','id'])||{});}return null;})[_0x5f86('0x6c')](function(_0x9e4aca){var _0x4b92f5;var _0x472a54;_0x18e4de=_0x9e4aca||[];var _0x3eb150=[];if(_0x9e4aca){for(var _0x4c6e59=0x0;_0x4c6e59<_0x9e4aca[_0x5f86('0x3d')];_0x4c6e59+=0x1){var _0x543540=_0x9e4aca[_0x4c6e59][_0x5f86('0x2a')]({'plain':!![]});_0x23edde['dialCheckDuplicateType']=_0x4d86cd[_0x5f86('0x5c')]['dialCheckDuplicateType']?_0x4d86cd['body']['dialCheckDuplicateType']:_0x23edde[_0x5f86('0x6d')];switch(_0x23edde[_0x5f86('0x6d')]){case _0x5f86('0x6e'):_0x4b92f5=squel[_0x5f86('0x6f')]()[_0x5f86('0x70')](_0x5f86('0x71'))[_0x5f86('0x72')](['phone',_0x5f86('0x73'),'ContactId','ListId',_0x5f86('0x60'),_0x5f86('0x59'),'updatedAt'],squel[_0x5f86('0x74')]()[_0x5f86('0x75')](_0x5f86('0x76'),_0x5f86('0x76'))['field'](_0x5f86('0x77'),'scheduledAt')['field']('id',_0x5f86('0x78'))['field'](_0x543540[_0x5f86('0x79')][_0x5f86('0x7a')](),_0x5f86('0x7b'))[_0x5f86('0x75')](_0x4d86cd[_0x5f86('0x4c')]['id'][_0x5f86('0x7a')](),_0x5f86('0x60'))['field']('\x27'+_0x5505b6+'\x27',_0x5f86('0x59'))[_0x5f86('0x75')]('\x27'+_0x5505b6+'\x27',_0x5f86('0x5b'))[_0x5f86('0x7c')](_0x5f86('0x7d'))[_0x5f86('0x42')](_0x5f86('0x7e'))['where'](_0x5f86('0x7f'),_0x543540[_0x5f86('0x79')]['toString']())['where'](_0x5f86('0x80'))[_0x5f86('0x42')](_0x5f86('0x81'),squel[_0x5f86('0x74')]()[_0x5f86('0x75')](_0x5f86('0x82'))[_0x5f86('0x7c')](_0x5f86('0x83'))[_0x5f86('0x42')](_0x5f86('0x84'),_0x4d86cd[_0x5f86('0x4c')]['id'][_0x5f86('0x7a')]()))[_0x5f86('0x42')](_0x5f86('0x81'),squel[_0x5f86('0x74')]()[_0x5f86('0x75')](_0x5f86('0x85'))[_0x5f86('0x7c')](_0x5f86('0x71'))[_0x5f86('0x42')]('CampaignId\x20=\x20?',_0x4d86cd[_0x5f86('0x4c')]['id'][_0x5f86('0x7a')]())))[_0x5f86('0x7a')]();break;case'onlyIfOpen':_0x4b92f5=squel[_0x5f86('0x6f')]()['into']('cm_hopper')[_0x5f86('0x72')]([_0x5f86('0x76'),_0x5f86('0x73'),'ContactId',_0x5f86('0x7b'),_0x5f86('0x60'),_0x5f86('0x59'),'updatedAt'],squel[_0x5f86('0x74')]()[_0x5f86('0x75')]('phone','phone')[_0x5f86('0x75')]('NOW()',_0x5f86('0x73'))['field']('id',_0x5f86('0x78'))[_0x5f86('0x75')](_0x543540[_0x5f86('0x79')][_0x5f86('0x7a')](),'ListId')[_0x5f86('0x75')](_0x4d86cd[_0x5f86('0x4c')]['id'][_0x5f86('0x7a')](),'CampaignId')['field']('\x27'+_0x5505b6+'\x27',_0x5f86('0x59'))[_0x5f86('0x75')]('\x27'+_0x5505b6+'\x27',_0x5f86('0x5b'))['from'](_0x5f86('0x7d'))[_0x5f86('0x42')](_0x5f86('0x7e'))[_0x5f86('0x42')](_0x5f86('0x7f'),_0x543540[_0x5f86('0x79')][_0x5f86('0x7a')]())[_0x5f86('0x42')](_0x5f86('0x80'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x5f86('0x75')](_0x5f86('0x85'))[_0x5f86('0x7c')]('cm_hopper')[_0x5f86('0x42')](_0x5f86('0x84'),_0x4d86cd[_0x5f86('0x4c')]['id'][_0x5f86('0x7a')]())))[_0x5f86('0x7a')]();break;default:_0x4b92f5=squel[_0x5f86('0x6f')]()[_0x5f86('0x70')](_0x5f86('0x71'))[_0x5f86('0x72')]([_0x5f86('0x76'),_0x5f86('0x73'),_0x5f86('0x78'),_0x5f86('0x7b'),'CampaignId',_0x5f86('0x59'),_0x5f86('0x5b')],squel[_0x5f86('0x74')]()[_0x5f86('0x75')]('phone','phone')[_0x5f86('0x75')](_0x5f86('0x77'),_0x5f86('0x73'))[_0x5f86('0x75')]('id',_0x5f86('0x78'))[_0x5f86('0x75')](_0x543540[_0x5f86('0x79')][_0x5f86('0x7a')](),_0x5f86('0x7b'))[_0x5f86('0x75')](_0x4d86cd[_0x5f86('0x4c')]['id'][_0x5f86('0x7a')](),_0x5f86('0x60'))[_0x5f86('0x75')]('\x27'+_0x5505b6+'\x27','createdAt')[_0x5f86('0x75')]('\x27'+_0x5505b6+'\x27',_0x5f86('0x5b'))[_0x5f86('0x7c')]('cm_contacts')[_0x5f86('0x42')](_0x5f86('0x7e'))[_0x5f86('0x42')](_0x5f86('0x7f'),_0x543540[_0x5f86('0x79')][_0x5f86('0x7a')]())[_0x5f86('0x42')](_0x5f86('0x80')))[_0x5f86('0x7a')]();}_0x472a54=squel['insert']()['into'](_0x5f86('0x86'))[_0x5f86('0x72')]([_0x5f86('0x87'),'scheduledAt',_0x5f86('0x76'),'OrderBy',_0x5f86('0x59'),_0x5f86('0x5b')],squel[_0x5f86('0x74')]()[_0x5f86('0x75')](_0x5f86('0x88'),'id')[_0x5f86('0x75')](_0x5f86('0x77'),_0x5f86('0x73'))['field']('ci.item',_0x5f86('0x76'))[_0x5f86('0x75')]('ci.OrderBY','OrderBy')[_0x5f86('0x75')]('\x27'+_0x5505b6+'\x27',_0x5f86('0x59'))[_0x5f86('0x75')]('\x27'+_0x5505b6+'\x27','updatedAt')['from'](_0x5f86('0x89'),'ci')[_0x5f86('0x8a')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x5f86('0x42')](_0x5f86('0x8b'),_0x543540[_0x5f86('0x79')][_0x5f86('0x7a')]())[_0x5f86('0x42')](_0x5f86('0x8c'),_0x4d86cd['params']['id'][_0x5f86('0x7a')]())[_0x5f86('0x42')]('h.createdAt\x20=\x20?',_0x5505b6))[_0x5f86('0x7a')]();_0x3eb150['push'](db['sequelize'][_0x5f86('0x36')](_0x4b92f5));_0x302b7b['push'](db[_0x5f86('0x8d')]['query'](_0x472a54));}return BPromise[_0x5f86('0x8e')](_0x3eb150);}})[_0x5f86('0x29')](function(){return BPromise[_0x5f86('0x8e')](_0x302b7b);})['then'](function(){return _0x18e4de;})[_0x5f86('0x29')](respondWithResult(_0x3d61f9,null))[_0x5f86('0x50')](handleError(_0x3d61f9,null));};exports['removeLists']=function(_0x1ca6df,_0x331095,_0x2790e4){return db[_0x5f86('0x34')][_0x5f86('0x4f')]({'where':{'id':_0x1ca6df[_0x5f86('0x4c')]['id']}})[_0x5f86('0x29')](handleEntityNotFound(_0x331095,null))[_0x5f86('0x29')](function(_0xa99dfb){if(_0xa99dfb){return _0xa99dfb[_0x5f86('0x8f')](_0x1ca6df[_0x5f86('0x36')]['ids']);}})[_0x5f86('0x29')](function(_0x5704c9){if(_0x5704c9){return db['CmHopper']['destroy']({'where':{'ListId':_0x1ca6df[_0x5f86('0x36')]['ids'],'CampaignId':_0x1ca6df[_0x5f86('0x4c')]['id']}})[_0x5f86('0x29')](function(){return _0x5704c9;});}})[_0x5f86('0x29')](respondWithStatusCode(_0x331095,null))[_0x5f86('0x50')](handleError(_0x331095,null));};exports[_0x5f86('0x90')]=function(_0x34db56,_0x5bf59b,_0x459e9c){var _0x1f2b00={};var _0x30787a={};var _0x5d0f1c;var _0xf14022;return db[_0x5f86('0x34')]['findOne']({'where':{'id':_0x34db56[_0x5f86('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5bf59b,null))[_0x5f86('0x29')](function(_0x9b74b3){if(_0x9b74b3){_0x5d0f1c=_0x9b74b3;_0x30787a[_0x5f86('0x39')]=_['keys'](db[_0x5f86('0x91')][_0x5f86('0x4d')]);_0x30787a[_0x5f86('0x36')]=_['keys'](_0x34db56['query']);_0x30787a['filters']=_['intersection'](_0x30787a[_0x5f86('0x39')],_0x30787a[_0x5f86('0x36')]);_0x1f2b00['attributes']=_[_0x5f86('0x3b')](_0x30787a[_0x5f86('0x39')],qs[_0x5f86('0x3c')](_0x34db56[_0x5f86('0x36')]['fields']));_0x1f2b00[_0x5f86('0x3a')]=_0x1f2b00[_0x5f86('0x3a')][_0x5f86('0x3d')]?_0x1f2b00['attributes']:_0x30787a[_0x5f86('0x39')];_0x1f2b00[_0x5f86('0x40')]=qs['sort'](_0x34db56[_0x5f86('0x36')][_0x5f86('0x41')]);_0x1f2b00[_0x5f86('0x42')]=qs['filters'](_[_0x5f86('0x43')](_0x34db56[_0x5f86('0x36')],_0x30787a['filters']));if(_0x34db56[_0x5f86('0x36')][_0x5f86('0x44')]){_0x1f2b00['where']=_[_0x5f86('0x45')](_0x1f2b00[_0x5f86('0x42')],{'$or':_[_0x5f86('0x33')](_0x1f2b00[_0x5f86('0x3a')],function(_0x781fc5){var _0x2bf234={};_0x2bf234[_0x781fc5]={'$like':'%'+_0x34db56[_0x5f86('0x36')][_0x5f86('0x44')]+'%'};return _0x2bf234;})});}_0x1f2b00=_[_0x5f86('0x45')]({},_0x1f2b00,_0x34db56['options']);return _0x5d0f1c[_0x5f86('0x90')](_0x1f2b00);}})[_0x5f86('0x29')](function(_0x461f22){if(_0x461f22){_0xf14022=_0x461f22['length'];if(!_0x34db56['query']['hasOwnProperty'](_0x5f86('0x3f'))){_0x1f2b00[_0x5f86('0x21')]=qs[_0x5f86('0x21')](_0x34db56['query'][_0x5f86('0x21')]);_0x1f2b00[_0x5f86('0x1f')]=qs['offset'](_0x34db56[_0x5f86('0x36')][_0x5f86('0x1f')]);}return _0x5d0f1c[_0x5f86('0x90')](_0x1f2b00);}})[_0x5f86('0x29')](function(_0x1c4e68){if(_0x1c4e68){return _0x1c4e68?{'count':_0xf14022,'rows':_0x1c4e68}:null;}})[_0x5f86('0x29')](respondWithResult(_0x5bf59b,null))[_0x5f86('0x50')](handleError(_0x5bf59b,null));};exports[_0x5f86('0x92')]=function(_0x34f581,_0x20febd,_0x2dcd19){var _0xf5bf07,_0x3547f1;var _0x5cb461=[];var _0xdca4e7=moment()[_0x5f86('0x69')](_0x5f86('0x93'));return db[_0x5f86('0x34')]['find']({'where':{'id':_0x34f581['params']['id']}})[_0x5f86('0x29')](handleEntityNotFound(_0x20febd,null))['then'](function(_0x2901f2){if(_0x2901f2){_0x3547f1=_0x2901f2;return _0x2901f2[_0x5f86('0x92')](_0x34f581[_0x5f86('0x5c')][_0x5f86('0x6b')],_['omit'](_0x34f581[_0x5f86('0x5c')],[_0x5f86('0x6b'),'id'])||{});}return null;})['spread'](function(_0x5603db){var _0x225c4e;var _0x3d7a56;_0xf5bf07=_0x5603db||[];var _0x570f6b=[];if(_0x5603db){for(var _0x3ccc0e=0x0;_0x3ccc0e<_0x5603db[_0x5f86('0x3d')];_0x3ccc0e+=0x1){var _0x299ba3=_0x5603db[_0x3ccc0e][_0x5f86('0x2a')]({'plain':!![]});_0x225c4e=squel['insert']()[_0x5f86('0x70')](_0x5f86('0x94'))[_0x5f86('0x72')]([_0x5f86('0x76'),_0x5f86('0x78'),_0x5f86('0x7b'),'CampaignId',_0x5f86('0x59'),_0x5f86('0x5b')],squel[_0x5f86('0x74')]()['field'](_0x5f86('0x76'),_0x5f86('0x76'))[_0x5f86('0x75')]('id',_0x5f86('0x78'))['field'](_0x299ba3[_0x5f86('0x79')][_0x5f86('0x7a')](),'ListId')[_0x5f86('0x75')](_0x34f581[_0x5f86('0x4c')]['id'][_0x5f86('0x7a')](),_0x5f86('0x60'))['field'](_0x5f86('0x77'),_0x5f86('0x59'))[_0x5f86('0x75')](_0x5f86('0x77'),'updatedAt')[_0x5f86('0x7c')](_0x5f86('0x7d'))[_0x5f86('0x42')](_0x5f86('0x7e'))[_0x5f86('0x42')](_0x5f86('0x7f'),_0x299ba3[_0x5f86('0x79')]['toString']())[_0x5f86('0x42')](_0x5f86('0x80')))[_0x5f86('0x7a')]();_0x570f6b[_0x5f86('0x95')](db[_0x5f86('0x8d')][_0x5f86('0x36')](_0x225c4e));}return BPromise[_0x5f86('0x8e')](_0x570f6b);}})[_0x5f86('0x29')](function(){return _0xf5bf07;})[_0x5f86('0x29')](respondWithResult(_0x20febd,null))[_0x5f86('0x50')](handleError(_0x20febd,null));};exports[_0x5f86('0x96')]=function(_0x1fbb1c,_0xbd0321,_0x4be8ce){return db[_0x5f86('0x34')][_0x5f86('0x4f')]({'where':{'id':_0x1fbb1c[_0x5f86('0x4c')]['id']}})[_0x5f86('0x29')](handleEntityNotFound(_0xbd0321,null))[_0x5f86('0x29')](function(_0x298c79){if(_0x298c79){return _0x298c79[_0x5f86('0x96')](_0x1fbb1c[_0x5f86('0x36')][_0x5f86('0x6b')]);}})[_0x5f86('0x29')](function(_0x5debb2){if(_0x5debb2){return db[_0x5f86('0x67')][_0x5f86('0x2d')]({'where':{'ListId':_0x1fbb1c[_0x5f86('0x36')]['ids'],'CampaignId':_0x1fbb1c[_0x5f86('0x4c')]['id']}})[_0x5f86('0x29')](function(){return _0x5debb2;});}})[_0x5f86('0x29')](respondWithStatusCode(_0xbd0321,null))[_0x5f86('0x50')](handleError(_0xbd0321,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index afdc304..03896d6 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(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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(_0x2bb0ff,_0x22c9e2){var _0x497825=function(_0x168536){while(--_0x168536){_0x2bb0ff['push'](_0x2bb0ff['shift']());}};_0x497825(++_0x22c9e2);}(_0x7a54,0x106));var _0x47a5=function(_0x1e79bf,_0x42f39e){_0x1e79bf=_0x1e79bf-0x0;var _0xb379ea=_0x7a54[_0x1e79bf];return _0xb379ea;};'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 f05638c..5564c6b 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 _0x8c99=['limit','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','findAll','options','raw','attributes'];(function(_0x31e94d,_0x19454d){var _0x2fbb0a=function(_0x5ac89b){while(--_0x5ac89b){_0x31e94d['push'](_0x31e94d['shift']());}};_0x2fbb0a(++_0x19454d);}(_0x8c99,0x1a8));var _0x98c9=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0x8c99[_0xaaf2e2];return _0x28bc36;};'use strict';var _=require(_0x98c9('0x0'));var util=require(_0x98c9('0x1'));var moment=require(_0x98c9('0x2'));var BPromise=require(_0x98c9('0x3'));var rs=require(_0x98c9('0x4'));var fs=require('fs');var Redis=require(_0x98c9('0x5'));var db=require(_0x98c9('0x6'))['db'];var utils=require(_0x98c9('0x7'));var logger=require(_0x98c9('0x8'))(_0x98c9('0x9'));var config=require(_0x98c9('0xa'));var jayson=require(_0x98c9('0xb'));var client=jayson['client'][_0x98c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ed2b6,_0x538465,_0x4af8a6){return new BPromise(function(_0x5b983e,_0xc789b1){return client[_0x98c9('0xd')](_0x2ed2b6,_0x4af8a6)[_0x98c9('0xe')](function(_0x4052cf){logger[_0x98c9('0xf')](_0x98c9('0x10'),_0x538465,_0x98c9('0x11'));logger[_0x98c9('0x12')](_0x98c9('0x13'),_0x538465,_0x98c9('0x11'),JSON[_0x98c9('0x14')](_0x4052cf));if(_0x4052cf['error']){if(_0x4052cf[_0x98c9('0x15')][_0x98c9('0x16')]===0x1f4){logger[_0x98c9('0x15')](_0x98c9('0x10'),_0x538465,_0x4052cf['error'][_0x98c9('0x17')]);return _0xc789b1(_0x4052cf[_0x98c9('0x15')][_0x98c9('0x17')]);}logger[_0x98c9('0x15')](_0x98c9('0x10'),_0x538465,_0x4052cf['error'][_0x98c9('0x17')]);return _0x5b983e(_0x4052cf[_0x98c9('0x15')][_0x98c9('0x17')]);}else{logger[_0x98c9('0xf')](_0x98c9('0x10'),_0x538465,_0x98c9('0x11'));_0x5b983e(_0x4052cf[_0x98c9('0x18')][_0x98c9('0x17')]);}})[_0x98c9('0x19')](function(_0x2bb8b6){logger[_0x98c9('0x15')](_0x98c9('0x10'),_0x538465,_0x2bb8b6);_0xc789b1(_0x2bb8b6);});});}exports[_0x98c9('0x1a')]=function(_0x39ed74){var _0x534903=this;return new Promise(function(_0x351254,_0x22fe71){return db['Campaign'][_0x98c9('0x1b')]({'raw':_0x39ed74['options']?_0x39ed74[_0x98c9('0x1c')][_0x98c9('0x1d')]===undefined?!![]:![]:!![],'where':_0x39ed74[_0x98c9('0x1c')]?_0x39ed74[_0x98c9('0x1c')]['where']||null:null,'attributes':_0x39ed74[_0x98c9('0x1c')]?_0x39ed74[_0x98c9('0x1c')][_0x98c9('0x1e')]||null:null,'limit':_0x39ed74[_0x98c9('0x1c')]?_0x39ed74['options'][_0x98c9('0x1f')]||null:null,'include':_0x39ed74[_0x98c9('0x1c')]?_0x39ed74[_0x98c9('0x1c')][_0x98c9('0x20')]?_['map'](_0x39ed74['options'][_0x98c9('0x20')],function(_0x4373cc){return{'model':db[_0x4373cc[_0x98c9('0x21')]],'as':_0x4373cc['as'],'attributes':_0x4373cc['attributes'],'include':_0x4373cc['include']?_['map'](_0x4373cc[_0x98c9('0x20')],function(_0x1653e0){return{'model':db[_0x1653e0['model']],'as':_0x1653e0['as'],'attributes':_0x1653e0[_0x98c9('0x1e')],'include':_0x1653e0[_0x98c9('0x20')]?_[_0x98c9('0x22')](_0x1653e0[_0x98c9('0x20')],function(_0x3f503a){return{'model':db[_0x3f503a[_0x98c9('0x21')]],'as':_0x3f503a['as'],'attributes':_0x3f503a['attributes']};}):[]};}):[]};}):[]:[]})[_0x98c9('0xe')](function(_0x361305){logger[_0x98c9('0xf')](_0x98c9('0x1a'),_0x39ed74);logger[_0x98c9('0x12')]('GetCampaign',_0x39ed74,JSON[_0x98c9('0x14')](_0x361305));_0x351254(_0x361305);})[_0x98c9('0x19')](function(_0x58c6e3){logger[_0x98c9('0x15')]('GetCampaign',_0x58c6e3['message'],_0x39ed74);_0x22fe71(_0x534903[_0x98c9('0x15')](0x1f4,_0x58c6e3['message']));});});}; \ No newline at end of file +var _0x12fd=['catch','GetCampaign','Campaign','options','raw','where','attributes','limit','include','map','model','debug','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','Campaign,\x20%s,\x20%s','result'];(function(_0x2894d5,_0x159d6b){var _0x343dd7=function(_0x3ee396){while(--_0x3ee396){_0x2894d5['push'](_0x2894d5['shift']());}};_0x343dd7(++_0x159d6b);}(_0x12fd,0x199));var _0xd12f=function(_0x1c47e4,_0x3705e7){_0x1c47e4=_0x1c47e4-0x0;var _0x555f11=_0x12fd[_0x1c47e4];return _0x555f11;};'use strict';var _=require(_0xd12f('0x0'));var util=require(_0xd12f('0x1'));var moment=require(_0xd12f('0x2'));var BPromise=require(_0xd12f('0x3'));var rs=require(_0xd12f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd12f('0x5'))['db'];var utils=require(_0xd12f('0x6'));var logger=require(_0xd12f('0x7'))(_0xd12f('0x8'));var config=require(_0xd12f('0x9'));var jayson=require(_0xd12f('0xa'));var client=jayson['client'][_0xd12f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ca6e6,_0x285abf,_0x193e89){return new BPromise(function(_0x62de68,_0x40aaf8){return client['request'](_0x5ca6e6,_0x193e89)[_0xd12f('0xc')](function(_0x539473){logger[_0xd12f('0xd')]('Campaign,\x20%s,\x20%s',_0x285abf,'request\x20sent');logger['debug'](_0xd12f('0xe'),_0x285abf,_0xd12f('0xf'),JSON['stringify'](_0x539473));if(_0x539473['error']){if(_0x539473['error']['code']===0x1f4){logger[_0xd12f('0x10')]('Campaign,\x20%s,\x20%s',_0x285abf,_0x539473[_0xd12f('0x10')][_0xd12f('0x11')]);return _0x40aaf8(_0x539473['error'][_0xd12f('0x11')]);}logger[_0xd12f('0x10')]('Campaign,\x20%s,\x20%s',_0x285abf,_0x539473['error']['message']);return _0x62de68(_0x539473[_0xd12f('0x10')][_0xd12f('0x11')]);}else{logger[_0xd12f('0xd')](_0xd12f('0x12'),_0x285abf,_0xd12f('0xf'));_0x62de68(_0x539473[_0xd12f('0x13')][_0xd12f('0x11')]);}})[_0xd12f('0x14')](function(_0x4769a2){logger['error']('Campaign,\x20%s,\x20%s',_0x285abf,_0x4769a2);_0x40aaf8(_0x4769a2);});});}exports[_0xd12f('0x15')]=function(_0x45ff4d){var _0x58a653=this;return new Promise(function(_0x14c619,_0x12c884){return db[_0xd12f('0x16')]['findAll']({'raw':_0x45ff4d['options']?_0x45ff4d[_0xd12f('0x17')][_0xd12f('0x18')]===undefined?!![]:![]:!![],'where':_0x45ff4d[_0xd12f('0x17')]?_0x45ff4d[_0xd12f('0x17')][_0xd12f('0x19')]||null:null,'attributes':_0x45ff4d[_0xd12f('0x17')]?_0x45ff4d['options'][_0xd12f('0x1a')]||null:null,'limit':_0x45ff4d[_0xd12f('0x17')]?_0x45ff4d[_0xd12f('0x17')][_0xd12f('0x1b')]||null:null,'include':_0x45ff4d[_0xd12f('0x17')]?_0x45ff4d[_0xd12f('0x17')][_0xd12f('0x1c')]?_[_0xd12f('0x1d')](_0x45ff4d[_0xd12f('0x17')][_0xd12f('0x1c')],function(_0x42eb92){return{'model':db[_0x42eb92[_0xd12f('0x1e')]],'as':_0x42eb92['as'],'attributes':_0x42eb92[_0xd12f('0x1a')],'include':_0x42eb92[_0xd12f('0x1c')]?_[_0xd12f('0x1d')](_0x42eb92[_0xd12f('0x1c')],function(_0x2218fe){return{'model':db[_0x2218fe[_0xd12f('0x1e')]],'as':_0x2218fe['as'],'attributes':_0x2218fe[_0xd12f('0x1a')],'include':_0x2218fe[_0xd12f('0x1c')]?_[_0xd12f('0x1d')](_0x2218fe[_0xd12f('0x1c')],function(_0x3d71be){return{'model':db[_0x3d71be['model']],'as':_0x3d71be['as'],'attributes':_0x3d71be[_0xd12f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x163f95){logger[_0xd12f('0xd')]('GetCampaign',_0x45ff4d);logger[_0xd12f('0x1f')]('GetCampaign',_0x45ff4d,JSON[_0xd12f('0x20')](_0x163f95));_0x14c619(_0x163f95);})[_0xd12f('0x14')](function(_0x3418de){logger[_0xd12f('0x10')]('GetCampaign',_0x3418de['message'],_0x45ff4d);_0x12c884(_0x58a653[_0xd12f('0x10')](0x1f4,_0x3418de['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index d92f500..07cb181 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 _0x0a8d=['index','/:id','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_black','getHopperBlacks','getBlackLists','create','/:id/clone','post','/:id/lists','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeBlackLists','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x4e6588,_0x18805c){var _0x4d9433=function(_0xceab8a){while(--_0xceab8a){_0x4e6588['push'](_0x4e6588['shift']());}};_0x4d9433(++_0x18805c);}(_0x0a8d,0x89));var _0xd0a8=function(_0x1023ab,_0x2a9604){_0x1023ab=_0x1023ab-0x0;var _0x10701d=_0x0a8d[_0x1023ab];return _0x10701d;};'use strict';var multer=require(_0xd0a8('0x0'));var util=require(_0xd0a8('0x1'));var path=require('path');var timeout=require(_0xd0a8('0x2'));var express=require(_0xd0a8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd0a8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd0a8('0x5'));var controller=require('./campaign.controller');router[_0xd0a8('0x6')]('/',auth[_0xd0a8('0x7')](),controller[_0xd0a8('0x8')]);router['get'](_0xd0a8('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0xd0a8('0xa'),auth[_0xd0a8('0x7')](),controller[_0xd0a8('0xb')]);router[_0xd0a8('0x6')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xd0a8('0xc')]);router[_0xd0a8('0x6')]('/:id/hopper_finals',auth[_0xd0a8('0x7')](),controller['getHopperFinals']);router[_0xd0a8('0x6')](_0xd0a8('0xd'),auth[_0xd0a8('0x7')](),controller[_0xd0a8('0xe')]);router[_0xd0a8('0x6')]('/:id/lists',auth[_0xd0a8('0x7')](),controller['getLists']);router[_0xd0a8('0x6')]('/:id/blacklists',auth[_0xd0a8('0x7')](),controller[_0xd0a8('0xf')]);router['post']('/',auth[_0xd0a8('0x7')](),controller[_0xd0a8('0x10')]);router['post'](_0xd0a8('0x11'),auth[_0xd0a8('0x7')](),controller['clone']);router[_0xd0a8('0x12')](_0xd0a8('0x13'),auth[_0xd0a8('0x7')](),controller[_0xd0a8('0x14')]);router[_0xd0a8('0x12')](_0xd0a8('0x15'),auth[_0xd0a8('0x7')](),controller[_0xd0a8('0x16')]);router[_0xd0a8('0x17')](_0xd0a8('0x9'),auth[_0xd0a8('0x7')](),controller[_0xd0a8('0x18')]);router[_0xd0a8('0x19')](_0xd0a8('0x9'),auth[_0xd0a8('0x7')](),controller[_0xd0a8('0x1a')]);router[_0xd0a8('0x19')](_0xd0a8('0x13'),auth[_0xd0a8('0x7')](),controller['removeLists']);router[_0xd0a8('0x19')](_0xd0a8('0x15'),auth[_0xd0a8('0x7')](),controller[_0xd0a8('0x1b')]);module[_0xd0a8('0x1c')]=router; \ No newline at end of file +var _0x2da1=['/:id/hopper_black','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists','addLists','addBlackLists','put','delete','destroy','removeLists','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','/:id/hoppers','/:id/hopper_histories','getHopperHistories'];(function(_0x40e908,_0x1ef6fb){var _0x43fa83=function(_0xf63d35){while(--_0xf63d35){_0x40e908['push'](_0x40e908['shift']());}};_0x43fa83(++_0x1ef6fb);}(_0x2da1,0xca));var _0x12da=function(_0x26a776,_0xb78d93){_0x26a776=_0x26a776-0x0;var _0x440e98=_0x2da1[_0x26a776];return _0x440e98;};'use strict';var multer=require(_0x12da('0x0'));var util=require(_0x12da('0x1'));var path=require('path');var timeout=require(_0x12da('0x2'));var express=require('express');var router=express[_0x12da('0x3')]();var fs_extra=require(_0x12da('0x4'));var auth=require(_0x12da('0x5'));var interaction=require(_0x12da('0x6'));var config=require('../../config/environment');var controller=require(_0x12da('0x7'));router[_0x12da('0x8')]('/',auth[_0x12da('0x9')](),controller[_0x12da('0xa')]);router[_0x12da('0x8')](_0x12da('0xb'),auth[_0x12da('0x9')](),controller['show']);router[_0x12da('0x8')](_0x12da('0xc'),auth[_0x12da('0x9')](),controller['getHoppers']);router[_0x12da('0x8')](_0x12da('0xd'),auth[_0x12da('0x9')](),controller[_0x12da('0xe')]);router[_0x12da('0x8')]('/:id/hopper_finals',auth[_0x12da('0x9')](),controller['getHopperFinals']);router[_0x12da('0x8')](_0x12da('0xf'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0x12da('0x8')]('/:id/lists',auth[_0x12da('0x9')](),controller[_0x12da('0x10')]);router[_0x12da('0x8')](_0x12da('0x11'),auth['isAuthenticated'](),controller[_0x12da('0x12')]);router[_0x12da('0x13')]('/',auth[_0x12da('0x9')](),controller[_0x12da('0x14')]);router[_0x12da('0x13')](_0x12da('0x15'),auth['isAuthenticated'](),controller[_0x12da('0x16')]);router['post'](_0x12da('0x17'),auth[_0x12da('0x9')](),controller[_0x12da('0x18')]);router['post'](_0x12da('0x11'),auth[_0x12da('0x9')](),controller[_0x12da('0x19')]);router[_0x12da('0x1a')](_0x12da('0xb'),auth[_0x12da('0x9')](),controller['update']);router[_0x12da('0x1b')]('/:id',auth[_0x12da('0x9')](),controller[_0x12da('0x1c')]);router[_0x12da('0x1b')](_0x12da('0x17'),auth['isAuthenticated'](),controller[_0x12da('0x1d')]);router['delete']('/:id/blacklists',auth[_0x12da('0x9')](),controller['removeBlackLists']);module[_0x12da('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index f6bdcc4..0efc223 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 _0x14b5=['exports','STRING','medium','VIRTUAL','getDataValue','key','sequelize'];(function(_0x2c5d0c,_0x2efb70){var _0x4d7408=function(_0x1e66fe){while(--_0x1e66fe){_0x2c5d0c['push'](_0x2c5d0c['shift']());}};_0x4d7408(++_0x2efb70);}(_0x14b5,0x1a3));var _0x514b=function(_0xcea3b6,_0x434ab3){_0xcea3b6=_0xcea3b6-0x0;var _0x285105=_0x14b5[_0xcea3b6];return _0x285105;};'use strict';var Sequelize=require(_0x514b('0x0'));module[_0x514b('0x1')]={'key':{'type':Sequelize[_0x514b('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x514b('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x514b('0x2')]},'name':{'type':Sequelize[_0x514b('0x4')],'get':function(){return this[_0x514b('0x5')](_0x514b('0x6'));}}}; \ No newline at end of file +var _0xb6f3=['key','sequelize','STRING','TEXT','medium','getDataValue'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0xb6f3,0xb5));var _0x3b6f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xb6f3[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x3b6f('0x0'));module['exports']={'key':{'type':Sequelize[_0x3b6f('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x3b6f('0x2')],'length':_0x3b6f('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x3b6f('0x4')](_0x3b6f('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 1cf3142..c7207a6 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 _0x8927=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','CannedAnswer','include','findAll','show','params','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key'];(function(_0x451d1b,_0x491c93){var _0x1fed5e=function(_0x3aebcd){while(--_0x3aebcd){_0x451d1b['push'](_0x451d1b['shift']());}};_0x1fed5e(++_0x491c93);}(_0x8927,0xdc));var _0x7892=function(_0x558f77,_0xb93712){_0x558f77=_0x558f77-0x0;var _0x4a20e3=_0x8927[_0x558f77];return _0x4a20e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7892('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7892('0x1'));var rp=require(_0x7892('0x2'));var moment=require(_0x7892('0x3'));var BPromise=require(_0x7892('0x4'));var Mustache=require(_0x7892('0x5'));var util=require(_0x7892('0x6'));var path=require(_0x7892('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7892('0x8'));var fs=require('fs');var fs_extra=require(_0x7892('0x9'));var _=require(_0x7892('0xa'));var squel=require(_0x7892('0xb'));var crypto=require(_0x7892('0xc'));var jsforce=require(_0x7892('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7892('0xe'));var querystring=require(_0x7892('0xf'));var Papa=require(_0x7892('0x10'));var Redis=require(_0x7892('0x11'));var authService=require(_0x7892('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7892('0x13'));var hardwareService=require(_0x7892('0x14'));var logger=require(_0x7892('0x15'))('api');var utils=require(_0x7892('0x16'));var config=require(_0x7892('0x17'));var licenseUtil=require(_0x7892('0x18'));var db=require(_0x7892('0x19'))['db'];function respondWithStatusCode(_0xf802e,_0x8b3678){_0x8b3678=_0x8b3678||0xcc;return function(_0x1460d8){if(_0x1460d8){return _0xf802e[_0x7892('0x1a')](_0x8b3678);}return _0xf802e[_0x7892('0x1b')](_0x8b3678)[_0x7892('0x1c')]();};}function respondWithResult(_0x488e8f,_0x2fd5c6){_0x2fd5c6=_0x2fd5c6||0xc8;return function(_0x5210b2){if(_0x5210b2){return _0x488e8f[_0x7892('0x1b')](_0x2fd5c6)[_0x7892('0x1d')](_0x5210b2);}};}function respondWithFilteredResult(_0x1297b2,_0x223f09){return function(_0x3f44ef){if(_0x3f44ef){var _0x35c7eb=typeof _0x223f09['offset']===_0x7892('0x1e')&&typeof _0x223f09[_0x7892('0x1f')]==='undefined';var _0x34398a=_0x3f44ef['count'];var _0x3fff01=_0x35c7eb?0x0:_0x223f09[_0x7892('0x20')];var _0x504a59=_0x35c7eb?_0x3f44ef[_0x7892('0x21')]:_0x223f09['offset']+_0x223f09[_0x7892('0x1f')];var _0x28924;if(_0x504a59>=_0x34398a){_0x504a59=_0x34398a;_0x28924=0xc8;}else{_0x28924=0xce;}_0x1297b2['status'](_0x28924);return _0x1297b2[_0x7892('0x22')]('Content-Range',_0x3fff01+'-'+_0x504a59+'/'+_0x34398a)['json'](_0x3f44ef);}return null;};}function patchUpdates(_0x3835c4){return function(_0x8f97ba){try{jsonpatch[_0x7892('0x23')](_0x8f97ba,_0x3835c4,!![]);}catch(_0x490ab2){return BPromise[_0x7892('0x24')](_0x490ab2);}return _0x8f97ba[_0x7892('0x25')]();};}function saveUpdates(_0x21df42,_0x5c8400){return function(_0x3ac33c){if(_0x3ac33c){return _0x3ac33c[_0x7892('0x26')](_0x21df42)[_0x7892('0x27')](function(_0x284a49){return _0x284a49;});}return null;};}function removeEntity(_0x10144e,_0x38a97b){return function(_0x12a0a7){if(_0x12a0a7){return _0x12a0a7[_0x7892('0x28')]()['then'](function(){var _0x4396f9=_0x12a0a7[_0x7892('0x29')]({'plain':!![]});var _0x313449=_0x7892('0x2a');return db[_0x7892('0x2b')]['destroy']({'where':{'type':_0x313449,'resourceId':_0x4396f9['id']}})['then'](function(){return _0x12a0a7;});})[_0x7892('0x27')](function(){_0x10144e[_0x7892('0x1b')](0xcc)[_0x7892('0x1c')]();});}};}function handleEntityNotFound(_0x3ba5e7,_0x3842e4){return function(_0x21a8e7){if(!_0x21a8e7){_0x3ba5e7[_0x7892('0x1a')](0x194);}return _0x21a8e7;};}function handleError(_0x782131,_0x91e1f6){_0x91e1f6=_0x91e1f6||0x1f4;return function(_0x55d043){logger[_0x7892('0x2c')](_0x55d043[_0x7892('0x2d')]);if(_0x55d043[_0x7892('0x2e')]){delete _0x55d043['name'];}_0x782131['status'](_0x91e1f6)[_0x7892('0x2f')](_0x55d043);};}exports['index']=function(_0x2ae69d,_0x32d39d){var _0x619939={},_0x4c8fd1={},_0x30fc8b={'count':0x0,'rows':[]};var _0x4843ab=_[_0x7892('0x30')](db['CannedAnswer'][_0x7892('0x31')],function(_0x1e27f7){return{'name':_0x1e27f7[_0x7892('0x32')],'type':_0x1e27f7[_0x7892('0x33')][_0x7892('0x34')]};});_0x4c8fd1[_0x7892('0x35')]=_[_0x7892('0x30')](_0x4843ab,_0x7892('0x2e'));_0x4c8fd1[_0x7892('0x36')]=_[_0x7892('0x37')](_0x2ae69d[_0x7892('0x36')]);_0x4c8fd1[_0x7892('0x38')]=_[_0x7892('0x39')](_0x4c8fd1['model'],_0x4c8fd1[_0x7892('0x36')]);_0x619939[_0x7892('0x3a')]=_['intersection'](_0x4c8fd1[_0x7892('0x35')],qs['fields'](_0x2ae69d[_0x7892('0x36')][_0x7892('0x3b')]));_0x619939[_0x7892('0x3a')]=_0x619939[_0x7892('0x3a')][_0x7892('0x3c')]?_0x619939[_0x7892('0x3a')]:_0x4c8fd1[_0x7892('0x35')];if(!_0x2ae69d[_0x7892('0x36')][_0x7892('0x3d')](_0x7892('0x3e'))){_0x619939[_0x7892('0x1f')]=qs[_0x7892('0x1f')](_0x2ae69d[_0x7892('0x36')][_0x7892('0x1f')]);_0x619939['offset']=qs[_0x7892('0x20')](_0x2ae69d[_0x7892('0x36')][_0x7892('0x20')]);}_0x619939['order']=qs[_0x7892('0x3f')](_0x2ae69d[_0x7892('0x36')][_0x7892('0x3f')]);_0x619939[_0x7892('0x40')]=qs[_0x7892('0x38')](_[_0x7892('0x41')](_0x2ae69d[_0x7892('0x36')],_0x4c8fd1[_0x7892('0x38')]),_0x4843ab);if(_0x2ae69d[_0x7892('0x36')]['filter']){_0x619939[_0x7892('0x40')]=_[_0x7892('0x42')](_0x619939[_0x7892('0x40')],{'$or':[{'key':{'$like':'%'+_0x2ae69d[_0x7892('0x36')][_0x7892('0x43')]+'%'}},{'value':{'$like':'%'+_0x2ae69d[_0x7892('0x36')]['filter']+'%'}}]});}_0x619939=_['merge']({},_0x619939,_0x2ae69d[_0x7892('0x44')]);var _0x1153cb={'where':_0x619939[_0x7892('0x40')]};return db[_0x7892('0x45')]['count'](_0x1153cb)[_0x7892('0x27')](function(_0x576cf9){_0x30fc8b[_0x7892('0x21')]=_0x576cf9;if(_0x2ae69d[_0x7892('0x36')]['includeAll']){_0x619939[_0x7892('0x46')]=[{'all':!![]}];}return db[_0x7892('0x45')][_0x7892('0x47')](_0x619939);})[_0x7892('0x27')](function(_0x1c94c6){_0x30fc8b['rows']=_0x1c94c6;return _0x30fc8b;})[_0x7892('0x27')](respondWithFilteredResult(_0x32d39d,_0x619939))['catch'](handleError(_0x32d39d,null));};exports[_0x7892('0x48')]=function(_0x3cd3a4,_0x25fffe){var _0xc3b26={'raw':!![],'where':{'id':_0x3cd3a4[_0x7892('0x49')]['id']}},_0x9270b5={};_0x9270b5[_0x7892('0x35')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x9270b5[_0x7892('0x36')]=_[_0x7892('0x37')](_0x3cd3a4[_0x7892('0x36')]);_0x9270b5['filters']=_['intersection'](_0x9270b5[_0x7892('0x35')],_0x9270b5[_0x7892('0x36')]);_0xc3b26['attributes']=_[_0x7892('0x39')](_0x9270b5[_0x7892('0x35')],qs['fields'](_0x3cd3a4['query'][_0x7892('0x3b')]));_0xc3b26['attributes']=_0xc3b26[_0x7892('0x3a')]['length']?_0xc3b26[_0x7892('0x3a')]:_0x9270b5[_0x7892('0x35')];if(_0x3cd3a4[_0x7892('0x36')]['includeAll']){_0xc3b26['include']=[{'all':!![]}];}_0xc3b26=_[_0x7892('0x42')]({},_0xc3b26,_0x3cd3a4[_0x7892('0x44')]);return db['CannedAnswer'][_0x7892('0x4a')](_0xc3b26)[_0x7892('0x27')](handleEntityNotFound(_0x25fffe,null))[_0x7892('0x27')](respondWithResult(_0x25fffe,null))[_0x7892('0x4b')](handleError(_0x25fffe,null));};exports[_0x7892('0x26')]=function(_0x3beb20,_0x21df5b){if(_0x3beb20[_0x7892('0x4c')]['id']){delete _0x3beb20['body']['id'];}return db['CannedAnswer'][_0x7892('0x4a')]({'where':{'id':_0x3beb20[_0x7892('0x49')]['id']}})[_0x7892('0x27')](handleEntityNotFound(_0x21df5b,null))[_0x7892('0x27')](saveUpdates(_0x3beb20['body'],null))[_0x7892('0x27')](respondWithResult(_0x21df5b,null))[_0x7892('0x4b')](handleError(_0x21df5b,null));};exports['destroy']=function(_0x552266,_0x576855){return db[_0x7892('0x45')][_0x7892('0x4a')]({'where':{'id':_0x552266['params']['id']}})['then'](handleEntityNotFound(_0x576855,null))[_0x7892('0x27')](removeEntity(_0x576855,null))['catch'](handleError(_0x576855,null));};exports[_0x7892('0x4d')]=function(_0x342484,_0x1b0aa5){var _0x16a138={'key':_0x342484['body'][_0x7892('0x34')]};if(_0x342484[_0x7892('0x4c')][_0x7892('0x4e')]){_0x16a138[_0x7892('0x4e')]=_0x342484[_0x7892('0x4c')][_0x7892('0x4e')];}else if(_0x342484[_0x7892('0x4c')][_0x7892('0x4f')]){_0x16a138[_0x7892('0x4f')]=_0x342484['body'][_0x7892('0x4f')];}else if(_0x342484[_0x7892('0x4c')][_0x7892('0x50')]){_0x16a138[_0x7892('0x50')]=_0x342484[_0x7892('0x4c')][_0x7892('0x50')];}else if(_0x342484['body'][_0x7892('0x51')]){_0x16a138[_0x7892('0x51')]=_0x342484[_0x7892('0x4c')][_0x7892('0x51')];}return db[_0x7892('0x45')]['find']({'where':_0x16a138})[_0x7892('0x27')](function(_0x2c45d8){if(_0x2c45d8){throw new db['Sequelize'][(_0x7892('0x52'))](_0x7892('0x53'));}return db[_0x7892('0x45')][_0x7892('0x4d')](_0x342484[_0x7892('0x4c')]);})['then'](function(_0x2f3d64){var _0x14e115=_0x342484[_0x7892('0x54')][_0x7892('0x29')]({'plain':!![]});if(!_0x14e115)throw new Error(_0x7892('0x55'));if(_0x14e115[_0x7892('0x56')]==='user'){var _0xa5686b=_0x2f3d64[_0x7892('0x29')]({'plain':!![]});return db[_0x7892('0x57')][_0x7892('0x4a')]({'where':{'name':_0x7892('0x2a'),'userProfileId':_0x14e115[_0x7892('0x58')]},'raw':!![]})[_0x7892('0x27')](function(_0x1e6b52){if(_0x1e6b52&&_0x1e6b52[_0x7892('0x59')]===0x0){return db[_0x7892('0x2b')][_0x7892('0x4d')]({'name':_0xa5686b[_0x7892('0x2e')],'resourceId':_0xa5686b['id'],'type':_0x1e6b52['name'],'sectionId':_0x1e6b52['id']},{})['then'](function(){return _0x2f3d64;});}else{return _0x2f3d64;}})[_0x7892('0x4b')](function(_0x1e409e){logger[_0x7892('0x2c')](_0x7892('0x5a'),_0x1e409e);throw _0x1e409e;});}return _0x2f3d64;})['then'](respondWithResult(_0x1b0aa5,0xc9))[_0x7892('0x4b')](handleError(_0x1b0aa5,null));}; \ No newline at end of file +var _0xfd1b=['where','pick','filter','merge','options','include','CannedAnswer','findAll','show','rawAttributes','includeAll','find','body','catch','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','get','CannedAnswers','destroy','error','stack','name','send','index','map','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfd1b,0xd0));var _0xbfd1=function(_0x1ef251,_0x504814){_0x1ef251=_0x1ef251-0x0;var _0x557a66=_0xfd1b[_0x1ef251];return _0x557a66;};'use strict';var emlformat=require(_0xbfd1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbfd1('0x1'));var jsonpatch=require(_0xbfd1('0x2'));var rp=require(_0xbfd1('0x3'));var moment=require(_0xbfd1('0x4'));var BPromise=require(_0xbfd1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xbfd1('0x6'));var csv=require('to-csv');var ejs=require(_0xbfd1('0x7'));var fs=require('fs');var fs_extra=require(_0xbfd1('0x8'));var _=require(_0xbfd1('0x9'));var squel=require(_0xbfd1('0xa'));var crypto=require(_0xbfd1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbfd1('0xc'));var toCsv=require(_0xbfd1('0xd'));var querystring=require(_0xbfd1('0xe'));var Papa=require('papaparse');var Redis=require(_0xbfd1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbfd1('0x10'));var as=require(_0xbfd1('0x11'));var hardwareService=require(_0xbfd1('0x12'));var logger=require(_0xbfd1('0x13'))(_0xbfd1('0x14'));var utils=require(_0xbfd1('0x15'));var config=require(_0xbfd1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbfd1('0x17'))['db'];function respondWithStatusCode(_0xeca68a,_0x310e3f){_0x310e3f=_0x310e3f||0xcc;return function(_0x4dc546){if(_0x4dc546){return _0xeca68a[_0xbfd1('0x18')](_0x310e3f);}return _0xeca68a['status'](_0x310e3f)[_0xbfd1('0x19')]();};}function respondWithResult(_0xda20f3,_0x5ca85f){_0x5ca85f=_0x5ca85f||0xc8;return function(_0x356f96){if(_0x356f96){return _0xda20f3[_0xbfd1('0x1a')](_0x5ca85f)[_0xbfd1('0x1b')](_0x356f96);}};}function respondWithFilteredResult(_0x25cdc6,_0xc3735){return function(_0x27171a){if(_0x27171a){var _0x36a098=typeof _0xc3735[_0xbfd1('0x1c')]===_0xbfd1('0x1d')&&typeof _0xc3735[_0xbfd1('0x1e')]===_0xbfd1('0x1d');var _0x47b74a=_0x27171a[_0xbfd1('0x1f')];var _0x276566=_0x36a098?0x0:_0xc3735[_0xbfd1('0x1c')];var _0x1ae8f3=_0x36a098?_0x27171a[_0xbfd1('0x1f')]:_0xc3735[_0xbfd1('0x1c')]+_0xc3735[_0xbfd1('0x1e')];var _0x2ea117;if(_0x1ae8f3>=_0x47b74a){_0x1ae8f3=_0x47b74a;_0x2ea117=0xc8;}else{_0x2ea117=0xce;}_0x25cdc6[_0xbfd1('0x1a')](_0x2ea117);return _0x25cdc6[_0xbfd1('0x20')](_0xbfd1('0x21'),_0x276566+'-'+_0x1ae8f3+'/'+_0x47b74a)[_0xbfd1('0x1b')](_0x27171a);}return null;};}function patchUpdates(_0x7d0d4d){return function(_0x84a970){try{jsonpatch['apply'](_0x84a970,_0x7d0d4d,!![]);}catch(_0x7323f3){return BPromise['reject'](_0x7323f3);}return _0x84a970['save']();};}function saveUpdates(_0x312f4e,_0x3f8336){return function(_0x47cf6b){if(_0x47cf6b){return _0x47cf6b[_0xbfd1('0x22')](_0x312f4e)[_0xbfd1('0x23')](function(_0x358816){return _0x358816;});}return null;};}function removeEntity(_0x10e6ff,_0x299fbb){return function(_0x1b82be){if(_0x1b82be){return _0x1b82be['destroy']()[_0xbfd1('0x23')](function(){var _0x597e18=_0x1b82be[_0xbfd1('0x24')]({'plain':!![]});var _0x3899ee=_0xbfd1('0x25');return db['UserProfileResource'][_0xbfd1('0x26')]({'where':{'type':_0x3899ee,'resourceId':_0x597e18['id']}})[_0xbfd1('0x23')](function(){return _0x1b82be;});})[_0xbfd1('0x23')](function(){_0x10e6ff['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ac829,_0x2fd591){return function(_0x3be78a){if(!_0x3be78a){_0x2ac829[_0xbfd1('0x18')](0x194);}return _0x3be78a;};}function handleError(_0x4a9f16,_0xa5180d){_0xa5180d=_0xa5180d||0x1f4;return function(_0x20de57){logger[_0xbfd1('0x27')](_0x20de57[_0xbfd1('0x28')]);if(_0x20de57[_0xbfd1('0x29')]){delete _0x20de57[_0xbfd1('0x29')];}_0x4a9f16[_0xbfd1('0x1a')](_0xa5180d)[_0xbfd1('0x2a')](_0x20de57);};}exports[_0xbfd1('0x2b')]=function(_0x151e4e,_0x595c57){var _0x1236ff={},_0x1c759f={},_0x58cb37={'count':0x0,'rows':[]};var _0x395118=_[_0xbfd1('0x2c')](db['CannedAnswer']['rawAttributes'],function(_0x1e3115){return{'name':_0x1e3115['fieldName'],'type':_0x1e3115[_0xbfd1('0x2d')][_0xbfd1('0x2e')]};});_0x1c759f['model']=_[_0xbfd1('0x2c')](_0x395118,_0xbfd1('0x29'));_0x1c759f[_0xbfd1('0x2f')]=_[_0xbfd1('0x30')](_0x151e4e[_0xbfd1('0x2f')]);_0x1c759f[_0xbfd1('0x31')]=_[_0xbfd1('0x32')](_0x1c759f[_0xbfd1('0x33')],_0x1c759f[_0xbfd1('0x2f')]);_0x1236ff[_0xbfd1('0x34')]=_[_0xbfd1('0x32')](_0x1c759f[_0xbfd1('0x33')],qs[_0xbfd1('0x35')](_0x151e4e[_0xbfd1('0x2f')][_0xbfd1('0x35')]));_0x1236ff['attributes']=_0x1236ff[_0xbfd1('0x34')][_0xbfd1('0x36')]?_0x1236ff[_0xbfd1('0x34')]:_0x1c759f[_0xbfd1('0x33')];if(!_0x151e4e[_0xbfd1('0x2f')][_0xbfd1('0x37')](_0xbfd1('0x38'))){_0x1236ff['limit']=qs[_0xbfd1('0x1e')](_0x151e4e[_0xbfd1('0x2f')][_0xbfd1('0x1e')]);_0x1236ff[_0xbfd1('0x1c')]=qs[_0xbfd1('0x1c')](_0x151e4e[_0xbfd1('0x2f')][_0xbfd1('0x1c')]);}_0x1236ff[_0xbfd1('0x39')]=qs[_0xbfd1('0x3a')](_0x151e4e[_0xbfd1('0x2f')][_0xbfd1('0x3a')]);_0x1236ff[_0xbfd1('0x3b')]=qs[_0xbfd1('0x31')](_[_0xbfd1('0x3c')](_0x151e4e[_0xbfd1('0x2f')],_0x1c759f[_0xbfd1('0x31')]),_0x395118);if(_0x151e4e[_0xbfd1('0x2f')][_0xbfd1('0x3d')]){_0x1236ff[_0xbfd1('0x3b')]=_['merge'](_0x1236ff[_0xbfd1('0x3b')],{'$or':[{'key':{'$like':'%'+_0x151e4e[_0xbfd1('0x2f')][_0xbfd1('0x3d')]+'%'}},{'value':{'$like':'%'+_0x151e4e[_0xbfd1('0x2f')][_0xbfd1('0x3d')]+'%'}}]});}_0x1236ff=_[_0xbfd1('0x3e')]({},_0x1236ff,_0x151e4e[_0xbfd1('0x3f')]);var _0x5a959f={'where':_0x1236ff['where']};return db['CannedAnswer']['count'](_0x5a959f)[_0xbfd1('0x23')](function(_0x19287c){_0x58cb37['count']=_0x19287c;if(_0x151e4e[_0xbfd1('0x2f')]['includeAll']){_0x1236ff[_0xbfd1('0x40')]=[{'all':!![]}];}return db[_0xbfd1('0x41')][_0xbfd1('0x42')](_0x1236ff);})['then'](function(_0x989e1){_0x58cb37['rows']=_0x989e1;return _0x58cb37;})[_0xbfd1('0x23')](respondWithFilteredResult(_0x595c57,_0x1236ff))['catch'](handleError(_0x595c57,null));};exports[_0xbfd1('0x43')]=function(_0x48621f,_0x1ac01a){var _0x5a5cae={'raw':!![],'where':{'id':_0x48621f['params']['id']}},_0xd99f6={};_0xd99f6[_0xbfd1('0x33')]=_[_0xbfd1('0x30')](db[_0xbfd1('0x41')][_0xbfd1('0x44')]);_0xd99f6['query']=_[_0xbfd1('0x30')](_0x48621f['query']);_0xd99f6['filters']=_[_0xbfd1('0x32')](_0xd99f6[_0xbfd1('0x33')],_0xd99f6[_0xbfd1('0x2f')]);_0x5a5cae[_0xbfd1('0x34')]=_['intersection'](_0xd99f6[_0xbfd1('0x33')],qs[_0xbfd1('0x35')](_0x48621f[_0xbfd1('0x2f')]['fields']));_0x5a5cae[_0xbfd1('0x34')]=_0x5a5cae[_0xbfd1('0x34')][_0xbfd1('0x36')]?_0x5a5cae[_0xbfd1('0x34')]:_0xd99f6[_0xbfd1('0x33')];if(_0x48621f[_0xbfd1('0x2f')][_0xbfd1('0x45')]){_0x5a5cae['include']=[{'all':!![]}];}_0x5a5cae=_[_0xbfd1('0x3e')]({},_0x5a5cae,_0x48621f[_0xbfd1('0x3f')]);return db[_0xbfd1('0x41')][_0xbfd1('0x46')](_0x5a5cae)['then'](handleEntityNotFound(_0x1ac01a,null))['then'](respondWithResult(_0x1ac01a,null))['catch'](handleError(_0x1ac01a,null));};exports['update']=function(_0x5bf764,_0x3b757c){if(_0x5bf764[_0xbfd1('0x47')]['id']){delete _0x5bf764[_0xbfd1('0x47')]['id'];}return db[_0xbfd1('0x41')][_0xbfd1('0x46')]({'where':{'id':_0x5bf764['params']['id']}})[_0xbfd1('0x23')](handleEntityNotFound(_0x3b757c,null))['then'](saveUpdates(_0x5bf764[_0xbfd1('0x47')],null))[_0xbfd1('0x23')](respondWithResult(_0x3b757c,null))[_0xbfd1('0x48')](handleError(_0x3b757c,null));};exports[_0xbfd1('0x26')]=function(_0x3efaeb,_0x336cda){return db[_0xbfd1('0x41')][_0xbfd1('0x46')]({'where':{'id':_0x3efaeb[_0xbfd1('0x49')]['id']}})[_0xbfd1('0x23')](handleEntityNotFound(_0x336cda,null))[_0xbfd1('0x23')](removeEntity(_0x336cda,null))['catch'](handleError(_0x336cda,null));};exports['create']=function(_0x207e2c,_0x1016cf){var _0x458419={'key':_0x207e2c[_0xbfd1('0x47')][_0xbfd1('0x2e')]};if(_0x207e2c['body'][_0xbfd1('0x4a')]){_0x458419[_0xbfd1('0x4a')]=_0x207e2c['body'][_0xbfd1('0x4a')];}else if(_0x207e2c[_0xbfd1('0x47')][_0xbfd1('0x4b')]){_0x458419[_0xbfd1('0x4b')]=_0x207e2c[_0xbfd1('0x47')]['SmsAccountId'];}else if(_0x207e2c['body'][_0xbfd1('0x4c')]){_0x458419['OpenchannelAccountId']=_0x207e2c[_0xbfd1('0x47')][_0xbfd1('0x4c')];}else if(_0x207e2c[_0xbfd1('0x47')]['ChatWebsiteId']){_0x458419[_0xbfd1('0x4d')]=_0x207e2c[_0xbfd1('0x47')][_0xbfd1('0x4d')];}return db[_0xbfd1('0x41')][_0xbfd1('0x46')]({'where':_0x458419})[_0xbfd1('0x23')](function(_0x75fefa){if(_0x75fefa){throw new db[(_0xbfd1('0x4e'))][(_0xbfd1('0x4f'))](_0xbfd1('0x50'));}return db['CannedAnswer'][_0xbfd1('0x51')](_0x207e2c[_0xbfd1('0x47')]);})['then'](function(_0x3e67a1){var _0x49d0fd=_0x207e2c[_0xbfd1('0x52')][_0xbfd1('0x24')]({'plain':!![]});if(!_0x49d0fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49d0fd[_0xbfd1('0x53')]===_0xbfd1('0x52')){var _0x4369bd=_0x3e67a1[_0xbfd1('0x24')]({'plain':!![]});return db[_0xbfd1('0x54')][_0xbfd1('0x46')]({'where':{'name':'CannedAnswers','userProfileId':_0x49d0fd[_0xbfd1('0x55')]},'raw':!![]})['then'](function(_0x72ec2e){if(_0x72ec2e&&_0x72ec2e[_0xbfd1('0x56')]===0x0){return db[_0xbfd1('0x57')]['create']({'name':_0x4369bd[_0xbfd1('0x29')],'resourceId':_0x4369bd['id'],'type':_0x72ec2e['name'],'sectionId':_0x72ec2e['id']},{})[_0xbfd1('0x23')](function(){return _0x3e67a1;});}else{return _0x3e67a1;}})['catch'](function(_0xdc02fe){logger[_0xbfd1('0x27')](_0xbfd1('0x58'),_0xdc02fe);throw _0xdc02fe;});}return _0x3e67a1;})[_0xbfd1('0x23')](respondWithResult(_0x1016cf,0xc9))[_0xbfd1('0x48')](handleError(_0x1016cf,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index f097660..ceb0063 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 _0xdd70=['util','moment','bluebird','request-promise','rimraf','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1a33a7,_0x3a9262){var _0x22d80d=function(_0xad057){while(--_0xad057){_0x1a33a7['push'](_0x1a33a7['shift']());}};_0x22d80d(++_0x3a9262);}(_0xdd70,0x18b));var _0x0dd7=function(_0x5af911,_0x5a72aa){_0x5af911=_0x5af911-0x0;var _0x336e64=_0xdd70[_0x5af911];return _0x336e64;};'use strict';var _=require(_0x0dd7('0x0'));var util=require(_0x0dd7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0dd7('0x2'));var BPromise=require(_0x0dd7('0x3'));var rp=require(_0x0dd7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0dd7('0x5'));var config=require(_0x0dd7('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x0dd7('0x7')]=function(_0x349081,_0x34aa1b){return _0x349081['define'](_0x0dd7('0x8'),attributes,{'tableName':_0x0dd7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0dd7('0xa'),'collate':_0x0dd7('0xb')});}; \ No newline at end of file +var _0x415e=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util'];(function(_0x5849c,_0x1c646f){var _0x826335=function(_0x16fe49){while(--_0x16fe49){_0x5849c['push'](_0x5849c['shift']());}};_0x826335(++_0x1c646f);}(_0x415e,0x1c6));var _0xe415=function(_0xc9790d,_0x33ac1c){_0xc9790d=_0xc9790d-0x0;var _0x2e3793=_0x415e[_0xc9790d];return _0x2e3793;};'use strict';var _=require(_0xe415('0x0'));var util=require(_0xe415('0x1'));var logger=require(_0xe415('0x2'))('api');var moment=require(_0xe415('0x3'));var BPromise=require(_0xe415('0x4'));var rp=require(_0xe415('0x5'));var fs=require('fs');var path=require(_0xe415('0x6'));var rimraf=require(_0xe415('0x7'));var config=require('../../config/environment');var attributes=require(_0xe415('0x8'));module['exports']=function(_0x1f3996,_0x325844){return _0x1f3996['define'](_0xe415('0x9'),attributes,{'tableName':_0xe415('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe415('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 4cce389..ba5890d 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(_0x3b9c2d,_0x262a19){var _0x5591f8=function(_0x3f55fd){while(--_0x3f55fd){_0x3b9c2d['push'](_0x3b9c2d['shift']());}};_0x5591f8(++_0x262a19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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(_0x104fe1,_0x2f8841){var _0x5d934e=function(_0x23dda7){while(--_0x23dda7){_0x104fe1['push'](_0x104fe1['shift']());}};_0x5d934e(++_0x2f8841);}(_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 diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 4ca5cec..e13595f 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 _0xd65d=['express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','create','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x24773e,_0x3e0ff1){var _0x42129c=function(_0x47a58e){while(--_0x47a58e){_0x24773e['push'](_0x24773e['shift']());}};_0x42129c(++_0x3e0ff1);}(_0xd65d,0x183));var _0xdd65=function(_0x19d2b2,_0x2fd6b1){_0x19d2b2=_0x19d2b2-0x0;var _0x457228=_0xd65d[_0x19d2b2];return _0x457228;};'use strict';var multer=require(_0xdd65('0x0'));var util=require(_0xdd65('0x1'));var path=require(_0xdd65('0x2'));var timeout=require(_0xdd65('0x3'));var express=require(_0xdd65('0x4'));var router=express[_0xdd65('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdd65('0x6'));var config=require(_0xdd65('0x7'));var controller=require(_0xdd65('0x8'));router[_0xdd65('0x9')]('/',auth[_0xdd65('0xa')](),controller['index']);router['get'](_0xdd65('0xb'),auth['isAuthenticated'](),controller[_0xdd65('0xc')]);router['post']('/',auth[_0xdd65('0xa')](),controller[_0xdd65('0xd')]);router[_0xdd65('0xe')](_0xdd65('0xb'),auth[_0xdd65('0xa')](),controller['update']);router[_0xdd65('0xf')](_0xdd65('0xb'),auth['isAuthenticated'](),controller[_0xdd65('0x10')]);module['exports']=router; \ No newline at end of file +var _0x84df=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','index','get','post','isAuthenticated','create','put','/:id','delete','destroy','exports','multer','util'];(function(_0x1fb325,_0x24a691){var _0x148491=function(_0x2427df){while(--_0x2427df){_0x1fb325['push'](_0x1fb325['shift']());}};_0x148491(++_0x24a691);}(_0x84df,0x108));var _0xf84d=function(_0x2b85d5,_0x3115b7){_0x2b85d5=_0x2b85d5-0x0;var _0xe8c96f=_0x84df[_0x2b85d5];return _0xe8c96f;};'use strict';var multer=require(_0xf84d('0x0'));var util=require(_0xf84d('0x1'));var path=require(_0xf84d('0x2'));var timeout=require(_0xf84d('0x3'));var express=require(_0xf84d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf84d('0x5'));var interaction=require(_0xf84d('0x6'));var config=require(_0xf84d('0x7'));var controller=require(_0xf84d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf84d('0x9')]);router[_0xf84d('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf84d('0xb')]('/',auth[_0xf84d('0xc')](),controller[_0xf84d('0xd')]);router[_0xf84d('0xe')](_0xf84d('0xf'),auth[_0xf84d('0xc')](),controller['update']);router[_0xf84d('0x10')](_0xf84d('0xf'),auth[_0xf84d('0xc')](),controller[_0xf84d('0x11')]);module[_0xf84d('0x12')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 30e48b7..40391c4 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 _0x5c42=['INTEGER','sequelize','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x5431df,_0x6dbf5e){var _0x52a89e=function(_0x4e7b20){while(--_0x4e7b20){_0x5431df['push'](_0x5431df['shift']());}};_0x52a89e(++_0x6dbf5e);}(_0x5c42,0x182));var _0x25c4=function(_0x1c9531,_0x1b45bc){_0x1c9531=_0x1c9531-0x0;var _0x1f8c5e=_0x5c42[_0x1c9531];return _0x1f8c5e;};'use strict';var Sequelize=require(_0x25c4('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x25c4('0x1')],'allowNull':![],'defaultValue':_0x25c4('0x2')},'clid':{'type':Sequelize[_0x25c4('0x3')]},'src':{'type':Sequelize[_0x25c4('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x25c4('0x3')]},'channel':{'type':Sequelize[_0x25c4('0x3')]},'dstchannel':{'type':Sequelize[_0x25c4('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x25c4('0x3')]},'duration':{'type':Sequelize[_0x25c4('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x25c4('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x25c4('0x3')]},'amaflags':{'type':Sequelize[_0x25c4('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x25c4('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x25c4('0x3')]},'linkedid':{'type':Sequelize[_0x25c4('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x25c4('0x3')]},'type':{'type':Sequelize[_0x25c4('0x3')]},'tag':{'type':Sequelize[_0x25c4('0x3')]}}; \ No newline at end of file +var _0x3f19=['sequelize','STRING','INTEGER'];(function(_0x4165f6,_0x13fca3){var _0x2a558a=function(_0x2f76a7){while(--_0x2f76a7){_0x4165f6['push'](_0x4165f6['shift']());}};_0x2a558a(++_0x13fca3);}(_0x3f19,0xc0));var _0x93f1=function(_0x1ac9f4,_0x5b796f){_0x1ac9f4=_0x1ac9f4-0x0;var _0x502020=_0x3f19[_0x1ac9f4];return _0x502020;};'use strict';var Sequelize=require(_0x93f1('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x93f1('0x1')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x93f1('0x1')]},'dcontext':{'type':Sequelize[_0x93f1('0x1')]},'channel':{'type':Sequelize[_0x93f1('0x1')]},'dstchannel':{'type':Sequelize[_0x93f1('0x1')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x93f1('0x1')]},'duration':{'type':Sequelize[_0x93f1('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x93f1('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x93f1('0x1')]},'amaflags':{'type':Sequelize[_0x93f1('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x93f1('0x1')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x93f1('0x1')]},'linkedid':{'type':Sequelize[_0x93f1('0x1')]},'sequence':{'type':Sequelize[_0x93f1('0x1')]},'peeraccount':{'type':Sequelize[_0x93f1('0x1')]},'type':{'type':Sequelize[_0x93f1('0x1')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b0de3ca..d7921bd 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 _0x5fc3=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','Cdr','fieldName','type','model','query','keys','filters'];(function(_0x4be27a,_0x385776){var _0x4ffa98=function(_0x240df9){while(--_0x240df9){_0x4be27a['push'](_0x4be27a['shift']());}};_0x4ffa98(++_0x385776);}(_0x5fc3,0xa8));var _0x35fc=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x5fc3[_0x56740a];return _0x257144;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){_0x2d8183['status'](0xcc)[_0x35fc('0x19')]();});}};}function handleEntityNotFound(_0x5a93df,_0x3d4a98){return function(_0x51cfec){if(!_0x51cfec){_0x5a93df[_0x35fc('0x17')](0x194);}return _0x51cfec;};}function handleError(_0x598d7a,_0x1bf180){_0x1bf180=_0x1bf180||0x1f4;return function(_0xdfab9f){logger['error'](_0xdfab9f['stack']);if(_0xdfab9f[_0x35fc('0x26')]){delete _0xdfab9f['name'];}_0x598d7a[_0x35fc('0x18')](_0x1bf180)[_0x35fc('0x27')](_0xdfab9f);};}exports['index']=function(_0x26b7cb,_0x645eac){var _0x383837={},_0x9f3c8a={},_0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x28')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x2b')]['key']};});_0x9f3c8a[_0x35fc('0x2c')]=_[_0x35fc('0x28')](_0x134dfa,_0x35fc('0x26'));_0x9f3c8a[_0x35fc('0x2d')]=_[_0x35fc('0x2e')](_0x26b7cb[_0x35fc('0x2d')]);_0x9f3c8a[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x9f3c8a[_0x35fc('0x2c')],_0x9f3c8a[_0x35fc('0x2d')]);_0x383837['attributes']=_['intersection'](_0x9f3c8a[_0x35fc('0x2c')],qs['fields'](_0x26b7cb[_0x35fc('0x2d')][_0x35fc('0x31')]));_0x383837[_0x35fc('0x32')]=_0x383837[_0x35fc('0x32')][_0x35fc('0x33')]?_0x383837[_0x35fc('0x32')]:_0x9f3c8a['model'];if(!_0x26b7cb[_0x35fc('0x2d')][_0x35fc('0x34')](_0x35fc('0x35'))){_0x383837[_0x35fc('0x1c')]=qs[_0x35fc('0x1c')](_0x26b7cb[_0x35fc('0x2d')]['limit']);_0x383837[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x26b7cb[_0x35fc('0x2d')]['offset']);}_0x383837[_0x35fc('0x36')]=qs['sort'](_0x26b7cb[_0x35fc('0x2d')][_0x35fc('0x37')]);_0x383837[_0x35fc('0x38')]=qs[_0x35fc('0x2f')](_['pick'](_0x26b7cb['query'],_0x9f3c8a['filters']),_0x134dfa);if(_0x26b7cb[_0x35fc('0x2d')]['filter']){_0x383837[_0x35fc('0x38')]=_['merge'](_0x383837[_0x35fc('0x38')],{'$or':_[_0x35fc('0x28')](_0x134dfa,function(_0x2ca9ac){if(_0x2ca9ac[_0x35fc('0x2b')]!==_0x35fc('0x39')){var _0x3313fa={};_0x3313fa[_0x2ca9ac[_0x35fc('0x26')]]={'$like':'%'+_0x26b7cb['query'][_0x35fc('0x3a')]+'%'};return _0x3313fa;}})});}_0x383837=_[_0x35fc('0x3b')]({},_0x383837,_0x26b7cb['options']);var _0x1feda5={'where':_0x383837[_0x35fc('0x38')]};return db[_0x35fc('0x29')][_0x35fc('0x1d')](_0x1feda5)[_0x35fc('0x24')](function(_0x31d926){_0x3735da['count']=_0x31d926;if(_0x26b7cb[_0x35fc('0x2d')][_0x35fc('0x3c')]){_0x383837[_0x35fc('0x3d')]=[{'all':!![]}];}return db['Cdr'][_0x35fc('0x3e')](_0x383837);})[_0x35fc('0x24')](function(_0x596919){_0x3735da[_0x35fc('0x3f')]=_0x596919;return _0x3735da;})[_0x35fc('0x24')](respondWithFilteredResult(_0x645eac,_0x383837))[_0x35fc('0x40')](handleError(_0x645eac,null));};exports[_0x35fc('0x41')]=function(_0x331439,_0x2a1cf6){var _0x211b70={'raw':!![],'where':{'id':_0x331439['params']['id']}},_0x3ec51f={};_0x3ec51f['model']=_[_0x35fc('0x2e')](db[_0x35fc('0x29')]['rawAttributes']);_0x3ec51f['query']=_['keys'](_0x331439[_0x35fc('0x2d')]);_0x3ec51f[_0x35fc('0x2f')]=_['intersection'](_0x3ec51f[_0x35fc('0x2c')],_0x3ec51f[_0x35fc('0x2d')]);_0x211b70[_0x35fc('0x32')]=_[_0x35fc('0x30')](_0x3ec51f['model'],qs['fields'](_0x331439['query']['fields']));_0x211b70['attributes']=_0x211b70[_0x35fc('0x32')][_0x35fc('0x33')]?_0x211b70['attributes']:_0x3ec51f[_0x35fc('0x2c')];if(_0x331439['query'][_0x35fc('0x3c')]){_0x211b70[_0x35fc('0x3d')]=[{'all':!![]}];}_0x211b70=_[_0x35fc('0x3b')]({},_0x211b70,_0x331439[_0x35fc('0x42')]);return db[_0x35fc('0x29')]['find'](_0x211b70)[_0x35fc('0x24')](handleEntityNotFound(_0x2a1cf6,null))[_0x35fc('0x24')](respondWithResult(_0x2a1cf6,null))['catch'](handleError(_0x2a1cf6,null));};exports[_0x35fc('0x43')]=function(_0x298b7b,_0x2a8a09){return db[_0x35fc('0x29')]['create'](_0x298b7b[_0x35fc('0x44')],{})['then'](respondWithResult(_0x2a8a09,0xc9))['catch'](handleError(_0x2a8a09,null));};exports[_0x35fc('0x23')]=function(_0x9db7e8,_0x18dc78){if(_0x9db7e8[_0x35fc('0x44')]['id']){delete _0x9db7e8[_0x35fc('0x44')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x45')]({'where':{'id':_0x9db7e8[_0x35fc('0x46')]['id']}})['then'](handleEntityNotFound(_0x18dc78,null))[_0x35fc('0x24')](saveUpdates(_0x9db7e8[_0x35fc('0x44')],null))[_0x35fc('0x24')](respondWithResult(_0x18dc78,null))[_0x35fc('0x40')](handleError(_0x18dc78,null));};exports[_0x35fc('0x25')]=function(_0x1e3221,_0x1b8229){return db[_0x35fc('0x29')][_0x35fc('0x45')]({'where':{'id':_0x1e3221[_0x35fc('0x46')]['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x1b8229,null))[_0x35fc('0x24')](removeEntity(_0x1b8229,null))[_0x35fc('0x40')](handleError(_0x1b8229,null));};exports[_0x35fc('0x47')]=function(_0x59c666,_0x553ed6){return db[_0x35fc('0x29')][_0x35fc('0x47')]()[_0x35fc('0x24')](respondWithResult(_0x553ed6,null))[_0x35fc('0x40')](handleError(_0x553ed6,null));}; \ No newline at end of file +var _0x5075=['save','update','then','destroy','end','error','name','index','map','Cdr','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply'];(function(_0x19a0bc,_0x2f7125){var _0x4d6c30=function(_0x35b981){while(--_0x35b981){_0x19a0bc['push'](_0x19a0bc['shift']());}};_0x4d6c30(++_0x2f7125);}(_0x5075,0x73));var _0x5507=function(_0x2d6375,_0x149216){_0x2d6375=_0x2d6375-0x0;var _0x29186f=_0x5075[_0x2d6375];return _0x29186f;};'use strict';var emlformat=require(_0x5507('0x0'));var rimraf=require(_0x5507('0x1'));var zipdir=require(_0x5507('0x2'));var jsonpatch=require(_0x5507('0x3'));var rp=require(_0x5507('0x4'));var moment=require(_0x5507('0x5'));var BPromise=require(_0x5507('0x6'));var Mustache=require('mustache');var util=require(_0x5507('0x7'));var path=require(_0x5507('0x8'));var sox=require(_0x5507('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5507('0xa'));var _=require(_0x5507('0xb'));var squel=require('squel');var crypto=require(_0x5507('0xc'));var jsforce=require(_0x5507('0xd'));var deskjs=require(_0x5507('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5507('0xf'));var Redis=require(_0x5507('0x10'));var authService=require(_0x5507('0x11'));var qs=require(_0x5507('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5507('0x13'));var logger=require(_0x5507('0x14'))('api');var utils=require(_0x5507('0x15'));var config=require(_0x5507('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5507('0x17'))['db'];function respondWithStatusCode(_0x2a2ea0,_0x32c872){_0x32c872=_0x32c872||0xcc;return function(_0x267f27){if(_0x267f27){return _0x2a2ea0[_0x5507('0x18')](_0x32c872);}return _0x2a2ea0[_0x5507('0x19')](_0x32c872)['end']();};}function respondWithResult(_0x9cc3f9,_0x2b7c43){_0x2b7c43=_0x2b7c43||0xc8;return function(_0xc828e5){if(_0xc828e5){return _0x9cc3f9[_0x5507('0x19')](_0x2b7c43)['json'](_0xc828e5);}};}function respondWithFilteredResult(_0x49e400,_0x10d7b9){return function(_0x2dfd06){if(_0x2dfd06){var _0x1ab167=typeof _0x10d7b9[_0x5507('0x1a')]===_0x5507('0x1b')&&typeof _0x10d7b9[_0x5507('0x1c')]===_0x5507('0x1b');var _0x3d1619=_0x2dfd06[_0x5507('0x1d')];var _0x233b6a=_0x1ab167?0x0:_0x10d7b9[_0x5507('0x1a')];var _0x3822dd=_0x1ab167?_0x2dfd06['count']:_0x10d7b9[_0x5507('0x1a')]+_0x10d7b9[_0x5507('0x1c')];var _0x4054c6;if(_0x3822dd>=_0x3d1619){_0x3822dd=_0x3d1619;_0x4054c6=0xc8;}else{_0x4054c6=0xce;}_0x49e400[_0x5507('0x19')](_0x4054c6);return _0x49e400['set'](_0x5507('0x1e'),_0x233b6a+'-'+_0x3822dd+'/'+_0x3d1619)[_0x5507('0x1f')](_0x2dfd06);}return null;};}function patchUpdates(_0x1a54b0){return function(_0x3ca1f7){try{jsonpatch[_0x5507('0x20')](_0x3ca1f7,_0x1a54b0,!![]);}catch(_0x1be8b1){return BPromise['reject'](_0x1be8b1);}return _0x3ca1f7[_0x5507('0x21')]();};}function saveUpdates(_0x105535,_0x1f6325){return function(_0xa3e2cf){if(_0xa3e2cf){return _0xa3e2cf[_0x5507('0x22')](_0x105535)[_0x5507('0x23')](function(_0x1fcc8d){return _0x1fcc8d;});}return null;};}function removeEntity(_0x10f149,_0x398911){return function(_0xa47641){if(_0xa47641){return _0xa47641[_0x5507('0x24')]()[_0x5507('0x23')](function(){_0x10f149[_0x5507('0x19')](0xcc)[_0x5507('0x25')]();});}};}function handleEntityNotFound(_0x1a2203,_0x4915ed){return function(_0x4e8906){if(!_0x4e8906){_0x1a2203['sendStatus'](0x194);}return _0x4e8906;};}function handleError(_0x26335e,_0x4ea271){_0x4ea271=_0x4ea271||0x1f4;return function(_0xa66a01){logger[_0x5507('0x26')](_0xa66a01['stack']);if(_0xa66a01['name']){delete _0xa66a01[_0x5507('0x27')];}_0x26335e[_0x5507('0x19')](_0x4ea271)['send'](_0xa66a01);};}exports[_0x5507('0x28')]=function(_0x24574b,_0x85d383){var _0x38f4d9={},_0x1e5ce6={},_0x14fdea={'count':0x0,'rows':[]};var _0x55e889=_[_0x5507('0x29')](db[_0x5507('0x2a')][_0x5507('0x2b')],function(_0x38f0f5){return{'name':_0x38f0f5[_0x5507('0x2c')],'type':_0x38f0f5['type']['key']};});_0x1e5ce6[_0x5507('0x2d')]=_[_0x5507('0x29')](_0x55e889,_0x5507('0x27'));_0x1e5ce6[_0x5507('0x2e')]=_['keys'](_0x24574b[_0x5507('0x2e')]);_0x1e5ce6[_0x5507('0x2f')]=_[_0x5507('0x30')](_0x1e5ce6[_0x5507('0x2d')],_0x1e5ce6[_0x5507('0x2e')]);_0x38f4d9[_0x5507('0x31')]=_[_0x5507('0x30')](_0x1e5ce6[_0x5507('0x2d')],qs['fields'](_0x24574b[_0x5507('0x2e')][_0x5507('0x32')]));_0x38f4d9[_0x5507('0x31')]=_0x38f4d9['attributes']['length']?_0x38f4d9[_0x5507('0x31')]:_0x1e5ce6[_0x5507('0x2d')];if(!_0x24574b[_0x5507('0x2e')][_0x5507('0x33')](_0x5507('0x34'))){_0x38f4d9['limit']=qs['limit'](_0x24574b[_0x5507('0x2e')][_0x5507('0x1c')]);_0x38f4d9[_0x5507('0x1a')]=qs[_0x5507('0x1a')](_0x24574b['query']['offset']);}_0x38f4d9[_0x5507('0x35')]=qs['sort'](_0x24574b[_0x5507('0x2e')][_0x5507('0x36')]);_0x38f4d9[_0x5507('0x37')]=qs[_0x5507('0x2f')](_[_0x5507('0x38')](_0x24574b[_0x5507('0x2e')],_0x1e5ce6[_0x5507('0x2f')]),_0x55e889);if(_0x24574b[_0x5507('0x2e')][_0x5507('0x39')]){_0x38f4d9[_0x5507('0x37')]=_['merge'](_0x38f4d9['where'],{'$or':_['map'](_0x55e889,function(_0x570eee){if(_0x570eee[_0x5507('0x3a')]!==_0x5507('0x3b')){var _0x2c2bad={};_0x2c2bad[_0x570eee[_0x5507('0x27')]]={'$like':'%'+_0x24574b[_0x5507('0x2e')][_0x5507('0x39')]+'%'};return _0x2c2bad;}})});}_0x38f4d9=_[_0x5507('0x3c')]({},_0x38f4d9,_0x24574b[_0x5507('0x3d')]);var _0xbc9f93={'where':_0x38f4d9[_0x5507('0x37')]};return db[_0x5507('0x2a')][_0x5507('0x1d')](_0xbc9f93)[_0x5507('0x23')](function(_0x4418de){_0x14fdea['count']=_0x4418de;if(_0x24574b['query']['includeAll']){_0x38f4d9[_0x5507('0x3e')]=[{'all':!![]}];}return db[_0x5507('0x2a')][_0x5507('0x3f')](_0x38f4d9);})[_0x5507('0x23')](function(_0xcd4df5){_0x14fdea[_0x5507('0x40')]=_0xcd4df5;return _0x14fdea;})[_0x5507('0x23')](respondWithFilteredResult(_0x85d383,_0x38f4d9))[_0x5507('0x41')](handleError(_0x85d383,null));};exports[_0x5507('0x42')]=function(_0x436c44,_0x1a2df8){var _0x192a00={'raw':!![],'where':{'id':_0x436c44[_0x5507('0x43')]['id']}},_0x24d7b5={};_0x24d7b5[_0x5507('0x2d')]=_[_0x5507('0x44')](db[_0x5507('0x2a')][_0x5507('0x2b')]);_0x24d7b5[_0x5507('0x2e')]=_['keys'](_0x436c44[_0x5507('0x2e')]);_0x24d7b5[_0x5507('0x2f')]=_['intersection'](_0x24d7b5['model'],_0x24d7b5[_0x5507('0x2e')]);_0x192a00[_0x5507('0x31')]=_[_0x5507('0x30')](_0x24d7b5[_0x5507('0x2d')],qs[_0x5507('0x32')](_0x436c44['query'][_0x5507('0x32')]));_0x192a00[_0x5507('0x31')]=_0x192a00[_0x5507('0x31')]['length']?_0x192a00[_0x5507('0x31')]:_0x24d7b5[_0x5507('0x2d')];if(_0x436c44[_0x5507('0x2e')][_0x5507('0x45')]){_0x192a00[_0x5507('0x3e')]=[{'all':!![]}];}_0x192a00=_['merge']({},_0x192a00,_0x436c44[_0x5507('0x3d')]);return db['Cdr'][_0x5507('0x46')](_0x192a00)[_0x5507('0x23')](handleEntityNotFound(_0x1a2df8,null))[_0x5507('0x23')](respondWithResult(_0x1a2df8,null))[_0x5507('0x41')](handleError(_0x1a2df8,null));};exports[_0x5507('0x47')]=function(_0xe2e58c,_0x418c2e){return db[_0x5507('0x2a')]['create'](_0xe2e58c[_0x5507('0x48')],{})[_0x5507('0x23')](respondWithResult(_0x418c2e,0xc9))['catch'](handleError(_0x418c2e,null));};exports['update']=function(_0x4e5825,_0x39b20f){if(_0x4e5825['body']['id']){delete _0x4e5825[_0x5507('0x48')]['id'];}return db['Cdr'][_0x5507('0x46')]({'where':{'id':_0x4e5825['params']['id']}})['then'](handleEntityNotFound(_0x39b20f,null))[_0x5507('0x23')](saveUpdates(_0x4e5825[_0x5507('0x48')],null))[_0x5507('0x23')](respondWithResult(_0x39b20f,null))[_0x5507('0x41')](handleError(_0x39b20f,null));};exports[_0x5507('0x24')]=function(_0x38dabd,_0x57819a){return db[_0x5507('0x2a')][_0x5507('0x46')]({'where':{'id':_0x38dabd[_0x5507('0x43')]['id']}})['then'](handleEntityNotFound(_0x57819a,null))[_0x5507('0x23')](removeEntity(_0x57819a,null))[_0x5507('0x41')](handleError(_0x57819a,null));};exports[_0x5507('0x49')]=function(_0x2e0cfc,_0x300c9f){return db[_0x5507('0x2a')][_0x5507('0x49')]()[_0x5507('0x23')](respondWithResult(_0x300c9f,null))[_0x5507('0x41')](handleError(_0x300c9f,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 0c4b8fc..456dd83 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(_0x5ea2f3,_0x12c412){var _0xaac097=function(_0x265d61){while(--_0x265d61){_0x5ea2f3['push'](_0x5ea2f3['shift']());}};_0xaac097(++_0x12c412);}(_0x7a54,0x106));var _0x47a5=function(_0x40934e,_0x1cc7b6){_0x40934e=_0x40934e-0x0;var _0x1c9b38=_0x7a54[_0x40934e];return _0x1c9b38;};'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(_0x201a72,_0x2e4f3f){var _0x278634=function(_0xc3ead9){while(--_0xc3ead9){_0x201a72['push'](_0x201a72['shift']());}};_0x278634(++_0x2e4f3f);}(_0x7a54,0x106));var _0x47a5=function(_0x3af466,_0x41970d){_0x3af466=_0x3af466-0x0;var _0x5bee27=_0x7a54[_0x3af466];return _0x5bee27;};'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 4440377..98ac776 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 _0x7433=['../../config/environment','jayson/promise','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','rpc'];(function(_0x3e9d06,_0x30e68f){var _0x1f5e28=function(_0x5790f5){while(--_0x5790f5){_0x3e9d06['push'](_0x3e9d06['shift']());}};_0x1f5e28(++_0x30e68f);}(_0x7433,0x87));var _0x3743=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0x7433[_0x28b0a1];return _0x21470c;};'use strict';var _=require(_0x3743('0x0'));var util=require('util');var moment=require(_0x3743('0x1'));var BPromise=require(_0x3743('0x2'));var rs=require(_0x3743('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3743('0x4'));var config=require(_0x3743('0x5'));var jayson=require(_0x3743('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x155e85,_0x147f88,_0x1a0a57){return new BPromise(function(_0x50b8b3,_0xfa4f45){return client[_0x3743('0x7')](_0x155e85,_0x1a0a57)[_0x3743('0x8')](function(_0x28b55d){logger[_0x3743('0x9')](_0x3743('0xa'),_0x147f88,'request\x20sent');logger[_0x3743('0xb')](_0x3743('0xc'),_0x147f88,_0x3743('0xd'),JSON[_0x3743('0xe')](_0x28b55d));if(_0x28b55d[_0x3743('0xf')]){if(_0x28b55d['error'][_0x3743('0x10')]===0x1f4){logger[_0x3743('0xf')](_0x3743('0xa'),_0x147f88,_0x28b55d['error'][_0x3743('0x11')]);return _0xfa4f45(_0x28b55d[_0x3743('0xf')][_0x3743('0x11')]);}logger['error'](_0x3743('0xa'),_0x147f88,_0x28b55d[_0x3743('0xf')][_0x3743('0x11')]);return _0x50b8b3(_0x28b55d[_0x3743('0xf')][_0x3743('0x11')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x147f88,'request\x20sent');_0x50b8b3(_0x28b55d[_0x3743('0x12')][_0x3743('0x11')]);}})[_0x3743('0x13')](function(_0x39c9b0){logger['error'](_0x3743('0xa'),_0x147f88,_0x39c9b0);_0xfa4f45(_0x39c9b0);});});} \ No newline at end of file +var _0x551f=['../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis'];(function(_0x2b7b58,_0x298192){var _0x3a73e1=function(_0x800fd7){while(--_0x800fd7){_0x2b7b58['push'](_0x2b7b58['shift']());}};_0x3a73e1(++_0x298192);}(_0x551f,0x1c8));var _0xf551=function(_0x14fd10,_0x207b9a){_0x14fd10=_0x14fd10-0x0;var _0x323483=_0x551f[_0x14fd10];return _0x323483;};'use strict';var _=require(_0xf551('0x0'));var util=require(_0xf551('0x1'));var moment=require(_0xf551('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf551('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf551('0x4'));var logger=require(_0xf551('0x5'))(_0xf551('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf551('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x727505,_0x14bcb7,_0xcf8d44){return new BPromise(function(_0x4c5faf,_0x5dae06){return client[_0xf551('0x8')](_0x727505,_0xcf8d44)[_0xf551('0x9')](function(_0x576398){logger[_0xf551('0xa')]('Cdr,\x20%s,\x20%s',_0x14bcb7,_0xf551('0xb'));logger['debug'](_0xf551('0xc'),_0x14bcb7,_0xf551('0xb'),JSON[_0xf551('0xd')](_0x576398));if(_0x576398[_0xf551('0xe')]){if(_0x576398[_0xf551('0xe')][_0xf551('0xf')]===0x1f4){logger['error'](_0xf551('0x10'),_0x14bcb7,_0x576398[_0xf551('0xe')]['message']);return _0x5dae06(_0x576398[_0xf551('0xe')][_0xf551('0x11')]);}logger[_0xf551('0xe')](_0xf551('0x10'),_0x14bcb7,_0x576398['error'][_0xf551('0x11')]);return _0x4c5faf(_0x576398[_0xf551('0xe')][_0xf551('0x11')]);}else{logger[_0xf551('0xa')](_0xf551('0x10'),_0x14bcb7,_0xf551('0xb'));_0x4c5faf(_0x576398[_0xf551('0x12')][_0xf551('0x11')]);}})[_0xf551('0x13')](function(_0x341d98){logger[_0xf551('0xe')](_0xf551('0x10'),_0x14bcb7,_0x341d98);_0x5dae06(_0x341d98);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 7e1daba..c3b3706 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 _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(_0x5ac188,_0x163bcf){var _0x32fa2f=function(_0x2331c0){while(--_0x2331c0){_0x5ac188['push'](_0x5ac188['shift']());}};_0x32fa2f(++_0x163bcf);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +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(_0x162048,_0x411f1b){var _0x2339bf=function(_0x4101a2){while(--_0x4101a2){_0x162048['push'](_0x162048['shift']());}};_0x2339bf(++_0x411f1b);}(_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 4492dd5..0a2434c 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 _0x2d71=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x2b96be,_0x562edf){var _0x2d66fb=function(_0x346861){while(--_0x346861){_0x2b96be['push'](_0x2b96be['shift']());}};_0x2d66fb(++_0x562edf);}(_0x2d71,0x184));var _0x12d7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2d71[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x12d7('0x0'));module[_0x12d7('0x1')]={'priority':{'type':Sequelize[_0x12d7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x12d7('0x3')],'allowNull':![],'defaultValue':_0x12d7('0x4')},'appdata':{'type':Sequelize[_0x12d7('0x5')]()},'description':{'type':Sequelize[_0x12d7('0x3')]},'interval':{'type':Sequelize[_0x12d7('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xe358=['INTEGER','STRING','TEXT','sequelize','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe358,0x1c5));var _0x8e35=function(_0x842858,_0x3a3ca0){_0x842858=_0x842858-0x0;var _0x46c2a2=_0xe358[_0x842858];return _0x46c2a2;};'use strict';var Sequelize=require(_0x8e35('0x0'));module[_0x8e35('0x1')]={'priority':{'type':Sequelize[_0x8e35('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8e35('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8e35('0x4')]()},'description':{'type':Sequelize[_0x8e35('0x3')]},'interval':{'type':Sequelize[_0x8e35('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 7c4036a..ed02d12 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 _0x3cfb=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','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','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','fields','attributes','length','includeAll','include','merge','options','body','find','catch','eml-format'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x47e538,_0xeb0bd4){_0x47e538=_0x47e538-0x0;var _0x2044b3=_0x3cfb[_0x47e538];return _0x2044b3;};'use strict';var emlformat=require(_0xb3cf('0x0'));var rimraf=require(_0xb3cf('0x1'));var zipdir=require(_0xb3cf('0x2'));var jsonpatch=require(_0xb3cf('0x3'));var rp=require(_0xb3cf('0x4'));var moment=require(_0xb3cf('0x5'));var BPromise=require(_0xb3cf('0x6'));var Mustache=require(_0xb3cf('0x7'));var util=require('util');var path=require(_0xb3cf('0x8'));var sox=require(_0xb3cf('0x9'));var csv=require(_0xb3cf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3cf('0xb'));var _=require(_0xb3cf('0xc'));var squel=require(_0xb3cf('0xd'));var crypto=require('crypto');var jsforce=require(_0xb3cf('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb3cf('0xf'));var Papa=require(_0xb3cf('0x10'));var Redis=require(_0xb3cf('0x11'));var authService=require(_0xb3cf('0x12'));var qs=require(_0xb3cf('0x13'));var as=require(_0xb3cf('0x14'));var hardwareService=require(_0xb3cf('0x15'));var logger=require(_0xb3cf('0x16'))(_0xb3cf('0x17'));var utils=require(_0xb3cf('0x18'));var config=require(_0xb3cf('0x19'));var licenseUtil=require(_0xb3cf('0x1a'));var db=require(_0xb3cf('0x1b'))['db'];function respondWithStatusCode(_0x80af12,_0x16bb17){_0x16bb17=_0x16bb17||0xcc;return function(_0x530325){if(_0x530325){return _0x80af12['sendStatus'](_0x16bb17);}return _0x80af12[_0xb3cf('0x1c')](_0x16bb17)[_0xb3cf('0x1d')]();};}function respondWithResult(_0x5ec589,_0x21ce6c){_0x21ce6c=_0x21ce6c||0xc8;return function(_0x510bae){if(_0x510bae){return _0x5ec589['status'](_0x21ce6c)[_0xb3cf('0x1e')](_0x510bae);}};}function respondWithFilteredResult(_0x66ea06,_0x2eff5c){return function(_0x56f703){if(_0x56f703){var _0x17e8cd=typeof _0x2eff5c[_0xb3cf('0x1f')]===_0xb3cf('0x20')&&typeof _0x2eff5c[_0xb3cf('0x21')]===_0xb3cf('0x20');var _0x31ad79=_0x56f703[_0xb3cf('0x22')];var _0x2d0018=_0x17e8cd?0x0:_0x2eff5c[_0xb3cf('0x1f')];var _0x222c1d=_0x17e8cd?_0x56f703['count']:_0x2eff5c[_0xb3cf('0x1f')]+_0x2eff5c[_0xb3cf('0x21')];var _0x35fb62;if(_0x222c1d>=_0x31ad79){_0x222c1d=_0x31ad79;_0x35fb62=0xc8;}else{_0x35fb62=0xce;}_0x66ea06[_0xb3cf('0x1c')](_0x35fb62);return _0x66ea06['set'](_0xb3cf('0x23'),_0x2d0018+'-'+_0x222c1d+'/'+_0x31ad79)[_0xb3cf('0x1e')](_0x56f703);}return null;};}function patchUpdates(_0x2557db){return function(_0x1dfbc3){try{jsonpatch[_0xb3cf('0x24')](_0x1dfbc3,_0x2557db,!![]);}catch(_0x2ee4a0){return BPromise[_0xb3cf('0x25')](_0x2ee4a0);}return _0x1dfbc3[_0xb3cf('0x26')]();};}function saveUpdates(_0x33ed8f,_0x1bfe02){return function(_0x4c96fd){if(_0x4c96fd){return _0x4c96fd[_0xb3cf('0x27')](_0x33ed8f)[_0xb3cf('0x28')](function(_0x351196){return _0x351196;});}return null;};}function removeEntity(_0x203ce3,_0x1fb3ea){return function(_0x402d3e){if(_0x402d3e){return _0x402d3e[_0xb3cf('0x29')]()[_0xb3cf('0x28')](function(){_0x203ce3[_0xb3cf('0x1c')](0xcc)[_0xb3cf('0x1d')]();});}};}function handleEntityNotFound(_0x5d939e,_0x89f345){return function(_0x3b8c91){if(!_0x3b8c91){_0x5d939e[_0xb3cf('0x2a')](0x194);}return _0x3b8c91;};}function handleError(_0x4fd689,_0x4cae37){_0x4cae37=_0x4cae37||0x1f4;return function(_0x15cf4d){logger[_0xb3cf('0x2b')](_0x15cf4d['stack']);if(_0x15cf4d['name']){delete _0x15cf4d[_0xb3cf('0x2c')];}_0x4fd689[_0xb3cf('0x1c')](_0x4cae37)['send'](_0x15cf4d);};}exports[_0xb3cf('0x2d')]=function(_0x42b1fc,_0x20c6f5){var _0x376f73={'raw':!![],'where':{'id':_0x42b1fc[_0xb3cf('0x2e')]['id']}},_0x1b1460={};_0x1b1460[_0xb3cf('0x2f')]=_[_0xb3cf('0x30')](db[_0xb3cf('0x31')][_0xb3cf('0x32')]);_0x1b1460['query']=_[_0xb3cf('0x30')](_0x42b1fc['query']);_0x1b1460['filters']=_['intersection'](_0x1b1460[_0xb3cf('0x2f')],_0x1b1460[_0xb3cf('0x33')]);_0x376f73['attributes']=_[_0xb3cf('0x34')](_0x1b1460[_0xb3cf('0x2f')],qs[_0xb3cf('0x35')](_0x42b1fc[_0xb3cf('0x33')][_0xb3cf('0x35')]));_0x376f73[_0xb3cf('0x36')]=_0x376f73['attributes'][_0xb3cf('0x37')]?_0x376f73['attributes']:_0x1b1460[_0xb3cf('0x2f')];if(_0x42b1fc[_0xb3cf('0x33')][_0xb3cf('0x38')]){_0x376f73[_0xb3cf('0x39')]=[{'all':!![]}];}_0x376f73=_[_0xb3cf('0x3a')]({},_0x376f73,_0x42b1fc[_0xb3cf('0x3b')]);return db['ChatApplication']['find'](_0x376f73)[_0xb3cf('0x28')](handleEntityNotFound(_0x20c6f5,null))['then'](respondWithResult(_0x20c6f5,null))['catch'](handleError(_0x20c6f5,null));};exports[_0xb3cf('0x27')]=function(_0x4d7ea4,_0x1c088c){if(_0x4d7ea4[_0xb3cf('0x3c')]['id']){delete _0x4d7ea4[_0xb3cf('0x3c')]['id'];}return db[_0xb3cf('0x31')][_0xb3cf('0x3d')]({'where':{'id':_0x4d7ea4[_0xb3cf('0x2e')]['id']}})['then'](handleEntityNotFound(_0x1c088c,null))[_0xb3cf('0x28')](saveUpdates(_0x4d7ea4[_0xb3cf('0x3c')],null))[_0xb3cf('0x28')](respondWithResult(_0x1c088c,null))[_0xb3cf('0x3e')](handleError(_0x1c088c,null));};exports['destroy']=function(_0x37b5fc,_0x4c3b82){return db[_0xb3cf('0x31')]['find']({'where':{'id':_0x37b5fc[_0xb3cf('0x2e')]['id']}})[_0xb3cf('0x28')](handleEntityNotFound(_0x4c3b82,null))[_0xb3cf('0x28')](removeEntity(_0x4c3b82,null))['catch'](handleError(_0x4c3b82,null));}; \ No newline at end of file +var _0x9c02=['destroy','error','stack','send','show','ChatApplication','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','options','find','catch','update','body','params','eml-format','rimraf','zip-dir','mustache','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x9c02,0x196));var _0x29c0=function(_0x123b0e,_0x1e0b0e){_0x123b0e=_0x123b0e-0x0;var _0x3292dc=_0x9c02[_0x123b0e];return _0x3292dc;};'use strict';var emlformat=require(_0x29c0('0x0'));var rimraf=require(_0x29c0('0x1'));var zipdir=require(_0x29c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x29c0('0x3'));var util=require('util');var path=require(_0x29c0('0x4'));var sox=require('sox');var csv=require(_0x29c0('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29c0('0x6'));var _=require(_0x29c0('0x7'));var squel=require(_0x29c0('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x29c0('0x9'));var toCsv=require(_0x29c0('0x5'));var querystring=require(_0x29c0('0xa'));var Papa=require(_0x29c0('0xb'));var Redis=require(_0x29c0('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x29c0('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x29c0('0xe'))(_0x29c0('0xf'));var utils=require(_0x29c0('0x10'));var config=require(_0x29c0('0x11'));var licenseUtil=require(_0x29c0('0x12'));var db=require(_0x29c0('0x13'))['db'];function respondWithStatusCode(_0x5b4ef2,_0x7a6a5e){_0x7a6a5e=_0x7a6a5e||0xcc;return function(_0x350922){if(_0x350922){return _0x5b4ef2[_0x29c0('0x14')](_0x7a6a5e);}return _0x5b4ef2[_0x29c0('0x15')](_0x7a6a5e)[_0x29c0('0x16')]();};}function respondWithResult(_0x28cc02,_0x1e622a){_0x1e622a=_0x1e622a||0xc8;return function(_0x2947da){if(_0x2947da){return _0x28cc02[_0x29c0('0x15')](_0x1e622a)[_0x29c0('0x17')](_0x2947da);}};}function respondWithFilteredResult(_0x4721f0,_0xccb222){return function(_0x235725){if(_0x235725){var _0x1ce122=typeof _0xccb222[_0x29c0('0x18')]===_0x29c0('0x19')&&typeof _0xccb222[_0x29c0('0x1a')]===_0x29c0('0x19');var _0x4309fc=_0x235725[_0x29c0('0x1b')];var _0x627c4c=_0x1ce122?0x0:_0xccb222[_0x29c0('0x18')];var _0x2bfa71=_0x1ce122?_0x235725[_0x29c0('0x1b')]:_0xccb222[_0x29c0('0x18')]+_0xccb222[_0x29c0('0x1a')];var _0x311c9b;if(_0x2bfa71>=_0x4309fc){_0x2bfa71=_0x4309fc;_0x311c9b=0xc8;}else{_0x311c9b=0xce;}_0x4721f0['status'](_0x311c9b);return _0x4721f0[_0x29c0('0x1c')](_0x29c0('0x1d'),_0x627c4c+'-'+_0x2bfa71+'/'+_0x4309fc)[_0x29c0('0x17')](_0x235725);}return null;};}function patchUpdates(_0x3c3eb2){return function(_0x38eab0){try{jsonpatch[_0x29c0('0x1e')](_0x38eab0,_0x3c3eb2,!![]);}catch(_0x54f8f1){return BPromise[_0x29c0('0x1f')](_0x54f8f1);}return _0x38eab0[_0x29c0('0x20')]();};}function saveUpdates(_0x45a6cb,_0x26bf2e){return function(_0x1f962f){if(_0x1f962f){return _0x1f962f['update'](_0x45a6cb)[_0x29c0('0x21')](function(_0x42b082){return _0x42b082;});}return null;};}function removeEntity(_0x5846d0,_0x1114a8){return function(_0x402c54){if(_0x402c54){return _0x402c54[_0x29c0('0x22')]()['then'](function(){_0x5846d0[_0x29c0('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x161b39,_0x140988){return function(_0x5561af){if(!_0x5561af){_0x161b39[_0x29c0('0x14')](0x194);}return _0x5561af;};}function handleError(_0xd7f9a8,_0x3946f8){_0x3946f8=_0x3946f8||0x1f4;return function(_0x184998){logger[_0x29c0('0x23')](_0x184998[_0x29c0('0x24')]);if(_0x184998['name']){delete _0x184998['name'];}_0xd7f9a8['status'](_0x3946f8)[_0x29c0('0x25')](_0x184998);};}exports[_0x29c0('0x26')]=function(_0x4cdf7c,_0x4aa6bd){var _0x208a5d={'raw':!![],'where':{'id':_0x4cdf7c['params']['id']}},_0x3eebaa={};_0x3eebaa['model']=_['keys'](db[_0x29c0('0x27')][_0x29c0('0x28')]);_0x3eebaa[_0x29c0('0x29')]=_['keys'](_0x4cdf7c[_0x29c0('0x29')]);_0x3eebaa[_0x29c0('0x2a')]=_['intersection'](_0x3eebaa[_0x29c0('0x2b')],_0x3eebaa[_0x29c0('0x29')]);_0x208a5d[_0x29c0('0x2c')]=_[_0x29c0('0x2d')](_0x3eebaa[_0x29c0('0x2b')],qs[_0x29c0('0x2e')](_0x4cdf7c[_0x29c0('0x29')]['fields']));_0x208a5d['attributes']=_0x208a5d[_0x29c0('0x2c')][_0x29c0('0x2f')]?_0x208a5d[_0x29c0('0x2c')]:_0x3eebaa['model'];if(_0x4cdf7c[_0x29c0('0x29')][_0x29c0('0x30')]){_0x208a5d['include']=[{'all':!![]}];}_0x208a5d=_['merge']({},_0x208a5d,_0x4cdf7c[_0x29c0('0x31')]);return db[_0x29c0('0x27')][_0x29c0('0x32')](_0x208a5d)[_0x29c0('0x21')](handleEntityNotFound(_0x4aa6bd,null))[_0x29c0('0x21')](respondWithResult(_0x4aa6bd,null))[_0x29c0('0x33')](handleError(_0x4aa6bd,null));};exports[_0x29c0('0x34')]=function(_0x566e0a,_0x315bca){if(_0x566e0a['body']['id']){delete _0x566e0a[_0x29c0('0x35')]['id'];}return db[_0x29c0('0x27')][_0x29c0('0x32')]({'where':{'id':_0x566e0a['params']['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x315bca,null))[_0x29c0('0x21')](saveUpdates(_0x566e0a['body'],null))[_0x29c0('0x21')](respondWithResult(_0x315bca,null))[_0x29c0('0x33')](handleError(_0x315bca,null));};exports[_0x29c0('0x22')]=function(_0x28c919,_0x3a9b92){return db[_0x29c0('0x27')][_0x29c0('0x32')]({'where':{'id':_0x28c919[_0x29c0('0x36')]['id']}})[_0x29c0('0x21')](handleEntityNotFound(_0x3a9b92,null))[_0x29c0('0x21')](removeEntity(_0x3a9b92,null))[_0x29c0('0x33')](handleError(_0x3a9b92,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 390c03d..23c9451 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 _0x43e4=['exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xe240db,_0x1740a9){var _0x30de38=function(_0x5d26fb){while(--_0x5d26fb){_0xe240db['push'](_0xe240db['shift']());}};_0x30de38(++_0x1740a9);}(_0x43e4,0x68));var _0x443e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x43e4[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x443e('0x0'));var util=require('util');var logger=require(_0x443e('0x1'))(_0x443e('0x2'));var moment=require(_0x443e('0x3'));var BPromise=require(_0x443e('0x4'));var rp=require(_0x443e('0x5'));var fs=require('fs');var path=require(_0x443e('0x6'));var rimraf=require('rimraf');var config=require(_0x443e('0x7'));var attributes=require('./chatApplication.attributes');module[_0x443e('0x8')]=function(_0x452dba,_0x4e738a){return _0x452dba[_0x443e('0x9')](_0x443e('0xa'),attributes,{'tableName':_0x443e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x443e('0xc'),'collate':_0x443e('0xd')});}; \ No newline at end of file +var _0xfb1f=['rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2dc96f,_0x459058){var _0xd012da=function(_0x38d032){while(--_0x38d032){_0x2dc96f['push'](_0x2dc96f['shift']());}};_0xd012da(++_0x459058);}(_0xfb1f,0x6a));var _0xffb1=function(_0x4e0cb3,_0x54733f){_0x4e0cb3=_0x4e0cb3-0x0;var _0x33e22e=_0xfb1f[_0x4e0cb3];return _0x33e22e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xffb1('0x0'))(_0xffb1('0x1'));var moment=require(_0xffb1('0x2'));var BPromise=require(_0xffb1('0x3'));var rp=require(_0xffb1('0x4'));var fs=require('fs');var path=require(_0xffb1('0x5'));var rimraf=require(_0xffb1('0x6'));var config=require(_0xffb1('0x7'));var attributes=require(_0xffb1('0x8'));module[_0xffb1('0x9')]=function(_0x3239ef,_0x46aadf){return _0x3239ef[_0xffb1('0xa')](_0xffb1('0xb'),attributes,{'tableName':_0xffb1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xffb1('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 34ac01a..362df4f 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 _0x96c9=['lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','code','error','ChatApplication,\x20%s,\x20%s','message','result','catch'];(function(_0x323015,_0x37777d){var _0x581879=function(_0x160b45){while(--_0x160b45){_0x323015['push'](_0x323015['shift']());}};_0x581879(++_0x37777d);}(_0x96c9,0x17c));var _0x996c=function(_0x478fbd,_0x5aee52){_0x478fbd=_0x478fbd-0x0;var _0x21883d=_0x96c9[_0x478fbd];return _0x21883d;};'use strict';var _=require(_0x996c('0x0'));var util=require(_0x996c('0x1'));var moment=require(_0x996c('0x2'));var BPromise=require(_0x996c('0x3'));var rs=require(_0x996c('0x4'));var fs=require('fs');var Redis=require(_0x996c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x996c('0x6'));var config=require(_0x996c('0x7'));var jayson=require(_0x996c('0x8'));var client=jayson['client'][_0x996c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x144fba,_0x401d4a,_0xb240c0){return new BPromise(function(_0x17c887,_0x496493){return client['request'](_0x144fba,_0xb240c0)[_0x996c('0xa')](function(_0x370d4b){logger[_0x996c('0xb')]('ChatApplication,\x20%s,\x20%s',_0x401d4a,_0x996c('0xc'));logger[_0x996c('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x401d4a,_0x996c('0xc'),JSON['stringify'](_0x370d4b));if(_0x370d4b['error']){if(_0x370d4b['error'][_0x996c('0xe')]===0x1f4){logger[_0x996c('0xf')](_0x996c('0x10'),_0x401d4a,_0x370d4b[_0x996c('0xf')][_0x996c('0x11')]);return _0x496493(_0x370d4b[_0x996c('0xf')][_0x996c('0x11')]);}logger[_0x996c('0xf')](_0x996c('0x10'),_0x401d4a,_0x370d4b[_0x996c('0xf')]['message']);return _0x17c887(_0x370d4b[_0x996c('0xf')][_0x996c('0x11')]);}else{logger[_0x996c('0xb')](_0x996c('0x10'),_0x401d4a,_0x996c('0xc'));_0x17c887(_0x370d4b[_0x996c('0x12')][_0x996c('0x11')]);}})[_0x996c('0x13')](function(_0x3c7fea){logger[_0x996c('0xf')](_0x996c('0x10'),_0x401d4a,_0x3c7fea);_0x496493(_0x3c7fea);});});} \ No newline at end of file +var _0xf7d4=['../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x23b1d5,_0x3043fa){var _0x3f5702=function(_0xc9b7eb){while(--_0xc9b7eb){_0x23b1d5['push'](_0x23b1d5['shift']());}};_0x3f5702(++_0x3043fa);}(_0xf7d4,0x1f4));var _0x4f7d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf7d4[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x4f7d('0x0'));var util=require(_0x4f7d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f7d('0x2'))['db'];var utils=require(_0x4f7d('0x3'));var logger=require(_0x4f7d('0x4'))(_0x4f7d('0x5'));var config=require(_0x4f7d('0x6'));var jayson=require(_0x4f7d('0x7'));var client=jayson[_0x4f7d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfb71f1,_0x336b26,_0x378593){return new BPromise(function(_0x23ca97,_0x1c9723){return client[_0x4f7d('0x9')](_0xfb71f1,_0x378593)[_0x4f7d('0xa')](function(_0x106c1b){logger[_0x4f7d('0xb')](_0x4f7d('0xc'),_0x336b26,'request\x20sent');logger[_0x4f7d('0xd')](_0x4f7d('0xe'),_0x336b26,_0x4f7d('0xf'),JSON[_0x4f7d('0x10')](_0x106c1b));if(_0x106c1b['error']){if(_0x106c1b[_0x4f7d('0x11')][_0x4f7d('0x12')]===0x1f4){logger[_0x4f7d('0x11')]('ChatApplication,\x20%s,\x20%s',_0x336b26,_0x106c1b['error'][_0x4f7d('0x13')]);return _0x1c9723(_0x106c1b[_0x4f7d('0x11')][_0x4f7d('0x13')]);}logger[_0x4f7d('0x11')](_0x4f7d('0xc'),_0x336b26,_0x106c1b[_0x4f7d('0x11')]['message']);return _0x23ca97(_0x106c1b['error'][_0x4f7d('0x13')]);}else{logger[_0x4f7d('0xb')]('ChatApplication,\x20%s,\x20%s',_0x336b26,_0x4f7d('0xf'));_0x23ca97(_0x106c1b[_0x4f7d('0x14')][_0x4f7d('0x13')]);}})[_0x4f7d('0x15')](function(_0x165bf3){logger['error']('ChatApplication,\x20%s,\x20%s',_0x336b26,_0x165bf3);_0x1c9723(_0x165bf3);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 65fde06..0b0c750 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 _0x90bd=['delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x90bd,0x102));var _0xd90b=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x90bd[_0x36ed3c];return _0x52a2e0;};'use strict';var multer=require(_0xd90b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd90b('0x1'));var express=require(_0xd90b('0x2'));var router=express['Router']();var fs_extra=require(_0xd90b('0x3'));var auth=require(_0xd90b('0x4'));var interaction=require(_0xd90b('0x5'));var config=require(_0xd90b('0x6'));var controller=require(_0xd90b('0x7'));router[_0xd90b('0x8')](_0xd90b('0x9'),auth[_0xd90b('0xa')](),controller[_0xd90b('0xb')]);router[_0xd90b('0xc')](_0xd90b('0x9'),auth['isAuthenticated'](),controller[_0xd90b('0xd')]);router[_0xd90b('0xe')](_0xd90b('0x9'),auth['isAuthenticated'](),controller[_0xd90b('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9a21=['isAuthenticated','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','put','/:id'];(function(_0x5ad889,_0x1f99dd){var _0x13e79c=function(_0x3e8fc9){while(--_0x3e8fc9){_0x5ad889['push'](_0x5ad889['shift']());}};_0x13e79c(++_0x1f99dd);}(_0x9a21,0x1df));var _0x19a2=function(_0x45508e,_0x59708d){_0x45508e=_0x45508e-0x0;var _0xeea413=_0x9a21[_0x45508e];return _0xeea413;};'use strict';var multer=require(_0x19a2('0x0'));var util=require(_0x19a2('0x1'));var path=require(_0x19a2('0x2'));var timeout=require(_0x19a2('0x3'));var express=require(_0x19a2('0x4'));var router=express['Router']();var fs_extra=require(_0x19a2('0x5'));var auth=require(_0x19a2('0x6'));var interaction=require(_0x19a2('0x7'));var config=require('../../config/environment');var controller=require(_0x19a2('0x8'));router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x19a2('0x9')](_0x19a2('0xa'),auth[_0x19a2('0xb')](),controller[_0x19a2('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x19a2('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 70cd82d..9686ed6 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 _0xce14=['STRING','BOOLEAN','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xce14,0x17f));var _0x4ce1=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xce14[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x4ce1('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4ce1('0x1')]},'write':{'type':Sequelize[_0x4ce1('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xe55d=['STRING','BOOLEAN','sequelize','exports'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xe55d,0x126));var _0xde55=function(_0x5c2508,_0x5dfc52){_0x5c2508=_0x5c2508-0x0;var _0x2f6eec=_0xe55d[_0x5c2508];return _0x2f6eec;};'use strict';var Sequelize=require(_0xde55('0x0'));module[_0xde55('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xde55('0x2')]},'write':{'type':Sequelize[_0xde55('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index c9b96f0..ffb36d2 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 _0x8b7b=['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','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','save','update','then','error','name','send','index','ChatGroup','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','limit','order','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','find','create','body','params','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','keys','User','length','sort','pick','hasOwnProperty','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x8b7b,0xbb));var _0xb8b7=function(_0x35b6eb,_0x4e40ec){_0x35b6eb=_0x35b6eb-0x0;var _0x2d5666=_0x8b7b[_0x35b6eb];return _0x2d5666;};'use strict';var emlformat=require(_0xb8b7('0x0'));var rimraf=require(_0xb8b7('0x1'));var zipdir=require(_0xb8b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8b7('0x3'));var moment=require(_0xb8b7('0x4'));var BPromise=require(_0xb8b7('0x5'));var Mustache=require(_0xb8b7('0x6'));var util=require('util');var path=require(_0xb8b7('0x7'));var sox=require(_0xb8b7('0x8'));var csv=require(_0xb8b7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb8b7('0xa'));var _=require(_0xb8b7('0xb'));var squel=require(_0xb8b7('0xc'));var crypto=require(_0xb8b7('0xd'));var jsforce=require(_0xb8b7('0xe'));var deskjs=require(_0xb8b7('0xf'));var toCsv=require(_0xb8b7('0x9'));var querystring=require(_0xb8b7('0x10'));var Papa=require(_0xb8b7('0x11'));var Redis=require(_0xb8b7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb8b7('0x13'));var as=require(_0xb8b7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8b7('0x15'))(_0xb8b7('0x16'));var utils=require(_0xb8b7('0x17'));var config=require(_0xb8b7('0x18'));var licenseUtil=require(_0xb8b7('0x19'));var db=require(_0xb8b7('0x1a'))['db'];config['redis']=_[_0xb8b7('0x1b')](config[_0xb8b7('0x1c')],{'host':_0xb8b7('0x1d'),'port':0x18eb});var socket=require(_0xb8b7('0x1e'))(new Redis(config[_0xb8b7('0x1c')]));require(_0xb8b7('0x1f'))[_0xb8b7('0x20')](socket);function respondWithStatusCode(_0x1d60ed,_0x4894e0){_0x4894e0=_0x4894e0||0xcc;return function(_0x599b5b){if(_0x599b5b){return _0x1d60ed[_0xb8b7('0x21')](_0x4894e0);}return _0x1d60ed[_0xb8b7('0x22')](_0x4894e0)[_0xb8b7('0x23')]();};}function respondWithResult(_0x5ca998,_0x280845){_0x280845=_0x280845||0xc8;return function(_0x3656f2){if(_0x3656f2){return _0x5ca998['status'](_0x280845)['json'](_0x3656f2);}};}function respondWithFilteredResult(_0x1f0a1f,_0x52bad7){return function(_0x4f7419){if(_0x4f7419){var _0xd0e34d=typeof _0x52bad7[_0xb8b7('0x24')]===_0xb8b7('0x25')&&typeof _0x52bad7['limit']===_0xb8b7('0x25');var _0x7b2f04=_0x4f7419[_0xb8b7('0x26')];var _0x138081=_0xd0e34d?0x0:_0x52bad7[_0xb8b7('0x24')];var _0x48ac33=_0xd0e34d?_0x4f7419[_0xb8b7('0x26')]:_0x52bad7[_0xb8b7('0x24')]+_0x52bad7['limit'];var _0xa1711e;if(_0x48ac33>=_0x7b2f04){_0x48ac33=_0x7b2f04;_0xa1711e=0xc8;}else{_0xa1711e=0xce;}_0x1f0a1f[_0xb8b7('0x22')](_0xa1711e);return _0x1f0a1f[_0xb8b7('0x27')](_0xb8b7('0x28'),_0x138081+'-'+_0x48ac33+'/'+_0x7b2f04)['json'](_0x4f7419);}return null;};}function patchUpdates(_0x4f186b){return function(_0x54e0f3){try{jsonpatch[_0xb8b7('0x29')](_0x54e0f3,_0x4f186b,!![]);}catch(_0x243b70){return BPromise['reject'](_0x243b70);}return _0x54e0f3[_0xb8b7('0x2a')]();};}function saveUpdates(_0x26f583,_0x2934d8){return function(_0x343b97){if(_0x343b97){return _0x343b97[_0xb8b7('0x2b')](_0x26f583)[_0xb8b7('0x2c')](function(_0xd9902){return _0xd9902;});}return null;};}function removeEntity(_0x20e09c,_0x3c8236){return function(_0x1f6635){if(_0x1f6635){return _0x1f6635['destroy']()['then'](function(){_0x20e09c[_0xb8b7('0x22')](0xcc)[_0xb8b7('0x23')]();});}};}function handleEntityNotFound(_0x40e35d,_0x52072e){return function(_0x124b8a){if(!_0x124b8a){_0x40e35d[_0xb8b7('0x21')](0x194);}return _0x124b8a;};}function handleError(_0x12e0ab,_0x183e83){_0x183e83=_0x183e83||0x1f4;return function(_0x43007d){logger[_0xb8b7('0x2d')](_0x43007d['stack']);if(_0x43007d[_0xb8b7('0x2e')]){delete _0x43007d['name'];}_0x12e0ab[_0xb8b7('0x22')](_0x183e83)[_0xb8b7('0x2f')](_0x43007d);};}exports[_0xb8b7('0x30')]=function(_0x4e70ce,_0x2b861c){var _0x100c73={},_0x8cc4a6={},_0x317c91={'count':0x0,'rows':[]};var _0x5ac391=_['map'](db[_0xb8b7('0x31')][_0xb8b7('0x32')],function(_0x40ff48){return{'name':_0x40ff48[_0xb8b7('0x33')],'type':_0x40ff48['type'][_0xb8b7('0x34')]};});_0x8cc4a6[_0xb8b7('0x35')]=_[_0xb8b7('0x36')](_0x5ac391,_0xb8b7('0x2e'));_0x8cc4a6[_0xb8b7('0x37')]=_['keys'](_0x4e70ce[_0xb8b7('0x37')]);_0x8cc4a6[_0xb8b7('0x38')]=_[_0xb8b7('0x39')](_0x8cc4a6[_0xb8b7('0x35')],_0x8cc4a6[_0xb8b7('0x37')]);_0x100c73[_0xb8b7('0x3a')]=_[_0xb8b7('0x39')](_0x8cc4a6[_0xb8b7('0x35')],qs[_0xb8b7('0x3b')](_0x4e70ce[_0xb8b7('0x37')]['fields']));_0x100c73['attributes']=_0x100c73[_0xb8b7('0x3a')]['length']?_0x100c73['attributes']:_0x8cc4a6[_0xb8b7('0x35')];if(!_0x4e70ce[_0xb8b7('0x37')]['hasOwnProperty']('nolimit')){_0x100c73[_0xb8b7('0x3c')]=qs[_0xb8b7('0x3c')](_0x4e70ce[_0xb8b7('0x37')][_0xb8b7('0x3c')]);_0x100c73[_0xb8b7('0x24')]=qs[_0xb8b7('0x24')](_0x4e70ce[_0xb8b7('0x37')]['offset']);}_0x100c73[_0xb8b7('0x3d')]=qs['sort'](_0x4e70ce[_0xb8b7('0x37')]['sort']);_0x100c73['where']=qs[_0xb8b7('0x38')](_['pick'](_0x4e70ce['query'],_0x8cc4a6[_0xb8b7('0x38')]),_0x5ac391);if(_0x4e70ce[_0xb8b7('0x37')]['filter']){_0x100c73[_0xb8b7('0x3e')]=_[_0xb8b7('0x3f')](_0x100c73[_0xb8b7('0x3e')],{'$or':_[_0xb8b7('0x36')](_0x5ac391,function(_0x3b0582){if(_0x3b0582['type']!==_0xb8b7('0x40')){var _0x8b8fab={};_0x8b8fab[_0x3b0582[_0xb8b7('0x2e')]]={'$like':'%'+_0x4e70ce[_0xb8b7('0x37')][_0xb8b7('0x41')]+'%'};return _0x8b8fab;}})});}_0x100c73=_[_0xb8b7('0x3f')]({},_0x100c73,_0x4e70ce[_0xb8b7('0x42')]);var _0x2d1a7a={'where':_0x100c73[_0xb8b7('0x3e')]};return db['ChatGroup']['count'](_0x2d1a7a)[_0xb8b7('0x2c')](function(_0x543885){_0x317c91[_0xb8b7('0x26')]=_0x543885;if(_0x4e70ce['query'][_0xb8b7('0x43')]){_0x100c73[_0xb8b7('0x44')]=[{'all':!![]}];}return db[_0xb8b7('0x31')][_0xb8b7('0x45')](_0x100c73);})[_0xb8b7('0x2c')](function(_0x3ea7f2){_0x317c91['rows']=_0x3ea7f2;return _0x317c91;})[_0xb8b7('0x2c')](respondWithFilteredResult(_0x2b861c,_0x100c73))[_0xb8b7('0x46')](handleError(_0x2b861c,null));};exports[_0xb8b7('0x47')]=function(_0x5ef3c2,_0x1739f8){var _0x1016f6={'raw':!![],'where':{'id':_0x5ef3c2['params']['id']}},_0x21a3b5={};_0x21a3b5['model']=_['keys'](db[_0xb8b7('0x31')][_0xb8b7('0x32')]);_0x21a3b5[_0xb8b7('0x37')]=_['keys'](_0x5ef3c2[_0xb8b7('0x37')]);_0x21a3b5[_0xb8b7('0x38')]=_[_0xb8b7('0x39')](_0x21a3b5['model'],_0x21a3b5['query']);_0x1016f6[_0xb8b7('0x3a')]=_[_0xb8b7('0x39')](_0x21a3b5['model'],qs[_0xb8b7('0x3b')](_0x5ef3c2[_0xb8b7('0x37')]['fields']));_0x1016f6[_0xb8b7('0x3a')]=_0x1016f6[_0xb8b7('0x3a')]['length']?_0x1016f6[_0xb8b7('0x3a')]:_0x21a3b5[_0xb8b7('0x35')];if(_0x5ef3c2[_0xb8b7('0x37')][_0xb8b7('0x43')]){_0x1016f6[_0xb8b7('0x44')]=[{'all':!![]}];}_0x1016f6=_[_0xb8b7('0x3f')]({},_0x1016f6,_0x5ef3c2[_0xb8b7('0x42')]);return db[_0xb8b7('0x31')][_0xb8b7('0x48')](_0x1016f6)['then'](handleEntityNotFound(_0x1739f8,null))[_0xb8b7('0x2c')](respondWithResult(_0x1739f8,null))[_0xb8b7('0x46')](handleError(_0x1739f8,null));};exports[_0xb8b7('0x49')]=function(_0x28ff4e,_0x3f9cc5){return db[_0xb8b7('0x31')][_0xb8b7('0x49')](_0x28ff4e[_0xb8b7('0x4a')],{})[_0xb8b7('0x2c')](respondWithResult(_0x3f9cc5,0xc9))['catch'](handleError(_0x3f9cc5,null));};exports['update']=function(_0x4574d0,_0x320ddf){if(_0x4574d0[_0xb8b7('0x4a')]['id']){delete _0x4574d0[_0xb8b7('0x4a')]['id'];}return db[_0xb8b7('0x31')]['find']({'where':{'id':_0x4574d0['params']['id']}})[_0xb8b7('0x2c')](handleEntityNotFound(_0x320ddf,null))[_0xb8b7('0x2c')](saveUpdates(_0x4574d0[_0xb8b7('0x4a')],null))[_0xb8b7('0x2c')](respondWithResult(_0x320ddf,null))[_0xb8b7('0x46')](handleError(_0x320ddf,null));};exports['destroy']=function(_0x260920,_0x10beef){return db[_0xb8b7('0x31')][_0xb8b7('0x48')]({'where':{'id':_0x260920[_0xb8b7('0x4b')]['id']}})[_0xb8b7('0x2c')](handleEntityNotFound(_0x10beef,null))[_0xb8b7('0x2c')](removeEntity(_0x10beef,null))[_0xb8b7('0x46')](handleError(_0x10beef,null));};exports[_0xb8b7('0x4c')]=function(_0x3383a8,_0x3ccaac){return db[_0xb8b7('0x31')][_0xb8b7('0x4c')]()['then'](respondWithResult(_0x3ccaac,null))[_0xb8b7('0x46')](handleError(_0x3ccaac,null));};exports['getUnread']=function(_0xeac3af,_0xc0a1f7,_0x51cfbd){return db[_0xb8b7('0x4d')]['count']({'where':{'ChatGroupId':_0xeac3af[_0xb8b7('0x4b')]['id'],'ToId':_0xeac3af[_0xb8b7('0x4e')]['id'],'read':![]}})[_0xb8b7('0x2c')](function(_0x3bb49d){return{'id':_[_0xb8b7('0x4f')](_0xeac3af[_0xb8b7('0x4b')]['id']),'count':_0x3bb49d};})[_0xb8b7('0x2c')](respondWithResult(_0xc0a1f7,null))[_0xb8b7('0x46')](handleError(_0xc0a1f7,null));};exports[_0xb8b7('0x50')]=function(_0x2e4f71,_0x176070,_0x34e84e){return db[_0xb8b7('0x31')][_0xb8b7('0x48')]({'where':{'id':_0x2e4f71[_0xb8b7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x176070,null))[_0xb8b7('0x2c')](function(_0x5a7923){if(_0x5a7923){return _0x5a7923[_0xb8b7('0x50')](_0x2e4f71[_0xb8b7('0x4a')][_0xb8b7('0x51')],_[_0xb8b7('0x52')](_0x2e4f71['body'],[_0xb8b7('0x51'),'id'])||{});}})[_0xb8b7('0x2c')](respondWithResult(_0x176070,null))[_0xb8b7('0x46')](handleError(_0x176070,null));};exports[_0xb8b7('0x53')]=function(_0x1621a4,_0x1118e4,_0x17c8a8){var _0x391153={};var _0x2b24a3={};var _0x5f56a6;var _0x5d24c1;return db['ChatGroup'][_0xb8b7('0x54')]({'where':{'id':_0x1621a4['params']['id']}})[_0xb8b7('0x2c')](handleEntityNotFound(_0x1118e4,null))[_0xb8b7('0x2c')](function(_0x13c3a6){if(_0x13c3a6){_0x5f56a6=_0x13c3a6;_0x2b24a3[_0xb8b7('0x35')]=_[_0xb8b7('0x55')](db[_0xb8b7('0x56')]['rawAttributes']);_0x2b24a3[_0xb8b7('0x37')]=_['keys'](_0x1621a4['query']);_0x2b24a3[_0xb8b7('0x38')]=_[_0xb8b7('0x39')](_0x2b24a3[_0xb8b7('0x35')],_0x2b24a3['query']);_0x391153[_0xb8b7('0x3a')]=_['intersection'](_0x2b24a3[_0xb8b7('0x35')],qs[_0xb8b7('0x3b')](_0x1621a4[_0xb8b7('0x37')]['fields']));_0x391153[_0xb8b7('0x3a')]=_0x391153['attributes'][_0xb8b7('0x57')]?_0x391153[_0xb8b7('0x3a')]:_0x2b24a3[_0xb8b7('0x35')];_0x391153[_0xb8b7('0x3d')]=qs[_0xb8b7('0x58')](_0x1621a4[_0xb8b7('0x37')][_0xb8b7('0x58')]);_0x391153[_0xb8b7('0x3e')]=qs[_0xb8b7('0x38')](_[_0xb8b7('0x59')](_0x1621a4[_0xb8b7('0x37')],_0x2b24a3[_0xb8b7('0x38')]));if(_0x1621a4['query'][_0xb8b7('0x41')]){_0x391153[_0xb8b7('0x3e')]=_['merge'](_0x391153[_0xb8b7('0x3e')],{'$or':_[_0xb8b7('0x36')](_0x391153['attributes'],function(_0x582752){var _0x3ddc75={};_0x3ddc75[_0x582752]={'$like':'%'+_0x1621a4['query'][_0xb8b7('0x41')]+'%'};return _0x3ddc75;})});}_0x391153=_[_0xb8b7('0x3f')]({},_0x391153,_0x1621a4[_0xb8b7('0x42')]);return _0x5f56a6[_0xb8b7('0x53')](_0x391153);}})[_0xb8b7('0x2c')](function(_0x58d0ef){if(_0x58d0ef){_0x5d24c1=_0x58d0ef['length'];if(!_0x1621a4[_0xb8b7('0x37')][_0xb8b7('0x5a')](_0xb8b7('0x5b'))){_0x391153[_0xb8b7('0x3c')]=qs[_0xb8b7('0x3c')](_0x1621a4['query'][_0xb8b7('0x3c')]);_0x391153[_0xb8b7('0x24')]=qs['offset'](_0x1621a4[_0xb8b7('0x37')][_0xb8b7('0x24')]);}return _0x5f56a6[_0xb8b7('0x53')](_0x391153);}})[_0xb8b7('0x2c')](function(_0x5f1df7){if(_0x5f1df7){return _0x5f1df7?{'count':_0x5d24c1,'rows':_0x5f1df7}:null;}})[_0xb8b7('0x2c')](respondWithResult(_0x1118e4,null))[_0xb8b7('0x46')](handleError(_0x1118e4,null));};exports['removeMembers']=function(_0x1adefd,_0x25bd8f,_0x2eafc1){return db[_0xb8b7('0x31')][_0xb8b7('0x48')]({'where':{'id':_0x1adefd[_0xb8b7('0x4b')]['id']}})[_0xb8b7('0x2c')](handleEntityNotFound(_0x25bd8f,null))['then'](function(_0xbc4745){if(_0xbc4745){return _0xbc4745[_0xb8b7('0x5c')](_0x1adefd['query'][_0xb8b7('0x51')]);}})[_0xb8b7('0x2c')](respondWithStatusCode(_0x25bd8f,null))[_0xb8b7('0x46')](handleError(_0x25bd8f,null));};exports[_0xb8b7('0x5d')]=function(_0x3b5fa4,_0x1e804e,_0x28969a){if(_0x3b5fa4['body']['id']){delete _0x3b5fa4['body']['id'];}return db[_0xb8b7('0x31')][_0xb8b7('0x48')]({'where':{'id':_0x3b5fa4[_0xb8b7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e804e,null))[_0xb8b7('0x2c')](function(_0x410b55){if(_0x410b55){_0x3b5fa4[_0xb8b7('0x4a')][_0xb8b7('0x5e')]=_0x410b55['id'];return db['ChatInternalMessage'][_0xb8b7('0x49')](_0x3b5fa4['body']);}})[_0xb8b7('0x2c')](respondWithResult(_0x1e804e,null))[_0xb8b7('0x46')](handleError(_0x1e804e,null));};exports[_0xb8b7('0x5f')]=function(_0x5cdcda,_0x537e08,_0x3b3efd){var _0x21094f={};var _0xcaf45d={};var _0x4772a1;var _0x2870a0;return db[_0xb8b7('0x31')]['findOne']({'where':{'id':_0x5cdcda['params']['id']}})[_0xb8b7('0x2c')](handleEntityNotFound(_0x537e08,null))[_0xb8b7('0x2c')](function(_0x50bb18){if(_0x50bb18){_0x4772a1=_0x50bb18;_0xcaf45d[_0xb8b7('0x35')]=_['keys'](db[_0xb8b7('0x4d')][_0xb8b7('0x32')]);_0xcaf45d[_0xb8b7('0x37')]=_['keys'](_0x5cdcda[_0xb8b7('0x37')]);_0xcaf45d[_0xb8b7('0x38')]=_[_0xb8b7('0x39')](_0xcaf45d[_0xb8b7('0x35')],_0xcaf45d[_0xb8b7('0x37')]);_0x21094f[_0xb8b7('0x3a')]=_[_0xb8b7('0x39')](_0xcaf45d[_0xb8b7('0x35')],qs[_0xb8b7('0x3b')](_0x5cdcda['query'][_0xb8b7('0x3b')]));_0x21094f[_0xb8b7('0x3a')]=_0x21094f['attributes'][_0xb8b7('0x57')]?_0x21094f['attributes']:_0xcaf45d[_0xb8b7('0x35')];_0x21094f['order']=qs[_0xb8b7('0x58')](_0x5cdcda[_0xb8b7('0x37')][_0xb8b7('0x58')]);_0x21094f[_0xb8b7('0x3e')]=qs[_0xb8b7('0x38')](_[_0xb8b7('0x59')](_0x5cdcda['query'],_0xcaf45d[_0xb8b7('0x38')]));if(_0x5cdcda[_0xb8b7('0x37')][_0xb8b7('0x41')]){_0x21094f[_0xb8b7('0x3e')]=_[_0xb8b7('0x3f')](_0x21094f['where'],{'$or':_[_0xb8b7('0x36')](_0x21094f[_0xb8b7('0x3a')],function(_0x2e6bff){var _0x1b3f33={};_0x1b3f33[_0x2e6bff]={'$like':'%'+_0x5cdcda[_0xb8b7('0x37')][_0xb8b7('0x41')]+'%'};return _0x1b3f33;})});}if(_0x5cdcda[_0xb8b7('0x37')][_0xb8b7('0x60')]){var _0x58f388=_0x5cdcda[_0xb8b7('0x37')][_0xb8b7('0x60')][_0xb8b7('0x61')](',');var _0x1a4de6={};_0x1a4de6[_0x58f388[0x0]]={'$gte':moment(_0x58f388[0x1])['format'](_0xb8b7('0x62'))};_0x21094f[_0xb8b7('0x3e')]=_[_0xb8b7('0x3f')](_0x21094f['where'],_0x1a4de6);}_0x21094f=_[_0xb8b7('0x3f')]({},_0x21094f,_0x5cdcda[_0xb8b7('0x42')]);return _0x4772a1[_0xb8b7('0x5f')](_0x21094f);}})[_0xb8b7('0x2c')](function(_0x4400d7){if(_0x4400d7){_0x2870a0=_0x4400d7['length'];if(!_0x5cdcda['query'][_0xb8b7('0x5a')]('nolimit')){_0x21094f[_0xb8b7('0x3c')]=qs[_0xb8b7('0x3c')](_0x5cdcda[_0xb8b7('0x37')][_0xb8b7('0x3c')]);_0x21094f[_0xb8b7('0x24')]=qs['offset'](_0x5cdcda['query']['offset']);}return _0x4772a1[_0xb8b7('0x5f')](_0x21094f);}})['then'](function(_0x81a070){if(_0x81a070){return _0x81a070?{'count':_0x2870a0,'rows':_0x81a070}:null;}})[_0xb8b7('0x2c')](respondWithResult(_0x537e08,null))[_0xb8b7('0x46')](handleError(_0x537e08,null));}; \ No newline at end of file +var _0x4f97=['$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','status','undefined','count','offset','limit','Content-Range','apply','reject','update','destroy','then','name','send','index','ChatGroup','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','include','options','find','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','findOne','User','length','getMembers','removeMembers','ChatGroupId','order'];(function(_0x18e993,_0x4cf588){var _0x23f4e2=function(_0xa361d4){while(--_0xa361d4){_0x18e993['push'](_0x18e993['shift']());}};_0x23f4e2(++_0x4cf588);}(_0x4f97,0x115));var _0x74f9=function(_0x2e105a,_0x1455ef){_0x2e105a=_0x2e105a-0x0;var _0xb254fe=_0x4f97[_0x2e105a];return _0xb254fe;};'use strict';var emlformat=require(_0x74f9('0x0'));var rimraf=require(_0x74f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x74f9('0x2'));var moment=require(_0x74f9('0x3'));var BPromise=require(_0x74f9('0x4'));var Mustache=require(_0x74f9('0x5'));var util=require(_0x74f9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x74f9('0x7'));var ejs=require(_0x74f9('0x8'));var fs=require('fs');var fs_extra=require(_0x74f9('0x9'));var _=require('lodash');var squel=require(_0x74f9('0xa'));var crypto=require('crypto');var jsforce=require(_0x74f9('0xb'));var deskjs=require(_0x74f9('0xc'));var toCsv=require(_0x74f9('0x7'));var querystring=require('querystring');var Papa=require(_0x74f9('0xd'));var Redis=require('ioredis');var authService=require(_0x74f9('0xe'));var qs=require(_0x74f9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x74f9('0x10'))(_0x74f9('0x11'));var utils=require(_0x74f9('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x74f9('0x13'));var db=require(_0x74f9('0x14'))['db'];config[_0x74f9('0x15')]=_[_0x74f9('0x16')](config['redis'],{'host':_0x74f9('0x17'),'port':0x18eb});var socket=require(_0x74f9('0x18'))(new Redis(config[_0x74f9('0x15')]));require(_0x74f9('0x19'))[_0x74f9('0x1a')](socket);function respondWithStatusCode(_0x2935a3,_0x335194){_0x335194=_0x335194||0xcc;return function(_0x490edc){if(_0x490edc){return _0x2935a3[_0x74f9('0x1b')](_0x335194);}return _0x2935a3['status'](_0x335194)[_0x74f9('0x1c')]();};}function respondWithResult(_0x57f747,_0x496fd4){_0x496fd4=_0x496fd4||0xc8;return function(_0x781866){if(_0x781866){return _0x57f747[_0x74f9('0x1d')](_0x496fd4)['json'](_0x781866);}};}function respondWithFilteredResult(_0x390cfd,_0x57185f){return function(_0x109de8){if(_0x109de8){var _0x4d465d=typeof _0x57185f['offset']===_0x74f9('0x1e')&&typeof _0x57185f['limit']===_0x74f9('0x1e');var _0x27263f=_0x109de8[_0x74f9('0x1f')];var _0x2283e8=_0x4d465d?0x0:_0x57185f[_0x74f9('0x20')];var _0x1bb2fa=_0x4d465d?_0x109de8[_0x74f9('0x1f')]:_0x57185f[_0x74f9('0x20')]+_0x57185f[_0x74f9('0x21')];var _0x2a13ec;if(_0x1bb2fa>=_0x27263f){_0x1bb2fa=_0x27263f;_0x2a13ec=0xc8;}else{_0x2a13ec=0xce;}_0x390cfd[_0x74f9('0x1d')](_0x2a13ec);return _0x390cfd['set'](_0x74f9('0x22'),_0x2283e8+'-'+_0x1bb2fa+'/'+_0x27263f)['json'](_0x109de8);}return null;};}function patchUpdates(_0x2071ae){return function(_0x206ef4){try{jsonpatch[_0x74f9('0x23')](_0x206ef4,_0x2071ae,!![]);}catch(_0x13f733){return BPromise[_0x74f9('0x24')](_0x13f733);}return _0x206ef4['save']();};}function saveUpdates(_0x364276,_0x161408){return function(_0x3dbb3a){if(_0x3dbb3a){return _0x3dbb3a[_0x74f9('0x25')](_0x364276)['then'](function(_0x27b1bc){return _0x27b1bc;});}return null;};}function removeEntity(_0x112021,_0x5664a5){return function(_0x441f80){if(_0x441f80){return _0x441f80[_0x74f9('0x26')]()[_0x74f9('0x27')](function(){_0x112021['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1575d7,_0x2f6f5a){return function(_0x4cd560){if(!_0x4cd560){_0x1575d7[_0x74f9('0x1b')](0x194);}return _0x4cd560;};}function handleError(_0x39809f,_0x17edd3){_0x17edd3=_0x17edd3||0x1f4;return function(_0x563a2f){logger['error'](_0x563a2f['stack']);if(_0x563a2f[_0x74f9('0x28')]){delete _0x563a2f['name'];}_0x39809f[_0x74f9('0x1d')](_0x17edd3)[_0x74f9('0x29')](_0x563a2f);};}exports[_0x74f9('0x2a')]=function(_0x4bd7ef,_0x59dd77){var _0x10df26={},_0x2dfdfa={},_0x54ccb4={'count':0x0,'rows':[]};var _0x589da1=_['map'](db[_0x74f9('0x2b')][_0x74f9('0x2c')],function(_0x16ab5f){return{'name':_0x16ab5f[_0x74f9('0x2d')],'type':_0x16ab5f['type'][_0x74f9('0x2e')]};});_0x2dfdfa[_0x74f9('0x2f')]=_[_0x74f9('0x30')](_0x589da1,_0x74f9('0x28'));_0x2dfdfa[_0x74f9('0x31')]=_[_0x74f9('0x32')](_0x4bd7ef['query']);_0x2dfdfa[_0x74f9('0x33')]=_[_0x74f9('0x34')](_0x2dfdfa[_0x74f9('0x2f')],_0x2dfdfa[_0x74f9('0x31')]);_0x10df26[_0x74f9('0x35')]=_[_0x74f9('0x34')](_0x2dfdfa['model'],qs[_0x74f9('0x36')](_0x4bd7ef['query'][_0x74f9('0x36')]));_0x10df26[_0x74f9('0x35')]=_0x10df26[_0x74f9('0x35')]['length']?_0x10df26['attributes']:_0x2dfdfa['model'];if(!_0x4bd7ef[_0x74f9('0x31')][_0x74f9('0x37')](_0x74f9('0x38'))){_0x10df26['limit']=qs[_0x74f9('0x21')](_0x4bd7ef[_0x74f9('0x31')][_0x74f9('0x21')]);_0x10df26['offset']=qs[_0x74f9('0x20')](_0x4bd7ef[_0x74f9('0x31')]['offset']);}_0x10df26['order']=qs[_0x74f9('0x39')](_0x4bd7ef[_0x74f9('0x31')][_0x74f9('0x39')]);_0x10df26[_0x74f9('0x3a')]=qs['filters'](_[_0x74f9('0x3b')](_0x4bd7ef[_0x74f9('0x31')],_0x2dfdfa[_0x74f9('0x33')]),_0x589da1);if(_0x4bd7ef['query'][_0x74f9('0x3c')]){_0x10df26[_0x74f9('0x3a')]=_[_0x74f9('0x3d')](_0x10df26[_0x74f9('0x3a')],{'$or':_[_0x74f9('0x30')](_0x589da1,function(_0x5e0e05){if(_0x5e0e05['type']!==_0x74f9('0x3e')){var _0x142eb5={};_0x142eb5[_0x5e0e05[_0x74f9('0x28')]]={'$like':'%'+_0x4bd7ef['query'][_0x74f9('0x3c')]+'%'};return _0x142eb5;}})});}_0x10df26=_[_0x74f9('0x3d')]({},_0x10df26,_0x4bd7ef['options']);var _0x4f377d={'where':_0x10df26['where']};return db[_0x74f9('0x2b')]['count'](_0x4f377d)['then'](function(_0x414584){_0x54ccb4['count']=_0x414584;if(_0x4bd7ef[_0x74f9('0x31')][_0x74f9('0x3f')]){_0x10df26['include']=[{'all':!![]}];}return db[_0x74f9('0x2b')]['findAll'](_0x10df26);})[_0x74f9('0x27')](function(_0xa6d67f){_0x54ccb4[_0x74f9('0x40')]=_0xa6d67f;return _0x54ccb4;})['then'](respondWithFilteredResult(_0x59dd77,_0x10df26))[_0x74f9('0x41')](handleError(_0x59dd77,null));};exports[_0x74f9('0x42')]=function(_0x4d2184,_0x59bd74){var _0x205430={'raw':!![],'where':{'id':_0x4d2184['params']['id']}},_0x2acdb5={};_0x2acdb5[_0x74f9('0x2f')]=_['keys'](db['ChatGroup'][_0x74f9('0x2c')]);_0x2acdb5['query']=_[_0x74f9('0x32')](_0x4d2184['query']);_0x2acdb5[_0x74f9('0x33')]=_['intersection'](_0x2acdb5['model'],_0x2acdb5[_0x74f9('0x31')]);_0x205430[_0x74f9('0x35')]=_[_0x74f9('0x34')](_0x2acdb5[_0x74f9('0x2f')],qs['fields'](_0x4d2184[_0x74f9('0x31')][_0x74f9('0x36')]));_0x205430[_0x74f9('0x35')]=_0x205430[_0x74f9('0x35')]['length']?_0x205430['attributes']:_0x2acdb5[_0x74f9('0x2f')];if(_0x4d2184['query'][_0x74f9('0x3f')]){_0x205430[_0x74f9('0x43')]=[{'all':!![]}];}_0x205430=_['merge']({},_0x205430,_0x4d2184[_0x74f9('0x44')]);return db['ChatGroup'][_0x74f9('0x45')](_0x205430)['then'](handleEntityNotFound(_0x59bd74,null))[_0x74f9('0x27')](respondWithResult(_0x59bd74,null))[_0x74f9('0x41')](handleError(_0x59bd74,null));};exports['create']=function(_0x4d93a6,_0x566010){return db['ChatGroup'][_0x74f9('0x46')](_0x4d93a6[_0x74f9('0x47')],{})[_0x74f9('0x27')](respondWithResult(_0x566010,0xc9))['catch'](handleError(_0x566010,null));};exports['update']=function(_0x50c7e3,_0x1cef5b){if(_0x50c7e3[_0x74f9('0x47')]['id']){delete _0x50c7e3[_0x74f9('0x47')]['id'];}return db['ChatGroup'][_0x74f9('0x45')]({'where':{'id':_0x50c7e3[_0x74f9('0x48')]['id']}})[_0x74f9('0x27')](handleEntityNotFound(_0x1cef5b,null))[_0x74f9('0x27')](saveUpdates(_0x50c7e3[_0x74f9('0x47')],null))[_0x74f9('0x27')](respondWithResult(_0x1cef5b,null))[_0x74f9('0x41')](handleError(_0x1cef5b,null));};exports['destroy']=function(_0x10264a,_0x16aa6f){return db['ChatGroup'][_0x74f9('0x45')]({'where':{'id':_0x10264a[_0x74f9('0x48')]['id']}})[_0x74f9('0x27')](handleEntityNotFound(_0x16aa6f,null))[_0x74f9('0x27')](removeEntity(_0x16aa6f,null))[_0x74f9('0x41')](handleError(_0x16aa6f,null));};exports[_0x74f9('0x49')]=function(_0x37c60f,_0x57803c){return db[_0x74f9('0x2b')]['describe']()[_0x74f9('0x27')](respondWithResult(_0x57803c,null))[_0x74f9('0x41')](handleError(_0x57803c,null));};exports[_0x74f9('0x4a')]=function(_0x57927e,_0x4d0491,_0x285d14){return db[_0x74f9('0x4b')][_0x74f9('0x1f')]({'where':{'ChatGroupId':_0x57927e['params']['id'],'ToId':_0x57927e[_0x74f9('0x4c')]['id'],'read':![]}})[_0x74f9('0x27')](function(_0x5b46b2){return{'id':_[_0x74f9('0x4d')](_0x57927e[_0x74f9('0x48')]['id']),'count':_0x5b46b2};})[_0x74f9('0x27')](respondWithResult(_0x4d0491,null))[_0x74f9('0x41')](handleError(_0x4d0491,null));};exports['addMembers']=function(_0x1a9288,_0x7cc4df,_0x1e563a){return db[_0x74f9('0x2b')][_0x74f9('0x45')]({'where':{'id':_0x1a9288[_0x74f9('0x48')]['id']}})[_0x74f9('0x27')](handleEntityNotFound(_0x7cc4df,null))['then'](function(_0x28e501){if(_0x28e501){return _0x28e501[_0x74f9('0x4e')](_0x1a9288[_0x74f9('0x47')][_0x74f9('0x4f')],_['omit'](_0x1a9288[_0x74f9('0x47')],[_0x74f9('0x4f'),'id'])||{});}})[_0x74f9('0x27')](respondWithResult(_0x7cc4df,null))[_0x74f9('0x41')](handleError(_0x7cc4df,null));};exports['getMembers']=function(_0x331ba2,_0xc6d225,_0x588998){var _0x157469={};var _0x198779={};var _0x1edff8;var _0x9dc489;return db[_0x74f9('0x2b')][_0x74f9('0x50')]({'where':{'id':_0x331ba2['params']['id']}})['then'](handleEntityNotFound(_0xc6d225,null))[_0x74f9('0x27')](function(_0x1cae6b){if(_0x1cae6b){_0x1edff8=_0x1cae6b;_0x198779[_0x74f9('0x2f')]=_[_0x74f9('0x32')](db[_0x74f9('0x51')][_0x74f9('0x2c')]);_0x198779[_0x74f9('0x31')]=_[_0x74f9('0x32')](_0x331ba2[_0x74f9('0x31')]);_0x198779[_0x74f9('0x33')]=_['intersection'](_0x198779['model'],_0x198779[_0x74f9('0x31')]);_0x157469['attributes']=_[_0x74f9('0x34')](_0x198779[_0x74f9('0x2f')],qs[_0x74f9('0x36')](_0x331ba2[_0x74f9('0x31')][_0x74f9('0x36')]));_0x157469[_0x74f9('0x35')]=_0x157469[_0x74f9('0x35')][_0x74f9('0x52')]?_0x157469['attributes']:_0x198779[_0x74f9('0x2f')];_0x157469['order']=qs[_0x74f9('0x39')](_0x331ba2[_0x74f9('0x31')][_0x74f9('0x39')]);_0x157469['where']=qs['filters'](_['pick'](_0x331ba2[_0x74f9('0x31')],_0x198779['filters']));if(_0x331ba2['query'][_0x74f9('0x3c')]){_0x157469['where']=_['merge'](_0x157469[_0x74f9('0x3a')],{'$or':_[_0x74f9('0x30')](_0x157469[_0x74f9('0x35')],function(_0x2b0944){var _0x29debd={};_0x29debd[_0x2b0944]={'$like':'%'+_0x331ba2[_0x74f9('0x31')][_0x74f9('0x3c')]+'%'};return _0x29debd;})});}_0x157469=_[_0x74f9('0x3d')]({},_0x157469,_0x331ba2['options']);return _0x1edff8[_0x74f9('0x53')](_0x157469);}})[_0x74f9('0x27')](function(_0x35da4f){if(_0x35da4f){_0x9dc489=_0x35da4f[_0x74f9('0x52')];if(!_0x331ba2[_0x74f9('0x31')]['hasOwnProperty'](_0x74f9('0x38'))){_0x157469[_0x74f9('0x21')]=qs[_0x74f9('0x21')](_0x331ba2[_0x74f9('0x31')][_0x74f9('0x21')]);_0x157469['offset']=qs[_0x74f9('0x20')](_0x331ba2[_0x74f9('0x31')][_0x74f9('0x20')]);}return _0x1edff8[_0x74f9('0x53')](_0x157469);}})[_0x74f9('0x27')](function(_0x271502){if(_0x271502){return _0x271502?{'count':_0x9dc489,'rows':_0x271502}:null;}})['then'](respondWithResult(_0xc6d225,null))['catch'](handleError(_0xc6d225,null));};exports[_0x74f9('0x54')]=function(_0x2d6d31,_0x30f0f4,_0x320490){return db[_0x74f9('0x2b')][_0x74f9('0x45')]({'where':{'id':_0x2d6d31[_0x74f9('0x48')]['id']}})['then'](handleEntityNotFound(_0x30f0f4,null))[_0x74f9('0x27')](function(_0x594d02){if(_0x594d02){return _0x594d02[_0x74f9('0x54')](_0x2d6d31['query'][_0x74f9('0x4f')]);}})['then'](respondWithStatusCode(_0x30f0f4,null))[_0x74f9('0x41')](handleError(_0x30f0f4,null));};exports['addMessage']=function(_0x198a5c,_0x359efb,_0x5e65a8){if(_0x198a5c[_0x74f9('0x47')]['id']){delete _0x198a5c[_0x74f9('0x47')]['id'];}return db[_0x74f9('0x2b')]['find']({'where':{'id':_0x198a5c[_0x74f9('0x48')]['id']}})[_0x74f9('0x27')](handleEntityNotFound(_0x359efb,null))[_0x74f9('0x27')](function(_0xb31ed6){if(_0xb31ed6){_0x198a5c['body'][_0x74f9('0x55')]=_0xb31ed6['id'];return db[_0x74f9('0x4b')][_0x74f9('0x46')](_0x198a5c['body']);}})['then'](respondWithResult(_0x359efb,null))[_0x74f9('0x41')](handleError(_0x359efb,null));};exports['getMessages']=function(_0x1b42e9,_0x287f94,_0x36361c){var _0x1d95e5={};var _0x123b96={};var _0x50c3d5;var _0x1c2155;return db[_0x74f9('0x2b')][_0x74f9('0x50')]({'where':{'id':_0x1b42e9['params']['id']}})['then'](handleEntityNotFound(_0x287f94,null))[_0x74f9('0x27')](function(_0x84db42){if(_0x84db42){_0x50c3d5=_0x84db42;_0x123b96[_0x74f9('0x2f')]=_[_0x74f9('0x32')](db[_0x74f9('0x4b')][_0x74f9('0x2c')]);_0x123b96[_0x74f9('0x31')]=_[_0x74f9('0x32')](_0x1b42e9['query']);_0x123b96['filters']=_[_0x74f9('0x34')](_0x123b96[_0x74f9('0x2f')],_0x123b96[_0x74f9('0x31')]);_0x1d95e5[_0x74f9('0x35')]=_['intersection'](_0x123b96[_0x74f9('0x2f')],qs[_0x74f9('0x36')](_0x1b42e9['query'][_0x74f9('0x36')]));_0x1d95e5[_0x74f9('0x35')]=_0x1d95e5['attributes'][_0x74f9('0x52')]?_0x1d95e5[_0x74f9('0x35')]:_0x123b96[_0x74f9('0x2f')];_0x1d95e5[_0x74f9('0x56')]=qs[_0x74f9('0x39')](_0x1b42e9[_0x74f9('0x31')][_0x74f9('0x39')]);_0x1d95e5[_0x74f9('0x3a')]=qs['filters'](_[_0x74f9('0x3b')](_0x1b42e9[_0x74f9('0x31')],_0x123b96[_0x74f9('0x33')]));if(_0x1b42e9[_0x74f9('0x31')]['filter']){_0x1d95e5[_0x74f9('0x3a')]=_[_0x74f9('0x3d')](_0x1d95e5['where'],{'$or':_[_0x74f9('0x30')](_0x1d95e5[_0x74f9('0x35')],function(_0x299459){var _0x28262e={};_0x28262e[_0x299459]={'$like':'%'+_0x1b42e9[_0x74f9('0x31')][_0x74f9('0x3c')]+'%'};return _0x28262e;})});}if(_0x1b42e9[_0x74f9('0x31')][_0x74f9('0x57')]){var _0x15c99b=_0x1b42e9[_0x74f9('0x31')][_0x74f9('0x57')][_0x74f9('0x58')](',');var _0x3de316={};_0x3de316[_0x15c99b[0x0]]={'$gte':moment(_0x15c99b[0x1])['format'](_0x74f9('0x59'))};_0x1d95e5[_0x74f9('0x3a')]=_[_0x74f9('0x3d')](_0x1d95e5['where'],_0x3de316);}_0x1d95e5=_[_0x74f9('0x3d')]({},_0x1d95e5,_0x1b42e9[_0x74f9('0x44')]);return _0x50c3d5[_0x74f9('0x5a')](_0x1d95e5);}})['then'](function(_0x361120){if(_0x361120){_0x1c2155=_0x361120[_0x74f9('0x52')];if(!_0x1b42e9[_0x74f9('0x31')][_0x74f9('0x37')](_0x74f9('0x38'))){_0x1d95e5[_0x74f9('0x21')]=qs['limit'](_0x1b42e9['query']['limit']);_0x1d95e5[_0x74f9('0x20')]=qs[_0x74f9('0x20')](_0x1b42e9['query']['offset']);}return _0x50c3d5[_0x74f9('0x5a')](_0x1d95e5);}})[_0x74f9('0x27')](function(_0x28003c){if(_0x28003c){return _0x28003c?{'count':_0x1c2155,'rows':_0x28003c}:null;}})[_0x74f9('0x27')](respondWithResult(_0x287f94,null))[_0x74f9('0x41')](handleError(_0x287f94,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 55f3614..b426564 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 _0x1000=['hasOwnProperty','hook','events','../../mysqldb','ChatGroup','save','update','remove','emit'];(function(_0x1c5ca3,_0x18dcc2){var _0x5db079=function(_0x10bbce){while(--_0x10bbce){_0x1c5ca3['push'](_0x1c5ca3['shift']());}};_0x5db079(++_0x18dcc2);}(_0x1000,0x1e8));var _0x0100=function(_0x48b139,_0x5e089c){_0x48b139=_0x48b139-0x0;var _0x52d29d=_0x1000[_0x48b139];return _0x52d29d;};'use strict';var EventEmitter=require(_0x0100('0x0'));var ChatGroup=require(_0x0100('0x1'))['db'][_0x0100('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0100('0x3'),'afterUpdate':_0x0100('0x4'),'afterDestroy':_0x0100('0x5')};function emitEvent(_0x3b417e){return function(_0x2b662a,_0x416152,_0x1e8674){ChatGroupEvents[_0x0100('0x6')](_0x3b417e+':'+_0x2b662a['id'],_0x2b662a);ChatGroupEvents['emit'](_0x3b417e,_0x2b662a);_0x1e8674(null);};}for(var e in events){if(events[_0x0100('0x7')](e)){var event=events[e];ChatGroup[_0x0100('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x708c=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatGroup','save','update'];(function(_0x4aa7cd,_0x2a29ba){var _0x1bdede=function(_0x25807d){while(--_0x25807d){_0x4aa7cd['push'](_0x4aa7cd['shift']());}};_0x1bdede(++_0x2a29ba);}(_0x708c,0x8b));var _0xc708=function(_0x37a88c,_0x9d32ce){_0x37a88c=_0x37a88c-0x0;var _0x396759=_0x708c[_0x37a88c];return _0x396759;};'use strict';var EventEmitter=require(_0xc708('0x0'));var ChatGroup=require(_0xc708('0x1'))['db'][_0xc708('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc708('0x3'),'afterUpdate':_0xc708('0x4'),'afterDestroy':_0xc708('0x5')};function emitEvent(_0x424476){return function(_0x269df0,_0x46d3b4,_0x56b4f3){ChatGroupEvents[_0xc708('0x6')](_0x424476+':'+_0x269df0['id'],_0x269df0);ChatGroupEvents[_0xc708('0x6')](_0x424476,_0x269df0);_0x56b4f3(null);};}for(var e in events){if(events[_0xc708('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xc708('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 51e88ba..7f23edb 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 _0x2ebd=['chat_groups','util','api','moment','path','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0x2ebd,0xfd));var _0xd2eb=function(_0x17ce0f,_0x529746){_0x17ce0f=_0x17ce0f-0x0;var _0x197cfa=_0x2ebd[_0x17ce0f];return _0x197cfa;};'use strict';var _=require('lodash');var util=require(_0xd2eb('0x0'));var logger=require('../../config/logger')(_0xd2eb('0x1'));var moment=require(_0xd2eb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2eb('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd2eb('0x4'));module[_0xd2eb('0x5')]=function(_0x498dfd,_0x43c634){return _0x498dfd[_0xd2eb('0x6')](_0xd2eb('0x7'),attributes,{'tableName':_0xd2eb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52d6=['ChatGroup','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x52d6,0x137));var _0x652d=function(_0xe539b9,_0x43c21d){_0xe539b9=_0xe539b9-0x0;var _0x578b7d=_0x52d6[_0xe539b9];return _0x578b7d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x652d('0x0'))(_0x652d('0x1'));var moment=require('moment');var BPromise=require(_0x652d('0x2'));var rp=require(_0x652d('0x3'));var fs=require('fs');var path=require(_0x652d('0x4'));var rimraf=require(_0x652d('0x5'));var config=require(_0x652d('0x6'));var attributes=require('./chatGroup.attributes');module[_0x652d('0x7')]=function(_0x15003e,_0x3478a3){return _0x15003e[_0x652d('0x8')](_0x652d('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 d5bb75d..28cee8e 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 _0x8cdb=['socket.io-emitter','redis','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','localhost'];(function(_0x39c9dd,_0x5d26ad){var _0xc66af8=function(_0x248d0f){while(--_0x248d0f){_0x39c9dd['push'](_0x39c9dd['shift']());}};_0xc66af8(++_0x5d26ad);}(_0x8cdb,0x138));var _0xb8cd=function(_0x527670,_0x26046e){_0x527670=_0x527670-0x0;var _0x3080a1=_0x8cdb[_0x527670];return _0x3080a1;};'use strict';var _=require(_0xb8cd('0x0'));var util=require('util');var moment=require(_0xb8cd('0x1'));var BPromise=require(_0xb8cd('0x2'));var rs=require(_0xb8cd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8cd('0x4'))['db'];var utils=require(_0xb8cd('0x5'));var logger=require(_0xb8cd('0x6'))(_0xb8cd('0x7'));var config=require('../../config/environment');var jayson=require(_0xb8cd('0x8'));var client=jayson['client'][_0xb8cd('0x9')]({'port':0x232a});config['redis']=_[_0xb8cd('0xa')](config['redis'],{'host':_0xb8cd('0xb'),'port':0x18eb});var socket=require(_0xb8cd('0xc'))(new Redis(config[_0xb8cd('0xd')]));require(_0xb8cd('0xe'))['register'](socket);function respondWithRpcPromise(_0x3c17e9,_0x2048a4,_0x2f9f59){return new BPromise(function(_0xcd14ca,_0x2de51f){return client[_0xb8cd('0xf')](_0x3c17e9,_0x2f9f59)[_0xb8cd('0x10')](function(_0x3c22af){logger[_0xb8cd('0x11')](_0xb8cd('0x12'),_0x2048a4,_0xb8cd('0x13'));logger[_0xb8cd('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2048a4,_0xb8cd('0x13'),JSON[_0xb8cd('0x15')](_0x3c22af));if(_0x3c22af[_0xb8cd('0x16')]){if(_0x3c22af['error'][_0xb8cd('0x17')]===0x1f4){logger[_0xb8cd('0x16')](_0xb8cd('0x12'),_0x2048a4,_0x3c22af[_0xb8cd('0x16')][_0xb8cd('0x18')]);return _0x2de51f(_0x3c22af[_0xb8cd('0x16')][_0xb8cd('0x18')]);}logger['error'](_0xb8cd('0x12'),_0x2048a4,_0x3c22af[_0xb8cd('0x16')][_0xb8cd('0x18')]);return _0xcd14ca(_0x3c22af[_0xb8cd('0x16')]['message']);}else{logger[_0xb8cd('0x11')](_0xb8cd('0x12'),_0x2048a4,_0xb8cd('0x13'));_0xcd14ca(_0x3c22af[_0xb8cd('0x19')][_0xb8cd('0x18')]);}})[_0xb8cd('0x1a')](function(_0x46dc9c){logger[_0xb8cd('0x16')](_0xb8cd('0x12'),_0x2048a4,_0x46dc9c);_0x2de51f(_0x46dc9c);});});} \ No newline at end of file +var _0x41d9=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x941d('0x0'));var util=require(_0x941d('0x1'));var moment=require(_0x941d('0x2'));var BPromise=require(_0x941d('0x3'));var rs=require(_0x941d('0x4'));var fs=require('fs');var Redis=require(_0x941d('0x5'));var db=require(_0x941d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x941d('0x7'))(_0x941d('0x8'));var config=require('../../config/environment');var jayson=require(_0x941d('0x9'));var client=jayson[_0x941d('0xa')]['http']({'port':0x232a});config[_0x941d('0xb')]=_['defaults'](config[_0x941d('0xb')],{'host':_0x941d('0xc'),'port':0x18eb});var socket=require(_0x941d('0xd'))(new Redis(config[_0x941d('0xb')]));require(_0x941d('0xe'))['register'](socket);function respondWithRpcPromise(_0x176430,_0x1c5e4d,_0x40afd7){return new BPromise(function(_0x10d08e,_0x575883){return client[_0x941d('0xf')](_0x176430,_0x40afd7)[_0x941d('0x10')](function(_0xe0743b){logger[_0x941d('0x11')](_0x941d('0x12'),_0x1c5e4d,_0x941d('0x13'));logger['debug'](_0x941d('0x14'),_0x1c5e4d,'request\x20sent',JSON['stringify'](_0xe0743b));if(_0xe0743b[_0x941d('0x15')]){if(_0xe0743b[_0x941d('0x15')][_0x941d('0x16')]===0x1f4){logger[_0x941d('0x15')](_0x941d('0x12'),_0x1c5e4d,_0xe0743b[_0x941d('0x15')][_0x941d('0x17')]);return _0x575883(_0xe0743b[_0x941d('0x15')][_0x941d('0x17')]);}logger[_0x941d('0x15')](_0x941d('0x12'),_0x1c5e4d,_0xe0743b['error'][_0x941d('0x17')]);return _0x10d08e(_0xe0743b[_0x941d('0x15')][_0x941d('0x17')]);}else{logger[_0x941d('0x11')](_0x941d('0x12'),_0x1c5e4d,_0x941d('0x13'));_0x10d08e(_0xe0743b[_0x941d('0x18')][_0x941d('0x17')]);}})[_0x941d('0x19')](function(_0x546a7c){logger[_0x941d('0x15')]('ChatGroup,\x20%s,\x20%s',_0x1c5e4d,_0x546a7c);_0x575883(_0x546a7c);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 6ff0f9b..7ed8459 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 _0x23e5=['chatGroup:','save','remove','update','emit','removeListener','register','length'];(function(_0x3e14cb,_0x2d27f2){var _0x1fdfc7=function(_0x309726){while(--_0x309726){_0x3e14cb['push'](_0x3e14cb['shift']());}};_0x1fdfc7(++_0x2d27f2);}(_0x23e5,0xe9));var _0x523e=function(_0x14aee3,_0x4be548){_0x14aee3=_0x14aee3-0x0;var _0x58954c=_0x23e5[_0x14aee3];return _0x58954c;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x523e('0x0'),_0x523e('0x1'),_0x523e('0x2')];function createListener(_0x282ab8,_0x5e1221){return function(_0x38a949){_0x5e1221[_0x523e('0x3')](_0x282ab8,_0x38a949);};}function removeListener(_0x5c2bba,_0x15a262){return function(){ChatGroupEvents[_0x523e('0x4')](_0x5c2bba,_0x15a262);};}exports[_0x523e('0x5')]=function(_0x5b97dd){for(var _0x18b4ea=0x0,_0x376e2a=events[_0x523e('0x6')];_0x18b4ea<_0x376e2a;_0x18b4ea++){var _0x15d135=events[_0x18b4ea];var _0x221612=createListener(_0x523e('0x7')+_0x15d135,_0x5b97dd);ChatGroupEvents['on'](_0x15d135,_0x221612);}}; \ No newline at end of file +var _0xb619=['./chatGroup.events','save','remove','emit','removeListener','register','chatGroup:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb619,0xa8));var _0x9b61=function(_0x2c3e94,_0x2290e4){_0x2c3e94=_0x2c3e94-0x0;var _0x31f0fb=_0xb619[_0x2c3e94];return _0x31f0fb;};'use strict';var ChatGroupEvents=require(_0x9b61('0x0'));var events=[_0x9b61('0x1'),_0x9b61('0x2'),'update'];function createListener(_0x4bb238,_0x2e3a17){return function(_0x5ade8f){_0x2e3a17[_0x9b61('0x3')](_0x4bb238,_0x5ade8f);};}function removeListener(_0x3482ca,_0x1b7116){return function(){ChatGroupEvents[_0x9b61('0x4')](_0x3482ca,_0x1b7116);};}exports[_0x9b61('0x5')]=function(_0x174055){for(var _0x259876=0x0,_0x194c5b=events['length'];_0x259876<_0x194c5b;_0x259876++){var _0x41a25c=events[_0x259876];var _0x55ed3b=createListener(_0x9b61('0x6')+_0x41a25c,_0x174055);ChatGroupEvents['on'](_0x41a25c,_0x55ed3b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 6311fcb..e613cd0 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 _0x0b7c=['show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMessage','put','delete','destroy','removeMembers','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id'];(function(_0x6d0143,_0x3d7c30){var _0x29cb75=function(_0x3bfcf4){while(--_0x3bfcf4){_0x6d0143['push'](_0x6d0143['shift']());}};_0x29cb75(++_0x3d7c30);}(_0x0b7c,0x139));var _0xc0b7=function(_0x3b9d5f,_0x2e9039){_0x3b9d5f=_0x3b9d5f-0x0;var _0x39924e=_0x0b7c[_0x3b9d5f];return _0x39924e;};'use strict';var multer=require('multer');var util=require(_0xc0b7('0x0'));var path=require('path');var timeout=require(_0xc0b7('0x1'));var express=require('express');var router=express[_0xc0b7('0x2')]();var fs_extra=require(_0xc0b7('0x3'));var auth=require(_0xc0b7('0x4'));var interaction=require(_0xc0b7('0x5'));var config=require(_0xc0b7('0x6'));var controller=require('./chatGroup.controller');router[_0xc0b7('0x7')]('/',auth['isAuthenticated'](),controller[_0xc0b7('0x8')]);router[_0xc0b7('0x7')]('/describe',auth[_0xc0b7('0x9')](),controller[_0xc0b7('0xa')]);router[_0xc0b7('0x7')](_0xc0b7('0xb'),auth[_0xc0b7('0x9')](),controller[_0xc0b7('0xc')]);router['get'](_0xc0b7('0xd'),auth[_0xc0b7('0x9')](),controller[_0xc0b7('0xe')]);router[_0xc0b7('0x7')](_0xc0b7('0xf'),auth[_0xc0b7('0x9')](),controller[_0xc0b7('0x10')]);router[_0xc0b7('0x7')](_0xc0b7('0x11'),auth[_0xc0b7('0x9')](),controller[_0xc0b7('0x12')]);router[_0xc0b7('0x13')]('/',auth[_0xc0b7('0x9')](),controller['create']);router[_0xc0b7('0x13')](_0xc0b7('0xf'),auth[_0xc0b7('0x9')](),controller['addMembers']);router['post'](_0xc0b7('0x11'),auth[_0xc0b7('0x9')](),controller[_0xc0b7('0x14')]);router[_0xc0b7('0x15')](_0xc0b7('0xb'),auth[_0xc0b7('0x9')](),controller['update']);router[_0xc0b7('0x16')](_0xc0b7('0xb'),auth[_0xc0b7('0x9')](),controller[_0xc0b7('0x17')]);router[_0xc0b7('0x16')](_0xc0b7('0xf'),auth[_0xc0b7('0x9')](),controller[_0xc0b7('0x18')]);module['exports']=router; \ No newline at end of file +var _0x45da=['addMembers','/:id/messages','addMessage','update','delete','destroy','removeMembers','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getMessages','post'];(function(_0x399338,_0x11496b){var _0x3c4485=function(_0x17e385){while(--_0x17e385){_0x399338['push'](_0x399338['shift']());}};_0x3c4485(++_0x11496b);}(_0x45da,0x133));var _0xa45d=function(_0x229111,_0x3a8ac6){_0x229111=_0x229111-0x0;var _0x3cf17d=_0x45da[_0x229111];return _0x3cf17d;};'use strict';var multer=require(_0xa45d('0x0'));var util=require('util');var path=require(_0xa45d('0x1'));var timeout=require(_0xa45d('0x2'));var express=require(_0xa45d('0x3'));var router=express[_0xa45d('0x4')]();var fs_extra=require(_0xa45d('0x5'));var auth=require(_0xa45d('0x6'));var interaction=require(_0xa45d('0x7'));var config=require(_0xa45d('0x8'));var controller=require('./chatGroup.controller');router[_0xa45d('0x9')]('/',auth[_0xa45d('0xa')](),controller['index']);router[_0xa45d('0x9')]('/describe',auth[_0xa45d('0xa')](),controller[_0xa45d('0xb')]);router[_0xa45d('0x9')](_0xa45d('0xc'),auth[_0xa45d('0xa')](),controller[_0xa45d('0xd')]);router[_0xa45d('0x9')]('/:id/unread',auth[_0xa45d('0xa')](),controller['getUnread']);router[_0xa45d('0x9')](_0xa45d('0xe'),auth[_0xa45d('0xa')](),controller[_0xa45d('0xf')]);router[_0xa45d('0x9')]('/:id/messages',auth[_0xa45d('0xa')](),controller[_0xa45d('0x10')]);router[_0xa45d('0x11')]('/',auth[_0xa45d('0xa')](),controller['create']);router[_0xa45d('0x11')]('/:id/members',auth[_0xa45d('0xa')](),controller[_0xa45d('0x12')]);router['post'](_0xa45d('0x13'),auth[_0xa45d('0xa')](),controller[_0xa45d('0x14')]);router['put']('/:id',auth[_0xa45d('0xa')](),controller[_0xa45d('0x15')]);router[_0xa45d('0x16')](_0xa45d('0xc'),auth[_0xa45d('0xa')](),controller[_0xa45d('0x17')]);router[_0xa45d('0x16')](_0xa45d('0xe'),auth[_0xa45d('0xa')](),controller[_0xa45d('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 242ec58..e4c55e6 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 _0x4dcf=['long','ENUM','out','exports','BOOLEAN','INTEGER','star','thumb','TEXT','STRING','DATE'];(function(_0x28717b,_0x497695){var _0x284566=function(_0xa5ffa1){while(--_0xa5ffa1){_0x28717b['push'](_0x28717b['shift']());}};_0x284566(++_0x497695);}(_0x4dcf,0xc9));var _0xf4dc=function(_0x563918,_0x102c5f){_0x563918=_0x563918-0x0;var _0x1e1738=_0x4dcf[_0x563918];return _0x1e1738;};'use strict';var Sequelize=require('sequelize');module[_0xf4dc('0x0')]={'closed':{'type':Sequelize[_0xf4dc('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xf4dc('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0xf4dc('0x3'),_0xf4dc('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xf4dc('0x5')]},'pathTranscript':{'type':Sequelize[_0xf4dc('0x5')]},'mailTranscript':{'type':Sequelize[_0xf4dc('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xf4dc('0x7')]},'disposition':{'type':Sequelize[_0xf4dc('0x6')]},'secondDisposition':{'type':Sequelize[_0xf4dc('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf4dc('0x6')]},'browserName':{'type':Sequelize[_0xf4dc('0x6')]},'browserVersion':{'type':Sequelize[_0xf4dc('0x6')]},'osName':{'type':Sequelize[_0xf4dc('0x6')]},'osVersion':{'type':Sequelize[_0xf4dc('0x6')]},'deviceModel':{'type':Sequelize[_0xf4dc('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xf4dc('0x6')]},'referer':{'type':Sequelize[_0xf4dc('0x5')]},'customerIp':{'type':Sequelize[_0xf4dc('0x6')]},'formData':{'type':Sequelize['TEXT'](_0xf4dc('0x8'))},'read1stAt':{'type':Sequelize[_0xf4dc('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf4dc('0x9')]('in',_0xf4dc('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf4dc('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xf4dc('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xf4dc('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf4dc('0x2')]}}; \ No newline at end of file +var _0xb1b3=['DATE','TEXT','long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','STRING'];(function(_0x44a117,_0x35f739){var _0x14e802=function(_0x5b083e){while(--_0x5b083e){_0x44a117['push'](_0x44a117['shift']());}};_0x14e802(++_0x35f739);}(_0xb1b3,0x1f0));var _0x3b1b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb1b3[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x3b1b('0x0'));module[_0x3b1b('0x1')]={'closed':{'type':Sequelize[_0x3b1b('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3b1b('0x3')]},'ratingType':{'type':Sequelize[_0x3b1b('0x4')](_0x3b1b('0x5'),_0x3b1b('0x6')),'defaultValue':_0x3b1b('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x3b1b('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3b1b('0x8')]},'disposition':{'type':Sequelize[_0x3b1b('0x7')]},'secondDisposition':{'type':Sequelize[_0x3b1b('0x7')]},'thirdDisposition':{'type':Sequelize[_0x3b1b('0x7')]},'note':{'type':Sequelize[_0x3b1b('0x7')]},'browserName':{'type':Sequelize[_0x3b1b('0x7')]},'browserVersion':{'type':Sequelize[_0x3b1b('0x7')]},'osName':{'type':Sequelize[_0x3b1b('0x7')]},'osVersion':{'type':Sequelize[_0x3b1b('0x7')]},'deviceModel':{'type':Sequelize[_0x3b1b('0x7')]},'deviceVendor':{'type':Sequelize[_0x3b1b('0x7')]},'deviceType':{'type':Sequelize[_0x3b1b('0x7')]},'referer':{'type':Sequelize[_0x3b1b('0x9')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x3b1b('0x9')](_0x3b1b('0xa'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3b1b('0x4')]('in',_0x3b1b('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3b1b('0x7')]},'customerPort':{'type':Sequelize[_0x3b1b('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x3b1b('0x9')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3b1b('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index f512ff3..95f3bbd 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 _0x5239=['Chat','err','unlinkSync','zip-dir','request-promise','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','destroy','stack','name','send','render','merge','body','contact','agent','account','map','ChatInteraction','fieldName','type','key','getOptions','findAll','chat','query','user','show','params','model','keys','intersection','attributes','fields','length','includeAll','create','find','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','fullname','email','POST','isNull','vidaooNote','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','updateAttributes','CmContact','Contact','abandon','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','User','ChatWebsite','ContactId','UserId','%s%d','agentAlias','Visitor','agentIdentifier','website_alias','System','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','getMessages','filters','hasOwnProperty','nolimit','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','getMyMessages','rawAttributes','includeAgent','push','alias','addTags','setTags','omit','spread','Tag','ids','chatInteractionTags:save','removeTags','download','toString','server','files','tmp','attachments','lastName','createdAt','Account','Owner','mkdirSync','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','firstName','read','value','downloadInteraction.ejs','transcript-','.pdf'];(function(_0x461c41,_0x2e6d1c){var _0x509e12=function(_0x245f5d){while(--_0x245f5d){_0x461c41['push'](_0x461c41['shift']());}};_0x509e12(++_0x2e6d1c);}(_0x5239,0x1a5));var _0x9523=function(_0x2f9a42,_0x222316){_0x2f9a42=_0x2f9a42-0x0;var _0x440df7=_0x5239[_0x2f9a42];return _0x440df7;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x9523('0x0'));var rp=require(_0x9523('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9523('0x2'));var util=require(_0x9523('0x3'));var path=require(_0x9523('0x4'));var ejs=require(_0x9523('0x5'));var fs=require('fs');var _=require(_0x9523('0x6'));var Redis=require(_0x9523('0x7'));var interaction=require(_0x9523('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0x9523('0x9'));var logger=require(_0x9523('0xa'))(_0x9523('0xb'));var config=require(_0x9523('0xc'));var db=require(_0x9523('0xd'))['db'];config[_0x9523('0xe')]=_[_0x9523('0xf')](config['redis'],{'host':_0x9523('0x10'),'port':0x18eb});var socket=require(_0x9523('0x11'))(new Redis(config[_0x9523('0xe')]));require(_0x9523('0x12'))[_0x9523('0x13')](socket);var jayson=require(_0x9523('0x14'));var client=jayson[_0x9523('0x15')]['http']({'port':0x232b});var client9004=jayson[_0x9523('0x15')][_0x9523('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x2067ed,_0x596e2c,_0x33db01,_0x449d6a){return new BPromise(function(_0x5b8607,_0x15f7c6){var _0x370206=_0x449d6a||client;return _0x370206[_0x9523('0x17')](_0x2067ed,_0x33db01)[_0x9523('0x18')](function(_0x440fc3){logger['info'](_0x9523('0x19'),_0x596e2c,_0x9523('0x1a'));logger[_0x9523('0x1b')](_0x9523('0x1c'),_0x596e2c,_0x9523('0x1a'),JSON[_0x9523('0x1d')](_0x440fc3));if(_0x440fc3[_0x9523('0x1e')]){if(_0x440fc3['error'][_0x9523('0x1f')]===0x1f4){logger['error'](_0x9523('0x19'),_0x596e2c,_0x440fc3[_0x9523('0x1e')][_0x9523('0x20')]);return _0x15f7c6(_0x440fc3[_0x9523('0x1e')][_0x9523('0x20')]);}logger['error'](_0x9523('0x19'),_0x596e2c,_0x440fc3['error'][_0x9523('0x20')]);return _0x5b8607(_0x440fc3[_0x9523('0x1e')]['message']);}else{logger[_0x9523('0x21')]('ChatInteraction,\x20%s,\x20%s',_0x596e2c,'request\x20sent');_0x5b8607(_0x440fc3[_0x9523('0x22')][_0x9523('0x20')]);}})[_0x9523('0x23')](function(_0x5d4f9d){logger[_0x9523('0x1e')](_0x9523('0x19'),_0x596e2c,_0x5d4f9d);_0x15f7c6(_0x5d4f9d);});});}function respondWithStatusCode(_0xfdd4c,_0x1ab936){_0x1ab936=_0x1ab936||0xcc;return function(_0x22622b){if(_0x22622b){return _0xfdd4c[_0x9523('0x24')](_0x1ab936);}return _0xfdd4c[_0x9523('0x25')](_0x1ab936)[_0x9523('0x26')]();};}function respondWithResult(_0x3aa55f,_0x1c31e1){_0x1c31e1=_0x1c31e1||0xc8;return function(_0x56626c){if(_0x56626c){return _0x3aa55f[_0x9523('0x25')](_0x1c31e1)[_0x9523('0x27')](_0x56626c);}};}function respondWithFilteredResult(_0x269386,_0x4c4ca6){return function(_0x797250){if(_0x797250){var _0x45eb0d=typeof _0x4c4ca6[_0x9523('0x28')]==='undefined'&&typeof _0x4c4ca6[_0x9523('0x29')]==='undefined';var _0x3584f6=_0x797250[_0x9523('0x2a')];var _0x3cbe96=_0x45eb0d?0x0:_0x4c4ca6['offset'];var _0x8aae3c=_0x45eb0d?_0x797250[_0x9523('0x2a')]:_0x4c4ca6[_0x9523('0x28')]+_0x4c4ca6[_0x9523('0x29')];var _0x241567;if(_0x8aae3c>=_0x3584f6){_0x8aae3c=_0x3584f6;_0x241567=0xc8;}else{_0x241567=0xce;}_0x269386['status'](_0x241567);return _0x269386[_0x9523('0x2b')](_0x9523('0x2c'),_0x3cbe96+'-'+_0x8aae3c+'/'+_0x3584f6)[_0x9523('0x27')](_0x797250);}return null;};}function saveUpdates(_0x5b8486){return function(_0x171d47){if(_0x171d47){return _0x171d47[_0x9523('0x2d')](_0x5b8486)['then'](function(_0x2e1038){return _0x2e1038;});}return null;};}function removeEntity(_0x13bfc2){return function(_0x20f627){if(_0x20f627){return _0x20f627[_0x9523('0x2e')]()[_0x9523('0x18')](function(){_0x13bfc2['status'](0xcc)[_0x9523('0x26')]();});}};}function handleEntityNotFound(_0x573c2c){return function(_0x23bab5){if(!_0x23bab5){_0x573c2c['sendStatus'](0x194);}return _0x23bab5;};}function handleError(_0x339875,_0x2add77){_0x2add77=_0x2add77||0x1f4;return function(_0xcfa8d2){logger[_0x9523('0x1e')](_0xcfa8d2[_0x9523('0x2f')]);if(_0xcfa8d2[_0x9523('0x30')]){delete _0xcfa8d2[_0x9523('0x30')];}_0x339875[_0x9523('0x25')](_0x2add77)[_0x9523('0x31')](_0xcfa8d2);};}function getMustacheRender(_0x3cddfd,_0x4e4445){return Mustache[_0x9523('0x32')](_0x3cddfd,_[_0x9523('0x33')](_0x4e4445[_0x9523('0x34')],{'contact':_0x4e4445[_0x9523('0x35')],'message':_0x4e4445['message'],'agent':_0x4e4445[_0x9523('0x36')],'interaction':_0x4e4445['interaction'],'account':_0x4e4445[_0x9523('0x37')]}))||'';}exports['index']=function(_0xb0a9fc,_0x487e6a){var _0x23420e={};var _0xac8ee1=_[_0x9523('0x38')](db[_0x9523('0x39')]['rawAttributes'],function(_0x1a36ec){return{'name':_0x1a36ec[_0x9523('0x3a')],'type':_0x1a36ec[_0x9523('0x3b')][_0x9523('0x3c')]};});_0x23420e=qs[_0x9523('0x3d')](_0xac8ee1,_0xb0a9fc);return interaction[_0x9523('0x3e')](_0x9523('0x3f'),_0xb0a9fc[_0x9523('0x40')],_0xb0a9fc[_0x9523('0x41')],_0x23420e,_0xac8ee1)['then'](respondWithFilteredResult(_0x487e6a,_0x23420e))[_0x9523('0x23')](handleError(_0x487e6a,null));};exports[_0x9523('0x42')]=function(_0x1eb145,_0x159737){var _0x52c290={'raw':![],'where':{'id':_0x1eb145[_0x9523('0x43')]['id']}},_0x268796={};_0x268796[_0x9523('0x44')]=_[_0x9523('0x45')](db[_0x9523('0x39')]['rawAttributes']);_0x268796[_0x9523('0x40')]=_[_0x9523('0x45')](_0x1eb145[_0x9523('0x40')]);_0x268796['filters']=_[_0x9523('0x46')](_0x268796[_0x9523('0x44')],_0x268796[_0x9523('0x40')]);_0x52c290[_0x9523('0x47')]=_['intersection'](_0x268796['model'],qs[_0x9523('0x48')](_0x1eb145[_0x9523('0x40')]['fields']));_0x52c290[_0x9523('0x47')]=_0x52c290['attributes'][_0x9523('0x49')]?_0x52c290[_0x9523('0x47')]:_0x268796[_0x9523('0x44')];if(_0x1eb145[_0x9523('0x40')][_0x9523('0x4a')]){_0x52c290['include']=[{'all':!![]}];}_0x52c290=_[_0x9523('0x33')]({},_0x52c290,_0x1eb145['options']);return db[_0x9523('0x39')]['find'](_0x52c290)[_0x9523('0x18')](handleEntityNotFound(_0x159737,null))[_0x9523('0x18')](respondWithResult(_0x159737,null))[_0x9523('0x23')](handleError(_0x159737,null));};exports[_0x9523('0x4b')]=function(_0xc1db4c,_0x19d9f9){return db[_0x9523('0x39')][_0x9523('0x4b')](_0xc1db4c[_0x9523('0x34')],{})[_0x9523('0x18')](respondWithResult(_0x19d9f9,0xc9))[_0x9523('0x23')](handleError(_0x19d9f9,null));};exports[_0x9523('0x2d')]=function(_0x1b2bde,_0x549867){if(_0x1b2bde[_0x9523('0x34')]['id']){delete _0x1b2bde['body']['id'];}return db[_0x9523('0x39')][_0x9523('0x4c')]({'where':{'id':_0x1b2bde[_0x9523('0x43')]['id']}})[_0x9523('0x18')](handleEntityNotFound(_0x549867,null))[_0x9523('0x18')](saveUpdates(_0x1b2bde[_0x9523('0x34')],null))[_0x9523('0x18')](respondWithResult(_0x549867,null))[_0x9523('0x23')](handleError(_0x549867,null));};exports['destroy']=function(_0x499f6c,_0x183481){return db[_0x9523('0x39')]['find']({'where':{'id':_0x499f6c['params']['id']}})[_0x9523('0x18')](handleEntityNotFound(_0x183481,null))['then'](removeEntity(_0x183481,null))[_0x9523('0x23')](handleError(_0x183481,null));};exports[_0x9523('0x4d')]=function(_0xb39f0e,_0x537a8f){return db[_0x9523('0x39')]['describe']()[_0x9523('0x18')](respondWithResult(_0x537a8f,null))['catch'](handleError(_0x537a8f,null));};exports[_0x9523('0x4e')]=function(_0x778cda,_0x5cfb5a){var _0x4bb89a=_0x778cda[_0x9523('0x43')]['id'];var _0x144a0c;var _0x49ce3b;var _0x4d1565;return db[_0x9523('0x39')][_0x9523('0x4f')]({'where':{'id':_0x4bb89a}})[_0x9523('0x18')](function(_0x1e5724){_0x144a0c=_0x1e5724;return db['ChatWebsite'][_0x9523('0x4f')]({'where':{'id':_0x1e5724[_0x9523('0x50')]},'attributes':['id',_0x9523('0x51'),_0x9523('0x52'),_0x9523('0x53'),'vidaooNote',_0x9523('0x54')],'raw':!![]});})[_0x9523('0x18')](function(_0x533209){if(_0x533209&&_0x533209[_0x9523('0x51')]&&_0x533209[_0x9523('0x52')]){_0x49ce3b=_0x533209;var _0x5d42e1={'interaction':{'id':_0x4bb89a},'agent':{'id':_0x778cda[_0x9523('0x41')]['id'],'name':_0x778cda[_0x9523('0x41')][_0x9523('0x30')],'fullname':_0x778cda[_0x9523('0x41')][_0x9523('0x55')],'email':_0x778cda[_0x9523('0x41')][_0x9523('0x56')]},'contact':_0x778cda[_0x9523('0x34')][_0x9523('0x35')],'account':_0x778cda['body'][_0x9523('0x37')]};var _0x17b72f={'rejectUnauthorized':![],'method':_0x9523('0x57'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x533209['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x778cda[_0x9523('0x41')][_0x9523('0x56')]],'buttons':null,'topic':_0x49ce3b[_0x9523('0x53')],'note':_[_0x9523('0x58')](_0x49ce3b[_0x9523('0x59')])?null:getMustacheRender(_0x49ce3b['vidaooNote'],_0x5d42e1),'metadata':null},'redirect':_0x9523('0x5a'),'json':!![]};try{if(!_['isNull'](_0x49ce3b[_0x9523('0x54')])){var _0x4b2cfd=getMustacheRender(_0x49ce3b[_0x9523('0x54')],_0x5d42e1);var _0x589b34=JSON[_0x9523('0x5b')](_0x4b2cfd);_0x17b72f[_0x9523('0x34')][_0x9523('0x5c')]=_0x589b34;}}catch(_0x2a2cea){throw new db[(_0x9523('0x5d'))][(_0x9523('0x5e'))](_0x9523('0x5f'));}return rp(_0x17b72f);}else{throw new db[(_0x9523('0x5d'))][(_0x9523('0x5e'))](_0x9523('0x60'));}})['then'](function(_0x1c6f42){_0x4d1565=_0x1c6f42;if(_0x4d1565['id']){var _0x3b3e44={'body':_0x4d1565['join_url'],'ChatWebsiteId':_0x49ce3b['id'],'ChatInteractionId':_0x144a0c['id'],'direction':_0x9523('0x61'),'UserId':_0x778cda[_0x9523('0x41')]['id']};return db['ChatMessage'][_0x9523('0x4b')](_0x3b3e44,{});}else{throw new db[(_0x9523('0x5d'))][(_0x9523('0x5e'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x144a0c[_0x9523('0x62')]({'vidaooSessionId':_0x4d1565['id']});})[_0x9523('0x18')](respondWithResult(_0x5cfb5a,null))[_0x9523('0x23')](handleError(_0x5cfb5a,null));};exports['customUpdate']=function(_0x20e9a7,_0x43c6cf){if(_0x20e9a7['body']['id']){delete _0x20e9a7[_0x9523('0x34')]['id'];}return db[_0x9523('0x39')][_0x9523('0x4c')]({'where':{'id':_0x20e9a7[_0x9523('0x43')]['id']},'include':[{'model':db[_0x9523('0x63')],'as':_0x9523('0x64')}]})['then'](handleEntityNotFound(_0x43c6cf,null))[_0x9523('0x18')](saveUpdates(_0x20e9a7[_0x9523('0x34')],null))[_0x9523('0x18')](respondWithResult(_0x43c6cf,null))[_0x9523('0x23')](handleError(_0x43c6cf,null));};exports['abandon']=function(_0x3e7138,_0xe345cb){if(_0x3e7138['body']['id']){delete _0x3e7138[_0x9523('0x34')]['id'];}return db[_0x9523('0x39')][_0x9523('0x4c')]({'where':{'id':_0x3e7138['params']['id']}})[_0x9523('0x18')](function(_0x5166e8){if(!_0x5166e8){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x9523('0x65'),0x194,'entity\x20not\x20found');_0xe345cb[_0x9523('0x24')](0x194);}else{if(_0x5166e8['UserId']){throw new db['Sequelize'][(_0x9523('0x5e'))]('Interaction\x20already\x20assigned');}}return _0x5166e8;})['then'](function(_0x37d7e4){if(_0x37d7e4){return _0x37d7e4[_0x9523('0x2d')]({'closed':_0x3e7138[_0x9523('0x34')][_0x9523('0x66')],'disposition':_0x3e7138[_0x9523('0x34')][_0x9523('0x67')]})['then'](function(_0x45a1ac){return _0x45a1ac;});}})[_0x9523('0x18')](function(){return respondWithRpcPromise(_0x9523('0x68'),_0x9523('0x65'),_0x3e7138[_0x9523('0x34')],client9004);})['then'](respondWithResult(_0xe345cb,null))[_0x9523('0x23')](handleError(_0xe345cb,null));};exports[_0x9523('0x69')]=function(_0x343481,_0x41d33f){_0x343481[_0x9523('0x34')][_0x9523('0x30')]=_0x343481[_0x9523('0x6a')][_0x9523('0x6b')];_0x343481[_0x9523('0x34')]['basename']=_0x343481[_0x9523('0x6a')]['filename'];_0x343481[_0x9523('0x34')]['type']=_0x343481[_0x9523('0x6a')][_0x9523('0x6c')];return db[_0x9523('0x6d')][_0x9523('0x4b')](_0x343481[_0x9523('0x34')])[_0x9523('0x18')](respondWithResult(_0x41d33f,0xc9))[_0x9523('0x23')](handleError(_0x41d33f,null));};exports['attachmentDownload']=function(_0x5e88b0,_0x32e736){return db[_0x9523('0x39')]['findOne']({'where':{'id':_0x5e88b0[_0x9523('0x43')]['id']},'raw':!![]})[_0x9523('0x18')](handleEntityNotFound(_0x32e736,null))[_0x9523('0x18')](function(_0xd2ebea){if(_0xd2ebea){if(_0xd2ebea['closed']){return _0x32e736[_0x9523('0x25')](0x193)[_0x9523('0x27')]({'status':0x193,'message':_0x9523('0x6e')});}return db['Attachment'][_0x9523('0x4f')]({'where':{'id':_0x5e88b0[_0x9523('0x40')][_0x9523('0x6f')]},'raw':!![]})[_0x9523('0x18')](handleEntityNotFound(_0x32e736,null));}})[_0x9523('0x18')](function(_0x3f9cd7){if(_0x3f9cd7){var _0x74385b=_0x3f9cd7[_0x9523('0x70')]!==null;var _0x338e2a=path['join'](config[_0x9523('0x71')],_0x9523('0x72'));if(_0x74385b){_0x338e2a=path[_0x9523('0x73')](_0x338e2a,_0x9523('0x74'));}var _0x114a04=path[_0x9523('0x73')](_0x338e2a,_0x3f9cd7[_0x9523('0x75')]);return _0x32e736['download'](_0x114a04);}})[_0x9523('0x23')](handleError(_0x32e736,null));};exports[_0x9523('0x76')]=function(_0x32f69e,_0x104d52){var _0x4f93f7=null;var _0x24949b=null;var _0x179fc8=null;if(_0x32f69e[_0x9523('0x34')]['id']){delete _0x32f69e[_0x9523('0x34')]['id'];}if(_0x32f69e[_0x9523('0x34')][_0x9523('0x77')]){_0x179fc8=path[_0x9523('0x73')](config['root'],'server/files/chat/upload/',util[_0x9523('0x78')](_0x9523('0x79'),Date[_0x9523('0x7a')]()));_0x32f69e[_0x9523('0x34')][_0x9523('0x7b')]=_0x179fc8;}return db[_0x9523('0x39')][_0x9523('0x4c')]({'where':{'id':_0x32f69e[_0x9523('0x43')]['id']},'include':[{'model':db[_0x9523('0x7c')],'as':_0x9523('0x7d'),'include':[{'model':db[_0x9523('0x7e')],'as':_0x9523('0x7e')}]}]})['then'](handleEntityNotFound(_0x104d52,null))[_0x9523('0x18')](saveUpdates(_0x32f69e['body'],null))[_0x9523('0x18')](function(_0x299cc1){if(_0x299cc1){_0x4f93f7=_0x299cc1;return db[_0x9523('0x7f')][_0x9523('0x4c')]({'where':{'id':_0x4f93f7[_0x9523('0x50')]}});}})[_0x9523('0x18')](function(_0x4b5886){if(_0x4b5886){_0x24949b=_0x4b5886;return db['CmContact'][_0x9523('0x4c')]({'where':{'id':_0x4f93f7[_0x9523('0x80')]}});}})[_0x9523('0x18')](function(_0x4456ea){if(_0x4456ea){if(_0x179fc8){var _0x19c8c3=null;for(var _0x4d529a=0x1;_0x4d529a<_0x4f93f7['Messages'][_0x9523('0x49')];++_0x4d529a){_0x19c8c3=_0x4f93f7[_0x9523('0x7d')][_0x4d529a];var _0x587323=_0x19c8c3[_0x9523('0x81')]?util[_0x9523('0x78')](_0x9523('0x82'),_0x24949b[_0x9523('0x83')],_0x19c8c3[_0x9523('0x81')]):'System';var _0x5a9dfa=_0x32f69e[_0x9523('0x34')]['customer']||util['format']('%s%d',_0x9523('0x84'),_0x19c8c3['ContactId']);switch(_0x24949b[_0x9523('0x85')]){case _0x9523('0x86'):_0x587323=_0x19c8c3[_0x9523('0x81')]?util[_0x9523('0x78')](_0x9523('0x82'),_0x24949b[_0x9523('0x83')],_0x19c8c3[_0x9523('0x81')]):_0x9523('0x87');break;case'agent_alias':_0x587323=_0x19c8c3['UserId']?_0x19c8c3[_0x9523('0x7e')]['alias']||_0x19c8c3[_0x9523('0x7e')][_0x9523('0x55')]:_0x9523('0x87');break;case _0x9523('0x88'):_0x587323=_0x19c8c3[_0x9523('0x81')]?_0x19c8c3[_0x9523('0x7e')]['fullname']:_0x9523('0x87');break;default:_0x587323=_0x19c8c3[_0x9523('0x81')]?util[_0x9523('0x78')](_0x9523('0x82'),_0x24949b['agentAlias'],_0x19c8c3['UserId']):_0x9523('0x87');}var _0x45f2ae=util['format'](_0x9523('0x89'),moment(_0x19c8c3['createdAt'])[_0x9523('0x78')](_0x9523('0x8a')),_0x19c8c3[_0x9523('0x8b')]==='in'?_0x5a9dfa:_0x587323,_0x19c8c3[_0x9523('0x34')]);if(!_0x19c8c3[_0x9523('0x8c')]){fs[_0x9523('0x8d')](_0x179fc8,_0x45f2ae);}}return db[_0x9523('0x8e')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x9523('0x8f')],'as':_0x9523('0x90'),'raw':!![],'include':[{'model':db[_0x9523('0x91')],'as':_0x9523('0x91'),'raw':!![]}]}]});}}})['then'](function(_0x5ccc13){if(!_0x5ccc13||!_0x5ccc13[_0x9523('0x90')]||!_0x32f69e[_0x9523('0x34')])return _0x4f93f7;var _0x123d7e=_0x5ccc13[_0x9523('0x92')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x123d7e,'message':{'from':util[_0x9523('0x78')](_0x9523('0x93'),_0x5ccc13[_0x9523('0x30')],_0x5ccc13[_0x9523('0x56')]||_0x5ccc13[_0x9523('0x90')][_0x9523('0x41')]),'to':_0x32f69e[_0x9523('0x34')][_0x9523('0x77')],'subject':'Mail\x20Transcript','text':util['format'](_0x9523('0x94'),_0x32f69e[_0x9523('0x34')][_0x9523('0x77')]),'attachments':[{'path':_0x179fc8}]}})[_0x9523('0x18')](function(){return _0x4f93f7;})[_0x9523('0x23')](function(_0x4df0c1){logger[_0x9523('0x1e')](_0x4df0c1);});})[_0x9523('0x18')](respondWithStatusCode(_0x104d52,0xc8))[_0x9523('0x23')](handleError(_0x104d52,null));};exports[_0x9523('0x95')]=function(_0x5bdb21,_0x35499f){return db[_0x9523('0x7c')][_0x9523('0x4c')]({'where':{'id':_0x5bdb21[_0x9523('0x43')]['id']}})[_0x9523('0x18')](handleEntityNotFound(_0x35499f,null))[_0x9523('0x18')](function(_0x4afcfe){if(_0x4afcfe){return _0x4afcfe[_0x9523('0x95')](_0x5bdb21[_0x9523('0x34')]['ids'],_['omit'](_0x5bdb21[_0x9523('0x34')],['ids','id'])||{});}})['then'](respondWithResult(_0x35499f,null))['catch'](handleError(_0x35499f,null));};exports[_0x9523('0x96')]=function(_0x5833eb,_0x29dabd){var _0x3292f0={'raw':![],'where':{}};var _0x3780d9={};var _0x5586e8={'count':0x0,'rows':[]};return db[_0x9523('0x39')][_0x9523('0x4f')]({'where':{'id':_0x5833eb[_0x9523('0x43')]['id']}})['then'](handleEntityNotFound(_0x29dabd,null))['then'](function(_0x30b845){if(_0x30b845){_0x3780d9['model']=_[_0x9523('0x45')](db[_0x9523('0x7c')]['rawAttributes']);_0x3780d9[_0x9523('0x40')]=_[_0x9523('0x45')](_0x5833eb[_0x9523('0x40')]);_0x3780d9[_0x9523('0x97')]=_[_0x9523('0x46')](_0x3780d9[_0x9523('0x44')],_0x3780d9[_0x9523('0x40')]);_0x3292f0['attributes']=_[_0x9523('0x46')](_0x3780d9[_0x9523('0x44')],qs[_0x9523('0x48')](_0x5833eb[_0x9523('0x40')][_0x9523('0x48')]));_0x3292f0[_0x9523('0x47')]=_0x3292f0[_0x9523('0x47')][_0x9523('0x49')]?_0x3292f0[_0x9523('0x47')]:_0x3780d9['model'];if(!_0x5833eb[_0x9523('0x40')][_0x9523('0x98')](_0x9523('0x99'))){_0x3292f0[_0x9523('0x29')]=qs[_0x9523('0x29')](_0x5833eb['query'][_0x9523('0x29')]);_0x3292f0[_0x9523('0x28')]=qs[_0x9523('0x28')](_0x5833eb[_0x9523('0x40')]['offset']);}_0x3292f0['order']=qs[_0x9523('0x9a')](_0x5833eb[_0x9523('0x40')][_0x9523('0x9a')]);_0x3292f0[_0x9523('0x9b')]=qs[_0x9523('0x97')](_[_0x9523('0x9c')](_0x5833eb['query'],_0x3780d9[_0x9523('0x97')]));_0x3292f0[_0x9523('0x9b')]['ChatInteractionId']=_0x30b845['id'];if(_0x5833eb[_0x9523('0x40')][_0x9523('0x9d')]){_0x3292f0['where']=_[_0x9523('0x33')](_0x3292f0[_0x9523('0x9b')],{'$or':_['map'](_0x3292f0[_0x9523('0x47')],function(_0x1396dd){var _0x4b3470={};_0x4b3470[_0x1396dd]={'$like':'%'+_0x5833eb[_0x9523('0x40')][_0x9523('0x9d')]+'%'};return _0x4b3470;})});}if(_0x5833eb[_0x9523('0x40')][_0x9523('0x9e')]){var _0x1f6341=_0x5833eb[_0x9523('0x40')][_0x9523('0x9e')][_0x9523('0x9f')](',');var _0x209f3f={};_0x209f3f[_0x1f6341[0x0]]={'$gte':moment(_0x1f6341[0x1])['format'](_0x9523('0xa0'))};_0x3292f0[_0x9523('0x9b')]=_[_0x9523('0x33')](_0x3292f0[_0x9523('0x9b')],_0x209f3f);}_0x3292f0=_[_0x9523('0x33')]({},_0x3292f0,_0x5833eb[_0x9523('0xa1')]);return db[_0x9523('0x7c')][_0x9523('0x2a')]({'where':_0x3292f0[_0x9523('0x9b')]})[_0x9523('0x18')](function(_0x520b45){_0x5586e8['count']=_0x520b45;if(_0x5833eb['query'][_0x9523('0x4a')]){_0x3292f0[_0x9523('0xa2')]=[{'all':!![]}];}return db[_0x9523('0x7c')][_0x9523('0x3e')](_0x3292f0);})[_0x9523('0x18')](function(_0x5dec5f){_0x5586e8[_0x9523('0xa3')]=_0x5dec5f;return _0x5586e8;});}})[_0x9523('0x18')](respondWithFilteredResult(_0x29dabd,_0x3292f0))[_0x9523('0x23')](handleError(_0x29dabd,null));};exports[_0x9523('0xa4')]=function(_0x5a0dbc,_0xe528fc){var _0x5d167d={'where':{}},_0x26cdd2={},_0x2343d7={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x9523('0x4f')]({'where':{'id':_0x5a0dbc[_0x9523('0x43')]['id']}})[_0x9523('0x18')](handleEntityNotFound(_0xe528fc,null))[_0x9523('0x18')](function(_0x512771){if(_0x512771){_0x26cdd2['model']=_['keys'](db['ChatMessage'][_0x9523('0xa5')]);_0x26cdd2[_0x9523('0x40')]=_[_0x9523('0x45')](_0x5a0dbc[_0x9523('0x40')]);_0x26cdd2[_0x9523('0x97')]=_[_0x9523('0x46')](_0x26cdd2[_0x9523('0x44')],_0x26cdd2[_0x9523('0x40')]);_0x5d167d[_0x9523('0x47')]=_[_0x9523('0x46')](_0x26cdd2[_0x9523('0x44')],qs['fields'](_0x5a0dbc[_0x9523('0x40')][_0x9523('0x48')]));_0x5d167d[_0x9523('0x47')]=_0x5d167d[_0x9523('0x47')][_0x9523('0x49')]?_0x5d167d['attributes']:_0x26cdd2[_0x9523('0x44')];if(!_0x5a0dbc['query'][_0x9523('0x98')](_0x9523('0x99'))){_0x5d167d[_0x9523('0x29')]=qs[_0x9523('0x29')](_0x5a0dbc[_0x9523('0x40')][_0x9523('0x29')]);_0x5d167d['offset']=qs[_0x9523('0x28')](_0x5a0dbc[_0x9523('0x40')]['offset']);}_0x5d167d['order']=qs['sort'](_0x5a0dbc['query'][_0x9523('0x9a')]);_0x5d167d['where']=qs[_0x9523('0x97')](_[_0x9523('0x9c')](_0x5a0dbc[_0x9523('0x40')],_0x26cdd2['filters']));_0x5d167d['where']['ChatInteractionId']=_0x512771['id'];if(_0x5a0dbc[_0x9523('0x40')][_0x9523('0x9d')]){_0x5d167d[_0x9523('0x9b')]=_[_0x9523('0x33')](_0x5d167d[_0x9523('0x9b')],{'$or':_[_0x9523('0x38')](_0x5d167d[_0x9523('0x47')],function(_0x34ce61){var _0x4776e3={};_0x4776e3[_0x34ce61]={'$like':'%'+_0x5a0dbc[_0x9523('0x40')][_0x9523('0x9d')]+'%'};return _0x4776e3;})});}_0x5d167d[_0x9523('0x9b')][_0x9523('0x8c')]=![];if(_0x5a0dbc[_0x9523('0x40')]['id']){_0x5d167d[_0x9523('0x9b')]['id']={'$gt':_0x5a0dbc[_0x9523('0x40')]['id']};}_0x5d167d=_[_0x9523('0x33')]({},_0x5d167d,_0x5a0dbc['options']);return db[_0x9523('0x7c')][_0x9523('0x2a')]({'where':_0x5d167d['where']})['then'](function(_0x3f90ac){_0x2343d7[_0x9523('0x2a')]=_0x3f90ac;_0x5d167d[_0x9523('0xa2')]=[];if(_0x5a0dbc[_0x9523('0x40')][_0x9523('0xa6')]){_0x5d167d[_0x9523('0xa2')][_0x9523('0xa7')]({'model':db['User'],'as':_0x9523('0x7e'),'attributes':['id',_0x9523('0x55'),_0x9523('0xa8')]});}if(_0x5a0dbc[_0x9523('0x40')][_0x9523('0x4a')]){_0x5d167d[_0x9523('0xa2')]=[{'all':!![]}];}return db[_0x9523('0x7c')][_0x9523('0x3e')](_0x5d167d);})[_0x9523('0x18')](function(_0x1a5ac6){_0x2343d7[_0x9523('0xa3')]=_0x1a5ac6;return _0x2343d7;});}})[_0x9523('0x18')](respondWithFilteredResult(_0xe528fc,_0x5d167d))[_0x9523('0x23')](handleError(_0xe528fc,null));};exports[_0x9523('0xa9')]=function(_0xf957c3,_0x52b5f4){return db['ChatInteraction'][_0x9523('0x4c')]({'where':{'id':_0xf957c3[_0x9523('0x43')]['id']}})[_0x9523('0x18')](handleEntityNotFound(_0x52b5f4,null))[_0x9523('0x18')](function(_0xb1448c){if(_0xb1448c){return _0xb1448c[_0x9523('0xaa')](_0xf957c3[_0x9523('0x34')]['ids'],_[_0x9523('0xab')](_0xf957c3['body'],['ids','id'])||{})[_0x9523('0xac')](function(){return db[_0x9523('0xad')][_0x9523('0x3e')]({'attributes':['id',_0x9523('0x30'),'color'],'where':{'id':_0xf957c3[_0x9523('0x34')][_0x9523('0xae')]}});})['then'](function(_0x39fcf5){socket['emit'](_0x9523('0xaf'),{'id':Number(_0xf957c3['params']['id']),'tags':_0x39fcf5||[]});return{'id':Number(_0xf957c3[_0x9523('0x43')]['id']),'tags':_0x39fcf5||[]};});}})[_0x9523('0x18')](respondWithResult(_0x52b5f4,null))[_0x9523('0x23')](handleError(_0x52b5f4,null));};exports[_0x9523('0xb0')]=function(_0x56de27,_0x32b098){return db[_0x9523('0x39')]['find']({'where':{'id':_0x56de27[_0x9523('0x43')]['id']}})[_0x9523('0x18')](handleEntityNotFound(_0x32b098,null))[_0x9523('0x18')](function(_0x4e4dc8){if(_0x4e4dc8){return _0x4e4dc8[_0x9523('0xb0')](_0x56de27[_0x9523('0x40')][_0x9523('0xae')]);}})[_0x9523('0x18')](respondWithStatusCode(_0x32b098,null))[_0x9523('0x23')](handleError(_0x32b098,null));};exports[_0x9523('0xb1')]=function(_0x776ae9,_0x26a1c1){var _0x5ba046=moment()['unix']()[_0x9523('0xb2')]();var _0x1d0e0f=path[_0x9523('0x73')](config[_0x9523('0x71')],_0x9523('0xb3'),_0x9523('0xb4'),_0x9523('0xb5'));var _0x237b64=path['join'](config[_0x9523('0x71')],_0x9523('0xb3'),_0x9523('0xb4'),_0x9523('0xb6'));var _0x176213=path['join'](_0x1d0e0f,_0x5ba046);var _0x4e940c=util['format']('transcript-%d-%s.zip',_0x776ae9[_0x9523('0x43')]['id'],_0x5ba046);var _0x2e4e90=path[_0x9523('0x73')](_0x1d0e0f,_0x4e940c);var _0x48668e=[];_0x48668e['push']({'model':db['User'],'as':_0x9523('0x7e'),'attributes':['id','fullname'],'raw':!![]});_0x48668e[_0x9523('0xa7')]({'model':db['CmContact'],'as':_0x9523('0x64'),'attributes':['id','firstName',_0x9523('0xb7')],'raw':!![]});if(_0x776ae9[_0x9523('0x40')][_0x9523('0xb6')]){_0x48668e[_0x9523('0xa7')]({'model':db[_0x9523('0x6d')],'as':_0x9523('0x6d'),'raw':!![]});}var _0x9da4d9=[{'model':db[_0x9523('0x7c')],'as':_0x9523('0x7d'),'attributes':['id',_0x9523('0x34'),_0x9523('0xb8'),_0x9523('0x8b'),_0x9523('0x8c'),'read'],'include':_0x48668e}];_0x9da4d9['push']({'model':db[_0x9523('0x7f')],'as':_0x9523('0xb9'),'attributes':['id','name']});_0x9da4d9['push']({'model':db['User'],'as':_0x9523('0xba'),'attributes':['id',_0x9523('0x55')]});return db[_0x9523('0x39')]['find']({'where':{'id':_0x776ae9['params']['id']},'include':_0x9da4d9})[_0x9523('0x18')](handleEntityNotFound(_0x26a1c1,null))[_0x9523('0x18')](function(_0x28ce72){if(_0x28ce72){var _0x391dda=_0x28ce72['get']({'plain':!![]});fs[_0x9523('0xbb')](_0x176213);var _0x81ac63={'channel':'Chat','account':_0x391dda['Account'][_0x9523('0x30')],'agent':_0x391dda[_0x9523('0xba')]?_0x391dda[_0x9523('0xba')][_0x9523('0x55')]:_0x9523('0xbc'),'createdAt':moment(_0x391dda[_0x9523('0xb8')])['format'](_0x9523('0xa0'))[_0x9523('0xb2')](),'closedAt':_0x391dda[_0x9523('0x66')]?moment(_0x391dda[_0x9523('0xbd')])[_0x9523('0x78')](_0x9523('0xa0'))[_0x9523('0xb2')]():'','disposition':_0x391dda[_0x9523('0x67')],'chatInfo':{'browser':_0x391dda[_0x9523('0xbe')],'os':_0x391dda[_0x9523('0xbf')],'referer':_0x391dda[_0x9523('0xc0')],'customerIp':_0x391dda[_0x9523('0xc1')],'customerPort':_0x391dda[_0x9523('0xc2')]?_0x391dda['customerPort']:'N.A.'},'messages':_(_0x391dda[_0x9523('0x7d')])[_0x9523('0xc3')]()[_0x9523('0x9d')]({'secret':![]})[_0x9523('0x38')](function(_0x389c12){if(_0x389c12[_0x9523('0x6d')]){var _0x41d73e=path[_0x9523('0x73')](_0x237b64,_0x389c12[_0x9523('0x6d')][_0x9523('0x75')]);if(fs[_0x9523('0xc4')](_0x41d73e)){fs[_0x9523('0xc5')](_0x41d73e)[_0x9523('0xc6')](fs[_0x9523('0xc7')](path[_0x9523('0x73')](_0x176213,_0x389c12['Attachment']['basename'])));}}return{'date':moment(_0x389c12['createdAt'])[_0x9523('0x78')](_0x9523('0xa0'))['toString'](),'sender':_0x389c12[_0x9523('0x8b')]===_0x9523('0x61')?_0x389c12[_0x9523('0x7e')]?_0x389c12[_0x9523('0x7e')]['fullname']:_0x9523('0x87'):_0x389c12[_0x9523('0x64')][_0x9523('0xc8')]+(_0x389c12['Contact']['lastName']?'\x20'+_0x389c12['Contact'][_0x9523('0xb7')]:''),'body':_0x389c12[_0x9523('0x6d')]?_0x389c12[_0x9523('0x6d')][_0x9523('0x75')]:_0x389c12[_0x9523('0x34')],'direction':_0x389c12[_0x9523('0x8b')]===_0x9523('0x61')?'A':'C','secret':_0x389c12['secret'],'read':_0x389c12[_0x9523('0xc9')],'attachment':_0x389c12[_0x9523('0x6d')]};})[_0x9523('0xca')]()};return ejs['renderFile'](path[_0x9523('0x73')](config[_0x9523('0x71')],_0x9523('0xb3'),'views',_0x9523('0xcb')),{'interaction':_0x81ac63})[_0x9523('0x18')](function(_0x1ee0d0){var _0x20ea34=path[_0x9523('0x73')](_0x176213,_0x9523('0xcc')+_0x391dda['id']+'-'+_0x5ba046+_0x9523('0xcd'));var _0x22d984={'path':_0x20ea34,'channel':_0x9523('0xce'),'interactionId':_0x391dda['id']};return pdf['createPdfFromHTML'](_0x1ee0d0,_0x22d984);})[_0x9523('0x18')](function(){return new Promise(function(_0x3e2436,_0x219f51){zipdir(_0x176213,{'saveTo':_0x2e4e90},function(_0x2bd786,_0x2764af){if(_0x2bd786)return _0x219f51(_0x2bd786);return _0x3e2436(_0x2764af);});})[_0x9523('0x18')](function(){return new BPromise(function(_0x210098,_0x3e4c43){rimraf(_0x176213,function(_0x3d29e2){if(_0x3d29e2)_0x3e4c43(_0x3d29e2);return _0x210098();});});})[_0x9523('0x18')](function(){return _0x26a1c1[_0x9523('0xb1')](_0x2e4e90,_0x4e940c,function(_0x413636){if(_0x413636){logger[_0x9523('0x1e')](_0x9523('0xcf'),_0x413636);}else{fs[_0x9523('0xd0')](_0x2e4e90);}});});});}else{return _0x26a1c1[_0x9523('0x24')](0xc8);}})[_0x9523('0x23')](handleError(_0x26a1c1,null));}; \ No newline at end of file +var _0x607c=['secret','includeAgent','push','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','download','toString','server','files','tmp','attachments','firstName','lastName','direction','read','Account','Owner','mkdirSync','N.A.','closedAt','disposition','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Chat','createPdfFromHTML','unlinkSync','rimraf','moment','mustache','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','jayson/promise','client','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','update','then','destroy','name','send','render','merge','body','contact','agent','interaction','account','map','ChatInteraction','fieldName','key','getOptions','findAll','chat','query','user','catch','show','params','model','keys','rawAttributes','attributes','intersection','fields','length','includeAll','include','options','find','create','describe','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','fullname','email','POST','isNull','follow','parse','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','type','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsiteId','ContactId','%s%d','agentAlias','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','System','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','Smtp','CloudProvider','getSmtpOptions','sendMail','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','filters','hasOwnProperty','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','nolimit','order'];(function(_0x4cbf12,_0x10fb21){var _0x568b6d=function(_0x5f2471){while(--_0x5f2471){_0x4cbf12['push'](_0x4cbf12['shift']());}};_0x568b6d(++_0x10fb21);}(_0x607c,0xfd));var _0xc607=function(_0x385b15,_0x4eef91){_0x385b15=_0x385b15-0x0;var _0x4ffd63=_0x607c[_0x385b15];return _0x4ffd63;};'use strict';var rimraf=require(_0xc607('0x0'));var zipdir=require('zip-dir');var rp=require('request-promise');var moment=require(_0xc607('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xc607('0x2'));var util=require('util');var path=require(_0xc607('0x3'));var ejs=require(_0xc607('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc607('0x5'));var interaction=require(_0xc607('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0xc607('0x7'));var logger=require(_0xc607('0x8'))(_0xc607('0x9'));var config=require(_0xc607('0xa'));var db=require(_0xc607('0xb'))['db'];config[_0xc607('0xc')]=_[_0xc607('0xd')](config[_0xc607('0xc')],{'host':_0xc607('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc607('0xf'))['register'](socket);var jayson=require(_0xc607('0x10'));var client=jayson[_0xc607('0x11')]['http']({'port':0x232b});var client9004=jayson[_0xc607('0x11')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5d01b7,_0x37d119,_0x3184a8,_0x24a23c){return new BPromise(function(_0x1d3f5f,_0x4151ec){var _0x31a7ec=_0x24a23c||client;return _0x31a7ec['request'](_0x5d01b7,_0x3184a8)['then'](function(_0x28eb6d){logger['info'](_0xc607('0x12'),_0x37d119,_0xc607('0x13'));logger[_0xc607('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x37d119,'request\x20sent',JSON['stringify'](_0x28eb6d));if(_0x28eb6d[_0xc607('0x15')]){if(_0x28eb6d[_0xc607('0x15')][_0xc607('0x16')]===0x1f4){logger[_0xc607('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x37d119,_0x28eb6d[_0xc607('0x15')][_0xc607('0x17')]);return _0x4151ec(_0x28eb6d[_0xc607('0x15')][_0xc607('0x17')]);}logger[_0xc607('0x15')](_0xc607('0x12'),_0x37d119,_0x28eb6d[_0xc607('0x15')][_0xc607('0x17')]);return _0x1d3f5f(_0x28eb6d['error'][_0xc607('0x17')]);}else{logger[_0xc607('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x37d119,_0xc607('0x13'));_0x1d3f5f(_0x28eb6d[_0xc607('0x19')][_0xc607('0x17')]);}})['catch'](function(_0x72734){logger[_0xc607('0x15')](_0xc607('0x12'),_0x37d119,_0x72734);_0x4151ec(_0x72734);});});}function respondWithStatusCode(_0x527db9,_0x4673ec){_0x4673ec=_0x4673ec||0xcc;return function(_0x4afc8f){if(_0x4afc8f){return _0x527db9[_0xc607('0x1a')](_0x4673ec);}return _0x527db9['status'](_0x4673ec)[_0xc607('0x1b')]();};}function respondWithResult(_0x594873,_0x4d8964){_0x4d8964=_0x4d8964||0xc8;return function(_0x39fb2c){if(_0x39fb2c){return _0x594873['status'](_0x4d8964)['json'](_0x39fb2c);}};}function respondWithFilteredResult(_0x4ccec5,_0x48ce8a){return function(_0x1ccab6){if(_0x1ccab6){var _0x2b86ad=typeof _0x48ce8a[_0xc607('0x1c')]===_0xc607('0x1d')&&typeof _0x48ce8a[_0xc607('0x1e')]===_0xc607('0x1d');var _0x3721bf=_0x1ccab6[_0xc607('0x1f')];var _0x6a83ab=_0x2b86ad?0x0:_0x48ce8a[_0xc607('0x1c')];var _0x58dcd6=_0x2b86ad?_0x1ccab6['count']:_0x48ce8a[_0xc607('0x1c')]+_0x48ce8a[_0xc607('0x1e')];var _0x21d993;if(_0x58dcd6>=_0x3721bf){_0x58dcd6=_0x3721bf;_0x21d993=0xc8;}else{_0x21d993=0xce;}_0x4ccec5[_0xc607('0x20')](_0x21d993);return _0x4ccec5[_0xc607('0x21')](_0xc607('0x22'),_0x6a83ab+'-'+_0x58dcd6+'/'+_0x3721bf)[_0xc607('0x23')](_0x1ccab6);}return null;};}function saveUpdates(_0x8906e3){return function(_0x3bdd01){if(_0x3bdd01){return _0x3bdd01[_0xc607('0x24')](_0x8906e3)[_0xc607('0x25')](function(_0xb7ad97){return _0xb7ad97;});}return null;};}function removeEntity(_0x27ea72){return function(_0x385b9d){if(_0x385b9d){return _0x385b9d[_0xc607('0x26')]()[_0xc607('0x25')](function(){_0x27ea72[_0xc607('0x20')](0xcc)[_0xc607('0x1b')]();});}};}function handleEntityNotFound(_0x1a5573){return function(_0x30a5d8){if(!_0x30a5d8){_0x1a5573[_0xc607('0x1a')](0x194);}return _0x30a5d8;};}function handleError(_0x2bf1c1,_0x42b566){_0x42b566=_0x42b566||0x1f4;return function(_0x158593){logger['error'](_0x158593['stack']);if(_0x158593['name']){delete _0x158593[_0xc607('0x27')];}_0x2bf1c1['status'](_0x42b566)[_0xc607('0x28')](_0x158593);};}function getMustacheRender(_0x564090,_0x3f83c7){return Mustache[_0xc607('0x29')](_0x564090,_[_0xc607('0x2a')](_0x3f83c7[_0xc607('0x2b')],{'contact':_0x3f83c7[_0xc607('0x2c')],'message':_0x3f83c7[_0xc607('0x17')],'agent':_0x3f83c7[_0xc607('0x2d')],'interaction':_0x3f83c7[_0xc607('0x2e')],'account':_0x3f83c7[_0xc607('0x2f')]}))||'';}exports['index']=function(_0x231a1c,_0x561701){var _0x4dc5f5={};var _0x37229c=_[_0xc607('0x30')](db[_0xc607('0x31')]['rawAttributes'],function(_0x3f90c3){return{'name':_0x3f90c3[_0xc607('0x32')],'type':_0x3f90c3['type'][_0xc607('0x33')]};});_0x4dc5f5=qs[_0xc607('0x34')](_0x37229c,_0x231a1c);return interaction[_0xc607('0x35')](_0xc607('0x36'),_0x231a1c[_0xc607('0x37')],_0x231a1c[_0xc607('0x38')],_0x4dc5f5,_0x37229c)[_0xc607('0x25')](respondWithFilteredResult(_0x561701,_0x4dc5f5))[_0xc607('0x39')](handleError(_0x561701,null));};exports[_0xc607('0x3a')]=function(_0x3de5d8,_0xb458c4){var _0x501475={'raw':![],'where':{'id':_0x3de5d8[_0xc607('0x3b')]['id']}},_0x3aaad4={};_0x3aaad4[_0xc607('0x3c')]=_[_0xc607('0x3d')](db[_0xc607('0x31')][_0xc607('0x3e')]);_0x3aaad4[_0xc607('0x37')]=_['keys'](_0x3de5d8[_0xc607('0x37')]);_0x3aaad4['filters']=_['intersection'](_0x3aaad4[_0xc607('0x3c')],_0x3aaad4['query']);_0x501475[_0xc607('0x3f')]=_[_0xc607('0x40')](_0x3aaad4[_0xc607('0x3c')],qs[_0xc607('0x41')](_0x3de5d8[_0xc607('0x37')][_0xc607('0x41')]));_0x501475[_0xc607('0x3f')]=_0x501475[_0xc607('0x3f')][_0xc607('0x42')]?_0x501475['attributes']:_0x3aaad4[_0xc607('0x3c')];if(_0x3de5d8[_0xc607('0x37')][_0xc607('0x43')]){_0x501475[_0xc607('0x44')]=[{'all':!![]}];}_0x501475=_['merge']({},_0x501475,_0x3de5d8[_0xc607('0x45')]);return db['ChatInteraction'][_0xc607('0x46')](_0x501475)['then'](handleEntityNotFound(_0xb458c4,null))[_0xc607('0x25')](respondWithResult(_0xb458c4,null))[_0xc607('0x39')](handleError(_0xb458c4,null));};exports[_0xc607('0x47')]=function(_0x5cfa4c,_0x7d07cf){return db[_0xc607('0x31')][_0xc607('0x47')](_0x5cfa4c[_0xc607('0x2b')],{})[_0xc607('0x25')](respondWithResult(_0x7d07cf,0xc9))[_0xc607('0x39')](handleError(_0x7d07cf,null));};exports[_0xc607('0x24')]=function(_0x579f1b,_0x4e25ab){if(_0x579f1b[_0xc607('0x2b')]['id']){delete _0x579f1b[_0xc607('0x2b')]['id'];}return db[_0xc607('0x31')][_0xc607('0x46')]({'where':{'id':_0x579f1b['params']['id']}})[_0xc607('0x25')](handleEntityNotFound(_0x4e25ab,null))['then'](saveUpdates(_0x579f1b[_0xc607('0x2b')],null))[_0xc607('0x25')](respondWithResult(_0x4e25ab,null))[_0xc607('0x39')](handleError(_0x4e25ab,null));};exports['destroy']=function(_0x81bf7b,_0xb86a07){return db[_0xc607('0x31')][_0xc607('0x46')]({'where':{'id':_0x81bf7b['params']['id']}})['then'](handleEntityNotFound(_0xb86a07,null))[_0xc607('0x25')](removeEntity(_0xb86a07,null))[_0xc607('0x39')](handleError(_0xb86a07,null));};exports[_0xc607('0x48')]=function(_0x35866f,_0x387b6c){return db[_0xc607('0x31')][_0xc607('0x48')]()['then'](respondWithResult(_0x387b6c,null))[_0xc607('0x39')](handleError(_0x387b6c,null));};exports['createVidaooSession']=function(_0x53cf3d,_0x25f87e){var _0x47475f=_0x53cf3d[_0xc607('0x3b')]['id'];var _0x152b7f;var _0x1733cb;var _0x570f5;return db[_0xc607('0x31')]['findOne']({'where':{'id':_0x47475f}})['then'](function(_0x327717){_0x152b7f=_0x327717;return db[_0xc607('0x49')][_0xc607('0x4a')]({'where':{'id':_0x327717['ChatWebsiteId']},'attributes':['id',_0xc607('0x4b'),'vidaooEscalation',_0xc607('0x4c'),_0xc607('0x4d'),_0xc607('0x4e')],'raw':!![]});})[_0xc607('0x25')](function(_0x173713){if(_0x173713&&_0x173713['vidaooApiKey']&&_0x173713[_0xc607('0x4f')]){_0x1733cb=_0x173713;var _0x5f470f={'interaction':{'id':_0x47475f},'agent':{'id':_0x53cf3d['user']['id'],'name':_0x53cf3d[_0xc607('0x38')][_0xc607('0x27')],'fullname':_0x53cf3d['user'][_0xc607('0x50')],'email':_0x53cf3d[_0xc607('0x38')][_0xc607('0x51')]},'contact':_0x53cf3d['body'][_0xc607('0x2c')],'account':_0x53cf3d[_0xc607('0x2b')][_0xc607('0x2f')]};var _0xf5e88f={'rejectUnauthorized':![],'method':_0xc607('0x52'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x173713[_0xc607('0x4b')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x53cf3d[_0xc607('0x38')][_0xc607('0x51')]],'buttons':null,'topic':_0x1733cb[_0xc607('0x4c')],'note':_[_0xc607('0x53')](_0x1733cb['vidaooNote'])?null:getMustacheRender(_0x1733cb[_0xc607('0x4d')],_0x5f470f),'metadata':null},'redirect':_0xc607('0x54'),'json':!![]};try{if(!_[_0xc607('0x53')](_0x1733cb['vidaooMetadata'])){var _0xce810c=getMustacheRender(_0x1733cb[_0xc607('0x4e')],_0x5f470f);var _0x163511=JSON[_0xc607('0x55')](_0xce810c);_0xf5e88f[_0xc607('0x2b')]['metadata']=_0x163511;}}catch(_0x4a2eb2){throw new db['Sequelize'][(_0xc607('0x56'))](_0xc607('0x57'));}return rp(_0xf5e88f);}else{throw new db[(_0xc607('0x58'))][(_0xc607('0x56'))](_0xc607('0x59'));}})['then'](function(_0x49dd82){_0x570f5=_0x49dd82;if(_0x570f5['id']){var _0x481b08={'body':_0x570f5['join_url'],'ChatWebsiteId':_0x1733cb['id'],'ChatInteractionId':_0x152b7f['id'],'direction':_0xc607('0x5a'),'UserId':_0x53cf3d[_0xc607('0x38')]['id']};return db[_0xc607('0x5b')][_0xc607('0x47')](_0x481b08,{});}else{throw new db[(_0xc607('0x58'))][(_0xc607('0x56'))](_0xc607('0x5c'));}})[_0xc607('0x25')](function(){return _0x152b7f[_0xc607('0x5d')]({'vidaooSessionId':_0x570f5['id']});})[_0xc607('0x25')](respondWithResult(_0x25f87e,null))[_0xc607('0x39')](handleError(_0x25f87e,null));};exports[_0xc607('0x5e')]=function(_0x36e34c,_0x3e2002){if(_0x36e34c[_0xc607('0x2b')]['id']){delete _0x36e34c[_0xc607('0x2b')]['id'];}return db[_0xc607('0x31')]['find']({'where':{'id':_0x36e34c['params']['id']},'include':[{'model':db[_0xc607('0x5f')],'as':_0xc607('0x60')}]})['then'](handleEntityNotFound(_0x3e2002,null))[_0xc607('0x25')](saveUpdates(_0x36e34c[_0xc607('0x2b')],null))[_0xc607('0x25')](respondWithResult(_0x3e2002,null))[_0xc607('0x39')](handleError(_0x3e2002,null));};exports[_0xc607('0x61')]=function(_0x3aacab,_0x3c594b){if(_0x3aacab[_0xc607('0x2b')]['id']){delete _0x3aacab[_0xc607('0x2b')]['id'];}return db[_0xc607('0x31')][_0xc607('0x46')]({'where':{'id':_0x3aacab[_0xc607('0x3b')]['id']}})['then'](function(_0x32d9dd){if(!_0x32d9dd){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xc607('0x61'),0x194,_0xc607('0x62'));_0x3c594b[_0xc607('0x1a')](0x194);}else{if(_0x32d9dd[_0xc607('0x63')]){throw new db[(_0xc607('0x58'))]['ValidationError'](_0xc607('0x64'));}}return _0x32d9dd;})[_0xc607('0x25')](function(_0x3f99f9){if(_0x3f99f9){return _0x3f99f9['update']({'closed':_0x3aacab['body'][_0xc607('0x65')],'disposition':_0x3aacab['body']['disposition']})[_0xc607('0x25')](function(_0x1bd212){return _0x1bd212;});}})['then'](function(){return respondWithRpcPromise(_0xc607('0x66'),_0xc607('0x61'),_0x3aacab[_0xc607('0x2b')],client9004);})['then'](respondWithResult(_0x3c594b,null))[_0xc607('0x39')](handleError(_0x3c594b,null));};exports[_0xc607('0x67')]=function(_0x5e3072,_0x588f49){_0x5e3072[_0xc607('0x2b')]['name']=_0x5e3072[_0xc607('0x68')][_0xc607('0x69')];_0x5e3072['body'][_0xc607('0x6a')]=_0x5e3072['file']['filename'];_0x5e3072['body'][_0xc607('0x6b')]=_0x5e3072[_0xc607('0x68')][_0xc607('0x6c')];return db[_0xc607('0x6d')][_0xc607('0x47')](_0x5e3072[_0xc607('0x2b')])[_0xc607('0x25')](respondWithResult(_0x588f49,0xc9))[_0xc607('0x39')](handleError(_0x588f49,null));};exports[_0xc607('0x6e')]=function(_0x2934b8,_0x45cbde){return db['ChatInteraction'][_0xc607('0x4a')]({'where':{'id':_0x2934b8['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x45cbde,null))['then'](function(_0x2ea583){if(_0x2ea583){if(_0x2ea583[_0xc607('0x65')]){return _0x45cbde['status'](0x193)['json']({'status':0x193,'message':_0xc607('0x6f')});}return db['Attachment'][_0xc607('0x4a')]({'where':{'id':_0x2934b8[_0xc607('0x37')][_0xc607('0x70')]},'raw':!![]})[_0xc607('0x25')](handleEntityNotFound(_0x45cbde,null));}})[_0xc607('0x25')](function(_0xcafc53){if(_0xcafc53){var _0x4a4afa=_0xcafc53[_0xc607('0x71')]!==null;var _0xf33b4d=path[_0xc607('0x72')](config[_0xc607('0x73')],_0xc607('0x74'));if(_0x4a4afa){_0xf33b4d=path[_0xc607('0x72')](_0xf33b4d,_0xc607('0x75'));}var _0xa09341=path[_0xc607('0x72')](_0xf33b4d,_0xcafc53['basename']);return _0x45cbde['download'](_0xa09341);}})[_0xc607('0x39')](handleError(_0x45cbde,null));};exports[_0xc607('0x76')]=function(_0x2bd494,_0x50a881){var _0x319451=null;var _0x268716=null;var _0x49118b=null;if(_0x2bd494['body']['id']){delete _0x2bd494[_0xc607('0x2b')]['id'];}if(_0x2bd494['body'][_0xc607('0x77')]){_0x49118b=path[_0xc607('0x72')](config['root'],'server/files/chat/upload/',util[_0xc607('0x78')](_0xc607('0x79'),Date[_0xc607('0x7a')]()));_0x2bd494[_0xc607('0x2b')][_0xc607('0x7b')]=_0x49118b;}return db[_0xc607('0x31')][_0xc607('0x46')]({'where':{'id':_0x2bd494['params']['id']},'include':[{'model':db[_0xc607('0x5b')],'as':_0xc607('0x7c'),'include':[{'model':db[_0xc607('0x7d')],'as':_0xc607('0x7d')}]}]})['then'](handleEntityNotFound(_0x50a881,null))[_0xc607('0x25')](saveUpdates(_0x2bd494['body'],null))['then'](function(_0x3e82fc){if(_0x3e82fc){_0x319451=_0x3e82fc;return db[_0xc607('0x49')][_0xc607('0x46')]({'where':{'id':_0x319451[_0xc607('0x7e')]}});}})[_0xc607('0x25')](function(_0x55c3c6){if(_0x55c3c6){_0x268716=_0x55c3c6;return db[_0xc607('0x5f')][_0xc607('0x46')]({'where':{'id':_0x319451[_0xc607('0x7f')]}});}})[_0xc607('0x25')](function(_0x23e1d7){if(_0x23e1d7){if(_0x49118b){var _0x2d8b50=null;for(var _0x5c4c55=0x1;_0x5c4c55<_0x319451[_0xc607('0x7c')]['length'];++_0x5c4c55){_0x2d8b50=_0x319451[_0xc607('0x7c')][_0x5c4c55];var _0x5f1d43=_0x2d8b50['UserId']?util['format'](_0xc607('0x80'),_0x268716[_0xc607('0x81')],_0x2d8b50[_0xc607('0x63')]):'System';var _0x29cee9=_0x2bd494[_0xc607('0x2b')]['customer']||util[_0xc607('0x78')](_0xc607('0x80'),_0xc607('0x82'),_0x2d8b50[_0xc607('0x7f')]);switch(_0x268716[_0xc607('0x83')]){case'website_alias':_0x5f1d43=_0x2d8b50[_0xc607('0x63')]?util['format'](_0xc607('0x80'),_0x268716['agentAlias'],_0x2d8b50[_0xc607('0x63')]):'System';break;case _0xc607('0x84'):_0x5f1d43=_0x2d8b50[_0xc607('0x63')]?_0x2d8b50[_0xc607('0x7d')][_0xc607('0x85')]||_0x2d8b50[_0xc607('0x7d')][_0xc607('0x50')]:'System';break;case _0xc607('0x86'):_0x5f1d43=_0x2d8b50[_0xc607('0x63')]?_0x2d8b50[_0xc607('0x7d')][_0xc607('0x50')]:'System';break;default:_0x5f1d43=_0x2d8b50[_0xc607('0x63')]?util[_0xc607('0x78')](_0xc607('0x80'),_0x268716[_0xc607('0x81')],_0x2d8b50[_0xc607('0x63')]):_0xc607('0x87');}var _0x4a2d06=util[_0xc607('0x78')](_0xc607('0x88'),moment(_0x2d8b50[_0xc607('0x89')])[_0xc607('0x78')](_0xc607('0x8a')),_0x2d8b50['direction']==='in'?_0x29cee9:_0x5f1d43,_0x2d8b50[_0xc607('0x2b')]);if(!_0x2d8b50['secret']){fs[_0xc607('0x8b')](_0x49118b,_0x4a2d06);}}return db['MailAccount'][_0xc607('0x4a')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xc607('0x8c'),'raw':!![],'include':[{'model':db[_0xc607('0x8d')],'as':_0xc607('0x8d'),'raw':!![]}]}]});}}})[_0xc607('0x25')](function(_0x240785){if(!_0x240785||!_0x240785['Smtp']||!_0x2bd494[_0xc607('0x2b')])return _0x319451;var _0x3ff42a=_0x240785[_0xc607('0x8e')]();return respondWithRpcPromise('SendMail',_0xc607('0x8f'),{'account':_0x3ff42a,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x240785[_0xc607('0x27')],_0x240785['email']||_0x240785[_0xc607('0x8c')][_0xc607('0x38')]),'to':_0x2bd494[_0xc607('0x2b')][_0xc607('0x77')],'subject':'Mail\x20Transcript','text':util[_0xc607('0x78')](_0xc607('0x90'),_0x2bd494[_0xc607('0x2b')][_0xc607('0x77')]),'attachments':[{'path':_0x49118b}]}})['then'](function(){return _0x319451;})[_0xc607('0x39')](function(_0x2e84ac){logger[_0xc607('0x15')](_0x2e84ac);});})[_0xc607('0x25')](respondWithStatusCode(_0x50a881,0xc8))[_0xc607('0x39')](handleError(_0x50a881,null));};exports[_0xc607('0x91')]=function(_0x2171ef,_0x44c043){return db[_0xc607('0x5b')]['find']({'where':{'id':_0x2171ef[_0xc607('0x3b')]['id']}})['then'](handleEntityNotFound(_0x44c043,null))[_0xc607('0x25')](function(_0x8ba726){if(_0x8ba726){return _0x8ba726[_0xc607('0x91')](_0x2171ef[_0xc607('0x2b')][_0xc607('0x92')],_[_0xc607('0x93')](_0x2171ef[_0xc607('0x2b')],[_0xc607('0x92'),'id'])||{});}})[_0xc607('0x25')](respondWithResult(_0x44c043,null))[_0xc607('0x39')](handleError(_0x44c043,null));};exports[_0xc607('0x94')]=function(_0x311195,_0xf2ff4b){var _0x2567c7={'raw':![],'where':{}};var _0x1d309d={};var _0x579ba0={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xc607('0x4a')]({'where':{'id':_0x311195['params']['id']}})['then'](handleEntityNotFound(_0xf2ff4b,null))['then'](function(_0x1906a8){if(_0x1906a8){_0x1d309d[_0xc607('0x3c')]=_[_0xc607('0x3d')](db[_0xc607('0x5b')][_0xc607('0x3e')]);_0x1d309d[_0xc607('0x37')]=_[_0xc607('0x3d')](_0x311195[_0xc607('0x37')]);_0x1d309d[_0xc607('0x95')]=_[_0xc607('0x40')](_0x1d309d[_0xc607('0x3c')],_0x1d309d[_0xc607('0x37')]);_0x2567c7[_0xc607('0x3f')]=_[_0xc607('0x40')](_0x1d309d[_0xc607('0x3c')],qs[_0xc607('0x41')](_0x311195['query'][_0xc607('0x41')]));_0x2567c7[_0xc607('0x3f')]=_0x2567c7[_0xc607('0x3f')][_0xc607('0x42')]?_0x2567c7[_0xc607('0x3f')]:_0x1d309d[_0xc607('0x3c')];if(!_0x311195[_0xc607('0x37')][_0xc607('0x96')]('nolimit')){_0x2567c7[_0xc607('0x1e')]=qs[_0xc607('0x1e')](_0x311195[_0xc607('0x37')][_0xc607('0x1e')]);_0x2567c7['offset']=qs['offset'](_0x311195[_0xc607('0x37')][_0xc607('0x1c')]);}_0x2567c7['order']=qs['sort'](_0x311195['query'][_0xc607('0x97')]);_0x2567c7[_0xc607('0x98')]=qs[_0xc607('0x95')](_[_0xc607('0x99')](_0x311195[_0xc607('0x37')],_0x1d309d['filters']));_0x2567c7['where'][_0xc607('0x9a')]=_0x1906a8['id'];if(_0x311195[_0xc607('0x37')][_0xc607('0x9b')]){_0x2567c7['where']=_[_0xc607('0x2a')](_0x2567c7['where'],{'$or':_[_0xc607('0x30')](_0x2567c7[_0xc607('0x3f')],function(_0x3ad7a7){var _0x35f4bb={};_0x35f4bb[_0x3ad7a7]={'$like':'%'+_0x311195[_0xc607('0x37')][_0xc607('0x9b')]+'%'};return _0x35f4bb;})});}if(_0x311195[_0xc607('0x37')][_0xc607('0x9c')]){var _0x4f09e6=_0x311195[_0xc607('0x37')][_0xc607('0x9c')][_0xc607('0x9d')](',');var _0xa1b812={};_0xa1b812[_0x4f09e6[0x0]]={'$gte':moment(_0x4f09e6[0x1])[_0xc607('0x78')](_0xc607('0x9e'))};_0x2567c7[_0xc607('0x98')]=_[_0xc607('0x2a')](_0x2567c7['where'],_0xa1b812);}_0x2567c7=_['merge']({},_0x2567c7,_0x311195[_0xc607('0x45')]);return db['ChatMessage']['count']({'where':_0x2567c7[_0xc607('0x98')]})[_0xc607('0x25')](function(_0x3140d6){_0x579ba0[_0xc607('0x1f')]=_0x3140d6;if(_0x311195[_0xc607('0x37')][_0xc607('0x43')]){_0x2567c7['include']=[{'all':!![]}];}return db[_0xc607('0x5b')][_0xc607('0x35')](_0x2567c7);})[_0xc607('0x25')](function(_0xb61701){_0x579ba0[_0xc607('0x9f')]=_0xb61701;return _0x579ba0;});}})[_0xc607('0x25')](respondWithFilteredResult(_0xf2ff4b,_0x2567c7))['catch'](handleError(_0xf2ff4b,null));};exports[_0xc607('0xa0')]=function(_0x5912f7,_0x5251ce){var _0xc3c593={'where':{}},_0x27fc93={},_0x472efd={'count':0x0,'rows':[]};return db[_0xc607('0x31')]['findOne']({'where':{'id':_0x5912f7['params']['id']}})['then'](handleEntityNotFound(_0x5251ce,null))[_0xc607('0x25')](function(_0x54c5a4){if(_0x54c5a4){_0x27fc93[_0xc607('0x3c')]=_[_0xc607('0x3d')](db[_0xc607('0x5b')][_0xc607('0x3e')]);_0x27fc93[_0xc607('0x37')]=_[_0xc607('0x3d')](_0x5912f7[_0xc607('0x37')]);_0x27fc93[_0xc607('0x95')]=_[_0xc607('0x40')](_0x27fc93[_0xc607('0x3c')],_0x27fc93[_0xc607('0x37')]);_0xc3c593[_0xc607('0x3f')]=_[_0xc607('0x40')](_0x27fc93[_0xc607('0x3c')],qs[_0xc607('0x41')](_0x5912f7['query'][_0xc607('0x41')]));_0xc3c593[_0xc607('0x3f')]=_0xc3c593[_0xc607('0x3f')]['length']?_0xc3c593['attributes']:_0x27fc93[_0xc607('0x3c')];if(!_0x5912f7[_0xc607('0x37')][_0xc607('0x96')](_0xc607('0xa1'))){_0xc3c593[_0xc607('0x1e')]=qs[_0xc607('0x1e')](_0x5912f7['query'][_0xc607('0x1e')]);_0xc3c593[_0xc607('0x1c')]=qs[_0xc607('0x1c')](_0x5912f7[_0xc607('0x37')]['offset']);}_0xc3c593[_0xc607('0xa2')]=qs[_0xc607('0x97')](_0x5912f7['query']['sort']);_0xc3c593['where']=qs[_0xc607('0x95')](_[_0xc607('0x99')](_0x5912f7[_0xc607('0x37')],_0x27fc93[_0xc607('0x95')]));_0xc3c593[_0xc607('0x98')][_0xc607('0x9a')]=_0x54c5a4['id'];if(_0x5912f7[_0xc607('0x37')][_0xc607('0x9b')]){_0xc3c593['where']=_[_0xc607('0x2a')](_0xc3c593['where'],{'$or':_[_0xc607('0x30')](_0xc3c593[_0xc607('0x3f')],function(_0x27f810){var _0x1dd37c={};_0x1dd37c[_0x27f810]={'$like':'%'+_0x5912f7['query'][_0xc607('0x9b')]+'%'};return _0x1dd37c;})});}_0xc3c593['where'][_0xc607('0xa3')]=![];if(_0x5912f7[_0xc607('0x37')]['id']){_0xc3c593['where']['id']={'$gt':_0x5912f7['query']['id']};}_0xc3c593=_[_0xc607('0x2a')]({},_0xc3c593,_0x5912f7['options']);return db[_0xc607('0x5b')][_0xc607('0x1f')]({'where':_0xc3c593[_0xc607('0x98')]})[_0xc607('0x25')](function(_0x195911){_0x472efd[_0xc607('0x1f')]=_0x195911;_0xc3c593[_0xc607('0x44')]=[];if(_0x5912f7[_0xc607('0x37')][_0xc607('0xa4')]){_0xc3c593[_0xc607('0x44')][_0xc607('0xa5')]({'model':db[_0xc607('0x7d')],'as':'User','attributes':['id','fullname',_0xc607('0x85')]});}if(_0x5912f7[_0xc607('0x37')][_0xc607('0x43')]){_0xc3c593[_0xc607('0x44')]=[{'all':!![]}];}return db[_0xc607('0x5b')][_0xc607('0x35')](_0xc3c593);})[_0xc607('0x25')](function(_0x3b9a37){_0x472efd['rows']=_0x3b9a37;return _0x472efd;});}})[_0xc607('0x25')](respondWithFilteredResult(_0x5251ce,_0xc3c593))['catch'](handleError(_0x5251ce,null));};exports[_0xc607('0xa6')]=function(_0x322634,_0x1a3088){return db[_0xc607('0x31')][_0xc607('0x46')]({'where':{'id':_0x322634[_0xc607('0x3b')]['id']}})[_0xc607('0x25')](handleEntityNotFound(_0x1a3088,null))[_0xc607('0x25')](function(_0x1ae606){if(_0x1ae606){return _0x1ae606[_0xc607('0xa7')](_0x322634[_0xc607('0x2b')][_0xc607('0x92')],_[_0xc607('0x93')](_0x322634['body'],['ids','id'])||{})[_0xc607('0xa8')](function(){return db[_0xc607('0xa9')][_0xc607('0x35')]({'attributes':['id',_0xc607('0x27'),_0xc607('0xaa')],'where':{'id':_0x322634['body'][_0xc607('0x92')]}});})[_0xc607('0x25')](function(_0x1cbeab){socket[_0xc607('0xab')](_0xc607('0xac'),{'id':Number(_0x322634['params']['id']),'tags':_0x1cbeab||[]});return{'id':Number(_0x322634[_0xc607('0x3b')]['id']),'tags':_0x1cbeab||[]};});}})[_0xc607('0x25')](respondWithResult(_0x1a3088,null))[_0xc607('0x39')](handleError(_0x1a3088,null));};exports[_0xc607('0xad')]=function(_0x141fea,_0x36b43f){return db[_0xc607('0x31')][_0xc607('0x46')]({'where':{'id':_0x141fea[_0xc607('0x3b')]['id']}})['then'](handleEntityNotFound(_0x36b43f,null))[_0xc607('0x25')](function(_0x5a044b){if(_0x5a044b){return _0x5a044b[_0xc607('0xad')](_0x141fea[_0xc607('0x37')][_0xc607('0x92')]);}})[_0xc607('0x25')](respondWithStatusCode(_0x36b43f,null))[_0xc607('0x39')](handleError(_0x36b43f,null));};exports[_0xc607('0xae')]=function(_0xffbd25,_0x4a32ba){var _0x38da8d=moment()['unix']()[_0xc607('0xaf')]();var _0x4d1c8d=path['join'](config[_0xc607('0x73')],_0xc607('0xb0'),_0xc607('0xb1'),_0xc607('0xb2'));var _0x5688c8=path[_0xc607('0x72')](config[_0xc607('0x73')],'server','files',_0xc607('0xb3'));var _0x4e1abe=path[_0xc607('0x72')](_0x4d1c8d,_0x38da8d);var _0x42116a=util[_0xc607('0x78')]('transcript-%d-%s.zip',_0xffbd25['params']['id'],_0x38da8d);var _0x331fc6=path[_0xc607('0x72')](_0x4d1c8d,_0x42116a);var _0x49f0f7=[];_0x49f0f7['push']({'model':db[_0xc607('0x7d')],'as':_0xc607('0x7d'),'attributes':['id',_0xc607('0x50')],'raw':!![]});_0x49f0f7[_0xc607('0xa5')]({'model':db[_0xc607('0x5f')],'as':_0xc607('0x60'),'attributes':['id',_0xc607('0xb4'),_0xc607('0xb5')],'raw':!![]});if(_0xffbd25[_0xc607('0x37')][_0xc607('0xb3')]){_0x49f0f7[_0xc607('0xa5')]({'model':db['Attachment'],'as':_0xc607('0x6d'),'raw':!![]});}var _0x18563c=[{'model':db['ChatMessage'],'as':_0xc607('0x7c'),'attributes':['id',_0xc607('0x2b'),'createdAt',_0xc607('0xb6'),_0xc607('0xa3'),_0xc607('0xb7')],'include':_0x49f0f7}];_0x18563c[_0xc607('0xa5')]({'model':db[_0xc607('0x49')],'as':_0xc607('0xb8'),'attributes':['id','name']});_0x18563c[_0xc607('0xa5')]({'model':db[_0xc607('0x7d')],'as':_0xc607('0xb9'),'attributes':['id','fullname']});return db['ChatInteraction'][_0xc607('0x46')]({'where':{'id':_0xffbd25[_0xc607('0x3b')]['id']},'include':_0x18563c})['then'](handleEntityNotFound(_0x4a32ba,null))[_0xc607('0x25')](function(_0x31d6a7){if(_0x31d6a7){var _0x1498ef=_0x31d6a7['get']({'plain':!![]});fs[_0xc607('0xba')](_0x4e1abe);var _0x44cad5={'channel':'Chat','account':_0x1498ef[_0xc607('0xb8')][_0xc607('0x27')],'agent':_0x1498ef[_0xc607('0xb9')]?_0x1498ef[_0xc607('0xb9')][_0xc607('0x50')]:_0xc607('0xbb'),'createdAt':moment(_0x1498ef[_0xc607('0x89')])[_0xc607('0x78')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc607('0xaf')](),'closedAt':_0x1498ef[_0xc607('0x65')]?moment(_0x1498ef[_0xc607('0xbc')])[_0xc607('0x78')](_0xc607('0x9e'))[_0xc607('0xaf')]():'','disposition':_0x1498ef[_0xc607('0xbd')],'chatInfo':{'browser':_0x1498ef[_0xc607('0xbe')],'os':_0x1498ef[_0xc607('0xbf')],'referer':_0x1498ef[_0xc607('0xc0')],'customerIp':_0x1498ef[_0xc607('0xc1')],'customerPort':_0x1498ef['customerPort']?_0x1498ef[_0xc607('0xc2')]:_0xc607('0xbb')},'messages':_(_0x1498ef[_0xc607('0x7c')])[_0xc607('0xc3')]()[_0xc607('0x9b')]({'secret':![]})['map'](function(_0xf4817){if(_0xf4817[_0xc607('0x6d')]){var _0x5093d9=path['join'](_0x5688c8,_0xf4817[_0xc607('0x6d')]['basename']);if(fs[_0xc607('0xc4')](_0x5093d9)){fs['createReadStream'](_0x5093d9)[_0xc607('0xc5')](fs[_0xc607('0xc6')](path['join'](_0x4e1abe,_0xf4817['Attachment']['basename'])));}}return{'date':moment(_0xf4817[_0xc607('0x89')])[_0xc607('0x78')](_0xc607('0x9e'))['toString'](),'sender':_0xf4817[_0xc607('0xb6')]===_0xc607('0x5a')?_0xf4817[_0xc607('0x7d')]?_0xf4817[_0xc607('0x7d')][_0xc607('0x50')]:_0xc607('0x87'):_0xf4817[_0xc607('0x60')]['firstName']+(_0xf4817['Contact'][_0xc607('0xb5')]?'\x20'+_0xf4817[_0xc607('0x60')][_0xc607('0xb5')]:''),'body':_0xf4817['Attachment']?_0xf4817[_0xc607('0x6d')][_0xc607('0x6a')]:_0xf4817[_0xc607('0x2b')],'direction':_0xf4817[_0xc607('0xb6')]==='out'?'A':'C','secret':_0xf4817[_0xc607('0xa3')],'read':_0xf4817[_0xc607('0xb7')],'attachment':_0xf4817[_0xc607('0x6d')]};})[_0xc607('0xc7')]()};return ejs[_0xc607('0xc8')](path[_0xc607('0x72')](config[_0xc607('0x73')],_0xc607('0xb0'),_0xc607('0xc9'),_0xc607('0xca')),{'interaction':_0x44cad5})[_0xc607('0x25')](function(_0x5b1bd8){var _0x48e2c2=path[_0xc607('0x72')](_0x4e1abe,_0xc607('0xcb')+_0x1498ef['id']+'-'+_0x38da8d+_0xc607('0xcc'));var _0x404a17={'path':_0x48e2c2,'channel':_0xc607('0xcd'),'interactionId':_0x1498ef['id']};return pdf[_0xc607('0xce')](_0x5b1bd8,_0x404a17);})[_0xc607('0x25')](function(){return new Promise(function(_0x206449,_0x18151d){zipdir(_0x4e1abe,{'saveTo':_0x331fc6},function(_0x14ccdb,_0x2621b1){if(_0x14ccdb)return _0x18151d(_0x14ccdb);return _0x206449(_0x2621b1);});})[_0xc607('0x25')](function(){return new BPromise(function(_0x543fbc,_0x12f421){rimraf(_0x4e1abe,function(_0x2b55f2){if(_0x2b55f2)_0x12f421(_0x2b55f2);return _0x543fbc();});});})['then'](function(){return _0x4a32ba[_0xc607('0xae')](_0x331fc6,_0x42116a,function(_0x9f446b){if(_0x9f446b){logger['error']('err',_0x9f446b);}else{fs[_0xc607('0xcf')](_0x331fc6);}});});});}else{return _0x4a32ba[_0xc607('0x1a')](0xc8);}})[_0xc607('0x39')](handleError(_0x4a32ba,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 33b9569..d06099a 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 _0x545c=['findAll','then','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map'];(function(_0x8b247d,_0x9401a9){var _0x4e10a3=function(_0x176b53){while(--_0x176b53){_0x8b247d['push'](_0x8b247d['shift']());}};_0x4e10a3(++_0x9401a9);}(_0x545c,0x80));var _0xc545=function(_0x30e004,_0x46f8c2){_0x30e004=_0x30e004-0x0;var _0x5ca247=_0x545c[_0x30e004];return _0x5ca247;};'use strict';var EventEmitter=require(_0xc545('0x0'));var ChatInteraction=require(_0xc545('0x1'))['db'][_0xc545('0x2')];var ChatMessage=require(_0xc545('0x1'))['db'][_0xc545('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc545('0x4')](0x0);var events={'afterCreate':_0xc545('0x5'),'afterUpdate':_0xc545('0x6'),'afterDestroy':_0xc545('0x7')};function emitEvent(_0x249064){return function(_0x5b5355,_0x556447,_0x281192){_0x5b5355[_0xc545('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2a1c56){_0x5b5355[_0xc545('0x9')](_0xc545('0xa'),_0x2a1c56[_0xc545('0xb')](function(_0x24bc50){return{'id':_0x24bc50['id']};}));return ChatMessage[_0xc545('0xc')]({'where':{'ChatInteractionId':_0x5b5355['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc545('0xd')](function(_0x1c3b98){_0x5b5355['setDataValue']('unreadMessages',_0x1c3b98[_0xc545('0xe')]);ChatInteractionEvents['emit'](_0x249064+':'+_0x5b5355['id'],_0x5b5355);ChatInteractionEvents[_0xc545('0xf')](_0x249064,_0x5b5355);_0x281192(null);})[_0xc545('0x10')](_0x281192(null));};}for(var e in events){if(events[_0xc545('0x11')](e)){var event=events[e];ChatInteraction[_0xc545('0x12')](e,emitEvent(event));}}module[_0xc545('0x13')]=ChatInteractionEvents; \ No newline at end of file +var _0xb5cd=['unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll'];(function(_0x218b1e,_0x484a36){var _0x9d23a2=function(_0x17c030){while(--_0x17c030){_0x218b1e['push'](_0x218b1e['shift']());}};_0x9d23a2(++_0x484a36);}(_0xb5cd,0x1a8));var _0xdb5c=function(_0x5309bb,_0x56195b){_0x5309bb=_0x5309bb-0x0;var _0x185cce=_0xb5cd[_0x5309bb];return _0x185cce;};'use strict';var EventEmitter=require(_0xdb5c('0x0'));var ChatInteraction=require(_0xdb5c('0x1'))['db'][_0xdb5c('0x2')];var ChatMessage=require(_0xdb5c('0x1'))['db'][_0xdb5c('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xdb5c('0x4')](0x0);var events={'afterCreate':_0xdb5c('0x5'),'afterUpdate':_0xdb5c('0x6'),'afterDestroy':_0xdb5c('0x7')};function emitEvent(_0x5734de){return function(_0x5ba81b,_0x427517,_0xee157e){_0x5ba81b[_0xdb5c('0x8')]({'attributes':['id'],'raw':!![]})[_0xdb5c('0x9')](function(_0x38fc24){_0x5ba81b[_0xdb5c('0xa')](_0xdb5c('0xb'),_0x38fc24['map'](function(_0x59c2a1){return{'id':_0x59c2a1['id']};}));return ChatMessage[_0xdb5c('0xc')]({'where':{'ChatInteractionId':_0x5ba81b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdb5c('0x9')](function(_0x170b29){_0x5ba81b[_0xdb5c('0xa')](_0xdb5c('0xd'),_0x170b29[_0xdb5c('0xe')]);ChatInteractionEvents[_0xdb5c('0xf')](_0x5734de+':'+_0x5ba81b['id'],_0x5ba81b);ChatInteractionEvents[_0xdb5c('0xf')](_0x5734de,_0x5ba81b);_0xee157e(null);})[_0xdb5c('0x10')](_0xee157e(null));};}for(var e in events){if(events[_0xdb5c('0x11')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xdb5c('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 9cb319e..6a7be3d 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 _0x94eb=['closedAt','format','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions'];(function(_0x1e8aa8,_0x2b9059){var _0x327768=function(_0x2a2572){while(--_0x2a2572){_0x1e8aa8['push'](_0x1e8aa8['shift']());}};_0x327768(++_0x2b9059);}(_0x94eb,0x86));var _0xb94e=function(_0x3abe59,_0x592d4e){_0x3abe59=_0x3abe59-0x0;var _0x2492ba=_0x94eb[_0x3abe59];return _0x2492ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb94e('0x0'))(_0xb94e('0x1'));var moment=require('moment');var BPromise=require(_0xb94e('0x2'));var rp=require(_0xb94e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb94e('0x4'));var config=require(_0xb94e('0x5'));var attributes=require(_0xb94e('0x6'));module[_0xb94e('0x7')]=function(_0x54b86f,_0x49525f){return _0x54b86f[_0xb94e('0x8')]('ChatInteraction',attributes,{'tableName':_0xb94e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x264de1,_0x3f6226,_0x5366c0){if(_0x264de1['changed']('closed')){_0x264de1[_0xb94e('0xa')]=moment()[_0xb94e('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5366c0(null,_0x264de1);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6279=['util','api','moment','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1a584c,_0x402f8b){var _0x5a312e=function(_0x2dfdd6){while(--_0x2dfdd6){_0x1a584c['push'](_0x1a584c['shift']());}};_0x5a312e(++_0x402f8b);}(_0x6279,0x11c));var _0x9627=function(_0xb3e53,_0x2583db){_0xb3e53=_0xb3e53-0x0;var _0x385233=_0x6279[_0xb3e53];return _0x385233;};'use strict';var _=require(_0x9627('0x0'));var util=require(_0x9627('0x1'));var logger=require('../../config/logger')(_0x9627('0x2'));var moment=require(_0x9627('0x3'));var BPromise=require(_0x9627('0x4'));var rp=require(_0x9627('0x5'));var fs=require('fs');var path=require(_0x9627('0x6'));var rimraf=require('rimraf');var config=require(_0x9627('0x7'));var attributes=require(_0x9627('0x8'));module[_0x9627('0x9')]=function(_0x14af99,_0x465c0d){return _0x14af99['define'](_0x9627('0xa'),attributes,{'tableName':_0x9627('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2c9bdf,_0x29c880,_0x5d23e8){if(_0x2c9bdf[_0x9627('0xc')](_0x9627('0xd'))){_0x2c9bdf[_0x9627('0xe')]=moment()[_0x9627('0xf')](_0x9627('0x10'));}_0x5d23e8(null,_0x2c9bdf);}},'charset':_0x9627('0x11'),'collate':_0x9627('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index c09c717..715153f 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 _0xa015=['request\x20sent','debug','stringify','error','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','limit','AddTagsToChatInteraction','find','addTags','omit','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','then','ChatInteraction,\x20%s,\x20%s'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0xa015,0x66));var _0x5a01=function(_0x4d817f,_0x414fa2){_0x4d817f=_0x4d817f-0x0;var _0x65cfa0=_0xa015[_0x4d817f];return _0x65cfa0;};'use strict';var _=require('lodash');var util=require(_0x5a01('0x0'));var moment=require(_0x5a01('0x1'));var BPromise=require('bluebird');var rs=require(_0x5a01('0x2'));var fs=require('fs');var Redis=require(_0x5a01('0x3'));var db=require(_0x5a01('0x4'))['db'];var utils=require(_0x5a01('0x5'));var logger=require(_0x5a01('0x6'))('rpc');var config=require(_0x5a01('0x7'));var jayson=require(_0x5a01('0x8'));var client=jayson[_0x5a01('0x9')][_0x5a01('0xa')]({'port':0x232a});config[_0x5a01('0xb')]=_['defaults'](config['redis'],{'host':_0x5a01('0xc'),'port':0x18eb});var socket=require(_0x5a01('0xd'))(new Redis(config[_0x5a01('0xb')]));require(_0x5a01('0xe'))['register'](socket);function respondWithRpcPromise(_0x5b2ba5,_0xe70104,_0x48a314){return new BPromise(function(_0x414ff9,_0x4b15e0){return client[_0x5a01('0xf')](_0x5b2ba5,_0x48a314)[_0x5a01('0x10')](function(_0x27a1b3){logger['info'](_0x5a01('0x11'),_0xe70104,_0x5a01('0x12'));logger[_0x5a01('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xe70104,'request\x20sent',JSON[_0x5a01('0x14')](_0x27a1b3));if(_0x27a1b3[_0x5a01('0x15')]){if(_0x27a1b3[_0x5a01('0x15')]['code']===0x1f4){logger[_0x5a01('0x15')]('ChatInteraction,\x20%s,\x20%s',_0xe70104,_0x27a1b3[_0x5a01('0x15')]['message']);return _0x4b15e0(_0x27a1b3[_0x5a01('0x15')][_0x5a01('0x16')]);}logger['error'](_0x5a01('0x11'),_0xe70104,_0x27a1b3[_0x5a01('0x15')][_0x5a01('0x16')]);return _0x414ff9(_0x27a1b3['error'][_0x5a01('0x16')]);}else{logger[_0x5a01('0x17')]('ChatInteraction,\x20%s,\x20%s',_0xe70104,_0x5a01('0x12'));_0x414ff9(_0x27a1b3[_0x5a01('0x18')][_0x5a01('0x16')]);}})[_0x5a01('0x19')](function(_0x4bf128){logger[_0x5a01('0x15')](_0x5a01('0x11'),_0xe70104,_0x4bf128);_0x4b15e0(_0x4bf128);});});}exports[_0x5a01('0x1a')]=function(_0x40c653){var _0x14f795=this;return new Promise(function(_0x3edcb2,_0x3edbc5){return db[_0x5a01('0x1b')][_0x5a01('0x1c')](_0x40c653[_0x5a01('0x1d')],{'raw':_0x40c653[_0x5a01('0x1e')]?_0x40c653[_0x5a01('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40c653[_0x5a01('0x1e')]?_0x40c653['options'][_0x5a01('0x1f')]||null:null,'attributes':_0x40c653[_0x5a01('0x1e')]?_0x40c653['options'][_0x5a01('0x20')]||null:null,'limit':_0x40c653[_0x5a01('0x1e')]?_0x40c653['options'][_0x5a01('0x21')]||null:null})[_0x5a01('0x10')](function(_0x4b2eeb){logger['info'](_0x5a01('0x1a'),_0x40c653);logger['debug']('UpdateChatInteraction',_0x40c653,JSON['stringify'](_0x4b2eeb));_0x3edcb2(_0x4b2eeb);})['catch'](function(_0x1d6396){logger[_0x5a01('0x15')](_0x5a01('0x1a'),_0x1d6396[_0x5a01('0x16')],_0x40c653);_0x3edbc5(_0x14f795[_0x5a01('0x15')](0x1f4,_0x1d6396['message']));});});};exports[_0x5a01('0x22')]=function(_0xb0602f){return new Promise(function(_0xbe41a5,_0x428051){return db[_0x5a01('0x1b')][_0x5a01('0x23')]({'where':_0xb0602f[_0x5a01('0x1e')]?_0xb0602f[_0x5a01('0x1e')][_0x5a01('0x1f')]||null:null})[_0x5a01('0x10')](function(_0x3de295){if(_0x3de295){return _0x3de295[_0x5a01('0x24')](_0xb0602f[_0x5a01('0x1d')]['ids'],_[_0x5a01('0x25')](_0xb0602f['body'],['ids','id'])||{});}})[_0x5a01('0x26')](function(_0x5236fe){logger[_0x5a01('0x17')]('AddTags',_0xb0602f);logger['debug']('AddTags',_0xb0602f,JSON[_0x5a01('0x14')](_0x5236fe));_0xbe41a5(_0x5236fe);})[_0x5a01('0x19')](function(_0x398c2b){logger[_0x5a01('0x15')](_0x5a01('0x27'),_0x398c2b[_0x5a01('0x16')],_0xb0602f);_0x428051(_this[_0x5a01('0x15')](0x1f4,_0x398c2b['message']));});});}; \ No newline at end of file +var _0x7f6b=['UpdateChatInteraction','AddTagsToChatInteraction','ChatInteraction','addTags','ids','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','body','options','where','attributes'];(function(_0x184759,_0x1cc38a){var _0xf26d5f=function(_0x1010c8){while(--_0x1010c8){_0x184759['push'](_0x184759['shift']());}};_0xf26d5f(++_0x1cc38a);}(_0x7f6b,0x126));var _0xb7f6=function(_0x252b41,_0x431285){_0x252b41=_0x252b41-0x0;var _0x313620=_0x7f6b[_0x252b41];return _0x313620;};'use strict';var _=require(_0xb7f6('0x0'));var util=require('util');var moment=require(_0xb7f6('0x1'));var BPromise=require(_0xb7f6('0x2'));var rs=require(_0xb7f6('0x3'));var fs=require('fs');var Redis=require(_0xb7f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb7f6('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb7f6('0x6'));var client=jayson[_0xb7f6('0x7')][_0xb7f6('0x8')]({'port':0x232a});config[_0xb7f6('0x9')]=_[_0xb7f6('0xa')](config['redis'],{'host':_0xb7f6('0xb'),'port':0x18eb});var socket=require(_0xb7f6('0xc'))(new Redis(config[_0xb7f6('0x9')]));require('./chatInteraction.socket')[_0xb7f6('0xd')](socket);function respondWithRpcPromise(_0xfca5a0,_0x1ef391,_0x55fdb6){return new BPromise(function(_0x352101,_0x5293cf){return client[_0xb7f6('0xe')](_0xfca5a0,_0x55fdb6)[_0xb7f6('0xf')](function(_0x15dcc7){logger['info'](_0xb7f6('0x10'),_0x1ef391,_0xb7f6('0x11'));logger[_0xb7f6('0x12')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1ef391,_0xb7f6('0x11'),JSON[_0xb7f6('0x13')](_0x15dcc7));if(_0x15dcc7['error']){if(_0x15dcc7[_0xb7f6('0x14')][_0xb7f6('0x15')]===0x1f4){logger[_0xb7f6('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x1ef391,_0x15dcc7['error'][_0xb7f6('0x16')]);return _0x5293cf(_0x15dcc7[_0xb7f6('0x14')][_0xb7f6('0x16')]);}logger[_0xb7f6('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x1ef391,_0x15dcc7[_0xb7f6('0x14')]['message']);return _0x352101(_0x15dcc7['error']['message']);}else{logger[_0xb7f6('0x17')](_0xb7f6('0x10'),_0x1ef391,_0xb7f6('0x11'));_0x352101(_0x15dcc7[_0xb7f6('0x18')][_0xb7f6('0x16')]);}})[_0xb7f6('0x19')](function(_0x600a9d){logger['error'](_0xb7f6('0x10'),_0x1ef391,_0x600a9d);_0x5293cf(_0x600a9d);});});}exports['UpdateChatInteraction']=function(_0x3401b2){var _0x4294c5=this;return new Promise(function(_0x5bb10d,_0xa8ecf8){return db['ChatInteraction']['update'](_0x3401b2[_0xb7f6('0x1a')],{'raw':_0x3401b2[_0xb7f6('0x1b')]?_0x3401b2[_0xb7f6('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3401b2[_0xb7f6('0x1b')]?_0x3401b2[_0xb7f6('0x1b')][_0xb7f6('0x1c')]||null:null,'attributes':_0x3401b2[_0xb7f6('0x1b')]?_0x3401b2['options'][_0xb7f6('0x1d')]||null:null,'limit':_0x3401b2['options']?_0x3401b2['options']['limit']||null:null})[_0xb7f6('0xf')](function(_0x523cf8){logger['info'](_0xb7f6('0x1e'),_0x3401b2);logger[_0xb7f6('0x12')]('UpdateChatInteraction',_0x3401b2,JSON[_0xb7f6('0x13')](_0x523cf8));_0x5bb10d(_0x523cf8);})[_0xb7f6('0x19')](function(_0x2ac791){logger[_0xb7f6('0x14')](_0xb7f6('0x1e'),_0x2ac791[_0xb7f6('0x16')],_0x3401b2);_0xa8ecf8(_0x4294c5['error'](0x1f4,_0x2ac791[_0xb7f6('0x16')]));});});};exports[_0xb7f6('0x1f')]=function(_0x34ac9d){return new Promise(function(_0x4d19d0,_0x35151f){return db[_0xb7f6('0x20')]['find']({'where':_0x34ac9d[_0xb7f6('0x1b')]?_0x34ac9d[_0xb7f6('0x1b')][_0xb7f6('0x1c')]||null:null})['then'](function(_0x74e7dd){if(_0x74e7dd){return _0x74e7dd[_0xb7f6('0x21')](_0x34ac9d[_0xb7f6('0x1a')][_0xb7f6('0x22')],_['omit'](_0x34ac9d[_0xb7f6('0x1a')],[_0xb7f6('0x22'),'id'])||{});}})['spread'](function(_0x104ff5){logger[_0xb7f6('0x17')](_0xb7f6('0x23'),_0x34ac9d);logger['debug'](_0xb7f6('0x23'),_0x34ac9d,JSON[_0xb7f6('0x13')](_0x104ff5));_0x4d19d0(_0x104ff5);})[_0xb7f6('0x19')](function(_0x135b3f){logger['error']('AddTags',_0x135b3f[_0xb7f6('0x16')],_0x34ac9d);_0x35151f(_this[_0xb7f6('0x14')](0x1f4,_0x135b3f['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index d2db4bd..eb8b265 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 _0xf5ed=['remove','update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x4777ae,_0x557fd2){var _0x2f12b9=function(_0x4b9a26){while(--_0x4b9a26){_0x4777ae['push'](_0x4777ae['shift']());}};_0x2f12b9(++_0x557fd2);}(_0xf5ed,0x154));var _0xdf5e=function(_0x15dd28,_0x2fd167){_0x15dd28=_0x15dd28-0x0;var _0x3c2a16=_0xf5ed[_0x15dd28];return _0x3c2a16;};'use strict';var ChatInteractionEvents=require(_0xdf5e('0x0'));var events=[_0xdf5e('0x1'),_0xdf5e('0x2'),_0xdf5e('0x3')];function createListener(_0x5e238c,_0x544c31){return function(_0x1f3a7b){_0x544c31[_0xdf5e('0x4')](_0x5e238c,_0x1f3a7b);};}function removeListener(_0x3d9f7f,_0x3989aa){return function(){ChatInteractionEvents[_0xdf5e('0x5')](_0x3d9f7f,_0x3989aa);};}exports[_0xdf5e('0x6')]=function(_0x1f666b){for(var _0x3eb9fc=0x0,_0x289d41=events[_0xdf5e('0x7')];_0x3eb9fc<_0x289d41;_0x3eb9fc++){var _0x5d29a8=events[_0x3eb9fc];var _0x3ff12b=createListener(_0xdf5e('0x8')+_0x5d29a8,_0x1f666b);ChatInteractionEvents['on'](_0x5d29a8,_0x3ff12b);}}; \ No newline at end of file +var _0x1e9c=['chatInteraction:','./chatInteraction.events','update','removeListener','length'];(function(_0x378b55,_0x5f43e6){var _0x41badb=function(_0x545588){while(--_0x545588){_0x378b55['push'](_0x378b55['shift']());}};_0x41badb(++_0x5f43e6);}(_0x1e9c,0xec));var _0xc1e9=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x1e9c[_0x344a3f];return _0x264712;};'use strict';var ChatInteractionEvents=require(_0xc1e9('0x0'));var events=['save','remove',_0xc1e9('0x1')];function createListener(_0x197ca8,_0x56a92e){return function(_0xe39c69){_0x56a92e['emit'](_0x197ca8,_0xe39c69);};}function removeListener(_0x3f5ed7,_0xfa9db1){return function(){ChatInteractionEvents[_0xc1e9('0x2')](_0x3f5ed7,_0xfa9db1);};}exports['register']=function(_0x185cac){for(var _0x2387a9=0x0,_0x14d042=events[_0xc1e9('0x3')];_0x2387a9<_0x14d042;_0x2387a9++){var _0x2491a7=events[_0x2387a9];var _0x4ad7d5=createListener(_0xc1e9('0x4')+_0x2491a7,_0x185cac);ChatInteractionEvents['on'](_0x2491a7,_0x4ad7d5);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 00f3809..fe2a608 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 _0x7e47=['describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','%s-%s','now','originalname','replace','attachmentUpload','addMessage','/:id/tags','tracked','addTags','put','chat','chatinteraction:update','update','customUpdate','/:id/abandon','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index'];(function(_0x5347c9,_0x399981){var _0x2b3980=function(_0x447f64){while(--_0x447f64){_0x5347c9['push'](_0x5347c9['shift']());}};_0x2b3980(++_0x399981);}(_0x7e47,0x110));var _0x77e4=function(_0x20372a,_0x5636bd){_0x20372a=_0x20372a-0x0;var _0x28653b=_0x7e47[_0x20372a];return _0x28653b;};'use strict';var multer=require(_0x77e4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x77e4('0x1'));var express=require('express');var router=express[_0x77e4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x77e4('0x3'));var interaction=require(_0x77e4('0x4'));var config=require(_0x77e4('0x5'));var controller=require(_0x77e4('0x6'));router[_0x77e4('0x7')]('/',auth[_0x77e4('0x8')](),controller[_0x77e4('0x9')]);router[_0x77e4('0x7')]('/describe',auth[_0x77e4('0x8')](),controller[_0x77e4('0xa')]);router[_0x77e4('0x7')](_0x77e4('0xb'),auth[_0x77e4('0xc')](),controller['show']);router[_0x77e4('0x7')](_0x77e4('0xd'),auth[_0x77e4('0xc')](),controller[_0x77e4('0xe')]);router[_0x77e4('0x7')](_0x77e4('0xf'),auth[_0x77e4('0x8')](),controller[_0x77e4('0x10')]);router[_0x77e4('0x7')](_0x77e4('0x11'),auth[_0x77e4('0xc')](),controller[_0x77e4('0x12')]);router[_0x77e4('0x7')]('/:id/download',auth[_0x77e4('0x8')](),controller[_0x77e4('0x13')]);router[_0x77e4('0x14')]('/',auth[_0x77e4('0x8')](),controller[_0x77e4('0x15')]);router[_0x77e4('0x14')](_0x77e4('0x16'),auth[_0x77e4('0x8')](),controller[_0x77e4('0x17')]);var upload=multer({'storage':multer[_0x77e4('0x18')]({'destination':function(_0x2a0eae,_0xc8e8f0,_0x5f128f){_0x5f128f(null,path['join'](config[_0x77e4('0x19')],_0x77e4('0x1a')));},'filename':function(_0x39c57d,_0x335e47,_0x4f8cc2){_0x4f8cc2(null,util['format'](_0x77e4('0x1b'),Date[_0x77e4('0x1c')](),_0x335e47[_0x77e4('0x1d')][_0x77e4('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x77e4('0x14')]('/:id/attachment_upload',upload['single']('file'),controller[_0x77e4('0x1f')]);router[_0x77e4('0x14')](_0x77e4('0xf'),auth[_0x77e4('0xc')](),controller[_0x77e4('0x20')]);router[_0x77e4('0x14')](_0x77e4('0x21'),auth['isAuthenticated'](),interaction[_0x77e4('0x22')]('chat','chatinteraction:addtags'),controller[_0x77e4('0x23')]);router[_0x77e4('0x24')](_0x77e4('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x77e4('0x25'),_0x77e4('0x26')),controller[_0x77e4('0x27')]);router['put']('/:id/custom_update',controller[_0x77e4('0x28')]);router[_0x77e4('0x24')](_0x77e4('0x29'),auth[_0x77e4('0xc')](),controller['abandon']);router[_0x77e4('0x24')]('/:id/close',controller['close']);router[_0x77e4('0x2a')](_0x77e4('0xb'),auth[_0x77e4('0x8')](),interaction[_0x77e4('0x22')]('chat',_0x77e4('0x2b')),controller[_0x77e4('0x2c')]);router[_0x77e4('0x2a')](_0x77e4('0x21'),auth[_0x77e4('0x8')](),controller[_0x77e4('0x2d')]);module[_0x77e4('0x2e')]=router; \ No newline at end of file +var _0xabec=['/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','download','post','create','createVidaooSession','diskStorage','join','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','single','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','update','put','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized'];(function(_0x51dd8b,_0x326222){var _0x11cc3d=function(_0x2f1138){while(--_0x2f1138){_0x51dd8b['push'](_0x51dd8b['shift']());}};_0x11cc3d(++_0x326222);}(_0xabec,0x16b));var _0xcabe=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0xabec[_0xf04c6d];return _0x4a804e;};'use strict';var multer=require(_0xcabe('0x0'));var util=require(_0xcabe('0x1'));var path=require(_0xcabe('0x2'));var timeout=require(_0xcabe('0x3'));var express=require('express');var router=express[_0xcabe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcabe('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcabe('0x6'));router[_0xcabe('0x7')]('/',auth[_0xcabe('0x8')](),controller[_0xcabe('0x9')]);router[_0xcabe('0x7')]('/describe',auth[_0xcabe('0x8')](),controller[_0xcabe('0xa')]);router[_0xcabe('0x7')](_0xcabe('0xb'),auth[_0xcabe('0xc')](),controller['show']);router[_0xcabe('0x7')](_0xcabe('0xd'),auth[_0xcabe('0xc')](),controller[_0xcabe('0xe')]);router['get'](_0xcabe('0xf'),auth[_0xcabe('0x8')](),controller[_0xcabe('0x10')]);router['get'](_0xcabe('0x11'),auth[_0xcabe('0xc')](),controller['getMyMessages']);router[_0xcabe('0x7')]('/:id/download',auth[_0xcabe('0x8')](),controller[_0xcabe('0x12')]);router[_0xcabe('0x13')]('/',auth[_0xcabe('0x8')](),controller[_0xcabe('0x14')]);router['post']('/:id/vidaoo',auth[_0xcabe('0x8')](),controller[_0xcabe('0x15')]);var upload=multer({'storage':multer[_0xcabe('0x16')]({'destination':function(_0x2736d2,_0x1abc24,_0x5046f9){_0x5046f9(null,path[_0xcabe('0x17')](config['root'],_0xcabe('0x18')));},'filename':function(_0x15dad9,_0x3ed021,_0x45c331){_0x45c331(null,util[_0xcabe('0x19')](_0xcabe('0x1a'),Date['now'](),_0x3ed021[_0xcabe('0x1b')][_0xcabe('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xcabe('0x13')](_0xcabe('0x1d'),upload[_0xcabe('0x1e')](_0xcabe('0x1f')),controller['attachmentUpload']);router['post'](_0xcabe('0xf'),auth[_0xcabe('0xc')](),controller[_0xcabe('0x20')]);router[_0xcabe('0x13')](_0xcabe('0x21'),auth[_0xcabe('0x8')](),interaction[_0xcabe('0x22')](_0xcabe('0x23'),_0xcabe('0x24')),controller[_0xcabe('0x25')]);router['put'](_0xcabe('0xb'),auth[_0xcabe('0x8')](),interaction[_0xcabe('0x22')]('chat','chatinteraction:update'),controller[_0xcabe('0x26')]);router[_0xcabe('0x27')](_0xcabe('0x28'),controller[_0xcabe('0x29')]);router['put']('/:id/abandon',auth[_0xcabe('0xc')](),controller[_0xcabe('0x2a')]);router[_0xcabe('0x27')](_0xcabe('0x2b'),controller[_0xcabe('0x2c')]);router[_0xcabe('0x2d')](_0xcabe('0xb'),auth['isAuthenticated'](),interaction[_0xcabe('0x22')](_0xcabe('0x23'),'chatinteraction:destroy'),controller['destroy']);router['delete'](_0xcabe('0x21'),auth[_0xcabe('0x8')](),controller['removeTags']);module[_0xcabe('0x2e')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index fd02123..2f554c4 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 _0x6129=['INTEGER','medium','BOOLEAN'];(function(_0x5018ed,_0x5adc7c){var _0x137df7=function(_0x565d94){while(--_0x565d94){_0x5018ed['push'](_0x5018ed['shift']());}};_0x137df7(++_0x5adc7c);}(_0x6129,0x1c3));var _0x9612=function(_0x3c51af,_0x1991ce){_0x3c51af=_0x3c51af-0x0;var _0xeb10d9=_0x6129[_0x3c51af];return _0xeb10d9;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x9612('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x9612('0x1')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x9612('0x2')]}}; \ No newline at end of file +var _0x50d6=['medium','BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x50d6,0x1dd));var _0x650d=function(_0x4a08f5,_0x29f8b0){_0x4a08f5=_0x4a08f5-0x0;var _0x4f2cd6=_0x50d6[_0x4a08f5];return _0x4f2cd6;};'use strict';var Sequelize=require(_0x650d('0x0'));module[_0x650d('0x1')]={'body':{'type':Sequelize[_0x650d('0x2')](_0x650d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x650d('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x650d('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 1a4452f..8a0361b 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 _0x83ba=['then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','include','rows','catch','show','includeAll','options','find','create','body','params','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','findAll','agent','user','role','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update'];(function(_0x297d70,_0x39c7a6){var _0x5ada9e=function(_0x23b8c0){while(--_0x23b8c0){_0x297d70['push'](_0x297d70['shift']());}};_0x5ada9e(++_0x39c7a6);}(_0x83ba,0x129));var _0xa83b=function(_0x6f6680,_0x57dcc6){_0x6f6680=_0x6f6680-0x0;var _0x15e6af=_0x83ba[_0x6f6680];return _0x15e6af;};'use strict';var emlformat=require(_0xa83b('0x0'));var rimraf=require(_0xa83b('0x1'));var zipdir=require(_0xa83b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa83b('0x3'));var moment=require(_0xa83b('0x4'));var BPromise=require(_0xa83b('0x5'));var Mustache=require('mustache');var util=require(_0xa83b('0x6'));var path=require(_0xa83b('0x7'));var sox=require(_0xa83b('0x8'));var csv=require(_0xa83b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa83b('0xa'));var _=require(_0xa83b('0xb'));var squel=require(_0xa83b('0xc'));var crypto=require(_0xa83b('0xd'));var jsforce=require(_0xa83b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa83b('0x9'));var querystring=require(_0xa83b('0xf'));var Papa=require(_0xa83b('0x10'));var Redis=require(_0xa83b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa83b('0x12'));var as=require(_0xa83b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa83b('0x14'));var config=require(_0xa83b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa83b('0x16'))['db'];config[_0xa83b('0x17')]=_[_0xa83b('0x18')](config[_0xa83b('0x17')],{'host':_0xa83b('0x19'),'port':0x18eb});var socket=require(_0xa83b('0x1a'))(new Redis(config[_0xa83b('0x17')]));require(_0xa83b('0x1b'))[_0xa83b('0x1c')](socket);function respondWithStatusCode(_0x214eb5,_0x19693f){_0x19693f=_0x19693f||0xcc;return function(_0x46e388){if(_0x46e388){return _0x214eb5[_0xa83b('0x1d')](_0x19693f);}return _0x214eb5['status'](_0x19693f)['end']();};}function respondWithResult(_0x5d8705,_0x399506){_0x399506=_0x399506||0xc8;return function(_0x1b1989){if(_0x1b1989){return _0x5d8705[_0xa83b('0x1e')](_0x399506)['json'](_0x1b1989);}};}function respondWithFilteredResult(_0x27df5f,_0x7fb44b){return function(_0x594ddc){if(_0x594ddc){var _0x392202=typeof _0x7fb44b[_0xa83b('0x1f')]===_0xa83b('0x20')&&typeof _0x7fb44b[_0xa83b('0x21')]===_0xa83b('0x20');var _0x32f0bd=_0x594ddc[_0xa83b('0x22')];var _0x2590e0=_0x392202?0x0:_0x7fb44b['offset'];var _0x1a31b1=_0x392202?_0x594ddc['count']:_0x7fb44b['offset']+_0x7fb44b[_0xa83b('0x21')];var _0xf7ef30;if(_0x1a31b1>=_0x32f0bd){_0x1a31b1=_0x32f0bd;_0xf7ef30=0xc8;}else{_0xf7ef30=0xce;}_0x27df5f['status'](_0xf7ef30);return _0x27df5f[_0xa83b('0x23')](_0xa83b('0x24'),_0x2590e0+'-'+_0x1a31b1+'/'+_0x32f0bd)[_0xa83b('0x25')](_0x594ddc);}return null;};}function patchUpdates(_0x1db196){return function(_0x5d126b){try{jsonpatch[_0xa83b('0x26')](_0x5d126b,_0x1db196,!![]);}catch(_0x1513ae){return BPromise[_0xa83b('0x27')](_0x1513ae);}return _0x5d126b[_0xa83b('0x28')]();};}function saveUpdates(_0x5b7438,_0x543bd5){return function(_0x5802bc){if(_0x5802bc){return _0x5802bc[_0xa83b('0x29')](_0x5b7438)[_0xa83b('0x2a')](function(_0x33f7e2){return _0x33f7e2;});}return null;};}function removeEntity(_0x2772a6,_0x2b6dec){return function(_0x425d27){if(_0x425d27){return _0x425d27[_0xa83b('0x2b')]()['then'](function(){_0x2772a6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x67d83b,_0x2cfdf1){return function(_0x5d22c2){if(!_0x5d22c2){_0x67d83b[_0xa83b('0x1d')](0x194);}return _0x5d22c2;};}function handleError(_0x4f68cf,_0x48e3b0){_0x48e3b0=_0x48e3b0||0x1f4;return function(_0x2d51b3){logger[_0xa83b('0x2c')](_0x2d51b3[_0xa83b('0x2d')]);if(_0x2d51b3[_0xa83b('0x2e')]){delete _0x2d51b3[_0xa83b('0x2e')];}_0x4f68cf['status'](_0x48e3b0)[_0xa83b('0x2f')](_0x2d51b3);};}exports[_0xa83b('0x30')]=function(_0x59ed4b,_0x561bce){var _0x48101e={},_0x12d808={},_0x11b7d4={'count':0x0,'rows':[]};var _0x37b61b=_[_0xa83b('0x31')](db[_0xa83b('0x32')][_0xa83b('0x33')],function(_0x498207){return{'name':_0x498207['fieldName'],'type':_0x498207['type'][_0xa83b('0x34')]};});_0x12d808[_0xa83b('0x35')]=_[_0xa83b('0x31')](_0x37b61b,'name');_0x12d808[_0xa83b('0x36')]=_[_0xa83b('0x37')](_0x59ed4b[_0xa83b('0x36')]);_0x12d808['filters']=_['intersection'](_0x12d808['model'],_0x12d808['query']);_0x48101e[_0xa83b('0x38')]=_[_0xa83b('0x39')](_0x12d808[_0xa83b('0x35')],qs['fields'](_0x59ed4b[_0xa83b('0x36')][_0xa83b('0x3a')]));_0x48101e[_0xa83b('0x38')]=_0x48101e[_0xa83b('0x38')][_0xa83b('0x3b')]?_0x48101e['attributes']:_0x12d808[_0xa83b('0x35')];if(!_0x59ed4b['query'][_0xa83b('0x3c')](_0xa83b('0x3d'))){_0x48101e[_0xa83b('0x21')]=qs[_0xa83b('0x21')](_0x59ed4b[_0xa83b('0x36')][_0xa83b('0x21')]);_0x48101e[_0xa83b('0x1f')]=qs['offset'](_0x59ed4b[_0xa83b('0x36')][_0xa83b('0x1f')]);}_0x48101e[_0xa83b('0x3e')]=qs['sort'](_0x59ed4b[_0xa83b('0x36')][_0xa83b('0x3f')]);_0x48101e[_0xa83b('0x40')]=qs[_0xa83b('0x41')](_[_0xa83b('0x42')](_0x59ed4b[_0xa83b('0x36')],_0x12d808[_0xa83b('0x41')]),_0x37b61b);if(_0x59ed4b[_0xa83b('0x36')]['filter']){_0x48101e[_0xa83b('0x40')]=_['merge'](_0x48101e[_0xa83b('0x40')],{'$or':_[_0xa83b('0x31')](_0x37b61b,function(_0x474104){if(_0x474104[_0xa83b('0x43')]!==_0xa83b('0x44')){var _0x43fff2={};_0x43fff2[_0x474104['name']]={'$like':'%'+_0x59ed4b[_0xa83b('0x36')][_0xa83b('0x45')]+'%'};return _0x43fff2;}})});}_0x48101e=_[_0xa83b('0x46')]({},_0x48101e,_0x59ed4b['options']);var _0x2ea549={'where':_0x48101e['where']};return db['ChatInternalMessage']['count'](_0x2ea549)[_0xa83b('0x2a')](function(_0xb8d90b){_0x11b7d4['count']=_0xb8d90b;if(_0x59ed4b[_0xa83b('0x36')]['includeAll']){_0x48101e[_0xa83b('0x47')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x48101e);})[_0xa83b('0x2a')](function(_0x19584b){_0x11b7d4[_0xa83b('0x48')]=_0x19584b;return _0x11b7d4;})[_0xa83b('0x2a')](respondWithFilteredResult(_0x561bce,_0x48101e))[_0xa83b('0x49')](handleError(_0x561bce,null));};exports[_0xa83b('0x4a')]=function(_0x1ae5c6,_0x40be33){var _0x347cb5={'raw':!![],'where':{'id':_0x1ae5c6['params']['id']}},_0x3fa3d0={};_0x3fa3d0[_0xa83b('0x35')]=_[_0xa83b('0x37')](db['ChatInternalMessage'][_0xa83b('0x33')]);_0x3fa3d0[_0xa83b('0x36')]=_[_0xa83b('0x37')](_0x1ae5c6[_0xa83b('0x36')]);_0x3fa3d0[_0xa83b('0x41')]=_[_0xa83b('0x39')](_0x3fa3d0[_0xa83b('0x35')],_0x3fa3d0[_0xa83b('0x36')]);_0x347cb5['attributes']=_[_0xa83b('0x39')](_0x3fa3d0[_0xa83b('0x35')],qs['fields'](_0x1ae5c6[_0xa83b('0x36')]['fields']));_0x347cb5[_0xa83b('0x38')]=_0x347cb5[_0xa83b('0x38')][_0xa83b('0x3b')]?_0x347cb5[_0xa83b('0x38')]:_0x3fa3d0['model'];if(_0x1ae5c6[_0xa83b('0x36')][_0xa83b('0x4b')]){_0x347cb5[_0xa83b('0x47')]=[{'all':!![]}];}_0x347cb5=_[_0xa83b('0x46')]({},_0x347cb5,_0x1ae5c6[_0xa83b('0x4c')]);return db[_0xa83b('0x32')][_0xa83b('0x4d')](_0x347cb5)['then'](handleEntityNotFound(_0x40be33,null))[_0xa83b('0x2a')](respondWithResult(_0x40be33,null))[_0xa83b('0x49')](handleError(_0x40be33,null));};exports[_0xa83b('0x4e')]=function(_0x4e61bb,_0x95132a){return db[_0xa83b('0x32')]['create'](_0x4e61bb[_0xa83b('0x4f')],{})[_0xa83b('0x2a')](respondWithResult(_0x95132a,0xc9))[_0xa83b('0x49')](handleError(_0x95132a,null));};exports[_0xa83b('0x29')]=function(_0x1a2245,_0x1b75cc){if(_0x1a2245['body']['id']){delete _0x1a2245['body']['id'];}return db[_0xa83b('0x32')][_0xa83b('0x4d')]({'where':{'id':_0x1a2245[_0xa83b('0x50')]['id']}})[_0xa83b('0x2a')](handleEntityNotFound(_0x1b75cc,null))[_0xa83b('0x2a')](saveUpdates(_0x1a2245[_0xa83b('0x4f')],null))[_0xa83b('0x2a')](respondWithResult(_0x1b75cc,null))[_0xa83b('0x49')](handleError(_0x1b75cc,null));};exports[_0xa83b('0x2b')]=function(_0x479675,_0x45c967){return db['ChatInternalMessage'][_0xa83b('0x4d')]({'where':{'id':_0x479675[_0xa83b('0x50')]['id']}})[_0xa83b('0x2a')](handleEntityNotFound(_0x45c967,null))[_0xa83b('0x2a')](removeEntity(_0x45c967,null))['catch'](handleError(_0x45c967,null));};exports[_0xa83b('0x51')]=function(_0x75f45f,_0x316b38){return db[_0xa83b('0x32')][_0xa83b('0x51')]()[_0xa83b('0x2a')](respondWithResult(_0x316b38,null))[_0xa83b('0x49')](handleError(_0x316b38,null));};function wrapUser(_0x247628){return function(_0x47a7de){var _0x47498c=_0x247628[_0xa83b('0x52')]({'plain':!![]});_0x47498c[_0xa83b('0x53')]=[];if(_0x47a7de){_0x47498c[_0xa83b('0x54')]=_0x47a7de['createdAt'];_0x47498c[_0xa83b('0x55')]=_0x47a7de;}else{_0x47498c[_0xa83b('0x54')]=moment(0x0)[_0xa83b('0x56')](_0xa83b('0x57'));_0x47498c[_0xa83b('0x55')]={};}return _0x47498c;};}exports[_0xa83b('0x58')]=function(_0x582511,_0x27e707,_0x3cfcc1){var _0x3ab199=[];return db['User'][_0xa83b('0x59')]({'where':{'role':[_0xa83b('0x5a'),'admin',_0xa83b('0x5b')]},'attributes':['id','fullname',_0xa83b('0x2e'),_0xa83b('0x5c'),'userpic','internal','online',_0xa83b('0x5d'),_0xa83b('0x5e'),_0xa83b('0x5f')],'order':qs['sort']('-online'),'include':[{'model':db[_0xa83b('0x60')],'as':_0xa83b('0x61'),'attributes':['id',_0xa83b('0x2e'),_0xa83b('0x43')],'through':{'attributes':[]}}]})[_0xa83b('0x2a')](function(_0x5ee640){if(_0x5ee640){var _0x40fd0a=_0x582511[_0xa83b('0x5b')][_0xa83b('0x52')]({'plain':!![]});if(!_0x40fd0a)throw new Error(_0xa83b('0x62'));if(_0x40fd0a[_0xa83b('0x5c')]===_0xa83b('0x5b')){return db[_0xa83b('0x63')][_0xa83b('0x4d')]({'where':{'name':_0xa83b('0x64'),'userProfileId':_0x40fd0a[_0xa83b('0x65')]},'raw':!![]})[_0xa83b('0x2a')](function(_0x1ba915){if(_0x1ba915){if(_0x1ba915[_0xa83b('0x66')]===0x0){return db[_0xa83b('0x67')][_0xa83b('0x59')]({'where':{'sectionId':_0x1ba915['id']},'raw':!![]})[_0xa83b('0x2a')](function(_0x4f9b98){var _0x43b5ae=[];if(_[_0xa83b('0x68')](_0x4f9b98)){_0x43b5ae=_[_0xa83b('0x45')](_0x5ee640,function(_0x4ab9e1){if(_0x4ab9e1[_0xa83b('0x5c')]!=='agent'){return _0x4ab9e1;}});return _0x43b5ae;}else{for(var _0x24a34f=0x0;_0x24a34f<_0x5ee640[_0xa83b('0x3b')];_0x24a34f++){var _0xca9ccd=_0x5ee640[_0x24a34f];if(_0xca9ccd[_0xa83b('0x5c')]===_0xa83b('0x5a')){var _0xb69c5f=_[_0xa83b('0x4d')](_0x4f9b98,function(_0x3c9796){return _0x3c9796[_0xa83b('0x69')]===_0xca9ccd['id'];});if(_0xb69c5f)_0x43b5ae['push'](_0xca9ccd);}else{_0x43b5ae[_0xa83b('0x6a')](_0xca9ccd);}}return _0x43b5ae;}});}else{return _0x5ee640;}}else{var _0x5707ef=_[_0xa83b('0x45')](_0x5ee640,function(_0x38679b){if(_0x38679b['role']!==_0xa83b('0x5a')){return _0x38679b;}});return _0x5707ef;}});}else{return _0x5ee640;}}})[_0xa83b('0x2a')](function(_0x34a5e1){var _0x327b70=[];if(_0x34a5e1){_0x3ab199=_0x34a5e1;for(var _0x2fe192=0x0;_0x2fe192<_0x34a5e1[_0xa83b('0x3b')];_0x2fe192+=0x1){_0x3ab199[_0x2fe192]['messages']=[];_0x327b70['push'](db[_0xa83b('0x32')][_0xa83b('0x4d')]({'where':{'FromId':[_0x582511[_0xa83b('0x5b')]['id'],_0x34a5e1[_0x2fe192]['id']],'ToId':[_0x582511[_0xa83b('0x5b')]['id'],_0x34a5e1[_0x2fe192]['id']],'ChatGroupId':null},'attributes':['id',_0xa83b('0x6b'),_0xa83b('0x6c'),_0xa83b('0x6d'),_0xa83b('0x6e'),_0xa83b('0x4f')],'order':qs[_0xa83b('0x3f')](_0xa83b('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x34a5e1[_0x2fe192])));}return BPromise[_0xa83b('0x70')](_0x327b70);}return[];})[_0xa83b('0x2a')](function(_0x4dc7ae){return{'rows':_0x4dc7ae,'count':_0x4dc7ae['length']};})[_0xa83b('0x2a')](respondWithResult(_0x27e707,null))['catch'](handleError(_0x27e707,null));}; \ No newline at end of file +var _0x13ef=['fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','rows','catch','length','include','options','find','create','body','update','params','destroy','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','findAll','agent','admin','fullname','role','userpic','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','push','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x242a4f,_0x369c57){var _0x122117=function(_0x55a797){while(--_0x55a797){_0x242a4f['push'](_0x242a4f['shift']());}};_0x122117(++_0x369c57);}(_0x13ef,0x67));var _0xf13e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x13ef[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0xf13e('0x0'));var rimraf=require(_0xf13e('0x1'));var zipdir=require(_0xf13e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf13e('0x3'));var moment=require(_0xf13e('0x4'));var BPromise=require(_0xf13e('0x5'));var Mustache=require(_0xf13e('0x6'));var util=require('util');var path=require(_0xf13e('0x7'));var sox=require(_0xf13e('0x8'));var csv=require(_0xf13e('0x9'));var ejs=require(_0xf13e('0xa'));var fs=require('fs');var fs_extra=require(_0xf13e('0xb'));var _=require('lodash');var squel=require(_0xf13e('0xc'));var crypto=require(_0xf13e('0xd'));var jsforce=require(_0xf13e('0xe'));var deskjs=require(_0xf13e('0xf'));var toCsv=require(_0xf13e('0x9'));var querystring=require(_0xf13e('0x10'));var Papa=require('papaparse');var Redis=require(_0xf13e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf13e('0x12'));var as=require(_0xf13e('0x13'));var hardwareService=require(_0xf13e('0x14'));var logger=require(_0xf13e('0x15'))(_0xf13e('0x16'));var utils=require(_0xf13e('0x17'));var config=require(_0xf13e('0x18'));var licenseUtil=require(_0xf13e('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf13e('0x1a')](config[_0xf13e('0x1b')],{'host':_0xf13e('0x1c'),'port':0x18eb});var socket=require(_0xf13e('0x1d'))(new Redis(config[_0xf13e('0x1b')]));require(_0xf13e('0x1e'))[_0xf13e('0x1f')](socket);function respondWithStatusCode(_0x35c9d6,_0x258168){_0x258168=_0x258168||0xcc;return function(_0x5473c5){if(_0x5473c5){return _0x35c9d6[_0xf13e('0x20')](_0x258168);}return _0x35c9d6[_0xf13e('0x21')](_0x258168)[_0xf13e('0x22')]();};}function respondWithResult(_0x37bcc7,_0x1b663b){_0x1b663b=_0x1b663b||0xc8;return function(_0x1c8fa9){if(_0x1c8fa9){return _0x37bcc7['status'](_0x1b663b)[_0xf13e('0x23')](_0x1c8fa9);}};}function respondWithFilteredResult(_0x1270da,_0x22867f){return function(_0x5c3960){if(_0x5c3960){var _0x5e9b2d=typeof _0x22867f[_0xf13e('0x24')]===_0xf13e('0x25')&&typeof _0x22867f[_0xf13e('0x26')]===_0xf13e('0x25');var _0x3a8e02=_0x5c3960['count'];var _0x4ee404=_0x5e9b2d?0x0:_0x22867f['offset'];var _0x24ff1e=_0x5e9b2d?_0x5c3960[_0xf13e('0x27')]:_0x22867f[_0xf13e('0x24')]+_0x22867f['limit'];var _0xb9dcf5;if(_0x24ff1e>=_0x3a8e02){_0x24ff1e=_0x3a8e02;_0xb9dcf5=0xc8;}else{_0xb9dcf5=0xce;}_0x1270da['status'](_0xb9dcf5);return _0x1270da[_0xf13e('0x28')](_0xf13e('0x29'),_0x4ee404+'-'+_0x24ff1e+'/'+_0x3a8e02)[_0xf13e('0x23')](_0x5c3960);}return null;};}function patchUpdates(_0xed60d7){return function(_0x347c28){try{jsonpatch['apply'](_0x347c28,_0xed60d7,!![]);}catch(_0x158240){return BPromise[_0xf13e('0x2a')](_0x158240);}return _0x347c28[_0xf13e('0x2b')]();};}function saveUpdates(_0x3d100e,_0x4a6c38){return function(_0x17b216){if(_0x17b216){return _0x17b216['update'](_0x3d100e)[_0xf13e('0x2c')](function(_0x577121){return _0x577121;});}return null;};}function removeEntity(_0x369670,_0x12ab9a){return function(_0x512745){if(_0x512745){return _0x512745['destroy']()[_0xf13e('0x2c')](function(){_0x369670[_0xf13e('0x21')](0xcc)[_0xf13e('0x22')]();});}};}function handleEntityNotFound(_0x4edb7a,_0x1aebfe){return function(_0x24aeca){if(!_0x24aeca){_0x4edb7a[_0xf13e('0x20')](0x194);}return _0x24aeca;};}function handleError(_0xc267dd,_0x258e49){_0x258e49=_0x258e49||0x1f4;return function(_0x115679){logger[_0xf13e('0x2d')](_0x115679[_0xf13e('0x2e')]);if(_0x115679['name']){delete _0x115679[_0xf13e('0x2f')];}_0xc267dd['status'](_0x258e49)[_0xf13e('0x30')](_0x115679);};}exports[_0xf13e('0x31')]=function(_0x2cf7f2,_0x553031){var _0x581433={},_0x40c6e3={},_0xda65f1={'count':0x0,'rows':[]};var _0x3e4d72=_[_0xf13e('0x32')](db[_0xf13e('0x33')][_0xf13e('0x34')],function(_0xda1e6f){return{'name':_0xda1e6f['fieldName'],'type':_0xda1e6f[_0xf13e('0x35')][_0xf13e('0x36')]};});_0x40c6e3[_0xf13e('0x37')]=_['map'](_0x3e4d72,_0xf13e('0x2f'));_0x40c6e3['query']=_[_0xf13e('0x38')](_0x2cf7f2[_0xf13e('0x39')]);_0x40c6e3['filters']=_[_0xf13e('0x3a')](_0x40c6e3[_0xf13e('0x37')],_0x40c6e3[_0xf13e('0x39')]);_0x581433[_0xf13e('0x3b')]=_[_0xf13e('0x3a')](_0x40c6e3['model'],qs[_0xf13e('0x3c')](_0x2cf7f2[_0xf13e('0x39')]['fields']));_0x581433[_0xf13e('0x3b')]=_0x581433[_0xf13e('0x3b')]['length']?_0x581433[_0xf13e('0x3b')]:_0x40c6e3[_0xf13e('0x37')];if(!_0x2cf7f2[_0xf13e('0x39')][_0xf13e('0x3d')](_0xf13e('0x3e'))){_0x581433[_0xf13e('0x26')]=qs[_0xf13e('0x26')](_0x2cf7f2['query'][_0xf13e('0x26')]);_0x581433[_0xf13e('0x24')]=qs['offset'](_0x2cf7f2['query']['offset']);}_0x581433[_0xf13e('0x3f')]=qs[_0xf13e('0x40')](_0x2cf7f2[_0xf13e('0x39')]['sort']);_0x581433[_0xf13e('0x41')]=qs[_0xf13e('0x42')](_['pick'](_0x2cf7f2[_0xf13e('0x39')],_0x40c6e3[_0xf13e('0x42')]),_0x3e4d72);if(_0x2cf7f2[_0xf13e('0x39')][_0xf13e('0x43')]){_0x581433['where']=_[_0xf13e('0x44')](_0x581433[_0xf13e('0x41')],{'$or':_[_0xf13e('0x32')](_0x3e4d72,function(_0x361347){if(_0x361347[_0xf13e('0x35')]!==_0xf13e('0x45')){var _0x1f9dee={};_0x1f9dee[_0x361347['name']]={'$like':'%'+_0x2cf7f2[_0xf13e('0x39')][_0xf13e('0x43')]+'%'};return _0x1f9dee;}})});}_0x581433=_[_0xf13e('0x44')]({},_0x581433,_0x2cf7f2['options']);var _0x29cc26={'where':_0x581433[_0xf13e('0x41')]};return db[_0xf13e('0x33')][_0xf13e('0x27')](_0x29cc26)[_0xf13e('0x2c')](function(_0x212a08){_0xda65f1[_0xf13e('0x27')]=_0x212a08;if(_0x2cf7f2['query'][_0xf13e('0x46')]){_0x581433['include']=[{'all':!![]}];}return db[_0xf13e('0x33')]['findAll'](_0x581433);})['then'](function(_0x164a98){_0xda65f1[_0xf13e('0x47')]=_0x164a98;return _0xda65f1;})[_0xf13e('0x2c')](respondWithFilteredResult(_0x553031,_0x581433))[_0xf13e('0x48')](handleError(_0x553031,null));};exports['show']=function(_0x3b71dd,_0x4da4a3){var _0x1f1bd5={'raw':!![],'where':{'id':_0x3b71dd['params']['id']}},_0x2249f4={};_0x2249f4['model']=_[_0xf13e('0x38')](db[_0xf13e('0x33')][_0xf13e('0x34')]);_0x2249f4['query']=_[_0xf13e('0x38')](_0x3b71dd[_0xf13e('0x39')]);_0x2249f4[_0xf13e('0x42')]=_[_0xf13e('0x3a')](_0x2249f4[_0xf13e('0x37')],_0x2249f4['query']);_0x1f1bd5['attributes']=_[_0xf13e('0x3a')](_0x2249f4[_0xf13e('0x37')],qs[_0xf13e('0x3c')](_0x3b71dd[_0xf13e('0x39')][_0xf13e('0x3c')]));_0x1f1bd5[_0xf13e('0x3b')]=_0x1f1bd5[_0xf13e('0x3b')][_0xf13e('0x49')]?_0x1f1bd5['attributes']:_0x2249f4['model'];if(_0x3b71dd['query'][_0xf13e('0x46')]){_0x1f1bd5[_0xf13e('0x4a')]=[{'all':!![]}];}_0x1f1bd5=_[_0xf13e('0x44')]({},_0x1f1bd5,_0x3b71dd[_0xf13e('0x4b')]);return db[_0xf13e('0x33')][_0xf13e('0x4c')](_0x1f1bd5)['then'](handleEntityNotFound(_0x4da4a3,null))[_0xf13e('0x2c')](respondWithResult(_0x4da4a3,null))[_0xf13e('0x48')](handleError(_0x4da4a3,null));};exports[_0xf13e('0x4d')]=function(_0x3cb404,_0x5c9ce0){return db['ChatInternalMessage'][_0xf13e('0x4d')](_0x3cb404[_0xf13e('0x4e')],{})[_0xf13e('0x2c')](respondWithResult(_0x5c9ce0,0xc9))[_0xf13e('0x48')](handleError(_0x5c9ce0,null));};exports[_0xf13e('0x4f')]=function(_0x4ed6ec,_0x23a46e){if(_0x4ed6ec[_0xf13e('0x4e')]['id']){delete _0x4ed6ec['body']['id'];}return db[_0xf13e('0x33')][_0xf13e('0x4c')]({'where':{'id':_0x4ed6ec[_0xf13e('0x50')]['id']}})[_0xf13e('0x2c')](handleEntityNotFound(_0x23a46e,null))[_0xf13e('0x2c')](saveUpdates(_0x4ed6ec['body'],null))[_0xf13e('0x2c')](respondWithResult(_0x23a46e,null))['catch'](handleError(_0x23a46e,null));};exports[_0xf13e('0x51')]=function(_0x2541f7,_0xb8f945){return db[_0xf13e('0x33')][_0xf13e('0x4c')]({'where':{'id':_0x2541f7['params']['id']}})[_0xf13e('0x2c')](handleEntityNotFound(_0xb8f945,null))[_0xf13e('0x2c')](removeEntity(_0xb8f945,null))[_0xf13e('0x48')](handleError(_0xb8f945,null));};exports[_0xf13e('0x52')]=function(_0x5a7e47,_0x18e70b){return db[_0xf13e('0x33')][_0xf13e('0x52')]()[_0xf13e('0x2c')](respondWithResult(_0x18e70b,null))[_0xf13e('0x48')](handleError(_0x18e70b,null));};function wrapUser(_0x3dda2e){return function(_0x1e1440){var _0x4314f1=_0x3dda2e['get']({'plain':!![]});_0x4314f1[_0xf13e('0x53')]=[];if(_0x1e1440){_0x4314f1[_0xf13e('0x54')]=_0x1e1440[_0xf13e('0x55')];_0x4314f1[_0xf13e('0x56')]=_0x1e1440;}else{_0x4314f1['lastMessageAt']=moment(0x0)[_0xf13e('0x57')](_0xf13e('0x58'));_0x4314f1[_0xf13e('0x56')]={};}return _0x4314f1;};}exports[_0xf13e('0x59')]=function(_0x32562a,_0x5ab5c2,_0x140e43){var _0x454b28=[];return db['User'][_0xf13e('0x5a')]({'where':{'role':[_0xf13e('0x5b'),_0xf13e('0x5c'),'user']},'attributes':['id',_0xf13e('0x5d'),_0xf13e('0x2f'),_0xf13e('0x5e'),_0xf13e('0x5f'),'internal',_0xf13e('0x60'),'lastLoginAt',_0xf13e('0x61'),_0xf13e('0x62')],'order':qs[_0xf13e('0x40')](_0xf13e('0x63')),'include':[{'model':db[_0xf13e('0x64')],'as':_0xf13e('0x65'),'attributes':['id',_0xf13e('0x2f'),'type'],'through':{'attributes':[]}}]})[_0xf13e('0x2c')](function(_0x5601cb){if(_0x5601cb){var _0x46f2aa=_0x32562a[_0xf13e('0x66')][_0xf13e('0x67')]({'plain':!![]});if(!_0x46f2aa)throw new Error(_0xf13e('0x68'));if(_0x46f2aa[_0xf13e('0x5e')]==='user'){return db[_0xf13e('0x69')][_0xf13e('0x4c')]({'where':{'name':_0xf13e('0x6a'),'userProfileId':_0x46f2aa['userProfileId']},'raw':!![]})['then'](function(_0x4303a0){if(_0x4303a0){if(_0x4303a0[_0xf13e('0x6b')]===0x0){return db[_0xf13e('0x6c')][_0xf13e('0x5a')]({'where':{'sectionId':_0x4303a0['id']},'raw':!![]})[_0xf13e('0x2c')](function(_0x4b8c7d){var _0x65f3eb=[];if(_[_0xf13e('0x6d')](_0x4b8c7d)){_0x65f3eb=_['filter'](_0x5601cb,function(_0x536d9e){if(_0x536d9e[_0xf13e('0x5e')]!==_0xf13e('0x5b')){return _0x536d9e;}});return _0x65f3eb;}else{for(var _0x587987=0x0;_0x587987<_0x5601cb[_0xf13e('0x49')];_0x587987++){var _0x3e7a5e=_0x5601cb[_0x587987];if(_0x3e7a5e[_0xf13e('0x5e')]===_0xf13e('0x5b')){var _0x5dc009=_[_0xf13e('0x4c')](_0x4b8c7d,function(_0x4d25d3){return _0x4d25d3['resourceId']===_0x3e7a5e['id'];});if(_0x5dc009)_0x65f3eb[_0xf13e('0x6e')](_0x3e7a5e);}else{_0x65f3eb['push'](_0x3e7a5e);}}return _0x65f3eb;}});}else{return _0x5601cb;}}else{var _0x289264=_[_0xf13e('0x43')](_0x5601cb,function(_0x5d084c){if(_0x5d084c[_0xf13e('0x5e')]!==_0xf13e('0x5b')){return _0x5d084c;}});return _0x289264;}});}else{return _0x5601cb;}}})['then'](function(_0x495b18){var _0x48c932=[];if(_0x495b18){_0x454b28=_0x495b18;for(var _0x25583f=0x0;_0x25583f<_0x495b18[_0xf13e('0x49')];_0x25583f+=0x1){_0x454b28[_0x25583f][_0xf13e('0x53')]=[];_0x48c932['push'](db[_0xf13e('0x33')][_0xf13e('0x4c')]({'where':{'FromId':[_0x32562a[_0xf13e('0x66')]['id'],_0x495b18[_0x25583f]['id']],'ToId':[_0x32562a['user']['id'],_0x495b18[_0x25583f]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId','ToId',_0xf13e('0x6f'),_0xf13e('0x4e')],'order':qs['sort'](_0xf13e('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf13e('0x2c')](wrapUser(_0x495b18[_0x25583f])));}return BPromise[_0xf13e('0x71')](_0x48c932);}return[];})[_0xf13e('0x2c')](function(_0x906cab){return{'rows':_0x906cab,'count':_0x906cab[_0xf13e('0x49')]};})[_0xf13e('0x2c')](respondWithResult(_0x5ab5c2,null))[_0xf13e('0x48')](handleError(_0x5ab5c2,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 83801cf..3b316e3 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 _0x96f1=['hook','exports','../../mysqldb','ChatInternalMessage','save','update'];(function(_0x551f88,_0x330636){var _0x585273=function(_0x29c2d9){while(--_0x29c2d9){_0x551f88['push'](_0x551f88['shift']());}};_0x585273(++_0x330636);}(_0x96f1,0x10a));var _0x196f=function(_0x529c3a,_0x48b765){_0x529c3a=_0x529c3a-0x0;var _0x1a00ce=_0x96f1[_0x529c3a];return _0x1a00ce;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x196f('0x0'))['db'][_0x196f('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x196f('0x2'),'afterUpdate':_0x196f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2ee279){return function(_0x59e862,_0xd756d6,_0x3c6470){ChatInternalMessageEvents['emit'](_0x2ee279+':'+_0x59e862['id'],_0x59e862);ChatInternalMessageEvents['emit'](_0x2ee279,_0x59e862);_0x3c6470(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x196f('0x4')](e,emitEvent(event));}}module[_0x196f('0x5')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xd824=['save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x2767d7,_0xb1ee5c){var _0xb1aece=function(_0x4b65cc){while(--_0x4b65cc){_0x2767d7['push'](_0x2767d7['shift']());}};_0xb1aece(++_0xb1ee5c);}(_0xd824,0xc2));var _0x4d82=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd824[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x4d82('0x0'));var ChatInternalMessage=require(_0x4d82('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4d82('0x2'),'afterUpdate':_0x4d82('0x3'),'afterDestroy':_0x4d82('0x4')};function emitEvent(_0x2a976e){return function(_0x287fbf,_0x1c8ad9,_0x4bc746){ChatInternalMessageEvents['emit'](_0x2a976e+':'+_0x287fbf['id'],_0x287fbf);ChatInternalMessageEvents[_0x4d82('0x5')](_0x2a976e,_0x287fbf);_0x4bc746(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x4d82('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 9b9790e..f4aae4c 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 _0x8265=['rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x293b44,_0x122a8b){var _0x1ca24b=function(_0xa7314a){while(--_0xa7314a){_0x293b44['push'](_0x293b44['shift']());}};_0x1ca24b(++_0x122a8b);}(_0x8265,0xa0));var _0x5826=function(_0x13ead2,_0x5ec737){_0x13ead2=_0x13ead2-0x0;var _0x5cca4a=_0x8265[_0x13ead2];return _0x5cca4a;};'use strict';var _=require(_0x5826('0x0'));var util=require(_0x5826('0x1'));var logger=require(_0x5826('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5826('0x3'));var rp=require(_0x5826('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5826('0x5'));var config=require(_0x5826('0x6'));var attributes=require(_0x5826('0x7'));module[_0x5826('0x8')]=function(_0x3bf5a3,_0x53cbb0){return _0x3bf5a3[_0x5826('0x9')](_0x5826('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6a16=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','rimraf','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x477c0c,_0x48b400){var _0x37d540=function(_0x2d95e2){while(--_0x2d95e2){_0x477c0c['push'](_0x477c0c['shift']());}};_0x37d540(++_0x48b400);}(_0x6a16,0x151));var _0x66a1=function(_0x438d4a,_0x70220a){_0x438d4a=_0x438d4a-0x0;var _0x35fe05=_0x6a16[_0x438d4a];return _0x35fe05;};'use strict';var _=require(_0x66a1('0x0'));var util=require(_0x66a1('0x1'));var logger=require(_0x66a1('0x2'))('api');var moment=require(_0x66a1('0x3'));var BPromise=require('bluebird');var rp=require(_0x66a1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x66a1('0x5'));var config=require('../../config/environment');var attributes=require(_0x66a1('0x6'));module['exports']=function(_0x4bcdc5,_0x2ef202){return _0x4bcdc5[_0x66a1('0x7')](_0x66a1('0x8'),attributes,{'tableName':_0x66a1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x66a1('0xa'),'collate':_0x66a1('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 3c4da8b..26fd23f 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 _0x4ecf=['localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults'];(function(_0x53818b,_0x1523cc){var _0x5a6429=function(_0x5d7407){while(--_0x5d7407){_0x53818b['push'](_0x53818b['shift']());}};_0x5a6429(++_0x1523cc);}(_0x4ecf,0x186));var _0xf4ec=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4ecf[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf4ec('0x0'));var util=require(_0xf4ec('0x1'));var moment=require('moment');var BPromise=require(_0xf4ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4ec('0x3'))['db'];var utils=require(_0xf4ec('0x4'));var logger=require('../../config/logger')(_0xf4ec('0x5'));var config=require(_0xf4ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf4ec('0x7')]['http']({'port':0x232a});config[_0xf4ec('0x8')]=_[_0xf4ec('0x9')](config[_0xf4ec('0x8')],{'host':_0xf4ec('0xa'),'port':0x18eb});var socket=require(_0xf4ec('0xb'))(new Redis(config[_0xf4ec('0x8')]));require(_0xf4ec('0xc'))[_0xf4ec('0xd')](socket);function respondWithRpcPromise(_0x3cbed1,_0xe7b504,_0x35081f){return new BPromise(function(_0x293c3b,_0x30ed79){return client[_0xf4ec('0xe')](_0x3cbed1,_0x35081f)[_0xf4ec('0xf')](function(_0x58bfe6){logger[_0xf4ec('0x10')](_0xf4ec('0x11'),_0xe7b504,_0xf4ec('0x12'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xe7b504,'request\x20sent',JSON[_0xf4ec('0x13')](_0x58bfe6));if(_0x58bfe6['error']){if(_0x58bfe6[_0xf4ec('0x14')][_0xf4ec('0x15')]===0x1f4){logger['error'](_0xf4ec('0x11'),_0xe7b504,_0x58bfe6[_0xf4ec('0x14')][_0xf4ec('0x16')]);return _0x30ed79(_0x58bfe6[_0xf4ec('0x14')][_0xf4ec('0x16')]);}logger['error'](_0xf4ec('0x11'),_0xe7b504,_0x58bfe6[_0xf4ec('0x14')][_0xf4ec('0x16')]);return _0x293c3b(_0x58bfe6[_0xf4ec('0x14')][_0xf4ec('0x16')]);}else{logger[_0xf4ec('0x10')](_0xf4ec('0x11'),_0xe7b504,_0xf4ec('0x12'));_0x293c3b(_0x58bfe6[_0xf4ec('0x17')]['message']);}})[_0xf4ec('0x18')](function(_0x31511a){logger[_0xf4ec('0x14')](_0xf4ec('0x11'),_0xe7b504,_0x31511a);_0x30ed79(_0x31511a);});});} \ No newline at end of file +var _0x813e=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x2628cc,_0x944b07){var _0x141d9e=function(_0x5afcaf){while(--_0x5afcaf){_0x2628cc['push'](_0x2628cc['shift']());}};_0x141d9e(++_0x944b07);}(_0x813e,0xba));var _0xe813=function(_0x164798,_0x29e959){_0x164798=_0x164798-0x0;var _0xc5da=_0x813e[_0x164798];return _0xc5da;};'use strict';var _=require(_0xe813('0x0'));var util=require(_0xe813('0x1'));var moment=require(_0xe813('0x2'));var BPromise=require(_0xe813('0x3'));var rs=require(_0xe813('0x4'));var fs=require('fs');var Redis=require(_0xe813('0x5'));var db=require(_0xe813('0x6'))['db'];var utils=require(_0xe813('0x7'));var logger=require(_0xe813('0x8'))(_0xe813('0x9'));var config=require('../../config/environment');var jayson=require(_0xe813('0xa'));var client=jayson[_0xe813('0xb')]['http']({'port':0x232a});config['redis']=_[_0xe813('0xc')](config[_0xe813('0xd')],{'host':_0xe813('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe813('0xd')]));require(_0xe813('0xf'))[_0xe813('0x10')](socket);function respondWithRpcPromise(_0x23ddd3,_0x236827,_0x343dbc){return new BPromise(function(_0x52f3be,_0x233559){return client[_0xe813('0x11')](_0x23ddd3,_0x343dbc)[_0xe813('0x12')](function(_0x454607){logger[_0xe813('0x13')](_0xe813('0x14'),_0x236827,_0xe813('0x15'));logger['debug'](_0xe813('0x16'),_0x236827,'request\x20sent',JSON['stringify'](_0x454607));if(_0x454607[_0xe813('0x17')]){if(_0x454607[_0xe813('0x17')]['code']===0x1f4){logger['error'](_0xe813('0x14'),_0x236827,_0x454607[_0xe813('0x17')]['message']);return _0x233559(_0x454607[_0xe813('0x17')][_0xe813('0x18')]);}logger[_0xe813('0x17')](_0xe813('0x14'),_0x236827,_0x454607[_0xe813('0x17')][_0xe813('0x18')]);return _0x52f3be(_0x454607[_0xe813('0x17')]['message']);}else{logger['info'](_0xe813('0x14'),_0x236827,_0xe813('0x15'));_0x52f3be(_0x454607[_0xe813('0x19')]['message']);}})['catch'](function(_0x5a9c62){logger[_0xe813('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x236827,_0x5a9c62);_0x233559(_0x5a9c62);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 23c5dec..40d75e5 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 _0x926d=['save','remove','emit','removeListener','register'];(function(_0x170b0b,_0x4aa600){var _0x33cd22=function(_0x35263c){while(--_0x35263c){_0x170b0b['push'](_0x170b0b['shift']());}};_0x33cd22(++_0x4aa600);}(_0x926d,0x177));var _0xd926=function(_0x855e7,_0x21975d){_0x855e7=_0x855e7-0x0;var _0xe4a718=_0x926d[_0x855e7];return _0xe4a718;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xd926('0x0'),_0xd926('0x1'),'update'];function createListener(_0x53efe8,_0x5959e6){return function(_0x2ef23a){_0x5959e6[_0xd926('0x2')](_0x53efe8,_0x2ef23a);};}function removeListener(_0x2e8a31,_0x232ac0){return function(){ChatInternalMessageEvents[_0xd926('0x3')](_0x2e8a31,_0x232ac0);};}exports[_0xd926('0x4')]=function(_0x19675d){for(var _0x3b830c=0x0,_0x38422e=events['length'];_0x3b830c<_0x38422e;_0x3b830c++){var _0xb1aa1=events[_0x3b830c];var _0x2973cb=createListener('chatInternalMessage:'+_0xb1aa1,_0x19675d);ChatInternalMessageEvents['on'](_0xb1aa1,_0x2973cb);}}; \ No newline at end of file +var _0x13f6=['removeListener','register','length','./chatInternalMessage.events','remove','update','emit'];(function(_0x52ae20,_0x28fc23){var _0xf1ad1=function(_0x384122){while(--_0x384122){_0x52ae20['push'](_0x52ae20['shift']());}};_0xf1ad1(++_0x28fc23);}(_0x13f6,0x153));var _0x613f=function(_0x2ffbb1,_0x17cd1b){_0x2ffbb1=_0x2ffbb1-0x0;var _0xde0895=_0x13f6[_0x2ffbb1];return _0xde0895;};'use strict';var ChatInternalMessageEvents=require(_0x613f('0x0'));var events=['save',_0x613f('0x1'),_0x613f('0x2')];function createListener(_0x18d15e,_0x4a5509){return function(_0x512f0d){_0x4a5509[_0x613f('0x3')](_0x18d15e,_0x512f0d);};}function removeListener(_0x4979e2,_0x5d47f4){return function(){ChatInternalMessageEvents[_0x613f('0x4')](_0x4979e2,_0x5d47f4);};}exports[_0x613f('0x5')]=function(_0x120b2f){for(var _0x137272=0x0,_0x23df26=events[_0x613f('0x6')];_0x137272<_0x23df26;_0x137272++){var _0x480fa8=events[_0x137272];var _0x1efce4=createListener('chatInternalMessage:'+_0x480fa8,_0x120b2f);ChatInternalMessageEvents['on'](_0x480fa8,_0x1efce4);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7248225..3791786 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 _0xb156=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0xb156,0xfd));var _0x6b15=function(_0x21bfce,_0x4c2c80){_0x21bfce=_0x21bfce-0x0;var _0x1cd9e0=_0xb156[_0x21bfce];return _0x1cd9e0;};'use strict';var multer=require(_0x6b15('0x0'));var util=require('util');var path=require(_0x6b15('0x1'));var timeout=require(_0x6b15('0x2'));var express=require('express');var router=express[_0x6b15('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6b15('0x4'));var interaction=require(_0x6b15('0x5'));var config=require('../../config/environment');var controller=require(_0x6b15('0x6'));router['get']('/',auth[_0x6b15('0x7')](),controller[_0x6b15('0x8')]);router[_0x6b15('0x9')](_0x6b15('0xa'),auth[_0x6b15('0x7')](),controller[_0x6b15('0xb')]);router[_0x6b15('0x9')](_0x6b15('0xc'),auth['isAuthenticated'](),controller[_0x6b15('0xd')]);router[_0x6b15('0x9')](_0x6b15('0xe'),auth[_0x6b15('0x7')](),controller[_0x6b15('0xf')]);router[_0x6b15('0x10')]('/',auth['isAuthenticated'](),controller[_0x6b15('0x11')]);router[_0x6b15('0x12')](_0x6b15('0xe'),controller[_0x6b15('0x13')]);router[_0x6b15('0x14')](_0x6b15('0xe'),auth['isAuthenticated'](),controller[_0x6b15('0x15')]);module[_0x6b15('0x16')]=router; \ No newline at end of file +var _0xb8f2=['/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','describe','/users','getUsers','get'];(function(_0x20a89d,_0x1eafac){var _0x4904c7=function(_0x357928){while(--_0x357928){_0x20a89d['push'](_0x20a89d['shift']());}};_0x4904c7(++_0x1eafac);}(_0xb8f2,0x1bc));var _0x2b8f=function(_0x3cb6fa,_0x516f15){_0x3cb6fa=_0x3cb6fa-0x0;var _0x4d786e=_0xb8f2[_0x3cb6fa];return _0x4d786e;};'use strict';var multer=require(_0x2b8f('0x0'));var util=require(_0x2b8f('0x1'));var path=require(_0x2b8f('0x2'));var timeout=require(_0x2b8f('0x3'));var express=require(_0x2b8f('0x4'));var router=express[_0x2b8f('0x5')]();var fs_extra=require(_0x2b8f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2b8f('0x7'));var config=require(_0x2b8f('0x8'));var controller=require(_0x2b8f('0x9'));router['get']('/',auth[_0x2b8f('0xa')](),controller[_0x2b8f('0xb')]);router['get']('/describe',auth[_0x2b8f('0xa')](),controller[_0x2b8f('0xc')]);router['get'](_0x2b8f('0xd'),auth[_0x2b8f('0xa')](),controller[_0x2b8f('0xe')]);router[_0x2b8f('0xf')](_0x2b8f('0x10'),auth[_0x2b8f('0xa')](),controller[_0x2b8f('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2b8f('0x12')]);router[_0x2b8f('0x13')](_0x2b8f('0x10'),controller['update']);router[_0x2b8f('0x14')](_0x2b8f('0x10'),auth[_0x2b8f('0xa')](),controller[_0x2b8f('0x15')]);module[_0x2b8f('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 8a2d60a..f6ff898 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 _0x9ccd=['TEXT','medium','ENUM','out','DATE','STRING','sequelize'];(function(_0xecfad3,_0x5e4ce6){var _0x3061bb=function(_0x525e75){while(--_0x525e75){_0xecfad3['push'](_0xecfad3['shift']());}};_0x3061bb(++_0x5e4ce6);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xd9cc('0x0'));module['exports']={'body':{'type':Sequelize[_0xd9cc('0x1')](_0xd9cc('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd9cc('0x3')]('in','out'),'defaultValue':_0xd9cc('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd9cc('0x5')]},'providerName':{'type':Sequelize[_0xd9cc('0x6')]},'providerResponse':{'type':Sequelize[_0xd9cc('0x1')]}}; \ No newline at end of file +var _0x4f3c=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x3eddd9,_0x5c2256){var _0x572cfd=function(_0x1e0a21){while(--_0x1e0a21){_0x3eddd9['push'](_0x3eddd9['shift']());}};_0x572cfd(++_0x5c2256);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x1f0679,_0x53d43c){_0x1f0679=_0x1f0679-0x0;var _0x3dc3a4=_0x4f3c[_0x1f0679];return _0x3dc3a4;};'use strict';var Sequelize=require(_0xc4f3('0x0'));module[_0xc4f3('0x1')]={'body':{'type':Sequelize[_0xc4f3('0x2')](_0xc4f3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xc4f3('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc4f3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc4f3('0x5')]('in',_0xc4f3('0x6')),'defaultValue':_0xc4f3('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc4f3('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index a4bb4c2..7742a27 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 _0xc9d8=['filters','pick','filter','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','keys','include','merge','options','create','body','find','chat-interactions','chat','read','readAt','format','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','ContactId','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\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','destroy','stack','name','map','ChatMessage','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4877ab,_0x22d949){var _0x36b940=function(_0x3f7d8c){while(--_0x3f7d8c){_0x4877ab['push'](_0x4877ab['shift']());}};_0x36b940(++_0x22d949);}(_0xc9d8,0xc2));var _0x8c9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9d8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8c9d('0x0'));var rimraf=require(_0x8c9d('0x1'));var zipdir=require(_0x8c9d('0x2'));var jsonpatch=require(_0x8c9d('0x3'));var rp=require('request-promise');var moment=require(_0x8c9d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8c9d('0x5'));var path=require(_0x8c9d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8c9d('0x7'));var fs=require('fs');var fs_extra=require(_0x8c9d('0x8'));var _=require(_0x8c9d('0x9'));var squel=require(_0x8c9d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8c9d('0xb'));var toCsv=require(_0x8c9d('0xc'));var querystring=require(_0x8c9d('0xd'));var Papa=require(_0x8c9d('0xe'));var Redis=require(_0x8c9d('0xf'));var authService=require(_0x8c9d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8c9d('0x11'));var hardwareService=require(_0x8c9d('0x12'));var logger=require(_0x8c9d('0x13'))('api');var utils=require(_0x8c9d('0x14'));var config=require(_0x8c9d('0x15'));var licenseUtil=require(_0x8c9d('0x16'));var db=require('../../mysqldb')['db'];config[_0x8c9d('0x17')]=_[_0x8c9d('0x18')](config[_0x8c9d('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x8c9d('0x19'))(new Redis(config[_0x8c9d('0x17')]));require(_0x8c9d('0x1a'))[_0x8c9d('0x1b')](socket);var jayson=require(_0x8c9d('0x1c'));var client=jayson[_0x8c9d('0x1d')][_0x8c9d('0x1e')]({'port':0x232c});var client9002=jayson[_0x8c9d('0x1d')][_0x8c9d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xe47db,_0x107bd6,_0x288fef,_0x398000){return new BPromise(function(_0x3b6315,_0x44256e){var _0x3ecfff=_0x398000||client;return _0x3ecfff[_0x8c9d('0x1f')](_0xe47db,_0x288fef)[_0x8c9d('0x20')](function(_0x55d9c4){logger[_0x8c9d('0x21')](_0x8c9d('0x22'),_0x107bd6,_0x8c9d('0x23'));logger['debug'](_0x8c9d('0x24'),_0x107bd6,'request\x20sent',JSON['stringify'](_0x55d9c4));if(_0x55d9c4[_0x8c9d('0x25')]){if(_0x55d9c4[_0x8c9d('0x25')][_0x8c9d('0x26')]===0x1f4){logger[_0x8c9d('0x25')](_0x8c9d('0x22'),_0x107bd6,_0x55d9c4[_0x8c9d('0x25')][_0x8c9d('0x27')]);return _0x44256e(_0x55d9c4[_0x8c9d('0x25')]['message']);}logger[_0x8c9d('0x25')](_0x8c9d('0x22'),_0x107bd6,_0x55d9c4[_0x8c9d('0x25')]['message']);return _0x3b6315(_0x55d9c4['error'][_0x8c9d('0x27')]);}else{logger[_0x8c9d('0x21')](_0x8c9d('0x22'),_0x107bd6,_0x8c9d('0x23'));_0x3b6315(_0x55d9c4[_0x8c9d('0x28')][_0x8c9d('0x27')]);}})[_0x8c9d('0x29')](function(_0x1d8731){logger[_0x8c9d('0x25')]('ChatMessage,\x20%s,\x20%s',_0x107bd6,_0x1d8731);_0x44256e(_0x1d8731);});});}function respondWithStatusCode(_0x3c4d04,_0x666602){_0x666602=_0x666602||0xcc;return function(_0x145cd2){if(_0x145cd2){return _0x3c4d04[_0x8c9d('0x2a')](_0x666602);}return _0x3c4d04[_0x8c9d('0x2b')](_0x666602)[_0x8c9d('0x2c')]();};}function respondWithResult(_0x45d91c,_0x485933){_0x485933=_0x485933||0xc8;return function(_0x12e297){if(_0x12e297){return _0x45d91c[_0x8c9d('0x2b')](_0x485933)[_0x8c9d('0x2d')](_0x12e297);}};}function respondWithFilteredResult(_0x5e220f,_0x55b457){return function(_0x167519){if(_0x167519){var _0x126217=typeof _0x55b457['offset']===_0x8c9d('0x2e')&&typeof _0x55b457[_0x8c9d('0x2f')]===_0x8c9d('0x2e');var _0x516811=_0x167519[_0x8c9d('0x30')];var _0x458669=_0x126217?0x0:_0x55b457[_0x8c9d('0x31')];var _0x247871=_0x126217?_0x167519[_0x8c9d('0x30')]:_0x55b457[_0x8c9d('0x31')]+_0x55b457[_0x8c9d('0x2f')];var _0x13b2ad;if(_0x247871>=_0x516811){_0x247871=_0x516811;_0x13b2ad=0xc8;}else{_0x13b2ad=0xce;}_0x5e220f[_0x8c9d('0x2b')](_0x13b2ad);return _0x5e220f[_0x8c9d('0x32')](_0x8c9d('0x33'),_0x458669+'-'+_0x247871+'/'+_0x516811)[_0x8c9d('0x2d')](_0x167519);}return null;};}function patchUpdates(_0x161a39){return function(_0x19d1f3){try{jsonpatch[_0x8c9d('0x34')](_0x19d1f3,_0x161a39,!![]);}catch(_0x29f6b6){return BPromise[_0x8c9d('0x35')](_0x29f6b6);}return _0x19d1f3[_0x8c9d('0x36')]();};}function saveUpdates(_0x10297d,_0x4507c7){return function(_0x12b136){if(_0x12b136){return _0x12b136[_0x8c9d('0x37')](_0x10297d)[_0x8c9d('0x20')](function(_0x18c6e8){return _0x18c6e8;});}return null;};}function removeEntity(_0x58a889,_0x16aeb0){return function(_0x48ee4c){if(_0x48ee4c){return _0x48ee4c[_0x8c9d('0x38')]()['then'](function(){_0x58a889[_0x8c9d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x237722,_0x4e81c2){return function(_0x133884){if(!_0x133884){_0x237722[_0x8c9d('0x2a')](0x194);}return _0x133884;};}function handleError(_0x2a970e,_0x375632){_0x375632=_0x375632||0x1f4;return function(_0x15a4c5){logger[_0x8c9d('0x25')](_0x15a4c5[_0x8c9d('0x39')]);if(_0x15a4c5[_0x8c9d('0x3a')]){delete _0x15a4c5[_0x8c9d('0x3a')];}_0x2a970e[_0x8c9d('0x2b')](_0x375632)['send'](_0x15a4c5);};}exports['index']=function(_0x5e3cae,_0x5767dd){var _0x1df5ba={},_0x503853={},_0x3e671c={'count':0x0,'rows':[]};var _0x3dc755=_[_0x8c9d('0x3b')](db[_0x8c9d('0x3c')]['rawAttributes'],function(_0x109fc7){return{'name':_0x109fc7['fieldName'],'type':_0x109fc7[_0x8c9d('0x3d')][_0x8c9d('0x3e')]};});_0x503853[_0x8c9d('0x3f')]=_[_0x8c9d('0x3b')](_0x3dc755,'name');_0x503853[_0x8c9d('0x40')]=_['keys'](_0x5e3cae[_0x8c9d('0x40')]);_0x503853['filters']=_[_0x8c9d('0x41')](_0x503853[_0x8c9d('0x3f')],_0x503853['query']);_0x1df5ba[_0x8c9d('0x42')]=_[_0x8c9d('0x41')](_0x503853[_0x8c9d('0x3f')],qs[_0x8c9d('0x43')](_0x5e3cae[_0x8c9d('0x40')]['fields']));_0x1df5ba[_0x8c9d('0x42')]=_0x1df5ba[_0x8c9d('0x42')][_0x8c9d('0x44')]?_0x1df5ba['attributes']:_0x503853['model'];if(!_0x5e3cae[_0x8c9d('0x40')][_0x8c9d('0x45')](_0x8c9d('0x46'))){_0x1df5ba['limit']=qs[_0x8c9d('0x2f')](_0x5e3cae[_0x8c9d('0x40')]['limit']);_0x1df5ba['offset']=qs[_0x8c9d('0x31')](_0x5e3cae['query'][_0x8c9d('0x31')]);}_0x1df5ba[_0x8c9d('0x47')]=qs[_0x8c9d('0x48')](_0x5e3cae[_0x8c9d('0x40')]['sort']);_0x1df5ba[_0x8c9d('0x49')]=qs[_0x8c9d('0x4a')](_[_0x8c9d('0x4b')](_0x5e3cae[_0x8c9d('0x40')],_0x503853['filters']),_0x3dc755);if(_0x5e3cae[_0x8c9d('0x40')][_0x8c9d('0x4c')]){_0x1df5ba[_0x8c9d('0x49')]=_['merge'](_0x1df5ba['where'],{'$or':_[_0x8c9d('0x3b')](_0x3dc755,function(_0x245dd4){if(_0x245dd4[_0x8c9d('0x3d')]!==_0x8c9d('0x4d')){var _0x4624c4={};_0x4624c4[_0x245dd4[_0x8c9d('0x3a')]]={'$like':'%'+_0x5e3cae['query'][_0x8c9d('0x4c')]+'%'};return _0x4624c4;}})});}_0x1df5ba=_['merge']({},_0x1df5ba,_0x5e3cae['options']);var _0xfa89b8={'where':_0x1df5ba[_0x8c9d('0x49')]};return db[_0x8c9d('0x3c')][_0x8c9d('0x30')](_0xfa89b8)[_0x8c9d('0x20')](function(_0x108ebc){_0x3e671c['count']=_0x108ebc;if(_0x5e3cae[_0x8c9d('0x40')][_0x8c9d('0x4e')]){_0x1df5ba['include']=[{'all':!![]}];}return db[_0x8c9d('0x3c')][_0x8c9d('0x4f')](_0x1df5ba);})['then'](function(_0xf65f1c){_0x3e671c[_0x8c9d('0x50')]=_0xf65f1c;return _0x3e671c;})[_0x8c9d('0x20')](respondWithFilteredResult(_0x5767dd,_0x1df5ba))['catch'](handleError(_0x5767dd,null));};exports[_0x8c9d('0x51')]=function(_0x436a33,_0x5ee1c2){var _0x435dff={'raw':!![],'where':{'id':_0x436a33[_0x8c9d('0x52')]['id']}},_0x18bc27={};_0x18bc27[_0x8c9d('0x3f')]=_['keys'](db[_0x8c9d('0x3c')][_0x8c9d('0x53')]);_0x18bc27[_0x8c9d('0x40')]=_[_0x8c9d('0x54')](_0x436a33[_0x8c9d('0x40')]);_0x18bc27['filters']=_[_0x8c9d('0x41')](_0x18bc27[_0x8c9d('0x3f')],_0x18bc27[_0x8c9d('0x40')]);_0x435dff[_0x8c9d('0x42')]=_[_0x8c9d('0x41')](_0x18bc27[_0x8c9d('0x3f')],qs[_0x8c9d('0x43')](_0x436a33[_0x8c9d('0x40')]['fields']));_0x435dff['attributes']=_0x435dff[_0x8c9d('0x42')][_0x8c9d('0x44')]?_0x435dff['attributes']:_0x18bc27['model'];if(_0x436a33['query'][_0x8c9d('0x4e')]){_0x435dff[_0x8c9d('0x55')]=[{'all':!![]}];}_0x435dff=_[_0x8c9d('0x56')]({},_0x435dff,_0x436a33[_0x8c9d('0x57')]);return db[_0x8c9d('0x3c')]['find'](_0x435dff)[_0x8c9d('0x20')](handleEntityNotFound(_0x5ee1c2,null))[_0x8c9d('0x20')](respondWithResult(_0x5ee1c2,null))['catch'](handleError(_0x5ee1c2,null));};exports[_0x8c9d('0x58')]=function(_0x27e97c,_0x688746){return db[_0x8c9d('0x3c')][_0x8c9d('0x58')](_0x27e97c['body'],{})[_0x8c9d('0x20')](respondWithResult(_0x688746,0xc9))[_0x8c9d('0x29')](handleError(_0x688746,null));};exports[_0x8c9d('0x37')]=function(_0x3075d3,_0x5adb79){if(_0x3075d3[_0x8c9d('0x59')]['id']){delete _0x3075d3[_0x8c9d('0x59')]['id'];}return db[_0x8c9d('0x3c')][_0x8c9d('0x5a')]({'where':{'id':_0x3075d3[_0x8c9d('0x52')]['id']}})[_0x8c9d('0x20')](handleEntityNotFound(_0x5adb79,null))['then'](saveUpdates(_0x3075d3['body'],null))[_0x8c9d('0x20')](respondWithResult(_0x5adb79,null))[_0x8c9d('0x29')](handleError(_0x5adb79,null));};exports[_0x8c9d('0x38')]=function(_0x1b4122,_0x35ab85){return db['ChatMessage'][_0x8c9d('0x5a')]({'where':{'id':_0x1b4122[_0x8c9d('0x52')]['id']}})['then'](handleEntityNotFound(_0x35ab85,null))['then'](removeEntity(_0x35ab85,null))[_0x8c9d('0x29')](handleError(_0x35ab85,null));};exports['describe']=function(_0x16c4e5,_0x4398fa){return db[_0x8c9d('0x3c')]['describe']()[_0x8c9d('0x20')](respondWithResult(_0x4398fa,null))[_0x8c9d('0x29')](handleError(_0x4398fa,null));};var interaction_log=require(_0x8c9d('0x13'))(_0x8c9d('0x5b'));exports['accept']=function(_0x2330c8,_0x1577a9,_0xd80b19){var _0x12144a={'agent':{},'channel':_0x8c9d('0x5c')};if(_0x2330c8[_0x8c9d('0x59')]['id']){delete _0x2330c8[_0x8c9d('0x59')]['id'];}_0x2330c8['body'][_0x8c9d('0x5d')]=!![];_0x2330c8[_0x8c9d('0x59')][_0x8c9d('0x5e')]=moment()[_0x8c9d('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2330c8[_0x8c9d('0x59')][_0x8c9d('0x60')]=_0x2330c8[_0x8c9d('0x59')]['UserId']||_0x2330c8[_0x8c9d('0x61')]['id'];_0x12144a[_0x8c9d('0x62')]['id']=_0x2330c8[_0x8c9d('0x59')][_0x8c9d('0x60')];return db['ChatMessage']['find']({'where':{'id':_0x2330c8[_0x8c9d('0x52')]['id'],'UserId':null}})[_0x8c9d('0x20')](handleEntityNotFound(_0x1577a9,null))['then'](saveUpdates(_0x2330c8[_0x8c9d('0x59')],null))[_0x8c9d('0x20')](function(_0x414176){if(_0x414176){_0x12144a[_0x8c9d('0x27')]=_0x414176[_0x8c9d('0x63')]({'plain':!![]});return db[_0x8c9d('0x64')][_0x8c9d('0x5a')]({'where':{'id':_0x414176[_0x8c9d('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x1577a9,null))[_0x8c9d('0x20')](function(_0x4dec5d){if(_0x4dec5d){return _0x4dec5d[_0x8c9d('0x37')]({'UserId':_0x2330c8[_0x8c9d('0x59')]['UserId'],'read1stAt':_[_0x8c9d('0x66')](_0x4dec5d[_0x8c9d('0x67')])?moment()[_0x8c9d('0x5f')](_0x8c9d('0x68')):undefined});}return null;})[_0x8c9d('0x20')](function(_0x3a2dfe){if(_0x3a2dfe){_0x12144a['interaction']=_0x3a2dfe[_0x8c9d('0x63')]({'plain':!![]});interaction_log[_0x8c9d('0x21')](_0x8c9d('0x69'),_0x2330c8[_0x8c9d('0x61')]['id'],_0x2330c8[_0x8c9d('0x61')][_0x8c9d('0x3a')],_0x2330c8[_0x8c9d('0x61')][_0x8c9d('0x6a')],_0x12144a[_0x8c9d('0x6b')]['id'],_0x2330c8[_0x8c9d('0x59')]?JSON[_0x8c9d('0x6c')](_0x2330c8[_0x8c9d('0x59')]):'null');return respondWithRpcPromise(_0x8c9d('0x6d'),_0x8c9d('0x6e'),_0x12144a);}return null;})[_0x8c9d('0x20')](function(_0x166706){var _0x1037bc=_0x8c9d('0x6f')+_0x166706['message']['ContactId'];return db[_0x8c9d('0x70')][_0x8c9d('0x40')](_0x1037bc,{'type':db['Sequelize'][_0x8c9d('0x71')][_0x8c9d('0x72')],'raw':!![]})[_0x8c9d('0x20')](function(_0x2e8110){return _0x2e8110;});})[_0x8c9d('0x20')](function(_0x555688){if(_0x555688){_0x12144a[_0x8c9d('0x27')][_0x8c9d('0x73')]=_0x555688[0x0];if(!_0x2330c8['body'][_0x8c9d('0x60')])return;return db[_0x8c9d('0x74')][_0x8c9d('0x5a')]({'where':{'id':_0x2330c8[_0x8c9d('0x59')][_0x8c9d('0x60')],'role':_0x8c9d('0x62')},'attributes':['id','name',_0x8c9d('0x75'),_0x8c9d('0x76'),_0x8c9d('0x77')],'raw':!![]});}return null;})[_0x8c9d('0x20')](function(_0xcae539){if(!_0xcae539)return null;_0x12144a['message'][_0x8c9d('0x62')]=_0xcae539;return _0x12144a;})[_0x8c9d('0x20')](function(_0x5923f0){if(_0x5923f0){if(_0x2330c8[_0x8c9d('0x59')][_0x8c9d('0x78')]){_0x12144a['message'][_0x8c9d('0x79')]=util[_0x8c9d('0x5f')](_0x8c9d('0x7a'),_0x2330c8[_0x8c9d('0x61')]['name']);_0x12144a[_0x8c9d('0x27')][_0x8c9d('0x7b')]=_0x12144a['channel'];_0x12144a['message']['motionChannel']=_0x12144a['channel'];_0x12144a[_0x8c9d('0x27')][_0x8c9d('0x7c')]=_0x8c9d('0x7d');return respondWithRpcPromise(_0x8c9d('0x7e'),'EventManager',{'event':'acceptmessage','message':_[_0x8c9d('0x56')](_0x12144a[_0x8c9d('0x27')],JSON[_0x8c9d('0x7f')](_0x12144a[_0x8c9d('0x6b')][_0x8c9d('0x80')]))},client9002)[_0x8c9d('0x20')](function(){return _0x12144a;});}return _0x12144a;}return null;})[_0x8c9d('0x20')](respondWithResult(_0x1577a9,null))[_0x8c9d('0x29')](handleError(_0x1577a9,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x8c9d('0x35')]=function(_0x5a0330,_0x51ff8b,_0x40a1b4){var _0x54af8f={'agent':{},'channel':'chat'};if(_0x5a0330['body']['id']){delete _0x5a0330[_0x8c9d('0x59')]['id'];}_0x5a0330[_0x8c9d('0x59')][_0x8c9d('0x60')]=_0x5a0330['body']['UserId']||_0x5a0330[_0x8c9d('0x61')]['id'];_0x54af8f[_0x8c9d('0x62')]['id']=_0x5a0330[_0x8c9d('0x59')]['UserId'];return db['ChatMessage'][_0x8c9d('0x5a')]({'where':{'id':_0x5a0330[_0x8c9d('0x52')]['id'],'UserId':null}})[_0x8c9d('0x20')](handleEntityNotFound(_0x51ff8b,null))[_0x8c9d('0x20')](function(_0x4cc6ae){if(_0x4cc6ae){_0x54af8f[_0x8c9d('0x27')]=_0x4cc6ae[_0x8c9d('0x63')]({'plain':!![]});return db[_0x8c9d('0x64')]['find']({'where':{'id':_0x4cc6ae[_0x8c9d('0x65')]}});}return null;})[_0x8c9d('0x20')](handleEntityNotFound(_0x51ff8b,null))[_0x8c9d('0x20')](function(_0x2afd63){if(_0x2afd63){_0x54af8f[_0x8c9d('0x6b')]=_0x2afd63[_0x8c9d('0x63')]({'plain':!![]});interaction_log[_0x8c9d('0x21')](_0x8c9d('0x81'),_0x5a0330[_0x8c9d('0x61')]['id'],_0x5a0330[_0x8c9d('0x61')][_0x8c9d('0x3a')],_0x5a0330[_0x8c9d('0x61')]['role'],_0x54af8f[_0x8c9d('0x6b')]['id'],_0x5a0330[_0x8c9d('0x59')]?JSON['stringify'](_0x5a0330['body']):_0x8c9d('0x82'));return respondWithRpcPromise('RejectMessage',_0x8c9d('0x83'),_0x54af8f);}return null;})[_0x8c9d('0x20')](function(_0x1dbbc8){var _0x25e71e=_0x8c9d('0x6f')+_0x1dbbc8['message'][_0x8c9d('0x84')];return db['sequelize'][_0x8c9d('0x40')](_0x25e71e,{'type':db['Sequelize'][_0x8c9d('0x71')][_0x8c9d('0x72')],'raw':!![]})['then'](function(_0x97c63a){return _0x97c63a;});})[_0x8c9d('0x20')](function(_0x3d23fe){if(_0x3d23fe){_0x54af8f[_0x8c9d('0x27')][_0x8c9d('0x73')]=_0x3d23fe[0x0];if(!_0x5a0330['body'][_0x8c9d('0x60')])return;return db[_0x8c9d('0x74')][_0x8c9d('0x5a')]({'where':{'id':_0x5a0330[_0x8c9d('0x59')][_0x8c9d('0x60')],'role':'agent'},'attributes':['id',_0x8c9d('0x3a'),_0x8c9d('0x75'),_0x8c9d('0x76'),_0x8c9d('0x77')],'raw':!![]});}return null;})[_0x8c9d('0x20')](function(_0x27bccf){if(!_0x27bccf)return null;_0x54af8f[_0x8c9d('0x27')][_0x8c9d('0x62')]=_0x27bccf;return _0x54af8f;})[_0x8c9d('0x20')](function(_0x190309){if(_0x190309){_0x190309[_0x8c9d('0x27')][_0x8c9d('0x79')]=util['format'](_0x8c9d('0x7a'),_0x5a0330[_0x8c9d('0x61')][_0x8c9d('0x3a')]);_0x190309[_0x8c9d('0x27')][_0x8c9d('0x7b')]=_0x54af8f['channel'];_0x190309['message']['motionChannel']=_0x54af8f['channel'];_0x190309['message'][_0x8c9d('0x7c')]=_0x8c9d('0x35');respondWithRpcPromise(_0x8c9d('0x7e'),_0x8c9d('0x7e'),{'event':_0x8c9d('0x85'),'message':_[_0x8c9d('0x56')](_0x54af8f[_0x8c9d('0x27')],JSON[_0x8c9d('0x7f')](_0x54af8f['interaction'][_0x8c9d('0x80')]))},client9002);return _0x54af8f;}return null;})[_0x8c9d('0x20')](respondWithResult(_0x51ff8b,null))[_0x8c9d('0x29')](handleError(_0x51ff8b,null));}; \ No newline at end of file +var _0x0216=['send','index','ChatMessage','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','include','show','params','keys','includeAll','find','create','body','describe','chat-interactions','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','email','manual','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','parse','formData','reject','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','fullname','internal','event','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','destroy','name'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x0216,0x1e5));var _0x6021=function(_0xc2e996,_0x5c79e1){_0xc2e996=_0xc2e996-0x0;var _0x27cea2=_0x0216[_0xc2e996];return _0x27cea2;};'use strict';var emlformat=require(_0x6021('0x0'));var rimraf=require(_0x6021('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6021('0x2'));var rp=require(_0x6021('0x3'));var moment=require(_0x6021('0x4'));var BPromise=require(_0x6021('0x5'));var Mustache=require(_0x6021('0x6'));var util=require(_0x6021('0x7'));var path=require(_0x6021('0x8'));var sox=require(_0x6021('0x9'));var csv=require(_0x6021('0xa'));var ejs=require(_0x6021('0xb'));var fs=require('fs');var fs_extra=require(_0x6021('0xc'));var _=require('lodash');var squel=require(_0x6021('0xd'));var crypto=require(_0x6021('0xe'));var jsforce=require(_0x6021('0xf'));var deskjs=require(_0x6021('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6021('0x11'));var Papa=require(_0x6021('0x12'));var Redis=require(_0x6021('0x13'));var authService=require(_0x6021('0x14'));var qs=require(_0x6021('0x15'));var as=require(_0x6021('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6021('0x17'))(_0x6021('0x18'));var utils=require(_0x6021('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x6021('0x1a'));var db=require(_0x6021('0x1b'))['db'];config[_0x6021('0x1c')]=_[_0x6021('0x1d')](config['redis'],{'host':_0x6021('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6021('0x1c')]));require(_0x6021('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x6021('0x20')][_0x6021('0x21')]({'port':0x232c});var client9002=jayson[_0x6021('0x20')][_0x6021('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xc04394,_0x5d02e6,_0x5053ba,_0x1ba6e5){return new BPromise(function(_0x1ef25a,_0x818463){var _0x594941=_0x1ba6e5||client;return _0x594941[_0x6021('0x22')](_0xc04394,_0x5053ba)[_0x6021('0x23')](function(_0x41e6f0){logger[_0x6021('0x24')](_0x6021('0x25'),_0x5d02e6,'request\x20sent');logger[_0x6021('0x26')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5d02e6,'request\x20sent',JSON[_0x6021('0x27')](_0x41e6f0));if(_0x41e6f0[_0x6021('0x28')]){if(_0x41e6f0[_0x6021('0x28')][_0x6021('0x29')]===0x1f4){logger[_0x6021('0x28')](_0x6021('0x25'),_0x5d02e6,_0x41e6f0['error'][_0x6021('0x2a')]);return _0x818463(_0x41e6f0[_0x6021('0x28')]['message']);}logger[_0x6021('0x28')](_0x6021('0x25'),_0x5d02e6,_0x41e6f0[_0x6021('0x28')][_0x6021('0x2a')]);return _0x1ef25a(_0x41e6f0[_0x6021('0x28')][_0x6021('0x2a')]);}else{logger[_0x6021('0x24')](_0x6021('0x25'),_0x5d02e6,'request\x20sent');_0x1ef25a(_0x41e6f0[_0x6021('0x2b')][_0x6021('0x2a')]);}})[_0x6021('0x2c')](function(_0x39982b){logger['error'](_0x6021('0x25'),_0x5d02e6,_0x39982b);_0x818463(_0x39982b);});});}function respondWithStatusCode(_0xcf04e6,_0x461de6){_0x461de6=_0x461de6||0xcc;return function(_0x33df87){if(_0x33df87){return _0xcf04e6[_0x6021('0x2d')](_0x461de6);}return _0xcf04e6[_0x6021('0x2e')](_0x461de6)[_0x6021('0x2f')]();};}function respondWithResult(_0x42589b,_0x4fff0b){_0x4fff0b=_0x4fff0b||0xc8;return function(_0x558353){if(_0x558353){return _0x42589b[_0x6021('0x2e')](_0x4fff0b)[_0x6021('0x30')](_0x558353);}};}function respondWithFilteredResult(_0x2bb4c2,_0x1b9046){return function(_0x124fdd){if(_0x124fdd){var _0x7e0f6d=typeof _0x1b9046[_0x6021('0x31')]==='undefined'&&typeof _0x1b9046[_0x6021('0x32')]===_0x6021('0x33');var _0x6fe3fc=_0x124fdd[_0x6021('0x34')];var _0x375b4e=_0x7e0f6d?0x0:_0x1b9046['offset'];var _0xb38f3c=_0x7e0f6d?_0x124fdd[_0x6021('0x34')]:_0x1b9046[_0x6021('0x31')]+_0x1b9046[_0x6021('0x32')];var _0x2e34b9;if(_0xb38f3c>=_0x6fe3fc){_0xb38f3c=_0x6fe3fc;_0x2e34b9=0xc8;}else{_0x2e34b9=0xce;}_0x2bb4c2['status'](_0x2e34b9);return _0x2bb4c2[_0x6021('0x35')](_0x6021('0x36'),_0x375b4e+'-'+_0xb38f3c+'/'+_0x6fe3fc)['json'](_0x124fdd);}return null;};}function patchUpdates(_0x35cbe1){return function(_0x5d9391){try{jsonpatch['apply'](_0x5d9391,_0x35cbe1,!![]);}catch(_0x3bb1b0){return BPromise['reject'](_0x3bb1b0);}return _0x5d9391[_0x6021('0x37')]();};}function saveUpdates(_0x42bf8e,_0x516204){return function(_0x29d2f4){if(_0x29d2f4){return _0x29d2f4[_0x6021('0x38')](_0x42bf8e)[_0x6021('0x23')](function(_0x321c31){return _0x321c31;});}return null;};}function removeEntity(_0x4807a7,_0x2448c7){return function(_0x471542){if(_0x471542){return _0x471542[_0x6021('0x39')]()[_0x6021('0x23')](function(){_0x4807a7[_0x6021('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ca702,_0x5e3944){return function(_0x2ba1ed){if(!_0x2ba1ed){_0x3ca702[_0x6021('0x2d')](0x194);}return _0x2ba1ed;};}function handleError(_0x161ed1,_0x118038){_0x118038=_0x118038||0x1f4;return function(_0x355dd0){logger[_0x6021('0x28')](_0x355dd0['stack']);if(_0x355dd0['name']){delete _0x355dd0[_0x6021('0x3a')];}_0x161ed1[_0x6021('0x2e')](_0x118038)[_0x6021('0x3b')](_0x355dd0);};}exports[_0x6021('0x3c')]=function(_0xe731a,_0x867a8f){var _0x221f46={},_0x4f089d={},_0xbb9172={'count':0x0,'rows':[]};var _0x512315=_['map'](db[_0x6021('0x3d')][_0x6021('0x3e')],function(_0x1d43f7){return{'name':_0x1d43f7[_0x6021('0x3f')],'type':_0x1d43f7[_0x6021('0x40')]['key']};});_0x4f089d[_0x6021('0x41')]=_['map'](_0x512315,_0x6021('0x3a'));_0x4f089d['query']=_['keys'](_0xe731a[_0x6021('0x42')]);_0x4f089d[_0x6021('0x43')]=_['intersection'](_0x4f089d[_0x6021('0x41')],_0x4f089d[_0x6021('0x42')]);_0x221f46[_0x6021('0x44')]=_[_0x6021('0x45')](_0x4f089d[_0x6021('0x41')],qs[_0x6021('0x46')](_0xe731a[_0x6021('0x42')][_0x6021('0x46')]));_0x221f46['attributes']=_0x221f46[_0x6021('0x44')][_0x6021('0x47')]?_0x221f46['attributes']:_0x4f089d[_0x6021('0x41')];if(!_0xe731a[_0x6021('0x42')][_0x6021('0x48')](_0x6021('0x49'))){_0x221f46[_0x6021('0x32')]=qs[_0x6021('0x32')](_0xe731a['query'][_0x6021('0x32')]);_0x221f46[_0x6021('0x31')]=qs[_0x6021('0x31')](_0xe731a['query'][_0x6021('0x31')]);}_0x221f46[_0x6021('0x4a')]=qs[_0x6021('0x4b')](_0xe731a[_0x6021('0x42')]['sort']);_0x221f46[_0x6021('0x4c')]=qs[_0x6021('0x43')](_['pick'](_0xe731a[_0x6021('0x42')],_0x4f089d['filters']),_0x512315);if(_0xe731a[_0x6021('0x42')][_0x6021('0x4d')]){_0x221f46[_0x6021('0x4c')]=_[_0x6021('0x4e')](_0x221f46[_0x6021('0x4c')],{'$or':_[_0x6021('0x4f')](_0x512315,function(_0xae2a6d){if(_0xae2a6d['type']!==_0x6021('0x50')){var _0x15080d={};_0x15080d[_0xae2a6d[_0x6021('0x3a')]]={'$like':'%'+_0xe731a[_0x6021('0x42')][_0x6021('0x4d')]+'%'};return _0x15080d;}})});}_0x221f46=_[_0x6021('0x4e')]({},_0x221f46,_0xe731a[_0x6021('0x51')]);var _0xfaca03={'where':_0x221f46[_0x6021('0x4c')]};return db[_0x6021('0x3d')][_0x6021('0x34')](_0xfaca03)[_0x6021('0x23')](function(_0x40d33c){_0xbb9172['count']=_0x40d33c;if(_0xe731a[_0x6021('0x42')]['includeAll']){_0x221f46[_0x6021('0x52')]=[{'all':!![]}];}return db[_0x6021('0x3d')]['findAll'](_0x221f46);})[_0x6021('0x23')](function(_0x55d285){_0xbb9172['rows']=_0x55d285;return _0xbb9172;})['then'](respondWithFilteredResult(_0x867a8f,_0x221f46))[_0x6021('0x2c')](handleError(_0x867a8f,null));};exports[_0x6021('0x53')]=function(_0x4c6aa4,_0x4c324d){var _0x2e0c5a={'raw':!![],'where':{'id':_0x4c6aa4[_0x6021('0x54')]['id']}},_0x424736={};_0x424736[_0x6021('0x41')]=_[_0x6021('0x55')](db[_0x6021('0x3d')][_0x6021('0x3e')]);_0x424736[_0x6021('0x42')]=_[_0x6021('0x55')](_0x4c6aa4[_0x6021('0x42')]);_0x424736[_0x6021('0x43')]=_[_0x6021('0x45')](_0x424736[_0x6021('0x41')],_0x424736[_0x6021('0x42')]);_0x2e0c5a['attributes']=_['intersection'](_0x424736[_0x6021('0x41')],qs[_0x6021('0x46')](_0x4c6aa4[_0x6021('0x42')][_0x6021('0x46')]));_0x2e0c5a[_0x6021('0x44')]=_0x2e0c5a['attributes'][_0x6021('0x47')]?_0x2e0c5a['attributes']:_0x424736[_0x6021('0x41')];if(_0x4c6aa4[_0x6021('0x42')][_0x6021('0x56')]){_0x2e0c5a[_0x6021('0x52')]=[{'all':!![]}];}_0x2e0c5a=_[_0x6021('0x4e')]({},_0x2e0c5a,_0x4c6aa4[_0x6021('0x51')]);return db[_0x6021('0x3d')][_0x6021('0x57')](_0x2e0c5a)['then'](handleEntityNotFound(_0x4c324d,null))['then'](respondWithResult(_0x4c324d,null))[_0x6021('0x2c')](handleError(_0x4c324d,null));};exports[_0x6021('0x58')]=function(_0x1ea610,_0x1e3c9e){return db[_0x6021('0x3d')]['create'](_0x1ea610[_0x6021('0x59')],{})[_0x6021('0x23')](respondWithResult(_0x1e3c9e,0xc9))[_0x6021('0x2c')](handleError(_0x1e3c9e,null));};exports[_0x6021('0x38')]=function(_0x57353b,_0x360b2c){if(_0x57353b['body']['id']){delete _0x57353b[_0x6021('0x59')]['id'];}return db[_0x6021('0x3d')]['find']({'where':{'id':_0x57353b['params']['id']}})[_0x6021('0x23')](handleEntityNotFound(_0x360b2c,null))[_0x6021('0x23')](saveUpdates(_0x57353b[_0x6021('0x59')],null))['then'](respondWithResult(_0x360b2c,null))['catch'](handleError(_0x360b2c,null));};exports[_0x6021('0x39')]=function(_0x4bb755,_0xbe59a3){return db['ChatMessage'][_0x6021('0x57')]({'where':{'id':_0x4bb755['params']['id']}})['then'](handleEntityNotFound(_0xbe59a3,null))[_0x6021('0x23')](removeEntity(_0xbe59a3,null))[_0x6021('0x2c')](handleError(_0xbe59a3,null));};exports[_0x6021('0x5a')]=function(_0x2534d0,_0xba5462){return db[_0x6021('0x3d')][_0x6021('0x5a')]()[_0x6021('0x23')](respondWithResult(_0xba5462,null))[_0x6021('0x2c')](handleError(_0xba5462,null));};var interaction_log=require(_0x6021('0x17'))(_0x6021('0x5b'));exports['accept']=function(_0x4552ba,_0x595ea4,_0x1e0ee0){var _0x5a6fad={'agent':{},'channel':'chat'};if(_0x4552ba['body']['id']){delete _0x4552ba[_0x6021('0x59')]['id'];}_0x4552ba['body'][_0x6021('0x5c')]=!![];_0x4552ba[_0x6021('0x59')]['readAt']=moment()[_0x6021('0x5d')](_0x6021('0x5e'));_0x4552ba[_0x6021('0x59')][_0x6021('0x5f')]=_0x4552ba[_0x6021('0x59')]['UserId']||_0x4552ba[_0x6021('0x60')]['id'];_0x5a6fad[_0x6021('0x61')]['id']=_0x4552ba[_0x6021('0x59')][_0x6021('0x5f')];return db[_0x6021('0x3d')][_0x6021('0x57')]({'where':{'id':_0x4552ba[_0x6021('0x54')]['id'],'UserId':null}})[_0x6021('0x23')](handleEntityNotFound(_0x595ea4,null))[_0x6021('0x23')](saveUpdates(_0x4552ba[_0x6021('0x59')],null))[_0x6021('0x23')](function(_0x25d128){if(_0x25d128){_0x5a6fad[_0x6021('0x2a')]=_0x25d128[_0x6021('0x62')]({'plain':!![]});return db[_0x6021('0x63')][_0x6021('0x57')]({'where':{'id':_0x25d128[_0x6021('0x64')]}});}return null;})[_0x6021('0x23')](handleEntityNotFound(_0x595ea4,null))['then'](function(_0x52a1e4){if(_0x52a1e4){return _0x52a1e4[_0x6021('0x38')]({'UserId':_0x4552ba[_0x6021('0x59')]['UserId'],'read1stAt':_[_0x6021('0x65')](_0x52a1e4[_0x6021('0x66')])?moment()[_0x6021('0x5d')](_0x6021('0x5e')):undefined});}return null;})[_0x6021('0x23')](function(_0x5418e8){if(_0x5418e8){_0x5a6fad[_0x6021('0x67')]=_0x5418e8[_0x6021('0x62')]({'plain':!![]});interaction_log[_0x6021('0x24')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4552ba['user']['id'],_0x4552ba[_0x6021('0x60')][_0x6021('0x3a')],_0x4552ba[_0x6021('0x60')][_0x6021('0x68')],_0x5a6fad[_0x6021('0x67')]['id'],_0x4552ba[_0x6021('0x59')]?JSON['stringify'](_0x4552ba[_0x6021('0x59')]):_0x6021('0x69'));return respondWithRpcPromise(_0x6021('0x6a'),_0x6021('0x6b'),_0x5a6fad);}return null;})[_0x6021('0x23')](function(_0x2510bf){var _0x56cfb7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2510bf[_0x6021('0x2a')][_0x6021('0x6c')];return db[_0x6021('0x6d')]['query'](_0x56cfb7,{'type':db[_0x6021('0x6e')]['QueryTypes'][_0x6021('0x6f')],'raw':!![]})[_0x6021('0x23')](function(_0x1ed443){return _0x1ed443;});})['then'](function(_0x3ed2b2){if(_0x3ed2b2){_0x5a6fad[_0x6021('0x2a')][_0x6021('0x70')]=_0x3ed2b2[0x0];if(!_0x4552ba['body'][_0x6021('0x5f')])return;return db[_0x6021('0x71')][_0x6021('0x57')]({'where':{'id':_0x4552ba[_0x6021('0x59')][_0x6021('0x5f')],'role':_0x6021('0x61')},'attributes':['id',_0x6021('0x3a'),'fullname',_0x6021('0x72'),'internal'],'raw':!![]});}return null;})[_0x6021('0x23')](function(_0x2f7823){if(!_0x2f7823)return null;_0x5a6fad[_0x6021('0x2a')]['agent']=_0x2f7823;return _0x5a6fad;})[_0x6021('0x23')](function(_0x1ecf13){if(_0x1ecf13){if(_0x4552ba['body'][_0x6021('0x73')]){_0x5a6fad[_0x6021('0x2a')][_0x6021('0x74')]=util[_0x6021('0x5d')](_0x6021('0x75'),_0x4552ba[_0x6021('0x60')][_0x6021('0x3a')]);_0x5a6fad['message'][_0x6021('0x76')]=_0x5a6fad[_0x6021('0x76')];_0x5a6fad[_0x6021('0x2a')][_0x6021('0x77')]=_0x5a6fad[_0x6021('0x76')];_0x5a6fad[_0x6021('0x2a')]['event']=_0x6021('0x78');return respondWithRpcPromise(_0x6021('0x79'),_0x6021('0x79'),{'event':_0x6021('0x7a'),'message':_[_0x6021('0x4e')](_0x5a6fad['message'],JSON[_0x6021('0x7b')](_0x5a6fad[_0x6021('0x67')][_0x6021('0x7c')]))},client9002)[_0x6021('0x23')](function(){return _0x5a6fad;});}return _0x5a6fad;}return null;})[_0x6021('0x23')](respondWithResult(_0x595ea4,null))[_0x6021('0x2c')](handleError(_0x595ea4,null));};var interaction_log=require(_0x6021('0x17'))(_0x6021('0x5b'));exports[_0x6021('0x7d')]=function(_0x10986b,_0x991236,_0x201615){var _0x12bad2={'agent':{},'channel':_0x6021('0x7e')};if(_0x10986b[_0x6021('0x59')]['id']){delete _0x10986b[_0x6021('0x59')]['id'];}_0x10986b[_0x6021('0x59')]['UserId']=_0x10986b[_0x6021('0x59')][_0x6021('0x5f')]||_0x10986b['user']['id'];_0x12bad2[_0x6021('0x61')]['id']=_0x10986b[_0x6021('0x59')][_0x6021('0x5f')];return db[_0x6021('0x3d')]['find']({'where':{'id':_0x10986b[_0x6021('0x54')]['id'],'UserId':null}})[_0x6021('0x23')](handleEntityNotFound(_0x991236,null))[_0x6021('0x23')](function(_0x265368){if(_0x265368){_0x12bad2[_0x6021('0x2a')]=_0x265368['get']({'plain':!![]});return db[_0x6021('0x63')][_0x6021('0x57')]({'where':{'id':_0x265368[_0x6021('0x64')]}});}return null;})[_0x6021('0x23')](handleEntityNotFound(_0x991236,null))[_0x6021('0x23')](function(_0x240359){if(_0x240359){_0x12bad2[_0x6021('0x67')]=_0x240359[_0x6021('0x62')]({'plain':!![]});interaction_log[_0x6021('0x24')](_0x6021('0x7f'),_0x10986b['user']['id'],_0x10986b[_0x6021('0x60')]['name'],_0x10986b['user'][_0x6021('0x68')],_0x12bad2[_0x6021('0x67')]['id'],_0x10986b[_0x6021('0x59')]?JSON[_0x6021('0x27')](_0x10986b['body']):_0x6021('0x69'));return respondWithRpcPromise(_0x6021('0x80'),_0x6021('0x81'),_0x12bad2);}return null;})[_0x6021('0x23')](function(_0x187f16){var _0xc41ed7=_0x6021('0x82')+_0x187f16[_0x6021('0x2a')][_0x6021('0x6c')];return db[_0x6021('0x6d')][_0x6021('0x42')](_0xc41ed7,{'type':db[_0x6021('0x6e')][_0x6021('0x83')]['SELECT'],'raw':!![]})['then'](function(_0x206e58){return _0x206e58;});})['then'](function(_0x3a3529){if(_0x3a3529){_0x12bad2[_0x6021('0x2a')][_0x6021('0x70')]=_0x3a3529[0x0];if(!_0x10986b['body']['UserId'])return;return db['User'][_0x6021('0x57')]({'where':{'id':_0x10986b['body'][_0x6021('0x5f')],'role':_0x6021('0x61')},'attributes':['id',_0x6021('0x3a'),_0x6021('0x84'),'email',_0x6021('0x85')],'raw':!![]});}return null;})['then'](function(_0x4f25ae){if(!_0x4f25ae)return null;_0x12bad2['message']['agent']=_0x4f25ae;return _0x12bad2;})[_0x6021('0x23')](function(_0x36a22a){if(_0x36a22a){_0x36a22a[_0x6021('0x2a')][_0x6021('0x74')]=util[_0x6021('0x5d')]('SIP/%s',_0x10986b[_0x6021('0x60')]['name']);_0x36a22a[_0x6021('0x2a')]['channel']=_0x12bad2['channel'];_0x36a22a[_0x6021('0x2a')]['motionChannel']=_0x12bad2[_0x6021('0x76')];_0x36a22a[_0x6021('0x2a')][_0x6021('0x86')]='reject';respondWithRpcPromise(_0x6021('0x79'),_0x6021('0x79'),{'event':_0x6021('0x87'),'message':_[_0x6021('0x4e')](_0x12bad2[_0x6021('0x2a')],JSON[_0x6021('0x7b')](_0x12bad2[_0x6021('0x67')][_0x6021('0x7c')]))},client9002);return _0x12bad2;}return null;})[_0x6021('0x23')](respondWithResult(_0x991236,null))[_0x6021('0x2c')](handleError(_0x991236,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 847a72a..cea2f68 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 _0xdd03=['emit','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x3a6e4b,_0x118cd9){var _0x36572d=function(_0x2a53cf){while(--_0x2a53cf){_0x3a6e4b['push'](_0x3a6e4b['shift']());}};_0x36572d(++_0x118cd9);}(_0xdd03,0x12a));var _0x3dd0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xdd03[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x3dd0('0x0'))['db'][_0x3dd0('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3dd0('0x2')](0x0);var events={'afterCreate':_0x3dd0('0x3'),'afterUpdate':_0x3dd0('0x4'),'afterDestroy':_0x3dd0('0x5')};function emitEvent(_0x97a444){return function(_0x37c4e8,_0x24706c,_0x2f8292){ChatMessageEvents[_0x3dd0('0x6')](_0x97a444+':'+_0x37c4e8['id'],_0x37c4e8);ChatMessageEvents[_0x3dd0('0x6')](_0x97a444,_0x37c4e8);_0x2f8292(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x3dd0('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x219c=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x4a559b,_0x1e9fd1){var _0x413d71=function(_0x4bcbfa){while(--_0x4bcbfa){_0x4a559b['push'](_0x4a559b['shift']());}};_0x413d71(++_0x1e9fd1);}(_0x219c,0x10c));var _0xc219=function(_0x573b80,_0x2298e0){_0x573b80=_0x573b80-0x0;var _0x3cee19=_0x219c[_0x573b80];return _0x3cee19;};'use strict';var EventEmitter=require(_0xc219('0x0'));var ChatMessage=require(_0xc219('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc219('0x2'),'afterUpdate':_0xc219('0x3'),'afterDestroy':_0xc219('0x4')};function emitEvent(_0x533012){return function(_0x7f5557,_0x431f8c,_0xb02fda){ChatMessageEvents['emit'](_0x533012+':'+_0x7f5557['id'],_0x7f5557);ChatMessageEvents['emit'](_0x533012,_0x7f5557);_0xb02fda(null);};}for(var e in events){if(events[_0xc219('0x5')](e)){var event=events[e];ChatMessage[_0xc219('0x6')](e,emitEvent(event));}}module[_0xc219('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 cec482d..0c99036 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 _0x1f27=['./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3424c2,_0x527fda){var _0x493a18=function(_0x2d7197){while(--_0x2d7197){_0x3424c2['push'](_0x3424c2['shift']());}};_0x493a18(++_0x527fda);}(_0x1f27,0x13d));var _0x71f2=function(_0x8c0045,_0x2707d8){_0x8c0045=_0x8c0045-0x0;var _0x3e316e=_0x1f27[_0x8c0045];return _0x3e316e;};'use strict';var _=require(_0x71f2('0x0'));var util=require(_0x71f2('0x1'));var logger=require(_0x71f2('0x2'))(_0x71f2('0x3'));var moment=require(_0x71f2('0x4'));var BPromise=require(_0x71f2('0x5'));var rp=require(_0x71f2('0x6'));var fs=require('fs');var path=require(_0x71f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x71f2('0x8'));module[_0x71f2('0x9')]=function(_0xd0b66,_0x4411d1){return _0xd0b66['define'](_0x71f2('0xa'),attributes,{'tableName':_0x71f2('0xb'),'paranoid':![],'indexes':[{'name':_0x71f2('0xc'),'fields':[_0x71f2('0xd')],'type':_0x71f2('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xef5a0e,_0x3ff522,_0x31a36c){var _0x7c36d2=_0xd0b66['models'];var _0x22923e=_0xef5a0e['get']({'plain':!![]});if(_0x22923e[_0x71f2('0xf')]['toLowerCase']()==='in'||_0x22923e['direction'][_0x71f2('0x10')]()===_0x71f2('0x11')&&!_0x22923e[_0x71f2('0x12')]&&!_[_0x71f2('0x13')](_0x22923e[_0x71f2('0x14')])){_0x7c36d2['ChatInteraction']['findOne']({'where':{'id':_0x22923e['ChatInteractionId']}})['then'](function(_0x1bfc7c){if(_0x1bfc7c){_0x1bfc7c[_0x71f2('0x15')]({'lastMsgAt':_0x22923e['createdAt'],'lastMsgDirection':_0x22923e[_0x71f2('0xf')][_0x71f2('0x10')]()});}})['catch'](function(_0x113215){console[_0x71f2('0x16')](_0x113215);});}_0x31a36c();}},'charset':_0x71f2('0x17'),'collate':_0x71f2('0x18')});}; \ No newline at end of file +var _0x1bb7=['get','direction','toLowerCase','out','isNil','ChatInteraction','findOne','ChatInteractionId','createdAt','catch','utf8mb4','lodash','util','api','path','rimraf','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0x1bb7,0x192));var _0x71bb=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x1bb7[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x71bb('0x0'));var util=require(_0x71bb('0x1'));var logger=require('../../config/logger')(_0x71bb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x71bb('0x3'));var rimraf=require(_0x71bb('0x4'));var config=require('../../config/environment');var attributes=require(_0x71bb('0x5'));module[_0x71bb('0x6')]=function(_0x1ec005,_0x3890e3){return _0x1ec005['define'](_0x71bb('0x7'),attributes,{'tableName':_0x71bb('0x8'),'paranoid':![],'indexes':[{'name':_0x71bb('0x9'),'fields':['body'],'type':_0x71bb('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2028e8,_0x6c4e57,_0x3c0aa0){var _0x446298=_0x1ec005[_0x71bb('0xb')];var _0x211b78=_0x2028e8[_0x71bb('0xc')]({'plain':!![]});if(_0x211b78[_0x71bb('0xd')][_0x71bb('0xe')]()==='in'||_0x211b78[_0x71bb('0xd')][_0x71bb('0xe')]()===_0x71bb('0xf')&&!_0x211b78['secret']&&!_[_0x71bb('0x10')](_0x211b78['UserId'])){_0x446298[_0x71bb('0x11')][_0x71bb('0x12')]({'where':{'id':_0x211b78[_0x71bb('0x13')]}})['then'](function(_0x466dac){if(_0x466dac){_0x466dac['update']({'lastMsgAt':_0x211b78[_0x71bb('0x14')],'lastMsgDirection':_0x211b78['direction'][_0x71bb('0xe')]()});}})[_0x71bb('0x15')](function(_0x59d82e){console['error'](_0x59d82e);});}_0x3c0aa0();}},'charset':_0x71bb('0x16'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 5196cdb..3d1fd21 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 _0xaffe=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','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','code','message','result','CreateChatMessage','body','options','raw','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xaffe,0x158));var _0xeaff=function(_0x1e871d,_0x50eb6c){_0x1e871d=_0x1e871d-0x0;var _0x45a504=_0xaffe[_0x1e871d];return _0x45a504;};'use strict';var _=require(_0xeaff('0x0'));var util=require(_0xeaff('0x1'));var moment=require(_0xeaff('0x2'));var BPromise=require('bluebird');var rs=require(_0xeaff('0x3'));var fs=require('fs');var Redis=require(_0xeaff('0x4'));var db=require(_0xeaff('0x5'))['db'];var utils=require(_0xeaff('0x6'));var logger=require(_0xeaff('0x7'))(_0xeaff('0x8'));var config=require(_0xeaff('0x9'));var jayson=require(_0xeaff('0xa'));var client=jayson[_0xeaff('0xb')][_0xeaff('0xc')]({'port':0x232a});config[_0xeaff('0xd')]=_[_0xeaff('0xe')](config['redis'],{'host':_0xeaff('0xf'),'port':0x18eb});var socket=require(_0xeaff('0x10'))(new Redis(config[_0xeaff('0xd')]));require('./chatMessage.socket')[_0xeaff('0x11')](socket);function respondWithRpcPromise(_0x37fa2f,_0x15b061,_0xe99b56){return new BPromise(function(_0x4f5710,_0x599853){return client[_0xeaff('0x12')](_0x37fa2f,_0xe99b56)[_0xeaff('0x13')](function(_0x20162b){logger[_0xeaff('0x14')](_0xeaff('0x15'),_0x15b061,_0xeaff('0x16'));logger[_0xeaff('0x17')](_0xeaff('0x18'),_0x15b061,_0xeaff('0x16'),JSON[_0xeaff('0x19')](_0x20162b));if(_0x20162b[_0xeaff('0x1a')]){if(_0x20162b[_0xeaff('0x1a')][_0xeaff('0x1b')]===0x1f4){logger[_0xeaff('0x1a')](_0xeaff('0x15'),_0x15b061,_0x20162b[_0xeaff('0x1a')][_0xeaff('0x1c')]);return _0x599853(_0x20162b[_0xeaff('0x1a')]['message']);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x15b061,_0x20162b[_0xeaff('0x1a')][_0xeaff('0x1c')]);return _0x4f5710(_0x20162b[_0xeaff('0x1a')][_0xeaff('0x1c')]);}else{logger[_0xeaff('0x14')]('ChatMessage,\x20%s,\x20%s',_0x15b061,'request\x20sent');_0x4f5710(_0x20162b[_0xeaff('0x1d')]['message']);}})['catch'](function(_0x7f1d8c){logger[_0xeaff('0x1a')](_0xeaff('0x15'),_0x15b061,_0x7f1d8c);_0x599853(_0x7f1d8c);});});}exports[_0xeaff('0x1e')]=function(_0x31389e){var _0x1ca445=this;return new Promise(function(_0x45cd63,_0x56d705){return db['ChatMessage']['create'](_0x31389e[_0xeaff('0x1f')],{'raw':_0x31389e['options']?_0x31389e[_0xeaff('0x20')][_0xeaff('0x21')]===undefined?!![]:![]:!![]})[_0xeaff('0x13')](function(_0x2cfcab){logger[_0xeaff('0x14')](_0xeaff('0x1e'),_0x31389e);logger[_0xeaff('0x17')](_0xeaff('0x1e'),_0x31389e,JSON[_0xeaff('0x19')](_0x2cfcab));_0x45cd63(_0x2cfcab);})[_0xeaff('0x22')](function(_0x47f440){logger[_0xeaff('0x1a')]('CreateChatMessage',_0x47f440[_0xeaff('0x1c')],_0x31389e);_0x56d705(_0x1ca445[_0xeaff('0x1a')](0x1f4,_0x47f440['message']));});});}; \ No newline at end of file +var _0x8cbe=['rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','catch','CreateChatMessage','create','body','options','raw','then','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8cbe,0x14f));var _0xe8cb=function(_0x38e471,_0x4926ba){_0x38e471=_0x38e471-0x0;var _0x5a5133=_0x8cbe[_0x38e471];return _0x5a5133;};'use strict';var _=require(_0xe8cb('0x0'));var util=require('util');var moment=require(_0xe8cb('0x1'));var BPromise=require(_0xe8cb('0x2'));var rs=require(_0xe8cb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe8cb('0x4'));var logger=require(_0xe8cb('0x5'))(_0xe8cb('0x6'));var config=require(_0xe8cb('0x7'));var jayson=require(_0xe8cb('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xe8cb('0x9')](config[_0xe8cb('0xa')],{'host':_0xe8cb('0xb'),'port':0x18eb});var socket=require(_0xe8cb('0xc'))(new Redis(config['redis']));require('./chatMessage.socket')[_0xe8cb('0xd')](socket);function respondWithRpcPromise(_0x2c3a97,_0x4a6163,_0x58a1cd){return new BPromise(function(_0x4ace01,_0x36701c){return client[_0xe8cb('0xe')](_0x2c3a97,_0x58a1cd)['then'](function(_0x45c526){logger[_0xe8cb('0xf')]('ChatMessage,\x20%s,\x20%s',_0x4a6163,_0xe8cb('0x10'));logger[_0xe8cb('0x11')](_0xe8cb('0x12'),_0x4a6163,_0xe8cb('0x10'),JSON[_0xe8cb('0x13')](_0x45c526));if(_0x45c526[_0xe8cb('0x14')]){if(_0x45c526['error'][_0xe8cb('0x15')]===0x1f4){logger[_0xe8cb('0x14')](_0xe8cb('0x16'),_0x4a6163,_0x45c526[_0xe8cb('0x14')][_0xe8cb('0x17')]);return _0x36701c(_0x45c526[_0xe8cb('0x14')]['message']);}logger['error'](_0xe8cb('0x16'),_0x4a6163,_0x45c526[_0xe8cb('0x14')][_0xe8cb('0x17')]);return _0x4ace01(_0x45c526[_0xe8cb('0x14')][_0xe8cb('0x17')]);}else{logger[_0xe8cb('0xf')](_0xe8cb('0x16'),_0x4a6163,_0xe8cb('0x10'));_0x4ace01(_0x45c526['result'][_0xe8cb('0x17')]);}})[_0xe8cb('0x18')](function(_0x9c355d){logger['error'](_0xe8cb('0x16'),_0x4a6163,_0x9c355d);_0x36701c(_0x9c355d);});});}exports[_0xe8cb('0x19')]=function(_0x37491b){var _0x7d0647=this;return new Promise(function(_0x1ffb63,_0x548eff){return db['ChatMessage'][_0xe8cb('0x1a')](_0x37491b[_0xe8cb('0x1b')],{'raw':_0x37491b[_0xe8cb('0x1c')]?_0x37491b[_0xe8cb('0x1c')][_0xe8cb('0x1d')]===undefined?!![]:![]:!![]})[_0xe8cb('0x1e')](function(_0x11dd4d){logger[_0xe8cb('0xf')](_0xe8cb('0x19'),_0x37491b);logger['debug']('CreateChatMessage',_0x37491b,JSON[_0xe8cb('0x13')](_0x11dd4d));_0x1ffb63(_0x11dd4d);})[_0xe8cb('0x18')](function(_0x2da69c){logger[_0xe8cb('0x14')](_0xe8cb('0x19'),_0x2da69c['message'],_0x37491b);_0x548eff(_0x7d0647[_0xe8cb('0x14')](0x1f4,_0x2da69c[_0xe8cb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 1e78e13..ac728d4 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 _0xe574=['update','emit','removeListener','register','./chatMessage.events','remove'];(function(_0x515cfe,_0x2d4bfb){var _0x4f91cb=function(_0x53ea7a){while(--_0x53ea7a){_0x515cfe['push'](_0x515cfe['shift']());}};_0x4f91cb(++_0x2d4bfb);}(_0xe574,0x100));var _0x4e57=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe574[_0xfae23b];return _0x200640;};'use strict';var ChatMessageEvents=require(_0x4e57('0x0'));var events=['save',_0x4e57('0x1'),_0x4e57('0x2')];function createListener(_0x3cebb9,_0xc485ee){return function(_0x9153d1){_0xc485ee[_0x4e57('0x3')](_0x3cebb9,_0x9153d1);};}function removeListener(_0x10de04,_0x44569b){return function(){ChatMessageEvents[_0x4e57('0x4')](_0x10de04,_0x44569b);};}exports[_0x4e57('0x5')]=function(_0x436174){for(var _0x2825a9=0x0,_0x588b4e=events['length'];_0x2825a9<_0x588b4e;_0x2825a9++){var _0x12ec74=events[_0x2825a9];var _0x534df1=createListener('chatMessage:'+_0x12ec74,_0x436174);ChatMessageEvents['on'](_0x12ec74,_0x534df1);}}; \ No newline at end of file +var _0x4ab0=['register','length','chatMessage:','save','remove','update'];(function(_0x6f15fe,_0x2f8696){var _0xff40f6=function(_0x517c28){while(--_0x517c28){_0x6f15fe['push'](_0x6f15fe['shift']());}};_0xff40f6(++_0x2f8696);}(_0x4ab0,0xd5));var _0x04ab=function(_0x155e2f,_0x41e9a2){_0x155e2f=_0x155e2f-0x0;var _0x680e78=_0x4ab0[_0x155e2f];return _0x680e78;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x04ab('0x0'),_0x04ab('0x1'),_0x04ab('0x2')];function createListener(_0x3d8417,_0x3a7b9f){return function(_0x51135e){_0x3a7b9f['emit'](_0x3d8417,_0x51135e);};}function removeListener(_0x45dfee,_0xb1bf2d){return function(){ChatMessageEvents['removeListener'](_0x45dfee,_0xb1bf2d);};}exports[_0x04ab('0x3')]=function(_0x2c5730){for(var _0x4edd2e=0x0,_0x3f5901=events[_0x04ab('0x4')];_0x4edd2e<_0x3f5901;_0x4edd2e++){var _0x1ff7f6=events[_0x4edd2e];var _0x4bc05e=createListener(_0x04ab('0x5')+_0x1ff7f6,_0x2c5730);ChatMessageEvents['on'](_0x1ff7f6,_0x4bc05e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 6a4f1e1..0c5e0be 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 _0xfe53=['../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','tracked','chat','create','put','/:id/accept','accept','/:id/reject','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x14855f,_0x5841d7){var _0x2d61ba=function(_0xa491ab){while(--_0xa491ab){_0x14855f['push'](_0x14855f['shift']());}};_0x2d61ba(++_0x5841d7);}(_0xfe53,0x1a9));var _0x3fe5=function(_0x8d0bf4,_0x1b0290){_0x8d0bf4=_0x8d0bf4-0x0;var _0x3f23eb=_0xfe53[_0x8d0bf4];return _0x3f23eb;};'use strict';var multer=require(_0x3fe5('0x0'));var util=require(_0x3fe5('0x1'));var path=require('path');var timeout=require(_0x3fe5('0x2'));var express=require(_0x3fe5('0x3'));var router=express[_0x3fe5('0x4')]();var fs_extra=require(_0x3fe5('0x5'));var auth=require(_0x3fe5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3fe5('0x7'));var controller=require(_0x3fe5('0x8'));router[_0x3fe5('0x9')]('/',auth[_0x3fe5('0xa')](),controller['index']);router[_0x3fe5('0x9')](_0x3fe5('0xb'),auth[_0x3fe5('0xa')](),controller[_0x3fe5('0xc')]);router[_0x3fe5('0x9')](_0x3fe5('0xd'),auth[_0x3fe5('0xa')](),controller[_0x3fe5('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x3fe5('0xf')](_0x3fe5('0x10'),'chatmessage:create'),controller[_0x3fe5('0x11')]);router[_0x3fe5('0x12')](_0x3fe5('0xd'),controller['update']);router[_0x3fe5('0x12')](_0x3fe5('0x13'),auth[_0x3fe5('0xa')](),controller[_0x3fe5('0x14')]);router['put'](_0x3fe5('0x15'),auth[_0x3fe5('0xa')](),controller['reject']);router[_0x3fe5('0x16')](_0x3fe5('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x3fe5('0x17')]=router; \ No newline at end of file +var _0x5abd=['../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','show','tracked','chatmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x5abd,0xe4));var _0xd5ab=function(_0x1f02c7,_0x53ffa1){_0x1f02c7=_0x1f02c7-0x0;var _0x3f76d2=_0x5abd[_0x1f02c7];return _0x3f76d2;};'use strict';var multer=require('multer');var util=require(_0xd5ab('0x0'));var path=require(_0xd5ab('0x1'));var timeout=require('connect-timeout');var express=require(_0xd5ab('0x2'));var router=express[_0xd5ab('0x3')]();var fs_extra=require(_0xd5ab('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd5ab('0x5'));var config=require(_0xd5ab('0x6'));var controller=require(_0xd5ab('0x7'));router[_0xd5ab('0x8')]('/',auth[_0xd5ab('0x9')](),controller[_0xd5ab('0xa')]);router[_0xd5ab('0x8')](_0xd5ab('0xb'),auth[_0xd5ab('0x9')](),controller['describe']);router[_0xd5ab('0x8')]('/:id',auth[_0xd5ab('0x9')](),controller[_0xd5ab('0xc')]);router['post']('/',auth[_0xd5ab('0x9')](),interaction[_0xd5ab('0xd')]('chat',_0xd5ab('0xe')),controller[_0xd5ab('0xf')]);router[_0xd5ab('0x10')](_0xd5ab('0x11'),controller[_0xd5ab('0x12')]);router[_0xd5ab('0x10')](_0xd5ab('0x13'),auth['isAuthenticated'](),controller[_0xd5ab('0x14')]);router[_0xd5ab('0x10')](_0xd5ab('0x15'),auth[_0xd5ab('0x9')](),controller[_0xd5ab('0x16')]);router[_0xd5ab('0x17')]('/:id',auth[_0xd5ab('0x9')](),controller[_0xd5ab('0x18')]);module[_0xd5ab('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 2b3850a..c9d335d 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 _0x5f66=['medium','TEXT','exports'];(function(_0x54236b,_0x541ffc){var _0x469b5f=function(_0x4cedfe){while(--_0x4cedfe){_0x54236b['push'](_0x54236b['shift']());}};_0x469b5f(++_0x541ffc);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'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 +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x46da90,_0x35aa67){var _0x5cc036=function(_0x5c7150){while(--_0x5c7150){_0x46da90['push'](_0x46da90['shift']());}};_0x5cc036(++_0x35aa67);}(_0x5f2f,0x73));var _0xf5f2=function(_0x13992d,_0x3029ea){_0x13992d=_0x13992d-0x0;var _0x3d15bf=_0x5f2f[_0x13992d];return _0x3d15bf;};'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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 887bc2d..eae43dd 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(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x7a54,0x106));var _0x47a5=function(_0x4cafea,_0x26b660){_0x4cafea=_0x4cafea-0x0;var _0x22f1cd=_0x7a54[_0x4cafea];return _0x22f1cd;};'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(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7a54,0x106));var _0x47a5=function(_0x349a91,_0x45583f){_0x349a91=_0x349a91-0x0;var _0x416e74=_0x7a54[_0x349a91];return _0x416e74;};'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 aab3bee..972ca38 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 _0x36c3=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x10969f,_0x11acfc){var _0x202897=function(_0x5b06b1){while(--_0x5b06b1){_0x10969f['push'](_0x10969f['shift']());}};_0x202897(++_0x11acfc);}(_0x36c3,0x1a6));var _0x336c=function(_0x5a184b,_0x457876){_0x5a184b=_0x5a184b-0x0;var _0x713964=_0x36c3[_0x5a184b];return _0x713964;};'use strict';var EventEmitter=require(_0x336c('0x0'));var ChatOfflineMessage=require(_0x336c('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x336c('0x2')](0x0);var events={'afterCreate':_0x336c('0x3'),'afterUpdate':_0x336c('0x4'),'afterDestroy':_0x336c('0x5')};function emitEvent(_0x32aed2){return function(_0x2b1194,_0x39ed12,_0x4e4c07){ChatOfflineMessageEvents[_0x336c('0x6')](_0x32aed2+':'+_0x2b1194['id'],_0x2b1194);ChatOfflineMessageEvents[_0x336c('0x6')](_0x32aed2,_0x2b1194);_0x4e4c07(null);};}for(var e in events){if(events[_0x336c('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x336c('0x8')](e,emitEvent(event));}}module[_0x336c('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xc563=['update','remove','emit','hasOwnProperty','exports','events','ChatOfflineMessage','setMaxListeners','save'];(function(_0x1c8646,_0x314662){var _0x25e8b6=function(_0x273aa3){while(--_0x273aa3){_0x1c8646['push'](_0x1c8646['shift']());}};_0x25e8b6(++_0x314662);}(_0xc563,0x137));var _0x3c56=function(_0x590766,_0x26a057){_0x590766=_0x590766-0x0;var _0x4e2f10=_0xc563[_0x590766];return _0x4e2f10;};'use strict';var EventEmitter=require(_0x3c56('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x3c56('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x3c56('0x2')](0x0);var events={'afterCreate':_0x3c56('0x3'),'afterUpdate':_0x3c56('0x4'),'afterDestroy':_0x3c56('0x5')};function emitEvent(_0x1b79f6){return function(_0x2a638f,_0x307c37,_0x3762c8){ChatOfflineMessageEvents[_0x3c56('0x6')](_0x1b79f6+':'+_0x2a638f['id'],_0x2a638f);ChatOfflineMessageEvents[_0x3c56('0x6')](_0x1b79f6,_0x2a638f);_0x3762c8(null);};}for(var e in events){if(events[_0x3c56('0x7')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x3c56('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 79709e8..312de16 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 _0x2496=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','exports'];(function(_0x1cac35,_0x32ec7a){var _0x152589=function(_0x47eed8){while(--_0x47eed8){_0x1cac35['push'](_0x1cac35['shift']());}};_0x152589(++_0x32ec7a);}(_0x2496,0x180));var _0x6249=function(_0x5b0d94,_0xe1b0ab){_0x5b0d94=_0x5b0d94-0x0;var _0x2af1e1=_0x2496[_0x5b0d94];return _0x2af1e1;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x6249('0x0')]=function(_0x2ca194){return _0x2ca194[_0x6249('0x1')](_0x6249('0x2'),attributes,{'tableName':_0x6249('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6249('0x4')});}; \ No newline at end of file +var _0xef78=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes','exports'];(function(_0x87cd98,_0x1fd56d){var _0x4a8c09=function(_0x4c60bf){while(--_0x4c60bf){_0x87cd98['push'](_0x87cd98['shift']());}};_0x4a8c09(++_0x1fd56d);}(_0xef78,0x17e));var _0x8ef7=function(_0x57870b,_0x1598f9){_0x57870b=_0x57870b-0x0;var _0xea8c41=_0xef78[_0x57870b];return _0xea8c41;};'use strict';var attributes=require(_0x8ef7('0x0'));module[_0x8ef7('0x1')]=function(_0x31ddc8){return _0x31ddc8[_0x8ef7('0x2')](_0x8ef7('0x3'),attributes,{'tableName':_0x8ef7('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8ef7('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index a3896e6..766a18d 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 _0xb425=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x23e69b,_0x2f9bf8){var _0x2fdd5a=function(_0x54b2cf){while(--_0x54b2cf){_0x23e69b['push'](_0x23e69b['shift']());}};_0x2fdd5a(++_0x2f9bf8);}(_0xb425,0x1ed));var _0x5b42=function(_0x27de45,_0x932c3d){_0x27de45=_0x27de45-0x0;var _0x51b97a=_0xb425[_0x27de45];return _0x51b97a;};'use strict';var _=require('lodash');var util=require(_0x5b42('0x0'));var moment=require(_0x5b42('0x1'));var BPromise=require(_0x5b42('0x2'));var rs=require(_0x5b42('0x3'));var fs=require('fs');var Redis=require(_0x5b42('0x4'));var db=require(_0x5b42('0x5'))['db'];var utils=require(_0x5b42('0x6'));var logger=require(_0x5b42('0x7'))(_0x5b42('0x8'));var config=require(_0x5b42('0x9'));var jayson=require(_0x5b42('0xa'));var client=jayson[_0x5b42('0xb')][_0x5b42('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa89f52,_0x37aaa4,_0x26142a){return new BPromise(function(_0x3a34e5,_0x4e6c96){return client[_0x5b42('0xd')](_0xa89f52,_0x26142a)[_0x5b42('0xe')](function(_0x42bd76){logger[_0x5b42('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x37aaa4,_0x5b42('0x10'));logger[_0x5b42('0x11')](_0x5b42('0x12'),_0x37aaa4,_0x5b42('0x10'),JSON['stringify'](_0x42bd76));if(_0x42bd76[_0x5b42('0x13')]){if(_0x42bd76['error'][_0x5b42('0x14')]===0x1f4){logger[_0x5b42('0x13')](_0x5b42('0x15'),_0x37aaa4,_0x42bd76[_0x5b42('0x13')][_0x5b42('0x16')]);return _0x4e6c96(_0x42bd76[_0x5b42('0x13')][_0x5b42('0x16')]);}logger[_0x5b42('0x13')](_0x5b42('0x15'),_0x37aaa4,_0x42bd76[_0x5b42('0x13')][_0x5b42('0x16')]);return _0x3a34e5(_0x42bd76['error'][_0x5b42('0x16')]);}else{logger['info'](_0x5b42('0x15'),_0x37aaa4,'request\x20sent');_0x3a34e5(_0x42bd76[_0x5b42('0x17')]['message']);}})[_0x5b42('0x18')](function(_0x2ff438){logger[_0x5b42('0x13')](_0x5b42('0x15'),_0x37aaa4,_0x2ff438);_0x4e6c96(_0x2ff438);});});} \ No newline at end of file +var _0x5a52=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','randomstring','ioredis'];(function(_0x2c534a,_0x18a19e){var _0x3f5c99=function(_0x4c085f){while(--_0x4c085f){_0x2c534a['push'](_0x2c534a['shift']());}};_0x3f5c99(++_0x18a19e);}(_0x5a52,0x18d));var _0x25a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a52[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x25a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x25a5('0x1'));var fs=require('fs');var Redis=require(_0x25a5('0x2'));var db=require(_0x25a5('0x3'))['db'];var utils=require(_0x25a5('0x4'));var logger=require(_0x25a5('0x5'))(_0x25a5('0x6'));var config=require(_0x25a5('0x7'));var jayson=require(_0x25a5('0x8'));var client=jayson['client'][_0x25a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d0639,_0x2c4b31,_0x2d8920){return new BPromise(function(_0x31a0a,_0x66bf9b){return client[_0x25a5('0xa')](_0x4d0639,_0x2d8920)[_0x25a5('0xb')](function(_0x4fc92c){logger['info'](_0x25a5('0xc'),_0x2c4b31,_0x25a5('0xd'));logger[_0x25a5('0xe')](_0x25a5('0xf'),_0x2c4b31,_0x25a5('0xd'),JSON[_0x25a5('0x10')](_0x4fc92c));if(_0x4fc92c[_0x25a5('0x11')]){if(_0x4fc92c[_0x25a5('0x11')]['code']===0x1f4){logger[_0x25a5('0x11')](_0x25a5('0xc'),_0x2c4b31,_0x4fc92c[_0x25a5('0x11')]['message']);return _0x66bf9b(_0x4fc92c[_0x25a5('0x11')]['message']);}logger[_0x25a5('0x11')](_0x25a5('0xc'),_0x2c4b31,_0x4fc92c[_0x25a5('0x11')]['message']);return _0x31a0a(_0x4fc92c['error'][_0x25a5('0x12')]);}else{logger['info'](_0x25a5('0xc'),_0x2c4b31,_0x25a5('0xd'));_0x31a0a(_0x4fc92c[_0x25a5('0x13')][_0x25a5('0x12')]);}})['catch'](function(_0x1d56b9){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x2c4b31,_0x1d56b9);_0x66bf9b(_0x1d56b9);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 471db7a..030b57a 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 _0x9b8c=['connect-timeout','express','Router','../../config/environment','./chatOfflineMessage.controller','index','/describe','isAuthenticated','describe','get','/:id','create','update','delete','destroy','exports','multer','util','path'];(function(_0x21d9b7,_0x1cc234){var _0x20bdcc=function(_0xb6aa16){while(--_0xb6aa16){_0x21d9b7['push'](_0x21d9b7['shift']());}};_0x20bdcc(++_0x1cc234);}(_0x9b8c,0x153));var _0xc9b8=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0x9b8c[_0x870b62];return _0x2dcb39;};'use strict';var multer=require(_0xc9b8('0x0'));var util=require(_0xc9b8('0x1'));var path=require(_0xc9b8('0x2'));var timeout=require(_0xc9b8('0x3'));var express=require(_0xc9b8('0x4'));var router=express[_0xc9b8('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc9b8('0x6'));var controller=require(_0xc9b8('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc9b8('0x8')]);router['get'](_0xc9b8('0x9'),auth[_0xc9b8('0xa')](),controller[_0xc9b8('0xb')]);router[_0xc9b8('0xc')](_0xc9b8('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc9b8('0xa')](),controller[_0xc9b8('0xe')]);router['put'](_0xc9b8('0xd'),auth['isAuthenticated'](),controller[_0xc9b8('0xf')]);router[_0xc9b8('0x10')](_0xc9b8('0xd'),auth[_0xc9b8('0xa')](),controller[_0xc9b8('0x11')]);module[_0xc9b8('0x12')]=router; \ No newline at end of file +var _0x0cf5=['index','/describe','describe','show','post','create','put','update','/:id','destroy','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1906d,_0x1a7ba5){var _0x5da090=function(_0x104a24){while(--_0x104a24){_0x1906d['push'](_0x1906d['shift']());}};_0x5da090(++_0x1a7ba5);}(_0x0cf5,0x13c));var _0x50cf=function(_0x568fc8,_0x294b1e){_0x568fc8=_0x568fc8-0x0;var _0x48b23b=_0x0cf5[_0x568fc8];return _0x48b23b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x50cf('0x0'));var timeout=require(_0x50cf('0x1'));var express=require('express');var router=express[_0x50cf('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x50cf('0x3'));var config=require(_0x50cf('0x4'));var controller=require('./chatOfflineMessage.controller');router[_0x50cf('0x5')]('/',auth[_0x50cf('0x6')](),controller[_0x50cf('0x7')]);router[_0x50cf('0x5')](_0x50cf('0x8'),auth[_0x50cf('0x6')](),controller[_0x50cf('0x9')]);router[_0x50cf('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x50cf('0xa')]);router[_0x50cf('0xb')]('/',auth[_0x50cf('0x6')](),controller[_0x50cf('0xc')]);router[_0x50cf('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x50cf('0xe')]);router['delete'](_0x50cf('0xf'),auth[_0x50cf('0x6')](),controller[_0x50cf('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index b40a400..62a0b37 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 _0x775f=['mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x1cc944,_0x10da7d){var _0x4c457d=function(_0x10922c){while(--_0x10922c){_0x1cc944['push'](_0x1cc944['shift']());}};_0x4c457d(++_0x10da7d);}(_0x775f,0x8d));var _0xf775=function(_0x4206f5,_0x21f338){_0x4206f5=_0x4206f5-0x0;var _0xa29cf3=_0x775f[_0x4206f5];return _0xa29cf3;};'use strict';var Sequelize=require(_0xf775('0x0'));module[_0xf775('0x1')]={'name':{'type':Sequelize[_0xf775('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf775('0x3'),_0xf775('0x4')),'defaultValue':_0xf775('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf775('0x5')]}}; \ No newline at end of file +var _0xc954=['sequelize','exports','ENUM','mouseOver','INTEGER'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xc954,0x1ea));var _0x4c95=function(_0x4332f5,_0x33ce38){_0x4332f5=_0x4332f5-0x0;var _0x55a180=_0xc954[_0x4332f5];return _0x55a180;};'use strict';var Sequelize=require(_0x4c95('0x0'));module[_0x4c95('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4c95('0x2')](_0x4c95('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4c95('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index ae814fe..13da94f 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 _0xac21=['attributes','length','include','merge','options','ChatProactiveAction','find','catch','body','update','params','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','show','model','rawAttributes','query','keys','filters','intersection','fields'];(function(_0x49563a,_0x2fdc39){var _0x5d23ff=function(_0x49129e){while(--_0x49129e){_0x49563a['push'](_0x49563a['shift']());}};_0x5d23ff(++_0x2fdc39);}(_0xac21,0x1af));var _0x1ac2=function(_0x1216a8,_0x444f4a){_0x1216a8=_0x1216a8-0x0;var _0x13cf16=_0xac21[_0x1216a8];return _0x13cf16;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ac2('0x0'));var zipdir=require(_0x1ac2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ac2('0x2'));var moment=require('moment');var BPromise=require(_0x1ac2('0x3'));var Mustache=require(_0x1ac2('0x4'));var util=require('util');var path=require(_0x1ac2('0x5'));var sox=require('sox');var csv=require(_0x1ac2('0x6'));var ejs=require(_0x1ac2('0x7'));var fs=require('fs');var fs_extra=require(_0x1ac2('0x8'));var _=require(_0x1ac2('0x9'));var squel=require(_0x1ac2('0xa'));var crypto=require(_0x1ac2('0xb'));var jsforce=require(_0x1ac2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1ac2('0x6'));var querystring=require(_0x1ac2('0xd'));var Papa=require(_0x1ac2('0xe'));var Redis=require(_0x1ac2('0xf'));var authService=require(_0x1ac2('0x10'));var qs=require(_0x1ac2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ac2('0x12'));var logger=require(_0x1ac2('0x13'))(_0x1ac2('0x14'));var utils=require(_0x1ac2('0x15'));var config=require(_0x1ac2('0x16'));var licenseUtil=require(_0x1ac2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf2a9e0,_0x37e704){_0x37e704=_0x37e704||0xcc;return function(_0x11900b){if(_0x11900b){return _0xf2a9e0[_0x1ac2('0x18')](_0x37e704);}return _0xf2a9e0[_0x1ac2('0x19')](_0x37e704)[_0x1ac2('0x1a')]();};}function respondWithResult(_0x419156,_0x14c8e9){_0x14c8e9=_0x14c8e9||0xc8;return function(_0x32dc1d){if(_0x32dc1d){return _0x419156['status'](_0x14c8e9)[_0x1ac2('0x1b')](_0x32dc1d);}};}function respondWithFilteredResult(_0x3c415d,_0x1ebc8d){return function(_0x23beb9){if(_0x23beb9){var _0x1d51a8=typeof _0x1ebc8d[_0x1ac2('0x1c')]===_0x1ac2('0x1d')&&typeof _0x1ebc8d[_0x1ac2('0x1e')]==='undefined';var _0xafc377=_0x23beb9[_0x1ac2('0x1f')];var _0x5a76a0=_0x1d51a8?0x0:_0x1ebc8d[_0x1ac2('0x1c')];var _0x14cab0=_0x1d51a8?_0x23beb9['count']:_0x1ebc8d[_0x1ac2('0x1c')]+_0x1ebc8d['limit'];var _0x369697;if(_0x14cab0>=_0xafc377){_0x14cab0=_0xafc377;_0x369697=0xc8;}else{_0x369697=0xce;}_0x3c415d[_0x1ac2('0x19')](_0x369697);return _0x3c415d['set'](_0x1ac2('0x20'),_0x5a76a0+'-'+_0x14cab0+'/'+_0xafc377)[_0x1ac2('0x1b')](_0x23beb9);}return null;};}function patchUpdates(_0x24100c){return function(_0x849c59){try{jsonpatch[_0x1ac2('0x21')](_0x849c59,_0x24100c,!![]);}catch(_0x1c4f4f){return BPromise[_0x1ac2('0x22')](_0x1c4f4f);}return _0x849c59[_0x1ac2('0x23')]();};}function saveUpdates(_0x25d520,_0x2ca8d1){return function(_0xe7a4cd){if(_0xe7a4cd){return _0xe7a4cd['update'](_0x25d520)[_0x1ac2('0x24')](function(_0x76c205){return _0x76c205;});}return null;};}function removeEntity(_0x2fa3e7,_0x457251){return function(_0x1e204e){if(_0x1e204e){return _0x1e204e[_0x1ac2('0x25')]()['then'](function(){_0x2fa3e7[_0x1ac2('0x19')](0xcc)[_0x1ac2('0x1a')]();});}};}function handleEntityNotFound(_0x25224e,_0x102390){return function(_0xd7c79c){if(!_0xd7c79c){_0x25224e['sendStatus'](0x194);}return _0xd7c79c;};}function handleError(_0x416f28,_0x37b68a){_0x37b68a=_0x37b68a||0x1f4;return function(_0x21f248){logger[_0x1ac2('0x26')](_0x21f248[_0x1ac2('0x27')]);if(_0x21f248['name']){delete _0x21f248[_0x1ac2('0x28')];}_0x416f28[_0x1ac2('0x19')](_0x37b68a)['send'](_0x21f248);};}exports[_0x1ac2('0x29')]=function(_0x4d3053,_0x40137f){var _0x439430={'raw':!![],'where':{'id':_0x4d3053['params']['id']}},_0x24f5c9={};_0x24f5c9[_0x1ac2('0x2a')]=_['keys'](db['ChatProactiveAction'][_0x1ac2('0x2b')]);_0x24f5c9[_0x1ac2('0x2c')]=_[_0x1ac2('0x2d')](_0x4d3053[_0x1ac2('0x2c')]);_0x24f5c9[_0x1ac2('0x2e')]=_[_0x1ac2('0x2f')](_0x24f5c9[_0x1ac2('0x2a')],_0x24f5c9['query']);_0x439430['attributes']=_['intersection'](_0x24f5c9['model'],qs[_0x1ac2('0x30')](_0x4d3053[_0x1ac2('0x2c')][_0x1ac2('0x30')]));_0x439430['attributes']=_0x439430[_0x1ac2('0x31')][_0x1ac2('0x32')]?_0x439430['attributes']:_0x24f5c9[_0x1ac2('0x2a')];if(_0x4d3053[_0x1ac2('0x2c')]['includeAll']){_0x439430[_0x1ac2('0x33')]=[{'all':!![]}];}_0x439430=_[_0x1ac2('0x34')]({},_0x439430,_0x4d3053[_0x1ac2('0x35')]);return db[_0x1ac2('0x36')][_0x1ac2('0x37')](_0x439430)['then'](handleEntityNotFound(_0x40137f,null))[_0x1ac2('0x24')](respondWithResult(_0x40137f,null))[_0x1ac2('0x38')](handleError(_0x40137f,null));};exports['create']=function(_0x167dba,_0x27816f){return db[_0x1ac2('0x36')]['create'](_0x167dba[_0x1ac2('0x39')],{})[_0x1ac2('0x24')](respondWithResult(_0x27816f,0xc9))[_0x1ac2('0x38')](handleError(_0x27816f,null));};exports[_0x1ac2('0x3a')]=function(_0x16666d,_0x2ebea3){if(_0x16666d[_0x1ac2('0x39')]['id']){delete _0x16666d[_0x1ac2('0x39')]['id'];}return db['ChatProactiveAction'][_0x1ac2('0x37')]({'where':{'id':_0x16666d[_0x1ac2('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2ebea3,null))[_0x1ac2('0x24')](saveUpdates(_0x16666d[_0x1ac2('0x39')],null))[_0x1ac2('0x24')](respondWithResult(_0x2ebea3,null))[_0x1ac2('0x38')](handleError(_0x2ebea3,null));};exports[_0x1ac2('0x25')]=function(_0x2fb7be,_0x440f91){return db[_0x1ac2('0x36')][_0x1ac2('0x37')]({'where':{'id':_0x2fb7be[_0x1ac2('0x3b')]['id']}})[_0x1ac2('0x24')](handleEntityNotFound(_0x440f91,null))[_0x1ac2('0x24')](removeEntity(_0x440f91,null))['catch'](handleError(_0x440f91,null));}; \ No newline at end of file +var _0x4553=['name','send','show','params','model','ChatProactiveAction','rawAttributes','query','keys','intersection','attributes','fields','include','merge','find','then','create','body','catch','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','error','stack'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x4553,0x1be));var _0x3455=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x4553[_0x3635ce];return _0x97ecd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3455('0x0'));var zipdir=require(_0x3455('0x1'));var jsonpatch=require(_0x3455('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3455('0x3'));var Mustache=require(_0x3455('0x4'));var util=require(_0x3455('0x5'));var path=require(_0x3455('0x6'));var sox=require(_0x3455('0x7'));var csv=require(_0x3455('0x8'));var ejs=require(_0x3455('0x9'));var fs=require('fs');var fs_extra=require(_0x3455('0xa'));var _=require(_0x3455('0xb'));var squel=require('squel');var crypto=require(_0x3455('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3455('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3455('0xe'));var Papa=require(_0x3455('0xf'));var Redis=require(_0x3455('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3455('0x11'));var hardwareService=require(_0x3455('0x12'));var logger=require(_0x3455('0x13'))(_0x3455('0x14'));var utils=require(_0x3455('0x15'));var config=require(_0x3455('0x16'));var licenseUtil=require(_0x3455('0x17'));var db=require(_0x3455('0x18'))['db'];function respondWithStatusCode(_0x1b9454,_0x1eb225){_0x1eb225=_0x1eb225||0xcc;return function(_0x20c489){if(_0x20c489){return _0x1b9454[_0x3455('0x19')](_0x1eb225);}return _0x1b9454[_0x3455('0x1a')](_0x1eb225)[_0x3455('0x1b')]();};}function respondWithResult(_0x3063cb,_0x349a5f){_0x349a5f=_0x349a5f||0xc8;return function(_0x3856f7){if(_0x3856f7){return _0x3063cb['status'](_0x349a5f)[_0x3455('0x1c')](_0x3856f7);}};}function respondWithFilteredResult(_0x31f2ac,_0x1de6ed){return function(_0x3c0def){if(_0x3c0def){var _0x257a9c=typeof _0x1de6ed[_0x3455('0x1d')]==='undefined'&&typeof _0x1de6ed[_0x3455('0x1e')]===_0x3455('0x1f');var _0x147e95=_0x3c0def[_0x3455('0x20')];var _0x4d3915=_0x257a9c?0x0:_0x1de6ed[_0x3455('0x1d')];var _0x59d493=_0x257a9c?_0x3c0def[_0x3455('0x20')]:_0x1de6ed['offset']+_0x1de6ed[_0x3455('0x1e')];var _0x624dd5;if(_0x59d493>=_0x147e95){_0x59d493=_0x147e95;_0x624dd5=0xc8;}else{_0x624dd5=0xce;}_0x31f2ac[_0x3455('0x1a')](_0x624dd5);return _0x31f2ac[_0x3455('0x21')](_0x3455('0x22'),_0x4d3915+'-'+_0x59d493+'/'+_0x147e95)[_0x3455('0x1c')](_0x3c0def);}return null;};}function patchUpdates(_0x192d90){return function(_0x34d2ee){try{jsonpatch[_0x3455('0x23')](_0x34d2ee,_0x192d90,!![]);}catch(_0x491127){return BPromise[_0x3455('0x24')](_0x491127);}return _0x34d2ee[_0x3455('0x25')]();};}function saveUpdates(_0x2b0b5e,_0x5a9719){return function(_0x32c51c){if(_0x32c51c){return _0x32c51c[_0x3455('0x26')](_0x2b0b5e)['then'](function(_0x55dd41){return _0x55dd41;});}return null;};}function removeEntity(_0xf3018c,_0x13b9af){return function(_0xd58aa8){if(_0xd58aa8){return _0xd58aa8[_0x3455('0x27')]()['then'](function(){_0xf3018c[_0x3455('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x252f87,_0x577e97){return function(_0x1ddb6a){if(!_0x1ddb6a){_0x252f87[_0x3455('0x19')](0x194);}return _0x1ddb6a;};}function handleError(_0x4d1a86,_0x4fc679){_0x4fc679=_0x4fc679||0x1f4;return function(_0x3658a4){logger[_0x3455('0x28')](_0x3658a4[_0x3455('0x29')]);if(_0x3658a4[_0x3455('0x2a')]){delete _0x3658a4['name'];}_0x4d1a86['status'](_0x4fc679)[_0x3455('0x2b')](_0x3658a4);};}exports[_0x3455('0x2c')]=function(_0x2f8ded,_0x55ae42){var _0x6e33b6={'raw':!![],'where':{'id':_0x2f8ded[_0x3455('0x2d')]['id']}},_0x25e280={};_0x25e280[_0x3455('0x2e')]=_['keys'](db[_0x3455('0x2f')][_0x3455('0x30')]);_0x25e280[_0x3455('0x31')]=_[_0x3455('0x32')](_0x2f8ded[_0x3455('0x31')]);_0x25e280['filters']=_[_0x3455('0x33')](_0x25e280[_0x3455('0x2e')],_0x25e280['query']);_0x6e33b6[_0x3455('0x34')]=_['intersection'](_0x25e280[_0x3455('0x2e')],qs[_0x3455('0x35')](_0x2f8ded[_0x3455('0x31')][_0x3455('0x35')]));_0x6e33b6['attributes']=_0x6e33b6[_0x3455('0x34')]['length']?_0x6e33b6[_0x3455('0x34')]:_0x25e280[_0x3455('0x2e')];if(_0x2f8ded[_0x3455('0x31')]['includeAll']){_0x6e33b6[_0x3455('0x36')]=[{'all':!![]}];}_0x6e33b6=_[_0x3455('0x37')]({},_0x6e33b6,_0x2f8ded['options']);return db['ChatProactiveAction'][_0x3455('0x38')](_0x6e33b6)[_0x3455('0x39')](handleEntityNotFound(_0x55ae42,null))[_0x3455('0x39')](respondWithResult(_0x55ae42,null))['catch'](handleError(_0x55ae42,null));};exports[_0x3455('0x3a')]=function(_0x32534e,_0x351062){return db['ChatProactiveAction'][_0x3455('0x3a')](_0x32534e[_0x3455('0x3b')],{})['then'](respondWithResult(_0x351062,0xc9))[_0x3455('0x3c')](handleError(_0x351062,null));};exports[_0x3455('0x26')]=function(_0x503f71,_0x385b4e){if(_0x503f71[_0x3455('0x3b')]['id']){delete _0x503f71['body']['id'];}return db[_0x3455('0x2f')][_0x3455('0x38')]({'where':{'id':_0x503f71['params']['id']}})[_0x3455('0x39')](handleEntityNotFound(_0x385b4e,null))[_0x3455('0x39')](saveUpdates(_0x503f71[_0x3455('0x3b')],null))['then'](respondWithResult(_0x385b4e,null))[_0x3455('0x3c')](handleError(_0x385b4e,null));};exports['destroy']=function(_0x111c02,_0x22f09f){return db['ChatProactiveAction']['find']({'where':{'id':_0x111c02[_0x3455('0x2d')]['id']}})[_0x3455('0x39')](handleEntityNotFound(_0x22f09f,null))['then'](removeEntity(_0x22f09f,null))[_0x3455('0x3c')](handleError(_0x22f09f,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 741f678..6aa0881 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 _0xd0f1=['define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','path','./chatProactiveAction.attributes','exports'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xd0f1,0xb7));var _0x1d0f=function(_0x19fa06,_0x14dcc6){_0x19fa06=_0x19fa06-0x0;var _0x278075=_0xd0f1[_0x19fa06];return _0x278075;};'use strict';var _=require('lodash');var util=require(_0x1d0f('0x0'));var logger=require(_0x1d0f('0x1'))(_0x1d0f('0x2'));var moment=require(_0x1d0f('0x3'));var BPromise=require(_0x1d0f('0x4'));var rp=require(_0x1d0f('0x5'));var fs=require('fs');var path=require(_0x1d0f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1d0f('0x7'));module[_0x1d0f('0x8')]=function(_0x38d6e9,_0xe3fc00){return _0x38d6e9[_0x1d0f('0x9')](_0x1d0f('0xa'),attributes,{'tableName':_0x1d0f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61d8=['util','api','moment','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x21bfab,_0x2fee48){var _0x4db318=function(_0x10396d){while(--_0x10396d){_0x21bfab['push'](_0x21bfab['shift']());}};_0x4db318(++_0x2fee48);}(_0x61d8,0x1d8));var _0x861d=function(_0x12f010,_0x4e91f7){_0x12f010=_0x12f010-0x0;var _0x2cd285=_0x61d8[_0x12f010];return _0x2cd285;};'use strict';var _=require(_0x861d('0x0'));var util=require(_0x861d('0x1'));var logger=require('../../config/logger')(_0x861d('0x2'));var moment=require(_0x861d('0x3'));var BPromise=require('bluebird');var rp=require(_0x861d('0x4'));var fs=require('fs');var path=require(_0x861d('0x5'));var rimraf=require(_0x861d('0x6'));var config=require('../../config/environment');var attributes=require(_0x861d('0x7'));module[_0x861d('0x8')]=function(_0x27d11d,_0x1f2fcb){return _0x27d11d['define'](_0x861d('0x9'),attributes,{'tableName':_0x861d('0xa'),'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 289beda..8b1e581 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 _0x02d5=['request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x3c2f8c,_0x549869){var _0x2005e3=function(_0x33ab25){while(--_0x33ab25){_0x3c2f8c['push'](_0x3c2f8c['shift']());}};_0x2005e3(++_0x549869);}(_0x02d5,0x66));var _0x502d=function(_0x58b35e,_0x17a8cd){_0x58b35e=_0x58b35e-0x0;var _0x86b2a0=_0x02d5[_0x58b35e];return _0x86b2a0;};'use strict';var _=require('lodash');var util=require(_0x502d('0x0'));var moment=require(_0x502d('0x1'));var BPromise=require(_0x502d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x502d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x502d('0x4'));var logger=require(_0x502d('0x5'))(_0x502d('0x6'));var config=require('../../config/environment');var jayson=require(_0x502d('0x7'));var client=jayson['client'][_0x502d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a372c,_0x31713f,_0x26dbb7){return new BPromise(function(_0x1bad1d,_0x252f18){return client[_0x502d('0x9')](_0x3a372c,_0x26dbb7)['then'](function(_0x98bf13){logger[_0x502d('0xa')](_0x502d('0xb'),_0x31713f,'request\x20sent');logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x31713f,_0x502d('0xc'),JSON[_0x502d('0xd')](_0x98bf13));if(_0x98bf13[_0x502d('0xe')]){if(_0x98bf13[_0x502d('0xe')][_0x502d('0xf')]===0x1f4){logger[_0x502d('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x31713f,_0x98bf13[_0x502d('0xe')]['message']);return _0x252f18(_0x98bf13[_0x502d('0xe')][_0x502d('0x10')]);}logger[_0x502d('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x31713f,_0x98bf13[_0x502d('0xe')]['message']);return _0x1bad1d(_0x98bf13[_0x502d('0xe')][_0x502d('0x10')]);}else{logger[_0x502d('0xa')](_0x502d('0xb'),_0x31713f,_0x502d('0xc'));_0x1bad1d(_0x98bf13[_0x502d('0x11')]['message']);}})[_0x502d('0x12')](function(_0x341c27){logger[_0x502d('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x31713f,_0x341c27);_0x252f18(_0x341c27);});});} \ No newline at end of file +var _0x0e47=['result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','ChatProactiveAction,\x20%s,\x20%s','message'];(function(_0xc9d445,_0x3d969d){var _0x5a120b=function(_0x8dd704){while(--_0x8dd704){_0xc9d445['push'](_0xc9d445['shift']());}};_0x5a120b(++_0x3d969d);}(_0x0e47,0x65));var _0x70e4=function(_0x3f6b47,_0x1256d8){_0x3f6b47=_0x3f6b47-0x0;var _0x3c70ec=_0x0e47[_0x3f6b47];return _0x3c70ec;};'use strict';var _=require(_0x70e4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x70e4('0x1'));var rs=require(_0x70e4('0x2'));var fs=require('fs');var Redis=require(_0x70e4('0x3'));var db=require(_0x70e4('0x4'))['db'];var utils=require(_0x70e4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x70e4('0x6'));var jayson=require(_0x70e4('0x7'));var client=jayson['client'][_0x70e4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4503c4,_0x34b0c6,_0x1b4ee4){return new BPromise(function(_0x2ac9d3,_0x5eb8c5){return client[_0x70e4('0x9')](_0x4503c4,_0x1b4ee4)[_0x70e4('0xa')](function(_0x3e1b7f){logger[_0x70e4('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x34b0c6,_0x70e4('0xc'));logger[_0x70e4('0xd')](_0x70e4('0xe'),_0x34b0c6,'request\x20sent',JSON[_0x70e4('0xf')](_0x3e1b7f));if(_0x3e1b7f[_0x70e4('0x10')]){if(_0x3e1b7f[_0x70e4('0x10')]['code']===0x1f4){logger[_0x70e4('0x10')](_0x70e4('0x11'),_0x34b0c6,_0x3e1b7f[_0x70e4('0x10')][_0x70e4('0x12')]);return _0x5eb8c5(_0x3e1b7f[_0x70e4('0x10')]['message']);}logger[_0x70e4('0x10')](_0x70e4('0x11'),_0x34b0c6,_0x3e1b7f['error'][_0x70e4('0x12')]);return _0x2ac9d3(_0x3e1b7f['error'][_0x70e4('0x12')]);}else{logger[_0x70e4('0xb')](_0x70e4('0x11'),_0x34b0c6,_0x70e4('0xc'));_0x2ac9d3(_0x3e1b7f[_0x70e4('0x13')][_0x70e4('0x12')]);}})['catch'](function(_0x4d2e94){logger[_0x70e4('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0x34b0c6,_0x4d2e94);_0x5eb8c5(_0x4d2e94);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index e302c21..778ba77 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 _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(_0x333c49,_0x3b9816){var _0x23b2f5=function(_0xa53c39){while(--_0xa53c39){_0x333c49['push'](_0x333c49['shift']());}};_0x23b2f5(++_0x3b9816);}(_0xf494,0x1c6));var _0x4f49=function(_0x476c7a,_0x20c6e8){_0x476c7a=_0x476c7a-0x0;var _0x181dc9=_0xf494[_0x476c7a];return _0x181dc9;};'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 +var _0x55ca=['multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','destroy','exports'];(function(_0x31121a,_0x5b8600){var _0x40a550=function(_0x1abf84){while(--_0x1abf84){_0x31121a['push'](_0x31121a['shift']());}};_0x40a550(++_0x5b8600);}(_0x55ca,0x126));var _0xa55c=function(_0x162246,_0x4e5038){_0x162246=_0x162246-0x0;var _0x32ac95=_0x55ca[_0x162246];return _0x32ac95;};'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')](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x9')](),controller[_0xa55c('0xb')]);router['put'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller['update']);router['delete'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xc')]);module[_0xa55c('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 34b83b4..480c5fc 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 _0x4ae5=['exports','STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x7648fe,_0x4d2108){var _0x3f8265=function(_0x22ec58){while(--_0x22ec58){_0x7648fe['push'](_0x7648fe['shift']());}};_0x3f8265(++_0x4d2108);}(_0x4ae5,0x187));var _0x54ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4ae5[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x54ae('0x0'));module[_0x54ae('0x1')]={'name':{'type':Sequelize[_0x54ae('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x54ae('0x2')]},'timeout':{'type':Sequelize[_0x54ae('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x54ae('0x4'),_0x54ae('0x5'),_0x54ae('0x6'))}}; \ No newline at end of file +var _0x8058=['roundrobin','sequelize','exports','STRING','ENUM','rrmemory','beepall'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x8058,0xf6));var _0x8805=function(_0x196681,_0x5b062f){_0x196681=_0x196681-0x0;var _0x9a81aa=_0x8058[_0x196681];return _0x9a81aa;};'use strict';var Sequelize=require(_0x8805('0x0'));module[_0x8805('0x1')]={'name':{'type':Sequelize[_0x8805('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8805('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8805('0x3')](_0x8805('0x4'),_0x8805('0x5'),_0x8805('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 1a6bfd6..a4e9283 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 _0x9b1d=['describe','findOne','keys','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','UserChatQueue','findAll','findAndCountAll','agent','chatPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','filter','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','value','removeAgents','addAgents','spread','isArray','userChatQueue:remove','getAgents','options','bluebird','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','then','destroy','ChatQueues','UserProfileResource','name','index','map','ChatQueue','rawAttributes','fieldName','type','getOptions','where','include','query','catch','show','params','model','filters','intersection','attributes','fields','length','includeAll','merge','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','error','update'];(function(_0x1199a2,_0x216ec7){var _0x40e834=function(_0x5570f3){while(--_0x5570f3){_0x1199a2['push'](_0x1199a2['shift']());}};_0x40e834(++_0x216ec7);}(_0x9b1d,0xb8));var _0xd9b1=function(_0x469693,_0x289b1d){_0x469693=_0x469693-0x0;var _0x188b42=_0x9b1d[_0x469693];return _0x188b42;};'use strict';var BPromise=require(_0xd9b1('0x0'));var util=require('util');var _=require(_0xd9b1('0x1'));var squel=require(_0xd9b1('0x2'));var Redis=require(_0xd9b1('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xd9b1('0x4'))(_0xd9b1('0x5'));var config=require(_0xd9b1('0x6'));var db=require(_0xd9b1('0x7'))['db'];config['redis']=_['defaults'](config[_0xd9b1('0x8')],{'host':_0xd9b1('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd9b1('0x8')]));require('./chatQueue.socket')[_0xd9b1('0xa')](socket);function respondWithStatusCode(_0x4945af,_0x40ab0f){_0x40ab0f=_0x40ab0f||0xcc;return function(_0x49d66e){if(_0x49d66e){return _0x4945af[_0xd9b1('0xb')](_0x40ab0f);}return _0x4945af['status'](_0x40ab0f)[_0xd9b1('0xc')]();};}function respondWithResult(_0x32024e,_0x6a2e8){_0x6a2e8=_0x6a2e8||0xc8;return function(_0x163147){if(_0x163147){return _0x32024e['status'](_0x6a2e8)[_0xd9b1('0xd')](_0x163147);}};}function respondWithFilteredResult(_0x367d99,_0xc736e5){return function(_0x58ef66){if(_0x58ef66){var _0x28ef36=typeof _0xc736e5[_0xd9b1('0xe')]===_0xd9b1('0xf')&&typeof _0xc736e5[_0xd9b1('0x10')]===_0xd9b1('0xf');var _0x1b200d=_0x58ef66[_0xd9b1('0x11')];var _0x2d0fde=_0x28ef36?0x0:_0xc736e5['offset'];var _0x286f8b=_0x28ef36?_0x58ef66[_0xd9b1('0x11')]:_0xc736e5[_0xd9b1('0xe')]+_0xc736e5[_0xd9b1('0x10')];var _0x38c9aa;if(_0x286f8b>=_0x1b200d){_0x286f8b=_0x1b200d;_0x38c9aa=0xc8;}else{_0x38c9aa=0xce;}_0x367d99[_0xd9b1('0x12')](_0x38c9aa);return _0x367d99['set'](_0xd9b1('0x13'),_0x2d0fde+'-'+_0x286f8b+'/'+_0x1b200d)[_0xd9b1('0xd')](_0x58ef66);}return null;};}function saveUpdates(_0x177756){return function(_0x510ad2){if(_0x510ad2){return _0x510ad2['update'](_0x177756)[_0xd9b1('0x14')](function(_0x4f62df){return _0x4f62df;});}return null;};}function removeEntity(_0x7f1620){return function(_0xcd1a2c){if(_0xcd1a2c){return _0xcd1a2c[_0xd9b1('0x15')]()['then'](function(){var _0x7ba82f=_0xcd1a2c['get']({'plain':!![]});var _0xc37540=_0xd9b1('0x16');return db[_0xd9b1('0x17')]['destroy']({'where':{'type':_0xc37540,'resourceId':_0x7ba82f['id']}})['then'](function(){return _0xcd1a2c;});})['then'](function(){_0x7f1620[_0xd9b1('0x12')](0xcc)[_0xd9b1('0xc')]();});}};}function handleEntityNotFound(_0x4fc0d2){return function(_0x3173ee){if(!_0x3173ee){_0x4fc0d2[_0xd9b1('0xb')](0x194);}return _0x3173ee;};}function handleError(_0xc86f3f,_0x1cd536){_0x1cd536=_0x1cd536||0x1f4;return function(_0x143f64){logger['error'](_0x143f64['stack']);if(_0x143f64[_0xd9b1('0x18')]){delete _0x143f64[_0xd9b1('0x18')];}_0xc86f3f[_0xd9b1('0x12')](_0x1cd536)['send'](_0x143f64);};}exports[_0xd9b1('0x19')]=function(_0x36f426,_0x4e1602){var _0x4bac87={};var _0x1ca35e={'count':0x0,'rows':[]};var _0x381357=_[_0xd9b1('0x1a')](db[_0xd9b1('0x1b')][_0xd9b1('0x1c')],function(_0x3f3d44){return{'name':_0x3f3d44[_0xd9b1('0x1d')],'type':_0x3f3d44[_0xd9b1('0x1e')]['key']};});_0x4bac87=qs[_0xd9b1('0x1f')](_0x381357,_0x36f426);var _0x32003f={'where':_0x4bac87[_0xd9b1('0x20')]};return db[_0xd9b1('0x1b')][_0xd9b1('0x11')](_0x32003f)['then'](function(_0x32b7a0){_0x1ca35e[_0xd9b1('0x11')]=_0x32b7a0;_0x4bac87[_0xd9b1('0x21')]=qs[_0xd9b1('0x21')](_0x36f426[_0xd9b1('0x22')]);return db[_0xd9b1('0x1b')]['findAll'](_0x4bac87);})[_0xd9b1('0x14')](function(_0x265970){_0x1ca35e['rows']=_0x265970;return _0x1ca35e;})[_0xd9b1('0x14')](respondWithFilteredResult(_0x4e1602,_0x4bac87))[_0xd9b1('0x23')](handleError(_0x4e1602,null));};exports[_0xd9b1('0x24')]=function(_0x1cf610,_0x2e56bb){var _0x2bd4ee={'raw':!![],'where':{'id':_0x1cf610[_0xd9b1('0x25')]['id']}},_0x460b7b={};_0x460b7b[_0xd9b1('0x26')]=_['keys'](db[_0xd9b1('0x1b')][_0xd9b1('0x1c')]);_0x460b7b[_0xd9b1('0x22')]=_['keys'](_0x1cf610['query']);_0x460b7b[_0xd9b1('0x27')]=_[_0xd9b1('0x28')](_0x460b7b[_0xd9b1('0x26')],_0x460b7b['query']);_0x2bd4ee[_0xd9b1('0x29')]=_[_0xd9b1('0x28')](_0x460b7b[_0xd9b1('0x26')],qs[_0xd9b1('0x2a')](_0x1cf610[_0xd9b1('0x22')][_0xd9b1('0x2a')]));_0x2bd4ee['attributes']=_0x2bd4ee['attributes'][_0xd9b1('0x2b')]?_0x2bd4ee['attributes']:_0x460b7b[_0xd9b1('0x26')];if(_0x1cf610[_0xd9b1('0x22')][_0xd9b1('0x2c')]){_0x2bd4ee[_0xd9b1('0x21')]=[{'all':!![]}];}_0x2bd4ee=_[_0xd9b1('0x2d')]({},_0x2bd4ee,_0x1cf610['options']);return db[_0xd9b1('0x1b')]['find'](_0x2bd4ee)[_0xd9b1('0x14')](handleEntityNotFound(_0x2e56bb,null))[_0xd9b1('0x14')](respondWithResult(_0x2e56bb,null))[_0xd9b1('0x23')](handleError(_0x2e56bb,null));};exports[_0xd9b1('0x2e')]=function(_0x5771ca,_0x5ef565){return db[_0xd9b1('0x1b')]['create'](_0x5771ca[_0xd9b1('0x2f')],{})['then'](function(_0x279e7d){var _0x41e7e7=_0x5771ca['user'][_0xd9b1('0x30')]({'plain':!![]});if(!_0x41e7e7)throw new Error(_0xd9b1('0x31'));if(_0x41e7e7['role']===_0xd9b1('0x32')){var _0xa3f761=_0x279e7d['get']({'plain':!![]});var _0x13ea6a='ChatQueues';return db[_0xd9b1('0x33')][_0xd9b1('0x34')]({'where':{'name':_0x13ea6a,'userProfileId':_0x41e7e7[_0xd9b1('0x35')]},'raw':!![]})['then'](function(_0x1679e0){if(_0x1679e0&&_0x1679e0['autoAssociation']===0x0){return db[_0xd9b1('0x17')][_0xd9b1('0x2e')]({'name':_0xa3f761[_0xd9b1('0x18')],'resourceId':_0xa3f761['id'],'type':_0x1679e0[_0xd9b1('0x18')],'sectionId':_0x1679e0['id']},{})[_0xd9b1('0x14')](function(){return _0x279e7d;});}else{return _0x279e7d;}})[_0xd9b1('0x23')](function(_0x3fec74){logger[_0xd9b1('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fec74);throw _0x3fec74;});}return _0x279e7d;})[_0xd9b1('0x14')](respondWithResult(_0x5ef565,0xc9))[_0xd9b1('0x23')](handleError(_0x5ef565,null));};exports[_0xd9b1('0x37')]=function(_0x18cd80,_0x8c953a){if(_0x18cd80[_0xd9b1('0x2f')]['id']){delete _0x18cd80['body']['id'];}return db[_0xd9b1('0x1b')][_0xd9b1('0x34')]({'where':{'id':_0x18cd80[_0xd9b1('0x25')]['id']}})['then'](handleEntityNotFound(_0x8c953a,null))[_0xd9b1('0x14')](saveUpdates(_0x18cd80[_0xd9b1('0x2f')],null))[_0xd9b1('0x14')](respondWithResult(_0x8c953a,null))[_0xd9b1('0x23')](handleError(_0x8c953a,null));};exports[_0xd9b1('0x15')]=function(_0x2471e8,_0x23049c){return db[_0xd9b1('0x1b')]['find']({'where':{'id':_0x2471e8[_0xd9b1('0x25')]['id']}})[_0xd9b1('0x14')](handleEntityNotFound(_0x23049c,null))[_0xd9b1('0x14')](removeEntity(_0x23049c,null))[_0xd9b1('0x23')](handleError(_0x23049c,null));};exports[_0xd9b1('0x38')]=function(_0x1c9419,_0x2eef68){return db[_0xd9b1('0x1b')][_0xd9b1('0x38')]()[_0xd9b1('0x14')](respondWithResult(_0x2eef68,null))[_0xd9b1('0x23')](handleError(_0x2eef68,null));};exports['getMembers']=function(_0x330300,_0x5119c4){var _0x341ab2={'raw':!![],'where':{}},_0x16ac91={},_0x930a32;return db[_0xd9b1('0x1b')][_0xd9b1('0x39')]({'where':{'id':_0x330300['params']['id']}})[_0xd9b1('0x14')](handleEntityNotFound(_0x5119c4,null))[_0xd9b1('0x14')](function(_0x26c075){if(_0x26c075){_0x930a32=_0x26c075[_0xd9b1('0x30')]({'plain':!![]});_0x16ac91[_0xd9b1('0x26')]=_[_0xd9b1('0x3a')](db['UserChatQueue'][_0xd9b1('0x1c')]);_0x16ac91[_0xd9b1('0x22')]=_['keys'](_0x330300[_0xd9b1('0x22')]);_0x16ac91['filters']=_['intersection'](_0x16ac91[_0xd9b1('0x26')],_0x16ac91[_0xd9b1('0x22')]);_0x341ab2[_0xd9b1('0x29')]=_['intersection'](_0x16ac91[_0xd9b1('0x26')],qs[_0xd9b1('0x2a')](_0x330300['query']['fields']));_0x341ab2[_0xd9b1('0x29')]=_0x341ab2['attributes'][_0xd9b1('0x2b')]?_0x341ab2[_0xd9b1('0x29')]:_0x16ac91[_0xd9b1('0x26')];if(!_0x330300[_0xd9b1('0x22')][_0xd9b1('0x3b')](_0xd9b1('0x3c'))){_0x341ab2[_0xd9b1('0x10')]=qs[_0xd9b1('0x10')](_0x330300[_0xd9b1('0x22')]['limit']);_0x341ab2[_0xd9b1('0xe')]=qs[_0xd9b1('0xe')](_0x330300['query'][_0xd9b1('0xe')]);}_0x341ab2[_0xd9b1('0x3d')]=qs[_0xd9b1('0x3e')](_0x330300[_0xd9b1('0x22')][_0xd9b1('0x3e')]);_0x341ab2[_0xd9b1('0x20')]=qs[_0xd9b1('0x27')](_[_0xd9b1('0x3f')](_0x330300['query'],_0x16ac91['filters']));_0x341ab2[_0xd9b1('0x20')][_0xd9b1('0x40')]=_0x26c075['id'];if(_0x330300[_0xd9b1('0x22')]['filter']){_0x341ab2[_0xd9b1('0x20')]=_[_0xd9b1('0x2d')](_0x341ab2[_0xd9b1('0x20')],{'$or':_[_0xd9b1('0x1a')](_0x341ab2[_0xd9b1('0x29')],function(_0x22675c){var _0x4aac71={};_0x4aac71[_0x22675c]={'$like':'%'+_0x330300[_0xd9b1('0x22')]['filter']+'%'};return _0x4aac71;})});}_0x341ab2=_[_0xd9b1('0x2d')]({},_0x341ab2,_0x330300['options']);return db[_0xd9b1('0x41')][_0xd9b1('0x42')](_0x341ab2);}})[_0xd9b1('0x14')](function(_0x46bdd6){if(_0x46bdd6){return db['User'][_0xd9b1('0x43')]({'where':{'id':_[_0xd9b1('0x1a')](_0x46bdd6,'UserId'),'role':_0xd9b1('0x44')},'attributes':['id',_0xd9b1('0x18'),_0xd9b1('0x45'),_0xd9b1('0x46'),'createdAt']});}})[_0xd9b1('0x14')](function(_0x493c3d){if(_0x493c3d){return{'count':_0x493c3d[_0xd9b1('0x11')],'rows':_[_0xd9b1('0x1a')](_0x493c3d[_0xd9b1('0x47')],function(_0x2b614f){return{'membername':_0x2b614f[_0xd9b1('0x18')],'UserId':_0x2b614f['id'],'queue_name':_0x930a32['name'],'ChatQueueId':_0x930a32['id'],'interface':util[_0xd9b1('0x48')](_0xd9b1('0x49'),_0xd9b1('0x4a'),_0x2b614f['name']),'penalty':0x0,'paused':_0x2b614f[_0xd9b1('0x45')],'createdAt':_0x2b614f[_0xd9b1('0x4b')],'updatedAt':_0x2b614f[_0xd9b1('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd9b1('0x14')](respondWithFilteredResult(_0x5119c4,_0x341ab2))['catch'](handleError(_0x5119c4,null));};exports[_0xd9b1('0x4c')]=function(_0x2b9bf8,_0x31e49d){var _0x43a2ea={};var _0xdb690d={};var _0x29fbd9;var _0x387b33;return db[_0xd9b1('0x1b')][_0xd9b1('0x39')]({'where':{'id':_0x2b9bf8[_0xd9b1('0x25')]['id']}})[_0xd9b1('0x14')](handleEntityNotFound(_0x31e49d,null))[_0xd9b1('0x14')](function(_0x5c8ad9){if(_0x5c8ad9){_0x29fbd9=_0x5c8ad9;_0xdb690d[_0xd9b1('0x26')]=_[_0xd9b1('0x3a')](db[_0xd9b1('0x4d')][_0xd9b1('0x1c')]);_0xdb690d[_0xd9b1('0x22')]=_[_0xd9b1('0x3a')](_0x2b9bf8[_0xd9b1('0x22')]);_0xdb690d[_0xd9b1('0x27')]=_['intersection'](_0xdb690d['model'],_0xdb690d[_0xd9b1('0x22')]);_0x43a2ea['attributes']=_[_0xd9b1('0x28')](_0xdb690d[_0xd9b1('0x26')],qs[_0xd9b1('0x2a')](_0x2b9bf8[_0xd9b1('0x22')]['fields']));_0x43a2ea[_0xd9b1('0x29')]=_0x43a2ea[_0xd9b1('0x29')][_0xd9b1('0x2b')]?_0x43a2ea[_0xd9b1('0x29')]:_0xdb690d[_0xd9b1('0x26')];_0x43a2ea['order']=qs[_0xd9b1('0x3e')](_0x2b9bf8[_0xd9b1('0x22')][_0xd9b1('0x3e')]);_0x43a2ea[_0xd9b1('0x20')]=qs[_0xd9b1('0x27')](_['pick'](_0x2b9bf8[_0xd9b1('0x22')],_0xdb690d[_0xd9b1('0x27')]));if(_0x2b9bf8[_0xd9b1('0x22')][_0xd9b1('0x4e')]){_0x43a2ea[_0xd9b1('0x20')]=_['merge'](_0x43a2ea[_0xd9b1('0x20')],{'$or':_['map'](_0x43a2ea['attributes'],function(_0x160b71){var _0x3a636c={};_0x3a636c[_0x160b71]={'$like':'%'+_0x2b9bf8[_0xd9b1('0x22')][_0xd9b1('0x4e')]+'%'};return _0x3a636c;})});}_0x43a2ea=_[_0xd9b1('0x2d')]({},_0x43a2ea,_0x2b9bf8['options']);return _0x29fbd9['getTeams'](_0x43a2ea);}})['then'](function(_0x1186cd){if(_0x1186cd){_0x387b33=_0x1186cd['length'];if(!_0x2b9bf8[_0xd9b1('0x22')][_0xd9b1('0x3b')](_0xd9b1('0x3c'))){_0x43a2ea[_0xd9b1('0x10')]=qs[_0xd9b1('0x10')](_0x2b9bf8[_0xd9b1('0x22')]['limit']);_0x43a2ea[_0xd9b1('0xe')]=qs[_0xd9b1('0xe')](_0x2b9bf8[_0xd9b1('0x22')][_0xd9b1('0xe')]);}return _0x29fbd9[_0xd9b1('0x4c')](_0x43a2ea);}})[_0xd9b1('0x14')](function(_0x89cc0a){if(_0x89cc0a){return _0x89cc0a?{'count':_0x387b33,'rows':_0x89cc0a}:null;}})[_0xd9b1('0x14')](respondWithResult(_0x31e49d,null))[_0xd9b1('0x23')](handleError(_0x31e49d,null));};exports['addTeams']=function(_0x3d173c,_0x2d5f65){var _0x4a11b2=_0x3d173c['body'][_0xd9b1('0x4f')];return db['Team'][_0xd9b1('0x42')]({'where':{'id':_0x4a11b2},'attributes':['id'],'include':[{'model':db[_0xd9b1('0x50')],'as':_0xd9b1('0x51'),'attributes':['id',_0xd9b1('0x18'),_0xd9b1('0x52'),_0xd9b1('0x53'),'interface'],'raw':!![]}]})[_0xd9b1('0x14')](function(_0x58571b){if(_0x58571b){var _0x2c2915=_[_0xd9b1('0x54')](_0x58571b,function(_0x20592e){var _0x21b572=_0x20592e[_0xd9b1('0x30')]({'plain':!![]});return _0x21b572[_0xd9b1('0x51')];});return db[_0xd9b1('0x1b')][_0xd9b1('0x34')]({'where':{'id':_0x3d173c[_0xd9b1('0x25')]['id']}})['then'](function(_0x3ffd10){return db[_0xd9b1('0x55')][_0xd9b1('0x56')](function(_0x41d195){return _0x3ffd10[_0xd9b1('0x57')](_0x4a11b2,{'transaction':_0x41d195})[_0xd9b1('0x14')](function(){return BPromise[_0xd9b1('0x58')](_0x2c2915,function(_0x237310){return db[_0xd9b1('0x41')][_0xd9b1('0x59')]({'where':{'UserId':_0x237310['id'],'ChatQueueId':_0x3d173c[_0xd9b1('0x25')]['id']},'transaction':_0x41d195});});})[_0xd9b1('0x14')](function(){_0x2c2915[_0xd9b1('0x5a')](function(_0x28dbb5){socket[_0xd9b1('0x5b')](_0xd9b1('0x5c'),{'UserId':_0x28dbb5['id'],'ChatQueueId':_0x3ffd10['id']});});});});});}})[_0xd9b1('0x14')](respondWithStatusCode(_0x2d5f65,null))[_0xd9b1('0x23')](handleError(_0x2d5f65,null));};exports[_0xd9b1('0x5d')]=function(_0x519959,_0xf22845){return db[_0xd9b1('0x4d')]['findAll']({'where':{'id':_0x519959[_0xd9b1('0x22')][_0xd9b1('0x4f')]},'attributes':['id'],'include':[{'model':db[_0xd9b1('0x50')],'as':_0xd9b1('0x51'),'attributes':['id'],'raw':!![]}]})[_0xd9b1('0x14')](handleEntityNotFound(_0xf22845,null))[_0xd9b1('0x14')](function(_0x2e22d2){var _0x3e88c7=_['map'](_0x2e22d2,'id');var _0x4b51a4=[];var _0x4829f9=[];var _0x1fb26b=squel[_0xd9b1('0x5e')]();_0x1fb26b[_0xd9b1('0x5f')](_0xd9b1('0x60'))[_0xd9b1('0x61')]('team_has_chat_queues','tq')[_0xd9b1('0x62')](_0xd9b1('0x63'),'ut',_0xd9b1('0x64'))[_0xd9b1('0x20')](_0xd9b1('0x65'),_0x519959['params']['id']);for(var _0x747777=0x0;_0x747777<_0x2e22d2['length'];_0x747777+=0x1){let _0x3f1637=_0x2e22d2[_0x747777];for(var _0x577299=0x0;_0x577299<_0x3f1637[_0xd9b1('0x51')]['length'];_0x577299+=0x1){let _0x103b1d=_0x3f1637[_0xd9b1('0x51')][_0x577299];var _0x4aeab5=_0x1fb26b[_0xd9b1('0x66')]();_0x4aeab5[_0xd9b1('0x20')](_0xd9b1('0x67'),_0x103b1d['id']);_0x4829f9[_0xd9b1('0x68')](db[_0xd9b1('0x55')][_0xd9b1('0x22')](_0x4aeab5[_0xd9b1('0x69')](),{'type':db['sequelize'][_0xd9b1('0x6a')][_0xd9b1('0x6b')]})[_0xd9b1('0x14')](function(_0x6e75c7){if(_0x6e75c7[_0xd9b1('0x2b')]===0x1){return _0x103b1d['id'];}else{var _0x2a8858=_['every'](_[_0xd9b1('0x1a')](_0x6e75c7,_0xd9b1('0x6c')),function(_0x1c98b6){return _[_0xd9b1('0x6d')](_0x3e88c7,_0x1c98b6);});if(_0x2a8858){return _0x103b1d['id'];}}}));}}return BPromise[_0xd9b1('0x6e')](_0x4829f9)[_0xd9b1('0x14')](function(_0x2ae438){_0x4b51a4=_(_0x4b51a4)[_0xd9b1('0x6f')](_0x2ae438)['compact']()[_0xd9b1('0x70')]();return db[_0xd9b1('0x1b')][_0xd9b1('0x34')]({'where':{'id':_0x519959[_0xd9b1('0x25')]['id']}})['then'](function(_0x4730c7){return db[_0xd9b1('0x55')][_0xd9b1('0x56')](function(_0x2cea14){return _0x4730c7[_0xd9b1('0x5d')](_0x519959[_0xd9b1('0x22')][_0xd9b1('0x4f')],{'transaction':_0x2cea14})[_0xd9b1('0x14')](function(){if(!_['isEmpty'](_0x4b51a4)){return _0x4730c7[_0xd9b1('0x71')](_0x4b51a4,{'transaction':_0x2cea14});}})[_0xd9b1('0x14')](function(){_0x4b51a4['forEach'](function(_0x743f80){socket[_0xd9b1('0x5b')]('userChatQueue:remove',{'UserId':_0x743f80,'ChatQueueId':_0x4730c7['id']});});});});});});})[_0xd9b1('0x14')](respondWithStatusCode(_0xf22845,null))[_0xd9b1('0x23')](handleError(_0xf22845,null));};exports[_0xd9b1('0x72')]=function(_0x44ea1b,_0x56ef97){return db['ChatQueue']['find']({'where':{'id':_0x44ea1b[_0xd9b1('0x25')]['id']}})[_0xd9b1('0x14')](handleEntityNotFound(_0x56ef97,null))[_0xd9b1('0x14')](function(_0x274dba){if(_0x274dba){return _0x274dba[_0xd9b1('0x72')](_0x44ea1b['body'][_0xd9b1('0x4f')],_['omit'](_0x44ea1b[_0xd9b1('0x2f')],[_0xd9b1('0x4f'),'id'])||{})[_0xd9b1('0x73')](function(_0x18f9a2){for(var _0x21421b=0x0;_0x21421b<_0x44ea1b['body']['ids'][_0xd9b1('0x2b')];_0x21421b+=0x1){socket[_0xd9b1('0x5b')]('userChatQueue:save',{'UserId':Number(_0x44ea1b[_0xd9b1('0x2f')][_0xd9b1('0x4f')][_0x21421b]),'ChatQueueId':Number(_0x44ea1b['params']['id'])});}return _0x18f9a2;});}})[_0xd9b1('0x14')](respondWithResult(_0x56ef97,null))['catch'](handleError(_0x56ef97,null));};exports[_0xd9b1('0x71')]=function(_0x40900a,_0x3e748a){return db[_0xd9b1('0x1b')][_0xd9b1('0x34')]({'where':{'id':_0x40900a[_0xd9b1('0x25')]['id']}})['then'](handleEntityNotFound(_0x3e748a,null))[_0xd9b1('0x14')](function(_0x2463ca){if(_0x2463ca){return _0x2463ca[_0xd9b1('0x71')](_0x40900a['query'][_0xd9b1('0x4f')])[_0xd9b1('0x14')](function(){if(_[_0xd9b1('0x74')](_0x40900a['query'][_0xd9b1('0x4f')])){for(var _0x10407b=0x0;_0x10407b<_0x40900a['query'][_0xd9b1('0x4f')][_0xd9b1('0x2b')];_0x10407b+=0x1){socket[_0xd9b1('0x5b')](_0xd9b1('0x75'),{'UserId':Number(_0x40900a[_0xd9b1('0x22')]['ids'][_0x10407b]),'ChatQueueId':Number(_0x40900a[_0xd9b1('0x25')]['id'])});}}else{socket[_0xd9b1('0x5b')](_0xd9b1('0x75'),{'UserId':Number(_0x40900a[_0xd9b1('0x22')][_0xd9b1('0x4f')]),'ChatQueueId':Number(_0x40900a['params']['id'])});}});}})[_0xd9b1('0x14')](respondWithStatusCode(_0x3e748a,null))[_0xd9b1('0x23')](handleError(_0x3e748a,null));};exports[_0xd9b1('0x76')]=function(_0x507793,_0x1af87f){var _0x5eb5a2={};var _0x5a0395={};var _0x575f8a;var _0x5d07e1;return db[_0xd9b1('0x1b')][_0xd9b1('0x39')]({'where':{'id':_0x507793[_0xd9b1('0x25')]['id']}})['then'](handleEntityNotFound(_0x1af87f,null))[_0xd9b1('0x14')](function(_0x253635){if(_0x253635){_0x575f8a=_0x253635;_0x5a0395[_0xd9b1('0x26')]=_[_0xd9b1('0x3a')](db['User'][_0xd9b1('0x1c')]);_0x5a0395['query']=_['keys'](_0x507793['query']);_0x5a0395[_0xd9b1('0x27')]=_[_0xd9b1('0x28')](_0x5a0395[_0xd9b1('0x26')],_0x5a0395[_0xd9b1('0x22')]);_0x5eb5a2['attributes']=_[_0xd9b1('0x28')](_0x5a0395[_0xd9b1('0x26')],qs[_0xd9b1('0x2a')](_0x507793[_0xd9b1('0x22')][_0xd9b1('0x2a')]));_0x5eb5a2['attributes']=_0x5eb5a2[_0xd9b1('0x29')][_0xd9b1('0x2b')]?_0x5eb5a2[_0xd9b1('0x29')]:_0x5a0395[_0xd9b1('0x26')];_0x5eb5a2[_0xd9b1('0x3d')]=qs[_0xd9b1('0x3e')](_0x507793[_0xd9b1('0x22')]['sort']);_0x5eb5a2[_0xd9b1('0x20')]=qs['filters'](_[_0xd9b1('0x3f')](_0x507793[_0xd9b1('0x22')],_0x5a0395[_0xd9b1('0x27')]));if(_0x507793['query'][_0xd9b1('0x4e')]){_0x5eb5a2[_0xd9b1('0x20')]=_[_0xd9b1('0x2d')](_0x5eb5a2['where'],{'$or':_[_0xd9b1('0x1a')](_0x5eb5a2[_0xd9b1('0x29')],function(_0x53d2f1){var _0x887e61={};_0x887e61[_0x53d2f1]={'$like':'%'+_0x507793[_0xd9b1('0x22')]['filter']+'%'};return _0x887e61;})});}_0x5eb5a2=_[_0xd9b1('0x2d')]({},_0x5eb5a2,_0x507793[_0xd9b1('0x77')]);return _0x575f8a[_0xd9b1('0x76')](_0x5eb5a2);}})['then'](function(_0x25a974){if(_0x25a974){_0x5d07e1=_0x25a974['length'];if(!_0x507793[_0xd9b1('0x22')]['hasOwnProperty'](_0xd9b1('0x3c'))){_0x5eb5a2[_0xd9b1('0x10')]=qs['limit'](_0x507793[_0xd9b1('0x22')][_0xd9b1('0x10')]);_0x5eb5a2[_0xd9b1('0xe')]=qs[_0xd9b1('0xe')](_0x507793[_0xd9b1('0x22')][_0xd9b1('0xe')]);}return _0x575f8a[_0xd9b1('0x76')](_0x5eb5a2);}})[_0xd9b1('0x14')](function(_0x25fbcf){if(_0x25fbcf){return _0x25fbcf?{'count':_0x5d07e1,'rows':_0x25fbcf}:null;}})[_0xd9b1('0x14')](respondWithResult(_0x1af87f,null))[_0xd9b1('0x23')](handleError(_0x1af87f,null));}; \ No newline at end of file +var _0x3f2c=['transaction','each','forEach','emit','userChatQueue:save','removeTeams','select','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','squel','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','offset','undefined','count','limit','json','update','then','destroy','get','UserProfileResource','stack','name','map','ChatQueue','rawAttributes','fieldName','key','where','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','autoAssociation','error','describe','findOne','UserChatQueue','nolimit','order','sort','pick','ChatQueueId','filter','User','findAndCountAll','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize'];(function(_0x27b68a,_0xc568ce){var _0x46fe17=function(_0x34349c){while(--_0x34349c){_0x27b68a['push'](_0x27b68a['shift']());}};_0x46fe17(++_0xc568ce);}(_0x3f2c,0x10c));var _0xc3f2=function(_0x510b29,_0x274123){_0x510b29=_0x510b29-0x0;var _0x345aa7=_0x3f2c[_0x510b29];return _0x345aa7;};'use strict';var BPromise=require(_0xc3f2('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0xc3f2('0x1'));var Redis=require(_0xc3f2('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc3f2('0x3'));var config=require(_0xc3f2('0x4'));var db=require(_0xc3f2('0x5'))['db'];config[_0xc3f2('0x6')]=_[_0xc3f2('0x7')](config['redis'],{'host':_0xc3f2('0x8'),'port':0x18eb});var socket=require(_0xc3f2('0x9'))(new Redis(config[_0xc3f2('0x6')]));require(_0xc3f2('0xa'))[_0xc3f2('0xb')](socket);function respondWithStatusCode(_0x141dcf,_0x1c6f93){_0x1c6f93=_0x1c6f93||0xcc;return function(_0x200a9e){if(_0x200a9e){return _0x141dcf[_0xc3f2('0xc')](_0x1c6f93);}return _0x141dcf[_0xc3f2('0xd')](_0x1c6f93)[_0xc3f2('0xe')]();};}function respondWithResult(_0x1c77e6,_0xd2cc5a){_0xd2cc5a=_0xd2cc5a||0xc8;return function(_0x396e84){if(_0x396e84){return _0x1c77e6['status'](_0xd2cc5a)['json'](_0x396e84);}};}function respondWithFilteredResult(_0x1d3395,_0x3cae55){return function(_0x3b4dda){if(_0x3b4dda){var _0x5984ef=typeof _0x3cae55[_0xc3f2('0xf')]===_0xc3f2('0x10')&&typeof _0x3cae55['limit']===_0xc3f2('0x10');var _0x24ecdd=_0x3b4dda[_0xc3f2('0x11')];var _0x110055=_0x5984ef?0x0:_0x3cae55['offset'];var _0x39105a=_0x5984ef?_0x3b4dda[_0xc3f2('0x11')]:_0x3cae55[_0xc3f2('0xf')]+_0x3cae55[_0xc3f2('0x12')];var _0x3bebf9;if(_0x39105a>=_0x24ecdd){_0x39105a=_0x24ecdd;_0x3bebf9=0xc8;}else{_0x3bebf9=0xce;}_0x1d3395[_0xc3f2('0xd')](_0x3bebf9);return _0x1d3395['set']('Content-Range',_0x110055+'-'+_0x39105a+'/'+_0x24ecdd)[_0xc3f2('0x13')](_0x3b4dda);}return null;};}function saveUpdates(_0x5ca1e3){return function(_0x571a23){if(_0x571a23){return _0x571a23[_0xc3f2('0x14')](_0x5ca1e3)[_0xc3f2('0x15')](function(_0x33a58f){return _0x33a58f;});}return null;};}function removeEntity(_0x306fe9){return function(_0x44b884){if(_0x44b884){return _0x44b884[_0xc3f2('0x16')]()[_0xc3f2('0x15')](function(){var _0x1a9880=_0x44b884[_0xc3f2('0x17')]({'plain':!![]});var _0x29aa9e='ChatQueues';return db[_0xc3f2('0x18')][_0xc3f2('0x16')]({'where':{'type':_0x29aa9e,'resourceId':_0x1a9880['id']}})[_0xc3f2('0x15')](function(){return _0x44b884;});})[_0xc3f2('0x15')](function(){_0x306fe9[_0xc3f2('0xd')](0xcc)[_0xc3f2('0xe')]();});}};}function handleEntityNotFound(_0x2a413d){return function(_0xcf5811){if(!_0xcf5811){_0x2a413d['sendStatus'](0x194);}return _0xcf5811;};}function handleError(_0x509ec5,_0x80bdca){_0x80bdca=_0x80bdca||0x1f4;return function(_0x4b2586){logger['error'](_0x4b2586[_0xc3f2('0x19')]);if(_0x4b2586[_0xc3f2('0x1a')]){delete _0x4b2586[_0xc3f2('0x1a')];}_0x509ec5[_0xc3f2('0xd')](_0x80bdca)['send'](_0x4b2586);};}exports['index']=function(_0x48c3ce,_0xad1f72){var _0xa17060={};var _0x2dcd64={'count':0x0,'rows':[]};var _0x335d76=_[_0xc3f2('0x1b')](db[_0xc3f2('0x1c')][_0xc3f2('0x1d')],function(_0x501370){return{'name':_0x501370[_0xc3f2('0x1e')],'type':_0x501370['type'][_0xc3f2('0x1f')]};});_0xa17060=qs['getOptions'](_0x335d76,_0x48c3ce);var _0x1f9e79={'where':_0xa17060[_0xc3f2('0x20')]};return db[_0xc3f2('0x1c')][_0xc3f2('0x11')](_0x1f9e79)[_0xc3f2('0x15')](function(_0x2a3b95){_0x2dcd64[_0xc3f2('0x11')]=_0x2a3b95;_0xa17060[_0xc3f2('0x21')]=qs[_0xc3f2('0x21')](_0x48c3ce['query']);return db[_0xc3f2('0x1c')][_0xc3f2('0x22')](_0xa17060);})[_0xc3f2('0x15')](function(_0x1f5cee){_0x2dcd64[_0xc3f2('0x23')]=_0x1f5cee;return _0x2dcd64;})['then'](respondWithFilteredResult(_0xad1f72,_0xa17060))[_0xc3f2('0x24')](handleError(_0xad1f72,null));};exports[_0xc3f2('0x25')]=function(_0x21d4f6,_0x4691ff){var _0x39225b={'raw':!![],'where':{'id':_0x21d4f6[_0xc3f2('0x26')]['id']}},_0x450662={};_0x450662[_0xc3f2('0x27')]=_[_0xc3f2('0x28')](db['ChatQueue'][_0xc3f2('0x1d')]);_0x450662['query']=_[_0xc3f2('0x28')](_0x21d4f6[_0xc3f2('0x29')]);_0x450662[_0xc3f2('0x2a')]=_[_0xc3f2('0x2b')](_0x450662[_0xc3f2('0x27')],_0x450662[_0xc3f2('0x29')]);_0x39225b[_0xc3f2('0x2c')]=_[_0xc3f2('0x2b')](_0x450662[_0xc3f2('0x27')],qs[_0xc3f2('0x2d')](_0x21d4f6[_0xc3f2('0x29')][_0xc3f2('0x2d')]));_0x39225b[_0xc3f2('0x2c')]=_0x39225b[_0xc3f2('0x2c')][_0xc3f2('0x2e')]?_0x39225b[_0xc3f2('0x2c')]:_0x450662['model'];if(_0x21d4f6['query'][_0xc3f2('0x2f')]){_0x39225b[_0xc3f2('0x21')]=[{'all':!![]}];}_0x39225b=_[_0xc3f2('0x30')]({},_0x39225b,_0x21d4f6[_0xc3f2('0x31')]);return db['ChatQueue'][_0xc3f2('0x32')](_0x39225b)[_0xc3f2('0x15')](handleEntityNotFound(_0x4691ff,null))[_0xc3f2('0x15')](respondWithResult(_0x4691ff,null))['catch'](handleError(_0x4691ff,null));};exports[_0xc3f2('0x33')]=function(_0x4b02ad,_0x58aa62){return db[_0xc3f2('0x1c')][_0xc3f2('0x33')](_0x4b02ad[_0xc3f2('0x34')],{})[_0xc3f2('0x15')](function(_0x148972){var _0x465d1f=_0x4b02ad['user'][_0xc3f2('0x17')]({'plain':!![]});if(!_0x465d1f)throw new Error(_0xc3f2('0x35'));if(_0x465d1f[_0xc3f2('0x36')]===_0xc3f2('0x37')){var _0xaa0c2d=_0x148972[_0xc3f2('0x17')]({'plain':!![]});var _0x13b72f=_0xc3f2('0x38');return db['UserProfileSection'][_0xc3f2('0x32')]({'where':{'name':_0x13b72f,'userProfileId':_0x465d1f['userProfileId']},'raw':!![]})['then'](function(_0x25710c){if(_0x25710c&&_0x25710c[_0xc3f2('0x39')]===0x0){return db[_0xc3f2('0x18')][_0xc3f2('0x33')]({'name':_0xaa0c2d[_0xc3f2('0x1a')],'resourceId':_0xaa0c2d['id'],'type':_0x25710c[_0xc3f2('0x1a')],'sectionId':_0x25710c['id']},{})['then'](function(){return _0x148972;});}else{return _0x148972;}})[_0xc3f2('0x24')](function(_0x5bcacb){logger[_0xc3f2('0x3a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bcacb);throw _0x5bcacb;});}return _0x148972;})['then'](respondWithResult(_0x58aa62,0xc9))[_0xc3f2('0x24')](handleError(_0x58aa62,null));};exports[_0xc3f2('0x14')]=function(_0x278d04,_0x1a4ea4){if(_0x278d04[_0xc3f2('0x34')]['id']){delete _0x278d04[_0xc3f2('0x34')]['id'];}return db[_0xc3f2('0x1c')][_0xc3f2('0x32')]({'where':{'id':_0x278d04['params']['id']}})[_0xc3f2('0x15')](handleEntityNotFound(_0x1a4ea4,null))[_0xc3f2('0x15')](saveUpdates(_0x278d04['body'],null))[_0xc3f2('0x15')](respondWithResult(_0x1a4ea4,null))[_0xc3f2('0x24')](handleError(_0x1a4ea4,null));};exports[_0xc3f2('0x16')]=function(_0x37f658,_0x5c923c){return db['ChatQueue']['find']({'where':{'id':_0x37f658[_0xc3f2('0x26')]['id']}})['then'](handleEntityNotFound(_0x5c923c,null))['then'](removeEntity(_0x5c923c,null))[_0xc3f2('0x24')](handleError(_0x5c923c,null));};exports[_0xc3f2('0x3b')]=function(_0x5a8a06,_0xc846f3){return db[_0xc3f2('0x1c')]['describe']()[_0xc3f2('0x15')](respondWithResult(_0xc846f3,null))[_0xc3f2('0x24')](handleError(_0xc846f3,null));};exports['getMembers']=function(_0xd73834,_0x2c6b81){var _0x1e84a6={'raw':!![],'where':{}},_0x77b01={},_0x1cb73e;return db[_0xc3f2('0x1c')][_0xc3f2('0x3c')]({'where':{'id':_0xd73834[_0xc3f2('0x26')]['id']}})[_0xc3f2('0x15')](handleEntityNotFound(_0x2c6b81,null))[_0xc3f2('0x15')](function(_0x291e9b){if(_0x291e9b){_0x1cb73e=_0x291e9b[_0xc3f2('0x17')]({'plain':!![]});_0x77b01[_0xc3f2('0x27')]=_[_0xc3f2('0x28')](db[_0xc3f2('0x3d')][_0xc3f2('0x1d')]);_0x77b01[_0xc3f2('0x29')]=_['keys'](_0xd73834[_0xc3f2('0x29')]);_0x77b01[_0xc3f2('0x2a')]=_[_0xc3f2('0x2b')](_0x77b01[_0xc3f2('0x27')],_0x77b01['query']);_0x1e84a6['attributes']=_[_0xc3f2('0x2b')](_0x77b01['model'],qs[_0xc3f2('0x2d')](_0xd73834[_0xc3f2('0x29')]['fields']));_0x1e84a6[_0xc3f2('0x2c')]=_0x1e84a6[_0xc3f2('0x2c')]['length']?_0x1e84a6[_0xc3f2('0x2c')]:_0x77b01[_0xc3f2('0x27')];if(!_0xd73834[_0xc3f2('0x29')]['hasOwnProperty'](_0xc3f2('0x3e'))){_0x1e84a6[_0xc3f2('0x12')]=qs[_0xc3f2('0x12')](_0xd73834[_0xc3f2('0x29')]['limit']);_0x1e84a6['offset']=qs[_0xc3f2('0xf')](_0xd73834[_0xc3f2('0x29')][_0xc3f2('0xf')]);}_0x1e84a6[_0xc3f2('0x3f')]=qs[_0xc3f2('0x40')](_0xd73834['query'][_0xc3f2('0x40')]);_0x1e84a6[_0xc3f2('0x20')]=qs['filters'](_[_0xc3f2('0x41')](_0xd73834['query'],_0x77b01[_0xc3f2('0x2a')]));_0x1e84a6[_0xc3f2('0x20')][_0xc3f2('0x42')]=_0x291e9b['id'];if(_0xd73834[_0xc3f2('0x29')][_0xc3f2('0x43')]){_0x1e84a6[_0xc3f2('0x20')]=_[_0xc3f2('0x30')](_0x1e84a6[_0xc3f2('0x20')],{'$or':_[_0xc3f2('0x1b')](_0x1e84a6[_0xc3f2('0x2c')],function(_0x4d6c3b){var _0x2c9937={};_0x2c9937[_0x4d6c3b]={'$like':'%'+_0xd73834[_0xc3f2('0x29')][_0xc3f2('0x43')]+'%'};return _0x2c9937;})});}_0x1e84a6=_['merge']({},_0x1e84a6,_0xd73834['options']);return db[_0xc3f2('0x3d')][_0xc3f2('0x22')](_0x1e84a6);}})[_0xc3f2('0x15')](function(_0x4eb0c2){if(_0x4eb0c2){return db[_0xc3f2('0x44')][_0xc3f2('0x45')]({'where':{'id':_[_0xc3f2('0x1b')](_0x4eb0c2,'UserId'),'role':'agent'},'attributes':['id',_0xc3f2('0x1a'),_0xc3f2('0x46'),_0xc3f2('0x47'),_0xc3f2('0x48')]});}})[_0xc3f2('0x15')](function(_0x10a852){if(_0x10a852){return{'count':_0x10a852[_0xc3f2('0x11')],'rows':_[_0xc3f2('0x1b')](_0x10a852['rows'],function(_0x381ec1){return{'membername':_0x381ec1[_0xc3f2('0x1a')],'UserId':_0x381ec1['id'],'queue_name':_0x1cb73e[_0xc3f2('0x1a')],'ChatQueueId':_0x1cb73e['id'],'interface':util[_0xc3f2('0x49')](_0xc3f2('0x4a'),_0xc3f2('0x4b'),_0x381ec1[_0xc3f2('0x1a')]),'penalty':0x0,'paused':_0x381ec1[_0xc3f2('0x46')],'createdAt':_0x381ec1[_0xc3f2('0x48')],'updatedAt':_0x381ec1[_0xc3f2('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc3f2('0x15')](respondWithFilteredResult(_0x2c6b81,_0x1e84a6))[_0xc3f2('0x24')](handleError(_0x2c6b81,null));};exports[_0xc3f2('0x4c')]=function(_0x4ad0dc,_0x267468){var _0x346f5c={};var _0x483438={};var _0x5a9b1f;var _0x226914;return db[_0xc3f2('0x1c')][_0xc3f2('0x3c')]({'where':{'id':_0x4ad0dc[_0xc3f2('0x26')]['id']}})[_0xc3f2('0x15')](handleEntityNotFound(_0x267468,null))[_0xc3f2('0x15')](function(_0x260191){if(_0x260191){_0x5a9b1f=_0x260191;_0x483438['model']=_[_0xc3f2('0x28')](db[_0xc3f2('0x4d')][_0xc3f2('0x1d')]);_0x483438[_0xc3f2('0x29')]=_[_0xc3f2('0x28')](_0x4ad0dc['query']);_0x483438[_0xc3f2('0x2a')]=_[_0xc3f2('0x2b')](_0x483438['model'],_0x483438['query']);_0x346f5c['attributes']=_[_0xc3f2('0x2b')](_0x483438[_0xc3f2('0x27')],qs[_0xc3f2('0x2d')](_0x4ad0dc[_0xc3f2('0x29')][_0xc3f2('0x2d')]));_0x346f5c[_0xc3f2('0x2c')]=_0x346f5c[_0xc3f2('0x2c')]['length']?_0x346f5c['attributes']:_0x483438[_0xc3f2('0x27')];_0x346f5c[_0xc3f2('0x3f')]=qs['sort'](_0x4ad0dc[_0xc3f2('0x29')][_0xc3f2('0x40')]);_0x346f5c[_0xc3f2('0x20')]=qs[_0xc3f2('0x2a')](_[_0xc3f2('0x41')](_0x4ad0dc[_0xc3f2('0x29')],_0x483438[_0xc3f2('0x2a')]));if(_0x4ad0dc['query'][_0xc3f2('0x43')]){_0x346f5c[_0xc3f2('0x20')]=_['merge'](_0x346f5c[_0xc3f2('0x20')],{'$or':_[_0xc3f2('0x1b')](_0x346f5c['attributes'],function(_0x34cf3c){var _0x21e6c8={};_0x21e6c8[_0x34cf3c]={'$like':'%'+_0x4ad0dc[_0xc3f2('0x29')][_0xc3f2('0x43')]+'%'};return _0x21e6c8;})});}_0x346f5c=_['merge']({},_0x346f5c,_0x4ad0dc['options']);return _0x5a9b1f[_0xc3f2('0x4c')](_0x346f5c);}})[_0xc3f2('0x15')](function(_0xfbdb88){if(_0xfbdb88){_0x226914=_0xfbdb88[_0xc3f2('0x2e')];if(!_0x4ad0dc[_0xc3f2('0x29')][_0xc3f2('0x4e')](_0xc3f2('0x3e'))){_0x346f5c[_0xc3f2('0x12')]=qs[_0xc3f2('0x12')](_0x4ad0dc[_0xc3f2('0x29')][_0xc3f2('0x12')]);_0x346f5c[_0xc3f2('0xf')]=qs[_0xc3f2('0xf')](_0x4ad0dc[_0xc3f2('0x29')][_0xc3f2('0xf')]);}return _0x5a9b1f[_0xc3f2('0x4c')](_0x346f5c);}})[_0xc3f2('0x15')](function(_0x198831){if(_0x198831){return _0x198831?{'count':_0x226914,'rows':_0x198831}:null;}})[_0xc3f2('0x15')](respondWithResult(_0x267468,null))[_0xc3f2('0x24')](handleError(_0x267468,null));};exports[_0xc3f2('0x4f')]=function(_0x302f44,_0x4fc1b8){var _0xb80715=_0x302f44[_0xc3f2('0x34')][_0xc3f2('0x50')];return db['Team'][_0xc3f2('0x22')]({'where':{'id':_0xb80715},'attributes':['id'],'include':[{'model':db[_0xc3f2('0x44')],'as':_0xc3f2('0x51'),'attributes':['id',_0xc3f2('0x1a'),'online',_0xc3f2('0x52'),_0xc3f2('0x53')],'raw':!![]}]})[_0xc3f2('0x15')](function(_0x17cc64){if(_0x17cc64){var _0x41e787=_[_0xc3f2('0x54')](_0x17cc64,function(_0x1f2cc5){var _0x38a80e=_0x1f2cc5[_0xc3f2('0x17')]({'plain':!![]});return _0x38a80e[_0xc3f2('0x51')];});return db[_0xc3f2('0x1c')][_0xc3f2('0x32')]({'where':{'id':_0x302f44[_0xc3f2('0x26')]['id']}})[_0xc3f2('0x15')](function(_0x213a38){return db[_0xc3f2('0x55')][_0xc3f2('0x56')](function(_0x4437af){return _0x213a38[_0xc3f2('0x4f')](_0xb80715,{'transaction':_0x4437af})[_0xc3f2('0x15')](function(){return BPromise[_0xc3f2('0x57')](_0x41e787,function(_0x22aa77){return db[_0xc3f2('0x3d')]['findOrCreate']({'where':{'UserId':_0x22aa77['id'],'ChatQueueId':_0x302f44[_0xc3f2('0x26')]['id']},'transaction':_0x4437af});});})['then'](function(){_0x41e787[_0xc3f2('0x58')](function(_0x8d949f){socket[_0xc3f2('0x59')](_0xc3f2('0x5a'),{'UserId':_0x8d949f['id'],'ChatQueueId':_0x213a38['id']});});});});});}})[_0xc3f2('0x15')](respondWithStatusCode(_0x4fc1b8,null))[_0xc3f2('0x24')](handleError(_0x4fc1b8,null));};exports[_0xc3f2('0x5b')]=function(_0x7a8a0c,_0xdfbde8){return db['Team'][_0xc3f2('0x22')]({'where':{'id':_0x7a8a0c['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc3f2('0x51'),'attributes':['id'],'raw':!![]}]})[_0xc3f2('0x15')](handleEntityNotFound(_0xdfbde8,null))['then'](function(_0x2f28f4){var _0x1695b4=_[_0xc3f2('0x1b')](_0x2f28f4,'id');var _0x2aa3b8=[];var _0x3da533=[];var _0x49a9e0=squel[_0xc3f2('0x5c')]();_0x49a9e0[_0xc3f2('0x5d')]('tq.TeamId')[_0xc3f2('0x5e')](_0xc3f2('0x5f'),'tq')[_0xc3f2('0x60')](_0xc3f2('0x61'),'ut',_0xc3f2('0x62'))[_0xc3f2('0x20')](_0xc3f2('0x63'),_0x7a8a0c[_0xc3f2('0x26')]['id']);for(var _0x10bcc5=0x0;_0x10bcc5<_0x2f28f4['length'];_0x10bcc5+=0x1){let _0x11b975=_0x2f28f4[_0x10bcc5];for(var _0x34252d=0x0;_0x34252d<_0x11b975[_0xc3f2('0x51')][_0xc3f2('0x2e')];_0x34252d+=0x1){let _0x24365a=_0x11b975[_0xc3f2('0x51')][_0x34252d];var _0x5fc33b=_0x49a9e0['clone']();_0x5fc33b[_0xc3f2('0x20')]('ut.UserId\x20=\x20?',_0x24365a['id']);_0x3da533[_0xc3f2('0x64')](db['sequelize'][_0xc3f2('0x29')](_0x5fc33b[_0xc3f2('0x65')](),{'type':db[_0xc3f2('0x55')][_0xc3f2('0x66')][_0xc3f2('0x67')]})[_0xc3f2('0x15')](function(_0x13de59){if(_0x13de59[_0xc3f2('0x2e')]===0x1){return _0x24365a['id'];}else{var _0x17c7d8=_['every'](_['map'](_0x13de59,_0xc3f2('0x68')),function(_0x290ed9){return _[_0xc3f2('0x69')](_0x1695b4,_0x290ed9);});if(_0x17c7d8){return _0x24365a['id'];}}}));}}return BPromise[_0xc3f2('0x6a')](_0x3da533)[_0xc3f2('0x15')](function(_0x443fbb){_0x2aa3b8=_(_0x2aa3b8)[_0xc3f2('0x6b')](_0x443fbb)[_0xc3f2('0x6c')]()[_0xc3f2('0x6d')]();return db[_0xc3f2('0x1c')][_0xc3f2('0x32')]({'where':{'id':_0x7a8a0c[_0xc3f2('0x26')]['id']}})['then'](function(_0x1d39eb){return db['sequelize'][_0xc3f2('0x56')](function(_0x2ca53a){return _0x1d39eb['removeTeams'](_0x7a8a0c[_0xc3f2('0x29')]['ids'],{'transaction':_0x2ca53a})[_0xc3f2('0x15')](function(){if(!_[_0xc3f2('0x6e')](_0x2aa3b8)){return _0x1d39eb[_0xc3f2('0x6f')](_0x2aa3b8,{'transaction':_0x2ca53a});}})[_0xc3f2('0x15')](function(){_0x2aa3b8['forEach'](function(_0x38388b){socket[_0xc3f2('0x59')](_0xc3f2('0x70'),{'UserId':_0x38388b,'ChatQueueId':_0x1d39eb['id']});});});});});});})['then'](respondWithStatusCode(_0xdfbde8,null))[_0xc3f2('0x24')](handleError(_0xdfbde8,null));};exports[_0xc3f2('0x71')]=function(_0x22e491,_0x408f96){return db[_0xc3f2('0x1c')][_0xc3f2('0x32')]({'where':{'id':_0x22e491[_0xc3f2('0x26')]['id']}})[_0xc3f2('0x15')](handleEntityNotFound(_0x408f96,null))[_0xc3f2('0x15')](function(_0x1d1438){if(_0x1d1438){return _0x1d1438[_0xc3f2('0x71')](_0x22e491[_0xc3f2('0x34')]['ids'],_[_0xc3f2('0x72')](_0x22e491[_0xc3f2('0x34')],['ids','id'])||{})[_0xc3f2('0x73')](function(_0x18f90){for(var _0x2bcffe=0x0;_0x2bcffe<_0x22e491[_0xc3f2('0x34')][_0xc3f2('0x50')]['length'];_0x2bcffe+=0x1){socket[_0xc3f2('0x59')](_0xc3f2('0x5a'),{'UserId':Number(_0x22e491[_0xc3f2('0x34')][_0xc3f2('0x50')][_0x2bcffe]),'ChatQueueId':Number(_0x22e491[_0xc3f2('0x26')]['id'])});}return _0x18f90;});}})[_0xc3f2('0x15')](respondWithResult(_0x408f96,null))[_0xc3f2('0x24')](handleError(_0x408f96,null));};exports[_0xc3f2('0x6f')]=function(_0x808557,_0x533586){return db[_0xc3f2('0x1c')][_0xc3f2('0x32')]({'where':{'id':_0x808557['params']['id']}})[_0xc3f2('0x15')](handleEntityNotFound(_0x533586,null))['then'](function(_0x4da014){if(_0x4da014){return _0x4da014[_0xc3f2('0x6f')](_0x808557[_0xc3f2('0x29')]['ids'])[_0xc3f2('0x15')](function(){if(_[_0xc3f2('0x74')](_0x808557[_0xc3f2('0x29')][_0xc3f2('0x50')])){for(var _0x1c4b89=0x0;_0x1c4b89<_0x808557[_0xc3f2('0x29')][_0xc3f2('0x50')][_0xc3f2('0x2e')];_0x1c4b89+=0x1){socket[_0xc3f2('0x59')](_0xc3f2('0x70'),{'UserId':Number(_0x808557['query'][_0xc3f2('0x50')][_0x1c4b89]),'ChatQueueId':Number(_0x808557[_0xc3f2('0x26')]['id'])});}}else{socket[_0xc3f2('0x59')]('userChatQueue:remove',{'UserId':Number(_0x808557[_0xc3f2('0x29')][_0xc3f2('0x50')]),'ChatQueueId':Number(_0x808557[_0xc3f2('0x26')]['id'])});}});}})[_0xc3f2('0x15')](respondWithStatusCode(_0x533586,null))['catch'](handleError(_0x533586,null));};exports[_0xc3f2('0x75')]=function(_0x3a7a66,_0x4dd608){var _0x17ed0e={};var _0x1a031e={};var _0x5bbb23;var _0x14d892;return db[_0xc3f2('0x1c')][_0xc3f2('0x3c')]({'where':{'id':_0x3a7a66[_0xc3f2('0x26')]['id']}})[_0xc3f2('0x15')](handleEntityNotFound(_0x4dd608,null))['then'](function(_0x447b3c){if(_0x447b3c){_0x5bbb23=_0x447b3c;_0x1a031e[_0xc3f2('0x27')]=_[_0xc3f2('0x28')](db[_0xc3f2('0x44')][_0xc3f2('0x1d')]);_0x1a031e[_0xc3f2('0x29')]=_[_0xc3f2('0x28')](_0x3a7a66[_0xc3f2('0x29')]);_0x1a031e[_0xc3f2('0x2a')]=_[_0xc3f2('0x2b')](_0x1a031e[_0xc3f2('0x27')],_0x1a031e[_0xc3f2('0x29')]);_0x17ed0e[_0xc3f2('0x2c')]=_[_0xc3f2('0x2b')](_0x1a031e[_0xc3f2('0x27')],qs[_0xc3f2('0x2d')](_0x3a7a66[_0xc3f2('0x29')][_0xc3f2('0x2d')]));_0x17ed0e[_0xc3f2('0x2c')]=_0x17ed0e[_0xc3f2('0x2c')]['length']?_0x17ed0e[_0xc3f2('0x2c')]:_0x1a031e[_0xc3f2('0x27')];_0x17ed0e['order']=qs['sort'](_0x3a7a66[_0xc3f2('0x29')][_0xc3f2('0x40')]);_0x17ed0e['where']=qs[_0xc3f2('0x2a')](_[_0xc3f2('0x41')](_0x3a7a66['query'],_0x1a031e[_0xc3f2('0x2a')]));if(_0x3a7a66[_0xc3f2('0x29')]['filter']){_0x17ed0e['where']=_['merge'](_0x17ed0e[_0xc3f2('0x20')],{'$or':_['map'](_0x17ed0e[_0xc3f2('0x2c')],function(_0x17bc2d){var _0x187aa3={};_0x187aa3[_0x17bc2d]={'$like':'%'+_0x3a7a66[_0xc3f2('0x29')][_0xc3f2('0x43')]+'%'};return _0x187aa3;})});}_0x17ed0e=_[_0xc3f2('0x30')]({},_0x17ed0e,_0x3a7a66[_0xc3f2('0x31')]);return _0x5bbb23[_0xc3f2('0x75')](_0x17ed0e);}})[_0xc3f2('0x15')](function(_0x40a3f4){if(_0x40a3f4){_0x14d892=_0x40a3f4[_0xc3f2('0x2e')];if(!_0x3a7a66['query'][_0xc3f2('0x4e')](_0xc3f2('0x3e'))){_0x17ed0e['limit']=qs[_0xc3f2('0x12')](_0x3a7a66[_0xc3f2('0x29')][_0xc3f2('0x12')]);_0x17ed0e[_0xc3f2('0xf')]=qs[_0xc3f2('0xf')](_0x3a7a66[_0xc3f2('0x29')]['offset']);}return _0x5bbb23[_0xc3f2('0x75')](_0x17ed0e);}})[_0xc3f2('0x15')](function(_0x2c53e3){if(_0x2c53e3){return _0x2c53e3?{'count':_0x14d892,'rows':_0x2c53e3}:null;}})[_0xc3f2('0x15')](respondWithResult(_0x4dd608,null))[_0xc3f2('0x24')](handleError(_0x4dd608,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 4ff066c..7c5f71b 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 _0x0002=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners'];(function(_0x18d9d2,_0x5e0e1c){var _0x2d9739=function(_0x28201d){while(--_0x28201d){_0x18d9d2['push'](_0x18d9d2['shift']());}};_0x2d9739(++_0x5e0e1c);}(_0x0002,0x8e));var _0x2000=function(_0x5b214b,_0x4bd6d1){_0x5b214b=_0x5b214b-0x0;var _0xc8d63b=_0x0002[_0x5b214b];return _0xc8d63b;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x2000('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x2000('0x1')](0x0);var events={'afterCreate':_0x2000('0x2'),'afterUpdate':_0x2000('0x3'),'afterDestroy':_0x2000('0x4')};function emitEvent(_0x5ac7c3){return function(_0x46353c,_0x57a71f,_0x12ebe1){ChatQueueEvents[_0x2000('0x5')](_0x5ac7c3+':'+_0x46353c['id'],_0x46353c);ChatQueueEvents[_0x2000('0x5')](_0x5ac7c3,_0x46353c);_0x12ebe1(null);};}for(var e in events){if(events[_0x2000('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x2000('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xea8e=['setMaxListeners','remove','emit','hasOwnProperty','events','ChatQueue'];(function(_0x49258d,_0x5bcf0e){var _0x2a9044=function(_0x1a629e){while(--_0x1a629e){_0x49258d['push'](_0x49258d['shift']());}};_0x2a9044(++_0x5bcf0e);}(_0xea8e,0x1ba));var _0xeea8=function(_0x53755d,_0x4f705f){_0x53755d=_0x53755d-0x0;var _0x512b5b=_0xea8e[_0x53755d];return _0x512b5b;};'use strict';var EventEmitter=require(_0xeea8('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xeea8('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xeea8('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xeea8('0x3')};function emitEvent(_0x107a9e){return function(_0x1ea1ba,_0x9971c1,_0x3a16de){ChatQueueEvents[_0xeea8('0x4')](_0x107a9e+':'+_0x1ea1ba['id'],_0x1ea1ba);ChatQueueEvents[_0xeea8('0x4')](_0x107a9e,_0x1ea1ba);_0x3a16de(null);};}for(var e in events){if(events[_0xeea8('0x5')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 5a4f9a4..1205be0 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 _0xd1dc=['util','api','moment','request-promise','./chatQueue.attributes','define','ChatQueue','lodash'];(function(_0x41e8da,_0x23b529){var _0x26260e=function(_0x52f2b9){while(--_0x52f2b9){_0x41e8da['push'](_0x41e8da['shift']());}};_0x26260e(++_0x23b529);}(_0xd1dc,0x147));var _0xcd1d=function(_0xd25b59,_0x217f8a){_0xd25b59=_0xd25b59-0x0;var _0x4cab47=_0xd1dc[_0xd25b59];return _0x4cab47;};'use strict';var _=require(_0xcd1d('0x0'));var util=require(_0xcd1d('0x1'));var logger=require('../../config/logger')(_0xcd1d('0x2'));var moment=require(_0xcd1d('0x3'));var BPromise=require('bluebird');var rp=require(_0xcd1d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcd1d('0x5'));module['exports']=function(_0x5bc728,_0x390319){return _0x5bc728[_0xcd1d('0x6')](_0xcd1d('0x7'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30c2=['../../config/environment','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1d0764,_0x2beb7c){var _0x423f49=function(_0x5334ee){while(--_0x5334ee){_0x1d0764['push'](_0x1d0764['shift']());}};_0x423f49(++_0x2beb7c);}(_0x30c2,0x89));var _0x230c=function(_0x51d2c5,_0x13ea90){_0x51d2c5=_0x51d2c5-0x0;var _0x47caff=_0x30c2[_0x51d2c5];return _0x47caff;};'use strict';var _=require(_0x230c('0x0'));var util=require(_0x230c('0x1'));var logger=require(_0x230c('0x2'))('api');var moment=require(_0x230c('0x3'));var BPromise=require(_0x230c('0x4'));var rp=require(_0x230c('0x5'));var fs=require('fs');var path=require(_0x230c('0x6'));var rimraf=require('rimraf');var config=require(_0x230c('0x7'));var attributes=require('./chatQueue.attributes');module[_0x230c('0x8')]=function(_0x1839f7,_0xbd75b5){return _0x1839f7[_0x230c('0x9')](_0x230c('0xa'),attributes,{'tableName':_0x230c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 2160b01..bce09ff 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 _0x8f71=['redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','result','findAll','options','raw','where','attributes','limit','include','model','map','GetChatQueue','catch','ShowChatQueue','ChatQueue','stringify','util','moment','randomstring','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x8f71,0x1e6));var _0x18f7=function(_0x16db8d,_0x3b7798){_0x16db8d=_0x16db8d-0x0;var _0x43aa6c=_0x8f71[_0x16db8d];return _0x43aa6c;};'use strict';var _=require('lodash');var util=require(_0x18f7('0x0'));var moment=require(_0x18f7('0x1'));var BPromise=require('bluebird');var rs=require(_0x18f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18f7('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x18f7('0x4'));var config=require('../../config/environment');var jayson=require(_0x18f7('0x5'));var client=jayson[_0x18f7('0x6')][_0x18f7('0x7')]({'port':0x232a});config[_0x18f7('0x8')]=_[_0x18f7('0x9')](config[_0x18f7('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x18f7('0xa'))(new Redis(config[_0x18f7('0x8')]));require(_0x18f7('0xb'))[_0x18f7('0xc')](socket);function respondWithRpcPromise(_0x565c32,_0x3e765c,_0x3c4464){return new BPromise(function(_0x4dab47,_0x40c7b8){return client[_0x18f7('0xd')](_0x565c32,_0x3c4464)[_0x18f7('0xe')](function(_0x6d486d){logger[_0x18f7('0xf')]('ChatQueue,\x20%s,\x20%s',_0x3e765c,_0x18f7('0x10'));logger[_0x18f7('0x11')](_0x18f7('0x12'),_0x3e765c,_0x18f7('0x10'),JSON['stringify'](_0x6d486d));if(_0x6d486d[_0x18f7('0x13')]){if(_0x6d486d[_0x18f7('0x13')][_0x18f7('0x14')]===0x1f4){logger[_0x18f7('0x13')](_0x18f7('0x15'),_0x3e765c,_0x6d486d['error'][_0x18f7('0x16')]);return _0x40c7b8(_0x6d486d[_0x18f7('0x13')][_0x18f7('0x16')]);}logger[_0x18f7('0x13')](_0x18f7('0x15'),_0x3e765c,_0x6d486d[_0x18f7('0x13')][_0x18f7('0x16')]);return _0x4dab47(_0x6d486d[_0x18f7('0x13')][_0x18f7('0x16')]);}else{logger['info'](_0x18f7('0x15'),_0x3e765c,'request\x20sent');_0x4dab47(_0x6d486d[_0x18f7('0x17')][_0x18f7('0x16')]);}})['catch'](function(_0x22f584){logger['error']('ChatQueue,\x20%s,\x20%s',_0x3e765c,_0x22f584);_0x40c7b8(_0x22f584);});});}exports['GetChatQueue']=function(_0x1d7362){var _0x4aadaa=this;return new Promise(function(_0x4cebcc,_0x176c24){return db['ChatQueue'][_0x18f7('0x18')]({'raw':_0x1d7362[_0x18f7('0x19')]?_0x1d7362[_0x18f7('0x19')][_0x18f7('0x1a')]===undefined?!![]:![]:!![],'where':_0x1d7362[_0x18f7('0x19')]?_0x1d7362['options'][_0x18f7('0x1b')]||null:null,'attributes':_0x1d7362[_0x18f7('0x19')]?_0x1d7362['options'][_0x18f7('0x1c')]||null:null,'limit':_0x1d7362['options']?_0x1d7362[_0x18f7('0x19')][_0x18f7('0x1d')]||null:null,'include':_0x1d7362[_0x18f7('0x19')]?_0x1d7362[_0x18f7('0x19')][_0x18f7('0x1e')]?_['map'](_0x1d7362[_0x18f7('0x19')][_0x18f7('0x1e')],function(_0x2f5d67){return{'model':db[_0x2f5d67[_0x18f7('0x1f')]],'as':_0x2f5d67['as'],'attributes':_0x2f5d67[_0x18f7('0x1c')],'include':_0x2f5d67['include']?_[_0x18f7('0x20')](_0x2f5d67[_0x18f7('0x1e')],function(_0x167b7e){return{'model':db[_0x167b7e[_0x18f7('0x1f')]],'as':_0x167b7e['as'],'attributes':_0x167b7e[_0x18f7('0x1c')],'include':_0x167b7e[_0x18f7('0x1e')]?_['map'](_0x167b7e[_0x18f7('0x1e')],function(_0x132293){return{'model':db[_0x132293['model']],'as':_0x132293['as'],'attributes':_0x132293['attributes']};}):[]};}):[]};}):[]:[]})[_0x18f7('0xe')](function(_0x18e938){logger[_0x18f7('0xf')]('GetChatQueue',_0x1d7362);logger[_0x18f7('0x11')](_0x18f7('0x21'),_0x1d7362,JSON['stringify'](_0x18e938));_0x4cebcc(_0x18e938);})[_0x18f7('0x22')](function(_0x184079){logger[_0x18f7('0x13')](_0x18f7('0x21'),_0x184079[_0x18f7('0x16')],_0x1d7362);_0x176c24(_0x4aadaa['error'](0x1f4,_0x184079[_0x18f7('0x16')]));});});};exports[_0x18f7('0x23')]=function(_0x46662d){var _0x3d90c2=this;return new Promise(function(_0x2f6772,_0x5f0acf){return db[_0x18f7('0x24')]['find']({'raw':_0x46662d[_0x18f7('0x19')]?_0x46662d[_0x18f7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x46662d[_0x18f7('0x19')]?_0x46662d['options'][_0x18f7('0x1b')]||null:null,'attributes':_0x46662d['options']?_0x46662d['options'][_0x18f7('0x1c')]||null:null,'include':_0x46662d['options']?_0x46662d[_0x18f7('0x19')][_0x18f7('0x1e')]?_['map'](_0x46662d[_0x18f7('0x19')]['include'],function(_0x492202){return{'model':db[_0x492202[_0x18f7('0x1f')]],'as':_0x492202['as'],'attributes':_0x492202[_0x18f7('0x1c')],'include':_0x492202[_0x18f7('0x1e')]?_[_0x18f7('0x20')](_0x492202[_0x18f7('0x1e')],function(_0x153e2b){return{'model':db[_0x153e2b[_0x18f7('0x1f')]],'as':_0x153e2b['as'],'attributes':_0x153e2b['attributes'],'include':_0x153e2b[_0x18f7('0x1e')]?_[_0x18f7('0x20')](_0x153e2b['include'],function(_0x172590){return{'model':db[_0x172590[_0x18f7('0x1f')]],'as':_0x172590['as'],'attributes':_0x172590[_0x18f7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x18f7('0xe')](function(_0xf43895){logger[_0x18f7('0xf')](_0x18f7('0x23'),_0x46662d);logger[_0x18f7('0x11')](_0x18f7('0x23'),_0x46662d,JSON[_0x18f7('0x25')](_0xf43895));_0x2f6772(_0xf43895);})[_0x18f7('0x22')](function(_0x2bdafe){logger[_0x18f7('0x13')](_0x18f7('0x23'),_0x2bdafe[_0x18f7('0x16')],_0x46662d);_0x5f0acf(_0x3d90c2[_0x18f7('0x13')](0x1f4,_0x2bdafe['message']));});});}; \ No newline at end of file +var _0xa249=['attributes','limit','map','include','model','GetChatQueue','ShowChatQueue','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','ChatQueue','findAll','options','raw','where'];(function(_0x301e79,_0x266183){var _0x25d62d=function(_0x26dab6){while(--_0x26dab6){_0x301e79['push'](_0x301e79['shift']());}};_0x25d62d(++_0x266183);}(_0xa249,0x183));var _0x9a24=function(_0xf00cfd,_0x1f6b9c){_0xf00cfd=_0xf00cfd-0x0;var _0x439bc2=_0xa249[_0xf00cfd];return _0x439bc2;};'use strict';var _=require(_0x9a24('0x0'));var util=require(_0x9a24('0x1'));var moment=require('moment');var BPromise=require(_0x9a24('0x2'));var rs=require(_0x9a24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a24('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a24('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9a24('0x6')][_0x9a24('0x7')]({'port':0x232a});config[_0x9a24('0x8')]=_[_0x9a24('0x9')](config[_0x9a24('0x8')],{'host':_0x9a24('0xa'),'port':0x18eb});var socket=require(_0x9a24('0xb'))(new Redis(config[_0x9a24('0x8')]));require(_0x9a24('0xc'))[_0x9a24('0xd')](socket);function respondWithRpcPromise(_0x543676,_0x510b29,_0x1cd07a){return new BPromise(function(_0x1db2e0,_0x885cac){return client['request'](_0x543676,_0x1cd07a)[_0x9a24('0xe')](function(_0x4b7075){logger[_0x9a24('0xf')]('ChatQueue,\x20%s,\x20%s',_0x510b29,_0x9a24('0x10'));logger[_0x9a24('0x11')](_0x9a24('0x12'),_0x510b29,_0x9a24('0x10'),JSON[_0x9a24('0x13')](_0x4b7075));if(_0x4b7075['error']){if(_0x4b7075[_0x9a24('0x14')][_0x9a24('0x15')]===0x1f4){logger[_0x9a24('0x14')](_0x9a24('0x16'),_0x510b29,_0x4b7075[_0x9a24('0x14')]['message']);return _0x885cac(_0x4b7075['error'][_0x9a24('0x17')]);}logger[_0x9a24('0x14')](_0x9a24('0x16'),_0x510b29,_0x4b7075['error'][_0x9a24('0x17')]);return _0x1db2e0(_0x4b7075[_0x9a24('0x14')][_0x9a24('0x17')]);}else{logger[_0x9a24('0xf')](_0x9a24('0x16'),_0x510b29,_0x9a24('0x10'));_0x1db2e0(_0x4b7075[_0x9a24('0x18')][_0x9a24('0x17')]);}})[_0x9a24('0x19')](function(_0x2a38cf){logger[_0x9a24('0x14')](_0x9a24('0x16'),_0x510b29,_0x2a38cf);_0x885cac(_0x2a38cf);});});}exports['GetChatQueue']=function(_0x2f1a0c){var _0x562d7d=this;return new Promise(function(_0x5a000d,_0x4b775a){return db[_0x9a24('0x1a')][_0x9a24('0x1b')]({'raw':_0x2f1a0c['options']?_0x2f1a0c[_0x9a24('0x1c')][_0x9a24('0x1d')]===undefined?!![]:![]:!![],'where':_0x2f1a0c[_0x9a24('0x1c')]?_0x2f1a0c[_0x9a24('0x1c')][_0x9a24('0x1e')]||null:null,'attributes':_0x2f1a0c[_0x9a24('0x1c')]?_0x2f1a0c[_0x9a24('0x1c')][_0x9a24('0x1f')]||null:null,'limit':_0x2f1a0c[_0x9a24('0x1c')]?_0x2f1a0c['options'][_0x9a24('0x20')]||null:null,'include':_0x2f1a0c[_0x9a24('0x1c')]?_0x2f1a0c[_0x9a24('0x1c')]['include']?_[_0x9a24('0x21')](_0x2f1a0c['options'][_0x9a24('0x22')],function(_0x1f145d){return{'model':db[_0x1f145d[_0x9a24('0x23')]],'as':_0x1f145d['as'],'attributes':_0x1f145d['attributes'],'include':_0x1f145d[_0x9a24('0x22')]?_[_0x9a24('0x21')](_0x1f145d[_0x9a24('0x22')],function(_0x4c6d7f){return{'model':db[_0x4c6d7f[_0x9a24('0x23')]],'as':_0x4c6d7f['as'],'attributes':_0x4c6d7f['attributes'],'include':_0x4c6d7f[_0x9a24('0x22')]?_['map'](_0x4c6d7f[_0x9a24('0x22')],function(_0x2fa061){return{'model':db[_0x2fa061[_0x9a24('0x23')]],'as':_0x2fa061['as'],'attributes':_0x2fa061[_0x9a24('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9a24('0xe')](function(_0x57bd0c){logger['info'](_0x9a24('0x24'),_0x2f1a0c);logger[_0x9a24('0x11')](_0x9a24('0x24'),_0x2f1a0c,JSON[_0x9a24('0x13')](_0x57bd0c));_0x5a000d(_0x57bd0c);})[_0x9a24('0x19')](function(_0x34d053){logger[_0x9a24('0x14')](_0x9a24('0x24'),_0x34d053[_0x9a24('0x17')],_0x2f1a0c);_0x4b775a(_0x562d7d[_0x9a24('0x14')](0x1f4,_0x34d053[_0x9a24('0x17')]));});});};exports[_0x9a24('0x25')]=function(_0x596129){var _0x4427d1=this;return new Promise(function(_0x1a6dd8,_0x20d054){return db['ChatQueue']['find']({'raw':_0x596129[_0x9a24('0x1c')]?_0x596129[_0x9a24('0x1c')][_0x9a24('0x1d')]===undefined?!![]:![]:!![],'where':_0x596129[_0x9a24('0x1c')]?_0x596129[_0x9a24('0x1c')]['where']||null:null,'attributes':_0x596129[_0x9a24('0x1c')]?_0x596129[_0x9a24('0x1c')][_0x9a24('0x1f')]||null:null,'include':_0x596129[_0x9a24('0x1c')]?_0x596129[_0x9a24('0x1c')][_0x9a24('0x22')]?_[_0x9a24('0x21')](_0x596129[_0x9a24('0x1c')][_0x9a24('0x22')],function(_0x2d87fc){return{'model':db[_0x2d87fc[_0x9a24('0x23')]],'as':_0x2d87fc['as'],'attributes':_0x2d87fc[_0x9a24('0x1f')],'include':_0x2d87fc['include']?_[_0x9a24('0x21')](_0x2d87fc[_0x9a24('0x22')],function(_0x162754){return{'model':db[_0x162754[_0x9a24('0x23')]],'as':_0x162754['as'],'attributes':_0x162754[_0x9a24('0x1f')],'include':_0x162754[_0x9a24('0x22')]?_[_0x9a24('0x21')](_0x162754[_0x9a24('0x22')],function(_0x4a9720){return{'model':db[_0x4a9720[_0x9a24('0x23')]],'as':_0x4a9720['as'],'attributes':_0x4a9720[_0x9a24('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c20df){logger['info']('ShowChatQueue',_0x596129);logger['debug']('ShowChatQueue',_0x596129,JSON[_0x9a24('0x13')](_0x4c20df));_0x1a6dd8(_0x4c20df);})['catch'](function(_0x5265c8){logger[_0x9a24('0x14')]('ShowChatQueue',_0x5265c8[_0x9a24('0x17')],_0x596129);_0x20d054(_0x4427d1[_0x9a24('0x14')](0x1f4,_0x5265c8[_0x9a24('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index f3af22d..ea9c8df 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 _0x6aa7=['update','emit','length','chatQueue:','./chatQueue.events','remove'];(function(_0x5a3b09,_0x24a4a3){var _0x46298a=function(_0x20e887){while(--_0x20e887){_0x5a3b09['push'](_0x5a3b09['shift']());}};_0x46298a(++_0x24a4a3);}(_0x6aa7,0x178));var _0x76aa=function(_0x516c35,_0x229264){_0x516c35=_0x516c35-0x0;var _0x4feef9=_0x6aa7[_0x516c35];return _0x4feef9;};'use strict';var ChatQueueEvents=require(_0x76aa('0x0'));var events=['save',_0x76aa('0x1'),_0x76aa('0x2')];function createListener(_0x25c818,_0x2db4fe){return function(_0x4f007e){_0x2db4fe[_0x76aa('0x3')](_0x25c818,_0x4f007e);};}function removeListener(_0xef15ef,_0x1d6e04){return function(){ChatQueueEvents['removeListener'](_0xef15ef,_0x1d6e04);};}exports['register']=function(_0x1aceaa){for(var _0x4d53f6=0x0,_0x32dee5=events[_0x76aa('0x4')];_0x4d53f6<_0x32dee5;_0x4d53f6++){var _0xa9b695=events[_0x4d53f6];var _0x56d6bc=createListener(_0x76aa('0x5')+_0xa9b695,_0x1aceaa);ChatQueueEvents['on'](_0xa9b695,_0x56d6bc);}}; \ No newline at end of file +var _0x4ea3=['removeListener','register','length','chatQueue:','./chatQueue.events','save','remove','update','emit'];(function(_0x39cbc1,_0x3b0597){var _0x40869c=function(_0x52473e){while(--_0x52473e){_0x39cbc1['push'](_0x39cbc1['shift']());}};_0x40869c(++_0x3b0597);}(_0x4ea3,0x70));var _0x34ea=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4ea3[_0x501510];return _0x1e6ee5;};'use strict';var ChatQueueEvents=require(_0x34ea('0x0'));var events=[_0x34ea('0x1'),_0x34ea('0x2'),_0x34ea('0x3')];function createListener(_0x588172,_0x374ec1){return function(_0x494b56){_0x374ec1[_0x34ea('0x4')](_0x588172,_0x494b56);};}function removeListener(_0x571f1b,_0x5e5a84){return function(){ChatQueueEvents[_0x34ea('0x5')](_0x571f1b,_0x5e5a84);};}exports[_0x34ea('0x6')]=function(_0x962596){for(var _0x123d48=0x0,_0x40434e=events[_0x34ea('0x7')];_0x123d48<_0x40434e;_0x123d48++){var _0x22b09e=events[_0x123d48];var _0x5bec7c=createListener(_0x34ea('0x8')+_0x22b09e,_0x962596);ChatQueueEvents['on'](_0x22b09e,_0x5bec7c);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index c2e3789..e33c281 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 _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(_0x366aef,_0x361e9e){var _0x2549c1=function(_0x4a4d06){while(--_0x4a4d06){_0x366aef['push'](_0x366aef['shift']());}};_0x2549c1(++_0x361e9e);}(_0x7217,0x19e));var _0x7721=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7217[_0x5b561d];return _0x431060;};'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 +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(_0x318b17,_0x3566d6){var _0x95b9f1=function(_0x4f886b){while(--_0x4f886b){_0x318b17['push'](_0x318b17['shift']());}};_0x95b9f1(++_0x3566d6);}(_0x55ca,0x126));var _0xa55c=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0x55ca[_0x587693];return _0x510a1a;};'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 diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index b5b83e2..3497b10 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 _0x8f35=['sequelize','STRING','DATE','moment'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x8f35,0x107));var _0x58f3=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x8f35[_0x231e16];return _0x570a7c;};'use strict';var moment=require(_0x58f3('0x0'));var Sequelize=require(_0x58f3('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x58f3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x58f3('0x2')]},'joinAt':{'type':Sequelize[_0x58f3('0x3')]},'leaveAt':{'type':Sequelize[_0x58f3('0x3')]},'acceptAt':{'type':Sequelize[_0x58f3('0x3')]},'exitAt':{'type':Sequelize[_0x58f3('0x3')]},'reason':{'type':Sequelize[_0x58f3('0x2')]}}; \ No newline at end of file +var _0x179f=['moment','exports','STRING','DATE'];(function(_0x203eae,_0xa7dee1){var _0x1e72a8=function(_0x3b0e1a){while(--_0x3b0e1a){_0x203eae['push'](_0x203eae['shift']());}};_0x1e72a8(++_0xa7dee1);}(_0x179f,0x1e8));var _0xf179=function(_0x5403ec,_0x372801){_0x5403ec=_0x5403ec-0x0;var _0x413815=_0x179f[_0x5403ec];return _0x413815;};'use strict';var moment=require(_0xf179('0x0'));var Sequelize=require('sequelize');module[_0xf179('0x1')]={'uniqueid':{'type':Sequelize[_0xf179('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf179('0x2')]},'joinAt':{'type':Sequelize[_0xf179('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xf179('0x3')]},'exitAt':{'type':Sequelize[_0xf179('0x3')]},'reason':{'type':Sequelize[_0xf179('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index b725590..1bf0bc9 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 _0x627e=['limit','count','set','reject','save','then','destroy','error','stack','name','index','ChatQueueReport','fieldName','key','map','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','rows','catch','params','fields','length','includeAll','include','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x4e5771,_0x42d424){var _0x281a54=function(_0x231c62){while(--_0x231c62){_0x4e5771['push'](_0x4e5771['shift']());}};_0x281a54(++_0x42d424);}(_0x627e,0x14a));var _0xe627=function(_0x122980,_0x133e47){_0x122980=_0x122980-0x0;var _0x2f78cb=_0x627e[_0x122980];return _0x2f78cb;};'use strict';var emlformat=require(_0xe627('0x0'));var rimraf=require(_0xe627('0x1'));var zipdir=require(_0xe627('0x2'));var jsonpatch=require(_0xe627('0x3'));var rp=require(_0xe627('0x4'));var moment=require('moment');var BPromise=require(_0xe627('0x5'));var Mustache=require(_0xe627('0x6'));var util=require(_0xe627('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe627('0x8'));var fs=require('fs');var fs_extra=require(_0xe627('0x9'));var _=require(_0xe627('0xa'));var squel=require(_0xe627('0xb'));var crypto=require(_0xe627('0xc'));var jsforce=require(_0xe627('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe627('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe627('0xf'));var authService=require(_0xe627('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe627('0x11'));var logger=require(_0xe627('0x12'))(_0xe627('0x13'));var utils=require(_0xe627('0x14'));var config=require(_0xe627('0x15'));var licenseUtil=require(_0xe627('0x16'));var db=require(_0xe627('0x17'))['db'];function respondWithStatusCode(_0x3919be,_0x1922f5){_0x1922f5=_0x1922f5||0xcc;return function(_0x582190){if(_0x582190){return _0x3919be[_0xe627('0x18')](_0x1922f5);}return _0x3919be[_0xe627('0x19')](_0x1922f5)[_0xe627('0x1a')]();};}function respondWithResult(_0x4be370,_0x42dd1c){_0x42dd1c=_0x42dd1c||0xc8;return function(_0x1e2e62){if(_0x1e2e62){return _0x4be370[_0xe627('0x19')](_0x42dd1c)[_0xe627('0x1b')](_0x1e2e62);}};}function respondWithFilteredResult(_0x62896f,_0x6a9a15){return function(_0x271325){if(_0x271325){var _0x54720a=typeof _0x6a9a15[_0xe627('0x1c')]===_0xe627('0x1d')&&typeof _0x6a9a15[_0xe627('0x1e')]===_0xe627('0x1d');var _0x403982=_0x271325[_0xe627('0x1f')];var _0x56559b=_0x54720a?0x0:_0x6a9a15[_0xe627('0x1c')];var _0x538b22=_0x54720a?_0x271325[_0xe627('0x1f')]:_0x6a9a15['offset']+_0x6a9a15[_0xe627('0x1e')];var _0x565213;if(_0x538b22>=_0x403982){_0x538b22=_0x403982;_0x565213=0xc8;}else{_0x565213=0xce;}_0x62896f['status'](_0x565213);return _0x62896f[_0xe627('0x20')]('Content-Range',_0x56559b+'-'+_0x538b22+'/'+_0x403982)[_0xe627('0x1b')](_0x271325);}return null;};}function patchUpdates(_0x3391ce){return function(_0x4adde7){try{jsonpatch['apply'](_0x4adde7,_0x3391ce,!![]);}catch(_0x4ecfa6){return BPromise[_0xe627('0x21')](_0x4ecfa6);}return _0x4adde7[_0xe627('0x22')]();};}function saveUpdates(_0x4e3338,_0x708a8a){return function(_0x33cb27){if(_0x33cb27){return _0x33cb27['update'](_0x4e3338)[_0xe627('0x23')](function(_0x29221b){return _0x29221b;});}return null;};}function removeEntity(_0x52d492,_0x42f3d1){return function(_0x19adbc){if(_0x19adbc){return _0x19adbc[_0xe627('0x24')]()['then'](function(){_0x52d492[_0xe627('0x19')](0xcc)[_0xe627('0x1a')]();});}};}function handleEntityNotFound(_0x1a5081,_0x3ddd8d){return function(_0x4b9ff9){if(!_0x4b9ff9){_0x1a5081[_0xe627('0x18')](0x194);}return _0x4b9ff9;};}function handleError(_0x1fe192,_0x1635a0){_0x1635a0=_0x1635a0||0x1f4;return function(_0x29eb8e){logger[_0xe627('0x25')](_0x29eb8e[_0xe627('0x26')]);if(_0x29eb8e[_0xe627('0x27')]){delete _0x29eb8e[_0xe627('0x27')];}_0x1fe192[_0xe627('0x19')](_0x1635a0)['send'](_0x29eb8e);};}exports[_0xe627('0x28')]=function(_0x5aeba1,_0x5cd7c8){var _0x1e0bd7={},_0xdf63c8={},_0x5799a3={'count':0x0,'rows':[]};var _0x39c23f=_['map'](db[_0xe627('0x29')]['rawAttributes'],function(_0x262253){return{'name':_0x262253[_0xe627('0x2a')],'type':_0x262253['type'][_0xe627('0x2b')]};});_0xdf63c8['model']=_[_0xe627('0x2c')](_0x39c23f,_0xe627('0x27'));_0xdf63c8[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x5aeba1[_0xe627('0x2d')]);_0xdf63c8[_0xe627('0x2f')]=_[_0xe627('0x30')](_0xdf63c8[_0xe627('0x31')],_0xdf63c8[_0xe627('0x2d')]);_0x1e0bd7[_0xe627('0x32')]=_[_0xe627('0x30')](_0xdf63c8['model'],qs['fields'](_0x5aeba1[_0xe627('0x2d')]['fields']));_0x1e0bd7[_0xe627('0x32')]=_0x1e0bd7['attributes']['length']?_0x1e0bd7[_0xe627('0x32')]:_0xdf63c8['model'];if(!_0x5aeba1['query'][_0xe627('0x33')](_0xe627('0x34'))){_0x1e0bd7[_0xe627('0x1e')]=qs['limit'](_0x5aeba1['query']['limit']);_0x1e0bd7[_0xe627('0x1c')]=qs['offset'](_0x5aeba1[_0xe627('0x2d')][_0xe627('0x1c')]);}_0x1e0bd7['order']=qs[_0xe627('0x35')](_0x5aeba1[_0xe627('0x2d')]['sort']);_0x1e0bd7[_0xe627('0x36')]=qs[_0xe627('0x2f')](_[_0xe627('0x37')](_0x5aeba1[_0xe627('0x2d')],_0xdf63c8[_0xe627('0x2f')]),_0x39c23f);if(_0x5aeba1[_0xe627('0x2d')]['filter']){_0x1e0bd7[_0xe627('0x36')]=_['merge'](_0x1e0bd7[_0xe627('0x36')],{'$or':_['map'](_0x39c23f,function(_0xe90eda){if(_0xe90eda[_0xe627('0x38')]!==_0xe627('0x39')){var _0x21a533={};_0x21a533[_0xe90eda[_0xe627('0x27')]]={'$like':'%'+_0x5aeba1[_0xe627('0x2d')][_0xe627('0x3a')]+'%'};return _0x21a533;}})});}_0x1e0bd7=_[_0xe627('0x3b')]({},_0x1e0bd7,_0x5aeba1[_0xe627('0x3c')]);var _0x415a25={'where':_0x1e0bd7[_0xe627('0x36')]};return db[_0xe627('0x29')][_0xe627('0x1f')](_0x415a25)['then'](function(_0x4ddff5){_0x5799a3['count']=_0x4ddff5;if(_0x5aeba1['query']['includeAll']){_0x1e0bd7['include']=[{'all':!![]}];}return db[_0xe627('0x29')]['findAll'](_0x1e0bd7);})[_0xe627('0x23')](function(_0x59cd6a){_0x5799a3[_0xe627('0x3d')]=_0x59cd6a;return _0x5799a3;})[_0xe627('0x23')](respondWithFilteredResult(_0x5cd7c8,_0x1e0bd7))[_0xe627('0x3e')](handleError(_0x5cd7c8,null));};exports['show']=function(_0x58e110,_0x26064c){var _0x5f3374={'raw':!![],'where':{'id':_0x58e110[_0xe627('0x3f')]['id']}},_0x5e352e={};_0x5e352e['model']=_[_0xe627('0x2e')](db['ChatQueueReport']['rawAttributes']);_0x5e352e[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x58e110[_0xe627('0x2d')]);_0x5e352e['filters']=_['intersection'](_0x5e352e[_0xe627('0x31')],_0x5e352e['query']);_0x5f3374['attributes']=_[_0xe627('0x30')](_0x5e352e[_0xe627('0x31')],qs[_0xe627('0x40')](_0x58e110[_0xe627('0x2d')][_0xe627('0x40')]));_0x5f3374[_0xe627('0x32')]=_0x5f3374['attributes'][_0xe627('0x41')]?_0x5f3374[_0xe627('0x32')]:_0x5e352e['model'];if(_0x58e110['query'][_0xe627('0x42')]){_0x5f3374[_0xe627('0x43')]=[{'all':!![]}];}_0x5f3374=_[_0xe627('0x3b')]({},_0x5f3374,_0x58e110[_0xe627('0x3c')]);return db[_0xe627('0x29')][_0xe627('0x44')](_0x5f3374)[_0xe627('0x23')](handleEntityNotFound(_0x26064c,null))['then'](respondWithResult(_0x26064c,null))[_0xe627('0x3e')](handleError(_0x26064c,null));};exports['create']=function(_0x648456,_0xcd19f5){return db[_0xe627('0x29')]['create'](_0x648456[_0xe627('0x45')],{})['then'](respondWithResult(_0xcd19f5,0xc9))[_0xe627('0x3e')](handleError(_0xcd19f5,null));};exports[_0xe627('0x46')]=function(_0x375e05,_0x30e057){if(_0x375e05[_0xe627('0x45')]['id']){delete _0x375e05['body']['id'];}return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x375e05[_0xe627('0x3f')]['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x30e057,null))[_0xe627('0x23')](saveUpdates(_0x375e05[_0xe627('0x45')],null))[_0xe627('0x23')](respondWithResult(_0x30e057,null))[_0xe627('0x3e')](handleError(_0x30e057,null));};exports[_0xe627('0x24')]=function(_0x3824da,_0x550b74){return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x3824da['params']['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x550b74,null))[_0xe627('0x23')](removeEntity(_0x550b74,null))['catch'](handleError(_0x550b74,null));};exports[_0xe627('0x47')]=function(_0x3a827e,_0x542a4c){return db[_0xe627('0x29')][_0xe627('0x47')]()['then'](respondWithResult(_0x542a4c,null))[_0xe627('0x3e')](handleError(_0x542a4c,null));}; \ No newline at end of file +var _0xafc4=['update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','ChatQueueReport','includeAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0xafc4,0x69));var _0x4afc=function(_0x43a083,_0x280661){_0x43a083=_0x43a083-0x0;var _0x131827=_0xafc4[_0x43a083];return _0x131827;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['ChatQueueReport'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':!![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['ChatQueueReport']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));};exports[_0x4afc('0x45')]=function(_0x3625c9,_0x387834){return db[_0x4afc('0x3d')][_0x4afc('0x45')]()[_0x4afc('0x25')](respondWithResult(_0x387834,null))[_0x4afc('0x3f')](handleError(_0x387834,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index b14c683..5b76dcf 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x216b79,_0x3a8fc0){var _0xd42888=function(_0x39426d){while(--_0x39426d){_0x216b79['push'](_0x216b79['shift']());}};_0xd42888(++_0x3a8fc0);}(_0x757a,0xde));var _0xa757=function(_0x5bacec,_0x3e3ebc){_0x5bacec=_0x5bacec-0x0;var _0x31bcb5=_0x757a[_0x5bacec];return _0x31bcb5;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 55b7f83..a235996 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 _0xc5a8=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateChatQueueReport','body','options','raw','stringify','UpdateChatQueueReport','ChatQueueReport','update','where','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x40646e,_0x2b7664){var _0x5911a0=function(_0xea0d93){while(--_0xea0d93){_0x40646e['push'](_0x40646e['shift']());}};_0x5911a0(++_0x2b7664);}(_0xc5a8,0x11a));var _0x8c5a=function(_0x5efffe,_0x195199){_0x5efffe=_0x5efffe-0x0;var _0x409f8e=_0xc5a8[_0x5efffe];return _0x409f8e;};'use strict';var _=require(_0x8c5a('0x0'));var util=require(_0x8c5a('0x1'));var moment=require(_0x8c5a('0x2'));var BPromise=require(_0x8c5a('0x3'));var rs=require(_0x8c5a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8c5a('0x5'));var logger=require(_0x8c5a('0x6'))(_0x8c5a('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c5a('0x8'));var client=jayson[_0x8c5a('0x9')][_0x8c5a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b0cca,_0x20353b,_0x549bc3){return new BPromise(function(_0x2ade80,_0x1a74d2){return client[_0x8c5a('0xb')](_0x3b0cca,_0x549bc3)[_0x8c5a('0xc')](function(_0x1f3b08){logger[_0x8c5a('0xd')](_0x8c5a('0xe'),_0x20353b,'request\x20sent');logger[_0x8c5a('0xf')](_0x8c5a('0x10'),_0x20353b,_0x8c5a('0x11'),JSON['stringify'](_0x1f3b08));if(_0x1f3b08[_0x8c5a('0x12')]){if(_0x1f3b08[_0x8c5a('0x12')][_0x8c5a('0x13')]===0x1f4){logger[_0x8c5a('0x12')](_0x8c5a('0xe'),_0x20353b,_0x1f3b08['error'][_0x8c5a('0x14')]);return _0x1a74d2(_0x1f3b08[_0x8c5a('0x12')][_0x8c5a('0x14')]);}logger['error'](_0x8c5a('0xe'),_0x20353b,_0x1f3b08['error'][_0x8c5a('0x14')]);return _0x2ade80(_0x1f3b08['error'][_0x8c5a('0x14')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x20353b,_0x8c5a('0x11'));_0x2ade80(_0x1f3b08[_0x8c5a('0x15')]['message']);}})[_0x8c5a('0x16')](function(_0x4abc97){logger[_0x8c5a('0x12')](_0x8c5a('0xe'),_0x20353b,_0x4abc97);_0x1a74d2(_0x4abc97);});});}exports[_0x8c5a('0x17')]=function(_0x50442d){var _0x13c85d=this;return new Promise(function(_0x52ddc8,_0x5610f1){return db['ChatQueueReport']['create'](_0x50442d[_0x8c5a('0x18')],{'raw':_0x50442d[_0x8c5a('0x19')]?_0x50442d['options'][_0x8c5a('0x1a')]===undefined?!![]:![]:!![]})[_0x8c5a('0xc')](function(_0x4b64e8){logger['info'](_0x8c5a('0x17'),_0x50442d);logger[_0x8c5a('0xf')]('CreateChatQueueReport',_0x50442d,JSON[_0x8c5a('0x1b')](_0x4b64e8));_0x52ddc8(_0x4b64e8);})[_0x8c5a('0x16')](function(_0x36ca48){logger[_0x8c5a('0x12')](_0x8c5a('0x17'),_0x36ca48[_0x8c5a('0x14')],_0x50442d);_0x5610f1(_0x13c85d[_0x8c5a('0x12')](0x1f4,_0x36ca48[_0x8c5a('0x14')]));});});};exports[_0x8c5a('0x1c')]=function(_0x51b209){var _0x2d95b3=this;return new Promise(function(_0x5db9fa,_0x5e0489){return db[_0x8c5a('0x1d')][_0x8c5a('0x1e')](_0x51b209[_0x8c5a('0x18')],{'raw':_0x51b209[_0x8c5a('0x19')]?_0x51b209[_0x8c5a('0x19')][_0x8c5a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51b209[_0x8c5a('0x19')]?_0x51b209[_0x8c5a('0x19')][_0x8c5a('0x1f')]||null:null,'attributes':_0x51b209['options']?_0x51b209[_0x8c5a('0x19')]['attributes']||null:null,'limit':_0x51b209['options']?_0x51b209[_0x8c5a('0x19')]['limit']||null:null})['then'](function(_0x36b286){logger[_0x8c5a('0xd')](_0x8c5a('0x1c'),_0x51b209);logger[_0x8c5a('0xf')](_0x8c5a('0x1c'),_0x51b209,JSON[_0x8c5a('0x1b')](_0x36b286));_0x5db9fa(_0x36b286);})[_0x8c5a('0x16')](function(_0x2365f9){logger[_0x8c5a('0x12')](_0x8c5a('0x1c'),_0x2365f9['message'],_0x51b209);_0x5e0489(_0x2d95b3['error'](0x1f4,_0x2365f9[_0x8c5a('0x14')]));});});}; \ No newline at end of file +var _0x0852=['update','raw','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','catch','UpdateChatQueueReport'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0852,0xe5));var _0x2085=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x0852[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0x2085('0x0'));var util=require('util');var moment=require(_0x2085('0x1'));var BPromise=require(_0x2085('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2085('0x3'));var db=require(_0x2085('0x4'))['db'];var utils=require(_0x2085('0x5'));var logger=require(_0x2085('0x6'))(_0x2085('0x7'));var config=require('../../config/environment');var jayson=require(_0x2085('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x147b61,_0x38d07d,_0x4b0ccb){return new BPromise(function(_0x26b82c,_0x206694){return client[_0x2085('0x9')](_0x147b61,_0x4b0ccb)[_0x2085('0xa')](function(_0x210a70){logger[_0x2085('0xb')](_0x2085('0xc'),_0x38d07d,_0x2085('0xd'));logger[_0x2085('0xe')](_0x2085('0xf'),_0x38d07d,_0x2085('0xd'),JSON[_0x2085('0x10')](_0x210a70));if(_0x210a70['error']){if(_0x210a70[_0x2085('0x11')]['code']===0x1f4){logger[_0x2085('0x11')](_0x2085('0xc'),_0x38d07d,_0x210a70[_0x2085('0x11')][_0x2085('0x12')]);return _0x206694(_0x210a70[_0x2085('0x11')][_0x2085('0x12')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x38d07d,_0x210a70[_0x2085('0x11')][_0x2085('0x12')]);return _0x26b82c(_0x210a70['error'][_0x2085('0x12')]);}else{logger[_0x2085('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0x38d07d,_0x2085('0xd'));_0x26b82c(_0x210a70[_0x2085('0x13')][_0x2085('0x12')]);}})['catch'](function(_0x581e3e){logger[_0x2085('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x38d07d,_0x581e3e);_0x206694(_0x581e3e);});});}exports[_0x2085('0x14')]=function(_0x52fd81){var _0x14967f=this;return new Promise(function(_0x20e2ac,_0x10fa3c){return db[_0x2085('0x15')][_0x2085('0x16')](_0x52fd81[_0x2085('0x17')],{'raw':_0x52fd81[_0x2085('0x18')]?_0x52fd81['options']['raw']===undefined?!![]:![]:!![]})[_0x2085('0xa')](function(_0x5aa7d0){logger['info'](_0x2085('0x14'),_0x52fd81);logger['debug'](_0x2085('0x14'),_0x52fd81,JSON['stringify'](_0x5aa7d0));_0x20e2ac(_0x5aa7d0);})[_0x2085('0x19')](function(_0x38cac9){logger['error'](_0x2085('0x14'),_0x38cac9[_0x2085('0x12')],_0x52fd81);_0x10fa3c(_0x14967f[_0x2085('0x11')](0x1f4,_0x38cac9[_0x2085('0x12')]));});});};exports[_0x2085('0x1a')]=function(_0x11fb07){var _0x40afb5=this;return new Promise(function(_0x530679,_0x4343ee){return db[_0x2085('0x15')][_0x2085('0x1b')](_0x11fb07['body'],{'raw':_0x11fb07['options']?_0x11fb07[_0x2085('0x18')][_0x2085('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11fb07[_0x2085('0x18')]?_0x11fb07[_0x2085('0x18')][_0x2085('0x1d')]||null:null,'attributes':_0x11fb07['options']?_0x11fb07['options'][_0x2085('0x1e')]||null:null,'limit':_0x11fb07['options']?_0x11fb07[_0x2085('0x18')][_0x2085('0x1f')]||null:null})[_0x2085('0xa')](function(_0x1befe8){logger[_0x2085('0xb')]('UpdateChatQueueReport',_0x11fb07);logger[_0x2085('0xe')](_0x2085('0x1a'),_0x11fb07,JSON[_0x2085('0x10')](_0x1befe8));_0x530679(_0x1befe8);})['catch'](function(_0x21150e){logger[_0x2085('0x11')](_0x2085('0x1a'),_0x21150e[_0x2085('0x12')],_0x11fb07);_0x4343ee(_0x40afb5[_0x2085('0x11')](0x1f4,_0x21150e[_0x2085('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 9a5731c..670dc25 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 _0x72b2=['get','isAuthenticated','describe','/:id','show','create','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0x58c576,_0x3df9c6){var _0x2677c3=function(_0x9a8fca){while(--_0x9a8fca){_0x58c576['push'](_0x58c576['shift']());}};_0x2677c3(++_0x3df9c6);}(_0x72b2,0x19d));var _0x272b=function(_0x13d34c,_0x294fed){_0x13d34c=_0x13d34c-0x0;var _0x1e13aa=_0x72b2[_0x13d34c];return _0x1e13aa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x272b('0x0'));var timeout=require(_0x272b('0x1'));var express=require('express');var router=express[_0x272b('0x2')]();var fs_extra=require(_0x272b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x272b('0x4'));var config=require(_0x272b('0x5'));var controller=require(_0x272b('0x6'));router[_0x272b('0x7')]('/',auth[_0x272b('0x8')](),controller['index']);router[_0x272b('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x272b('0x9')]);router[_0x272b('0x7')](_0x272b('0xa'),auth['isAuthenticated'](),controller[_0x272b('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x272b('0xc')]);router['put'](_0x272b('0xa'),auth[_0x272b('0x8')](),controller['update']);router[_0x272b('0xd')](_0x272b('0xa'),auth[_0x272b('0x8')](),controller[_0x272b('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc0d9=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xc0d9,0x138));var _0x9c0d=function(_0x4ffeb7,_0x3cfd54){_0x4ffeb7=_0x4ffeb7-0x0;var _0x2bfca3=_0xc0d9[_0x4ffeb7];return _0x2bfca3;};'use strict';var multer=require(_0x9c0d('0x0'));var util=require(_0x9c0d('0x1'));var path=require(_0x9c0d('0x2'));var timeout=require(_0x9c0d('0x3'));var express=require(_0x9c0d('0x4'));var router=express[_0x9c0d('0x5')]();var fs_extra=require(_0x9c0d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9c0d('0x7'));var config=require('../../config/environment');var controller=require(_0x9c0d('0x8'));router[_0x9c0d('0x9')]('/',auth[_0x9c0d('0xa')](),controller[_0x9c0d('0xb')]);router[_0x9c0d('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9c0d('0xc')]);router[_0x9c0d('0x9')](_0x9c0d('0xd'),auth[_0x9c0d('0xa')](),controller[_0x9c0d('0xe')]);router[_0x9c0d('0xf')]('/',auth['isAuthenticated'](),controller[_0x9c0d('0x10')]);router[_0x9c0d('0x11')](_0x9c0d('0xd'),auth[_0x9c0d('0xa')](),controller[_0x9c0d('0x12')]);router[_0x9c0d('0x13')]('/:id',auth[_0x9c0d('0xa')](),controller[_0x9c0d('0x14')]);module[_0x9c0d('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index c091185..8fd7310 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1e01ca,_0x14dc80){var _0x318e7f=function(_0x1fe292){while(--_0x1fe292){_0x1e01ca['push'](_0x1e01ca['shift']());}};_0x318e7f(++_0x14dc80);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4be759,_0x4af334){_0x4be759=_0x4be759-0x0;var _0x261d88=_0x9bde[_0x4be759];return _0x261d88;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 5e692b0..a1f06ad 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 _0xb856=['Content-Range','apply','reject','save','then','end','error','stack','map','ChatTransferReport','rawAttributes','fieldName','key','model','name','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','filter','options','includeAll','include','rows','catch','show','params','intersection','find','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set'];(function(_0x16f8aa,_0x1f4309){var _0x56ceff=function(_0x200942){while(--_0x200942){_0x16f8aa['push'](_0x16f8aa['shift']());}};_0x56ceff(++_0x1f4309);}(_0xb856,0x198));var _0x6b85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb856[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6b85('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6b85('0x1'));var rp=require(_0x6b85('0x2'));var moment=require('moment');var BPromise=require(_0x6b85('0x3'));var Mustache=require(_0x6b85('0x4'));var util=require('util');var path=require(_0x6b85('0x5'));var sox=require(_0x6b85('0x6'));var csv=require('to-csv');var ejs=require(_0x6b85('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b85('0x8'));var squel=require(_0x6b85('0x9'));var crypto=require(_0x6b85('0xa'));var jsforce=require(_0x6b85('0xb'));var deskjs=require(_0x6b85('0xc'));var toCsv=require(_0x6b85('0xd'));var querystring=require(_0x6b85('0xe'));var Papa=require('papaparse');var Redis=require(_0x6b85('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6b85('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b85('0x11'));var logger=require(_0x6b85('0x12'))('api');var utils=require(_0x6b85('0x13'));var config=require(_0x6b85('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b85('0x15'))['db'];function respondWithStatusCode(_0x18d208,_0x1932eb){_0x1932eb=_0x1932eb||0xcc;return function(_0x252397){if(_0x252397){return _0x18d208[_0x6b85('0x16')](_0x1932eb);}return _0x18d208[_0x6b85('0x17')](_0x1932eb)['end']();};}function respondWithResult(_0x4cb88f,_0x509f41){_0x509f41=_0x509f41||0xc8;return function(_0x4a7255){if(_0x4a7255){return _0x4cb88f[_0x6b85('0x17')](_0x509f41)[_0x6b85('0x18')](_0x4a7255);}};}function respondWithFilteredResult(_0x1c36af,_0x3b1d25){return function(_0x5164a6){if(_0x5164a6){var _0x44f494=typeof _0x3b1d25['offset']===_0x6b85('0x19')&&typeof _0x3b1d25['limit']===_0x6b85('0x19');var _0x583f7e=_0x5164a6[_0x6b85('0x1a')];var _0x4f9838=_0x44f494?0x0:_0x3b1d25[_0x6b85('0x1b')];var _0x2cde03=_0x44f494?_0x5164a6[_0x6b85('0x1a')]:_0x3b1d25[_0x6b85('0x1b')]+_0x3b1d25[_0x6b85('0x1c')];var _0x4b31d6;if(_0x2cde03>=_0x583f7e){_0x2cde03=_0x583f7e;_0x4b31d6=0xc8;}else{_0x4b31d6=0xce;}_0x1c36af[_0x6b85('0x17')](_0x4b31d6);return _0x1c36af[_0x6b85('0x1d')](_0x6b85('0x1e'),_0x4f9838+'-'+_0x2cde03+'/'+_0x583f7e)[_0x6b85('0x18')](_0x5164a6);}return null;};}function patchUpdates(_0x3076ce){return function(_0x3e2d3c){try{jsonpatch[_0x6b85('0x1f')](_0x3e2d3c,_0x3076ce,!![]);}catch(_0x4a24e4){return BPromise[_0x6b85('0x20')](_0x4a24e4);}return _0x3e2d3c[_0x6b85('0x21')]();};}function saveUpdates(_0xf1f089,_0xe781c){return function(_0x14dfbf){if(_0x14dfbf){return _0x14dfbf['update'](_0xf1f089)[_0x6b85('0x22')](function(_0x16b625){return _0x16b625;});}return null;};}function removeEntity(_0x2bc354,_0x11ff3c){return function(_0x156da2){if(_0x156da2){return _0x156da2['destroy']()['then'](function(){_0x2bc354[_0x6b85('0x17')](0xcc)[_0x6b85('0x23')]();});}};}function handleEntityNotFound(_0x35e2aa,_0x16ba7b){return function(_0x59757a){if(!_0x59757a){_0x35e2aa['sendStatus'](0x194);}return _0x59757a;};}function handleError(_0x2d9c90,_0x1357bf){_0x1357bf=_0x1357bf||0x1f4;return function(_0x41070c){logger[_0x6b85('0x24')](_0x41070c[_0x6b85('0x25')]);if(_0x41070c['name']){delete _0x41070c['name'];}_0x2d9c90['status'](_0x1357bf)['send'](_0x41070c);};}exports['index']=function(_0x3340e5,_0x32f3d4){var _0x4a7edf={},_0x12158e={},_0x20c6ea={'count':0x0,'rows':[]};var _0x59330d=_[_0x6b85('0x26')](db[_0x6b85('0x27')][_0x6b85('0x28')],function(_0x4c5c4a){return{'name':_0x4c5c4a[_0x6b85('0x29')],'type':_0x4c5c4a['type'][_0x6b85('0x2a')]};});_0x12158e[_0x6b85('0x2b')]=_[_0x6b85('0x26')](_0x59330d,_0x6b85('0x2c'));_0x12158e[_0x6b85('0x2d')]=_[_0x6b85('0x2e')](_0x3340e5['query']);_0x12158e['filters']=_['intersection'](_0x12158e['model'],_0x12158e[_0x6b85('0x2d')]);_0x4a7edf[_0x6b85('0x2f')]=_['intersection'](_0x12158e[_0x6b85('0x2b')],qs['fields'](_0x3340e5[_0x6b85('0x2d')][_0x6b85('0x30')]));_0x4a7edf[_0x6b85('0x2f')]=_0x4a7edf['attributes'][_0x6b85('0x31')]?_0x4a7edf[_0x6b85('0x2f')]:_0x12158e['model'];if(!_0x3340e5[_0x6b85('0x2d')][_0x6b85('0x32')](_0x6b85('0x33'))){_0x4a7edf[_0x6b85('0x1c')]=qs[_0x6b85('0x1c')](_0x3340e5['query']['limit']);_0x4a7edf['offset']=qs[_0x6b85('0x1b')](_0x3340e5['query'][_0x6b85('0x1b')]);}_0x4a7edf[_0x6b85('0x34')]=qs[_0x6b85('0x35')](_0x3340e5[_0x6b85('0x2d')][_0x6b85('0x35')]);_0x4a7edf['where']=qs[_0x6b85('0x36')](_[_0x6b85('0x37')](_0x3340e5[_0x6b85('0x2d')],_0x12158e[_0x6b85('0x36')]),_0x59330d);if(_0x3340e5[_0x6b85('0x2d')]['filter']){_0x4a7edf[_0x6b85('0x38')]=_[_0x6b85('0x39')](_0x4a7edf['where'],{'$or':_[_0x6b85('0x26')](_0x59330d,function(_0x1bcd14){if(_0x1bcd14[_0x6b85('0x3a')]!=='VIRTUAL'){var _0x336ff7={};_0x336ff7[_0x1bcd14[_0x6b85('0x2c')]]={'$like':'%'+_0x3340e5[_0x6b85('0x2d')][_0x6b85('0x3b')]+'%'};return _0x336ff7;}})});}_0x4a7edf=_[_0x6b85('0x39')]({},_0x4a7edf,_0x3340e5[_0x6b85('0x3c')]);var _0x17a3db={'where':_0x4a7edf[_0x6b85('0x38')]};return db['ChatTransferReport'][_0x6b85('0x1a')](_0x17a3db)['then'](function(_0x39b9c8){_0x20c6ea[_0x6b85('0x1a')]=_0x39b9c8;if(_0x3340e5[_0x6b85('0x2d')][_0x6b85('0x3d')]){_0x4a7edf[_0x6b85('0x3e')]=[{'all':!![]}];}return db[_0x6b85('0x27')]['findAll'](_0x4a7edf);})[_0x6b85('0x22')](function(_0x4dc79d){_0x20c6ea[_0x6b85('0x3f')]=_0x4dc79d;return _0x20c6ea;})[_0x6b85('0x22')](respondWithFilteredResult(_0x32f3d4,_0x4a7edf))[_0x6b85('0x40')](handleError(_0x32f3d4,null));};exports[_0x6b85('0x41')]=function(_0x42d56a,_0x316450){var _0x37d1a6={'raw':!![],'where':{'id':_0x42d56a[_0x6b85('0x42')]['id']}},_0x3a3bd2={};_0x3a3bd2[_0x6b85('0x2b')]=_['keys'](db[_0x6b85('0x27')][_0x6b85('0x28')]);_0x3a3bd2[_0x6b85('0x2d')]=_[_0x6b85('0x2e')](_0x42d56a['query']);_0x3a3bd2[_0x6b85('0x36')]=_[_0x6b85('0x43')](_0x3a3bd2['model'],_0x3a3bd2[_0x6b85('0x2d')]);_0x37d1a6['attributes']=_[_0x6b85('0x43')](_0x3a3bd2['model'],qs['fields'](_0x42d56a['query'][_0x6b85('0x30')]));_0x37d1a6[_0x6b85('0x2f')]=_0x37d1a6[_0x6b85('0x2f')][_0x6b85('0x31')]?_0x37d1a6['attributes']:_0x3a3bd2[_0x6b85('0x2b')];if(_0x42d56a[_0x6b85('0x2d')][_0x6b85('0x3d')]){_0x37d1a6['include']=[{'all':!![]}];}_0x37d1a6=_['merge']({},_0x37d1a6,_0x42d56a[_0x6b85('0x3c')]);return db[_0x6b85('0x27')][_0x6b85('0x44')](_0x37d1a6)['then'](handleEntityNotFound(_0x316450,null))[_0x6b85('0x22')](respondWithResult(_0x316450,null))[_0x6b85('0x40')](handleError(_0x316450,null));};exports['create']=function(_0x350553,_0x5a234b){return db[_0x6b85('0x27')][_0x6b85('0x45')](_0x350553[_0x6b85('0x46')],{})[_0x6b85('0x22')](respondWithResult(_0x5a234b,0xc9))[_0x6b85('0x40')](handleError(_0x5a234b,null));};exports['update']=function(_0x2f6e2f,_0x562cdc){if(_0x2f6e2f[_0x6b85('0x46')]['id']){delete _0x2f6e2f['body']['id'];}return db[_0x6b85('0x27')][_0x6b85('0x44')]({'where':{'id':_0x2f6e2f[_0x6b85('0x42')]['id']}})[_0x6b85('0x22')](handleEntityNotFound(_0x562cdc,null))[_0x6b85('0x22')](saveUpdates(_0x2f6e2f[_0x6b85('0x46')],null))[_0x6b85('0x22')](respondWithResult(_0x562cdc,null))[_0x6b85('0x40')](handleError(_0x562cdc,null));};exports[_0x6b85('0x47')]=function(_0x593243,_0x48a538){return db[_0x6b85('0x27')][_0x6b85('0x44')]({'where':{'id':_0x593243[_0x6b85('0x42')]['id']}})[_0x6b85('0x22')](handleEntityNotFound(_0x48a538,null))[_0x6b85('0x22')](removeEntity(_0x48a538,null))[_0x6b85('0x40')](handleError(_0x48a538,null));};exports[_0x6b85('0x48')]=function(_0x2a790c,_0x539ec5){return db[_0x6b85('0x27')]['describe']()[_0x6b85('0x22')](respondWithResult(_0x539ec5,null))[_0x6b85('0x40')](handleError(_0x539ec5,null));}; \ No newline at end of file +var _0x5e65=['Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x2a1a6a,_0x39764b){var _0xdaa2c4=function(_0x2dc461){while(--_0x2dc461){_0x2a1a6a['push'](_0x2a1a6a['shift']());}};_0xdaa2c4(++_0x39764b);}(_0x5e65,0xcf));var _0x55e6=function(_0x417890,_0x5af979){_0x417890=_0x417890-0x0;var _0x183cfc=_0x5e65[_0x417890];return _0x183cfc;};'use strict';var emlformat=require(_0x55e6('0x0'));var rimraf=require(_0x55e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x55e6('0x2'));var rp=require(_0x55e6('0x3'));var moment=require(_0x55e6('0x4'));var BPromise=require(_0x55e6('0x5'));var Mustache=require(_0x55e6('0x6'));var util=require(_0x55e6('0x7'));var path=require(_0x55e6('0x8'));var sox=require(_0x55e6('0x9'));var csv=require('to-csv');var ejs=require(_0x55e6('0xa'));var fs=require('fs');var fs_extra=require(_0x55e6('0xb'));var _=require(_0x55e6('0xc'));var squel=require(_0x55e6('0xd'));var crypto=require(_0x55e6('0xe'));var jsforce=require(_0x55e6('0xf'));var deskjs=require(_0x55e6('0x10'));var toCsv=require(_0x55e6('0x11'));var querystring=require(_0x55e6('0x12'));var Papa=require(_0x55e6('0x13'));var Redis=require(_0x55e6('0x14'));var authService=require(_0x55e6('0x15'));var qs=require(_0x55e6('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x55e6('0x17'));var logger=require(_0x55e6('0x18'))('api');var utils=require(_0x55e6('0x19'));var config=require(_0x55e6('0x1a'));var licenseUtil=require(_0x55e6('0x1b'));var db=require(_0x55e6('0x1c'))['db'];function respondWithStatusCode(_0x289cea,_0x256916){_0x256916=_0x256916||0xcc;return function(_0x5c5cee){if(_0x5c5cee){return _0x289cea[_0x55e6('0x1d')](_0x256916);}return _0x289cea[_0x55e6('0x1e')](_0x256916)['end']();};}function respondWithResult(_0x5e3c7c,_0x543eb8){_0x543eb8=_0x543eb8||0xc8;return function(_0x436d73){if(_0x436d73){return _0x5e3c7c[_0x55e6('0x1e')](_0x543eb8)[_0x55e6('0x1f')](_0x436d73);}};}function respondWithFilteredResult(_0xf56c20,_0x243ffc){return function(_0x54857d){if(_0x54857d){var _0x250afa=typeof _0x243ffc[_0x55e6('0x20')]===_0x55e6('0x21')&&typeof _0x243ffc[_0x55e6('0x22')]===_0x55e6('0x21');var _0x445f20=_0x54857d[_0x55e6('0x23')];var _0x24f20b=_0x250afa?0x0:_0x243ffc['offset'];var _0x14db91=_0x250afa?_0x54857d['count']:_0x243ffc[_0x55e6('0x20')]+_0x243ffc[_0x55e6('0x22')];var _0x41f306;if(_0x14db91>=_0x445f20){_0x14db91=_0x445f20;_0x41f306=0xc8;}else{_0x41f306=0xce;}_0xf56c20[_0x55e6('0x1e')](_0x41f306);return _0xf56c20['set'](_0x55e6('0x24'),_0x24f20b+'-'+_0x14db91+'/'+_0x445f20)['json'](_0x54857d);}return null;};}function patchUpdates(_0x35966c){return function(_0x45af8e){try{jsonpatch[_0x55e6('0x25')](_0x45af8e,_0x35966c,!![]);}catch(_0x5a240b){return BPromise[_0x55e6('0x26')](_0x5a240b);}return _0x45af8e[_0x55e6('0x27')]();};}function saveUpdates(_0x494efe,_0xfd449d){return function(_0x4ffffb){if(_0x4ffffb){return _0x4ffffb[_0x55e6('0x28')](_0x494efe)[_0x55e6('0x29')](function(_0x11ef51){return _0x11ef51;});}return null;};}function removeEntity(_0x1de40a,_0x41666d){return function(_0x2ccf7d){if(_0x2ccf7d){return _0x2ccf7d[_0x55e6('0x2a')]()[_0x55e6('0x29')](function(){_0x1de40a[_0x55e6('0x1e')](0xcc)[_0x55e6('0x2b')]();});}};}function handleEntityNotFound(_0x1b36de,_0x3d1547){return function(_0x36972f){if(!_0x36972f){_0x1b36de[_0x55e6('0x1d')](0x194);}return _0x36972f;};}function handleError(_0x10ece2,_0x38c415){_0x38c415=_0x38c415||0x1f4;return function(_0x292e71){logger[_0x55e6('0x2c')](_0x292e71[_0x55e6('0x2d')]);if(_0x292e71[_0x55e6('0x2e')]){delete _0x292e71[_0x55e6('0x2e')];}_0x10ece2['status'](_0x38c415)[_0x55e6('0x2f')](_0x292e71);};}exports[_0x55e6('0x30')]=function(_0x2ef71c,_0x104c3d){var _0x1466ee={},_0x62b0f7={},_0x5a677b={'count':0x0,'rows':[]};var _0x4a1acb=_['map'](db[_0x55e6('0x31')][_0x55e6('0x32')],function(_0x246e74){return{'name':_0x246e74[_0x55e6('0x33')],'type':_0x246e74[_0x55e6('0x34')]['key']};});_0x62b0f7[_0x55e6('0x35')]=_[_0x55e6('0x36')](_0x4a1acb,_0x55e6('0x2e'));_0x62b0f7[_0x55e6('0x37')]=_[_0x55e6('0x38')](_0x2ef71c[_0x55e6('0x37')]);_0x62b0f7['filters']=_[_0x55e6('0x39')](_0x62b0f7[_0x55e6('0x35')],_0x62b0f7[_0x55e6('0x37')]);_0x1466ee[_0x55e6('0x3a')]=_[_0x55e6('0x39')](_0x62b0f7['model'],qs[_0x55e6('0x3b')](_0x2ef71c[_0x55e6('0x37')][_0x55e6('0x3b')]));_0x1466ee[_0x55e6('0x3a')]=_0x1466ee[_0x55e6('0x3a')][_0x55e6('0x3c')]?_0x1466ee[_0x55e6('0x3a')]:_0x62b0f7[_0x55e6('0x35')];if(!_0x2ef71c[_0x55e6('0x37')][_0x55e6('0x3d')](_0x55e6('0x3e'))){_0x1466ee[_0x55e6('0x22')]=qs[_0x55e6('0x22')](_0x2ef71c[_0x55e6('0x37')][_0x55e6('0x22')]);_0x1466ee[_0x55e6('0x20')]=qs[_0x55e6('0x20')](_0x2ef71c[_0x55e6('0x37')][_0x55e6('0x20')]);}_0x1466ee[_0x55e6('0x3f')]=qs['sort'](_0x2ef71c['query'][_0x55e6('0x40')]);_0x1466ee['where']=qs[_0x55e6('0x41')](_['pick'](_0x2ef71c[_0x55e6('0x37')],_0x62b0f7[_0x55e6('0x41')]),_0x4a1acb);if(_0x2ef71c[_0x55e6('0x37')][_0x55e6('0x42')]){_0x1466ee[_0x55e6('0x43')]=_['merge'](_0x1466ee[_0x55e6('0x43')],{'$or':_['map'](_0x4a1acb,function(_0x74f853){if(_0x74f853[_0x55e6('0x34')]!==_0x55e6('0x44')){var _0x138716={};_0x138716[_0x74f853[_0x55e6('0x2e')]]={'$like':'%'+_0x2ef71c[_0x55e6('0x37')]['filter']+'%'};return _0x138716;}})});}_0x1466ee=_[_0x55e6('0x45')]({},_0x1466ee,_0x2ef71c[_0x55e6('0x46')]);var _0x44d1c4={'where':_0x1466ee[_0x55e6('0x43')]};return db['ChatTransferReport']['count'](_0x44d1c4)[_0x55e6('0x29')](function(_0x37c086){_0x5a677b[_0x55e6('0x23')]=_0x37c086;if(_0x2ef71c[_0x55e6('0x37')][_0x55e6('0x47')]){_0x1466ee['include']=[{'all':!![]}];}return db[_0x55e6('0x31')][_0x55e6('0x48')](_0x1466ee);})[_0x55e6('0x29')](function(_0x11dce4){_0x5a677b['rows']=_0x11dce4;return _0x5a677b;})['then'](respondWithFilteredResult(_0x104c3d,_0x1466ee))[_0x55e6('0x49')](handleError(_0x104c3d,null));};exports[_0x55e6('0x4a')]=function(_0x92370f,_0x215688){var _0x315e2b={'raw':!![],'where':{'id':_0x92370f[_0x55e6('0x4b')]['id']}},_0x1fe0ee={};_0x1fe0ee[_0x55e6('0x35')]=_[_0x55e6('0x38')](db[_0x55e6('0x31')][_0x55e6('0x32')]);_0x1fe0ee[_0x55e6('0x37')]=_[_0x55e6('0x38')](_0x92370f[_0x55e6('0x37')]);_0x1fe0ee[_0x55e6('0x41')]=_[_0x55e6('0x39')](_0x1fe0ee[_0x55e6('0x35')],_0x1fe0ee[_0x55e6('0x37')]);_0x315e2b['attributes']=_[_0x55e6('0x39')](_0x1fe0ee[_0x55e6('0x35')],qs[_0x55e6('0x3b')](_0x92370f[_0x55e6('0x37')][_0x55e6('0x3b')]));_0x315e2b[_0x55e6('0x3a')]=_0x315e2b['attributes'][_0x55e6('0x3c')]?_0x315e2b[_0x55e6('0x3a')]:_0x1fe0ee[_0x55e6('0x35')];if(_0x92370f['query'][_0x55e6('0x47')]){_0x315e2b[_0x55e6('0x4c')]=[{'all':!![]}];}_0x315e2b=_[_0x55e6('0x45')]({},_0x315e2b,_0x92370f[_0x55e6('0x46')]);return db['ChatTransferReport'][_0x55e6('0x4d')](_0x315e2b)[_0x55e6('0x29')](handleEntityNotFound(_0x215688,null))[_0x55e6('0x29')](respondWithResult(_0x215688,null))[_0x55e6('0x49')](handleError(_0x215688,null));};exports[_0x55e6('0x4e')]=function(_0x3e2cdb,_0xd7eae1){return db[_0x55e6('0x31')][_0x55e6('0x4e')](_0x3e2cdb[_0x55e6('0x4f')],{})['then'](respondWithResult(_0xd7eae1,0xc9))[_0x55e6('0x49')](handleError(_0xd7eae1,null));};exports[_0x55e6('0x28')]=function(_0x43e697,_0x2b632c){if(_0x43e697[_0x55e6('0x4f')]['id']){delete _0x43e697['body']['id'];}return db[_0x55e6('0x31')][_0x55e6('0x4d')]({'where':{'id':_0x43e697[_0x55e6('0x4b')]['id']}})[_0x55e6('0x29')](handleEntityNotFound(_0x2b632c,null))[_0x55e6('0x29')](saveUpdates(_0x43e697['body'],null))[_0x55e6('0x29')](respondWithResult(_0x2b632c,null))[_0x55e6('0x49')](handleError(_0x2b632c,null));};exports[_0x55e6('0x2a')]=function(_0xaca06c,_0x337cb4){return db[_0x55e6('0x31')][_0x55e6('0x4d')]({'where':{'id':_0xaca06c[_0x55e6('0x4b')]['id']}})[_0x55e6('0x29')](handleEntityNotFound(_0x337cb4,null))[_0x55e6('0x29')](removeEntity(_0x337cb4,null))[_0x55e6('0x49')](handleError(_0x337cb4,null));};exports[_0x55e6('0x50')]=function(_0x401718,_0x1f1d4a){return db[_0x55e6('0x31')][_0x55e6('0x50')]()['then'](respondWithResult(_0x1f1d4a,null))['catch'](handleError(_0x1f1d4a,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 13d805c..be1bb5e 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 _0xba39=['util','../../config/logger','api','bluebird','request-promise','rimraf','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash'];(function(_0x140a86,_0x426df8){var _0x20c777=function(_0x46e9e5){while(--_0x46e9e5){_0x140a86['push'](_0x140a86['shift']());}};_0x20c777(++_0x426df8);}(_0xba39,0xbf));var _0x9ba3=function(_0x2805d2,_0x281ebb){_0x2805d2=_0x2805d2-0x0;var _0x16b104=_0xba39[_0x2805d2];return _0x16b104;};'use strict';var _=require(_0x9ba3('0x0'));var util=require(_0x9ba3('0x1'));var logger=require(_0x9ba3('0x2'))(_0x9ba3('0x3'));var moment=require('moment');var BPromise=require(_0x9ba3('0x4'));var rp=require(_0x9ba3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ba3('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ba3('0x7'));module[_0x9ba3('0x8')]=function(_0x386709,_0x4d77a5){return _0x386709[_0x9ba3('0x9')](_0x9ba3('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x9ba3('0xb'),'fields':[_0x9ba3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9730=['exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','bluebird','path','../../config/environment','./chatTransferReport.attributes'];(function(_0x419fd9,_0x44a2f9){var _0x44d049=function(_0x3fa251){while(--_0x3fa251){_0x419fd9['push'](_0x419fd9['shift']());}};_0x44d049(++_0x44a2f9);}(_0x9730,0x1d8));var _0x0973=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9730[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0973('0x0'));var util=require(_0x0973('0x1'));var logger=require('../../config/logger')(_0x0973('0x2'));var moment=require(_0x0973('0x3'));var BPromise=require(_0x0973('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0973('0x5'));var rimraf=require('rimraf');var config=require(_0x0973('0x6'));var attributes=require(_0x0973('0x7'));module[_0x0973('0x8')]=function(_0x1484dc,_0x412dde){return _0x1484dc['define'](_0x0973('0x9'),attributes,{'tableName':_0x0973('0xa'),'paranoid':![],'indexes':[{'name':_0x0973('0xb'),'fields':[_0x0973('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 950f060..daf5756 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 _0xc8f9=['util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x3ef5a9,_0x4a2ac6){var _0x272e9a=function(_0x4e5d1d){while(--_0x4e5d1d){_0x3ef5a9['push'](_0x3ef5a9['shift']());}};_0x272e9a(++_0x4a2ac6);}(_0xc8f9,0x1b4));var _0x9c8f=function(_0x1af906,_0x163d6c){_0x1af906=_0x1af906-0x0;var _0x12e02f=_0xc8f9[_0x1af906];return _0x12e02f;};'use strict';var _=require(_0x9c8f('0x0'));var util=require(_0x9c8f('0x1'));var moment=require(_0x9c8f('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c8f('0x3'));var fs=require('fs');var Redis=require(_0x9c8f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9c8f('0x5'))(_0x9c8f('0x6'));var config=require(_0x9c8f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9c8f('0x8')][_0x9c8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x314a9a,_0x4d0de8,_0x497a49){return new BPromise(function(_0x3466c8,_0x225e05){return client[_0x9c8f('0xa')](_0x314a9a,_0x497a49)[_0x9c8f('0xb')](function(_0x3a9041){logger[_0x9c8f('0xc')](_0x9c8f('0xd'),_0x4d0de8,'request\x20sent');logger[_0x9c8f('0xe')](_0x9c8f('0xf'),_0x4d0de8,_0x9c8f('0x10'),JSON[_0x9c8f('0x11')](_0x3a9041));if(_0x3a9041[_0x9c8f('0x12')]){if(_0x3a9041['error'][_0x9c8f('0x13')]===0x1f4){logger['error'](_0x9c8f('0xd'),_0x4d0de8,_0x3a9041[_0x9c8f('0x12')][_0x9c8f('0x14')]);return _0x225e05(_0x3a9041[_0x9c8f('0x12')][_0x9c8f('0x14')]);}logger[_0x9c8f('0x12')](_0x9c8f('0xd'),_0x4d0de8,_0x3a9041['error'][_0x9c8f('0x14')]);return _0x3466c8(_0x3a9041[_0x9c8f('0x12')][_0x9c8f('0x14')]);}else{logger[_0x9c8f('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x4d0de8,_0x9c8f('0x10'));_0x3466c8(_0x3a9041[_0x9c8f('0x15')]['message']);}})[_0x9c8f('0x16')](function(_0x423d7b){logger[_0x9c8f('0x12')](_0x9c8f('0xd'),_0x4d0de8,_0x423d7b);_0x225e05(_0x423d7b);});});} \ No newline at end of file +var _0x3603=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0x3603,0x176));var _0x3360=function(_0x58530f,_0x32442f){_0x58530f=_0x58530f-0x0;var _0x4adc74=_0x3603[_0x58530f];return _0x4adc74;};'use strict';var _=require(_0x3360('0x0'));var util=require(_0x3360('0x1'));var moment=require(_0x3360('0x2'));var BPromise=require(_0x3360('0x3'));var rs=require(_0x3360('0x4'));var fs=require('fs');var Redis=require(_0x3360('0x5'));var db=require(_0x3360('0x6'))['db'];var utils=require(_0x3360('0x7'));var logger=require(_0x3360('0x8'))(_0x3360('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x390634,_0x54271f,_0x20d577){return new BPromise(function(_0xbf7978,_0x295ba0){return client['request'](_0x390634,_0x20d577)[_0x3360('0xa')](function(_0x554984){logger[_0x3360('0xb')](_0x3360('0xc'),_0x54271f,_0x3360('0xd'));logger['debug'](_0x3360('0xe'),_0x54271f,_0x3360('0xd'),JSON[_0x3360('0xf')](_0x554984));if(_0x554984[_0x3360('0x10')]){if(_0x554984[_0x3360('0x10')][_0x3360('0x11')]===0x1f4){logger[_0x3360('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x54271f,_0x554984[_0x3360('0x10')][_0x3360('0x12')]);return _0x295ba0(_0x554984[_0x3360('0x10')][_0x3360('0x12')]);}logger[_0x3360('0x10')](_0x3360('0xc'),_0x54271f,_0x554984['error'][_0x3360('0x12')]);return _0xbf7978(_0x554984['error']['message']);}else{logger[_0x3360('0xb')](_0x3360('0xc'),_0x54271f,_0x3360('0xd'));_0xbf7978(_0x554984[_0x3360('0x13')]['message']);}})[_0x3360('0x14')](function(_0x572c56){logger[_0x3360('0x10')](_0x3360('0xc'),_0x54271f,_0x572c56);_0x295ba0(_0x572c56);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index b3d0906..a1b786e 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 _0xe3d3=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','describe','get','post','create','put','/:id','update','destroy'];(function(_0x3c1df4,_0x2307ff){var _0x67bac2=function(_0x205287){while(--_0x205287){_0x3c1df4['push'](_0x3c1df4['shift']());}};_0x67bac2(++_0x2307ff);}(_0xe3d3,0x104));var _0x3e3d=function(_0x27cc41,_0x3c7e5d){_0x27cc41=_0x27cc41-0x0;var _0x3e4f89=_0xe3d3[_0x27cc41];return _0x3e4f89;};'use strict';var multer=require(_0x3e3d('0x0'));var util=require(_0x3e3d('0x1'));var path=require(_0x3e3d('0x2'));var timeout=require('connect-timeout');var express=require(_0x3e3d('0x3'));var router=express[_0x3e3d('0x4')]();var fs_extra=require(_0x3e3d('0x5'));var auth=require(_0x3e3d('0x6'));var interaction=require(_0x3e3d('0x7'));var config=require(_0x3e3d('0x8'));var controller=require(_0x3e3d('0x9'));router['get']('/',auth[_0x3e3d('0xa')](),controller[_0x3e3d('0xb')]);router['get']('/describe',auth[_0x3e3d('0xa')](),controller[_0x3e3d('0xc')]);router[_0x3e3d('0xd')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3e3d('0xe')]('/',auth['isAuthenticated'](),controller[_0x3e3d('0xf')]);router[_0x3e3d('0x10')](_0x3e3d('0x11'),auth[_0x3e3d('0xa')](),controller[_0x3e3d('0x12')]);router['delete']('/:id',auth[_0x3e3d('0xa')](),controller[_0x3e3d('0x13')]);module['exports']=router; \ No newline at end of file +var _0x488b=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x21090b,_0x39dd3b){var _0x3c68d7=function(_0x28ecd4){while(--_0x28ecd4){_0x21090b['push'](_0x21090b['shift']());}};_0x3c68d7(++_0x39dd3b);}(_0x488b,0xb6));var _0xb488=function(_0x2ddaec,_0x1bc0be){_0x2ddaec=_0x2ddaec-0x0;var _0x217fde=_0x488b[_0x2ddaec];return _0x217fde;};'use strict';var multer=require(_0xb488('0x0'));var util=require(_0xb488('0x1'));var path=require(_0xb488('0x2'));var timeout=require(_0xb488('0x3'));var express=require(_0xb488('0x4'));var router=express['Router']();var fs_extra=require(_0xb488('0x5'));var auth=require(_0xb488('0x6'));var interaction=require(_0xb488('0x7'));var config=require(_0xb488('0x8'));var controller=require(_0xb488('0x9'));router[_0xb488('0xa')]('/',auth[_0xb488('0xb')](),controller[_0xb488('0xc')]);router[_0xb488('0xa')](_0xb488('0xd'),auth[_0xb488('0xb')](),controller['describe']);router[_0xb488('0xa')](_0xb488('0xe'),auth[_0xb488('0xb')](),controller[_0xb488('0xf')]);router['post']('/',auth[_0xb488('0xb')](),controller[_0xb488('0x10')]);router[_0xb488('0x11')](_0xb488('0xe'),auth['isAuthenticated'](),controller[_0xb488('0x12')]);router[_0xb488('0x13')]('/:id',auth[_0xb488('0xb')](),controller[_0xb488('0x14')]);module[_0xb488('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 5a94d9f..d71fe5a 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 _0x9d4d=['star','TEXT','stringify','input','name','text','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','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','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','squared','rounded','We\x20are\x20here!','Send','BOOLEAN','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','thumb'];(function(_0x5ebb89,_0x26c132){var _0x375087=function(_0x2a4c29){while(--_0x2a4c29){_0x5ebb89['push'](_0x5ebb89['shift']());}};_0x375087(++_0x26c132);}(_0x9d4d,0xed));var _0xd9d4=function(_0x4390aa,_0x80bc78){_0x4390aa=_0x4390aa-0x0;var _0x88eb9a=_0x9d4d[_0x4390aa];return _0x88eb9a;};'use strict';var Sequelize=require(_0xd9d4('0x0'));var rs=require('randomstring');module[_0xd9d4('0x1')]={'name':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd9d4('0x3')},'description':{'type':Sequelize[_0xd9d4('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xd9d4('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xd9d4('0x4')},'key':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![],'defaultValue':_0xd9d4('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![],'defaultValue':_0xd9d4('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![],'defaultValue':_0xd9d4('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xd9d4('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xd9d4('0x8')),'defaultValue':_0xd9d4('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xd9d4('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xd9d4('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0xd')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0xe')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd9d4('0xf')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd9d4('0x10')},'noteTitle':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x11')},'placeholderMessage':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x12')},'closingMessageButton':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xd9d4('0x13')},'conditionAgreement':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x14')},'ratingType':{'type':Sequelize[_0xd9d4('0x15')]('star',_0xd9d4('0x16')),'defaultValue':_0xd9d4('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xd9d4('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xd9d4('0x18')],'defaultValue':function(){return JSON[_0xd9d4('0x19')]({'items':[{'type':_0xd9d4('0x1a'),'variable':null,'config':{'placeholder':_0xd9d4('0x1b'),'type':_0xd9d4('0x1c'),'required':!![]},'props':{'title':_0xd9d4('0x1b'),'helpText':''}},{'type':_0xd9d4('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xd9d4('0x4'),'type':_0xd9d4('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xd9d4('0x1d')](_0xd9d4('0x1e'))?JSON['parse'](this[_0xd9d4('0x1d')](_0xd9d4('0x1e'))):{};},'set':function(_0x1a1aef){return this[_0xd9d4('0x1f')](_0xd9d4('0x1e'),JSON['stringify'](_0x1a1aef));}},'offlineForm':{'type':Sequelize[_0xd9d4('0x18')],'defaultValue':function(){return JSON[_0xd9d4('0x19')]({'items':[{'type':'input','props':{'title':_0xd9d4('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xd9d4('0x4'),'type':_0xd9d4('0x4')},'variable':null},{'type':_0xd9d4('0x20'),'config':{'placeholder':_0xd9d4('0x21')},'props':{'title':_0xd9d4('0x21'),'helpText':_0xd9d4('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xd9d4('0x1d')](_0xd9d4('0x23'))?JSON[_0xd9d4('0x24')](this[_0xd9d4('0x1d')](_0xd9d4('0x23'))):{};},'set':function(_0x1d35c6){return this[_0xd9d4('0x1f')](_0xd9d4('0x23'),JSON[_0xd9d4('0x19')](_0x1d35c6));}},'token':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xd9d4('0x2')]},'forwardOffline':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x26')},'offlineMessageBody':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xd9d4('0x13')},'sendUnmanaged':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xd9d4('0x18')]},'showAgentAvatar':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xd9d4('0x2')]},'notificationTemplate':{'type':Sequelize[_0xd9d4('0x18')],'defaultValue':function(){return _0xd9d4('0x29');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0xd9d4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x2b')},'verticalAlignment':{'type':Sequelize[_0xd9d4('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x2c')},'messagesAlignment':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![],'defaultValue':_0xd9d4('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd9d4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd9d4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xd9d4('0x18')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xd9d4('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![],'comment':_0xd9d4('0x30'),'set':function(_0x30a0af){if(!_0x30a0af)this[_0xd9d4('0x1f')](_0xd9d4('0x31'),null);this[_0xd9d4('0x1f')](_0xd9d4('0x32'),_0x30a0af);}},'vidaooEscalation':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xd9d4('0x2')]},'vidaooTopic':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![],'defaultValue':_0xd9d4('0x33')},'vidaooNote':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xd9d4('0x18')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xad26=['#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','input','text','name','getDataValue','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','parse','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','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','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'];(function(_0x398032,_0x391f3b){var _0x4af960=function(_0x4b3b7d){while(--_0x4b3b7d){_0x398032['push'](_0x398032['shift']());}};_0x4af960(++_0x391f3b);}(_0xad26,0xd0));var _0x6ad2=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xad26[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require(_0x6ad2('0x0'));var rs=require(_0x6ad2('0x1'));module[_0x6ad2('0x2')]={'name':{'type':Sequelize[_0x6ad2('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x6ad2('0x3')],'allowNull':![],'unique':_0x6ad2('0x4')},'description':{'type':Sequelize[_0x6ad2('0x3')]},'mapKey':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x6ad2('0x5')},'key':{'type':Sequelize[_0x6ad2('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x6')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6ad2('0x3')],'allowNull':![],'defaultValue':_0x6ad2('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6ad2('0x3')],'allowNull':![],'defaultValue':_0x6ad2('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6ad2('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6ad2('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6ad2('0x3')]},'animation':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6ad2('0xa')](_0x6ad2('0xb'),_0x6ad2('0xc')),'defaultValue':_0x6ad2('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x6ad2('0xd')},'start_chat_button':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0xe')},'offline_chat_button':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0xf')},'download_transcript':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6ad2('0x10')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6ad2('0x12')]},'closingQuestion':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x13')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x6ad2('0x14')},'placeholderMessage':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x15')},'closingMessage':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x16')},'closingMessageButton':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x17')},'skipMessageButton':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x18')},'conditionAgreement':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x19')},'ratingType':{'type':Sequelize[_0x6ad2('0xa')](_0x6ad2('0x1a'),'thumb'),'defaultValue':_0x6ad2('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0x6ad2('0x10')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x6ad2('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0x6ad2('0x1c'),'required':!![]},'props':{'title':_0x6ad2('0x1d'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x6ad2('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6ad2('0x1e')]('onlineForm')?JSON['parse'](this[_0x6ad2('0x1e')](_0x6ad2('0x1f'))):{};},'set':function(_0x361a82){return this[_0x6ad2('0x20')](_0x6ad2('0x1f'),JSON[_0x6ad2('0x21')](_0x361a82));}},'offlineForm':{'type':Sequelize[_0x6ad2('0x12')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x6ad2('0x5'),'type':'email'},'variable':null},{'type':_0x6ad2('0x22'),'config':{'placeholder':'Comments'},'props':{'title':_0x6ad2('0x23'),'helpText':_0x6ad2('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x6ad2('0x1e')]('offlineForm')?JSON[_0x6ad2('0x25')](this[_0x6ad2('0x1e')]('offlineForm')):{};},'set':function(_0x1880c5){return this[_0x6ad2('0x20')]('offlineForm',JSON[_0x6ad2('0x21')](_0x1880c5));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6ad2('0x26')]();}},'autoclose':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6ad2('0x3')]},'forwardOffline':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6ad2('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x6ad2('0x27')},'waitingMessage':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x28')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x6ad2('0x29')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6ad2('0x2a')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x6ad2('0x18')},'sendUnmanaged':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x17')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6ad2('0x12')]},'showAgentAvatar':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6ad2('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6ad2('0x12')],'defaultValue':function(){return _0x6ad2('0x2b');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6ad2('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6ad2('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x2d')},'verticalAlignment':{'type':Sequelize[_0x6ad2('0x10')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x2e')},'messagesAlignment':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x2f')},'defaultTitle':{'type':Sequelize[_0x6ad2('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6ad2('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':_0x6ad2('0x30')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6ad2('0x10')],'comment':_0x6ad2('0x31')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6ad2('0x32'),'set':function(_0x579b30){if(!_0x579b30)this[_0x6ad2('0x20')]('mandatoryDispositionPauseId',null);this[_0x6ad2('0x20')](_0x6ad2('0x33'),_0x579b30);}},'vidaooEscalation':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6ad2('0x3')]},'vidaooTopic':{'type':Sequelize[_0x6ad2('0x3')],'allowNull':![],'defaultValue':_0x6ad2('0x34')},'vidaooNote':{'type':Sequelize[_0x6ad2('0x3')],'defaultValue':function(){return _0x6ad2('0x35');}},'vidaooMetadata':{'type':Sequelize[_0x6ad2('0x12')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6ad2('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 7e16ffa..9524701 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 _0x6faf=['removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','file','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','isNil','existsSync','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','getSystemAvatar','notify','CmContact','Sequelize','difference','createdAt','updatedAt','ListId','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','list','applications','orderBy','Applications','priority','asc','headers','threadId','externalUrl','ContactId','interaction','ChatInteraction','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','unshift','queue','waitForTheAssignedQueue','Start','EventManager','offline','files','send','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','basename','openNewInteraction','sequelize','Attachment','CloudProvider','Smtp','forwardOfflineAddress','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','Chat','NotifyMailAccount','notifyMail','server','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','getProactiveActions','getLicense','virtual','custom','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','URL','address','remote','x-real-ip','connection','remoteAddress','referer','alignment','verticalAlignment','labelText','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','html-to-text','ioredis','jayson/promise','url','../../components/parsers/qs','../../config/logger','api','../../errors/api','APIOutOfIntervalError','APINotFoundError','handleError','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','then','destroy','ChatWebsites','UserProfileResource','sendStatus','stack','name','Command','getSnippet','timezone','format','iftime\x20%s,%s','iftime\x20%s','interval','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','map','Interval','Intervals','get','user-agent-parser','setUA','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','type','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','rows','show','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','update','body','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne'];(function(_0x37cb61,_0xa49d0){var _0x4ca1c7=function(_0x4201f9){while(--_0x4201f9){_0x37cb61['push'](_0x37cb61['shift']());}};_0x4ca1c7(++_0xa49d0);}(_0x6faf,0xb0));var _0xf6fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6faf[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0xf6fa('0x0'));var util=require('util');var path=require(_0xf6fa('0x1'));var ejs=require(_0xf6fa('0x2'));var fs=require('fs');var fs_extra=require(_0xf6fa('0x3'));var _=require(_0xf6fa('0x4'));var querystring=require('querystring');var htmlToText=require(_0xf6fa('0x5'));var Redis=require(_0xf6fa('0x6'));var jayson=require(_0xf6fa('0x7'));var url=require(_0xf6fa('0x8'));var qs=require(_0xf6fa('0x9'));var logger=require(_0xf6fa('0xa'))(_0xf6fa('0xb'));var config=require('../../config/environment');var APIOutOfIntervalError=require(_0xf6fa('0xc'))[_0xf6fa('0xd')];var APINotFoundError=require('../../errors/api')[_0xf6fa('0xe')];var APIHandleError=require('../../errors/api')[_0xf6fa('0xf')];var db=require(_0xf6fa('0x10'))['db'];config[_0xf6fa('0x11')]=_[_0xf6fa('0x12')](config[_0xf6fa('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0xf6fa('0x13'))(new Redis(config[_0xf6fa('0x11')]));require('./chatWebsite.socket')[_0xf6fa('0x14')](socket);var client=jayson[_0xf6fa('0x15')]['http']({'port':0x232c});var client9002=jayson[_0xf6fa('0x15')][_0xf6fa('0x16')]({'port':0x232a});var client9003=jayson[_0xf6fa('0x15')][_0xf6fa('0x16')]({'port':0x232b});var client9001=jayson[_0xf6fa('0x15')][_0xf6fa('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x3fb0c3,_0x29f4f0,_0x29699b,_0x575cd7){return new Promise(function(_0x45b2eb,_0xb88b48){var _0x2c7e75=_0x575cd7||client;return _0x2c7e75['request'](_0x3fb0c3,_0x29699b)['then'](function(_0x2527a5){logger[_0xf6fa('0x17')](_0xf6fa('0x18'),_0x29f4f0,_0xf6fa('0x19'));logger[_0xf6fa('0x1a')](_0xf6fa('0x1b'),_0x29f4f0,'request\x20sent',JSON[_0xf6fa('0x1c')](_0x2527a5));if(_0x2527a5[_0xf6fa('0x1d')]){if(_0x2527a5[_0xf6fa('0x1d')]['code']===0x1f4){logger['error'](_0xf6fa('0x18'),_0x29f4f0,_0x2527a5[_0xf6fa('0x1d')][_0xf6fa('0x1e')]);return _0xb88b48(_0x2527a5[_0xf6fa('0x1d')][_0xf6fa('0x1e')]);}logger[_0xf6fa('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x29f4f0,_0x2527a5[_0xf6fa('0x1d')][_0xf6fa('0x1e')]);return _0x45b2eb(_0x2527a5[_0xf6fa('0x1d')][_0xf6fa('0x1e')]);}else{logger[_0xf6fa('0x17')](_0xf6fa('0x18'),_0x29f4f0,'request\x20sent');_0x45b2eb(_0x2527a5[_0xf6fa('0x1f')][_0xf6fa('0x1e')]);}})[_0xf6fa('0x20')](function(_0x26062a){logger[_0xf6fa('0x1d')](_0xf6fa('0x18'),_0x29f4f0,_0x26062a);_0xb88b48(_0x26062a);});});}function respondWithStatusCode(_0x26275a,_0x347469){_0x347469=_0x347469||0xcc;return function(_0x14e9f9){if(_0x14e9f9){return _0x26275a['sendStatus'](_0x347469);}return _0x26275a[_0xf6fa('0x21')](_0x347469)[_0xf6fa('0x22')]();};}function respondWithResult(_0x504898,_0x5807c3){_0x5807c3=_0x5807c3||0xc8;return function(_0x124e29){if(_0x124e29){return _0x504898[_0xf6fa('0x21')](_0x5807c3)[_0xf6fa('0x23')](_0x124e29);}};}function respondWithFilteredResult(_0x47bf12,_0x523057){return function(_0x29bcfb){if(_0x29bcfb){var _0x56dec2=typeof _0x523057[_0xf6fa('0x24')]===_0xf6fa('0x25')&&typeof _0x523057[_0xf6fa('0x26')]===_0xf6fa('0x25');var _0x2f579a=_0x29bcfb[_0xf6fa('0x27')];var _0x298f0f=_0x56dec2?0x0:_0x523057[_0xf6fa('0x24')];var _0x424e8b=_0x56dec2?_0x29bcfb[_0xf6fa('0x27')]:_0x523057['offset']+_0x523057['limit'];var _0xf115fe;if(_0x424e8b>=_0x2f579a){_0x424e8b=_0x2f579a;_0xf115fe=0xc8;}else{_0xf115fe=0xce;}_0x47bf12['status'](_0xf115fe);return _0x47bf12['set'](_0xf6fa('0x28'),_0x298f0f+'-'+_0x424e8b+'/'+_0x2f579a)[_0xf6fa('0x23')](_0x29bcfb);}return null;};}function saveUpdates(_0x536b53){return function(_0x41af04){if(_0x41af04){return _0x41af04['update'](_0x536b53)[_0xf6fa('0x29')](function(_0x5ca4ce){return _0x5ca4ce;});}return null;};}function removeEntity(_0x38b986){return function(_0x262ea2){if(_0x262ea2){return _0x262ea2[_0xf6fa('0x2a')]()['then'](function(){var _0x411a83=_0x262ea2['get']({'plain':!![]});var _0x19dc4b=_0xf6fa('0x2b');return db[_0xf6fa('0x2c')][_0xf6fa('0x2a')]({'where':{'type':_0x19dc4b,'resourceId':_0x411a83['id']}})[_0xf6fa('0x29')](function(){return _0x262ea2;});})[_0xf6fa('0x29')](function(){_0x38b986[_0xf6fa('0x21')](0xcc)[_0xf6fa('0x22')]();});}};}function handleEntityNotFound(_0x105938){return function(_0x48d5c3){if(!_0x48d5c3){_0x105938[_0xf6fa('0x2d')](0x194);}return _0x48d5c3;};}function handleError(_0x365685,_0x18f0d3){_0x18f0d3=_0x18f0d3||0x1f4;return function(_0x470326){logger[_0xf6fa('0x1d')](_0x470326[_0xf6fa('0x2e')]);if(_0x470326['name']){delete _0x470326[_0xf6fa('0x2f')];}_0x365685[_0xf6fa('0x21')](_0x18f0d3)['send'](_0x470326);};}function iftimePromise(_0x21176f,_0x4747db){return respondWithRpcPromise(_0xf6fa('0x30'),_0xf6fa('0x31'),{'command':_0x4747db[_0xf6fa('0x32')]?util[_0xf6fa('0x33')](_0xf6fa('0x34'),_0x21176f['interval'],_0x4747db[_0xf6fa('0x32')]):util[_0xf6fa('0x33')](_0xf6fa('0x35'),_0x21176f[_0xf6fa('0x36')])},client9002)[_0xf6fa('0x29')](function(_0x4764be){var _0x522cfa=_0x4764be&&_0x4764be['indexOf'](_0xf6fa('0x37'))>=0x0?!![]:![];logger[_0xf6fa('0x17')](_0xf6fa('0x38'),_0x4747db['id'],_0x21176f['id'],_0x21176f[_0xf6fa('0x36')],_0x522cfa?_0xf6fa('0x39'):_0xf6fa('0x3a'),_0x4747db['timezone']?_0x4747db[_0xf6fa('0x32')]:_0xf6fa('0x3b'));return _0x522cfa;})[_0xf6fa('0x20')](function(_0x4bbf36){logger[_0xf6fa('0x1d')](_0xf6fa('0x38'),_0x4747db['id'],_0x21176f['id'],_0x21176f[_0xf6fa('0x36')],util['inspect'](_0x4bbf36,{'showHidden':![],'depth':null}),_0x4747db[_0xf6fa('0x32')]?_0x4747db[_0xf6fa('0x32')]:_0xf6fa('0x3b'));return![];});}function checkWebsiteIntervals(_0x238a07){var _0x7263bf=_[_0xf6fa('0x3c')](_0x238a07[_0xf6fa('0x3d')][_0xf6fa('0x3e')],function(_0x675772){var _0x41a6ec=_0x675772[_0xf6fa('0x3f')]({'plain':!![]});return iftimePromise(_0x41a6ec,_0x238a07);});return Promise['all'](_0x7263bf)[_0xf6fa('0x29')](function(_0x5553e3){return _['some'](_0x5553e3);});}function createInteractionObject(_0x10cec8,_0x38cb34,_0x155654,_0x14c679){var _0x32b67b=require(_0xf6fa('0x40'));var _0x3b9738=new _0x32b67b();var _0x3ef49b=_0x3b9738[_0xf6fa('0x41')](_0x155654['user-agent'])['getResult']();var _0x46e709=_0x38cb34[_0xf6fa('0x42')];if(_0x155654[_0xf6fa('0x43')]){_0x46e709=_0x155654[_0xf6fa('0x43')];}else if(_0x155654[_0xf6fa('0x44')]){_0x46e709=_[_0xf6fa('0x45')](_0x155654['x-forwarded-for'][_0xf6fa('0x46')](','));}return{'ContactId':_0x14c679['id'],'ChatWebsiteId':_0x10cec8,'from':(_0x14c679[_0xf6fa('0x47')]||'')+'\x20'+(_0x14c679[_0xf6fa('0x48')]||''),'customerIp':_0x46e709,'customerPort':_0x155654[_0xf6fa('0x49')]?_0x155654[_0xf6fa('0x49')]:null,'referer':_0x38cb34['referer'],'browserName':_0x3ef49b[_0xf6fa('0x4a')][_0xf6fa('0x2f')]&&_0x3ef49b[_0xf6fa('0x4a')]['version']?util[_0xf6fa('0x33')](_0xf6fa('0x4b'),_0x3ef49b['browser'][_0xf6fa('0x2f')],_0x3ef49b[_0xf6fa('0x4a')][_0xf6fa('0x4c')]):'unknown','browserVersion':_0x3ef49b['browser'][_0xf6fa('0x4c')]||_0xf6fa('0x4d'),'osName':util['format']('%s\x20%s',_0x3ef49b['os'][_0xf6fa('0x2f')],_0x3ef49b['os']['version']),'osVersion':_0x3ef49b['os'][_0xf6fa('0x4c')],'deviceModel':_0x3ef49b['device']['model']&&_0x3ef49b[_0xf6fa('0x4e')][_0xf6fa('0x4f')]?util[_0xf6fa('0x33')](_0xf6fa('0x50'),_0x3ef49b[_0xf6fa('0x4e')]['model'],_0x3ef49b[_0xf6fa('0x4e')][_0xf6fa('0x4f')],_0x3ef49b[_0xf6fa('0x4e')][_0xf6fa('0x51')]):null,'deviceVendor':_0x3ef49b['device']['vendor'],'deviceType':_0x3ef49b[_0xf6fa('0x4e')]['type'],'formData':JSON[_0xf6fa('0x1c')](_0x38cb34)};}exports['index']=function(_0x1efbdd,_0x180aeb){var _0xa8d61a={'include':[{'model':db[_0xf6fa('0x52')],'as':_0xf6fa('0x53')}]},_0x58e608={},_0x8cab02={'count':0x0,'rows':[]};var _0x4f6c05=_['map'](db[_0xf6fa('0x54')][_0xf6fa('0x55')],function(_0x36c434){return{'name':_0x36c434[_0xf6fa('0x56')],'type':_0x36c434[_0xf6fa('0x51')]['key']};});_0x58e608['model']=_[_0xf6fa('0x3c')](_0x4f6c05,_0xf6fa('0x2f'));_0x58e608[_0xf6fa('0x57')]=_[_0xf6fa('0x58')](_0x1efbdd['query']);_0x58e608[_0xf6fa('0x59')]=_['intersection'](_0x58e608[_0xf6fa('0x5a')],_0x58e608[_0xf6fa('0x57')]);_0xa8d61a['attributes']=_[_0xf6fa('0x5b')](_0x58e608[_0xf6fa('0x5a')],qs[_0xf6fa('0x5c')](_0x1efbdd[_0xf6fa('0x57')][_0xf6fa('0x5c')]));_0xa8d61a['attributes']=_0xa8d61a[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0xa8d61a[_0xf6fa('0x5d')]:_0x58e608[_0xf6fa('0x5a')];if(!_0x1efbdd[_0xf6fa('0x57')][_0xf6fa('0x5f')](_0xf6fa('0x60'))){_0xa8d61a[_0xf6fa('0x26')]=qs['limit'](_0x1efbdd['query'][_0xf6fa('0x26')]);_0xa8d61a['offset']=qs[_0xf6fa('0x24')](_0x1efbdd[_0xf6fa('0x57')]['offset']);}_0xa8d61a[_0xf6fa('0x61')]=qs['sort'](_0x1efbdd[_0xf6fa('0x57')][_0xf6fa('0x62')]);_0xa8d61a[_0xf6fa('0x63')]=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0x1efbdd[_0xf6fa('0x57')],_0x58e608[_0xf6fa('0x59')]),_0x4f6c05);if(_0x1efbdd[_0xf6fa('0x57')][_0xf6fa('0x65')]){_0xa8d61a[_0xf6fa('0x63')]=_['merge'](_0xa8d61a[_0xf6fa('0x63')],{'$or':_[_0xf6fa('0x3c')](_0x4f6c05,function(_0x28c096){if(_0x28c096[_0xf6fa('0x51')]!=='VIRTUAL'){var _0xc2444c={};_0xc2444c[_0x28c096[_0xf6fa('0x2f')]]={'$like':'%'+_0x1efbdd[_0xf6fa('0x57')]['filter']+'%'};return _0xc2444c;}})});}_0xa8d61a=_['merge']({},_0xa8d61a,_0x1efbdd[_0xf6fa('0x66')]);var _0x37f179={'where':_0xa8d61a[_0xf6fa('0x63')]};return db[_0xf6fa('0x54')][_0xf6fa('0x27')](_0x37f179)[_0xf6fa('0x29')](function(_0xe41bb2){_0x8cab02[_0xf6fa('0x27')]=_0xe41bb2;if(_0x1efbdd['query'][_0xf6fa('0x67')]){_0xa8d61a[_0xf6fa('0x68')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0xa8d61a);})[_0xf6fa('0x29')](function(_0x1d014d){_0x8cab02[_0xf6fa('0x69')]=_0x1d014d;return _0x8cab02;})['then'](respondWithFilteredResult(_0x180aeb,_0xa8d61a))['catch'](handleError(_0x180aeb,null));};exports[_0xf6fa('0x6a')]=function(_0x3e6c85,_0x2fc5c4){var _0x1f7aec={'raw':![],'where':{'id':_0x3e6c85['params']['id']},'include':[{'model':db[_0xf6fa('0x52')],'as':_0xf6fa('0x53')}]},_0x4f66c6={};_0x4f66c6[_0xf6fa('0x5a')]=_['keys'](db[_0xf6fa('0x54')][_0xf6fa('0x55')]);_0x4f66c6['query']=_[_0xf6fa('0x58')](_0x3e6c85[_0xf6fa('0x57')]);_0x4f66c6['filters']=_[_0xf6fa('0x5b')](_0x4f66c6[_0xf6fa('0x5a')],_0x4f66c6[_0xf6fa('0x57')]);_0x1f7aec[_0xf6fa('0x5d')]=_['intersection'](_0x4f66c6['model'],qs['fields'](_0x3e6c85[_0xf6fa('0x57')][_0xf6fa('0x5c')]));_0x1f7aec[_0xf6fa('0x5d')]=_0x1f7aec[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0x1f7aec[_0xf6fa('0x5d')]:_0x4f66c6[_0xf6fa('0x5a')];if(_0x3e6c85[_0xf6fa('0x57')][_0xf6fa('0x67')]){_0x1f7aec['include']=[{'all':!![]}];}_0x1f7aec=_[_0xf6fa('0x6b')]({},_0x1f7aec,_0x3e6c85[_0xf6fa('0x66')]);return db[_0xf6fa('0x54')]['find'](_0x1f7aec)[_0xf6fa('0x29')](handleEntityNotFound(_0x2fc5c4,null))[_0xf6fa('0x29')](respondWithResult(_0x2fc5c4,null))['catch'](handleError(_0x2fc5c4,null));};exports[_0xf6fa('0x6c')]=function(_0x1efe78,_0x564d65){return db[_0xf6fa('0x54')]['create'](_0x1efe78['body'],{})[_0xf6fa('0x29')](function(_0x4262a5){var _0x2695c0=_0x1efe78[_0xf6fa('0x6d')][_0xf6fa('0x3f')]({'plain':!![]});if(!_0x2695c0)throw new Error(_0xf6fa('0x6e'));if(_0x2695c0[_0xf6fa('0x6f')]==='user'){var _0xf3dc7f=_0x4262a5['get']({'plain':!![]});var _0x33ddf8=_0xf6fa('0x2b');return db[_0xf6fa('0x70')][_0xf6fa('0x71')]({'where':{'name':_0x33ddf8,'userProfileId':_0x2695c0[_0xf6fa('0x72')]},'raw':!![]})[_0xf6fa('0x29')](function(_0x4941d5){if(_0x4941d5&&_0x4941d5[_0xf6fa('0x73')]===0x0){return db['UserProfileResource'][_0xf6fa('0x6c')]({'name':_0xf3dc7f[_0xf6fa('0x2f')],'resourceId':_0xf3dc7f['id'],'type':_0x4941d5[_0xf6fa('0x2f')],'sectionId':_0x4941d5['id']},{})['then'](function(){return _0x4262a5;});}else{return _0x4262a5;}})['catch'](function(_0x4bf40e){logger[_0xf6fa('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bf40e);throw _0x4bf40e;});}return _0x4262a5;})['then'](respondWithResult(_0x564d65,0xc9))[_0xf6fa('0x20')](handleError(_0x564d65,null));};exports[_0xf6fa('0x74')]=function(_0x5b5d75,_0x465b0b){if(_0x5b5d75['body']['id']){delete _0x5b5d75[_0xf6fa('0x75')]['id'];}return db[_0xf6fa('0x54')]['find']({'where':{'id':_0x5b5d75[_0xf6fa('0x76')]['id']},'include':[{'model':db[_0xf6fa('0x52')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x465b0b,null))['then'](saveUpdates(_0x5b5d75[_0xf6fa('0x75')],null))[_0xf6fa('0x29')](respondWithResult(_0x465b0b,null))['catch'](handleError(_0x465b0b,null));};exports[_0xf6fa('0x2a')]=function(_0x323871,_0x1a34b3){return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x323871[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x1a34b3,null))['then'](removeEntity(_0x1a34b3,null))[_0xf6fa('0x20')](handleError(_0x1a34b3,null));};exports[_0xf6fa('0x77')]=function(_0x57be89,_0xe54ee6){return db[_0xf6fa('0x54')][_0xf6fa('0x77')]()[_0xf6fa('0x29')](respondWithResult(_0xe54ee6,null))[_0xf6fa('0x20')](handleError(_0xe54ee6,null));};exports[_0xf6fa('0x78')]=function(_0x43aff5,_0x25ef7d){if(_0x43aff5[_0xf6fa('0x75')]['id']){delete _0x43aff5[_0xf6fa('0x75')]['id'];}return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x43aff5[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x25ef7d,null))['then'](function(_0x5b134b){if(_0x5b134b){_0x43aff5[_0xf6fa('0x75')][_0xf6fa('0x79')]=_0x5b134b['id'];return db[_0xf6fa('0x7a')][_0xf6fa('0x6c')](_0x43aff5[_0xf6fa('0x75')]);}})[_0xf6fa('0x29')](respondWithResult(_0x25ef7d,null))[_0xf6fa('0x20')](handleError(_0x25ef7d,null));};exports[_0xf6fa('0x7b')]=function(_0x5210e7,_0x505045){var _0x14442e={'raw':![],'where':{}};var _0x5d73bb={};var _0x5f1031={'count':0x0,'rows':[]};return db[_0xf6fa('0x54')]['findOne']({'where':{'id':_0x5210e7[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x505045,null))['then'](function(_0x2113ac){if(_0x2113ac){_0x5d73bb['model']=_['keys'](db[_0xf6fa('0x7a')]['rawAttributes']);_0x5d73bb['query']=_['keys'](_0x5210e7[_0xf6fa('0x57')]);_0x5d73bb['filters']=_['intersection'](_0x5d73bb[_0xf6fa('0x5a')],_0x5d73bb[_0xf6fa('0x57')]);_0x14442e[_0xf6fa('0x5d')]=_['intersection'](_0x5d73bb[_0xf6fa('0x5a')],qs['fields'](_0x5210e7[_0xf6fa('0x57')][_0xf6fa('0x5c')]));_0x14442e[_0xf6fa('0x5d')]=_0x14442e[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0x14442e[_0xf6fa('0x5d')]:_0x5d73bb['model'];if(!_0x5210e7[_0xf6fa('0x57')]['hasOwnProperty']('nolimit')){_0x14442e['limit']=qs['limit'](_0x5210e7[_0xf6fa('0x57')]['limit']);_0x14442e[_0xf6fa('0x24')]=qs[_0xf6fa('0x24')](_0x5210e7[_0xf6fa('0x57')][_0xf6fa('0x24')]);}_0x14442e[_0xf6fa('0x61')]=qs[_0xf6fa('0x62')](_0x5210e7[_0xf6fa('0x57')][_0xf6fa('0x62')]);_0x14442e[_0xf6fa('0x63')]=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0x5210e7['query'],_0x5d73bb[_0xf6fa('0x59')]));_0x14442e[_0xf6fa('0x63')][_0xf6fa('0x79')]=_0x2113ac['id'];if(_0x5210e7['query'][_0xf6fa('0x65')]){_0x14442e[_0xf6fa('0x63')]=_[_0xf6fa('0x6b')](_0x14442e[_0xf6fa('0x63')],{'$or':_[_0xf6fa('0x3c')](_0x14442e[_0xf6fa('0x5d')],function(_0x249219){var _0x3f6a53={};_0x3f6a53[_0x249219]={'$like':'%'+_0x5210e7[_0xf6fa('0x57')]['filter']+'%'};return _0x3f6a53;})});}_0x14442e=_['merge']({},_0x14442e,_0x5210e7[_0xf6fa('0x66')]);return db[_0xf6fa('0x7a')][_0xf6fa('0x27')]({'where':_0x14442e[_0xf6fa('0x63')]})[_0xf6fa('0x29')](function(_0x3ec3c2){_0x5f1031['count']=_0x3ec3c2;if(_0x5210e7[_0xf6fa('0x57')][_0xf6fa('0x67')]){_0x14442e[_0xf6fa('0x68')]=[{'all':!![]}];}return db[_0xf6fa('0x7a')][_0xf6fa('0x7c')](_0x14442e);})[_0xf6fa('0x29')](function(_0x26e6af){_0x5f1031['rows']=_0x26e6af;return _0x5f1031;});}})[_0xf6fa('0x29')](respondWithFilteredResult(_0x505045,_0x14442e))[_0xf6fa('0x20')](handleError(_0x505045,null));};exports['removeDispositions']=function(_0x4682c5,_0x5b7952){return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x4682c5['params']['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x5b7952,null))['then'](function(_0x317cff){if(_0x317cff){return _0x317cff[_0xf6fa('0x7d')](_0x4682c5[_0xf6fa('0x57')][_0xf6fa('0x7e')]);}})['then'](respondWithStatusCode(_0x5b7952,null))['catch'](handleError(_0x5b7952,null));};exports[_0xf6fa('0x7f')]=function(_0x32b710,_0x1d81a0){if(_0x32b710[_0xf6fa('0x75')]['id']){delete _0x32b710[_0xf6fa('0x75')]['id'];}return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x32b710[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x1d81a0,null))[_0xf6fa('0x29')](function(_0x23d157){if(_0x23d157){_0x32b710[_0xf6fa('0x75')]['ChatWebsiteId']=_0x23d157['id'];return db[_0xf6fa('0x80')][_0xf6fa('0x6c')](_0x32b710['body']);}})[_0xf6fa('0x29')](respondWithResult(_0x1d81a0,null))['catch'](handleError(_0x1d81a0,null));};exports[_0xf6fa('0x81')]=function(_0x1fad87,_0xc2c363){var _0x2c6508={'raw':![],'where':{}};var _0x3b980c={};var _0x1f056e={'count':0x0,'rows':[]};return db[_0xf6fa('0x54')][_0xf6fa('0x82')]({'where':{'id':_0x1fad87[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0xc2c363,null))[_0xf6fa('0x29')](function(_0x3d9014){if(_0x3d9014){_0x3b980c[_0xf6fa('0x5a')]=_[_0xf6fa('0x58')](db[_0xf6fa('0x80')]['rawAttributes']);_0x3b980c[_0xf6fa('0x57')]=_['keys'](_0x1fad87['query']);_0x3b980c[_0xf6fa('0x59')]=_['intersection'](_0x3b980c[_0xf6fa('0x5a')],_0x3b980c[_0xf6fa('0x57')]);_0x2c6508[_0xf6fa('0x5d')]=_[_0xf6fa('0x5b')](_0x3b980c[_0xf6fa('0x5a')],qs[_0xf6fa('0x5c')](_0x1fad87['query'][_0xf6fa('0x5c')]));_0x2c6508[_0xf6fa('0x5d')]=_0x2c6508[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0x2c6508[_0xf6fa('0x5d')]:_0x3b980c[_0xf6fa('0x5a')];if(!_0x1fad87[_0xf6fa('0x57')][_0xf6fa('0x5f')](_0xf6fa('0x60'))){_0x2c6508[_0xf6fa('0x26')]=qs[_0xf6fa('0x26')](_0x1fad87[_0xf6fa('0x57')][_0xf6fa('0x26')]);_0x2c6508[_0xf6fa('0x24')]=qs['offset'](_0x1fad87[_0xf6fa('0x57')][_0xf6fa('0x24')]);}_0x2c6508[_0xf6fa('0x61')]=qs[_0xf6fa('0x62')](_0x1fad87[_0xf6fa('0x57')][_0xf6fa('0x62')]);_0x2c6508[_0xf6fa('0x63')]=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0x1fad87[_0xf6fa('0x57')],_0x3b980c[_0xf6fa('0x59')]));_0x2c6508[_0xf6fa('0x63')][_0xf6fa('0x79')]=_0x3d9014['id'];if(_0x1fad87[_0xf6fa('0x57')][_0xf6fa('0x65')]){_0x2c6508[_0xf6fa('0x63')]=_['merge'](_0x2c6508[_0xf6fa('0x63')],{'$or':_['map'](_0x2c6508[_0xf6fa('0x5d')],function(_0x4ff6bb){var _0x577f76={};_0x577f76[_0x4ff6bb]={'$like':'%'+_0x1fad87['query'][_0xf6fa('0x65')]+'%'};return _0x577f76;})});}_0x2c6508=_[_0xf6fa('0x6b')]({},_0x2c6508,_0x1fad87[_0xf6fa('0x66')]);return db[_0xf6fa('0x80')]['count']({'where':_0x2c6508['where']})['then'](function(_0x59137e){_0x1f056e[_0xf6fa('0x27')]=_0x59137e;if(_0x1fad87['query'][_0xf6fa('0x67')]){_0x2c6508[_0xf6fa('0x68')]=[{'all':!![]}];}return db[_0xf6fa('0x80')][_0xf6fa('0x7c')](_0x2c6508);})[_0xf6fa('0x29')](function(_0xab2ee1){_0x1f056e[_0xf6fa('0x69')]=_0xab2ee1;return _0x1f056e;});}})[_0xf6fa('0x29')](respondWithFilteredResult(_0xc2c363,_0x2c6508))[_0xf6fa('0x20')](handleError(_0xc2c363,null));};exports['removeAnswers']=function(_0x4618fd,_0x5111db){return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x4618fd[_0xf6fa('0x76')]['id']}})['then'](handleEntityNotFound(_0x5111db,null))[_0xf6fa('0x29')](function(_0x40dd25){if(_0x40dd25){return _0x40dd25[_0xf6fa('0x83')](_0x4618fd[_0xf6fa('0x57')][_0xf6fa('0x7e')]);}})[_0xf6fa('0x29')](respondWithStatusCode(_0x5111db,null))[_0xf6fa('0x20')](handleError(_0x5111db,null));};exports[_0xf6fa('0x84')]=function(_0x5c6552,_0x1205c0){_0x5c6552[_0xf6fa('0x75')][_0xf6fa('0x85')]=_0x5c6552['file'][_0xf6fa('0x86')];return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x5c6552[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x1205c0,null))[_0xf6fa('0x29')](saveUpdates(_0x5c6552[_0xf6fa('0x75')],null))[_0xf6fa('0x29')](respondWithResult(_0x1205c0,null))['catch'](handleError(_0x1205c0,null));};exports[_0xf6fa('0x87')]=function(_0x5f27ee,_0xd16dd0){_0x5f27ee[_0xf6fa('0x75')][_0xf6fa('0x88')]=_0x5f27ee['file'][_0xf6fa('0x86')];return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x5f27ee[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0xd16dd0,null))['then'](saveUpdates(_0x5f27ee[_0xf6fa('0x75')],null))[_0xf6fa('0x29')](respondWithResult(_0xd16dd0,null))[_0xf6fa('0x20')](handleError(_0xd16dd0,null));};exports[_0xf6fa('0x89')]=function(_0x40dcb8,_0x192d56){_0x40dcb8[_0xf6fa('0x75')][_0xf6fa('0x8a')]=_0x40dcb8[_0xf6fa('0x8b')][_0xf6fa('0x86')];return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x40dcb8[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x192d56,null))[_0xf6fa('0x29')](saveUpdates(_0x40dcb8[_0xf6fa('0x75')],null))[_0xf6fa('0x29')](respondWithResult(_0x192d56,null))['catch'](handleError(_0x192d56,null));};exports[_0xf6fa('0x8c')]=function(_0xe95e0b,_0x32bfd3){_0xe95e0b['body'][_0xf6fa('0x8d')]=_0xe95e0b[_0xf6fa('0x8b')]['filename'];return db[_0xf6fa('0x54')]['find']({'where':{'id':_0xe95e0b[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x32bfd3,null))[_0xf6fa('0x29')](saveUpdates(_0xe95e0b[_0xf6fa('0x75')],null))[_0xf6fa('0x29')](respondWithResult(_0x32bfd3,null))[_0xf6fa('0x20')](handleError(_0x32bfd3,null));};exports[_0xf6fa('0x8e')]=function(_0x1fff07,_0x592c73){var _0x7f5cd8=path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],_0xf6fa('0x91'));var _0x47d7e8={'where':{'id':_0x1fff07['params']['id']},'attributes':['id',_0xf6fa('0x85')],'raw':!![]};var _0x2c90e1=![];return require(_0xf6fa('0x92'))['getLicense']()['then'](function(_0x27034f){if(_0x27034f){_0x2c90e1=_0x27034f['custom'];}})['then'](function(){return db[_0xf6fa('0x54')]['find'](_0x47d7e8);})[_0xf6fa('0x29')](handleEntityNotFound(_0x592c73,null))['then'](function(_0x338c72){if(_0x338c72){if(!_[_0xf6fa('0x93')](_0x338c72[_0xf6fa('0x85')])){if(fs[_0xf6fa('0x94')](path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],_0xf6fa('0x95'),_0x338c72[_0xf6fa('0x85')]))&&_0x2c90e1){_0x7f5cd8=path['join'](config[_0xf6fa('0x90')],_0xf6fa('0x95'),_0x338c72['sitepic']);}}return _0x592c73[_0xf6fa('0x96')](_0x7f5cd8);}})[_0xf6fa('0x20')](handleError(_0x592c73,null));};exports[_0xf6fa('0x97')]=function(_0x253f98,_0x411d58){var _0x2b4d27=path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],_0xf6fa('0x98'));var _0x2cebff={'where':{'id':_0x253f98[_0xf6fa('0x76')]['id']},'attributes':['id',_0xf6fa('0x88')],'raw':!![]};return db[_0xf6fa('0x54')][_0xf6fa('0x71')](_0x2cebff)[_0xf6fa('0x29')](handleEntityNotFound(_0x411d58,null))['then'](function(_0x5bed8f){if(_0x5bed8f){if(!_['isNil'](_0x5bed8f[_0xf6fa('0x88')])){if(fs[_0xf6fa('0x94')](path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],_0xf6fa('0x99'),_0x5bed8f[_0xf6fa('0x88')]))){_0x2b4d27=path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],_0xf6fa('0x99'),_0x5bed8f[_0xf6fa('0x88')]);}}return _0x411d58[_0xf6fa('0x96')](_0x2b4d27);}})[_0xf6fa('0x20')](handleError(_0x411d58,null));};exports[_0xf6fa('0x9a')]=function(_0x4a76aa,_0x3c2003){var _0xb711a4=path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],_0xf6fa('0x9b'));var _0x395d36={'where':{'id':_0x4a76aa[_0xf6fa('0x76')]['id']},'attributes':['id',_0xf6fa('0x8a'),_0xf6fa('0x9c')],'raw':!![]};return db[_0xf6fa('0x54')][_0xf6fa('0x71')](_0x395d36)[_0xf6fa('0x29')](handleEntityNotFound(_0x3c2003,null))[_0xf6fa('0x29')](function(_0x71359a){if(_0x71359a){if(!_[_0xf6fa('0x93')](_0x71359a[_0xf6fa('0x8a')])){if(fs[_0xf6fa('0x94')](path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],'server/files/images/avatars/',_0x71359a[_0xf6fa('0x8a')]))&&_0x71359a[_0xf6fa('0x9c')]){_0xb711a4=path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],'server/files/images/avatars/',_0x71359a[_0xf6fa('0x8a')]);}}return _0x3c2003[_0xf6fa('0x96')](_0xb711a4);}})[_0xf6fa('0x20')](handleError(_0x3c2003,null));};exports[_0xf6fa('0x9d')]=function(_0x1d9d13,_0x57175a){var _0x2f8ff6=path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],'server/files/images/avatars/system_avatar.png');var _0x4f7538={'where':{'id':_0x1d9d13[_0xf6fa('0x76')]['id']},'attributes':['id',_0xf6fa('0x8d')],'raw':!![]};return db[_0xf6fa('0x54')][_0xf6fa('0x71')](_0x4f7538)[_0xf6fa('0x29')](handleEntityNotFound(_0x57175a,null))[_0xf6fa('0x29')](function(_0x27cc50){if(_0x27cc50){if(!_[_0xf6fa('0x93')](_0x27cc50[_0xf6fa('0x8d')])){if(fs[_0xf6fa('0x94')](path[_0xf6fa('0x8f')](config['root'],_0xf6fa('0x99'),_0x27cc50[_0xf6fa('0x8d')]))){_0x2f8ff6=path['join'](config[_0xf6fa('0x90')],_0xf6fa('0x99'),_0x27cc50[_0xf6fa('0x8d')]);}}return _0x57175a[_0xf6fa('0x96')](_0x2f8ff6);}})[_0xf6fa('0x20')](handleError(_0x57175a,null));};exports[_0xf6fa('0x9e')]=function(_0x2c7fc9,_0x2c1f70){var _0xbc37c8={'body':_0x2c7fc9[_0xf6fa('0x75')],'channel':'chat'};var _0xdf52d3=[];var _0x2b3770=[];var _0x1a0d99={};var _0x5377d1=![];return db[_0xf6fa('0x9f')][_0xf6fa('0x77')]()['then'](function(_0x32672b){if(!_0x32672b){throw new db[(_0xf6fa('0xa0'))]['ValidationError']('no\x20available\x20attributes');}_0xdf52d3=_[_0xf6fa('0xa1')](_[_0xf6fa('0x58')](_0x32672b),[_0xf6fa('0xa2'),_0xf6fa('0xa3')]);_0x2b3770=_[_0xf6fa('0xa1')](_[_0xf6fa('0x58')](_0x32672b),[_0xf6fa('0xa2'),_0xf6fa('0xa3'),'CompanyId',_0xf6fa('0xa4')]);if(_0x2c7fc9[_0xf6fa('0x75')]['id']){delete _0x2c7fc9[_0xf6fa('0x75')]['id'];}if(_['isNil'](_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xa5')])){throw new db[(_0xf6fa('0xa0'))][(_0xf6fa('0xa6'))]('from\x20is\x20mandatory');}if(_[_0xf6fa('0x93')](_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0x75')])||_0x2c7fc9['body'][_0xf6fa('0x75')]===''){throw new db[(_0xf6fa('0xa0'))][(_0xf6fa('0xa6'))](_0xf6fa('0xa7'));}if(_[_0xf6fa('0x93')](_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xa8')])){throw new db[(_0xf6fa('0xa0'))]['ValidationError'](_0xf6fa('0xa9')+_0x2b3770);}if(!_[_0xf6fa('0xaa')](_0x2b3770,_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xa8')])){throw new db[(_0xf6fa('0xa0'))]['ValidationError'](_0xf6fa('0xab')+_0x2b3770);}_0x1a0d99[_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xa8')]]=_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xa5')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x2c7fc9[_0xf6fa('0x76')]['id']},'include':[{'model':db[_0xf6fa('0xac')],'as':_0xf6fa('0xad'),'include':[{'model':db[_0xf6fa('0x9f')],'as':_0xf6fa('0xae'),'where':_0x1a0d99,'limit':0x1,'order':[[_0xf6fa('0xa3'),_0xf6fa('0xaf')]]}]},{'model':db[_0xf6fa('0xb0')],'as':'Applications'},{'model':db[_0xf6fa('0x3d')],'as':_0xf6fa('0x3d'),'include':[{'model':db[_0xf6fa('0x3d')],'as':_0xf6fa('0x3e'),'attributes':['id',_0xf6fa('0x36')],'raw':!![]}]}]});})[_0xf6fa('0x29')](function(_0x4560cd){if(!_0x4560cd)throw new APINotFoundError(util[_0xf6fa('0x33')](_0xf6fa('0xb1'),_0x2c7fc9[_0xf6fa('0x76')]['id']));if(!_0x4560cd[_0xf6fa('0x3d')]||!_0x4560cd[_0xf6fa('0x3d')]['Intervals'])return[_0x4560cd,!![]];return[_0x4560cd,checkWebsiteIntervals(_0x4560cd)];})[_0xf6fa('0xb2')](function(_0x145fc4,_0xfc230d){if(!_0xfc230d)throw new APIOutOfIntervalError();if(!_0x145fc4[_0xf6fa('0xad')])return;_0xbc37c8[_0xf6fa('0xb3')]=_0x145fc4;_0xbc37c8[_0xf6fa('0xb4')]=_0x145fc4['List'];_0xbc37c8[_0xf6fa('0xb5')]=_[_0xf6fa('0xb6')](_0x145fc4[_0xf6fa('0xb7')],[_0xf6fa('0xb8')],[_0xf6fa('0xb9')]);if(_0xbc37c8[_0xf6fa('0xb3')]['Applications']){delete _0xbc37c8[_0xf6fa('0xb3')][_0xf6fa('0xb7')];}if(_0xbc37c8[_0xf6fa('0xb3')][_0xf6fa('0xad')]&&_0xbc37c8['account'][_0xf6fa('0xad')][_0xf6fa('0xae')][_0xf6fa('0x5e')]){return _0xbc37c8[_0xf6fa('0xb3')][_0xf6fa('0xad')][_0xf6fa('0xae')][0x0];}var _0x136a54=_[_0xf6fa('0x12')](_0x2c7fc9[_0xf6fa('0x75')],{'firstName':_0x2c7fc9['body']['from'],'ListId':_0x145fc4['ListId']});_0x136a54[_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xa8')]]=_0x2c7fc9[_0xf6fa('0x75')]['from'];return db['CmContact'][_0xf6fa('0x6c')](_0x136a54,{'fields':_0xdf52d3,'raw':!![]});})[_0xf6fa('0x29')](function(_0xfa2350){_0xbc37c8['contact']=_0xfa2350;var _0x2eda39=createInteractionObject(_0x2c7fc9[_0xf6fa('0x76')]['id'],_0x2c7fc9[_0xf6fa('0x75')],_0x2c7fc9[_0xf6fa('0xba')],_0xfa2350);var _0x56e67e={'ChatWebsiteId':_0x2c7fc9[_0xf6fa('0x76')]['id'],'closed':![]};if(_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xbb')]){_0x56e67e[_0xf6fa('0xbb')]=_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xbb')];return db['ChatInteraction']['find']({'where':_0x56e67e})[_0xf6fa('0x29')](function(_0x17a097){if(_0x17a097){_0x5377d1=!![];return _0x17a097;}_0x2eda39[_0xf6fa('0xbb')]=_0x2c7fc9['body'][_0xf6fa('0xbb')];_0x2eda39[_0xf6fa('0xbc')]=_0x2c7fc9['body'][_0xf6fa('0xbc')];return db['ChatInteraction'][_0xf6fa('0x6c')](_0x2eda39);});}_0x56e67e[_0xf6fa('0xbd')]=_0xfa2350['id'];if(_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xbe')]&&_0x2c7fc9['body'][_0xf6fa('0xbe')]['id']){_0x56e67e['id']=_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xbe')]['id'];return db[_0xf6fa('0xbf')][_0xf6fa('0x71')]({'where':_0x56e67e})[_0xf6fa('0x29')](function(_0x553ad2){if(_0x553ad2){_0x5377d1=!![];return _0x553ad2;}return db[_0xf6fa('0xbf')]['create'](_0x2eda39);});}return db[_0xf6fa('0xbf')]['create'](_0x2eda39);})[_0xf6fa('0x29')](function(_0x1faabb){if(!_0x5377d1)return _0x1faabb;var _0x3c575e={'from':(_0xbc37c8['contact'][_0xf6fa('0x47')]||'')+'\x20'+(_0xbc37c8[_0xf6fa('0xc0')][_0xf6fa('0x48')]||'')};if(_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xbb')]&&_0x2c7fc9[_0xf6fa('0x75')]['messageId']&&_0x2c7fc9['body']['threadId']!=_0x2c7fc9[_0xf6fa('0x75')]['messageId']){_0x3c575e[_0xf6fa('0xbb')]=_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xc1')];}return _0x1faabb['update'](_0x3c575e);})[_0xf6fa('0x29')](function(_0x1ff9b2){_0xbc37c8[_0xf6fa('0xbe')]=_0x1ff9b2['get']({'plain':!![]});_0xbc37c8[_0xf6fa('0xbe')]['created']=!_0x5377d1;if(_0xbc37c8[_0xf6fa('0xbe')][_0xf6fa('0xc2')]){if(_0xbc37c8[_0xf6fa('0xb3')][_0xf6fa('0xc3')]){_0xbc37c8['applications'][_0xf6fa('0xc4')]({'id':0x0,'priority':_0xbc37c8['applications']['length']+0x1,'app':_0xf6fa('0xc5'),'appdata':_0xf6fa('0xc6'),'interval':_0xf6fa('0xc7')});}}return db[_0xf6fa('0xc8')][_0xf6fa('0x6c')]({'body':_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0x75')],'ChatWebsiteId':_0x2c7fc9[_0xf6fa('0x76')]['id'],'ChatInteractionId':_0x1ff9b2['id'],'direction':'in','ContactId':_0xbc37c8[_0xf6fa('0xc0')]['id'],'AttachmentId':_0x2c7fc9['body'][_0xf6fa('0xc9')]});})['then'](function(_0x25cc2c){_0xbc37c8['message']=_0x25cc2c;if(!_0xbc37c8[_0xf6fa('0xbe')]['UserId']){return;}return db['User']['find']({'attributes':['id','name'],'where':{'id':_0xbc37c8[_0xf6fa('0xbe')][_0xf6fa('0xca')]}});})['then'](function(_0xb0cd1){if(_0xb0cd1){_0xbc37c8[_0xf6fa('0xb5')]['unshift']({'id':0x0,'priority':0x0,'app':_0xf6fa('0xcb'),'appdata':_0xb0cd1[_0xf6fa('0x2f')]+','+(_0xbc37c8[_0xf6fa('0xb3')][_0xf6fa('0xcc')]||0xa),'interval':_0xf6fa('0xc7')});_0xbc37c8[_0xf6fa('0xcd')]=!![];}if(!_0xbc37c8['interaction'][_0xf6fa('0xce')]){return;}return db[_0xf6fa('0xcf')][_0xf6fa('0x71')]({'attributes':['id','name'],'where':{'id':_0xbc37c8[_0xf6fa('0xbe')][_0xf6fa('0xce')]}});})[_0xf6fa('0x29')](function(_0x584c6c){if(_0x584c6c){_0xbc37c8[_0xf6fa('0xb5')][_0xf6fa('0xd0')]({'id':0x0,'priority':0x1,'app':_0xf6fa('0xd1'),'appdata':_0x584c6c[_0xf6fa('0x2f')]+','+(_0xbc37c8[_0xf6fa('0xb3')][_0xf6fa('0xd2')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf6fa('0xd3'),'startRouting',_0xbc37c8);})['then'](function(_0x2d901a){respondWithRpcPromise(_0xf6fa('0xd4'),_0xf6fa('0xd4'),{'event':'notify','message':_0x2d901a},client9002);return _0x2d901a;})['then'](respondWithResult(_0x2c1f70,null))[_0xf6fa('0x20')](APIHandleError(_0x2c1f70));};exports[_0xf6fa('0xd5')]=function(_0x2aef5d,_0x5224b4){var _0x2aa40d,_0xfa92b3,_0x4df00c;var _0xb22606=[];var _0x452b81={};var _0x5cfd6b=_0x2aef5d[_0xf6fa('0xd6')]||[];var _0x514321=[];var _0x43a578;return db[_0xf6fa('0x9f')]['describe']()[_0xf6fa('0x29')](function(_0x2ee2a3){if(!_0x2ee2a3){throw new db[(_0xf6fa('0xa0'))][(_0xf6fa('0xa6'))]('no\x20available\x20attributes');}_0xb22606=_[_0xf6fa('0xa1')](_[_0xf6fa('0x58')](_0x2ee2a3),[_0xf6fa('0xa2'),_0xf6fa('0xa3'),'CompanyId','ListId']);if(_0x2aef5d[_0xf6fa('0x75')]['id']){delete _0x2aef5d[_0xf6fa('0x75')]['id'];}if(_[_0xf6fa('0x93')](_0x2aef5d[_0xf6fa('0x75')][_0xf6fa('0xa5')])){throw _0x5224b4[_0xf6fa('0x21')](0x1f4)[_0xf6fa('0xd7')](new db['Sequelize'][(_0xf6fa('0xa6'))](_0xf6fa('0xd8')));}if(_[_0xf6fa('0x93')](_0x2aef5d[_0xf6fa('0x75')]['body'])||_0x2aef5d['body'][_0xf6fa('0x75')]===''){throw _0x5224b4['status'](0x1f4)['send'](new db['Sequelize'][(_0xf6fa('0xa6'))](_0xf6fa('0xa7')));}if(_[_0xf6fa('0x93')](_0x2aef5d[_0xf6fa('0x75')][_0xf6fa('0xd9')])){throw _0x5224b4[_0xf6fa('0x21')](0x1f4)[_0xf6fa('0xd7')](new db[(_0xf6fa('0xa0'))][(_0xf6fa('0xa6'))](_0xf6fa('0xda')+_0xb22606));}if(!_[_0xf6fa('0xaa')](_0xb22606,_0x2aef5d[_0xf6fa('0x75')][_0xf6fa('0xd9')])){throw _0x5224b4['status'](0x1f4)[_0xf6fa('0xd7')](new db[(_0xf6fa('0xa0'))]['ValidationError'](_0xf6fa('0xdb')+_0xb22606));}_0x452b81[_0x2aef5d['body'][_0xf6fa('0xd9')]]=_0x2aef5d['body'][_0xf6fa('0xa5')];})[_0xf6fa('0x29')](function(){return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x2aef5d[_0xf6fa('0x76')]['id']},'include':[{'model':db['CmList'],'as':_0xf6fa('0xad')},{'model':db[_0xf6fa('0xdc')],'as':_0xf6fa('0xdc')}]});})[_0xf6fa('0x29')](handleEntityNotFound(_0x5224b4,null))[_0xf6fa('0x29')](function(_0x2564fa){if(_0x2564fa&&_0x2564fa[_0xf6fa('0xad')]){_0xfa92b3=_0x2564fa;var _0x5b2722=_[_0xf6fa('0x12')](_0x2aef5d[_0xf6fa('0x75')],{'firstName':_0x2aef5d[_0xf6fa('0x75')]['from'],'phone':_0x2aef5d[_0xf6fa('0x75')]['from'],'ListId':_0x2564fa['ListId']});_0x5b2722[_0x2aef5d[_0xf6fa('0x75')][_0xf6fa('0xd9')]]=_0x2aef5d[_0xf6fa('0x75')]['from'];return db[_0xf6fa('0x9f')][_0xf6fa('0xdd')]({'where':_0x452b81,'defaults':_0x5b2722});}})[_0xf6fa('0xb2')](function(_0x2e95f8){if(_0x2e95f8){_0x4df00c=_0x2e95f8;var _0xc5cbf0=fs[_0xf6fa('0xde')](path[_0xf6fa('0x8f')](config['root'],_0xf6fa('0xdf')),_0xf6fa('0xe0'));var _0x1ae0e7=ejs[_0xf6fa('0xe1')](_0xc5cbf0,{'body':_[_0xf6fa('0xe2')](_0x2aef5d[_0xf6fa('0x75')]['body']),'bodyTitle':_0xfa92b3[_0xf6fa('0xe3')]});return db[_0xf6fa('0xe4')][_0xf6fa('0x6c')]({'body':_0x1ae0e7,'plainBody':htmlToText[_0xf6fa('0xe5')](_0x1ae0e7),'ContactId':_0x2e95f8['id'],'ChatWebsiteId':_0xfa92b3['id']});}})[_0xf6fa('0x29')](function(_0x336568){_0x43a578=_0x336568;if(_0x5cfd6b['length']){var _0x1130a=_0x5cfd6b[_0xf6fa('0x3c')](function(_0x268c9b){return{'name':_0x268c9b[_0xf6fa('0xe6')],'basename':_0x268c9b[_0xf6fa('0x86')],'type':_0x268c9b[_0xf6fa('0xe7')],'ChatOfflineMessageId':_0x336568['id']};});_0x514321=_0x1130a[_0xf6fa('0x3c')](_0x1a3c35=>{var _0x206a3d={'filename':_0x1a3c35[_0xf6fa('0x2f')],'path':path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],'server','files','attachments','offline-chat',_0x1a3c35[_0xf6fa('0xe8')])};return _0x206a3d;});if(!_0xfa92b3[_0xf6fa('0xe9')]){return db[_0xf6fa('0xea')]['transaction'](function(_0x5332e7){return db[_0xf6fa('0xeb')]['bulkCreate'](_0x1130a,{'transaction':_0x5332e7});});}}})[_0xf6fa('0x29')](function(){if(_0x43a578){_0x2aa40d=_0x43a578;return db[_0xf6fa('0xdc')][_0xf6fa('0x82')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xf6fa('0xec')],'as':_0xf6fa('0xec'),'raw':!![]}]}]});}})['then'](function(_0x23e822){if(_0x23e822&&_0x23e822[_0xf6fa('0xed')]&&_0xfa92b3['forwardOffline']&&_0xfa92b3[_0xf6fa('0xee')]){var _0x38631b=_0x23e822['getSmtpOptions']();return respondWithRpcPromise(_0xf6fa('0xef'),_0xf6fa('0xf0'),{'account':_0x38631b,'message':{'from':util[_0xf6fa('0x33')]('\x22%s\x22\x20<%s>',_0x23e822[_0xf6fa('0x2f')],_0x23e822[_0xf6fa('0xf1')]||_0x23e822[_0xf6fa('0xed')][_0xf6fa('0x6d')]),'to':_0xfa92b3[_0xf6fa('0xee')],'subject':_0xfa92b3[_0xf6fa('0xf2')],'html':_0x2aa40d[_0xf6fa('0x75')],'attachments':_0x514321}},client9003)[_0xf6fa('0x29')](function(){return _0x2aa40d;})[_0xf6fa('0x20')](function(_0x3b5cd6){logger[_0xf6fa('0x1d')](_0x3b5cd6);});}})[_0xf6fa('0x29')](function(){if(_0xfa92b3&&_0xfa92b3[_0xf6fa('0xe9')]&&_0xfa92b3[_0xf6fa('0xf3')]){var _0x609d75=[];if(_0x5cfd6b[_0xf6fa('0x5e')]){_0x609d75=_0x5cfd6b[_0xf6fa('0x3c')](function(_0x2f054f){return{'name':_0x2f054f[_0xf6fa('0xe6')],'basename':_0x2f054f[_0xf6fa('0x86')],'type':_0x2f054f[_0xf6fa('0xe7')],'ChatOfflineMessageId':_0x43a578['id']};});}var _0x382fb4;if(!_[_0xf6fa('0x93')](_0xfa92b3[_0xf6fa('0xf4')])){var _0x2fb21d=_[_0xf6fa('0x3c')](_0x2aef5d[_0xf6fa('0x75')],function(_0x2c3dbd){return _0x2c3dbd;});var _0x247708=_[_0xf6fa('0xf5')](_0x2fb21d)[0x0];var _0x3f05f4=_['mapValues'](_0x247708,function(_0x2a3ac8){return _0x2a3ac8;});_0x382fb4=_0x3f05f4[0x1][_0xfa92b3[_0xf6fa('0xf4')]];}var _0x581409={'from':_0x4df00c[_0xf6fa('0xf1')],'firstName':_0x4df00c[_0xf6fa('0x47')],'lastName':_0x4df00c['lastName'],'mapKey':_0xf6fa('0xf1'),'message':{'from':_0x4df00c[_0xf6fa('0xf1')],'to':_0xfa92b3['MailAccount'][_0xf6fa('0xf1')],'cc':'','subject':_['isNil'](_0x382fb4)?_0xfa92b3[_0xf6fa('0xf2')]:_0x382fb4,'messageId':'','sentAt':new Date(),'attach':_0x609d75[_0xf6fa('0x5e')],'attachments':_0x609d75,'originChannel':_0xf6fa('0xf6'),'ChatWebsiteId':_0xfa92b3['id'],'ChatOfflineMessageId':_0x2aa40d['id'],'originTo':_0xfa92b3[_0xf6fa('0xdc')][_0xf6fa('0xf1')]},'body':_0x2aa40d[_0xf6fa('0x75')]};var _0x48fe91={'account':{'id':_0xfa92b3[_0xf6fa('0xf3')]},'body':_0x581409,'log':_0xf6fa('0xf7')};return respondWithRpcPromise(_0xf6fa('0xf7'),_0xf6fa('0xf8'),_0x48fe91,client9001)[_0xf6fa('0x29')](function(){return _0x2aa40d;})[_0xf6fa('0x20')](function(_0x3df2f3){logger[_0xf6fa('0x1d')](_0x3df2f3);});}return;})[_0xf6fa('0x29')](function(){if(_0x2aa40d){return _0x2aa40d;}})[_0xf6fa('0x29')](respondWithResult(_0x5224b4,null))[_0xf6fa('0x20')](function(){for(var _0x4c5e50 of _0x5cfd6b){var _0x43e95d=path['join'](config['root'],_0xf6fa('0xf9'),'files','attachments','offline-chat',_0x4c5e50[_0xf6fa('0x86')]);fs_extra['remove'](_0x43e95d)[_0xf6fa('0x20')](function(_0x8d2dd9){logger[_0xf6fa('0x1d')]('Could\x20not\x20remove\x20attachment\x20file',_0x43e95d,_0x8d2dd9);});}});};exports[_0xf6fa('0xfa')]=function(_0x439dbc,_0x4522ee){return db[_0xf6fa('0xbf')][_0xf6fa('0x71')]({'where':{'id':_0x439dbc[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x4522ee,null))[_0xf6fa('0x29')](function(_0x4e6b58){if(_0x4e6b58){return _0x4e6b58[_0xf6fa('0xfa')](_0x439dbc['body'][_0xf6fa('0x7e')],_[_0xf6fa('0xfb')](_0x439dbc['body'],[_0xf6fa('0x7e'),'id'])||{});}})[_0xf6fa('0x29')](respondWithResult(_0x4522ee,null))[_0xf6fa('0x20')](handleError(_0x4522ee,null));};exports[_0xf6fa('0xfc')]=function(_0x3649d1,_0x304a04){var _0x5f13fa={'raw':![],'where':{}};var _0x414a56={};var _0x21c638={'count':0x0,'rows':[]};return db[_0xf6fa('0x54')][_0xf6fa('0x82')]({'where':{'id':_0x3649d1[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x304a04,null))['then'](function(_0x5424b9){if(_0x5424b9){_0x414a56[_0xf6fa('0x5a')]=_[_0xf6fa('0x58')](db[_0xf6fa('0xbf')][_0xf6fa('0x55')]);_0x414a56[_0xf6fa('0x57')]=_[_0xf6fa('0x58')](_0x3649d1[_0xf6fa('0x57')]);_0x414a56[_0xf6fa('0x59')]=_[_0xf6fa('0x5b')](_0x414a56['model'],_0x414a56[_0xf6fa('0x57')]);_0x5f13fa[_0xf6fa('0x5d')]=_[_0xf6fa('0x5b')](_0x414a56[_0xf6fa('0x5a')],qs[_0xf6fa('0x5c')](_0x3649d1[_0xf6fa('0x57')]['fields']));_0x5f13fa[_0xf6fa('0x5d')]=_0x5f13fa[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0x5f13fa[_0xf6fa('0x5d')]:_0x414a56[_0xf6fa('0x5a')];if(!_0x3649d1['query'][_0xf6fa('0x5f')]('nolimit')){_0x5f13fa[_0xf6fa('0x26')]=qs['limit'](_0x3649d1[_0xf6fa('0x57')]['limit']);_0x5f13fa['offset']=qs[_0xf6fa('0x24')](_0x3649d1[_0xf6fa('0x57')][_0xf6fa('0x24')]);}_0x5f13fa[_0xf6fa('0x61')]=qs[_0xf6fa('0x62')](_0x3649d1[_0xf6fa('0x57')][_0xf6fa('0x62')]);_0x5f13fa['where']=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0x3649d1[_0xf6fa('0x57')],_0x414a56[_0xf6fa('0x59')]));_0x5f13fa[_0xf6fa('0x63')][_0xf6fa('0x79')]=_0x5424b9['id'];if(_0x3649d1[_0xf6fa('0x57')][_0xf6fa('0x65')]){_0x5f13fa[_0xf6fa('0x63')]=_[_0xf6fa('0x6b')](_0x5f13fa['where'],{'$or':_[_0xf6fa('0x3c')](_0x5f13fa[_0xf6fa('0x5d')],function(_0x584e47){var _0x3777c0={};_0x3777c0[_0x584e47]={'$like':'%'+_0x3649d1[_0xf6fa('0x57')]['filter']+'%'};return _0x3777c0;})});}_0x5f13fa=_[_0xf6fa('0x6b')]({},_0x5f13fa,_0x3649d1[_0xf6fa('0x66')]);return db[_0xf6fa('0xbf')][_0xf6fa('0x27')]({'where':_0x5f13fa[_0xf6fa('0x63')]})['then'](function(_0x38851f){_0x21c638[_0xf6fa('0x27')]=_0x38851f;if(_0x3649d1[_0xf6fa('0x57')][_0xf6fa('0x67')]){_0x5f13fa[_0xf6fa('0x68')]=[{'model':db['CmContact'],'as':_0xf6fa('0xfd'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0xf6fa('0xfe'),_0xf6fa('0xff')],'required':![]},{'model':db[_0xf6fa('0x100')],'as':_0xf6fa('0x101'),'attributes':['id',_0xf6fa('0x2f'),_0xf6fa('0x102')],'where':_0x3649d1[_0xf6fa('0x57')][_0xf6fa('0x103')]?{'id':_0x3649d1[_0xf6fa('0x57')]['tag']}:undefined,'required':_0x3649d1[_0xf6fa('0x57')]['tag']?!![]:![]}];}return db[_0xf6fa('0xbf')][_0xf6fa('0x7c')](_0x5f13fa);})[_0xf6fa('0x29')](function(_0x147a8a){_0x21c638['rows']=_0x147a8a;return _0x21c638;});}})[_0xf6fa('0x29')](respondWithFilteredResult(_0x304a04,_0x5f13fa))[_0xf6fa('0x20')](handleError(_0x304a04,null));};exports['getSnippet']=function(_0x58672b,_0x5c3ced){var _0x2157d9=0x0;var _0x54e7eb=0x0;var _0x3b6a35=![];var _0x13ffdf;var _0x4e3a15;return db[_0xf6fa('0x54')]['find']({'where':{'id':_0x58672b[_0xf6fa('0x76')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0xf6fa('0x3d')],'as':_0xf6fa('0x3e'),'attributes':['id',_0xf6fa('0x36')]}]}]})['then'](handleEntityNotFound(_0x5c3ced,null))['then'](function(_0x5efcb2){if(_0x5efcb2){_0x13ffdf=_0x5efcb2;return _0x5efcb2[_0xf6fa('0x104')]({'raw':!![]});}})[_0xf6fa('0x29')](function(_0x4513b9){if(_0x13ffdf){if(_0x4513b9){_0x4e3a15=_0x4513b9;}}return require('../../config/license/util')[_0xf6fa('0x105')]();})[_0xf6fa('0x29')](function(_0x62fa41){if(_0x62fa41){_0x54e7eb=_0x62fa41[_0xf6fa('0x106')];_0x3b6a35=_0x62fa41[_0xf6fa('0x107')];}})[_0xf6fa('0x29')](function(){return db['ChatInteraction'][_0xf6fa('0x27')]({'where':{'closed':![]}});})[_0xf6fa('0x29')](function(_0x570021){_0x2157d9=_0x570021;if(_0x54e7eb&&_0x570021>_0x54e7eb){return db[_0xf6fa('0x108')][_0xf6fa('0x82')]({'where':{'id':0x1}})[_0xf6fa('0x29')](function(_0x415573){if(_0x415573){_0x415573[_0xf6fa('0x109')](_0xf6fa('0x10a'));}});}})[_0xf6fa('0x29')](function(){if(!_0x13ffdf['Interval']||!_0x13ffdf[_0xf6fa('0x3d')][_0xf6fa('0x3e')])return!![];return checkWebsiteIntervals(_0x13ffdf);})['then'](function(_0xe38587){var _0x25c351=fs[_0xf6fa('0xde')](path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],_0xf6fa('0x10b')),_0xf6fa('0xe0'));var _0x251af8=new url[(_0xf6fa('0x10c'))](_0x13ffdf[_0xf6fa('0x10d')])['origin'];var _0x2e9133='3.5.0';var _0x2d7257=![];var _0xc54a68={'chatVersion':_0x2e9133,'chatWebsiteAddressOrigin':_0x251af8,'remote':_0x13ffdf[_0xf6fa('0x10e')],'query':querystring['stringify'](_['merge'](_0x13ffdf[_0xf6fa('0x3f')]({'plain':!![]}),{'customerIp':_0x58672b[_0xf6fa('0xba')][_0xf6fa('0x44')]||_0x58672b[_0xf6fa('0xba')][_0xf6fa('0x10f')]||_0x58672b[_0xf6fa('0x110')][_0xf6fa('0x111')]||_0x58672b['ip'],'referer':_0x58672b['headers'][_0xf6fa('0x112')],'openedInteractions':_0x2157d9,'maxInteractions':_0x54e7eb,'virtual':_0x3b6a35[_0xf6fa('0x106')],'online':_0xe38587,'custom':_0x3b6a35}))['replace'](/'/g,'\x5c\x27')};_0x5c3ced[_0xf6fa('0xd7')](ejs[_0xf6fa('0xe1')](Mustache[_0xf6fa('0xe1')](_0x25c351,_0xc54a68),{'proactiveActions':_0x4e3a15,'alignment':_0x13ffdf[_0xf6fa('0x113')],'verticalAlignment':_0x13ffdf[_0xf6fa('0x114')],'div_color':_0x13ffdf[_0xf6fa('0x102')],'labelText':_0x13ffdf[_0xf6fa('0x115')],'text_color':_0x13ffdf['textColor'],'text_button_color':_0x13ffdf[_0xf6fa('0x116')],'button_color':_0x13ffdf[_0xf6fa('0x117')],'background_color':_0x13ffdf[_0xf6fa('0x118')],'hideWhenOffline':_0x13ffdf[_0xf6fa('0x119')],'intervalId':_0x13ffdf['IntervalId'],'isDevelopment':_0x2d7257,'chatVersion':_0x2e9133}));})[_0xf6fa('0x20')](handleError(_0x5c3ced,null));};exports[_0xf6fa('0x11a')]=function(_0x1c95bd,_0x1da0dd){var _0x3d3164=_0x1c95bd[_0xf6fa('0x76')]['id'];var _0xf670ce=_0x1c95bd['body'];var _0x5b9650=0xc8;var _0x3165c5=null;return db['sequelize'][_0xf6fa('0x11b')]({'isolationLevel':db[_0xf6fa('0xea')]['Transaction']['ISOLATION_LEVELS'][_0xf6fa('0x11c')]},function(_0x38e825){return db[_0xf6fa('0x54')][_0xf6fa('0x82')]({'where':{'id':_0x3d3164},'transaction':_0x38e825})[_0xf6fa('0x29')](function(_0x5793fc){if(_0x5793fc){return db[_0xf6fa('0xb0')]['destroy']({'where':{'ChatWebsiteId':_0x3d3164},'transaction':_0x38e825})[_0xf6fa('0x29')](function(){var _0x15678e=_[_0xf6fa('0x3c')](_0xf670ce,function(_0x3ddb28){_0x3ddb28[_0xf6fa('0x79')]=_0x3d3164;return _0x3ddb28;});return db['ChatApplication'][_0xf6fa('0x11d')](_0x15678e,{'transaction':_0x38e825});});}else{_0x5b9650=0x194;_0x3165c5=[];}});})[_0xf6fa('0x29')](function(){if(_0x5b9650!==0x194){return db[_0xf6fa('0xb0')][_0xf6fa('0x11e')]({'where':{'ChatWebsiteId':_0x3d3164},'order':_0xf6fa('0xb8')})[_0xf6fa('0x29')](function(_0xa6fc8e){_0x3165c5=_0xa6fc8e;});}})[_0xf6fa('0x20')](function(_0x34ea82){_0x5b9650=0x1f4;logger['error'](_0x34ea82['stack']);if(_0x34ea82[_0xf6fa('0x2f')]){delete _0x34ea82[_0xf6fa('0x2f')];}_0x3165c5=_0x34ea82;})[_0xf6fa('0x11f')](function(){if(_0x3165c5===null){_0x1da0dd[_0xf6fa('0x2d')](_0x5b9650);}else{if(_0x5b9650===0x1f4){_0x1da0dd[_0xf6fa('0x21')](_0x5b9650)[_0xf6fa('0xd7')](_0x3165c5);}else{_0x1da0dd['status'](_0x5b9650)['json'](_0x3165c5);}}});};exports['getApplications']=function(_0x41bac2,_0x49ae11){var _0x42ffbd={};var _0xed1cb5={};var _0x4f3da0;var _0x51243c;return db[_0xf6fa('0x54')]['findOne']({'where':{'id':_0x41bac2['params']['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x49ae11,null))[_0xf6fa('0x29')](function(_0xcf8bff){if(_0xcf8bff){_0x4f3da0=_0xcf8bff;_0xed1cb5[_0xf6fa('0x5a')]=_['keys'](db['ChatApplication'][_0xf6fa('0x55')]);_0xed1cb5[_0xf6fa('0x57')]=_['keys'](_0x41bac2[_0xf6fa('0x57')]);_0xed1cb5['filters']=_[_0xf6fa('0x5b')](_0xed1cb5[_0xf6fa('0x5a')],_0xed1cb5[_0xf6fa('0x57')]);_0x42ffbd[_0xf6fa('0x5d')]=_[_0xf6fa('0x5b')](_0xed1cb5[_0xf6fa('0x5a')],qs[_0xf6fa('0x5c')](_0x41bac2[_0xf6fa('0x57')][_0xf6fa('0x5c')]));_0x42ffbd['attributes']=_0x42ffbd[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0x42ffbd['attributes']:_0xed1cb5[_0xf6fa('0x5a')];_0x42ffbd[_0xf6fa('0x61')]=qs[_0xf6fa('0x62')](_0x41bac2['query'][_0xf6fa('0x62')]);_0x42ffbd[_0xf6fa('0x63')]=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0x41bac2[_0xf6fa('0x57')],_0xed1cb5[_0xf6fa('0x59')]));if(_0x41bac2[_0xf6fa('0x57')][_0xf6fa('0x65')]){_0x42ffbd[_0xf6fa('0x63')]=_[_0xf6fa('0x6b')](_0x42ffbd['where'],{'$or':_['map'](_0x42ffbd[_0xf6fa('0x5d')],function(_0x20c307){var _0x1dd4ad={};_0x1dd4ad[_0x20c307]={'$like':'%'+_0x41bac2[_0xf6fa('0x57')][_0xf6fa('0x65')]+'%'};return _0x1dd4ad;})});}_0x42ffbd=_['merge']({},_0x42ffbd,_0x41bac2[_0xf6fa('0x66')]);return _0x4f3da0[_0xf6fa('0x120')](_0x42ffbd);}})[_0xf6fa('0x29')](function(_0x28841d){if(_0x28841d){_0x51243c=_0x28841d[_0xf6fa('0x5e')];if(!_0x41bac2[_0xf6fa('0x57')][_0xf6fa('0x5f')](_0xf6fa('0x60'))){_0x42ffbd[_0xf6fa('0x26')]=qs['limit'](_0x41bac2[_0xf6fa('0x57')]['limit']);_0x42ffbd[_0xf6fa('0x24')]=qs['offset'](_0x41bac2[_0xf6fa('0x57')]['offset']);}return _0x4f3da0[_0xf6fa('0x120')](_0x42ffbd);}})[_0xf6fa('0x29')](function(_0x326519){if(_0x326519){return _0x326519?{'count':_0x51243c,'rows':_0x326519}:null;}})[_0xf6fa('0x29')](respondWithResult(_0x49ae11,null))[_0xf6fa('0x20')](handleError(_0x49ae11,null));};exports[_0xf6fa('0x121')]=function(_0x3954b4,_0x36274e){return db[_0xf6fa('0x122')]['find']({'where':{'id':_0x3954b4['params']['id']}})['then'](handleEntityNotFound(_0x36274e,null))[_0xf6fa('0x29')](function(_0x4072ae){if(_0x4072ae){return _0x4072ae[_0xf6fa('0x121')](_0x3954b4[_0xf6fa('0x75')][_0xf6fa('0x7e')],_[_0xf6fa('0xfb')](_0x3954b4['body'],[_0xf6fa('0x7e'),'id'])||{});}})[_0xf6fa('0x29')](respondWithResult(_0x36274e,null))[_0xf6fa('0x20')](handleError(_0x36274e,null));};exports[_0xf6fa('0x104')]=function(_0x2791e8,_0x56d874){var _0x3f4d0e={};var _0x22f68e={};var _0x40fe0e;var _0x128a26;return db[_0xf6fa('0x54')][_0xf6fa('0x82')]({'where':{'id':_0x2791e8[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x56d874,null))[_0xf6fa('0x29')](function(_0x45808f){if(_0x45808f){_0x40fe0e=_0x45808f;_0x22f68e[_0xf6fa('0x5a')]=_[_0xf6fa('0x58')](db[_0xf6fa('0x123')][_0xf6fa('0x55')]);_0x22f68e['query']=_['keys'](_0x2791e8['query']);_0x22f68e['filters']=_[_0xf6fa('0x5b')](_0x22f68e['model'],_0x22f68e['query']);_0x3f4d0e['attributes']=_[_0xf6fa('0x5b')](_0x22f68e[_0xf6fa('0x5a')],qs[_0xf6fa('0x5c')](_0x2791e8[_0xf6fa('0x57')][_0xf6fa('0x5c')]));_0x3f4d0e[_0xf6fa('0x5d')]=_0x3f4d0e['attributes']['length']?_0x3f4d0e['attributes']:_0x22f68e[_0xf6fa('0x5a')];_0x3f4d0e[_0xf6fa('0x61')]=qs[_0xf6fa('0x62')](_0x2791e8[_0xf6fa('0x57')][_0xf6fa('0x62')]);_0x3f4d0e[_0xf6fa('0x63')]=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0x2791e8[_0xf6fa('0x57')],_0x22f68e[_0xf6fa('0x59')]));if(_0x2791e8[_0xf6fa('0x57')]['filter']){_0x3f4d0e[_0xf6fa('0x63')]=_[_0xf6fa('0x6b')](_0x3f4d0e[_0xf6fa('0x63')],{'$or':_['map'](_0x3f4d0e[_0xf6fa('0x5d')],function(_0x288a47){var _0x1e29ff={};_0x1e29ff[_0x288a47]={'$like':'%'+_0x2791e8[_0xf6fa('0x57')][_0xf6fa('0x65')]+'%'};return _0x1e29ff;})});}_0x3f4d0e=_[_0xf6fa('0x6b')]({},_0x3f4d0e,_0x2791e8['options']);return _0x40fe0e['getProactiveActions'](_0x3f4d0e);}})[_0xf6fa('0x29')](function(_0x5406b4){if(_0x5406b4){_0x128a26=_0x5406b4[_0xf6fa('0x5e')];if(!_0x2791e8[_0xf6fa('0x57')]['hasOwnProperty'](_0xf6fa('0x60'))){_0x3f4d0e[_0xf6fa('0x26')]=qs['limit'](_0x2791e8['query'][_0xf6fa('0x26')]);_0x3f4d0e[_0xf6fa('0x24')]=qs[_0xf6fa('0x24')](_0x2791e8[_0xf6fa('0x57')][_0xf6fa('0x24')]);}return _0x40fe0e[_0xf6fa('0x104')](_0x3f4d0e);}})[_0xf6fa('0x29')](function(_0x4b4a9c){if(_0x4b4a9c){return _0x4b4a9c?{'count':_0x128a26,'rows':_0x4b4a9c}:null;}})['then'](respondWithResult(_0x56d874,null))['catch'](handleError(_0x56d874,null));};exports[_0xf6fa('0x124')]=function(_0x31d32f,_0x1c5912){var _0x286211=_0x31d32f['query'][_0xf6fa('0x125')]===_0xf6fa('0x126')?_0xf6fa('0x127'):_0xf6fa('0x128');return db['ChatWebsite']['find']({'attributes':['id',_0x286211],'where':{'id':_0x31d32f[_0xf6fa('0x76')]['id']}})['then'](handleEntityNotFound(_0x1c5912,null))['then'](function(_0x38d15d){if(_0x38d15d){var _0x142684=_0x38d15d[_0x286211];var _0x46952a=_0x142684&&_0x142684[_0xf6fa('0x129')]?_0x142684[_0xf6fa('0x129')]:[];_0x1c5912[_0xf6fa('0xd7')]({'fromKey':_[_0xf6fa('0x93')](_0x142684['fromKey'])?undefined:_0x142684[_0xf6fa('0x12a')],'count':_0x46952a[_0xf6fa('0x5e')],'rows':_0x46952a});}})[_0xf6fa('0x20')](handleError(_0x1c5912,null));};exports[_0xf6fa('0x12b')]=function(_0x559ea9,_0x298b12){var _0x2479f1={'raw':![],'where':{}};var _0x2c4660={};var _0x40bd18={'count':0x0,'rows':[]};return db[_0xf6fa('0x54')][_0xf6fa('0x82')]({'where':{'id':_0x559ea9['params']['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x298b12,null))[_0xf6fa('0x29')](function(_0x49ad42){if(_0x49ad42){_0x2c4660['model']=_[_0xf6fa('0x58')](db[_0xf6fa('0xe4')]['rawAttributes']);_0x2c4660['query']=_[_0xf6fa('0x58')](_0x559ea9[_0xf6fa('0x57')]);_0x2c4660[_0xf6fa('0x59')]=_[_0xf6fa('0x5b')](_0x2c4660[_0xf6fa('0x5a')],_0x2c4660['query']);_0x2479f1[_0xf6fa('0x5d')]=_[_0xf6fa('0x5b')](_0x2c4660['model'],qs['fields'](_0x559ea9['query']['fields']));_0x2479f1[_0xf6fa('0x5d')]=_0x2479f1[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0x2479f1[_0xf6fa('0x5d')]:_0x2c4660[_0xf6fa('0x5a')];if(!_0x559ea9[_0xf6fa('0x57')][_0xf6fa('0x5f')](_0xf6fa('0x60'))){_0x2479f1[_0xf6fa('0x26')]=qs[_0xf6fa('0x26')](_0x559ea9[_0xf6fa('0x57')][_0xf6fa('0x26')]);_0x2479f1[_0xf6fa('0x24')]=qs[_0xf6fa('0x24')](_0x559ea9[_0xf6fa('0x57')][_0xf6fa('0x24')]);}_0x2479f1[_0xf6fa('0x61')]=qs['sort'](_0x559ea9['query']['sort']);_0x2479f1[_0xf6fa('0x63')]=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0x559ea9['query'],_0x2c4660[_0xf6fa('0x59')]));_0x2479f1[_0xf6fa('0x63')][_0xf6fa('0x79')]=_0x49ad42['id'];if(_0x559ea9['query'][_0xf6fa('0x65')]){_0x2479f1['where']=_[_0xf6fa('0x6b')](_0x2479f1[_0xf6fa('0x63')],{'$or':_[_0xf6fa('0x3c')](_0x2479f1[_0xf6fa('0x5d')],function(_0x572f5a){var _0x151c95={};_0x151c95[_0x572f5a]={'$like':'%'+_0x559ea9[_0xf6fa('0x57')][_0xf6fa('0x65')]+'%'};return _0x151c95;})});}_0x2479f1=_[_0xf6fa('0x6b')]({},_0x2479f1,_0x559ea9[_0xf6fa('0x66')]);return db[_0xf6fa('0xe4')][_0xf6fa('0x27')]({'where':_0x2479f1[_0xf6fa('0x63')]})['then'](function(_0x5a814a){_0x40bd18[_0xf6fa('0x27')]=_0x5a814a;if(_0x559ea9[_0xf6fa('0x57')][_0xf6fa('0x67')]){_0x2479f1[_0xf6fa('0x68')]=[{'all':!![]}];}else{_0x2479f1['include']=[{'model':db['CmContact'],'as':_0xf6fa('0xfd'),'required':![]},{'model':db[_0xf6fa('0xeb')],'as':_0xf6fa('0x12c'),'required':![]}];}return db[_0xf6fa('0xe4')][_0xf6fa('0x7c')](_0x2479f1);})[_0xf6fa('0x29')](function(_0x269312){_0x40bd18[_0xf6fa('0x69')]=_0x269312;return _0x40bd18;});}})[_0xf6fa('0x29')](respondWithFilteredResult(_0x298b12,_0x2479f1))['catch'](handleError(_0x298b12,null));};exports['addAgents']=function(_0x221a9e,_0x27c7ba){return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x221a9e['params']['id']}})['then'](handleEntityNotFound(_0x27c7ba,null))['then'](function(_0x5e9be4){if(_0x5e9be4){return _0x5e9be4[_0xf6fa('0x12d')](_0x221a9e[_0xf6fa('0x75')][_0xf6fa('0x7e')],_[_0xf6fa('0xfb')](_0x221a9e[_0xf6fa('0x75')],[_0xf6fa('0x7e'),'id'])||{})[_0xf6fa('0xb2')](function(_0x155020){for(var _0x2ad125=0x0;_0x2ad125<_0x221a9e[_0xf6fa('0x75')][_0xf6fa('0x7e')][_0xf6fa('0x5e')];_0x2ad125+=0x1){socket[_0xf6fa('0x12e')]('userChatWebsite:save',{'UserId':Number(_0x221a9e['body'][_0xf6fa('0x7e')][_0x2ad125]),'ChatWebsiteId':Number(_0x221a9e[_0xf6fa('0x76')]['id'])});}return _0x155020;});}})[_0xf6fa('0x29')](respondWithResult(_0x27c7ba,null))[_0xf6fa('0x20')](handleError(_0x27c7ba,null));};exports[_0xf6fa('0x12f')]=function(_0xa2cd80,_0xbd9c73){return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0xa2cd80[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0xbd9c73,null))['then'](function(_0x552b6c){if(_0x552b6c){return _0x552b6c[_0xf6fa('0x12f')](_0xa2cd80[_0xf6fa('0x57')][_0xf6fa('0x7e')])['then'](function(){if(_[_0xf6fa('0x130')](_0xa2cd80['query'][_0xf6fa('0x7e')])){for(var _0x1288de=0x0;_0x1288de<_0xa2cd80['query'][_0xf6fa('0x7e')][_0xf6fa('0x5e')];_0x1288de+=0x1){socket[_0xf6fa('0x12e')]('userChatWebsite:remove',{'UserId':Number(_0xa2cd80[_0xf6fa('0x57')][_0xf6fa('0x7e')][_0x1288de]),'ChatWebsiteId':Number(_0xa2cd80[_0xf6fa('0x76')]['id'])});}}else{socket['emit'](_0xf6fa('0x131'),{'UserId':Number(_0xa2cd80['query'][_0xf6fa('0x7e')]),'ChatWebsiteId':Number(_0xa2cd80['params']['id'])});}});}})['then'](respondWithStatusCode(_0xbd9c73,null))['catch'](handleError(_0xbd9c73,null));};exports['getAgents']=function(_0xaff431,_0x39097b){var _0x4cc1d6={};var _0x12cb49={};var _0x55a7bd;var _0x3eab18;return db[_0xf6fa('0x54')][_0xf6fa('0x82')]({'where':{'id':_0xaff431[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x39097b,null))[_0xf6fa('0x29')](function(_0x149ffa){if(_0x149ffa){_0x55a7bd=_0x149ffa;_0x12cb49[_0xf6fa('0x5a')]=_[_0xf6fa('0x58')](db['User'][_0xf6fa('0x55')]);_0x12cb49[_0xf6fa('0x57')]=_['keys'](_0xaff431[_0xf6fa('0x57')]);_0x12cb49[_0xf6fa('0x59')]=_['intersection'](_0x12cb49['model'],_0x12cb49[_0xf6fa('0x57')]);_0x4cc1d6[_0xf6fa('0x5d')]=_[_0xf6fa('0x5b')](_0x12cb49['model'],qs[_0xf6fa('0x5c')](_0xaff431[_0xf6fa('0x57')][_0xf6fa('0x5c')]));_0x4cc1d6[_0xf6fa('0x5d')]=_0x4cc1d6[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0x4cc1d6[_0xf6fa('0x5d')]:_0x12cb49[_0xf6fa('0x5a')];_0x4cc1d6[_0xf6fa('0x61')]=qs['sort'](_0xaff431[_0xf6fa('0x57')][_0xf6fa('0x62')]);_0x4cc1d6[_0xf6fa('0x63')]=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0xaff431[_0xf6fa('0x57')],_0x12cb49[_0xf6fa('0x59')]));if(_0xaff431['query']['filter']){_0x4cc1d6['where']=_[_0xf6fa('0x6b')](_0x4cc1d6[_0xf6fa('0x63')],{'$or':_['map'](_0x4cc1d6[_0xf6fa('0x5d')],function(_0x55a5e3){var _0x1f4936={};_0x1f4936[_0x55a5e3]={'$like':'%'+_0xaff431[_0xf6fa('0x57')][_0xf6fa('0x65')]+'%'};return _0x1f4936;})});}_0x4cc1d6=_['merge']({},_0x4cc1d6,_0xaff431[_0xf6fa('0x66')]);return _0x55a7bd['getAgents'](_0x4cc1d6);}})['then'](function(_0x14fa2a){if(_0x14fa2a){_0x3eab18=_0x14fa2a[_0xf6fa('0x5e')];if(!_0xaff431[_0xf6fa('0x57')][_0xf6fa('0x5f')](_0xf6fa('0x60'))){_0x4cc1d6[_0xf6fa('0x26')]=qs[_0xf6fa('0x26')](_0xaff431['query']['limit']);_0x4cc1d6[_0xf6fa('0x24')]=qs[_0xf6fa('0x24')](_0xaff431[_0xf6fa('0x57')][_0xf6fa('0x24')]);}return _0x55a7bd[_0xf6fa('0x132')](_0x4cc1d6);}})[_0xf6fa('0x29')](function(_0x16a861){if(_0x16a861){return _0x16a861?{'count':_0x3eab18,'rows':_0x16a861}:null;}})[_0xf6fa('0x29')](respondWithResult(_0x39097b,null))[_0xf6fa('0x20')](handleError(_0x39097b,null));}; \ No newline at end of file +var _0xe500=['*,*,*,*','ChatMessage','UserId','User','unshift','forcedOwnership','queueId','ChatQueue','waitForTheAssignedQueue','Start','EventManager','notify','offline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','email','user','offlineMessageSubject','originalname','toPairsIn','mapValues','subjectOffline','NotifyMailAccount','notifyMail','files','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tags','color','tag','getProactiveActions','../../config/license/util','getLicense','virtual','increment','chatLicenseExceeded','readFileSync','URL','address','3.5.0','headers','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','Transaction','READ_COMMITTED','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','onlineForm','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','getAgents','mustache','util','path','ejs','fs-extra','querystring','ioredis','jayson/promise','../../config/logger','api','../../errors/api','handleError','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','ChatWebsite,\x20%s,\x20%s','result','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','update','ChatWebsites','UserProfileResource','destroy','sendStatus','stack','name','send','Command','getSnippet','timezone','iftime\x20%s,%s','interval','format','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','map','Intervals','get','all','user-agent-parser','user-agent','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','unknown','%s\x20%s','device','vendor','model','type','index','mandatoryDispositionPause','ChatWebsite','fieldName','key','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','addDisposition','ChatWebsiteId','Disposition','findOne','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','order','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','custom','isNil','download','getAvatar','existsSync','server/files/images/avatars/','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','ChatApplication','Interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','list','applications','orderBy','Applications','priority','asc','threadId','ChatInteraction','externalUrl','ContactId','interaction','firstName','contact','messageId','created','autoclose','push','close','unmanaged'];(function(_0x4c71df,_0xeec35b){var _0x21641b=function(_0x413f8d){while(--_0x413f8d){_0x4c71df['push'](_0x4c71df['shift']());}};_0x21641b(++_0xeec35b);}(_0xe500,0x67));var _0x0e50=function(_0x2b948f,_0x398e62){_0x2b948f=_0x2b948f-0x0;var _0x1237bc=_0xe500[_0x2b948f];return _0x1237bc;};'use strict';var Mustache=require(_0x0e50('0x0'));var util=require(_0x0e50('0x1'));var path=require(_0x0e50('0x2'));var ejs=require(_0x0e50('0x3'));var fs=require('fs');var fs_extra=require(_0x0e50('0x4'));var _=require('lodash');var querystring=require(_0x0e50('0x5'));var htmlToText=require('html-to-text');var Redis=require(_0x0e50('0x6'));var jayson=require(_0x0e50('0x7'));var url=require('url');var qs=require('../../components/parsers/qs');var logger=require(_0x0e50('0x8'))(_0x0e50('0x9'));var config=require('../../config/environment');var APIOutOfIntervalError=require(_0x0e50('0xa'))['APIOutOfIntervalError'];var APINotFoundError=require(_0x0e50('0xa'))['APINotFoundError'];var APIHandleError=require(_0x0e50('0xa'))[_0x0e50('0xb')];var db=require(_0x0e50('0xc'))['db'];config['redis']=_[_0x0e50('0xd')](config[_0x0e50('0xe')],{'host':_0x0e50('0xf'),'port':0x18eb});var socket=require(_0x0e50('0x10'))(new Redis(config[_0x0e50('0xe')]));require(_0x0e50('0x11'))[_0x0e50('0x12')](socket);var client=jayson[_0x0e50('0x13')][_0x0e50('0x14')]({'port':0x232c});var client9002=jayson[_0x0e50('0x13')][_0x0e50('0x14')]({'port':0x232a});var client9003=jayson[_0x0e50('0x13')][_0x0e50('0x14')]({'port':0x232b});var client9001=jayson[_0x0e50('0x13')][_0x0e50('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x4f0b62,_0x43e5bb,_0x14b55b,_0x426255){return new Promise(function(_0x171c83,_0x50af18){var _0x591103=_0x426255||client;return _0x591103[_0x0e50('0x15')](_0x4f0b62,_0x14b55b)[_0x0e50('0x16')](function(_0x1675f1){logger[_0x0e50('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x43e5bb,_0x0e50('0x18'));logger[_0x0e50('0x19')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x43e5bb,_0x0e50('0x18'),JSON[_0x0e50('0x1a')](_0x1675f1));if(_0x1675f1['error']){if(_0x1675f1[_0x0e50('0x1b')][_0x0e50('0x1c')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x43e5bb,_0x1675f1[_0x0e50('0x1b')][_0x0e50('0x1d')]);return _0x50af18(_0x1675f1[_0x0e50('0x1b')][_0x0e50('0x1d')]);}logger['error'](_0x0e50('0x1e'),_0x43e5bb,_0x1675f1[_0x0e50('0x1b')][_0x0e50('0x1d')]);return _0x171c83(_0x1675f1[_0x0e50('0x1b')][_0x0e50('0x1d')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x43e5bb,_0x0e50('0x18'));_0x171c83(_0x1675f1[_0x0e50('0x1f')][_0x0e50('0x1d')]);}})[_0x0e50('0x20')](function(_0x292b39){logger[_0x0e50('0x1b')](_0x0e50('0x1e'),_0x43e5bb,_0x292b39);_0x50af18(_0x292b39);});});}function respondWithStatusCode(_0x25c3b6,_0x149625){_0x149625=_0x149625||0xcc;return function(_0x55b78a){if(_0x55b78a){return _0x25c3b6['sendStatus'](_0x149625);}return _0x25c3b6[_0x0e50('0x21')](_0x149625)[_0x0e50('0x22')]();};}function respondWithResult(_0x53e907,_0x2cffa7){_0x2cffa7=_0x2cffa7||0xc8;return function(_0x8303d6){if(_0x8303d6){return _0x53e907[_0x0e50('0x21')](_0x2cffa7)[_0x0e50('0x23')](_0x8303d6);}};}function respondWithFilteredResult(_0x4f689d,_0x8446da){return function(_0xa64b8c){if(_0xa64b8c){var _0x184725=typeof _0x8446da['offset']===_0x0e50('0x24')&&typeof _0x8446da['limit']===_0x0e50('0x24');var _0x313c53=_0xa64b8c[_0x0e50('0x25')];var _0x53e11f=_0x184725?0x0:_0x8446da[_0x0e50('0x26')];var _0x381995=_0x184725?_0xa64b8c[_0x0e50('0x25')]:_0x8446da[_0x0e50('0x26')]+_0x8446da[_0x0e50('0x27')];var _0x46c469;if(_0x381995>=_0x313c53){_0x381995=_0x313c53;_0x46c469=0xc8;}else{_0x46c469=0xce;}_0x4f689d[_0x0e50('0x21')](_0x46c469);return _0x4f689d[_0x0e50('0x28')](_0x0e50('0x29'),_0x53e11f+'-'+_0x381995+'/'+_0x313c53)[_0x0e50('0x23')](_0xa64b8c);}return null;};}function saveUpdates(_0x9a0fec){return function(_0x28492e){if(_0x28492e){return _0x28492e[_0x0e50('0x2a')](_0x9a0fec)[_0x0e50('0x16')](function(_0x261a42){return _0x261a42;});}return null;};}function removeEntity(_0x71bb88){return function(_0x4d0f47){if(_0x4d0f47){return _0x4d0f47['destroy']()['then'](function(){var _0x351aeb=_0x4d0f47['get']({'plain':!![]});var _0x33b10b=_0x0e50('0x2b');return db[_0x0e50('0x2c')][_0x0e50('0x2d')]({'where':{'type':_0x33b10b,'resourceId':_0x351aeb['id']}})[_0x0e50('0x16')](function(){return _0x4d0f47;});})['then'](function(){_0x71bb88['status'](0xcc)[_0x0e50('0x22')]();});}};}function handleEntityNotFound(_0x14705b){return function(_0x8425a3){if(!_0x8425a3){_0x14705b[_0x0e50('0x2e')](0x194);}return _0x8425a3;};}function handleError(_0x1664ba,_0x1368b0){_0x1368b0=_0x1368b0||0x1f4;return function(_0x4a875c){logger[_0x0e50('0x1b')](_0x4a875c[_0x0e50('0x2f')]);if(_0x4a875c['name']){delete _0x4a875c[_0x0e50('0x30')];}_0x1664ba[_0x0e50('0x21')](_0x1368b0)[_0x0e50('0x31')](_0x4a875c);};}function iftimePromise(_0x2df84c,_0x57efa2){return respondWithRpcPromise(_0x0e50('0x32'),_0x0e50('0x33'),{'command':_0x57efa2[_0x0e50('0x34')]?util['format'](_0x0e50('0x35'),_0x2df84c[_0x0e50('0x36')],_0x57efa2[_0x0e50('0x34')]):util[_0x0e50('0x37')](_0x0e50('0x38'),_0x2df84c['interval'])},client9002)['then'](function(_0x1c9b33){var _0x467d30=_0x1c9b33&&_0x1c9b33[_0x0e50('0x39')](_0x0e50('0x3a'))>=0x0?!![]:![];logger[_0x0e50('0x17')](_0x0e50('0x3b'),_0x57efa2['id'],_0x2df84c['id'],_0x2df84c[_0x0e50('0x36')],_0x467d30?_0x0e50('0x3c'):'OFFLINE',_0x57efa2[_0x0e50('0x34')]?_0x57efa2[_0x0e50('0x34')]:_0x0e50('0x3d'));return _0x467d30;})[_0x0e50('0x20')](function(_0x3405bd){logger[_0x0e50('0x1b')](_0x0e50('0x3b'),_0x57efa2['id'],_0x2df84c['id'],_0x2df84c[_0x0e50('0x36')],util['inspect'](_0x3405bd,{'showHidden':![],'depth':null}),_0x57efa2[_0x0e50('0x34')]?_0x57efa2['timezone']:_0x0e50('0x3d'));return![];});}function checkWebsiteIntervals(_0x4714fd){var _0x273607=_[_0x0e50('0x3e')](_0x4714fd['Interval'][_0x0e50('0x3f')],function(_0x5aa4a1){var _0x53d85a=_0x5aa4a1[_0x0e50('0x40')]({'plain':!![]});return iftimePromise(_0x53d85a,_0x4714fd);});return Promise[_0x0e50('0x41')](_0x273607)[_0x0e50('0x16')](function(_0x6a4e4e){return _['some'](_0x6a4e4e);});}function createInteractionObject(_0x2da5c6,_0x3b7634,_0x4fe926,_0x16b68f){var _0x280a5b=require(_0x0e50('0x42'));var _0x1b8253=new _0x280a5b();var _0x823a5=_0x1b8253['setUA'](_0x4fe926[_0x0e50('0x43')])['getResult']();var _0x29d514=_0x3b7634[_0x0e50('0x44')];if(_0x4fe926['cf-connecting-ip']){_0x29d514=_0x4fe926[_0x0e50('0x45')];}else if(_0x4fe926[_0x0e50('0x46')]){_0x29d514=_[_0x0e50('0x47')](_0x4fe926[_0x0e50('0x46')][_0x0e50('0x48')](','));}return{'ContactId':_0x16b68f['id'],'ChatWebsiteId':_0x2da5c6,'from':(_0x16b68f['firstName']||'')+'\x20'+(_0x16b68f[_0x0e50('0x49')]||''),'customerIp':_0x29d514,'customerPort':_0x4fe926[_0x0e50('0x4a')]?_0x4fe926['x-real-port']:null,'referer':_0x3b7634[_0x0e50('0x4b')],'browserName':_0x823a5[_0x0e50('0x4c')][_0x0e50('0x30')]&&_0x823a5[_0x0e50('0x4c')][_0x0e50('0x4d')]?util[_0x0e50('0x37')]('%s\x20%s',_0x823a5[_0x0e50('0x4c')][_0x0e50('0x30')],_0x823a5[_0x0e50('0x4c')]['version']):_0x0e50('0x4e'),'browserVersion':_0x823a5[_0x0e50('0x4c')][_0x0e50('0x4d')]||_0x0e50('0x4e'),'osName':util[_0x0e50('0x37')](_0x0e50('0x4f'),_0x823a5['os'][_0x0e50('0x30')],_0x823a5['os'][_0x0e50('0x4d')]),'osVersion':_0x823a5['os']['version'],'deviceModel':_0x823a5[_0x0e50('0x50')]['model']&&_0x823a5[_0x0e50('0x50')][_0x0e50('0x51')]?util[_0x0e50('0x37')]('%s\x20%s\x20%s',_0x823a5[_0x0e50('0x50')][_0x0e50('0x52')],_0x823a5[_0x0e50('0x50')]['vendor'],_0x823a5[_0x0e50('0x50')][_0x0e50('0x53')]):null,'deviceVendor':_0x823a5['device'][_0x0e50('0x51')],'deviceType':_0x823a5[_0x0e50('0x50')][_0x0e50('0x53')],'formData':JSON[_0x0e50('0x1a')](_0x3b7634)};}exports[_0x0e50('0x54')]=function(_0x445481,_0x3aecb0){var _0x4390d0={'include':[{'model':db['Pause'],'as':_0x0e50('0x55')}]},_0xc21306={},_0x4c7285={'count':0x0,'rows':[]};var _0x5c20e8=_[_0x0e50('0x3e')](db[_0x0e50('0x56')]['rawAttributes'],function(_0xa46fc1){return{'name':_0xa46fc1[_0x0e50('0x57')],'type':_0xa46fc1['type'][_0x0e50('0x58')]};});_0xc21306[_0x0e50('0x52')]=_[_0x0e50('0x3e')](_0x5c20e8,_0x0e50('0x30'));_0xc21306[_0x0e50('0x59')]=_[_0x0e50('0x5a')](_0x445481[_0x0e50('0x59')]);_0xc21306[_0x0e50('0x5b')]=_[_0x0e50('0x5c')](_0xc21306[_0x0e50('0x52')],_0xc21306[_0x0e50('0x59')]);_0x4390d0[_0x0e50('0x5d')]=_[_0x0e50('0x5c')](_0xc21306['model'],qs[_0x0e50('0x5e')](_0x445481[_0x0e50('0x59')][_0x0e50('0x5e')]));_0x4390d0[_0x0e50('0x5d')]=_0x4390d0[_0x0e50('0x5d')]['length']?_0x4390d0['attributes']:_0xc21306[_0x0e50('0x52')];if(!_0x445481[_0x0e50('0x59')][_0x0e50('0x5f')](_0x0e50('0x60'))){_0x4390d0['limit']=qs['limit'](_0x445481[_0x0e50('0x59')][_0x0e50('0x27')]);_0x4390d0[_0x0e50('0x26')]=qs['offset'](_0x445481[_0x0e50('0x59')][_0x0e50('0x26')]);}_0x4390d0['order']=qs[_0x0e50('0x61')](_0x445481['query'][_0x0e50('0x61')]);_0x4390d0[_0x0e50('0x62')]=qs[_0x0e50('0x5b')](_['pick'](_0x445481['query'],_0xc21306[_0x0e50('0x5b')]),_0x5c20e8);if(_0x445481[_0x0e50('0x59')]['filter']){_0x4390d0[_0x0e50('0x62')]=_[_0x0e50('0x63')](_0x4390d0[_0x0e50('0x62')],{'$or':_['map'](_0x5c20e8,function(_0xc31148){if(_0xc31148[_0x0e50('0x53')]!==_0x0e50('0x64')){var _0x4360a8={};_0x4360a8[_0xc31148[_0x0e50('0x30')]]={'$like':'%'+_0x445481[_0x0e50('0x59')][_0x0e50('0x65')]+'%'};return _0x4360a8;}})});}_0x4390d0=_[_0x0e50('0x63')]({},_0x4390d0,_0x445481[_0x0e50('0x66')]);var _0x5ad6c5={'where':_0x4390d0[_0x0e50('0x62')]};return db[_0x0e50('0x56')][_0x0e50('0x25')](_0x5ad6c5)[_0x0e50('0x16')](function(_0x5b8230){_0x4c7285[_0x0e50('0x25')]=_0x5b8230;if(_0x445481[_0x0e50('0x59')][_0x0e50('0x67')]){_0x4390d0[_0x0e50('0x68')]=[{'all':!![]}];}return db[_0x0e50('0x56')][_0x0e50('0x69')](_0x4390d0);})[_0x0e50('0x16')](function(_0x18e4e5){_0x4c7285['rows']=_0x18e4e5;return _0x4c7285;})[_0x0e50('0x16')](respondWithFilteredResult(_0x3aecb0,_0x4390d0))['catch'](handleError(_0x3aecb0,null));};exports[_0x0e50('0x6a')]=function(_0x3223fe,_0x55df5e){var _0x15ea5f={'raw':![],'where':{'id':_0x3223fe[_0x0e50('0x6b')]['id']},'include':[{'model':db['Pause'],'as':_0x0e50('0x55')}]},_0x35ad4b={};_0x35ad4b['model']=_[_0x0e50('0x5a')](db[_0x0e50('0x56')][_0x0e50('0x6c')]);_0x35ad4b['query']=_['keys'](_0x3223fe[_0x0e50('0x59')]);_0x35ad4b[_0x0e50('0x5b')]=_[_0x0e50('0x5c')](_0x35ad4b[_0x0e50('0x52')],_0x35ad4b[_0x0e50('0x59')]);_0x15ea5f[_0x0e50('0x5d')]=_[_0x0e50('0x5c')](_0x35ad4b['model'],qs[_0x0e50('0x5e')](_0x3223fe[_0x0e50('0x59')][_0x0e50('0x5e')]));_0x15ea5f['attributes']=_0x15ea5f[_0x0e50('0x5d')][_0x0e50('0x6d')]?_0x15ea5f[_0x0e50('0x5d')]:_0x35ad4b['model'];if(_0x3223fe['query'][_0x0e50('0x67')]){_0x15ea5f['include']=[{'all':!![]}];}_0x15ea5f=_['merge']({},_0x15ea5f,_0x3223fe[_0x0e50('0x66')]);return db['ChatWebsite'][_0x0e50('0x6e')](_0x15ea5f)[_0x0e50('0x16')](handleEntityNotFound(_0x55df5e,null))[_0x0e50('0x16')](respondWithResult(_0x55df5e,null))['catch'](handleError(_0x55df5e,null));};exports[_0x0e50('0x6f')]=function(_0x2ddce4,_0x5e36d2){return db[_0x0e50('0x56')][_0x0e50('0x6f')](_0x2ddce4['body'],{})[_0x0e50('0x16')](function(_0x3a8bad){var _0x18a76f=_0x2ddce4['user'][_0x0e50('0x40')]({'plain':!![]});if(!_0x18a76f)throw new Error(_0x0e50('0x70'));if(_0x18a76f[_0x0e50('0x71')]==='user'){var _0x29faa3=_0x3a8bad[_0x0e50('0x40')]({'plain':!![]});var _0x34a8c6=_0x0e50('0x2b');return db[_0x0e50('0x72')]['find']({'where':{'name':_0x34a8c6,'userProfileId':_0x18a76f['userProfileId']},'raw':!![]})['then'](function(_0xb34ecf){if(_0xb34ecf&&_0xb34ecf[_0x0e50('0x73')]===0x0){return db[_0x0e50('0x2c')][_0x0e50('0x6f')]({'name':_0x29faa3['name'],'resourceId':_0x29faa3['id'],'type':_0xb34ecf[_0x0e50('0x30')],'sectionId':_0xb34ecf['id']},{})['then'](function(){return _0x3a8bad;});}else{return _0x3a8bad;}})[_0x0e50('0x20')](function(_0x5b014f){logger[_0x0e50('0x1b')](_0x0e50('0x74'),_0x5b014f);throw _0x5b014f;});}return _0x3a8bad;})['then'](respondWithResult(_0x5e36d2,0xc9))[_0x0e50('0x20')](handleError(_0x5e36d2,null));};exports[_0x0e50('0x2a')]=function(_0x236b3f,_0x47ab72){if(_0x236b3f[_0x0e50('0x75')]['id']){delete _0x236b3f['body']['id'];}return db[_0x0e50('0x56')][_0x0e50('0x6e')]({'where':{'id':_0x236b3f[_0x0e50('0x6b')]['id']},'include':[{'model':db[_0x0e50('0x76')],'as':_0x0e50('0x55')}]})['then'](handleEntityNotFound(_0x47ab72,null))[_0x0e50('0x16')](saveUpdates(_0x236b3f['body'],null))[_0x0e50('0x16')](respondWithResult(_0x47ab72,null))[_0x0e50('0x20')](handleError(_0x47ab72,null));};exports[_0x0e50('0x2d')]=function(_0x37563b,_0x352539){return db[_0x0e50('0x56')]['find']({'where':{'id':_0x37563b[_0x0e50('0x6b')]['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0x352539,null))[_0x0e50('0x16')](removeEntity(_0x352539,null))[_0x0e50('0x20')](handleError(_0x352539,null));};exports['describe']=function(_0xf1d4f9,_0x2cd2d4){return db[_0x0e50('0x56')][_0x0e50('0x77')]()[_0x0e50('0x16')](respondWithResult(_0x2cd2d4,null))[_0x0e50('0x20')](handleError(_0x2cd2d4,null));};exports[_0x0e50('0x78')]=function(_0x1dd7a6,_0x1ffbc3){if(_0x1dd7a6['body']['id']){delete _0x1dd7a6['body']['id'];}return db['ChatWebsite'][_0x0e50('0x6e')]({'where':{'id':_0x1dd7a6['params']['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0x1ffbc3,null))[_0x0e50('0x16')](function(_0x443141){if(_0x443141){_0x1dd7a6[_0x0e50('0x75')][_0x0e50('0x79')]=_0x443141['id'];return db[_0x0e50('0x7a')][_0x0e50('0x6f')](_0x1dd7a6['body']);}})[_0x0e50('0x16')](respondWithResult(_0x1ffbc3,null))[_0x0e50('0x20')](handleError(_0x1ffbc3,null));};exports['getDispositions']=function(_0x4bf9b5,_0x2e6da2){var _0x2169f9={'raw':![],'where':{}};var _0x4b26dc={};var _0x51402c={'count':0x0,'rows':[]};return db[_0x0e50('0x56')][_0x0e50('0x7b')]({'where':{'id':_0x4bf9b5[_0x0e50('0x6b')]['id']}})['then'](handleEntityNotFound(_0x2e6da2,null))[_0x0e50('0x16')](function(_0x185208){if(_0x185208){_0x4b26dc[_0x0e50('0x52')]=_[_0x0e50('0x5a')](db[_0x0e50('0x7a')]['rawAttributes']);_0x4b26dc[_0x0e50('0x59')]=_[_0x0e50('0x5a')](_0x4bf9b5[_0x0e50('0x59')]);_0x4b26dc['filters']=_[_0x0e50('0x5c')](_0x4b26dc[_0x0e50('0x52')],_0x4b26dc[_0x0e50('0x59')]);_0x2169f9['attributes']=_[_0x0e50('0x5c')](_0x4b26dc[_0x0e50('0x52')],qs[_0x0e50('0x5e')](_0x4bf9b5['query'][_0x0e50('0x5e')]));_0x2169f9[_0x0e50('0x5d')]=_0x2169f9[_0x0e50('0x5d')][_0x0e50('0x6d')]?_0x2169f9[_0x0e50('0x5d')]:_0x4b26dc['model'];if(!_0x4bf9b5['query']['hasOwnProperty'](_0x0e50('0x60'))){_0x2169f9[_0x0e50('0x27')]=qs[_0x0e50('0x27')](_0x4bf9b5['query'][_0x0e50('0x27')]);_0x2169f9[_0x0e50('0x26')]=qs[_0x0e50('0x26')](_0x4bf9b5['query'][_0x0e50('0x26')]);}_0x2169f9['order']=qs['sort'](_0x4bf9b5[_0x0e50('0x59')][_0x0e50('0x61')]);_0x2169f9['where']=qs[_0x0e50('0x5b')](_[_0x0e50('0x7c')](_0x4bf9b5[_0x0e50('0x59')],_0x4b26dc['filters']));_0x2169f9[_0x0e50('0x62')][_0x0e50('0x79')]=_0x185208['id'];if(_0x4bf9b5[_0x0e50('0x59')][_0x0e50('0x65')]){_0x2169f9['where']=_['merge'](_0x2169f9[_0x0e50('0x62')],{'$or':_[_0x0e50('0x3e')](_0x2169f9[_0x0e50('0x5d')],function(_0x5a1ec1){var _0x55c3b3={};_0x55c3b3[_0x5a1ec1]={'$like':'%'+_0x4bf9b5['query'][_0x0e50('0x65')]+'%'};return _0x55c3b3;})});}_0x2169f9=_[_0x0e50('0x63')]({},_0x2169f9,_0x4bf9b5[_0x0e50('0x66')]);return db[_0x0e50('0x7a')][_0x0e50('0x25')]({'where':_0x2169f9[_0x0e50('0x62')]})[_0x0e50('0x16')](function(_0x10322a){_0x51402c['count']=_0x10322a;if(_0x4bf9b5['query'][_0x0e50('0x67')]){_0x2169f9[_0x0e50('0x68')]=[{'all':!![]}];}return db[_0x0e50('0x7a')][_0x0e50('0x69')](_0x2169f9);})['then'](function(_0x4f6d0d){_0x51402c[_0x0e50('0x7d')]=_0x4f6d0d;return _0x51402c;});}})[_0x0e50('0x16')](respondWithFilteredResult(_0x2e6da2,_0x2169f9))[_0x0e50('0x20')](handleError(_0x2e6da2,null));};exports[_0x0e50('0x7e')]=function(_0x2ed0cb,_0x55a61){return db['ChatWebsite']['find']({'where':{'id':_0x2ed0cb[_0x0e50('0x6b')]['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0x55a61,null))[_0x0e50('0x16')](function(_0x4a5626){if(_0x4a5626){return _0x4a5626[_0x0e50('0x7e')](_0x2ed0cb[_0x0e50('0x59')][_0x0e50('0x7f')]);}})[_0x0e50('0x16')](respondWithStatusCode(_0x55a61,null))[_0x0e50('0x20')](handleError(_0x55a61,null));};exports[_0x0e50('0x80')]=function(_0x1cffc2,_0x3c7532){if(_0x1cffc2['body']['id']){delete _0x1cffc2[_0x0e50('0x75')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x1cffc2['params']['id']}})['then'](handleEntityNotFound(_0x3c7532,null))[_0x0e50('0x16')](function(_0x52ef6d){if(_0x52ef6d){_0x1cffc2[_0x0e50('0x75')]['ChatWebsiteId']=_0x52ef6d['id'];return db[_0x0e50('0x81')]['create'](_0x1cffc2['body']);}})[_0x0e50('0x16')](respondWithResult(_0x3c7532,null))[_0x0e50('0x20')](handleError(_0x3c7532,null));};exports['getAnswers']=function(_0x4d5e4d,_0xf724cd){var _0x5b2dc2={'raw':![],'where':{}};var _0x2919ec={};var _0x61a522={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0e50('0x7b')]({'where':{'id':_0x4d5e4d[_0x0e50('0x6b')]['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0xf724cd,null))[_0x0e50('0x16')](function(_0x18fbf4){if(_0x18fbf4){_0x2919ec[_0x0e50('0x52')]=_[_0x0e50('0x5a')](db[_0x0e50('0x81')]['rawAttributes']);_0x2919ec[_0x0e50('0x59')]=_[_0x0e50('0x5a')](_0x4d5e4d[_0x0e50('0x59')]);_0x2919ec[_0x0e50('0x5b')]=_[_0x0e50('0x5c')](_0x2919ec['model'],_0x2919ec['query']);_0x5b2dc2[_0x0e50('0x5d')]=_[_0x0e50('0x5c')](_0x2919ec[_0x0e50('0x52')],qs[_0x0e50('0x5e')](_0x4d5e4d['query'][_0x0e50('0x5e')]));_0x5b2dc2[_0x0e50('0x5d')]=_0x5b2dc2['attributes'][_0x0e50('0x6d')]?_0x5b2dc2[_0x0e50('0x5d')]:_0x2919ec[_0x0e50('0x52')];if(!_0x4d5e4d[_0x0e50('0x59')]['hasOwnProperty'](_0x0e50('0x60'))){_0x5b2dc2['limit']=qs[_0x0e50('0x27')](_0x4d5e4d[_0x0e50('0x59')][_0x0e50('0x27')]);_0x5b2dc2[_0x0e50('0x26')]=qs[_0x0e50('0x26')](_0x4d5e4d[_0x0e50('0x59')][_0x0e50('0x26')]);}_0x5b2dc2[_0x0e50('0x82')]=qs[_0x0e50('0x61')](_0x4d5e4d[_0x0e50('0x59')]['sort']);_0x5b2dc2[_0x0e50('0x62')]=qs[_0x0e50('0x5b')](_['pick'](_0x4d5e4d[_0x0e50('0x59')],_0x2919ec[_0x0e50('0x5b')]));_0x5b2dc2[_0x0e50('0x62')][_0x0e50('0x79')]=_0x18fbf4['id'];if(_0x4d5e4d['query'][_0x0e50('0x65')]){_0x5b2dc2[_0x0e50('0x62')]=_[_0x0e50('0x63')](_0x5b2dc2[_0x0e50('0x62')],{'$or':_['map'](_0x5b2dc2[_0x0e50('0x5d')],function(_0x56ef69){var _0x3aa347={};_0x3aa347[_0x56ef69]={'$like':'%'+_0x4d5e4d[_0x0e50('0x59')][_0x0e50('0x65')]+'%'};return _0x3aa347;})});}_0x5b2dc2=_[_0x0e50('0x63')]({},_0x5b2dc2,_0x4d5e4d[_0x0e50('0x66')]);return db[_0x0e50('0x81')][_0x0e50('0x25')]({'where':_0x5b2dc2['where']})['then'](function(_0x43a6f3){_0x61a522[_0x0e50('0x25')]=_0x43a6f3;if(_0x4d5e4d[_0x0e50('0x59')]['includeAll']){_0x5b2dc2['include']=[{'all':!![]}];}return db[_0x0e50('0x81')][_0x0e50('0x69')](_0x5b2dc2);})['then'](function(_0x583d53){_0x61a522[_0x0e50('0x7d')]=_0x583d53;return _0x61a522;});}})[_0x0e50('0x16')](respondWithFilteredResult(_0xf724cd,_0x5b2dc2))[_0x0e50('0x20')](handleError(_0xf724cd,null));};exports[_0x0e50('0x83')]=function(_0x5cd937,_0x28d8e1){return db['ChatWebsite'][_0x0e50('0x6e')]({'where':{'id':_0x5cd937[_0x0e50('0x6b')]['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0x28d8e1,null))['then'](function(_0x15254f){if(_0x15254f){return _0x15254f['removeAnswers'](_0x5cd937['query'][_0x0e50('0x7f')]);}})[_0x0e50('0x16')](respondWithStatusCode(_0x28d8e1,null))['catch'](handleError(_0x28d8e1,null));};exports[_0x0e50('0x84')]=function(_0x4cf5a6,_0x1a63dc){_0x4cf5a6[_0x0e50('0x75')][_0x0e50('0x85')]=_0x4cf5a6[_0x0e50('0x86')][_0x0e50('0x87')];return db[_0x0e50('0x56')][_0x0e50('0x6e')]({'where':{'id':_0x4cf5a6[_0x0e50('0x6b')]['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0x1a63dc,null))[_0x0e50('0x16')](saveUpdates(_0x4cf5a6['body'],null))['then'](respondWithResult(_0x1a63dc,null))[_0x0e50('0x20')](handleError(_0x1a63dc,null));};exports['addAvatar']=function(_0xccbb81,_0xcbb3d2){_0xccbb81[_0x0e50('0x75')][_0x0e50('0x88')]=_0xccbb81['file'][_0x0e50('0x87')];return db[_0x0e50('0x56')][_0x0e50('0x6e')]({'where':{'id':_0xccbb81['params']['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0xcbb3d2,null))[_0x0e50('0x16')](saveUpdates(_0xccbb81[_0x0e50('0x75')],null))['then'](respondWithResult(_0xcbb3d2,null))[_0x0e50('0x20')](handleError(_0xcbb3d2,null));};exports[_0x0e50('0x89')]=function(_0x9a16e,_0x46a8a0){_0x9a16e[_0x0e50('0x75')][_0x0e50('0x8a')]=_0x9a16e[_0x0e50('0x86')][_0x0e50('0x87')];return db[_0x0e50('0x56')][_0x0e50('0x6e')]({'where':{'id':_0x9a16e[_0x0e50('0x6b')]['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0x46a8a0,null))['then'](saveUpdates(_0x9a16e[_0x0e50('0x75')],null))['then'](respondWithResult(_0x46a8a0,null))[_0x0e50('0x20')](handleError(_0x46a8a0,null));};exports[_0x0e50('0x8b')]=function(_0x173549,_0x5ad94f){_0x173549[_0x0e50('0x75')][_0x0e50('0x8c')]=_0x173549['file'][_0x0e50('0x87')];return db[_0x0e50('0x56')][_0x0e50('0x6e')]({'where':{'id':_0x173549['params']['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0x5ad94f,null))[_0x0e50('0x16')](saveUpdates(_0x173549[_0x0e50('0x75')],null))[_0x0e50('0x16')](respondWithResult(_0x5ad94f,null))[_0x0e50('0x20')](handleError(_0x5ad94f,null));};exports[_0x0e50('0x8d')]=function(_0x5a69c5,_0x50b90c){var _0xbfc175=path[_0x0e50('0x8e')](config[_0x0e50('0x8f')],'server/files/images/logos/default_logo.svg');var _0x43fac0={'where':{'id':_0x5a69c5['params']['id']},'attributes':['id',_0x0e50('0x85')],'raw':!![]};var _0x1110e6=![];return require('../../config/license/util')['getLicense']()[_0x0e50('0x16')](function(_0x3a6a43){if(_0x3a6a43){_0x1110e6=_0x3a6a43[_0x0e50('0x90')];}})[_0x0e50('0x16')](function(){return db[_0x0e50('0x56')][_0x0e50('0x6e')](_0x43fac0);})[_0x0e50('0x16')](handleEntityNotFound(_0x50b90c,null))[_0x0e50('0x16')](function(_0x3b5ca7){if(_0x3b5ca7){if(!_[_0x0e50('0x91')](_0x3b5ca7[_0x0e50('0x85')])){if(fs['existsSync'](path[_0x0e50('0x8e')](config[_0x0e50('0x8f')],'server/files/images/logos/',_0x3b5ca7[_0x0e50('0x85')]))&&_0x1110e6){_0xbfc175=path[_0x0e50('0x8e')](config['root'],'server/files/images/logos/',_0x3b5ca7[_0x0e50('0x85')]);}}return _0x50b90c[_0x0e50('0x92')](_0xbfc175);}})[_0x0e50('0x20')](handleError(_0x50b90c,null));};exports[_0x0e50('0x93')]=function(_0x3ce423,_0x3fc6f9){var _0x412ff0=path[_0x0e50('0x8e')](config[_0x0e50('0x8f')],'server/files/images/avatars/default_avatar.png');var _0x275135={'where':{'id':_0x3ce423[_0x0e50('0x6b')]['id']},'attributes':['id',_0x0e50('0x88')],'raw':!![]};return db[_0x0e50('0x56')][_0x0e50('0x6e')](_0x275135)['then'](handleEntityNotFound(_0x3fc6f9,null))[_0x0e50('0x16')](function(_0x571eb6){if(_0x571eb6){if(!_[_0x0e50('0x91')](_0x571eb6[_0x0e50('0x88')])){if(fs[_0x0e50('0x94')](path[_0x0e50('0x8e')](config['root'],'server/files/images/avatars/',_0x571eb6['agentAvatar']))){_0x412ff0=path[_0x0e50('0x8e')](config[_0x0e50('0x8f')],'server/files/images/avatars/',_0x571eb6[_0x0e50('0x88')]);}}return _0x3fc6f9[_0x0e50('0x92')](_0x412ff0);}})[_0x0e50('0x20')](handleError(_0x3fc6f9,null));};exports['getCustomerAvatar']=function(_0x3812cf,_0x16a669){var _0x247961=path[_0x0e50('0x8e')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x4e7fc7={'where':{'id':_0x3812cf[_0x0e50('0x6b')]['id']},'attributes':['id',_0x0e50('0x8a'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0x0e50('0x6e')](_0x4e7fc7)['then'](handleEntityNotFound(_0x16a669,null))[_0x0e50('0x16')](function(_0x764765){if(_0x764765){if(!_['isNil'](_0x764765[_0x0e50('0x8a')])){if(fs[_0x0e50('0x94')](path[_0x0e50('0x8e')](config['root'],_0x0e50('0x95'),_0x764765[_0x0e50('0x8a')]))&&_0x764765[_0x0e50('0x96')]){_0x247961=path['join'](config[_0x0e50('0x8f')],'server/files/images/avatars/',_0x764765[_0x0e50('0x8a')]);}}return _0x16a669[_0x0e50('0x92')](_0x247961);}})['catch'](handleError(_0x16a669,null));};exports[_0x0e50('0x97')]=function(_0x45c689,_0x1a2dff){var _0x10f5ec=path[_0x0e50('0x8e')](config[_0x0e50('0x8f')],_0x0e50('0x98'));var _0x154eb5={'where':{'id':_0x45c689[_0x0e50('0x6b')]['id']},'attributes':['id',_0x0e50('0x8c')],'raw':!![]};return db[_0x0e50('0x56')][_0x0e50('0x6e')](_0x154eb5)['then'](handleEntityNotFound(_0x1a2dff,null))[_0x0e50('0x16')](function(_0x28790f){if(_0x28790f){if(!_['isNil'](_0x28790f[_0x0e50('0x8c')])){if(fs[_0x0e50('0x94')](path['join'](config[_0x0e50('0x8f')],'server/files/images/avatars/',_0x28790f[_0x0e50('0x8c')]))){_0x10f5ec=path[_0x0e50('0x8e')](config[_0x0e50('0x8f')],_0x0e50('0x95'),_0x28790f[_0x0e50('0x8c')]);}}return _0x1a2dff[_0x0e50('0x92')](_0x10f5ec);}})[_0x0e50('0x20')](handleError(_0x1a2dff,null));};exports['notify']=function(_0x1ac593,_0x273f1b){var _0x53aca8={'body':_0x1ac593[_0x0e50('0x75')],'channel':_0x0e50('0x99')};var _0x26c732=[];var _0x54e445=[];var _0x727b7e={};var _0x516563=![];return db[_0x0e50('0x9a')]['describe']()['then'](function(_0x4ebcfa){if(!_0x4ebcfa){throw new db[(_0x0e50('0x9b'))]['ValidationError'](_0x0e50('0x9c'));}_0x26c732=_[_0x0e50('0x9d')](_[_0x0e50('0x5a')](_0x4ebcfa),['createdAt',_0x0e50('0x9e')]);_0x54e445=_[_0x0e50('0x9d')](_[_0x0e50('0x5a')](_0x4ebcfa),[_0x0e50('0x9f'),_0x0e50('0x9e'),'CompanyId',_0x0e50('0xa0')]);if(_0x1ac593[_0x0e50('0x75')]['id']){delete _0x1ac593[_0x0e50('0x75')]['id'];}if(_[_0x0e50('0x91')](_0x1ac593[_0x0e50('0x75')]['from'])){throw new db[(_0x0e50('0x9b'))]['ValidationError'](_0x0e50('0xa1'));}if(_[_0x0e50('0x91')](_0x1ac593[_0x0e50('0x75')][_0x0e50('0x75')])||_0x1ac593[_0x0e50('0x75')][_0x0e50('0x75')]===''){throw new db[(_0x0e50('0x9b'))]['ValidationError'](_0x0e50('0xa2'));}if(_[_0x0e50('0x91')](_0x1ac593[_0x0e50('0x75')][_0x0e50('0xa3')])){throw new db[(_0x0e50('0x9b'))][(_0x0e50('0xa4'))](_0x0e50('0xa5')+_0x54e445);}if(!_[_0x0e50('0xa6')](_0x54e445,_0x1ac593[_0x0e50('0x75')]['mapKey'])){throw new db[(_0x0e50('0x9b'))][(_0x0e50('0xa4'))](_0x0e50('0xa7')+_0x54e445);}_0x727b7e[_0x1ac593[_0x0e50('0x75')][_0x0e50('0xa3')]]=_0x1ac593[_0x0e50('0x75')][_0x0e50('0xa8')];})[_0x0e50('0x16')](function(){return db[_0x0e50('0x56')][_0x0e50('0x6e')]({'where':{'id':_0x1ac593[_0x0e50('0x6b')]['id']},'include':[{'model':db[_0x0e50('0xa9')],'as':_0x0e50('0xaa'),'include':[{'model':db[_0x0e50('0x9a')],'as':_0x0e50('0xab'),'where':_0x727b7e,'limit':0x1,'order':[[_0x0e50('0x9e'),_0x0e50('0xac')]]}]},{'model':db[_0x0e50('0xad')],'as':'Applications'},{'model':db[_0x0e50('0xae')],'as':_0x0e50('0xae'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x0e50('0x36')],'raw':!![]}]}]});})['then'](function(_0x5882bc){if(!_0x5882bc)throw new APINotFoundError(util[_0x0e50('0x37')](_0x0e50('0xaf'),_0x1ac593[_0x0e50('0x6b')]['id']));if(!_0x5882bc['Interval']||!_0x5882bc[_0x0e50('0xae')][_0x0e50('0x3f')])return[_0x5882bc,!![]];return[_0x5882bc,checkWebsiteIntervals(_0x5882bc)];})['spread'](function(_0x36731e,_0x15b237){if(!_0x15b237)throw new APIOutOfIntervalError();if(!_0x36731e[_0x0e50('0xaa')])return;_0x53aca8[_0x0e50('0xb0')]=_0x36731e;_0x53aca8[_0x0e50('0xb1')]=_0x36731e['List'];_0x53aca8[_0x0e50('0xb2')]=_[_0x0e50('0xb3')](_0x36731e[_0x0e50('0xb4')],[_0x0e50('0xb5')],[_0x0e50('0xb6')]);if(_0x53aca8['account'][_0x0e50('0xb4')]){delete _0x53aca8[_0x0e50('0xb0')]['Applications'];}if(_0x53aca8[_0x0e50('0xb0')][_0x0e50('0xaa')]&&_0x53aca8['account'][_0x0e50('0xaa')][_0x0e50('0xab')][_0x0e50('0x6d')]){return _0x53aca8[_0x0e50('0xb0')][_0x0e50('0xaa')][_0x0e50('0xab')][0x0];}var _0x3abe20=_[_0x0e50('0xd')](_0x1ac593['body'],{'firstName':_0x1ac593[_0x0e50('0x75')][_0x0e50('0xa8')],'ListId':_0x36731e['ListId']});_0x3abe20[_0x1ac593[_0x0e50('0x75')][_0x0e50('0xa3')]]=_0x1ac593[_0x0e50('0x75')][_0x0e50('0xa8')];return db[_0x0e50('0x9a')][_0x0e50('0x6f')](_0x3abe20,{'fields':_0x26c732,'raw':!![]});})[_0x0e50('0x16')](function(_0x10ff00){_0x53aca8['contact']=_0x10ff00;var _0x5d2e1f=createInteractionObject(_0x1ac593[_0x0e50('0x6b')]['id'],_0x1ac593[_0x0e50('0x75')],_0x1ac593['headers'],_0x10ff00);var _0x5484e4={'ChatWebsiteId':_0x1ac593[_0x0e50('0x6b')]['id'],'closed':![]};if(_0x1ac593['body'][_0x0e50('0xb7')]){_0x5484e4['threadId']=_0x1ac593[_0x0e50('0x75')][_0x0e50('0xb7')];return db[_0x0e50('0xb8')][_0x0e50('0x6e')]({'where':_0x5484e4})[_0x0e50('0x16')](function(_0x336afa){if(_0x336afa){_0x516563=!![];return _0x336afa;}_0x5d2e1f[_0x0e50('0xb7')]=_0x1ac593[_0x0e50('0x75')][_0x0e50('0xb7')];_0x5d2e1f[_0x0e50('0xb9')]=_0x1ac593[_0x0e50('0x75')][_0x0e50('0xb9')];return db['ChatInteraction'][_0x0e50('0x6f')](_0x5d2e1f);});}_0x5484e4[_0x0e50('0xba')]=_0x10ff00['id'];if(_0x1ac593[_0x0e50('0x75')][_0x0e50('0xbb')]&&_0x1ac593[_0x0e50('0x75')][_0x0e50('0xbb')]['id']){_0x5484e4['id']=_0x1ac593[_0x0e50('0x75')][_0x0e50('0xbb')]['id'];return db[_0x0e50('0xb8')][_0x0e50('0x6e')]({'where':_0x5484e4})['then'](function(_0x1b001e){if(_0x1b001e){_0x516563=!![];return _0x1b001e;}return db[_0x0e50('0xb8')][_0x0e50('0x6f')](_0x5d2e1f);});}return db[_0x0e50('0xb8')][_0x0e50('0x6f')](_0x5d2e1f);})[_0x0e50('0x16')](function(_0x5ef30a){if(!_0x516563)return _0x5ef30a;var _0x5bcc2e={'from':(_0x53aca8['contact'][_0x0e50('0xbc')]||'')+'\x20'+(_0x53aca8[_0x0e50('0xbd')][_0x0e50('0x49')]||'')};if(_0x1ac593[_0x0e50('0x75')][_0x0e50('0xb7')]&&_0x1ac593[_0x0e50('0x75')]['messageId']&&_0x1ac593[_0x0e50('0x75')][_0x0e50('0xb7')]!=_0x1ac593['body'][_0x0e50('0xbe')]){_0x5bcc2e[_0x0e50('0xb7')]=_0x1ac593['body'][_0x0e50('0xbe')];}return _0x5ef30a[_0x0e50('0x2a')](_0x5bcc2e);})['then'](function(_0x191371){_0x53aca8[_0x0e50('0xbb')]=_0x191371[_0x0e50('0x40')]({'plain':!![]});_0x53aca8[_0x0e50('0xbb')][_0x0e50('0xbf')]=!_0x516563;if(_0x53aca8['interaction']['created']){if(_0x53aca8[_0x0e50('0xb0')][_0x0e50('0xc0')]){_0x53aca8['applications'][_0x0e50('0xc1')]({'id':0x0,'priority':_0x53aca8['applications']['length']+0x1,'app':_0x0e50('0xc2'),'appdata':_0x0e50('0xc3'),'interval':_0x0e50('0xc4')});}}return db[_0x0e50('0xc5')][_0x0e50('0x6f')]({'body':_0x1ac593[_0x0e50('0x75')]['body'],'ChatWebsiteId':_0x1ac593[_0x0e50('0x6b')]['id'],'ChatInteractionId':_0x191371['id'],'direction':'in','ContactId':_0x53aca8['contact']['id'],'AttachmentId':_0x1ac593[_0x0e50('0x75')]['AttachmentId']});})[_0x0e50('0x16')](function(_0x744969){_0x53aca8['message']=_0x744969;if(!_0x53aca8['interaction'][_0x0e50('0xc6')]){return;}return db[_0x0e50('0xc7')][_0x0e50('0x6e')]({'attributes':['id',_0x0e50('0x30')],'where':{'id':_0x53aca8['interaction'][_0x0e50('0xc6')]}});})[_0x0e50('0x16')](function(_0x11bc47){if(_0x11bc47){_0x53aca8[_0x0e50('0xb2')][_0x0e50('0xc8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x11bc47[_0x0e50('0x30')]+','+(_0x53aca8[_0x0e50('0xb0')]['waitForTheAssignedAgent']||0xa),'interval':_0x0e50('0xc4')});_0x53aca8[_0x0e50('0xc9')]=!![];}if(!_0x53aca8[_0x0e50('0xbb')][_0x0e50('0xca')]){return;}return db[_0x0e50('0xcb')][_0x0e50('0x6e')]({'attributes':['id',_0x0e50('0x30')],'where':{'id':_0x53aca8['interaction'][_0x0e50('0xca')]}});})['then'](function(_0x9db627){if(_0x9db627){_0x53aca8['applications']['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x9db627['name']+','+(_0x53aca8['account'][_0x0e50('0xcc')]||0x12c),'interval':_0x0e50('0xc4')});}return respondWithRpcPromise(_0x0e50('0xcd'),'startRouting',_0x53aca8);})[_0x0e50('0x16')](function(_0x2e7228){respondWithRpcPromise(_0x0e50('0xce'),_0x0e50('0xce'),{'event':_0x0e50('0xcf'),'message':_0x2e7228},client9002);return _0x2e7228;})[_0x0e50('0x16')](respondWithResult(_0x273f1b,null))[_0x0e50('0x20')](APIHandleError(_0x273f1b));};exports[_0x0e50('0xd0')]=function(_0x3c9dfe,_0x7e68de){var _0x35e5a5,_0x27a049,_0x7bc239;var _0x1ca45b=[];var _0x32a602={};var _0x1f3330=_0x3c9dfe['files']||[];var _0x150d7c=[];var _0x563fe8;return db[_0x0e50('0x9a')][_0x0e50('0x77')]()[_0x0e50('0x16')](function(_0x129312){if(!_0x129312){throw new db[(_0x0e50('0x9b'))]['ValidationError'](_0x0e50('0x9c'));}_0x1ca45b=_['difference'](_[_0x0e50('0x5a')](_0x129312),[_0x0e50('0x9f'),'updatedAt','CompanyId',_0x0e50('0xa0')]);if(_0x3c9dfe['body']['id']){delete _0x3c9dfe[_0x0e50('0x75')]['id'];}if(_['isNil'](_0x3c9dfe[_0x0e50('0x75')]['from'])){throw _0x7e68de['status'](0x1f4)[_0x0e50('0x31')](new db[(_0x0e50('0x9b'))][(_0x0e50('0xa4'))](_0x0e50('0xa1')));}if(_['isNil'](_0x3c9dfe[_0x0e50('0x75')][_0x0e50('0x75')])||_0x3c9dfe['body'][_0x0e50('0x75')]===''){throw _0x7e68de[_0x0e50('0x21')](0x1f4)['send'](new db[(_0x0e50('0x9b'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x0e50('0x91')](_0x3c9dfe[_0x0e50('0x75')]['mapKeyOffline'])){throw _0x7e68de[_0x0e50('0x21')](0x1f4)[_0x0e50('0x31')](new db[(_0x0e50('0x9b'))]['ValidationError'](_0x0e50('0xd1')+_0x1ca45b));}if(!_[_0x0e50('0xa6')](_0x1ca45b,_0x3c9dfe[_0x0e50('0x75')]['mapKeyOffline'])){throw _0x7e68de[_0x0e50('0x21')](0x1f4)[_0x0e50('0x31')](new db[(_0x0e50('0x9b'))]['ValidationError'](_0x0e50('0xd2')+_0x1ca45b));}_0x32a602[_0x3c9dfe[_0x0e50('0x75')][_0x0e50('0xd3')]]=_0x3c9dfe[_0x0e50('0x75')][_0x0e50('0xa8')];})['then'](function(){return db['ChatWebsite'][_0x0e50('0x6e')]({'where':{'id':_0x3c9dfe['params']['id']},'include':[{'model':db[_0x0e50('0xa9')],'as':_0x0e50('0xaa')},{'model':db[_0x0e50('0xd4')],'as':_0x0e50('0xd4')}]});})[_0x0e50('0x16')](handleEntityNotFound(_0x7e68de,null))[_0x0e50('0x16')](function(_0x2347b4){if(_0x2347b4&&_0x2347b4[_0x0e50('0xaa')]){_0x27a049=_0x2347b4;var _0x372cb5=_[_0x0e50('0xd')](_0x3c9dfe[_0x0e50('0x75')],{'firstName':_0x3c9dfe[_0x0e50('0x75')][_0x0e50('0xa8')],'phone':_0x3c9dfe[_0x0e50('0x75')][_0x0e50('0xa8')],'ListId':_0x2347b4[_0x0e50('0xa0')]});_0x372cb5[_0x3c9dfe[_0x0e50('0x75')]['mapKeyOffline']]=_0x3c9dfe[_0x0e50('0x75')][_0x0e50('0xa8')];return db[_0x0e50('0x9a')][_0x0e50('0xd5')]({'where':_0x32a602,'defaults':_0x372cb5});}})[_0x0e50('0xd6')](function(_0x32e88b){if(_0x32e88b){_0x7bc239=_0x32e88b;var _0x39e24c=fs['readFileSync'](path[_0x0e50('0x8e')](config['root'],_0x0e50('0xd7')),_0x0e50('0xd8'));var _0x21f8f1=ejs['render'](_0x39e24c,{'body':_[_0x0e50('0xd9')](_0x3c9dfe['body'][_0x0e50('0x75')]),'bodyTitle':_0x27a049[_0x0e50('0xda')]});return db[_0x0e50('0xdb')][_0x0e50('0x6f')]({'body':_0x21f8f1,'plainBody':htmlToText[_0x0e50('0xdc')](_0x21f8f1),'ContactId':_0x32e88b['id'],'ChatWebsiteId':_0x27a049['id']});}})[_0x0e50('0x16')](function(_0x5edb3f){_0x563fe8=_0x5edb3f;if(_0x1f3330['length']){var _0x274c62=_0x1f3330[_0x0e50('0x3e')](function(_0xd3d8df){return{'name':_0xd3d8df['originalname'],'basename':_0xd3d8df[_0x0e50('0x87')],'type':_0xd3d8df[_0x0e50('0xdd')],'ChatOfflineMessageId':_0x5edb3f['id']};});_0x150d7c=_0x274c62[_0x0e50('0x3e')](_0x531b5=>{var _0x5bd3aa={'filename':_0x531b5[_0x0e50('0x30')],'path':path['join'](config[_0x0e50('0x8f')],_0x0e50('0xde'),'files',_0x0e50('0xdf'),_0x0e50('0xe0'),_0x531b5[_0x0e50('0xe1')])};return _0x5bd3aa;});if(!_0x27a049[_0x0e50('0xe2')]){return db[_0x0e50('0xe3')][_0x0e50('0xe4')](function(_0x24b1b8){return db[_0x0e50('0xe5')][_0x0e50('0xe6')](_0x274c62,{'transaction':_0x24b1b8});});}}})[_0x0e50('0x16')](function(){if(_0x563fe8){_0x35e5a5=_0x563fe8;return db[_0x0e50('0xd4')][_0x0e50('0x7b')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x0e50('0xe7'),'raw':!![],'include':[{'model':db[_0x0e50('0xe8')],'as':_0x0e50('0xe8'),'raw':!![]}]}]});}})[_0x0e50('0x16')](function(_0xdd1166){if(_0xdd1166&&_0xdd1166['Smtp']&&_0x27a049[_0x0e50('0xe9')]&&_0x27a049[_0x0e50('0xea')]){var _0x37ca00=_0xdd1166[_0x0e50('0xeb')]();return respondWithRpcPromise('SendMail',_0x0e50('0xec'),{'account':_0x37ca00,'message':{'from':util[_0x0e50('0x37')]('\x22%s\x22\x20<%s>',_0xdd1166[_0x0e50('0x30')],_0xdd1166[_0x0e50('0xed')]||_0xdd1166[_0x0e50('0xe7')][_0x0e50('0xee')]),'to':_0x27a049[_0x0e50('0xea')],'subject':_0x27a049[_0x0e50('0xef')],'html':_0x35e5a5['body'],'attachments':_0x150d7c}},client9003)[_0x0e50('0x16')](function(){return _0x35e5a5;})[_0x0e50('0x20')](function(_0x29ccc9){logger['error'](_0x29ccc9);});}})[_0x0e50('0x16')](function(){if(_0x27a049&&_0x27a049['openNewInteraction']&&_0x27a049['MailAccountId']){var _0x10953e=[];if(_0x1f3330[_0x0e50('0x6d')]){_0x10953e=_0x1f3330[_0x0e50('0x3e')](function(_0x3811a8){return{'name':_0x3811a8[_0x0e50('0xf0')],'basename':_0x3811a8[_0x0e50('0x87')],'type':_0x3811a8[_0x0e50('0xdd')],'ChatOfflineMessageId':_0x563fe8['id']};});}var _0x2f9b0f;if(!_[_0x0e50('0x91')](_0x27a049['subjectOffline'])){var _0x583c91=_[_0x0e50('0x3e')](_0x3c9dfe[_0x0e50('0x75')],function(_0x4986ff){return _0x4986ff;});var _0x4f8e3d=_[_0x0e50('0xf1')](_0x583c91)[0x0];var _0x54e590=_[_0x0e50('0xf2')](_0x4f8e3d,function(_0x573b67){return _0x573b67;});_0x2f9b0f=_0x54e590[0x1][_0x27a049[_0x0e50('0xf3')]];}var _0x2d7994={'from':_0x7bc239[_0x0e50('0xed')],'firstName':_0x7bc239['firstName'],'lastName':_0x7bc239[_0x0e50('0x49')],'mapKey':'email','message':{'from':_0x7bc239[_0x0e50('0xed')],'to':_0x27a049[_0x0e50('0xd4')][_0x0e50('0xed')],'cc':'','subject':_[_0x0e50('0x91')](_0x2f9b0f)?_0x27a049[_0x0e50('0xef')]:_0x2f9b0f,'messageId':'','sentAt':new Date(),'attach':_0x10953e[_0x0e50('0x6d')],'attachments':_0x10953e,'originChannel':'Chat','ChatWebsiteId':_0x27a049['id'],'ChatOfflineMessageId':_0x35e5a5['id'],'originTo':_0x27a049['MailAccount'][_0x0e50('0xed')]},'body':_0x35e5a5[_0x0e50('0x75')]};var _0x14866c={'account':{'id':_0x27a049['MailAccountId']},'body':_0x2d7994,'log':_0x0e50('0xf4')};return respondWithRpcPromise(_0x0e50('0xf4'),_0x0e50('0xf5'),_0x14866c,client9001)['then'](function(){return _0x35e5a5;})['catch'](function(_0x176b57){logger[_0x0e50('0x1b')](_0x176b57);});}return;})['then'](function(){if(_0x35e5a5){return _0x35e5a5;}})[_0x0e50('0x16')](respondWithResult(_0x7e68de,null))[_0x0e50('0x20')](function(){for(var _0x9e560b of _0x1f3330){var _0x52e960=path[_0x0e50('0x8e')](config['root'],_0x0e50('0xde'),_0x0e50('0xf6'),'attachments',_0x0e50('0xe0'),_0x9e560b[_0x0e50('0x87')]);fs_extra[_0x0e50('0xf7')](_0x52e960)[_0x0e50('0x20')](function(_0x59e59c){logger['error'](_0x0e50('0xf8'),_0x52e960,_0x59e59c);});}});};exports[_0x0e50('0xf9')]=function(_0xf63fa7,_0x22d1a7){return db[_0x0e50('0xb8')][_0x0e50('0x6e')]({'where':{'id':_0xf63fa7[_0x0e50('0x6b')]['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0x22d1a7,null))[_0x0e50('0x16')](function(_0x2197aa){if(_0x2197aa){return _0x2197aa['addInteraction'](_0xf63fa7['body'][_0x0e50('0x7f')],_[_0x0e50('0xfa')](_0xf63fa7[_0x0e50('0x75')],[_0x0e50('0x7f'),'id'])||{});}})[_0x0e50('0x16')](respondWithResult(_0x22d1a7,null))[_0x0e50('0x20')](handleError(_0x22d1a7,null));};exports[_0x0e50('0xfb')]=function(_0x212c47,_0x2102d4){var _0x2cb162={'raw':![],'where':{}};var _0x594ccf={};var _0x2e362f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0e50('0x7b')]({'where':{'id':_0x212c47[_0x0e50('0x6b')]['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0x2102d4,null))['then'](function(_0x4d2f66){if(_0x4d2f66){_0x594ccf['model']=_[_0x0e50('0x5a')](db[_0x0e50('0xb8')][_0x0e50('0x6c')]);_0x594ccf[_0x0e50('0x59')]=_['keys'](_0x212c47[_0x0e50('0x59')]);_0x594ccf[_0x0e50('0x5b')]=_['intersection'](_0x594ccf[_0x0e50('0x52')],_0x594ccf['query']);_0x2cb162[_0x0e50('0x5d')]=_[_0x0e50('0x5c')](_0x594ccf['model'],qs[_0x0e50('0x5e')](_0x212c47[_0x0e50('0x59')]['fields']));_0x2cb162[_0x0e50('0x5d')]=_0x2cb162[_0x0e50('0x5d')]['length']?_0x2cb162[_0x0e50('0x5d')]:_0x594ccf[_0x0e50('0x52')];if(!_0x212c47[_0x0e50('0x59')][_0x0e50('0x5f')](_0x0e50('0x60'))){_0x2cb162[_0x0e50('0x27')]=qs['limit'](_0x212c47[_0x0e50('0x59')]['limit']);_0x2cb162[_0x0e50('0x26')]=qs['offset'](_0x212c47[_0x0e50('0x59')][_0x0e50('0x26')]);}_0x2cb162[_0x0e50('0x82')]=qs['sort'](_0x212c47[_0x0e50('0x59')][_0x0e50('0x61')]);_0x2cb162['where']=qs[_0x0e50('0x5b')](_[_0x0e50('0x7c')](_0x212c47[_0x0e50('0x59')],_0x594ccf[_0x0e50('0x5b')]));_0x2cb162[_0x0e50('0x62')][_0x0e50('0x79')]=_0x4d2f66['id'];if(_0x212c47[_0x0e50('0x59')][_0x0e50('0x65')]){_0x2cb162[_0x0e50('0x62')]=_[_0x0e50('0x63')](_0x2cb162['where'],{'$or':_['map'](_0x2cb162[_0x0e50('0x5d')],function(_0x4b3d53){var _0x12e9b3={};_0x12e9b3[_0x4b3d53]={'$like':'%'+_0x212c47[_0x0e50('0x59')][_0x0e50('0x65')]+'%'};return _0x12e9b3;})});}_0x2cb162=_[_0x0e50('0x63')]({},_0x2cb162,_0x212c47[_0x0e50('0x66')]);return db[_0x0e50('0xb8')][_0x0e50('0x25')]({'where':_0x2cb162[_0x0e50('0x62')]})[_0x0e50('0x16')](function(_0x23581c){_0x2e362f[_0x0e50('0x25')]=_0x23581c;if(_0x212c47[_0x0e50('0x59')]['includeAll']){_0x2cb162[_0x0e50('0x68')]=[{'model':db[_0x0e50('0x9a')],'as':_0x0e50('0xfc'),'required':![]},{'model':db['User'],'as':_0x0e50('0xfd'),'attributes':[_0x0e50('0x30'),_0x0e50('0xfe'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x0e50('0xff'),'attributes':['id',_0x0e50('0x30'),_0x0e50('0x100')],'where':_0x212c47[_0x0e50('0x59')][_0x0e50('0x101')]?{'id':_0x212c47[_0x0e50('0x59')][_0x0e50('0x101')]}:undefined,'required':_0x212c47[_0x0e50('0x59')][_0x0e50('0x101')]?!![]:![]}];}return db[_0x0e50('0xb8')]['findAll'](_0x2cb162);})[_0x0e50('0x16')](function(_0x2e0623){_0x2e362f[_0x0e50('0x7d')]=_0x2e0623;return _0x2e362f;});}})[_0x0e50('0x16')](respondWithFilteredResult(_0x2102d4,_0x2cb162))[_0x0e50('0x20')](handleError(_0x2102d4,null));};exports[_0x0e50('0x33')]=function(_0x12ade8,_0x257a00){var _0x5eb7c2=0x0;var _0x5297fe=0x0;var _0x14c4dd=![];var _0x4531ea;var _0x55b864;return db[_0x0e50('0x56')]['find']({'where':{'id':_0x12ade8[_0x0e50('0x6b')]['id']},'include':[{'model':db['Interval'],'as':_0x0e50('0xae'),'include':[{'model':db[_0x0e50('0xae')],'as':'Intervals','attributes':['id',_0x0e50('0x36')]}]}]})['then'](handleEntityNotFound(_0x257a00,null))[_0x0e50('0x16')](function(_0x14adbe){if(_0x14adbe){_0x4531ea=_0x14adbe;return _0x14adbe[_0x0e50('0x102')]({'raw':!![]});}})[_0x0e50('0x16')](function(_0xd35621){if(_0x4531ea){if(_0xd35621){_0x55b864=_0xd35621;}}return require(_0x0e50('0x103'))[_0x0e50('0x104')]();})['then'](function(_0x3f8f14){if(_0x3f8f14){_0x5297fe=_0x3f8f14[_0x0e50('0x105')];_0x14c4dd=_0x3f8f14[_0x0e50('0x90')];}})[_0x0e50('0x16')](function(){return db[_0x0e50('0xb8')][_0x0e50('0x25')]({'where':{'closed':![]}});})[_0x0e50('0x16')](function(_0x1d2ba4){_0x5eb7c2=_0x1d2ba4;if(_0x5297fe&&_0x1d2ba4>_0x5297fe){return db['License'][_0x0e50('0x7b')]({'where':{'id':0x1}})['then'](function(_0x504bec){if(_0x504bec){_0x504bec[_0x0e50('0x106')](_0x0e50('0x107'));}});}})[_0x0e50('0x16')](function(){if(!_0x4531ea['Interval']||!_0x4531ea[_0x0e50('0xae')][_0x0e50('0x3f')])return!![];return checkWebsiteIntervals(_0x4531ea);})[_0x0e50('0x16')](function(_0x44632f){var _0x3a55c8=fs[_0x0e50('0x108')](path[_0x0e50('0x8e')](config[_0x0e50('0x8f')],'server/files/chat/iframe.ejs'),_0x0e50('0xd8'));var _0x1a0cf1=new url[(_0x0e50('0x109'))](_0x4531ea[_0x0e50('0x10a')])['origin'];var _0x9746da=_0x0e50('0x10b');var _0x19df40=![];var _0x26f944={'chatVersion':_0x9746da,'chatWebsiteAddressOrigin':_0x1a0cf1,'remote':_0x4531ea['remote'],'query':querystring[_0x0e50('0x1a')](_[_0x0e50('0x63')](_0x4531ea[_0x0e50('0x40')]({'plain':!![]}),{'customerIp':_0x12ade8[_0x0e50('0x10c')]['x-forwarded-for']||_0x12ade8[_0x0e50('0x10c')][_0x0e50('0x10d')]||_0x12ade8[_0x0e50('0x10e')][_0x0e50('0x10f')]||_0x12ade8['ip'],'referer':_0x12ade8[_0x0e50('0x10c')][_0x0e50('0x4b')],'openedInteractions':_0x5eb7c2,'maxInteractions':_0x5297fe,'virtual':_0x14c4dd['virtual'],'online':_0x44632f,'custom':_0x14c4dd}))[_0x0e50('0x110')](/'/g,'\x5c\x27')};_0x257a00['send'](ejs[_0x0e50('0x111')](Mustache[_0x0e50('0x111')](_0x3a55c8,_0x26f944),{'proactiveActions':_0x55b864,'alignment':_0x4531ea[_0x0e50('0x112')],'verticalAlignment':_0x4531ea[_0x0e50('0x113')],'div_color':_0x4531ea['color'],'labelText':_0x4531ea[_0x0e50('0x114')],'text_color':_0x4531ea[_0x0e50('0x115')],'text_button_color':_0x4531ea[_0x0e50('0x116')],'button_color':_0x4531ea[_0x0e50('0x117')],'background_color':_0x4531ea[_0x0e50('0x118')],'hideWhenOffline':_0x4531ea[_0x0e50('0x119')],'intervalId':_0x4531ea['IntervalId'],'isDevelopment':_0x19df40,'chatVersion':_0x9746da}));})[_0x0e50('0x20')](handleError(_0x257a00,null));};exports[_0x0e50('0x11a')]=function(_0x4e7492,_0x52aab2){var _0x154dac=_0x4e7492[_0x0e50('0x6b')]['id'];var _0x43ed14=_0x4e7492['body'];var _0x1b4901=0xc8;var _0x7bde53=null;return db[_0x0e50('0xe3')][_0x0e50('0xe4')]({'isolationLevel':db[_0x0e50('0xe3')][_0x0e50('0x11b')]['ISOLATION_LEVELS'][_0x0e50('0x11c')]},function(_0x3643e1){return db[_0x0e50('0x56')][_0x0e50('0x7b')]({'where':{'id':_0x154dac},'transaction':_0x3643e1})[_0x0e50('0x16')](function(_0x9ae760){if(_0x9ae760){return db[_0x0e50('0xad')][_0x0e50('0x2d')]({'where':{'ChatWebsiteId':_0x154dac},'transaction':_0x3643e1})[_0x0e50('0x16')](function(){var _0x241328=_['map'](_0x43ed14,function(_0x2c196c){_0x2c196c['ChatWebsiteId']=_0x154dac;return _0x2c196c;});return db['ChatApplication'][_0x0e50('0xe6')](_0x241328,{'transaction':_0x3643e1});});}else{_0x1b4901=0x194;_0x7bde53=[];}});})[_0x0e50('0x16')](function(){if(_0x1b4901!==0x194){return db[_0x0e50('0xad')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x154dac},'order':_0x0e50('0xb5')})[_0x0e50('0x16')](function(_0x568f9d){_0x7bde53=_0x568f9d;});}})[_0x0e50('0x20')](function(_0x1070f7){_0x1b4901=0x1f4;logger[_0x0e50('0x1b')](_0x1070f7[_0x0e50('0x2f')]);if(_0x1070f7['name']){delete _0x1070f7[_0x0e50('0x30')];}_0x7bde53=_0x1070f7;})['finally'](function(){if(_0x7bde53===null){_0x52aab2[_0x0e50('0x2e')](_0x1b4901);}else{if(_0x1b4901===0x1f4){_0x52aab2[_0x0e50('0x21')](_0x1b4901)['send'](_0x7bde53);}else{_0x52aab2[_0x0e50('0x21')](_0x1b4901)['json'](_0x7bde53);}}});};exports[_0x0e50('0x11d')]=function(_0x1f51a7,_0x5c9054){var _0x988605={};var _0x46668a={};var _0x227e01;var _0xcb51c6;return db['ChatWebsite']['findOne']({'where':{'id':_0x1f51a7[_0x0e50('0x6b')]['id']}})['then'](handleEntityNotFound(_0x5c9054,null))[_0x0e50('0x16')](function(_0x1933cb){if(_0x1933cb){_0x227e01=_0x1933cb;_0x46668a[_0x0e50('0x52')]=_[_0x0e50('0x5a')](db[_0x0e50('0xad')][_0x0e50('0x6c')]);_0x46668a[_0x0e50('0x59')]=_[_0x0e50('0x5a')](_0x1f51a7[_0x0e50('0x59')]);_0x46668a[_0x0e50('0x5b')]=_[_0x0e50('0x5c')](_0x46668a[_0x0e50('0x52')],_0x46668a['query']);_0x988605['attributes']=_[_0x0e50('0x5c')](_0x46668a[_0x0e50('0x52')],qs['fields'](_0x1f51a7[_0x0e50('0x59')][_0x0e50('0x5e')]));_0x988605[_0x0e50('0x5d')]=_0x988605[_0x0e50('0x5d')][_0x0e50('0x6d')]?_0x988605[_0x0e50('0x5d')]:_0x46668a[_0x0e50('0x52')];_0x988605[_0x0e50('0x82')]=qs[_0x0e50('0x61')](_0x1f51a7[_0x0e50('0x59')]['sort']);_0x988605[_0x0e50('0x62')]=qs[_0x0e50('0x5b')](_['pick'](_0x1f51a7['query'],_0x46668a[_0x0e50('0x5b')]));if(_0x1f51a7[_0x0e50('0x59')][_0x0e50('0x65')]){_0x988605['where']=_[_0x0e50('0x63')](_0x988605['where'],{'$or':_[_0x0e50('0x3e')](_0x988605['attributes'],function(_0x2020c9){var _0x3d13b8={};_0x3d13b8[_0x2020c9]={'$like':'%'+_0x1f51a7[_0x0e50('0x59')][_0x0e50('0x65')]+'%'};return _0x3d13b8;})});}_0x988605=_[_0x0e50('0x63')]({},_0x988605,_0x1f51a7[_0x0e50('0x66')]);return _0x227e01[_0x0e50('0x11d')](_0x988605);}})[_0x0e50('0x16')](function(_0x2241c9){if(_0x2241c9){_0xcb51c6=_0x2241c9[_0x0e50('0x6d')];if(!_0x1f51a7[_0x0e50('0x59')][_0x0e50('0x5f')](_0x0e50('0x60'))){_0x988605['limit']=qs[_0x0e50('0x27')](_0x1f51a7['query']['limit']);_0x988605['offset']=qs[_0x0e50('0x26')](_0x1f51a7[_0x0e50('0x59')][_0x0e50('0x26')]);}return _0x227e01[_0x0e50('0x11d')](_0x988605);}})[_0x0e50('0x16')](function(_0x231826){if(_0x231826){return _0x231826?{'count':_0xcb51c6,'rows':_0x231826}:null;}})[_0x0e50('0x16')](respondWithResult(_0x5c9054,null))['catch'](handleError(_0x5c9054,null));};exports[_0x0e50('0x11e')]=function(_0x1c58f0,_0x584d23){return db['chatProactiveAction'][_0x0e50('0x6e')]({'where':{'id':_0x1c58f0[_0x0e50('0x6b')]['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0x584d23,null))['then'](function(_0x46fe52){if(_0x46fe52){return _0x46fe52[_0x0e50('0x11e')](_0x1c58f0[_0x0e50('0x75')][_0x0e50('0x7f')],_[_0x0e50('0xfa')](_0x1c58f0[_0x0e50('0x75')],[_0x0e50('0x7f'),'id'])||{});}})['then'](respondWithResult(_0x584d23,null))[_0x0e50('0x20')](handleError(_0x584d23,null));};exports['getProactiveActions']=function(_0x3a8c72,_0x45e4d1){var _0x1fb5a9={};var _0x16bc58={};var _0x1eec86;var _0x856a8e;return db['ChatWebsite']['findOne']({'where':{'id':_0x3a8c72['params']['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0x45e4d1,null))['then'](function(_0x510285){if(_0x510285){_0x1eec86=_0x510285;_0x16bc58[_0x0e50('0x52')]=_['keys'](db[_0x0e50('0x11f')][_0x0e50('0x6c')]);_0x16bc58[_0x0e50('0x59')]=_[_0x0e50('0x5a')](_0x3a8c72[_0x0e50('0x59')]);_0x16bc58['filters']=_['intersection'](_0x16bc58[_0x0e50('0x52')],_0x16bc58['query']);_0x1fb5a9[_0x0e50('0x5d')]=_[_0x0e50('0x5c')](_0x16bc58[_0x0e50('0x52')],qs['fields'](_0x3a8c72[_0x0e50('0x59')]['fields']));_0x1fb5a9[_0x0e50('0x5d')]=_0x1fb5a9[_0x0e50('0x5d')]['length']?_0x1fb5a9[_0x0e50('0x5d')]:_0x16bc58[_0x0e50('0x52')];_0x1fb5a9[_0x0e50('0x82')]=qs[_0x0e50('0x61')](_0x3a8c72[_0x0e50('0x59')][_0x0e50('0x61')]);_0x1fb5a9[_0x0e50('0x62')]=qs['filters'](_[_0x0e50('0x7c')](_0x3a8c72[_0x0e50('0x59')],_0x16bc58[_0x0e50('0x5b')]));if(_0x3a8c72[_0x0e50('0x59')][_0x0e50('0x65')]){_0x1fb5a9[_0x0e50('0x62')]=_[_0x0e50('0x63')](_0x1fb5a9[_0x0e50('0x62')],{'$or':_[_0x0e50('0x3e')](_0x1fb5a9[_0x0e50('0x5d')],function(_0x338329){var _0x550a1c={};_0x550a1c[_0x338329]={'$like':'%'+_0x3a8c72[_0x0e50('0x59')][_0x0e50('0x65')]+'%'};return _0x550a1c;})});}_0x1fb5a9=_['merge']({},_0x1fb5a9,_0x3a8c72[_0x0e50('0x66')]);return _0x1eec86[_0x0e50('0x102')](_0x1fb5a9);}})[_0x0e50('0x16')](function(_0x184909){if(_0x184909){_0x856a8e=_0x184909[_0x0e50('0x6d')];if(!_0x3a8c72[_0x0e50('0x59')][_0x0e50('0x5f')](_0x0e50('0x60'))){_0x1fb5a9[_0x0e50('0x27')]=qs[_0x0e50('0x27')](_0x3a8c72[_0x0e50('0x59')]['limit']);_0x1fb5a9[_0x0e50('0x26')]=qs['offset'](_0x3a8c72[_0x0e50('0x59')][_0x0e50('0x26')]);}return _0x1eec86[_0x0e50('0x102')](_0x1fb5a9);}})[_0x0e50('0x16')](function(_0x45d86a){if(_0x45d86a){return _0x45d86a?{'count':_0x856a8e,'rows':_0x45d86a}:null;}})[_0x0e50('0x16')](respondWithResult(_0x45e4d1,null))[_0x0e50('0x20')](handleError(_0x45e4d1,null));};exports[_0x0e50('0x120')]=function(_0x3c15e8,_0x34011e){var _0x214687=_0x3c15e8['query'][_0x0e50('0x121')]==='false'?'offlineForm':_0x0e50('0x122');return db[_0x0e50('0x56')]['find']({'attributes':['id',_0x214687],'where':{'id':_0x3c15e8[_0x0e50('0x6b')]['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0x34011e,null))['then'](function(_0xcfa7e4){if(_0xcfa7e4){var _0x145c56=_0xcfa7e4[_0x214687];var _0x526754=_0x145c56&&_0x145c56['items']?_0x145c56['items']:[];_0x34011e[_0x0e50('0x31')]({'fromKey':_[_0x0e50('0x91')](_0x145c56[_0x0e50('0x123')])?undefined:_0x145c56[_0x0e50('0x123')],'count':_0x526754[_0x0e50('0x6d')],'rows':_0x526754});}})['catch'](handleError(_0x34011e,null));};exports[_0x0e50('0x124')]=function(_0x26a74a,_0x94aed0){var _0xa5966b={'raw':![],'where':{}};var _0x2c9f92={};var _0x231bf2={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0e50('0x7b')]({'where':{'id':_0x26a74a[_0x0e50('0x6b')]['id']}})['then'](handleEntityNotFound(_0x94aed0,null))[_0x0e50('0x16')](function(_0x126807){if(_0x126807){_0x2c9f92[_0x0e50('0x52')]=_[_0x0e50('0x5a')](db['ChatOfflineMessage'][_0x0e50('0x6c')]);_0x2c9f92[_0x0e50('0x59')]=_['keys'](_0x26a74a[_0x0e50('0x59')]);_0x2c9f92[_0x0e50('0x5b')]=_['intersection'](_0x2c9f92['model'],_0x2c9f92['query']);_0xa5966b[_0x0e50('0x5d')]=_[_0x0e50('0x5c')](_0x2c9f92[_0x0e50('0x52')],qs['fields'](_0x26a74a[_0x0e50('0x59')]['fields']));_0xa5966b[_0x0e50('0x5d')]=_0xa5966b['attributes'][_0x0e50('0x6d')]?_0xa5966b[_0x0e50('0x5d')]:_0x2c9f92['model'];if(!_0x26a74a[_0x0e50('0x59')][_0x0e50('0x5f')]('nolimit')){_0xa5966b[_0x0e50('0x27')]=qs[_0x0e50('0x27')](_0x26a74a['query'][_0x0e50('0x27')]);_0xa5966b[_0x0e50('0x26')]=qs[_0x0e50('0x26')](_0x26a74a['query']['offset']);}_0xa5966b[_0x0e50('0x82')]=qs['sort'](_0x26a74a[_0x0e50('0x59')][_0x0e50('0x61')]);_0xa5966b[_0x0e50('0x62')]=qs[_0x0e50('0x5b')](_['pick'](_0x26a74a[_0x0e50('0x59')],_0x2c9f92[_0x0e50('0x5b')]));_0xa5966b[_0x0e50('0x62')]['ChatWebsiteId']=_0x126807['id'];if(_0x26a74a[_0x0e50('0x59')][_0x0e50('0x65')]){_0xa5966b[_0x0e50('0x62')]=_['merge'](_0xa5966b['where'],{'$or':_[_0x0e50('0x3e')](_0xa5966b[_0x0e50('0x5d')],function(_0x5ebed4){var _0x3c15a1={};_0x3c15a1[_0x5ebed4]={'$like':'%'+_0x26a74a['query'][_0x0e50('0x65')]+'%'};return _0x3c15a1;})});}_0xa5966b=_[_0x0e50('0x63')]({},_0xa5966b,_0x26a74a[_0x0e50('0x66')]);return db[_0x0e50('0xdb')][_0x0e50('0x25')]({'where':_0xa5966b[_0x0e50('0x62')]})['then'](function(_0xde3494){_0x231bf2[_0x0e50('0x25')]=_0xde3494;if(_0x26a74a[_0x0e50('0x59')][_0x0e50('0x67')]){_0xa5966b[_0x0e50('0x68')]=[{'all':!![]}];}else{_0xa5966b['include']=[{'model':db['CmContact'],'as':_0x0e50('0xfc'),'required':![]},{'model':db[_0x0e50('0xe5')],'as':_0x0e50('0x125'),'required':![]}];}return db[_0x0e50('0xdb')][_0x0e50('0x69')](_0xa5966b);})[_0x0e50('0x16')](function(_0x21a49a){_0x231bf2[_0x0e50('0x7d')]=_0x21a49a;return _0x231bf2;});}})[_0x0e50('0x16')](respondWithFilteredResult(_0x94aed0,_0xa5966b))['catch'](handleError(_0x94aed0,null));};exports[_0x0e50('0x126')]=function(_0x34f216,_0x34c245){return db[_0x0e50('0x56')][_0x0e50('0x6e')]({'where':{'id':_0x34f216[_0x0e50('0x6b')]['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0x34c245,null))[_0x0e50('0x16')](function(_0x505bf3){if(_0x505bf3){return _0x505bf3[_0x0e50('0x126')](_0x34f216[_0x0e50('0x75')][_0x0e50('0x7f')],_[_0x0e50('0xfa')](_0x34f216[_0x0e50('0x75')],[_0x0e50('0x7f'),'id'])||{})['spread'](function(_0x5d0e19){for(var _0x33c608=0x0;_0x33c608<_0x34f216['body'][_0x0e50('0x7f')][_0x0e50('0x6d')];_0x33c608+=0x1){socket[_0x0e50('0x127')](_0x0e50('0x128'),{'UserId':Number(_0x34f216['body'][_0x0e50('0x7f')][_0x33c608]),'ChatWebsiteId':Number(_0x34f216['params']['id'])});}return _0x5d0e19;});}})[_0x0e50('0x16')](respondWithResult(_0x34c245,null))[_0x0e50('0x20')](handleError(_0x34c245,null));};exports['removeAgents']=function(_0x29b8c3,_0x4ee455){return db[_0x0e50('0x56')][_0x0e50('0x6e')]({'where':{'id':_0x29b8c3['params']['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0x4ee455,null))[_0x0e50('0x16')](function(_0x85a926){if(_0x85a926){return _0x85a926[_0x0e50('0x129')](_0x29b8c3[_0x0e50('0x59')][_0x0e50('0x7f')])['then'](function(){if(_['isArray'](_0x29b8c3['query']['ids'])){for(var _0x2886ec=0x0;_0x2886ec<_0x29b8c3[_0x0e50('0x59')][_0x0e50('0x7f')][_0x0e50('0x6d')];_0x2886ec+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x29b8c3['query']['ids'][_0x2886ec]),'ChatWebsiteId':Number(_0x29b8c3[_0x0e50('0x6b')]['id'])});}}else{socket[_0x0e50('0x127')]('userChatWebsite:remove',{'UserId':Number(_0x29b8c3[_0x0e50('0x59')][_0x0e50('0x7f')]),'ChatWebsiteId':Number(_0x29b8c3['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4ee455,null))['catch'](handleError(_0x4ee455,null));};exports[_0x0e50('0x12a')]=function(_0x5ce123,_0xa99b06){var _0x7ab692={};var _0x31d9a7={};var _0x3faf80;var _0xb9b07;return db[_0x0e50('0x56')][_0x0e50('0x7b')]({'where':{'id':_0x5ce123[_0x0e50('0x6b')]['id']}})[_0x0e50('0x16')](handleEntityNotFound(_0xa99b06,null))[_0x0e50('0x16')](function(_0x18348e){if(_0x18348e){_0x3faf80=_0x18348e;_0x31d9a7[_0x0e50('0x52')]=_['keys'](db[_0x0e50('0xc7')]['rawAttributes']);_0x31d9a7['query']=_['keys'](_0x5ce123[_0x0e50('0x59')]);_0x31d9a7[_0x0e50('0x5b')]=_['intersection'](_0x31d9a7[_0x0e50('0x52')],_0x31d9a7[_0x0e50('0x59')]);_0x7ab692[_0x0e50('0x5d')]=_['intersection'](_0x31d9a7[_0x0e50('0x52')],qs['fields'](_0x5ce123[_0x0e50('0x59')][_0x0e50('0x5e')]));_0x7ab692[_0x0e50('0x5d')]=_0x7ab692['attributes'][_0x0e50('0x6d')]?_0x7ab692[_0x0e50('0x5d')]:_0x31d9a7[_0x0e50('0x52')];_0x7ab692[_0x0e50('0x82')]=qs[_0x0e50('0x61')](_0x5ce123[_0x0e50('0x59')][_0x0e50('0x61')]);_0x7ab692['where']=qs[_0x0e50('0x5b')](_[_0x0e50('0x7c')](_0x5ce123[_0x0e50('0x59')],_0x31d9a7[_0x0e50('0x5b')]));if(_0x5ce123['query'][_0x0e50('0x65')]){_0x7ab692[_0x0e50('0x62')]=_[_0x0e50('0x63')](_0x7ab692['where'],{'$or':_['map'](_0x7ab692['attributes'],function(_0x50c74d){var _0x53c4ed={};_0x53c4ed[_0x50c74d]={'$like':'%'+_0x5ce123[_0x0e50('0x59')][_0x0e50('0x65')]+'%'};return _0x53c4ed;})});}_0x7ab692=_[_0x0e50('0x63')]({},_0x7ab692,_0x5ce123[_0x0e50('0x66')]);return _0x3faf80['getAgents'](_0x7ab692);}})[_0x0e50('0x16')](function(_0x1f79b6){if(_0x1f79b6){_0xb9b07=_0x1f79b6[_0x0e50('0x6d')];if(!_0x5ce123[_0x0e50('0x59')][_0x0e50('0x5f')](_0x0e50('0x60'))){_0x7ab692['limit']=qs[_0x0e50('0x27')](_0x5ce123[_0x0e50('0x59')][_0x0e50('0x27')]);_0x7ab692[_0x0e50('0x26')]=qs[_0x0e50('0x26')](_0x5ce123['query'][_0x0e50('0x26')]);}return _0x3faf80[_0x0e50('0x12a')](_0x7ab692);}})[_0x0e50('0x16')](function(_0x285be8){if(_0x285be8){return _0x285be8?{'count':_0xb9b07,'rows':_0x285be8}:null;}})[_0x0e50('0x16')](respondWithResult(_0xa99b06,null))[_0x0e50('0x20')](handleError(_0xa99b06,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 035b5fc..7187d12 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 _0x684d=['exports','../../mysqldb','ChatWebsite','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x47e86f,_0xcec17e){var _0xc749bb=function(_0x57bf84){while(--_0x57bf84){_0x47e86f['push'](_0x47e86f['shift']());}};_0xc749bb(++_0xcec17e);}(_0x684d,0x174));var _0xd684=function(_0x55ef86,_0x22479e){_0x55ef86=_0x55ef86-0x0;var _0x206965=_0x684d[_0x55ef86];return _0x206965;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xd684('0x0'))['db'][_0xd684('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xd684('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd684('0x3'),'afterDestroy':'remove'};function emitEvent(_0x20d7ea){return function(_0x1d505b,_0x654972,_0x51ac07){ChatWebsiteEvents[_0xd684('0x4')](_0x20d7ea+':'+_0x1d505b['id'],_0x1d505b);ChatWebsiteEvents['emit'](_0x20d7ea,_0x1d505b);_0x51ac07(null);};}for(var e in events){if(events[_0xd684('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xd684('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x57d4=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x57d4,0x78));var _0x457d=function(_0x249e81,_0x3f5d68){_0x249e81=_0x249e81-0x0;var _0xac47c9=_0x57d4[_0x249e81];return _0xac47c9;};'use strict';var EventEmitter=require(_0x457d('0x0'));var ChatWebsite=require(_0x457d('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x457d('0x2')](0x0);var events={'afterCreate':_0x457d('0x3'),'afterUpdate':_0x457d('0x4'),'afterDestroy':_0x457d('0x5')};function emitEvent(_0x1219e1){return function(_0x3c89b2,_0x3e2239,_0x1f5b4e){ChatWebsiteEvents[_0x457d('0x6')](_0x1219e1+':'+_0x3c89b2['id'],_0x3c89b2);ChatWebsiteEvents[_0x457d('0x6')](_0x1219e1,_0x3c89b2);_0x1f5b4e(null);};}for(var e in events){if(events[_0x457d('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x457d('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 17b93b7..b5efc9f 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 _0x5183=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','ChatWebsite','chat_websites','lodash','../../config/logger'];(function(_0x32f0e2,_0x230534){var _0x1038b6=function(_0x3ef3a6){while(--_0x3ef3a6){_0x32f0e2['push'](_0x32f0e2['shift']());}};_0x1038b6(++_0x230534);}(_0x5183,0xfb));var _0x3518=function(_0x2a5303,_0x5b85fc){_0x2a5303=_0x2a5303-0x0;var _0x218496=_0x5183[_0x2a5303];return _0x218496;};'use strict';var _=require(_0x3518('0x0'));var util=require('util');var logger=require(_0x3518('0x1'))(_0x3518('0x2'));var moment=require(_0x3518('0x3'));var BPromise=require(_0x3518('0x4'));var rp=require(_0x3518('0x5'));var fs=require('fs');var path=require(_0x3518('0x6'));var rimraf=require(_0x3518('0x7'));var config=require(_0x3518('0x8'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x31c90d,_0x18e66e){return _0x31c90d['define'](_0x3518('0x9'),attributes,{'tableName':_0x3518('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8b2=['moment','bluebird','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','chat_websites','../../config/logger','api'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xb8b2,0x77));var _0x2b8b=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0xb8b2[_0x126fb9];return _0xc8a3b1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2b8b('0x0'))(_0x2b8b('0x1'));var moment=require(_0x2b8b('0x2'));var BPromise=require(_0x2b8b('0x3'));var rp=require(_0x2b8b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b8b('0x5'));var config=require(_0x2b8b('0x6'));var attributes=require(_0x2b8b('0x7'));module[_0x2b8b('0x8')]=function(_0x536137,_0x4841c3){return _0x536137[_0x2b8b('0x9')]('ChatWebsite',attributes,{'tableName':_0x2b8b('0xa'),'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 f161d7d..2f52310 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 _0x10a7=['./chatWebsite.socket','register','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x10a7,0x1b3));var _0x710a=function(_0x2abeaf,_0x1071c8){_0x2abeaf=_0x2abeaf-0x0;var _0x503043=_0x10a7[_0x2abeaf];return _0x503043;};'use strict';var _=require(_0x710a('0x0'));var util=require(_0x710a('0x1'));var moment=require(_0x710a('0x2'));var BPromise=require(_0x710a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x710a('0x4'));var db=require(_0x710a('0x5'))['db'];var utils=require(_0x710a('0x6'));var logger=require(_0x710a('0x7'))(_0x710a('0x8'));var config=require(_0x710a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x710a('0xa')]['http']({'port':0x232a});config[_0x710a('0xb')]=_[_0x710a('0xc')](config[_0x710a('0xb')],{'host':_0x710a('0xd'),'port':0x18eb});var socket=require(_0x710a('0xe'))(new Redis(config[_0x710a('0xb')]));require(_0x710a('0xf'))[_0x710a('0x10')](socket);function respondWithRpcPromise(_0x417dcc,_0x4c34e5,_0x47926f){return new BPromise(function(_0x5487b6,_0x4fcd7c){return client[_0x710a('0x11')](_0x417dcc,_0x47926f)[_0x710a('0x12')](function(_0x4bf4a7){logger[_0x710a('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x4c34e5,_0x710a('0x14'));logger[_0x710a('0x15')](_0x710a('0x16'),_0x4c34e5,_0x710a('0x14'),JSON[_0x710a('0x17')](_0x4bf4a7));if(_0x4bf4a7[_0x710a('0x18')]){if(_0x4bf4a7[_0x710a('0x18')][_0x710a('0x19')]===0x1f4){logger[_0x710a('0x18')](_0x710a('0x1a'),_0x4c34e5,_0x4bf4a7[_0x710a('0x18')][_0x710a('0x1b')]);return _0x4fcd7c(_0x4bf4a7[_0x710a('0x18')][_0x710a('0x1b')]);}logger['error'](_0x710a('0x1a'),_0x4c34e5,_0x4bf4a7['error'][_0x710a('0x1b')]);return _0x5487b6(_0x4bf4a7['error'][_0x710a('0x1b')]);}else{logger[_0x710a('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x4c34e5,_0x710a('0x14'));_0x5487b6(_0x4bf4a7[_0x710a('0x1c')][_0x710a('0x1b')]);}})[_0x710a('0x1d')](function(_0x48cd32){logger[_0x710a('0x18')](_0x710a('0x1a'),_0x4c34e5,_0x48cd32);_0x4fcd7c(_0x48cd32);});});} \ No newline at end of file +var _0xb3e4=['redis','socket.io-emitter','./chatWebsite.socket','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2a8cb7,_0x314d29){var _0x183a1f=function(_0x7f65bc){while(--_0x7f65bc){_0x2a8cb7['push'](_0x2a8cb7['shift']());}};_0x183a1f(++_0x314d29);}(_0xb3e4,0x138));var _0x4b3e=function(_0x14b158,_0x4b7633){_0x14b158=_0x14b158-0x0;var _0x39f599=_0xb3e4[_0x14b158];return _0x39f599;};'use strict';var _=require(_0x4b3e('0x0'));var util=require(_0x4b3e('0x1'));var moment=require(_0x4b3e('0x2'));var BPromise=require(_0x4b3e('0x3'));var rs=require(_0x4b3e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b3e('0x5'))['db'];var utils=require(_0x4b3e('0x6'));var logger=require(_0x4b3e('0x7'))(_0x4b3e('0x8'));var config=require(_0x4b3e('0x9'));var jayson=require(_0x4b3e('0xa'));var client=jayson[_0x4b3e('0xb')][_0x4b3e('0xc')]({'port':0x232a});config[_0x4b3e('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4b3e('0xe'))(new Redis(config[_0x4b3e('0xd')]));require(_0x4b3e('0xf'))['register'](socket);function respondWithRpcPromise(_0x47b903,_0x2d2849,_0x24bfc2){return new BPromise(function(_0x32845d,_0x32b18a){return client['request'](_0x47b903,_0x24bfc2)[_0x4b3e('0x10')](function(_0x551e9d){logger[_0x4b3e('0x11')](_0x4b3e('0x12'),_0x2d2849,_0x4b3e('0x13'));logger[_0x4b3e('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x2d2849,_0x4b3e('0x13'),JSON[_0x4b3e('0x15')](_0x551e9d));if(_0x551e9d[_0x4b3e('0x16')]){if(_0x551e9d['error']['code']===0x1f4){logger[_0x4b3e('0x16')](_0x4b3e('0x12'),_0x2d2849,_0x551e9d['error'][_0x4b3e('0x17')]);return _0x32b18a(_0x551e9d[_0x4b3e('0x16')][_0x4b3e('0x17')]);}logger[_0x4b3e('0x16')](_0x4b3e('0x12'),_0x2d2849,_0x551e9d[_0x4b3e('0x16')]['message']);return _0x32845d(_0x551e9d['error'][_0x4b3e('0x17')]);}else{logger[_0x4b3e('0x11')](_0x4b3e('0x12'),_0x2d2849,'request\x20sent');_0x32845d(_0x551e9d[_0x4b3e('0x18')][_0x4b3e('0x17')]);}})['catch'](function(_0x495eab){logger[_0x4b3e('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x2d2849,_0x495eab);_0x32b18a(_0x495eab);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index d274e21..1704ca5 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 _0x8c78=['chatWebsite:','save','remove','removeListener','register','length'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8c78,0x103));var _0x88c7=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x8c78[_0x126558];return _0x1f6d14;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x88c7('0x0'),_0x88c7('0x1'),'update'];function createListener(_0x22902c,_0x444e76){return function(_0x3c72a3){_0x444e76['emit'](_0x22902c,_0x3c72a3);};}function removeListener(_0x17fbe8,_0x1fe30d){return function(){ChatWebsiteEvents[_0x88c7('0x2')](_0x17fbe8,_0x1fe30d);};}exports[_0x88c7('0x3')]=function(_0x4ae3f){for(var _0x26c694=0x0,_0x1abce2=events[_0x88c7('0x4')];_0x26c694<_0x1abce2;_0x26c694++){var _0x351b8c=events[_0x26c694];var _0x1f8a50=createListener(_0x88c7('0x5')+_0x351b8c,_0x4ae3f);ChatWebsiteEvents['on'](_0x351b8c,_0x1f8a50);}}; \ No newline at end of file +var _0x5b63=['./chatWebsite.events','remove','emit','removeListener','register'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x5b63,0x145));var _0x35b6=function(_0x2c9d95,_0xcc4c3){_0x2c9d95=_0x2c9d95-0x0;var _0x1b9a2e=_0x5b63[_0x2c9d95];return _0x1b9a2e;};'use strict';var ChatWebsiteEvents=require(_0x35b6('0x0'));var events=['save',_0x35b6('0x1'),'update'];function createListener(_0xe41c26,_0x49289f){return function(_0x20d458){_0x49289f[_0x35b6('0x2')](_0xe41c26,_0x20d458);};}function removeListener(_0x477db9,_0x54f0c7){return function(){ChatWebsiteEvents[_0x35b6('0x3')](_0x477db9,_0x54f0c7);};}exports[_0x35b6('0x4')]=function(_0x57fcb4){for(var _0x5e134c=0x0,_0x1a76fc=events['length'];_0x5e134c<_0x1a76fc;_0x5e134c++){var _0x294c55=events[_0x5e134c];var _0x208009=createListener('chatWebsite:'+_0x294c55,_0x57fcb4);ChatWebsiteEvents['on'](_0x294c55,_0x208009);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index bd8e218..fdbcc9a 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 _0x8b34=['getSnippet','getApplications','/:id/fields','getFields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','now','originalname','file','addLogo','join','server/files/images/avatars/','%s-%s','/:id/avatar','addAvatar','single','addCustomerAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/applications','/:id/proactive_actions','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','get','/describe','describe','/:id','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet'];(function(_0x3d92f7,_0x39b899){var _0x509790=function(_0x5219ed){while(--_0x5219ed){_0x3d92f7['push'](_0x3d92f7['shift']());}};_0x509790(++_0x39b899);}(_0x8b34,0x1dd));var _0x48b3=function(_0x2af337,_0xf67452){_0x2af337=_0x2af337-0x0;var _0x122c54=_0x8b34[_0x2af337];return _0x122c54;};'use strict';var multer=require(_0x48b3('0x0'));var util=require(_0x48b3('0x1'));var path=require(_0x48b3('0x2'));var timeout=require(_0x48b3('0x3'));var express=require(_0x48b3('0x4'));var router=express[_0x48b3('0x5')]();var fs_extra=require(_0x48b3('0x6'));var auth=require(_0x48b3('0x7'));var interaction=require(_0x48b3('0x8'));var config=require(_0x48b3('0x9'));var controller=require(_0x48b3('0xa'));router['get']('/',auth[_0x48b3('0xb')](),controller['index']);router[_0x48b3('0xc')](_0x48b3('0xd'),auth[_0x48b3('0xb')](),controller[_0x48b3('0xe')]);router[_0x48b3('0xc')](_0x48b3('0xf'),auth[_0x48b3('0xb')](),controller['show']);router[_0x48b3('0xc')]('/:id/dispositions',auth[_0x48b3('0xb')](),controller['getDispositions']);router[_0x48b3('0xc')](_0x48b3('0x10'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x11')]);router[_0x48b3('0xc')](_0x48b3('0x12'),controller[_0x48b3('0x13')]);router[_0x48b3('0xc')]('/:id/avatar',controller['getAvatar']);router['get'](_0x48b3('0x14'),controller[_0x48b3('0x15')]);router[_0x48b3('0xc')](_0x48b3('0x16'),controller[_0x48b3('0x17')]);router['get'](_0x48b3('0x18'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x19')]);router['get'](_0x48b3('0x1a'),controller[_0x48b3('0x1b')]);router[_0x48b3('0xc')]('/:id/applications',auth[_0x48b3('0xb')](),controller[_0x48b3('0x1c')]);router['get']('/:id/proactive_actions',auth[_0x48b3('0xb')](),controller['getProactiveActions']);router[_0x48b3('0xc')](_0x48b3('0x1d'),controller[_0x48b3('0x1e')]);router['get']('/:id/offline_messages',auth[_0x48b3('0xb')](),controller['getOfflineMessages']);router[_0x48b3('0xc')](_0x48b3('0x1f'),auth['isAuthenticated'](),controller[_0x48b3('0x20')]);router[_0x48b3('0x21')]('/',auth[_0x48b3('0xb')](),controller[_0x48b3('0x22')]);router[_0x48b3('0x21')](_0x48b3('0x23'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x24')]);router[_0x48b3('0x21')]('/:id/canned_answers',auth[_0x48b3('0xb')](),controller[_0x48b3('0x25')]);var upload=multer({'storage':multer[_0x48b3('0x26')]({'destination':function(_0x718990,_0x806557,_0x35b943){_0x35b943(null,path['join'](config[_0x48b3('0x27')],_0x48b3('0x28')));},'filename':function(_0x592081,_0x5a9859,_0x4e5a95){_0x4e5a95(null,util[_0x48b3('0x29')]('%s-%s',Date[_0x48b3('0x2a')](),_0x5a9859[_0x48b3('0x2b')]));}})});router['post']('/:id/logo',upload['single'](_0x48b3('0x2c')),controller[_0x48b3('0x2d')]);var upload=multer({'storage':multer[_0x48b3('0x26')]({'destination':function(_0x54be8b,_0x2f2f52,_0x14783a){_0x14783a(null,path[_0x48b3('0x2e')](config[_0x48b3('0x27')],_0x48b3('0x2f')));},'filename':function(_0x173003,_0x39affb,_0x2b3469){_0x2b3469(null,util[_0x48b3('0x29')](_0x48b3('0x30'),Date['now'](),_0x39affb['originalname']));}})});router[_0x48b3('0x21')](_0x48b3('0x31'),upload['single'](_0x48b3('0x2c')),controller[_0x48b3('0x32')]);var upload=multer({'storage':multer[_0x48b3('0x26')]({'destination':function(_0x2b1c6c,_0x870b6b,_0x51d0c6){_0x51d0c6(null,path['join'](config[_0x48b3('0x27')],_0x48b3('0x2f')));},'filename':function(_0x413fae,_0xcb468,_0x38c9cb){_0x38c9cb(null,util[_0x48b3('0x29')](_0x48b3('0x30'),Date[_0x48b3('0x2a')](),_0xcb468[_0x48b3('0x2b')]));}})});router[_0x48b3('0x21')](_0x48b3('0x14'),upload[_0x48b3('0x33')]('file'),controller[_0x48b3('0x34')]);var upload=multer({'storage':multer[_0x48b3('0x26')]({'destination':function(_0x3a1c06,_0x57fbd8,_0x4f04dd){_0x4f04dd(null,path[_0x48b3('0x2e')](config[_0x48b3('0x27')],'server/files/images/avatars/'));},'filename':function(_0x1356ad,_0x4c21fc,_0x1e789b){_0x1e789b(null,util['format'](_0x48b3('0x30'),Date['now'](),_0x4c21fc[_0x48b3('0x2b')]));}})});router[_0x48b3('0x21')]('/:id/system_avatar',upload[_0x48b3('0x33')](_0x48b3('0x2c')),controller['addSystemAvatar']);router[_0x48b3('0x21')](_0x48b3('0x35'),controller[_0x48b3('0x36')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x546605,_0x1884ef,_0x407006){const _0x382d69=path['join'](config[_0x48b3('0x27')],'server/files',_0x48b3('0x37'),_0x48b3('0x38'));fs_extra[_0x48b3('0x39')](_0x382d69,function(){_0x407006(null,_0x382d69);});},'filename':function(_0x1990ed,_0x3c4c54,_0x3defb0){const _0x4fc26d=_0x3c4c54['originalname'][_0x48b3('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2f39d1=path[_0x48b3('0x3b')](_0x4fc26d);const _0x1be258=Date[_0x48b3('0x2a')]()+'-'+_0x4fc26d['replace'](_0x2f39d1,'')+_0x2f39d1;_0x3defb0(null,_0x1be258);}})});router[_0x48b3('0x21')](_0x48b3('0x3c'),offlineUploadMulter[_0x48b3('0x3d')](),controller[_0x48b3('0x3e')]);router['post'](_0x48b3('0x18'),auth[_0x48b3('0xb')](),controller['addInteraction']);router['post'](_0x48b3('0x3f'),auth[_0x48b3('0xb')](),controller['addApplications']);router[_0x48b3('0x21')](_0x48b3('0x40'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x41')]);router[_0x48b3('0x21')](_0x48b3('0x1f'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x42')]);router['put'](_0x48b3('0xf'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x43')]);router[_0x48b3('0x44')](_0x48b3('0xf'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x45')]);router[_0x48b3('0x44')](_0x48b3('0x23'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x46')]);router[_0x48b3('0x44')](_0x48b3('0x10'),auth['isAuthenticated'](),controller[_0x48b3('0x47')]);router[_0x48b3('0x44')](_0x48b3('0x1f'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xfc4a=['delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./chatWebsite.controller','get','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/applications','getProactiveActions','getFields','/:id/offline_messages','/:id/users','getAgents','create','post','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','file','addLogo','join','server/files/images/avatars/','originalname','addAvatar','addCustomerAvatar','single','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','/:id/proactive_actions','addProactiveActions','addAgents','destroy'];(function(_0x523a9c,_0x337b8a){var _0x5b79d2=function(_0x3625a5){while(--_0x3625a5){_0x523a9c['push'](_0x523a9c['shift']());}};_0x5b79d2(++_0x337b8a);}(_0xfc4a,0x104));var _0xafc4=function(_0x515844,_0x2e3801){_0x515844=_0x515844-0x0;var _0x5ebce5=_0xfc4a[_0x515844];return _0x5ebce5;};'use strict';var multer=require(_0xafc4('0x0'));var util=require(_0xafc4('0x1'));var path=require(_0xafc4('0x2'));var timeout=require(_0xafc4('0x3'));var express=require(_0xafc4('0x4'));var router=express['Router']();var fs_extra=require(_0xafc4('0x5'));var auth=require(_0xafc4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xafc4('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xafc4('0x8')]('/describe',auth[_0xafc4('0x9')](),controller[_0xafc4('0xa')]);router[_0xafc4('0x8')](_0xafc4('0xb'),auth[_0xafc4('0x9')](),controller[_0xafc4('0xc')]);router[_0xafc4('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xafc4('0xd')]);router[_0xafc4('0x8')](_0xafc4('0xe'),auth[_0xafc4('0x9')](),controller[_0xafc4('0xf')]);router[_0xafc4('0x8')](_0xafc4('0x10'),controller[_0xafc4('0x11')]);router[_0xafc4('0x8')](_0xafc4('0x12'),controller[_0xafc4('0x13')]);router[_0xafc4('0x8')](_0xafc4('0x14'),controller['getCustomerAvatar']);router[_0xafc4('0x8')](_0xafc4('0x15'),controller[_0xafc4('0x16')]);router[_0xafc4('0x8')](_0xafc4('0x17'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xafc4('0x8')]('/:id/snippet',controller['getSnippet']);router[_0xafc4('0x8')](_0xafc4('0x18'),auth[_0xafc4('0x9')](),controller['getApplications']);router[_0xafc4('0x8')]('/:id/proactive_actions',auth[_0xafc4('0x9')](),controller[_0xafc4('0x19')]);router['get']('/:id/fields',controller[_0xafc4('0x1a')]);router[_0xafc4('0x8')](_0xafc4('0x1b'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0xafc4('0x8')](_0xafc4('0x1c'),auth['isAuthenticated'](),controller[_0xafc4('0x1d')]);router['post']('/',auth[_0xafc4('0x9')](),controller[_0xafc4('0x1e')]);router[_0xafc4('0x1f')]('/:id/dispositions',auth[_0xafc4('0x9')](),controller['addDisposition']);router[_0xafc4('0x1f')](_0xafc4('0xe'),auth['isAuthenticated'](),controller[_0xafc4('0x20')]);var upload=multer({'storage':multer[_0xafc4('0x21')]({'destination':function(_0x211821,_0x4075e8,_0x3f39dd){_0x3f39dd(null,path['join'](config[_0xafc4('0x22')],_0xafc4('0x23')));},'filename':function(_0x52a2de,_0x3b598a,_0x2f9bb3){_0x2f9bb3(null,util[_0xafc4('0x24')](_0xafc4('0x25'),Date[_0xafc4('0x26')](),_0x3b598a['originalname']));}})});router[_0xafc4('0x1f')]('/:id/logo',upload['single'](_0xafc4('0x27')),controller[_0xafc4('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1fdfa9,_0x3d42dc,_0x5bdef1){_0x5bdef1(null,path[_0xafc4('0x29')](config['root'],_0xafc4('0x2a')));},'filename':function(_0x1cc86a,_0x3731eb,_0x4bce7f){_0x4bce7f(null,util[_0xafc4('0x24')](_0xafc4('0x25'),Date[_0xafc4('0x26')](),_0x3731eb[_0xafc4('0x2b')]));}})});router[_0xafc4('0x1f')]('/:id/avatar',upload['single']('file'),controller[_0xafc4('0x2c')]);var upload=multer({'storage':multer[_0xafc4('0x21')]({'destination':function(_0x2dce76,_0x3fadd4,_0x5102db){_0x5102db(null,path[_0xafc4('0x29')](config[_0xafc4('0x22')],'server/files/images/avatars/'));},'filename':function(_0x3547e7,_0x295815,_0x5e5499){_0x5e5499(null,util[_0xafc4('0x24')](_0xafc4('0x25'),Date[_0xafc4('0x26')](),_0x295815[_0xafc4('0x2b')]));}})});router[_0xafc4('0x1f')](_0xafc4('0x14'),upload['single'](_0xafc4('0x27')),controller[_0xafc4('0x2d')]);var upload=multer({'storage':multer[_0xafc4('0x21')]({'destination':function(_0x2f52c7,_0x37c622,_0x3f2ad8){_0x3f2ad8(null,path[_0xafc4('0x29')](config[_0xafc4('0x22')],'server/files/images/avatars/'));},'filename':function(_0x4cc817,_0x1c14c2,_0x42d0b3){_0x42d0b3(null,util[_0xafc4('0x24')](_0xafc4('0x25'),Date[_0xafc4('0x26')](),_0x1c14c2[_0xafc4('0x2b')]));}})});router['post']('/:id/system_avatar',upload[_0xafc4('0x2e')](_0xafc4('0x27')),controller['addSystemAvatar']);router['post']('/:id/notify',controller[_0xafc4('0x2f')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x329648,_0x59cfe2,_0x32cea2){const _0x17c0c0=path[_0xafc4('0x29')](config[_0xafc4('0x22')],_0xafc4('0x30'),_0xafc4('0x31'),_0xafc4('0x32'));fs_extra[_0xafc4('0x33')](_0x17c0c0,function(){_0x32cea2(null,_0x17c0c0);});},'filename':function(_0x3eb88a,_0x9556bf,_0x21948e){const _0xbe4ced=_0x9556bf[_0xafc4('0x2b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1e1fac=path[_0xafc4('0x34')](_0xbe4ced);const _0x4224b1=Date[_0xafc4('0x26')]()+'-'+_0xbe4ced[_0xafc4('0x35')](_0x1e1fac,'')+_0x1e1fac;_0x21948e(null,_0x4224b1);}})});router[_0xafc4('0x1f')](_0xafc4('0x36'),offlineUploadMulter[_0xafc4('0x37')](),controller['offline']);router[_0xafc4('0x1f')](_0xafc4('0x17'),auth[_0xafc4('0x9')](),controller['addInteraction']);router['post']('/:id/applications',auth[_0xafc4('0x9')](),controller['addApplications']);router[_0xafc4('0x1f')](_0xafc4('0x38'),auth[_0xafc4('0x9')](),controller[_0xafc4('0x39')]);router[_0xafc4('0x1f')](_0xafc4('0x1c'),auth[_0xafc4('0x9')](),controller[_0xafc4('0x3a')]);router['put'](_0xafc4('0xb'),auth[_0xafc4('0x9')](),controller['update']);router['delete'](_0xafc4('0xb'),auth[_0xafc4('0x9')](),controller[_0xafc4('0x3b')]);router[_0xafc4('0x3c')]('/:id/dispositions',auth[_0xafc4('0x9')](),controller['removeDispositions']);router[_0xafc4('0x3c')](_0xafc4('0xe'),auth[_0xafc4('0x9')](),controller[_0xafc4('0x3d')]);router[_0xafc4('0x3c')](_0xafc4('0x1c'),auth['isAuthenticated'](),controller[_0xafc4('0x3e')]);module[_0xafc4('0x3f')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index d5b1750..318ebe1 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 _0x5d24=['Router','env','production','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','beaver-logger/server','express','../components/auth/service'];(function(_0x5045e2,_0x32fe5a){var _0x1b5794=function(_0x2d9f4d){while(--_0x2d9f4d){_0x5045e2['push'](_0x5045e2['shift']());}};_0x1b5794(++_0x32fe5a);}(_0x5d24,0xc3));var _0x45d2=function(_0x3653a0,_0x378bef){_0x3653a0=_0x3653a0-0x0;var _0x2cca6a=_0x5d24[_0x3653a0];return _0x2cca6a;};var beaverLogger=require(_0x45d2('0x0'));var express=require(_0x45d2('0x1'));var auth=require(_0x45d2('0x2'));var config=require('../config/environment');var router=express[_0x45d2('0x3')]();var isProduction=config[_0x45d2('0x4')]===_0x45d2('0x5')||![];function clientSideLogs(_0x4e49e5,_0x1c7fbb,_0x19c8dc){var _0x5113e6=_0x4e49e5['app']['get'](_0x45d2('0x6'));if(!_0x5113e6){throw new Error(_0x45d2('0x7'));}return beaverLogger[_0x45d2('0x8')]({'uri':'/client-logs','logger':_0x5113e6,'enableCors':!isProduction})(_0x4e49e5,_0x1c7fbb,_0x19c8dc);}router[_0x45d2('0x9')](auth[_0x45d2('0xa')](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0xae03=['isAuthenticated','exports','express','../components/auth/service','../config/environment','Router','env','production','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xae03,0xe2));var _0x3ae0=function(_0x19bec8,_0x52d9eb){_0x19bec8=_0x19bec8-0x0;var _0x203871=_0xae03[_0x19bec8];return _0x203871;};var beaverLogger=require('beaver-logger/server');var express=require(_0x3ae0('0x0'));var auth=require(_0x3ae0('0x1'));var config=require(_0x3ae0('0x2'));var router=express[_0x3ae0('0x3')]();var isProduction=config[_0x3ae0('0x4')]===_0x3ae0('0x5')||![];function clientSideLogs(_0x3edb0b,_0x47d9de,_0x5a6f79){var _0x5f3d6e=_0x3edb0b[_0x3ae0('0x6')]['get'](_0x3ae0('0x7'));if(!_0x5f3d6e){throw new Error(_0x3ae0('0x8'));}return beaverLogger[_0x3ae0('0x9')]({'uri':_0x3ae0('0xa'),'logger':_0x5f3d6e,'enableCors':!isProduction})(_0x3edb0b,_0x47d9de,_0x5a6f79);}router[_0x3ae0('0xb')](auth[_0x3ae0('0xc')](),clientSideLogs);module[_0x3ae0('0xd')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 9f60a3c..e2e8e41 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 _0x803c=['STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','Google','MicrosoftAzure','Outlook365'];(function(_0x40129c,_0x440255){var _0x2bd64e=function(_0x17639e){while(--_0x17639e){_0x40129c['push'](_0x40129c['shift']());}};_0x2bd64e(++_0x440255);}(_0x803c,0x1f2));var _0xc803=function(_0x228bf3,_0x4c4ad6){_0x228bf3=_0x228bf3-0x0;var _0x4798e1=_0x803c[_0x228bf3];return _0x4798e1;};'use strict';var Sequelize=require(_0xc803('0x0'));module[_0xc803('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc803('0x2')]('AmazonAWS',_0xc803('0x3'),_0xc803('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xc803('0x2')](_0xc803('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0xc803('0x6')],'comment':_0xc803('0x7')},'data2':{'type':Sequelize[_0xc803('0x6')],'comment':_0xc803('0x8')},'data3':{'type':Sequelize[_0xc803('0x6')],'comment':_0xc803('0x9')},'data4':{'type':Sequelize[_0xc803('0x6')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xc803('0xa')],'comment':_0xc803('0xb')},'data6':{'type':Sequelize[_0xc803('0xa')],'comment':_0xc803('0xc')},'data7':{'type':Sequelize[_0xc803('0xa')],'comment':_0xc803('0xd')}}; \ No newline at end of file +var _0xe995=['Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS'];(function(_0x2f6799,_0x4e7f00){var _0x3cb26f=function(_0x3c5a3d){while(--_0x3c5a3d){_0x2f6799['push'](_0x2f6799['shift']());}};_0x3cb26f(++_0x4e7f00);}(_0xe995,0x172));var _0x5e99=function(_0x1fad9d,_0x21bd6e){_0x1fad9d=_0x1fad9d-0x0;var _0x1f14fe=_0xe995[_0x1fad9d];return _0x1f14fe;};'use strict';var Sequelize=require(_0x5e99('0x0'));module[_0x5e99('0x1')]={'name':{'type':Sequelize[_0x5e99('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5e99('0x3')](_0x5e99('0x4'),_0x5e99('0x5'),_0x5e99('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x5e99('0x7'),'Dynamics365')},'data1':{'type':Sequelize[_0x5e99('0x2')],'comment':_0x5e99('0x8')},'data2':{'type':Sequelize[_0x5e99('0x2')],'comment':_0x5e99('0x9')},'data3':{'type':Sequelize[_0x5e99('0x2')],'comment':_0x5e99('0xa')},'data4':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x5e99('0xb')],'comment':_0x5e99('0xc')},'data6':{'type':Sequelize[_0x5e99('0xb')],'comment':_0x5e99('0xd')},'data7':{'type':Sequelize[_0x5e99('0xb')],'comment':_0x5e99('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 726e01a..3e048d4 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 _0xbcd2=['state','parse','from','base64','ascii','id_token','oauth2Claims','getOauth2MicrosoftAccessToken','code','access_token','data6','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','padEnd','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','service','MicrosoftAzure','data3','show','params','keys','find','decryptString','body','Name\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','create','update','encryptString','catch','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get'];(function(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0xbcd2,0x1d0));var _0x2bcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var Redis=require(_0x2bcd('0x0'));var qs=require(_0x2bcd('0x1'));var encryptor=require(_0x2bcd('0x2'));var config=require('../../config/environment');var logger=require(_0x2bcd('0x3'))('api');var db=require(_0x2bcd('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x2bcd('0x5')]=_['defaults'](config[_0x2bcd('0x5')],{'host':_0x2bcd('0x6'),'port':0x18eb});var socket=require(_0x2bcd('0x7'))(new Redis(config[_0x2bcd('0x5')]));var redis=new Redis(config[_0x2bcd('0x5')]);function respondWithStatusCode(_0x4b427e,_0x151946){_0x151946=_0x151946||0xcc;return function(_0x43f330){if(_0x43f330){return _0x4b427e[_0x2bcd('0x8')](_0x151946);}return _0x4b427e[_0x2bcd('0x9')](_0x151946)[_0x2bcd('0xa')]();};}function respondWithResult(_0x2c4a7f,_0x11598e){_0x11598e=_0x11598e||0xc8;return function(_0xdf2ad0){if(_0xdf2ad0){return _0x2c4a7f['status'](_0x11598e)[_0x2bcd('0xb')](_0xdf2ad0);}};}function respondWithFilteredResult(_0x58b7d0,_0x5b44ce){return function(_0xb33d18){if(_0xb33d18){var _0x2dc1a7=typeof _0x5b44ce[_0x2bcd('0xc')]===_0x2bcd('0xd')&&typeof _0x5b44ce[_0x2bcd('0xe')]===_0x2bcd('0xd');var _0x454d23=_0xb33d18[_0x2bcd('0xf')];var _0x2b4734=_0x2dc1a7?0x0:_0x5b44ce[_0x2bcd('0xc')];var _0x3f12f1=_0x2dc1a7?_0xb33d18[_0x2bcd('0xf')]:_0x5b44ce[_0x2bcd('0xc')]+_0x5b44ce[_0x2bcd('0xe')];var _0x340fb7;if(_0x3f12f1>=_0x454d23){_0x3f12f1=_0x454d23;_0x340fb7=0xc8;}else{_0x340fb7=0xce;}_0x58b7d0[_0x2bcd('0x9')](_0x340fb7);return _0x58b7d0[_0x2bcd('0x10')](_0x2bcd('0x11'),_0x2b4734+'-'+_0x3f12f1+'/'+_0x454d23)[_0x2bcd('0xb')](_0xb33d18);}return null;};}function saveUpdates(_0x15d8ad){return function(_0x398ceb){if(_0x398ceb){return _0x398ceb['update'](_0x15d8ad)[_0x2bcd('0x12')](function(_0x3a11b5){return _0x3a11b5;});}return null;};}function removeEntity(_0x38026b){return function(_0x5c94cc){if(_0x5c94cc){return _0x5c94cc[_0x2bcd('0x13')]()[_0x2bcd('0x12')](function(){_0x38026b[_0x2bcd('0x9')](0xcc)[_0x2bcd('0xa')]();});}};}function handleEntityNotFound(_0x11fb07){return function(_0x12b82a){if(!_0x12b82a){_0x11fb07[_0x2bcd('0x8')](0x194);}return _0x12b82a;};}function handleError(_0x46e6bf,_0x2ecf29){_0x2ecf29=_0x2ecf29||0x1f4;return function(_0x4a82f7){logger[_0x2bcd('0x14')](_0x4a82f7[_0x2bcd('0x15')]);if(_0x4a82f7['name']){delete _0x4a82f7[_0x2bcd('0x16')];}_0x46e6bf[_0x2bcd('0x9')](_0x2ecf29)[_0x2bcd('0x17')](_0x4a82f7);};}function maskClientSecret(_0x345f49){return _[_0x2bcd('0x18')](_0x345f49['slice'](0x0,0x3),0x14,'*');}exports[_0x2bcd('0x19')]=function(_0x4cf1c2,_0xf63736){var _0x520392={},_0x540241={},_0x114c0a={'count':0x0,'rows':[]};var _0xf2796f=_[_0x2bcd('0x1a')](db[_0x2bcd('0x1b')][_0x2bcd('0x1c')],function(_0x15861d){return{'name':_0x15861d[_0x2bcd('0x1d')],'type':_0x15861d[_0x2bcd('0x1e')][_0x2bcd('0x1f')]};});_0x540241[_0x2bcd('0x20')]=_[_0x2bcd('0x1a')](_0xf2796f,'name');_0x540241['query']=_['keys'](_0x4cf1c2[_0x2bcd('0x21')]);_0x540241[_0x2bcd('0x22')]=_[_0x2bcd('0x23')](_0x540241[_0x2bcd('0x20')],_0x540241[_0x2bcd('0x21')]);_0x520392[_0x2bcd('0x24')]=_[_0x2bcd('0x23')](_0x540241[_0x2bcd('0x20')],qs[_0x2bcd('0x25')](_0x4cf1c2[_0x2bcd('0x21')][_0x2bcd('0x25')]));_0x520392['attributes']=_0x520392['attributes'][_0x2bcd('0x26')]?_0x520392[_0x2bcd('0x24')]:_0x540241[_0x2bcd('0x20')];if(!_0x4cf1c2['query']['hasOwnProperty'](_0x2bcd('0x27'))){_0x520392[_0x2bcd('0xe')]=qs[_0x2bcd('0xe')](_0x4cf1c2[_0x2bcd('0x21')][_0x2bcd('0xe')]);_0x520392[_0x2bcd('0xc')]=qs['offset'](_0x4cf1c2[_0x2bcd('0x21')][_0x2bcd('0xc')]);}_0x520392['order']=qs[_0x2bcd('0x28')](_0x4cf1c2[_0x2bcd('0x21')][_0x2bcd('0x28')]);_0x520392[_0x2bcd('0x29')]=qs[_0x2bcd('0x22')](_[_0x2bcd('0x2a')](_0x4cf1c2['query'],_0x540241['filters']),_0xf2796f);if(_0x4cf1c2['query']['filter']){_0x520392[_0x2bcd('0x29')]=_[_0x2bcd('0x2b')](_0x520392[_0x2bcd('0x29')],{'$or':_[_0x2bcd('0x1a')](_0xf2796f,function(_0x31af39){if(_0x31af39[_0x2bcd('0x1e')]!==_0x2bcd('0x2c')){var _0x4328d4={};_0x4328d4[_0x31af39[_0x2bcd('0x16')]]={'$like':'%'+_0x4cf1c2[_0x2bcd('0x21')]['filter']+'%'};return _0x4328d4;}})});}_0x520392=_[_0x2bcd('0x2b')]({},_0x520392,_0x4cf1c2[_0x2bcd('0x2d')]);var _0x5b739c={'where':_0x520392[_0x2bcd('0x29')]};return db[_0x2bcd('0x1b')][_0x2bcd('0xf')](_0x5b739c)['then'](function(_0x1edbf9){_0x114c0a[_0x2bcd('0xf')]=_0x1edbf9;if(_0x4cf1c2[_0x2bcd('0x21')][_0x2bcd('0x2e')]){_0x520392[_0x2bcd('0x2f')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x520392);})[_0x2bcd('0x12')](function(_0x4e6226){_0x114c0a[_0x2bcd('0x30')]=_[_0x2bcd('0x1a')](_0x4e6226,function(_0x5a2129){if(_0x5a2129[_0x2bcd('0x31')]===_0x2bcd('0x32')){var _0x11550d=encryptor['decryptString'](_0x5a2129[_0x2bcd('0x33')]);_0x5a2129[_0x2bcd('0x33')]=maskClientSecret(_0x11550d);}return _0x5a2129;});return _0x114c0a;})['then'](respondWithFilteredResult(_0xf63736,_0x520392))['catch'](handleError(_0xf63736,null));};exports[_0x2bcd('0x34')]=function(_0x330df3,_0x5e4ae7){var _0x481ad0={'raw':!![],'where':{'id':_0x330df3[_0x2bcd('0x35')]['id']}},_0x10813a={};_0x10813a['model']=_[_0x2bcd('0x36')](db['CloudProvider'][_0x2bcd('0x1c')]);_0x10813a[_0x2bcd('0x21')]=_[_0x2bcd('0x36')](_0x330df3['query']);_0x10813a[_0x2bcd('0x22')]=_['intersection'](_0x10813a['model'],_0x10813a[_0x2bcd('0x21')]);_0x481ad0[_0x2bcd('0x24')]=_[_0x2bcd('0x23')](_0x10813a[_0x2bcd('0x20')],qs[_0x2bcd('0x25')](_0x330df3[_0x2bcd('0x21')][_0x2bcd('0x25')]));_0x481ad0[_0x2bcd('0x24')]=_0x481ad0['attributes'][_0x2bcd('0x26')]?_0x481ad0[_0x2bcd('0x24')]:_0x10813a[_0x2bcd('0x20')];if(_0x330df3[_0x2bcd('0x21')][_0x2bcd('0x2e')]){_0x481ad0[_0x2bcd('0x2f')]=[{'all':!![]}];}_0x481ad0=_[_0x2bcd('0x2b')]({},_0x481ad0,_0x330df3[_0x2bcd('0x2d')]);return db[_0x2bcd('0x1b')][_0x2bcd('0x37')](_0x481ad0)['then'](handleEntityNotFound(_0x5e4ae7,null))['then'](function(_0x14a89f){if(_0x14a89f[_0x2bcd('0x31')]===_0x2bcd('0x32')){var _0x327d82=encryptor[_0x2bcd('0x38')](_0x14a89f['data3']);_0x14a89f[_0x2bcd('0x33')]=maskClientSecret(_0x327d82);}return _0x14a89f;})[_0x2bcd('0x12')](respondWithResult(_0x5e4ae7,null))['catch'](handleError(_0x5e4ae7,null));};exports['create']=function(_0x1207be,_0x4997b9){if(!_0x1207be[_0x2bcd('0x39')][_0x2bcd('0x16')])throw new Error(_0x2bcd('0x3a'));if(!_0x1207be['body'][_0x2bcd('0x31')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x25edeb=db[_0x2bcd('0x1b')][_0x2bcd('0x1c')][_0x2bcd('0x31')][_0x2bcd('0x3b')];if(!_0x25edeb[_0x2bcd('0x3c')](_0x1207be['body'][_0x2bcd('0x31')]))throw new Error(_0x2bcd('0x3d')+_0x25edeb['join'](',\x20'));if(_0x1207be[_0x2bcd('0x39')][_0x2bcd('0x31')]===_0x2bcd('0x32')&&_0x1207be['body'][_0x2bcd('0x33')]){_0x1207be['body']['data3']=encryptor['encryptString'](_0x1207be[_0x2bcd('0x39')]['data3']);}return db[_0x2bcd('0x1b')][_0x2bcd('0x3e')](_0x1207be[_0x2bcd('0x39')],{})[_0x2bcd('0x12')](respondWithResult(_0x4997b9,0xc9))['catch'](handleError(_0x4997b9,null));};exports[_0x2bcd('0x3f')]=function(_0x55ac1f,_0x78555c){if(_0x55ac1f[_0x2bcd('0x39')]['id']){delete _0x55ac1f[_0x2bcd('0x39')]['id'];}return db[_0x2bcd('0x1b')][_0x2bcd('0x37')]({'where':{'id':_0x55ac1f[_0x2bcd('0x35')]['id']}})[_0x2bcd('0x12')](handleEntityNotFound(_0x78555c,null))[_0x2bcd('0x12')](function(_0x1c01ae){if(_0x1c01ae[_0x2bcd('0x31')]==='MicrosoftAzure'&&_0x55ac1f[_0x2bcd('0x39')]['data3']){_0x55ac1f['body']['data3']=encryptor[_0x2bcd('0x40')](_0x55ac1f[_0x2bcd('0x39')][_0x2bcd('0x33')]);}return _0x1c01ae;})[_0x2bcd('0x12')](saveUpdates(_0x55ac1f[_0x2bcd('0x39')],null))[_0x2bcd('0x12')](respondWithResult(_0x78555c,null))['catch'](handleError(_0x78555c,null));};exports[_0x2bcd('0x13')]=function(_0x3031b8,_0x2ebae1){return db['CloudProvider']['find']({'where':{'id':_0x3031b8[_0x2bcd('0x35')]['id']}})['then'](handleEntityNotFound(_0x2ebae1,null))[_0x2bcd('0x12')](removeEntity(_0x2ebae1,null))[_0x2bcd('0x41')](handleError(_0x2ebae1,null));};exports['oauth2MicrosoftAuthorize']=function(_0x5a1ff9,_0x124583){return db[_0x2bcd('0x1b')][_0x2bcd('0x42')]({'where':{'id':_0x5a1ff9['params']['id']},'raw':!![]})[_0x2bcd('0x12')](function(_0x4cb16d){if(!_0x4cb16d)return _0x124583[_0x2bcd('0x8')](0x194);return{'url':oauth[_0x2bcd('0x43')](_0x4cb16d,_0x5a1ff9['user']['id'])};})[_0x2bcd('0x12')](respondWithResult(_0x124583,null))[_0x2bcd('0x41')](handleError(_0x124583,null));};exports[_0x2bcd('0x44')]=function(_0x2fba5a,_0x16857e){var _0x2b566f=_0x2fba5a[_0x2bcd('0x39')];var _0x17f2b9;var _0x34c9a6;if(_0x2b566f['error'])throw _0x2b566f;redis[_0x2bcd('0x45')](_0x2b566f[_0x2bcd('0x46')])[_0x2bcd('0x12')](function(_0x1e72ea){if(!_0x1e72ea)throw new Error('Invalid\x20state\x20parameter');_0x17f2b9=JSON[_0x2bcd('0x47')](_0x1e72ea);var _0x4832b8=Buffer[_0x2bcd('0x48')](_0x2b566f[_0x2bcd('0x46')],_0x2bcd('0x49'))['toString'](_0x2bcd('0x4a'));_0x34c9a6=JSON[_0x2bcd('0x47')](_0x4832b8);if(!oauth['isValidIdToken'](_0x2b566f[_0x2bcd('0x4b')],_0x17f2b9[_0x2bcd('0x4c')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x2b566f['state']);return oauth[_0x2bcd('0x4d')](_0x2b566f[_0x2bcd('0x4e')],_0x17f2b9);})[_0x2bcd('0x12')](function(_0x3b423f){_0x17f2b9['data5']=_0x3b423f[_0x2bcd('0x4f')];_0x17f2b9[_0x2bcd('0x50')]=_0x3b423f['refresh_token'];return db[_0x2bcd('0x1b')]['update']({'data5':_0x17f2b9[_0x2bcd('0x51')],'data6':_0x17f2b9[_0x2bcd('0x50')]},{'where':{'id':_0x17f2b9['id']}});})['then'](function(){oauth[_0x2bcd('0x52')](_0x17f2b9);socket[_0x2bcd('0x53')](_0x2bcd('0x54'),{'id':_0x34c9a6['id']});return;})['then'](respondWithStatusCode(_0x16857e,null))[_0x2bcd('0x41')](function(_0x3a2cf2){if(_0x34c9a6){socket['emit'](_0x2bcd('0x55'),{'id':_0x34c9a6['id']});}if(!_0x17f2b9){logger[_0x2bcd('0x14')]('Invalid\x20authentication\x20state\x20parameter',_0x3a2cf2);return _0x16857e[_0x2bcd('0x9')](0x1f4)['send'](_0x3a2cf2[_0x2bcd('0x56')]);}logger[_0x2bcd('0x14')](_0x2bcd('0x57'),_0x17f2b9['id'],JSON[_0x2bcd('0x58')](_0x3a2cf2));});}; \ No newline at end of file +var _0x407e=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','then','rows','service','MicrosoftAzure','data3','params','rawAttributes','find','decryptString','body','Service\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','catch','oauth2MicrosoftAuthorize','user','get','Invalid\x20state\x20parameter','parse','state','toString','ascii','isValidIdToken','id_token','oauth2Claims','code','data5','data6','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','stringify','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','error','stack','name','send','slice','index','map','CloudProvider','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x5c4519,_0x1f73ef){var _0x1706c4=function(_0x1061de){while(--_0x1061de){_0x5c4519['push'](_0x5c4519['shift']());}};_0x1706c4(++_0x1f73ef);}(_0x407e,0x12a));var _0xe407=function(_0x5e9817,_0xa29439){_0x5e9817=_0x5e9817-0x0;var _0x25b437=_0x407e[_0x5e9817];return _0x25b437;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xe407('0x0'));var encryptor=require(_0xe407('0x1'));var config=require(_0xe407('0x2'));var logger=require(_0xe407('0x3'))('api');var db=require(_0xe407('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config[_0xe407('0x5')]=_['defaults'](config[_0xe407('0x5')],{'host':_0xe407('0x6'),'port':0x18eb});var socket=require(_0xe407('0x7'))(new Redis(config[_0xe407('0x5')]));var redis=new Redis(config[_0xe407('0x5')]);function respondWithStatusCode(_0x35979e,_0xb2b400){_0xb2b400=_0xb2b400||0xcc;return function(_0x11c7b0){if(_0x11c7b0){return _0x35979e[_0xe407('0x8')](_0xb2b400);}return _0x35979e[_0xe407('0x9')](_0xb2b400)[_0xe407('0xa')]();};}function respondWithResult(_0xf470ed,_0xeceb35){_0xeceb35=_0xeceb35||0xc8;return function(_0x5bdb32){if(_0x5bdb32){return _0xf470ed[_0xe407('0x9')](_0xeceb35)[_0xe407('0xb')](_0x5bdb32);}};}function respondWithFilteredResult(_0x452329,_0x1bad48){return function(_0x13475e){if(_0x13475e){var _0x4a2231=typeof _0x1bad48[_0xe407('0xc')]===_0xe407('0xd')&&typeof _0x1bad48[_0xe407('0xe')]===_0xe407('0xd');var _0x45d514=_0x13475e[_0xe407('0xf')];var _0x3b7f0d=_0x4a2231?0x0:_0x1bad48[_0xe407('0xc')];var _0x2446b0=_0x4a2231?_0x13475e[_0xe407('0xf')]:_0x1bad48[_0xe407('0xc')]+_0x1bad48['limit'];var _0x302c4e;if(_0x2446b0>=_0x45d514){_0x2446b0=_0x45d514;_0x302c4e=0xc8;}else{_0x302c4e=0xce;}_0x452329[_0xe407('0x9')](_0x302c4e);return _0x452329[_0xe407('0x10')](_0xe407('0x11'),_0x3b7f0d+'-'+_0x2446b0+'/'+_0x45d514)[_0xe407('0xb')](_0x13475e);}return null;};}function saveUpdates(_0x43a5e6){return function(_0x164870){if(_0x164870){return _0x164870[_0xe407('0x12')](_0x43a5e6)['then'](function(_0x7ee02){return _0x7ee02;});}return null;};}function removeEntity(_0x3932ae){return function(_0x37fc90){if(_0x37fc90){return _0x37fc90['destroy']()['then'](function(){_0x3932ae[_0xe407('0x9')](0xcc)[_0xe407('0xa')]();});}};}function handleEntityNotFound(_0x412b4b){return function(_0x3f7e44){if(!_0x3f7e44){_0x412b4b[_0xe407('0x8')](0x194);}return _0x3f7e44;};}function handleError(_0x3c72cd,_0x531569){_0x531569=_0x531569||0x1f4;return function(_0x3c2ac2){logger[_0xe407('0x13')](_0x3c2ac2[_0xe407('0x14')]);if(_0x3c2ac2['name']){delete _0x3c2ac2[_0xe407('0x15')];}_0x3c72cd[_0xe407('0x9')](_0x531569)[_0xe407('0x16')](_0x3c2ac2);};}function maskClientSecret(_0x3963b0){return _['padEnd'](_0x3963b0[_0xe407('0x17')](0x0,0x3),0x14,'*');}exports[_0xe407('0x18')]=function(_0x2ff71d,_0x1cce4e){var _0x452825={},_0x5ac61a={},_0x5c9dcc={'count':0x0,'rows':[]};var _0x533b14=_[_0xe407('0x19')](db[_0xe407('0x1a')]['rawAttributes'],function(_0x5ab875){return{'name':_0x5ab875[_0xe407('0x1b')],'type':_0x5ab875[_0xe407('0x1c')][_0xe407('0x1d')]};});_0x5ac61a[_0xe407('0x1e')]=_['map'](_0x533b14,_0xe407('0x15'));_0x5ac61a[_0xe407('0x1f')]=_[_0xe407('0x20')](_0x2ff71d['query']);_0x5ac61a[_0xe407('0x21')]=_[_0xe407('0x22')](_0x5ac61a[_0xe407('0x1e')],_0x5ac61a[_0xe407('0x1f')]);_0x452825['attributes']=_[_0xe407('0x22')](_0x5ac61a[_0xe407('0x1e')],qs[_0xe407('0x23')](_0x2ff71d[_0xe407('0x1f')][_0xe407('0x23')]));_0x452825[_0xe407('0x24')]=_0x452825['attributes'][_0xe407('0x25')]?_0x452825[_0xe407('0x24')]:_0x5ac61a[_0xe407('0x1e')];if(!_0x2ff71d['query'][_0xe407('0x26')](_0xe407('0x27'))){_0x452825[_0xe407('0xe')]=qs[_0xe407('0xe')](_0x2ff71d['query'][_0xe407('0xe')]);_0x452825[_0xe407('0xc')]=qs[_0xe407('0xc')](_0x2ff71d[_0xe407('0x1f')][_0xe407('0xc')]);}_0x452825[_0xe407('0x28')]=qs[_0xe407('0x29')](_0x2ff71d[_0xe407('0x1f')][_0xe407('0x29')]);_0x452825[_0xe407('0x2a')]=qs[_0xe407('0x21')](_[_0xe407('0x2b')](_0x2ff71d[_0xe407('0x1f')],_0x5ac61a[_0xe407('0x21')]),_0x533b14);if(_0x2ff71d['query'][_0xe407('0x2c')]){_0x452825[_0xe407('0x2a')]=_[_0xe407('0x2d')](_0x452825[_0xe407('0x2a')],{'$or':_[_0xe407('0x19')](_0x533b14,function(_0x520263){if(_0x520263[_0xe407('0x1c')]!==_0xe407('0x2e')){var _0x46aaf3={};_0x46aaf3[_0x520263[_0xe407('0x15')]]={'$like':'%'+_0x2ff71d['query'][_0xe407('0x2c')]+'%'};return _0x46aaf3;}})});}_0x452825=_['merge']({},_0x452825,_0x2ff71d[_0xe407('0x2f')]);var _0x5646c8={'where':_0x452825[_0xe407('0x2a')]};return db[_0xe407('0x1a')][_0xe407('0xf')](_0x5646c8)['then'](function(_0x35b493){_0x5c9dcc['count']=_0x35b493;if(_0x2ff71d[_0xe407('0x1f')][_0xe407('0x30')]){_0x452825[_0xe407('0x31')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x452825);})[_0xe407('0x32')](function(_0x4ab106){_0x5c9dcc[_0xe407('0x33')]=_['map'](_0x4ab106,function(_0x2fbfec){if(_0x2fbfec[_0xe407('0x34')]===_0xe407('0x35')){var _0x2ef071=encryptor['decryptString'](_0x2fbfec[_0xe407('0x36')]);_0x2fbfec[_0xe407('0x36')]=maskClientSecret(_0x2ef071);}return _0x2fbfec;});return _0x5c9dcc;})['then'](respondWithFilteredResult(_0x1cce4e,_0x452825))['catch'](handleError(_0x1cce4e,null));};exports['show']=function(_0x4a59a6,_0x267d1f){var _0x4f26d2={'raw':!![],'where':{'id':_0x4a59a6[_0xe407('0x37')]['id']}},_0x1b0982={};_0x1b0982[_0xe407('0x1e')]=_[_0xe407('0x20')](db['CloudProvider'][_0xe407('0x38')]);_0x1b0982[_0xe407('0x1f')]=_[_0xe407('0x20')](_0x4a59a6[_0xe407('0x1f')]);_0x1b0982[_0xe407('0x21')]=_[_0xe407('0x22')](_0x1b0982[_0xe407('0x1e')],_0x1b0982[_0xe407('0x1f')]);_0x4f26d2[_0xe407('0x24')]=_[_0xe407('0x22')](_0x1b0982[_0xe407('0x1e')],qs['fields'](_0x4a59a6[_0xe407('0x1f')]['fields']));_0x4f26d2[_0xe407('0x24')]=_0x4f26d2[_0xe407('0x24')]['length']?_0x4f26d2[_0xe407('0x24')]:_0x1b0982[_0xe407('0x1e')];if(_0x4a59a6['query'][_0xe407('0x30')]){_0x4f26d2[_0xe407('0x31')]=[{'all':!![]}];}_0x4f26d2=_[_0xe407('0x2d')]({},_0x4f26d2,_0x4a59a6[_0xe407('0x2f')]);return db[_0xe407('0x1a')][_0xe407('0x39')](_0x4f26d2)[_0xe407('0x32')](handleEntityNotFound(_0x267d1f,null))['then'](function(_0x4da36d){if(_0x4da36d['service']===_0xe407('0x35')){var _0xd63c3f=encryptor[_0xe407('0x3a')](_0x4da36d['data3']);_0x4da36d[_0xe407('0x36')]=maskClientSecret(_0xd63c3f);}return _0x4da36d;})[_0xe407('0x32')](respondWithResult(_0x267d1f,null))['catch'](handleError(_0x267d1f,null));};exports['create']=function(_0x3c1c64,_0x5c1393){if(!_0x3c1c64['body'][_0xe407('0x15')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x3c1c64[_0xe407('0x3b')][_0xe407('0x34')])throw new Error(_0xe407('0x3c'));var _0x497b38=db[_0xe407('0x1a')]['rawAttributes'][_0xe407('0x34')][_0xe407('0x3d')];if(!_0x497b38['includes'](_0x3c1c64[_0xe407('0x3b')][_0xe407('0x34')]))throw new Error(_0xe407('0x3e')+_0x497b38[_0xe407('0x3f')](',\x20'));if(_0x3c1c64[_0xe407('0x3b')][_0xe407('0x34')]===_0xe407('0x35')&&_0x3c1c64[_0xe407('0x3b')][_0xe407('0x36')]){_0x3c1c64[_0xe407('0x3b')][_0xe407('0x36')]=encryptor[_0xe407('0x40')](_0x3c1c64[_0xe407('0x3b')][_0xe407('0x36')]);}return db[_0xe407('0x1a')][_0xe407('0x41')](_0x3c1c64[_0xe407('0x3b')],{})[_0xe407('0x32')](respondWithResult(_0x5c1393,0xc9))['catch'](handleError(_0x5c1393,null));};exports[_0xe407('0x12')]=function(_0x5982a3,_0x1f5d4d){if(_0x5982a3[_0xe407('0x3b')]['id']){delete _0x5982a3['body']['id'];}return db['CloudProvider'][_0xe407('0x39')]({'where':{'id':_0x5982a3[_0xe407('0x37')]['id']}})[_0xe407('0x32')](handleEntityNotFound(_0x1f5d4d,null))[_0xe407('0x32')](function(_0x34a180){if(_0x34a180[_0xe407('0x34')]===_0xe407('0x35')&&_0x5982a3[_0xe407('0x3b')][_0xe407('0x36')]){_0x5982a3['body']['data3']=encryptor[_0xe407('0x40')](_0x5982a3[_0xe407('0x3b')][_0xe407('0x36')]);}return _0x34a180;})[_0xe407('0x32')](saveUpdates(_0x5982a3[_0xe407('0x3b')],null))['then'](respondWithResult(_0x1f5d4d,null))[_0xe407('0x42')](handleError(_0x1f5d4d,null));};exports['destroy']=function(_0x1aa1ff,_0x361f65){return db[_0xe407('0x1a')]['find']({'where':{'id':_0x1aa1ff[_0xe407('0x37')]['id']}})[_0xe407('0x32')](handleEntityNotFound(_0x361f65,null))['then'](removeEntity(_0x361f65,null))[_0xe407('0x42')](handleError(_0x361f65,null));};exports[_0xe407('0x43')]=function(_0x147162,_0x584867){return db[_0xe407('0x1a')]['findOne']({'where':{'id':_0x147162[_0xe407('0x37')]['id']},'raw':!![]})[_0xe407('0x32')](function(_0x409626){if(!_0x409626)return _0x584867[_0xe407('0x8')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x409626,_0x147162[_0xe407('0x44')]['id'])};})[_0xe407('0x32')](respondWithResult(_0x584867,null))[_0xe407('0x42')](handleError(_0x584867,null));};exports['oauth2MicrosoftCallback']=function(_0x58605f,_0x45be4a){var _0x30afa9=_0x58605f[_0xe407('0x3b')];var _0x2f7cdc;var _0x1cc1e6;if(_0x30afa9[_0xe407('0x13')])throw _0x30afa9;redis[_0xe407('0x45')](_0x30afa9['state'])[_0xe407('0x32')](function(_0x29b019){if(!_0x29b019)throw new Error(_0xe407('0x46'));_0x2f7cdc=JSON[_0xe407('0x47')](_0x29b019);var _0x5fd8d4=Buffer['from'](_0x30afa9[_0xe407('0x48')],'base64')[_0xe407('0x49')](_0xe407('0x4a'));_0x1cc1e6=JSON[_0xe407('0x47')](_0x5fd8d4);if(!oauth[_0xe407('0x4b')](_0x30afa9[_0xe407('0x4c')],_0x2f7cdc[_0xe407('0x4d')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x30afa9[_0xe407('0x48')]);return oauth['getOauth2MicrosoftAccessToken'](_0x30afa9[_0xe407('0x4e')],_0x2f7cdc);})[_0xe407('0x32')](function(_0x5de9e2){_0x2f7cdc[_0xe407('0x4f')]=_0x5de9e2['access_token'];_0x2f7cdc[_0xe407('0x50')]=_0x5de9e2['refresh_token'];return db[_0xe407('0x1a')][_0xe407('0x12')]({'data5':_0x2f7cdc[_0xe407('0x4f')],'data6':_0x2f7cdc[_0xe407('0x50')]},{'where':{'id':_0x2f7cdc['id']}});})[_0xe407('0x32')](function(){oauth['startRefreshInterval'](_0x2f7cdc);socket[_0xe407('0x51')](_0xe407('0x52'),{'id':_0x1cc1e6['id']});return;})[_0xe407('0x32')](respondWithStatusCode(_0x45be4a,null))['catch'](function(_0x46b1d1){if(_0x1cc1e6){socket['emit']('microsoftAuthorization:error',{'id':_0x1cc1e6['id']});}if(!_0x2f7cdc){logger[_0xe407('0x13')](_0xe407('0x53'),_0x46b1d1);return _0x45be4a[_0xe407('0x9')](0x1f4)[_0xe407('0x16')](_0x46b1d1['message']);}logger[_0xe407('0x13')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x2f7cdc['id'],JSON[_0xe407('0x54')](_0x46b1d1));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 16678d4..f246ac9 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 _0xaecc=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','CloudProvider','util','../../config/logger'];(function(_0x9f0bdf,_0x14e6ca){var _0x523eca=function(_0x3ac7f6){while(--_0x3ac7f6){_0x9f0bdf['push'](_0x9f0bdf['shift']());}};_0x523eca(++_0x14e6ca);}(_0xaecc,0x153));var _0xcaec=function(_0x493df0,_0x3808fe){_0x493df0=_0x493df0-0x0;var _0x4b6a03=_0xaecc[_0x493df0];return _0x4b6a03;};'use strict';var _=require('lodash');var util=require(_0xcaec('0x0'));var logger=require(_0xcaec('0x1'))(_0xcaec('0x2'));var moment=require(_0xcaec('0x3'));var BPromise=require(_0xcaec('0x4'));var rp=require(_0xcaec('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcaec('0x6'));var config=require(_0xcaec('0x7'));var attributes=require('./cloudProvider.attributes');module[_0xcaec('0x8')]=function(_0x37e146,_0x4a0388){return _0x37e146[_0xcaec('0x9')](_0xcaec('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47b9=['cloud_providers','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./cloudProvider.attributes','define','CloudProvider'];(function(_0x369458,_0x1d7188){var _0x5266f9=function(_0x3123aa){while(--_0x3123aa){_0x369458['push'](_0x369458['shift']());}};_0x5266f9(++_0x1d7188);}(_0x47b9,0x135));var _0x947b=function(_0x35fb56,_0x5dadff){_0x35fb56=_0x35fb56-0x0;var _0x2fd52c=_0x47b9[_0x35fb56];return _0x2fd52c;};'use strict';var _=require(_0x947b('0x0'));var util=require(_0x947b('0x1'));var logger=require(_0x947b('0x2'))('api');var moment=require(_0x947b('0x3'));var BPromise=require(_0x947b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x947b('0x5'));var rimraf=require('rimraf');var config=require(_0x947b('0x6'));var attributes=require(_0x947b('0x7'));module['exports']=function(_0xb6b32e,_0x12d0d3){return _0xb6b32e[_0x947b('0x8')](_0x947b('0x9'),attributes,{'tableName':_0x947b('0xa'),'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 4796fe8..5f03016 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 _0x5918=['Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','defaults','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','data7','/.default','replace','{TENANT_ID}','code','from','stringify','base64','randomBytes','hex','client_id','data1','join','redirect_uri','data4','response_mode','form_post','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','set','decode','payload','iss','aud','isAfter','resolve','then','data3','CloudProvider','findOne','refresh_token','decryptString','data5','access_token','data6','catch','error'];(function(_0xe1441d,_0x36fb8e){var _0x2ef242=function(_0x52bf2d){while(--_0x52bf2d){_0xe1441d['push'](_0xe1441d['shift']());}};_0x2ef242(++_0x36fb8e);}(_0x5918,0x1cc));var _0x8591=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5918[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8591('0x0'));var crypto=require(_0x8591('0x1'));var jwt=require(_0x8591('0x2'));var moment=require('moment');var Redis=require(_0x8591('0x3'));var rp=require(_0x8591('0x4'));var util=require('util');var encryptor=require(_0x8591('0x5'));var config=require('../../config/environment');var logger=require(_0x8591('0x6'))(_0x8591('0x7'));var schedule=require(_0x8591('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8591('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x8591('0xa')]);var MICROSOFT_AUTH_URL=_0x8591('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0x8591('0xc'),'profile',_0x8591('0xd'),_0x8591('0xe'),_0x8591('0xf'),'https://outlook.office.com/POP.AccessAsUser.All',_0x8591('0x10')],'Dynamics365':[_0x8591('0xc'),_0x8591('0xe')]};var MICROSOFT_AUTH_ENDPOINT=_0x8591('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0x8591('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x16e6be){var _0x1c2b74=_[_0x8591('0x13')](AZURE_AUTH_SCOPES[_0x16e6be[_0x8591('0x14')]]);if(_0x16e6be[_0x8591('0x14')]===_0x8591('0x15'))_0x1c2b74['push'](_0x16e6be[_0x8591('0x16')]+'/.default');return _0x1c2b74['join']('\x20');}function getAccessTokenScope(_0x5d6181){if(_0x5d6181[_0x8591('0x14')]==='Outlook365')return _0x8591('0xf');if(_0x5d6181[_0x8591('0x14')]===_0x8591('0x15'))return _0x5d6181[_0x8591('0x16')]+_0x8591('0x17');}function generateMicrosoftAuthorizationUrl(_0x54df18,_0x49486a){var _0x14e9a9=MICROSOFT_AUTH_URL[_0x8591('0x18')](_0x8591('0x19'),_0x54df18['data2']);var _0x467eed=[_0x8591('0x1a'),'id_token'];var _0x374fe8=Buffer[_0x8591('0x1b')](JSON[_0x8591('0x1c')]({'id':_0x49486a}))['toString'](_0x8591('0x1d'));var _0x1c4ef4=crypto[_0x8591('0x1e')](0x10)['toString'](_0x8591('0x1f'));var _0x4d6b6a=getAuthorizationScopes(_0x54df18);var _0x320e62=[{'key':_0x8591('0x20'),'value':_0x54df18[_0x8591('0x21')]},{'key':'response_type','value':encodeURIComponent(_0x467eed[_0x8591('0x22')]('\x20'))},{'key':_0x8591('0x23'),'value':_0x54df18[_0x8591('0x24')]},{'key':_0x8591('0x25'),'value':_0x8591('0x26')},{'key':'scope','value':encodeURIComponent(_0x4d6b6a)},{'key':_0x8591('0x27'),'value':_0x374fe8},{'key':_0x8591('0x28'),'value':_0x1c4ef4},{'key':_0x8591('0x29'),'value':_0x8591('0x2a')}];var _0xd98c84=_0x14e9a9+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x8591('0x13')](_0x320e62,function(_0x1b89d5){return _0x1b89d5[_0x8591('0x2b')]+'='+_0x1b89d5[_0x8591('0x2c')];})[_0x8591('0x22')]('&');_0x54df18[_0x8591('0x2d')]={'issuer':_0x14e9a9[_0x8591('0x18')](_0x8591('0x2e'),''),'audience':_0x54df18[_0x8591('0x21')],'state':_0x374fe8,'nonce':_0x1c4ef4};redis[_0x8591('0x2f')](_0x374fe8,JSON[_0x8591('0x1c')](_0x54df18));return _0xd98c84;}function isValidIdToken(_0x374791,_0x586e06){try{var _0xbcbdff=jwt[_0x8591('0x30')](_0x374791,{'complete':!![]});var _0x464620=_0xbcbdff[_0x8591('0x31')];if(_0x464620[_0x8591('0x32')]!==_0x586e06['issuer'])return![];if(_0x464620[_0x8591('0x33')]!==_0x586e06['audience'])return![];if(_0x464620[_0x8591('0x28')]!==_0x586e06[_0x8591('0x28')])return![];if(moment()[_0x8591('0x34')](moment['unix'](_0x464620['exp'])))return![];return!![];}catch(_0x1a8c8c){throw _0x1a8c8c;}}function refreshOauth2MicrosoftAccessToken(_0x2d12dc){return Promise[_0x8591('0x35')]()[_0x8591('0x36')](function(){if(_0x2d12dc[_0x8591('0x37')])return _0x2d12dc;return db[_0x8591('0x38')][_0x8591('0x39')]({'where':{'id':_0x2d12dc['id']},'raw':!![]});})[_0x8591('0x36')](function(_0x4794b6){var _0x49ec15={'grant_type':_0x8591('0x3a'),'refresh_token':_0x4794b6['data6'],'scope':getAccessTokenScope(_0x4794b6),'redirect_uri':_0x4794b6[_0x8591('0x24')],'client_id':_0x4794b6['data1'],'client_secret':encryptor[_0x8591('0x3b')](_0x4794b6['data3'])};var _0x5b2b6f={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x8591('0x19'),_0x4794b6['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x49ec15,'json':!![]};return rp(_0x5b2b6f);})[_0x8591('0x36')](function(_0x54900d){_0x2d12dc[_0x8591('0x3c')]=_0x54900d[_0x8591('0x3d')];_0x2d12dc['data6']=_0x54900d[_0x8591('0x3a')];return db[_0x8591('0x38')]['update']({'data5':_0x2d12dc['data5'],'data6':_0x2d12dc[_0x8591('0x3e')]},{'where':{'id':_0x2d12dc['id']}});})[_0x8591('0x36')](function(){return _0x2d12dc;})[_0x8591('0x3f')](function(_0x112f02){logger[_0x8591('0x40')](_0x8591('0x41'),_0x2d12dc['id'],_0x112f02);});}function getOauth2MicrosoftAccessToken(_0x3a0494,_0x5bb87e){var _0x3f84a5={'grant_type':_0x8591('0x42'),'code':_0x3a0494,'scope':getAccessTokenScope(_0x5bb87e),'redirect_uri':_0x5bb87e['data4'],'client_id':_0x5bb87e[_0x8591('0x21')],'client_secret':encryptor['decryptString'](_0x5bb87e[_0x8591('0x37')])};var _0xcfb055={'method':_0x8591('0x43'),'uri':MICROSOFT_AUTH_URL[_0x8591('0x18')]('{TENANT_ID}',_0x5bb87e['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3f84a5,'json':!![]};return rp(_0xcfb055);}function startRefreshInterval(_0x30da7c){var _0x3363aa=schedule[_0x8591('0x44')];if(_0x3363aa[_0x30da7c['id']])clearInterval(_0x3363aa[_0x30da7c['id']]);_0x3363aa[_0x30da7c['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x8591('0x45')](this,{'id':_0x30da7c['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x8591('0x44')]=_0x3363aa;}function startAllRefreshIntervals(){return db[_0x8591('0x38')][_0x8591('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x8591('0x36')](function(_0x12d626){var _0x4a2c45=_0x12d626[_0x8591('0x13')](function(_0x3b17ce){return refreshOauth2MicrosoftAccessToken(_0x3b17ce)['then'](function(_0x298245){startRefreshInterval(_0x298245);});});return Promise[_0x8591('0x47')](_0x4a2c45);})['catch'](function(_0x188782){var _0x22f4da=_0x188782?util[_0x8591('0x48')](_0x188782,{'showHidden':![],'depth':null}):'';logger[_0x8591('0x40')](_0x8591('0x49'),_0x22f4da);});}module[_0x8591('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x9a49=['data4','response_mode','form_post','scope','state','nonce','login','key','value','replace','set','decode','payload','iss','issuer','audience','isAfter','unix','exp','data3','findOne','then','data6','decryptString','{TENANT_ID}','access_token','refresh_token','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','bind','intervals','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token','map','type','Dynamics365','data7','/.default','join','https://outlook.office365.com/IMAP.AccessAsUser.All','data2','code','id_token','from','stringify','randomBytes','hex','client_id','data1','redirect_uri'];(function(_0x11fa4b,_0x2e0ec1){var _0x122a99=function(_0x305e92){while(--_0x305e92){_0x11fa4b['push'](_0x11fa4b['shift']());}};_0x122a99(++_0x2e0ec1);}(_0x9a49,0x1ad));var _0x99a4=function(_0x55e3f4,_0x35b064){_0x55e3f4=_0x55e3f4-0x0;var _0x387699=_0x9a49[_0x55e3f4];return _0x387699;};'use strict';var _=require(_0x99a4('0x0'));var crypto=require('crypto');var jwt=require(_0x99a4('0x1'));var moment=require(_0x99a4('0x2'));var Redis=require(_0x99a4('0x3'));var rp=require(_0x99a4('0x4'));var util=require(_0x99a4('0x5'));var encryptor=require(_0x99a4('0x6'));var config=require(_0x99a4('0x7'));var logger=require(_0x99a4('0x8'))('api');var schedule=require(_0x99a4('0x9'));var db=require(_0x99a4('0xa'))['db'];config[_0x99a4('0xb')]=_[_0x99a4('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x99a4('0xb')]);var MICROSOFT_AUTH_URL=_0x99a4('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x99a4('0xe'),_0x99a4('0xf'),_0x99a4('0x10'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x99a4('0x11'),_0x99a4('0x12')],'Dynamics365':[_0x99a4('0x13'),_0x99a4('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x99a4('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x99a4('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xd9393){var _0x3b7641=_[_0x99a4('0x16')](AZURE_AUTH_SCOPES[_0xd9393[_0x99a4('0x17')]]);if(_0xd9393[_0x99a4('0x17')]===_0x99a4('0x18'))_0x3b7641['push'](_0xd9393[_0x99a4('0x19')]+_0x99a4('0x1a'));return _0x3b7641[_0x99a4('0x1b')]('\x20');}function getAccessTokenScope(_0x18f8fe){if(_0x18f8fe['type']==='Outlook365')return _0x99a4('0x1c');if(_0x18f8fe['type']===_0x99a4('0x18'))return _0x18f8fe['data7']+_0x99a4('0x1a');}function generateMicrosoftAuthorizationUrl(_0x11cee5,_0x1edce3){var _0x29e105=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x11cee5[_0x99a4('0x1d')]);var _0x1fe0f3=[_0x99a4('0x1e'),_0x99a4('0x1f')];var _0x516ff3=Buffer[_0x99a4('0x20')](JSON[_0x99a4('0x21')]({'id':_0x1edce3}))['toString']('base64');var _0x319f5e=crypto[_0x99a4('0x22')](0x10)['toString'](_0x99a4('0x23'));var _0x4fba12=getAuthorizationScopes(_0x11cee5);var _0x54f8e1=[{'key':_0x99a4('0x24'),'value':_0x11cee5[_0x99a4('0x25')]},{'key':'response_type','value':encodeURIComponent(_0x1fe0f3[_0x99a4('0x1b')]('\x20'))},{'key':_0x99a4('0x26'),'value':_0x11cee5[_0x99a4('0x27')]},{'key':_0x99a4('0x28'),'value':_0x99a4('0x29')},{'key':_0x99a4('0x2a'),'value':encodeURIComponent(_0x4fba12)},{'key':_0x99a4('0x2b'),'value':_0x516ff3},{'key':_0x99a4('0x2c'),'value':_0x319f5e},{'key':'prompt','value':_0x99a4('0x2d')}];var _0x332cff=_0x29e105+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x54f8e1,function(_0xd391f3){return _0xd391f3[_0x99a4('0x2e')]+'='+_0xd391f3[_0x99a4('0x2f')];})[_0x99a4('0x1b')]('&');_0x11cee5['oauth2Claims']={'issuer':_0x29e105[_0x99a4('0x30')]('oauth2/',''),'audience':_0x11cee5['data1'],'state':_0x516ff3,'nonce':_0x319f5e};redis[_0x99a4('0x31')](_0x516ff3,JSON['stringify'](_0x11cee5));return _0x332cff;}function isValidIdToken(_0x53ec2b,_0x78c0c6){try{var _0x3cc4be=jwt[_0x99a4('0x32')](_0x53ec2b,{'complete':!![]});var _0x14879d=_0x3cc4be[_0x99a4('0x33')];if(_0x14879d[_0x99a4('0x34')]!==_0x78c0c6[_0x99a4('0x35')])return![];if(_0x14879d['aud']!==_0x78c0c6[_0x99a4('0x36')])return![];if(_0x14879d[_0x99a4('0x2c')]!==_0x78c0c6[_0x99a4('0x2c')])return![];if(moment()[_0x99a4('0x37')](moment[_0x99a4('0x38')](_0x14879d[_0x99a4('0x39')])))return![];return!![];}catch(_0x25a609){throw _0x25a609;}}function refreshOauth2MicrosoftAccessToken(_0x5a40e9){return Promise['resolve']()['then'](function(){if(_0x5a40e9[_0x99a4('0x3a')])return _0x5a40e9;return db['CloudProvider'][_0x99a4('0x3b')]({'where':{'id':_0x5a40e9['id']},'raw':!![]});})[_0x99a4('0x3c')](function(_0x1df0a9){var _0x1fa172={'grant_type':'refresh_token','refresh_token':_0x1df0a9[_0x99a4('0x3d')],'scope':getAccessTokenScope(_0x1df0a9),'redirect_uri':_0x1df0a9[_0x99a4('0x27')],'client_id':_0x1df0a9['data1'],'client_secret':encryptor[_0x99a4('0x3e')](_0x1df0a9[_0x99a4('0x3a')])};var _0x172cdc={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x99a4('0x3f'),_0x1df0a9[_0x99a4('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1fa172,'json':!![]};return rp(_0x172cdc);})[_0x99a4('0x3c')](function(_0x445890){_0x5a40e9['data5']=_0x445890[_0x99a4('0x40')];_0x5a40e9[_0x99a4('0x3d')]=_0x445890[_0x99a4('0x41')];return db['CloudProvider']['update']({'data5':_0x5a40e9[_0x99a4('0x42')],'data6':_0x5a40e9[_0x99a4('0x3d')]},{'where':{'id':_0x5a40e9['id']}});})['then'](function(){return _0x5a40e9;})[_0x99a4('0x43')](function(_0x509c15){logger[_0x99a4('0x44')](_0x99a4('0x45'),_0x5a40e9['id'],_0x509c15);});}function getOauth2MicrosoftAccessToken(_0x4ace0f,_0x3c27d4){var _0x482620={'grant_type':_0x99a4('0x46'),'code':_0x4ace0f,'scope':getAccessTokenScope(_0x3c27d4),'redirect_uri':_0x3c27d4[_0x99a4('0x27')],'client_id':_0x3c27d4[_0x99a4('0x25')],'client_secret':encryptor['decryptString'](_0x3c27d4[_0x99a4('0x3a')])};var _0x19fde7={'method':_0x99a4('0x47'),'uri':MICROSOFT_AUTH_URL[_0x99a4('0x30')](_0x99a4('0x3f'),_0x3c27d4[_0x99a4('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x482620,'json':!![]};return rp(_0x19fde7);}function startRefreshInterval(_0x4e2a08){var _0x56eb0c=schedule['intervals'];if(_0x56eb0c[_0x4e2a08['id']])clearInterval(_0x56eb0c[_0x4e2a08['id']]);_0x56eb0c[_0x4e2a08['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x99a4('0x48')](this,{'id':_0x4e2a08['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x99a4('0x49')]=_0x56eb0c;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x42dff7){var _0x12d942=_0x42dff7[_0x99a4('0x16')](function(_0xfbd349){return refreshOauth2MicrosoftAccessToken(_0xfbd349)['then'](function(_0x5f1d9a){startRefreshInterval(_0x5f1d9a);});});return Promise[_0x99a4('0x4a')](_0x12d942);})[_0x99a4('0x43')](function(_0x2050d4){var _0x29924f=_0x2050d4?util[_0x99a4('0x4b')](_0x2050d4,{'showHidden':![],'depth':null}):'';logger['error'](_0x99a4('0x4c'),_0x29924f);});}module[_0x99a4('0x4d')]={'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 7c81686..a81e9aa 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 _0x3609=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x488346,_0x1fc778){var _0x1a64cf=function(_0x4dbb0e){while(--_0x4dbb0e){_0x488346['push'](_0x488346['shift']());}};_0x1a64cf(++_0x1fc778);}(_0x3609,0x101));var _0x9360=function(_0x57d09c,_0x57754d){_0x57d09c=_0x57d09c-0x0;var _0x3598c6=_0x3609[_0x57d09c];return _0x3598c6;};'use strict';var _=require(_0x9360('0x0'));var util=require(_0x9360('0x1'));var moment=require(_0x9360('0x2'));var BPromise=require(_0x9360('0x3'));var rs=require(_0x9360('0x4'));var fs=require('fs');var Redis=require(_0x9360('0x5'));var db=require(_0x9360('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9360('0x7'))(_0x9360('0x8'));var config=require(_0x9360('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11fe15,_0xf4e840,_0x50e967){return new BPromise(function(_0x2a67be,_0x3a08e5){return client[_0x9360('0xa')](_0x11fe15,_0x50e967)[_0x9360('0xb')](function(_0x2d951e){logger[_0x9360('0xc')](_0x9360('0xd'),_0xf4e840,_0x9360('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0xf4e840,_0x9360('0xe'),JSON[_0x9360('0xf')](_0x2d951e));if(_0x2d951e[_0x9360('0x10')]){if(_0x2d951e['error'][_0x9360('0x11')]===0x1f4){logger[_0x9360('0x10')](_0x9360('0xd'),_0xf4e840,_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);return _0x3a08e5(_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0xf4e840,_0x2d951e[_0x9360('0x10')]['message']);return _0x2a67be(_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);}else{logger[_0x9360('0xc')](_0x9360('0xd'),_0xf4e840,'request\x20sent');_0x2a67be(_0x2d951e[_0x9360('0x13')][_0x9360('0x12')]);}})[_0x9360('0x14')](function(_0x1e0316){logger[_0x9360('0x10')](_0x9360('0xd'),_0xf4e840,_0x1e0316);_0x3a08e5(_0x1e0316);});});} \ No newline at end of file +var _0x4bd3=['request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x4bbe3f,_0x36257f){var _0x5b06c2=function(_0x250be9){while(--_0x250be9){_0x4bbe3f['push'](_0x4bbe3f['shift']());}};_0x5b06c2(++_0x36257f);}(_0x4bd3,0x174));var _0x34bd=function(_0x261b6d,_0x11f53e){_0x261b6d=_0x261b6d-0x0;var _0x43d2fb=_0x4bd3[_0x261b6d];return _0x43d2fb;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var moment=require(_0x34bd('0x1'));var BPromise=require(_0x34bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x34bd('0x3'));var logger=require(_0x34bd('0x4'))(_0x34bd('0x5'));var config=require('../../config/environment');var jayson=require(_0x34bd('0x6'));var client=jayson[_0x34bd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8744,_0x213716,_0x51a4d7){return new BPromise(function(_0xd600e1,_0x76de8d){return client[_0x34bd('0x8')](_0x3e8744,_0x51a4d7)[_0x34bd('0x9')](function(_0x1ac77f){logger[_0x34bd('0xa')]('CloudProvider,\x20%s,\x20%s',_0x213716,_0x34bd('0xb'));logger[_0x34bd('0xc')](_0x34bd('0xd'),_0x213716,_0x34bd('0xb'),JSON['stringify'](_0x1ac77f));if(_0x1ac77f['error']){if(_0x1ac77f[_0x34bd('0xe')]['code']===0x1f4){logger['error'](_0x34bd('0xf'),_0x213716,_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);return _0x76de8d(_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);}logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x213716,_0x1ac77f[_0x34bd('0xe')][_0x34bd('0x10')]);return _0xd600e1(_0x1ac77f['error'][_0x34bd('0x10')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x213716,_0x34bd('0xb'));_0xd600e1(_0x1ac77f[_0x34bd('0x11')][_0x34bd('0x10')]);}})[_0x34bd('0x12')](function(_0x34b91b){logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x213716,_0x34b91b);_0x76de8d(_0x34b91b);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 73ecf65..ccf2083 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 _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x1cca2e,_0xdd3c44){var _0x5b4258=function(_0x150b84){while(--_0x150b84){_0x1cca2e['push'](_0x1cca2e['shift']());}};_0x5b4258(++_0xdd3c44);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file +var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x20157f,_0x4bcd12){var _0x1ed61f=function(_0x28fa6d){while(--_0x28fa6d){_0x20157f['push'](_0x20157f['shift']());}};_0x1ed61f(++_0x4bcd12);}(_0xadb5,0xad));var _0x5adb=function(_0x1b7a25,_0x5d2575){_0x1b7a25=_0x1b7a25-0x0;var _0x605407=_0xadb5[_0x1b7a25];return _0x605407;};'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['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 6597b44..713f4ad 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 _0xec86=['sequelize','name','STRING'];(function(_0x423cc7,_0xf945d4){var _0x3cac73=function(_0x2e8e1a){while(--_0x2e8e1a){_0x423cc7['push'](_0x423cc7['shift']());}};_0x3cac73(++_0xf945d4);}(_0xec86,0x1d4));var _0x6ec8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xec86[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x6ec8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6ec8('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x6ec8('0x2')]},'website':{'type':Sequelize[_0x6ec8('0x2')]},'phone':{'type':Sequelize[_0x6ec8('0x2')]},'fax':{'type':Sequelize[_0x6ec8('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x6ec8('0x2')]},'postalCode':{'type':Sequelize[_0x6ec8('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x6ec8('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x6ec8('0x2')]},'sStreet':{'type':Sequelize[_0x6ec8('0x2')]},'sPostalCode':{'type':Sequelize[_0x6ec8('0x2')]},'sCity':{'type':Sequelize[_0x6ec8('0x2')]},'sCountry':{'type':Sequelize[_0x6ec8('0x2')]},'description':{'type':Sequelize[_0x6ec8('0x2')]}}; \ No newline at end of file +var _0xb643=['name','STRING','sequelize'];(function(_0x333fc8,_0x2b292c){var _0x432439=function(_0x5501b6){while(--_0x5501b6){_0x333fc8['push'](_0x333fc8['shift']());}};_0x432439(++_0x2b292c);}(_0xb643,0x6b));var _0x3b64=function(_0xee4c5f,_0x1bf72d){_0xee4c5f=_0xee4c5f-0x0;var _0x5accbc=_0xb643[_0xee4c5f];return _0x5accbc;};'use strict';var Sequelize=require(_0x3b64('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3b64('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3b64('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x3b64('0x2')]},'phone':{'type':Sequelize[_0x3b64('0x2')]},'fax':{'type':Sequelize[_0x3b64('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x3b64('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x3b64('0x2')]},'country':{'type':Sequelize[_0x3b64('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x3b64('0x2')]},'sStreet':{'type':Sequelize[_0x3b64('0x2')]},'sPostalCode':{'type':Sequelize[_0x3b64('0x2')]},'sCity':{'type':Sequelize[_0x3b64('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3b64('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index b0d1eab..648a650 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 _0x7804=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','CmContact','addContacts','ids','getContacts','findOne','eml-format','rimraf','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','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','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','update','destroy','then','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x29f82c,_0x5a6380){var _0x58a330=function(_0x1a4e82){while(--_0x1a4e82){_0x29f82c['push'](_0x29f82c['shift']());}};_0x58a330(++_0x5a6380);}(_0x7804,0xb8));var _0x4780=function(_0x2c193a,_0x309a20){_0x2c193a=_0x2c193a-0x0;var _0x4e5218=_0x7804[_0x2c193a];return _0x4e5218;};'use strict';var emlformat=require(_0x4780('0x0'));var rimraf=require(_0x4780('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4780('0x2'));var Mustache=require(_0x4780('0x3'));var util=require(_0x4780('0x4'));var path=require('path');var sox=require(_0x4780('0x5'));var csv=require(_0x4780('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4780('0x7'));var _=require(_0x4780('0x8'));var squel=require(_0x4780('0x9'));var crypto=require(_0x4780('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4780('0xb'));var toCsv=require(_0x4780('0x6'));var querystring=require(_0x4780('0xc'));var Papa=require(_0x4780('0xd'));var Redis=require(_0x4780('0xe'));var authService=require(_0x4780('0xf'));var qs=require(_0x4780('0x10'));var as=require(_0x4780('0x11'));var hardwareService=require(_0x4780('0x12'));var logger=require(_0x4780('0x13'))(_0x4780('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4780('0x15'));var db=require(_0x4780('0x16'))['db'];function respondWithStatusCode(_0x3535ab,_0x20e97e){_0x20e97e=_0x20e97e||0xcc;return function(_0x57bf4b){if(_0x57bf4b){return _0x3535ab[_0x4780('0x17')](_0x20e97e);}return _0x3535ab[_0x4780('0x18')](_0x20e97e)[_0x4780('0x19')]();};}function respondWithResult(_0x3b3212,_0x2841ff){_0x2841ff=_0x2841ff||0xc8;return function(_0x14abdc){if(_0x14abdc){return _0x3b3212[_0x4780('0x18')](_0x2841ff)[_0x4780('0x1a')](_0x14abdc);}};}function respondWithFilteredResult(_0x32135a,_0x3ad216){return function(_0x17f091){if(_0x17f091){var _0x4659f1=typeof _0x3ad216['offset']===_0x4780('0x1b')&&typeof _0x3ad216['limit']===_0x4780('0x1b');var _0x1ac8f9=_0x17f091['count'];var _0x4aa914=_0x4659f1?0x0:_0x3ad216[_0x4780('0x1c')];var _0x588b2b=_0x4659f1?_0x17f091[_0x4780('0x1d')]:_0x3ad216[_0x4780('0x1c')]+_0x3ad216[_0x4780('0x1e')];var _0x4b49e4;if(_0x588b2b>=_0x1ac8f9){_0x588b2b=_0x1ac8f9;_0x4b49e4=0xc8;}else{_0x4b49e4=0xce;}_0x32135a[_0x4780('0x18')](_0x4b49e4);return _0x32135a[_0x4780('0x1f')](_0x4780('0x20'),_0x4aa914+'-'+_0x588b2b+'/'+_0x1ac8f9)[_0x4780('0x1a')](_0x17f091);}return null;};}function patchUpdates(_0x43b181){return function(_0x59a81a){try{jsonpatch[_0x4780('0x21')](_0x59a81a,_0x43b181,!![]);}catch(_0x31d42e){return BPromise[_0x4780('0x22')](_0x31d42e);}return _0x59a81a['save']();};}function saveUpdates(_0x5c9da1,_0x1b7302){return function(_0x146b1e){if(_0x146b1e){return _0x146b1e[_0x4780('0x23')](_0x5c9da1)['then'](function(_0x39a89e){return _0x39a89e;});}return null;};}function removeEntity(_0xaebd98,_0x3c3f4b){return function(_0x3b18b2){if(_0x3b18b2){return _0x3b18b2[_0x4780('0x24')]()[_0x4780('0x25')](function(){var _0x35d5cc=_0x3b18b2[_0x4780('0x26')]({'plain':!![]});var _0x2fc1f0=_0x4780('0x27');return db[_0x4780('0x28')][_0x4780('0x24')]({'where':{'type':_0x2fc1f0,'resourceId':_0x35d5cc['id']}})['then'](function(){return _0x3b18b2;});})[_0x4780('0x25')](function(){_0xaebd98['status'](0xcc)[_0x4780('0x19')]();});}};}function handleEntityNotFound(_0x8144e4,_0x2124c9){return function(_0x53f338){if(!_0x53f338){_0x8144e4[_0x4780('0x17')](0x194);}return _0x53f338;};}function handleError(_0x2b434b,_0x403410){_0x403410=_0x403410||0x1f4;return function(_0xa652a2){logger[_0x4780('0x29')](_0xa652a2[_0x4780('0x2a')]);if(_0xa652a2[_0x4780('0x2b')]){delete _0xa652a2[_0x4780('0x2b')];}_0x2b434b[_0x4780('0x18')](_0x403410)[_0x4780('0x2c')](_0xa652a2);};}exports[_0x4780('0x2d')]=function(_0x2550dc,_0x3ef2dc){var _0x14c85a={},_0x5790a2={},_0x344751={'count':0x0,'rows':[]};return db[_0x4780('0x2e')]['describe']()['then'](function(_0x4f1ae8){_0x5790a2[_0x4780('0x2f')]=_['keys'](_0x4f1ae8);_0x5790a2[_0x4780('0x30')]=_['keys'](_0x2550dc['query']);_0x5790a2[_0x4780('0x31')]=_[_0x4780('0x32')](_0x5790a2[_0x4780('0x2f')],_0x5790a2[_0x4780('0x30')]);_0x14c85a[_0x4780('0x33')]=_['intersection'](_0x5790a2[_0x4780('0x2f')],qs[_0x4780('0x34')](_0x2550dc['query']['fields']));_0x14c85a[_0x4780('0x33')]=_0x14c85a[_0x4780('0x33')][_0x4780('0x35')]?_0x14c85a[_0x4780('0x33')]:_0x5790a2['model'];if(!_0x2550dc[_0x4780('0x30')]['hasOwnProperty'](_0x4780('0x36'))){_0x14c85a['limit']=qs[_0x4780('0x1e')](_0x2550dc[_0x4780('0x30')][_0x4780('0x1e')]);_0x14c85a['offset']=qs[_0x4780('0x1c')](_0x2550dc[_0x4780('0x30')][_0x4780('0x1c')]);}_0x14c85a[_0x4780('0x37')]=qs[_0x4780('0x38')](_0x2550dc[_0x4780('0x30')]['sort']);_0x14c85a[_0x4780('0x39')]=qs[_0x4780('0x31')](_[_0x4780('0x3a')](_0x2550dc[_0x4780('0x30')],_0x5790a2[_0x4780('0x31')]),_0x4f1ae8);if(_0x2550dc[_0x4780('0x30')][_0x4780('0x3b')]){_0x14c85a['where']=_[_0x4780('0x3c')](_0x14c85a[_0x4780('0x39')],{'$or':_[_0x4780('0x3d')](_0x14c85a['attributes'],function(_0x34ed16){var _0xb939f4={};_0xb939f4[_0x34ed16]={'$like':'%'+_0x2550dc['query'][_0x4780('0x3b')]+'%'};return _0xb939f4;})});}_0x14c85a=_[_0x4780('0x3c')]({},_0x14c85a,_0x2550dc[_0x4780('0x3e')]);var _0x541b5e={'where':_0x14c85a[_0x4780('0x39')]};return db['CmCompany'][_0x4780('0x1d')](_0x541b5e)[_0x4780('0x25')](function(_0x31fc1d){_0x344751[_0x4780('0x1d')]=_0x31fc1d;if(_0x2550dc['query'][_0x4780('0x3f')]){_0x14c85a[_0x4780('0x40')]=[{'all':!![]}];}return db[_0x4780('0x2e')][_0x4780('0x41')](_0x14c85a);})[_0x4780('0x25')](function(_0x5768ec){_0x344751[_0x4780('0x42')]=_0x5768ec;return _0x344751;})[_0x4780('0x25')](respondWithFilteredResult(_0x3ef2dc,_0x14c85a))[_0x4780('0x43')](handleError(_0x3ef2dc,null));})[_0x4780('0x43')](handleError(_0x3ef2dc,null));};exports[_0x4780('0x44')]=function(_0x257eeb,_0x111444){var _0x2c7e7e={'raw':![],'where':{'id':_0x257eeb[_0x4780('0x45')]['id']}},_0x1c3ac6={};_0x1c3ac6['model']=_[_0x4780('0x46')](db['CmCompany'][_0x4780('0x47')]);_0x1c3ac6[_0x4780('0x30')]=_[_0x4780('0x46')](_0x257eeb[_0x4780('0x30')]);_0x1c3ac6[_0x4780('0x31')]=_['intersection'](_0x1c3ac6[_0x4780('0x2f')],_0x1c3ac6['query']);_0x2c7e7e['attributes']=_[_0x4780('0x32')](_0x1c3ac6[_0x4780('0x2f')],qs[_0x4780('0x34')](_0x257eeb[_0x4780('0x30')]['fields']));_0x2c7e7e[_0x4780('0x33')]=_0x2c7e7e[_0x4780('0x33')][_0x4780('0x35')]?_0x2c7e7e[_0x4780('0x33')]:_0x1c3ac6[_0x4780('0x2f')];if(_0x257eeb[_0x4780('0x30')][_0x4780('0x3f')]){_0x2c7e7e[_0x4780('0x40')]=[{'all':!![]}];}_0x2c7e7e=_[_0x4780('0x3c')]({},_0x2c7e7e,_0x257eeb[_0x4780('0x3e')]);return db[_0x4780('0x2e')][_0x4780('0x48')](_0x2c7e7e)[_0x4780('0x25')](handleEntityNotFound(_0x111444,null))[_0x4780('0x25')](respondWithResult(_0x111444,null))[_0x4780('0x43')](handleError(_0x111444,null));};exports[_0x4780('0x49')]=function(_0x563488,_0x3c828f){return db[_0x4780('0x2e')]['create'](_0x563488['body'],{})['then'](function(_0x50aebf){var _0x2f7ae5=_0x563488[_0x4780('0x4a')][_0x4780('0x26')]({'plain':!![]});if(!_0x2f7ae5)throw new Error(_0x4780('0x4b'));if(_0x2f7ae5[_0x4780('0x4c')]===_0x4780('0x4a')){var _0x3ad3ee=_0x50aebf[_0x4780('0x26')]({'plain':!![]});var _0x258c9d=_0x4780('0x27');return db[_0x4780('0x4d')][_0x4780('0x48')]({'where':{'name':_0x258c9d,'userProfileId':_0x2f7ae5[_0x4780('0x4e')]},'raw':!![]})[_0x4780('0x25')](function(_0x10ba82){if(_0x10ba82&&_0x10ba82[_0x4780('0x4f')]===0x0){return db[_0x4780('0x28')]['create']({'name':_0x3ad3ee[_0x4780('0x2b')],'resourceId':_0x3ad3ee['id'],'type':_0x10ba82[_0x4780('0x2b')],'sectionId':_0x10ba82['id']},{})[_0x4780('0x25')](function(){return _0x50aebf;});}else{return _0x50aebf;}})[_0x4780('0x43')](function(_0x204589){logger[_0x4780('0x29')](_0x4780('0x50'),_0x204589);throw _0x204589;});}return _0x50aebf;})['then'](respondWithResult(_0x3c828f,0xc9))['catch'](handleError(_0x3c828f,null));};exports[_0x4780('0x23')]=function(_0x414498,_0x14e59d){if(_0x414498[_0x4780('0x51')]['id']){delete _0x414498['body']['id'];}return db['CmCompany'][_0x4780('0x48')]({'where':{'id':_0x414498[_0x4780('0x45')]['id']}})[_0x4780('0x25')](handleEntityNotFound(_0x14e59d,null))[_0x4780('0x25')](saveUpdates(_0x414498[_0x4780('0x51')],null))[_0x4780('0x25')](respondWithResult(_0x14e59d,null))[_0x4780('0x43')](handleError(_0x14e59d,null));};exports[_0x4780('0x24')]=function(_0x1c71cb,_0x56d840){return db[_0x4780('0x2e')][_0x4780('0x48')]({'where':{'id':_0x1c71cb[_0x4780('0x45')]['id']}})[_0x4780('0x25')](handleEntityNotFound(_0x56d840,null))[_0x4780('0x25')](removeEntity(_0x56d840,null))[_0x4780('0x43')](handleError(_0x56d840,null));};exports[_0x4780('0x52')]=function(_0x3e29da,_0x4a36d6){return db[_0x4780('0x2e')][_0x4780('0x52')]()[_0x4780('0x25')](respondWithResult(_0x4a36d6,null))['catch'](handleError(_0x4a36d6,null));};exports['addContacts']=function(_0x4a285b,_0x5602d9,_0x4de9f0){return db[_0x4780('0x53')][_0x4780('0x48')]({'where':{'id':_0x4a285b['params']['id']}})[_0x4780('0x25')](handleEntityNotFound(_0x5602d9,null))[_0x4780('0x25')](function(_0x3aceb1){if(_0x3aceb1){return _0x3aceb1[_0x4780('0x54')](_0x4a285b[_0x4780('0x51')][_0x4780('0x55')],_['omit'](_0x4a285b['body'],[_0x4780('0x55'),'id'])||{});}})[_0x4780('0x25')](respondWithResult(_0x5602d9,null))[_0x4780('0x43')](handleError(_0x5602d9,null));};exports[_0x4780('0x56')]=function(_0xbd2e23,_0x41fba2,_0x1bb732){var _0x2d554a={};var _0x3e1001={};var _0x5df540;var _0x284334;return db[_0x4780('0x2e')][_0x4780('0x57')]({'where':{'id':_0xbd2e23['params']['id']}})[_0x4780('0x25')](handleEntityNotFound(_0x41fba2,null))['then'](function(_0x5d55b8){if(_0x5d55b8){_0x5df540=_0x5d55b8;_0x3e1001[_0x4780('0x2f')]=_[_0x4780('0x46')](db[_0x4780('0x53')]['rawAttributes']);_0x3e1001['query']=_['keys'](_0xbd2e23[_0x4780('0x30')]);_0x3e1001[_0x4780('0x31')]=_[_0x4780('0x32')](_0x3e1001[_0x4780('0x2f')],_0x3e1001[_0x4780('0x30')]);_0x2d554a[_0x4780('0x33')]=_[_0x4780('0x32')](_0x3e1001['model'],qs[_0x4780('0x34')](_0xbd2e23[_0x4780('0x30')]['fields']));_0x2d554a[_0x4780('0x33')]=_0x2d554a[_0x4780('0x33')]['length']?_0x2d554a[_0x4780('0x33')]:_0x3e1001[_0x4780('0x2f')];_0x2d554a[_0x4780('0x37')]=qs['sort'](_0xbd2e23[_0x4780('0x30')][_0x4780('0x38')]);_0x2d554a[_0x4780('0x39')]=qs['filters'](_['pick'](_0xbd2e23[_0x4780('0x30')],_0x3e1001[_0x4780('0x31')]));if(_0xbd2e23[_0x4780('0x30')][_0x4780('0x3b')]){_0x2d554a[_0x4780('0x39')]=_[_0x4780('0x3c')](_0x2d554a[_0x4780('0x39')],{'$or':_[_0x4780('0x3d')](_0x2d554a[_0x4780('0x33')],function(_0x309957){var _0x152ac2={};_0x152ac2[_0x309957]={'$like':'%'+_0xbd2e23[_0x4780('0x30')][_0x4780('0x3b')]+'%'};return _0x152ac2;})});}_0x2d554a=_[_0x4780('0x3c')]({},_0x2d554a,_0xbd2e23[_0x4780('0x3e')]);return _0x5df540[_0x4780('0x56')](_0x2d554a);}})[_0x4780('0x25')](function(_0x41d2f1){if(_0x41d2f1){_0x284334=_0x41d2f1['length'];if(!_0xbd2e23[_0x4780('0x30')]['hasOwnProperty']('nolimit')){_0x2d554a[_0x4780('0x1e')]=qs['limit'](_0xbd2e23[_0x4780('0x30')]['limit']);_0x2d554a['offset']=qs[_0x4780('0x1c')](_0xbd2e23['query'][_0x4780('0x1c')]);}return _0x5df540[_0x4780('0x56')](_0x2d554a);}})[_0x4780('0x25')](function(_0x167e89){if(_0x167e89){return _0x167e89?{'count':_0x284334,'rows':_0x167e89}:null;}})[_0x4780('0x25')](respondWithResult(_0x41fba2,null))['catch'](handleError(_0x41fba2,null));}; \ No newline at end of file +var _0x4f9e=['omit','getContacts','sort','filter','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','then','get','Companies','UserProfileResource','destroy','stack','name','send','CmCompany','model','keys','query','filters','intersection','attributes','fields','nolimit','order','pick','merge','where','map','include','findAll','rows','catch','params','rawAttributes','length','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','CmContact','addContacts','ids'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f9e,0xac));var _0xe4f9=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0x4f9e[_0x352d28];return _0x387d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4f9('0x0'));var zipdir=require(_0xe4f9('0x1'));var jsonpatch=require(_0xe4f9('0x2'));var rp=require(_0xe4f9('0x3'));var moment=require(_0xe4f9('0x4'));var BPromise=require(_0xe4f9('0x5'));var Mustache=require(_0xe4f9('0x6'));var util=require('util');var path=require(_0xe4f9('0x7'));var sox=require('sox');var csv=require(_0xe4f9('0x8'));var ejs=require(_0xe4f9('0x9'));var fs=require('fs');var fs_extra=require(_0xe4f9('0xa'));var _=require(_0xe4f9('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe4f9('0xc'));var deskjs=require(_0xe4f9('0xd'));var toCsv=require(_0xe4f9('0x8'));var querystring=require(_0xe4f9('0xe'));var Papa=require(_0xe4f9('0xf'));var Redis=require(_0xe4f9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe4f9('0x11'));var as=require(_0xe4f9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe4f9('0x13'));var utils=require(_0xe4f9('0x14'));var config=require(_0xe4f9('0x15'));var licenseUtil=require(_0xe4f9('0x16'));var db=require(_0xe4f9('0x17'))['db'];function respondWithStatusCode(_0x114a44,_0x1a292c){_0x1a292c=_0x1a292c||0xcc;return function(_0x1567c4){if(_0x1567c4){return _0x114a44['sendStatus'](_0x1a292c);}return _0x114a44[_0xe4f9('0x18')](_0x1a292c)[_0xe4f9('0x19')]();};}function respondWithResult(_0x45c951,_0x5a2e4b){_0x5a2e4b=_0x5a2e4b||0xc8;return function(_0x16a76f){if(_0x16a76f){return _0x45c951[_0xe4f9('0x18')](_0x5a2e4b)[_0xe4f9('0x1a')](_0x16a76f);}};}function respondWithFilteredResult(_0x1d085f,_0x383277){return function(_0x46bbd6){if(_0x46bbd6){var _0x3cdd00=typeof _0x383277[_0xe4f9('0x1b')]==='undefined'&&typeof _0x383277[_0xe4f9('0x1c')]===_0xe4f9('0x1d');var _0x1d7e6a=_0x46bbd6[_0xe4f9('0x1e')];var _0x55631d=_0x3cdd00?0x0:_0x383277['offset'];var _0x25280e=_0x3cdd00?_0x46bbd6[_0xe4f9('0x1e')]:_0x383277[_0xe4f9('0x1b')]+_0x383277[_0xe4f9('0x1c')];var _0x1ea578;if(_0x25280e>=_0x1d7e6a){_0x25280e=_0x1d7e6a;_0x1ea578=0xc8;}else{_0x1ea578=0xce;}_0x1d085f[_0xe4f9('0x18')](_0x1ea578);return _0x1d085f['set'](_0xe4f9('0x1f'),_0x55631d+'-'+_0x25280e+'/'+_0x1d7e6a)[_0xe4f9('0x1a')](_0x46bbd6);}return null;};}function patchUpdates(_0x10f896){return function(_0x36ba86){try{jsonpatch['apply'](_0x36ba86,_0x10f896,!![]);}catch(_0x288fa1){return BPromise[_0xe4f9('0x20')](_0x288fa1);}return _0x36ba86[_0xe4f9('0x21')]();};}function saveUpdates(_0x1871b7,_0x3cc052){return function(_0x34fb3d){if(_0x34fb3d){return _0x34fb3d['update'](_0x1871b7)[_0xe4f9('0x22')](function(_0xa741bc){return _0xa741bc;});}return null;};}function removeEntity(_0x472407,_0x28aeec){return function(_0x39f614){if(_0x39f614){return _0x39f614['destroy']()[_0xe4f9('0x22')](function(){var _0x2562cd=_0x39f614[_0xe4f9('0x23')]({'plain':!![]});var _0x4d00a6=_0xe4f9('0x24');return db[_0xe4f9('0x25')][_0xe4f9('0x26')]({'where':{'type':_0x4d00a6,'resourceId':_0x2562cd['id']}})[_0xe4f9('0x22')](function(){return _0x39f614;});})[_0xe4f9('0x22')](function(){_0x472407[_0xe4f9('0x18')](0xcc)[_0xe4f9('0x19')]();});}};}function handleEntityNotFound(_0xf43243,_0x5976a2){return function(_0x5e5766){if(!_0x5e5766){_0xf43243['sendStatus'](0x194);}return _0x5e5766;};}function handleError(_0x575c94,_0x488d69){_0x488d69=_0x488d69||0x1f4;return function(_0x42449d){logger['error'](_0x42449d[_0xe4f9('0x27')]);if(_0x42449d[_0xe4f9('0x28')]){delete _0x42449d[_0xe4f9('0x28')];}_0x575c94['status'](_0x488d69)[_0xe4f9('0x29')](_0x42449d);};}exports['index']=function(_0x9dd579,_0x30b73b){var _0x283003={},_0x28d4ca={},_0x591ee4={'count':0x0,'rows':[]};return db[_0xe4f9('0x2a')]['describe']()['then'](function(_0x50fa3d){_0x28d4ca[_0xe4f9('0x2b')]=_[_0xe4f9('0x2c')](_0x50fa3d);_0x28d4ca[_0xe4f9('0x2d')]=_[_0xe4f9('0x2c')](_0x9dd579[_0xe4f9('0x2d')]);_0x28d4ca[_0xe4f9('0x2e')]=_[_0xe4f9('0x2f')](_0x28d4ca[_0xe4f9('0x2b')],_0x28d4ca[_0xe4f9('0x2d')]);_0x283003[_0xe4f9('0x30')]=_[_0xe4f9('0x2f')](_0x28d4ca[_0xe4f9('0x2b')],qs[_0xe4f9('0x31')](_0x9dd579[_0xe4f9('0x2d')][_0xe4f9('0x31')]));_0x283003[_0xe4f9('0x30')]=_0x283003[_0xe4f9('0x30')]['length']?_0x283003['attributes']:_0x28d4ca['model'];if(!_0x9dd579[_0xe4f9('0x2d')]['hasOwnProperty'](_0xe4f9('0x32'))){_0x283003[_0xe4f9('0x1c')]=qs['limit'](_0x9dd579[_0xe4f9('0x2d')][_0xe4f9('0x1c')]);_0x283003[_0xe4f9('0x1b')]=qs['offset'](_0x9dd579[_0xe4f9('0x2d')][_0xe4f9('0x1b')]);}_0x283003[_0xe4f9('0x33')]=qs['sort'](_0x9dd579[_0xe4f9('0x2d')]['sort']);_0x283003['where']=qs[_0xe4f9('0x2e')](_[_0xe4f9('0x34')](_0x9dd579['query'],_0x28d4ca['filters']),_0x50fa3d);if(_0x9dd579[_0xe4f9('0x2d')]['filter']){_0x283003['where']=_[_0xe4f9('0x35')](_0x283003[_0xe4f9('0x36')],{'$or':_[_0xe4f9('0x37')](_0x283003[_0xe4f9('0x30')],function(_0xf1b530){var _0x1b76b4={};_0x1b76b4[_0xf1b530]={'$like':'%'+_0x9dd579[_0xe4f9('0x2d')]['filter']+'%'};return _0x1b76b4;})});}_0x283003=_[_0xe4f9('0x35')]({},_0x283003,_0x9dd579['options']);var _0x228c96={'where':_0x283003[_0xe4f9('0x36')]};return db[_0xe4f9('0x2a')][_0xe4f9('0x1e')](_0x228c96)[_0xe4f9('0x22')](function(_0x36164b){_0x591ee4[_0xe4f9('0x1e')]=_0x36164b;if(_0x9dd579[_0xe4f9('0x2d')]['includeAll']){_0x283003[_0xe4f9('0x38')]=[{'all':!![]}];}return db[_0xe4f9('0x2a')][_0xe4f9('0x39')](_0x283003);})[_0xe4f9('0x22')](function(_0x1c7506){_0x591ee4[_0xe4f9('0x3a')]=_0x1c7506;return _0x591ee4;})[_0xe4f9('0x22')](respondWithFilteredResult(_0x30b73b,_0x283003))[_0xe4f9('0x3b')](handleError(_0x30b73b,null));})[_0xe4f9('0x3b')](handleError(_0x30b73b,null));};exports['show']=function(_0x541adf,_0x335045){var _0x21762b={'raw':![],'where':{'id':_0x541adf[_0xe4f9('0x3c')]['id']}},_0x41df38={};_0x41df38[_0xe4f9('0x2b')]=_['keys'](db[_0xe4f9('0x2a')][_0xe4f9('0x3d')]);_0x41df38['query']=_[_0xe4f9('0x2c')](_0x541adf['query']);_0x41df38['filters']=_[_0xe4f9('0x2f')](_0x41df38[_0xe4f9('0x2b')],_0x41df38[_0xe4f9('0x2d')]);_0x21762b[_0xe4f9('0x30')]=_[_0xe4f9('0x2f')](_0x41df38['model'],qs[_0xe4f9('0x31')](_0x541adf['query'][_0xe4f9('0x31')]));_0x21762b[_0xe4f9('0x30')]=_0x21762b[_0xe4f9('0x30')][_0xe4f9('0x3e')]?_0x21762b['attributes']:_0x41df38[_0xe4f9('0x2b')];if(_0x541adf[_0xe4f9('0x2d')][_0xe4f9('0x3f')]){_0x21762b[_0xe4f9('0x38')]=[{'all':!![]}];}_0x21762b=_['merge']({},_0x21762b,_0x541adf[_0xe4f9('0x40')]);return db[_0xe4f9('0x2a')][_0xe4f9('0x41')](_0x21762b)['then'](handleEntityNotFound(_0x335045,null))[_0xe4f9('0x22')](respondWithResult(_0x335045,null))[_0xe4f9('0x3b')](handleError(_0x335045,null));};exports[_0xe4f9('0x42')]=function(_0x540a26,_0x5d009c){return db['CmCompany'][_0xe4f9('0x42')](_0x540a26[_0xe4f9('0x43')],{})['then'](function(_0x169c3b){var _0x22aee4=_0x540a26['user'][_0xe4f9('0x23')]({'plain':!![]});if(!_0x22aee4)throw new Error(_0xe4f9('0x44'));if(_0x22aee4[_0xe4f9('0x45')]===_0xe4f9('0x46')){var _0x791e24=_0x169c3b['get']({'plain':!![]});var _0x179011=_0xe4f9('0x24');return db[_0xe4f9('0x47')][_0xe4f9('0x41')]({'where':{'name':_0x179011,'userProfileId':_0x22aee4[_0xe4f9('0x48')]},'raw':!![]})['then'](function(_0x14a112){if(_0x14a112&&_0x14a112[_0xe4f9('0x49')]===0x0){return db['UserProfileResource'][_0xe4f9('0x42')]({'name':_0x791e24['name'],'resourceId':_0x791e24['id'],'type':_0x14a112[_0xe4f9('0x28')],'sectionId':_0x14a112['id']},{})[_0xe4f9('0x22')](function(){return _0x169c3b;});}else{return _0x169c3b;}})[_0xe4f9('0x3b')](function(_0x42c958){logger['error'](_0xe4f9('0x4a'),_0x42c958);throw _0x42c958;});}return _0x169c3b;})[_0xe4f9('0x22')](respondWithResult(_0x5d009c,0xc9))['catch'](handleError(_0x5d009c,null));};exports[_0xe4f9('0x4b')]=function(_0x513df6,_0xf71df){if(_0x513df6[_0xe4f9('0x43')]['id']){delete _0x513df6[_0xe4f9('0x43')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x513df6[_0xe4f9('0x3c')]['id']}})[_0xe4f9('0x22')](handleEntityNotFound(_0xf71df,null))[_0xe4f9('0x22')](saveUpdates(_0x513df6['body'],null))[_0xe4f9('0x22')](respondWithResult(_0xf71df,null))[_0xe4f9('0x3b')](handleError(_0xf71df,null));};exports[_0xe4f9('0x26')]=function(_0x440c77,_0x3786e7){return db[_0xe4f9('0x2a')][_0xe4f9('0x41')]({'where':{'id':_0x440c77[_0xe4f9('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3786e7,null))[_0xe4f9('0x22')](removeEntity(_0x3786e7,null))['catch'](handleError(_0x3786e7,null));};exports['describe']=function(_0x5214cf,_0x1b34b4){return db[_0xe4f9('0x2a')][_0xe4f9('0x4c')]()[_0xe4f9('0x22')](respondWithResult(_0x1b34b4,null))[_0xe4f9('0x3b')](handleError(_0x1b34b4,null));};exports['addContacts']=function(_0x2256a2,_0x41b242,_0x264992){return db[_0xe4f9('0x4d')][_0xe4f9('0x41')]({'where':{'id':_0x2256a2[_0xe4f9('0x3c')]['id']}})[_0xe4f9('0x22')](handleEntityNotFound(_0x41b242,null))[_0xe4f9('0x22')](function(_0xe263b2){if(_0xe263b2){return _0xe263b2[_0xe4f9('0x4e')](_0x2256a2[_0xe4f9('0x43')][_0xe4f9('0x4f')],_[_0xe4f9('0x50')](_0x2256a2[_0xe4f9('0x43')],[_0xe4f9('0x4f'),'id'])||{});}})[_0xe4f9('0x22')](respondWithResult(_0x41b242,null))[_0xe4f9('0x3b')](handleError(_0x41b242,null));};exports[_0xe4f9('0x51')]=function(_0x882e98,_0x591df7,_0x189335){var _0x102b39={};var _0x20f72a={};var _0x41d78c;var _0x221577;return db['CmCompany']['findOne']({'where':{'id':_0x882e98[_0xe4f9('0x3c')]['id']}})[_0xe4f9('0x22')](handleEntityNotFound(_0x591df7,null))['then'](function(_0x17a331){if(_0x17a331){_0x41d78c=_0x17a331;_0x20f72a[_0xe4f9('0x2b')]=_['keys'](db[_0xe4f9('0x4d')][_0xe4f9('0x3d')]);_0x20f72a[_0xe4f9('0x2d')]=_[_0xe4f9('0x2c')](_0x882e98[_0xe4f9('0x2d')]);_0x20f72a[_0xe4f9('0x2e')]=_['intersection'](_0x20f72a[_0xe4f9('0x2b')],_0x20f72a[_0xe4f9('0x2d')]);_0x102b39['attributes']=_[_0xe4f9('0x2f')](_0x20f72a[_0xe4f9('0x2b')],qs['fields'](_0x882e98[_0xe4f9('0x2d')][_0xe4f9('0x31')]));_0x102b39['attributes']=_0x102b39['attributes'][_0xe4f9('0x3e')]?_0x102b39[_0xe4f9('0x30')]:_0x20f72a[_0xe4f9('0x2b')];_0x102b39['order']=qs[_0xe4f9('0x52')](_0x882e98[_0xe4f9('0x2d')][_0xe4f9('0x52')]);_0x102b39[_0xe4f9('0x36')]=qs[_0xe4f9('0x2e')](_[_0xe4f9('0x34')](_0x882e98[_0xe4f9('0x2d')],_0x20f72a[_0xe4f9('0x2e')]));if(_0x882e98[_0xe4f9('0x2d')][_0xe4f9('0x53')]){_0x102b39[_0xe4f9('0x36')]=_[_0xe4f9('0x35')](_0x102b39[_0xe4f9('0x36')],{'$or':_[_0xe4f9('0x37')](_0x102b39['attributes'],function(_0x222548){var _0x594262={};_0x594262[_0x222548]={'$like':'%'+_0x882e98[_0xe4f9('0x2d')]['filter']+'%'};return _0x594262;})});}_0x102b39=_['merge']({},_0x102b39,_0x882e98['options']);return _0x41d78c[_0xe4f9('0x51')](_0x102b39);}})[_0xe4f9('0x22')](function(_0x1b8872){if(_0x1b8872){_0x221577=_0x1b8872[_0xe4f9('0x3e')];if(!_0x882e98[_0xe4f9('0x2d')]['hasOwnProperty'](_0xe4f9('0x32'))){_0x102b39[_0xe4f9('0x1c')]=qs[_0xe4f9('0x1c')](_0x882e98[_0xe4f9('0x2d')][_0xe4f9('0x1c')]);_0x102b39[_0xe4f9('0x1b')]=qs[_0xe4f9('0x1b')](_0x882e98['query'][_0xe4f9('0x1b')]);}return _0x41d78c[_0xe4f9('0x51')](_0x102b39);}})[_0xe4f9('0x22')](function(_0x1dcfbd){if(_0x1dcfbd){return _0x1dcfbd?{'count':_0x221577,'rows':_0x1dcfbd}:null;}})[_0xe4f9('0x22')](respondWithResult(_0x591df7,null))[_0xe4f9('0x3b')](handleError(_0x591df7,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 33be591..c7b9f2b 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 _0xb927=['rimraf','../../config/environment','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x248c35,_0x186c2b){var _0xf199ea=function(_0x459cc5){while(--_0x459cc5){_0x248c35['push'](_0x248c35['shift']());}};_0xf199ea(++_0x186c2b);}(_0xb927,0x19c));var _0x7b92=function(_0x330129,_0x172199){_0x330129=_0x330129-0x0;var _0x1ea3da=_0xb927[_0x330129];return _0x1ea3da;};'use strict';var _=require(_0x7b92('0x0'));var util=require(_0x7b92('0x1'));var logger=require(_0x7b92('0x2'))(_0x7b92('0x3'));var moment=require(_0x7b92('0x4'));var BPromise=require(_0x7b92('0x5'));var rp=require(_0x7b92('0x6'));var fs=require('fs');var path=require(_0x7b92('0x7'));var rimraf=require(_0x7b92('0x8'));var config=require(_0x7b92('0x9'));var attributes=require('./cmCompany.attributes');module[_0x7b92('0xa')]=function(_0x58651b,_0x54a0f9){return _0x58651b[_0x7b92('0xb')](_0x7b92('0xc'),attributes,{'tableName':_0x7b92('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e6=['bluebird','request-promise','./cmCompany.attributes','define','CmCompany','cm_companies','../../config/logger','api','moment'];(function(_0x295c80,_0x357a09){var _0x63e389=function(_0x4465c6){while(--_0x4465c6){_0x295c80['push'](_0x295c80['shift']());}};_0x63e389(++_0x357a09);}(_0x70e6,0x12f));var _0x670e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x70e6[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x670e('0x0'))(_0x670e('0x1'));var moment=require(_0x670e('0x2'));var BPromise=require(_0x670e('0x3'));var rp=require(_0x670e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x670e('0x5'));module['exports']=function(_0xc04422,_0x19bf40){return _0xc04422[_0x670e('0x6')](_0x670e('0x7'),attributes,{'tableName':_0x670e('0x8'),'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 19dad9f..8f90b2a 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 _0xa0df=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x1b040d,_0x157a0b){var _0x2d2ae5=function(_0x475ca7){while(--_0x475ca7){_0x1b040d['push'](_0x1b040d['shift']());}};_0x2d2ae5(++_0x157a0b);}(_0xa0df,0x19a));var _0xfa0d=function(_0xe44720,_0x82aee3){_0xe44720=_0xe44720-0x0;var _0x39c880=_0xa0df[_0xe44720];return _0x39c880;};'use strict';var _=require(_0xfa0d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfa0d('0x1'));var rs=require(_0xfa0d('0x2'));var fs=require('fs');var Redis=require(_0xfa0d('0x3'));var db=require(_0xfa0d('0x4'))['db'];var utils=require(_0xfa0d('0x5'));var logger=require(_0xfa0d('0x6'))('rpc');var config=require(_0xfa0d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfa0d('0x8')][_0xfa0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf32944,_0x535d73,_0x2aaa9){return new BPromise(function(_0x4eca16,_0x1ce8b0){return client[_0xfa0d('0xa')](_0xf32944,_0x2aaa9)[_0xfa0d('0xb')](function(_0x158ef0){logger[_0xfa0d('0xc')](_0xfa0d('0xd'),_0x535d73,_0xfa0d('0xe'));logger[_0xfa0d('0xf')](_0xfa0d('0x10'),_0x535d73,_0xfa0d('0xe'),JSON[_0xfa0d('0x11')](_0x158ef0));if(_0x158ef0[_0xfa0d('0x12')]){if(_0x158ef0[_0xfa0d('0x12')][_0xfa0d('0x13')]===0x1f4){logger[_0xfa0d('0x12')](_0xfa0d('0xd'),_0x535d73,_0x158ef0[_0xfa0d('0x12')][_0xfa0d('0x14')]);return _0x1ce8b0(_0x158ef0['error'][_0xfa0d('0x14')]);}logger[_0xfa0d('0x12')](_0xfa0d('0xd'),_0x535d73,_0x158ef0[_0xfa0d('0x12')][_0xfa0d('0x14')]);return _0x4eca16(_0x158ef0[_0xfa0d('0x12')][_0xfa0d('0x14')]);}else{logger['info'](_0xfa0d('0xd'),_0x535d73,_0xfa0d('0xe'));_0x4eca16(_0x158ef0[_0xfa0d('0x15')][_0xfa0d('0x14')]);}})[_0xfa0d('0x16')](function(_0x5cb046){logger['error'](_0xfa0d('0xd'),_0x535d73,_0x5cb046);_0x1ce8b0(_0x5cb046);});});} \ No newline at end of file +var _0xdaef=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xdaef,0x13c));var _0xfdae=function(_0x3cfb23,_0x48307d){_0x3cfb23=_0x3cfb23-0x0;var _0x415b60=_0xdaef[_0x3cfb23];return _0x415b60;};'use strict';var _=require(_0xfdae('0x0'));var util=require(_0xfdae('0x1'));var moment=require(_0xfdae('0x2'));var BPromise=require(_0xfdae('0x3'));var rs=require(_0xfdae('0x4'));var fs=require('fs');var Redis=require(_0xfdae('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdae('0x6'));var logger=require(_0xfdae('0x7'))('rpc');var config=require(_0xfdae('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfdae('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e4029,_0xa40dee,_0x1dd43f){return new BPromise(function(_0x3fe9a7,_0x1119f3){return client['request'](_0x3e4029,_0x1dd43f)[_0xfdae('0xa')](function(_0x113812){logger[_0xfdae('0xb')](_0xfdae('0xc'),_0xa40dee,_0xfdae('0xd'));logger[_0xfdae('0xe')](_0xfdae('0xf'),_0xa40dee,'request\x20sent',JSON['stringify'](_0x113812));if(_0x113812[_0xfdae('0x10')]){if(_0x113812['error'][_0xfdae('0x11')]===0x1f4){logger[_0xfdae('0x10')](_0xfdae('0xc'),_0xa40dee,_0x113812['error'][_0xfdae('0x12')]);return _0x1119f3(_0x113812[_0xfdae('0x10')]['message']);}logger[_0xfdae('0x10')]('CmCompany,\x20%s,\x20%s',_0xa40dee,_0x113812[_0xfdae('0x10')][_0xfdae('0x12')]);return _0x3fe9a7(_0x113812[_0xfdae('0x10')][_0xfdae('0x12')]);}else{logger[_0xfdae('0xb')]('CmCompany,\x20%s,\x20%s',_0xa40dee,_0xfdae('0xd'));_0x3fe9a7(_0x113812[_0xfdae('0x13')][_0xfdae('0x12')]);}})[_0xfdae('0x14')](function(_0x3065c2){logger['error'](_0xfdae('0xc'),_0xa40dee,_0x3065c2);_0x1119f3(_0x3065c2);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 8ed28d0..4a21365 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 _0x71a5=['index','describe','get','show','/:id/contacts','getContacts','create','post','addContacts','put','/:id','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','isAuthenticated'];(function(_0x4e97b9,_0x40c22e){var _0x31c482=function(_0x5035af){while(--_0x5035af){_0x4e97b9['push'](_0x4e97b9['shift']());}};_0x31c482(++_0x40c22e);}(_0x71a5,0x168));var _0x571a=function(_0x378031,_0x2c57df){_0x378031=_0x378031-0x0;var _0x30ce29=_0x71a5[_0x378031];return _0x30ce29;};'use strict';var multer=require(_0x571a('0x0'));var util=require(_0x571a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x571a('0x2'));var router=express[_0x571a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x571a('0x4'));var interaction=require(_0x571a('0x5'));var config=require('../../config/environment');var controller=require(_0x571a('0x6'));router['get']('/',auth[_0x571a('0x7')](),controller[_0x571a('0x8')]);router['get']('/describe',auth[_0x571a('0x7')](),controller[_0x571a('0x9')]);router[_0x571a('0xa')]('/:id',auth[_0x571a('0x7')](),controller[_0x571a('0xb')]);router[_0x571a('0xa')](_0x571a('0xc'),auth[_0x571a('0x7')](),controller[_0x571a('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x571a('0xe')]);router[_0x571a('0xf')](_0x571a('0xc'),auth['isAuthenticated'](),controller[_0x571a('0x10')]);router[_0x571a('0x11')](_0x571a('0x12'),auth['isAuthenticated'](),controller[_0x571a('0x13')]);router[_0x571a('0x14')](_0x571a('0x12'),auth[_0x571a('0x7')](),controller[_0x571a('0x15')]);module[_0x571a('0x16')]=router; \ No newline at end of file +var _0xe0af=['put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','/:id/contacts','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0af,0x1e3));var _0xfe0a=function(_0xbaeba7,_0x578dfa){_0xbaeba7=_0xbaeba7-0x0;var _0x4b42e7=_0xe0af[_0xbaeba7];return _0x4b42e7;};'use strict';var multer=require(_0xfe0a('0x0'));var util=require(_0xfe0a('0x1'));var path=require(_0xfe0a('0x2'));var timeout=require(_0xfe0a('0x3'));var express=require(_0xfe0a('0x4'));var router=express[_0xfe0a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfe0a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfe0a('0x7'));var controller=require('./cmCompany.controller');router[_0xfe0a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfe0a('0x8')](_0xfe0a('0x9'),auth[_0xfe0a('0xa')](),controller['describe']);router[_0xfe0a('0x8')]('/:id',auth[_0xfe0a('0xa')](),controller['show']);router['get'](_0xfe0a('0xb'),auth[_0xfe0a('0xa')](),controller['getContacts']);router['post']('/',auth[_0xfe0a('0xa')](),controller['create']);router[_0xfe0a('0xc')](_0xfe0a('0xb'),auth[_0xfe0a('0xa')](),controller['addContacts']);router[_0xfe0a('0xd')]('/:id',auth[_0xfe0a('0xa')](),controller['update']);router['delete']('/:id',auth[_0xfe0a('0xa')](),controller[_0xfe0a('0xe')]);module[_0xfe0a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 84f176a..dddd520 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 _0xe3db=['UNSIGNED','NOW','exports','STRING','TEXT','INTEGER'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0xe3db,0x1be));var _0xbe3d=function(_0x1dd9be,_0x542e01){_0x1dd9be=_0x1dd9be-0x0;var _0x317c49=_0xe3db[_0x1dd9be];return _0x317c49;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0xbe3d('0x0')]={'firstName':{'type':Sequelize[_0xbe3d('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xbe3d('0x1')]},'street':{'type':Sequelize[_0xbe3d('0x1')]},'postalCode':{'type':Sequelize[_0xbe3d('0x1')]},'city':{'type':Sequelize[_0xbe3d('0x1')]},'country':{'type':Sequelize[_0xbe3d('0x1')]},'dateOfBirth':{'type':Sequelize[_0xbe3d('0x1')]},'description':{'type':Sequelize[_0xbe3d('0x2')]},'phone':{'type':Sequelize[_0xbe3d('0x1')]},'mobile':{'type':Sequelize[_0xbe3d('0x1')]},'fax':{'type':Sequelize[_0xbe3d('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xbe3d('0x1')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xbe3d('0x1')]},'twitter':{'type':Sequelize[_0xbe3d('0x1')]},'skype':{'type':Sequelize[_0xbe3d('0x1')]},'teams':{'type':Sequelize[_0xbe3d('0x1')]},'viber':{'type':Sequelize[_0xbe3d('0x1')]},'line':{'type':Sequelize[_0xbe3d('0x1')]},'wechat':{'type':Sequelize[_0xbe3d('0x1')]},'telegram':{'type':Sequelize[_0xbe3d('0x1')]},'UserId':{'type':Sequelize[_0xbe3d('0x3')]},'AdditionalPhones':{'type':Sequelize[_0xbe3d('0x1')]},'priority':{'type':Sequelize[_0xbe3d('0x3')](0x2)[_0xbe3d('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xbe3d('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xbe3d('0x3')]}}; \ No newline at end of file +var _0x15cc=['NOW','lodash','sequelize','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x2e2e85,_0xfdae25){var _0x461299=function(_0x543eda){while(--_0x543eda){_0x2e2e85['push'](_0x2e2e85['shift']());}};_0x461299(++_0xfdae25);}(_0x15cc,0x191));var _0xc15c=function(_0x9d58e0,_0x5ee515){_0x9d58e0=_0x9d58e0-0x0;var _0x5eab07=_0x15cc[_0x9d58e0];return _0x5eab07;};'use strict';var _=require(_0xc15c('0x0'));var Sequelize=require(_0xc15c('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xc15c('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xc15c('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xc15c('0x2')]},'city':{'type':Sequelize[_0xc15c('0x2')]},'country':{'type':Sequelize[_0xc15c('0x2')]},'dateOfBirth':{'type':Sequelize[_0xc15c('0x2')]},'description':{'type':Sequelize[_0xc15c('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xc15c('0x2')]},'email':{'type':Sequelize[_0xc15c('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xc15c('0x2')]},'twitter':{'type':Sequelize[_0xc15c('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xc15c('0x2')]},'viber':{'type':Sequelize[_0xc15c('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xc15c('0x2')]},'telegram':{'type':Sequelize[_0xc15c('0x2')]},'UserId':{'type':Sequelize[_0xc15c('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xc15c('0x2')]},'priority':{'type':Sequelize[_0xc15c('0x4')](0x2)[_0xc15c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc15c('0x6')],'defaultValue':Sequelize[_0xc15c('0x7')]},'dialTimezone':{'type':Sequelize[_0xc15c('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 765cfd0..0c66c9d 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 _0x9582=['redis','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','count','update','end','error','stack','name','send','index','describe','then','getOptions','findAll','query','user','CmContact','find','catch','keys','length','cf_','columnName','displayName','analytics','CmCustomField','alias','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','from','get','mergeWith','tags','isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','destroy','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','push','ListId','findOrCreate','spread','all','show','params','Tag','color','tag','Phones','ContactItemType','sequelize','literal','$and','omit','map','format','cf_%d','pickBy','table','id\x20=\x20?','toParam','text','values','phone','getTags','findOne','model','filters','intersection','attributes','fields','order','sort','pick','options','hasOwnProperty','nolimit','limit','setTags','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','PHONE','CmHopperAdditionalPhone','item','ItemType','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','rawAttributes','ContactId','filter','includeAll','include','rows','getHopperHistories','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','filename','chmodSync','child_process','fork','join','../../components/import/cm/csv','socket_timestamp','upload','createReadStream','file','parse','meta','User','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','fullname','findAndCountAll','startCase','Account','disposition','UserId','key','Owner','Tags','DESC','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','referer','substatus','externalUrl','threadId','flatten','sortBy','value','slice','bluebird','path','lodash','squel','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9582,0xed));var _0x2958=function(_0x3ac8ff,_0x4e52ca){_0x3ac8ff=_0x3ac8ff-0x0;var _0x3f9247=_0x9582[_0x3ac8ff];return _0x3f9247;};'use strict';var moment=require('moment');var BPromise=require(_0x2958('0x0'));var util=require('util');var path=require(_0x2958('0x1'));var fs=require('fs');var _=require(_0x2958('0x2'));var squel=require(_0x2958('0x3'));var Papa=require(_0x2958('0x4'));var Redis=require('ioredis');var contacts=require('../../components/contacts');var qs=require(_0x2958('0x5'));var logger=require(_0x2958('0x6'))(_0x2958('0x7'));var config=require(_0x2958('0x8'));var shared=require(_0x2958('0x9'));var db=require(_0x2958('0xa'))['db'];config['redis']=_[_0x2958('0xb')](config[_0x2958('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x2958('0xd'))(new Redis(config['redis']));require(_0x2958('0xe'))[_0x2958('0xf')](socket);function respondWithResult(_0x1540eb,_0x5df0f6){_0x5df0f6=_0x5df0f6||0xc8;return function(_0x708d8){if(_0x708d8){return _0x1540eb[_0x2958('0x10')](_0x5df0f6)[_0x2958('0x11')](_0x708d8);}};}function respondWithFilteredResult(_0x592b73,_0x49c0c3){return function(_0x2b8501){if(_0x2b8501){var _0x56c6e1=typeof _0x49c0c3[_0x2958('0x12')]==='undefined'&&typeof _0x49c0c3['limit']===_0x2958('0x13');var _0x535949=_0x2b8501[_0x2958('0x14')];var _0x34e647=_0x56c6e1?0x0:_0x49c0c3[_0x2958('0x12')];var _0x485bc5=_0x56c6e1?_0x2b8501['count']:_0x49c0c3[_0x2958('0x12')]+_0x49c0c3['limit'];var _0x43a333;if(_0x485bc5>=_0x535949){_0x485bc5=_0x535949;_0x43a333=0xc8;}else{_0x43a333=0xce;}_0x592b73[_0x2958('0x10')](_0x43a333);return _0x592b73['set']('Content-Range',_0x34e647+'-'+_0x485bc5+'/'+_0x535949)[_0x2958('0x11')](_0x2b8501);}return null;};}function saveUpdates(_0x5df6e4){return function(_0x3e00e3){if(_0x3e00e3){return _0x3e00e3[_0x2958('0x15')](_0x5df6e4)['then'](function(_0x41bd8d){return _0x41bd8d;});}return null;};}function removeEntity(_0x3b9017){return function(_0x1a1761){if(_0x1a1761){return _0x1a1761['destroy']()['then'](function(){_0x3b9017[_0x2958('0x10')](0xcc)[_0x2958('0x16')]();});}};}function handleEntityNotFound(_0x259a2a){return function(_0x49289b){if(!_0x49289b){_0x259a2a['sendStatus'](0x194);}return _0x49289b;};}function handleError(_0x5d8a94,_0x341aee){_0x341aee=_0x341aee||0x1f4;return function(_0x54e81e){logger[_0x2958('0x17')](_0x54e81e[_0x2958('0x18')]);if(_0x54e81e[_0x2958('0x19')]){delete _0x54e81e[_0x2958('0x19')];}_0x5d8a94[_0x2958('0x10')](_0x341aee)[_0x2958('0x1a')](_0x54e81e);};}exports[_0x2958('0x1b')]=function(_0x5ce4df,_0x424944){var _0x44d408={};return contacts[_0x2958('0x1c')]()[_0x2958('0x1d')](function(_0x2e826d){_0x44d408=qs[_0x2958('0x1e')](_0x2e826d,_0x5ce4df);return contacts[_0x2958('0x1f')](_0x5ce4df[_0x2958('0x20')],_0x5ce4df[_0x2958('0x21')],_0x44d408,_0x2e826d);})[_0x2958('0x1d')](respondWithFilteredResult(_0x424944,_0x44d408))['catch'](handleError(_0x424944,null));};exports['destroy']=function(_0x4ff538,_0x3d626e){return db[_0x2958('0x22')][_0x2958('0x23')]({'where':{'id':_0x4ff538['params']['id']}})[_0x2958('0x1d')](handleEntityNotFound(_0x3d626e,null))[_0x2958('0x1d')](removeEntity(_0x3d626e,null))[_0x2958('0x24')](handleError(_0x3d626e,null));};exports['describe']=function(_0x4e8a2d,_0x392196){return db[_0x2958('0x22')][_0x2958('0x1c')]()['then'](function(_0x2a8268){delete _0x2a8268['tags'];for(var _0x113cbb=0x0;_0x113cbb0x0){return new Promise(function(_0xd607db){var _0x2b4552=[];for(var _0x22714a=0x0;_0x22714a<_0x3c141a['length'];_0x22714a++){_0x2b4552[_0x2958('0x5a')](insertAdditionalPhones(_0x3c141a[_0x22714a]['contact'],_0x3c141a[_0x22714a][_0x2958('0x55')]));}Promise[_0x2958('0x5e')](_0x2b4552)[_0x2958('0x1d')](function(){_0xd607db(0x1);});})[_0x2958('0x1d')](function(){return{'success':_0x4c0675,'failure':_0x26a27e,'duplicates':_0x24102d};});}else{return{'success':_0x4c0675,'failure':_0x26a27e,'duplicates':_0x24102d};}}})[_0x2958('0x1d')](respondWithResult(_0xa60afe,0xc9))['catch'](handleError(_0xa60afe,null));};exports[_0x2958('0x5f')]=function(_0x1fde70,_0x507132){var _0x1dc5a8;return db[_0x2958('0x22')][_0x2958('0x1c')]()[_0x2958('0x1d')](function(_0x506785){return db[_0x2958('0x22')]['find']({'where':{'id':_0x1fde70[_0x2958('0x60')]['id']},'include':[{'model':db[_0x2958('0x61')],'as':'Tags','attributes':['id','name',_0x2958('0x62')],'required':_0x1fde70[_0x2958('0x20')][_0x2958('0x63')]?!![]:![]},{'model':db[_0x2958('0x45')],'as':_0x2958('0x64'),'where':{'CmContactId':_0x1fde70['params']['id']},'required':![],'include':[{'model':db[_0x2958('0x65')],'as':'ItemType'}]}],'order':[db[_0x2958('0x66')][_0x2958('0x67')]('Phones.OrderBy')],'attributes':_[_0x2958('0x25')](_0x506785)});})[_0x2958('0x1d')](function(_0x1c118d){if(!_[_0x2958('0x52')](_0x1c118d)){_0x1dc5a8=_0x1c118d[_0x2958('0x34')]({'plain':!![]});var _0x4b3fd5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1c118d&&_0x1c118d[_0x2958('0x5b')]){if(_0x1c118d[_0x2958('0x5b')]){_0x4b3fd5[_0x2958('0x59')][_0x2958('0x68')]['push']({'ListId':{'$ne':_0x1c118d[_0x2958('0x5b')]}});}}return db[_0x2958('0x2b')]['findAll'](_0x4b3fd5);}})[_0x2958('0x1d')](function(_0x179f7f){if(!_[_0x2958('0x52')](_0x179f7f)){return _[_0x2958('0x69')](_0x1dc5a8,_[_0x2958('0x6a')](_0x179f7f,function(_0x2bdcc6){return util[_0x2958('0x6b')](_0x2958('0x6c'),_0x2bdcc6['id']);}));}})[_0x2958('0x1d')](handleEntityNotFound(_0x507132,null))[_0x2958('0x1d')](respondWithResult(_0x507132,null))[_0x2958('0x24')](handleError(_0x507132,null));};exports[_0x2958('0x15')]=function(_0x4e66b8,_0xe97151){var _0x405eb8;if(_0x4e66b8[_0x2958('0x32')]['id']){delete _0x4e66b8[_0x2958('0x32')]['id'];}if(!_[_0x2958('0x52')](_0x4e66b8[_0x2958('0x32')][_0x2958('0x51')])){var _0x195eba=_0x4e66b8[_0x2958('0x32')]['dialTimezone'];if(!_[_0x2958('0x52')](shared['timezones'][_0x195eba]))_0x4e66b8[_0x2958('0x32')][_0x2958('0x54')]=shared[_0x2958('0x53')][_0x195eba][_0x2958('0x54')];}return db[_0x2958('0x22')][_0x2958('0x23')]({'where':{'id':_0x4e66b8['params']['id']}})['then'](handleEntityNotFound(_0xe97151,null))['then'](saveUpdates(_0x4e66b8[_0x2958('0x32')],null))['then'](function(_0x64331d){_0x405eb8=_0x64331d;var _0x4467c2={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x64331d&&_0x64331d[_0x2958('0x5b')]){if(_0x64331d[_0x2958('0x5b')]){_0x4467c2['where'][_0x2958('0x68')][_0x2958('0x5a')]({'ListId':{'$ne':_0x64331d[_0x2958('0x5b')]}});}}return db[_0x2958('0x2b')][_0x2958('0x1f')](_0x4467c2);})[_0x2958('0x1d')](function(_0x53b15b){if(_0x53b15b){return _[_0x2958('0x69')](_[_0x2958('0x6d')](_0x4e66b8[_0x2958('0x32')],function(_0x501f09,_0x55db32){return _['startsWith'](_0x55db32,_0x2958('0x27'));}),_[_0x2958('0x6a')](_0x53b15b,function(_0x4ff85d){return util['format']('cf_%d',_0x4ff85d['id']);}));}})[_0x2958('0x1d')](function(_0x4547e0){if(_0x4547e0&&!_['isEmpty'](_0x4547e0)){var _0x528635=squel['update']()[_0x2958('0x6e')]('cm_contacts')['setFields'](_0x4547e0)[_0x2958('0x59')](_0x2958('0x6f'),_0x4e66b8['params']['id'])[_0x2958('0x70')]();return db[_0x2958('0x66')][_0x2958('0x20')](_0x528635[_0x2958('0x71')],{'replacements':_0x528635[_0x2958('0x72')]});}})['then'](function(){if(_0x4e66b8[_0x2958('0x32')][_0x2958('0x73')]&&_0x405eb8){return db['CmHopper'][_0x2958('0x15')]({'phone':_0x4e66b8[_0x2958('0x32')][_0x2958('0x73')],'OrderBy':0x0},{'where':{'ContactId':_0x405eb8['id']}});}})['then'](function(){return _0x405eb8;})[_0x2958('0x1d')](respondWithResult(_0xe97151,null))[_0x2958('0x24')](handleError(_0xe97151,null));};exports[_0x2958('0x74')]=function(_0x11b8bc,_0x42e61d){var _0x49c251={};var _0x293876={};var _0xca62bd;var _0x1e96a2;return db[_0x2958('0x22')][_0x2958('0x75')]({'where':{'id':_0x11b8bc[_0x2958('0x60')]['id']}})[_0x2958('0x1d')](handleEntityNotFound(_0x42e61d,null))[_0x2958('0x1d')](function(_0x476748){if(_0x476748){_0xca62bd=_0x476748;_0x293876[_0x2958('0x76')]=_['keys'](db[_0x2958('0x61')]['rawAttributes']);_0x293876[_0x2958('0x20')]=_[_0x2958('0x25')](_0x11b8bc[_0x2958('0x20')]);_0x293876[_0x2958('0x77')]=_[_0x2958('0x78')](_0x293876['model'],_0x293876[_0x2958('0x20')]);_0x49c251[_0x2958('0x79')]=_[_0x2958('0x78')](_0x293876[_0x2958('0x76')],qs['fields'](_0x11b8bc[_0x2958('0x20')][_0x2958('0x7a')]));_0x49c251[_0x2958('0x79')]=_0x49c251[_0x2958('0x79')][_0x2958('0x26')]?_0x49c251['attributes']:_0x293876[_0x2958('0x76')];_0x49c251[_0x2958('0x7b')]=qs[_0x2958('0x7c')](_0x11b8bc[_0x2958('0x20')][_0x2958('0x7c')]);_0x49c251['where']=qs['filters'](_[_0x2958('0x7d')](_0x11b8bc[_0x2958('0x20')],_0x293876[_0x2958('0x77')]));if(_0x11b8bc[_0x2958('0x20')]['filter']){_0x49c251[_0x2958('0x59')]=_[_0x2958('0x31')](_0x49c251[_0x2958('0x59')],{'$or':_[_0x2958('0x6a')](_0x49c251[_0x2958('0x79')],function(_0x176f94){var _0x12442a={};_0x12442a[_0x176f94]={'$like':'%'+_0x11b8bc[_0x2958('0x20')]['filter']+'%'};return _0x12442a;})});}_0x49c251=_[_0x2958('0x31')]({},_0x49c251,_0x11b8bc[_0x2958('0x7e')]);return _0xca62bd[_0x2958('0x74')](_0x49c251);}})['then'](function(_0x2be22c){if(_0x2be22c){_0x1e96a2=_0x2be22c[_0x2958('0x26')];if(!_0x11b8bc[_0x2958('0x20')][_0x2958('0x7f')](_0x2958('0x80'))){_0x49c251['limit']=qs[_0x2958('0x81')](_0x11b8bc['query']['limit']);_0x49c251[_0x2958('0x12')]=qs[_0x2958('0x12')](_0x11b8bc[_0x2958('0x20')][_0x2958('0x12')]);}return _0xca62bd['getTags'](_0x49c251);}})['then'](function(_0x1aaf70){if(_0x1aaf70){return _0x1aaf70?{'count':_0x1e96a2,'rows':_0x1aaf70}:null;}})[_0x2958('0x1d')](respondWithResult(_0x42e61d,null))['catch'](handleError(_0x42e61d,null));};exports[_0x2958('0x82')]=function(_0x2af91b,_0x406c78){if(_0x2af91b[_0x2958('0x32')]['id']){delete _0x2af91b[_0x2958('0x32')]['id'];}return db[_0x2958('0x22')][_0x2958('0x75')]({'where':{'id':_0x2af91b[_0x2958('0x60')]['id']}})[_0x2958('0x1d')](handleEntityNotFound(_0x406c78,null))[_0x2958('0x1d')](function(_0x2bb9d4){if(_0x2bb9d4){return _0x2bb9d4[_0x2958('0x82')](_0x2af91b[_0x2958('0x32')]['ids']||[]);}return null;})['then'](respondWithResult(_0x406c78,null))[_0x2958('0x24')](handleError(_0x406c78,null));};exports[_0x2958('0x83')]=function(_0xccae28,_0x1bd8a8){var _0x39c005=[];_0x39c005[_0x2958('0x5a')](addAdditionalPhones(_0xccae28[_0x2958('0x32')]));Promise[_0x2958('0x5e')](_0x39c005)[_0x2958('0x1d')](function(){_0x39c005=[];_0x39c005[_0x2958('0x5a')](deleteCmHopperPhones(_0xccae28[_0x2958('0x32')]['id']));_0x39c005[_0x2958('0x5a')](addCmHopperPhones(_0xccae28[_0x2958('0x32')]['id']));Promise[_0x2958('0x5e')](_0x39c005)[_0x2958('0x1d')](function(){return[0x1];})[_0x2958('0x1d')](respondWithResult(_0x1bd8a8,null));});};function addAdditionalPhones(_0x3fcef2){var _0x16ba57;return new Promise(function(_0x2be477){return db[_0x2958('0x45')]['destroy']({'where':{'CmContactId':_0x3fcef2['id']}})[_0x2958('0x1d')](function(){db['ContactItemType'][_0x2958('0x1f')]({'raw':!![],'attributes':['id',_0x2958('0x84')]})[_0x2958('0x1d')](function(_0x426e77){var _0x456961=[];for(var _0x387f52=0x0;_0x387f52<_0x3fcef2[_0x2958('0x85')][_0x2958('0x26')];_0x387f52++){var _0x2861e8=_0x3fcef2[_0x2958('0x86')]?_[_0x2958('0x52')](_0x3fcef2[_0x2958('0x86')][_0x387f52])?'':_0x3fcef2['item_types'][_0x387f52]:_0x3fcef2[_0x2958('0x85')][_0x387f52][_0x2958('0x87')]?_0x3fcef2[_0x2958('0x85')][_0x387f52]['ItemTypeId']:'';var _0x2e2a7b=_['isNil'](_0x3fcef2[_0x2958('0x85')][_0x387f52][_0x2958('0x88')])?'':_0x3fcef2[_0x2958('0x85')][_0x387f52][_0x2958('0x88')];var _0x3b7eb3=_0x2861e8+':'+_0x3fcef2[_0x2958('0x85')][_0x387f52]['phone']+'§'+_0x2e2a7b;if(_[_0x2958('0x52')](_0x16ba57))_0x16ba57=_0x3b7eb3;else _0x16ba57+=';'+_0x3b7eb3;var _0x170472=null;var _0x58ce38=null;if(_0x3fcef2['item_types']){if(!_[_0x2958('0x52')](_0x3fcef2['item_types'][_0x387f52])){_0x58ce38=_[_0x2958('0x23')](_0x426e77,function(_0x310d97){return _0x310d97['id']===_0x3fcef2[_0x2958('0x86')][_0x387f52];});if(!_[_0x2958('0x52')](_0x58ce38)){_0x170472=_0x58ce38[_0x2958('0x84')];}}}else{if(!_[_0x2958('0x52')](_0x3fcef2[_0x2958('0x85')][_0x387f52])){_0x58ce38=_['find'](_0x426e77,function(_0x2e7ea8){return _0x2e7ea8['id']===_0x3fcef2[_0x2958('0x85')][_0x387f52][_0x2958('0x87')];});if(!_[_0x2958('0x52')](_0x58ce38)){_0x170472=_0x387f52;}}}if(_[_0x2958('0x52')](_0x170472)){_0x170472=0x64;}_0x456961[_0x2958('0x5a')](addAdditionalPhone(_0x3fcef2['id'],_0x3fcef2[_0x2958('0x85')][_0x387f52][_0x2958('0x73')],_0x3fcef2[_0x2958('0x86')]?_[_0x2958('0x52')](_0x3fcef2['item_types'][_0x387f52])?null:_0x3fcef2['item_types'][_0x387f52]:_0x3fcef2[_0x2958('0x85')][_0x387f52][_0x2958('0x87')]?_0x3fcef2[_0x2958('0x85')][_0x387f52]['ItemTypeId']:null,_0x170472,_0x2e2a7b));}Promise[_0x2958('0x5e')](_0x456961)[_0x2958('0x1d')](function(){db[_0x2958('0x22')][_0x2958('0x15')]({'AdditionalPhones':_0x16ba57},{'where':{'id':_0x3fcef2['id']}})[_0x2958('0x1d')](function(){_0x2be477(0x1);});});});});});}function addAdditionalPhone(_0x40b05a,_0x381256,_0x5d5574,_0x348a61,_0x54bdc3){return db[_0x2958('0x45')][_0x2958('0x23')]({'where':{'CmContactId':_0x40b05a,'item':_0x381256}})[_0x2958('0x1d')](function(_0x3bae74){if(_0x3bae74)logger[_0x2958('0x2e')]('contact\x20phone\x20exists',_0x3bae74);else{db['CmContactHasItem'][_0x2958('0x50')]({'CmContactId':_0x40b05a,'item':_0x381256,'ItemTypeId':_0x5d5574,'OrderBy':_0x348a61,'ItemClass':_0x2958('0x89'),'description':_0x54bdc3});}});}function deleteCmHopperPhones(_0x257308){return new Promise(function(_0x29b6d3){return db['CmHopper'][_0x2958('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x257308}})['then'](function(_0x59cda5){db[_0x2958('0x8a')][_0x2958('0x3a')]({'where':{'CmHopperId':{'$in':_[_0x2958('0x6a')](_0x59cda5,'id')}}});})['then'](function(){_0x29b6d3(0x1);});});}function addCmHopperPhones(_0x255b99){return new Promise(function(_0xfe3257){return db[_0x2958('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x255b99}})[_0x2958('0x1d')](function(_0x38d95b){var _0x363b06=[];_[_0x2958('0x6a')](_0x38d95b,function(_0x164afb){_0x363b06[_0x2958('0x5a')](createCmHopperPhone(_0x255b99,_0x164afb['id']));});Promise[_0x2958('0x5e')](_0x363b06)[_0x2958('0x1d')](function(){_0xfe3257(0x1);});});});}function createCmHopperPhone(_0x1d099a,_0x23dff9){return new Promise(function(_0x5c9811){db[_0x2958('0x45')][_0x2958('0x1f')]({'raw':!![],'attributes':[_0x2958('0x8b'),_0x2958('0x84')],'where':{'CmContactId':_0x1d099a,'ItemClass':_0x2958('0x89')},'include':[{'model':db['ContactItemType'],'attributes':[_0x2958('0x84')],'as':_0x2958('0x8c')}],'order':[_0x2958('0x84'),db[_0x2958('0x66')][_0x2958('0x67')](_0x2958('0x8d'))]})['then'](function(_0x320731){var _0x596c4b=0x1;var _0xfb621a=_[_0x2958('0x6a')](_0x320731,function(_0x1ba590){_0x1ba590[_0x2958('0x8e')]=_0x23dff9;_0x1ba590['phone']=_0x1ba590['item'];_0x1ba590[_0x2958('0x84')]=_0x596c4b;delete _0x1ba590[_0x2958('0x8f')];_0x596c4b=_0x596c4b+0x1;return _0x1ba590;});return db[_0x2958('0x8a')]['bulkCreate'](_0xfb621a,{});})[_0x2958('0x1d')](function(){_0x5c9811(0x1);});});}function insertAdditionalPhones(_0x15543b,_0x1eb13d){return new Promise(function(_0x436a16){var _0x50cbd8=[];for(var _0x3045e5=0x0;_0x3045e5<_0x1eb13d[_0x2958('0x26')];_0x3045e5++){var _0x203cfb=_0x1eb13d[_0x3045e5];_0x50cbd8[_0x2958('0x5a')](parseContactItemType(_0x203cfb));}Promise[_0x2958('0x5e')](_0x50cbd8)[_0x2958('0x1d')](function(){var _0x1120b2={'id':_0x15543b['id'],'items':_0x1eb13d};return addAdditionalPhones(_0x1120b2)[_0x2958('0x1d')](function(){return addCmHopperPhones(_0x15543b['id']);});})[_0x2958('0x1d')](function(){_0x436a16(_0x15543b);});});}function parseContactItemType(_0x58fda3){return new Promise(function(_0x7a4039){if(_0x58fda3['hasOwnProperty'](_0x2958('0x87'))){_0x7a4039(_0x58fda3);}else{return db['ContactItemType'][_0x2958('0x23')]({'where':{'name':_0x58fda3[_0x2958('0x8c')]}})[_0x2958('0x1d')](function(_0x3f3442){if(_[_0x2958('0x52')](_0x3f3442))_0x58fda3[_0x2958('0x87')]=null;else _0x58fda3[_0x2958('0x87')]=_0x3f3442['id'];_0x7a4039(_0x58fda3);});}});}exports[_0x2958('0x90')]=function(_0x413f1d,_0x2380be){return db['CmContactHasItem'][_0x2958('0x1f')]({'raw':!![],'where':{'CmContactId':_0x413f1d[_0x2958('0x60')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x2958('0x65')],'as':_0x2958('0x8c')}],'order':[['OrderBy'],[db[_0x2958('0x66')][_0x2958('0x67')]('`ItemType`.OrderBy')]]})[_0x2958('0x1d')](function(_0x4703a3){return _0x4703a3;})[_0x2958('0x1d')](respondWithResult(_0x2380be,null))[_0x2958('0x24')](handleError(_0x2380be,null));};exports[_0x2958('0x91')]=function(_0x351373,_0x10d1fd){return db[_0x2958('0x45')][_0x2958('0x1f')]({'raw':!![],'where':{'CmContactId':_0x351373[_0x2958('0x32')]['fromContactId']}})[_0x2958('0x1d')](function(_0x38ea90){var _0x487bf8=_[_0x2958('0x6a')](_0x38ea90,function(_0x23fa69){_0x23fa69[_0x2958('0x92')]=_0x351373[_0x2958('0x32')][_0x2958('0x93')];return _0x23fa69;});return db['CmContactHasItem']['bulkCreate'](_0x487bf8,{});})[_0x2958('0x1d')](function(){return addCmHopperPhones(_0x351373['body']['toContactId']);})[_0x2958('0x1d')](function(){return['ok'];})[_0x2958('0x1d')](respondWithResult(_0x10d1fd,null))[_0x2958('0x24')](handleError(_0x10d1fd,null));};exports[_0x2958('0x94')]=function(_0x4435d7,_0x362e30){var _0x3eef06=[];_0x3eef06[_0x2958('0x5a')](createCmHopperPhone(_0x4435d7[_0x2958('0x32')]['id'],_0x4435d7[_0x2958('0x32')][_0x2958('0x95')]));Promise['all'](_0x3eef06)[_0x2958('0x1d')](function(){return[0x1];})['then'](respondWithResult(_0x362e30,null));};exports['getHoppers']=function(_0xe785ed,_0x39ee9f){var _0xd574ff={'raw':![],'where':{}};var _0x148186={};var _0x117670={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0xe785ed[_0x2958('0x60')]['id']}})[_0x2958('0x1d')](handleEntityNotFound(_0x39ee9f,null))[_0x2958('0x1d')](function(_0x3ab28d){if(_0x3ab28d){_0x148186[_0x2958('0x76')]=_[_0x2958('0x25')](db[_0x2958('0x39')][_0x2958('0x96')]);_0x148186['query']=_[_0x2958('0x25')](_0xe785ed[_0x2958('0x20')]);_0x148186[_0x2958('0x77')]=_[_0x2958('0x78')](_0x148186[_0x2958('0x76')],_0x148186[_0x2958('0x20')]);_0xd574ff[_0x2958('0x79')]=_[_0x2958('0x78')](_0x148186[_0x2958('0x76')],qs[_0x2958('0x7a')](_0xe785ed[_0x2958('0x20')][_0x2958('0x7a')]));_0xd574ff[_0x2958('0x79')]=_0xd574ff['attributes'][_0x2958('0x26')]?_0xd574ff['attributes']:_0x148186['model'];if(!_0xe785ed[_0x2958('0x20')][_0x2958('0x7f')]('nolimit')){_0xd574ff[_0x2958('0x81')]=qs[_0x2958('0x81')](_0xe785ed[_0x2958('0x20')]['limit']);_0xd574ff[_0x2958('0x12')]=qs[_0x2958('0x12')](_0xe785ed[_0x2958('0x20')][_0x2958('0x12')]);}_0xd574ff[_0x2958('0x7b')]=qs['sort'](_0xe785ed[_0x2958('0x20')][_0x2958('0x7c')]);_0xd574ff[_0x2958('0x59')]=qs[_0x2958('0x77')](_[_0x2958('0x7d')](_0xe785ed['query'],_0x148186[_0x2958('0x77')]));_0xd574ff[_0x2958('0x59')][_0x2958('0x97')]=_0x3ab28d['id'];if(_0xe785ed[_0x2958('0x20')][_0x2958('0x98')]){_0xd574ff['where']=_[_0x2958('0x31')](_0xd574ff[_0x2958('0x59')],{'$or':_[_0x2958('0x6a')](_0xd574ff[_0x2958('0x79')],function(_0x55ce7d){var _0x2f1dea={};_0x2f1dea[_0x55ce7d]={'$like':'%'+_0xe785ed['query'][_0x2958('0x98')]+'%'};return _0x2f1dea;})});}_0xd574ff=_['merge']({},_0xd574ff,_0xe785ed[_0x2958('0x7e')]);return db['CmHopper'][_0x2958('0x14')]({'where':_0xd574ff[_0x2958('0x59')]})[_0x2958('0x1d')](function(_0x76c9cc){_0x117670[_0x2958('0x14')]=_0x76c9cc;if(_0xe785ed[_0x2958('0x20')][_0x2958('0x99')]){_0xd574ff[_0x2958('0x9a')]=[{'all':!![]}];}return db[_0x2958('0x39')][_0x2958('0x1f')](_0xd574ff);})[_0x2958('0x1d')](function(_0x57d717){_0x117670[_0x2958('0x9b')]=_0x57d717;return _0x117670;});}})[_0x2958('0x1d')](respondWithFilteredResult(_0x39ee9f,_0xd574ff))['catch'](handleError(_0x39ee9f,null));};exports[_0x2958('0x9c')]=function(_0x5e96b8,_0x5c761b){var _0x28bd5a={'raw':!![],'where':{}};var _0x56bc4d={};var _0x362537={'count':0x0,'rows':[]};return db[_0x2958('0x22')][_0x2958('0x75')]({'where':{'id':_0x5e96b8['params']['id']}})['then'](handleEntityNotFound(_0x5c761b,null))[_0x2958('0x1d')](function(_0x3dc870){if(_0x3dc870){_0x56bc4d[_0x2958('0x76')]=_['keys'](db[_0x2958('0x46')][_0x2958('0x96')]);_0x56bc4d['query']=_[_0x2958('0x25')](_0x5e96b8[_0x2958('0x20')]);_0x56bc4d[_0x2958('0x77')]=_[_0x2958('0x78')](_0x56bc4d[_0x2958('0x76')],_0x56bc4d[_0x2958('0x20')]);_0x28bd5a[_0x2958('0x79')]=_[_0x2958('0x78')](_0x56bc4d[_0x2958('0x76')],qs[_0x2958('0x7a')](_0x5e96b8[_0x2958('0x20')]['fields']));_0x28bd5a[_0x2958('0x79')]=_0x28bd5a[_0x2958('0x79')][_0x2958('0x26')]?_0x28bd5a[_0x2958('0x79')]:_0x56bc4d[_0x2958('0x76')];if(!_0x5e96b8[_0x2958('0x20')][_0x2958('0x7f')](_0x2958('0x80'))){_0x28bd5a[_0x2958('0x81')]=qs['limit'](_0x5e96b8['query'][_0x2958('0x81')]);_0x28bd5a[_0x2958('0x12')]=qs[_0x2958('0x12')](_0x5e96b8['query'][_0x2958('0x12')]);}_0x28bd5a['order']=qs[_0x2958('0x7c')](_0x5e96b8[_0x2958('0x20')][_0x2958('0x7c')]);_0x28bd5a[_0x2958('0x59')]=qs[_0x2958('0x77')](_[_0x2958('0x7d')](_0x5e96b8[_0x2958('0x20')],_0x56bc4d[_0x2958('0x77')]));_0x28bd5a[_0x2958('0x59')][_0x2958('0x97')]=_0x3dc870['id'];if(_0x5e96b8[_0x2958('0x20')][_0x2958('0x98')]){_0x28bd5a['where']=_['merge'](_0x28bd5a[_0x2958('0x59')],{'$or':_[_0x2958('0x6a')](_0x28bd5a[_0x2958('0x79')],function(_0x38f78a){var _0x52618c={};_0x52618c[_0x38f78a]={'$like':'%'+_0x5e96b8[_0x2958('0x20')]['filter']+'%'};return _0x52618c;})});}_0x28bd5a=_[_0x2958('0x31')]({},_0x28bd5a,_0x5e96b8['options']);return db[_0x2958('0x46')][_0x2958('0x14')]({'where':_0x28bd5a[_0x2958('0x59')]})[_0x2958('0x1d')](function(_0x12e976){_0x362537[_0x2958('0x14')]=_0x12e976;if(_0x5e96b8['query']['includeAll']){_0x28bd5a[_0x2958('0x9a')]=[{'all':!![]}];}return db[_0x2958('0x46')][_0x2958('0x1f')](_0x28bd5a);})[_0x2958('0x1d')](function(_0x58d2bc){_0x362537[_0x2958('0x9b')]=_0x58d2bc;return _0x362537;});}})[_0x2958('0x1d')](respondWithFilteredResult(_0x5c761b,_0x28bd5a))[_0x2958('0x24')](handleError(_0x5c761b,null));};exports[_0x2958('0x9d')]=function(_0x1508e2,_0x11d4dc){var _0x4d6a8b={'raw':!![],'where':{}};var _0xb36d57={};var _0x410c84={'count':0x0,'rows':[]};return db[_0x2958('0x22')]['findOne']({'where':{'id':_0x1508e2[_0x2958('0x60')]['id']}})['then'](handleEntityNotFound(_0x11d4dc,null))[_0x2958('0x1d')](function(_0x5081c2){if(_0x5081c2){_0xb36d57[_0x2958('0x76')]=_[_0x2958('0x25')](db[_0x2958('0x9e')][_0x2958('0x96')]);_0xb36d57['query']=_[_0x2958('0x25')](_0x1508e2[_0x2958('0x20')]);_0xb36d57[_0x2958('0x77')]=_[_0x2958('0x78')](_0xb36d57[_0x2958('0x76')],_0xb36d57[_0x2958('0x20')]);_0x4d6a8b[_0x2958('0x79')]=_[_0x2958('0x78')](_0xb36d57['model'],qs['fields'](_0x1508e2['query'][_0x2958('0x7a')]));_0x4d6a8b[_0x2958('0x79')]=_0x4d6a8b[_0x2958('0x79')]['length']?_0x4d6a8b[_0x2958('0x79')]:_0xb36d57['model'];if(!_0x1508e2['query'][_0x2958('0x7f')](_0x2958('0x80'))){_0x4d6a8b[_0x2958('0x81')]=qs['limit'](_0x1508e2[_0x2958('0x20')][_0x2958('0x81')]);_0x4d6a8b['offset']=qs[_0x2958('0x12')](_0x1508e2[_0x2958('0x20')][_0x2958('0x12')]);}_0x4d6a8b[_0x2958('0x7b')]=qs[_0x2958('0x7c')](_0x1508e2[_0x2958('0x20')][_0x2958('0x7c')]);_0x4d6a8b[_0x2958('0x59')]=qs['filters'](_[_0x2958('0x7d')](_0x1508e2[_0x2958('0x20')],_0xb36d57[_0x2958('0x77')]));_0x4d6a8b[_0x2958('0x59')]['ContactId']=_0x5081c2['id'];if(_0x1508e2[_0x2958('0x20')][_0x2958('0x98')]){_0x4d6a8b[_0x2958('0x59')]=_[_0x2958('0x31')](_0x4d6a8b[_0x2958('0x59')],{'$or':_[_0x2958('0x6a')](_0x4d6a8b[_0x2958('0x79')],function(_0x38ab7d){var _0x550d42={};_0x550d42[_0x38ab7d]={'$like':'%'+_0x1508e2[_0x2958('0x20')][_0x2958('0x98')]+'%'};return _0x550d42;})});}_0x4d6a8b=_[_0x2958('0x31')]({},_0x4d6a8b,_0x1508e2[_0x2958('0x7e')]);return db[_0x2958('0x9e')][_0x2958('0x14')]({'where':_0x4d6a8b[_0x2958('0x59')]})[_0x2958('0x1d')](function(_0x29f536){_0x410c84['count']=_0x29f536;if(_0x1508e2[_0x2958('0x20')][_0x2958('0x99')]){_0x4d6a8b[_0x2958('0x9a')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x2958('0x1f')](_0x4d6a8b);})[_0x2958('0x1d')](function(_0x1914e8){_0x410c84[_0x2958('0x9b')]=_0x1914e8;return _0x410c84;});}})[_0x2958('0x1d')](respondWithFilteredResult(_0x11d4dc,_0x4d6a8b))['catch'](handleError(_0x11d4dc,null));};exports[_0x2958('0x9f')]=function(_0x8658da,_0xf0b9ae){var _0x4003e4={'raw':!![],'where':{}};var _0x2c32db={};var _0xd51aa6={'count':0x0,'rows':[]};return db['CmContact'][_0x2958('0x75')]({'where':{'id':_0x8658da[_0x2958('0x60')]['id']}})[_0x2958('0x1d')](handleEntityNotFound(_0xf0b9ae,null))[_0x2958('0x1d')](function(_0x374383){if(_0x374383){_0x2c32db[_0x2958('0x76')]=_['keys'](db[_0x2958('0x4c')]['rawAttributes']);_0x2c32db[_0x2958('0x20')]=_[_0x2958('0x25')](_0x8658da[_0x2958('0x20')]);_0x2c32db[_0x2958('0x77')]=_[_0x2958('0x78')](_0x2c32db[_0x2958('0x76')],_0x2c32db[_0x2958('0x20')]);_0x4003e4[_0x2958('0x79')]=_[_0x2958('0x78')](_0x2c32db['model'],qs['fields'](_0x8658da[_0x2958('0x20')][_0x2958('0x7a')]));_0x4003e4['attributes']=_0x4003e4['attributes'][_0x2958('0x26')]?_0x4003e4[_0x2958('0x79')]:_0x2c32db[_0x2958('0x76')];if(!_0x8658da[_0x2958('0x20')]['hasOwnProperty'](_0x2958('0x80'))){_0x4003e4[_0x2958('0x81')]=qs['limit'](_0x8658da['query']['limit']);_0x4003e4[_0x2958('0x12')]=qs[_0x2958('0x12')](_0x8658da[_0x2958('0x20')][_0x2958('0x12')]);}_0x4003e4[_0x2958('0x7b')]=qs['sort'](_0x8658da[_0x2958('0x20')]['sort']);_0x4003e4[_0x2958('0x59')]=qs[_0x2958('0x77')](_[_0x2958('0x7d')](_0x8658da[_0x2958('0x20')],_0x2c32db[_0x2958('0x77')]));_0x4003e4['where']['ContactId']=_0x374383['id'];if(_0x8658da[_0x2958('0x20')][_0x2958('0x98')]){_0x4003e4[_0x2958('0x59')]=_[_0x2958('0x31')](_0x4003e4[_0x2958('0x59')],{'$or':_[_0x2958('0x6a')](_0x4003e4['attributes'],function(_0x5de095){var _0x1698f2={};_0x1698f2[_0x5de095]={'$like':'%'+_0x8658da[_0x2958('0x20')][_0x2958('0x98')]+'%'};return _0x1698f2;})});}_0x4003e4=_['merge']({},_0x4003e4,_0x8658da[_0x2958('0x7e')]);return db[_0x2958('0x4c')][_0x2958('0x14')]({'where':_0x4003e4['where']})[_0x2958('0x1d')](function(_0x4e52f0){_0xd51aa6[_0x2958('0x14')]=_0x4e52f0;if(_0x8658da[_0x2958('0x20')][_0x2958('0x99')]){_0x4003e4[_0x2958('0x9a')]=[{'all':!![]}];}return db[_0x2958('0x4c')]['findAll'](_0x4003e4);})[_0x2958('0x1d')](function(_0xf0a1dc){_0xd51aa6[_0x2958('0x9b')]=_0xf0a1dc;return _0xd51aa6;});}})[_0x2958('0x1d')](respondWithFilteredResult(_0xf0b9ae,_0x4003e4))[_0x2958('0x24')](handleError(_0xf0b9ae,null));};exports[_0x2958('0xa0')]=function(_0x307e6e,_0xdc2bd3){try{if(!_0x307e6e[_0x2958('0x32')][_0x2958('0x5b')]){throw new Error(_0x2958('0xa1'));}if(!_0x307e6e[_0x2958('0x32')][_0x2958('0xa2')]){throw new Error(_0x2958('0xa3'));}if(!_0x307e6e[_0x2958('0x32')][_0x2958('0xa4')]){throw new Error(_0x2958('0xa5'));}if(!_0x307e6e[_0x2958('0x32')]['socket_timestamp']){throw new Error(_0x2958('0xa6'));}var _0x5d5ac9=_0x307e6e[_0x2958('0x32')][_0x2958('0xa2')][_0x2958('0xa7')](',');var _0x44da7c=_0x307e6e[_0x2958('0x32')][_0x2958('0xa4')][_0x2958('0xa7')](',');if(!_0x5d5ac9[_0x2958('0x26')]||!_0x44da7c[_0x2958('0x26')]||_0x5d5ac9[_0x2958('0x26')]!==_0x44da7c[_0x2958('0x26')]){throw new Error(_0x2958('0xa8'));}_0x307e6e[_0x2958('0x32')][_0x2958('0x7a')]=_['zipObject'](_0x5d5ac9,_0x44da7c);if(!_0x307e6e[_0x2958('0x32')][_0x2958('0x7a')][_0x2958('0x73')]){throw new Error(_0x2958('0xa9'));}if(!_0x307e6e[_0x2958('0x32')][_0x2958('0x7a')][_0x2958('0xaa')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x77c1e1=path['join'](config[_0x2958('0xab')],_0x2958('0xac'),_0x307e6e['file'][_0x2958('0xad')]);fs[_0x2958('0xae')](_0x77c1e1,parseInt('0777',0x8));var _0x198dfa=require(_0x2958('0xaf'))[_0x2958('0xb0')](path[_0x2958('0xb1')](__dirname,_0x2958('0xb2')),[_0x77c1e1,_0x307e6e['body']['binding_keys'],_0x307e6e['body'][_0x2958('0xa4')],_0x307e6e[_0x2958('0x32')][_0x2958('0x5b')],_0x307e6e['body']['CompanyId'],_0x307e6e[_0x2958('0x32')][_0x2958('0x58')],_0x307e6e[_0x2958('0x32')][_0x2958('0xb3')]]);return _0xdc2bd3['status'](0xc8)[_0x2958('0x11')]({'message':'File\x20uploaded\x20correctly!','pid':_0x198dfa['pid']});}catch(_0x4dc429){return _0xdc2bd3['status'](0x1f4)[_0x2958('0x1a')](_0x4dc429);}};exports[_0x2958('0xb4')]=function(_0xac962b,_0x4533c3){var _0x34a36f=fs[_0x2958('0xb5')](_0xac962b[_0x2958('0xb6')]['path']);Papa[_0x2958('0xb7')](_0x34a36f,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0xf318d6){return _0x4533c3[_0x2958('0x10')](0xc8)[_0x2958('0x11')]({'file':_0xac962b[_0x2958('0xb6')],'fields':_0xf318d6[_0x2958('0xb8')][_0x2958('0x7a')]});}});};exports['import']=function(_0x305356,_0x408528){return db[_0x2958('0xb9')][_0x2958('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x2958('0x1d')](function(_0x2d18d2){var _0x1508d1=![];if(!_0x305356[_0x2958('0x32')][_0x2958('0x5b')]){throw new Error(_0x2958('0xa1'));}if(!_0x305356['body']['binding'][_0x2958('0x73')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x305356[_0x2958('0x32')][_0x2958('0xba')][_0x2958('0xaa')]){throw new Error(_0x2958('0xbb'));}if(!_0x305356[_0x2958('0x32')][_0x2958('0xb3')]){throw new Error(_0x2958('0xa6'));}var _0x54a5fc=require(_0x2958('0xaf'))[_0x2958('0xb0')](path[_0x2958('0xb1')](__dirname,_0x2958('0xbc')),[_0x305356[_0x2958('0x60')]['id'],JSON[_0x2958('0xbd')](_0x305356[_0x2958('0x32')]),JSON[_0x2958('0xbd')](_0x2d18d2)]);_0x54a5fc['on'](_0x2958('0xbe'),function(){_0x1508d1=!![];return _0x408528[_0x2958('0x10')](0xc8)[_0x2958('0x11')]({'message':_0x2958('0xbf'),'pid':_0x54a5fc[_0x2958('0xc0')]});});_0x54a5fc['on'](_0x2958('0xc1'),function(_0x428e11){if(_0x428e11&&!_0x1508d1){return _0x408528[_0x2958('0x10')](0x1f4)['json']({'message':_0x2958('0xc2'),'pid':_0x54a5fc['pid']});}});})[_0x2958('0x24')](handleError(_0x408528,null));};exports[_0x2958('0xc3')]=function(_0x406ecd,_0xce0936){return db[_0x2958('0xb9')][_0x2958('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x2958('0x1d')](function(_0x37c43b){var _0x1a8ce7=![];if(!_0x406ecd['body']['ListId']){throw new Error(_0x2958('0xa1'));}if(!_0x406ecd[_0x2958('0x32')][_0x2958('0xba')][_0x2958('0x73')]){throw new Error(_0x2958('0xa9'));}if(!_0x406ecd[_0x2958('0x32')][_0x2958('0xba')][_0x2958('0xaa')]){throw new Error(_0x2958('0xbb'));}if(!_0x406ecd['body'][_0x2958('0xb3')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x2b323c=require(_0x2958('0xaf'))[_0x2958('0xb0')](path[_0x2958('0xb1')](__dirname,_0x2958('0xc4')),[_0x406ecd[_0x2958('0x60')]['id'],JSON['stringify'](_0x406ecd[_0x2958('0x32')]),JSON[_0x2958('0xbd')](_0x37c43b)]);_0x2b323c['on'](_0x2958('0xbe'),function(){_0x1a8ce7=!![];return _0xce0936[_0x2958('0x10')](0xc8)['json']({'message':_0x2958('0xbf'),'pid':_0x2b323c['pid']});});_0x2b323c['on'](_0x2958('0xc1'),function(_0x249d99){if(_0x249d99&&!_0x1a8ce7){return _0xce0936[_0x2958('0x10')](0x1f4)[_0x2958('0x11')]({'message':_0x2958('0xc2'),'pid':_0x2b323c['pid']});}});})[_0x2958('0x24')](handleError(_0xce0936,null));};exports[_0x2958('0xc5')]=function(_0x439db3,_0xa68cf0){var _0x1fa226=[_0x2958('0xc6'),_0x2958('0xc7'),_0x2958('0xc8'),_0x2958('0xc9'),_0x2958('0xca'),_0x2958('0xcb'),_0x2958('0xcc')];var _0x21b0d7={'offset':0x0,'order':qs['sort'](_0x2958('0xcd'))},_0x1169aa={'count':0x0,'rows':[]};Promise[_0x2958('0xce')]()['then'](function(){if(_0x439db3[_0x2958('0x20')][_0x2958('0xcf')]){if(!_[_0x2958('0xd0')](_0x1fa226,_0x439db3['query'][_0x2958('0xcf')][_0x2958('0xd1')]())){throw new Error(_0x2958('0xd2'));}_0x1fa226=[_0x439db3[_0x2958('0x20')][_0x2958('0xcf')][_0x2958('0xd1')]()];}if(_0x439db3['query'][_0x2958('0xd3')]){try{var _0x5e61a5=JSON['parse'](_0x439db3[_0x2958('0x20')]['range']);if(!moment(_0x5e61a5[_0x2958('0x33')])[_0x2958('0xd4')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x5e61a5['to'])[_0x2958('0xd4')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x444dd0){throw new Error(_0x2958('0xd5'));}}if(!_0x439db3['query'][_0x2958('0x7f')]('nolimit')){_0x21b0d7['limit']=qs[_0x2958('0x81')](_0x439db3[_0x2958('0x20')][_0x2958('0x81')]||0xa);_0x21b0d7[_0x2958('0x12')]=qs[_0x2958('0x12')](_0x439db3[_0x2958('0x20')][_0x2958('0x12')]);}var _0x2e64c9=_0x1fa226['map'](function(_0x53269c){if(_0x53269c===_0x2958('0xcc')){var _0x4e3ccb={'attributes':['id',_0x2958('0xd6'),'type',_0x2958('0xd7'),_0x2958('0xd8'),_0x2958('0xd9'),_0x2958('0xda'),_0x2958('0xdb'),_0x2958('0xdc'),_0x2958('0xdd'),_0x2958('0xde'),_0x2958('0xdf'),_0x2958('0xe0'),'userThirdDisposition','UserId'],'where':{'ContactId':_0x439db3[_0x2958('0x60')]['id']},'include':[{'model':db[_0x2958('0xb9')],'as':_0x2958('0xb9'),'attributes':['id',_0x2958('0x19'),_0x2958('0xe1'),_0x2958('0x2c')]}],'order':[[_0x2958('0xde'),'DESC']]};if(_0x439db3[_0x2958('0x20')][_0x2958('0xd3')]){_0x4e3ccb['where'][_0x2958('0xde')]={'$gte':_0x5e61a5['from'],'$lte':_0x5e61a5['to']};}return db[_0x2958('0x48')][_0x2958('0xe2')](_0x4e3ccb)['then'](function(_0x3f8e9c){_0x1169aa[_0x2958('0x14')]+=_0x3f8e9c[_0x2958('0x14')];return _[_0x2958('0x6a')](_0x3f8e9c[_0x2958('0x9b')],function(_0x4c26e8){var _0x5f4bbd=_0x4c26e8[_0x2958('0x34')]({'plain':!![]});_0x5f4bbd[_0x2958('0xcf')]=_0x53269c;if(_0x5f4bbd[_0x2958('0xb9')]){_0x5f4bbd[_0x2958('0xb9')]={'id':_0x5f4bbd[_0x2958('0xb9')]['id'],'name':_0x5f4bbd[_0x2958('0xb9')][_0x2958('0x19')],'fullname':_0x5f4bbd[_0x2958('0xb9')][_0x2958('0xe1')],'alias':_0x5f4bbd[_0x2958('0xb9')][_0x2958('0x2c')]};}return _0x5f4bbd;});});}else{var _0x37f99b=_[_0x2958('0xe3')](_0x53269c)+(_0x53269c===_0x2958('0xc7')?'Website':_0x2958('0xe4'));var _0x56b8b0={'attributes':['id','closed','closedAt',_0x2958('0xde'),'note',_0x2958('0xe5'),'secondDisposition','thirdDisposition',_0x2958('0xe6'),_0x37f99b+'Id'],'where':{'ContactId':_0x439db3[_0x2958('0x60')]['id']},'include':[{'model':db[_0x37f99b],'as':'Account','attributes':['id',_0x2958('0x19'),_0x2958('0xe7')]},{'model':db['User'],'as':_0x2958('0xe8'),'attributes':['id',_0x2958('0x19'),_0x2958('0xe1')]},{'model':db[_0x2958('0x61')],'as':_0x2958('0xe9'),'attributes':['id','name',_0x2958('0x62')],'through':{'attributes':[]}}],'order':[['createdAt',_0x2958('0xea')]]};if(_0x439db3[_0x2958('0x20')][_0x2958('0xd3')]){_0x56b8b0[_0x2958('0x59')]['createdAt']={'$gte':_0x5e61a5[_0x2958('0x33')],'$lte':_0x5e61a5['to']};}switch(_0x53269c){case _0x2958('0xc7'):_0x56b8b0[_0x2958('0x79')][_0x2958('0x5a')](_0x2958('0xeb'),_0x2958('0xec'),_0x2958('0xed'),_0x2958('0xee'),'osName',_0x2958('0xef'),_0x2958('0xf0'),'ratingValue',_0x2958('0xf1'));break;case _0x2958('0xc6'):_0x56b8b0[_0x2958('0x79')][_0x2958('0x5a')]('subject',_0x2958('0xf2'));break;case'openchannel':_0x56b8b0['attributes'][_0x2958('0x5a')](_0x2958('0xf3'),_0x2958('0xf4'));break;}return db[_[_0x2958('0xe3')](_0x53269c)+'Interaction'][_0x2958('0xe2')](_0x56b8b0)[_0x2958('0x1d')](function(_0x1ae511){_0x1169aa['count']+=_0x1ae511['count'];return _['map'](_0x1ae511[_0x2958('0x9b')],function(_0x2e18b7){var _0x3cd4a2=_0x2e18b7[_0x2958('0x34')]({'plain':!![]});_0x3cd4a2[_0x2958('0xcf')]=_0x53269c;if(_0x3cd4a2[_0x2958('0xe8')]){_0x3cd4a2[_0x2958('0xe8')]={'id':_0x3cd4a2[_0x2958('0xe8')]['id'],'name':_0x3cd4a2[_0x2958('0xe8')][_0x2958('0x19')],'fullname':_0x3cd4a2[_0x2958('0xe8')][_0x2958('0xe1')]};}return _0x3cd4a2;});});}});return Promise[_0x2958('0x5e')](_0x2e64c9);})[_0x2958('0x1d')](function(_0xf16241){return _(_0xf16241)[_0x2958('0xf5')]()[_0x2958('0xf6')](_0x2958('0xde'))['reverse']()[_0x2958('0xf7')]();})['then'](function(_0x3a3da3){_0x1169aa[_0x2958('0x9b')]=_0x21b0d7[_0x2958('0x81')]?_0x3a3da3[_0x2958('0xf8')](_0x21b0d7['offset'],_0x21b0d7['offset']+_0x21b0d7[_0x2958('0x81')]):_0x3a3da3;return _0x1169aa;})[_0x2958('0x1d')](respondWithFilteredResult(_0xa68cf0,_0x21b0d7))['catch'](handleError(_0xa68cf0,null));}; \ No newline at end of file +var _0x99d7=['socket.io-emitter','./cmContact.socket','register','status','json','offset','limit','undefined','count','Content-Range','then','end','sendStatus','error','stack','name','send','index','describe','query','user','catch','destroy','CmContact','find','params','tags','keys','startsWith','cf_','columnName','analytics','length','displayName','type','values','hasOwnProperty','merge','body','findAll','from','get','mergeWith','isArray','join','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','create','isNil','dialTimezone','timezones','utcOffset','bulkCreate','each','duplicates','where','ListId','findOrCreate','spread','additionalPhones','push','all','show','Tag','Tags','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','CmCustomField','omit','map','format','cf_%d','pickBy','isEmpty','table','cm_contacts','setFields','phone','getTags','rawAttributes','filters','intersection','model','fields','attributes','order','sort','filter','options','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','hopperId','getHoppers','pick','ContactId','include','rows','includeAll','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','file','meta','User','agent','binding','firstName','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','getJourney','mail','chat','fax','whatsapp','voice','-createdAt','includes','channel','Invalid\x20channel','toLowerCase','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','UserId','fullname','alias','findAndCountAll','startCase','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','key','Owner','color','DESC','customerIp','deviceModel','osName','ratingMessage','ratingType','ratingValue','subject','substatus','openchannel','externalUrl','threadId','Interaction','flatten','sortBy','value','moment','bluebird','util','path','squel','ioredis','../../components/contacts','../../config/logger','api','../../config/environment','../../config/environment/shared','redis'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0x99d7,0x1e4));var _0x799d=function(_0xef4ad0,_0x5d4d71){_0xef4ad0=_0xef4ad0-0x0;var _0x4b9b00=_0x99d7[_0xef4ad0];return _0x4b9b00;};'use strict';var moment=require(_0x799d('0x0'));var BPromise=require(_0x799d('0x1'));var util=require(_0x799d('0x2'));var path=require(_0x799d('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x799d('0x4'));var Papa=require('papaparse');var Redis=require(_0x799d('0x5'));var contacts=require(_0x799d('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x799d('0x7'))(_0x799d('0x8'));var config=require(_0x799d('0x9'));var shared=require(_0x799d('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x799d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x799d('0xc'))(new Redis(config['redis']));require(_0x799d('0xd'))[_0x799d('0xe')](socket);function respondWithResult(_0x492dd1,_0xc761c6){_0xc761c6=_0xc761c6||0xc8;return function(_0x157b96){if(_0x157b96){return _0x492dd1[_0x799d('0xf')](_0xc761c6)[_0x799d('0x10')](_0x157b96);}};}function respondWithFilteredResult(_0x11f129,_0x256025){return function(_0x211f9c){if(_0x211f9c){var _0x26a820=typeof _0x256025[_0x799d('0x11')]==='undefined'&&typeof _0x256025[_0x799d('0x12')]===_0x799d('0x13');var _0x1bb15f=_0x211f9c[_0x799d('0x14')];var _0x1b543e=_0x26a820?0x0:_0x256025[_0x799d('0x11')];var _0x2fc35b=_0x26a820?_0x211f9c[_0x799d('0x14')]:_0x256025['offset']+_0x256025[_0x799d('0x12')];var _0x205246;if(_0x2fc35b>=_0x1bb15f){_0x2fc35b=_0x1bb15f;_0x205246=0xc8;}else{_0x205246=0xce;}_0x11f129['status'](_0x205246);return _0x11f129['set'](_0x799d('0x15'),_0x1b543e+'-'+_0x2fc35b+'/'+_0x1bb15f)[_0x799d('0x10')](_0x211f9c);}return null;};}function saveUpdates(_0x45ceb0){return function(_0x53b9ae){if(_0x53b9ae){return _0x53b9ae['update'](_0x45ceb0)[_0x799d('0x16')](function(_0x263dfa){return _0x263dfa;});}return null;};}function removeEntity(_0x355522){return function(_0x16a1c2){if(_0x16a1c2){return _0x16a1c2['destroy']()[_0x799d('0x16')](function(){_0x355522[_0x799d('0xf')](0xcc)[_0x799d('0x17')]();});}};}function handleEntityNotFound(_0x53dc90){return function(_0x5bec72){if(!_0x5bec72){_0x53dc90[_0x799d('0x18')](0x194);}return _0x5bec72;};}function handleError(_0x18de72,_0x440979){_0x440979=_0x440979||0x1f4;return function(_0x49830a){logger[_0x799d('0x19')](_0x49830a[_0x799d('0x1a')]);if(_0x49830a[_0x799d('0x1b')]){delete _0x49830a[_0x799d('0x1b')];}_0x18de72['status'](_0x440979)[_0x799d('0x1c')](_0x49830a);};}exports[_0x799d('0x1d')]=function(_0x3f8c0b,_0x4e8342){var _0x392fba={};return contacts[_0x799d('0x1e')]()['then'](function(_0x22b9f2){_0x392fba=qs['getOptions'](_0x22b9f2,_0x3f8c0b);return contacts['findAll'](_0x3f8c0b[_0x799d('0x1f')],_0x3f8c0b[_0x799d('0x20')],_0x392fba,_0x22b9f2);})[_0x799d('0x16')](respondWithFilteredResult(_0x4e8342,_0x392fba))[_0x799d('0x21')](handleError(_0x4e8342,null));};exports[_0x799d('0x22')]=function(_0x55e7b1,_0x3b0142){return db[_0x799d('0x23')][_0x799d('0x24')]({'where':{'id':_0x55e7b1[_0x799d('0x25')]['id']}})['then'](handleEntityNotFound(_0x3b0142,null))[_0x799d('0x16')](removeEntity(_0x3b0142,null))[_0x799d('0x21')](handleError(_0x3b0142,null));};exports['describe']=function(_0x4b3675,_0x472be7){return db['CmContact']['describe']()[_0x799d('0x16')](function(_0x543f11){delete _0x543f11[_0x799d('0x26')];for(var _0x396499=0x0;_0x3964990x0){return new Promise(function(_0x12d290){var _0x4330bd=[];for(var _0x558b21=0x0;_0x558b21<_0x2f20fc[_0x799d('0x2c')];_0x558b21++){_0x4330bd[_0x799d('0x5d')](insertAdditionalPhones(_0x2f20fc[_0x558b21]['contact'],_0x2f20fc[_0x558b21]['additionalPhones']));}Promise[_0x799d('0x5e')](_0x4330bd)['then'](function(){_0x12d290(0x1);});})[_0x799d('0x16')](function(){return{'success':_0x3c278a,'failure':_0x47dcbd,'duplicates':_0xf105cd};});}else{return{'success':_0x3c278a,'failure':_0x47dcbd,'duplicates':_0xf105cd};}}})[_0x799d('0x16')](respondWithResult(_0x1d108a,0xc9))[_0x799d('0x21')](handleError(_0x1d108a,null));};exports[_0x799d('0x5f')]=function(_0x21d020,_0xd9a51d){var _0x253566;return db['CmContact'][_0x799d('0x1e')]()[_0x799d('0x16')](function(_0x5e5458){return db['CmContact'][_0x799d('0x24')]({'where':{'id':_0x21d020['params']['id']},'include':[{'model':db[_0x799d('0x60')],'as':_0x799d('0x61'),'attributes':['id',_0x799d('0x1b'),'color'],'required':_0x21d020[_0x799d('0x1f')]['tag']?!![]:![]},{'model':db[_0x799d('0x46')],'as':'Phones','where':{'CmContactId':_0x21d020[_0x799d('0x25')]['id']},'required':![],'include':[{'model':db[_0x799d('0x62')],'as':_0x799d('0x63')}]}],'order':[db[_0x799d('0x64')][_0x799d('0x65')](_0x799d('0x66'))],'attributes':_[_0x799d('0x27')](_0x5e5458)});})['then'](function(_0x21bf31){if(!_[_0x799d('0x51')](_0x21bf31)){_0x253566=_0x21bf31[_0x799d('0x35')]({'plain':!![]});var _0x271f5d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x21bf31&&_0x21bf31['ListId']){if(_0x21bf31[_0x799d('0x59')]){_0x271f5d[_0x799d('0x58')][_0x799d('0x67')][_0x799d('0x5d')]({'ListId':{'$ne':_0x21bf31['ListId']}});}}return db[_0x799d('0x68')]['findAll'](_0x271f5d);}})[_0x799d('0x16')](function(_0x445db6){if(!_[_0x799d('0x51')](_0x445db6)){return _[_0x799d('0x69')](_0x253566,_[_0x799d('0x6a')](_0x445db6,function(_0x47d16b){return util[_0x799d('0x6b')](_0x799d('0x6c'),_0x47d16b['id']);}));}})[_0x799d('0x16')](handleEntityNotFound(_0xd9a51d,null))[_0x799d('0x16')](respondWithResult(_0xd9a51d,null))[_0x799d('0x21')](handleError(_0xd9a51d,null));};exports[_0x799d('0x3e')]=function(_0x5d4696,_0x5294bc){var _0x44dd16;if(_0x5d4696[_0x799d('0x32')]['id']){delete _0x5d4696[_0x799d('0x32')]['id'];}if(!_[_0x799d('0x51')](_0x5d4696[_0x799d('0x32')][_0x799d('0x52')])){var _0xc9c248=_0x5d4696[_0x799d('0x32')][_0x799d('0x52')];if(!_[_0x799d('0x51')](shared[_0x799d('0x53')][_0xc9c248]))_0x5d4696[_0x799d('0x32')]['utcOffset']=shared[_0x799d('0x53')][_0xc9c248]['utcOffset'];}return db[_0x799d('0x23')][_0x799d('0x24')]({'where':{'id':_0x5d4696[_0x799d('0x25')]['id']}})[_0x799d('0x16')](handleEntityNotFound(_0x5294bc,null))[_0x799d('0x16')](saveUpdates(_0x5d4696['body'],null))['then'](function(_0x2f2a27){_0x44dd16=_0x2f2a27;var _0x54aced={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2f2a27&&_0x2f2a27[_0x799d('0x59')]){if(_0x2f2a27[_0x799d('0x59')]){_0x54aced['where'][_0x799d('0x67')][_0x799d('0x5d')]({'ListId':{'$ne':_0x2f2a27[_0x799d('0x59')]}});}}return db['CmCustomField'][_0x799d('0x33')](_0x54aced);})[_0x799d('0x16')](function(_0x40b3af){if(_0x40b3af){return _['omit'](_[_0x799d('0x6d')](_0x5d4696['body'],function(_0x563e42,_0x3f7fd2){return _['startsWith'](_0x3f7fd2,_0x799d('0x29'));}),_[_0x799d('0x6a')](_0x40b3af,function(_0x108a5b){return util[_0x799d('0x6b')](_0x799d('0x6c'),_0x108a5b['id']);}));}})[_0x799d('0x16')](function(_0x2e20fa){if(_0x2e20fa&&!_[_0x799d('0x6e')](_0x2e20fa)){var _0xece75b=squel[_0x799d('0x3e')]()[_0x799d('0x6f')](_0x799d('0x70'))[_0x799d('0x71')](_0x2e20fa)[_0x799d('0x58')]('id\x20=\x20?',_0x5d4696[_0x799d('0x25')]['id'])['toParam']();return db['sequelize'][_0x799d('0x1f')](_0xece75b['text'],{'replacements':_0xece75b['values']});}})['then'](function(){if(_0x5d4696[_0x799d('0x32')]['phone']&&_0x44dd16){return db[_0x799d('0x39')][_0x799d('0x3e')]({'phone':_0x5d4696['body'][_0x799d('0x72')],'OrderBy':0x0},{'where':{'ContactId':_0x44dd16['id']}});}})['then'](function(){return _0x44dd16;})[_0x799d('0x16')](respondWithResult(_0x5294bc,null))[_0x799d('0x21')](handleError(_0x5294bc,null));};exports[_0x799d('0x73')]=function(_0x24830d,_0x27e556){var _0x4a49e6={};var _0xb2a9ee={};var _0x224e32;var _0x3e2b4c;return db[_0x799d('0x23')]['findOne']({'where':{'id':_0x24830d[_0x799d('0x25')]['id']}})['then'](handleEntityNotFound(_0x27e556,null))[_0x799d('0x16')](function(_0x22468a){if(_0x22468a){_0x224e32=_0x22468a;_0xb2a9ee['model']=_['keys'](db[_0x799d('0x60')][_0x799d('0x74')]);_0xb2a9ee[_0x799d('0x1f')]=_['keys'](_0x24830d['query']);_0xb2a9ee[_0x799d('0x75')]=_[_0x799d('0x76')](_0xb2a9ee['model'],_0xb2a9ee['query']);_0x4a49e6['attributes']=_[_0x799d('0x76')](_0xb2a9ee[_0x799d('0x77')],qs[_0x799d('0x78')](_0x24830d['query'][_0x799d('0x78')]));_0x4a49e6[_0x799d('0x79')]=_0x4a49e6[_0x799d('0x79')]['length']?_0x4a49e6['attributes']:_0xb2a9ee[_0x799d('0x77')];_0x4a49e6[_0x799d('0x7a')]=qs['sort'](_0x24830d[_0x799d('0x1f')][_0x799d('0x7b')]);_0x4a49e6[_0x799d('0x58')]=qs[_0x799d('0x75')](_['pick'](_0x24830d['query'],_0xb2a9ee[_0x799d('0x75')]));if(_0x24830d[_0x799d('0x1f')]['filter']){_0x4a49e6[_0x799d('0x58')]=_[_0x799d('0x31')](_0x4a49e6[_0x799d('0x58')],{'$or':_['map'](_0x4a49e6[_0x799d('0x79')],function(_0xb21bc6){var _0x21118b={};_0x21118b[_0xb21bc6]={'$like':'%'+_0x24830d[_0x799d('0x1f')][_0x799d('0x7c')]+'%'};return _0x21118b;})});}_0x4a49e6=_['merge']({},_0x4a49e6,_0x24830d[_0x799d('0x7d')]);return _0x224e32[_0x799d('0x73')](_0x4a49e6);}})[_0x799d('0x16')](function(_0x4707d6){if(_0x4707d6){_0x3e2b4c=_0x4707d6[_0x799d('0x2c')];if(!_0x24830d['query'][_0x799d('0x30')](_0x799d('0x7e'))){_0x4a49e6['limit']=qs[_0x799d('0x12')](_0x24830d[_0x799d('0x1f')][_0x799d('0x12')]);_0x4a49e6[_0x799d('0x11')]=qs[_0x799d('0x11')](_0x24830d[_0x799d('0x1f')][_0x799d('0x11')]);}return _0x224e32[_0x799d('0x73')](_0x4a49e6);}})[_0x799d('0x16')](function(_0x566c6d){if(_0x566c6d){return _0x566c6d?{'count':_0x3e2b4c,'rows':_0x566c6d}:null;}})[_0x799d('0x16')](respondWithResult(_0x27e556,null))[_0x799d('0x21')](handleError(_0x27e556,null));};exports[_0x799d('0x7f')]=function(_0x51c20d,_0x2fb4d5){if(_0x51c20d[_0x799d('0x32')]['id']){delete _0x51c20d['body']['id'];}return db[_0x799d('0x23')][_0x799d('0x80')]({'where':{'id':_0x51c20d[_0x799d('0x25')]['id']}})[_0x799d('0x16')](handleEntityNotFound(_0x2fb4d5,null))[_0x799d('0x16')](function(_0x30c9d8){if(_0x30c9d8){return _0x30c9d8[_0x799d('0x7f')](_0x51c20d[_0x799d('0x32')][_0x799d('0x81')]||[]);}return null;})[_0x799d('0x16')](respondWithResult(_0x2fb4d5,null))['catch'](handleError(_0x2fb4d5,null));};exports[_0x799d('0x82')]=function(_0x16e96c,_0x32ee31){var _0x32e5b1=[];_0x32e5b1['push'](addAdditionalPhones(_0x16e96c[_0x799d('0x32')]));Promise[_0x799d('0x5e')](_0x32e5b1)[_0x799d('0x16')](function(){_0x32e5b1=[];_0x32e5b1[_0x799d('0x5d')](deleteCmHopperPhones(_0x16e96c[_0x799d('0x32')]['id']));_0x32e5b1[_0x799d('0x5d')](addCmHopperPhones(_0x16e96c[_0x799d('0x32')]['id']));Promise[_0x799d('0x5e')](_0x32e5b1)['then'](function(){return[0x1];})[_0x799d('0x16')](respondWithResult(_0x32ee31,null));});};function addAdditionalPhones(_0x403521){var _0xf72631;return new Promise(function(_0x3b41e2){return db[_0x799d('0x46')][_0x799d('0x22')]({'where':{'CmContactId':_0x403521['id']}})['then'](function(){db[_0x799d('0x62')][_0x799d('0x33')]({'raw':!![],'attributes':['id',_0x799d('0x83')]})[_0x799d('0x16')](function(_0x224579){var _0xc58e1c=[];for(var _0x112476=0x0;_0x112476<_0x403521[_0x799d('0x84')][_0x799d('0x2c')];_0x112476++){var _0x469582=_0x403521['item_types']?_[_0x799d('0x51')](_0x403521['item_types'][_0x112476])?'':_0x403521[_0x799d('0x85')][_0x112476]:_0x403521[_0x799d('0x84')][_0x112476][_0x799d('0x86')]?_0x403521[_0x799d('0x84')][_0x112476][_0x799d('0x86')]:'';var _0x504e38=_[_0x799d('0x51')](_0x403521[_0x799d('0x84')][_0x112476]['description'])?'':_0x403521[_0x799d('0x84')][_0x112476]['description'];var _0x4c316d=_0x469582+':'+_0x403521[_0x799d('0x84')][_0x112476][_0x799d('0x72')]+'§'+_0x504e38;if(_[_0x799d('0x51')](_0xf72631))_0xf72631=_0x4c316d;else _0xf72631+=';'+_0x4c316d;var _0x5761df=null;var _0xba0cee=null;if(_0x403521[_0x799d('0x85')]){if(!_[_0x799d('0x51')](_0x403521[_0x799d('0x85')][_0x112476])){_0xba0cee=_[_0x799d('0x24')](_0x224579,function(_0xe4c46){return _0xe4c46['id']===_0x403521[_0x799d('0x85')][_0x112476];});if(!_[_0x799d('0x51')](_0xba0cee)){_0x5761df=_0xba0cee['OrderBy'];}}}else{if(!_[_0x799d('0x51')](_0x403521[_0x799d('0x84')][_0x112476])){_0xba0cee=_[_0x799d('0x24')](_0x224579,function(_0x2033e3){return _0x2033e3['id']===_0x403521[_0x799d('0x84')][_0x112476][_0x799d('0x86')];});if(!_[_0x799d('0x51')](_0xba0cee)){_0x5761df=_0x112476;}}}if(_['isNil'](_0x5761df)){_0x5761df=0x64;}_0xc58e1c[_0x799d('0x5d')](addAdditionalPhone(_0x403521['id'],_0x403521['items'][_0x112476]['phone'],_0x403521[_0x799d('0x85')]?_[_0x799d('0x51')](_0x403521['item_types'][_0x112476])?null:_0x403521[_0x799d('0x85')][_0x112476]:_0x403521[_0x799d('0x84')][_0x112476][_0x799d('0x86')]?_0x403521[_0x799d('0x84')][_0x112476][_0x799d('0x86')]:null,_0x5761df,_0x504e38));}Promise[_0x799d('0x5e')](_0xc58e1c)[_0x799d('0x16')](function(){db[_0x799d('0x23')][_0x799d('0x3e')]({'AdditionalPhones':_0xf72631},{'where':{'id':_0x403521['id']}})[_0x799d('0x16')](function(){_0x3b41e2(0x1);});});});});});}function addAdditionalPhone(_0x605ff4,_0x23bf55,_0x145f24,_0x53d434,_0x5420ed){return db[_0x799d('0x46')][_0x799d('0x24')]({'where':{'CmContactId':_0x605ff4,'item':_0x23bf55}})[_0x799d('0x16')](function(_0x1e4b83){if(_0x1e4b83)logger[_0x799d('0x3a')](_0x799d('0x87'),_0x1e4b83);else{db[_0x799d('0x46')]['create']({'CmContactId':_0x605ff4,'item':_0x23bf55,'ItemTypeId':_0x145f24,'OrderBy':_0x53d434,'ItemClass':_0x799d('0x88'),'description':_0x5420ed});}});}function deleteCmHopperPhones(_0x5b0bab){return new Promise(function(_0x3019de){return db[_0x799d('0x39')][_0x799d('0x33')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5b0bab}})[_0x799d('0x16')](function(_0x34d607){db[_0x799d('0x89')][_0x799d('0x22')]({'where':{'CmHopperId':{'$in':_[_0x799d('0x6a')](_0x34d607,'id')}}});})[_0x799d('0x16')](function(){_0x3019de(0x1);});});}function addCmHopperPhones(_0x49d07e){return new Promise(function(_0x3528a0){return db[_0x799d('0x39')][_0x799d('0x33')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x49d07e}})['then'](function(_0x56b2f0){var _0x480636=[];_[_0x799d('0x6a')](_0x56b2f0,function(_0x2fba3a){_0x480636[_0x799d('0x5d')](createCmHopperPhone(_0x49d07e,_0x2fba3a['id']));});Promise[_0x799d('0x5e')](_0x480636)[_0x799d('0x16')](function(){_0x3528a0(0x1);});});});}function createCmHopperPhone(_0x4cb45a,_0x3067d1){return new Promise(function(_0x442273){db['CmContactHasItem']['findAll']({'raw':!![],'attributes':[_0x799d('0x8a'),_0x799d('0x83')],'where':{'CmContactId':_0x4cb45a,'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'attributes':[_0x799d('0x83')],'as':_0x799d('0x63')}],'order':[_0x799d('0x83'),db[_0x799d('0x64')][_0x799d('0x65')](_0x799d('0x8b'))]})['then'](function(_0x46d2b9){var _0x5d04b9=0x1;var _0x35bcd4=_[_0x799d('0x6a')](_0x46d2b9,function(_0x557df4){_0x557df4[_0x799d('0x8c')]=_0x3067d1;_0x557df4[_0x799d('0x72')]=_0x557df4[_0x799d('0x8a')];_0x557df4[_0x799d('0x83')]=_0x5d04b9;delete _0x557df4[_0x799d('0x8d')];_0x5d04b9=_0x5d04b9+0x1;return _0x557df4;});return db['CmHopperAdditionalPhone'][_0x799d('0x55')](_0x35bcd4,{});})[_0x799d('0x16')](function(){_0x442273(0x1);});});}function insertAdditionalPhones(_0xed22c5,_0x192ee3){return new Promise(function(_0xd96370){var _0x5c048f=[];for(var _0x45327d=0x0;_0x45327d<_0x192ee3[_0x799d('0x2c')];_0x45327d++){var _0x97ad23=_0x192ee3[_0x45327d];_0x5c048f[_0x799d('0x5d')](parseContactItemType(_0x97ad23));}Promise[_0x799d('0x5e')](_0x5c048f)[_0x799d('0x16')](function(){var _0x31744f={'id':_0xed22c5['id'],'items':_0x192ee3};return addAdditionalPhones(_0x31744f)['then'](function(){return addCmHopperPhones(_0xed22c5['id']);});})[_0x799d('0x16')](function(){_0xd96370(_0xed22c5);});});}function parseContactItemType(_0x4fea41){return new Promise(function(_0x83b1a){if(_0x4fea41[_0x799d('0x30')](_0x799d('0x86'))){_0x83b1a(_0x4fea41);}else{return db[_0x799d('0x62')][_0x799d('0x24')]({'where':{'name':_0x4fea41[_0x799d('0x63')]}})['then'](function(_0x46d87d){if(_[_0x799d('0x51')](_0x46d87d))_0x4fea41[_0x799d('0x86')]=null;else _0x4fea41['ItemTypeId']=_0x46d87d['id'];_0x83b1a(_0x4fea41);});}});}exports[_0x799d('0x8e')]=function(_0x4e57a0,_0xe35ac5){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x4e57a0['params']['id'],'ItemClass':_0x799d('0x88')},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[[_0x799d('0x83')],[db[_0x799d('0x64')][_0x799d('0x65')]('`ItemType`.OrderBy')]]})['then'](function(_0x3696fd){return _0x3696fd;})[_0x799d('0x16')](respondWithResult(_0xe35ac5,null))['catch'](handleError(_0xe35ac5,null));};exports[_0x799d('0x8f')]=function(_0x3466b1,_0x46a2be){return db[_0x799d('0x46')][_0x799d('0x33')]({'raw':!![],'where':{'CmContactId':_0x3466b1[_0x799d('0x32')][_0x799d('0x90')]}})[_0x799d('0x16')](function(_0x27e65a){var _0x377053=_['map'](_0x27e65a,function(_0x55d36c){_0x55d36c[_0x799d('0x91')]=_0x3466b1[_0x799d('0x32')][_0x799d('0x92')];return _0x55d36c;});return db[_0x799d('0x46')][_0x799d('0x55')](_0x377053,{});})['then'](function(){return addCmHopperPhones(_0x3466b1[_0x799d('0x32')]['toContactId']);})['then'](function(){return['ok'];})['then'](respondWithResult(_0x46a2be,null))['catch'](handleError(_0x46a2be,null));};exports['rescheduleAdditionalPhones']=function(_0x3da924,_0x24b63c){var _0x63d9b1=[];_0x63d9b1[_0x799d('0x5d')](createCmHopperPhone(_0x3da924['body']['id'],_0x3da924[_0x799d('0x32')][_0x799d('0x93')]));Promise['all'](_0x63d9b1)[_0x799d('0x16')](function(){return[0x1];})[_0x799d('0x16')](respondWithResult(_0x24b63c,null));};exports[_0x799d('0x94')]=function(_0x364936,_0x5413b4){var _0x3cb47f={'raw':![],'where':{}};var _0x4980bd={};var _0x3fa12b={'count':0x0,'rows':[]};return db[_0x799d('0x23')][_0x799d('0x80')]({'where':{'id':_0x364936[_0x799d('0x25')]['id']}})[_0x799d('0x16')](handleEntityNotFound(_0x5413b4,null))[_0x799d('0x16')](function(_0x590840){if(_0x590840){_0x4980bd[_0x799d('0x77')]=_['keys'](db['CmHopper']['rawAttributes']);_0x4980bd[_0x799d('0x1f')]=_[_0x799d('0x27')](_0x364936[_0x799d('0x1f')]);_0x4980bd[_0x799d('0x75')]=_[_0x799d('0x76')](_0x4980bd[_0x799d('0x77')],_0x4980bd[_0x799d('0x1f')]);_0x3cb47f[_0x799d('0x79')]=_[_0x799d('0x76')](_0x4980bd[_0x799d('0x77')],qs[_0x799d('0x78')](_0x364936[_0x799d('0x1f')][_0x799d('0x78')]));_0x3cb47f[_0x799d('0x79')]=_0x3cb47f['attributes'][_0x799d('0x2c')]?_0x3cb47f[_0x799d('0x79')]:_0x4980bd[_0x799d('0x77')];if(!_0x364936[_0x799d('0x1f')][_0x799d('0x30')](_0x799d('0x7e'))){_0x3cb47f['limit']=qs['limit'](_0x364936[_0x799d('0x1f')][_0x799d('0x12')]);_0x3cb47f[_0x799d('0x11')]=qs[_0x799d('0x11')](_0x364936[_0x799d('0x1f')][_0x799d('0x11')]);}_0x3cb47f[_0x799d('0x7a')]=qs[_0x799d('0x7b')](_0x364936['query'][_0x799d('0x7b')]);_0x3cb47f['where']=qs[_0x799d('0x75')](_[_0x799d('0x95')](_0x364936['query'],_0x4980bd['filters']));_0x3cb47f['where'][_0x799d('0x96')]=_0x590840['id'];if(_0x364936[_0x799d('0x1f')][_0x799d('0x7c')]){_0x3cb47f[_0x799d('0x58')]=_['merge'](_0x3cb47f[_0x799d('0x58')],{'$or':_['map'](_0x3cb47f[_0x799d('0x79')],function(_0x3686fd){var _0x1141da={};_0x1141da[_0x3686fd]={'$like':'%'+_0x364936[_0x799d('0x1f')][_0x799d('0x7c')]+'%'};return _0x1141da;})});}_0x3cb47f=_[_0x799d('0x31')]({},_0x3cb47f,_0x364936[_0x799d('0x7d')]);return db[_0x799d('0x39')]['count']({'where':_0x3cb47f[_0x799d('0x58')]})[_0x799d('0x16')](function(_0x299504){_0x3fa12b['count']=_0x299504;if(_0x364936[_0x799d('0x1f')]['includeAll']){_0x3cb47f[_0x799d('0x97')]=[{'all':!![]}];}return db[_0x799d('0x39')][_0x799d('0x33')](_0x3cb47f);})[_0x799d('0x16')](function(_0x11c7d9){_0x3fa12b[_0x799d('0x98')]=_0x11c7d9;return _0x3fa12b;});}})[_0x799d('0x16')](respondWithFilteredResult(_0x5413b4,_0x3cb47f))[_0x799d('0x21')](handleError(_0x5413b4,null));};exports['getHopperHistories']=function(_0x4fc354,_0x4eb8a1){var _0x134d00={'raw':!![],'where':{}};var _0x32419b={};var _0x6c189c={'count':0x0,'rows':[]};return db[_0x799d('0x23')][_0x799d('0x80')]({'where':{'id':_0x4fc354[_0x799d('0x25')]['id']}})[_0x799d('0x16')](handleEntityNotFound(_0x4eb8a1,null))[_0x799d('0x16')](function(_0xa3769){if(_0xa3769){_0x32419b[_0x799d('0x77')]=_[_0x799d('0x27')](db[_0x799d('0x48')][_0x799d('0x74')]);_0x32419b[_0x799d('0x1f')]=_[_0x799d('0x27')](_0x4fc354[_0x799d('0x1f')]);_0x32419b[_0x799d('0x75')]=_['intersection'](_0x32419b[_0x799d('0x77')],_0x32419b[_0x799d('0x1f')]);_0x134d00[_0x799d('0x79')]=_[_0x799d('0x76')](_0x32419b['model'],qs['fields'](_0x4fc354[_0x799d('0x1f')][_0x799d('0x78')]));_0x134d00[_0x799d('0x79')]=_0x134d00[_0x799d('0x79')][_0x799d('0x2c')]?_0x134d00['attributes']:_0x32419b['model'];if(!_0x4fc354[_0x799d('0x1f')][_0x799d('0x30')]('nolimit')){_0x134d00[_0x799d('0x12')]=qs[_0x799d('0x12')](_0x4fc354[_0x799d('0x1f')][_0x799d('0x12')]);_0x134d00[_0x799d('0x11')]=qs[_0x799d('0x11')](_0x4fc354[_0x799d('0x1f')][_0x799d('0x11')]);}_0x134d00[_0x799d('0x7a')]=qs[_0x799d('0x7b')](_0x4fc354[_0x799d('0x1f')]['sort']);_0x134d00[_0x799d('0x58')]=qs[_0x799d('0x75')](_[_0x799d('0x95')](_0x4fc354[_0x799d('0x1f')],_0x32419b[_0x799d('0x75')]));_0x134d00[_0x799d('0x58')][_0x799d('0x96')]=_0xa3769['id'];if(_0x4fc354[_0x799d('0x1f')][_0x799d('0x7c')]){_0x134d00[_0x799d('0x58')]=_['merge'](_0x134d00[_0x799d('0x58')],{'$or':_[_0x799d('0x6a')](_0x134d00[_0x799d('0x79')],function(_0x1b4748){var _0x489f1b={};_0x489f1b[_0x1b4748]={'$like':'%'+_0x4fc354[_0x799d('0x1f')][_0x799d('0x7c')]+'%'};return _0x489f1b;})});}_0x134d00=_[_0x799d('0x31')]({},_0x134d00,_0x4fc354['options']);return db[_0x799d('0x48')]['count']({'where':_0x134d00['where']})[_0x799d('0x16')](function(_0x4e2b8b){_0x6c189c[_0x799d('0x14')]=_0x4e2b8b;if(_0x4fc354[_0x799d('0x1f')][_0x799d('0x99')]){_0x134d00[_0x799d('0x97')]=[{'all':!![]}];}return db[_0x799d('0x48')]['findAll'](_0x134d00);})[_0x799d('0x16')](function(_0x17efc3){_0x6c189c[_0x799d('0x98')]=_0x17efc3;return _0x6c189c;});}})[_0x799d('0x16')](respondWithFilteredResult(_0x4eb8a1,_0x134d00))[_0x799d('0x21')](handleError(_0x4eb8a1,null));};exports[_0x799d('0x9a')]=function(_0x4c999f,_0x4542fc){var _0x2659c4={'raw':!![],'where':{}};var _0x513d24={};var _0x37e8db={'count':0x0,'rows':[]};return db['CmContact'][_0x799d('0x80')]({'where':{'id':_0x4c999f[_0x799d('0x25')]['id']}})[_0x799d('0x16')](handleEntityNotFound(_0x4542fc,null))['then'](function(_0x3016a0){if(_0x3016a0){_0x513d24[_0x799d('0x77')]=_[_0x799d('0x27')](db[_0x799d('0x47')][_0x799d('0x74')]);_0x513d24['query']=_[_0x799d('0x27')](_0x4c999f[_0x799d('0x1f')]);_0x513d24[_0x799d('0x75')]=_[_0x799d('0x76')](_0x513d24[_0x799d('0x77')],_0x513d24[_0x799d('0x1f')]);_0x2659c4['attributes']=_['intersection'](_0x513d24[_0x799d('0x77')],qs[_0x799d('0x78')](_0x4c999f[_0x799d('0x1f')]['fields']));_0x2659c4[_0x799d('0x79')]=_0x2659c4[_0x799d('0x79')][_0x799d('0x2c')]?_0x2659c4['attributes']:_0x513d24[_0x799d('0x77')];if(!_0x4c999f['query']['hasOwnProperty'](_0x799d('0x7e'))){_0x2659c4[_0x799d('0x12')]=qs[_0x799d('0x12')](_0x4c999f[_0x799d('0x1f')][_0x799d('0x12')]);_0x2659c4[_0x799d('0x11')]=qs[_0x799d('0x11')](_0x4c999f[_0x799d('0x1f')]['offset']);}_0x2659c4[_0x799d('0x7a')]=qs['sort'](_0x4c999f[_0x799d('0x1f')]['sort']);_0x2659c4[_0x799d('0x58')]=qs[_0x799d('0x75')](_[_0x799d('0x95')](_0x4c999f[_0x799d('0x1f')],_0x513d24[_0x799d('0x75')]));_0x2659c4['where']['ContactId']=_0x3016a0['id'];if(_0x4c999f['query'][_0x799d('0x7c')]){_0x2659c4[_0x799d('0x58')]=_['merge'](_0x2659c4['where'],{'$or':_[_0x799d('0x6a')](_0x2659c4[_0x799d('0x79')],function(_0x5ee304){var _0x72eda2={};_0x72eda2[_0x5ee304]={'$like':'%'+_0x4c999f[_0x799d('0x1f')][_0x799d('0x7c')]+'%'};return _0x72eda2;})});}_0x2659c4=_['merge']({},_0x2659c4,_0x4c999f['options']);return db[_0x799d('0x47')][_0x799d('0x14')]({'where':_0x2659c4[_0x799d('0x58')]})[_0x799d('0x16')](function(_0x212ba6){_0x37e8db[_0x799d('0x14')]=_0x212ba6;if(_0x4c999f[_0x799d('0x1f')]['includeAll']){_0x2659c4[_0x799d('0x97')]=[{'all':!![]}];}return db[_0x799d('0x47')][_0x799d('0x33')](_0x2659c4);})['then'](function(_0x1f9fb8){_0x37e8db[_0x799d('0x98')]=_0x1f9fb8;return _0x37e8db;});}})[_0x799d('0x16')](respondWithFilteredResult(_0x4542fc,_0x2659c4))[_0x799d('0x21')](handleError(_0x4542fc,null));};exports[_0x799d('0x9b')]=function(_0x89b643,_0x466077){var _0x1e0630={'raw':!![],'where':{}};var _0x29d52f={};var _0x360485={'count':0x0,'rows':[]};return db[_0x799d('0x23')][_0x799d('0x80')]({'where':{'id':_0x89b643[_0x799d('0x25')]['id']}})[_0x799d('0x16')](handleEntityNotFound(_0x466077,null))[_0x799d('0x16')](function(_0x2d7c91){if(_0x2d7c91){_0x29d52f[_0x799d('0x77')]=_[_0x799d('0x27')](db[_0x799d('0x4e')][_0x799d('0x74')]);_0x29d52f[_0x799d('0x1f')]=_[_0x799d('0x27')](_0x89b643[_0x799d('0x1f')]);_0x29d52f[_0x799d('0x75')]=_[_0x799d('0x76')](_0x29d52f[_0x799d('0x77')],_0x29d52f[_0x799d('0x1f')]);_0x1e0630[_0x799d('0x79')]=_[_0x799d('0x76')](_0x29d52f[_0x799d('0x77')],qs[_0x799d('0x78')](_0x89b643['query']['fields']));_0x1e0630[_0x799d('0x79')]=_0x1e0630[_0x799d('0x79')][_0x799d('0x2c')]?_0x1e0630[_0x799d('0x79')]:_0x29d52f['model'];if(!_0x89b643[_0x799d('0x1f')][_0x799d('0x30')](_0x799d('0x7e'))){_0x1e0630['limit']=qs['limit'](_0x89b643[_0x799d('0x1f')][_0x799d('0x12')]);_0x1e0630[_0x799d('0x11')]=qs[_0x799d('0x11')](_0x89b643[_0x799d('0x1f')]['offset']);}_0x1e0630[_0x799d('0x7a')]=qs[_0x799d('0x7b')](_0x89b643[_0x799d('0x1f')]['sort']);_0x1e0630[_0x799d('0x58')]=qs[_0x799d('0x75')](_[_0x799d('0x95')](_0x89b643[_0x799d('0x1f')],_0x29d52f['filters']));_0x1e0630['where']['ContactId']=_0x2d7c91['id'];if(_0x89b643[_0x799d('0x1f')][_0x799d('0x7c')]){_0x1e0630[_0x799d('0x58')]=_[_0x799d('0x31')](_0x1e0630[_0x799d('0x58')],{'$or':_[_0x799d('0x6a')](_0x1e0630[_0x799d('0x79')],function(_0x2b2fb2){var _0x45dc35={};_0x45dc35[_0x2b2fb2]={'$like':'%'+_0x89b643['query'][_0x799d('0x7c')]+'%'};return _0x45dc35;})});}_0x1e0630=_[_0x799d('0x31')]({},_0x1e0630,_0x89b643['options']);return db[_0x799d('0x4e')][_0x799d('0x14')]({'where':_0x1e0630[_0x799d('0x58')]})[_0x799d('0x16')](function(_0x507197){_0x360485['count']=_0x507197;if(_0x89b643['query'][_0x799d('0x99')]){_0x1e0630[_0x799d('0x97')]=[{'all':!![]}];}return db[_0x799d('0x4e')][_0x799d('0x33')](_0x1e0630);})[_0x799d('0x16')](function(_0x517fd9){_0x360485[_0x799d('0x98')]=_0x517fd9;return _0x360485;});}})[_0x799d('0x16')](respondWithFilteredResult(_0x466077,_0x1e0630))[_0x799d('0x21')](handleError(_0x466077,null));};exports['uploadCsv']=function(_0x10d180,_0x699d1a){try{if(!_0x10d180[_0x799d('0x32')][_0x799d('0x59')]){throw new Error(_0x799d('0x9c'));}if(!_0x10d180[_0x799d('0x32')][_0x799d('0x9d')]){throw new Error(_0x799d('0x9e'));}if(!_0x10d180[_0x799d('0x32')][_0x799d('0x9f')]){throw new Error(_0x799d('0xa0'));}if(!_0x10d180[_0x799d('0x32')][_0x799d('0xa1')]){throw new Error(_0x799d('0xa2'));}var _0x4c739c=_0x10d180[_0x799d('0x32')][_0x799d('0x9d')][_0x799d('0xa3')](',');var _0x4aba0f=_0x10d180[_0x799d('0x32')][_0x799d('0x9f')][_0x799d('0xa3')](',');if(!_0x4c739c[_0x799d('0x2c')]||!_0x4aba0f[_0x799d('0x2c')]||_0x4c739c[_0x799d('0x2c')]!==_0x4aba0f[_0x799d('0x2c')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x10d180[_0x799d('0x32')][_0x799d('0x78')]=_[_0x799d('0xa4')](_0x4c739c,_0x4aba0f);if(!_0x10d180[_0x799d('0x32')][_0x799d('0x78')][_0x799d('0x72')]){throw new Error(_0x799d('0xa5'));}if(!_0x10d180[_0x799d('0x32')][_0x799d('0x78')]['firstName']){throw new Error(_0x799d('0xa6'));}var _0x28ae0a=path['join'](config['root'],'server/files/tmp',_0x10d180['file'][_0x799d('0xa7')]);fs[_0x799d('0xa8')](_0x28ae0a,parseInt(_0x799d('0xa9'),0x8));var _0x55de57=require(_0x799d('0xaa'))[_0x799d('0xab')](path['join'](__dirname,_0x799d('0xac')),[_0x28ae0a,_0x10d180[_0x799d('0x32')]['binding_keys'],_0x10d180[_0x799d('0x32')][_0x799d('0x9f')],_0x10d180[_0x799d('0x32')][_0x799d('0x59')],_0x10d180[_0x799d('0x32')][_0x799d('0xad')],_0x10d180[_0x799d('0x32')][_0x799d('0x57')],_0x10d180[_0x799d('0x32')][_0x799d('0xa1')]]);return _0x699d1a[_0x799d('0xf')](0xc8)[_0x799d('0x10')]({'message':_0x799d('0xae'),'pid':_0x55de57[_0x799d('0xaf')]});}catch(_0x53af15){return _0x699d1a[_0x799d('0xf')](0x1f4)[_0x799d('0x1c')](_0x53af15);}};exports[_0x799d('0xb0')]=function(_0x3b8c3e,_0x11e072){var _0x461e18=fs[_0x799d('0xb1')](_0x3b8c3e[_0x799d('0xb2')][_0x799d('0x3')]);Papa['parse'](_0x461e18,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x46fa24){return _0x11e072[_0x799d('0xf')](0xc8)[_0x799d('0x10')]({'file':_0x3b8c3e[_0x799d('0xb2')],'fields':_0x46fa24[_0x799d('0xb3')][_0x799d('0x78')]});}});};exports['import']=function(_0x1712d0,_0x417743){return db[_0x799d('0xb4')][_0x799d('0x33')]({'raw':!![],'attributes':['id'],'where':{'role':_0x799d('0xb5')}})[_0x799d('0x16')](function(_0x5871c9){var _0x406755=![];if(!_0x1712d0[_0x799d('0x32')][_0x799d('0x59')]){throw new Error('No\x20ListId\x20specified');}if(!_0x1712d0['body'][_0x799d('0xb6')][_0x799d('0x72')]){throw new Error(_0x799d('0xa5'));}if(!_0x1712d0[_0x799d('0x32')][_0x799d('0xb6')][_0x799d('0xb7')]){throw new Error(_0x799d('0xa6'));}if(!_0x1712d0[_0x799d('0x32')][_0x799d('0xa1')]){throw new Error(_0x799d('0xa2'));}var _0x76bf16=require(_0x799d('0xaa'))[_0x799d('0xab')](path[_0x799d('0x38')](__dirname,_0x799d('0xb8')),[_0x1712d0['params']['id'],JSON[_0x799d('0xb9')](_0x1712d0['body']),JSON['stringify'](_0x5871c9)]);_0x76bf16['on'](_0x799d('0xba'),function(){_0x406755=!![];return _0x417743[_0x799d('0xf')](0xc8)[_0x799d('0x10')]({'message':_0x799d('0xbb'),'pid':_0x76bf16[_0x799d('0xaf')]});});_0x76bf16['on'](_0x799d('0xbc'),function(_0x903cb3){if(_0x903cb3&&!_0x406755){return _0x417743[_0x799d('0xf')](0x1f4)[_0x799d('0x10')]({'message':_0x799d('0xbd'),'pid':_0x76bf16[_0x799d('0xaf')]});}});})['catch'](handleError(_0x417743,null));};exports[_0x799d('0xbe')]=function(_0x6f1e93,_0xe2c80b){return db[_0x799d('0xb4')][_0x799d('0x33')]({'raw':!![],'attributes':['id'],'where':{'role':_0x799d('0xb5')}})['then'](function(_0x125926){var _0x1cde16=![];if(!_0x6f1e93[_0x799d('0x32')][_0x799d('0x59')]){throw new Error(_0x799d('0x9c'));}if(!_0x6f1e93['body'][_0x799d('0xb6')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x6f1e93['body'][_0x799d('0xb6')][_0x799d('0xb7')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x6f1e93[_0x799d('0x32')][_0x799d('0xa1')]){throw new Error(_0x799d('0xa2'));}var _0x5a1cfb=require('child_process')[_0x799d('0xab')](path[_0x799d('0x38')](__dirname,'../../components/import/cm/csvUpdates'),[_0x6f1e93[_0x799d('0x25')]['id'],JSON[_0x799d('0xb9')](_0x6f1e93[_0x799d('0x32')]),JSON['stringify'](_0x125926)]);_0x5a1cfb['on']('message',function(){_0x1cde16=!![];return _0xe2c80b[_0x799d('0xf')](0xc8)[_0x799d('0x10')]({'message':_0x799d('0xbb'),'pid':_0x5a1cfb[_0x799d('0xaf')]});});_0x5a1cfb['on']('exit',function(_0x258810){if(_0x258810&&!_0x1cde16){return _0xe2c80b[_0x799d('0xf')](0x1f4)['json']({'message':_0x799d('0xbd'),'pid':_0x5a1cfb[_0x799d('0xaf')]});}});})[_0x799d('0x21')](handleError(_0xe2c80b,null));};exports[_0x799d('0xbf')]=function(_0xd61d6b,_0x495e09){var _0x286243=[_0x799d('0xc0'),_0x799d('0xc1'),'sms','openchannel',_0x799d('0xc2'),_0x799d('0xc3'),_0x799d('0xc4')];var _0x62ff6a={'offset':0x0,'order':qs[_0x799d('0x7b')](_0x799d('0xc5'))},_0x4fe8ba={'count':0x0,'rows':[]};Promise['resolve']()[_0x799d('0x16')](function(){if(_0xd61d6b[_0x799d('0x1f')]['channel']){if(!_[_0x799d('0xc6')](_0x286243,_0xd61d6b[_0x799d('0x1f')][_0x799d('0xc7')]['toLowerCase']())){throw new Error(_0x799d('0xc8'));}_0x286243=[_0xd61d6b[_0x799d('0x1f')][_0x799d('0xc7')][_0x799d('0xc9')]()];}if(_0xd61d6b[_0x799d('0x1f')][_0x799d('0xca')]){try{var _0x10dfb6=JSON[_0x799d('0xcb')](_0xd61d6b[_0x799d('0x1f')][_0x799d('0xca')]);if(!moment(_0x10dfb6['from'])[_0x799d('0xcc')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x10dfb6['to'])[_0x799d('0xcc')]()){throw new Error(_0x799d('0xcd'));}}catch(_0x2798b6){throw new Error(_0x799d('0xce'));}}if(!_0xd61d6b[_0x799d('0x1f')][_0x799d('0x30')]('nolimit')){_0x62ff6a[_0x799d('0x12')]=qs[_0x799d('0x12')](_0xd61d6b[_0x799d('0x1f')][_0x799d('0x12')]||0xa);_0x62ff6a[_0x799d('0x11')]=qs['offset'](_0xd61d6b['query'][_0x799d('0x11')]);}var _0x132f65=_0x286243[_0x799d('0x6a')](function(_0x96f270){if(_0x96f270==='voice'){var _0x14e30b={'attributes':['id',_0x799d('0xcf'),_0x799d('0x2e'),_0x799d('0xd0'),_0x799d('0xd1'),_0x799d('0xd2'),'starttime',_0x799d('0xd3'),_0x799d('0xd4'),_0x799d('0xd5'),_0x799d('0xd6'),_0x799d('0xd7'),_0x799d('0xd8'),'userThirdDisposition',_0x799d('0xd9')],'where':{'ContactId':_0xd61d6b['params']['id']},'include':[{'model':db[_0x799d('0xb4')],'as':_0x799d('0xb4'),'attributes':['id',_0x799d('0x1b'),_0x799d('0xda'),_0x799d('0xdb')]}],'order':[[_0x799d('0xd6'),'DESC']]};if(_0xd61d6b[_0x799d('0x1f')][_0x799d('0xca')]){_0x14e30b[_0x799d('0x58')][_0x799d('0xd6')]={'$gte':_0x10dfb6[_0x799d('0x34')],'$lte':_0x10dfb6['to']};}return db[_0x799d('0x4a')][_0x799d('0xdc')](_0x14e30b)[_0x799d('0x16')](function(_0x5e2cdf){_0x4fe8ba[_0x799d('0x14')]+=_0x5e2cdf[_0x799d('0x14')];return _[_0x799d('0x6a')](_0x5e2cdf[_0x799d('0x98')],function(_0x52d3c6){var _0x499ccc=_0x52d3c6[_0x799d('0x35')]({'plain':!![]});_0x499ccc[_0x799d('0xc7')]=_0x96f270;if(_0x499ccc[_0x799d('0xb4')]){_0x499ccc['User']={'id':_0x499ccc[_0x799d('0xb4')]['id'],'name':_0x499ccc['User'][_0x799d('0x1b')],'fullname':_0x499ccc[_0x799d('0xb4')][_0x799d('0xda')],'alias':_0x499ccc[_0x799d('0xb4')][_0x799d('0xdb')]};}return _0x499ccc;});});}else{var _0x2a2696=_[_0x799d('0xdd')](_0x96f270)+(_0x96f270===_0x799d('0xc1')?_0x799d('0xde'):_0x799d('0xdf'));var _0x35c7b2={'attributes':['id',_0x799d('0xe0'),_0x799d('0xe1'),_0x799d('0xd6'),_0x799d('0xd5'),_0x799d('0xe2'),_0x799d('0xe3'),_0x799d('0xe4'),_0x799d('0xd9'),_0x2a2696+'Id'],'where':{'ContactId':_0xd61d6b['params']['id']},'include':[{'model':db[_0x2a2696],'as':'Account','attributes':['id',_0x799d('0x1b'),_0x799d('0xe5')]},{'model':db[_0x799d('0xb4')],'as':_0x799d('0xe6'),'attributes':['id',_0x799d('0x1b'),_0x799d('0xda')]},{'model':db[_0x799d('0x60')],'as':'Tags','attributes':['id',_0x799d('0x1b'),_0x799d('0xe7')],'through':{'attributes':[]}}],'order':[[_0x799d('0xd6'),_0x799d('0xe8')]]};if(_0xd61d6b[_0x799d('0x1f')][_0x799d('0xca')]){_0x35c7b2[_0x799d('0x58')]['createdAt']={'$gte':_0x10dfb6['from'],'$lte':_0x10dfb6['to']};}switch(_0x96f270){case _0x799d('0xc1'):_0x35c7b2['attributes'][_0x799d('0x5d')]('browserName',_0x799d('0xe9'),'customerPort',_0x799d('0xea'),_0x799d('0xeb'),_0x799d('0xec'),_0x799d('0xed'),_0x799d('0xee'),'referer');break;case _0x799d('0xc0'):_0x35c7b2[_0x799d('0x79')][_0x799d('0x5d')](_0x799d('0xef'),_0x799d('0xf0'));break;case _0x799d('0xf1'):_0x35c7b2[_0x799d('0x79')]['push'](_0x799d('0xf2'),_0x799d('0xf3'));break;}return db[_[_0x799d('0xdd')](_0x96f270)+_0x799d('0xf4')][_0x799d('0xdc')](_0x35c7b2)[_0x799d('0x16')](function(_0x4b1eb9){_0x4fe8ba[_0x799d('0x14')]+=_0x4b1eb9[_0x799d('0x14')];return _[_0x799d('0x6a')](_0x4b1eb9[_0x799d('0x98')],function(_0x1a6c48){var _0x1b9201=_0x1a6c48[_0x799d('0x35')]({'plain':!![]});_0x1b9201[_0x799d('0xc7')]=_0x96f270;if(_0x1b9201[_0x799d('0xe6')]){_0x1b9201[_0x799d('0xe6')]={'id':_0x1b9201[_0x799d('0xe6')]['id'],'name':_0x1b9201[_0x799d('0xe6')]['name'],'fullname':_0x1b9201[_0x799d('0xe6')]['fullname']};}return _0x1b9201;});});}});return Promise[_0x799d('0x5e')](_0x132f65);})[_0x799d('0x16')](function(_0x3e5355){return _(_0x3e5355)[_0x799d('0xf5')]()[_0x799d('0xf6')](_0x799d('0xd6'))['reverse']()[_0x799d('0xf7')]();})['then'](function(_0x450a04){_0x4fe8ba['rows']=_0x62ff6a[_0x799d('0x12')]?_0x450a04['slice'](_0x62ff6a[_0x799d('0x11')],_0x62ff6a[_0x799d('0x11')]+_0x62ff6a[_0x799d('0x12')]):_0x450a04;return _0x4fe8ba;})[_0x799d('0x16')](respondWithFilteredResult(_0x495e09,_0x62ff6a))[_0x799d('0x21')](handleError(_0x495e09,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 6dd219d..ef46752 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 _0x5765=['events','../../mysqldb','CmContact','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x2f09f7,_0x461707){var _0x1b266c=function(_0xbff8dc){while(--_0xbff8dc){_0x2f09f7['push'](_0x2f09f7['shift']());}};_0x1b266c(++_0x461707);}(_0x5765,0x157));var _0x5576=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0x5765[_0x441563];return _0x2369ec;};'use strict';var EventEmitter=require(_0x5576('0x0'));var CmContact=require(_0x5576('0x1'))['db'][_0x5576('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x5576('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5576('0x4'),'afterDestroy':'remove'};function emitEvent(_0x10bc6e){return function(_0x405ef9,_0x3a6d40,_0xee07b9){CmContactEvents['emit'](_0x10bc6e+':'+_0x405ef9['id'],_0x405ef9);CmContactEvents[_0x5576('0x5')](_0x10bc6e,_0x405ef9);_0xee07b9(null);};}for(var e in events){if(events[_0x5576('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x8550=['CmContact','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x42160f,_0x29ffd2){var _0x992d2a=function(_0x379a6a){while(--_0x379a6a){_0x42160f['push'](_0x42160f['shift']());}};_0x992d2a(++_0x29ffd2);}(_0x8550,0x7c));var _0x0855=function(_0x43ff8a,_0x5cca86){_0x43ff8a=_0x43ff8a-0x0;var _0x1d49b7=_0x8550[_0x43ff8a];return _0x1d49b7;};'use strict';var EventEmitter=require(_0x0855('0x0'));var CmContact=require(_0x0855('0x1'))['db'][_0x0855('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x0855('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0855('0x4'),'afterDestroy':_0x0855('0x5')};function emitEvent(_0x281853){return function(_0x10bee8,_0x385daf,_0x437ad0){CmContactEvents[_0x0855('0x6')](_0x281853+':'+_0x10bee8['id'],_0x10bee8);CmContactEvents['emit'](_0x281853,_0x10bee8);_0x437ad0(null);};}for(var e in events){if(events[_0x0855('0x7')](e)){var event=events[e];CmContact[_0x0855('0x8')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index e62bfc9..6c0c12a 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 _0x04e8=['create','format','timezones','add','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','Lists','length','dialCheckDuplicateType','always','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','onlyIfOpen','List\x20not\x20found','isEmpty','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Error]','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','phone','fti_cm_contacts','lastName','mobile','FULLTEXT','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','utcOffset','then','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'];(function(_0x1d75f7,_0x139d5e){var _0x307f9a=function(_0x400ae1){while(--_0x400ae1){_0x1d75f7['push'](_0x1d75f7['shift']());}};_0x307f9a(++_0x139d5e);}(_0x04e8,0xf8));var _0x804e=function(_0x313f4b,_0x3d3759){_0x313f4b=_0x313f4b-0x0;var _0x57634c=_0x04e8[_0x313f4b];return _0x57634c;};'use strict';var _=require('lodash');var util=require(_0x804e('0x0'));var logger=require(_0x804e('0x1'))(_0x804e('0x2'));var moment=require(_0x804e('0x3'));var BPromise=require('bluebird');var rp=require(_0x804e('0x4'));var fs=require('fs');var path=require(_0x804e('0x5'));var rimraf=require(_0x804e('0x6'));var config=require('../../config/environment');var shared=require(_0x804e('0x7'));var attributes=require(_0x804e('0x8'));module[_0x804e('0x9')]=function(_0x316d90,_0x47e9cf){return _0x316d90[_0x804e('0xa')]('CmContact',attributes,{'tableName':_0x804e('0xb'),'paranoid':!![],'indexes':[{'name':_0x804e('0xc'),'fields':[_0x804e('0xc')]},{'name':_0x804e('0xd'),'fields':['firstName',_0x804e('0xe'),_0x804e('0xc'),_0x804e('0xf'),'fax','email'],'type':_0x804e('0x10')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x804e('0x11'),'hooks':{'afterCreate':function(_0x553314,_0x208806,_0x3eac6d){var _0x248013=_0x316d90[_0x804e('0x12')];var _0x75c909=_0x553314[_0x804e('0x13')]({'plain':!![]});function _0x5199f3(){return function(_0x5f08af){logger[_0x804e('0x14')](_0x804e('0x15'),_0x804e('0x16'),util[_0x804e('0x17')](_0x5f08af,{'showHidden':![],'depth':null}));};}function _0x5053e0(_0x10f665,_0x176b37){var _0x453d50=_0x176b37[_0x804e('0x18')]?_0x176b37[_0x804e('0x18')]:moment()['format'](_0x804e('0x19'));return new BPromise(function(_0x1d3511,_0x43da49){if(_[_0x804e('0x1a')](_0x176b37[_0x804e('0x1b')])){_0x1d3511({'ret':_0x453d50});}else{_0x248013[_0x804e('0x1c')][_0x804e('0x1d')]({'where':{'id':_0x10f665['id']}})['then'](function(_0x252d11){if(!_[_0x804e('0x1a')](_0x252d11)){var _0x22049a=_0x252d11[_0x804e('0x1b')];if(!_['isNil'](_0x22049a)){var _0x2a311d=shared['timezones'];var _0x5ba3fb=_0x2a311d[_0x22049a];var _0x209a97=_0x2a311d[_0x176b37[_0x804e('0x1b')]];if(!_[_0x804e('0x1a')](_0x5ba3fb)&&!_[_0x804e('0x1a')](_0x209a97)){var _0x121d54=_0x5ba3fb['utcOffset']-_0x209a97[_0x804e('0x1e')];_0x453d50=_0x176b37[_0x804e('0x18')]?_0x176b37['scheduledat']:moment();var _0x323d0b=moment(_0x453d50)['add'](_0x121d54,'minutes');_0x1d3511({'ret':_0x323d0b['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x1d3511({'ret':_0x453d50});}else _0x1d3511({'ret':_0x453d50});}else{_0x1d3511({'ret':_0x453d50});}});}});return 0xa;}var _0x517373=function(_0x41bb39){return new BPromise(function(_0x29fd13,_0x4e9551){_0x5053e0(_0x41bb39,_0x75c909)[_0x804e('0x1f')](function(_0x131c4e){_0x75c909[_0x804e('0x18')]=_0x131c4e[_0x804e('0x20')];_0x248013[_0x804e('0x21')][_0x804e('0x1d')]({'where':{'phone':_0x75c909[_0x804e('0xc')],'VoiceQueueId':_0x41bb39['id']}})[_0x804e('0x1f')](function(_0xddedc6){if(!_[_0x804e('0x1a')](_0xddedc6)){throw new Error(_0x804e('0x22')+_0x75c909[_0x804e('0xc')]+_0x804e('0x23')+_0x41bb39['id']);}return _0x248013[_0x804e('0x21')]['create']({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909[_0x804e('0x24')],'priority':_0x75c909[_0x804e('0x25')]?_0x75c909[_0x804e('0x25')]:0x2,'scheduledat':_0x75c909[_0x804e('0x18')]?_0x75c909[_0x804e('0x18')]:moment()['format'](_0x804e('0x19')),'callback':_0x75c909['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x75c909[_0x804e('0x26')]?_0x75c909[_0x804e('0x26')]:undefined,'callbackat':_0x75c909[_0x804e('0x26')]?moment()['format'](_0x804e('0x19')):undefined,'VoiceQueueId':_0x41bb39['id']});})[_0x804e('0x27')](function(_0x3ecb43){_0x4e9551(_0x3ecb43);});});});};var _0x3489b6=function(_0x5c938c){return new BPromise(function(_0x11743c,_0x17e117){_0x5053e0(_0x5c938c,_0x75c909)[_0x804e('0x1f')](function(_0x22e94e){_0x75c909[_0x804e('0x18')]=_0x22e94e['ret'];_0x248013[_0x804e('0x21')][_0x804e('0x1d')]({'where':{'phone':_0x75c909[_0x804e('0xc')],'VoiceQueueId':_0x5c938c['id']}})[_0x804e('0x1f')](function(_0x4f36f6){if(!_[_0x804e('0x1a')](_0x4f36f6)){throw new Error(_0x804e('0x22')+_0x75c909[_0x804e('0xc')]+_0x804e('0x28')+_0x5c938c['id']);}return _0x248013[_0x804e('0x29')][_0x804e('0x1d')]({'where':{'calleridnum':_0x75c909[_0x804e('0xc')],'VoiceQueueId':_0x5c938c['id']}});})[_0x804e('0x1f')](function(_0x15d3fc){if(!_[_0x804e('0x1a')](_0x15d3fc)){throw new Error(_0x804e('0x2a')+_0x75c909[_0x804e('0xc')]+_0x804e('0x2b')+_0x5c938c['id']);}return _0x248013[_0x804e('0x21')][_0x804e('0x2c')]({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909['ListId'],'priority':_0x75c909['priority']?_0x75c909[_0x804e('0x25')]:0x2,'scheduledat':_0x75c909[_0x804e('0x18')]?_0x75c909['scheduledat']:moment()[_0x804e('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x75c909[_0x804e('0x26')]?!![]:![],'callbackuniqueid':_0x75c909[_0x804e('0x26')]?_0x75c909[_0x804e('0x26')]:undefined,'callbackat':_0x75c909[_0x804e('0x26')]?moment()[_0x804e('0x2d')](_0x804e('0x19')):undefined,'VoiceQueueId':_0x5c938c['id']});})[_0x804e('0x27')](function(_0x29b28a){_0x17e117(_0x29b28a);});});});};function _0xd7a9fa(){return function(_0x2180ca){logger[_0x804e('0x14')](_0x804e('0x15'),_0x804e('0x16'),util[_0x804e('0x17')](_0x2180ca,{'showHidden':![],'depth':null}));};}function _0x312c4e(_0x2242db,_0x4e1283){var _0xa4a09b=_0x4e1283[_0x804e('0x18')]?_0x4e1283['scheduledat']:moment()[_0x804e('0x2d')](_0x804e('0x19'));return new BPromise(function(_0x226572,_0x23a620){if(_[_0x804e('0x1a')](_0x4e1283[_0x804e('0x1b')])){_0x226572({'ret':_0xa4a09b});}else{_0x248013['Campaign'][_0x804e('0x1d')]({'where':{'id':_0x2242db['id']}})[_0x804e('0x1f')](function(_0x4322e3){if(!_['isNil'](_0x4322e3)){var _0xcc9e41=_0x4322e3[_0x804e('0x1b')];if(!_[_0x804e('0x1a')](_0xcc9e41)){var _0x20815f=shared[_0x804e('0x2e')];var _0x2ce720=_0x20815f[_0xcc9e41];var _0x57ce82=_0x20815f[_0x4e1283[_0x804e('0x1b')]];if(!_['isNil'](_0x2ce720)&&!_['isNil'](_0x57ce82)){var _0x3cd2e3=_0x2ce720[_0x804e('0x1e')]-_0x57ce82[_0x804e('0x1e')];_0xa4a09b=_0x4e1283[_0x804e('0x18')]?_0x4e1283[_0x804e('0x18')]:moment();var _0xb61fc9=moment(_0xa4a09b)[_0x804e('0x2f')](_0x3cd2e3,_0x804e('0x30'));_0x226572({'ret':_0xb61fc9[_0x804e('0x2d')](_0x804e('0x19'))});}else _0x226572({'ret':_0xa4a09b});}else _0x226572({'ret':_0xa4a09b});}else{_0x226572({'ret':_0xa4a09b});}});}});return 0xa;}var _0x2f1075=function(_0x49b0a7){return new BPromise(function(_0x54e53c,_0x21f63c){_0x312c4e(_0x49b0a7,_0x75c909)['then'](function(_0x45d123){_0x75c909['scheduledat']=_0x45d123[_0x804e('0x20')];_0x248013[_0x804e('0x21')]['findOne']({'where':{'phone':_0x75c909[_0x804e('0xc')],'CampaignId':_0x49b0a7['id']}})['then'](function(_0x162418){if(!_['isNil'](_0x162418)){throw new Error(_0x804e('0x22')+_0x75c909[_0x804e('0xc')]+_0x804e('0x31')+_0x49b0a7['id']);}return _0x248013[_0x804e('0x21')][_0x804e('0x2c')]({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909['ListId'],'priority':_0x75c909['priority']?_0x75c909[_0x804e('0x25')]:0x2,'scheduledat':_0x75c909[_0x804e('0x18')]?_0x75c909[_0x804e('0x18')]:moment()[_0x804e('0x2d')](_0x804e('0x19')),'callback':_0x75c909[_0x804e('0x26')]?!![]:![],'callbackuniqueid':_0x75c909[_0x804e('0x26')]?_0x75c909['callbackUniqueid']:undefined,'callbackat':_0x75c909[_0x804e('0x26')]?moment()[_0x804e('0x2d')](_0x804e('0x19')):undefined,'CampaignId':_0x49b0a7['id']});})['catch'](function(_0x45fae2){_0x21f63c(_0x45fae2);});});});};var _0x28f328=function(_0x538716){return new BPromise(function(_0x52ba3f,_0x500658){_0x312c4e(_0x538716,_0x75c909)[_0x804e('0x1f')](function(_0x5e72f4){_0x75c909[_0x804e('0x18')]=_0x5e72f4[_0x804e('0x20')];_0x248013[_0x804e('0x21')]['findOne']({'where':{'phone':_0x75c909[_0x804e('0xc')],'CampaignId':_0x538716['id']}})[_0x804e('0x1f')](function(_0x5ba64c){if(!_[_0x804e('0x1a')](_0x5ba64c)){throw new Error('cmContact,\x20afterCreate\x20'+_0x75c909[_0x804e('0xc')]+_0x804e('0x32')+_0x538716['id']);}return _0x248013[_0x804e('0x29')][_0x804e('0x1d')]({'where':{'calleridnum':_0x75c909[_0x804e('0xc')],'CampaignId':_0x538716['id']}});})[_0x804e('0x1f')](function(_0x2eeaf9){if(!_[_0x804e('0x1a')](_0x2eeaf9)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x75c909[_0x804e('0xc')]+_0x804e('0x33')+_0x538716['id']);}return _0x248013[_0x804e('0x21')][_0x804e('0x2c')]({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909[_0x804e('0x24')],'priority':_0x75c909[_0x804e('0x25')]?_0x75c909[_0x804e('0x25')]:0x2,'scheduledat':_0x75c909[_0x804e('0x18')]?_0x75c909[_0x804e('0x18')]:moment()[_0x804e('0x2d')](_0x804e('0x19')),'callback':_0x75c909[_0x804e('0x26')]?!![]:![],'callbackuniqueid':_0x75c909['callbackUniqueid']?_0x75c909['callbackUniqueid']:undefined,'callbackat':_0x75c909[_0x804e('0x26')]?moment()[_0x804e('0x2d')](_0x804e('0x19')):undefined,'CampaignId':_0x538716['id']});})[_0x804e('0x27')](function(_0x2f8110){_0x500658(_0x2f8110);});});});};if(_0x75c909['ListId']){_0x248013[_0x804e('0x1c')][_0x804e('0x34')]({'where':{'type':_0x804e('0x35')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x248013[_0x804e('0x36')],'as':_0x804e('0x37'),'where':{'id':_0x75c909[_0x804e('0x24')]}}]})[_0x804e('0x1f')](function(_0x57523e){if(_0x57523e){var _0x3d0b9f=[];for(var _0x370153=0x0,_0x3a4e8a;_0x370153<_0x57523e[_0x804e('0x38')];_0x370153+=0x1){_0x3a4e8a=_0x57523e[_0x370153]['get']({'plain':!![]});switch(_0x3a4e8a[_0x804e('0x39')]){case _0x804e('0x3a'):_0x3489b6(_0x3a4e8a)[_0x804e('0x27')](_0x5199f3());break;case'onlyIfOpen':_0x517373(_0x3a4e8a)['catch'](_0x5199f3());break;default:_0x312c4e(_0x3a4e8a,_0x75c909)[_0x804e('0x1f')](function(_0xfdf87){_0x75c909[_0x804e('0x18')]=_0xfdf87['ret'];_0x248013[_0x804e('0x21')][_0x804e('0x2c')]({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909[_0x804e('0x24')],'scheduledat':_0x75c909[_0x804e('0x18')]?_0x75c909[_0x804e('0x18')]:moment()[_0x804e('0x2d')](_0x804e('0x19')),'priority':_0x75c909[_0x804e('0x25')]?_0x75c909[_0x804e('0x25')]:0x2,'callback':_0x75c909[_0x804e('0x26')]?!![]:![],'callbackuniqueid':_0x75c909[_0x804e('0x26')]?_0x75c909[_0x804e('0x26')]:undefined,'callbackat':_0x75c909['callbackUniqueid']?moment()[_0x804e('0x2d')](_0x804e('0x19')):undefined,'VoiceQueueId':_0x3a4e8a['id']})['catch'](_0x5199f3());});}}}})['then'](function(){return _0x248013[_0x804e('0x1c')][_0x804e('0x34')]({'where':{'type':_0x804e('0x35')},'attributes':['id'],'include':[{'model':_0x248013[_0x804e('0x36')],'as':_0x804e('0x3b'),'where':{'id':_0x75c909[_0x804e('0x24')]}}]})[_0x804e('0x1f')](function(_0x34ad21){if(_0x34ad21){var _0x3a188b=[];for(var _0x244abb=0x0,_0x15cf6e;_0x244abb<_0x34ad21[_0x804e('0x38')];_0x244abb+=0x1){_0x15cf6e=_0x34ad21[_0x244abb]['get']({'plain':!![]});_0x248013[_0x804e('0x3c')]['create']({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909[_0x804e('0x24')],'VoiceQueueId':_0x15cf6e['id']})[_0x804e('0x27')](function(_0x4729b0){logger[_0x804e('0x14')](_0x804e('0x3d'),_0x804e('0x16'),_0x4729b0[_0x804e('0x3e')]);});}}});})[_0x804e('0x1f')](function(){return _0x248013[_0x804e('0x3f')][_0x804e('0x34')]({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x248013[_0x804e('0x36')],'as':_0x804e('0x37'),'where':{'id':_0x75c909['ListId']}}]})[_0x804e('0x1f')](function(_0x239f91){if(_0x239f91){var _0x71a3b0=[];for(var _0x47534b=0x0,_0xfba914;_0x47534b<_0x239f91[_0x804e('0x38')];_0x47534b+=0x1){_0xfba914=_0x239f91[_0x47534b][_0x804e('0x13')]({'plain':!![]});switch(_0xfba914[_0x804e('0x39')]){case'always':_0x28f328(_0xfba914)[_0x804e('0x27')](_0xd7a9fa());break;case _0x804e('0x40'):_0x2f1075(_0xfba914)['catch'](_0xd7a9fa());break;default:_0x248013[_0x804e('0x21')][_0x804e('0x2c')]({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909[_0x804e('0x24')],'scheduledat':_0x75c909['scheduledat']?_0x75c909['scheduledat']:moment()['format'](_0x804e('0x19')),'priority':_0x75c909['priority']?_0x75c909['priority']:0x2,'callback':_0x75c909['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x75c909['callbackUniqueid']?_0x75c909[_0x804e('0x26')]:undefined,'callbackat':_0x75c909[_0x804e('0x26')]?moment()['format'](_0x804e('0x19')):undefined,'CampaignId':_0xfba914['id']})[_0x804e('0x27')](_0xd7a9fa());}}}});})[_0x804e('0x1f')](function(){return _0x248013[_0x804e('0x3f')][_0x804e('0x34')]({'attributes':['id'],'include':[{'model':_0x248013[_0x804e('0x36')],'as':_0x804e('0x3b'),'where':{'id':_0x75c909['ListId']}}]})['then'](function(_0x1d602d){if(_0x1d602d){var _0x345e47=[];for(var _0x4bd518=0x0,_0x548b33;_0x4bd518<_0x1d602d[_0x804e('0x38')];_0x4bd518+=0x1){_0x548b33=_0x1d602d[_0x4bd518][_0x804e('0x13')]({'plain':!![]});_0x248013[_0x804e('0x3c')][_0x804e('0x2c')]({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909[_0x804e('0x24')],'CampaignId':_0x548b33['id']})[_0x804e('0x27')](function(_0x39efe9){logger[_0x804e('0x14')](_0x804e('0x3d'),_0x804e('0x16'),_0x39efe9['message']);});}}});})['then'](function(){_0x3eac6d();})[_0x804e('0x27')](function(_0x23c52e){logger['error'](_0x804e('0x3d'),_0x804e('0x16'),_0x23c52e[_0x804e('0x3e')]);_0x3eac6d(_0x23c52e);});}else{_0x3eac6d(new Error(_0x804e('0x41')));}},'afterDestroy':function(_0x375980,_0x4ca7f0,_0x5936ba){var _0x34cf6c=_0x316d90['models'];var _0x1c9d26=_0x375980['get']({'plain':!![]});return _0x34cf6c['CmHopper'][_0x804e('0x34')]({'raw':!![],'where':{'ListId':_0x1c9d26[_0x804e('0x24')],'ContactId':_0x1c9d26['id']}})[_0x804e('0x1f')](function(_0x4e774f){if(!_[_0x804e('0x42')](_0x4e774f)){var _0x5cafd3=[];for(var _0x553002=0x0;_0x553002<_0x4e774f['length'];_0x553002+=0x1){var _0x67de01=_0x34cf6c[_0x804e('0x21')]['destroy']({'where':{'ListId':_0x4e774f[_0x553002][_0x804e('0x24')],'ContactId':_0x4e774f[_0x553002]['ContactId'],'VoiceQueueId':_0x4e774f[_0x553002][_0x804e('0x43')],'CampaignId':_0x4e774f[_0x553002][_0x804e('0x44')]}});_0x5cafd3[_0x804e('0x45')](_0x67de01);}return BPromise[_0x804e('0x46')](_0x5cafd3);}})[_0x804e('0x1f')](function(_0x4f75d3){logger[_0x804e('0x47')]('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x4f75d3,{'showHidden':![],'depth':null}));_0x5936ba();})[_0x804e('0x27')](function(_0x16851e){logger[_0x804e('0x14')](_0x804e('0x48'),util['inspect'](_0x16851e,{'showHidden':![],'depth':null}));_0x5936ba(_0x16851e);});}}});}; \ No newline at end of file +var _0xcd07=['./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','error','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','then','timezones','utcOffset','add','minutes','ret','CmHopper','findOne','cmContact,\x20afterCreate\x20','create','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','cmContact','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','length','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','message','always','CmHopperBlack','List\x20not\x20found','models','isEmpty','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment/shared'];(function(_0xc18558,_0x1c5150){var _0x3bb16b=function(_0x429c8e){while(--_0x429c8e){_0xc18558['push'](_0xc18558['shift']());}};_0x3bb16b(++_0x1c5150);}(_0xcd07,0x178));var _0x7cd0=function(_0x1b4feb,_0x293404){_0x1b4feb=_0x1b4feb-0x0;var _0x52d9e6=_0xcd07[_0x1b4feb];return _0x52d9e6;};'use strict';var _=require('lodash');var util=require(_0x7cd0('0x0'));var logger=require(_0x7cd0('0x1'))(_0x7cd0('0x2'));var moment=require(_0x7cd0('0x3'));var BPromise=require(_0x7cd0('0x4'));var rp=require(_0x7cd0('0x5'));var fs=require('fs');var path=require(_0x7cd0('0x6'));var rimraf=require(_0x7cd0('0x7'));var config=require('../../config/environment');var shared=require(_0x7cd0('0x8'));var attributes=require(_0x7cd0('0x9'));module[_0x7cd0('0xa')]=function(_0x3c14ab,_0x1728ef){return _0x3c14ab[_0x7cd0('0xb')](_0x7cd0('0xc'),attributes,{'tableName':_0x7cd0('0xd'),'paranoid':!![],'indexes':[{'name':_0x7cd0('0xe'),'fields':[_0x7cd0('0xe')]},{'name':_0x7cd0('0xf'),'fields':[_0x7cd0('0x10'),'lastName','phone',_0x7cd0('0x11'),_0x7cd0('0x12'),_0x7cd0('0x13')],'type':_0x7cd0('0x14')}],'timestamps':!![],'charset':_0x7cd0('0x15'),'collate':_0x7cd0('0x16'),'hooks':{'afterCreate':function(_0x5956b0,_0x1d2bb5,_0x21f6b0){var _0x3f30ba=_0x3c14ab['models'];var _0x1369b5=_0x5956b0[_0x7cd0('0x17')]({'plain':!![]});function _0x5371bf(){return function(_0x2c1aea){logger[_0x7cd0('0x18')]('cmContact',_0x7cd0('0x19'),util[_0x7cd0('0x1a')](_0x2c1aea,{'showHidden':![],'depth':null}));};}function _0x5616e6(_0x5a8a83,_0x6e4ed6){var _0x525c76=_0x6e4ed6[_0x7cd0('0x1b')]?_0x6e4ed6[_0x7cd0('0x1b')]:moment()[_0x7cd0('0x1c')](_0x7cd0('0x1d'));return new BPromise(function(_0x10f539,_0x549fb1){if(_[_0x7cd0('0x1e')](_0x6e4ed6[_0x7cd0('0x1f')])){_0x10f539({'ret':_0x525c76});}else{_0x3f30ba[_0x7cd0('0x20')]['findOne']({'where':{'id':_0x5a8a83['id']}})[_0x7cd0('0x21')](function(_0x367b47){if(!_[_0x7cd0('0x1e')](_0x367b47)){var _0x1b60f7=_0x367b47['dialTimezone'];if(!_['isNil'](_0x1b60f7)){var _0x440b1d=shared[_0x7cd0('0x22')];var _0x1fff4b=_0x440b1d[_0x1b60f7];var _0x30244f=_0x440b1d[_0x6e4ed6['dialTimezone']];if(!_['isNil'](_0x1fff4b)&&!_[_0x7cd0('0x1e')](_0x30244f)){var _0x3eef73=_0x1fff4b[_0x7cd0('0x23')]-_0x30244f[_0x7cd0('0x23')];_0x525c76=_0x6e4ed6[_0x7cd0('0x1b')]?_0x6e4ed6[_0x7cd0('0x1b')]:moment();var _0x52acbd=moment(_0x525c76)[_0x7cd0('0x24')](_0x3eef73,_0x7cd0('0x25'));_0x10f539({'ret':_0x52acbd[_0x7cd0('0x1c')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x10f539({'ret':_0x525c76});}else _0x10f539({'ret':_0x525c76});}else{_0x10f539({'ret':_0x525c76});}});}});return 0xa;}var _0x8eb2a0=function(_0x23da8a){return new BPromise(function(_0x612e36,_0x478104){_0x5616e6(_0x23da8a,_0x1369b5)['then'](function(_0x27aa10){_0x1369b5[_0x7cd0('0x1b')]=_0x27aa10[_0x7cd0('0x26')];_0x3f30ba[_0x7cd0('0x27')][_0x7cd0('0x28')]({'where':{'phone':_0x1369b5[_0x7cd0('0xe')],'VoiceQueueId':_0x23da8a['id']}})['then'](function(_0x343b0a){if(!_['isNil'](_0x343b0a)){throw new Error(_0x7cd0('0x29')+_0x1369b5[_0x7cd0('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x23da8a['id']);}return _0x3f30ba['CmHopper'][_0x7cd0('0x2a')]({'phone':_0x1369b5[_0x7cd0('0xe')],'ContactId':_0x1369b5['id'],'ListId':_0x1369b5[_0x7cd0('0x2b')],'priority':_0x1369b5[_0x7cd0('0x2c')]?_0x1369b5[_0x7cd0('0x2c')]:0x2,'scheduledat':_0x1369b5[_0x7cd0('0x1b')]?_0x1369b5[_0x7cd0('0x1b')]:moment()[_0x7cd0('0x1c')](_0x7cd0('0x1d')),'callback':_0x1369b5['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1369b5[_0x7cd0('0x2d')]?_0x1369b5[_0x7cd0('0x2d')]:undefined,'callbackat':_0x1369b5[_0x7cd0('0x2d')]?moment()[_0x7cd0('0x1c')](_0x7cd0('0x1d')):undefined,'VoiceQueueId':_0x23da8a['id']});})[_0x7cd0('0x2e')](function(_0x173c7f){_0x478104(_0x173c7f);});});});};var _0x38d118=function(_0x38b016){return new BPromise(function(_0x377c0a,_0x94612b){_0x5616e6(_0x38b016,_0x1369b5)[_0x7cd0('0x21')](function(_0x16de1f){_0x1369b5[_0x7cd0('0x1b')]=_0x16de1f['ret'];_0x3f30ba[_0x7cd0('0x27')][_0x7cd0('0x28')]({'where':{'phone':_0x1369b5[_0x7cd0('0xe')],'VoiceQueueId':_0x38b016['id']}})['then'](function(_0x419b92){if(!_['isNil'](_0x419b92)){throw new Error('cmContact,\x20afterCreate\x20'+_0x1369b5[_0x7cd0('0xe')]+_0x7cd0('0x2f')+_0x38b016['id']);}return _0x3f30ba[_0x7cd0('0x30')]['findOne']({'where':{'calleridnum':_0x1369b5[_0x7cd0('0xe')],'VoiceQueueId':_0x38b016['id']}});})[_0x7cd0('0x21')](function(_0x57a1ac){if(!_[_0x7cd0('0x1e')](_0x57a1ac)){throw new Error(_0x7cd0('0x31')+_0x1369b5['phone']+_0x7cd0('0x32')+_0x38b016['id']);}return _0x3f30ba['CmHopper']['create']({'phone':_0x1369b5[_0x7cd0('0xe')],'ContactId':_0x1369b5['id'],'ListId':_0x1369b5[_0x7cd0('0x2b')],'priority':_0x1369b5[_0x7cd0('0x2c')]?_0x1369b5[_0x7cd0('0x2c')]:0x2,'scheduledat':_0x1369b5[_0x7cd0('0x1b')]?_0x1369b5['scheduledat']:moment()[_0x7cd0('0x1c')](_0x7cd0('0x1d')),'callback':_0x1369b5[_0x7cd0('0x2d')]?!![]:![],'callbackuniqueid':_0x1369b5[_0x7cd0('0x2d')]?_0x1369b5[_0x7cd0('0x2d')]:undefined,'callbackat':_0x1369b5[_0x7cd0('0x2d')]?moment()[_0x7cd0('0x1c')](_0x7cd0('0x1d')):undefined,'VoiceQueueId':_0x38b016['id']});})[_0x7cd0('0x2e')](function(_0x556167){_0x94612b(_0x556167);});});});};function _0x1e1961(){return function(_0x4fda2a){logger[_0x7cd0('0x18')](_0x7cd0('0x33'),_0x7cd0('0x19'),util[_0x7cd0('0x1a')](_0x4fda2a,{'showHidden':![],'depth':null}));};}function _0x49d5cd(_0x48ae3f,_0x246f25){var _0x2ce506=_0x246f25['scheduledat']?_0x246f25[_0x7cd0('0x1b')]:moment()[_0x7cd0('0x1c')](_0x7cd0('0x1d'));return new BPromise(function(_0x3d4378,_0x1a3bd6){if(_[_0x7cd0('0x1e')](_0x246f25[_0x7cd0('0x1f')])){_0x3d4378({'ret':_0x2ce506});}else{_0x3f30ba[_0x7cd0('0x34')][_0x7cd0('0x28')]({'where':{'id':_0x48ae3f['id']}})['then'](function(_0x10cae4){if(!_['isNil'](_0x10cae4)){var _0x2b70ec=_0x10cae4['dialTimezone'];if(!_[_0x7cd0('0x1e')](_0x2b70ec)){var _0x25396d=shared[_0x7cd0('0x22')];var _0x3a36de=_0x25396d[_0x2b70ec];var _0x1b7a0c=_0x25396d[_0x246f25[_0x7cd0('0x1f')]];if(!_[_0x7cd0('0x1e')](_0x3a36de)&&!_[_0x7cd0('0x1e')](_0x1b7a0c)){var _0x5b2af8=_0x3a36de[_0x7cd0('0x23')]-_0x1b7a0c[_0x7cd0('0x23')];_0x2ce506=_0x246f25[_0x7cd0('0x1b')]?_0x246f25[_0x7cd0('0x1b')]:moment();var _0x227969=moment(_0x2ce506)[_0x7cd0('0x24')](_0x5b2af8,_0x7cd0('0x25'));_0x3d4378({'ret':_0x227969[_0x7cd0('0x1c')](_0x7cd0('0x1d'))});}else _0x3d4378({'ret':_0x2ce506});}else _0x3d4378({'ret':_0x2ce506});}else{_0x3d4378({'ret':_0x2ce506});}});}});return 0xa;}var _0x2f19d9=function(_0x2af793){return new BPromise(function(_0x1c7379,_0x3f3bbb){_0x49d5cd(_0x2af793,_0x1369b5)[_0x7cd0('0x21')](function(_0x4ba847){_0x1369b5[_0x7cd0('0x1b')]=_0x4ba847['ret'];_0x3f30ba['CmHopper'][_0x7cd0('0x28')]({'where':{'phone':_0x1369b5[_0x7cd0('0xe')],'CampaignId':_0x2af793['id']}})['then'](function(_0x354e04){if(!_['isNil'](_0x354e04)){throw new Error(_0x7cd0('0x29')+_0x1369b5[_0x7cd0('0xe')]+_0x7cd0('0x35')+_0x2af793['id']);}return _0x3f30ba[_0x7cd0('0x27')][_0x7cd0('0x2a')]({'phone':_0x1369b5[_0x7cd0('0xe')],'ContactId':_0x1369b5['id'],'ListId':_0x1369b5[_0x7cd0('0x2b')],'priority':_0x1369b5[_0x7cd0('0x2c')]?_0x1369b5['priority']:0x2,'scheduledat':_0x1369b5[_0x7cd0('0x1b')]?_0x1369b5[_0x7cd0('0x1b')]:moment()[_0x7cd0('0x1c')](_0x7cd0('0x1d')),'callback':_0x1369b5[_0x7cd0('0x2d')]?!![]:![],'callbackuniqueid':_0x1369b5['callbackUniqueid']?_0x1369b5[_0x7cd0('0x2d')]:undefined,'callbackat':_0x1369b5['callbackUniqueid']?moment()[_0x7cd0('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x2af793['id']});})[_0x7cd0('0x2e')](function(_0x48a9d6){_0x3f3bbb(_0x48a9d6);});});});};var _0x54fb67=function(_0x368e3f){return new BPromise(function(_0x207de4,_0x34cae1){_0x49d5cd(_0x368e3f,_0x1369b5)[_0x7cd0('0x21')](function(_0x1bfd81){_0x1369b5[_0x7cd0('0x1b')]=_0x1bfd81['ret'];_0x3f30ba['CmHopper'][_0x7cd0('0x28')]({'where':{'phone':_0x1369b5[_0x7cd0('0xe')],'CampaignId':_0x368e3f['id']}})[_0x7cd0('0x21')](function(_0xfb4913){if(!_['isNil'](_0xfb4913)){throw new Error(_0x7cd0('0x29')+_0x1369b5[_0x7cd0('0xe')]+_0x7cd0('0x36')+_0x368e3f['id']);}return _0x3f30ba[_0x7cd0('0x30')][_0x7cd0('0x28')]({'where':{'calleridnum':_0x1369b5[_0x7cd0('0xe')],'CampaignId':_0x368e3f['id']}});})['then'](function(_0xcb617e){if(!_[_0x7cd0('0x1e')](_0xcb617e)){throw new Error(_0x7cd0('0x31')+_0x1369b5[_0x7cd0('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x368e3f['id']);}return _0x3f30ba['CmHopper']['create']({'phone':_0x1369b5['phone'],'ContactId':_0x1369b5['id'],'ListId':_0x1369b5[_0x7cd0('0x2b')],'priority':_0x1369b5['priority']?_0x1369b5[_0x7cd0('0x2c')]:0x2,'scheduledat':_0x1369b5[_0x7cd0('0x1b')]?_0x1369b5[_0x7cd0('0x1b')]:moment()[_0x7cd0('0x1c')](_0x7cd0('0x1d')),'callback':_0x1369b5[_0x7cd0('0x2d')]?!![]:![],'callbackuniqueid':_0x1369b5[_0x7cd0('0x2d')]?_0x1369b5[_0x7cd0('0x2d')]:undefined,'callbackat':_0x1369b5[_0x7cd0('0x2d')]?moment()[_0x7cd0('0x1c')](_0x7cd0('0x1d')):undefined,'CampaignId':_0x368e3f['id']});})['catch'](function(_0x556307){_0x34cae1(_0x556307);});});});};if(_0x1369b5[_0x7cd0('0x2b')]){_0x3f30ba[_0x7cd0('0x20')][_0x7cd0('0x37')]({'where':{'type':_0x7cd0('0x38')},'attributes':['id',_0x7cd0('0x39'),_0x7cd0('0x1f')],'include':[{'model':_0x3f30ba[_0x7cd0('0x3a')],'as':'Lists','where':{'id':_0x1369b5[_0x7cd0('0x2b')]}}]})[_0x7cd0('0x21')](function(_0x312b53){if(_0x312b53){var _0x23f06d=[];for(var _0x2e94e1=0x0,_0x43cc74;_0x2e94e1<_0x312b53[_0x7cd0('0x3b')];_0x2e94e1+=0x1){_0x43cc74=_0x312b53[_0x2e94e1][_0x7cd0('0x17')]({'plain':!![]});switch(_0x43cc74[_0x7cd0('0x39')]){case'always':_0x38d118(_0x43cc74)[_0x7cd0('0x2e')](_0x5371bf());break;case _0x7cd0('0x3c'):_0x8eb2a0(_0x43cc74)[_0x7cd0('0x2e')](_0x5371bf());break;default:_0x49d5cd(_0x43cc74,_0x1369b5)[_0x7cd0('0x21')](function(_0x5c7bd0){_0x1369b5[_0x7cd0('0x1b')]=_0x5c7bd0[_0x7cd0('0x26')];_0x3f30ba[_0x7cd0('0x27')][_0x7cd0('0x2a')]({'phone':_0x1369b5['phone'],'ContactId':_0x1369b5['id'],'ListId':_0x1369b5[_0x7cd0('0x2b')],'scheduledat':_0x1369b5[_0x7cd0('0x1b')]?_0x1369b5[_0x7cd0('0x1b')]:moment()[_0x7cd0('0x1c')](_0x7cd0('0x1d')),'priority':_0x1369b5[_0x7cd0('0x2c')]?_0x1369b5['priority']:0x2,'callback':_0x1369b5[_0x7cd0('0x2d')]?!![]:![],'callbackuniqueid':_0x1369b5[_0x7cd0('0x2d')]?_0x1369b5[_0x7cd0('0x2d')]:undefined,'callbackat':_0x1369b5['callbackUniqueid']?moment()[_0x7cd0('0x1c')](_0x7cd0('0x1d')):undefined,'VoiceQueueId':_0x43cc74['id']})['catch'](_0x5371bf());});}}}})[_0x7cd0('0x21')](function(){return _0x3f30ba['VoiceQueue'][_0x7cd0('0x37')]({'where':{'type':_0x7cd0('0x38')},'attributes':['id'],'include':[{'model':_0x3f30ba[_0x7cd0('0x3a')],'as':_0x7cd0('0x3d'),'where':{'id':_0x1369b5['ListId']}}]})[_0x7cd0('0x21')](function(_0x4e71a3){if(_0x4e71a3){var _0x47ae1c=[];for(var _0x3d12ac=0x0,_0x1e3896;_0x3d12ac<_0x4e71a3[_0x7cd0('0x3b')];_0x3d12ac+=0x1){_0x1e3896=_0x4e71a3[_0x3d12ac][_0x7cd0('0x17')]({'plain':!![]});_0x3f30ba['CmHopperBlack'][_0x7cd0('0x2a')]({'phone':_0x1369b5[_0x7cd0('0xe')],'ContactId':_0x1369b5['id'],'ListId':_0x1369b5[_0x7cd0('0x2b')],'VoiceQueueId':_0x1e3896['id']})[_0x7cd0('0x2e')](function(_0x32a009){logger[_0x7cd0('0x18')](_0x7cd0('0x3e'),_0x7cd0('0x19'),_0x32a009[_0x7cd0('0x3f')]);});}}});})[_0x7cd0('0x21')](function(){return _0x3f30ba[_0x7cd0('0x34')][_0x7cd0('0x37')]({'attributes':['id',_0x7cd0('0x39'),_0x7cd0('0x1f')],'include':[{'model':_0x3f30ba[_0x7cd0('0x3a')],'as':'Lists','where':{'id':_0x1369b5[_0x7cd0('0x2b')]}}]})[_0x7cd0('0x21')](function(_0x263b74){if(_0x263b74){var _0x4d09a9=[];for(var _0x361f76=0x0,_0x5c78d8;_0x361f76<_0x263b74[_0x7cd0('0x3b')];_0x361f76+=0x1){_0x5c78d8=_0x263b74[_0x361f76]['get']({'plain':!![]});switch(_0x5c78d8[_0x7cd0('0x39')]){case _0x7cd0('0x40'):_0x54fb67(_0x5c78d8)[_0x7cd0('0x2e')](_0x1e1961());break;case _0x7cd0('0x3c'):_0x2f19d9(_0x5c78d8)['catch'](_0x1e1961());break;default:_0x3f30ba['CmHopper'][_0x7cd0('0x2a')]({'phone':_0x1369b5[_0x7cd0('0xe')],'ContactId':_0x1369b5['id'],'ListId':_0x1369b5[_0x7cd0('0x2b')],'scheduledat':_0x1369b5['scheduledat']?_0x1369b5[_0x7cd0('0x1b')]:moment()[_0x7cd0('0x1c')](_0x7cd0('0x1d')),'priority':_0x1369b5[_0x7cd0('0x2c')]?_0x1369b5[_0x7cd0('0x2c')]:0x2,'callback':_0x1369b5['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1369b5[_0x7cd0('0x2d')]?_0x1369b5[_0x7cd0('0x2d')]:undefined,'callbackat':_0x1369b5[_0x7cd0('0x2d')]?moment()[_0x7cd0('0x1c')](_0x7cd0('0x1d')):undefined,'CampaignId':_0x5c78d8['id']})['catch'](_0x1e1961());}}}});})[_0x7cd0('0x21')](function(){return _0x3f30ba[_0x7cd0('0x34')][_0x7cd0('0x37')]({'attributes':['id'],'include':[{'model':_0x3f30ba[_0x7cd0('0x3a')],'as':_0x7cd0('0x3d'),'where':{'id':_0x1369b5[_0x7cd0('0x2b')]}}]})['then'](function(_0x45f49b){if(_0x45f49b){var _0x444247=[];for(var _0xff3dad=0x0,_0x2647ac;_0xff3dad<_0x45f49b[_0x7cd0('0x3b')];_0xff3dad+=0x1){_0x2647ac=_0x45f49b[_0xff3dad][_0x7cd0('0x17')]({'plain':!![]});_0x3f30ba[_0x7cd0('0x41')]['create']({'phone':_0x1369b5['phone'],'ContactId':_0x1369b5['id'],'ListId':_0x1369b5[_0x7cd0('0x2b')],'CampaignId':_0x2647ac['id']})[_0x7cd0('0x2e')](function(_0x804215){logger[_0x7cd0('0x18')]('cmContact,\x20%s,\x20%s',_0x7cd0('0x19'),_0x804215['message']);});}}});})['then'](function(){_0x21f6b0();})[_0x7cd0('0x2e')](function(_0x20988f){logger[_0x7cd0('0x18')](_0x7cd0('0x3e'),_0x7cd0('0x19'),_0x20988f[_0x7cd0('0x3f')]);_0x21f6b0(_0x20988f);});}else{_0x21f6b0(new Error(_0x7cd0('0x42')));}},'afterDestroy':function(_0x488e9b,_0x28a748,_0x3408a2){var _0x1b7361=_0x3c14ab[_0x7cd0('0x43')];var _0x476136=_0x488e9b[_0x7cd0('0x17')]({'plain':!![]});return _0x1b7361[_0x7cd0('0x27')]['findAll']({'raw':!![],'where':{'ListId':_0x476136[_0x7cd0('0x2b')],'ContactId':_0x476136['id']}})[_0x7cd0('0x21')](function(_0x186a1c){if(!_[_0x7cd0('0x44')](_0x186a1c)){var _0x468c46=[];for(var _0x5d28e6=0x0;_0x5d28e6<_0x186a1c[_0x7cd0('0x3b')];_0x5d28e6+=0x1){var _0x45f62b=_0x1b7361[_0x7cd0('0x27')][_0x7cd0('0x45')]({'where':{'ListId':_0x186a1c[_0x5d28e6][_0x7cd0('0x2b')],'ContactId':_0x186a1c[_0x5d28e6][_0x7cd0('0x46')],'VoiceQueueId':_0x186a1c[_0x5d28e6][_0x7cd0('0x47')],'CampaignId':_0x186a1c[_0x5d28e6]['CampaignId']}});_0x468c46[_0x7cd0('0x48')](_0x45f62b);}return BPromise[_0x7cd0('0x49')](_0x468c46);}})['then'](function(_0x5c9981){logger[_0x7cd0('0x4a')](_0x7cd0('0x4b'),util['inspect'](_0x5c9981,{'showHidden':![],'depth':null}));_0x3408a2();})[_0x7cd0('0x2e')](function(_0x30ce39){logger['error'](_0x7cd0('0x4c'),util[_0x7cd0('0x1a')](_0x30ce39,{'showHidden':![],'depth':null}));_0x3408a2(_0x30ce39);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index b6acade..8dfd34a 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x2e337f,_0x49b153){var _0x36d2c0=function(_0x37c866){while(--_0x37c866){_0x2e337f['push'](_0x2e337f['shift']());}};_0x36d2c0(++_0x49b153);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 c285138..efdd606 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 _0xcb91=['STRING','INTEGER'];(function(_0x58b6a8,_0x307021){var _0xc566dc=function(_0x59bd76){while(--_0x59bd76){_0x58b6a8['push'](_0x58b6a8['shift']());}};_0xc566dc(++_0x307021);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xcb91[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0x1cb9('0x0')],'primaryKey':!![]},'item':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x1cb9('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x1cb9('0x0')],'defaultValue':null},'description':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x1de4=['INTEGER','STRING','PHONE','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1de4,0x94));var _0x41de=function(_0xc68f9f,_0x1a3f17){_0xc68f9f=_0xc68f9f-0x0;var _0x8fb862=_0x1de4[_0xc68f9f];return _0x8fb862;};'use strict';var Sequelize=require(_0x41de('0x0'));module[_0x41de('0x1')]={'CmContactId':{'type':Sequelize[_0x41de('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x41de('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x41de('0x3')],'defaultValue':_0x41de('0x4')},'OrderBy':{'type':Sequelize[_0x41de('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'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 ed927a8..4a8d74c 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 _0x315b=['nolimit','order','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','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/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','get','CmContactHasItems','UserProfileResource','destroy','error','stack','name','send','map','CmContactHasItem','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x315b,0x151));var _0xb315=function(_0x4e1762,_0x42981a){_0x4e1762=_0x4e1762-0x0;var _0x21f41c=_0x315b[_0x4e1762];return _0x21f41c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb315('0x0'));var zipdir=require(_0xb315('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb315('0x2'));var moment=require('moment');var BPromise=require(_0xb315('0x3'));var Mustache=require(_0xb315('0x4'));var util=require(_0xb315('0x5'));var path=require(_0xb315('0x6'));var sox=require(_0xb315('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb315('0x8'));var squel=require(_0xb315('0x9'));var crypto=require(_0xb315('0xa'));var jsforce=require(_0xb315('0xb'));var deskjs=require(_0xb315('0xc'));var toCsv=require(_0xb315('0xd'));var querystring=require(_0xb315('0xe'));var Papa=require(_0xb315('0xf'));var Redis=require('ioredis');var authService=require(_0xb315('0x10'));var qs=require(_0xb315('0x11'));var as=require(_0xb315('0x12'));var hardwareService=require(_0xb315('0x13'));var logger=require(_0xb315('0x14'))(_0xb315('0x15'));var utils=require(_0xb315('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb315('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55ec67,_0x2feaa4){_0x2feaa4=_0x2feaa4||0xcc;return function(_0x4fe089){if(_0x4fe089){return _0x55ec67[_0xb315('0x18')](_0x2feaa4);}return _0x55ec67[_0xb315('0x19')](_0x2feaa4)[_0xb315('0x1a')]();};}function respondWithResult(_0x2ccf41,_0x34e436){_0x34e436=_0x34e436||0xc8;return function(_0x7dafef){if(_0x7dafef){return _0x2ccf41['status'](_0x34e436)[_0xb315('0x1b')](_0x7dafef);}};}function respondWithFilteredResult(_0x679ea9,_0x33f3a2){return function(_0x469f0c){if(_0x469f0c){var _0x36c829=typeof _0x33f3a2['offset']===_0xb315('0x1c')&&typeof _0x33f3a2[_0xb315('0x1d')]===_0xb315('0x1c');var _0x3e52de=_0x469f0c[_0xb315('0x1e')];var _0x55c89c=_0x36c829?0x0:_0x33f3a2['offset'];var _0x21bff2=_0x36c829?_0x469f0c[_0xb315('0x1e')]:_0x33f3a2[_0xb315('0x1f')]+_0x33f3a2[_0xb315('0x1d')];var _0xdcb96b;if(_0x21bff2>=_0x3e52de){_0x21bff2=_0x3e52de;_0xdcb96b=0xc8;}else{_0xdcb96b=0xce;}_0x679ea9[_0xb315('0x19')](_0xdcb96b);return _0x679ea9[_0xb315('0x20')]('Content-Range',_0x55c89c+'-'+_0x21bff2+'/'+_0x3e52de)[_0xb315('0x1b')](_0x469f0c);}return null;};}function patchUpdates(_0x3c8b86){return function(_0x4d5d5f){try{jsonpatch[_0xb315('0x21')](_0x4d5d5f,_0x3c8b86,!![]);}catch(_0x24f69f){return BPromise[_0xb315('0x22')](_0x24f69f);}return _0x4d5d5f['save']();};}function saveUpdates(_0xc45815,_0x17fe5c){return function(_0x1e15d4){if(_0x1e15d4){return _0x1e15d4[_0xb315('0x23')](_0xc45815)['then'](function(_0x45d6fa){return _0x45d6fa;});}return null;};}function removeEntity(_0x171750,_0x4fa3b4){return function(_0x220525){if(_0x220525){return _0x220525['destroy']()[_0xb315('0x24')](function(){var _0x41a2f5=_0x220525[_0xb315('0x25')]({'plain':!![]});var _0x5adea0=_0xb315('0x26');return db[_0xb315('0x27')][_0xb315('0x28')]({'where':{'type':_0x5adea0,'resourceId':_0x41a2f5['id']}})[_0xb315('0x24')](function(){return _0x220525;});})[_0xb315('0x24')](function(){_0x171750[_0xb315('0x19')](0xcc)[_0xb315('0x1a')]();});}};}function handleEntityNotFound(_0x2ee6c5,_0x5946d1){return function(_0x1a3ada){if(!_0x1a3ada){_0x2ee6c5[_0xb315('0x18')](0x194);}return _0x1a3ada;};}function handleError(_0x5cd9b2,_0x359c0f){_0x359c0f=_0x359c0f||0x1f4;return function(_0x524dba){logger[_0xb315('0x29')](_0x524dba[_0xb315('0x2a')]);if(_0x524dba[_0xb315('0x2b')]){delete _0x524dba[_0xb315('0x2b')];}_0x5cd9b2['status'](_0x359c0f)[_0xb315('0x2c')](_0x524dba);};}exports['index']=function(_0x553294,_0x2c04c3){var _0x52d289={},_0x138cdc={},_0x1f35ec={'count':0x0,'rows':[]};var _0xe99fe4=_[_0xb315('0x2d')](db[_0xb315('0x2e')]['rawAttributes'],function(_0x19a6e1){return{'name':_0x19a6e1['fieldName'],'type':_0x19a6e1[_0xb315('0x2f')][_0xb315('0x30')]};});_0x138cdc['model']=_[_0xb315('0x2d')](_0xe99fe4,_0xb315('0x2b'));_0x138cdc[_0xb315('0x31')]=_[_0xb315('0x32')](_0x553294['query']);_0x138cdc[_0xb315('0x33')]=_[_0xb315('0x34')](_0x138cdc[_0xb315('0x35')],_0x138cdc[_0xb315('0x31')]);_0x52d289['attributes']=_[_0xb315('0x34')](_0x138cdc[_0xb315('0x35')],qs['fields'](_0x553294[_0xb315('0x31')][_0xb315('0x36')]));_0x52d289[_0xb315('0x37')]=_0x52d289[_0xb315('0x37')][_0xb315('0x38')]?_0x52d289['attributes']:_0x138cdc[_0xb315('0x35')];if(!_0x553294[_0xb315('0x31')][_0xb315('0x39')](_0xb315('0x3a'))){_0x52d289['limit']=qs['limit'](_0x553294['query'][_0xb315('0x1d')]);_0x52d289[_0xb315('0x1f')]=qs[_0xb315('0x1f')](_0x553294['query'][_0xb315('0x1f')]);}_0x52d289[_0xb315('0x3b')]=qs['sort'](_0x553294[_0xb315('0x31')]['sort']);_0x52d289[_0xb315('0x3c')]=qs[_0xb315('0x33')](_[_0xb315('0x3d')](_0x553294['query'],_0x138cdc[_0xb315('0x33')]),_0xe99fe4);if(_0x553294[_0xb315('0x31')][_0xb315('0x3e')]){_0x52d289[_0xb315('0x3c')]=_['merge'](_0x52d289[_0xb315('0x3c')],{'$or':_[_0xb315('0x2d')](_0xe99fe4,function(_0x30b16f){if(_0x30b16f[_0xb315('0x2f')]!=='VIRTUAL'){var _0x2bbe36={};_0x2bbe36[_0x30b16f[_0xb315('0x2b')]]={'$like':'%'+_0x553294[_0xb315('0x31')][_0xb315('0x3e')]+'%'};return _0x2bbe36;}})});}_0x52d289=_[_0xb315('0x3f')]({},_0x52d289,_0x553294[_0xb315('0x40')]);var _0x931f0={'where':_0x52d289['where']};return db['CmContactHasItem'][_0xb315('0x1e')](_0x931f0)[_0xb315('0x24')](function(_0x245a48){_0x1f35ec[_0xb315('0x1e')]=_0x245a48;if(_0x553294[_0xb315('0x31')][_0xb315('0x41')]){_0x52d289['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0xb315('0x42')](_0x52d289);})[_0xb315('0x24')](function(_0x3907f8){_0x1f35ec[_0xb315('0x43')]=_0x3907f8;return _0x1f35ec;})[_0xb315('0x24')](respondWithFilteredResult(_0x2c04c3,_0x52d289))[_0xb315('0x44')](handleError(_0x2c04c3,null));};exports[_0xb315('0x45')]=function(_0x3dbbc2,_0x319495){var _0x58b85f={'raw':!![],'where':{'id':_0x3dbbc2[_0xb315('0x46')]['id']}},_0xc8a6a6={};_0xc8a6a6[_0xb315('0x35')]=_['keys'](db['CmContactHasItem']['rawAttributes']);_0xc8a6a6[_0xb315('0x31')]=_[_0xb315('0x32')](_0x3dbbc2[_0xb315('0x31')]);_0xc8a6a6[_0xb315('0x33')]=_[_0xb315('0x34')](_0xc8a6a6[_0xb315('0x35')],_0xc8a6a6[_0xb315('0x31')]);_0x58b85f[_0xb315('0x37')]=_[_0xb315('0x34')](_0xc8a6a6['model'],qs[_0xb315('0x36')](_0x3dbbc2[_0xb315('0x31')]['fields']));_0x58b85f[_0xb315('0x37')]=_0x58b85f['attributes'][_0xb315('0x38')]?_0x58b85f[_0xb315('0x37')]:_0xc8a6a6[_0xb315('0x35')];if(_0x3dbbc2[_0xb315('0x31')]['includeAll']){_0x58b85f[_0xb315('0x47')]=[{'all':!![]}];}_0x58b85f=_['merge']({},_0x58b85f,_0x3dbbc2['options']);return db['CmContactHasItem']['find'](_0x58b85f)[_0xb315('0x24')](handleEntityNotFound(_0x319495,null))['then'](respondWithResult(_0x319495,null))['catch'](handleError(_0x319495,null));};exports[_0xb315('0x48')]=function(_0x1ecbcf,_0x2641cb){return db[_0xb315('0x2e')][_0xb315('0x48')](_0x1ecbcf[_0xb315('0x49')],{})[_0xb315('0x24')](function(_0x2cd9db){var _0x59022c=_0x1ecbcf['user']['get']({'plain':!![]});if(!_0x59022c)throw new Error(_0xb315('0x4a'));if(_0x59022c['role']===_0xb315('0x4b')){var _0x35a5e1=_0x2cd9db[_0xb315('0x25')]({'plain':!![]});var _0x35e286='CmContactHasItems';return db['UserProfileSection'][_0xb315('0x4c')]({'where':{'name':_0x35e286,'userProfileId':_0x59022c['userProfileId']},'raw':!![]})[_0xb315('0x24')](function(_0x54825f){if(_0x54825f&&_0x54825f[_0xb315('0x4d')]===0x0){return db[_0xb315('0x27')]['create']({'name':_0x35a5e1[_0xb315('0x2b')],'resourceId':_0x35a5e1['id'],'type':_0x54825f[_0xb315('0x2b')],'sectionId':_0x54825f['id']},{})['then'](function(){return _0x2cd9db;});}else{return _0x2cd9db;}})[_0xb315('0x44')](function(_0x3708a3){logger['error'](_0xb315('0x4e'),_0x3708a3);throw _0x3708a3;});}return _0x2cd9db;})[_0xb315('0x24')](respondWithResult(_0x2641cb,0xc9))[_0xb315('0x44')](handleError(_0x2641cb,null));};exports[_0xb315('0x23')]=function(_0x5d0e59,_0x3b4615){if(_0x5d0e59['body']['id']){delete _0x5d0e59[_0xb315('0x49')]['id'];}return db[_0xb315('0x2e')]['find']({'where':{'id':_0x5d0e59[_0xb315('0x46')]['id']}})[_0xb315('0x24')](handleEntityNotFound(_0x3b4615,null))[_0xb315('0x24')](saveUpdates(_0x5d0e59['body'],null))[_0xb315('0x24')](respondWithResult(_0x3b4615,null))[_0xb315('0x44')](handleError(_0x3b4615,null));};exports['destroy']=function(_0x5550fd,_0x3b9875){return db['CmContactHasItem'][_0xb315('0x4c')]({'where':{'id':_0x5550fd['params']['id']}})[_0xb315('0x24')](handleEntityNotFound(_0x3b9875,null))[_0xb315('0x24')](removeEntity(_0x3b9875,null))[_0xb315('0x44')](handleError(_0x3b9875,null));}; \ No newline at end of file +var _0xed56=['error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','CmContactHasItems','UserProfileResource','sendStatus'];(function(_0x2aebce,_0x4a85a8){var _0x41d780=function(_0xaebffc){while(--_0xaebffc){_0x2aebce['push'](_0x2aebce['shift']());}};_0x41d780(++_0x4a85a8);}(_0xed56,0x193));var _0x6ed5=function(_0x35875b,_0x4e7e26){_0x35875b=_0x35875b-0x0;var _0x2e386b=_0xed56[_0x35875b];return _0x2e386b;};'use strict';var emlformat=require(_0x6ed5('0x0'));var rimraf=require(_0x6ed5('0x1'));var zipdir=require(_0x6ed5('0x2'));var jsonpatch=require(_0x6ed5('0x3'));var rp=require(_0x6ed5('0x4'));var moment=require(_0x6ed5('0x5'));var BPromise=require(_0x6ed5('0x6'));var Mustache=require(_0x6ed5('0x7'));var util=require(_0x6ed5('0x8'));var path=require(_0x6ed5('0x9'));var sox=require(_0x6ed5('0xa'));var csv=require('to-csv');var ejs=require(_0x6ed5('0xb'));var fs=require('fs');var fs_extra=require(_0x6ed5('0xc'));var _=require('lodash');var squel=require(_0x6ed5('0xd'));var crypto=require(_0x6ed5('0xe'));var jsforce=require(_0x6ed5('0xf'));var deskjs=require(_0x6ed5('0x10'));var toCsv=require(_0x6ed5('0x11'));var querystring=require(_0x6ed5('0x12'));var Papa=require(_0x6ed5('0x13'));var Redis=require(_0x6ed5('0x14'));var authService=require(_0x6ed5('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x6ed5('0x16'));var hardwareService=require(_0x6ed5('0x17'));var logger=require(_0x6ed5('0x18'))(_0x6ed5('0x19'));var utils=require(_0x6ed5('0x1a'));var config=require(_0x6ed5('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ed5('0x1c'))['db'];function respondWithStatusCode(_0x15ea74,_0x4a67cc){_0x4a67cc=_0x4a67cc||0xcc;return function(_0x2f0ad4){if(_0x2f0ad4){return _0x15ea74['sendStatus'](_0x4a67cc);}return _0x15ea74[_0x6ed5('0x1d')](_0x4a67cc)[_0x6ed5('0x1e')]();};}function respondWithResult(_0xce508a,_0xe774cd){_0xe774cd=_0xe774cd||0xc8;return function(_0xf34169){if(_0xf34169){return _0xce508a[_0x6ed5('0x1d')](_0xe774cd)['json'](_0xf34169);}};}function respondWithFilteredResult(_0x17a6e1,_0x4192d2){return function(_0x2e116d){if(_0x2e116d){var _0xb3e40f=typeof _0x4192d2[_0x6ed5('0x1f')]===_0x6ed5('0x20')&&typeof _0x4192d2[_0x6ed5('0x21')]===_0x6ed5('0x20');var _0x3e39df=_0x2e116d[_0x6ed5('0x22')];var _0x4eecb2=_0xb3e40f?0x0:_0x4192d2[_0x6ed5('0x1f')];var _0x1ec76c=_0xb3e40f?_0x2e116d[_0x6ed5('0x22')]:_0x4192d2['offset']+_0x4192d2[_0x6ed5('0x21')];var _0xfc7101;if(_0x1ec76c>=_0x3e39df){_0x1ec76c=_0x3e39df;_0xfc7101=0xc8;}else{_0xfc7101=0xce;}_0x17a6e1[_0x6ed5('0x1d')](_0xfc7101);return _0x17a6e1[_0x6ed5('0x23')](_0x6ed5('0x24'),_0x4eecb2+'-'+_0x1ec76c+'/'+_0x3e39df)[_0x6ed5('0x25')](_0x2e116d);}return null;};}function patchUpdates(_0x288ffc){return function(_0x6b7e2){try{jsonpatch[_0x6ed5('0x26')](_0x6b7e2,_0x288ffc,!![]);}catch(_0x5d1853){return BPromise[_0x6ed5('0x27')](_0x5d1853);}return _0x6b7e2['save']();};}function saveUpdates(_0x42eedf,_0x5ec980){return function(_0x508fac){if(_0x508fac){return _0x508fac[_0x6ed5('0x28')](_0x42eedf)[_0x6ed5('0x29')](function(_0x57245f){return _0x57245f;});}return null;};}function removeEntity(_0x4ffd2f,_0x27eadb){return function(_0x52c5fb){if(_0x52c5fb){return _0x52c5fb[_0x6ed5('0x2a')]()['then'](function(){var _0x349f24=_0x52c5fb[_0x6ed5('0x2b')]({'plain':!![]});var _0x58eab0=_0x6ed5('0x2c');return db[_0x6ed5('0x2d')][_0x6ed5('0x2a')]({'where':{'type':_0x58eab0,'resourceId':_0x349f24['id']}})['then'](function(){return _0x52c5fb;});})[_0x6ed5('0x29')](function(){_0x4ffd2f['status'](0xcc)[_0x6ed5('0x1e')]();});}};}function handleEntityNotFound(_0x200202,_0x1eba12){return function(_0x49facf){if(!_0x49facf){_0x200202[_0x6ed5('0x2e')](0x194);}return _0x49facf;};}function handleError(_0x530ecc,_0x41fb00){_0x41fb00=_0x41fb00||0x1f4;return function(_0x462d37){logger[_0x6ed5('0x2f')](_0x462d37[_0x6ed5('0x30')]);if(_0x462d37[_0x6ed5('0x31')]){delete _0x462d37['name'];}_0x530ecc[_0x6ed5('0x1d')](_0x41fb00)[_0x6ed5('0x32')](_0x462d37);};}exports[_0x6ed5('0x33')]=function(_0x494c76,_0x52b1a9){var _0x53518e={},_0x37ab83={},_0x5b1b07={'count':0x0,'rows':[]};var _0x1f3672=_[_0x6ed5('0x34')](db[_0x6ed5('0x35')][_0x6ed5('0x36')],function(_0x2e05d2){return{'name':_0x2e05d2[_0x6ed5('0x37')],'type':_0x2e05d2[_0x6ed5('0x38')][_0x6ed5('0x39')]};});_0x37ab83[_0x6ed5('0x3a')]=_[_0x6ed5('0x34')](_0x1f3672,_0x6ed5('0x31'));_0x37ab83[_0x6ed5('0x3b')]=_[_0x6ed5('0x3c')](_0x494c76[_0x6ed5('0x3b')]);_0x37ab83[_0x6ed5('0x3d')]=_['intersection'](_0x37ab83[_0x6ed5('0x3a')],_0x37ab83['query']);_0x53518e[_0x6ed5('0x3e')]=_[_0x6ed5('0x3f')](_0x37ab83[_0x6ed5('0x3a')],qs[_0x6ed5('0x40')](_0x494c76['query']['fields']));_0x53518e['attributes']=_0x53518e[_0x6ed5('0x3e')][_0x6ed5('0x41')]?_0x53518e[_0x6ed5('0x3e')]:_0x37ab83[_0x6ed5('0x3a')];if(!_0x494c76[_0x6ed5('0x3b')][_0x6ed5('0x42')](_0x6ed5('0x43'))){_0x53518e['limit']=qs['limit'](_0x494c76[_0x6ed5('0x3b')][_0x6ed5('0x21')]);_0x53518e[_0x6ed5('0x1f')]=qs[_0x6ed5('0x1f')](_0x494c76[_0x6ed5('0x3b')][_0x6ed5('0x1f')]);}_0x53518e['order']=qs[_0x6ed5('0x44')](_0x494c76[_0x6ed5('0x3b')][_0x6ed5('0x44')]);_0x53518e[_0x6ed5('0x45')]=qs[_0x6ed5('0x3d')](_[_0x6ed5('0x46')](_0x494c76['query'],_0x37ab83[_0x6ed5('0x3d')]),_0x1f3672);if(_0x494c76[_0x6ed5('0x3b')][_0x6ed5('0x47')]){_0x53518e[_0x6ed5('0x45')]=_[_0x6ed5('0x48')](_0x53518e[_0x6ed5('0x45')],{'$or':_['map'](_0x1f3672,function(_0x220d15){if(_0x220d15['type']!=='VIRTUAL'){var _0x2c115d={};_0x2c115d[_0x220d15['name']]={'$like':'%'+_0x494c76[_0x6ed5('0x3b')][_0x6ed5('0x47')]+'%'};return _0x2c115d;}})});}_0x53518e=_[_0x6ed5('0x48')]({},_0x53518e,_0x494c76[_0x6ed5('0x49')]);var _0x39f23c={'where':_0x53518e[_0x6ed5('0x45')]};return db[_0x6ed5('0x35')][_0x6ed5('0x22')](_0x39f23c)[_0x6ed5('0x29')](function(_0x560c1d){_0x5b1b07[_0x6ed5('0x22')]=_0x560c1d;if(_0x494c76[_0x6ed5('0x3b')][_0x6ed5('0x4a')]){_0x53518e[_0x6ed5('0x4b')]=[{'all':!![]}];}return db[_0x6ed5('0x35')][_0x6ed5('0x4c')](_0x53518e);})[_0x6ed5('0x29')](function(_0xe8a8b){_0x5b1b07[_0x6ed5('0x4d')]=_0xe8a8b;return _0x5b1b07;})[_0x6ed5('0x29')](respondWithFilteredResult(_0x52b1a9,_0x53518e))['catch'](handleError(_0x52b1a9,null));};exports['show']=function(_0x3f5742,_0x2c5f4e){var _0x558c6e={'raw':!![],'where':{'id':_0x3f5742[_0x6ed5('0x4e')]['id']}},_0x4eb768={};_0x4eb768['model']=_[_0x6ed5('0x3c')](db[_0x6ed5('0x35')]['rawAttributes']);_0x4eb768[_0x6ed5('0x3b')]=_[_0x6ed5('0x3c')](_0x3f5742[_0x6ed5('0x3b')]);_0x4eb768[_0x6ed5('0x3d')]=_[_0x6ed5('0x3f')](_0x4eb768[_0x6ed5('0x3a')],_0x4eb768[_0x6ed5('0x3b')]);_0x558c6e[_0x6ed5('0x3e')]=_[_0x6ed5('0x3f')](_0x4eb768[_0x6ed5('0x3a')],qs['fields'](_0x3f5742['query'][_0x6ed5('0x40')]));_0x558c6e['attributes']=_0x558c6e['attributes'][_0x6ed5('0x41')]?_0x558c6e[_0x6ed5('0x3e')]:_0x4eb768[_0x6ed5('0x3a')];if(_0x3f5742[_0x6ed5('0x3b')][_0x6ed5('0x4a')]){_0x558c6e[_0x6ed5('0x4b')]=[{'all':!![]}];}_0x558c6e=_[_0x6ed5('0x48')]({},_0x558c6e,_0x3f5742['options']);return db[_0x6ed5('0x35')]['find'](_0x558c6e)['then'](handleEntityNotFound(_0x2c5f4e,null))[_0x6ed5('0x29')](respondWithResult(_0x2c5f4e,null))[_0x6ed5('0x4f')](handleError(_0x2c5f4e,null));};exports[_0x6ed5('0x50')]=function(_0x512795,_0xa712f8){return db[_0x6ed5('0x35')][_0x6ed5('0x50')](_0x512795[_0x6ed5('0x51')],{})['then'](function(_0x1d51b8){var _0x289416=_0x512795[_0x6ed5('0x52')][_0x6ed5('0x2b')]({'plain':!![]});if(!_0x289416)throw new Error(_0x6ed5('0x53'));if(_0x289416[_0x6ed5('0x54')]===_0x6ed5('0x52')){var _0x1fdce8=_0x1d51b8['get']({'plain':!![]});var _0x4f3b68=_0x6ed5('0x2c');return db[_0x6ed5('0x55')][_0x6ed5('0x56')]({'where':{'name':_0x4f3b68,'userProfileId':_0x289416[_0x6ed5('0x57')]},'raw':!![]})[_0x6ed5('0x29')](function(_0x11dbc){if(_0x11dbc&&_0x11dbc[_0x6ed5('0x58')]===0x0){return db[_0x6ed5('0x2d')]['create']({'name':_0x1fdce8[_0x6ed5('0x31')],'resourceId':_0x1fdce8['id'],'type':_0x11dbc[_0x6ed5('0x31')],'sectionId':_0x11dbc['id']},{})['then'](function(){return _0x1d51b8;});}else{return _0x1d51b8;}})[_0x6ed5('0x4f')](function(_0x335407){logger['error'](_0x6ed5('0x59'),_0x335407);throw _0x335407;});}return _0x1d51b8;})[_0x6ed5('0x29')](respondWithResult(_0xa712f8,0xc9))[_0x6ed5('0x4f')](handleError(_0xa712f8,null));};exports[_0x6ed5('0x28')]=function(_0x2f8039,_0x49446d){if(_0x2f8039[_0x6ed5('0x51')]['id']){delete _0x2f8039[_0x6ed5('0x51')]['id'];}return db[_0x6ed5('0x35')][_0x6ed5('0x56')]({'where':{'id':_0x2f8039[_0x6ed5('0x4e')]['id']}})[_0x6ed5('0x29')](handleEntityNotFound(_0x49446d,null))['then'](saveUpdates(_0x2f8039[_0x6ed5('0x51')],null))[_0x6ed5('0x29')](respondWithResult(_0x49446d,null))[_0x6ed5('0x4f')](handleError(_0x49446d,null));};exports[_0x6ed5('0x2a')]=function(_0x3ead11,_0x48531d){return db[_0x6ed5('0x35')][_0x6ed5('0x56')]({'where':{'id':_0x3ead11['params']['id']}})[_0x6ed5('0x29')](handleEntityNotFound(_0x48531d,null))['then'](removeEntity(_0x48531d,null))[_0x6ed5('0x4f')](handleError(_0x48531d,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 7bb9d81..92eb26a 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 _0x6aa8=['define','CmContactHasItem','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmContactHasItem.attributes','exports'];(function(_0x38e5ee,_0x3cd0cb){var _0x85812d=function(_0x3715a7){while(--_0x3715a7){_0x38e5ee['push'](_0x38e5ee['shift']());}};_0x85812d(++_0x3cd0cb);}(_0x6aa8,0x120));var _0x86aa=function(_0x7a1bcc,_0x30120f){_0x7a1bcc=_0x7a1bcc-0x0;var _0xf98e07=_0x6aa8[_0x7a1bcc];return _0xf98e07;};'use strict';var _=require(_0x86aa('0x0'));var util=require(_0x86aa('0x1'));var logger=require(_0x86aa('0x2'))(_0x86aa('0x3'));var moment=require(_0x86aa('0x4'));var BPromise=require(_0x86aa('0x5'));var rp=require(_0x86aa('0x6'));var fs=require('fs');var path=require(_0x86aa('0x7'));var rimraf=require(_0x86aa('0x8'));var config=require('../../config/environment');var attributes=require(_0x86aa('0x9'));module[_0x86aa('0xa')]=function(_0x5aaab7,_0x397919){return _0x5aaab7[_0x86aa('0xb')](_0x86aa('0xc'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44f7=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmContactHasItem.attributes','define','CmContactHasItem','cm_contact_has_items','lodash'];(function(_0x40b7fd,_0x1e8c68){var _0x4cc91b=function(_0x424753){while(--_0x424753){_0x40b7fd['push'](_0x40b7fd['shift']());}};_0x4cc91b(++_0x1e8c68);}(_0x44f7,0xe9));var _0x744f=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x44f7[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0x744f('0x0'));var util=require(_0x744f('0x1'));var logger=require(_0x744f('0x2'))(_0x744f('0x3'));var moment=require(_0x744f('0x4'));var BPromise=require(_0x744f('0x5'));var rp=require(_0x744f('0x6'));var fs=require('fs');var path=require(_0x744f('0x7'));var rimraf=require('rimraf');var config=require(_0x744f('0x8'));var attributes=require(_0x744f('0x9'));module['exports']=function(_0x11ea92,_0x33d8c2){return _0x11ea92[_0x744f('0xa')](_0x744f('0xb'),attributes,{'tableName':_0x744f('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 455fb31..9244062 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 _0x0a0f=['../../config/logger','../../config/environment','jayson/promise','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x28490c,_0xaaa013){var _0x1972c2=function(_0x2b9b24){while(--_0x2b9b24){_0x28490c['push'](_0x28490c['shift']());}};_0x1972c2(++_0xaaa013);}(_0x0a0f,0x101));var _0xf0a0=function(_0x310ee0,_0x1c5d46){_0x310ee0=_0x310ee0-0x0;var _0x2aae43=_0x0a0f[_0x310ee0];return _0x2aae43;};'use strict';var _=require(_0xf0a0('0x0'));var util=require('util');var moment=require(_0xf0a0('0x1'));var BPromise=require(_0xf0a0('0x2'));var rs=require(_0xf0a0('0x3'));var fs=require('fs');var Redis=require(_0xf0a0('0x4'));var db=require(_0xf0a0('0x5'))['db'];var utils=require(_0xf0a0('0x6'));var logger=require(_0xf0a0('0x7'))('rpc');var config=require(_0xf0a0('0x8'));var jayson=require(_0xf0a0('0x9'));var client=jayson['client'][_0xf0a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b1b42,_0x55ec1a,_0x18755d){return new BPromise(function(_0xd9cbb8,_0x4f3014){return client['request'](_0x4b1b42,_0x18755d)[_0xf0a0('0xb')](function(_0xbe85a7){logger[_0xf0a0('0xc')](_0xf0a0('0xd'),_0x55ec1a,_0xf0a0('0xe'));logger[_0xf0a0('0xf')](_0xf0a0('0x10'),_0x55ec1a,_0xf0a0('0xe'),JSON[_0xf0a0('0x11')](_0xbe85a7));if(_0xbe85a7[_0xf0a0('0x12')]){if(_0xbe85a7['error'][_0xf0a0('0x13')]===0x1f4){logger['error'](_0xf0a0('0xd'),_0x55ec1a,_0xbe85a7['error']['message']);return _0x4f3014(_0xbe85a7[_0xf0a0('0x12')][_0xf0a0('0x14')]);}logger[_0xf0a0('0x12')](_0xf0a0('0xd'),_0x55ec1a,_0xbe85a7[_0xf0a0('0x12')][_0xf0a0('0x14')]);return _0xd9cbb8(_0xbe85a7[_0xf0a0('0x12')][_0xf0a0('0x14')]);}else{logger[_0xf0a0('0xc')](_0xf0a0('0xd'),_0x55ec1a,'request\x20sent');_0xd9cbb8(_0xbe85a7['result'][_0xf0a0('0x14')]);}})[_0xf0a0('0x15')](function(_0x3b9d18){logger[_0xf0a0('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x55ec1a,_0x3b9d18);_0x4f3014(_0x3b9d18);});});} \ No newline at end of file +var _0x0b86=['request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','stringify','error','code','message'];(function(_0x15b580,_0x343baf){var _0x47cd5e=function(_0x51993a){while(--_0x51993a){_0x15b580['push'](_0x15b580['shift']());}};_0x47cd5e(++_0x343baf);}(_0x0b86,0xbb));var _0x60b8=function(_0x2b5ee5,_0x3741bf){_0x2b5ee5=_0x2b5ee5-0x0;var _0x1c480b=_0x0b86[_0x2b5ee5];return _0x1c480b;};'use strict';var _=require(_0x60b8('0x0'));var util=require(_0x60b8('0x1'));var moment=require(_0x60b8('0x2'));var BPromise=require(_0x60b8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60b8('0x4'));var db=require(_0x60b8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x60b8('0x6'))(_0x60b8('0x7'));var config=require('../../config/environment');var jayson=require(_0x60b8('0x8'));var client=jayson[_0x60b8('0x9')][_0x60b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ebe5f,_0x9b8cd6,_0x3dd2e5){return new BPromise(function(_0x20aadb,_0x22af32){return client[_0x60b8('0xb')](_0x4ebe5f,_0x3dd2e5)[_0x60b8('0xc')](function(_0x59fb3f){logger[_0x60b8('0xd')](_0x60b8('0xe'),_0x9b8cd6,'request\x20sent');logger[_0x60b8('0xf')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x9b8cd6,'request\x20sent',JSON[_0x60b8('0x10')](_0x59fb3f));if(_0x59fb3f[_0x60b8('0x11')]){if(_0x59fb3f[_0x60b8('0x11')][_0x60b8('0x12')]===0x1f4){logger[_0x60b8('0x11')](_0x60b8('0xe'),_0x9b8cd6,_0x59fb3f[_0x60b8('0x11')]['message']);return _0x22af32(_0x59fb3f[_0x60b8('0x11')][_0x60b8('0x13')]);}logger['error'](_0x60b8('0xe'),_0x9b8cd6,_0x59fb3f[_0x60b8('0x11')][_0x60b8('0x13')]);return _0x20aadb(_0x59fb3f[_0x60b8('0x11')][_0x60b8('0x13')]);}else{logger[_0x60b8('0xd')](_0x60b8('0xe'),_0x9b8cd6,_0x60b8('0x14'));_0x20aadb(_0x59fb3f[_0x60b8('0x15')]['message']);}})[_0x60b8('0x16')](function(_0x6a4e29){logger[_0x60b8('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x9b8cd6,_0x6a4e29);_0x22af32(_0x6a4e29);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index b1096f3..c608d1a 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 _0xc1ae=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dacc3,_0x3a475f){var _0x3ed9a5=function(_0x167eac){while(--_0x167eac){_0x3dacc3['push'](_0x3dacc3['shift']());}};_0x3ed9a5(++_0x3a475f);}(_0xc1ae,0xae));var _0xec1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1ae[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xec1a('0x0'));var util=require(_0xec1a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xec1a('0x2'));var auth=require(_0xec1a('0x3'));var interaction=require(_0xec1a('0x4'));var config=require(_0xec1a('0x5'));var controller=require('./cmContactHasItem.controller');router[_0xec1a('0x6')]('/',auth[_0xec1a('0x7')](),controller['index']);router['get'](_0xec1a('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xec1a('0x9')]('/',auth[_0xec1a('0x7')](),controller[_0xec1a('0xa')]);router[_0xec1a('0xb')](_0xec1a('0x8'),auth[_0xec1a('0x7')](),controller[_0xec1a('0xc')]);router[_0xec1a('0xd')](_0xec1a('0x8'),auth[_0xec1a('0x7')](),controller[_0xec1a('0xe')]);module[_0xec1a('0xf')]=router; \ No newline at end of file +var _0x718b=['index','get','isAuthenticated','post','put','/:id','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller'];(function(_0x44fc6c,_0x4ada61){var _0x3f34c6=function(_0x298e9d){while(--_0x298e9d){_0x44fc6c['push'](_0x44fc6c['shift']());}};_0x3f34c6(++_0x4ada61);}(_0x718b,0xc3));var _0xb718=function(_0x1597e2,_0x388d3e){_0x1597e2=_0x1597e2-0x0;var _0x4c8c0a=_0x718b[_0x1597e2];return _0x4c8c0a;};'use strict';var multer=require(_0xb718('0x0'));var util=require(_0xb718('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb718('0x2'));var router=express[_0xb718('0x3')]();var fs_extra=require(_0xb718('0x4'));var auth=require(_0xb718('0x5'));var interaction=require(_0xb718('0x6'));var config=require(_0xb718('0x7'));var controller=require(_0xb718('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb718('0x9')]);router[_0xb718('0xa')]('/:id',auth[_0xb718('0xb')](),controller['show']);router[_0xb718('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb718('0xd')](_0xb718('0xe'),auth[_0xb718('0xb')](),controller[_0xb718('0xf')]);router[_0xb718('0x10')](_0xb718('0xe'),auth[_0xb718('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index bfd5b9d..5b8d434 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 _0x81ff=['lodash','exports','VIRTUAL','alias','STRING','getDataValue','name','TEXT','long','type','select','values','stringify','setDataValue','BOOLEAN','ENUM','voice','sequelize'];(function(_0x7af18,_0x4993a1){var _0x45bb08=function(_0x39b2bd){while(--_0x39b2bd){_0x7af18['push'](_0x7af18['shift']());}};_0x45bb08(++_0x4993a1);}(_0x81ff,0xe9));var _0xf81f=function(_0x27f789,_0x4276de){_0x27f789=_0x27f789-0x0;var _0xe8fc8=_0x81ff[_0x27f789];return _0xe8fc8;};'use strict';var Sequelize=require(_0xf81f('0x0'));var _=require(_0xf81f('0x1'));module[_0xf81f('0x2')]={'name':{'type':Sequelize[_0xf81f('0x3')],'get':function(_0x246f99){return this['getDataValue'](_0xf81f('0x4'));}},'alias':{'type':Sequelize[_0xf81f('0x5')],'allowNull':![],'set':function(_0x3dfbf2){this['setDataValue'](_0xf81f('0x4'),_0x3dfbf2?_0x3dfbf2:this[_0xf81f('0x6')](_0xf81f('0x7')));}},'type':{'type':Sequelize[_0xf81f('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xf81f('0x8')](_0xf81f('0x9')),'get':function(){if(this[_0xf81f('0x6')](_0xf81f('0xa'))===_0xf81f('0xb')){return JSON['parse'](this[_0xf81f('0x6')](_0xf81f('0xc')));}else{return this[_0xf81f('0x6')](_0xf81f('0xc'));}},'set':function(_0x23eed8){if(Array['isArray'](_0x23eed8)){this['setDataValue'](_0xf81f('0xc'),JSON[_0xf81f('0xd')](_0x23eed8));}else{this[_0xf81f('0xe')]('values',_0x23eed8);}}},'required':{'type':Sequelize[_0xf81f('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf81f('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf81f('0x10')](_0xf81f('0x11'))}}; \ No newline at end of file +var _0x06c1=['parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','exports','VIRTUAL','getDataValue','STRING','setDataValue','name','TEXT','type'];(function(_0x239a6d,_0x52ebf1){var _0x29ad03=function(_0x4c99cd){while(--_0x4c99cd){_0x239a6d['push'](_0x239a6d['shift']());}};_0x29ad03(++_0x52ebf1);}(_0x06c1,0x157));var _0x106c=function(_0x3a091f,_0x5e202d){_0x3a091f=_0x3a091f-0x0;var _0x43356d=_0x06c1[_0x3a091f];return _0x43356d;};'use strict';var Sequelize=require(_0x106c('0x0'));var _=require('lodash');module[_0x106c('0x1')]={'name':{'type':Sequelize[_0x106c('0x2')],'get':function(_0xfda02b){return this[_0x106c('0x3')]('alias');}},'alias':{'type':Sequelize[_0x106c('0x4')],'allowNull':![],'set':function(_0x47f0e0){this[_0x106c('0x5')]('alias',_0x47f0e0?_0x47f0e0:this[_0x106c('0x3')](_0x106c('0x6')));}},'type':{'type':Sequelize[_0x106c('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x106c('0x7')]('long'),'get':function(){if(this['getDataValue'](_0x106c('0x8'))==='select'){return JSON[_0x106c('0x9')](this[_0x106c('0x3')](_0x106c('0xa')));}else{return this[_0x106c('0x3')](_0x106c('0xa'));}},'set':function(_0xbc9eb0){if(Array[_0x106c('0xb')](_0xbc9eb0)){this[_0x106c('0x5')](_0x106c('0xa'),JSON[_0x106c('0xc')](_0xbc9eb0));}else{this[_0x106c('0x5')](_0x106c('0xa'),_0xbc9eb0);}}},'required':{'type':Sequelize[_0x106c('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x106c('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x106c('0xe')](_0x106c('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 03593ea..183b2b8 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 _0x3398=['create','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','format','cf_%d','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','send','index','CmCustomField','rawAttributes','type','key','model','differenceBy','name','query','keys','filters','fields','attributes','length','nolimit','order','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','body'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x3398,0xb4));var _0x8339=function(_0x525b68,_0x321435){_0x525b68=_0x525b68-0x0;var _0x5430c4=_0x3398[_0x525b68];return _0x5430c4;};'use strict';var emlformat=require(_0x8339('0x0'));var rimraf=require(_0x8339('0x1'));var zipdir=require(_0x8339('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8339('0x3'));var moment=require(_0x8339('0x4'));var BPromise=require(_0x8339('0x5'));var Mustache=require(_0x8339('0x6'));var util=require('util');var path=require(_0x8339('0x7'));var sox=require(_0x8339('0x8'));var csv=require(_0x8339('0x9'));var ejs=require(_0x8339('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8339('0xb'));var squel=require(_0x8339('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8339('0xd'));var toCsv=require(_0x8339('0x9'));var querystring=require('querystring');var Papa=require(_0x8339('0xe'));var Redis=require(_0x8339('0xf'));var authService=require(_0x8339('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8339('0x11'));var hardwareService=require(_0x8339('0x12'));var logger=require('../../config/logger')(_0x8339('0x13'));var utils=require(_0x8339('0x14'));var config=require(_0x8339('0x15'));var licenseUtil=require(_0x8339('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x339d67,_0x178a69){_0x178a69=_0x178a69||0xcc;return function(_0x3b1bfc){if(_0x3b1bfc){return _0x339d67['sendStatus'](_0x178a69);}return _0x339d67['status'](_0x178a69)[_0x8339('0x17')]();};}function respondWithResult(_0x17705c,_0x4548ad){_0x4548ad=_0x4548ad||0xc8;return function(_0x59329b){if(_0x59329b){return _0x17705c[_0x8339('0x18')](_0x4548ad)[_0x8339('0x19')](_0x59329b);}};}function respondWithFilteredResult(_0x438435,_0x142945){return function(_0x863b45){if(_0x863b45){var _0x1257f5=typeof _0x142945[_0x8339('0x1a')]===_0x8339('0x1b')&&typeof _0x142945['limit']===_0x8339('0x1b');var _0x311d64=_0x863b45['count'];var _0x57ae1d=_0x1257f5?0x0:_0x142945[_0x8339('0x1a')];var _0x5e5d52=_0x1257f5?_0x863b45[_0x8339('0x1c')]:_0x142945[_0x8339('0x1a')]+_0x142945[_0x8339('0x1d')];var _0x367602;if(_0x5e5d52>=_0x311d64){_0x5e5d52=_0x311d64;_0x367602=0xc8;}else{_0x367602=0xce;}_0x438435[_0x8339('0x18')](_0x367602);return _0x438435[_0x8339('0x1e')](_0x8339('0x1f'),_0x57ae1d+'-'+_0x5e5d52+'/'+_0x311d64)[_0x8339('0x19')](_0x863b45);}return null;};}function patchUpdates(_0x83e212){return function(_0x379e94){try{jsonpatch[_0x8339('0x20')](_0x379e94,_0x83e212,!![]);}catch(_0x5f0878){return BPromise['reject'](_0x5f0878);}return _0x379e94[_0x8339('0x21')]();};}function saveUpdates(_0x3b8e8a,_0x1d6ef8){return function(_0x2dcfe2){if(_0x2dcfe2){return _0x2dcfe2[_0x8339('0x22')](_0x3b8e8a)[_0x8339('0x23')](function(_0x2124f4){return _0x2124f4;});}return null;};}function removeEntity(_0x376007,_0x3caf18){return function(_0x458f26){if(_0x458f26){return _0x458f26[_0x8339('0x24')]()[_0x8339('0x23')](function(){_0x376007[_0x8339('0x18')](0xcc)[_0x8339('0x17')]();});}};}function handleEntityNotFound(_0x472cc1,_0x5f0f4e){return function(_0x32d3a1){if(!_0x32d3a1){_0x472cc1[_0x8339('0x25')](0x194);}return _0x32d3a1;};}function handleError(_0x598f83,_0xf7874c){_0xf7874c=_0xf7874c||0x1f4;return function(_0x26c3c6){logger[_0x8339('0x26')](_0x26c3c6['stack']);if(_0x26c3c6['name']){delete _0x26c3c6['name'];}_0x598f83['status'](_0xf7874c)[_0x8339('0x27')](_0x26c3c6);};}exports[_0x8339('0x28')]=function(_0x368c80,_0x1faf8c){var _0x19d820={},_0x2ecf43={},_0x269fec={'count':0x0,'rows':[]};var _0x44dfda=_['map'](db[_0x8339('0x29')][_0x8339('0x2a')],function(_0x12c498){return{'name':_0x12c498['fieldName'],'type':_0x12c498[_0x8339('0x2b')][_0x8339('0x2c')]};});_0x2ecf43[_0x8339('0x2d')]=_[_0x8339('0x2e')](_['map'](_0x44dfda,_0x8339('0x2f')),[_0x8339('0x2f')]);_0x2ecf43[_0x8339('0x30')]=_[_0x8339('0x31')](_0x368c80[_0x8339('0x30')]);_0x2ecf43[_0x8339('0x32')]=_['intersection'](_0x2ecf43['model'],_0x2ecf43['query']);_0x19d820['attributes']=_['intersection'](_0x2ecf43[_0x8339('0x2d')],qs[_0x8339('0x33')](_0x368c80[_0x8339('0x30')][_0x8339('0x33')]));_0x19d820[_0x8339('0x34')]=_0x19d820[_0x8339('0x34')][_0x8339('0x35')]?_0x19d820[_0x8339('0x34')]:_0x2ecf43['model'];if(!_0x368c80[_0x8339('0x30')]['hasOwnProperty'](_0x8339('0x36'))){_0x19d820[_0x8339('0x1d')]=qs[_0x8339('0x1d')](_0x368c80['query']['limit']);_0x19d820[_0x8339('0x1a')]=qs[_0x8339('0x1a')](_0x368c80[_0x8339('0x30')][_0x8339('0x1a')]);}_0x19d820[_0x8339('0x37')]=qs['sort'](_0x368c80[_0x8339('0x30')]['sort']);_0x19d820['where']=qs[_0x8339('0x32')](_[_0x8339('0x38')](_0x368c80['query'],_0x2ecf43[_0x8339('0x32')]),_0x44dfda);if(_0x368c80[_0x8339('0x30')][_0x8339('0x39')]){_0x19d820[_0x8339('0x3a')]=_['merge'](_0x19d820[_0x8339('0x3a')],{'$or':_['map'](_0x44dfda,function(_0x503695){if(_0x503695[_0x8339('0x2b')]!==_0x8339('0x3b')){var _0x5ceb4c={};_0x5ceb4c[_0x503695['name']]={'$like':'%'+_0x368c80[_0x8339('0x30')][_0x8339('0x39')]+'%'};return _0x5ceb4c;}})});}_0x19d820=_[_0x8339('0x3c')]({},_0x19d820,_0x368c80[_0x8339('0x3d')]);var _0x44d3e4={'where':_0x19d820[_0x8339('0x3a')]};return db['CmCustomField'][_0x8339('0x1c')](_0x44d3e4)[_0x8339('0x23')](function(_0x1ce9d2){_0x269fec[_0x8339('0x1c')]=_0x1ce9d2;if(_0x368c80['query'][_0x8339('0x3e')]){_0x19d820[_0x8339('0x3f')]=[{'all':!![]}];}return db[_0x8339('0x29')][_0x8339('0x40')](_0x19d820);})[_0x8339('0x23')](function(_0x1eab79){_0x269fec[_0x8339('0x41')]=_0x1eab79;return _0x269fec;})['then'](respondWithFilteredResult(_0x1faf8c,_0x19d820))[_0x8339('0x42')](handleError(_0x1faf8c,null));};exports[_0x8339('0x43')]=function(_0x310f7b,_0x442618){var _0x2c7854={'raw':!![],'where':{'id':_0x310f7b[_0x8339('0x44')]['id']}},_0x1ae4dd={};_0x1ae4dd['model']=_['keys'](db['CmCustomField']['rawAttributes']);_0x1ae4dd[_0x8339('0x30')]=_[_0x8339('0x31')](_0x310f7b['query']);_0x1ae4dd[_0x8339('0x32')]=_[_0x8339('0x45')](_0x1ae4dd[_0x8339('0x2d')],_0x1ae4dd['query']);_0x2c7854[_0x8339('0x34')]=_[_0x8339('0x45')](_0x1ae4dd['model'],qs[_0x8339('0x33')](_0x310f7b[_0x8339('0x30')][_0x8339('0x33')]));_0x2c7854[_0x8339('0x34')]=_0x2c7854['attributes'][_0x8339('0x35')]?_0x2c7854[_0x8339('0x34')]:_0x1ae4dd[_0x8339('0x2d')];if(_0x310f7b[_0x8339('0x30')][_0x8339('0x3e')]){_0x2c7854[_0x8339('0x3f')]=[{'all':!![]}];}_0x2c7854=_[_0x8339('0x3c')]({},_0x2c7854,_0x310f7b[_0x8339('0x3d')]);return db[_0x8339('0x29')][_0x8339('0x46')](_0x2c7854)[_0x8339('0x23')](handleEntityNotFound(_0x442618,null))[_0x8339('0x23')](respondWithResult(_0x442618,null))[_0x8339('0x42')](handleError(_0x442618,null));};exports[_0x8339('0x22')]=function(_0x195368,_0x457557){if(_0x195368[_0x8339('0x47')]['id']){delete _0x195368[_0x8339('0x47')]['id'];}return db[_0x8339('0x29')][_0x8339('0x46')]({'where':{'id':_0x195368['params']['id']}})['then'](handleEntityNotFound(_0x457557,null))['then'](saveUpdates(_0x195368['body'],null))[_0x8339('0x23')](respondWithResult(_0x457557,null))[_0x8339('0x42')](handleError(_0x457557,null));};exports[_0x8339('0x24')]=function(_0x16a434,_0x52ad1e){return db[_0x8339('0x29')][_0x8339('0x46')]({'where':{'id':_0x16a434['params']['id']}})[_0x8339('0x23')](handleEntityNotFound(_0x52ad1e,null))[_0x8339('0x23')](removeEntity(_0x52ad1e,null))['catch'](handleError(_0x52ad1e,null));};exports[_0x8339('0x48')]=function(_0x41500c,_0x3832d5){var _0x11b20f;return db['sequelize'][_0x8339('0x49')](function(_0x55811a){return db[_0x8339('0x29')][_0x8339('0x48')](_0x41500c['body'],{'transaction':_0x55811a})[_0x8339('0x23')](function(_0x4d07c4){_0x11b20f=_0x4d07c4;var _0x68dd75={'type':db[_0x8339('0x4a')][_0x8339('0x4b')],'transaction':_0x55811a};switch(_0x41500c[_0x8339('0x47')][_0x8339('0x2b')]){case'text':_0x68dd75['type']=db[_0x8339('0x4a')]['TEXT'];break;case _0x8339('0x4c'):_0x68dd75['type']=db[_0x8339('0x4a')][_0x8339('0x4d')];break;case _0x8339('0x4e'):_0x68dd75[_0x8339('0x2b')]=db[_0x8339('0x4a')][_0x8339('0x4f')];_0x68dd75[_0x8339('0x50')]=![];break;default:}return db[_0x8339('0x51')]['queryInterface']['addColumn']('cm_contacts',util[_0x8339('0x52')](_0x8339('0x53'),_0x11b20f['id']),_0x68dd75);})[_0x8339('0x23')](function(){return _0x11b20f;});})['then'](respondWithResult(_0x3832d5,0xc9))['catch'](handleError(_0x3832d5,null));}; \ No newline at end of file +var _0x0fcf=['intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','then','catch','params','include','options','find','body','destroy','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','sendStatus','error','name','index','map','CmCustomField','rawAttributes','key','model','query','keys','filters'];(function(_0x3ed430,_0x5fafab){var _0xae4a10=function(_0x53105d){while(--_0x53105d){_0x3ed430['push'](_0x3ed430['shift']());}};_0xae4a10(++_0x5fafab);}(_0x0fcf,0xc7));var _0xf0fc=function(_0x191580,_0x2f48fc){_0x191580=_0x191580-0x0;var _0x1ba1c1=_0x0fcf[_0x191580];return _0x1ba1c1;};'use strict';var emlformat=require(_0xf0fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0fc('0x1'));var jsonpatch=require(_0xf0fc('0x2'));var rp=require(_0xf0fc('0x3'));var moment=require(_0xf0fc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf0fc('0x5'));var util=require(_0xf0fc('0x6'));var path=require('path');var sox=require(_0xf0fc('0x7'));var csv=require(_0xf0fc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0fc('0x9'));var _=require(_0xf0fc('0xa'));var squel=require(_0xf0fc('0xb'));var crypto=require('crypto');var jsforce=require(_0xf0fc('0xc'));var deskjs=require(_0xf0fc('0xd'));var toCsv=require(_0xf0fc('0x8'));var querystring=require('querystring');var Papa=require(_0xf0fc('0xe'));var Redis=require(_0xf0fc('0xf'));var authService=require(_0xf0fc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0fc('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf0fc('0x12'));var db=require(_0xf0fc('0x13'))['db'];function respondWithStatusCode(_0xad9cec,_0x3ac15f){_0x3ac15f=_0x3ac15f||0xcc;return function(_0x2c579a){if(_0x2c579a){return _0xad9cec['sendStatus'](_0x3ac15f);}return _0xad9cec['status'](_0x3ac15f)[_0xf0fc('0x14')]();};}function respondWithResult(_0x5522dc,_0x2d7831){_0x2d7831=_0x2d7831||0xc8;return function(_0x32de54){if(_0x32de54){return _0x5522dc[_0xf0fc('0x15')](_0x2d7831)['json'](_0x32de54);}};}function respondWithFilteredResult(_0x3d6c79,_0x5cd93a){return function(_0x20782b){if(_0x20782b){var _0x5aca9b=typeof _0x5cd93a[_0xf0fc('0x16')]===_0xf0fc('0x17')&&typeof _0x5cd93a[_0xf0fc('0x18')]===_0xf0fc('0x17');var _0x33cf80=_0x20782b[_0xf0fc('0x19')];var _0x208e28=_0x5aca9b?0x0:_0x5cd93a[_0xf0fc('0x16')];var _0x54b946=_0x5aca9b?_0x20782b['count']:_0x5cd93a['offset']+_0x5cd93a['limit'];var _0x25b873;if(_0x54b946>=_0x33cf80){_0x54b946=_0x33cf80;_0x25b873=0xc8;}else{_0x25b873=0xce;}_0x3d6c79['status'](_0x25b873);return _0x3d6c79['set'](_0xf0fc('0x1a'),_0x208e28+'-'+_0x54b946+'/'+_0x33cf80)[_0xf0fc('0x1b')](_0x20782b);}return null;};}function patchUpdates(_0x4e60c3){return function(_0x2c2fb0){try{jsonpatch[_0xf0fc('0x1c')](_0x2c2fb0,_0x4e60c3,!![]);}catch(_0x176460){return BPromise[_0xf0fc('0x1d')](_0x176460);}return _0x2c2fb0[_0xf0fc('0x1e')]();};}function saveUpdates(_0x4526a1,_0x1bee43){return function(_0xa3b6ee){if(_0xa3b6ee){return _0xa3b6ee[_0xf0fc('0x1f')](_0x4526a1)['then'](function(_0x2630c2){return _0x2630c2;});}return null;};}function removeEntity(_0x29170f,_0xca0672){return function(_0xa8c0f7){if(_0xa8c0f7){return _0xa8c0f7['destroy']()['then'](function(){_0x29170f['status'](0xcc)[_0xf0fc('0x14')]();});}};}function handleEntityNotFound(_0x896113,_0x3eaf4c){return function(_0x450225){if(!_0x450225){_0x896113[_0xf0fc('0x20')](0x194);}return _0x450225;};}function handleError(_0x12a30b,_0x3d9ff7){_0x3d9ff7=_0x3d9ff7||0x1f4;return function(_0x4d3907){logger[_0xf0fc('0x21')](_0x4d3907['stack']);if(_0x4d3907[_0xf0fc('0x22')]){delete _0x4d3907[_0xf0fc('0x22')];}_0x12a30b[_0xf0fc('0x15')](_0x3d9ff7)['send'](_0x4d3907);};}exports[_0xf0fc('0x23')]=function(_0x16d85c,_0x3d2111){var _0xeabb08={},_0x368608={},_0xce3d97={'count':0x0,'rows':[]};var _0x6409ef=_[_0xf0fc('0x24')](db[_0xf0fc('0x25')][_0xf0fc('0x26')],function(_0x2588c1){return{'name':_0x2588c1['fieldName'],'type':_0x2588c1['type'][_0xf0fc('0x27')]};});_0x368608[_0xf0fc('0x28')]=_['differenceBy'](_['map'](_0x6409ef,_0xf0fc('0x22')),[_0xf0fc('0x22')]);_0x368608[_0xf0fc('0x29')]=_[_0xf0fc('0x2a')](_0x16d85c[_0xf0fc('0x29')]);_0x368608[_0xf0fc('0x2b')]=_[_0xf0fc('0x2c')](_0x368608[_0xf0fc('0x28')],_0x368608[_0xf0fc('0x29')]);_0xeabb08['attributes']=_[_0xf0fc('0x2c')](_0x368608[_0xf0fc('0x28')],qs['fields'](_0x16d85c[_0xf0fc('0x29')][_0xf0fc('0x2d')]));_0xeabb08[_0xf0fc('0x2e')]=_0xeabb08[_0xf0fc('0x2e')][_0xf0fc('0x2f')]?_0xeabb08['attributes']:_0x368608[_0xf0fc('0x28')];if(!_0x16d85c[_0xf0fc('0x29')][_0xf0fc('0x30')](_0xf0fc('0x31'))){_0xeabb08['limit']=qs[_0xf0fc('0x18')](_0x16d85c[_0xf0fc('0x29')]['limit']);_0xeabb08[_0xf0fc('0x16')]=qs[_0xf0fc('0x16')](_0x16d85c[_0xf0fc('0x29')][_0xf0fc('0x16')]);}_0xeabb08['order']=qs[_0xf0fc('0x32')](_0x16d85c['query']['sort']);_0xeabb08[_0xf0fc('0x33')]=qs[_0xf0fc('0x2b')](_[_0xf0fc('0x34')](_0x16d85c[_0xf0fc('0x29')],_0x368608[_0xf0fc('0x2b')]),_0x6409ef);if(_0x16d85c[_0xf0fc('0x29')][_0xf0fc('0x35')]){_0xeabb08[_0xf0fc('0x33')]=_['merge'](_0xeabb08[_0xf0fc('0x33')],{'$or':_[_0xf0fc('0x24')](_0x6409ef,function(_0x5f5d95){if(_0x5f5d95[_0xf0fc('0x36')]!==_0xf0fc('0x37')){var _0x2e9465={};_0x2e9465[_0x5f5d95['name']]={'$like':'%'+_0x16d85c[_0xf0fc('0x29')][_0xf0fc('0x35')]+'%'};return _0x2e9465;}})});}_0xeabb08=_[_0xf0fc('0x38')]({},_0xeabb08,_0x16d85c['options']);var _0x197009={'where':_0xeabb08['where']};return db['CmCustomField']['count'](_0x197009)['then'](function(_0x4b6c62){_0xce3d97[_0xf0fc('0x19')]=_0x4b6c62;if(_0x16d85c['query'][_0xf0fc('0x39')]){_0xeabb08['include']=[{'all':!![]}];}return db[_0xf0fc('0x25')]['findAll'](_0xeabb08);})[_0xf0fc('0x3a')](function(_0x2389df){_0xce3d97['rows']=_0x2389df;return _0xce3d97;})[_0xf0fc('0x3a')](respondWithFilteredResult(_0x3d2111,_0xeabb08))[_0xf0fc('0x3b')](handleError(_0x3d2111,null));};exports['show']=function(_0x52c221,_0x5774d4){var _0x3187c7={'raw':!![],'where':{'id':_0x52c221[_0xf0fc('0x3c')]['id']}},_0x3b1aaf={};_0x3b1aaf[_0xf0fc('0x28')]=_['keys'](db['CmCustomField']['rawAttributes']);_0x3b1aaf[_0xf0fc('0x29')]=_[_0xf0fc('0x2a')](_0x52c221[_0xf0fc('0x29')]);_0x3b1aaf[_0xf0fc('0x2b')]=_[_0xf0fc('0x2c')](_0x3b1aaf[_0xf0fc('0x28')],_0x3b1aaf[_0xf0fc('0x29')]);_0x3187c7[_0xf0fc('0x2e')]=_[_0xf0fc('0x2c')](_0x3b1aaf[_0xf0fc('0x28')],qs[_0xf0fc('0x2d')](_0x52c221[_0xf0fc('0x29')]['fields']));_0x3187c7[_0xf0fc('0x2e')]=_0x3187c7['attributes']['length']?_0x3187c7[_0xf0fc('0x2e')]:_0x3b1aaf['model'];if(_0x52c221[_0xf0fc('0x29')][_0xf0fc('0x39')]){_0x3187c7[_0xf0fc('0x3d')]=[{'all':!![]}];}_0x3187c7=_['merge']({},_0x3187c7,_0x52c221[_0xf0fc('0x3e')]);return db[_0xf0fc('0x25')][_0xf0fc('0x3f')](_0x3187c7)['then'](handleEntityNotFound(_0x5774d4,null))[_0xf0fc('0x3a')](respondWithResult(_0x5774d4,null))[_0xf0fc('0x3b')](handleError(_0x5774d4,null));};exports['update']=function(_0x670d94,_0xd46b84){if(_0x670d94[_0xf0fc('0x40')]['id']){delete _0x670d94[_0xf0fc('0x40')]['id'];}return db[_0xf0fc('0x25')]['find']({'where':{'id':_0x670d94[_0xf0fc('0x3c')]['id']}})['then'](handleEntityNotFound(_0xd46b84,null))['then'](saveUpdates(_0x670d94[_0xf0fc('0x40')],null))['then'](respondWithResult(_0xd46b84,null))[_0xf0fc('0x3b')](handleError(_0xd46b84,null));};exports[_0xf0fc('0x41')]=function(_0x39b074,_0x4b0709){return db[_0xf0fc('0x25')][_0xf0fc('0x3f')]({'where':{'id':_0x39b074[_0xf0fc('0x3c')]['id']}})[_0xf0fc('0x3a')](handleEntityNotFound(_0x4b0709,null))[_0xf0fc('0x3a')](removeEntity(_0x4b0709,null))[_0xf0fc('0x3b')](handleError(_0x4b0709,null));};exports[_0xf0fc('0x42')]=function(_0x441c1a,_0x301e13){var _0xaf70b;return db[_0xf0fc('0x43')][_0xf0fc('0x44')](function(_0x2bf551){return db[_0xf0fc('0x25')][_0xf0fc('0x42')](_0x441c1a[_0xf0fc('0x40')],{'transaction':_0x2bf551})[_0xf0fc('0x3a')](function(_0x409e9f){_0xaf70b=_0x409e9f;var _0x4e6705={'type':db[_0xf0fc('0x45')][_0xf0fc('0x46')],'transaction':_0x2bf551};switch(_0x441c1a['body'][_0xf0fc('0x36')]){case _0xf0fc('0x47'):_0x4e6705[_0xf0fc('0x36')]=db[_0xf0fc('0x45')][_0xf0fc('0x46')];break;case _0xf0fc('0x48'):_0x4e6705[_0xf0fc('0x36')]=db['Sequelize'][_0xf0fc('0x49')];break;case'switch':_0x4e6705['type']=db['Sequelize'][_0xf0fc('0x4a')];_0x4e6705[_0xf0fc('0x4b')]=![];break;default:}return db[_0xf0fc('0x43')][_0xf0fc('0x4c')][_0xf0fc('0x4d')](_0xf0fc('0x4e'),util[_0xf0fc('0x4f')](_0xf0fc('0x50'),_0xaf70b['id']),_0x4e6705);})[_0xf0fc('0x3a')](function(){return _0xaf70b;});})[_0xf0fc('0x3a')](respondWithResult(_0x301e13,0xc9))[_0xf0fc('0x3b')](handleError(_0x301e13,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 86ad518..f87125a 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 _0xc0e2=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x43e489,_0x309c03){var _0x4a5078=function(_0x30828a){while(--_0x30828a){_0x43e489['push'](_0x43e489['shift']());}};_0x4a5078(++_0x309c03);}(_0xc0e2,0x1e2));var _0x2c0e=function(_0x2bf613,_0x10449d){_0x2bf613=_0x2bf613-0x0;var _0x57a019=_0xc0e2[_0x2bf613];return _0x57a019;};'use strict';var _=require(_0x2c0e('0x0'));var util=require(_0x2c0e('0x1'));var logger=require(_0x2c0e('0x2'))('api');var moment=require(_0x2c0e('0x3'));var BPromise=require(_0x2c0e('0x4'));var rp=require(_0x2c0e('0x5'));var fs=require('fs');var path=require(_0x2c0e('0x6'));var rimraf=require(_0x2c0e('0x7'));var config=require(_0x2c0e('0x8'));var attributes=require(_0x2c0e('0x9'));module[_0x2c0e('0xa')]=function(_0x2d25ba,_0x18028d){return _0x2d25ba[_0x2c0e('0xb')](_0x2c0e('0xc'),attributes,{'tableName':_0x2c0e('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2d1=['exports','define','CmCustomField','cm_custom_fields','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x4c9bc9,_0x13e695){var _0x4a7fa4=function(_0x4e89b0){while(--_0x4e89b0){_0x4c9bc9['push'](_0x4c9bc9['shift']());}};_0x4a7fa4(++_0x13e695);}(_0xd2d1,0x154));var _0x1d2d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd2d1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1d2d('0x0'));var util=require(_0x1d2d('0x1'));var logger=require('../../config/logger')(_0x1d2d('0x2'));var moment=require(_0x1d2d('0x3'));var BPromise=require(_0x1d2d('0x4'));var rp=require(_0x1d2d('0x5'));var fs=require('fs');var path=require(_0x1d2d('0x6'));var rimraf=require(_0x1d2d('0x7'));var config=require(_0x1d2d('0x8'));var attributes=require(_0x1d2d('0x9'));module[_0x1d2d('0xa')]=function(_0x2665fd,_0x563db4){return _0x2665fd[_0x1d2d('0xb')](_0x1d2d('0xc'),attributes,{'tableName':_0x1d2d('0xd'),'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 a63064e..f3c8914 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 _0x1258=['error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4ef7bc,_0x1e8207){var _0x30a74f=function(_0x5c728e){while(--_0x5c728e){_0x4ef7bc['push'](_0x4ef7bc['shift']());}};_0x30a74f(++_0x1e8207);}(_0x1258,0x196));var _0x8125=function(_0x5ccc4c,_0x5bee16){_0x5ccc4c=_0x5ccc4c-0x0;var _0x13d160=_0x1258[_0x5ccc4c];return _0x13d160;};'use strict';var _=require(_0x8125('0x0'));var util=require('util');var moment=require(_0x8125('0x1'));var BPromise=require(_0x8125('0x2'));var rs=require(_0x8125('0x3'));var fs=require('fs');var Redis=require(_0x8125('0x4'));var db=require(_0x8125('0x5'))['db'];var utils=require(_0x8125('0x6'));var logger=require(_0x8125('0x7'))(_0x8125('0x8'));var config=require('../../config/environment');var jayson=require(_0x8125('0x9'));var client=jayson[_0x8125('0xa')][_0x8125('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x322fca,_0x214f30,_0x10f4c9){return new BPromise(function(_0x1bd27d,_0x1a46f9){return client[_0x8125('0xc')](_0x322fca,_0x10f4c9)[_0x8125('0xd')](function(_0x40ea80){logger[_0x8125('0xe')]('CmCustomField,\x20%s,\x20%s',_0x214f30,'request\x20sent');logger[_0x8125('0xf')](_0x8125('0x10'),_0x214f30,_0x8125('0x11'),JSON[_0x8125('0x12')](_0x40ea80));if(_0x40ea80[_0x8125('0x13')]){if(_0x40ea80[_0x8125('0x13')][_0x8125('0x14')]===0x1f4){logger[_0x8125('0x13')](_0x8125('0x15'),_0x214f30,_0x40ea80[_0x8125('0x13')][_0x8125('0x16')]);return _0x1a46f9(_0x40ea80[_0x8125('0x13')]['message']);}logger['error'](_0x8125('0x15'),_0x214f30,_0x40ea80[_0x8125('0x13')][_0x8125('0x16')]);return _0x1bd27d(_0x40ea80[_0x8125('0x13')][_0x8125('0x16')]);}else{logger['info'](_0x8125('0x15'),_0x214f30,_0x8125('0x11'));_0x1bd27d(_0x40ea80[_0x8125('0x17')][_0x8125('0x16')]);}})[_0x8125('0x18')](function(_0x5fa08c){logger[_0x8125('0x13')](_0x8125('0x15'),_0x214f30,_0x5fa08c);_0x1a46f9(_0x5fa08c);});});} \ No newline at end of file +var _0x8b25=['request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x447610,_0x43baa9){var _0x2d6b19=function(_0xd6adc1){while(--_0xd6adc1){_0x447610['push'](_0x447610['shift']());}};_0x2d6b19(++_0x43baa9);}(_0x8b25,0x15a));var _0x58b2=function(_0x503b3e,_0x344bb6){_0x503b3e=_0x503b3e-0x0;var _0x3b5f13=_0x8b25[_0x503b3e];return _0x3b5f13;};'use strict';var _=require(_0x58b2('0x0'));var util=require(_0x58b2('0x1'));var moment=require('moment');var BPromise=require(_0x58b2('0x2'));var rs=require(_0x58b2('0x3'));var fs=require('fs');var Redis=require(_0x58b2('0x4'));var db=require(_0x58b2('0x5'))['db'];var utils=require(_0x58b2('0x6'));var logger=require(_0x58b2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x58b2('0x8'));var client=jayson[_0x58b2('0x9')][_0x58b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ba1ec,_0x4f041b,_0x67cf17){return new BPromise(function(_0x38283e,_0xc56346){return client[_0x58b2('0xb')](_0x5ba1ec,_0x67cf17)['then'](function(_0x2fd490){logger[_0x58b2('0xc')](_0x58b2('0xd'),_0x4f041b,_0x58b2('0xe'));logger[_0x58b2('0xf')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4f041b,_0x58b2('0xe'),JSON['stringify'](_0x2fd490));if(_0x2fd490[_0x58b2('0x10')]){if(_0x2fd490[_0x58b2('0x10')][_0x58b2('0x11')]===0x1f4){logger['error'](_0x58b2('0xd'),_0x4f041b,_0x2fd490[_0x58b2('0x10')][_0x58b2('0x12')]);return _0xc56346(_0x2fd490[_0x58b2('0x10')][_0x58b2('0x12')]);}logger['error'](_0x58b2('0xd'),_0x4f041b,_0x2fd490[_0x58b2('0x10')][_0x58b2('0x12')]);return _0x38283e(_0x2fd490['error'][_0x58b2('0x12')]);}else{logger[_0x58b2('0xc')](_0x58b2('0xd'),_0x4f041b,_0x58b2('0xe'));_0x38283e(_0x2fd490[_0x58b2('0x13')][_0x58b2('0x12')]);}})[_0x58b2('0x14')](function(_0x20e68a){logger[_0x58b2('0x10')](_0x58b2('0xd'),_0x4f041b,_0x20e68a);_0xc56346(_0x20e68a);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 2f9c836..7cb59ff 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 _0x1c3d=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x2359b4,_0x97eed2){var _0x9c21a2=function(_0x4e76ae){while(--_0x4e76ae){_0x2359b4['push'](_0x2359b4['shift']());}};_0x9c21a2(++_0x97eed2);}(_0x1c3d,0x68));var _0xd1c3=function(_0x1fb07d,_0x16b8cb){_0x1fb07d=_0x1fb07d-0x0;var _0x5a101f=_0x1c3d[_0x1fb07d];return _0x5a101f;};'use strict';var multer=require(_0xd1c3('0x0'));var util=require(_0xd1c3('0x1'));var path=require(_0xd1c3('0x2'));var timeout=require(_0xd1c3('0x3'));var express=require(_0xd1c3('0x4'));var router=express['Router']();var fs_extra=require(_0xd1c3('0x5'));var auth=require(_0xd1c3('0x6'));var interaction=require(_0xd1c3('0x7'));var config=require(_0xd1c3('0x8'));var controller=require(_0xd1c3('0x9'));router[_0xd1c3('0xa')]('/',auth[_0xd1c3('0xb')](),controller[_0xd1c3('0xc')]);router[_0xd1c3('0xa')](_0xd1c3('0xd'),auth[_0xd1c3('0xb')](),controller[_0xd1c3('0xe')]);router[_0xd1c3('0xf')]('/',auth['isAuthenticated'](),controller[_0xd1c3('0x10')]);router[_0xd1c3('0x11')](_0xd1c3('0xd'),auth[_0xd1c3('0xb')](),controller[_0xd1c3('0x12')]);router[_0xd1c3('0x13')](_0xd1c3('0xd'),auth[_0xd1c3('0xb')](),controller[_0xd1c3('0x14')]);module['exports']=router; \ No newline at end of file +var _0x655d=['Router','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x31880d,_0x4f0ff3){var _0x423823=function(_0x57cc92){while(--_0x57cc92){_0x31880d['push'](_0x31880d['shift']());}};_0x423823(++_0x4f0ff3);}(_0x655d,0x13b));var _0xd655=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x655d[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0xd655('0x0'));var util=require(_0xd655('0x1'));var path=require(_0xd655('0x2'));var timeout=require(_0xd655('0x3'));var express=require(_0xd655('0x4'));var router=express[_0xd655('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd655('0x6'));var interaction=require(_0xd655('0x7'));var config=require('../../config/environment');var controller=require(_0xd655('0x8'));router['get']('/',auth[_0xd655('0x9')](),controller[_0xd655('0xa')]);router[_0xd655('0xb')](_0xd655('0xc'),auth[_0xd655('0x9')](),controller[_0xd655('0xd')]);router[_0xd655('0xe')]('/',auth[_0xd655('0x9')](),controller[_0xd655('0xf')]);router[_0xd655('0x10')](_0xd655('0xc'),auth['isAuthenticated'](),controller[_0xd655('0x11')]);router[_0xd655('0x12')](_0xd655('0xc'),auth[_0xd655('0x9')](),controller['destroy']);module[_0xd655('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index f359716..1bd869a 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 _0x1f3b=['INTEGER','UNSIGNED','contactListQueue','sequelize','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0x1f3b,0x18b));var _0xb1f3=function(_0x2e2c1b,_0x94deaf){_0x2e2c1b=_0x2e2c1b-0x0;var _0x43a4f2=_0x1f3b[_0x2e2c1b];return _0x43a4f2;};'use strict';var moment=require('moment');var Sequelize=require(_0xb1f3('0x0'));module['exports']={'phone':{'type':Sequelize[_0xb1f3('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xb1f3('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb1f3('0x3')],'defaultValue':moment()['format'](_0xb1f3('0x4'))},'countbusyretry':{'type':Sequelize[_0xb1f3('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb1f3('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb1f3('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb1f3('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb1f3('0x3')]},'priority':{'type':Sequelize[_0xb1f3('0x5')](0x2)[_0xb1f3('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb1f3('0x5')],'unique':_0xb1f3('0x7')},'ListId':{'type':Sequelize[_0xb1f3('0x5')],'unique':_0xb1f3('0x7')},'UserId':{'type':Sequelize[_0xb1f3('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xb1f3('0x5')],'unique':_0xb1f3('0x7')},'CampaignId':{'type':Sequelize[_0xb1f3('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb1f3('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb1f3('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb1f3('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb1f3('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb1f3('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0xb1f3('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x271d=['INTEGER','STRING','DATE','UNSIGNED','contactListQueue','sequelize','exports','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x49393a,_0xa11c3){var _0xd95485=function(_0x5f8cf3){while(--_0x5f8cf3){_0x49393a['push'](_0x49393a['shift']());}};_0xd95485(++_0xa11c3);}(_0x271d,0xd7));var _0xd271=function(_0x2f3c30,_0x4040f6){_0x2f3c30=_0x2f3c30-0x0;var _0x917b24=_0x271d[_0x2f3c30];return _0x917b24;};'use strict';var moment=require('moment');var Sequelize=require(_0xd271('0x0'));module[_0xd271('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xd271('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xd271('0x3')](_0xd271('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd271('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd271('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd271('0x7')]},'priority':{'type':Sequelize[_0xd271('0x5')](0x2)[_0xd271('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd271('0x5')],'unique':_0xd271('0x9')},'ListId':{'type':Sequelize[_0xd271('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xd271('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xd271('0x5')],'unique':_0xd271('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xd271('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd271('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd271('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd271('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xd271('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'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 2722773..6708aa5 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 _0xa990=['describe','destroy','find','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','updatedAt','state','statedesc','deleted','campaign','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','format','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','dialOrderByScheduledAt','findOne','scheduledat','recallme','LOCK','UPDATE','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','transaction','CmList','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','set','update','then','sendStatus','error','stack','name','index','map','CmHopper','rawAttributes','type','model','keys','query','filters','intersection','concat','$gt','$gte','$lt','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$any','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','rows','catch','show','include','create','body','params'];(function(_0x12ff98,_0x52151d){var _0x9c49e6=function(_0x16027c){while(--_0x16027c){_0x12ff98['push'](_0x12ff98['shift']());}};_0x9c49e6(++_0x52151d);}(_0xa990,0xc9));var _0x0a99=function(_0x40f871,_0x3d7cce){_0x40f871=_0x40f871-0x0;var _0x2f1e26=_0xa990[_0x40f871];return _0x2f1e26;};'use strict';var moment=require(_0x0a99('0x0'));var _=require(_0x0a99('0x1'));var qs=require(_0x0a99('0x2'));var logger=require(_0x0a99('0x3'))(_0x0a99('0x4'));var shared=require(_0x0a99('0x5'));var db=require(_0x0a99('0x6'))['db'];function respondWithResult(_0x394f1c,_0x4d4992){_0x4d4992=_0x4d4992||0xc8;return function(_0x4d1781){if(_0x4d1781){return _0x394f1c[_0x0a99('0x7')](_0x4d4992)[_0x0a99('0x8')](_0x4d1781);}};}function respondWithFilteredResult(_0xfdb594,_0x320560){return function(_0x45b195){if(_0x45b195){var _0x398d95=typeof _0x320560[_0x0a99('0x9')]===_0x0a99('0xa')&&typeof _0x320560[_0x0a99('0xb')]===_0x0a99('0xa');var _0x1eaa2a=_0x45b195['count'];var _0x813e91=_0x398d95?0x0:_0x320560[_0x0a99('0x9')];var _0x5b5ec3=_0x398d95?_0x45b195['count']:_0x320560[_0x0a99('0x9')]+_0x320560[_0x0a99('0xb')];var _0x1eb2bd;if(_0x5b5ec3>=_0x1eaa2a){_0x5b5ec3=_0x1eaa2a;_0x1eb2bd=0xc8;}else{_0x1eb2bd=0xce;}_0xfdb594[_0x0a99('0x7')](_0x1eb2bd);return _0xfdb594[_0x0a99('0xc')]('Content-Range',_0x813e91+'-'+_0x5b5ec3+'/'+_0x1eaa2a)[_0x0a99('0x8')](_0x45b195);}return null;};}function saveUpdates(_0x3aaaad,_0x57ab88){return function(_0xb6a34d){if(_0xb6a34d){return _0xb6a34d[_0x0a99('0xd')](_0x3aaaad)[_0x0a99('0xe')](function(_0x2bbf1a){return _0x2bbf1a;});}return null;};}function handleEntityNotFound(_0x346061,_0x23d018){return function(_0x18c124){if(!_0x18c124){_0x346061[_0x0a99('0xf')](0x194);}return _0x18c124;};}function handleError(_0x4b6946,_0x5a17e1){_0x5a17e1=_0x5a17e1||0x1f4;return function(_0x2c40db){logger[_0x0a99('0x10')](_0x2c40db[_0x0a99('0x11')]);if(_0x2c40db['name']){delete _0x2c40db[_0x0a99('0x12')];}_0x4b6946['status'](_0x5a17e1)['send'](_0x2c40db);};}exports[_0x0a99('0x13')]=function(_0x3bab16,_0x3de006){var _0x544c2={},_0x572ce5={},_0x564ae9={'count':0x0,'rows':[]};var _0x27a14f=_[_0x0a99('0x14')](db[_0x0a99('0x15')][_0x0a99('0x16')],function(_0x5e6c7e){return{'name':_0x5e6c7e['fieldName'],'type':_0x5e6c7e[_0x0a99('0x17')]['key']};});_0x572ce5[_0x0a99('0x18')]=_['map'](_0x27a14f,_0x0a99('0x12'));_0x572ce5['query']=_[_0x0a99('0x19')](_0x3bab16[_0x0a99('0x1a')]);_0x572ce5[_0x0a99('0x1b')]=_[_0x0a99('0x1c')](_0x572ce5[_0x0a99('0x18')],_0x572ce5[_0x0a99('0x1a')]);_0x572ce5[_0x0a99('0x1b')]=_[_0x0a99('0x1d')](_0x572ce5[_0x0a99('0x1b')],['$and','$or',_0x0a99('0x1e'),_0x0a99('0x1f'),_0x0a99('0x20'),'$lte','$ne',_0x0a99('0x21'),_0x0a99('0x22'),_0x0a99('0x23'),_0x0a99('0x24'),_0x0a99('0x25'),_0x0a99('0x26'),_0x0a99('0x27'),_0x0a99('0x28'),_0x0a99('0x29'),'$notILike',_0x0a99('0x27'),'$overlap','$contains','$contained',_0x0a99('0x2a')]);_0x544c2[_0x0a99('0x2b')]=_[_0x0a99('0x1c')](_0x572ce5[_0x0a99('0x18')],qs[_0x0a99('0x2c')](_0x3bab16[_0x0a99('0x1a')][_0x0a99('0x2c')]));_0x544c2['attributes']=_0x544c2[_0x0a99('0x2b')][_0x0a99('0x2d')]?_0x544c2[_0x0a99('0x2b')]:_0x572ce5[_0x0a99('0x18')];if(!_0x3bab16['query']['hasOwnProperty']('nolimit')){_0x544c2[_0x0a99('0xb')]=qs[_0x0a99('0xb')](_0x3bab16[_0x0a99('0x1a')]['limit']);_0x544c2[_0x0a99('0x9')]=qs[_0x0a99('0x9')](_0x3bab16[_0x0a99('0x1a')][_0x0a99('0x9')]);}_0x544c2[_0x0a99('0x2e')]=qs[_0x0a99('0x2f')](_0x3bab16[_0x0a99('0x1a')]['sort']);_0x544c2[_0x0a99('0x30')]=qs[_0x0a99('0x1b')](_[_0x0a99('0x31')](_0x3bab16[_0x0a99('0x1a')],_0x572ce5[_0x0a99('0x1b')]),_0x27a14f);if(_0x3bab16['query'][_0x0a99('0x32')]){_0x544c2['where']=_['merge'](_0x544c2['where'],{'$or':_['map'](_0x27a14f,function(_0x155a14){if(_0x155a14['type']!==_0x0a99('0x33')){var _0x3d5e0f={};_0x3d5e0f[_0x155a14[_0x0a99('0x12')]]={'$like':'%'+_0x3bab16[_0x0a99('0x1a')][_0x0a99('0x32')]+'%'};return _0x3d5e0f;}})});}_0x544c2=_[_0x0a99('0x34')]({},_0x544c2,_0x3bab16[_0x0a99('0x35')]);var _0x3bc3fc={'where':_0x544c2[_0x0a99('0x30')]};return db[_0x0a99('0x15')][_0x0a99('0x36')](_0x3bc3fc)[_0x0a99('0xe')](function(_0x472850){_0x564ae9['count']=_0x472850;if(_0x3bab16[_0x0a99('0x1a')][_0x0a99('0x37')]){_0x544c2['include']=[{'all':!![]}];}return db[_0x0a99('0x15')]['findAll'](_0x544c2);})[_0x0a99('0xe')](function(_0x563fbc){_0x564ae9[_0x0a99('0x38')]=_0x563fbc;return _0x564ae9;})[_0x0a99('0xe')](respondWithFilteredResult(_0x3de006,_0x544c2))[_0x0a99('0x39')](handleError(_0x3de006,null));};exports[_0x0a99('0x3a')]=function(_0x4a5c58,_0x19774f){var _0x11e046={'raw':!![],'where':{'id':_0x4a5c58['params']['id']}},_0x3b7efc={};_0x3b7efc[_0x0a99('0x18')]=_[_0x0a99('0x19')](db[_0x0a99('0x15')][_0x0a99('0x16')]);_0x3b7efc['query']=_[_0x0a99('0x19')](_0x4a5c58['query']);_0x3b7efc['filters']=_[_0x0a99('0x1c')](_0x3b7efc['model'],_0x3b7efc[_0x0a99('0x1a')]);_0x11e046['attributes']=_[_0x0a99('0x1c')](_0x3b7efc[_0x0a99('0x18')],qs[_0x0a99('0x2c')](_0x4a5c58[_0x0a99('0x1a')]['fields']));_0x11e046[_0x0a99('0x2b')]=_0x11e046[_0x0a99('0x2b')][_0x0a99('0x2d')]?_0x11e046[_0x0a99('0x2b')]:_0x3b7efc['model'];if(_0x4a5c58['query']['includeAll']){_0x11e046[_0x0a99('0x3b')]=[{'all':!![]}];}_0x11e046=_['merge']({},_0x11e046,_0x4a5c58[_0x0a99('0x35')]);return db['CmHopper']['find'](_0x11e046)['then'](handleEntityNotFound(_0x19774f,null))['then'](respondWithResult(_0x19774f,null))[_0x0a99('0x39')](handleError(_0x19774f,null));};exports['create']=function(_0x3e6213,_0x78cd0c){return db['CmHopper'][_0x0a99('0x3c')](_0x3e6213[_0x0a99('0x3d')],{})['then'](respondWithResult(_0x78cd0c,0xc9))[_0x0a99('0x39')](handleError(_0x78cd0c,null));};exports['update']=function(_0x3107bc,_0x278454){if(_0x3107bc['body']['id']){delete _0x3107bc[_0x0a99('0x3d')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x3107bc[_0x0a99('0x3e')]['id']}})[_0x0a99('0xe')](handleEntityNotFound(_0x278454,null))[_0x0a99('0xe')](saveUpdates(_0x3107bc[_0x0a99('0x3d')],null))[_0x0a99('0xe')](respondWithResult(_0x278454,null))['catch'](handleError(_0x278454,null));};exports[_0x0a99('0x3f')]=function(_0x174298,_0x4525d1){return db[_0x0a99('0x15')][_0x0a99('0x3f')]()[_0x0a99('0xe')](respondWithResult(_0x4525d1,null))[_0x0a99('0x39')](handleError(_0x4525d1,null));};exports[_0x0a99('0x40')]=function(_0x1cd328,_0x1621d9){var _0x52c754;var _0x50e04f=_0x1cd328[_0x0a99('0x3e')]['id'];return db[_0x0a99('0x15')][_0x0a99('0x41')]({'where':{'id':_0x1cd328[_0x0a99('0x3e')]['id']}})[_0x0a99('0xe')](handleEntityNotFound(_0x1621d9,null))[_0x0a99('0xe')](function(_0x5cda7d){if(_0x5cda7d){return _0x5cda7d[_0x0a99('0x40')]()[_0x0a99('0xe')](function(_0x55fee0){return _0x55fee0;});}})[_0x0a99('0xe')](function(_0x474e8b){_0x52c754=_0x474e8b;if(_0x474e8b){if(_0x474e8b['VoiceQueueId']||_0x474e8b[_0x0a99('0x42')]){return db[_0x474e8b[_0x0a99('0x43')]?_0x0a99('0x44'):_0x0a99('0x45')][_0x0a99('0x41')]({'where':{'id':_0x474e8b[_0x0a99('0x43')]?_0x474e8b[_0x0a99('0x43')]:_0x474e8b['CampaignId']},'attributes':['id',_0x0a99('0x12')],'raw':!![]});}}})[_0x0a99('0xe')](function(_0x1e9e9d){var _0x5a6762={};if(_0x1e9e9d){_[_0x0a99('0x34')](_0x5a6762,_[_0x0a99('0x46')](_0x52c754[_0x0a99('0x47')],['createdAt',_0x0a99('0x48'),'id']));_0x5a6762[_0x0a99('0x49')]=0x15;_0x5a6762[_0x0a99('0x4a')]=_0x0a99('0x4b');_0x5a6762[_0x0a99('0x4c')]=_0x1e9e9d[_0x0a99('0x12')];_0x5a6762['membername']=_0x1cd328[_0x0a99('0x4d')]['name'];_0x5a6762[_0x0a99('0x4e')]=_0x1cd328[_0x0a99('0x4d')]['id'];_0x5a6762[_0x0a99('0x4b')]=!![];_0x5a6762[_0x0a99('0x4f')]=moment()['format'](_0x0a99('0x50'));_0x5a6762['calleridnum']=_0x52c754[_0x0a99('0x51')];_0x5a6762[_0x0a99('0x52')]=_0x52c754[_0x0a99('0x43')]?_0x0a99('0x53'):_0x0a99('0x54');return db[_0x0a99('0x55')][_0x0a99('0x41')]({'where':{'id':_0x5a6762[_0x0a99('0x56')]},'attributes':[_0x0a99('0x57'),_0x0a99('0x58')]})[_0x0a99('0xe')](function(_0x3f2e09){if(!_[_0x0a99('0x59')](_0x1621d9)&&!_['isNil'](_0x3f2e09[_0x0a99('0x57')])){_0x5a6762[_0x0a99('0x5a')]=_0x3f2e09[_0x0a99('0x57')];if(!_['isNil'](_0x3f2e09[_0x0a99('0x58')])){_0x5a6762[_0x0a99('0x5a')]+='\x20'+_0x3f2e09[_0x0a99('0x58')];}}})['finally'](function(){return db[_0x0a99('0x5b')][_0x0a99('0x3c')](_0x5a6762);});}})[_0x0a99('0xe')](function(_0x144032){return db['CmHopperAdditionalPhone'][_0x0a99('0x40')]({'where':{'CmHopperId':_0x50e04f}});})[_0x0a99('0xe')](function(){return _0x1621d9[_0x0a99('0x7')](0xcc)['end']();})['catch'](handleError(_0x1621d9,null));};exports[_0x0a99('0x5c')]=function(_0x528a5d,_0x53b1f4){var _0x5406a7=[];return db[_0x0a99('0x55')]['describe']()[_0x0a99('0xe')](function(_0x436942){_0x5406a7=_[_0x0a99('0x19')](_0x436942);return _0x528a5d[_0x0a99('0x4d')][_0x0a99('0x5d')]({'where':{'type':_0x0a99('0x5e'),'dialActive':!![],'dialMethod':_0x0a99('0x5f')},'attributes':['id','dialOrderByScheduledAt',_0x0a99('0x60')],'raw':!![]});})[_0x0a99('0xe')](function(_0x2d3b63){if(_0x2d3b63&&_0x2d3b63['length']){return db[_0x0a99('0x61')]['transaction'](function(_0x2109db){var _0x51d18a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0a99('0x62')](_0x0a99('0x50'))},'VoiceQueueId':{'$in':_['map'](_0x2d3b63,'id')},'$or':[{'UserId':null},{'UserId':_0x528a5d[_0x0a99('0x4d')]['id']}]};var _0x4ce300={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2d3b63)[_0x0a99('0x32')]([_0x0a99('0x60'),0x0])[_0x0a99('0x14')]('id')[_0x0a99('0x63')]()},'$or':[{'UserId':null},{'UserId':_0x528a5d[_0x0a99('0x4d')]['id']}]};var _0x9b52c7={'$or':[_0x51d18a,_0x4ce300]};var _0x44aa5d=[];if(_0x528a5d[_0x0a99('0x3d')][_0x0a99('0x64')]&&_0x528a5d[_0x0a99('0x3d')][_0x0a99('0x64')]===_0x0a99('0x65')){if(!_[_0x0a99('0x66')](_0x528a5d[_0x0a99('0x3d')][_0x0a99('0x67')])){_0x9b52c7['id']={'$in':_0x528a5d[_0x0a99('0x3d')][_0x0a99('0x67')]};}_0x44aa5d=[[_0x0a99('0x68'),'ASC'],['scheduledAt',_0x2d3b63[0x0]['dialOrderByScheduledAt']===_0x0a99('0x69')?_0x0a99('0x6a'):_0x0a99('0x69')],db['sequelize'][_0x0a99('0x6b')](_0x0a99('0x6c')),['id',_0x0a99('0x6a')]];}else{if(!_[_0x0a99('0x66')](_0x528a5d['body'][_0x0a99('0x67')])){_0x9b52c7['id']={'$notIn':_0x528a5d[_0x0a99('0x3d')]['hopperIds']};}_0x44aa5d=[['priority',_0x0a99('0x6a')],[_0x0a99('0x6d'),_0x2d3b63[0x0][_0x0a99('0x6e')]],db[_0x0a99('0x61')][_0x0a99('0x6b')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0x0a99('0x15')][_0x0a99('0x6f')]({'attributes':['id',_0x0a99('0x70'),_0x0a99('0x51'),_0x0a99('0x71')],'where':_0x9b52c7,'order':_0x44aa5d,'transaction':_0x2109db,'lock':_0x2109db[_0x0a99('0x72')][_0x0a99('0x73')],'include':[{'model':db[_0x0a99('0x55')],'as':'Contact','attributes':_0x5406a7,'include':[{'model':db[_0x0a99('0x74')],'as':_0x0a99('0x75'),'attributes':['id',_0x0a99('0x12')]}]},{'model':db['CmList'],'as':_0x0a99('0x76'),'attributes':['id','name']},{'model':db[_0x0a99('0x44')],'as':_0x0a99('0x77'),'attributes':['id',_0x0a99('0x12'),_0x0a99('0x78')]}]})['then'](function(_0x3435e3){if(_0x3435e3){return _0x3435e3[_0x0a99('0xd')]({'UserId':_0x528a5d[_0x0a99('0x4d')]['id']},{'transaction':_0x2109db});}});});}})[_0x0a99('0xe')](handleEntityNotFound(_0x53b1f4,null))[_0x0a99('0xe')](respondWithResult(_0x53b1f4,null))[_0x0a99('0x39')](handleError(_0x53b1f4,null));};exports[_0x0a99('0x79')]=function(_0x4c6a12,_0x656dd,_0x31950f){var _0x436163=[];var _0x2bae3d=_0x4c6a12['params']['id'];var _0x1a40e9=_0x4c6a12['user']['id'];return db['CmContact'][_0x0a99('0x3f')]()[_0x0a99('0xe')](function(_0x3bed6e){_0x436163=_[_0x0a99('0x19')](_0x3bed6e);return db[_0x0a99('0x61')][_0x0a99('0x7a')](function(_0x24a389){const _0x353660={'id':_0x2bae3d};return db['CmHopper'][_0x0a99('0x6f')]({'attributes':['id','scheduledat','recallme'],'where':_0x353660,'transaction':_0x24a389,'lock':_0x24a389['LOCK'][_0x0a99('0x73')],'include':[{'model':db[_0x0a99('0x55')],'as':'Contact','attributes':_0x436163,'include':[{'model':db['CmCompany'],'as':_0x0a99('0x75'),'attributes':['id',_0x0a99('0x12')]}]},{'model':db[_0x0a99('0x7b')],'as':_0x0a99('0x76'),'attributes':['id',_0x0a99('0x12')]},{'model':db[_0x0a99('0x44')],'as':_0x0a99('0x77'),'attributes':['id',_0x0a99('0x12'),_0x0a99('0x78')]}]})['then'](function(_0x51627a){if(_0x51627a){return _0x51627a[_0x0a99('0xd')]({'UserId':_0x1a40e9},{'transaction':_0x24a389});}});});})[_0x0a99('0xe')](handleEntityNotFound(_0x656dd,null))[_0x0a99('0xe')](respondWithResult(_0x656dd,null))[_0x0a99('0x39')](handleError(_0x656dd,null));};exports[_0x0a99('0x7c')]=function(_0x22b737,_0x3a6773){return _0x22b737['user']['getVoiceQueues']({'where':{'type':_0x0a99('0x5e'),'dialActive':!![],'dialMethod':_0x0a99('0x5f')},'attributes':['id'],'raw':!![]})['then'](function(_0x587442){if(_0x587442&&_0x587442[_0x0a99('0x2d')]){return db['CmHopper'][_0x0a99('0x36')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0a99('0x62')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x587442,'id')},'$or':[{'UserId':null},{'UserId':_0x22b737[_0x0a99('0x4d')]['id']}]}});}return 0x0;})['then'](function(_0x17436d){if(!_['isNil'](_0x17436d)&&_[_0x0a99('0x7d')](_0x17436d)){return _0x3a6773[_0x0a99('0x7')](0xc8)[_0x0a99('0x8')]({'contacts':_0x17436d});}else{logger[_0x0a99('0x10')](_0x0a99('0x7e'),_0x0a99('0x7c'),0x194,_0x0a99('0x7f'));_0x3a6773[_0x0a99('0xf')](0x194);}})[_0x0a99('0x39')](handleError(_0x3a6773,null));};exports[_0x0a99('0x80')]=function(_0x2d3efa,_0xe18018){var _0x51df2a=shared[_0x0a99('0x81')];var _0x2f4d34=[];_[_0x0a99('0x14')](_0x51df2a,function(_0x25c31b){_0x2f4d34[_0x0a99('0x82')]({'id':_0x25c31b[_0x0a99('0x12')],'name':_0x25c31b[_0x0a99('0x12')],'utcOffset':_0x25c31b[_0x0a99('0x83')]});});return _0xe18018[_0x0a99('0x7')](0xc8)[_0x0a99('0x8')]({'tz':_0x2f4d34});};exports['getTimezone']=function(_0x5607f1,_0x505a2c){var _0x59228e=shared[_0x0a99('0x81')];var _0x38932f={};if(!_[_0x0a99('0x59')](_0x59228e[_0x5607f1[_0x0a99('0x3d')]['id']]))_0x38932f=_0x59228e[_0x5607f1[_0x0a99('0x3d')]['id']];return _0x505a2c[_0x0a99('0x7')](0xc8)[_0x0a99('0x8')](_0x38932f);}; \ No newline at end of file +var _0x202c=['update','then','error','name','send','index','rawAttributes','fieldName','type','key','keys','query','model','filters','concat','$and','$or','$lt','$lte','$ne','$not','$between','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','CmHopper','includeAll','include','findAll','rows','catch','show','length','find','create','body','describe','destroy','params','CampaignId','VoiceQueueId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','UserId','user','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','map','prev','isEmpty','hopperIds','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','LOCK','UPDATE','CmCompany','Company','List','Queue','CmContact','VoiceQueue','getOpenContacts','format','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','moment','../../config/logger','api','../../config/environment','status','undefined','limit','count','offset','Content-Range','json'];(function(_0x381652,_0x45998f){var _0x124e26=function(_0x184a19){while(--_0x184a19){_0x381652['push'](_0x381652['shift']());}};_0x124e26(++_0x45998f);}(_0x202c,0x178));var _0xc202=function(_0x2c077b,_0x171aff){_0x2c077b=_0x2c077b-0x0;var _0x23105e=_0x202c[_0x2c077b];return _0x23105e;};'use strict';var moment=require(_0xc202('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0xc202('0x1'))(_0xc202('0x2'));var shared=require(_0xc202('0x3'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x215161,_0x155c3b){_0x155c3b=_0x155c3b||0xc8;return function(_0x1763f5){if(_0x1763f5){return _0x215161[_0xc202('0x4')](_0x155c3b)['json'](_0x1763f5);}};}function respondWithFilteredResult(_0x28e51c,_0x68d363){return function(_0x59563a){if(_0x59563a){var _0xc2b3eb=typeof _0x68d363['offset']===_0xc202('0x5')&&typeof _0x68d363[_0xc202('0x6')]===_0xc202('0x5');var _0x336fc8=_0x59563a[_0xc202('0x7')];var _0x3ea754=_0xc2b3eb?0x0:_0x68d363[_0xc202('0x8')];var _0xdfe8bf=_0xc2b3eb?_0x59563a[_0xc202('0x7')]:_0x68d363[_0xc202('0x8')]+_0x68d363[_0xc202('0x6')];var _0x870346;if(_0xdfe8bf>=_0x336fc8){_0xdfe8bf=_0x336fc8;_0x870346=0xc8;}else{_0x870346=0xce;}_0x28e51c[_0xc202('0x4')](_0x870346);return _0x28e51c['set'](_0xc202('0x9'),_0x3ea754+'-'+_0xdfe8bf+'/'+_0x336fc8)[_0xc202('0xa')](_0x59563a);}return null;};}function saveUpdates(_0x2805af,_0xbf3618){return function(_0x269dc0){if(_0x269dc0){return _0x269dc0[_0xc202('0xb')](_0x2805af)[_0xc202('0xc')](function(_0x53600c){return _0x53600c;});}return null;};}function handleEntityNotFound(_0xbd4353,_0x32b5d9){return function(_0x591cc0){if(!_0x591cc0){_0xbd4353['sendStatus'](0x194);}return _0x591cc0;};}function handleError(_0x5c10dd,_0x2dafa5){_0x2dafa5=_0x2dafa5||0x1f4;return function(_0x4a333c){logger[_0xc202('0xd')](_0x4a333c['stack']);if(_0x4a333c[_0xc202('0xe')]){delete _0x4a333c[_0xc202('0xe')];}_0x5c10dd[_0xc202('0x4')](_0x2dafa5)[_0xc202('0xf')](_0x4a333c);};}exports[_0xc202('0x10')]=function(_0x2419c5,_0x9620a0){var _0x591ecc={},_0x16ec7c={},_0x2c5557={'count':0x0,'rows':[]};var _0x3f322d=_['map'](db['CmHopper'][_0xc202('0x11')],function(_0x1af67a){return{'name':_0x1af67a[_0xc202('0x12')],'type':_0x1af67a[_0xc202('0x13')][_0xc202('0x14')]};});_0x16ec7c['model']=_['map'](_0x3f322d,_0xc202('0xe'));_0x16ec7c['query']=_[_0xc202('0x15')](_0x2419c5[_0xc202('0x16')]);_0x16ec7c['filters']=_['intersection'](_0x16ec7c[_0xc202('0x17')],_0x16ec7c['query']);_0x16ec7c[_0xc202('0x18')]=_[_0xc202('0x19')](_0x16ec7c[_0xc202('0x18')],[_0xc202('0x1a'),_0xc202('0x1b'),'$gt','$gte',_0xc202('0x1c'),_0xc202('0x1d'),_0xc202('0x1e'),'$eq',_0xc202('0x1f'),_0xc202('0x20'),'$notBetween','$in',_0xc202('0x21'),_0xc202('0x22'),_0xc202('0x23'),_0xc202('0x24'),_0xc202('0x25'),'$like',_0xc202('0x26'),_0xc202('0x27'),'$contained','$any']);_0x591ecc[_0xc202('0x28')]=_[_0xc202('0x29')](_0x16ec7c[_0xc202('0x17')],qs[_0xc202('0x2a')](_0x2419c5['query'][_0xc202('0x2a')]));_0x591ecc[_0xc202('0x28')]=_0x591ecc[_0xc202('0x28')]['length']?_0x591ecc[_0xc202('0x28')]:_0x16ec7c[_0xc202('0x17')];if(!_0x2419c5[_0xc202('0x16')][_0xc202('0x2b')](_0xc202('0x2c'))){_0x591ecc[_0xc202('0x6')]=qs[_0xc202('0x6')](_0x2419c5[_0xc202('0x16')][_0xc202('0x6')]);_0x591ecc[_0xc202('0x8')]=qs[_0xc202('0x8')](_0x2419c5[_0xc202('0x16')]['offset']);}_0x591ecc[_0xc202('0x2d')]=qs[_0xc202('0x2e')](_0x2419c5[_0xc202('0x16')]['sort']);_0x591ecc[_0xc202('0x2f')]=qs['filters'](_[_0xc202('0x30')](_0x2419c5[_0xc202('0x16')],_0x16ec7c[_0xc202('0x18')]),_0x3f322d);if(_0x2419c5[_0xc202('0x16')][_0xc202('0x31')]){_0x591ecc[_0xc202('0x2f')]=_['merge'](_0x591ecc[_0xc202('0x2f')],{'$or':_['map'](_0x3f322d,function(_0x3ac7e8){if(_0x3ac7e8['type']!==_0xc202('0x32')){var _0x147272={};_0x147272[_0x3ac7e8[_0xc202('0xe')]]={'$like':'%'+_0x2419c5['query'][_0xc202('0x31')]+'%'};return _0x147272;}})});}_0x591ecc=_[_0xc202('0x33')]({},_0x591ecc,_0x2419c5[_0xc202('0x34')]);var _0x444a8d={'where':_0x591ecc[_0xc202('0x2f')]};return db[_0xc202('0x35')]['count'](_0x444a8d)[_0xc202('0xc')](function(_0x1e57c3){_0x2c5557[_0xc202('0x7')]=_0x1e57c3;if(_0x2419c5['query'][_0xc202('0x36')]){_0x591ecc[_0xc202('0x37')]=[{'all':!![]}];}return db[_0xc202('0x35')][_0xc202('0x38')](_0x591ecc);})['then'](function(_0x57d5a4){_0x2c5557[_0xc202('0x39')]=_0x57d5a4;return _0x2c5557;})['then'](respondWithFilteredResult(_0x9620a0,_0x591ecc))[_0xc202('0x3a')](handleError(_0x9620a0,null));};exports[_0xc202('0x3b')]=function(_0x25fdd8,_0x200c27){var _0x9dbdb={'raw':!![],'where':{'id':_0x25fdd8['params']['id']}},_0x126c62={};_0x126c62[_0xc202('0x17')]=_[_0xc202('0x15')](db[_0xc202('0x35')][_0xc202('0x11')]);_0x126c62[_0xc202('0x16')]=_['keys'](_0x25fdd8[_0xc202('0x16')]);_0x126c62[_0xc202('0x18')]=_[_0xc202('0x29')](_0x126c62[_0xc202('0x17')],_0x126c62[_0xc202('0x16')]);_0x9dbdb['attributes']=_[_0xc202('0x29')](_0x126c62['model'],qs[_0xc202('0x2a')](_0x25fdd8['query'][_0xc202('0x2a')]));_0x9dbdb[_0xc202('0x28')]=_0x9dbdb[_0xc202('0x28')][_0xc202('0x3c')]?_0x9dbdb['attributes']:_0x126c62[_0xc202('0x17')];if(_0x25fdd8[_0xc202('0x16')][_0xc202('0x36')]){_0x9dbdb[_0xc202('0x37')]=[{'all':!![]}];}_0x9dbdb=_[_0xc202('0x33')]({},_0x9dbdb,_0x25fdd8[_0xc202('0x34')]);return db[_0xc202('0x35')][_0xc202('0x3d')](_0x9dbdb)[_0xc202('0xc')](handleEntityNotFound(_0x200c27,null))[_0xc202('0xc')](respondWithResult(_0x200c27,null))[_0xc202('0x3a')](handleError(_0x200c27,null));};exports[_0xc202('0x3e')]=function(_0x157c2e,_0x39607d){return db[_0xc202('0x35')][_0xc202('0x3e')](_0x157c2e[_0xc202('0x3f')],{})[_0xc202('0xc')](respondWithResult(_0x39607d,0xc9))[_0xc202('0x3a')](handleError(_0x39607d,null));};exports[_0xc202('0xb')]=function(_0x484013,_0x39f2c1){if(_0x484013[_0xc202('0x3f')]['id']){delete _0x484013[_0xc202('0x3f')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x484013['params']['id']}})[_0xc202('0xc')](handleEntityNotFound(_0x39f2c1,null))[_0xc202('0xc')](saveUpdates(_0x484013[_0xc202('0x3f')],null))[_0xc202('0xc')](respondWithResult(_0x39f2c1,null))[_0xc202('0x3a')](handleError(_0x39f2c1,null));};exports[_0xc202('0x40')]=function(_0x157d89,_0x466ba4){return db[_0xc202('0x35')][_0xc202('0x40')]()[_0xc202('0xc')](respondWithResult(_0x466ba4,null))[_0xc202('0x3a')](handleError(_0x466ba4,null));};exports[_0xc202('0x41')]=function(_0x5220a2,_0x33e70c){var _0x163023;var _0x57855e=_0x5220a2[_0xc202('0x42')]['id'];return db[_0xc202('0x35')][_0xc202('0x3d')]({'where':{'id':_0x5220a2[_0xc202('0x42')]['id']}})[_0xc202('0xc')](handleEntityNotFound(_0x33e70c,null))['then'](function(_0x2250a6){if(_0x2250a6){return _0x2250a6['destroy']()[_0xc202('0xc')](function(_0x5f1b99){return _0x5f1b99;});}})[_0xc202('0xc')](function(_0x20ffe5){_0x163023=_0x20ffe5;if(_0x20ffe5){if(_0x20ffe5['VoiceQueueId']||_0x20ffe5[_0xc202('0x43')]){return db[_0x20ffe5[_0xc202('0x44')]?'VoiceQueue':'Campaign']['find']({'where':{'id':_0x20ffe5[_0xc202('0x44')]?_0x20ffe5['VoiceQueueId']:_0x20ffe5[_0xc202('0x43')]},'attributes':['id',_0xc202('0xe')],'raw':!![]});}}})[_0xc202('0xc')](function(_0x1f6233){var _0x3858b9={};if(_0x1f6233){_[_0xc202('0x33')](_0x3858b9,_[_0xc202('0x45')](_0x163023[_0xc202('0x46')],[_0xc202('0x47'),_0xc202('0x48'),'id']));_0x3858b9[_0xc202('0x49')]=0x15;_0x3858b9[_0xc202('0x4a')]=_0xc202('0x4b');_0x3858b9['campaign']=_0x1f6233[_0xc202('0xe')];_0x3858b9['membername']=_0x5220a2['user'][_0xc202('0xe')];_0x3858b9[_0xc202('0x4c')]=_0x5220a2[_0xc202('0x4d')]['id'];_0x3858b9['deleted']=!![];_0x3858b9[_0xc202('0x4e')]=moment()['format'](_0xc202('0x4f'));_0x3858b9[_0xc202('0x50')]=_0x163023['phone'];_0x3858b9[_0xc202('0x51')]=_0x163023[_0xc202('0x44')]?'queue':_0xc202('0x52');return db['CmContact'][_0xc202('0x3d')]({'where':{'id':_0x3858b9[_0xc202('0x53')]},'attributes':[_0xc202('0x54'),_0xc202('0x55')]})[_0xc202('0xc')](function(_0x2d475a){if(!_[_0xc202('0x56')](_0x33e70c)&&!_['isNil'](_0x2d475a[_0xc202('0x54')])){_0x3858b9[_0xc202('0x57')]=_0x2d475a['firstName'];if(!_[_0xc202('0x56')](_0x2d475a['lastName'])){_0x3858b9[_0xc202('0x57')]+='\x20'+_0x2d475a['lastName'];}}})[_0xc202('0x58')](function(){return db['CmHopperFinal'][_0xc202('0x3e')](_0x3858b9);});}})['then'](function(_0x5f212b){return db[_0xc202('0x59')][_0xc202('0x41')]({'where':{'CmHopperId':_0x57855e}});})[_0xc202('0xc')](function(){return _0x33e70c[_0xc202('0x4')](0xcc)[_0xc202('0x5a')]();})[_0xc202('0x3a')](handleError(_0x33e70c,null));};exports[_0xc202('0x5b')]=function(_0x2b0865,_0x409845){var _0x135797=[];return db['CmContact'][_0xc202('0x40')]()[_0xc202('0xc')](function(_0x58bc02){_0x135797=_[_0xc202('0x15')](_0x58bc02);return _0x2b0865[_0xc202('0x4d')][_0xc202('0x5c')]({'where':{'type':_0xc202('0x5d'),'dialActive':!![],'dialMethod':_0xc202('0x5e')},'attributes':['id',_0xc202('0x5f'),_0xc202('0x60')],'raw':!![]});})[_0xc202('0xc')](function(_0x502caf){if(_0x502caf&&_0x502caf[_0xc202('0x3c')]){return db[_0xc202('0x61')][_0xc202('0x62')](function(_0x3095d2){var _0x233e0a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xc202('0x4f'))},'VoiceQueueId':{'$in':_[_0xc202('0x63')](_0x502caf,'id')},'$or':[{'UserId':null},{'UserId':_0x2b0865[_0xc202('0x4d')]['id']}]};var _0x5ae21d={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x502caf)[_0xc202('0x31')](['dialPreviewAutoRecallMe',0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x2b0865[_0xc202('0x4d')]['id']}]};var _0xd2d160={'$or':[_0x233e0a,_0x5ae21d]};var _0x189884=[];if(_0x2b0865[_0xc202('0x3f')]['direction']&&_0x2b0865[_0xc202('0x3f')]['direction']===_0xc202('0x64')){if(!_[_0xc202('0x65')](_0x2b0865['body'][_0xc202('0x66')])){_0xd2d160['id']={'$in':_0x2b0865[_0xc202('0x3f')][_0xc202('0x66')]};}_0x189884=[['priority','ASC'],['scheduledAt',_0x502caf[0x0][_0xc202('0x5f')]===_0xc202('0x67')?'DESC':_0xc202('0x67')],db[_0xc202('0x61')]['literal'](_0xc202('0x68')),['id','DESC']];}else{if(!_[_0xc202('0x65')](_0x2b0865[_0xc202('0x3f')][_0xc202('0x66')])){_0xd2d160['id']={'$notIn':_0x2b0865[_0xc202('0x3f')][_0xc202('0x66')]};}_0x189884=[['priority','DESC'],[_0xc202('0x69'),_0x502caf[0x0][_0xc202('0x5f')]],db[_0xc202('0x61')][_0xc202('0x6a')](_0xc202('0x6b')),['id','ASC']];}return db['CmHopper'][_0xc202('0x6c')]({'attributes':['id',_0xc202('0x6d'),_0xc202('0x6e'),_0xc202('0x6f')],'where':_0xd2d160,'order':_0x189884,'transaction':_0x3095d2,'lock':_0x3095d2[_0xc202('0x70')][_0xc202('0x71')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x135797,'include':[{'model':db[_0xc202('0x72')],'as':_0xc202('0x73'),'attributes':['id',_0xc202('0xe')]}]},{'model':db['CmList'],'as':_0xc202('0x74'),'attributes':['id',_0xc202('0xe')]},{'model':db['VoiceQueue'],'as':_0xc202('0x75'),'attributes':['id',_0xc202('0xe'),'dialActive']}]})[_0xc202('0xc')](function(_0x382dea){if(_0x382dea){return _0x382dea[_0xc202('0xb')]({'UserId':_0x2b0865[_0xc202('0x4d')]['id']},{'transaction':_0x3095d2});}});});}})[_0xc202('0xc')](handleEntityNotFound(_0x409845,null))['then'](respondWithResult(_0x409845,null))[_0xc202('0x3a')](handleError(_0x409845,null));};exports['getPreviewRecall']=function(_0x3cfbaa,_0x17ff38,_0x585984){var _0x2d149a=[];var _0x5b8a32=_0x3cfbaa[_0xc202('0x42')]['id'];var _0x411043=_0x3cfbaa[_0xc202('0x4d')]['id'];return db[_0xc202('0x76')]['describe']()[_0xc202('0xc')](function(_0x234770){_0x2d149a=_[_0xc202('0x15')](_0x234770);return db[_0xc202('0x61')][_0xc202('0x62')](function(_0x3ba0c4){const _0x5f2b84={'id':_0x5b8a32};return db[_0xc202('0x35')][_0xc202('0x6c')]({'attributes':['id','scheduledat',_0xc202('0x6f')],'where':_0x5f2b84,'transaction':_0x3ba0c4,'lock':_0x3ba0c4[_0xc202('0x70')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x2d149a,'include':[{'model':db[_0xc202('0x72')],'as':_0xc202('0x73'),'attributes':['id',_0xc202('0xe')]}]},{'model':db['CmList'],'as':_0xc202('0x74'),'attributes':['id',_0xc202('0xe')]},{'model':db[_0xc202('0x77')],'as':_0xc202('0x75'),'attributes':['id',_0xc202('0xe'),'dialActive']}]})[_0xc202('0xc')](function(_0x1bf945){if(_0x1bf945){return _0x1bf945[_0xc202('0xb')]({'UserId':_0x411043},{'transaction':_0x3ba0c4});}});});})[_0xc202('0xc')](handleEntityNotFound(_0x17ff38,null))[_0xc202('0xc')](respondWithResult(_0x17ff38,null))[_0xc202('0x3a')](handleError(_0x17ff38,null));};exports[_0xc202('0x78')]=function(_0x27147e,_0x906dc2){return _0x27147e[_0xc202('0x4d')][_0xc202('0x5c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xc202('0x5e')},'attributes':['id'],'raw':!![]})[_0xc202('0xc')](function(_0x48a098){if(_0x48a098&&_0x48a098[_0xc202('0x3c')]){return db[_0xc202('0x35')][_0xc202('0x7')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xc202('0x79')](_0xc202('0x4f'))},'VoiceQueueId':{'$in':_['map'](_0x48a098,'id')},'$or':[{'UserId':null},{'UserId':_0x27147e[_0xc202('0x4d')]['id']}]}});}return 0x0;})['then'](function(_0x41908c){if(!_[_0xc202('0x56')](_0x41908c)&&_[_0xc202('0x7a')](_0x41908c)){return _0x906dc2[_0xc202('0x4')](0xc8)['json']({'contacts':_0x41908c});}else{logger[_0xc202('0xd')](_0xc202('0x7b'),_0xc202('0x78'),0x194,_0xc202('0x7c'));_0x906dc2[_0xc202('0x7d')](0x194);}})[_0xc202('0x3a')](handleError(_0x906dc2,null));};exports[_0xc202('0x7e')]=function(_0x414557,_0x80109){var _0x1bf8b8=shared[_0xc202('0x7f')];var _0x48521a=[];_['map'](_0x1bf8b8,function(_0x41ef84){_0x48521a[_0xc202('0x80')]({'id':_0x41ef84[_0xc202('0xe')],'name':_0x41ef84[_0xc202('0xe')],'utcOffset':_0x41ef84['utcOffset']});});return _0x80109[_0xc202('0x4')](0xc8)['json']({'tz':_0x48521a});};exports['getTimezone']=function(_0x30f49c,_0x151976){var _0x53e43a=shared['timezones'];var _0x4f6c06={};if(!_[_0xc202('0x56')](_0x53e43a[_0x30f49c[_0xc202('0x3f')]['id']]))_0x4f6c06=_0x53e43a[_0x30f49c['body']['id']];return _0x151976[_0xc202('0x4')](0xc8)[_0xc202('0xa')](_0x4f6c06);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 2b45071..740af13 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 _0x53ec=['moment','bluebird','path','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x53ec,0x192));var _0xc53e=function(_0x39bc06,_0x18d7ff){_0x39bc06=_0x39bc06-0x0;var _0x131143=_0x53ec[_0x39bc06];return _0x131143;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]},{'name':_0xc53e('0xc'),'fields':[_0xc53e('0xc')]},{'name':_0xc53e('0xd'),'fields':[_0xc53e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['util','../../config/logger','api','path','rimraf','./cmHopper.attributes','exports','CmHopper','scheduledat','priority','lodash'];(function(_0x29b38e,_0x4a9741){var _0xb2ea1a=function(_0x4836e9){while(--_0x4836e9){_0x29b38e['push'](_0x29b38e['shift']());}};_0xb2ea1a(++_0x4a9741);}(_0xd8fb,0x99));var _0xbd8f=function(_0x69e5f2,_0x473162){_0x69e5f2=_0x69e5f2-0x0;var _0x588211=_0xd8fb[_0x69e5f2];return _0x588211;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xbd8f('0x9'),'fields':[_0xbd8f('0x9')]},{'name':'phone','fields':['phone']},{'name':_0xbd8f('0xa'),'fields':[_0xbd8f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index da1a8cc..4184f46 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 _0x7522=['map','model','then','info','debug','catch','error','message','ShowCmHopper','find','stringify','CreateCmHopper','create','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CmContact','transaction','order','LOCK','UPDATE','Contact','User','Agent','name','voicePause','length','UserId','push','body','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','all','GetContactRecallMe','describe','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','lodash','util','moment','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include'];(function(_0x7cad4,_0x50a25e){var _0xcbbca0=function(_0x42bcae){while(--_0x42bcae){_0x7cad4['push'](_0x7cad4['shift']());}};_0xcbbca0(++_0x50a25e);}(_0x7522,0xe3));var _0x2752=function(_0x38cb8d,_0x3ecb57){_0x38cb8d=_0x38cb8d-0x0;var _0x51c2c1=_0x7522[_0x38cb8d];return _0x51c2c1;};'use strict';var _=require(_0x2752('0x0'));var util=require(_0x2752('0x1'));var moment=require(_0x2752('0x2'));var BPromise=require('bluebird');var db=require(_0x2752('0x3'))['db'];var logger=require(_0x2752('0x4'))('rpc');exports[_0x2752('0x5')]=function(_0x39f21b){var _0x2c3d9d=this;return new Promise(function(_0x1b3f32,_0x48c2be){return db[_0x2752('0x6')][_0x2752('0x7')]({'raw':_0x39f21b['options']?_0x39f21b[_0x2752('0x8')][_0x2752('0x9')]===undefined?!![]:![]:!![],'where':_0x39f21b[_0x2752('0x8')]?_0x39f21b['options'][_0x2752('0xa')]||null:null,'attributes':_0x39f21b[_0x2752('0x8')]?_0x39f21b[_0x2752('0x8')][_0x2752('0xb')]||null:null,'limit':_0x39f21b['options']?_0x39f21b[_0x2752('0x8')]['limit']||null:null,'include':_0x39f21b[_0x2752('0x8')]?_0x39f21b[_0x2752('0x8')][_0x2752('0xc')]?_[_0x2752('0xd')](_0x39f21b[_0x2752('0x8')][_0x2752('0xc')],function(_0x13dea8){return{'model':db[_0x13dea8[_0x2752('0xe')]],'as':_0x13dea8['as'],'attributes':_0x13dea8['attributes'],'include':_0x13dea8[_0x2752('0xc')]?_[_0x2752('0xd')](_0x13dea8[_0x2752('0xc')],function(_0x4a9604){return{'model':db[_0x4a9604[_0x2752('0xe')]],'as':_0x4a9604['as'],'attributes':_0x4a9604['attributes'],'include':_0x4a9604[_0x2752('0xc')]?_['map'](_0x4a9604[_0x2752('0xc')],function(_0x1f9099){return{'model':db[_0x1f9099['model']],'as':_0x1f9099['as'],'attributes':_0x1f9099['attributes']};}):[]};}):[]};}):[]:[]})[_0x2752('0xf')](function(_0x16551e){logger[_0x2752('0x10')](_0x2752('0x5'),_0x39f21b);logger[_0x2752('0x11')](_0x2752('0x5'),_0x39f21b,JSON['stringify'](_0x16551e));_0x1b3f32(_0x16551e);})[_0x2752('0x12')](function(_0xd9450c){logger[_0x2752('0x13')](_0x2752('0x5'),_0xd9450c[_0x2752('0x14')],_0x39f21b);_0x48c2be(_0x2c3d9d[_0x2752('0x13')](0x1f4,_0xd9450c['message']));});});};exports[_0x2752('0x15')]=function(_0xf858e6){var _0x32265b=this;return new Promise(function(_0x13d7b4,_0x4c786e){return db[_0x2752('0x6')][_0x2752('0x16')]({'raw':_0xf858e6['options']?_0xf858e6['options'][_0x2752('0x9')]===undefined?!![]:![]:!![],'where':_0xf858e6[_0x2752('0x8')]?_0xf858e6[_0x2752('0x8')][_0x2752('0xa')]||null:null,'attributes':_0xf858e6[_0x2752('0x8')]?_0xf858e6[_0x2752('0x8')][_0x2752('0xb')]||null:null,'include':_0xf858e6[_0x2752('0x8')]?_0xf858e6[_0x2752('0x8')][_0x2752('0xc')]?_[_0x2752('0xd')](_0xf858e6[_0x2752('0x8')][_0x2752('0xc')],function(_0x53768f){return{'model':db[_0x53768f['model']],'as':_0x53768f['as'],'attributes':_0x53768f[_0x2752('0xb')],'include':_0x53768f[_0x2752('0xc')]?_[_0x2752('0xd')](_0x53768f[_0x2752('0xc')],function(_0x1dc9bf){return{'model':db[_0x1dc9bf['model']],'as':_0x1dc9bf['as'],'attributes':_0x1dc9bf['attributes'],'include':_0x1dc9bf['include']?_[_0x2752('0xd')](_0x1dc9bf[_0x2752('0xc')],function(_0x3f8066){return{'model':db[_0x3f8066[_0x2752('0xe')]],'as':_0x3f8066['as'],'attributes':_0x3f8066[_0x2752('0xb')]};}):[]};}):[]};}):[]:[]})[_0x2752('0xf')](function(_0x4c2a63){logger['info']('ShowCmHopper',_0xf858e6);logger[_0x2752('0x11')](_0x2752('0x15'),_0xf858e6,JSON[_0x2752('0x17')](_0x4c2a63));_0x13d7b4(_0x4c2a63);})[_0x2752('0x12')](function(_0x4796cd){logger[_0x2752('0x13')](_0x2752('0x15'),_0x4796cd[_0x2752('0x14')],_0xf858e6);_0x4c786e(_0x32265b[_0x2752('0x13')](0x1f4,_0x4796cd[_0x2752('0x14')]));});});};exports[_0x2752('0x18')]=function(_0x46fcb6){var _0x5e2f84=this;return new Promise(function(_0x2fda4b,_0x495fca){return db['CmHopper'][_0x2752('0x19')](_0x46fcb6['body'],{'raw':_0x46fcb6[_0x2752('0x8')]?_0x46fcb6[_0x2752('0x8')][_0x2752('0x9')]===undefined?!![]:![]:!![]})[_0x2752('0xf')](function(_0x4d3cea){logger[_0x2752('0x10')](_0x2752('0x18'),_0x46fcb6);logger[_0x2752('0x11')]('CreateCmHopper',_0x46fcb6,JSON[_0x2752('0x17')](_0x4d3cea));_0x2fda4b(_0x4d3cea);})[_0x2752('0x12')](function(_0x2c7759){logger[_0x2752('0x13')](_0x2752('0x18'),_0x2c7759[_0x2752('0x14')],_0x46fcb6);_0x495fca(_0x5e2f84[_0x2752('0x13')](0x1f4,_0x2c7759[_0x2752('0x14')]));});});};exports[_0x2752('0x1a')]=function(_0xec59b8){var _0x39424b=this;return new Promise(function(_0x141944,_0x33f22e){return db['CmHopper'][_0x2752('0x1b')](_0xec59b8['body'],{'raw':_0xec59b8[_0x2752('0x8')]?_0xec59b8[_0x2752('0x8')][_0x2752('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xec59b8[_0x2752('0x8')]?_0xec59b8[_0x2752('0x8')]['where']||null:null,'attributes':_0xec59b8['options']?_0xec59b8[_0x2752('0x8')][_0x2752('0xb')]||null:null,'limit':_0xec59b8[_0x2752('0x8')]?_0xec59b8[_0x2752('0x8')][_0x2752('0x1c')]||null:null})['then'](function(_0x532bd9){logger['info'](_0x2752('0x1a'),_0xec59b8);logger['info'](_0x2752('0x1d'),JSON[_0x2752('0x17')](_0xec59b8[_0x2752('0x8')][_0x2752('0xa')]),_0xec59b8['body']['active']);logger['debug']('UpdateCmHopper',_0xec59b8,JSON[_0x2752('0x17')](_0x532bd9));_0x141944(_0x532bd9);})[_0x2752('0x12')](function(_0x50adbb){logger[_0x2752('0x13')](_0x2752('0x1a'),_0x50adbb[_0x2752('0x14')],_0xec59b8);_0x33f22e(_0x39424b[_0x2752('0x13')](0x1f4,_0x50adbb[_0x2752('0x14')]));});});};exports['DestroyCmHopper']=function(_0x2151c0){var _0x3e9d05=this;return new Promise(function(_0x4e9552,_0x5a7d36){return db[_0x2752('0x6')]['destroy']({'where':_0x2151c0[_0x2752('0x8')]?_0x2151c0[_0x2752('0x8')][_0x2752('0xa')]||null:null})[_0x2752('0xf')](function(_0x56c8fc){logger[_0x2752('0x10')]('DestroyCmHopper',_0x2151c0);logger['debug']('DestroyCmHopper',_0x2151c0,JSON['stringify'](_0x56c8fc));_0x4e9552(_0x56c8fc);})[_0x2752('0x12')](function(_0x20b16f){logger[_0x2752('0x13')]('DestroyCmHopper',_0x20b16f['message'],_0x2151c0);_0x5a7d36(_0x3e9d05[_0x2752('0x13')](0x1f4,_0x20b16f['message']));});});};exports['GetContactDialer']=function(_0x308981){var _0x481ee8=this;return new Promise(function(_0x386c23,_0x2b3c31){return db[_0x2752('0x1e')]['describe']()[_0x2752('0xf')](function(_0x37eb10){return db['sequelize'][_0x2752('0x1f')](function(_0x185588){return db[_0x2752('0x6')]['findAll']({'where':_0x308981[_0x2752('0x8')]?_0x308981[_0x2752('0x8')][_0x2752('0xa')]||null:null,'attributes':_0x308981[_0x2752('0x8')]?_0x308981[_0x2752('0x8')]['attributes']||null:null,'limit':_0x308981[_0x2752('0x8')]?_0x308981[_0x2752('0x8')]['limit']||null:null,'order':_0x308981[_0x2752('0x8')]?_0x308981[_0x2752('0x8')][_0x2752('0x20')]||null:null,'transaction':_0x185588,'lock':_0x185588[_0x2752('0x21')][_0x2752('0x22')],'include':[{'model':db[_0x2752('0x1e')],'as':_0x2752('0x23'),'attributes':_['keys'](_0x37eb10)},{'model':db[_0x2752('0x24')],'as':_0x2752('0x25'),'attributes':['id',_0x2752('0x26'),_0x2752('0x27')]}]})[_0x2752('0xf')](function(_0x2673ce){var _0x318f11=[];var _0x4a2e6e=[];for(var _0xbb9bae=0x0;_0xbb9bae<_0x2673ce[_0x2752('0x28')];_0xbb9bae+=0x1){var _0x20007d=_0x2673ce[_0xbb9bae][_0x2752('0x29')];if(_0x20007d===null){_0x318f11[_0x2752('0x2a')](_0x2673ce[_0xbb9bae][_0x2752('0x1b')](_0x308981[_0x2752('0x2b')],{'transaction':_0x185588}));}else if(!_0x4a2e6e[_0x2752('0x2c')](_0x20007d)){_0x4a2e6e[_0x2752('0x2a')](_0x20007d);_0x318f11['push'](_0x2673ce[_0xbb9bae]['update'](_0x308981[_0x2752('0x2b')],{'transaction':_0x185588}));}}return BPromise['all'](_0x318f11);});})[_0x2752('0xf')](function(_0x50e9d4){logger[_0x2752('0x10')]('GetContactDialer',_0x308981);if(_0x50e9d4[_0x2752('0x28')]>0x0){logger['info'](_0x2752('0x2d'),_0x50e9d4[0x0]['dataValues']['id'],_0x50e9d4[0x0][_0x2752('0x2e')][_0x2752('0x2f')],_0x50e9d4[0x0][_0x2752('0x2e')]['active']);}logger['debug'](_0x2752('0x30'),_0x308981,JSON['stringify'](_0x50e9d4));_0x386c23(_0x50e9d4);})[_0x2752('0x12')](function(_0x6328a8){logger['error'](_0x2752('0x30'),_0x6328a8[_0x2752('0x14')],_0x308981);_0x2b3c31(_0x481ee8[_0x2752('0x13')](0x1f4,_0x6328a8[_0x2752('0x14')]));});});});};exports[_0x2752('0x31')]=function(_0x390bc6){var _0x468acd=this;return new Promise(function(_0x67cda9,_0x5149dc){return db['sequelize'][_0x2752('0x1f')](function(_0x16045a){return db[_0x2752('0x32')][_0x2752('0x19')](_0x390bc6[_0x2752('0x2b')],{'raw':_0x390bc6['options']?_0x390bc6[_0x2752('0x8')][_0x2752('0x9')]===undefined?!![]:![]:!![],'transaction':_0x16045a})[_0x2752('0xf')](function(){logger[_0x2752('0x10')](_0x2752('0x33'),JSON[_0x2752('0x17')](_0x390bc6['options'][_0x2752('0xa')]),_0x390bc6['options'][_0x2752('0xa')][_0x2752('0x34')]);return db['CmHopper'][_0x2752('0x35')]({'where':_0x390bc6[_0x2752('0x8')]?_0x390bc6[_0x2752('0x8')]['where']||null:null,'transaction':_0x16045a});});})[_0x2752('0xf')](function(_0x621486){logger[_0x2752('0x10')](_0x2752('0x31'),_0x390bc6);logger['debug'](_0x2752('0x31'),_0x390bc6,JSON[_0x2752('0x17')](_0x621486));_0x67cda9(_0x621486);})[_0x2752('0x12')](function(_0x5f2d90){logger[_0x2752('0x13')](_0x2752('0x31'),_0x5f2d90[_0x2752('0x14')],_0x390bc6);_0x5149dc(_0x468acd[_0x2752('0x13')](0x1f4,_0x5f2d90['message']));});});};exports['CountReScheduled']=function(_0x426538){var _0x1bd5c9=this;return new Promise(function(_0xa09015,_0x337a44){return db[_0x2752('0x6')][_0x2752('0x7')]({'raw':_0x426538[_0x2752('0x8')]?_0x426538[_0x2752('0x8')][_0x2752('0x9')]===undefined?!![]:![]:!![],'where':_0x426538[_0x2752('0x8')]?_0x426538[_0x2752('0x8')][_0x2752('0xa')]||null:null,'attributes':[[db[_0x2752('0x36')]['fn'](_0x2752('0x37'),db[_0x2752('0x36')]['fn']('IF',db[_0x2752('0x36')][_0x2752('0x38')](_0x2752('0x39')+util[_0x2752('0x3a')]('\x22%s\x22',moment()[_0x2752('0x3a')](_0x2752('0x3b')))+'\x20,\x201,\x20null'))),_0x2752('0x3c')]]})[_0x2752('0xf')](function(_0x275b6c){logger[_0x2752('0x10')](_0x2752('0x3d'),_0x426538);logger['debug'](_0x2752('0x3d'),_0x426538,JSON['stringify'](_0x275b6c));_0xa09015(_0x275b6c);})[_0x2752('0x12')](function(_0x352872){logger[_0x2752('0x13')]('CountReScheduled',_0x352872[_0x2752('0x14')],_0x426538);_0x337a44(_0x1bd5c9['error'](0x1f4,_0x352872[_0x2752('0x14')]));});});};exports['GetContactRecallMe']=function(_0x222386){var _0xa1d998=this;return new Promise(function(_0x1c985d,_0x20eca8){return db[_0x2752('0x1e')]['describe']()[_0x2752('0xf')](function(){return db[_0x2752('0x36')]['transaction'](function(_0x40a7b6){return db['CmHopper'][_0x2752('0x7')]({'where':_0x222386[_0x2752('0x8')]?_0x222386['options']['where']||null:null,'attributes':_0x222386['options']?_0x222386[_0x2752('0x8')][_0x2752('0xb')]||null:null,'limit':0x1,'order':_0x222386[_0x2752('0x8')]?_0x222386[_0x2752('0x8')][_0x2752('0x20')]||null:null,'group':db[_0x2752('0x6')][_0x2752('0x29')],'transaction':_0x40a7b6,'lock':_0x40a7b6[_0x2752('0x21')][_0x2752('0x22')],'include':_0x222386[_0x2752('0x8')]?_0x222386[_0x2752('0x8')][_0x2752('0xc')]?_[_0x2752('0xd')](_0x222386[_0x2752('0x8')][_0x2752('0xc')],function(_0x1bcd21){return{'model':db[_0x1bcd21['model']],'as':_0x1bcd21['as'],'attributes':_0x1bcd21['attributes'],'include':_0x1bcd21[_0x2752('0xc')]?_[_0x2752('0xd')](_0x1bcd21['include'],function(_0x349ae2){return{'model':db[_0x349ae2['model']],'as':_0x349ae2['as'],'attributes':_0x349ae2['attributes'],'include':_0x349ae2[_0x2752('0xc')]?_['map'](_0x349ae2[_0x2752('0xc')],function(_0x447c20){return{'model':db[_0x447c20[_0x2752('0xe')]],'as':_0x447c20['as'],'attributes':_0x447c20[_0x2752('0xb')]};}):[]};}):[]};}):[]:[]})[_0x2752('0xf')](function(_0x94e44f){var _0x1e3d4d=[];for(var _0x14171a=0x0;_0x14171a<_0x94e44f['length'];_0x14171a+=0x1){_0x1e3d4d[_0x2752('0x2a')](_0x94e44f[_0x14171a][_0x2752('0x1b')](_0x222386[_0x2752('0x2b')],{'transaction':_0x40a7b6}));}return BPromise[_0x2752('0x3e')](_0x1e3d4d);});})[_0x2752('0xf')](function(_0x41c7ca){logger['info'](_0x2752('0x3f'),_0x222386);logger['debug'](_0x2752('0x3f'),_0x222386,JSON[_0x2752('0x17')](_0x41c7ca));_0x1c985d(_0x41c7ca);})[_0x2752('0x12')](function(_0x27d47d){logger['error']('GetContactRecallMe',_0x27d47d[_0x2752('0x14')],_0x222386);_0x20eca8(_0xa1d998['error'](0x1f4,_0x27d47d[_0x2752('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x136397){var _0x46b682=this;return new Promise(function(_0x366075,_0x53733e){db['CmContact'][_0x2752('0x40')]()[_0x2752('0xf')](function(_0x4d0b36){return db[_0x2752('0x6')]['findAll']({'raw':_0x136397['options']?_0x136397[_0x2752('0x8')][_0x2752('0x9')]===undefined?!![]:![]:!![],'where':_0x136397[_0x2752('0x8')]?_0x136397[_0x2752('0x8')][_0x2752('0xa')]||null:null,'attributes':_0x136397[_0x2752('0x8')]?_0x136397[_0x2752('0x8')][_0x2752('0xb')]||null:null,'limit':_0x136397[_0x2752('0x8')]?_0x136397['options'][_0x2752('0x1c')]||null:null,'include':_0x136397[_0x2752('0x8')]?_0x136397[_0x2752('0x8')][_0x2752('0xc')]?_[_0x2752('0xd')](_0x136397[_0x2752('0x8')][_0x2752('0xc')],function(_0x347b0e){return{'model':db[_0x347b0e['model']],'as':_0x347b0e['as'],'attributes':_0x347b0e['as']===_0x2752('0x23')?_['keys'](_0x4d0b36):_0x347b0e[_0x2752('0xb')],'include':_0x347b0e[_0x2752('0xc')]?_[_0x2752('0xd')](_0x347b0e[_0x2752('0xc')],function(_0x5406f9){return{'model':db[_0x5406f9['model']],'as':_0x5406f9['as'],'attributes':_0x5406f9['attributes'],'include':_0x5406f9[_0x2752('0xc')]?_[_0x2752('0xd')](_0x5406f9['include'],function(_0xa6bde7){return{'model':db[_0xa6bde7['model']],'as':_0xa6bde7['as'],'attributes':_0xa6bde7[_0x2752('0xb')]};}):[]};}):[]};}):[]:[]})[_0x2752('0xf')](function(_0xd92bf5){logger[_0x2752('0x10')]('GetCmHopper',_0x136397);logger[_0x2752('0x11')]('GetCmHopper',_0x136397,JSON['stringify'](_0xd92bf5));_0x366075(_0xd92bf5);})[_0x2752('0x12')](function(_0x2c1eb1){logger[_0x2752('0x13')](_0x2752('0x5'),_0x2c1eb1[_0x2752('0x14')],_0x136397);_0x53733e(_0x46b682['error'](0x1f4,_0x2c1eb1[_0x2752('0x14')]));});});});};exports[_0x2752('0x41')]=function(_0x2ae949){var _0x310c88=this;return new Promise(function(_0x29bd05,_0xf378a){return db[_0x2752('0x1e')][_0x2752('0x42')]({'raw':!![],'where':{'phone':_0x2ae949[_0x2752('0x8')]['where'][_0x2752('0x43')]},'attributes':['id',_0x2752('0x44')],'order':[['id','DESC']]})[_0x2752('0xf')](function(_0x290653){logger[_0x2752('0x10')](_0x2752('0x45'),_0x2ae949);logger['debug']('getContactByPhone',_0x2ae949,JSON['stringify'](_0x290653));_0x29bd05(_0x290653);})[_0x2752('0x12')](function(_0x555ca8){logger[_0x2752('0x13')](_0x2752('0x45'),_0x555ca8[_0x2752('0x14')],_0x2ae949);_0xf378a(_0x310c88[_0x2752('0x13')](0x1f4,_0x555ca8[_0x2752('0x14')]));});});};exports[_0x2752('0x46')]=function(_0x4376c0){var _0x4664d2=this;return new Promise(function(_0x344f3e,_0x4efd3c){return db[_0x2752('0x36')]['transaction'](function(_0x1f521c){var _0x3d997b=_0x4376c0[_0x2752('0x8')]&&_0x4376c0['options'][_0x2752('0xa')]?_0x4376c0[_0x2752('0x8')]['where']:{};return db[_0x2752('0x6')][_0x2752('0x1b')](_0x4376c0[_0x2752('0x2b')],{'where':_0x3d997b,'transaction':_0x1f521c})['then'](function(_0x4d2d25){logger['info'](_0x2752('0x46'),_0x4376c0);logger[_0x2752('0x11')](_0x2752('0x46'),_0x4376c0,JSON[_0x2752('0x17')](_0x4d2d25));_0x344f3e(_0x4d2d25);})['catch'](function(_0x13e260){logger[_0x2752('0x13')](_0x2752('0x46'),_0x13e260[_0x2752('0x14')],_0x4376c0);_0x4efd3c(_0x4664d2[_0x2752('0x13')](0x1f4,_0x13e260[_0x2752('0x14')]));});});});};exports[_0x2752('0x47')]=function(_0xfc3f8c){var _0x2cbe95=this;var _0xe5b8be=_0xfc3f8c[_0x2752('0x2b')][_0x2752('0xa')][_0x2752('0x48')];var _0x47af2b=_0xfc3f8c[_0x2752('0x2b')]['where'][_0x2752('0x49')];var _0x1dc218=_0xfc3f8c[_0x2752('0x2b')][_0x2752('0xa')][_0x2752('0x4a')];return new Promise(function(_0x2ba592,_0x4faf31){return db['CmHopper'][_0x2752('0x7')]({'where':{'voiceQueueId':{'$in':_0xe5b8be},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x2752('0x36')][_0x2752('0x38')](_0x2752('0x4b')+_0x47af2b+_0x2752('0x4c')),'$gt':db[_0x2752('0x36')][_0x2752('0x38')](_0x2752('0x4d'))}},'UserId':{'$in':_0x1dc218}},'include':[{'model':db['CmContact'],'as':_0x2752('0x23')},{'model':db['User'],'as':_0x2752('0x25'),'attributes':['id',_0x2752('0x26'),_0x2752('0x27')]},{'model':db[_0x2752('0x4e')],'as':_0x2752('0x4f')}]})[_0x2752('0xf')](function(_0x19a359){if(_0x19a359[_0x2752('0x28')]>0x0){return db[_0x2752('0x36')][_0x2752('0x1f')](function(_0x151ba2){return db[_0x2752('0x6')][_0x2752('0x1b')]({'recallmeNotifiedDate':db[_0x2752('0x36')]['literal'](_0x2752('0x4d'))},{'where':{'id':{'$in':_[_0x2752('0xd')](_0x19a359,'id')}},'transaction':_0x151ba2})[_0x2752('0xf')](function(){_0x2ba592(_0x19a359);})[_0x2752('0x12')](function(_0x496edb){logger[_0x2752('0x13')](_0x2752('0x47'),_0x496edb[_0x2752('0x14')],_0xfc3f8c);_0x4faf31(_0x2cbe95[_0x2752('0x13')](0x1f4,_0x496edb['message']));});})[_0x2752('0x12')](function(_0x17404e){logger[_0x2752('0x13')](_0x2752('0x47'),_0x17404e[_0x2752('0x14')],_0xfc3f8c);_0x4faf31(_0x2cbe95[_0x2752('0x13')](0x1f4,_0x17404e[_0x2752('0x14')]));});}else{_0x2ba592(_0x19a359);}});});}; \ No newline at end of file +var _0x47db=['DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','UserId','push','includes','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CountReScheduled','`scheduledat`\x20>=\x20','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','literal','NOW()','voicePause','lodash','util','moment','../../mysqldb','../../config/logger','rpc','GetCmHopper','findAll','options','raw','where','limit','map','include','model','attributes','then','info','debug','stringify','catch','error','message','ShowCmHopper','CmHopper','find','CreateCmHopper','body','update','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x47db,0xbd));var _0xb47d=function(_0x120357,_0x274f42){_0x120357=_0x120357-0x0;var _0x4d44df=_0x47db[_0x120357];return _0x4d44df;};'use strict';var _=require(_0xb47d('0x0'));var util=require(_0xb47d('0x1'));var moment=require(_0xb47d('0x2'));var BPromise=require('bluebird');var db=require(_0xb47d('0x3'))['db'];var logger=require(_0xb47d('0x4'))(_0xb47d('0x5'));exports[_0xb47d('0x6')]=function(_0x24b6e8){var _0x585116=this;return new Promise(function(_0x2b31be,_0x3d0e70){return db['CmHopper'][_0xb47d('0x7')]({'raw':_0x24b6e8[_0xb47d('0x8')]?_0x24b6e8[_0xb47d('0x8')][_0xb47d('0x9')]===undefined?!![]:![]:!![],'where':_0x24b6e8['options']?_0x24b6e8[_0xb47d('0x8')][_0xb47d('0xa')]||null:null,'attributes':_0x24b6e8[_0xb47d('0x8')]?_0x24b6e8['options']['attributes']||null:null,'limit':_0x24b6e8[_0xb47d('0x8')]?_0x24b6e8[_0xb47d('0x8')][_0xb47d('0xb')]||null:null,'include':_0x24b6e8[_0xb47d('0x8')]?_0x24b6e8[_0xb47d('0x8')]['include']?_[_0xb47d('0xc')](_0x24b6e8['options'][_0xb47d('0xd')],function(_0x4599ac){return{'model':db[_0x4599ac[_0xb47d('0xe')]],'as':_0x4599ac['as'],'attributes':_0x4599ac['attributes'],'include':_0x4599ac[_0xb47d('0xd')]?_[_0xb47d('0xc')](_0x4599ac[_0xb47d('0xd')],function(_0x3bdab6){return{'model':db[_0x3bdab6['model']],'as':_0x3bdab6['as'],'attributes':_0x3bdab6[_0xb47d('0xf')],'include':_0x3bdab6['include']?_[_0xb47d('0xc')](_0x3bdab6[_0xb47d('0xd')],function(_0x29d805){return{'model':db[_0x29d805['model']],'as':_0x29d805['as'],'attributes':_0x29d805[_0xb47d('0xf')]};}):[]};}):[]};}):[]:[]})[_0xb47d('0x10')](function(_0x2e7ff6){logger[_0xb47d('0x11')](_0xb47d('0x6'),_0x24b6e8);logger[_0xb47d('0x12')]('GetCmHopper',_0x24b6e8,JSON[_0xb47d('0x13')](_0x2e7ff6));_0x2b31be(_0x2e7ff6);})[_0xb47d('0x14')](function(_0x5d9b2f){logger[_0xb47d('0x15')](_0xb47d('0x6'),_0x5d9b2f[_0xb47d('0x16')],_0x24b6e8);_0x3d0e70(_0x585116[_0xb47d('0x15')](0x1f4,_0x5d9b2f['message']));});});};exports[_0xb47d('0x17')]=function(_0x5ad03e){var _0x435d70=this;return new Promise(function(_0x3aa6e7,_0x6cfd81){return db[_0xb47d('0x18')][_0xb47d('0x19')]({'raw':_0x5ad03e[_0xb47d('0x8')]?_0x5ad03e[_0xb47d('0x8')][_0xb47d('0x9')]===undefined?!![]:![]:!![],'where':_0x5ad03e['options']?_0x5ad03e[_0xb47d('0x8')][_0xb47d('0xa')]||null:null,'attributes':_0x5ad03e['options']?_0x5ad03e[_0xb47d('0x8')][_0xb47d('0xf')]||null:null,'include':_0x5ad03e['options']?_0x5ad03e[_0xb47d('0x8')][_0xb47d('0xd')]?_[_0xb47d('0xc')](_0x5ad03e['options'][_0xb47d('0xd')],function(_0x27308d){return{'model':db[_0x27308d[_0xb47d('0xe')]],'as':_0x27308d['as'],'attributes':_0x27308d[_0xb47d('0xf')],'include':_0x27308d[_0xb47d('0xd')]?_[_0xb47d('0xc')](_0x27308d[_0xb47d('0xd')],function(_0x293368){return{'model':db[_0x293368[_0xb47d('0xe')]],'as':_0x293368['as'],'attributes':_0x293368['attributes'],'include':_0x293368[_0xb47d('0xd')]?_[_0xb47d('0xc')](_0x293368[_0xb47d('0xd')],function(_0x38b4d6){return{'model':db[_0x38b4d6['model']],'as':_0x38b4d6['as'],'attributes':_0x38b4d6[_0xb47d('0xf')]};}):[]};}):[]};}):[]:[]})[_0xb47d('0x10')](function(_0x43db83){logger[_0xb47d('0x11')]('ShowCmHopper',_0x5ad03e);logger[_0xb47d('0x12')](_0xb47d('0x17'),_0x5ad03e,JSON[_0xb47d('0x13')](_0x43db83));_0x3aa6e7(_0x43db83);})[_0xb47d('0x14')](function(_0xa893c6){logger['error'](_0xb47d('0x17'),_0xa893c6['message'],_0x5ad03e);_0x6cfd81(_0x435d70[_0xb47d('0x15')](0x1f4,_0xa893c6[_0xb47d('0x16')]));});});};exports[_0xb47d('0x1a')]=function(_0x1afb9c){var _0x35ad39=this;return new Promise(function(_0x2edd96,_0x3bb16f){return db[_0xb47d('0x18')]['create'](_0x1afb9c[_0xb47d('0x1b')],{'raw':_0x1afb9c[_0xb47d('0x8')]?_0x1afb9c[_0xb47d('0x8')][_0xb47d('0x9')]===undefined?!![]:![]:!![]})[_0xb47d('0x10')](function(_0x236ae7){logger[_0xb47d('0x11')](_0xb47d('0x1a'),_0x1afb9c);logger[_0xb47d('0x12')]('CreateCmHopper',_0x1afb9c,JSON['stringify'](_0x236ae7));_0x2edd96(_0x236ae7);})['catch'](function(_0x567bfd){logger[_0xb47d('0x15')](_0xb47d('0x1a'),_0x567bfd[_0xb47d('0x16')],_0x1afb9c);_0x3bb16f(_0x35ad39[_0xb47d('0x15')](0x1f4,_0x567bfd['message']));});});};exports['UpdateCmHopper']=function(_0x1fdc7d){var _0x4d0663=this;return new Promise(function(_0x16000b,_0x27f50e){return db[_0xb47d('0x18')][_0xb47d('0x1c')](_0x1fdc7d[_0xb47d('0x1b')],{'raw':_0x1fdc7d['options']?_0x1fdc7d[_0xb47d('0x8')][_0xb47d('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fdc7d['options']?_0x1fdc7d[_0xb47d('0x8')][_0xb47d('0xa')]||null:null,'attributes':_0x1fdc7d[_0xb47d('0x8')]?_0x1fdc7d[_0xb47d('0x8')][_0xb47d('0xf')]||null:null,'limit':_0x1fdc7d[_0xb47d('0x8')]?_0x1fdc7d[_0xb47d('0x8')][_0xb47d('0xb')]||null:null})['then'](function(_0x6fac1){logger['info'](_0xb47d('0x1d'),_0x1fdc7d);logger[_0xb47d('0x11')](_0xb47d('0x1e'),JSON[_0xb47d('0x13')](_0x1fdc7d[_0xb47d('0x8')][_0xb47d('0xa')]),_0x1fdc7d[_0xb47d('0x1b')][_0xb47d('0x1f')]);logger['debug'](_0xb47d('0x1d'),_0x1fdc7d,JSON[_0xb47d('0x13')](_0x6fac1));_0x16000b(_0x6fac1);})[_0xb47d('0x14')](function(_0x4d9d3c){logger['error'](_0xb47d('0x1d'),_0x4d9d3c[_0xb47d('0x16')],_0x1fdc7d);_0x27f50e(_0x4d0663['error'](0x1f4,_0x4d9d3c[_0xb47d('0x16')]));});});};exports['DestroyCmHopper']=function(_0x51818b){var _0x4727aa=this;return new Promise(function(_0x2d0807,_0x2d4fad){return db['CmHopper'][_0xb47d('0x20')]({'where':_0x51818b[_0xb47d('0x8')]?_0x51818b[_0xb47d('0x8')]['where']||null:null})[_0xb47d('0x10')](function(_0x43dc30){logger[_0xb47d('0x11')](_0xb47d('0x21'),_0x51818b);logger[_0xb47d('0x12')](_0xb47d('0x21'),_0x51818b,JSON[_0xb47d('0x13')](_0x43dc30));_0x2d0807(_0x43dc30);})['catch'](function(_0x4ee9fc){logger['error'](_0xb47d('0x21'),_0x4ee9fc[_0xb47d('0x16')],_0x51818b);_0x2d4fad(_0x4727aa[_0xb47d('0x15')](0x1f4,_0x4ee9fc[_0xb47d('0x16')]));});});};exports[_0xb47d('0x22')]=function(_0x33a2b4){var _0x52de4b=this;return new Promise(function(_0x3af2bc,_0x17ea18){return db[_0xb47d('0x23')][_0xb47d('0x24')]()[_0xb47d('0x10')](function(_0x2fa620){return db[_0xb47d('0x25')][_0xb47d('0x26')](function(_0x4f6ccc){return db['CmHopper'][_0xb47d('0x7')]({'where':_0x33a2b4['options']?_0x33a2b4[_0xb47d('0x8')]['where']||null:null,'attributes':_0x33a2b4[_0xb47d('0x8')]?_0x33a2b4[_0xb47d('0x8')]['attributes']||null:null,'limit':_0x33a2b4[_0xb47d('0x8')]?_0x33a2b4[_0xb47d('0x8')][_0xb47d('0xb')]||null:null,'order':_0x33a2b4[_0xb47d('0x8')]?_0x33a2b4[_0xb47d('0x8')][_0xb47d('0x27')]||null:null,'transaction':_0x4f6ccc,'lock':_0x4f6ccc[_0xb47d('0x28')][_0xb47d('0x29')],'include':[{'model':db[_0xb47d('0x23')],'as':_0xb47d('0x2a'),'attributes':_[_0xb47d('0x2b')](_0x2fa620)},{'model':db[_0xb47d('0x2c')],'as':_0xb47d('0x2d'),'attributes':['id',_0xb47d('0x2e'),'voicePause']}]})[_0xb47d('0x10')](function(_0x16ec0d){var _0x156e8c=[];var _0xee19af=[];for(var _0x1caf55=0x0;_0x1caf55<_0x16ec0d['length'];_0x1caf55+=0x1){var _0x8da50d=_0x16ec0d[_0x1caf55][_0xb47d('0x2f')];if(_0x8da50d===null){_0x156e8c[_0xb47d('0x30')](_0x16ec0d[_0x1caf55]['update'](_0x33a2b4['body'],{'transaction':_0x4f6ccc}));}else if(!_0xee19af[_0xb47d('0x31')](_0x8da50d)){_0xee19af['push'](_0x8da50d);_0x156e8c[_0xb47d('0x30')](_0x16ec0d[_0x1caf55]['update'](_0x33a2b4['body'],{'transaction':_0x4f6ccc}));}}return BPromise['all'](_0x156e8c);});})['then'](function(_0x4f1107){logger[_0xb47d('0x11')](_0xb47d('0x22'),_0x33a2b4);if(_0x4f1107[_0xb47d('0x32')]>0x0){logger[_0xb47d('0x11')](_0xb47d('0x33'),_0x4f1107[0x0][_0xb47d('0x34')]['id'],_0x4f1107[0x0][_0xb47d('0x34')][_0xb47d('0x35')],_0x4f1107[0x0]['dataValues']['active']);}logger[_0xb47d('0x12')](_0xb47d('0x22'),_0x33a2b4,JSON[_0xb47d('0x13')](_0x4f1107));_0x3af2bc(_0x4f1107);})['catch'](function(_0x39bd63){logger['error'](_0xb47d('0x22'),_0x39bd63[_0xb47d('0x16')],_0x33a2b4);_0x17ea18(_0x52de4b[_0xb47d('0x15')](0x1f4,_0x39bd63[_0xb47d('0x16')]));});});});};exports[_0xb47d('0x36')]=function(_0xde52ab){var _0x9f02f7=this;return new Promise(function(_0x506987,_0x45c615){return db[_0xb47d('0x25')]['transaction'](function(_0x6d026b){return db['CmHopperFinal']['create'](_0xde52ab['body'],{'raw':_0xde52ab[_0xb47d('0x8')]?_0xde52ab[_0xb47d('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x6d026b})[_0xb47d('0x10')](function(){logger[_0xb47d('0x11')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xb47d('0x13')](_0xde52ab['options'][_0xb47d('0xa')]),_0xde52ab['options'][_0xb47d('0xa')]['active']);return db['CmHopper'][_0xb47d('0x20')]({'where':_0xde52ab['options']?_0xde52ab[_0xb47d('0x8')][_0xb47d('0xa')]||null:null,'transaction':_0x6d026b});});})[_0xb47d('0x10')](function(_0x2bb4b8){logger[_0xb47d('0x11')](_0xb47d('0x36'),_0xde52ab);logger['debug']('MoveContactManagedDialer',_0xde52ab,JSON['stringify'](_0x2bb4b8));_0x506987(_0x2bb4b8);})[_0xb47d('0x14')](function(_0x1cab67){logger['error']('MoveContactManagedDialer',_0x1cab67[_0xb47d('0x16')],_0xde52ab);_0x45c615(_0x9f02f7['error'](0x1f4,_0x1cab67['message']));});});};exports[_0xb47d('0x37')]=function(_0x399ba3){var _0x45adca=this;return new Promise(function(_0x878aef,_0x2271de){return db[_0xb47d('0x18')][_0xb47d('0x7')]({'raw':_0x399ba3[_0xb47d('0x8')]?_0x399ba3[_0xb47d('0x8')][_0xb47d('0x9')]===undefined?!![]:![]:!![],'where':_0x399ba3['options']?_0x399ba3['options'][_0xb47d('0xa')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xb47d('0x25')]['fn']('IF',db[_0xb47d('0x25')]['literal'](_0xb47d('0x38')+util['format'](_0xb47d('0x39'),moment()['format'](_0xb47d('0x3a')))+_0xb47d('0x3b')))),_0xb47d('0x3c')]]})[_0xb47d('0x10')](function(_0x4bd8b5){logger[_0xb47d('0x11')](_0xb47d('0x37'),_0x399ba3);logger['debug']('CountReScheduled',_0x399ba3,JSON[_0xb47d('0x13')](_0x4bd8b5));_0x878aef(_0x4bd8b5);})['catch'](function(_0x11476e){logger[_0xb47d('0x15')](_0xb47d('0x37'),_0x11476e['message'],_0x399ba3);_0x2271de(_0x45adca[_0xb47d('0x15')](0x1f4,_0x11476e['message']));});});};exports['GetContactRecallMe']=function(_0x576988){var _0x5dc44a=this;return new Promise(function(_0x4ce375,_0x309e4a){return db[_0xb47d('0x23')]['describe']()[_0xb47d('0x10')](function(){return db['sequelize'][_0xb47d('0x26')](function(_0x3858e8){return db[_0xb47d('0x18')][_0xb47d('0x7')]({'where':_0x576988[_0xb47d('0x8')]?_0x576988[_0xb47d('0x8')][_0xb47d('0xa')]||null:null,'attributes':_0x576988[_0xb47d('0x8')]?_0x576988[_0xb47d('0x8')][_0xb47d('0xf')]||null:null,'limit':0x1,'order':_0x576988['options']?_0x576988['options'][_0xb47d('0x27')]||null:null,'group':db[_0xb47d('0x18')][_0xb47d('0x2f')],'transaction':_0x3858e8,'lock':_0x3858e8[_0xb47d('0x28')][_0xb47d('0x29')],'include':_0x576988[_0xb47d('0x8')]?_0x576988[_0xb47d('0x8')][_0xb47d('0xd')]?_[_0xb47d('0xc')](_0x576988['options'][_0xb47d('0xd')],function(_0x5b52b0){return{'model':db[_0x5b52b0[_0xb47d('0xe')]],'as':_0x5b52b0['as'],'attributes':_0x5b52b0[_0xb47d('0xf')],'include':_0x5b52b0['include']?_['map'](_0x5b52b0[_0xb47d('0xd')],function(_0x58ca0f){return{'model':db[_0x58ca0f[_0xb47d('0xe')]],'as':_0x58ca0f['as'],'attributes':_0x58ca0f[_0xb47d('0xf')],'include':_0x58ca0f['include']?_['map'](_0x58ca0f[_0xb47d('0xd')],function(_0x113055){return{'model':db[_0x113055[_0xb47d('0xe')]],'as':_0x113055['as'],'attributes':_0x113055[_0xb47d('0xf')]};}):[]};}):[]};}):[]:[]})[_0xb47d('0x10')](function(_0x294dde){var _0x3d215a=[];for(var _0x29e55e=0x0;_0x29e55e<_0x294dde['length'];_0x29e55e+=0x1){_0x3d215a['push'](_0x294dde[_0x29e55e][_0xb47d('0x1c')](_0x576988[_0xb47d('0x1b')],{'transaction':_0x3858e8}));}return BPromise['all'](_0x3d215a);});})['then'](function(_0x19f879){logger[_0xb47d('0x11')](_0xb47d('0x3d'),_0x576988);logger[_0xb47d('0x12')](_0xb47d('0x3d'),_0x576988,JSON[_0xb47d('0x13')](_0x19f879));_0x4ce375(_0x19f879);})[_0xb47d('0x14')](function(_0x157f8b){logger[_0xb47d('0x15')](_0xb47d('0x3d'),_0x157f8b[_0xb47d('0x16')],_0x576988);_0x309e4a(_0x5dc44a[_0xb47d('0x15')](0x1f4,_0x157f8b['message']));});});});};exports[_0xb47d('0x3e')]=function(_0x229fe5){var _0x463005=this;return new Promise(function(_0x84d1b9,_0x9e343f){db['CmContact'][_0xb47d('0x24')]()[_0xb47d('0x10')](function(_0x218414){return db['CmHopper'][_0xb47d('0x7')]({'raw':_0x229fe5['options']?_0x229fe5[_0xb47d('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x229fe5['options']?_0x229fe5[_0xb47d('0x8')][_0xb47d('0xa')]||null:null,'attributes':_0x229fe5[_0xb47d('0x8')]?_0x229fe5['options'][_0xb47d('0xf')]||null:null,'limit':_0x229fe5[_0xb47d('0x8')]?_0x229fe5[_0xb47d('0x8')]['limit']||null:null,'include':_0x229fe5['options']?_0x229fe5[_0xb47d('0x8')][_0xb47d('0xd')]?_[_0xb47d('0xc')](_0x229fe5['options'][_0xb47d('0xd')],function(_0x4d2518){return{'model':db[_0x4d2518['model']],'as':_0x4d2518['as'],'attributes':_0x4d2518['as']===_0xb47d('0x2a')?_[_0xb47d('0x2b')](_0x218414):_0x4d2518['attributes'],'include':_0x4d2518[_0xb47d('0xd')]?_[_0xb47d('0xc')](_0x4d2518[_0xb47d('0xd')],function(_0x4c9336){return{'model':db[_0x4c9336[_0xb47d('0xe')]],'as':_0x4c9336['as'],'attributes':_0x4c9336['attributes'],'include':_0x4c9336[_0xb47d('0xd')]?_[_0xb47d('0xc')](_0x4c9336[_0xb47d('0xd')],function(_0x25ba66){return{'model':db[_0x25ba66[_0xb47d('0xe')]],'as':_0x25ba66['as'],'attributes':_0x25ba66[_0xb47d('0xf')]};}):[]};}):[]};}):[]:[]})[_0xb47d('0x10')](function(_0x134509){logger[_0xb47d('0x11')]('GetCmHopper',_0x229fe5);logger[_0xb47d('0x12')](_0xb47d('0x6'),_0x229fe5,JSON[_0xb47d('0x13')](_0x134509));_0x84d1b9(_0x134509);})[_0xb47d('0x14')](function(_0x168b3a){logger[_0xb47d('0x15')]('GetCmHopper',_0x168b3a['message'],_0x229fe5);_0x9e343f(_0x463005[_0xb47d('0x15')](0x1f4,_0x168b3a['message']));});});});};exports[_0xb47d('0x3f')]=function(_0x386e70){var _0x3481e9=this;return new Promise(function(_0x24fe9e,_0x1d132d){return db[_0xb47d('0x23')][_0xb47d('0x40')]({'raw':!![],'where':{'phone':_0x386e70[_0xb47d('0x8')][_0xb47d('0xa')][_0xb47d('0x41')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0xb47d('0x10')](function(_0x25add3){logger[_0xb47d('0x11')](_0xb47d('0x42'),_0x386e70);logger[_0xb47d('0x12')](_0xb47d('0x42'),_0x386e70,JSON[_0xb47d('0x13')](_0x25add3));_0x24fe9e(_0x25add3);})[_0xb47d('0x14')](function(_0x30878a){logger[_0xb47d('0x15')](_0xb47d('0x42'),_0x30878a[_0xb47d('0x16')],_0x386e70);_0x1d132d(_0x3481e9[_0xb47d('0x15')](0x1f4,_0x30878a[_0xb47d('0x16')]));});});};exports[_0xb47d('0x43')]=function(_0xbbfbba){var _0x10fb7b=this;return new Promise(function(_0x1f33f1,_0x2cb987){return db['sequelize'][_0xb47d('0x26')](function(_0x299dd2){var _0xcaa37d=_0xbbfbba['options']&&_0xbbfbba[_0xb47d('0x8')][_0xb47d('0xa')]?_0xbbfbba['options'][_0xb47d('0xa')]:{};return db['CmHopper'][_0xb47d('0x1c')](_0xbbfbba[_0xb47d('0x1b')],{'where':_0xcaa37d,'transaction':_0x299dd2})[_0xb47d('0x10')](function(_0x7058d6){logger[_0xb47d('0x11')](_0xb47d('0x43'),_0xbbfbba);logger[_0xb47d('0x12')](_0xb47d('0x43'),_0xbbfbba,JSON['stringify'](_0x7058d6));_0x1f33f1(_0x7058d6);})[_0xb47d('0x14')](function(_0x13954d){logger['error']('ResetActiveCalls',_0x13954d[_0xb47d('0x16')],_0xbbfbba);_0x2cb987(_0x10fb7b[_0xb47d('0x15')](0x1f4,_0x13954d[_0xb47d('0x16')]));});});});};exports[_0xb47d('0x44')]=function(_0x3ef6d0){var _0x5af698=this;var _0x490de1=_0x3ef6d0['body']['where'][_0xb47d('0x45')];var _0x364f59=_0x3ef6d0[_0xb47d('0x1b')]['where'][_0xb47d('0x46')];var _0x27d846=_0x3ef6d0[_0xb47d('0x1b')][_0xb47d('0xa')]['availableAgentsIds'];return new Promise(function(_0x4044c4,_0x2c05ac){return db['CmHopper'][_0xb47d('0x7')]({'where':{'voiceQueueId':{'$in':_0x490de1},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xb47d('0x47')]('NOW()\x20+\x20INTERVAL\x20'+_0x364f59+'\x20MINUTE'),'$gt':db[_0xb47d('0x25')][_0xb47d('0x47')](_0xb47d('0x48'))}},'UserId':{'$in':_0x27d846}},'include':[{'model':db[_0xb47d('0x23')],'as':'Contact'},{'model':db[_0xb47d('0x2c')],'as':'Agent','attributes':['id',_0xb47d('0x2e'),_0xb47d('0x49')]},{'model':db['CmList'],'as':'List'}]})['then'](function(_0x904280){if(_0x904280[_0xb47d('0x32')]>0x0){return db['sequelize'][_0xb47d('0x26')](function(_0x3e1129){return db[_0xb47d('0x18')][_0xb47d('0x1c')]({'recallmeNotifiedDate':db['sequelize'][_0xb47d('0x47')]('NOW()')},{'where':{'id':{'$in':_[_0xb47d('0xc')](_0x904280,'id')}},'transaction':_0x3e1129})['then'](function(){_0x4044c4(_0x904280);})[_0xb47d('0x14')](function(_0x4d11f8){logger[_0xb47d('0x15')](_0xb47d('0x44'),_0x4d11f8['message'],_0x3ef6d0);_0x2c05ac(_0x5af698['error'](0x1f4,_0x4d11f8[_0xb47d('0x16')]));});})[_0xb47d('0x14')](function(_0x33dacb){logger[_0xb47d('0x15')](_0xb47d('0x44'),_0x33dacb[_0xb47d('0x16')],_0x3ef6d0);_0x2c05ac(_0x5af698[_0xb47d('0x15')](0x1f4,_0x33dacb[_0xb47d('0x16')]));});}else{_0x4044c4(_0x904280);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index caf2764..4816285 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 _0x1495=['getPreviewRecall','post','create','/preview','getPreview','put','/:id','delete','exports','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','/:id/previewrecall'];(function(_0x4ff5f9,_0x47a3c2){var _0x5c08fd=function(_0x438938){while(--_0x438938){_0x4ff5f9['push'](_0x4ff5f9['shift']());}};_0x5c08fd(++_0x47a3c2);}(_0x1495,0x68));var _0x5149=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1495[_0x2dafbe];return _0x58a45a;};'use strict';var express=require('express');var router=express[_0x5149('0x0')]();var auth=require(_0x5149('0x1'));var controller=require(_0x5149('0x2'));router[_0x5149('0x3')]('/',auth[_0x5149('0x4')](),controller[_0x5149('0x5')]);router[_0x5149('0x3')](_0x5149('0x6'),auth[_0x5149('0x4')](),controller['describe']);router[_0x5149('0x3')](_0x5149('0x7'),auth[_0x5149('0x4')](),controller[_0x5149('0x8')]);router['get']('/timezones',auth['isAuthenticated'](),controller['getTimezones']);router[_0x5149('0x3')]('/:id',auth[_0x5149('0x4')](),controller['show']);router[_0x5149('0x3')](_0x5149('0x9'),auth[_0x5149('0x4')](),controller[_0x5149('0xa')]);router[_0x5149('0xb')]('/',auth[_0x5149('0x4')](),controller[_0x5149('0xc')]);router[_0x5149('0xb')](_0x5149('0xd'),auth[_0x5149('0x4')](),controller[_0x5149('0xe')]);router[_0x5149('0xb')]('/timezone',auth[_0x5149('0x4')](),controller['getTimezone']);router[_0x5149('0xf')](_0x5149('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x5149('0x11')]('/:id',auth[_0x5149('0x4')](),controller['destroy']);module[_0x5149('0x12')]=router; \ No newline at end of file +var _0x5d74=['exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','/timezone','getTimezone','put','update','delete','destroy'];(function(_0x3d2404,_0xe6c343){var _0x38b798=function(_0x5d6206){while(--_0x5d6206){_0x3d2404['push'](_0x3d2404['shift']());}};_0x38b798(++_0xe6c343);}(_0x5d74,0xd0));var _0x45d7=function(_0x5ef45e,_0x3a3bde){_0x5ef45e=_0x5ef45e-0x0;var _0xa9cc6d=_0x5d74[_0x5ef45e];return _0xa9cc6d;};'use strict';var express=require(_0x45d7('0x0'));var router=express[_0x45d7('0x1')]();var auth=require(_0x45d7('0x2'));var controller=require(_0x45d7('0x3'));router[_0x45d7('0x4')]('/',auth[_0x45d7('0x5')](),controller['index']);router[_0x45d7('0x4')]('/describe',auth[_0x45d7('0x5')](),controller['describe']);router[_0x45d7('0x4')](_0x45d7('0x6'),auth['isAuthenticated'](),controller[_0x45d7('0x7')]);router[_0x45d7('0x4')](_0x45d7('0x8'),auth['isAuthenticated'](),controller[_0x45d7('0x9')]);router[_0x45d7('0x4')](_0x45d7('0xa'),auth[_0x45d7('0x5')](),controller['show']);router[_0x45d7('0x4')](_0x45d7('0xb'),auth['isAuthenticated'](),controller[_0x45d7('0xc')]);router[_0x45d7('0xd')]('/',auth[_0x45d7('0x5')](),controller['create']);router[_0x45d7('0xd')](_0x45d7('0xe'),auth[_0x45d7('0x5')](),controller[_0x45d7('0xf')]);router['post'](_0x45d7('0x10'),auth['isAuthenticated'](),controller[_0x45d7('0x11')]);router[_0x45d7('0x12')](_0x45d7('0xa'),auth[_0x45d7('0x5')](),controller[_0x45d7('0x13')]);router[_0x45d7('0x14')](_0x45d7('0xa'),auth[_0x45d7('0x5')](),controller[_0x45d7('0x15')]);module[_0x45d7('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index d0b6ad1..887508e 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 _0x9ae3=['moment','exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x9ae3,0x103));var _0x39ae=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9ae3[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0x39ae('0x0'));var Sequelize=require('sequelize');module[_0x39ae('0x1')]={'CmHopperId':{'type':Sequelize[_0x39ae('0x2')]},'phone':{'type':Sequelize[_0x39ae('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x39ae('0x4')],'defaultValue':moment()[_0x39ae('0x5')](_0x39ae('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xae83=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING','DATE','format'];(function(_0x23aa23,_0x3708ea){var _0x3c34be=function(_0x5ce4c9){while(--_0x5ce4c9){_0x23aa23['push'](_0x23aa23['shift']());}};_0x3c34be(++_0x3708ea);}(_0xae83,0x89));var _0x3ae8=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xae83[_0x4b055c];return _0x4b62bb;};'use strict';var moment=require(_0x3ae8('0x0'));var Sequelize=require(_0x3ae8('0x1'));module[_0x3ae8('0x2')]={'CmHopperId':{'type':Sequelize[_0x3ae8('0x3')]},'phone':{'type':Sequelize[_0x3ae8('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x3ae8('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x3ae8('0x5')],'defaultValue':moment()[_0x3ae8('0x6')](_0x3ae8('0x7'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3ae8('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3ae8('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x3ae8('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3ae8('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3ae8('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3ae8('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 af20a77..b2fd191 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 _0x5930=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','end','status','undefined','limit','count','offset','Content-Range','json','save','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','sendStatus','error','stack','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperAdditionalPhone','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0x5930,0x92));var _0x0593=function(_0x3bc18b,_0x5269a3){_0x3bc18b=_0x3bc18b-0x0;var _0x36deb1=_0x5930[_0x3bc18b];return _0x36deb1;};'use strict';var emlformat=require(_0x0593('0x0'));var rimraf=require(_0x0593('0x1'));var zipdir=require(_0x0593('0x2'));var jsonpatch=require(_0x0593('0x3'));var rp=require(_0x0593('0x4'));var moment=require(_0x0593('0x5'));var BPromise=require(_0x0593('0x6'));var Mustache=require('mustache');var util=require(_0x0593('0x7'));var path=require(_0x0593('0x8'));var sox=require(_0x0593('0x9'));var csv=require(_0x0593('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0593('0xb'));var _=require(_0x0593('0xc'));var squel=require(_0x0593('0xd'));var crypto=require(_0x0593('0xe'));var jsforce=require(_0x0593('0xf'));var deskjs=require(_0x0593('0x10'));var toCsv=require(_0x0593('0xa'));var querystring=require(_0x0593('0x11'));var Papa=require(_0x0593('0x12'));var Redis=require(_0x0593('0x13'));var authService=require(_0x0593('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x0593('0x15'));var hardwareService=require(_0x0593('0x16'));var logger=require(_0x0593('0x17'))(_0x0593('0x18'));var utils=require('../../config/utils');var config=require(_0x0593('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11c117,_0x588814){_0x588814=_0x588814||0xcc;return function(_0x43d006){if(_0x43d006){return _0x11c117['sendStatus'](_0x588814);}return _0x11c117['status'](_0x588814)[_0x0593('0x1a')]();};}function respondWithResult(_0x1486c,_0x33b26f){_0x33b26f=_0x33b26f||0xc8;return function(_0x447c48){if(_0x447c48){return _0x1486c[_0x0593('0x1b')](_0x33b26f)['json'](_0x447c48);}};}function respondWithFilteredResult(_0x1e4a8a,_0x405878){return function(_0x4e8fd7){if(_0x4e8fd7){var _0x3047dd=typeof _0x405878['offset']===_0x0593('0x1c')&&typeof _0x405878[_0x0593('0x1d')]===_0x0593('0x1c');var _0x22a945=_0x4e8fd7[_0x0593('0x1e')];var _0x31ec12=_0x3047dd?0x0:_0x405878['offset'];var _0x282747=_0x3047dd?_0x4e8fd7['count']:_0x405878[_0x0593('0x1f')]+_0x405878['limit'];var _0x2928de;if(_0x282747>=_0x22a945){_0x282747=_0x22a945;_0x2928de=0xc8;}else{_0x2928de=0xce;}_0x1e4a8a['status'](_0x2928de);return _0x1e4a8a['set'](_0x0593('0x20'),_0x31ec12+'-'+_0x282747+'/'+_0x22a945)[_0x0593('0x21')](_0x4e8fd7);}return null;};}function patchUpdates(_0xbed827){return function(_0x401ecb){try{jsonpatch['apply'](_0x401ecb,_0xbed827,!![]);}catch(_0x15d612){return BPromise['reject'](_0x15d612);}return _0x401ecb[_0x0593('0x22')]();};}function saveUpdates(_0x15aa0c,_0x58977a){return function(_0x2bf6ad){if(_0x2bf6ad){return _0x2bf6ad[_0x0593('0x23')](_0x15aa0c)[_0x0593('0x24')](function(_0x586311){return _0x586311;});}return null;};}function removeEntity(_0x334ebe,_0x21b916){return function(_0x7f1426){if(_0x7f1426){return _0x7f1426['destroy']()[_0x0593('0x24')](function(){var _0x3d2200=_0x7f1426[_0x0593('0x25')]({'plain':!![]});var _0x19aa04=_0x0593('0x26');return db[_0x0593('0x27')][_0x0593('0x28')]({'where':{'type':_0x19aa04,'resourceId':_0x3d2200['id']}})['then'](function(){return _0x7f1426;});})[_0x0593('0x24')](function(){_0x334ebe['status'](0xcc)[_0x0593('0x1a')]();});}};}function handleEntityNotFound(_0x50fe10,_0x3980c2){return function(_0x11e0ae){if(!_0x11e0ae){_0x50fe10[_0x0593('0x29')](0x194);}return _0x11e0ae;};}function handleError(_0x5db63f,_0x9f2acd){_0x9f2acd=_0x9f2acd||0x1f4;return function(_0x400af9){logger[_0x0593('0x2a')](_0x400af9[_0x0593('0x2b')]);if(_0x400af9['name']){delete _0x400af9['name'];}_0x5db63f[_0x0593('0x1b')](_0x9f2acd)['send'](_0x400af9);};}exports['index']=function(_0x208e6d,_0x56ed75){var _0x11bf8b={},_0x3ab0ad={},_0x28efc9={'count':0x0,'rows':[]};var _0x17a6b9=_[_0x0593('0x2c')](db['CmHopperAdditionalPhone'][_0x0593('0x2d')],function(_0x37097f){return{'name':_0x37097f[_0x0593('0x2e')],'type':_0x37097f[_0x0593('0x2f')][_0x0593('0x30')]};});_0x3ab0ad[_0x0593('0x31')]=_['map'](_0x17a6b9,_0x0593('0x32'));_0x3ab0ad['query']=_[_0x0593('0x33')](_0x208e6d[_0x0593('0x34')]);_0x3ab0ad[_0x0593('0x35')]=_[_0x0593('0x36')](_0x3ab0ad[_0x0593('0x31')],_0x3ab0ad[_0x0593('0x34')]);_0x11bf8b['attributes']=_['intersection'](_0x3ab0ad[_0x0593('0x31')],qs[_0x0593('0x37')](_0x208e6d[_0x0593('0x34')]['fields']));_0x11bf8b[_0x0593('0x38')]=_0x11bf8b['attributes'][_0x0593('0x39')]?_0x11bf8b['attributes']:_0x3ab0ad[_0x0593('0x31')];if(!_0x208e6d[_0x0593('0x34')][_0x0593('0x3a')](_0x0593('0x3b'))){_0x11bf8b['limit']=qs[_0x0593('0x1d')](_0x208e6d[_0x0593('0x34')]['limit']);_0x11bf8b[_0x0593('0x1f')]=qs[_0x0593('0x1f')](_0x208e6d[_0x0593('0x34')][_0x0593('0x1f')]);}_0x11bf8b[_0x0593('0x3c')]=qs['sort'](_0x208e6d[_0x0593('0x34')][_0x0593('0x3d')]);_0x11bf8b[_0x0593('0x3e')]=qs[_0x0593('0x35')](_[_0x0593('0x3f')](_0x208e6d[_0x0593('0x34')],_0x3ab0ad[_0x0593('0x35')]),_0x17a6b9);if(_0x208e6d[_0x0593('0x34')][_0x0593('0x40')]){_0x11bf8b[_0x0593('0x3e')]=_[_0x0593('0x41')](_0x11bf8b['where'],{'$or':_[_0x0593('0x2c')](_0x17a6b9,function(_0x9af8f0){if(_0x9af8f0[_0x0593('0x2f')]!==_0x0593('0x42')){var _0x36d659={};_0x36d659[_0x9af8f0['name']]={'$like':'%'+_0x208e6d[_0x0593('0x34')][_0x0593('0x40')]+'%'};return _0x36d659;}})});}_0x11bf8b=_[_0x0593('0x41')]({},_0x11bf8b,_0x208e6d[_0x0593('0x43')]);var _0x4f3a31={'where':_0x11bf8b[_0x0593('0x3e')]};return db[_0x0593('0x44')][_0x0593('0x1e')](_0x4f3a31)[_0x0593('0x24')](function(_0x3c5979){_0x28efc9[_0x0593('0x1e')]=_0x3c5979;if(_0x208e6d[_0x0593('0x34')][_0x0593('0x45')]){_0x11bf8b[_0x0593('0x46')]=[{'all':!![]}];}return db[_0x0593('0x44')][_0x0593('0x47')](_0x11bf8b);})['then'](function(_0xbde80a){_0x28efc9[_0x0593('0x48')]=_0xbde80a;return _0x28efc9;})[_0x0593('0x24')](respondWithFilteredResult(_0x56ed75,_0x11bf8b))[_0x0593('0x49')](handleError(_0x56ed75,null));};exports['show']=function(_0x3a19e6,_0x3b86f7){var _0x5af5b0={'raw':!![],'where':{'id':_0x3a19e6[_0x0593('0x4a')]['id']}},_0x562701={};_0x562701[_0x0593('0x31')]=_[_0x0593('0x33')](db[_0x0593('0x44')]['rawAttributes']);_0x562701[_0x0593('0x34')]=_[_0x0593('0x33')](_0x3a19e6[_0x0593('0x34')]);_0x562701[_0x0593('0x35')]=_[_0x0593('0x36')](_0x562701['model'],_0x562701[_0x0593('0x34')]);_0x5af5b0['attributes']=_[_0x0593('0x36')](_0x562701['model'],qs['fields'](_0x3a19e6[_0x0593('0x34')][_0x0593('0x37')]));_0x5af5b0[_0x0593('0x38')]=_0x5af5b0[_0x0593('0x38')][_0x0593('0x39')]?_0x5af5b0[_0x0593('0x38')]:_0x562701[_0x0593('0x31')];if(_0x3a19e6['query'][_0x0593('0x45')]){_0x5af5b0['include']=[{'all':!![]}];}_0x5af5b0=_[_0x0593('0x41')]({},_0x5af5b0,_0x3a19e6[_0x0593('0x43')]);return db['CmHopperAdditionalPhone'][_0x0593('0x4b')](_0x5af5b0)[_0x0593('0x24')](handleEntityNotFound(_0x3b86f7,null))[_0x0593('0x24')](respondWithResult(_0x3b86f7,null))[_0x0593('0x49')](handleError(_0x3b86f7,null));};exports[_0x0593('0x4c')]=function(_0x37d609,_0xa8ad2b){return db['CmHopperAdditionalPhone'][_0x0593('0x4c')](_0x37d609[_0x0593('0x4d')],{})[_0x0593('0x24')](function(_0x4f84a6){var _0x5b853e=_0x37d609[_0x0593('0x4e')][_0x0593('0x25')]({'plain':!![]});if(!_0x5b853e)throw new Error(_0x0593('0x4f'));if(_0x5b853e['role']===_0x0593('0x4e')){var _0x21782d=_0x4f84a6[_0x0593('0x25')]({'plain':!![]});var _0x34135e=_0x0593('0x26');return db['UserProfileSection'][_0x0593('0x4b')]({'where':{'name':_0x34135e,'userProfileId':_0x5b853e[_0x0593('0x50')]},'raw':!![]})[_0x0593('0x24')](function(_0x2af907){if(_0x2af907&&_0x2af907['autoAssociation']===0x0){return db['UserProfileResource'][_0x0593('0x4c')]({'name':_0x21782d[_0x0593('0x32')],'resourceId':_0x21782d['id'],'type':_0x2af907['name'],'sectionId':_0x2af907['id']},{})[_0x0593('0x24')](function(){return _0x4f84a6;});}else{return _0x4f84a6;}})[_0x0593('0x49')](function(_0x111d92){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x111d92);throw _0x111d92;});}return _0x4f84a6;})[_0x0593('0x24')](respondWithResult(_0xa8ad2b,0xc9))[_0x0593('0x49')](handleError(_0xa8ad2b,null));};exports['update']=function(_0x34a2f3,_0x11ec08){if(_0x34a2f3['body']['id']){delete _0x34a2f3[_0x0593('0x4d')]['id'];}return db[_0x0593('0x44')][_0x0593('0x4b')]({'where':{'id':_0x34a2f3[_0x0593('0x4a')]['id']}})[_0x0593('0x24')](handleEntityNotFound(_0x11ec08,null))['then'](saveUpdates(_0x34a2f3[_0x0593('0x4d')],null))[_0x0593('0x24')](respondWithResult(_0x11ec08,null))[_0x0593('0x49')](handleError(_0x11ec08,null));};exports['destroy']=function(_0x1d4c37,_0x379d09){return db[_0x0593('0x44')]['find']({'where':{'id':_0x1d4c37['params']['id']}})['then'](handleEntityNotFound(_0x379d09,null))[_0x0593('0x24')](removeEntity(_0x379d09,null))[_0x0593('0x49')](handleError(_0x379d09,null));}; \ No newline at end of file +var _0x2382=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','error','name','send','map','CmHopperAdditionalPhone','rawAttributes','type','key','model','keys','filters','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','intersection','includeAll','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmHopperAdditionalPhones','UserProfileSection','find','autoAssociation'];(function(_0x58be50,_0x1ad346){var _0x25259d=function(_0xf1c665){while(--_0xf1c665){_0x58be50['push'](_0x58be50['shift']());}};_0x25259d(++_0x1ad346);}(_0x2382,0xa2));var _0x2238=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x2382[_0x3718b7];return _0xf8c91e;};'use strict';var emlformat=require(_0x2238('0x0'));var rimraf=require(_0x2238('0x1'));var zipdir=require(_0x2238('0x2'));var jsonpatch=require(_0x2238('0x3'));var rp=require(_0x2238('0x4'));var moment=require(_0x2238('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2238('0x6'));var path=require(_0x2238('0x7'));var sox=require(_0x2238('0x8'));var csv=require(_0x2238('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2238('0xa'));var _=require(_0x2238('0xb'));var squel=require('squel');var crypto=require(_0x2238('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2238('0xd'));var toCsv=require(_0x2238('0x9'));var querystring=require(_0x2238('0xe'));var Papa=require('papaparse');var Redis=require(_0x2238('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2238('0x10'));var as=require(_0x2238('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2238('0x12'));var config=require(_0x2238('0x13'));var licenseUtil=require(_0x2238('0x14'));var db=require(_0x2238('0x15'))['db'];function respondWithStatusCode(_0x6124d6,_0x18fea6){_0x18fea6=_0x18fea6||0xcc;return function(_0x2a5544){if(_0x2a5544){return _0x6124d6[_0x2238('0x16')](_0x18fea6);}return _0x6124d6[_0x2238('0x17')](_0x18fea6)[_0x2238('0x18')]();};}function respondWithResult(_0x392c66,_0x216fe2){_0x216fe2=_0x216fe2||0xc8;return function(_0x2282e0){if(_0x2282e0){return _0x392c66[_0x2238('0x17')](_0x216fe2)[_0x2238('0x19')](_0x2282e0);}};}function respondWithFilteredResult(_0x272a91,_0x5a48de){return function(_0x4c104c){if(_0x4c104c){var _0x4fc5ec=typeof _0x5a48de[_0x2238('0x1a')]===_0x2238('0x1b')&&typeof _0x5a48de[_0x2238('0x1c')]===_0x2238('0x1b');var _0x45e138=_0x4c104c[_0x2238('0x1d')];var _0x30e08e=_0x4fc5ec?0x0:_0x5a48de[_0x2238('0x1a')];var _0x45dd84=_0x4fc5ec?_0x4c104c['count']:_0x5a48de[_0x2238('0x1a')]+_0x5a48de['limit'];var _0x4aa93e;if(_0x45dd84>=_0x45e138){_0x45dd84=_0x45e138;_0x4aa93e=0xc8;}else{_0x4aa93e=0xce;}_0x272a91[_0x2238('0x17')](_0x4aa93e);return _0x272a91[_0x2238('0x1e')](_0x2238('0x1f'),_0x30e08e+'-'+_0x45dd84+'/'+_0x45e138)[_0x2238('0x19')](_0x4c104c);}return null;};}function patchUpdates(_0xc5e96a){return function(_0x15160d){try{jsonpatch[_0x2238('0x20')](_0x15160d,_0xc5e96a,!![]);}catch(_0x5448b2){return BPromise[_0x2238('0x21')](_0x5448b2);}return _0x15160d['save']();};}function saveUpdates(_0x482188,_0x530c33){return function(_0x48356e){if(_0x48356e){return _0x48356e[_0x2238('0x22')](_0x482188)[_0x2238('0x23')](function(_0x5021e0){return _0x5021e0;});}return null;};}function removeEntity(_0x4155a2,_0x3728e3){return function(_0x1852a4){if(_0x1852a4){return _0x1852a4[_0x2238('0x24')]()[_0x2238('0x23')](function(){var _0xe8b120=_0x1852a4['get']({'plain':!![]});var _0x5d7874='CmHopperAdditionalPhones';return db[_0x2238('0x25')][_0x2238('0x24')]({'where':{'type':_0x5d7874,'resourceId':_0xe8b120['id']}})['then'](function(){return _0x1852a4;});})[_0x2238('0x23')](function(){_0x4155a2[_0x2238('0x17')](0xcc)[_0x2238('0x18')]();});}};}function handleEntityNotFound(_0xebaf23,_0x238a8){return function(_0x3935bc){if(!_0x3935bc){_0xebaf23[_0x2238('0x16')](0x194);}return _0x3935bc;};}function handleError(_0x2e548a,_0x1f6df7){_0x1f6df7=_0x1f6df7||0x1f4;return function(_0x1357f8){logger[_0x2238('0x26')](_0x1357f8['stack']);if(_0x1357f8[_0x2238('0x27')]){delete _0x1357f8[_0x2238('0x27')];}_0x2e548a[_0x2238('0x17')](_0x1f6df7)[_0x2238('0x28')](_0x1357f8);};}exports['index']=function(_0x547185,_0x432c4d){var _0xad4116={},_0x1a1e91={},_0x416605={'count':0x0,'rows':[]};var _0x3e5421=_[_0x2238('0x29')](db[_0x2238('0x2a')][_0x2238('0x2b')],function(_0xa02d5b){return{'name':_0xa02d5b['fieldName'],'type':_0xa02d5b[_0x2238('0x2c')][_0x2238('0x2d')]};});_0x1a1e91[_0x2238('0x2e')]=_[_0x2238('0x29')](_0x3e5421,'name');_0x1a1e91['query']=_[_0x2238('0x2f')](_0x547185['query']);_0x1a1e91[_0x2238('0x30')]=_['intersection'](_0x1a1e91['model'],_0x1a1e91[_0x2238('0x31')]);_0xad4116[_0x2238('0x32')]=_['intersection'](_0x1a1e91['model'],qs[_0x2238('0x33')](_0x547185['query'][_0x2238('0x33')]));_0xad4116[_0x2238('0x32')]=_0xad4116['attributes'][_0x2238('0x34')]?_0xad4116[_0x2238('0x32')]:_0x1a1e91[_0x2238('0x2e')];if(!_0x547185[_0x2238('0x31')][_0x2238('0x35')]('nolimit')){_0xad4116[_0x2238('0x1c')]=qs[_0x2238('0x1c')](_0x547185[_0x2238('0x31')]['limit']);_0xad4116[_0x2238('0x1a')]=qs['offset'](_0x547185[_0x2238('0x31')][_0x2238('0x1a')]);}_0xad4116[_0x2238('0x36')]=qs[_0x2238('0x37')](_0x547185[_0x2238('0x31')][_0x2238('0x37')]);_0xad4116[_0x2238('0x38')]=qs[_0x2238('0x30')](_[_0x2238('0x39')](_0x547185[_0x2238('0x31')],_0x1a1e91[_0x2238('0x30')]),_0x3e5421);if(_0x547185[_0x2238('0x31')][_0x2238('0x3a')]){_0xad4116[_0x2238('0x38')]=_[_0x2238('0x3b')](_0xad4116[_0x2238('0x38')],{'$or':_[_0x2238('0x29')](_0x3e5421,function(_0x3aa77d){if(_0x3aa77d['type']!==_0x2238('0x3c')){var _0x5f393e={};_0x5f393e[_0x3aa77d['name']]={'$like':'%'+_0x547185[_0x2238('0x31')]['filter']+'%'};return _0x5f393e;}})});}_0xad4116=_[_0x2238('0x3b')]({},_0xad4116,_0x547185[_0x2238('0x3d')]);var _0x14af74={'where':_0xad4116['where']};return db[_0x2238('0x2a')][_0x2238('0x1d')](_0x14af74)[_0x2238('0x23')](function(_0x39657c){_0x416605[_0x2238('0x1d')]=_0x39657c;if(_0x547185['query']['includeAll']){_0xad4116[_0x2238('0x3e')]=[{'all':!![]}];}return db[_0x2238('0x2a')][_0x2238('0x3f')](_0xad4116);})[_0x2238('0x23')](function(_0x219b6e){_0x416605[_0x2238('0x40')]=_0x219b6e;return _0x416605;})['then'](respondWithFilteredResult(_0x432c4d,_0xad4116))['catch'](handleError(_0x432c4d,null));};exports[_0x2238('0x41')]=function(_0x231f84,_0x207a36){var _0x36d28d={'raw':!![],'where':{'id':_0x231f84[_0x2238('0x42')]['id']}},_0x2d1bd2={};_0x2d1bd2[_0x2238('0x2e')]=_[_0x2238('0x2f')](db[_0x2238('0x2a')][_0x2238('0x2b')]);_0x2d1bd2['query']=_[_0x2238('0x2f')](_0x231f84['query']);_0x2d1bd2[_0x2238('0x30')]=_[_0x2238('0x43')](_0x2d1bd2[_0x2238('0x2e')],_0x2d1bd2['query']);_0x36d28d[_0x2238('0x32')]=_[_0x2238('0x43')](_0x2d1bd2[_0x2238('0x2e')],qs[_0x2238('0x33')](_0x231f84[_0x2238('0x31')][_0x2238('0x33')]));_0x36d28d[_0x2238('0x32')]=_0x36d28d[_0x2238('0x32')]['length']?_0x36d28d[_0x2238('0x32')]:_0x2d1bd2['model'];if(_0x231f84[_0x2238('0x31')][_0x2238('0x44')]){_0x36d28d[_0x2238('0x3e')]=[{'all':!![]}];}_0x36d28d=_[_0x2238('0x3b')]({},_0x36d28d,_0x231f84[_0x2238('0x3d')]);return db[_0x2238('0x2a')]['find'](_0x36d28d)[_0x2238('0x23')](handleEntityNotFound(_0x207a36,null))[_0x2238('0x23')](respondWithResult(_0x207a36,null))[_0x2238('0x45')](handleError(_0x207a36,null));};exports[_0x2238('0x46')]=function(_0x5cd622,_0x1276cd){return db[_0x2238('0x2a')]['create'](_0x5cd622['body'],{})['then'](function(_0xe3e4a4){var _0x1039e2=_0x5cd622[_0x2238('0x47')][_0x2238('0x48')]({'plain':!![]});if(!_0x1039e2)throw new Error(_0x2238('0x49'));if(_0x1039e2['role']===_0x2238('0x47')){var _0x24b3ae=_0xe3e4a4[_0x2238('0x48')]({'plain':!![]});var _0x18f00b=_0x2238('0x4a');return db[_0x2238('0x4b')][_0x2238('0x4c')]({'where':{'name':_0x18f00b,'userProfileId':_0x1039e2['userProfileId']},'raw':!![]})[_0x2238('0x23')](function(_0xf574ae){if(_0xf574ae&&_0xf574ae[_0x2238('0x4d')]===0x0){return db[_0x2238('0x25')][_0x2238('0x46')]({'name':_0x24b3ae['name'],'resourceId':_0x24b3ae['id'],'type':_0xf574ae[_0x2238('0x27')],'sectionId':_0xf574ae['id']},{})['then'](function(){return _0xe3e4a4;});}else{return _0xe3e4a4;}})[_0x2238('0x45')](function(_0x5965d6){logger[_0x2238('0x26')](_0x2238('0x4e'),_0x5965d6);throw _0x5965d6;});}return _0xe3e4a4;})[_0x2238('0x23')](respondWithResult(_0x1276cd,0xc9))[_0x2238('0x45')](handleError(_0x1276cd,null));};exports[_0x2238('0x22')]=function(_0x2affd1,_0x43dbba){if(_0x2affd1[_0x2238('0x4f')]['id']){delete _0x2affd1[_0x2238('0x4f')]['id'];}return db['CmHopperAdditionalPhone'][_0x2238('0x4c')]({'where':{'id':_0x2affd1['params']['id']}})[_0x2238('0x23')](handleEntityNotFound(_0x43dbba,null))[_0x2238('0x23')](saveUpdates(_0x2affd1[_0x2238('0x4f')],null))[_0x2238('0x23')](respondWithResult(_0x43dbba,null))[_0x2238('0x45')](handleError(_0x43dbba,null));};exports['destroy']=function(_0x2453e7,_0x133e61){return db[_0x2238('0x2a')]['find']({'where':{'id':_0x2453e7[_0x2238('0x42')]['id']}})[_0x2238('0x23')](handleEntityNotFound(_0x133e61,null))[_0x2238('0x23')](removeEntity(_0x133e61,null))[_0x2238('0x45')](handleError(_0x133e61,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 57b1ab5..717dd85 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 _0x3036=['moment','request-promise','./cmHopperAdditionalPhone.attributes','define','cm_hopper_additional_phones','../../config/logger','api'];(function(_0x42d042,_0x18f536){var _0x45b24d=function(_0x1897c4){while(--_0x1897c4){_0x42d042['push'](_0x42d042['shift']());}};_0x45b24d(++_0x18f536);}(_0x3036,0x1a9));var _0x6303=function(_0x5e8571,_0x3add15){_0x5e8571=_0x5e8571-0x0;var _0x830ce=_0x3036[_0x5e8571];return _0x830ce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6303('0x0'))(_0x6303('0x1'));var moment=require(_0x6303('0x2'));var BPromise=require('bluebird');var rp=require(_0x6303('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6303('0x4'));module['exports']=function(_0x464b99,_0xaa32ef){return _0x464b99[_0x6303('0x5')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x6303('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45f1=['path','rimraf','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','request-promise'];(function(_0x4f2b79,_0x4a133e){var _0xf5098f=function(_0x12ca90){while(--_0x12ca90){_0x4f2b79['push'](_0x4f2b79['shift']());}};_0xf5098f(++_0x4a133e);}(_0x45f1,0x67));var _0x145f=function(_0x3926fd,_0x4e8e80){_0x3926fd=_0x3926fd-0x0;var _0x419e15=_0x45f1[_0x3926fd];return _0x419e15;};'use strict';var _=require(_0x145f('0x0'));var util=require(_0x145f('0x1'));var logger=require(_0x145f('0x2'))(_0x145f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x145f('0x4'));var fs=require('fs');var path=require(_0x145f('0x5'));var rimraf=require(_0x145f('0x6'));var config=require('../../config/environment');var attributes=require(_0x145f('0x7'));module[_0x145f('0x8')]=function(_0x889333,_0x33b69b){return _0x889333[_0x145f('0x9')](_0x145f('0xa'),attributes,{'tableName':_0x145f('0xb'),'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 be7be36..efe62ff 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 _0x52bb=['CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','catch','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','ASC','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x52bb,0xd4));var _0xb52b=function(_0x1a654a,_0x53fa98){_0x1a654a=_0x1a654a-0x0;var _0x2624d0=_0x52bb[_0x1a654a];return _0x2624d0;};'use strict';var _=require(_0xb52b('0x0'));var util=require(_0xb52b('0x1'));var moment=require(_0xb52b('0x2'));var BPromise=require(_0xb52b('0x3'));var rs=require(_0xb52b('0x4'));var fs=require('fs');var Redis=require(_0xb52b('0x5'));var db=require(_0xb52b('0x6'))['db'];var utils=require(_0xb52b('0x7'));var logger=require(_0xb52b('0x8'))(_0xb52b('0x9'));var config=require('../../config/environment');var jayson=require(_0xb52b('0xa'));var client=jayson['client'][_0xb52b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f401a,_0x4e33e5,_0x2d91be){return new BPromise(function(_0x55ce61,_0x35de34){return client['request'](_0x5f401a,_0x2d91be)['then'](function(_0x2dbb4d){logger['info'](_0xb52b('0xc'),_0x4e33e5,_0xb52b('0xd'));logger[_0xb52b('0xe')](_0xb52b('0xf'),_0x4e33e5,'request\x20sent',JSON['stringify'](_0x2dbb4d));if(_0x2dbb4d['error']){if(_0x2dbb4d[_0xb52b('0x10')][_0xb52b('0x11')]===0x1f4){logger['error'](_0xb52b('0xc'),_0x4e33e5,_0x2dbb4d[_0xb52b('0x10')][_0xb52b('0x12')]);return _0x35de34(_0x2dbb4d['error']['message']);}logger['error'](_0xb52b('0xc'),_0x4e33e5,_0x2dbb4d[_0xb52b('0x10')][_0xb52b('0x12')]);return _0x55ce61(_0x2dbb4d[_0xb52b('0x10')][_0xb52b('0x12')]);}else{logger['info'](_0xb52b('0xc'),_0x4e33e5,'request\x20sent');_0x55ce61(_0x2dbb4d['result']['message']);}})[_0xb52b('0x13')](function(_0x8a7434){logger[_0xb52b('0x10')](_0xb52b('0xc'),_0x4e33e5,_0x8a7434);_0x35de34(_0x8a7434);});});}exports['VerifyAdditionalPhones']=function(_0x447815){var _0x149fa9=this;return new Promise(function(_0x3adcca,_0x15d344){return db[_0xb52b('0x14')][_0xb52b('0x15')]({'raw':!![],'where':{'ContactId':_0x447815[_0xb52b('0x16')][_0xb52b('0x17')],'ListId':_0x447815[_0xb52b('0x16')][_0xb52b('0x18')],'VoiceQueueId':_0x447815['body'][_0xb52b('0x19')]===undefined?null:_0x447815[_0xb52b('0x16')][_0xb52b('0x19')],'CampaignId':_0x447815['body'][_0xb52b('0x1a')]===undefined?null:_0x447815[_0xb52b('0x16')][_0xb52b('0x1a')]}})[_0xb52b('0x1b')](function(_0x5b560f){if(_0x5b560f!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x5b560f['id'],'OrderBy':{'$gt':_0x5b560f[_0xb52b('0x1c')]}},'order':[['OrderBy','ASC']]})[_0xb52b('0x1b')](function(_0x1889ed){var _0x5ce9ce=0x0;if(_0x1889ed){if(_0x1889ed[_0xb52b('0x1d')]+_0x1889ed[_0xb52b('0x1e')]+_0x1889ed[_0xb52b('0x1f')]+_0x1889ed[_0xb52b('0x20')]+_0x1889ed[_0xb52b('0x21')]+_0x1889ed[_0xb52b('0x22')]+_0x1889ed[_0xb52b('0x23')]+_0x1889ed[_0xb52b('0x24')]<_0x447815[_0xb52b('0x25')][_0xb52b('0x26')])_0x5ce9ce=0x1;_0x3adcca({'additional':_0x5ce9ce});}else{return db[_0xb52b('0x27')][_0xb52b('0x15')]({'raw':!![],'where':{'CmHopperId':_0x5b560f['id']},'order':[[_0xb52b('0x1c'),_0xb52b('0x28')]]})[_0xb52b('0x1b')](function(_0x48bb7d){var _0x56f191=0x0;if(_0x48bb7d){if(_0x48bb7d['countbusyretry']+_0x48bb7d[_0xb52b('0x1e')]+_0x48bb7d[_0xb52b('0x1f')]+_0x48bb7d[_0xb52b('0x20')]+_0x48bb7d[_0xb52b('0x21')]+_0x48bb7d[_0xb52b('0x22')]+_0x48bb7d[_0xb52b('0x23')]+_0x48bb7d[_0xb52b('0x24')]<_0x447815[_0xb52b('0x25')][_0xb52b('0x26')])_0x56f191=0x1;_0x3adcca({'additional':_0x56f191});}else{_0x3adcca({'additional':0x0});}})[_0xb52b('0x13')](function(_0x34d18b){logger[_0xb52b('0x10')](_0xb52b('0x29'),_0x34d18b[_0xb52b('0x12')]);_0x15d344(_0x149fa9[_0xb52b('0x10')](0x1f4,_0x34d18b[_0xb52b('0x12')]));});}})['catch'](function(_0x188fe3){logger[_0xb52b('0x10')](_0xb52b('0x29'),_0x188fe3[_0xb52b('0x12')]);_0x15d344(_0x149fa9['error'](0x1f4,_0x188fe3[_0xb52b('0x12')]));});}else _0x3adcca({'additional':0x0});});});};exports[_0xb52b('0x2a')]=function(_0x2c59d5){var _0xfb6853=this;return new Promise(function(_0x3403a2,_0x41fbad){return db[_0xb52b('0x14')][_0xb52b('0x15')]({'raw':!![],'where':{'ContactId':_0x2c59d5[_0xb52b('0x16')][_0xb52b('0x17')],'ListId':_0x2c59d5[_0xb52b('0x16')][_0xb52b('0x18')],'VoiceQueueId':_0x2c59d5['body']['VoiceQueueId']===undefined?null:_0x2c59d5[_0xb52b('0x16')]['VoiceQueueId'],'CampaignId':_0x2c59d5['body'][_0xb52b('0x1a')]===undefined?null:_0x2c59d5[_0xb52b('0x16')][_0xb52b('0x1a')]}})['then'](function(_0x159397){if(_0x159397!=null){return db[_0xb52b('0x27')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x159397['id'],'OrderBy':{'$gte':_0x159397[_0xb52b('0x1c')]}},'order':[[_0xb52b('0x1c'),_0xb52b('0x28')]]})[_0xb52b('0x1b')](function(_0x55c2b9){if(_0x55c2b9)return activateAdditionalPhone(_0x159397,_0x2c59d5[_0xb52b('0x16')],_0x55c2b9,_0x2c59d5[_0xb52b('0x2b')],_0x2c59d5[_0xb52b('0x2c')])[_0xb52b('0x1b')](function(_0x102826){_0x3403a2(_0x102826);});else{return db[_0xb52b('0x27')][_0xb52b('0x15')]({'raw':!![],'where':{'CmHopperId':_0x159397['id']},'order':[[_0xb52b('0x1c'),_0xb52b('0x28')]]})[_0xb52b('0x1b')](function(_0x149156){if(_0x149156)return activateAdditionalPhone(_0x159397,_0x2c59d5[_0xb52b('0x16')],_0x149156,_0x2c59d5[_0xb52b('0x2b')],_0x2c59d5[_0xb52b('0x2c')])[_0xb52b('0x1b')](function(_0x5121ea){_0x3403a2(_0x5121ea);});else{_0x3403a2({'id':_0x159397['id'],'phone':''});}})[_0xb52b('0x13')](function(_0x33bb50){logger[_0xb52b('0x10')]('VerifyAdditionalPhones',_0x33bb50['message']);_0x41fbad(_0xfb6853[_0xb52b('0x10')](0x1f4,_0x33bb50[_0xb52b('0x12')]));});}})[_0xb52b('0x13')](function(_0x463c5d){logger[_0xb52b('0x10')](_0xb52b('0x29'),_0x463c5d[_0xb52b('0x12')]);_0x41fbad(_0xfb6853[_0xb52b('0x10')](0x1f4,_0x463c5d[_0xb52b('0x12')]));});}else _0x3403a2(0x1);});});};function activateAdditionalPhone(_0x15eb3d,_0x285d90,_0x23ff63,_0x2fa776,_0x350c59){return new Promise(function(_0x562838,_0x3be562){var _0x31a644;if(_[_0xb52b('0x2d')](_0x23ff63[_0xb52b('0x2e')])){_0x23ff63[_0xb52b('0x2e')]=moment();}if(moment()>moment(_0x23ff63[_0xb52b('0x2e')])){_0x31a644=moment()[_0xb52b('0x2f')](_0x350c59||0x3,_0xb52b('0x30'));}else{if(_0x23ff63[_0xb52b('0x1c')]==0x0){_0x31a644=moment(_0x23ff63[_0xb52b('0x2e')]);}else{_0x31a644=moment()[_0xb52b('0x2f')](_0x350c59||0x3,'minutes');}}if(_[_0xb52b('0x2d')](_0x31a644)){_0x31a644=moment()[_0xb52b('0x2f')](_0x350c59||0x3,_0xb52b('0x30'));}var _0x567466={'phone':_0x15eb3d[_0xb52b('0x31')],'active':0x0,'OrderBy':_[_0xb52b('0x2d')](_0x15eb3d[_0xb52b('0x1c')])?0x0:_0x15eb3d[_0xb52b('0x1c')],'scheduledat':moment()[_0xb52b('0x2f')](_0x2fa776||0x1,'minutes'),'countbusyretry':_0x285d90[_0xb52b('0x1d')],'countcongestionretry':_0x285d90[_0xb52b('0x1e')],'countnoanswerretry':_0x285d90[_0xb52b('0x1f')],'countnosuchnumberretry':_0x285d90['countnosuchnumberretry'],'countdropretry':_0x285d90[_0xb52b('0x21')],'countabandonedretry':_0x285d90[_0xb52b('0x22')],'countmachineretry':_0x285d90['countmachineretry'],'countagentrejectretry':_0x285d90[_0xb52b('0x24')],'createdAt':_0x285d90['createdAt'],'updatedAt':_0x285d90[_0xb52b('0x32')]};var _0x324683={'CmHopperId':_0x15eb3d['id'],'phone':_0x23ff63[_0xb52b('0x31')],'active':0x0,'OrderBy':_[_0xb52b('0x2d')](_0x23ff63[_0xb52b('0x1c')])?0x0:_0x23ff63[_0xb52b('0x1c')],'scheduledat':_0x31a644,'countbusyretry':_0x23ff63[_0xb52b('0x1d')],'countcongestionretry':_0x23ff63[_0xb52b('0x1e')],'countnoanswerretry':_0x23ff63['countnoanswerretry'],'countnosuchnumberretry':_0x23ff63['countnosuchnumberretry'],'countdropretry':_0x23ff63['countdropretry'],'countabandonedretry':_0x23ff63[_0xb52b('0x22')],'countmachineretry':_0x23ff63[_0xb52b('0x23')],'countagentrejectretry':_0x23ff63[_0xb52b('0x24')],'createdAt':_0x23ff63['createdAt'],'updatedAt':_0x23ff63['updatedAt']};return db[_0xb52b('0x33')][_0xb52b('0x34')](function(_0x17d2cc){return db[_0xb52b('0x27')][_0xb52b('0x35')](_0x567466,{'where':{'id':_0x23ff63['id']}},{'transaction':_0x17d2cc})[_0xb52b('0x1b')](function(){return db[_0xb52b('0x14')]['update'](_0x324683,{'where':{'id':_0x15eb3d['id']}},{'transaction':_0x17d2cc});});})[_0xb52b('0x1b')](function(_0x4ffad1){_0x562838({'id':_0x15eb3d['id'],'phone':_0x23ff63[_0xb52b('0x31')]});})[_0xb52b('0x13')](function(_0x2d1d2d){logger['error'](_0xb52b('0x36'),_0x2d1d2d[_0xb52b('0x12')]);_0x3be562({'error':_0x2d1d2d[_0xb52b('0x12')]});});});}exports[_0xb52b('0x37')]=function(_0x56a6c8){var _0x276a36=this;return new Promise(function(_0x4c6e62,_0x13c584){return db[_0xb52b('0x14')][_0xb52b('0x35')](_0x56a6c8[_0xb52b('0x16')]['field'],{'where':{'id':_0x56a6c8['body']['id']}})['then'](function(_0xd79afb){_0x4c6e62(_0xd79afb);})['catch'](function(_0x49ef07){logger[_0xb52b('0x10')](_0xb52b('0x37'),_0x49ef07[_0xb52b('0x12')]);_0x13c584(_0x276a36[_0xb52b('0x10')](0x1f4,_0x49ef07[_0xb52b('0x12')]));});});}; \ No newline at end of file +var _0x2fa4=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','VoiceQueueId','body','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','countnosuchnumberretry','SwapAdditionalPhones','ListId','duration','waitTime','isNil','scheduledat','add','minutes','phone','countbusyretry','createdAt','updatedAt','transaction','update','IncrementPreviewCounters','field','util','moment','bluebird'];(function(_0x4f1117,_0x5f50f9){var _0x267607=function(_0x236a3b){while(--_0x236a3b){_0x4f1117['push'](_0x4f1117['shift']());}};_0x267607(++_0x5f50f9);}(_0x2fa4,0xe1));var _0x42fa=function(_0x10efb6,_0x51b06d){_0x10efb6=_0x10efb6-0x0;var _0x1f646e=_0x2fa4[_0x10efb6];return _0x1f646e;};'use strict';var _=require('lodash');var util=require(_0x42fa('0x0'));var moment=require(_0x42fa('0x1'));var BPromise=require(_0x42fa('0x2'));var rs=require(_0x42fa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x42fa('0x4'));var logger=require(_0x42fa('0x5'))(_0x42fa('0x6'));var config=require(_0x42fa('0x7'));var jayson=require(_0x42fa('0x8'));var client=jayson[_0x42fa('0x9')][_0x42fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x226827,_0x2216d6,_0x404dbf){return new BPromise(function(_0x7413e,_0x7bca57){return client[_0x42fa('0xb')](_0x226827,_0x404dbf)[_0x42fa('0xc')](function(_0x20bc3f){logger['info'](_0x42fa('0xd'),_0x2216d6,_0x42fa('0xe'));logger[_0x42fa('0xf')](_0x42fa('0x10'),_0x2216d6,_0x42fa('0xe'),JSON[_0x42fa('0x11')](_0x20bc3f));if(_0x20bc3f[_0x42fa('0x12')]){if(_0x20bc3f[_0x42fa('0x12')]['code']===0x1f4){logger[_0x42fa('0x12')](_0x42fa('0xd'),_0x2216d6,_0x20bc3f['error'][_0x42fa('0x13')]);return _0x7bca57(_0x20bc3f[_0x42fa('0x12')]['message']);}logger[_0x42fa('0x12')](_0x42fa('0xd'),_0x2216d6,_0x20bc3f[_0x42fa('0x12')][_0x42fa('0x13')]);return _0x7413e(_0x20bc3f[_0x42fa('0x12')][_0x42fa('0x13')]);}else{logger[_0x42fa('0x14')](_0x42fa('0xd'),_0x2216d6,_0x42fa('0xe'));_0x7413e(_0x20bc3f[_0x42fa('0x15')][_0x42fa('0x13')]);}})[_0x42fa('0x16')](function(_0x2bfda6){logger[_0x42fa('0x12')](_0x42fa('0xd'),_0x2216d6,_0x2bfda6);_0x7bca57(_0x2bfda6);});});}exports[_0x42fa('0x17')]=function(_0x3f11ad){var _0x356733=this;return new Promise(function(_0x5e8e24,_0x45923b){return db[_0x42fa('0x18')][_0x42fa('0x19')]({'raw':!![],'where':{'ContactId':_0x3f11ad['body'][_0x42fa('0x1a')],'ListId':_0x3f11ad['body']['ListId'],'VoiceQueueId':_0x3f11ad['body'][_0x42fa('0x1b')]===undefined?null:_0x3f11ad['body']['VoiceQueueId'],'CampaignId':_0x3f11ad[_0x42fa('0x1c')][_0x42fa('0x1d')]===undefined?null:_0x3f11ad['body']['CampaignId']}})[_0x42fa('0xc')](function(_0x458fb2){if(_0x458fb2!=null){return db[_0x42fa('0x1e')][_0x42fa('0x19')]({'raw':!![],'where':{'CmHopperId':_0x458fb2['id'],'OrderBy':{'$gt':_0x458fb2[_0x42fa('0x1f')]}},'order':[['OrderBy',_0x42fa('0x20')]]})['then'](function(_0x1bd5e0){var _0x2b5c52=0x0;if(_0x1bd5e0){if(_0x1bd5e0['countbusyretry']+_0x1bd5e0[_0x42fa('0x21')]+_0x1bd5e0[_0x42fa('0x22')]+_0x1bd5e0['countnosuchnumberretry']+_0x1bd5e0[_0x42fa('0x23')]+_0x1bd5e0[_0x42fa('0x24')]+_0x1bd5e0[_0x42fa('0x25')]+_0x1bd5e0[_0x42fa('0x26')]<_0x3f11ad[_0x42fa('0x27')]['dialGlobalMaxRetry'])_0x2b5c52=0x1;_0x5e8e24({'additional':_0x2b5c52});}else{return db['CmHopperAdditionalPhone'][_0x42fa('0x19')]({'raw':!![],'where':{'CmHopperId':_0x458fb2['id']},'order':[['OrderBy',_0x42fa('0x20')]]})['then'](function(_0x1137a1){var _0x3df447=0x0;if(_0x1137a1){if(_0x1137a1['countbusyretry']+_0x1137a1[_0x42fa('0x21')]+_0x1137a1['countnoanswerretry']+_0x1137a1[_0x42fa('0x28')]+_0x1137a1[_0x42fa('0x23')]+_0x1137a1[_0x42fa('0x24')]+_0x1137a1[_0x42fa('0x25')]+_0x1137a1[_0x42fa('0x26')]<_0x3f11ad['entity']['dialGlobalMaxRetry'])_0x3df447=0x1;_0x5e8e24({'additional':_0x3df447});}else{_0x5e8e24({'additional':0x0});}})[_0x42fa('0x16')](function(_0x28b4c5){logger[_0x42fa('0x12')](_0x42fa('0x17'),_0x28b4c5[_0x42fa('0x13')]);_0x45923b(_0x356733[_0x42fa('0x12')](0x1f4,_0x28b4c5[_0x42fa('0x13')]));});}})[_0x42fa('0x16')](function(_0x1caf76){logger[_0x42fa('0x12')](_0x42fa('0x17'),_0x1caf76[_0x42fa('0x13')]);_0x45923b(_0x356733[_0x42fa('0x12')](0x1f4,_0x1caf76['message']));});}else _0x5e8e24({'additional':0x0});});});};exports[_0x42fa('0x29')]=function(_0x4afb83){var _0x20f0a4=this;return new Promise(function(_0x106210,_0x1df06e){return db['CmHopper'][_0x42fa('0x19')]({'raw':!![],'where':{'ContactId':_0x4afb83[_0x42fa('0x1c')][_0x42fa('0x1a')],'ListId':_0x4afb83[_0x42fa('0x1c')][_0x42fa('0x2a')],'VoiceQueueId':_0x4afb83[_0x42fa('0x1c')][_0x42fa('0x1b')]===undefined?null:_0x4afb83[_0x42fa('0x1c')][_0x42fa('0x1b')],'CampaignId':_0x4afb83['body'][_0x42fa('0x1d')]===undefined?null:_0x4afb83['body']['CampaignId']}})[_0x42fa('0xc')](function(_0x12a6ac){if(_0x12a6ac!=null){return db[_0x42fa('0x1e')][_0x42fa('0x19')]({'raw':!![],'where':{'CmHopperId':_0x12a6ac['id'],'OrderBy':{'$gte':_0x12a6ac[_0x42fa('0x1f')]}},'order':[[_0x42fa('0x1f'),_0x42fa('0x20')]]})[_0x42fa('0xc')](function(_0x458256){if(_0x458256)return activateAdditionalPhone(_0x12a6ac,_0x4afb83[_0x42fa('0x1c')],_0x458256,_0x4afb83[_0x42fa('0x2b')],_0x4afb83['waitTime'])[_0x42fa('0xc')](function(_0x5b3c16){_0x106210(_0x5b3c16);});else{return db[_0x42fa('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x12a6ac['id']},'order':[[_0x42fa('0x1f'),_0x42fa('0x20')]]})[_0x42fa('0xc')](function(_0x5a2636){if(_0x5a2636)return activateAdditionalPhone(_0x12a6ac,_0x4afb83[_0x42fa('0x1c')],_0x5a2636,_0x4afb83[_0x42fa('0x2b')],_0x4afb83[_0x42fa('0x2c')])[_0x42fa('0xc')](function(_0x41ba54){_0x106210(_0x41ba54);});else{_0x106210({'id':_0x12a6ac['id'],'phone':''});}})['catch'](function(_0x3b6c23){logger[_0x42fa('0x12')](_0x42fa('0x17'),_0x3b6c23[_0x42fa('0x13')]);_0x1df06e(_0x20f0a4[_0x42fa('0x12')](0x1f4,_0x3b6c23[_0x42fa('0x13')]));});}})['catch'](function(_0x158236){logger['error'](_0x42fa('0x17'),_0x158236[_0x42fa('0x13')]);_0x1df06e(_0x20f0a4[_0x42fa('0x12')](0x1f4,_0x158236[_0x42fa('0x13')]));});}else _0x106210(0x1);});});};function activateAdditionalPhone(_0x407afb,_0x4e64e3,_0xd7d460,_0x557443,_0x1126e3){return new Promise(function(_0x218bb9,_0x1f3bed){var _0xdc8cfd;if(_[_0x42fa('0x2d')](_0xd7d460[_0x42fa('0x2e')])){_0xd7d460[_0x42fa('0x2e')]=moment();}if(moment()>moment(_0xd7d460['scheduledat'])){_0xdc8cfd=moment()[_0x42fa('0x2f')](_0x1126e3||0x3,_0x42fa('0x30'));}else{if(_0xd7d460[_0x42fa('0x1f')]==0x0){_0xdc8cfd=moment(_0xd7d460['scheduledat']);}else{_0xdc8cfd=moment()[_0x42fa('0x2f')](_0x1126e3||0x3,_0x42fa('0x30'));}}if(_[_0x42fa('0x2d')](_0xdc8cfd)){_0xdc8cfd=moment()[_0x42fa('0x2f')](_0x1126e3||0x3,_0x42fa('0x30'));}var _0xb1fe6a={'phone':_0x407afb[_0x42fa('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x407afb[_0x42fa('0x1f')])?0x0:_0x407afb['OrderBy'],'scheduledat':moment()[_0x42fa('0x2f')](_0x557443||0x1,_0x42fa('0x30')),'countbusyretry':_0x4e64e3[_0x42fa('0x32')],'countcongestionretry':_0x4e64e3[_0x42fa('0x21')],'countnoanswerretry':_0x4e64e3['countnoanswerretry'],'countnosuchnumberretry':_0x4e64e3['countnosuchnumberretry'],'countdropretry':_0x4e64e3[_0x42fa('0x23')],'countabandonedretry':_0x4e64e3[_0x42fa('0x24')],'countmachineretry':_0x4e64e3[_0x42fa('0x25')],'countagentrejectretry':_0x4e64e3[_0x42fa('0x26')],'createdAt':_0x4e64e3[_0x42fa('0x33')],'updatedAt':_0x4e64e3[_0x42fa('0x34')]};var _0x414c87={'CmHopperId':_0x407afb['id'],'phone':_0xd7d460[_0x42fa('0x31')],'active':0x0,'OrderBy':_['isNil'](_0xd7d460[_0x42fa('0x1f')])?0x0:_0xd7d460[_0x42fa('0x1f')],'scheduledat':_0xdc8cfd,'countbusyretry':_0xd7d460[_0x42fa('0x32')],'countcongestionretry':_0xd7d460[_0x42fa('0x21')],'countnoanswerretry':_0xd7d460[_0x42fa('0x22')],'countnosuchnumberretry':_0xd7d460['countnosuchnumberretry'],'countdropretry':_0xd7d460[_0x42fa('0x23')],'countabandonedretry':_0xd7d460[_0x42fa('0x24')],'countmachineretry':_0xd7d460[_0x42fa('0x25')],'countagentrejectretry':_0xd7d460[_0x42fa('0x26')],'createdAt':_0xd7d460[_0x42fa('0x33')],'updatedAt':_0xd7d460['updatedAt']};return db['sequelize'][_0x42fa('0x35')](function(_0x1d6bac){return db[_0x42fa('0x1e')]['update'](_0xb1fe6a,{'where':{'id':_0xd7d460['id']}},{'transaction':_0x1d6bac})[_0x42fa('0xc')](function(){return db[_0x42fa('0x18')][_0x42fa('0x36')](_0x414c87,{'where':{'id':_0x407afb['id']}},{'transaction':_0x1d6bac});});})[_0x42fa('0xc')](function(_0x551ac2){_0x218bb9({'id':_0x407afb['id'],'phone':_0xd7d460[_0x42fa('0x31')]});})[_0x42fa('0x16')](function(_0x239f21){logger[_0x42fa('0x12')]('activateAdditionalPhone',_0x239f21['message']);_0x1f3bed({'error':_0x239f21['message']});});});}exports[_0x42fa('0x37')]=function(_0x2fd549){var _0x4a1331=this;return new Promise(function(_0x1961b8,_0x572ff7){return db[_0x42fa('0x18')]['update'](_0x2fd549[_0x42fa('0x1c')][_0x42fa('0x38')],{'where':{'id':_0x2fd549[_0x42fa('0x1c')]['id']}})['then'](function(_0x2e316c){_0x1961b8(_0x2e316c);})[_0x42fa('0x16')](function(_0x414417){logger[_0x42fa('0x12')](_0x42fa('0x37'),_0x414417[_0x42fa('0x13')]);_0x572ff7(_0x4a1331['error'](0x1f4,_0x414417[_0x42fa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 0c9b917..0cbb3f0 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 _0x3bbd=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./cmHopperAdditionalPhone.controller','isAuthenticated','index','/:id','show','post','create'];(function(_0x39f615,_0xf7942b){var _0x34d59b=function(_0xac3613){while(--_0xac3613){_0x39f615['push'](_0x39f615['shift']());}};_0x34d59b(++_0xf7942b);}(_0x3bbd,0x1b2));var _0xd3bb=function(_0x16a5ba,_0x291f82){_0x16a5ba=_0x16a5ba-0x0;var _0x5eccea=_0x3bbd[_0x16a5ba];return _0x5eccea;};'use strict';var multer=require(_0xd3bb('0x0'));var util=require(_0xd3bb('0x1'));var path=require(_0xd3bb('0x2'));var timeout=require(_0xd3bb('0x3'));var express=require(_0xd3bb('0x4'));var router=express[_0xd3bb('0x5')]();var fs_extra=require(_0xd3bb('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd3bb('0x7'));router['get']('/',auth[_0xd3bb('0x8')](),controller[_0xd3bb('0x9')]);router['get'](_0xd3bb('0xa'),auth[_0xd3bb('0x8')](),controller[_0xd3bb('0xb')]);router[_0xd3bb('0xc')]('/',auth[_0xd3bb('0x8')](),controller[_0xd3bb('0xd')]);router['put']('/:id',auth[_0xd3bb('0x8')](),controller['update']);router[_0xd3bb('0xe')](_0xd3bb('0xa'),auth[_0xd3bb('0x8')](),controller['destroy']);module[_0xd3bb('0xf')]=router; \ No newline at end of file +var _0x5b89=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','index','get','/:id','show','post','create','put','update','isAuthenticated','destroy','exports','multer'];(function(_0x42edf6,_0x51bc9b){var _0x471c60=function(_0x5f4213){while(--_0x5f4213){_0x42edf6['push'](_0x42edf6['shift']());}};_0x471c60(++_0x51bc9b);}(_0x5b89,0x1a3));var _0x95b8=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x5b89[_0x243b59];return _0x3e1676;};'use strict';var multer=require(_0x95b8('0x0'));var util=require(_0x95b8('0x1'));var path=require(_0x95b8('0x2'));var timeout=require(_0x95b8('0x3'));var express=require('express');var router=express[_0x95b8('0x4')]();var fs_extra=require(_0x95b8('0x5'));var auth=require(_0x95b8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x95b8('0x7'));var controller=require(_0x95b8('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x95b8('0x9')]);router[_0x95b8('0xa')](_0x95b8('0xb'),auth['isAuthenticated'](),controller[_0x95b8('0xc')]);router[_0x95b8('0xd')]('/',auth['isAuthenticated'](),controller[_0x95b8('0xe')]);router[_0x95b8('0xf')](_0x95b8('0xb'),auth['isAuthenticated'](),controller[_0x95b8('0x10')]);router['delete'](_0x95b8('0xb'),auth[_0x95b8('0x11')](),controller[_0x95b8('0x12')]);module[_0x95b8('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 872f313..86a669c 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 _0x017e=['moment','exports','INTEGER','contactListQueue'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x017e,0x10c));var _0xe017=function(_0x2c5d4e,_0x6d5975){_0x2c5d4e=_0x2c5d4e-0x0;var _0xe27290=_0x017e[_0x2c5d4e];return _0xe27290;};'use strict';var moment=require(_0xe017('0x0'));var Sequelize=require('sequelize');module[_0xe017('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe017('0x2')],'unique':_0xe017('0x3')},'ListId':{'type':Sequelize[_0xe017('0x2')],'unique':_0xe017('0x3')},'VoiceQueueId':{'type':Sequelize[_0xe017('0x2')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x43d6=['INTEGER','moment','exports','contactListQueue'];(function(_0x909abb,_0x49bef3){var _0x421e71=function(_0x4d445c){while(--_0x4d445c){_0x909abb['push'](_0x909abb['shift']());}};_0x421e71(++_0x49bef3);}(_0x43d6,0xe9));var _0x643d=function(_0x1c0889,_0x2ade71){_0x1c0889=_0x1c0889-0x0;var _0x4f60b4=_0x43d6[_0x1c0889];return _0x4f60b4;};'use strict';var moment=require(_0x643d('0x0'));var Sequelize=require('sequelize');module[_0x643d('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x643d('0x2')},'ListId':{'type':Sequelize[_0x643d('0x3')],'unique':_0x643d('0x2')},'VoiceQueueId':{'type':Sequelize[_0x643d('0x3')],'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 b1e8ee5..939c4ac 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 _0xea41=['fs-extra','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','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','sort','filter','where','VIRTUAL','merge','CmHopperBlack','includeAll','include','rows','catch','show','params','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs'];(function(_0x5a19fc,_0x58f9f4){var _0x34b413=function(_0x344feb){while(--_0x344feb){_0x5a19fc['push'](_0x5a19fc['shift']());}};_0x34b413(++_0x58f9f4);}(_0xea41,0xcd));var _0x1ea4=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xea41[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x1ea4('0x0'));var rimraf=require(_0x1ea4('0x1'));var zipdir=require(_0x1ea4('0x2'));var jsonpatch=require(_0x1ea4('0x3'));var rp=require(_0x1ea4('0x4'));var moment=require(_0x1ea4('0x5'));var BPromise=require(_0x1ea4('0x6'));var Mustache=require('mustache');var util=require(_0x1ea4('0x7'));var path=require(_0x1ea4('0x8'));var sox=require('sox');var csv=require(_0x1ea4('0x9'));var ejs=require(_0x1ea4('0xa'));var fs=require('fs');var fs_extra=require(_0x1ea4('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1ea4('0xc'));var jsforce=require(_0x1ea4('0xd'));var deskjs=require(_0x1ea4('0xe'));var toCsv=require(_0x1ea4('0x9'));var querystring=require(_0x1ea4('0xf'));var Papa=require(_0x1ea4('0x10'));var Redis=require(_0x1ea4('0x11'));var authService=require(_0x1ea4('0x12'));var qs=require(_0x1ea4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ea4('0x14'));var logger=require(_0x1ea4('0x15'))(_0x1ea4('0x16'));var utils=require(_0x1ea4('0x17'));var config=require(_0x1ea4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ea4('0x19'))['db'];function respondWithStatusCode(_0x29ad89,_0x1c0f87){_0x1c0f87=_0x1c0f87||0xcc;return function(_0x2afbec){if(_0x2afbec){return _0x29ad89[_0x1ea4('0x1a')](_0x1c0f87);}return _0x29ad89['status'](_0x1c0f87)[_0x1ea4('0x1b')]();};}function respondWithResult(_0xd24eeb,_0x27f8b9){_0x27f8b9=_0x27f8b9||0xc8;return function(_0x72e65e){if(_0x72e65e){return _0xd24eeb[_0x1ea4('0x1c')](_0x27f8b9)[_0x1ea4('0x1d')](_0x72e65e);}};}function respondWithFilteredResult(_0x34acd1,_0x476e61){return function(_0x17407d){if(_0x17407d){var _0x54d07a=typeof _0x476e61[_0x1ea4('0x1e')]===_0x1ea4('0x1f')&&typeof _0x476e61[_0x1ea4('0x20')]===_0x1ea4('0x1f');var _0x5476cc=_0x17407d[_0x1ea4('0x21')];var _0x16aa82=_0x54d07a?0x0:_0x476e61['offset'];var _0x105a1e=_0x54d07a?_0x17407d['count']:_0x476e61[_0x1ea4('0x1e')]+_0x476e61[_0x1ea4('0x20')];var _0x59641f;if(_0x105a1e>=_0x5476cc){_0x105a1e=_0x5476cc;_0x59641f=0xc8;}else{_0x59641f=0xce;}_0x34acd1['status'](_0x59641f);return _0x34acd1[_0x1ea4('0x22')](_0x1ea4('0x23'),_0x16aa82+'-'+_0x105a1e+'/'+_0x5476cc)[_0x1ea4('0x1d')](_0x17407d);}return null;};}function patchUpdates(_0x1c8b8c){return function(_0x2fe354){try{jsonpatch[_0x1ea4('0x24')](_0x2fe354,_0x1c8b8c,!![]);}catch(_0x137431){return BPromise[_0x1ea4('0x25')](_0x137431);}return _0x2fe354['save']();};}function saveUpdates(_0x5dbc1a,_0x422f43){return function(_0x5dc113){if(_0x5dc113){return _0x5dc113[_0x1ea4('0x26')](_0x5dbc1a)['then'](function(_0x5309f7){return _0x5309f7;});}return null;};}function removeEntity(_0x562126,_0x53bcd0){return function(_0x2c1d5e){if(_0x2c1d5e){return _0x2c1d5e[_0x1ea4('0x27')]()[_0x1ea4('0x28')](function(){_0x562126['status'](0xcc)[_0x1ea4('0x1b')]();});}};}function handleEntityNotFound(_0x25e4ed,_0x71237e){return function(_0x23cf82){if(!_0x23cf82){_0x25e4ed[_0x1ea4('0x1a')](0x194);}return _0x23cf82;};}function handleError(_0xc71e93,_0x159a12){_0x159a12=_0x159a12||0x1f4;return function(_0x4abe43){logger[_0x1ea4('0x29')](_0x4abe43[_0x1ea4('0x2a')]);if(_0x4abe43[_0x1ea4('0x2b')]){delete _0x4abe43['name'];}_0xc71e93[_0x1ea4('0x1c')](_0x159a12)['send'](_0x4abe43);};}exports[_0x1ea4('0x2c')]=function(_0x44fef7,_0x47ac44){var _0x57044e={},_0xaf0c6e={},_0x194851={'count':0x0,'rows':[]};var _0xdd30b3=_[_0x1ea4('0x2d')](db['CmHopperBlack'][_0x1ea4('0x2e')],function(_0x5b4c7b){return{'name':_0x5b4c7b['fieldName'],'type':_0x5b4c7b[_0x1ea4('0x2f')]['key']};});_0xaf0c6e[_0x1ea4('0x30')]=_[_0x1ea4('0x2d')](_0xdd30b3,_0x1ea4('0x2b'));_0xaf0c6e[_0x1ea4('0x31')]=_[_0x1ea4('0x32')](_0x44fef7[_0x1ea4('0x31')]);_0xaf0c6e[_0x1ea4('0x33')]=_[_0x1ea4('0x34')](_0xaf0c6e['model'],_0xaf0c6e[_0x1ea4('0x31')]);_0x57044e[_0x1ea4('0x35')]=_[_0x1ea4('0x34')](_0xaf0c6e[_0x1ea4('0x30')],qs[_0x1ea4('0x36')](_0x44fef7[_0x1ea4('0x31')][_0x1ea4('0x36')]));_0x57044e['attributes']=_0x57044e['attributes'][_0x1ea4('0x37')]?_0x57044e['attributes']:_0xaf0c6e[_0x1ea4('0x30')];if(!_0x44fef7[_0x1ea4('0x31')]['hasOwnProperty']('nolimit')){_0x57044e['limit']=qs[_0x1ea4('0x20')](_0x44fef7[_0x1ea4('0x31')][_0x1ea4('0x20')]);_0x57044e['offset']=qs[_0x1ea4('0x1e')](_0x44fef7['query'][_0x1ea4('0x1e')]);}_0x57044e['order']=qs['sort'](_0x44fef7[_0x1ea4('0x31')][_0x1ea4('0x38')]);_0x57044e['where']=qs[_0x1ea4('0x33')](_['pick'](_0x44fef7['query'],_0xaf0c6e[_0x1ea4('0x33')]),_0xdd30b3);if(_0x44fef7[_0x1ea4('0x31')][_0x1ea4('0x39')]){_0x57044e[_0x1ea4('0x3a')]=_['merge'](_0x57044e['where'],{'$or':_[_0x1ea4('0x2d')](_0xdd30b3,function(_0x40aa91){if(_0x40aa91['type']!==_0x1ea4('0x3b')){var _0x1cf900={};_0x1cf900[_0x40aa91[_0x1ea4('0x2b')]]={'$like':'%'+_0x44fef7[_0x1ea4('0x31')]['filter']+'%'};return _0x1cf900;}})});}_0x57044e=_[_0x1ea4('0x3c')]({},_0x57044e,_0x44fef7['options']);var _0x54986c={'where':_0x57044e[_0x1ea4('0x3a')]};return db[_0x1ea4('0x3d')][_0x1ea4('0x21')](_0x54986c)[_0x1ea4('0x28')](function(_0x1d5f01){_0x194851[_0x1ea4('0x21')]=_0x1d5f01;if(_0x44fef7[_0x1ea4('0x31')][_0x1ea4('0x3e')]){_0x57044e[_0x1ea4('0x3f')]=[{'all':!![]}];}return db[_0x1ea4('0x3d')]['findAll'](_0x57044e);})[_0x1ea4('0x28')](function(_0x3da825){_0x194851[_0x1ea4('0x40')]=_0x3da825;return _0x194851;})[_0x1ea4('0x28')](respondWithFilteredResult(_0x47ac44,_0x57044e))[_0x1ea4('0x41')](handleError(_0x47ac44,null));};exports[_0x1ea4('0x42')]=function(_0x17b63c,_0x57b13b){var _0x2b92ab={'raw':!![],'where':{'id':_0x17b63c[_0x1ea4('0x43')]['id']}},_0x4b4270={};_0x4b4270['model']=_[_0x1ea4('0x32')](db[_0x1ea4('0x3d')][_0x1ea4('0x2e')]);_0x4b4270['query']=_['keys'](_0x17b63c['query']);_0x4b4270[_0x1ea4('0x33')]=_[_0x1ea4('0x34')](_0x4b4270[_0x1ea4('0x30')],_0x4b4270[_0x1ea4('0x31')]);_0x2b92ab[_0x1ea4('0x35')]=_[_0x1ea4('0x34')](_0x4b4270[_0x1ea4('0x30')],qs[_0x1ea4('0x36')](_0x17b63c[_0x1ea4('0x31')][_0x1ea4('0x36')]));_0x2b92ab[_0x1ea4('0x35')]=_0x2b92ab[_0x1ea4('0x35')][_0x1ea4('0x37')]?_0x2b92ab[_0x1ea4('0x35')]:_0x4b4270[_0x1ea4('0x30')];if(_0x17b63c[_0x1ea4('0x31')]['includeAll']){_0x2b92ab[_0x1ea4('0x3f')]=[{'all':!![]}];}_0x2b92ab=_[_0x1ea4('0x3c')]({},_0x2b92ab,_0x17b63c[_0x1ea4('0x44')]);return db[_0x1ea4('0x3d')][_0x1ea4('0x45')](_0x2b92ab)[_0x1ea4('0x28')](handleEntityNotFound(_0x57b13b,null))[_0x1ea4('0x28')](respondWithResult(_0x57b13b,null))[_0x1ea4('0x41')](handleError(_0x57b13b,null));};exports[_0x1ea4('0x26')]=function(_0xcb6bbe,_0x1e3789){if(_0xcb6bbe['body']['id']){delete _0xcb6bbe[_0x1ea4('0x46')]['id'];}return db['CmHopperBlack'][_0x1ea4('0x45')]({'where':{'id':_0xcb6bbe[_0x1ea4('0x43')]['id']}})[_0x1ea4('0x28')](handleEntityNotFound(_0x1e3789,null))[_0x1ea4('0x28')](saveUpdates(_0xcb6bbe[_0x1ea4('0x46')],null))[_0x1ea4('0x28')](respondWithResult(_0x1e3789,null))[_0x1ea4('0x41')](handleError(_0x1e3789,null));};exports[_0x1ea4('0x27')]=function(_0x387af0,_0x1c2a96){return db[_0x1ea4('0x3d')][_0x1ea4('0x45')]({'where':{'id':_0x387af0[_0x1ea4('0x43')]['id']}})[_0x1ea4('0x28')](handleEntityNotFound(_0x1c2a96,null))['then'](removeEntity(_0x1c2a96,null))[_0x1ea4('0x41')](handleError(_0x1c2a96,null));};exports[_0x1ea4('0x47')]=function(_0x4697af,_0x432bd7){return db['CmHopperBlack']['describe']()['then'](respondWithResult(_0x432bd7,null))[_0x1ea4('0x41')](handleError(_0x432bd7,null));}; \ No newline at end of file +var _0x27c4=['name','send','CmHopperBlack','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','rows','show','keys','find','catch','body','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error'];(function(_0x489734,_0x24791d){var _0x24a8cc=function(_0x4d2765){while(--_0x4d2765){_0x489734['push'](_0x489734['shift']());}};_0x24a8cc(++_0x24791d);}(_0x27c4,0x189));var _0x427c=function(_0x256ab0,_0x1f1d53){_0x256ab0=_0x256ab0-0x0;var _0x4f6574=_0x27c4[_0x256ab0];return _0x4f6574;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x427c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x427c('0x1'));var rp=require(_0x427c('0x2'));var moment=require(_0x427c('0x3'));var BPromise=require(_0x427c('0x4'));var Mustache=require(_0x427c('0x5'));var util=require(_0x427c('0x6'));var path=require(_0x427c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x427c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x427c('0x9'));var squel=require('squel');var crypto=require(_0x427c('0xa'));var jsforce=require(_0x427c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x427c('0xc'));var querystring=require(_0x427c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x427c('0xe'));var qs=require(_0x427c('0xf'));var as=require(_0x427c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x427c('0x11'))(_0x427c('0x12'));var utils=require(_0x427c('0x13'));var config=require(_0x427c('0x14'));var licenseUtil=require(_0x427c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cbc45,_0x44e60d){_0x44e60d=_0x44e60d||0xcc;return function(_0x4b2ee6){if(_0x4b2ee6){return _0x3cbc45[_0x427c('0x16')](_0x44e60d);}return _0x3cbc45[_0x427c('0x17')](_0x44e60d)[_0x427c('0x18')]();};}function respondWithResult(_0x4b6a27,_0x3e5dec){_0x3e5dec=_0x3e5dec||0xc8;return function(_0x165032){if(_0x165032){return _0x4b6a27['status'](_0x3e5dec)[_0x427c('0x19')](_0x165032);}};}function respondWithFilteredResult(_0x43ea13,_0x1fb5fb){return function(_0x49b78f){if(_0x49b78f){var _0x44c188=typeof _0x1fb5fb[_0x427c('0x1a')]===_0x427c('0x1b')&&typeof _0x1fb5fb[_0x427c('0x1c')]===_0x427c('0x1b');var _0x56de04=_0x49b78f[_0x427c('0x1d')];var _0x505e3d=_0x44c188?0x0:_0x1fb5fb[_0x427c('0x1a')];var _0x439dbc=_0x44c188?_0x49b78f['count']:_0x1fb5fb['offset']+_0x1fb5fb[_0x427c('0x1c')];var _0x2ad76e;if(_0x439dbc>=_0x56de04){_0x439dbc=_0x56de04;_0x2ad76e=0xc8;}else{_0x2ad76e=0xce;}_0x43ea13[_0x427c('0x17')](_0x2ad76e);return _0x43ea13[_0x427c('0x1e')](_0x427c('0x1f'),_0x505e3d+'-'+_0x439dbc+'/'+_0x56de04)[_0x427c('0x19')](_0x49b78f);}return null;};}function patchUpdates(_0x34c2f2){return function(_0x4a47ef){try{jsonpatch[_0x427c('0x20')](_0x4a47ef,_0x34c2f2,!![]);}catch(_0x395b10){return BPromise[_0x427c('0x21')](_0x395b10);}return _0x4a47ef[_0x427c('0x22')]();};}function saveUpdates(_0x27ade1,_0x3b4253){return function(_0x302241){if(_0x302241){return _0x302241[_0x427c('0x23')](_0x27ade1)['then'](function(_0x749c8e){return _0x749c8e;});}return null;};}function removeEntity(_0x5c2690,_0x12c854){return function(_0x8bb71f){if(_0x8bb71f){return _0x8bb71f[_0x427c('0x24')]()[_0x427c('0x25')](function(){_0x5c2690[_0x427c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2db6cc,_0x1d8fdb){return function(_0x4cce48){if(!_0x4cce48){_0x2db6cc[_0x427c('0x16')](0x194);}return _0x4cce48;};}function handleError(_0x5c425d,_0x3b7127){_0x3b7127=_0x3b7127||0x1f4;return function(_0x2f358a){logger[_0x427c('0x26')](_0x2f358a['stack']);if(_0x2f358a['name']){delete _0x2f358a[_0x427c('0x27')];}_0x5c425d['status'](_0x3b7127)[_0x427c('0x28')](_0x2f358a);};}exports['index']=function(_0x4accfd,_0x31afc4){var _0x2506db={},_0x2aabff={},_0x35ac8d={'count':0x0,'rows':[]};var _0x2018c6=_['map'](db[_0x427c('0x29')][_0x427c('0x2a')],function(_0x3c0e91){return{'name':_0x3c0e91[_0x427c('0x2b')],'type':_0x3c0e91[_0x427c('0x2c')][_0x427c('0x2d')]};});_0x2aabff[_0x427c('0x2e')]=_[_0x427c('0x2f')](_0x2018c6,_0x427c('0x27'));_0x2aabff[_0x427c('0x30')]=_['keys'](_0x4accfd[_0x427c('0x30')]);_0x2aabff[_0x427c('0x31')]=_[_0x427c('0x32')](_0x2aabff[_0x427c('0x2e')],_0x2aabff[_0x427c('0x30')]);_0x2506db[_0x427c('0x33')]=_['intersection'](_0x2aabff['model'],qs[_0x427c('0x34')](_0x4accfd[_0x427c('0x30')][_0x427c('0x34')]));_0x2506db[_0x427c('0x33')]=_0x2506db[_0x427c('0x33')][_0x427c('0x35')]?_0x2506db[_0x427c('0x33')]:_0x2aabff['model'];if(!_0x4accfd['query'][_0x427c('0x36')](_0x427c('0x37'))){_0x2506db[_0x427c('0x1c')]=qs['limit'](_0x4accfd[_0x427c('0x30')][_0x427c('0x1c')]);_0x2506db[_0x427c('0x1a')]=qs[_0x427c('0x1a')](_0x4accfd[_0x427c('0x30')][_0x427c('0x1a')]);}_0x2506db[_0x427c('0x38')]=qs[_0x427c('0x39')](_0x4accfd[_0x427c('0x30')]['sort']);_0x2506db['where']=qs[_0x427c('0x31')](_['pick'](_0x4accfd['query'],_0x2aabff[_0x427c('0x31')]),_0x2018c6);if(_0x4accfd['query'][_0x427c('0x3a')]){_0x2506db[_0x427c('0x3b')]=_[_0x427c('0x3c')](_0x2506db[_0x427c('0x3b')],{'$or':_['map'](_0x2018c6,function(_0x3b123f){if(_0x3b123f['type']!==_0x427c('0x3d')){var _0x243dcd={};_0x243dcd[_0x3b123f[_0x427c('0x27')]]={'$like':'%'+_0x4accfd['query'][_0x427c('0x3a')]+'%'};return _0x243dcd;}})});}_0x2506db=_[_0x427c('0x3c')]({},_0x2506db,_0x4accfd[_0x427c('0x3e')]);var _0x14c5f2={'where':_0x2506db[_0x427c('0x3b')]};return db[_0x427c('0x29')]['count'](_0x14c5f2)[_0x427c('0x25')](function(_0x2e3c6f){_0x35ac8d[_0x427c('0x1d')]=_0x2e3c6f;if(_0x4accfd[_0x427c('0x30')][_0x427c('0x3f')]){_0x2506db['include']=[{'all':!![]}];}return db[_0x427c('0x29')]['findAll'](_0x2506db);})['then'](function(_0x265483){_0x35ac8d[_0x427c('0x40')]=_0x265483;return _0x35ac8d;})[_0x427c('0x25')](respondWithFilteredResult(_0x31afc4,_0x2506db))['catch'](handleError(_0x31afc4,null));};exports[_0x427c('0x41')]=function(_0x1b798b,_0x44805f){var _0x2157b4={'raw':!![],'where':{'id':_0x1b798b['params']['id']}},_0x44c0eb={};_0x44c0eb[_0x427c('0x2e')]=_[_0x427c('0x42')](db[_0x427c('0x29')]['rawAttributes']);_0x44c0eb['query']=_[_0x427c('0x42')](_0x1b798b[_0x427c('0x30')]);_0x44c0eb['filters']=_[_0x427c('0x32')](_0x44c0eb[_0x427c('0x2e')],_0x44c0eb[_0x427c('0x30')]);_0x2157b4[_0x427c('0x33')]=_[_0x427c('0x32')](_0x44c0eb[_0x427c('0x2e')],qs[_0x427c('0x34')](_0x1b798b[_0x427c('0x30')][_0x427c('0x34')]));_0x2157b4['attributes']=_0x2157b4[_0x427c('0x33')][_0x427c('0x35')]?_0x2157b4[_0x427c('0x33')]:_0x44c0eb[_0x427c('0x2e')];if(_0x1b798b[_0x427c('0x30')][_0x427c('0x3f')]){_0x2157b4['include']=[{'all':!![]}];}_0x2157b4=_[_0x427c('0x3c')]({},_0x2157b4,_0x1b798b[_0x427c('0x3e')]);return db['CmHopperBlack'][_0x427c('0x43')](_0x2157b4)[_0x427c('0x25')](handleEntityNotFound(_0x44805f,null))['then'](respondWithResult(_0x44805f,null))[_0x427c('0x44')](handleError(_0x44805f,null));};exports[_0x427c('0x23')]=function(_0x4e22a4,_0x5a822d){if(_0x4e22a4['body']['id']){delete _0x4e22a4[_0x427c('0x45')]['id'];}return db[_0x427c('0x29')][_0x427c('0x43')]({'where':{'id':_0x4e22a4[_0x427c('0x46')]['id']}})[_0x427c('0x25')](handleEntityNotFound(_0x5a822d,null))[_0x427c('0x25')](saveUpdates(_0x4e22a4[_0x427c('0x45')],null))[_0x427c('0x25')](respondWithResult(_0x5a822d,null))['catch'](handleError(_0x5a822d,null));};exports[_0x427c('0x24')]=function(_0x107c46,_0x33175b){return db[_0x427c('0x29')][_0x427c('0x43')]({'where':{'id':_0x107c46[_0x427c('0x46')]['id']}})[_0x427c('0x25')](handleEntityNotFound(_0x33175b,null))[_0x427c('0x25')](removeEntity(_0x33175b,null))[_0x427c('0x44')](handleError(_0x33175b,null));};exports[_0x427c('0x47')]=function(_0x3cdb45,_0x1ec2c5){return db['CmHopperBlack'][_0x427c('0x47')]()[_0x427c('0x25')](respondWithResult(_0x1ec2c5,null))['catch'](handleError(_0x1ec2c5,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index c7fd443..f2649e0 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 _0x8087=['bluebird','request-promise','path','rimraf','../../config/environment','exports','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment'];(function(_0x166aa8,_0x338b92){var _0x5a9b90=function(_0x41b565){while(--_0x41b565){_0x166aa8['push'](_0x166aa8['shift']());}};_0x5a9b90(++_0x338b92);}(_0x8087,0x1cf));var _0x7808=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x8087[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0x7808('0x0'));var util=require(_0x7808('0x1'));var logger=require(_0x7808('0x2'))(_0x7808('0x3'));var moment=require(_0x7808('0x4'));var BPromise=require(_0x7808('0x5'));var rp=require(_0x7808('0x6'));var fs=require('fs');var path=require(_0x7808('0x7'));var rimraf=require(_0x7808('0x8'));var config=require(_0x7808('0x9'));var attributes=require('./cmHopperBlack.attributes');module[_0x7808('0xa')]=function(_0x2eb3d8,_0xc52792){return _0x2eb3d8['define'](_0x7808('0xb'),attributes,{'tableName':_0x7808('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2d2=['lodash','util','bluebird','request-promise','path','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black'];(function(_0xb18334,_0x2f7b62){var _0x5565c0=function(_0x1ba74d){while(--_0x1ba74d){_0xb18334['push'](_0xb18334['shift']());}};_0x5565c0(++_0x2f7b62);}(_0xd2d2,0x1ea));var _0x2d2d=function(_0x4e7a0e,_0x31389b){_0x4e7a0e=_0x4e7a0e-0x0;var _0x3960c1=_0xd2d2[_0x4e7a0e];return _0x3960c1;};'use strict';var _=require(_0x2d2d('0x0'));var util=require(_0x2d2d('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2d2d('0x2'));var rp=require(_0x2d2d('0x3'));var fs=require('fs');var path=require(_0x2d2d('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2d2d('0x5'));module[_0x2d2d('0x6')]=function(_0x26948b,_0x20f8f7){return _0x26948b[_0x2d2d('0x7')](_0x2d2d('0x8'),attributes,{'tableName':_0x2d2d('0x9'),'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 b2ed8ca..7cbfe17 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 _0x19bd=['findAll','options','raw','where','limit','include','model','attributes','map','CmHopperBlack','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopperBlack'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x19bd,0xae));var _0xd19b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x19bd[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xd19b('0x0'));var moment=require(_0xd19b('0x1'));var BPromise=require(_0xd19b('0x2'));var rs=require(_0xd19b('0x3'));var fs=require('fs');var Redis=require(_0xd19b('0x4'));var db=require(_0xd19b('0x5'))['db'];var utils=require(_0xd19b('0x6'));var logger=require('../../config/logger')(_0xd19b('0x7'));var config=require(_0xd19b('0x8'));var jayson=require(_0xd19b('0x9'));var client=jayson[_0xd19b('0xa')][_0xd19b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51f4a3,_0x347f50,_0x47bcfc){return new BPromise(function(_0x31e214,_0x196ca2){return client[_0xd19b('0xc')](_0x51f4a3,_0x47bcfc)[_0xd19b('0xd')](function(_0x4ac2d7){logger[_0xd19b('0xe')](_0xd19b('0xf'),_0x347f50,'request\x20sent');logger[_0xd19b('0x10')](_0xd19b('0x11'),_0x347f50,_0xd19b('0x12'),JSON[_0xd19b('0x13')](_0x4ac2d7));if(_0x4ac2d7[_0xd19b('0x14')]){if(_0x4ac2d7[_0xd19b('0x14')][_0xd19b('0x15')]===0x1f4){logger['error'](_0xd19b('0xf'),_0x347f50,_0x4ac2d7[_0xd19b('0x14')]['message']);return _0x196ca2(_0x4ac2d7['error']['message']);}logger['error'](_0xd19b('0xf'),_0x347f50,_0x4ac2d7[_0xd19b('0x14')][_0xd19b('0x16')]);return _0x31e214(_0x4ac2d7['error'][_0xd19b('0x16')]);}else{logger[_0xd19b('0xe')](_0xd19b('0xf'),_0x347f50,'request\x20sent');_0x31e214(_0x4ac2d7[_0xd19b('0x17')][_0xd19b('0x16')]);}})[_0xd19b('0x18')](function(_0x194aef){logger[_0xd19b('0x14')](_0xd19b('0xf'),_0x347f50,_0x194aef);_0x196ca2(_0x194aef);});});}exports[_0xd19b('0x19')]=function(_0x1fbc7f){var _0x108677=this;return new Promise(function(_0x9ae7e4,_0x2fabc7){return db['CmHopperBlack'][_0xd19b('0x1a')]({'raw':_0x1fbc7f['options']?_0x1fbc7f[_0xd19b('0x1b')][_0xd19b('0x1c')]===undefined?!![]:![]:!![],'where':_0x1fbc7f[_0xd19b('0x1b')]?_0x1fbc7f['options'][_0xd19b('0x1d')]||null:null,'attributes':_0x1fbc7f[_0xd19b('0x1b')]?_0x1fbc7f[_0xd19b('0x1b')]['attributes']||null:null,'limit':_0x1fbc7f[_0xd19b('0x1b')]?_0x1fbc7f['options'][_0xd19b('0x1e')]||null:null,'include':_0x1fbc7f[_0xd19b('0x1b')]?_0x1fbc7f[_0xd19b('0x1b')][_0xd19b('0x1f')]?_['map'](_0x1fbc7f['options']['include'],function(_0x5e65d8){return{'model':db[_0x5e65d8[_0xd19b('0x20')]],'as':_0x5e65d8['as'],'attributes':_0x5e65d8[_0xd19b('0x21')],'include':_0x5e65d8[_0xd19b('0x1f')]?_[_0xd19b('0x22')](_0x5e65d8[_0xd19b('0x1f')],function(_0xa9a56b){return{'model':db[_0xa9a56b[_0xd19b('0x20')]],'as':_0xa9a56b['as'],'attributes':_0xa9a56b[_0xd19b('0x21')],'include':_0xa9a56b[_0xd19b('0x1f')]?_[_0xd19b('0x22')](_0xa9a56b[_0xd19b('0x1f')],function(_0x413e88){return{'model':db[_0x413e88[_0xd19b('0x20')]],'as':_0x413e88['as'],'attributes':_0x413e88['attributes']};}):[]};}):[]};}):[]:[]})[_0xd19b('0xd')](function(_0x31bfd1){logger[_0xd19b('0xe')](_0xd19b('0x19'),_0x1fbc7f);logger[_0xd19b('0x10')]('GetCmHopperBlack',_0x1fbc7f,JSON['stringify'](_0x31bfd1));_0x9ae7e4(_0x31bfd1);})['catch'](function(_0x21d3c2){logger[_0xd19b('0x14')](_0xd19b('0x19'),_0x21d3c2[_0xd19b('0x16')],_0x1fbc7f);_0x2fabc7(_0x108677['error'](0x1f4,_0x21d3c2[_0xd19b('0x16')]));});});};exports['UpdateCmHopperBlack']=function(_0x3b37b8){var _0x6a573e=this;return new Promise(function(_0x1fa3fb,_0x18db6f){return db[_0xd19b('0x23')][_0xd19b('0x24')](_0x3b37b8[_0xd19b('0x25')],{'raw':_0x3b37b8[_0xd19b('0x1b')]?_0x3b37b8[_0xd19b('0x1b')][_0xd19b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b37b8['options']?_0x3b37b8[_0xd19b('0x1b')][_0xd19b('0x1d')]||null:null,'attributes':_0x3b37b8['options']?_0x3b37b8[_0xd19b('0x1b')][_0xd19b('0x21')]||null:null,'limit':_0x3b37b8['options']?_0x3b37b8[_0xd19b('0x1b')][_0xd19b('0x1e')]||null:null})[_0xd19b('0xd')](function(_0x214bd3){logger[_0xd19b('0xe')](_0xd19b('0x26'),_0x3b37b8);logger[_0xd19b('0x10')](_0xd19b('0x26'),_0x3b37b8,JSON['stringify'](_0x214bd3));_0x1fa3fb(_0x214bd3);})[_0xd19b('0x18')](function(_0x380d82){logger[_0xd19b('0x14')](_0xd19b('0x26'),_0x380d82[_0xd19b('0x16')],_0x3b37b8);_0x18db6f(_0x6a573e[_0xd19b('0x14')](0x1f4,_0x380d82[_0xd19b('0x16')]));});});};exports[_0xd19b('0x27')]=function(_0x53bbff){var _0x1607ec=this;return new Promise(function(_0x544b9a,_0x1c03fe){return db[_0xd19b('0x23')]['destroy']({'where':_0x53bbff['options']?_0x53bbff['options'][_0xd19b('0x1d')]||null:null})[_0xd19b('0xd')](function(_0x2f1edd){logger[_0xd19b('0xe')](_0xd19b('0x27'),_0x53bbff);logger[_0xd19b('0x10')]('DestroyCmHopperBlack',_0x53bbff,JSON[_0xd19b('0x13')](_0x2f1edd));_0x544b9a(_0x2f1edd);})[_0xd19b('0x18')](function(_0x392205){logger['error'](_0xd19b('0x27'),_0x392205['message'],_0x53bbff);_0x1c03fe(_0x1607ec[_0xd19b('0x14')](0x1f4,_0x392205[_0xd19b('0x16')]));});});}; \ No newline at end of file +var _0xa5c6=['catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','then','debug','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','result'];(function(_0x491117,_0x68be95){var _0x145277=function(_0x40b471){while(--_0x40b471){_0x491117['push'](_0x491117['shift']());}};_0x145277(++_0x68be95);}(_0xa5c6,0x19d));var _0x6a5c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa5c6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6a5c('0x0'));var util=require('util');var moment=require(_0x6a5c('0x1'));var BPromise=require(_0x6a5c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a5c('0x3'));var db=require(_0x6a5c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a5c('0x5'))(_0x6a5c('0x6'));var config=require(_0x6a5c('0x7'));var jayson=require(_0x6a5c('0x8'));var client=jayson['client'][_0x6a5c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5cf7d0,_0x643073,_0x539489){return new BPromise(function(_0x322876,_0x2fbba6){return client[_0x6a5c('0xa')](_0x5cf7d0,_0x539489)['then'](function(_0x9e9b36){logger[_0x6a5c('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x643073,_0x6a5c('0xc'));logger['debug'](_0x6a5c('0xd'),_0x643073,'request\x20sent',JSON[_0x6a5c('0xe')](_0x9e9b36));if(_0x9e9b36[_0x6a5c('0xf')]){if(_0x9e9b36['error']['code']===0x1f4){logger[_0x6a5c('0xf')](_0x6a5c('0x10'),_0x643073,_0x9e9b36[_0x6a5c('0xf')][_0x6a5c('0x11')]);return _0x2fbba6(_0x9e9b36[_0x6a5c('0xf')][_0x6a5c('0x11')]);}logger[_0x6a5c('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x643073,_0x9e9b36['error'][_0x6a5c('0x11')]);return _0x322876(_0x9e9b36[_0x6a5c('0xf')][_0x6a5c('0x11')]);}else{logger[_0x6a5c('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x643073,_0x6a5c('0xc'));_0x322876(_0x9e9b36[_0x6a5c('0x12')]['message']);}})[_0x6a5c('0x13')](function(_0x7d4923){logger['error'](_0x6a5c('0x10'),_0x643073,_0x7d4923);_0x2fbba6(_0x7d4923);});});}exports[_0x6a5c('0x14')]=function(_0x2a295a){var _0x2bfda1=this;return new Promise(function(_0x5245a4,_0x1da7c4){return db[_0x6a5c('0x15')][_0x6a5c('0x16')]({'raw':_0x2a295a[_0x6a5c('0x17')]?_0x2a295a['options'][_0x6a5c('0x18')]===undefined?!![]:![]:!![],'where':_0x2a295a[_0x6a5c('0x17')]?_0x2a295a[_0x6a5c('0x17')][_0x6a5c('0x19')]||null:null,'attributes':_0x2a295a[_0x6a5c('0x17')]?_0x2a295a['options'][_0x6a5c('0x1a')]||null:null,'limit':_0x2a295a[_0x6a5c('0x17')]?_0x2a295a[_0x6a5c('0x17')]['limit']||null:null,'include':_0x2a295a[_0x6a5c('0x17')]?_0x2a295a[_0x6a5c('0x17')][_0x6a5c('0x1b')]?_[_0x6a5c('0x1c')](_0x2a295a[_0x6a5c('0x17')]['include'],function(_0x16dadc){return{'model':db[_0x16dadc[_0x6a5c('0x1d')]],'as':_0x16dadc['as'],'attributes':_0x16dadc[_0x6a5c('0x1a')],'include':_0x16dadc[_0x6a5c('0x1b')]?_[_0x6a5c('0x1c')](_0x16dadc[_0x6a5c('0x1b')],function(_0xfbc711){return{'model':db[_0xfbc711['model']],'as':_0xfbc711['as'],'attributes':_0xfbc711[_0x6a5c('0x1a')],'include':_0xfbc711[_0x6a5c('0x1b')]?_[_0x6a5c('0x1c')](_0xfbc711['include'],function(_0x5b7293){return{'model':db[_0x5b7293[_0x6a5c('0x1d')]],'as':_0x5b7293['as'],'attributes':_0x5b7293[_0x6a5c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6a5c('0x1e')](function(_0x12e952){logger[_0x6a5c('0xb')](_0x6a5c('0x14'),_0x2a295a);logger[_0x6a5c('0x1f')](_0x6a5c('0x14'),_0x2a295a,JSON[_0x6a5c('0xe')](_0x12e952));_0x5245a4(_0x12e952);})[_0x6a5c('0x13')](function(_0x20003c){logger[_0x6a5c('0xf')]('GetCmHopperBlack',_0x20003c[_0x6a5c('0x11')],_0x2a295a);_0x1da7c4(_0x2bfda1[_0x6a5c('0xf')](0x1f4,_0x20003c[_0x6a5c('0x11')]));});});};exports[_0x6a5c('0x20')]=function(_0x538743){var _0x1bfb3d=this;return new Promise(function(_0x37da3f,_0x3c7ba0){return db[_0x6a5c('0x15')][_0x6a5c('0x21')](_0x538743[_0x6a5c('0x22')],{'raw':_0x538743[_0x6a5c('0x17')]?_0x538743['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x538743[_0x6a5c('0x17')]?_0x538743[_0x6a5c('0x17')][_0x6a5c('0x19')]||null:null,'attributes':_0x538743[_0x6a5c('0x17')]?_0x538743[_0x6a5c('0x17')][_0x6a5c('0x1a')]||null:null,'limit':_0x538743[_0x6a5c('0x17')]?_0x538743['options']['limit']||null:null})[_0x6a5c('0x1e')](function(_0x5e1ba6){logger[_0x6a5c('0xb')](_0x6a5c('0x20'),_0x538743);logger[_0x6a5c('0x1f')](_0x6a5c('0x20'),_0x538743,JSON[_0x6a5c('0xe')](_0x5e1ba6));_0x37da3f(_0x5e1ba6);})[_0x6a5c('0x13')](function(_0x42b882){logger[_0x6a5c('0xf')](_0x6a5c('0x20'),_0x42b882[_0x6a5c('0x11')],_0x538743);_0x3c7ba0(_0x1bfb3d[_0x6a5c('0xf')](0x1f4,_0x42b882['message']));});});};exports[_0x6a5c('0x23')]=function(_0x2f16ec){var _0x58c380=this;return new Promise(function(_0x476515,_0x347d0c){return db[_0x6a5c('0x15')]['destroy']({'where':_0x2f16ec[_0x6a5c('0x17')]?_0x2f16ec[_0x6a5c('0x17')][_0x6a5c('0x19')]||null:null})[_0x6a5c('0x1e')](function(_0x9eb0c9){logger[_0x6a5c('0xb')](_0x6a5c('0x23'),_0x2f16ec);logger['debug'](_0x6a5c('0x23'),_0x2f16ec,JSON[_0x6a5c('0xe')](_0x9eb0c9));_0x476515(_0x9eb0c9);})[_0x6a5c('0x13')](function(_0x37d12a){logger[_0x6a5c('0xf')]('DestroyCmHopperBlack',_0x37d12a[_0x6a5c('0x11')],_0x2f16ec);_0x347d0c(_0x58c380[_0x6a5c('0xf')](0x1f4,_0x37d12a[_0x6a5c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index c30ec21..f9b4826 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 _0xffd6=['path','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','show','/:id','update','delete','destroy','multer','util'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xffd6,0x97));var _0x6ffd=function(_0x1c6ef2,_0x8d926a){_0x1c6ef2=_0x1c6ef2-0x0;var _0x404b8c=_0xffd6[_0x1c6ef2];return _0x404b8c;};'use strict';var multer=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var path=require(_0x6ffd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ffd('0x3')]();var fs_extra=require(_0x6ffd('0x4'));var auth=require(_0x6ffd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6ffd('0x6'));var controller=require(_0x6ffd('0x7'));router[_0x6ffd('0x8')]('/',auth[_0x6ffd('0x9')](),controller['index']);router[_0x6ffd('0x8')](_0x6ffd('0xa'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0xb')]);router[_0x6ffd('0x8')]('/:id',auth[_0x6ffd('0x9')](),controller[_0x6ffd('0xc')]);router['put'](_0x6ffd('0xd'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0xe')]);router[_0x6ffd('0xf')](_0x6ffd('0xd'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0x10')]);module['exports']=router; \ No newline at end of file +var _0x81c6=['delete','util','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','/:id','update'];(function(_0x1826bd,_0x2b1fb4){var _0x50f8b8=function(_0x544248){while(--_0x544248){_0x1826bd['push'](_0x1826bd['shift']());}};_0x50f8b8(++_0x2b1fb4);}(_0x81c6,0x1d5));var _0x681c=function(_0x1bdd2d,_0x308db2){_0x1bdd2d=_0x1bdd2d-0x0;var _0x3f723a=_0x81c6[_0x1bdd2d];return _0x3f723a;};'use strict';var multer=require('multer');var util=require(_0x681c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x681c('0x1')]();var fs_extra=require(_0x681c('0x2'));var auth=require(_0x681c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x681c('0x4'));var controller=require(_0x681c('0x5'));router[_0x681c('0x6')]('/',auth[_0x681c('0x7')](),controller['index']);router[_0x681c('0x6')](_0x681c('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x681c('0x6')](_0x681c('0x9'),auth[_0x681c('0x7')](),controller['show']);router['put'](_0x681c('0x9'),auth['isAuthenticated'](),controller[_0x681c('0xa')]);router[_0x681c('0xb')](_0x681c('0x9'),auth[_0x681c('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index fdfa0ac..3798fc2 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 _0x8fb6=['exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','diff','BOOLEAN','sequelize','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fb6,0xfb));var _0x68fb=function(_0x408704,_0x139393){_0x408704=_0x408704-0x0;var _0x3dfbc7=_0x8fb6[_0x408704];return _0x3dfbc7;};'use strict';var Sequelize=require(_0x68fb('0x0'));var moment=require(_0x68fb('0x1'));module[_0x68fb('0x2')]={'state':{'type':Sequelize[_0x68fb('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x68fb('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x68fb('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x68fb('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x68fb('0x4')]},'starttime':{'type':Sequelize[_0x68fb('0x5')]},'responsetime':{'type':Sequelize[_0x68fb('0x5')]},'answertime':{'type':Sequelize[_0x68fb('0x5')]},'droptime':{'type':Sequelize[_0x68fb('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x68fb('0x4')]},'campaign':{'type':Sequelize[_0x68fb('0x4')]},'campaigntype':{'type':Sequelize[_0x68fb('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x68fb('0x4')]},'disposition':{'type':Sequelize[_0x68fb('0x4')]},'secondDisposition':{'type':Sequelize[_0x68fb('0x4')]},'thirdDisposition':{'type':Sequelize[_0x68fb('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5e323b){var _0x51556a=this[_0x68fb('0x6')](_0x68fb('0x7'));if(_0x51556a&&_0x5e323b){this[_0x68fb('0x8')]('followuptime',moment(_0x5e323b)[_0x68fb('0x9')](moment(_0x51556a),'seconds'));}}},'amd':{'type':Sequelize[_0x68fb('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x68fb('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x68fb('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x68fb('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x68fb('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x68fb('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x68fb('0x5')]},'deleted':{'type':Sequelize[_0x68fb('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x68fb('0x5')]},'recallme':{'type':Sequelize[_0x68fb('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x68fb('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8783=['STRING','INTEGER','DATE','getDataValue','endtime','diff','BOOLEAN','sequelize','moment','exports'];(function(_0x376283,_0x3bf7fe){var _0x2b258d=function(_0x32e9c5){while(--_0x32e9c5){_0x376283['push'](_0x376283['shift']());}};_0x2b258d(++_0x3bf7fe);}(_0x8783,0xa7));var _0x3878=function(_0x5d5171,_0x55ca64){_0x5d5171=_0x5d5171-0x0;var _0x154c9c=_0x8783[_0x5d5171];return _0x154c9c;};'use strict';var Sequelize=require(_0x3878('0x0'));var moment=require(_0x3878('0x1'));module[_0x3878('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x3878('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3878('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3878('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3878('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x3878('0x3')]},'originatecalleridname':{'type':Sequelize[_0x3878('0x3')]},'calleridnum':{'type':Sequelize[_0x3878('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x3878('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x3878('0x5')]},'endtime':{'type':Sequelize[_0x3878('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3878('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3878('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x3878('0x3')]},'campaigntype':{'type':Sequelize[_0x3878('0x3')]},'membername':{'type':Sequelize[_0x3878('0x3')]},'reason':{'type':Sequelize[_0x3878('0x3')]},'disposition':{'type':Sequelize[_0x3878('0x3')]},'secondDisposition':{'type':Sequelize[_0x3878('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3878('0x3')]},'dispositionat':{'type':Sequelize[_0x3878('0x5')],'set':function(_0x4376a3){var _0x2769da=this[_0x3878('0x6')](_0x3878('0x7'));if(_0x2769da&&_0x4376a3){this['setDataValue']('followuptime',moment(_0x4376a3)[_0x3878('0x8')](moment(_0x2769da),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x3878('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x3878('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x3878('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x3878('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3878('0x5')]},'deleted':{'type':Sequelize[_0x3878('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x3878('0x5')]},'recallme':{'type':Sequelize[_0x3878('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x3878('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x3878('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3878('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3878('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3878('0x4')],'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 70bf034..be4fb2a 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 _0x1883=['abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','scheduledAt','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','NOW()','ContactId','field','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperFinal','includeAll','include','findAll','params','catch','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null'];(function(_0x41699e,_0x577c18){var _0x2d2e81=function(_0x298afc){while(--_0x298afc){_0x41699e['push'](_0x41699e['shift']());}};_0x2d2e81(++_0x577c18);}(_0x1883,0xab));var _0x3188=function(_0x2da69d,_0x16eabf){_0x2da69d=_0x2da69d-0x0;var _0x100d09=_0x1883[_0x2da69d];return _0x100d09;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['CmHopperFinal'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':!![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['CmHopperFinal'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')]()[_0x3188('0x23')](respondWithResult(_0x315524,null))[_0x3188('0x46')](handleError(_0x315524,null));};exports[_0x3188('0x22')]=function(_0x50c08d,_0x50fd56){if(_0x50c08d[_0x3188('0x48')]['uniqueid']){delete _0x50c08d[_0x3188('0x48')][_0x3188('0x49')];}return db['CmHopperFinal'][_0x3188('0x4a')]({'where':{'uniqueid':_0x50c08d[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x50fd56,null))[_0x3188('0x23')](saveUpdates(_0x50c08d[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x50fd56,null))[_0x3188('0x46')](handleError(_0x50fd56,null));};exports[_0x3188('0x4b')]=function(_0x59a177,_0x3b8fe9,_0x3051ce){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x59a177['params']['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x4f')))),'noAnswerContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x50')))),_0x3188('0x51')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x52')))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x54')))),_0x3188('0x55')],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})[_0x3188('0x23')](handleEntityNotFound(_0x3b8fe9,null))[_0x3188('0x23')](respondWithResult(_0x3b8fe9,null))[_0x3188('0x46')](handleError(_0x3b8fe9,null));};exports[_0x3188('0x58')]=function(_0x3afd94,_0x447827,_0x27983c){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'CampaignId':_0x3afd94[_0x3188('0x45')]['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x59')))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x4f')))),_0x3188('0x5a')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x50')))),'busyContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x5b')))),_0x3188('0x5c')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3188('0x55')],[db[_0x3188('0x4c')]['fn']('COUNT',db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x447827,null))['then'](respondWithResult(_0x447827,null))['catch'](handleError(_0x447827,null));};exports[_0x3188('0x5d')]=function(_0x693395,_0x3b6a13,_0x30f3b3){return db[_0x3188('0x5e')]['find']({'where':{'id':_0x693395[_0x3188('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b6a13,null))[_0x3188('0x23')](function(_0x96600f){var _0x5b93cd;if(_0x96600f){_0x5b93cd=squel[_0x3188('0x5f')]()['into'](_0x3188('0x60'))[_0x3188('0x61')](['phone',_0x3188('0x62'),'ContactId',_0x3188('0x63'),_0x3188('0x64'),_0x3188('0x65'),_0x3188('0x66')],squel[_0x3188('0x67')]()['field'](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),_0x3188('0x62'))['field']('ANY_VALUE(ContactId)',_0x3188('0x6b'))[_0x3188('0x6c')](_0x3188('0x6d'),_0x3188('0x63'))[_0x3188('0x6c')](_0x3188('0x6e'),'VoiceQueueId')[_0x3188('0x6c')](_0x3188('0x6a'),_0x3188('0x65'))['field'](_0x3188('0x6a'),_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395['params']['id']['toString']())['where'](_0x3188('0x72'),_0x693395[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()['field'](_0x3188('0x69'))[_0x3188('0x6f')](_0x3188('0x60'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x76'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]())['where'](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db[_0x3188('0x4c')]['query'](_0x5b93cd);}return[];})[_0x3188('0x23')](respondWithResult(_0x3b6a13,null))[_0x3188('0x46')](handleError(_0x3b6a13,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xc1ee8e,_0x2ba5a5,_0x43212c){return db['Campaign'][_0x3188('0x4a')]({'where':{'id':_0xc1ee8e['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x2ba5a5,null))[_0x3188('0x23')](function(_0x31029d){var _0xcf9ceb;if(_0x31029d){_0xcf9ceb=squel[_0x3188('0x5f')]()[_0x3188('0x79')]('cm_hopper')['fromQuery']([_0x3188('0x69'),_0x3188('0x62'),_0x3188('0x6b'),_0x3188('0x63'),_0x3188('0x7a'),_0x3188('0x65'),'updatedAt'],squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),'scheduledAt')['field']('ANY_VALUE(ContactId)','ContactId')[_0x3188('0x6c')](_0x3188('0x6d'),'ListId')[_0x3188('0x6c')](_0x3188('0x7b'),'CampaignId')[_0x3188('0x6c')]('NOW()',_0x3188('0x65'))[_0x3188('0x6c')]('NOW()',_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x72'),_0xc1ee8e[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))['where'](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('phone')['from']('cm_hopper')['where'](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('calleridnum')['from'](_0x3188('0x70'))[_0x3188('0x3b')]('CampaignId\x20=\x20?',_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db['sequelize'][_0x3188('0x30')](_0xcf9ceb);}return[];})[_0x3188('0x23')](respondWithResult(_0x2ba5a5,null))[_0x3188('0x46')](handleError(_0x2ba5a5,null));};exports[_0x3188('0x7d')]=function(_0x203f04,_0x12c18c,_0x11b74c){return db[_0x3188('0x7e')][_0x3188('0x7f')]({'where':{'VoiceQueueId':_0x203f04['body'][_0x3188('0x64')],'CampaignId':_0x203f04['body'][_0x3188('0x7a')],'ContactId':_0x203f04[_0x3188('0x48')][_0x3188('0x6b')]}})[_0x3188('0x23')](handleEntityNotFound(_0x12c18c,null))[_0x3188('0x23')](function(_0x41ca86){if(_0x41ca86){return _0x41ca86;}return null;})[_0x3188('0x23')](respondWithResult(_0x12c18c,null))[_0x3188('0x46')](handleError(_0x12c18c,null));}; \ No newline at end of file +var _0xb016=['error','name','send','index','map','CmHopperFinal','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','body','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum','state\x20=\x204','group','checkContactHopper','CmHopper','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end'];(function(_0x2948d4,_0x4a53f6){var _0x10ba59=function(_0x5ecee1){while(--_0x5ecee1){_0x2948d4['push'](_0x2948d4['shift']());}};_0x10ba59(++_0x4a53f6);}(_0xb016,0x159));var _0x6b01=function(_0x5aa9c6,_0x3f8e68){_0x5aa9c6=_0x5aa9c6-0x0;var _0x3cc1e8=_0xb016[_0x5aa9c6];return _0x3cc1e8;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':!![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['describe']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['describe']()['then'](respondWithResult(_0x27442e,null))['catch'](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x12160f,_0x518d94){if(_0x12160f[_0x6b01('0x43')]['uniqueid']){delete _0x12160f['body']['uniqueid'];}return db[_0x6b01('0x29')][_0x6b01('0x44')]({'where':{'uniqueid':_0x12160f['params']['id']}})['then'](handleEntityNotFound(_0x518d94,null))[_0x6b01('0x21')](saveUpdates(_0x12160f['body'],null))[_0x6b01('0x21')](respondWithResult(_0x518d94,null))[_0x6b01('0x40')](handleError(_0x518d94,null));};exports[_0x6b01('0x45')]=function(_0x172a56,_0x13f6d7,_0x4d327f){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x172a56[_0x6b01('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x49')))),_0x6b01('0x4a')],[db[_0x6b01('0x47')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x6b01('0x4b')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal'](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')]('`state`\x20=\x208,\x201,\x20null'))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x53')))),_0x6b01('0x54')]]})[_0x6b01('0x21')](handleEntityNotFound(_0x13f6d7,null))[_0x6b01('0x21')](respondWithResult(_0x13f6d7,null))[_0x6b01('0x40')](handleError(_0x13f6d7,null));};exports[_0x6b01('0x55')]=function(_0x425d28,_0x132dda,_0x4c1345){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'CampaignId':_0x425d28[_0x6b01('0x41')]['id']},'attributes':[[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x49')))),'noSuchContacts'],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x56')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x57')))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x58')))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),_0x6b01('0x59')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x53')))),'answeringMachine']]})[_0x6b01('0x21')](handleEntityNotFound(_0x132dda,null))[_0x6b01('0x21')](respondWithResult(_0x132dda,null))[_0x6b01('0x40')](handleError(_0x132dda,null));};exports[_0x6b01('0x5a')]=function(_0x1c419c,_0x250889,_0x40931a){return db[_0x6b01('0x5b')][_0x6b01('0x44')]({'where':{'id':_0x1c419c[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x250889,null))[_0x6b01('0x21')](function(_0x468a0b){var _0x30171f;if(_0x468a0b){_0x30171f=squel[_0x6b01('0x5c')]()['into'](_0x6b01('0x5d'))[_0x6b01('0x5e')]([_0x6b01('0x5f'),_0x6b01('0x60'),_0x6b01('0x61'),_0x6b01('0x62'),_0x6b01('0x63'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))[_0x6b01('0x67')](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')]('ANY_VALUE(ListId)','ListId')['field']('ANY_VALUE(VoiceQueueId)',_0x6b01('0x63'))['field']('NOW()','createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c['params']['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x1c419c[_0x6b01('0x43')]['state'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))[_0x6b01('0x37')](_0x6b01('0x71'),squel['select']()[_0x6b01('0x67')]('phone')[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id']['toString']()))[_0x6b01('0x37')](_0x6b01('0x71'),squel[_0x6b01('0x66')]()[_0x6b01('0x67')]('calleridnum')[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())['where']('state\x20=\x204'))['group'](_0x6b01('0x61')))[_0x6b01('0x6f')]();return db['sequelize'][_0x6b01('0x2c')](_0x30171f);}return[];})[_0x6b01('0x21')](respondWithResult(_0x250889,null))[_0x6b01('0x40')](handleError(_0x250889,null));};exports[_0x6b01('0x72')]=function(_0x536748,_0x18066a,_0x4ccc00){return db[_0x6b01('0x73')]['find']({'where':{'id':_0x536748[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x18066a,null))[_0x6b01('0x21')](function(_0x3bc182){var _0x410303;if(_0x3bc182){_0x410303=squel[_0x6b01('0x5c')]()[_0x6b01('0x74')](_0x6b01('0x5d'))[_0x6b01('0x5e')](['phone',_0x6b01('0x60'),'ContactId',_0x6b01('0x62'),_0x6b01('0x75'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))['field'](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')](_0x6b01('0x76'),'ListId')[_0x6b01('0x67')](_0x6b01('0x77'),_0x6b01('0x75'))[_0x6b01('0x67')](_0x6b01('0x69'),'createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x536748[_0x6b01('0x43')][_0x6b01('0x79')][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))['where'](_0x6b01('0x71'),squel['select']()['field'](_0x6b01('0x5f'))[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')]('CampaignId\x20=\x20?',_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]()))[_0x6b01('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x7a'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x7b')))[_0x6b01('0x7c')](_0x6b01('0x61')))['toString']();return db['sequelize'][_0x6b01('0x2c')](_0x410303);}return[];})[_0x6b01('0x21')](respondWithResult(_0x18066a,null))[_0x6b01('0x40')](handleError(_0x18066a,null));};exports[_0x6b01('0x7d')]=function(_0x6a33d7,_0x214f54,_0x1343af){return db[_0x6b01('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x63')],'CampaignId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x75')],'ContactId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x61')]}})[_0x6b01('0x21')](handleEntityNotFound(_0x214f54,null))['then'](function(_0x5140ba){if(_0x5140ba){return _0x5140ba;}return null;})['then'](respondWithResult(_0x214f54,null))[_0x6b01('0x40')](handleError(_0x214f54,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 0d21b5c..62455a3 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 _0x9d4d=['CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x4284b8,_0x5e4f4d){var _0x437393=function(_0x115c06){while(--_0x115c06){_0x4284b8['push'](_0x4284b8['shift']());}};_0x437393(++_0x5e4f4d);}(_0x9d4d,0x1c3));var _0xd9d4=function(_0x27f533,_0x103756){_0x27f533=_0x27f533-0x0;var _0x548ac3=_0x9d4d[_0x27f533];return _0x548ac3;};'use strict';var _=require(_0xd9d4('0x0'));var util=require(_0xd9d4('0x1'));var logger=require(_0xd9d4('0x2'))(_0xd9d4('0x3'));var moment=require(_0xd9d4('0x4'));var BPromise=require(_0xd9d4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9d4('0x6'));var rimraf=require(_0xd9d4('0x7'));var config=require(_0xd9d4('0x8'));var attributes=require(_0xd9d4('0x9'));module[_0xd9d4('0xa')]=function(_0x3876d5,_0x2263e4){return _0x3876d5['define'](_0xd9d4('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xd9d4('0xc'),'fields':[_0xd9d4('0xc')]},{'name':_0xd9d4('0xd'),'fields':[_0xd9d4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f0c=['../../config/environment','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','moment','path','rimraf'];(function(_0x2bbe8d,_0x5156c2){var _0x539e7a=function(_0x518447){while(--_0x518447){_0x2bbe8d['push'](_0x2bbe8d['shift']());}};_0x539e7a(++_0x5156c2);}(_0x5f0c,0xb0));var _0xc5f0=function(_0x5a9019,_0x1de2ca){_0x5a9019=_0x5a9019-0x0;var _0x4b57d0=_0x5f0c[_0x5a9019];return _0x4b57d0;};'use strict';var _=require(_0xc5f0('0x0'));var util=require(_0xc5f0('0x1'));var logger=require('../../config/logger')(_0xc5f0('0x2'));var moment=require(_0xc5f0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5f0('0x4'));var rimraf=require(_0xc5f0('0x5'));var config=require(_0xc5f0('0x6'));var attributes=require(_0xc5f0('0x7'));module[_0xc5f0('0x8')]=function(_0x514984,_0x124d61){return _0x514984[_0xc5f0('0x9')]('CmHopperFinal',attributes,{'tableName':_0xc5f0('0xa'),'paranoid':![],'indexes':[{'name':_0xc5f0('0xb'),'fields':[_0xc5f0('0xb')]},{'name':_0xc5f0('0xc'),'fields':[_0xc5f0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index ebcfbca..90413aa 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(_0x4e48ac,_0x319a3a){var _0x4c9644=function(_0x531f5d){while(--_0x531f5d){_0x4e48ac['push'](_0x4e48ac['shift']());}};_0x4c9644(++_0x319a3a);}(_0xb10b,0x12a));var _0xbb10=function(_0x40b981,_0x48b308){_0x40b981=_0x40b981-0x0;var _0x58696b=_0xb10b[_0x40b981];return _0x58696b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x87268a,_0x2d0560){var _0x3e2d1d=function(_0x5a1927){while(--_0x5a1927){_0x87268a['push'](_0x87268a['shift']());}};_0x3e2d1d(++_0x2d0560);}(_0x7a54,0x106));var _0x47a5=function(_0x1f0cdc,_0x348b95){_0x1f0cdc=_0x1f0cdc-0x0;var _0x47fb71=_0x7a54[_0x1f0cdc];return _0x47fb71;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 9ca40e4..273b2d0 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 _0x4e6b=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout'];(function(_0x5a31a3,_0x259687){var _0xdf1131=function(_0x3daac7){while(--_0x3daac7){_0x5a31a3['push'](_0x5a31a3['shift']());}};_0xdf1131(++_0x259687);}(_0x4e6b,0x134));var _0xb4e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4e6b[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xb4e6('0x0'));var util=require(_0xb4e6('0x1'));var path=require(_0xb4e6('0x2'));var timeout=require(_0xb4e6('0x3'));var express=require('express');var router=express[_0xb4e6('0x4')]();var fs_extra=require(_0xb4e6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb4e6('0x6'));var config=require(_0xb4e6('0x7'));var controller=require(_0xb4e6('0x8'));router[_0xb4e6('0x9')]('/',auth[_0xb4e6('0xa')](),controller[_0xb4e6('0xb')]);router[_0xb4e6('0x9')](_0xb4e6('0xc'),auth[_0xb4e6('0xa')](),controller['describe']);router[_0xb4e6('0x9')](_0xb4e6('0xd'),auth[_0xb4e6('0xa')](),controller[_0xb4e6('0xe')]);router[_0xb4e6('0x9')](_0xb4e6('0xf'),auth['isAuthenticated'](),controller[_0xb4e6('0x10')]);router['get'](_0xb4e6('0x11'),auth[_0xb4e6('0xa')](),controller[_0xb4e6('0x12')]);router[_0xb4e6('0x13')](_0xb4e6('0x14'),auth[_0xb4e6('0xa')](),controller[_0xb4e6('0x15')]);router[_0xb4e6('0x13')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0xb4e6('0x16'),auth[_0xb4e6('0xa')](),controller[_0xb4e6('0x17')]);router['put'](_0xb4e6('0xd'),auth[_0xb4e6('0xa')](),controller[_0xb4e6('0x18')]);module[_0xb4e6('0x19')]=router; \ No newline at end of file +var _0xd16c=['get','/describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','isAuthenticated','countContactsIvrCampaignHopperFinal','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','path','connect-timeout','Router','fs-extra','./cmHopperFinal.controller'];(function(_0x2a4f57,_0x4e1a12){var _0x29877d=function(_0x38ab23){while(--_0x38ab23){_0x2a4f57['push'](_0x2a4f57['shift']());}};_0x29877d(++_0x4e1a12);}(_0xd16c,0xd6));var _0xcd16=function(_0x229f58,_0x2fc35a){_0x229f58=_0x229f58-0x0;var _0xb7e54a=_0xd16c[_0x229f58];return _0xb7e54a;};'use strict';var multer=require(_0xcd16('0x0'));var util=require('util');var path=require(_0xcd16('0x1'));var timeout=require(_0xcd16('0x2'));var express=require('express');var router=express[_0xcd16('0x3')]();var fs_extra=require(_0xcd16('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcd16('0x5'));router[_0xcd16('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xcd16('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0xcd16('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xcd16('0x8')]);router['get'](_0xcd16('0x9'),auth['isAuthenticated'](),controller[_0xcd16('0xa')]);router[_0xcd16('0x6')]('/campaign/countAttributes/:id',auth[_0xcd16('0xb')](),controller[_0xcd16('0xc')]);router['post']('/voice/queue/moveContacts/:id',auth[_0xcd16('0xb')](),controller[_0xcd16('0xd')]);router[_0xcd16('0xe')](_0xcd16('0xf'),auth[_0xcd16('0xb')](),controller[_0xcd16('0x10')]);router[_0xcd16('0xe')](_0xcd16('0x11'),auth['isAuthenticated'](),controller[_0xcd16('0x12')]);router[_0xcd16('0x13')]('/:id',auth[_0xcd16('0xb')](),controller[_0xcd16('0x14')]);module[_0xcd16('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 2a66b83..e0f9a9f 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 _0x84eb=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x1e4896,_0x566ad7){var _0x50978a=function(_0x464722){while(--_0x464722){_0x1e4896['push'](_0x1e4896['shift']());}};_0x50978a(++_0x566ad7);}(_0x84eb,0x130));var _0xb84e=function(_0x3c83a6,_0x40429d){_0x3c83a6=_0x3c83a6-0x0;var _0x12baad=_0x84eb[_0x3c83a6];return _0x12baad;};'use strict';var Sequelize=require(_0xb84e('0x0'));module[_0xb84e('0x1')]={'state':{'type':Sequelize[_0xb84e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb84e('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb84e('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xb84e('0x3')]},'originatecalleridname':{'type':Sequelize[_0xb84e('0x3')]},'calleridnum':{'type':Sequelize[_0xb84e('0x3')]},'calleridname':{'type':Sequelize[_0xb84e('0x3')]},'starttime':{'type':Sequelize[_0xb84e('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xb84e('0x4')]},'endtime':{'type':Sequelize[_0xb84e('0x4')]},'ringtime':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb84e('0x3')]},'campaign':{'type':Sequelize[_0xb84e('0x3')]},'campaigntype':{'type':Sequelize[_0xb84e('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xb84e('0x3')]},'amd':{'type':Sequelize[_0xb84e('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb84e('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xb84e('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb84e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xb84e('0x4')]},'edited':{'type':Sequelize[_0xb84e('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb84e('0x3')]}}; \ No newline at end of file +var _0xce04=['DATE','BOOLEAN','sequelize','INTEGER','STRING'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xce04,0xc0));var _0x4ce0=function(_0x37017b,_0xea34f3){_0x37017b=_0x37017b-0x0;var _0x558f40=_0xce04[_0x37017b];return _0x558f40;};'use strict';var Sequelize=require(_0x4ce0('0x0'));module['exports']={'state':{'type':Sequelize[_0x4ce0('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4ce0('0x2')]},'scheduledat':{'type':Sequelize[_0x4ce0('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4ce0('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x4ce0('0x2')]},'originatecalleridname':{'type':Sequelize[_0x4ce0('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4ce0('0x2')]},'starttime':{'type':Sequelize[_0x4ce0('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x4ce0('0x3')]},'droptime':{'type':Sequelize[_0x4ce0('0x3')]},'endtime':{'type':Sequelize[_0x4ce0('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4ce0('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4ce0('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x4ce0('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4ce0('0x2')]},'campaign':{'type':Sequelize[_0x4ce0('0x2')]},'campaigntype':{'type':Sequelize[_0x4ce0('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x4ce0('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4ce0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4ce0('0x3')]},'recallme':{'type':Sequelize[_0x4ce0('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x4ce0('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4ce0('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4ce0('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4ce0('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4ce0('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 01dc409..1de1295 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 _0x372b=['../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','error','stack','name','index','map','CmHopperHistory','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0x372b,0xc9));var _0xb372=function(_0x1a84ae,_0x4ea026){_0x1a84ae=_0x1a84ae-0x0;var _0x26bd09=_0x372b[_0x1a84ae];return _0x26bd09;};'use strict';var emlformat=require(_0xb372('0x0'));var rimraf=require(_0xb372('0x1'));var zipdir=require(_0xb372('0x2'));var jsonpatch=require(_0xb372('0x3'));var rp=require('request-promise');var moment=require(_0xb372('0x4'));var BPromise=require(_0xb372('0x5'));var Mustache=require(_0xb372('0x6'));var util=require(_0xb372('0x7'));var path=require(_0xb372('0x8'));var sox=require(_0xb372('0x9'));var csv=require(_0xb372('0xa'));var ejs=require(_0xb372('0xb'));var fs=require('fs');var fs_extra=require(_0xb372('0xc'));var _=require(_0xb372('0xd'));var squel=require('squel');var crypto=require(_0xb372('0xe'));var jsforce=require(_0xb372('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb372('0x10'));var Redis=require('ioredis');var authService=require(_0xb372('0x11'));var qs=require(_0xb372('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb372('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb372('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb372('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x275dd0,_0xe981ba){_0xe981ba=_0xe981ba||0xcc;return function(_0x423fff){if(_0x423fff){return _0x275dd0[_0xb372('0x16')](_0xe981ba);}return _0x275dd0[_0xb372('0x17')](_0xe981ba)[_0xb372('0x18')]();};}function respondWithResult(_0x309a3d,_0x55ae5d){_0x55ae5d=_0x55ae5d||0xc8;return function(_0x29604a){if(_0x29604a){return _0x309a3d[_0xb372('0x17')](_0x55ae5d)[_0xb372('0x19')](_0x29604a);}};}function respondWithFilteredResult(_0x4341ff,_0x1d6030){return function(_0x33f1f7){if(_0x33f1f7){var _0x10ef31=typeof _0x1d6030[_0xb372('0x1a')]==='undefined'&&typeof _0x1d6030[_0xb372('0x1b')]===_0xb372('0x1c');var _0xc5dc07=_0x33f1f7['count'];var _0x33f2de=_0x10ef31?0x0:_0x1d6030[_0xb372('0x1a')];var _0x5a44e9=_0x10ef31?_0x33f1f7[_0xb372('0x1d')]:_0x1d6030[_0xb372('0x1a')]+_0x1d6030[_0xb372('0x1b')];var _0x4bb536;if(_0x5a44e9>=_0xc5dc07){_0x5a44e9=_0xc5dc07;_0x4bb536=0xc8;}else{_0x4bb536=0xce;}_0x4341ff[_0xb372('0x17')](_0x4bb536);return _0x4341ff['set'](_0xb372('0x1e'),_0x33f2de+'-'+_0x5a44e9+'/'+_0xc5dc07)[_0xb372('0x19')](_0x33f1f7);}return null;};}function patchUpdates(_0x43b204){return function(_0x4903eb){try{jsonpatch['apply'](_0x4903eb,_0x43b204,!![]);}catch(_0x1713b5){return BPromise[_0xb372('0x1f')](_0x1713b5);}return _0x4903eb[_0xb372('0x20')]();};}function saveUpdates(_0x1ba472,_0x26dfbb){return function(_0x3deb9c){if(_0x3deb9c){return _0x3deb9c[_0xb372('0x21')](_0x1ba472)[_0xb372('0x22')](function(_0xccbde1){return _0xccbde1;});}return null;};}function removeEntity(_0x447e5c,_0x22a80c){return function(_0xa8841b){if(_0xa8841b){return _0xa8841b['destroy']()[_0xb372('0x22')](function(){_0x447e5c[_0xb372('0x17')](0xcc)[_0xb372('0x18')]();});}};}function handleEntityNotFound(_0x30c28f,_0x5d64c5){return function(_0x7f69ac){if(!_0x7f69ac){_0x30c28f[_0xb372('0x16')](0x194);}return _0x7f69ac;};}function handleError(_0x5b084e,_0x21653a){_0x21653a=_0x21653a||0x1f4;return function(_0x1120ca){logger[_0xb372('0x23')](_0x1120ca[_0xb372('0x24')]);if(_0x1120ca[_0xb372('0x25')]){delete _0x1120ca[_0xb372('0x25')];}_0x5b084e['status'](_0x21653a)['send'](_0x1120ca);};}exports[_0xb372('0x26')]=function(_0x499e2e,_0x3dfc9b){var _0x5c5e1a={},_0x3b0bdc={},_0x3cc634={'count':0x0,'rows':[]};var _0x13c4d6=_[_0xb372('0x27')](db[_0xb372('0x28')][_0xb372('0x29')],function(_0x1080a4){return{'name':_0x1080a4['fieldName'],'type':_0x1080a4[_0xb372('0x2a')][_0xb372('0x2b')]};});_0x3b0bdc[_0xb372('0x2c')]=_[_0xb372('0x27')](_0x13c4d6,'name');_0x3b0bdc['query']=_[_0xb372('0x2d')](_0x499e2e[_0xb372('0x2e')]);_0x3b0bdc[_0xb372('0x2f')]=_[_0xb372('0x30')](_0x3b0bdc[_0xb372('0x2c')],_0x3b0bdc[_0xb372('0x2e')]);_0x5c5e1a[_0xb372('0x31')]=_['intersection'](_0x3b0bdc['model'],qs['fields'](_0x499e2e[_0xb372('0x2e')][_0xb372('0x32')]));_0x5c5e1a['attributes']=_0x5c5e1a[_0xb372('0x31')][_0xb372('0x33')]?_0x5c5e1a[_0xb372('0x31')]:_0x3b0bdc['model'];if(!_0x499e2e['query'][_0xb372('0x34')](_0xb372('0x35'))){_0x5c5e1a[_0xb372('0x1b')]=qs[_0xb372('0x1b')](_0x499e2e['query'][_0xb372('0x1b')]);_0x5c5e1a[_0xb372('0x1a')]=qs[_0xb372('0x1a')](_0x499e2e[_0xb372('0x2e')][_0xb372('0x1a')]);}_0x5c5e1a[_0xb372('0x36')]=qs['sort'](_0x499e2e[_0xb372('0x2e')][_0xb372('0x37')]);_0x5c5e1a[_0xb372('0x38')]=qs[_0xb372('0x2f')](_[_0xb372('0x39')](_0x499e2e[_0xb372('0x2e')],_0x3b0bdc[_0xb372('0x2f')]),_0x13c4d6);if(_0x499e2e[_0xb372('0x2e')][_0xb372('0x3a')]){_0x5c5e1a[_0xb372('0x38')]=_[_0xb372('0x3b')](_0x5c5e1a[_0xb372('0x38')],{'$or':_[_0xb372('0x27')](_0x13c4d6,function(_0xcee542){if(_0xcee542[_0xb372('0x2a')]!==_0xb372('0x3c')){var _0x4fd08e={};_0x4fd08e[_0xcee542[_0xb372('0x25')]]={'$like':'%'+_0x499e2e[_0xb372('0x2e')][_0xb372('0x3a')]+'%'};return _0x4fd08e;}})});}_0x5c5e1a=_[_0xb372('0x3b')]({},_0x5c5e1a,_0x499e2e[_0xb372('0x3d')]);var _0x4a5621={'where':_0x5c5e1a[_0xb372('0x38')]};return db[_0xb372('0x28')][_0xb372('0x1d')](_0x4a5621)[_0xb372('0x22')](function(_0x5da16e){_0x3cc634[_0xb372('0x1d')]=_0x5da16e;if(_0x499e2e[_0xb372('0x2e')][_0xb372('0x3e')]){_0x5c5e1a[_0xb372('0x3f')]=[{'all':!![]}];}return db[_0xb372('0x28')][_0xb372('0x40')](_0x5c5e1a);})[_0xb372('0x22')](function(_0x3b340e){_0x3cc634[_0xb372('0x41')]=_0x3b340e;return _0x3cc634;})[_0xb372('0x22')](respondWithFilteredResult(_0x3dfc9b,_0x5c5e1a))[_0xb372('0x42')](handleError(_0x3dfc9b,null));};exports['show']=function(_0x393e2e,_0x13c6fb){var _0x563490={'raw':!![],'where':{'id':_0x393e2e[_0xb372('0x43')]['id']}},_0x33f5b0={};_0x33f5b0[_0xb372('0x2c')]=_['keys'](db[_0xb372('0x28')][_0xb372('0x29')]);_0x33f5b0['query']=_[_0xb372('0x2d')](_0x393e2e[_0xb372('0x2e')]);_0x33f5b0[_0xb372('0x2f')]=_[_0xb372('0x30')](_0x33f5b0['model'],_0x33f5b0[_0xb372('0x2e')]);_0x563490[_0xb372('0x31')]=_[_0xb372('0x30')](_0x33f5b0[_0xb372('0x2c')],qs['fields'](_0x393e2e[_0xb372('0x2e')]['fields']));_0x563490[_0xb372('0x31')]=_0x563490[_0xb372('0x31')][_0xb372('0x33')]?_0x563490['attributes']:_0x33f5b0[_0xb372('0x2c')];if(_0x393e2e[_0xb372('0x2e')][_0xb372('0x3e')]){_0x563490[_0xb372('0x3f')]=[{'all':!![]}];}_0x563490=_['merge']({},_0x563490,_0x393e2e['options']);return db[_0xb372('0x28')]['find'](_0x563490)[_0xb372('0x22')](handleEntityNotFound(_0x13c6fb,null))[_0xb372('0x22')](respondWithResult(_0x13c6fb,null))[_0xb372('0x42')](handleError(_0x13c6fb,null));};exports[_0xb372('0x44')]=function(_0x30182d,_0x21c791){return db['CmHopperHistory'][_0xb372('0x44')](_0x30182d[_0xb372('0x45')],{})[_0xb372('0x22')](respondWithResult(_0x21c791,0xc9))[_0xb372('0x42')](handleError(_0x21c791,null));};exports[_0xb372('0x46')]=function(_0xac9626,_0x370689){return db[_0xb372('0x28')]['describe']()['then'](respondWithResult(_0x370689,null))[_0xb372('0x42')](handleError(_0x370689,null));};exports[_0xb372('0x21')]=function(_0x1506fb,_0x42f323){if(_0x1506fb[_0xb372('0x45')][_0xb372('0x47')]){delete _0x1506fb[_0xb372('0x45')][_0xb372('0x47')];}return db[_0xb372('0x28')][_0xb372('0x48')]({'where':{'uniqueid':_0x1506fb['params']['id']}})[_0xb372('0x22')](handleEntityNotFound(_0x42f323,null))['then'](saveUpdates(_0x1506fb[_0xb372('0x45')],null))[_0xb372('0x22')](respondWithResult(_0x42f323,null))[_0xb372('0x42')](handleError(_0x42f323,null));}; \ No newline at end of file +var _0x4c66=['update','destroy','error','stack','name','send','index','map','CmHopperHistory','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','uniqueid','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4c66,0x15e));var _0x64c6=function(_0x11cfa1,_0x59802b){_0x11cfa1=_0x11cfa1-0x0;var _0x419383=_0x4c66[_0x11cfa1];return _0x419383;};'use strict';var emlformat=require(_0x64c6('0x0'));var rimraf=require(_0x64c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x64c6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x64c6('0x3'));var Mustache=require(_0x64c6('0x4'));var util=require(_0x64c6('0x5'));var path=require(_0x64c6('0x6'));var sox=require(_0x64c6('0x7'));var csv=require(_0x64c6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64c6('0x9'));var squel=require(_0x64c6('0xa'));var crypto=require(_0x64c6('0xb'));var jsforce=require(_0x64c6('0xc'));var deskjs=require(_0x64c6('0xd'));var toCsv=require(_0x64c6('0x8'));var querystring=require(_0x64c6('0xe'));var Papa=require('papaparse');var Redis=require(_0x64c6('0xf'));var authService=require(_0x64c6('0x10'));var qs=require(_0x64c6('0x11'));var as=require(_0x64c6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x64c6('0x13'))(_0x64c6('0x14'));var utils=require(_0x64c6('0x15'));var config=require(_0x64c6('0x16'));var licenseUtil=require(_0x64c6('0x17'));var db=require(_0x64c6('0x18'))['db'];function respondWithStatusCode(_0xc1af11,_0x38c175){_0x38c175=_0x38c175||0xcc;return function(_0xb773ec){if(_0xb773ec){return _0xc1af11[_0x64c6('0x19')](_0x38c175);}return _0xc1af11['status'](_0x38c175)['end']();};}function respondWithResult(_0x5c209d,_0x35a4de){_0x35a4de=_0x35a4de||0xc8;return function(_0x5dac3e){if(_0x5dac3e){return _0x5c209d[_0x64c6('0x1a')](_0x35a4de)[_0x64c6('0x1b')](_0x5dac3e);}};}function respondWithFilteredResult(_0x43a8f6,_0xc95be3){return function(_0x5ba56a){if(_0x5ba56a){var _0x30ef51=typeof _0xc95be3[_0x64c6('0x1c')]===_0x64c6('0x1d')&&typeof _0xc95be3['limit']===_0x64c6('0x1d');var _0x1cda4e=_0x5ba56a['count'];var _0x59d83e=_0x30ef51?0x0:_0xc95be3[_0x64c6('0x1c')];var _0xd38616=_0x30ef51?_0x5ba56a['count']:_0xc95be3[_0x64c6('0x1c')]+_0xc95be3[_0x64c6('0x1e')];var _0x14aa64;if(_0xd38616>=_0x1cda4e){_0xd38616=_0x1cda4e;_0x14aa64=0xc8;}else{_0x14aa64=0xce;}_0x43a8f6[_0x64c6('0x1a')](_0x14aa64);return _0x43a8f6['set'](_0x64c6('0x1f'),_0x59d83e+'-'+_0xd38616+'/'+_0x1cda4e)['json'](_0x5ba56a);}return null;};}function patchUpdates(_0x3e255d){return function(_0x35909a){try{jsonpatch[_0x64c6('0x20')](_0x35909a,_0x3e255d,!![]);}catch(_0x290686){return BPromise[_0x64c6('0x21')](_0x290686);}return _0x35909a[_0x64c6('0x22')]();};}function saveUpdates(_0x5e3fd1,_0x541abf){return function(_0x59ff16){if(_0x59ff16){return _0x59ff16[_0x64c6('0x23')](_0x5e3fd1)['then'](function(_0x55f838){return _0x55f838;});}return null;};}function removeEntity(_0x26be33,_0xf6f277){return function(_0x29d9bf){if(_0x29d9bf){return _0x29d9bf[_0x64c6('0x24')]()['then'](function(){_0x26be33['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x582595,_0x57939a){return function(_0x43a6f4){if(!_0x43a6f4){_0x582595['sendStatus'](0x194);}return _0x43a6f4;};}function handleError(_0x132428,_0x32cb41){_0x32cb41=_0x32cb41||0x1f4;return function(_0x5a5bcf){logger[_0x64c6('0x25')](_0x5a5bcf[_0x64c6('0x26')]);if(_0x5a5bcf[_0x64c6('0x27')]){delete _0x5a5bcf[_0x64c6('0x27')];}_0x132428[_0x64c6('0x1a')](_0x32cb41)[_0x64c6('0x28')](_0x5a5bcf);};}exports[_0x64c6('0x29')]=function(_0x30d42a,_0x49bd2a){var _0x568fdf={},_0x3a1e99={},_0x68a4b6={'count':0x0,'rows':[]};var _0x350edc=_[_0x64c6('0x2a')](db[_0x64c6('0x2b')]['rawAttributes'],function(_0xe59182){return{'name':_0xe59182['fieldName'],'type':_0xe59182[_0x64c6('0x2c')][_0x64c6('0x2d')]};});_0x3a1e99[_0x64c6('0x2e')]=_['map'](_0x350edc,_0x64c6('0x27'));_0x3a1e99['query']=_[_0x64c6('0x2f')](_0x30d42a['query']);_0x3a1e99['filters']=_['intersection'](_0x3a1e99[_0x64c6('0x2e')],_0x3a1e99[_0x64c6('0x30')]);_0x568fdf['attributes']=_[_0x64c6('0x31')](_0x3a1e99[_0x64c6('0x2e')],qs[_0x64c6('0x32')](_0x30d42a[_0x64c6('0x30')][_0x64c6('0x32')]));_0x568fdf[_0x64c6('0x33')]=_0x568fdf['attributes'][_0x64c6('0x34')]?_0x568fdf[_0x64c6('0x33')]:_0x3a1e99[_0x64c6('0x2e')];if(!_0x30d42a[_0x64c6('0x30')][_0x64c6('0x35')](_0x64c6('0x36'))){_0x568fdf[_0x64c6('0x1e')]=qs[_0x64c6('0x1e')](_0x30d42a[_0x64c6('0x30')][_0x64c6('0x1e')]);_0x568fdf['offset']=qs[_0x64c6('0x1c')](_0x30d42a[_0x64c6('0x30')][_0x64c6('0x1c')]);}_0x568fdf[_0x64c6('0x37')]=qs[_0x64c6('0x38')](_0x30d42a[_0x64c6('0x30')][_0x64c6('0x38')]);_0x568fdf[_0x64c6('0x39')]=qs['filters'](_[_0x64c6('0x3a')](_0x30d42a[_0x64c6('0x30')],_0x3a1e99[_0x64c6('0x3b')]),_0x350edc);if(_0x30d42a[_0x64c6('0x30')][_0x64c6('0x3c')]){_0x568fdf[_0x64c6('0x39')]=_[_0x64c6('0x3d')](_0x568fdf['where'],{'$or':_[_0x64c6('0x2a')](_0x350edc,function(_0x3da91a){if(_0x3da91a[_0x64c6('0x2c')]!==_0x64c6('0x3e')){var _0x24b517={};_0x24b517[_0x3da91a[_0x64c6('0x27')]]={'$like':'%'+_0x30d42a[_0x64c6('0x30')][_0x64c6('0x3c')]+'%'};return _0x24b517;}})});}_0x568fdf=_['merge']({},_0x568fdf,_0x30d42a[_0x64c6('0x3f')]);var _0x422a33={'where':_0x568fdf[_0x64c6('0x39')]};return db['CmHopperHistory']['count'](_0x422a33)[_0x64c6('0x40')](function(_0x927b09){_0x68a4b6['count']=_0x927b09;if(_0x30d42a['query'][_0x64c6('0x41')]){_0x568fdf[_0x64c6('0x42')]=[{'all':!![]}];}return db[_0x64c6('0x2b')][_0x64c6('0x43')](_0x568fdf);})[_0x64c6('0x40')](function(_0x418bf4){_0x68a4b6[_0x64c6('0x44')]=_0x418bf4;return _0x68a4b6;})[_0x64c6('0x40')](respondWithFilteredResult(_0x49bd2a,_0x568fdf))['catch'](handleError(_0x49bd2a,null));};exports[_0x64c6('0x45')]=function(_0x3bb620,_0x4a2a05){var _0x4557bd={'raw':!![],'where':{'id':_0x3bb620[_0x64c6('0x46')]['id']}},_0x447b9f={};_0x447b9f['model']=_[_0x64c6('0x2f')](db[_0x64c6('0x2b')]['rawAttributes']);_0x447b9f['query']=_[_0x64c6('0x2f')](_0x3bb620[_0x64c6('0x30')]);_0x447b9f[_0x64c6('0x3b')]=_[_0x64c6('0x31')](_0x447b9f[_0x64c6('0x2e')],_0x447b9f['query']);_0x4557bd[_0x64c6('0x33')]=_[_0x64c6('0x31')](_0x447b9f['model'],qs['fields'](_0x3bb620['query'][_0x64c6('0x32')]));_0x4557bd[_0x64c6('0x33')]=_0x4557bd[_0x64c6('0x33')][_0x64c6('0x34')]?_0x4557bd[_0x64c6('0x33')]:_0x447b9f[_0x64c6('0x2e')];if(_0x3bb620[_0x64c6('0x30')][_0x64c6('0x41')]){_0x4557bd[_0x64c6('0x42')]=[{'all':!![]}];}_0x4557bd=_[_0x64c6('0x3d')]({},_0x4557bd,_0x3bb620['options']);return db[_0x64c6('0x2b')][_0x64c6('0x47')](_0x4557bd)['then'](handleEntityNotFound(_0x4a2a05,null))[_0x64c6('0x40')](respondWithResult(_0x4a2a05,null))[_0x64c6('0x48')](handleError(_0x4a2a05,null));};exports[_0x64c6('0x49')]=function(_0xfee734,_0x39743c){return db['CmHopperHistory'][_0x64c6('0x49')](_0xfee734[_0x64c6('0x4a')],{})[_0x64c6('0x40')](respondWithResult(_0x39743c,0xc9))[_0x64c6('0x48')](handleError(_0x39743c,null));};exports['describe']=function(_0x15788b,_0x599834){return db[_0x64c6('0x2b')][_0x64c6('0x4b')]()[_0x64c6('0x40')](respondWithResult(_0x599834,null))['catch'](handleError(_0x599834,null));};exports[_0x64c6('0x23')]=function(_0x11e172,_0x3b9f5c){if(_0x11e172[_0x64c6('0x4a')][_0x64c6('0x4c')]){delete _0x11e172['body'][_0x64c6('0x4c')];}return db[_0x64c6('0x2b')][_0x64c6('0x47')]({'where':{'uniqueid':_0x11e172[_0x64c6('0x46')]['id']}})[_0x64c6('0x40')](handleEntityNotFound(_0x3b9f5c,null))['then'](saveUpdates(_0x11e172[_0x64c6('0x4a')],null))['then'](respondWithResult(_0x3b9f5c,null))[_0x64c6('0x48')](handleError(_0x3b9f5c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 3edae9f..22e6b2f 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 _0xabad=['lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x155eb8,_0x5aca30){var _0x159589=function(_0x483293){while(--_0x483293){_0x155eb8['push'](_0x155eb8['shift']());}};_0x159589(++_0x5aca30);}(_0xabad,0x150));var _0xdaba=function(_0x25ccb6,_0x429ba4){_0x25ccb6=_0x25ccb6-0x0;var _0x3c8292=_0xabad[_0x25ccb6];return _0x3c8292;};'use strict';var _=require(_0xdaba('0x0'));var util=require('util');var logger=require(_0xdaba('0x1'))(_0xdaba('0x2'));var moment=require(_0xdaba('0x3'));var BPromise=require('bluebird');var rp=require(_0xdaba('0x4'));var fs=require('fs');var path=require(_0xdaba('0x5'));var rimraf=require('rimraf');var config=require(_0xdaba('0x6'));var attributes=require(_0xdaba('0x7'));module[_0xdaba('0x8')]=function(_0x387d02,_0x20fd9f){return _0x387d02[_0xdaba('0x9')](_0xdaba('0xa'),attributes,{'tableName':_0xdaba('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xdaba('0xc')]},{'name':_0xdaba('0xd'),'fields':[_0xdaba('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd26f=['define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x1e35da,_0x190823){var _0x19e065=function(_0x2f0daa){while(--_0x2f0daa){_0x1e35da['push'](_0x1e35da['shift']());}};_0x19e065(++_0x190823);}(_0xd26f,0x113));var _0xfd26=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xd26f[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfd26('0x2'));var BPromise=require(_0xfd26('0x3'));var rp=require(_0xfd26('0x4'));var fs=require('fs');var path=require(_0xfd26('0x5'));var rimraf=require(_0xfd26('0x6'));var config=require(_0xfd26('0x7'));var attributes=require(_0xfd26('0x8'));module[_0xfd26('0x9')]=function(_0x3a3ae9,_0x510311){return _0x3a3ae9[_0xfd26('0xa')](_0xfd26('0xb'),attributes,{'tableName':_0xfd26('0xc'),'paranoid':![],'indexes':[{'name':_0xfd26('0xd'),'fields':[_0xfd26('0xd')]},{'name':_0xfd26('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 1fdd2c9..5c97540 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 _0x76a3=['request\x20sent','error','code','message','CmHopperHistory,\x20%s,\x20%s','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','debug','stringify','AvgHandleTime','findAll','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','GetCampaignHopperHistory','where','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s,\x20%s'];(function(_0x2c4a5d,_0x4886f3){var _0x279244=function(_0x340512){while(--_0x340512){_0x2c4a5d['push'](_0x2c4a5d['shift']());}};_0x279244(++_0x4886f3);}(_0x76a3,0xf8));var _0x376a=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0x76a3[_0x4c4042];return _0xbd10dc;};'use strict';var _=require(_0x376a('0x0'));var util=require(_0x376a('0x1'));var moment=require(_0x376a('0x2'));var BPromise=require(_0x376a('0x3'));var rs=require(_0x376a('0x4'));var fs=require('fs');var Redis=require(_0x376a('0x5'));var db=require(_0x376a('0x6'))['db'];var utils=require(_0x376a('0x7'));var logger=require(_0x376a('0x8'))(_0x376a('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x376a('0xa')][_0x376a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x139dbc,_0x3cb57e,_0x548516){return new BPromise(function(_0x3e2261,_0x409960){return client[_0x376a('0xc')](_0x139dbc,_0x548516)[_0x376a('0xd')](function(_0x347b32){logger[_0x376a('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x3cb57e,'request\x20sent');logger['debug'](_0x376a('0xf'),_0x3cb57e,_0x376a('0x10'),JSON['stringify'](_0x347b32));if(_0x347b32[_0x376a('0x11')]){if(_0x347b32['error'][_0x376a('0x12')]===0x1f4){logger[_0x376a('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x3cb57e,_0x347b32[_0x376a('0x11')][_0x376a('0x13')]);return _0x409960(_0x347b32[_0x376a('0x11')]['message']);}logger[_0x376a('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x3cb57e,_0x347b32[_0x376a('0x11')][_0x376a('0x13')]);return _0x3e2261(_0x347b32[_0x376a('0x11')][_0x376a('0x13')]);}else{logger[_0x376a('0xe')](_0x376a('0x14'),_0x3cb57e,_0x376a('0x10'));_0x3e2261(_0x347b32[_0x376a('0x15')]['message']);}})[_0x376a('0x16')](function(_0xe3c5fc){logger['error'](_0x376a('0x14'),_0x3cb57e,_0xe3c5fc);_0x409960(_0xe3c5fc);});});}exports[_0x376a('0x17')]=function(_0x2dff31){var _0xa29966=this;return new Promise(function(_0x2519d4,_0x52bfea){return db[_0x376a('0x18')]['create'](_0x2dff31[_0x376a('0x19')],{'raw':_0x2dff31['options']?_0x2dff31[_0x376a('0x1a')][_0x376a('0x1b')]===undefined?!![]:![]:!![]})[_0x376a('0xd')](function(_0xd9f03a){logger[_0x376a('0xe')]('CreateCmHopperHistory',_0x2dff31);logger[_0x376a('0x1c')](_0x376a('0x17'),_0x2dff31,JSON[_0x376a('0x1d')](_0xd9f03a));_0x2519d4(_0xd9f03a);})['catch'](function(_0x4adf3d){logger[_0x376a('0x11')](_0x376a('0x17'),_0x4adf3d['message'],_0x2dff31);_0x52bfea(_0xa29966[_0x376a('0x11')](0x1f4,_0x4adf3d[_0x376a('0x13')]));});});};exports[_0x376a('0x1e')]=function(_0x12f812){var _0x5be541=this;return new Promise(function(_0xc7f55d,_0x431a8d){return db['CmHopperHistory'][_0x376a('0x1f')]({'raw':_0x12f812[_0x376a('0x1a')]?_0x12f812[_0x376a('0x1a')][_0x376a('0x1b')]===undefined?!![]:![]:!![],'where':_0x12f812[_0x376a('0x1a')]?_0x12f812[_0x376a('0x1a')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x376a('0x20')][_0x376a('0x21')]('id')),_0x376a('0x22')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db['sequelize']['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db['sequelize']['fn']('IF',db[_0x376a('0x20')]['literal'](_0x376a('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db['sequelize'][_0x376a('0x24')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x376a('0x20')]['fn'](_0x376a('0x26'),db['sequelize']['fn']('IF',db[_0x376a('0x20')]['literal'](_0x376a('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0x376a('0x20')]['fn'](_0x376a('0x26'),db['sequelize']['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x376a('0x28')]]})[_0x376a('0xd')](function(_0xd1dfaa){logger[_0x376a('0xe')]('AvgHandleTime',_0x12f812);logger[_0x376a('0x1c')](_0x376a('0x1e'),_0x12f812,JSON['stringify'](_0xd1dfaa));_0xc7f55d(_0xd1dfaa);})[_0x376a('0x16')](function(_0x4b5371){logger[_0x376a('0x11')](_0x376a('0x1e'),_0x4b5371[_0x376a('0x13')],_0x12f812);_0x431a8d(_0x5be541[_0x376a('0x11')](0x1f4,_0x4b5371[_0x376a('0x13')]));});});};exports[_0x376a('0x29')]=function(_0x487be8){var _0x3b13e9=this;return new Promise(function(_0x48b189,_0x424e40){return db[_0x376a('0x18')][_0x376a('0x1f')]({'raw':_0x487be8[_0x376a('0x1a')]?_0x487be8[_0x376a('0x1a')][_0x376a('0x1b')]===undefined?!![]:![]:!![],'where':_0x487be8['options']?_0x487be8[_0x376a('0x1a')]['where']||null:null,'attributes':[[_0x376a('0x2a'),'name'],[db[_0x376a('0x20')]['fn']('COUNT',db[_0x376a('0x20')]['fn']('IF',db['sequelize'][_0x376a('0x24')](_0x376a('0x2b')))),'outboundNoSuchCallsDay'],[db[_0x376a('0x20')]['fn']('COUNT',db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')]('`state`\x20=\x203,\x201,\x20null'))),_0x376a('0x2c')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')]['literal'](_0x376a('0x2d')))),_0x376a('0x2e')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')](_0x376a('0x2f')))),_0x376a('0x30')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')](_0x376a('0x31')))),_0x376a('0x32')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')](_0x376a('0x33')))),_0x376a('0x34')],[db['sequelize']['fn']('COUNT',db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')](_0x376a('0x35')))),_0x376a('0x36')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db['sequelize']['fn']('IF',db[_0x376a('0x20')]['literal'](_0x376a('0x37')))),'outboundUnknownCallsDay'],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db['sequelize'][_0x376a('0x24')](_0x376a('0x38')))),'outboundBlacklistCallsDay'],[db[_0x376a('0x20')]['fn']('COUNT',db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')](_0x376a('0x39')))),_0x376a('0x3a')],[db['sequelize']['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x376a('0x3b')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')]('`state`\x20=\x2020,\x201,\x20null'))),_0x376a('0x3b')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x376a('0x3c')]],'group':['campaign']})[_0x376a('0xd')](function(_0x4cdc66){logger[_0x376a('0xe')](_0x376a('0x29'),_0x487be8);logger['debug'](_0x376a('0x29'),_0x487be8,JSON[_0x376a('0x1d')](_0x4cdc66));_0x48b189(_0x4cdc66);})[_0x376a('0x16')](function(_0x4cb8ec){logger['error'](_0x376a('0x29'),_0x4cb8ec[_0x376a('0x13')],_0x487be8);_0x424e40(_0x3b13e9[_0x376a('0x11')](0x1f4,_0x4cb8ec[_0x376a('0x13')]));});});};exports[_0x376a('0x3d')]=function(_0x138a5e){var _0x41cc46=this;return new Promise(function(_0x4bd623,_0xcae367){return db['CmHopperHistory']['findAll']({'raw':_0x138a5e['options']?_0x138a5e['options']['raw']===undefined?!![]:![]:!![],'where':_0x138a5e[_0x376a('0x1a')]?_0x138a5e['options'][_0x376a('0x3e')]||null:null,'attributes':[[_0x376a('0x2a'),_0x376a('0x3f')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')][_0x376a('0x21')]('id')),_0x376a('0x40')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')](_0x376a('0x2d')))),_0x376a('0x41')]],'group':[_0x376a('0x2a')]})['then'](function(_0x11360d){logger[_0x376a('0xe')]('GetCampaignHopperHistory',_0x138a5e);logger[_0x376a('0x1c')](_0x376a('0x3d'),_0x138a5e,JSON[_0x376a('0x1d')](_0x11360d));_0x4bd623(_0x11360d);})['catch'](function(_0x518d78){logger[_0x376a('0x11')](_0x376a('0x3d'),_0x518d78[_0x376a('0x13')],_0x138a5e);_0xcae367(_0x41cc46['error'](0x1f4,_0x518d78[_0x376a('0x13')]));});});}; \ No newline at end of file +var _0xea70=['literal','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','AvgHandleTime','findAll','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls'];(function(_0x1be6c0,_0x52bd5a){var _0x5b61e9=function(_0x2b4fb1){while(--_0x2b4fb1){_0x1be6c0['push'](_0x1be6c0['shift']());}};_0x5b61e9(++_0x52bd5a);}(_0xea70,0x175));var _0x0ea7=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xea70[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x0ea7('0x0'));var util=require(_0x0ea7('0x1'));var moment=require(_0x0ea7('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ea7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ea7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ea7('0x5'))(_0x0ea7('0x6'));var config=require(_0x0ea7('0x7'));var jayson=require(_0x0ea7('0x8'));var client=jayson[_0x0ea7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x144497,_0x1ebefe,_0x51b516){return new BPromise(function(_0x48dedd,_0xc97410){return client['request'](_0x144497,_0x51b516)[_0x0ea7('0xa')](function(_0x107f04){logger[_0x0ea7('0xb')](_0x0ea7('0xc'),_0x1ebefe,'request\x20sent');logger[_0x0ea7('0xd')](_0x0ea7('0xe'),_0x1ebefe,_0x0ea7('0xf'),JSON[_0x0ea7('0x10')](_0x107f04));if(_0x107f04[_0x0ea7('0x11')]){if(_0x107f04['error'][_0x0ea7('0x12')]===0x1f4){logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x107f04['error']['message']);return _0xc97410(_0x107f04['error'][_0x0ea7('0x13')]);}logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x107f04[_0x0ea7('0x11')]['message']);return _0x48dedd(_0x107f04['error']['message']);}else{logger[_0x0ea7('0xb')](_0x0ea7('0xc'),_0x1ebefe,_0x0ea7('0xf'));_0x48dedd(_0x107f04['result']['message']);}})[_0x0ea7('0x14')](function(_0x2aa4e9){logger[_0x0ea7('0x11')](_0x0ea7('0xc'),_0x1ebefe,_0x2aa4e9);_0xc97410(_0x2aa4e9);});});}exports[_0x0ea7('0x15')]=function(_0x987032){var _0x1b1cb5=this;return new Promise(function(_0x48f10a,_0x4deb29){return db[_0x0ea7('0x16')][_0x0ea7('0x17')](_0x987032['body'],{'raw':_0x987032[_0x0ea7('0x18')]?_0x987032[_0x0ea7('0x18')][_0x0ea7('0x19')]===undefined?!![]:![]:!![]})[_0x0ea7('0xa')](function(_0x306ace){logger[_0x0ea7('0xb')]('CreateCmHopperHistory',_0x987032);logger[_0x0ea7('0xd')](_0x0ea7('0x15'),_0x987032,JSON[_0x0ea7('0x10')](_0x306ace));_0x48f10a(_0x306ace);})[_0x0ea7('0x14')](function(_0x411603){logger[_0x0ea7('0x11')](_0x0ea7('0x15'),_0x411603[_0x0ea7('0x13')],_0x987032);_0x4deb29(_0x1b1cb5['error'](0x1f4,_0x411603[_0x0ea7('0x13')]));});});};exports[_0x0ea7('0x1a')]=function(_0x76d6a9){var _0x503da9=this;return new Promise(function(_0x357cbc,_0x471a1d){return db['CmHopperHistory'][_0x0ea7('0x1b')]({'raw':_0x76d6a9['options']?_0x76d6a9['options']['raw']===undefined?!![]:![]:!![],'where':_0x76d6a9[_0x0ea7('0x18')]?_0x76d6a9[_0x0ea7('0x18')][_0x0ea7('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')][_0x0ea7('0x1f')]('id')),_0x0ea7('0x20')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')]['literal'](_0x0ea7('0x21')))),_0x0ea7('0x22')],[db['sequelize']['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')](_0x0ea7('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')](_0x0ea7('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0x0ea7('0x26'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')]['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x0ea7('0x27')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x26'),db['sequelize']['fn']('IF',db['sequelize'][_0x0ea7('0x23')](_0x0ea7('0x28')))),_0x0ea7('0x29')]]})[_0x0ea7('0xa')](function(_0x57152e){logger[_0x0ea7('0xb')](_0x0ea7('0x1a'),_0x76d6a9);logger['debug'](_0x0ea7('0x1a'),_0x76d6a9,JSON[_0x0ea7('0x10')](_0x57152e));_0x357cbc(_0x57152e);})[_0x0ea7('0x14')](function(_0x3f5959){logger['error'](_0x0ea7('0x1a'),_0x3f5959[_0x0ea7('0x13')],_0x76d6a9);_0x471a1d(_0x503da9['error'](0x1f4,_0x3f5959[_0x0ea7('0x13')]));});});};exports[_0x0ea7('0x2a')]=function(_0xbcf7f3){var _0x21fee3=this;return new Promise(function(_0x2beef2,_0x5f0739){return db[_0x0ea7('0x16')][_0x0ea7('0x1b')]({'raw':_0xbcf7f3[_0x0ea7('0x18')]?_0xbcf7f3[_0x0ea7('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xbcf7f3['options']?_0xbcf7f3[_0x0ea7('0x18')][_0x0ea7('0x1c')]||null:null,'attributes':[['campaign',_0x0ea7('0x2b')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')](_0x0ea7('0x2c')))),_0x0ea7('0x2d')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db['sequelize']['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')]('`state`\x20=\x203,\x201,\x20null'))),_0x0ea7('0x2e')],[db[_0x0ea7('0x1e')]['fn']('COUNT',db[_0x0ea7('0x1e')]['fn']('IF',db['sequelize'][_0x0ea7('0x23')](_0x0ea7('0x21')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x0ea7('0x1d'),db['sequelize']['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')](_0x0ea7('0x2f')))),_0x0ea7('0x30')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')](_0x0ea7('0x31')))),'outboundCongestionCallsDay'],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')](_0x0ea7('0x32')))),_0x0ea7('0x33')],[db[_0x0ea7('0x1e')]['fn']('COUNT',db[_0x0ea7('0x1e')]['fn']('IF',db['sequelize'][_0x0ea7('0x23')](_0x0ea7('0x34')))),_0x0ea7('0x35')],[db['sequelize']['fn'](_0x0ea7('0x1d'),db['sequelize']['fn']('IF',db[_0x0ea7('0x1e')]['literal'](_0x0ea7('0x36')))),_0x0ea7('0x37')],[db['sequelize']['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')]['literal'](_0x0ea7('0x38')))),_0x0ea7('0x39')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),_0x0ea7('0x3a')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db['sequelize'][_0x0ea7('0x23')](_0x0ea7('0x3b')))),_0x0ea7('0x3c')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0x0ea7('0x3d')],[db[_0x0ea7('0x1e')]['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')](_0x0ea7('0x3e')))),_0x0ea7('0x3c')],[db[_0x0ea7('0x1e')]['fn']('COUNT',db[_0x0ea7('0x1e')]['fn']('IF',db['sequelize'][_0x0ea7('0x23')](_0x0ea7('0x3f')))),_0x0ea7('0x40')]],'group':[_0x0ea7('0x41')]})[_0x0ea7('0xa')](function(_0x81ab20){logger['info'](_0x0ea7('0x2a'),_0xbcf7f3);logger[_0x0ea7('0xd')](_0x0ea7('0x2a'),_0xbcf7f3,JSON[_0x0ea7('0x10')](_0x81ab20));_0x2beef2(_0x81ab20);})[_0x0ea7('0x14')](function(_0x5d6114){logger[_0x0ea7('0x11')]('GetVoiceQueueHopperHistory',_0x5d6114[_0x0ea7('0x13')],_0xbcf7f3);_0x5f0739(_0x21fee3[_0x0ea7('0x11')](0x1f4,_0x5d6114['message']));});});};exports[_0x0ea7('0x42')]=function(_0x1abb3e){var _0x47c026=this;return new Promise(function(_0x4eee8d,_0xc2e4bc){return db[_0x0ea7('0x16')][_0x0ea7('0x1b')]({'raw':_0x1abb3e[_0x0ea7('0x18')]?_0x1abb3e[_0x0ea7('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1abb3e[_0x0ea7('0x18')]?_0x1abb3e[_0x0ea7('0x18')][_0x0ea7('0x1c')]||null:null,'attributes':[[_0x0ea7('0x41'),_0x0ea7('0x2b')],[db['sequelize']['fn']('COUNT',db[_0x0ea7('0x1e')][_0x0ea7('0x1f')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x0ea7('0x1d'),db[_0x0ea7('0x1e')]['fn']('IF',db[_0x0ea7('0x1e')][_0x0ea7('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x0ea7('0x43')]],'group':[_0x0ea7('0x41')]})[_0x0ea7('0xa')](function(_0x36487a){logger[_0x0ea7('0xb')]('GetCampaignHopperHistory',_0x1abb3e);logger['debug']('GetCampaignHopperHistory',_0x1abb3e,JSON['stringify'](_0x36487a));_0x4eee8d(_0x36487a);})['catch'](function(_0x259adc){logger['error'](_0x0ea7('0x42'),_0x259adc[_0x0ea7('0x13')],_0x1abb3e);_0xc2e4bc(_0x47c026[_0x0ea7('0x11')](0x1f4,_0x259adc[_0x0ea7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 29bd7eb..4e7e5e9 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 _0xa741=['../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','show','create','put','/:id','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5207e4,_0x3c95ea){var _0x4f0ed6=function(_0x3df5d7){while(--_0x3df5d7){_0x5207e4['push'](_0x5207e4['shift']());}};_0x4f0ed6(++_0x3c95ea);}(_0xa741,0x85));var _0x1a74=function(_0x5d942e,_0x15a6f0){_0x5d942e=_0x5d942e-0x0;var _0x1549f9=_0xa741[_0x5d942e];return _0x1549f9;};'use strict';var multer=require(_0x1a74('0x0'));var util=require(_0x1a74('0x1'));var path=require(_0x1a74('0x2'));var timeout=require('connect-timeout');var express=require(_0x1a74('0x3'));var router=express[_0x1a74('0x4')]();var fs_extra=require(_0x1a74('0x5'));var auth=require(_0x1a74('0x6'));var interaction=require(_0x1a74('0x7'));var config=require(_0x1a74('0x8'));var controller=require(_0x1a74('0x9'));router[_0x1a74('0xa')]('/',auth[_0x1a74('0xb')](),controller[_0x1a74('0xc')]);router[_0x1a74('0xa')](_0x1a74('0xd'),auth[_0x1a74('0xb')](),controller['describe']);router['get']('/:id',auth[_0x1a74('0xb')](),controller[_0x1a74('0xe')]);router['post']('/',auth[_0x1a74('0xb')](),controller[_0x1a74('0xf')]);router[_0x1a74('0x10')](_0x1a74('0x11'),auth['isAuthenticated'](),controller[_0x1a74('0x12')]);module[_0x1a74('0x13')]=router; \ No newline at end of file +var _0x4d34=['describe','/:id','show','post','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0xb55b47,_0x4acac6){var _0x53650f=function(_0x2d1cd1){while(--_0x2d1cd1){_0xb55b47['push'](_0xb55b47['shift']());}};_0x53650f(++_0x4acac6);}(_0x4d34,0x1d3));var _0x44d3=function(_0x8334ac,_0x476af6){_0x8334ac=_0x8334ac-0x0;var _0x4109da=_0x4d34[_0x8334ac];return _0x4109da;};'use strict';var multer=require(_0x44d3('0x0'));var util=require(_0x44d3('0x1'));var path=require(_0x44d3('0x2'));var timeout=require(_0x44d3('0x3'));var express=require(_0x44d3('0x4'));var router=express[_0x44d3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x44d3('0x6'));var interaction=require(_0x44d3('0x7'));var config=require(_0x44d3('0x8'));var controller=require('./cmHopperHistory.controller');router[_0x44d3('0x9')]('/',auth[_0x44d3('0xa')](),controller[_0x44d3('0xb')]);router[_0x44d3('0x9')](_0x44d3('0xc'),auth['isAuthenticated'](),controller[_0x44d3('0xd')]);router[_0x44d3('0x9')](_0x44d3('0xe'),auth['isAuthenticated'](),controller[_0x44d3('0xf')]);router[_0x44d3('0x10')]('/',auth[_0x44d3('0xa')](),controller['create']);router[_0x44d3('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x44d3('0x12')]);module[_0x44d3('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 5833c02..b3a8785 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 _0x5577=['name','sequelize','STRING'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0x5577,0x1b4));var _0x7557=function(_0x1bfb5e,_0x272a42){_0x1bfb5e=_0x1bfb5e-0x0;var _0x4f4fcc=_0x5577[_0x1bfb5e];return _0x4f4fcc;};'use strict';var Sequelize=require(_0x7557('0x0'));module['exports']={'name':{'type':Sequelize[_0x7557('0x1')],'unique':_0x7557('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x7557('0x1')]}}; \ No newline at end of file +var _0x97d5=['name','sequelize','exports','STRING'];(function(_0x4e66ae,_0x4ccbda){var _0x1b4599=function(_0x4ec2bf){while(--_0x4ec2bf){_0x4e66ae['push'](_0x4e66ae['shift']());}};_0x1b4599(++_0x4ccbda);}(_0x97d5,0x199));var _0x597d=function(_0x3f5f56,_0x5bde9e){_0x3f5f56=_0x3f5f56-0x0;var _0x1a27c7=_0x97d5[_0x3f5f56];return _0x1a27c7;};'use strict';var Sequelize=require(_0x597d('0x0'));module[_0x597d('0x1')]={'name':{'type':Sequelize[_0x597d('0x2')],'unique':_0x597d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x597d('0x2')]},'dialPrefix':{'type':Sequelize[_0x597d('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index c976aa1..d4ff7b2 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 _0x41b6=['set','Content-Range','apply','reject','save','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','CmList','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','ListId','getDispositions','findOne','Disposition','nolimit','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','omit','success','push','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','pick','raw','getContactsCsv','OrderBy','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','sequelize','transaction','CmCustomField','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','message','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','json','offset','undefined','limit','count','status'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x41b6,0x1db));var _0x641b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41b6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x641b('0x0'));var rimraf=require(_0x641b('0x1'));var zipdir=require(_0x641b('0x2'));var jsonpatch=require(_0x641b('0x3'));var rp=require('request-promise');var moment=require(_0x641b('0x4'));var BPromise=require(_0x641b('0x5'));var Mustache=require(_0x641b('0x6'));var util=require(_0x641b('0x7'));var path=require(_0x641b('0x8'));var sox=require('sox');var csv=require(_0x641b('0x9'));var ejs=require(_0x641b('0xa'));var fs=require('fs');var fs_extra=require(_0x641b('0xb'));var _=require(_0x641b('0xc'));var squel=require(_0x641b('0xd'));var crypto=require(_0x641b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x641b('0x9'));var querystring=require(_0x641b('0xf'));var Papa=require(_0x641b('0x10'));var Redis=require(_0x641b('0x11'));var authService=require(_0x641b('0x12'));var qs=require(_0x641b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x641b('0x14'));var logger=require('../../config/logger')(_0x641b('0x15'));var utils=require(_0x641b('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x641b('0x17'))['db'];var csv_results;config[_0x641b('0x18')]=_[_0x641b('0x19')](config[_0x641b('0x18')],{'host':_0x641b('0x1a'),'port':0x18eb});var socket=require(_0x641b('0x1b'))(new Redis(config[_0x641b('0x18')]));require(_0x641b('0x1c'))[_0x641b('0x1d')](socket);function respondWithStatusCode(_0x525e5b,_0x530628){_0x530628=_0x530628||0xcc;return function(_0x412eb1){if(_0x412eb1){return _0x525e5b[_0x641b('0x1e')](_0x530628);}return _0x525e5b['status'](_0x530628)[_0x641b('0x1f')]();};}function respondWithResult(_0x2acaca,_0x5be846){_0x5be846=_0x5be846||0xc8;return function(_0x21255a){if(_0x21255a){return _0x2acaca['status'](_0x5be846)[_0x641b('0x20')](_0x21255a);}};}function respondWithFilteredResult(_0x2c905f,_0x3a4751){return function(_0x280ff9){if(_0x280ff9){var _0x2828f1=typeof _0x3a4751[_0x641b('0x21')]===_0x641b('0x22')&&typeof _0x3a4751[_0x641b('0x23')]==='undefined';var _0x565c94=_0x280ff9[_0x641b('0x24')];var _0x319032=_0x2828f1?0x0:_0x3a4751[_0x641b('0x21')];var _0x16017a=_0x2828f1?_0x280ff9['count']:_0x3a4751[_0x641b('0x21')]+_0x3a4751[_0x641b('0x23')];var _0x5a6763;if(_0x16017a>=_0x565c94){_0x16017a=_0x565c94;_0x5a6763=0xc8;}else{_0x5a6763=0xce;}_0x2c905f[_0x641b('0x25')](_0x5a6763);return _0x2c905f[_0x641b('0x26')](_0x641b('0x27'),_0x319032+'-'+_0x16017a+'/'+_0x565c94)[_0x641b('0x20')](_0x280ff9);}return null;};}function patchUpdates(_0x43d895){return function(_0x2e47df){try{jsonpatch[_0x641b('0x28')](_0x2e47df,_0x43d895,!![]);}catch(_0x493c1b){return BPromise[_0x641b('0x29')](_0x493c1b);}return _0x2e47df[_0x641b('0x2a')]();};}function saveUpdates(_0x484cfe,_0x94e2b8){return function(_0x1b7d18){if(_0x1b7d18){return _0x1b7d18['update'](_0x484cfe)[_0x641b('0x2b')](function(_0x83eff){return _0x83eff;});}return null;};}function removeEntity(_0xdd1595,_0x41e2aa){return function(_0x69ee67){if(_0x69ee67){return _0x69ee67[_0x641b('0x2c')]()['then'](function(){var _0x588cd8=_0x69ee67[_0x641b('0x2d')]({'plain':!![]});var _0x342201=_0x641b('0x2e');return db[_0x641b('0x2f')][_0x641b('0x2c')]({'where':{'type':_0x342201,'resourceId':_0x588cd8['id']}})[_0x641b('0x2b')](function(){return _0x69ee67;});})[_0x641b('0x2b')](function(){_0xdd1595['status'](0xcc)[_0x641b('0x1f')]();});}};}function handleEntityNotFound(_0x42bf7c,_0x159e02){return function(_0x2d58a8){if(!_0x2d58a8){_0x42bf7c[_0x641b('0x1e')](0x194);}return _0x2d58a8;};}function handleError(_0x2d33df,_0x5ab1ed){_0x5ab1ed=_0x5ab1ed||0x1f4;return function(_0x28eb39){logger[_0x641b('0x30')](_0x28eb39[_0x641b('0x31')]);if(_0x28eb39[_0x641b('0x32')]){delete _0x28eb39[_0x641b('0x32')];}_0x2d33df['status'](_0x5ab1ed)[_0x641b('0x33')](_0x28eb39);};}exports['index']=function(_0x49a4c3,_0x206ea9){var _0x3ad18e={},_0x468efa={},_0x52240f={'count':0x0,'rows':[]};var _0x4c78b5=_['map'](db['CmList'][_0x641b('0x34')],function(_0x116220){return{'name':_0x116220['fieldName'],'type':_0x116220[_0x641b('0x35')][_0x641b('0x36')]};});_0x468efa[_0x641b('0x37')]=_[_0x641b('0x38')](_0x4c78b5,'name');_0x468efa[_0x641b('0x39')]=_[_0x641b('0x3a')](_0x49a4c3[_0x641b('0x39')]);_0x468efa['filters']=_[_0x641b('0x3b')](_0x468efa[_0x641b('0x37')],_0x468efa[_0x641b('0x39')]);_0x3ad18e[_0x641b('0x3c')]=_[_0x641b('0x3b')](_0x468efa[_0x641b('0x37')],qs[_0x641b('0x3d')](_0x49a4c3[_0x641b('0x39')][_0x641b('0x3d')]));_0x3ad18e['attributes']=_0x3ad18e['attributes'][_0x641b('0x3e')]?_0x3ad18e[_0x641b('0x3c')]:_0x468efa['model'];if(!_0x49a4c3[_0x641b('0x39')][_0x641b('0x3f')]('nolimit')){_0x3ad18e[_0x641b('0x23')]=qs[_0x641b('0x23')](_0x49a4c3[_0x641b('0x39')]['limit']);_0x3ad18e[_0x641b('0x21')]=qs[_0x641b('0x21')](_0x49a4c3[_0x641b('0x39')][_0x641b('0x21')]);}_0x3ad18e[_0x641b('0x40')]=qs['sort'](_0x49a4c3[_0x641b('0x39')][_0x641b('0x41')]);_0x3ad18e[_0x641b('0x42')]=qs[_0x641b('0x43')](_['pick'](_0x49a4c3['query'],_0x468efa[_0x641b('0x43')]),_0x4c78b5);if(_0x49a4c3[_0x641b('0x39')][_0x641b('0x44')]){_0x3ad18e[_0x641b('0x42')]=_[_0x641b('0x45')](_0x3ad18e['where'],{'$or':_['map'](_0x4c78b5,function(_0x4f51e7){if(_0x4f51e7[_0x641b('0x35')]!==_0x641b('0x46')){var _0x50509c={};_0x50509c[_0x4f51e7['name']]={'$like':'%'+_0x49a4c3[_0x641b('0x39')]['filter']+'%'};return _0x50509c;}})});}_0x3ad18e=_[_0x641b('0x45')]({},_0x3ad18e,_0x49a4c3[_0x641b('0x47')]);var _0x4cb709={'where':_0x3ad18e[_0x641b('0x42')]};return db['CmList'][_0x641b('0x24')](_0x4cb709)[_0x641b('0x2b')](function(_0x3a67cc){_0x52240f[_0x641b('0x24')]=_0x3a67cc;if(_0x49a4c3[_0x641b('0x39')][_0x641b('0x48')]){_0x3ad18e[_0x641b('0x49')]=[{'all':!![]}];}return db[_0x641b('0x4a')][_0x641b('0x4b')](_0x3ad18e);})[_0x641b('0x2b')](function(_0x123888){_0x52240f[_0x641b('0x4c')]=_0x123888;return _0x52240f;})[_0x641b('0x2b')](respondWithFilteredResult(_0x206ea9,_0x3ad18e))[_0x641b('0x4d')](handleError(_0x206ea9,null));};exports[_0x641b('0x4e')]=function(_0x4c940f,_0x480991){var _0x5cc9a2={'raw':![],'where':{'id':_0x4c940f['params']['id']}},_0x3ef0e4={};_0x3ef0e4['model']=_[_0x641b('0x3a')](db[_0x641b('0x4a')]['rawAttributes']);_0x3ef0e4[_0x641b('0x39')]=_['keys'](_0x4c940f[_0x641b('0x39')]);_0x3ef0e4['filters']=_[_0x641b('0x3b')](_0x3ef0e4[_0x641b('0x37')],_0x3ef0e4[_0x641b('0x39')]);_0x5cc9a2[_0x641b('0x3c')]=_[_0x641b('0x3b')](_0x3ef0e4[_0x641b('0x37')],qs[_0x641b('0x3d')](_0x4c940f[_0x641b('0x39')]['fields']));_0x5cc9a2['attributes']=_0x5cc9a2[_0x641b('0x3c')][_0x641b('0x3e')]?_0x5cc9a2['attributes']:_0x3ef0e4[_0x641b('0x37')];if(_0x4c940f[_0x641b('0x39')][_0x641b('0x48')]){_0x5cc9a2['include']=[{'all':!![]}];}_0x5cc9a2=_[_0x641b('0x45')]({},_0x5cc9a2,_0x4c940f[_0x641b('0x47')]);return db[_0x641b('0x4a')]['find'](_0x5cc9a2)[_0x641b('0x2b')](handleEntityNotFound(_0x480991,null))['then'](respondWithResult(_0x480991,null))[_0x641b('0x4d')](handleError(_0x480991,null));};exports[_0x641b('0x4f')]=function(_0x1c1dfb,_0x380f78){return db[_0x641b('0x4a')][_0x641b('0x4f')](_0x1c1dfb[_0x641b('0x50')],{})['then'](function(_0xa422bf){var _0x1f6e97=_0x1c1dfb[_0x641b('0x51')][_0x641b('0x2d')]({'plain':!![]});if(!_0x1f6e97)throw new Error(_0x641b('0x52'));if(_0x1f6e97[_0x641b('0x53')]===_0x641b('0x51')){var _0x445d20=_0xa422bf[_0x641b('0x2d')]({'plain':!![]});var _0x54fcd3=_0x641b('0x2e');return db[_0x641b('0x54')][_0x641b('0x55')]({'where':{'name':_0x54fcd3,'userProfileId':_0x1f6e97[_0x641b('0x56')]},'raw':!![]})[_0x641b('0x2b')](function(_0x2558bd){if(_0x2558bd&&_0x2558bd[_0x641b('0x57')]===0x0){return db[_0x641b('0x2f')]['create']({'name':_0x445d20[_0x641b('0x32')],'resourceId':_0x445d20['id'],'type':_0x2558bd[_0x641b('0x32')],'sectionId':_0x2558bd['id']},{})['then'](function(){return _0xa422bf;});}else{return _0xa422bf;}})[_0x641b('0x4d')](function(_0x19fb3b){logger[_0x641b('0x30')](_0x641b('0x58'),_0x19fb3b);throw _0x19fb3b;});}return _0xa422bf;})[_0x641b('0x2b')](respondWithResult(_0x380f78,0xc9))[_0x641b('0x4d')](handleError(_0x380f78,null));};exports[_0x641b('0x59')]=function(_0x44ff89,_0x413a70){if(_0x44ff89[_0x641b('0x50')]['id']){delete _0x44ff89['body']['id'];}return db[_0x641b('0x4a')][_0x641b('0x55')]({'where':{'id':_0x44ff89[_0x641b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x413a70,null))[_0x641b('0x2b')](saveUpdates(_0x44ff89['body'],null))['then'](respondWithResult(_0x413a70,null))[_0x641b('0x4d')](handleError(_0x413a70,null));};exports[_0x641b('0x2c')]=function(_0x4f1872,_0x276c5c){return db[_0x641b('0x4a')][_0x641b('0x55')]({'where':{'id':_0x4f1872[_0x641b('0x5a')]['id']}})[_0x641b('0x2b')](handleEntityNotFound(_0x276c5c,null))[_0x641b('0x2b')](removeEntity(_0x276c5c,null))[_0x641b('0x4d')](handleError(_0x276c5c,null));};exports[_0x641b('0x5b')]=function(_0x20b26d,_0x115201){return db[_0x641b('0x4a')][_0x641b('0x5b')]()[_0x641b('0x2b')](respondWithResult(_0x115201,null))[_0x641b('0x4d')](handleError(_0x115201,null));};exports[_0x641b('0x5c')]=function(_0x2c0d9a,_0x18cf1e,_0xee802b){if(_0x2c0d9a[_0x641b('0x50')]['id']){delete _0x2c0d9a['body']['id'];}return db[_0x641b('0x4a')][_0x641b('0x55')]({'where':{'id':_0x2c0d9a[_0x641b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x18cf1e,null))[_0x641b('0x2b')](function(_0x3a41ea){if(_0x3a41ea){_0x2c0d9a[_0x641b('0x50')][_0x641b('0x5d')]=_0x3a41ea['id'];return db['Disposition'][_0x641b('0x4f')](_0x2c0d9a['body']);}})[_0x641b('0x2b')](respondWithResult(_0x18cf1e,null))['catch'](handleError(_0x18cf1e,null));};exports[_0x641b('0x5e')]=function(_0x2e65ce,_0x3b8edc,_0x2ab5fa){var _0x1f7293={'raw':![],'where':{}};var _0x400c71={};var _0x273788={'count':0x0,'rows':[]};return db[_0x641b('0x4a')][_0x641b('0x5f')]({'where':{'id':_0x2e65ce['params']['id']}})[_0x641b('0x2b')](handleEntityNotFound(_0x3b8edc,null))[_0x641b('0x2b')](function(_0x76ac1c){if(_0x76ac1c){_0x400c71['model']=_[_0x641b('0x3a')](db[_0x641b('0x60')][_0x641b('0x34')]);_0x400c71[_0x641b('0x39')]=_[_0x641b('0x3a')](_0x2e65ce[_0x641b('0x39')]);_0x400c71[_0x641b('0x43')]=_[_0x641b('0x3b')](_0x400c71[_0x641b('0x37')],_0x400c71[_0x641b('0x39')]);_0x1f7293['attributes']=_[_0x641b('0x3b')](_0x400c71['model'],qs[_0x641b('0x3d')](_0x2e65ce['query'][_0x641b('0x3d')]));_0x1f7293[_0x641b('0x3c')]=_0x1f7293['attributes'][_0x641b('0x3e')]?_0x1f7293['attributes']:_0x400c71[_0x641b('0x37')];if(!_0x2e65ce[_0x641b('0x39')]['hasOwnProperty'](_0x641b('0x61'))){_0x1f7293[_0x641b('0x23')]=qs[_0x641b('0x23')](_0x2e65ce[_0x641b('0x39')][_0x641b('0x23')]);_0x1f7293[_0x641b('0x21')]=qs['offset'](_0x2e65ce[_0x641b('0x39')][_0x641b('0x21')]);}_0x1f7293[_0x641b('0x40')]=qs[_0x641b('0x41')](_0x2e65ce[_0x641b('0x39')][_0x641b('0x41')]);_0x1f7293[_0x641b('0x42')]=qs[_0x641b('0x43')](_['pick'](_0x2e65ce[_0x641b('0x39')],_0x400c71['filters']));_0x1f7293[_0x641b('0x42')]['ListId']=_0x76ac1c['id'];if(_0x2e65ce['query'][_0x641b('0x44')]){_0x1f7293[_0x641b('0x42')]=_['merge'](_0x1f7293[_0x641b('0x42')],{'$or':_['map'](_0x1f7293[_0x641b('0x3c')],function(_0x458987){var _0x49a195={};_0x49a195[_0x458987]={'$like':'%'+_0x2e65ce[_0x641b('0x39')][_0x641b('0x44')]+'%'};return _0x49a195;})});}_0x1f7293=_[_0x641b('0x45')]({},_0x1f7293,_0x2e65ce[_0x641b('0x47')]);return db[_0x641b('0x60')][_0x641b('0x24')]({'where':_0x1f7293[_0x641b('0x42')]})[_0x641b('0x2b')](function(_0x4a0bd7){_0x273788[_0x641b('0x24')]=_0x4a0bd7;if(_0x2e65ce[_0x641b('0x39')][_0x641b('0x48')]){_0x1f7293[_0x641b('0x49')]=[{'all':!![]}];}return db['Disposition'][_0x641b('0x4b')](_0x1f7293);})[_0x641b('0x2b')](function(_0xc8ba78){_0x273788[_0x641b('0x4c')]=_0xc8ba78;return _0x273788;});}})[_0x641b('0x2b')](respondWithFilteredResult(_0x3b8edc,_0x1f7293))['catch'](handleError(_0x3b8edc,null));};exports['removeDispositions']=function(_0x145da2,_0x264782,_0x1e210b){return db[_0x641b('0x4a')]['find']({'where':{'id':_0x145da2[_0x641b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x264782,null))[_0x641b('0x2b')](function(_0x10c3c6){if(_0x10c3c6){return _0x10c3c6[_0x641b('0x62')](_0x145da2['query'][_0x641b('0x63')]);}})[_0x641b('0x2b')](respondWithStatusCode(_0x264782,null))[_0x641b('0x4d')](handleError(_0x264782,null));};exports[_0x641b('0x64')]=function(_0x13364c,_0x5aea71,_0x2a5c3c){return db['CmList'][_0x641b('0x55')]({'where':{'id':_0x13364c['params']['id']}})[_0x641b('0x2b')](handleEntityNotFound(_0x5aea71,null))['then'](function(_0x105458){if(_0x105458){var _0xaef2f=[];var _0x177e45={'success':[],'errors':[]};return db[_0x641b('0x65')][_0x641b('0x5b')]()['then'](function(_0xf2d2c2){if(_0x13364c[_0x641b('0x50')][_0x641b('0x66')]&&_[_0x641b('0x67')](_0x13364c[_0x641b('0x50')][_0x641b('0x66')])){if(_0x13364c['body'][_0x641b('0x66')][_0x641b('0x3e')]){_0x13364c['body'][_0x641b('0x66')]=_0x13364c[_0x641b('0x50')]['tags'][_0x641b('0x68')](';')+';';}else{_0x13364c[_0x641b('0x50')]['tags']=null;}}else{_0x13364c[_0x641b('0x50')][_0x641b('0x66')]=null;}if(_0x13364c[_0x641b('0x50')]&&_[_0x641b('0x67')](_0x13364c[_0x641b('0x50')])){for(var _0x26900b=0x0;_0x26900b<_0x13364c[_0x641b('0x50')]['length'];_0x26900b+=0x1){_0x13364c['body'][_0x26900b][_0x641b('0x5d')]=_0x13364c[_0x641b('0x5a')]['id'];_0xaef2f['push'](_0x13364c['body'][_0x26900b]);}return BPromise[_0x641b('0x69')](_0xaef2f,function(_0x5f2018){return db[_0x641b('0x65')][_0x641b('0x4f')](_[_0x641b('0x6a')](_0x5f2018,[_0x641b('0x63'),'id'])||{},{'fields':_[_0x641b('0x3a')](_0xf2d2c2),'raw':!![]})['then'](function(_0xf979){_0x177e45[_0x641b('0x6b')][_0x641b('0x6c')](_0xf979[_0x641b('0x6d')]);})[_0x641b('0x4d')](function(_0x3c845e){_0x177e45[_0x641b('0x6e')]['push']({'data':_0x5f2018,'error':_0x3c845e['message']});});})[_0x641b('0x2b')](function(_0x5c2101){return _0x177e45;})[_0x641b('0x4d')](function(_0x1c1557){return _0x1c1557;});}else{_0x5aea71[_0x641b('0x25')](0x190)[_0x641b('0x20')]({'message':_0x641b('0x6f')});}});}})[_0x641b('0x2b')](respondWithResult(_0x5aea71,null))['catch'](handleError(_0x5aea71,null));};exports[_0x641b('0x70')]=function(_0x182d10,_0x1e8466,_0x166df0){var _0x39e4df;return db[_0x641b('0x4a')][_0x641b('0x55')]({'where':{'id':_0x182d10[_0x641b('0x5a')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x641b('0x71')}]})[_0x641b('0x2b')](handleEntityNotFound(_0x1e8466,null))[_0x641b('0x2b')](function(_0x916b9a){if(_0x916b9a){_0x39e4df=_0x916b9a;return db[_0x641b('0x65')]['rawAttributes'];}})[_0x641b('0x2b')](function(_0x290c53){if(_0x290c53){var _0xdccf11={};var _0x255f2a={};_0x255f2a[_0x641b('0x37')]=_[_0x641b('0x72')](_[_0x641b('0x3a')](_0x290c53),_[_0x641b('0x38')](_0x39e4df[_0x641b('0x71')],function(_0x2c9313){return util[_0x641b('0x73')]('cf_%d',_0x2c9313['id']);}));_0x255f2a['query']=_['keys'](_0x182d10[_0x641b('0x39')]);_0x255f2a[_0x641b('0x43')]=_['intersection'](_0x255f2a[_0x641b('0x37')],_0x255f2a[_0x641b('0x39')]);_0xdccf11[_0x641b('0x3c')]=_[_0x641b('0x3b')](_0x255f2a[_0x641b('0x37')],qs[_0x641b('0x3d')](_0x182d10['query'][_0x641b('0x3d')]));_0xdccf11['attributes']=_0xdccf11[_0x641b('0x3c')][_0x641b('0x3e')]?_0xdccf11[_0x641b('0x3c')]:_0x255f2a['model'];if(!_0x182d10['query'][_0x641b('0x3f')](_0x641b('0x61'))){_0xdccf11[_0x641b('0x23')]=qs['limit'](_0x182d10[_0x641b('0x39')][_0x641b('0x23')]);_0xdccf11['offset']=qs[_0x641b('0x21')](_0x182d10[_0x641b('0x39')][_0x641b('0x21')]);}_0xdccf11[_0x641b('0x40')]=qs[_0x641b('0x41')](_0x182d10['query'][_0x641b('0x41')]);_0xdccf11[_0x641b('0x42')]=qs['filters'](_[_0x641b('0x74')](_0x182d10[_0x641b('0x39')],_0x255f2a['filters']));_0xdccf11[_0x641b('0x75')]=!![];if(_0x182d10[_0x641b('0x39')][_0x641b('0x44')]){_0xdccf11[_0x641b('0x42')]=_['merge'](_0xdccf11[_0x641b('0x42')],{'$or':_[_0x641b('0x38')](_0xdccf11[_0x641b('0x3c')],function(_0x1f9b2a){var _0x477339={};_0x477339[_0x1f9b2a]={'$like':'%'+_0x182d10[_0x641b('0x39')][_0x641b('0x44')]+'%'};return _0x477339;})});}_0xdccf11=_[_0x641b('0x45')]({},_0xdccf11,_0x182d10[_0x641b('0x47')]);return _0x39e4df[_0x641b('0x70')](_0xdccf11);}})[_0x641b('0x2b')](respondWithResult(_0x1e8466,null))[_0x641b('0x4d')](handleError(_0x1e8466,null));};exports[_0x641b('0x76')]=function(_0x20da4c,_0x9653e8,_0x567ea7){var _0x4d071e;var _0x69cbdf;var _0x275d79;var _0x43dec1=_0x20da4c[_0x641b('0x5a')]['id'];csv_results=[];return db['ContactItemType'][_0x641b('0x4b')]({'attributes':['id',_0x641b('0x32')],'raw':!![],'order':[_0x641b('0x77')]})['then'](function(_0x2dac0f){_0x4d071e=_0x2dac0f;var _0x37bdb2=_['keys'](db[_0x641b('0x65')][_0x641b('0x34')]);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0x641b('0x78')]})[_0x641b('0x2b')](function(_0x258e63){_0x69cbdf=_0x258e63;var _0x4cc367=squel[_0x641b('0x79')]()['fields'](_0x37bdb2)[_0x641b('0x7a')](_0x641b('0x7b'),'c')[_0x641b('0x42')]('c.ListId\x20=\x20?',_0x43dec1)[_0x641b('0x42')](_0x641b('0x7c'))[_0x641b('0x7d')]();for(var _0x3fc89e=0x0;_0x3fc89e<_0x69cbdf[_0x641b('0x3e')];_0x3fc89e++){_0x4cc367[_0x641b('0x7e')](_0x641b('0x7f')+_0x69cbdf[_0x3fc89e]['id'],_0x641b('0x80')+_0x69cbdf[_0x3fc89e]['alias']);}for(var _0x3fc89e=0x0;_0x3fc89e<_0x4d071e[_0x641b('0x3e')];_0x3fc89e++){_0x4cc367[_0x641b('0x7e')](squel[_0x641b('0x79')]()[_0x641b('0x7e')](_0x641b('0x81'))[_0x641b('0x7a')]('cm_contact_has_items')[_0x641b('0x42')](_0x641b('0x82'),_0x4d071e[_0x3fc89e]['id'])[_0x641b('0x42')](_0x641b('0x83')),_0x641b('0x84')+_0x4d071e[_0x3fc89e][_0x641b('0x32')]);_0x4cc367[_0x641b('0x7e')](squel[_0x641b('0x79')]()['field'](_0x641b('0x85'))[_0x641b('0x7a')](_0x641b('0x86'))[_0x641b('0x42')](_0x641b('0x82'),_0x4d071e[_0x3fc89e]['id'])[_0x641b('0x42')](_0x641b('0x83')),_0x641b('0x87')+_0x4d071e[_0x3fc89e]['name']);}var _0x4b64b4=[];_0x4b64b4[_0x641b('0x6c')](_0x4cc367[_0x641b('0x88')]());BPromise[_0x641b('0x69')](_0x4b64b4,handleQuery)['then'](function(_0x3e242d){handleQuery(_0x4cc367[_0x641b('0x88')]());var _0x5291e4=csv_results[0x0];if(!_[_0x641b('0x89')](_0x5291e4)){var _0x5b5e3e=toCsv(_0x5291e4);var _0x3a546e=Date[_0x641b('0x8a')]();fs[_0x641b('0x8b')](util['format'](_0x641b('0x8c'),_0x43dec1,_0x3a546e),_0x5b5e3e);_0x9653e8[_0x641b('0x8d')](_0x641b('0x8e'),_0x641b('0x8f')+util['format']('list_%d_%s.csv',_0x43dec1,_0x3a546e));_0x9653e8[_0x641b('0x8d')](_0x641b('0x90'),'text/csv');return _0x9653e8[_0x641b('0x91')](util['format'](_0x641b('0x8c'),_0x43dec1,_0x3a546e));}else{return _0x9653e8['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x38b7f6,_0x2b2ef3,_0xae7e70){var _0x4e14ef;delete _0x38b7f6[_0x641b('0x50')]['id'];return db['CmList'][_0x641b('0x5f')]({'where':{'id':_0x38b7f6['params']['id']}})['then'](handleEntityNotFound(_0x2b2ef3,null))[_0x641b('0x2b')](function(_0x36921d){if(_0x36921d){return db[_0x641b('0x92')][_0x641b('0x93')](function(_0x123a2b){return db[_0x641b('0x94')][_0x641b('0x4f')](_0x38b7f6[_0x641b('0x50')],{'transaction':_0x123a2b})[_0x641b('0x2b')](function(_0x5ccf3f){_0x4e14ef=_0x5ccf3f;return _0x36921d[_0x641b('0x95')](_0x5ccf3f,{'transaction':_0x123a2b});})[_0x641b('0x2b')](function(){var _0x2914f2={'type':db[_0x641b('0x96')][_0x641b('0x97')],'transaction':_0x123a2b};switch(_0x38b7f6[_0x641b('0x50')][_0x641b('0x35')]){case _0x641b('0x98'):_0x2914f2[_0x641b('0x35')]=db[_0x641b('0x96')]['TEXT'];break;case _0x641b('0x99'):_0x2914f2['type']=db['Sequelize']['INTEGER'];break;case _0x641b('0x9a'):_0x2914f2[_0x641b('0x35')]=db[_0x641b('0x96')][_0x641b('0x9b')];_0x2914f2['defaultValue']=![];break;default:}return db[_0x641b('0x92')][_0x641b('0x9c')][_0x641b('0x9d')](_0x641b('0x7b'),util[_0x641b('0x73')](_0x641b('0x9e'),_0x4e14ef['id']),_0x2914f2);})[_0x641b('0x2b')](function(){return _0x4e14ef;});});}})[_0x641b('0x2b')](respondWithResult(_0x2b2ef3,null))[_0x641b('0x4d')](handleError(_0x2b2ef3,null));};exports[_0x641b('0x9f')]=function(_0x1e5422,_0x307cd9,_0x5538cf){var _0x1757e9={};var _0x52d424={};var _0xdf31a6;var _0x1a8813;return db['CmList'][_0x641b('0x5f')]({'where':{'id':_0x1e5422[_0x641b('0x5a')]['id']}})[_0x641b('0x2b')](handleEntityNotFound(_0x307cd9,null))[_0x641b('0x2b')](function(_0x10778a){if(_0x10778a){_0xdf31a6=_0x10778a;_0x52d424[_0x641b('0x37')]=_[_0x641b('0x3a')](db[_0x641b('0x94')]['rawAttributes']);_0x52d424[_0x641b('0x39')]=_[_0x641b('0x3a')](_0x1e5422[_0x641b('0x39')]);_0x52d424['filters']=_[_0x641b('0x3b')](_0x52d424[_0x641b('0x37')],_0x52d424[_0x641b('0x39')]);_0x1757e9[_0x641b('0x3c')]=_[_0x641b('0x3b')](_0x52d424['model'],qs['fields'](_0x1e5422['query'][_0x641b('0x3d')]));_0x1757e9[_0x641b('0x3c')]=_0x1757e9[_0x641b('0x3c')]['length']?_0x1757e9['attributes']:_0x52d424['model'];_0x1757e9[_0x641b('0x40')]=qs['sort'](_0x1e5422[_0x641b('0x39')][_0x641b('0x41')]);_0x1757e9[_0x641b('0x42')]=qs[_0x641b('0x43')](_['pick'](_0x1e5422[_0x641b('0x39')],_0x52d424['filters']));_0x1757e9[_0x641b('0x42')]=_[_0x641b('0x45')](_0x1757e9['where'],{'$or':[{'ListId':_0x10778a['id']},{'ListId':null}]});if(_0x1e5422[_0x641b('0x39')][_0x641b('0x44')]){_0x1757e9[_0x641b('0x42')]=_[_0x641b('0x45')](_0x1757e9['where'],{'$or':_['map'](_0x1757e9[_0x641b('0x3c')],function(_0x9e279f){var _0x51ca38={};_0x51ca38[_0x9e279f]={'$like':'%'+_0x1e5422[_0x641b('0x39')]['filter']+'%'};return _0x51ca38;})});}_0x1757e9=_['merge']({},_0x1757e9,_0x1e5422[_0x641b('0x47')]);return db[_0x641b('0x94')][_0x641b('0xa0')](_0x1757e9);}})[_0x641b('0x2b')](respondWithResult(_0x307cd9,null))['catch'](handleError(_0x307cd9,null));};exports[_0x641b('0xa1')]=function(_0x2ee324,_0x160b19){return db[_0x641b('0x94')][_0x641b('0xa0')]({'where':{'ListId':null}})[_0x641b('0x2b')](handleEntityNotFound(_0x160b19,null))[_0x641b('0x2b')](function(_0x4e898e){return _0x4e898e;})['then'](respondWithResult(_0x160b19,null))[_0x641b('0x4d')](handleError(_0x160b19,null));};exports['addAgents']=function(_0x17a29e,_0x5341ee,_0x6f11fa){return db[_0x641b('0x4a')][_0x641b('0x55')]({'where':{'id':_0x17a29e['params']['id']}})[_0x641b('0x2b')](handleEntityNotFound(_0x5341ee,null))['then'](function(_0x4aeaed){if(_0x4aeaed){return _0x4aeaed[_0x641b('0xa2')](_0x17a29e[_0x641b('0x50')][_0x641b('0x63')],_['omit'](_0x17a29e[_0x641b('0x50')],[_0x641b('0x63'),'id'])||{})[_0x641b('0xa3')](function(_0x30626f){for(var _0xab0466=0x0;_0xab0466<_0x17a29e['body'][_0x641b('0x63')][_0x641b('0x3e')];_0xab0466+=0x1){socket[_0x641b('0xa4')](_0x641b('0xa5'),{'UserId':Number(_0x17a29e['body']['ids'][_0xab0466]),'CmListId':Number(_0x17a29e[_0x641b('0x5a')]['id'])});}return _0x30626f;});}})['then'](respondWithResult(_0x5341ee,null))['catch'](handleError(_0x5341ee,null));};exports['removeAgents']=function(_0x412c1b,_0x529667,_0x116d7d){return db[_0x641b('0x4a')]['find']({'where':{'id':_0x412c1b[_0x641b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x529667,null))[_0x641b('0x2b')](function(_0x3a7dc0){if(_0x3a7dc0){return _0x3a7dc0[_0x641b('0xa6')](_0x412c1b[_0x641b('0x39')][_0x641b('0x63')])[_0x641b('0x2b')](function(){if(_[_0x641b('0x67')](_0x412c1b[_0x641b('0x39')][_0x641b('0x63')])){for(var _0x406766=0x0;_0x406766<_0x412c1b[_0x641b('0x39')][_0x641b('0x63')]['length'];_0x406766+=0x1){socket['emit'](_0x641b('0xa7'),{'UserId':Number(_0x412c1b[_0x641b('0x39')][_0x641b('0x63')][_0x406766]),'CmListId':Number(_0x412c1b[_0x641b('0x5a')]['id'])});}}else{socket['emit'](_0x641b('0xa7'),{'UserId':Number(_0x412c1b[_0x641b('0x39')][_0x641b('0x63')]),'CmListId':Number(_0x412c1b['params']['id'])});}});}})[_0x641b('0x2b')](respondWithStatusCode(_0x529667,null))[_0x641b('0x4d')](handleError(_0x529667,null));};exports[_0x641b('0xa8')]=function(_0x358d5e,_0x21fc45,_0x599fdb){var _0x50ae39={};var _0x11777f={};var _0x342274;var _0x17fcdc;return db[_0x641b('0x4a')]['findOne']({'where':{'id':_0x358d5e[_0x641b('0x5a')]['id']}})[_0x641b('0x2b')](handleEntityNotFound(_0x21fc45,null))[_0x641b('0x2b')](function(_0x25f125){if(_0x25f125){_0x342274=_0x25f125;_0x11777f['model']=_[_0x641b('0x3a')](db['User'][_0x641b('0x34')]);_0x11777f['query']=_[_0x641b('0x3a')](_0x358d5e[_0x641b('0x39')]);_0x11777f['filters']=_[_0x641b('0x3b')](_0x11777f[_0x641b('0x37')],_0x11777f['query']);_0x50ae39[_0x641b('0x3c')]=_['intersection'](_0x11777f[_0x641b('0x37')],qs['fields'](_0x358d5e['query'][_0x641b('0x3d')]));_0x50ae39[_0x641b('0x3c')]=_0x50ae39['attributes'][_0x641b('0x3e')]?_0x50ae39[_0x641b('0x3c')]:_0x11777f['model'];_0x50ae39[_0x641b('0x40')]=qs[_0x641b('0x41')](_0x358d5e['query'][_0x641b('0x41')]);_0x50ae39[_0x641b('0x42')]=qs[_0x641b('0x43')](_[_0x641b('0x74')](_0x358d5e[_0x641b('0x39')],_0x11777f[_0x641b('0x43')]));if(_0x358d5e[_0x641b('0x39')][_0x641b('0x44')]){_0x50ae39[_0x641b('0x42')]=_[_0x641b('0x45')](_0x50ae39[_0x641b('0x42')],{'$or':_[_0x641b('0x38')](_0x50ae39[_0x641b('0x3c')],function(_0x2306f3){var _0x2d28b8={};_0x2d28b8[_0x2306f3]={'$like':'%'+_0x358d5e[_0x641b('0x39')]['filter']+'%'};return _0x2d28b8;})});}_0x50ae39=_[_0x641b('0x45')]({},_0x50ae39,_0x358d5e[_0x641b('0x47')]);return _0x342274['getAgents'](_0x50ae39);}})[_0x641b('0x2b')](function(_0x59717c){if(_0x59717c){_0x17fcdc=_0x59717c[_0x641b('0x3e')];if(!_0x358d5e[_0x641b('0x39')][_0x641b('0x3f')]('nolimit')){_0x50ae39[_0x641b('0x23')]=qs[_0x641b('0x23')](_0x358d5e['query'][_0x641b('0x23')]);_0x50ae39[_0x641b('0x21')]=qs['offset'](_0x358d5e['query'][_0x641b('0x21')]);}return _0x342274[_0x641b('0xa8')](_0x50ae39);}})[_0x641b('0x2b')](function(_0x1dc34c){if(_0x1dc34c){return _0x1dc34c?{'count':_0x17fcdc,'rows':_0x1dc34c}:null;}})['then'](respondWithResult(_0x21fc45,null))[_0x641b('0x4d')](handleError(_0x21fc45,null));};function handleQuery(_0x30b50e){logger[_0x641b('0xa9')](_0x30b50e);return db[_0x641b('0x92')][_0x641b('0x39')](_0x30b50e)[_0x641b('0xa3')](function(_0x11737e){csv_results[_0x641b('0x6c')](_0x11737e);})[_0x641b('0x4d')](function(_0xb428e7){logger['error'](_0xb428e7[_0x641b('0xaa')]);});} \ No newline at end of file +var _0x183e=['getDispositions','Disposition','hasOwnProperty','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','each','omit','success','errors','message','getContacts','CmCustomField','format','raw','getContactsCsv','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','customField_','select','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','addColumn','cf_%s','getCustomFields','findOne','findAndCountAll','getGlobalCustomFields','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','info','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','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','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','index','CmList','fieldName','type','model','map','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','catch','describe','addDisposition','ListId'];(function(_0x4b7bbc,_0x4bf660){var _0x273b31=function(_0x1e0a16){while(--_0x1e0a16){_0x4b7bbc['push'](_0x4b7bbc['shift']());}};_0x273b31(++_0x4bf660);}(_0x183e,0x193));var _0xe183=function(_0x53f3dc,_0x424b5d){_0x53f3dc=_0x53f3dc-0x0;var _0x328200=_0x183e[_0x53f3dc];return _0x328200;};'use strict';var emlformat=require(_0xe183('0x0'));var rimraf=require(_0xe183('0x1'));var zipdir=require(_0xe183('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe183('0x3'));var moment=require(_0xe183('0x4'));var BPromise=require(_0xe183('0x5'));var Mustache=require(_0xe183('0x6'));var util=require(_0xe183('0x7'));var path=require(_0xe183('0x8'));var sox=require('sox');var csv=require(_0xe183('0x9'));var ejs=require(_0xe183('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe183('0xb'));var squel=require(_0xe183('0xc'));var crypto=require('crypto');var jsforce=require(_0xe183('0xd'));var deskjs=require(_0xe183('0xe'));var toCsv=require(_0xe183('0x9'));var querystring=require(_0xe183('0xf'));var Papa=require(_0xe183('0x10'));var Redis=require(_0xe183('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe183('0x12'));var as=require(_0xe183('0x13'));var hardwareService=require(_0xe183('0x14'));var logger=require(_0xe183('0x15'))(_0xe183('0x16'));var utils=require(_0xe183('0x17'));var config=require(_0xe183('0x18'));var licenseUtil=require(_0xe183('0x19'));var db=require(_0xe183('0x1a'))['db'];var csv_results;config[_0xe183('0x1b')]=_[_0xe183('0x1c')](config['redis'],{'host':_0xe183('0x1d'),'port':0x18eb});var socket=require(_0xe183('0x1e'))(new Redis(config[_0xe183('0x1b')]));require(_0xe183('0x1f'))[_0xe183('0x20')](socket);function respondWithStatusCode(_0x3cacef,_0x2b3a1f){_0x2b3a1f=_0x2b3a1f||0xcc;return function(_0x255385){if(_0x255385){return _0x3cacef[_0xe183('0x21')](_0x2b3a1f);}return _0x3cacef[_0xe183('0x22')](_0x2b3a1f)[_0xe183('0x23')]();};}function respondWithResult(_0x1a1163,_0x1a8f04){_0x1a8f04=_0x1a8f04||0xc8;return function(_0x44f9c8){if(_0x44f9c8){return _0x1a1163[_0xe183('0x22')](_0x1a8f04)['json'](_0x44f9c8);}};}function respondWithFilteredResult(_0x1319d0,_0x4193c1){return function(_0x1ea539){if(_0x1ea539){var _0x293b34=typeof _0x4193c1[_0xe183('0x24')]===_0xe183('0x25')&&typeof _0x4193c1[_0xe183('0x26')]===_0xe183('0x25');var _0x1e0cba=_0x1ea539[_0xe183('0x27')];var _0x458af5=_0x293b34?0x0:_0x4193c1[_0xe183('0x24')];var _0x51af51=_0x293b34?_0x1ea539[_0xe183('0x27')]:_0x4193c1['offset']+_0x4193c1[_0xe183('0x26')];var _0x44ba55;if(_0x51af51>=_0x1e0cba){_0x51af51=_0x1e0cba;_0x44ba55=0xc8;}else{_0x44ba55=0xce;}_0x1319d0[_0xe183('0x22')](_0x44ba55);return _0x1319d0[_0xe183('0x28')](_0xe183('0x29'),_0x458af5+'-'+_0x51af51+'/'+_0x1e0cba)[_0xe183('0x2a')](_0x1ea539);}return null;};}function patchUpdates(_0x3898f6){return function(_0x37f634){try{jsonpatch['apply'](_0x37f634,_0x3898f6,!![]);}catch(_0x335267){return BPromise[_0xe183('0x2b')](_0x335267);}return _0x37f634[_0xe183('0x2c')]();};}function saveUpdates(_0xfd1964,_0x2cef7b){return function(_0x579eba){if(_0x579eba){return _0x579eba[_0xe183('0x2d')](_0xfd1964)['then'](function(_0x518a7e){return _0x518a7e;});}return null;};}function removeEntity(_0x51e420,_0x3b53ed){return function(_0x590f2b){if(_0x590f2b){return _0x590f2b['destroy']()[_0xe183('0x2e')](function(){var _0x3aff5e=_0x590f2b[_0xe183('0x2f')]({'plain':!![]});var _0x428db8='Lists';return db[_0xe183('0x30')][_0xe183('0x31')]({'where':{'type':_0x428db8,'resourceId':_0x3aff5e['id']}})[_0xe183('0x2e')](function(){return _0x590f2b;});})[_0xe183('0x2e')](function(){_0x51e420[_0xe183('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaab417,_0x557512){return function(_0x14e3ce){if(!_0x14e3ce){_0xaab417['sendStatus'](0x194);}return _0x14e3ce;};}function handleError(_0x5e41b8,_0x5ac9f8){_0x5ac9f8=_0x5ac9f8||0x1f4;return function(_0x5c6507){logger[_0xe183('0x32')](_0x5c6507[_0xe183('0x33')]);if(_0x5c6507[_0xe183('0x34')]){delete _0x5c6507[_0xe183('0x34')];}_0x5e41b8['status'](_0x5ac9f8)['send'](_0x5c6507);};}exports[_0xe183('0x35')]=function(_0x2e47a3,_0x4a490b){var _0x458471={},_0x1133f5={},_0x1e2971={'count':0x0,'rows':[]};var _0x51185c=_['map'](db[_0xe183('0x36')]['rawAttributes'],function(_0x3d02b5){return{'name':_0x3d02b5[_0xe183('0x37')],'type':_0x3d02b5[_0xe183('0x38')]['key']};});_0x1133f5[_0xe183('0x39')]=_[_0xe183('0x3a')](_0x51185c,_0xe183('0x34'));_0x1133f5[_0xe183('0x3b')]=_['keys'](_0x2e47a3['query']);_0x1133f5[_0xe183('0x3c')]=_['intersection'](_0x1133f5['model'],_0x1133f5['query']);_0x458471[_0xe183('0x3d')]=_[_0xe183('0x3e')](_0x1133f5[_0xe183('0x39')],qs[_0xe183('0x3f')](_0x2e47a3[_0xe183('0x3b')]['fields']));_0x458471[_0xe183('0x3d')]=_0x458471[_0xe183('0x3d')][_0xe183('0x40')]?_0x458471[_0xe183('0x3d')]:_0x1133f5[_0xe183('0x39')];if(!_0x2e47a3[_0xe183('0x3b')]['hasOwnProperty'](_0xe183('0x41'))){_0x458471['limit']=qs[_0xe183('0x26')](_0x2e47a3[_0xe183('0x3b')][_0xe183('0x26')]);_0x458471[_0xe183('0x24')]=qs[_0xe183('0x24')](_0x2e47a3[_0xe183('0x3b')][_0xe183('0x24')]);}_0x458471[_0xe183('0x42')]=qs['sort'](_0x2e47a3['query'][_0xe183('0x43')]);_0x458471['where']=qs[_0xe183('0x3c')](_[_0xe183('0x44')](_0x2e47a3[_0xe183('0x3b')],_0x1133f5[_0xe183('0x3c')]),_0x51185c);if(_0x2e47a3['query'][_0xe183('0x45')]){_0x458471[_0xe183('0x46')]=_[_0xe183('0x47')](_0x458471[_0xe183('0x46')],{'$or':_[_0xe183('0x3a')](_0x51185c,function(_0x1fc82f){if(_0x1fc82f['type']!==_0xe183('0x48')){var _0x56e74c={};_0x56e74c[_0x1fc82f[_0xe183('0x34')]]={'$like':'%'+_0x2e47a3[_0xe183('0x3b')]['filter']+'%'};return _0x56e74c;}})});}_0x458471=_[_0xe183('0x47')]({},_0x458471,_0x2e47a3['options']);var _0x22e38e={'where':_0x458471['where']};return db[_0xe183('0x36')][_0xe183('0x27')](_0x22e38e)['then'](function(_0x3924ab){_0x1e2971[_0xe183('0x27')]=_0x3924ab;if(_0x2e47a3[_0xe183('0x3b')][_0xe183('0x49')]){_0x458471[_0xe183('0x4a')]=[{'all':!![]}];}return db['CmList'][_0xe183('0x4b')](_0x458471);})['then'](function(_0x43db07){_0x1e2971[_0xe183('0x4c')]=_0x43db07;return _0x1e2971;})[_0xe183('0x2e')](respondWithFilteredResult(_0x4a490b,_0x458471))['catch'](handleError(_0x4a490b,null));};exports[_0xe183('0x4d')]=function(_0x2eaf0d,_0x56c863){var _0x2a73d5={'raw':![],'where':{'id':_0x2eaf0d[_0xe183('0x4e')]['id']}},_0x193078={};_0x193078['model']=_[_0xe183('0x4f')](db[_0xe183('0x36')][_0xe183('0x50')]);_0x193078[_0xe183('0x3b')]=_[_0xe183('0x4f')](_0x2eaf0d[_0xe183('0x3b')]);_0x193078[_0xe183('0x3c')]=_[_0xe183('0x3e')](_0x193078[_0xe183('0x39')],_0x193078['query']);_0x2a73d5['attributes']=_[_0xe183('0x3e')](_0x193078[_0xe183('0x39')],qs[_0xe183('0x3f')](_0x2eaf0d[_0xe183('0x3b')][_0xe183('0x3f')]));_0x2a73d5[_0xe183('0x3d')]=_0x2a73d5['attributes'][_0xe183('0x40')]?_0x2a73d5['attributes']:_0x193078[_0xe183('0x39')];if(_0x2eaf0d[_0xe183('0x3b')]['includeAll']){_0x2a73d5[_0xe183('0x4a')]=[{'all':!![]}];}_0x2a73d5=_[_0xe183('0x47')]({},_0x2a73d5,_0x2eaf0d[_0xe183('0x51')]);return db[_0xe183('0x36')][_0xe183('0x52')](_0x2a73d5)[_0xe183('0x2e')](handleEntityNotFound(_0x56c863,null))[_0xe183('0x2e')](respondWithResult(_0x56c863,null))['catch'](handleError(_0x56c863,null));};exports[_0xe183('0x53')]=function(_0x287dfe,_0x4593a3){return db['CmList'][_0xe183('0x53')](_0x287dfe[_0xe183('0x54')],{})['then'](function(_0x4495ba){var _0x394770=_0x287dfe[_0xe183('0x55')][_0xe183('0x2f')]({'plain':!![]});if(!_0x394770)throw new Error(_0xe183('0x56'));if(_0x394770[_0xe183('0x57')]===_0xe183('0x55')){var _0x58bc17=_0x4495ba[_0xe183('0x2f')]({'plain':!![]});var _0x36375f=_0xe183('0x58');return db[_0xe183('0x59')]['find']({'where':{'name':_0x36375f,'userProfileId':_0x394770[_0xe183('0x5a')]},'raw':!![]})['then'](function(_0x43d1d2){if(_0x43d1d2&&_0x43d1d2['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x58bc17[_0xe183('0x34')],'resourceId':_0x58bc17['id'],'type':_0x43d1d2['name'],'sectionId':_0x43d1d2['id']},{})['then'](function(){return _0x4495ba;});}else{return _0x4495ba;}})['catch'](function(_0x1236ea){logger[_0xe183('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1236ea);throw _0x1236ea;});}return _0x4495ba;})[_0xe183('0x2e')](respondWithResult(_0x4593a3,0xc9))[_0xe183('0x5b')](handleError(_0x4593a3,null));};exports[_0xe183('0x2d')]=function(_0x3439f1,_0x1b4560){if(_0x3439f1[_0xe183('0x54')]['id']){delete _0x3439f1[_0xe183('0x54')]['id'];}return db[_0xe183('0x36')][_0xe183('0x52')]({'where':{'id':_0x3439f1[_0xe183('0x4e')]['id']}})[_0xe183('0x2e')](handleEntityNotFound(_0x1b4560,null))[_0xe183('0x2e')](saveUpdates(_0x3439f1[_0xe183('0x54')],null))[_0xe183('0x2e')](respondWithResult(_0x1b4560,null))[_0xe183('0x5b')](handleError(_0x1b4560,null));};exports[_0xe183('0x31')]=function(_0x20042f,_0x460e0b){return db['CmList'][_0xe183('0x52')]({'where':{'id':_0x20042f[_0xe183('0x4e')]['id']}})[_0xe183('0x2e')](handleEntityNotFound(_0x460e0b,null))[_0xe183('0x2e')](removeEntity(_0x460e0b,null))[_0xe183('0x5b')](handleError(_0x460e0b,null));};exports[_0xe183('0x5c')]=function(_0x5b0948,_0x52c3c1){return db['CmList'][_0xe183('0x5c')]()[_0xe183('0x2e')](respondWithResult(_0x52c3c1,null))[_0xe183('0x5b')](handleError(_0x52c3c1,null));};exports[_0xe183('0x5d')]=function(_0x5a5e7b,_0x33609d,_0x18a964){if(_0x5a5e7b['body']['id']){delete _0x5a5e7b[_0xe183('0x54')]['id'];}return db[_0xe183('0x36')]['find']({'where':{'id':_0x5a5e7b[_0xe183('0x4e')]['id']}})[_0xe183('0x2e')](handleEntityNotFound(_0x33609d,null))[_0xe183('0x2e')](function(_0x2091b5){if(_0x2091b5){_0x5a5e7b[_0xe183('0x54')][_0xe183('0x5e')]=_0x2091b5['id'];return db['Disposition'][_0xe183('0x53')](_0x5a5e7b[_0xe183('0x54')]);}})[_0xe183('0x2e')](respondWithResult(_0x33609d,null))['catch'](handleError(_0x33609d,null));};exports[_0xe183('0x5f')]=function(_0xb51d3e,_0x346637,_0x554b92){var _0x109942={'raw':![],'where':{}};var _0x18aa6e={};var _0x3e4efd={'count':0x0,'rows':[]};return db[_0xe183('0x36')]['findOne']({'where':{'id':_0xb51d3e[_0xe183('0x4e')]['id']}})[_0xe183('0x2e')](handleEntityNotFound(_0x346637,null))[_0xe183('0x2e')](function(_0x3ab146){if(_0x3ab146){_0x18aa6e[_0xe183('0x39')]=_['keys'](db[_0xe183('0x60')][_0xe183('0x50')]);_0x18aa6e[_0xe183('0x3b')]=_[_0xe183('0x4f')](_0xb51d3e[_0xe183('0x3b')]);_0x18aa6e[_0xe183('0x3c')]=_[_0xe183('0x3e')](_0x18aa6e[_0xe183('0x39')],_0x18aa6e[_0xe183('0x3b')]);_0x109942[_0xe183('0x3d')]=_[_0xe183('0x3e')](_0x18aa6e[_0xe183('0x39')],qs[_0xe183('0x3f')](_0xb51d3e[_0xe183('0x3b')][_0xe183('0x3f')]));_0x109942[_0xe183('0x3d')]=_0x109942['attributes'][_0xe183('0x40')]?_0x109942[_0xe183('0x3d')]:_0x18aa6e['model'];if(!_0xb51d3e[_0xe183('0x3b')][_0xe183('0x61')](_0xe183('0x41'))){_0x109942['limit']=qs[_0xe183('0x26')](_0xb51d3e[_0xe183('0x3b')][_0xe183('0x26')]);_0x109942[_0xe183('0x24')]=qs[_0xe183('0x24')](_0xb51d3e[_0xe183('0x3b')][_0xe183('0x24')]);}_0x109942[_0xe183('0x42')]=qs['sort'](_0xb51d3e[_0xe183('0x3b')][_0xe183('0x43')]);_0x109942['where']=qs[_0xe183('0x3c')](_[_0xe183('0x44')](_0xb51d3e[_0xe183('0x3b')],_0x18aa6e[_0xe183('0x3c')]));_0x109942[_0xe183('0x46')][_0xe183('0x5e')]=_0x3ab146['id'];if(_0xb51d3e[_0xe183('0x3b')][_0xe183('0x45')]){_0x109942[_0xe183('0x46')]=_[_0xe183('0x47')](_0x109942[_0xe183('0x46')],{'$or':_[_0xe183('0x3a')](_0x109942[_0xe183('0x3d')],function(_0x127a3d){var _0x51dc27={};_0x51dc27[_0x127a3d]={'$like':'%'+_0xb51d3e[_0xe183('0x3b')][_0xe183('0x45')]+'%'};return _0x51dc27;})});}_0x109942=_[_0xe183('0x47')]({},_0x109942,_0xb51d3e[_0xe183('0x51')]);return db['Disposition']['count']({'where':_0x109942['where']})[_0xe183('0x2e')](function(_0x4331d4){_0x3e4efd['count']=_0x4331d4;if(_0xb51d3e[_0xe183('0x3b')][_0xe183('0x49')]){_0x109942[_0xe183('0x4a')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x109942);})['then'](function(_0x58c1b7){_0x3e4efd[_0xe183('0x4c')]=_0x58c1b7;return _0x3e4efd;});}})[_0xe183('0x2e')](respondWithFilteredResult(_0x346637,_0x109942))['catch'](handleError(_0x346637,null));};exports[_0xe183('0x62')]=function(_0x34687d,_0x544853,_0x18cbb3){return db['CmList']['find']({'where':{'id':_0x34687d['params']['id']}})[_0xe183('0x2e')](handleEntityNotFound(_0x544853,null))['then'](function(_0x2d8c19){if(_0x2d8c19){return _0x2d8c19[_0xe183('0x62')](_0x34687d[_0xe183('0x3b')][_0xe183('0x63')]);}})['then'](respondWithStatusCode(_0x544853,null))['catch'](handleError(_0x544853,null));};exports[_0xe183('0x64')]=function(_0x416d3d,_0x4dfbae,_0x59ff40){return db[_0xe183('0x36')]['find']({'where':{'id':_0x416d3d[_0xe183('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4dfbae,null))['then'](function(_0x2e2493){if(_0x2e2493){var _0x1b3fd7=[];var _0x288e91={'success':[],'errors':[]};return db[_0xe183('0x65')][_0xe183('0x5c')]()[_0xe183('0x2e')](function(_0xcf779a){if(_0x416d3d[_0xe183('0x54')][_0xe183('0x66')]&&_[_0xe183('0x67')](_0x416d3d[_0xe183('0x54')][_0xe183('0x66')])){if(_0x416d3d[_0xe183('0x54')][_0xe183('0x66')]['length']){_0x416d3d[_0xe183('0x54')][_0xe183('0x66')]=_0x416d3d[_0xe183('0x54')][_0xe183('0x66')]['join'](';')+';';}else{_0x416d3d['body']['tags']=null;}}else{_0x416d3d['body'][_0xe183('0x66')]=null;}if(_0x416d3d[_0xe183('0x54')]&&_[_0xe183('0x67')](_0x416d3d[_0xe183('0x54')])){for(var _0x3993ef=0x0;_0x3993ef<_0x416d3d['body']['length'];_0x3993ef+=0x1){_0x416d3d[_0xe183('0x54')][_0x3993ef][_0xe183('0x5e')]=_0x416d3d[_0xe183('0x4e')]['id'];_0x1b3fd7[_0xe183('0x68')](_0x416d3d[_0xe183('0x54')][_0x3993ef]);}return BPromise[_0xe183('0x69')](_0x1b3fd7,function(_0x5e65bd){return db[_0xe183('0x65')][_0xe183('0x53')](_[_0xe183('0x6a')](_0x5e65bd,[_0xe183('0x63'),'id'])||{},{'fields':_[_0xe183('0x4f')](_0xcf779a),'raw':!![]})[_0xe183('0x2e')](function(_0x2aa1cf){_0x288e91[_0xe183('0x6b')][_0xe183('0x68')](_0x2aa1cf['dataValues']);})[_0xe183('0x5b')](function(_0x29c6a8){_0x288e91[_0xe183('0x6c')][_0xe183('0x68')]({'data':_0x5e65bd,'error':_0x29c6a8[_0xe183('0x6d')]});});})[_0xe183('0x2e')](function(_0x5a7da5){return _0x288e91;})[_0xe183('0x5b')](function(_0x42f5d5){return _0x42f5d5;});}else{_0x4dfbae[_0xe183('0x22')](0x190)[_0xe183('0x2a')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xe183('0x2e')](respondWithResult(_0x4dfbae,null))[_0xe183('0x5b')](handleError(_0x4dfbae,null));};exports[_0xe183('0x6e')]=function(_0x5045a4,_0x11e286,_0x762917){var _0x426d41;return db[_0xe183('0x36')][_0xe183('0x52')]({'where':{'id':_0x5045a4[_0xe183('0x4e')]['id']},'include':[{'model':db[_0xe183('0x6f')],'as':'CustomFields'}]})[_0xe183('0x2e')](handleEntityNotFound(_0x11e286,null))[_0xe183('0x2e')](function(_0x3d8aab){if(_0x3d8aab){_0x426d41=_0x3d8aab;return db['CmContact'][_0xe183('0x50')];}})[_0xe183('0x2e')](function(_0x3163c4){if(_0x3163c4){var _0x2056c7={};var _0x5d9853={};_0x5d9853[_0xe183('0x39')]=_['concat'](_[_0xe183('0x4f')](_0x3163c4),_[_0xe183('0x3a')](_0x426d41['CustomFields'],function(_0x137c85){return util[_0xe183('0x70')]('cf_%d',_0x137c85['id']);}));_0x5d9853[_0xe183('0x3b')]=_[_0xe183('0x4f')](_0x5045a4[_0xe183('0x3b')]);_0x5d9853['filters']=_[_0xe183('0x3e')](_0x5d9853['model'],_0x5d9853[_0xe183('0x3b')]);_0x2056c7['attributes']=_[_0xe183('0x3e')](_0x5d9853['model'],qs['fields'](_0x5045a4[_0xe183('0x3b')][_0xe183('0x3f')]));_0x2056c7['attributes']=_0x2056c7['attributes'][_0xe183('0x40')]?_0x2056c7[_0xe183('0x3d')]:_0x5d9853[_0xe183('0x39')];if(!_0x5045a4[_0xe183('0x3b')][_0xe183('0x61')](_0xe183('0x41'))){_0x2056c7[_0xe183('0x26')]=qs[_0xe183('0x26')](_0x5045a4[_0xe183('0x3b')]['limit']);_0x2056c7[_0xe183('0x24')]=qs['offset'](_0x5045a4[_0xe183('0x3b')][_0xe183('0x24')]);}_0x2056c7[_0xe183('0x42')]=qs[_0xe183('0x43')](_0x5045a4[_0xe183('0x3b')][_0xe183('0x43')]);_0x2056c7[_0xe183('0x46')]=qs[_0xe183('0x3c')](_[_0xe183('0x44')](_0x5045a4[_0xe183('0x3b')],_0x5d9853['filters']));_0x2056c7[_0xe183('0x71')]=!![];if(_0x5045a4[_0xe183('0x3b')][_0xe183('0x45')]){_0x2056c7[_0xe183('0x46')]=_[_0xe183('0x47')](_0x2056c7['where'],{'$or':_[_0xe183('0x3a')](_0x2056c7[_0xe183('0x3d')],function(_0x3f8bd0){var _0x3c5e2d={};_0x3c5e2d[_0x3f8bd0]={'$like':'%'+_0x5045a4['query'][_0xe183('0x45')]+'%'};return _0x3c5e2d;})});}_0x2056c7=_['merge']({},_0x2056c7,_0x5045a4['options']);return _0x426d41[_0xe183('0x6e')](_0x2056c7);}})[_0xe183('0x2e')](respondWithResult(_0x11e286,null))['catch'](handleError(_0x11e286,null));};exports[_0xe183('0x72')]=function(_0x47f3be,_0x3a5fa0,_0x2e6e94){var _0x5c0d09;var _0x378fba;var _0x571622;var _0x75cc3=_0x47f3be[_0xe183('0x4e')]['id'];csv_results=[];return db['ContactItemType'][_0xe183('0x4b')]({'attributes':['id',_0xe183('0x34')],'raw':!![],'order':['OrderBy']})['then'](function(_0x122086){_0x5c0d09=_0x122086;var _0x4e9309=_[_0xe183('0x4f')](db['CmContact'][_0xe183('0x50')]);return db[_0xe183('0x6f')][_0xe183('0x4b')]({'raw':!![],'attributes':['id',_0xe183('0x73')]})['then'](function(_0x3458cf){_0x378fba=_0x3458cf;var _0xb2b4df=squel['select']()[_0xe183('0x3f')](_0x4e9309)[_0xe183('0x74')](_0xe183('0x75'),'c')[_0xe183('0x46')](_0xe183('0x76'),_0x75cc3)[_0xe183('0x46')](_0xe183('0x77'))[_0xe183('0x78')]();for(var _0x54e8dd=0x0;_0x54e8dd<_0x378fba[_0xe183('0x40')];_0x54e8dd++){_0xb2b4df[_0xe183('0x79')]('c.cf_'+_0x378fba[_0x54e8dd]['id'],_0xe183('0x7a')+_0x378fba[_0x54e8dd][_0xe183('0x73')]);}for(var _0x54e8dd=0x0;_0x54e8dd<_0x5c0d09[_0xe183('0x40')];_0x54e8dd++){_0xb2b4df[_0xe183('0x79')](squel[_0xe183('0x7b')]()[_0xe183('0x79')](_0xe183('0x7c'))[_0xe183('0x74')](_0xe183('0x7d'))[_0xe183('0x46')](_0xe183('0x7e'),_0x5c0d09[_0x54e8dd]['id'])[_0xe183('0x46')](_0xe183('0x7f')),'additionalPhone_'+_0x5c0d09[_0x54e8dd]['name']);_0xb2b4df[_0xe183('0x79')](squel['select']()[_0xe183('0x79')](_0xe183('0x80'))['from'](_0xe183('0x7d'))['where']('ItemTypeId\x20=\x20?',_0x5c0d09[_0x54e8dd]['id'])[_0xe183('0x46')]('CmContactId\x20=\x20c.id'),_0xe183('0x81')+_0x5c0d09[_0x54e8dd][_0xe183('0x34')]);}var _0x1b300b=[];_0x1b300b[_0xe183('0x68')](_0xb2b4df[_0xe183('0x82')]());BPromise[_0xe183('0x69')](_0x1b300b,handleQuery)['then'](function(_0x567d5b){handleQuery(_0xb2b4df[_0xe183('0x82')]());var _0x143906=csv_results[0x0];if(!_[_0xe183('0x83')](_0x143906)){var _0x192c0b=toCsv(_0x143906);var _0x9fef38=Date[_0xe183('0x84')]();fs[_0xe183('0x85')](util[_0xe183('0x70')](_0xe183('0x86'),_0x75cc3,_0x9fef38),_0x192c0b);_0x3a5fa0[_0xe183('0x87')](_0xe183('0x88'),_0xe183('0x89')+util[_0xe183('0x70')](_0xe183('0x8a'),_0x75cc3,_0x9fef38));_0x3a5fa0['setHeader'](_0xe183('0x8b'),_0xe183('0x8c'));return _0x3a5fa0[_0xe183('0x8d')](util['format']('/tmp/list_%d_%s.csv',_0x75cc3,_0x9fef38));}else{return _0x3a5fa0['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x1104ee,_0x230e31,_0x523b67){var _0x331324;delete _0x1104ee['body']['id'];return db[_0xe183('0x36')]['findOne']({'where':{'id':_0x1104ee[_0xe183('0x4e')]['id']}})[_0xe183('0x2e')](handleEntityNotFound(_0x230e31,null))['then'](function(_0x27e5be){if(_0x27e5be){return db[_0xe183('0x8e')][_0xe183('0x8f')](function(_0x6c734c){return db['CmCustomField'][_0xe183('0x53')](_0x1104ee[_0xe183('0x54')],{'transaction':_0x6c734c})[_0xe183('0x2e')](function(_0x4953c6){_0x331324=_0x4953c6;return _0x27e5be[_0xe183('0x90')](_0x4953c6,{'transaction':_0x6c734c});})[_0xe183('0x2e')](function(){var _0x169ec5={'type':db[_0xe183('0x91')][_0xe183('0x92')],'transaction':_0x6c734c};switch(_0x1104ee[_0xe183('0x54')][_0xe183('0x38')]){case _0xe183('0x93'):_0x169ec5[_0xe183('0x38')]=db[_0xe183('0x91')][_0xe183('0x92')];break;case _0xe183('0x94'):_0x169ec5[_0xe183('0x38')]=db['Sequelize'][_0xe183('0x95')];break;case _0xe183('0x96'):_0x169ec5['type']=db[_0xe183('0x91')]['BOOLEAN'];_0x169ec5['defaultValue']=![];break;default:}return db[_0xe183('0x8e')]['queryInterface'][_0xe183('0x97')]('cm_contacts',util['format'](_0xe183('0x98'),_0x331324['id']),_0x169ec5);})[_0xe183('0x2e')](function(){return _0x331324;});});}})[_0xe183('0x2e')](respondWithResult(_0x230e31,null))[_0xe183('0x5b')](handleError(_0x230e31,null));};exports[_0xe183('0x99')]=function(_0x3a0799,_0x1f3a2b,_0x18fc68){var _0x4b15c7={};var _0xa38f27={};var _0x3f6942;var _0x5e9d4b;return db[_0xe183('0x36')][_0xe183('0x9a')]({'where':{'id':_0x3a0799[_0xe183('0x4e')]['id']}})[_0xe183('0x2e')](handleEntityNotFound(_0x1f3a2b,null))[_0xe183('0x2e')](function(_0x55be88){if(_0x55be88){_0x3f6942=_0x55be88;_0xa38f27['model']=_[_0xe183('0x4f')](db[_0xe183('0x6f')][_0xe183('0x50')]);_0xa38f27[_0xe183('0x3b')]=_[_0xe183('0x4f')](_0x3a0799['query']);_0xa38f27[_0xe183('0x3c')]=_['intersection'](_0xa38f27[_0xe183('0x39')],_0xa38f27['query']);_0x4b15c7['attributes']=_[_0xe183('0x3e')](_0xa38f27['model'],qs[_0xe183('0x3f')](_0x3a0799['query'][_0xe183('0x3f')]));_0x4b15c7[_0xe183('0x3d')]=_0x4b15c7['attributes'][_0xe183('0x40')]?_0x4b15c7[_0xe183('0x3d')]:_0xa38f27[_0xe183('0x39')];_0x4b15c7[_0xe183('0x42')]=qs[_0xe183('0x43')](_0x3a0799[_0xe183('0x3b')][_0xe183('0x43')]);_0x4b15c7[_0xe183('0x46')]=qs[_0xe183('0x3c')](_[_0xe183('0x44')](_0x3a0799['query'],_0xa38f27[_0xe183('0x3c')]));_0x4b15c7['where']=_['merge'](_0x4b15c7[_0xe183('0x46')],{'$or':[{'ListId':_0x55be88['id']},{'ListId':null}]});if(_0x3a0799[_0xe183('0x3b')][_0xe183('0x45')]){_0x4b15c7['where']=_[_0xe183('0x47')](_0x4b15c7[_0xe183('0x46')],{'$or':_[_0xe183('0x3a')](_0x4b15c7[_0xe183('0x3d')],function(_0x5d5ff9){var _0x3099df={};_0x3099df[_0x5d5ff9]={'$like':'%'+_0x3a0799[_0xe183('0x3b')][_0xe183('0x45')]+'%'};return _0x3099df;})});}_0x4b15c7=_[_0xe183('0x47')]({},_0x4b15c7,_0x3a0799[_0xe183('0x51')]);return db[_0xe183('0x6f')][_0xe183('0x9b')](_0x4b15c7);}})[_0xe183('0x2e')](respondWithResult(_0x1f3a2b,null))[_0xe183('0x5b')](handleError(_0x1f3a2b,null));};exports[_0xe183('0x9c')]=function(_0x38903b,_0x1338a0){return db['CmCustomField'][_0xe183('0x9b')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x1338a0,null))[_0xe183('0x2e')](function(_0x2ebf33){return _0x2ebf33;})[_0xe183('0x2e')](respondWithResult(_0x1338a0,null))[_0xe183('0x5b')](handleError(_0x1338a0,null));};exports[_0xe183('0x9d')]=function(_0x4b5bc4,_0x275d82,_0x21d1b3){return db[_0xe183('0x36')][_0xe183('0x52')]({'where':{'id':_0x4b5bc4[_0xe183('0x4e')]['id']}})[_0xe183('0x2e')](handleEntityNotFound(_0x275d82,null))[_0xe183('0x2e')](function(_0x36e2a1){if(_0x36e2a1){return _0x36e2a1['addAgents'](_0x4b5bc4[_0xe183('0x54')][_0xe183('0x63')],_[_0xe183('0x6a')](_0x4b5bc4['body'],['ids','id'])||{})[_0xe183('0x9e')](function(_0x3681d4){for(var _0x2123a9=0x0;_0x2123a9<_0x4b5bc4[_0xe183('0x54')][_0xe183('0x63')][_0xe183('0x40')];_0x2123a9+=0x1){socket['emit'](_0xe183('0x9f'),{'UserId':Number(_0x4b5bc4[_0xe183('0x54')]['ids'][_0x2123a9]),'CmListId':Number(_0x4b5bc4['params']['id'])});}return _0x3681d4;});}})['then'](respondWithResult(_0x275d82,null))[_0xe183('0x5b')](handleError(_0x275d82,null));};exports[_0xe183('0xa0')]=function(_0x5207c0,_0x385598,_0x4cd70a){return db['CmList'][_0xe183('0x52')]({'where':{'id':_0x5207c0['params']['id']}})[_0xe183('0x2e')](handleEntityNotFound(_0x385598,null))[_0xe183('0x2e')](function(_0x41d87c){if(_0x41d87c){return _0x41d87c[_0xe183('0xa0')](_0x5207c0['query'][_0xe183('0x63')])[_0xe183('0x2e')](function(){if(_['isArray'](_0x5207c0[_0xe183('0x3b')]['ids'])){for(var _0x39e1c5=0x0;_0x39e1c5<_0x5207c0[_0xe183('0x3b')][_0xe183('0x63')][_0xe183('0x40')];_0x39e1c5+=0x1){socket[_0xe183('0xa1')](_0xe183('0xa2'),{'UserId':Number(_0x5207c0[_0xe183('0x3b')][_0xe183('0x63')][_0x39e1c5]),'CmListId':Number(_0x5207c0['params']['id'])});}}else{socket[_0xe183('0xa1')](_0xe183('0xa2'),{'UserId':Number(_0x5207c0[_0xe183('0x3b')][_0xe183('0x63')]),'CmListId':Number(_0x5207c0[_0xe183('0x4e')]['id'])});}});}})[_0xe183('0x2e')](respondWithStatusCode(_0x385598,null))[_0xe183('0x5b')](handleError(_0x385598,null));};exports[_0xe183('0xa3')]=function(_0x23fb47,_0x153cc7,_0x2ea847){var _0x531916={};var _0x1d36d6={};var _0x381676;var _0x3c402c;return db[_0xe183('0x36')]['findOne']({'where':{'id':_0x23fb47[_0xe183('0x4e')]['id']}})[_0xe183('0x2e')](handleEntityNotFound(_0x153cc7,null))['then'](function(_0x3a0f5e){if(_0x3a0f5e){_0x381676=_0x3a0f5e;_0x1d36d6[_0xe183('0x39')]=_[_0xe183('0x4f')](db[_0xe183('0xa4')]['rawAttributes']);_0x1d36d6[_0xe183('0x3b')]=_[_0xe183('0x4f')](_0x23fb47[_0xe183('0x3b')]);_0x1d36d6[_0xe183('0x3c')]=_['intersection'](_0x1d36d6[_0xe183('0x39')],_0x1d36d6[_0xe183('0x3b')]);_0x531916[_0xe183('0x3d')]=_[_0xe183('0x3e')](_0x1d36d6[_0xe183('0x39')],qs[_0xe183('0x3f')](_0x23fb47[_0xe183('0x3b')][_0xe183('0x3f')]));_0x531916['attributes']=_0x531916[_0xe183('0x3d')][_0xe183('0x40')]?_0x531916[_0xe183('0x3d')]:_0x1d36d6[_0xe183('0x39')];_0x531916[_0xe183('0x42')]=qs[_0xe183('0x43')](_0x23fb47[_0xe183('0x3b')][_0xe183('0x43')]);_0x531916[_0xe183('0x46')]=qs[_0xe183('0x3c')](_['pick'](_0x23fb47[_0xe183('0x3b')],_0x1d36d6['filters']));if(_0x23fb47['query'][_0xe183('0x45')]){_0x531916[_0xe183('0x46')]=_[_0xe183('0x47')](_0x531916['where'],{'$or':_[_0xe183('0x3a')](_0x531916[_0xe183('0x3d')],function(_0x2f5231){var _0xb44820={};_0xb44820[_0x2f5231]={'$like':'%'+_0x23fb47[_0xe183('0x3b')][_0xe183('0x45')]+'%'};return _0xb44820;})});}_0x531916=_[_0xe183('0x47')]({},_0x531916,_0x23fb47[_0xe183('0x51')]);return _0x381676[_0xe183('0xa3')](_0x531916);}})[_0xe183('0x2e')](function(_0x37c158){if(_0x37c158){_0x3c402c=_0x37c158[_0xe183('0x40')];if(!_0x23fb47[_0xe183('0x3b')]['hasOwnProperty']('nolimit')){_0x531916[_0xe183('0x26')]=qs['limit'](_0x23fb47['query'][_0xe183('0x26')]);_0x531916[_0xe183('0x24')]=qs[_0xe183('0x24')](_0x23fb47['query']['offset']);}return _0x381676['getAgents'](_0x531916);}})['then'](function(_0x3f8ad2){if(_0x3f8ad2){return _0x3f8ad2?{'count':_0x3c402c,'rows':_0x3f8ad2}:null;}})['then'](respondWithResult(_0x153cc7,null))[_0xe183('0x5b')](handleError(_0x153cc7,null));};function handleQuery(_0x342ec9){logger[_0xe183('0xa5')](_0x342ec9);return db[_0xe183('0x8e')]['query'](_0x342ec9)[_0xe183('0x9e')](function(_0x988b5d){csv_results[_0xe183('0x68')](_0x988b5d);})['catch'](function(_0x3ace5f){logger['error'](_0x3ace5f['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 3cb4d7b..a7856de 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(_0x54f696,_0x532152){var _0x1323d8=function(_0x336656){while(--_0x336656){_0x54f696['push'](_0x54f696['shift']());}};_0x1323d8(++_0x532152);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x5018bd,_0x24b200){var _0x5cb7c7=function(_0x3a5d84){while(--_0x3a5d84){_0x5018bd['push'](_0x5018bd['shift']());}};_0x5cb7c7(++_0x24b200);}(_0x814b,0x1a2));var _0xb814=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0x814b[_0x5e8eae];return _0xdd09cd;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index eb29895..e133826 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 _0xbec5=['request-promise','path','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','api','moment','bluebird'];(function(_0xeaab78,_0x365743){var _0x143298=function(_0x273554){while(--_0x273554){_0xeaab78['push'](_0xeaab78['shift']());}};_0x143298(++_0x365743);}(_0xbec5,0xe5));var _0x5bec=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0xbec5[_0x31eb67];return _0x2a8cb8;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa74f=['cm_lists','../../config/logger','bluebird','request-promise','path','rimraf','./cmList.attributes','define','CmList'];(function(_0x4f38a3,_0x5e4902){var _0x233958=function(_0x316502){while(--_0x316502){_0x4f38a3['push'](_0x4f38a3['shift']());}};_0x233958(++_0x5e4902);}(_0xa74f,0x9a));var _0xfa74=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0xa74f[_0x2f6f50];return _0x2cf365;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa74('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfa74('0x1'));var rp=require(_0xfa74('0x2'));var fs=require('fs');var path=require(_0xfa74('0x3'));var rimraf=require(_0xfa74('0x4'));var config=require('../../config/environment');var attributes=require(_0xfa74('0x5'));module['exports']=function(_0x543cfe,_0x43dd2f){return _0x543cfe[_0xfa74('0x6')](_0xfa74('0x7'),attributes,{'tableName':_0xfa74('0x8'),'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 393d596..11c3325 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 _0x9a9e=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2cfc8c,_0x5472df){var _0x1de813=function(_0x580f50){while(--_0x580f50){_0x2cfc8c['push'](_0x2cfc8c['shift']());}};_0x1de813(++_0x5472df);}(_0x9a9e,0xc1));var _0xe9a9=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x9a9e[_0x25bea7];return _0x175952;};'use strict';var _=require(_0xe9a9('0x0'));var util=require('util');var moment=require(_0xe9a9('0x1'));var BPromise=require('bluebird');var rs=require(_0xe9a9('0x2'));var fs=require('fs');var Redis=require(_0xe9a9('0x3'));var db=require(_0xe9a9('0x4'))['db'];var utils=require(_0xe9a9('0x5'));var logger=require(_0xe9a9('0x6'))('rpc');var config=require(_0xe9a9('0x7'));var jayson=require(_0xe9a9('0x8'));var client=jayson[_0xe9a9('0x9')][_0xe9a9('0xa')]({'port':0x232a});config[_0xe9a9('0xb')]=_[_0xe9a9('0xc')](config[_0xe9a9('0xb')],{'host':_0xe9a9('0xd'),'port':0x18eb});var socket=require(_0xe9a9('0xe'))(new Redis(config['redis']));require('./cmList.socket')[_0xe9a9('0xf')](socket);function respondWithRpcPromise(_0x175d55,_0x1a0579,_0xfe219d){return new BPromise(function(_0x41d913,_0x235645){return client[_0xe9a9('0x10')](_0x175d55,_0xfe219d)[_0xe9a9('0x11')](function(_0xdbc2b){logger[_0xe9a9('0x12')](_0xe9a9('0x13'),_0x1a0579,_0xe9a9('0x14'));logger[_0xe9a9('0x15')](_0xe9a9('0x16'),_0x1a0579,_0xe9a9('0x14'),JSON[_0xe9a9('0x17')](_0xdbc2b));if(_0xdbc2b['error']){if(_0xdbc2b[_0xe9a9('0x18')][_0xe9a9('0x19')]===0x1f4){logger['error'](_0xe9a9('0x13'),_0x1a0579,_0xdbc2b[_0xe9a9('0x18')][_0xe9a9('0x1a')]);return _0x235645(_0xdbc2b[_0xe9a9('0x18')][_0xe9a9('0x1a')]);}logger[_0xe9a9('0x18')](_0xe9a9('0x13'),_0x1a0579,_0xdbc2b['error'][_0xe9a9('0x1a')]);return _0x41d913(_0xdbc2b['error'][_0xe9a9('0x1a')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x1a0579,'request\x20sent');_0x41d913(_0xdbc2b[_0xe9a9('0x1b')]['message']);}})[_0xe9a9('0x1c')](function(_0x268c85){logger[_0xe9a9('0x18')]('CmList,\x20%s,\x20%s',_0x1a0579,_0x268c85);_0x235645(_0x268c85);});});} \ No newline at end of file +var _0xeaeb=['client','http','redis','defaults','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xeaeb,0xd6));var _0xbeae=function(_0x441dd4,_0x582db9){_0x441dd4=_0x441dd4-0x0;var _0x54ea8b=_0xeaeb[_0x441dd4];return _0x54ea8b;};'use strict';var _=require(_0xbeae('0x0'));var util=require(_0xbeae('0x1'));var moment=require(_0xbeae('0x2'));var BPromise=require(_0xbeae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbeae('0x4'));var db=require(_0xbeae('0x5'))['db'];var utils=require(_0xbeae('0x6'));var logger=require(_0xbeae('0x7'))(_0xbeae('0x8'));var config=require(_0xbeae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbeae('0xa')][_0xbeae('0xb')]({'port':0x232a});config[_0xbeae('0xc')]=_[_0xbeae('0xd')](config['redis'],{'host':_0xbeae('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbeae('0xc')]));require(_0xbeae('0xf'))[_0xbeae('0x10')](socket);function respondWithRpcPromise(_0x37c843,_0x3bd0a3,_0x25f43a){return new BPromise(function(_0xf7e437,_0x1c0809){return client[_0xbeae('0x11')](_0x37c843,_0x25f43a)[_0xbeae('0x12')](function(_0x3cf96d){logger[_0xbeae('0x13')](_0xbeae('0x14'),_0x3bd0a3,'request\x20sent');logger['debug'](_0xbeae('0x15'),_0x3bd0a3,_0xbeae('0x16'),JSON['stringify'](_0x3cf96d));if(_0x3cf96d['error']){if(_0x3cf96d['error'][_0xbeae('0x17')]===0x1f4){logger[_0xbeae('0x18')]('CmList,\x20%s,\x20%s',_0x3bd0a3,_0x3cf96d['error'][_0xbeae('0x19')]);return _0x1c0809(_0x3cf96d['error'][_0xbeae('0x19')]);}logger[_0xbeae('0x18')](_0xbeae('0x14'),_0x3bd0a3,_0x3cf96d['error']['message']);return _0xf7e437(_0x3cf96d['error'][_0xbeae('0x19')]);}else{logger[_0xbeae('0x13')](_0xbeae('0x14'),_0x3bd0a3,'request\x20sent');_0xf7e437(_0x3cf96d[_0xbeae('0x1a')]['message']);}})[_0xbeae('0x1b')](function(_0x129bff){logger[_0xbeae('0x18')](_0xbeae('0x14'),_0x3bd0a3,_0x129bff);_0x1c0809(_0x129bff);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 5a9b2f6..0ecabe9 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 _0xca72=['register','length','cmList:','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca72,0x1bf));var _0x2ca7=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0xca72[_0x175e89];return _0x2ed996;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x2ca7('0x0'),_0x2ca7('0x1'),'update'];function createListener(_0x20d905,_0x5d2415){return function(_0xef2f7){_0x5d2415[_0x2ca7('0x2')](_0x20d905,_0xef2f7);};}function removeListener(_0x279759,_0x35758f){return function(){CmListEvents['removeListener'](_0x279759,_0x35758f);};}exports[_0x2ca7('0x3')]=function(_0x108833){for(var _0x5c4972=0x0,_0xadde62=events[_0x2ca7('0x4')];_0x5c4972<_0xadde62;_0x5c4972++){var _0x5106ff=events[_0x5c4972];var _0x4e2362=createListener(_0x2ca7('0x5')+_0x5106ff,_0x108833);CmListEvents['on'](_0x5106ff,_0x4e2362);}}; \ No newline at end of file +var _0xe6f7=['save','remove','update','emit','removeListener','length','cmList:','./cmList.events'];(function(_0x223152,_0x17ab65){var _0x594a07=function(_0x570f91){while(--_0x570f91){_0x223152['push'](_0x223152['shift']());}};_0x594a07(++_0x17ab65);}(_0xe6f7,0x197));var _0x7e6f=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0xe6f7[_0x39a2d6];return _0x23af66;};'use strict';var CmListEvents=require(_0x7e6f('0x0'));var events=[_0x7e6f('0x1'),_0x7e6f('0x2'),_0x7e6f('0x3')];function createListener(_0x26e37f,_0x3a82ed){return function(_0x1ae48d){_0x3a82ed[_0x7e6f('0x4')](_0x26e37f,_0x1ae48d);};}function removeListener(_0x45c5b0,_0xa71a66){return function(){CmListEvents[_0x7e6f('0x5')](_0x45c5b0,_0xa71a66);};}exports['register']=function(_0x19fe74){for(var _0x1af445=0x0,_0x429382=events[_0x7e6f('0x6')];_0x1af445<_0x429382;_0x1af445++){var _0x5454b2=events[_0x1af445];var _0x4268c1=createListener(_0x7e6f('0x7')+_0x5454b2,_0x19fe74);CmListEvents['on'](_0x5454b2,_0x4268c1);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index fca7c0d..df77879 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 _0xd0d5=['../../components/auth/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addContacts','addCustomField','addAgents','put','update','delete','removeDispositions','removeAgents','exports','Router','fs-extra'];(function(_0x438d5c,_0x41407a){var _0x254322=function(_0x2682b8){while(--_0x2682b8){_0x438d5c['push'](_0x438d5c['shift']());}};_0x254322(++_0x41407a);}(_0xd0d5,0x1ed));var _0x5d0d=function(_0x156a7d,_0x30fe8f){_0x156a7d=_0x156a7d-0x0;var _0x49b857=_0xd0d5[_0x156a7d];return _0x49b857;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5d0d('0x0')]();var fs_extra=require(_0x5d0d('0x1'));var auth=require(_0x5d0d('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5d0d('0x3'));router[_0x5d0d('0x4')]('/',auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x6')]);router['get'](_0x5d0d('0x7'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x8')]);router[_0x5d0d('0x4')](_0x5d0d('0x9'),auth['isAuthenticated'](),controller[_0x5d0d('0xa')]);router['get'](_0x5d0d('0xb'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0xc')]);router[_0x5d0d('0x4')](_0x5d0d('0xd'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0xe')]);router['get'](_0x5d0d('0xf'),auth[_0x5d0d('0x5')](),controller['getContacts']);router['get'](_0x5d0d('0x10'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x11')]);router[_0x5d0d('0x4')](_0x5d0d('0x12'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x13')]);router[_0x5d0d('0x4')](_0x5d0d('0x14'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x15')]);router[_0x5d0d('0x16')]('/',auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x17')]);router['post'](_0x5d0d('0xd'),auth[_0x5d0d('0x5')](),controller['addDisposition']);router[_0x5d0d('0x16')](_0x5d0d('0xf'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x18')]);router[_0x5d0d('0x16')](_0x5d0d('0x12'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x19')]);router[_0x5d0d('0x16')]('/:id/users',auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x1a')]);router[_0x5d0d('0x1b')]('/:id',auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x1c')]);router[_0x5d0d('0x1d')](_0x5d0d('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x5d0d('0x1d')](_0x5d0d('0xd'),auth['isAuthenticated'](),controller[_0x5d0d('0x1e')]);router[_0x5d0d('0x1d')](_0x5d0d('0x14'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x1f')]);module[_0x5d0d('0x20')]=router; \ No newline at end of file +var _0x24ab=['addAgents','delete','destroy','removeDispositions','removeAgents','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','describe','/global_fields','getGlobalCustomFields','/:id','/:id/dispositions','/:id/fields','getCustomFields','post','create','addDisposition','/:id/contacts','addContacts','addCustomField','/:id/users'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24ab,0x13c));var _0xb24a=function(_0x1276f5,_0x5153e2){_0x1276f5=_0x1276f5-0x0;var _0x14d765=_0x24ab[_0x1276f5];return _0x14d765;};'use strict';var multer=require(_0xb24a('0x0'));var util=require('util');var path=require(_0xb24a('0x1'));var timeout=require('connect-timeout');var express=require(_0xb24a('0x2'));var router=express['Router']();var fs_extra=require(_0xb24a('0x3'));var auth=require(_0xb24a('0x4'));var interaction=require(_0xb24a('0x5'));var config=require(_0xb24a('0x6'));var controller=require(_0xb24a('0x7'));router[_0xb24a('0x8')]('/',auth[_0xb24a('0x9')](),controller['index']);router[_0xb24a('0x8')](_0xb24a('0xa'),auth[_0xb24a('0x9')](),controller[_0xb24a('0xb')]);router[_0xb24a('0x8')](_0xb24a('0xc'),auth[_0xb24a('0x9')](),controller[_0xb24a('0xd')]);router[_0xb24a('0x8')](_0xb24a('0xe'),auth[_0xb24a('0x9')](),controller['show']);router[_0xb24a('0x8')](_0xb24a('0xf'),auth[_0xb24a('0x9')](),controller['getDispositions']);router[_0xb24a('0x8')]('/:id/contacts',auth[_0xb24a('0x9')](),controller['getContacts']);router[_0xb24a('0x8')]('/:id/contacts/csv',auth['isAuthenticated'](),controller['getContactsCsv']);router[_0xb24a('0x8')](_0xb24a('0x10'),auth['isAuthenticated'](),controller[_0xb24a('0x11')]);router[_0xb24a('0x8')]('/:id/users',auth[_0xb24a('0x9')](),controller['getAgents']);router[_0xb24a('0x12')]('/',auth[_0xb24a('0x9')](),controller[_0xb24a('0x13')]);router[_0xb24a('0x12')](_0xb24a('0xf'),auth['isAuthenticated'](),controller[_0xb24a('0x14')]);router[_0xb24a('0x12')](_0xb24a('0x15'),auth[_0xb24a('0x9')](),controller[_0xb24a('0x16')]);router['post']('/:id/fields',auth[_0xb24a('0x9')](),controller[_0xb24a('0x17')]);router[_0xb24a('0x12')](_0xb24a('0x18'),auth[_0xb24a('0x9')](),controller[_0xb24a('0x19')]);router['put'](_0xb24a('0xe'),auth[_0xb24a('0x9')](),controller['update']);router[_0xb24a('0x1a')](_0xb24a('0xe'),auth[_0xb24a('0x9')](),controller[_0xb24a('0x1b')]);router[_0xb24a('0x1a')](_0xb24a('0xf'),auth[_0xb24a('0x9')](),controller[_0xb24a('0x1c')]);router[_0xb24a('0x1a')](_0xb24a('0x18'),auth[_0xb24a('0x9')](),controller[_0xb24a('0x1d')]);module[_0xb24a('0x1e')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 33f065c..1d889d5 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 _0xd50c=['STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x35967c,_0x135008){var _0x7a39b7=function(_0x207e69){while(--_0x207e69){_0x35967c['push'](_0x35967c['shift']());}};_0x7a39b7(++_0x135008);}(_0xd50c,0x178));var _0xcd50=function(_0x1cb868,_0x17d978){_0x1cb868=_0x1cb868-0x0;var _0x4de2f4=_0xd50c[_0x1cb868];return _0x4de2f4;};'use strict';var Sequelize=require(_0xcd50('0x0'));module[_0xcd50('0x1')]={'name':{'type':Sequelize[_0xcd50('0x2')],'get':function(_0x60d468){return this[_0xcd50('0x3')]('field');}},'field':{'type':Sequelize[_0xcd50('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xcd50('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x2dff=['exports','VIRTUAL','getDataValue','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2dff,0x84));var _0xf2df=function(_0x495b5a,_0x42d778){_0x495b5a=_0x495b5a-0x0;var _0x4d77f0=_0x2dff[_0x495b5a];return _0x4d77f0;};'use strict';var Sequelize=require('sequelize');module[_0xf2df('0x0')]={'name':{'type':Sequelize[_0xf2df('0x1')],'get':function(_0xe299bc){return this[_0xf2df('0x2')]('field');}},'field':{'type':Sequelize[_0xf2df('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index f27037a..7b306ed 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x20643b,_0x199285){var _0x185ef6=function(_0x5ce6da){while(--_0x5ce6da){_0x20643b['push'](_0x20643b['shift']());}};_0x185ef6(++_0x199285);}(_0x7a54,0x106));var _0x47a5=function(_0x117889,_0x394788){_0x117889=_0x117889-0x0;var _0x180bdb=_0x7a54[_0x117889];return _0x180bdb;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _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(_0x16fefd,_0x1a5183){var _0xee8b0b=function(_0xe2dd6d){while(--_0xe2dd6d){_0x16fefd['push'](_0x16fefd['shift']());}};_0xee8b0b(++_0x1a5183);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 41362c2..c84088c 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 _0xaca6=['tools_conditions','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','Condition'];(function(_0x8fdbb3,_0x40f930){var _0x3e1f2a=function(_0x2c85e1){while(--_0x2c85e1){_0x8fdbb3['push'](_0x8fdbb3['shift']());}};_0x3e1f2a(++_0x40f930);}(_0xaca6,0x196));var _0x6aca=function(_0x3edbbd,_0x5331ef){_0x3edbbd=_0x3edbbd-0x0;var _0x358679=_0xaca6[_0x3edbbd];return _0x358679;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6aca('0x0'))(_0x6aca('0x1'));var moment=require(_0x6aca('0x2'));var BPromise=require(_0x6aca('0x3'));var rp=require(_0x6aca('0x4'));var fs=require('fs');var path=require(_0x6aca('0x5'));var rimraf=require('rimraf');var config=require(_0x6aca('0x6'));var attributes=require('./condition.attributes');module['exports']=function(_0x56a7b1,_0x9f032f){return _0x56a7b1['define'](_0x6aca('0x7'),attributes,{'tableName':_0x6aca('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x839d=['rimraf','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x839d,0x11a));var _0xd839=function(_0x1844a3,_0xcbc14f){_0x1844a3=_0x1844a3-0x0;var _0x16c5b9=_0x839d[_0x1844a3];return _0x16c5b9;};'use strict';var _=require(_0xd839('0x0'));var util=require(_0xd839('0x1'));var logger=require('../../config/logger')(_0xd839('0x2'));var moment=require(_0xd839('0x3'));var BPromise=require(_0xd839('0x4'));var rp=require(_0xd839('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd839('0x6'));var config=require('../../config/environment');var attributes=require(_0xd839('0x7'));module[_0xd839('0x8')]=function(_0x25853d,_0x1fa36d){return _0x25853d[_0xd839('0x9')](_0xd839('0xa'),attributes,{'tableName':_0xd839('0xb'),'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 5554f03..3b7d4b9 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 _0xeaf6=['message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x343018,_0x1c1d6d){var _0x382429=function(_0x35efd8){while(--_0x35efd8){_0x343018['push'](_0x343018['shift']());}};_0x382429(++_0x1c1d6d);}(_0xeaf6,0x111));var _0x6eaf=function(_0x5394ee,_0x322947){_0x5394ee=_0x5394ee-0x0;var _0x1acef7=_0xeaf6[_0x5394ee];return _0x1acef7;};'use strict';var _=require(_0x6eaf('0x0'));var util=require(_0x6eaf('0x1'));var moment=require('moment');var BPromise=require(_0x6eaf('0x2'));var rs=require(_0x6eaf('0x3'));var fs=require('fs');var Redis=require(_0x6eaf('0x4'));var db=require(_0x6eaf('0x5'))['db'];var utils=require(_0x6eaf('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6eaf('0x7'));var client=jayson['client'][_0x6eaf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b53e5,_0x51868c,_0xd01133){return new BPromise(function(_0x2fb1f0,_0x22f25c){return client[_0x6eaf('0x9')](_0x1b53e5,_0xd01133)['then'](function(_0x5eb152){logger['info'](_0x6eaf('0xa'),_0x51868c,_0x6eaf('0xb'));logger['debug'](_0x6eaf('0xc'),_0x51868c,_0x6eaf('0xb'),JSON['stringify'](_0x5eb152));if(_0x5eb152[_0x6eaf('0xd')]){if(_0x5eb152[_0x6eaf('0xd')][_0x6eaf('0xe')]===0x1f4){logger[_0x6eaf('0xd')](_0x6eaf('0xa'),_0x51868c,_0x5eb152[_0x6eaf('0xd')][_0x6eaf('0xf')]);return _0x22f25c(_0x5eb152[_0x6eaf('0xd')]['message']);}logger['error'](_0x6eaf('0xa'),_0x51868c,_0x5eb152[_0x6eaf('0xd')]['message']);return _0x2fb1f0(_0x5eb152['error']['message']);}else{logger[_0x6eaf('0x10')](_0x6eaf('0xa'),_0x51868c,'request\x20sent');_0x2fb1f0(_0x5eb152['result'][_0x6eaf('0xf')]);}})[_0x6eaf('0x11')](function(_0x280f6d){logger['error'](_0x6eaf('0xa'),_0x51868c,_0x280f6d);_0x22f25c(_0x280f6d);});});} \ No newline at end of file +var _0xa4d2=['http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0xa4d2,0x182));var _0x2a4d=function(_0x35da62,_0x59d032){_0x35da62=_0x35da62-0x0;var _0x4a7691=_0xa4d2[_0x35da62];return _0x4a7691;};'use strict';var _=require(_0x2a4d('0x0'));var util=require('util');var moment=require(_0x2a4d('0x1'));var BPromise=require(_0x2a4d('0x2'));var rs=require(_0x2a4d('0x3'));var fs=require('fs');var Redis=require(_0x2a4d('0x4'));var db=require(_0x2a4d('0x5'))['db'];var utils=require(_0x2a4d('0x6'));var logger=require('../../config/logger')(_0x2a4d('0x7'));var config=require('../../config/environment');var jayson=require(_0x2a4d('0x8'));var client=jayson[_0x2a4d('0x9')][_0x2a4d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x555055,_0x1cce78,_0x269bec){return new BPromise(function(_0x23942e,_0x332233){return client[_0x2a4d('0xb')](_0x555055,_0x269bec)[_0x2a4d('0xc')](function(_0x332cca){logger[_0x2a4d('0xd')](_0x2a4d('0xe'),_0x1cce78,_0x2a4d('0xf'));logger['debug'](_0x2a4d('0x10'),_0x1cce78,'request\x20sent',JSON[_0x2a4d('0x11')](_0x332cca));if(_0x332cca[_0x2a4d('0x12')]){if(_0x332cca['error'][_0x2a4d('0x13')]===0x1f4){logger[_0x2a4d('0x12')]('Condition,\x20%s,\x20%s',_0x1cce78,_0x332cca['error']['message']);return _0x332233(_0x332cca[_0x2a4d('0x12')][_0x2a4d('0x14')]);}logger[_0x2a4d('0x12')](_0x2a4d('0xe'),_0x1cce78,_0x332cca[_0x2a4d('0x12')]['message']);return _0x23942e(_0x332cca[_0x2a4d('0x12')][_0x2a4d('0x14')]);}else{logger[_0x2a4d('0xd')](_0x2a4d('0xe'),_0x1cce78,'request\x20sent');_0x23942e(_0x332cca[_0x2a4d('0x15')]['message']);}})['catch'](function(_0x1daf3c){logger['error'](_0x2a4d('0xe'),_0x1cce78,_0x1daf3c);_0x332233(_0x1daf3c);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 2583363..acdbc88 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 _0xe115=['isAuthenticated','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put'];(function(_0x1a7e22,_0xc1e6d8){var _0x36b1c2=function(_0x3f640e){while(--_0x3f640e){_0x1a7e22['push'](_0x1a7e22['shift']());}};_0x36b1c2(++_0xc1e6d8);}(_0xe115,0xe3));var _0x5e11=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xe115[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require('multer');var util=require(_0x5e11('0x0'));var path=require(_0x5e11('0x1'));var timeout=require(_0x5e11('0x2'));var express=require(_0x5e11('0x3'));var router=express[_0x5e11('0x4')]();var fs_extra=require(_0x5e11('0x5'));var auth=require(_0x5e11('0x6'));var interaction=require(_0x5e11('0x7'));var config=require(_0x5e11('0x8'));var controller=require(_0x5e11('0x9'));router[_0x5e11('0xa')]('/:id',auth[_0x5e11('0xb')](),controller[_0x5e11('0xc')]);router[_0x5e11('0xd')](_0x5e11('0xe'),auth[_0x5e11('0xb')](),controller[_0x5e11('0xf')]);module[_0x5e11('0x10')]=router; \ No newline at end of file +var _0x4a81=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','destroy'];(function(_0x39f34f,_0x298f45){var _0x59fee1=function(_0x6ebbb7){while(--_0x6ebbb7){_0x39f34f['push'](_0x39f34f['shift']());}};_0x59fee1(++_0x298f45);}(_0x4a81,0x1e1));var _0x14a8=function(_0x4e9ad1,_0x3007a7){_0x4e9ad1=_0x4e9ad1-0x0;var _0x4f70ee=_0x4a81[_0x4e9ad1];return _0x4f70ee;};'use strict';var multer=require(_0x14a8('0x0'));var util=require(_0x14a8('0x1'));var path=require(_0x14a8('0x2'));var timeout=require(_0x14a8('0x3'));var express=require(_0x14a8('0x4'));var router=express['Router']();var fs_extra=require(_0x14a8('0x5'));var auth=require(_0x14a8('0x6'));var interaction=require(_0x14a8('0x7'));var config=require(_0x14a8('0x8'));var controller=require(_0x14a8('0x9'));router[_0x14a8('0xa')](_0x14a8('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x14a8('0xb'),auth[_0x14a8('0xc')](),controller[_0x14a8('0xd')]);module[_0x14a8('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index e800e19..70757ab 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 _0x35d0=['exports','STRING','name','INTEGER','sequelize'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x35d0,0x1da));var _0x035d=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0x35d0[_0x29d623];return _0x242e59;};'use strict';var Sequelize=require(_0x035d('0x0'));module[_0x035d('0x1')]={'name':{'type':Sequelize[_0x035d('0x2')],'allowNull':![],'unique':_0x035d('0x3')},'OrderBy':{'type':Sequelize[_0x035d('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x035d('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x46d9=['name','INTEGER','sequelize','exports','STRING'];(function(_0x1aeb05,_0x4248d2){var _0xb49082=function(_0x479124){while(--_0x479124){_0x1aeb05['push'](_0x1aeb05['shift']());}};_0xb49082(++_0x4248d2);}(_0x46d9,0x16a));var _0x946d=function(_0x90e96d,_0x40ee64){_0x90e96d=_0x90e96d-0x0;var _0x4f0d82=_0x46d9[_0x90e96d];return _0x4f0d82;};'use strict';var Sequelize=require(_0x946d('0x0'));module[_0x946d('0x1')]={'name':{'type':Sequelize[_0x946d('0x2')],'allowNull':![],'unique':_0x946d('0x3')},'OrderBy':{'type':Sequelize[_0x946d('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x946d('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 3913f6d..7561e94 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 _0xd4f4=['reject','save','update','destroy','get','ContactItemTypes','then','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0xd4f4,0x8b));var _0x4d4f=function(_0xdce6c0,_0x3c6032){_0xdce6c0=_0xdce6c0-0x0;var _0x481a7c=_0xd4f4[_0xdce6c0];return _0x481a7c;};'use strict';var emlformat=require(_0x4d4f('0x0'));var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require(_0x4d4f('0x7'));var util=require(_0x4d4f('0x8'));var path=require(_0x4d4f('0x9'));var sox=require(_0x4d4f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var licenseUtil=require(_0x4d4f('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551a10,_0x5b4f4e){_0x5b4f4e=_0x5b4f4e||0xcc;return function(_0x15fe6a){if(_0x15fe6a){return _0x551a10[_0x4d4f('0x1d')](_0x5b4f4e);}return _0x551a10['status'](_0x5b4f4e)[_0x4d4f('0x1e')]();};}function respondWithResult(_0x301380,_0x1878b6){_0x1878b6=_0x1878b6||0xc8;return function(_0x59252c){if(_0x59252c){return _0x301380[_0x4d4f('0x1f')](_0x1878b6)[_0x4d4f('0x20')](_0x59252c);}};}function respondWithFilteredResult(_0x1a9173,_0x4a3364){return function(_0x59bfb5){if(_0x59bfb5){var _0x5e4ff5=typeof _0x4a3364[_0x4d4f('0x21')]===_0x4d4f('0x22')&&typeof _0x4a3364[_0x4d4f('0x23')]==='undefined';var _0x30b6b1=_0x59bfb5[_0x4d4f('0x24')];var _0x51dcf1=_0x5e4ff5?0x0:_0x4a3364['offset'];var _0x519501=_0x5e4ff5?_0x59bfb5['count']:_0x4a3364['offset']+_0x4a3364[_0x4d4f('0x23')];var _0x15100a;if(_0x519501>=_0x30b6b1){_0x519501=_0x30b6b1;_0x15100a=0xc8;}else{_0x15100a=0xce;}_0x1a9173[_0x4d4f('0x1f')](_0x15100a);return _0x1a9173[_0x4d4f('0x25')]('Content-Range',_0x51dcf1+'-'+_0x519501+'/'+_0x30b6b1)['json'](_0x59bfb5);}return null;};}function patchUpdates(_0x1e1ae2){return function(_0x4dd360){try{jsonpatch[_0x4d4f('0x26')](_0x4dd360,_0x1e1ae2,!![]);}catch(_0x1e3e9a){return BPromise[_0x4d4f('0x27')](_0x1e3e9a);}return _0x4dd360[_0x4d4f('0x28')]();};}function saveUpdates(_0x3dd36a,_0x5beab4){return function(_0x570520){if(_0x570520){return _0x570520[_0x4d4f('0x29')](_0x3dd36a)['then'](function(_0x247077){return _0x247077;});}return null;};}function removeEntity(_0x3d5d93,_0x2d2fb3){return function(_0x3f4a55){if(_0x3f4a55){return _0x3f4a55[_0x4d4f('0x2a')]()['then'](function(){var _0x44bd2f=_0x3f4a55[_0x4d4f('0x2b')]({'plain':!![]});var _0x1cf365=_0x4d4f('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x1cf365,'resourceId':_0x44bd2f['id']}})[_0x4d4f('0x2d')](function(){return _0x3f4a55;});})[_0x4d4f('0x2d')](function(){_0x3d5d93[_0x4d4f('0x1f')](0xcc)[_0x4d4f('0x1e')]();});}};}function handleEntityNotFound(_0x58acbe,_0x671c87){return function(_0x380ebf){if(!_0x380ebf){_0x58acbe[_0x4d4f('0x1d')](0x194);}return _0x380ebf;};}function handleError(_0x2e91b2,_0x4effb1){_0x4effb1=_0x4effb1||0x1f4;return function(_0x338ba2){logger['error'](_0x338ba2[_0x4d4f('0x2e')]);if(_0x338ba2[_0x4d4f('0x2f')]){delete _0x338ba2['name'];}_0x2e91b2[_0x4d4f('0x1f')](_0x4effb1)[_0x4d4f('0x30')](_0x338ba2);};}exports[_0x4d4f('0x31')]=function(_0x3d7f14,_0x19a502){var _0x43a704={},_0x4c69cb={},_0x36eede={'count':0x0,'rows':[]};var _0x4578b6=_[_0x4d4f('0x32')](db[_0x4d4f('0x33')][_0x4d4f('0x34')],function(_0x4e47e5){return{'name':_0x4e47e5[_0x4d4f('0x35')],'type':_0x4e47e5['type'][_0x4d4f('0x36')]};});_0x4c69cb['model']=_['map'](_0x4578b6,'name');_0x4c69cb[_0x4d4f('0x37')]=_['keys'](_0x3d7f14[_0x4d4f('0x37')]);_0x4c69cb[_0x4d4f('0x38')]=_[_0x4d4f('0x39')](_0x4c69cb['model'],_0x4c69cb[_0x4d4f('0x37')]);_0x43a704[_0x4d4f('0x3a')]=_[_0x4d4f('0x39')](_0x4c69cb['model'],qs[_0x4d4f('0x3b')](_0x3d7f14['query'][_0x4d4f('0x3b')]));_0x43a704[_0x4d4f('0x3a')]=_0x43a704[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x43a704[_0x4d4f('0x3a')]:_0x4c69cb[_0x4d4f('0x3d')];if(!_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x3e')]('nolimit')){_0x43a704['limit']=qs[_0x4d4f('0x23')](_0x3d7f14['query']['limit']);_0x43a704[_0x4d4f('0x21')]=qs[_0x4d4f('0x21')](_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x21')]);}_0x43a704[_0x4d4f('0x3f')]=qs['sort'](_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x40')]);_0x43a704['where']=qs[_0x4d4f('0x38')](_[_0x4d4f('0x41')](_0x3d7f14[_0x4d4f('0x37')],_0x4c69cb[_0x4d4f('0x38')]),_0x4578b6);if(_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x42')]){_0x43a704[_0x4d4f('0x43')]=_[_0x4d4f('0x44')](_0x43a704[_0x4d4f('0x43')],{'$or':_['map'](_0x4578b6,function(_0x55a151){if(_0x55a151[_0x4d4f('0x45')]!==_0x4d4f('0x46')){var _0x4b3ba1={};_0x4b3ba1[_0x55a151[_0x4d4f('0x2f')]]={'$like':'%'+_0x3d7f14['query']['filter']+'%'};return _0x4b3ba1;}})});}_0x43a704=_[_0x4d4f('0x44')]({},_0x43a704,_0x3d7f14[_0x4d4f('0x47')]);var _0x58b52c={'where':_0x43a704['where']};return db[_0x4d4f('0x33')][_0x4d4f('0x24')](_0x58b52c)['then'](function(_0x949a6d){_0x36eede[_0x4d4f('0x24')]=_0x949a6d;if(_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x48')]){_0x43a704[_0x4d4f('0x49')]=[{'all':!![]}];}return db['ContactItemType'][_0x4d4f('0x4a')](_0x43a704);})['then'](function(_0x45a0c1){_0x36eede[_0x4d4f('0x4b')]=_0x45a0c1;return _0x36eede;})['then'](respondWithFilteredResult(_0x19a502,_0x43a704))[_0x4d4f('0x4c')](handleError(_0x19a502,null));};exports[_0x4d4f('0x4d')]=function(_0x1f7169,_0x489abe){var _0x379b59={'raw':!![],'where':{'id':_0x1f7169[_0x4d4f('0x4e')]['id']}},_0x48caa2={};_0x48caa2['model']=_[_0x4d4f('0x4f')](db[_0x4d4f('0x33')][_0x4d4f('0x34')]);_0x48caa2[_0x4d4f('0x37')]=_[_0x4d4f('0x4f')](_0x1f7169['query']);_0x48caa2['filters']=_[_0x4d4f('0x39')](_0x48caa2[_0x4d4f('0x3d')],_0x48caa2[_0x4d4f('0x37')]);_0x379b59[_0x4d4f('0x3a')]=_['intersection'](_0x48caa2['model'],qs['fields'](_0x1f7169[_0x4d4f('0x37')][_0x4d4f('0x3b')]));_0x379b59[_0x4d4f('0x3a')]=_0x379b59[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x379b59[_0x4d4f('0x3a')]:_0x48caa2[_0x4d4f('0x3d')];if(_0x1f7169[_0x4d4f('0x37')][_0x4d4f('0x48')]){_0x379b59[_0x4d4f('0x49')]=[{'all':!![]}];}_0x379b59=_[_0x4d4f('0x44')]({},_0x379b59,_0x1f7169[_0x4d4f('0x47')]);return db['ContactItemType'][_0x4d4f('0x50')](_0x379b59)[_0x4d4f('0x2d')](handleEntityNotFound(_0x489abe,null))['then'](respondWithResult(_0x489abe,null))[_0x4d4f('0x4c')](handleError(_0x489abe,null));};exports['create']=function(_0x15cf38,_0x401466){return db['ContactItemType'][_0x4d4f('0x51')](_0x15cf38[_0x4d4f('0x52')],{})[_0x4d4f('0x2d')](function(_0x21d0d6){var _0x7f22f2=_0x15cf38[_0x4d4f('0x53')][_0x4d4f('0x2b')]({'plain':!![]});if(!_0x7f22f2)throw new Error(_0x4d4f('0x54'));if(_0x7f22f2[_0x4d4f('0x55')]===_0x4d4f('0x53')){var _0xa6cef=_0x21d0d6[_0x4d4f('0x2b')]({'plain':!![]});var _0x504d85=_0x4d4f('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x504d85,'userProfileId':_0x7f22f2['userProfileId']},'raw':!![]})[_0x4d4f('0x2d')](function(_0x168742){if(_0x168742&&_0x168742['autoAssociation']===0x0){return db['UserProfileResource'][_0x4d4f('0x51')]({'name':_0xa6cef[_0x4d4f('0x2f')],'resourceId':_0xa6cef['id'],'type':_0x168742['name'],'sectionId':_0x168742['id']},{})[_0x4d4f('0x2d')](function(){return _0x21d0d6;});}else{return _0x21d0d6;}})['catch'](function(_0x17b59e){logger[_0x4d4f('0x56')](_0x4d4f('0x57'),_0x17b59e);throw _0x17b59e;});}return _0x21d0d6;})[_0x4d4f('0x2d')](respondWithResult(_0x401466,0xc9))['catch'](handleError(_0x401466,null));};exports[_0x4d4f('0x29')]=function(_0x2008c3,_0x36a446){if(_0x2008c3[_0x4d4f('0x52')]['id']){delete _0x2008c3[_0x4d4f('0x52')]['id'];}return db['ContactItemType'][_0x4d4f('0x50')]({'where':{'id':_0x2008c3['params']['id']}})[_0x4d4f('0x2d')](handleEntityNotFound(_0x36a446,null))['then'](saveUpdates(_0x2008c3[_0x4d4f('0x52')],null))[_0x4d4f('0x2d')](respondWithResult(_0x36a446,null))['catch'](handleError(_0x36a446,null));};exports[_0x4d4f('0x2a')]=function(_0x1d8ae6,_0x4d08c8){return db[_0x4d4f('0x33')]['find']({'where':{'id':_0x1d8ae6[_0x4d4f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4d08c8,null))['then'](db[_0x4d4f('0x58')][_0x4d4f('0x29')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1d8ae6[_0x4d4f('0x4e')]['id']}}))[_0x4d4f('0x2d')](removeEntity(_0x4d08c8,null))[_0x4d4f('0x4c')](handleError(_0x4d08c8,null));}; \ No newline at end of file +var _0x63a5=['end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','ContactItemType','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','CmContactHasItem','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x63a5,0x18e));var _0x563a=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x63a5[_0x556bb1];return _0x45455f;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61d5b2,_0x214f42){_0x214f42=_0x214f42||0xcc;return function(_0x10de2e){if(_0x10de2e){return _0x61d5b2[_0x563a('0x19')](_0x214f42);}return _0x61d5b2[_0x563a('0x1a')](_0x214f42)[_0x563a('0x1b')]();};}function respondWithResult(_0x50396b,_0x2cf052){_0x2cf052=_0x2cf052||0xc8;return function(_0x3045ac){if(_0x3045ac){return _0x50396b[_0x563a('0x1a')](_0x2cf052)[_0x563a('0x1c')](_0x3045ac);}};}function respondWithFilteredResult(_0x5a2980,_0x504cb7){return function(_0x414535){if(_0x414535){var _0x2ad667=typeof _0x504cb7['offset']===_0x563a('0x1d')&&typeof _0x504cb7[_0x563a('0x1e')]===_0x563a('0x1d');var _0x9c2f77=_0x414535['count'];var _0x598693=_0x2ad667?0x0:_0x504cb7[_0x563a('0x1f')];var _0x422aaf=_0x2ad667?_0x414535[_0x563a('0x20')]:_0x504cb7['offset']+_0x504cb7['limit'];var _0x52b99a;if(_0x422aaf>=_0x9c2f77){_0x422aaf=_0x9c2f77;_0x52b99a=0xc8;}else{_0x52b99a=0xce;}_0x5a2980['status'](_0x52b99a);return _0x5a2980[_0x563a('0x21')](_0x563a('0x22'),_0x598693+'-'+_0x422aaf+'/'+_0x9c2f77)[_0x563a('0x1c')](_0x414535);}return null;};}function patchUpdates(_0x43b7a8){return function(_0x562fce){try{jsonpatch['apply'](_0x562fce,_0x43b7a8,!![]);}catch(_0x3930f0){return BPromise[_0x563a('0x23')](_0x3930f0);}return _0x562fce[_0x563a('0x24')]();};}function saveUpdates(_0x2beccb,_0x1bf502){return function(_0x2dc7e2){if(_0x2dc7e2){return _0x2dc7e2[_0x563a('0x25')](_0x2beccb)[_0x563a('0x26')](function(_0x506491){return _0x506491;});}return null;};}function removeEntity(_0xd59ba8,_0x5422f6){return function(_0x44e2c1){if(_0x44e2c1){return _0x44e2c1[_0x563a('0x27')]()[_0x563a('0x26')](function(){var _0x1250e6=_0x44e2c1[_0x563a('0x28')]({'plain':!![]});var _0x1682ee=_0x563a('0x29');return db[_0x563a('0x2a')]['destroy']({'where':{'type':_0x1682ee,'resourceId':_0x1250e6['id']}})[_0x563a('0x26')](function(){return _0x44e2c1;});})[_0x563a('0x26')](function(){_0xd59ba8[_0x563a('0x1a')](0xcc)[_0x563a('0x1b')]();});}};}function handleEntityNotFound(_0xce8165,_0x1898f9){return function(_0x1afdff){if(!_0x1afdff){_0xce8165[_0x563a('0x19')](0x194);}return _0x1afdff;};}function handleError(_0x249db8,_0x8f3429){_0x8f3429=_0x8f3429||0x1f4;return function(_0x1a69d5){logger[_0x563a('0x2b')](_0x1a69d5[_0x563a('0x2c')]);if(_0x1a69d5[_0x563a('0x2d')]){delete _0x1a69d5['name'];}_0x249db8[_0x563a('0x1a')](_0x8f3429)[_0x563a('0x2e')](_0x1a69d5);};}exports[_0x563a('0x2f')]=function(_0x4aaa3d,_0x1e8d43){var _0x2e5c4b={},_0x3a59cb={},_0x28a8f6={'count':0x0,'rows':[]};var _0x166f89=_[_0x563a('0x30')](db[_0x563a('0x31')]['rawAttributes'],function(_0x2418ae){return{'name':_0x2418ae[_0x563a('0x32')],'type':_0x2418ae[_0x563a('0x33')][_0x563a('0x34')]};});_0x3a59cb[_0x563a('0x35')]=_['map'](_0x166f89,'name');_0x3a59cb['query']=_['keys'](_0x4aaa3d[_0x563a('0x36')]);_0x3a59cb[_0x563a('0x37')]=_[_0x563a('0x38')](_0x3a59cb[_0x563a('0x35')],_0x3a59cb[_0x563a('0x36')]);_0x2e5c4b[_0x563a('0x39')]=_['intersection'](_0x3a59cb['model'],qs[_0x563a('0x3a')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3a')]));_0x2e5c4b[_0x563a('0x39')]=_0x2e5c4b[_0x563a('0x39')][_0x563a('0x3b')]?_0x2e5c4b[_0x563a('0x39')]:_0x3a59cb[_0x563a('0x35')];if(!_0x4aaa3d[_0x563a('0x36')][_0x563a('0x3c')](_0x563a('0x3d'))){_0x2e5c4b[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1e')]);_0x2e5c4b[_0x563a('0x1f')]=qs['offset'](_0x4aaa3d[_0x563a('0x36')][_0x563a('0x1f')]);}_0x2e5c4b[_0x563a('0x3e')]=qs['sort'](_0x4aaa3d[_0x563a('0x36')]['sort']);_0x2e5c4b[_0x563a('0x3f')]=qs[_0x563a('0x37')](_['pick'](_0x4aaa3d['query'],_0x3a59cb[_0x563a('0x37')]),_0x166f89);if(_0x4aaa3d['query'][_0x563a('0x40')]){_0x2e5c4b[_0x563a('0x3f')]=_[_0x563a('0x41')](_0x2e5c4b[_0x563a('0x3f')],{'$or':_['map'](_0x166f89,function(_0x47d37a){if(_0x47d37a[_0x563a('0x33')]!=='VIRTUAL'){var _0x46d471={};_0x46d471[_0x47d37a[_0x563a('0x2d')]]={'$like':'%'+_0x4aaa3d[_0x563a('0x36')][_0x563a('0x40')]+'%'};return _0x46d471;}})});}_0x2e5c4b=_[_0x563a('0x41')]({},_0x2e5c4b,_0x4aaa3d[_0x563a('0x42')]);var _0x4bf555={'where':_0x2e5c4b[_0x563a('0x3f')]};return db['ContactItemType'][_0x563a('0x20')](_0x4bf555)['then'](function(_0x20c142){_0x28a8f6[_0x563a('0x20')]=_0x20c142;if(_0x4aaa3d[_0x563a('0x36')][_0x563a('0x43')]){_0x2e5c4b['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x2e5c4b);})[_0x563a('0x26')](function(_0x1255da){_0x28a8f6[_0x563a('0x44')]=_0x1255da;return _0x28a8f6;})[_0x563a('0x26')](respondWithFilteredResult(_0x1e8d43,_0x2e5c4b))[_0x563a('0x45')](handleError(_0x1e8d43,null));};exports[_0x563a('0x46')]=function(_0x29a1c0,_0x2ca0f4){var _0x19c2cc={'raw':!![],'where':{'id':_0x29a1c0[_0x563a('0x47')]['id']}},_0x433353={};_0x433353[_0x563a('0x35')]=_[_0x563a('0x48')](db[_0x563a('0x31')][_0x563a('0x49')]);_0x433353[_0x563a('0x36')]=_[_0x563a('0x48')](_0x29a1c0[_0x563a('0x36')]);_0x433353[_0x563a('0x37')]=_['intersection'](_0x433353['model'],_0x433353[_0x563a('0x36')]);_0x19c2cc[_0x563a('0x39')]=_[_0x563a('0x38')](_0x433353[_0x563a('0x35')],qs[_0x563a('0x3a')](_0x29a1c0[_0x563a('0x36')][_0x563a('0x3a')]));_0x19c2cc[_0x563a('0x39')]=_0x19c2cc['attributes']['length']?_0x19c2cc[_0x563a('0x39')]:_0x433353[_0x563a('0x35')];if(_0x29a1c0[_0x563a('0x36')][_0x563a('0x43')]){_0x19c2cc[_0x563a('0x4a')]=[{'all':!![]}];}_0x19c2cc=_[_0x563a('0x41')]({},_0x19c2cc,_0x29a1c0[_0x563a('0x42')]);return db[_0x563a('0x31')]['find'](_0x19c2cc)[_0x563a('0x26')](handleEntityNotFound(_0x2ca0f4,null))[_0x563a('0x26')](respondWithResult(_0x2ca0f4,null))['catch'](handleError(_0x2ca0f4,null));};exports[_0x563a('0x4b')]=function(_0x5a063a,_0x3ea787){return db[_0x563a('0x31')][_0x563a('0x4b')](_0x5a063a['body'],{})[_0x563a('0x26')](function(_0x23efcf){var _0xb1dbc8=_0x5a063a[_0x563a('0x4c')][_0x563a('0x28')]({'plain':!![]});if(!_0xb1dbc8)throw new Error(_0x563a('0x4d'));if(_0xb1dbc8[_0x563a('0x4e')]===_0x563a('0x4c')){var _0x277d54=_0x23efcf[_0x563a('0x28')]({'plain':!![]});var _0x3c98d5=_0x563a('0x29');return db[_0x563a('0x4f')]['find']({'where':{'name':_0x3c98d5,'userProfileId':_0xb1dbc8['userProfileId']},'raw':!![]})[_0x563a('0x26')](function(_0xaae9fd){if(_0xaae9fd&&_0xaae9fd[_0x563a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x277d54[_0x563a('0x2d')],'resourceId':_0x277d54['id'],'type':_0xaae9fd[_0x563a('0x2d')],'sectionId':_0xaae9fd['id']},{})['then'](function(){return _0x23efcf;});}else{return _0x23efcf;}})['catch'](function(_0x51e142){logger[_0x563a('0x2b')](_0x563a('0x51'),_0x51e142);throw _0x51e142;});}return _0x23efcf;})[_0x563a('0x26')](respondWithResult(_0x3ea787,0xc9))[_0x563a('0x45')](handleError(_0x3ea787,null));};exports[_0x563a('0x25')]=function(_0x2805eb,_0x4dd257){if(_0x2805eb['body']['id']){delete _0x2805eb[_0x563a('0x52')]['id'];}return db['ContactItemType'][_0x563a('0x53')]({'where':{'id':_0x2805eb[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x4dd257,null))[_0x563a('0x26')](saveUpdates(_0x2805eb[_0x563a('0x52')],null))[_0x563a('0x26')](respondWithResult(_0x4dd257,null))[_0x563a('0x45')](handleError(_0x4dd257,null));};exports['destroy']=function(_0x22cc91,_0x227372){return db['ContactItemType'][_0x563a('0x53')]({'where':{'id':_0x22cc91[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x227372,null))[_0x563a('0x26')](db[_0x563a('0x54')][_0x563a('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x22cc91[_0x563a('0x47')]['id']}}))[_0x563a('0x26')](removeEntity(_0x227372,null))[_0x563a('0x45')](handleError(_0x227372,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 1d5729f..a71bc90 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 _0x0136=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','ContactItemType','tools_contact_item_types'];(function(_0xd91dc9,_0x4d8d06){var _0x6c3141=function(_0x316cd9){while(--_0x316cd9){_0xd91dc9['push'](_0xd91dc9['shift']());}};_0x6c3141(++_0x4d8d06);}(_0x0136,0xb4));var _0x6013=function(_0x9d304e,_0x571739){_0x9d304e=_0x9d304e-0x0;var _0x13f2c9=_0x0136[_0x9d304e];return _0x13f2c9;};'use strict';var _=require(_0x6013('0x0'));var util=require(_0x6013('0x1'));var logger=require(_0x6013('0x2'))(_0x6013('0x3'));var moment=require(_0x6013('0x4'));var BPromise=require(_0x6013('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6013('0x6'));var rimraf=require('rimraf');var config=require(_0x6013('0x7'));var attributes=require('./contactItemType.attributes');module[_0x6013('0x8')]=function(_0x384b51,_0x162df1){return _0x384b51[_0x6013('0x9')](_0x6013('0xa'),attributes,{'tableName':_0x6013('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5396=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','tools_contact_item_types','lodash','../../config/logger','api'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5396,0x1b9));var _0x6539=function(_0xcf2706,_0x39e261){_0xcf2706=_0xcf2706-0x0;var _0x2875ce=_0x5396[_0xcf2706];return _0x2875ce;};'use strict';var _=require(_0x6539('0x0'));var util=require('util');var logger=require(_0x6539('0x1'))(_0x6539('0x2'));var moment=require(_0x6539('0x3'));var BPromise=require(_0x6539('0x4'));var rp=require(_0x6539('0x5'));var fs=require('fs');var path=require(_0x6539('0x6'));var rimraf=require(_0x6539('0x7'));var config=require(_0x6539('0x8'));var attributes=require(_0x6539('0x9'));module[_0x6539('0xa')]=function(_0x8e861b,_0x299c88){return _0x8e861b['define']('ContactItemType',attributes,{'tableName':_0x6539('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 305f50c..d1f781d 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 _0x4cbc=['debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent'];(function(_0x559e51,_0x2836f7){var _0x3d228c=function(_0x1f2a44){while(--_0x1f2a44){_0x559e51['push'](_0x559e51['shift']());}};_0x3d228c(++_0x2836f7);}(_0x4cbc,0x1cf));var _0xc4cb=function(_0x500611,_0x179481){_0x500611=_0x500611-0x0;var _0x379d32=_0x4cbc[_0x500611];return _0x379d32;};'use strict';var _=require(_0xc4cb('0x0'));var util=require(_0xc4cb('0x1'));var moment=require(_0xc4cb('0x2'));var BPromise=require(_0xc4cb('0x3'));var rs=require(_0xc4cb('0x4'));var fs=require('fs');var Redis=require(_0xc4cb('0x5'));var db=require(_0xc4cb('0x6'))['db'];var utils=require(_0xc4cb('0x7'));var logger=require(_0xc4cb('0x8'))(_0xc4cb('0x9'));var config=require(_0xc4cb('0xa'));var jayson=require(_0xc4cb('0xb'));var client=jayson['client'][_0xc4cb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x538ba1,_0x414c38,_0x593715){return new BPromise(function(_0x58d100,_0x24a32b){return client[_0xc4cb('0xd')](_0x538ba1,_0x593715)['then'](function(_0x28b264){logger[_0xc4cb('0xe')](_0xc4cb('0xf'),_0x414c38,_0xc4cb('0x10'));logger[_0xc4cb('0x11')](_0xc4cb('0x12'),_0x414c38,'request\x20sent',JSON['stringify'](_0x28b264));if(_0x28b264[_0xc4cb('0x13')]){if(_0x28b264['error'][_0xc4cb('0x14')]===0x1f4){logger[_0xc4cb('0x13')]('ContactItemType,\x20%s,\x20%s',_0x414c38,_0x28b264[_0xc4cb('0x13')][_0xc4cb('0x15')]);return _0x24a32b(_0x28b264[_0xc4cb('0x13')][_0xc4cb('0x15')]);}logger[_0xc4cb('0x13')]('ContactItemType,\x20%s,\x20%s',_0x414c38,_0x28b264[_0xc4cb('0x13')][_0xc4cb('0x15')]);return _0x58d100(_0x28b264[_0xc4cb('0x13')][_0xc4cb('0x15')]);}else{logger['info'](_0xc4cb('0xf'),_0x414c38,_0xc4cb('0x10'));_0x58d100(_0x28b264[_0xc4cb('0x16')][_0xc4cb('0x15')]);}})[_0xc4cb('0x17')](function(_0x5f3cee){logger[_0xc4cb('0x13')](_0xc4cb('0xf'),_0x414c38,_0x5f3cee);_0x24a32b(_0x5f3cee);});});} \ No newline at end of file +var _0x58c4=['request\x20sent','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','ContactItemType,\x20%s,\x20%s'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x58c4,0x135));var _0x458c=function(_0x5c13da,_0x5e16c5){_0x5c13da=_0x5c13da-0x0;var _0x531852=_0x58c4[_0x5c13da];return _0x531852;};'use strict';var _=require(_0x458c('0x0'));var util=require('util');var moment=require(_0x458c('0x1'));var BPromise=require(_0x458c('0x2'));var rs=require(_0x458c('0x3'));var fs=require('fs');var Redis=require(_0x458c('0x4'));var db=require(_0x458c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x458c('0x6'));var config=require(_0x458c('0x7'));var jayson=require(_0x458c('0x8'));var client=jayson[_0x458c('0x9')][_0x458c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d7776,_0x35ab1f,_0x52e84c){return new BPromise(function(_0x56e43c,_0x3ef121){return client[_0x458c('0xb')](_0x1d7776,_0x52e84c)[_0x458c('0xc')](function(_0x47ea10){logger['info'](_0x458c('0xd'),_0x35ab1f,'request\x20sent');logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x35ab1f,_0x458c('0xe'),JSON[_0x458c('0xf')](_0x47ea10));if(_0x47ea10[_0x458c('0x10')]){if(_0x47ea10[_0x458c('0x10')][_0x458c('0x11')]===0x1f4){logger[_0x458c('0x10')](_0x458c('0xd'),_0x35ab1f,_0x47ea10['error'][_0x458c('0x12')]);return _0x3ef121(_0x47ea10[_0x458c('0x10')]['message']);}logger[_0x458c('0x10')](_0x458c('0xd'),_0x35ab1f,_0x47ea10['error'][_0x458c('0x12')]);return _0x56e43c(_0x47ea10[_0x458c('0x10')][_0x458c('0x12')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x35ab1f,'request\x20sent');_0x56e43c(_0x47ea10['result']['message']);}})['catch'](function(_0x2789d3){logger['error'](_0x458c('0xd'),_0x35ab1f,_0x2789d3);_0x3ef121(_0x2789d3);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 6ea3a55..f25fcc2 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 _0xb215=['../../components/auth/service','./contactItemType.controller','get','isAuthenticated','show','post','create','put','update','/:id','destroy','multer','connect-timeout','express','Router','fs-extra'];(function(_0x5c207b,_0x46abbf){var _0x56dd8b=function(_0x319c23){while(--_0x319c23){_0x5c207b['push'](_0x5c207b['shift']());}};_0x56dd8b(++_0x46abbf);}(_0xb215,0x1cb));var _0x5b21=function(_0x5c18cf,_0x21e920){_0x5c18cf=_0x5c18cf-0x0;var _0x26f627=_0xb215[_0x5c18cf];return _0x26f627;};'use strict';var multer=require(_0x5b21('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5b21('0x1'));var express=require(_0x5b21('0x2'));var router=express[_0x5b21('0x3')]();var fs_extra=require(_0x5b21('0x4'));var auth=require(_0x5b21('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5b21('0x6'));router[_0x5b21('0x7')]('/',auth[_0x5b21('0x8')](),controller['index']);router[_0x5b21('0x7')]('/:id',auth[_0x5b21('0x8')](),controller[_0x5b21('0x9')]);router[_0x5b21('0xa')]('/',auth['isAuthenticated'](),controller[_0x5b21('0xb')]);router[_0x5b21('0xc')]('/:id',auth[_0x5b21('0x8')](),controller[_0x5b21('0xd')]);router['delete'](_0x5b21('0xe'),auth[_0x5b21('0x8')](),controller[_0x5b21('0xf')]);module['exports']=router; \ No newline at end of file +var _0x93c9=['../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','put','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x34e40e,_0x27cb10){var _0xe69f7=function(_0x3fa759){while(--_0x3fa759){_0x34e40e['push'](_0x34e40e['shift']());}};_0xe69f7(++_0x27cb10);}(_0x93c9,0x19d));var _0x993c=function(_0x45ccd9,_0x378f39){_0x45ccd9=_0x45ccd9-0x0;var _0x4676fd=_0x93c9[_0x45ccd9];return _0x4676fd;};'use strict';var multer=require(_0x993c('0x0'));var util=require(_0x993c('0x1'));var path=require(_0x993c('0x2'));var timeout=require('connect-timeout');var express=require(_0x993c('0x3'));var router=express[_0x993c('0x4')]();var fs_extra=require(_0x993c('0x5'));var auth=require(_0x993c('0x6'));var interaction=require(_0x993c('0x7'));var config=require(_0x993c('0x8'));var controller=require(_0x993c('0x9'));router[_0x993c('0xa')]('/',auth[_0x993c('0xb')](),controller['index']);router[_0x993c('0xa')](_0x993c('0xc'),auth[_0x993c('0xb')](),controller['show']);router['post']('/',auth[_0x993c('0xb')](),controller['create']);router[_0x993c('0xd')](_0x993c('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x993c('0xc'),auth[_0x993c('0xb')](),controller['destroy']);module[_0x993c('0xe')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index ae06723..9764b4d 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['STRING','name'];(function(_0x3c91a3,_0x497bda){var _0x2d7863=function(_0x26562c){while(--_0x26562c){_0x3c91a3['push'](_0x3c91a3['shift']());}};_0x2d7863(++_0x497bda);}(_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 _0x0713=['STRING','name'];(function(_0x5822cb,_0x7a08a){var _0x307f8c=function(_0x144c7b){while(--_0x144c7b){_0x5822cb['push'](_0x5822cb['shift']());}};_0x307f8c(++_0x7a08a);}(_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 diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index a084ace..84bb909 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 _0xaa26=['catch','show','params','include','find','create','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','body','createdAt','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','order','filter','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','update','destroy','UserProfileResource','then','error','send','index','map','Dashboard','rawAttributes','type','model','name','query','keys','filters','intersection','fields','length','attributes','nolimit','sort','where','merge','VIRTUAL','includeAll','rows'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xaa26,0x135));var _0x6aa2=function(_0x314683,_0x42ca32){_0x314683=_0x314683-0x0;var _0x4abc6e=_0xaa26[_0x314683];return _0x4abc6e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6aa2('0x0'));var zipdir=require(_0x6aa2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6aa2('0x2'));var moment=require(_0x6aa2('0x3'));var BPromise=require(_0x6aa2('0x4'));var Mustache=require(_0x6aa2('0x5'));var util=require(_0x6aa2('0x6'));var path=require(_0x6aa2('0x7'));var sox=require(_0x6aa2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6aa2('0x9'));var _=require(_0x6aa2('0xa'));var squel=require('squel');var crypto=require(_0x6aa2('0xb'));var jsforce=require(_0x6aa2('0xc'));var deskjs=require(_0x6aa2('0xd'));var toCsv=require(_0x6aa2('0xe'));var querystring=require('querystring');var Papa=require(_0x6aa2('0xf'));var Redis=require(_0x6aa2('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6aa2('0x11'));var hardwareService=require(_0x6aa2('0x12'));var logger=require(_0x6aa2('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x6aa2('0x14'));var licenseUtil=require(_0x6aa2('0x15'));var db=require(_0x6aa2('0x16'))['db'];config[_0x6aa2('0x17')]=_['defaults'](config[_0x6aa2('0x17')],{'host':_0x6aa2('0x18'),'port':0x18eb});var socket=require(_0x6aa2('0x19'))(new Redis(config[_0x6aa2('0x17')]));require(_0x6aa2('0x1a'))[_0x6aa2('0x1b')](socket);function respondWithStatusCode(_0x5f2f2e,_0x4b58f4){_0x4b58f4=_0x4b58f4||0xcc;return function(_0x4ac1ea){if(_0x4ac1ea){return _0x5f2f2e[_0x6aa2('0x1c')](_0x4b58f4);}return _0x5f2f2e[_0x6aa2('0x1d')](_0x4b58f4)[_0x6aa2('0x1e')]();};}function respondWithResult(_0x550267,_0x546a25){_0x546a25=_0x546a25||0xc8;return function(_0x56e6e1){if(_0x56e6e1){return _0x550267['status'](_0x546a25)[_0x6aa2('0x1f')](_0x56e6e1);}};}function respondWithFilteredResult(_0x2087f6,_0x3b4d03){return function(_0x4b44a6){if(_0x4b44a6){var _0x5c041b=typeof _0x3b4d03['offset']===_0x6aa2('0x20')&&typeof _0x3b4d03['limit']===_0x6aa2('0x20');var _0x4ba6b4=_0x4b44a6[_0x6aa2('0x21')];var _0x56a778=_0x5c041b?0x0:_0x3b4d03['offset'];var _0x1fb5dc=_0x5c041b?_0x4b44a6[_0x6aa2('0x21')]:_0x3b4d03[_0x6aa2('0x22')]+_0x3b4d03[_0x6aa2('0x23')];var _0x3c9f92;if(_0x1fb5dc>=_0x4ba6b4){_0x1fb5dc=_0x4ba6b4;_0x3c9f92=0xc8;}else{_0x3c9f92=0xce;}_0x2087f6[_0x6aa2('0x1d')](_0x3c9f92);return _0x2087f6[_0x6aa2('0x24')]('Content-Range',_0x56a778+'-'+_0x1fb5dc+'/'+_0x4ba6b4)['json'](_0x4b44a6);}return null;};}function patchUpdates(_0x1a60c3){return function(_0x56b491){try{jsonpatch[_0x6aa2('0x25')](_0x56b491,_0x1a60c3,!![]);}catch(_0x309e9d){return BPromise[_0x6aa2('0x26')](_0x309e9d);}return _0x56b491['save']();};}function saveUpdates(_0x317277,_0x2575cd){return function(_0x471a02){if(_0x471a02){return _0x471a02[_0x6aa2('0x27')](_0x317277)['then'](function(_0x412a96){return _0x412a96;});}return null;};}function removeEntity(_0x1a242b,_0x564f9e){return function(_0x3b49df){if(_0x3b49df){return _0x3b49df[_0x6aa2('0x28')]()['then'](function(){var _0x164fec=_0x3b49df['get']({'plain':!![]});var _0x53fd87='CustomDashboards';return db[_0x6aa2('0x29')][_0x6aa2('0x28')]({'where':{'type':_0x53fd87,'resourceId':_0x164fec['id']}})[_0x6aa2('0x2a')](function(){return _0x3b49df;});})[_0x6aa2('0x2a')](function(){_0x1a242b['status'](0xcc)[_0x6aa2('0x1e')]();});}};}function handleEntityNotFound(_0x2d0dc9,_0x45901a){return function(_0x35d79a){if(!_0x35d79a){_0x2d0dc9[_0x6aa2('0x1c')](0x194);}return _0x35d79a;};}function handleError(_0x9730fa,_0x3a3900){_0x3a3900=_0x3a3900||0x1f4;return function(_0x37fdb8){logger[_0x6aa2('0x2b')](_0x37fdb8['stack']);if(_0x37fdb8['name']){delete _0x37fdb8['name'];}_0x9730fa['status'](_0x3a3900)[_0x6aa2('0x2c')](_0x37fdb8);};}exports[_0x6aa2('0x2d')]=function(_0x4dc4db,_0x14d35e){var _0x89f899={},_0xefb8be={},_0x1e23ce={'count':0x0,'rows':[]};var _0x16eb9f=_[_0x6aa2('0x2e')](db[_0x6aa2('0x2f')][_0x6aa2('0x30')],function(_0x3c60fd){return{'name':_0x3c60fd['fieldName'],'type':_0x3c60fd[_0x6aa2('0x31')]['key']};});_0xefb8be[_0x6aa2('0x32')]=_[_0x6aa2('0x2e')](_0x16eb9f,_0x6aa2('0x33'));_0xefb8be[_0x6aa2('0x34')]=_[_0x6aa2('0x35')](_0x4dc4db[_0x6aa2('0x34')]);_0xefb8be[_0x6aa2('0x36')]=_[_0x6aa2('0x37')](_0xefb8be[_0x6aa2('0x32')],_0xefb8be[_0x6aa2('0x34')]);_0x89f899['attributes']=_[_0x6aa2('0x37')](_0xefb8be['model'],qs[_0x6aa2('0x38')](_0x4dc4db[_0x6aa2('0x34')][_0x6aa2('0x38')]));_0x89f899['attributes']=_0x89f899['attributes'][_0x6aa2('0x39')]?_0x89f899[_0x6aa2('0x3a')]:_0xefb8be[_0x6aa2('0x32')];if(!_0x4dc4db[_0x6aa2('0x34')]['hasOwnProperty'](_0x6aa2('0x3b'))){_0x89f899[_0x6aa2('0x23')]=qs[_0x6aa2('0x23')](_0x4dc4db[_0x6aa2('0x34')]['limit']);_0x89f899['offset']=qs[_0x6aa2('0x22')](_0x4dc4db[_0x6aa2('0x34')][_0x6aa2('0x22')]);}_0x89f899['order']=qs[_0x6aa2('0x3c')](_0x4dc4db['query']['sort']);_0x89f899[_0x6aa2('0x3d')]=qs['filters'](_['pick'](_0x4dc4db[_0x6aa2('0x34')],_0xefb8be[_0x6aa2('0x36')]),_0x16eb9f);if(_0x4dc4db[_0x6aa2('0x34')]['filter']){_0x89f899['where']=_[_0x6aa2('0x3e')](_0x89f899['where'],{'$or':_[_0x6aa2('0x2e')](_0x16eb9f,function(_0x28241b){if(_0x28241b[_0x6aa2('0x31')]!==_0x6aa2('0x3f')){var _0x33c0a3={};_0x33c0a3[_0x28241b[_0x6aa2('0x33')]]={'$like':'%'+_0x4dc4db['query']['filter']+'%'};return _0x33c0a3;}})});}_0x89f899=_[_0x6aa2('0x3e')]({},_0x89f899,_0x4dc4db['options']);var _0x12d860={'where':_0x89f899[_0x6aa2('0x3d')]};return db[_0x6aa2('0x2f')][_0x6aa2('0x21')](_0x12d860)['then'](function(_0x4a75d3){_0x1e23ce[_0x6aa2('0x21')]=_0x4a75d3;if(_0x4dc4db[_0x6aa2('0x34')][_0x6aa2('0x40')]){_0x89f899['include']=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x89f899);})[_0x6aa2('0x2a')](function(_0x5d94f3){_0x1e23ce[_0x6aa2('0x41')]=_0x5d94f3;return _0x1e23ce;})[_0x6aa2('0x2a')](respondWithFilteredResult(_0x14d35e,_0x89f899))[_0x6aa2('0x42')](handleError(_0x14d35e,null));};exports[_0x6aa2('0x43')]=function(_0xb23450,_0x398acf){var _0x27e5a7={'raw':![],'where':{'id':_0xb23450[_0x6aa2('0x44')]['id']}},_0x5d2463={};_0x5d2463[_0x6aa2('0x32')]=_[_0x6aa2('0x35')](db[_0x6aa2('0x2f')][_0x6aa2('0x30')]);_0x5d2463[_0x6aa2('0x34')]=_[_0x6aa2('0x35')](_0xb23450[_0x6aa2('0x34')]);_0x5d2463[_0x6aa2('0x36')]=_[_0x6aa2('0x37')](_0x5d2463[_0x6aa2('0x32')],_0x5d2463[_0x6aa2('0x34')]);_0x27e5a7[_0x6aa2('0x3a')]=_[_0x6aa2('0x37')](_0x5d2463[_0x6aa2('0x32')],qs[_0x6aa2('0x38')](_0xb23450[_0x6aa2('0x34')][_0x6aa2('0x38')]));_0x27e5a7[_0x6aa2('0x3a')]=_0x27e5a7['attributes']['length']?_0x27e5a7[_0x6aa2('0x3a')]:_0x5d2463[_0x6aa2('0x32')];if(_0xb23450['query']['includeAll']){_0x27e5a7[_0x6aa2('0x45')]=[{'all':!![]}];}_0x27e5a7=_['merge']({},_0x27e5a7,_0xb23450['options']);return db[_0x6aa2('0x2f')][_0x6aa2('0x46')](_0x27e5a7)[_0x6aa2('0x2a')](handleEntityNotFound(_0x398acf,null))[_0x6aa2('0x2a')](respondWithResult(_0x398acf,null))['catch'](handleError(_0x398acf,null));};exports[_0x6aa2('0x47')]=function(_0x2e3995,_0x390ef4){return db[_0x6aa2('0x2f')][_0x6aa2('0x47')](_0x2e3995['body'],{})[_0x6aa2('0x2a')](function(_0x40f088){var _0xb20a97=_0x2e3995['user'][_0x6aa2('0x48')]({'plain':!![]});if(!_0xb20a97)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb20a97[_0x6aa2('0x49')]==='user'){var _0x291718=_0x40f088[_0x6aa2('0x48')]({'plain':!![]});var _0xcde267='CustomDashboards';return db[_0x6aa2('0x4a')][_0x6aa2('0x46')]({'where':{'name':_0xcde267,'userProfileId':_0xb20a97[_0x6aa2('0x4b')]},'raw':!![]})['then'](function(_0x56380a){if(_0x56380a&&_0x56380a[_0x6aa2('0x4c')]===0x0){return db[_0x6aa2('0x29')][_0x6aa2('0x47')]({'name':_0x291718[_0x6aa2('0x33')],'resourceId':_0x291718['id'],'type':_0x56380a[_0x6aa2('0x33')],'sectionId':_0x56380a['id']},{})[_0x6aa2('0x2a')](function(){return _0x40f088;});}else{return _0x40f088;}})[_0x6aa2('0x42')](function(_0x6d0d77){logger[_0x6aa2('0x2b')](_0x6aa2('0x4d'),_0x6d0d77);throw _0x6d0d77;});}return _0x40f088;})['then'](respondWithResult(_0x390ef4,0xc9))['catch'](handleError(_0x390ef4,null));};exports[_0x6aa2('0x4e')]=function(_0xd8bd05,_0x2a1623){var _0x3fef27={'where':{'id':_0xd8bd05[_0x6aa2('0x44')]['id']}},_0x5eade0={};_0x5eade0[_0x6aa2('0x32')]=_[_0x6aa2('0x35')](db[_0x6aa2('0x2f')][_0x6aa2('0x30')]);_0x3fef27['attributes']=_[_0x6aa2('0x37')](_0x5eade0[_0x6aa2('0x32')],qs['fields'](_0xd8bd05[_0x6aa2('0x34')][_0x6aa2('0x38')]));_0x3fef27['attributes']=_0x3fef27['attributes'][_0x6aa2('0x39')]?_0x3fef27[_0x6aa2('0x3a')]:_0x5eade0['model'];if(_0xd8bd05['query'][_0x6aa2('0x40')]){_0x3fef27[_0x6aa2('0x45')]=[{'all':!![]}];}_0x3fef27=_['merge']({},_0x3fef27,_0xd8bd05[_0x6aa2('0x4f')]);return db[_0x6aa2('0x2f')][_0x6aa2('0x46')](_0x3fef27)['then'](handleEntityNotFound(_0x2a1623,null))[_0x6aa2('0x2a')](function(_0x10abec){if(_0x10abec){var _0x1135ae=_0x10abec['get']({'plain':!![]});_0x1135ae=qs[_0x6aa2('0x50')](_0x1135ae,['id','createdAt','updatedAt']);_0xd8bd05[_0x6aa2('0x51')]=_[_0x6aa2('0x50')](_0xd8bd05['body'],['id',_0x6aa2('0x52'),_0x6aa2('0x53')]);return db[_0x6aa2('0x2f')][_0x6aa2('0x47')](_[_0x6aa2('0x3e')](_0x1135ae,_0xd8bd05['body']),{'include':_0xd8bd05[_0x6aa2('0x34')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x16201a){var _0x246ef2=_0xd8bd05[_0x6aa2('0x54')][_0x6aa2('0x48')]({'plain':!![]});if(!_0x246ef2)throw new Error(_0x6aa2('0x55'));if(_0x246ef2[_0x6aa2('0x49')]===_0x6aa2('0x54')){var _0x407b71=_0x16201a[_0x6aa2('0x48')]({'plain':!![]});var _0x79c1ac=_0x6aa2('0x56');return db[_0x6aa2('0x4a')]['find']({'where':{'name':_0x79c1ac,'userProfileId':_0x246ef2[_0x6aa2('0x4b')]},'raw':!![]})[_0x6aa2('0x2a')](function(_0x2cf890){if(_0x2cf890&&_0x2cf890[_0x6aa2('0x4c')]===0x0){return db[_0x6aa2('0x29')]['create']({'name':_0x407b71[_0x6aa2('0x33')],'resourceId':_0x407b71['id'],'type':_0x2cf890[_0x6aa2('0x33')],'sectionId':_0x2cf890['id']},{})[_0x6aa2('0x2a')](function(){return _0x16201a;});}else{return _0x16201a;}})[_0x6aa2('0x42')](function(_0xb4dd5e){logger[_0x6aa2('0x2b')](_0x6aa2('0x4d'),_0xb4dd5e);throw _0xb4dd5e;});}return _0x16201a;});}})['then'](respondWithResult(_0x2a1623,0xc9))[_0x6aa2('0x42')](handleError(_0x2a1623,null));};exports[_0x6aa2('0x27')]=function(_0x2352ec,_0x132baf){if(_0x2352ec[_0x6aa2('0x51')]['id']){delete _0x2352ec['body']['id'];}return db['Dashboard'][_0x6aa2('0x46')]({'where':{'id':_0x2352ec[_0x6aa2('0x44')]['id']}})[_0x6aa2('0x2a')](handleEntityNotFound(_0x132baf,null))[_0x6aa2('0x2a')](saveUpdates(_0x2352ec[_0x6aa2('0x51')],null))['then'](respondWithResult(_0x132baf,null))['catch'](handleError(_0x132baf,null));};exports[_0x6aa2('0x28')]=function(_0x250971,_0x1b55f8){return db[_0x6aa2('0x2f')][_0x6aa2('0x46')]({'where':{'id':_0x250971['params']['id']}})[_0x6aa2('0x2a')](handleEntityNotFound(_0x1b55f8,null))[_0x6aa2('0x2a')](removeEntity(_0x1b55f8,null))[_0x6aa2('0x42')](handleError(_0x1b55f8,null));};function widgetAttributes(_0x153e9d){try{switch(_0x153e9d[_0x6aa2('0x31')]){case'iframe':return[{'name':_0x6aa2('0x57'),'value':_0x153e9d[_0x6aa2('0x57')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x0]?_0x153e9d[_0x6aa2('0x58')][0x0][_0x6aa2('0x59')]:undefined)||_0x6aa2('0x5a')}];case'custom':return[{'name':_0x6aa2('0x5b'),'value':_0x153e9d['attrPath']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x0]?_0x153e9d[_0x6aa2('0x58')][0x0]['value']:undefined)||''}];case _0x6aa2('0x5c'):return[{'name':'attrHourFormat','value':_0x153e9d[_0x6aa2('0x5d')]||(_0x153e9d['attrs']&&_0x153e9d[_0x6aa2('0x58')][0x0]?_0x153e9d[_0x6aa2('0x58')][0x0][_0x6aa2('0x59')]:undefined)||_0x6aa2('0x5e')},{'name':_0x6aa2('0x5f'),'value':_0x153e9d[_0x6aa2('0x5f')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x1]?_0x153e9d[_0x6aa2('0x58')][0x1][_0x6aa2('0x59')]:undefined)||'0.00'},{'name':_0x6aa2('0x60'),'value':_0x153e9d[_0x6aa2('0x60')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x2]?_0x153e9d[_0x6aa2('0x58')][0x2][_0x6aa2('0x59')]:undefined)||0xc}];case'counter':return[{'name':_0x6aa2('0x61'),'value':_0x153e9d[_0x6aa2('0x61')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x0]?_0x153e9d[_0x6aa2('0x58')][0x0][_0x6aa2('0x59')]:undefined)||_0x6aa2('0x62')},{'name':_0x6aa2('0x63'),'value':_0x153e9d[_0x6aa2('0x63')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x1]?_0x153e9d[_0x6aa2('0x58')][0x1][_0x6aa2('0x59')]:undefined)||[]},{'name':_0x6aa2('0x60'),'value':_0x153e9d[_0x6aa2('0x60')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x2]?_0x153e9d[_0x6aa2('0x58')][0x2][_0x6aa2('0x59')]:undefined)||0x14},{'name':_0x6aa2('0x64'),'value':_0x153e9d['attrChannel']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x3]?_0x153e9d[_0x6aa2('0x58')][0x3][_0x6aa2('0x59')]:undefined)||_0x6aa2('0x65')},{'name':_0x6aa2('0x66'),'value':_0x153e9d[_0x6aa2('0x66')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x4]?_0x153e9d['attrs'][0x4][_0x6aa2('0x59')]:undefined)||''},{'name':_0x6aa2('0x67'),'value':_0x153e9d[_0x6aa2('0x67')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x5]?_0x153e9d['attrs'][0x5][_0x6aa2('0x59')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x153e9d[_0x6aa2('0x68')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x6]?_0x153e9d[_0x6aa2('0x58')][0x6][_0x6aa2('0x59')]:undefined)||''},{'name':_0x6aa2('0x69'),'value':_0x153e9d[_0x6aa2('0x69')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x7]?_0x153e9d['attrs'][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x153e9d[_0x6aa2('0x6a')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x8]?_0x153e9d[_0x6aa2('0x58')][0x8][_0x6aa2('0x59')]:undefined)||''},{'name':_0x6aa2('0x6b'),'value':_0x153e9d[_0x6aa2('0x6b')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x9]?_0x153e9d['attrs'][0x9][_0x6aa2('0x59')]:undefined)||''}];case _0x6aa2('0x6c'):case _0x6aa2('0x6d'):return[{'name':_0x6aa2('0x6e'),'value':_0x153e9d['attrSerie1']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x0]?_0x153e9d['attrs'][0x0]['value']:undefined)||_0x6aa2('0x62')},{'name':_0x6aa2('0x6f'),'value':_0x153e9d['attrSerie2']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x1]?_0x153e9d[_0x6aa2('0x58')][0x1][_0x6aa2('0x59')]:undefined)||null},{'name':_0x6aa2('0x70'),'value':_0x153e9d[_0x6aa2('0x70')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x2]?_0x153e9d[_0x6aa2('0x58')][0x2][_0x6aa2('0x59')]:undefined)||null},{'name':_0x6aa2('0x63'),'value':_0x153e9d[_0x6aa2('0x63')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x3]?_0x153e9d[_0x6aa2('0x58')][0x3]['value']:undefined)||[]},{'name':_0x6aa2('0x64'),'value':_0x153e9d['attrChannel']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x4]?_0x153e9d[_0x6aa2('0x58')][0x4][_0x6aa2('0x59')]:undefined)||_0x6aa2('0x65')},{'name':'attrEmailAccounts','value':_0x153e9d['attrEmailAccounts']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x5]?_0x153e9d['attrs'][0x5][_0x6aa2('0x59')]:undefined)||''},{'name':_0x6aa2('0x67'),'value':_0x153e9d[_0x6aa2('0x67')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x6]?_0x153e9d[_0x6aa2('0x58')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x153e9d['attrSmsAccounts']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x7]?_0x153e9d[_0x6aa2('0x58')][0x7][_0x6aa2('0x59')]:undefined)||''},{'name':_0x6aa2('0x69'),'value':_0x153e9d[_0x6aa2('0x69')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x8]?_0x153e9d['attrs'][0x8]['value']:undefined)||''},{'name':_0x6aa2('0x6a'),'value':_0x153e9d[_0x6aa2('0x6a')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x9]?_0x153e9d[_0x6aa2('0x58')][0x9][_0x6aa2('0x59')]:undefined)||''},{'name':_0x6aa2('0x6b'),'value':_0x153e9d[_0x6aa2('0x6b')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0xa]?_0x153e9d[_0x6aa2('0x58')][0xa][_0x6aa2('0x59')]:undefined)||''}];case _0x6aa2('0x71'):return[{'name':_0x6aa2('0x72'),'type':_0x153e9d['reportType']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x0]?_0x153e9d[_0x6aa2('0x58')][0x0][_0x6aa2('0x31')]:undefined)||null,'value':_0x153e9d['attrReport']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x0]?_0x153e9d['attrs'][0x0]['value']:undefined)||null},{'name':_0x6aa2('0x73'),'value':_0x153e9d[_0x6aa2('0x73')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x1]?_0x153e9d[_0x6aa2('0x58')][0x1][_0x6aa2('0x59')]:undefined)||0x0}];default:return[];}}catch(_0x3e3a22){logger[_0x6aa2('0x2b')](_0x6aa2('0x74'),JSON[_0x6aa2('0x75')](_0x3e3a22));return[];}}exports[_0x6aa2('0x76')]=function(_0x460ae3,_0xf01ed2,_0x4000ed){if(_0x460ae3[_0x6aa2('0x51')]['id']){delete _0x460ae3[_0x6aa2('0x51')]['id'];}return db[_0x6aa2('0x2f')]['find']({'where':{'id':_0x460ae3[_0x6aa2('0x44')]['id']}})[_0x6aa2('0x2a')](handleEntityNotFound(_0xf01ed2,null))[_0x6aa2('0x2a')](function(_0x21d44f){if(_0x21d44f){_0x460ae3['body'][_0x6aa2('0x77')]=_0x21d44f['id'];_0x460ae3[_0x6aa2('0x51')]['attrs']=widgetAttributes(_0x460ae3[_0x6aa2('0x51')]);return db[_0x6aa2('0x78')][_0x6aa2('0x47')](_0x460ae3[_0x6aa2('0x51')]);}})[_0x6aa2('0x2a')](respondWithResult(_0xf01ed2,null))['catch'](handleError(_0xf01ed2,null));};exports[_0x6aa2('0x79')]=function(_0x2403f8,_0x1c212a,_0x32439f){var _0x340cbb={};var _0x16efba={};var _0x381b13;var _0x1d1bce;return db['Dashboard'][_0x6aa2('0x7a')]({'where':{'id':_0x2403f8['params']['id']}})[_0x6aa2('0x2a')](handleEntityNotFound(_0x1c212a,null))[_0x6aa2('0x2a')](function(_0x141077){if(_0x141077){_0x381b13=_0x141077;_0x16efba[_0x6aa2('0x32')]=_['keys'](db[_0x6aa2('0x78')]['rawAttributes']);_0x16efba[_0x6aa2('0x34')]=_[_0x6aa2('0x35')](_0x2403f8[_0x6aa2('0x34')]);_0x16efba['filters']=_[_0x6aa2('0x37')](_0x16efba['model'],_0x16efba['query']);_0x340cbb['attributes']=_[_0x6aa2('0x37')](_0x16efba[_0x6aa2('0x32')],qs[_0x6aa2('0x38')](_0x2403f8['query'][_0x6aa2('0x38')]));_0x340cbb[_0x6aa2('0x3a')]=_0x340cbb[_0x6aa2('0x3a')][_0x6aa2('0x39')]?_0x340cbb[_0x6aa2('0x3a')]:_0x16efba['model'];_0x340cbb[_0x6aa2('0x7b')]=qs[_0x6aa2('0x3c')](_0x2403f8[_0x6aa2('0x34')][_0x6aa2('0x3c')]);_0x340cbb[_0x6aa2('0x3d')]=qs[_0x6aa2('0x36')](_['pick'](_0x2403f8[_0x6aa2('0x34')],_0x16efba[_0x6aa2('0x36')]));if(_0x2403f8[_0x6aa2('0x34')][_0x6aa2('0x7c')]){_0x340cbb[_0x6aa2('0x3d')]=_['merge'](_0x340cbb[_0x6aa2('0x3d')],{'$or':_[_0x6aa2('0x2e')](_0x340cbb[_0x6aa2('0x3a')],function(_0x29fdbb){var _0x26dea7={};_0x26dea7[_0x29fdbb]={'$like':'%'+_0x2403f8['query'][_0x6aa2('0x7c')]+'%'};return _0x26dea7;})});}_0x340cbb=_[_0x6aa2('0x3e')]({},_0x340cbb,_0x2403f8['options']);return _0x381b13[_0x6aa2('0x79')](_0x340cbb);}})[_0x6aa2('0x2a')](function(_0x27b2f6){if(_0x27b2f6){_0x1d1bce=_0x27b2f6[_0x6aa2('0x39')];if(!_0x2403f8[_0x6aa2('0x34')]['hasOwnProperty'](_0x6aa2('0x3b'))){_0x340cbb[_0x6aa2('0x23')]=qs[_0x6aa2('0x23')](_0x2403f8['query']['limit']);_0x340cbb[_0x6aa2('0x22')]=qs[_0x6aa2('0x22')](_0x2403f8['query'][_0x6aa2('0x22')]);}return _0x381b13[_0x6aa2('0x79')](_0x340cbb);}})[_0x6aa2('0x2a')](function(_0x43e12f){if(_0x43e12f){return _0x43e12f?{'count':_0x1d1bce,'rows':_0x43e12f}:null;}})[_0x6aa2('0x2a')](respondWithResult(_0x1c212a,null))['catch'](handleError(_0x1c212a,null));}; \ No newline at end of file +var _0xc6cf=['options','findAll','rows','catch','show','params','intersection','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrChannel','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','findOne','DashboardItem','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','lodash','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x1406ae,_0x292395){var _0x23a076=function(_0x5e147a){while(--_0x5e147a){_0x1406ae['push'](_0x1406ae['shift']());}};_0x23a076(++_0x292395);}(_0xc6cf,0x138));var _0xfc6c=function(_0x448f61,_0x54ad2e){_0x448f61=_0x448f61-0x0;var _0x592254=_0xc6cf[_0x448f61];return _0x592254;};'use strict';var emlformat=require(_0xfc6c('0x0'));var rimraf=require(_0xfc6c('0x1'));var zipdir=require(_0xfc6c('0x2'));var jsonpatch=require(_0xfc6c('0x3'));var rp=require(_0xfc6c('0x4'));var moment=require(_0xfc6c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfc6c('0x6'));var util=require(_0xfc6c('0x7'));var path=require('path');var sox=require(_0xfc6c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc6c('0x9'));var _=require(_0xfc6c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfc6c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfc6c('0xc'));var querystring=require(_0xfc6c('0xd'));var Papa=require('papaparse');var Redis=require(_0xfc6c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfc6c('0xf'));var as=require(_0xfc6c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc6c('0x11'))(_0xfc6c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc6c('0x13'));var db=require(_0xfc6c('0x14'))['db'];config[_0xfc6c('0x15')]=_[_0xfc6c('0x16')](config[_0xfc6c('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xfc6c('0x17'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x5c7412,_0x3abfd6){_0x3abfd6=_0x3abfd6||0xcc;return function(_0x41aa54){if(_0x41aa54){return _0x5c7412[_0xfc6c('0x18')](_0x3abfd6);}return _0x5c7412[_0xfc6c('0x19')](_0x3abfd6)[_0xfc6c('0x1a')]();};}function respondWithResult(_0x35ae00,_0x3fc8b8){_0x3fc8b8=_0x3fc8b8||0xc8;return function(_0x3a6af6){if(_0x3a6af6){return _0x35ae00[_0xfc6c('0x19')](_0x3fc8b8)[_0xfc6c('0x1b')](_0x3a6af6);}};}function respondWithFilteredResult(_0x4abd8e,_0x2bb94d){return function(_0x56ce49){if(_0x56ce49){var _0x327b04=typeof _0x2bb94d['offset']===_0xfc6c('0x1c')&&typeof _0x2bb94d['limit']===_0xfc6c('0x1c');var _0x1b0a80=_0x56ce49[_0xfc6c('0x1d')];var _0x1c2467=_0x327b04?0x0:_0x2bb94d[_0xfc6c('0x1e')];var _0x5ed723=_0x327b04?_0x56ce49[_0xfc6c('0x1d')]:_0x2bb94d[_0xfc6c('0x1e')]+_0x2bb94d[_0xfc6c('0x1f')];var _0x1c59e2;if(_0x5ed723>=_0x1b0a80){_0x5ed723=_0x1b0a80;_0x1c59e2=0xc8;}else{_0x1c59e2=0xce;}_0x4abd8e['status'](_0x1c59e2);return _0x4abd8e[_0xfc6c('0x20')]('Content-Range',_0x1c2467+'-'+_0x5ed723+'/'+_0x1b0a80)[_0xfc6c('0x1b')](_0x56ce49);}return null;};}function patchUpdates(_0xa04911){return function(_0x5a7dcb){try{jsonpatch[_0xfc6c('0x21')](_0x5a7dcb,_0xa04911,!![]);}catch(_0x31acdd){return BPromise['reject'](_0x31acdd);}return _0x5a7dcb[_0xfc6c('0x22')]();};}function saveUpdates(_0x38eaff,_0x5a9585){return function(_0x5b7cc3){if(_0x5b7cc3){return _0x5b7cc3[_0xfc6c('0x23')](_0x38eaff)[_0xfc6c('0x24')](function(_0xfd67e3){return _0xfd67e3;});}return null;};}function removeEntity(_0x1d5bce,_0x4bc55d){return function(_0x1794e6){if(_0x1794e6){return _0x1794e6[_0xfc6c('0x25')]()[_0xfc6c('0x24')](function(){var _0x50f07b=_0x1794e6[_0xfc6c('0x26')]({'plain':!![]});var _0xc6764f=_0xfc6c('0x27');return db[_0xfc6c('0x28')]['destroy']({'where':{'type':_0xc6764f,'resourceId':_0x50f07b['id']}})['then'](function(){return _0x1794e6;});})[_0xfc6c('0x24')](function(){_0x1d5bce[_0xfc6c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38c4c8,_0x52f625){return function(_0x50d169){if(!_0x50d169){_0x38c4c8[_0xfc6c('0x18')](0x194);}return _0x50d169;};}function handleError(_0x1fc7c2,_0x6ec2cb){_0x6ec2cb=_0x6ec2cb||0x1f4;return function(_0x3cd744){logger[_0xfc6c('0x29')](_0x3cd744[_0xfc6c('0x2a')]);if(_0x3cd744['name']){delete _0x3cd744[_0xfc6c('0x2b')];}_0x1fc7c2[_0xfc6c('0x19')](_0x6ec2cb)['send'](_0x3cd744);};}exports[_0xfc6c('0x2c')]=function(_0x32fa5f,_0x8edb29){var _0x186cb7={},_0x94a583={},_0x599a2f={'count':0x0,'rows':[]};var _0x1df83e=_[_0xfc6c('0x2d')](db[_0xfc6c('0x2e')][_0xfc6c('0x2f')],function(_0x5eb915){return{'name':_0x5eb915[_0xfc6c('0x30')],'type':_0x5eb915[_0xfc6c('0x31')][_0xfc6c('0x32')]};});_0x94a583[_0xfc6c('0x33')]=_['map'](_0x1df83e,_0xfc6c('0x2b'));_0x94a583[_0xfc6c('0x34')]=_[_0xfc6c('0x35')](_0x32fa5f[_0xfc6c('0x34')]);_0x94a583[_0xfc6c('0x36')]=_['intersection'](_0x94a583[_0xfc6c('0x33')],_0x94a583[_0xfc6c('0x34')]);_0x186cb7['attributes']=_['intersection'](_0x94a583[_0xfc6c('0x33')],qs[_0xfc6c('0x37')](_0x32fa5f[_0xfc6c('0x34')][_0xfc6c('0x37')]));_0x186cb7['attributes']=_0x186cb7[_0xfc6c('0x38')][_0xfc6c('0x39')]?_0x186cb7['attributes']:_0x94a583[_0xfc6c('0x33')];if(!_0x32fa5f[_0xfc6c('0x34')][_0xfc6c('0x3a')](_0xfc6c('0x3b'))){_0x186cb7[_0xfc6c('0x1f')]=qs['limit'](_0x32fa5f[_0xfc6c('0x34')][_0xfc6c('0x1f')]);_0x186cb7[_0xfc6c('0x1e')]=qs[_0xfc6c('0x1e')](_0x32fa5f[_0xfc6c('0x34')]['offset']);}_0x186cb7[_0xfc6c('0x3c')]=qs[_0xfc6c('0x3d')](_0x32fa5f[_0xfc6c('0x34')][_0xfc6c('0x3d')]);_0x186cb7[_0xfc6c('0x3e')]=qs[_0xfc6c('0x36')](_[_0xfc6c('0x3f')](_0x32fa5f[_0xfc6c('0x34')],_0x94a583[_0xfc6c('0x36')]),_0x1df83e);if(_0x32fa5f[_0xfc6c('0x34')][_0xfc6c('0x40')]){_0x186cb7['where']=_[_0xfc6c('0x41')](_0x186cb7[_0xfc6c('0x3e')],{'$or':_['map'](_0x1df83e,function(_0x14aaca){if(_0x14aaca[_0xfc6c('0x31')]!=='VIRTUAL'){var _0x2b5b49={};_0x2b5b49[_0x14aaca['name']]={'$like':'%'+_0x32fa5f[_0xfc6c('0x34')][_0xfc6c('0x40')]+'%'};return _0x2b5b49;}})});}_0x186cb7=_['merge']({},_0x186cb7,_0x32fa5f[_0xfc6c('0x42')]);var _0x138576={'where':_0x186cb7['where']};return db[_0xfc6c('0x2e')]['count'](_0x138576)['then'](function(_0x2f1923){_0x599a2f[_0xfc6c('0x1d')]=_0x2f1923;if(_0x32fa5f[_0xfc6c('0x34')]['includeAll']){_0x186cb7['include']=[{'all':!![]}];}return db['Dashboard'][_0xfc6c('0x43')](_0x186cb7);})['then'](function(_0x56df4e){_0x599a2f[_0xfc6c('0x44')]=_0x56df4e;return _0x599a2f;})[_0xfc6c('0x24')](respondWithFilteredResult(_0x8edb29,_0x186cb7))[_0xfc6c('0x45')](handleError(_0x8edb29,null));};exports[_0xfc6c('0x46')]=function(_0x3b3b60,_0x494974){var _0x16d6b0={'raw':![],'where':{'id':_0x3b3b60[_0xfc6c('0x47')]['id']}},_0x2252b8={};_0x2252b8[_0xfc6c('0x33')]=_[_0xfc6c('0x35')](db[_0xfc6c('0x2e')][_0xfc6c('0x2f')]);_0x2252b8[_0xfc6c('0x34')]=_['keys'](_0x3b3b60[_0xfc6c('0x34')]);_0x2252b8['filters']=_[_0xfc6c('0x48')](_0x2252b8['model'],_0x2252b8[_0xfc6c('0x34')]);_0x16d6b0[_0xfc6c('0x38')]=_[_0xfc6c('0x48')](_0x2252b8['model'],qs['fields'](_0x3b3b60[_0xfc6c('0x34')]['fields']));_0x16d6b0[_0xfc6c('0x38')]=_0x16d6b0[_0xfc6c('0x38')][_0xfc6c('0x39')]?_0x16d6b0[_0xfc6c('0x38')]:_0x2252b8[_0xfc6c('0x33')];if(_0x3b3b60['query']['includeAll']){_0x16d6b0[_0xfc6c('0x49')]=[{'all':!![]}];}_0x16d6b0=_[_0xfc6c('0x41')]({},_0x16d6b0,_0x3b3b60[_0xfc6c('0x42')]);return db[_0xfc6c('0x2e')][_0xfc6c('0x4a')](_0x16d6b0)[_0xfc6c('0x24')](handleEntityNotFound(_0x494974,null))[_0xfc6c('0x24')](respondWithResult(_0x494974,null))[_0xfc6c('0x45')](handleError(_0x494974,null));};exports[_0xfc6c('0x4b')]=function(_0x48b018,_0x594dde){return db[_0xfc6c('0x2e')][_0xfc6c('0x4b')](_0x48b018[_0xfc6c('0x4c')],{})['then'](function(_0x398f0f){var _0x3efecd=_0x48b018['user'][_0xfc6c('0x26')]({'plain':!![]});if(!_0x3efecd)throw new Error(_0xfc6c('0x4d'));if(_0x3efecd['role']===_0xfc6c('0x4e')){var _0x3828cb=_0x398f0f[_0xfc6c('0x26')]({'plain':!![]});var _0x2d9a13=_0xfc6c('0x27');return db[_0xfc6c('0x4f')][_0xfc6c('0x4a')]({'where':{'name':_0x2d9a13,'userProfileId':_0x3efecd[_0xfc6c('0x50')]},'raw':!![]})[_0xfc6c('0x24')](function(_0x25564b){if(_0x25564b&&_0x25564b[_0xfc6c('0x51')]===0x0){return db[_0xfc6c('0x28')]['create']({'name':_0x3828cb[_0xfc6c('0x2b')],'resourceId':_0x3828cb['id'],'type':_0x25564b[_0xfc6c('0x2b')],'sectionId':_0x25564b['id']},{})[_0xfc6c('0x24')](function(){return _0x398f0f;});}else{return _0x398f0f;}})['catch'](function(_0x125298){logger[_0xfc6c('0x29')](_0xfc6c('0x52'),_0x125298);throw _0x125298;});}return _0x398f0f;})[_0xfc6c('0x24')](respondWithResult(_0x594dde,0xc9))[_0xfc6c('0x45')](handleError(_0x594dde,null));};exports['clone']=function(_0x1a1148,_0x554861){var _0x9709bd={'where':{'id':_0x1a1148[_0xfc6c('0x47')]['id']}},_0x3ccba2={};_0x3ccba2[_0xfc6c('0x33')]=_[_0xfc6c('0x35')](db[_0xfc6c('0x2e')][_0xfc6c('0x2f')]);_0x9709bd[_0xfc6c('0x38')]=_[_0xfc6c('0x48')](_0x3ccba2[_0xfc6c('0x33')],qs['fields'](_0x1a1148[_0xfc6c('0x34')][_0xfc6c('0x37')]));_0x9709bd[_0xfc6c('0x38')]=_0x9709bd['attributes'][_0xfc6c('0x39')]?_0x9709bd['attributes']:_0x3ccba2[_0xfc6c('0x33')];if(_0x1a1148[_0xfc6c('0x34')][_0xfc6c('0x53')]){_0x9709bd[_0xfc6c('0x49')]=[{'all':!![]}];}_0x9709bd=_['merge']({},_0x9709bd,_0x1a1148['options']);return db[_0xfc6c('0x2e')][_0xfc6c('0x4a')](_0x9709bd)['then'](handleEntityNotFound(_0x554861,null))[_0xfc6c('0x24')](function(_0x26bc17){if(_0x26bc17){var _0x5c01ce=_0x26bc17[_0xfc6c('0x26')]({'plain':!![]});_0x5c01ce=qs[_0xfc6c('0x54')](_0x5c01ce,['id',_0xfc6c('0x55'),_0xfc6c('0x56')]);_0x1a1148['body']=_[_0xfc6c('0x54')](_0x1a1148['body'],['id',_0xfc6c('0x55'),_0xfc6c('0x56')]);return db[_0xfc6c('0x2e')][_0xfc6c('0x4b')](_[_0xfc6c('0x41')](_0x5c01ce,_0x1a1148['body']),{'include':_0x1a1148[_0xfc6c('0x34')][_0xfc6c('0x53')]?[{'all':!![]}]:undefined})[_0xfc6c('0x24')](function(_0x58665c){var _0x5c8d49=_0x1a1148[_0xfc6c('0x4e')][_0xfc6c('0x26')]({'plain':!![]});if(!_0x5c8d49)throw new Error(_0xfc6c('0x4d'));if(_0x5c8d49['role']==='user'){var _0x4f603e=_0x58665c[_0xfc6c('0x26')]({'plain':!![]});var _0x5754e1=_0xfc6c('0x27');return db[_0xfc6c('0x4f')][_0xfc6c('0x4a')]({'where':{'name':_0x5754e1,'userProfileId':_0x5c8d49[_0xfc6c('0x50')]},'raw':!![]})['then'](function(_0x2714fb){if(_0x2714fb&&_0x2714fb[_0xfc6c('0x51')]===0x0){return db[_0xfc6c('0x28')][_0xfc6c('0x4b')]({'name':_0x4f603e[_0xfc6c('0x2b')],'resourceId':_0x4f603e['id'],'type':_0x2714fb['name'],'sectionId':_0x2714fb['id']},{})[_0xfc6c('0x24')](function(){return _0x58665c;});}else{return _0x58665c;}})[_0xfc6c('0x45')](function(_0x48db58){logger[_0xfc6c('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48db58);throw _0x48db58;});}return _0x58665c;});}})[_0xfc6c('0x24')](respondWithResult(_0x554861,0xc9))['catch'](handleError(_0x554861,null));};exports[_0xfc6c('0x23')]=function(_0x221ef2,_0x7ce020){if(_0x221ef2[_0xfc6c('0x4c')]['id']){delete _0x221ef2[_0xfc6c('0x4c')]['id'];}return db['Dashboard'][_0xfc6c('0x4a')]({'where':{'id':_0x221ef2[_0xfc6c('0x47')]['id']}})['then'](handleEntityNotFound(_0x7ce020,null))[_0xfc6c('0x24')](saveUpdates(_0x221ef2[_0xfc6c('0x4c')],null))[_0xfc6c('0x24')](respondWithResult(_0x7ce020,null))[_0xfc6c('0x45')](handleError(_0x7ce020,null));};exports['destroy']=function(_0x5bb0ef,_0x31ff96){return db[_0xfc6c('0x2e')][_0xfc6c('0x4a')]({'where':{'id':_0x5bb0ef[_0xfc6c('0x47')]['id']}})[_0xfc6c('0x24')](handleEntityNotFound(_0x31ff96,null))['then'](removeEntity(_0x31ff96,null))[_0xfc6c('0x45')](handleError(_0x31ff96,null));};function widgetAttributes(_0x5ac85a){try{switch(_0x5ac85a[_0xfc6c('0x31')]){case _0xfc6c('0x57'):return[{'name':'attrUrl','value':_0x5ac85a[_0xfc6c('0x58')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a['attrs'][0x0]?_0x5ac85a['attrs'][0x0][_0xfc6c('0x5a')]:undefined)||_0xfc6c('0x5b')}];case _0xfc6c('0x5c'):return[{'name':_0xfc6c('0x5d'),'value':_0x5ac85a[_0xfc6c('0x5d')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x0]?_0x5ac85a['attrs'][0x0][_0xfc6c('0x5a')]:undefined)||''}];case _0xfc6c('0x5e'):return[{'name':_0xfc6c('0x5f'),'value':_0x5ac85a[_0xfc6c('0x5f')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x0]?_0x5ac85a[_0xfc6c('0x59')][0x0][_0xfc6c('0x5a')]:undefined)||_0xfc6c('0x60')},{'name':_0xfc6c('0x61'),'value':_0x5ac85a[_0xfc6c('0x61')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a['attrs'][0x1]?_0x5ac85a[_0xfc6c('0x59')][0x1]['value']:undefined)||_0xfc6c('0x62')},{'name':'attrFontSize','value':_0x5ac85a[_0xfc6c('0x63')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x2]?_0x5ac85a[_0xfc6c('0x59')][0x2]['value']:undefined)||0xc}];case _0xfc6c('0x64'):return[{'name':'attrMetric','value':_0x5ac85a[_0xfc6c('0x65')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a['attrs'][0x0]?_0x5ac85a[_0xfc6c('0x59')][0x0]['value']:undefined)||'total'},{'name':_0xfc6c('0x66'),'value':_0x5ac85a[_0xfc6c('0x66')]||(_0x5ac85a['attrs']&&_0x5ac85a[_0xfc6c('0x59')][0x1]?_0x5ac85a[_0xfc6c('0x59')][0x1][_0xfc6c('0x5a')]:undefined)||[]},{'name':_0xfc6c('0x63'),'value':_0x5ac85a[_0xfc6c('0x63')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x2]?_0x5ac85a[_0xfc6c('0x59')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x5ac85a['attrChannel']||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x3]?_0x5ac85a[_0xfc6c('0x59')][0x3][_0xfc6c('0x5a')]:undefined)||'voice'},{'name':_0xfc6c('0x67'),'value':_0x5ac85a[_0xfc6c('0x67')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x4]?_0x5ac85a[_0xfc6c('0x59')][0x4][_0xfc6c('0x5a')]:undefined)||''},{'name':_0xfc6c('0x68'),'value':_0x5ac85a[_0xfc6c('0x68')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x5]?_0x5ac85a['attrs'][0x5][_0xfc6c('0x5a')]:undefined)||''},{'name':_0xfc6c('0x69'),'value':_0x5ac85a[_0xfc6c('0x69')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x6]?_0x5ac85a[_0xfc6c('0x59')][0x6][_0xfc6c('0x5a')]:undefined)||''},{'name':_0xfc6c('0x6a'),'value':_0x5ac85a[_0xfc6c('0x6a')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x7]?_0x5ac85a[_0xfc6c('0x59')][0x7][_0xfc6c('0x5a')]:undefined)||''},{'name':_0xfc6c('0x6b'),'value':_0x5ac85a['attrWhatsappAccounts']||(_0x5ac85a['attrs']&&_0x5ac85a[_0xfc6c('0x59')][0x8]?_0x5ac85a[_0xfc6c('0x59')][0x8][_0xfc6c('0x5a')]:undefined)||''},{'name':_0xfc6c('0x6c'),'value':_0x5ac85a[_0xfc6c('0x6c')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a['attrs'][0x9]?_0x5ac85a['attrs'][0x9][_0xfc6c('0x5a')]:undefined)||''}];case _0xfc6c('0x6d'):case _0xfc6c('0x6e'):return[{'name':_0xfc6c('0x6f'),'value':_0x5ac85a[_0xfc6c('0x6f')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x0]?_0x5ac85a[_0xfc6c('0x59')][0x0][_0xfc6c('0x5a')]:undefined)||_0xfc6c('0x70')},{'name':_0xfc6c('0x71'),'value':_0x5ac85a[_0xfc6c('0x71')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x1]?_0x5ac85a[_0xfc6c('0x59')][0x1][_0xfc6c('0x5a')]:undefined)||null},{'name':_0xfc6c('0x72'),'value':_0x5ac85a[_0xfc6c('0x72')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x2]?_0x5ac85a[_0xfc6c('0x59')][0x2]['value']:undefined)||null},{'name':_0xfc6c('0x66'),'value':_0x5ac85a[_0xfc6c('0x66')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x3]?_0x5ac85a[_0xfc6c('0x59')][0x3][_0xfc6c('0x5a')]:undefined)||[]},{'name':_0xfc6c('0x73'),'value':_0x5ac85a[_0xfc6c('0x73')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x4]?_0x5ac85a[_0xfc6c('0x59')][0x4][_0xfc6c('0x5a')]:undefined)||'voice'},{'name':_0xfc6c('0x67'),'value':_0x5ac85a[_0xfc6c('0x67')]||(_0x5ac85a['attrs']&&_0x5ac85a[_0xfc6c('0x59')][0x5]?_0x5ac85a[_0xfc6c('0x59')][0x5][_0xfc6c('0x5a')]:undefined)||''},{'name':_0xfc6c('0x68'),'value':_0x5ac85a['attrFaxAccounts']||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a['attrs'][0x6]?_0x5ac85a[_0xfc6c('0x59')][0x6][_0xfc6c('0x5a')]:undefined)||''},{'name':_0xfc6c('0x69'),'value':_0x5ac85a[_0xfc6c('0x69')]||(_0x5ac85a['attrs']&&_0x5ac85a[_0xfc6c('0x59')][0x7]?_0x5ac85a[_0xfc6c('0x59')][0x7][_0xfc6c('0x5a')]:undefined)||''},{'name':_0xfc6c('0x6a'),'value':_0x5ac85a[_0xfc6c('0x6a')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x8]?_0x5ac85a[_0xfc6c('0x59')][0x8][_0xfc6c('0x5a')]:undefined)||''},{'name':_0xfc6c('0x6b'),'value':_0x5ac85a[_0xfc6c('0x6b')]||(_0x5ac85a['attrs']&&_0x5ac85a[_0xfc6c('0x59')][0x9]?_0x5ac85a[_0xfc6c('0x59')][0x9][_0xfc6c('0x5a')]:undefined)||''},{'name':_0xfc6c('0x6c'),'value':_0x5ac85a[_0xfc6c('0x6c')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0xa]?_0x5ac85a[_0xfc6c('0x59')][0xa][_0xfc6c('0x5a')]:undefined)||''}];case _0xfc6c('0x74'):return[{'name':_0xfc6c('0x75'),'type':_0x5ac85a[_0xfc6c('0x76')]||(_0x5ac85a['attrs']&&_0x5ac85a[_0xfc6c('0x59')][0x0]?_0x5ac85a[_0xfc6c('0x59')][0x0][_0xfc6c('0x31')]:undefined)||null,'value':_0x5ac85a['attrReport']||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x0]?_0x5ac85a['attrs'][0x0]['value']:undefined)||null},{'name':_0xfc6c('0x77'),'value':_0x5ac85a[_0xfc6c('0x77')]||(_0x5ac85a[_0xfc6c('0x59')]&&_0x5ac85a[_0xfc6c('0x59')][0x1]?_0x5ac85a['attrs'][0x1][_0xfc6c('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x34a849){logger[_0xfc6c('0x29')](_0xfc6c('0x78'),JSON[_0xfc6c('0x79')](_0x34a849));return[];}}exports['addItem']=function(_0xe3689e,_0x2406e4,_0x327a83){if(_0xe3689e[_0xfc6c('0x4c')]['id']){delete _0xe3689e[_0xfc6c('0x4c')]['id'];}return db['Dashboard'][_0xfc6c('0x4a')]({'where':{'id':_0xe3689e[_0xfc6c('0x47')]['id']}})[_0xfc6c('0x24')](handleEntityNotFound(_0x2406e4,null))[_0xfc6c('0x24')](function(_0xc5c96a){if(_0xc5c96a){_0xe3689e[_0xfc6c('0x4c')][_0xfc6c('0x7a')]=_0xc5c96a['id'];_0xe3689e[_0xfc6c('0x4c')]['attrs']=widgetAttributes(_0xe3689e[_0xfc6c('0x4c')]);return db['DashboardItem']['create'](_0xe3689e[_0xfc6c('0x4c')]);}})[_0xfc6c('0x24')](respondWithResult(_0x2406e4,null))[_0xfc6c('0x45')](handleError(_0x2406e4,null));};exports['getItems']=function(_0x30cf41,_0x19393a,_0xf3ffea){var _0x3f0cb7={};var _0x3f19be={};var _0x126688;var _0x501ba9;return db[_0xfc6c('0x2e')][_0xfc6c('0x7b')]({'where':{'id':_0x30cf41['params']['id']}})[_0xfc6c('0x24')](handleEntityNotFound(_0x19393a,null))[_0xfc6c('0x24')](function(_0x478717){if(_0x478717){_0x126688=_0x478717;_0x3f19be['model']=_[_0xfc6c('0x35')](db[_0xfc6c('0x7c')][_0xfc6c('0x2f')]);_0x3f19be[_0xfc6c('0x34')]=_[_0xfc6c('0x35')](_0x30cf41[_0xfc6c('0x34')]);_0x3f19be[_0xfc6c('0x36')]=_['intersection'](_0x3f19be[_0xfc6c('0x33')],_0x3f19be[_0xfc6c('0x34')]);_0x3f0cb7[_0xfc6c('0x38')]=_[_0xfc6c('0x48')](_0x3f19be[_0xfc6c('0x33')],qs[_0xfc6c('0x37')](_0x30cf41[_0xfc6c('0x34')][_0xfc6c('0x37')]));_0x3f0cb7['attributes']=_0x3f0cb7[_0xfc6c('0x38')][_0xfc6c('0x39')]?_0x3f0cb7['attributes']:_0x3f19be[_0xfc6c('0x33')];_0x3f0cb7[_0xfc6c('0x3c')]=qs[_0xfc6c('0x3d')](_0x30cf41['query']['sort']);_0x3f0cb7[_0xfc6c('0x3e')]=qs[_0xfc6c('0x36')](_[_0xfc6c('0x3f')](_0x30cf41[_0xfc6c('0x34')],_0x3f19be['filters']));if(_0x30cf41[_0xfc6c('0x34')][_0xfc6c('0x40')]){_0x3f0cb7['where']=_[_0xfc6c('0x41')](_0x3f0cb7[_0xfc6c('0x3e')],{'$or':_[_0xfc6c('0x2d')](_0x3f0cb7[_0xfc6c('0x38')],function(_0x100ddb){var _0x3fdd87={};_0x3fdd87[_0x100ddb]={'$like':'%'+_0x30cf41[_0xfc6c('0x34')][_0xfc6c('0x40')]+'%'};return _0x3fdd87;})});}_0x3f0cb7=_[_0xfc6c('0x41')]({},_0x3f0cb7,_0x30cf41[_0xfc6c('0x42')]);return _0x126688[_0xfc6c('0x7d')](_0x3f0cb7);}})[_0xfc6c('0x24')](function(_0x1ee256){if(_0x1ee256){_0x501ba9=_0x1ee256[_0xfc6c('0x39')];if(!_0x30cf41['query']['hasOwnProperty'](_0xfc6c('0x3b'))){_0x3f0cb7[_0xfc6c('0x1f')]=qs['limit'](_0x30cf41[_0xfc6c('0x34')][_0xfc6c('0x1f')]);_0x3f0cb7['offset']=qs[_0xfc6c('0x1e')](_0x30cf41[_0xfc6c('0x34')][_0xfc6c('0x1e')]);}return _0x126688[_0xfc6c('0x7d')](_0x3f0cb7);}})['then'](function(_0x3cc718){if(_0x3cc718){return _0x3cc718?{'count':_0x501ba9,'rows':_0x3cc718}:null;}})[_0xfc6c('0x24')](respondWithResult(_0x19393a,null))[_0xfc6c('0x45')](handleError(_0x19393a,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index ce3ac36..7621a0f 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 _0x9f01=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','Dashboard'];(function(_0x325658,_0x41e099){var _0x3025a6=function(_0xebc9f3){while(--_0xebc9f3){_0x325658['push'](_0x325658['shift']());}};_0x3025a6(++_0x41e099);}(_0x9f01,0x19c));var _0x19f0=function(_0x2de065,_0x5754c2){_0x2de065=_0x2de065-0x0;var _0x2bb8c7=_0x9f01[_0x2de065];return _0x2bb8c7;};'use strict';var EventEmitter=require(_0x19f0('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x19f0('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x19f0('0x2')](0x0);var events={'afterCreate':_0x19f0('0x3'),'afterUpdate':_0x19f0('0x4'),'afterDestroy':_0x19f0('0x5')};function emitEvent(_0x48af7a){return function(_0x1b0a46,_0x3886b0,_0x47247c){DashboardEvents[_0x19f0('0x6')](_0x48af7a+':'+_0x1b0a46['id'],_0x1b0a46);DashboardEvents[_0x19f0('0x6')](_0x48af7a,_0x1b0a46);_0x47247c(null);};}for(var e in events){if(events[_0x19f0('0x7')](e)){var event=events[e];Dashboard[_0x19f0('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x241a=['hasOwnProperty','exports','events','Dashboard','setMaxListeners','save','update','remove','emit'];(function(_0x12182a,_0x1194f4){var _0x7284ac=function(_0x4f87bb){while(--_0x4f87bb){_0x12182a['push'](_0x12182a['shift']());}};_0x7284ac(++_0x1194f4);}(_0x241a,0x13d));var _0xa241=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x241a[_0x39096d];return _0x13da4f;};'use strict';var EventEmitter=require(_0xa241('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xa241('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa241('0x2')](0x0);var events={'afterCreate':_0xa241('0x3'),'afterUpdate':_0xa241('0x4'),'afterDestroy':_0xa241('0x5')};function emitEvent(_0x51ac21){return function(_0x4b40d8,_0x316fd3,_0x1387cb){DashboardEvents[_0xa241('0x6')](_0x51ac21+':'+_0x4b40d8['id'],_0x4b40d8);DashboardEvents[_0xa241('0x6')](_0x51ac21,_0x4b40d8);_0x1387cb(null);};}for(var e in events){if(events[_0xa241('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xa241('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 0b6c6bb..159c356 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 _0x83cd=['define','dashboards','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x147fee,_0x5f3654){var _0x1932f5=function(_0x36422e){while(--_0x36422e){_0x147fee['push'](_0x147fee['shift']());}};_0x1932f5(++_0x5f3654);}(_0x83cd,0x120));var _0xd83c=function(_0xd0ebf2,_0x9596d9){_0xd0ebf2=_0xd0ebf2-0x0;var _0x47ec74=_0x83cd[_0xd0ebf2];return _0x47ec74;};'use strict';var _=require('lodash');var util=require(_0xd83c('0x0'));var logger=require(_0xd83c('0x1'))(_0xd83c('0x2'));var moment=require('moment');var BPromise=require(_0xd83c('0x3'));var rp=require(_0xd83c('0x4'));var fs=require('fs');var path=require(_0xd83c('0x5'));var rimraf=require(_0xd83c('0x6'));var config=require(_0xd83c('0x7'));var attributes=require('./dashboard.attributes');module[_0xd83c('0x8')]=function(_0x53d55b,_0x4eb6f1){return _0x53d55b[_0xd83c('0x9')]('Dashboard',attributes,{'tableName':_0xd83c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e45=['util','../../config/logger','api','bluebird','request-promise','path','exports','define','Dashboard','dashboards','lodash'];(function(_0xad4c88,_0x1abb36){var _0x8a86f0=function(_0x5dfcf5){while(--_0x5dfcf5){_0xad4c88['push'](_0xad4c88['shift']());}};_0x8a86f0(++_0x1abb36);}(_0x9e45,0x13e));var _0x59e4=function(_0x4e3fb9,_0x47ec2d){_0x4e3fb9=_0x4e3fb9-0x0;var _0x4aecce=_0x9e45[_0x4e3fb9];return _0x4aecce;};'use strict';var _=require(_0x59e4('0x0'));var util=require(_0x59e4('0x1'));var logger=require(_0x59e4('0x2'))(_0x59e4('0x3'));var moment=require('moment');var BPromise=require(_0x59e4('0x4'));var rp=require(_0x59e4('0x5'));var fs=require('fs');var path=require(_0x59e4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0x59e4('0x7')]=function(_0x205877,_0x344f41){return _0x205877[_0x59e4('0x8')](_0x59e4('0x9'),attributes,{'tableName':_0x59e4('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 ccf772f..5c332d8 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 _0x3431=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./dashboard.socket','register','request','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','Dashboard,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2f58ea,_0x2c8f38){var _0x514770=function(_0xd39816){while(--_0xd39816){_0x2f58ea['push'](_0x2f58ea['shift']());}};_0x514770(++_0x2c8f38);}(_0x3431,0x1bb));var _0x1343=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0x3431[_0xea35d1];return _0x1d7a7c;};'use strict';var _=require('lodash');var util=require(_0x1343('0x0'));var moment=require('moment');var BPromise=require(_0x1343('0x1'));var rs=require(_0x1343('0x2'));var fs=require('fs');var Redis=require(_0x1343('0x3'));var db=require(_0x1343('0x4'))['db'];var utils=require(_0x1343('0x5'));var logger=require(_0x1343('0x6'))(_0x1343('0x7'));var config=require(_0x1343('0x8'));var jayson=require(_0x1343('0x9'));var client=jayson[_0x1343('0xa')][_0x1343('0xb')]({'port':0x232a});config['redis']=_[_0x1343('0xc')](config[_0x1343('0xd')],{'host':_0x1343('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1343('0xd')]));require(_0x1343('0xf'))[_0x1343('0x10')](socket);function respondWithRpcPromise(_0x2bc8de,_0x245cde,_0x4244d2){return new BPromise(function(_0x36d8c4,_0x3a6bd9){return client[_0x1343('0x11')](_0x2bc8de,_0x4244d2)['then'](function(_0x2bfa85){logger[_0x1343('0x12')]('Dashboard,\x20%s,\x20%s',_0x245cde,_0x1343('0x13'));logger[_0x1343('0x14')](_0x1343('0x15'),_0x245cde,_0x1343('0x13'),JSON['stringify'](_0x2bfa85));if(_0x2bfa85[_0x1343('0x16')]){if(_0x2bfa85[_0x1343('0x16')][_0x1343('0x17')]===0x1f4){logger[_0x1343('0x16')]('Dashboard,\x20%s,\x20%s',_0x245cde,_0x2bfa85['error'][_0x1343('0x18')]);return _0x3a6bd9(_0x2bfa85[_0x1343('0x16')][_0x1343('0x18')]);}logger[_0x1343('0x16')](_0x1343('0x19'),_0x245cde,_0x2bfa85[_0x1343('0x16')][_0x1343('0x18')]);return _0x36d8c4(_0x2bfa85[_0x1343('0x16')]['message']);}else{logger[_0x1343('0x12')](_0x1343('0x19'),_0x245cde,_0x1343('0x13'));_0x36d8c4(_0x2bfa85[_0x1343('0x1a')][_0x1343('0x18')]);}})[_0x1343('0x1b')](function(_0x273e1b){logger['error'](_0x1343('0x19'),_0x245cde,_0x273e1b);_0x3a6bd9(_0x273e1b);});});} \ No newline at end of file +var _0xcbdb=['localhost','socket.io-emitter','./dashboard.socket','request','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis'];(function(_0x21e03a,_0x59dabf){var _0x5efabd=function(_0x5e2e58){while(--_0x5e2e58){_0x21e03a['push'](_0x21e03a['shift']());}};_0x5efabd(++_0x59dabf);}(_0xcbdb,0x6f));var _0xbcbd=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xcbdb[_0x5bd426];return _0x23a7eb;};'use strict';var _=require('lodash');var util=require(_0xbcbd('0x0'));var moment=require(_0xbcbd('0x1'));var BPromise=require(_0xbcbd('0x2'));var rs=require(_0xbcbd('0x3'));var fs=require('fs');var Redis=require(_0xbcbd('0x4'));var db=require(_0xbcbd('0x5'))['db'];var utils=require(_0xbcbd('0x6'));var logger=require(_0xbcbd('0x7'))(_0xbcbd('0x8'));var config=require(_0xbcbd('0x9'));var jayson=require(_0xbcbd('0xa'));var client=jayson[_0xbcbd('0xb')]['http']({'port':0x232a});config['redis']=_[_0xbcbd('0xc')](config[_0xbcbd('0xd')],{'host':_0xbcbd('0xe'),'port':0x18eb});var socket=require(_0xbcbd('0xf'))(new Redis(config[_0xbcbd('0xd')]));require(_0xbcbd('0x10'))['register'](socket);function respondWithRpcPromise(_0x23431f,_0x6af6f5,_0x2506cf){return new BPromise(function(_0x11aa0e,_0x34eacf){return client[_0xbcbd('0x11')](_0x23431f,_0x2506cf)['then'](function(_0x2eb045){logger['info'](_0xbcbd('0x12'),_0x6af6f5,'request\x20sent');logger['debug'](_0xbcbd('0x13'),_0x6af6f5,_0xbcbd('0x14'),JSON[_0xbcbd('0x15')](_0x2eb045));if(_0x2eb045[_0xbcbd('0x16')]){if(_0x2eb045[_0xbcbd('0x16')][_0xbcbd('0x17')]===0x1f4){logger[_0xbcbd('0x16')](_0xbcbd('0x12'),_0x6af6f5,_0x2eb045['error'][_0xbcbd('0x18')]);return _0x34eacf(_0x2eb045[_0xbcbd('0x16')][_0xbcbd('0x18')]);}logger['error'](_0xbcbd('0x12'),_0x6af6f5,_0x2eb045['error'][_0xbcbd('0x18')]);return _0x11aa0e(_0x2eb045[_0xbcbd('0x16')][_0xbcbd('0x18')]);}else{logger['info'](_0xbcbd('0x12'),_0x6af6f5,'request\x20sent');_0x11aa0e(_0x2eb045['result'][_0xbcbd('0x18')]);}})['catch'](function(_0x1621d8){logger[_0xbcbd('0x16')]('Dashboard,\x20%s,\x20%s',_0x6af6f5,_0x1621d8);_0x34eacf(_0x1621d8);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index ffce8a2..bcb3a0b 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 _0x3361=['register','length','save','update','emit','removeListener'];(function(_0x24899b,_0x1690ed){var _0x3c714c=function(_0x12f6ad){while(--_0x12f6ad){_0x24899b['push'](_0x24899b['shift']());}};_0x3c714c(++_0x1690ed);}(_0x3361,0xfe));var _0x1336=function(_0x16d016,_0x5329fe){_0x16d016=_0x16d016-0x0;var _0x6896d7=_0x3361[_0x16d016];return _0x6896d7;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x1336('0x0'),'remove',_0x1336('0x1')];function createListener(_0x3d4f69,_0x10f568){return function(_0x127d8a){_0x10f568[_0x1336('0x2')](_0x3d4f69,_0x127d8a);};}function removeListener(_0x42cd5b,_0x3fa8b8){return function(){DashboardEvents[_0x1336('0x3')](_0x42cd5b,_0x3fa8b8);};}exports[_0x1336('0x4')]=function(_0x4b0878){for(var _0x2e3aa5=0x0,_0x3fb88e=events[_0x1336('0x5')];_0x2e3aa5<_0x3fb88e;_0x2e3aa5++){var _0x184891=events[_0x2e3aa5];var _0x2b8d1c=createListener('dashboard:'+_0x184891,_0x4b0878);DashboardEvents['on'](_0x184891,_0x2b8d1c);}}; \ No newline at end of file +var _0x00da=['length','./dashboard.events','save','update','emit','removeListener'];(function(_0x3f4b10,_0x2dd0f1){var _0x34d8dd=function(_0x46bef8){while(--_0x46bef8){_0x3f4b10['push'](_0x3f4b10['shift']());}};_0x34d8dd(++_0x2dd0f1);}(_0x00da,0x1cf));var _0xa00d=function(_0x5a501a,_0x2f4f97){_0x5a501a=_0x5a501a-0x0;var _0x25f334=_0x00da[_0x5a501a];return _0x25f334;};'use strict';var DashboardEvents=require(_0xa00d('0x0'));var events=[_0xa00d('0x1'),'remove',_0xa00d('0x2')];function createListener(_0x457042,_0x5de680){return function(_0x55114d){_0x5de680[_0xa00d('0x3')](_0x457042,_0x55114d);};}function removeListener(_0x4971df,_0x333fdc){return function(){DashboardEvents[_0xa00d('0x4')](_0x4971df,_0x333fdc);};}exports['register']=function(_0x4ea212){for(var _0x20f467=0x0,_0x5b9123=events[_0xa00d('0x5')];_0x20f467<_0x5b9123;_0x20f467++){var _0x482ff0=events[_0x20f467];var _0x37525d=createListener('dashboard:'+_0x482ff0,_0x4ea212);DashboardEvents['on'](_0x482ff0,_0x37525d);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 45c8fca..abf3481 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 _0xc028=['put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem'];(function(_0x101223,_0x1a8fa5){var _0x432037=function(_0xc55f11){while(--_0xc55f11){_0x101223['push'](_0x101223['shift']());}};_0x432037(++_0x1a8fa5);}(_0xc028,0x19c));var _0x8c02=function(_0x3747eb,_0x2061a2){_0x3747eb=_0x3747eb-0x0;var _0x123a6c=_0xc028[_0x3747eb];return _0x123a6c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8c02('0x0'));var timeout=require(_0x8c02('0x1'));var express=require(_0x8c02('0x2'));var router=express[_0x8c02('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8c02('0x4'));var interaction=require(_0x8c02('0x5'));var config=require(_0x8c02('0x6'));var controller=require(_0x8c02('0x7'));router[_0x8c02('0x8')]('/',auth[_0x8c02('0x9')](),controller[_0x8c02('0xa')]);router[_0x8c02('0x8')](_0x8c02('0xb'),auth[_0x8c02('0x9')](),controller[_0x8c02('0xc')]);router['get'](_0x8c02('0xd'),auth[_0x8c02('0x9')](),controller[_0x8c02('0xe')]);router[_0x8c02('0xf')]('/',auth[_0x8c02('0x9')](),controller[_0x8c02('0x10')]);router['post'](_0x8c02('0x11'),auth[_0x8c02('0x9')](),controller[_0x8c02('0x12')]);router[_0x8c02('0xf')](_0x8c02('0xd'),auth['isAuthenticated'](),controller[_0x8c02('0x13')]);router[_0x8c02('0x14')]('/:id',auth[_0x8c02('0x9')](),controller['update']);router[_0x8c02('0x15')]('/:id',auth[_0x8c02('0x9')](),controller[_0x8c02('0x16')]);module[_0x8c02('0x17')]=router; \ No newline at end of file +var _0x5ea9=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/items','post','create','/:id/clone','clone','put','delete','destroy','multer','util','path'];(function(_0x34b821,_0x504e55){var _0x5e00a0=function(_0x242892){while(--_0x242892){_0x34b821['push'](_0x34b821['shift']());}};_0x5e00a0(++_0x504e55);}(_0x5ea9,0xba));var _0x95ea=function(_0x7058e5,_0x4304b8){_0x7058e5=_0x7058e5-0x0;var _0xcadefd=_0x5ea9[_0x7058e5];return _0xcadefd;};'use strict';var multer=require(_0x95ea('0x0'));var util=require(_0x95ea('0x1'));var path=require(_0x95ea('0x2'));var timeout=require('connect-timeout');var express=require(_0x95ea('0x3'));var router=express[_0x95ea('0x4')]();var fs_extra=require(_0x95ea('0x5'));var auth=require(_0x95ea('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x95ea('0x7'));var controller=require('./dashboard.controller');router[_0x95ea('0x8')]('/',auth[_0x95ea('0x9')](),controller[_0x95ea('0xa')]);router[_0x95ea('0x8')](_0x95ea('0xb'),auth[_0x95ea('0x9')](),controller[_0x95ea('0xc')]);router[_0x95ea('0x8')](_0x95ea('0xd'),auth[_0x95ea('0x9')](),controller['getItems']);router[_0x95ea('0xe')]('/',auth['isAuthenticated'](),controller[_0x95ea('0xf')]);router[_0x95ea('0xe')](_0x95ea('0x10'),auth[_0x95ea('0x9')](),controller[_0x95ea('0x11')]);router['post'](_0x95ea('0xd'),auth[_0x95ea('0x9')](),controller['addItem']);router[_0x95ea('0x12')](_0x95ea('0xb'),auth[_0x95ea('0x9')](),controller['update']);router[_0x95ea('0x13')](_0x95ea('0xb'),auth[_0x95ea('0x9')](),controller[_0x95ea('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index e8ca353..183c08c 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 _0x33af=['attrs','setDataValue','stringify','INTEGER','#ffffff','squel','exports','STRING','TEXT','long','parse'];(function(_0x411f6f,_0x1a311d){var _0x14d129=function(_0x4dd216){while(--_0x4dd216){_0x411f6f['push'](_0x411f6f['shift']());}};_0x14d129(++_0x1a311d);}(_0x33af,0xec));var _0xf33a=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x33af[_0x4e1a49];return _0x136aae;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xf33a('0x0'));var _=require('lodash');module[_0xf33a('0x1')]={'title':{'type':Sequelize[_0xf33a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf33a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf33a('0x3')](_0xf33a('0x4')),'get':function(){try{return JSON[_0xf33a('0x5')](this['getDataValue'](_0xf33a('0x6')));}catch(_0x44cfa5){return[];}},'set':function(_0x583e54){try{this[_0xf33a('0x7')](_0xf33a('0x6'),JSON[_0xf33a('0x8')](_0x583e54));}catch(_0x2f3730){this[_0xf33a('0x7')](_0xf33a('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xf33a('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf33a('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf33a('0x9')]},'col':{'type':Sequelize[_0xf33a('0x9')]},'background':{'type':Sequelize[_0xf33a('0x2')],'allowNull':![],'defaultValue':_0xf33a('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xf33a('0x2')]},'titleFontSize':{'type':Sequelize[_0xf33a('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x1967=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#2196f3','squel','lodash','exports','STRING','TEXT','long'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x1967,0x173));var _0x7196=function(_0x49046d,_0x44a932){_0x49046d=_0x49046d-0x0;var _0x47df70=_0x1967[_0x49046d];return _0x47df70;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x7196('0x0'));var _=require(_0x7196('0x1'));module[_0x7196('0x2')]={'title':{'type':Sequelize[_0x7196('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x7196('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7196('0x4')](_0x7196('0x5')),'get':function(){try{return JSON[_0x7196('0x6')](this[_0x7196('0x7')](_0x7196('0x8')));}catch(_0x5c128f){return[];}},'set':function(_0x36b01e){try{this[_0x7196('0x9')](_0x7196('0x8'),JSON[_0x7196('0xa')](_0x36b01e));}catch(_0x266a6e){this[_0x7196('0x9')]('attrs',JSON[_0x7196('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x7196('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7196('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7196('0xb')]},'col':{'type':Sequelize[_0x7196('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7196('0x3')],'allowNull':![],'defaultValue':_0x7196('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7196('0x3')]},'titleFontSize':{'type':Sequelize[_0x7196('0xb')],'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 ceab439..3f24109 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 _0xb3f9=['clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','body','update','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','stack','name','send','params','model','keys','query','filters','attributes','intersection','fields','length','includeAll','include','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value'];(function(_0xc9c3b0,_0x38b68a){var _0x31ff42=function(_0x22c29d){while(--_0x22c29d){_0xc9c3b0['push'](_0xc9c3b0['shift']());}};_0x31ff42(++_0x38b68a);}(_0xb3f9,0x7a));var _0x9b3f=function(_0x3854ed,_0x335031){_0x3854ed=_0x3854ed-0x0;var _0x5c25c1=_0xb3f9[_0x3854ed];return _0x5c25c1;};'use strict';var emlformat=require(_0x9b3f('0x0'));var rimraf=require(_0x9b3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9b3f('0x2'));var moment=require('moment');var BPromise=require(_0x9b3f('0x3'));var Mustache=require(_0x9b3f('0x4'));var util=require(_0x9b3f('0x5'));var path=require(_0x9b3f('0x6'));var sox=require(_0x9b3f('0x7'));var csv=require(_0x9b3f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b3f('0x9'));var squel=require(_0x9b3f('0xa'));var crypto=require('crypto');var jsforce=require(_0x9b3f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9b3f('0xc'));var Redis=require('ioredis');var authService=require(_0x9b3f('0xd'));var qs=require(_0x9b3f('0xe'));var as=require(_0x9b3f('0xf'));var hardwareService=require(_0x9b3f('0x10'));var logger=require(_0x9b3f('0x11'))('api');var utils=require(_0x9b3f('0x12'));var config=require(_0x9b3f('0x13'));var licenseUtil=require(_0x9b3f('0x14'));var db=require(_0x9b3f('0x15'))['db'];config[_0x9b3f('0x16')]=_[_0x9b3f('0x17')](config[_0x9b3f('0x16')],{'host':_0x9b3f('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9b3f('0x19'))[_0x9b3f('0x1a')](socket);function respondWithStatusCode(_0x27dab5,_0x377bfa){_0x377bfa=_0x377bfa||0xcc;return function(_0x76978e){if(_0x76978e){return _0x27dab5['sendStatus'](_0x377bfa);}return _0x27dab5['status'](_0x377bfa)['end']();};}function respondWithResult(_0x34fb19,_0x427992){_0x427992=_0x427992||0xc8;return function(_0x484323){if(_0x484323){return _0x34fb19[_0x9b3f('0x1b')](_0x427992)[_0x9b3f('0x1c')](_0x484323);}};}function respondWithFilteredResult(_0x2cdc7c,_0x5f5c1c){return function(_0x579c32){if(_0x579c32){var _0x2f2a53=typeof _0x5f5c1c[_0x9b3f('0x1d')]===_0x9b3f('0x1e')&&typeof _0x5f5c1c[_0x9b3f('0x1f')]===_0x9b3f('0x1e');var _0x297fa8=_0x579c32[_0x9b3f('0x20')];var _0x17f2d3=_0x2f2a53?0x0:_0x5f5c1c[_0x9b3f('0x1d')];var _0x13e65b=_0x2f2a53?_0x579c32[_0x9b3f('0x20')]:_0x5f5c1c[_0x9b3f('0x1d')]+_0x5f5c1c[_0x9b3f('0x1f')];var _0x1218c0;if(_0x13e65b>=_0x297fa8){_0x13e65b=_0x297fa8;_0x1218c0=0xc8;}else{_0x1218c0=0xce;}_0x2cdc7c[_0x9b3f('0x1b')](_0x1218c0);return _0x2cdc7c[_0x9b3f('0x21')](_0x9b3f('0x22'),_0x17f2d3+'-'+_0x13e65b+'/'+_0x297fa8)[_0x9b3f('0x1c')](_0x579c32);}return null;};}function patchUpdates(_0x3360d6){return function(_0x5b4f21){try{jsonpatch[_0x9b3f('0x23')](_0x5b4f21,_0x3360d6,!![]);}catch(_0x4db496){return BPromise[_0x9b3f('0x24')](_0x4db496);}return _0x5b4f21['save']();};}function saveUpdates(_0x3c9d8d,_0x28dd96){return function(_0x16452e){if(_0x16452e){return _0x16452e['update'](_0x3c9d8d)[_0x9b3f('0x25')](function(_0x483eb3){return _0x483eb3;});}return null;};}function removeEntity(_0x325c74,_0x526355){return function(_0x1b3ba8){if(_0x1b3ba8){return _0x1b3ba8[_0x9b3f('0x26')]()['then'](function(){_0x325c74[_0x9b3f('0x1b')](0xcc)[_0x9b3f('0x27')]();});}};}function handleEntityNotFound(_0x2dfef4,_0x9cf303){return function(_0x487527){if(!_0x487527){_0x2dfef4['sendStatus'](0x194);}return _0x487527;};}function handleError(_0x28e426,_0x555bf4){_0x555bf4=_0x555bf4||0x1f4;return function(_0x377d0e){logger['error'](_0x377d0e[_0x9b3f('0x28')]);if(_0x377d0e[_0x9b3f('0x29')]){delete _0x377d0e[_0x9b3f('0x29')];}_0x28e426[_0x9b3f('0x1b')](_0x555bf4)[_0x9b3f('0x2a')](_0x377d0e);};}exports['show']=function(_0x23dff5,_0x38dd12){var _0x1dad0e={'raw':![],'where':{'id':_0x23dff5[_0x9b3f('0x2b')]['id']}},_0x2a0a0c={};_0x2a0a0c[_0x9b3f('0x2c')]=_[_0x9b3f('0x2d')](db['DashboardItem']['rawAttributes']);_0x2a0a0c[_0x9b3f('0x2e')]=_['keys'](_0x23dff5['query']);_0x2a0a0c[_0x9b3f('0x2f')]=_['intersection'](_0x2a0a0c[_0x9b3f('0x2c')],_0x2a0a0c[_0x9b3f('0x2e')]);_0x1dad0e[_0x9b3f('0x30')]=_[_0x9b3f('0x31')](_0x2a0a0c[_0x9b3f('0x2c')],qs['fields'](_0x23dff5[_0x9b3f('0x2e')][_0x9b3f('0x32')]));_0x1dad0e[_0x9b3f('0x30')]=_0x1dad0e[_0x9b3f('0x30')][_0x9b3f('0x33')]?_0x1dad0e[_0x9b3f('0x30')]:_0x2a0a0c['model'];if(_0x23dff5[_0x9b3f('0x2e')][_0x9b3f('0x34')]){_0x1dad0e[_0x9b3f('0x35')]=[{'all':!![]}];}_0x1dad0e=_['merge']({},_0x1dad0e,_0x23dff5[_0x9b3f('0x36')]);return db[_0x9b3f('0x37')][_0x9b3f('0x38')](_0x1dad0e)[_0x9b3f('0x25')](handleEntityNotFound(_0x38dd12,null))[_0x9b3f('0x25')](respondWithResult(_0x38dd12,null))[_0x9b3f('0x39')](handleError(_0x38dd12,null));};exports[_0x9b3f('0x26')]=function(_0x1cfa30,_0x115d38){return db[_0x9b3f('0x37')][_0x9b3f('0x38')]({'where':{'id':_0x1cfa30[_0x9b3f('0x2b')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x115d38,null))[_0x9b3f('0x25')](removeEntity(_0x115d38,null))[_0x9b3f('0x39')](handleError(_0x115d38,null));};function widgetAttributes(_0x4c4aba){try{switch(_0x4c4aba[_0x9b3f('0x3a')]){case _0x9b3f('0x3b'):return[{'name':_0x9b3f('0x3c'),'value':_0x4c4aba[_0x9b3f('0x3c')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x0]?_0x4c4aba[_0x9b3f('0x3d')][0x0]['value']:undefined)||_0x9b3f('0x3e')}];case _0x9b3f('0x3f'):return[{'name':'attrPath','value':_0x4c4aba[_0x9b3f('0x40')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x0]?_0x4c4aba[_0x9b3f('0x3d')][0x0][_0x9b3f('0x41')]:undefined)||''}];case _0x9b3f('0x42'):return[{'name':'attrHourFormat','value':_0x4c4aba[_0x9b3f('0x43')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x0]?_0x4c4aba[_0x9b3f('0x3d')][0x0][_0x9b3f('0x41')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x4c4aba[_0x9b3f('0x44')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x1]?_0x4c4aba['attrs'][0x1][_0x9b3f('0x41')]:undefined)||'0.00'},{'name':_0x9b3f('0x45'),'value':_0x4c4aba['attrFontSize']||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x2]?_0x4c4aba['attrs'][0x2][_0x9b3f('0x41')]:undefined)||0xc}];case _0x9b3f('0x46'):return[{'name':_0x9b3f('0x47'),'value':_0x4c4aba[_0x9b3f('0x47')]||(_0x4c4aba['attrs']&&_0x4c4aba['attrs'][0x0]?_0x4c4aba[_0x9b3f('0x3d')][0x0]['value']:undefined)||_0x9b3f('0x48')},{'name':_0x9b3f('0x49'),'value':_0x4c4aba['attrVoiceQueues']||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x1]?_0x4c4aba[_0x9b3f('0x3d')][0x1][_0x9b3f('0x41')]:undefined)||[]},{'name':'attrFontSize','value':_0x4c4aba[_0x9b3f('0x45')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x2]?_0x4c4aba[_0x9b3f('0x3d')][0x2][_0x9b3f('0x41')]:undefined)||0x14},{'name':'attrChannel','value':_0x4c4aba[_0x9b3f('0x4a')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x3]?_0x4c4aba[_0x9b3f('0x3d')][0x3][_0x9b3f('0x41')]:undefined)||_0x9b3f('0x4b')},{'name':_0x9b3f('0x4c'),'value':_0x4c4aba[_0x9b3f('0x4c')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x4]?_0x4c4aba['attrs'][0x4][_0x9b3f('0x41')]:undefined)||''},{'name':_0x9b3f('0x4d'),'value':_0x4c4aba[_0x9b3f('0x4d')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x5]?_0x4c4aba[_0x9b3f('0x3d')][0x5][_0x9b3f('0x41')]:undefined)||''},{'name':_0x9b3f('0x4e'),'value':_0x4c4aba[_0x9b3f('0x4e')]||(_0x4c4aba['attrs']&&_0x4c4aba[_0x9b3f('0x3d')][0x6]?_0x4c4aba['attrs'][0x6][_0x9b3f('0x41')]:undefined)||''},{'name':_0x9b3f('0x4f'),'value':_0x4c4aba[_0x9b3f('0x4f')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x7]?_0x4c4aba[_0x9b3f('0x3d')][0x7][_0x9b3f('0x41')]:undefined)||''},{'name':_0x9b3f('0x50'),'value':_0x4c4aba[_0x9b3f('0x50')]||(_0x4c4aba['attrs']&&_0x4c4aba['attrs'][0x8]?_0x4c4aba['attrs'][0x8]['value']:undefined)||''},{'name':_0x9b3f('0x51'),'value':_0x4c4aba[_0x9b3f('0x51')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x9]?_0x4c4aba[_0x9b3f('0x3d')][0x9]['value']:undefined)||''}];case _0x9b3f('0x52'):case'pie-chart':return[{'name':_0x9b3f('0x53'),'value':_0x4c4aba[_0x9b3f('0x53')]||(_0x4c4aba['attrs']&&_0x4c4aba[_0x9b3f('0x3d')][0x0]?_0x4c4aba[_0x9b3f('0x3d')][0x0][_0x9b3f('0x41')]:undefined)||_0x9b3f('0x48')},{'name':_0x9b3f('0x54'),'value':_0x4c4aba[_0x9b3f('0x54')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x1]?_0x4c4aba[_0x9b3f('0x3d')][0x1]['value']:undefined)||null},{'name':_0x9b3f('0x55'),'value':_0x4c4aba[_0x9b3f('0x55')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x2]?_0x4c4aba[_0x9b3f('0x3d')][0x2]['value']:undefined)||null},{'name':_0x9b3f('0x49'),'value':_0x4c4aba[_0x9b3f('0x49')]||(_0x4c4aba['attrs']&&_0x4c4aba[_0x9b3f('0x3d')][0x3]?_0x4c4aba[_0x9b3f('0x3d')][0x3][_0x9b3f('0x41')]:undefined)||[]},{'name':'attrChannel','value':_0x4c4aba[_0x9b3f('0x4a')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x4]?_0x4c4aba[_0x9b3f('0x3d')][0x4][_0x9b3f('0x41')]:undefined)||_0x9b3f('0x4b')},{'name':_0x9b3f('0x4c'),'value':_0x4c4aba[_0x9b3f('0x4c')]||(_0x4c4aba['attrs']&&_0x4c4aba[_0x9b3f('0x3d')][0x5]?_0x4c4aba[_0x9b3f('0x3d')][0x5][_0x9b3f('0x41')]:undefined)||''},{'name':_0x9b3f('0x4d'),'value':_0x4c4aba[_0x9b3f('0x4d')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x6]?_0x4c4aba[_0x9b3f('0x3d')][0x6][_0x9b3f('0x41')]:undefined)||''},{'name':_0x9b3f('0x4e'),'value':_0x4c4aba[_0x9b3f('0x4e')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x7]?_0x4c4aba[_0x9b3f('0x3d')][0x7][_0x9b3f('0x41')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4c4aba[_0x9b3f('0x4f')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x8]?_0x4c4aba[_0x9b3f('0x3d')][0x8][_0x9b3f('0x41')]:undefined)||''},{'name':_0x9b3f('0x50'),'value':_0x4c4aba[_0x9b3f('0x50')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x9]?_0x4c4aba[_0x9b3f('0x3d')][0x9]['value']:undefined)||''},{'name':_0x9b3f('0x51'),'value':_0x4c4aba[_0x9b3f('0x51')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0xa]?_0x4c4aba[_0x9b3f('0x3d')][0xa][_0x9b3f('0x41')]:undefined)||''}];case _0x9b3f('0x56'):return[{'name':_0x9b3f('0x57'),'type':_0x4c4aba[_0x9b3f('0x58')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x0]?_0x4c4aba[_0x9b3f('0x3d')][0x0][_0x9b3f('0x3a')]:undefined)||null,'value':_0x4c4aba[_0x9b3f('0x57')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x0]?_0x4c4aba['attrs'][0x0][_0x9b3f('0x41')]:undefined)||null},{'name':_0x9b3f('0x59'),'value':_0x4c4aba['attrRefresh']||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x1]?_0x4c4aba['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x54f8f3){logger[_0x9b3f('0x5a')](_0x9b3f('0x5b'),JSON['stringify'](_0x54f8f3));return[];}}exports['create']=function(_0x24a45a,_0x7a43a5){if(_0x24a45a[_0x9b3f('0x5c')]){_0x24a45a['body'][_0x9b3f('0x3d')]=widgetAttributes(_0x24a45a['body']);}return db['DashboardItem']['create'](_0x24a45a['body'],{})['then'](respondWithResult(_0x7a43a5,0xc9))[_0x9b3f('0x39')](handleError(_0x7a43a5,null));};exports[_0x9b3f('0x5d')]=function(_0x46e1c9,_0x1bfaad){if(_0x46e1c9[_0x9b3f('0x5c')]['id']){delete _0x46e1c9[_0x9b3f('0x5c')]['id'];}_0x46e1c9[_0x9b3f('0x5c')]['attrs']=widgetAttributes(_0x46e1c9[_0x9b3f('0x5c')]);return db[_0x9b3f('0x37')][_0x9b3f('0x38')]({'where':{'id':_0x46e1c9[_0x9b3f('0x2b')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x1bfaad,null))['then'](saveUpdates(_0x46e1c9['body'],null))[_0x9b3f('0x25')](respondWithResult(_0x1bfaad,null))[_0x9b3f('0x39')](handleError(_0x1bfaad,null));}; \ No newline at end of file +var _0xafca=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','show','DashboardItem','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','merge','options','find','params','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x7c61a2,_0x4aac8a){var _0x46f65c=function(_0x426eb8){while(--_0x426eb8){_0x7c61a2['push'](_0x7c61a2['shift']());}};_0x46f65c(++_0x4aac8a);}(_0xafca,0x1ef));var _0xaafc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xafca[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaafc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaafc('0x1'));var jsonpatch=require(_0xaafc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaafc('0x3'));var Mustache=require(_0xaafc('0x4'));var util=require(_0xaafc('0x5'));var path=require(_0xaafc('0x6'));var sox=require(_0xaafc('0x7'));var csv=require('to-csv');var ejs=require(_0xaafc('0x8'));var fs=require('fs');var fs_extra=require(_0xaafc('0x9'));var _=require(_0xaafc('0xa'));var squel=require(_0xaafc('0xb'));var crypto=require(_0xaafc('0xc'));var jsforce=require(_0xaafc('0xd'));var deskjs=require(_0xaafc('0xe'));var toCsv=require(_0xaafc('0xf'));var querystring=require(_0xaafc('0x10'));var Papa=require(_0xaafc('0x11'));var Redis=require(_0xaafc('0x12'));var authService=require(_0xaafc('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaafc('0x14'));var logger=require('../../config/logger')(_0xaafc('0x15'));var utils=require('../../config/utils');var config=require(_0xaafc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaafc('0x17'))['db'];config[_0xaafc('0x18')]=_[_0xaafc('0x19')](config[_0xaafc('0x18')],{'host':_0xaafc('0x1a'),'port':0x18eb});var socket=require(_0xaafc('0x1b'))(new Redis(config[_0xaafc('0x18')]));require(_0xaafc('0x1c'))[_0xaafc('0x1d')](socket);function respondWithStatusCode(_0x3313ae,_0x2505ea){_0x2505ea=_0x2505ea||0xcc;return function(_0x54d69b){if(_0x54d69b){return _0x3313ae[_0xaafc('0x1e')](_0x2505ea);}return _0x3313ae[_0xaafc('0x1f')](_0x2505ea)[_0xaafc('0x20')]();};}function respondWithResult(_0x42ef58,_0x404ddf){_0x404ddf=_0x404ddf||0xc8;return function(_0x1248ac){if(_0x1248ac){return _0x42ef58[_0xaafc('0x1f')](_0x404ddf)[_0xaafc('0x21')](_0x1248ac);}};}function respondWithFilteredResult(_0x34b7e0,_0x2af27e){return function(_0x48c266){if(_0x48c266){var _0x1b0d6d=typeof _0x2af27e['offset']===_0xaafc('0x22')&&typeof _0x2af27e[_0xaafc('0x23')]===_0xaafc('0x22');var _0x30b49c=_0x48c266[_0xaafc('0x24')];var _0x3ba411=_0x1b0d6d?0x0:_0x2af27e[_0xaafc('0x25')];var _0x331763=_0x1b0d6d?_0x48c266[_0xaafc('0x24')]:_0x2af27e['offset']+_0x2af27e[_0xaafc('0x23')];var _0x990ed9;if(_0x331763>=_0x30b49c){_0x331763=_0x30b49c;_0x990ed9=0xc8;}else{_0x990ed9=0xce;}_0x34b7e0['status'](_0x990ed9);return _0x34b7e0[_0xaafc('0x26')](_0xaafc('0x27'),_0x3ba411+'-'+_0x331763+'/'+_0x30b49c)[_0xaafc('0x21')](_0x48c266);}return null;};}function patchUpdates(_0x521f26){return function(_0x4421a7){try{jsonpatch[_0xaafc('0x28')](_0x4421a7,_0x521f26,!![]);}catch(_0x1d2091){return BPromise['reject'](_0x1d2091);}return _0x4421a7[_0xaafc('0x29')]();};}function saveUpdates(_0xd3b1a2,_0x48e541){return function(_0x3c598c){if(_0x3c598c){return _0x3c598c[_0xaafc('0x2a')](_0xd3b1a2)[_0xaafc('0x2b')](function(_0x4103fc){return _0x4103fc;});}return null;};}function removeEntity(_0x1f5522,_0x386bac){return function(_0x5c047c){if(_0x5c047c){return _0x5c047c[_0xaafc('0x2c')]()[_0xaafc('0x2b')](function(){_0x1f5522[_0xaafc('0x1f')](0xcc)[_0xaafc('0x20')]();});}};}function handleEntityNotFound(_0x59a97f,_0x43e3f1){return function(_0x239037){if(!_0x239037){_0x59a97f[_0xaafc('0x1e')](0x194);}return _0x239037;};}function handleError(_0xf9e586,_0x143dda){_0x143dda=_0x143dda||0x1f4;return function(_0x44e207){logger[_0xaafc('0x2d')](_0x44e207[_0xaafc('0x2e')]);if(_0x44e207[_0xaafc('0x2f')]){delete _0x44e207[_0xaafc('0x2f')];}_0xf9e586[_0xaafc('0x1f')](_0x143dda)[_0xaafc('0x30')](_0x44e207);};}exports[_0xaafc('0x31')]=function(_0x3eacd2,_0x32c110){var _0x6d3ed4={'raw':![],'where':{'id':_0x3eacd2['params']['id']}},_0x35a29f={};_0x35a29f['model']=_['keys'](db[_0xaafc('0x32')][_0xaafc('0x33')]);_0x35a29f[_0xaafc('0x34')]=_['keys'](_0x3eacd2[_0xaafc('0x34')]);_0x35a29f[_0xaafc('0x35')]=_[_0xaafc('0x36')](_0x35a29f[_0xaafc('0x37')],_0x35a29f[_0xaafc('0x34')]);_0x6d3ed4['attributes']=_['intersection'](_0x35a29f['model'],qs[_0xaafc('0x38')](_0x3eacd2[_0xaafc('0x34')][_0xaafc('0x38')]));_0x6d3ed4[_0xaafc('0x39')]=_0x6d3ed4[_0xaafc('0x39')]['length']?_0x6d3ed4[_0xaafc('0x39')]:_0x35a29f[_0xaafc('0x37')];if(_0x3eacd2[_0xaafc('0x34')][_0xaafc('0x3a')]){_0x6d3ed4[_0xaafc('0x3b')]=[{'all':!![]}];}_0x6d3ed4=_[_0xaafc('0x3c')]({},_0x6d3ed4,_0x3eacd2[_0xaafc('0x3d')]);return db['DashboardItem']['find'](_0x6d3ed4)[_0xaafc('0x2b')](handleEntityNotFound(_0x32c110,null))[_0xaafc('0x2b')](respondWithResult(_0x32c110,null))['catch'](handleError(_0x32c110,null));};exports[_0xaafc('0x2c')]=function(_0x118a97,_0x35f761){return db[_0xaafc('0x32')][_0xaafc('0x3e')]({'where':{'id':_0x118a97[_0xaafc('0x3f')]['id']}})[_0xaafc('0x2b')](handleEntityNotFound(_0x35f761,null))[_0xaafc('0x2b')](removeEntity(_0x35f761,null))[_0xaafc('0x40')](handleError(_0x35f761,null));};function widgetAttributes(_0x3b8c95){try{switch(_0x3b8c95[_0xaafc('0x41')]){case _0xaafc('0x42'):return[{'name':_0xaafc('0x43'),'value':_0x3b8c95[_0xaafc('0x43')]||(_0x3b8c95['attrs']&&_0x3b8c95[_0xaafc('0x44')][0x0]?_0x3b8c95['attrs'][0x0][_0xaafc('0x45')]:undefined)||_0xaafc('0x46')}];case _0xaafc('0x47'):return[{'name':_0xaafc('0x48'),'value':_0x3b8c95[_0xaafc('0x48')]||(_0x3b8c95['attrs']&&_0x3b8c95[_0xaafc('0x44')][0x0]?_0x3b8c95['attrs'][0x0][_0xaafc('0x45')]:undefined)||''}];case _0xaafc('0x49'):return[{'name':_0xaafc('0x4a'),'value':_0x3b8c95[_0xaafc('0x4a')]||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95[_0xaafc('0x44')][0x0]?_0x3b8c95['attrs'][0x0][_0xaafc('0x45')]:undefined)||_0xaafc('0x4b')},{'name':'attrTimezone','value':_0x3b8c95['attrTimezone']||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95[_0xaafc('0x44')][0x1]?_0x3b8c95[_0xaafc('0x44')][0x1][_0xaafc('0x45')]:undefined)||_0xaafc('0x4c')},{'name':_0xaafc('0x4d'),'value':_0x3b8c95['attrFontSize']||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95[_0xaafc('0x44')][0x2]?_0x3b8c95['attrs'][0x2][_0xaafc('0x45')]:undefined)||0xc}];case _0xaafc('0x4e'):return[{'name':'attrMetric','value':_0x3b8c95[_0xaafc('0x4f')]||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95['attrs'][0x0]?_0x3b8c95[_0xaafc('0x44')][0x0]['value']:undefined)||_0xaafc('0x50')},{'name':_0xaafc('0x51'),'value':_0x3b8c95[_0xaafc('0x51')]||(_0x3b8c95['attrs']&&_0x3b8c95[_0xaafc('0x44')][0x1]?_0x3b8c95[_0xaafc('0x44')][0x1][_0xaafc('0x45')]:undefined)||[]},{'name':'attrFontSize','value':_0x3b8c95[_0xaafc('0x4d')]||(_0x3b8c95['attrs']&&_0x3b8c95[_0xaafc('0x44')][0x2]?_0x3b8c95['attrs'][0x2]['value']:undefined)||0x14},{'name':_0xaafc('0x52'),'value':_0x3b8c95[_0xaafc('0x52')]||(_0x3b8c95['attrs']&&_0x3b8c95['attrs'][0x3]?_0x3b8c95[_0xaafc('0x44')][0x3][_0xaafc('0x45')]:undefined)||_0xaafc('0x53')},{'name':_0xaafc('0x54'),'value':_0x3b8c95[_0xaafc('0x54')]||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95[_0xaafc('0x44')][0x4]?_0x3b8c95[_0xaafc('0x44')][0x4][_0xaafc('0x45')]:undefined)||''},{'name':_0xaafc('0x55'),'value':_0x3b8c95[_0xaafc('0x55')]||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95['attrs'][0x5]?_0x3b8c95[_0xaafc('0x44')][0x5][_0xaafc('0x45')]:undefined)||''},{'name':_0xaafc('0x56'),'value':_0x3b8c95[_0xaafc('0x56')]||(_0x3b8c95['attrs']&&_0x3b8c95[_0xaafc('0x44')][0x6]?_0x3b8c95['attrs'][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3b8c95[_0xaafc('0x57')]||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95[_0xaafc('0x44')][0x7]?_0x3b8c95['attrs'][0x7][_0xaafc('0x45')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3b8c95[_0xaafc('0x58')]||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95[_0xaafc('0x44')][0x8]?_0x3b8c95['attrs'][0x8][_0xaafc('0x45')]:undefined)||''},{'name':_0xaafc('0x59'),'value':_0x3b8c95[_0xaafc('0x59')]||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95['attrs'][0x9]?_0x3b8c95[_0xaafc('0x44')][0x9][_0xaafc('0x45')]:undefined)||''}];case _0xaafc('0x5a'):case _0xaafc('0x5b'):return[{'name':'attrSerie1','value':_0x3b8c95[_0xaafc('0x5c')]||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95[_0xaafc('0x44')][0x0]?_0x3b8c95[_0xaafc('0x44')][0x0][_0xaafc('0x45')]:undefined)||_0xaafc('0x50')},{'name':'attrSerie2','value':_0x3b8c95['attrSerie2']||(_0x3b8c95['attrs']&&_0x3b8c95[_0xaafc('0x44')][0x1]?_0x3b8c95[_0xaafc('0x44')][0x1]['value']:undefined)||null},{'name':_0xaafc('0x5d'),'value':_0x3b8c95[_0xaafc('0x5d')]||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95['attrs'][0x2]?_0x3b8c95[_0xaafc('0x44')][0x2][_0xaafc('0x45')]:undefined)||null},{'name':_0xaafc('0x51'),'value':_0x3b8c95[_0xaafc('0x51')]||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95[_0xaafc('0x44')][0x3]?_0x3b8c95['attrs'][0x3][_0xaafc('0x45')]:undefined)||[]},{'name':'attrChannel','value':_0x3b8c95[_0xaafc('0x52')]||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95[_0xaafc('0x44')][0x4]?_0x3b8c95[_0xaafc('0x44')][0x4][_0xaafc('0x45')]:undefined)||_0xaafc('0x53')},{'name':_0xaafc('0x54'),'value':_0x3b8c95['attrEmailAccounts']||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95[_0xaafc('0x44')][0x5]?_0x3b8c95[_0xaafc('0x44')][0x5]['value']:undefined)||''},{'name':_0xaafc('0x55'),'value':_0x3b8c95[_0xaafc('0x55')]||(_0x3b8c95['attrs']&&_0x3b8c95[_0xaafc('0x44')][0x6]?_0x3b8c95['attrs'][0x6][_0xaafc('0x45')]:undefined)||''},{'name':_0xaafc('0x56'),'value':_0x3b8c95[_0xaafc('0x56')]||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95[_0xaafc('0x44')][0x7]?_0x3b8c95[_0xaafc('0x44')][0x7][_0xaafc('0x45')]:undefined)||''},{'name':_0xaafc('0x57'),'value':_0x3b8c95['attrOpenchannelAccounts']||(_0x3b8c95['attrs']&&_0x3b8c95[_0xaafc('0x44')][0x8]?_0x3b8c95[_0xaafc('0x44')][0x8][_0xaafc('0x45')]:undefined)||''},{'name':_0xaafc('0x58'),'value':_0x3b8c95[_0xaafc('0x58')]||(_0x3b8c95['attrs']&&_0x3b8c95['attrs'][0x9]?_0x3b8c95[_0xaafc('0x44')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x3b8c95[_0xaafc('0x59')]||(_0x3b8c95['attrs']&&_0x3b8c95[_0xaafc('0x44')][0xa]?_0x3b8c95[_0xaafc('0x44')][0xa][_0xaafc('0x45')]:undefined)||''}];case'web-report':return[{'name':_0xaafc('0x5e'),'type':_0x3b8c95[_0xaafc('0x5f')]||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95[_0xaafc('0x44')][0x0]?_0x3b8c95['attrs'][0x0][_0xaafc('0x41')]:undefined)||null,'value':_0x3b8c95[_0xaafc('0x5e')]||(_0x3b8c95['attrs']&&_0x3b8c95[_0xaafc('0x44')][0x0]?_0x3b8c95[_0xaafc('0x44')][0x0][_0xaafc('0x45')]:undefined)||null},{'name':_0xaafc('0x60'),'value':_0x3b8c95[_0xaafc('0x60')]||(_0x3b8c95[_0xaafc('0x44')]&&_0x3b8c95['attrs'][0x1]?_0x3b8c95[_0xaafc('0x44')][0x1][_0xaafc('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x44b98a){logger['error'](_0xaafc('0x61'),JSON[_0xaafc('0x62')](_0x44b98a));return[];}}exports[_0xaafc('0x63')]=function(_0x57e219,_0x59733f){if(_0x57e219[_0xaafc('0x64')]){_0x57e219[_0xaafc('0x64')][_0xaafc('0x44')]=widgetAttributes(_0x57e219[_0xaafc('0x64')]);}return db[_0xaafc('0x32')][_0xaafc('0x63')](_0x57e219[_0xaafc('0x64')],{})['then'](respondWithResult(_0x59733f,0xc9))[_0xaafc('0x40')](handleError(_0x59733f,null));};exports[_0xaafc('0x2a')]=function(_0x289383,_0x1f019b){if(_0x289383[_0xaafc('0x64')]['id']){delete _0x289383[_0xaafc('0x64')]['id'];}_0x289383[_0xaafc('0x64')]['attrs']=widgetAttributes(_0x289383[_0xaafc('0x64')]);return db[_0xaafc('0x32')]['find']({'where':{'id':_0x289383[_0xaafc('0x3f')]['id']}})[_0xaafc('0x2b')](handleEntityNotFound(_0x1f019b,null))[_0xaafc('0x2b')](saveUpdates(_0x289383[_0xaafc('0x64')],null))[_0xaafc('0x2b')](respondWithResult(_0x1f019b,null))['catch'](handleError(_0x1f019b,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 3a698dd..80e2519 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 _0xf4e2=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','update'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xf4e2,0x15a));var _0x2f4e=function(_0x44faf5,_0x1f0f92){_0x44faf5=_0x44faf5-0x0;var _0x4c0a90=_0xf4e2[_0x44faf5];return _0x4c0a90;};'use strict';var EventEmitter=require(_0x2f4e('0x0'));var DashboardItem=require(_0x2f4e('0x1'))['db'][_0x2f4e('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x2f4e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2f4e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5a01dd){return function(_0xe2eccd,_0x2277b2,_0x5a8e0f){DashboardItemEvents['emit'](_0x5a01dd+':'+_0xe2eccd['id'],_0xe2eccd);DashboardItemEvents[_0x2f4e('0x5')](_0x5a01dd,_0xe2eccd);_0x5a8e0f(null);};}for(var e in events){if(events[_0x2f4e('0x6')](e)){var event=events[e];DashboardItem[_0x2f4e('0x7')](e,emitEvent(event));}}module[_0x2f4e('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xd900=['remove','emit','hasOwnProperty','hook','events','DashboardItem','setMaxListeners','save','update'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xd900,0x112));var _0x0d90=function(_0x36975e,_0x103ce0){_0x36975e=_0x36975e-0x0;var _0x51ded9=_0xd900[_0x36975e];return _0x51ded9;};'use strict';var EventEmitter=require(_0x0d90('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x0d90('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0d90('0x2')](0x0);var events={'afterCreate':_0x0d90('0x3'),'afterUpdate':_0x0d90('0x4'),'afterDestroy':_0x0d90('0x5')};function emitEvent(_0x1427db){return function(_0x966521,_0x111b72,_0x1f982){DashboardItemEvents['emit'](_0x1427db+':'+_0x966521['id'],_0x966521);DashboardItemEvents[_0x0d90('0x6')](_0x1427db,_0x966521);_0x1f982(null);};}for(var e in events){if(events[_0x0d90('0x7')](e)){var event=events[e];DashboardItem[_0x0d90('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index a0b21b0..1878549 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 _0xe119=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x8d92a3,_0x44ef39){var _0x1dfe67=function(_0x39a7c8){while(--_0x39a7c8){_0x8d92a3['push'](_0x8d92a3['shift']());}};_0x1dfe67(++_0x44ef39);}(_0xe119,0x1c8));var _0x9e11=function(_0x48c615,_0x4cc757){_0x48c615=_0x48c615-0x0;var _0x3d9e22=_0xe119[_0x48c615];return _0x3d9e22;};'use strict';var _=require(_0x9e11('0x0'));var util=require(_0x9e11('0x1'));var logger=require(_0x9e11('0x2'))(_0x9e11('0x3'));var moment=require(_0x9e11('0x4'));var BPromise=require(_0x9e11('0x5'));var rp=require(_0x9e11('0x6'));var fs=require('fs');var path=require(_0x9e11('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9e11('0x8'));module[_0x9e11('0x9')]=function(_0x280be0,_0x1f5d91){return _0x280be0[_0x9e11('0xa')](_0x9e11('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b0a=['define','DashboardItem','dashboard_items','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x246227,_0x12bfcb){var _0x37bd4a=function(_0x4670f4){while(--_0x4670f4){_0x246227['push'](_0x246227['shift']());}};_0x37bd4a(++_0x12bfcb);}(_0x2b0a,0x73));var _0xa2b0=function(_0x9303f1,_0x4bdbac){_0x9303f1=_0x9303f1-0x0;var _0x144ffc=_0x2b0a[_0x9303f1];return _0x144ffc;};'use strict';var _=require(_0xa2b0('0x0'));var util=require(_0xa2b0('0x1'));var logger=require(_0xa2b0('0x2'))('api');var moment=require(_0xa2b0('0x3'));var BPromise=require(_0xa2b0('0x4'));var rp=require(_0xa2b0('0x5'));var fs=require('fs');var path=require(_0xa2b0('0x6'));var rimraf=require(_0xa2b0('0x7'));var config=require(_0xa2b0('0x8'));var attributes=require(_0xa2b0('0x9'));module[_0xa2b0('0xa')]=function(_0x293b0e,_0x485b7d){return _0x293b0e[_0xa2b0('0xb')](_0xa2b0('0xc'),attributes,{'tableName':_0xa2b0('0xd'),'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 0ea9db6..095819b 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 _0x44af=['then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x291a25,_0x31ae01){var _0x380fab=function(_0x205298){while(--_0x205298){_0x291a25['push'](_0x291a25['shift']());}};_0x380fab(++_0x31ae01);}(_0x44af,0x184));var _0xf44a=function(_0x17eba5,_0x434f32){_0x17eba5=_0x17eba5-0x0;var _0x1aa6f1=_0x44af[_0x17eba5];return _0x1aa6f1;};'use strict';var _=require(_0xf44a('0x0'));var util=require(_0xf44a('0x1'));var moment=require(_0xf44a('0x2'));var BPromise=require(_0xf44a('0x3'));var rs=require(_0xf44a('0x4'));var fs=require('fs');var Redis=require(_0xf44a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf44a('0x6'));var logger=require(_0xf44a('0x7'))(_0xf44a('0x8'));var config=require('../../config/environment');var jayson=require(_0xf44a('0x9'));var client=jayson[_0xf44a('0xa')][_0xf44a('0xb')]({'port':0x232a});config['redis']=_[_0xf44a('0xc')](config[_0xf44a('0xd')],{'host':_0xf44a('0xe'),'port':0x18eb});var socket=require(_0xf44a('0xf'))(new Redis(config[_0xf44a('0xd')]));require(_0xf44a('0x10'))['register'](socket);function respondWithRpcPromise(_0x36a69b,_0x391897,_0x1abb3a){return new BPromise(function(_0x136cab,_0xd3d96d){return client['request'](_0x36a69b,_0x1abb3a)[_0xf44a('0x11')](function(_0x2cd362){logger[_0xf44a('0x12')](_0xf44a('0x13'),_0x391897,'request\x20sent');logger[_0xf44a('0x14')](_0xf44a('0x15'),_0x391897,'request\x20sent',JSON[_0xf44a('0x16')](_0x2cd362));if(_0x2cd362[_0xf44a('0x17')]){if(_0x2cd362[_0xf44a('0x17')][_0xf44a('0x18')]===0x1f4){logger[_0xf44a('0x17')](_0xf44a('0x13'),_0x391897,_0x2cd362[_0xf44a('0x17')]['message']);return _0xd3d96d(_0x2cd362[_0xf44a('0x17')]['message']);}logger[_0xf44a('0x17')](_0xf44a('0x13'),_0x391897,_0x2cd362[_0xf44a('0x17')][_0xf44a('0x19')]);return _0x136cab(_0x2cd362['error'][_0xf44a('0x19')]);}else{logger[_0xf44a('0x12')](_0xf44a('0x13'),_0x391897,'request\x20sent');_0x136cab(_0x2cd362['result'][_0xf44a('0x19')]);}})[_0xf44a('0x1a')](function(_0x5b2ab1){logger[_0xf44a('0x17')]('DashboardItem,\x20%s,\x20%s',_0x391897,_0x5b2ab1);_0xd3d96d(_0x5b2ab1);});});} \ No newline at end of file +var _0x3014=['randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','info','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3014,0x19d));var _0x4301=function(_0x31eb23,_0x43bc07){_0x31eb23=_0x31eb23-0x0;var _0x433c79=_0x3014[_0x31eb23];return _0x433c79;};'use strict';var _=require('lodash');var util=require(_0x4301('0x0'));var moment=require(_0x4301('0x1'));var BPromise=require(_0x4301('0x2'));var rs=require(_0x4301('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4301('0x4'))(_0x4301('0x5'));var config=require(_0x4301('0x6'));var jayson=require(_0x4301('0x7'));var client=jayson[_0x4301('0x8')][_0x4301('0x9')]({'port':0x232a});config['redis']=_[_0x4301('0xa')](config[_0x4301('0xb')],{'host':_0x4301('0xc'),'port':0x18eb});var socket=require(_0x4301('0xd'))(new Redis(config[_0x4301('0xb')]));require(_0x4301('0xe'))['register'](socket);function respondWithRpcPromise(_0x3c058d,_0x4a5f1f,_0x5eb5ce){return new BPromise(function(_0x50e289,_0x1181ac){return client[_0x4301('0xf')](_0x3c058d,_0x5eb5ce)['then'](function(_0x31d0b7){logger[_0x4301('0x10')]('DashboardItem,\x20%s,\x20%s',_0x4a5f1f,'request\x20sent');logger[_0x4301('0x11')](_0x4301('0x12'),_0x4a5f1f,_0x4301('0x13'),JSON['stringify'](_0x31d0b7));if(_0x31d0b7[_0x4301('0x14')]){if(_0x31d0b7[_0x4301('0x14')][_0x4301('0x15')]===0x1f4){logger[_0x4301('0x14')](_0x4301('0x16'),_0x4a5f1f,_0x31d0b7[_0x4301('0x14')][_0x4301('0x17')]);return _0x1181ac(_0x31d0b7['error'][_0x4301('0x17')]);}logger[_0x4301('0x14')](_0x4301('0x16'),_0x4a5f1f,_0x31d0b7['error'][_0x4301('0x17')]);return _0x50e289(_0x31d0b7[_0x4301('0x14')][_0x4301('0x17')]);}else{logger[_0x4301('0x10')](_0x4301('0x16'),_0x4a5f1f,_0x4301('0x13'));_0x50e289(_0x31d0b7[_0x4301('0x18')][_0x4301('0x17')]);}})[_0x4301('0x19')](function(_0x20f5c7){logger[_0x4301('0x14')](_0x4301('0x16'),_0x4a5f1f,_0x20f5c7);_0x1181ac(_0x20f5c7);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 82d6470..eef902c 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 _0xb379=['remove','update','emit','removeListener','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x11ebc8,_0x3e5e12){var _0x9ab69d=function(_0xfce6ac){while(--_0xfce6ac){_0x11ebc8['push'](_0x11ebc8['shift']());}};_0x9ab69d(++_0x3e5e12);}(_0xb379,0x18e));var _0x9b37=function(_0x431611,_0x3a439f){_0x431611=_0x431611-0x0;var _0x37a192=_0xb379[_0x431611];return _0x37a192;};'use strict';var DashboardItemEvents=require(_0x9b37('0x0'));var events=[_0x9b37('0x1'),_0x9b37('0x2'),_0x9b37('0x3')];function createListener(_0x1daab5,_0x342a41){return function(_0x8f4c87){_0x342a41[_0x9b37('0x4')](_0x1daab5,_0x8f4c87);};}function removeListener(_0x5c5db5,_0x161139){return function(){DashboardItemEvents[_0x9b37('0x5')](_0x5c5db5,_0x161139);};}exports['register']=function(_0x1d8dd1){for(var _0x3bf8ac=0x0,_0x123692=events[_0x9b37('0x6')];_0x3bf8ac<_0x123692;_0x3bf8ac++){var _0x3b032d=events[_0x3bf8ac];var _0x4c7f31=createListener(_0x9b37('0x7')+_0x3b032d,_0x1d8dd1);DashboardItemEvents['on'](_0x3b032d,_0x4c7f31);}}; \ No newline at end of file +var _0x08b3=['update','emit','register','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x2ed242,_0x2769cb){var _0x30496c=function(_0x16d779){while(--_0x16d779){_0x2ed242['push'](_0x2ed242['shift']());}};_0x30496c(++_0x2769cb);}(_0x08b3,0x125));var _0x308b=function(_0x579321,_0x2d4bc0){_0x579321=_0x579321-0x0;var _0x4cfdde=_0x08b3[_0x579321];return _0x4cfdde;};'use strict';var DashboardItemEvents=require(_0x308b('0x0'));var events=[_0x308b('0x1'),_0x308b('0x2'),_0x308b('0x3')];function createListener(_0x309438,_0x33ca8f){return function(_0x4daae8){_0x33ca8f[_0x308b('0x4')](_0x309438,_0x4daae8);};}function removeListener(_0x167c63,_0x378f2b){return function(){DashboardItemEvents['removeListener'](_0x167c63,_0x378f2b);};}exports[_0x308b('0x5')]=function(_0x1fd36d){for(var _0xfb172d=0x0,_0x2589d4=events[_0x308b('0x6')];_0xfb172d<_0x2589d4;_0xfb172d++){var _0x4813b5=events[_0xfb172d];var _0x5da127=createListener(_0x308b('0x7')+_0x4813b5,_0x1fd36d);DashboardItemEvents['on'](_0x4813b5,_0x5da127);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 8567829..037baec 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 _0x2bf9=['express','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x4c73c4,_0x1090cb){var _0x56c316=function(_0xb1e181){while(--_0xb1e181){_0x4c73c4['push'](_0x4c73c4['shift']());}};_0x56c316(++_0x1090cb);}(_0x2bf9,0xfd));var _0x92bf=function(_0x4fde83,_0x2d9011){_0x4fde83=_0x4fde83-0x0;var _0x3b33e3=_0x2bf9[_0x4fde83];return _0x3b33e3;};'use strict';var multer=require('multer');var util=require(_0x92bf('0x0'));var path=require(_0x92bf('0x1'));var timeout=require(_0x92bf('0x2'));var express=require(_0x92bf('0x3'));var router=express['Router']();var fs_extra=require(_0x92bf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x92bf('0x5'));var config=require(_0x92bf('0x6'));var controller=require(_0x92bf('0x7'));router[_0x92bf('0x8')](_0x92bf('0x9'),auth[_0x92bf('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x92bf('0xb')]);router[_0x92bf('0xc')](_0x92bf('0x9'),auth['isAuthenticated'](),controller[_0x92bf('0xd')]);router[_0x92bf('0xe')]('/:id',auth[_0x92bf('0xa')](),controller[_0x92bf('0xf')]);module['exports']=router; \ No newline at end of file +var _0xef47=['exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','show','isAuthenticated','create','update','delete','destroy'];(function(_0x53b78c,_0x5adccb){var _0x34e5b4=function(_0x54c143){while(--_0x54c143){_0x53b78c['push'](_0x53b78c['shift']());}};_0x34e5b4(++_0x5adccb);}(_0xef47,0x91));var _0x7ef4=function(_0x2de716,_0x4145df){_0x2de716=_0x2de716-0x0;var _0x304b05=_0xef47[_0x2de716];return _0x304b05;};'use strict';var multer=require('multer');var util=require(_0x7ef4('0x0'));var path=require('path');var timeout=require(_0x7ef4('0x1'));var express=require('express');var router=express[_0x7ef4('0x2')]();var fs_extra=require(_0x7ef4('0x3'));var auth=require(_0x7ef4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7ef4('0x5'));var controller=require(_0x7ef4('0x6'));router[_0x7ef4('0x7')](_0x7ef4('0x8'),auth['isAuthenticated'](),controller[_0x7ef4('0x9')]);router['post']('/',auth[_0x7ef4('0xa')](),controller[_0x7ef4('0xb')]);router['put'](_0x7ef4('0x8'),auth[_0x7ef4('0xa')](),controller[_0x7ef4('0xc')]);router[_0x7ef4('0xd')](_0x7ef4('0x8'),auth[_0x7ef4('0xa')](),controller[_0x7ef4('0xe')]);module[_0x7ef4('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 e34cdb2..59f5862 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 _0xfc8d=['first','sequelize','exports','STRING','ENUM','second','third'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfc8d,0xfd));var _0xdfc8=function(_0x44e7b9,_0xf7f5cc){_0x44e7b9=_0x44e7b9-0x0;var _0x1de7ac=_0xfc8d[_0x44e7b9];return _0x1de7ac;};'use strict';var Sequelize=require(_0xdfc8('0x0'));module[_0xdfc8('0x1')]={'name':{'type':Sequelize[_0xdfc8('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xdfc8('0x3')]('first',_0xdfc8('0x4'),_0xdfc8('0x5')),'allowNull':![],'defaultValue':_0xdfc8('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x51ec=['sequelize','STRING','ENUM','second'];(function(_0x1cd7f1,_0x44236f){var _0x5adfde=function(_0x409537){while(--_0x409537){_0x1cd7f1['push'](_0x1cd7f1['shift']());}};_0x5adfde(++_0x44236f);}(_0x51ec,0x14c));var _0xc51e=function(_0x28e576,_0x8110d4){_0x28e576=_0x28e576-0x0;var _0x5bb39c=_0x51ec[_0x28e576];return _0x5bb39c;};'use strict';var Sequelize=require(_0xc51e('0x0'));module['exports']={'name':{'type':Sequelize[_0xc51e('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xc51e('0x2')]('first',_0xc51e('0x3'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xc51e('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 1e8844d..272d726 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 _0xe7db=['stack','name','index','map','Disposition','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','Dispositions','UserProfileResource','then','error'];(function(_0x3dc93c,_0xfd8a27){var _0x2402c8=function(_0x440744){while(--_0x440744){_0x3dc93c['push'](_0x3dc93c['shift']());}};_0x2402c8(++_0xfd8a27);}(_0xe7db,0x1bd));var _0xbe7d=function(_0x163691,_0x3d10c4){_0x163691=_0x163691-0x0;var _0x543ae5=_0xe7db[_0x163691];return _0x543ae5;};'use strict';var emlformat=require(_0xbe7d('0x0'));var rimraf=require(_0xbe7d('0x1'));var zipdir=require(_0xbe7d('0x2'));var jsonpatch=require(_0xbe7d('0x3'));var rp=require('request-promise');var moment=require(_0xbe7d('0x4'));var BPromise=require(_0xbe7d('0x5'));var Mustache=require(_0xbe7d('0x6'));var util=require(_0xbe7d('0x7'));var path=require('path');var sox=require(_0xbe7d('0x8'));var csv=require(_0xbe7d('0x9'));var ejs=require(_0xbe7d('0xa'));var fs=require('fs');var fs_extra=require(_0xbe7d('0xb'));var _=require('lodash');var squel=require(_0xbe7d('0xc'));var crypto=require('crypto');var jsforce=require(_0xbe7d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbe7d('0x9'));var querystring=require(_0xbe7d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbe7d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe7d('0x10'));var logger=require(_0xbe7d('0x11'))('api');var utils=require(_0xbe7d('0x12'));var config=require(_0xbe7d('0x13'));var licenseUtil=require(_0xbe7d('0x14'));var db=require(_0xbe7d('0x15'))['db'];function respondWithStatusCode(_0x1ee9b8,_0x254a90){_0x254a90=_0x254a90||0xcc;return function(_0x3eb5be){if(_0x3eb5be){return _0x1ee9b8[_0xbe7d('0x16')](_0x254a90);}return _0x1ee9b8[_0xbe7d('0x17')](_0x254a90)[_0xbe7d('0x18')]();};}function respondWithResult(_0x57b464,_0x2e70a4){_0x2e70a4=_0x2e70a4||0xc8;return function(_0x308238){if(_0x308238){return _0x57b464[_0xbe7d('0x17')](_0x2e70a4)[_0xbe7d('0x19')](_0x308238);}};}function respondWithFilteredResult(_0xcc8aae,_0x16c04b){return function(_0xd8c2c9){if(_0xd8c2c9){var _0x462c9b=typeof _0x16c04b[_0xbe7d('0x1a')]===_0xbe7d('0x1b')&&typeof _0x16c04b[_0xbe7d('0x1c')]==='undefined';var _0x3509e7=_0xd8c2c9[_0xbe7d('0x1d')];var _0x45444f=_0x462c9b?0x0:_0x16c04b['offset'];var _0x3f2caa=_0x462c9b?_0xd8c2c9[_0xbe7d('0x1d')]:_0x16c04b[_0xbe7d('0x1a')]+_0x16c04b['limit'];var _0x140e0d;if(_0x3f2caa>=_0x3509e7){_0x3f2caa=_0x3509e7;_0x140e0d=0xc8;}else{_0x140e0d=0xce;}_0xcc8aae[_0xbe7d('0x17')](_0x140e0d);return _0xcc8aae[_0xbe7d('0x1e')](_0xbe7d('0x1f'),_0x45444f+'-'+_0x3f2caa+'/'+_0x3509e7)[_0xbe7d('0x19')](_0xd8c2c9);}return null;};}function patchUpdates(_0x15dfc5){return function(_0x3cb5d6){try{jsonpatch['apply'](_0x3cb5d6,_0x15dfc5,!![]);}catch(_0xbdb4a4){return BPromise[_0xbe7d('0x20')](_0xbdb4a4);}return _0x3cb5d6[_0xbe7d('0x21')]();};}function saveUpdates(_0x55a191,_0x56d6f8){return function(_0x2cd763){if(_0x2cd763){return _0x2cd763[_0xbe7d('0x22')](_0x55a191)['then'](function(_0x5085f0){return _0x5085f0;});}return null;};}function removeEntity(_0xd4a5f6,_0x291c69){return function(_0x2f9499){if(_0x2f9499){return _0x2f9499[_0xbe7d('0x23')]()['then'](function(){var _0x486f33=_0x2f9499[_0xbe7d('0x24')]({'plain':!![]});var _0x3b8fb0=_0xbe7d('0x25');return db[_0xbe7d('0x26')][_0xbe7d('0x23')]({'where':{'type':_0x3b8fb0,'resourceId':_0x486f33['id']}})[_0xbe7d('0x27')](function(){return _0x2f9499;});})['then'](function(){_0xd4a5f6[_0xbe7d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53843c,_0xd07785){return function(_0x5a99da){if(!_0x5a99da){_0x53843c[_0xbe7d('0x16')](0x194);}return _0x5a99da;};}function handleError(_0x2d823c,_0x136643){_0x136643=_0x136643||0x1f4;return function(_0x2acfb3){logger[_0xbe7d('0x28')](_0x2acfb3[_0xbe7d('0x29')]);if(_0x2acfb3[_0xbe7d('0x2a')]){delete _0x2acfb3[_0xbe7d('0x2a')];}_0x2d823c[_0xbe7d('0x17')](_0x136643)['send'](_0x2acfb3);};}exports[_0xbe7d('0x2b')]=function(_0x4b4975,_0x283935){var _0x2e7698={},_0x52fd59={},_0x191c0b={'count':0x0,'rows':[]};var _0x596088=_[_0xbe7d('0x2c')](db[_0xbe7d('0x2d')][_0xbe7d('0x2e')],function(_0x59121e){return{'name':_0x59121e[_0xbe7d('0x2f')],'type':_0x59121e[_0xbe7d('0x30')]['key']};});_0x52fd59[_0xbe7d('0x31')]=_[_0xbe7d('0x2c')](_0x596088,'name');_0x52fd59[_0xbe7d('0x32')]=_[_0xbe7d('0x33')](_0x4b4975[_0xbe7d('0x32')]);_0x52fd59[_0xbe7d('0x34')]=_[_0xbe7d('0x35')](_0x52fd59[_0xbe7d('0x31')],_0x52fd59[_0xbe7d('0x32')]);_0x2e7698[_0xbe7d('0x36')]=_[_0xbe7d('0x35')](_0x52fd59[_0xbe7d('0x31')],qs[_0xbe7d('0x37')](_0x4b4975[_0xbe7d('0x32')]['fields']));_0x2e7698[_0xbe7d('0x36')]=_0x2e7698[_0xbe7d('0x36')][_0xbe7d('0x38')]?_0x2e7698[_0xbe7d('0x36')]:_0x52fd59[_0xbe7d('0x31')];if(!_0x4b4975[_0xbe7d('0x32')]['hasOwnProperty'](_0xbe7d('0x39'))){_0x2e7698[_0xbe7d('0x1c')]=qs[_0xbe7d('0x1c')](_0x4b4975['query']['limit']);_0x2e7698['offset']=qs[_0xbe7d('0x1a')](_0x4b4975[_0xbe7d('0x32')][_0xbe7d('0x1a')]);}_0x2e7698[_0xbe7d('0x3a')]=qs[_0xbe7d('0x3b')](_0x4b4975[_0xbe7d('0x32')][_0xbe7d('0x3b')]);_0x2e7698[_0xbe7d('0x3c')]=qs[_0xbe7d('0x34')](_['pick'](_0x4b4975[_0xbe7d('0x32')],_0x52fd59[_0xbe7d('0x34')]),_0x596088);if(_0x4b4975[_0xbe7d('0x32')][_0xbe7d('0x3d')]){_0x2e7698[_0xbe7d('0x3c')]=_[_0xbe7d('0x3e')](_0x2e7698[_0xbe7d('0x3c')],{'$or':_['map'](_0x596088,function(_0x3b8b46){if(_0x3b8b46[_0xbe7d('0x30')]!==_0xbe7d('0x3f')){var _0x515c7c={};_0x515c7c[_0x3b8b46['name']]={'$like':'%'+_0x4b4975[_0xbe7d('0x32')]['filter']+'%'};return _0x515c7c;}})});}_0x2e7698=_[_0xbe7d('0x3e')]({},_0x2e7698,_0x4b4975[_0xbe7d('0x40')]);var _0x207cac={'where':_0x2e7698[_0xbe7d('0x3c')]};return db[_0xbe7d('0x2d')][_0xbe7d('0x1d')](_0x207cac)[_0xbe7d('0x27')](function(_0x248b19){_0x191c0b['count']=_0x248b19;if(_0x4b4975['query'][_0xbe7d('0x41')]){_0x2e7698[_0xbe7d('0x42')]=[{'all':!![]}];}return db[_0xbe7d('0x2d')][_0xbe7d('0x43')](_0x2e7698);})[_0xbe7d('0x27')](function(_0x224a2a){_0x191c0b[_0xbe7d('0x44')]=_0x224a2a;return _0x191c0b;})[_0xbe7d('0x27')](respondWithFilteredResult(_0x283935,_0x2e7698))['catch'](handleError(_0x283935,null));};exports[_0xbe7d('0x45')]=function(_0x26406b,_0x58582b){var _0x30e483={'raw':!![],'where':{'id':_0x26406b[_0xbe7d('0x46')]['id']}},_0x19aa18={};_0x19aa18[_0xbe7d('0x31')]=_[_0xbe7d('0x33')](db[_0xbe7d('0x2d')][_0xbe7d('0x2e')]);_0x19aa18[_0xbe7d('0x32')]=_['keys'](_0x26406b['query']);_0x19aa18[_0xbe7d('0x34')]=_['intersection'](_0x19aa18[_0xbe7d('0x31')],_0x19aa18['query']);_0x30e483[_0xbe7d('0x36')]=_[_0xbe7d('0x35')](_0x19aa18[_0xbe7d('0x31')],qs[_0xbe7d('0x37')](_0x26406b[_0xbe7d('0x32')][_0xbe7d('0x37')]));_0x30e483[_0xbe7d('0x36')]=_0x30e483['attributes'][_0xbe7d('0x38')]?_0x30e483[_0xbe7d('0x36')]:_0x19aa18['model'];if(_0x26406b[_0xbe7d('0x32')][_0xbe7d('0x41')]){_0x30e483[_0xbe7d('0x42')]=[{'all':!![]}];}_0x30e483=_['merge']({},_0x30e483,_0x26406b[_0xbe7d('0x40')]);return db[_0xbe7d('0x2d')][_0xbe7d('0x47')](_0x30e483)[_0xbe7d('0x27')](handleEntityNotFound(_0x58582b,null))[_0xbe7d('0x27')](respondWithResult(_0x58582b,null))[_0xbe7d('0x48')](handleError(_0x58582b,null));};exports[_0xbe7d('0x49')]=function(_0xbdfeea,_0x4e8427){return db[_0xbe7d('0x2d')][_0xbe7d('0x49')](_0xbdfeea['body'],{})[_0xbe7d('0x27')](function(_0x42181e){var _0x4f5c66=_0xbdfeea[_0xbe7d('0x4a')][_0xbe7d('0x24')]({'plain':!![]});if(!_0x4f5c66)throw new Error(_0xbe7d('0x4b'));if(_0x4f5c66[_0xbe7d('0x4c')]===_0xbe7d('0x4a')){var _0x292be2=_0x42181e[_0xbe7d('0x24')]({'plain':!![]});var _0x3ce120=_0xbe7d('0x25');return db[_0xbe7d('0x4d')][_0xbe7d('0x47')]({'where':{'name':_0x3ce120,'userProfileId':_0x4f5c66[_0xbe7d('0x4e')]},'raw':!![]})[_0xbe7d('0x27')](function(_0x1a3374){if(_0x1a3374&&_0x1a3374['autoAssociation']===0x0){return db[_0xbe7d('0x26')][_0xbe7d('0x49')]({'name':_0x292be2[_0xbe7d('0x2a')],'resourceId':_0x292be2['id'],'type':_0x1a3374[_0xbe7d('0x2a')],'sectionId':_0x1a3374['id']},{})[_0xbe7d('0x27')](function(){return _0x42181e;});}else{return _0x42181e;}})[_0xbe7d('0x48')](function(_0x29e121){logger['error'](_0xbe7d('0x4f'),_0x29e121);throw _0x29e121;});}return _0x42181e;})[_0xbe7d('0x27')](respondWithResult(_0x4e8427,0xc9))['catch'](handleError(_0x4e8427,null));};exports['update']=function(_0x39c6a4,_0x33ad59){if(_0x39c6a4['body']['id']){delete _0x39c6a4[_0xbe7d('0x50')]['id'];}return db['Disposition'][_0xbe7d('0x47')]({'where':{'id':_0x39c6a4[_0xbe7d('0x46')]['id']}})['then'](handleEntityNotFound(_0x33ad59,null))['then'](saveUpdates(_0x39c6a4[_0xbe7d('0x50')],null))[_0xbe7d('0x27')](respondWithResult(_0x33ad59,null))[_0xbe7d('0x48')](handleError(_0x33ad59,null));};exports[_0xbe7d('0x23')]=function(_0x2939f9,_0x48b8a5){return db[_0xbe7d('0x2d')][_0xbe7d('0x47')]({'where':{'id':_0x2939f9[_0xbe7d('0x46')]['id']}})[_0xbe7d('0x27')](handleEntityNotFound(_0x48b8a5,null))['then'](removeEntity(_0x48b8a5,null))[_0xbe7d('0x48')](handleError(_0x48b8a5,null));}; \ No newline at end of file +var _0xc77b=['model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','Disposition','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','Dispositions','UserProfileResource','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xc77b,0x187));var _0xbc77=function(_0x5610ba,_0x35f90b){_0x5610ba=_0x5610ba-0x0;var _0x22cb20=_0xc77b[_0x5610ba];return _0x22cb20;};'use strict';var emlformat=require(_0xbc77('0x0'));var rimraf=require(_0xbc77('0x1'));var zipdir=require(_0xbc77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc77('0x3'));var moment=require(_0xbc77('0x4'));var BPromise=require(_0xbc77('0x5'));var Mustache=require(_0xbc77('0x6'));var util=require(_0xbc77('0x7'));var path=require(_0xbc77('0x8'));var sox=require(_0xbc77('0x9'));var csv=require(_0xbc77('0xa'));var ejs=require(_0xbc77('0xb'));var fs=require('fs');var fs_extra=require(_0xbc77('0xc'));var _=require(_0xbc77('0xd'));var squel=require(_0xbc77('0xe'));var crypto=require(_0xbc77('0xf'));var jsforce=require(_0xbc77('0x10'));var deskjs=require(_0xbc77('0x11'));var toCsv=require('to-csv');var querystring=require(_0xbc77('0x12'));var Papa=require(_0xbc77('0x13'));var Redis=require('ioredis');var authService=require(_0xbc77('0x14'));var qs=require(_0xbc77('0x15'));var as=require(_0xbc77('0x16'));var hardwareService=require(_0xbc77('0x17'));var logger=require(_0xbc77('0x18'))(_0xbc77('0x19'));var utils=require(_0xbc77('0x1a'));var config=require(_0xbc77('0x1b'));var licenseUtil=require(_0xbc77('0x1c'));var db=require(_0xbc77('0x1d'))['db'];function respondWithStatusCode(_0xb742f5,_0x12077f){_0x12077f=_0x12077f||0xcc;return function(_0x54edbc){if(_0x54edbc){return _0xb742f5['sendStatus'](_0x12077f);}return _0xb742f5[_0xbc77('0x1e')](_0x12077f)['end']();};}function respondWithResult(_0x12e266,_0x59c8a1){_0x59c8a1=_0x59c8a1||0xc8;return function(_0x203364){if(_0x203364){return _0x12e266['status'](_0x59c8a1)[_0xbc77('0x1f')](_0x203364);}};}function respondWithFilteredResult(_0x1fd1cb,_0x34c9a2){return function(_0x1ced81){if(_0x1ced81){var _0x350fc3=typeof _0x34c9a2[_0xbc77('0x20')]===_0xbc77('0x21')&&typeof _0x34c9a2[_0xbc77('0x22')]==='undefined';var _0x1ec473=_0x1ced81[_0xbc77('0x23')];var _0xd21dde=_0x350fc3?0x0:_0x34c9a2['offset'];var _0x4f77d0=_0x350fc3?_0x1ced81['count']:_0x34c9a2[_0xbc77('0x20')]+_0x34c9a2[_0xbc77('0x22')];var _0x5f5d17;if(_0x4f77d0>=_0x1ec473){_0x4f77d0=_0x1ec473;_0x5f5d17=0xc8;}else{_0x5f5d17=0xce;}_0x1fd1cb[_0xbc77('0x1e')](_0x5f5d17);return _0x1fd1cb[_0xbc77('0x24')](_0xbc77('0x25'),_0xd21dde+'-'+_0x4f77d0+'/'+_0x1ec473)[_0xbc77('0x1f')](_0x1ced81);}return null;};}function patchUpdates(_0x5e68d2){return function(_0x54677a){try{jsonpatch['apply'](_0x54677a,_0x5e68d2,!![]);}catch(_0x597cd7){return BPromise['reject'](_0x597cd7);}return _0x54677a['save']();};}function saveUpdates(_0xd186bf,_0x1dd76c){return function(_0x23a83a){if(_0x23a83a){return _0x23a83a[_0xbc77('0x26')](_0xd186bf)[_0xbc77('0x27')](function(_0x101e92){return _0x101e92;});}return null;};}function removeEntity(_0xd6b7aa,_0x1ddd98){return function(_0x5e5f82){if(_0x5e5f82){return _0x5e5f82[_0xbc77('0x28')]()[_0xbc77('0x27')](function(){var _0x3fcc3e=_0x5e5f82[_0xbc77('0x29')]({'plain':!![]});var _0x1df2bb=_0xbc77('0x2a');return db[_0xbc77('0x2b')][_0xbc77('0x28')]({'where':{'type':_0x1df2bb,'resourceId':_0x3fcc3e['id']}})[_0xbc77('0x27')](function(){return _0x5e5f82;});})[_0xbc77('0x27')](function(){_0xd6b7aa[_0xbc77('0x1e')](0xcc)[_0xbc77('0x2c')]();});}};}function handleEntityNotFound(_0x503308,_0x49eede){return function(_0x29daca){if(!_0x29daca){_0x503308[_0xbc77('0x2d')](0x194);}return _0x29daca;};}function handleError(_0x5c29e8,_0x57f8e1){_0x57f8e1=_0x57f8e1||0x1f4;return function(_0x189463){logger['error'](_0x189463[_0xbc77('0x2e')]);if(_0x189463[_0xbc77('0x2f')]){delete _0x189463['name'];}_0x5c29e8[_0xbc77('0x1e')](_0x57f8e1)[_0xbc77('0x30')](_0x189463);};}exports[_0xbc77('0x31')]=function(_0x60ab94,_0x59f056){var _0x2f2683={},_0x15819c={},_0x5c1d09={'count':0x0,'rows':[]};var _0x558fd8=_[_0xbc77('0x32')](db['Disposition'][_0xbc77('0x33')],function(_0x4444a7){return{'name':_0x4444a7[_0xbc77('0x34')],'type':_0x4444a7['type'][_0xbc77('0x35')]};});_0x15819c[_0xbc77('0x36')]=_[_0xbc77('0x32')](_0x558fd8,'name');_0x15819c[_0xbc77('0x37')]=_[_0xbc77('0x38')](_0x60ab94[_0xbc77('0x37')]);_0x15819c['filters']=_[_0xbc77('0x39')](_0x15819c['model'],_0x15819c['query']);_0x2f2683[_0xbc77('0x3a')]=_[_0xbc77('0x39')](_0x15819c[_0xbc77('0x36')],qs[_0xbc77('0x3b')](_0x60ab94[_0xbc77('0x37')][_0xbc77('0x3b')]));_0x2f2683['attributes']=_0x2f2683[_0xbc77('0x3a')]['length']?_0x2f2683['attributes']:_0x15819c['model'];if(!_0x60ab94['query'][_0xbc77('0x3c')]('nolimit')){_0x2f2683['limit']=qs[_0xbc77('0x22')](_0x60ab94[_0xbc77('0x37')][_0xbc77('0x22')]);_0x2f2683['offset']=qs['offset'](_0x60ab94[_0xbc77('0x37')][_0xbc77('0x20')]);}_0x2f2683[_0xbc77('0x3d')]=qs[_0xbc77('0x3e')](_0x60ab94[_0xbc77('0x37')][_0xbc77('0x3e')]);_0x2f2683[_0xbc77('0x3f')]=qs[_0xbc77('0x40')](_[_0xbc77('0x41')](_0x60ab94['query'],_0x15819c['filters']),_0x558fd8);if(_0x60ab94['query'][_0xbc77('0x42')]){_0x2f2683[_0xbc77('0x3f')]=_[_0xbc77('0x43')](_0x2f2683['where'],{'$or':_[_0xbc77('0x32')](_0x558fd8,function(_0x36daf5){if(_0x36daf5[_0xbc77('0x44')]!==_0xbc77('0x45')){var _0xbb4de7={};_0xbb4de7[_0x36daf5[_0xbc77('0x2f')]]={'$like':'%'+_0x60ab94[_0xbc77('0x37')][_0xbc77('0x42')]+'%'};return _0xbb4de7;}})});}_0x2f2683=_['merge']({},_0x2f2683,_0x60ab94[_0xbc77('0x46')]);var _0x52c512={'where':_0x2f2683['where']};return db[_0xbc77('0x47')][_0xbc77('0x23')](_0x52c512)[_0xbc77('0x27')](function(_0x485873){_0x5c1d09['count']=_0x485873;if(_0x60ab94[_0xbc77('0x37')][_0xbc77('0x48')]){_0x2f2683[_0xbc77('0x49')]=[{'all':!![]}];}return db[_0xbc77('0x47')][_0xbc77('0x4a')](_0x2f2683);})[_0xbc77('0x27')](function(_0x16d371){_0x5c1d09[_0xbc77('0x4b')]=_0x16d371;return _0x5c1d09;})['then'](respondWithFilteredResult(_0x59f056,_0x2f2683))[_0xbc77('0x4c')](handleError(_0x59f056,null));};exports[_0xbc77('0x4d')]=function(_0x485b03,_0x106647){var _0x3ba49d={'raw':!![],'where':{'id':_0x485b03[_0xbc77('0x4e')]['id']}},_0x2e0138={};_0x2e0138[_0xbc77('0x36')]=_[_0xbc77('0x38')](db['Disposition']['rawAttributes']);_0x2e0138[_0xbc77('0x37')]=_[_0xbc77('0x38')](_0x485b03[_0xbc77('0x37')]);_0x2e0138[_0xbc77('0x40')]=_[_0xbc77('0x39')](_0x2e0138[_0xbc77('0x36')],_0x2e0138['query']);_0x3ba49d[_0xbc77('0x3a')]=_[_0xbc77('0x39')](_0x2e0138[_0xbc77('0x36')],qs[_0xbc77('0x3b')](_0x485b03[_0xbc77('0x37')]['fields']));_0x3ba49d[_0xbc77('0x3a')]=_0x3ba49d[_0xbc77('0x3a')][_0xbc77('0x4f')]?_0x3ba49d['attributes']:_0x2e0138['model'];if(_0x485b03['query'][_0xbc77('0x48')]){_0x3ba49d[_0xbc77('0x49')]=[{'all':!![]}];}_0x3ba49d=_[_0xbc77('0x43')]({},_0x3ba49d,_0x485b03[_0xbc77('0x46')]);return db[_0xbc77('0x47')][_0xbc77('0x50')](_0x3ba49d)[_0xbc77('0x27')](handleEntityNotFound(_0x106647,null))[_0xbc77('0x27')](respondWithResult(_0x106647,null))[_0xbc77('0x4c')](handleError(_0x106647,null));};exports['create']=function(_0x4838df,_0x37c670){return db[_0xbc77('0x47')][_0xbc77('0x51')](_0x4838df[_0xbc77('0x52')],{})[_0xbc77('0x27')](function(_0x2bee6a){var _0x1ab8e2=_0x4838df[_0xbc77('0x53')][_0xbc77('0x29')]({'plain':!![]});if(!_0x1ab8e2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ab8e2[_0xbc77('0x54')]===_0xbc77('0x53')){var _0x306120=_0x2bee6a['get']({'plain':!![]});var _0x58e9b6=_0xbc77('0x2a');return db[_0xbc77('0x55')]['find']({'where':{'name':_0x58e9b6,'userProfileId':_0x1ab8e2[_0xbc77('0x56')]},'raw':!![]})[_0xbc77('0x27')](function(_0x3737ea){if(_0x3737ea&&_0x3737ea['autoAssociation']===0x0){return db[_0xbc77('0x2b')][_0xbc77('0x51')]({'name':_0x306120['name'],'resourceId':_0x306120['id'],'type':_0x3737ea['name'],'sectionId':_0x3737ea['id']},{})[_0xbc77('0x27')](function(){return _0x2bee6a;});}else{return _0x2bee6a;}})[_0xbc77('0x4c')](function(_0x2b0056){logger[_0xbc77('0x57')](_0xbc77('0x58'),_0x2b0056);throw _0x2b0056;});}return _0x2bee6a;})['then'](respondWithResult(_0x37c670,0xc9))[_0xbc77('0x4c')](handleError(_0x37c670,null));};exports[_0xbc77('0x26')]=function(_0x25effc,_0x3fee67){if(_0x25effc[_0xbc77('0x52')]['id']){delete _0x25effc[_0xbc77('0x52')]['id'];}return db[_0xbc77('0x47')][_0xbc77('0x50')]({'where':{'id':_0x25effc[_0xbc77('0x4e')]['id']}})[_0xbc77('0x27')](handleEntityNotFound(_0x3fee67,null))[_0xbc77('0x27')](saveUpdates(_0x25effc['body'],null))[_0xbc77('0x27')](respondWithResult(_0x3fee67,null))[_0xbc77('0x4c')](handleError(_0x3fee67,null));};exports['destroy']=function(_0x1e9283,_0x5acd4b){return db[_0xbc77('0x47')]['find']({'where':{'id':_0x1e9283[_0xbc77('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5acd4b,null))[_0xbc77('0x27')](removeEntity(_0x5acd4b,null))['catch'](handleError(_0x5acd4b,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index fa9fa38..688fd73 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 _0xd5dc=['name_fax','FaxAccountId','OpenchannelAccountId','WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise','rimraf','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms'];(function(_0x49fc9f,_0x2d91fe){var _0x25f36f=function(_0x4d48fd){while(--_0x4d48fd){_0x49fc9f['push'](_0x49fc9f['shift']());}};_0x25f36f(++_0x2d91fe);}(_0xd5dc,0x12f));var _0xcd5d=function(_0x33d8e4,_0x2ffb48){_0x33d8e4=_0x33d8e4-0x0;var _0x55d1f0=_0xd5dc[_0x33d8e4];return _0x55d1f0;};'use strict';var _=require(_0xcd5d('0x0'));var util=require(_0xcd5d('0x1'));var logger=require('../../config/logger')(_0xcd5d('0x2'));var moment=require(_0xcd5d('0x3'));var BPromise=require(_0xcd5d('0x4'));var rp=require(_0xcd5d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd5d('0x6'));var config=require('../../config/environment');var attributes=require(_0xcd5d('0x7'));module[_0xcd5d('0x8')]=function(_0xd9098c,_0x435c35){return _0xd9098c[_0xcd5d('0x9')]('Disposition',attributes,{'tableName':_0xcd5d('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xcd5d('0xb'),'fields':[_0xcd5d('0xc'),_0xcd5d('0xd')]},{'unique':!![],'name':_0xcd5d('0xe'),'fields':[_0xcd5d('0xc'),_0xcd5d('0xf')]},{'unique':!![],'name':_0xcd5d('0x10'),'fields':[_0xcd5d('0xc'),_0xcd5d('0x11')]},{'unique':!![],'name':_0xcd5d('0x12'),'fields':[_0xcd5d('0xc'),'SmsAccountId']},{'unique':!![],'name':_0xcd5d('0x13'),'fields':[_0xcd5d('0xc'),_0xcd5d('0x14')]},{'unique':!![],'name':'name_openchannel','fields':[_0xcd5d('0xc'),_0xcd5d('0x15')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xcd5d('0xc'),_0xcd5d('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x289e=['name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','api','moment','request-promise','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_sms','FaxAccountId'];(function(_0x486e4e,_0x4ad8c4){var _0x43d722=function(_0x169799){while(--_0x169799){_0x486e4e['push'](_0x486e4e['shift']());}};_0x43d722(++_0x4ad8c4);}(_0x289e,0xea));var _0xe289=function(_0x32fbf1,_0x10e6cf){_0x32fbf1=_0x32fbf1-0x0;var _0x52cb7d=_0x289e[_0x32fbf1];return _0x52cb7d;};'use strict';var _=require(_0xe289('0x0'));var util=require(_0xe289('0x1'));var logger=require('../../config/logger')(_0xe289('0x2'));var moment=require(_0xe289('0x3'));var BPromise=require('bluebird');var rp=require(_0xe289('0x4'));var fs=require('fs');var path=require(_0xe289('0x5'));var rimraf=require('rimraf');var config=require(_0xe289('0x6'));var attributes=require(_0xe289('0x7'));module[_0xe289('0x8')]=function(_0x14871b,_0x2096af){return _0x14871b[_0xe289('0x9')](_0xe289('0xa'),attributes,{'tableName':_0xe289('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xe289('0xc'),'fields':[_0xe289('0xd'),'ListId']},{'unique':!![],'name':_0xe289('0xe'),'fields':[_0xe289('0xd'),_0xe289('0xf')]},{'unique':!![],'name':'name_mail','fields':[_0xe289('0xd'),'MailAccountId']},{'unique':!![],'name':_0xe289('0x10'),'fields':[_0xe289('0xd'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':['name',_0xe289('0x11')]},{'unique':!![],'name':_0xe289('0x12'),'fields':[_0xe289('0xd'),_0xe289('0x13')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xe289('0xd'),_0xe289('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 65a184a..eab6fef 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(_0x14e02b,_0x13c7bd){var _0x4d9594=function(_0x22c180){while(--_0x22c180){_0x14e02b['push'](_0x14e02b['shift']());}};_0x4d9594(++_0x13c7bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x5600d9,_0x13a40f){var _0x347c94=function(_0x1915d5){while(--_0x1915d5){_0x5600d9['push'](_0x5600d9['shift']());}};_0x347c94(++_0x13a40f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 93ad800..2ba1e69 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 _0x971e=['destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x169302,_0x194227){var _0x139a23=function(_0x3e766a){while(--_0x3e766a){_0x169302['push'](_0x169302['shift']());}};_0x139a23(++_0x194227);}(_0x971e,0x80));var _0xe971=function(_0x21d535,_0x9d3bf4){_0x21d535=_0x21d535-0x0;var _0x1194c2=_0x971e[_0x21d535];return _0x1194c2;};'use strict';var multer=require('multer');var util=require(_0xe971('0x0'));var path=require(_0xe971('0x1'));var timeout=require(_0xe971('0x2'));var express=require('express');var router=express[_0xe971('0x3')]();var fs_extra=require(_0xe971('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe971('0x5'));var config=require(_0xe971('0x6'));var controller=require('./disposition.controller');router[_0xe971('0x7')]('/',auth[_0xe971('0x8')](),controller[_0xe971('0x9')]);router['get'](_0xe971('0xa'),auth[_0xe971('0x8')](),controller[_0xe971('0xb')]);router[_0xe971('0xc')]('/',auth[_0xe971('0x8')](),controller[_0xe971('0xd')]);router[_0xe971('0xe')](_0xe971('0xa'),auth[_0xe971('0x8')](),controller[_0xe971('0xf')]);router['delete'](_0xe971('0xa'),auth[_0xe971('0x8')](),controller[_0xe971('0x10')]);module[_0xe971('0x11')]=router; \ No newline at end of file +var _0x4c18=['delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','post','put','update'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x4c18,0x1b7));var _0x84c1=function(_0x36c024,_0x259bf4){_0x36c024=_0x36c024-0x0;var _0x53f5ce=_0x4c18[_0x36c024];return _0x53f5ce;};'use strict';var multer=require(_0x84c1('0x0'));var util=require(_0x84c1('0x1'));var path=require('path');var timeout=require(_0x84c1('0x2'));var express=require(_0x84c1('0x3'));var router=express[_0x84c1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x84c1('0x5'));var interaction=require(_0x84c1('0x6'));var config=require(_0x84c1('0x7'));var controller=require(_0x84c1('0x8'));router['get']('/',auth[_0x84c1('0x9')](),controller[_0x84c1('0xa')]);router[_0x84c1('0xb')](_0x84c1('0xc'),auth[_0x84c1('0x9')](),controller[_0x84c1('0xd')]);router[_0x84c1('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x84c1('0xf')](_0x84c1('0xc'),auth[_0x84c1('0x9')](),controller[_0x84c1('0x10')]);router[_0x84c1('0x11')](_0x84c1('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x84c1('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 8d903b9..54c2e88 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 _0xc949=['mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','14400','7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0xc949,0x181));var _0x9c94=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xc949[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0x9c94('0x0'));module['exports']={'name':{'type':Sequelize[_0x9c94('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9c94('0x1')]},'ecm':{'type':Sequelize[_0x9c94('0x2')](_0x9c94('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x9c94('0x1')],'defaultValue':_0x9c94('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x9c94('0x5')},'minrate':{'type':Sequelize[_0x9c94('0x2')](_0x9c94('0x6'),_0x9c94('0x7'),'7200',_0x9c94('0x8'),_0x9c94('0x9'),_0x9c94('0xa')),'defaultValue':_0x9c94('0x7')},'maxrate':{'type':Sequelize[_0x9c94('0x2')](_0x9c94('0x6'),_0x9c94('0x7'),_0x9c94('0xb'),_0x9c94('0x8'),_0x9c94('0x9'),'14400'),'defaultValue':_0x9c94('0xa')},'modem':{'type':Sequelize[_0x9c94('0x1')],'defaultValue':_0x9c94('0xc')},'gateway':{'type':Sequelize[_0x9c94('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x9c94('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x9c94('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9c94('0x2')](_0x9c94('0xe'),_0x9c94('0xf'),_0x9c94('0x10'),_0x9c94('0x11')),'defaultValue':_0x9c94('0xe')},'key':{'type':Sequelize[_0x9c94('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9c94('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9c94('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9c94('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9c94('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9c94('0xd')],'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[_0x9c94('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9c94('0x13')],'defaultValue':![],'comment':_0x9c94('0x14'),'set':function(_0x4d9266){if(!_0x4d9266)this[_0x9c94('0x15')](_0x9c94('0x16'),null);this[_0x9c94('0x15')](_0x9c94('0x17'),_0x4d9266);}}}; \ No newline at end of file +var _0x83d0=['exports','STRING','ENUM','yes','localstationid','2400','4800','7200','14400','9600','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x322501,_0xc548b0){var _0x1a3096=function(_0x4d8b33){while(--_0x4d8b33){_0x322501['push'](_0x322501['shift']());}};_0x1a3096(++_0xc548b0);}(_0x83d0,0xb7));var _0x083d=function(_0x23f7d5,_0x22faeb){_0x23f7d5=_0x23f7d5-0x0;var _0x440263=_0x83d0[_0x23f7d5];return _0x440263;};'use strict';var Sequelize=require(_0x083d('0x0'));module[_0x083d('0x1')]={'name':{'type':Sequelize[_0x083d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x083d('0x2')]},'ecm':{'type':Sequelize[_0x083d('0x3')](_0x083d('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x083d('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0x083d('0x5')},'minrate':{'type':Sequelize[_0x083d('0x3')](_0x083d('0x6'),_0x083d('0x7'),_0x083d('0x8'),'9600','12000',_0x083d('0x9')),'defaultValue':_0x083d('0x7')},'maxrate':{'type':Sequelize[_0x083d('0x3')]('2400',_0x083d('0x7'),_0x083d('0x8'),_0x083d('0xa'),_0x083d('0xb'),'14400'),'defaultValue':_0x083d('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x083d('0xc')},'gateway':{'type':Sequelize[_0x083d('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x083d('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x083d('0x3')](_0x083d('0xe'),_0x083d('0xf'),_0x083d('0x10'),'KHOMP'),'defaultValue':_0x083d('0xe')},'key':{'type':Sequelize[_0x083d('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x083d('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x083d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x083d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x083d('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x083d('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x083d('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x083d('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x083d('0x12')],'defaultValue':![],'comment':_0x083d('0x13'),'set':function(_0x24708d){if(!_0x24708d)this[_0x083d('0x14')](_0x083d('0x15'),null);this[_0x083d('0x14')](_0x083d('0x16'),_0x24708d);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 98eb1d8..f8c79bd 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 _0xd69a=['headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','format','send','CmList','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','CmContact','Send\x20Fax\x20failed','out','filename','Messages','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','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','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./faxAccount.socket','register','client','http','request','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','FaxAccount','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','show','rawAttributes','length','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','getDispositions','findOne','hasOwnProperty','FaxAccountId','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addInteraction','FaxInteraction','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','gateway'];(function(_0x4d2610,_0x4820ec){var _0x57511e=function(_0x3095e4){while(--_0x3095e4){_0x4d2610['push'](_0x4d2610['shift']());}};_0x57511e(++_0x4820ec);}(_0xd69a,0x1c8));var _0xad69=function(_0x1cc467,_0x4f8dde){_0x1cc467=_0x1cc467-0x0;var _0x1ae3cf=_0xd69a[_0x1cc467];return _0x1ae3cf;};'use strict';var emlformat=require(_0xad69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad69('0x1'));var jsonpatch=require(_0xad69('0x2'));var rp=require(_0xad69('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad69('0x4'));var util=require(_0xad69('0x5'));var path=require(_0xad69('0x6'));var sox=require(_0xad69('0x7'));var csv=require(_0xad69('0x8'));var ejs=require(_0xad69('0x9'));var fs=require('fs');var fs_extra=require(_0xad69('0xa'));var _=require(_0xad69('0xb'));var squel=require(_0xad69('0xc'));var crypto=require('crypto');var jsforce=require(_0xad69('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xad69('0x8'));var querystring=require(_0xad69('0xe'));var Papa=require(_0xad69('0xf'));var Redis=require(_0xad69('0x10'));var authService=require(_0xad69('0x11'));var qs=require(_0xad69('0x12'));var as=require(_0xad69('0x13'));var hardwareService=require(_0xad69('0x14'));var logger=require(_0xad69('0x15'))(_0xad69('0x16'));var utils=require('../../config/utils');var config=require(_0xad69('0x17'));var licenseUtil=require(_0xad69('0x18'));var db=require(_0xad69('0x19'))['db'];config['redis']=_[_0xad69('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xad69('0x1b'))(new Redis(config[_0xad69('0x1c')]));require(_0xad69('0x1d'))[_0xad69('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xad69('0x1f')][_0xad69('0x20')]({'port':0x232c});var client9002=jayson[_0xad69('0x1f')][_0xad69('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1c74e6,_0x5809f4,_0x41f49c,_0xe50956){return new BPromise(function(_0x4e93a3,_0x19da65){var _0x19d359=_0xe50956||client;return _0x19d359[_0xad69('0x21')](_0x1c74e6,_0x41f49c)['then'](function(_0x408e5d){logger[_0xad69('0x22')](_0xad69('0x23'),_0x5809f4,'request\x20sent');logger['debug'](_0xad69('0x24'),_0x5809f4,_0xad69('0x25'),JSON[_0xad69('0x26')](_0x408e5d));if(_0x408e5d[_0xad69('0x27')]){if(_0x408e5d[_0xad69('0x27')][_0xad69('0x28')]===0x1f4){logger[_0xad69('0x27')](_0xad69('0x23'),_0x5809f4,_0x408e5d[_0xad69('0x27')]['message']);return _0x19da65(_0x408e5d['error'][_0xad69('0x29')]);}logger[_0xad69('0x27')](_0xad69('0x23'),_0x5809f4,_0x408e5d[_0xad69('0x27')]['message']);return _0x4e93a3(_0x408e5d[_0xad69('0x27')]['message']);}else{logger[_0xad69('0x22')](_0xad69('0x23'),_0x5809f4,'request\x20sent');_0x4e93a3(_0x408e5d[_0xad69('0x2a')][_0xad69('0x29')]);}})[_0xad69('0x2b')](function(_0x5a4ed0){logger[_0xad69('0x27')](_0xad69('0x23'),_0x5809f4,_0x5a4ed0);_0x19da65(_0x5a4ed0);});});}function respondWithStatusCode(_0x554a75,_0x1d852b){_0x1d852b=_0x1d852b||0xcc;return function(_0x3655e4){if(_0x3655e4){return _0x554a75['sendStatus'](_0x1d852b);}return _0x554a75[_0xad69('0x2c')](_0x1d852b)[_0xad69('0x2d')]();};}function respondWithResult(_0x819fc9,_0x2df3e3){_0x2df3e3=_0x2df3e3||0xc8;return function(_0x2b7ddf){if(_0x2b7ddf){return _0x819fc9['status'](_0x2df3e3)['json'](_0x2b7ddf);}};}function respondWithFilteredResult(_0x3822e9,_0x4762a8){return function(_0x294ca6){if(_0x294ca6){var _0x4cc9d6=typeof _0x4762a8['offset']===_0xad69('0x2e')&&typeof _0x4762a8[_0xad69('0x2f')]===_0xad69('0x2e');var _0x151ab8=_0x294ca6[_0xad69('0x30')];var _0x3c1f0e=_0x4cc9d6?0x0:_0x4762a8[_0xad69('0x31')];var _0x4df765=_0x4cc9d6?_0x294ca6[_0xad69('0x30')]:_0x4762a8[_0xad69('0x31')]+_0x4762a8['limit'];var _0xc00783;if(_0x4df765>=_0x151ab8){_0x4df765=_0x151ab8;_0xc00783=0xc8;}else{_0xc00783=0xce;}_0x3822e9[_0xad69('0x2c')](_0xc00783);return _0x3822e9['set'](_0xad69('0x32'),_0x3c1f0e+'-'+_0x4df765+'/'+_0x151ab8)['json'](_0x294ca6);}return null;};}function patchUpdates(_0x5d4508){return function(_0x500264){try{jsonpatch[_0xad69('0x33')](_0x500264,_0x5d4508,!![]);}catch(_0x48be4a){return BPromise[_0xad69('0x34')](_0x48be4a);}return _0x500264[_0xad69('0x35')]();};}function saveUpdates(_0x1452a2,_0x32de89){return function(_0x15a847){if(_0x15a847){return _0x15a847[_0xad69('0x36')](_0x1452a2)[_0xad69('0x37')](function(_0x915393){return _0x915393;});}return null;};}function removeEntity(_0x3e0f96,_0x5c3e75){return function(_0x4766c1){if(_0x4766c1){return _0x4766c1[_0xad69('0x38')]()[_0xad69('0x37')](function(){var _0x409f50=_0x4766c1[_0xad69('0x39')]({'plain':!![]});var _0x511bfc=_0xad69('0x3a');return db[_0xad69('0x3b')]['destroy']({'where':{'type':_0x511bfc,'resourceId':_0x409f50['id']}})[_0xad69('0x37')](function(){return _0x4766c1;});})['then'](function(){_0x3e0f96[_0xad69('0x2c')](0xcc)[_0xad69('0x2d')]();});}};}function handleEntityNotFound(_0x2ac456,_0x4dc445){return function(_0x4f7c28){if(!_0x4f7c28){_0x2ac456[_0xad69('0x3c')](0x194);}return _0x4f7c28;};}function handleError(_0x5cb4b3,_0x1cda27){_0x1cda27=_0x1cda27||0x1f4;return function(_0x446ddf){logger[_0xad69('0x27')](_0x446ddf[_0xad69('0x3d')]);if(_0x446ddf[_0xad69('0x3e')]){delete _0x446ddf[_0xad69('0x3e')];}_0x5cb4b3[_0xad69('0x2c')](_0x1cda27)['send'](_0x446ddf);};}exports[_0xad69('0x3f')]=function(_0x2fa823,_0x149624){var _0x854006={'include':[{'model':db[_0xad69('0x40')],'as':_0xad69('0x41')}]},_0xbb4294={},_0x4f0ebd={'count':0x0,'rows':[]};var _0xa5270b=_['map'](db[_0xad69('0x42')]['rawAttributes'],function(_0x3785b4){return{'name':_0x3785b4[_0xad69('0x43')],'type':_0x3785b4[_0xad69('0x44')][_0xad69('0x45')]};});_0xbb4294['model']=_[_0xad69('0x46')](_0xa5270b,_0xad69('0x3e'));_0xbb4294[_0xad69('0x47')]=_[_0xad69('0x48')](_0x2fa823['query']);_0xbb4294[_0xad69('0x49')]=_[_0xad69('0x4a')](_0xbb4294['model'],_0xbb4294[_0xad69('0x47')]);_0x854006[_0xad69('0x4b')]=_['intersection'](_0xbb4294[_0xad69('0x4c')],qs['fields'](_0x2fa823[_0xad69('0x47')][_0xad69('0x4d')]));_0x854006[_0xad69('0x4b')]=_0x854006['attributes']['length']?_0x854006[_0xad69('0x4b')]:_0xbb4294['model'];if(!_0x2fa823[_0xad69('0x47')]['hasOwnProperty'](_0xad69('0x4e'))){_0x854006[_0xad69('0x2f')]=qs['limit'](_0x2fa823[_0xad69('0x47')][_0xad69('0x2f')]);_0x854006[_0xad69('0x31')]=qs[_0xad69('0x31')](_0x2fa823[_0xad69('0x47')][_0xad69('0x31')]);}_0x854006[_0xad69('0x4f')]=qs['sort'](_0x2fa823[_0xad69('0x47')][_0xad69('0x50')]);_0x854006['where']=qs['filters'](_[_0xad69('0x51')](_0x2fa823[_0xad69('0x47')],_0xbb4294['filters']),_0xa5270b);if(_0x2fa823[_0xad69('0x47')][_0xad69('0x52')]){_0x854006['where']=_[_0xad69('0x53')](_0x854006[_0xad69('0x54')],{'$or':_['map'](_0xa5270b,function(_0x1173e4){if(_0x1173e4['type']!==_0xad69('0x55')){var _0x55ccd2={};_0x55ccd2[_0x1173e4['name']]={'$like':'%'+_0x2fa823['query'][_0xad69('0x52')]+'%'};return _0x55ccd2;}})});}_0x854006=_[_0xad69('0x53')]({},_0x854006,_0x2fa823[_0xad69('0x56')]);var _0xe4b969={'where':_0x854006[_0xad69('0x54')]};return db[_0xad69('0x42')]['count'](_0xe4b969)['then'](function(_0x4bf659){_0x4f0ebd['count']=_0x4bf659;if(_0x2fa823[_0xad69('0x47')][_0xad69('0x57')]){_0x854006['include']=[{'all':!![]}];}return db['FaxAccount'][_0xad69('0x58')](_0x854006);})[_0xad69('0x37')](function(_0x883e44){_0x4f0ebd[_0xad69('0x59')]=_0x883e44;return _0x4f0ebd;})['then'](respondWithFilteredResult(_0x149624,_0x854006))['catch'](handleError(_0x149624,null));};exports[_0xad69('0x5a')]=function(_0x41863a,_0x30602a){var _0x57afeb={'raw':![],'where':{'id':_0x41863a['params']['id']},'include':[{'model':db[_0xad69('0x40')],'as':_0xad69('0x41')}]},_0x3912e6={};_0x3912e6[_0xad69('0x4c')]=_[_0xad69('0x48')](db[_0xad69('0x42')][_0xad69('0x5b')]);_0x3912e6[_0xad69('0x47')]=_[_0xad69('0x48')](_0x41863a[_0xad69('0x47')]);_0x3912e6[_0xad69('0x49')]=_[_0xad69('0x4a')](_0x3912e6[_0xad69('0x4c')],_0x3912e6[_0xad69('0x47')]);_0x57afeb[_0xad69('0x4b')]=_[_0xad69('0x4a')](_0x3912e6['model'],qs[_0xad69('0x4d')](_0x41863a[_0xad69('0x47')][_0xad69('0x4d')]));_0x57afeb[_0xad69('0x4b')]=_0x57afeb['attributes'][_0xad69('0x5c')]?_0x57afeb[_0xad69('0x4b')]:_0x3912e6[_0xad69('0x4c')];if(_0x41863a[_0xad69('0x47')]['includeAll']){_0x57afeb['include']=[{'all':!![]}];}_0x57afeb=_[_0xad69('0x53')]({},_0x57afeb,_0x41863a[_0xad69('0x56')]);return db[_0xad69('0x42')][_0xad69('0x5d')](_0x57afeb)['then'](handleEntityNotFound(_0x30602a,null))[_0xad69('0x37')](respondWithResult(_0x30602a,null))['catch'](handleError(_0x30602a,null));};exports['create']=function(_0x1412dc,_0x1cf8a6){return db[_0xad69('0x42')]['create'](_0x1412dc[_0xad69('0x5e')],{})[_0xad69('0x37')](function(_0x5058d8){var _0x552243=_0x1412dc['user'][_0xad69('0x39')]({'plain':!![]});if(!_0x552243)throw new Error(_0xad69('0x5f'));if(_0x552243['role']===_0xad69('0x60')){var _0x47e017=_0x5058d8['get']({'plain':!![]});var _0x1aea8b=_0xad69('0x3a');return db['UserProfileSection'][_0xad69('0x5d')]({'where':{'name':_0x1aea8b,'userProfileId':_0x552243[_0xad69('0x61')]},'raw':!![]})[_0xad69('0x37')](function(_0x1b5ba2){if(_0x1b5ba2&&_0x1b5ba2[_0xad69('0x62')]===0x0){return db['UserProfileResource'][_0xad69('0x63')]({'name':_0x47e017[_0xad69('0x3e')],'resourceId':_0x47e017['id'],'type':_0x1b5ba2[_0xad69('0x3e')],'sectionId':_0x1b5ba2['id']},{})[_0xad69('0x37')](function(){return _0x5058d8;});}else{return _0x5058d8;}})[_0xad69('0x2b')](function(_0x281f0d){logger[_0xad69('0x27')](_0xad69('0x64'),_0x281f0d);throw _0x281f0d;});}return _0x5058d8;})['then'](respondWithResult(_0x1cf8a6,0xc9))[_0xad69('0x2b')](handleError(_0x1cf8a6,null));};exports[_0xad69('0x36')]=function(_0x1a6937,_0x38fc20){if(_0x1a6937[_0xad69('0x5e')]['id']){delete _0x1a6937[_0xad69('0x5e')]['id'];}return db[_0xad69('0x42')][_0xad69('0x5d')]({'where':{'id':_0x1a6937[_0xad69('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0xad69('0x41')}]})[_0xad69('0x37')](handleEntityNotFound(_0x38fc20,null))[_0xad69('0x37')](saveUpdates(_0x1a6937[_0xad69('0x5e')],null))[_0xad69('0x37')](respondWithResult(_0x38fc20,null))[_0xad69('0x2b')](handleError(_0x38fc20,null));};exports['destroy']=function(_0x4e2471,_0x394660){return db['FaxAccount']['find']({'where':{'id':_0x4e2471[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x394660,null))['then'](removeEntity(_0x394660,null))[_0xad69('0x2b')](handleError(_0x394660,null));};exports['describe']=function(_0x8c95e2,_0x2c92c3){return db['FaxAccount'][_0xad69('0x66')]()[_0xad69('0x37')](respondWithResult(_0x2c92c3,null))['catch'](handleError(_0x2c92c3,null));};exports['addDisposition']=function(_0x400bc0,_0x3498aa,_0x74acd2){if(_0x400bc0[_0xad69('0x5e')]['id']){delete _0x400bc0[_0xad69('0x5e')]['id'];}return db[_0xad69('0x42')][_0xad69('0x5d')]({'where':{'id':_0x400bc0[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x3498aa,null))[_0xad69('0x37')](function(_0x5421d4){if(_0x5421d4){_0x400bc0[_0xad69('0x5e')]['FaxAccountId']=_0x5421d4['id'];return db[_0xad69('0x67')]['create'](_0x400bc0[_0xad69('0x5e')]);}})[_0xad69('0x37')](respondWithResult(_0x3498aa,null))[_0xad69('0x2b')](handleError(_0x3498aa,null));};exports[_0xad69('0x68')]=function(_0xc16a3,_0x1c4306,_0x1d178c){var _0xdfbafe={'raw':![],'where':{}};var _0x58b232={};var _0x33bba1={'count':0x0,'rows':[]};return db[_0xad69('0x42')][_0xad69('0x69')]({'where':{'id':_0xc16a3[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x1c4306,null))[_0xad69('0x37')](function(_0x4e3d7c){if(_0x4e3d7c){_0x58b232[_0xad69('0x4c')]=_['keys'](db[_0xad69('0x67')][_0xad69('0x5b')]);_0x58b232[_0xad69('0x47')]=_[_0xad69('0x48')](_0xc16a3['query']);_0x58b232[_0xad69('0x49')]=_['intersection'](_0x58b232[_0xad69('0x4c')],_0x58b232['query']);_0xdfbafe['attributes']=_[_0xad69('0x4a')](_0x58b232[_0xad69('0x4c')],qs['fields'](_0xc16a3[_0xad69('0x47')]['fields']));_0xdfbafe[_0xad69('0x4b')]=_0xdfbafe['attributes']['length']?_0xdfbafe[_0xad69('0x4b')]:_0x58b232[_0xad69('0x4c')];if(!_0xc16a3[_0xad69('0x47')][_0xad69('0x6a')]('nolimit')){_0xdfbafe[_0xad69('0x2f')]=qs[_0xad69('0x2f')](_0xc16a3['query'][_0xad69('0x2f')]);_0xdfbafe[_0xad69('0x31')]=qs[_0xad69('0x31')](_0xc16a3[_0xad69('0x47')][_0xad69('0x31')]);}_0xdfbafe[_0xad69('0x4f')]=qs[_0xad69('0x50')](_0xc16a3[_0xad69('0x47')][_0xad69('0x50')]);_0xdfbafe[_0xad69('0x54')]=qs[_0xad69('0x49')](_['pick'](_0xc16a3[_0xad69('0x47')],_0x58b232[_0xad69('0x49')]));_0xdfbafe[_0xad69('0x54')][_0xad69('0x6b')]=_0x4e3d7c['id'];if(_0xc16a3[_0xad69('0x47')][_0xad69('0x52')]){_0xdfbafe[_0xad69('0x54')]=_['merge'](_0xdfbafe[_0xad69('0x54')],{'$or':_['map'](_0xdfbafe['attributes'],function(_0x26ac05){var _0x416d0e={};_0x416d0e[_0x26ac05]={'$like':'%'+_0xc16a3[_0xad69('0x47')]['filter']+'%'};return _0x416d0e;})});}_0xdfbafe=_[_0xad69('0x53')]({},_0xdfbafe,_0xc16a3[_0xad69('0x56')]);return db[_0xad69('0x67')][_0xad69('0x30')]({'where':_0xdfbafe[_0xad69('0x54')]})[_0xad69('0x37')](function(_0x6dbd85){_0x33bba1[_0xad69('0x30')]=_0x6dbd85;if(_0xc16a3[_0xad69('0x47')]['includeAll']){_0xdfbafe[_0xad69('0x6c')]=[{'all':!![]}];}return db[_0xad69('0x67')][_0xad69('0x58')](_0xdfbafe);})[_0xad69('0x37')](function(_0x483bcd){_0x33bba1[_0xad69('0x59')]=_0x483bcd;return _0x33bba1;});}})['then'](respondWithFilteredResult(_0x1c4306,_0xdfbafe))['catch'](handleError(_0x1c4306,null));};exports[_0xad69('0x6d')]=function(_0x57b03d,_0x3837cc,_0xf90127){return db[_0xad69('0x42')][_0xad69('0x5d')]({'where':{'id':_0x57b03d[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x3837cc,null))['then'](function(_0x1bad9c){if(_0x1bad9c){return _0x1bad9c[_0xad69('0x6d')](_0x57b03d[_0xad69('0x47')][_0xad69('0x6e')]);}})[_0xad69('0x37')](respondWithStatusCode(_0x3837cc,null))[_0xad69('0x2b')](handleError(_0x3837cc,null));};exports[_0xad69('0x6f')]=function(_0x572779,_0x217216,_0x64fc3e){if(_0x572779[_0xad69('0x5e')]['id']){delete _0x572779[_0xad69('0x5e')]['id'];}return db[_0xad69('0x42')][_0xad69('0x5d')]({'where':{'id':_0x572779[_0xad69('0x65')]['id']}})['then'](handleEntityNotFound(_0x217216,null))['then'](function(_0x12a71c){if(_0x12a71c){_0x572779[_0xad69('0x5e')]['FaxAccountId']=_0x12a71c['id'];return db[_0xad69('0x70')]['create'](_0x572779['body']);}})['then'](respondWithResult(_0x217216,null))[_0xad69('0x2b')](handleError(_0x217216,null));};exports[_0xad69('0x71')]=function(_0x2952f8,_0x25eb73,_0x13dee7){var _0x20b0a0={'raw':![],'where':{}};var _0x37ebc3={};var _0x13bf34={'count':0x0,'rows':[]};return db[_0xad69('0x42')][_0xad69('0x69')]({'where':{'id':_0x2952f8[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x25eb73,null))['then'](function(_0x4dac43){if(_0x4dac43){_0x37ebc3[_0xad69('0x4c')]=_[_0xad69('0x48')](db['CannedAnswer']['rawAttributes']);_0x37ebc3[_0xad69('0x47')]=_[_0xad69('0x48')](_0x2952f8[_0xad69('0x47')]);_0x37ebc3[_0xad69('0x49')]=_[_0xad69('0x4a')](_0x37ebc3[_0xad69('0x4c')],_0x37ebc3[_0xad69('0x47')]);_0x20b0a0[_0xad69('0x4b')]=_[_0xad69('0x4a')](_0x37ebc3['model'],qs[_0xad69('0x4d')](_0x2952f8['query'][_0xad69('0x4d')]));_0x20b0a0[_0xad69('0x4b')]=_0x20b0a0[_0xad69('0x4b')][_0xad69('0x5c')]?_0x20b0a0[_0xad69('0x4b')]:_0x37ebc3['model'];if(!_0x2952f8[_0xad69('0x47')][_0xad69('0x6a')](_0xad69('0x4e'))){_0x20b0a0[_0xad69('0x2f')]=qs['limit'](_0x2952f8[_0xad69('0x47')][_0xad69('0x2f')]);_0x20b0a0[_0xad69('0x31')]=qs[_0xad69('0x31')](_0x2952f8[_0xad69('0x47')][_0xad69('0x31')]);}_0x20b0a0[_0xad69('0x4f')]=qs['sort'](_0x2952f8[_0xad69('0x47')][_0xad69('0x50')]);_0x20b0a0[_0xad69('0x54')]=qs[_0xad69('0x49')](_['pick'](_0x2952f8['query'],_0x37ebc3[_0xad69('0x49')]));_0x20b0a0['where']['FaxAccountId']=_0x4dac43['id'];if(_0x2952f8['query'][_0xad69('0x52')]){_0x20b0a0[_0xad69('0x54')]=_[_0xad69('0x53')](_0x20b0a0[_0xad69('0x54')],{'$or':_[_0xad69('0x46')](_0x20b0a0['attributes'],function(_0x5ae87b){var _0x1eabde={};_0x1eabde[_0x5ae87b]={'$like':'%'+_0x2952f8['query'][_0xad69('0x52')]+'%'};return _0x1eabde;})});}_0x20b0a0=_[_0xad69('0x53')]({},_0x20b0a0,_0x2952f8[_0xad69('0x56')]);return db['CannedAnswer'][_0xad69('0x30')]({'where':_0x20b0a0[_0xad69('0x54')]})['then'](function(_0x3a40db){_0x13bf34[_0xad69('0x30')]=_0x3a40db;if(_0x2952f8[_0xad69('0x47')][_0xad69('0x57')]){_0x20b0a0[_0xad69('0x6c')]=[{'all':!![]}];}return db[_0xad69('0x70')]['findAll'](_0x20b0a0);})[_0xad69('0x37')](function(_0x4a92b9){_0x13bf34[_0xad69('0x59')]=_0x4a92b9;return _0x13bf34;});}})[_0xad69('0x37')](respondWithFilteredResult(_0x25eb73,_0x20b0a0))['catch'](handleError(_0x25eb73,null));};exports['removeAnswers']=function(_0x353b19,_0x4920e0,_0x5ce0ff){return db['FaxAccount'][_0xad69('0x5d')]({'where':{'id':_0x353b19[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x4920e0,null))[_0xad69('0x37')](function(_0x3af2b1){if(_0x3af2b1){return _0x3af2b1['removeAnswers'](_0x353b19[_0xad69('0x47')][_0xad69('0x6e')]);}})[_0xad69('0x37')](respondWithStatusCode(_0x4920e0,null))['catch'](handleError(_0x4920e0,null));};exports[_0xad69('0x72')]=function(_0x14979b,_0x76c8af,_0x485aa6){return db[_0xad69('0x73')][_0xad69('0x5d')]({'where':{'id':_0x14979b[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x76c8af,null))['then'](function(_0x20498a){if(_0x20498a){return _0x20498a[_0xad69('0x72')](_0x14979b[_0xad69('0x5e')]['ids'],_['omit'](_0x14979b[_0xad69('0x5e')],[_0xad69('0x6e'),'id'])||{});}})[_0xad69('0x37')](respondWithResult(_0x76c8af,null))[_0xad69('0x2b')](handleError(_0x76c8af,null));};exports[_0xad69('0x74')]=function(_0x4c6842,_0x33a2bc,_0x5b5742){var _0x155490={'raw':![],'where':{}};var _0x5ecc5f={};var _0x423e10={'count':0x0,'rows':[]};return db[_0xad69('0x42')][_0xad69('0x69')]({'where':{'id':_0x4c6842[_0xad69('0x65')]['id']}})['then'](handleEntityNotFound(_0x33a2bc,null))[_0xad69('0x37')](function(_0x12583c){if(_0x12583c){_0x5ecc5f['model']=_[_0xad69('0x48')](db[_0xad69('0x73')][_0xad69('0x5b')]);_0x5ecc5f[_0xad69('0x47')]=_[_0xad69('0x48')](_0x4c6842[_0xad69('0x47')]);_0x5ecc5f[_0xad69('0x49')]=_[_0xad69('0x4a')](_0x5ecc5f[_0xad69('0x4c')],_0x5ecc5f['query']);_0x155490[_0xad69('0x4b')]=_[_0xad69('0x4a')](_0x5ecc5f[_0xad69('0x4c')],qs[_0xad69('0x4d')](_0x4c6842[_0xad69('0x47')]['fields']));_0x155490[_0xad69('0x4b')]=_0x155490['attributes'][_0xad69('0x5c')]?_0x155490[_0xad69('0x4b')]:_0x5ecc5f[_0xad69('0x4c')];if(!_0x4c6842[_0xad69('0x47')]['hasOwnProperty']('nolimit')){_0x155490[_0xad69('0x2f')]=qs[_0xad69('0x2f')](_0x4c6842[_0xad69('0x47')][_0xad69('0x2f')]);_0x155490[_0xad69('0x31')]=qs[_0xad69('0x31')](_0x4c6842[_0xad69('0x47')][_0xad69('0x31')]);}_0x155490[_0xad69('0x4f')]=qs[_0xad69('0x50')](_0x4c6842[_0xad69('0x47')]['sort']);_0x155490['where']=qs[_0xad69('0x49')](_[_0xad69('0x51')](_0x4c6842['query'],_0x5ecc5f[_0xad69('0x49')]));_0x155490[_0xad69('0x54')][_0xad69('0x6b')]=_0x12583c['id'];if(_0x4c6842[_0xad69('0x47')][_0xad69('0x52')]){_0x155490[_0xad69('0x54')]=_[_0xad69('0x53')](_0x155490[_0xad69('0x54')],{'$or':_[_0xad69('0x46')](_0x155490[_0xad69('0x4b')],function(_0x3ed075){var _0x29c0e2={};_0x29c0e2[_0x3ed075]={'$like':'%'+_0x4c6842[_0xad69('0x47')][_0xad69('0x52')]+'%'};return _0x29c0e2;})});}_0x155490=_[_0xad69('0x53')]({},_0x155490,_0x4c6842[_0xad69('0x56')]);return db[_0xad69('0x73')]['count']({'where':_0x155490[_0xad69('0x54')]})[_0xad69('0x37')](function(_0x29d6d5){_0x423e10[_0xad69('0x30')]=_0x29d6d5;if(_0x4c6842[_0xad69('0x47')][_0xad69('0x57')]){_0x155490[_0xad69('0x6c')]=[{'model':db['CmContact'],'as':_0xad69('0x75'),'required':![]},{'model':db[_0xad69('0x76')],'as':_0xad69('0x77'),'attributes':[_0xad69('0x3e'),_0xad69('0x78'),_0xad69('0x79')],'required':![]},{'model':db[_0xad69('0x7a')],'as':_0xad69('0x7b'),'attributes':['id',_0xad69('0x3e'),_0xad69('0x7c')],'where':_0x4c6842[_0xad69('0x47')][_0xad69('0x7d')]?{'id':_0x4c6842[_0xad69('0x47')][_0xad69('0x7d')]}:undefined,'required':_0x4c6842[_0xad69('0x47')][_0xad69('0x7d')]?!![]:![]}];}return db[_0xad69('0x73')]['findAll'](_0x155490);})[_0xad69('0x37')](function(_0x1518bb){_0x423e10['rows']=_0x1518bb;return _0x423e10;});}})['then'](respondWithFilteredResult(_0x33a2bc,_0x155490))[_0xad69('0x2b')](handleError(_0x33a2bc,null));};exports[_0xad69('0x7e')]=function(_0x278452,_0x56e74){var _0x403a68=_0x278452[_0xad69('0x65')]['id'];var _0x2de79f=_0x278452['body'];var _0x580de0=0xc8;var _0x4c81fe=null;return db[_0xad69('0x7f')][_0xad69('0x80')]({'isolationLevel':db[_0xad69('0x7f')][_0xad69('0x81')][_0xad69('0x82')]['READ_COMMITTED']},function(_0x363ffb){return db[_0xad69('0x42')]['findOne']({'where':{'id':_0x403a68},'transaction':_0x363ffb})[_0xad69('0x37')](function(_0x3ecdea){if(_0x3ecdea){return db[_0xad69('0x83')]['destroy']({'where':{'FaxAccountId':_0x403a68},'transaction':_0x363ffb})['then'](function(){var _0x10ecca=_['map'](_0x2de79f,function(_0x522c95){_0x522c95[_0xad69('0x6b')]=_0x403a68;return _0x522c95;});return db[_0xad69('0x83')][_0xad69('0x84')](_0x10ecca,{'transaction':_0x363ffb});});}else{_0x580de0=0x194;_0x4c81fe=[];}});})[_0xad69('0x37')](function(){if(_0x580de0!==0x194){return db[_0xad69('0x83')]['findAndCountAll']({'where':{'FaxAccountId':_0x403a68},'order':_0xad69('0x85')})['then'](function(_0x3a596e){_0x4c81fe=_0x3a596e;});}})[_0xad69('0x2b')](function(_0x187609){_0x580de0=0x1f4;logger[_0xad69('0x27')](_0x187609['stack']);if(_0x187609[_0xad69('0x3e')]){delete _0x187609[_0xad69('0x3e')];}_0x4c81fe=_0x187609;})[_0xad69('0x86')](function(){if(_0x4c81fe===null){_0x56e74[_0xad69('0x3c')](_0x580de0);}else{if(_0x580de0===0x1f4){_0x56e74[_0xad69('0x2c')](_0x580de0)['send'](_0x4c81fe);}else{_0x56e74[_0xad69('0x2c')](_0x580de0)['json'](_0x4c81fe);}}});};exports[_0xad69('0x87')]=function(_0xfacb98,_0xbc93e8,_0x1170ce){var _0x3680f0={};var _0x81a8f4={};var _0x5819d3;var _0xf9dedb;return db[_0xad69('0x42')][_0xad69('0x69')]({'where':{'id':_0xfacb98[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0xbc93e8,null))['then'](function(_0x35a588){if(_0x35a588){_0x5819d3=_0x35a588;_0x81a8f4[_0xad69('0x4c')]=_['keys'](db[_0xad69('0x83')]['rawAttributes']);_0x81a8f4[_0xad69('0x47')]=_['keys'](_0xfacb98[_0xad69('0x47')]);_0x81a8f4[_0xad69('0x49')]=_['intersection'](_0x81a8f4['model'],_0x81a8f4[_0xad69('0x47')]);_0x3680f0[_0xad69('0x4b')]=_['intersection'](_0x81a8f4[_0xad69('0x4c')],qs[_0xad69('0x4d')](_0xfacb98[_0xad69('0x47')][_0xad69('0x4d')]));_0x3680f0['attributes']=_0x3680f0[_0xad69('0x4b')]['length']?_0x3680f0[_0xad69('0x4b')]:_0x81a8f4[_0xad69('0x4c')];_0x3680f0[_0xad69('0x4f')]=qs[_0xad69('0x50')](_0xfacb98[_0xad69('0x47')][_0xad69('0x50')]);_0x3680f0[_0xad69('0x54')]=qs[_0xad69('0x49')](_[_0xad69('0x51')](_0xfacb98['query'],_0x81a8f4[_0xad69('0x49')]));if(_0xfacb98[_0xad69('0x47')][_0xad69('0x52')]){_0x3680f0[_0xad69('0x54')]=_[_0xad69('0x53')](_0x3680f0[_0xad69('0x54')],{'$or':_['map'](_0x3680f0[_0xad69('0x4b')],function(_0x5c6bcd){var _0x2ac800={};_0x2ac800[_0x5c6bcd]={'$like':'%'+_0xfacb98['query'][_0xad69('0x52')]+'%'};return _0x2ac800;})});}_0x3680f0=_[_0xad69('0x53')]({},_0x3680f0,_0xfacb98[_0xad69('0x56')]);return _0x5819d3[_0xad69('0x87')](_0x3680f0);}})[_0xad69('0x37')](function(_0x3c0247){if(_0x3c0247){_0xf9dedb=_0x3c0247[_0xad69('0x5c')];if(!_0xfacb98[_0xad69('0x47')][_0xad69('0x6a')](_0xad69('0x4e'))){_0x3680f0[_0xad69('0x2f')]=qs[_0xad69('0x2f')](_0xfacb98[_0xad69('0x47')]['limit']);_0x3680f0['offset']=qs[_0xad69('0x31')](_0xfacb98[_0xad69('0x47')]['offset']);}return _0x5819d3[_0xad69('0x87')](_0x3680f0);}})[_0xad69('0x37')](function(_0x17e6ba){if(_0x17e6ba){return _0x17e6ba?{'count':_0xf9dedb,'rows':_0x17e6ba}:null;}})[_0xad69('0x37')](respondWithResult(_0xbc93e8,null))[_0xad69('0x2b')](handleError(_0xbc93e8,null));};function Extension(_0x46161a,_0x1dcecd,_0x55f479,_0x537631){this[_0xad69('0x88')]=_0xad69('0x89');this[_0xad69('0x8a')]=_0x46161a[_0xad69('0x8b')];this[_0xad69('0x8c')]=_0x537631;this[_0xad69('0x44')]=_0xad69('0x8d');this[_0xad69('0x8e')]=_0xad69('0x8f');this[_0xad69('0x6b')]=_0x46161a['id'];this[_0xad69('0x85')]=_0x1dcecd;this[_0xad69('0x90')]=_0x55f479;}function createExtensionsReciveFax(_0x5240e2){var _0x5ebc9c=0x1;var _0xc76d75=[];_0xc76d75['push'](new Extension(_0x5240e2,_0x5ebc9c,'',_0xad69('0x91')));_0x5ebc9c+=0x1;_0xc76d75[_0xad69('0x92')](new Extension(_0x5240e2,_0x5ebc9c,_0xad69('0x93'),_0xad69('0x94')));_0x5ebc9c+=0x1;for(var _0x4a4baa in _0x5240e2){if(_0x5240e2[_0xad69('0x6a')](_0x4a4baa)&&(_0x4a4baa==='ecm'||_0x4a4baa==='localstationid'||_0x4a4baa===_0xad69('0x95')||_0x4a4baa==='faxdetect'||_0x4a4baa===_0xad69('0x96')||_0x4a4baa===_0xad69('0x97')||_0x4a4baa===_0xad69('0x98')||_0x4a4baa===_0xad69('0x99')||_0x4a4baa==='t38timeout')){_0xc76d75[_0xad69('0x92')](new Extension(_0x5240e2,_0x5ebc9c,_0xad69('0x9a')+_0x4a4baa+')='+_0x5240e2[_0x4a4baa],'Set'));_0x5ebc9c+=0x1;}}_0xc76d75[_0xad69('0x92')](new Extension(_0x5240e2,_0x5ebc9c,'6',_0xad69('0x9b')));_0x5ebc9c+=0x1;_0xc76d75[_0xad69('0x92')](new Extension(_0x5240e2,_0x5ebc9c,'/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',_0xad69('0x9c')));_0x5ebc9c=0x0;return _0xc76d75;}exports[_0xad69('0x9d')]=function(_0x45d330,_0x2f90f7,_0x28b476){var _0x6f0060;return db['sequelize'][_0xad69('0x80')](function(_0x22565d){return db['FaxAccount'][_0xad69('0x63')](_0x45d330['body'],{'transaction':_0x22565d})['then'](function(_0x1dfd6d){_0x6f0060=_0x1dfd6d['get']({'plain':!![]});return db[_0xad69('0x9e')][_0xad69('0x84')](createExtensionsReciveFax(_0x6f0060),{'transaction':_0x22565d});});})[_0xad69('0x37')](function(){return _0x6f0060;})[_0xad69('0x37')](respondWithResult(_0x2f90f7,null))[_0xad69('0x2b')](handleError(_0x2f90f7,null));};exports[_0xad69('0x9f')]=function(_0x14ad5f,_0x15d186,_0x4016af){var _0xa11f3e;return db[_0xad69('0x7f')][_0xad69('0x80')](function(_0x1b0b60){return db[_0xad69('0x42')][_0xad69('0x36')](_0x14ad5f[_0xad69('0x5e')],{'where':{'id':_0x14ad5f['body']['id']},'transaction':_0x1b0b60})[_0xad69('0x37')](function(_0x14b057){return db[_0xad69('0x9e')][_0xad69('0x38')]({'where':{'FaxAccountId':_0x14ad5f[_0xad69('0x5e')]['id']},'transaction':_0x1b0b60})[_0xad69('0x37')](function(_0x3f3824){return db[_0xad69('0x9e')]['bulkCreate'](createExtensionsReciveFax(_[_0xad69('0xa0')](_0x14ad5f[_0xad69('0x5e')],[_0xad69('0xa1'),_0xad69('0x45'),_0xad69('0xa2'),_0xad69('0xa3'),_0xad69('0xa4'),_0xad69('0xa5')])),{'transaction':_0x1b0b60});});});})[_0xad69('0x37')](function(){return db[_0xad69('0x42')][_0xad69('0xa6')](_0x14ad5f[_0xad69('0x5e')]['id']);})[_0xad69('0x37')](respondWithResult(_0x15d186,null))['catch'](handleError(_0x15d186,null));};exports['getMessages']=function(_0x338c09,_0x29b7c4,_0x5e981c){var _0x505ce2={'raw':!![],'where':{}};var _0x21066f={};var _0x88fa22={'count':0x0,'rows':[]};return db[_0xad69('0x42')][_0xad69('0x69')]({'where':{'id':_0x338c09['params']['id']}})['then'](handleEntityNotFound(_0x29b7c4,null))['then'](function(_0x3288ed){if(_0x3288ed){_0x21066f[_0xad69('0x4c')]=_[_0xad69('0x48')](db[_0xad69('0xa7')]['rawAttributes']);_0x21066f[_0xad69('0x47')]=_['keys'](_0x338c09[_0xad69('0x47')]);_0x21066f[_0xad69('0x49')]=_[_0xad69('0x4a')](_0x21066f[_0xad69('0x4c')],_0x21066f[_0xad69('0x47')]);_0x505ce2[_0xad69('0x4b')]=_[_0xad69('0x4a')](_0x21066f[_0xad69('0x4c')],qs[_0xad69('0x4d')](_0x338c09[_0xad69('0x47')][_0xad69('0x4d')]));_0x505ce2['attributes']=_0x505ce2[_0xad69('0x4b')][_0xad69('0x5c')]?_0x505ce2[_0xad69('0x4b')]:_0x21066f[_0xad69('0x4c')];if(!_0x338c09[_0xad69('0x47')][_0xad69('0x6a')]('nolimit')){_0x505ce2[_0xad69('0x2f')]=qs[_0xad69('0x2f')](_0x338c09[_0xad69('0x47')][_0xad69('0x2f')]);_0x505ce2[_0xad69('0x31')]=qs[_0xad69('0x31')](_0x338c09[_0xad69('0x47')][_0xad69('0x31')]);}_0x505ce2['order']=qs[_0xad69('0x50')](_0x338c09['query'][_0xad69('0x50')]);_0x505ce2[_0xad69('0x54')]=qs[_0xad69('0x49')](_[_0xad69('0x51')](_0x338c09[_0xad69('0x47')],_0x21066f[_0xad69('0x49')]));_0x505ce2[_0xad69('0x54')][_0xad69('0x6b')]=_0x3288ed['id'];if(_0x338c09['query']['filter']){_0x505ce2['where']=_[_0xad69('0x53')](_0x505ce2['where'],{'$or':_[_0xad69('0x46')](_0x505ce2['attributes'],function(_0x2492fc){var _0x4d7b48={};_0x4d7b48[_0x2492fc]={'$like':'%'+_0x338c09['query'][_0xad69('0x52')]+'%'};return _0x4d7b48;})});}if(_0x338c09['query'][_0xad69('0xa8')]){var _0x2b33e9=_0x338c09[_0xad69('0x47')][_0xad69('0xa8')]['split'](',');var _0x51443c={};_0x51443c[_0x2b33e9[0x0]]={'$gte':moment(_0x2b33e9[0x1])[_0xad69('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x505ce2[_0xad69('0x54')]=_[_0xad69('0x53')](_0x505ce2[_0xad69('0x54')],_0x51443c);}_0x505ce2=_[_0xad69('0x53')]({},_0x505ce2,_0x338c09[_0xad69('0x56')]);return db[_0xad69('0xa7')][_0xad69('0x30')]({'where':_0x505ce2[_0xad69('0x54')]})[_0xad69('0x37')](function(_0x168fcd){_0x88fa22[_0xad69('0x30')]=_0x168fcd;if(_0x338c09['query'][_0xad69('0x57')]){_0x505ce2['include']=[{'all':!![]}];}return db[_0xad69('0xa7')]['findAll'](_0x505ce2);})[_0xad69('0x37')](function(_0x3a0dd1){_0x88fa22['rows']=_0x3a0dd1;return _0x88fa22;});}})[_0xad69('0x37')](respondWithFilteredResult(_0x29b7c4,_0x505ce2))['catch'](handleError(_0x29b7c4,null));};exports[_0xad69('0xaa')]=function(_0x43d550,_0x44e4c4,_0x4598a7){var _0x41e6e2,_0x5183be={},_0x5c9400;if(_0x43d550['body']['to']){_0x5c9400=_0x43d550[_0xad69('0x5e')]['to'][0x0];}return db[_0xad69('0x42')][_0xad69('0x5d')]({'where':{'id':_0x43d550[_0xad69('0x65')]['id']},'include':[{'model':db[_0xad69('0xab')],'as':_0xad69('0xac'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x5c9400},'limit':0x1,'order':[[_0xad69('0xa3'),_0xad69('0xad')]]}]}]})[_0xad69('0x37')](handleEntityNotFound(_0x44e4c4,null))[_0xad69('0x37')](function(_0x37fa54){_0x41e6e2=_0x37fa54;if(_0x43d550[_0xad69('0x5e')][_0xad69('0xae')]&&_0x43d550[_0xad69('0x5e')]['attachments'][_0xad69('0x5c')]){for(var _0x29b567=0x0;_0x29b567<_0x43d550[_0xad69('0x5e')][_0xad69('0xae')][_0xad69('0x5c')];_0x29b567+=0x1){_0x43d550[_0xad69('0x5e')]['attachments'][_0x29b567]={'filename':_0x43d550[_0xad69('0x5e')]['attachments'][_0x29b567][_0xad69('0x3e')],'id':_0x43d550[_0xad69('0x5e')]['attachments'][_0x29b567]['id'],'path':path[_0xad69('0xaf')](config[_0xad69('0xb0')],_0xad69('0xb1'),_0x43d550['body']['attachments'][_0x29b567][_0xad69('0xb2')])};}}return respondWithRpcPromise('CheckAfterSend',_0xad69('0xb3'),{'FaxAccountId':_['isNil'](_0x43d550[_0xad69('0x65')]['id'])?undefined:_0x43d550[_0xad69('0x65')]['id'],'path':_[_0xad69('0xb4')](_0x43d550[_0xad69('0x5e')][_0xad69('0xae')][0x0][_0xad69('0x6')])?undefined:_0x43d550[_0xad69('0x5e')][_0xad69('0xae')][0x0][_0xad69('0x6')],'fax':_[_0xad69('0xb4')](_0x43d550[_0xad69('0x5e')]['to'][0x0])?undefined:_0x43d550[_0xad69('0x5e')]['to'][0x0]},client9002);})[_0xad69('0x37')](function(){if(_0x41e6e2){if(_['isNil'](_0x43d550[_0xad69('0x5e')][_0xad69('0xb5')])){_0x43d550[_0xad69('0x5e')]['from']=util[_0xad69('0xa9')](_0xad69('0xb6'),_0x41e6e2['name'],_0x41e6e2[_0xad69('0xb7')]);}if(_0x41e6e2[_0xad69('0xac')]){if(_0x41e6e2['List'][_0xad69('0xb8')][_0xad69('0x5c')]){return _0x41e6e2[_0xad69('0xac')]['Contacts'][0x0];}else{return db[_0xad69('0xb9')]['create'](_[_0xad69('0x1a')](_0x43d550[_0xad69('0x5e')],{'firstName':_0x43d550[_0xad69('0x5e')]['to'][0x0],'phone':_0x43d550[_0xad69('0x5e')]['to'][0x0],'fax':_0x43d550[_0xad69('0x5e')]['to'][0x0],'ListId':_0x41e6e2[_0xad69('0xa5')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xad69('0xba'));}})['then'](function(_0x4a065a){if(_0x4a065a){return db[_0xad69('0x73')]['find']({'where':{'ContactId':_0x4a065a['id'],'closed':![],'FaxAccountId':_0x41e6e2['id']}})[_0xad69('0x37')](function(_0x54faf3){if(_0x54faf3){return[_0x54faf3,![]];}return db[_0xad69('0x73')][_0xad69('0x63')]({'UserId':_0x43d550[_0xad69('0x60')]['id'],'ContactId':_0x4a065a['id'],'FaxAccountId':_0x41e6e2['id'],'fax':_0x43d550[_0xad69('0x5e')]['to'][0x0],'firstMsgDirection':_0xad69('0xbb'),'Messages':[_[_0xad69('0x53')](_0x43d550[_0xad69('0x5e')],{'read':![],'body':_0x43d550[_0xad69('0x5e')]['attachments'][0x0][_0xad69('0xbc')],'FaxAccountId':_0x41e6e2['id'],'UserId':_0x43d550[_0xad69('0x60')]['id'],'ContactId':_0x4a065a['id'],'AttachmentId':_0x43d550[_0xad69('0x5e')][_0xad69('0xae')][0x0]['id']})]},{'include':[{'model':db[_0xad69('0xa7')],'as':_0xad69('0xbd')}]})[_0xad69('0x37')](function(_0x3c40cf){return[_0x3c40cf,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2c62bf,_0x58412e){if(_0x58412e){return _0x2c62bf;}return db[_0xad69('0xa7')][_0xad69('0x63')]({'direction':_0xad69('0xbb'),'read':![],'body':_0x43d550[_0xad69('0x5e')][_0xad69('0xae')][0x0]['filename'],'FaxAccountId':_0x41e6e2['id'],'FaxInteractionId':_0x2c62bf['id'],'UserId':_0x43d550['user']['id'],'ContactId':_0x2c62bf[_0xad69('0xbe')],'AttachmentId':_0x43d550[_0xad69('0x5e')]['attachments'][0x0]['id']})[_0xad69('0x37')](function(_0x26ee30){_0x2c62bf[_0xad69('0xbf')][_0xad69('0xbd')]=[];_0x2c62bf[_0xad69('0xbf')][_0xad69('0xbd')][_0xad69('0x92')](_0x26ee30[_0xad69('0xbf')]);return _0x2c62bf;});})['then'](function(_0x532a17){respondWithRpcPromise(_0xad69('0xc0'),_0xad69('0xc0'),{'FaxAccountId':_['isNil'](_0x43d550[_0xad69('0x65')]['id'])?undefined:_0x43d550['params']['id'],'path':_[_0xad69('0xb4')](_0x43d550[_0xad69('0x5e')]['attachments'][0x0][_0xad69('0x6')])?undefined:_0x43d550['body']['attachments'][0x0][_0xad69('0x6')],'fax':_[_0xad69('0xb4')](_0x43d550[_0xad69('0x5e')]['to'][0x0])?undefined:_0x43d550[_0xad69('0x5e')]['to'][0x0],'AttachmentId':_0x43d550[_0xad69('0x5e')]['attachments'][0x0]['id']},client9002)[_0xad69('0x37')](function(_0x24fbe1){logger['info'](_0xad69('0xc1'),_0x24fbe1);})[_0xad69('0x2b')](function(_0x3ea3f5){logger[_0xad69('0x22')]('SendFaxRpc,\x20%s',_0x3ea3f5);});return _0x532a17;})[_0xad69('0x37')](respondWithResult(_0x44e4c4,null))[_0xad69('0x2b')](handleError(_0x44e4c4,null));};exports['addAgents']=function(_0x29f668,_0x4b28ad,_0xc5fa6c){return db[_0xad69('0x42')][_0xad69('0x5d')]({'where':{'id':_0x29f668['params']['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x4b28ad,null))[_0xad69('0x37')](function(_0x4a1856){if(_0x4a1856){return _0x4a1856[_0xad69('0xc2')](_0x29f668[_0xad69('0x5e')]['ids'],_[_0xad69('0xa0')](_0x29f668['body'],['ids','id'])||{})[_0xad69('0xc3')](function(_0x3ac5df){for(var _0x5ef170=0x0;_0x5ef170<_0x29f668[_0xad69('0x5e')]['ids'][_0xad69('0x5c')];_0x5ef170+=0x1){socket[_0xad69('0xc4')](_0xad69('0xc5'),{'UserId':Number(_0x29f668[_0xad69('0x5e')][_0xad69('0x6e')][_0x5ef170]),'FaxAccountId':Number(_0x29f668['params']['id'])});}return _0x3ac5df;});}})['then'](respondWithResult(_0x4b28ad,null))[_0xad69('0x2b')](handleError(_0x4b28ad,null));};exports[_0xad69('0xc6')]=function(_0x10ee13,_0x55b6ad,_0x39efe8){return db[_0xad69('0x42')][_0xad69('0x5d')]({'where':{'id':_0x10ee13[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x55b6ad,null))['then'](function(_0x4e073b){if(_0x4e073b){return _0x4e073b[_0xad69('0xc6')](_0x10ee13['query'][_0xad69('0x6e')])[_0xad69('0x37')](function(){if(_[_0xad69('0xc7')](_0x10ee13[_0xad69('0x47')][_0xad69('0x6e')])){for(var _0x47d467=0x0;_0x47d467<_0x10ee13[_0xad69('0x47')][_0xad69('0x6e')][_0xad69('0x5c')];_0x47d467+=0x1){socket['emit'](_0xad69('0xc8'),{'UserId':Number(_0x10ee13[_0xad69('0x47')][_0xad69('0x6e')][_0x47d467]),'FaxAccountId':Number(_0x10ee13[_0xad69('0x65')]['id'])});}}else{socket[_0xad69('0xc4')](_0xad69('0xc8'),{'UserId':Number(_0x10ee13[_0xad69('0x47')]['ids']),'FaxAccountId':Number(_0x10ee13[_0xad69('0x65')]['id'])});}});}})['then'](respondWithStatusCode(_0x55b6ad,null))[_0xad69('0x2b')](handleError(_0x55b6ad,null));};exports['getAgents']=function(_0x3e3194,_0xc84963,_0x287778){var _0x28c8f0={};var _0x2fe1ad={};var _0x29d618;var _0x2d624;return db[_0xad69('0x42')]['findOne']({'where':{'id':_0x3e3194[_0xad69('0x65')]['id']}})['then'](handleEntityNotFound(_0xc84963,null))[_0xad69('0x37')](function(_0x9e4634){if(_0x9e4634){_0x29d618=_0x9e4634;_0x2fe1ad[_0xad69('0x4c')]=_[_0xad69('0x48')](db[_0xad69('0x76')]['rawAttributes']);_0x2fe1ad[_0xad69('0x47')]=_[_0xad69('0x48')](_0x3e3194[_0xad69('0x47')]);_0x2fe1ad[_0xad69('0x49')]=_['intersection'](_0x2fe1ad[_0xad69('0x4c')],_0x2fe1ad[_0xad69('0x47')]);_0x28c8f0[_0xad69('0x4b')]=_[_0xad69('0x4a')](_0x2fe1ad[_0xad69('0x4c')],qs['fields'](_0x3e3194['query'][_0xad69('0x4d')]));_0x28c8f0[_0xad69('0x4b')]=_0x28c8f0[_0xad69('0x4b')][_0xad69('0x5c')]?_0x28c8f0[_0xad69('0x4b')]:_0x2fe1ad[_0xad69('0x4c')];_0x28c8f0[_0xad69('0x4f')]=qs[_0xad69('0x50')](_0x3e3194[_0xad69('0x47')][_0xad69('0x50')]);_0x28c8f0[_0xad69('0x54')]=qs[_0xad69('0x49')](_[_0xad69('0x51')](_0x3e3194[_0xad69('0x47')],_0x2fe1ad['filters']));if(_0x3e3194[_0xad69('0x47')][_0xad69('0x52')]){_0x28c8f0['where']=_[_0xad69('0x53')](_0x28c8f0[_0xad69('0x54')],{'$or':_[_0xad69('0x46')](_0x28c8f0['attributes'],function(_0xa9ff19){var _0x37ae1c={};_0x37ae1c[_0xa9ff19]={'$like':'%'+_0x3e3194[_0xad69('0x47')][_0xad69('0x52')]+'%'};return _0x37ae1c;})});}_0x28c8f0=_[_0xad69('0x53')]({},_0x28c8f0,_0x3e3194[_0xad69('0x56')]);return _0x29d618[_0xad69('0xc9')](_0x28c8f0);}})['then'](function(_0x3513f6){if(_0x3513f6){_0x2d624=_0x3513f6[_0xad69('0x5c')];if(!_0x3e3194[_0xad69('0x47')][_0xad69('0x6a')](_0xad69('0x4e'))){_0x28c8f0['limit']=qs['limit'](_0x3e3194['query'][_0xad69('0x2f')]);_0x28c8f0['offset']=qs[_0xad69('0x31')](_0x3e3194['query'][_0xad69('0x31')]);}return _0x29d618[_0xad69('0xc9')](_0x28c8f0);}})[_0xad69('0x37')](function(_0x76a197){if(_0x76a197){return _0x76a197?{'count':_0x2d624,'rows':_0x76a197}:null;}})['then'](respondWithResult(_0xc84963,null))['catch'](handleError(_0xc84963,null));}; \ No newline at end of file +var _0xc638=['status','offset','undefined','limit','count','Content-Range','json','update','destroy','get','FaxAccounts','UserProfileResource','end','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','Pause','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','length','order','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','tag','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','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','ReceiveFax','sequelize','transaction','VoiceExtension','updateAccountApplications','omit','createdAt','updatedAt','TrunkId','findById','FaxMessage','$gte','format','Contacts','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','List','List\x20not\x20found','out','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','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','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./faxAccount.socket','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus'];(function(_0x227993,_0x532b9c){var _0x4dca2f=function(_0x135f3f){while(--_0x135f3f){_0x227993['push'](_0x227993['shift']());}};_0x4dca2f(++_0x532b9c);}(_0xc638,0x93));var _0x8c63=function(_0x5342c0,_0x5071b8){_0x5342c0=_0x5342c0-0x0;var _0x21376c=_0xc638[_0x5342c0];return _0x21376c;};'use strict';var emlformat=require(_0x8c63('0x0'));var rimraf=require(_0x8c63('0x1'));var zipdir=require(_0x8c63('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c63('0x3'));var moment=require(_0x8c63('0x4'));var BPromise=require(_0x8c63('0x5'));var Mustache=require('mustache');var util=require(_0x8c63('0x6'));var path=require(_0x8c63('0x7'));var sox=require(_0x8c63('0x8'));var csv=require(_0x8c63('0x9'));var ejs=require(_0x8c63('0xa'));var fs=require('fs');var fs_extra=require(_0x8c63('0xb'));var _=require(_0x8c63('0xc'));var squel=require(_0x8c63('0xd'));var crypto=require(_0x8c63('0xe'));var jsforce=require(_0x8c63('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8c63('0x9'));var querystring=require('querystring');var Papa=require(_0x8c63('0x10'));var Redis=require('ioredis');var authService=require(_0x8c63('0x11'));var qs=require(_0x8c63('0x12'));var as=require(_0x8c63('0x13'));var hardwareService=require(_0x8c63('0x14'));var logger=require(_0x8c63('0x15'))(_0x8c63('0x16'));var utils=require(_0x8c63('0x17'));var config=require(_0x8c63('0x18'));var licenseUtil=require(_0x8c63('0x19'));var db=require(_0x8c63('0x1a'))['db'];config['redis']=_[_0x8c63('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8c63('0x1c'))(new Redis(config[_0x8c63('0x1d')]));require(_0x8c63('0x1e'))[_0x8c63('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8c63('0x20')][_0x8c63('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10b79f,_0x16e031,_0x449161,_0x54ed0b){return new BPromise(function(_0x2d1ee0,_0x55a6c6){var _0x3c2568=_0x54ed0b||client;return _0x3c2568[_0x8c63('0x22')](_0x10b79f,_0x449161)[_0x8c63('0x23')](function(_0x783cba){logger[_0x8c63('0x24')](_0x8c63('0x25'),_0x16e031,'request\x20sent');logger[_0x8c63('0x26')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x16e031,_0x8c63('0x27'),JSON[_0x8c63('0x28')](_0x783cba));if(_0x783cba[_0x8c63('0x29')]){if(_0x783cba['error'][_0x8c63('0x2a')]===0x1f4){logger[_0x8c63('0x29')]('FaxAccount,\x20%s,\x20%s',_0x16e031,_0x783cba[_0x8c63('0x29')][_0x8c63('0x2b')]);return _0x55a6c6(_0x783cba['error']['message']);}logger[_0x8c63('0x29')]('FaxAccount,\x20%s,\x20%s',_0x16e031,_0x783cba['error'][_0x8c63('0x2b')]);return _0x2d1ee0(_0x783cba[_0x8c63('0x29')][_0x8c63('0x2b')]);}else{logger['info'](_0x8c63('0x25'),_0x16e031,_0x8c63('0x27'));_0x2d1ee0(_0x783cba[_0x8c63('0x2c')][_0x8c63('0x2b')]);}})[_0x8c63('0x2d')](function(_0x5590dd){logger['error'](_0x8c63('0x25'),_0x16e031,_0x5590dd);_0x55a6c6(_0x5590dd);});});}function respondWithStatusCode(_0x49d54a,_0x44b3d7){_0x44b3d7=_0x44b3d7||0xcc;return function(_0x9f9cfc){if(_0x9f9cfc){return _0x49d54a[_0x8c63('0x2e')](_0x44b3d7);}return _0x49d54a[_0x8c63('0x2f')](_0x44b3d7)['end']();};}function respondWithResult(_0x1b77b1,_0x422235){_0x422235=_0x422235||0xc8;return function(_0x5a54b0){if(_0x5a54b0){return _0x1b77b1[_0x8c63('0x2f')](_0x422235)['json'](_0x5a54b0);}};}function respondWithFilteredResult(_0x46dd22,_0x378aed){return function(_0x3751b3){if(_0x3751b3){var _0x2936e4=typeof _0x378aed[_0x8c63('0x30')]===_0x8c63('0x31')&&typeof _0x378aed[_0x8c63('0x32')]===_0x8c63('0x31');var _0x3c3d72=_0x3751b3[_0x8c63('0x33')];var _0x231689=_0x2936e4?0x0:_0x378aed[_0x8c63('0x30')];var _0xf0c713=_0x2936e4?_0x3751b3[_0x8c63('0x33')]:_0x378aed[_0x8c63('0x30')]+_0x378aed[_0x8c63('0x32')];var _0xadc43b;if(_0xf0c713>=_0x3c3d72){_0xf0c713=_0x3c3d72;_0xadc43b=0xc8;}else{_0xadc43b=0xce;}_0x46dd22['status'](_0xadc43b);return _0x46dd22['set'](_0x8c63('0x34'),_0x231689+'-'+_0xf0c713+'/'+_0x3c3d72)[_0x8c63('0x35')](_0x3751b3);}return null;};}function patchUpdates(_0x40e8ad){return function(_0x196096){try{jsonpatch['apply'](_0x196096,_0x40e8ad,!![]);}catch(_0x43ddbf){return BPromise['reject'](_0x43ddbf);}return _0x196096['save']();};}function saveUpdates(_0x530a1e,_0x3ac661){return function(_0x2c3102){if(_0x2c3102){return _0x2c3102[_0x8c63('0x36')](_0x530a1e)[_0x8c63('0x23')](function(_0x95c68e){return _0x95c68e;});}return null;};}function removeEntity(_0x3d51ad,_0x25e7c7){return function(_0x456df1){if(_0x456df1){return _0x456df1[_0x8c63('0x37')]()['then'](function(){var _0xe1840c=_0x456df1[_0x8c63('0x38')]({'plain':!![]});var _0x43f247=_0x8c63('0x39');return db[_0x8c63('0x3a')][_0x8c63('0x37')]({'where':{'type':_0x43f247,'resourceId':_0xe1840c['id']}})['then'](function(){return _0x456df1;});})[_0x8c63('0x23')](function(){_0x3d51ad[_0x8c63('0x2f')](0xcc)[_0x8c63('0x3b')]();});}};}function handleEntityNotFound(_0x1a5f7e,_0x47b419){return function(_0x28b801){if(!_0x28b801){_0x1a5f7e[_0x8c63('0x2e')](0x194);}return _0x28b801;};}function handleError(_0x2e02f0,_0x5ca38e){_0x5ca38e=_0x5ca38e||0x1f4;return function(_0xb33280){logger[_0x8c63('0x29')](_0xb33280[_0x8c63('0x3c')]);if(_0xb33280[_0x8c63('0x3d')]){delete _0xb33280[_0x8c63('0x3d')];}_0x2e02f0['status'](_0x5ca38e)[_0x8c63('0x3e')](_0xb33280);};}exports[_0x8c63('0x3f')]=function(_0x7ff140,_0x1f85d5){var _0xcd0329={'include':[{'model':db['Pause'],'as':_0x8c63('0x40')}]},_0x25ac6c={},_0x160254={'count':0x0,'rows':[]};var _0x546226=_[_0x8c63('0x41')](db[_0x8c63('0x42')][_0x8c63('0x43')],function(_0x30241a){return{'name':_0x30241a[_0x8c63('0x44')],'type':_0x30241a[_0x8c63('0x45')][_0x8c63('0x46')]};});_0x25ac6c[_0x8c63('0x47')]=_[_0x8c63('0x41')](_0x546226,_0x8c63('0x3d'));_0x25ac6c['query']=_[_0x8c63('0x48')](_0x7ff140[_0x8c63('0x49')]);_0x25ac6c['filters']=_[_0x8c63('0x4a')](_0x25ac6c[_0x8c63('0x47')],_0x25ac6c['query']);_0xcd0329[_0x8c63('0x4b')]=_[_0x8c63('0x4a')](_0x25ac6c[_0x8c63('0x47')],qs[_0x8c63('0x4c')](_0x7ff140[_0x8c63('0x49')][_0x8c63('0x4c')]));_0xcd0329[_0x8c63('0x4b')]=_0xcd0329[_0x8c63('0x4b')]['length']?_0xcd0329[_0x8c63('0x4b')]:_0x25ac6c['model'];if(!_0x7ff140[_0x8c63('0x49')][_0x8c63('0x4d')](_0x8c63('0x4e'))){_0xcd0329[_0x8c63('0x32')]=qs[_0x8c63('0x32')](_0x7ff140[_0x8c63('0x49')][_0x8c63('0x32')]);_0xcd0329[_0x8c63('0x30')]=qs[_0x8c63('0x30')](_0x7ff140['query'][_0x8c63('0x30')]);}_0xcd0329['order']=qs[_0x8c63('0x4f')](_0x7ff140[_0x8c63('0x49')][_0x8c63('0x4f')]);_0xcd0329[_0x8c63('0x50')]=qs[_0x8c63('0x51')](_[_0x8c63('0x52')](_0x7ff140[_0x8c63('0x49')],_0x25ac6c[_0x8c63('0x51')]),_0x546226);if(_0x7ff140['query'][_0x8c63('0x53')]){_0xcd0329['where']=_[_0x8c63('0x54')](_0xcd0329[_0x8c63('0x50')],{'$or':_[_0x8c63('0x41')](_0x546226,function(_0x270888){if(_0x270888['type']!==_0x8c63('0x55')){var _0x4b5f24={};_0x4b5f24[_0x270888[_0x8c63('0x3d')]]={'$like':'%'+_0x7ff140['query'][_0x8c63('0x53')]+'%'};return _0x4b5f24;}})});}_0xcd0329=_['merge']({},_0xcd0329,_0x7ff140[_0x8c63('0x56')]);var _0x511ab2={'where':_0xcd0329[_0x8c63('0x50')]};return db['FaxAccount'][_0x8c63('0x33')](_0x511ab2)['then'](function(_0x28043b){_0x160254['count']=_0x28043b;if(_0x7ff140[_0x8c63('0x49')]['includeAll']){_0xcd0329[_0x8c63('0x57')]=[{'all':!![]}];}return db[_0x8c63('0x42')][_0x8c63('0x58')](_0xcd0329);})[_0x8c63('0x23')](function(_0x235248){_0x160254[_0x8c63('0x59')]=_0x235248;return _0x160254;})[_0x8c63('0x23')](respondWithFilteredResult(_0x1f85d5,_0xcd0329))[_0x8c63('0x2d')](handleError(_0x1f85d5,null));};exports[_0x8c63('0x5a')]=function(_0x144c02,_0x33eeef){var _0x5bdf14={'raw':![],'where':{'id':_0x144c02[_0x8c63('0x5b')]['id']},'include':[{'model':db[_0x8c63('0x5c')],'as':_0x8c63('0x40')}]},_0xb265a={};_0xb265a[_0x8c63('0x47')]=_[_0x8c63('0x48')](db['FaxAccount'][_0x8c63('0x43')]);_0xb265a[_0x8c63('0x49')]=_[_0x8c63('0x48')](_0x144c02[_0x8c63('0x49')]);_0xb265a[_0x8c63('0x51')]=_[_0x8c63('0x4a')](_0xb265a[_0x8c63('0x47')],_0xb265a[_0x8c63('0x49')]);_0x5bdf14[_0x8c63('0x4b')]=_[_0x8c63('0x4a')](_0xb265a['model'],qs[_0x8c63('0x4c')](_0x144c02[_0x8c63('0x49')][_0x8c63('0x4c')]));_0x5bdf14['attributes']=_0x5bdf14[_0x8c63('0x4b')]['length']?_0x5bdf14['attributes']:_0xb265a[_0x8c63('0x47')];if(_0x144c02['query'][_0x8c63('0x5d')]){_0x5bdf14['include']=[{'all':!![]}];}_0x5bdf14=_[_0x8c63('0x54')]({},_0x5bdf14,_0x144c02[_0x8c63('0x56')]);return db[_0x8c63('0x42')][_0x8c63('0x5e')](_0x5bdf14)[_0x8c63('0x23')](handleEntityNotFound(_0x33eeef,null))[_0x8c63('0x23')](respondWithResult(_0x33eeef,null))[_0x8c63('0x2d')](handleError(_0x33eeef,null));};exports[_0x8c63('0x5f')]=function(_0x763d4c,_0x3cce68){return db[_0x8c63('0x42')][_0x8c63('0x5f')](_0x763d4c[_0x8c63('0x60')],{})['then'](function(_0x5e4b05){var _0x21b030=_0x763d4c[_0x8c63('0x61')]['get']({'plain':!![]});if(!_0x21b030)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21b030[_0x8c63('0x62')]===_0x8c63('0x61')){var _0x7abb49=_0x5e4b05[_0x8c63('0x38')]({'plain':!![]});var _0x3a0300=_0x8c63('0x39');return db[_0x8c63('0x63')][_0x8c63('0x5e')]({'where':{'name':_0x3a0300,'userProfileId':_0x21b030[_0x8c63('0x64')]},'raw':!![]})[_0x8c63('0x23')](function(_0xe3fd06){if(_0xe3fd06&&_0xe3fd06['autoAssociation']===0x0){return db[_0x8c63('0x3a')][_0x8c63('0x5f')]({'name':_0x7abb49[_0x8c63('0x3d')],'resourceId':_0x7abb49['id'],'type':_0xe3fd06[_0x8c63('0x3d')],'sectionId':_0xe3fd06['id']},{})[_0x8c63('0x23')](function(){return _0x5e4b05;});}else{return _0x5e4b05;}})[_0x8c63('0x2d')](function(_0x4b63f8){logger[_0x8c63('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b63f8);throw _0x4b63f8;});}return _0x5e4b05;})[_0x8c63('0x23')](respondWithResult(_0x3cce68,0xc9))[_0x8c63('0x2d')](handleError(_0x3cce68,null));};exports[_0x8c63('0x36')]=function(_0x1ef282,_0xe146da){if(_0x1ef282[_0x8c63('0x60')]['id']){delete _0x1ef282[_0x8c63('0x60')]['id'];}return db[_0x8c63('0x42')]['find']({'where':{'id':_0x1ef282[_0x8c63('0x5b')]['id']},'include':[{'model':db[_0x8c63('0x5c')],'as':_0x8c63('0x40')}]})[_0x8c63('0x23')](handleEntityNotFound(_0xe146da,null))[_0x8c63('0x23')](saveUpdates(_0x1ef282[_0x8c63('0x60')],null))['then'](respondWithResult(_0xe146da,null))[_0x8c63('0x2d')](handleError(_0xe146da,null));};exports[_0x8c63('0x37')]=function(_0x55771d,_0x2a392c){return db['FaxAccount'][_0x8c63('0x5e')]({'where':{'id':_0x55771d[_0x8c63('0x5b')]['id']}})[_0x8c63('0x23')](handleEntityNotFound(_0x2a392c,null))[_0x8c63('0x23')](removeEntity(_0x2a392c,null))[_0x8c63('0x2d')](handleError(_0x2a392c,null));};exports[_0x8c63('0x65')]=function(_0x3042ff,_0x3bc658){return db[_0x8c63('0x42')]['describe']()[_0x8c63('0x23')](respondWithResult(_0x3bc658,null))['catch'](handleError(_0x3bc658,null));};exports[_0x8c63('0x66')]=function(_0x3e810b,_0x31efb4,_0x31cdbf){if(_0x3e810b[_0x8c63('0x60')]['id']){delete _0x3e810b['body']['id'];}return db[_0x8c63('0x42')][_0x8c63('0x5e')]({'where':{'id':_0x3e810b[_0x8c63('0x5b')]['id']}})[_0x8c63('0x23')](handleEntityNotFound(_0x31efb4,null))[_0x8c63('0x23')](function(_0x438d02){if(_0x438d02){_0x3e810b[_0x8c63('0x60')][_0x8c63('0x67')]=_0x438d02['id'];return db[_0x8c63('0x68')][_0x8c63('0x5f')](_0x3e810b['body']);}})['then'](respondWithResult(_0x31efb4,null))[_0x8c63('0x2d')](handleError(_0x31efb4,null));};exports[_0x8c63('0x69')]=function(_0x43844e,_0xf28f65,_0x4fe45c){var _0x2f63a0={'raw':![],'where':{}};var _0x457443={};var _0x4c678f={'count':0x0,'rows':[]};return db[_0x8c63('0x42')][_0x8c63('0x6a')]({'where':{'id':_0x43844e['params']['id']}})[_0x8c63('0x23')](handleEntityNotFound(_0xf28f65,null))[_0x8c63('0x23')](function(_0x58dc11){if(_0x58dc11){_0x457443[_0x8c63('0x47')]=_[_0x8c63('0x48')](db[_0x8c63('0x68')][_0x8c63('0x43')]);_0x457443[_0x8c63('0x49')]=_[_0x8c63('0x48')](_0x43844e[_0x8c63('0x49')]);_0x457443[_0x8c63('0x51')]=_['intersection'](_0x457443[_0x8c63('0x47')],_0x457443['query']);_0x2f63a0[_0x8c63('0x4b')]=_[_0x8c63('0x4a')](_0x457443[_0x8c63('0x47')],qs[_0x8c63('0x4c')](_0x43844e[_0x8c63('0x49')][_0x8c63('0x4c')]));_0x2f63a0[_0x8c63('0x4b')]=_0x2f63a0[_0x8c63('0x4b')][_0x8c63('0x6b')]?_0x2f63a0[_0x8c63('0x4b')]:_0x457443['model'];if(!_0x43844e[_0x8c63('0x49')][_0x8c63('0x4d')](_0x8c63('0x4e'))){_0x2f63a0[_0x8c63('0x32')]=qs[_0x8c63('0x32')](_0x43844e[_0x8c63('0x49')]['limit']);_0x2f63a0[_0x8c63('0x30')]=qs[_0x8c63('0x30')](_0x43844e[_0x8c63('0x49')][_0x8c63('0x30')]);}_0x2f63a0[_0x8c63('0x6c')]=qs['sort'](_0x43844e[_0x8c63('0x49')][_0x8c63('0x4f')]);_0x2f63a0[_0x8c63('0x50')]=qs[_0x8c63('0x51')](_[_0x8c63('0x52')](_0x43844e['query'],_0x457443[_0x8c63('0x51')]));_0x2f63a0[_0x8c63('0x50')][_0x8c63('0x67')]=_0x58dc11['id'];if(_0x43844e[_0x8c63('0x49')][_0x8c63('0x53')]){_0x2f63a0[_0x8c63('0x50')]=_[_0x8c63('0x54')](_0x2f63a0[_0x8c63('0x50')],{'$or':_[_0x8c63('0x41')](_0x2f63a0[_0x8c63('0x4b')],function(_0x246471){var _0x2fb36b={};_0x2fb36b[_0x246471]={'$like':'%'+_0x43844e[_0x8c63('0x49')][_0x8c63('0x53')]+'%'};return _0x2fb36b;})});}_0x2f63a0=_[_0x8c63('0x54')]({},_0x2f63a0,_0x43844e['options']);return db[_0x8c63('0x68')][_0x8c63('0x33')]({'where':_0x2f63a0[_0x8c63('0x50')]})['then'](function(_0x76c7c7){_0x4c678f['count']=_0x76c7c7;if(_0x43844e[_0x8c63('0x49')][_0x8c63('0x5d')]){_0x2f63a0[_0x8c63('0x57')]=[{'all':!![]}];}return db[_0x8c63('0x68')][_0x8c63('0x58')](_0x2f63a0);})[_0x8c63('0x23')](function(_0x15a087){_0x4c678f[_0x8c63('0x59')]=_0x15a087;return _0x4c678f;});}})['then'](respondWithFilteredResult(_0xf28f65,_0x2f63a0))['catch'](handleError(_0xf28f65,null));};exports['removeDispositions']=function(_0x1c95cd,_0x2beb2b,_0x7f5d66){return db[_0x8c63('0x42')][_0x8c63('0x5e')]({'where':{'id':_0x1c95cd[_0x8c63('0x5b')]['id']}})[_0x8c63('0x23')](handleEntityNotFound(_0x2beb2b,null))[_0x8c63('0x23')](function(_0x12d504){if(_0x12d504){return _0x12d504['removeDispositions'](_0x1c95cd[_0x8c63('0x49')][_0x8c63('0x6d')]);}})[_0x8c63('0x23')](respondWithStatusCode(_0x2beb2b,null))[_0x8c63('0x2d')](handleError(_0x2beb2b,null));};exports[_0x8c63('0x6e')]=function(_0x413db2,_0x3dd170,_0x564123){if(_0x413db2[_0x8c63('0x60')]['id']){delete _0x413db2[_0x8c63('0x60')]['id'];}return db['FaxAccount'][_0x8c63('0x5e')]({'where':{'id':_0x413db2[_0x8c63('0x5b')]['id']}})[_0x8c63('0x23')](handleEntityNotFound(_0x3dd170,null))['then'](function(_0x3ad1f4){if(_0x3ad1f4){_0x413db2[_0x8c63('0x60')][_0x8c63('0x67')]=_0x3ad1f4['id'];return db[_0x8c63('0x6f')][_0x8c63('0x5f')](_0x413db2[_0x8c63('0x60')]);}})[_0x8c63('0x23')](respondWithResult(_0x3dd170,null))[_0x8c63('0x2d')](handleError(_0x3dd170,null));};exports[_0x8c63('0x70')]=function(_0x525c3e,_0x44a700,_0x36beb2){var _0x1d94f4={'raw':![],'where':{}};var _0x3f6f35={};var _0x14dda1={'count':0x0,'rows':[]};return db['FaxAccount'][_0x8c63('0x6a')]({'where':{'id':_0x525c3e[_0x8c63('0x5b')]['id']}})['then'](handleEntityNotFound(_0x44a700,null))[_0x8c63('0x23')](function(_0x4f5040){if(_0x4f5040){_0x3f6f35['model']=_[_0x8c63('0x48')](db['CannedAnswer'][_0x8c63('0x43')]);_0x3f6f35['query']=_[_0x8c63('0x48')](_0x525c3e[_0x8c63('0x49')]);_0x3f6f35[_0x8c63('0x51')]=_[_0x8c63('0x4a')](_0x3f6f35['model'],_0x3f6f35[_0x8c63('0x49')]);_0x1d94f4['attributes']=_[_0x8c63('0x4a')](_0x3f6f35[_0x8c63('0x47')],qs[_0x8c63('0x4c')](_0x525c3e[_0x8c63('0x49')][_0x8c63('0x4c')]));_0x1d94f4[_0x8c63('0x4b')]=_0x1d94f4['attributes'][_0x8c63('0x6b')]?_0x1d94f4['attributes']:_0x3f6f35[_0x8c63('0x47')];if(!_0x525c3e['query'][_0x8c63('0x4d')](_0x8c63('0x4e'))){_0x1d94f4['limit']=qs['limit'](_0x525c3e[_0x8c63('0x49')][_0x8c63('0x32')]);_0x1d94f4[_0x8c63('0x30')]=qs['offset'](_0x525c3e[_0x8c63('0x49')]['offset']);}_0x1d94f4[_0x8c63('0x6c')]=qs[_0x8c63('0x4f')](_0x525c3e[_0x8c63('0x49')][_0x8c63('0x4f')]);_0x1d94f4[_0x8c63('0x50')]=qs[_0x8c63('0x51')](_[_0x8c63('0x52')](_0x525c3e[_0x8c63('0x49')],_0x3f6f35['filters']));_0x1d94f4[_0x8c63('0x50')][_0x8c63('0x67')]=_0x4f5040['id'];if(_0x525c3e['query'][_0x8c63('0x53')]){_0x1d94f4[_0x8c63('0x50')]=_[_0x8c63('0x54')](_0x1d94f4[_0x8c63('0x50')],{'$or':_[_0x8c63('0x41')](_0x1d94f4[_0x8c63('0x4b')],function(_0x14e72e){var _0x23de7c={};_0x23de7c[_0x14e72e]={'$like':'%'+_0x525c3e['query'][_0x8c63('0x53')]+'%'};return _0x23de7c;})});}_0x1d94f4=_[_0x8c63('0x54')]({},_0x1d94f4,_0x525c3e[_0x8c63('0x56')]);return db[_0x8c63('0x6f')][_0x8c63('0x33')]({'where':_0x1d94f4[_0x8c63('0x50')]})['then'](function(_0x1de1d6){_0x14dda1[_0x8c63('0x33')]=_0x1de1d6;if(_0x525c3e[_0x8c63('0x49')][_0x8c63('0x5d')]){_0x1d94f4[_0x8c63('0x57')]=[{'all':!![]}];}return db[_0x8c63('0x6f')][_0x8c63('0x58')](_0x1d94f4);})['then'](function(_0x36f6d5){_0x14dda1[_0x8c63('0x59')]=_0x36f6d5;return _0x14dda1;});}})[_0x8c63('0x23')](respondWithFilteredResult(_0x44a700,_0x1d94f4))['catch'](handleError(_0x44a700,null));};exports['removeAnswers']=function(_0x13bba2,_0x30b4e7,_0x50640c){return db['FaxAccount'][_0x8c63('0x5e')]({'where':{'id':_0x13bba2['params']['id']}})['then'](handleEntityNotFound(_0x30b4e7,null))[_0x8c63('0x23')](function(_0x79f2ac){if(_0x79f2ac){return _0x79f2ac[_0x8c63('0x71')](_0x13bba2['query'][_0x8c63('0x6d')]);}})[_0x8c63('0x23')](respondWithStatusCode(_0x30b4e7,null))[_0x8c63('0x2d')](handleError(_0x30b4e7,null));};exports['addInteraction']=function(_0x2c0d72,_0x1321aa,_0x6272af){return db[_0x8c63('0x72')]['find']({'where':{'id':_0x2c0d72['params']['id']}})[_0x8c63('0x23')](handleEntityNotFound(_0x1321aa,null))[_0x8c63('0x23')](function(_0x32acff){if(_0x32acff){return _0x32acff['addInteraction'](_0x2c0d72[_0x8c63('0x60')][_0x8c63('0x6d')],_['omit'](_0x2c0d72['body'],[_0x8c63('0x6d'),'id'])||{});}})[_0x8c63('0x23')](respondWithResult(_0x1321aa,null))[_0x8c63('0x2d')](handleError(_0x1321aa,null));};exports[_0x8c63('0x73')]=function(_0xcac751,_0x4a1778,_0x576fa7){var _0x4ca20f={'raw':![],'where':{}};var _0x2a7c7d={};var _0x1aa36c={'count':0x0,'rows':[]};return db[_0x8c63('0x42')][_0x8c63('0x6a')]({'where':{'id':_0xcac751[_0x8c63('0x5b')]['id']}})[_0x8c63('0x23')](handleEntityNotFound(_0x4a1778,null))[_0x8c63('0x23')](function(_0x981e5b){if(_0x981e5b){_0x2a7c7d['model']=_[_0x8c63('0x48')](db[_0x8c63('0x72')][_0x8c63('0x43')]);_0x2a7c7d[_0x8c63('0x49')]=_[_0x8c63('0x48')](_0xcac751['query']);_0x2a7c7d['filters']=_[_0x8c63('0x4a')](_0x2a7c7d[_0x8c63('0x47')],_0x2a7c7d[_0x8c63('0x49')]);_0x4ca20f[_0x8c63('0x4b')]=_[_0x8c63('0x4a')](_0x2a7c7d['model'],qs[_0x8c63('0x4c')](_0xcac751[_0x8c63('0x49')]['fields']));_0x4ca20f[_0x8c63('0x4b')]=_0x4ca20f['attributes'][_0x8c63('0x6b')]?_0x4ca20f[_0x8c63('0x4b')]:_0x2a7c7d['model'];if(!_0xcac751[_0x8c63('0x49')][_0x8c63('0x4d')](_0x8c63('0x4e'))){_0x4ca20f['limit']=qs[_0x8c63('0x32')](_0xcac751[_0x8c63('0x49')]['limit']);_0x4ca20f[_0x8c63('0x30')]=qs[_0x8c63('0x30')](_0xcac751[_0x8c63('0x49')][_0x8c63('0x30')]);}_0x4ca20f['order']=qs[_0x8c63('0x4f')](_0xcac751[_0x8c63('0x49')][_0x8c63('0x4f')]);_0x4ca20f['where']=qs[_0x8c63('0x51')](_['pick'](_0xcac751[_0x8c63('0x49')],_0x2a7c7d[_0x8c63('0x51')]));_0x4ca20f['where'][_0x8c63('0x67')]=_0x981e5b['id'];if(_0xcac751[_0x8c63('0x49')][_0x8c63('0x53')]){_0x4ca20f[_0x8c63('0x50')]=_[_0x8c63('0x54')](_0x4ca20f['where'],{'$or':_[_0x8c63('0x41')](_0x4ca20f[_0x8c63('0x4b')],function(_0x47964c){var _0x30567c={};_0x30567c[_0x47964c]={'$like':'%'+_0xcac751[_0x8c63('0x49')]['filter']+'%'};return _0x30567c;})});}_0x4ca20f=_['merge']({},_0x4ca20f,_0xcac751['options']);return db[_0x8c63('0x72')][_0x8c63('0x33')]({'where':_0x4ca20f[_0x8c63('0x50')]})['then'](function(_0x5cf847){_0x1aa36c[_0x8c63('0x33')]=_0x5cf847;if(_0xcac751[_0x8c63('0x49')][_0x8c63('0x5d')]){_0x4ca20f[_0x8c63('0x57')]=[{'model':db[_0x8c63('0x74')],'as':_0x8c63('0x75'),'required':![]},{'model':db[_0x8c63('0x76')],'as':_0x8c63('0x77'),'attributes':[_0x8c63('0x3d'),_0x8c63('0x78'),_0x8c63('0x79')],'required':![]},{'model':db[_0x8c63('0x7a')],'as':'Tags','attributes':['id',_0x8c63('0x3d'),'color'],'where':_0xcac751['query'][_0x8c63('0x7b')]?{'id':_0xcac751[_0x8c63('0x49')]['tag']}:undefined,'required':_0xcac751[_0x8c63('0x49')]['tag']?!![]:![]}];}return db[_0x8c63('0x72')]['findAll'](_0x4ca20f);})[_0x8c63('0x23')](function(_0x21f5b3){_0x1aa36c['rows']=_0x21f5b3;return _0x1aa36c;});}})[_0x8c63('0x23')](respondWithFilteredResult(_0x4a1778,_0x4ca20f))[_0x8c63('0x2d')](handleError(_0x4a1778,null));};exports[_0x8c63('0x7c')]=function(_0x36b97c,_0x5416b8){var _0x5cb01e=_0x36b97c[_0x8c63('0x5b')]['id'];var _0x457f9c=_0x36b97c['body'];var _0x470859=0xc8;var _0x87cd10=null;return db['sequelize']['transaction']({'isolationLevel':db['sequelize'][_0x8c63('0x7d')][_0x8c63('0x7e')][_0x8c63('0x7f')]},function(_0x4590b2){return db['FaxAccount']['findOne']({'where':{'id':_0x5cb01e},'transaction':_0x4590b2})[_0x8c63('0x23')](function(_0x29d8f0){if(_0x29d8f0){return db[_0x8c63('0x80')]['destroy']({'where':{'FaxAccountId':_0x5cb01e},'transaction':_0x4590b2})['then'](function(){var _0x3466ac=_[_0x8c63('0x41')](_0x457f9c,function(_0x42d9ab){_0x42d9ab[_0x8c63('0x67')]=_0x5cb01e;return _0x42d9ab;});return db['FaxApplication'][_0x8c63('0x81')](_0x3466ac,{'transaction':_0x4590b2});});}else{_0x470859=0x194;_0x87cd10=[];}});})[_0x8c63('0x23')](function(){if(_0x470859!==0x194){return db[_0x8c63('0x80')][_0x8c63('0x82')]({'where':{'FaxAccountId':_0x5cb01e},'order':_0x8c63('0x83')})[_0x8c63('0x23')](function(_0x2f338c){_0x87cd10=_0x2f338c;});}})[_0x8c63('0x2d')](function(_0x21b27f){_0x470859=0x1f4;logger['error'](_0x21b27f[_0x8c63('0x3c')]);if(_0x21b27f[_0x8c63('0x3d')]){delete _0x21b27f[_0x8c63('0x3d')];}_0x87cd10=_0x21b27f;})[_0x8c63('0x84')](function(){if(_0x87cd10===null){_0x5416b8[_0x8c63('0x2e')](_0x470859);}else{if(_0x470859===0x1f4){_0x5416b8[_0x8c63('0x2f')](_0x470859)[_0x8c63('0x3e')](_0x87cd10);}else{_0x5416b8[_0x8c63('0x2f')](_0x470859)[_0x8c63('0x35')](_0x87cd10);}}});};exports[_0x8c63('0x85')]=function(_0x192704,_0x5af155,_0x1ac53d){var _0x192133={};var _0x22d5d9={};var _0x1cbd77;var _0xf109b8;return db[_0x8c63('0x42')][_0x8c63('0x6a')]({'where':{'id':_0x192704[_0x8c63('0x5b')]['id']}})[_0x8c63('0x23')](handleEntityNotFound(_0x5af155,null))[_0x8c63('0x23')](function(_0x37f483){if(_0x37f483){_0x1cbd77=_0x37f483;_0x22d5d9['model']=_[_0x8c63('0x48')](db[_0x8c63('0x80')]['rawAttributes']);_0x22d5d9[_0x8c63('0x49')]=_[_0x8c63('0x48')](_0x192704[_0x8c63('0x49')]);_0x22d5d9['filters']=_[_0x8c63('0x4a')](_0x22d5d9[_0x8c63('0x47')],_0x22d5d9[_0x8c63('0x49')]);_0x192133[_0x8c63('0x4b')]=_[_0x8c63('0x4a')](_0x22d5d9[_0x8c63('0x47')],qs[_0x8c63('0x4c')](_0x192704[_0x8c63('0x49')][_0x8c63('0x4c')]));_0x192133[_0x8c63('0x4b')]=_0x192133[_0x8c63('0x4b')][_0x8c63('0x6b')]?_0x192133['attributes']:_0x22d5d9[_0x8c63('0x47')];_0x192133[_0x8c63('0x6c')]=qs[_0x8c63('0x4f')](_0x192704[_0x8c63('0x49')][_0x8c63('0x4f')]);_0x192133[_0x8c63('0x50')]=qs[_0x8c63('0x51')](_[_0x8c63('0x52')](_0x192704[_0x8c63('0x49')],_0x22d5d9['filters']));if(_0x192704[_0x8c63('0x49')][_0x8c63('0x53')]){_0x192133['where']=_[_0x8c63('0x54')](_0x192133[_0x8c63('0x50')],{'$or':_[_0x8c63('0x41')](_0x192133[_0x8c63('0x4b')],function(_0x47ae27){var _0x29a4dd={};_0x29a4dd[_0x47ae27]={'$like':'%'+_0x192704[_0x8c63('0x49')][_0x8c63('0x53')]+'%'};return _0x29a4dd;})});}_0x192133=_[_0x8c63('0x54')]({},_0x192133,_0x192704[_0x8c63('0x56')]);return _0x1cbd77[_0x8c63('0x85')](_0x192133);}})[_0x8c63('0x23')](function(_0x52142f){if(_0x52142f){_0xf109b8=_0x52142f[_0x8c63('0x6b')];if(!_0x192704['query'][_0x8c63('0x4d')](_0x8c63('0x4e'))){_0x192133[_0x8c63('0x32')]=qs[_0x8c63('0x32')](_0x192704[_0x8c63('0x49')][_0x8c63('0x32')]);_0x192133['offset']=qs['offset'](_0x192704[_0x8c63('0x49')][_0x8c63('0x30')]);}return _0x1cbd77['getApplications'](_0x192133);}})[_0x8c63('0x23')](function(_0x265a26){if(_0x265a26){return _0x265a26?{'count':_0xf109b8,'rows':_0x265a26}:null;}})[_0x8c63('0x23')](respondWithResult(_0x5af155,null))[_0x8c63('0x2d')](handleError(_0x5af155,null));};function Extension(_0x5d4cb1,_0x1f151a,_0x14fa66,_0x37aff1){this['context']=_0x8c63('0x86');this[_0x8c63('0x87')]=_0x5d4cb1['localstationid'];this[_0x8c63('0x88')]=_0x37aff1;this[_0x8c63('0x45')]=_0x8c63('0x89');this[_0x8c63('0x8a')]=_0x8c63('0x8b');this[_0x8c63('0x67')]=_0x5d4cb1['id'];this[_0x8c63('0x83')]=_0x1f151a;this[_0x8c63('0x8c')]=_0x14fa66;}function createExtensionsReciveFax(_0x2c1d76){var _0x2aad4a=0x1;var _0x4e8a36=[];_0x4e8a36[_0x8c63('0x8d')](new Extension(_0x2c1d76,_0x2aad4a,'',_0x8c63('0x8e')));_0x2aad4a+=0x1;_0x4e8a36[_0x8c63('0x8d')](new Extension(_0x2c1d76,_0x2aad4a,_0x8c63('0x8f'),_0x8c63('0x90')));_0x2aad4a+=0x1;for(var _0x1a61fd in _0x2c1d76){if(_0x2c1d76['hasOwnProperty'](_0x1a61fd)&&(_0x1a61fd===_0x8c63('0x91')||_0x1a61fd===_0x8c63('0x92')||_0x1a61fd===_0x8c63('0x93')||_0x1a61fd===_0x8c63('0x94')||_0x1a61fd===_0x8c63('0x95')||_0x1a61fd===_0x8c63('0x96')||_0x1a61fd===_0x8c63('0x97')||_0x1a61fd===_0x8c63('0x98')||_0x1a61fd===_0x8c63('0x99'))){_0x4e8a36[_0x8c63('0x8d')](new Extension(_0x2c1d76,_0x2aad4a,_0x8c63('0x9a')+_0x1a61fd+')='+_0x2c1d76[_0x1a61fd],'Set'));_0x2aad4a+=0x1;}}_0x4e8a36[_0x8c63('0x8d')](new Extension(_0x2c1d76,_0x2aad4a,'6',_0x8c63('0x9b')));_0x2aad4a+=0x1;_0x4e8a36[_0x8c63('0x8d')](new Extension(_0x2c1d76,_0x2aad4a,_0x8c63('0x9c'),_0x8c63('0x9d')));_0x2aad4a=0x0;return _0x4e8a36;}exports['addAccountApplications']=function(_0x3950f1,_0x5b5604,_0x4fec8a){var _0x32d353;return db[_0x8c63('0x9e')][_0x8c63('0x9f')](function(_0x1dece5){return db[_0x8c63('0x42')][_0x8c63('0x5f')](_0x3950f1[_0x8c63('0x60')],{'transaction':_0x1dece5})[_0x8c63('0x23')](function(_0x299869){_0x32d353=_0x299869[_0x8c63('0x38')]({'plain':!![]});return db[_0x8c63('0xa0')][_0x8c63('0x81')](createExtensionsReciveFax(_0x32d353),{'transaction':_0x1dece5});});})[_0x8c63('0x23')](function(){return _0x32d353;})[_0x8c63('0x23')](respondWithResult(_0x5b5604,null))['catch'](handleError(_0x5b5604,null));};exports[_0x8c63('0xa1')]=function(_0x446257,_0x29ef05,_0x246954){var _0x238273;return db[_0x8c63('0x9e')][_0x8c63('0x9f')](function(_0xdc7875){return db['FaxAccount'][_0x8c63('0x36')](_0x446257[_0x8c63('0x60')],{'where':{'id':_0x446257[_0x8c63('0x60')]['id']},'transaction':_0xdc7875})[_0x8c63('0x23')](function(_0x37d807){return db[_0x8c63('0xa0')][_0x8c63('0x37')]({'where':{'FaxAccountId':_0x446257['body']['id']},'transaction':_0xdc7875})[_0x8c63('0x23')](function(_0x10e34a){return db[_0x8c63('0xa0')][_0x8c63('0x81')](createExtensionsReciveFax(_[_0x8c63('0xa2')](_0x446257['body'],['tech',_0x8c63('0x46'),_0x8c63('0xa3'),_0x8c63('0xa4'),_0x8c63('0xa5'),'ListId'])),{'transaction':_0xdc7875});});});})[_0x8c63('0x23')](function(){return db[_0x8c63('0x42')][_0x8c63('0xa6')](_0x446257[_0x8c63('0x60')]['id']);})[_0x8c63('0x23')](respondWithResult(_0x29ef05,null))[_0x8c63('0x2d')](handleError(_0x29ef05,null));};exports['getMessages']=function(_0x2a2763,_0x3b3e55,_0x38e0ca){var _0x5546a9={'raw':!![],'where':{}};var _0x3a9a9a={};var _0x508e70={'count':0x0,'rows':[]};return db[_0x8c63('0x42')][_0x8c63('0x6a')]({'where':{'id':_0x2a2763[_0x8c63('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3b3e55,null))[_0x8c63('0x23')](function(_0x55c981){if(_0x55c981){_0x3a9a9a['model']=_[_0x8c63('0x48')](db[_0x8c63('0xa7')][_0x8c63('0x43')]);_0x3a9a9a['query']=_[_0x8c63('0x48')](_0x2a2763[_0x8c63('0x49')]);_0x3a9a9a[_0x8c63('0x51')]=_['intersection'](_0x3a9a9a[_0x8c63('0x47')],_0x3a9a9a[_0x8c63('0x49')]);_0x5546a9[_0x8c63('0x4b')]=_['intersection'](_0x3a9a9a['model'],qs[_0x8c63('0x4c')](_0x2a2763[_0x8c63('0x49')]['fields']));_0x5546a9[_0x8c63('0x4b')]=_0x5546a9[_0x8c63('0x4b')][_0x8c63('0x6b')]?_0x5546a9['attributes']:_0x3a9a9a[_0x8c63('0x47')];if(!_0x2a2763['query'][_0x8c63('0x4d')](_0x8c63('0x4e'))){_0x5546a9[_0x8c63('0x32')]=qs['limit'](_0x2a2763['query']['limit']);_0x5546a9[_0x8c63('0x30')]=qs[_0x8c63('0x30')](_0x2a2763[_0x8c63('0x49')]['offset']);}_0x5546a9['order']=qs[_0x8c63('0x4f')](_0x2a2763[_0x8c63('0x49')][_0x8c63('0x4f')]);_0x5546a9[_0x8c63('0x50')]=qs[_0x8c63('0x51')](_[_0x8c63('0x52')](_0x2a2763[_0x8c63('0x49')],_0x3a9a9a['filters']));_0x5546a9['where'][_0x8c63('0x67')]=_0x55c981['id'];if(_0x2a2763[_0x8c63('0x49')][_0x8c63('0x53')]){_0x5546a9[_0x8c63('0x50')]=_[_0x8c63('0x54')](_0x5546a9['where'],{'$or':_[_0x8c63('0x41')](_0x5546a9[_0x8c63('0x4b')],function(_0x4ed856){var _0x2712dc={};_0x2712dc[_0x4ed856]={'$like':'%'+_0x2a2763[_0x8c63('0x49')][_0x8c63('0x53')]+'%'};return _0x2712dc;})});}if(_0x2a2763[_0x8c63('0x49')][_0x8c63('0xa8')]){var _0x59a80f=_0x2a2763[_0x8c63('0x49')][_0x8c63('0xa8')]['split'](',');var _0x122be1={};_0x122be1[_0x59a80f[0x0]]={'$gte':moment(_0x59a80f[0x1])[_0x8c63('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5546a9[_0x8c63('0x50')]=_['merge'](_0x5546a9[_0x8c63('0x50')],_0x122be1);}_0x5546a9=_[_0x8c63('0x54')]({},_0x5546a9,_0x2a2763['options']);return db['FaxMessage']['count']({'where':_0x5546a9[_0x8c63('0x50')]})[_0x8c63('0x23')](function(_0x386e3a){_0x508e70['count']=_0x386e3a;if(_0x2a2763[_0x8c63('0x49')][_0x8c63('0x5d')]){_0x5546a9['include']=[{'all':!![]}];}return db[_0x8c63('0xa7')]['findAll'](_0x5546a9);})[_0x8c63('0x23')](function(_0x389c67){_0x508e70[_0x8c63('0x59')]=_0x389c67;return _0x508e70;});}})['then'](respondWithFilteredResult(_0x3b3e55,_0x5546a9))[_0x8c63('0x2d')](handleError(_0x3b3e55,null));};exports[_0x8c63('0x3e')]=function(_0x289c31,_0x47a62b,_0x19d1a4){var _0x381485,_0x505eb8={},_0x362930;if(_0x289c31[_0x8c63('0x60')]['to']){_0x362930=_0x289c31[_0x8c63('0x60')]['to'][0x0];}return db['FaxAccount'][_0x8c63('0x5e')]({'where':{'id':_0x289c31['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8c63('0x74')],'as':_0x8c63('0xaa'),'where':{'fax':_0x362930},'limit':0x1,'order':[[_0x8c63('0xa4'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x47a62b,null))['then'](function(_0x34e945){_0x381485=_0x34e945;if(_0x289c31[_0x8c63('0x60')]['attachments']&&_0x289c31[_0x8c63('0x60')][_0x8c63('0xab')][_0x8c63('0x6b')]){for(var _0x519b3f=0x0;_0x519b3f<_0x289c31[_0x8c63('0x60')][_0x8c63('0xab')]['length'];_0x519b3f+=0x1){_0x289c31[_0x8c63('0x60')][_0x8c63('0xab')][_0x519b3f]={'filename':_0x289c31[_0x8c63('0x60')]['attachments'][_0x519b3f]['name'],'id':_0x289c31[_0x8c63('0x60')][_0x8c63('0xab')][_0x519b3f]['id'],'path':path['join'](config[_0x8c63('0xac')],_0x8c63('0xad'),_0x289c31['body'][_0x8c63('0xab')][_0x519b3f][_0x8c63('0xae')])};}}return respondWithRpcPromise(_0x8c63('0xaf'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x289c31[_0x8c63('0x5b')]['id'])?undefined:_0x289c31[_0x8c63('0x5b')]['id'],'path':_[_0x8c63('0xb0')](_0x289c31['body'][_0x8c63('0xab')][0x0][_0x8c63('0x7')])?undefined:_0x289c31[_0x8c63('0x60')]['attachments'][0x0]['path'],'fax':_[_0x8c63('0xb0')](_0x289c31[_0x8c63('0x60')]['to'][0x0])?undefined:_0x289c31[_0x8c63('0x60')]['to'][0x0]},client9002);})['then'](function(){if(_0x381485){if(_[_0x8c63('0xb0')](_0x289c31[_0x8c63('0x60')][_0x8c63('0xb1')])){_0x289c31[_0x8c63('0x60')][_0x8c63('0xb1')]=util[_0x8c63('0xa9')]('\x22%s\x22\x20<%s>',_0x381485[_0x8c63('0x3d')],_0x381485[_0x8c63('0xb2')]);}if(_0x381485['List']){if(_0x381485[_0x8c63('0xb3')][_0x8c63('0xaa')][_0x8c63('0x6b')]){return _0x381485[_0x8c63('0xb3')][_0x8c63('0xaa')][0x0];}else{return db[_0x8c63('0x74')][_0x8c63('0x5f')](_[_0x8c63('0x1b')](_0x289c31[_0x8c63('0x60')],{'firstName':_0x289c31[_0x8c63('0x60')]['to'][0x0],'phone':_0x289c31[_0x8c63('0x60')]['to'][0x0],'fax':_0x289c31[_0x8c63('0x60')]['to'][0x0],'ListId':_0x381485['ListId']}));}}else{throw new Error(_0x8c63('0xb4'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x8c63('0x23')](function(_0x1e93ff){if(_0x1e93ff){return db[_0x8c63('0x72')][_0x8c63('0x5e')]({'where':{'ContactId':_0x1e93ff['id'],'closed':![],'FaxAccountId':_0x381485['id']}})[_0x8c63('0x23')](function(_0x45ca92){if(_0x45ca92){return[_0x45ca92,![]];}return db['FaxInteraction'][_0x8c63('0x5f')]({'UserId':_0x289c31[_0x8c63('0x61')]['id'],'ContactId':_0x1e93ff['id'],'FaxAccountId':_0x381485['id'],'fax':_0x289c31['body']['to'][0x0],'firstMsgDirection':_0x8c63('0xb5'),'Messages':[_[_0x8c63('0x54')](_0x289c31[_0x8c63('0x60')],{'read':![],'body':_0x289c31[_0x8c63('0x60')][_0x8c63('0xab')][0x0]['filename'],'FaxAccountId':_0x381485['id'],'UserId':_0x289c31['user']['id'],'ContactId':_0x1e93ff['id'],'AttachmentId':_0x289c31['body'][_0x8c63('0xab')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x8c63('0xb6')}]})[_0x8c63('0x23')](function(_0x50b0ca){return[_0x50b0ca,!![]];});});}else{throw new Error(_0x8c63('0xb7'));}})[_0x8c63('0xb8')](function(_0x45e016,_0x59e86e){if(_0x59e86e){return _0x45e016;}return db['FaxMessage'][_0x8c63('0x5f')]({'direction':_0x8c63('0xb5'),'read':![],'body':_0x289c31[_0x8c63('0x60')]['attachments'][0x0]['filename'],'FaxAccountId':_0x381485['id'],'FaxInteractionId':_0x45e016['id'],'UserId':_0x289c31[_0x8c63('0x61')]['id'],'ContactId':_0x45e016[_0x8c63('0xb9')],'AttachmentId':_0x289c31[_0x8c63('0x60')][_0x8c63('0xab')][0x0]['id']})[_0x8c63('0x23')](function(_0x64275a){_0x45e016['dataValues'][_0x8c63('0xb6')]=[];_0x45e016['dataValues'][_0x8c63('0xb6')][_0x8c63('0x8d')](_0x64275a[_0x8c63('0xba')]);return _0x45e016;});})[_0x8c63('0x23')](function(_0x318ac5){respondWithRpcPromise(_0x8c63('0xbb'),_0x8c63('0xbb'),{'FaxAccountId':_[_0x8c63('0xb0')](_0x289c31['params']['id'])?undefined:_0x289c31['params']['id'],'path':_[_0x8c63('0xb0')](_0x289c31['body'][_0x8c63('0xab')][0x0][_0x8c63('0x7')])?undefined:_0x289c31[_0x8c63('0x60')][_0x8c63('0xab')][0x0][_0x8c63('0x7')],'fax':_[_0x8c63('0xb0')](_0x289c31[_0x8c63('0x60')]['to'][0x0])?undefined:_0x289c31[_0x8c63('0x60')]['to'][0x0],'AttachmentId':_0x289c31[_0x8c63('0x60')][_0x8c63('0xab')][0x0]['id']},client9002)[_0x8c63('0x23')](function(_0xaf05e8){logger['info'](_0x8c63('0xbc'),_0xaf05e8);})[_0x8c63('0x2d')](function(_0x30d5d7){logger[_0x8c63('0x24')](_0x8c63('0xbc'),_0x30d5d7);});return _0x318ac5;})[_0x8c63('0x23')](respondWithResult(_0x47a62b,null))[_0x8c63('0x2d')](handleError(_0x47a62b,null));};exports[_0x8c63('0xbd')]=function(_0x3584d2,_0x47bbbc,_0x2543a2){return db[_0x8c63('0x42')]['find']({'where':{'id':_0x3584d2[_0x8c63('0x5b')]['id']}})[_0x8c63('0x23')](handleEntityNotFound(_0x47bbbc,null))[_0x8c63('0x23')](function(_0x8ada2e){if(_0x8ada2e){return _0x8ada2e[_0x8c63('0xbd')](_0x3584d2[_0x8c63('0x60')][_0x8c63('0x6d')],_['omit'](_0x3584d2[_0x8c63('0x60')],[_0x8c63('0x6d'),'id'])||{})[_0x8c63('0xb8')](function(_0x2446de){for(var _0x41aea2=0x0;_0x41aea2<_0x3584d2['body']['ids']['length'];_0x41aea2+=0x1){socket[_0x8c63('0xbe')]('userFaxAccount:save',{'UserId':Number(_0x3584d2[_0x8c63('0x60')]['ids'][_0x41aea2]),'FaxAccountId':Number(_0x3584d2[_0x8c63('0x5b')]['id'])});}return _0x2446de;});}})[_0x8c63('0x23')](respondWithResult(_0x47bbbc,null))[_0x8c63('0x2d')](handleError(_0x47bbbc,null));};exports[_0x8c63('0xbf')]=function(_0x5ae1ff,_0x22d9be,_0xb739fa){return db[_0x8c63('0x42')][_0x8c63('0x5e')]({'where':{'id':_0x5ae1ff[_0x8c63('0x5b')]['id']}})[_0x8c63('0x23')](handleEntityNotFound(_0x22d9be,null))[_0x8c63('0x23')](function(_0x18afa6){if(_0x18afa6){return _0x18afa6[_0x8c63('0xbf')](_0x5ae1ff[_0x8c63('0x49')][_0x8c63('0x6d')])[_0x8c63('0x23')](function(){if(_['isArray'](_0x5ae1ff['query']['ids'])){for(var _0x1460ec=0x0;_0x1460ec<_0x5ae1ff[_0x8c63('0x49')][_0x8c63('0x6d')][_0x8c63('0x6b')];_0x1460ec+=0x1){socket[_0x8c63('0xbe')](_0x8c63('0xc0'),{'UserId':Number(_0x5ae1ff[_0x8c63('0x49')][_0x8c63('0x6d')][_0x1460ec]),'FaxAccountId':Number(_0x5ae1ff[_0x8c63('0x5b')]['id'])});}}else{socket[_0x8c63('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x5ae1ff['query'][_0x8c63('0x6d')]),'FaxAccountId':Number(_0x5ae1ff[_0x8c63('0x5b')]['id'])});}});}})[_0x8c63('0x23')](respondWithStatusCode(_0x22d9be,null))['catch'](handleError(_0x22d9be,null));};exports['getAgents']=function(_0x2df5fa,_0x56db44,_0x5d2a2b){var _0x1ae981={};var _0xe62fdf={};var _0x3c723f;var _0x16ef89;return db[_0x8c63('0x42')][_0x8c63('0x6a')]({'where':{'id':_0x2df5fa[_0x8c63('0x5b')]['id']}})[_0x8c63('0x23')](handleEntityNotFound(_0x56db44,null))[_0x8c63('0x23')](function(_0x18fbfb){if(_0x18fbfb){_0x3c723f=_0x18fbfb;_0xe62fdf['model']=_[_0x8c63('0x48')](db[_0x8c63('0x76')][_0x8c63('0x43')]);_0xe62fdf[_0x8c63('0x49')]=_[_0x8c63('0x48')](_0x2df5fa[_0x8c63('0x49')]);_0xe62fdf['filters']=_[_0x8c63('0x4a')](_0xe62fdf[_0x8c63('0x47')],_0xe62fdf[_0x8c63('0x49')]);_0x1ae981['attributes']=_['intersection'](_0xe62fdf[_0x8c63('0x47')],qs['fields'](_0x2df5fa[_0x8c63('0x49')][_0x8c63('0x4c')]));_0x1ae981[_0x8c63('0x4b')]=_0x1ae981[_0x8c63('0x4b')][_0x8c63('0x6b')]?_0x1ae981[_0x8c63('0x4b')]:_0xe62fdf[_0x8c63('0x47')];_0x1ae981['order']=qs[_0x8c63('0x4f')](_0x2df5fa[_0x8c63('0x49')][_0x8c63('0x4f')]);_0x1ae981['where']=qs['filters'](_[_0x8c63('0x52')](_0x2df5fa[_0x8c63('0x49')],_0xe62fdf[_0x8c63('0x51')]));if(_0x2df5fa[_0x8c63('0x49')][_0x8c63('0x53')]){_0x1ae981['where']=_[_0x8c63('0x54')](_0x1ae981['where'],{'$or':_[_0x8c63('0x41')](_0x1ae981[_0x8c63('0x4b')],function(_0xfa39f5){var _0x288c13={};_0x288c13[_0xfa39f5]={'$like':'%'+_0x2df5fa[_0x8c63('0x49')][_0x8c63('0x53')]+'%'};return _0x288c13;})});}_0x1ae981=_[_0x8c63('0x54')]({},_0x1ae981,_0x2df5fa[_0x8c63('0x56')]);return _0x3c723f[_0x8c63('0xc1')](_0x1ae981);}})['then'](function(_0x31acbc){if(_0x31acbc){_0x16ef89=_0x31acbc[_0x8c63('0x6b')];if(!_0x2df5fa[_0x8c63('0x49')][_0x8c63('0x4d')](_0x8c63('0x4e'))){_0x1ae981[_0x8c63('0x32')]=qs[_0x8c63('0x32')](_0x2df5fa[_0x8c63('0x49')][_0x8c63('0x32')]);_0x1ae981[_0x8c63('0x30')]=qs['offset'](_0x2df5fa[_0x8c63('0x49')][_0x8c63('0x30')]);}return _0x3c723f['getAgents'](_0x1ae981);}})[_0x8c63('0x23')](function(_0x252853){if(_0x252853){return _0x252853?{'count':_0x16ef89,'rows':_0x252853}:null;}})[_0x8c63('0x23')](respondWithResult(_0x56db44,null))[_0x8c63('0x2d')](handleError(_0x56db44,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 6c1a12a..dabf605 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 _0xd01c=['../../mysqldb','FaxAccount','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x50aab5,_0x58761d){var _0x1a817a=function(_0x46b9ae){while(--_0x46b9ae){_0x50aab5['push'](_0x50aab5['shift']());}};_0x1a817a(++_0x58761d);}(_0xd01c,0xfb));var _0xcd01=function(_0x133918,_0x545ebd){_0x133918=_0x133918-0x0;var _0x137308=_0xd01c[_0x133918];return _0x137308;};'use strict';var EventEmitter=require(_0xcd01('0x0'));var FaxAccount=require(_0xcd01('0x1'))['db'][_0xcd01('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xcd01('0x3')](0x0);var events={'afterCreate':_0xcd01('0x4'),'afterUpdate':'update','afterDestroy':_0xcd01('0x5')};function emitEvent(_0x16466f){return function(_0x407055,_0x57fb31,_0x298492){FaxAccountEvents[_0xcd01('0x6')](_0x16466f+':'+_0x407055['id'],_0x407055);FaxAccountEvents[_0xcd01('0x6')](_0x16466f,_0x407055);_0x298492(null);};}for(var e in events){if(events[_0xcd01('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xcd01('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x3663=['../../mysqldb','FaxAccount','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x32e20f,_0x125f96){var _0x1905b4=function(_0x4a0013){while(--_0x4a0013){_0x32e20f['push'](_0x32e20f['shift']());}};_0x1905b4(++_0x125f96);}(_0x3663,0x1ee));var _0x3366=function(_0x5899b9,_0x3c4477){_0x5899b9=_0x5899b9-0x0;var _0x2c766d=_0x3663[_0x5899b9];return _0x2c766d;};'use strict';var EventEmitter=require(_0x3366('0x0'));var FaxAccount=require(_0x3366('0x1'))['db'][_0x3366('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3366('0x3'),'afterUpdate':_0x3366('0x4'),'afterDestroy':_0x3366('0x5')};function emitEvent(_0x442cff){return function(_0x4c8466,_0x31a653,_0xb66bbe){FaxAccountEvents[_0x3366('0x6')](_0x442cff+':'+_0x4c8466['id'],_0x4c8466);FaxAccountEvents[_0x3366('0x6')](_0x442cff,_0x4c8466);_0xb66bbe(null);};}for(var e in events){if(events[_0x3366('0x7')](e)){var event=events[e];FaxAccount[_0x3366('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index b183c9f..b11c2b1 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 _0xce8a=['util','moment','bluebird','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts'];(function(_0x2cadb3,_0x42a762){var _0x4144b4=function(_0x44b69d){while(--_0x44b69d){_0x2cadb3['push'](_0x2cadb3['shift']());}};_0x4144b4(++_0x42a762);}(_0xce8a,0xfc));var _0xace8=function(_0x3968c4,_0xc70dd3){_0x3968c4=_0x3968c4-0x0;var _0x30ba6f=_0xce8a[_0x3968c4];return _0x30ba6f;};'use strict';var _=require('lodash');var util=require(_0xace8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xace8('0x1'));var BPromise=require(_0xace8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xace8('0x3'));var config=require(_0xace8('0x4'));var attributes=require(_0xace8('0x5'));module['exports']=function(_0x2be4b1,_0x2f0d49){return _0x2be4b1[_0xace8('0x6')](_0xace8('0x7'),attributes,{'tableName':_0xace8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d3e=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x53d3b0,_0x62aa42){var _0x44f608=function(_0x47f276){while(--_0x47f276){_0x53d3b0['push'](_0x53d3b0['shift']());}};_0x44f608(++_0x62aa42);}(_0x9d3e,0x1e6));var _0xe9d3=function(_0x3110c2,_0x4377fe){_0x3110c2=_0x3110c2-0x0;var _0x4d15d0=_0x9d3e[_0x3110c2];return _0x4d15d0;};'use strict';var _=require('lodash');var util=require(_0xe9d3('0x0'));var logger=require(_0xe9d3('0x1'))(_0xe9d3('0x2'));var moment=require(_0xe9d3('0x3'));var BPromise=require(_0xe9d3('0x4'));var rp=require(_0xe9d3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9d3('0x6'));var config=require(_0xe9d3('0x7'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x27b6fa,_0x484ca9){return _0x27b6fa[_0xe9d3('0x8')]('FaxAccount',attributes,{'tableName':'fax_accounts','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 3641e79..769b4eb 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 _0xcb72=['queue','Start','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','FaxAccount','findAll','options','raw','attributes','include','map','model','GetFaxAccount','stringify','NotifyFaxAccount','body','fax','CmContact','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','CmList','List','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','account','Contacts','length','defaults','create','contact','FaxInteraction','spread','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','name','UserId','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue'];(function(_0x631b42,_0x1eabda){var _0x251d91=function(_0x196bc9){while(--_0x196bc9){_0x631b42['push'](_0x631b42['shift']());}};_0x251d91(++_0x1eabda);}(_0xcb72,0xbc));var _0x2cb7=function(_0x50bf2d,_0xb39881){_0x50bf2d=_0x50bf2d-0x0;var _0x340911=_0xcb72[_0x50bf2d];return _0x340911;};'use strict';var _=require(_0x2cb7('0x0'));var util=require(_0x2cb7('0x1'));var moment=require(_0x2cb7('0x2'));var BPromise=require(_0x2cb7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cb7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2cb7('0x5'));var logger=require(_0x2cb7('0x6'))(_0x2cb7('0x7'));var config=require(_0x2cb7('0x8'));var jayson=require(_0x2cb7('0x9'));var client=jayson[_0x2cb7('0xa')]['http']({'port':0x232c});config[_0x2cb7('0xb')]=_['defaults'](config[_0x2cb7('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2cb7('0xb')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x1fa57a,_0x5e7292,_0x9ec6c4){return new BPromise(function(_0x295b7c,_0x9594c2){return client[_0x2cb7('0xc')](_0x1fa57a,_0x9ec6c4)[_0x2cb7('0xd')](function(_0xc7f77c){logger['info'](_0x2cb7('0xe'),_0x5e7292,_0x2cb7('0xf'));logger[_0x2cb7('0x10')](_0x2cb7('0x11'),_0x5e7292,'request\x20sent',JSON['stringify'](_0xc7f77c));if(_0xc7f77c[_0x2cb7('0x12')]){if(_0xc7f77c['error'][_0x2cb7('0x13')]===0x1f4){logger[_0x2cb7('0x12')](_0x2cb7('0xe'),_0x5e7292,_0xc7f77c[_0x2cb7('0x12')][_0x2cb7('0x14')]);return _0x9594c2(_0xc7f77c[_0x2cb7('0x12')][_0x2cb7('0x14')]);}logger[_0x2cb7('0x12')](_0x2cb7('0xe'),_0x5e7292,_0xc7f77c[_0x2cb7('0x12')][_0x2cb7('0x14')]);return _0x295b7c(_0xc7f77c[_0x2cb7('0x12')][_0x2cb7('0x14')]);}else{logger[_0x2cb7('0x15')]('FaxAccount,\x20%s,\x20%s',_0x5e7292,_0x2cb7('0xf'));_0x295b7c(_0xc7f77c[_0x2cb7('0x16')][_0x2cb7('0x14')]);}})[_0x2cb7('0x17')](function(_0x1c0ed8){logger[_0x2cb7('0x12')]('FaxAccount,\x20%s,\x20%s',_0x5e7292,_0x1c0ed8);_0x9594c2(_0x1c0ed8);});});}exports['GetFaxAccount']=function(_0x568474){var _0x4952de=this;return new Promise(function(_0x49d24f,_0x28f628){return db[_0x2cb7('0x18')][_0x2cb7('0x19')]({'raw':_0x568474[_0x2cb7('0x1a')]?_0x568474[_0x2cb7('0x1a')][_0x2cb7('0x1b')]===undefined?!![]:![]:!![],'where':_0x568474[_0x2cb7('0x1a')]?_0x568474['options']['where']||null:null,'attributes':_0x568474[_0x2cb7('0x1a')]?_0x568474[_0x2cb7('0x1a')][_0x2cb7('0x1c')]||null:null,'limit':_0x568474[_0x2cb7('0x1a')]?_0x568474[_0x2cb7('0x1a')]['limit']||null:null,'include':_0x568474[_0x2cb7('0x1a')]?_0x568474[_0x2cb7('0x1a')][_0x2cb7('0x1d')]?_[_0x2cb7('0x1e')](_0x568474[_0x2cb7('0x1a')][_0x2cb7('0x1d')],function(_0x1e5de7){return{'model':db[_0x1e5de7[_0x2cb7('0x1f')]],'as':_0x1e5de7['as'],'attributes':_0x1e5de7['attributes'],'include':_0x1e5de7['include']?_[_0x2cb7('0x1e')](_0x1e5de7[_0x2cb7('0x1d')],function(_0x415d43){return{'model':db[_0x415d43[_0x2cb7('0x1f')]],'as':_0x415d43['as'],'attributes':_0x415d43['attributes'],'include':_0x415d43[_0x2cb7('0x1d')]?_[_0x2cb7('0x1e')](_0x415d43[_0x2cb7('0x1d')],function(_0x540a3e){return{'model':db[_0x540a3e['model']],'as':_0x540a3e['as'],'attributes':_0x540a3e['attributes']};}):[]};}):[]};}):[]:[]})[_0x2cb7('0xd')](function(_0x2b56fe){logger['info'](_0x2cb7('0x20'),_0x568474);logger[_0x2cb7('0x10')](_0x2cb7('0x20'),_0x568474,JSON[_0x2cb7('0x21')](_0x2b56fe));_0x49d24f(_0x2b56fe);})['catch'](function(_0xead3fa){logger[_0x2cb7('0x12')](_0x2cb7('0x20'),_0xead3fa[_0x2cb7('0x14')],_0x568474);_0x28f628(_0x4952de[_0x2cb7('0x12')](0x1f4,_0xead3fa[_0x2cb7('0x14')]));});});};exports[_0x2cb7('0x22')]=function(_0x5e9469,_0x1c59f0,_0x3cf4ec){var _0x305908=this;return new Promise(function(_0x4c8335,_0x510c38){var _0x19f7e4={'body':_0x5e9469[_0x2cb7('0x23')],'channel':_0x2cb7('0x24')};var _0x4fcf80=[];var _0x1bd32a=[];var _0x4482a4={};return db[_0x2cb7('0x25')]['describe']()['then'](function(_0x17b6f8){if(!_0x17b6f8){throw new db['Sequelize']['ValidationError'](_0x2cb7('0x26'));}_0x4fcf80=_[_0x2cb7('0x27')](_[_0x2cb7('0x28')](_0x17b6f8),['createdAt',_0x2cb7('0x29')]);_0x1bd32a=_[_0x2cb7('0x27')](_['keys'](_0x17b6f8),[_0x2cb7('0x2a'),_0x2cb7('0x29'),_0x2cb7('0x2b'),_0x2cb7('0x2c')]);if(_0x5e9469[_0x2cb7('0x23')]['id']){delete _0x5e9469['body']['id'];}if(_[_0x2cb7('0x2d')](_0x5e9469['body'][_0x2cb7('0x2e')])){throw new db['Sequelize'][(_0x2cb7('0x2f'))](_0x2cb7('0x30'));}if(_[_0x2cb7('0x2d')](_0x5e9469[_0x2cb7('0x23')]['body'])||_0x5e9469['body']['body']===''){throw new db[(_0x2cb7('0x31'))][(_0x2cb7('0x2f'))](_0x2cb7('0x32'));}if(_['isNil'](_0x5e9469[_0x2cb7('0x23')]['mapKey'])){throw new db['Sequelize'][(_0x2cb7('0x2f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1bd32a);}if(!_[_0x2cb7('0x33')](_0x1bd32a,_0x5e9469['body']['mapKey'])){throw new db[(_0x2cb7('0x31'))]['ValidationError'](_0x2cb7('0x34')+_0x1bd32a);}_0x4482a4[_0x5e9469[_0x2cb7('0x23')][_0x2cb7('0x35')]]=_0x5e9469[_0x2cb7('0x23')][_0x2cb7('0x2e')];})[_0x2cb7('0xd')](function(){return db[_0x2cb7('0x18')][_0x2cb7('0x36')]({'where':{'id':_0x5e9469['account']['id']},'include':[{'model':db[_0x2cb7('0x37')],'as':_0x2cb7('0x38'),'include':[{'model':db[_0x2cb7('0x25')],'as':'Contacts','where':_0x4482a4,'limit':0x1,'order':[['updatedAt',_0x2cb7('0x39')]]}]},{'model':db[_0x2cb7('0x3a')],'as':_0x2cb7('0x3b')}]});})[_0x2cb7('0xd')](function(_0x218810){if(_0x218810&&_0x218810[_0x2cb7('0x38')]){var _0x293f3b=_0x218810[_0x2cb7('0x3c')]({'plain':!![]});_0x19f7e4['account']=_0x293f3b;_0x19f7e4[_0x2cb7('0x3d')]=_0x293f3b[_0x2cb7('0x3b')];_0x19f7e4[_0x2cb7('0x3e')]=_0x293f3b['List'];_0x19f7e4['applications']=_[_0x2cb7('0x3f')](_0x19f7e4[_0x2cb7('0x3d')],[_0x2cb7('0x40')],[_0x2cb7('0x41')]);if(_0x19f7e4[_0x2cb7('0x42')][_0x2cb7('0x3b')]){delete _0x19f7e4[_0x2cb7('0x42')][_0x2cb7('0x3b')];}if(_0x19f7e4['account'][_0x2cb7('0x38')]&&_0x19f7e4[_0x2cb7('0x42')][_0x2cb7('0x38')][_0x2cb7('0x43')][_0x2cb7('0x44')]){return _0x19f7e4[_0x2cb7('0x42')][_0x2cb7('0x38')][_0x2cb7('0x43')][0x0];}var _0x38223a=_[_0x2cb7('0x45')](_0x5e9469[_0x2cb7('0x23')],{'firstName':_0x5e9469['body'][_0x2cb7('0x2e')],'ListId':_0x293f3b[_0x2cb7('0x2c')]});_0x38223a[_0x5e9469[_0x2cb7('0x23')][_0x2cb7('0x35')]]=_0x5e9469[_0x2cb7('0x23')][_0x2cb7('0x2e')];return db[_0x2cb7('0x25')][_0x2cb7('0x46')](_0x38223a,{'fields':_0x4fcf80,'raw':!![]});}})[_0x2cb7('0xd')](function(_0x16abd5){_0x19f7e4[_0x2cb7('0x47')]=_0x16abd5;if(_0x16abd5){var _0x2539c9={'ContactId':_0x16abd5['id'],'FaxAccountId':_0x5e9469[_0x2cb7('0x42')]['id'],'fax':_0x16abd5[_0x2cb7('0x24')]};return db[_0x2cb7('0x48')][_0x2cb7('0x36')]({'where':{'ContactId':_0x16abd5['id'],'closed':![],'FaxAccountId':_0x5e9469[_0x2cb7('0x42')]['id']}})[_0x2cb7('0xd')](function(_0x509d2c){if(_0x509d2c){return[_0x509d2c,![]];}return db[_0x2cb7('0x48')]['create'](_0x2539c9)[_0x2cb7('0xd')](function(_0x4c1ed3){return[_0x4c1ed3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x2cb7('0x49')](function(_0x3ed620,_0x38b29e){var _0x447aa7=_0x3ed620['get']({'plain':!![]});if(_0x38b29e){if(_0x19f7e4[_0x2cb7('0x42')][_0x2cb7('0x4a')]){_0x19f7e4['applications'][_0x2cb7('0x4b')]({'id':0x0,'priority':_0x19f7e4[_0x2cb7('0x3d')]['length']+0x1,'app':_0x2cb7('0x4c'),'appdata':_0x2cb7('0x4d'),'interval':_0x2cb7('0x4e')});}_0x447aa7[_0x2cb7('0x4f')]=!![];}else{_0x447aa7[_0x2cb7('0x4f')]=![];}_0x19f7e4['interaction']=_0x447aa7;return db[_0x2cb7('0x50')]['create']({'body':_0x5e9469['body'][_0x2cb7('0x23')],'FaxAccountId':_0x5e9469[_0x2cb7('0x42')]['id'],'FaxInteractionId':_0x3ed620['id'],'direction':'in','ContactId':_0x3ed620[_0x2cb7('0x51')],'AttachmentId':_0x5e9469[_0x2cb7('0x23')][_0x2cb7('0x52')]});})[_0x2cb7('0xd')](function(_0x113814){_0x19f7e4[_0x2cb7('0x14')]=_0x113814;if(!_0x19f7e4[_0x2cb7('0x53')]['UserId'])return;return db['User'][_0x2cb7('0x36')]({'attributes':['id',_0x2cb7('0x54')],'where':{'id':_0x19f7e4['interaction'][_0x2cb7('0x55')]}});})[_0x2cb7('0xd')](function(_0x472a8b){if(_0x472a8b){_0x19f7e4[_0x2cb7('0x3d')][_0x2cb7('0x56')]({'id':0x0,'priority':0x0,'app':_0x2cb7('0x57'),'appdata':_0x472a8b['name']+','+(_0x19f7e4[_0x2cb7('0x42')][_0x2cb7('0x58')]||0xa),'interval':_0x2cb7('0x4e')});}if(!_0x19f7e4[_0x2cb7('0x53')][_0x2cb7('0x59')])return;return db[_0x2cb7('0x5a')][_0x2cb7('0x36')]({'attributes':['id',_0x2cb7('0x54')],'where':{'id':_0x19f7e4[_0x2cb7('0x53')][_0x2cb7('0x59')]}});})[_0x2cb7('0xd')](function(_0x208eb8){if(_0x208eb8){_0x19f7e4['applications'][_0x2cb7('0x56')]({'id':0x0,'priority':0x1,'app':_0x2cb7('0x5b'),'appdata':_0x208eb8[_0x2cb7('0x54')]+','+(_0x19f7e4[_0x2cb7('0x42')]['waitForTheAssignedQueue']||0x12c),'interval':_0x2cb7('0x4e')});}return respondWithRpcPromise(_0x2cb7('0x5c'),'startRouting',_0x19f7e4);})['then'](function(_0x22d7c2){_0x4c8335(_0x22d7c2);})[_0x2cb7('0x17')](function(_0xcd3ae8){_0x510c38(_0x305908['error'](0x1f4,_0xcd3ae8[_0x2cb7('0x14')]));});});}; \ No newline at end of file +var _0x9c83=['DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','length','create','contact','FaxInteraction','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./faxAccount.socket','request','then','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','FaxAccount','raw','options','where','attributes','limit','include','map','model','GetFaxAccount','catch','NotifyFaxAccount','body','fax','CmContact','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','ValidationError','from\x20is\x20mandatory','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','find','account','CmList','List','Contacts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c83,0x18e));var _0x39c8=function(_0x459c4b,_0x2ab622){_0x459c4b=_0x459c4b-0x0;var _0x31f016=_0x9c83[_0x459c4b];return _0x31f016;};'use strict';var _=require(_0x39c8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x39c8('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39c8('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x39c8('0x3'));var config=require(_0x39c8('0x4'));var jayson=require(_0x39c8('0x5'));var client=jayson['client'][_0x39c8('0x6')]({'port':0x232c});config[_0x39c8('0x7')]=_[_0x39c8('0x8')](config[_0x39c8('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x39c8('0x9'))(new Redis(config[_0x39c8('0x7')]));require(_0x39c8('0xa'))['register'](socket);function respondWithRpcPromise(_0x2958e1,_0x5b640b,_0x3f1698){return new BPromise(function(_0x58137b,_0x442088){return client[_0x39c8('0xb')](_0x2958e1,_0x3f1698)[_0x39c8('0xc')](function(_0xf4dd38){logger['info'](_0x39c8('0xd'),_0x5b640b,'request\x20sent');logger[_0x39c8('0xe')](_0x39c8('0xf'),_0x5b640b,_0x39c8('0x10'),JSON[_0x39c8('0x11')](_0xf4dd38));if(_0xf4dd38[_0x39c8('0x12')]){if(_0xf4dd38['error']['code']===0x1f4){logger[_0x39c8('0x12')](_0x39c8('0xd'),_0x5b640b,_0xf4dd38[_0x39c8('0x12')]['message']);return _0x442088(_0xf4dd38[_0x39c8('0x12')]['message']);}logger[_0x39c8('0x12')](_0x39c8('0xd'),_0x5b640b,_0xf4dd38[_0x39c8('0x12')][_0x39c8('0x13')]);return _0x58137b(_0xf4dd38[_0x39c8('0x12')]['message']);}else{logger[_0x39c8('0x14')](_0x39c8('0xd'),_0x5b640b,_0x39c8('0x10'));_0x58137b(_0xf4dd38[_0x39c8('0x15')][_0x39c8('0x13')]);}})['catch'](function(_0x4425e2){logger[_0x39c8('0x12')](_0x39c8('0xd'),_0x5b640b,_0x4425e2);_0x442088(_0x4425e2);});});}exports['GetFaxAccount']=function(_0x24a3e5){var _0x4af93d=this;return new Promise(function(_0x3b6704,_0x570a60){return db[_0x39c8('0x16')]['findAll']({'raw':_0x24a3e5['options']?_0x24a3e5['options'][_0x39c8('0x17')]===undefined?!![]:![]:!![],'where':_0x24a3e5[_0x39c8('0x18')]?_0x24a3e5['options'][_0x39c8('0x19')]||null:null,'attributes':_0x24a3e5[_0x39c8('0x18')]?_0x24a3e5[_0x39c8('0x18')][_0x39c8('0x1a')]||null:null,'limit':_0x24a3e5['options']?_0x24a3e5[_0x39c8('0x18')][_0x39c8('0x1b')]||null:null,'include':_0x24a3e5['options']?_0x24a3e5['options'][_0x39c8('0x1c')]?_[_0x39c8('0x1d')](_0x24a3e5['options'][_0x39c8('0x1c')],function(_0x41ffe8){return{'model':db[_0x41ffe8[_0x39c8('0x1e')]],'as':_0x41ffe8['as'],'attributes':_0x41ffe8[_0x39c8('0x1a')],'include':_0x41ffe8[_0x39c8('0x1c')]?_[_0x39c8('0x1d')](_0x41ffe8[_0x39c8('0x1c')],function(_0x3359d4){return{'model':db[_0x3359d4[_0x39c8('0x1e')]],'as':_0x3359d4['as'],'attributes':_0x3359d4['attributes'],'include':_0x3359d4[_0x39c8('0x1c')]?_[_0x39c8('0x1d')](_0x3359d4['include'],function(_0x686024){return{'model':db[_0x686024[_0x39c8('0x1e')]],'as':_0x686024['as'],'attributes':_0x686024['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d2f08){logger[_0x39c8('0x14')]('GetFaxAccount',_0x24a3e5);logger['debug'](_0x39c8('0x1f'),_0x24a3e5,JSON['stringify'](_0x3d2f08));_0x3b6704(_0x3d2f08);})[_0x39c8('0x20')](function(_0x27aa0f){logger[_0x39c8('0x12')](_0x39c8('0x1f'),_0x27aa0f[_0x39c8('0x13')],_0x24a3e5);_0x570a60(_0x4af93d['error'](0x1f4,_0x27aa0f[_0x39c8('0x13')]));});});};exports[_0x39c8('0x21')]=function(_0x7b9ae4,_0x40c7ff,_0x4684b0){var _0x4afb30=this;return new Promise(function(_0x5cb301,_0x4dec0e){var _0x2708f0={'body':_0x7b9ae4[_0x39c8('0x22')],'channel':_0x39c8('0x23')};var _0x49684d=[];var _0xbeffb2=[];var _0x4d8f6c={};return db[_0x39c8('0x24')]['describe']()[_0x39c8('0xc')](function(_0x1a8fcb){if(!_0x1a8fcb){throw new db['Sequelize']['ValidationError'](_0x39c8('0x25'));}_0x49684d=_[_0x39c8('0x26')](_['keys'](_0x1a8fcb),['createdAt','updatedAt']);_0xbeffb2=_[_0x39c8('0x26')](_[_0x39c8('0x27')](_0x1a8fcb),[_0x39c8('0x28'),_0x39c8('0x29'),_0x39c8('0x2a'),_0x39c8('0x2b')]);if(_0x7b9ae4[_0x39c8('0x22')]['id']){delete _0x7b9ae4[_0x39c8('0x22')]['id'];}if(_['isNil'](_0x7b9ae4[_0x39c8('0x22')]['from'])){throw new db['Sequelize'][(_0x39c8('0x2c'))](_0x39c8('0x2d'));}if(_[_0x39c8('0x2e')](_0x7b9ae4['body']['body'])||_0x7b9ae4['body']['body']===''){throw new db[(_0x39c8('0x2f'))][(_0x39c8('0x2c'))](_0x39c8('0x30'));}if(_[_0x39c8('0x2e')](_0x7b9ae4['body'][_0x39c8('0x31')])){throw new db['Sequelize'][(_0x39c8('0x2c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xbeffb2);}if(!_[_0x39c8('0x32')](_0xbeffb2,_0x7b9ae4[_0x39c8('0x22')][_0x39c8('0x31')])){throw new db[(_0x39c8('0x2f'))][(_0x39c8('0x2c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xbeffb2);}_0x4d8f6c[_0x7b9ae4['body']['mapKey']]=_0x7b9ae4[_0x39c8('0x22')][_0x39c8('0x33')];})['then'](function(){return db['FaxAccount'][_0x39c8('0x34')]({'where':{'id':_0x7b9ae4[_0x39c8('0x35')]['id']},'include':[{'model':db[_0x39c8('0x36')],'as':_0x39c8('0x37'),'include':[{'model':db[_0x39c8('0x24')],'as':_0x39c8('0x38'),'where':_0x4d8f6c,'limit':0x1,'order':[[_0x39c8('0x29'),_0x39c8('0x39')]]}]},{'model':db[_0x39c8('0x3a')],'as':_0x39c8('0x3b')}]});})['then'](function(_0x1184ce){if(_0x1184ce&&_0x1184ce[_0x39c8('0x37')]){var _0x3fdff7=_0x1184ce[_0x39c8('0x3c')]({'plain':!![]});_0x2708f0[_0x39c8('0x35')]=_0x3fdff7;_0x2708f0[_0x39c8('0x3d')]=_0x3fdff7['Applications'];_0x2708f0[_0x39c8('0x3e')]=_0x3fdff7[_0x39c8('0x37')];_0x2708f0[_0x39c8('0x3d')]=_[_0x39c8('0x3f')](_0x2708f0[_0x39c8('0x3d')],[_0x39c8('0x40')],[_0x39c8('0x41')]);if(_0x2708f0['account'][_0x39c8('0x3b')]){delete _0x2708f0[_0x39c8('0x35')][_0x39c8('0x3b')];}if(_0x2708f0[_0x39c8('0x35')][_0x39c8('0x37')]&&_0x2708f0[_0x39c8('0x35')]['List']['Contacts'][_0x39c8('0x42')]){return _0x2708f0[_0x39c8('0x35')]['List']['Contacts'][0x0];}var _0x4ddaa0=_[_0x39c8('0x8')](_0x7b9ae4[_0x39c8('0x22')],{'firstName':_0x7b9ae4[_0x39c8('0x22')][_0x39c8('0x33')],'ListId':_0x3fdff7[_0x39c8('0x2b')]});_0x4ddaa0[_0x7b9ae4['body'][_0x39c8('0x31')]]=_0x7b9ae4['body'][_0x39c8('0x33')];return db[_0x39c8('0x24')][_0x39c8('0x43')](_0x4ddaa0,{'fields':_0x49684d,'raw':!![]});}})[_0x39c8('0xc')](function(_0x6cf37e){_0x2708f0[_0x39c8('0x44')]=_0x6cf37e;if(_0x6cf37e){var _0x2714ec={'ContactId':_0x6cf37e['id'],'FaxAccountId':_0x7b9ae4[_0x39c8('0x35')]['id'],'fax':_0x6cf37e['fax']};return db[_0x39c8('0x45')]['find']({'where':{'ContactId':_0x6cf37e['id'],'closed':![],'FaxAccountId':_0x7b9ae4[_0x39c8('0x35')]['id']}})['then'](function(_0x4b895a){if(_0x4b895a){return[_0x4b895a,![]];}return db[_0x39c8('0x45')]['create'](_0x2714ec)[_0x39c8('0xc')](function(_0x45c93c){return[_0x45c93c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x5e32f3,_0x17c7bf){var _0x15f0cb=_0x5e32f3[_0x39c8('0x3c')]({'plain':!![]});if(_0x17c7bf){if(_0x2708f0['account'][_0x39c8('0x46')]){_0x2708f0[_0x39c8('0x3d')][_0x39c8('0x47')]({'id':0x0,'priority':_0x2708f0[_0x39c8('0x3d')][_0x39c8('0x42')]+0x1,'app':_0x39c8('0x48'),'appdata':_0x39c8('0x49'),'interval':_0x39c8('0x4a')});}_0x15f0cb[_0x39c8('0x4b')]=!![];}else{_0x15f0cb['created']=![];}_0x2708f0[_0x39c8('0x4c')]=_0x15f0cb;return db[_0x39c8('0x4d')][_0x39c8('0x43')]({'body':_0x7b9ae4[_0x39c8('0x22')][_0x39c8('0x22')],'FaxAccountId':_0x7b9ae4[_0x39c8('0x35')]['id'],'FaxInteractionId':_0x5e32f3['id'],'direction':'in','ContactId':_0x5e32f3['ContactId'],'AttachmentId':_0x7b9ae4[_0x39c8('0x22')][_0x39c8('0x4e')]});})[_0x39c8('0xc')](function(_0x483e1d){_0x2708f0[_0x39c8('0x13')]=_0x483e1d;if(!_0x2708f0[_0x39c8('0x4c')][_0x39c8('0x4f')])return;return db[_0x39c8('0x50')][_0x39c8('0x34')]({'attributes':['id',_0x39c8('0x51')],'where':{'id':_0x2708f0[_0x39c8('0x4c')]['UserId']}});})[_0x39c8('0xc')](function(_0xcf5e00){if(_0xcf5e00){_0x2708f0[_0x39c8('0x3d')][_0x39c8('0x52')]({'id':0x0,'priority':0x0,'app':_0x39c8('0x53'),'appdata':_0xcf5e00[_0x39c8('0x51')]+','+(_0x2708f0[_0x39c8('0x35')][_0x39c8('0x54')]||0xa),'interval':_0x39c8('0x4a')});}if(!_0x2708f0[_0x39c8('0x4c')][_0x39c8('0x55')])return;return db[_0x39c8('0x56')]['find']({'attributes':['id',_0x39c8('0x51')],'where':{'id':_0x2708f0['interaction'][_0x39c8('0x55')]}});})[_0x39c8('0xc')](function(_0x379172){if(_0x379172){_0x2708f0[_0x39c8('0x3d')]['unshift']({'id':0x0,'priority':0x1,'app':_0x39c8('0x57'),'appdata':_0x379172[_0x39c8('0x51')]+','+(_0x2708f0[_0x39c8('0x35')][_0x39c8('0x58')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x39c8('0x59'),_0x39c8('0x5a'),_0x2708f0);})[_0x39c8('0xc')](function(_0x7f67f1){_0x5cb301(_0x7f67f1);})[_0x39c8('0x20')](function(_0x3e0e4e){_0x4dec0e(_0x4afb30[_0x39c8('0x12')](0x1f4,_0x3e0e4e[_0x39c8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index a076219..bbf6431 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 _0x0cea=['faxAccount:','./faxAccount.events','remove','emit','register','length'];(function(_0x256684,_0x529c1e){var _0x37a0c9=function(_0x4b431b){while(--_0x4b431b){_0x256684['push'](_0x256684['shift']());}};_0x37a0c9(++_0x529c1e);}(_0x0cea,0x85));var _0xa0ce=function(_0x380711,_0x274f90){_0x380711=_0x380711-0x0;var _0x23156e=_0x0cea[_0x380711];return _0x23156e;};'use strict';var FaxAccountEvents=require(_0xa0ce('0x0'));var events=['save',_0xa0ce('0x1'),'update'];function createListener(_0x2de8a3,_0x3c69b5){return function(_0x188d3d){_0x3c69b5[_0xa0ce('0x2')](_0x2de8a3,_0x188d3d);};}function removeListener(_0xb65036,_0xeaa33d){return function(){FaxAccountEvents['removeListener'](_0xb65036,_0xeaa33d);};}exports[_0xa0ce('0x3')]=function(_0x135945){for(var _0x7b4c1b=0x0,_0x41f6ec=events[_0xa0ce('0x4')];_0x7b4c1b<_0x41f6ec;_0x7b4c1b++){var _0x403bc3=events[_0x7b4c1b];var _0x1dfeba=createListener(_0xa0ce('0x5')+_0x403bc3,_0x135945);FaxAccountEvents['on'](_0x403bc3,_0x1dfeba);}}; \ No newline at end of file +var _0x24cd=['faxAccount:','save','remove','update','emit','removeListener','register','length'];(function(_0x2db315,_0x58d720){var _0x12f9a2=function(_0x1f146e){while(--_0x1f146e){_0x2db315['push'](_0x2db315['shift']());}};_0x12f9a2(++_0x58d720);}(_0x24cd,0x1c9));var _0xd24c=function(_0x3afa21,_0x322496){_0x3afa21=_0x3afa21-0x0;var _0x1ce534=_0x24cd[_0x3afa21];return _0x1ce534;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xd24c('0x0'),_0xd24c('0x1'),_0xd24c('0x2')];function createListener(_0x4f63f5,_0x38b586){return function(_0xa1d83d){_0x38b586[_0xd24c('0x3')](_0x4f63f5,_0xa1d83d);};}function removeListener(_0x45a964,_0x1ce8f0){return function(){FaxAccountEvents[_0xd24c('0x4')](_0x45a964,_0x1ce8f0);};}exports[_0xd24c('0x5')]=function(_0x5f150a){for(var _0x205d4a=0x0,_0xf5ab9b=events[_0xd24c('0x6')];_0x205d4a<_0xf5ab9b;_0x205d4a++){var _0x134727=events[_0x205d4a];var _0x5e1faa=createListener(_0xd24c('0x7')+_0x134727,_0x5f150a);FaxAccountEvents['on'](_0x134727,_0x5e1faa);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 169183d..e8e090b 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 _0x444e=['express','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/interactions','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAgents','multer','path'];(function(_0x70a8a5,_0x35a384){var _0x2b563b=function(_0x4bbb5b){while(--_0x4bbb5b){_0x70a8a5['push'](_0x70a8a5['shift']());}};_0x2b563b(++_0x35a384);}(_0x444e,0xe8));var _0xe444=function(_0x1fa74e,_0x164801){_0x1fa74e=_0x1fa74e-0x0;var _0x25da92=_0x444e[_0x1fa74e];return _0x25da92;};'use strict';var multer=require(_0xe444('0x0'));var util=require('util');var path=require(_0xe444('0x1'));var timeout=require('connect-timeout');var express=require(_0xe444('0x2'));var router=express['Router']();var fs_extra=require(_0xe444('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe444('0x4'));var config=require(_0xe444('0x5'));var controller=require(_0xe444('0x6'));router[_0xe444('0x7')]('/',auth[_0xe444('0x8')](),controller[_0xe444('0x9')]);router['get'](_0xe444('0xa'),auth['isAuthenticated'](),controller[_0xe444('0xb')]);router['get'](_0xe444('0xc'),auth[_0xe444('0x8')](),controller[_0xe444('0xd')]);router['get']('/:id/dispositions',auth[_0xe444('0x8')](),controller[_0xe444('0xe')]);router['get'](_0xe444('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xe444('0x7')]('/:id/interactions',auth[_0xe444('0x8')](),controller[_0xe444('0x10')]);router['get'](_0xe444('0x11'),auth['isAuthenticated'](),controller['getApplications']);router[_0xe444('0x7')](_0xe444('0x12'),auth['isAuthenticated'](),controller[_0xe444('0x13')]);router['get'](_0xe444('0x14'),auth[_0xe444('0x8')](),controller[_0xe444('0x15')]);router[_0xe444('0x16')]('/',auth[_0xe444('0x8')](),controller[_0xe444('0x17')]);router[_0xe444('0x16')](_0xe444('0x18'),auth[_0xe444('0x8')](),controller[_0xe444('0x19')]);router[_0xe444('0x16')](_0xe444('0xf'),auth[_0xe444('0x8')](),controller['addAnswer']);router[_0xe444('0x16')](_0xe444('0x1a'),auth[_0xe444('0x8')](),controller[_0xe444('0x1b')]);router['post'](_0xe444('0x11'),auth[_0xe444('0x8')](),controller[_0xe444('0x1c')]);router[_0xe444('0x16')](_0xe444('0x1d'),auth['isAuthenticated'](),controller[_0xe444('0x1e')]);router[_0xe444('0x16')]('/updateaccountapplications',auth[_0xe444('0x8')](),controller['updateAccountApplications']);router[_0xe444('0x16')](_0xe444('0x1f'),auth[_0xe444('0x8')](),controller[_0xe444('0x20')]);router[_0xe444('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xe444('0x21')]);router[_0xe444('0x22')](_0xe444('0xc'),auth[_0xe444('0x8')](),controller[_0xe444('0x23')]);router['delete'](_0xe444('0xc'),auth[_0xe444('0x8')](),controller['destroy']);router[_0xe444('0x24')](_0xe444('0x18'),auth[_0xe444('0x8')](),controller[_0xe444('0x25')]);router[_0xe444('0x24')](_0xe444('0xf'),auth[_0xe444('0x8')](),controller['removeAnswers']);router[_0xe444('0x24')](_0xe444('0x14'),auth[_0xe444('0x8')](),controller[_0xe444('0x26')]);module['exports']=router; \ No newline at end of file +var _0x7371=['create','post','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','/describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getMessages','/:id/users'];(function(_0x331a34,_0xeb62d){var _0xa14a20=function(_0x17306e){while(--_0x17306e){_0x331a34['push'](_0x331a34['shift']());}};_0xa14a20(++_0xeb62d);}(_0x7371,0x88));var _0x1737=function(_0x57e564,_0x1a5a40){_0x57e564=_0x57e564-0x0;var _0x2cf2ca=_0x7371[_0x57e564];return _0x2cf2ca;};'use strict';var multer=require(_0x1737('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1737('0x1'));var express=require('express');var router=express[_0x1737('0x2')]();var fs_extra=require(_0x1737('0x3'));var auth=require(_0x1737('0x4'));var interaction=require(_0x1737('0x5'));var config=require(_0x1737('0x6'));var controller=require(_0x1737('0x7'));router[_0x1737('0x8')]('/',auth[_0x1737('0x9')](),controller['index']);router[_0x1737('0x8')](_0x1737('0xa'),auth[_0x1737('0x9')](),controller['describe']);router[_0x1737('0x8')]('/:id',auth[_0x1737('0x9')](),controller['show']);router[_0x1737('0x8')](_0x1737('0xb'),auth[_0x1737('0x9')](),controller[_0x1737('0xc')]);router['get'](_0x1737('0xd'),auth['isAuthenticated'](),controller[_0x1737('0xe')]);router[_0x1737('0x8')](_0x1737('0xf'),auth['isAuthenticated'](),controller[_0x1737('0x10')]);router[_0x1737('0x8')](_0x1737('0x11'),auth['isAuthenticated'](),controller['getApplications']);router[_0x1737('0x8')]('/:id/messages',auth[_0x1737('0x9')](),controller[_0x1737('0x12')]);router[_0x1737('0x8')](_0x1737('0x13'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x1737('0x14')]);router[_0x1737('0x15')](_0x1737('0xb'),auth[_0x1737('0x9')](),controller[_0x1737('0x16')]);router[_0x1737('0x15')](_0x1737('0xd'),auth[_0x1737('0x9')](),controller[_0x1737('0x17')]);router[_0x1737('0x15')]('/:id/interactions',auth[_0x1737('0x9')](),controller[_0x1737('0x18')]);router[_0x1737('0x15')](_0x1737('0x11'),auth['isAuthenticated'](),controller[_0x1737('0x19')]);router[_0x1737('0x15')](_0x1737('0x1a'),auth[_0x1737('0x9')](),controller[_0x1737('0x1b')]);router[_0x1737('0x15')](_0x1737('0x1c'),auth[_0x1737('0x9')](),controller['updateAccountApplications']);router['post'](_0x1737('0x1d'),auth[_0x1737('0x9')](),controller[_0x1737('0x1e')]);router[_0x1737('0x15')](_0x1737('0x13'),auth[_0x1737('0x9')](),controller[_0x1737('0x1f')]);router[_0x1737('0x20')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x1737('0x21')](_0x1737('0x22'),auth[_0x1737('0x9')](),controller[_0x1737('0x23')]);router[_0x1737('0x21')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x1737('0x24')]);router[_0x1737('0x21')](_0x1737('0xd'),auth['isAuthenticated'](),controller[_0x1737('0x25')]);router['delete'](_0x1737('0x13'),auth['isAuthenticated'](),controller[_0x1737('0x26')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 7936012..eca00dc 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 _0x4e5f=['STRING','sequelize','exports'];(function(_0xdc4f0c,_0x40a013){var _0x55e188=function(_0x3c821c){while(--_0x3c821c){_0xdc4f0c['push'](_0xdc4f0c['shift']());}};_0x55e188(++_0x40a013);}(_0x4e5f,0x196));var _0xf4e5=function(_0x570841,_0x3f3f68){_0x570841=_0x570841-0x0;var _0x3a6bf9=_0x4e5f[_0x570841];return _0x3a6bf9;};'use strict';var Sequelize=require(_0xf4e5('0x0'));module[_0xf4e5('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf4e5('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf4e5('0x2')]},'interval':{'type':Sequelize[_0xf4e5('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xc874=['TEXT','STRING','*,*,*,*','exports','noop'];(function(_0x4d521e,_0x58ba39){var _0x3beb42=function(_0x1a7bd2){while(--_0x1a7bd2){_0x4d521e['push'](_0x4d521e['shift']());}};_0x3beb42(++_0x58ba39);}(_0xc874,0x120));var _0x4c87=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xc874[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require('sequelize');module[_0x4c87('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4c87('0x1')},'appdata':{'type':Sequelize[_0x4c87('0x2')]()},'description':{'type':Sequelize[_0x4c87('0x3')]},'interval':{'type':Sequelize[_0x4c87('0x3')],'defaultValue':_0x4c87('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 44ecb9c..ac2f461 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 _0xe972=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','where','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service'];(function(_0xea813,_0x5ce85d){var _0x31fab5=function(_0x5357bc){while(--_0x5357bc){_0xea813['push'](_0xea813['shift']());}};_0x31fab5(++_0x5ce85d);}(_0xe972,0x15d));var _0x2e97=function(_0x2539e6,_0x595d36){_0x2539e6=_0x2539e6-0x0;var _0xe83570=_0xe972[_0x2539e6];return _0xe83570;};'use strict';var emlformat=require(_0x2e97('0x0'));var rimraf=require(_0x2e97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e97('0x2'));var rp=require(_0x2e97('0x3'));var moment=require('moment');var BPromise=require(_0x2e97('0x4'));var Mustache=require(_0x2e97('0x5'));var util=require(_0x2e97('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2e97('0x7'));var ejs=require(_0x2e97('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e97('0x9'));var squel=require(_0x2e97('0xa'));var crypto=require(_0x2e97('0xb'));var jsforce=require(_0x2e97('0xc'));var deskjs=require(_0x2e97('0xd'));var toCsv=require(_0x2e97('0x7'));var querystring=require('querystring');var Papa=require(_0x2e97('0xe'));var Redis=require('ioredis');var authService=require(_0x2e97('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2e97('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e97('0x11'))(_0x2e97('0x12'));var utils=require(_0x2e97('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2e97('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f1468,_0x4484d1){_0x4484d1=_0x4484d1||0xcc;return function(_0x360b49){if(_0x360b49){return _0x2f1468[_0x2e97('0x15')](_0x4484d1);}return _0x2f1468[_0x2e97('0x16')](_0x4484d1)[_0x2e97('0x17')]();};}function respondWithResult(_0x57f4fa,_0x23c194){_0x23c194=_0x23c194||0xc8;return function(_0x55be40){if(_0x55be40){return _0x57f4fa['status'](_0x23c194)[_0x2e97('0x18')](_0x55be40);}};}function respondWithFilteredResult(_0x5524a3,_0x586d79){return function(_0x48e7d1){if(_0x48e7d1){var _0xaf6482=typeof _0x586d79['offset']===_0x2e97('0x19')&&typeof _0x586d79[_0x2e97('0x1a')]===_0x2e97('0x19');var _0x4d155b=_0x48e7d1[_0x2e97('0x1b')];var _0x433057=_0xaf6482?0x0:_0x586d79[_0x2e97('0x1c')];var _0xaa7015=_0xaf6482?_0x48e7d1[_0x2e97('0x1b')]:_0x586d79[_0x2e97('0x1c')]+_0x586d79['limit'];var _0x44dad6;if(_0xaa7015>=_0x4d155b){_0xaa7015=_0x4d155b;_0x44dad6=0xc8;}else{_0x44dad6=0xce;}_0x5524a3['status'](_0x44dad6);return _0x5524a3[_0x2e97('0x1d')](_0x2e97('0x1e'),_0x433057+'-'+_0xaa7015+'/'+_0x4d155b)[_0x2e97('0x18')](_0x48e7d1);}return null;};}function patchUpdates(_0x16bd95){return function(_0x321313){try{jsonpatch[_0x2e97('0x1f')](_0x321313,_0x16bd95,!![]);}catch(_0x138374){return BPromise[_0x2e97('0x20')](_0x138374);}return _0x321313[_0x2e97('0x21')]();};}function saveUpdates(_0x120369,_0x2c17fa){return function(_0x151423){if(_0x151423){return _0x151423[_0x2e97('0x22')](_0x120369)[_0x2e97('0x23')](function(_0x509cf2){return _0x509cf2;});}return null;};}function removeEntity(_0x119aec,_0x4c3e18){return function(_0x1a2bd1){if(_0x1a2bd1){return _0x1a2bd1['destroy']()[_0x2e97('0x23')](function(){_0x119aec['status'](0xcc)[_0x2e97('0x17')]();});}};}function handleEntityNotFound(_0x2df759,_0x489458){return function(_0x2d0010){if(!_0x2d0010){_0x2df759[_0x2e97('0x15')](0x194);}return _0x2d0010;};}function handleError(_0x3a25d4,_0x23527b){_0x23527b=_0x23527b||0x1f4;return function(_0x1040c4){logger[_0x2e97('0x24')](_0x1040c4[_0x2e97('0x25')]);if(_0x1040c4[_0x2e97('0x26')]){delete _0x1040c4[_0x2e97('0x26')];}_0x3a25d4['status'](_0x23527b)[_0x2e97('0x27')](_0x1040c4);};}exports[_0x2e97('0x28')]=function(_0x5ef7f7,_0x150587){var _0x31ac51={},_0x422124={},_0x1ae724={'count':0x0,'rows':[]};var _0x5d8abf=_[_0x2e97('0x29')](db[_0x2e97('0x2a')][_0x2e97('0x2b')],function(_0x28ec9c){return{'name':_0x28ec9c[_0x2e97('0x2c')],'type':_0x28ec9c['type'][_0x2e97('0x2d')]};});_0x422124[_0x2e97('0x2e')]=_[_0x2e97('0x29')](_0x5d8abf,_0x2e97('0x26'));_0x422124['query']=_[_0x2e97('0x2f')](_0x5ef7f7[_0x2e97('0x30')]);_0x422124[_0x2e97('0x31')]=_[_0x2e97('0x32')](_0x422124[_0x2e97('0x2e')],_0x422124['query']);_0x31ac51[_0x2e97('0x33')]=_[_0x2e97('0x32')](_0x422124['model'],qs['fields'](_0x5ef7f7[_0x2e97('0x30')][_0x2e97('0x34')]));_0x31ac51[_0x2e97('0x33')]=_0x31ac51[_0x2e97('0x33')][_0x2e97('0x35')]?_0x31ac51[_0x2e97('0x33')]:_0x422124[_0x2e97('0x2e')];if(!_0x5ef7f7['query'][_0x2e97('0x36')](_0x2e97('0x37'))){_0x31ac51[_0x2e97('0x1a')]=qs[_0x2e97('0x1a')](_0x5ef7f7['query'][_0x2e97('0x1a')]);_0x31ac51[_0x2e97('0x1c')]=qs['offset'](_0x5ef7f7[_0x2e97('0x30')][_0x2e97('0x1c')]);}_0x31ac51['order']=qs['sort'](_0x5ef7f7[_0x2e97('0x30')]['sort']);_0x31ac51['where']=qs[_0x2e97('0x31')](_[_0x2e97('0x38')](_0x5ef7f7[_0x2e97('0x30')],_0x422124[_0x2e97('0x31')]),_0x5d8abf);if(_0x5ef7f7[_0x2e97('0x30')]['filter']){_0x31ac51[_0x2e97('0x39')]=_[_0x2e97('0x3a')](_0x31ac51['where'],{'$or':_['map'](_0x5d8abf,function(_0x369034){if(_0x369034[_0x2e97('0x3b')]!=='VIRTUAL'){var _0x2a8034={};_0x2a8034[_0x369034['name']]={'$like':'%'+_0x5ef7f7['query'][_0x2e97('0x3c')]+'%'};return _0x2a8034;}})});}_0x31ac51=_[_0x2e97('0x3a')]({},_0x31ac51,_0x5ef7f7[_0x2e97('0x3d')]);var _0x3d2c31={'where':_0x31ac51[_0x2e97('0x39')]};return db[_0x2e97('0x2a')][_0x2e97('0x1b')](_0x3d2c31)[_0x2e97('0x23')](function(_0x53749b){_0x1ae724['count']=_0x53749b;if(_0x5ef7f7[_0x2e97('0x30')][_0x2e97('0x3e')]){_0x31ac51[_0x2e97('0x3f')]=[{'all':!![]}];}return db[_0x2e97('0x2a')][_0x2e97('0x40')](_0x31ac51);})['then'](function(_0x4ed358){_0x1ae724[_0x2e97('0x41')]=_0x4ed358;return _0x1ae724;})['then'](respondWithFilteredResult(_0x150587,_0x31ac51))[_0x2e97('0x42')](handleError(_0x150587,null));};exports[_0x2e97('0x43')]=function(_0x44505f,_0x27ff47){var _0x199dcf={'raw':!![],'where':{'id':_0x44505f[_0x2e97('0x44')]['id']}},_0x46e0a2={};_0x46e0a2[_0x2e97('0x2e')]=_[_0x2e97('0x2f')](db[_0x2e97('0x2a')][_0x2e97('0x2b')]);_0x46e0a2['query']=_[_0x2e97('0x2f')](_0x44505f[_0x2e97('0x30')]);_0x46e0a2[_0x2e97('0x31')]=_['intersection'](_0x46e0a2[_0x2e97('0x2e')],_0x46e0a2[_0x2e97('0x30')]);_0x199dcf[_0x2e97('0x33')]=_[_0x2e97('0x32')](_0x46e0a2[_0x2e97('0x2e')],qs[_0x2e97('0x34')](_0x44505f[_0x2e97('0x30')][_0x2e97('0x34')]));_0x199dcf[_0x2e97('0x33')]=_0x199dcf[_0x2e97('0x33')]['length']?_0x199dcf['attributes']:_0x46e0a2['model'];if(_0x44505f['query']['includeAll']){_0x199dcf['include']=[{'all':!![]}];}_0x199dcf=_['merge']({},_0x199dcf,_0x44505f['options']);return db['FaxApplication'][_0x2e97('0x45')](_0x199dcf)['then'](handleEntityNotFound(_0x27ff47,null))['then'](respondWithResult(_0x27ff47,null))[_0x2e97('0x42')](handleError(_0x27ff47,null));};exports['create']=function(_0x525a67,_0x557a1c){return db[_0x2e97('0x2a')][_0x2e97('0x46')](_0x525a67[_0x2e97('0x47')],{})[_0x2e97('0x23')](respondWithResult(_0x557a1c,0xc9))[_0x2e97('0x42')](handleError(_0x557a1c,null));};exports['update']=function(_0x3d4e52,_0x321655){if(_0x3d4e52[_0x2e97('0x47')]['id']){delete _0x3d4e52[_0x2e97('0x47')]['id'];}return db[_0x2e97('0x2a')][_0x2e97('0x45')]({'where':{'id':_0x3d4e52[_0x2e97('0x44')]['id']}})[_0x2e97('0x23')](handleEntityNotFound(_0x321655,null))[_0x2e97('0x23')](saveUpdates(_0x3d4e52[_0x2e97('0x47')],null))[_0x2e97('0x23')](respondWithResult(_0x321655,null))['catch'](handleError(_0x321655,null));};exports[_0x2e97('0x48')]=function(_0x224656,_0x116242){return db['FaxApplication'][_0x2e97('0x45')]({'where':{'id':_0x224656[_0x2e97('0x44')]['id']}})[_0x2e97('0x23')](handleEntityNotFound(_0x116242,null))[_0x2e97('0x23')](removeEntity(_0x116242,null))[_0x2e97('0x42')](handleError(_0x116242,null));}; \ No newline at end of file +var _0x7f55=['VIRTUAL','filter','options','includeAll','FaxApplication','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','error','stack','name','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','map'];(function(_0x3f0e00,_0x56c620){var _0x1f9698=function(_0x451db1){while(--_0x451db1){_0x3f0e00['push'](_0x3f0e00['shift']());}};_0x1f9698(++_0x56c620);}(_0x7f55,0x136));var _0x57f5=function(_0x43b06b,_0x1929c7){_0x43b06b=_0x43b06b-0x0;var _0x2c555b=_0x7f55[_0x43b06b];return _0x2c555b;};'use strict';var emlformat=require(_0x57f5('0x0'));var rimraf=require(_0x57f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x57f5('0x2'));var rp=require('request-promise');var moment=require(_0x57f5('0x3'));var BPromise=require(_0x57f5('0x4'));var Mustache=require(_0x57f5('0x5'));var util=require(_0x57f5('0x6'));var path=require(_0x57f5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57f5('0x8'));var fs=require('fs');var fs_extra=require(_0x57f5('0x9'));var _=require(_0x57f5('0xa'));var squel=require(_0x57f5('0xb'));var crypto=require(_0x57f5('0xc'));var jsforce=require(_0x57f5('0xd'));var deskjs=require(_0x57f5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x57f5('0xf'));var Papa=require(_0x57f5('0x10'));var Redis=require(_0x57f5('0x11'));var authService=require(_0x57f5('0x12'));var qs=require(_0x57f5('0x13'));var as=require(_0x57f5('0x14'));var hardwareService=require(_0x57f5('0x15'));var logger=require(_0x57f5('0x16'))(_0x57f5('0x17'));var utils=require(_0x57f5('0x18'));var config=require(_0x57f5('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x57f5('0x1a'))['db'];function respondWithStatusCode(_0x189e86,_0xff3ff9){_0xff3ff9=_0xff3ff9||0xcc;return function(_0x4521ce){if(_0x4521ce){return _0x189e86[_0x57f5('0x1b')](_0xff3ff9);}return _0x189e86[_0x57f5('0x1c')](_0xff3ff9)['end']();};}function respondWithResult(_0x28ca48,_0x274c91){_0x274c91=_0x274c91||0xc8;return function(_0x2dcd7e){if(_0x2dcd7e){return _0x28ca48[_0x57f5('0x1c')](_0x274c91)[_0x57f5('0x1d')](_0x2dcd7e);}};}function respondWithFilteredResult(_0x333e7c,_0x3b9fc4){return function(_0x4f12cb){if(_0x4f12cb){var _0x2e0f69=typeof _0x3b9fc4[_0x57f5('0x1e')]==='undefined'&&typeof _0x3b9fc4[_0x57f5('0x1f')]===_0x57f5('0x20');var _0xac0116=_0x4f12cb[_0x57f5('0x21')];var _0x4dbe4d=_0x2e0f69?0x0:_0x3b9fc4[_0x57f5('0x1e')];var _0x6d6080=_0x2e0f69?_0x4f12cb['count']:_0x3b9fc4[_0x57f5('0x1e')]+_0x3b9fc4[_0x57f5('0x1f')];var _0x242263;if(_0x6d6080>=_0xac0116){_0x6d6080=_0xac0116;_0x242263=0xc8;}else{_0x242263=0xce;}_0x333e7c[_0x57f5('0x1c')](_0x242263);return _0x333e7c[_0x57f5('0x22')]('Content-Range',_0x4dbe4d+'-'+_0x6d6080+'/'+_0xac0116)['json'](_0x4f12cb);}return null;};}function patchUpdates(_0x4d92d4){return function(_0x759283){try{jsonpatch[_0x57f5('0x23')](_0x759283,_0x4d92d4,!![]);}catch(_0x5b8ec0){return BPromise['reject'](_0x5b8ec0);}return _0x759283[_0x57f5('0x24')]();};}function saveUpdates(_0x136c69,_0x3226c3){return function(_0x482bee){if(_0x482bee){return _0x482bee[_0x57f5('0x25')](_0x136c69)[_0x57f5('0x26')](function(_0x145f29){return _0x145f29;});}return null;};}function removeEntity(_0x3e1cce,_0x4c44ee){return function(_0x32b996){if(_0x32b996){return _0x32b996[_0x57f5('0x27')]()['then'](function(){_0x3e1cce[_0x57f5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1223f1,_0x472602){return function(_0x47d9a2){if(!_0x47d9a2){_0x1223f1[_0x57f5('0x1b')](0x194);}return _0x47d9a2;};}function handleError(_0xa33261,_0x4d885c){_0x4d885c=_0x4d885c||0x1f4;return function(_0x56d0a1){logger[_0x57f5('0x28')](_0x56d0a1[_0x57f5('0x29')]);if(_0x56d0a1[_0x57f5('0x2a')]){delete _0x56d0a1[_0x57f5('0x2a')];}_0xa33261['status'](_0x4d885c)['send'](_0x56d0a1);};}exports[_0x57f5('0x2b')]=function(_0x33f4ac,_0x3efbcb){var _0x1b80b6={},_0x48b5d9={},_0x14e2b2={'count':0x0,'rows':[]};var _0x4aad5c=_['map'](db['FaxApplication'][_0x57f5('0x2c')],function(_0x45b3fd){return{'name':_0x45b3fd['fieldName'],'type':_0x45b3fd[_0x57f5('0x2d')][_0x57f5('0x2e')]};});_0x48b5d9[_0x57f5('0x2f')]=_['map'](_0x4aad5c,'name');_0x48b5d9[_0x57f5('0x30')]=_[_0x57f5('0x31')](_0x33f4ac['query']);_0x48b5d9[_0x57f5('0x32')]=_[_0x57f5('0x33')](_0x48b5d9['model'],_0x48b5d9[_0x57f5('0x30')]);_0x1b80b6[_0x57f5('0x34')]=_['intersection'](_0x48b5d9['model'],qs[_0x57f5('0x35')](_0x33f4ac[_0x57f5('0x30')][_0x57f5('0x35')]));_0x1b80b6[_0x57f5('0x34')]=_0x1b80b6['attributes']['length']?_0x1b80b6['attributes']:_0x48b5d9[_0x57f5('0x2f')];if(!_0x33f4ac[_0x57f5('0x30')]['hasOwnProperty'](_0x57f5('0x36'))){_0x1b80b6['limit']=qs[_0x57f5('0x1f')](_0x33f4ac[_0x57f5('0x30')][_0x57f5('0x1f')]);_0x1b80b6[_0x57f5('0x1e')]=qs[_0x57f5('0x1e')](_0x33f4ac[_0x57f5('0x30')][_0x57f5('0x1e')]);}_0x1b80b6['order']=qs[_0x57f5('0x37')](_0x33f4ac[_0x57f5('0x30')]['sort']);_0x1b80b6[_0x57f5('0x38')]=qs[_0x57f5('0x32')](_[_0x57f5('0x39')](_0x33f4ac[_0x57f5('0x30')],_0x48b5d9['filters']),_0x4aad5c);if(_0x33f4ac['query']['filter']){_0x1b80b6[_0x57f5('0x38')]=_[_0x57f5('0x3a')](_0x1b80b6[_0x57f5('0x38')],{'$or':_[_0x57f5('0x3b')](_0x4aad5c,function(_0x3ba3f0){if(_0x3ba3f0[_0x57f5('0x2d')]!==_0x57f5('0x3c')){var _0x498a34={};_0x498a34[_0x3ba3f0[_0x57f5('0x2a')]]={'$like':'%'+_0x33f4ac[_0x57f5('0x30')][_0x57f5('0x3d')]+'%'};return _0x498a34;}})});}_0x1b80b6=_[_0x57f5('0x3a')]({},_0x1b80b6,_0x33f4ac[_0x57f5('0x3e')]);var _0x258b67={'where':_0x1b80b6[_0x57f5('0x38')]};return db['FaxApplication'][_0x57f5('0x21')](_0x258b67)[_0x57f5('0x26')](function(_0x37da74){_0x14e2b2[_0x57f5('0x21')]=_0x37da74;if(_0x33f4ac['query'][_0x57f5('0x3f')]){_0x1b80b6['include']=[{'all':!![]}];}return db[_0x57f5('0x40')][_0x57f5('0x41')](_0x1b80b6);})[_0x57f5('0x26')](function(_0x2fbddd){_0x14e2b2[_0x57f5('0x42')]=_0x2fbddd;return _0x14e2b2;})[_0x57f5('0x26')](respondWithFilteredResult(_0x3efbcb,_0x1b80b6))[_0x57f5('0x43')](handleError(_0x3efbcb,null));};exports[_0x57f5('0x44')]=function(_0x43a77a,_0x172b4a){var _0x381fbd={'raw':!![],'where':{'id':_0x43a77a[_0x57f5('0x45')]['id']}},_0x3596c7={};_0x3596c7[_0x57f5('0x2f')]=_[_0x57f5('0x31')](db['FaxApplication'][_0x57f5('0x2c')]);_0x3596c7['query']=_['keys'](_0x43a77a['query']);_0x3596c7[_0x57f5('0x32')]=_[_0x57f5('0x33')](_0x3596c7[_0x57f5('0x2f')],_0x3596c7['query']);_0x381fbd[_0x57f5('0x34')]=_[_0x57f5('0x33')](_0x3596c7[_0x57f5('0x2f')],qs[_0x57f5('0x35')](_0x43a77a[_0x57f5('0x30')][_0x57f5('0x35')]));_0x381fbd[_0x57f5('0x34')]=_0x381fbd['attributes'][_0x57f5('0x46')]?_0x381fbd['attributes']:_0x3596c7['model'];if(_0x43a77a[_0x57f5('0x30')][_0x57f5('0x3f')]){_0x381fbd['include']=[{'all':!![]}];}_0x381fbd=_[_0x57f5('0x3a')]({},_0x381fbd,_0x43a77a['options']);return db['FaxApplication'][_0x57f5('0x47')](_0x381fbd)[_0x57f5('0x26')](handleEntityNotFound(_0x172b4a,null))[_0x57f5('0x26')](respondWithResult(_0x172b4a,null))[_0x57f5('0x43')](handleError(_0x172b4a,null));};exports[_0x57f5('0x48')]=function(_0x3039b7,_0x285123){return db[_0x57f5('0x40')][_0x57f5('0x48')](_0x3039b7[_0x57f5('0x49')],{})[_0x57f5('0x26')](respondWithResult(_0x285123,0xc9))[_0x57f5('0x43')](handleError(_0x285123,null));};exports[_0x57f5('0x25')]=function(_0x4b00c4,_0x539ca8){if(_0x4b00c4[_0x57f5('0x49')]['id']){delete _0x4b00c4[_0x57f5('0x49')]['id'];}return db['FaxApplication'][_0x57f5('0x47')]({'where':{'id':_0x4b00c4[_0x57f5('0x45')]['id']}})[_0x57f5('0x26')](handleEntityNotFound(_0x539ca8,null))[_0x57f5('0x26')](saveUpdates(_0x4b00c4[_0x57f5('0x49')],null))['then'](respondWithResult(_0x539ca8,null))['catch'](handleError(_0x539ca8,null));};exports['destroy']=function(_0x52d14c,_0x25410f){return db['FaxApplication']['find']({'where':{'id':_0x52d14c[_0x57f5('0x45')]['id']}})[_0x57f5('0x26')](handleEntityNotFound(_0x25410f,null))[_0x57f5('0x26')](removeEntity(_0x25410f,null))['catch'](handleError(_0x25410f,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 50a45a7..1e0e2b4 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 _0x143f=['./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x50fe6c,_0xbf5380){var _0x18175f=function(_0x19eb08){while(--_0x19eb08){_0x50fe6c['push'](_0x50fe6c['shift']());}};_0x18175f(++_0xbf5380);}(_0x143f,0x1aa));var _0xf143=function(_0x435c6a,_0x4599d7){_0x435c6a=_0x435c6a-0x0;var _0xb15be4=_0x143f[_0x435c6a];return _0xb15be4;};'use strict';var _=require('lodash');var util=require(_0xf143('0x0'));var logger=require(_0xf143('0x1'))(_0xf143('0x2'));var moment=require('moment');var BPromise=require(_0xf143('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf143('0x4'));var rimraf=require(_0xf143('0x5'));var config=require('../../config/environment');var attributes=require(_0xf143('0x6'));module['exports']=function(_0x279a90,_0x1365bd){return _0x279a90[_0xf143('0x7')](_0xf143('0x8'),attributes,{'tableName':_0xf143('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf143('0xa'),'collate':_0xf143('0xb')});}; \ No newline at end of file +var _0x2e2a=['./faxApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x4a0821,_0x3ecba8){var _0x26169a=function(_0x1775c1){while(--_0x1775c1){_0x4a0821['push'](_0x4a0821['shift']());}};_0x26169a(++_0x3ecba8);}(_0x2e2a,0x170));var _0xa2e2=function(_0x313532,_0x33e75f){_0x313532=_0x313532-0x0;var _0x44bc16=_0x2e2a[_0x313532];return _0x44bc16;};'use strict';var _=require(_0xa2e2('0x0'));var util=require('util');var logger=require(_0xa2e2('0x1'))(_0xa2e2('0x2'));var moment=require(_0xa2e2('0x3'));var BPromise=require('bluebird');var rp=require(_0xa2e2('0x4'));var fs=require('fs');var path=require(_0xa2e2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa2e2('0x6'));module[_0xa2e2('0x7')]=function(_0x5d2dd9,_0x454e98){return _0x5d2dd9[_0xa2e2('0x8')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa2e2('0x9'),'collate':_0xa2e2('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index a4126f4..ef7c071 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 _0x836d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication','update','body','raw','options','where','attributes','limit','then','UpdateFaxApplication','debug','lodash','util','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x836d,0x126));var _0xd836=function(_0xa7239,_0x5d230f){_0xa7239=_0xa7239-0x0;var _0xb3675e=_0x836d[_0xa7239];return _0xb3675e;};'use strict';var _=require(_0xd836('0x0'));var util=require(_0xd836('0x1'));var moment=require(_0xd836('0x2'));var BPromise=require(_0xd836('0x3'));var rs=require(_0xd836('0x4'));var fs=require('fs');var Redis=require(_0xd836('0x5'));var db=require(_0xd836('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd836('0x7'))(_0xd836('0x8'));var config=require(_0xd836('0x9'));var jayson=require(_0xd836('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4534ef,_0x2da02d,_0x17a97c){return new BPromise(function(_0x83e235,_0x1ead58){return client[_0xd836('0xb')](_0x4534ef,_0x17a97c)['then'](function(_0x422358){logger[_0xd836('0xc')](_0xd836('0xd'),_0x2da02d,_0xd836('0xe'));logger['debug'](_0xd836('0xf'),_0x2da02d,_0xd836('0xe'),JSON[_0xd836('0x10')](_0x422358));if(_0x422358[_0xd836('0x11')]){if(_0x422358[_0xd836('0x11')][_0xd836('0x12')]===0x1f4){logger[_0xd836('0x11')](_0xd836('0xd'),_0x2da02d,_0x422358[_0xd836('0x11')][_0xd836('0x13')]);return _0x1ead58(_0x422358['error'][_0xd836('0x13')]);}logger[_0xd836('0x11')](_0xd836('0xd'),_0x2da02d,_0x422358['error'][_0xd836('0x13')]);return _0x83e235(_0x422358[_0xd836('0x11')]['message']);}else{logger['info'](_0xd836('0xd'),_0x2da02d,_0xd836('0xe'));_0x83e235(_0x422358[_0xd836('0x14')][_0xd836('0x13')]);}})[_0xd836('0x15')](function(_0x3de73e){logger[_0xd836('0x11')]('FaxApplication,\x20%s,\x20%s',_0x2da02d,_0x3de73e);_0x1ead58(_0x3de73e);});});}exports['UpdateFaxApplication']=function(_0x1adb34){var _0x481a60=this;return new Promise(function(_0x8d745a,_0x4ba018){return db[_0xd836('0x16')][_0xd836('0x17')](_0x1adb34[_0xd836('0x18')],{'raw':_0x1adb34['options']?_0x1adb34['options'][_0xd836('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1adb34[_0xd836('0x1a')]?_0x1adb34[_0xd836('0x1a')][_0xd836('0x1b')]||null:null,'attributes':_0x1adb34['options']?_0x1adb34[_0xd836('0x1a')][_0xd836('0x1c')]||null:null,'limit':_0x1adb34[_0xd836('0x1a')]?_0x1adb34['options'][_0xd836('0x1d')]||null:null})[_0xd836('0x1e')](function(_0x4329bc){logger[_0xd836('0xc')](_0xd836('0x1f'),_0x1adb34);logger[_0xd836('0x20')](_0xd836('0x1f'),_0x1adb34,JSON[_0xd836('0x10')](_0x4329bc));_0x8d745a(_0x4329bc);})[_0xd836('0x15')](function(_0x209013){logger[_0xd836('0x11')](_0xd836('0x1f'),_0x209013[_0xd836('0x13')],_0x1adb34);_0x4ba018(_0x481a60[_0xd836('0x11')](0x1f4,_0x209013[_0xd836('0x13')]));});});}; \ No newline at end of file +var _0x118c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateFaxApplication','update','body','options','where','attributes','limit','lodash','util','moment'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x118c,0x1ec));var _0xc118=function(_0x2cb11a,_0x27f77a){_0x2cb11a=_0x2cb11a-0x0;var _0xe67271=_0x118c[_0x2cb11a];return _0xe67271;};'use strict';var _=require(_0xc118('0x0'));var util=require(_0xc118('0x1'));var moment=require(_0xc118('0x2'));var BPromise=require(_0xc118('0x3'));var rs=require(_0xc118('0x4'));var fs=require('fs');var Redis=require(_0xc118('0x5'));var db=require(_0xc118('0x6'))['db'];var utils=require(_0xc118('0x7'));var logger=require(_0xc118('0x8'))(_0xc118('0x9'));var config=require(_0xc118('0xa'));var jayson=require(_0xc118('0xb'));var client=jayson[_0xc118('0xc')][_0xc118('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4ff7ba,_0x26a8e4,_0x124ab9){return new BPromise(function(_0x2fe8a3,_0x3d9205){return client[_0xc118('0xe')](_0x4ff7ba,_0x124ab9)[_0xc118('0xf')](function(_0x492d94){logger['info'](_0xc118('0x10'),_0x26a8e4,_0xc118('0x11'));logger[_0xc118('0x12')](_0xc118('0x13'),_0x26a8e4,_0xc118('0x11'),JSON[_0xc118('0x14')](_0x492d94));if(_0x492d94['error']){if(_0x492d94[_0xc118('0x15')][_0xc118('0x16')]===0x1f4){logger[_0xc118('0x15')]('FaxApplication,\x20%s,\x20%s',_0x26a8e4,_0x492d94[_0xc118('0x15')][_0xc118('0x17')]);return _0x3d9205(_0x492d94['error'][_0xc118('0x17')]);}logger[_0xc118('0x15')](_0xc118('0x10'),_0x26a8e4,_0x492d94['error'][_0xc118('0x17')]);return _0x2fe8a3(_0x492d94[_0xc118('0x15')]['message']);}else{logger[_0xc118('0x18')](_0xc118('0x10'),_0x26a8e4,_0xc118('0x11'));_0x2fe8a3(_0x492d94[_0xc118('0x19')][_0xc118('0x17')]);}})['catch'](function(_0x135805){logger['error']('FaxApplication,\x20%s,\x20%s',_0x26a8e4,_0x135805);_0x3d9205(_0x135805);});});}exports[_0xc118('0x1a')]=function(_0x1c0662){var _0x5d680e=this;return new Promise(function(_0x25b961,_0x7e4cc3){return db['FaxApplication'][_0xc118('0x1b')](_0x1c0662[_0xc118('0x1c')],{'raw':_0x1c0662[_0xc118('0x1d')]?_0x1c0662[_0xc118('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c0662['options']?_0x1c0662[_0xc118('0x1d')][_0xc118('0x1e')]||null:null,'attributes':_0x1c0662['options']?_0x1c0662[_0xc118('0x1d')][_0xc118('0x1f')]||null:null,'limit':_0x1c0662[_0xc118('0x1d')]?_0x1c0662[_0xc118('0x1d')][_0xc118('0x20')]||null:null})[_0xc118('0xf')](function(_0x5c8928){logger[_0xc118('0x18')]('UpdateFaxApplication',_0x1c0662);logger[_0xc118('0x12')](_0xc118('0x1a'),_0x1c0662,JSON[_0xc118('0x14')](_0x5c8928));_0x25b961(_0x5c8928);})['catch'](function(_0x4db55a){logger['error']('UpdateFaxApplication',_0x4db55a[_0xc118('0x17')],_0x1c0662);_0x7e4cc3(_0x5d680e[_0xc118('0x15')](0x1f4,_0x4db55a[_0xc118('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 09debc6..0533d7c 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 _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x2ede90,_0x3b446b){var _0x3283ea=function(_0x344c6e){while(--_0x344c6e){_0x2ede90['push'](_0x2ede90['shift']());}};_0x3283ea(++_0x3b446b);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'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['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file +var _0x36ee=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','path','express'];(function(_0xea46d,_0x254082){var _0x1fa4c5=function(_0x4d7817){while(--_0x4d7817){_0xea46d['push'](_0xea46d['shift']());}};_0x1fa4c5(++_0x254082);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['post']('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xd')]);router[_0xe36e('0xe')]('/:id',auth[_0xe36e('0x9')](),controller['update']);router[_0xe36e('0xf')](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x10')]);module[_0xe36e('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 e70c50a..6f11909 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 _0xcaf2=['DATE','STRING','ENUM','out','INTEGER','sequelize','BOOLEAN'];(function(_0x30ed79,_0x5cdfdb){var _0x5a2f51=function(_0x1296c6){while(--_0x1296c6){_0x30ed79['push'](_0x30ed79['shift']());}};_0x5a2f51(++_0x5cdfdb);}(_0xcaf2,0x8a));var _0x2caf=function(_0x1d5677,_0x342d27){_0x1d5677=_0x1d5677-0x0;var _0x274227=_0xcaf2[_0x1d5677];return _0x274227;};'use strict';var Sequelize=require(_0x2caf('0x0'));module['exports']={'closed':{'type':Sequelize[_0x2caf('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2caf('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2caf('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2caf('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2caf('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x2caf('0x4')]('in',_0x2caf('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2caf('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2caf('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x2caf('0x6')]}}; \ No newline at end of file +var _0x781d=['INTEGER','sequelize','exports','STRING','DATE','ENUM','out'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x781d,0x14a));var _0xd781=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x781d[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0xd781('0x0'));module[_0xd781('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xd781('0x2')]},'secondDisposition':{'type':Sequelize[_0xd781('0x2')]},'thirdDisposition':{'type':Sequelize[_0xd781('0x2')]},'note':{'type':Sequelize[_0xd781('0x2')]},'read1stAt':{'type':Sequelize[_0xd781('0x3')]},'fax':{'type':Sequelize[_0xd781('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xd781('0x4')]('in',_0xd781('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd781('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd781('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xd781('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index fb0cf86..a9d483b 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 _0xf502=['fieldName','type','key','getOptions','findAll','query','user','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','FaxMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','where','map','filter','format','rows','spread','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','attachments','transcript-%d-%s.zip','push','Messages','createdAt','get','mkdirSync','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','err','unlinkSync','rimraf','zip-dir','moment','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','offset','limit','count','set','Content-Range','json','update','destroy','then','error','stack','name','send','index','FaxInteraction','rawAttributes'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0xf502,0x104));var _0x2f50=function(_0x14476b,_0xd1a7a4){_0x14476b=_0x14476b-0x0;var _0x24e2e8=_0xf502[_0x14476b];return _0x24e2e8;};'use strict';var rimraf=require(_0x2f50('0x0'));var zipdir=require(_0x2f50('0x1'));var moment=require(_0x2f50('0x2'));var BPromise=require('bluebird');var util=require(_0x2f50('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x2f50('0x4'));var Redis=require('ioredis');var interaction=require(_0x2f50('0x5'));var qs=require(_0x2f50('0x6'));var logger=require(_0x2f50('0x7'))(_0x2f50('0x8'));var config=require(_0x2f50('0x9'));var db=require(_0x2f50('0xa'))['db'];config[_0x2f50('0xb')]=_[_0x2f50('0xc')](config[_0x2f50('0xb')],{'host':_0x2f50('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f50('0xb')]));require(_0x2f50('0xe'))[_0x2f50('0xf')](socket);function respondWithStatusCode(_0x21ea8f,_0xaa3365){_0xaa3365=_0xaa3365||0xcc;return function(_0x1e343e){if(_0x1e343e){return _0x21ea8f[_0x2f50('0x10')](_0xaa3365);}return _0x21ea8f[_0x2f50('0x11')](_0xaa3365)['end']();};}function respondWithResult(_0x418daf,_0x4aadb3){_0x4aadb3=_0x4aadb3||0xc8;return function(_0x5f5cac){if(_0x5f5cac){return _0x418daf['status'](_0x4aadb3)['json'](_0x5f5cac);}};}function respondWithFilteredResult(_0x397179,_0x4c185f){return function(_0x51672e){if(_0x51672e){var _0x4d27f0=typeof _0x4c185f[_0x2f50('0x12')]==='undefined'&&typeof _0x4c185f[_0x2f50('0x13')]==='undefined';var _0x1c449e=_0x51672e[_0x2f50('0x14')];var _0xa5ad2e=_0x4d27f0?0x0:_0x4c185f['offset'];var _0x22e635=_0x4d27f0?_0x51672e[_0x2f50('0x14')]:_0x4c185f[_0x2f50('0x12')]+_0x4c185f[_0x2f50('0x13')];var _0x2cb5e1;if(_0x22e635>=_0x1c449e){_0x22e635=_0x1c449e;_0x2cb5e1=0xc8;}else{_0x2cb5e1=0xce;}_0x397179['status'](_0x2cb5e1);return _0x397179[_0x2f50('0x15')](_0x2f50('0x16'),_0xa5ad2e+'-'+_0x22e635+'/'+_0x1c449e)[_0x2f50('0x17')](_0x51672e);}return null;};}function saveUpdates(_0xcc1fc4){return function(_0x4a43eb){if(_0x4a43eb){return _0x4a43eb[_0x2f50('0x18')](_0xcc1fc4)['then'](function(_0x496239){return _0x496239;});}return null;};}function removeEntity(_0x316040){return function(_0xf00f28){if(_0xf00f28){return _0xf00f28[_0x2f50('0x19')]()[_0x2f50('0x1a')](function(){_0x316040[_0x2f50('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415ce3){return function(_0x3008c1){if(!_0x3008c1){_0x415ce3[_0x2f50('0x10')](0x194);}return _0x3008c1;};}function handleError(_0x1ec791,_0x1ff488){_0x1ff488=_0x1ff488||0x1f4;return function(_0x2f8e88){logger[_0x2f50('0x1b')](_0x2f8e88[_0x2f50('0x1c')]);if(_0x2f8e88[_0x2f50('0x1d')]){delete _0x2f8e88['name'];}_0x1ec791[_0x2f50('0x11')](_0x1ff488)[_0x2f50('0x1e')](_0x2f8e88);};}exports[_0x2f50('0x1f')]=function(_0x40419f,_0x479a69){var _0x2bd32d={};var _0x41be10=_['map'](db[_0x2f50('0x20')][_0x2f50('0x21')],function(_0x1aff1d){return{'name':_0x1aff1d[_0x2f50('0x22')],'type':_0x1aff1d[_0x2f50('0x23')][_0x2f50('0x24')]};});_0x2bd32d=qs[_0x2f50('0x25')](_0x41be10,_0x40419f);return interaction[_0x2f50('0x26')]('fax',_0x40419f[_0x2f50('0x27')],_0x40419f[_0x2f50('0x28')],_0x2bd32d,_0x41be10)[_0x2f50('0x1a')](respondWithFilteredResult(_0x479a69,_0x2bd32d))[_0x2f50('0x29')](handleError(_0x479a69,null));};exports['show']=function(_0xb36827,_0x3e39c8){var _0x5b7f79={'raw':![],'where':{'id':_0xb36827[_0x2f50('0x2a')]['id']}},_0x1f60ee={};_0x1f60ee[_0x2f50('0x2b')]=_['keys'](db[_0x2f50('0x20')][_0x2f50('0x21')]);_0x1f60ee[_0x2f50('0x27')]=_[_0x2f50('0x2c')](_0xb36827[_0x2f50('0x27')]);_0x1f60ee[_0x2f50('0x2d')]=_[_0x2f50('0x2e')](_0x1f60ee[_0x2f50('0x2b')],_0x1f60ee[_0x2f50('0x27')]);_0x5b7f79[_0x2f50('0x2f')]=_['intersection'](_0x1f60ee['model'],qs[_0x2f50('0x30')](_0xb36827[_0x2f50('0x27')][_0x2f50('0x30')]));_0x5b7f79[_0x2f50('0x2f')]=_0x5b7f79['attributes'][_0x2f50('0x31')]?_0x5b7f79['attributes']:_0x1f60ee[_0x2f50('0x2b')];if(_0xb36827[_0x2f50('0x27')][_0x2f50('0x32')]){_0x5b7f79[_0x2f50('0x33')]=[{'all':!![]}];}_0x5b7f79=_[_0x2f50('0x34')]({},_0x5b7f79,_0xb36827[_0x2f50('0x35')]);return db[_0x2f50('0x20')][_0x2f50('0x36')](_0x5b7f79)[_0x2f50('0x1a')](handleEntityNotFound(_0x3e39c8,null))[_0x2f50('0x1a')](respondWithResult(_0x3e39c8,null))[_0x2f50('0x29')](handleError(_0x3e39c8,null));};exports['create']=function(_0x129801,_0x41ba05){return db[_0x2f50('0x20')][_0x2f50('0x37')](_0x129801[_0x2f50('0x38')],{})[_0x2f50('0x1a')](respondWithResult(_0x41ba05,0xc9))['catch'](handleError(_0x41ba05,null));};exports['update']=function(_0x113517,_0x5db194){if(_0x113517[_0x2f50('0x38')]['id']){delete _0x113517[_0x2f50('0x38')]['id'];}return db[_0x2f50('0x20')][_0x2f50('0x36')]({'where':{'id':_0x113517[_0x2f50('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5db194,null))[_0x2f50('0x1a')](saveUpdates(_0x113517[_0x2f50('0x38')],null))['then'](respondWithResult(_0x5db194,null))[_0x2f50('0x29')](handleError(_0x5db194,null));};exports[_0x2f50('0x19')]=function(_0x1b3217,_0x2053c5){return db['FaxInteraction'][_0x2f50('0x36')]({'where':{'id':_0x1b3217[_0x2f50('0x2a')]['id']}})[_0x2f50('0x1a')](handleEntityNotFound(_0x2053c5,null))['then'](removeEntity(_0x2053c5,null))['catch'](handleError(_0x2053c5,null));};exports[_0x2f50('0x39')]=function(_0x3610ef,_0x364e75){return db[_0x2f50('0x20')][_0x2f50('0x39')]()['then'](respondWithResult(_0x364e75,null))['catch'](handleError(_0x364e75,null));};exports[_0x2f50('0x3a')]=function(_0x3d206e,_0x58c0cf){return db[_0x2f50('0x3b')][_0x2f50('0x36')]({'where':{'id':_0x3d206e[_0x2f50('0x2a')]['id']}})[_0x2f50('0x1a')](handleEntityNotFound(_0x58c0cf,null))['then'](function(_0xcaddbf){if(_0xcaddbf){return _0xcaddbf[_0x2f50('0x3a')](_0x3d206e[_0x2f50('0x38')][_0x2f50('0x3c')],_[_0x2f50('0x3d')](_0x3d206e['body'],[_0x2f50('0x3c'),'id'])||{});}})[_0x2f50('0x1a')](respondWithResult(_0x58c0cf,null))[_0x2f50('0x29')](handleError(_0x58c0cf,null));};exports['getMessages']=function(_0x1d993c,_0x524471){var _0x15a245={'raw':![],'where':{}};var _0x903564={};var _0x769379={'count':0x0,'rows':[]};return db[_0x2f50('0x20')][_0x2f50('0x3e')]({'where':{'id':_0x1d993c[_0x2f50('0x2a')]['id']}})[_0x2f50('0x1a')](handleEntityNotFound(_0x524471,null))[_0x2f50('0x1a')](function(_0x2414d9){if(_0x2414d9){_0x903564[_0x2f50('0x2b')]=_[_0x2f50('0x2c')](db[_0x2f50('0x3b')][_0x2f50('0x21')]);_0x903564[_0x2f50('0x27')]=_[_0x2f50('0x2c')](_0x1d993c[_0x2f50('0x27')]);_0x903564[_0x2f50('0x2d')]=_[_0x2f50('0x2e')](_0x903564[_0x2f50('0x2b')],_0x903564['query']);_0x15a245[_0x2f50('0x2f')]=_[_0x2f50('0x2e')](_0x903564['model'],qs['fields'](_0x1d993c[_0x2f50('0x27')][_0x2f50('0x30')]));_0x15a245[_0x2f50('0x2f')]=_0x15a245['attributes'][_0x2f50('0x31')]?_0x15a245['attributes']:_0x903564[_0x2f50('0x2b')];if(!_0x1d993c[_0x2f50('0x27')][_0x2f50('0x3f')](_0x2f50('0x40'))){_0x15a245[_0x2f50('0x13')]=qs['limit'](_0x1d993c['query'][_0x2f50('0x13')]);_0x15a245[_0x2f50('0x12')]=qs[_0x2f50('0x12')](_0x1d993c[_0x2f50('0x27')]['offset']);}_0x15a245[_0x2f50('0x41')]=qs[_0x2f50('0x42')](_0x1d993c[_0x2f50('0x27')]['sort']);_0x15a245[_0x2f50('0x43')]=qs['filters'](_['pick'](_0x1d993c[_0x2f50('0x27')],_0x903564['filters']));_0x15a245[_0x2f50('0x43')]['FaxInteractionId']=_0x2414d9['id'];if(_0x1d993c[_0x2f50('0x27')]['filter']){_0x15a245[_0x2f50('0x43')]=_[_0x2f50('0x34')](_0x15a245[_0x2f50('0x43')],{'$or':_[_0x2f50('0x44')](_0x15a245[_0x2f50('0x2f')],function(_0xcbab4){var _0x3b1c4f={};_0x3b1c4f[_0xcbab4]={'$like':'%'+_0x1d993c[_0x2f50('0x27')][_0x2f50('0x45')]+'%'};return _0x3b1c4f;})});}if(_0x1d993c[_0x2f50('0x27')]['$gte']){var _0x21d623=_0x1d993c['query']['$gte']['split'](',');var _0x214723={};_0x214723[_0x21d623[0x0]]={'$gte':moment(_0x21d623[0x1])[_0x2f50('0x46')]('YYYY-MM-DD\x20HH:mm:ss')};_0x15a245[_0x2f50('0x43')]=_['merge'](_0x15a245[_0x2f50('0x43')],_0x214723);}_0x15a245=_[_0x2f50('0x34')]({},_0x15a245,_0x1d993c[_0x2f50('0x35')]);return db[_0x2f50('0x3b')][_0x2f50('0x14')]({'where':_0x15a245['where']})[_0x2f50('0x1a')](function(_0x42dba9){_0x769379[_0x2f50('0x14')]=_0x42dba9;if(_0x1d993c[_0x2f50('0x27')][_0x2f50('0x32')]){_0x15a245[_0x2f50('0x33')]=[{'all':!![]}];}return db[_0x2f50('0x3b')][_0x2f50('0x26')](_0x15a245);})[_0x2f50('0x1a')](function(_0x3e4013){_0x769379[_0x2f50('0x47')]=_0x3e4013;return _0x769379;});}})[_0x2f50('0x1a')](respondWithFilteredResult(_0x524471,_0x15a245))[_0x2f50('0x29')](handleError(_0x524471,null));};exports['addTags']=function(_0x22916b,_0x249224){return db[_0x2f50('0x20')][_0x2f50('0x36')]({'where':{'id':_0x22916b[_0x2f50('0x2a')]['id']}})['then'](handleEntityNotFound(_0x249224,null))[_0x2f50('0x1a')](function(_0x1b0d59){if(_0x1b0d59){return _0x1b0d59['setTags'](_0x22916b['body']['ids'],_['omit'](_0x22916b[_0x2f50('0x38')],[_0x2f50('0x3c'),'id'])||{})[_0x2f50('0x48')](function(){return db['Tag'][_0x2f50('0x26')]({'attributes':['id',_0x2f50('0x1d'),'color'],'where':{'id':_0x22916b[_0x2f50('0x38')][_0x2f50('0x3c')]}});})['then'](function(_0x121ae1){socket['emit'](_0x2f50('0x49'),{'id':Number(_0x22916b[_0x2f50('0x2a')]['id']),'tags':_0x121ae1||[]});return{'id':Number(_0x22916b[_0x2f50('0x2a')]['id']),'tags':_0x121ae1||[]};});}})[_0x2f50('0x1a')](respondWithResult(_0x249224,null))[_0x2f50('0x29')](handleError(_0x249224,null));};exports[_0x2f50('0x4a')]=function(_0x2d722c,_0x2d48ae){return db[_0x2f50('0x20')]['find']({'where':{'id':_0x2d722c['params']['id']}})[_0x2f50('0x1a')](handleEntityNotFound(_0x2d48ae,null))[_0x2f50('0x1a')](function(_0x1827a9){if(_0x1827a9){return _0x1827a9[_0x2f50('0x4a')](_0x2d722c[_0x2f50('0x27')][_0x2f50('0x3c')]);}})[_0x2f50('0x1a')](respondWithStatusCode(_0x2d48ae,null))[_0x2f50('0x29')](handleError(_0x2d48ae,null));};exports[_0x2f50('0x4b')]=function(_0x52fc52,_0x10d1c2){var _0x4ea1d4=moment()[_0x2f50('0x4c')]()[_0x2f50('0x4d')]();var _0x43bdcf=path[_0x2f50('0x4e')](config[_0x2f50('0x4f')],_0x2f50('0x50'),'files',_0x2f50('0x51'));var _0x18b0d2=path[_0x2f50('0x4e')](config[_0x2f50('0x4f')],'server','files',_0x2f50('0x52'));var _0x141f08=path[_0x2f50('0x4e')](_0x43bdcf,_0x4ea1d4);var _0x214971=util[_0x2f50('0x46')](_0x2f50('0x53'),_0x52fc52[_0x2f50('0x2a')]['id'],_0x4ea1d4);var _0x1dd7a2=path['join'](_0x43bdcf,_0x214971);var _0x491f1c=[];_0x491f1c[_0x2f50('0x54')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x3a4580=[{'model':db[_0x2f50('0x3b')],'as':_0x2f50('0x55'),'attributes':['id',_0x2f50('0x38'),_0x2f50('0x56')],'include':_0x491f1c}];return db[_0x2f50('0x20')][_0x2f50('0x36')]({'where':{'id':_0x52fc52[_0x2f50('0x2a')]['id']},'include':_0x3a4580})[_0x2f50('0x1a')](handleEntityNotFound(_0x10d1c2,null))[_0x2f50('0x1a')](function(_0x87d462){if(_0x87d462&&_0x87d462[_0x2f50('0x55')]){var _0x2ee372=_0x87d462[_0x2f50('0x57')]({'plain':!![]});fs[_0x2f50('0x58')](_0x141f08);for(var _0x34b54e=0x0;_0x34b54e<_0x2ee372[_0x2f50('0x55')]['length'];_0x34b54e++){var _0x285712=_0x2ee372[_0x2f50('0x55')][_0x34b54e][_0x2f50('0x59')];if(_0x285712){var _0xc4c785=path[_0x2f50('0x4e')](_0x18b0d2,_0x285712[_0x2f50('0x5a')]);if(fs[_0x2f50('0x5b')](_0xc4c785)){fs[_0x2f50('0x5c')](_0xc4c785)[_0x2f50('0x5d')](fs[_0x2f50('0x5e')](path[_0x2f50('0x4e')](_0x141f08,_0x285712[_0x2f50('0x5a')])));}}}return BPromise[_0x2f50('0x5f')]()[_0x2f50('0x1a')](function(){return new BPromise(function(_0x5e99b0,_0x3312fd){zipdir(_0x141f08,{'saveTo':_0x1dd7a2},function(_0x24fe37,_0x3a637c){if(_0x24fe37)return _0x3312fd(_0x24fe37);return _0x5e99b0(_0x3a637c);});})[_0x2f50('0x1a')](function(){return new BPromise(function(_0x587561,_0x330b89){rimraf(_0x141f08,function(_0x389840){if(_0x389840)_0x330b89(_0x389840);return _0x587561();});});})['then'](function(){return _0x10d1c2['download'](_0x1dd7a2,_0x214971,function(_0x413b04){if(_0x413b04){console['log'](_0x2f50('0x60'),_0x413b04);}else{fs[_0x2f50('0x61')](_0x1dd7a2);}});});});}else{return _0x10d1c2[_0x2f50('0x10')](0xc8);}})['catch'](handleError(_0x10d1c2,null));}; \ No newline at end of file +var _0x61e3=['$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','createReadStream','pipe','resolve','err','unlinkSync','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','destroy','then','end','error','stack','name','index','map','FaxInteraction','type','key','getOptions','query','user','catch','show','params','model','rawAttributes','filters','intersection','attributes','fields','includeAll','include','options','body','find','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','keys','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x132787,_0x49aebb){var _0x281428=function(_0x5e354e){while(--_0x5e354e){_0x132787['push'](_0x132787['shift']());}};_0x281428(++_0x49aebb);}(_0x61e3,0x1af));var _0x361e=function(_0x268bf8,_0x31c5ec){_0x268bf8=_0x268bf8-0x0;var _0x3f3224=_0x61e3[_0x268bf8];return _0x3f3224;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x361e('0x0'));var moment=require(_0x361e('0x1'));var BPromise=require(_0x361e('0x2'));var util=require('util');var path=require(_0x361e('0x3'));var fs=require('fs');var _=require(_0x361e('0x4'));var Redis=require(_0x361e('0x5'));var interaction=require(_0x361e('0x6'));var qs=require(_0x361e('0x7'));var logger=require('../../config/logger')(_0x361e('0x8'));var config=require(_0x361e('0x9'));var db=require(_0x361e('0xa'))['db'];config['redis']=_[_0x361e('0xb')](config['redis'],{'host':_0x361e('0xc'),'port':0x18eb});var socket=require(_0x361e('0xd'))(new Redis(config['redis']));require(_0x361e('0xe'))[_0x361e('0xf')](socket);function respondWithStatusCode(_0x9ba4b9,_0x4f18e2){_0x4f18e2=_0x4f18e2||0xcc;return function(_0x4977dc){if(_0x4977dc){return _0x9ba4b9[_0x361e('0x10')](_0x4f18e2);}return _0x9ba4b9[_0x361e('0x11')](_0x4f18e2)['end']();};}function respondWithResult(_0x58d51d,_0x5784ea){_0x5784ea=_0x5784ea||0xc8;return function(_0xcd27d5){if(_0xcd27d5){return _0x58d51d['status'](_0x5784ea)[_0x361e('0x12')](_0xcd27d5);}};}function respondWithFilteredResult(_0x2a82c4,_0x4a2a35){return function(_0x33893f){if(_0x33893f){var _0x264a06=typeof _0x4a2a35[_0x361e('0x13')]===_0x361e('0x14')&&typeof _0x4a2a35[_0x361e('0x15')]===_0x361e('0x14');var _0x23437c=_0x33893f[_0x361e('0x16')];var _0x1d3b8b=_0x264a06?0x0:_0x4a2a35[_0x361e('0x13')];var _0x3d09db=_0x264a06?_0x33893f[_0x361e('0x16')]:_0x4a2a35['offset']+_0x4a2a35[_0x361e('0x15')];var _0x31c27e;if(_0x3d09db>=_0x23437c){_0x3d09db=_0x23437c;_0x31c27e=0xc8;}else{_0x31c27e=0xce;}_0x2a82c4[_0x361e('0x11')](_0x31c27e);return _0x2a82c4['set'](_0x361e('0x17'),_0x1d3b8b+'-'+_0x3d09db+'/'+_0x23437c)[_0x361e('0x12')](_0x33893f);}return null;};}function saveUpdates(_0xbf1449){return function(_0x340469){if(_0x340469){return _0x340469[_0x361e('0x18')](_0xbf1449)['then'](function(_0xb547e7){return _0xb547e7;});}return null;};}function removeEntity(_0x242943){return function(_0xaa1737){if(_0xaa1737){return _0xaa1737[_0x361e('0x19')]()[_0x361e('0x1a')](function(){_0x242943[_0x361e('0x11')](0xcc)[_0x361e('0x1b')]();});}};}function handleEntityNotFound(_0x5a208f){return function(_0x44deec){if(!_0x44deec){_0x5a208f[_0x361e('0x10')](0x194);}return _0x44deec;};}function handleError(_0x248d6b,_0x32ff42){_0x32ff42=_0x32ff42||0x1f4;return function(_0x4ade12){logger[_0x361e('0x1c')](_0x4ade12[_0x361e('0x1d')]);if(_0x4ade12['name']){delete _0x4ade12[_0x361e('0x1e')];}_0x248d6b['status'](_0x32ff42)['send'](_0x4ade12);};}exports[_0x361e('0x1f')]=function(_0x4377ca,_0x492dde){var _0xa4ef75={};var _0x59fa19=_[_0x361e('0x20')](db[_0x361e('0x21')]['rawAttributes'],function(_0x593830){return{'name':_0x593830['fieldName'],'type':_0x593830[_0x361e('0x22')][_0x361e('0x23')]};});_0xa4ef75=qs[_0x361e('0x24')](_0x59fa19,_0x4377ca);return interaction['findAll']('fax',_0x4377ca[_0x361e('0x25')],_0x4377ca[_0x361e('0x26')],_0xa4ef75,_0x59fa19)[_0x361e('0x1a')](respondWithFilteredResult(_0x492dde,_0xa4ef75))[_0x361e('0x27')](handleError(_0x492dde,null));};exports[_0x361e('0x28')]=function(_0x3412df,_0x1347e7){var _0x3a7ec7={'raw':![],'where':{'id':_0x3412df[_0x361e('0x29')]['id']}},_0x268387={};_0x268387[_0x361e('0x2a')]=_['keys'](db[_0x361e('0x21')][_0x361e('0x2b')]);_0x268387[_0x361e('0x25')]=_['keys'](_0x3412df[_0x361e('0x25')]);_0x268387[_0x361e('0x2c')]=_[_0x361e('0x2d')](_0x268387[_0x361e('0x2a')],_0x268387[_0x361e('0x25')]);_0x3a7ec7[_0x361e('0x2e')]=_[_0x361e('0x2d')](_0x268387[_0x361e('0x2a')],qs[_0x361e('0x2f')](_0x3412df[_0x361e('0x25')][_0x361e('0x2f')]));_0x3a7ec7['attributes']=_0x3a7ec7[_0x361e('0x2e')]['length']?_0x3a7ec7['attributes']:_0x268387['model'];if(_0x3412df['query'][_0x361e('0x30')]){_0x3a7ec7[_0x361e('0x31')]=[{'all':!![]}];}_0x3a7ec7=_['merge']({},_0x3a7ec7,_0x3412df[_0x361e('0x32')]);return db[_0x361e('0x21')]['find'](_0x3a7ec7)[_0x361e('0x1a')](handleEntityNotFound(_0x1347e7,null))[_0x361e('0x1a')](respondWithResult(_0x1347e7,null))[_0x361e('0x27')](handleError(_0x1347e7,null));};exports['create']=function(_0x4cb645,_0x4fec3a){return db[_0x361e('0x21')]['create'](_0x4cb645['body'],{})[_0x361e('0x1a')](respondWithResult(_0x4fec3a,0xc9))[_0x361e('0x27')](handleError(_0x4fec3a,null));};exports[_0x361e('0x18')]=function(_0xdb016,_0xf7f3b0){if(_0xdb016[_0x361e('0x33')]['id']){delete _0xdb016[_0x361e('0x33')]['id'];}return db[_0x361e('0x21')][_0x361e('0x34')]({'where':{'id':_0xdb016[_0x361e('0x29')]['id']}})[_0x361e('0x1a')](handleEntityNotFound(_0xf7f3b0,null))[_0x361e('0x1a')](saveUpdates(_0xdb016[_0x361e('0x33')],null))[_0x361e('0x1a')](respondWithResult(_0xf7f3b0,null))[_0x361e('0x27')](handleError(_0xf7f3b0,null));};exports[_0x361e('0x19')]=function(_0x1329be,_0x4ff1b2){return db[_0x361e('0x21')][_0x361e('0x34')]({'where':{'id':_0x1329be[_0x361e('0x29')]['id']}})[_0x361e('0x1a')](handleEntityNotFound(_0x4ff1b2,null))[_0x361e('0x1a')](removeEntity(_0x4ff1b2,null))['catch'](handleError(_0x4ff1b2,null));};exports['describe']=function(_0x455a87,_0x59ba2b){return db['FaxInteraction'][_0x361e('0x35')]()[_0x361e('0x1a')](respondWithResult(_0x59ba2b,null))[_0x361e('0x27')](handleError(_0x59ba2b,null));};exports[_0x361e('0x36')]=function(_0x1f8085,_0x191291){return db[_0x361e('0x37')][_0x361e('0x34')]({'where':{'id':_0x1f8085[_0x361e('0x29')]['id']}})[_0x361e('0x1a')](handleEntityNotFound(_0x191291,null))[_0x361e('0x1a')](function(_0x28798c){if(_0x28798c){return _0x28798c['addMessage'](_0x1f8085['body'][_0x361e('0x38')],_[_0x361e('0x39')](_0x1f8085['body'],[_0x361e('0x38'),'id'])||{});}})[_0x361e('0x1a')](respondWithResult(_0x191291,null))[_0x361e('0x27')](handleError(_0x191291,null));};exports[_0x361e('0x3a')]=function(_0x321ad6,_0x2e57a6){var _0x4214e5={'raw':![],'where':{}};var _0x4918b6={};var _0x3dfba6={'count':0x0,'rows':[]};return db[_0x361e('0x21')][_0x361e('0x3b')]({'where':{'id':_0x321ad6[_0x361e('0x29')]['id']}})[_0x361e('0x1a')](handleEntityNotFound(_0x2e57a6,null))[_0x361e('0x1a')](function(_0x112ba7){if(_0x112ba7){_0x4918b6[_0x361e('0x2a')]=_[_0x361e('0x3c')](db['FaxMessage'][_0x361e('0x2b')]);_0x4918b6[_0x361e('0x25')]=_['keys'](_0x321ad6['query']);_0x4918b6[_0x361e('0x2c')]=_[_0x361e('0x2d')](_0x4918b6[_0x361e('0x2a')],_0x4918b6[_0x361e('0x25')]);_0x4214e5[_0x361e('0x2e')]=_['intersection'](_0x4918b6['model'],qs[_0x361e('0x2f')](_0x321ad6[_0x361e('0x25')][_0x361e('0x2f')]));_0x4214e5[_0x361e('0x2e')]=_0x4214e5[_0x361e('0x2e')]['length']?_0x4214e5[_0x361e('0x2e')]:_0x4918b6[_0x361e('0x2a')];if(!_0x321ad6['query'][_0x361e('0x3d')](_0x361e('0x3e'))){_0x4214e5[_0x361e('0x15')]=qs['limit'](_0x321ad6[_0x361e('0x25')]['limit']);_0x4214e5[_0x361e('0x13')]=qs['offset'](_0x321ad6[_0x361e('0x25')]['offset']);}_0x4214e5[_0x361e('0x3f')]=qs[_0x361e('0x40')](_0x321ad6[_0x361e('0x25')][_0x361e('0x40')]);_0x4214e5[_0x361e('0x41')]=qs[_0x361e('0x2c')](_[_0x361e('0x42')](_0x321ad6[_0x361e('0x25')],_0x4918b6[_0x361e('0x2c')]));_0x4214e5[_0x361e('0x41')]['FaxInteractionId']=_0x112ba7['id'];if(_0x321ad6[_0x361e('0x25')][_0x361e('0x43')]){_0x4214e5[_0x361e('0x41')]=_[_0x361e('0x44')](_0x4214e5[_0x361e('0x41')],{'$or':_['map'](_0x4214e5[_0x361e('0x2e')],function(_0x283a45){var _0x30521b={};_0x30521b[_0x283a45]={'$like':'%'+_0x321ad6[_0x361e('0x25')]['filter']+'%'};return _0x30521b;})});}if(_0x321ad6[_0x361e('0x25')][_0x361e('0x45')]){var _0x28886c=_0x321ad6[_0x361e('0x25')]['$gte'][_0x361e('0x46')](',');var _0x211878={};_0x211878[_0x28886c[0x0]]={'$gte':moment(_0x28886c[0x1])['format'](_0x361e('0x47'))};_0x4214e5[_0x361e('0x41')]=_['merge'](_0x4214e5[_0x361e('0x41')],_0x211878);}_0x4214e5=_['merge']({},_0x4214e5,_0x321ad6[_0x361e('0x32')]);return db[_0x361e('0x37')][_0x361e('0x16')]({'where':_0x4214e5[_0x361e('0x41')]})['then'](function(_0x2088eb){_0x3dfba6['count']=_0x2088eb;if(_0x321ad6[_0x361e('0x25')][_0x361e('0x30')]){_0x4214e5[_0x361e('0x31')]=[{'all':!![]}];}return db['FaxMessage'][_0x361e('0x48')](_0x4214e5);})['then'](function(_0x3c00ad){_0x3dfba6[_0x361e('0x49')]=_0x3c00ad;return _0x3dfba6;});}})[_0x361e('0x1a')](respondWithFilteredResult(_0x2e57a6,_0x4214e5))['catch'](handleError(_0x2e57a6,null));};exports[_0x361e('0x4a')]=function(_0x1ebd8d,_0x44bfa6){return db[_0x361e('0x21')]['find']({'where':{'id':_0x1ebd8d[_0x361e('0x29')]['id']}})[_0x361e('0x1a')](handleEntityNotFound(_0x44bfa6,null))[_0x361e('0x1a')](function(_0x2c1159){if(_0x2c1159){return _0x2c1159[_0x361e('0x4b')](_0x1ebd8d[_0x361e('0x33')][_0x361e('0x38')],_[_0x361e('0x39')](_0x1ebd8d[_0x361e('0x33')],[_0x361e('0x38'),'id'])||{})['spread'](function(){return db['Tag'][_0x361e('0x48')]({'attributes':['id',_0x361e('0x1e'),_0x361e('0x4c')],'where':{'id':_0x1ebd8d['body'][_0x361e('0x38')]}});})[_0x361e('0x1a')](function(_0x20dc9f){socket[_0x361e('0x4d')](_0x361e('0x4e'),{'id':Number(_0x1ebd8d[_0x361e('0x29')]['id']),'tags':_0x20dc9f||[]});return{'id':Number(_0x1ebd8d['params']['id']),'tags':_0x20dc9f||[]};});}})['then'](respondWithResult(_0x44bfa6,null))['catch'](handleError(_0x44bfa6,null));};exports[_0x361e('0x4f')]=function(_0xa7a50,_0x4bc95c){return db[_0x361e('0x21')][_0x361e('0x34')]({'where':{'id':_0xa7a50['params']['id']}})[_0x361e('0x1a')](handleEntityNotFound(_0x4bc95c,null))[_0x361e('0x1a')](function(_0x48bd5d){if(_0x48bd5d){return _0x48bd5d[_0x361e('0x4f')](_0xa7a50[_0x361e('0x25')][_0x361e('0x38')]);}})[_0x361e('0x1a')](respondWithStatusCode(_0x4bc95c,null))[_0x361e('0x27')](handleError(_0x4bc95c,null));};exports[_0x361e('0x50')]=function(_0x59f1eb,_0x5a8efd){var _0x1bb828=moment()[_0x361e('0x51')]()['toString']();var _0x294f3d=path[_0x361e('0x52')](config[_0x361e('0x53')],_0x361e('0x54'),_0x361e('0x55'),_0x361e('0x56'));var _0x377ac6=path[_0x361e('0x52')](config['root'],_0x361e('0x54'),_0x361e('0x55'),_0x361e('0x57'));var _0x154eac=path[_0x361e('0x52')](_0x294f3d,_0x1bb828);var _0x2a587c=util['format'](_0x361e('0x58'),_0x59f1eb['params']['id'],_0x1bb828);var _0x2a0383=path['join'](_0x294f3d,_0x2a587c);var _0x5b8909=[];_0x5b8909[_0x361e('0x59')]({'model':db[_0x361e('0x5a')],'as':_0x361e('0x5a'),'raw':!![]});var _0x4664e6=[{'model':db[_0x361e('0x37')],'as':_0x361e('0x5b'),'attributes':['id',_0x361e('0x33'),_0x361e('0x5c')],'include':_0x5b8909}];return db[_0x361e('0x21')][_0x361e('0x34')]({'where':{'id':_0x59f1eb[_0x361e('0x29')]['id']},'include':_0x4664e6})['then'](handleEntityNotFound(_0x5a8efd,null))[_0x361e('0x1a')](function(_0x46643a){if(_0x46643a&&_0x46643a[_0x361e('0x5b')]){var _0x5a0416=_0x46643a[_0x361e('0x5d')]({'plain':!![]});fs[_0x361e('0x5e')](_0x154eac);for(var _0x158703=0x0;_0x158703<_0x5a0416['Messages']['length'];_0x158703++){var _0x1e3ab1=_0x5a0416[_0x361e('0x5b')][_0x158703][_0x361e('0x5a')];if(_0x1e3ab1){var _0x1f7c0f=path[_0x361e('0x52')](_0x377ac6,_0x1e3ab1['basename']);if(fs['existsSync'](_0x1f7c0f)){fs[_0x361e('0x5f')](_0x1f7c0f)[_0x361e('0x60')](fs['createWriteStream'](path[_0x361e('0x52')](_0x154eac,_0x1e3ab1['basename'])));}}}return BPromise[_0x361e('0x61')]()[_0x361e('0x1a')](function(){return new BPromise(function(_0x472778,_0x3ad829){zipdir(_0x154eac,{'saveTo':_0x2a0383},function(_0x30f82f,_0x57dd99){if(_0x30f82f)return _0x3ad829(_0x30f82f);return _0x472778(_0x57dd99);});})['then'](function(){return new BPromise(function(_0x42a7d2,_0x3849c9){rimraf(_0x154eac,function(_0x25f85e){if(_0x25f85e)_0x3849c9(_0x25f85e);return _0x42a7d2();});});})['then'](function(){return _0x5a8efd[_0x361e('0x50')](_0x2a0383,_0x2a587c,function(_0x4da50f){if(_0x4da50f){console['log'](_0x361e('0x62'),_0x4da50f);}else{fs[_0x361e('0x63')](_0x2a0383);}});});});}else{return _0x5a8efd[_0x361e('0x10')](0xc8);}})['catch'](handleError(_0x5a8efd,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 533d19e..27775d4 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 _0x3bd5=['getUsers','then','setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','hook','../../mysqldb','FaxInteraction','FaxMessage','save','update','remove'];(function(_0x333537,_0x46cc18){var _0x5dbca5=function(_0x767207){while(--_0x767207){_0x333537['push'](_0x333537['shift']());}};_0x5dbca5(++_0x46cc18);}(_0x3bd5,0x10a));var _0x53bd=function(_0x2796e7,_0x5caa4c){_0x2796e7=_0x2796e7-0x0;var _0x5498c5=_0x3bd5[_0x2796e7];return _0x5498c5;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x53bd('0x0'))['db'][_0x53bd('0x1')];var FaxMessage=require(_0x53bd('0x0'))['db'][_0x53bd('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x53bd('0x3'),'afterUpdate':_0x53bd('0x4'),'afterDestroy':_0x53bd('0x5')};function emitEvent(_0x4e563b){return function(_0x5f53d2,_0x2a3311,_0x5d221e){_0x5f53d2[_0x53bd('0x6')]({'attributes':['id'],'raw':!![]})[_0x53bd('0x7')](function(_0x483860){_0x5f53d2[_0x53bd('0x8')](_0x53bd('0x9'),_0x483860['map'](function(_0x473af4){return{'id':_0x473af4['id']};}));return FaxMessage[_0x53bd('0xa')]({'where':{'FaxInteractionId':_0x5f53d2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x53bd('0x7')](function(_0x5b80bc){_0x5f53d2[_0x53bd('0x8')]('unreadMessages',_0x5b80bc[_0x53bd('0xb')]);FaxInteractionEvents['emit'](_0x4e563b+':'+_0x5f53d2['id'],_0x5f53d2);FaxInteractionEvents[_0x53bd('0xc')](_0x4e563b,_0x5f53d2);_0x5d221e(null);})[_0x53bd('0xd')](_0x5d221e(null));};}for(var e in events){if(events[_0x53bd('0xe')](e)){var event=events[e];FaxInteraction[_0x53bd('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x641d=['../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hook'];(function(_0x4d649a,_0x4d4a1d){var _0x548023=function(_0x8f537){while(--_0x8f537){_0x4d649a['push'](_0x4d649a['shift']());}};_0x548023(++_0x4d4a1d);}(_0x641d,0x88));var _0xd641=function(_0x1ec273,_0x585cdd){_0x1ec273=_0x1ec273-0x0;var _0x4b30ee=_0x641d[_0x1ec273];return _0x4b30ee;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xd641('0x0'))['db'][_0xd641('0x1')];var FaxMessage=require(_0xd641('0x0'))['db'][_0xd641('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd641('0x3'),'afterUpdate':_0xd641('0x4'),'afterDestroy':_0xd641('0x5')};function emitEvent(_0x1c4d2b){return function(_0x24271f,_0x5415b1,_0xd06536){_0x24271f[_0xd641('0x6')]({'attributes':['id'],'raw':!![]})[_0xd641('0x7')](function(_0x56d2cf){_0x24271f['setDataValue'](_0xd641('0x8'),_0x56d2cf[_0xd641('0x9')](function(_0x4b3df2){return{'id':_0x4b3df2['id']};}));return FaxMessage[_0xd641('0xa')]({'where':{'FaxInteractionId':_0x24271f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd641('0x7')](function(_0x2086c9){_0x24271f[_0xd641('0xb')](_0xd641('0xc'),_0x2086c9[_0xd641('0xd')]);FaxInteractionEvents[_0xd641('0xe')](_0x1c4d2b+':'+_0x24271f['id'],_0x24271f);FaxInteractionEvents[_0xd641('0xe')](_0x1c4d2b,_0x24271f);_0xd06536(null);})[_0xd641('0xf')](_0xd06536(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xd641('0x10')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index da82b62..365ee92 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 _0x4049=['lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2d48fa,_0x103065){var _0x4645b7=function(_0x5c8751){while(--_0x5c8751){_0x2d48fa['push'](_0x2d48fa['shift']());}};_0x4645b7(++_0x103065);}(_0x4049,0x177));var _0x9404=function(_0xc569f3,_0x485552){_0xc569f3=_0xc569f3-0x0;var _0x152849=_0x4049[_0xc569f3];return _0x152849;};'use strict';var _=require(_0x9404('0x0'));var util=require(_0x9404('0x1'));var logger=require(_0x9404('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9404('0x3'));var rp=require(_0x9404('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9404('0x5'));var attributes=require('./faxInteraction.attributes');module[_0x9404('0x6')]=function(_0x60a82e,_0x2f42c7){return _0x60a82e[_0x9404('0x7')](_0x9404('0x8'),attributes,{'tableName':_0x9404('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40d475,_0x3d15a6,_0x3b93a1){if(_0x40d475[_0x9404('0xa')](_0x9404('0xb'))){_0x40d475[_0x9404('0xc')]=moment()[_0x9404('0xd')](_0x9404('0xe'));}_0x3b93a1(null,_0x40d475);}}});}; \ No newline at end of file +var _0xe7c2=['FaxInteraction','fax_interactions','closed','closedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x3fb8ef,_0xc52f7c){var _0x47f95=function(_0x28c62d){while(--_0x28c62d){_0x3fb8ef['push'](_0x3fb8ef['shift']());}};_0x47f95(++_0xc52f7c);}(_0xe7c2,0x114));var _0x2e7c=function(_0xa7454d,_0x2a3250){_0xa7454d=_0xa7454d-0x0;var _0x119e2b=_0xe7c2[_0xa7454d];return _0x119e2b;};'use strict';var _=require(_0x2e7c('0x0'));var util=require(_0x2e7c('0x1'));var logger=require(_0x2e7c('0x2'))(_0x2e7c('0x3'));var moment=require(_0x2e7c('0x4'));var BPromise=require(_0x2e7c('0x5'));var rp=require(_0x2e7c('0x6'));var fs=require('fs');var path=require(_0x2e7c('0x7'));var rimraf=require('rimraf');var config=require(_0x2e7c('0x8'));var attributes=require(_0x2e7c('0x9'));module[_0x2e7c('0xa')]=function(_0x48c7fe,_0x28c3e5){return _0x48c7fe[_0x2e7c('0xb')](_0x2e7c('0xc'),attributes,{'tableName':_0x2e7c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x411e71,_0x1028a8,_0x18dff9){if(_0x411e71['changed'](_0x2e7c('0xe'))){_0x411e71[_0x2e7c('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x18dff9(null,_0x411e71);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index c7c97f7..c949b62 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 _0xa3d2=['rpc','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','FaxInteraction,\x20%s,\x20%s','message','catch','UpdateFaxInteraction','FaxInteraction','update','options','where','attributes','limit','debug','AddTagsToFaxInteraction','find','body','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xa3d2,0x19b));var _0x2a3d=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0xa3d2[_0x151721];return _0x2deaa7;};'use strict';var _=require(_0x2a3d('0x0'));var util=require(_0x2a3d('0x1'));var moment=require(_0x2a3d('0x2'));var BPromise=require(_0x2a3d('0x3'));var rs=require(_0x2a3d('0x4'));var fs=require('fs');var Redis=require(_0x2a3d('0x5'));var db=require(_0x2a3d('0x6'))['db'];var utils=require(_0x2a3d('0x7'));var logger=require(_0x2a3d('0x8'))(_0x2a3d('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2a3d('0xa')][_0x2a3d('0xb')]({'port':0x232a});config[_0x2a3d('0xc')]=_['defaults'](config['redis'],{'host':_0x2a3d('0xd'),'port':0x18eb});var socket=require(_0x2a3d('0xe'))(new Redis(config[_0x2a3d('0xc')]));require(_0x2a3d('0xf'))[_0x2a3d('0x10')](socket);function respondWithRpcPromise(_0xe4319d,_0x14044e,_0x1a21f9){return new BPromise(function(_0x27a38f,_0x45cf66){return client[_0x2a3d('0x11')](_0xe4319d,_0x1a21f9)[_0x2a3d('0x12')](function(_0x71b80c){logger[_0x2a3d('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x14044e,_0x2a3d('0x14'));logger['debug'](_0x2a3d('0x15'),_0x14044e,_0x2a3d('0x14'),JSON[_0x2a3d('0x16')](_0x71b80c));if(_0x71b80c['error']){if(_0x71b80c['error'][_0x2a3d('0x17')]===0x1f4){logger[_0x2a3d('0x18')](_0x2a3d('0x19'),_0x14044e,_0x71b80c[_0x2a3d('0x18')][_0x2a3d('0x1a')]);return _0x45cf66(_0x71b80c[_0x2a3d('0x18')]['message']);}logger[_0x2a3d('0x18')](_0x2a3d('0x19'),_0x14044e,_0x71b80c[_0x2a3d('0x18')][_0x2a3d('0x1a')]);return _0x27a38f(_0x71b80c[_0x2a3d('0x18')]['message']);}else{logger['info'](_0x2a3d('0x19'),_0x14044e,_0x2a3d('0x14'));_0x27a38f(_0x71b80c['result'][_0x2a3d('0x1a')]);}})[_0x2a3d('0x1b')](function(_0x5f04cb){logger[_0x2a3d('0x18')](_0x2a3d('0x19'),_0x14044e,_0x5f04cb);_0x45cf66(_0x5f04cb);});});}exports[_0x2a3d('0x1c')]=function(_0x271574){var _0x119840=this;return new Promise(function(_0x3670be,_0x1575b9){return db[_0x2a3d('0x1d')][_0x2a3d('0x1e')](_0x271574['body'],{'raw':_0x271574[_0x2a3d('0x1f')]?_0x271574[_0x2a3d('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x271574[_0x2a3d('0x1f')]?_0x271574[_0x2a3d('0x1f')][_0x2a3d('0x20')]||null:null,'attributes':_0x271574[_0x2a3d('0x1f')]?_0x271574['options'][_0x2a3d('0x21')]||null:null,'limit':_0x271574[_0x2a3d('0x1f')]?_0x271574[_0x2a3d('0x1f')][_0x2a3d('0x22')]||null:null})[_0x2a3d('0x12')](function(_0x1d6b2d){logger[_0x2a3d('0x13')]('UpdateFaxInteraction',_0x271574);logger[_0x2a3d('0x23')](_0x2a3d('0x1c'),_0x271574,JSON['stringify'](_0x1d6b2d));_0x3670be(_0x1d6b2d);})['catch'](function(_0x311380){logger[_0x2a3d('0x18')]('UpdateFaxInteraction',_0x311380[_0x2a3d('0x1a')],_0x271574);_0x1575b9(_0x119840['error'](0x1f4,_0x311380[_0x2a3d('0x1a')]));});});};exports[_0x2a3d('0x24')]=function(_0x5c979b){return new Promise(function(_0x170844,_0x4d6a88){return db['FaxInteraction'][_0x2a3d('0x25')]({'where':_0x5c979b[_0x2a3d('0x1f')]?_0x5c979b[_0x2a3d('0x1f')][_0x2a3d('0x20')]||null:null})['then'](function(_0x3e8a7f){if(_0x3e8a7f){return _0x3e8a7f['addTags'](_0x5c979b[_0x2a3d('0x26')]['ids'],_[_0x2a3d('0x27')](_0x5c979b['body'],['ids','id'])||{});}})[_0x2a3d('0x28')](function(_0x42ebef){logger[_0x2a3d('0x13')](_0x2a3d('0x29'),_0x5c979b);logger['debug']('AddTags',_0x5c979b,JSON[_0x2a3d('0x16')](_0x42ebef));_0x170844(_0x42ebef);})[_0x2a3d('0x1b')](function(_0x1c8b2c){logger[_0x2a3d('0x18')]('AddTags',_0x1c8b2c[_0x2a3d('0x1a')],_0x5c979b);_0x4d6a88(_this['error'](0x1f4,_0x1c8b2c[_0x2a3d('0x1a')]));});});}; \ No newline at end of file +var _0x136a=['lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateFaxInteraction','update','options','raw','where','attributes','limit','stringify','AddTagsToFaxInteraction','FaxInteraction','find','addTags','body','ids','omit','spread','AddTags'];(function(_0xd8f59d,_0x542c9f){var _0x537ff2=function(_0xf0b2f5){while(--_0xf0b2f5){_0xd8f59d['push'](_0xd8f59d['shift']());}};_0x537ff2(++_0x542c9f);}(_0x136a,0x126));var _0xa136=function(_0x103a86,_0x27a81d){_0x103a86=_0x103a86-0x0;var _0x35f207=_0x136a[_0x103a86];return _0x35f207;};'use strict';var _=require(_0xa136('0x0'));var util=require(_0xa136('0x1'));var moment=require(_0xa136('0x2'));var BPromise=require(_0xa136('0x3'));var rs=require(_0xa136('0x4'));var fs=require('fs');var Redis=require(_0xa136('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa136('0x6'));var config=require('../../config/environment');var jayson=require(_0xa136('0x7'));var client=jayson[_0xa136('0x8')][_0xa136('0x9')]({'port':0x232a});config[_0xa136('0xa')]=_[_0xa136('0xb')](config[_0xa136('0xa')],{'host':_0xa136('0xc'),'port':0x18eb});var socket=require(_0xa136('0xd'))(new Redis(config[_0xa136('0xa')]));require('./faxInteraction.socket')[_0xa136('0xe')](socket);function respondWithRpcPromise(_0x408712,_0x4b9f74,_0x9e7e03){return new BPromise(function(_0x292106,_0x37adef){return client[_0xa136('0xf')](_0x408712,_0x9e7e03)[_0xa136('0x10')](function(_0x303093){logger[_0xa136('0x11')](_0xa136('0x12'),_0x4b9f74,'request\x20sent');logger[_0xa136('0x13')](_0xa136('0x14'),_0x4b9f74,'request\x20sent',JSON['stringify'](_0x303093));if(_0x303093[_0xa136('0x15')]){if(_0x303093[_0xa136('0x15')]['code']===0x1f4){logger[_0xa136('0x15')](_0xa136('0x12'),_0x4b9f74,_0x303093[_0xa136('0x15')][_0xa136('0x16')]);return _0x37adef(_0x303093[_0xa136('0x15')][_0xa136('0x16')]);}logger[_0xa136('0x15')](_0xa136('0x12'),_0x4b9f74,_0x303093[_0xa136('0x15')]['message']);return _0x292106(_0x303093[_0xa136('0x15')][_0xa136('0x16')]);}else{logger[_0xa136('0x11')](_0xa136('0x12'),_0x4b9f74,'request\x20sent');_0x292106(_0x303093[_0xa136('0x17')]['message']);}})[_0xa136('0x18')](function(_0x32c905){logger[_0xa136('0x15')](_0xa136('0x12'),_0x4b9f74,_0x32c905);_0x37adef(_0x32c905);});});}exports[_0xa136('0x19')]=function(_0x123d6c){var _0x5ac0d8=this;return new Promise(function(_0x5e62d1,_0x2c5d7b){return db['FaxInteraction'][_0xa136('0x1a')](_0x123d6c['body'],{'raw':_0x123d6c[_0xa136('0x1b')]?_0x123d6c[_0xa136('0x1b')][_0xa136('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x123d6c['options']?_0x123d6c[_0xa136('0x1b')][_0xa136('0x1d')]||null:null,'attributes':_0x123d6c['options']?_0x123d6c[_0xa136('0x1b')][_0xa136('0x1e')]||null:null,'limit':_0x123d6c[_0xa136('0x1b')]?_0x123d6c[_0xa136('0x1b')][_0xa136('0x1f')]||null:null})[_0xa136('0x10')](function(_0x56df49){logger['info'](_0xa136('0x19'),_0x123d6c);logger[_0xa136('0x13')](_0xa136('0x19'),_0x123d6c,JSON[_0xa136('0x20')](_0x56df49));_0x5e62d1(_0x56df49);})['catch'](function(_0x1979fe){logger['error'](_0xa136('0x19'),_0x1979fe[_0xa136('0x16')],_0x123d6c);_0x2c5d7b(_0x5ac0d8[_0xa136('0x15')](0x1f4,_0x1979fe[_0xa136('0x16')]));});});};exports[_0xa136('0x21')]=function(_0x24044f){return new Promise(function(_0x460c3e,_0xd2c656){return db[_0xa136('0x22')][_0xa136('0x23')]({'where':_0x24044f[_0xa136('0x1b')]?_0x24044f[_0xa136('0x1b')][_0xa136('0x1d')]||null:null})[_0xa136('0x10')](function(_0xbe1372){if(_0xbe1372){return _0xbe1372[_0xa136('0x24')](_0x24044f[_0xa136('0x25')][_0xa136('0x26')],_[_0xa136('0x27')](_0x24044f[_0xa136('0x25')],[_0xa136('0x26'),'id'])||{});}})[_0xa136('0x28')](function(_0x2e28b8){logger[_0xa136('0x11')](_0xa136('0x29'),_0x24044f);logger[_0xa136('0x13')](_0xa136('0x29'),_0x24044f,JSON[_0xa136('0x20')](_0x2e28b8));_0x460c3e(_0x2e28b8);})[_0xa136('0x18')](function(_0x2925d4){logger[_0xa136('0x15')](_0xa136('0x29'),_0x2925d4['message'],_0x24044f);_0xd2c656(_this['error'](0x1f4,_0x2925d4['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 44ad79c..7e38fde 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 _0xdd32=['emit','update'];(function(_0x3d4846,_0x2a43e7){var _0x471729=function(_0x344510){while(--_0x344510){_0x3d4846['push'](_0x3d4846['shift']());}};_0x471729(++_0x2a43e7);}(_0xdd32,0x107));var _0x2dd3=function(_0x2bd2be,_0x417ecd){_0x2bd2be=_0x2bd2be-0x0;var _0x3abc42=_0xdd32[_0x2bd2be];return _0x3abc42;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save','remove',_0x2dd3('0x0')];function createListener(_0x5997c2,_0x27c49e){return function(_0x16dc9f){_0x27c49e[_0x2dd3('0x1')](_0x5997c2,_0x16dc9f);};}function removeListener(_0x993063,_0x2dff5f){return function(){FaxInteractionEvents['removeListener'](_0x993063,_0x2dff5f);};}exports['register']=function(_0x1a5ddc){for(var _0x28a5d8=0x0,_0x4bf414=events['length'];_0x28a5d8<_0x4bf414;_0x28a5d8++){var _0x22eb0a=events[_0x28a5d8];var _0x5a8bcf=createListener('faxInteraction:'+_0x22eb0a,_0x1a5ddc);FaxInteractionEvents['on'](_0x22eb0a,_0x5a8bcf);}}; \ No newline at end of file +var _0x2d69=['remove','update','emit','removeListener','register','length','./faxInteraction.events','save'];(function(_0x4a7397,_0x45d00e){var _0x143d70=function(_0x487736){while(--_0x487736){_0x4a7397['push'](_0x4a7397['shift']());}};_0x143d70(++_0x45d00e);}(_0x2d69,0x6e));var _0x92d6=function(_0x5f52f3,_0x1c9c8d){_0x5f52f3=_0x5f52f3-0x0;var _0x41bf27=_0x2d69[_0x5f52f3];return _0x41bf27;};'use strict';var FaxInteractionEvents=require(_0x92d6('0x0'));var events=[_0x92d6('0x1'),_0x92d6('0x2'),_0x92d6('0x3')];function createListener(_0x7a2a35,_0x5abeb3){return function(_0x5be480){_0x5abeb3[_0x92d6('0x4')](_0x7a2a35,_0x5be480);};}function removeListener(_0x335e72,_0x51602d){return function(){FaxInteractionEvents[_0x92d6('0x5')](_0x335e72,_0x51602d);};}exports[_0x92d6('0x6')]=function(_0x109830){for(var _0x37638f=0x0,_0x1bb16d=events[_0x92d6('0x7')];_0x37638f<_0x1bb16d;_0x37638f++){var _0x29722a=events[_0x37638f];var _0x38d53c=createListener('faxInteraction:'+_0x29722a,_0x109830);FaxInteractionEvents['on'](_0x29722a,_0x38d53c);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index dd78d5c..d2eb2c3 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 _0x0f44=['update','delete','faxinteraction:destroy','destroy','removeTags','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','describe','get','show','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','fax','addTags','put','/:id','tracked'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0f44,0x7d));var _0x40f4=function(_0x5763cc,_0x1cc8f4){_0x5763cc=_0x5763cc-0x0;var _0x3bbecd=_0x0f44[_0x5763cc];return _0x3bbecd;};'use strict';var multer=require(_0x40f4('0x0'));var util=require(_0x40f4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x40f4('0x2'));var router=express[_0x40f4('0x3')]();var fs_extra=require(_0x40f4('0x4'));var auth=require(_0x40f4('0x5'));var interaction=require(_0x40f4('0x6'));var config=require(_0x40f4('0x7'));var controller=require(_0x40f4('0x8'));router['get']('/',auth[_0x40f4('0x9')](),controller['index']);router['get']('/describe',auth[_0x40f4('0x9')](),controller[_0x40f4('0xa')]);router[_0x40f4('0xb')]('/:id',auth[_0x40f4('0x9')](),controller[_0x40f4('0xc')]);router[_0x40f4('0xb')]('/:id/messages',auth[_0x40f4('0x9')](),controller[_0x40f4('0xd')]);router['get'](_0x40f4('0xe'),auth[_0x40f4('0x9')](),controller[_0x40f4('0xf')]);router[_0x40f4('0x10')]('/',auth[_0x40f4('0x9')](),controller[_0x40f4('0x11')]);router[_0x40f4('0x10')]('/:id/messages',auth[_0x40f4('0x9')](),controller[_0x40f4('0x12')]);router[_0x40f4('0x10')](_0x40f4('0x13'),auth[_0x40f4('0x9')](),interaction['tracked'](_0x40f4('0x14'),'faxinteraction:addtags'),controller[_0x40f4('0x15')]);router[_0x40f4('0x16')](_0x40f4('0x17'),auth[_0x40f4('0x9')](),interaction[_0x40f4('0x18')](_0x40f4('0x14'),'faxinteraction:update'),controller[_0x40f4('0x19')]);router[_0x40f4('0x1a')](_0x40f4('0x17'),auth['isAuthenticated'](),interaction[_0x40f4('0x18')]('fax',_0x40f4('0x1b')),controller[_0x40f4('0x1c')]);router[_0x40f4('0x1a')](_0x40f4('0x13'),auth[_0x40f4('0x9')](),controller[_0x40f4('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x17f0=['create','addMessage','/:id/tags','tracked','addTags','put','fax','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','post'];(function(_0x2030b5,_0x5eb8c3){var _0x39283a=function(_0x3265f9){while(--_0x3265f9){_0x2030b5['push'](_0x2030b5['shift']());}};_0x39283a(++_0x5eb8c3);}(_0x17f0,0x91));var _0x017f=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x17f0[_0x500419];return _0x241c1a;};'use strict';var multer=require(_0x017f('0x0'));var util=require(_0x017f('0x1'));var path=require(_0x017f('0x2'));var timeout=require(_0x017f('0x3'));var express=require(_0x017f('0x4'));var router=express[_0x017f('0x5')]();var fs_extra=require(_0x017f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x017f('0x7'));var config=require(_0x017f('0x8'));var controller=require(_0x017f('0x9'));router[_0x017f('0xa')]('/',auth[_0x017f('0xb')](),controller['index']);router[_0x017f('0xa')](_0x017f('0xc'),auth[_0x017f('0xb')](),controller[_0x017f('0xd')]);router[_0x017f('0xa')](_0x017f('0xe'),auth[_0x017f('0xb')](),controller[_0x017f('0xf')]);router[_0x017f('0xa')]('/:id/messages',auth[_0x017f('0xb')](),controller[_0x017f('0x10')]);router['get'](_0x017f('0x11'),auth[_0x017f('0xb')](),controller[_0x017f('0x12')]);router[_0x017f('0x13')]('/',auth['isAuthenticated'](),controller[_0x017f('0x14')]);router[_0x017f('0x13')]('/:id/messages',auth['isAuthenticated'](),controller[_0x017f('0x15')]);router[_0x017f('0x13')](_0x017f('0x16'),auth[_0x017f('0xb')](),interaction[_0x017f('0x17')]('fax','faxinteraction:addtags'),controller[_0x017f('0x18')]);router[_0x017f('0x19')](_0x017f('0xe'),auth['isAuthenticated'](),interaction[_0x017f('0x17')](_0x017f('0x1a'),_0x017f('0x1b')),controller[_0x017f('0x1c')]);router['delete'](_0x017f('0xe'),auth[_0x017f('0xb')](),interaction[_0x017f('0x17')](_0x017f('0x1a'),_0x017f('0x1d')),controller[_0x017f('0x1e')]);router[_0x017f('0x1f')](_0x017f('0x16'),auth[_0x017f('0xb')](),controller['removeTags']);module[_0x017f('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 3b336c0..ae4a156 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 _0xb205=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0xb205,0xf0));var _0x5b20=function(_0x5030ea,_0xc07510){_0x5030ea=_0x5030ea-0x0;var _0x322984=_0xb205[_0x5030ea];return _0x322984;};'use strict';var Sequelize=require(_0x5b20('0x0'));module[_0x5b20('0x1')]={'body':{'type':Sequelize[_0x5b20('0x2')](_0x5b20('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5b20('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x5b20('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x5b20('0x6')]}}; \ No newline at end of file +var _0xe2cc=['sequelize','exports','BOOLEAN','ENUM','out','TEXT','DATE'];(function(_0xf395f6,_0x4347eb){var _0x1b4493=function(_0x44dcaa){while(--_0x44dcaa){_0xf395f6['push'](_0xf395f6['shift']());}};_0x1b4493(++_0x4347eb);}(_0xe2cc,0x69));var _0xce2c=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xe2cc[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0xce2c('0x0'));module[_0xce2c('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xce2c('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xce2c('0x3')]('in',_0xce2c('0x4')),'defaultValue':_0xce2c('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xce2c('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xce2c('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 2e5180c..598fe06 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 _0x49b5=['SIP/%s','channel','EventManager','acceptmessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','internal','interface','motionChannel','event','rejectmessage','create','CmContact','Attachment','findOne','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','root','server','files','download','join','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','index','map','FaxMessage','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','include','rows','show','find','update','body','params','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x49b5,0x1c9));var _0x549b=function(_0x3595c0,_0x20c2ec){_0x3595c0=_0x3595c0-0x0;var _0x528865=_0x49b5[_0x3595c0];return _0x528865;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x549b('0x0'));var jsonpatch=require(_0x549b('0x1'));var rp=require(_0x549b('0x2'));var moment=require(_0x549b('0x3'));var BPromise=require(_0x549b('0x4'));var Mustache=require(_0x549b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x549b('0x6'));var csv=require(_0x549b('0x7'));var ejs=require(_0x549b('0x8'));var fs=require('fs');var fs_extra=require(_0x549b('0x9'));var _=require(_0x549b('0xa'));var squel=require(_0x549b('0xb'));var crypto=require(_0x549b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x549b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x549b('0xe'));var Papa=require('papaparse');var Redis=require(_0x549b('0xf'));var authService=require(_0x549b('0x10'));var qs=require(_0x549b('0x11'));var as=require(_0x549b('0x12'));var hardwareService=require(_0x549b('0x13'));var logger=require(_0x549b('0x14'))(_0x549b('0x15'));var utils=require(_0x549b('0x16'));var config=require(_0x549b('0x17'));var licenseUtil=require(_0x549b('0x18'));var db=require(_0x549b('0x19'))['db'];config['redis']=_['defaults'](config[_0x549b('0x1a')],{'host':_0x549b('0x1b'),'port':0x18eb});var socket=require(_0x549b('0x1c'))(new Redis(config['redis']));require(_0x549b('0x1d'))[_0x549b('0x1e')](socket);var jayson=require(_0x549b('0x1f'));var client=jayson[_0x549b('0x20')][_0x549b('0x21')]({'port':0x232c});var client9002=jayson[_0x549b('0x20')][_0x549b('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xd6cb5d,_0x4b64ae,_0x391697,_0x547481){return new BPromise(function(_0x479999,_0x126ab4){var _0x74442f=_0x547481||client;return _0x74442f['request'](_0xd6cb5d,_0x391697)[_0x549b('0x22')](function(_0x5effbc){logger[_0x549b('0x23')](_0x549b('0x24'),_0x4b64ae,'request\x20sent');logger[_0x549b('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4b64ae,'request\x20sent',JSON[_0x549b('0x26')](_0x5effbc));if(_0x5effbc['error']){if(_0x5effbc[_0x549b('0x27')][_0x549b('0x28')]===0x1f4){logger[_0x549b('0x27')](_0x549b('0x24'),_0x4b64ae,_0x5effbc[_0x549b('0x27')][_0x549b('0x29')]);return _0x126ab4(_0x5effbc[_0x549b('0x27')][_0x549b('0x29')]);}logger[_0x549b('0x27')]('FaxMessage,\x20%s,\x20%s',_0x4b64ae,_0x5effbc['error'][_0x549b('0x29')]);return _0x479999(_0x5effbc['error']['message']);}else{logger[_0x549b('0x23')](_0x549b('0x24'),_0x4b64ae,_0x549b('0x2a'));_0x479999(_0x5effbc[_0x549b('0x2b')]['message']);}})[_0x549b('0x2c')](function(_0x2da5b3){logger['error'](_0x549b('0x24'),_0x4b64ae,_0x2da5b3);_0x126ab4(_0x2da5b3);});});}function respondWithStatusCode(_0x5e8ff6,_0x3bad26){_0x3bad26=_0x3bad26||0xcc;return function(_0x40259e){if(_0x40259e){return _0x5e8ff6['sendStatus'](_0x3bad26);}return _0x5e8ff6[_0x549b('0x2d')](_0x3bad26)[_0x549b('0x2e')]();};}function respondWithResult(_0x464b49,_0x41fa4){_0x41fa4=_0x41fa4||0xc8;return function(_0x24ea51){if(_0x24ea51){return _0x464b49[_0x549b('0x2d')](_0x41fa4)[_0x549b('0x2f')](_0x24ea51);}};}function respondWithFilteredResult(_0x5bd6c9,_0xb74488){return function(_0x9b6fbd){if(_0x9b6fbd){var _0x1052c8=typeof _0xb74488[_0x549b('0x30')]===_0x549b('0x31')&&typeof _0xb74488[_0x549b('0x32')]==='undefined';var _0x177206=_0x9b6fbd['count'];var _0x3948fc=_0x1052c8?0x0:_0xb74488[_0x549b('0x30')];var _0x454555=_0x1052c8?_0x9b6fbd['count']:_0xb74488[_0x549b('0x30')]+_0xb74488[_0x549b('0x32')];var _0x5ba9dc;if(_0x454555>=_0x177206){_0x454555=_0x177206;_0x5ba9dc=0xc8;}else{_0x5ba9dc=0xce;}_0x5bd6c9[_0x549b('0x2d')](_0x5ba9dc);return _0x5bd6c9['set'](_0x549b('0x33'),_0x3948fc+'-'+_0x454555+'/'+_0x177206)[_0x549b('0x2f')](_0x9b6fbd);}return null;};}function patchUpdates(_0x251fb8){return function(_0x424881){try{jsonpatch[_0x549b('0x34')](_0x424881,_0x251fb8,!![]);}catch(_0x3a1c02){return BPromise[_0x549b('0x35')](_0x3a1c02);}return _0x424881[_0x549b('0x36')]();};}function saveUpdates(_0x3a8d7b,_0x354dd9){return function(_0xe8855b){if(_0xe8855b){return _0xe8855b['update'](_0x3a8d7b)[_0x549b('0x22')](function(_0x212925){return _0x212925;});}return null;};}function removeEntity(_0x165c49,_0x4a764d){return function(_0xe3440b){if(_0xe3440b){return _0xe3440b[_0x549b('0x37')]()['then'](function(){_0x165c49[_0x549b('0x2d')](0xcc)[_0x549b('0x2e')]();});}};}function handleEntityNotFound(_0x36330c,_0x15c046){return function(_0x336c94){if(!_0x336c94){_0x36330c[_0x549b('0x38')](0x194);}return _0x336c94;};}function handleError(_0x427a31,_0x4ea210){_0x4ea210=_0x4ea210||0x1f4;return function(_0xa04747){logger['error'](_0xa04747[_0x549b('0x39')]);if(_0xa04747[_0x549b('0x3a')]){delete _0xa04747[_0x549b('0x3a')];}_0x427a31[_0x549b('0x2d')](_0x4ea210)['send'](_0xa04747);};}exports[_0x549b('0x3b')]=function(_0x576f22,_0x519f4e){var _0x249a56={},_0x33bed4={},_0x1a0c59={'count':0x0,'rows':[]};var _0x2946f9=_[_0x549b('0x3c')](db[_0x549b('0x3d')]['rawAttributes'],function(_0x23994e){return{'name':_0x23994e[_0x549b('0x3e')],'type':_0x23994e['type'][_0x549b('0x3f')]};});_0x33bed4[_0x549b('0x40')]=_[_0x549b('0x3c')](_0x2946f9,_0x549b('0x3a'));_0x33bed4[_0x549b('0x41')]=_[_0x549b('0x42')](_0x576f22[_0x549b('0x41')]);_0x33bed4[_0x549b('0x43')]=_[_0x549b('0x44')](_0x33bed4[_0x549b('0x40')],_0x33bed4['query']);_0x249a56['attributes']=_[_0x549b('0x44')](_0x33bed4[_0x549b('0x40')],qs[_0x549b('0x45')](_0x576f22[_0x549b('0x41')][_0x549b('0x45')]));_0x249a56['attributes']=_0x249a56[_0x549b('0x46')][_0x549b('0x47')]?_0x249a56[_0x549b('0x46')]:_0x33bed4[_0x549b('0x40')];if(!_0x576f22['query'][_0x549b('0x48')](_0x549b('0x49'))){_0x249a56['limit']=qs[_0x549b('0x32')](_0x576f22[_0x549b('0x41')][_0x549b('0x32')]);_0x249a56[_0x549b('0x30')]=qs[_0x549b('0x30')](_0x576f22[_0x549b('0x41')][_0x549b('0x30')]);}_0x249a56[_0x549b('0x4a')]=qs[_0x549b('0x4b')](_0x576f22[_0x549b('0x41')][_0x549b('0x4b')]);_0x249a56['where']=qs['filters'](_[_0x549b('0x4c')](_0x576f22[_0x549b('0x41')],_0x33bed4[_0x549b('0x43')]),_0x2946f9);if(_0x576f22[_0x549b('0x41')][_0x549b('0x4d')]){_0x249a56[_0x549b('0x4e')]=_[_0x549b('0x4f')](_0x249a56[_0x549b('0x4e')],{'$or':_[_0x549b('0x3c')](_0x2946f9,function(_0x3b929c){if(_0x3b929c['type']!==_0x549b('0x50')){var _0xbd833a={};_0xbd833a[_0x3b929c[_0x549b('0x3a')]]={'$like':'%'+_0x576f22[_0x549b('0x41')][_0x549b('0x4d')]+'%'};return _0xbd833a;}})});}_0x249a56=_[_0x549b('0x4f')]({},_0x249a56,_0x576f22[_0x549b('0x51')]);var _0x351c85={'where':_0x249a56['where']};return db['FaxMessage'][_0x549b('0x52')](_0x351c85)[_0x549b('0x22')](function(_0x4135da){_0x1a0c59['count']=_0x4135da;if(_0x576f22['query']['includeAll']){_0x249a56[_0x549b('0x53')]=[{'all':!![]}];}return db[_0x549b('0x3d')]['findAll'](_0x249a56);})['then'](function(_0x50001c){_0x1a0c59[_0x549b('0x54')]=_0x50001c;return _0x1a0c59;})['then'](respondWithFilteredResult(_0x519f4e,_0x249a56))[_0x549b('0x2c')](handleError(_0x519f4e,null));};exports[_0x549b('0x55')]=function(_0xc6645e,_0x215f8c){var _0x1aef45={'raw':!![],'where':{'id':_0xc6645e['params']['id']}},_0x32bdd2={};_0x32bdd2['model']=_[_0x549b('0x42')](db[_0x549b('0x3d')]['rawAttributes']);_0x32bdd2[_0x549b('0x41')]=_[_0x549b('0x42')](_0xc6645e['query']);_0x32bdd2['filters']=_[_0x549b('0x44')](_0x32bdd2[_0x549b('0x40')],_0x32bdd2[_0x549b('0x41')]);_0x1aef45[_0x549b('0x46')]=_[_0x549b('0x44')](_0x32bdd2[_0x549b('0x40')],qs[_0x549b('0x45')](_0xc6645e[_0x549b('0x41')][_0x549b('0x45')]));_0x1aef45[_0x549b('0x46')]=_0x1aef45['attributes'][_0x549b('0x47')]?_0x1aef45['attributes']:_0x32bdd2[_0x549b('0x40')];if(_0xc6645e[_0x549b('0x41')]['includeAll']){_0x1aef45[_0x549b('0x53')]=[{'all':!![]}];}_0x1aef45=_[_0x549b('0x4f')]({},_0x1aef45,_0xc6645e[_0x549b('0x51')]);return db[_0x549b('0x3d')][_0x549b('0x56')](_0x1aef45)[_0x549b('0x22')](handleEntityNotFound(_0x215f8c,null))[_0x549b('0x22')](respondWithResult(_0x215f8c,null))[_0x549b('0x2c')](handleError(_0x215f8c,null));};exports[_0x549b('0x57')]=function(_0x4a7aae,_0x1fb106){if(_0x4a7aae[_0x549b('0x58')]['id']){delete _0x4a7aae[_0x549b('0x58')]['id'];}return db[_0x549b('0x3d')][_0x549b('0x56')]({'where':{'id':_0x4a7aae[_0x549b('0x59')]['id']}})['then'](handleEntityNotFound(_0x1fb106,null))[_0x549b('0x22')](saveUpdates(_0x4a7aae[_0x549b('0x58')],null))['then'](respondWithResult(_0x1fb106,null))['catch'](handleError(_0x1fb106,null));};exports[_0x549b('0x37')]=function(_0x291d8f,_0x3cdc24){return db['FaxMessage'][_0x549b('0x56')]({'where':{'id':_0x291d8f[_0x549b('0x59')]['id']}})[_0x549b('0x22')](handleEntityNotFound(_0x3cdc24,null))[_0x549b('0x22')](removeEntity(_0x3cdc24,null))['catch'](handleError(_0x3cdc24,null));};exports[_0x549b('0x5a')]=function(_0x34966d,_0x1fb6fc){return db[_0x549b('0x3d')][_0x549b('0x5a')]()['then'](respondWithResult(_0x1fb6fc,null))['catch'](handleError(_0x1fb6fc,null));};var interaction_log=require(_0x549b('0x14'))(_0x549b('0x5b'));exports[_0x549b('0x5c')]=function(_0x617ece,_0x336aa4,_0x5ba865){var _0x11f00e={'agent':{},'channel':_0x549b('0x5d')};if(_0x617ece['body']['id']){delete _0x617ece[_0x549b('0x58')]['id'];}_0x617ece[_0x549b('0x58')][_0x549b('0x5e')]=!![];_0x617ece['body'][_0x549b('0x5f')]=moment()[_0x549b('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x617ece[_0x549b('0x58')]['UserId']=_0x617ece[_0x549b('0x58')][_0x549b('0x61')]||_0x617ece[_0x549b('0x62')]['id'];_0x11f00e[_0x549b('0x63')]['id']=_0x617ece[_0x549b('0x58')][_0x549b('0x61')];return db[_0x549b('0x3d')][_0x549b('0x56')]({'where':{'id':_0x617ece[_0x549b('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x336aa4,null))['then'](saveUpdates(_0x617ece[_0x549b('0x58')],null))[_0x549b('0x22')](function(_0x32a6fc){if(_0x32a6fc){_0x11f00e[_0x549b('0x29')]=_0x32a6fc[_0x549b('0x64')]({'plain':!![]});return db[_0x549b('0x65')][_0x549b('0x56')]({'where':{'id':_0x32a6fc[_0x549b('0x66')]}});}return null;})[_0x549b('0x22')](handleEntityNotFound(_0x336aa4,null))[_0x549b('0x22')](function(_0x50914e){if(_0x50914e){return _0x50914e['update']({'UserId':_0x617ece[_0x549b('0x58')][_0x549b('0x61')],'read1stAt':_[_0x549b('0x67')](_0x50914e[_0x549b('0x68')])?moment()['format'](_0x549b('0x69')):undefined});}return null;})[_0x549b('0x22')](function(_0x5bb75e){if(_0x5bb75e){_0x11f00e[_0x549b('0x6a')]=_0x5bb75e[_0x549b('0x64')]({'plain':!![]});interaction_log[_0x549b('0x23')](_0x549b('0x6b'),_0x617ece['user']['id'],_0x617ece[_0x549b('0x62')][_0x549b('0x3a')],_0x617ece['user']['role'],_0x11f00e[_0x549b('0x6a')]['id'],_0x617ece[_0x549b('0x58')]?JSON['stringify'](_0x617ece[_0x549b('0x58')]):_0x549b('0x6c'));return respondWithRpcPromise(_0x549b('0x6d'),'acceptMessage',_0x11f00e);}return null;})[_0x549b('0x22')](function(_0x258077){var _0x55bde8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x258077['message'][_0x549b('0x6e')];return db[_0x549b('0x6f')][_0x549b('0x41')](_0x55bde8,{'type':db['Sequelize'][_0x549b('0x70')][_0x549b('0x71')],'raw':!![]})[_0x549b('0x22')](function(_0x5a70eb){return _0x5a70eb;});})[_0x549b('0x22')](function(_0x446d79){if(_0x446d79){_0x11f00e['message'][_0x549b('0x72')]=_0x446d79[0x0];if(!_0x617ece[_0x549b('0x58')][_0x549b('0x61')])return;return db[_0x549b('0x73')][_0x549b('0x56')]({'where':{'id':_0x617ece[_0x549b('0x58')][_0x549b('0x61')],'role':_0x549b('0x63')},'attributes':['id',_0x549b('0x3a'),_0x549b('0x74'),_0x549b('0x75'),'internal'],'raw':!![]});}return null;})[_0x549b('0x22')](function(_0x12ba42){if(!_0x12ba42)return null;_0x11f00e[_0x549b('0x29')][_0x549b('0x63')]=_0x12ba42;return _0x11f00e;})['then'](function(_0x4a6a6b){if(_0x4a6a6b){if(_0x617ece[_0x549b('0x58')][_0x549b('0x76')]){_0x11f00e['message']['interface']=util[_0x549b('0x60')](_0x549b('0x77'),_0x617ece[_0x549b('0x62')][_0x549b('0x3a')]);_0x11f00e[_0x549b('0x29')][_0x549b('0x78')]=_0x11f00e[_0x549b('0x78')];_0x11f00e[_0x549b('0x29')]['motionChannel']=_0x11f00e[_0x549b('0x78')];_0x11f00e['message']['event']=_0x549b('0x5c');return respondWithRpcPromise(_0x549b('0x79'),_0x549b('0x79'),{'event':_0x549b('0x7a'),'message':_0x11f00e[_0x549b('0x29')]},client9002)[_0x549b('0x22')](function(){return _0x11f00e;});}return _0x11f00e;}return null;})['then'](respondWithResult(_0x336aa4,null))['catch'](handleError(_0x336aa4,null));};var interaction_log=require(_0x549b('0x14'))('fax-interactions');exports[_0x549b('0x35')]=function(_0x404e4f,_0x31afbf,_0x184cf8){var _0x361a9d={'agent':{},'channel':_0x549b('0x5d')};if(_0x404e4f['body']['id']){delete _0x404e4f['body']['id'];}_0x404e4f[_0x549b('0x58')][_0x549b('0x61')]=_0x404e4f[_0x549b('0x58')][_0x549b('0x61')]||_0x404e4f[_0x549b('0x62')]['id'];_0x361a9d['agent']['id']=_0x404e4f[_0x549b('0x58')][_0x549b('0x61')];return db[_0x549b('0x3d')][_0x549b('0x56')]({'where':{'id':_0x404e4f['params']['id'],'UserId':null}})[_0x549b('0x22')](handleEntityNotFound(_0x31afbf,null))[_0x549b('0x22')](function(_0x4d8a36){if(_0x4d8a36){_0x361a9d[_0x549b('0x29')]=_0x4d8a36[_0x549b('0x64')]({'plain':!![]});return db[_0x549b('0x65')][_0x549b('0x56')]({'where':{'id':_0x4d8a36[_0x549b('0x66')]}});}return null;})[_0x549b('0x22')](handleEntityNotFound(_0x31afbf,null))[_0x549b('0x22')](function(_0x2d0c98){if(_0x2d0c98){_0x361a9d[_0x549b('0x6a')]=_0x2d0c98[_0x549b('0x64')]({'plain':!![]});interaction_log[_0x549b('0x23')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x404e4f[_0x549b('0x62')]['id'],_0x404e4f['user'][_0x549b('0x3a')],_0x404e4f[_0x549b('0x62')]['role'],_0x361a9d['interaction']['id'],_0x404e4f[_0x549b('0x58')]?JSON[_0x549b('0x26')](_0x404e4f[_0x549b('0x58')]):_0x549b('0x6c'));return respondWithRpcPromise('RejectMessage',_0x549b('0x7b'),_0x361a9d);}return null;})[_0x549b('0x22')](function(_0x52dacd){var _0x28f4d2=_0x549b('0x7c')+_0x52dacd['message'][_0x549b('0x6e')];return db[_0x549b('0x6f')][_0x549b('0x41')](_0x28f4d2,{'type':db[_0x549b('0x7d')][_0x549b('0x70')]['SELECT'],'raw':!![]})[_0x549b('0x22')](function(_0x371a9f){return _0x371a9f;});})[_0x549b('0x22')](function(_0xe696c5){if(_0xe696c5){_0x361a9d[_0x549b('0x29')][_0x549b('0x72')]=_0xe696c5[0x0];if(!_0x404e4f[_0x549b('0x58')][_0x549b('0x61')])return;return db[_0x549b('0x73')]['find']({'where':{'id':_0x404e4f[_0x549b('0x58')][_0x549b('0x61')],'role':_0x549b('0x63')},'attributes':['id',_0x549b('0x3a'),'fullname',_0x549b('0x75'),_0x549b('0x7e')],'raw':!![]});}return null;})['then'](function(_0x2aa18a){if(!_0x2aa18a)return null;_0x361a9d[_0x549b('0x29')][_0x549b('0x63')]=_0x2aa18a;return _0x361a9d;})[_0x549b('0x22')](function(_0x5f4b4a){if(_0x5f4b4a){_0x5f4b4a[_0x549b('0x29')][_0x549b('0x7f')]=util[_0x549b('0x60')]('SIP/%s',_0x404e4f['user'][_0x549b('0x3a')]);_0x5f4b4a[_0x549b('0x29')][_0x549b('0x78')]=_0x361a9d[_0x549b('0x78')];_0x5f4b4a[_0x549b('0x29')][_0x549b('0x80')]=_0x361a9d[_0x549b('0x78')];_0x5f4b4a[_0x549b('0x29')][_0x549b('0x81')]=_0x549b('0x35');respondWithRpcPromise('EventManager',_0x549b('0x79'),{'event':_0x549b('0x82'),'message':_0x5f4b4a[_0x549b('0x29')]},client9002);return _0x361a9d;}return null;})[_0x549b('0x22')](respondWithResult(_0x31afbf,null))[_0x549b('0x2c')](handleError(_0x31afbf,null));};exports['create']=function(_0x42e0cf,_0x819127){var _0x14273c;return db['FaxMessage'][_0x549b('0x83')](_0x42e0cf[_0x549b('0x58')],{})[_0x549b('0x22')](function(_0x6d912f){_0x14273c=_0x6d912f;return db[_0x549b('0x84')]['findOne']({'where':{'id':_0x14273c[_0x549b('0x6e')]}});})[_0x549b('0x22')](function(_0x5c9235){if(_[_0x549b('0x67')](_0x5c9235)){return;}else{_0x14273c[_0x549b('0x5d')]=_0x5c9235[_0x549b('0x5d')];return db[_0x549b('0x85')][_0x549b('0x86')]({'where':{'id':_0x14273c['AttachmentId']}});}})[_0x549b('0x22')](function(_0x3b8217){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x549b('0x67')](_0x42e0cf[_0x549b('0x58')])?undefined:_0x42e0cf[_0x549b('0x58')][_0x549b('0x87')],'path':_[_0x549b('0x67')](_0x3b8217)?undefined:util[_0x549b('0x60')](_0x549b('0x88'),_0x3b8217[_0x549b('0x89')]),'fax':_[_0x549b('0x67')](_0x14273c['fax'])?undefined:_0x14273c['fax'],'AttachmentId':_0x14273c[_0x549b('0x8a')]},client9002);})[_0x549b('0x22')](respondWithResult(_0x819127,0xc9))['catch'](handleError(_0x819127,null));};exports['download']=function(_0x26252e,_0x1072f2){var _0xe79e2a=path['join'](config[_0x549b('0x8b')],_0x549b('0x8c'),_0x549b('0x8d'),'attachments');return db['FaxMessage'][_0x549b('0x56')]({'where':{'id':_0x26252e[_0x549b('0x59')]['id']},'include':[{'model':db[_0x549b('0x85')],'as':'Attachment'}]})[_0x549b('0x22')](handleEntityNotFound(_0x1072f2,null))['then'](function(_0x131449){if(_0x131449){return _0x1072f2[_0x549b('0x8e')](path[_0x549b('0x8f')](_0xe79e2a,_0x131449[_0x549b('0x85')][_0x549b('0x89')]));}})[_0x549b('0x2c')](handleError(_0x1072f2,null));}; \ No newline at end of file +var _0x5ec8=['options','find','body','params','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteractionId','isNil','read1stAt','format','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','QueryTypes','rejectmessage','create','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','root','server','files','join','eml-format','fast-json-patch','request-promise','mustache','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/license/util','../../mysqldb','defaults','redis','./faxMessage.socket','register','client','http','request','info','FaxMessage,\x20%s,\x20%s','debug','stringify','error','code','message','result','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','includeAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5ec8,0x155));var _0x85ec=function(_0x525798,_0x77a707){_0x525798=_0x525798-0x0;var _0x57da9a=_0x5ec8[_0x525798];return _0x57da9a;};'use strict';var emlformat=require(_0x85ec('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x85ec('0x1'));var rp=require(_0x85ec('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x85ec('0x3'));var util=require('util');var path=require(_0x85ec('0x4'));var sox=require(_0x85ec('0x5'));var csv=require(_0x85ec('0x6'));var ejs=require(_0x85ec('0x7'));var fs=require('fs');var fs_extra=require(_0x85ec('0x8'));var _=require(_0x85ec('0x9'));var squel=require(_0x85ec('0xa'));var crypto=require('crypto');var jsforce=require(_0x85ec('0xb'));var deskjs=require(_0x85ec('0xc'));var toCsv=require(_0x85ec('0x6'));var querystring=require(_0x85ec('0xd'));var Papa=require(_0x85ec('0xe'));var Redis=require(_0x85ec('0xf'));var authService=require(_0x85ec('0x10'));var qs=require(_0x85ec('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85ec('0x12'));var logger=require('../../config/logger')(_0x85ec('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x85ec('0x14'));var db=require(_0x85ec('0x15'))['db'];config['redis']=_[_0x85ec('0x16')](config[_0x85ec('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x85ec('0x18'))[_0x85ec('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x85ec('0x1a')][_0x85ec('0x1b')]({'port':0x232c});var client9002=jayson[_0x85ec('0x1a')][_0x85ec('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x8850a1,_0x5b1203,_0x192343,_0x162f98){return new BPromise(function(_0x2d79b6,_0x40f4da){var _0x28e76b=_0x162f98||client;return _0x28e76b[_0x85ec('0x1c')](_0x8850a1,_0x192343)['then'](function(_0x5409d5){logger[_0x85ec('0x1d')](_0x85ec('0x1e'),_0x5b1203,'request\x20sent');logger[_0x85ec('0x1f')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5b1203,'request\x20sent',JSON[_0x85ec('0x20')](_0x5409d5));if(_0x5409d5[_0x85ec('0x21')]){if(_0x5409d5[_0x85ec('0x21')][_0x85ec('0x22')]===0x1f4){logger[_0x85ec('0x21')](_0x85ec('0x1e'),_0x5b1203,_0x5409d5[_0x85ec('0x21')][_0x85ec('0x23')]);return _0x40f4da(_0x5409d5['error']['message']);}logger['error'](_0x85ec('0x1e'),_0x5b1203,_0x5409d5[_0x85ec('0x21')][_0x85ec('0x23')]);return _0x2d79b6(_0x5409d5[_0x85ec('0x21')][_0x85ec('0x23')]);}else{logger[_0x85ec('0x1d')](_0x85ec('0x1e'),_0x5b1203,'request\x20sent');_0x2d79b6(_0x5409d5[_0x85ec('0x24')]['message']);}})['catch'](function(_0x4b62e1){logger['error'](_0x85ec('0x1e'),_0x5b1203,_0x4b62e1);_0x40f4da(_0x4b62e1);});});}function respondWithStatusCode(_0x207e47,_0x10fb7d){_0x10fb7d=_0x10fb7d||0xcc;return function(_0x3444ee){if(_0x3444ee){return _0x207e47[_0x85ec('0x25')](_0x10fb7d);}return _0x207e47[_0x85ec('0x26')](_0x10fb7d)['end']();};}function respondWithResult(_0x5cbe54,_0x406270){_0x406270=_0x406270||0xc8;return function(_0x3cbc){if(_0x3cbc){return _0x5cbe54[_0x85ec('0x26')](_0x406270)[_0x85ec('0x27')](_0x3cbc);}};}function respondWithFilteredResult(_0x5ce301,_0x3bdd37){return function(_0x5ec704){if(_0x5ec704){var _0x13fea1=typeof _0x3bdd37['offset']===_0x85ec('0x28')&&typeof _0x3bdd37[_0x85ec('0x29')]===_0x85ec('0x28');var _0x2d9384=_0x5ec704[_0x85ec('0x2a')];var _0x389b32=_0x13fea1?0x0:_0x3bdd37[_0x85ec('0x2b')];var _0xdcb5c5=_0x13fea1?_0x5ec704[_0x85ec('0x2a')]:_0x3bdd37[_0x85ec('0x2b')]+_0x3bdd37[_0x85ec('0x29')];var _0xbb437e;if(_0xdcb5c5>=_0x2d9384){_0xdcb5c5=_0x2d9384;_0xbb437e=0xc8;}else{_0xbb437e=0xce;}_0x5ce301['status'](_0xbb437e);return _0x5ce301[_0x85ec('0x2c')](_0x85ec('0x2d'),_0x389b32+'-'+_0xdcb5c5+'/'+_0x2d9384)[_0x85ec('0x27')](_0x5ec704);}return null;};}function patchUpdates(_0x75d11e){return function(_0x3760a2){try{jsonpatch['apply'](_0x3760a2,_0x75d11e,!![]);}catch(_0x54dfe6){return BPromise[_0x85ec('0x2e')](_0x54dfe6);}return _0x3760a2[_0x85ec('0x2f')]();};}function saveUpdates(_0x41211a,_0x52beb5){return function(_0x5e9265){if(_0x5e9265){return _0x5e9265[_0x85ec('0x30')](_0x41211a)[_0x85ec('0x31')](function(_0x423a30){return _0x423a30;});}return null;};}function removeEntity(_0x3b8afe,_0x5e756d){return function(_0x47d2b4){if(_0x47d2b4){return _0x47d2b4[_0x85ec('0x32')]()[_0x85ec('0x31')](function(){_0x3b8afe[_0x85ec('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e648d,_0x3ba7e7){return function(_0x1d93c1){if(!_0x1d93c1){_0x3e648d[_0x85ec('0x25')](0x194);}return _0x1d93c1;};}function handleError(_0x23f357,_0x1dc7cf){_0x1dc7cf=_0x1dc7cf||0x1f4;return function(_0x1e7bc2){logger['error'](_0x1e7bc2[_0x85ec('0x33')]);if(_0x1e7bc2[_0x85ec('0x34')]){delete _0x1e7bc2[_0x85ec('0x34')];}_0x23f357['status'](_0x1dc7cf)['send'](_0x1e7bc2);};}exports[_0x85ec('0x35')]=function(_0x5e45b8,_0x29531d){var _0x2754ea={},_0x430281={},_0x5d401c={'count':0x0,'rows':[]};var _0x35248f=_[_0x85ec('0x36')](db[_0x85ec('0x37')][_0x85ec('0x38')],function(_0xdbd525){return{'name':_0xdbd525[_0x85ec('0x39')],'type':_0xdbd525[_0x85ec('0x3a')][_0x85ec('0x3b')]};});_0x430281[_0x85ec('0x3c')]=_[_0x85ec('0x36')](_0x35248f,_0x85ec('0x34'));_0x430281[_0x85ec('0x3d')]=_[_0x85ec('0x3e')](_0x5e45b8[_0x85ec('0x3d')]);_0x430281[_0x85ec('0x3f')]=_[_0x85ec('0x40')](_0x430281[_0x85ec('0x3c')],_0x430281[_0x85ec('0x3d')]);_0x2754ea[_0x85ec('0x41')]=_[_0x85ec('0x40')](_0x430281[_0x85ec('0x3c')],qs[_0x85ec('0x42')](_0x5e45b8[_0x85ec('0x3d')][_0x85ec('0x42')]));_0x2754ea[_0x85ec('0x41')]=_0x2754ea['attributes'][_0x85ec('0x43')]?_0x2754ea['attributes']:_0x430281['model'];if(!_0x5e45b8[_0x85ec('0x3d')][_0x85ec('0x44')](_0x85ec('0x45'))){_0x2754ea[_0x85ec('0x29')]=qs[_0x85ec('0x29')](_0x5e45b8['query'][_0x85ec('0x29')]);_0x2754ea[_0x85ec('0x2b')]=qs[_0x85ec('0x2b')](_0x5e45b8[_0x85ec('0x3d')][_0x85ec('0x2b')]);}_0x2754ea[_0x85ec('0x46')]=qs[_0x85ec('0x47')](_0x5e45b8[_0x85ec('0x3d')][_0x85ec('0x47')]);_0x2754ea['where']=qs[_0x85ec('0x3f')](_[_0x85ec('0x48')](_0x5e45b8[_0x85ec('0x3d')],_0x430281[_0x85ec('0x3f')]),_0x35248f);if(_0x5e45b8[_0x85ec('0x3d')][_0x85ec('0x49')]){_0x2754ea[_0x85ec('0x4a')]=_[_0x85ec('0x4b')](_0x2754ea['where'],{'$or':_[_0x85ec('0x36')](_0x35248f,function(_0x5f3349){if(_0x5f3349[_0x85ec('0x3a')]!==_0x85ec('0x4c')){var _0x9b3125={};_0x9b3125[_0x5f3349[_0x85ec('0x34')]]={'$like':'%'+_0x5e45b8[_0x85ec('0x3d')][_0x85ec('0x49')]+'%'};return _0x9b3125;}})});}_0x2754ea=_[_0x85ec('0x4b')]({},_0x2754ea,_0x5e45b8['options']);var _0x284e39={'where':_0x2754ea['where']};return db[_0x85ec('0x37')]['count'](_0x284e39)[_0x85ec('0x31')](function(_0x2db3ea){_0x5d401c[_0x85ec('0x2a')]=_0x2db3ea;if(_0x5e45b8[_0x85ec('0x3d')]['includeAll']){_0x2754ea[_0x85ec('0x4d')]=[{'all':!![]}];}return db[_0x85ec('0x37')][_0x85ec('0x4e')](_0x2754ea);})[_0x85ec('0x31')](function(_0x305b0a){_0x5d401c[_0x85ec('0x4f')]=_0x305b0a;return _0x5d401c;})['then'](respondWithFilteredResult(_0x29531d,_0x2754ea))[_0x85ec('0x50')](handleError(_0x29531d,null));};exports['show']=function(_0x3e1961,_0x10230a){var _0x4da178={'raw':!![],'where':{'id':_0x3e1961['params']['id']}},_0x3db166={};_0x3db166['model']=_[_0x85ec('0x3e')](db[_0x85ec('0x37')]['rawAttributes']);_0x3db166['query']=_[_0x85ec('0x3e')](_0x3e1961['query']);_0x3db166[_0x85ec('0x3f')]=_[_0x85ec('0x40')](_0x3db166[_0x85ec('0x3c')],_0x3db166['query']);_0x4da178[_0x85ec('0x41')]=_[_0x85ec('0x40')](_0x3db166['model'],qs[_0x85ec('0x42')](_0x3e1961[_0x85ec('0x3d')][_0x85ec('0x42')]));_0x4da178[_0x85ec('0x41')]=_0x4da178[_0x85ec('0x41')][_0x85ec('0x43')]?_0x4da178[_0x85ec('0x41')]:_0x3db166[_0x85ec('0x3c')];if(_0x3e1961['query'][_0x85ec('0x51')]){_0x4da178[_0x85ec('0x4d')]=[{'all':!![]}];}_0x4da178=_[_0x85ec('0x4b')]({},_0x4da178,_0x3e1961[_0x85ec('0x52')]);return db[_0x85ec('0x37')][_0x85ec('0x53')](_0x4da178)[_0x85ec('0x31')](handleEntityNotFound(_0x10230a,null))[_0x85ec('0x31')](respondWithResult(_0x10230a,null))[_0x85ec('0x50')](handleError(_0x10230a,null));};exports[_0x85ec('0x30')]=function(_0x12872a,_0x4fdbd0){if(_0x12872a[_0x85ec('0x54')]['id']){delete _0x12872a[_0x85ec('0x54')]['id'];}return db[_0x85ec('0x37')]['find']({'where':{'id':_0x12872a[_0x85ec('0x55')]['id']}})[_0x85ec('0x31')](handleEntityNotFound(_0x4fdbd0,null))[_0x85ec('0x31')](saveUpdates(_0x12872a['body'],null))['then'](respondWithResult(_0x4fdbd0,null))[_0x85ec('0x50')](handleError(_0x4fdbd0,null));};exports[_0x85ec('0x32')]=function(_0x5c6ba0,_0xb621cb){return db[_0x85ec('0x37')][_0x85ec('0x53')]({'where':{'id':_0x5c6ba0['params']['id']}})[_0x85ec('0x31')](handleEntityNotFound(_0xb621cb,null))[_0x85ec('0x31')](removeEntity(_0xb621cb,null))[_0x85ec('0x50')](handleError(_0xb621cb,null));};exports[_0x85ec('0x56')]=function(_0x43b438,_0x14f0b2){return db[_0x85ec('0x37')][_0x85ec('0x56')]()[_0x85ec('0x31')](respondWithResult(_0x14f0b2,null))[_0x85ec('0x50')](handleError(_0x14f0b2,null));};var interaction_log=require('../../config/logger')(_0x85ec('0x57'));exports[_0x85ec('0x58')]=function(_0x492647,_0x102577,_0x1d6cd5){var _0x36e4eb={'agent':{},'channel':_0x85ec('0x59')};if(_0x492647[_0x85ec('0x54')]['id']){delete _0x492647[_0x85ec('0x54')]['id'];}_0x492647[_0x85ec('0x54')][_0x85ec('0x5a')]=!![];_0x492647['body'][_0x85ec('0x5b')]=moment()['format'](_0x85ec('0x5c'));_0x492647['body']['UserId']=_0x492647['body'][_0x85ec('0x5d')]||_0x492647[_0x85ec('0x5e')]['id'];_0x36e4eb[_0x85ec('0x5f')]['id']=_0x492647[_0x85ec('0x54')][_0x85ec('0x5d')];return db[_0x85ec('0x37')][_0x85ec('0x53')]({'where':{'id':_0x492647[_0x85ec('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x102577,null))['then'](saveUpdates(_0x492647['body'],null))[_0x85ec('0x31')](function(_0x1f0fdf){if(_0x1f0fdf){_0x36e4eb[_0x85ec('0x23')]=_0x1f0fdf['get']({'plain':!![]});return db['FaxInteraction'][_0x85ec('0x53')]({'where':{'id':_0x1f0fdf[_0x85ec('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x102577,null))[_0x85ec('0x31')](function(_0x3ea4e3){if(_0x3ea4e3){return _0x3ea4e3[_0x85ec('0x30')]({'UserId':_0x492647[_0x85ec('0x54')][_0x85ec('0x5d')],'read1stAt':_[_0x85ec('0x61')](_0x3ea4e3[_0x85ec('0x62')])?moment()[_0x85ec('0x63')](_0x85ec('0x5c')):undefined});}return null;})[_0x85ec('0x31')](function(_0x527c81){if(_0x527c81){_0x36e4eb['interaction']=_0x527c81['get']({'plain':!![]});interaction_log['info'](_0x85ec('0x64'),_0x492647['user']['id'],_0x492647[_0x85ec('0x5e')][_0x85ec('0x34')],_0x492647[_0x85ec('0x5e')]['role'],_0x36e4eb[_0x85ec('0x65')]['id'],_0x492647[_0x85ec('0x54')]?JSON['stringify'](_0x492647[_0x85ec('0x54')]):_0x85ec('0x66'));return respondWithRpcPromise(_0x85ec('0x67'),_0x85ec('0x68'),_0x36e4eb);}return null;})[_0x85ec('0x31')](function(_0x399e59){var _0x2edf40=_0x85ec('0x69')+_0x399e59[_0x85ec('0x23')][_0x85ec('0x6a')];return db[_0x85ec('0x6b')][_0x85ec('0x3d')](_0x2edf40,{'type':db[_0x85ec('0x6c')]['QueryTypes'][_0x85ec('0x6d')],'raw':!![]})['then'](function(_0x1b6cd5){return _0x1b6cd5;});})[_0x85ec('0x31')](function(_0x219fcf){if(_0x219fcf){_0x36e4eb[_0x85ec('0x23')][_0x85ec('0x6e')]=_0x219fcf[0x0];if(!_0x492647[_0x85ec('0x54')][_0x85ec('0x5d')])return;return db[_0x85ec('0x6f')][_0x85ec('0x53')]({'where':{'id':_0x492647[_0x85ec('0x54')]['UserId'],'role':_0x85ec('0x5f')},'attributes':['id',_0x85ec('0x34'),_0x85ec('0x70'),_0x85ec('0x71'),_0x85ec('0x72')],'raw':!![]});}return null;})[_0x85ec('0x31')](function(_0x4c9559){if(!_0x4c9559)return null;_0x36e4eb['message'][_0x85ec('0x5f')]=_0x4c9559;return _0x36e4eb;})[_0x85ec('0x31')](function(_0x311e9a){if(_0x311e9a){if(_0x492647[_0x85ec('0x54')]['manual']){_0x36e4eb[_0x85ec('0x23')][_0x85ec('0x73')]=util[_0x85ec('0x63')](_0x85ec('0x74'),_0x492647[_0x85ec('0x5e')][_0x85ec('0x34')]);_0x36e4eb['message']['channel']=_0x36e4eb[_0x85ec('0x75')];_0x36e4eb[_0x85ec('0x23')][_0x85ec('0x76')]=_0x36e4eb[_0x85ec('0x75')];_0x36e4eb['message'][_0x85ec('0x77')]=_0x85ec('0x58');return respondWithRpcPromise(_0x85ec('0x78'),_0x85ec('0x78'),{'event':_0x85ec('0x79'),'message':_0x36e4eb['message']},client9002)[_0x85ec('0x31')](function(){return _0x36e4eb;});}return _0x36e4eb;}return null;})['then'](respondWithResult(_0x102577,null))[_0x85ec('0x50')](handleError(_0x102577,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x85ec('0x2e')]=function(_0x5b8b80,_0x2186a9,_0x49dd6d){var _0x2a4244={'agent':{},'channel':_0x85ec('0x59')};if(_0x5b8b80[_0x85ec('0x54')]['id']){delete _0x5b8b80['body']['id'];}_0x5b8b80[_0x85ec('0x54')][_0x85ec('0x5d')]=_0x5b8b80[_0x85ec('0x54')][_0x85ec('0x5d')]||_0x5b8b80[_0x85ec('0x5e')]['id'];_0x2a4244['agent']['id']=_0x5b8b80[_0x85ec('0x54')][_0x85ec('0x5d')];return db['FaxMessage']['find']({'where':{'id':_0x5b8b80[_0x85ec('0x55')]['id'],'UserId':null}})[_0x85ec('0x31')](handleEntityNotFound(_0x2186a9,null))[_0x85ec('0x31')](function(_0x59c014){if(_0x59c014){_0x2a4244[_0x85ec('0x23')]=_0x59c014[_0x85ec('0x7a')]({'plain':!![]});return db['FaxInteraction'][_0x85ec('0x53')]({'where':{'id':_0x59c014[_0x85ec('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x2186a9,null))[_0x85ec('0x31')](function(_0x4ab112){if(_0x4ab112){_0x2a4244[_0x85ec('0x65')]=_0x4ab112['get']({'plain':!![]});interaction_log[_0x85ec('0x1d')](_0x85ec('0x7b'),_0x5b8b80[_0x85ec('0x5e')]['id'],_0x5b8b80[_0x85ec('0x5e')][_0x85ec('0x34')],_0x5b8b80[_0x85ec('0x5e')][_0x85ec('0x7c')],_0x2a4244['interaction']['id'],_0x5b8b80['body']?JSON[_0x85ec('0x20')](_0x5b8b80[_0x85ec('0x54')]):_0x85ec('0x66'));return respondWithRpcPromise(_0x85ec('0x7d'),_0x85ec('0x7e'),_0x2a4244);}return null;})[_0x85ec('0x31')](function(_0x4ff728){var _0xf62e84='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4ff728[_0x85ec('0x23')][_0x85ec('0x6a')];return db['sequelize'][_0x85ec('0x3d')](_0xf62e84,{'type':db['Sequelize'][_0x85ec('0x7f')][_0x85ec('0x6d')],'raw':!![]})[_0x85ec('0x31')](function(_0x1df704){return _0x1df704;});})['then'](function(_0x6681e2){if(_0x6681e2){_0x2a4244[_0x85ec('0x23')][_0x85ec('0x6e')]=_0x6681e2[0x0];if(!_0x5b8b80[_0x85ec('0x54')][_0x85ec('0x5d')])return;return db[_0x85ec('0x6f')][_0x85ec('0x53')]({'where':{'id':_0x5b8b80['body'][_0x85ec('0x5d')],'role':_0x85ec('0x5f')},'attributes':['id',_0x85ec('0x34'),_0x85ec('0x70'),_0x85ec('0x71'),_0x85ec('0x72')],'raw':!![]});}return null;})[_0x85ec('0x31')](function(_0x5dea84){if(!_0x5dea84)return null;_0x2a4244[_0x85ec('0x23')]['agent']=_0x5dea84;return _0x2a4244;})['then'](function(_0x471574){if(_0x471574){_0x471574[_0x85ec('0x23')][_0x85ec('0x73')]=util[_0x85ec('0x63')](_0x85ec('0x74'),_0x5b8b80[_0x85ec('0x5e')][_0x85ec('0x34')]);_0x471574[_0x85ec('0x23')]['channel']=_0x2a4244[_0x85ec('0x75')];_0x471574[_0x85ec('0x23')]['motionChannel']=_0x2a4244[_0x85ec('0x75')];_0x471574[_0x85ec('0x23')][_0x85ec('0x77')]=_0x85ec('0x2e');respondWithRpcPromise(_0x85ec('0x78'),_0x85ec('0x78'),{'event':_0x85ec('0x80'),'message':_0x471574[_0x85ec('0x23')]},client9002);return _0x2a4244;}return null;})[_0x85ec('0x31')](respondWithResult(_0x2186a9,null))[_0x85ec('0x50')](handleError(_0x2186a9,null));};exports['create']=function(_0x2faeb9,_0xe7c0c0){var _0xdc60be;return db[_0x85ec('0x37')][_0x85ec('0x81')](_0x2faeb9[_0x85ec('0x54')],{})['then'](function(_0x1188e9){_0xdc60be=_0x1188e9;return db['CmContact']['findOne']({'where':{'id':_0xdc60be[_0x85ec('0x6a')]}});})[_0x85ec('0x31')](function(_0x3faa84){if(_[_0x85ec('0x61')](_0x3faa84)){return;}else{_0xdc60be['fax']=_0x3faa84[_0x85ec('0x59')];return db[_0x85ec('0x82')][_0x85ec('0x83')]({'where':{'id':_0xdc60be[_0x85ec('0x84')]}});}})[_0x85ec('0x31')](function(_0x1ae1fb){return respondWithRpcPromise(_0x85ec('0x85'),'SendFax',{'FaxAccountId':_['isNil'](_0x2faeb9['body'])?undefined:_0x2faeb9[_0x85ec('0x54')][_0x85ec('0x86')],'path':_[_0x85ec('0x61')](_0x1ae1fb)?undefined:util[_0x85ec('0x63')](_0x85ec('0x87'),_0x1ae1fb[_0x85ec('0x88')]),'fax':_['isNil'](_0xdc60be['fax'])?undefined:_0xdc60be['fax'],'AttachmentId':_0xdc60be[_0x85ec('0x84')]},client9002);})['then'](respondWithResult(_0xe7c0c0,0xc9))[_0x85ec('0x50')](handleError(_0xe7c0c0,null));};exports['download']=function(_0x20e6cd,_0x22ac5b){var _0x4c735d=path['join'](config[_0x85ec('0x89')],_0x85ec('0x8a'),_0x85ec('0x8b'),'attachments');return db[_0x85ec('0x37')]['find']({'where':{'id':_0x20e6cd[_0x85ec('0x55')]['id']},'include':[{'model':db[_0x85ec('0x82')],'as':_0x85ec('0x82')}]})[_0x85ec('0x31')](handleEntityNotFound(_0x22ac5b,null))[_0x85ec('0x31')](function(_0x50520f){if(_0x50520f){return _0x22ac5b['download'](path[_0x85ec('0x8c')](_0x4c735d,_0x50520f[_0x85ec('0x82')][_0x85ec('0x88')]));}})[_0x85ec('0x50')](handleError(_0x22ac5b,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 5a897df..0b6d609 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 _0xa24d=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x509c0b,_0x4d4553){var _0x5f0415=function(_0x4f9d10){while(--_0x4f9d10){_0x509c0b['push'](_0x509c0b['shift']());}};_0x5f0415(++_0x4d4553);}(_0xa24d,0x1c1));var _0xda24=function(_0x354404,_0x141542){_0x354404=_0x354404-0x0;var _0x1c10f8=_0xa24d[_0x354404];return _0x1c10f8;};'use strict';var EventEmitter=require(_0xda24('0x0'));var FaxMessage=require(_0xda24('0x1'))['db'][_0xda24('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xda24('0x3')](0x0);var events={'afterCreate':_0xda24('0x4'),'afterUpdate':_0xda24('0x5'),'afterDestroy':_0xda24('0x6')};function emitEvent(_0x501b16){return function(_0xcc2450,_0x2e6e4f,_0x24a908){FaxMessageEvents[_0xda24('0x7')](_0x501b16+':'+_0xcc2450['id'],_0xcc2450);FaxMessageEvents['emit'](_0x501b16,_0xcc2450);_0x24a908(null);};}for(var e in events){if(events[_0xda24('0x8')](e)){var event=events[e];FaxMessage[_0xda24('0x9')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x853e=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x3d65c3,_0x5205e6){var _0x1b0227=function(_0x32010e){while(--_0x32010e){_0x3d65c3['push'](_0x3d65c3['shift']());}};_0x1b0227(++_0x5205e6);}(_0x853e,0x1ea));var _0xe853=function(_0x2d7119,_0x5df720){_0x2d7119=_0x2d7119-0x0;var _0x2aab10=_0x853e[_0x2d7119];return _0x2aab10;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xe853('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xe853('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe853('0x2'),'afterDestroy':'remove'};function emitEvent(_0xf7b6da){return function(_0xbc2b15,_0x46c559,_0x44705d){FaxMessageEvents[_0xe853('0x3')](_0xf7b6da+':'+_0xbc2b15['id'],_0xbc2b15);FaxMessageEvents['emit'](_0xf7b6da,_0xbc2b15);_0x44705d(null);};}for(var e in events){if(events[_0xe853('0x4')](e)){var event=events[e];FaxMessage[_0xe853('0x5')](e,emitEvent(event));}}module[_0xe853('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 57d9a40..460aabc 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 _0x9dfb=['isNil','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','FaxMessage','fax_messages','fti_fax_messages','get','direction','toLowerCase','out'];(function(_0x531465,_0x35196d){var _0x5c3aa2=function(_0x3f4dae){while(--_0x3f4dae){_0x531465['push'](_0x531465['shift']());}};_0x5c3aa2(++_0x35196d);}(_0x9dfb,0xc8));var _0xb9df=function(_0x3f1a25,_0x2c21e5){_0x3f1a25=_0x3f1a25-0x0;var _0x3fba4a=_0x9dfb[_0x3f1a25];return _0x3fba4a;};'use strict';var _=require('lodash');var util=require(_0xb9df('0x0'));var logger=require(_0xb9df('0x1'))(_0xb9df('0x2'));var moment=require(_0xb9df('0x3'));var BPromise=require(_0xb9df('0x4'));var rp=require(_0xb9df('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb9df('0x6'));var config=require(_0xb9df('0x7'));var attributes=require('./faxMessage.attributes');module[_0xb9df('0x8')]=function(_0x189928,_0x453995){return _0x189928['define'](_0xb9df('0x9'),attributes,{'tableName':_0xb9df('0xa'),'paranoid':![],'indexes':[{'name':_0xb9df('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3eb586,_0x17de58,_0x19883a){var _0x3a565=_0x189928['models'];var _0x129e30=_0x3eb586[_0xb9df('0xc')]({'plain':!![]});if(_0x129e30[_0xb9df('0xd')]['toLowerCase']()==='in'||_0x129e30['direction'][_0xb9df('0xe')]()===_0xb9df('0xf')&&!_0x129e30['secret']&&!_[_0xb9df('0x10')](_0x129e30['UserId'])){_0x3a565[_0xb9df('0x11')][_0xb9df('0x12')]({'where':{'id':_0x129e30[_0xb9df('0x13')]}})[_0xb9df('0x14')](function(_0x3d5470){if(_0x3d5470){_0x3d5470[_0xb9df('0x15')]({'lastMsgAt':_0x129e30[_0xb9df('0x16')],'lastMsgDirection':_0x129e30[_0xb9df('0xd')]['toLowerCase']()});}})[_0xb9df('0x17')](function(_0x3da722){console[_0xb9df('0x18')](_0x3da722);});}_0x19883a();}},'charset':_0xb9df('0x19'),'collate':_0xb9df('0x1a')});}; \ No newline at end of file +var _0xfcb5=['error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxMessage','fax_messages','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','createdAt'];(function(_0x3e037d,_0x1c8c8a){var _0x572050=function(_0x190efa){while(--_0x190efa){_0x3e037d['push'](_0x3e037d['shift']());}};_0x572050(++_0x1c8c8a);}(_0xfcb5,0x1bd));var _0x5fcb=function(_0xb121c3,_0x1f9815){_0xb121c3=_0xb121c3-0x0;var _0x2b8ae1=_0xfcb5[_0xb121c3];return _0x2b8ae1;};'use strict';var _=require('lodash');var util=require(_0x5fcb('0x0'));var logger=require(_0x5fcb('0x1'))(_0x5fcb('0x2'));var moment=require(_0x5fcb('0x3'));var BPromise=require(_0x5fcb('0x4'));var rp=require(_0x5fcb('0x5'));var fs=require('fs');var path=require(_0x5fcb('0x6'));var rimraf=require(_0x5fcb('0x7'));var config=require(_0x5fcb('0x8'));var attributes=require('./faxMessage.attributes');module[_0x5fcb('0x9')]=function(_0x378a8c,_0x396dc8){return _0x378a8c['define'](_0x5fcb('0xa'),attributes,{'tableName':_0x5fcb('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x465208,_0x77745d,_0x12b426){var _0x50acda=_0x378a8c[_0x5fcb('0xc')];var _0x333a48=_0x465208[_0x5fcb('0xd')]({'plain':!![]});if(_0x333a48[_0x5fcb('0xe')]['toLowerCase']()==='in'||_0x333a48[_0x5fcb('0xe')][_0x5fcb('0xf')]()===_0x5fcb('0x10')&&!_0x333a48[_0x5fcb('0x11')]&&!_[_0x5fcb('0x12')](_0x333a48[_0x5fcb('0x13')])){_0x50acda['FaxInteraction'][_0x5fcb('0x14')]({'where':{'id':_0x333a48[_0x5fcb('0x15')]}})['then'](function(_0x5bf998){if(_0x5bf998){_0x5bf998['update']({'lastMsgAt':_0x333a48[_0x5fcb('0x16')],'lastMsgDirection':_0x333a48[_0x5fcb('0xe')][_0x5fcb('0xf')]()});}})['catch'](function(_0x11a94b){console[_0x5fcb('0x17')](_0x11a94b);});}_0x12b426();}},'charset':_0x5fcb('0x18'),'collate':_0x5fcb('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 6dbe394..61c880a 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 _0xbd50=['request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','options','raw','then','UpdateFaxMessage','FaxMessage','update','body','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','./faxMessage.socket','register'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xbd50,0x196));var _0x0bd5=function(_0x46b131,_0x5e44c9){_0x46b131=_0x46b131-0x0;var _0x4925a5=_0xbd50[_0x46b131];return _0x4925a5;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});config[_0x0bd5('0xa')]=_[_0x0bd5('0xb')](config[_0x0bd5('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0bd5('0xa')]));require(_0x0bd5('0xc'))[_0x0bd5('0xd')](socket);function respondWithRpcPromise(_0x5f5a0c,_0xa98f54,_0x2fa7d1){return new BPromise(function(_0x519bc6,_0x210f45){return client[_0x0bd5('0xe')](_0x5f5a0c,_0x2fa7d1)['then'](function(_0x1ce7dd){logger[_0x0bd5('0xf')](_0x0bd5('0x10'),_0xa98f54,'request\x20sent');logger[_0x0bd5('0x11')](_0x0bd5('0x12'),_0xa98f54,_0x0bd5('0x13'),JSON[_0x0bd5('0x14')](_0x1ce7dd));if(_0x1ce7dd[_0x0bd5('0x15')]){if(_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x16')]===0x1f4){logger[_0x0bd5('0x15')]('FaxMessage,\x20%s,\x20%s',_0xa98f54,_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x17')]);return _0x210f45(_0x1ce7dd['error'][_0x0bd5('0x17')]);}logger[_0x0bd5('0x15')](_0x0bd5('0x10'),_0xa98f54,_0x1ce7dd[_0x0bd5('0x15')]['message']);return _0x519bc6(_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x17')]);}else{logger[_0x0bd5('0xf')](_0x0bd5('0x10'),_0xa98f54,_0x0bd5('0x13'));_0x519bc6(_0x1ce7dd[_0x0bd5('0x18')][_0x0bd5('0x17')]);}})[_0x0bd5('0x19')](function(_0x29fa4c){logger[_0x0bd5('0x15')](_0x0bd5('0x10'),_0xa98f54,_0x29fa4c);_0x210f45(_0x29fa4c);});});}exports[_0x0bd5('0x1a')]=function(_0x4008bd){var _0x2dc1e5=this;return new Promise(function(_0x527c37,_0x5ba943){return db['FaxMessage']['create'](_0x4008bd['body'],{'raw':_0x4008bd[_0x0bd5('0x1b')]?_0x4008bd[_0x0bd5('0x1b')][_0x0bd5('0x1c')]===undefined?!![]:![]:!![]})[_0x0bd5('0x1d')](function(_0x6ee1a8){logger['info'](_0x0bd5('0x1a'),_0x4008bd);logger[_0x0bd5('0x11')](_0x0bd5('0x1a'),_0x4008bd,JSON['stringify'](_0x6ee1a8));_0x527c37(_0x6ee1a8);})[_0x0bd5('0x19')](function(_0x4a8787){logger['error'](_0x0bd5('0x1a'),_0x4a8787[_0x0bd5('0x17')],_0x4008bd);_0x5ba943(_0x2dc1e5[_0x0bd5('0x15')](0x1f4,_0x4a8787['message']));});});};exports[_0x0bd5('0x1e')]=function(_0x5eab3e){var _0x456e87=this;return new Promise(function(_0x3ffb08,_0x18cec3){return db[_0x0bd5('0x1f')][_0x0bd5('0x20')](_0x5eab3e[_0x0bd5('0x21')],{'raw':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')][_0x0bd5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')][_0x0bd5('0x22')]||null:null,'attributes':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')]['attributes']||null:null,'limit':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')]['limit']||null:null})[_0x0bd5('0x1d')](function(_0x8eccc9){logger['info'](_0x0bd5('0x1e'),_0x5eab3e);logger[_0x0bd5('0x11')](_0x0bd5('0x1e'),_0x5eab3e,JSON[_0x0bd5('0x14')](_0x8eccc9));_0x3ffb08(_0x8eccc9);})['catch'](function(_0x440e69){logger[_0x0bd5('0x15')](_0x0bd5('0x1e'),_0x440e69[_0x0bd5('0x17')],_0x5eab3e);_0x18cec3(_0x456e87[_0x0bd5('0x15')](0x1f4,_0x440e69[_0x0bd5('0x17')]));});});}; \ No newline at end of file +var _0x99e9=['register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','FaxMessage','update','where','attributes','limit','stringify','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x99e9,0xb4));var _0x999e=function(_0x15a8fa,_0x4652b2){_0x15a8fa=_0x15a8fa-0x0;var _0x1355c2=_0x99e9[_0x15a8fa];return _0x1355c2;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});config[_0x999e('0xa')]=_[_0x999e('0xb')](config['redis'],{'host':_0x999e('0xc'),'port':0x18eb});var socket=require(_0x999e('0xd'))(new Redis(config[_0x999e('0xa')]));require(_0x999e('0xe'))[_0x999e('0xf')](socket);function respondWithRpcPromise(_0x175042,_0x3f2c24,_0x180846){return new BPromise(function(_0x3cb1c2,_0xf40130){return client[_0x999e('0x10')](_0x175042,_0x180846)[_0x999e('0x11')](function(_0x4246b1){logger[_0x999e('0x12')](_0x999e('0x13'),_0x3f2c24,_0x999e('0x14'));logger[_0x999e('0x15')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x3f2c24,_0x999e('0x14'),JSON['stringify'](_0x4246b1));if(_0x4246b1[_0x999e('0x16')]){if(_0x4246b1[_0x999e('0x16')][_0x999e('0x17')]===0x1f4){logger['error'](_0x999e('0x13'),_0x3f2c24,_0x4246b1['error'][_0x999e('0x18')]);return _0xf40130(_0x4246b1['error']['message']);}logger[_0x999e('0x16')](_0x999e('0x13'),_0x3f2c24,_0x4246b1[_0x999e('0x16')][_0x999e('0x18')]);return _0x3cb1c2(_0x4246b1[_0x999e('0x16')][_0x999e('0x18')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x3f2c24,'request\x20sent');_0x3cb1c2(_0x4246b1[_0x999e('0x19')][_0x999e('0x18')]);}})[_0x999e('0x1a')](function(_0x302f52){logger[_0x999e('0x16')](_0x999e('0x13'),_0x3f2c24,_0x302f52);_0xf40130(_0x302f52);});});}exports['CreateFaxMessage']=function(_0x5d86d4){var _0xc20d3e=this;return new Promise(function(_0x3f4d7c,_0x3b3642){return db['FaxMessage'][_0x999e('0x1b')](_0x5d86d4[_0x999e('0x1c')],{'raw':_0x5d86d4[_0x999e('0x1d')]?_0x5d86d4[_0x999e('0x1d')][_0x999e('0x1e')]===undefined?!![]:![]:!![]})[_0x999e('0x11')](function(_0x427bcf){logger['info']('CreateFaxMessage',_0x5d86d4);logger[_0x999e('0x15')](_0x999e('0x1f'),_0x5d86d4,JSON['stringify'](_0x427bcf));_0x3f4d7c(_0x427bcf);})[_0x999e('0x1a')](function(_0xe324d8){logger[_0x999e('0x16')](_0x999e('0x1f'),_0xe324d8[_0x999e('0x18')],_0x5d86d4);_0x3b3642(_0xc20d3e[_0x999e('0x16')](0x1f4,_0xe324d8['message']));});});};exports[_0x999e('0x20')]=function(_0x4199ff){var _0x11068e=this;return new Promise(function(_0x12b9ad,_0x1b7adb){return db[_0x999e('0x21')][_0x999e('0x22')](_0x4199ff['body'],{'raw':_0x4199ff[_0x999e('0x1d')]?_0x4199ff['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4199ff[_0x999e('0x1d')]?_0x4199ff[_0x999e('0x1d')][_0x999e('0x23')]||null:null,'attributes':_0x4199ff['options']?_0x4199ff[_0x999e('0x1d')][_0x999e('0x24')]||null:null,'limit':_0x4199ff[_0x999e('0x1d')]?_0x4199ff[_0x999e('0x1d')][_0x999e('0x25')]||null:null})[_0x999e('0x11')](function(_0x82e067){logger[_0x999e('0x12')](_0x999e('0x20'),_0x4199ff);logger[_0x999e('0x15')]('UpdateFaxMessage',_0x4199ff,JSON[_0x999e('0x26')](_0x82e067));_0x12b9ad(_0x82e067);})[_0x999e('0x1a')](function(_0x371613){logger['error'](_0x999e('0x20'),_0x371613['message'],_0x4199ff);_0x1b7adb(_0x11068e['error'](0x1f4,_0x371613[_0x999e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 4d86a20..58284b3 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 _0x0255=['register','length','faxMessage:','remove','update','removeListener'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x0255,0x11d));var _0x5025=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0255[_0x3dd15e];return _0x231fd0;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0x5025('0x0'),_0x5025('0x1')];function createListener(_0x2e4330,_0xc57005){return function(_0xf05df0){_0xc57005['emit'](_0x2e4330,_0xf05df0);};}function removeListener(_0x49fabf,_0x25660b){return function(){FaxMessageEvents[_0x5025('0x2')](_0x49fabf,_0x25660b);};}exports[_0x5025('0x3')]=function(_0x4a422e){for(var _0x449e8d=0x0,_0x8e158b=events[_0x5025('0x4')];_0x449e8d<_0x8e158b;_0x449e8d++){var _0xe6544e=events[_0x449e8d];var _0x133f6e=createListener(_0x5025('0x5')+_0xe6544e,_0x4a422e);FaxMessageEvents['on'](_0xe6544e,_0x133f6e);}}; \ No newline at end of file +var _0x140f=['register','length','faxMessage:','./faxMessage.events','remove','update','emit','removeListener'];(function(_0x492221,_0x9e2521){var _0x398bf9=function(_0x303c5b){while(--_0x303c5b){_0x492221['push'](_0x492221['shift']());}};_0x398bf9(++_0x9e2521);}(_0x140f,0x1ab));var _0xf140=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x140f[_0x2f3794];return _0x1c9fbe;};'use strict';var FaxMessageEvents=require(_0xf140('0x0'));var events=['save',_0xf140('0x1'),_0xf140('0x2')];function createListener(_0xbe169b,_0x3c0ea6){return function(_0x3190a9){_0x3c0ea6[_0xf140('0x3')](_0xbe169b,_0x3190a9);};}function removeListener(_0x4d85d0,_0x4d0c06){return function(){FaxMessageEvents[_0xf140('0x4')](_0x4d85d0,_0x4d0c06);};}exports[_0xf140('0x5')]=function(_0x2a81a4){for(var _0x4a948f=0x0,_0x5f40ae=events[_0xf140('0x6')];_0x4a948f<_0x5f40ae;_0x4a948f++){var _0x2a7b95=events[_0x4a948f];var _0x751514=createListener(_0xf140('0x7')+_0x2a7b95,_0x2a81a4);FaxMessageEvents['on'](_0x2a7b95,_0x751514);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 56b19c1..3011e37 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 _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(_0x4b4a4b,_0xf29d3b){var _0x8ca386=function(_0x257b1a){while(--_0x257b1a){_0x4b4a4b['push'](_0x4b4a4b['shift']());}};_0x8ca386(++_0xf29d3b);}(_0x3f8c,0x104));var _0xc3f8=function(_0x190b16,_0x35ac6d){_0x190b16=_0x190b16-0x0;var _0xe65f4b=_0x3f8c[_0x190b16];return _0xe65f4b;};'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 +var _0x44a3=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/:id','show','download','fax','create','put','update','/:id/accept','accept','reject','delete','exports'];(function(_0x4ce64a,_0x20363e){var _0xea198=function(_0xcb8ee2){while(--_0xcb8ee2){_0x4ce64a['push'](_0x4ce64a['shift']());}};_0xea198(++_0x20363e);}(_0x44a3,0x1a9));var _0x344a=function(_0x58736a,_0x5d0121){_0x58736a=_0x58736a-0x0;var _0x4518e2=_0x44a3[_0x58736a];return _0x4518e2;};'use strict';var multer=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var path=require(_0x344a('0x2'));var timeout=require(_0x344a('0x3'));var express=require(_0x344a('0x4'));var router=express[_0x344a('0x5')]();var fs_extra=require(_0x344a('0x6'));var auth=require(_0x344a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x344a('0x8'));var controller=require(_0x344a('0x9'));router[_0x344a('0xa')]('/',auth[_0x344a('0xb')](),controller[_0x344a('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x344a('0xa')](_0x344a('0xd'),auth[_0x344a('0xb')](),controller[_0x344a('0xe')]);router[_0x344a('0xa')]('/:id/download',auth[_0x344a('0xb')](),controller[_0x344a('0xf')]);router['post']('/',auth[_0x344a('0xb')](),interaction['tracked'](_0x344a('0x10'),'faxmessage:create'),controller[_0x344a('0x11')]);router[_0x344a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x344a('0x13')]);router[_0x344a('0x12')](_0x344a('0x14'),auth[_0x344a('0xb')](),controller[_0x344a('0x15')]);router[_0x344a('0x12')]('/:id/reject',auth[_0x344a('0xb')](),controller[_0x344a('0x16')]);router[_0x344a('0x17')](_0x344a('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x344a('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index afd2193..5cbd09a 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 _0x5430=['STRING','name','INTEGER','beepall','sequelize','exports'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0x5430,0x10c));var _0x0543=function(_0xf152b3,_0x31e32b){_0xf152b3=_0xf152b3-0x0;var _0x298017=_0x5430[_0xf152b3];return _0x298017;};'use strict';var Sequelize=require(_0x0543('0x0'));module[_0x0543('0x1')]={'name':{'type':Sequelize[_0x0543('0x2')],'unique':_0x0543('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0543('0x2')]},'timeout':{'type':Sequelize[_0x0543('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x0543('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcc4b=['roundrobin','exports','STRING','name','INTEGER','rrmemory'];(function(_0x2494bf,_0x1eca45){var _0x533c9c=function(_0x18e8f6){while(--_0x18e8f6){_0x2494bf['push'](_0x2494bf['shift']());}};_0x533c9c(++_0x1eca45);}(_0xcc4b,0x16f));var _0xbcc4=function(_0x2fc464,_0x2936c1){_0x2fc464=_0x2fc464-0x0;var _0x1bd429=_0xcc4b[_0x2fc464];return _0x1bd429;};'use strict';var Sequelize=require('sequelize');module[_0xbcc4('0x0')]={'name':{'type':Sequelize[_0xbcc4('0x1')],'unique':_0xbcc4('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbcc4('0x1')]},'timeout':{'type':Sequelize[_0xbcc4('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xbcc4('0x4'),'beepall',_0xbcc4('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xbcc4('0x3')],'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 bc84998..daca24d 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 _0xf072=['get','FaxQueues','UserProfileResource','error','stack','name','send','FaxQueue','fieldName','type','key','getOptions','where','include','query','rows','catch','show','params','keys','rawAttributes','filters','intersection','model','attributes','fields','includeAll','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','getMembers','findOne','UserFaxQueue','length','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','filter','merge','User','findAndCountAll','map','agent','faxPause','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','findAll','Agents','online','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy'];(function(_0x3ea94c,_0x4928a9){var _0x2a991d=function(_0x9ea828){while(--_0x9ea828){_0x3ea94c['push'](_0x3ea94c['shift']());}};_0x2a991d(++_0x4928a9);}(_0xf072,0x1cf));var _0x2f07=function(_0x130c43,_0x4b4fa8){_0x130c43=_0x130c43-0x0;var _0x1951e0=_0xf072[_0x130c43];return _0x1951e0;};'use strict';var BPromise=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var _=require(_0x2f07('0x2'));var squel=require('squel');var Redis=require(_0x2f07('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x2f07('0x4'))(_0x2f07('0x5'));var config=require(_0x2f07('0x6'));var db=require('../../mysqldb')['db'];config[_0x2f07('0x7')]=_[_0x2f07('0x8')](config[_0x2f07('0x7')],{'host':_0x2f07('0x9'),'port':0x18eb});var socket=require(_0x2f07('0xa'))(new Redis(config[_0x2f07('0x7')]));require(_0x2f07('0xb'))[_0x2f07('0xc')](socket);function respondWithStatusCode(_0x4746c2,_0x2e167){_0x2e167=_0x2e167||0xcc;return function(_0x30c638){if(_0x30c638){return _0x4746c2[_0x2f07('0xd')](_0x2e167);}return _0x4746c2[_0x2f07('0xe')](_0x2e167)[_0x2f07('0xf')]();};}function respondWithResult(_0x14e237,_0x564260){_0x564260=_0x564260||0xc8;return function(_0xdb2783){if(_0xdb2783){return _0x14e237[_0x2f07('0xe')](_0x564260)[_0x2f07('0x10')](_0xdb2783);}};}function respondWithFilteredResult(_0x3525be,_0x496d87){return function(_0x4e81d9){if(_0x4e81d9){var _0x3dd0cf=typeof _0x496d87[_0x2f07('0x11')]==='undefined'&&typeof _0x496d87[_0x2f07('0x12')]===_0x2f07('0x13');var _0x26edfa=_0x4e81d9['count'];var _0x211514=_0x3dd0cf?0x0:_0x496d87[_0x2f07('0x11')];var _0x3596ea=_0x3dd0cf?_0x4e81d9[_0x2f07('0x14')]:_0x496d87[_0x2f07('0x11')]+_0x496d87[_0x2f07('0x12')];var _0x5d32d6;if(_0x3596ea>=_0x26edfa){_0x3596ea=_0x26edfa;_0x5d32d6=0xc8;}else{_0x5d32d6=0xce;}_0x3525be[_0x2f07('0xe')](_0x5d32d6);return _0x3525be['set'](_0x2f07('0x15'),_0x211514+'-'+_0x3596ea+'/'+_0x26edfa)[_0x2f07('0x10')](_0x4e81d9);}return null;};}function saveUpdates(_0x1dace4){return function(_0x9f7a1a){if(_0x9f7a1a){return _0x9f7a1a[_0x2f07('0x16')](_0x1dace4)[_0x2f07('0x17')](function(_0x1a6135){return _0x1a6135;});}return null;};}function removeEntity(_0xe3ed0){return function(_0x55bd60){if(_0x55bd60){return _0x55bd60[_0x2f07('0x18')]()['then'](function(){var _0x3cd3c0=_0x55bd60[_0x2f07('0x19')]({'plain':!![]});var _0x119b68=_0x2f07('0x1a');return db[_0x2f07('0x1b')]['destroy']({'where':{'type':_0x119b68,'resourceId':_0x3cd3c0['id']}})[_0x2f07('0x17')](function(){return _0x55bd60;});})['then'](function(){_0xe3ed0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d93c2){return function(_0x51c285){if(!_0x51c285){_0x1d93c2[_0x2f07('0xd')](0x194);}return _0x51c285;};}function handleError(_0x5e6ac6,_0x354ee2){_0x354ee2=_0x354ee2||0x1f4;return function(_0x2c495f){logger[_0x2f07('0x1c')](_0x2c495f[_0x2f07('0x1d')]);if(_0x2c495f['name']){delete _0x2c495f[_0x2f07('0x1e')];}_0x5e6ac6[_0x2f07('0xe')](_0x354ee2)[_0x2f07('0x1f')](_0x2c495f);};}exports['index']=function(_0x111376,_0x113916){var _0x522006={};var _0x1dcedc={'count':0x0,'rows':[]};var _0x1c9ca1=_['map'](db[_0x2f07('0x20')]['rawAttributes'],function(_0x894cd4){return{'name':_0x894cd4[_0x2f07('0x21')],'type':_0x894cd4[_0x2f07('0x22')][_0x2f07('0x23')]};});_0x522006=qs[_0x2f07('0x24')](_0x1c9ca1,_0x111376);var _0x139ea8={'where':_0x522006[_0x2f07('0x25')]};return db[_0x2f07('0x20')][_0x2f07('0x14')](_0x139ea8)[_0x2f07('0x17')](function(_0x3b4e2f){_0x1dcedc[_0x2f07('0x14')]=_0x3b4e2f;_0x522006['include']=qs[_0x2f07('0x26')](_0x111376[_0x2f07('0x27')]);return db[_0x2f07('0x20')]['findAll'](_0x522006);})[_0x2f07('0x17')](function(_0x21b5e6){_0x1dcedc[_0x2f07('0x28')]=_0x21b5e6;return _0x1dcedc;})['then'](respondWithFilteredResult(_0x113916,_0x522006))[_0x2f07('0x29')](handleError(_0x113916,null));};exports[_0x2f07('0x2a')]=function(_0xee6a27,_0x329195){var _0x3802b9={'raw':!![],'where':{'id':_0xee6a27[_0x2f07('0x2b')]['id']}},_0x2e9a5d={};_0x2e9a5d['model']=_[_0x2f07('0x2c')](db['FaxQueue'][_0x2f07('0x2d')]);_0x2e9a5d[_0x2f07('0x27')]=_[_0x2f07('0x2c')](_0xee6a27[_0x2f07('0x27')]);_0x2e9a5d[_0x2f07('0x2e')]=_[_0x2f07('0x2f')](_0x2e9a5d[_0x2f07('0x30')],_0x2e9a5d[_0x2f07('0x27')]);_0x3802b9[_0x2f07('0x31')]=_[_0x2f07('0x2f')](_0x2e9a5d[_0x2f07('0x30')],qs[_0x2f07('0x32')](_0xee6a27[_0x2f07('0x27')][_0x2f07('0x32')]));_0x3802b9[_0x2f07('0x31')]=_0x3802b9[_0x2f07('0x31')]['length']?_0x3802b9['attributes']:_0x2e9a5d[_0x2f07('0x30')];if(_0xee6a27[_0x2f07('0x27')][_0x2f07('0x33')]){_0x3802b9['include']=[{'all':!![]}];}_0x3802b9=_['merge']({},_0x3802b9,_0xee6a27[_0x2f07('0x34')]);return db['FaxQueue'][_0x2f07('0x35')](_0x3802b9)[_0x2f07('0x17')](handleEntityNotFound(_0x329195,null))[_0x2f07('0x17')](respondWithResult(_0x329195,null))[_0x2f07('0x29')](handleError(_0x329195,null));};exports[_0x2f07('0x36')]=function(_0x52ead8,_0x45fe2f){return db['FaxQueue'][_0x2f07('0x36')](_0x52ead8['body'],{})[_0x2f07('0x17')](function(_0x592277){var _0x508f8a=_0x52ead8[_0x2f07('0x37')][_0x2f07('0x19')]({'plain':!![]});if(!_0x508f8a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x508f8a[_0x2f07('0x38')]===_0x2f07('0x37')){var _0x429ae1=_0x592277['get']({'plain':!![]});var _0x17b88f=_0x2f07('0x1a');return db[_0x2f07('0x39')][_0x2f07('0x35')]({'where':{'name':_0x17b88f,'userProfileId':_0x508f8a[_0x2f07('0x3a')]},'raw':!![]})[_0x2f07('0x17')](function(_0x1a0ef2){if(_0x1a0ef2&&_0x1a0ef2[_0x2f07('0x3b')]===0x0){return db['UserProfileResource'][_0x2f07('0x36')]({'name':_0x429ae1[_0x2f07('0x1e')],'resourceId':_0x429ae1['id'],'type':_0x1a0ef2[_0x2f07('0x1e')],'sectionId':_0x1a0ef2['id']},{})[_0x2f07('0x17')](function(){return _0x592277;});}else{return _0x592277;}})[_0x2f07('0x29')](function(_0x2ded2e){logger[_0x2f07('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ded2e);throw _0x2ded2e;});}return _0x592277;})[_0x2f07('0x17')](respondWithResult(_0x45fe2f,0xc9))[_0x2f07('0x29')](handleError(_0x45fe2f,null));};exports[_0x2f07('0x16')]=function(_0x273c0f,_0x3db7ad){if(_0x273c0f[_0x2f07('0x3c')]['id']){delete _0x273c0f['body']['id'];}return db[_0x2f07('0x20')][_0x2f07('0x35')]({'where':{'id':_0x273c0f[_0x2f07('0x2b')]['id']}})[_0x2f07('0x17')](handleEntityNotFound(_0x3db7ad,null))['then'](saveUpdates(_0x273c0f['body'],null))[_0x2f07('0x17')](respondWithResult(_0x3db7ad,null))[_0x2f07('0x29')](handleError(_0x3db7ad,null));};exports[_0x2f07('0x18')]=function(_0x1277f0,_0x478cc9){return db[_0x2f07('0x20')][_0x2f07('0x35')]({'where':{'id':_0x1277f0[_0x2f07('0x2b')]['id']}})[_0x2f07('0x17')](handleEntityNotFound(_0x478cc9,null))[_0x2f07('0x17')](removeEntity(_0x478cc9,null))[_0x2f07('0x29')](handleError(_0x478cc9,null));};exports[_0x2f07('0x3d')]=function(_0x3e5682,_0xf10865){return db[_0x2f07('0x20')]['describe']()['then'](respondWithResult(_0xf10865,null))['catch'](handleError(_0xf10865,null));};exports[_0x2f07('0x3e')]=function(_0x320ad1,_0x5a4963){var _0x97c166={'raw':!![],'where':{}},_0x562b0f={},_0x3a7159;return db[_0x2f07('0x20')][_0x2f07('0x3f')]({'where':{'id':_0x320ad1['params']['id']}})[_0x2f07('0x17')](handleEntityNotFound(_0x5a4963,null))[_0x2f07('0x17')](function(_0x47b17f){if(_0x47b17f){_0x3a7159=_0x47b17f['get']({'plain':!![]});_0x562b0f[_0x2f07('0x30')]=_[_0x2f07('0x2c')](db[_0x2f07('0x40')][_0x2f07('0x2d')]);_0x562b0f[_0x2f07('0x27')]=_[_0x2f07('0x2c')](_0x320ad1[_0x2f07('0x27')]);_0x562b0f[_0x2f07('0x2e')]=_[_0x2f07('0x2f')](_0x562b0f[_0x2f07('0x30')],_0x562b0f[_0x2f07('0x27')]);_0x97c166[_0x2f07('0x31')]=_[_0x2f07('0x2f')](_0x562b0f[_0x2f07('0x30')],qs[_0x2f07('0x32')](_0x320ad1[_0x2f07('0x27')]['fields']));_0x97c166[_0x2f07('0x31')]=_0x97c166[_0x2f07('0x31')][_0x2f07('0x41')]?_0x97c166[_0x2f07('0x31')]:_0x562b0f[_0x2f07('0x30')];if(!_0x320ad1[_0x2f07('0x27')][_0x2f07('0x42')](_0x2f07('0x43'))){_0x97c166[_0x2f07('0x12')]=qs['limit'](_0x320ad1[_0x2f07('0x27')][_0x2f07('0x12')]);_0x97c166[_0x2f07('0x11')]=qs[_0x2f07('0x11')](_0x320ad1['query']['offset']);}_0x97c166[_0x2f07('0x44')]=qs[_0x2f07('0x45')](_0x320ad1['query']['sort']);_0x97c166[_0x2f07('0x25')]=qs['filters'](_[_0x2f07('0x46')](_0x320ad1[_0x2f07('0x27')],_0x562b0f[_0x2f07('0x2e')]));_0x97c166[_0x2f07('0x25')][_0x2f07('0x47')]=_0x47b17f['id'];if(_0x320ad1[_0x2f07('0x27')][_0x2f07('0x48')]){_0x97c166[_0x2f07('0x25')]=_[_0x2f07('0x49')](_0x97c166[_0x2f07('0x25')],{'$or':_['map'](_0x97c166[_0x2f07('0x31')],function(_0x399072){var _0x380159={};_0x380159[_0x399072]={'$like':'%'+_0x320ad1[_0x2f07('0x27')]['filter']+'%'};return _0x380159;})});}_0x97c166=_[_0x2f07('0x49')]({},_0x97c166,_0x320ad1['options']);return db['UserFaxQueue']['findAll'](_0x97c166);}})[_0x2f07('0x17')](function(_0x5153fc){if(_0x5153fc){return db[_0x2f07('0x4a')][_0x2f07('0x4b')]({'where':{'id':_[_0x2f07('0x4c')](_0x5153fc,'UserId'),'role':_0x2f07('0x4d')},'attributes':['id',_0x2f07('0x1e'),_0x2f07('0x4e'),'updatedAt',_0x2f07('0x4f')]});}})['then'](function(_0x64762c){if(_0x64762c){return{'count':_0x64762c['count'],'rows':_[_0x2f07('0x4c')](_0x64762c[_0x2f07('0x28')],function(_0x4408a7){return{'membername':_0x4408a7[_0x2f07('0x1e')],'UserId':_0x4408a7['id'],'queue_name':_0x3a7159[_0x2f07('0x1e')],'FaxQueueId':_0x3a7159['id'],'interface':util[_0x2f07('0x50')](_0x2f07('0x51'),_0x2f07('0x52'),_0x4408a7[_0x2f07('0x1e')]),'penalty':0x0,'paused':_0x4408a7[_0x2f07('0x4e')],'createdAt':_0x4408a7['createdAt'],'updatedAt':_0x4408a7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2f07('0x17')](respondWithFilteredResult(_0x5a4963,_0x97c166))['catch'](handleError(_0x5a4963,null));};exports['getTeams']=function(_0x580441,_0x5439ae){var _0x295959={};var _0x50015e={};var _0x4175fe;var _0x41e88f;return db[_0x2f07('0x20')][_0x2f07('0x3f')]({'where':{'id':_0x580441['params']['id']}})[_0x2f07('0x17')](handleEntityNotFound(_0x5439ae,null))[_0x2f07('0x17')](function(_0x16fab3){if(_0x16fab3){_0x4175fe=_0x16fab3;_0x50015e[_0x2f07('0x30')]=_['keys'](db[_0x2f07('0x53')][_0x2f07('0x2d')]);_0x50015e[_0x2f07('0x27')]=_[_0x2f07('0x2c')](_0x580441['query']);_0x50015e[_0x2f07('0x2e')]=_[_0x2f07('0x2f')](_0x50015e[_0x2f07('0x30')],_0x50015e[_0x2f07('0x27')]);_0x295959['attributes']=_[_0x2f07('0x2f')](_0x50015e['model'],qs[_0x2f07('0x32')](_0x580441[_0x2f07('0x27')][_0x2f07('0x32')]));_0x295959[_0x2f07('0x31')]=_0x295959['attributes'][_0x2f07('0x41')]?_0x295959[_0x2f07('0x31')]:_0x50015e['model'];_0x295959[_0x2f07('0x44')]=qs[_0x2f07('0x45')](_0x580441['query'][_0x2f07('0x45')]);_0x295959[_0x2f07('0x25')]=qs[_0x2f07('0x2e')](_['pick'](_0x580441['query'],_0x50015e[_0x2f07('0x2e')]));if(_0x580441[_0x2f07('0x27')]['filter']){_0x295959[_0x2f07('0x25')]=_[_0x2f07('0x49')](_0x295959[_0x2f07('0x25')],{'$or':_[_0x2f07('0x4c')](_0x295959[_0x2f07('0x31')],function(_0x26f986){var _0x22acf6={};_0x22acf6[_0x26f986]={'$like':'%'+_0x580441[_0x2f07('0x27')]['filter']+'%'};return _0x22acf6;})});}_0x295959=_['merge']({},_0x295959,_0x580441['options']);return _0x4175fe['getTeams'](_0x295959);}})['then'](function(_0x503d9b){if(_0x503d9b){_0x41e88f=_0x503d9b['length'];if(!_0x580441[_0x2f07('0x27')][_0x2f07('0x42')](_0x2f07('0x43'))){_0x295959[_0x2f07('0x12')]=qs['limit'](_0x580441[_0x2f07('0x27')][_0x2f07('0x12')]);_0x295959[_0x2f07('0x11')]=qs[_0x2f07('0x11')](_0x580441['query'][_0x2f07('0x11')]);}return _0x4175fe[_0x2f07('0x54')](_0x295959);}})['then'](function(_0x5cbc28){if(_0x5cbc28){return _0x5cbc28?{'count':_0x41e88f,'rows':_0x5cbc28}:null;}})['then'](respondWithResult(_0x5439ae,null))['catch'](handleError(_0x5439ae,null));};exports[_0x2f07('0x55')]=function(_0x6fc9b9,_0x127a39){var _0x5db1db=_0x6fc9b9[_0x2f07('0x3c')][_0x2f07('0x56')];return db[_0x2f07('0x53')][_0x2f07('0x57')]({'where':{'id':_0x5db1db},'attributes':['id'],'include':[{'model':db[_0x2f07('0x4a')],'as':_0x2f07('0x58'),'attributes':['id',_0x2f07('0x1e'),_0x2f07('0x59'),'voicePause','interface'],'raw':!![]}]})[_0x2f07('0x17')](function(_0x1ab958){if(_0x1ab958){var _0x3031c0=_[_0x2f07('0x5a')](_0x1ab958,function(_0x5646b3){var _0x220236=_0x5646b3[_0x2f07('0x19')]({'plain':!![]});return _0x220236[_0x2f07('0x58')];});return db[_0x2f07('0x20')][_0x2f07('0x35')]({'where':{'id':_0x6fc9b9[_0x2f07('0x2b')]['id']}})['then'](function(_0x1c6f46){return db[_0x2f07('0x5b')][_0x2f07('0x5c')](function(_0x122aef){return _0x1c6f46[_0x2f07('0x55')](_0x5db1db,{'transaction':_0x122aef})['then'](function(){return BPromise[_0x2f07('0x5d')](_0x3031c0,function(_0x31dd3){return db[_0x2f07('0x40')][_0x2f07('0x5e')]({'where':{'UserId':_0x31dd3['id'],'FaxQueueId':_0x6fc9b9[_0x2f07('0x2b')]['id']},'transaction':_0x122aef});});})[_0x2f07('0x17')](function(){_0x3031c0['forEach'](function(_0x221f67){socket[_0x2f07('0x5f')]('userFaxQueue:save',{'UserId':_0x221f67['id'],'FaxQueueId':_0x1c6f46['id']});});});});});}})[_0x2f07('0x17')](respondWithStatusCode(_0x127a39,null))[_0x2f07('0x29')](handleError(_0x127a39,null));};exports[_0x2f07('0x60')]=function(_0x496dd9,_0x3c364b){return db[_0x2f07('0x53')]['findAll']({'where':{'id':_0x496dd9[_0x2f07('0x27')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2f07('0x4a')],'as':_0x2f07('0x58'),'attributes':['id'],'raw':!![]}]})[_0x2f07('0x17')](handleEntityNotFound(_0x3c364b,null))[_0x2f07('0x17')](function(_0x3377cf){var _0x3a99ce=_[_0x2f07('0x4c')](_0x3377cf,'id');var _0xa5f7f1=[];var _0xbdb45c=[];var _0x4e7f9f=squel[_0x2f07('0x61')]();_0x4e7f9f[_0x2f07('0x62')](_0x2f07('0x63'))[_0x2f07('0x64')](_0x2f07('0x65'),'tq')[_0x2f07('0x66')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2f07('0x25')](_0x2f07('0x67'),_0x496dd9[_0x2f07('0x2b')]['id']);for(var _0x191111=0x0;_0x191111<_0x3377cf['length'];_0x191111+=0x1){let _0x26b287=_0x3377cf[_0x191111];for(var _0x51db42=0x0;_0x51db42<_0x26b287[_0x2f07('0x58')]['length'];_0x51db42+=0x1){let _0x203070=_0x26b287[_0x2f07('0x58')][_0x51db42];var _0x4377e4=_0x4e7f9f[_0x2f07('0x68')]();_0x4377e4[_0x2f07('0x25')](_0x2f07('0x69'),_0x203070['id']);_0xbdb45c[_0x2f07('0x6a')](db[_0x2f07('0x5b')][_0x2f07('0x27')](_0x4377e4[_0x2f07('0x6b')](),{'type':db['sequelize'][_0x2f07('0x6c')]['SELECT']})[_0x2f07('0x17')](function(_0x4f807e){if(_0x4f807e[_0x2f07('0x41')]===0x1){return _0x203070['id'];}else{var _0x1da0ba=_[_0x2f07('0x6d')](_['map'](_0x4f807e,_0x2f07('0x6e')),function(_0x2f2df3){return _[_0x2f07('0x6f')](_0x3a99ce,_0x2f2df3);});if(_0x1da0ba){return _0x203070['id'];}}}));}}return BPromise['all'](_0xbdb45c)['then'](function(_0x5061f3){_0xa5f7f1=_(_0xa5f7f1)['union'](_0x5061f3)[_0x2f07('0x70')]()[_0x2f07('0x71')]();return db[_0x2f07('0x20')]['find']({'where':{'id':_0x496dd9[_0x2f07('0x2b')]['id']}})[_0x2f07('0x17')](function(_0x35f284){return db[_0x2f07('0x5b')][_0x2f07('0x5c')](function(_0x180f53){return _0x35f284[_0x2f07('0x60')](_0x496dd9['query'][_0x2f07('0x56')],{'transaction':_0x180f53})['then'](function(){if(!_[_0x2f07('0x72')](_0xa5f7f1)){return _0x35f284[_0x2f07('0x73')](_0xa5f7f1,{'transaction':_0x180f53});}})['then'](function(){_0xa5f7f1['forEach'](function(_0x2a10f0){socket[_0x2f07('0x5f')](_0x2f07('0x74'),{'UserId':_0x2a10f0,'FaxQueueId':_0x35f284['id']});});});});});});})[_0x2f07('0x17')](respondWithStatusCode(_0x3c364b,null))[_0x2f07('0x29')](handleError(_0x3c364b,null));};exports[_0x2f07('0x75')]=function(_0xf51d0a,_0x52dfc3){return db[_0x2f07('0x20')][_0x2f07('0x35')]({'where':{'id':_0xf51d0a['params']['id']}})['then'](handleEntityNotFound(_0x52dfc3,null))[_0x2f07('0x17')](function(_0x5112e2){if(_0x5112e2){return _0x5112e2['addAgents'](_0xf51d0a[_0x2f07('0x3c')][_0x2f07('0x56')],_[_0x2f07('0x76')](_0xf51d0a[_0x2f07('0x3c')],['ids','id'])||{})[_0x2f07('0x77')](function(_0x30498b){for(var _0x2f7d88=0x0;_0x2f7d88<_0xf51d0a['body'][_0x2f07('0x56')][_0x2f07('0x41')];_0x2f7d88+=0x1){socket[_0x2f07('0x5f')]('userFaxQueue:save',{'UserId':Number(_0xf51d0a['body'][_0x2f07('0x56')][_0x2f7d88]),'FaxQueueId':Number(_0xf51d0a[_0x2f07('0x2b')]['id'])});}return _0x30498b;});}})[_0x2f07('0x17')](respondWithResult(_0x52dfc3,null))[_0x2f07('0x29')](handleError(_0x52dfc3,null));};exports[_0x2f07('0x73')]=function(_0x414540,_0x1dd659){return db[_0x2f07('0x20')][_0x2f07('0x35')]({'where':{'id':_0x414540[_0x2f07('0x2b')]['id']}})[_0x2f07('0x17')](handleEntityNotFound(_0x1dd659,null))[_0x2f07('0x17')](function(_0x56a571){if(_0x56a571){return _0x56a571[_0x2f07('0x73')](_0x414540[_0x2f07('0x27')][_0x2f07('0x56')])[_0x2f07('0x17')](function(){if(_[_0x2f07('0x78')](_0x414540[_0x2f07('0x27')][_0x2f07('0x56')])){for(var _0x5aa451=0x0;_0x5aa451<_0x414540[_0x2f07('0x27')][_0x2f07('0x56')][_0x2f07('0x41')];_0x5aa451+=0x1){socket[_0x2f07('0x5f')](_0x2f07('0x74'),{'UserId':Number(_0x414540['query'][_0x2f07('0x56')][_0x5aa451]),'FaxQueueId':Number(_0x414540[_0x2f07('0x2b')]['id'])});}}else{socket[_0x2f07('0x5f')](_0x2f07('0x74'),{'UserId':Number(_0x414540[_0x2f07('0x27')][_0x2f07('0x56')]),'FaxQueueId':Number(_0x414540[_0x2f07('0x2b')]['id'])});}});}})['then'](respondWithStatusCode(_0x1dd659,null))[_0x2f07('0x29')](handleError(_0x1dd659,null));};exports[_0x2f07('0x79')]=function(_0x5260b0,_0x45d089){var _0x51a952={};var _0x3331fb={};var _0x54f1f4;var _0x3508cf;return db[_0x2f07('0x20')][_0x2f07('0x3f')]({'where':{'id':_0x5260b0[_0x2f07('0x2b')]['id']}})[_0x2f07('0x17')](handleEntityNotFound(_0x45d089,null))['then'](function(_0x10ed29){if(_0x10ed29){_0x54f1f4=_0x10ed29;_0x3331fb[_0x2f07('0x30')]=_[_0x2f07('0x2c')](db[_0x2f07('0x4a')][_0x2f07('0x2d')]);_0x3331fb[_0x2f07('0x27')]=_[_0x2f07('0x2c')](_0x5260b0['query']);_0x3331fb[_0x2f07('0x2e')]=_[_0x2f07('0x2f')](_0x3331fb[_0x2f07('0x30')],_0x3331fb[_0x2f07('0x27')]);_0x51a952[_0x2f07('0x31')]=_[_0x2f07('0x2f')](_0x3331fb['model'],qs[_0x2f07('0x32')](_0x5260b0[_0x2f07('0x27')][_0x2f07('0x32')]));_0x51a952[_0x2f07('0x31')]=_0x51a952[_0x2f07('0x31')]['length']?_0x51a952[_0x2f07('0x31')]:_0x3331fb['model'];_0x51a952[_0x2f07('0x44')]=qs[_0x2f07('0x45')](_0x5260b0['query'][_0x2f07('0x45')]);_0x51a952[_0x2f07('0x25')]=qs['filters'](_[_0x2f07('0x46')](_0x5260b0[_0x2f07('0x27')],_0x3331fb['filters']));if(_0x5260b0[_0x2f07('0x27')][_0x2f07('0x48')]){_0x51a952[_0x2f07('0x25')]=_[_0x2f07('0x49')](_0x51a952['where'],{'$or':_[_0x2f07('0x4c')](_0x51a952['attributes'],function(_0x40739f){var _0x39b692={};_0x39b692[_0x40739f]={'$like':'%'+_0x5260b0[_0x2f07('0x27')]['filter']+'%'};return _0x39b692;})});}_0x51a952=_[_0x2f07('0x49')]({},_0x51a952,_0x5260b0[_0x2f07('0x34')]);return _0x54f1f4[_0x2f07('0x79')](_0x51a952);}})[_0x2f07('0x17')](function(_0x4b400c){if(_0x4b400c){_0x3508cf=_0x4b400c[_0x2f07('0x41')];if(!_0x5260b0['query'][_0x2f07('0x42')]('nolimit')){_0x51a952[_0x2f07('0x12')]=qs['limit'](_0x5260b0[_0x2f07('0x27')][_0x2f07('0x12')]);_0x51a952[_0x2f07('0x11')]=qs[_0x2f07('0x11')](_0x5260b0['query'][_0x2f07('0x11')]);}return _0x54f1f4[_0x2f07('0x79')](_0x51a952);}})['then'](function(_0x47a864){if(_0x47a864){return _0x47a864?{'count':_0x3508cf,'rows':_0x47a864}:null;}})[_0x2f07('0x17')](respondWithResult(_0x45d089,null))[_0x2f07('0x29')](handleError(_0x45d089,null));}; \ No newline at end of file +var _0xba0d=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','TeamId','includes','all','union','compact','value','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','lodash','squel','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','map','FaxQueue','fieldName','type','key','getOptions','where','include','findAll','catch','params','model','keys','query','filters','intersection','attributes','fields','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','rawAttributes','hasOwnProperty','nolimit','sort','FaxQueueId','filter','merge','options','User','UserId','agent','faxPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','pick','addTeams','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_fax_queues','join'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0xba0d,0x8e));var _0xdba0=function(_0x277c65,_0x286ee4){_0x277c65=_0x277c65-0x0;var _0x3e4a19=_0xba0d[_0x277c65];return _0x3e4a19;};'use strict';var BPromise=require(_0xdba0('0x0'));var util=require('util');var _=require(_0xdba0('0x1'));var squel=require(_0xdba0('0x2'));var Redis=require(_0xdba0('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xdba0('0x4'))('api');var config=require(_0xdba0('0x5'));var db=require(_0xdba0('0x6'))['db'];config[_0xdba0('0x7')]=_[_0xdba0('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdba0('0x9'))(new Redis(config[_0xdba0('0x7')]));require(_0xdba0('0xa'))[_0xdba0('0xb')](socket);function respondWithStatusCode(_0x5aeceb,_0x3db492){_0x3db492=_0x3db492||0xcc;return function(_0x5d2ac2){if(_0x5d2ac2){return _0x5aeceb['sendStatus'](_0x3db492);}return _0x5aeceb[_0xdba0('0xc')](_0x3db492)['end']();};}function respondWithResult(_0x268cc3,_0x56d368){_0x56d368=_0x56d368||0xc8;return function(_0x1b4dec){if(_0x1b4dec){return _0x268cc3[_0xdba0('0xc')](_0x56d368)[_0xdba0('0xd')](_0x1b4dec);}};}function respondWithFilteredResult(_0x193cd6,_0x2be4d3){return function(_0x5da0ca){if(_0x5da0ca){var _0x24bf36=typeof _0x2be4d3[_0xdba0('0xe')]==='undefined'&&typeof _0x2be4d3['limit']===_0xdba0('0xf');var _0x2d9e50=_0x5da0ca[_0xdba0('0x10')];var _0x1c7dbf=_0x24bf36?0x0:_0x2be4d3[_0xdba0('0xe')];var _0x28da4c=_0x24bf36?_0x5da0ca[_0xdba0('0x10')]:_0x2be4d3['offset']+_0x2be4d3[_0xdba0('0x11')];var _0x722955;if(_0x28da4c>=_0x2d9e50){_0x28da4c=_0x2d9e50;_0x722955=0xc8;}else{_0x722955=0xce;}_0x193cd6[_0xdba0('0xc')](_0x722955);return _0x193cd6[_0xdba0('0x12')](_0xdba0('0x13'),_0x1c7dbf+'-'+_0x28da4c+'/'+_0x2d9e50)[_0xdba0('0xd')](_0x5da0ca);}return null;};}function saveUpdates(_0x316a23){return function(_0x243a65){if(_0x243a65){return _0x243a65[_0xdba0('0x14')](_0x316a23)[_0xdba0('0x15')](function(_0x479a46){return _0x479a46;});}return null;};}function removeEntity(_0x2b75e7){return function(_0x5e954c){if(_0x5e954c){return _0x5e954c[_0xdba0('0x16')]()[_0xdba0('0x15')](function(){var _0x30b049=_0x5e954c[_0xdba0('0x17')]({'plain':!![]});var _0x5c1d6c='FaxQueues';return db[_0xdba0('0x18')][_0xdba0('0x16')]({'where':{'type':_0x5c1d6c,'resourceId':_0x30b049['id']}})['then'](function(){return _0x5e954c;});})[_0xdba0('0x15')](function(){_0x2b75e7[_0xdba0('0xc')](0xcc)[_0xdba0('0x19')]();});}};}function handleEntityNotFound(_0x591b0e){return function(_0x36adb3){if(!_0x36adb3){_0x591b0e[_0xdba0('0x1a')](0x194);}return _0x36adb3;};}function handleError(_0x35a741,_0x11ded6){_0x11ded6=_0x11ded6||0x1f4;return function(_0x2fdeeb){logger[_0xdba0('0x1b')](_0x2fdeeb[_0xdba0('0x1c')]);if(_0x2fdeeb[_0xdba0('0x1d')]){delete _0x2fdeeb[_0xdba0('0x1d')];}_0x35a741[_0xdba0('0xc')](_0x11ded6)[_0xdba0('0x1e')](_0x2fdeeb);};}exports['index']=function(_0xdce58c,_0x226d17){var _0x4873de={};var _0x80ec5b={'count':0x0,'rows':[]};var _0x4ac548=_[_0xdba0('0x1f')](db[_0xdba0('0x20')]['rawAttributes'],function(_0x4ad40f){return{'name':_0x4ad40f[_0xdba0('0x21')],'type':_0x4ad40f[_0xdba0('0x22')][_0xdba0('0x23')]};});_0x4873de=qs[_0xdba0('0x24')](_0x4ac548,_0xdce58c);var _0x2f6677={'where':_0x4873de[_0xdba0('0x25')]};return db[_0xdba0('0x20')]['count'](_0x2f6677)['then'](function(_0x3cf6c4){_0x80ec5b[_0xdba0('0x10')]=_0x3cf6c4;_0x4873de[_0xdba0('0x26')]=qs[_0xdba0('0x26')](_0xdce58c['query']);return db['FaxQueue'][_0xdba0('0x27')](_0x4873de);})['then'](function(_0x3cb358){_0x80ec5b['rows']=_0x3cb358;return _0x80ec5b;})[_0xdba0('0x15')](respondWithFilteredResult(_0x226d17,_0x4873de))[_0xdba0('0x28')](handleError(_0x226d17,null));};exports['show']=function(_0xafb45d,_0x2ca134){var _0x1b2ef2={'raw':!![],'where':{'id':_0xafb45d[_0xdba0('0x29')]['id']}},_0x46aff8={};_0x46aff8[_0xdba0('0x2a')]=_[_0xdba0('0x2b')](db['FaxQueue']['rawAttributes']);_0x46aff8[_0xdba0('0x2c')]=_[_0xdba0('0x2b')](_0xafb45d[_0xdba0('0x2c')]);_0x46aff8[_0xdba0('0x2d')]=_[_0xdba0('0x2e')](_0x46aff8['model'],_0x46aff8['query']);_0x1b2ef2[_0xdba0('0x2f')]=_[_0xdba0('0x2e')](_0x46aff8['model'],qs[_0xdba0('0x30')](_0xafb45d['query'][_0xdba0('0x30')]));_0x1b2ef2[_0xdba0('0x2f')]=_0x1b2ef2[_0xdba0('0x2f')][_0xdba0('0x31')]?_0x1b2ef2[_0xdba0('0x2f')]:_0x46aff8[_0xdba0('0x2a')];if(_0xafb45d[_0xdba0('0x2c')]['includeAll']){_0x1b2ef2[_0xdba0('0x26')]=[{'all':!![]}];}_0x1b2ef2=_['merge']({},_0x1b2ef2,_0xafb45d['options']);return db[_0xdba0('0x20')][_0xdba0('0x32')](_0x1b2ef2)['then'](handleEntityNotFound(_0x2ca134,null))[_0xdba0('0x15')](respondWithResult(_0x2ca134,null))[_0xdba0('0x28')](handleError(_0x2ca134,null));};exports['create']=function(_0x55021a,_0x4a61cc){return db['FaxQueue'][_0xdba0('0x33')](_0x55021a['body'],{})['then'](function(_0x14ded0){var _0x5f4146=_0x55021a[_0xdba0('0x34')][_0xdba0('0x17')]({'plain':!![]});if(!_0x5f4146)throw new Error(_0xdba0('0x35'));if(_0x5f4146[_0xdba0('0x36')]===_0xdba0('0x34')){var _0x2bc78e=_0x14ded0[_0xdba0('0x17')]({'plain':!![]});var _0x111d5f=_0xdba0('0x37');return db[_0xdba0('0x38')][_0xdba0('0x32')]({'where':{'name':_0x111d5f,'userProfileId':_0x5f4146[_0xdba0('0x39')]},'raw':!![]})['then'](function(_0x101e2c){if(_0x101e2c&&_0x101e2c[_0xdba0('0x3a')]===0x0){return db['UserProfileResource'][_0xdba0('0x33')]({'name':_0x2bc78e[_0xdba0('0x1d')],'resourceId':_0x2bc78e['id'],'type':_0x101e2c[_0xdba0('0x1d')],'sectionId':_0x101e2c['id']},{})[_0xdba0('0x15')](function(){return _0x14ded0;});}else{return _0x14ded0;}})[_0xdba0('0x28')](function(_0x20d5cf){logger[_0xdba0('0x1b')](_0xdba0('0x3b'),_0x20d5cf);throw _0x20d5cf;});}return _0x14ded0;})[_0xdba0('0x15')](respondWithResult(_0x4a61cc,0xc9))[_0xdba0('0x28')](handleError(_0x4a61cc,null));};exports[_0xdba0('0x14')]=function(_0x4296c1,_0x39963d){if(_0x4296c1['body']['id']){delete _0x4296c1[_0xdba0('0x3c')]['id'];}return db['FaxQueue'][_0xdba0('0x32')]({'where':{'id':_0x4296c1[_0xdba0('0x29')]['id']}})['then'](handleEntityNotFound(_0x39963d,null))['then'](saveUpdates(_0x4296c1['body'],null))['then'](respondWithResult(_0x39963d,null))[_0xdba0('0x28')](handleError(_0x39963d,null));};exports[_0xdba0('0x16')]=function(_0x4a21f6,_0x5764dc){return db[_0xdba0('0x20')][_0xdba0('0x32')]({'where':{'id':_0x4a21f6[_0xdba0('0x29')]['id']}})[_0xdba0('0x15')](handleEntityNotFound(_0x5764dc,null))[_0xdba0('0x15')](removeEntity(_0x5764dc,null))[_0xdba0('0x28')](handleError(_0x5764dc,null));};exports[_0xdba0('0x3d')]=function(_0x2905cd,_0xc31213){return db[_0xdba0('0x20')][_0xdba0('0x3d')]()[_0xdba0('0x15')](respondWithResult(_0xc31213,null))[_0xdba0('0x28')](handleError(_0xc31213,null));};exports[_0xdba0('0x3e')]=function(_0x23f035,_0x57dd1e){var _0x2e8184={'raw':!![],'where':{}},_0x77df20={},_0x298447;return db['FaxQueue'][_0xdba0('0x3f')]({'where':{'id':_0x23f035[_0xdba0('0x29')]['id']}})[_0xdba0('0x15')](handleEntityNotFound(_0x57dd1e,null))[_0xdba0('0x15')](function(_0x494332){if(_0x494332){_0x298447=_0x494332[_0xdba0('0x17')]({'plain':!![]});_0x77df20[_0xdba0('0x2a')]=_[_0xdba0('0x2b')](db[_0xdba0('0x40')][_0xdba0('0x41')]);_0x77df20[_0xdba0('0x2c')]=_[_0xdba0('0x2b')](_0x23f035[_0xdba0('0x2c')]);_0x77df20['filters']=_[_0xdba0('0x2e')](_0x77df20[_0xdba0('0x2a')],_0x77df20[_0xdba0('0x2c')]);_0x2e8184[_0xdba0('0x2f')]=_[_0xdba0('0x2e')](_0x77df20['model'],qs['fields'](_0x23f035[_0xdba0('0x2c')][_0xdba0('0x30')]));_0x2e8184['attributes']=_0x2e8184[_0xdba0('0x2f')][_0xdba0('0x31')]?_0x2e8184[_0xdba0('0x2f')]:_0x77df20[_0xdba0('0x2a')];if(!_0x23f035['query'][_0xdba0('0x42')](_0xdba0('0x43'))){_0x2e8184[_0xdba0('0x11')]=qs[_0xdba0('0x11')](_0x23f035['query']['limit']);_0x2e8184[_0xdba0('0xe')]=qs['offset'](_0x23f035[_0xdba0('0x2c')][_0xdba0('0xe')]);}_0x2e8184['order']=qs['sort'](_0x23f035[_0xdba0('0x2c')][_0xdba0('0x44')]);_0x2e8184[_0xdba0('0x25')]=qs['filters'](_['pick'](_0x23f035[_0xdba0('0x2c')],_0x77df20['filters']));_0x2e8184[_0xdba0('0x25')][_0xdba0('0x45')]=_0x494332['id'];if(_0x23f035[_0xdba0('0x2c')][_0xdba0('0x46')]){_0x2e8184[_0xdba0('0x25')]=_[_0xdba0('0x47')](_0x2e8184['where'],{'$or':_[_0xdba0('0x1f')](_0x2e8184['attributes'],function(_0x5693fd){var _0xafe6a={};_0xafe6a[_0x5693fd]={'$like':'%'+_0x23f035['query']['filter']+'%'};return _0xafe6a;})});}_0x2e8184=_[_0xdba0('0x47')]({},_0x2e8184,_0x23f035[_0xdba0('0x48')]);return db[_0xdba0('0x40')][_0xdba0('0x27')](_0x2e8184);}})[_0xdba0('0x15')](function(_0x4e2302){if(_0x4e2302){return db[_0xdba0('0x49')]['findAndCountAll']({'where':{'id':_[_0xdba0('0x1f')](_0x4e2302,_0xdba0('0x4a')),'role':_0xdba0('0x4b')},'attributes':['id',_0xdba0('0x1d'),_0xdba0('0x4c'),_0xdba0('0x4d'),_0xdba0('0x4e')]});}})[_0xdba0('0x15')](function(_0x467971){if(_0x467971){return{'count':_0x467971[_0xdba0('0x10')],'rows':_[_0xdba0('0x1f')](_0x467971[_0xdba0('0x4f')],function(_0xce6896){return{'membername':_0xce6896[_0xdba0('0x1d')],'UserId':_0xce6896['id'],'queue_name':_0x298447[_0xdba0('0x1d')],'FaxQueueId':_0x298447['id'],'interface':util[_0xdba0('0x50')](_0xdba0('0x51'),'SIP',_0xce6896[_0xdba0('0x1d')]),'penalty':0x0,'paused':_0xce6896[_0xdba0('0x4c')],'createdAt':_0xce6896[_0xdba0('0x4e')],'updatedAt':_0xce6896[_0xdba0('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdba0('0x15')](respondWithFilteredResult(_0x57dd1e,_0x2e8184))[_0xdba0('0x28')](handleError(_0x57dd1e,null));};exports[_0xdba0('0x52')]=function(_0x49aaea,_0x57a1e5){var _0x319791={};var _0x47e00c={};var _0x1812b4;var _0x3e5b49;return db['FaxQueue'][_0xdba0('0x3f')]({'where':{'id':_0x49aaea['params']['id']}})[_0xdba0('0x15')](handleEntityNotFound(_0x57a1e5,null))[_0xdba0('0x15')](function(_0x50357f){if(_0x50357f){_0x1812b4=_0x50357f;_0x47e00c[_0xdba0('0x2a')]=_['keys'](db['Team'][_0xdba0('0x41')]);_0x47e00c[_0xdba0('0x2c')]=_[_0xdba0('0x2b')](_0x49aaea['query']);_0x47e00c[_0xdba0('0x2d')]=_[_0xdba0('0x2e')](_0x47e00c[_0xdba0('0x2a')],_0x47e00c[_0xdba0('0x2c')]);_0x319791[_0xdba0('0x2f')]=_[_0xdba0('0x2e')](_0x47e00c['model'],qs[_0xdba0('0x30')](_0x49aaea[_0xdba0('0x2c')]['fields']));_0x319791['attributes']=_0x319791[_0xdba0('0x2f')][_0xdba0('0x31')]?_0x319791['attributes']:_0x47e00c['model'];_0x319791['order']=qs[_0xdba0('0x44')](_0x49aaea[_0xdba0('0x2c')][_0xdba0('0x44')]);_0x319791[_0xdba0('0x25')]=qs[_0xdba0('0x2d')](_[_0xdba0('0x53')](_0x49aaea[_0xdba0('0x2c')],_0x47e00c['filters']));if(_0x49aaea[_0xdba0('0x2c')][_0xdba0('0x46')]){_0x319791['where']=_[_0xdba0('0x47')](_0x319791[_0xdba0('0x25')],{'$or':_[_0xdba0('0x1f')](_0x319791[_0xdba0('0x2f')],function(_0x851c25){var _0x5e0173={};_0x5e0173[_0x851c25]={'$like':'%'+_0x49aaea['query']['filter']+'%'};return _0x5e0173;})});}_0x319791=_[_0xdba0('0x47')]({},_0x319791,_0x49aaea['options']);return _0x1812b4[_0xdba0('0x52')](_0x319791);}})[_0xdba0('0x15')](function(_0x71aa9b){if(_0x71aa9b){_0x3e5b49=_0x71aa9b['length'];if(!_0x49aaea['query'][_0xdba0('0x42')](_0xdba0('0x43'))){_0x319791[_0xdba0('0x11')]=qs['limit'](_0x49aaea[_0xdba0('0x2c')][_0xdba0('0x11')]);_0x319791[_0xdba0('0xe')]=qs[_0xdba0('0xe')](_0x49aaea[_0xdba0('0x2c')][_0xdba0('0xe')]);}return _0x1812b4[_0xdba0('0x52')](_0x319791);}})[_0xdba0('0x15')](function(_0xbe4b82){if(_0xbe4b82){return _0xbe4b82?{'count':_0x3e5b49,'rows':_0xbe4b82}:null;}})['then'](respondWithResult(_0x57a1e5,null))[_0xdba0('0x28')](handleError(_0x57a1e5,null));};exports[_0xdba0('0x54')]=function(_0x3b8a86,_0x277d2f){var _0x144f99=_0x3b8a86[_0xdba0('0x3c')]['ids'];return db['Team'][_0xdba0('0x27')]({'where':{'id':_0x144f99},'attributes':['id'],'include':[{'model':db[_0xdba0('0x49')],'as':_0xdba0('0x55'),'attributes':['id',_0xdba0('0x1d'),_0xdba0('0x56'),_0xdba0('0x57'),_0xdba0('0x58')],'raw':!![]}]})[_0xdba0('0x15')](function(_0x14602d){if(_0x14602d){var _0x23d65a=_['flatMap'](_0x14602d,function(_0x1a2c67){var _0x582c5a=_0x1a2c67[_0xdba0('0x17')]({'plain':!![]});return _0x582c5a['Agents'];});return db[_0xdba0('0x20')][_0xdba0('0x32')]({'where':{'id':_0x3b8a86[_0xdba0('0x29')]['id']}})['then'](function(_0x5ceecf){return db[_0xdba0('0x59')][_0xdba0('0x5a')](function(_0x5586f6){return _0x5ceecf[_0xdba0('0x54')](_0x144f99,{'transaction':_0x5586f6})[_0xdba0('0x15')](function(){return BPromise[_0xdba0('0x5b')](_0x23d65a,function(_0x201b67){return db['UserFaxQueue'][_0xdba0('0x5c')]({'where':{'UserId':_0x201b67['id'],'FaxQueueId':_0x3b8a86['params']['id']},'transaction':_0x5586f6});});})['then'](function(){_0x23d65a[_0xdba0('0x5d')](function(_0x583746){socket[_0xdba0('0x5e')](_0xdba0('0x5f'),{'UserId':_0x583746['id'],'FaxQueueId':_0x5ceecf['id']});});});});});}})['then'](respondWithStatusCode(_0x277d2f,null))[_0xdba0('0x28')](handleError(_0x277d2f,null));};exports[_0xdba0('0x60')]=function(_0x16ddc3,_0x114120){return db['Team']['findAll']({'where':{'id':_0x16ddc3[_0xdba0('0x2c')][_0xdba0('0x61')]},'attributes':['id'],'include':[{'model':db[_0xdba0('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x114120,null))[_0xdba0('0x15')](function(_0x1d7e14){var _0x6b26da=_[_0xdba0('0x1f')](_0x1d7e14,'id');var _0x9bf57=[];var _0x2a7bde=[];var _0x1ba698=squel[_0xdba0('0x62')]();_0x1ba698[_0xdba0('0x63')](_0xdba0('0x64'))[_0xdba0('0x65')](_0xdba0('0x66'),'tq')[_0xdba0('0x67')](_0xdba0('0x68'),'ut',_0xdba0('0x69'))[_0xdba0('0x25')](_0xdba0('0x6a'),_0x16ddc3[_0xdba0('0x29')]['id']);for(var _0x226dd9=0x0;_0x226dd9<_0x1d7e14[_0xdba0('0x31')];_0x226dd9+=0x1){let _0xf4b7d6=_0x1d7e14[_0x226dd9];for(var _0x1286ae=0x0;_0x1286ae<_0xf4b7d6['Agents']['length'];_0x1286ae+=0x1){let _0x32f56c=_0xf4b7d6[_0xdba0('0x55')][_0x1286ae];var _0x33f006=_0x1ba698['clone']();_0x33f006[_0xdba0('0x25')](_0xdba0('0x6b'),_0x32f56c['id']);_0x2a7bde[_0xdba0('0x6c')](db[_0xdba0('0x59')][_0xdba0('0x2c')](_0x33f006['toString'](),{'type':db[_0xdba0('0x59')]['QueryTypes'][_0xdba0('0x6d')]})['then'](function(_0x33673c){if(_0x33673c[_0xdba0('0x31')]===0x1){return _0x32f56c['id'];}else{var _0x568aeb=_['every'](_[_0xdba0('0x1f')](_0x33673c,_0xdba0('0x6e')),function(_0x3f61fa){return _[_0xdba0('0x6f')](_0x6b26da,_0x3f61fa);});if(_0x568aeb){return _0x32f56c['id'];}}}));}}return BPromise[_0xdba0('0x70')](_0x2a7bde)[_0xdba0('0x15')](function(_0x2cc865){_0x9bf57=_(_0x9bf57)[_0xdba0('0x71')](_0x2cc865)[_0xdba0('0x72')]()[_0xdba0('0x73')]();return db[_0xdba0('0x20')][_0xdba0('0x32')]({'where':{'id':_0x16ddc3['params']['id']}})['then'](function(_0x34f57b){return db[_0xdba0('0x59')][_0xdba0('0x5a')](function(_0x4a7913){return _0x34f57b['removeTeams'](_0x16ddc3[_0xdba0('0x2c')][_0xdba0('0x61')],{'transaction':_0x4a7913})[_0xdba0('0x15')](function(){if(!_['isEmpty'](_0x9bf57)){return _0x34f57b[_0xdba0('0x74')](_0x9bf57,{'transaction':_0x4a7913});}})[_0xdba0('0x15')](function(){_0x9bf57[_0xdba0('0x5d')](function(_0x2d09ed){socket[_0xdba0('0x5e')](_0xdba0('0x75'),{'UserId':_0x2d09ed,'FaxQueueId':_0x34f57b['id']});});});});});});})['then'](respondWithStatusCode(_0x114120,null))[_0xdba0('0x28')](handleError(_0x114120,null));};exports[_0xdba0('0x76')]=function(_0x36dafc,_0x8f4c18){return db[_0xdba0('0x20')][_0xdba0('0x32')]({'where':{'id':_0x36dafc[_0xdba0('0x29')]['id']}})[_0xdba0('0x15')](handleEntityNotFound(_0x8f4c18,null))[_0xdba0('0x15')](function(_0x1a9f71){if(_0x1a9f71){return _0x1a9f71[_0xdba0('0x76')](_0x36dafc[_0xdba0('0x3c')]['ids'],_[_0xdba0('0x77')](_0x36dafc[_0xdba0('0x3c')],[_0xdba0('0x61'),'id'])||{})[_0xdba0('0x78')](function(_0xfb1114){for(var _0xcef646=0x0;_0xcef646<_0x36dafc[_0xdba0('0x3c')][_0xdba0('0x61')][_0xdba0('0x31')];_0xcef646+=0x1){socket['emit'](_0xdba0('0x5f'),{'UserId':Number(_0x36dafc[_0xdba0('0x3c')][_0xdba0('0x61')][_0xcef646]),'FaxQueueId':Number(_0x36dafc[_0xdba0('0x29')]['id'])});}return _0xfb1114;});}})[_0xdba0('0x15')](respondWithResult(_0x8f4c18,null))[_0xdba0('0x28')](handleError(_0x8f4c18,null));};exports[_0xdba0('0x74')]=function(_0x359104,_0x5c8dfd){return db[_0xdba0('0x20')][_0xdba0('0x32')]({'where':{'id':_0x359104['params']['id']}})['then'](handleEntityNotFound(_0x5c8dfd,null))[_0xdba0('0x15')](function(_0x8c48d){if(_0x8c48d){return _0x8c48d[_0xdba0('0x74')](_0x359104[_0xdba0('0x2c')][_0xdba0('0x61')])['then'](function(){if(_[_0xdba0('0x79')](_0x359104[_0xdba0('0x2c')][_0xdba0('0x61')])){for(var _0x3627e6=0x0;_0x3627e6<_0x359104['query']['ids'][_0xdba0('0x31')];_0x3627e6+=0x1){socket['emit'](_0xdba0('0x75'),{'UserId':Number(_0x359104[_0xdba0('0x2c')][_0xdba0('0x61')][_0x3627e6]),'FaxQueueId':Number(_0x359104[_0xdba0('0x29')]['id'])});}}else{socket[_0xdba0('0x5e')](_0xdba0('0x75'),{'UserId':Number(_0x359104[_0xdba0('0x2c')][_0xdba0('0x61')]),'FaxQueueId':Number(_0x359104[_0xdba0('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x5c8dfd,null))[_0xdba0('0x28')](handleError(_0x5c8dfd,null));};exports['getAgents']=function(_0x45ff83,_0x23de97){var _0x1642af={};var _0x29c429={};var _0x185cba;var _0x422f9b;return db[_0xdba0('0x20')][_0xdba0('0x3f')]({'where':{'id':_0x45ff83[_0xdba0('0x29')]['id']}})['then'](handleEntityNotFound(_0x23de97,null))[_0xdba0('0x15')](function(_0x51052f){if(_0x51052f){_0x185cba=_0x51052f;_0x29c429[_0xdba0('0x2a')]=_[_0xdba0('0x2b')](db[_0xdba0('0x49')][_0xdba0('0x41')]);_0x29c429['query']=_[_0xdba0('0x2b')](_0x45ff83[_0xdba0('0x2c')]);_0x29c429[_0xdba0('0x2d')]=_[_0xdba0('0x2e')](_0x29c429['model'],_0x29c429['query']);_0x1642af[_0xdba0('0x2f')]=_[_0xdba0('0x2e')](_0x29c429[_0xdba0('0x2a')],qs[_0xdba0('0x30')](_0x45ff83[_0xdba0('0x2c')][_0xdba0('0x30')]));_0x1642af[_0xdba0('0x2f')]=_0x1642af[_0xdba0('0x2f')][_0xdba0('0x31')]?_0x1642af['attributes']:_0x29c429[_0xdba0('0x2a')];_0x1642af['order']=qs[_0xdba0('0x44')](_0x45ff83[_0xdba0('0x2c')][_0xdba0('0x44')]);_0x1642af[_0xdba0('0x25')]=qs[_0xdba0('0x2d')](_[_0xdba0('0x53')](_0x45ff83[_0xdba0('0x2c')],_0x29c429[_0xdba0('0x2d')]));if(_0x45ff83[_0xdba0('0x2c')][_0xdba0('0x46')]){_0x1642af[_0xdba0('0x25')]=_[_0xdba0('0x47')](_0x1642af[_0xdba0('0x25')],{'$or':_[_0xdba0('0x1f')](_0x1642af[_0xdba0('0x2f')],function(_0x133447){var _0x24f8e0={};_0x24f8e0[_0x133447]={'$like':'%'+_0x45ff83[_0xdba0('0x2c')]['filter']+'%'};return _0x24f8e0;})});}_0x1642af=_[_0xdba0('0x47')]({},_0x1642af,_0x45ff83[_0xdba0('0x48')]);return _0x185cba[_0xdba0('0x7a')](_0x1642af);}})[_0xdba0('0x15')](function(_0x49eb62){if(_0x49eb62){_0x422f9b=_0x49eb62[_0xdba0('0x31')];if(!_0x45ff83['query'][_0xdba0('0x42')](_0xdba0('0x43'))){_0x1642af['limit']=qs[_0xdba0('0x11')](_0x45ff83['query'][_0xdba0('0x11')]);_0x1642af['offset']=qs[_0xdba0('0xe')](_0x45ff83[_0xdba0('0x2c')]['offset']);}return _0x185cba['getAgents'](_0x1642af);}})['then'](function(_0xbd979f){if(_0xbd979f){return _0xbd979f?{'count':_0x422f9b,'rows':_0xbd979f}:null;}})[_0xdba0('0x15')](respondWithResult(_0x23de97,null))[_0xdba0('0x28')](handleError(_0x23de97,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 2d495c3..1ccc142 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 _0x1c11=['../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x4390b8,_0x114074){var _0x3b7551=function(_0x47824d){while(--_0x47824d){_0x4390b8['push'](_0x4390b8['shift']());}};_0x3b7551(++_0x114074);}(_0x1c11,0x1d3));var _0x11c1=function(_0x58fd8a,_0x5c8736){_0x58fd8a=_0x58fd8a-0x0;var _0x32bec7=_0x1c11[_0x58fd8a];return _0x32bec7;};'use strict';var EventEmitter=require(_0x11c1('0x0'));var FaxQueue=require(_0x11c1('0x1'))['db'][_0x11c1('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x11c1('0x3')](0x0);var events={'afterCreate':_0x11c1('0x4'),'afterUpdate':_0x11c1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x54330f){return function(_0x2195fc,_0x4ff5d7,_0x32aaaf){FaxQueueEvents[_0x11c1('0x6')](_0x54330f+':'+_0x2195fc['id'],_0x2195fc);FaxQueueEvents[_0x11c1('0x6')](_0x54330f,_0x2195fc);_0x32aaaf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x11c1('0x7')](e,emitEvent(event));}}module[_0x11c1('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x868f=['../../mysqldb','FaxQueue','save','update','remove','emit','hook','exports','events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x868f,0x116));var _0xf868=function(_0x42024c,_0x121a52){_0x42024c=_0x42024c-0x0;var _0x4d3fd3=_0x868f[_0x42024c];return _0x4d3fd3;};'use strict';var EventEmitter=require(_0xf868('0x0'));var FaxQueue=require(_0xf868('0x1'))['db'][_0xf868('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf868('0x3'),'afterUpdate':_0xf868('0x4'),'afterDestroy':_0xf868('0x5')};function emitEvent(_0x4164f8){return function(_0x5d8354,_0x1a9083,_0x5486dd){FaxQueueEvents['emit'](_0x4164f8+':'+_0x5d8354['id'],_0x5d8354);FaxQueueEvents[_0xf868('0x6')](_0x4164f8,_0x5d8354);_0x5486dd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xf868('0x7')](e,emitEvent(event));}}module[_0xf868('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index f208d95..d17025b 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 _0x7405=['../../config/environment','exports','FaxQueue','fax_queues','lodash','../../config/logger','bluebird','path','rimraf'];(function(_0x3874fd,_0x4bdc14){var _0x425904=function(_0x2d0c07){while(--_0x2d0c07){_0x3874fd['push'](_0x3874fd['shift']());}};_0x425904(++_0x4bdc14);}(_0x7405,0x151));var _0x5740=function(_0xa522f,_0x5debbc){_0xa522f=_0xa522f-0x0;var _0x2083b0=_0x7405[_0xa522f];return _0x2083b0;};'use strict';var _=require(_0x5740('0x0'));var util=require('util');var logger=require(_0x5740('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5740('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5740('0x3'));var rimraf=require(_0x5740('0x4'));var config=require(_0x5740('0x5'));var attributes=require('./faxQueue.attributes');module[_0x5740('0x6')]=function(_0x21a170,_0x2d141d){return _0x21a170['define'](_0x5740('0x7'),attributes,{'tableName':_0x5740('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3663=['define','FaxQueue','fax_queues','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports'];(function(_0x5ed32c,_0x956025){var _0x271ea3=function(_0x206a21){while(--_0x206a21){_0x5ed32c['push'](_0x5ed32c['shift']());}};_0x271ea3(++_0x956025);}(_0x3663,0x18f));var _0x3366=function(_0x5585f5,_0x167771){_0x5585f5=_0x5585f5-0x0;var _0x3439c9=_0x3663[_0x5585f5];return _0x3439c9;};'use strict';var _=require('lodash');var util=require(_0x3366('0x0'));var logger=require(_0x3366('0x1'))('api');var moment=require(_0x3366('0x2'));var BPromise=require(_0x3366('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3366('0x4'));var rimraf=require(_0x3366('0x5'));var config=require(_0x3366('0x6'));var attributes=require(_0x3366('0x7'));module[_0x3366('0x8')]=function(_0x3f2136,_0x18c06a){return _0x3f2136[_0x3366('0x9')](_0x3366('0xa'),attributes,{'tableName':_0x3366('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 9eb3cc2..370561c 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 _0x2751=['find','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','findAll','options','raw','where','attributes','include','map','model','GetFaxQueue','debug','stringify','catch','ShowFaxQueue'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0x2751,0x14e));var _0x1275=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2751[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1275('0x0'));var util=require(_0x1275('0x1'));var moment=require(_0x1275('0x2'));var BPromise=require('bluebird');var rs=require(_0x1275('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1275('0x4'));var logger=require('../../config/logger')(_0x1275('0x5'));var config=require(_0x1275('0x6'));var jayson=require(_0x1275('0x7'));var client=jayson[_0x1275('0x8')]['http']({'port':0x232a});config[_0x1275('0x9')]=_[_0x1275('0xa')](config[_0x1275('0x9')],{'host':_0x1275('0xb'),'port':0x18eb});var socket=require(_0x1275('0xc'))(new Redis(config['redis']));require(_0x1275('0xd'))[_0x1275('0xe')](socket);function respondWithRpcPromise(_0x511f0e,_0x54284b,_0x2f5429){return new BPromise(function(_0x42f549,_0x41327c){return client['request'](_0x511f0e,_0x2f5429)[_0x1275('0xf')](function(_0x1f306a){logger[_0x1275('0x10')](_0x1275('0x11'),_0x54284b,_0x1275('0x12'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x54284b,_0x1275('0x12'),JSON['stringify'](_0x1f306a));if(_0x1f306a[_0x1275('0x13')]){if(_0x1f306a[_0x1275('0x13')][_0x1275('0x14')]===0x1f4){logger[_0x1275('0x13')](_0x1275('0x11'),_0x54284b,_0x1f306a[_0x1275('0x13')][_0x1275('0x15')]);return _0x41327c(_0x1f306a['error']['message']);}logger[_0x1275('0x13')](_0x1275('0x11'),_0x54284b,_0x1f306a[_0x1275('0x13')][_0x1275('0x15')]);return _0x42f549(_0x1f306a[_0x1275('0x13')][_0x1275('0x15')]);}else{logger[_0x1275('0x10')](_0x1275('0x11'),_0x54284b,_0x1275('0x12'));_0x42f549(_0x1f306a[_0x1275('0x16')][_0x1275('0x15')]);}})['catch'](function(_0x22db14){logger[_0x1275('0x13')](_0x1275('0x11'),_0x54284b,_0x22db14);_0x41327c(_0x22db14);});});}exports['GetFaxQueue']=function(_0x150abe){var _0x1eb07a=this;return new Promise(function(_0x472de9,_0x189546){return db['FaxQueue'][_0x1275('0x17')]({'raw':_0x150abe[_0x1275('0x18')]?_0x150abe[_0x1275('0x18')][_0x1275('0x19')]===undefined?!![]:![]:!![],'where':_0x150abe[_0x1275('0x18')]?_0x150abe['options'][_0x1275('0x1a')]||null:null,'attributes':_0x150abe[_0x1275('0x18')]?_0x150abe[_0x1275('0x18')][_0x1275('0x1b')]||null:null,'limit':_0x150abe['options']?_0x150abe[_0x1275('0x18')]['limit']||null:null,'include':_0x150abe[_0x1275('0x18')]?_0x150abe[_0x1275('0x18')][_0x1275('0x1c')]?_[_0x1275('0x1d')](_0x150abe[_0x1275('0x18')][_0x1275('0x1c')],function(_0x378f8c){return{'model':db[_0x378f8c['model']],'as':_0x378f8c['as'],'attributes':_0x378f8c[_0x1275('0x1b')],'include':_0x378f8c[_0x1275('0x1c')]?_[_0x1275('0x1d')](_0x378f8c[_0x1275('0x1c')],function(_0x4cb526){return{'model':db[_0x4cb526[_0x1275('0x1e')]],'as':_0x4cb526['as'],'attributes':_0x4cb526['attributes'],'include':_0x4cb526[_0x1275('0x1c')]?_[_0x1275('0x1d')](_0x4cb526['include'],function(_0x4ec932){return{'model':db[_0x4ec932[_0x1275('0x1e')]],'as':_0x4ec932['as'],'attributes':_0x4ec932[_0x1275('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1275('0xf')](function(_0x5bdbfe){logger[_0x1275('0x10')](_0x1275('0x1f'),_0x150abe);logger[_0x1275('0x20')](_0x1275('0x1f'),_0x150abe,JSON[_0x1275('0x21')](_0x5bdbfe));_0x472de9(_0x5bdbfe);})[_0x1275('0x22')](function(_0x3a4eaf){logger[_0x1275('0x13')](_0x1275('0x1f'),_0x3a4eaf[_0x1275('0x15')],_0x150abe);_0x189546(_0x1eb07a[_0x1275('0x13')](0x1f4,_0x3a4eaf[_0x1275('0x15')]));});});};exports[_0x1275('0x23')]=function(_0x3c43bb){var _0x32ae6b=this;return new Promise(function(_0x75daf,_0x316f74){return db['FaxQueue'][_0x1275('0x24')]({'raw':_0x3c43bb['options']?_0x3c43bb[_0x1275('0x18')][_0x1275('0x19')]===undefined?!![]:![]:!![],'where':_0x3c43bb['options']?_0x3c43bb[_0x1275('0x18')][_0x1275('0x1a')]||null:null,'attributes':_0x3c43bb[_0x1275('0x18')]?_0x3c43bb[_0x1275('0x18')][_0x1275('0x1b')]||null:null,'include':_0x3c43bb[_0x1275('0x18')]?_0x3c43bb[_0x1275('0x18')][_0x1275('0x1c')]?_['map'](_0x3c43bb['options'][_0x1275('0x1c')],function(_0x53a3f4){return{'model':db[_0x53a3f4[_0x1275('0x1e')]],'as':_0x53a3f4['as'],'attributes':_0x53a3f4[_0x1275('0x1b')],'include':_0x53a3f4[_0x1275('0x1c')]?_[_0x1275('0x1d')](_0x53a3f4[_0x1275('0x1c')],function(_0x49776e){return{'model':db[_0x49776e['model']],'as':_0x49776e['as'],'attributes':_0x49776e[_0x1275('0x1b')],'include':_0x49776e[_0x1275('0x1c')]?_['map'](_0x49776e['include'],function(_0xb25ac5){return{'model':db[_0xb25ac5['model']],'as':_0xb25ac5['as'],'attributes':_0xb25ac5[_0x1275('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1275('0xf')](function(_0x9fd121){logger[_0x1275('0x10')](_0x1275('0x23'),_0x3c43bb);logger['debug'](_0x1275('0x23'),_0x3c43bb,JSON['stringify'](_0x9fd121));_0x75daf(_0x9fd121);})[_0x1275('0x22')](function(_0x150c8f){logger[_0x1275('0x13')](_0x1275('0x23'),_0x150c8f['message'],_0x3c43bb);_0x316f74(_0x32ae6b['error'](0x1f4,_0x150c8f[_0x1275('0x15')]));});});}; \ No newline at end of file +var _0x0c75=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x0c75,0x139));var _0x50c7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0c75[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x50c7('0x0'));var moment=require('moment');var BPromise=require(_0x50c7('0x1'));var rs=require(_0x50c7('0x2'));var fs=require('fs');var Redis=require(_0x50c7('0x3'));var db=require(_0x50c7('0x4'))['db'];var utils=require(_0x50c7('0x5'));var logger=require(_0x50c7('0x6'))('rpc');var config=require(_0x50c7('0x7'));var jayson=require(_0x50c7('0x8'));var client=jayson[_0x50c7('0x9')][_0x50c7('0xa')]({'port':0x232a});config[_0x50c7('0xb')]=_[_0x50c7('0xc')](config[_0x50c7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x50c7('0xd'))(new Redis(config[_0x50c7('0xb')]));require('./faxQueue.socket')[_0x50c7('0xe')](socket);function respondWithRpcPromise(_0x26dee5,_0x5e7620,_0x359b0c){return new BPromise(function(_0x8044d3,_0x20e10b){return client[_0x50c7('0xf')](_0x26dee5,_0x359b0c)[_0x50c7('0x10')](function(_0x4e71c4){logger[_0x50c7('0x11')](_0x50c7('0x12'),_0x5e7620,'request\x20sent');logger[_0x50c7('0x13')](_0x50c7('0x14'),_0x5e7620,'request\x20sent',JSON[_0x50c7('0x15')](_0x4e71c4));if(_0x4e71c4[_0x50c7('0x16')]){if(_0x4e71c4[_0x50c7('0x16')][_0x50c7('0x17')]===0x1f4){logger[_0x50c7('0x16')](_0x50c7('0x12'),_0x5e7620,_0x4e71c4[_0x50c7('0x16')][_0x50c7('0x18')]);return _0x20e10b(_0x4e71c4[_0x50c7('0x16')][_0x50c7('0x18')]);}logger[_0x50c7('0x16')](_0x50c7('0x12'),_0x5e7620,_0x4e71c4[_0x50c7('0x16')]['message']);return _0x8044d3(_0x4e71c4[_0x50c7('0x16')]['message']);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x5e7620,_0x50c7('0x19'));_0x8044d3(_0x4e71c4[_0x50c7('0x1a')][_0x50c7('0x18')]);}})[_0x50c7('0x1b')](function(_0x1deaa9){logger['error'](_0x50c7('0x12'),_0x5e7620,_0x1deaa9);_0x20e10b(_0x1deaa9);});});}exports[_0x50c7('0x1c')]=function(_0x10ec81){var _0x1adc0d=this;return new Promise(function(_0x4dab05,_0x4bd1a6){return db[_0x50c7('0x1d')][_0x50c7('0x1e')]({'raw':_0x10ec81[_0x50c7('0x1f')]?_0x10ec81[_0x50c7('0x1f')][_0x50c7('0x20')]===undefined?!![]:![]:!![],'where':_0x10ec81[_0x50c7('0x1f')]?_0x10ec81[_0x50c7('0x1f')][_0x50c7('0x21')]||null:null,'attributes':_0x10ec81['options']?_0x10ec81[_0x50c7('0x1f')][_0x50c7('0x22')]||null:null,'limit':_0x10ec81[_0x50c7('0x1f')]?_0x10ec81['options'][_0x50c7('0x23')]||null:null,'include':_0x10ec81[_0x50c7('0x1f')]?_0x10ec81['options'][_0x50c7('0x24')]?_[_0x50c7('0x25')](_0x10ec81['options'][_0x50c7('0x24')],function(_0x3f0372){return{'model':db[_0x3f0372[_0x50c7('0x26')]],'as':_0x3f0372['as'],'attributes':_0x3f0372[_0x50c7('0x22')],'include':_0x3f0372[_0x50c7('0x24')]?_['map'](_0x3f0372[_0x50c7('0x24')],function(_0x42b9e1){return{'model':db[_0x42b9e1['model']],'as':_0x42b9e1['as'],'attributes':_0x42b9e1[_0x50c7('0x22')],'include':_0x42b9e1[_0x50c7('0x24')]?_['map'](_0x42b9e1['include'],function(_0x22a994){return{'model':db[_0x22a994[_0x50c7('0x26')]],'as':_0x22a994['as'],'attributes':_0x22a994['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x25907){logger[_0x50c7('0x11')](_0x50c7('0x1c'),_0x10ec81);logger[_0x50c7('0x13')](_0x50c7('0x1c'),_0x10ec81,JSON[_0x50c7('0x15')](_0x25907));_0x4dab05(_0x25907);})[_0x50c7('0x1b')](function(_0x5958c7){logger[_0x50c7('0x16')](_0x50c7('0x1c'),_0x5958c7['message'],_0x10ec81);_0x4bd1a6(_0x1adc0d[_0x50c7('0x16')](0x1f4,_0x5958c7[_0x50c7('0x18')]));});});};exports[_0x50c7('0x27')]=function(_0x1d6e05){var _0x3e9cd8=this;return new Promise(function(_0x5eda41,_0x3ff8eb){return db[_0x50c7('0x1d')]['find']({'raw':_0x1d6e05[_0x50c7('0x1f')]?_0x1d6e05['options']['raw']===undefined?!![]:![]:!![],'where':_0x1d6e05[_0x50c7('0x1f')]?_0x1d6e05[_0x50c7('0x1f')][_0x50c7('0x21')]||null:null,'attributes':_0x1d6e05[_0x50c7('0x1f')]?_0x1d6e05[_0x50c7('0x1f')][_0x50c7('0x22')]||null:null,'include':_0x1d6e05[_0x50c7('0x1f')]?_0x1d6e05['options'][_0x50c7('0x24')]?_['map'](_0x1d6e05[_0x50c7('0x1f')][_0x50c7('0x24')],function(_0x1cadc3){return{'model':db[_0x1cadc3[_0x50c7('0x26')]],'as':_0x1cadc3['as'],'attributes':_0x1cadc3['attributes'],'include':_0x1cadc3[_0x50c7('0x24')]?_[_0x50c7('0x25')](_0x1cadc3[_0x50c7('0x24')],function(_0x448a18){return{'model':db[_0x448a18[_0x50c7('0x26')]],'as':_0x448a18['as'],'attributes':_0x448a18['attributes'],'include':_0x448a18[_0x50c7('0x24')]?_['map'](_0x448a18[_0x50c7('0x24')],function(_0x17fd1d){return{'model':db[_0x17fd1d[_0x50c7('0x26')]],'as':_0x17fd1d['as'],'attributes':_0x17fd1d[_0x50c7('0x22')]};}):[]};}):[]};}):[]:[]})[_0x50c7('0x10')](function(_0x136e07){logger[_0x50c7('0x11')](_0x50c7('0x27'),_0x1d6e05);logger[_0x50c7('0x13')]('ShowFaxQueue',_0x1d6e05,JSON['stringify'](_0x136e07));_0x5eda41(_0x136e07);})[_0x50c7('0x1b')](function(_0xcbdb4d){logger['error'](_0x50c7('0x27'),_0xcbdb4d[_0x50c7('0x18')],_0x1d6e05);_0x3ff8eb(_0x3e9cd8[_0x50c7('0x16')](0x1f4,_0xcbdb4d[_0x50c7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 2cf6910..67c860a 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 _0x2201=['remove','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x444de5,_0x1a7291){var _0x473cfa=function(_0x3ac368){while(--_0x3ac368){_0x444de5['push'](_0x444de5['shift']());}};_0x473cfa(++_0x1a7291);}(_0x2201,0x155));var _0x1220=function(_0x100696,_0x2c163b){_0x100696=_0x100696-0x0;var _0x36c0af=_0x2201[_0x100696];return _0x36c0af;};'use strict';var FaxQueueEvents=require(_0x1220('0x0'));var events=[_0x1220('0x1'),_0x1220('0x2'),'update'];function createListener(_0x249a72,_0x4c5336){return function(_0xf1dc88){_0x4c5336['emit'](_0x249a72,_0xf1dc88);};}function removeListener(_0x3be1f7,_0x2e6e28){return function(){FaxQueueEvents[_0x1220('0x3')](_0x3be1f7,_0x2e6e28);};}exports[_0x1220('0x4')]=function(_0x243717){for(var _0x2aaa29=0x0,_0x28697b=events[_0x1220('0x5')];_0x2aaa29<_0x28697b;_0x2aaa29++){var _0x1fb0c1=events[_0x2aaa29];var _0x902b63=createListener(_0x1220('0x6')+_0x1fb0c1,_0x243717);FaxQueueEvents['on'](_0x1fb0c1,_0x902b63);}}; \ No newline at end of file +var _0x7543=['faxQueue:','./faxQueue.events','remove','update','emit','removeListener','register','length'];(function(_0x49ed67,_0x290989){var _0x1523d5=function(_0x34a179){while(--_0x34a179){_0x49ed67['push'](_0x49ed67['shift']());}};_0x1523d5(++_0x290989);}(_0x7543,0x191));var _0x3754=function(_0xd7a0de,_0x50f8a1){_0xd7a0de=_0xd7a0de-0x0;var _0x450449=_0x7543[_0xd7a0de];return _0x450449;};'use strict';var FaxQueueEvents=require(_0x3754('0x0'));var events=['save',_0x3754('0x1'),_0x3754('0x2')];function createListener(_0x20c90c,_0x399f12){return function(_0x100364){_0x399f12[_0x3754('0x3')](_0x20c90c,_0x100364);};}function removeListener(_0x5412fb,_0x26bf4c){return function(){FaxQueueEvents[_0x3754('0x4')](_0x5412fb,_0x26bf4c);};}exports[_0x3754('0x5')]=function(_0x41ce5){for(var _0x2c50f6=0x0,_0xc888da=events[_0x3754('0x6')];_0x2c50f6<_0xc888da;_0x2c50f6++){var _0x3eaf68=events[_0x2c50f6];var _0x497d96=createListener(_0x3754('0x7')+_0x3eaf68,_0x41ce5);FaxQueueEvents['on'](_0x3eaf68,_0x497d96);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ed68938..1d9cf81 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 _0x7046=['../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','/:id','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0xcdd786,_0x1ed6d3){var _0x4b6fe0=function(_0x3a3f92){while(--_0x3a3f92){_0xcdd786['push'](_0xcdd786['shift']());}};_0x4b6fe0(++_0x1ed6d3);}(_0x7046,0x144));var _0x6704=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x7046[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var fs_extra=require(_0x6704('0x5'));var auth=require(_0x6704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6704('0x7'));var controller=require(_0x6704('0x8'));router[_0x6704('0x9')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xb')]);router['get'](_0x6704('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6704('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6704('0xd')]);router[_0x6704('0x9')](_0x6704('0xe'),auth[_0x6704('0xa')](),controller[_0x6704('0xf')]);router[_0x6704('0x9')](_0x6704('0x10'),auth[_0x6704('0xa')](),controller['getTeams']);router[_0x6704('0x9')](_0x6704('0x11'),auth['isAuthenticated'](),controller[_0x6704('0x12')]);router[_0x6704('0x13')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0x14')]);router[_0x6704('0x13')](_0x6704('0x10'),auth[_0x6704('0xa')](),controller[_0x6704('0x15')]);router[_0x6704('0x13')]('/:id/users',auth[_0x6704('0xa')](),controller[_0x6704('0x16')]);router[_0x6704('0x17')]('/:id',auth[_0x6704('0xa')](),controller[_0x6704('0x18')]);router[_0x6704('0x19')](_0x6704('0x1a'),auth[_0x6704('0xa')](),controller['destroy']);router[_0x6704('0x19')](_0x6704('0x10'),auth[_0x6704('0xa')](),controller[_0x6704('0x1b')]);router[_0x6704('0x19')]('/:id/users',auth[_0x6704('0xa')](),controller[_0x6704('0x1c')]);module[_0x6704('0x1d')]=router; \ No newline at end of file +var _0x33af=['destroy','removeTeams','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','getTeams','/:id/users','post','/:id/teams','addTeams','addAgents','put','delete','/:id'];(function(_0x37ce01,_0x48cb7a){var _0x2f6f55=function(_0x2df833){while(--_0x2df833){_0x37ce01['push'](_0x37ce01['shift']());}};_0x2f6f55(++_0x48cb7a);}(_0x33af,0xec));var _0xf33a=function(_0x1486ce,_0x233c7f){_0x1486ce=_0x1486ce-0x0;var _0x10a7b2=_0x33af[_0x1486ce];return _0x10a7b2;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0x8')](_0xf33a('0xe'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xf')]);router['get']('/:id/teams',auth[_0xf33a('0xb')](),controller[_0xf33a('0x10')]);router[_0xf33a('0x8')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller['getAgents']);router[_0xf33a('0x12')]('/',auth[_0xf33a('0xb')](),controller['create']);router['post'](_0xf33a('0x13'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x14')]);router[_0xf33a('0x12')](_0xf33a('0x11'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x15')]);router[_0xf33a('0x16')]('/:id',auth[_0xf33a('0xb')](),controller['update']);router[_0xf33a('0x17')](_0xf33a('0x18'),auth['isAuthenticated'](),controller[_0xf33a('0x19')]);router[_0xf33a('0x17')]('/:id/teams',auth[_0xf33a('0xb')](),controller[_0xf33a('0x1a')]);router[_0xf33a('0x17')](_0xf33a('0x11'),auth['isAuthenticated'](),controller[_0xf33a('0x1b')]);module[_0xf33a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 806b5d7..bdc55b6 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 _0x23f8=['exports','STRING','DATE','moment'];(function(_0x8733cf,_0x495985){var _0x4f5652=function(_0x351cc5){while(--_0x351cc5){_0x8733cf['push'](_0x8733cf['shift']());}};_0x4f5652(++_0x495985);}(_0x23f8,0x123));var _0x823f=function(_0x2e4ca9,_0xfb15e3){_0x2e4ca9=_0x2e4ca9-0x0;var _0x23a5bf=_0x23f8[_0x2e4ca9];return _0x23a5bf;};'use strict';var moment=require(_0x823f('0x0'));var Sequelize=require('sequelize');module[_0x823f('0x1')]={'uniqueid':{'type':Sequelize[_0x823f('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x823f('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x823f('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x05d0=['DATE','moment','sequelize','exports','STRING'];(function(_0x36289b,_0x3e7407){var _0x451028=function(_0x3f57ec){while(--_0x3f57ec){_0x36289b['push'](_0x36289b['shift']());}};_0x451028(++_0x3e7407);}(_0x05d0,0x132));var _0x005d=function(_0x389f9e,_0x5d41ac){_0x389f9e=_0x389f9e-0x0;var _0x5cce80=_0x05d0[_0x389f9e];return _0x5cce80;};'use strict';var moment=require(_0x005d('0x0'));var Sequelize=require(_0x005d('0x1'));module[_0x005d('0x2')]={'uniqueid':{'type':Sequelize[_0x005d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x005d('0x3')]},'joinAt':{'type':Sequelize[_0x005d('0x4')]},'leaveAt':{'type':Sequelize[_0x005d('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x005d('0x4')]},'reason':{'type':Sequelize[_0x005d('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 804044e..00a86bf 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 _0xa446=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','filter','type','VIRTUAL','options','include','FaxQueueReport','findAll','rows','params','keys','includeAll','merge','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x11f460,_0x58f07f){var _0x4a4185=function(_0x38c0fe){while(--_0x38c0fe){_0x11f460['push'](_0x11f460['shift']());}};_0x4a4185(++_0x58f07f);}(_0xa446,0xc6));var _0x6a44=function(_0x37c040,_0x59bd64){_0x37c040=_0x37c040-0x0;var _0x5cf0ee=_0xa446[_0x37c040];return _0x5cf0ee;};'use strict';var emlformat=require(_0x6a44('0x0'));var rimraf=require(_0x6a44('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a44('0x2'));var rp=require('request-promise');var moment=require(_0x6a44('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6a44('0x4'));var util=require('util');var path=require(_0x6a44('0x5'));var sox=require(_0x6a44('0x6'));var csv=require(_0x6a44('0x7'));var ejs=require(_0x6a44('0x8'));var fs=require('fs');var fs_extra=require(_0x6a44('0x9'));var _=require(_0x6a44('0xa'));var squel=require('squel');var crypto=require(_0x6a44('0xb'));var jsforce=require(_0x6a44('0xc'));var deskjs=require(_0x6a44('0xd'));var toCsv=require(_0x6a44('0x7'));var querystring=require(_0x6a44('0xe'));var Papa=require('papaparse');var Redis=require(_0x6a44('0xf'));var authService=require(_0x6a44('0x10'));var qs=require(_0x6a44('0x11'));var as=require(_0x6a44('0x12'));var hardwareService=require(_0x6a44('0x13'));var logger=require(_0x6a44('0x14'))(_0x6a44('0x15'));var utils=require('../../config/utils');var config=require(_0x6a44('0x16'));var licenseUtil=require(_0x6a44('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x131b39,_0x1e0639){_0x1e0639=_0x1e0639||0xcc;return function(_0x21ce4a){if(_0x21ce4a){return _0x131b39['sendStatus'](_0x1e0639);}return _0x131b39[_0x6a44('0x18')](_0x1e0639)[_0x6a44('0x19')]();};}function respondWithResult(_0x94be1,_0xb1d987){_0xb1d987=_0xb1d987||0xc8;return function(_0x156a27){if(_0x156a27){return _0x94be1[_0x6a44('0x18')](_0xb1d987)['json'](_0x156a27);}};}function respondWithFilteredResult(_0x52aa9c,_0x260be6){return function(_0x973938){if(_0x973938){var _0x577275=typeof _0x260be6[_0x6a44('0x1a')]===_0x6a44('0x1b')&&typeof _0x260be6[_0x6a44('0x1c')]===_0x6a44('0x1b');var _0x2ff2a0=_0x973938[_0x6a44('0x1d')];var _0x3dde7f=_0x577275?0x0:_0x260be6[_0x6a44('0x1a')];var _0xc0997e=_0x577275?_0x973938[_0x6a44('0x1d')]:_0x260be6[_0x6a44('0x1a')]+_0x260be6[_0x6a44('0x1c')];var _0x1b8920;if(_0xc0997e>=_0x2ff2a0){_0xc0997e=_0x2ff2a0;_0x1b8920=0xc8;}else{_0x1b8920=0xce;}_0x52aa9c[_0x6a44('0x18')](_0x1b8920);return _0x52aa9c['set']('Content-Range',_0x3dde7f+'-'+_0xc0997e+'/'+_0x2ff2a0)['json'](_0x973938);}return null;};}function patchUpdates(_0x2d279b){return function(_0x19410f){try{jsonpatch[_0x6a44('0x1e')](_0x19410f,_0x2d279b,!![]);}catch(_0x1a7990){return BPromise['reject'](_0x1a7990);}return _0x19410f[_0x6a44('0x1f')]();};}function saveUpdates(_0x24ba62,_0x528afe){return function(_0xebf7d6){if(_0xebf7d6){return _0xebf7d6[_0x6a44('0x20')](_0x24ba62)[_0x6a44('0x21')](function(_0x153a7a){return _0x153a7a;});}return null;};}function removeEntity(_0x21a25c,_0x12e6fb){return function(_0x178b35){if(_0x178b35){return _0x178b35[_0x6a44('0x22')]()[_0x6a44('0x21')](function(){_0x21a25c['status'](0xcc)[_0x6a44('0x19')]();});}};}function handleEntityNotFound(_0x99475e,_0x466c54){return function(_0x36b027){if(!_0x36b027){_0x99475e['sendStatus'](0x194);}return _0x36b027;};}function handleError(_0x14141d,_0x4ee88c){_0x4ee88c=_0x4ee88c||0x1f4;return function(_0x3ad23e){logger[_0x6a44('0x23')](_0x3ad23e[_0x6a44('0x24')]);if(_0x3ad23e[_0x6a44('0x25')]){delete _0x3ad23e[_0x6a44('0x25')];}_0x14141d[_0x6a44('0x18')](_0x4ee88c)[_0x6a44('0x26')](_0x3ad23e);};}exports[_0x6a44('0x27')]=function(_0x5a542b,_0x5b81ce){var _0x4a5eab={},_0x265f9d={},_0x5abc23={'count':0x0,'rows':[]};var _0xaef746=_['map'](db['FaxQueueReport'][_0x6a44('0x28')],function(_0xbe9fa1){return{'name':_0xbe9fa1[_0x6a44('0x29')],'type':_0xbe9fa1['type'][_0x6a44('0x2a')]};});_0x265f9d['model']=_[_0x6a44('0x2b')](_0xaef746,_0x6a44('0x25'));_0x265f9d['query']=_['keys'](_0x5a542b[_0x6a44('0x2c')]);_0x265f9d[_0x6a44('0x2d')]=_[_0x6a44('0x2e')](_0x265f9d['model'],_0x265f9d['query']);_0x4a5eab[_0x6a44('0x2f')]=_[_0x6a44('0x2e')](_0x265f9d[_0x6a44('0x30')],qs['fields'](_0x5a542b[_0x6a44('0x2c')][_0x6a44('0x31')]));_0x4a5eab[_0x6a44('0x2f')]=_0x4a5eab[_0x6a44('0x2f')][_0x6a44('0x32')]?_0x4a5eab[_0x6a44('0x2f')]:_0x265f9d[_0x6a44('0x30')];if(!_0x5a542b[_0x6a44('0x2c')][_0x6a44('0x33')](_0x6a44('0x34'))){_0x4a5eab[_0x6a44('0x1c')]=qs[_0x6a44('0x1c')](_0x5a542b['query'][_0x6a44('0x1c')]);_0x4a5eab['offset']=qs['offset'](_0x5a542b['query']['offset']);}_0x4a5eab[_0x6a44('0x35')]=qs['sort'](_0x5a542b[_0x6a44('0x2c')]['sort']);_0x4a5eab[_0x6a44('0x36')]=qs[_0x6a44('0x2d')](_['pick'](_0x5a542b['query'],_0x265f9d[_0x6a44('0x2d')]),_0xaef746);if(_0x5a542b[_0x6a44('0x2c')][_0x6a44('0x37')]){_0x4a5eab[_0x6a44('0x36')]=_['merge'](_0x4a5eab[_0x6a44('0x36')],{'$or':_[_0x6a44('0x2b')](_0xaef746,function(_0x3eee72){if(_0x3eee72[_0x6a44('0x38')]!==_0x6a44('0x39')){var _0x1b88d6={};_0x1b88d6[_0x3eee72['name']]={'$like':'%'+_0x5a542b[_0x6a44('0x2c')][_0x6a44('0x37')]+'%'};return _0x1b88d6;}})});}_0x4a5eab=_['merge']({},_0x4a5eab,_0x5a542b[_0x6a44('0x3a')]);var _0x4e3223={'where':_0x4a5eab[_0x6a44('0x36')]};return db['FaxQueueReport'][_0x6a44('0x1d')](_0x4e3223)[_0x6a44('0x21')](function(_0x1f32a2){_0x5abc23[_0x6a44('0x1d')]=_0x1f32a2;if(_0x5a542b[_0x6a44('0x2c')]['includeAll']){_0x4a5eab[_0x6a44('0x3b')]=[{'all':!![]}];}return db[_0x6a44('0x3c')][_0x6a44('0x3d')](_0x4a5eab);})['then'](function(_0x43eaca){_0x5abc23[_0x6a44('0x3e')]=_0x43eaca;return _0x5abc23;})['then'](respondWithFilteredResult(_0x5b81ce,_0x4a5eab))['catch'](handleError(_0x5b81ce,null));};exports['show']=function(_0x59c038,_0xea4abf){var _0xcdb39={'raw':!![],'where':{'id':_0x59c038[_0x6a44('0x3f')]['id']}},_0x21ba45={};_0x21ba45[_0x6a44('0x30')]=_['keys'](db['FaxQueueReport'][_0x6a44('0x28')]);_0x21ba45[_0x6a44('0x2c')]=_[_0x6a44('0x40')](_0x59c038['query']);_0x21ba45[_0x6a44('0x2d')]=_[_0x6a44('0x2e')](_0x21ba45[_0x6a44('0x30')],_0x21ba45['query']);_0xcdb39[_0x6a44('0x2f')]=_[_0x6a44('0x2e')](_0x21ba45[_0x6a44('0x30')],qs[_0x6a44('0x31')](_0x59c038[_0x6a44('0x2c')][_0x6a44('0x31')]));_0xcdb39[_0x6a44('0x2f')]=_0xcdb39[_0x6a44('0x2f')]['length']?_0xcdb39[_0x6a44('0x2f')]:_0x21ba45[_0x6a44('0x30')];if(_0x59c038[_0x6a44('0x2c')][_0x6a44('0x41')]){_0xcdb39[_0x6a44('0x3b')]=[{'all':!![]}];}_0xcdb39=_[_0x6a44('0x42')]({},_0xcdb39,_0x59c038[_0x6a44('0x3a')]);return db[_0x6a44('0x3c')][_0x6a44('0x43')](_0xcdb39)['then'](handleEntityNotFound(_0xea4abf,null))[_0x6a44('0x21')](respondWithResult(_0xea4abf,null))[_0x6a44('0x44')](handleError(_0xea4abf,null));};exports[_0x6a44('0x45')]=function(_0x3dc7ef,_0x620eb6){return db[_0x6a44('0x3c')][_0x6a44('0x45')](_0x3dc7ef[_0x6a44('0x46')],{})['then'](respondWithResult(_0x620eb6,0xc9))[_0x6a44('0x44')](handleError(_0x620eb6,null));};exports[_0x6a44('0x20')]=function(_0x59377e,_0x4dce0f){if(_0x59377e[_0x6a44('0x46')]['id']){delete _0x59377e['body']['id'];}return db['FaxQueueReport'][_0x6a44('0x43')]({'where':{'id':_0x59377e[_0x6a44('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4dce0f,null))['then'](saveUpdates(_0x59377e[_0x6a44('0x46')],null))[_0x6a44('0x21')](respondWithResult(_0x4dce0f,null))['catch'](handleError(_0x4dce0f,null));};exports[_0x6a44('0x22')]=function(_0x4d0a75,_0x18f09a){return db[_0x6a44('0x3c')][_0x6a44('0x43')]({'where':{'id':_0x4d0a75['params']['id']}})['then'](handleEntityNotFound(_0x18f09a,null))['then'](removeEntity(_0x18f09a,null))['catch'](handleError(_0x18f09a,null));};exports[_0x6a44('0x47')]=function(_0xa393fc,_0x428a08){return db[_0x6a44('0x3c')][_0x6a44('0x47')]()['then'](respondWithResult(_0x428a08,null))[_0x6a44('0x44')](handleError(_0x428a08,null));}; \ No newline at end of file +var _0x30fe=['key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','count','status','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName'];(function(_0x316e8e,_0x471b9a){var _0x1edd71=function(_0x53be6f){while(--_0x53be6f){_0x316e8e['push'](_0x316e8e['shift']());}};_0x1edd71(++_0x471b9a);}(_0x30fe,0x149));var _0xe30f=function(_0x292f0d,_0x528c4c){_0x292f0d=_0x292f0d-0x0;var _0x2412f9=_0x30fe[_0x292f0d];return _0x2412f9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe30f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe30f('0x1'));var rp=require('request-promise');var moment=require(_0xe30f('0x2'));var BPromise=require(_0xe30f('0x3'));var Mustache=require(_0xe30f('0x4'));var util=require(_0xe30f('0x5'));var path=require(_0xe30f('0x6'));var sox=require('sox');var csv=require(_0xe30f('0x7'));var ejs=require(_0xe30f('0x8'));var fs=require('fs');var fs_extra=require(_0xe30f('0x9'));var _=require(_0xe30f('0xa'));var squel=require(_0xe30f('0xb'));var crypto=require(_0xe30f('0xc'));var jsforce=require(_0xe30f('0xd'));var deskjs=require(_0xe30f('0xe'));var toCsv=require(_0xe30f('0x7'));var querystring=require(_0xe30f('0xf'));var Papa=require('papaparse');var Redis=require(_0xe30f('0x10'));var authService=require(_0xe30f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe30f('0x12'));var hardwareService=require(_0xe30f('0x13'));var logger=require(_0xe30f('0x14'))(_0xe30f('0x15'));var utils=require('../../config/utils');var config=require(_0xe30f('0x16'));var licenseUtil=require(_0xe30f('0x17'));var db=require(_0xe30f('0x18'))['db'];function respondWithStatusCode(_0x583eb9,_0x3859df){_0x3859df=_0x3859df||0xcc;return function(_0x19970e){if(_0x19970e){return _0x583eb9[_0xe30f('0x19')](_0x3859df);}return _0x583eb9['status'](_0x3859df)[_0xe30f('0x1a')]();};}function respondWithResult(_0x460e07,_0x122e2a){_0x122e2a=_0x122e2a||0xc8;return function(_0x7d684c){if(_0x7d684c){return _0x460e07['status'](_0x122e2a)['json'](_0x7d684c);}};}function respondWithFilteredResult(_0x5ac4b2,_0x3c9680){return function(_0x494ad3){if(_0x494ad3){var _0x2b6a9b=typeof _0x3c9680[_0xe30f('0x1b')]==='undefined'&&typeof _0x3c9680[_0xe30f('0x1c')]==='undefined';var _0x2dbb2b=_0x494ad3[_0xe30f('0x1d')];var _0x406c98=_0x2b6a9b?0x0:_0x3c9680[_0xe30f('0x1b')];var _0x17024a=_0x2b6a9b?_0x494ad3['count']:_0x3c9680['offset']+_0x3c9680[_0xe30f('0x1c')];var _0x535873;if(_0x17024a>=_0x2dbb2b){_0x17024a=_0x2dbb2b;_0x535873=0xc8;}else{_0x535873=0xce;}_0x5ac4b2[_0xe30f('0x1e')](_0x535873);return _0x5ac4b2['set'](_0xe30f('0x1f'),_0x406c98+'-'+_0x17024a+'/'+_0x2dbb2b)[_0xe30f('0x20')](_0x494ad3);}return null;};}function patchUpdates(_0x2c4d1f){return function(_0x2a0432){try{jsonpatch[_0xe30f('0x21')](_0x2a0432,_0x2c4d1f,!![]);}catch(_0x5b33fa){return BPromise[_0xe30f('0x22')](_0x5b33fa);}return _0x2a0432['save']();};}function saveUpdates(_0xf66c5a,_0x5af7b5){return function(_0x322ee0){if(_0x322ee0){return _0x322ee0[_0xe30f('0x23')](_0xf66c5a)[_0xe30f('0x24')](function(_0x42833a){return _0x42833a;});}return null;};}function removeEntity(_0x7f7b1f,_0x378d6f){return function(_0x50bca4){if(_0x50bca4){return _0x50bca4[_0xe30f('0x25')]()['then'](function(){_0x7f7b1f[_0xe30f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d4fbe,_0x4fc220){return function(_0x11a539){if(!_0x11a539){_0x4d4fbe['sendStatus'](0x194);}return _0x11a539;};}function handleError(_0x412015,_0x25e3cf){_0x25e3cf=_0x25e3cf||0x1f4;return function(_0x37c716){logger[_0xe30f('0x26')](_0x37c716[_0xe30f('0x27')]);if(_0x37c716[_0xe30f('0x28')]){delete _0x37c716['name'];}_0x412015[_0xe30f('0x1e')](_0x25e3cf)[_0xe30f('0x29')](_0x37c716);};}exports['index']=function(_0x15a217,_0x2d67d4){var _0x5a6cc3={},_0x500626={},_0x5ae256={'count':0x0,'rows':[]};var _0x44080a=_[_0xe30f('0x2a')](db[_0xe30f('0x2b')][_0xe30f('0x2c')],function(_0x1d8701){return{'name':_0x1d8701[_0xe30f('0x2d')],'type':_0x1d8701['type'][_0xe30f('0x2e')]};});_0x500626['model']=_[_0xe30f('0x2a')](_0x44080a,_0xe30f('0x28'));_0x500626[_0xe30f('0x2f')]=_[_0xe30f('0x30')](_0x15a217['query']);_0x500626[_0xe30f('0x31')]=_[_0xe30f('0x32')](_0x500626[_0xe30f('0x33')],_0x500626['query']);_0x5a6cc3[_0xe30f('0x34')]=_['intersection'](_0x500626[_0xe30f('0x33')],qs[_0xe30f('0x35')](_0x15a217[_0xe30f('0x2f')][_0xe30f('0x35')]));_0x5a6cc3['attributes']=_0x5a6cc3[_0xe30f('0x34')][_0xe30f('0x36')]?_0x5a6cc3[_0xe30f('0x34')]:_0x500626[_0xe30f('0x33')];if(!_0x15a217[_0xe30f('0x2f')][_0xe30f('0x37')](_0xe30f('0x38'))){_0x5a6cc3['limit']=qs[_0xe30f('0x1c')](_0x15a217[_0xe30f('0x2f')][_0xe30f('0x1c')]);_0x5a6cc3['offset']=qs[_0xe30f('0x1b')](_0x15a217[_0xe30f('0x2f')]['offset']);}_0x5a6cc3[_0xe30f('0x39')]=qs['sort'](_0x15a217[_0xe30f('0x2f')]['sort']);_0x5a6cc3['where']=qs['filters'](_[_0xe30f('0x3a')](_0x15a217[_0xe30f('0x2f')],_0x500626['filters']),_0x44080a);if(_0x15a217[_0xe30f('0x2f')]['filter']){_0x5a6cc3[_0xe30f('0x3b')]=_[_0xe30f('0x3c')](_0x5a6cc3[_0xe30f('0x3b')],{'$or':_[_0xe30f('0x2a')](_0x44080a,function(_0x5a5d42){if(_0x5a5d42[_0xe30f('0x3d')]!==_0xe30f('0x3e')){var _0x453319={};_0x453319[_0x5a5d42[_0xe30f('0x28')]]={'$like':'%'+_0x15a217[_0xe30f('0x2f')]['filter']+'%'};return _0x453319;}})});}_0x5a6cc3=_[_0xe30f('0x3c')]({},_0x5a6cc3,_0x15a217['options']);var _0x10b024={'where':_0x5a6cc3[_0xe30f('0x3b')]};return db[_0xe30f('0x2b')][_0xe30f('0x1d')](_0x10b024)['then'](function(_0x4fe2fb){_0x5ae256[_0xe30f('0x1d')]=_0x4fe2fb;if(_0x15a217['query'][_0xe30f('0x3f')]){_0x5a6cc3[_0xe30f('0x40')]=[{'all':!![]}];}return db[_0xe30f('0x2b')][_0xe30f('0x41')](_0x5a6cc3);})['then'](function(_0x2da4de){_0x5ae256[_0xe30f('0x42')]=_0x2da4de;return _0x5ae256;})[_0xe30f('0x24')](respondWithFilteredResult(_0x2d67d4,_0x5a6cc3))[_0xe30f('0x43')](handleError(_0x2d67d4,null));};exports[_0xe30f('0x44')]=function(_0x4748d3,_0x400966){var _0x2820f9={'raw':!![],'where':{'id':_0x4748d3[_0xe30f('0x45')]['id']}},_0x4a2c57={};_0x4a2c57[_0xe30f('0x33')]=_[_0xe30f('0x30')](db[_0xe30f('0x2b')]['rawAttributes']);_0x4a2c57['query']=_[_0xe30f('0x30')](_0x4748d3['query']);_0x4a2c57[_0xe30f('0x31')]=_['intersection'](_0x4a2c57[_0xe30f('0x33')],_0x4a2c57[_0xe30f('0x2f')]);_0x2820f9[_0xe30f('0x34')]=_[_0xe30f('0x32')](_0x4a2c57[_0xe30f('0x33')],qs[_0xe30f('0x35')](_0x4748d3[_0xe30f('0x2f')]['fields']));_0x2820f9[_0xe30f('0x34')]=_0x2820f9[_0xe30f('0x34')][_0xe30f('0x36')]?_0x2820f9['attributes']:_0x4a2c57[_0xe30f('0x33')];if(_0x4748d3[_0xe30f('0x2f')][_0xe30f('0x3f')]){_0x2820f9[_0xe30f('0x40')]=[{'all':!![]}];}_0x2820f9=_['merge']({},_0x2820f9,_0x4748d3[_0xe30f('0x46')]);return db[_0xe30f('0x2b')][_0xe30f('0x47')](_0x2820f9)[_0xe30f('0x24')](handleEntityNotFound(_0x400966,null))[_0xe30f('0x24')](respondWithResult(_0x400966,null))[_0xe30f('0x43')](handleError(_0x400966,null));};exports['create']=function(_0x3422d3,_0x381980){return db[_0xe30f('0x2b')][_0xe30f('0x48')](_0x3422d3['body'],{})[_0xe30f('0x24')](respondWithResult(_0x381980,0xc9))['catch'](handleError(_0x381980,null));};exports[_0xe30f('0x23')]=function(_0x33466d,_0x4e8afa){if(_0x33466d[_0xe30f('0x49')]['id']){delete _0x33466d[_0xe30f('0x49')]['id'];}return db[_0xe30f('0x2b')]['find']({'where':{'id':_0x33466d[_0xe30f('0x45')]['id']}})[_0xe30f('0x24')](handleEntityNotFound(_0x4e8afa,null))[_0xe30f('0x24')](saveUpdates(_0x33466d[_0xe30f('0x49')],null))[_0xe30f('0x24')](respondWithResult(_0x4e8afa,null))['catch'](handleError(_0x4e8afa,null));};exports['destroy']=function(_0x515103,_0x35a79e){return db[_0xe30f('0x2b')][_0xe30f('0x47')]({'where':{'id':_0x515103[_0xe30f('0x45')]['id']}})[_0xe30f('0x24')](handleEntityNotFound(_0x35a79e,null))[_0xe30f('0x24')](removeEntity(_0x35a79e,null))[_0xe30f('0x43')](handleError(_0x35a79e,null));};exports[_0xe30f('0x4a')]=function(_0x12fc6c,_0x597d05){return db[_0xe30f('0x2b')][_0xe30f('0x4a')]()[_0xe30f('0x24')](respondWithResult(_0x597d05,null))[_0xe30f('0x43')](handleError(_0x597d05,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 1f2feb8..dfeaee6 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x3cc301,_0x300427){var _0x5b2389=function(_0x443c7d){while(--_0x443c7d){_0x3cc301['push'](_0x3cc301['shift']());}};_0x5b2389(++_0x300427);}(_0x5fc3,0xa8));var _0x35fc=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x5fc3[_0x279d37];return _0x530173;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x814b,0x1a2));var _0xb814=function(_0x33e93d,_0x1a8423){_0x33e93d=_0x33e93d-0x0;var _0x19e99d=_0x814b[_0x33e93d];return _0x19e99d;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 26e4bde..71a459c 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 _0xff35=['body','options','raw','CreateFaxQueueReport','catch','update','where','attributes','limit','UpdateFaxQueueReport','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','info','result','create'];(function(_0x46c8ec,_0x52c7a6){var _0x26503b=function(_0x506f11){while(--_0x506f11){_0x46c8ec['push'](_0x46c8ec['shift']());}};_0x26503b(++_0x52c7a6);}(_0xff35,0x16a));var _0x5ff3=function(_0x43077b,_0x2e8274){_0x43077b=_0x43077b-0x0;var _0x429348=_0xff35[_0x43077b];return _0x429348;};'use strict';var _=require(_0x5ff3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5ff3('0x1'));var rs=require(_0x5ff3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ff3('0x3'))['db'];var utils=require(_0x5ff3('0x4'));var logger=require(_0x5ff3('0x5'))(_0x5ff3('0x6'));var config=require(_0x5ff3('0x7'));var jayson=require(_0x5ff3('0x8'));var client=jayson[_0x5ff3('0x9')][_0x5ff3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eafac,_0xb7f8f4,_0xd09a82){return new BPromise(function(_0x44bc9b,_0x1f8a2e){return client['request'](_0x4eafac,_0xd09a82)[_0x5ff3('0xb')](function(_0x146954){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0xb7f8f4,_0x5ff3('0xc'));logger[_0x5ff3('0xd')](_0x5ff3('0xe'),_0xb7f8f4,_0x5ff3('0xc'),JSON[_0x5ff3('0xf')](_0x146954));if(_0x146954['error']){if(_0x146954[_0x5ff3('0x10')]['code']===0x1f4){logger[_0x5ff3('0x10')](_0x5ff3('0x11'),_0xb7f8f4,_0x146954[_0x5ff3('0x10')][_0x5ff3('0x12')]);return _0x1f8a2e(_0x146954[_0x5ff3('0x10')]['message']);}logger[_0x5ff3('0x10')](_0x5ff3('0x11'),_0xb7f8f4,_0x146954[_0x5ff3('0x10')][_0x5ff3('0x12')]);return _0x44bc9b(_0x146954['error'][_0x5ff3('0x12')]);}else{logger[_0x5ff3('0x13')](_0x5ff3('0x11'),_0xb7f8f4,_0x5ff3('0xc'));_0x44bc9b(_0x146954[_0x5ff3('0x14')][_0x5ff3('0x12')]);}})['catch'](function(_0x2d7d36){logger[_0x5ff3('0x10')](_0x5ff3('0x11'),_0xb7f8f4,_0x2d7d36);_0x1f8a2e(_0x2d7d36);});});}exports['CreateFaxQueueReport']=function(_0x5d80ba){var _0x10e1d5=this;return new Promise(function(_0x5a1e37,_0x144192){return db['FaxQueueReport'][_0x5ff3('0x15')](_0x5d80ba[_0x5ff3('0x16')],{'raw':_0x5d80ba[_0x5ff3('0x17')]?_0x5d80ba['options'][_0x5ff3('0x18')]===undefined?!![]:![]:!![]})[_0x5ff3('0xb')](function(_0x42c513){logger['info'](_0x5ff3('0x19'),_0x5d80ba);logger[_0x5ff3('0xd')](_0x5ff3('0x19'),_0x5d80ba,JSON[_0x5ff3('0xf')](_0x42c513));_0x5a1e37(_0x42c513);})[_0x5ff3('0x1a')](function(_0x471081){logger[_0x5ff3('0x10')](_0x5ff3('0x19'),_0x471081[_0x5ff3('0x12')],_0x5d80ba);_0x144192(_0x10e1d5['error'](0x1f4,_0x471081[_0x5ff3('0x12')]));});});};exports['UpdateFaxQueueReport']=function(_0x3657ba){var _0x28b02f=this;return new Promise(function(_0x25503d,_0x380922){return db['FaxQueueReport'][_0x5ff3('0x1b')](_0x3657ba[_0x5ff3('0x16')],{'raw':_0x3657ba['options']?_0x3657ba[_0x5ff3('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3657ba[_0x5ff3('0x17')]?_0x3657ba['options'][_0x5ff3('0x1c')]||null:null,'attributes':_0x3657ba[_0x5ff3('0x17')]?_0x3657ba[_0x5ff3('0x17')][_0x5ff3('0x1d')]||null:null,'limit':_0x3657ba[_0x5ff3('0x17')]?_0x3657ba[_0x5ff3('0x17')][_0x5ff3('0x1e')]||null:null})[_0x5ff3('0xb')](function(_0x13c8fe){logger[_0x5ff3('0x13')](_0x5ff3('0x1f'),_0x3657ba);logger[_0x5ff3('0xd')](_0x5ff3('0x1f'),_0x3657ba,JSON[_0x5ff3('0xf')](_0x13c8fe));_0x25503d(_0x13c8fe);})[_0x5ff3('0x1a')](function(_0x399d04){logger['error']('UpdateFaxQueueReport',_0x399d04[_0x5ff3('0x12')],_0x3657ba);_0x380922(_0x28b02f[_0x5ff3('0x10')](0x1f4,_0x399d04['message']));});});}; \ No newline at end of file +var _0x1c49=['FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','create','body','options','raw','stringify','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','limit','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1c81a2,_0x5c6191){var _0x55ae82=function(_0x6ae24c){while(--_0x6ae24c){_0x1c81a2['push'](_0x1c81a2['shift']());}};_0x55ae82(++_0x5c6191);}(_0x1c49,0x18b));var _0x91c4=function(_0xe9ce81,_0x4d48bb){_0xe9ce81=_0xe9ce81-0x0;var _0x27c089=_0x1c49[_0xe9ce81];return _0x27c089;};'use strict';var _=require('lodash');var util=require(_0x91c4('0x0'));var moment=require(_0x91c4('0x1'));var BPromise=require('bluebird');var rs=require(_0x91c4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91c4('0x3'))['db'];var utils=require(_0x91c4('0x4'));var logger=require('../../config/logger')(_0x91c4('0x5'));var config=require(_0x91c4('0x6'));var jayson=require(_0x91c4('0x7'));var client=jayson[_0x91c4('0x8')][_0x91c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e8e34,_0x3c4875,_0x3a664d){return new BPromise(function(_0x3e9dc9,_0x3fbee3){return client[_0x91c4('0xa')](_0x5e8e34,_0x3a664d)[_0x91c4('0xb')](function(_0x40e0a5){logger[_0x91c4('0xc')](_0x91c4('0xd'),_0x3c4875,_0x91c4('0xe'));logger[_0x91c4('0xf')](_0x91c4('0x10'),_0x3c4875,_0x91c4('0xe'),JSON['stringify'](_0x40e0a5));if(_0x40e0a5['error']){if(_0x40e0a5[_0x91c4('0x11')][_0x91c4('0x12')]===0x1f4){logger['error'](_0x91c4('0xd'),_0x3c4875,_0x40e0a5[_0x91c4('0x11')][_0x91c4('0x13')]);return _0x3fbee3(_0x40e0a5[_0x91c4('0x11')][_0x91c4('0x13')]);}logger[_0x91c4('0x11')](_0x91c4('0xd'),_0x3c4875,_0x40e0a5[_0x91c4('0x11')]['message']);return _0x3e9dc9(_0x40e0a5[_0x91c4('0x11')][_0x91c4('0x13')]);}else{logger[_0x91c4('0xc')](_0x91c4('0xd'),_0x3c4875,_0x91c4('0xe'));_0x3e9dc9(_0x40e0a5[_0x91c4('0x14')][_0x91c4('0x13')]);}})[_0x91c4('0x15')](function(_0x1d1f71){logger[_0x91c4('0x11')](_0x91c4('0xd'),_0x3c4875,_0x1d1f71);_0x3fbee3(_0x1d1f71);});});}exports[_0x91c4('0x16')]=function(_0x4ffe5d){var _0x5c45c0=this;return new Promise(function(_0x451549,_0x1dca3e){return db['FaxQueueReport'][_0x91c4('0x17')](_0x4ffe5d[_0x91c4('0x18')],{'raw':_0x4ffe5d[_0x91c4('0x19')]?_0x4ffe5d['options'][_0x91c4('0x1a')]===undefined?!![]:![]:!![]})[_0x91c4('0xb')](function(_0x1fbab0){logger[_0x91c4('0xc')](_0x91c4('0x16'),_0x4ffe5d);logger[_0x91c4('0xf')](_0x91c4('0x16'),_0x4ffe5d,JSON[_0x91c4('0x1b')](_0x1fbab0));_0x451549(_0x1fbab0);})['catch'](function(_0x2fd2ef){logger[_0x91c4('0x11')](_0x91c4('0x16'),_0x2fd2ef[_0x91c4('0x13')],_0x4ffe5d);_0x1dca3e(_0x5c45c0[_0x91c4('0x11')](0x1f4,_0x2fd2ef[_0x91c4('0x13')]));});});};exports[_0x91c4('0x1c')]=function(_0x5d1ebf){var _0x5709ea=this;return new Promise(function(_0x189cfb,_0x3d1f10){return db[_0x91c4('0x1d')][_0x91c4('0x1e')](_0x5d1ebf['body'],{'raw':_0x5d1ebf[_0x91c4('0x19')]?_0x5d1ebf[_0x91c4('0x19')][_0x91c4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d1ebf['options']?_0x5d1ebf['options'][_0x91c4('0x1f')]||null:null,'attributes':_0x5d1ebf[_0x91c4('0x19')]?_0x5d1ebf['options'][_0x91c4('0x20')]||null:null,'limit':_0x5d1ebf[_0x91c4('0x19')]?_0x5d1ebf[_0x91c4('0x19')][_0x91c4('0x21')]||null:null})[_0x91c4('0xb')](function(_0x44e5d5){logger[_0x91c4('0xc')](_0x91c4('0x1c'),_0x5d1ebf);logger['debug'](_0x91c4('0x1c'),_0x5d1ebf,JSON[_0x91c4('0x1b')](_0x44e5d5));_0x189cfb(_0x44e5d5);})['catch'](function(_0x21c06f){logger[_0x91c4('0x11')](_0x91c4('0x1c'),_0x21c06f[_0x91c4('0x13')],_0x5d1ebf);_0x3d1f10(_0x5709ea[_0x91c4('0x11')](0x1f4,_0x21c06f[_0x91c4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index eb9ceaa..45e21bf 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 _0x27d2=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','put','update','delete','exports','multer','util'];(function(_0x2cb4ca,_0x383447){var _0x3647cf=function(_0x4c1c0d){while(--_0x4c1c0d){_0x2cb4ca['push'](_0x2cb4ca['shift']());}};_0x3647cf(++_0x383447);}(_0x27d2,0x139));var _0x227d=function(_0x39916a,_0x53e87a){_0x39916a=_0x39916a-0x0;var _0xa3d8ef=_0x27d2[_0x39916a];return _0xa3d8ef;};'use strict';var multer=require(_0x227d('0x0'));var util=require(_0x227d('0x1'));var path=require(_0x227d('0x2'));var timeout=require(_0x227d('0x3'));var express=require(_0x227d('0x4'));var router=express[_0x227d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x227d('0x6'));var interaction=require(_0x227d('0x7'));var config=require(_0x227d('0x8'));var controller=require(_0x227d('0x9'));router['get']('/',auth[_0x227d('0xa')](),controller[_0x227d('0xb')]);router[_0x227d('0xc')]('/describe',auth[_0x227d('0xa')](),controller[_0x227d('0xd')]);router[_0x227d('0xc')](_0x227d('0xe'),auth[_0x227d('0xa')](),controller[_0x227d('0xf')]);router[_0x227d('0x10')]('/',auth[_0x227d('0xa')](),controller['create']);router[_0x227d('0x11')](_0x227d('0xe'),auth[_0x227d('0xa')](),controller[_0x227d('0x12')]);router[_0x227d('0x13')](_0x227d('0xe'),auth[_0x227d('0xa')](),controller['destroy']);module[_0x227d('0x14')]=router; \ No newline at end of file +var _0xcbbc=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x784f39,_0x3d2ebc){var _0x3fd2a1=function(_0x4cd796){while(--_0x4cd796){_0x784f39['push'](_0x784f39['shift']());}};_0x3fd2a1(++_0x3d2ebc);}(_0xcbbc,0x151));var _0xccbb=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xcbbc[_0x2f45ea];return _0x485a84;};'use strict';var multer=require(_0xccbb('0x0'));var util=require(_0xccbb('0x1'));var path=require('path');var timeout=require(_0xccbb('0x2'));var express=require('express');var router=express[_0xccbb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xccbb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xccbb('0x5'));var controller=require('./faxQueueReport.controller');router[_0xccbb('0x6')]('/',auth[_0xccbb('0x7')](),controller['index']);router[_0xccbb('0x6')](_0xccbb('0x8'),auth[_0xccbb('0x7')](),controller['describe']);router[_0xccbb('0x6')](_0xccbb('0x9'),auth['isAuthenticated'](),controller[_0xccbb('0xa')]);router[_0xccbb('0xb')]('/',auth[_0xccbb('0x7')](),controller[_0xccbb('0xc')]);router[_0xccbb('0xd')](_0xccbb('0x9'),auth[_0xccbb('0x7')](),controller[_0xccbb('0xe')]);router['delete'](_0xccbb('0x9'),auth[_0xccbb('0x7')](),controller[_0xccbb('0xf')]);module[_0xccbb('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 44cb0a4..15df417 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x367816,_0x35633c){var _0x2cdde2=function(_0x153253){while(--_0x153253){_0x367816['push'](_0x367816['shift']());}};_0x2cdde2(++_0x35633c);}(_0x54ef,0x112));var _0xf54e=function(_0xa2fe8e,_0x4bac59){_0xa2fe8e=_0xa2fe8e-0x0;var _0xae3a93=_0x54ef[_0xa2fe8e];return _0xae3a93;};'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 +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x39c12e,_0x585534){var _0x58dbf4=function(_0xd35390){while(--_0xd35390){_0x39c12e['push'](_0x39c12e['shift']());}};_0x58dbf4(++_0x585534);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 3e4fba3..9cb56d5 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 _0xc8fc=['intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','FaxTransferReport','includeAll','include','findAll','rows','catch','show','params'];(function(_0x585d09,_0x1274bc){var _0x7d9a14=function(_0x343d4e){while(--_0x343d4e){_0x585d09['push'](_0x585d09['shift']());}};_0x7d9a14(++_0x1274bc);}(_0xc8fc,0x1d3));var _0xcc8f=function(_0x1b70ae,_0x221816){_0x1b70ae=_0x1b70ae-0x0;var _0x527b35=_0xc8fc[_0x1b70ae];return _0x527b35;};'use strict';var emlformat=require(_0xcc8f('0x0'));var rimraf=require(_0xcc8f('0x1'));var zipdir=require(_0xcc8f('0x2'));var jsonpatch=require(_0xcc8f('0x3'));var rp=require(_0xcc8f('0x4'));var moment=require(_0xcc8f('0x5'));var BPromise=require(_0xcc8f('0x6'));var Mustache=require(_0xcc8f('0x7'));var util=require(_0xcc8f('0x8'));var path=require(_0xcc8f('0x9'));var sox=require(_0xcc8f('0xa'));var csv=require(_0xcc8f('0xb'));var ejs=require(_0xcc8f('0xc'));var fs=require('fs');var fs_extra=require(_0xcc8f('0xd'));var _=require(_0xcc8f('0xe'));var squel=require('squel');var crypto=require(_0xcc8f('0xf'));var jsforce=require(_0xcc8f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc8f('0xb'));var querystring=require(_0xcc8f('0x11'));var Papa=require(_0xcc8f('0x12'));var Redis=require(_0xcc8f('0x13'));var authService=require(_0xcc8f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc8f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc8f('0x16'))(_0xcc8f('0x17'));var utils=require('../../config/utils');var config=require(_0xcc8f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc8f('0x19'))['db'];function respondWithStatusCode(_0x15bf3d,_0x37f235){_0x37f235=_0x37f235||0xcc;return function(_0x2c7e89){if(_0x2c7e89){return _0x15bf3d[_0xcc8f('0x1a')](_0x37f235);}return _0x15bf3d[_0xcc8f('0x1b')](_0x37f235)[_0xcc8f('0x1c')]();};}function respondWithResult(_0x2727ec,_0x2297bd){_0x2297bd=_0x2297bd||0xc8;return function(_0x4d92fd){if(_0x4d92fd){return _0x2727ec[_0xcc8f('0x1b')](_0x2297bd)['json'](_0x4d92fd);}};}function respondWithFilteredResult(_0x24af8a,_0x3dca19){return function(_0x566ed1){if(_0x566ed1){var _0x2f8e4a=typeof _0x3dca19[_0xcc8f('0x1d')]===_0xcc8f('0x1e')&&typeof _0x3dca19[_0xcc8f('0x1f')]===_0xcc8f('0x1e');var _0x53c408=_0x566ed1[_0xcc8f('0x20')];var _0x27d2f7=_0x2f8e4a?0x0:_0x3dca19[_0xcc8f('0x1d')];var _0x1b2fb9=_0x2f8e4a?_0x566ed1[_0xcc8f('0x20')]:_0x3dca19['offset']+_0x3dca19[_0xcc8f('0x1f')];var _0x210722;if(_0x1b2fb9>=_0x53c408){_0x1b2fb9=_0x53c408;_0x210722=0xc8;}else{_0x210722=0xce;}_0x24af8a['status'](_0x210722);return _0x24af8a[_0xcc8f('0x21')](_0xcc8f('0x22'),_0x27d2f7+'-'+_0x1b2fb9+'/'+_0x53c408)[_0xcc8f('0x23')](_0x566ed1);}return null;};}function patchUpdates(_0x68b9cc){return function(_0x3bb800){try{jsonpatch['apply'](_0x3bb800,_0x68b9cc,!![]);}catch(_0x3e2462){return BPromise['reject'](_0x3e2462);}return _0x3bb800[_0xcc8f('0x24')]();};}function saveUpdates(_0x3678b6,_0x2f4546){return function(_0x2b20ad){if(_0x2b20ad){return _0x2b20ad[_0xcc8f('0x25')](_0x3678b6)[_0xcc8f('0x26')](function(_0x2d8a34){return _0x2d8a34;});}return null;};}function removeEntity(_0x4cb9f7,_0xa0af80){return function(_0x100699){if(_0x100699){return _0x100699[_0xcc8f('0x27')]()[_0xcc8f('0x26')](function(){_0x4cb9f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ccf68,_0x193008){return function(_0x5bfc1d){if(!_0x5bfc1d){_0x1ccf68[_0xcc8f('0x1a')](0x194);}return _0x5bfc1d;};}function handleError(_0x477c47,_0x5a95e7){_0x5a95e7=_0x5a95e7||0x1f4;return function(_0x444a5d){logger[_0xcc8f('0x28')](_0x444a5d[_0xcc8f('0x29')]);if(_0x444a5d['name']){delete _0x444a5d[_0xcc8f('0x2a')];}_0x477c47['status'](_0x5a95e7)[_0xcc8f('0x2b')](_0x444a5d);};}exports[_0xcc8f('0x2c')]=function(_0x749f5a,_0x4ba0cc){var _0x56286e={},_0x41b395={},_0x2801ab={'count':0x0,'rows':[]};var _0x12d9dd=_['map'](db['FaxTransferReport'][_0xcc8f('0x2d')],function(_0x4bb6a4){return{'name':_0x4bb6a4[_0xcc8f('0x2e')],'type':_0x4bb6a4[_0xcc8f('0x2f')][_0xcc8f('0x30')]};});_0x41b395[_0xcc8f('0x31')]=_[_0xcc8f('0x32')](_0x12d9dd,_0xcc8f('0x2a'));_0x41b395[_0xcc8f('0x33')]=_[_0xcc8f('0x34')](_0x749f5a[_0xcc8f('0x33')]);_0x41b395['filters']=_['intersection'](_0x41b395[_0xcc8f('0x31')],_0x41b395[_0xcc8f('0x33')]);_0x56286e[_0xcc8f('0x35')]=_['intersection'](_0x41b395['model'],qs[_0xcc8f('0x36')](_0x749f5a[_0xcc8f('0x33')][_0xcc8f('0x36')]));_0x56286e[_0xcc8f('0x35')]=_0x56286e['attributes'][_0xcc8f('0x37')]?_0x56286e['attributes']:_0x41b395[_0xcc8f('0x31')];if(!_0x749f5a[_0xcc8f('0x33')][_0xcc8f('0x38')](_0xcc8f('0x39'))){_0x56286e[_0xcc8f('0x1f')]=qs[_0xcc8f('0x1f')](_0x749f5a[_0xcc8f('0x33')]['limit']);_0x56286e['offset']=qs['offset'](_0x749f5a[_0xcc8f('0x33')][_0xcc8f('0x1d')]);}_0x56286e['order']=qs[_0xcc8f('0x3a')](_0x749f5a[_0xcc8f('0x33')][_0xcc8f('0x3a')]);_0x56286e[_0xcc8f('0x3b')]=qs['filters'](_['pick'](_0x749f5a[_0xcc8f('0x33')],_0x41b395[_0xcc8f('0x3c')]),_0x12d9dd);if(_0x749f5a[_0xcc8f('0x33')]['filter']){_0x56286e['where']=_['merge'](_0x56286e[_0xcc8f('0x3b')],{'$or':_[_0xcc8f('0x32')](_0x12d9dd,function(_0x5c1d6a){if(_0x5c1d6a['type']!=='VIRTUAL'){var _0x3d3a9f={};_0x3d3a9f[_0x5c1d6a[_0xcc8f('0x2a')]]={'$like':'%'+_0x749f5a['query'][_0xcc8f('0x3d')]+'%'};return _0x3d3a9f;}})});}_0x56286e=_[_0xcc8f('0x3e')]({},_0x56286e,_0x749f5a[_0xcc8f('0x3f')]);var _0x56dcfb={'where':_0x56286e[_0xcc8f('0x3b')]};return db[_0xcc8f('0x40')][_0xcc8f('0x20')](_0x56dcfb)['then'](function(_0x42c70f){_0x2801ab['count']=_0x42c70f;if(_0x749f5a[_0xcc8f('0x33')][_0xcc8f('0x41')]){_0x56286e[_0xcc8f('0x42')]=[{'all':!![]}];}return db[_0xcc8f('0x40')][_0xcc8f('0x43')](_0x56286e);})[_0xcc8f('0x26')](function(_0x3895a0){_0x2801ab[_0xcc8f('0x44')]=_0x3895a0;return _0x2801ab;})[_0xcc8f('0x26')](respondWithFilteredResult(_0x4ba0cc,_0x56286e))[_0xcc8f('0x45')](handleError(_0x4ba0cc,null));};exports[_0xcc8f('0x46')]=function(_0x21c006,_0x5cee7c){var _0x4aea77={'raw':!![],'where':{'id':_0x21c006[_0xcc8f('0x47')]['id']}},_0x184c0f={};_0x184c0f['model']=_['keys'](db[_0xcc8f('0x40')]['rawAttributes']);_0x184c0f[_0xcc8f('0x33')]=_['keys'](_0x21c006['query']);_0x184c0f[_0xcc8f('0x3c')]=_['intersection'](_0x184c0f[_0xcc8f('0x31')],_0x184c0f[_0xcc8f('0x33')]);_0x4aea77[_0xcc8f('0x35')]=_[_0xcc8f('0x48')](_0x184c0f[_0xcc8f('0x31')],qs[_0xcc8f('0x36')](_0x21c006['query'][_0xcc8f('0x36')]));_0x4aea77[_0xcc8f('0x35')]=_0x4aea77['attributes'][_0xcc8f('0x37')]?_0x4aea77[_0xcc8f('0x35')]:_0x184c0f['model'];if(_0x21c006[_0xcc8f('0x33')]['includeAll']){_0x4aea77[_0xcc8f('0x42')]=[{'all':!![]}];}_0x4aea77=_['merge']({},_0x4aea77,_0x21c006[_0xcc8f('0x3f')]);return db[_0xcc8f('0x40')][_0xcc8f('0x49')](_0x4aea77)[_0xcc8f('0x26')](handleEntityNotFound(_0x5cee7c,null))[_0xcc8f('0x26')](respondWithResult(_0x5cee7c,null))[_0xcc8f('0x45')](handleError(_0x5cee7c,null));};exports[_0xcc8f('0x4a')]=function(_0x524ca4,_0x1d0e0e){return db[_0xcc8f('0x40')]['create'](_0x524ca4[_0xcc8f('0x4b')],{})['then'](respondWithResult(_0x1d0e0e,0xc9))[_0xcc8f('0x45')](handleError(_0x1d0e0e,null));};exports[_0xcc8f('0x25')]=function(_0x2f1c36,_0x588769){if(_0x2f1c36['body']['id']){delete _0x2f1c36[_0xcc8f('0x4b')]['id'];}return db[_0xcc8f('0x40')][_0xcc8f('0x49')]({'where':{'id':_0x2f1c36['params']['id']}})[_0xcc8f('0x26')](handleEntityNotFound(_0x588769,null))[_0xcc8f('0x26')](saveUpdates(_0x2f1c36['body'],null))[_0xcc8f('0x26')](respondWithResult(_0x588769,null))[_0xcc8f('0x45')](handleError(_0x588769,null));};exports[_0xcc8f('0x27')]=function(_0x3d2839,_0x18a929){return db[_0xcc8f('0x40')][_0xcc8f('0x49')]({'where':{'id':_0x3d2839[_0xcc8f('0x47')]['id']}})['then'](handleEntityNotFound(_0x18a929,null))[_0xcc8f('0x26')](removeEntity(_0x18a929,null))[_0xcc8f('0x45')](handleError(_0x18a929,null));};exports[_0xcc8f('0x4c')]=function(_0x2e85e6,_0x1533c4){return db[_0xcc8f('0x40')]['describe']()[_0xcc8f('0x26')](respondWithResult(_0x1533c4,null))[_0xcc8f('0x45')](handleError(_0x1533c4,null));}; \ No newline at end of file +var _0x233a=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','find','catch','create','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x4cc5c5,_0x58c6ac){var _0x3ddc64=function(_0x554db4){while(--_0x554db4){_0x4cc5c5['push'](_0x4cc5c5['shift']());}};_0x3ddc64(++_0x58c6ac);}(_0x233a,0xe0));var _0xa233=function(_0x249a95,_0x33b508){_0x249a95=_0x249a95-0x0;var _0x4ba485=_0x233a[_0x249a95];return _0x4ba485;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa233('0x0'));var jsonpatch=require(_0xa233('0x1'));var rp=require(_0xa233('0x2'));var moment=require('moment');var BPromise=require(_0xa233('0x3'));var Mustache=require(_0xa233('0x4'));var util=require(_0xa233('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa233('0x6'));var ejs=require(_0xa233('0x7'));var fs=require('fs');var fs_extra=require(_0xa233('0x8'));var _=require(_0xa233('0x9'));var squel=require(_0xa233('0xa'));var crypto=require(_0xa233('0xb'));var jsforce=require(_0xa233('0xc'));var deskjs=require(_0xa233('0xd'));var toCsv=require(_0xa233('0x6'));var querystring=require(_0xa233('0xe'));var Papa=require(_0xa233('0xf'));var Redis=require(_0xa233('0x10'));var authService=require(_0xa233('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa233('0x12'));var hardwareService=require(_0xa233('0x13'));var logger=require(_0xa233('0x14'))(_0xa233('0x15'));var utils=require(_0xa233('0x16'));var config=require(_0xa233('0x17'));var licenseUtil=require(_0xa233('0x18'));var db=require(_0xa233('0x19'))['db'];function respondWithStatusCode(_0x3dffe9,_0x20bec7){_0x20bec7=_0x20bec7||0xcc;return function(_0x49c2eb){if(_0x49c2eb){return _0x3dffe9[_0xa233('0x1a')](_0x20bec7);}return _0x3dffe9[_0xa233('0x1b')](_0x20bec7)[_0xa233('0x1c')]();};}function respondWithResult(_0x4ac6c9,_0x52fb99){_0x52fb99=_0x52fb99||0xc8;return function(_0x315d27){if(_0x315d27){return _0x4ac6c9[_0xa233('0x1b')](_0x52fb99)[_0xa233('0x1d')](_0x315d27);}};}function respondWithFilteredResult(_0x1ace44,_0x373392){return function(_0x54a34b){if(_0x54a34b){var _0x19a910=typeof _0x373392[_0xa233('0x1e')]===_0xa233('0x1f')&&typeof _0x373392[_0xa233('0x20')]===_0xa233('0x1f');var _0x537afb=_0x54a34b[_0xa233('0x21')];var _0x56e050=_0x19a910?0x0:_0x373392[_0xa233('0x1e')];var _0x3e108f=_0x19a910?_0x54a34b[_0xa233('0x21')]:_0x373392[_0xa233('0x1e')]+_0x373392[_0xa233('0x20')];var _0x2ef74e;if(_0x3e108f>=_0x537afb){_0x3e108f=_0x537afb;_0x2ef74e=0xc8;}else{_0x2ef74e=0xce;}_0x1ace44[_0xa233('0x1b')](_0x2ef74e);return _0x1ace44[_0xa233('0x22')](_0xa233('0x23'),_0x56e050+'-'+_0x3e108f+'/'+_0x537afb)[_0xa233('0x1d')](_0x54a34b);}return null;};}function patchUpdates(_0x45c486){return function(_0x2e5df7){try{jsonpatch[_0xa233('0x24')](_0x2e5df7,_0x45c486,!![]);}catch(_0x651942){return BPromise[_0xa233('0x25')](_0x651942);}return _0x2e5df7['save']();};}function saveUpdates(_0x27f89f,_0x3847c5){return function(_0x3966b7){if(_0x3966b7){return _0x3966b7[_0xa233('0x26')](_0x27f89f)[_0xa233('0x27')](function(_0x22b549){return _0x22b549;});}return null;};}function removeEntity(_0x416027,_0x8c265e){return function(_0x43ab69){if(_0x43ab69){return _0x43ab69[_0xa233('0x28')]()['then'](function(){_0x416027['status'](0xcc)[_0xa233('0x1c')]();});}};}function handleEntityNotFound(_0x60c26e,_0x234172){return function(_0x4b62e6){if(!_0x4b62e6){_0x60c26e[_0xa233('0x1a')](0x194);}return _0x4b62e6;};}function handleError(_0x483ff5,_0xcc79){_0xcc79=_0xcc79||0x1f4;return function(_0x257237){logger[_0xa233('0x29')](_0x257237['stack']);if(_0x257237['name']){delete _0x257237[_0xa233('0x2a')];}_0x483ff5[_0xa233('0x1b')](_0xcc79)[_0xa233('0x2b')](_0x257237);};}exports[_0xa233('0x2c')]=function(_0x58a81b,_0x5b95d2){var _0x16d0be={},_0x27a722={},_0x335c01={'count':0x0,'rows':[]};var _0x1e2c3e=_[_0xa233('0x2d')](db[_0xa233('0x2e')][_0xa233('0x2f')],function(_0x461c64){return{'name':_0x461c64[_0xa233('0x30')],'type':_0x461c64['type'][_0xa233('0x31')]};});_0x27a722[_0xa233('0x32')]=_[_0xa233('0x2d')](_0x1e2c3e,_0xa233('0x2a'));_0x27a722['query']=_['keys'](_0x58a81b[_0xa233('0x33')]);_0x27a722[_0xa233('0x34')]=_[_0xa233('0x35')](_0x27a722[_0xa233('0x32')],_0x27a722['query']);_0x16d0be[_0xa233('0x36')]=_[_0xa233('0x35')](_0x27a722[_0xa233('0x32')],qs[_0xa233('0x37')](_0x58a81b[_0xa233('0x33')]['fields']));_0x16d0be[_0xa233('0x36')]=_0x16d0be['attributes'][_0xa233('0x38')]?_0x16d0be['attributes']:_0x27a722[_0xa233('0x32')];if(!_0x58a81b[_0xa233('0x33')][_0xa233('0x39')](_0xa233('0x3a'))){_0x16d0be[_0xa233('0x20')]=qs['limit'](_0x58a81b[_0xa233('0x33')][_0xa233('0x20')]);_0x16d0be[_0xa233('0x1e')]=qs[_0xa233('0x1e')](_0x58a81b['query'][_0xa233('0x1e')]);}_0x16d0be[_0xa233('0x3b')]=qs['sort'](_0x58a81b['query'][_0xa233('0x3c')]);_0x16d0be[_0xa233('0x3d')]=qs[_0xa233('0x34')](_[_0xa233('0x3e')](_0x58a81b[_0xa233('0x33')],_0x27a722[_0xa233('0x34')]),_0x1e2c3e);if(_0x58a81b[_0xa233('0x33')][_0xa233('0x3f')]){_0x16d0be[_0xa233('0x3d')]=_['merge'](_0x16d0be[_0xa233('0x3d')],{'$or':_[_0xa233('0x2d')](_0x1e2c3e,function(_0x59d7da){if(_0x59d7da[_0xa233('0x40')]!==_0xa233('0x41')){var _0x55f82c={};_0x55f82c[_0x59d7da[_0xa233('0x2a')]]={'$like':'%'+_0x58a81b[_0xa233('0x33')][_0xa233('0x3f')]+'%'};return _0x55f82c;}})});}_0x16d0be=_[_0xa233('0x42')]({},_0x16d0be,_0x58a81b[_0xa233('0x43')]);var _0x577051={'where':_0x16d0be[_0xa233('0x3d')]};return db[_0xa233('0x2e')][_0xa233('0x21')](_0x577051)[_0xa233('0x27')](function(_0x41e391){_0x335c01['count']=_0x41e391;if(_0x58a81b[_0xa233('0x33')][_0xa233('0x44')]){_0x16d0be[_0xa233('0x45')]=[{'all':!![]}];}return db[_0xa233('0x2e')]['findAll'](_0x16d0be);})[_0xa233('0x27')](function(_0x47601f){_0x335c01[_0xa233('0x46')]=_0x47601f;return _0x335c01;})['then'](respondWithFilteredResult(_0x5b95d2,_0x16d0be))['catch'](handleError(_0x5b95d2,null));};exports[_0xa233('0x47')]=function(_0x4e7a7d,_0x36c2bd){var _0x1fff9f={'raw':!![],'where':{'id':_0x4e7a7d[_0xa233('0x48')]['id']}},_0x5a424b={};_0x5a424b['model']=_[_0xa233('0x49')](db['FaxTransferReport'][_0xa233('0x2f')]);_0x5a424b['query']=_['keys'](_0x4e7a7d['query']);_0x5a424b[_0xa233('0x34')]=_['intersection'](_0x5a424b[_0xa233('0x32')],_0x5a424b['query']);_0x1fff9f[_0xa233('0x36')]=_[_0xa233('0x35')](_0x5a424b[_0xa233('0x32')],qs['fields'](_0x4e7a7d[_0xa233('0x33')][_0xa233('0x37')]));_0x1fff9f['attributes']=_0x1fff9f[_0xa233('0x36')][_0xa233('0x38')]?_0x1fff9f[_0xa233('0x36')]:_0x5a424b['model'];if(_0x4e7a7d['query'][_0xa233('0x44')]){_0x1fff9f['include']=[{'all':!![]}];}_0x1fff9f=_[_0xa233('0x42')]({},_0x1fff9f,_0x4e7a7d[_0xa233('0x43')]);return db['FaxTransferReport'][_0xa233('0x4a')](_0x1fff9f)['then'](handleEntityNotFound(_0x36c2bd,null))['then'](respondWithResult(_0x36c2bd,null))[_0xa233('0x4b')](handleError(_0x36c2bd,null));};exports[_0xa233('0x4c')]=function(_0x426dcd,_0x5c633d){return db[_0xa233('0x2e')]['create'](_0x426dcd[_0xa233('0x4d')],{})[_0xa233('0x27')](respondWithResult(_0x5c633d,0xc9))[_0xa233('0x4b')](handleError(_0x5c633d,null));};exports['update']=function(_0x4d2a51,_0x570ed1){if(_0x4d2a51['body']['id']){delete _0x4d2a51[_0xa233('0x4d')]['id'];}return db[_0xa233('0x2e')][_0xa233('0x4a')]({'where':{'id':_0x4d2a51[_0xa233('0x48')]['id']}})['then'](handleEntityNotFound(_0x570ed1,null))['then'](saveUpdates(_0x4d2a51[_0xa233('0x4d')],null))['then'](respondWithResult(_0x570ed1,null))['catch'](handleError(_0x570ed1,null));};exports['destroy']=function(_0x5d6fa5,_0x467092){return db[_0xa233('0x2e')][_0xa233('0x4a')]({'where':{'id':_0x5d6fa5[_0xa233('0x48')]['id']}})[_0xa233('0x27')](handleEntityNotFound(_0x467092,null))[_0xa233('0x27')](removeEntity(_0x467092,null))[_0xa233('0x4b')](handleError(_0x467092,null));};exports['describe']=function(_0x23eff7,_0x2bb50d){return db[_0xa233('0x2e')][_0xa233('0x4e')]()['then'](respondWithResult(_0x2bb50d,null))[_0xa233('0x4b')](handleError(_0x2bb50d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index eb8768d..e81aa7c 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 _0x792f=['rimraf','../../config/environment','exports','define','FaxTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x792f,0x10e));var _0xf792=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x792f[_0xd39959];return _0x1ff69c;};'use strict';var _=require('lodash');var util=require(_0xf792('0x0'));var logger=require(_0xf792('0x1'))(_0xf792('0x2'));var moment=require(_0xf792('0x3'));var BPromise=require(_0xf792('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf792('0x5'));var rimraf=require(_0xf792('0x6'));var config=require(_0xf792('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0xf792('0x8')]=function(_0x121909,_0x357d6e){return _0x121909[_0xf792('0x9')](_0xf792('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xf792('0xb'),'fields':[_0xf792('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4060=['./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x425755,_0x16e311){var _0x38c60b=function(_0x22a7fa){while(--_0x22a7fa){_0x425755['push'](_0x425755['shift']());}};_0x38c60b(++_0x16e311);}(_0x4060,0x89));var _0x0406=function(_0x182b2a,_0x18b831){_0x182b2a=_0x182b2a-0x0;var _0x239a1b=_0x4060[_0x182b2a];return _0x239a1b;};'use strict';var _=require('lodash');var util=require(_0x0406('0x0'));var logger=require('../../config/logger')(_0x0406('0x1'));var moment=require(_0x0406('0x2'));var BPromise=require(_0x0406('0x3'));var rp=require(_0x0406('0x4'));var fs=require('fs');var path=require(_0x0406('0x5'));var rimraf=require(_0x0406('0x6'));var config=require('../../config/environment');var attributes=require(_0x0406('0x7'));module[_0x0406('0x8')]=function(_0x55a78e,_0x3caf08){return _0x55a78e[_0x0406('0x9')]('FaxTransferReport',attributes,{'tableName':_0x0406('0xa'),'paranoid':![],'indexes':[{'name':_0x0406('0xb'),'fields':[_0x0406('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 25640ed..9be8a74 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 _0x1107=['info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x1107,0xcb));var _0x7110=function(_0x3fe1ba,_0x1a33c5){_0x3fe1ba=_0x3fe1ba-0x0;var _0x5df1b4=_0x1107[_0x3fe1ba];return _0x5df1b4;};'use strict';var _=require('lodash');var util=require(_0x7110('0x0'));var moment=require(_0x7110('0x1'));var BPromise=require(_0x7110('0x2'));var rs=require(_0x7110('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7110('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7110('0x5'))(_0x7110('0x6'));var config=require(_0x7110('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7110('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2aefa3,_0x48a160,_0x3038e8){return new BPromise(function(_0x579fd9,_0x3ebde7){return client[_0x7110('0x9')](_0x2aefa3,_0x3038e8)[_0x7110('0xa')](function(_0x208056){logger['info'](_0x7110('0xb'),_0x48a160,_0x7110('0xc'));logger[_0x7110('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x48a160,'request\x20sent',JSON['stringify'](_0x208056));if(_0x208056[_0x7110('0xe')]){if(_0x208056[_0x7110('0xe')][_0x7110('0xf')]===0x1f4){logger[_0x7110('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x48a160,_0x208056[_0x7110('0xe')][_0x7110('0x10')]);return _0x3ebde7(_0x208056[_0x7110('0xe')][_0x7110('0x10')]);}logger['error'](_0x7110('0xb'),_0x48a160,_0x208056[_0x7110('0xe')][_0x7110('0x10')]);return _0x579fd9(_0x208056[_0x7110('0xe')][_0x7110('0x10')]);}else{logger[_0x7110('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x48a160,'request\x20sent');_0x579fd9(_0x208056[_0x7110('0x12')][_0x7110('0x10')]);}})[_0x7110('0x13')](function(_0x15764b){logger['error'](_0x7110('0xb'),_0x48a160,_0x15764b);_0x3ebde7(_0x15764b);});});} \ No newline at end of file +var _0xbf37=['../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2a2e72,_0x1de962){var _0x3cfb4a=function(_0x3d435c){while(--_0x3d435c){_0x2a2e72['push'](_0x2a2e72['shift']());}};_0x3cfb4a(++_0x1de962);}(_0xbf37,0x1af));var _0x7bf3=function(_0x36b298,_0x4cae80){_0x36b298=_0x36b298-0x0;var _0x574fb7=_0xbf37[_0x36b298];return _0x574fb7;};'use strict';var _=require(_0x7bf3('0x0'));var util=require(_0x7bf3('0x1'));var moment=require(_0x7bf3('0x2'));var BPromise=require(_0x7bf3('0x3'));var rs=require(_0x7bf3('0x4'));var fs=require('fs');var Redis=require(_0x7bf3('0x5'));var db=require(_0x7bf3('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7bf3('0x7'));var jayson=require(_0x7bf3('0x8'));var client=jayson[_0x7bf3('0x9')][_0x7bf3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38daac,_0x463a90,_0x262513){return new BPromise(function(_0x52a43c,_0x3ea888){return client[_0x7bf3('0xb')](_0x38daac,_0x262513)['then'](function(_0x59c21e){logger[_0x7bf3('0xc')](_0x7bf3('0xd'),_0x463a90,_0x7bf3('0xe'));logger[_0x7bf3('0xf')](_0x7bf3('0x10'),_0x463a90,'request\x20sent',JSON[_0x7bf3('0x11')](_0x59c21e));if(_0x59c21e[_0x7bf3('0x12')]){if(_0x59c21e[_0x7bf3('0x12')][_0x7bf3('0x13')]===0x1f4){logger['error'](_0x7bf3('0xd'),_0x463a90,_0x59c21e[_0x7bf3('0x12')][_0x7bf3('0x14')]);return _0x3ea888(_0x59c21e[_0x7bf3('0x12')][_0x7bf3('0x14')]);}logger[_0x7bf3('0x12')](_0x7bf3('0xd'),_0x463a90,_0x59c21e['error'][_0x7bf3('0x14')]);return _0x52a43c(_0x59c21e['error'][_0x7bf3('0x14')]);}else{logger[_0x7bf3('0xc')](_0x7bf3('0xd'),_0x463a90,_0x7bf3('0xe'));_0x52a43c(_0x59c21e[_0x7bf3('0x15')][_0x7bf3('0x14')]);}})[_0x7bf3('0x16')](function(_0x41a853){logger[_0x7bf3('0x12')](_0x7bf3('0xd'),_0x463a90,_0x41a853);_0x3ea888(_0x41a853);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 0db2ab8..d423506 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 _0xcc1e=['show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2bd0d7,_0x158fb3){var _0x3f3d78=function(_0x204a96){while(--_0x204a96){_0x2bd0d7['push'](_0x2bd0d7['shift']());}};_0x3f3d78(++_0x158fb3);}(_0xcc1e,0x71));var _0xecc1=function(_0xea8272,_0x1bad50){_0xea8272=_0xea8272-0x0;var _0x117bd0=_0xcc1e[_0xea8272];return _0x117bd0;};'use strict';var multer=require(_0xecc1('0x0'));var util=require('util');var path=require(_0xecc1('0x1'));var timeout=require(_0xecc1('0x2'));var express=require(_0xecc1('0x3'));var router=express[_0xecc1('0x4')]();var fs_extra=require(_0xecc1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xecc1('0x6'));var config=require('../../config/environment');var controller=require(_0xecc1('0x7'));router[_0xecc1('0x8')]('/',auth[_0xecc1('0x9')](),controller[_0xecc1('0xa')]);router[_0xecc1('0x8')](_0xecc1('0xb'),auth[_0xecc1('0x9')](),controller[_0xecc1('0xc')]);router[_0xecc1('0x8')]('/:id',auth[_0xecc1('0x9')](),controller[_0xecc1('0xd')]);router[_0xecc1('0xe')]('/',auth[_0xecc1('0x9')](),controller['create']);router[_0xecc1('0xf')](_0xecc1('0x10'),auth['isAuthenticated'](),controller[_0xecc1('0x11')]);router[_0xecc1('0x12')](_0xecc1('0x10'),auth[_0xecc1('0x9')](),controller[_0xecc1('0x13')]);module[_0xecc1('0x14')]=router; \ No newline at end of file +var _0x9ec2=['index','/describe','post','create','put','/:id','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated'];(function(_0x22d097,_0x162352){var _0x51bf99=function(_0x3fb57c){while(--_0x3fb57c){_0x22d097['push'](_0x22d097['shift']());}};_0x51bf99(++_0x162352);}(_0x9ec2,0x14b));var _0x29ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ec2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x29ec('0x0'));var util=require(_0x29ec('0x1'));var path=require(_0x29ec('0x2'));var timeout=require(_0x29ec('0x3'));var express=require(_0x29ec('0x4'));var router=express['Router']();var fs_extra=require(_0x29ec('0x5'));var auth=require(_0x29ec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x29ec('0x7'));var controller=require(_0x29ec('0x8'));router[_0x29ec('0x9')]('/',auth[_0x29ec('0xa')](),controller[_0x29ec('0xb')]);router[_0x29ec('0x9')](_0x29ec('0xc'),auth[_0x29ec('0xa')](),controller['describe']);router[_0x29ec('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x29ec('0xd')]('/',auth[_0x29ec('0xa')](),controller[_0x29ec('0xe')]);router[_0x29ec('0xf')](_0x29ec('0x10'),auth[_0x29ec('0xa')](),controller[_0x29ec('0x11')]);router['delete'](_0x29ec('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x29ec('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 0cfbb8e..6ab2b7a 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 _0x4431=['put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','create','post'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4431,0x10c));var _0x1443=function(_0x140c76,_0x52ff6e){_0x140c76=_0x140c76-0x0;var _0x20b0fe=_0x4431[_0x140c76];return _0x20b0fe;};'use strict';var multer=require('multer');var util=require(_0x1443('0x0'));var path=require(_0x1443('0x1'));var timeout=require('connect-timeout');var express=require(_0x1443('0x2'));var router=express[_0x1443('0x3')]();var fs_extra=require(_0x1443('0x4'));var auth=require(_0x1443('0x5'));var interaction=require(_0x1443('0x6'));var config=require(_0x1443('0x7'));var controller=require(_0x1443('0x8'));router[_0x1443('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1443('0x9')](_0x1443('0xa'),auth[_0x1443('0xb')](),controller[_0x1443('0xc')]);router[_0x1443('0x9')]('/:id/configurations',auth[_0x1443('0xb')](),controller[_0x1443('0xd')]);router['get'](_0x1443('0xe'),auth[_0x1443('0xb')](),controller[_0x1443('0xf')]);router['post']('/',auth[_0x1443('0xb')](),controller[_0x1443('0x10')]);router[_0x1443('0x11')]('/:id/configurations',auth[_0x1443('0xb')](),controller['addConfiguration']);router[_0x1443('0x12')](_0x1443('0xa'),auth[_0x1443('0xb')](),controller[_0x1443('0x13')]);router[_0x1443('0x14')](_0x1443('0xa'),auth['isAuthenticated'](),controller[_0x1443('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd8f1=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x297b35,_0x15ea65){var _0x112f1c=function(_0x47f8a1){while(--_0x47f8a1){_0x297b35['push'](_0x297b35['shift']());}};_0x112f1c(++_0x15ea65);}(_0xd8f1,0x7e));var _0x1d8f=function(_0x8195c5,_0x52f6bf){_0x8195c5=_0x8195c5-0x0;var _0x6e8c07=_0xd8f1[_0x8195c5];return _0x6e8c07;};'use strict';var multer=require(_0x1d8f('0x0'));var util=require(_0x1d8f('0x1'));var path=require('path');var timeout=require(_0x1d8f('0x2'));var express=require(_0x1d8f('0x3'));var router=express[_0x1d8f('0x4')]();var fs_extra=require(_0x1d8f('0x5'));var auth=require(_0x1d8f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1d8f('0x7'));router[_0x1d8f('0x8')]('/',auth[_0x1d8f('0x9')](),controller['index']);router[_0x1d8f('0x8')]('/:id',auth[_0x1d8f('0x9')](),controller[_0x1d8f('0xa')]);router[_0x1d8f('0x8')](_0x1d8f('0xb'),auth[_0x1d8f('0x9')](),controller[_0x1d8f('0xc')]);router['get'](_0x1d8f('0xd'),auth[_0x1d8f('0x9')](),controller[_0x1d8f('0xe')]);router[_0x1d8f('0xf')]('/',auth[_0x1d8f('0x9')](),controller[_0x1d8f('0x10')]);router[_0x1d8f('0xf')](_0x1d8f('0xb'),auth[_0x1d8f('0x9')](),controller[_0x1d8f('0x11')]);router[_0x1d8f('0x12')](_0x1d8f('0x13'),auth['isAuthenticated'](),controller[_0x1d8f('0x14')]);router[_0x1d8f('0x15')](_0x1d8f('0x13'),auth['isAuthenticated'](),controller[_0x1d8f('0x16')]);module[_0x1d8f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index cb2ffe1..a74051c 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 _0xaf66=['basic','integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x482bc3,_0x3d5ab){var _0x458dbe=function(_0x9600eb){while(--_0x9600eb){_0x482bc3['push'](_0x482bc3['shift']());}};_0x458dbe(++_0x3d5ab);}(_0xaf66,0x19a));var _0x6af6=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0xaf66[_0x13ac10];return _0x28eda2;};'use strict';var Sequelize=require(_0x6af6('0x0'));module[_0x6af6('0x1')]={'name':{'type':Sequelize[_0x6af6('0x2')]},'description':{'type':Sequelize[_0x6af6('0x2')]},'username':{'type':Sequelize[_0x6af6('0x2')]},'remoteUri':{'type':Sequelize[_0x6af6('0x2')]},'authType':{'type':Sequelize[_0x6af6('0x3')](_0x6af6('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x6af6('0x2')]},'consumerKey':{'type':Sequelize[_0x6af6('0x2')]},'consumerSecret':{'type':Sequelize[_0x6af6('0x2')]},'token':{'type':Sequelize[_0x6af6('0x2')]},'tokenSecret':{'type':Sequelize[_0x6af6('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6af6('0x3')](_0x6af6('0x5'),'newTab'),'defaultValue':_0x6af6('0x5')}}; \ No newline at end of file +var _0x14f2=['integrationTab','sequelize','STRING','ENUM','basic'];(function(_0x6b5c7f,_0x344491){var _0x47ad5d=function(_0x5db8d2){while(--_0x5db8d2){_0x6b5c7f['push'](_0x6b5c7f['shift']());}};_0x47ad5d(++_0x344491);}(_0x14f2,0x1c3));var _0x214f=function(_0x311d67,_0x3c85f4){_0x311d67=_0x311d67-0x0;var _0xb0e1c4=_0x14f2[_0x311d67];return _0xb0e1c4;};'use strict';var Sequelize=require(_0x214f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x214f('0x1')]},'username':{'type':Sequelize[_0x214f('0x1')]},'remoteUri':{'type':Sequelize[_0x214f('0x1')]},'authType':{'type':Sequelize[_0x214f('0x2')](_0x214f('0x3')),'defaultValue':_0x214f('0x3')},'password':{'type':Sequelize[_0x214f('0x1')]},'consumerKey':{'type':Sequelize[_0x214f('0x1')]},'consumerSecret':{'type':Sequelize[_0x214f('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x214f('0x1')]},'serverUrl':{'type':Sequelize[_0x214f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x214f('0x2')](_0x214f('0x4'),'newTab'),'defaultValue':_0x214f('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index b3ab726..4024d4d 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 _0x875a=['includeAll','include','findAll','rows','catch','show','create','body','find','params','findOne','DeskConfiguration','getConfigurations','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','priority','authType','username','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','password','base64','entries','active','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','DeskAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x10d820,_0x1ff879){var _0xd75692=function(_0x4cd207){while(--_0x4cd207){_0x10d820['push'](_0x10d820['shift']());}};_0xd75692(++_0x1ff879);}(_0x875a,0x187));var _0xa875=function(_0x135061,_0x54a184){_0x135061=_0x135061-0x0;var _0x3e58af=_0x875a[_0x135061];return _0x3e58af;};'use strict';var emlformat=require(_0xa875('0x0'));var rimraf=require(_0xa875('0x1'));var zipdir=require(_0xa875('0x2'));var jsonpatch=require(_0xa875('0x3'));var rp=require(_0xa875('0x4'));var moment=require(_0xa875('0x5'));var BPromise=require(_0xa875('0x6'));var Mustache=require('mustache');var util=require(_0xa875('0x7'));var path=require(_0xa875('0x8'));var sox=require(_0xa875('0x9'));var csv=require(_0xa875('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa875('0xb'));var crypto=require(_0xa875('0xc'));var jsforce=require(_0xa875('0xd'));var deskjs=require(_0xa875('0xe'));var toCsv=require(_0xa875('0xa'));var querystring=require(_0xa875('0xf'));var Papa=require(_0xa875('0x10'));var Redis=require('ioredis');var authService=require(_0xa875('0x11'));var qs=require(_0xa875('0x12'));var as=require(_0xa875('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa875('0x14'));var utils=require(_0xa875('0x15'));var config=require(_0xa875('0x16'));var licenseUtil=require(_0xa875('0x17'));var db=require(_0xa875('0x18'))['db'];var integrations=require(_0xa875('0x19'));function respondWithStatusCode(_0x2a100d,_0x3f08b5){_0x3f08b5=_0x3f08b5||0xcc;return function(_0x338860){if(_0x338860){return _0x2a100d[_0xa875('0x1a')](_0x3f08b5);}return _0x2a100d[_0xa875('0x1b')](_0x3f08b5)['end']();};}function respondWithResult(_0x841e93,_0x3b5a51){_0x3b5a51=_0x3b5a51||0xc8;return function(_0x111cbd){if(_0x111cbd){return _0x841e93['status'](_0x3b5a51)[_0xa875('0x1c')](_0x111cbd);}};}function respondWithFilteredResult(_0x51ae33,_0x4eb266){return function(_0x5ef83e){if(_0x5ef83e){var _0x226628=typeof _0x4eb266[_0xa875('0x1d')]==='undefined'&&typeof _0x4eb266[_0xa875('0x1e')]===_0xa875('0x1f');var _0x1f5edf=_0x5ef83e[_0xa875('0x20')];var _0x39b542=_0x226628?0x0:_0x4eb266[_0xa875('0x1d')];var _0x3cbe71=_0x226628?_0x5ef83e['count']:_0x4eb266['offset']+_0x4eb266[_0xa875('0x1e')];var _0xa4b805;if(_0x3cbe71>=_0x1f5edf){_0x3cbe71=_0x1f5edf;_0xa4b805=0xc8;}else{_0xa4b805=0xce;}_0x51ae33[_0xa875('0x1b')](_0xa4b805);return _0x51ae33[_0xa875('0x21')](_0xa875('0x22'),_0x39b542+'-'+_0x3cbe71+'/'+_0x1f5edf)[_0xa875('0x1c')](_0x5ef83e);}return null;};}function patchUpdates(_0x1d42a9){return function(_0x5b1f2e){try{jsonpatch['apply'](_0x5b1f2e,_0x1d42a9,!![]);}catch(_0x419469){return BPromise[_0xa875('0x23')](_0x419469);}return _0x5b1f2e[_0xa875('0x24')]();};}function saveUpdates(_0x3bfbba,_0x75eac7){return function(_0x5d7e2f){if(_0x5d7e2f){return _0x5d7e2f[_0xa875('0x25')](_0x3bfbba)[_0xa875('0x26')](function(_0x293b71){return _0x293b71;});}return null;};}function removeEntity(_0x22d801,_0x42dcef){return function(_0x5b31d4){if(_0x5b31d4){return _0x5b31d4[_0xa875('0x27')]()[_0xa875('0x26')](function(){_0x22d801['status'](0xcc)[_0xa875('0x28')]();});}};}function handleEntityNotFound(_0x18f0b6,_0x52df1f){return function(_0x1efe72){if(!_0x1efe72){_0x18f0b6[_0xa875('0x1a')](0x194);}return _0x1efe72;};}function handleError(_0x4107ea,_0xd01270){_0xd01270=_0xd01270||0x1f4;return function(_0x470667){logger[_0xa875('0x29')](_0x470667[_0xa875('0x2a')]);if(_0x470667[_0xa875('0x2b')]){delete _0x470667[_0xa875('0x2b')];}_0x4107ea[_0xa875('0x1b')](_0xd01270)['send'](_0x470667);};}exports[_0xa875('0x2c')]=function(_0x1afcd9,_0x1f5231){var _0x3f6454={},_0x1a21e4={},_0x2ae687={'count':0x0,'rows':[]};var _0x5c3ee2=_['map'](db[_0xa875('0x2d')][_0xa875('0x2e')],function(_0x6c1740){return{'name':_0x6c1740[_0xa875('0x2f')],'type':_0x6c1740['type'][_0xa875('0x30')]};});_0x1a21e4[_0xa875('0x31')]=_[_0xa875('0x32')](_0x5c3ee2,_0xa875('0x2b'));_0x1a21e4[_0xa875('0x33')]=_[_0xa875('0x34')](_0x1afcd9[_0xa875('0x33')]);_0x1a21e4[_0xa875('0x35')]=_['intersection'](_0x1a21e4[_0xa875('0x31')],_0x1a21e4[_0xa875('0x33')]);_0x3f6454[_0xa875('0x36')]=_[_0xa875('0x37')](_0x1a21e4['model'],qs['fields'](_0x1afcd9[_0xa875('0x33')][_0xa875('0x38')]));_0x3f6454[_0xa875('0x36')]=_0x3f6454[_0xa875('0x36')][_0xa875('0x39')]?_0x3f6454[_0xa875('0x36')]:_0x1a21e4['model'];if(!_0x1afcd9[_0xa875('0x33')][_0xa875('0x3a')](_0xa875('0x3b'))){_0x3f6454[_0xa875('0x1e')]=qs[_0xa875('0x1e')](_0x1afcd9[_0xa875('0x33')][_0xa875('0x1e')]);_0x3f6454['offset']=qs[_0xa875('0x1d')](_0x1afcd9[_0xa875('0x33')][_0xa875('0x1d')]);}_0x3f6454[_0xa875('0x3c')]=qs[_0xa875('0x3d')](_0x1afcd9[_0xa875('0x33')][_0xa875('0x3d')]);_0x3f6454[_0xa875('0x3e')]=qs[_0xa875('0x35')](_[_0xa875('0x3f')](_0x1afcd9[_0xa875('0x33')],_0x1a21e4['filters']),_0x5c3ee2);if(_0x1afcd9[_0xa875('0x33')][_0xa875('0x40')]){_0x3f6454[_0xa875('0x3e')]=_[_0xa875('0x41')](_0x3f6454[_0xa875('0x3e')],{'$or':_['map'](_0x5c3ee2,function(_0x3b5457){if(_0x3b5457[_0xa875('0x42')]!==_0xa875('0x43')){var _0x18e7ac={};_0x18e7ac[_0x3b5457[_0xa875('0x2b')]]={'$like':'%'+_0x1afcd9[_0xa875('0x33')][_0xa875('0x40')]+'%'};return _0x18e7ac;}})});}_0x3f6454=_[_0xa875('0x41')]({},_0x3f6454,_0x1afcd9[_0xa875('0x44')]);var _0x3358e5={'where':_0x3f6454['where']};return db['DeskAccount'][_0xa875('0x20')](_0x3358e5)['then'](function(_0x26c614){_0x2ae687['count']=_0x26c614;if(_0x1afcd9[_0xa875('0x33')][_0xa875('0x45')]){_0x3f6454[_0xa875('0x46')]=[{'all':!![]}];}return db[_0xa875('0x2d')][_0xa875('0x47')](_0x3f6454);})[_0xa875('0x26')](function(_0x30c06b){_0x2ae687[_0xa875('0x48')]=_0x30c06b;return _0x2ae687;})[_0xa875('0x26')](respondWithFilteredResult(_0x1f5231,_0x3f6454))[_0xa875('0x49')](handleError(_0x1f5231,null));};exports[_0xa875('0x4a')]=function(_0x52b616,_0x58f16a){var _0x3bdc48={'raw':![],'where':{'id':_0x52b616['params']['id']}},_0x5a6429={};_0x5a6429[_0xa875('0x31')]=_[_0xa875('0x34')](db[_0xa875('0x2d')][_0xa875('0x2e')]);_0x5a6429[_0xa875('0x33')]=_['keys'](_0x52b616[_0xa875('0x33')]);_0x5a6429[_0xa875('0x35')]=_['intersection'](_0x5a6429[_0xa875('0x31')],_0x5a6429[_0xa875('0x33')]);_0x3bdc48[_0xa875('0x36')]=_[_0xa875('0x37')](_0x5a6429[_0xa875('0x31')],qs[_0xa875('0x38')](_0x52b616[_0xa875('0x33')]['fields']));_0x3bdc48[_0xa875('0x36')]=_0x3bdc48[_0xa875('0x36')][_0xa875('0x39')]?_0x3bdc48[_0xa875('0x36')]:_0x5a6429[_0xa875('0x31')];if(_0x52b616['query']['includeAll']){_0x3bdc48[_0xa875('0x46')]=[{'all':!![]}];}_0x3bdc48=_['merge']({},_0x3bdc48,_0x52b616[_0xa875('0x44')]);return db[_0xa875('0x2d')]['find'](_0x3bdc48)[_0xa875('0x26')](handleEntityNotFound(_0x58f16a,null))['then'](respondWithResult(_0x58f16a,null))['catch'](handleError(_0x58f16a,null));};exports[_0xa875('0x4b')]=function(_0x24194d,_0x4f589a){return db[_0xa875('0x2d')]['create'](_0x24194d['body'],{})[_0xa875('0x26')](respondWithResult(_0x4f589a,0xc9))[_0xa875('0x49')](handleError(_0x4f589a,null));};exports[_0xa875('0x25')]=function(_0x3ec57b,_0x48257a){if(_0x3ec57b[_0xa875('0x4c')]['id']){delete _0x3ec57b[_0xa875('0x4c')]['id'];}return db[_0xa875('0x2d')][_0xa875('0x4d')]({'where':{'id':_0x3ec57b[_0xa875('0x4e')]['id']}})['then'](handleEntityNotFound(_0x48257a,null))[_0xa875('0x26')](saveUpdates(_0x3ec57b[_0xa875('0x4c')],null))['then'](respondWithResult(_0x48257a,null))[_0xa875('0x49')](handleError(_0x48257a,null));};exports[_0xa875('0x27')]=function(_0x1c25f0,_0x146480){return db[_0xa875('0x2d')][_0xa875('0x4d')]({'where':{'id':_0x1c25f0[_0xa875('0x4e')]['id']}})[_0xa875('0x26')](handleEntityNotFound(_0x146480,null))[_0xa875('0x26')](removeEntity(_0x146480,null))[_0xa875('0x49')](handleError(_0x146480,null));};exports['getConfigurations']=function(_0x528013,_0x1f63dc,_0xb1f7d4){var _0x3df49e={};var _0x44ae7f={};var _0x3e959f;var _0x2392a1;return db[_0xa875('0x2d')][_0xa875('0x4f')]({'where':{'id':_0x528013[_0xa875('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1f63dc,null))[_0xa875('0x26')](function(_0x2d8235){if(_0x2d8235){_0x3e959f=_0x2d8235;_0x44ae7f[_0xa875('0x31')]=_[_0xa875('0x34')](db[_0xa875('0x50')][_0xa875('0x2e')]);_0x44ae7f[_0xa875('0x33')]=_[_0xa875('0x34')](_0x528013[_0xa875('0x33')]);_0x44ae7f['filters']=_[_0xa875('0x37')](_0x44ae7f[_0xa875('0x31')],_0x44ae7f[_0xa875('0x33')]);_0x3df49e[_0xa875('0x36')]=_[_0xa875('0x37')](_0x44ae7f[_0xa875('0x31')],qs[_0xa875('0x38')](_0x528013[_0xa875('0x33')]['fields']));_0x3df49e['attributes']=_0x3df49e['attributes'][_0xa875('0x39')]?_0x3df49e[_0xa875('0x36')]:_0x44ae7f['model'];_0x3df49e[_0xa875('0x3c')]=qs[_0xa875('0x3d')](_0x528013[_0xa875('0x33')]['sort']);_0x3df49e['where']=qs[_0xa875('0x35')](_[_0xa875('0x3f')](_0x528013[_0xa875('0x33')],_0x44ae7f[_0xa875('0x35')]));if(_0x528013[_0xa875('0x33')]['filter']){_0x3df49e[_0xa875('0x3e')]=_[_0xa875('0x41')](_0x3df49e[_0xa875('0x3e')],{'$or':_[_0xa875('0x32')](_0x3df49e[_0xa875('0x36')],function(_0x3bfa1c){var _0x4b84ab={};_0x4b84ab[_0x3bfa1c]={'$like':'%'+_0x528013[_0xa875('0x33')][_0xa875('0x40')]+'%'};return _0x4b84ab;})});}_0x3df49e=_[_0xa875('0x41')]({},_0x3df49e,_0x528013[_0xa875('0x44')]);return _0x3e959f['getConfigurations'](_0x3df49e);}})[_0xa875('0x26')](function(_0x11782c){if(_0x11782c){_0x2392a1=_0x11782c[_0xa875('0x39')];if(!_0x528013[_0xa875('0x33')][_0xa875('0x3a')]('nolimit')){_0x3df49e[_0xa875('0x1e')]=qs[_0xa875('0x1e')](_0x528013['query'][_0xa875('0x1e')]);_0x3df49e['offset']=qs[_0xa875('0x1d')](_0x528013[_0xa875('0x33')][_0xa875('0x1d')]);}return _0x3e959f[_0xa875('0x51')](_0x3df49e);}})[_0xa875('0x26')](function(_0x2e95a5){if(_0x2e95a5){return _0x2e95a5?{'count':_0x2392a1,'rows':_0x2e95a5}:null;}})[_0xa875('0x26')](respondWithResult(_0x1f63dc,null))['catch'](handleError(_0x1f63dc,null));};exports['addConfiguration']=function(_0x18e16c,_0x10f701,_0x4d6d07){if(_0x18e16c[_0xa875('0x4c')]['id']){delete _0x18e16c['body']['id'];}return db[_0xa875('0x2d')][_0xa875('0x4f')]({'where':{'id':_0x18e16c[_0xa875('0x4e')]['id']}})[_0xa875('0x26')](handleEntityNotFound(_0x10f701,null))[_0xa875('0x26')](function(_0x54f7bd){if(_0x54f7bd){_0x18e16c[_0xa875('0x4c')]['AccountId']=_0x54f7bd['id'];_0x18e16c[_0xa875('0x4c')]['Subjects']=integrations[_0xa875('0x52')](_0x18e16c[_0xa875('0x4c')][_0xa875('0x53')],_0x18e16c['body'][_0xa875('0x42')]);_0x18e16c['body'][_0xa875('0x54')]=integrations[_0xa875('0x55')](_0x18e16c['body']['channel'],_0x18e16c[_0xa875('0x4c')]['type']);return db[_0xa875('0x50')]['create'](_0x18e16c[_0xa875('0x4c')],{'include':[{'model':db[_0xa875('0x56')],'as':_0xa875('0x57')},{'model':db['DeskField'],'as':_0xa875('0x54')}]});}return null;})[_0xa875('0x26')](respondWithResult(_0x10f701,null))[_0xa875('0x49')](handleError(_0x10f701,null));};exports['getFields']=function(_0x4c0531,_0x23fd67,_0x5baf0f){var _0x4e5500=[{'name':_0xa875('0x58'),'label':_0xa875('0x58'),'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 _0x47bf3a='';return db[_0xa875('0x2d')]['findOne']({'where':{'id':_0x4c0531[_0xa875('0x4e')]['id']},'attributes':['id','remoteUri',_0xa875('0x59'),_0xa875('0x5a'),'password','consumerKey',_0xa875('0x5b'),_0xa875('0x5c'),_0xa875('0x5d')]})[_0xa875('0x26')](handleEntityNotFound(_0x23fd67,null))['then'](function(_0x3dc37c){if(_0x3dc37c){_0x47bf3a=_0x3dc37c['remoteUri'];var _0x39bbf3=_0x47bf3a['slice'](-0x1);if(_0x39bbf3==='/'){_0x47bf3a=_0x47bf3a[_0xa875('0x5e')](0x0,_0x47bf3a[_0xa875('0x5f')](_0x39bbf3));}var _0x2129c8={'method':_0xa875('0x60'),'uri':util[_0xa875('0x61')](_0xa875('0x62'),_0x47bf3a),'headers':{'Content-Type':_0xa875('0x63'),'Accept':_0xa875('0x63')},'json':!![]};if(_0x3dc37c[_0xa875('0x59')]===_0xa875('0x64')){_0x2129c8[_0xa875('0x65')]['Authorization']=util['format'](_0xa875('0x66'),new Buffer(util[_0xa875('0x61')](_0xa875('0x67'),_0x3dc37c[_0xa875('0x5a')],_0x3dc37c[_0xa875('0x68')]))['toString'](_0xa875('0x69')));}return rp(_0x2129c8)['then'](function(_0x2a5c7d){return _0x4e5500['concat'](_[_0xa875('0x32')](_0x2a5c7d['_embedded'][_0xa875('0x6a')],function(_0x3fc970){return{'id':_0x3fc970['name'],'name':_0x3fc970['name'],'type':_0x3fc970[_0xa875('0x42')],'active':_0x3fc970[_0xa875('0x6b')],'label':_0x3fc970['label'],'custom':!![]};}));});}})[_0xa875('0x26')](function(_0x95ed50){return{'count':_0x95ed50[_0xa875('0x39')],'rows':_0x95ed50};})['then'](respondWithResult(_0x23fd67,null))[_0xa875('0x49')](function(_0x522b5c){var _0x286e30=_0x4c0531[_0xa875('0x33')]['test']?0x1f4:_0x522b5c['statusCode']||0x1f4;logger['error'](_0xa875('0x6c'),_0xa875('0x6d'),_0x286e30,JSON[_0xa875('0x6e')](_0x522b5c));delete _0x522b5c[_0xa875('0x2b')];if(_0x286e30===0x191){_0x286e30=0x190;}_0x23fd67[_0xa875('0x1b')](_0x286e30)[_0xa875('0x6f')](_0x4c0531['query'][_0xa875('0x70')]?{'message':_0xa875('0x71'),'statusCode':_0x522b5c[_0xa875('0x72')]}:_0x522b5c);});}; \ No newline at end of file +var _0x07f8=['Subjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','authType','password','consumerKey','consumerSecret','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','Authorization','format','%s:%s','username','_embedded','entries','active','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','index','map','DeskAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','keys','find','catch','create','body','params','findOne','DeskConfiguration','getConfigurations','nolimit','addConfiguration','AccountId'];(function(_0x1cb1f6,_0x5a26b7){var _0x1c5d21=function(_0x3df920){while(--_0x3df920){_0x1cb1f6['push'](_0x1cb1f6['shift']());}};_0x1c5d21(++_0x5a26b7);}(_0x07f8,0x174));var _0x807f=function(_0x1534e0,_0x5d3d89){_0x1534e0=_0x1534e0-0x0;var _0x570b2b=_0x07f8[_0x1534e0];return _0x570b2b;};'use strict';var emlformat=require(_0x807f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x807f('0x1'));var rp=require(_0x807f('0x2'));var moment=require(_0x807f('0x3'));var BPromise=require(_0x807f('0x4'));var Mustache=require(_0x807f('0x5'));var util=require(_0x807f('0x6'));var path=require(_0x807f('0x7'));var sox=require('sox');var csv=require(_0x807f('0x8'));var ejs=require(_0x807f('0x9'));var fs=require('fs');var fs_extra=require(_0x807f('0xa'));var _=require(_0x807f('0xb'));var squel=require(_0x807f('0xc'));var crypto=require(_0x807f('0xd'));var jsforce=require(_0x807f('0xe'));var deskjs=require(_0x807f('0xf'));var toCsv=require(_0x807f('0x8'));var querystring=require(_0x807f('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x807f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x807f('0x12'));var hardwareService=require(_0x807f('0x13'));var logger=require(_0x807f('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x807f('0x15'));var licenseUtil=require(_0x807f('0x16'));var db=require(_0x807f('0x17'))['db'];var integrations=require(_0x807f('0x18'));function respondWithStatusCode(_0x2e86ca,_0xc612dc){_0xc612dc=_0xc612dc||0xcc;return function(_0x349da0){if(_0x349da0){return _0x2e86ca['sendStatus'](_0xc612dc);}return _0x2e86ca['status'](_0xc612dc)['end']();};}function respondWithResult(_0x5036b0,_0x1ba970){_0x1ba970=_0x1ba970||0xc8;return function(_0x2a55fb){if(_0x2a55fb){return _0x5036b0[_0x807f('0x19')](_0x1ba970)[_0x807f('0x1a')](_0x2a55fb);}};}function respondWithFilteredResult(_0x48ef7,_0x414795){return function(_0x2ac08c){if(_0x2ac08c){var _0x69db94=typeof _0x414795[_0x807f('0x1b')]===_0x807f('0x1c')&&typeof _0x414795[_0x807f('0x1d')]==='undefined';var _0xf632ab=_0x2ac08c[_0x807f('0x1e')];var _0x4f87f9=_0x69db94?0x0:_0x414795[_0x807f('0x1b')];var _0x52bb27=_0x69db94?_0x2ac08c['count']:_0x414795[_0x807f('0x1b')]+_0x414795['limit'];var _0x36e0b9;if(_0x52bb27>=_0xf632ab){_0x52bb27=_0xf632ab;_0x36e0b9=0xc8;}else{_0x36e0b9=0xce;}_0x48ef7[_0x807f('0x19')](_0x36e0b9);return _0x48ef7[_0x807f('0x1f')](_0x807f('0x20'),_0x4f87f9+'-'+_0x52bb27+'/'+_0xf632ab)[_0x807f('0x1a')](_0x2ac08c);}return null;};}function patchUpdates(_0x1f1a15){return function(_0x5d12fd){try{jsonpatch[_0x807f('0x21')](_0x5d12fd,_0x1f1a15,!![]);}catch(_0x4dd337){return BPromise[_0x807f('0x22')](_0x4dd337);}return _0x5d12fd['save']();};}function saveUpdates(_0x7f5307,_0x412a57){return function(_0x35921b){if(_0x35921b){return _0x35921b[_0x807f('0x23')](_0x7f5307)[_0x807f('0x24')](function(_0x2ea574){return _0x2ea574;});}return null;};}function removeEntity(_0x4ea3ed,_0x40394c){return function(_0x20ad71){if(_0x20ad71){return _0x20ad71[_0x807f('0x25')]()[_0x807f('0x24')](function(){_0x4ea3ed[_0x807f('0x19')](0xcc)[_0x807f('0x26')]();});}};}function handleEntityNotFound(_0x1b5f5f,_0x4b49aa){return function(_0x5cc592){if(!_0x5cc592){_0x1b5f5f['sendStatus'](0x194);}return _0x5cc592;};}function handleError(_0x3df29c,_0x39ed33){_0x39ed33=_0x39ed33||0x1f4;return function(_0x2a24d2){logger[_0x807f('0x27')](_0x2a24d2[_0x807f('0x28')]);if(_0x2a24d2['name']){delete _0x2a24d2[_0x807f('0x29')];}_0x3df29c['status'](_0x39ed33)['send'](_0x2a24d2);};}exports[_0x807f('0x2a')]=function(_0x28711a,_0x29e761){var _0x274775={},_0x46c76e={},_0x59a883={'count':0x0,'rows':[]};var _0x2f2475=_[_0x807f('0x2b')](db[_0x807f('0x2c')][_0x807f('0x2d')],function(_0x4d21cf){return{'name':_0x4d21cf[_0x807f('0x2e')],'type':_0x4d21cf[_0x807f('0x2f')][_0x807f('0x30')]};});_0x46c76e['model']=_[_0x807f('0x2b')](_0x2f2475,_0x807f('0x29'));_0x46c76e[_0x807f('0x31')]=_['keys'](_0x28711a[_0x807f('0x31')]);_0x46c76e[_0x807f('0x32')]=_[_0x807f('0x33')](_0x46c76e[_0x807f('0x34')],_0x46c76e[_0x807f('0x31')]);_0x274775[_0x807f('0x35')]=_['intersection'](_0x46c76e['model'],qs[_0x807f('0x36')](_0x28711a[_0x807f('0x31')]['fields']));_0x274775['attributes']=_0x274775['attributes'][_0x807f('0x37')]?_0x274775[_0x807f('0x35')]:_0x46c76e[_0x807f('0x34')];if(!_0x28711a[_0x807f('0x31')][_0x807f('0x38')]('nolimit')){_0x274775[_0x807f('0x1d')]=qs[_0x807f('0x1d')](_0x28711a[_0x807f('0x31')][_0x807f('0x1d')]);_0x274775['offset']=qs[_0x807f('0x1b')](_0x28711a[_0x807f('0x31')][_0x807f('0x1b')]);}_0x274775[_0x807f('0x39')]=qs['sort'](_0x28711a[_0x807f('0x31')][_0x807f('0x3a')]);_0x274775[_0x807f('0x3b')]=qs[_0x807f('0x32')](_[_0x807f('0x3c')](_0x28711a['query'],_0x46c76e[_0x807f('0x32')]),_0x2f2475);if(_0x28711a['query'][_0x807f('0x3d')]){_0x274775[_0x807f('0x3b')]=_[_0x807f('0x3e')](_0x274775[_0x807f('0x3b')],{'$or':_['map'](_0x2f2475,function(_0x2edda5){if(_0x2edda5['type']!==_0x807f('0x3f')){var _0x53848c={};_0x53848c[_0x2edda5[_0x807f('0x29')]]={'$like':'%'+_0x28711a[_0x807f('0x31')][_0x807f('0x3d')]+'%'};return _0x53848c;}})});}_0x274775=_[_0x807f('0x3e')]({},_0x274775,_0x28711a[_0x807f('0x40')]);var _0x450502={'where':_0x274775['where']};return db[_0x807f('0x2c')]['count'](_0x450502)['then'](function(_0x3e7ed1){_0x59a883['count']=_0x3e7ed1;if(_0x28711a[_0x807f('0x31')][_0x807f('0x41')]){_0x274775[_0x807f('0x42')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x274775);})[_0x807f('0x24')](function(_0x1b115b){_0x59a883[_0x807f('0x43')]=_0x1b115b;return _0x59a883;})[_0x807f('0x24')](respondWithFilteredResult(_0x29e761,_0x274775))['catch'](handleError(_0x29e761,null));};exports['show']=function(_0x25219e,_0x5e0268){var _0x7a271a={'raw':![],'where':{'id':_0x25219e['params']['id']}},_0x22c17b={};_0x22c17b['model']=_[_0x807f('0x44')](db[_0x807f('0x2c')]['rawAttributes']);_0x22c17b[_0x807f('0x31')]=_['keys'](_0x25219e['query']);_0x22c17b[_0x807f('0x32')]=_[_0x807f('0x33')](_0x22c17b['model'],_0x22c17b[_0x807f('0x31')]);_0x7a271a[_0x807f('0x35')]=_['intersection'](_0x22c17b[_0x807f('0x34')],qs[_0x807f('0x36')](_0x25219e[_0x807f('0x31')][_0x807f('0x36')]));_0x7a271a[_0x807f('0x35')]=_0x7a271a['attributes'][_0x807f('0x37')]?_0x7a271a[_0x807f('0x35')]:_0x22c17b[_0x807f('0x34')];if(_0x25219e[_0x807f('0x31')][_0x807f('0x41')]){_0x7a271a['include']=[{'all':!![]}];}_0x7a271a=_[_0x807f('0x3e')]({},_0x7a271a,_0x25219e['options']);return db[_0x807f('0x2c')][_0x807f('0x45')](_0x7a271a)[_0x807f('0x24')](handleEntityNotFound(_0x5e0268,null))[_0x807f('0x24')](respondWithResult(_0x5e0268,null))[_0x807f('0x46')](handleError(_0x5e0268,null));};exports[_0x807f('0x47')]=function(_0x52f40f,_0x3b802c){return db[_0x807f('0x2c')]['create'](_0x52f40f['body'],{})[_0x807f('0x24')](respondWithResult(_0x3b802c,0xc9))[_0x807f('0x46')](handleError(_0x3b802c,null));};exports[_0x807f('0x23')]=function(_0x42e8a1,_0x1f2545){if(_0x42e8a1[_0x807f('0x48')]['id']){delete _0x42e8a1[_0x807f('0x48')]['id'];}return db[_0x807f('0x2c')][_0x807f('0x45')]({'where':{'id':_0x42e8a1[_0x807f('0x49')]['id']}})[_0x807f('0x24')](handleEntityNotFound(_0x1f2545,null))[_0x807f('0x24')](saveUpdates(_0x42e8a1[_0x807f('0x48')],null))[_0x807f('0x24')](respondWithResult(_0x1f2545,null))['catch'](handleError(_0x1f2545,null));};exports[_0x807f('0x25')]=function(_0x1d3489,_0x132136){return db['DeskAccount']['find']({'where':{'id':_0x1d3489[_0x807f('0x49')]['id']}})['then'](handleEntityNotFound(_0x132136,null))[_0x807f('0x24')](removeEntity(_0x132136,null))['catch'](handleError(_0x132136,null));};exports['getConfigurations']=function(_0x4cf71e,_0x17e0b6,_0x2180d8){var _0x20d743={};var _0x6977c={};var _0xdfd14d;var _0x3bbef1;return db[_0x807f('0x2c')][_0x807f('0x4a')]({'where':{'id':_0x4cf71e[_0x807f('0x49')]['id']}})[_0x807f('0x24')](handleEntityNotFound(_0x17e0b6,null))[_0x807f('0x24')](function(_0x54e929){if(_0x54e929){_0xdfd14d=_0x54e929;_0x6977c[_0x807f('0x34')]=_[_0x807f('0x44')](db[_0x807f('0x4b')][_0x807f('0x2d')]);_0x6977c[_0x807f('0x31')]=_['keys'](_0x4cf71e[_0x807f('0x31')]);_0x6977c['filters']=_[_0x807f('0x33')](_0x6977c[_0x807f('0x34')],_0x6977c['query']);_0x20d743['attributes']=_[_0x807f('0x33')](_0x6977c['model'],qs['fields'](_0x4cf71e[_0x807f('0x31')]['fields']));_0x20d743[_0x807f('0x35')]=_0x20d743['attributes'][_0x807f('0x37')]?_0x20d743['attributes']:_0x6977c['model'];_0x20d743[_0x807f('0x39')]=qs[_0x807f('0x3a')](_0x4cf71e[_0x807f('0x31')][_0x807f('0x3a')]);_0x20d743[_0x807f('0x3b')]=qs[_0x807f('0x32')](_[_0x807f('0x3c')](_0x4cf71e[_0x807f('0x31')],_0x6977c[_0x807f('0x32')]));if(_0x4cf71e['query'][_0x807f('0x3d')]){_0x20d743[_0x807f('0x3b')]=_[_0x807f('0x3e')](_0x20d743[_0x807f('0x3b')],{'$or':_[_0x807f('0x2b')](_0x20d743[_0x807f('0x35')],function(_0x3e8e62){var _0x1f0cb0={};_0x1f0cb0[_0x3e8e62]={'$like':'%'+_0x4cf71e[_0x807f('0x31')]['filter']+'%'};return _0x1f0cb0;})});}_0x20d743=_[_0x807f('0x3e')]({},_0x20d743,_0x4cf71e[_0x807f('0x40')]);return _0xdfd14d[_0x807f('0x4c')](_0x20d743);}})[_0x807f('0x24')](function(_0x357a2f){if(_0x357a2f){_0x3bbef1=_0x357a2f[_0x807f('0x37')];if(!_0x4cf71e['query']['hasOwnProperty'](_0x807f('0x4d'))){_0x20d743[_0x807f('0x1d')]=qs[_0x807f('0x1d')](_0x4cf71e[_0x807f('0x31')]['limit']);_0x20d743[_0x807f('0x1b')]=qs[_0x807f('0x1b')](_0x4cf71e[_0x807f('0x31')][_0x807f('0x1b')]);}return _0xdfd14d[_0x807f('0x4c')](_0x20d743);}})['then'](function(_0x2203b6){if(_0x2203b6){return _0x2203b6?{'count':_0x3bbef1,'rows':_0x2203b6}:null;}})['then'](respondWithResult(_0x17e0b6,null))[_0x807f('0x46')](handleError(_0x17e0b6,null));};exports[_0x807f('0x4e')]=function(_0x1306c8,_0x4b7847,_0x2fc8cc){if(_0x1306c8[_0x807f('0x48')]['id']){delete _0x1306c8['body']['id'];}return db['DeskAccount'][_0x807f('0x4a')]({'where':{'id':_0x1306c8['params']['id']}})[_0x807f('0x24')](handleEntityNotFound(_0x4b7847,null))['then'](function(_0xd3694d){if(_0xd3694d){_0x1306c8[_0x807f('0x48')][_0x807f('0x4f')]=_0xd3694d['id'];_0x1306c8['body'][_0x807f('0x50')]=integrations['getSubjects'](_0x1306c8[_0x807f('0x48')]['channel'],_0x1306c8['body'][_0x807f('0x2f')]);_0x1306c8[_0x807f('0x48')][_0x807f('0x51')]=integrations[_0x807f('0x52')](_0x1306c8[_0x807f('0x48')][_0x807f('0x53')],_0x1306c8[_0x807f('0x48')][_0x807f('0x2f')]);return db[_0x807f('0x4b')][_0x807f('0x47')](_0x1306c8[_0x807f('0x48')],{'include':[{'model':db[_0x807f('0x54')],'as':_0x807f('0x50')},{'model':db[_0x807f('0x54')],'as':_0x807f('0x51')}]});}return null;})[_0x807f('0x24')](respondWithResult(_0x4b7847,null))['catch'](handleError(_0x4b7847,null));};exports[_0x807f('0x55')]=function(_0x10bad8,_0x5cd867,_0x234b2f){var _0x55b9e0=[{'name':_0x807f('0x56'),'label':_0x807f('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x10ee05='';return db[_0x807f('0x2c')][_0x807f('0x4a')]({'where':{'id':_0x10bad8['params']['id']},'attributes':['id',_0x807f('0x57'),_0x807f('0x58'),'username',_0x807f('0x59'),_0x807f('0x5a'),_0x807f('0x5b'),'token',_0x807f('0x5c')]})[_0x807f('0x24')](handleEntityNotFound(_0x5cd867,null))[_0x807f('0x24')](function(_0x330ee0){if(_0x330ee0){_0x10ee05=_0x330ee0[_0x807f('0x57')];var _0x468b44=_0x10ee05[_0x807f('0x5d')](-0x1);if(_0x468b44==='/'){_0x10ee05=_0x10ee05[_0x807f('0x5e')](0x0,_0x10ee05[_0x807f('0x5f')](_0x468b44));}var _0xf1ed17={'method':_0x807f('0x60'),'uri':util['format'](_0x807f('0x61'),_0x10ee05),'headers':{'Content-Type':_0x807f('0x62'),'Accept':'application/json'},'json':!![]};if(_0x330ee0[_0x807f('0x58')]===_0x807f('0x63')){_0xf1ed17[_0x807f('0x64')][_0x807f('0x65')]=util[_0x807f('0x66')]('Basic\x20%s',new Buffer(util[_0x807f('0x66')](_0x807f('0x67'),_0x330ee0[_0x807f('0x68')],_0x330ee0[_0x807f('0x59')]))['toString']('base64'));}return rp(_0xf1ed17)['then'](function(_0x2ea305){return _0x55b9e0['concat'](_[_0x807f('0x2b')](_0x2ea305[_0x807f('0x69')][_0x807f('0x6a')],function(_0x1f106c){return{'id':_0x1f106c[_0x807f('0x29')],'name':_0x1f106c[_0x807f('0x29')],'type':_0x1f106c[_0x807f('0x2f')],'active':_0x1f106c[_0x807f('0x6b')],'label':_0x1f106c['label'],'custom':!![]};}));});}})['then'](function(_0x2072a2){return{'count':_0x2072a2[_0x807f('0x37')],'rows':_0x2072a2};})[_0x807f('0x24')](respondWithResult(_0x5cd867,null))[_0x807f('0x46')](function(_0x2ab2b8){var _0x42ec17=_0x10bad8[_0x807f('0x31')]['test']?0x1f4:_0x2ab2b8['statusCode']||0x1f4;logger['error'](_0x807f('0x6c'),'getFields',_0x42ec17,JSON['stringify'](_0x2ab2b8));delete _0x2ab2b8[_0x807f('0x29')];if(_0x42ec17===0x191){_0x42ec17=0x190;}_0x5cd867['status'](_0x42ec17)[_0x807f('0x6d')](_0x10bad8[_0x807f('0x31')][_0x807f('0x6e')]?{'message':_0x807f('0x6f'),'statusCode':_0x2ab2b8[_0x807f('0x70')]}:_0x2ab2b8);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index cdb6d7f..baa718e 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 _0x031f=['lodash','util','moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x031f,0x104));var _0xf031=function(_0x349009,_0x2a1c8c){_0x349009=_0x349009-0x0;var _0x57a5b8=_0x031f[_0x349009];return _0x57a5b8;};'use strict';var _=require(_0xf031('0x0'));var util=require(_0xf031('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf031('0x2'));var BPromise=require('bluebird');var rp=require(_0xf031('0x3'));var fs=require('fs');var path=require(_0xf031('0x4'));var rimraf=require(_0xf031('0x5'));var config=require(_0xf031('0x6'));var attributes=require(_0xf031('0x7'));var integrations=require(_0xf031('0x8'));module[_0xf031('0x9')]=function(_0x13508d,_0xc23a6b){return _0x13508d[_0xf031('0xa')](_0xf031('0xb'),attributes,{'tableName':_0xf031('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc97=['define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x5a1b51,_0x386897){var _0x108e2c=function(_0x3b3c2f){while(--_0x3b3c2f){_0x5a1b51['push'](_0x5a1b51['shift']());}};_0x108e2c(++_0x386897);}(_0xfc97,0x99));var _0x7fc9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfc97[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x7fc9('0x0'));var util=require(_0x7fc9('0x1'));var logger=require(_0x7fc9('0x2'))(_0x7fc9('0x3'));var moment=require(_0x7fc9('0x4'));var BPromise=require(_0x7fc9('0x5'));var rp=require(_0x7fc9('0x6'));var fs=require('fs');var path=require(_0x7fc9('0x7'));var rimraf=require(_0x7fc9('0x8'));var config=require('../../config/environment');var attributes=require(_0x7fc9('0x9'));var integrations=require(_0x7fc9('0xa'));module[_0x7fc9('0xb')]=function(_0x40e955,_0x38ea6b){return _0x40e955[_0x7fc9('0xc')](_0x7fc9('0xd'),attributes,{'tableName':_0x7fc9('0xe'),'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 3a62f73..817d44e 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 _0x04de=['debug','stringify','error','message','catch','DeskAccount','findAll','options','where','attributes','limit','map','include','model','GetDeskAccount','find','raw','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1d41a2,_0x33011b){var _0x241d1c=function(_0x1c8b0a){while(--_0x1c8b0a){_0x1d41a2['push'](_0x1d41a2['shift']());}};_0x241d1c(++_0x33011b);}(_0x04de,0x12a));var _0xe04d=function(_0x3eea86,_0x2eb677){_0x3eea86=_0x3eea86-0x0;var _0x4a8c08=_0x04de[_0x3eea86];return _0x4a8c08;};'use strict';var _=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var moment=require(_0xe04d('0x2'));var BPromise=require(_0xe04d('0x3'));var rs=require(_0xe04d('0x4'));var fs=require('fs');var Redis=require(_0xe04d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe04d('0x6'));var logger=require(_0xe04d('0x7'))(_0xe04d('0x8'));var config=require(_0xe04d('0x9'));var jayson=require(_0xe04d('0xa'));var client=jayson[_0xe04d('0xb')][_0xe04d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c5ed8,_0x10fa56,_0x33ac8d){return new BPromise(function(_0x32fb32,_0x24cbbe){return client['request'](_0x5c5ed8,_0x33ac8d)[_0xe04d('0xd')](function(_0xa50019){logger[_0xe04d('0xe')](_0xe04d('0xf'),_0x10fa56,_0xe04d('0x10'));logger[_0xe04d('0x11')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x10fa56,_0xe04d('0x10'),JSON[_0xe04d('0x12')](_0xa50019));if(_0xa50019[_0xe04d('0x13')]){if(_0xa50019['error']['code']===0x1f4){logger['error'](_0xe04d('0xf'),_0x10fa56,_0xa50019[_0xe04d('0x13')][_0xe04d('0x14')]);return _0x24cbbe(_0xa50019[_0xe04d('0x13')][_0xe04d('0x14')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x10fa56,_0xa50019[_0xe04d('0x13')][_0xe04d('0x14')]);return _0x32fb32(_0xa50019[_0xe04d('0x13')][_0xe04d('0x14')]);}else{logger[_0xe04d('0xe')]('DeskAccount,\x20%s,\x20%s',_0x10fa56,'request\x20sent');_0x32fb32(_0xa50019['result'][_0xe04d('0x14')]);}})[_0xe04d('0x15')](function(_0x5c9df8){logger[_0xe04d('0x13')]('DeskAccount,\x20%s,\x20%s',_0x10fa56,_0x5c9df8);_0x24cbbe(_0x5c9df8);});});}exports['GetDeskAccount']=function(_0x51d9ab){var _0x4b9885=this;return new Promise(function(_0x10fe34,_0xcbcca8){return db[_0xe04d('0x16')][_0xe04d('0x17')]({'raw':_0x51d9ab[_0xe04d('0x18')]?_0x51d9ab[_0xe04d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x51d9ab[_0xe04d('0x18')]?_0x51d9ab[_0xe04d('0x18')][_0xe04d('0x19')]||null:null,'attributes':_0x51d9ab['options']?_0x51d9ab['options'][_0xe04d('0x1a')]||null:null,'limit':_0x51d9ab[_0xe04d('0x18')]?_0x51d9ab[_0xe04d('0x18')][_0xe04d('0x1b')]||null:null,'include':_0x51d9ab['options']?_0x51d9ab[_0xe04d('0x18')]['include']?_[_0xe04d('0x1c')](_0x51d9ab[_0xe04d('0x18')][_0xe04d('0x1d')],function(_0x502617){return{'model':db[_0x502617[_0xe04d('0x1e')]],'as':_0x502617['as'],'attributes':_0x502617['attributes'],'include':_0x502617[_0xe04d('0x1d')]?_[_0xe04d('0x1c')](_0x502617[_0xe04d('0x1d')],function(_0x17444d){return{'model':db[_0x17444d[_0xe04d('0x1e')]],'as':_0x17444d['as'],'attributes':_0x17444d[_0xe04d('0x1a')],'include':_0x17444d[_0xe04d('0x1d')]?_[_0xe04d('0x1c')](_0x17444d[_0xe04d('0x1d')],function(_0x1075cf){return{'model':db[_0x1075cf['model']],'as':_0x1075cf['as'],'attributes':_0x1075cf[_0xe04d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cd0fb){logger[_0xe04d('0xe')](_0xe04d('0x1f'),_0x51d9ab);logger['debug'](_0xe04d('0x1f'),_0x51d9ab,JSON[_0xe04d('0x12')](_0x4cd0fb));_0x10fe34(_0x4cd0fb);})[_0xe04d('0x15')](function(_0x4d164a){logger[_0xe04d('0x13')]('GetDeskAccount',_0x4d164a[_0xe04d('0x14')],_0x51d9ab);_0xcbcca8(_0x4b9885['error'](0x1f4,_0x4d164a[_0xe04d('0x14')]));});});};exports['ShowDeskAccount']=function(_0x3a538a){var _0x261e5a=this;return new Promise(function(_0x4c9ca7,_0x30534e){return db['DeskAccount'][_0xe04d('0x20')]({'raw':_0x3a538a['options']?_0x3a538a[_0xe04d('0x18')][_0xe04d('0x21')]===undefined?!![]:![]:!![],'where':_0x3a538a[_0xe04d('0x18')]?_0x3a538a['options'][_0xe04d('0x19')]||null:null,'attributes':_0x3a538a[_0xe04d('0x18')]?_0x3a538a[_0xe04d('0x18')][_0xe04d('0x1a')]||null:null,'include':_0x3a538a['options']?_0x3a538a['options'][_0xe04d('0x1d')]?_[_0xe04d('0x1c')](_0x3a538a[_0xe04d('0x18')][_0xe04d('0x1d')],function(_0x469f53){return{'model':db[_0x469f53['model']],'as':_0x469f53['as'],'attributes':_0x469f53[_0xe04d('0x1a')],'include':_0x469f53[_0xe04d('0x1d')]?_[_0xe04d('0x1c')](_0x469f53['include'],function(_0x13918f){return{'model':db[_0x13918f[_0xe04d('0x1e')]],'as':_0x13918f['as'],'attributes':_0x13918f['attributes'],'include':_0x13918f['include']?_[_0xe04d('0x1c')](_0x13918f['include'],function(_0x225ab6){return{'model':db[_0x225ab6[_0xe04d('0x1e')]],'as':_0x225ab6['as'],'attributes':_0x225ab6[_0xe04d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe04d('0xd')](function(_0x213ffa){logger[_0xe04d('0xe')](_0xe04d('0x22'),_0x3a538a);logger[_0xe04d('0x11')](_0xe04d('0x22'),_0x3a538a,JSON['stringify'](_0x213ffa));_0x4c9ca7(_0x213ffa);})[_0xe04d('0x15')](function(_0x58e30f){logger[_0xe04d('0x13')](_0xe04d('0x22'),_0x58e30f[_0xe04d('0x14')],_0x3a538a);_0x30534e(_0x261e5a[_0xe04d('0x13')](0x1f4,_0x58e30f[_0xe04d('0x14')]));});});}; \ No newline at end of file +var _0xfefe=['code','message','result','catch','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','GetDeskAccount','debug','find','ShowDeskAccount','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2e7d49,_0x26ae35){var _0x1b7bf6=function(_0x3a354f){while(--_0x3a354f){_0x2e7d49['push'](_0x2e7d49['shift']());}};_0x1b7bf6(++_0x26ae35);}(_0xfefe,0x1e1));var _0xefef=function(_0x33aa95,_0x2fbe94){_0x33aa95=_0x33aa95-0x0;var _0x3ab137=_0xfefe[_0x33aa95];return _0x3ab137;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xefef('0x0'));var BPromise=require(_0xefef('0x1'));var rs=require(_0xefef('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefef('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xefef('0x4'))('rpc');var config=require(_0xefef('0x5'));var jayson=require(_0xefef('0x6'));var client=jayson[_0xefef('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3af896,_0x324e5e,_0x3f7233){return new BPromise(function(_0x186116,_0x4ccc52){return client['request'](_0x3af896,_0x3f7233)['then'](function(_0x3c74ec){logger[_0xefef('0x8')](_0xefef('0x9'),_0x324e5e,_0xefef('0xa'));logger['debug'](_0xefef('0xb'),_0x324e5e,_0xefef('0xa'),JSON[_0xefef('0xc')](_0x3c74ec));if(_0x3c74ec[_0xefef('0xd')]){if(_0x3c74ec[_0xefef('0xd')][_0xefef('0xe')]===0x1f4){logger[_0xefef('0xd')](_0xefef('0x9'),_0x324e5e,_0x3c74ec[_0xefef('0xd')][_0xefef('0xf')]);return _0x4ccc52(_0x3c74ec['error'][_0xefef('0xf')]);}logger[_0xefef('0xd')](_0xefef('0x9'),_0x324e5e,_0x3c74ec[_0xefef('0xd')][_0xefef('0xf')]);return _0x186116(_0x3c74ec[_0xefef('0xd')][_0xefef('0xf')]);}else{logger['info'](_0xefef('0x9'),_0x324e5e,_0xefef('0xa'));_0x186116(_0x3c74ec[_0xefef('0x10')][_0xefef('0xf')]);}})[_0xefef('0x11')](function(_0x25a4b4){logger['error'](_0xefef('0x9'),_0x324e5e,_0x25a4b4);_0x4ccc52(_0x25a4b4);});});}exports['GetDeskAccount']=function(_0x99dda5){var _0x494f88=this;return new Promise(function(_0x5021d9,_0x5533a6){return db[_0xefef('0x12')][_0xefef('0x13')]({'raw':_0x99dda5[_0xefef('0x14')]?_0x99dda5['options'][_0xefef('0x15')]===undefined?!![]:![]:!![],'where':_0x99dda5[_0xefef('0x14')]?_0x99dda5[_0xefef('0x14')][_0xefef('0x16')]||null:null,'attributes':_0x99dda5[_0xefef('0x14')]?_0x99dda5['options'][_0xefef('0x17')]||null:null,'limit':_0x99dda5[_0xefef('0x14')]?_0x99dda5['options'][_0xefef('0x18')]||null:null,'include':_0x99dda5[_0xefef('0x14')]?_0x99dda5['options'][_0xefef('0x19')]?_[_0xefef('0x1a')](_0x99dda5[_0xefef('0x14')][_0xefef('0x19')],function(_0x55898f){return{'model':db[_0x55898f[_0xefef('0x1b')]],'as':_0x55898f['as'],'attributes':_0x55898f[_0xefef('0x17')],'include':_0x55898f[_0xefef('0x19')]?_[_0xefef('0x1a')](_0x55898f[_0xefef('0x19')],function(_0x2de3ee){return{'model':db[_0x2de3ee['model']],'as':_0x2de3ee['as'],'attributes':_0x2de3ee[_0xefef('0x17')],'include':_0x2de3ee[_0xefef('0x19')]?_[_0xefef('0x1a')](_0x2de3ee[_0xefef('0x19')],function(_0x2f5245){return{'model':db[_0x2f5245[_0xefef('0x1b')]],'as':_0x2f5245['as'],'attributes':_0x2f5245['attributes']};}):[]};}):[]};}):[]:[]})[_0xefef('0x1c')](function(_0x33c90c){logger['info'](_0xefef('0x1d'),_0x99dda5);logger[_0xefef('0x1e')](_0xefef('0x1d'),_0x99dda5,JSON[_0xefef('0xc')](_0x33c90c));_0x5021d9(_0x33c90c);})['catch'](function(_0x666939){logger[_0xefef('0xd')]('GetDeskAccount',_0x666939['message'],_0x99dda5);_0x5533a6(_0x494f88[_0xefef('0xd')](0x1f4,_0x666939[_0xefef('0xf')]));});});};exports['ShowDeskAccount']=function(_0x5c0b67){var _0x4ba802=this;return new Promise(function(_0x217c94,_0x5c5560){return db[_0xefef('0x12')][_0xefef('0x1f')]({'raw':_0x5c0b67[_0xefef('0x14')]?_0x5c0b67['options'][_0xefef('0x15')]===undefined?!![]:![]:!![],'where':_0x5c0b67['options']?_0x5c0b67[_0xefef('0x14')][_0xefef('0x16')]||null:null,'attributes':_0x5c0b67[_0xefef('0x14')]?_0x5c0b67[_0xefef('0x14')][_0xefef('0x17')]||null:null,'include':_0x5c0b67[_0xefef('0x14')]?_0x5c0b67[_0xefef('0x14')][_0xefef('0x19')]?_[_0xefef('0x1a')](_0x5c0b67['options']['include'],function(_0x121a75){return{'model':db[_0x121a75[_0xefef('0x1b')]],'as':_0x121a75['as'],'attributes':_0x121a75[_0xefef('0x17')],'include':_0x121a75[_0xefef('0x19')]?_[_0xefef('0x1a')](_0x121a75[_0xefef('0x19')],function(_0x1a4e7a){return{'model':db[_0x1a4e7a[_0xefef('0x1b')]],'as':_0x1a4e7a['as'],'attributes':_0x1a4e7a[_0xefef('0x17')],'include':_0x1a4e7a[_0xefef('0x19')]?_['map'](_0x1a4e7a[_0xefef('0x19')],function(_0x5cbf7d){return{'model':db[_0x5cbf7d[_0xefef('0x1b')]],'as':_0x5cbf7d['as'],'attributes':_0x5cbf7d[_0xefef('0x17')]};}):[]};}):[]};}):[]:[]})[_0xefef('0x1c')](function(_0x3027c8){logger[_0xefef('0x8')](_0xefef('0x20'),_0x5c0b67);logger['debug'](_0xefef('0x20'),_0x5c0b67,JSON['stringify'](_0x3027c8));_0x217c94(_0x3027c8);})[_0xefef('0x11')](function(_0x40ffdd){logger[_0xefef('0xd')]('ShowDeskAccount',_0x40ffdd[_0xefef('0xf')],_0x5c0b67);_0x5c5560(_0x4ba802['error'](0x1f4,_0x40ffdd['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 17e02a3..518e00c 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 _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x11646a,_0xf8e0f5){var _0x4e30b6=function(_0x169f69){while(--_0x169f69){_0x11646a['push'](_0x11646a['shift']());}};_0x4e30b6(++_0xf8e0f5);}(_0x008c,0x188));var _0xc008=function(_0x2d98f1,_0x254499){_0x2d98f1=_0x2d98f1-0x0;var _0x5cbe38=_0x008c[_0x2d98f1];return _0x5cbe38;};'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('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x1988f8,_0x1bb155){var _0x906c03=function(_0x580187){while(--_0x580187){_0x1988f8['push'](_0x1988f8['shift']());}};_0x906c03(++_0x1bb155);}(_0x7217,0x19e));var _0x7721=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x7217[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index b6f1d1a..b0ac057 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 _0x3e47=['STRING','sequelize','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x3e47,0x79));var _0x73e4=function(_0x1a151a,_0x44325f){_0x1a151a=_0x1a151a-0x0;var _0x3ce862=_0x3e47[_0x1a151a];return _0x3ce862;};'use strict';var Sequelize=require(_0x73e4('0x0'));module[_0x73e4('0x1')]={'name':{'type':Sequelize[_0x73e4('0x2')]},'description':{'type':Sequelize[_0x73e4('0x2')]}}; \ No newline at end of file +var _0x10b4=['exports','STRING','sequelize'];(function(_0xf84c57,_0x714fd3){var _0x1bc23b=function(_0x555537){while(--_0x555537){_0xf84c57['push'](_0xf84c57['shift']());}};_0x1bc23b(++_0x714fd3);}(_0x10b4,0x74));var _0x410b=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x10b4[_0x3e112d];return _0x531c31;};'use strict';var Sequelize=require(_0x410b('0x0'));module[_0x410b('0x1')]={'name':{'type':Sequelize[_0x410b('0x2')]},'description':{'type':Sequelize[_0x410b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 2a7ba30..24a0155 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 _0x98eb=['set','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','then','params','length','catch','create','body','find','getFields','findOne','DeskField','order','nolimit','getSubjects','getDescriptions','getTags','Tag','hasOwnProperty','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','limit','undefined','count','status'];(function(_0x24bfe2,_0x4ba64a){var _0x53d71d=function(_0x3f4dee){while(--_0x3f4dee){_0x24bfe2['push'](_0x24bfe2['shift']());}};_0x53d71d(++_0x4ba64a);}(_0x98eb,0x12d));var _0xb98e=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0x98eb[_0x286bfb];return _0x52b683;};'use strict';var emlformat=require(_0xb98e('0x0'));var rimraf=require(_0xb98e('0x1'));var zipdir=require(_0xb98e('0x2'));var jsonpatch=require(_0xb98e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb98e('0x4'));var util=require(_0xb98e('0x5'));var path=require(_0xb98e('0x6'));var sox=require(_0xb98e('0x7'));var csv=require(_0xb98e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb98e('0x9'));var squel=require('squel');var crypto=require(_0xb98e('0xa'));var jsforce=require(_0xb98e('0xb'));var deskjs=require(_0xb98e('0xc'));var toCsv=require(_0xb98e('0x8'));var querystring=require(_0xb98e('0xd'));var Papa=require(_0xb98e('0xe'));var Redis=require(_0xb98e('0xf'));var authService=require(_0xb98e('0x10'));var qs=require(_0xb98e('0x11'));var as=require(_0xb98e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb98e('0x13'))('api');var utils=require(_0xb98e('0x14'));var config=require(_0xb98e('0x15'));var licenseUtil=require(_0xb98e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x361ba2,_0x5c6d8b){_0x5c6d8b=_0x5c6d8b||0xcc;return function(_0x1e3244){if(_0x1e3244){return _0x361ba2[_0xb98e('0x17')](_0x5c6d8b);}return _0x361ba2['status'](_0x5c6d8b)[_0xb98e('0x18')]();};}function respondWithResult(_0x45a3aa,_0x14ba57){_0x14ba57=_0x14ba57||0xc8;return function(_0x2868ef){if(_0x2868ef){return _0x45a3aa['status'](_0x14ba57)[_0xb98e('0x19')](_0x2868ef);}};}function respondWithFilteredResult(_0x276390,_0x18353f){return function(_0x2aa88a){if(_0x2aa88a){var _0x8edefd=typeof _0x18353f[_0xb98e('0x1a')]==='undefined'&&typeof _0x18353f[_0xb98e('0x1b')]===_0xb98e('0x1c');var _0x5e4159=_0x2aa88a[_0xb98e('0x1d')];var _0x54b621=_0x8edefd?0x0:_0x18353f[_0xb98e('0x1a')];var _0x16f180=_0x8edefd?_0x2aa88a[_0xb98e('0x1d')]:_0x18353f[_0xb98e('0x1a')]+_0x18353f[_0xb98e('0x1b')];var _0x4ecc1a;if(_0x16f180>=_0x5e4159){_0x16f180=_0x5e4159;_0x4ecc1a=0xc8;}else{_0x4ecc1a=0xce;}_0x276390[_0xb98e('0x1e')](_0x4ecc1a);return _0x276390[_0xb98e('0x1f')](_0xb98e('0x20'),_0x54b621+'-'+_0x16f180+'/'+_0x5e4159)[_0xb98e('0x19')](_0x2aa88a);}return null;};}function patchUpdates(_0x325b52){return function(_0x118d5d){try{jsonpatch[_0xb98e('0x21')](_0x118d5d,_0x325b52,!![]);}catch(_0x332bf7){return BPromise[_0xb98e('0x22')](_0x332bf7);}return _0x118d5d[_0xb98e('0x23')]();};}function saveUpdates(_0x46d99b,_0x2617f2){return function(_0x49837d){if(_0x49837d){return _0x49837d[_0xb98e('0x24')](_0x46d99b)['then'](function(_0x34e0f2){return _0x34e0f2;});}return null;};}function removeEntity(_0x1afe84,_0x3de9a2){return function(_0x35ded2){if(_0x35ded2){return _0x35ded2[_0xb98e('0x25')]()['then'](function(){_0x1afe84[_0xb98e('0x1e')](0xcc)[_0xb98e('0x18')]();});}};}function handleEntityNotFound(_0x5e6407,_0x213dcc){return function(_0x406efa){if(!_0x406efa){_0x5e6407[_0xb98e('0x17')](0x194);}return _0x406efa;};}function handleError(_0x282774,_0x569241){_0x569241=_0x569241||0x1f4;return function(_0x169255){logger[_0xb98e('0x26')](_0x169255[_0xb98e('0x27')]);if(_0x169255[_0xb98e('0x28')]){delete _0x169255[_0xb98e('0x28')];}_0x282774[_0xb98e('0x1e')](_0x569241)['send'](_0x169255);};}exports[_0xb98e('0x29')]=function(_0x356489,_0x3a9157){var _0x8a6f61={},_0x4f8856={},_0x541b12={'count':0x0,'rows':[]};var _0x514706=_[_0xb98e('0x2a')](db[_0xb98e('0x2b')][_0xb98e('0x2c')],function(_0x34e82c){return{'name':_0x34e82c[_0xb98e('0x2d')],'type':_0x34e82c[_0xb98e('0x2e')]['key']};});_0x4f8856['model']=_[_0xb98e('0x2a')](_0x514706,_0xb98e('0x28'));_0x4f8856[_0xb98e('0x2f')]=_[_0xb98e('0x30')](_0x356489[_0xb98e('0x2f')]);_0x4f8856[_0xb98e('0x31')]=_[_0xb98e('0x32')](_0x4f8856[_0xb98e('0x33')],_0x4f8856[_0xb98e('0x2f')]);_0x8a6f61[_0xb98e('0x34')]=_[_0xb98e('0x32')](_0x4f8856[_0xb98e('0x33')],qs[_0xb98e('0x35')](_0x356489[_0xb98e('0x2f')][_0xb98e('0x35')]));_0x8a6f61['attributes']=_0x8a6f61[_0xb98e('0x34')]['length']?_0x8a6f61[_0xb98e('0x34')]:_0x4f8856[_0xb98e('0x33')];if(!_0x356489['query']['hasOwnProperty']('nolimit')){_0x8a6f61[_0xb98e('0x1b')]=qs['limit'](_0x356489[_0xb98e('0x2f')][_0xb98e('0x1b')]);_0x8a6f61['offset']=qs[_0xb98e('0x1a')](_0x356489[_0xb98e('0x2f')][_0xb98e('0x1a')]);}_0x8a6f61['order']=qs[_0xb98e('0x36')](_0x356489['query'][_0xb98e('0x36')]);_0x8a6f61[_0xb98e('0x37')]=qs['filters'](_[_0xb98e('0x38')](_0x356489[_0xb98e('0x2f')],_0x4f8856[_0xb98e('0x31')]),_0x514706);if(_0x356489['query'][_0xb98e('0x39')]){_0x8a6f61['where']=_[_0xb98e('0x3a')](_0x8a6f61[_0xb98e('0x37')],{'$or':_[_0xb98e('0x2a')](_0x514706,function(_0x28678){if(_0x28678[_0xb98e('0x2e')]!==_0xb98e('0x3b')){var _0x3c3684={};_0x3c3684[_0x28678[_0xb98e('0x28')]]={'$like':'%'+_0x356489[_0xb98e('0x2f')][_0xb98e('0x39')]+'%'};return _0x3c3684;}})});}_0x8a6f61=_[_0xb98e('0x3a')]({},_0x8a6f61,_0x356489[_0xb98e('0x3c')]);var _0x17b723={'where':_0x8a6f61[_0xb98e('0x37')]};return db[_0xb98e('0x2b')]['count'](_0x17b723)['then'](function(_0x2e62d2){_0x541b12[_0xb98e('0x1d')]=_0x2e62d2;if(_0x356489[_0xb98e('0x2f')][_0xb98e('0x3d')]){_0x8a6f61[_0xb98e('0x3e')]=[{'all':!![]}];}return db[_0xb98e('0x2b')]['findAll'](_0x8a6f61);})['then'](function(_0x416757){_0x541b12[_0xb98e('0x3f')]=_0x416757;return _0x541b12;})[_0xb98e('0x40')](respondWithFilteredResult(_0x3a9157,_0x8a6f61))['catch'](handleError(_0x3a9157,null));};exports['show']=function(_0x28e1fa,_0x43ac32){var _0x4bbff0={'raw':![],'where':{'id':_0x28e1fa[_0xb98e('0x41')]['id']}},_0x36e4f1={};_0x36e4f1[_0xb98e('0x33')]=_[_0xb98e('0x30')](db[_0xb98e('0x2b')][_0xb98e('0x2c')]);_0x36e4f1['query']=_['keys'](_0x28e1fa[_0xb98e('0x2f')]);_0x36e4f1[_0xb98e('0x31')]=_[_0xb98e('0x32')](_0x36e4f1[_0xb98e('0x33')],_0x36e4f1[_0xb98e('0x2f')]);_0x4bbff0[_0xb98e('0x34')]=_[_0xb98e('0x32')](_0x36e4f1[_0xb98e('0x33')],qs['fields'](_0x28e1fa['query']['fields']));_0x4bbff0[_0xb98e('0x34')]=_0x4bbff0[_0xb98e('0x34')][_0xb98e('0x42')]?_0x4bbff0['attributes']:_0x36e4f1['model'];if(_0x28e1fa[_0xb98e('0x2f')][_0xb98e('0x3d')]){_0x4bbff0[_0xb98e('0x3e')]=[{'all':!![]}];}_0x4bbff0=_[_0xb98e('0x3a')]({},_0x4bbff0,_0x28e1fa[_0xb98e('0x3c')]);return db[_0xb98e('0x2b')]['find'](_0x4bbff0)['then'](handleEntityNotFound(_0x43ac32,null))[_0xb98e('0x40')](respondWithResult(_0x43ac32,null))[_0xb98e('0x43')](handleError(_0x43ac32,null));};exports[_0xb98e('0x44')]=function(_0x145c6c,_0x587cd9){return db[_0xb98e('0x2b')][_0xb98e('0x44')](_0x145c6c[_0xb98e('0x45')],{})[_0xb98e('0x40')](respondWithResult(_0x587cd9,0xc9))['catch'](handleError(_0x587cd9,null));};exports['update']=function(_0x42fe4e,_0x4a6e98){if(_0x42fe4e[_0xb98e('0x45')]['id']){delete _0x42fe4e[_0xb98e('0x45')]['id'];}return db[_0xb98e('0x2b')][_0xb98e('0x46')]({'where':{'id':_0x42fe4e[_0xb98e('0x41')]['id']}})[_0xb98e('0x40')](handleEntityNotFound(_0x4a6e98,null))[_0xb98e('0x40')](saveUpdates(_0x42fe4e['body'],null))[_0xb98e('0x40')](respondWithResult(_0x4a6e98,null))[_0xb98e('0x43')](handleError(_0x4a6e98,null));};exports['destroy']=function(_0x23d36e,_0x5c249d){return db['DeskConfiguration'][_0xb98e('0x46')]({'where':{'id':_0x23d36e['params']['id']}})[_0xb98e('0x40')](handleEntityNotFound(_0x5c249d,null))['then'](removeEntity(_0x5c249d,null))[_0xb98e('0x43')](handleError(_0x5c249d,null));};exports[_0xb98e('0x47')]=function(_0x192936,_0x1cf1bd,_0x2bfb65){var _0x503bf8={};var _0x4c9a8e={};var _0x349cb3;var _0x203763;return db['DeskConfiguration'][_0xb98e('0x48')]({'where':{'id':_0x192936[_0xb98e('0x41')]['id']}})[_0xb98e('0x40')](handleEntityNotFound(_0x1cf1bd,null))[_0xb98e('0x40')](function(_0x17b9be){if(_0x17b9be){_0x349cb3=_0x17b9be;_0x4c9a8e[_0xb98e('0x33')]=_[_0xb98e('0x30')](db[_0xb98e('0x49')]['rawAttributes']);_0x4c9a8e[_0xb98e('0x2f')]=_['keys'](_0x192936['query']);_0x4c9a8e[_0xb98e('0x31')]=_['intersection'](_0x4c9a8e[_0xb98e('0x33')],_0x4c9a8e['query']);_0x503bf8[_0xb98e('0x34')]=_[_0xb98e('0x32')](_0x4c9a8e[_0xb98e('0x33')],qs[_0xb98e('0x35')](_0x192936['query'][_0xb98e('0x35')]));_0x503bf8[_0xb98e('0x34')]=_0x503bf8[_0xb98e('0x34')][_0xb98e('0x42')]?_0x503bf8[_0xb98e('0x34')]:_0x4c9a8e[_0xb98e('0x33')];_0x503bf8[_0xb98e('0x4a')]=qs[_0xb98e('0x36')](_0x192936[_0xb98e('0x2f')][_0xb98e('0x36')]);_0x503bf8['where']=qs[_0xb98e('0x31')](_[_0xb98e('0x38')](_0x192936[_0xb98e('0x2f')],_0x4c9a8e['filters']));if(_0x192936['query'][_0xb98e('0x39')]){_0x503bf8[_0xb98e('0x37')]=_[_0xb98e('0x3a')](_0x503bf8['where'],{'$or':_[_0xb98e('0x2a')](_0x503bf8[_0xb98e('0x34')],function(_0x293f64){var _0xdd0077={};_0xdd0077[_0x293f64]={'$like':'%'+_0x192936['query'][_0xb98e('0x39')]+'%'};return _0xdd0077;})});}_0x503bf8=_['merge']({},_0x503bf8,_0x192936['options']);return _0x349cb3[_0xb98e('0x47')](_0x503bf8);}})['then'](function(_0x26035c){if(_0x26035c){_0x203763=_0x26035c[_0xb98e('0x42')];if(!_0x192936['query']['hasOwnProperty'](_0xb98e('0x4b'))){_0x503bf8[_0xb98e('0x1b')]=qs[_0xb98e('0x1b')](_0x192936[_0xb98e('0x2f')][_0xb98e('0x1b')]);_0x503bf8[_0xb98e('0x1a')]=qs[_0xb98e('0x1a')](_0x192936[_0xb98e('0x2f')][_0xb98e('0x1a')]);}return _0x349cb3[_0xb98e('0x47')](_0x503bf8);}})['then'](function(_0x4a11c8){if(_0x4a11c8){return _0x4a11c8?{'count':_0x203763,'rows':_0x4a11c8}:null;}})[_0xb98e('0x40')](respondWithResult(_0x1cf1bd,null))[_0xb98e('0x43')](handleError(_0x1cf1bd,null));};exports[_0xb98e('0x4c')]=function(_0x29b4ac,_0x257750,_0x4fe595){var _0x4a9384={};var _0x42658a={};var _0x556fe4;var _0x1c2968;return db[_0xb98e('0x2b')][_0xb98e('0x48')]({'where':{'id':_0x29b4ac['params']['id']}})[_0xb98e('0x40')](handleEntityNotFound(_0x257750,null))[_0xb98e('0x40')](function(_0x12c88f){if(_0x12c88f){_0x556fe4=_0x12c88f;_0x42658a[_0xb98e('0x33')]=_[_0xb98e('0x30')](db[_0xb98e('0x49')]['rawAttributes']);_0x42658a[_0xb98e('0x2f')]=_[_0xb98e('0x30')](_0x29b4ac['query']);_0x42658a['filters']=_['intersection'](_0x42658a[_0xb98e('0x33')],_0x42658a[_0xb98e('0x2f')]);_0x4a9384[_0xb98e('0x34')]=_[_0xb98e('0x32')](_0x42658a[_0xb98e('0x33')],qs[_0xb98e('0x35')](_0x29b4ac[_0xb98e('0x2f')][_0xb98e('0x35')]));_0x4a9384[_0xb98e('0x34')]=_0x4a9384[_0xb98e('0x34')]['length']?_0x4a9384[_0xb98e('0x34')]:_0x42658a[_0xb98e('0x33')];_0x4a9384[_0xb98e('0x4a')]=qs[_0xb98e('0x36')](_0x29b4ac[_0xb98e('0x2f')][_0xb98e('0x36')]);_0x4a9384['where']=qs[_0xb98e('0x31')](_['pick'](_0x29b4ac[_0xb98e('0x2f')],_0x42658a[_0xb98e('0x31')]));if(_0x29b4ac['query'][_0xb98e('0x39')]){_0x4a9384[_0xb98e('0x37')]=_[_0xb98e('0x3a')](_0x4a9384[_0xb98e('0x37')],{'$or':_[_0xb98e('0x2a')](_0x4a9384[_0xb98e('0x34')],function(_0x1e128d){var _0x42dcb0={};_0x42dcb0[_0x1e128d]={'$like':'%'+_0x29b4ac[_0xb98e('0x2f')][_0xb98e('0x39')]+'%'};return _0x42dcb0;})});}_0x4a9384=_[_0xb98e('0x3a')]({},_0x4a9384,_0x29b4ac[_0xb98e('0x3c')]);return _0x556fe4[_0xb98e('0x4c')](_0x4a9384);}})[_0xb98e('0x40')](function(_0x49ab0f){if(_0x49ab0f){_0x1c2968=_0x49ab0f[_0xb98e('0x42')];if(!_0x29b4ac[_0xb98e('0x2f')]['hasOwnProperty'](_0xb98e('0x4b'))){_0x4a9384[_0xb98e('0x1b')]=qs[_0xb98e('0x1b')](_0x29b4ac['query'][_0xb98e('0x1b')]);_0x4a9384[_0xb98e('0x1a')]=qs['offset'](_0x29b4ac[_0xb98e('0x2f')][_0xb98e('0x1a')]);}return _0x556fe4[_0xb98e('0x4c')](_0x4a9384);}})['then'](function(_0x55fa01){if(_0x55fa01){return _0x55fa01?{'count':_0x1c2968,'rows':_0x55fa01}:null;}})['then'](respondWithResult(_0x257750,null))[_0xb98e('0x43')](handleError(_0x257750,null));};exports[_0xb98e('0x4d')]=function(_0x1bde71,_0x41e083,_0x53c6f1){var _0x91e3bf={};var _0x33cd60={};var _0x5a9b37;var _0x150d95;return db[_0xb98e('0x2b')][_0xb98e('0x48')]({'where':{'id':_0x1bde71[_0xb98e('0x41')]['id']}})[_0xb98e('0x40')](handleEntityNotFound(_0x41e083,null))[_0xb98e('0x40')](function(_0x19b843){if(_0x19b843){_0x5a9b37=_0x19b843;_0x33cd60['model']=_[_0xb98e('0x30')](db[_0xb98e('0x49')][_0xb98e('0x2c')]);_0x33cd60[_0xb98e('0x2f')]=_[_0xb98e('0x30')](_0x1bde71['query']);_0x33cd60['filters']=_[_0xb98e('0x32')](_0x33cd60['model'],_0x33cd60[_0xb98e('0x2f')]);_0x91e3bf[_0xb98e('0x34')]=_['intersection'](_0x33cd60[_0xb98e('0x33')],qs[_0xb98e('0x35')](_0x1bde71[_0xb98e('0x2f')][_0xb98e('0x35')]));_0x91e3bf['attributes']=_0x91e3bf['attributes'][_0xb98e('0x42')]?_0x91e3bf[_0xb98e('0x34')]:_0x33cd60[_0xb98e('0x33')];_0x91e3bf[_0xb98e('0x4a')]=qs[_0xb98e('0x36')](_0x1bde71[_0xb98e('0x2f')]['sort']);_0x91e3bf[_0xb98e('0x37')]=qs[_0xb98e('0x31')](_[_0xb98e('0x38')](_0x1bde71[_0xb98e('0x2f')],_0x33cd60[_0xb98e('0x31')]));if(_0x1bde71['query'][_0xb98e('0x39')]){_0x91e3bf[_0xb98e('0x37')]=_[_0xb98e('0x3a')](_0x91e3bf[_0xb98e('0x37')],{'$or':_['map'](_0x91e3bf[_0xb98e('0x34')],function(_0x419630){var _0x45389d={};_0x45389d[_0x419630]={'$like':'%'+_0x1bde71['query'][_0xb98e('0x39')]+'%'};return _0x45389d;})});}_0x91e3bf=_[_0xb98e('0x3a')]({},_0x91e3bf,_0x1bde71[_0xb98e('0x3c')]);return _0x5a9b37[_0xb98e('0x4d')](_0x91e3bf);}})[_0xb98e('0x40')](function(_0x2fe0c8){if(_0x2fe0c8){_0x150d95=_0x2fe0c8[_0xb98e('0x42')];if(!_0x1bde71[_0xb98e('0x2f')]['hasOwnProperty'](_0xb98e('0x4b'))){_0x91e3bf['limit']=qs[_0xb98e('0x1b')](_0x1bde71[_0xb98e('0x2f')]['limit']);_0x91e3bf['offset']=qs[_0xb98e('0x1a')](_0x1bde71[_0xb98e('0x2f')][_0xb98e('0x1a')]);}return _0x5a9b37[_0xb98e('0x4d')](_0x91e3bf);}})[_0xb98e('0x40')](function(_0x52b27e){if(_0x52b27e){return _0x52b27e?{'count':_0x150d95,'rows':_0x52b27e}:null;}})[_0xb98e('0x40')](respondWithResult(_0x41e083,null))[_0xb98e('0x43')](handleError(_0x41e083,null));};exports[_0xb98e('0x4e')]=function(_0x5cefdb,_0x3471c5,_0x18a209){var _0x2a8142={};var _0x10e3d0={};var _0x5ac302;var _0x2c6f4d;return db['DeskConfiguration'][_0xb98e('0x48')]({'where':{'id':_0x5cefdb[_0xb98e('0x41')]['id']}})[_0xb98e('0x40')](handleEntityNotFound(_0x3471c5,null))[_0xb98e('0x40')](function(_0x37120d){if(_0x37120d){_0x5ac302=_0x37120d;_0x10e3d0['model']=_['keys'](db[_0xb98e('0x4f')][_0xb98e('0x2c')]);_0x10e3d0['query']=_[_0xb98e('0x30')](_0x5cefdb[_0xb98e('0x2f')]);_0x10e3d0[_0xb98e('0x31')]=_[_0xb98e('0x32')](_0x10e3d0[_0xb98e('0x33')],_0x10e3d0[_0xb98e('0x2f')]);_0x2a8142[_0xb98e('0x34')]=_['intersection'](_0x10e3d0[_0xb98e('0x33')],qs[_0xb98e('0x35')](_0x5cefdb['query'][_0xb98e('0x35')]));_0x2a8142[_0xb98e('0x34')]=_0x2a8142[_0xb98e('0x34')]['length']?_0x2a8142[_0xb98e('0x34')]:_0x10e3d0[_0xb98e('0x33')];_0x2a8142[_0xb98e('0x4a')]=qs[_0xb98e('0x36')](_0x5cefdb[_0xb98e('0x2f')][_0xb98e('0x36')]);_0x2a8142[_0xb98e('0x37')]=qs[_0xb98e('0x31')](_[_0xb98e('0x38')](_0x5cefdb[_0xb98e('0x2f')],_0x10e3d0[_0xb98e('0x31')]));if(_0x5cefdb[_0xb98e('0x2f')][_0xb98e('0x39')]){_0x2a8142[_0xb98e('0x37')]=_['merge'](_0x2a8142['where'],{'$or':_['map'](_0x2a8142[_0xb98e('0x34')],function(_0xf74a1){var _0x45ff2d={};_0x45ff2d[_0xf74a1]={'$like':'%'+_0x5cefdb[_0xb98e('0x2f')][_0xb98e('0x39')]+'%'};return _0x45ff2d;})});}_0x2a8142=_[_0xb98e('0x3a')]({},_0x2a8142,_0x5cefdb[_0xb98e('0x3c')]);return _0x5ac302[_0xb98e('0x4e')](_0x2a8142);}})['then'](function(_0x1746cd){if(_0x1746cd){_0x2c6f4d=_0x1746cd[_0xb98e('0x42')];if(!_0x5cefdb[_0xb98e('0x2f')][_0xb98e('0x50')](_0xb98e('0x4b'))){_0x2a8142['limit']=qs['limit'](_0x5cefdb['query'][_0xb98e('0x1b')]);_0x2a8142[_0xb98e('0x1a')]=qs[_0xb98e('0x1a')](_0x5cefdb[_0xb98e('0x2f')][_0xb98e('0x1a')]);}return _0x5ac302[_0xb98e('0x4e')](_0x2a8142);}})[_0xb98e('0x40')](function(_0xd1a810){if(_0xd1a810){return _0xd1a810?{'count':_0x2c6f4d,'rows':_0xd1a810}:null;}})[_0xb98e('0x40')](respondWithResult(_0x3471c5,null))[_0xb98e('0x43')](handleError(_0x3471c5,null));};exports[_0xb98e('0x51')]=function(_0x28883e,_0x640a5c,_0x4649e5){if(_0x28883e[_0xb98e('0x45')]['id']){delete _0x28883e[_0xb98e('0x45')]['id'];}return db[_0xb98e('0x2b')][_0xb98e('0x48')]({'where':{'id':_0x28883e[_0xb98e('0x41')]['id']}})[_0xb98e('0x40')](handleEntityNotFound(_0x640a5c,null))['then'](function(_0x5ed15b){if(_0x5ed15b){return _0x5ed15b[_0xb98e('0x51')](_0x28883e['body'][_0xb98e('0x52')]||[]);}return null;})[_0xb98e('0x40')](respondWithResult(_0x640a5c,null))[_0xb98e('0x43')](handleError(_0x640a5c,null));}; \ No newline at end of file +var _0xc4df=['attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','rows','catch','show','params','rawAttributes','options','find','create','update','body','getFields','findOne','getSubjects','DeskField','hasOwnProperty','getDescriptions','Tag','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','error','name','index','DeskConfiguration','fieldName','key','model','map','query','keys','filters','intersection'];(function(_0x418117,_0x5747c7){var _0x518f8a=function(_0x2f5324){while(--_0x2f5324){_0x418117['push'](_0x418117['shift']());}};_0x518f8a(++_0x5747c7);}(_0xc4df,0x1d4));var _0xfc4d=function(_0x17be5a,_0x4f56b2){_0x17be5a=_0x17be5a-0x0;var _0x1a2771=_0xc4df[_0x17be5a];return _0x1a2771;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc4d('0x0'));var zipdir=require(_0xfc4d('0x1'));var jsonpatch=require(_0xfc4d('0x2'));var rp=require(_0xfc4d('0x3'));var moment=require(_0xfc4d('0x4'));var BPromise=require(_0xfc4d('0x5'));var Mustache=require(_0xfc4d('0x6'));var util=require(_0xfc4d('0x7'));var path=require(_0xfc4d('0x8'));var sox=require(_0xfc4d('0x9'));var csv=require(_0xfc4d('0xa'));var ejs=require(_0xfc4d('0xb'));var fs=require('fs');var fs_extra=require(_0xfc4d('0xc'));var _=require(_0xfc4d('0xd'));var squel=require(_0xfc4d('0xe'));var crypto=require(_0xfc4d('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfc4d('0x10'));var Papa=require(_0xfc4d('0x11'));var Redis=require(_0xfc4d('0x12'));var authService=require(_0xfc4d('0x13'));var qs=require(_0xfc4d('0x14'));var as=require(_0xfc4d('0x15'));var hardwareService=require(_0xfc4d('0x16'));var logger=require(_0xfc4d('0x17'))(_0xfc4d('0x18'));var utils=require(_0xfc4d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xfc4d('0x1a'));var db=require(_0xfc4d('0x1b'))['db'];function respondWithStatusCode(_0x489303,_0x913087){_0x913087=_0x913087||0xcc;return function(_0x367c33){if(_0x367c33){return _0x489303[_0xfc4d('0x1c')](_0x913087);}return _0x489303[_0xfc4d('0x1d')](_0x913087)[_0xfc4d('0x1e')]();};}function respondWithResult(_0x24f5cd,_0x4fcbd4){_0x4fcbd4=_0x4fcbd4||0xc8;return function(_0x19a5eb){if(_0x19a5eb){return _0x24f5cd['status'](_0x4fcbd4)[_0xfc4d('0x1f')](_0x19a5eb);}};}function respondWithFilteredResult(_0x1ef93a,_0x12cb35){return function(_0x54c1b6){if(_0x54c1b6){var _0x127890=typeof _0x12cb35['offset']===_0xfc4d('0x20')&&typeof _0x12cb35[_0xfc4d('0x21')]===_0xfc4d('0x20');var _0x1f917a=_0x54c1b6[_0xfc4d('0x22')];var _0x53224c=_0x127890?0x0:_0x12cb35['offset'];var _0x58103c=_0x127890?_0x54c1b6[_0xfc4d('0x22')]:_0x12cb35[_0xfc4d('0x23')]+_0x12cb35[_0xfc4d('0x21')];var _0x301db5;if(_0x58103c>=_0x1f917a){_0x58103c=_0x1f917a;_0x301db5=0xc8;}else{_0x301db5=0xce;}_0x1ef93a[_0xfc4d('0x1d')](_0x301db5);return _0x1ef93a[_0xfc4d('0x24')]('Content-Range',_0x53224c+'-'+_0x58103c+'/'+_0x1f917a)[_0xfc4d('0x1f')](_0x54c1b6);}return null;};}function patchUpdates(_0x424811){return function(_0x5d953b){try{jsonpatch[_0xfc4d('0x25')](_0x5d953b,_0x424811,!![]);}catch(_0x885c7d){return BPromise[_0xfc4d('0x26')](_0x885c7d);}return _0x5d953b[_0xfc4d('0x27')]();};}function saveUpdates(_0x35716d,_0x593c85){return function(_0x29da64){if(_0x29da64){return _0x29da64['update'](_0x35716d)[_0xfc4d('0x28')](function(_0x4e35f2){return _0x4e35f2;});}return null;};}function removeEntity(_0xd97e6a,_0x10645b){return function(_0x1c4557){if(_0x1c4557){return _0x1c4557[_0xfc4d('0x29')]()[_0xfc4d('0x28')](function(){_0xd97e6a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45087b,_0x2e6e42){return function(_0xc2f15d){if(!_0xc2f15d){_0x45087b['sendStatus'](0x194);}return _0xc2f15d;};}function handleError(_0x3ea988,_0x95ca54){_0x95ca54=_0x95ca54||0x1f4;return function(_0x2abcbd){logger[_0xfc4d('0x2a')](_0x2abcbd['stack']);if(_0x2abcbd[_0xfc4d('0x2b')]){delete _0x2abcbd['name'];}_0x3ea988[_0xfc4d('0x1d')](_0x95ca54)['send'](_0x2abcbd);};}exports[_0xfc4d('0x2c')]=function(_0x5c7c25,_0x3c4692){var _0x34b040={},_0x3e2889={},_0x5a813b={'count':0x0,'rows':[]};var _0x49e417=_['map'](db[_0xfc4d('0x2d')]['rawAttributes'],function(_0x1d61f7){return{'name':_0x1d61f7[_0xfc4d('0x2e')],'type':_0x1d61f7['type'][_0xfc4d('0x2f')]};});_0x3e2889[_0xfc4d('0x30')]=_[_0xfc4d('0x31')](_0x49e417,'name');_0x3e2889[_0xfc4d('0x32')]=_[_0xfc4d('0x33')](_0x5c7c25['query']);_0x3e2889[_0xfc4d('0x34')]=_[_0xfc4d('0x35')](_0x3e2889[_0xfc4d('0x30')],_0x3e2889['query']);_0x34b040[_0xfc4d('0x36')]=_[_0xfc4d('0x35')](_0x3e2889['model'],qs[_0xfc4d('0x37')](_0x5c7c25[_0xfc4d('0x32')]['fields']));_0x34b040['attributes']=_0x34b040[_0xfc4d('0x36')][_0xfc4d('0x38')]?_0x34b040['attributes']:_0x3e2889[_0xfc4d('0x30')];if(!_0x5c7c25['query']['hasOwnProperty'](_0xfc4d('0x39'))){_0x34b040[_0xfc4d('0x21')]=qs[_0xfc4d('0x21')](_0x5c7c25['query'][_0xfc4d('0x21')]);_0x34b040['offset']=qs[_0xfc4d('0x23')](_0x5c7c25[_0xfc4d('0x32')][_0xfc4d('0x23')]);}_0x34b040[_0xfc4d('0x3a')]=qs[_0xfc4d('0x3b')](_0x5c7c25[_0xfc4d('0x32')]['sort']);_0x34b040[_0xfc4d('0x3c')]=qs['filters'](_[_0xfc4d('0x3d')](_0x5c7c25[_0xfc4d('0x32')],_0x3e2889[_0xfc4d('0x34')]),_0x49e417);if(_0x5c7c25[_0xfc4d('0x32')][_0xfc4d('0x3e')]){_0x34b040[_0xfc4d('0x3c')]=_[_0xfc4d('0x3f')](_0x34b040[_0xfc4d('0x3c')],{'$or':_['map'](_0x49e417,function(_0x4e84a9){if(_0x4e84a9[_0xfc4d('0x40')]!=='VIRTUAL'){var _0x55cece={};_0x55cece[_0x4e84a9[_0xfc4d('0x2b')]]={'$like':'%'+_0x5c7c25[_0xfc4d('0x32')][_0xfc4d('0x3e')]+'%'};return _0x55cece;}})});}_0x34b040=_[_0xfc4d('0x3f')]({},_0x34b040,_0x5c7c25['options']);var _0x555e5b={'where':_0x34b040[_0xfc4d('0x3c')]};return db[_0xfc4d('0x2d')]['count'](_0x555e5b)['then'](function(_0x31eaca){_0x5a813b[_0xfc4d('0x22')]=_0x31eaca;if(_0x5c7c25[_0xfc4d('0x32')][_0xfc4d('0x41')]){_0x34b040[_0xfc4d('0x42')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x34b040);})['then'](function(_0x414300){_0x5a813b[_0xfc4d('0x43')]=_0x414300;return _0x5a813b;})[_0xfc4d('0x28')](respondWithFilteredResult(_0x3c4692,_0x34b040))[_0xfc4d('0x44')](handleError(_0x3c4692,null));};exports[_0xfc4d('0x45')]=function(_0x3b7f2b,_0x446287){var _0x5f0c3a={'raw':![],'where':{'id':_0x3b7f2b[_0xfc4d('0x46')]['id']}},_0x417ef9={};_0x417ef9['model']=_['keys'](db[_0xfc4d('0x2d')][_0xfc4d('0x47')]);_0x417ef9[_0xfc4d('0x32')]=_[_0xfc4d('0x33')](_0x3b7f2b['query']);_0x417ef9[_0xfc4d('0x34')]=_[_0xfc4d('0x35')](_0x417ef9[_0xfc4d('0x30')],_0x417ef9[_0xfc4d('0x32')]);_0x5f0c3a[_0xfc4d('0x36')]=_['intersection'](_0x417ef9['model'],qs[_0xfc4d('0x37')](_0x3b7f2b[_0xfc4d('0x32')]['fields']));_0x5f0c3a['attributes']=_0x5f0c3a[_0xfc4d('0x36')][_0xfc4d('0x38')]?_0x5f0c3a[_0xfc4d('0x36')]:_0x417ef9[_0xfc4d('0x30')];if(_0x3b7f2b[_0xfc4d('0x32')]['includeAll']){_0x5f0c3a['include']=[{'all':!![]}];}_0x5f0c3a=_[_0xfc4d('0x3f')]({},_0x5f0c3a,_0x3b7f2b[_0xfc4d('0x48')]);return db[_0xfc4d('0x2d')][_0xfc4d('0x49')](_0x5f0c3a)[_0xfc4d('0x28')](handleEntityNotFound(_0x446287,null))[_0xfc4d('0x28')](respondWithResult(_0x446287,null))[_0xfc4d('0x44')](handleError(_0x446287,null));};exports[_0xfc4d('0x4a')]=function(_0x300b1e,_0x207046){return db[_0xfc4d('0x2d')]['create'](_0x300b1e['body'],{})['then'](respondWithResult(_0x207046,0xc9))[_0xfc4d('0x44')](handleError(_0x207046,null));};exports[_0xfc4d('0x4b')]=function(_0x977442,_0x2f0b17){if(_0x977442[_0xfc4d('0x4c')]['id']){delete _0x977442['body']['id'];}return db['DeskConfiguration'][_0xfc4d('0x49')]({'where':{'id':_0x977442[_0xfc4d('0x46')]['id']}})[_0xfc4d('0x28')](handleEntityNotFound(_0x2f0b17,null))[_0xfc4d('0x28')](saveUpdates(_0x977442[_0xfc4d('0x4c')],null))[_0xfc4d('0x28')](respondWithResult(_0x2f0b17,null))[_0xfc4d('0x44')](handleError(_0x2f0b17,null));};exports['destroy']=function(_0x488d76,_0x3e24c7){return db[_0xfc4d('0x2d')][_0xfc4d('0x49')]({'where':{'id':_0x488d76['params']['id']}})[_0xfc4d('0x28')](handleEntityNotFound(_0x3e24c7,null))[_0xfc4d('0x28')](removeEntity(_0x3e24c7,null))[_0xfc4d('0x44')](handleError(_0x3e24c7,null));};exports[_0xfc4d('0x4d')]=function(_0x37a415,_0x150a4e,_0x439746){var _0x2d6897={};var _0x1d12b6={};var _0x539805;var _0x2e7440;return db['DeskConfiguration'][_0xfc4d('0x4e')]({'where':{'id':_0x37a415[_0xfc4d('0x46')]['id']}})[_0xfc4d('0x28')](handleEntityNotFound(_0x150a4e,null))['then'](function(_0x1e794a){if(_0x1e794a){_0x539805=_0x1e794a;_0x1d12b6['model']=_[_0xfc4d('0x33')](db['DeskField'][_0xfc4d('0x47')]);_0x1d12b6[_0xfc4d('0x32')]=_[_0xfc4d('0x33')](_0x37a415[_0xfc4d('0x32')]);_0x1d12b6['filters']=_[_0xfc4d('0x35')](_0x1d12b6[_0xfc4d('0x30')],_0x1d12b6[_0xfc4d('0x32')]);_0x2d6897[_0xfc4d('0x36')]=_[_0xfc4d('0x35')](_0x1d12b6[_0xfc4d('0x30')],qs['fields'](_0x37a415[_0xfc4d('0x32')][_0xfc4d('0x37')]));_0x2d6897[_0xfc4d('0x36')]=_0x2d6897[_0xfc4d('0x36')][_0xfc4d('0x38')]?_0x2d6897['attributes']:_0x1d12b6[_0xfc4d('0x30')];_0x2d6897['order']=qs[_0xfc4d('0x3b')](_0x37a415['query'][_0xfc4d('0x3b')]);_0x2d6897[_0xfc4d('0x3c')]=qs[_0xfc4d('0x34')](_[_0xfc4d('0x3d')](_0x37a415[_0xfc4d('0x32')],_0x1d12b6[_0xfc4d('0x34')]));if(_0x37a415['query'][_0xfc4d('0x3e')]){_0x2d6897['where']=_[_0xfc4d('0x3f')](_0x2d6897['where'],{'$or':_[_0xfc4d('0x31')](_0x2d6897[_0xfc4d('0x36')],function(_0x34be7b){var _0x1b743e={};_0x1b743e[_0x34be7b]={'$like':'%'+_0x37a415['query']['filter']+'%'};return _0x1b743e;})});}_0x2d6897=_['merge']({},_0x2d6897,_0x37a415['options']);return _0x539805['getFields'](_0x2d6897);}})[_0xfc4d('0x28')](function(_0x44673d){if(_0x44673d){_0x2e7440=_0x44673d['length'];if(!_0x37a415[_0xfc4d('0x32')]['hasOwnProperty'](_0xfc4d('0x39'))){_0x2d6897[_0xfc4d('0x21')]=qs[_0xfc4d('0x21')](_0x37a415['query']['limit']);_0x2d6897[_0xfc4d('0x23')]=qs['offset'](_0x37a415[_0xfc4d('0x32')]['offset']);}return _0x539805[_0xfc4d('0x4d')](_0x2d6897);}})[_0xfc4d('0x28')](function(_0xaa941e){if(_0xaa941e){return _0xaa941e?{'count':_0x2e7440,'rows':_0xaa941e}:null;}})[_0xfc4d('0x28')](respondWithResult(_0x150a4e,null))['catch'](handleError(_0x150a4e,null));};exports[_0xfc4d('0x4f')]=function(_0x26b8d2,_0x3e2014,_0x2d1c57){var _0x25551d={};var _0x51cb9f={};var _0x3c0a10;var _0x597f55;return db[_0xfc4d('0x2d')][_0xfc4d('0x4e')]({'where':{'id':_0x26b8d2['params']['id']}})[_0xfc4d('0x28')](handleEntityNotFound(_0x3e2014,null))[_0xfc4d('0x28')](function(_0x1203ab){if(_0x1203ab){_0x3c0a10=_0x1203ab;_0x51cb9f[_0xfc4d('0x30')]=_[_0xfc4d('0x33')](db[_0xfc4d('0x50')][_0xfc4d('0x47')]);_0x51cb9f[_0xfc4d('0x32')]=_['keys'](_0x26b8d2[_0xfc4d('0x32')]);_0x51cb9f['filters']=_[_0xfc4d('0x35')](_0x51cb9f[_0xfc4d('0x30')],_0x51cb9f['query']);_0x25551d['attributes']=_['intersection'](_0x51cb9f[_0xfc4d('0x30')],qs[_0xfc4d('0x37')](_0x26b8d2[_0xfc4d('0x32')][_0xfc4d('0x37')]));_0x25551d[_0xfc4d('0x36')]=_0x25551d[_0xfc4d('0x36')]['length']?_0x25551d[_0xfc4d('0x36')]:_0x51cb9f[_0xfc4d('0x30')];_0x25551d[_0xfc4d('0x3a')]=qs[_0xfc4d('0x3b')](_0x26b8d2[_0xfc4d('0x32')][_0xfc4d('0x3b')]);_0x25551d[_0xfc4d('0x3c')]=qs[_0xfc4d('0x34')](_[_0xfc4d('0x3d')](_0x26b8d2[_0xfc4d('0x32')],_0x51cb9f[_0xfc4d('0x34')]));if(_0x26b8d2['query'][_0xfc4d('0x3e')]){_0x25551d[_0xfc4d('0x3c')]=_['merge'](_0x25551d[_0xfc4d('0x3c')],{'$or':_['map'](_0x25551d[_0xfc4d('0x36')],function(_0x57a873){var _0x2d8842={};_0x2d8842[_0x57a873]={'$like':'%'+_0x26b8d2[_0xfc4d('0x32')]['filter']+'%'};return _0x2d8842;})});}_0x25551d=_[_0xfc4d('0x3f')]({},_0x25551d,_0x26b8d2[_0xfc4d('0x48')]);return _0x3c0a10['getSubjects'](_0x25551d);}})[_0xfc4d('0x28')](function(_0x1e6ae1){if(_0x1e6ae1){_0x597f55=_0x1e6ae1['length'];if(!_0x26b8d2[_0xfc4d('0x32')][_0xfc4d('0x51')]('nolimit')){_0x25551d[_0xfc4d('0x21')]=qs[_0xfc4d('0x21')](_0x26b8d2['query'][_0xfc4d('0x21')]);_0x25551d[_0xfc4d('0x23')]=qs[_0xfc4d('0x23')](_0x26b8d2[_0xfc4d('0x32')]['offset']);}return _0x3c0a10[_0xfc4d('0x4f')](_0x25551d);}})[_0xfc4d('0x28')](function(_0x13cf08){if(_0x13cf08){return _0x13cf08?{'count':_0x597f55,'rows':_0x13cf08}:null;}})[_0xfc4d('0x28')](respondWithResult(_0x3e2014,null))[_0xfc4d('0x44')](handleError(_0x3e2014,null));};exports[_0xfc4d('0x52')]=function(_0x3e123d,_0x44545f,_0x315489){var _0x1a7de4={};var _0x21d243={};var _0x3e4124;var _0x4ae988;return db[_0xfc4d('0x2d')][_0xfc4d('0x4e')]({'where':{'id':_0x3e123d[_0xfc4d('0x46')]['id']}})[_0xfc4d('0x28')](handleEntityNotFound(_0x44545f,null))['then'](function(_0x16b4f9){if(_0x16b4f9){_0x3e4124=_0x16b4f9;_0x21d243[_0xfc4d('0x30')]=_[_0xfc4d('0x33')](db[_0xfc4d('0x50')][_0xfc4d('0x47')]);_0x21d243[_0xfc4d('0x32')]=_[_0xfc4d('0x33')](_0x3e123d[_0xfc4d('0x32')]);_0x21d243[_0xfc4d('0x34')]=_[_0xfc4d('0x35')](_0x21d243[_0xfc4d('0x30')],_0x21d243['query']);_0x1a7de4[_0xfc4d('0x36')]=_[_0xfc4d('0x35')](_0x21d243[_0xfc4d('0x30')],qs[_0xfc4d('0x37')](_0x3e123d['query'][_0xfc4d('0x37')]));_0x1a7de4[_0xfc4d('0x36')]=_0x1a7de4['attributes']['length']?_0x1a7de4['attributes']:_0x21d243[_0xfc4d('0x30')];_0x1a7de4[_0xfc4d('0x3a')]=qs[_0xfc4d('0x3b')](_0x3e123d[_0xfc4d('0x32')]['sort']);_0x1a7de4[_0xfc4d('0x3c')]=qs[_0xfc4d('0x34')](_[_0xfc4d('0x3d')](_0x3e123d[_0xfc4d('0x32')],_0x21d243['filters']));if(_0x3e123d[_0xfc4d('0x32')][_0xfc4d('0x3e')]){_0x1a7de4['where']=_[_0xfc4d('0x3f')](_0x1a7de4['where'],{'$or':_['map'](_0x1a7de4[_0xfc4d('0x36')],function(_0x4441c3){var _0xf80ed0={};_0xf80ed0[_0x4441c3]={'$like':'%'+_0x3e123d[_0xfc4d('0x32')][_0xfc4d('0x3e')]+'%'};return _0xf80ed0;})});}_0x1a7de4=_['merge']({},_0x1a7de4,_0x3e123d[_0xfc4d('0x48')]);return _0x3e4124[_0xfc4d('0x52')](_0x1a7de4);}})[_0xfc4d('0x28')](function(_0x5f5113){if(_0x5f5113){_0x4ae988=_0x5f5113[_0xfc4d('0x38')];if(!_0x3e123d[_0xfc4d('0x32')][_0xfc4d('0x51')](_0xfc4d('0x39'))){_0x1a7de4[_0xfc4d('0x21')]=qs[_0xfc4d('0x21')](_0x3e123d['query'][_0xfc4d('0x21')]);_0x1a7de4[_0xfc4d('0x23')]=qs[_0xfc4d('0x23')](_0x3e123d['query'][_0xfc4d('0x23')]);}return _0x3e4124[_0xfc4d('0x52')](_0x1a7de4);}})[_0xfc4d('0x28')](function(_0x935f61){if(_0x935f61){return _0x935f61?{'count':_0x4ae988,'rows':_0x935f61}:null;}})[_0xfc4d('0x28')](respondWithResult(_0x44545f,null))[_0xfc4d('0x44')](handleError(_0x44545f,null));};exports['getTags']=function(_0x5e3adb,_0x2b2026,_0x4045c9){var _0x2fdc55={};var _0x5f3b54={};var _0xb58d38;var _0x44a71a;return db[_0xfc4d('0x2d')][_0xfc4d('0x4e')]({'where':{'id':_0x5e3adb[_0xfc4d('0x46')]['id']}})[_0xfc4d('0x28')](handleEntityNotFound(_0x2b2026,null))['then'](function(_0x21b422){if(_0x21b422){_0xb58d38=_0x21b422;_0x5f3b54['model']=_[_0xfc4d('0x33')](db[_0xfc4d('0x53')]['rawAttributes']);_0x5f3b54[_0xfc4d('0x32')]=_[_0xfc4d('0x33')](_0x5e3adb[_0xfc4d('0x32')]);_0x5f3b54[_0xfc4d('0x34')]=_[_0xfc4d('0x35')](_0x5f3b54[_0xfc4d('0x30')],_0x5f3b54['query']);_0x2fdc55[_0xfc4d('0x36')]=_['intersection'](_0x5f3b54[_0xfc4d('0x30')],qs['fields'](_0x5e3adb[_0xfc4d('0x32')][_0xfc4d('0x37')]));_0x2fdc55['attributes']=_0x2fdc55[_0xfc4d('0x36')]['length']?_0x2fdc55[_0xfc4d('0x36')]:_0x5f3b54[_0xfc4d('0x30')];_0x2fdc55[_0xfc4d('0x3a')]=qs[_0xfc4d('0x3b')](_0x5e3adb[_0xfc4d('0x32')][_0xfc4d('0x3b')]);_0x2fdc55[_0xfc4d('0x3c')]=qs[_0xfc4d('0x34')](_['pick'](_0x5e3adb[_0xfc4d('0x32')],_0x5f3b54[_0xfc4d('0x34')]));if(_0x5e3adb[_0xfc4d('0x32')][_0xfc4d('0x3e')]){_0x2fdc55['where']=_[_0xfc4d('0x3f')](_0x2fdc55[_0xfc4d('0x3c')],{'$or':_[_0xfc4d('0x31')](_0x2fdc55[_0xfc4d('0x36')],function(_0x2d2041){var _0x193e56={};_0x193e56[_0x2d2041]={'$like':'%'+_0x5e3adb[_0xfc4d('0x32')][_0xfc4d('0x3e')]+'%'};return _0x193e56;})});}_0x2fdc55=_[_0xfc4d('0x3f')]({},_0x2fdc55,_0x5e3adb['options']);return _0xb58d38[_0xfc4d('0x54')](_0x2fdc55);}})[_0xfc4d('0x28')](function(_0x13511e){if(_0x13511e){_0x44a71a=_0x13511e[_0xfc4d('0x38')];if(!_0x5e3adb[_0xfc4d('0x32')][_0xfc4d('0x51')](_0xfc4d('0x39'))){_0x2fdc55[_0xfc4d('0x21')]=qs['limit'](_0x5e3adb['query'][_0xfc4d('0x21')]);_0x2fdc55[_0xfc4d('0x23')]=qs[_0xfc4d('0x23')](_0x5e3adb[_0xfc4d('0x32')][_0xfc4d('0x23')]);}return _0xb58d38['getTags'](_0x2fdc55);}})[_0xfc4d('0x28')](function(_0xd9d860){if(_0xd9d860){return _0xd9d860?{'count':_0x44a71a,'rows':_0xd9d860}:null;}})[_0xfc4d('0x28')](respondWithResult(_0x2b2026,null))[_0xfc4d('0x44')](handleError(_0x2b2026,null));};exports[_0xfc4d('0x55')]=function(_0x37d9f2,_0x349f33,_0x50a35d){if(_0x37d9f2['body']['id']){delete _0x37d9f2[_0xfc4d('0x4c')]['id'];}return db[_0xfc4d('0x2d')][_0xfc4d('0x4e')]({'where':{'id':_0x37d9f2[_0xfc4d('0x46')]['id']}})[_0xfc4d('0x28')](handleEntityNotFound(_0x349f33,null))[_0xfc4d('0x28')](function(_0x336f80){if(_0x336f80){return _0x336f80[_0xfc4d('0x55')](_0x37d9f2[_0xfc4d('0x4c')][_0xfc4d('0x56')]||[]);}return null;})[_0xfc4d('0x28')](respondWithResult(_0x349f33,null))[_0xfc4d('0x44')](handleError(_0x349f33,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 35003f6..f8518a5 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 _0x196d=['util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x553183,_0x5479b4){var _0xfc0ebe=function(_0x4a2bbf){while(--_0x4a2bbf){_0x553183['push'](_0x553183['shift']());}};_0xfc0ebe(++_0x5479b4);}(_0x196d,0x112));var _0xd196=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x196d[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xd196('0x0'));var util=require(_0xd196('0x1'));var logger=require(_0xd196('0x2'))('api');var moment=require(_0xd196('0x3'));var BPromise=require('bluebird');var rp=require(_0xd196('0x4'));var fs=require('fs');var path=require(_0xd196('0x5'));var rimraf=require('rimraf');var config=require(_0xd196('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0xd196('0x7')]=function(_0x4918d9,_0x268927){return _0x4918d9[_0xd196('0x8')](_0xd196('0x9'),attributes,{'tableName':_0xd196('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2524=['bluebird','request-promise','rimraf','../../config/environment','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','moment'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0x2524,0x8c));var _0x4252=function(_0x3efb88,_0x3509c6){_0x3efb88=_0x3efb88-0x0;var _0x3115ef=_0x2524[_0x3efb88];return _0x3115ef;};'use strict';var _=require(_0x4252('0x0'));var util=require(_0x4252('0x1'));var logger=require('../../config/logger')(_0x4252('0x2'));var moment=require(_0x4252('0x3'));var BPromise=require(_0x4252('0x4'));var rp=require(_0x4252('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4252('0x6'));var config=require(_0x4252('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0x4252('0x8')]=function(_0x40e8a8,_0x24ef55){return _0x40e8a8[_0x4252('0x9')](_0x4252('0xa'),attributes,{'tableName':_0x4252('0xb'),'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 ca7e812..d01fcc4 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 _0x5eca=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x5f44cb,_0x564cc1){var _0x5ca561=function(_0x309f40){while(--_0x309f40){_0x5f44cb['push'](_0x5f44cb['shift']());}};_0x5ca561(++_0x564cc1);}(_0x5eca,0x10e));var _0xa5ec=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5eca[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xa5ec('0x0'));var util=require(_0xa5ec('0x1'));var moment=require(_0xa5ec('0x2'));var BPromise=require(_0xa5ec('0x3'));var rs=require(_0xa5ec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa5ec('0x6'));var config=require(_0xa5ec('0x7'));var jayson=require(_0xa5ec('0x8'));var client=jayson[_0xa5ec('0x9')][_0xa5ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cdf5e,_0x127519,_0x5f314e){return new BPromise(function(_0x436828,_0x65aa33){return client['request'](_0x2cdf5e,_0x5f314e)[_0xa5ec('0xb')](function(_0x4e60cc){logger[_0xa5ec('0xc')](_0xa5ec('0xd'),_0x127519,_0xa5ec('0xe'));logger['debug'](_0xa5ec('0xf'),_0x127519,_0xa5ec('0xe'),JSON[_0xa5ec('0x10')](_0x4e60cc));if(_0x4e60cc[_0xa5ec('0x11')]){if(_0x4e60cc[_0xa5ec('0x11')][_0xa5ec('0x12')]===0x1f4){logger[_0xa5ec('0x11')](_0xa5ec('0xd'),_0x127519,_0x4e60cc[_0xa5ec('0x11')][_0xa5ec('0x13')]);return _0x65aa33(_0x4e60cc[_0xa5ec('0x11')][_0xa5ec('0x13')]);}logger[_0xa5ec('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x127519,_0x4e60cc[_0xa5ec('0x11')][_0xa5ec('0x13')]);return _0x436828(_0x4e60cc[_0xa5ec('0x11')][_0xa5ec('0x13')]);}else{logger[_0xa5ec('0xc')](_0xa5ec('0xd'),_0x127519,'request\x20sent');_0x436828(_0x4e60cc[_0xa5ec('0x14')]['message']);}})[_0xa5ec('0x15')](function(_0x35e4a7){logger[_0xa5ec('0x11')](_0xa5ec('0xd'),_0x127519,_0x35e4a7);_0x65aa33(_0x35e4a7);});});} \ No newline at end of file +var _0xb36b=['then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5cbaae,_0xf01db1){var _0xd164d5=function(_0x5cca83){while(--_0x5cca83){_0x5cbaae['push'](_0x5cbaae['shift']());}};_0xd164d5(++_0xf01db1);}(_0xb36b,0xac));var _0xbb36=function(_0x39d074,_0xd3f6c0){_0x39d074=_0x39d074-0x0;var _0x16cafb=_0xb36b[_0x39d074];return _0x16cafb;};'use strict';var _=require(_0xbb36('0x0'));var util=require('util');var moment=require(_0xbb36('0x1'));var BPromise=require(_0xbb36('0x2'));var rs=require(_0xbb36('0x3'));var fs=require('fs');var Redis=require(_0xbb36('0x4'));var db=require(_0xbb36('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb36('0x6'))(_0xbb36('0x7'));var config=require(_0xbb36('0x8'));var jayson=require(_0xbb36('0x9'));var client=jayson[_0xbb36('0xa')][_0xbb36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe65cd3,_0xaa6b59,_0x3450c4){return new BPromise(function(_0x16f3f2,_0x4d3458){return client['request'](_0xe65cd3,_0x3450c4)[_0xbb36('0xc')](function(_0x4cc282){logger['info'](_0xbb36('0xd'),_0xaa6b59,_0xbb36('0xe'));logger[_0xbb36('0xf')](_0xbb36('0x10'),_0xaa6b59,_0xbb36('0xe'),JSON['stringify'](_0x4cc282));if(_0x4cc282[_0xbb36('0x11')]){if(_0x4cc282[_0xbb36('0x11')][_0xbb36('0x12')]===0x1f4){logger[_0xbb36('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0xaa6b59,_0x4cc282[_0xbb36('0x11')][_0xbb36('0x13')]);return _0x4d3458(_0x4cc282[_0xbb36('0x11')][_0xbb36('0x13')]);}logger[_0xbb36('0x11')](_0xbb36('0xd'),_0xaa6b59,_0x4cc282[_0xbb36('0x11')][_0xbb36('0x13')]);return _0x16f3f2(_0x4cc282[_0xbb36('0x11')][_0xbb36('0x13')]);}else{logger[_0xbb36('0x14')]('DeskConfiguration,\x20%s,\x20%s',_0xaa6b59,_0xbb36('0xe'));_0x16f3f2(_0x4cc282[_0xbb36('0x15')][_0xbb36('0x13')]);}})[_0xbb36('0x16')](function(_0x3941ab){logger[_0xbb36('0x11')](_0xbb36('0xd'),_0xaa6b59,_0x3941ab);_0x4d3458(_0x3941ab);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index a4ed926..27ba77b 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 _0x48e3=['../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','post','/:id','exports','multer','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48e3,0x1ea));var _0x348e=function(_0x1c5026,_0x44676f){_0x1c5026=_0x1c5026-0x0;var _0x2c65df=_0x48e3[_0x1c5026];return _0x2c65df;};'use strict';var multer=require(_0x348e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x348e('0x1'));var express=require(_0x348e('0x2'));var router=express[_0x348e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x348e('0x4'));var config=require(_0x348e('0x5'));var controller=require(_0x348e('0x6'));router['get']('/',auth[_0x348e('0x7')](),controller[_0x348e('0x8')]);router[_0x348e('0x9')]('/:id',auth[_0x348e('0x7')](),controller['show']);router[_0x348e('0xa')]('/',auth[_0x348e('0x7')](),controller['create']);router['put'](_0x348e('0xb'),auth[_0x348e('0x7')](),controller['update']);router['delete'](_0x348e('0xb'),auth[_0x348e('0x7')](),controller['destroy']);module[_0x348e('0xc')]=router; \ No newline at end of file +var _0x9a55=['exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','post','update','delete','destroy'];(function(_0x462150,_0x48ac37){var _0x28a15c=function(_0x43057b){while(--_0x43057b){_0x462150['push'](_0x462150['shift']());}};_0x28a15c(++_0x48ac37);}(_0x9a55,0xe2));var _0x59a5=function(_0x333f89,_0x45a9d5){_0x333f89=_0x333f89-0x0;var _0xf217a=_0x9a55[_0x333f89];return _0xf217a;};'use strict';var multer=require(_0x59a5('0x0'));var util=require('util');var path=require(_0x59a5('0x1'));var timeout=require(_0x59a5('0x2'));var express=require(_0x59a5('0x3'));var router=express['Router']();var fs_extra=require(_0x59a5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x59a5('0x5'));var controller=require('./intDeskField.controller');router[_0x59a5('0x6')]('/',auth[_0x59a5('0x7')](),controller[_0x59a5('0x8')]);router[_0x59a5('0x6')](_0x59a5('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x59a5('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x59a5('0x9'),auth['isAuthenticated'](),controller[_0x59a5('0xb')]);router[_0x59a5('0xc')](_0x59a5('0x9'),auth[_0x59a5('0x7')](),controller[_0x59a5('0xd')]);module[_0x59a5('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 0eb2bd6..793a328 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 _0x5b93=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x2dc5b7,_0x3837ba){var _0x4edb5b=function(_0x3ed644){while(--_0x3ed644){_0x2dc5b7['push'](_0x2dc5b7['shift']());}};_0x4edb5b(++_0x3837ba);}(_0x5b93,0x12c));var _0x35b9=function(_0x24a55c,_0x120790){_0x24a55c=_0x24a55c-0x0;var _0x9344e7=_0x5b93[_0x24a55c];return _0x9344e7;};'use strict';var Sequelize=require(_0x35b9('0x0'));module[_0x35b9('0x1')]={'type':{'type':Sequelize[_0x35b9('0x2')](_0x35b9('0x3'),_0x35b9('0x4'),_0x35b9('0x5'),_0x35b9('0x6'),_0x35b9('0x7')),'defaultValue':_0x35b9('0x3')},'content':{'type':Sequelize[_0x35b9('0x8')]},'key':{'type':Sequelize[_0x35b9('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x35b9('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x35b9('0x8')]},'idField':{'type':Sequelize[_0x35b9('0x8')]},'nameField':{'type':Sequelize[_0x35b9('0x8')]},'customField':{'type':Sequelize[_0x35b9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x35b9('0x8')]}}; \ No newline at end of file +var _0x1cb2=['exports','string','customVariable','picklist','STRING','ENUM','variable','BOOLEAN'];(function(_0x45883a,_0x237d28){var _0x20af68=function(_0x51a0ad){while(--_0x51a0ad){_0x45883a['push'](_0x45883a['shift']());}};_0x20af68(++_0x237d28);}(_0x1cb2,0xe8));var _0x21cb=function(_0xb867a8,_0x926a63){_0xb867a8=_0xb867a8-0x0;var _0x1e5dcd=_0x1cb2[_0xb867a8];return _0x1e5dcd;};'use strict';var Sequelize=require('sequelize');module[_0x21cb('0x0')]={'type':{'type':Sequelize['ENUM'](_0x21cb('0x1'),'variable',_0x21cb('0x2'),'keyValue',_0x21cb('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x21cb('0x4')]},'key':{'type':Sequelize[_0x21cb('0x4')]},'keyType':{'type':Sequelize[_0x21cb('0x5')](_0x21cb('0x1'),_0x21cb('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x21cb('0x4')]},'idField':{'type':Sequelize[_0x21cb('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x21cb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x21cb('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index cf7eba7..3a2d68b 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 _0x7374=['to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x3aac62,_0x370953){var _0x1e77f7=function(_0x487c16){while(--_0x487c16){_0x3aac62['push'](_0x3aac62['shift']());}};_0x1e77f7(++_0x370953);}(_0x7374,0x1b9));var _0x4737=function(_0x196957,_0x29331f){_0x196957=_0x196957-0x0;var _0x435a8d=_0x7374[_0x196957];return _0x435a8d;};'use strict';var emlformat=require(_0x4737('0x0'));var rimraf=require(_0x4737('0x1'));var zipdir=require(_0x4737('0x2'));var jsonpatch=require(_0x4737('0x3'));var rp=require(_0x4737('0x4'));var moment=require('moment');var BPromise=require(_0x4737('0x5'));var Mustache=require(_0x4737('0x6'));var util=require(_0x4737('0x7'));var path=require(_0x4737('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4737('0x9'));var fs=require('fs');var fs_extra=require(_0x4737('0xa'));var _=require(_0x4737('0xb'));var squel=require(_0x4737('0xc'));var crypto=require('crypto');var jsforce=require(_0x4737('0xd'));var deskjs=require(_0x4737('0xe'));var toCsv=require(_0x4737('0xf'));var querystring=require(_0x4737('0x10'));var Papa=require(_0x4737('0x11'));var Redis=require('ioredis');var authService=require(_0x4737('0x12'));var qs=require(_0x4737('0x13'));var as=require(_0x4737('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4737('0x15'));var utils=require(_0x4737('0x16'));var config=require(_0x4737('0x17'));var licenseUtil=require(_0x4737('0x18'));var db=require(_0x4737('0x19'))['db'];function respondWithStatusCode(_0xe662e8,_0x438f1d){_0x438f1d=_0x438f1d||0xcc;return function(_0xa7c11){if(_0xa7c11){return _0xe662e8[_0x4737('0x1a')](_0x438f1d);}return _0xe662e8['status'](_0x438f1d)[_0x4737('0x1b')]();};}function respondWithResult(_0x301753,_0x69f87b){_0x69f87b=_0x69f87b||0xc8;return function(_0xc7fceb){if(_0xc7fceb){return _0x301753[_0x4737('0x1c')](_0x69f87b)['json'](_0xc7fceb);}};}function respondWithFilteredResult(_0x4c1a5a,_0xeb4aa2){return function(_0x48a8c3){if(_0x48a8c3){var _0x470ed4=typeof _0xeb4aa2[_0x4737('0x1d')]==='undefined'&&typeof _0xeb4aa2[_0x4737('0x1e')]===_0x4737('0x1f');var _0xef032a=_0x48a8c3['count'];var _0x2d2c32=_0x470ed4?0x0:_0xeb4aa2['offset'];var _0x37b74d=_0x470ed4?_0x48a8c3[_0x4737('0x20')]:_0xeb4aa2[_0x4737('0x1d')]+_0xeb4aa2[_0x4737('0x1e')];var _0x1b2183;if(_0x37b74d>=_0xef032a){_0x37b74d=_0xef032a;_0x1b2183=0xc8;}else{_0x1b2183=0xce;}_0x4c1a5a['status'](_0x1b2183);return _0x4c1a5a[_0x4737('0x21')](_0x4737('0x22'),_0x2d2c32+'-'+_0x37b74d+'/'+_0xef032a)[_0x4737('0x23')](_0x48a8c3);}return null;};}function patchUpdates(_0x354b71){return function(_0x54c899){try{jsonpatch[_0x4737('0x24')](_0x54c899,_0x354b71,!![]);}catch(_0x5d9ed4){return BPromise[_0x4737('0x25')](_0x5d9ed4);}return _0x54c899[_0x4737('0x26')]();};}function saveUpdates(_0x4c1292,_0x67fac){return function(_0x1c004f){if(_0x1c004f){return _0x1c004f[_0x4737('0x27')](_0x4c1292)[_0x4737('0x28')](function(_0x56d82f){return _0x56d82f;});}return null;};}function removeEntity(_0x116ef4,_0x2ce99e){return function(_0x49eddf){if(_0x49eddf){return _0x49eddf[_0x4737('0x29')]()['then'](function(){_0x116ef4[_0x4737('0x1c')](0xcc)[_0x4737('0x1b')]();});}};}function handleEntityNotFound(_0x3df6c5,_0x10685f){return function(_0xe8e844){if(!_0xe8e844){_0x3df6c5[_0x4737('0x1a')](0x194);}return _0xe8e844;};}function handleError(_0x542c14,_0x1cc0c7){_0x1cc0c7=_0x1cc0c7||0x1f4;return function(_0x52c764){logger[_0x4737('0x2a')](_0x52c764['stack']);if(_0x52c764[_0x4737('0x2b')]){delete _0x52c764[_0x4737('0x2b')];}_0x542c14[_0x4737('0x1c')](_0x1cc0c7)['send'](_0x52c764);};}exports['index']=function(_0x2d7486,_0x43d44a){var _0x14e4a2={},_0x2d587c={},_0x235f7b={'count':0x0,'rows':[]};var _0x5d6a2a=_[_0x4737('0x2c')](db[_0x4737('0x2d')][_0x4737('0x2e')],function(_0x31f2cd){return{'name':_0x31f2cd[_0x4737('0x2f')],'type':_0x31f2cd[_0x4737('0x30')][_0x4737('0x31')]};});_0x2d587c[_0x4737('0x32')]=_['map'](_0x5d6a2a,_0x4737('0x2b'));_0x2d587c[_0x4737('0x33')]=_[_0x4737('0x34')](_0x2d7486[_0x4737('0x33')]);_0x2d587c[_0x4737('0x35')]=_[_0x4737('0x36')](_0x2d587c[_0x4737('0x32')],_0x2d587c[_0x4737('0x33')]);_0x14e4a2[_0x4737('0x37')]=_['intersection'](_0x2d587c['model'],qs[_0x4737('0x38')](_0x2d7486[_0x4737('0x33')]['fields']));_0x14e4a2[_0x4737('0x37')]=_0x14e4a2[_0x4737('0x37')][_0x4737('0x39')]?_0x14e4a2[_0x4737('0x37')]:_0x2d587c[_0x4737('0x32')];if(!_0x2d7486[_0x4737('0x33')][_0x4737('0x3a')](_0x4737('0x3b'))){_0x14e4a2[_0x4737('0x1e')]=qs[_0x4737('0x1e')](_0x2d7486['query'][_0x4737('0x1e')]);_0x14e4a2[_0x4737('0x1d')]=qs[_0x4737('0x1d')](_0x2d7486[_0x4737('0x33')]['offset']);}_0x14e4a2['order']=qs[_0x4737('0x3c')](_0x2d7486['query'][_0x4737('0x3c')]);_0x14e4a2[_0x4737('0x3d')]=qs['filters'](_[_0x4737('0x3e')](_0x2d7486[_0x4737('0x33')],_0x2d587c[_0x4737('0x35')]),_0x5d6a2a);if(_0x2d7486[_0x4737('0x33')][_0x4737('0x3f')]){_0x14e4a2[_0x4737('0x3d')]=_[_0x4737('0x40')](_0x14e4a2['where'],{'$or':_[_0x4737('0x2c')](_0x5d6a2a,function(_0x133744){if(_0x133744[_0x4737('0x30')]!==_0x4737('0x41')){var _0x658ea3={};_0x658ea3[_0x133744[_0x4737('0x2b')]]={'$like':'%'+_0x2d7486['query'][_0x4737('0x3f')]+'%'};return _0x658ea3;}})});}_0x14e4a2=_[_0x4737('0x40')]({},_0x14e4a2,_0x2d7486[_0x4737('0x42')]);var _0x4bd105={'where':_0x14e4a2['where']};return db[_0x4737('0x2d')][_0x4737('0x20')](_0x4bd105)['then'](function(_0x27bc72){_0x235f7b[_0x4737('0x20')]=_0x27bc72;if(_0x2d7486[_0x4737('0x33')][_0x4737('0x43')]){_0x14e4a2[_0x4737('0x44')]=[{'all':!![]}];}return db[_0x4737('0x2d')][_0x4737('0x45')](_0x14e4a2);})[_0x4737('0x28')](function(_0x90fea6){_0x235f7b[_0x4737('0x46')]=_0x90fea6;return _0x235f7b;})[_0x4737('0x28')](respondWithFilteredResult(_0x43d44a,_0x14e4a2))[_0x4737('0x47')](handleError(_0x43d44a,null));};exports[_0x4737('0x48')]=function(_0x1d3620,_0x5eccca){var _0x28ca8a={'raw':!![],'where':{'id':_0x1d3620[_0x4737('0x49')]['id']}},_0xce2e64={};_0xce2e64[_0x4737('0x32')]=_[_0x4737('0x34')](db[_0x4737('0x2d')][_0x4737('0x2e')]);_0xce2e64[_0x4737('0x33')]=_[_0x4737('0x34')](_0x1d3620['query']);_0xce2e64[_0x4737('0x35')]=_[_0x4737('0x36')](_0xce2e64[_0x4737('0x32')],_0xce2e64['query']);_0x28ca8a[_0x4737('0x37')]=_[_0x4737('0x36')](_0xce2e64[_0x4737('0x32')],qs[_0x4737('0x38')](_0x1d3620[_0x4737('0x33')]['fields']));_0x28ca8a['attributes']=_0x28ca8a[_0x4737('0x37')][_0x4737('0x39')]?_0x28ca8a[_0x4737('0x37')]:_0xce2e64[_0x4737('0x32')];if(_0x1d3620[_0x4737('0x33')]['includeAll']){_0x28ca8a[_0x4737('0x44')]=[{'all':!![]}];}_0x28ca8a=_[_0x4737('0x40')]({},_0x28ca8a,_0x1d3620[_0x4737('0x42')]);return db[_0x4737('0x2d')][_0x4737('0x4a')](_0x28ca8a)[_0x4737('0x28')](handleEntityNotFound(_0x5eccca,null))[_0x4737('0x28')](respondWithResult(_0x5eccca,null))['catch'](handleError(_0x5eccca,null));};exports['create']=function(_0x4a78d,_0x2ba038){return db[_0x4737('0x2d')]['create'](_0x4a78d[_0x4737('0x4b')],{})['then'](respondWithResult(_0x2ba038,0xc9))[_0x4737('0x47')](handleError(_0x2ba038,null));};exports[_0x4737('0x27')]=function(_0x2f63d8,_0xffb923){if(_0x2f63d8[_0x4737('0x4b')]['id']){delete _0x2f63d8[_0x4737('0x4b')]['id'];}return db[_0x4737('0x2d')][_0x4737('0x4a')]({'where':{'id':_0x2f63d8[_0x4737('0x49')]['id']}})['then'](handleEntityNotFound(_0xffb923,null))[_0x4737('0x28')](saveUpdates(_0x2f63d8[_0x4737('0x4b')],null))[_0x4737('0x28')](respondWithResult(_0xffb923,null))['catch'](handleError(_0xffb923,null));};exports[_0x4737('0x29')]=function(_0x3608b2,_0x1ffd12){return db['DeskField'][_0x4737('0x4a')]({'where':{'id':_0x3608b2[_0x4737('0x49')]['id']}})[_0x4737('0x28')](handleEntityNotFound(_0x1ffd12,null))[_0x4737('0x28')](removeEntity(_0x1ffd12,null))[_0x4737('0x47')](handleError(_0x1ffd12,null));}; \ No newline at end of file +var _0x687b=['order','sort','where','filter','VIRTUAL','options','include','findAll','rows','show','length','includeAll','merge','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x54fdd8,_0x2e81ae){var _0x4f6f8a=function(_0x2a970c){while(--_0x2a970c){_0x54fdd8['push'](_0x54fdd8['shift']());}};_0x4f6f8a(++_0x2e81ae);}(_0x687b,0x14a));var _0xb687=function(_0x33466d,_0x4d7e8c){_0x33466d=_0x33466d-0x0;var _0x401b25=_0x687b[_0x33466d];return _0x401b25;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];function respondWithStatusCode(_0x12a0be,_0x4f9c19){_0x4f9c19=_0x4f9c19||0xcc;return function(_0x4c97ed){if(_0x4c97ed){return _0x12a0be[_0xb687('0x1c')](_0x4f9c19);}return _0x12a0be[_0xb687('0x1d')](_0x4f9c19)['end']();};}function respondWithResult(_0x108fd0,_0x2f1ac0){_0x2f1ac0=_0x2f1ac0||0xc8;return function(_0x1f1f35){if(_0x1f1f35){return _0x108fd0[_0xb687('0x1d')](_0x2f1ac0)[_0xb687('0x1e')](_0x1f1f35);}};}function respondWithFilteredResult(_0x3ab914,_0x30622f){return function(_0x141375){if(_0x141375){var _0x263085=typeof _0x30622f[_0xb687('0x1f')]===_0xb687('0x20')&&typeof _0x30622f[_0xb687('0x21')]==='undefined';var _0x214b06=_0x141375[_0xb687('0x22')];var _0x30d370=_0x263085?0x0:_0x30622f['offset'];var _0x48958d=_0x263085?_0x141375[_0xb687('0x22')]:_0x30622f[_0xb687('0x1f')]+_0x30622f[_0xb687('0x21')];var _0x4b593b;if(_0x48958d>=_0x214b06){_0x48958d=_0x214b06;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x3ab914[_0xb687('0x1d')](_0x4b593b);return _0x3ab914['set'](_0xb687('0x23'),_0x30d370+'-'+_0x48958d+'/'+_0x214b06)[_0xb687('0x1e')](_0x141375);}return null;};}function patchUpdates(_0x170dc0){return function(_0x44bd0b){try{jsonpatch['apply'](_0x44bd0b,_0x170dc0,!![]);}catch(_0x3a73d5){return BPromise['reject'](_0x3a73d5);}return _0x44bd0b[_0xb687('0x24')]();};}function saveUpdates(_0x90e892,_0x274241){return function(_0x546fde){if(_0x546fde){return _0x546fde[_0xb687('0x25')](_0x90e892)[_0xb687('0x26')](function(_0xa95e91){return _0xa95e91;});}return null;};}function removeEntity(_0x16cdcb,_0xbf6c58){return function(_0x38866c){if(_0x38866c){return _0x38866c[_0xb687('0x27')]()[_0xb687('0x26')](function(){_0x16cdcb['status'](0xcc)[_0xb687('0x28')]();});}};}function handleEntityNotFound(_0x129347,_0x1c1585){return function(_0x1a0261){if(!_0x1a0261){_0x129347[_0xb687('0x1c')](0x194);}return _0x1a0261;};}function handleError(_0x4136c9,_0x17ff2b){_0x17ff2b=_0x17ff2b||0x1f4;return function(_0x3cb2f2){logger[_0xb687('0x29')](_0x3cb2f2[_0xb687('0x2a')]);if(_0x3cb2f2['name']){delete _0x3cb2f2[_0xb687('0x2b')];}_0x4136c9[_0xb687('0x1d')](_0x17ff2b)[_0xb687('0x2c')](_0x3cb2f2);};}exports[_0xb687('0x2d')]=function(_0x2e5c8d,_0x173c58){var _0x4e9a06={},_0x28b69a={},_0x5143af={'count':0x0,'rows':[]};var _0x360429=_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')],function(_0x1ad3ef){return{'name':_0x1ad3ef[_0xb687('0x31')],'type':_0x1ad3ef[_0xb687('0x32')]['key']};});_0x28b69a[_0xb687('0x33')]=_[_0xb687('0x2e')](_0x360429,_0xb687('0x2b'));_0x28b69a[_0xb687('0x34')]=_[_0xb687('0x35')](_0x2e5c8d[_0xb687('0x34')]);_0x28b69a[_0xb687('0x36')]=_[_0xb687('0x37')](_0x28b69a[_0xb687('0x33')],_0x28b69a[_0xb687('0x34')]);_0x4e9a06[_0xb687('0x38')]=_['intersection'](_0x28b69a['model'],qs[_0xb687('0x39')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x39')]));_0x4e9a06[_0xb687('0x38')]=_0x4e9a06['attributes']['length']?_0x4e9a06[_0xb687('0x38')]:_0x28b69a[_0xb687('0x33')];if(!_0x2e5c8d['query'][_0xb687('0x3a')](_0xb687('0x3b'))){_0x4e9a06['limit']=qs[_0xb687('0x21')](_0x2e5c8d['query'][_0xb687('0x21')]);_0x4e9a06[_0xb687('0x1f')]=qs[_0xb687('0x1f')](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x1f')]);}_0x4e9a06[_0xb687('0x3c')]=qs['sort'](_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3d')]);_0x4e9a06[_0xb687('0x3e')]=qs[_0xb687('0x36')](_['pick'](_0x2e5c8d[_0xb687('0x34')],_0x28b69a[_0xb687('0x36')]),_0x360429);if(_0x2e5c8d[_0xb687('0x34')][_0xb687('0x3f')]){_0x4e9a06[_0xb687('0x3e')]=_['merge'](_0x4e9a06[_0xb687('0x3e')],{'$or':_[_0xb687('0x2e')](_0x360429,function(_0x24c013){if(_0x24c013[_0xb687('0x32')]!==_0xb687('0x40')){var _0x29cf09={};_0x29cf09[_0x24c013['name']]={'$like':'%'+_0x2e5c8d['query'][_0xb687('0x3f')]+'%'};return _0x29cf09;}})});}_0x4e9a06=_['merge']({},_0x4e9a06,_0x2e5c8d[_0xb687('0x41')]);var _0x2f4550={'where':_0x4e9a06['where']};return db[_0xb687('0x2f')][_0xb687('0x22')](_0x2f4550)['then'](function(_0x394b56){_0x5143af[_0xb687('0x22')]=_0x394b56;if(_0x2e5c8d[_0xb687('0x34')]['includeAll']){_0x4e9a06[_0xb687('0x42')]=[{'all':!![]}];}return db[_0xb687('0x2f')][_0xb687('0x43')](_0x4e9a06);})[_0xb687('0x26')](function(_0x140388){_0x5143af[_0xb687('0x44')]=_0x140388;return _0x5143af;})[_0xb687('0x26')](respondWithFilteredResult(_0x173c58,_0x4e9a06))['catch'](handleError(_0x173c58,null));};exports[_0xb687('0x45')]=function(_0x4cf6ad,_0x50fdb7){var _0xa3a9e0={'raw':!![],'where':{'id':_0x4cf6ad['params']['id']}},_0x430364={};_0x430364[_0xb687('0x33')]=_['keys'](db[_0xb687('0x2f')][_0xb687('0x30')]);_0x430364['query']=_[_0xb687('0x35')](_0x4cf6ad[_0xb687('0x34')]);_0x430364['filters']=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],_0x430364[_0xb687('0x34')]);_0xa3a9e0[_0xb687('0x38')]=_[_0xb687('0x37')](_0x430364[_0xb687('0x33')],qs[_0xb687('0x39')](_0x4cf6ad[_0xb687('0x34')][_0xb687('0x39')]));_0xa3a9e0[_0xb687('0x38')]=_0xa3a9e0[_0xb687('0x38')][_0xb687('0x46')]?_0xa3a9e0['attributes']:_0x430364[_0xb687('0x33')];if(_0x4cf6ad['query'][_0xb687('0x47')]){_0xa3a9e0[_0xb687('0x42')]=[{'all':!![]}];}_0xa3a9e0=_[_0xb687('0x48')]({},_0xa3a9e0,_0x4cf6ad[_0xb687('0x41')]);return db[_0xb687('0x2f')][_0xb687('0x49')](_0xa3a9e0)['then'](handleEntityNotFound(_0x50fdb7,null))['then'](respondWithResult(_0x50fdb7,null))[_0xb687('0x4a')](handleError(_0x50fdb7,null));};exports[_0xb687('0x4b')]=function(_0x40558a,_0x4f3069){return db['DeskField'][_0xb687('0x4b')](_0x40558a[_0xb687('0x4c')],{})[_0xb687('0x26')](respondWithResult(_0x4f3069,0xc9))[_0xb687('0x4a')](handleError(_0x4f3069,null));};exports['update']=function(_0x33a0b0,_0xfc4c5f){if(_0x33a0b0[_0xb687('0x4c')]['id']){delete _0x33a0b0[_0xb687('0x4c')]['id'];}return db['DeskField']['find']({'where':{'id':_0x33a0b0[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0xfc4c5f,null))[_0xb687('0x26')](saveUpdates(_0x33a0b0['body'],null))['then'](respondWithResult(_0xfc4c5f,null))[_0xb687('0x4a')](handleError(_0xfc4c5f,null));};exports[_0xb687('0x27')]=function(_0xd5bdb7,_0x22e618){return db[_0xb687('0x2f')][_0xb687('0x49')]({'where':{'id':_0xd5bdb7[_0xb687('0x4d')]['id']}})[_0xb687('0x26')](handleEntityNotFound(_0x22e618,null))['then'](removeEntity(_0x22e618,null))[_0xb687('0x4a')](handleError(_0x22e618,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index abac807..d69c59c 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 _0x68c1=['request-promise','path','rimraf','./intDeskField.attributes','exports','define','int_desk_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x68c1,0x108));var _0x168c=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x68c1[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x168c('0x0'));var util=require(_0x168c('0x1'));var logger=require(_0x168c('0x2'))(_0x168c('0x3'));var moment=require(_0x168c('0x4'));var BPromise=require(_0x168c('0x5'));var rp=require(_0x168c('0x6'));var fs=require('fs');var path=require(_0x168c('0x7'));var rimraf=require(_0x168c('0x8'));var config=require('../../config/environment');var attributes=require(_0x168c('0x9'));module[_0x168c('0xa')]=function(_0x52e79d,_0x369d0c){return _0x52e79d[_0x168c('0xb')]('DeskField',attributes,{'tableName':_0x168c('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x168c('0xd'),_0x168c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b8c=['moment','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x51ca50,_0x4667d0){var _0x538ef9=function(_0x23ba6c){while(--_0x23ba6c){_0x51ca50['push'](_0x51ca50['shift']());}};_0x538ef9(++_0x4667d0);}(_0x8b8c,0x1ec));var _0xc8b8=function(_0x3b6147,_0x5a2e80){_0x3b6147=_0x3b6147-0x0;var _0x1ba5b8=_0x8b8c[_0x3b6147];return _0x1ba5b8;};'use strict';var _=require(_0xc8b8('0x0'));var util=require('util');var logger=require(_0xc8b8('0x1'))(_0xc8b8('0x2'));var moment=require(_0xc8b8('0x3'));var BPromise=require(_0xc8b8('0x4'));var rp=require(_0xc8b8('0x5'));var fs=require('fs');var path=require(_0xc8b8('0x6'));var rimraf=require('rimraf');var config=require(_0xc8b8('0x7'));var attributes=require(_0xc8b8('0x8'));module[_0xc8b8('0x9')]=function(_0x32bccb,_0x420b25){return _0x32bccb[_0xc8b8('0xa')]('DeskField',attributes,{'tableName':_0xc8b8('0xb'),'paranoid':![],'indexes':[{'name':_0xc8b8('0xc'),'fields':[_0xc8b8('0xd'),_0xc8b8('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 84b2abb..d6d0b4f 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 _0x907e=['result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x907e,0xa2));var _0xe907=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x907e[_0x2b4448];return _0xb4b465;};'use strict';var _=require('lodash');var util=require(_0xe907('0x0'));var moment=require(_0xe907('0x1'));var BPromise=require(_0xe907('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe907('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe907('0x4'));var logger=require(_0xe907('0x5'))('rpc');var config=require(_0xe907('0x6'));var jayson=require(_0xe907('0x7'));var client=jayson['client'][_0xe907('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd6cd8c,_0x3fcb0d,_0xba925){return new BPromise(function(_0x1eabf2,_0x37f9ce){return client[_0xe907('0x9')](_0xd6cd8c,_0xba925)[_0xe907('0xa')](function(_0x3962b4){logger['info'](_0xe907('0xb'),_0x3fcb0d,_0xe907('0xc'));logger[_0xe907('0xd')](_0xe907('0xe'),_0x3fcb0d,_0xe907('0xc'),JSON['stringify'](_0x3962b4));if(_0x3962b4['error']){if(_0x3962b4['error']['code']===0x1f4){logger[_0xe907('0xf')](_0xe907('0xb'),_0x3fcb0d,_0x3962b4[_0xe907('0xf')][_0xe907('0x10')]);return _0x37f9ce(_0x3962b4[_0xe907('0xf')][_0xe907('0x10')]);}logger['error'](_0xe907('0xb'),_0x3fcb0d,_0x3962b4[_0xe907('0xf')]['message']);return _0x1eabf2(_0x3962b4[_0xe907('0xf')]['message']);}else{logger[_0xe907('0x11')]('DeskField,\x20%s,\x20%s',_0x3fcb0d,_0xe907('0xc'));_0x1eabf2(_0x3962b4[_0xe907('0x12')][_0xe907('0x10')]);}})[_0xe907('0x13')](function(_0x1c457d){logger[_0xe907('0xf')](_0xe907('0xb'),_0x3fcb0d,_0x1c457d);_0x37f9ce(_0x1c457d);});});} \ No newline at end of file +var _0x1e5f=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','DeskField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x50d4ce,_0x324607){var _0x867d8d=function(_0x5c7ef3){while(--_0x5c7ef3){_0x50d4ce['push'](_0x50d4ce['shift']());}};_0x867d8d(++_0x324607);}(_0x1e5f,0xf6));var _0xf1e5=function(_0x157d23,_0x4027b9){_0x157d23=_0x157d23-0x0;var _0x5b93cc=_0x1e5f[_0x157d23];return _0x5b93cc;};'use strict';var _=require(_0xf1e5('0x0'));var util=require(_0xf1e5('0x1'));var moment=require(_0xf1e5('0x2'));var BPromise=require(_0xf1e5('0x3'));var rs=require(_0xf1e5('0x4'));var fs=require('fs');var Redis=require(_0xf1e5('0x5'));var db=require(_0xf1e5('0x6'))['db'];var utils=require(_0xf1e5('0x7'));var logger=require('../../config/logger')(_0xf1e5('0x8'));var config=require(_0xf1e5('0x9'));var jayson=require(_0xf1e5('0xa'));var client=jayson['client'][_0xf1e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d9339,_0x35346e,_0x1be831){return new BPromise(function(_0xd4db11,_0x12640c){return client[_0xf1e5('0xc')](_0x4d9339,_0x1be831)['then'](function(_0x24c138){logger['info'](_0xf1e5('0xd'),_0x35346e,'request\x20sent');logger[_0xf1e5('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x35346e,_0xf1e5('0xf'),JSON['stringify'](_0x24c138));if(_0x24c138[_0xf1e5('0x10')]){if(_0x24c138['error'][_0xf1e5('0x11')]===0x1f4){logger[_0xf1e5('0x10')]('DeskField,\x20%s,\x20%s',_0x35346e,_0x24c138[_0xf1e5('0x10')]['message']);return _0x12640c(_0x24c138[_0xf1e5('0x10')][_0xf1e5('0x12')]);}logger[_0xf1e5('0x10')](_0xf1e5('0xd'),_0x35346e,_0x24c138[_0xf1e5('0x10')][_0xf1e5('0x12')]);return _0xd4db11(_0x24c138[_0xf1e5('0x10')][_0xf1e5('0x12')]);}else{logger[_0xf1e5('0x13')](_0xf1e5('0xd'),_0x35346e,'request\x20sent');_0xd4db11(_0x24c138[_0xf1e5('0x14')][_0xf1e5('0x12')]);}})['catch'](function(_0x10ed48){logger[_0xf1e5('0x10')]('DeskField,\x20%s,\x20%s',_0x35346e,_0x10ed48);_0x12640c(_0x10ed48);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index a22750d..b83f2db 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 _0x51e6=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','isAuthenticated','/:id/configurations','post','create','addConfiguration','put','/:id','update'];(function(_0xf4129c,_0x44fcf1){var _0x426611=function(_0x3b5bcd){while(--_0x3b5bcd){_0xf4129c['push'](_0xf4129c['shift']());}};_0x426611(++_0x44fcf1);}(_0x51e6,0x71));var _0x651e=function(_0x25ad66,_0x46e4dc){_0x25ad66=_0x25ad66-0x0;var _0x141bc4=_0x51e6[_0x25ad66];return _0x141bc4;};'use strict';var multer=require(_0x651e('0x0'));var util=require(_0x651e('0x1'));var path=require('path');var timeout=require(_0x651e('0x2'));var express=require(_0x651e('0x3'));var router=express[_0x651e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x651e('0x5'));var interaction=require(_0x651e('0x6'));var config=require(_0x651e('0x7'));var controller=require(_0x651e('0x8'));router[_0x651e('0x9')]('/',auth['isAuthenticated'](),controller[_0x651e('0xa')]);router[_0x651e('0x9')]('/:id',auth[_0x651e('0xb')](),controller['show']);router[_0x651e('0x9')](_0x651e('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x651e('0x9')]('/:id/fields',auth[_0x651e('0xb')](),controller['getFields']);router[_0x651e('0xd')]('/',auth[_0x651e('0xb')](),controller[_0x651e('0xe')]);router[_0x651e('0xd')](_0x651e('0xc'),auth[_0x651e('0xb')](),controller[_0x651e('0xf')]);router[_0x651e('0x10')](_0x651e('0x11'),auth[_0x651e('0xb')](),controller[_0x651e('0x12')]);router[_0x651e('0x13')](_0x651e('0x11'),auth[_0x651e('0xb')](),controller[_0x651e('0x14')]);module[_0x651e('0x15')]=router; \ No newline at end of file +var _0x2f9f=['create','/:id/configurations','put','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x2f9f,0x16a));var _0xf2f9=function(_0x1b3a2f,_0xaf21fd){_0x1b3a2f=_0x1b3a2f-0x0;var _0x13c046=_0x2f9f[_0x1b3a2f];return _0x13c046;};'use strict';var multer=require(_0xf2f9('0x0'));var util=require(_0xf2f9('0x1'));var path=require(_0xf2f9('0x2'));var timeout=require(_0xf2f9('0x3'));var express=require('express');var router=express[_0xf2f9('0x4')]();var fs_extra=require(_0xf2f9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf2f9('0x6'));var config=require('../../config/environment');var controller=require(_0xf2f9('0x7'));router[_0xf2f9('0x8')]('/',auth[_0xf2f9('0x9')](),controller[_0xf2f9('0xa')]);router[_0xf2f9('0x8')](_0xf2f9('0xb'),auth[_0xf2f9('0x9')](),controller['show']);router['get']('/:id/configurations',auth[_0xf2f9('0x9')](),controller[_0xf2f9('0xc')]);router['get'](_0xf2f9('0xd'),auth['isAuthenticated'](),controller[_0xf2f9('0xe')]);router[_0xf2f9('0xf')]('/',auth[_0xf2f9('0x9')](),controller[_0xf2f9('0x10')]);router['post'](_0xf2f9('0x11'),auth[_0xf2f9('0x9')](),controller['addConfiguration']);router[_0xf2f9('0x12')](_0xf2f9('0xb'),auth[_0xf2f9('0x9')](),controller['update']);router[_0xf2f9('0x13')](_0xf2f9('0xb'),auth['isAuthenticated'](),controller[_0xf2f9('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index ba5523a..b801225 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 _0x16cc=['exports','STRING','BOOLEAN'];(function(_0x2d4cce,_0x15179f){var _0x8a9182=function(_0x535867){while(--_0x535867){_0x2d4cce['push'](_0x2d4cce['shift']());}};_0x8a9182(++_0x15179f);}(_0x16cc,0x120));var _0xc16c=function(_0x515a95,_0x16cfb0){_0x515a95=_0x515a95-0x0;var _0x43f7ac=_0x16cc[_0x515a95];return _0x43f7ac;};'use strict';var Sequelize=require('sequelize');module[_0xc16c('0x0')]={'name':{'type':Sequelize[_0xc16c('0x1')]},'username':{'type':Sequelize[_0xc16c('0x1')]},'password':{'type':Sequelize[_0xc16c('0x1')]},'remoteUri':{'type':Sequelize[_0xc16c('0x1')]},'tenantId':{'type':Sequelize[_0xc16c('0x1')]},'clientId':{'type':Sequelize[_0xc16c('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xc16c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc16c('0x1')]},'modernAuthentication':{'type':Sequelize[_0xc16c('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8110=['STRING','BOOLEAN','exports'];(function(_0x3f23cc,_0x5f0e36){var _0x82bf19=function(_0x3bdf18){while(--_0x3bdf18){_0x3f23cc['push'](_0x3f23cc['shift']());}};_0x82bf19(++_0x5f0e36);}(_0x8110,0x185));var _0x0811=function(_0x5180ee,_0x48cf5c){_0x5180ee=_0x5180ee-0x0;var _0x302c65=_0x8110[_0x5180ee];return _0x302c65;};'use strict';var Sequelize=require('sequelize');module[_0x0811('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0811('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x0811('0x1')]},'clientSecret':{'type':Sequelize[_0x0811('0x1')]},'serverUrl':{'type':Sequelize[_0x0811('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0811('0x1')]},'modernAuthentication':{'type':Sequelize[_0x0811('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 77ba45e..b095d03 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 _0x0abe=['DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','status','set','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','order','sort','pick','filter','merge','where','VIRTUAL','options','Dynamics365Account','includeAll','include','rows','show','params','keys','catch','create','body','destroy','find','getConfigurations','findOne','Dynamics365Configuration','length','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidyominame','prioritycodename','responseby','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data7','modernAuthentication','data5','https://login.microsoftonline.com/','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x0abe,0x188));var _0xe0ab=function(_0x255e7b,_0x595944){_0x255e7b=_0x255e7b-0x0;var _0x141623=_0x0abe[_0x255e7b];return _0x141623;};'use strict';var rp=require(_0xe0ab('0x0'));var util=require('util');var _=require(_0xe0ab('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xe0ab('0x2'))(_0xe0ab('0x3'));var db=require(_0xe0ab('0x4'))['db'];var integrations=require(_0xe0ab('0x5'));function respondWithResult(_0x1a7751,_0x25d0a3){_0x25d0a3=_0x25d0a3||0xc8;return function(_0xfd76cf){if(_0xfd76cf){return _0x1a7751['status'](_0x25d0a3)[_0xe0ab('0x6')](_0xfd76cf);}};}function respondWithFilteredResult(_0x442693,_0x4c45d6){return function(_0x576315){if(_0x576315){var _0x4c54ea=typeof _0x4c45d6[_0xe0ab('0x7')]===_0xe0ab('0x8')&&typeof _0x4c45d6[_0xe0ab('0x9')]==='undefined';var _0x1e4861=_0x576315[_0xe0ab('0xa')];var _0x1867f8=_0x4c54ea?0x0:_0x4c45d6[_0xe0ab('0x7')];var _0x186fc1=_0x4c54ea?_0x576315['count']:_0x4c45d6['offset']+_0x4c45d6[_0xe0ab('0x9')];var _0x47f404;if(_0x186fc1>=_0x1e4861){_0x186fc1=_0x1e4861;_0x47f404=0xc8;}else{_0x47f404=0xce;}_0x442693[_0xe0ab('0xb')](_0x47f404);return _0x442693[_0xe0ab('0xc')]('Content-Range',_0x1867f8+'-'+_0x186fc1+'/'+_0x1e4861)[_0xe0ab('0x6')](_0x576315);}return null;};}function saveUpdates(_0x5aa1dc){return function(_0x2d2812){if(_0x2d2812){return _0x2d2812[_0xe0ab('0xd')](_0x5aa1dc)[_0xe0ab('0xe')](function(_0x1a1a49){return _0x1a1a49;});}return null;};}function removeEntity(_0x14d5ad){return function(_0x5e0331){if(_0x5e0331){return _0x5e0331['destroy']()[_0xe0ab('0xe')](function(){_0x14d5ad[_0xe0ab('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10fe05){return function(_0x12cce8){if(!_0x12cce8){_0x10fe05['sendStatus'](0x194);}return _0x12cce8;};}function handleError(_0x232d3f,_0x21f813){_0x21f813=_0x21f813||0x1f4;return function(_0x4fc689){logger[_0xe0ab('0xf')](_0x4fc689[_0xe0ab('0x10')]);if(_0x4fc689[_0xe0ab('0x11')]){delete _0x4fc689[_0xe0ab('0x11')];}_0x232d3f[_0xe0ab('0xb')](_0x21f813)[_0xe0ab('0x12')](_0x4fc689);};}exports[_0xe0ab('0x13')]=function(_0x416d9d,_0x105074){var _0x10e882={},_0x55c3e2={},_0x3d5794={'count':0x0,'rows':[]};var _0xdc1a28=_[_0xe0ab('0x14')](db['Dynamics365Account'][_0xe0ab('0x15')],function(_0x2d6e56){return{'name':_0x2d6e56[_0xe0ab('0x16')],'type':_0x2d6e56[_0xe0ab('0x17')][_0xe0ab('0x18')]};});_0x55c3e2[_0xe0ab('0x19')]=_['map'](_0xdc1a28,_0xe0ab('0x11'));_0x55c3e2[_0xe0ab('0x1a')]=_['keys'](_0x416d9d[_0xe0ab('0x1a')]);_0x55c3e2[_0xe0ab('0x1b')]=_[_0xe0ab('0x1c')](_0x55c3e2['model'],_0x55c3e2['query']);_0x10e882['attributes']=_['intersection'](_0x55c3e2['model'],qs[_0xe0ab('0x1d')](_0x416d9d['query']['fields']));_0x10e882[_0xe0ab('0x1e')]=_0x10e882[_0xe0ab('0x1e')]['length']?_0x10e882['attributes']:_0x55c3e2[_0xe0ab('0x19')];if(!_0x416d9d[_0xe0ab('0x1a')]['hasOwnProperty']('nolimit')){_0x10e882[_0xe0ab('0x9')]=qs[_0xe0ab('0x9')](_0x416d9d[_0xe0ab('0x1a')][_0xe0ab('0x9')]);_0x10e882[_0xe0ab('0x7')]=qs[_0xe0ab('0x7')](_0x416d9d[_0xe0ab('0x1a')][_0xe0ab('0x7')]);}_0x10e882[_0xe0ab('0x1f')]=qs[_0xe0ab('0x20')](_0x416d9d[_0xe0ab('0x1a')][_0xe0ab('0x20')]);_0x10e882['where']=qs[_0xe0ab('0x1b')](_[_0xe0ab('0x21')](_0x416d9d[_0xe0ab('0x1a')],_0x55c3e2[_0xe0ab('0x1b')]),_0xdc1a28);if(_0x416d9d['query'][_0xe0ab('0x22')]){_0x10e882['where']=_[_0xe0ab('0x23')](_0x10e882[_0xe0ab('0x24')],{'$or':_[_0xe0ab('0x14')](_0xdc1a28,function(_0x274366){if(_0x274366['type']!==_0xe0ab('0x25')){var _0x3cc202={};_0x3cc202[_0x274366[_0xe0ab('0x11')]]={'$like':'%'+_0x416d9d[_0xe0ab('0x1a')][_0xe0ab('0x22')]+'%'};return _0x3cc202;}})});}_0x10e882=_[_0xe0ab('0x23')]({},_0x10e882,_0x416d9d[_0xe0ab('0x26')]);var _0x4f739e={'where':_0x10e882[_0xe0ab('0x24')]};return db[_0xe0ab('0x27')][_0xe0ab('0xa')](_0x4f739e)[_0xe0ab('0xe')](function(_0x82d8e4){_0x3d5794[_0xe0ab('0xa')]=_0x82d8e4;if(_0x416d9d[_0xe0ab('0x1a')][_0xe0ab('0x28')]){_0x10e882[_0xe0ab('0x29')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x10e882);})[_0xe0ab('0xe')](function(_0x5c041a){_0x3d5794[_0xe0ab('0x2a')]=_0x5c041a;return _0x3d5794;})['then'](respondWithFilteredResult(_0x105074,_0x10e882))['catch'](handleError(_0x105074,null));};exports[_0xe0ab('0x2b')]=function(_0x318ce6,_0x246307){var _0x4e5653={'raw':![],'where':{'id':_0x318ce6[_0xe0ab('0x2c')]['id']}},_0x406308={};_0x406308[_0xe0ab('0x19')]=_[_0xe0ab('0x2d')](db[_0xe0ab('0x27')][_0xe0ab('0x15')]);_0x406308[_0xe0ab('0x1a')]=_[_0xe0ab('0x2d')](_0x318ce6[_0xe0ab('0x1a')]);_0x406308[_0xe0ab('0x1b')]=_[_0xe0ab('0x1c')](_0x406308[_0xe0ab('0x19')],_0x406308['query']);_0x4e5653[_0xe0ab('0x1e')]=_[_0xe0ab('0x1c')](_0x406308[_0xe0ab('0x19')],qs[_0xe0ab('0x1d')](_0x318ce6[_0xe0ab('0x1a')][_0xe0ab('0x1d')]));_0x4e5653[_0xe0ab('0x1e')]=_0x4e5653['attributes']['length']?_0x4e5653[_0xe0ab('0x1e')]:_0x406308[_0xe0ab('0x19')];if(_0x318ce6['query'][_0xe0ab('0x28')]){_0x4e5653[_0xe0ab('0x29')]=[{'all':!![]}];}_0x4e5653=_['merge']({},_0x4e5653,_0x318ce6[_0xe0ab('0x26')]);return db[_0xe0ab('0x27')]['find'](_0x4e5653)[_0xe0ab('0xe')](handleEntityNotFound(_0x246307,null))[_0xe0ab('0xe')](respondWithResult(_0x246307,null))[_0xe0ab('0x2e')](handleError(_0x246307,null));};exports['create']=function(_0x2deead,_0x4d47e0){return db[_0xe0ab('0x27')][_0xe0ab('0x2f')](_0x2deead[_0xe0ab('0x30')],{})[_0xe0ab('0xe')](respondWithResult(_0x4d47e0,0xc9))[_0xe0ab('0x2e')](handleError(_0x4d47e0,null));};exports[_0xe0ab('0xd')]=function(_0x54f272,_0x4a048e){if(_0x54f272[_0xe0ab('0x30')]['id']){delete _0x54f272[_0xe0ab('0x30')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x54f272[_0xe0ab('0x2c')]['id']}})[_0xe0ab('0xe')](handleEntityNotFound(_0x4a048e,null))[_0xe0ab('0xe')](saveUpdates(_0x54f272[_0xe0ab('0x30')],null))[_0xe0ab('0xe')](respondWithResult(_0x4a048e,null))[_0xe0ab('0x2e')](handleError(_0x4a048e,null));};exports[_0xe0ab('0x31')]=function(_0xd1ea6c,_0x50ca45){return db[_0xe0ab('0x27')][_0xe0ab('0x32')]({'where':{'id':_0xd1ea6c[_0xe0ab('0x2c')]['id']}})[_0xe0ab('0xe')](handleEntityNotFound(_0x50ca45,null))['then'](removeEntity(_0x50ca45,null))[_0xe0ab('0x2e')](handleError(_0x50ca45,null));};exports[_0xe0ab('0x33')]=function(_0x252f59,_0x3fc118){var _0xc88d64={};var _0x379d3d={};var _0x24f044;var _0x1cc993;return db['Dynamics365Account'][_0xe0ab('0x34')]({'where':{'id':_0x252f59[_0xe0ab('0x2c')]['id']}})[_0xe0ab('0xe')](handleEntityNotFound(_0x3fc118,null))[_0xe0ab('0xe')](function(_0x2894d6){if(_0x2894d6){_0x24f044=_0x2894d6;_0x379d3d['model']=_['keys'](db[_0xe0ab('0x35')][_0xe0ab('0x15')]);_0x379d3d[_0xe0ab('0x1a')]=_[_0xe0ab('0x2d')](_0x252f59[_0xe0ab('0x1a')]);_0x379d3d['filters']=_[_0xe0ab('0x1c')](_0x379d3d[_0xe0ab('0x19')],_0x379d3d[_0xe0ab('0x1a')]);_0xc88d64[_0xe0ab('0x1e')]=_['intersection'](_0x379d3d[_0xe0ab('0x19')],qs[_0xe0ab('0x1d')](_0x252f59[_0xe0ab('0x1a')][_0xe0ab('0x1d')]));_0xc88d64[_0xe0ab('0x1e')]=_0xc88d64[_0xe0ab('0x1e')]['length']?_0xc88d64[_0xe0ab('0x1e')]:_0x379d3d[_0xe0ab('0x19')];_0xc88d64[_0xe0ab('0x1f')]=qs['sort'](_0x252f59[_0xe0ab('0x1a')][_0xe0ab('0x20')]);_0xc88d64[_0xe0ab('0x24')]=qs[_0xe0ab('0x1b')](_[_0xe0ab('0x21')](_0x252f59[_0xe0ab('0x1a')],_0x379d3d[_0xe0ab('0x1b')]));if(_0x252f59[_0xe0ab('0x1a')][_0xe0ab('0x22')]){_0xc88d64[_0xe0ab('0x24')]=_[_0xe0ab('0x23')](_0xc88d64[_0xe0ab('0x24')],{'$or':_[_0xe0ab('0x14')](_0xc88d64['attributes'],function(_0xa2fe9f){var _0x38aa4a={};_0x38aa4a[_0xa2fe9f]={'$like':'%'+_0x252f59[_0xe0ab('0x1a')][_0xe0ab('0x22')]+'%'};return _0x38aa4a;})});}_0xc88d64=_['merge']({},_0xc88d64,_0x252f59[_0xe0ab('0x26')]);return _0x24f044[_0xe0ab('0x33')](_0xc88d64);}})['then'](function(_0x542740){if(_0x542740){_0x1cc993=_0x542740[_0xe0ab('0x36')];if(!_0x252f59[_0xe0ab('0x1a')]['hasOwnProperty'](_0xe0ab('0x37'))){_0xc88d64[_0xe0ab('0x9')]=qs[_0xe0ab('0x9')](_0x252f59[_0xe0ab('0x1a')][_0xe0ab('0x9')]);_0xc88d64[_0xe0ab('0x7')]=qs[_0xe0ab('0x7')](_0x252f59['query'][_0xe0ab('0x7')]);}return _0x24f044[_0xe0ab('0x33')](_0xc88d64);}})[_0xe0ab('0xe')](function(_0x11daa4){if(_0x11daa4){return _0x11daa4?{'count':_0x1cc993,'rows':_0x11daa4}:null;}})[_0xe0ab('0xe')](respondWithResult(_0x3fc118,null))[_0xe0ab('0x2e')](handleError(_0x3fc118,null));};exports[_0xe0ab('0x38')]=function(_0x660e3,_0x4b213d){if(_0x660e3[_0xe0ab('0x30')]['id']){delete _0x660e3[_0xe0ab('0x30')]['id'];}return db[_0xe0ab('0x27')][_0xe0ab('0x34')]({'where':{'id':_0x660e3[_0xe0ab('0x2c')]['id']}})[_0xe0ab('0xe')](handleEntityNotFound(_0x4b213d,null))[_0xe0ab('0xe')](function(_0x50e953){if(_0x50e953){_0x660e3[_0xe0ab('0x30')][_0xe0ab('0x39')]=_0x50e953['id'];_0x660e3['body'][_0xe0ab('0x3a')]=integrations[_0xe0ab('0x3b')](_0x660e3['body'][_0xe0ab('0x3c')],_0x660e3['body'][_0xe0ab('0x17')]);_0x660e3[_0xe0ab('0x30')][_0xe0ab('0x3d')]=integrations[_0xe0ab('0x3e')](_0x660e3[_0xe0ab('0x30')][_0xe0ab('0x3c')],_0x660e3[_0xe0ab('0x30')][_0xe0ab('0x17')]);return db[_0xe0ab('0x35')][_0xe0ab('0x2f')](_0x660e3[_0xe0ab('0x30')],{'include':[{'model':db['Dynamics365Field'],'as':_0xe0ab('0x3a')},{'model':db[_0xe0ab('0x3f')],'as':_0xe0ab('0x3d')}]});}return null;})[_0xe0ab('0xe')](respondWithResult(_0x4b213d,null))[_0xe0ab('0x2e')](handleError(_0x4b213d,null));};function sanitizeRemoteUri(_0x35ea16){var _0x1643db=_0x35ea16[_0xe0ab('0x40')](-0x1);if(_0x1643db==='/')return _0x35ea16[_0xe0ab('0x41')](0x0,_0x35ea16[_0xe0ab('0x42')](_0x1643db));return _0x35ea16;}function getWebApiUrl(_0xffd75c){return util[_0xe0ab('0x43')](_0xe0ab('0x44'),_0xffd75c);}exports[_0xe0ab('0x45')]=function(_0x5140df,_0x51df60){var _0x28ad08=_0x5140df[_0xe0ab('0x1a')][_0xe0ab('0x46')];var _0x36a016=_0x28ad08===_0xe0ab('0x47')?_0xe0ab('0x48'):_0xe0ab('0x49');var _0xd3b8f8='';var _0x4c670d='';var _0x5b4071='';var _0x21162f='';var _0x173538='';var _0x10f3f0='';var _0x2b8895='';var _0x444823='';var _0x5f5bfe=[_0xe0ab('0x4a'),_0xe0ab('0x4b'),_0xe0ab('0x4c'),_0xe0ab('0x4d'),_0xe0ab('0x4e'),'subject',_0xe0ab('0x4f'),_0xe0ab('0x50'),'directioncode','phonecall_activity_parties'];var _0x818f6f=[_0xe0ab('0x51'),_0xe0ab('0x52'),_0xe0ab('0x53'),_0xe0ab('0x54'),_0xe0ab('0x55'),_0xe0ab('0x56'),'contractdetailidname',_0xe0ab('0x57'),'createdbyexternalpartyname',_0xe0ab('0x58'),_0xe0ab('0x59'),_0xe0ab('0x5a'),_0xe0ab('0x5b'),_0xe0ab('0x5c'),_0xe0ab('0x5d'),_0xe0ab('0x5e'),_0xe0ab('0x5f'),_0xe0ab('0x60'),_0xe0ab('0x61'),'entitlementidname','entityimage_timestamp',_0xe0ab('0x62'),_0xe0ab('0x63'),_0xe0ab('0x64'),_0xe0ab('0x65'),'followupby',_0xe0ab('0x66'),'influencescore',_0xe0ab('0x67'),'lastonholdtime',_0xe0ab('0x68'),_0xe0ab('0x69'),_0xe0ab('0x6a'),_0xe0ab('0x6b'),'modifiedbyyominame',_0xe0ab('0x6c'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0xe0ab('0x6d'),_0xe0ab('0x6e'),_0xe0ab('0x6f'),_0xe0ab('0x70'),_0xe0ab('0x71'),_0xe0ab('0x72'),_0xe0ab('0x73'),'owneridyominame',_0xe0ab('0x74'),'primarycontactidname',_0xe0ab('0x75'),_0xe0ab('0x76'),'productidname','productserialnumber','resolveby','resolvebykpiidname',_0xe0ab('0x77'),'responsiblecontactidname',_0xe0ab('0x78'),'sentimentvalue',_0xe0ab('0x79'),_0xe0ab('0x7a'),_0xe0ab('0x7b'),_0xe0ab('0x7c'),'statuscode',_0xe0ab('0x7d'),_0xe0ab('0x7e'),'timezoneruleversionnumber',_0xe0ab('0x7f'),_0xe0ab('0x80'),_0xe0ab('0x81'),_0xe0ab('0x82')];var _0x3ac1b2=_0x5f5bfe[_0xe0ab('0x83')](_0x818f6f);return db['Dynamics365Account'][_0xe0ab('0x34')]({'where':{'id':_0x5140df[_0xe0ab('0x2c')]['id']},'attributes':['id',_0xe0ab('0x84'),_0xe0ab('0x85'),_0xe0ab('0x86'),_0xe0ab('0x87'),_0xe0ab('0x88'),_0xe0ab('0x89'),'modernAuthentication'],'include':[{'model':db['CloudProvider'],'as':_0xe0ab('0x8a'),'attributes':['id','data5',_0xe0ab('0x8b')]}]})[_0xe0ab('0xe')](handleEntityNotFound(_0x51df60,null))[_0xe0ab('0xe')](function(_0x48ef42){if(_0x48ef42){if(_0x48ef42[_0xe0ab('0x8c')]){_0x48ef42['access_token']=_0x48ef42['CloudProvider'][_0xe0ab('0x8d')];_0x444823=sanitizeRemoteUri(_0x48ef42[_0xe0ab('0x8a')][_0xe0ab('0x8b')]);_0x2b8895=getWebApiUrl(_0x444823);return _0x48ef42;}_0x444823=sanitizeRemoteUri(_0x48ef42[_0xe0ab('0x86')]);_0x2b8895=getWebApiUrl(_0x444823);var _0x35eb22={'method':'POST','uri':_0xe0ab('0x8e')+_0x48ef42['tenantId']+_0xe0ab('0x8f'),'form':{'client_id':_0x48ef42[_0xe0ab('0x88')],'resource':_0x444823,'username':_0x48ef42[_0xe0ab('0x84')],'password':_0x48ef42[_0xe0ab('0x85')],'grant_type':_0xe0ab('0x85'),'client_secret':_0x48ef42[_0xe0ab('0x89')]},'json':!![]};return rp(_0x35eb22);}})[_0xe0ab('0xe')](function(_0x4e2811){_0x10f3f0=_0x4e2811[_0xe0ab('0x90')];var _0x2f37c7={'method':'GET','uri':encodeURI(_0x2b8895+_0xe0ab('0x91')+_0x36a016+'\x27'),'headers':{'Authorization':_0xe0ab('0x92')+_0x10f3f0,'If-None-Match':null,'OData-Version':_0xe0ab('0x93')},'json':!![]};return rp(_0x2f37c7);})['then'](function(_0x5c9d21){var _0x28ccb9=_0x5c9d21[_0xe0ab('0x94')][0x0];var _0x24c94a=_0x28ccb9[_0xe0ab('0x95')];var _0x1cc560={'method':_0xe0ab('0x96'),'uri':_0x2b8895+'EntityDefinitions('+_0x24c94a+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xe0ab('0x92')+_0x10f3f0,'If-None-Match':null,'OData-Version':_0xe0ab('0x93')},'json':!![]};return rp(_0x1cc560);})[_0xe0ab('0xe')](function(_0x343606){_0xd3b8f8=_0x343606;_0x4c670d=_0xd3b8f8['Attributes'];_0x4c670d=_[_0xe0ab('0x97')](_0x4c670d,function(_0x998f1f){return!_0x3ac1b2['includes'](_0x998f1f[_0xe0ab('0x98')]);});var _0x58398d=[];var _0x22ff8a=[];_0x4c670d[_0xe0ab('0x99')](function(_0x41be98){if(_0x41be98[_0xe0ab('0x9a')]){var _0x5dd47c=_0x41be98[_0xe0ab('0x9a')][_0xe0ab('0x41')](_0x41be98[_0xe0ab('0x9a')][_0xe0ab('0x42')]('.')+0x1);if(_0x5dd47c===_0xe0ab('0x9b')){_0x58398d[_0xe0ab('0x9c')](getSelectList(_0x2b8895,_0x28ad08,_0x22ff8a,_0xd3b8f8['MetadataId'],_0x41be98[_0xe0ab('0x95')],_0x10f3f0));}}});return Promise['all'](_0x58398d);})[_0xe0ab('0xe')](function(_0x5c0d07){_0x5b4071=_0x5c0d07[0x0];var _0x5da2cb=[];var _0x2d11be=[];_0x4c670d[_0xe0ab('0x99')](function(_0x48b564){if(!_['isNil'](_0x48b564[_0xe0ab('0x9a')])){var _0x664b40=_0x48b564[_0xe0ab('0x9a')][_0xe0ab('0x41')](_0x48b564[_0xe0ab('0x9a')][_0xe0ab('0x42')]('.')+0x1);if(_0x664b40===_0xe0ab('0x9d')){_0x5da2cb[_0xe0ab('0x9c')](getBooleanList(_0x2b8895,_0x28ad08,_0x2d11be,_0xd3b8f8[_0xe0ab('0x95')],_0x48b564[_0xe0ab('0x95')],_0x10f3f0));}}});return Promise[_0xe0ab('0x9e')](_0x5da2cb);})[_0xe0ab('0xe')](function(_0x2a76c6){_0x21162f=_0x2a76c6[0x0];var _0x523c51=[];var _0x2d930f=[];_0x4c670d['forEach'](function(_0x18da8e){if(_0x18da8e[_0xe0ab('0x9a')]){var _0x2780c6=_0x18da8e[_0xe0ab('0x9a')][_0xe0ab('0x41')](_0x18da8e[_0xe0ab('0x9a')][_0xe0ab('0x42')]('.')+0x1);if(_0x2780c6===_0xe0ab('0x9f')||_0x2780c6===_0xe0ab('0xa0')||_0x2780c6==='BigIntAttributeMetadata'||_0x2780c6===_0xe0ab('0xa1')||_0x2780c6===_0xe0ab('0xa2')||_0x2780c6===_0xe0ab('0xa3')||_0x2780c6===_0xe0ab('0xa4')||_0x2780c6===_0xe0ab('0xa5')||_0x2780c6===_0xe0ab('0xa6')||_0x2780c6==='DecimalAttributeMetadata'){_0x523c51[_0xe0ab('0x9c')](getInputList(_0x2b8895,_0x28ad08,_0x2780c6,_0x2d930f,_0xd3b8f8[_0xe0ab('0x95')],_0x18da8e[_0xe0ab('0x95')],_0x10f3f0));}}});return Promise[_0xe0ab('0x9e')](_0x523c51);})[_0xe0ab('0xe')](function(_0x1d3ae1){_0x173538=_0x1d3ae1[0x0];var _0x54f3a7=_0x5b4071['concat'](_0x21162f)['concat'](_0x173538);var _0x1435fa={'count':_0x54f3a7[_0xe0ab('0x36')],'rows':_0x54f3a7};return _0x1435fa;})['then'](respondWithResult(_0x51df60,null))[_0xe0ab('0x2e')](function(_0x339b18){var _0x39853f=_0x5140df[_0xe0ab('0x1a')][_0xe0ab('0xa7')]?0x1f4:_0x339b18[_0xe0ab('0xa8')]||0x1f4;logger[_0xe0ab('0xf')](_0x339b18[_0xe0ab('0x10')]);delete _0x339b18[_0xe0ab('0x11')];if(_0x39853f===0x191){_0x39853f=0x190;}_0x51df60[_0xe0ab('0xb')](_0x39853f)['send'](_0x5140df[_0xe0ab('0x1a')][_0xe0ab('0xa7')]?{'message':_0xe0ab('0xa9'),'statusCode':_0x339b18[_0xe0ab('0xa8')]}:_0x339b18);});};function getSelectList(_0xfd32c6,_0x107b40,_0x2e94ef,_0x1e0590,_0x54c64f,_0x9b278a){var _0x2a288b={'method':_0xe0ab('0x96'),'uri':_0xfd32c6+_0xe0ab('0xaa')+_0x1e0590+_0xe0ab('0xab')+_0x54c64f+_0xe0ab('0xac')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xe0ab('0x92')+_0x9b278a,'If-None-Match':null,'OData-Version':_0xe0ab('0x93')},'json':!![]};return rp(_0x2a288b)[_0xe0ab('0xe')](function(_0x1d07db){var _0x1d17a7=[];var _0x55223c=_0x1d07db['OptionSet'][_0xe0ab('0xad')];_0x55223c[_0xe0ab('0x99')](function(_0xe5b239){_0x1d17a7[_0xe0ab('0x9c')]({'name':_0xe5b239[_0xe0ab('0xae')][_0xe0ab('0xaf')]['Label'],'value':String(_0xe5b239[_0xe0ab('0xb0')])});});var _0x286dd5={'id':_0x107b40+'_'+_0x1d07db[_0xe0ab('0x98')],'name':_0x1d07db[_0xe0ab('0xb1')][_0xe0ab('0xaf')]['Label'],'custom':![],'options':_0x1d17a7};_0x2e94ef[_0xe0ab('0x9c')](_0x286dd5);return _0x2e94ef;});}function getBooleanList(_0xe9d977,_0x542a98,_0x476028,_0x571301,_0x3be384,_0x2e28fc){var _0x1b2d0c={'method':'GET','uri':_0xe9d977+'EntityDefinitions('+_0x571301+_0xe0ab('0xab')+_0x3be384+_0xe0ab('0xb2'),'headers':{'Authorization':_0xe0ab('0x92')+_0x2e28fc,'If-None-Match':null,'OData-Version':_0xe0ab('0x93')},'json':!![]};return rp(_0x1b2d0c)[_0xe0ab('0xe')](function(_0x412ee9){var _0x5b0eec=[];_0x5b0eec['push']({'name':_0x412ee9[_0xe0ab('0xb3')]['TrueOption'][_0xe0ab('0xae')][_0xe0ab('0xaf')][_0xe0ab('0xae')],'value':_0xe0ab('0xb4')},{'name':_0x412ee9['OptionSet'][_0xe0ab('0xb5')][_0xe0ab('0xae')][_0xe0ab('0xaf')][_0xe0ab('0xae')],'value':_0xe0ab('0xb6')});var _0x18aa3c={'id':_0x542a98+'_'+_0x412ee9[_0xe0ab('0x98')],'name':_0x412ee9[_0xe0ab('0xb1')][_0xe0ab('0xaf')][_0xe0ab('0xae')],'custom':![],'options':_0x5b0eec};_0x476028[_0xe0ab('0x9c')](_0x18aa3c);return _0x476028;});}function getInputList(_0x59ae54,_0x5caf52,_0x119506,_0x202b38,_0x46f72f,_0x3c4457,_0x32b5fc){var _0x291b48={'method':_0xe0ab('0x96'),'uri':_0x59ae54+'EntityDefinitions('+_0x46f72f+')/Attributes('+_0x3c4457+_0xe0ab('0xb7')+_0x119506+_0xe0ab('0xb8'),'headers':{'Authorization':_0xe0ab('0x92')+_0x32b5fc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x291b48)[_0xe0ab('0xe')](function(_0x19bd87){var _0x9e3093={'id':_0x5caf52+'_'+_0x19bd87[_0xe0ab('0x98')],'name':_0x19bd87[_0xe0ab('0xb1')]['UserLocalizedLabel']?_0x19bd87[_0xe0ab('0xb1')][_0xe0ab('0xaf')][_0xe0ab('0xae')]:_0x19bd87['LogicalName'],'custom':![],'options':[]};_0x202b38[_0xe0ab('0x9c')](_0x9e3093);return _0x202b38;});} \ No newline at end of file +var _0x6f7b=[')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','error','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Bearer\x20','Options','Label','UserLocalizedLabel','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','json','offset','limit','count','status','update','then','destroy','end','sendStatus','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','include','findAll','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','Dynamics365Configuration','sort','pick','options','addConfiguration','AccountId','getSubjects','type','Descriptions','channel','Subjects','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','Incident','PhoneCall','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data5','data7','modernAuthentication','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','username','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','MetadataId','EntityDefinitions('];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x6f7b,0x197));var _0xb6f7=function(_0xac2415,_0x30dc2c){_0xac2415=_0xac2415-0x0;var _0x2312bf=_0x6f7b[_0xac2415];return _0x2312bf;};'use strict';var rp=require(_0xb6f7('0x0'));var util=require(_0xb6f7('0x1'));var _=require(_0xb6f7('0x2'));var qs=require(_0xb6f7('0x3'));var logger=require(_0xb6f7('0x4'))('api');var db=require(_0xb6f7('0x5'))['db'];var integrations=require(_0xb6f7('0x6'));function respondWithResult(_0x1a15a9,_0x334ca5){_0x334ca5=_0x334ca5||0xc8;return function(_0x525667){if(_0x525667){return _0x1a15a9['status'](_0x334ca5)[_0xb6f7('0x7')](_0x525667);}};}function respondWithFilteredResult(_0x362f60,_0x637bf0){return function(_0x420f8a){if(_0x420f8a){var _0x275a2f=typeof _0x637bf0[_0xb6f7('0x8')]==='undefined'&&typeof _0x637bf0[_0xb6f7('0x9')]==='undefined';var _0x4cec70=_0x420f8a['count'];var _0x2682dc=_0x275a2f?0x0:_0x637bf0[_0xb6f7('0x8')];var _0x3f0eb0=_0x275a2f?_0x420f8a[_0xb6f7('0xa')]:_0x637bf0[_0xb6f7('0x8')]+_0x637bf0[_0xb6f7('0x9')];var _0x5bc5bb;if(_0x3f0eb0>=_0x4cec70){_0x3f0eb0=_0x4cec70;_0x5bc5bb=0xc8;}else{_0x5bc5bb=0xce;}_0x362f60[_0xb6f7('0xb')](_0x5bc5bb);return _0x362f60['set']('Content-Range',_0x2682dc+'-'+_0x3f0eb0+'/'+_0x4cec70)[_0xb6f7('0x7')](_0x420f8a);}return null;};}function saveUpdates(_0x1d0ee4){return function(_0x4b09f0){if(_0x4b09f0){return _0x4b09f0[_0xb6f7('0xc')](_0x1d0ee4)[_0xb6f7('0xd')](function(_0x1fa269){return _0x1fa269;});}return null;};}function removeEntity(_0x48a8b1){return function(_0x18732a){if(_0x18732a){return _0x18732a[_0xb6f7('0xe')]()[_0xb6f7('0xd')](function(){_0x48a8b1[_0xb6f7('0xb')](0xcc)[_0xb6f7('0xf')]();});}};}function handleEntityNotFound(_0x1c46f9){return function(_0x4b5b44){if(!_0x4b5b44){_0x1c46f9[_0xb6f7('0x10')](0x194);}return _0x4b5b44;};}function handleError(_0x47a7f1,_0x547770){_0x547770=_0x547770||0x1f4;return function(_0x56bbca){logger['error'](_0x56bbca[_0xb6f7('0x11')]);if(_0x56bbca[_0xb6f7('0x12')]){delete _0x56bbca[_0xb6f7('0x12')];}_0x47a7f1[_0xb6f7('0xb')](_0x547770)[_0xb6f7('0x13')](_0x56bbca);};}exports[_0xb6f7('0x14')]=function(_0x3978c4,_0x29cb80){var _0xff7217={},_0x523be0={},_0x4cada1={'count':0x0,'rows':[]};var _0xe81d99=_['map'](db[_0xb6f7('0x15')][_0xb6f7('0x16')],function(_0x4af3ee){return{'name':_0x4af3ee[_0xb6f7('0x17')],'type':_0x4af3ee['type'][_0xb6f7('0x18')]};});_0x523be0['model']=_[_0xb6f7('0x19')](_0xe81d99,_0xb6f7('0x12'));_0x523be0[_0xb6f7('0x1a')]=_[_0xb6f7('0x1b')](_0x3978c4['query']);_0x523be0[_0xb6f7('0x1c')]=_[_0xb6f7('0x1d')](_0x523be0[_0xb6f7('0x1e')],_0x523be0[_0xb6f7('0x1a')]);_0xff7217[_0xb6f7('0x1f')]=_['intersection'](_0x523be0[_0xb6f7('0x1e')],qs[_0xb6f7('0x20')](_0x3978c4[_0xb6f7('0x1a')][_0xb6f7('0x20')]));_0xff7217[_0xb6f7('0x1f')]=_0xff7217['attributes'][_0xb6f7('0x21')]?_0xff7217[_0xb6f7('0x1f')]:_0x523be0[_0xb6f7('0x1e')];if(!_0x3978c4[_0xb6f7('0x1a')][_0xb6f7('0x22')](_0xb6f7('0x23'))){_0xff7217[_0xb6f7('0x9')]=qs[_0xb6f7('0x9')](_0x3978c4['query'][_0xb6f7('0x9')]);_0xff7217[_0xb6f7('0x8')]=qs[_0xb6f7('0x8')](_0x3978c4[_0xb6f7('0x1a')][_0xb6f7('0x8')]);}_0xff7217[_0xb6f7('0x24')]=qs['sort'](_0x3978c4[_0xb6f7('0x1a')]['sort']);_0xff7217[_0xb6f7('0x25')]=qs[_0xb6f7('0x1c')](_['pick'](_0x3978c4['query'],_0x523be0[_0xb6f7('0x1c')]),_0xe81d99);if(_0x3978c4[_0xb6f7('0x1a')][_0xb6f7('0x26')]){_0xff7217['where']=_[_0xb6f7('0x27')](_0xff7217[_0xb6f7('0x25')],{'$or':_['map'](_0xe81d99,function(_0x45c553){if(_0x45c553['type']!=='VIRTUAL'){var _0x28789e={};_0x28789e[_0x45c553[_0xb6f7('0x12')]]={'$like':'%'+_0x3978c4['query'][_0xb6f7('0x26')]+'%'};return _0x28789e;}})});}_0xff7217=_[_0xb6f7('0x27')]({},_0xff7217,_0x3978c4['options']);var _0x13da5b={'where':_0xff7217[_0xb6f7('0x25')]};return db['Dynamics365Account'][_0xb6f7('0xa')](_0x13da5b)[_0xb6f7('0xd')](function(_0x25cca0){_0x4cada1[_0xb6f7('0xa')]=_0x25cca0;if(_0x3978c4[_0xb6f7('0x1a')]['includeAll']){_0xff7217[_0xb6f7('0x28')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xb6f7('0x29')](_0xff7217);})[_0xb6f7('0xd')](function(_0x4b3d85){_0x4cada1[_0xb6f7('0x2a')]=_0x4b3d85;return _0x4cada1;})[_0xb6f7('0xd')](respondWithFilteredResult(_0x29cb80,_0xff7217))[_0xb6f7('0x2b')](handleError(_0x29cb80,null));};exports[_0xb6f7('0x2c')]=function(_0x19d5d9,_0x5db7e0){var _0x2695e4={'raw':![],'where':{'id':_0x19d5d9[_0xb6f7('0x2d')]['id']}},_0x48d479={};_0x48d479[_0xb6f7('0x1e')]=_[_0xb6f7('0x1b')](db['Dynamics365Account']['rawAttributes']);_0x48d479[_0xb6f7('0x1a')]=_[_0xb6f7('0x1b')](_0x19d5d9[_0xb6f7('0x1a')]);_0x48d479[_0xb6f7('0x1c')]=_['intersection'](_0x48d479['model'],_0x48d479[_0xb6f7('0x1a')]);_0x2695e4[_0xb6f7('0x1f')]=_[_0xb6f7('0x1d')](_0x48d479[_0xb6f7('0x1e')],qs[_0xb6f7('0x20')](_0x19d5d9['query']['fields']));_0x2695e4[_0xb6f7('0x1f')]=_0x2695e4[_0xb6f7('0x1f')][_0xb6f7('0x21')]?_0x2695e4[_0xb6f7('0x1f')]:_0x48d479[_0xb6f7('0x1e')];if(_0x19d5d9[_0xb6f7('0x1a')][_0xb6f7('0x2e')]){_0x2695e4['include']=[{'all':!![]}];}_0x2695e4=_['merge']({},_0x2695e4,_0x19d5d9['options']);return db[_0xb6f7('0x15')][_0xb6f7('0x2f')](_0x2695e4)[_0xb6f7('0xd')](handleEntityNotFound(_0x5db7e0,null))[_0xb6f7('0xd')](respondWithResult(_0x5db7e0,null))[_0xb6f7('0x2b')](handleError(_0x5db7e0,null));};exports[_0xb6f7('0x30')]=function(_0x53f649,_0x4d6ae1){return db[_0xb6f7('0x15')]['create'](_0x53f649['body'],{})[_0xb6f7('0xd')](respondWithResult(_0x4d6ae1,0xc9))[_0xb6f7('0x2b')](handleError(_0x4d6ae1,null));};exports[_0xb6f7('0xc')]=function(_0x1d2241,_0x14107c){if(_0x1d2241['body']['id']){delete _0x1d2241[_0xb6f7('0x31')]['id'];}return db['Dynamics365Account'][_0xb6f7('0x2f')]({'where':{'id':_0x1d2241['params']['id']}})[_0xb6f7('0xd')](handleEntityNotFound(_0x14107c,null))[_0xb6f7('0xd')](saveUpdates(_0x1d2241[_0xb6f7('0x31')],null))[_0xb6f7('0xd')](respondWithResult(_0x14107c,null))['catch'](handleError(_0x14107c,null));};exports[_0xb6f7('0xe')]=function(_0x2e2fb5,_0x48a6cb){return db['Dynamics365Account']['find']({'where':{'id':_0x2e2fb5[_0xb6f7('0x2d')]['id']}})[_0xb6f7('0xd')](handleEntityNotFound(_0x48a6cb,null))[_0xb6f7('0xd')](removeEntity(_0x48a6cb,null))[_0xb6f7('0x2b')](handleError(_0x48a6cb,null));};exports[_0xb6f7('0x32')]=function(_0xefd512,_0x3b8af0){var _0x42f7f3={};var _0xe2c74={};var _0x983a70;var _0x33c311;return db['Dynamics365Account'][_0xb6f7('0x33')]({'where':{'id':_0xefd512[_0xb6f7('0x2d')]['id']}})[_0xb6f7('0xd')](handleEntityNotFound(_0x3b8af0,null))[_0xb6f7('0xd')](function(_0x353061){if(_0x353061){_0x983a70=_0x353061;_0xe2c74['model']=_['keys'](db[_0xb6f7('0x34')][_0xb6f7('0x16')]);_0xe2c74[_0xb6f7('0x1a')]=_[_0xb6f7('0x1b')](_0xefd512[_0xb6f7('0x1a')]);_0xe2c74['filters']=_[_0xb6f7('0x1d')](_0xe2c74[_0xb6f7('0x1e')],_0xe2c74[_0xb6f7('0x1a')]);_0x42f7f3[_0xb6f7('0x1f')]=_[_0xb6f7('0x1d')](_0xe2c74[_0xb6f7('0x1e')],qs['fields'](_0xefd512[_0xb6f7('0x1a')][_0xb6f7('0x20')]));_0x42f7f3['attributes']=_0x42f7f3[_0xb6f7('0x1f')]['length']?_0x42f7f3[_0xb6f7('0x1f')]:_0xe2c74[_0xb6f7('0x1e')];_0x42f7f3[_0xb6f7('0x24')]=qs[_0xb6f7('0x35')](_0xefd512[_0xb6f7('0x1a')][_0xb6f7('0x35')]);_0x42f7f3[_0xb6f7('0x25')]=qs[_0xb6f7('0x1c')](_[_0xb6f7('0x36')](_0xefd512[_0xb6f7('0x1a')],_0xe2c74[_0xb6f7('0x1c')]));if(_0xefd512[_0xb6f7('0x1a')][_0xb6f7('0x26')]){_0x42f7f3[_0xb6f7('0x25')]=_[_0xb6f7('0x27')](_0x42f7f3[_0xb6f7('0x25')],{'$or':_[_0xb6f7('0x19')](_0x42f7f3[_0xb6f7('0x1f')],function(_0x31a0ba){var _0x247dde={};_0x247dde[_0x31a0ba]={'$like':'%'+_0xefd512[_0xb6f7('0x1a')][_0xb6f7('0x26')]+'%'};return _0x247dde;})});}_0x42f7f3=_['merge']({},_0x42f7f3,_0xefd512[_0xb6f7('0x37')]);return _0x983a70[_0xb6f7('0x32')](_0x42f7f3);}})['then'](function(_0x82af3c){if(_0x82af3c){_0x33c311=_0x82af3c['length'];if(!_0xefd512[_0xb6f7('0x1a')][_0xb6f7('0x22')]('nolimit')){_0x42f7f3[_0xb6f7('0x9')]=qs[_0xb6f7('0x9')](_0xefd512[_0xb6f7('0x1a')]['limit']);_0x42f7f3[_0xb6f7('0x8')]=qs[_0xb6f7('0x8')](_0xefd512['query'][_0xb6f7('0x8')]);}return _0x983a70[_0xb6f7('0x32')](_0x42f7f3);}})[_0xb6f7('0xd')](function(_0x170c4c){if(_0x170c4c){return _0x170c4c?{'count':_0x33c311,'rows':_0x170c4c}:null;}})[_0xb6f7('0xd')](respondWithResult(_0x3b8af0,null))[_0xb6f7('0x2b')](handleError(_0x3b8af0,null));};exports[_0xb6f7('0x38')]=function(_0x41e9fd,_0x14685c){if(_0x41e9fd[_0xb6f7('0x31')]['id']){delete _0x41e9fd['body']['id'];}return db[_0xb6f7('0x15')][_0xb6f7('0x33')]({'where':{'id':_0x41e9fd[_0xb6f7('0x2d')]['id']}})[_0xb6f7('0xd')](handleEntityNotFound(_0x14685c,null))[_0xb6f7('0xd')](function(_0x3aa707){if(_0x3aa707){_0x41e9fd[_0xb6f7('0x31')][_0xb6f7('0x39')]=_0x3aa707['id'];_0x41e9fd['body']['Subjects']=integrations[_0xb6f7('0x3a')](_0x41e9fd[_0xb6f7('0x31')]['channel'],_0x41e9fd['body'][_0xb6f7('0x3b')]);_0x41e9fd['body'][_0xb6f7('0x3c')]=integrations['getDescriptions'](_0x41e9fd[_0xb6f7('0x31')][_0xb6f7('0x3d')],_0x41e9fd[_0xb6f7('0x31')][_0xb6f7('0x3b')]);return db['Dynamics365Configuration'][_0xb6f7('0x30')](_0x41e9fd[_0xb6f7('0x31')],{'include':[{'model':db['Dynamics365Field'],'as':_0xb6f7('0x3e')},{'model':db['Dynamics365Field'],'as':_0xb6f7('0x3c')}]});}return null;})[_0xb6f7('0xd')](respondWithResult(_0x14685c,null))['catch'](handleError(_0x14685c,null));};function sanitizeRemoteUri(_0x29a9e4){var _0x4e0b71=_0x29a9e4[_0xb6f7('0x3f')](-0x1);if(_0x4e0b71==='/')return _0x29a9e4[_0xb6f7('0x40')](0x0,_0x29a9e4[_0xb6f7('0x41')](_0x4e0b71));return _0x29a9e4;}function getWebApiUrl(_0x306843){return util['format'](_0xb6f7('0x42'),_0x306843);}exports[_0xb6f7('0x43')]=function(_0x8302b6,_0x25510c){var _0x4c7334=_0x8302b6[_0xb6f7('0x1a')]['ticketType'];var _0x5e01df=_0x4c7334==='incident'?_0xb6f7('0x44'):_0xb6f7('0x45');var _0x5c18ca='';var _0x5115c6='';var _0x517743='';var _0x783f4a='';var _0x5f11b2='';var _0x1ec4cf='';var _0x3fb89d='';var _0x48b293='';var _0x45b01f=['title','description','customerid',_0xb6f7('0x46'),_0xb6f7('0x47'),_0xb6f7('0x48'),_0xb6f7('0x49'),_0xb6f7('0x4a'),_0xb6f7('0x4b'),_0xb6f7('0x4c')];var _0x235bae=[_0xb6f7('0x4d'),_0xb6f7('0x4e'),'actualserviceunits',_0xb6f7('0x4f'),_0xb6f7('0x50'),_0xb6f7('0x51'),_0xb6f7('0x52'),_0xb6f7('0x53'),_0xb6f7('0x54'),_0xb6f7('0x55'),_0xb6f7('0x56'),_0xb6f7('0x57'),_0xb6f7('0x58'),_0xb6f7('0x59'),_0xb6f7('0x5a'),_0xb6f7('0x5b'),_0xb6f7('0x5c'),_0xb6f7('0x5d'),'emailaddress',_0xb6f7('0x5e'),_0xb6f7('0x5f'),'entityimage_url','escalatedon',_0xb6f7('0x60'),_0xb6f7('0x61'),'followupby',_0xb6f7('0x62'),_0xb6f7('0x63'),_0xb6f7('0x64'),_0xb6f7('0x65'),_0xb6f7('0x66'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0xb6f7('0x67'),'modifiedbyyominame',_0xb6f7('0x68'),_0xb6f7('0x69'),_0xb6f7('0x6a'),_0xb6f7('0x6b'),'msdyn_iotalertname',_0xb6f7('0x6c'),_0xb6f7('0x6d'),_0xb6f7('0x6e'),'owneridname',_0xb6f7('0x6f'),_0xb6f7('0x70'),_0xb6f7('0x71'),'primarycontactidname',_0xb6f7('0x72'),'prioritycodename','productidname',_0xb6f7('0x73'),'resolveby',_0xb6f7('0x74'),_0xb6f7('0x75'),_0xb6f7('0x76'),_0xb6f7('0x77'),'sentimentvalue',_0xb6f7('0x78'),_0xb6f7('0x79'),_0xb6f7('0x7a'),_0xb6f7('0x7b'),_0xb6f7('0x7c'),'subjectidname',_0xb6f7('0x7d'),'timezoneruleversionnumber',_0xb6f7('0x7e'),_0xb6f7('0x7f'),'utcconversiontimezonecode',_0xb6f7('0x80')];var _0x312449=_0x45b01f[_0xb6f7('0x81')](_0x235bae);return db['Dynamics365Account']['findOne']({'where':{'id':_0x8302b6[_0xb6f7('0x2d')]['id']},'attributes':['id','username','password',_0xb6f7('0x82'),_0xb6f7('0x83'),_0xb6f7('0x84'),_0xb6f7('0x85'),'modernAuthentication'],'include':[{'model':db[_0xb6f7('0x86')],'as':'CloudProvider','attributes':['id',_0xb6f7('0x87'),_0xb6f7('0x88')]}]})[_0xb6f7('0xd')](handleEntityNotFound(_0x25510c,null))[_0xb6f7('0xd')](function(_0x3cb362){if(_0x3cb362){if(_0x3cb362[_0xb6f7('0x89')]){_0x3cb362[_0xb6f7('0x8a')]=_0x3cb362[_0xb6f7('0x86')][_0xb6f7('0x87')];_0x48b293=sanitizeRemoteUri(_0x3cb362[_0xb6f7('0x86')][_0xb6f7('0x88')]);_0x3fb89d=getWebApiUrl(_0x48b293);return _0x3cb362;}_0x48b293=sanitizeRemoteUri(_0x3cb362[_0xb6f7('0x82')]);_0x3fb89d=getWebApiUrl(_0x48b293);var _0x2f4cee={'method':_0xb6f7('0x8b'),'uri':_0xb6f7('0x8c')+_0x3cb362[_0xb6f7('0x83')]+_0xb6f7('0x8d'),'form':{'client_id':_0x3cb362[_0xb6f7('0x84')],'resource':_0x48b293,'username':_0x3cb362[_0xb6f7('0x8e')],'password':_0x3cb362[_0xb6f7('0x8f')],'grant_type':_0xb6f7('0x8f'),'client_secret':_0x3cb362['clientSecret']},'json':!![]};return rp(_0x2f4cee);}})[_0xb6f7('0xd')](function(_0x415a02){_0x1ec4cf=_0x415a02[_0xb6f7('0x8a')];var _0x25c37f={'method':_0xb6f7('0x90'),'uri':encodeURI(_0x3fb89d+_0xb6f7('0x91')+_0x5e01df+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x1ec4cf,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x25c37f);})['then'](function(_0x57fa9c){var _0x305cdf=_0x57fa9c['value'][0x0];var _0x5e5269=_0x305cdf[_0xb6f7('0x92')];var _0x2e26e5={'method':_0xb6f7('0x90'),'uri':_0x3fb89d+_0xb6f7('0x93')+_0x5e5269+_0xb6f7('0x94'),'headers':{'Authorization':'Bearer\x20'+_0x1ec4cf,'If-None-Match':null,'OData-Version':_0xb6f7('0x95')},'json':!![]};return rp(_0x2e26e5);})[_0xb6f7('0xd')](function(_0x276cc0){_0x5c18ca=_0x276cc0;_0x5115c6=_0x5c18ca[_0xb6f7('0x96')];_0x5115c6=_[_0xb6f7('0x97')](_0x5115c6,function(_0x2b86f8){return!_0x312449['includes'](_0x2b86f8[_0xb6f7('0x98')]);});var _0x210a93=[];var _0x49cf33=[];_0x5115c6[_0xb6f7('0x99')](function(_0x458b9b){if(_0x458b9b[_0xb6f7('0x9a')]){var _0x57119e=_0x458b9b[_0xb6f7('0x9a')]['substring'](_0x458b9b[_0xb6f7('0x9a')][_0xb6f7('0x41')]('.')+0x1);if(_0x57119e===_0xb6f7('0x9b')){_0x210a93[_0xb6f7('0x9c')](getSelectList(_0x3fb89d,_0x4c7334,_0x49cf33,_0x5c18ca['MetadataId'],_0x458b9b[_0xb6f7('0x92')],_0x1ec4cf));}}});return Promise[_0xb6f7('0x9d')](_0x210a93);})['then'](function(_0x15dbca){_0x517743=_0x15dbca[0x0];var _0x47abd9=[];var _0xee2ed8=[];_0x5115c6[_0xb6f7('0x99')](function(_0x210942){if(!_[_0xb6f7('0x9e')](_0x210942['@odata.type'])){var _0x2b5039=_0x210942['@odata.type'][_0xb6f7('0x40')](_0x210942[_0xb6f7('0x9a')]['lastIndexOf']('.')+0x1);if(_0x2b5039==='BooleanAttributeMetadata'){_0x47abd9[_0xb6f7('0x9c')](getBooleanList(_0x3fb89d,_0x4c7334,_0xee2ed8,_0x5c18ca['MetadataId'],_0x210942[_0xb6f7('0x92')],_0x1ec4cf));}}});return Promise[_0xb6f7('0x9d')](_0x47abd9);})[_0xb6f7('0xd')](function(_0xe684ef){_0x783f4a=_0xe684ef[0x0];var _0x377176=[];var _0x494c21=[];_0x5115c6['forEach'](function(_0x242670){if(_0x242670[_0xb6f7('0x9a')]){var _0x39bc3c=_0x242670['@odata.type'][_0xb6f7('0x40')](_0x242670[_0xb6f7('0x9a')][_0xb6f7('0x41')]('.')+0x1);if(_0x39bc3c===_0xb6f7('0x9f')||_0x39bc3c===_0xb6f7('0xa0')||_0x39bc3c==='BigIntAttributeMetadata'||_0x39bc3c==='IntegerAttributeMetadata'||_0x39bc3c===_0xb6f7('0xa1')||_0x39bc3c===_0xb6f7('0xa2')||_0x39bc3c===_0xb6f7('0xa3')||_0x39bc3c===_0xb6f7('0xa4')||_0x39bc3c===_0xb6f7('0xa5')||_0x39bc3c===_0xb6f7('0xa6')){_0x377176[_0xb6f7('0x9c')](getInputList(_0x3fb89d,_0x4c7334,_0x39bc3c,_0x494c21,_0x5c18ca[_0xb6f7('0x92')],_0x242670[_0xb6f7('0x92')],_0x1ec4cf));}}});return Promise[_0xb6f7('0x9d')](_0x377176);})['then'](function(_0x56526c){_0x5f11b2=_0x56526c[0x0];var _0x228285=_0x517743[_0xb6f7('0x81')](_0x783f4a)[_0xb6f7('0x81')](_0x5f11b2);var _0x24fe92={'count':_0x228285[_0xb6f7('0x21')],'rows':_0x228285};return _0x24fe92;})[_0xb6f7('0xd')](respondWithResult(_0x25510c,null))[_0xb6f7('0x2b')](function(_0xb0f884){var _0xdbb502=_0x8302b6[_0xb6f7('0x1a')][_0xb6f7('0xa7')]?0x1f4:_0xb0f884['statusCode']||0x1f4;logger[_0xb6f7('0xa8')](_0xb0f884[_0xb6f7('0x11')]);delete _0xb0f884[_0xb6f7('0x12')];if(_0xdbb502===0x191){_0xdbb502=0x190;}_0x25510c['status'](_0xdbb502)[_0xb6f7('0x13')](_0x8302b6[_0xb6f7('0x1a')][_0xb6f7('0xa7')]?{'message':_0xb6f7('0xa9'),'statusCode':_0xb0f884[_0xb6f7('0xaa')]}:_0xb0f884);});};function getSelectList(_0x593bdc,_0x25a4fb,_0x521b80,_0x105fe9,_0x2901e2,_0x18469c){var _0x23833b={'method':_0xb6f7('0x90'),'uri':_0x593bdc+'EntityDefinitions('+_0x105fe9+_0xb6f7('0xab')+_0x2901e2+_0xb6f7('0xac')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xb6f7('0xad')+_0x18469c,'If-None-Match':null,'OData-Version':_0xb6f7('0x95')},'json':!![]};return rp(_0x23833b)[_0xb6f7('0xd')](function(_0x305300){var _0x3bc237=[];var _0x2d061e=_0x305300['OptionSet'][_0xb6f7('0xae')];_0x2d061e[_0xb6f7('0x99')](function(_0x81ac5c){_0x3bc237[_0xb6f7('0x9c')]({'name':_0x81ac5c[_0xb6f7('0xaf')][_0xb6f7('0xb0')]['Label'],'value':String(_0x81ac5c['Value'])});});var _0x5be06d={'id':_0x25a4fb+'_'+_0x305300[_0xb6f7('0x98')],'name':_0x305300[_0xb6f7('0xb1')][_0xb6f7('0xb0')][_0xb6f7('0xaf')],'custom':![],'options':_0x3bc237};_0x521b80[_0xb6f7('0x9c')](_0x5be06d);return _0x521b80;});}function getBooleanList(_0x198ba1,_0xe32f94,_0x173f7b,_0x3139fa,_0x43eff5,_0x29defb){var _0x124a39={'method':_0xb6f7('0x90'),'uri':_0x198ba1+_0xb6f7('0x93')+_0x3139fa+')/Attributes('+_0x43eff5+_0xb6f7('0xb2'),'headers':{'Authorization':_0xb6f7('0xad')+_0x29defb,'If-None-Match':null,'OData-Version':_0xb6f7('0x95')},'json':!![]};return rp(_0x124a39)[_0xb6f7('0xd')](function(_0x39e663){var _0x1f95ef=[];_0x1f95ef[_0xb6f7('0x9c')]({'name':_0x39e663['OptionSet'][_0xb6f7('0xb3')][_0xb6f7('0xaf')][_0xb6f7('0xb0')][_0xb6f7('0xaf')],'value':_0xb6f7('0xb4')},{'name':_0x39e663['OptionSet'][_0xb6f7('0xb5')][_0xb6f7('0xaf')]['UserLocalizedLabel']['Label'],'value':_0xb6f7('0xb6')});var _0x38434b={'id':_0xe32f94+'_'+_0x39e663[_0xb6f7('0x98')],'name':_0x39e663['DisplayName'][_0xb6f7('0xb0')][_0xb6f7('0xaf')],'custom':![],'options':_0x1f95ef};_0x173f7b[_0xb6f7('0x9c')](_0x38434b);return _0x173f7b;});}function getInputList(_0x42858b,_0x58b93b,_0x4e7fcd,_0x18a3e0,_0x46f7ab,_0x1767c7,_0x17db85){var _0x1bea8e={'method':_0xb6f7('0x90'),'uri':_0x42858b+_0xb6f7('0x93')+_0x46f7ab+_0xb6f7('0xab')+_0x1767c7+_0xb6f7('0xb7')+_0x4e7fcd+_0xb6f7('0xb8'),'headers':{'Authorization':_0xb6f7('0xad')+_0x17db85,'If-None-Match':null,'OData-Version':_0xb6f7('0x95')},'json':!![]};return rp(_0x1bea8e)[_0xb6f7('0xd')](function(_0x440e88){var _0x10389c={'id':_0x58b93b+'_'+_0x440e88[_0xb6f7('0x98')],'name':_0x440e88['DisplayName'][_0xb6f7('0xb0')]?_0x440e88[_0xb6f7('0xb1')][_0xb6f7('0xb0')][_0xb6f7('0xaf')]:_0x440e88[_0xb6f7('0x98')],'custom':![],'options':[]};_0x18a3e0[_0xb6f7('0x9c')](_0x10389c);return _0x18a3e0;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 2bfb008..0c10aae 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x462d1b,_0x394883){var _0x1b9b2f=function(_0x2b6cde){while(--_0x2b6cde){_0x462d1b['push'](_0x462d1b['shift']());}};_0x1b9b2f(++_0x394883);}(_0x757a,0xde));var _0xa757=function(_0x78d8bc,_0x11cc96){_0x78d8bc=_0x78d8bc-0x0;var _0x2fd985=_0x757a[_0x78d8bc];return _0x2fd985;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x4f9561,_0x3c3ead){var _0x468bce=function(_0x5c42aa){while(--_0x5c42aa){_0x4f9561['push'](_0x4f9561['shift']());}};_0x468bce(++_0x3c3ead);}(_0x757a,0xde));var _0xa757=function(_0x3f9701,_0x3a8c6c){_0x3f9701=_0x3f9701-0x0;var _0x42a301=_0x757a[_0x3f9701];return _0x42a301;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 006b3fa..b03794a 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 _0xb5d0=['catch','find','ShowDynamics365Account','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','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'];(function(_0x2bb1fd,_0x5e674e){var _0x2bcab1=function(_0x29bb0d){while(--_0x29bb0d){_0x2bb1fd['push'](_0x2bb1fd['shift']());}};_0x2bcab1(++_0x5e674e);}(_0xb5d0,0x113));var _0x0b5d=function(_0x24f552,_0x46bdb8){_0x24f552=_0x24f552-0x0;var _0x3a0969=_0xb5d0[_0x24f552];return _0x3a0969;};'use strict';var _=require(_0x0b5d('0x0'));var util=require(_0x0b5d('0x1'));var moment=require('moment');var BPromise=require(_0x0b5d('0x2'));var rs=require(_0x0b5d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b5d('0x4'))['db'];var utils=require(_0x0b5d('0x5'));var logger=require(_0x0b5d('0x6'))('rpc');var config=require(_0x0b5d('0x7'));var jayson=require(_0x0b5d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2359ff,_0x184d7e,_0x1bf136){return new BPromise(function(_0x29b05b,_0x24eb79){return client['request'](_0x2359ff,_0x1bf136)[_0x0b5d('0x9')](function(_0x4151fd){logger[_0x0b5d('0xa')](_0x0b5d('0xb'),_0x184d7e,_0x0b5d('0xc'));logger[_0x0b5d('0xd')](_0x0b5d('0xe'),_0x184d7e,_0x0b5d('0xc'),JSON[_0x0b5d('0xf')](_0x4151fd));if(_0x4151fd[_0x0b5d('0x10')]){if(_0x4151fd[_0x0b5d('0x10')][_0x0b5d('0x11')]===0x1f4){logger[_0x0b5d('0x10')](_0x0b5d('0xb'),_0x184d7e,_0x4151fd[_0x0b5d('0x10')][_0x0b5d('0x12')]);return _0x24eb79(_0x4151fd[_0x0b5d('0x10')][_0x0b5d('0x12')]);}logger['error'](_0x0b5d('0xb'),_0x184d7e,_0x4151fd[_0x0b5d('0x10')][_0x0b5d('0x12')]);return _0x29b05b(_0x4151fd['error']['message']);}else{logger[_0x0b5d('0xa')](_0x0b5d('0xb'),_0x184d7e,_0x0b5d('0xc'));_0x29b05b(_0x4151fd[_0x0b5d('0x13')][_0x0b5d('0x12')]);}})['catch'](function(_0x4e43bc){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x184d7e,_0x4e43bc);_0x24eb79(_0x4e43bc);});});}exports[_0x0b5d('0x14')]=function(_0x47a7d6){var _0x38d982=this;return new Promise(function(_0x40a00,_0x1d6d50){return db[_0x0b5d('0x15')][_0x0b5d('0x16')]({'raw':_0x47a7d6[_0x0b5d('0x17')]?_0x47a7d6[_0x0b5d('0x17')][_0x0b5d('0x18')]===undefined?!![]:![]:!![],'where':_0x47a7d6[_0x0b5d('0x17')]?_0x47a7d6['options'][_0x0b5d('0x19')]||null:null,'attributes':_0x47a7d6['options']?_0x47a7d6[_0x0b5d('0x17')][_0x0b5d('0x1a')]||null:null,'limit':_0x47a7d6['options']?_0x47a7d6[_0x0b5d('0x17')][_0x0b5d('0x1b')]||null:null,'include':_0x47a7d6[_0x0b5d('0x17')]?_0x47a7d6[_0x0b5d('0x17')][_0x0b5d('0x1c')]?_[_0x0b5d('0x1d')](_0x47a7d6[_0x0b5d('0x17')][_0x0b5d('0x1c')],function(_0x3d7c81){return{'model':db[_0x3d7c81[_0x0b5d('0x1e')]],'as':_0x3d7c81['as'],'attributes':_0x3d7c81[_0x0b5d('0x1a')],'include':_0x3d7c81['include']?_[_0x0b5d('0x1d')](_0x3d7c81['include'],function(_0x24445d){return{'model':db[_0x24445d[_0x0b5d('0x1e')]],'as':_0x24445d['as'],'attributes':_0x24445d[_0x0b5d('0x1a')],'include':_0x24445d[_0x0b5d('0x1c')]?_[_0x0b5d('0x1d')](_0x24445d[_0x0b5d('0x1c')],function(_0x5b1b20){return{'model':db[_0x5b1b20['model']],'as':_0x5b1b20['as'],'attributes':_0x5b1b20[_0x0b5d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0b5d('0x9')](function(_0x1bc7ee){logger[_0x0b5d('0xa')](_0x0b5d('0x14'),_0x47a7d6);logger[_0x0b5d('0xd')]('GetDynamics365Account',_0x47a7d6,JSON[_0x0b5d('0xf')](_0x1bc7ee));_0x40a00(_0x1bc7ee);})[_0x0b5d('0x1f')](function(_0xa2b26){logger[_0x0b5d('0x10')](_0x0b5d('0x14'),_0xa2b26['message'],_0x47a7d6);_0x1d6d50(_0x38d982[_0x0b5d('0x10')](0x1f4,_0xa2b26['message']));});});};exports['ShowDynamics365Account']=function(_0x26a836){var _0x4aefc3=this;return new Promise(function(_0x143707,_0x1ce8bb){return db[_0x0b5d('0x15')][_0x0b5d('0x20')]({'raw':_0x26a836['options']?_0x26a836[_0x0b5d('0x17')][_0x0b5d('0x18')]===undefined?!![]:![]:!![],'where':_0x26a836[_0x0b5d('0x17')]?_0x26a836[_0x0b5d('0x17')][_0x0b5d('0x19')]||null:null,'attributes':_0x26a836[_0x0b5d('0x17')]?_0x26a836[_0x0b5d('0x17')]['attributes']||null:null,'include':_0x26a836[_0x0b5d('0x17')]?_0x26a836[_0x0b5d('0x17')][_0x0b5d('0x1c')]?_[_0x0b5d('0x1d')](_0x26a836[_0x0b5d('0x17')][_0x0b5d('0x1c')],function(_0x3e441a){return{'model':db[_0x3e441a['model']],'as':_0x3e441a['as'],'attributes':_0x3e441a[_0x0b5d('0x1a')],'include':_0x3e441a['include']?_[_0x0b5d('0x1d')](_0x3e441a[_0x0b5d('0x1c')],function(_0x4650bf){return{'model':db[_0x4650bf[_0x0b5d('0x1e')]],'as':_0x4650bf['as'],'attributes':_0x4650bf[_0x0b5d('0x1a')],'include':_0x4650bf['include']?_['map'](_0x4650bf[_0x0b5d('0x1c')],function(_0x527328){return{'model':db[_0x527328['model']],'as':_0x527328['as'],'attributes':_0x527328[_0x0b5d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0b5d('0x9')](function(_0x51ed94){logger[_0x0b5d('0xa')](_0x0b5d('0x21'),_0x26a836);logger[_0x0b5d('0xd')](_0x0b5d('0x21'),_0x26a836,JSON['stringify'](_0x51ed94));_0x143707(_0x51ed94);})[_0x0b5d('0x1f')](function(_0x5259f4){logger[_0x0b5d('0x10')](_0x0b5d('0x21'),_0x5259f4['message'],_0x26a836);_0x1ce8bb(_0x4aefc3[_0x0b5d('0x10')](0x1f4,_0x5259f4[_0x0b5d('0x12')]));});});}; \ No newline at end of file +var _0x769a=['find','raw','info','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetDynamics365Account','findAll','options','where','attributes','limit','include','map','model','debug','catch','ShowDynamics365Account','Dynamics365Account'];(function(_0x103664,_0x213cac){var _0x5b388a=function(_0x2a49ff){while(--_0x2a49ff){_0x103664['push'](_0x103664['shift']());}};_0x5b388a(++_0x213cac);}(_0x769a,0x87));var _0xa769=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x769a[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xa769('0x0'));var moment=require(_0xa769('0x1'));var BPromise=require('bluebird');var rs=require(_0xa769('0x2'));var fs=require('fs');var Redis=require(_0xa769('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa769('0x4'));var logger=require(_0xa769('0x5'))('rpc');var config=require(_0xa769('0x6'));var jayson=require(_0xa769('0x7'));var client=jayson[_0xa769('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ab8a8,_0x4435d2,_0x41ee7b){return new BPromise(function(_0x5035d3,_0x363175){return client['request'](_0x5ab8a8,_0x41ee7b)[_0xa769('0x9')](function(_0x5b2723){logger['info'](_0xa769('0xa'),_0x4435d2,'request\x20sent');logger['debug'](_0xa769('0xb'),_0x4435d2,_0xa769('0xc'),JSON[_0xa769('0xd')](_0x5b2723));if(_0x5b2723[_0xa769('0xe')]){if(_0x5b2723[_0xa769('0xe')][_0xa769('0xf')]===0x1f4){logger[_0xa769('0xe')](_0xa769('0xa'),_0x4435d2,_0x5b2723[_0xa769('0xe')][_0xa769('0x10')]);return _0x363175(_0x5b2723[_0xa769('0xe')]['message']);}logger[_0xa769('0xe')](_0xa769('0xa'),_0x4435d2,_0x5b2723[_0xa769('0xe')][_0xa769('0x10')]);return _0x5035d3(_0x5b2723[_0xa769('0xe')]['message']);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4435d2,'request\x20sent');_0x5035d3(_0x5b2723['result'][_0xa769('0x10')]);}})['catch'](function(_0x4af7da){logger[_0xa769('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x4435d2,_0x4af7da);_0x363175(_0x4af7da);});});}exports[_0xa769('0x11')]=function(_0xae00b2){var _0x33c34b=this;return new Promise(function(_0x6323c0,_0x41a5c1){return db['Dynamics365Account'][_0xa769('0x12')]({'raw':_0xae00b2[_0xa769('0x13')]?_0xae00b2[_0xa769('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0xae00b2['options']?_0xae00b2[_0xa769('0x13')][_0xa769('0x14')]||null:null,'attributes':_0xae00b2[_0xa769('0x13')]?_0xae00b2[_0xa769('0x13')][_0xa769('0x15')]||null:null,'limit':_0xae00b2[_0xa769('0x13')]?_0xae00b2[_0xa769('0x13')][_0xa769('0x16')]||null:null,'include':_0xae00b2['options']?_0xae00b2['options'][_0xa769('0x17')]?_[_0xa769('0x18')](_0xae00b2['options'][_0xa769('0x17')],function(_0x26a8ab){return{'model':db[_0x26a8ab[_0xa769('0x19')]],'as':_0x26a8ab['as'],'attributes':_0x26a8ab[_0xa769('0x15')],'include':_0x26a8ab['include']?_[_0xa769('0x18')](_0x26a8ab[_0xa769('0x17')],function(_0xe6003f){return{'model':db[_0xe6003f['model']],'as':_0xe6003f['as'],'attributes':_0xe6003f[_0xa769('0x15')],'include':_0xe6003f[_0xa769('0x17')]?_[_0xa769('0x18')](_0xe6003f[_0xa769('0x17')],function(_0x198afb){return{'model':db[_0x198afb[_0xa769('0x19')]],'as':_0x198afb['as'],'attributes':_0x198afb[_0xa769('0x15')]};}):[]};}):[]};}):[]:[]})[_0xa769('0x9')](function(_0x4d8a64){logger['info'](_0xa769('0x11'),_0xae00b2);logger[_0xa769('0x1a')](_0xa769('0x11'),_0xae00b2,JSON['stringify'](_0x4d8a64));_0x6323c0(_0x4d8a64);})[_0xa769('0x1b')](function(_0x8a8abb){logger[_0xa769('0xe')](_0xa769('0x11'),_0x8a8abb[_0xa769('0x10')],_0xae00b2);_0x41a5c1(_0x33c34b[_0xa769('0xe')](0x1f4,_0x8a8abb['message']));});});};exports[_0xa769('0x1c')]=function(_0x44e1a5){var _0x2da144=this;return new Promise(function(_0x188009,_0x43985f){return db[_0xa769('0x1d')][_0xa769('0x1e')]({'raw':_0x44e1a5[_0xa769('0x13')]?_0x44e1a5['options'][_0xa769('0x1f')]===undefined?!![]:![]:!![],'where':_0x44e1a5['options']?_0x44e1a5['options']['where']||null:null,'attributes':_0x44e1a5['options']?_0x44e1a5['options']['attributes']||null:null,'include':_0x44e1a5[_0xa769('0x13')]?_0x44e1a5['options'][_0xa769('0x17')]?_[_0xa769('0x18')](_0x44e1a5[_0xa769('0x13')]['include'],function(_0x3b57c2){return{'model':db[_0x3b57c2['model']],'as':_0x3b57c2['as'],'attributes':_0x3b57c2[_0xa769('0x15')],'include':_0x3b57c2['include']?_[_0xa769('0x18')](_0x3b57c2[_0xa769('0x17')],function(_0xd2b003){return{'model':db[_0xd2b003['model']],'as':_0xd2b003['as'],'attributes':_0xd2b003[_0xa769('0x15')],'include':_0xd2b003[_0xa769('0x17')]?_[_0xa769('0x18')](_0xd2b003['include'],function(_0x45ab86){return{'model':db[_0x45ab86['model']],'as':_0x45ab86['as'],'attributes':_0x45ab86[_0xa769('0x15')]};}):[]};}):[]};}):[]:[]})[_0xa769('0x9')](function(_0xfe4382){logger[_0xa769('0x20')](_0xa769('0x1c'),_0x44e1a5);logger[_0xa769('0x1a')](_0xa769('0x1c'),_0x44e1a5,JSON[_0xa769('0xd')](_0xfe4382));_0x188009(_0xfe4382);})[_0xa769('0x1b')](function(_0x23b7aa){logger[_0xa769('0xe')]('ShowDynamics365Account',_0x23b7aa['message'],_0x44e1a5);_0x43985f(_0x2da144[_0xa769('0xe')](0x1f4,_0x23b7aa['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 50f72a4..5eafe7b 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 _0xff8d=['getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff8d,0x7d));var _0xdff8=function(_0x30ecb6,_0x4bcd0c){_0x30ecb6=_0x30ecb6-0x0;var _0x2e4833=_0xff8d[_0x30ecb6];return _0x2e4833;};'use strict';var multer=require('multer');var util=require(_0xdff8('0x0'));var path=require(_0xdff8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdff8('0x2')]();var fs_extra=require(_0xdff8('0x3'));var auth=require(_0xdff8('0x4'));var interaction=require(_0xdff8('0x5'));var config=require('../../config/environment');var controller=require(_0xdff8('0x6'));router[_0xdff8('0x7')]('/',auth[_0xdff8('0x8')](),controller[_0xdff8('0x9')]);router[_0xdff8('0x7')](_0xdff8('0xa'),auth[_0xdff8('0x8')](),controller[_0xdff8('0xb')]);router[_0xdff8('0x7')](_0xdff8('0xc'),auth[_0xdff8('0x8')](),controller[_0xdff8('0xd')]);router[_0xdff8('0x7')]('/:id/subjects',auth[_0xdff8('0x8')](),controller[_0xdff8('0xe')]);router[_0xdff8('0x7')](_0xdff8('0xf'),auth[_0xdff8('0x8')](),controller[_0xdff8('0x10')]);router[_0xdff8('0x11')]('/',auth[_0xdff8('0x8')](),controller[_0xdff8('0x12')]);router['put'](_0xdff8('0xa'),auth[_0xdff8('0x8')](),controller[_0xdff8('0x13')]);router[_0xdff8('0x14')](_0xdff8('0xa'),auth[_0xdff8('0x8')](),controller[_0xdff8('0x15')]);module[_0xdff8('0x16')]=router; \ No newline at end of file +var _0x05b6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x43b34a,_0x39f685){var _0x4d4b3b=function(_0x488b72){while(--_0x488b72){_0x43b34a['push'](_0x43b34a['shift']());}};_0x4d4b3b(++_0x39f685);}(_0x05b6,0x74));var _0x605b=function(_0x293fa7,_0x1bdf5c){_0x293fa7=_0x293fa7-0x0;var _0x3f54dc=_0x05b6[_0x293fa7];return _0x3f54dc;};'use strict';var multer=require(_0x605b('0x0'));var util=require('util');var path=require(_0x605b('0x1'));var timeout=require(_0x605b('0x2'));var express=require(_0x605b('0x3'));var router=express[_0x605b('0x4')]();var fs_extra=require(_0x605b('0x5'));var auth=require(_0x605b('0x6'));var interaction=require(_0x605b('0x7'));var config=require(_0x605b('0x8'));var controller=require(_0x605b('0x9'));router[_0x605b('0xa')]('/',auth[_0x605b('0xb')](),controller[_0x605b('0xc')]);router[_0x605b('0xa')](_0x605b('0xd'),auth[_0x605b('0xb')](),controller[_0x605b('0xe')]);router[_0x605b('0xa')](_0x605b('0xf'),auth[_0x605b('0xb')](),controller['getFields']);router[_0x605b('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x605b('0xa')](_0x605b('0x10'),auth[_0x605b('0xb')](),controller[_0x605b('0x11')]);router[_0x605b('0x12')]('/',auth[_0x605b('0xb')](),controller[_0x605b('0x13')]);router[_0x605b('0x14')](_0x605b('0xd'),auth[_0x605b('0xb')](),controller[_0x605b('0x15')]);router[_0x605b('0x16')](_0x605b('0xd'),auth[_0x605b('0xb')](),controller['destroy']);module[_0x605b('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 dd3c66d..27a907e 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 _0xc2d9=['contact','nothing','BOOLEAN','sequelize','exports','STRING','ENUM','phonecall','incident'];(function(_0x574b74,_0x12d5fe){var _0x560c7c=function(_0x221f75){while(--_0x221f75){_0x574b74['push'](_0x574b74['shift']());}};_0x560c7c(++_0x12d5fe);}(_0xc2d9,0x9c));var _0x9c2d=function(_0x3f49c5,_0x2828db){_0x3f49c5=_0x3f49c5-0x0;var _0x34f3d2=_0xc2d9[_0x3f49c5];return _0x34f3d2;};'use strict';var Sequelize=require(_0x9c2d('0x0'));module[_0x9c2d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9c2d('0x2')]},'ticketType':{'type':Sequelize[_0x9c2d('0x3')]('incident',_0x9c2d('0x4')),'defaultValue':_0x9c2d('0x5')},'moduleCreate':{'type':Sequelize[_0x9c2d('0x3')](_0x9c2d('0x6'),_0x9c2d('0x7')),'defaultValue':_0x9c2d('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x9c2d('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x9c2d('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc5f8=['ENUM','incident','contact','nothing','sequelize','exports','STRING'];(function(_0x4849f7,_0x4f570b){var _0x3d844f=function(_0x1f97bb){while(--_0x1f97bb){_0x4849f7['push'](_0x4849f7['shift']());}};_0x3d844f(++_0x4f570b);}(_0xc5f8,0x7b));var _0x8c5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5f8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8c5f('0x0'));module[_0x8c5f('0x1')]={'name':{'type':Sequelize[_0x8c5f('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x8c5f('0x3')](_0x8c5f('0x4'),'phonecall'),'defaultValue':_0x8c5f('0x4')},'moduleCreate':{'type':Sequelize[_0x8c5f('0x3')](_0x8c5f('0x5'),_0x8c5f('0x6')),'defaultValue':_0x8c5f('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x8c5f('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index d75f572..0ae3228 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 _0xea35=['merge','then','includeAll','include','params','options','find','catch','create','body','update','getFields','findOne','getSubjects','Dynamics365Field','order','getDescriptions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','destroy','end','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter'];(function(_0x331298,_0x12341a){var _0x3824bc=function(_0x19449f){while(--_0x19449f){_0x331298['push'](_0x331298['shift']());}};_0x3824bc(++_0x12341a);}(_0xea35,0x1d4));var _0x5ea3=function(_0x1ada3a,_0x2661fc){_0x1ada3a=_0x1ada3a-0x0;var _0x317063=_0xea35[_0x1ada3a];return _0x317063;};'use strict';var emlformat=require(_0x5ea3('0x0'));var rimraf=require(_0x5ea3('0x1'));var zipdir=require(_0x5ea3('0x2'));var jsonpatch=require(_0x5ea3('0x3'));var rp=require(_0x5ea3('0x4'));var moment=require(_0x5ea3('0x5'));var BPromise=require(_0x5ea3('0x6'));var Mustache=require(_0x5ea3('0x7'));var util=require('util');var path=require(_0x5ea3('0x8'));var sox=require(_0x5ea3('0x9'));var csv=require('to-csv');var ejs=require(_0x5ea3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ea3('0xb'));var squel=require('squel');var crypto=require(_0x5ea3('0xc'));var jsforce=require(_0x5ea3('0xd'));var deskjs=require(_0x5ea3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5ea3('0xf'));var Papa=require('papaparse');var Redis=require(_0x5ea3('0x10'));var authService=require(_0x5ea3('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ea3('0x12'));var logger=require('../../config/logger')(_0x5ea3('0x13'));var utils=require('../../config/utils');var config=require(_0x5ea3('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x245ccd,_0x55af13){_0x55af13=_0x55af13||0xcc;return function(_0x249f19){if(_0x249f19){return _0x245ccd['sendStatus'](_0x55af13);}return _0x245ccd[_0x5ea3('0x15')](_0x55af13)['end']();};}function respondWithResult(_0xfc26e2,_0x4bb7f0){_0x4bb7f0=_0x4bb7f0||0xc8;return function(_0x5c9b22){if(_0x5c9b22){return _0xfc26e2[_0x5ea3('0x15')](_0x4bb7f0)[_0x5ea3('0x16')](_0x5c9b22);}};}function respondWithFilteredResult(_0x4ebe03,_0x1f5347){return function(_0x5b4e58){if(_0x5b4e58){var _0x791f24=typeof _0x1f5347[_0x5ea3('0x17')]==='undefined'&&typeof _0x1f5347[_0x5ea3('0x18')]===_0x5ea3('0x19');var _0x402bed=_0x5b4e58[_0x5ea3('0x1a')];var _0x12819f=_0x791f24?0x0:_0x1f5347[_0x5ea3('0x17')];var _0x5ab4aa=_0x791f24?_0x5b4e58[_0x5ea3('0x1a')]:_0x1f5347[_0x5ea3('0x17')]+_0x1f5347[_0x5ea3('0x18')];var _0x2dc2ef;if(_0x5ab4aa>=_0x402bed){_0x5ab4aa=_0x402bed;_0x2dc2ef=0xc8;}else{_0x2dc2ef=0xce;}_0x4ebe03['status'](_0x2dc2ef);return _0x4ebe03[_0x5ea3('0x1b')](_0x5ea3('0x1c'),_0x12819f+'-'+_0x5ab4aa+'/'+_0x402bed)[_0x5ea3('0x16')](_0x5b4e58);}return null;};}function patchUpdates(_0x54d725){return function(_0x2a117e){try{jsonpatch['apply'](_0x2a117e,_0x54d725,!![]);}catch(_0x200783){return BPromise[_0x5ea3('0x1d')](_0x200783);}return _0x2a117e[_0x5ea3('0x1e')]();};}function saveUpdates(_0x40a1d5,_0x4fe0f8){return function(_0x35550c){if(_0x35550c){return _0x35550c['update'](_0x40a1d5)['then'](function(_0x1f2434){return _0x1f2434;});}return null;};}function removeEntity(_0x53f5c3,_0x3b734a){return function(_0x2d21ff){if(_0x2d21ff){return _0x2d21ff[_0x5ea3('0x1f')]()['then'](function(){_0x53f5c3[_0x5ea3('0x15')](0xcc)[_0x5ea3('0x20')]();});}};}function handleEntityNotFound(_0xc2cb4c,_0x352930){return function(_0x30c1d3){if(!_0x30c1d3){_0xc2cb4c['sendStatus'](0x194);}return _0x30c1d3;};}function handleError(_0x125cb5,_0x510c1a){_0x510c1a=_0x510c1a||0x1f4;return function(_0xe7ab2e){logger[_0x5ea3('0x21')](_0xe7ab2e['stack']);if(_0xe7ab2e['name']){delete _0xe7ab2e[_0x5ea3('0x22')];}_0x125cb5['status'](_0x510c1a)[_0x5ea3('0x23')](_0xe7ab2e);};}exports[_0x5ea3('0x24')]=function(_0x4c766c,_0x43805d){var _0xeb9dc8={},_0x24e885={},_0x335253={'count':0x0,'rows':[]};var _0x30c97b=_[_0x5ea3('0x25')](db[_0x5ea3('0x26')][_0x5ea3('0x27')],function(_0x38019e){return{'name':_0x38019e[_0x5ea3('0x28')],'type':_0x38019e[_0x5ea3('0x29')][_0x5ea3('0x2a')]};});_0x24e885[_0x5ea3('0x2b')]=_['map'](_0x30c97b,_0x5ea3('0x22'));_0x24e885[_0x5ea3('0x2c')]=_[_0x5ea3('0x2d')](_0x4c766c['query']);_0x24e885[_0x5ea3('0x2e')]=_[_0x5ea3('0x2f')](_0x24e885[_0x5ea3('0x2b')],_0x24e885['query']);_0xeb9dc8[_0x5ea3('0x30')]=_['intersection'](_0x24e885['model'],qs[_0x5ea3('0x31')](_0x4c766c['query'][_0x5ea3('0x31')]));_0xeb9dc8[_0x5ea3('0x30')]=_0xeb9dc8[_0x5ea3('0x30')][_0x5ea3('0x32')]?_0xeb9dc8[_0x5ea3('0x30')]:_0x24e885[_0x5ea3('0x2b')];if(!_0x4c766c[_0x5ea3('0x2c')]['hasOwnProperty'](_0x5ea3('0x33'))){_0xeb9dc8[_0x5ea3('0x18')]=qs[_0x5ea3('0x18')](_0x4c766c[_0x5ea3('0x2c')][_0x5ea3('0x18')]);_0xeb9dc8[_0x5ea3('0x17')]=qs[_0x5ea3('0x17')](_0x4c766c[_0x5ea3('0x2c')]['offset']);}_0xeb9dc8['order']=qs[_0x5ea3('0x34')](_0x4c766c[_0x5ea3('0x2c')]['sort']);_0xeb9dc8[_0x5ea3('0x35')]=qs[_0x5ea3('0x2e')](_[_0x5ea3('0x36')](_0x4c766c[_0x5ea3('0x2c')],_0x24e885['filters']),_0x30c97b);if(_0x4c766c['query']['filter']){_0xeb9dc8[_0x5ea3('0x35')]=_['merge'](_0xeb9dc8[_0x5ea3('0x35')],{'$or':_[_0x5ea3('0x25')](_0x30c97b,function(_0x403cf9){if(_0x403cf9[_0x5ea3('0x29')]!==_0x5ea3('0x37')){var _0x5181a7={};_0x5181a7[_0x403cf9[_0x5ea3('0x22')]]={'$like':'%'+_0x4c766c[_0x5ea3('0x2c')][_0x5ea3('0x38')]+'%'};return _0x5181a7;}})});}_0xeb9dc8=_[_0x5ea3('0x39')]({},_0xeb9dc8,_0x4c766c['options']);var _0x29b896={'where':_0xeb9dc8['where']};return db[_0x5ea3('0x26')]['count'](_0x29b896)[_0x5ea3('0x3a')](function(_0x3f8841){_0x335253['count']=_0x3f8841;if(_0x4c766c['query'][_0x5ea3('0x3b')]){_0xeb9dc8[_0x5ea3('0x3c')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0xeb9dc8);})['then'](function(_0x156ac4){_0x335253['rows']=_0x156ac4;return _0x335253;})[_0x5ea3('0x3a')](respondWithFilteredResult(_0x43805d,_0xeb9dc8))['catch'](handleError(_0x43805d,null));};exports['show']=function(_0x495498,_0xe53ffa){var _0x55415d={'raw':![],'where':{'id':_0x495498[_0x5ea3('0x3d')]['id']}},_0x949c39={};_0x949c39[_0x5ea3('0x2b')]=_[_0x5ea3('0x2d')](db['Dynamics365Configuration']['rawAttributes']);_0x949c39[_0x5ea3('0x2c')]=_[_0x5ea3('0x2d')](_0x495498[_0x5ea3('0x2c')]);_0x949c39[_0x5ea3('0x2e')]=_[_0x5ea3('0x2f')](_0x949c39[_0x5ea3('0x2b')],_0x949c39[_0x5ea3('0x2c')]);_0x55415d[_0x5ea3('0x30')]=_[_0x5ea3('0x2f')](_0x949c39['model'],qs[_0x5ea3('0x31')](_0x495498[_0x5ea3('0x2c')][_0x5ea3('0x31')]));_0x55415d[_0x5ea3('0x30')]=_0x55415d['attributes']['length']?_0x55415d[_0x5ea3('0x30')]:_0x949c39['model'];if(_0x495498[_0x5ea3('0x2c')][_0x5ea3('0x3b')]){_0x55415d['include']=[{'all':!![]}];}_0x55415d=_[_0x5ea3('0x39')]({},_0x55415d,_0x495498[_0x5ea3('0x3e')]);return db[_0x5ea3('0x26')][_0x5ea3('0x3f')](_0x55415d)[_0x5ea3('0x3a')](handleEntityNotFound(_0xe53ffa,null))[_0x5ea3('0x3a')](respondWithResult(_0xe53ffa,null))[_0x5ea3('0x40')](handleError(_0xe53ffa,null));};exports['create']=function(_0x31c1a,_0x3047ac){return db[_0x5ea3('0x26')][_0x5ea3('0x41')](_0x31c1a[_0x5ea3('0x42')],{})['then'](respondWithResult(_0x3047ac,0xc9))['catch'](handleError(_0x3047ac,null));};exports[_0x5ea3('0x43')]=function(_0x1886a2,_0x3c4882){if(_0x1886a2[_0x5ea3('0x42')]['id']){delete _0x1886a2[_0x5ea3('0x42')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x1886a2['params']['id']}})[_0x5ea3('0x3a')](handleEntityNotFound(_0x3c4882,null))[_0x5ea3('0x3a')](saveUpdates(_0x1886a2['body'],null))[_0x5ea3('0x3a')](respondWithResult(_0x3c4882,null))[_0x5ea3('0x40')](handleError(_0x3c4882,null));};exports['destroy']=function(_0x3bb75d,_0x2d5bfe){return db[_0x5ea3('0x26')][_0x5ea3('0x3f')]({'where':{'id':_0x3bb75d['params']['id']}})['then'](handleEntityNotFound(_0x2d5bfe,null))['then'](removeEntity(_0x2d5bfe,null))[_0x5ea3('0x40')](handleError(_0x2d5bfe,null));};exports[_0x5ea3('0x44')]=function(_0x459597,_0x233ae1,_0x5acf25){var _0x10e8c0={};var _0x1dac34={};var _0x2ac5d4;var _0xd0ad5d;return db[_0x5ea3('0x26')][_0x5ea3('0x45')]({'where':{'id':_0x459597[_0x5ea3('0x3d')]['id']}})[_0x5ea3('0x3a')](handleEntityNotFound(_0x233ae1,null))[_0x5ea3('0x3a')](function(_0x32fd2e){if(_0x32fd2e){_0x2ac5d4=_0x32fd2e;_0x1dac34['model']=_[_0x5ea3('0x2d')](db['Dynamics365Field'][_0x5ea3('0x27')]);_0x1dac34[_0x5ea3('0x2c')]=_[_0x5ea3('0x2d')](_0x459597[_0x5ea3('0x2c')]);_0x1dac34[_0x5ea3('0x2e')]=_[_0x5ea3('0x2f')](_0x1dac34[_0x5ea3('0x2b')],_0x1dac34[_0x5ea3('0x2c')]);_0x10e8c0[_0x5ea3('0x30')]=_['intersection'](_0x1dac34['model'],qs[_0x5ea3('0x31')](_0x459597[_0x5ea3('0x2c')][_0x5ea3('0x31')]));_0x10e8c0[_0x5ea3('0x30')]=_0x10e8c0[_0x5ea3('0x30')]['length']?_0x10e8c0[_0x5ea3('0x30')]:_0x1dac34['model'];_0x10e8c0['order']=qs['sort'](_0x459597[_0x5ea3('0x2c')][_0x5ea3('0x34')]);_0x10e8c0[_0x5ea3('0x35')]=qs[_0x5ea3('0x2e')](_[_0x5ea3('0x36')](_0x459597[_0x5ea3('0x2c')],_0x1dac34[_0x5ea3('0x2e')]));if(_0x459597[_0x5ea3('0x2c')][_0x5ea3('0x38')]){_0x10e8c0[_0x5ea3('0x35')]=_[_0x5ea3('0x39')](_0x10e8c0['where'],{'$or':_['map'](_0x10e8c0[_0x5ea3('0x30')],function(_0x3cfcac){var _0x584264={};_0x584264[_0x3cfcac]={'$like':'%'+_0x459597[_0x5ea3('0x2c')][_0x5ea3('0x38')]+'%'};return _0x584264;})});}_0x10e8c0=_[_0x5ea3('0x39')]({},_0x10e8c0,_0x459597[_0x5ea3('0x3e')]);return _0x2ac5d4['getFields'](_0x10e8c0);}})[_0x5ea3('0x3a')](function(_0x3544ff){if(_0x3544ff){_0xd0ad5d=_0x3544ff['length'];if(!_0x459597['query']['hasOwnProperty'](_0x5ea3('0x33'))){_0x10e8c0[_0x5ea3('0x18')]=qs[_0x5ea3('0x18')](_0x459597['query'][_0x5ea3('0x18')]);_0x10e8c0[_0x5ea3('0x17')]=qs[_0x5ea3('0x17')](_0x459597[_0x5ea3('0x2c')][_0x5ea3('0x17')]);}return _0x2ac5d4[_0x5ea3('0x44')](_0x10e8c0);}})['then'](function(_0x50d75e){if(_0x50d75e){return _0x50d75e?{'count':_0xd0ad5d,'rows':_0x50d75e}:null;}})[_0x5ea3('0x3a')](respondWithResult(_0x233ae1,null))[_0x5ea3('0x40')](handleError(_0x233ae1,null));};exports[_0x5ea3('0x46')]=function(_0x42135a,_0x5791f0,_0x2569c7){var _0x54f426={};var _0x55b90d={};var _0x48b9f7;var _0x4fd84d;return db['Dynamics365Configuration'][_0x5ea3('0x45')]({'where':{'id':_0x42135a['params']['id']}})[_0x5ea3('0x3a')](handleEntityNotFound(_0x5791f0,null))['then'](function(_0x24dcb1){if(_0x24dcb1){_0x48b9f7=_0x24dcb1;_0x55b90d[_0x5ea3('0x2b')]=_[_0x5ea3('0x2d')](db[_0x5ea3('0x47')][_0x5ea3('0x27')]);_0x55b90d[_0x5ea3('0x2c')]=_[_0x5ea3('0x2d')](_0x42135a['query']);_0x55b90d[_0x5ea3('0x2e')]=_[_0x5ea3('0x2f')](_0x55b90d[_0x5ea3('0x2b')],_0x55b90d[_0x5ea3('0x2c')]);_0x54f426['attributes']=_[_0x5ea3('0x2f')](_0x55b90d['model'],qs[_0x5ea3('0x31')](_0x42135a[_0x5ea3('0x2c')]['fields']));_0x54f426[_0x5ea3('0x30')]=_0x54f426[_0x5ea3('0x30')][_0x5ea3('0x32')]?_0x54f426['attributes']:_0x55b90d[_0x5ea3('0x2b')];_0x54f426[_0x5ea3('0x48')]=qs[_0x5ea3('0x34')](_0x42135a[_0x5ea3('0x2c')][_0x5ea3('0x34')]);_0x54f426[_0x5ea3('0x35')]=qs[_0x5ea3('0x2e')](_[_0x5ea3('0x36')](_0x42135a[_0x5ea3('0x2c')],_0x55b90d['filters']));if(_0x42135a['query'][_0x5ea3('0x38')]){_0x54f426[_0x5ea3('0x35')]=_['merge'](_0x54f426[_0x5ea3('0x35')],{'$or':_[_0x5ea3('0x25')](_0x54f426['attributes'],function(_0x2d88a4){var _0x243d97={};_0x243d97[_0x2d88a4]={'$like':'%'+_0x42135a[_0x5ea3('0x2c')][_0x5ea3('0x38')]+'%'};return _0x243d97;})});}_0x54f426=_[_0x5ea3('0x39')]({},_0x54f426,_0x42135a['options']);return _0x48b9f7[_0x5ea3('0x46')](_0x54f426);}})[_0x5ea3('0x3a')](function(_0x22c43d){if(_0x22c43d){_0x4fd84d=_0x22c43d[_0x5ea3('0x32')];if(!_0x42135a[_0x5ea3('0x2c')]['hasOwnProperty'](_0x5ea3('0x33'))){_0x54f426[_0x5ea3('0x18')]=qs['limit'](_0x42135a['query'][_0x5ea3('0x18')]);_0x54f426['offset']=qs[_0x5ea3('0x17')](_0x42135a[_0x5ea3('0x2c')][_0x5ea3('0x17')]);}return _0x48b9f7[_0x5ea3('0x46')](_0x54f426);}})[_0x5ea3('0x3a')](function(_0x2a55f8){if(_0x2a55f8){return _0x2a55f8?{'count':_0x4fd84d,'rows':_0x2a55f8}:null;}})[_0x5ea3('0x3a')](respondWithResult(_0x5791f0,null))['catch'](handleError(_0x5791f0,null));};exports[_0x5ea3('0x49')]=function(_0x230c16,_0x5bd0f8,_0x5328f4){var _0x397e6f={};var _0x50f2f7={};var _0x142c29;var _0x4a73c3;return db[_0x5ea3('0x26')]['findOne']({'where':{'id':_0x230c16[_0x5ea3('0x3d')]['id']}})[_0x5ea3('0x3a')](handleEntityNotFound(_0x5bd0f8,null))[_0x5ea3('0x3a')](function(_0x1efbfe){if(_0x1efbfe){_0x142c29=_0x1efbfe;_0x50f2f7[_0x5ea3('0x2b')]=_[_0x5ea3('0x2d')](db[_0x5ea3('0x47')]['rawAttributes']);_0x50f2f7[_0x5ea3('0x2c')]=_[_0x5ea3('0x2d')](_0x230c16[_0x5ea3('0x2c')]);_0x50f2f7['filters']=_[_0x5ea3('0x2f')](_0x50f2f7[_0x5ea3('0x2b')],_0x50f2f7[_0x5ea3('0x2c')]);_0x397e6f['attributes']=_['intersection'](_0x50f2f7['model'],qs[_0x5ea3('0x31')](_0x230c16[_0x5ea3('0x2c')][_0x5ea3('0x31')]));_0x397e6f['attributes']=_0x397e6f['attributes'][_0x5ea3('0x32')]?_0x397e6f[_0x5ea3('0x30')]:_0x50f2f7['model'];_0x397e6f['order']=qs[_0x5ea3('0x34')](_0x230c16[_0x5ea3('0x2c')][_0x5ea3('0x34')]);_0x397e6f[_0x5ea3('0x35')]=qs[_0x5ea3('0x2e')](_[_0x5ea3('0x36')](_0x230c16[_0x5ea3('0x2c')],_0x50f2f7[_0x5ea3('0x2e')]));if(_0x230c16[_0x5ea3('0x2c')][_0x5ea3('0x38')]){_0x397e6f[_0x5ea3('0x35')]=_[_0x5ea3('0x39')](_0x397e6f[_0x5ea3('0x35')],{'$or':_[_0x5ea3('0x25')](_0x397e6f['attributes'],function(_0x15d23f){var _0x3deaeb={};_0x3deaeb[_0x15d23f]={'$like':'%'+_0x230c16['query'][_0x5ea3('0x38')]+'%'};return _0x3deaeb;})});}_0x397e6f=_[_0x5ea3('0x39')]({},_0x397e6f,_0x230c16[_0x5ea3('0x3e')]);return _0x142c29[_0x5ea3('0x49')](_0x397e6f);}})[_0x5ea3('0x3a')](function(_0x2d147b){if(_0x2d147b){_0x4a73c3=_0x2d147b['length'];if(!_0x230c16[_0x5ea3('0x2c')][_0x5ea3('0x4a')]('nolimit')){_0x397e6f[_0x5ea3('0x18')]=qs['limit'](_0x230c16[_0x5ea3('0x2c')][_0x5ea3('0x18')]);_0x397e6f[_0x5ea3('0x17')]=qs[_0x5ea3('0x17')](_0x230c16[_0x5ea3('0x2c')][_0x5ea3('0x17')]);}return _0x142c29[_0x5ea3('0x49')](_0x397e6f);}})[_0x5ea3('0x3a')](function(_0x279631){if(_0x279631){return _0x279631?{'count':_0x4a73c3,'rows':_0x279631}:null;}})['then'](respondWithResult(_0x5bd0f8,null))['catch'](handleError(_0x5bd0f8,null));}; \ No newline at end of file +var _0x4839=['map','Dynamics365Configuration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','include','find','catch','create','body','destroy','getFields','order','getSubjects','findOne','Dynamics365Field','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','limit','count','offset','Content-Range','reject','save','update','then','stack','name','index'];(function(_0xd168dc,_0x3594bd){var _0x27decd=function(_0x1a4a81){while(--_0x1a4a81){_0xd168dc['push'](_0xd168dc['shift']());}};_0x27decd(++_0x3594bd);}(_0x4839,0x152));var _0x9483=function(_0x2c4bb2,_0x508570){_0x2c4bb2=_0x2c4bb2-0x0;var _0x451126=_0x4839[_0x2c4bb2];return _0x451126;};'use strict';var emlformat=require(_0x9483('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9483('0x1'));var jsonpatch=require(_0x9483('0x2'));var rp=require(_0x9483('0x3'));var moment=require(_0x9483('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9483('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9483('0x6'));var csv=require('to-csv');var ejs=require(_0x9483('0x7'));var fs=require('fs');var fs_extra=require(_0x9483('0x8'));var _=require(_0x9483('0x9'));var squel=require('squel');var crypto=require(_0x9483('0xa'));var jsforce=require(_0x9483('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9483('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9483('0xd'));var authService=require(_0x9483('0xe'));var qs=require(_0x9483('0xf'));var as=require(_0x9483('0x10'));var hardwareService=require(_0x9483('0x11'));var logger=require(_0x9483('0x12'))(_0x9483('0x13'));var utils=require('../../config/utils');var config=require(_0x9483('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9483('0x15'))['db'];function respondWithStatusCode(_0x5db07b,_0x5b0036){_0x5b0036=_0x5b0036||0xcc;return function(_0x511f3d){if(_0x511f3d){return _0x5db07b[_0x9483('0x16')](_0x5b0036);}return _0x5db07b['status'](_0x5b0036)[_0x9483('0x17')]();};}function respondWithResult(_0x11148d,_0xabd7d0){_0xabd7d0=_0xabd7d0||0xc8;return function(_0x204434){if(_0x204434){return _0x11148d[_0x9483('0x18')](_0xabd7d0)[_0x9483('0x19')](_0x204434);}};}function respondWithFilteredResult(_0xb5c1b3,_0x51924a){return function(_0x4e351a){if(_0x4e351a){var _0x1060a2=typeof _0x51924a['offset']==='undefined'&&typeof _0x51924a[_0x9483('0x1a')]==='undefined';var _0x1e865c=_0x4e351a[_0x9483('0x1b')];var _0x3194b3=_0x1060a2?0x0:_0x51924a[_0x9483('0x1c')];var _0x3b8bc7=_0x1060a2?_0x4e351a[_0x9483('0x1b')]:_0x51924a[_0x9483('0x1c')]+_0x51924a[_0x9483('0x1a')];var _0x48258d;if(_0x3b8bc7>=_0x1e865c){_0x3b8bc7=_0x1e865c;_0x48258d=0xc8;}else{_0x48258d=0xce;}_0xb5c1b3[_0x9483('0x18')](_0x48258d);return _0xb5c1b3['set'](_0x9483('0x1d'),_0x3194b3+'-'+_0x3b8bc7+'/'+_0x1e865c)[_0x9483('0x19')](_0x4e351a);}return null;};}function patchUpdates(_0x1f87c7){return function(_0x24c224){try{jsonpatch['apply'](_0x24c224,_0x1f87c7,!![]);}catch(_0x558b21){return BPromise[_0x9483('0x1e')](_0x558b21);}return _0x24c224[_0x9483('0x1f')]();};}function saveUpdates(_0x3ba1f8,_0x21e732){return function(_0x5f00ba){if(_0x5f00ba){return _0x5f00ba[_0x9483('0x20')](_0x3ba1f8)[_0x9483('0x21')](function(_0x2a9d71){return _0x2a9d71;});}return null;};}function removeEntity(_0x3511c2,_0x5ecc39){return function(_0x24edb7){if(_0x24edb7){return _0x24edb7['destroy']()[_0x9483('0x21')](function(){_0x3511c2[_0x9483('0x18')](0xcc)[_0x9483('0x17')]();});}};}function handleEntityNotFound(_0x19c4cc,_0x2915ab){return function(_0x3d1f78){if(!_0x3d1f78){_0x19c4cc[_0x9483('0x16')](0x194);}return _0x3d1f78;};}function handleError(_0x4e72a8,_0x4f96e2){_0x4f96e2=_0x4f96e2||0x1f4;return function(_0x29af17){logger['error'](_0x29af17[_0x9483('0x22')]);if(_0x29af17['name']){delete _0x29af17[_0x9483('0x23')];}_0x4e72a8['status'](_0x4f96e2)['send'](_0x29af17);};}exports[_0x9483('0x24')]=function(_0xb36d4c,_0x25f216){var _0x571385={},_0x5f2762={},_0x34a0d7={'count':0x0,'rows':[]};var _0x50e38b=_[_0x9483('0x25')](db[_0x9483('0x26')][_0x9483('0x27')],function(_0x4536f5){return{'name':_0x4536f5['fieldName'],'type':_0x4536f5[_0x9483('0x28')][_0x9483('0x29')]};});_0x5f2762[_0x9483('0x2a')]=_[_0x9483('0x25')](_0x50e38b,'name');_0x5f2762[_0x9483('0x2b')]=_[_0x9483('0x2c')](_0xb36d4c['query']);_0x5f2762[_0x9483('0x2d')]=_[_0x9483('0x2e')](_0x5f2762[_0x9483('0x2a')],_0x5f2762[_0x9483('0x2b')]);_0x571385[_0x9483('0x2f')]=_[_0x9483('0x2e')](_0x5f2762['model'],qs[_0x9483('0x30')](_0xb36d4c[_0x9483('0x2b')]['fields']));_0x571385[_0x9483('0x2f')]=_0x571385['attributes'][_0x9483('0x31')]?_0x571385['attributes']:_0x5f2762[_0x9483('0x2a')];if(!_0xb36d4c['query'][_0x9483('0x32')](_0x9483('0x33'))){_0x571385[_0x9483('0x1a')]=qs['limit'](_0xb36d4c[_0x9483('0x2b')][_0x9483('0x1a')]);_0x571385[_0x9483('0x1c')]=qs[_0x9483('0x1c')](_0xb36d4c[_0x9483('0x2b')][_0x9483('0x1c')]);}_0x571385['order']=qs[_0x9483('0x34')](_0xb36d4c[_0x9483('0x2b')]['sort']);_0x571385[_0x9483('0x35')]=qs['filters'](_[_0x9483('0x36')](_0xb36d4c[_0x9483('0x2b')],_0x5f2762[_0x9483('0x2d')]),_0x50e38b);if(_0xb36d4c[_0x9483('0x2b')][_0x9483('0x37')]){_0x571385[_0x9483('0x35')]=_[_0x9483('0x38')](_0x571385[_0x9483('0x35')],{'$or':_[_0x9483('0x25')](_0x50e38b,function(_0x4ed5a2){if(_0x4ed5a2['type']!==_0x9483('0x39')){var _0x207661={};_0x207661[_0x4ed5a2[_0x9483('0x23')]]={'$like':'%'+_0xb36d4c[_0x9483('0x2b')][_0x9483('0x37')]+'%'};return _0x207661;}})});}_0x571385=_[_0x9483('0x38')]({},_0x571385,_0xb36d4c[_0x9483('0x3a')]);var _0x16c2a2={'where':_0x571385[_0x9483('0x35')]};return db[_0x9483('0x26')][_0x9483('0x1b')](_0x16c2a2)[_0x9483('0x21')](function(_0x536178){_0x34a0d7[_0x9483('0x1b')]=_0x536178;if(_0xb36d4c[_0x9483('0x2b')][_0x9483('0x3b')]){_0x571385['include']=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x571385);})['then'](function(_0x4b01a0){_0x34a0d7[_0x9483('0x3c')]=_0x4b01a0;return _0x34a0d7;})[_0x9483('0x21')](respondWithFilteredResult(_0x25f216,_0x571385))['catch'](handleError(_0x25f216,null));};exports[_0x9483('0x3d')]=function(_0x367728,_0x4c35e3){var _0x3c54c0={'raw':![],'where':{'id':_0x367728[_0x9483('0x3e')]['id']}},_0x35d8d3={};_0x35d8d3['model']=_[_0x9483('0x2c')](db['Dynamics365Configuration']['rawAttributes']);_0x35d8d3[_0x9483('0x2b')]=_[_0x9483('0x2c')](_0x367728[_0x9483('0x2b')]);_0x35d8d3[_0x9483('0x2d')]=_[_0x9483('0x2e')](_0x35d8d3[_0x9483('0x2a')],_0x35d8d3[_0x9483('0x2b')]);_0x3c54c0[_0x9483('0x2f')]=_[_0x9483('0x2e')](_0x35d8d3[_0x9483('0x2a')],qs[_0x9483('0x30')](_0x367728[_0x9483('0x2b')][_0x9483('0x30')]));_0x3c54c0[_0x9483('0x2f')]=_0x3c54c0[_0x9483('0x2f')][_0x9483('0x31')]?_0x3c54c0[_0x9483('0x2f')]:_0x35d8d3[_0x9483('0x2a')];if(_0x367728[_0x9483('0x2b')][_0x9483('0x3b')]){_0x3c54c0[_0x9483('0x3f')]=[{'all':!![]}];}_0x3c54c0=_['merge']({},_0x3c54c0,_0x367728[_0x9483('0x3a')]);return db[_0x9483('0x26')][_0x9483('0x40')](_0x3c54c0)[_0x9483('0x21')](handleEntityNotFound(_0x4c35e3,null))[_0x9483('0x21')](respondWithResult(_0x4c35e3,null))[_0x9483('0x41')](handleError(_0x4c35e3,null));};exports[_0x9483('0x42')]=function(_0x50511e,_0x17384f){return db['Dynamics365Configuration']['create'](_0x50511e[_0x9483('0x43')],{})[_0x9483('0x21')](respondWithResult(_0x17384f,0xc9))[_0x9483('0x41')](handleError(_0x17384f,null));};exports['update']=function(_0x25d35c,_0x52619c){if(_0x25d35c[_0x9483('0x43')]['id']){delete _0x25d35c[_0x9483('0x43')]['id'];}return db['Dynamics365Configuration'][_0x9483('0x40')]({'where':{'id':_0x25d35c['params']['id']}})[_0x9483('0x21')](handleEntityNotFound(_0x52619c,null))[_0x9483('0x21')](saveUpdates(_0x25d35c[_0x9483('0x43')],null))[_0x9483('0x21')](respondWithResult(_0x52619c,null))[_0x9483('0x41')](handleError(_0x52619c,null));};exports[_0x9483('0x44')]=function(_0x47eef0,_0x2bb398){return db['Dynamics365Configuration'][_0x9483('0x40')]({'where':{'id':_0x47eef0['params']['id']}})[_0x9483('0x21')](handleEntityNotFound(_0x2bb398,null))['then'](removeEntity(_0x2bb398,null))['catch'](handleError(_0x2bb398,null));};exports[_0x9483('0x45')]=function(_0xaaa333,_0x28aa9a,_0x510d7b){var _0x1fd35a={};var _0x50272e={};var _0x5161e8;var _0x220d48;return db[_0x9483('0x26')]['findOne']({'where':{'id':_0xaaa333[_0x9483('0x3e')]['id']}})[_0x9483('0x21')](handleEntityNotFound(_0x28aa9a,null))[_0x9483('0x21')](function(_0x1ec841){if(_0x1ec841){_0x5161e8=_0x1ec841;_0x50272e['model']=_[_0x9483('0x2c')](db['Dynamics365Field'][_0x9483('0x27')]);_0x50272e[_0x9483('0x2b')]=_[_0x9483('0x2c')](_0xaaa333['query']);_0x50272e[_0x9483('0x2d')]=_[_0x9483('0x2e')](_0x50272e['model'],_0x50272e[_0x9483('0x2b')]);_0x1fd35a[_0x9483('0x2f')]=_[_0x9483('0x2e')](_0x50272e['model'],qs[_0x9483('0x30')](_0xaaa333[_0x9483('0x2b')]['fields']));_0x1fd35a[_0x9483('0x2f')]=_0x1fd35a[_0x9483('0x2f')][_0x9483('0x31')]?_0x1fd35a['attributes']:_0x50272e[_0x9483('0x2a')];_0x1fd35a[_0x9483('0x46')]=qs[_0x9483('0x34')](_0xaaa333[_0x9483('0x2b')]['sort']);_0x1fd35a[_0x9483('0x35')]=qs['filters'](_['pick'](_0xaaa333[_0x9483('0x2b')],_0x50272e[_0x9483('0x2d')]));if(_0xaaa333[_0x9483('0x2b')]['filter']){_0x1fd35a[_0x9483('0x35')]=_[_0x9483('0x38')](_0x1fd35a['where'],{'$or':_[_0x9483('0x25')](_0x1fd35a[_0x9483('0x2f')],function(_0x19ca44){var _0x51ed2a={};_0x51ed2a[_0x19ca44]={'$like':'%'+_0xaaa333[_0x9483('0x2b')][_0x9483('0x37')]+'%'};return _0x51ed2a;})});}_0x1fd35a=_[_0x9483('0x38')]({},_0x1fd35a,_0xaaa333[_0x9483('0x3a')]);return _0x5161e8['getFields'](_0x1fd35a);}})[_0x9483('0x21')](function(_0x19a14a){if(_0x19a14a){_0x220d48=_0x19a14a['length'];if(!_0xaaa333['query'][_0x9483('0x32')]('nolimit')){_0x1fd35a[_0x9483('0x1a')]=qs[_0x9483('0x1a')](_0xaaa333[_0x9483('0x2b')][_0x9483('0x1a')]);_0x1fd35a[_0x9483('0x1c')]=qs['offset'](_0xaaa333[_0x9483('0x2b')]['offset']);}return _0x5161e8[_0x9483('0x45')](_0x1fd35a);}})['then'](function(_0x301bbd){if(_0x301bbd){return _0x301bbd?{'count':_0x220d48,'rows':_0x301bbd}:null;}})[_0x9483('0x21')](respondWithResult(_0x28aa9a,null))['catch'](handleError(_0x28aa9a,null));};exports[_0x9483('0x47')]=function(_0x4b5545,_0x194fcf,_0x256d1a){var _0x52cb80={};var _0x5c195d={};var _0x2242d0;var _0x4c799c;return db[_0x9483('0x26')][_0x9483('0x48')]({'where':{'id':_0x4b5545['params']['id']}})[_0x9483('0x21')](handleEntityNotFound(_0x194fcf,null))['then'](function(_0x478371){if(_0x478371){_0x2242d0=_0x478371;_0x5c195d[_0x9483('0x2a')]=_[_0x9483('0x2c')](db[_0x9483('0x49')][_0x9483('0x27')]);_0x5c195d[_0x9483('0x2b')]=_[_0x9483('0x2c')](_0x4b5545['query']);_0x5c195d[_0x9483('0x2d')]=_['intersection'](_0x5c195d[_0x9483('0x2a')],_0x5c195d['query']);_0x52cb80[_0x9483('0x2f')]=_[_0x9483('0x2e')](_0x5c195d['model'],qs['fields'](_0x4b5545['query']['fields']));_0x52cb80[_0x9483('0x2f')]=_0x52cb80[_0x9483('0x2f')][_0x9483('0x31')]?_0x52cb80[_0x9483('0x2f')]:_0x5c195d[_0x9483('0x2a')];_0x52cb80[_0x9483('0x46')]=qs[_0x9483('0x34')](_0x4b5545[_0x9483('0x2b')][_0x9483('0x34')]);_0x52cb80[_0x9483('0x35')]=qs[_0x9483('0x2d')](_[_0x9483('0x36')](_0x4b5545[_0x9483('0x2b')],_0x5c195d[_0x9483('0x2d')]));if(_0x4b5545[_0x9483('0x2b')]['filter']){_0x52cb80[_0x9483('0x35')]=_['merge'](_0x52cb80[_0x9483('0x35')],{'$or':_[_0x9483('0x25')](_0x52cb80[_0x9483('0x2f')],function(_0x192885){var _0x3a0175={};_0x3a0175[_0x192885]={'$like':'%'+_0x4b5545[_0x9483('0x2b')]['filter']+'%'};return _0x3a0175;})});}_0x52cb80=_['merge']({},_0x52cb80,_0x4b5545[_0x9483('0x3a')]);return _0x2242d0[_0x9483('0x47')](_0x52cb80);}})[_0x9483('0x21')](function(_0x1e361e){if(_0x1e361e){_0x4c799c=_0x1e361e[_0x9483('0x31')];if(!_0x4b5545[_0x9483('0x2b')][_0x9483('0x32')]('nolimit')){_0x52cb80[_0x9483('0x1a')]=qs[_0x9483('0x1a')](_0x4b5545[_0x9483('0x2b')][_0x9483('0x1a')]);_0x52cb80['offset']=qs['offset'](_0x4b5545[_0x9483('0x2b')]['offset']);}return _0x2242d0['getSubjects'](_0x52cb80);}})['then'](function(_0x2840d2){if(_0x2840d2){return _0x2840d2?{'count':_0x4c799c,'rows':_0x2840d2}:null;}})[_0x9483('0x21')](respondWithResult(_0x194fcf,null))[_0x9483('0x41')](handleError(_0x194fcf,null));};exports[_0x9483('0x4a')]=function(_0x49e364,_0x346983,_0x55ff51){var _0x24f64b={};var _0x398baf={};var _0x51eb48;var _0x5aa44f;return db[_0x9483('0x26')][_0x9483('0x48')]({'where':{'id':_0x49e364[_0x9483('0x3e')]['id']}})['then'](handleEntityNotFound(_0x346983,null))[_0x9483('0x21')](function(_0x207b16){if(_0x207b16){_0x51eb48=_0x207b16;_0x398baf[_0x9483('0x2a')]=_[_0x9483('0x2c')](db[_0x9483('0x49')][_0x9483('0x27')]);_0x398baf['query']=_['keys'](_0x49e364[_0x9483('0x2b')]);_0x398baf[_0x9483('0x2d')]=_[_0x9483('0x2e')](_0x398baf[_0x9483('0x2a')],_0x398baf[_0x9483('0x2b')]);_0x24f64b['attributes']=_['intersection'](_0x398baf[_0x9483('0x2a')],qs['fields'](_0x49e364[_0x9483('0x2b')][_0x9483('0x30')]));_0x24f64b[_0x9483('0x2f')]=_0x24f64b[_0x9483('0x2f')][_0x9483('0x31')]?_0x24f64b[_0x9483('0x2f')]:_0x398baf[_0x9483('0x2a')];_0x24f64b[_0x9483('0x46')]=qs[_0x9483('0x34')](_0x49e364['query'][_0x9483('0x34')]);_0x24f64b[_0x9483('0x35')]=qs[_0x9483('0x2d')](_['pick'](_0x49e364['query'],_0x398baf[_0x9483('0x2d')]));if(_0x49e364['query'][_0x9483('0x37')]){_0x24f64b[_0x9483('0x35')]=_[_0x9483('0x38')](_0x24f64b['where'],{'$or':_[_0x9483('0x25')](_0x24f64b[_0x9483('0x2f')],function(_0x11f702){var _0x10f91b={};_0x10f91b[_0x11f702]={'$like':'%'+_0x49e364[_0x9483('0x2b')][_0x9483('0x37')]+'%'};return _0x10f91b;})});}_0x24f64b=_[_0x9483('0x38')]({},_0x24f64b,_0x49e364[_0x9483('0x3a')]);return _0x51eb48[_0x9483('0x4a')](_0x24f64b);}})[_0x9483('0x21')](function(_0x4f0d26){if(_0x4f0d26){_0x5aa44f=_0x4f0d26['length'];if(!_0x49e364['query'][_0x9483('0x32')](_0x9483('0x33'))){_0x24f64b[_0x9483('0x1a')]=qs[_0x9483('0x1a')](_0x49e364[_0x9483('0x2b')][_0x9483('0x1a')]);_0x24f64b[_0x9483('0x1c')]=qs[_0x9483('0x1c')](_0x49e364[_0x9483('0x2b')][_0x9483('0x1c')]);}return _0x51eb48[_0x9483('0x4a')](_0x24f64b);}})[_0x9483('0x21')](function(_0x3c6286){if(_0x3c6286){return _0x3c6286?{'count':_0x5aa44f,'rows':_0x3c6286}:null;}})[_0x9483('0x21')](respondWithResult(_0x346983,null))[_0x9483('0x41')](handleError(_0x346983,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 55a78d2..02a89de 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(_0x41ecab,_0x4f4f9e){var _0x3df461=function(_0x48a69a){while(--_0x48a69a){_0x41ecab['push'](_0x41ecab['shift']());}};_0x3df461(++_0x4f4f9e);}(_0xaa88,0x137));var _0x8aa8=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0xaa88[_0x9b2bb0];return _0x2cdb3b;};'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 _0x9c44=['request-promise','path','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','../../config/logger','api','moment','bluebird'];(function(_0x40b68d,_0x3de8c3){var _0x1edd81=function(_0x308c79){while(--_0x308c79){_0x40b68d['push'](_0x40b68d['shift']());}};_0x1edd81(++_0x3de8c3);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'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 37f496b..5b51066 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 _0x9325=['stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0x9325,0x13b));var _0x5932=function(_0x4c05b4,_0x18273a){_0x4c05b4=_0x4c05b4-0x0;var _0x1d4fdf=_0x9325[_0x4c05b4];return _0x1d4fdf;};'use strict';var _=require(_0x5932('0x0'));var util=require(_0x5932('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5932('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5932('0x3'))['db'];var utils=require(_0x5932('0x4'));var logger=require(_0x5932('0x5'))(_0x5932('0x6'));var config=require(_0x5932('0x7'));var jayson=require(_0x5932('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1bbbfc,_0x1d97ea,_0x1bdca4){return new BPromise(function(_0x4295bf,_0x27dffa){return client[_0x5932('0x9')](_0x1bbbfc,_0x1bdca4)[_0x5932('0xa')](function(_0x56376d){logger[_0x5932('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1d97ea,_0x5932('0xc'));logger[_0x5932('0xd')](_0x5932('0xe'),_0x1d97ea,_0x5932('0xc'),JSON[_0x5932('0xf')](_0x56376d));if(_0x56376d[_0x5932('0x10')]){if(_0x56376d[_0x5932('0x10')][_0x5932('0x11')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1d97ea,_0x56376d[_0x5932('0x10')][_0x5932('0x12')]);return _0x27dffa(_0x56376d[_0x5932('0x10')][_0x5932('0x12')]);}logger[_0x5932('0x10')](_0x5932('0x13'),_0x1d97ea,_0x56376d[_0x5932('0x10')][_0x5932('0x12')]);return _0x4295bf(_0x56376d[_0x5932('0x10')][_0x5932('0x12')]);}else{logger[_0x5932('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1d97ea,_0x5932('0xc'));_0x4295bf(_0x56376d[_0x5932('0x14')][_0x5932('0x12')]);}})[_0x5932('0x15')](function(_0x1c69f5){logger[_0x5932('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1d97ea,_0x1c69f5);_0x27dffa(_0x1c69f5);});});} \ No newline at end of file +var _0x99fd=['rpc','http','request','then','debug','request\x20sent','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3be39b,_0x5cc1c){var _0x303fe5=function(_0x1479d8){while(--_0x1479d8){_0x3be39b['push'](_0x3be39b['shift']());}};_0x303fe5(++_0x5cc1c);}(_0x99fd,0x71));var _0xd99f=function(_0x216ed2,_0x1dd827){_0x216ed2=_0x216ed2-0x0;var _0x50daa3=_0x99fd[_0x216ed2];return _0x50daa3;};'use strict';var _=require(_0xd99f('0x0'));var util=require(_0xd99f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd99f('0x2'));var fs=require('fs');var Redis=require(_0xd99f('0x3'));var db=require(_0xd99f('0x4'))['db'];var utils=require(_0xd99f('0x5'));var logger=require(_0xd99f('0x6'))(_0xd99f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd99f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ce67e,_0x3d41d6,_0x2b7f42){return new BPromise(function(_0x398bcb,_0x2d56b1){return client[_0xd99f('0x9')](_0x3ce67e,_0x2b7f42)[_0xd99f('0xa')](function(_0xef6225){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x3d41d6,'request\x20sent');logger[_0xd99f('0xb')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3d41d6,_0xd99f('0xc'),JSON['stringify'](_0xef6225));if(_0xef6225[_0xd99f('0xd')]){if(_0xef6225[_0xd99f('0xd')][_0xd99f('0xe')]===0x1f4){logger[_0xd99f('0xd')](_0xd99f('0xf'),_0x3d41d6,_0xef6225['error']['message']);return _0x2d56b1(_0xef6225['error'][_0xd99f('0x10')]);}logger[_0xd99f('0xd')](_0xd99f('0xf'),_0x3d41d6,_0xef6225['error'][_0xd99f('0x10')]);return _0x398bcb(_0xef6225['error'][_0xd99f('0x10')]);}else{logger[_0xd99f('0x11')](_0xd99f('0xf'),_0x3d41d6,_0xd99f('0xc'));_0x398bcb(_0xef6225[_0xd99f('0x12')][_0xd99f('0x10')]);}})[_0xd99f('0x13')](function(_0x459917){logger[_0xd99f('0xd')](_0xd99f('0xf'),_0x3d41d6,_0x459917);_0x2d56b1(_0x459917);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 78513a3..509187f 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 _0x0dd1=['../../config/environment','./intDynamics365Field.controller','isAuthenticated','get','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x11f75c,_0x2a4588){var _0x8f4a95=function(_0xe13eec){while(--_0xe13eec){_0x11f75c['push'](_0x11f75c['shift']());}};_0x8f4a95(++_0x2a4588);}(_0x0dd1,0x186));var _0x10dd=function(_0x58f370,_0x2036cf){_0x58f370=_0x58f370-0x0;var _0x47ac1b=_0x0dd1[_0x58f370];return _0x47ac1b;};'use strict';var multer=require(_0x10dd('0x0'));var util=require(_0x10dd('0x1'));var path=require(_0x10dd('0x2'));var timeout=require(_0x10dd('0x3'));var express=require('express');var router=express[_0x10dd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x10dd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x10dd('0x6'));var controller=require(_0x10dd('0x7'));router['get']('/',auth[_0x10dd('0x8')](),controller['index']);router[_0x10dd('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x10dd('0xa')]);router[_0x10dd('0xb')]('/',auth[_0x10dd('0x8')](),controller[_0x10dd('0xc')]);router[_0x10dd('0xd')](_0x10dd('0xe'),auth[_0x10dd('0x8')](),controller['update']);router[_0x10dd('0xf')](_0x10dd('0xe'),auth[_0x10dd('0x8')](),controller[_0x10dd('0x10')]);module[_0x10dd('0x11')]=router; \ No newline at end of file +var _0x915c=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x11df89,_0x405f89){var _0x5f35ac=function(_0x87c181){while(--_0x87c181){_0x11df89['push'](_0x11df89['shift']());}};_0x5f35ac(++_0x405f89);}(_0x915c,0xfc));var _0xc915=function(_0x54dbb8,_0x445a8f){_0x54dbb8=_0x54dbb8-0x0;var _0x21d58c=_0x915c[_0x54dbb8];return _0x21d58c;};'use strict';var multer=require(_0xc915('0x0'));var util=require(_0xc915('0x1'));var path=require(_0xc915('0x2'));var timeout=require(_0xc915('0x3'));var express=require(_0xc915('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc915('0x5'));var config=require(_0xc915('0x6'));var controller=require('./intDynamics365Field.controller');router[_0xc915('0x7')]('/',auth[_0xc915('0x8')](),controller[_0xc915('0x9')]);router['get'](_0xc915('0xa'),auth[_0xc915('0x8')](),controller[_0xc915('0xb')]);router[_0xc915('0xc')]('/',auth[_0xc915('0x8')](),controller[_0xc915('0xd')]);router[_0xc915('0xe')](_0xc915('0xa'),auth[_0xc915('0x8')](),controller[_0xc915('0xf')]);router[_0xc915('0x10')](_0xc915('0xa'),auth[_0xc915('0x8')](),controller[_0xc915('0x11')]);module[_0xc915('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 050dd3a..ea63bff 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 _0xe966=['picklist','STRING','variable','BOOLEAN','exports','ENUM','string','customVariable','keyValue'];(function(_0x3231e8,_0x41df58){var _0x13a897=function(_0x5c01b5){while(--_0x5c01b5){_0x3231e8['push'](_0x3231e8['shift']());}};_0x13a897(++_0x41df58);}(_0xe966,0x175));var _0x6e96=function(_0x315350,_0x339cbc){_0x315350=_0x315350-0x0;var _0x3b46f6=_0xe966[_0x315350];return _0x3b46f6;};'use strict';var Sequelize=require('sequelize');module[_0x6e96('0x0')]={'type':{'type':Sequelize[_0x6e96('0x1')](_0x6e96('0x2'),'variable',_0x6e96('0x3'),_0x6e96('0x4'),_0x6e96('0x5')),'defaultValue':_0x6e96('0x2')},'content':{'type':Sequelize[_0x6e96('0x6')]},'key':{'type':Sequelize[_0x6e96('0x6')]},'keyType':{'type':Sequelize[_0x6e96('0x1')](_0x6e96('0x2'),_0x6e96('0x7'),_0x6e96('0x3'))},'keyContent':{'type':Sequelize[_0x6e96('0x6')]},'idField':{'type':Sequelize[_0x6e96('0x6')]},'nameField':{'type':Sequelize[_0x6e96('0x6')]},'customField':{'type':Sequelize[_0x6e96('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6e96('0x6')]}}; \ No newline at end of file +var _0xd545=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN'];(function(_0x183627,_0x59862f){var _0xadd630=function(_0x5bec34){while(--_0x5bec34){_0x183627['push'](_0x183627['shift']());}};_0xadd630(++_0x59862f);}(_0xd545,0x157));var _0x5d54=function(_0x3bed9a,_0x1ad776){_0x3bed9a=_0x3bed9a-0x0;var _0xdc3a5a=_0xd545[_0x3bed9a];return _0xdc3a5a;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x5d54('0x0')](_0x5d54('0x1'),'variable',_0x5d54('0x2'),_0x5d54('0x3'),'picklist'),'defaultValue':_0x5d54('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5d54('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x5d54('0x1'),_0x5d54('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0x5d54('0x4')]},'idField':{'type':Sequelize[_0x5d54('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5d54('0x6')],'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 08e2a84..036508f 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 _0xf3bd=['params','fields','find','create','body','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/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','end','stack','name','send','index','map','Dynamics365Field','fieldName','key','query','keys','filters','intersection','model','attributes','length','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show'];(function(_0x849f88,_0x558328){var _0x4862b8=function(_0x484af5){while(--_0x484af5){_0x849f88['push'](_0x849f88['shift']());}};_0x4862b8(++_0x558328);}(_0xf3bd,0x9b));var _0xdf3b=function(_0x2e658a,_0x571fc9){_0x2e658a=_0x2e658a-0x0;var _0x227d70=_0xf3bd[_0x2e658a];return _0x227d70;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdf3b('0x0'));var jsonpatch=require(_0xdf3b('0x1'));var rp=require(_0xdf3b('0x2'));var moment=require(_0xdf3b('0x3'));var BPromise=require(_0xdf3b('0x4'));var Mustache=require(_0xdf3b('0x5'));var util=require(_0xdf3b('0x6'));var path=require(_0xdf3b('0x7'));var sox=require(_0xdf3b('0x8'));var csv=require(_0xdf3b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf3b('0xa'));var _=require(_0xdf3b('0xb'));var squel=require(_0xdf3b('0xc'));var crypto=require(_0xdf3b('0xd'));var jsforce=require(_0xdf3b('0xe'));var deskjs=require(_0xdf3b('0xf'));var toCsv=require(_0xdf3b('0x9'));var querystring=require(_0xdf3b('0x10'));var Papa=require(_0xdf3b('0x11'));var Redis=require(_0xdf3b('0x12'));var authService=require(_0xdf3b('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf3b('0x14'));var logger=require('../../config/logger')(_0xdf3b('0x15'));var utils=require(_0xdf3b('0x16'));var config=require(_0xdf3b('0x17'));var licenseUtil=require(_0xdf3b('0x18'));var db=require(_0xdf3b('0x19'))['db'];function respondWithStatusCode(_0x2d4a7f,_0xf61e4){_0xf61e4=_0xf61e4||0xcc;return function(_0x2117d8){if(_0x2117d8){return _0x2d4a7f[_0xdf3b('0x1a')](_0xf61e4);}return _0x2d4a7f['status'](_0xf61e4)['end']();};}function respondWithResult(_0x103a6d,_0x1f3024){_0x1f3024=_0x1f3024||0xc8;return function(_0x211cd5){if(_0x211cd5){return _0x103a6d[_0xdf3b('0x1b')](_0x1f3024)[_0xdf3b('0x1c')](_0x211cd5);}};}function respondWithFilteredResult(_0x19c10e,_0x23b88a){return function(_0x487cba){if(_0x487cba){var _0xd11fa5=typeof _0x23b88a['offset']===_0xdf3b('0x1d')&&typeof _0x23b88a[_0xdf3b('0x1e')]==='undefined';var _0x3be213=_0x487cba[_0xdf3b('0x1f')];var _0x459924=_0xd11fa5?0x0:_0x23b88a['offset'];var _0x22ae97=_0xd11fa5?_0x487cba['count']:_0x23b88a[_0xdf3b('0x20')]+_0x23b88a['limit'];var _0x364f5d;if(_0x22ae97>=_0x3be213){_0x22ae97=_0x3be213;_0x364f5d=0xc8;}else{_0x364f5d=0xce;}_0x19c10e[_0xdf3b('0x1b')](_0x364f5d);return _0x19c10e[_0xdf3b('0x21')](_0xdf3b('0x22'),_0x459924+'-'+_0x22ae97+'/'+_0x3be213)['json'](_0x487cba);}return null;};}function patchUpdates(_0x207688){return function(_0x3385d5){try{jsonpatch['apply'](_0x3385d5,_0x207688,!![]);}catch(_0x30133a){return BPromise[_0xdf3b('0x23')](_0x30133a);}return _0x3385d5['save']();};}function saveUpdates(_0x484542,_0x2328e2){return function(_0x4af998){if(_0x4af998){return _0x4af998[_0xdf3b('0x24')](_0x484542)[_0xdf3b('0x25')](function(_0x20a0fe){return _0x20a0fe;});}return null;};}function removeEntity(_0x169983,_0x540859){return function(_0x5483ef){if(_0x5483ef){return _0x5483ef[_0xdf3b('0x26')]()['then'](function(){_0x169983[_0xdf3b('0x1b')](0xcc)[_0xdf3b('0x27')]();});}};}function handleEntityNotFound(_0x1e671c,_0x3d6063){return function(_0x245b48){if(!_0x245b48){_0x1e671c['sendStatus'](0x194);}return _0x245b48;};}function handleError(_0x47eccc,_0x17d0e4){_0x17d0e4=_0x17d0e4||0x1f4;return function(_0x240844){logger['error'](_0x240844[_0xdf3b('0x28')]);if(_0x240844[_0xdf3b('0x29')]){delete _0x240844[_0xdf3b('0x29')];}_0x47eccc[_0xdf3b('0x1b')](_0x17d0e4)[_0xdf3b('0x2a')](_0x240844);};}exports[_0xdf3b('0x2b')]=function(_0x44e5b8,_0x46efbc){var _0x44b932={},_0x216021={},_0x72802={'count':0x0,'rows':[]};var _0x31df30=_[_0xdf3b('0x2c')](db[_0xdf3b('0x2d')]['rawAttributes'],function(_0xb9bc71){return{'name':_0xb9bc71[_0xdf3b('0x2e')],'type':_0xb9bc71['type'][_0xdf3b('0x2f')]};});_0x216021['model']=_['map'](_0x31df30,_0xdf3b('0x29'));_0x216021[_0xdf3b('0x30')]=_[_0xdf3b('0x31')](_0x44e5b8[_0xdf3b('0x30')]);_0x216021[_0xdf3b('0x32')]=_[_0xdf3b('0x33')](_0x216021[_0xdf3b('0x34')],_0x216021[_0xdf3b('0x30')]);_0x44b932[_0xdf3b('0x35')]=_[_0xdf3b('0x33')](_0x216021['model'],qs['fields'](_0x44e5b8[_0xdf3b('0x30')]['fields']));_0x44b932[_0xdf3b('0x35')]=_0x44b932[_0xdf3b('0x35')][_0xdf3b('0x36')]?_0x44b932[_0xdf3b('0x35')]:_0x216021[_0xdf3b('0x34')];if(!_0x44e5b8['query']['hasOwnProperty'](_0xdf3b('0x37'))){_0x44b932[_0xdf3b('0x1e')]=qs[_0xdf3b('0x1e')](_0x44e5b8[_0xdf3b('0x30')][_0xdf3b('0x1e')]);_0x44b932['offset']=qs[_0xdf3b('0x20')](_0x44e5b8['query']['offset']);}_0x44b932['order']=qs[_0xdf3b('0x38')](_0x44e5b8['query'][_0xdf3b('0x38')]);_0x44b932[_0xdf3b('0x39')]=qs[_0xdf3b('0x32')](_[_0xdf3b('0x3a')](_0x44e5b8[_0xdf3b('0x30')],_0x216021[_0xdf3b('0x32')]),_0x31df30);if(_0x44e5b8['query']['filter']){_0x44b932[_0xdf3b('0x39')]=_[_0xdf3b('0x3b')](_0x44b932[_0xdf3b('0x39')],{'$or':_[_0xdf3b('0x2c')](_0x31df30,function(_0x3b5fa9){if(_0x3b5fa9[_0xdf3b('0x3c')]!==_0xdf3b('0x3d')){var _0x381bb1={};_0x381bb1[_0x3b5fa9['name']]={'$like':'%'+_0x44e5b8[_0xdf3b('0x30')][_0xdf3b('0x3e')]+'%'};return _0x381bb1;}})});}_0x44b932=_['merge']({},_0x44b932,_0x44e5b8[_0xdf3b('0x3f')]);var _0x207bd1={'where':_0x44b932[_0xdf3b('0x39')]};return db[_0xdf3b('0x2d')][_0xdf3b('0x1f')](_0x207bd1)['then'](function(_0x16504b){_0x72802['count']=_0x16504b;if(_0x44e5b8['query'][_0xdf3b('0x40')]){_0x44b932[_0xdf3b('0x41')]=[{'all':!![]}];}return db[_0xdf3b('0x2d')][_0xdf3b('0x42')](_0x44b932);})['then'](function(_0x4a3b78){_0x72802[_0xdf3b('0x43')]=_0x4a3b78;return _0x72802;})['then'](respondWithFilteredResult(_0x46efbc,_0x44b932))[_0xdf3b('0x44')](handleError(_0x46efbc,null));};exports[_0xdf3b('0x45')]=function(_0x1468da,_0x2e9921){var _0x1e3802={'raw':!![],'where':{'id':_0x1468da[_0xdf3b('0x46')]['id']}},_0x130fbf={};_0x130fbf[_0xdf3b('0x34')]=_['keys'](db[_0xdf3b('0x2d')]['rawAttributes']);_0x130fbf[_0xdf3b('0x30')]=_['keys'](_0x1468da[_0xdf3b('0x30')]);_0x130fbf[_0xdf3b('0x32')]=_[_0xdf3b('0x33')](_0x130fbf[_0xdf3b('0x34')],_0x130fbf['query']);_0x1e3802['attributes']=_[_0xdf3b('0x33')](_0x130fbf[_0xdf3b('0x34')],qs[_0xdf3b('0x47')](_0x1468da[_0xdf3b('0x30')]['fields']));_0x1e3802['attributes']=_0x1e3802['attributes']['length']?_0x1e3802[_0xdf3b('0x35')]:_0x130fbf[_0xdf3b('0x34')];if(_0x1468da[_0xdf3b('0x30')]['includeAll']){_0x1e3802[_0xdf3b('0x41')]=[{'all':!![]}];}_0x1e3802=_[_0xdf3b('0x3b')]({},_0x1e3802,_0x1468da[_0xdf3b('0x3f')]);return db[_0xdf3b('0x2d')][_0xdf3b('0x48')](_0x1e3802)[_0xdf3b('0x25')](handleEntityNotFound(_0x2e9921,null))[_0xdf3b('0x25')](respondWithResult(_0x2e9921,null))['catch'](handleError(_0x2e9921,null));};exports[_0xdf3b('0x49')]=function(_0x38f8d0,_0x3e5da3){return db[_0xdf3b('0x2d')][_0xdf3b('0x49')](_0x38f8d0[_0xdf3b('0x4a')],{})[_0xdf3b('0x25')](respondWithResult(_0x3e5da3,0xc9))[_0xdf3b('0x44')](handleError(_0x3e5da3,null));};exports['update']=function(_0x263eaa,_0x4b7f57){if(_0x263eaa[_0xdf3b('0x4a')]['id']){delete _0x263eaa[_0xdf3b('0x4a')]['id'];}return db[_0xdf3b('0x2d')][_0xdf3b('0x48')]({'where':{'id':_0x263eaa['params']['id']}})[_0xdf3b('0x25')](handleEntityNotFound(_0x4b7f57,null))['then'](saveUpdates(_0x263eaa[_0xdf3b('0x4a')],null))[_0xdf3b('0x25')](respondWithResult(_0x4b7f57,null))['catch'](handleError(_0x4b7f57,null));};exports[_0xdf3b('0x26')]=function(_0x2d221b,_0x5c0223){return db[_0xdf3b('0x2d')][_0xdf3b('0x48')]({'where':{'id':_0x2d221b['params']['id']}})[_0xdf3b('0x25')](handleEntityNotFound(_0x5c0223,null))[_0xdf3b('0x25')](removeEntity(_0x5c0223,null))[_0xdf3b('0x44')](handleError(_0x5c0223,null));}; \ No newline at end of file +var _0xa7ba=['offset','limit','count','set','Content-Range','apply','save','update','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','Dynamics365Field','then','includeAll','findAll','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x350078,_0x2e5ba5){var _0x56f53f=function(_0x29d7d3){while(--_0x29d7d3){_0x350078['push'](_0x350078['shift']());}};_0x56f53f(++_0x2e5ba5);}(_0xa7ba,0x1ca));var _0xaa7b=function(_0x2f0553,_0x74517c){_0x2f0553=_0x2f0553-0x0;var _0x34c4a1=_0xa7ba[_0x2f0553];return _0x34c4a1;};'use strict';var emlformat=require(_0xaa7b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaa7b('0x1'));var jsonpatch=require(_0xaa7b('0x2'));var rp=require(_0xaa7b('0x3'));var moment=require(_0xaa7b('0x4'));var BPromise=require(_0xaa7b('0x5'));var Mustache=require(_0xaa7b('0x6'));var util=require(_0xaa7b('0x7'));var path=require(_0xaa7b('0x8'));var sox=require('sox');var csv=require(_0xaa7b('0x9'));var ejs=require(_0xaa7b('0xa'));var fs=require('fs');var fs_extra=require(_0xaa7b('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa7b('0xc'));var jsforce=require(_0xaa7b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa7b('0x9'));var querystring=require(_0xaa7b('0xe'));var Papa=require(_0xaa7b('0xf'));var Redis=require(_0xaa7b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa7b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa7b('0x12'))(_0xaa7b('0x13'));var utils=require('../../config/utils');var config=require(_0xaa7b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa7b('0x15'))['db'];function respondWithStatusCode(_0x44524c,_0x3e1f45){_0x3e1f45=_0x3e1f45||0xcc;return function(_0x5438bc){if(_0x5438bc){return _0x44524c[_0xaa7b('0x16')](_0x3e1f45);}return _0x44524c[_0xaa7b('0x17')](_0x3e1f45)[_0xaa7b('0x18')]();};}function respondWithResult(_0x7473ce,_0x581480){_0x581480=_0x581480||0xc8;return function(_0x51b5f8){if(_0x51b5f8){return _0x7473ce['status'](_0x581480)['json'](_0x51b5f8);}};}function respondWithFilteredResult(_0x385631,_0x2be52e){return function(_0x3eb64e){if(_0x3eb64e){var _0x5eb27a=typeof _0x2be52e[_0xaa7b('0x19')]==='undefined'&&typeof _0x2be52e[_0xaa7b('0x1a')]==='undefined';var _0xbd67f5=_0x3eb64e[_0xaa7b('0x1b')];var _0x20a91b=_0x5eb27a?0x0:_0x2be52e[_0xaa7b('0x19')];var _0x28472b=_0x5eb27a?_0x3eb64e[_0xaa7b('0x1b')]:_0x2be52e[_0xaa7b('0x19')]+_0x2be52e[_0xaa7b('0x1a')];var _0x497aad;if(_0x28472b>=_0xbd67f5){_0x28472b=_0xbd67f5;_0x497aad=0xc8;}else{_0x497aad=0xce;}_0x385631['status'](_0x497aad);return _0x385631[_0xaa7b('0x1c')](_0xaa7b('0x1d'),_0x20a91b+'-'+_0x28472b+'/'+_0xbd67f5)['json'](_0x3eb64e);}return null;};}function patchUpdates(_0x3532a1){return function(_0x200240){try{jsonpatch[_0xaa7b('0x1e')](_0x200240,_0x3532a1,!![]);}catch(_0x4c41b5){return BPromise['reject'](_0x4c41b5);}return _0x200240[_0xaa7b('0x1f')]();};}function saveUpdates(_0x4295dc,_0x5a5c15){return function(_0x41b21a){if(_0x41b21a){return _0x41b21a[_0xaa7b('0x20')](_0x4295dc)['then'](function(_0x5c443c){return _0x5c443c;});}return null;};}function removeEntity(_0x4cd8e3,_0x2525b9){return function(_0x53a152){if(_0x53a152){return _0x53a152[_0xaa7b('0x21')]()['then'](function(){_0x4cd8e3[_0xaa7b('0x17')](0xcc)[_0xaa7b('0x18')]();});}};}function handleEntityNotFound(_0x3270f5,_0x52f22d){return function(_0xce50ed){if(!_0xce50ed){_0x3270f5[_0xaa7b('0x16')](0x194);}return _0xce50ed;};}function handleError(_0x443fcc,_0x30d49e){_0x30d49e=_0x30d49e||0x1f4;return function(_0x1dde26){logger[_0xaa7b('0x22')](_0x1dde26[_0xaa7b('0x23')]);if(_0x1dde26['name']){delete _0x1dde26[_0xaa7b('0x24')];}_0x443fcc['status'](_0x30d49e)['send'](_0x1dde26);};}exports[_0xaa7b('0x25')]=function(_0x189c95,_0x1040d6){var _0x21eef1={},_0x27220c={},_0x55d9c6={'count':0x0,'rows':[]};var _0x23b01a=_[_0xaa7b('0x26')](db['Dynamics365Field'][_0xaa7b('0x27')],function(_0x2a01e3){return{'name':_0x2a01e3[_0xaa7b('0x28')],'type':_0x2a01e3[_0xaa7b('0x29')][_0xaa7b('0x2a')]};});_0x27220c['model']=_['map'](_0x23b01a,_0xaa7b('0x24'));_0x27220c['query']=_[_0xaa7b('0x2b')](_0x189c95[_0xaa7b('0x2c')]);_0x27220c[_0xaa7b('0x2d')]=_[_0xaa7b('0x2e')](_0x27220c[_0xaa7b('0x2f')],_0x27220c['query']);_0x21eef1[_0xaa7b('0x30')]=_[_0xaa7b('0x2e')](_0x27220c[_0xaa7b('0x2f')],qs['fields'](_0x189c95[_0xaa7b('0x2c')]['fields']));_0x21eef1[_0xaa7b('0x30')]=_0x21eef1[_0xaa7b('0x30')][_0xaa7b('0x31')]?_0x21eef1['attributes']:_0x27220c['model'];if(!_0x189c95[_0xaa7b('0x2c')][_0xaa7b('0x32')](_0xaa7b('0x33'))){_0x21eef1[_0xaa7b('0x1a')]=qs['limit'](_0x189c95[_0xaa7b('0x2c')][_0xaa7b('0x1a')]);_0x21eef1[_0xaa7b('0x19')]=qs[_0xaa7b('0x19')](_0x189c95[_0xaa7b('0x2c')][_0xaa7b('0x19')]);}_0x21eef1[_0xaa7b('0x34')]=qs['sort'](_0x189c95[_0xaa7b('0x2c')][_0xaa7b('0x35')]);_0x21eef1['where']=qs['filters'](_[_0xaa7b('0x36')](_0x189c95[_0xaa7b('0x2c')],_0x27220c[_0xaa7b('0x2d')]),_0x23b01a);if(_0x189c95['query'][_0xaa7b('0x37')]){_0x21eef1['where']=_[_0xaa7b('0x38')](_0x21eef1[_0xaa7b('0x39')],{'$or':_['map'](_0x23b01a,function(_0x43ff80){if(_0x43ff80['type']!==_0xaa7b('0x3a')){var _0x23bf68={};_0x23bf68[_0x43ff80[_0xaa7b('0x24')]]={'$like':'%'+_0x189c95['query'][_0xaa7b('0x37')]+'%'};return _0x23bf68;}})});}_0x21eef1=_[_0xaa7b('0x38')]({},_0x21eef1,_0x189c95[_0xaa7b('0x3b')]);var _0x1bab84={'where':_0x21eef1[_0xaa7b('0x39')]};return db[_0xaa7b('0x3c')][_0xaa7b('0x1b')](_0x1bab84)[_0xaa7b('0x3d')](function(_0x5c739b){_0x55d9c6['count']=_0x5c739b;if(_0x189c95[_0xaa7b('0x2c')][_0xaa7b('0x3e')]){_0x21eef1['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0xaa7b('0x3f')](_0x21eef1);})[_0xaa7b('0x3d')](function(_0x50f470){_0x55d9c6['rows']=_0x50f470;return _0x55d9c6;})[_0xaa7b('0x3d')](respondWithFilteredResult(_0x1040d6,_0x21eef1))[_0xaa7b('0x40')](handleError(_0x1040d6,null));};exports['show']=function(_0xcc2e4a,_0x33701b){var _0x3ac15c={'raw':!![],'where':{'id':_0xcc2e4a[_0xaa7b('0x41')]['id']}},_0x3e4e17={};_0x3e4e17[_0xaa7b('0x2f')]=_[_0xaa7b('0x2b')](db[_0xaa7b('0x3c')][_0xaa7b('0x27')]);_0x3e4e17['query']=_[_0xaa7b('0x2b')](_0xcc2e4a[_0xaa7b('0x2c')]);_0x3e4e17['filters']=_['intersection'](_0x3e4e17[_0xaa7b('0x2f')],_0x3e4e17[_0xaa7b('0x2c')]);_0x3ac15c[_0xaa7b('0x30')]=_[_0xaa7b('0x2e')](_0x3e4e17[_0xaa7b('0x2f')],qs['fields'](_0xcc2e4a[_0xaa7b('0x2c')]['fields']));_0x3ac15c[_0xaa7b('0x30')]=_0x3ac15c['attributes'][_0xaa7b('0x31')]?_0x3ac15c[_0xaa7b('0x30')]:_0x3e4e17[_0xaa7b('0x2f')];if(_0xcc2e4a['query']['includeAll']){_0x3ac15c['include']=[{'all':!![]}];}_0x3ac15c=_[_0xaa7b('0x38')]({},_0x3ac15c,_0xcc2e4a[_0xaa7b('0x3b')]);return db['Dynamics365Field'][_0xaa7b('0x42')](_0x3ac15c)[_0xaa7b('0x3d')](handleEntityNotFound(_0x33701b,null))[_0xaa7b('0x3d')](respondWithResult(_0x33701b,null))[_0xaa7b('0x40')](handleError(_0x33701b,null));};exports[_0xaa7b('0x43')]=function(_0x27e267,_0xd13396){return db[_0xaa7b('0x3c')][_0xaa7b('0x43')](_0x27e267[_0xaa7b('0x44')],{})[_0xaa7b('0x3d')](respondWithResult(_0xd13396,0xc9))[_0xaa7b('0x40')](handleError(_0xd13396,null));};exports[_0xaa7b('0x20')]=function(_0xf77225,_0x1dd3b3){if(_0xf77225[_0xaa7b('0x44')]['id']){delete _0xf77225[_0xaa7b('0x44')]['id'];}return db[_0xaa7b('0x3c')]['find']({'where':{'id':_0xf77225['params']['id']}})[_0xaa7b('0x3d')](handleEntityNotFound(_0x1dd3b3,null))[_0xaa7b('0x3d')](saveUpdates(_0xf77225[_0xaa7b('0x44')],null))['then'](respondWithResult(_0x1dd3b3,null))[_0xaa7b('0x40')](handleError(_0x1dd3b3,null));};exports[_0xaa7b('0x21')]=function(_0x186bba,_0x3cd779){return db['Dynamics365Field'][_0xaa7b('0x42')]({'where':{'id':_0x186bba[_0xaa7b('0x41')]['id']}})[_0xaa7b('0x3d')](handleEntityNotFound(_0x3cd779,null))[_0xaa7b('0x3d')](removeEntity(_0x3cd779,null))[_0xaa7b('0x40')](handleError(_0x3cd779,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 7186700..26518f3 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 _0xf688=['dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields'];(function(_0x1b833e,_0x2d356f){var _0x315218=function(_0x4c928a){while(--_0x4c928a){_0x1b833e['push'](_0x1b833e['shift']());}};_0x315218(++_0x2d356f);}(_0xf688,0x123));var _0x8f68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf688[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8f68('0x0'));var util=require(_0x8f68('0x1'));var logger=require(_0x8f68('0x2'))(_0x8f68('0x3'));var moment=require(_0x8f68('0x4'));var BPromise=require(_0x8f68('0x5'));var rp=require(_0x8f68('0x6'));var fs=require('fs');var path=require(_0x8f68('0x7'));var rimraf=require('rimraf');var config=require(_0x8f68('0x8'));var attributes=require(_0x8f68('0x9'));module[_0x8f68('0xa')]=function(_0x35f553,_0x53889f){return _0x35f553['define'](_0x8f68('0xb'),attributes,{'tableName':_0x8f68('0xc'),'paranoid':![],'indexes':[{'name':_0x8f68('0xd'),'fields':[_0x8f68('0xe'),_0x8f68('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d07=['../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x10f8a9,_0x30ec97){var _0x3c9f70=function(_0xe70109){while(--_0xe70109){_0x10f8a9['push'](_0x10f8a9['shift']());}};_0x3c9f70(++_0x30ec97);}(_0x5d07,0x98));var _0x75d0=function(_0x532678,_0xa0db60){_0x532678=_0x532678-0x0;var _0x4ed301=_0x5d07[_0x532678];return _0x4ed301;};'use strict';var _=require(_0x75d0('0x0'));var util=require('util');var logger=require(_0x75d0('0x1'))(_0x75d0('0x2'));var moment=require(_0x75d0('0x3'));var BPromise=require(_0x75d0('0x4'));var rp=require(_0x75d0('0x5'));var fs=require('fs');var path=require(_0x75d0('0x6'));var rimraf=require(_0x75d0('0x7'));var config=require(_0x75d0('0x8'));var attributes=require(_0x75d0('0x9'));module[_0x75d0('0xa')]=function(_0x2c145a,_0x5d9380){return _0x2c145a[_0x75d0('0xb')](_0x75d0('0xc'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x75d0('0xd'),'fields':[_0x75d0('0xe'),_0x75d0('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 05c7726..a42b5dc 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 _0x22df=['client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0x22df,0x13a));var _0xf22d=function(_0x333523,_0x4a5286){_0x333523=_0x333523-0x0;var _0x4cf904=_0x22df[_0x333523];return _0x4cf904;};'use strict';var _=require(_0xf22d('0x0'));var util=require(_0xf22d('0x1'));var moment=require(_0xf22d('0x2'));var BPromise=require(_0xf22d('0x3'));var rs=require(_0xf22d('0x4'));var fs=require('fs');var Redis=require(_0xf22d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf22d('0x6'));var logger=require(_0xf22d('0x7'))(_0xf22d('0x8'));var config=require(_0xf22d('0x9'));var jayson=require(_0xf22d('0xa'));var client=jayson[_0xf22d('0xb')][_0xf22d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25c98e,_0x4b07bd,_0x708e86){return new BPromise(function(_0x21cf92,_0x57cc93){return client[_0xf22d('0xd')](_0x25c98e,_0x708e86)[_0xf22d('0xe')](function(_0xf40704){logger[_0xf22d('0xf')](_0xf22d('0x10'),_0x4b07bd,'request\x20sent');logger[_0xf22d('0x11')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4b07bd,_0xf22d('0x12'),JSON[_0xf22d('0x13')](_0xf40704));if(_0xf40704[_0xf22d('0x14')]){if(_0xf40704[_0xf22d('0x14')][_0xf22d('0x15')]===0x1f4){logger[_0xf22d('0x14')](_0xf22d('0x10'),_0x4b07bd,_0xf40704[_0xf22d('0x14')][_0xf22d('0x16')]);return _0x57cc93(_0xf40704[_0xf22d('0x14')][_0xf22d('0x16')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x4b07bd,_0xf40704['error'][_0xf22d('0x16')]);return _0x21cf92(_0xf40704['error']['message']);}else{logger[_0xf22d('0xf')](_0xf22d('0x10'),_0x4b07bd,_0xf22d('0x12'));_0x21cf92(_0xf40704[_0xf22d('0x17')][_0xf22d('0x16')]);}})[_0xf22d('0x18')](function(_0x5db07f){logger[_0xf22d('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x4b07bd,_0x5db07f);_0x57cc93(_0x5db07f);});});} \ No newline at end of file +var _0xcccf=['code','message','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xcccf,0x121));var _0xfccc=function(_0x115e22,_0x314750){_0x115e22=_0x115e22-0x0;var _0x1ba9ef=_0xcccf[_0x115e22];return _0x1ba9ef;};'use strict';var _=require(_0xfccc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfccc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfccc('0x2'));var db=require(_0xfccc('0x3'))['db'];var utils=require(_0xfccc('0x4'));var logger=require(_0xfccc('0x5'))(_0xfccc('0x6'));var config=require(_0xfccc('0x7'));var jayson=require(_0xfccc('0x8'));var client=jayson[_0xfccc('0x9')][_0xfccc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x368d85,_0x22cb42,_0x2977dd){return new BPromise(function(_0x53ad01,_0x5d69d7){return client[_0xfccc('0xb')](_0x368d85,_0x2977dd)['then'](function(_0x6ed5ac){logger[_0xfccc('0xc')](_0xfccc('0xd'),_0x22cb42,_0xfccc('0xe'));logger[_0xfccc('0xf')](_0xfccc('0x10'),_0x22cb42,_0xfccc('0xe'),JSON[_0xfccc('0x11')](_0x6ed5ac));if(_0x6ed5ac[_0xfccc('0x12')]){if(_0x6ed5ac[_0xfccc('0x12')][_0xfccc('0x13')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x22cb42,_0x6ed5ac[_0xfccc('0x12')][_0xfccc('0x14')]);return _0x5d69d7(_0x6ed5ac[_0xfccc('0x12')]['message']);}logger[_0xfccc('0x12')](_0xfccc('0xd'),_0x22cb42,_0x6ed5ac[_0xfccc('0x12')]['message']);return _0x53ad01(_0x6ed5ac[_0xfccc('0x12')][_0xfccc('0x14')]);}else{logger[_0xfccc('0xc')](_0xfccc('0xd'),_0x22cb42,_0xfccc('0xe'));_0x53ad01(_0x6ed5ac[_0xfccc('0x15')][_0xfccc('0x14')]);}})['catch'](function(_0x3b9d66){logger[_0xfccc('0x12')](_0xfccc('0xd'),_0x22cb42,_0x3b9d66);_0x5d69d7(_0x3b9d66);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 788e29f..639d5da 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 _0x2366=['addConfiguration','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2366,0x11a));var _0x6236=function(_0x4969d0,_0x4a5788){_0x4969d0=_0x4969d0-0x0;var _0x754944=_0x2366[_0x4969d0];return _0x754944;};'use strict';var multer=require(_0x6236('0x0'));var util=require(_0x6236('0x1'));var path=require('path');var timeout=require(_0x6236('0x2'));var express=require(_0x6236('0x3'));var router=express['Router']();var fs_extra=require(_0x6236('0x4'));var auth=require(_0x6236('0x5'));var interaction=require(_0x6236('0x6'));var config=require(_0x6236('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0x6236('0x8')]('/',auth[_0x6236('0x9')](),controller[_0x6236('0xa')]);router[_0x6236('0x8')]('/:id',auth[_0x6236('0x9')](),controller[_0x6236('0xb')]);router[_0x6236('0x8')](_0x6236('0xc'),auth[_0x6236('0x9')](),controller[_0x6236('0xd')]);router[_0x6236('0x8')](_0x6236('0xe'),auth['isAuthenticated'](),controller[_0x6236('0xf')]);router[_0x6236('0x10')]('/',auth[_0x6236('0x9')](),controller['create']);router[_0x6236('0x10')](_0x6236('0xc'),auth[_0x6236('0x9')](),controller[_0x6236('0x11')]);router[_0x6236('0x12')](_0x6236('0x13'),auth[_0x6236('0x9')](),controller[_0x6236('0x14')]);router['delete'](_0x6236('0x13'),auth[_0x6236('0x9')](),controller[_0x6236('0x15')]);module[_0x6236('0x16')]=router; \ No newline at end of file +var _0x13f4=['create','addConfiguration','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x13f4,0x166));var _0x413f=function(_0x138836,_0x229129){_0x138836=_0x138836-0x0;var _0x322688=_0x13f4[_0x138836];return _0x322688;};'use strict';var multer=require(_0x413f('0x0'));var util=require('util');var path=require(_0x413f('0x1'));var timeout=require(_0x413f('0x2'));var express=require(_0x413f('0x3'));var router=express['Router']();var fs_extra=require(_0x413f('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x413f('0x5'));var controller=require(_0x413f('0x6'));router[_0x413f('0x7')]('/',auth[_0x413f('0x8')](),controller['index']);router['get'](_0x413f('0x9'),auth['isAuthenticated'](),controller[_0x413f('0xa')]);router[_0x413f('0x7')](_0x413f('0xb'),auth[_0x413f('0x8')](),controller[_0x413f('0xc')]);router[_0x413f('0x7')](_0x413f('0xd'),auth['isAuthenticated'](),controller[_0x413f('0xe')]);router[_0x413f('0xf')]('/',auth[_0x413f('0x8')](),controller[_0x413f('0x10')]);router[_0x413f('0xf')]('/:id/configurations',auth[_0x413f('0x8')](),controller[_0x413f('0x11')]);router['put'](_0x413f('0x9'),auth[_0x413f('0x8')](),controller[_0x413f('0x12')]);router[_0x413f('0x13')](_0x413f('0x9'),auth[_0x413f('0x8')](),controller[_0x413f('0x14')]);module[_0x413f('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index cfd91f5..491cc2e 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 _0x7880=['exports','STRING','username','remoteUri'];(function(_0x466613,_0x56a7e3){var _0x13a954=function(_0x36f270){while(--_0x36f270){_0x466613['push'](_0x466613['shift']());}};_0x13a954(++_0x56a7e3);}(_0x7880,0x1f4));var _0x0788=function(_0x21310f,_0x2b178d){_0x21310f=_0x21310f-0x0;var _0x5bb5a3=_0x7880[_0x21310f];return _0x5bb5a3;};'use strict';var Sequelize=require('sequelize');module[_0x0788('0x0')]={'name':{'type':Sequelize[_0x0788('0x1')]},'description':{'type':Sequelize[_0x0788('0x1')]},'username':{'type':Sequelize[_0x0788('0x1')],'unique':_0x0788('0x2')},'apiKey':{'type':Sequelize[_0x0788('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x0788('0x3')},'serverUrl':{'type':Sequelize[_0x0788('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb145=['STRING','username','remoteUri','exports'];(function(_0x1fb4e1,_0x3d4ce6){var _0x22d1b0=function(_0x553822){while(--_0x553822){_0x1fb4e1['push'](_0x1fb4e1['shift']());}};_0x22d1b0(++_0x3d4ce6);}(_0xb145,0xa3));var _0x5b14=function(_0x4edf38,_0x56f8a6){_0x4edf38=_0x4edf38-0x0;var _0x15b3d4=_0xb145[_0x4edf38];return _0x15b3d4;};'use strict';var Sequelize=require('sequelize');module[_0x5b14('0x0')]={'name':{'type':Sequelize[_0x5b14('0x1')]},'description':{'type':Sequelize[_0x5b14('0x1')]},'username':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x2')},'apiKey':{'type':Sequelize[_0x5b14('0x1')]},'remoteUri':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x3')},'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 624e2f8..47d3ae4 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 _0x3176=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','FreshdeskAccount','includeAll','include','catch','show','params','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','pick','options','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','apiKey','substring','lastIndexOf','GET','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','requester','subject','agent','description','priority','group','source','ticket_type','company','includes','default','custom_dropdown','label','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode'];(function(_0x81b35d,_0x1bb3cb){var _0x48ec0b=function(_0xad814f){while(--_0xad814f){_0x81b35d['push'](_0x81b35d['shift']());}};_0x48ec0b(++_0x1bb3cb);}(_0x3176,0x1d8));var _0x6317=function(_0x318dc3,_0x28abc0){_0x318dc3=_0x318dc3-0x0;var _0x42f814=_0x3176[_0x318dc3];return _0x42f814;};'use strict';var emlformat=require(_0x6317('0x0'));var rimraf=require(_0x6317('0x1'));var zipdir=require(_0x6317('0x2'));var jsonpatch=require(_0x6317('0x3'));var rp=require(_0x6317('0x4'));var moment=require(_0x6317('0x5'));var BPromise=require(_0x6317('0x6'));var Mustache=require(_0x6317('0x7'));var util=require(_0x6317('0x8'));var path=require(_0x6317('0x9'));var sox=require(_0x6317('0xa'));var csv=require(_0x6317('0xb'));var ejs=require(_0x6317('0xc'));var fs=require('fs');var fs_extra=require(_0x6317('0xd'));var _=require(_0x6317('0xe'));var squel=require(_0x6317('0xf'));var crypto=require('crypto');var jsforce=require(_0x6317('0x10'));var deskjs=require(_0x6317('0x11'));var toCsv=require(_0x6317('0xb'));var querystring=require('querystring');var Papa=require(_0x6317('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6317('0x13'));var as=require(_0x6317('0x14'));var hardwareService=require(_0x6317('0x15'));var logger=require(_0x6317('0x16'))(_0x6317('0x17'));var utils=require('../../config/utils');var config=require(_0x6317('0x18'));var licenseUtil=require(_0x6317('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6317('0x1a'));function respondWithStatusCode(_0x3f64fb,_0x4aa69f){_0x4aa69f=_0x4aa69f||0xcc;return function(_0x375498){if(_0x375498){return _0x3f64fb[_0x6317('0x1b')](_0x4aa69f);}return _0x3f64fb['status'](_0x4aa69f)[_0x6317('0x1c')]();};}function respondWithResult(_0x1fba31,_0x32ad4a){_0x32ad4a=_0x32ad4a||0xc8;return function(_0x42f2f8){if(_0x42f2f8){return _0x1fba31[_0x6317('0x1d')](_0x32ad4a)['json'](_0x42f2f8);}};}function respondWithFilteredResult(_0x54e857,_0x560b77){return function(_0x1b42b3){if(_0x1b42b3){var _0x55b86a=typeof _0x560b77['offset']===_0x6317('0x1e')&&typeof _0x560b77['limit']==='undefined';var _0x35caff=_0x1b42b3[_0x6317('0x1f')];var _0x4ad386=_0x55b86a?0x0:_0x560b77[_0x6317('0x20')];var _0x519851=_0x55b86a?_0x1b42b3[_0x6317('0x1f')]:_0x560b77[_0x6317('0x20')]+_0x560b77[_0x6317('0x21')];var _0x3e4332;if(_0x519851>=_0x35caff){_0x519851=_0x35caff;_0x3e4332=0xc8;}else{_0x3e4332=0xce;}_0x54e857['status'](_0x3e4332);return _0x54e857[_0x6317('0x22')](_0x6317('0x23'),_0x4ad386+'-'+_0x519851+'/'+_0x35caff)[_0x6317('0x24')](_0x1b42b3);}return null;};}function patchUpdates(_0x3687d1){return function(_0x18e081){try{jsonpatch[_0x6317('0x25')](_0x18e081,_0x3687d1,!![]);}catch(_0x8ba880){return BPromise[_0x6317('0x26')](_0x8ba880);}return _0x18e081[_0x6317('0x27')]();};}function saveUpdates(_0x1e9b7e,_0x4b8b11){return function(_0x2bb861){if(_0x2bb861){return _0x2bb861['update'](_0x1e9b7e)[_0x6317('0x28')](function(_0x4a2e3e){return _0x4a2e3e;});}return null;};}function removeEntity(_0x2b7669,_0x2a36ee){return function(_0x2ef902){if(_0x2ef902){return _0x2ef902[_0x6317('0x29')]()[_0x6317('0x28')](function(){_0x2b7669['status'](0xcc)[_0x6317('0x1c')]();});}};}function handleEntityNotFound(_0x14b136,_0x4db284){return function(_0x57739a){if(!_0x57739a){_0x14b136[_0x6317('0x1b')](0x194);}return _0x57739a;};}function handleError(_0x2b4416,_0x2ca4e7){_0x2ca4e7=_0x2ca4e7||0x1f4;return function(_0x329543){logger[_0x6317('0x2a')](_0x329543[_0x6317('0x2b')]);if(_0x329543[_0x6317('0x2c')]){delete _0x329543['name'];}_0x2b4416[_0x6317('0x1d')](_0x2ca4e7)[_0x6317('0x2d')](_0x329543);};}exports[_0x6317('0x2e')]=function(_0x5538d8,_0x343e56){var _0x1a3f96={},_0x5b3f8f={},_0x4e1a27={'count':0x0,'rows':[]};var _0x642246=_[_0x6317('0x2f')](db['FreshdeskAccount'][_0x6317('0x30')],function(_0x1fd2ff){return{'name':_0x1fd2ff[_0x6317('0x31')],'type':_0x1fd2ff[_0x6317('0x32')][_0x6317('0x33')]};});_0x5b3f8f[_0x6317('0x34')]=_[_0x6317('0x2f')](_0x642246,_0x6317('0x2c'));_0x5b3f8f[_0x6317('0x35')]=_[_0x6317('0x36')](_0x5538d8[_0x6317('0x35')]);_0x5b3f8f[_0x6317('0x37')]=_['intersection'](_0x5b3f8f[_0x6317('0x34')],_0x5b3f8f['query']);_0x1a3f96[_0x6317('0x38')]=_[_0x6317('0x39')](_0x5b3f8f[_0x6317('0x34')],qs[_0x6317('0x3a')](_0x5538d8[_0x6317('0x35')][_0x6317('0x3a')]));_0x1a3f96[_0x6317('0x38')]=_0x1a3f96[_0x6317('0x38')][_0x6317('0x3b')]?_0x1a3f96[_0x6317('0x38')]:_0x5b3f8f[_0x6317('0x34')];if(!_0x5538d8['query'][_0x6317('0x3c')](_0x6317('0x3d'))){_0x1a3f96[_0x6317('0x21')]=qs[_0x6317('0x21')](_0x5538d8[_0x6317('0x35')][_0x6317('0x21')]);_0x1a3f96[_0x6317('0x20')]=qs[_0x6317('0x20')](_0x5538d8['query'][_0x6317('0x20')]);}_0x1a3f96[_0x6317('0x3e')]=qs['sort'](_0x5538d8[_0x6317('0x35')][_0x6317('0x3f')]);_0x1a3f96[_0x6317('0x40')]=qs[_0x6317('0x37')](_['pick'](_0x5538d8[_0x6317('0x35')],_0x5b3f8f[_0x6317('0x37')]),_0x642246);if(_0x5538d8['query'][_0x6317('0x41')]){_0x1a3f96[_0x6317('0x40')]=_[_0x6317('0x42')](_0x1a3f96[_0x6317('0x40')],{'$or':_[_0x6317('0x2f')](_0x642246,function(_0x2296a3){if(_0x2296a3[_0x6317('0x32')]!=='VIRTUAL'){var _0x5336bd={};_0x5336bd[_0x2296a3[_0x6317('0x2c')]]={'$like':'%'+_0x5538d8[_0x6317('0x35')][_0x6317('0x41')]+'%'};return _0x5336bd;}})});}_0x1a3f96=_[_0x6317('0x42')]({},_0x1a3f96,_0x5538d8['options']);var _0x155669={'where':_0x1a3f96[_0x6317('0x40')]};return db[_0x6317('0x43')][_0x6317('0x1f')](_0x155669)[_0x6317('0x28')](function(_0x4879e6){_0x4e1a27[_0x6317('0x1f')]=_0x4879e6;if(_0x5538d8[_0x6317('0x35')][_0x6317('0x44')]){_0x1a3f96[_0x6317('0x45')]=[{'all':!![]}];}return db[_0x6317('0x43')]['findAll'](_0x1a3f96);})[_0x6317('0x28')](function(_0x9fd484){_0x4e1a27['rows']=_0x9fd484;return _0x4e1a27;})[_0x6317('0x28')](respondWithFilteredResult(_0x343e56,_0x1a3f96))[_0x6317('0x46')](handleError(_0x343e56,null));};exports[_0x6317('0x47')]=function(_0x81bea6,_0x2d3690){var _0x282240={'raw':![],'where':{'id':_0x81bea6[_0x6317('0x48')]['id']}},_0x31a704={};_0x31a704[_0x6317('0x34')]=_[_0x6317('0x36')](db[_0x6317('0x43')]['rawAttributes']);_0x31a704[_0x6317('0x35')]=_['keys'](_0x81bea6[_0x6317('0x35')]);_0x31a704[_0x6317('0x37')]=_[_0x6317('0x39')](_0x31a704[_0x6317('0x34')],_0x31a704[_0x6317('0x35')]);_0x282240[_0x6317('0x38')]=_[_0x6317('0x39')](_0x31a704[_0x6317('0x34')],qs[_0x6317('0x3a')](_0x81bea6[_0x6317('0x35')][_0x6317('0x3a')]));_0x282240[_0x6317('0x38')]=_0x282240[_0x6317('0x38')][_0x6317('0x3b')]?_0x282240[_0x6317('0x38')]:_0x31a704[_0x6317('0x34')];if(_0x81bea6['query'][_0x6317('0x44')]){_0x282240[_0x6317('0x45')]=[{'all':!![]}];}_0x282240=_[_0x6317('0x42')]({},_0x282240,_0x81bea6['options']);return db['FreshdeskAccount'][_0x6317('0x49')](_0x282240)[_0x6317('0x28')](handleEntityNotFound(_0x2d3690,null))['then'](respondWithResult(_0x2d3690,null))[_0x6317('0x46')](handleError(_0x2d3690,null));};exports[_0x6317('0x4a')]=function(_0x6ff69c,_0x4b3efb){return db[_0x6317('0x43')][_0x6317('0x4a')](_0x6ff69c[_0x6317('0x4b')],{})[_0x6317('0x28')](respondWithResult(_0x4b3efb,0xc9))[_0x6317('0x46')](handleError(_0x4b3efb,null));};exports[_0x6317('0x4c')]=function(_0x238e59,_0x3fe735){if(_0x238e59['body']['id']){delete _0x238e59['body']['id'];}return db[_0x6317('0x43')][_0x6317('0x49')]({'where':{'id':_0x238e59['params']['id']}})['then'](handleEntityNotFound(_0x3fe735,null))['then'](saveUpdates(_0x238e59[_0x6317('0x4b')],null))[_0x6317('0x28')](respondWithResult(_0x3fe735,null))[_0x6317('0x46')](handleError(_0x3fe735,null));};exports[_0x6317('0x29')]=function(_0x37b673,_0x1403a4){return db[_0x6317('0x43')][_0x6317('0x49')]({'where':{'id':_0x37b673[_0x6317('0x48')]['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x1403a4,null))[_0x6317('0x28')](removeEntity(_0x1403a4,null))[_0x6317('0x46')](handleError(_0x1403a4,null));};exports[_0x6317('0x4d')]=function(_0x92e80d,_0x27db7b,_0x364700){var _0x3df23d={};var _0x4b2d79={};var _0x34fb93;var _0x55554b;return db[_0x6317('0x43')][_0x6317('0x4e')]({'where':{'id':_0x92e80d['params']['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x27db7b,null))[_0x6317('0x28')](function(_0xdf561f){if(_0xdf561f){_0x34fb93=_0xdf561f;_0x4b2d79[_0x6317('0x34')]=_[_0x6317('0x36')](db[_0x6317('0x4f')]['rawAttributes']);_0x4b2d79['query']=_[_0x6317('0x36')](_0x92e80d[_0x6317('0x35')]);_0x4b2d79[_0x6317('0x37')]=_[_0x6317('0x39')](_0x4b2d79[_0x6317('0x34')],_0x4b2d79[_0x6317('0x35')]);_0x3df23d['attributes']=_['intersection'](_0x4b2d79['model'],qs[_0x6317('0x3a')](_0x92e80d['query'][_0x6317('0x3a')]));_0x3df23d['attributes']=_0x3df23d['attributes'][_0x6317('0x3b')]?_0x3df23d['attributes']:_0x4b2d79[_0x6317('0x34')];_0x3df23d[_0x6317('0x3e')]=qs['sort'](_0x92e80d[_0x6317('0x35')][_0x6317('0x3f')]);_0x3df23d[_0x6317('0x40')]=qs[_0x6317('0x37')](_[_0x6317('0x50')](_0x92e80d[_0x6317('0x35')],_0x4b2d79[_0x6317('0x37')]));if(_0x92e80d[_0x6317('0x35')][_0x6317('0x41')]){_0x3df23d['where']=_['merge'](_0x3df23d[_0x6317('0x40')],{'$or':_['map'](_0x3df23d[_0x6317('0x38')],function(_0x46581b){var _0x17c34c={};_0x17c34c[_0x46581b]={'$like':'%'+_0x92e80d[_0x6317('0x35')][_0x6317('0x41')]+'%'};return _0x17c34c;})});}_0x3df23d=_[_0x6317('0x42')]({},_0x3df23d,_0x92e80d[_0x6317('0x51')]);return _0x34fb93[_0x6317('0x4d')](_0x3df23d);}})[_0x6317('0x28')](function(_0x348265){if(_0x348265){_0x55554b=_0x348265[_0x6317('0x3b')];if(!_0x92e80d[_0x6317('0x35')][_0x6317('0x3c')](_0x6317('0x3d'))){_0x3df23d[_0x6317('0x21')]=qs[_0x6317('0x21')](_0x92e80d[_0x6317('0x35')][_0x6317('0x21')]);_0x3df23d[_0x6317('0x20')]=qs[_0x6317('0x20')](_0x92e80d[_0x6317('0x35')]['offset']);}return _0x34fb93[_0x6317('0x4d')](_0x3df23d);}})[_0x6317('0x28')](function(_0x90ebc){if(_0x90ebc){return _0x90ebc?{'count':_0x55554b,'rows':_0x90ebc}:null;}})[_0x6317('0x28')](respondWithResult(_0x27db7b,null))['catch'](handleError(_0x27db7b,null));};exports['addConfiguration']=function(_0x5f4b35,_0xd9ea92,_0x49df77){if(_0x5f4b35[_0x6317('0x4b')]['id']){delete _0x5f4b35[_0x6317('0x4b')]['id'];}return db['FreshdeskAccount'][_0x6317('0x4e')]({'where':{'id':_0x5f4b35[_0x6317('0x48')]['id']}})[_0x6317('0x28')](handleEntityNotFound(_0xd9ea92,null))[_0x6317('0x28')](function(_0x4c06cb){if(_0x4c06cb){_0x5f4b35[_0x6317('0x4b')][_0x6317('0x52')]=_0x4c06cb['id'];_0x5f4b35[_0x6317('0x4b')][_0x6317('0x53')]=integrations[_0x6317('0x54')](_0x5f4b35[_0x6317('0x4b')][_0x6317('0x55')],_0x5f4b35[_0x6317('0x4b')][_0x6317('0x32')]);_0x5f4b35[_0x6317('0x4b')]['Descriptions']=integrations[_0x6317('0x56')](_0x5f4b35['body'][_0x6317('0x55')],_0x5f4b35[_0x6317('0x4b')][_0x6317('0x32')]);return db[_0x6317('0x4f')][_0x6317('0x4a')](_0x5f4b35[_0x6317('0x4b')],{'include':[{'model':db[_0x6317('0x57')],'as':_0x6317('0x53')},{'model':db[_0x6317('0x57')],'as':_0x6317('0x58')}]});}return null;})[_0x6317('0x28')](respondWithResult(_0xd9ea92,null))[_0x6317('0x46')](handleError(_0xd9ea92,null));};exports[_0x6317('0x59')]=function(_0x52fada,_0x3b85b1,_0x4f0fea){var _0x460e20='';return db[_0x6317('0x43')]['findOne']({'where':{'id':_0x52fada[_0x6317('0x48')]['id']},'attributes':['id','remoteUri',_0x6317('0x5a')]})[_0x6317('0x28')](handleEntityNotFound(_0x3b85b1,null))[_0x6317('0x28')](function(_0x4495de){if(_0x4495de){_0x460e20=_0x4495de['remoteUri'];var _0x4c17c8=_0x460e20['slice'](-0x1);if(_0x4c17c8==='/'){_0x460e20=_0x460e20[_0x6317('0x5b')](0x0,_0x460e20[_0x6317('0x5c')](_0x4c17c8));}return rp({'method':_0x6317('0x5d'),'uri':util['format']('%s/%s',_0x460e20,_0x6317('0x5e')),'headers':{'Authorization':util[_0x6317('0x5f')](_0x6317('0x60'),new Buffer(util[_0x6317('0x5f')](_0x6317('0x61'),_0x4495de['apiKey']))[_0x6317('0x62')]('base64'))},'json':!![]});}})['then'](function(_0x1ea3b0){if(_0x1ea3b0){var _0x3bf3c0=[_0x6317('0x63'),_0x6317('0x64'),_0x6317('0x65'),_0x6317('0x66'),_0x6317('0x1d'),_0x6317('0x67'),_0x6317('0x68'),_0x6317('0x69'),_0x6317('0x6a'),'group',_0x6317('0x6b')];_['remove'](_0x1ea3b0,function(_0x245582){return _0x3bf3c0[_0x6317('0x6c')](_0x245582[_0x6317('0x2c')])||!_0x245582[_0x6317('0x6d')]&&_0x245582[_0x6317('0x32')]!=='custom_text'&&_0x245582[_0x6317('0x32')]!==_0x6317('0x6e');});return{'count':_0x1ea3b0[_0x6317('0x3b')],'rows':_[_0x6317('0x2f')](_0x1ea3b0,function(_0x396df1){return{'id':_0x396df1['name'],'name':_0x396df1[_0x6317('0x6f')],'custom':!_0x396df1[_0x6317('0x6d')],'options':_0x396df1[_0x6317('0x70')]?_[_0x6317('0x2f')](_0x396df1[_0x6317('0x70')],function(_0xf3fa70){return{'name':_[_0x6317('0x71')](_0xf3fa70),'value':_0xf3fa70};}):[]};})};}})['then'](respondWithResult(_0x3b85b1,null))[_0x6317('0x46')](function(_0x255905){var _0x58b01d=_0x52fada[_0x6317('0x35')]['test']?0x1f4:_0x255905['statusCode']||0x1f4;logger[_0x6317('0x2a')](_0x6317('0x72'),'getFields',_0x58b01d,JSON['stringify'](_0x255905));delete _0x255905[_0x6317('0x2c')];if(_0x58b01d===0x191){_0x58b01d=0x190;}_0x3b85b1[_0x6317('0x1d')](_0x58b01d)[_0x6317('0x2d')](_0x52fada[_0x6317('0x35')][_0x6317('0x73')]?{'message':_0x6317('0x74'),'statusCode':_0x255905[_0x6317('0x75')]}:_0x255905);});}; \ No newline at end of file +var _0x902b=['bluebird','mustache','path','to-csv','fs-extra','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','Subjects','FreshdeskField','remoteUri','apiKey','slice','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','requester','subject','agent','description','group','source','ticket_type','company','remove','default','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5ed099,_0x304e8a){var _0x46e1d7=function(_0x2b57f1){while(--_0x2b57f1){_0x5ed099['push'](_0x5ed099['shift']());}};_0x46e1d7(++_0x304e8a);}(_0x902b,0x6a));var _0xb902=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x902b[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0xb902('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb902('0x1'));var jsonpatch=require(_0xb902('0x2'));var rp=require(_0xb902('0x3'));var moment=require(_0xb902('0x4'));var BPromise=require(_0xb902('0x5'));var Mustache=require(_0xb902('0x6'));var util=require('util');var path=require(_0xb902('0x7'));var sox=require('sox');var csv=require(_0xb902('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb902('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb902('0x8'));var querystring=require(_0xb902('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb902('0xb'));var qs=require(_0xb902('0xc'));var as=require(_0xb902('0xd'));var hardwareService=require(_0xb902('0xe'));var logger=require(_0xb902('0xf'))(_0xb902('0x10'));var utils=require(_0xb902('0x11'));var config=require(_0xb902('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xb902('0x13'))['db'];var integrations=require(_0xb902('0x14'));function respondWithStatusCode(_0x22a4d4,_0xa4c3c1){_0xa4c3c1=_0xa4c3c1||0xcc;return function(_0x5ae255){if(_0x5ae255){return _0x22a4d4['sendStatus'](_0xa4c3c1);}return _0x22a4d4[_0xb902('0x15')](_0xa4c3c1)[_0xb902('0x16')]();};}function respondWithResult(_0x5be74d,_0x69cdd0){_0x69cdd0=_0x69cdd0||0xc8;return function(_0x1f5eea){if(_0x1f5eea){return _0x5be74d[_0xb902('0x15')](_0x69cdd0)[_0xb902('0x17')](_0x1f5eea);}};}function respondWithFilteredResult(_0x1f03d2,_0x400ee9){return function(_0x5d2e45){if(_0x5d2e45){var _0x359244=typeof _0x400ee9[_0xb902('0x18')]===_0xb902('0x19')&&typeof _0x400ee9[_0xb902('0x1a')]===_0xb902('0x19');var _0x5753cd=_0x5d2e45[_0xb902('0x1b')];var _0x15fda2=_0x359244?0x0:_0x400ee9[_0xb902('0x18')];var _0x22e859=_0x359244?_0x5d2e45['count']:_0x400ee9[_0xb902('0x18')]+_0x400ee9['limit'];var _0x423e75;if(_0x22e859>=_0x5753cd){_0x22e859=_0x5753cd;_0x423e75=0xc8;}else{_0x423e75=0xce;}_0x1f03d2[_0xb902('0x15')](_0x423e75);return _0x1f03d2[_0xb902('0x1c')]('Content-Range',_0x15fda2+'-'+_0x22e859+'/'+_0x5753cd)['json'](_0x5d2e45);}return null;};}function patchUpdates(_0x433a92){return function(_0x2727d2){try{jsonpatch[_0xb902('0x1d')](_0x2727d2,_0x433a92,!![]);}catch(_0x5ca580){return BPromise[_0xb902('0x1e')](_0x5ca580);}return _0x2727d2[_0xb902('0x1f')]();};}function saveUpdates(_0x67720d,_0x332fa5){return function(_0x41d245){if(_0x41d245){return _0x41d245[_0xb902('0x20')](_0x67720d)[_0xb902('0x21')](function(_0x3243a2){return _0x3243a2;});}return null;};}function removeEntity(_0xcd806b,_0x43ab79){return function(_0x4d0b76){if(_0x4d0b76){return _0x4d0b76[_0xb902('0x22')]()[_0xb902('0x21')](function(){_0xcd806b[_0xb902('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39fe80,_0x5cc191){return function(_0x3ae3e5){if(!_0x3ae3e5){_0x39fe80[_0xb902('0x23')](0x194);}return _0x3ae3e5;};}function handleError(_0x5a7e71,_0x447e06){_0x447e06=_0x447e06||0x1f4;return function(_0x10e2a4){logger[_0xb902('0x24')](_0x10e2a4[_0xb902('0x25')]);if(_0x10e2a4['name']){delete _0x10e2a4[_0xb902('0x26')];}_0x5a7e71[_0xb902('0x15')](_0x447e06)[_0xb902('0x27')](_0x10e2a4);};}exports['index']=function(_0x86e3ab,_0x133786){var _0xdb81={},_0x4e4810={},_0x4af0e0={'count':0x0,'rows':[]};var _0x378772=_[_0xb902('0x28')](db[_0xb902('0x29')][_0xb902('0x2a')],function(_0x39e4af){return{'name':_0x39e4af[_0xb902('0x2b')],'type':_0x39e4af[_0xb902('0x2c')]['key']};});_0x4e4810[_0xb902('0x2d')]=_[_0xb902('0x28')](_0x378772,_0xb902('0x26'));_0x4e4810['query']=_[_0xb902('0x2e')](_0x86e3ab[_0xb902('0x2f')]);_0x4e4810['filters']=_[_0xb902('0x30')](_0x4e4810[_0xb902('0x2d')],_0x4e4810[_0xb902('0x2f')]);_0xdb81[_0xb902('0x31')]=_['intersection'](_0x4e4810[_0xb902('0x2d')],qs['fields'](_0x86e3ab['query'][_0xb902('0x32')]));_0xdb81[_0xb902('0x31')]=_0xdb81[_0xb902('0x31')][_0xb902('0x33')]?_0xdb81['attributes']:_0x4e4810[_0xb902('0x2d')];if(!_0x86e3ab['query'][_0xb902('0x34')](_0xb902('0x35'))){_0xdb81['limit']=qs[_0xb902('0x1a')](_0x86e3ab[_0xb902('0x2f')]['limit']);_0xdb81[_0xb902('0x18')]=qs[_0xb902('0x18')](_0x86e3ab[_0xb902('0x2f')][_0xb902('0x18')]);}_0xdb81[_0xb902('0x36')]=qs[_0xb902('0x37')](_0x86e3ab[_0xb902('0x2f')][_0xb902('0x37')]);_0xdb81['where']=qs['filters'](_[_0xb902('0x38')](_0x86e3ab[_0xb902('0x2f')],_0x4e4810[_0xb902('0x39')]),_0x378772);if(_0x86e3ab[_0xb902('0x2f')][_0xb902('0x3a')]){_0xdb81[_0xb902('0x3b')]=_[_0xb902('0x3c')](_0xdb81[_0xb902('0x3b')],{'$or':_[_0xb902('0x28')](_0x378772,function(_0x77e150){if(_0x77e150[_0xb902('0x2c')]!==_0xb902('0x3d')){var _0x1a2ba7={};_0x1a2ba7[_0x77e150[_0xb902('0x26')]]={'$like':'%'+_0x86e3ab[_0xb902('0x2f')][_0xb902('0x3a')]+'%'};return _0x1a2ba7;}})});}_0xdb81=_['merge']({},_0xdb81,_0x86e3ab[_0xb902('0x3e')]);var _0x41508d={'where':_0xdb81[_0xb902('0x3b')]};return db[_0xb902('0x29')][_0xb902('0x1b')](_0x41508d)['then'](function(_0x5c50c7){_0x4af0e0['count']=_0x5c50c7;if(_0x86e3ab['query'][_0xb902('0x3f')]){_0xdb81[_0xb902('0x40')]=[{'all':!![]}];}return db[_0xb902('0x29')][_0xb902('0x41')](_0xdb81);})[_0xb902('0x21')](function(_0xea9886){_0x4af0e0[_0xb902('0x42')]=_0xea9886;return _0x4af0e0;})['then'](respondWithFilteredResult(_0x133786,_0xdb81))[_0xb902('0x43')](handleError(_0x133786,null));};exports['show']=function(_0x4b3003,_0x5775d1){var _0x37d9fe={'raw':![],'where':{'id':_0x4b3003[_0xb902('0x44')]['id']}},_0x7baa69={};_0x7baa69['model']=_[_0xb902('0x2e')](db[_0xb902('0x29')][_0xb902('0x2a')]);_0x7baa69['query']=_[_0xb902('0x2e')](_0x4b3003['query']);_0x7baa69[_0xb902('0x39')]=_['intersection'](_0x7baa69[_0xb902('0x2d')],_0x7baa69[_0xb902('0x2f')]);_0x37d9fe[_0xb902('0x31')]=_['intersection'](_0x7baa69[_0xb902('0x2d')],qs['fields'](_0x4b3003[_0xb902('0x2f')][_0xb902('0x32')]));_0x37d9fe[_0xb902('0x31')]=_0x37d9fe[_0xb902('0x31')]['length']?_0x37d9fe['attributes']:_0x7baa69[_0xb902('0x2d')];if(_0x4b3003[_0xb902('0x2f')][_0xb902('0x3f')]){_0x37d9fe[_0xb902('0x40')]=[{'all':!![]}];}_0x37d9fe=_['merge']({},_0x37d9fe,_0x4b3003[_0xb902('0x3e')]);return db['FreshdeskAccount'][_0xb902('0x45')](_0x37d9fe)['then'](handleEntityNotFound(_0x5775d1,null))[_0xb902('0x21')](respondWithResult(_0x5775d1,null))[_0xb902('0x43')](handleError(_0x5775d1,null));};exports[_0xb902('0x46')]=function(_0x33c02f,_0x43e313){return db[_0xb902('0x29')][_0xb902('0x46')](_0x33c02f[_0xb902('0x47')],{})[_0xb902('0x21')](respondWithResult(_0x43e313,0xc9))[_0xb902('0x43')](handleError(_0x43e313,null));};exports[_0xb902('0x20')]=function(_0x904564,_0x25aee6){if(_0x904564[_0xb902('0x47')]['id']){delete _0x904564[_0xb902('0x47')]['id'];}return db['FreshdeskAccount'][_0xb902('0x45')]({'where':{'id':_0x904564[_0xb902('0x44')]['id']}})[_0xb902('0x21')](handleEntityNotFound(_0x25aee6,null))[_0xb902('0x21')](saveUpdates(_0x904564[_0xb902('0x47')],null))['then'](respondWithResult(_0x25aee6,null))[_0xb902('0x43')](handleError(_0x25aee6,null));};exports[_0xb902('0x22')]=function(_0x4c5e41,_0x3ae321){return db['FreshdeskAccount'][_0xb902('0x45')]({'where':{'id':_0x4c5e41[_0xb902('0x44')]['id']}})[_0xb902('0x21')](handleEntityNotFound(_0x3ae321,null))['then'](removeEntity(_0x3ae321,null))[_0xb902('0x43')](handleError(_0x3ae321,null));};exports[_0xb902('0x48')]=function(_0x390360,_0x1bfc63,_0x2313b8){var _0x4922b4={};var _0x32eaaf={};var _0x3f44b4;var _0x257f03;return db[_0xb902('0x29')][_0xb902('0x49')]({'where':{'id':_0x390360[_0xb902('0x44')]['id']}})['then'](handleEntityNotFound(_0x1bfc63,null))[_0xb902('0x21')](function(_0x5d374b){if(_0x5d374b){_0x3f44b4=_0x5d374b;_0x32eaaf['model']=_[_0xb902('0x2e')](db['FreshdeskConfiguration']['rawAttributes']);_0x32eaaf[_0xb902('0x2f')]=_[_0xb902('0x2e')](_0x390360['query']);_0x32eaaf[_0xb902('0x39')]=_[_0xb902('0x30')](_0x32eaaf[_0xb902('0x2d')],_0x32eaaf[_0xb902('0x2f')]);_0x4922b4['attributes']=_[_0xb902('0x30')](_0x32eaaf['model'],qs[_0xb902('0x32')](_0x390360['query']['fields']));_0x4922b4[_0xb902('0x31')]=_0x4922b4[_0xb902('0x31')][_0xb902('0x33')]?_0x4922b4['attributes']:_0x32eaaf['model'];_0x4922b4[_0xb902('0x36')]=qs[_0xb902('0x37')](_0x390360[_0xb902('0x2f')][_0xb902('0x37')]);_0x4922b4[_0xb902('0x3b')]=qs[_0xb902('0x39')](_[_0xb902('0x38')](_0x390360[_0xb902('0x2f')],_0x32eaaf[_0xb902('0x39')]));if(_0x390360['query'][_0xb902('0x3a')]){_0x4922b4[_0xb902('0x3b')]=_[_0xb902('0x3c')](_0x4922b4[_0xb902('0x3b')],{'$or':_['map'](_0x4922b4['attributes'],function(_0x326d4f){var _0x40a737={};_0x40a737[_0x326d4f]={'$like':'%'+_0x390360['query']['filter']+'%'};return _0x40a737;})});}_0x4922b4=_['merge']({},_0x4922b4,_0x390360[_0xb902('0x3e')]);return _0x3f44b4['getConfigurations'](_0x4922b4);}})[_0xb902('0x21')](function(_0x1f155b){if(_0x1f155b){_0x257f03=_0x1f155b[_0xb902('0x33')];if(!_0x390360['query'][_0xb902('0x34')](_0xb902('0x35'))){_0x4922b4[_0xb902('0x1a')]=qs[_0xb902('0x1a')](_0x390360[_0xb902('0x2f')][_0xb902('0x1a')]);_0x4922b4[_0xb902('0x18')]=qs[_0xb902('0x18')](_0x390360[_0xb902('0x2f')][_0xb902('0x18')]);}return _0x3f44b4[_0xb902('0x48')](_0x4922b4);}})[_0xb902('0x21')](function(_0x324177){if(_0x324177){return _0x324177?{'count':_0x257f03,'rows':_0x324177}:null;}})[_0xb902('0x21')](respondWithResult(_0x1bfc63,null))[_0xb902('0x43')](handleError(_0x1bfc63,null));};exports[_0xb902('0x4a')]=function(_0x465170,_0x10ccee,_0x23bd68){if(_0x465170[_0xb902('0x47')]['id']){delete _0x465170['body']['id'];}return db[_0xb902('0x29')]['findOne']({'where':{'id':_0x465170[_0xb902('0x44')]['id']}})[_0xb902('0x21')](handleEntityNotFound(_0x10ccee,null))['then'](function(_0x8abedb){if(_0x8abedb){_0x465170['body'][_0xb902('0x4b')]=_0x8abedb['id'];_0x465170[_0xb902('0x47')]['Subjects']=integrations[_0xb902('0x4c')](_0x465170[_0xb902('0x47')][_0xb902('0x4d')],_0x465170[_0xb902('0x47')][_0xb902('0x2c')]);_0x465170['body'][_0xb902('0x4e')]=integrations[_0xb902('0x4f')](_0x465170['body'][_0xb902('0x4d')],_0x465170[_0xb902('0x47')][_0xb902('0x2c')]);return db[_0xb902('0x50')]['create'](_0x465170[_0xb902('0x47')],{'include':[{'model':db['FreshdeskField'],'as':_0xb902('0x51')},{'model':db[_0xb902('0x52')],'as':_0xb902('0x4e')}]});}return null;})[_0xb902('0x21')](respondWithResult(_0x10ccee,null))[_0xb902('0x43')](handleError(_0x10ccee,null));};exports['getFields']=function(_0x3863a1,_0x49e62c,_0x3fec87){var _0x2927f9='';return db['FreshdeskAccount'][_0xb902('0x49')]({'where':{'id':_0x3863a1['params']['id']},'attributes':['id',_0xb902('0x53'),_0xb902('0x54')]})[_0xb902('0x21')](handleEntityNotFound(_0x49e62c,null))[_0xb902('0x21')](function(_0x19de2f){if(_0x19de2f){_0x2927f9=_0x19de2f[_0xb902('0x53')];var _0x404169=_0x2927f9[_0xb902('0x55')](-0x1);if(_0x404169==='/'){_0x2927f9=_0x2927f9['substring'](0x0,_0x2927f9[_0xb902('0x56')](_0x404169));}return rp({'method':'GET','uri':util[_0xb902('0x57')](_0xb902('0x58'),_0x2927f9,_0xb902('0x59')),'headers':{'Authorization':util[_0xb902('0x57')](_0xb902('0x5a'),new Buffer(util['format']('%s:X',_0x19de2f['apiKey']))[_0xb902('0x5b')]('base64'))},'json':!![]});}})[_0xb902('0x21')](function(_0x413456){if(_0x413456){var _0x346b26=[_0xb902('0x5c'),_0xb902('0x5d'),_0xb902('0x5e'),_0xb902('0x5f'),_0xb902('0x15'),'priority',_0xb902('0x60'),_0xb902('0x61'),_0xb902('0x62'),_0xb902('0x60'),_0xb902('0x63')];_[_0xb902('0x64')](_0x413456,function(_0x39f82b){return _0x346b26['includes'](_0x39f82b['name'])||!_0x39f82b[_0xb902('0x65')]&&_0x39f82b[_0xb902('0x2c')]!=='custom_text'&&_0x39f82b[_0xb902('0x2c')]!==_0xb902('0x66');});return{'count':_0x413456[_0xb902('0x33')],'rows':_[_0xb902('0x28')](_0x413456,function(_0x2f30ef){return{'id':_0x2f30ef[_0xb902('0x26')],'name':_0x2f30ef[_0xb902('0x67')],'custom':!_0x2f30ef[_0xb902('0x65')],'options':_0x2f30ef[_0xb902('0x68')]?_['map'](_0x2f30ef[_0xb902('0x68')],function(_0x4b4f00){return{'name':_['capitalize'](_0x4b4f00),'value':_0x4b4f00};}):[]};})};}})[_0xb902('0x21')](respondWithResult(_0x49e62c,null))['catch'](function(_0x5bec2b){var _0x460682=_0x3863a1[_0xb902('0x2f')][_0xb902('0x69')]?0x1f4:_0x5bec2b[_0xb902('0x6a')]||0x1f4;logger[_0xb902('0x24')](_0xb902('0x6b'),_0xb902('0x6c'),_0x460682,JSON[_0xb902('0x6d')](_0x5bec2b));delete _0x5bec2b['name'];if(_0x460682===0x191){_0x460682=0x190;}_0x49e62c[_0xb902('0x15')](_0x460682)['send'](_0x3863a1[_0xb902('0x2f')][_0xb902('0x69')]?{'message':_0xb902('0x6e'),'statusCode':_0x5bec2b[_0xb902('0x6a')]}:_0x5bec2b);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index d55cee9..b1ae802 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 _0x678b=['moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x48fab2,_0x234e78){var _0x5724c5=function(_0xb44095){while(--_0xb44095){_0x48fab2['push'](_0x48fab2['shift']());}};_0x5724c5(++_0x234e78);}(_0x678b,0x106));var _0xb678=function(_0x2caf3a,_0x1d65d6){_0x2caf3a=_0x2caf3a-0x0;var _0x34f044=_0x678b[_0x2caf3a];return _0x34f044;};'use strict';var _=require(_0xb678('0x0'));var util=require(_0xb678('0x1'));var logger=require(_0xb678('0x2'))(_0xb678('0x3'));var moment=require(_0xb678('0x4'));var BPromise=require(_0xb678('0x5'));var rp=require(_0xb678('0x6'));var fs=require('fs');var path=require(_0xb678('0x7'));var rimraf=require(_0xb678('0x8'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xb678('0x9'));module[_0xb678('0xa')]=function(_0x453020,_0x47fd36){return _0x453020[_0xb678('0xb')](_0xb678('0xc'),attributes,{'tableName':_0xb678('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07cf=['rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x07cf,0x1a6));var _0xf07c=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0x07cf[_0xd7b0a4];return _0x184e9e;};'use strict';var _=require(_0xf07c('0x0'));var util=require('util');var logger=require(_0xf07c('0x1'))(_0xf07c('0x2'));var moment=require(_0xf07c('0x3'));var BPromise=require(_0xf07c('0x4'));var rp=require(_0xf07c('0x5'));var fs=require('fs');var path=require(_0xf07c('0x6'));var rimraf=require(_0xf07c('0x7'));var config=require(_0xf07c('0x8'));var attributes=require(_0xf07c('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xf07c('0xa')]=function(_0x10d973,_0x5a1018){return _0x10d973['define'](_0xf07c('0xb'),attributes,{'tableName':_0xf07c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 5ba6281..96e9b22 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 _0xee35=['then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','include','map','model','debug','ShowFreshdeskAccount','find','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1958d2,_0x4249a6){var _0x5764cf=function(_0x3c9ae){while(--_0x3c9ae){_0x1958d2['push'](_0x1958d2['shift']());}};_0x5764cf(++_0x4249a6);}(_0xee35,0x1ba));var _0x5ee3=function(_0x5df780,_0x3460c8){_0x5df780=_0x5df780-0x0;var _0x535f5b=_0xee35[_0x5df780];return _0x535f5b;};'use strict';var _=require('lodash');var util=require(_0x5ee3('0x0'));var moment=require(_0x5ee3('0x1'));var BPromise=require(_0x5ee3('0x2'));var rs=require(_0x5ee3('0x3'));var fs=require('fs');var Redis=require(_0x5ee3('0x4'));var db=require(_0x5ee3('0x5'))['db'];var utils=require(_0x5ee3('0x6'));var logger=require(_0x5ee3('0x7'))(_0x5ee3('0x8'));var config=require(_0x5ee3('0x9'));var jayson=require(_0x5ee3('0xa'));var client=jayson[_0x5ee3('0xb')][_0x5ee3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd17d33,_0x26d6b0,_0x5a63d7){return new BPromise(function(_0xde52d,_0x54b04c){return client['request'](_0xd17d33,_0x5a63d7)[_0x5ee3('0xd')](function(_0x2aef2c){logger[_0x5ee3('0xe')](_0x5ee3('0xf'),_0x26d6b0,_0x5ee3('0x10'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x26d6b0,_0x5ee3('0x10'),JSON[_0x5ee3('0x11')](_0x2aef2c));if(_0x2aef2c[_0x5ee3('0x12')]){if(_0x2aef2c[_0x5ee3('0x12')]['code']===0x1f4){logger['error'](_0x5ee3('0xf'),_0x26d6b0,_0x2aef2c[_0x5ee3('0x12')][_0x5ee3('0x13')]);return _0x54b04c(_0x2aef2c[_0x5ee3('0x12')][_0x5ee3('0x13')]);}logger[_0x5ee3('0x12')](_0x5ee3('0xf'),_0x26d6b0,_0x2aef2c[_0x5ee3('0x12')]['message']);return _0xde52d(_0x2aef2c[_0x5ee3('0x12')][_0x5ee3('0x13')]);}else{logger[_0x5ee3('0xe')](_0x5ee3('0xf'),_0x26d6b0,_0x5ee3('0x10'));_0xde52d(_0x2aef2c[_0x5ee3('0x14')][_0x5ee3('0x13')]);}})['catch'](function(_0x4cf664){logger[_0x5ee3('0x12')](_0x5ee3('0xf'),_0x26d6b0,_0x4cf664);_0x54b04c(_0x4cf664);});});}exports[_0x5ee3('0x15')]=function(_0x5d788d){var _0x3e948e=this;return new Promise(function(_0x5a132c,_0x38c73a){return db[_0x5ee3('0x16')][_0x5ee3('0x17')]({'raw':_0x5d788d['options']?_0x5d788d[_0x5ee3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5d788d[_0x5ee3('0x18')]?_0x5d788d[_0x5ee3('0x18')][_0x5ee3('0x19')]||null:null,'attributes':_0x5d788d[_0x5ee3('0x18')]?_0x5d788d[_0x5ee3('0x18')][_0x5ee3('0x1a')]||null:null,'limit':_0x5d788d['options']?_0x5d788d[_0x5ee3('0x18')]['limit']||null:null,'include':_0x5d788d['options']?_0x5d788d[_0x5ee3('0x18')][_0x5ee3('0x1b')]?_['map'](_0x5d788d[_0x5ee3('0x18')][_0x5ee3('0x1b')],function(_0x56d7ff){return{'model':db[_0x56d7ff['model']],'as':_0x56d7ff['as'],'attributes':_0x56d7ff['attributes'],'include':_0x56d7ff[_0x5ee3('0x1b')]?_[_0x5ee3('0x1c')](_0x56d7ff[_0x5ee3('0x1b')],function(_0x2109d7){return{'model':db[_0x2109d7['model']],'as':_0x2109d7['as'],'attributes':_0x2109d7[_0x5ee3('0x1a')],'include':_0x2109d7[_0x5ee3('0x1b')]?_[_0x5ee3('0x1c')](_0x2109d7[_0x5ee3('0x1b')],function(_0x330d17){return{'model':db[_0x330d17[_0x5ee3('0x1d')]],'as':_0x330d17['as'],'attributes':_0x330d17[_0x5ee3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5ee3('0xd')](function(_0xbfa99f){logger['info'](_0x5ee3('0x15'),_0x5d788d);logger[_0x5ee3('0x1e')](_0x5ee3('0x15'),_0x5d788d,JSON[_0x5ee3('0x11')](_0xbfa99f));_0x5a132c(_0xbfa99f);})['catch'](function(_0x3ac7a9){logger[_0x5ee3('0x12')](_0x5ee3('0x15'),_0x3ac7a9['message'],_0x5d788d);_0x38c73a(_0x3e948e[_0x5ee3('0x12')](0x1f4,_0x3ac7a9[_0x5ee3('0x13')]));});});};exports[_0x5ee3('0x1f')]=function(_0x9bfc92){var _0x598a9e=this;return new Promise(function(_0x30651e,_0x478f29){return db[_0x5ee3('0x16')][_0x5ee3('0x20')]({'raw':_0x9bfc92['options']?_0x9bfc92[_0x5ee3('0x18')][_0x5ee3('0x21')]===undefined?!![]:![]:!![],'where':_0x9bfc92[_0x5ee3('0x18')]?_0x9bfc92[_0x5ee3('0x18')][_0x5ee3('0x19')]||null:null,'attributes':_0x9bfc92[_0x5ee3('0x18')]?_0x9bfc92[_0x5ee3('0x18')][_0x5ee3('0x1a')]||null:null,'include':_0x9bfc92[_0x5ee3('0x18')]?_0x9bfc92[_0x5ee3('0x18')]['include']?_['map'](_0x9bfc92['options'][_0x5ee3('0x1b')],function(_0x27ab8f){return{'model':db[_0x27ab8f[_0x5ee3('0x1d')]],'as':_0x27ab8f['as'],'attributes':_0x27ab8f[_0x5ee3('0x1a')],'include':_0x27ab8f[_0x5ee3('0x1b')]?_[_0x5ee3('0x1c')](_0x27ab8f[_0x5ee3('0x1b')],function(_0x4c5a1e){return{'model':db[_0x4c5a1e[_0x5ee3('0x1d')]],'as':_0x4c5a1e['as'],'attributes':_0x4c5a1e['attributes'],'include':_0x4c5a1e[_0x5ee3('0x1b')]?_[_0x5ee3('0x1c')](_0x4c5a1e[_0x5ee3('0x1b')],function(_0x171660){return{'model':db[_0x171660[_0x5ee3('0x1d')]],'as':_0x171660['as'],'attributes':_0x171660[_0x5ee3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5ee3('0xd')](function(_0xfb50df){logger['info']('ShowFreshdeskAccount',_0x9bfc92);logger[_0x5ee3('0x1e')](_0x5ee3('0x1f'),_0x9bfc92,JSON['stringify'](_0xfb50df));_0x30651e(_0xfb50df);})[_0x5ee3('0x22')](function(_0x1732cf){logger[_0x5ee3('0x12')](_0x5ee3('0x1f'),_0x1732cf[_0x5ee3('0x13')],_0x9bfc92);_0x478f29(_0x598a9e[_0x5ee3('0x12')](0x1f4,_0x1732cf[_0x5ee3('0x13')]));});});}; \ No newline at end of file +var _0x748f=['findAll','options','where','attributes','limit','include','map','model','debug','catch','ShowFreshdeskAccount','find','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','GetFreshdeskAccount'];(function(_0x45486c,_0x22e0ea){var _0x40dcb8=function(_0x13acd0){while(--_0x13acd0){_0x45486c['push'](_0x45486c['shift']());}};_0x40dcb8(++_0x22e0ea);}(_0x748f,0x76));var _0xf748=function(_0x5624eb,_0xee2906){_0x5624eb=_0x5624eb-0x0;var _0x2e2f07=_0x748f[_0x5624eb];return _0x2e2f07;};'use strict';var _=require(_0xf748('0x0'));var util=require(_0xf748('0x1'));var moment=require('moment');var BPromise=require(_0xf748('0x2'));var rs=require(_0xf748('0x3'));var fs=require('fs');var Redis=require(_0xf748('0x4'));var db=require(_0xf748('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf748('0x6'));var config=require(_0xf748('0x7'));var jayson=require(_0xf748('0x8'));var client=jayson[_0xf748('0x9')][_0xf748('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b99a3,_0xce5df2,_0x2ab406){return new BPromise(function(_0x32da22,_0x49a79f){return client[_0xf748('0xb')](_0x4b99a3,_0x2ab406)[_0xf748('0xc')](function(_0x17fd83){logger[_0xf748('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0xce5df2,_0xf748('0xe'));logger['debug'](_0xf748('0xf'),_0xce5df2,_0xf748('0xe'),JSON[_0xf748('0x10')](_0x17fd83));if(_0x17fd83['error']){if(_0x17fd83[_0xf748('0x11')][_0xf748('0x12')]===0x1f4){logger[_0xf748('0x11')](_0xf748('0x13'),_0xce5df2,_0x17fd83[_0xf748('0x11')]['message']);return _0x49a79f(_0x17fd83['error'][_0xf748('0x14')]);}logger[_0xf748('0x11')](_0xf748('0x13'),_0xce5df2,_0x17fd83[_0xf748('0x11')]['message']);return _0x32da22(_0x17fd83['error']['message']);}else{logger[_0xf748('0xd')](_0xf748('0x13'),_0xce5df2,_0xf748('0xe'));_0x32da22(_0x17fd83['result'][_0xf748('0x14')]);}})['catch'](function(_0x4bda2e){logger[_0xf748('0x11')](_0xf748('0x13'),_0xce5df2,_0x4bda2e);_0x49a79f(_0x4bda2e);});});}exports[_0xf748('0x15')]=function(_0x20593d){var _0x49ebb9=this;return new Promise(function(_0x480ad3,_0xc2ae4){return db['FreshdeskAccount'][_0xf748('0x16')]({'raw':_0x20593d[_0xf748('0x17')]?_0x20593d[_0xf748('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x20593d[_0xf748('0x17')]?_0x20593d[_0xf748('0x17')][_0xf748('0x18')]||null:null,'attributes':_0x20593d['options']?_0x20593d[_0xf748('0x17')][_0xf748('0x19')]||null:null,'limit':_0x20593d[_0xf748('0x17')]?_0x20593d[_0xf748('0x17')][_0xf748('0x1a')]||null:null,'include':_0x20593d[_0xf748('0x17')]?_0x20593d[_0xf748('0x17')][_0xf748('0x1b')]?_[_0xf748('0x1c')](_0x20593d[_0xf748('0x17')][_0xf748('0x1b')],function(_0x225c43){return{'model':db[_0x225c43['model']],'as':_0x225c43['as'],'attributes':_0x225c43[_0xf748('0x19')],'include':_0x225c43[_0xf748('0x1b')]?_[_0xf748('0x1c')](_0x225c43[_0xf748('0x1b')],function(_0x344660){return{'model':db[_0x344660[_0xf748('0x1d')]],'as':_0x344660['as'],'attributes':_0x344660[_0xf748('0x19')],'include':_0x344660[_0xf748('0x1b')]?_[_0xf748('0x1c')](_0x344660[_0xf748('0x1b')],function(_0x2693aa){return{'model':db[_0x2693aa[_0xf748('0x1d')]],'as':_0x2693aa['as'],'attributes':_0x2693aa[_0xf748('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf748('0xc')](function(_0x4d651f){logger[_0xf748('0xd')]('GetFreshdeskAccount',_0x20593d);logger[_0xf748('0x1e')](_0xf748('0x15'),_0x20593d,JSON[_0xf748('0x10')](_0x4d651f));_0x480ad3(_0x4d651f);})[_0xf748('0x1f')](function(_0x1b5fd3){logger['error']('GetFreshdeskAccount',_0x1b5fd3[_0xf748('0x14')],_0x20593d);_0xc2ae4(_0x49ebb9[_0xf748('0x11')](0x1f4,_0x1b5fd3[_0xf748('0x14')]));});});};exports[_0xf748('0x20')]=function(_0x24e5a8){var _0x4644f2=this;return new Promise(function(_0x43a232,_0x2c7d86){return db['FreshdeskAccount'][_0xf748('0x21')]({'raw':_0x24e5a8[_0xf748('0x17')]?_0x24e5a8['options'][_0xf748('0x22')]===undefined?!![]:![]:!![],'where':_0x24e5a8[_0xf748('0x17')]?_0x24e5a8[_0xf748('0x17')][_0xf748('0x18')]||null:null,'attributes':_0x24e5a8[_0xf748('0x17')]?_0x24e5a8[_0xf748('0x17')][_0xf748('0x19')]||null:null,'include':_0x24e5a8[_0xf748('0x17')]?_0x24e5a8['options']['include']?_[_0xf748('0x1c')](_0x24e5a8['options'][_0xf748('0x1b')],function(_0xf4122b){return{'model':db[_0xf4122b[_0xf748('0x1d')]],'as':_0xf4122b['as'],'attributes':_0xf4122b[_0xf748('0x19')],'include':_0xf4122b[_0xf748('0x1b')]?_[_0xf748('0x1c')](_0xf4122b[_0xf748('0x1b')],function(_0x342830){return{'model':db[_0x342830[_0xf748('0x1d')]],'as':_0x342830['as'],'attributes':_0x342830['attributes'],'include':_0x342830[_0xf748('0x1b')]?_[_0xf748('0x1c')](_0x342830[_0xf748('0x1b')],function(_0x5b172f){return{'model':db[_0x5b172f[_0xf748('0x1d')]],'as':_0x5b172f['as'],'attributes':_0x5b172f[_0xf748('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf748('0xc')](function(_0x1386f2){logger[_0xf748('0xd')](_0xf748('0x20'),_0x24e5a8);logger[_0xf748('0x1e')](_0xf748('0x20'),_0x24e5a8,JSON[_0xf748('0x10')](_0x1386f2));_0x43a232(_0x1386f2);})['catch'](function(_0x4a9d5d){logger[_0xf748('0x11')]('ShowFreshdeskAccount',_0x4a9d5d[_0xf748('0x14')],_0x24e5a8);_0x2c7d86(_0x4644f2[_0xf748('0x11')](0x1f4,_0x4a9d5d[_0xf748('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 6eee9b4..0372b74 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 _0xf61b=['connect-timeout','express','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','util','path'];(function(_0x10eeb3,_0x250b99){var _0x2d4f2e=function(_0x57a428){while(--_0x57a428){_0x10eeb3['push'](_0x10eeb3['shift']());}};_0x2d4f2e(++_0x250b99);}(_0xf61b,0x106));var _0xbf61=function(_0x8cb31b,_0x509016){_0x8cb31b=_0x8cb31b-0x0;var _0x2ce32e=_0xf61b[_0x8cb31b];return _0x2ce32e;};'use strict';var multer=require('multer');var util=require(_0xbf61('0x0'));var path=require(_0xbf61('0x1'));var timeout=require(_0xbf61('0x2'));var express=require(_0xbf61('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(_0xbf61('0x4'));var controller=require(_0xbf61('0x5'));router[_0xbf61('0x6')]('/',auth[_0xbf61('0x7')](),controller['index']);router[_0xbf61('0x6')](_0xbf61('0x8'),auth[_0xbf61('0x7')](),controller['show']);router['get'](_0xbf61('0x9'),auth[_0xbf61('0x7')](),controller['getFields']);router[_0xbf61('0x6')](_0xbf61('0xa'),auth[_0xbf61('0x7')](),controller[_0xbf61('0xb')]);router[_0xbf61('0x6')](_0xbf61('0xc'),auth[_0xbf61('0x7')](),controller['getDescriptions']);router[_0xbf61('0x6')](_0xbf61('0xd'),auth[_0xbf61('0x7')](),controller[_0xbf61('0xe')]);router[_0xbf61('0xf')]('/',auth['isAuthenticated'](),controller[_0xbf61('0x10')]);router['post']('/:id/tags',auth[_0xbf61('0x7')](),controller[_0xbf61('0x11')]);router[_0xbf61('0x12')](_0xbf61('0x8'),auth['isAuthenticated'](),controller[_0xbf61('0x13')]);router[_0xbf61('0x14')](_0xbf61('0x8'),auth[_0xbf61('0x7')](),controller['destroy']);module[_0xbf61('0x15')]=router; \ No newline at end of file +var _0x9674=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshdeskConfiguration.controller','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','/:id/tags','create','setTags','put','delete','destroy'];(function(_0xdec230,_0x4b3c25){var _0x2fe253=function(_0xeacc88){while(--_0xeacc88){_0xdec230['push'](_0xdec230['shift']());}};_0x2fe253(++_0x4b3c25);}(_0x9674,0x1cd));var _0x4967=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0x9674[_0x46428c];return _0x16a677;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4967('0x0'));var timeout=require(_0x4967('0x1'));var express=require(_0x4967('0x2'));var router=express[_0x4967('0x3')]();var fs_extra=require(_0x4967('0x4'));var auth=require(_0x4967('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4967('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4967('0x7')]);router[_0x4967('0x8')](_0x4967('0x9'),auth[_0x4967('0xa')](),controller[_0x4967('0xb')]);router['get'](_0x4967('0xc'),auth[_0x4967('0xa')](),controller[_0x4967('0xd')]);router[_0x4967('0x8')](_0x4967('0xe'),auth[_0x4967('0xa')](),controller['getSubjects']);router['get'](_0x4967('0xf'),auth[_0x4967('0xa')](),controller['getDescriptions']);router[_0x4967('0x8')](_0x4967('0x10'),auth[_0x4967('0xa')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x4967('0x11')]);router['post'](_0x4967('0x10'),auth[_0x4967('0xa')](),controller[_0x4967('0x12')]);router[_0x4967('0x13')]('/:id',auth[_0x4967('0xa')](),controller['update']);router[_0x4967('0x14')](_0x4967('0x9'),auth[_0x4967('0xa')](),controller[_0x4967('0x15')]);module[_0x4967('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 6e74371..6008ebb 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 _0xb3cf=['STRING','exports'];(function(_0x5ccf64,_0x34e890){var _0x4eb91a=function(_0x45404d){while(--_0x45404d){_0x5ccf64['push'](_0x5ccf64['shift']());}};_0x4eb91a(++_0x34e890);}(_0xb3cf,0x1ed));var _0xfb3c=function(_0x2e5cc1,_0x2dc83b){_0x2e5cc1=_0x2e5cc1-0x0;var _0x17d36b=_0xb3cf[_0x2e5cc1];return _0x17d36b;};'use strict';var Sequelize=require('sequelize');module[_0xfb3c('0x0')]={'name':{'type':Sequelize[_0xfb3c('0x1')]},'description':{'type':Sequelize[_0xfb3c('0x1')]}}; \ No newline at end of file +var _0xb65f=['sequelize','exports','STRING'];(function(_0x2a3e73,_0x4026e9){var _0x556db6=function(_0x26c108){while(--_0x26c108){_0x2a3e73['push'](_0x2a3e73['shift']());}};_0x556db6(++_0x4026e9);}(_0xb65f,0x144));var _0xfb65=function(_0x50451e,_0x124670){_0x50451e=_0x50451e-0x0;var _0x30524d=_0xb65f[_0x50451e];return _0x30524d;};'use strict';var Sequelize=require(_0xfb65('0x0'));module[_0xfb65('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfb65('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index a5c8d69..a6a1417 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 _0x58e4=['name','send','index','map','fieldName','type','key','keys','filters','intersection','model','attributes','fields','length','query','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','rows','catch','params','find','create','body','getFields','findOne','FreshdeskField','rawAttributes','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','json','apply','reject','save','update','then','destroy','error','stack'];(function(_0x3a7298,_0x27058){var _0x2504e8=function(_0x1932ec){while(--_0x1932ec){_0x3a7298['push'](_0x3a7298['shift']());}};_0x2504e8(++_0x27058);}(_0x58e4,0x128));var _0x458e=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x58e4[_0x12b8ec];return _0x21af77;};'use strict';var emlformat=require(_0x458e('0x0'));var rimraf=require(_0x458e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x458e('0x2'));var rp=require(_0x458e('0x3'));var moment=require('moment');var BPromise=require(_0x458e('0x4'));var Mustache=require('mustache');var util=require(_0x458e('0x5'));var path=require(_0x458e('0x6'));var sox=require('sox');var csv=require(_0x458e('0x7'));var ejs=require(_0x458e('0x8'));var fs=require('fs');var fs_extra=require(_0x458e('0x9'));var _=require(_0x458e('0xa'));var squel=require(_0x458e('0xb'));var crypto=require('crypto');var jsforce=require(_0x458e('0xc'));var deskjs=require(_0x458e('0xd'));var toCsv=require(_0x458e('0x7'));var querystring=require(_0x458e('0xe'));var Papa=require('papaparse');var Redis=require(_0x458e('0xf'));var authService=require(_0x458e('0x10'));var qs=require(_0x458e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x458e('0x12'));var logger=require('../../config/logger')(_0x458e('0x13'));var utils=require('../../config/utils');var config=require(_0x458e('0x14'));var licenseUtil=require(_0x458e('0x15'));var db=require(_0x458e('0x16'))['db'];function respondWithStatusCode(_0x228f8c,_0x3d0071){_0x3d0071=_0x3d0071||0xcc;return function(_0x122011){if(_0x122011){return _0x228f8c[_0x458e('0x17')](_0x3d0071);}return _0x228f8c['status'](_0x3d0071)[_0x458e('0x18')]();};}function respondWithResult(_0x10f7bf,_0x3d7d19){_0x3d7d19=_0x3d7d19||0xc8;return function(_0x4f1b06){if(_0x4f1b06){return _0x10f7bf['status'](_0x3d7d19)['json'](_0x4f1b06);}};}function respondWithFilteredResult(_0x42ce68,_0x534a1f){return function(_0x4c5330){if(_0x4c5330){var _0x571357=typeof _0x534a1f['offset']===_0x458e('0x19')&&typeof _0x534a1f[_0x458e('0x1a')]===_0x458e('0x19');var _0x13ba00=_0x4c5330[_0x458e('0x1b')];var _0x444593=_0x571357?0x0:_0x534a1f['offset'];var _0x2d407d=_0x571357?_0x4c5330[_0x458e('0x1b')]:_0x534a1f[_0x458e('0x1c')]+_0x534a1f[_0x458e('0x1a')];var _0x2447c7;if(_0x2d407d>=_0x13ba00){_0x2d407d=_0x13ba00;_0x2447c7=0xc8;}else{_0x2447c7=0xce;}_0x42ce68[_0x458e('0x1d')](_0x2447c7);return _0x42ce68[_0x458e('0x1e')]('Content-Range',_0x444593+'-'+_0x2d407d+'/'+_0x13ba00)[_0x458e('0x1f')](_0x4c5330);}return null;};}function patchUpdates(_0x2f8b3e){return function(_0x1a8e68){try{jsonpatch[_0x458e('0x20')](_0x1a8e68,_0x2f8b3e,!![]);}catch(_0x43893e){return BPromise[_0x458e('0x21')](_0x43893e);}return _0x1a8e68[_0x458e('0x22')]();};}function saveUpdates(_0xe91672,_0x1ae495){return function(_0x5b062c){if(_0x5b062c){return _0x5b062c[_0x458e('0x23')](_0xe91672)[_0x458e('0x24')](function(_0x22bbed){return _0x22bbed;});}return null;};}function removeEntity(_0x9586e0,_0x442420){return function(_0x16b996){if(_0x16b996){return _0x16b996[_0x458e('0x25')]()[_0x458e('0x24')](function(){_0x9586e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbaf4df,_0x451ec5){return function(_0x245416){if(!_0x245416){_0xbaf4df[_0x458e('0x17')](0x194);}return _0x245416;};}function handleError(_0x2ae330,_0x47093d){_0x47093d=_0x47093d||0x1f4;return function(_0x30923c){logger[_0x458e('0x26')](_0x30923c[_0x458e('0x27')]);if(_0x30923c[_0x458e('0x28')]){delete _0x30923c['name'];}_0x2ae330[_0x458e('0x1d')](_0x47093d)[_0x458e('0x29')](_0x30923c);};}exports[_0x458e('0x2a')]=function(_0x17a123,_0x34cd76){var _0x3afb3a={},_0x3cea37={},_0x548403={'count':0x0,'rows':[]};var _0x53cc1f=_[_0x458e('0x2b')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x2b34a7){return{'name':_0x2b34a7[_0x458e('0x2c')],'type':_0x2b34a7[_0x458e('0x2d')][_0x458e('0x2e')]};});_0x3cea37['model']=_[_0x458e('0x2b')](_0x53cc1f,_0x458e('0x28'));_0x3cea37['query']=_[_0x458e('0x2f')](_0x17a123['query']);_0x3cea37[_0x458e('0x30')]=_[_0x458e('0x31')](_0x3cea37[_0x458e('0x32')],_0x3cea37['query']);_0x3afb3a[_0x458e('0x33')]=_[_0x458e('0x31')](_0x3cea37[_0x458e('0x32')],qs['fields'](_0x17a123['query'][_0x458e('0x34')]));_0x3afb3a['attributes']=_0x3afb3a[_0x458e('0x33')][_0x458e('0x35')]?_0x3afb3a[_0x458e('0x33')]:_0x3cea37[_0x458e('0x32')];if(!_0x17a123[_0x458e('0x36')][_0x458e('0x37')]('nolimit')){_0x3afb3a[_0x458e('0x1a')]=qs[_0x458e('0x1a')](_0x17a123['query']['limit']);_0x3afb3a[_0x458e('0x1c')]=qs[_0x458e('0x1c')](_0x17a123[_0x458e('0x36')][_0x458e('0x1c')]);}_0x3afb3a[_0x458e('0x38')]=qs[_0x458e('0x39')](_0x17a123[_0x458e('0x36')]['sort']);_0x3afb3a[_0x458e('0x3a')]=qs['filters'](_[_0x458e('0x3b')](_0x17a123[_0x458e('0x36')],_0x3cea37[_0x458e('0x30')]),_0x53cc1f);if(_0x17a123[_0x458e('0x36')][_0x458e('0x3c')]){_0x3afb3a['where']=_[_0x458e('0x3d')](_0x3afb3a[_0x458e('0x3a')],{'$or':_[_0x458e('0x2b')](_0x53cc1f,function(_0x3969d2){if(_0x3969d2[_0x458e('0x2d')]!==_0x458e('0x3e')){var _0x1edc8f={};_0x1edc8f[_0x3969d2[_0x458e('0x28')]]={'$like':'%'+_0x17a123[_0x458e('0x36')][_0x458e('0x3c')]+'%'};return _0x1edc8f;}})});}_0x3afb3a=_[_0x458e('0x3d')]({},_0x3afb3a,_0x17a123[_0x458e('0x3f')]);var _0x3db191={'where':_0x3afb3a[_0x458e('0x3a')]};return db[_0x458e('0x40')][_0x458e('0x1b')](_0x3db191)[_0x458e('0x24')](function(_0x57a65e){_0x548403[_0x458e('0x1b')]=_0x57a65e;if(_0x17a123['query'][_0x458e('0x41')]){_0x3afb3a[_0x458e('0x42')]=[{'all':!![]}];}return db[_0x458e('0x40')]['findAll'](_0x3afb3a);})[_0x458e('0x24')](function(_0x68158e){_0x548403[_0x458e('0x43')]=_0x68158e;return _0x548403;})[_0x458e('0x24')](respondWithFilteredResult(_0x34cd76,_0x3afb3a))[_0x458e('0x44')](handleError(_0x34cd76,null));};exports['show']=function(_0x288b77,_0x40c61d){var _0x541e7b={'raw':![],'where':{'id':_0x288b77[_0x458e('0x45')]['id']}},_0x364e28={};_0x364e28['model']=_[_0x458e('0x2f')](db[_0x458e('0x40')]['rawAttributes']);_0x364e28[_0x458e('0x36')]=_['keys'](_0x288b77['query']);_0x364e28[_0x458e('0x30')]=_[_0x458e('0x31')](_0x364e28[_0x458e('0x32')],_0x364e28[_0x458e('0x36')]);_0x541e7b['attributes']=_[_0x458e('0x31')](_0x364e28[_0x458e('0x32')],qs[_0x458e('0x34')](_0x288b77[_0x458e('0x36')][_0x458e('0x34')]));_0x541e7b[_0x458e('0x33')]=_0x541e7b[_0x458e('0x33')][_0x458e('0x35')]?_0x541e7b[_0x458e('0x33')]:_0x364e28[_0x458e('0x32')];if(_0x288b77[_0x458e('0x36')]['includeAll']){_0x541e7b['include']=[{'all':!![]}];}_0x541e7b=_[_0x458e('0x3d')]({},_0x541e7b,_0x288b77[_0x458e('0x3f')]);return db['FreshdeskConfiguration'][_0x458e('0x46')](_0x541e7b)[_0x458e('0x24')](handleEntityNotFound(_0x40c61d,null))[_0x458e('0x24')](respondWithResult(_0x40c61d,null))['catch'](handleError(_0x40c61d,null));};exports[_0x458e('0x47')]=function(_0x432495,_0x176a60){return db[_0x458e('0x40')][_0x458e('0x47')](_0x432495[_0x458e('0x48')],{})[_0x458e('0x24')](respondWithResult(_0x176a60,0xc9))[_0x458e('0x44')](handleError(_0x176a60,null));};exports[_0x458e('0x23')]=function(_0x5b485c,_0x3d8062){if(_0x5b485c[_0x458e('0x48')]['id']){delete _0x5b485c[_0x458e('0x48')]['id'];}return db['FreshdeskConfiguration'][_0x458e('0x46')]({'where':{'id':_0x5b485c['params']['id']}})[_0x458e('0x24')](handleEntityNotFound(_0x3d8062,null))['then'](saveUpdates(_0x5b485c[_0x458e('0x48')],null))[_0x458e('0x24')](respondWithResult(_0x3d8062,null))[_0x458e('0x44')](handleError(_0x3d8062,null));};exports[_0x458e('0x25')]=function(_0x4836bd,_0x2b3092){return db['FreshdeskConfiguration'][_0x458e('0x46')]({'where':{'id':_0x4836bd[_0x458e('0x45')]['id']}})[_0x458e('0x24')](handleEntityNotFound(_0x2b3092,null))[_0x458e('0x24')](removeEntity(_0x2b3092,null))[_0x458e('0x44')](handleError(_0x2b3092,null));};exports[_0x458e('0x49')]=function(_0x5a52f8,_0x474cd9,_0x197c8c){var _0x4fda38={};var _0xda47c6={};var _0x118325;var _0x3502c8;return db[_0x458e('0x40')][_0x458e('0x4a')]({'where':{'id':_0x5a52f8[_0x458e('0x45')]['id']}})['then'](handleEntityNotFound(_0x474cd9,null))['then'](function(_0x1abb1e){if(_0x1abb1e){_0x118325=_0x1abb1e;_0xda47c6['model']=_[_0x458e('0x2f')](db[_0x458e('0x4b')][_0x458e('0x4c')]);_0xda47c6[_0x458e('0x36')]=_[_0x458e('0x2f')](_0x5a52f8['query']);_0xda47c6['filters']=_[_0x458e('0x31')](_0xda47c6[_0x458e('0x32')],_0xda47c6['query']);_0x4fda38[_0x458e('0x33')]=_['intersection'](_0xda47c6['model'],qs[_0x458e('0x34')](_0x5a52f8[_0x458e('0x36')]['fields']));_0x4fda38['attributes']=_0x4fda38[_0x458e('0x33')][_0x458e('0x35')]?_0x4fda38['attributes']:_0xda47c6[_0x458e('0x32')];_0x4fda38[_0x458e('0x38')]=qs[_0x458e('0x39')](_0x5a52f8[_0x458e('0x36')][_0x458e('0x39')]);_0x4fda38[_0x458e('0x3a')]=qs[_0x458e('0x30')](_['pick'](_0x5a52f8['query'],_0xda47c6[_0x458e('0x30')]));if(_0x5a52f8[_0x458e('0x36')][_0x458e('0x3c')]){_0x4fda38[_0x458e('0x3a')]=_[_0x458e('0x3d')](_0x4fda38[_0x458e('0x3a')],{'$or':_['map'](_0x4fda38[_0x458e('0x33')],function(_0x4f3802){var _0xdf152a={};_0xdf152a[_0x4f3802]={'$like':'%'+_0x5a52f8[_0x458e('0x36')]['filter']+'%'};return _0xdf152a;})});}_0x4fda38=_[_0x458e('0x3d')]({},_0x4fda38,_0x5a52f8[_0x458e('0x3f')]);return _0x118325[_0x458e('0x49')](_0x4fda38);}})['then'](function(_0x1fa452){if(_0x1fa452){_0x3502c8=_0x1fa452[_0x458e('0x35')];if(!_0x5a52f8['query'][_0x458e('0x37')](_0x458e('0x4d'))){_0x4fda38[_0x458e('0x1a')]=qs[_0x458e('0x1a')](_0x5a52f8[_0x458e('0x36')][_0x458e('0x1a')]);_0x4fda38[_0x458e('0x1c')]=qs[_0x458e('0x1c')](_0x5a52f8[_0x458e('0x36')][_0x458e('0x1c')]);}return _0x118325[_0x458e('0x49')](_0x4fda38);}})[_0x458e('0x24')](function(_0x11509a){if(_0x11509a){return _0x11509a?{'count':_0x3502c8,'rows':_0x11509a}:null;}})[_0x458e('0x24')](respondWithResult(_0x474cd9,null))[_0x458e('0x44')](handleError(_0x474cd9,null));};exports[_0x458e('0x4e')]=function(_0x4e6615,_0x4d21dc,_0x21c325){var _0x1b6e63={};var _0xb959a3={};var _0x247cc4;var _0x147094;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4e6615[_0x458e('0x45')]['id']}})[_0x458e('0x24')](handleEntityNotFound(_0x4d21dc,null))[_0x458e('0x24')](function(_0x5477ee){if(_0x5477ee){_0x247cc4=_0x5477ee;_0xb959a3[_0x458e('0x32')]=_[_0x458e('0x2f')](db[_0x458e('0x4b')][_0x458e('0x4c')]);_0xb959a3[_0x458e('0x36')]=_['keys'](_0x4e6615[_0x458e('0x36')]);_0xb959a3[_0x458e('0x30')]=_[_0x458e('0x31')](_0xb959a3[_0x458e('0x32')],_0xb959a3[_0x458e('0x36')]);_0x1b6e63[_0x458e('0x33')]=_[_0x458e('0x31')](_0xb959a3[_0x458e('0x32')],qs[_0x458e('0x34')](_0x4e6615[_0x458e('0x36')]['fields']));_0x1b6e63['attributes']=_0x1b6e63[_0x458e('0x33')][_0x458e('0x35')]?_0x1b6e63[_0x458e('0x33')]:_0xb959a3[_0x458e('0x32')];_0x1b6e63[_0x458e('0x38')]=qs['sort'](_0x4e6615[_0x458e('0x36')][_0x458e('0x39')]);_0x1b6e63['where']=qs[_0x458e('0x30')](_[_0x458e('0x3b')](_0x4e6615['query'],_0xb959a3['filters']));if(_0x4e6615[_0x458e('0x36')]['filter']){_0x1b6e63[_0x458e('0x3a')]=_[_0x458e('0x3d')](_0x1b6e63[_0x458e('0x3a')],{'$or':_['map'](_0x1b6e63[_0x458e('0x33')],function(_0x24e27d){var _0x32d6e0={};_0x32d6e0[_0x24e27d]={'$like':'%'+_0x4e6615[_0x458e('0x36')]['filter']+'%'};return _0x32d6e0;})});}_0x1b6e63=_[_0x458e('0x3d')]({},_0x1b6e63,_0x4e6615[_0x458e('0x3f')]);return _0x247cc4[_0x458e('0x4e')](_0x1b6e63);}})[_0x458e('0x24')](function(_0x5da54c){if(_0x5da54c){_0x147094=_0x5da54c['length'];if(!_0x4e6615[_0x458e('0x36')][_0x458e('0x37')](_0x458e('0x4d'))){_0x1b6e63[_0x458e('0x1a')]=qs[_0x458e('0x1a')](_0x4e6615[_0x458e('0x36')]['limit']);_0x1b6e63[_0x458e('0x1c')]=qs[_0x458e('0x1c')](_0x4e6615[_0x458e('0x36')][_0x458e('0x1c')]);}return _0x247cc4[_0x458e('0x4e')](_0x1b6e63);}})[_0x458e('0x24')](function(_0x3ac60c){if(_0x3ac60c){return _0x3ac60c?{'count':_0x147094,'rows':_0x3ac60c}:null;}})['then'](respondWithResult(_0x4d21dc,null))['catch'](handleError(_0x4d21dc,null));};exports[_0x458e('0x4f')]=function(_0x59e550,_0x440dbe,_0x25b26c){var _0x50aeb5={};var _0x16684c={};var _0x2114f4;var _0x1bdc11;return db[_0x458e('0x40')]['findOne']({'where':{'id':_0x59e550[_0x458e('0x45')]['id']}})['then'](handleEntityNotFound(_0x440dbe,null))[_0x458e('0x24')](function(_0x2bdafd){if(_0x2bdafd){_0x2114f4=_0x2bdafd;_0x16684c['model']=_[_0x458e('0x2f')](db[_0x458e('0x4b')][_0x458e('0x4c')]);_0x16684c[_0x458e('0x36')]=_[_0x458e('0x2f')](_0x59e550['query']);_0x16684c[_0x458e('0x30')]=_['intersection'](_0x16684c['model'],_0x16684c['query']);_0x50aeb5[_0x458e('0x33')]=_[_0x458e('0x31')](_0x16684c['model'],qs[_0x458e('0x34')](_0x59e550['query'][_0x458e('0x34')]));_0x50aeb5[_0x458e('0x33')]=_0x50aeb5[_0x458e('0x33')][_0x458e('0x35')]?_0x50aeb5[_0x458e('0x33')]:_0x16684c[_0x458e('0x32')];_0x50aeb5[_0x458e('0x38')]=qs[_0x458e('0x39')](_0x59e550[_0x458e('0x36')][_0x458e('0x39')]);_0x50aeb5['where']=qs['filters'](_[_0x458e('0x3b')](_0x59e550[_0x458e('0x36')],_0x16684c['filters']));if(_0x59e550['query']['filter']){_0x50aeb5[_0x458e('0x3a')]=_[_0x458e('0x3d')](_0x50aeb5[_0x458e('0x3a')],{'$or':_[_0x458e('0x2b')](_0x50aeb5['attributes'],function(_0xe89dd1){var _0x4b7a63={};_0x4b7a63[_0xe89dd1]={'$like':'%'+_0x59e550['query']['filter']+'%'};return _0x4b7a63;})});}_0x50aeb5=_[_0x458e('0x3d')]({},_0x50aeb5,_0x59e550['options']);return _0x2114f4['getDescriptions'](_0x50aeb5);}})[_0x458e('0x24')](function(_0x339b3e){if(_0x339b3e){_0x1bdc11=_0x339b3e[_0x458e('0x35')];if(!_0x59e550[_0x458e('0x36')][_0x458e('0x37')](_0x458e('0x4d'))){_0x50aeb5[_0x458e('0x1a')]=qs['limit'](_0x59e550['query']['limit']);_0x50aeb5[_0x458e('0x1c')]=qs[_0x458e('0x1c')](_0x59e550['query']['offset']);}return _0x2114f4['getDescriptions'](_0x50aeb5);}})[_0x458e('0x24')](function(_0x22a2f9){if(_0x22a2f9){return _0x22a2f9?{'count':_0x1bdc11,'rows':_0x22a2f9}:null;}})['then'](respondWithResult(_0x440dbe,null))[_0x458e('0x44')](handleError(_0x440dbe,null));};exports[_0x458e('0x50')]=function(_0x1217bb,_0x2fa34c,_0x32f552){var _0x1818a1={};var _0x47a1ab={};var _0x25e884;var _0x106a1c;return db[_0x458e('0x40')]['findOne']({'where':{'id':_0x1217bb[_0x458e('0x45')]['id']}})['then'](handleEntityNotFound(_0x2fa34c,null))[_0x458e('0x24')](function(_0xc67825){if(_0xc67825){_0x25e884=_0xc67825;_0x47a1ab[_0x458e('0x32')]=_[_0x458e('0x2f')](db[_0x458e('0x51')][_0x458e('0x4c')]);_0x47a1ab['query']=_['keys'](_0x1217bb[_0x458e('0x36')]);_0x47a1ab[_0x458e('0x30')]=_[_0x458e('0x31')](_0x47a1ab[_0x458e('0x32')],_0x47a1ab[_0x458e('0x36')]);_0x1818a1[_0x458e('0x33')]=_['intersection'](_0x47a1ab['model'],qs[_0x458e('0x34')](_0x1217bb[_0x458e('0x36')]['fields']));_0x1818a1[_0x458e('0x33')]=_0x1818a1[_0x458e('0x33')][_0x458e('0x35')]?_0x1818a1[_0x458e('0x33')]:_0x47a1ab[_0x458e('0x32')];_0x1818a1[_0x458e('0x38')]=qs[_0x458e('0x39')](_0x1217bb[_0x458e('0x36')][_0x458e('0x39')]);_0x1818a1[_0x458e('0x3a')]=qs[_0x458e('0x30')](_[_0x458e('0x3b')](_0x1217bb['query'],_0x47a1ab[_0x458e('0x30')]));if(_0x1217bb[_0x458e('0x36')]['filter']){_0x1818a1['where']=_[_0x458e('0x3d')](_0x1818a1['where'],{'$or':_[_0x458e('0x2b')](_0x1818a1['attributes'],function(_0x3e4ce6){var _0x14cf8f={};_0x14cf8f[_0x3e4ce6]={'$like':'%'+_0x1217bb['query'][_0x458e('0x3c')]+'%'};return _0x14cf8f;})});}_0x1818a1=_[_0x458e('0x3d')]({},_0x1818a1,_0x1217bb['options']);return _0x25e884['getTags'](_0x1818a1);}})[_0x458e('0x24')](function(_0x468bf2){if(_0x468bf2){_0x106a1c=_0x468bf2[_0x458e('0x35')];if(!_0x1217bb[_0x458e('0x36')]['hasOwnProperty'](_0x458e('0x4d'))){_0x1818a1[_0x458e('0x1a')]=qs[_0x458e('0x1a')](_0x1217bb[_0x458e('0x36')]['limit']);_0x1818a1['offset']=qs[_0x458e('0x1c')](_0x1217bb['query'][_0x458e('0x1c')]);}return _0x25e884[_0x458e('0x50')](_0x1818a1);}})['then'](function(_0x5231e4){if(_0x5231e4){return _0x5231e4?{'count':_0x106a1c,'rows':_0x5231e4}:null;}})[_0x458e('0x24')](respondWithResult(_0x2fa34c,null))[_0x458e('0x44')](handleError(_0x2fa34c,null));};exports[_0x458e('0x52')]=function(_0x283451,_0x3c0eaa,_0x23514a){if(_0x283451[_0x458e('0x48')]['id']){delete _0x283451[_0x458e('0x48')]['id'];}return db[_0x458e('0x40')][_0x458e('0x4a')]({'where':{'id':_0x283451[_0x458e('0x45')]['id']}})[_0x458e('0x24')](handleEntityNotFound(_0x3c0eaa,null))[_0x458e('0x24')](function(_0x56e98d){if(_0x56e98d){return _0x56e98d[_0x458e('0x52')](_0x283451['body'][_0x458e('0x53')]||[]);}return null;})[_0x458e('0x24')](respondWithResult(_0x3c0eaa,null))['catch'](handleError(_0x3c0eaa,null));}; \ No newline at end of file +var _0xb67c=['stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskConfiguration','include','findAll','catch','show','params','rawAttributes','includeAll','find','body','getFields','findOne','FreshdeskField','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error'];(function(_0x27b5ff,_0x29aa9b){var _0x345932=function(_0x410d68){while(--_0x410d68){_0x27b5ff['push'](_0x27b5ff['shift']());}};_0x345932(++_0x29aa9b);}(_0xb67c,0x129));var _0xcb67=function(_0x461930,_0x329a2a){_0x461930=_0x461930-0x0;var _0x382394=_0xb67c[_0x461930];return _0x382394;};'use strict';var emlformat=require(_0xcb67('0x0'));var rimraf=require(_0xcb67('0x1'));var zipdir=require(_0xcb67('0x2'));var jsonpatch=require(_0xcb67('0x3'));var rp=require('request-promise');var moment=require(_0xcb67('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcb67('0x5'));var util=require(_0xcb67('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xcb67('0x7'));var ejs=require(_0xcb67('0x8'));var fs=require('fs');var fs_extra=require(_0xcb67('0x9'));var _=require(_0xcb67('0xa'));var squel=require(_0xcb67('0xb'));var crypto=require(_0xcb67('0xc'));var jsforce=require(_0xcb67('0xd'));var deskjs=require(_0xcb67('0xe'));var toCsv=require(_0xcb67('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcb67('0xf'));var authService=require(_0xcb67('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcb67('0x11'));var hardwareService=require(_0xcb67('0x12'));var logger=require(_0xcb67('0x13'))(_0xcb67('0x14'));var utils=require(_0xcb67('0x15'));var config=require(_0xcb67('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb67('0x17'))['db'];function respondWithStatusCode(_0x405bd7,_0x2a90c0){_0x2a90c0=_0x2a90c0||0xcc;return function(_0x196782){if(_0x196782){return _0x405bd7[_0xcb67('0x18')](_0x2a90c0);}return _0x405bd7[_0xcb67('0x19')](_0x2a90c0)[_0xcb67('0x1a')]();};}function respondWithResult(_0x577c05,_0x20e229){_0x20e229=_0x20e229||0xc8;return function(_0x20be06){if(_0x20be06){return _0x577c05[_0xcb67('0x19')](_0x20e229)[_0xcb67('0x1b')](_0x20be06);}};}function respondWithFilteredResult(_0x3f2712,_0x28a82d){return function(_0x414bb6){if(_0x414bb6){var _0x19f6f3=typeof _0x28a82d[_0xcb67('0x1c')]===_0xcb67('0x1d')&&typeof _0x28a82d[_0xcb67('0x1e')]===_0xcb67('0x1d');var _0xe240a0=_0x414bb6[_0xcb67('0x1f')];var _0x2d05e6=_0x19f6f3?0x0:_0x28a82d[_0xcb67('0x1c')];var _0x2e57ff=_0x19f6f3?_0x414bb6['count']:_0x28a82d[_0xcb67('0x1c')]+_0x28a82d[_0xcb67('0x1e')];var _0x213952;if(_0x2e57ff>=_0xe240a0){_0x2e57ff=_0xe240a0;_0x213952=0xc8;}else{_0x213952=0xce;}_0x3f2712[_0xcb67('0x19')](_0x213952);return _0x3f2712['set'](_0xcb67('0x20'),_0x2d05e6+'-'+_0x2e57ff+'/'+_0xe240a0)[_0xcb67('0x1b')](_0x414bb6);}return null;};}function patchUpdates(_0x512e7c){return function(_0x3f1221){try{jsonpatch[_0xcb67('0x21')](_0x3f1221,_0x512e7c,!![]);}catch(_0x1e67cd){return BPromise['reject'](_0x1e67cd);}return _0x3f1221[_0xcb67('0x22')]();};}function saveUpdates(_0x2f6f11,_0x766f3d){return function(_0x3a4f40){if(_0x3a4f40){return _0x3a4f40[_0xcb67('0x23')](_0x2f6f11)[_0xcb67('0x24')](function(_0x227ac6){return _0x227ac6;});}return null;};}function removeEntity(_0x28757d,_0x49b0c3){return function(_0xb1ab54){if(_0xb1ab54){return _0xb1ab54[_0xcb67('0x25')]()[_0xcb67('0x24')](function(){_0x28757d[_0xcb67('0x19')](0xcc)[_0xcb67('0x1a')]();});}};}function handleEntityNotFound(_0x523ed2,_0x1c08c8){return function(_0x444041){if(!_0x444041){_0x523ed2[_0xcb67('0x18')](0x194);}return _0x444041;};}function handleError(_0x3dc5b8,_0x272309){_0x272309=_0x272309||0x1f4;return function(_0x5f0762){logger[_0xcb67('0x26')](_0x5f0762[_0xcb67('0x27')]);if(_0x5f0762[_0xcb67('0x28')]){delete _0x5f0762[_0xcb67('0x28')];}_0x3dc5b8[_0xcb67('0x19')](_0x272309)[_0xcb67('0x29')](_0x5f0762);};}exports[_0xcb67('0x2a')]=function(_0x2fce3d,_0xe45b0c){var _0x3ade52={},_0x520a44={},_0x37e2e8={'count':0x0,'rows':[]};var _0x71f57f=_[_0xcb67('0x2b')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x1b635a){return{'name':_0x1b635a[_0xcb67('0x2c')],'type':_0x1b635a[_0xcb67('0x2d')][_0xcb67('0x2e')]};});_0x520a44[_0xcb67('0x2f')]=_[_0xcb67('0x2b')](_0x71f57f,_0xcb67('0x28'));_0x520a44[_0xcb67('0x30')]=_[_0xcb67('0x31')](_0x2fce3d[_0xcb67('0x30')]);_0x520a44[_0xcb67('0x32')]=_[_0xcb67('0x33')](_0x520a44[_0xcb67('0x2f')],_0x520a44[_0xcb67('0x30')]);_0x3ade52[_0xcb67('0x34')]=_['intersection'](_0x520a44['model'],qs[_0xcb67('0x35')](_0x2fce3d[_0xcb67('0x30')][_0xcb67('0x35')]));_0x3ade52[_0xcb67('0x34')]=_0x3ade52[_0xcb67('0x34')][_0xcb67('0x36')]?_0x3ade52[_0xcb67('0x34')]:_0x520a44[_0xcb67('0x2f')];if(!_0x2fce3d[_0xcb67('0x30')]['hasOwnProperty'](_0xcb67('0x37'))){_0x3ade52[_0xcb67('0x1e')]=qs[_0xcb67('0x1e')](_0x2fce3d[_0xcb67('0x30')]['limit']);_0x3ade52[_0xcb67('0x1c')]=qs[_0xcb67('0x1c')](_0x2fce3d['query']['offset']);}_0x3ade52[_0xcb67('0x38')]=qs[_0xcb67('0x39')](_0x2fce3d[_0xcb67('0x30')]['sort']);_0x3ade52[_0xcb67('0x3a')]=qs[_0xcb67('0x32')](_[_0xcb67('0x3b')](_0x2fce3d['query'],_0x520a44[_0xcb67('0x32')]),_0x71f57f);if(_0x2fce3d[_0xcb67('0x30')][_0xcb67('0x3c')]){_0x3ade52[_0xcb67('0x3a')]=_[_0xcb67('0x3d')](_0x3ade52[_0xcb67('0x3a')],{'$or':_[_0xcb67('0x2b')](_0x71f57f,function(_0x2c0e39){if(_0x2c0e39[_0xcb67('0x2d')]!==_0xcb67('0x3e')){var _0x4b059e={};_0x4b059e[_0x2c0e39[_0xcb67('0x28')]]={'$like':'%'+_0x2fce3d[_0xcb67('0x30')][_0xcb67('0x3c')]+'%'};return _0x4b059e;}})});}_0x3ade52=_[_0xcb67('0x3d')]({},_0x3ade52,_0x2fce3d[_0xcb67('0x3f')]);var _0x2f4e59={'where':_0x3ade52[_0xcb67('0x3a')]};return db[_0xcb67('0x40')][_0xcb67('0x1f')](_0x2f4e59)[_0xcb67('0x24')](function(_0x34142a){_0x37e2e8[_0xcb67('0x1f')]=_0x34142a;if(_0x2fce3d[_0xcb67('0x30')]['includeAll']){_0x3ade52[_0xcb67('0x41')]=[{'all':!![]}];}return db[_0xcb67('0x40')][_0xcb67('0x42')](_0x3ade52);})['then'](function(_0x540a1d){_0x37e2e8['rows']=_0x540a1d;return _0x37e2e8;})['then'](respondWithFilteredResult(_0xe45b0c,_0x3ade52))[_0xcb67('0x43')](handleError(_0xe45b0c,null));};exports[_0xcb67('0x44')]=function(_0x547175,_0xfda234){var _0x4b7a5e={'raw':![],'where':{'id':_0x547175[_0xcb67('0x45')]['id']}},_0x203150={};_0x203150[_0xcb67('0x2f')]=_[_0xcb67('0x31')](db[_0xcb67('0x40')][_0xcb67('0x46')]);_0x203150[_0xcb67('0x30')]=_['keys'](_0x547175['query']);_0x203150['filters']=_[_0xcb67('0x33')](_0x203150[_0xcb67('0x2f')],_0x203150['query']);_0x4b7a5e[_0xcb67('0x34')]=_[_0xcb67('0x33')](_0x203150[_0xcb67('0x2f')],qs['fields'](_0x547175[_0xcb67('0x30')]['fields']));_0x4b7a5e[_0xcb67('0x34')]=_0x4b7a5e[_0xcb67('0x34')][_0xcb67('0x36')]?_0x4b7a5e[_0xcb67('0x34')]:_0x203150[_0xcb67('0x2f')];if(_0x547175[_0xcb67('0x30')][_0xcb67('0x47')]){_0x4b7a5e[_0xcb67('0x41')]=[{'all':!![]}];}_0x4b7a5e=_[_0xcb67('0x3d')]({},_0x4b7a5e,_0x547175[_0xcb67('0x3f')]);return db[_0xcb67('0x40')][_0xcb67('0x48')](_0x4b7a5e)[_0xcb67('0x24')](handleEntityNotFound(_0xfda234,null))[_0xcb67('0x24')](respondWithResult(_0xfda234,null))['catch'](handleError(_0xfda234,null));};exports['create']=function(_0x493f31,_0x11f414){return db[_0xcb67('0x40')]['create'](_0x493f31[_0xcb67('0x49')],{})[_0xcb67('0x24')](respondWithResult(_0x11f414,0xc9))[_0xcb67('0x43')](handleError(_0x11f414,null));};exports['update']=function(_0xf35b78,_0x126c70){if(_0xf35b78[_0xcb67('0x49')]['id']){delete _0xf35b78['body']['id'];}return db[_0xcb67('0x40')][_0xcb67('0x48')]({'where':{'id':_0xf35b78['params']['id']}})[_0xcb67('0x24')](handleEntityNotFound(_0x126c70,null))[_0xcb67('0x24')](saveUpdates(_0xf35b78[_0xcb67('0x49')],null))[_0xcb67('0x24')](respondWithResult(_0x126c70,null))[_0xcb67('0x43')](handleError(_0x126c70,null));};exports[_0xcb67('0x25')]=function(_0x48095e,_0x182886){return db[_0xcb67('0x40')][_0xcb67('0x48')]({'where':{'id':_0x48095e['params']['id']}})['then'](handleEntityNotFound(_0x182886,null))[_0xcb67('0x24')](removeEntity(_0x182886,null))[_0xcb67('0x43')](handleError(_0x182886,null));};exports[_0xcb67('0x4a')]=function(_0x3d7597,_0x581ddb,_0x402b7f){var _0x132852={};var _0x20408a={};var _0x56835a;var _0x5aa64d;return db[_0xcb67('0x40')][_0xcb67('0x4b')]({'where':{'id':_0x3d7597[_0xcb67('0x45')]['id']}})[_0xcb67('0x24')](handleEntityNotFound(_0x581ddb,null))['then'](function(_0x17fee9){if(_0x17fee9){_0x56835a=_0x17fee9;_0x20408a['model']=_[_0xcb67('0x31')](db[_0xcb67('0x4c')][_0xcb67('0x46')]);_0x20408a['query']=_[_0xcb67('0x31')](_0x3d7597[_0xcb67('0x30')]);_0x20408a[_0xcb67('0x32')]=_[_0xcb67('0x33')](_0x20408a[_0xcb67('0x2f')],_0x20408a[_0xcb67('0x30')]);_0x132852['attributes']=_['intersection'](_0x20408a[_0xcb67('0x2f')],qs[_0xcb67('0x35')](_0x3d7597[_0xcb67('0x30')]['fields']));_0x132852[_0xcb67('0x34')]=_0x132852[_0xcb67('0x34')][_0xcb67('0x36')]?_0x132852[_0xcb67('0x34')]:_0x20408a[_0xcb67('0x2f')];_0x132852['order']=qs[_0xcb67('0x39')](_0x3d7597[_0xcb67('0x30')][_0xcb67('0x39')]);_0x132852[_0xcb67('0x3a')]=qs[_0xcb67('0x32')](_[_0xcb67('0x3b')](_0x3d7597[_0xcb67('0x30')],_0x20408a[_0xcb67('0x32')]));if(_0x3d7597[_0xcb67('0x30')][_0xcb67('0x3c')]){_0x132852[_0xcb67('0x3a')]=_[_0xcb67('0x3d')](_0x132852[_0xcb67('0x3a')],{'$or':_['map'](_0x132852[_0xcb67('0x34')],function(_0x3a12c2){var _0x19fed3={};_0x19fed3[_0x3a12c2]={'$like':'%'+_0x3d7597[_0xcb67('0x30')]['filter']+'%'};return _0x19fed3;})});}_0x132852=_[_0xcb67('0x3d')]({},_0x132852,_0x3d7597['options']);return _0x56835a['getFields'](_0x132852);}})[_0xcb67('0x24')](function(_0x581cfc){if(_0x581cfc){_0x5aa64d=_0x581cfc[_0xcb67('0x36')];if(!_0x3d7597[_0xcb67('0x30')]['hasOwnProperty']('nolimit')){_0x132852[_0xcb67('0x1e')]=qs[_0xcb67('0x1e')](_0x3d7597[_0xcb67('0x30')][_0xcb67('0x1e')]);_0x132852[_0xcb67('0x1c')]=qs[_0xcb67('0x1c')](_0x3d7597[_0xcb67('0x30')][_0xcb67('0x1c')]);}return _0x56835a[_0xcb67('0x4a')](_0x132852);}})['then'](function(_0x43aff4){if(_0x43aff4){return _0x43aff4?{'count':_0x5aa64d,'rows':_0x43aff4}:null;}})[_0xcb67('0x24')](respondWithResult(_0x581ddb,null))[_0xcb67('0x43')](handleError(_0x581ddb,null));};exports['getSubjects']=function(_0x3be738,_0x2ce35e,_0x3cc3f9){var _0x577ba6={};var _0x3284e1={};var _0x5aa358;var _0x4293d3;return db[_0xcb67('0x40')][_0xcb67('0x4b')]({'where':{'id':_0x3be738['params']['id']}})['then'](handleEntityNotFound(_0x2ce35e,null))['then'](function(_0x55b42e){if(_0x55b42e){_0x5aa358=_0x55b42e;_0x3284e1[_0xcb67('0x2f')]=_[_0xcb67('0x31')](db[_0xcb67('0x4c')][_0xcb67('0x46')]);_0x3284e1[_0xcb67('0x30')]=_[_0xcb67('0x31')](_0x3be738[_0xcb67('0x30')]);_0x3284e1[_0xcb67('0x32')]=_['intersection'](_0x3284e1['model'],_0x3284e1[_0xcb67('0x30')]);_0x577ba6['attributes']=_[_0xcb67('0x33')](_0x3284e1[_0xcb67('0x2f')],qs[_0xcb67('0x35')](_0x3be738[_0xcb67('0x30')]['fields']));_0x577ba6[_0xcb67('0x34')]=_0x577ba6[_0xcb67('0x34')]['length']?_0x577ba6['attributes']:_0x3284e1[_0xcb67('0x2f')];_0x577ba6[_0xcb67('0x38')]=qs[_0xcb67('0x39')](_0x3be738[_0xcb67('0x30')][_0xcb67('0x39')]);_0x577ba6[_0xcb67('0x3a')]=qs[_0xcb67('0x32')](_['pick'](_0x3be738[_0xcb67('0x30')],_0x3284e1[_0xcb67('0x32')]));if(_0x3be738[_0xcb67('0x30')][_0xcb67('0x3c')]){_0x577ba6['where']=_[_0xcb67('0x3d')](_0x577ba6[_0xcb67('0x3a')],{'$or':_[_0xcb67('0x2b')](_0x577ba6['attributes'],function(_0x4ca069){var _0x25367e={};_0x25367e[_0x4ca069]={'$like':'%'+_0x3be738[_0xcb67('0x30')]['filter']+'%'};return _0x25367e;})});}_0x577ba6=_['merge']({},_0x577ba6,_0x3be738['options']);return _0x5aa358[_0xcb67('0x4d')](_0x577ba6);}})[_0xcb67('0x24')](function(_0xedfd42){if(_0xedfd42){_0x4293d3=_0xedfd42['length'];if(!_0x3be738[_0xcb67('0x30')][_0xcb67('0x4e')](_0xcb67('0x37'))){_0x577ba6[_0xcb67('0x1e')]=qs[_0xcb67('0x1e')](_0x3be738['query'][_0xcb67('0x1e')]);_0x577ba6[_0xcb67('0x1c')]=qs[_0xcb67('0x1c')](_0x3be738[_0xcb67('0x30')]['offset']);}return _0x5aa358[_0xcb67('0x4d')](_0x577ba6);}})[_0xcb67('0x24')](function(_0x557ecb){if(_0x557ecb){return _0x557ecb?{'count':_0x4293d3,'rows':_0x557ecb}:null;}})['then'](respondWithResult(_0x2ce35e,null))[_0xcb67('0x43')](handleError(_0x2ce35e,null));};exports['getDescriptions']=function(_0x30928a,_0x18686b,_0x4689b0){var _0x4da8b5={};var _0x148393={};var _0x44eafb;var _0x58d949;return db[_0xcb67('0x40')][_0xcb67('0x4b')]({'where':{'id':_0x30928a[_0xcb67('0x45')]['id']}})[_0xcb67('0x24')](handleEntityNotFound(_0x18686b,null))['then'](function(_0x32b57e){if(_0x32b57e){_0x44eafb=_0x32b57e;_0x148393['model']=_['keys'](db[_0xcb67('0x4c')][_0xcb67('0x46')]);_0x148393[_0xcb67('0x30')]=_[_0xcb67('0x31')](_0x30928a[_0xcb67('0x30')]);_0x148393[_0xcb67('0x32')]=_[_0xcb67('0x33')](_0x148393[_0xcb67('0x2f')],_0x148393[_0xcb67('0x30')]);_0x4da8b5['attributes']=_[_0xcb67('0x33')](_0x148393[_0xcb67('0x2f')],qs['fields'](_0x30928a['query'][_0xcb67('0x35')]));_0x4da8b5[_0xcb67('0x34')]=_0x4da8b5['attributes'][_0xcb67('0x36')]?_0x4da8b5[_0xcb67('0x34')]:_0x148393['model'];_0x4da8b5[_0xcb67('0x38')]=qs[_0xcb67('0x39')](_0x30928a['query']['sort']);_0x4da8b5[_0xcb67('0x3a')]=qs[_0xcb67('0x32')](_['pick'](_0x30928a[_0xcb67('0x30')],_0x148393[_0xcb67('0x32')]));if(_0x30928a[_0xcb67('0x30')][_0xcb67('0x3c')]){_0x4da8b5[_0xcb67('0x3a')]=_[_0xcb67('0x3d')](_0x4da8b5[_0xcb67('0x3a')],{'$or':_['map'](_0x4da8b5[_0xcb67('0x34')],function(_0x58695f){var _0x1fcab0={};_0x1fcab0[_0x58695f]={'$like':'%'+_0x30928a['query']['filter']+'%'};return _0x1fcab0;})});}_0x4da8b5=_[_0xcb67('0x3d')]({},_0x4da8b5,_0x30928a['options']);return _0x44eafb['getDescriptions'](_0x4da8b5);}})[_0xcb67('0x24')](function(_0xd628ec){if(_0xd628ec){_0x58d949=_0xd628ec['length'];if(!_0x30928a[_0xcb67('0x30')][_0xcb67('0x4e')](_0xcb67('0x37'))){_0x4da8b5['limit']=qs[_0xcb67('0x1e')](_0x30928a[_0xcb67('0x30')][_0xcb67('0x1e')]);_0x4da8b5['offset']=qs[_0xcb67('0x1c')](_0x30928a[_0xcb67('0x30')][_0xcb67('0x1c')]);}return _0x44eafb[_0xcb67('0x4f')](_0x4da8b5);}})[_0xcb67('0x24')](function(_0x32d9a8){if(_0x32d9a8){return _0x32d9a8?{'count':_0x58d949,'rows':_0x32d9a8}:null;}})[_0xcb67('0x24')](respondWithResult(_0x18686b,null))['catch'](handleError(_0x18686b,null));};exports[_0xcb67('0x50')]=function(_0x5db25e,_0x162576,_0x3a7ada){var _0x2338da={};var _0x470d51={};var _0x1f32df;var _0xb4d786;return db['FreshdeskConfiguration'][_0xcb67('0x4b')]({'where':{'id':_0x5db25e['params']['id']}})['then'](handleEntityNotFound(_0x162576,null))[_0xcb67('0x24')](function(_0x69ad3f){if(_0x69ad3f){_0x1f32df=_0x69ad3f;_0x470d51[_0xcb67('0x2f')]=_[_0xcb67('0x31')](db[_0xcb67('0x51')][_0xcb67('0x46')]);_0x470d51['query']=_[_0xcb67('0x31')](_0x5db25e[_0xcb67('0x30')]);_0x470d51['filters']=_['intersection'](_0x470d51[_0xcb67('0x2f')],_0x470d51[_0xcb67('0x30')]);_0x2338da['attributes']=_[_0xcb67('0x33')](_0x470d51[_0xcb67('0x2f')],qs[_0xcb67('0x35')](_0x5db25e[_0xcb67('0x30')][_0xcb67('0x35')]));_0x2338da[_0xcb67('0x34')]=_0x2338da[_0xcb67('0x34')]['length']?_0x2338da[_0xcb67('0x34')]:_0x470d51[_0xcb67('0x2f')];_0x2338da[_0xcb67('0x38')]=qs[_0xcb67('0x39')](_0x5db25e['query']['sort']);_0x2338da['where']=qs[_0xcb67('0x32')](_['pick'](_0x5db25e[_0xcb67('0x30')],_0x470d51[_0xcb67('0x32')]));if(_0x5db25e['query']['filter']){_0x2338da['where']=_[_0xcb67('0x3d')](_0x2338da[_0xcb67('0x3a')],{'$or':_[_0xcb67('0x2b')](_0x2338da[_0xcb67('0x34')],function(_0x29da89){var _0x385b62={};_0x385b62[_0x29da89]={'$like':'%'+_0x5db25e[_0xcb67('0x30')][_0xcb67('0x3c')]+'%'};return _0x385b62;})});}_0x2338da=_[_0xcb67('0x3d')]({},_0x2338da,_0x5db25e[_0xcb67('0x3f')]);return _0x1f32df['getTags'](_0x2338da);}})[_0xcb67('0x24')](function(_0x34cc23){if(_0x34cc23){_0xb4d786=_0x34cc23['length'];if(!_0x5db25e[_0xcb67('0x30')][_0xcb67('0x4e')]('nolimit')){_0x2338da[_0xcb67('0x1e')]=qs[_0xcb67('0x1e')](_0x5db25e[_0xcb67('0x30')][_0xcb67('0x1e')]);_0x2338da[_0xcb67('0x1c')]=qs[_0xcb67('0x1c')](_0x5db25e['query'][_0xcb67('0x1c')]);}return _0x1f32df[_0xcb67('0x50')](_0x2338da);}})[_0xcb67('0x24')](function(_0x3affe9){if(_0x3affe9){return _0x3affe9?{'count':_0xb4d786,'rows':_0x3affe9}:null;}})[_0xcb67('0x24')](respondWithResult(_0x162576,null))[_0xcb67('0x43')](handleError(_0x162576,null));};exports[_0xcb67('0x52')]=function(_0x352500,_0x5c48cd,_0x2148b4){if(_0x352500[_0xcb67('0x49')]['id']){delete _0x352500[_0xcb67('0x49')]['id'];}return db[_0xcb67('0x40')][_0xcb67('0x4b')]({'where':{'id':_0x352500[_0xcb67('0x45')]['id']}})[_0xcb67('0x24')](handleEntityNotFound(_0x5c48cd,null))[_0xcb67('0x24')](function(_0x52e586){if(_0x52e586){return _0x52e586[_0xcb67('0x52')](_0x352500['body'][_0xcb67('0x53')]||[]);}return null;})['then'](respondWithResult(_0x5c48cd,null))[_0xcb67('0x43')](handleError(_0x5c48cd,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index c731cf3..4e110b9 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 _0xa8ce=['../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8ce,0x171));var _0xea8c=function(_0x3cc916,_0x4b1a3c){_0x3cc916=_0x3cc916-0x0;var _0x21a1ee=_0xa8ce[_0x3cc916];return _0x21a1ee;};'use strict';var _=require(_0xea8c('0x0'));var util=require(_0xea8c('0x1'));var logger=require(_0xea8c('0x2'))(_0xea8c('0x3'));var moment=require(_0xea8c('0x4'));var BPromise=require('bluebird');var rp=require(_0xea8c('0x5'));var fs=require('fs');var path=require(_0xea8c('0x6'));var rimraf=require(_0xea8c('0x7'));var config=require(_0xea8c('0x8'));var attributes=require(_0xea8c('0x9'));module['exports']=function(_0x3c4bed,_0xcf1cf3){return _0x3c4bed[_0xea8c('0xa')](_0xea8c('0xb'),attributes,{'tableName':_0xea8c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4860=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x329a04,_0x2a3018){var _0x5b85e9=function(_0x32f30f){while(--_0x32f30f){_0x329a04['push'](_0x329a04['shift']());}};_0x5b85e9(++_0x2a3018);}(_0x4860,0x1c2));var _0x0486=function(_0x3d3eaf,_0x1de289){_0x3d3eaf=_0x3d3eaf-0x0;var _0x2278e0=_0x4860[_0x3d3eaf];return _0x2278e0;};'use strict';var _=require(_0x0486('0x0'));var util=require(_0x0486('0x1'));var logger=require(_0x0486('0x2'))(_0x0486('0x3'));var moment=require(_0x0486('0x4'));var BPromise=require('bluebird');var rp=require(_0x0486('0x5'));var fs=require('fs');var path=require(_0x0486('0x6'));var rimraf=require(_0x0486('0x7'));var config=require(_0x0486('0x8'));var attributes=require(_0x0486('0x9'));module[_0x0486('0xa')]=function(_0x3a1e1b,_0x564777){return _0x3a1e1b[_0x0486('0xb')](_0x0486('0xc'),attributes,{'tableName':_0x0486('0xd'),'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 d7660e4..00059b4 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 _0xd9c5=['request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x514530,_0x56ed87){var _0x5a2045=function(_0x2c359f){while(--_0x2c359f){_0x514530['push'](_0x514530['shift']());}};_0x5a2045(++_0x56ed87);}(_0xd9c5,0xf4));var _0x5d9c=function(_0x5e6d44,_0x21b4f1){_0x5e6d44=_0x5e6d44-0x0;var _0x32c80c=_0xd9c5[_0x5e6d44];return _0x32c80c;};'use strict';var _=require('lodash');var util=require(_0x5d9c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d9c('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d9c('0x2'));var logger=require('../../config/logger')(_0x5d9c('0x3'));var config=require(_0x5d9c('0x4'));var jayson=require(_0x5d9c('0x5'));var client=jayson[_0x5d9c('0x6')][_0x5d9c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1475c5,_0x2d573c,_0x5374f5){return new BPromise(function(_0x49f6ea,_0x348ae7){return client[_0x5d9c('0x8')](_0x1475c5,_0x5374f5)[_0x5d9c('0x9')](function(_0x3848cc){logger[_0x5d9c('0xa')](_0x5d9c('0xb'),_0x2d573c,_0x5d9c('0xc'));logger['debug'](_0x5d9c('0xd'),_0x2d573c,_0x5d9c('0xc'),JSON[_0x5d9c('0xe')](_0x3848cc));if(_0x3848cc['error']){if(_0x3848cc[_0x5d9c('0xf')]['code']===0x1f4){logger[_0x5d9c('0xf')](_0x5d9c('0xb'),_0x2d573c,_0x3848cc[_0x5d9c('0xf')]['message']);return _0x348ae7(_0x3848cc[_0x5d9c('0xf')]['message']);}logger['error'](_0x5d9c('0xb'),_0x2d573c,_0x3848cc[_0x5d9c('0xf')][_0x5d9c('0x10')]);return _0x49f6ea(_0x3848cc[_0x5d9c('0xf')][_0x5d9c('0x10')]);}else{logger['info'](_0x5d9c('0xb'),_0x2d573c,_0x5d9c('0xc'));_0x49f6ea(_0x3848cc[_0x5d9c('0x11')][_0x5d9c('0x10')]);}})['catch'](function(_0x2d10ff){logger[_0x5d9c('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2d573c,_0x2d10ff);_0x348ae7(_0x2d10ff);});});} \ No newline at end of file +var _0xab46=['catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x28594e,_0x46505a){var _0x45c591=function(_0x239d12){while(--_0x239d12){_0x28594e['push'](_0x28594e['shift']());}};_0x45c591(++_0x46505a);}(_0xab46,0x109));var _0x6ab4=function(_0x9d9343,_0x494c83){_0x9d9343=_0x9d9343-0x0;var _0x2abcd2=_0xab46[_0x9d9343];return _0x2abcd2;};'use strict';var _=require(_0x6ab4('0x0'));var util=require(_0x6ab4('0x1'));var moment=require(_0x6ab4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ab4('0x3'));var db=require(_0x6ab4('0x4'))['db'];var utils=require(_0x6ab4('0x5'));var logger=require(_0x6ab4('0x6'))(_0x6ab4('0x7'));var config=require(_0x6ab4('0x8'));var jayson=require(_0x6ab4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x282d49,_0xe52e5c,_0x5af81d){return new BPromise(function(_0xa8dfec,_0x9670e){return client[_0x6ab4('0xa')](_0x282d49,_0x5af81d)['then'](function(_0x5c03e3){logger[_0x6ab4('0xb')](_0x6ab4('0xc'),_0xe52e5c,_0x6ab4('0xd'));logger[_0x6ab4('0xe')](_0x6ab4('0xf'),_0xe52e5c,_0x6ab4('0xd'),JSON[_0x6ab4('0x10')](_0x5c03e3));if(_0x5c03e3['error']){if(_0x5c03e3['error'][_0x6ab4('0x11')]===0x1f4){logger[_0x6ab4('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xe52e5c,_0x5c03e3[_0x6ab4('0x12')][_0x6ab4('0x13')]);return _0x9670e(_0x5c03e3['error'][_0x6ab4('0x13')]);}logger[_0x6ab4('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xe52e5c,_0x5c03e3[_0x6ab4('0x12')][_0x6ab4('0x13')]);return _0xa8dfec(_0x5c03e3[_0x6ab4('0x12')][_0x6ab4('0x13')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0xe52e5c,'request\x20sent');_0xa8dfec(_0x5c03e3[_0x6ab4('0x14')][_0x6ab4('0x13')]);}})[_0x6ab4('0x15')](function(_0x404b33){logger['error'](_0x6ab4('0xc'),_0xe52e5c,_0x404b33);_0x9670e(_0x404b33);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 0160f8d..65a07ff 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 _0xb0de=['put','isAuthenticated','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','/:id','show','create'];(function(_0xb3e53,_0x2583db){var _0x385233=function(_0x444fe8){while(--_0x444fe8){_0xb3e53['push'](_0xb3e53['shift']());}};_0x385233(++_0x2583db);}(_0xb0de,0x198));var _0xeb0d=function(_0x116201,_0x1d3f76){_0x116201=_0x116201-0x0;var _0x2794d8=_0xb0de[_0x116201];return _0x2794d8;};'use strict';var multer=require(_0xeb0d('0x0'));var util=require(_0xeb0d('0x1'));var path=require(_0xeb0d('0x2'));var timeout=require(_0xeb0d('0x3'));var express=require(_0xeb0d('0x4'));var router=express['Router']();var fs_extra=require(_0xeb0d('0x5'));var auth=require(_0xeb0d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeb0d('0x7'));var controller=require('./intFreshdeskField.controller');router[_0xeb0d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xeb0d('0x8')](_0xeb0d('0x9'),auth['isAuthenticated'](),controller[_0xeb0d('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeb0d('0xb')]);router[_0xeb0d('0xc')](_0xeb0d('0x9'),auth[_0xeb0d('0xd')](),controller['update']);router['delete'](_0xeb0d('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xeb0d('0xe')]=router; \ No newline at end of file +var _0x38fc=['../../components/interaction/service','../../config/environment','isAuthenticated','index','show','post','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x1d20fb,_0x28dfe7){var _0x11732a=function(_0x9236e6){while(--_0x9236e6){_0x1d20fb['push'](_0x1d20fb['shift']());}};_0x11732a(++_0x28dfe7);}(_0x38fc,0x180));var _0xc38f=function(_0x78be3,_0x51f513){_0x78be3=_0x78be3-0x0;var _0x545fe5=_0x38fc[_0x78be3];return _0x545fe5;};'use strict';var multer=require(_0xc38f('0x0'));var util=require(_0xc38f('0x1'));var path=require(_0xc38f('0x2'));var timeout=require(_0xc38f('0x3'));var express=require('express');var router=express[_0xc38f('0x4')]();var fs_extra=require(_0xc38f('0x5'));var auth=require(_0xc38f('0x6'));var interaction=require(_0xc38f('0x7'));var config=require(_0xc38f('0x8'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0xc38f('0x9')](),controller[_0xc38f('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc38f('0xb')]);router[_0xc38f('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc38f('0xd'),auth[_0xc38f('0x9')](),controller[_0xc38f('0xe')]);router[_0xc38f('0xf')](_0xc38f('0xd'),auth[_0xc38f('0x9')](),controller[_0xc38f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 68f60e0..e2623db 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 _0xc367=['sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN'];(function(_0x46e2d0,_0x4f1d11){var _0x1c7c01=function(_0x3472d8){while(--_0x3472d8){_0x46e2d0['push'](_0x46e2d0['shift']());}};_0x1c7c01(++_0x4f1d11);}(_0xc367,0x1ef));var _0x7c36=function(_0x2bb556,_0x202392){_0x2bb556=_0x2bb556-0x0;var _0xd6d2b8=_0xc367[_0x2bb556];return _0xd6d2b8;};'use strict';var Sequelize=require(_0x7c36('0x0'));module[_0x7c36('0x1')]={'type':{'type':Sequelize[_0x7c36('0x2')]('string',_0x7c36('0x3'),_0x7c36('0x4'),_0x7c36('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x7c36('0x6'),'variable',_0x7c36('0x4'))},'keyContent':{'type':Sequelize[_0x7c36('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7c36('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7c36('0x7')]}}; \ No newline at end of file +var _0xaaf8=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xaaf8,0x181));var _0x8aaf=function(_0x32b307,_0x4485f8){_0x32b307=_0x32b307-0x0;var _0x5ead1c=_0xaaf8[_0x32b307];return _0x5ead1c;};'use strict';var Sequelize=require(_0x8aaf('0x0'));module[_0x8aaf('0x1')]={'type':{'type':Sequelize[_0x8aaf('0x2')](_0x8aaf('0x3'),_0x8aaf('0x4'),'customVariable',_0x8aaf('0x5'),_0x8aaf('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x8aaf('0x7')]},'key':{'type':Sequelize[_0x8aaf('0x7')]},'keyType':{'type':Sequelize[_0x8aaf('0x2')]('string',_0x8aaf('0x4'),_0x8aaf('0x8'))},'keyContent':{'type':Sequelize[_0x8aaf('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8aaf('0x7')]},'customField':{'type':Sequelize[_0x8aaf('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8aaf('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index a303d78..bfbe78b 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 _0x80df=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','FreshdeskField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0xbe6469,_0xc80a1f){var _0x24bdaa=function(_0x4aaf7d){while(--_0x4aaf7d){_0xbe6469['push'](_0xbe6469['shift']());}};_0x24bdaa(++_0xc80a1f);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xf80d('0x0'));var rimraf=require(_0xf80d('0x1'));var zipdir=require(_0xf80d('0x2'));var jsonpatch=require(_0xf80d('0x3'));var rp=require('request-promise');var moment=require(_0xf80d('0x4'));var BPromise=require(_0xf80d('0x5'));var Mustache=require(_0xf80d('0x6'));var util=require(_0xf80d('0x7'));var path=require(_0xf80d('0x8'));var sox=require(_0xf80d('0x9'));var csv=require(_0xf80d('0xa'));var ejs=require(_0xf80d('0xb'));var fs=require('fs');var fs_extra=require(_0xf80d('0xc'));var _=require(_0xf80d('0xd'));var squel=require('squel');var crypto=require(_0xf80d('0xe'));var jsforce=require(_0xf80d('0xf'));var deskjs=require(_0xf80d('0x10'));var toCsv=require(_0xf80d('0xa'));var querystring=require(_0xf80d('0x11'));var Papa=require(_0xf80d('0x12'));var Redis=require(_0xf80d('0x13'));var authService=require(_0xf80d('0x14'));var qs=require(_0xf80d('0x15'));var as=require(_0xf80d('0x16'));var hardwareService=require(_0xf80d('0x17'));var logger=require(_0xf80d('0x18'))(_0xf80d('0x19'));var utils=require(_0xf80d('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf80d('0x1b'))['db'];function respondWithStatusCode(_0x74ce36,_0x489bdf){_0x489bdf=_0x489bdf||0xcc;return function(_0x34e130){if(_0x34e130){return _0x74ce36['sendStatus'](_0x489bdf);}return _0x74ce36[_0xf80d('0x1c')](_0x489bdf)['end']();};}function respondWithResult(_0x4285de,_0x50c968){_0x50c968=_0x50c968||0xc8;return function(_0x3be9a9){if(_0x3be9a9){return _0x4285de[_0xf80d('0x1c')](_0x50c968)[_0xf80d('0x1d')](_0x3be9a9);}};}function respondWithFilteredResult(_0x1e1b08,_0x2098d6){return function(_0x45751c){if(_0x45751c){var _0x482043=typeof _0x2098d6[_0xf80d('0x1e')]===_0xf80d('0x1f')&&typeof _0x2098d6[_0xf80d('0x20')]===_0xf80d('0x1f');var _0x27b2ea=_0x45751c[_0xf80d('0x21')];var _0x1d104a=_0x482043?0x0:_0x2098d6[_0xf80d('0x1e')];var _0x2ea2c1=_0x482043?_0x45751c[_0xf80d('0x21')]:_0x2098d6[_0xf80d('0x1e')]+_0x2098d6[_0xf80d('0x20')];var _0x5392c5;if(_0x2ea2c1>=_0x27b2ea){_0x2ea2c1=_0x27b2ea;_0x5392c5=0xc8;}else{_0x5392c5=0xce;}_0x1e1b08[_0xf80d('0x1c')](_0x5392c5);return _0x1e1b08[_0xf80d('0x22')]('Content-Range',_0x1d104a+'-'+_0x2ea2c1+'/'+_0x27b2ea)[_0xf80d('0x1d')](_0x45751c);}return null;};}function patchUpdates(_0x539c80){return function(_0x3f3a2a){try{jsonpatch[_0xf80d('0x23')](_0x3f3a2a,_0x539c80,!![]);}catch(_0x2d5e46){return BPromise[_0xf80d('0x24')](_0x2d5e46);}return _0x3f3a2a[_0xf80d('0x25')]();};}function saveUpdates(_0x25d031,_0x446153){return function(_0x269859){if(_0x269859){return _0x269859[_0xf80d('0x26')](_0x25d031)[_0xf80d('0x27')](function(_0x33d58c){return _0x33d58c;});}return null;};}function removeEntity(_0x739968,_0x570c99){return function(_0x32ad42){if(_0x32ad42){return _0x32ad42[_0xf80d('0x28')]()['then'](function(){_0x739968[_0xf80d('0x1c')](0xcc)[_0xf80d('0x29')]();});}};}function handleEntityNotFound(_0x323540,_0x947bb){return function(_0x4986ad){if(!_0x4986ad){_0x323540[_0xf80d('0x2a')](0x194);}return _0x4986ad;};}function handleError(_0x14399e,_0xf4c3af){_0xf4c3af=_0xf4c3af||0x1f4;return function(_0x2a4597){logger[_0xf80d('0x2b')](_0x2a4597[_0xf80d('0x2c')]);if(_0x2a4597[_0xf80d('0x2d')]){delete _0x2a4597[_0xf80d('0x2d')];}_0x14399e[_0xf80d('0x1c')](_0xf4c3af)['send'](_0x2a4597);};}exports[_0xf80d('0x2e')]=function(_0x1603a4,_0x3e2c8c){var _0x368865={},_0x3ce924={},_0x5eab42={'count':0x0,'rows':[]};var _0x401cfb=_['map'](db[_0xf80d('0x2f')][_0xf80d('0x30')],function(_0x214bff){return{'name':_0x214bff[_0xf80d('0x31')],'type':_0x214bff['type']['key']};});_0x3ce924[_0xf80d('0x32')]=_['map'](_0x401cfb,_0xf80d('0x2d'));_0x3ce924[_0xf80d('0x33')]=_[_0xf80d('0x34')](_0x1603a4['query']);_0x3ce924[_0xf80d('0x35')]=_[_0xf80d('0x36')](_0x3ce924['model'],_0x3ce924[_0xf80d('0x33')]);_0x368865[_0xf80d('0x37')]=_[_0xf80d('0x36')](_0x3ce924['model'],qs[_0xf80d('0x38')](_0x1603a4[_0xf80d('0x33')][_0xf80d('0x38')]));_0x368865[_0xf80d('0x37')]=_0x368865[_0xf80d('0x37')]['length']?_0x368865[_0xf80d('0x37')]:_0x3ce924['model'];if(!_0x1603a4[_0xf80d('0x33')][_0xf80d('0x39')](_0xf80d('0x3a'))){_0x368865[_0xf80d('0x20')]=qs['limit'](_0x1603a4[_0xf80d('0x33')][_0xf80d('0x20')]);_0x368865[_0xf80d('0x1e')]=qs[_0xf80d('0x1e')](_0x1603a4['query'][_0xf80d('0x1e')]);}_0x368865[_0xf80d('0x3b')]=qs[_0xf80d('0x3c')](_0x1603a4[_0xf80d('0x33')][_0xf80d('0x3c')]);_0x368865[_0xf80d('0x3d')]=qs[_0xf80d('0x35')](_[_0xf80d('0x3e')](_0x1603a4['query'],_0x3ce924[_0xf80d('0x35')]),_0x401cfb);if(_0x1603a4[_0xf80d('0x33')][_0xf80d('0x3f')]){_0x368865['where']=_[_0xf80d('0x40')](_0x368865['where'],{'$or':_[_0xf80d('0x41')](_0x401cfb,function(_0x1a4ab7){if(_0x1a4ab7[_0xf80d('0x42')]!==_0xf80d('0x43')){var _0x4a3c5e={};_0x4a3c5e[_0x1a4ab7['name']]={'$like':'%'+_0x1603a4['query'][_0xf80d('0x3f')]+'%'};return _0x4a3c5e;}})});}_0x368865=_[_0xf80d('0x40')]({},_0x368865,_0x1603a4[_0xf80d('0x44')]);var _0x4b9f1d={'where':_0x368865[_0xf80d('0x3d')]};return db[_0xf80d('0x2f')]['count'](_0x4b9f1d)[_0xf80d('0x27')](function(_0x511310){_0x5eab42[_0xf80d('0x21')]=_0x511310;if(_0x1603a4['query'][_0xf80d('0x45')]){_0x368865['include']=[{'all':!![]}];}return db[_0xf80d('0x2f')][_0xf80d('0x46')](_0x368865);})[_0xf80d('0x27')](function(_0x2cd371){_0x5eab42[_0xf80d('0x47')]=_0x2cd371;return _0x5eab42;})[_0xf80d('0x27')](respondWithFilteredResult(_0x3e2c8c,_0x368865))[_0xf80d('0x48')](handleError(_0x3e2c8c,null));};exports[_0xf80d('0x49')]=function(_0x99e531,_0x80f24a){var _0x1fcbad={'raw':!![],'where':{'id':_0x99e531[_0xf80d('0x4a')]['id']}},_0x437e44={};_0x437e44[_0xf80d('0x32')]=_[_0xf80d('0x34')](db[_0xf80d('0x2f')][_0xf80d('0x30')]);_0x437e44[_0xf80d('0x33')]=_[_0xf80d('0x34')](_0x99e531[_0xf80d('0x33')]);_0x437e44[_0xf80d('0x35')]=_[_0xf80d('0x36')](_0x437e44[_0xf80d('0x32')],_0x437e44[_0xf80d('0x33')]);_0x1fcbad[_0xf80d('0x37')]=_['intersection'](_0x437e44[_0xf80d('0x32')],qs[_0xf80d('0x38')](_0x99e531[_0xf80d('0x33')][_0xf80d('0x38')]));_0x1fcbad[_0xf80d('0x37')]=_0x1fcbad['attributes'][_0xf80d('0x4b')]?_0x1fcbad[_0xf80d('0x37')]:_0x437e44[_0xf80d('0x32')];if(_0x99e531[_0xf80d('0x33')][_0xf80d('0x45')]){_0x1fcbad[_0xf80d('0x4c')]=[{'all':!![]}];}_0x1fcbad=_[_0xf80d('0x40')]({},_0x1fcbad,_0x99e531[_0xf80d('0x44')]);return db[_0xf80d('0x2f')][_0xf80d('0x4d')](_0x1fcbad)[_0xf80d('0x27')](handleEntityNotFound(_0x80f24a,null))[_0xf80d('0x27')](respondWithResult(_0x80f24a,null))[_0xf80d('0x48')](handleError(_0x80f24a,null));};exports[_0xf80d('0x4e')]=function(_0x3a420d,_0x10d5b5){return db[_0xf80d('0x2f')]['create'](_0x3a420d[_0xf80d('0x4f')],{})[_0xf80d('0x27')](respondWithResult(_0x10d5b5,0xc9))[_0xf80d('0x48')](handleError(_0x10d5b5,null));};exports['update']=function(_0x3e5cf6,_0x1088ca){if(_0x3e5cf6['body']['id']){delete _0x3e5cf6['body']['id'];}return db[_0xf80d('0x2f')]['find']({'where':{'id':_0x3e5cf6[_0xf80d('0x4a')]['id']}})[_0xf80d('0x27')](handleEntityNotFound(_0x1088ca,null))[_0xf80d('0x27')](saveUpdates(_0x3e5cf6[_0xf80d('0x4f')],null))[_0xf80d('0x27')](respondWithResult(_0x1088ca,null))[_0xf80d('0x48')](handleError(_0x1088ca,null));};exports[_0xf80d('0x28')]=function(_0x114132,_0x115d1f){return db[_0xf80d('0x2f')][_0xf80d('0x4d')]({'where':{'id':_0x114132[_0xf80d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x115d1f,null))[_0xf80d('0x27')](removeEntity(_0x115d1f,null))[_0xf80d('0x48')](handleError(_0x115d1f,null));}; \ No newline at end of file +var _0xbee3=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','FreshdeskField','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','body','find','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash'];(function(_0x25d4e5,_0x30b67f){var _0x44d116=function(_0x3011c2){while(--_0x3011c2){_0x25d4e5['push'](_0x25d4e5['shift']());}};_0x44d116(++_0x30b67f);}(_0xbee3,0xd5));var _0x3bee=function(_0x393264,_0x174ef1){_0x393264=_0x393264-0x0;var _0x26afb9=_0xbee3[_0x393264];return _0x26afb9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3bee('0x3'));var util=require(_0x3bee('0x4'));var path=require(_0x3bee('0x5'));var sox=require('sox');var csv=require(_0x3bee('0x6'));var ejs=require(_0x3bee('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x6'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];function respondWithStatusCode(_0x407526,_0x6950d0){_0x6950d0=_0x6950d0||0xcc;return function(_0x410124){if(_0x410124){return _0x407526[_0x3bee('0x17')](_0x6950d0);}return _0x407526[_0x3bee('0x18')](_0x6950d0)['end']();};}function respondWithResult(_0xad01f9,_0x33504d){_0x33504d=_0x33504d||0xc8;return function(_0x31ac52){if(_0x31ac52){return _0xad01f9[_0x3bee('0x18')](_0x33504d)[_0x3bee('0x19')](_0x31ac52);}};}function respondWithFilteredResult(_0x5b9473,_0x558436){return function(_0x346767){if(_0x346767){var _0x515397=typeof _0x558436[_0x3bee('0x1a')]===_0x3bee('0x1b')&&typeof _0x558436['limit']==='undefined';var _0x1582a4=_0x346767[_0x3bee('0x1c')];var _0xfdba3b=_0x515397?0x0:_0x558436[_0x3bee('0x1a')];var _0x49095a=_0x515397?_0x346767[_0x3bee('0x1c')]:_0x558436[_0x3bee('0x1a')]+_0x558436[_0x3bee('0x1d')];var _0x49b32d;if(_0x49095a>=_0x1582a4){_0x49095a=_0x1582a4;_0x49b32d=0xc8;}else{_0x49b32d=0xce;}_0x5b9473[_0x3bee('0x18')](_0x49b32d);return _0x5b9473[_0x3bee('0x1e')](_0x3bee('0x1f'),_0xfdba3b+'-'+_0x49095a+'/'+_0x1582a4)['json'](_0x346767);}return null;};}function patchUpdates(_0x4f36af){return function(_0x1afd0f){try{jsonpatch[_0x3bee('0x20')](_0x1afd0f,_0x4f36af,!![]);}catch(_0x57aba4){return BPromise[_0x3bee('0x21')](_0x57aba4);}return _0x1afd0f[_0x3bee('0x22')]();};}function saveUpdates(_0x2eea75,_0x179e62){return function(_0x28c248){if(_0x28c248){return _0x28c248[_0x3bee('0x23')](_0x2eea75)[_0x3bee('0x24')](function(_0x582fa9){return _0x582fa9;});}return null;};}function removeEntity(_0x8ae4ca,_0x1ed0c1){return function(_0x1fed5a){if(_0x1fed5a){return _0x1fed5a[_0x3bee('0x25')]()['then'](function(){_0x8ae4ca[_0x3bee('0x18')](0xcc)[_0x3bee('0x26')]();});}};}function handleEntityNotFound(_0x1e0111,_0x4b4cd4){return function(_0x5ed022){if(!_0x5ed022){_0x1e0111[_0x3bee('0x17')](0x194);}return _0x5ed022;};}function handleError(_0x479f45,_0x5341e2){_0x5341e2=_0x5341e2||0x1f4;return function(_0x2c0e50){logger[_0x3bee('0x27')](_0x2c0e50[_0x3bee('0x28')]);if(_0x2c0e50['name']){delete _0x2c0e50[_0x3bee('0x29')];}_0x479f45[_0x3bee('0x18')](_0x5341e2)[_0x3bee('0x2a')](_0x2c0e50);};}exports['index']=function(_0x239fa4,_0xf08fb3){var _0x3a3d92={},_0x496abd={},_0x1115ed={'count':0x0,'rows':[]};var _0x24d523=_[_0x3bee('0x2b')](db[_0x3bee('0x2c')][_0x3bee('0x2d')],function(_0x559c2b){return{'name':_0x559c2b['fieldName'],'type':_0x559c2b[_0x3bee('0x2e')][_0x3bee('0x2f')]};});_0x496abd[_0x3bee('0x30')]=_[_0x3bee('0x2b')](_0x24d523,'name');_0x496abd['query']=_[_0x3bee('0x31')](_0x239fa4[_0x3bee('0x32')]);_0x496abd['filters']=_['intersection'](_0x496abd[_0x3bee('0x30')],_0x496abd[_0x3bee('0x32')]);_0x3a3d92[_0x3bee('0x33')]=_[_0x3bee('0x34')](_0x496abd[_0x3bee('0x30')],qs[_0x3bee('0x35')](_0x239fa4[_0x3bee('0x32')][_0x3bee('0x35')]));_0x3a3d92[_0x3bee('0x33')]=_0x3a3d92[_0x3bee('0x33')]['length']?_0x3a3d92['attributes']:_0x496abd[_0x3bee('0x30')];if(!_0x239fa4['query']['hasOwnProperty'](_0x3bee('0x36'))){_0x3a3d92[_0x3bee('0x1d')]=qs[_0x3bee('0x1d')](_0x239fa4[_0x3bee('0x32')][_0x3bee('0x1d')]);_0x3a3d92[_0x3bee('0x1a')]=qs[_0x3bee('0x1a')](_0x239fa4[_0x3bee('0x32')]['offset']);}_0x3a3d92[_0x3bee('0x37')]=qs[_0x3bee('0x38')](_0x239fa4['query'][_0x3bee('0x38')]);_0x3a3d92[_0x3bee('0x39')]=qs[_0x3bee('0x3a')](_[_0x3bee('0x3b')](_0x239fa4[_0x3bee('0x32')],_0x496abd['filters']),_0x24d523);if(_0x239fa4['query'][_0x3bee('0x3c')]){_0x3a3d92[_0x3bee('0x39')]=_[_0x3bee('0x3d')](_0x3a3d92[_0x3bee('0x39')],{'$or':_[_0x3bee('0x2b')](_0x24d523,function(_0x3d9656){if(_0x3d9656[_0x3bee('0x2e')]!==_0x3bee('0x3e')){var _0x2fb349={};_0x2fb349[_0x3d9656[_0x3bee('0x29')]]={'$like':'%'+_0x239fa4[_0x3bee('0x32')][_0x3bee('0x3c')]+'%'};return _0x2fb349;}})});}_0x3a3d92=_['merge']({},_0x3a3d92,_0x239fa4[_0x3bee('0x3f')]);var _0x1b5eca={'where':_0x3a3d92[_0x3bee('0x39')]};return db[_0x3bee('0x2c')][_0x3bee('0x1c')](_0x1b5eca)[_0x3bee('0x24')](function(_0x1622b9){_0x1115ed[_0x3bee('0x1c')]=_0x1622b9;if(_0x239fa4[_0x3bee('0x32')][_0x3bee('0x40')]){_0x3a3d92[_0x3bee('0x41')]=[{'all':!![]}];}return db[_0x3bee('0x2c')][_0x3bee('0x42')](_0x3a3d92);})['then'](function(_0x2b773d){_0x1115ed[_0x3bee('0x43')]=_0x2b773d;return _0x1115ed;})[_0x3bee('0x24')](respondWithFilteredResult(_0xf08fb3,_0x3a3d92))[_0x3bee('0x44')](handleError(_0xf08fb3,null));};exports[_0x3bee('0x45')]=function(_0x44489f,_0x13dd72){var _0xd1140d={'raw':!![],'where':{'id':_0x44489f[_0x3bee('0x46')]['id']}},_0x5d9e1b={};_0x5d9e1b[_0x3bee('0x30')]=_[_0x3bee('0x31')](db['FreshdeskField'][_0x3bee('0x2d')]);_0x5d9e1b['query']=_[_0x3bee('0x31')](_0x44489f['query']);_0x5d9e1b['filters']=_[_0x3bee('0x34')](_0x5d9e1b[_0x3bee('0x30')],_0x5d9e1b[_0x3bee('0x32')]);_0xd1140d[_0x3bee('0x33')]=_[_0x3bee('0x34')](_0x5d9e1b['model'],qs['fields'](_0x44489f[_0x3bee('0x32')]['fields']));_0xd1140d[_0x3bee('0x33')]=_0xd1140d['attributes'][_0x3bee('0x47')]?_0xd1140d['attributes']:_0x5d9e1b[_0x3bee('0x30')];if(_0x44489f[_0x3bee('0x32')][_0x3bee('0x40')]){_0xd1140d[_0x3bee('0x41')]=[{'all':!![]}];}_0xd1140d=_['merge']({},_0xd1140d,_0x44489f['options']);return db[_0x3bee('0x2c')]['find'](_0xd1140d)['then'](handleEntityNotFound(_0x13dd72,null))['then'](respondWithResult(_0x13dd72,null))[_0x3bee('0x44')](handleError(_0x13dd72,null));};exports['create']=function(_0x125fa5,_0x33d615){return db[_0x3bee('0x2c')]['create'](_0x125fa5[_0x3bee('0x48')],{})['then'](respondWithResult(_0x33d615,0xc9))[_0x3bee('0x44')](handleError(_0x33d615,null));};exports['update']=function(_0x26ccd7,_0x16b096){if(_0x26ccd7[_0x3bee('0x48')]['id']){delete _0x26ccd7['body']['id'];}return db[_0x3bee('0x2c')][_0x3bee('0x49')]({'where':{'id':_0x26ccd7[_0x3bee('0x46')]['id']}})['then'](handleEntityNotFound(_0x16b096,null))['then'](saveUpdates(_0x26ccd7[_0x3bee('0x48')],null))[_0x3bee('0x24')](respondWithResult(_0x16b096,null))[_0x3bee('0x44')](handleError(_0x16b096,null));};exports[_0x3bee('0x25')]=function(_0x3b5d7a,_0x21ab40){return db[_0x3bee('0x2c')]['find']({'where':{'id':_0x3b5d7a[_0x3bee('0x46')]['id']}})[_0x3bee('0x24')](handleEntityNotFound(_0x21ab40,null))['then'](removeEntity(_0x21ab40,null))['catch'](handleError(_0x21ab40,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 6a1216c..b96c9c7 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 _0x552c=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','exports','define','FreshdeskField'];(function(_0x7ad123,_0xeeeef3){var _0x37d073=function(_0x51367b){while(--_0x51367b){_0x7ad123['push'](_0x7ad123['shift']());}};_0x37d073(++_0xeeeef3);}(_0x552c,0x66));var _0xc552=function(_0x1ad992,_0x5ddc63){_0x1ad992=_0x1ad992-0x0;var _0x535234=_0x552c[_0x1ad992];return _0x535234;};'use strict';var _=require(_0xc552('0x0'));var util=require(_0xc552('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc552('0x2'));var BPromise=require(_0xc552('0x3'));var rp=require(_0xc552('0x4'));var fs=require('fs');var path=require(_0xc552('0x5'));var rimraf=require(_0xc552('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0xc552('0x7')]=function(_0x41f2c7,_0x504ebc){return _0x41f2c7[_0xc552('0x8')](_0xc552('0x9'),attributes,{'tableName':_0xc552('0xa'),'paranoid':![],'indexes':[{'name':_0xc552('0xb'),'fields':[_0xc552('0xc'),_0xc552('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c79=['path','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','idField','lodash','../../config/logger','api','bluebird'];(function(_0x3c729b,_0x2a4146){var _0x55894c=function(_0x183a16){while(--_0x183a16){_0x3c729b['push'](_0x3c729b['shift']());}};_0x55894c(++_0x2a4146);}(_0x2c79,0x164));var _0x92c7=function(_0x169d2f,_0x4fe638){_0x169d2f=_0x169d2f-0x0;var _0x228360=_0x2c79[_0x169d2f];return _0x228360;};'use strict';var _=require(_0x92c7('0x0'));var util=require('util');var logger=require(_0x92c7('0x1'))(_0x92c7('0x2'));var moment=require('moment');var BPromise=require(_0x92c7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92c7('0x4'));var rimraf=require('rimraf');var config=require(_0x92c7('0x5'));var attributes=require(_0x92c7('0x6'));module['exports']=function(_0x42a70d,_0x4d2d3a){return _0x42a70d[_0x92c7('0x7')](_0x92c7('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x92c7('0x9'),'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 1702a68..0117c49 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 _0x830a=['then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x830a,0x159));var _0xa830=function(_0x5e1eb5,_0x7591c2){_0x5e1eb5=_0x5e1eb5-0x0;var _0x30f73c=_0x830a[_0x5e1eb5];return _0x30f73c;};'use strict';var _=require(_0xa830('0x0'));var util=require(_0xa830('0x1'));var moment=require(_0xa830('0x2'));var BPromise=require(_0xa830('0x3'));var rs=require(_0xa830('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa830('0x5'));var logger=require('../../config/logger')(_0xa830('0x6'));var config=require(_0xa830('0x7'));var jayson=require(_0xa830('0x8'));var client=jayson[_0xa830('0x9')][_0xa830('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x110e5e,_0x3230a1,_0x3e0c17){return new BPromise(function(_0x2ca9cd,_0x3c496c){return client[_0xa830('0xb')](_0x110e5e,_0x3e0c17)[_0xa830('0xc')](function(_0x4f8554){logger[_0xa830('0xd')](_0xa830('0xe'),_0x3230a1,_0xa830('0xf'));logger[_0xa830('0x10')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x3230a1,_0xa830('0xf'),JSON[_0xa830('0x11')](_0x4f8554));if(_0x4f8554[_0xa830('0x12')]){if(_0x4f8554[_0xa830('0x12')][_0xa830('0x13')]===0x1f4){logger[_0xa830('0x12')](_0xa830('0xe'),_0x3230a1,_0x4f8554[_0xa830('0x12')]['message']);return _0x3c496c(_0x4f8554[_0xa830('0x12')][_0xa830('0x14')]);}logger[_0xa830('0x12')](_0xa830('0xe'),_0x3230a1,_0x4f8554['error'][_0xa830('0x14')]);return _0x2ca9cd(_0x4f8554['error'][_0xa830('0x14')]);}else{logger[_0xa830('0xd')](_0xa830('0xe'),_0x3230a1,_0xa830('0xf'));_0x2ca9cd(_0x4f8554['result'][_0xa830('0x14')]);}})['catch'](function(_0x5e3326){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x3230a1,_0x5e3326);_0x3c496c(_0x5e3326);});});} \ No newline at end of file +var _0x6329=['debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x1d1024,_0x15e559){var _0x2bff1f=function(_0x51324c){while(--_0x51324c){_0x1d1024['push'](_0x1d1024['shift']());}};_0x2bff1f(++_0x15e559);}(_0x6329,0xb0));var _0x9632=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6329[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x9632('0x0'));var util=require(_0x9632('0x1'));var moment=require(_0x9632('0x2'));var BPromise=require('bluebird');var rs=require(_0x9632('0x3'));var fs=require('fs');var Redis=require(_0x9632('0x4'));var db=require(_0x9632('0x5'))['db'];var utils=require(_0x9632('0x6'));var logger=require(_0x9632('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x50b4b1,_0x442692,_0x363f9b){return new BPromise(function(_0x4ffce4,_0x3648ab){return client[_0x9632('0x8')](_0x50b4b1,_0x363f9b)[_0x9632('0x9')](function(_0x1f4d28){logger[_0x9632('0xa')](_0x9632('0xb'),_0x442692,_0x9632('0xc'));logger[_0x9632('0xd')](_0x9632('0xe'),_0x442692,_0x9632('0xc'),JSON[_0x9632('0xf')](_0x1f4d28));if(_0x1f4d28[_0x9632('0x10')]){if(_0x1f4d28[_0x9632('0x10')][_0x9632('0x11')]===0x1f4){logger[_0x9632('0x10')](_0x9632('0xb'),_0x442692,_0x1f4d28[_0x9632('0x10')][_0x9632('0x12')]);return _0x3648ab(_0x1f4d28['error'][_0x9632('0x12')]);}logger[_0x9632('0x10')](_0x9632('0xb'),_0x442692,_0x1f4d28[_0x9632('0x10')][_0x9632('0x12')]);return _0x4ffce4(_0x1f4d28[_0x9632('0x10')][_0x9632('0x12')]);}else{logger[_0x9632('0xa')](_0x9632('0xb'),_0x442692,_0x9632('0xc'));_0x4ffce4(_0x1f4d28[_0x9632('0x13')][_0x9632('0x12')]);}})[_0x9632('0x14')](function(_0x3d9ee8){logger[_0x9632('0x10')](_0x9632('0xb'),_0x442692,_0x3d9ee8);_0x3648ab(_0x3d9ee8);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index fa16ebd..8c0215e 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 _0xa478=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','getFields','post','/:id/configurations','update'];(function(_0x9d4544,_0x4f8a51){var _0x53e6c2=function(_0x176439){while(--_0x176439){_0x9d4544['push'](_0x9d4544['shift']());}};_0x53e6c2(++_0x4f8a51);}(_0xa478,0x136));var _0x8a47=function(_0x11a741,_0x1e7097){_0x11a741=_0x11a741-0x0;var _0xa466f6=_0xa478[_0x11a741];return _0xa466f6;};'use strict';var multer=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var path=require(_0x8a47('0x2'));var timeout=require(_0x8a47('0x3'));var express=require(_0x8a47('0x4'));var router=express[_0x8a47('0x5')]();var fs_extra=require(_0x8a47('0x6'));var auth=require(_0x8a47('0x7'));var interaction=require(_0x8a47('0x8'));var config=require(_0x8a47('0x9'));var controller=require(_0x8a47('0xa'));router[_0x8a47('0xb')]('/',auth['isAuthenticated'](),controller[_0x8a47('0xc')]);router[_0x8a47('0xb')](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller['show']);router[_0x8a47('0xb')]('/:id/configurations',auth[_0x8a47('0xe')](),controller[_0x8a47('0xf')]);router[_0x8a47('0xb')]('/:id/fields',auth[_0x8a47('0xe')](),controller[_0x8a47('0x10')]);router['post']('/',auth[_0x8a47('0xe')](),controller['create']);router[_0x8a47('0x11')](_0x8a47('0x12'),auth[_0x8a47('0xe')](),controller['addConfiguration']);router['put']('/:id',auth[_0x8a47('0xe')](),controller[_0x8a47('0x13')]);router['delete'](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller[_0x8a47('0x14')]);module[_0x8a47('0x15')]=router; \ No newline at end of file +var _0xdb94=['isAuthenticated','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intFreshsalesAccount.controller','index','/:id','show','get','/:id/configurations'];(function(_0x592fbd,_0x2d306a){var _0x330d89=function(_0x354811){while(--_0x354811){_0x592fbd['push'](_0x592fbd['shift']());}};_0x330d89(++_0x2d306a);}(_0xdb94,0xab));var _0x4db9=function(_0x1b2c38,_0x1ac952){_0x1b2c38=_0x1b2c38-0x0;var _0x24e67d=_0xdb94[_0x1b2c38];return _0x24e67d;};'use strict';var multer=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var path=require(_0x4db9('0x2'));var timeout=require(_0x4db9('0x3'));var express=require(_0x4db9('0x4'));var router=express['Router']();var fs_extra=require(_0x4db9('0x5'));var auth=require(_0x4db9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4db9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4db9('0x8')]);router['get'](_0x4db9('0x9'),auth['isAuthenticated'](),controller[_0x4db9('0xa')]);router[_0x4db9('0xb')](_0x4db9('0xc'),auth[_0x4db9('0xd')](),controller[_0x4db9('0xe')]);router[_0x4db9('0xb')](_0x4db9('0xf'),auth[_0x4db9('0xd')](),controller[_0x4db9('0x10')]);router[_0x4db9('0x11')]('/',auth[_0x4db9('0xd')](),controller['create']);router[_0x4db9('0x11')](_0x4db9('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4db9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4db9('0x13')]);router[_0x4db9('0x14')]('/:id',auth[_0x4db9('0xd')](),controller[_0x4db9('0x15')]);module[_0x4db9('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 54e9be0..6cc078b 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 _0x1399=['exports','STRING','username','remoteUri','sequelize'];(function(_0x21205e,_0x7eb8e7){var _0x136ebb=function(_0x54aac2){while(--_0x54aac2){_0x21205e['push'](_0x21205e['shift']());}};_0x136ebb(++_0x7eb8e7);}(_0x1399,0x16c));var _0x9139=function(_0x1b27ff,_0x34070b){_0x1b27ff=_0x1b27ff-0x0;var _0x1ff114=_0x1399[_0x1b27ff];return _0x1ff114;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9139('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x9139('0x3')},'apiKey':{'type':Sequelize[_0x9139('0x2')]},'remoteUri':{'type':Sequelize[_0x9139('0x2')],'unique':_0x9139('0x4')},'serverUrl':{'type':Sequelize[_0x9139('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xfb11=['sequelize','STRING','username'];(function(_0xe0dda2,_0x5f15e3){var _0x419af4=function(_0xc97872){while(--_0xc97872){_0xe0dda2['push'](_0xe0dda2['shift']());}};_0x419af4(++_0x5f15e3);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xfb11[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require(_0x1fb1('0x0'));module['exports']={'name':{'type':Sequelize[_0x1fb1('0x1')]},'description':{'type':Sequelize[_0x1fb1('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x1fb1('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1fb1('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x1fb1('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index b861e8d..46d086d 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 _0x8134=['error','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','findAll','show','params','include','merge','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','catch','addConfiguration','AccountId','getSubjects','channel','getDescriptions','FreshsalesField','Subjects','Descriptions','getFields','username','remoteUri','apiKey','lastIndexOf','format','%s%s','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','Content-Range','apply','save','then','destroy'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x8134,0xf5));var _0x4813=function(_0x496915,_0x426cce){_0x496915=_0x496915-0x0;var _0x54085e=_0x8134[_0x496915];return _0x54085e;};'use strict';var emlformat=require(_0x4813('0x0'));var rimraf=require(_0x4813('0x1'));var zipdir=require(_0x4813('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4813('0x3'));var moment=require(_0x4813('0x4'));var BPromise=require(_0x4813('0x5'));var Mustache=require('mustache');var util=require(_0x4813('0x6'));var path=require('path');var sox=require(_0x4813('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4813('0x8'));var squel=require('squel');var crypto=require(_0x4813('0x9'));var jsforce=require(_0x4813('0xa'));var deskjs=require(_0x4813('0xb'));var toCsv=require(_0x4813('0xc'));var querystring=require(_0x4813('0xd'));var Papa=require(_0x4813('0xe'));var Redis=require(_0x4813('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4813('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4813('0x11'));var logger=require('../../config/logger')(_0x4813('0x12'));var utils=require('../../config/utils');var config=require(_0x4813('0x13'));var licenseUtil=require(_0x4813('0x14'));var db=require(_0x4813('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3fe30f,_0x1ec7d2){_0x1ec7d2=_0x1ec7d2||0xcc;return function(_0x19d226){if(_0x19d226){return _0x3fe30f[_0x4813('0x16')](_0x1ec7d2);}return _0x3fe30f[_0x4813('0x17')](_0x1ec7d2)[_0x4813('0x18')]();};}function respondWithResult(_0x2ee706,_0x43bc5a){_0x43bc5a=_0x43bc5a||0xc8;return function(_0x3029bf){if(_0x3029bf){return _0x2ee706[_0x4813('0x17')](_0x43bc5a)['json'](_0x3029bf);}};}function respondWithFilteredResult(_0x45c04a,_0x255c5d){return function(_0x861ef2){if(_0x861ef2){var _0x2685b8=typeof _0x255c5d['offset']==='undefined'&&typeof _0x255c5d[_0x4813('0x19')]===_0x4813('0x1a');var _0x573ae2=_0x861ef2[_0x4813('0x1b')];var _0x5b5ca5=_0x2685b8?0x0:_0x255c5d[_0x4813('0x1c')];var _0x9972d9=_0x2685b8?_0x861ef2['count']:_0x255c5d['offset']+_0x255c5d['limit'];var _0x2f6e73;if(_0x9972d9>=_0x573ae2){_0x9972d9=_0x573ae2;_0x2f6e73=0xc8;}else{_0x2f6e73=0xce;}_0x45c04a[_0x4813('0x17')](_0x2f6e73);return _0x45c04a['set'](_0x4813('0x1d'),_0x5b5ca5+'-'+_0x9972d9+'/'+_0x573ae2)['json'](_0x861ef2);}return null;};}function patchUpdates(_0x33029b){return function(_0x56fc9e){try{jsonpatch[_0x4813('0x1e')](_0x56fc9e,_0x33029b,!![]);}catch(_0x147a0f){return BPromise['reject'](_0x147a0f);}return _0x56fc9e[_0x4813('0x1f')]();};}function saveUpdates(_0xa5a1a3,_0x1f7cf2){return function(_0x27f260){if(_0x27f260){return _0x27f260['update'](_0xa5a1a3)[_0x4813('0x20')](function(_0xfc4a86){return _0xfc4a86;});}return null;};}function removeEntity(_0x3f3433,_0x34c5dc){return function(_0x4fc03b){if(_0x4fc03b){return _0x4fc03b[_0x4813('0x21')]()[_0x4813('0x20')](function(){_0x3f3433[_0x4813('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ae848,_0x58d2a4){return function(_0x2bb5a4){if(!_0x2bb5a4){_0x5ae848[_0x4813('0x16')](0x194);}return _0x2bb5a4;};}function handleError(_0x41ce25,_0x50a58c){_0x50a58c=_0x50a58c||0x1f4;return function(_0x4366f3){logger[_0x4813('0x22')](_0x4366f3['stack']);if(_0x4366f3[_0x4813('0x23')]){delete _0x4366f3['name'];}_0x41ce25[_0x4813('0x17')](_0x50a58c)[_0x4813('0x24')](_0x4366f3);};}exports[_0x4813('0x25')]=function(_0x5112f9,_0x25576c){var _0x5d53ba={},_0x4bc0b8={},_0x39d28c={'count':0x0,'rows':[]};var _0x3f4bed=_[_0x4813('0x26')](db[_0x4813('0x27')][_0x4813('0x28')],function(_0x14fbaf){return{'name':_0x14fbaf[_0x4813('0x29')],'type':_0x14fbaf[_0x4813('0x2a')]['key']};});_0x4bc0b8[_0x4813('0x2b')]=_[_0x4813('0x26')](_0x3f4bed,'name');_0x4bc0b8[_0x4813('0x2c')]=_[_0x4813('0x2d')](_0x5112f9[_0x4813('0x2c')]);_0x4bc0b8[_0x4813('0x2e')]=_['intersection'](_0x4bc0b8['model'],_0x4bc0b8[_0x4813('0x2c')]);_0x5d53ba[_0x4813('0x2f')]=_[_0x4813('0x30')](_0x4bc0b8['model'],qs['fields'](_0x5112f9[_0x4813('0x2c')][_0x4813('0x31')]));_0x5d53ba[_0x4813('0x2f')]=_0x5d53ba['attributes'][_0x4813('0x32')]?_0x5d53ba[_0x4813('0x2f')]:_0x4bc0b8[_0x4813('0x2b')];if(!_0x5112f9[_0x4813('0x2c')][_0x4813('0x33')](_0x4813('0x34'))){_0x5d53ba[_0x4813('0x19')]=qs[_0x4813('0x19')](_0x5112f9[_0x4813('0x2c')][_0x4813('0x19')]);_0x5d53ba[_0x4813('0x1c')]=qs[_0x4813('0x1c')](_0x5112f9[_0x4813('0x2c')][_0x4813('0x1c')]);}_0x5d53ba[_0x4813('0x35')]=qs['sort'](_0x5112f9[_0x4813('0x2c')][_0x4813('0x36')]);_0x5d53ba['where']=qs['filters'](_[_0x4813('0x37')](_0x5112f9['query'],_0x4bc0b8[_0x4813('0x2e')]),_0x3f4bed);if(_0x5112f9['query']['filter']){_0x5d53ba['where']=_['merge'](_0x5d53ba[_0x4813('0x38')],{'$or':_['map'](_0x3f4bed,function(_0x41a9cb){if(_0x41a9cb['type']!==_0x4813('0x39')){var _0x3cc4b6={};_0x3cc4b6[_0x41a9cb[_0x4813('0x23')]]={'$like':'%'+_0x5112f9[_0x4813('0x2c')][_0x4813('0x3a')]+'%'};return _0x3cc4b6;}})});}_0x5d53ba=_['merge']({},_0x5d53ba,_0x5112f9[_0x4813('0x3b')]);var _0x57d0af={'where':_0x5d53ba[_0x4813('0x38')]};return db[_0x4813('0x27')][_0x4813('0x1b')](_0x57d0af)[_0x4813('0x20')](function(_0x413966){_0x39d28c[_0x4813('0x1b')]=_0x413966;if(_0x5112f9[_0x4813('0x2c')][_0x4813('0x3c')]){_0x5d53ba['include']=[{'all':!![]}];}return db[_0x4813('0x27')][_0x4813('0x3d')](_0x5d53ba);})[_0x4813('0x20')](function(_0x480288){_0x39d28c['rows']=_0x480288;return _0x39d28c;})[_0x4813('0x20')](respondWithFilteredResult(_0x25576c,_0x5d53ba))['catch'](handleError(_0x25576c,null));};exports[_0x4813('0x3e')]=function(_0x15fa8c,_0x478138){var _0x5d67ec={'raw':![],'where':{'id':_0x15fa8c[_0x4813('0x3f')]['id']}},_0x1b40fa={};_0x1b40fa[_0x4813('0x2b')]=_[_0x4813('0x2d')](db[_0x4813('0x27')][_0x4813('0x28')]);_0x1b40fa[_0x4813('0x2c')]=_['keys'](_0x15fa8c[_0x4813('0x2c')]);_0x1b40fa['filters']=_[_0x4813('0x30')](_0x1b40fa[_0x4813('0x2b')],_0x1b40fa['query']);_0x5d67ec[_0x4813('0x2f')]=_[_0x4813('0x30')](_0x1b40fa['model'],qs[_0x4813('0x31')](_0x15fa8c[_0x4813('0x2c')][_0x4813('0x31')]));_0x5d67ec[_0x4813('0x2f')]=_0x5d67ec[_0x4813('0x2f')]['length']?_0x5d67ec[_0x4813('0x2f')]:_0x1b40fa['model'];if(_0x15fa8c[_0x4813('0x2c')][_0x4813('0x3c')]){_0x5d67ec[_0x4813('0x40')]=[{'all':!![]}];}_0x5d67ec=_[_0x4813('0x41')]({},_0x5d67ec,_0x15fa8c[_0x4813('0x3b')]);return db[_0x4813('0x27')]['find'](_0x5d67ec)[_0x4813('0x20')](handleEntityNotFound(_0x478138,null))['then'](respondWithResult(_0x478138,null))['catch'](handleError(_0x478138,null));};exports[_0x4813('0x42')]=function(_0x1d93e0,_0x21bdc0){return db['FreshsalesAccount'][_0x4813('0x42')](_0x1d93e0['body'],{})[_0x4813('0x20')](respondWithResult(_0x21bdc0,0xc9))['catch'](handleError(_0x21bdc0,null));};exports['update']=function(_0x3e05ff,_0x3ca0af){if(_0x3e05ff[_0x4813('0x43')]['id']){delete _0x3e05ff[_0x4813('0x43')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x3e05ff[_0x4813('0x3f')]['id']}})[_0x4813('0x20')](handleEntityNotFound(_0x3ca0af,null))[_0x4813('0x20')](saveUpdates(_0x3e05ff[_0x4813('0x43')],null))[_0x4813('0x20')](respondWithResult(_0x3ca0af,null))['catch'](handleError(_0x3ca0af,null));};exports[_0x4813('0x21')]=function(_0x3b0a72,_0x496f83){return db[_0x4813('0x27')][_0x4813('0x44')]({'where':{'id':_0x3b0a72[_0x4813('0x3f')]['id']}})['then'](handleEntityNotFound(_0x496f83,null))[_0x4813('0x20')](removeEntity(_0x496f83,null))['catch'](handleError(_0x496f83,null));};exports[_0x4813('0x45')]=function(_0x36e9f6,_0x44c221,_0x56a90b){var _0x5dfd1c={};var _0x141058={};var _0x27770e;var _0x40407b;return db['FreshsalesAccount'][_0x4813('0x46')]({'where':{'id':_0x36e9f6[_0x4813('0x3f')]['id']}})[_0x4813('0x20')](handleEntityNotFound(_0x44c221,null))[_0x4813('0x20')](function(_0x42d06d){if(_0x42d06d){_0x27770e=_0x42d06d;_0x141058[_0x4813('0x2b')]=_[_0x4813('0x2d')](db[_0x4813('0x47')][_0x4813('0x28')]);_0x141058['query']=_[_0x4813('0x2d')](_0x36e9f6[_0x4813('0x2c')]);_0x141058['filters']=_[_0x4813('0x30')](_0x141058[_0x4813('0x2b')],_0x141058['query']);_0x5dfd1c[_0x4813('0x2f')]=_[_0x4813('0x30')](_0x141058[_0x4813('0x2b')],qs[_0x4813('0x31')](_0x36e9f6[_0x4813('0x2c')][_0x4813('0x31')]));_0x5dfd1c['attributes']=_0x5dfd1c[_0x4813('0x2f')][_0x4813('0x32')]?_0x5dfd1c[_0x4813('0x2f')]:_0x141058['model'];_0x5dfd1c['order']=qs[_0x4813('0x36')](_0x36e9f6[_0x4813('0x2c')][_0x4813('0x36')]);_0x5dfd1c[_0x4813('0x38')]=qs[_0x4813('0x2e')](_['pick'](_0x36e9f6[_0x4813('0x2c')],_0x141058[_0x4813('0x2e')]));if(_0x36e9f6['query']['filter']){_0x5dfd1c[_0x4813('0x38')]=_[_0x4813('0x41')](_0x5dfd1c['where'],{'$or':_[_0x4813('0x26')](_0x5dfd1c[_0x4813('0x2f')],function(_0x4fe49f){var _0x354445={};_0x354445[_0x4fe49f]={'$like':'%'+_0x36e9f6[_0x4813('0x2c')]['filter']+'%'};return _0x354445;})});}_0x5dfd1c=_[_0x4813('0x41')]({},_0x5dfd1c,_0x36e9f6[_0x4813('0x3b')]);return _0x27770e['getConfigurations'](_0x5dfd1c);}})['then'](function(_0x24b57e){if(_0x24b57e){_0x40407b=_0x24b57e[_0x4813('0x32')];if(!_0x36e9f6[_0x4813('0x2c')][_0x4813('0x33')](_0x4813('0x34'))){_0x5dfd1c[_0x4813('0x19')]=qs['limit'](_0x36e9f6[_0x4813('0x2c')][_0x4813('0x19')]);_0x5dfd1c[_0x4813('0x1c')]=qs[_0x4813('0x1c')](_0x36e9f6[_0x4813('0x2c')][_0x4813('0x1c')]);}return _0x27770e[_0x4813('0x45')](_0x5dfd1c);}})['then'](function(_0x5b3996){if(_0x5b3996){return _0x5b3996?{'count':_0x40407b,'rows':_0x5b3996}:null;}})[_0x4813('0x20')](respondWithResult(_0x44c221,null))[_0x4813('0x48')](handleError(_0x44c221,null));};exports[_0x4813('0x49')]=function(_0x156444,_0x2c7b3c,_0x3035a5){if(_0x156444[_0x4813('0x43')]['id']){delete _0x156444['body']['id'];}return db[_0x4813('0x27')][_0x4813('0x46')]({'where':{'id':_0x156444[_0x4813('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2c7b3c,null))[_0x4813('0x20')](function(_0x354b6a){if(_0x354b6a){_0x156444[_0x4813('0x43')][_0x4813('0x4a')]=_0x354b6a['id'];_0x156444[_0x4813('0x43')]['Subjects']=integrations[_0x4813('0x4b')](_0x156444[_0x4813('0x43')][_0x4813('0x4c')],_0x156444[_0x4813('0x43')][_0x4813('0x2a')]);_0x156444[_0x4813('0x43')]['Descriptions']=integrations[_0x4813('0x4d')](_0x156444['body'][_0x4813('0x4c')],_0x156444[_0x4813('0x43')][_0x4813('0x2a')]);return db[_0x4813('0x47')][_0x4813('0x42')](_0x156444['body'],{'include':[{'model':db[_0x4813('0x4e')],'as':_0x4813('0x4f')},{'model':db[_0x4813('0x4e')],'as':_0x4813('0x50')}]});}return null;})['then'](respondWithResult(_0x2c7b3c,null))[_0x4813('0x48')](handleError(_0x2c7b3c,null));};exports[_0x4813('0x51')]=function(_0x26306e,_0x4d3ffc,_0x4ecc51){var _0x522fc6='';var _0x314ea8='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x26306e[_0x4813('0x3f')]['id']},'attributes':['id',_0x4813('0x52'),_0x4813('0x53'),_0x4813('0x54')]})[_0x4813('0x20')](handleEntityNotFound(_0x4d3ffc,null))[_0x4813('0x20')](function(_0x3cc258){if(_0x3cc258){_0x314ea8=_0x3cc258[_0x4813('0x52')];_0x522fc6=_0x3cc258[_0x4813('0x53')];var _0x4311dc=_0x3cc258[_0x4813('0x53')]['slice'](-0x1);if(_0x4311dc==='/'){_0x522fc6=_0x522fc6['substring'](0x0,_0x522fc6[_0x4813('0x55')](_0x4311dc));}return rp({'method':'GET','uri':util[_0x4813('0x56')](_0x4813('0x57'),_0x522fc6,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x3cc258[_0x4813('0x54')]},'json':!![]});}})[_0x4813('0x20')](function(_0xf9edf7){if(_0xf9edf7){var _0x3cc482=_0xf9edf7[_0x4813('0x58')];var _0x216868=![];var _0x3a4589=null;for(_0x3a4589=0x0;_0x3a4589<_0x3cc482[_0x4813('0x32')];_0x3a4589++){if(_0x3cc482[_0x3a4589][_0x4813('0x59')]===_0x314ea8){_0x216868=!![];}}if(_0x216868){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x4813('0x20')](respondWithResult(_0x4d3ffc,null))[_0x4813('0x48')](function(_0x16e414){var _0x54ff26=_0x26306e[_0x4813('0x2c')][_0x4813('0x5a')]?0x1f4:_0x16e414[_0x4813('0x5b')]||0x1f4;logger[_0x4813('0x22')](_0x4813('0x5c'),_0x4813('0x51'),_0x54ff26,JSON['stringify'](_0x16e414));delete _0x16e414['name'];if(_0x54ff26===0x191){_0x54ff26=0x190;}_0x4d3ffc[_0x4813('0x17')](_0x54ff26)[_0x4813('0x24')](_0x26306e[_0x4813('0x2c')][_0x4813('0x5a')]?{'message':'Wrong\x20credentials','statusCode':_0x16e414['statusCode']}:_0x16e414);});}; \ No newline at end of file +var _0xd876=['where','pick','type','VIRTUAL','filter','options','FreshsalesAccount','includeAll','include','findAll','rows','catch','show','merge','find','create','body','getConfigurations','findOne','params','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd876,0x102));var _0x6d87=function(_0x47ebd3,_0x594278){_0x47ebd3=_0x47ebd3-0x0;var _0x2ee3cd=_0xd876[_0x47ebd3];return _0x2ee3cd;};'use strict';var emlformat=require(_0x6d87('0x0'));var rimraf=require(_0x6d87('0x1'));var zipdir=require(_0x6d87('0x2'));var jsonpatch=require(_0x6d87('0x3'));var rp=require(_0x6d87('0x4'));var moment=require('moment');var BPromise=require(_0x6d87('0x5'));var Mustache=require('mustache');var util=require(_0x6d87('0x6'));var path=require(_0x6d87('0x7'));var sox=require(_0x6d87('0x8'));var csv=require('to-csv');var ejs=require(_0x6d87('0x9'));var fs=require('fs');var fs_extra=require(_0x6d87('0xa'));var _=require('lodash');var squel=require(_0x6d87('0xb'));var crypto=require(_0x6d87('0xc'));var jsforce=require(_0x6d87('0xd'));var deskjs=require(_0x6d87('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6d87('0xf'));var Papa=require('papaparse');var Redis=require(_0x6d87('0x10'));var authService=require(_0x6d87('0x11'));var qs=require(_0x6d87('0x12'));var as=require(_0x6d87('0x13'));var hardwareService=require(_0x6d87('0x14'));var logger=require(_0x6d87('0x15'))(_0x6d87('0x16'));var utils=require('../../config/utils');var config=require(_0x6d87('0x17'));var licenseUtil=require(_0x6d87('0x18'));var db=require(_0x6d87('0x19'))['db'];var integrations=require(_0x6d87('0x1a'));function respondWithStatusCode(_0x71748e,_0x3b03bc){_0x3b03bc=_0x3b03bc||0xcc;return function(_0x113867){if(_0x113867){return _0x71748e[_0x6d87('0x1b')](_0x3b03bc);}return _0x71748e[_0x6d87('0x1c')](_0x3b03bc)[_0x6d87('0x1d')]();};}function respondWithResult(_0x29203b,_0x2f232d){_0x2f232d=_0x2f232d||0xc8;return function(_0x15d0e5){if(_0x15d0e5){return _0x29203b[_0x6d87('0x1c')](_0x2f232d)[_0x6d87('0x1e')](_0x15d0e5);}};}function respondWithFilteredResult(_0xdd8364,_0x1aa659){return function(_0x8d38ab){if(_0x8d38ab){var _0x312a34=typeof _0x1aa659[_0x6d87('0x1f')]===_0x6d87('0x20')&&typeof _0x1aa659[_0x6d87('0x21')]===_0x6d87('0x20');var _0x2cc17f=_0x8d38ab[_0x6d87('0x22')];var _0x44a1a1=_0x312a34?0x0:_0x1aa659['offset'];var _0x5b2dae=_0x312a34?_0x8d38ab['count']:_0x1aa659[_0x6d87('0x1f')]+_0x1aa659[_0x6d87('0x21')];var _0xd73d32;if(_0x5b2dae>=_0x2cc17f){_0x5b2dae=_0x2cc17f;_0xd73d32=0xc8;}else{_0xd73d32=0xce;}_0xdd8364[_0x6d87('0x1c')](_0xd73d32);return _0xdd8364['set']('Content-Range',_0x44a1a1+'-'+_0x5b2dae+'/'+_0x2cc17f)['json'](_0x8d38ab);}return null;};}function patchUpdates(_0x9d7480){return function(_0x24f4ac){try{jsonpatch[_0x6d87('0x23')](_0x24f4ac,_0x9d7480,!![]);}catch(_0x2f7c63){return BPromise[_0x6d87('0x24')](_0x2f7c63);}return _0x24f4ac[_0x6d87('0x25')]();};}function saveUpdates(_0x2a4ba0,_0x33fd40){return function(_0x9211cc){if(_0x9211cc){return _0x9211cc[_0x6d87('0x26')](_0x2a4ba0)[_0x6d87('0x27')](function(_0x37a42c){return _0x37a42c;});}return null;};}function removeEntity(_0x5f3bc2,_0xf085b1){return function(_0x984bd1){if(_0x984bd1){return _0x984bd1[_0x6d87('0x28')]()[_0x6d87('0x27')](function(){_0x5f3bc2['status'](0xcc)[_0x6d87('0x1d')]();});}};}function handleEntityNotFound(_0x186c62,_0x882685){return function(_0x1d3819){if(!_0x1d3819){_0x186c62[_0x6d87('0x1b')](0x194);}return _0x1d3819;};}function handleError(_0x31fc5c,_0x3630f4){_0x3630f4=_0x3630f4||0x1f4;return function(_0x2cc3ea){logger[_0x6d87('0x29')](_0x2cc3ea[_0x6d87('0x2a')]);if(_0x2cc3ea[_0x6d87('0x2b')]){delete _0x2cc3ea[_0x6d87('0x2b')];}_0x31fc5c['status'](_0x3630f4)['send'](_0x2cc3ea);};}exports[_0x6d87('0x2c')]=function(_0x4e9268,_0x76017f){var _0xbcd64f={},_0x4fbc20={},_0x22c6f6={'count':0x0,'rows':[]};var _0x415568=_[_0x6d87('0x2d')](db['FreshsalesAccount'][_0x6d87('0x2e')],function(_0x48400f){return{'name':_0x48400f['fieldName'],'type':_0x48400f['type'][_0x6d87('0x2f')]};});_0x4fbc20[_0x6d87('0x30')]=_[_0x6d87('0x2d')](_0x415568,'name');_0x4fbc20[_0x6d87('0x31')]=_[_0x6d87('0x32')](_0x4e9268[_0x6d87('0x31')]);_0x4fbc20[_0x6d87('0x33')]=_[_0x6d87('0x34')](_0x4fbc20[_0x6d87('0x30')],_0x4fbc20[_0x6d87('0x31')]);_0xbcd64f['attributes']=_[_0x6d87('0x34')](_0x4fbc20[_0x6d87('0x30')],qs[_0x6d87('0x35')](_0x4e9268[_0x6d87('0x31')]['fields']));_0xbcd64f[_0x6d87('0x36')]=_0xbcd64f[_0x6d87('0x36')][_0x6d87('0x37')]?_0xbcd64f[_0x6d87('0x36')]:_0x4fbc20[_0x6d87('0x30')];if(!_0x4e9268['query'][_0x6d87('0x38')](_0x6d87('0x39'))){_0xbcd64f[_0x6d87('0x21')]=qs[_0x6d87('0x21')](_0x4e9268[_0x6d87('0x31')]['limit']);_0xbcd64f['offset']=qs['offset'](_0x4e9268['query']['offset']);}_0xbcd64f[_0x6d87('0x3a')]=qs[_0x6d87('0x3b')](_0x4e9268[_0x6d87('0x31')][_0x6d87('0x3b')]);_0xbcd64f[_0x6d87('0x3c')]=qs[_0x6d87('0x33')](_[_0x6d87('0x3d')](_0x4e9268[_0x6d87('0x31')],_0x4fbc20[_0x6d87('0x33')]),_0x415568);if(_0x4e9268[_0x6d87('0x31')]['filter']){_0xbcd64f[_0x6d87('0x3c')]=_['merge'](_0xbcd64f[_0x6d87('0x3c')],{'$or':_['map'](_0x415568,function(_0x23b4e3){if(_0x23b4e3[_0x6d87('0x3e')]!==_0x6d87('0x3f')){var _0x2f9bae={};_0x2f9bae[_0x23b4e3[_0x6d87('0x2b')]]={'$like':'%'+_0x4e9268['query'][_0x6d87('0x40')]+'%'};return _0x2f9bae;}})});}_0xbcd64f=_['merge']({},_0xbcd64f,_0x4e9268[_0x6d87('0x41')]);var _0x36262b={'where':_0xbcd64f[_0x6d87('0x3c')]};return db[_0x6d87('0x42')][_0x6d87('0x22')](_0x36262b)[_0x6d87('0x27')](function(_0x4e4ac5){_0x22c6f6[_0x6d87('0x22')]=_0x4e4ac5;if(_0x4e9268[_0x6d87('0x31')][_0x6d87('0x43')]){_0xbcd64f[_0x6d87('0x44')]=[{'all':!![]}];}return db[_0x6d87('0x42')][_0x6d87('0x45')](_0xbcd64f);})[_0x6d87('0x27')](function(_0x35ba8f){_0x22c6f6[_0x6d87('0x46')]=_0x35ba8f;return _0x22c6f6;})[_0x6d87('0x27')](respondWithFilteredResult(_0x76017f,_0xbcd64f))[_0x6d87('0x47')](handleError(_0x76017f,null));};exports[_0x6d87('0x48')]=function(_0x3a2c1d,_0x1ca6d2){var _0x24b69c={'raw':![],'where':{'id':_0x3a2c1d['params']['id']}},_0x4db9a9={};_0x4db9a9[_0x6d87('0x30')]=_[_0x6d87('0x32')](db[_0x6d87('0x42')]['rawAttributes']);_0x4db9a9['query']=_[_0x6d87('0x32')](_0x3a2c1d['query']);_0x4db9a9[_0x6d87('0x33')]=_[_0x6d87('0x34')](_0x4db9a9['model'],_0x4db9a9['query']);_0x24b69c['attributes']=_[_0x6d87('0x34')](_0x4db9a9[_0x6d87('0x30')],qs['fields'](_0x3a2c1d[_0x6d87('0x31')][_0x6d87('0x35')]));_0x24b69c[_0x6d87('0x36')]=_0x24b69c[_0x6d87('0x36')][_0x6d87('0x37')]?_0x24b69c[_0x6d87('0x36')]:_0x4db9a9['model'];if(_0x3a2c1d['query'][_0x6d87('0x43')]){_0x24b69c[_0x6d87('0x44')]=[{'all':!![]}];}_0x24b69c=_[_0x6d87('0x49')]({},_0x24b69c,_0x3a2c1d[_0x6d87('0x41')]);return db[_0x6d87('0x42')][_0x6d87('0x4a')](_0x24b69c)[_0x6d87('0x27')](handleEntityNotFound(_0x1ca6d2,null))[_0x6d87('0x27')](respondWithResult(_0x1ca6d2,null))[_0x6d87('0x47')](handleError(_0x1ca6d2,null));};exports['create']=function(_0x2b5d2b,_0x4d7463){return db['FreshsalesAccount'][_0x6d87('0x4b')](_0x2b5d2b[_0x6d87('0x4c')],{})[_0x6d87('0x27')](respondWithResult(_0x4d7463,0xc9))[_0x6d87('0x47')](handleError(_0x4d7463,null));};exports[_0x6d87('0x26')]=function(_0x24d9c7,_0x17db63){if(_0x24d9c7['body']['id']){delete _0x24d9c7[_0x6d87('0x4c')]['id'];}return db[_0x6d87('0x42')][_0x6d87('0x4a')]({'where':{'id':_0x24d9c7['params']['id']}})[_0x6d87('0x27')](handleEntityNotFound(_0x17db63,null))['then'](saveUpdates(_0x24d9c7[_0x6d87('0x4c')],null))[_0x6d87('0x27')](respondWithResult(_0x17db63,null))['catch'](handleError(_0x17db63,null));};exports[_0x6d87('0x28')]=function(_0x155b0c,_0x13db03){return db[_0x6d87('0x42')][_0x6d87('0x4a')]({'where':{'id':_0x155b0c['params']['id']}})[_0x6d87('0x27')](handleEntityNotFound(_0x13db03,null))[_0x6d87('0x27')](removeEntity(_0x13db03,null))[_0x6d87('0x47')](handleError(_0x13db03,null));};exports[_0x6d87('0x4d')]=function(_0x4158c1,_0x17da93,_0x52ecf2){var _0x2abf65={};var _0x4d6c65={};var _0x34b199;var _0x52a1c8;return db[_0x6d87('0x42')][_0x6d87('0x4e')]({'where':{'id':_0x4158c1[_0x6d87('0x4f')]['id']}})[_0x6d87('0x27')](handleEntityNotFound(_0x17da93,null))[_0x6d87('0x27')](function(_0x279192){if(_0x279192){_0x34b199=_0x279192;_0x4d6c65[_0x6d87('0x30')]=_[_0x6d87('0x32')](db[_0x6d87('0x50')][_0x6d87('0x2e')]);_0x4d6c65[_0x6d87('0x31')]=_['keys'](_0x4158c1[_0x6d87('0x31')]);_0x4d6c65[_0x6d87('0x33')]=_[_0x6d87('0x34')](_0x4d6c65['model'],_0x4d6c65['query']);_0x2abf65[_0x6d87('0x36')]=_[_0x6d87('0x34')](_0x4d6c65[_0x6d87('0x30')],qs[_0x6d87('0x35')](_0x4158c1['query'][_0x6d87('0x35')]));_0x2abf65[_0x6d87('0x36')]=_0x2abf65[_0x6d87('0x36')]['length']?_0x2abf65[_0x6d87('0x36')]:_0x4d6c65[_0x6d87('0x30')];_0x2abf65[_0x6d87('0x3a')]=qs[_0x6d87('0x3b')](_0x4158c1[_0x6d87('0x31')][_0x6d87('0x3b')]);_0x2abf65[_0x6d87('0x3c')]=qs[_0x6d87('0x33')](_['pick'](_0x4158c1[_0x6d87('0x31')],_0x4d6c65[_0x6d87('0x33')]));if(_0x4158c1['query'][_0x6d87('0x40')]){_0x2abf65[_0x6d87('0x3c')]=_[_0x6d87('0x49')](_0x2abf65['where'],{'$or':_['map'](_0x2abf65[_0x6d87('0x36')],function(_0x415009){var _0x56fa81={};_0x56fa81[_0x415009]={'$like':'%'+_0x4158c1['query']['filter']+'%'};return _0x56fa81;})});}_0x2abf65=_['merge']({},_0x2abf65,_0x4158c1[_0x6d87('0x41')]);return _0x34b199['getConfigurations'](_0x2abf65);}})[_0x6d87('0x27')](function(_0x4dfc8c){if(_0x4dfc8c){_0x52a1c8=_0x4dfc8c['length'];if(!_0x4158c1[_0x6d87('0x31')]['hasOwnProperty'](_0x6d87('0x39'))){_0x2abf65[_0x6d87('0x21')]=qs[_0x6d87('0x21')](_0x4158c1[_0x6d87('0x31')][_0x6d87('0x21')]);_0x2abf65[_0x6d87('0x1f')]=qs[_0x6d87('0x1f')](_0x4158c1[_0x6d87('0x31')][_0x6d87('0x1f')]);}return _0x34b199[_0x6d87('0x4d')](_0x2abf65);}})['then'](function(_0x4b5d22){if(_0x4b5d22){return _0x4b5d22?{'count':_0x52a1c8,'rows':_0x4b5d22}:null;}})[_0x6d87('0x27')](respondWithResult(_0x17da93,null))['catch'](handleError(_0x17da93,null));};exports[_0x6d87('0x51')]=function(_0xb15a5c,_0x3815af,_0x4d2a46){if(_0xb15a5c['body']['id']){delete _0xb15a5c[_0x6d87('0x4c')]['id'];}return db[_0x6d87('0x42')][_0x6d87('0x4e')]({'where':{'id':_0xb15a5c[_0x6d87('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3815af,null))[_0x6d87('0x27')](function(_0x3e9dd4){if(_0x3e9dd4){_0xb15a5c[_0x6d87('0x4c')][_0x6d87('0x52')]=_0x3e9dd4['id'];_0xb15a5c[_0x6d87('0x4c')][_0x6d87('0x53')]=integrations[_0x6d87('0x54')](_0xb15a5c[_0x6d87('0x4c')][_0x6d87('0x55')],_0xb15a5c[_0x6d87('0x4c')][_0x6d87('0x3e')]);_0xb15a5c[_0x6d87('0x4c')][_0x6d87('0x56')]=integrations[_0x6d87('0x57')](_0xb15a5c['body']['channel'],_0xb15a5c[_0x6d87('0x4c')][_0x6d87('0x3e')]);return db[_0x6d87('0x50')][_0x6d87('0x4b')](_0xb15a5c[_0x6d87('0x4c')],{'include':[{'model':db['FreshsalesField'],'as':_0x6d87('0x53')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0x6d87('0x27')](respondWithResult(_0x3815af,null))[_0x6d87('0x47')](handleError(_0x3815af,null));};exports[_0x6d87('0x58')]=function(_0x2fcc50,_0x11586a,_0x2cfcb4){var _0x207b32='';var _0x15aa47='';return db['FreshsalesAccount'][_0x6d87('0x4e')]({'where':{'id':_0x2fcc50[_0x6d87('0x4f')]['id']},'attributes':['id',_0x6d87('0x59'),'remoteUri',_0x6d87('0x5a')]})['then'](handleEntityNotFound(_0x11586a,null))[_0x6d87('0x27')](function(_0x448699){if(_0x448699){_0x15aa47=_0x448699[_0x6d87('0x59')];_0x207b32=_0x448699['remoteUri'];var _0x1b212c=_0x448699[_0x6d87('0x5b')][_0x6d87('0x5c')](-0x1);if(_0x1b212c==='/'){_0x207b32=_0x207b32[_0x6d87('0x5d')](0x0,_0x207b32[_0x6d87('0x5e')](_0x1b212c));}return rp({'method':_0x6d87('0x5f'),'uri':util[_0x6d87('0x60')](_0x6d87('0x61'),_0x207b32,_0x6d87('0x62')),'headers':{'Authorization':_0x6d87('0x63')+_0x448699[_0x6d87('0x5a')]},'json':!![]});}})['then'](function(_0x46c4aa){if(_0x46c4aa){var _0x39339d=_0x46c4aa[_0x6d87('0x64')];var _0x53a9d0=![];var _0x315206=null;for(_0x315206=0x0;_0x315206<_0x39339d['length'];_0x315206++){if(_0x39339d[_0x315206][_0x6d87('0x65')]===_0x15aa47){_0x53a9d0=!![];}}if(_0x53a9d0){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x6d87('0x66')});}}})[_0x6d87('0x27')](respondWithResult(_0x11586a,null))[_0x6d87('0x47')](function(_0x2b406a){var _0x54fef2=_0x2fcc50[_0x6d87('0x31')][_0x6d87('0x67')]?0x1f4:_0x2b406a['statusCode']||0x1f4;logger[_0x6d87('0x29')](_0x6d87('0x68'),_0x6d87('0x58'),_0x54fef2,JSON['stringify'](_0x2b406a));delete _0x2b406a[_0x6d87('0x2b')];if(_0x54fef2===0x191){_0x54fef2=0x190;}_0x11586a[_0x6d87('0x1c')](_0x54fef2)['send'](_0x2fcc50['query'][_0x6d87('0x67')]?{'message':_0x6d87('0x69'),'statusCode':_0x2b406a['statusCode']}:_0x2b406a);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index a7b66c6..e898e0d 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 _0xd117=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x81f6fa,_0x47177b){var _0x36cdb5=function(_0x17377e){while(--_0x17377e){_0x81f6fa['push'](_0x81f6fa['shift']());}};_0x36cdb5(++_0x47177b);}(_0xd117,0x182));var _0x7d11=function(_0xe4d6c6,_0x3bdbf2){_0xe4d6c6=_0xe4d6c6-0x0;var _0x3a8935=_0xd117[_0xe4d6c6];return _0x3a8935;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var logger=require(_0x7d11('0x2'))(_0x7d11('0x3'));var moment=require(_0x7d11('0x4'));var BPromise=require(_0x7d11('0x5'));var rp=require(_0x7d11('0x6'));var fs=require('fs');var path=require(_0x7d11('0x7'));var rimraf=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var attributes=require(_0x7d11('0xa'));var integrations=require(_0x7d11('0xb'));module[_0x7d11('0xc')]=function(_0x40c3c4,_0x345602){return _0x40c3c4[_0x7d11('0xd')]('FreshsalesAccount',attributes,{'tableName':_0x7d11('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2e3=['int_freshsales_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','exports','define','FreshsalesAccount'];(function(_0xc82b22,_0x1cc5b6){var _0x382e4e=function(_0xd049f3){while(--_0xd049f3){_0xc82b22['push'](_0xc82b22['shift']());}};_0x382e4e(++_0x1cc5b6);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xf2e3[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var logger=require(_0x3f2e('0x1'))(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var rp=require(_0x3f2e('0x5'));var fs=require('fs');var path=require(_0x3f2e('0x6'));var rimraf=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var attributes=require(_0x3f2e('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x3f2e('0xa')]=function(_0xdd6b3e,_0x3c0864){return _0xdd6b3e[_0x3f2e('0xb')](_0x3f2e('0xc'),attributes,{'tableName':_0x3f2e('0xd'),'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 27c8b60..ed0ba64 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 _0xef0f=['FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','include','model','attributes','map','ShowFreshsalesAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x47746e,_0x5e6ee3){var _0x5d0860=function(_0x5bbd83){while(--_0x5bbd83){_0x47746e['push'](_0x47746e['shift']());}};_0x5d0860(++_0x5e6ee3);}(_0xef0f,0x168));var _0xfef0=function(_0x10b253,_0x5acad5){_0x10b253=_0x10b253-0x0;var _0x5c08fb=_0xef0f[_0x10b253];return _0x5c08fb;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});}exports[_0xfef0('0x18')]=function(_0x581459){var _0xd60678=this;return new Promise(function(_0x1642cd,_0x1577fa){return db[_0xfef0('0x19')][_0xfef0('0x1a')]({'raw':_0x581459['options']?_0x581459[_0xfef0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x581459[_0xfef0('0x1b')]?_0x581459[_0xfef0('0x1b')][_0xfef0('0x1c')]||null:null,'attributes':_0x581459['options']?_0x581459[_0xfef0('0x1b')]['attributes']||null:null,'limit':_0x581459[_0xfef0('0x1b')]?_0x581459[_0xfef0('0x1b')]['limit']||null:null,'include':_0x581459['options']?_0x581459['options'][_0xfef0('0x1d')]?_['map'](_0x581459[_0xfef0('0x1b')][_0xfef0('0x1d')],function(_0x1a8d66){return{'model':db[_0x1a8d66[_0xfef0('0x1e')]],'as':_0x1a8d66['as'],'attributes':_0x1a8d66[_0xfef0('0x1f')],'include':_0x1a8d66[_0xfef0('0x1d')]?_['map'](_0x1a8d66['include'],function(_0x316e20){return{'model':db[_0x316e20[_0xfef0('0x1e')]],'as':_0x316e20['as'],'attributes':_0x316e20[_0xfef0('0x1f')],'include':_0x316e20[_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x316e20[_0xfef0('0x1d')],function(_0x5df04f){return{'model':db[_0x5df04f[_0xfef0('0x1e')]],'as':_0x5df04f['as'],'attributes':_0x5df04f[_0xfef0('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a6758){logger[_0xfef0('0xd')](_0xfef0('0x18'),_0x581459);logger[_0xfef0('0x10')](_0xfef0('0x18'),_0x581459,JSON[_0xfef0('0x12')](_0x1a6758));_0x1642cd(_0x1a6758);})[_0xfef0('0x17')](function(_0x3e026a){logger[_0xfef0('0x13')](_0xfef0('0x18'),_0x3e026a[_0xfef0('0x15')],_0x581459);_0x1577fa(_0xd60678[_0xfef0('0x13')](0x1f4,_0x3e026a['message']));});});};exports[_0xfef0('0x21')]=function(_0x5806bd){var _0x4eaf74=this;return new Promise(function(_0x7d1692,_0x2ae54a){return db['FreshsalesAccount']['find']({'raw':_0x5806bd['options']?_0x5806bd['options']['raw']===undefined?!![]:![]:!![],'where':_0x5806bd[_0xfef0('0x1b')]?_0x5806bd[_0xfef0('0x1b')][_0xfef0('0x1c')]||null:null,'attributes':_0x5806bd['options']?_0x5806bd['options']['attributes']||null:null,'include':_0x5806bd[_0xfef0('0x1b')]?_0x5806bd['options'][_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x5806bd[_0xfef0('0x1b')]['include'],function(_0x3cad13){return{'model':db[_0x3cad13['model']],'as':_0x3cad13['as'],'attributes':_0x3cad13[_0xfef0('0x1f')],'include':_0x3cad13[_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x3cad13[_0xfef0('0x1d')],function(_0x3e1a64){return{'model':db[_0x3e1a64[_0xfef0('0x1e')]],'as':_0x3e1a64['as'],'attributes':_0x3e1a64[_0xfef0('0x1f')],'include':_0x3e1a64[_0xfef0('0x1d')]?_['map'](_0x3e1a64[_0xfef0('0x1d')],function(_0xea09ec){return{'model':db[_0xea09ec[_0xfef0('0x1e')]],'as':_0xea09ec['as'],'attributes':_0xea09ec[_0xfef0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfef0('0xc')](function(_0x262341){logger[_0xfef0('0xd')](_0xfef0('0x21'),_0x5806bd);logger[_0xfef0('0x10')](_0xfef0('0x21'),_0x5806bd,JSON[_0xfef0('0x12')](_0x262341));_0x7d1692(_0x262341);})[_0xfef0('0x17')](function(_0x366667){logger['error'](_0xfef0('0x21'),_0x366667['message'],_0x5806bd);_0x2ae54a(_0x4eaf74[_0xfef0('0x13')](0x1f4,_0x366667[_0xfef0('0x15')]));});});}; \ No newline at end of file +var _0x5c3c=['find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','limit','include','map','model','attributes','debug','catch','ShowFreshsalesAccount'];(function(_0x5b89c2,_0x55a198){var _0x2e35d5=function(_0x2952c9){while(--_0x2952c9){_0x5b89c2['push'](_0x5b89c2['shift']());}};_0x2e35d5(++_0x55a198);}(_0x5c3c,0x132));var _0xc5c3=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x5c3c[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});}exports[_0xc5c3('0x17')]=function(_0x2ff158){var _0x13c867=this;return new Promise(function(_0x28bae6,_0x5e11d5){return db[_0xc5c3('0x18')][_0xc5c3('0x19')]({'raw':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1b')]||null:null,'attributes':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')]['attributes']||null:null,'limit':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1c')]||null:null,'include':_0x2ff158[_0xc5c3('0x1a')]?_0x2ff158[_0xc5c3('0x1a')][_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x2ff158['options']['include'],function(_0x45affe){return{'model':db[_0x45affe[_0xc5c3('0x1f')]],'as':_0x45affe['as'],'attributes':_0x45affe['attributes'],'include':_0x45affe['include']?_[_0xc5c3('0x1e')](_0x45affe[_0xc5c3('0x1d')],function(_0x38a3df){return{'model':db[_0x38a3df['model']],'as':_0x38a3df['as'],'attributes':_0x38a3df['attributes'],'include':_0x38a3df[_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x38a3df[_0xc5c3('0x1d')],function(_0x29791c){return{'model':db[_0x29791c['model']],'as':_0x29791c['as'],'attributes':_0x29791c[_0xc5c3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2eacec){logger['info'](_0xc5c3('0x17'),_0x2ff158);logger[_0xc5c3('0x21')](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x2eacec));_0x28bae6(_0x2eacec);})[_0xc5c3('0x22')](function(_0x2d07e1){logger[_0xc5c3('0x12')]('GetFreshsalesAccount',_0x2d07e1[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x2d07e1[_0xc5c3('0x14')]));});});};exports[_0xc5c3('0x23')]=function(_0x5b26e9){var _0x4daa8b=this;return new Promise(function(_0x2e648f,_0x46f149){return db[_0xc5c3('0x18')][_0xc5c3('0x24')]({'raw':_0x5b26e9['options']?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x25')]===undefined?!![]:![]:!![],'where':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x1b')]||null:null,'attributes':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x20')]||null:null,'include':_0x5b26e9[_0xc5c3('0x1a')]?_0x5b26e9['options'][_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x5b26e9[_0xc5c3('0x1a')][_0xc5c3('0x1d')],function(_0x330391){return{'model':db[_0x330391[_0xc5c3('0x1f')]],'as':_0x330391['as'],'attributes':_0x330391[_0xc5c3('0x20')],'include':_0x330391['include']?_['map'](_0x330391[_0xc5c3('0x1d')],function(_0x55fccf){return{'model':db[_0x55fccf[_0xc5c3('0x1f')]],'as':_0x55fccf['as'],'attributes':_0x55fccf[_0xc5c3('0x20')],'include':_0x55fccf[_0xc5c3('0x1d')]?_[_0xc5c3('0x1e')](_0x55fccf[_0xc5c3('0x1d')],function(_0x498677){return{'model':db[_0x498677[_0xc5c3('0x1f')]],'as':_0x498677['as'],'attributes':_0x498677[_0xc5c3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29f57d){logger[_0xc5c3('0x15')](_0xc5c3('0x23'),_0x5b26e9);logger[_0xc5c3('0x21')](_0xc5c3('0x23'),_0x5b26e9,JSON[_0xc5c3('0x11')](_0x29f57d));_0x2e648f(_0x29f57d);})[_0xc5c3('0x22')](function(_0x2ad440){logger[_0xc5c3('0x12')](_0xc5c3('0x23'),_0x2ad440['message'],_0x5b26e9);_0x46f149(_0x4daa8b[_0xc5c3('0x12')](0x1f4,_0x2ad440['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index dd2f812..c550147 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 _0xb8b9=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','post','create','put','update','delete','destroy'];(function(_0x475b88,_0x3e3588){var _0x52081b=function(_0x30f208){while(--_0x30f208){_0x475b88['push'](_0x475b88['shift']());}};_0x52081b(++_0x3e3588);}(_0xb8b9,0x1aa));var _0x9b8b=function(_0x458686,_0x336f6a){_0x458686=_0x458686-0x0;var _0x15e073=_0xb8b9[_0x458686];return _0x15e073;};'use strict';var multer=require(_0x9b8b('0x0'));var util=require(_0x9b8b('0x1'));var path=require(_0x9b8b('0x2'));var timeout=require(_0x9b8b('0x3'));var express=require('express');var router=express[_0x9b8b('0x4')]();var fs_extra=require(_0x9b8b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9b8b('0x6'));var config=require(_0x9b8b('0x7'));var controller=require(_0x9b8b('0x8'));router[_0x9b8b('0x9')]('/',auth[_0x9b8b('0xa')](),controller[_0x9b8b('0xb')]);router[_0x9b8b('0x9')](_0x9b8b('0xc'),auth[_0x9b8b('0xa')](),controller['show']);router['get'](_0x9b8b('0xd'),auth['isAuthenticated'](),controller[_0x9b8b('0xe')]);router['get'](_0x9b8b('0xf'),auth[_0x9b8b('0xa')](),controller['getDescriptions']);router[_0x9b8b('0x9')](_0x9b8b('0x10'),auth[_0x9b8b('0xa')](),controller[_0x9b8b('0x11')]);router[_0x9b8b('0x12')]('/',auth[_0x9b8b('0xa')](),controller[_0x9b8b('0x13')]);router[_0x9b8b('0x14')](_0x9b8b('0xc'),auth[_0x9b8b('0xa')](),controller[_0x9b8b('0x15')]);router[_0x9b8b('0x16')](_0x9b8b('0xc'),auth[_0x9b8b('0xa')](),controller[_0x9b8b('0x17')]);module[_0x9b8b('0x18')]=router; \ No newline at end of file +var _0xc8b8=['./intFreshsalesConfiguration.controller','get','index','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','create','put','update','delete','/:id','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1409f7,_0x590833){var _0x3babad=function(_0x271944){while(--_0x271944){_0x1409f7['push'](_0x1409f7['shift']());}};_0x3babad(++_0x590833);}(_0xc8b8,0x9a));var _0x8c8b=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0xc8b8[_0x29632e];return _0x426e04;};'use strict';var multer=require('multer');var util=require(_0x8c8b('0x0'));var path=require(_0x8c8b('0x1'));var timeout=require(_0x8c8b('0x2'));var express=require('express');var router=express[_0x8c8b('0x3')]();var fs_extra=require(_0x8c8b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8c8b('0x5'));var config=require(_0x8c8b('0x6'));var controller=require(_0x8c8b('0x7'));router[_0x8c8b('0x8')]('/',auth['isAuthenticated'](),controller[_0x8c8b('0x9')]);router[_0x8c8b('0x8')]('/:id',auth[_0x8c8b('0xa')](),controller[_0x8c8b('0xb')]);router[_0x8c8b('0x8')](_0x8c8b('0xc'),auth[_0x8c8b('0xa')](),controller[_0x8c8b('0xd')]);router['get'](_0x8c8b('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x8c8b('0x8')](_0x8c8b('0xf'),auth['isAuthenticated'](),controller[_0x8c8b('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8c8b('0x11')]);router[_0x8c8b('0x12')]('/:id',auth[_0x8c8b('0xa')](),controller[_0x8c8b('0x13')]);router[_0x8c8b('0x14')](_0x8c8b('0x15'),auth[_0x8c8b('0xa')](),controller['destroy']);module[_0x8c8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index fe7f1c5..f42a70b 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 _0x81bd=['sequelize','exports','STRING'];(function(_0x5e68f0,_0x181383){var _0x320008=function(_0x5cf8ac){while(--_0x5cf8ac){_0x5e68f0['push'](_0x5e68f0['shift']());}};_0x320008(++_0x181383);}(_0x81bd,0x183));var _0xd81b=function(_0x49d7ca,_0x514fc4){_0x49d7ca=_0x49d7ca-0x0;var _0x12422f=_0x81bd[_0x49d7ca];return _0x12422f;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd81b('0x2')]}}; \ No newline at end of file +var _0xa47b=['exports','STRING'];(function(_0x48e8e4,_0x340e38){var _0x334463=function(_0x4a689e){while(--_0x4a689e){_0x48e8e4['push'](_0x48e8e4['shift']());}};_0x334463(++_0x340e38);}(_0xa47b,0x1b0));var _0xba47=function(_0x3b82df,_0xf983aa){_0x3b82df=_0x3b82df-0x0;var _0x19fb0e=_0xa47b[_0x3b82df];return _0x19fb0e;};'use strict';var Sequelize=require('sequelize');module[_0xba47('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba47('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 125f2fe..ac160ce 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 _0xe6c1=['querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','name','send','index','map','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getSubjects','findOne','FreshsalesField','getDescriptions','options','getFields','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0xe6c1,0xd7));var _0x1e6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6c1[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x1e6c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1e6c('0x1'));var rp=require(_0x1e6c('0x2'));var moment=require(_0x1e6c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1e6c('0x4'));var util=require(_0x1e6c('0x5'));var path=require(_0x1e6c('0x6'));var sox=require(_0x1e6c('0x7'));var csv=require(_0x1e6c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e6c('0x9'));var squel=require(_0x1e6c('0xa'));var crypto=require('crypto');var jsforce=require(_0x1e6c('0xb'));var deskjs=require(_0x1e6c('0xc'));var toCsv=require(_0x1e6c('0x8'));var querystring=require(_0x1e6c('0xd'));var Papa=require(_0x1e6c('0xe'));var Redis=require('ioredis');var authService=require(_0x1e6c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1e6c('0x10'));var hardwareService=require(_0x1e6c('0x11'));var logger=require(_0x1e6c('0x12'))(_0x1e6c('0x13'));var utils=require(_0x1e6c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1e6c('0x15'));var db=require(_0x1e6c('0x16'))['db'];function respondWithStatusCode(_0x2cb648,_0x515e4f){_0x515e4f=_0x515e4f||0xcc;return function(_0x56405e){if(_0x56405e){return _0x2cb648[_0x1e6c('0x17')](_0x515e4f);}return _0x2cb648[_0x1e6c('0x18')](_0x515e4f)[_0x1e6c('0x19')]();};}function respondWithResult(_0x423c90,_0x2494cb){_0x2494cb=_0x2494cb||0xc8;return function(_0x52e8e4){if(_0x52e8e4){return _0x423c90[_0x1e6c('0x18')](_0x2494cb)['json'](_0x52e8e4);}};}function respondWithFilteredResult(_0x18b014,_0x5c3d54){return function(_0x493373){if(_0x493373){var _0x474153=typeof _0x5c3d54[_0x1e6c('0x1a')]===_0x1e6c('0x1b')&&typeof _0x5c3d54[_0x1e6c('0x1c')]==='undefined';var _0x2d1f49=_0x493373[_0x1e6c('0x1d')];var _0x1bdca8=_0x474153?0x0:_0x5c3d54[_0x1e6c('0x1a')];var _0x27ea7c=_0x474153?_0x493373[_0x1e6c('0x1d')]:_0x5c3d54[_0x1e6c('0x1a')]+_0x5c3d54['limit'];var _0x2d0360;if(_0x27ea7c>=_0x2d1f49){_0x27ea7c=_0x2d1f49;_0x2d0360=0xc8;}else{_0x2d0360=0xce;}_0x18b014['status'](_0x2d0360);return _0x18b014[_0x1e6c('0x1e')](_0x1e6c('0x1f'),_0x1bdca8+'-'+_0x27ea7c+'/'+_0x2d1f49)['json'](_0x493373);}return null;};}function patchUpdates(_0x54ecd9){return function(_0x369c12){try{jsonpatch['apply'](_0x369c12,_0x54ecd9,!![]);}catch(_0x432189){return BPromise[_0x1e6c('0x20')](_0x432189);}return _0x369c12['save']();};}function saveUpdates(_0xcc6e47,_0x510bc9){return function(_0x4b0bac){if(_0x4b0bac){return _0x4b0bac[_0x1e6c('0x21')](_0xcc6e47)[_0x1e6c('0x22')](function(_0x49c665){return _0x49c665;});}return null;};}function removeEntity(_0x59ba11,_0x555c5b){return function(_0x1a3b40){if(_0x1a3b40){return _0x1a3b40[_0x1e6c('0x23')]()['then'](function(){_0x59ba11[_0x1e6c('0x18')](0xcc)[_0x1e6c('0x19')]();});}};}function handleEntityNotFound(_0x33ad14,_0x45566f){return function(_0x51e4f0){if(!_0x51e4f0){_0x33ad14[_0x1e6c('0x17')](0x194);}return _0x51e4f0;};}function handleError(_0x4197d5,_0x530b94){_0x530b94=_0x530b94||0x1f4;return function(_0x307627){logger['error'](_0x307627['stack']);if(_0x307627[_0x1e6c('0x24')]){delete _0x307627[_0x1e6c('0x24')];}_0x4197d5['status'](_0x530b94)[_0x1e6c('0x25')](_0x307627);};}exports[_0x1e6c('0x26')]=function(_0x4a01e5,_0x26055f){var _0x5119d9={},_0x1c9761={},_0x5017d6={'count':0x0,'rows':[]};var _0x422b21=_[_0x1e6c('0x27')](db['FreshsalesConfiguration'][_0x1e6c('0x28')],function(_0x385701){return{'name':_0x385701['fieldName'],'type':_0x385701[_0x1e6c('0x29')]['key']};});_0x1c9761[_0x1e6c('0x2a')]=_[_0x1e6c('0x27')](_0x422b21,_0x1e6c('0x24'));_0x1c9761[_0x1e6c('0x2b')]=_['keys'](_0x4a01e5[_0x1e6c('0x2b')]);_0x1c9761[_0x1e6c('0x2c')]=_['intersection'](_0x1c9761[_0x1e6c('0x2a')],_0x1c9761[_0x1e6c('0x2b')]);_0x5119d9['attributes']=_[_0x1e6c('0x2d')](_0x1c9761['model'],qs['fields'](_0x4a01e5[_0x1e6c('0x2b')][_0x1e6c('0x2e')]));_0x5119d9[_0x1e6c('0x2f')]=_0x5119d9[_0x1e6c('0x2f')][_0x1e6c('0x30')]?_0x5119d9['attributes']:_0x1c9761[_0x1e6c('0x2a')];if(!_0x4a01e5[_0x1e6c('0x2b')][_0x1e6c('0x31')](_0x1e6c('0x32'))){_0x5119d9[_0x1e6c('0x1c')]=qs[_0x1e6c('0x1c')](_0x4a01e5['query']['limit']);_0x5119d9[_0x1e6c('0x1a')]=qs['offset'](_0x4a01e5['query']['offset']);}_0x5119d9[_0x1e6c('0x33')]=qs[_0x1e6c('0x34')](_0x4a01e5[_0x1e6c('0x2b')][_0x1e6c('0x34')]);_0x5119d9['where']=qs['filters'](_[_0x1e6c('0x35')](_0x4a01e5[_0x1e6c('0x2b')],_0x1c9761[_0x1e6c('0x2c')]),_0x422b21);if(_0x4a01e5[_0x1e6c('0x2b')][_0x1e6c('0x36')]){_0x5119d9[_0x1e6c('0x37')]=_[_0x1e6c('0x38')](_0x5119d9['where'],{'$or':_[_0x1e6c('0x27')](_0x422b21,function(_0x4ecdea){if(_0x4ecdea['type']!==_0x1e6c('0x39')){var _0x53f471={};_0x53f471[_0x4ecdea[_0x1e6c('0x24')]]={'$like':'%'+_0x4a01e5['query']['filter']+'%'};return _0x53f471;}})});}_0x5119d9=_[_0x1e6c('0x38')]({},_0x5119d9,_0x4a01e5['options']);var _0x3f3dab={'where':_0x5119d9['where']};return db[_0x1e6c('0x3a')]['count'](_0x3f3dab)[_0x1e6c('0x22')](function(_0x56af44){_0x5017d6[_0x1e6c('0x1d')]=_0x56af44;if(_0x4a01e5[_0x1e6c('0x2b')][_0x1e6c('0x3b')]){_0x5119d9[_0x1e6c('0x3c')]=[{'all':!![]}];}return db[_0x1e6c('0x3a')][_0x1e6c('0x3d')](_0x5119d9);})['then'](function(_0x20fad2){_0x5017d6[_0x1e6c('0x3e')]=_0x20fad2;return _0x5017d6;})[_0x1e6c('0x22')](respondWithFilteredResult(_0x26055f,_0x5119d9))[_0x1e6c('0x3f')](handleError(_0x26055f,null));};exports[_0x1e6c('0x40')]=function(_0x54d8f0,_0x2c87e8){var _0x182453={'raw':![],'where':{'id':_0x54d8f0[_0x1e6c('0x41')]['id']}},_0x5c8a5a={};_0x5c8a5a[_0x1e6c('0x2a')]=_[_0x1e6c('0x42')](db[_0x1e6c('0x3a')][_0x1e6c('0x28')]);_0x5c8a5a[_0x1e6c('0x2b')]=_['keys'](_0x54d8f0[_0x1e6c('0x2b')]);_0x5c8a5a[_0x1e6c('0x2c')]=_[_0x1e6c('0x2d')](_0x5c8a5a[_0x1e6c('0x2a')],_0x5c8a5a[_0x1e6c('0x2b')]);_0x182453[_0x1e6c('0x2f')]=_[_0x1e6c('0x2d')](_0x5c8a5a[_0x1e6c('0x2a')],qs[_0x1e6c('0x2e')](_0x54d8f0[_0x1e6c('0x2b')][_0x1e6c('0x2e')]));_0x182453['attributes']=_0x182453[_0x1e6c('0x2f')]['length']?_0x182453[_0x1e6c('0x2f')]:_0x5c8a5a[_0x1e6c('0x2a')];if(_0x54d8f0[_0x1e6c('0x2b')][_0x1e6c('0x3b')]){_0x182453[_0x1e6c('0x3c')]=[{'all':!![]}];}_0x182453=_[_0x1e6c('0x38')]({},_0x182453,_0x54d8f0['options']);return db[_0x1e6c('0x3a')][_0x1e6c('0x43')](_0x182453)[_0x1e6c('0x22')](handleEntityNotFound(_0x2c87e8,null))[_0x1e6c('0x22')](respondWithResult(_0x2c87e8,null))[_0x1e6c('0x3f')](handleError(_0x2c87e8,null));};exports[_0x1e6c('0x44')]=function(_0x480b87,_0x350091){return db[_0x1e6c('0x3a')][_0x1e6c('0x44')](_0x480b87[_0x1e6c('0x45')],{})[_0x1e6c('0x22')](respondWithResult(_0x350091,0xc9))[_0x1e6c('0x3f')](handleError(_0x350091,null));};exports[_0x1e6c('0x21')]=function(_0x86989d,_0x2cd6bb){if(_0x86989d[_0x1e6c('0x45')]['id']){delete _0x86989d[_0x1e6c('0x45')]['id'];}return db[_0x1e6c('0x3a')]['find']({'where':{'id':_0x86989d[_0x1e6c('0x41')]['id']}})['then'](handleEntityNotFound(_0x2cd6bb,null))[_0x1e6c('0x22')](saveUpdates(_0x86989d[_0x1e6c('0x45')],null))['then'](respondWithResult(_0x2cd6bb,null))[_0x1e6c('0x3f')](handleError(_0x2cd6bb,null));};exports['destroy']=function(_0x2cbc32,_0x59f3e4){return db[_0x1e6c('0x3a')][_0x1e6c('0x43')]({'where':{'id':_0x2cbc32[_0x1e6c('0x41')]['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x59f3e4,null))['then'](removeEntity(_0x59f3e4,null))['catch'](handleError(_0x59f3e4,null));};exports[_0x1e6c('0x46')]=function(_0x106243,_0xc7b95b,_0xcb1152){var _0x1dbed8={};var _0x10db6c={};var _0x4eef70;var _0x26d5cb;return db['FreshsalesConfiguration'][_0x1e6c('0x47')]({'where':{'id':_0x106243[_0x1e6c('0x41')]['id']}})['then'](handleEntityNotFound(_0xc7b95b,null))[_0x1e6c('0x22')](function(_0x317ebc){if(_0x317ebc){_0x4eef70=_0x317ebc;_0x10db6c[_0x1e6c('0x2a')]=_['keys'](db[_0x1e6c('0x48')][_0x1e6c('0x28')]);_0x10db6c[_0x1e6c('0x2b')]=_[_0x1e6c('0x42')](_0x106243[_0x1e6c('0x2b')]);_0x10db6c[_0x1e6c('0x2c')]=_[_0x1e6c('0x2d')](_0x10db6c[_0x1e6c('0x2a')],_0x10db6c[_0x1e6c('0x2b')]);_0x1dbed8[_0x1e6c('0x2f')]=_[_0x1e6c('0x2d')](_0x10db6c[_0x1e6c('0x2a')],qs['fields'](_0x106243[_0x1e6c('0x2b')][_0x1e6c('0x2e')]));_0x1dbed8[_0x1e6c('0x2f')]=_0x1dbed8[_0x1e6c('0x2f')][_0x1e6c('0x30')]?_0x1dbed8[_0x1e6c('0x2f')]:_0x10db6c[_0x1e6c('0x2a')];_0x1dbed8[_0x1e6c('0x33')]=qs[_0x1e6c('0x34')](_0x106243[_0x1e6c('0x2b')][_0x1e6c('0x34')]);_0x1dbed8[_0x1e6c('0x37')]=qs[_0x1e6c('0x2c')](_[_0x1e6c('0x35')](_0x106243['query'],_0x10db6c['filters']));if(_0x106243[_0x1e6c('0x2b')][_0x1e6c('0x36')]){_0x1dbed8[_0x1e6c('0x37')]=_[_0x1e6c('0x38')](_0x1dbed8[_0x1e6c('0x37')],{'$or':_[_0x1e6c('0x27')](_0x1dbed8['attributes'],function(_0x7e4259){var _0x2ea16f={};_0x2ea16f[_0x7e4259]={'$like':'%'+_0x106243[_0x1e6c('0x2b')][_0x1e6c('0x36')]+'%'};return _0x2ea16f;})});}_0x1dbed8=_[_0x1e6c('0x38')]({},_0x1dbed8,_0x106243['options']);return _0x4eef70['getSubjects'](_0x1dbed8);}})[_0x1e6c('0x22')](function(_0x2d7ea4){if(_0x2d7ea4){_0x26d5cb=_0x2d7ea4[_0x1e6c('0x30')];if(!_0x106243[_0x1e6c('0x2b')][_0x1e6c('0x31')](_0x1e6c('0x32'))){_0x1dbed8[_0x1e6c('0x1c')]=qs[_0x1e6c('0x1c')](_0x106243[_0x1e6c('0x2b')]['limit']);_0x1dbed8['offset']=qs[_0x1e6c('0x1a')](_0x106243[_0x1e6c('0x2b')]['offset']);}return _0x4eef70[_0x1e6c('0x46')](_0x1dbed8);}})['then'](function(_0x30acbd){if(_0x30acbd){return _0x30acbd?{'count':_0x26d5cb,'rows':_0x30acbd}:null;}})[_0x1e6c('0x22')](respondWithResult(_0xc7b95b,null))[_0x1e6c('0x3f')](handleError(_0xc7b95b,null));};exports[_0x1e6c('0x49')]=function(_0x3dd012,_0x1ca77d,_0x5c8e10){var _0x34b273={};var _0x2a763a={};var _0x4eda55;var _0x3f5f8b;return db[_0x1e6c('0x3a')][_0x1e6c('0x47')]({'where':{'id':_0x3dd012[_0x1e6c('0x41')]['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x1ca77d,null))[_0x1e6c('0x22')](function(_0x47a9b2){if(_0x47a9b2){_0x4eda55=_0x47a9b2;_0x2a763a['model']=_['keys'](db[_0x1e6c('0x48')][_0x1e6c('0x28')]);_0x2a763a[_0x1e6c('0x2b')]=_[_0x1e6c('0x42')](_0x3dd012['query']);_0x2a763a['filters']=_[_0x1e6c('0x2d')](_0x2a763a[_0x1e6c('0x2a')],_0x2a763a[_0x1e6c('0x2b')]);_0x34b273['attributes']=_[_0x1e6c('0x2d')](_0x2a763a['model'],qs[_0x1e6c('0x2e')](_0x3dd012['query']['fields']));_0x34b273[_0x1e6c('0x2f')]=_0x34b273[_0x1e6c('0x2f')]['length']?_0x34b273[_0x1e6c('0x2f')]:_0x2a763a[_0x1e6c('0x2a')];_0x34b273[_0x1e6c('0x33')]=qs['sort'](_0x3dd012['query'][_0x1e6c('0x34')]);_0x34b273[_0x1e6c('0x37')]=qs[_0x1e6c('0x2c')](_[_0x1e6c('0x35')](_0x3dd012[_0x1e6c('0x2b')],_0x2a763a['filters']));if(_0x3dd012[_0x1e6c('0x2b')][_0x1e6c('0x36')]){_0x34b273[_0x1e6c('0x37')]=_['merge'](_0x34b273[_0x1e6c('0x37')],{'$or':_['map'](_0x34b273['attributes'],function(_0x104fa1){var _0x1ae417={};_0x1ae417[_0x104fa1]={'$like':'%'+_0x3dd012[_0x1e6c('0x2b')][_0x1e6c('0x36')]+'%'};return _0x1ae417;})});}_0x34b273=_['merge']({},_0x34b273,_0x3dd012[_0x1e6c('0x4a')]);return _0x4eda55[_0x1e6c('0x49')](_0x34b273);}})[_0x1e6c('0x22')](function(_0x2fb548){if(_0x2fb548){_0x3f5f8b=_0x2fb548[_0x1e6c('0x30')];if(!_0x3dd012['query'][_0x1e6c('0x31')]('nolimit')){_0x34b273[_0x1e6c('0x1c')]=qs['limit'](_0x3dd012[_0x1e6c('0x2b')][_0x1e6c('0x1c')]);_0x34b273['offset']=qs[_0x1e6c('0x1a')](_0x3dd012[_0x1e6c('0x2b')][_0x1e6c('0x1a')]);}return _0x4eda55[_0x1e6c('0x49')](_0x34b273);}})[_0x1e6c('0x22')](function(_0x5a2c78){if(_0x5a2c78){return _0x5a2c78?{'count':_0x3f5f8b,'rows':_0x5a2c78}:null;}})[_0x1e6c('0x22')](respondWithResult(_0x1ca77d,null))[_0x1e6c('0x3f')](handleError(_0x1ca77d,null));};exports[_0x1e6c('0x4b')]=function(_0x1b28ee,_0x608973,_0x572af5){var _0x226c27={};var _0x131b36={};var _0x49c9d8;var _0x5e3589;return db[_0x1e6c('0x3a')][_0x1e6c('0x47')]({'where':{'id':_0x1b28ee['params']['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x608973,null))['then'](function(_0x481a08){if(_0x481a08){_0x49c9d8=_0x481a08;_0x131b36[_0x1e6c('0x2a')]=_[_0x1e6c('0x42')](db[_0x1e6c('0x48')]['rawAttributes']);_0x131b36[_0x1e6c('0x2b')]=_[_0x1e6c('0x42')](_0x1b28ee[_0x1e6c('0x2b')]);_0x131b36[_0x1e6c('0x2c')]=_[_0x1e6c('0x2d')](_0x131b36[_0x1e6c('0x2a')],_0x131b36[_0x1e6c('0x2b')]);_0x226c27[_0x1e6c('0x2f')]=_[_0x1e6c('0x2d')](_0x131b36[_0x1e6c('0x2a')],qs['fields'](_0x1b28ee[_0x1e6c('0x2b')][_0x1e6c('0x2e')]));_0x226c27[_0x1e6c('0x2f')]=_0x226c27[_0x1e6c('0x2f')][_0x1e6c('0x30')]?_0x226c27[_0x1e6c('0x2f')]:_0x131b36['model'];_0x226c27[_0x1e6c('0x33')]=qs[_0x1e6c('0x34')](_0x1b28ee[_0x1e6c('0x2b')][_0x1e6c('0x34')]);_0x226c27[_0x1e6c('0x37')]=qs[_0x1e6c('0x2c')](_['pick'](_0x1b28ee[_0x1e6c('0x2b')],_0x131b36[_0x1e6c('0x2c')]));if(_0x1b28ee[_0x1e6c('0x2b')][_0x1e6c('0x36')]){_0x226c27[_0x1e6c('0x37')]=_[_0x1e6c('0x38')](_0x226c27['where'],{'$or':_[_0x1e6c('0x27')](_0x226c27[_0x1e6c('0x2f')],function(_0x46b514){var _0x3fab51={};_0x3fab51[_0x46b514]={'$like':'%'+_0x1b28ee[_0x1e6c('0x2b')]['filter']+'%'};return _0x3fab51;})});}_0x226c27=_[_0x1e6c('0x38')]({},_0x226c27,_0x1b28ee[_0x1e6c('0x4a')]);return _0x49c9d8[_0x1e6c('0x4b')](_0x226c27);}})['then'](function(_0xe4adf9){if(_0xe4adf9){_0x5e3589=_0xe4adf9['length'];if(!_0x1b28ee[_0x1e6c('0x2b')][_0x1e6c('0x31')](_0x1e6c('0x32'))){_0x226c27['limit']=qs[_0x1e6c('0x1c')](_0x1b28ee[_0x1e6c('0x2b')]['limit']);_0x226c27[_0x1e6c('0x1a')]=qs[_0x1e6c('0x1a')](_0x1b28ee[_0x1e6c('0x2b')][_0x1e6c('0x1a')]);}return _0x49c9d8[_0x1e6c('0x4b')](_0x226c27);}})['then'](function(_0x5460a4){if(_0x5460a4){return _0x5460a4?{'count':_0x5e3589,'rows':_0x5460a4}:null;}})[_0x1e6c('0x22')](respondWithResult(_0x608973,null))['catch'](handleError(_0x608973,null));}; \ No newline at end of file +var _0x39d2=['FreshsalesField','getDescriptions','getFields','rimraf','zip-dir','moment','bluebird','mustache','util','path','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','count','offset','Content-Range','json','apply','reject','save','destroy','then','stack','name','send','index','map','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','FreshsalesConfiguration','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','update','getSubjects','findOne'];(function(_0x552f23,_0x21af08){var _0x3613b3=function(_0x18822a){while(--_0x18822a){_0x552f23['push'](_0x552f23['shift']());}};_0x3613b3(++_0x21af08);}(_0x39d2,0x12f));var _0x239d=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x39d2[_0x1cfa0d];return _0xe33279;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x239d('0x0'));var zipdir=require(_0x239d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x239d('0x2'));var BPromise=require(_0x239d('0x3'));var Mustache=require(_0x239d('0x4'));var util=require(_0x239d('0x5'));var path=require(_0x239d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x239d('0x7'));var _=require(_0x239d('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x239d('0x9'));var deskjs=require(_0x239d('0xa'));var toCsv=require('to-csv');var querystring=require(_0x239d('0xb'));var Papa=require(_0x239d('0xc'));var Redis=require('ioredis');var authService=require(_0x239d('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x239d('0xe'));var logger=require(_0x239d('0xf'))(_0x239d('0x10'));var utils=require(_0x239d('0x11'));var config=require(_0x239d('0x12'));var licenseUtil=require(_0x239d('0x13'));var db=require(_0x239d('0x14'))['db'];function respondWithStatusCode(_0x2c6cd1,_0x430d89){_0x430d89=_0x430d89||0xcc;return function(_0x525ce5){if(_0x525ce5){return _0x2c6cd1[_0x239d('0x15')](_0x430d89);}return _0x2c6cd1[_0x239d('0x16')](_0x430d89)['end']();};}function respondWithResult(_0x189872,_0x5c3b17){_0x5c3b17=_0x5c3b17||0xc8;return function(_0x1c48eb){if(_0x1c48eb){return _0x189872['status'](_0x5c3b17)['json'](_0x1c48eb);}};}function respondWithFilteredResult(_0x19ac06,_0x5a056e){return function(_0x1ccbc6){if(_0x1ccbc6){var _0x3b3931=typeof _0x5a056e['offset']==='undefined'&&typeof _0x5a056e[_0x239d('0x17')]==='undefined';var _0x5f3063=_0x1ccbc6[_0x239d('0x18')];var _0x8ccc02=_0x3b3931?0x0:_0x5a056e[_0x239d('0x19')];var _0x4f9100=_0x3b3931?_0x1ccbc6[_0x239d('0x18')]:_0x5a056e['offset']+_0x5a056e[_0x239d('0x17')];var _0x62b173;if(_0x4f9100>=_0x5f3063){_0x4f9100=_0x5f3063;_0x62b173=0xc8;}else{_0x62b173=0xce;}_0x19ac06['status'](_0x62b173);return _0x19ac06['set'](_0x239d('0x1a'),_0x8ccc02+'-'+_0x4f9100+'/'+_0x5f3063)[_0x239d('0x1b')](_0x1ccbc6);}return null;};}function patchUpdates(_0x292db9){return function(_0xce3d8d){try{jsonpatch[_0x239d('0x1c')](_0xce3d8d,_0x292db9,!![]);}catch(_0x3ff5ae){return BPromise[_0x239d('0x1d')](_0x3ff5ae);}return _0xce3d8d[_0x239d('0x1e')]();};}function saveUpdates(_0x43bcc1,_0x3cee02){return function(_0x4bad06){if(_0x4bad06){return _0x4bad06['update'](_0x43bcc1)['then'](function(_0x5ec712){return _0x5ec712;});}return null;};}function removeEntity(_0x477b56,_0x1902a1){return function(_0x306267){if(_0x306267){return _0x306267[_0x239d('0x1f')]()[_0x239d('0x20')](function(){_0x477b56[_0x239d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x288a78,_0x3c22c3){return function(_0x4a8e4c){if(!_0x4a8e4c){_0x288a78['sendStatus'](0x194);}return _0x4a8e4c;};}function handleError(_0x533a91,_0xd77921){_0xd77921=_0xd77921||0x1f4;return function(_0x59f0fe){logger['error'](_0x59f0fe[_0x239d('0x21')]);if(_0x59f0fe[_0x239d('0x22')]){delete _0x59f0fe[_0x239d('0x22')];}_0x533a91[_0x239d('0x16')](_0xd77921)[_0x239d('0x23')](_0x59f0fe);};}exports[_0x239d('0x24')]=function(_0x4efe55,_0x5cbb49){var _0x55a638={},_0xb0da77={},_0x59d115={'count':0x0,'rows':[]};var _0xbde506=_[_0x239d('0x25')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x229210){return{'name':_0x229210['fieldName'],'type':_0x229210[_0x239d('0x26')][_0x239d('0x27')]};});_0xb0da77['model']=_[_0x239d('0x25')](_0xbde506,'name');_0xb0da77[_0x239d('0x28')]=_[_0x239d('0x29')](_0x4efe55[_0x239d('0x28')]);_0xb0da77['filters']=_[_0x239d('0x2a')](_0xb0da77[_0x239d('0x2b')],_0xb0da77['query']);_0x55a638['attributes']=_[_0x239d('0x2a')](_0xb0da77[_0x239d('0x2b')],qs[_0x239d('0x2c')](_0x4efe55[_0x239d('0x28')]['fields']));_0x55a638[_0x239d('0x2d')]=_0x55a638[_0x239d('0x2d')][_0x239d('0x2e')]?_0x55a638[_0x239d('0x2d')]:_0xb0da77[_0x239d('0x2b')];if(!_0x4efe55[_0x239d('0x28')][_0x239d('0x2f')](_0x239d('0x30'))){_0x55a638[_0x239d('0x17')]=qs[_0x239d('0x17')](_0x4efe55[_0x239d('0x28')][_0x239d('0x17')]);_0x55a638['offset']=qs[_0x239d('0x19')](_0x4efe55[_0x239d('0x28')][_0x239d('0x19')]);}_0x55a638[_0x239d('0x31')]=qs[_0x239d('0x32')](_0x4efe55['query'][_0x239d('0x32')]);_0x55a638[_0x239d('0x33')]=qs['filters'](_[_0x239d('0x34')](_0x4efe55[_0x239d('0x28')],_0xb0da77[_0x239d('0x35')]),_0xbde506);if(_0x4efe55[_0x239d('0x28')]['filter']){_0x55a638['where']=_[_0x239d('0x36')](_0x55a638[_0x239d('0x33')],{'$or':_['map'](_0xbde506,function(_0x21d189){if(_0x21d189[_0x239d('0x26')]!==_0x239d('0x37')){var _0x4e07f6={};_0x4e07f6[_0x21d189[_0x239d('0x22')]]={'$like':'%'+_0x4efe55['query'][_0x239d('0x38')]+'%'};return _0x4e07f6;}})});}_0x55a638=_['merge']({},_0x55a638,_0x4efe55[_0x239d('0x39')]);var _0x5ab0d4={'where':_0x55a638[_0x239d('0x33')]};return db[_0x239d('0x3a')]['count'](_0x5ab0d4)[_0x239d('0x20')](function(_0x19a118){_0x59d115['count']=_0x19a118;if(_0x4efe55[_0x239d('0x28')][_0x239d('0x3b')]){_0x55a638[_0x239d('0x3c')]=[{'all':!![]}];}return db[_0x239d('0x3a')][_0x239d('0x3d')](_0x55a638);})['then'](function(_0x2913ad){_0x59d115['rows']=_0x2913ad;return _0x59d115;})['then'](respondWithFilteredResult(_0x5cbb49,_0x55a638))[_0x239d('0x3e')](handleError(_0x5cbb49,null));};exports[_0x239d('0x3f')]=function(_0x14c680,_0x51f42f){var _0x1ff6fb={'raw':![],'where':{'id':_0x14c680[_0x239d('0x40')]['id']}},_0x580003={};_0x580003[_0x239d('0x2b')]=_[_0x239d('0x29')](db[_0x239d('0x3a')][_0x239d('0x41')]);_0x580003['query']=_[_0x239d('0x29')](_0x14c680[_0x239d('0x28')]);_0x580003[_0x239d('0x35')]=_[_0x239d('0x2a')](_0x580003[_0x239d('0x2b')],_0x580003['query']);_0x1ff6fb[_0x239d('0x2d')]=_['intersection'](_0x580003[_0x239d('0x2b')],qs[_0x239d('0x2c')](_0x14c680['query'][_0x239d('0x2c')]));_0x1ff6fb[_0x239d('0x2d')]=_0x1ff6fb[_0x239d('0x2d')][_0x239d('0x2e')]?_0x1ff6fb['attributes']:_0x580003[_0x239d('0x2b')];if(_0x14c680[_0x239d('0x28')][_0x239d('0x3b')]){_0x1ff6fb['include']=[{'all':!![]}];}_0x1ff6fb=_[_0x239d('0x36')]({},_0x1ff6fb,_0x14c680[_0x239d('0x39')]);return db[_0x239d('0x3a')][_0x239d('0x42')](_0x1ff6fb)[_0x239d('0x20')](handleEntityNotFound(_0x51f42f,null))[_0x239d('0x20')](respondWithResult(_0x51f42f,null))['catch'](handleError(_0x51f42f,null));};exports[_0x239d('0x43')]=function(_0x41ddf3,_0x4dfb9f){return db[_0x239d('0x3a')][_0x239d('0x43')](_0x41ddf3[_0x239d('0x44')],{})[_0x239d('0x20')](respondWithResult(_0x4dfb9f,0xc9))['catch'](handleError(_0x4dfb9f,null));};exports[_0x239d('0x45')]=function(_0x5c82f7,_0x5a058c){if(_0x5c82f7[_0x239d('0x44')]['id']){delete _0x5c82f7[_0x239d('0x44')]['id'];}return db[_0x239d('0x3a')][_0x239d('0x42')]({'where':{'id':_0x5c82f7[_0x239d('0x40')]['id']}})[_0x239d('0x20')](handleEntityNotFound(_0x5a058c,null))[_0x239d('0x20')](saveUpdates(_0x5c82f7[_0x239d('0x44')],null))[_0x239d('0x20')](respondWithResult(_0x5a058c,null))[_0x239d('0x3e')](handleError(_0x5a058c,null));};exports[_0x239d('0x1f')]=function(_0x18ecfe,_0x351525){return db[_0x239d('0x3a')][_0x239d('0x42')]({'where':{'id':_0x18ecfe[_0x239d('0x40')]['id']}})[_0x239d('0x20')](handleEntityNotFound(_0x351525,null))[_0x239d('0x20')](removeEntity(_0x351525,null))['catch'](handleError(_0x351525,null));};exports[_0x239d('0x46')]=function(_0x355dc8,_0x5d30c7,_0x36fec3){var _0x54dfb6={};var _0x70f08e={};var _0x1d9816;var _0x226667;return db[_0x239d('0x3a')][_0x239d('0x47')]({'where':{'id':_0x355dc8[_0x239d('0x40')]['id']}})[_0x239d('0x20')](handleEntityNotFound(_0x5d30c7,null))['then'](function(_0xe31aa9){if(_0xe31aa9){_0x1d9816=_0xe31aa9;_0x70f08e['model']=_[_0x239d('0x29')](db[_0x239d('0x48')][_0x239d('0x41')]);_0x70f08e[_0x239d('0x28')]=_[_0x239d('0x29')](_0x355dc8[_0x239d('0x28')]);_0x70f08e['filters']=_[_0x239d('0x2a')](_0x70f08e[_0x239d('0x2b')],_0x70f08e[_0x239d('0x28')]);_0x54dfb6[_0x239d('0x2d')]=_[_0x239d('0x2a')](_0x70f08e[_0x239d('0x2b')],qs[_0x239d('0x2c')](_0x355dc8[_0x239d('0x28')][_0x239d('0x2c')]));_0x54dfb6[_0x239d('0x2d')]=_0x54dfb6['attributes'][_0x239d('0x2e')]?_0x54dfb6[_0x239d('0x2d')]:_0x70f08e[_0x239d('0x2b')];_0x54dfb6['order']=qs[_0x239d('0x32')](_0x355dc8[_0x239d('0x28')][_0x239d('0x32')]);_0x54dfb6[_0x239d('0x33')]=qs[_0x239d('0x35')](_[_0x239d('0x34')](_0x355dc8[_0x239d('0x28')],_0x70f08e['filters']));if(_0x355dc8[_0x239d('0x28')]['filter']){_0x54dfb6[_0x239d('0x33')]=_['merge'](_0x54dfb6['where'],{'$or':_[_0x239d('0x25')](_0x54dfb6[_0x239d('0x2d')],function(_0x26abec){var _0x1fea25={};_0x1fea25[_0x26abec]={'$like':'%'+_0x355dc8[_0x239d('0x28')]['filter']+'%'};return _0x1fea25;})});}_0x54dfb6=_[_0x239d('0x36')]({},_0x54dfb6,_0x355dc8[_0x239d('0x39')]);return _0x1d9816[_0x239d('0x46')](_0x54dfb6);}})[_0x239d('0x20')](function(_0x12a6d5){if(_0x12a6d5){_0x226667=_0x12a6d5[_0x239d('0x2e')];if(!_0x355dc8[_0x239d('0x28')][_0x239d('0x2f')]('nolimit')){_0x54dfb6[_0x239d('0x17')]=qs[_0x239d('0x17')](_0x355dc8['query'][_0x239d('0x17')]);_0x54dfb6[_0x239d('0x19')]=qs[_0x239d('0x19')](_0x355dc8['query']['offset']);}return _0x1d9816[_0x239d('0x46')](_0x54dfb6);}})[_0x239d('0x20')](function(_0x401cc3){if(_0x401cc3){return _0x401cc3?{'count':_0x226667,'rows':_0x401cc3}:null;}})[_0x239d('0x20')](respondWithResult(_0x5d30c7,null))[_0x239d('0x3e')](handleError(_0x5d30c7,null));};exports['getDescriptions']=function(_0x3dd12a,_0x52fa6e,_0x4c3c00){var _0x588c02={};var _0x1c044e={};var _0x2f815e;var _0x3a3d02;return db['FreshsalesConfiguration'][_0x239d('0x47')]({'where':{'id':_0x3dd12a[_0x239d('0x40')]['id']}})[_0x239d('0x20')](handleEntityNotFound(_0x52fa6e,null))[_0x239d('0x20')](function(_0x5557de){if(_0x5557de){_0x2f815e=_0x5557de;_0x1c044e[_0x239d('0x2b')]=_['keys'](db[_0x239d('0x48')]['rawAttributes']);_0x1c044e['query']=_[_0x239d('0x29')](_0x3dd12a[_0x239d('0x28')]);_0x1c044e[_0x239d('0x35')]=_[_0x239d('0x2a')](_0x1c044e['model'],_0x1c044e[_0x239d('0x28')]);_0x588c02[_0x239d('0x2d')]=_['intersection'](_0x1c044e[_0x239d('0x2b')],qs[_0x239d('0x2c')](_0x3dd12a['query'][_0x239d('0x2c')]));_0x588c02[_0x239d('0x2d')]=_0x588c02[_0x239d('0x2d')]['length']?_0x588c02['attributes']:_0x1c044e['model'];_0x588c02['order']=qs[_0x239d('0x32')](_0x3dd12a[_0x239d('0x28')][_0x239d('0x32')]);_0x588c02['where']=qs[_0x239d('0x35')](_['pick'](_0x3dd12a[_0x239d('0x28')],_0x1c044e['filters']));if(_0x3dd12a[_0x239d('0x28')][_0x239d('0x38')]){_0x588c02[_0x239d('0x33')]=_[_0x239d('0x36')](_0x588c02[_0x239d('0x33')],{'$or':_[_0x239d('0x25')](_0x588c02['attributes'],function(_0xe076b){var _0x352d3a={};_0x352d3a[_0xe076b]={'$like':'%'+_0x3dd12a['query']['filter']+'%'};return _0x352d3a;})});}_0x588c02=_[_0x239d('0x36')]({},_0x588c02,_0x3dd12a[_0x239d('0x39')]);return _0x2f815e[_0x239d('0x49')](_0x588c02);}})[_0x239d('0x20')](function(_0xc86c3c){if(_0xc86c3c){_0x3a3d02=_0xc86c3c['length'];if(!_0x3dd12a[_0x239d('0x28')][_0x239d('0x2f')](_0x239d('0x30'))){_0x588c02['limit']=qs[_0x239d('0x17')](_0x3dd12a[_0x239d('0x28')]['limit']);_0x588c02[_0x239d('0x19')]=qs['offset'](_0x3dd12a['query'][_0x239d('0x19')]);}return _0x2f815e[_0x239d('0x49')](_0x588c02);}})[_0x239d('0x20')](function(_0x1bac45){if(_0x1bac45){return _0x1bac45?{'count':_0x3a3d02,'rows':_0x1bac45}:null;}})['then'](respondWithResult(_0x52fa6e,null))[_0x239d('0x3e')](handleError(_0x52fa6e,null));};exports[_0x239d('0x4a')]=function(_0x3d628d,_0x434e6d,_0x2f988d){var _0x56bc04={};var _0x51bd1c={};var _0x10cc49;var _0x5c6fbf;return db[_0x239d('0x3a')]['findOne']({'where':{'id':_0x3d628d['params']['id']}})['then'](handleEntityNotFound(_0x434e6d,null))['then'](function(_0x1ae71b){if(_0x1ae71b){_0x10cc49=_0x1ae71b;_0x51bd1c['model']=_[_0x239d('0x29')](db[_0x239d('0x48')][_0x239d('0x41')]);_0x51bd1c['query']=_['keys'](_0x3d628d[_0x239d('0x28')]);_0x51bd1c['filters']=_[_0x239d('0x2a')](_0x51bd1c[_0x239d('0x2b')],_0x51bd1c[_0x239d('0x28')]);_0x56bc04['attributes']=_['intersection'](_0x51bd1c[_0x239d('0x2b')],qs[_0x239d('0x2c')](_0x3d628d['query'][_0x239d('0x2c')]));_0x56bc04[_0x239d('0x2d')]=_0x56bc04[_0x239d('0x2d')][_0x239d('0x2e')]?_0x56bc04[_0x239d('0x2d')]:_0x51bd1c[_0x239d('0x2b')];_0x56bc04[_0x239d('0x31')]=qs[_0x239d('0x32')](_0x3d628d['query'][_0x239d('0x32')]);_0x56bc04[_0x239d('0x33')]=qs[_0x239d('0x35')](_['pick'](_0x3d628d[_0x239d('0x28')],_0x51bd1c[_0x239d('0x35')]));if(_0x3d628d['query']['filter']){_0x56bc04[_0x239d('0x33')]=_['merge'](_0x56bc04['where'],{'$or':_[_0x239d('0x25')](_0x56bc04[_0x239d('0x2d')],function(_0x2355aa){var _0x9fef39={};_0x9fef39[_0x2355aa]={'$like':'%'+_0x3d628d[_0x239d('0x28')][_0x239d('0x38')]+'%'};return _0x9fef39;})});}_0x56bc04=_[_0x239d('0x36')]({},_0x56bc04,_0x3d628d[_0x239d('0x39')]);return _0x10cc49['getFields'](_0x56bc04);}})[_0x239d('0x20')](function(_0x4caa12){if(_0x4caa12){_0x5c6fbf=_0x4caa12[_0x239d('0x2e')];if(!_0x3d628d['query'][_0x239d('0x2f')](_0x239d('0x30'))){_0x56bc04[_0x239d('0x17')]=qs[_0x239d('0x17')](_0x3d628d[_0x239d('0x28')][_0x239d('0x17')]);_0x56bc04[_0x239d('0x19')]=qs[_0x239d('0x19')](_0x3d628d[_0x239d('0x28')]['offset']);}return _0x10cc49[_0x239d('0x4a')](_0x56bc04);}})[_0x239d('0x20')](function(_0x42450d){if(_0x42450d){return _0x42450d?{'count':_0x5c6fbf,'rows':_0x42450d}:null;}})[_0x239d('0x20')](respondWithResult(_0x434e6d,null))[_0x239d('0x3e')](handleError(_0x434e6d,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 738fa7e..4a2f7ff 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 _0x5309=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','lodash','util','../../config/logger'];(function(_0x2760f9,_0xefbe99){var _0x42f596=function(_0xd6f282){while(--_0xd6f282){_0x2760f9['push'](_0x2760f9['shift']());}};_0x42f596(++_0xefbe99);}(_0x5309,0x1aa));var _0x9530=function(_0x315aea,_0x318a80){_0x315aea=_0x315aea-0x0;var _0x4a4bdb=_0x5309[_0x315aea];return _0x4a4bdb;};'use strict';var _=require(_0x9530('0x0'));var util=require(_0x9530('0x1'));var logger=require(_0x9530('0x2'))(_0x9530('0x3'));var moment=require(_0x9530('0x4'));var BPromise=require(_0x9530('0x5'));var rp=require(_0x9530('0x6'));var fs=require('fs');var path=require(_0x9530('0x7'));var rimraf=require(_0x9530('0x8'));var config=require(_0x9530('0x9'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x1cb512,_0x187678){return _0x1cb512[_0x9530('0xa')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11d6=['lodash','util','../../config/logger','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0x11d6,0x64));var _0x611d=function(_0x556270,_0x28250f){_0x556270=_0x556270-0x0;var _0x3c77ea=_0x11d6[_0x556270];return _0x3c77ea;};'use strict';var _=require(_0x611d('0x0'));var util=require(_0x611d('0x1'));var logger=require(_0x611d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x611d('0x3'));var fs=require('fs');var path=require(_0x611d('0x4'));var rimraf=require(_0x611d('0x5'));var config=require('../../config/environment');var attributes=require(_0x611d('0x6'));module[_0x611d('0x7')]=function(_0x3a0c0a,_0x1fc0c9){return _0x3a0c0a[_0x611d('0x8')](_0x611d('0x9'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 16bd019..67548b8 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 _0x8913=['client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','info','result','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x2779f4,_0x14f8c4){var _0x388da4=function(_0x201070){while(--_0x201070){_0x2779f4['push'](_0x2779f4['shift']());}};_0x388da4(++_0x14f8c4);}(_0x8913,0xdf));var _0x3891=function(_0x4e6e36,_0x207701){_0x4e6e36=_0x4e6e36-0x0;var _0x46da84=_0x8913[_0x4e6e36];return _0x46da84;};'use strict';var _=require(_0x3891('0x0'));var util=require('util');var moment=require(_0x3891('0x1'));var BPromise=require(_0x3891('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3891('0x3'));var db=require(_0x3891('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3891('0x5'));var config=require(_0x3891('0x6'));var jayson=require(_0x3891('0x7'));var client=jayson[_0x3891('0x8')][_0x3891('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x534f20,_0x19306d,_0x35a381){return new BPromise(function(_0x23a10c,_0x5c000a){return client[_0x3891('0xa')](_0x534f20,_0x35a381)[_0x3891('0xb')](function(_0x503197){logger['info'](_0x3891('0xc'),_0x19306d,_0x3891('0xd'));logger['debug'](_0x3891('0xe'),_0x19306d,_0x3891('0xd'),JSON['stringify'](_0x503197));if(_0x503197[_0x3891('0xf')]){if(_0x503197[_0x3891('0xf')][_0x3891('0x10')]===0x1f4){logger[_0x3891('0xf')](_0x3891('0xc'),_0x19306d,_0x503197['error']['message']);return _0x5c000a(_0x503197[_0x3891('0xf')]['message']);}logger[_0x3891('0xf')](_0x3891('0xc'),_0x19306d,_0x503197[_0x3891('0xf')]['message']);return _0x23a10c(_0x503197[_0x3891('0xf')]['message']);}else{logger[_0x3891('0x11')](_0x3891('0xc'),_0x19306d,_0x3891('0xd'));_0x23a10c(_0x503197[_0x3891('0x12')][_0x3891('0x13')]);}})[_0x3891('0x14')](function(_0x2ad13f){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x19306d,_0x2ad13f);_0x5c000a(_0x2ad13f);});});} \ No newline at end of file +var _0x1836=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x42f6d1,_0x52c740){var _0x50ae08=function(_0x419bf5){while(--_0x419bf5){_0x42f6d1['push'](_0x42f6d1['shift']());}};_0x50ae08(++_0x52c740);}(_0x1836,0x1e8));var _0x6183=function(_0xe6f8f,_0x17cfbd){_0xe6f8f=_0xe6f8f-0x0;var _0x17dcfc=_0x1836[_0xe6f8f];return _0x17dcfc;};'use strict';var _=require(_0x6183('0x0'));var util=require(_0x6183('0x1'));var moment=require(_0x6183('0x2'));var BPromise=require(_0x6183('0x3'));var rs=require(_0x6183('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6183('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6183('0x6'))(_0x6183('0x7'));var config=require(_0x6183('0x8'));var jayson=require(_0x6183('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b896a,_0x1a8d04,_0x3cf04b){return new BPromise(function(_0xdc9ce0,_0xb379bf){return client[_0x6183('0xa')](_0x2b896a,_0x3cf04b)[_0x6183('0xb')](function(_0x108072){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x1a8d04,_0x6183('0xc'));logger['debug'](_0x6183('0xd'),_0x1a8d04,_0x6183('0xc'),JSON[_0x6183('0xe')](_0x108072));if(_0x108072[_0x6183('0xf')]){if(_0x108072['error'][_0x6183('0x10')]===0x1f4){logger[_0x6183('0xf')](_0x6183('0x11'),_0x1a8d04,_0x108072['error']['message']);return _0xb379bf(_0x108072[_0x6183('0xf')][_0x6183('0x12')]);}logger[_0x6183('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1a8d04,_0x108072[_0x6183('0xf')][_0x6183('0x12')]);return _0xdc9ce0(_0x108072[_0x6183('0xf')][_0x6183('0x12')]);}else{logger[_0x6183('0x13')](_0x6183('0x11'),_0x1a8d04,_0x6183('0xc'));_0xdc9ce0(_0x108072[_0x6183('0x14')][_0x6183('0x12')]);}})[_0x6183('0x15')](function(_0x31a7b2){logger[_0x6183('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1a8d04,_0x31a7b2);_0xb379bf(_0x31a7b2);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index dc24a81..ade281f 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 _0xc041=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','/:id','show','post','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc041,0x1ea));var _0x1c04=function(_0x29cd14,_0x245c40){_0x29cd14=_0x29cd14-0x0;var _0x4229d1=_0xc041[_0x29cd14];return _0x4229d1;};'use strict';var multer=require(_0x1c04('0x0'));var util=require(_0x1c04('0x1'));var path=require('path');var timeout=require(_0x1c04('0x2'));var express=require('express');var router=express[_0x1c04('0x3')]();var fs_extra=require(_0x1c04('0x4'));var auth=require(_0x1c04('0x5'));var interaction=require(_0x1c04('0x6'));var config=require(_0x1c04('0x7'));var controller=require(_0x1c04('0x8'));router['get']('/',auth[_0x1c04('0x9')](),controller['index']);router['get'](_0x1c04('0xa'),auth[_0x1c04('0x9')](),controller[_0x1c04('0xb')]);router[_0x1c04('0xc')]('/',auth[_0x1c04('0x9')](),controller['create']);router['put'](_0x1c04('0xa'),auth[_0x1c04('0x9')](),controller[_0x1c04('0xd')]);router[_0x1c04('0xe')](_0x1c04('0xa'),auth[_0x1c04('0x9')](),controller[_0x1c04('0xf')]);module[_0x1c04('0x10')]=router; \ No newline at end of file +var _0x9755=['create','put','/:id','destroy','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show'];(function(_0x38dd12,_0x2f6434){var _0x457eef=function(_0x455051){while(--_0x455051){_0x38dd12['push'](_0x38dd12['shift']());}};_0x457eef(++_0x2f6434);}(_0x9755,0x1c6));var _0x5975=function(_0xca41dc,_0x22936e){_0xca41dc=_0xca41dc-0x0;var _0x3e125c=_0x9755[_0xca41dc];return _0x3e125c;};'use strict';var multer=require(_0x5975('0x0'));var util=require('util');var path=require(_0x5975('0x1'));var timeout=require(_0x5975('0x2'));var express=require(_0x5975('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5975('0x4'));var config=require(_0x5975('0x5'));var controller=require(_0x5975('0x6'));router[_0x5975('0x7')]('/',auth[_0x5975('0x8')](),controller[_0x5975('0x9')]);router[_0x5975('0x7')]('/:id',auth[_0x5975('0x8')](),controller[_0x5975('0xa')]);router['post']('/',auth[_0x5975('0x8')](),controller[_0x5975('0xb')]);router[_0x5975('0xc')]('/:id',auth[_0x5975('0x8')](),controller['update']);router['delete'](_0x5975('0xd'),auth[_0x5975('0x8')](),controller[_0x5975('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index bd57b4d..cba4722 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 _0xb90f=['customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x3df9dd,_0x26f5cd){var _0x4f11e4=function(_0x1993fe){while(--_0x1993fe){_0x3df9dd['push'](_0x3df9dd['shift']());}};_0x4f11e4(++_0x26f5cd);}(_0xb90f,0xd4));var _0xfb90=function(_0x1f64c1,_0x24e1ed){_0x1f64c1=_0x1f64c1-0x0;var _0x3651bb=_0xb90f[_0x1f64c1];return _0x3651bb;};'use strict';var Sequelize=require('sequelize');module[_0xfb90('0x0')]={'type':{'type':Sequelize[_0xfb90('0x1')](_0xfb90('0x2'),_0xfb90('0x3'),_0xfb90('0x4'),_0xfb90('0x5'),_0xfb90('0x6')),'defaultValue':_0xfb90('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xfb90('0x2'),_0xfb90('0x3'),_0xfb90('0x4'))},'keyContent':{'type':Sequelize[_0xfb90('0x7')]},'idField':{'type':Sequelize[_0xfb90('0x7')]},'nameField':{'type':Sequelize[_0xfb90('0x7')]},'customField':{'type':Sequelize[_0xfb90('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfb90('0x7')]}}; \ No newline at end of file +var _0xd8ed=['exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0xd8ed,0x8b));var _0xdd8e=function(_0x56c9ff,_0x5b5d42){_0x56c9ff=_0x56c9ff-0x0;var _0x7ab989=_0xd8ed[_0x56c9ff];return _0x7ab989;};'use strict';var Sequelize=require(_0xdd8e('0x0'));module[_0xdd8e('0x1')]={'type':{'type':Sequelize['ENUM'](_0xdd8e('0x2'),_0xdd8e('0x3'),_0xdd8e('0x4'),_0xdd8e('0x5'),_0xdd8e('0x6')),'defaultValue':_0xdd8e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdd8e('0x7')]},'keyType':{'type':Sequelize[_0xdd8e('0x8')](_0xdd8e('0x2'),_0xdd8e('0x3'),_0xdd8e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdd8e('0x7')]},'nameField':{'type':Sequelize[_0xdd8e('0x7')]},'customField':{'type':Sequelize[_0xdd8e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdd8e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 098c84c..62b1e4e 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 _0x733a=['../../components/auth/service','../../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','then','destroy','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x733a,0x162));var _0xa733=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x733a[_0x36ed3c];return _0x52a2e0;};'use strict';var emlformat=require(_0xa733('0x0'));var rimraf=require(_0xa733('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa733('0x2'));var rp=require(_0xa733('0x3'));var moment=require(_0xa733('0x4'));var BPromise=require(_0xa733('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa733('0x6'));var sox=require(_0xa733('0x7'));var csv=require('to-csv');var ejs=require(_0xa733('0x8'));var fs=require('fs');var fs_extra=require(_0xa733('0x9'));var _=require(_0xa733('0xa'));var squel=require(_0xa733('0xb'));var crypto=require('crypto');var jsforce=require(_0xa733('0xc'));var deskjs=require(_0xa733('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa733('0xe'));var Redis=require(_0xa733('0xf'));var authService=require(_0xa733('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa733('0x11'));var hardwareService=require(_0xa733('0x12'));var logger=require(_0xa733('0x13'))(_0xa733('0x14'));var utils=require(_0xa733('0x15'));var config=require(_0xa733('0x16'));var licenseUtil=require(_0xa733('0x17'));var db=require(_0xa733('0x18'))['db'];function respondWithStatusCode(_0x2e6c98,_0x26faa8){_0x26faa8=_0x26faa8||0xcc;return function(_0x373ed0){if(_0x373ed0){return _0x2e6c98[_0xa733('0x19')](_0x26faa8);}return _0x2e6c98[_0xa733('0x1a')](_0x26faa8)[_0xa733('0x1b')]();};}function respondWithResult(_0xc173a4,_0x571520){_0x571520=_0x571520||0xc8;return function(_0x9dd7ed){if(_0x9dd7ed){return _0xc173a4[_0xa733('0x1a')](_0x571520)[_0xa733('0x1c')](_0x9dd7ed);}};}function respondWithFilteredResult(_0x29132d,_0x22b92a){return function(_0x21fdaf){if(_0x21fdaf){var _0x2c9e5e=typeof _0x22b92a['offset']===_0xa733('0x1d')&&typeof _0x22b92a[_0xa733('0x1e')]===_0xa733('0x1d');var _0x510c16=_0x21fdaf[_0xa733('0x1f')];var _0x1db4fd=_0x2c9e5e?0x0:_0x22b92a[_0xa733('0x20')];var _0x495473=_0x2c9e5e?_0x21fdaf[_0xa733('0x1f')]:_0x22b92a['offset']+_0x22b92a['limit'];var _0x39551c;if(_0x495473>=_0x510c16){_0x495473=_0x510c16;_0x39551c=0xc8;}else{_0x39551c=0xce;}_0x29132d[_0xa733('0x1a')](_0x39551c);return _0x29132d[_0xa733('0x21')](_0xa733('0x22'),_0x1db4fd+'-'+_0x495473+'/'+_0x510c16)[_0xa733('0x1c')](_0x21fdaf);}return null;};}function patchUpdates(_0xe938b3){return function(_0x2cdd3d){try{jsonpatch[_0xa733('0x23')](_0x2cdd3d,_0xe938b3,!![]);}catch(_0x432f92){return BPromise[_0xa733('0x24')](_0x432f92);}return _0x2cdd3d['save']();};}function saveUpdates(_0x3d6368,_0x1d3ca6){return function(_0x507c91){if(_0x507c91){return _0x507c91['update'](_0x3d6368)[_0xa733('0x25')](function(_0x1f4da4){return _0x1f4da4;});}return null;};}function removeEntity(_0x5ad80d,_0x228fb8){return function(_0x28e5a9){if(_0x28e5a9){return _0x28e5a9[_0xa733('0x26')]()['then'](function(){_0x5ad80d[_0xa733('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19102c,_0x4982e0){return function(_0xb55448){if(!_0xb55448){_0x19102c[_0xa733('0x19')](0x194);}return _0xb55448;};}function handleError(_0x43d50d,_0x4c8b75){_0x4c8b75=_0x4c8b75||0x1f4;return function(_0x37c071){logger['error'](_0x37c071[_0xa733('0x27')]);if(_0x37c071[_0xa733('0x28')]){delete _0x37c071[_0xa733('0x28')];}_0x43d50d[_0xa733('0x1a')](_0x4c8b75)[_0xa733('0x29')](_0x37c071);};}exports[_0xa733('0x2a')]=function(_0x40c541,_0x580e27){var _0x18021d={},_0x11d428={},_0x12a2f2={'count':0x0,'rows':[]};var _0x56346d=_[_0xa733('0x2b')](db[_0xa733('0x2c')][_0xa733('0x2d')],function(_0x5f3e68){return{'name':_0x5f3e68[_0xa733('0x2e')],'type':_0x5f3e68['type'][_0xa733('0x2f')]};});_0x11d428[_0xa733('0x30')]=_['map'](_0x56346d,_0xa733('0x28'));_0x11d428['query']=_[_0xa733('0x31')](_0x40c541[_0xa733('0x32')]);_0x11d428[_0xa733('0x33')]=_[_0xa733('0x34')](_0x11d428[_0xa733('0x30')],_0x11d428['query']);_0x18021d['attributes']=_[_0xa733('0x34')](_0x11d428[_0xa733('0x30')],qs[_0xa733('0x35')](_0x40c541[_0xa733('0x32')][_0xa733('0x35')]));_0x18021d[_0xa733('0x36')]=_0x18021d[_0xa733('0x36')][_0xa733('0x37')]?_0x18021d[_0xa733('0x36')]:_0x11d428[_0xa733('0x30')];if(!_0x40c541['query']['hasOwnProperty'](_0xa733('0x38'))){_0x18021d['limit']=qs['limit'](_0x40c541['query'][_0xa733('0x1e')]);_0x18021d[_0xa733('0x20')]=qs[_0xa733('0x20')](_0x40c541['query'][_0xa733('0x20')]);}_0x18021d[_0xa733('0x39')]=qs[_0xa733('0x3a')](_0x40c541[_0xa733('0x32')]['sort']);_0x18021d[_0xa733('0x3b')]=qs[_0xa733('0x33')](_['pick'](_0x40c541[_0xa733('0x32')],_0x11d428[_0xa733('0x33')]),_0x56346d);if(_0x40c541[_0xa733('0x32')][_0xa733('0x3c')]){_0x18021d[_0xa733('0x3b')]=_[_0xa733('0x3d')](_0x18021d[_0xa733('0x3b')],{'$or':_[_0xa733('0x2b')](_0x56346d,function(_0x3243d8){if(_0x3243d8['type']!==_0xa733('0x3e')){var _0x32ce1e={};_0x32ce1e[_0x3243d8['name']]={'$like':'%'+_0x40c541['query'][_0xa733('0x3c')]+'%'};return _0x32ce1e;}})});}_0x18021d=_[_0xa733('0x3d')]({},_0x18021d,_0x40c541[_0xa733('0x3f')]);var _0x50cd28={'where':_0x18021d[_0xa733('0x3b')]};return db[_0xa733('0x2c')][_0xa733('0x1f')](_0x50cd28)['then'](function(_0x2d993c){_0x12a2f2['count']=_0x2d993c;if(_0x40c541['query'][_0xa733('0x40')]){_0x18021d['include']=[{'all':!![]}];}return db[_0xa733('0x2c')][_0xa733('0x41')](_0x18021d);})[_0xa733('0x25')](function(_0x1e3f97){_0x12a2f2[_0xa733('0x42')]=_0x1e3f97;return _0x12a2f2;})[_0xa733('0x25')](respondWithFilteredResult(_0x580e27,_0x18021d))[_0xa733('0x43')](handleError(_0x580e27,null));};exports[_0xa733('0x44')]=function(_0xcad084,_0x381080){var _0x470ecf={'raw':!![],'where':{'id':_0xcad084['params']['id']}},_0x299255={};_0x299255[_0xa733('0x30')]=_[_0xa733('0x31')](db[_0xa733('0x2c')][_0xa733('0x2d')]);_0x299255[_0xa733('0x32')]=_[_0xa733('0x31')](_0xcad084['query']);_0x299255[_0xa733('0x33')]=_[_0xa733('0x34')](_0x299255[_0xa733('0x30')],_0x299255['query']);_0x470ecf[_0xa733('0x36')]=_['intersection'](_0x299255[_0xa733('0x30')],qs['fields'](_0xcad084[_0xa733('0x32')][_0xa733('0x35')]));_0x470ecf[_0xa733('0x36')]=_0x470ecf[_0xa733('0x36')]['length']?_0x470ecf[_0xa733('0x36')]:_0x299255[_0xa733('0x30')];if(_0xcad084[_0xa733('0x32')][_0xa733('0x40')]){_0x470ecf[_0xa733('0x45')]=[{'all':!![]}];}_0x470ecf=_[_0xa733('0x3d')]({},_0x470ecf,_0xcad084[_0xa733('0x3f')]);return db[_0xa733('0x2c')]['find'](_0x470ecf)[_0xa733('0x25')](handleEntityNotFound(_0x381080,null))[_0xa733('0x25')](respondWithResult(_0x381080,null))['catch'](handleError(_0x381080,null));};exports[_0xa733('0x46')]=function(_0x101f8f,_0x47889f){return db['FreshsalesField'][_0xa733('0x46')](_0x101f8f[_0xa733('0x47')],{})[_0xa733('0x25')](respondWithResult(_0x47889f,0xc9))[_0xa733('0x43')](handleError(_0x47889f,null));};exports[_0xa733('0x48')]=function(_0x1a40a6,_0x23d8a3){if(_0x1a40a6[_0xa733('0x47')]['id']){delete _0x1a40a6[_0xa733('0x47')]['id'];}return db[_0xa733('0x2c')]['find']({'where':{'id':_0x1a40a6['params']['id']}})[_0xa733('0x25')](handleEntityNotFound(_0x23d8a3,null))[_0xa733('0x25')](saveUpdates(_0x1a40a6[_0xa733('0x47')],null))[_0xa733('0x25')](respondWithResult(_0x23d8a3,null))[_0xa733('0x43')](handleError(_0x23d8a3,null));};exports[_0xa733('0x26')]=function(_0x34201d,_0x598d6a){return db[_0xa733('0x2c')]['find']({'where':{'id':_0x34201d[_0xa733('0x49')]['id']}})['then'](handleEntityNotFound(_0x598d6a,null))[_0xa733('0x25')](removeEntity(_0x598d6a,null))[_0xa733('0x43')](handleError(_0x598d6a,null));}; \ No newline at end of file +var _0xe731=['findAll','rows','catch','rawAttributes','intersection','find','create','body','params','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','update','then','destroy','end','error','stack','name','send','index','map','FreshsalesField','fieldName','type','key','query','keys','model','attributes','fields','length','order','where','filters','filter','merge','options','includeAll','include'];(function(_0x4ab95d,_0x50e52b){var _0x42b4f7=function(_0x284ced){while(--_0x284ced){_0x4ab95d['push'](_0x4ab95d['shift']());}};_0x42b4f7(++_0x50e52b);}(_0xe731,0x1e5));var _0x1e73=function(_0x482af4,_0x841ba7){_0x482af4=_0x482af4-0x0;var _0x266fbb=_0xe731[_0x482af4];return _0x266fbb;};'use strict';var emlformat=require(_0x1e73('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1e73('0x1'));var rp=require(_0x1e73('0x2'));var moment=require('moment');var BPromise=require(_0x1e73('0x3'));var Mustache=require(_0x1e73('0x4'));var util=require(_0x1e73('0x5'));var path=require(_0x1e73('0x6'));var sox=require(_0x1e73('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e73('0x8'));var _=require(_0x1e73('0x9'));var squel=require(_0x1e73('0xa'));var crypto=require('crypto');var jsforce=require(_0x1e73('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1e73('0xc'));var querystring=require(_0x1e73('0xd'));var Papa=require('papaparse');var Redis=require(_0x1e73('0xe'));var authService=require(_0x1e73('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1e73('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e73('0x11'))(_0x1e73('0x12'));var utils=require(_0x1e73('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1e73('0x14'));var db=require(_0x1e73('0x15'))['db'];function respondWithStatusCode(_0x27db77,_0x532b65){_0x532b65=_0x532b65||0xcc;return function(_0x4e937c){if(_0x4e937c){return _0x27db77[_0x1e73('0x16')](_0x532b65);}return _0x27db77[_0x1e73('0x17')](_0x532b65)['end']();};}function respondWithResult(_0x3746e7,_0x2c6751){_0x2c6751=_0x2c6751||0xc8;return function(_0x4fd051){if(_0x4fd051){return _0x3746e7[_0x1e73('0x17')](_0x2c6751)[_0x1e73('0x18')](_0x4fd051);}};}function respondWithFilteredResult(_0x394d8d,_0x3e3320){return function(_0x851e22){if(_0x851e22){var _0x25d032=typeof _0x3e3320['offset']==='undefined'&&typeof _0x3e3320['limit']===_0x1e73('0x19');var _0x4d7191=_0x851e22[_0x1e73('0x1a')];var _0x1305c8=_0x25d032?0x0:_0x3e3320['offset'];var _0x36c68f=_0x25d032?_0x851e22[_0x1e73('0x1a')]:_0x3e3320[_0x1e73('0x1b')]+_0x3e3320[_0x1e73('0x1c')];var _0x4a4db0;if(_0x36c68f>=_0x4d7191){_0x36c68f=_0x4d7191;_0x4a4db0=0xc8;}else{_0x4a4db0=0xce;}_0x394d8d['status'](_0x4a4db0);return _0x394d8d[_0x1e73('0x1d')]('Content-Range',_0x1305c8+'-'+_0x36c68f+'/'+_0x4d7191)['json'](_0x851e22);}return null;};}function patchUpdates(_0x3904e2){return function(_0x5a45da){try{jsonpatch[_0x1e73('0x1e')](_0x5a45da,_0x3904e2,!![]);}catch(_0x3758d4){return BPromise['reject'](_0x3758d4);}return _0x5a45da['save']();};}function saveUpdates(_0x1e5966,_0x8c8466){return function(_0x23de2c){if(_0x23de2c){return _0x23de2c[_0x1e73('0x1f')](_0x1e5966)[_0x1e73('0x20')](function(_0x1b3a62){return _0x1b3a62;});}return null;};}function removeEntity(_0x3e307e,_0x4a27c4){return function(_0x4eeab5){if(_0x4eeab5){return _0x4eeab5[_0x1e73('0x21')]()[_0x1e73('0x20')](function(){_0x3e307e[_0x1e73('0x17')](0xcc)[_0x1e73('0x22')]();});}};}function handleEntityNotFound(_0x193f83,_0xae5a4d){return function(_0xd4b36a){if(!_0xd4b36a){_0x193f83['sendStatus'](0x194);}return _0xd4b36a;};}function handleError(_0x484b6d,_0xf69936){_0xf69936=_0xf69936||0x1f4;return function(_0x10d23a){logger[_0x1e73('0x23')](_0x10d23a[_0x1e73('0x24')]);if(_0x10d23a['name']){delete _0x10d23a[_0x1e73('0x25')];}_0x484b6d[_0x1e73('0x17')](_0xf69936)[_0x1e73('0x26')](_0x10d23a);};}exports[_0x1e73('0x27')]=function(_0x52a0c0,_0x15aa13){var _0x13d818={},_0xca0138={},_0x3858f3={'count':0x0,'rows':[]};var _0x1ff0d0=_[_0x1e73('0x28')](db[_0x1e73('0x29')]['rawAttributes'],function(_0x1795c2){return{'name':_0x1795c2[_0x1e73('0x2a')],'type':_0x1795c2[_0x1e73('0x2b')][_0x1e73('0x2c')]};});_0xca0138['model']=_[_0x1e73('0x28')](_0x1ff0d0,_0x1e73('0x25'));_0xca0138[_0x1e73('0x2d')]=_[_0x1e73('0x2e')](_0x52a0c0[_0x1e73('0x2d')]);_0xca0138['filters']=_['intersection'](_0xca0138[_0x1e73('0x2f')],_0xca0138['query']);_0x13d818[_0x1e73('0x30')]=_['intersection'](_0xca0138[_0x1e73('0x2f')],qs[_0x1e73('0x31')](_0x52a0c0[_0x1e73('0x2d')]['fields']));_0x13d818[_0x1e73('0x30')]=_0x13d818[_0x1e73('0x30')][_0x1e73('0x32')]?_0x13d818['attributes']:_0xca0138[_0x1e73('0x2f')];if(!_0x52a0c0['query']['hasOwnProperty']('nolimit')){_0x13d818[_0x1e73('0x1c')]=qs[_0x1e73('0x1c')](_0x52a0c0['query'][_0x1e73('0x1c')]);_0x13d818['offset']=qs[_0x1e73('0x1b')](_0x52a0c0[_0x1e73('0x2d')][_0x1e73('0x1b')]);}_0x13d818[_0x1e73('0x33')]=qs['sort'](_0x52a0c0[_0x1e73('0x2d')]['sort']);_0x13d818[_0x1e73('0x34')]=qs['filters'](_['pick'](_0x52a0c0[_0x1e73('0x2d')],_0xca0138[_0x1e73('0x35')]),_0x1ff0d0);if(_0x52a0c0[_0x1e73('0x2d')][_0x1e73('0x36')]){_0x13d818['where']=_[_0x1e73('0x37')](_0x13d818['where'],{'$or':_['map'](_0x1ff0d0,function(_0x4157a0){if(_0x4157a0[_0x1e73('0x2b')]!=='VIRTUAL'){var _0x27f682={};_0x27f682[_0x4157a0[_0x1e73('0x25')]]={'$like':'%'+_0x52a0c0[_0x1e73('0x2d')][_0x1e73('0x36')]+'%'};return _0x27f682;}})});}_0x13d818=_[_0x1e73('0x37')]({},_0x13d818,_0x52a0c0[_0x1e73('0x38')]);var _0x41f037={'where':_0x13d818[_0x1e73('0x34')]};return db['FreshsalesField'][_0x1e73('0x1a')](_0x41f037)[_0x1e73('0x20')](function(_0x24c783){_0x3858f3[_0x1e73('0x1a')]=_0x24c783;if(_0x52a0c0['query'][_0x1e73('0x39')]){_0x13d818[_0x1e73('0x3a')]=[{'all':!![]}];}return db['FreshsalesField'][_0x1e73('0x3b')](_0x13d818);})[_0x1e73('0x20')](function(_0x18c6b1){_0x3858f3[_0x1e73('0x3c')]=_0x18c6b1;return _0x3858f3;})[_0x1e73('0x20')](respondWithFilteredResult(_0x15aa13,_0x13d818))[_0x1e73('0x3d')](handleError(_0x15aa13,null));};exports['show']=function(_0xa4e2d5,_0x54d2ac){var _0x11b538={'raw':!![],'where':{'id':_0xa4e2d5['params']['id']}},_0x51014c={};_0x51014c[_0x1e73('0x2f')]=_['keys'](db[_0x1e73('0x29')][_0x1e73('0x3e')]);_0x51014c[_0x1e73('0x2d')]=_[_0x1e73('0x2e')](_0xa4e2d5[_0x1e73('0x2d')]);_0x51014c[_0x1e73('0x35')]=_['intersection'](_0x51014c[_0x1e73('0x2f')],_0x51014c[_0x1e73('0x2d')]);_0x11b538['attributes']=_[_0x1e73('0x3f')](_0x51014c['model'],qs[_0x1e73('0x31')](_0xa4e2d5[_0x1e73('0x2d')][_0x1e73('0x31')]));_0x11b538[_0x1e73('0x30')]=_0x11b538[_0x1e73('0x30')][_0x1e73('0x32')]?_0x11b538[_0x1e73('0x30')]:_0x51014c[_0x1e73('0x2f')];if(_0xa4e2d5[_0x1e73('0x2d')][_0x1e73('0x39')]){_0x11b538[_0x1e73('0x3a')]=[{'all':!![]}];}_0x11b538=_['merge']({},_0x11b538,_0xa4e2d5[_0x1e73('0x38')]);return db[_0x1e73('0x29')][_0x1e73('0x40')](_0x11b538)[_0x1e73('0x20')](handleEntityNotFound(_0x54d2ac,null))[_0x1e73('0x20')](respondWithResult(_0x54d2ac,null))['catch'](handleError(_0x54d2ac,null));};exports[_0x1e73('0x41')]=function(_0x45c2d8,_0x409b9a){return db['FreshsalesField'][_0x1e73('0x41')](_0x45c2d8[_0x1e73('0x42')],{})[_0x1e73('0x20')](respondWithResult(_0x409b9a,0xc9))[_0x1e73('0x3d')](handleError(_0x409b9a,null));};exports[_0x1e73('0x1f')]=function(_0x454a6f,_0x50f61c){if(_0x454a6f[_0x1e73('0x42')]['id']){delete _0x454a6f[_0x1e73('0x42')]['id'];}return db[_0x1e73('0x29')][_0x1e73('0x40')]({'where':{'id':_0x454a6f[_0x1e73('0x43')]['id']}})['then'](handleEntityNotFound(_0x50f61c,null))[_0x1e73('0x20')](saveUpdates(_0x454a6f[_0x1e73('0x42')],null))['then'](respondWithResult(_0x50f61c,null))[_0x1e73('0x3d')](handleError(_0x50f61c,null));};exports['destroy']=function(_0x5b1d94,_0x4492e0){return db[_0x1e73('0x29')][_0x1e73('0x40')]({'where':{'id':_0x5b1d94['params']['id']}})[_0x1e73('0x20')](handleEntityNotFound(_0x4492e0,null))[_0x1e73('0x20')](removeEntity(_0x4492e0,null))[_0x1e73('0x3d')](handleError(_0x4492e0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index af05ab6..f3ca91b 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 _0xd732=['bluebird','request-promise','../../config/environment','exports','FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xd732,0x18e));var _0x2d73=function(_0x7191d0,_0x521e2e){_0x7191d0=_0x7191d0-0x0;var _0x1c3a12=_0xd732[_0x7191d0];return _0x1c3a12;};'use strict';var _=require(_0x2d73('0x0'));var util=require('util');var logger=require(_0x2d73('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2d73('0x2'));var rp=require(_0x2d73('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2d73('0x4'));var attributes=require('./intFreshsalesField.attributes');module[_0x2d73('0x5')]=function(_0x11aa83,_0x47d40d){return _0x11aa83['define'](_0x2d73('0x6'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x2d73('0x7'),'fields':[_0x2d73('0x8'),_0x2d73('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f7b=['int_freshsales_fields','freshsales_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define'];(function(_0x43cb9a,_0x16c3e3){var _0x1ca679=function(_0x287243){while(--_0x287243){_0x43cb9a['push'](_0x43cb9a['shift']());}};_0x1ca679(++_0x16c3e3);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x165859,_0x198d56){_0x165859=_0x165859-0x0;var _0x2505d6=_0x4f7b[_0x165859];return _0x2505d6;};'use strict';var _=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var logger=require(_0xb4f7('0x2'))(_0xb4f7('0x3'));var moment=require('moment');var BPromise=require(_0xb4f7('0x4'));var rp=require(_0xb4f7('0x5'));var fs=require('fs');var path=require(_0xb4f7('0x6'));var rimraf=require(_0xb4f7('0x7'));var config=require(_0xb4f7('0x8'));var attributes=require(_0xb4f7('0x9'));module[_0xb4f7('0xa')]=function(_0x15443c,_0x4d2d83){return _0x15443c[_0xb4f7('0xb')]('FreshsalesField',attributes,{'tableName':_0xb4f7('0xc'),'paranoid':![],'indexes':[{'name':_0xb4f7('0xd'),'fields':[_0xb4f7('0xe'),'FieldId'],'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 3bf0fb7..73a77e6 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 _0x6d38=['request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1820ed,_0x2c6616){var _0x47f934=function(_0x38559f){while(--_0x38559f){_0x1820ed['push'](_0x1820ed['shift']());}};_0x47f934(++_0x2c6616);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x6d38[_0x4cf98e];return _0x1623ac;};'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']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file +var _0x31f0=['../../config/environment','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x197767,_0x400276){var _0x5422c6=function(_0x5eeffd){while(--_0x5eeffd){_0x197767['push'](_0x197767['shift']());}};_0x5422c6(++_0x400276);}(_0x31f0,0xb7));var _0x031f=function(_0x5e30df,_0x4849e6){_0x5e30df=_0x5e30df-0x0;var _0x5e4a5b=_0x31f0[_0x5e30df];return _0x5e4a5b;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 806ce29..f5f71e1 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x27c12b,_0x3ff1e7){var _0x3c2f20=function(_0x2a4804){while(--_0x2a4804){_0x27c12b['push'](_0x27c12b['shift']());}};_0x3c2f20(++_0x3ff1e7);}(_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/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x52ac7c,_0x4014e7){var _0x3ce4a5=function(_0x27f7d4){while(--_0x27f7d4){_0x52ac7c['push'](_0x52ac7c['shift']());}};_0x3ce4a5(++_0x4014e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 893206c..3258bc8 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 _0xe77c=['exports','STRING','username','integrationTab','sequelize'];(function(_0x3ed328,_0x2d2bb9){var _0x4043dc=function(_0x2652c2){while(--_0x2652c2){_0x3ed328['push'](_0x3ed328['shift']());}};_0x4043dc(++_0x2d2bb9);}(_0xe77c,0x176));var _0xce77=function(_0x17dab8,_0x19d0ec){_0x17dab8=_0x17dab8-0x0;var _0x336fb5=_0xe77c[_0x17dab8];return _0x336fb5;};'use strict';var Sequelize=require(_0xce77('0x0'));module[_0xce77('0x1')]={'name':{'type':Sequelize[_0xce77('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xce77('0x2')],'unique':_0xce77('0x3')},'remoteUri':{'type':Sequelize[_0xce77('0x2')]},'password':{'type':Sequelize[_0xce77('0x2')]},'clientId':{'type':Sequelize[_0xce77('0x2')]},'clientSecret':{'type':Sequelize[_0xce77('0x2')]},'securityToken':{'type':Sequelize[_0xce77('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xce77('0x4'),'newTab'),'defaultValue':_0xce77('0x4')}}; \ No newline at end of file +var _0xebcd=['sequelize','STRING','username','ENUM','integrationTab','newTab'];(function(_0x2a391c,_0x591011){var _0x5e68c4=function(_0x2447e0){while(--_0x2447e0){_0x2a391c['push'](_0x2a391c['shift']());}};_0x5e68c4(++_0x591011);}(_0xebcd,0x18c));var _0xdebc=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0xebcd[_0x142020];return _0x40da8f;};'use strict';var Sequelize=require(_0xdebc('0x0'));module['exports']={'name':{'type':Sequelize[_0xdebc('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xdebc('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xdebc('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xdebc('0x1')]},'securityToken':{'type':Sequelize[_0xdebc('0x1')]},'serverUrl':{'type':Sequelize[_0xdebc('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xdebc('0x3')](_0xdebc('0x4'),_0xdebc('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 2a1f375..27906c9 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 _0x6cb3=['IsRecurrence','Subject','Description','string','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','getConfigurations','findOne','SalesforceConfiguration','options','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','concat','isNil','ticketType','describe','OwnerId','ActivityDate'];(function(_0x1af482,_0x1af5b7){var _0x7e7580=function(_0x5ed4a7){while(--_0x5ed4a7){_0x1af482['push'](_0x1af482['shift']());}};_0x7e7580(++_0x1af5b7);}(_0x6cb3,0x94));var _0x36cb=function(_0x343229,_0x1ecd24){_0x343229=_0x343229-0x0;var _0x51f5b1=_0x6cb3[_0x343229];return _0x51f5b1;};'use strict';var emlformat=require(_0x36cb('0x0'));var rimraf=require(_0x36cb('0x1'));var zipdir=require(_0x36cb('0x2'));var jsonpatch=require(_0x36cb('0x3'));var rp=require(_0x36cb('0x4'));var moment=require(_0x36cb('0x5'));var BPromise=require(_0x36cb('0x6'));var Mustache=require(_0x36cb('0x7'));var util=require(_0x36cb('0x8'));var path=require(_0x36cb('0x9'));var sox=require(_0x36cb('0xa'));var csv=require(_0x36cb('0xb'));var ejs=require(_0x36cb('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x36cb('0xd'));var squel=require(_0x36cb('0xe'));var crypto=require('crypto');var jsforce=require(_0x36cb('0xf'));var deskjs=require(_0x36cb('0x10'));var toCsv=require('to-csv');var querystring=require(_0x36cb('0x11'));var Papa=require('papaparse');var Redis=require(_0x36cb('0x12'));var authService=require(_0x36cb('0x13'));var qs=require(_0x36cb('0x14'));var as=require(_0x36cb('0x15'));var hardwareService=require(_0x36cb('0x16'));var logger=require(_0x36cb('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x36cb('0x18'));var licenseUtil=require(_0x36cb('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x13f62c,_0xbb9a09){_0xbb9a09=_0xbb9a09||0xcc;return function(_0x29b579){if(_0x29b579){return _0x13f62c[_0x36cb('0x1a')](_0xbb9a09);}return _0x13f62c[_0x36cb('0x1b')](_0xbb9a09)['end']();};}function respondWithResult(_0x7137c0,_0x24b20c){_0x24b20c=_0x24b20c||0xc8;return function(_0x53281d){if(_0x53281d){return _0x7137c0['status'](_0x24b20c)[_0x36cb('0x1c')](_0x53281d);}};}function respondWithFilteredResult(_0x3e4615,_0x35dec9){return function(_0x3abba5){if(_0x3abba5){var _0xc4c604=typeof _0x35dec9[_0x36cb('0x1d')]===_0x36cb('0x1e')&&typeof _0x35dec9[_0x36cb('0x1f')]===_0x36cb('0x1e');var _0x4b5750=_0x3abba5['count'];var _0x176e99=_0xc4c604?0x0:_0x35dec9['offset'];var _0x198f83=_0xc4c604?_0x3abba5[_0x36cb('0x20')]:_0x35dec9[_0x36cb('0x1d')]+_0x35dec9['limit'];var _0x328e81;if(_0x198f83>=_0x4b5750){_0x198f83=_0x4b5750;_0x328e81=0xc8;}else{_0x328e81=0xce;}_0x3e4615[_0x36cb('0x1b')](_0x328e81);return _0x3e4615[_0x36cb('0x21')](_0x36cb('0x22'),_0x176e99+'-'+_0x198f83+'/'+_0x4b5750)[_0x36cb('0x1c')](_0x3abba5);}return null;};}function patchUpdates(_0x3debed){return function(_0xfb6ffc){try{jsonpatch[_0x36cb('0x23')](_0xfb6ffc,_0x3debed,!![]);}catch(_0xb75356){return BPromise['reject'](_0xb75356);}return _0xfb6ffc[_0x36cb('0x24')]();};}function saveUpdates(_0x199e41,_0x2d9c4e){return function(_0x5052b4){if(_0x5052b4){return _0x5052b4[_0x36cb('0x25')](_0x199e41)['then'](function(_0x5e594b){return _0x5e594b;});}return null;};}function removeEntity(_0x41849b,_0x5e04a0){return function(_0x1b600f){if(_0x1b600f){return _0x1b600f[_0x36cb('0x26')]()[_0x36cb('0x27')](function(){_0x41849b[_0x36cb('0x1b')](0xcc)[_0x36cb('0x28')]();});}};}function handleEntityNotFound(_0x29d58e,_0x4d423a){return function(_0x2c1b87){if(!_0x2c1b87){_0x29d58e[_0x36cb('0x1a')](0x194);}return _0x2c1b87;};}function handleError(_0x5d0f98,_0x398df9){_0x398df9=_0x398df9||0x1f4;return function(_0x358739){logger[_0x36cb('0x29')](_0x358739[_0x36cb('0x2a')]);if(_0x358739[_0x36cb('0x2b')]){delete _0x358739[_0x36cb('0x2b')];}_0x5d0f98[_0x36cb('0x1b')](_0x398df9)[_0x36cb('0x2c')](_0x358739);};}exports[_0x36cb('0x2d')]=function(_0x12b0d4,_0x4ad313){var _0x3d17c6={},_0x2c846d={},_0x3361ec={'count':0x0,'rows':[]};var _0x1e39c3=_[_0x36cb('0x2e')](db[_0x36cb('0x2f')][_0x36cb('0x30')],function(_0x39887b){return{'name':_0x39887b['fieldName'],'type':_0x39887b[_0x36cb('0x31')][_0x36cb('0x32')]};});_0x2c846d[_0x36cb('0x33')]=_[_0x36cb('0x2e')](_0x1e39c3,'name');_0x2c846d[_0x36cb('0x34')]=_[_0x36cb('0x35')](_0x12b0d4[_0x36cb('0x34')]);_0x2c846d[_0x36cb('0x36')]=_[_0x36cb('0x37')](_0x2c846d[_0x36cb('0x33')],_0x2c846d['query']);_0x3d17c6[_0x36cb('0x38')]=_[_0x36cb('0x37')](_0x2c846d[_0x36cb('0x33')],qs['fields'](_0x12b0d4[_0x36cb('0x34')][_0x36cb('0x39')]));_0x3d17c6[_0x36cb('0x38')]=_0x3d17c6['attributes'][_0x36cb('0x3a')]?_0x3d17c6['attributes']:_0x2c846d[_0x36cb('0x33')];if(!_0x12b0d4[_0x36cb('0x34')][_0x36cb('0x3b')](_0x36cb('0x3c'))){_0x3d17c6[_0x36cb('0x1f')]=qs['limit'](_0x12b0d4[_0x36cb('0x34')][_0x36cb('0x1f')]);_0x3d17c6['offset']=qs[_0x36cb('0x1d')](_0x12b0d4['query'][_0x36cb('0x1d')]);}_0x3d17c6[_0x36cb('0x3d')]=qs[_0x36cb('0x3e')](_0x12b0d4[_0x36cb('0x34')]['sort']);_0x3d17c6[_0x36cb('0x3f')]=qs[_0x36cb('0x36')](_['pick'](_0x12b0d4[_0x36cb('0x34')],_0x2c846d[_0x36cb('0x36')]),_0x1e39c3);if(_0x12b0d4[_0x36cb('0x34')]['filter']){_0x3d17c6[_0x36cb('0x3f')]=_['merge'](_0x3d17c6[_0x36cb('0x3f')],{'$or':_[_0x36cb('0x2e')](_0x1e39c3,function(_0x3dd9dd){if(_0x3dd9dd[_0x36cb('0x31')]!==_0x36cb('0x40')){var _0x116e5f={};_0x116e5f[_0x3dd9dd['name']]={'$like':'%'+_0x12b0d4[_0x36cb('0x34')][_0x36cb('0x41')]+'%'};return _0x116e5f;}})});}_0x3d17c6=_['merge']({},_0x3d17c6,_0x12b0d4['options']);var _0xe7d90f={'where':_0x3d17c6[_0x36cb('0x3f')]};return db[_0x36cb('0x2f')]['count'](_0xe7d90f)[_0x36cb('0x27')](function(_0x502de2){_0x3361ec[_0x36cb('0x20')]=_0x502de2;if(_0x12b0d4[_0x36cb('0x34')][_0x36cb('0x42')]){_0x3d17c6[_0x36cb('0x43')]=[{'all':!![]}];}return db[_0x36cb('0x2f')][_0x36cb('0x44')](_0x3d17c6);})[_0x36cb('0x27')](function(_0x4d9650){_0x3361ec[_0x36cb('0x45')]=_0x4d9650;return _0x3361ec;})[_0x36cb('0x27')](respondWithFilteredResult(_0x4ad313,_0x3d17c6))[_0x36cb('0x46')](handleError(_0x4ad313,null));};exports[_0x36cb('0x47')]=function(_0x12ea77,_0x590ab4){var _0x2353b1={'raw':![],'where':{'id':_0x12ea77[_0x36cb('0x48')]['id']}},_0x5ccb02={};_0x5ccb02['model']=_['keys'](db[_0x36cb('0x2f')][_0x36cb('0x30')]);_0x5ccb02[_0x36cb('0x34')]=_[_0x36cb('0x35')](_0x12ea77[_0x36cb('0x34')]);_0x5ccb02[_0x36cb('0x36')]=_[_0x36cb('0x37')](_0x5ccb02[_0x36cb('0x33')],_0x5ccb02[_0x36cb('0x34')]);_0x2353b1[_0x36cb('0x38')]=_[_0x36cb('0x37')](_0x5ccb02[_0x36cb('0x33')],qs[_0x36cb('0x39')](_0x12ea77['query'][_0x36cb('0x39')]));_0x2353b1[_0x36cb('0x38')]=_0x2353b1['attributes']['length']?_0x2353b1[_0x36cb('0x38')]:_0x5ccb02[_0x36cb('0x33')];if(_0x12ea77[_0x36cb('0x34')][_0x36cb('0x42')]){_0x2353b1[_0x36cb('0x43')]=[{'all':!![]}];}_0x2353b1=_[_0x36cb('0x49')]({},_0x2353b1,_0x12ea77['options']);return db[_0x36cb('0x2f')][_0x36cb('0x4a')](_0x2353b1)[_0x36cb('0x27')](handleEntityNotFound(_0x590ab4,null))['then'](respondWithResult(_0x590ab4,null))[_0x36cb('0x46')](handleError(_0x590ab4,null));};exports[_0x36cb('0x4b')]=function(_0x2f26ed,_0x8cc821){return db['SalesforceAccount']['create'](_0x2f26ed[_0x36cb('0x4c')],{})[_0x36cb('0x27')](respondWithResult(_0x8cc821,0xc9))[_0x36cb('0x46')](handleError(_0x8cc821,null));};exports[_0x36cb('0x25')]=function(_0x5a732d,_0x18f21b){if(_0x5a732d[_0x36cb('0x4c')]['id']){delete _0x5a732d['body']['id'];}return db[_0x36cb('0x2f')]['find']({'where':{'id':_0x5a732d[_0x36cb('0x48')]['id']}})[_0x36cb('0x27')](handleEntityNotFound(_0x18f21b,null))[_0x36cb('0x27')](saveUpdates(_0x5a732d['body'],null))[_0x36cb('0x27')](respondWithResult(_0x18f21b,null))[_0x36cb('0x46')](handleError(_0x18f21b,null));};exports[_0x36cb('0x26')]=function(_0xd9c32d,_0x33cbd1){return db[_0x36cb('0x2f')]['find']({'where':{'id':_0xd9c32d[_0x36cb('0x48')]['id']}})['then'](handleEntityNotFound(_0x33cbd1,null))[_0x36cb('0x27')](removeEntity(_0x33cbd1,null))['catch'](handleError(_0x33cbd1,null));};exports[_0x36cb('0x4d')]=function(_0x341d31,_0x54615f,_0x16bb2c){var _0xd2761a={};var _0xd38028={};var _0x9b96fc;var _0x2dbcc9;return db[_0x36cb('0x2f')][_0x36cb('0x4e')]({'where':{'id':_0x341d31[_0x36cb('0x48')]['id']}})[_0x36cb('0x27')](handleEntityNotFound(_0x54615f,null))[_0x36cb('0x27')](function(_0x346e94){if(_0x346e94){_0x9b96fc=_0x346e94;_0xd38028[_0x36cb('0x33')]=_[_0x36cb('0x35')](db[_0x36cb('0x4f')][_0x36cb('0x30')]);_0xd38028[_0x36cb('0x34')]=_[_0x36cb('0x35')](_0x341d31['query']);_0xd38028[_0x36cb('0x36')]=_[_0x36cb('0x37')](_0xd38028[_0x36cb('0x33')],_0xd38028['query']);_0xd2761a[_0x36cb('0x38')]=_[_0x36cb('0x37')](_0xd38028[_0x36cb('0x33')],qs[_0x36cb('0x39')](_0x341d31[_0x36cb('0x34')][_0x36cb('0x39')]));_0xd2761a['attributes']=_0xd2761a[_0x36cb('0x38')][_0x36cb('0x3a')]?_0xd2761a[_0x36cb('0x38')]:_0xd38028[_0x36cb('0x33')];_0xd2761a[_0x36cb('0x3d')]=qs[_0x36cb('0x3e')](_0x341d31[_0x36cb('0x34')][_0x36cb('0x3e')]);_0xd2761a[_0x36cb('0x3f')]=qs[_0x36cb('0x36')](_['pick'](_0x341d31['query'],_0xd38028[_0x36cb('0x36')]));if(_0x341d31[_0x36cb('0x34')][_0x36cb('0x41')]){_0xd2761a[_0x36cb('0x3f')]=_[_0x36cb('0x49')](_0xd2761a['where'],{'$or':_[_0x36cb('0x2e')](_0xd2761a[_0x36cb('0x38')],function(_0x461178){var _0x264e1d={};_0x264e1d[_0x461178]={'$like':'%'+_0x341d31[_0x36cb('0x34')][_0x36cb('0x41')]+'%'};return _0x264e1d;})});}_0xd2761a=_[_0x36cb('0x49')]({},_0xd2761a,_0x341d31[_0x36cb('0x50')]);return _0x9b96fc['getConfigurations'](_0xd2761a);}})[_0x36cb('0x27')](function(_0x251d17){if(_0x251d17){_0x2dbcc9=_0x251d17[_0x36cb('0x3a')];if(!_0x341d31[_0x36cb('0x34')]['hasOwnProperty'](_0x36cb('0x3c'))){_0xd2761a[_0x36cb('0x1f')]=qs[_0x36cb('0x1f')](_0x341d31[_0x36cb('0x34')][_0x36cb('0x1f')]);_0xd2761a[_0x36cb('0x1d')]=qs['offset'](_0x341d31[_0x36cb('0x34')][_0x36cb('0x1d')]);}return _0x9b96fc[_0x36cb('0x4d')](_0xd2761a);}})['then'](function(_0x1f59a0){if(_0x1f59a0){return _0x1f59a0?{'count':_0x2dbcc9,'rows':_0x1f59a0}:null;}})[_0x36cb('0x27')](respondWithResult(_0x54615f,null))[_0x36cb('0x46')](handleError(_0x54615f,null));};exports[_0x36cb('0x51')]=function(_0x2b4c0a,_0x27d7ed,_0x33400b){if(_0x2b4c0a[_0x36cb('0x4c')]['id']){delete _0x2b4c0a[_0x36cb('0x4c')]['id'];}return db['SalesforceAccount'][_0x36cb('0x4e')]({'where':{'id':_0x2b4c0a['params']['id']}})[_0x36cb('0x27')](handleEntityNotFound(_0x27d7ed,null))['then'](function(_0x13734b){if(_0x13734b){_0x2b4c0a[_0x36cb('0x4c')]['AccountId']=_0x13734b['id'];_0x2b4c0a[_0x36cb('0x4c')][_0x36cb('0x52')]=integrations[_0x36cb('0x53')](_0x2b4c0a['body'][_0x36cb('0x54')],_0x2b4c0a[_0x36cb('0x4c')][_0x36cb('0x31')]);_0x2b4c0a[_0x36cb('0x4c')][_0x36cb('0x55')]=integrations[_0x36cb('0x56')](_0x2b4c0a[_0x36cb('0x4c')][_0x36cb('0x54')],_0x2b4c0a['body']['type']);return db[_0x36cb('0x4f')]['create'](_0x2b4c0a['body'],{'include':[{'model':db['SalesforceField'],'as':_0x36cb('0x52')},{'model':db[_0x36cb('0x57')],'as':'Descriptions'}]});}return null;})[_0x36cb('0x27')](respondWithResult(_0x27d7ed,null))[_0x36cb('0x46')](handleError(_0x27d7ed,null));};exports[_0x36cb('0x58')]=function(_0xbf9871,_0x573b82,_0x4d722c){var _0x3e9260;var _0x17d516='';var _0x13afc3=_0x36cb('0x59');return db[_0x36cb('0x2f')][_0x36cb('0x4e')]({'where':{'id':_0xbf9871[_0x36cb('0x48')]['id']},'attributes':['id',_0x36cb('0x5a'),'clientId','clientSecret',_0x36cb('0x5b'),_0x36cb('0x5c'),_0x36cb('0x5d')]})[_0x36cb('0x27')](handleEntityNotFound(_0x573b82,null))[_0x36cb('0x27')](function(_0x201222){if(_0x201222){_0x17d516=_0x201222[_0x36cb('0x5a')];var _0x400c37=_0x17d516[_0x36cb('0x5e')](-0x1);if(_0x400c37==='/'){_0x17d516=_0x17d516[_0x36cb('0x5f')](0x0,_0x17d516[_0x36cb('0x60')](_0x400c37));}_0x3e9260=new jsforce[(_0x36cb('0x61'))]({'oauth2':{'loginUrl':_0x17d516,'clientId':_0x201222[_0x36cb('0x62')],'clientSecret':_0x201222['clientSecret']}});return _0x3e9260[_0x36cb('0x63')](_0x201222[_0x36cb('0x5b')],_0x201222[_0x36cb('0x5c')][_0x36cb('0x64')](_0x201222['securityToken']));}})[_0x36cb('0x27')](function(_0x5d6b76){if(_0x5d6b76){if(!_[_0x36cb('0x65')](_0xbf9871[_0x36cb('0x34')][_0x36cb('0x66')])){_0x13afc3=_0xbf9871[_0x36cb('0x34')][_0x36cb('0x66')];}return _0x3e9260['sobject'](_0x13afc3)[_0x36cb('0x67')]();}})[_0x36cb('0x27')](function(_0x136b5a){var _0x9564b1=[_0x36cb('0x68'),_0x36cb('0x69'),'IsReminderSet',_0x36cb('0x6a'),_0x36cb('0x6b'),_0x36cb('0x6c')];var _0x24bfbb=[_0x36cb('0x6d'),'int','picklist','boolean',_0x36cb('0x6e'),_0x36cb('0x6f'),_0x36cb('0x70')];if(_0x136b5a){_[_0x36cb('0x71')](_0x136b5a[_0x36cb('0x39')],function(_0x2b20bb){return _0x9564b1[_0x36cb('0x72')](_0x2b20bb[_0x36cb('0x2b')])||!_0x24bfbb[_0x36cb('0x72')](_0x2b20bb[_0x36cb('0x31')]);});return{'count':_0x136b5a[_0x36cb('0x39')][_0x36cb('0x3a')],'rows':_['map'](_0x136b5a[_0x36cb('0x39')],function(_0x4e30ed){return{'id':_0x4e30ed[_0x36cb('0x2b')],'name':_0x4e30ed[_0x36cb('0x73')],'custom':_0x4e30ed[_0x36cb('0x74')],'options':_0x4e30ed[_0x36cb('0x75')][_0x36cb('0x3a')]>0x0?_[_0x36cb('0x2e')](_0x4e30ed['picklistValues'],function(_0x2aed56){return{'name':_0x2aed56[_0x36cb('0x73')],'value':_0x2aed56[_0x36cb('0x76')]};}):_0x4e30ed['type']=='boolean'?[{'name':_0x36cb('0x77'),'value':_0x36cb('0x78')},{'name':_0x36cb('0x79'),'value':_0x36cb('0x7a')}]:[]};})};}})[_0x36cb('0x27')](respondWithResult(_0x573b82,null))[_0x36cb('0x46')](function(_0x24e9c6){var _0x2b3ec9=_0xbf9871[_0x36cb('0x34')][_0x36cb('0x7b')]?0x1f4:_0x24e9c6[_0x36cb('0x7c')]||0x1f4;logger[_0x36cb('0x29')](_0x36cb('0x7d'),_0x36cb('0x58'),_0x2b3ec9,JSON[_0x36cb('0x7e')](_0x24e9c6));delete _0x24e9c6[_0x36cb('0x2b')];if(_0x2b3ec9===0x191){_0x2b3ec9=0x190;}_0x573b82['status'](_0x2b3ec9)['send'](_0xbf9871['query'][_0x36cb('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x24e9c6[_0x36cb('0x7c')]}:_0x24e9c6);});}; \ No newline at end of file +var _0x665b=['limit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','Connection','login','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','undefined','offset','count','Content-Range','json','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','update','findOne','SalesforceConfiguration','order','getConfigurations'];(function(_0x1bbda2,_0x2dd81c){var _0x45f61f=function(_0x63c951){while(--_0x63c951){_0x1bbda2['push'](_0x1bbda2['shift']());}};_0x45f61f(++_0x2dd81c);}(_0x665b,0x12e));var _0xb665=function(_0x145d79,_0x25f89c){_0x145d79=_0x145d79-0x0;var _0x58dd3d=_0x665b[_0x145d79];return _0x58dd3d;};'use strict';var emlformat=require(_0xb665('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb665('0x1'));var jsonpatch=require(_0xb665('0x2'));var rp=require(_0xb665('0x3'));var moment=require(_0xb665('0x4'));var BPromise=require(_0xb665('0x5'));var Mustache=require('mustache');var util=require(_0xb665('0x6'));var path=require('path');var sox=require(_0xb665('0x7'));var csv=require(_0xb665('0x8'));var ejs=require(_0xb665('0x9'));var fs=require('fs');var fs_extra=require(_0xb665('0xa'));var _=require(_0xb665('0xb'));var squel=require(_0xb665('0xc'));var crypto=require(_0xb665('0xd'));var jsforce=require(_0xb665('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb665('0x8'));var querystring=require(_0xb665('0xf'));var Papa=require('papaparse');var Redis=require(_0xb665('0x10'));var authService=require(_0xb665('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb665('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb665('0x13'));var utils=require(_0xb665('0x14'));var config=require(_0xb665('0x15'));var licenseUtil=require(_0xb665('0x16'));var db=require(_0xb665('0x17'))['db'];var integrations=require(_0xb665('0x18'));function respondWithStatusCode(_0x6764f8,_0xda46e0){_0xda46e0=_0xda46e0||0xcc;return function(_0x1d739b){if(_0x1d739b){return _0x6764f8['sendStatus'](_0xda46e0);}return _0x6764f8[_0xb665('0x19')](_0xda46e0)[_0xb665('0x1a')]();};}function respondWithResult(_0x7243f3,_0x157e61){_0x157e61=_0x157e61||0xc8;return function(_0x584ec3){if(_0x584ec3){return _0x7243f3[_0xb665('0x19')](_0x157e61)['json'](_0x584ec3);}};}function respondWithFilteredResult(_0x32e86e,_0x6134fa){return function(_0x525262){if(_0x525262){var _0x455cc8=typeof _0x6134fa['offset']===_0xb665('0x1b')&&typeof _0x6134fa['limit']==='undefined';var _0x5eff15=_0x525262['count'];var _0x425734=_0x455cc8?0x0:_0x6134fa[_0xb665('0x1c')];var _0x2b7499=_0x455cc8?_0x525262[_0xb665('0x1d')]:_0x6134fa[_0xb665('0x1c')]+_0x6134fa['limit'];var _0x11495c;if(_0x2b7499>=_0x5eff15){_0x2b7499=_0x5eff15;_0x11495c=0xc8;}else{_0x11495c=0xce;}_0x32e86e[_0xb665('0x19')](_0x11495c);return _0x32e86e['set'](_0xb665('0x1e'),_0x425734+'-'+_0x2b7499+'/'+_0x5eff15)[_0xb665('0x1f')](_0x525262);}return null;};}function patchUpdates(_0x36b4e3){return function(_0x1c9f9a){try{jsonpatch['apply'](_0x1c9f9a,_0x36b4e3,!![]);}catch(_0x11c75e){return BPromise[_0xb665('0x20')](_0x11c75e);}return _0x1c9f9a[_0xb665('0x21')]();};}function saveUpdates(_0x5d972a,_0x46ecea){return function(_0x1f15e6){if(_0x1f15e6){return _0x1f15e6['update'](_0x5d972a)['then'](function(_0x18fcd8){return _0x18fcd8;});}return null;};}function removeEntity(_0x4078e5,_0x2cc627){return function(_0x5e5d80){if(_0x5e5d80){return _0x5e5d80[_0xb665('0x22')]()[_0xb665('0x23')](function(){_0x4078e5[_0xb665('0x19')](0xcc)[_0xb665('0x1a')]();});}};}function handleEntityNotFound(_0x2baded,_0x55e7fd){return function(_0x4f6dc7){if(!_0x4f6dc7){_0x2baded[_0xb665('0x24')](0x194);}return _0x4f6dc7;};}function handleError(_0x2e284d,_0x2e91df){_0x2e91df=_0x2e91df||0x1f4;return function(_0xad13d2){logger[_0xb665('0x25')](_0xad13d2[_0xb665('0x26')]);if(_0xad13d2[_0xb665('0x27')]){delete _0xad13d2['name'];}_0x2e284d['status'](_0x2e91df)[_0xb665('0x28')](_0xad13d2);};}exports[_0xb665('0x29')]=function(_0x3068e4,_0x469ad1){var _0x100d08={},_0x2615ee={},_0x1154d8={'count':0x0,'rows':[]};var _0x3ef0b9=_[_0xb665('0x2a')](db[_0xb665('0x2b')][_0xb665('0x2c')],function(_0x3efe8d){return{'name':_0x3efe8d[_0xb665('0x2d')],'type':_0x3efe8d[_0xb665('0x2e')][_0xb665('0x2f')]};});_0x2615ee['model']=_[_0xb665('0x2a')](_0x3ef0b9,_0xb665('0x27'));_0x2615ee[_0xb665('0x30')]=_[_0xb665('0x31')](_0x3068e4[_0xb665('0x30')]);_0x2615ee[_0xb665('0x32')]=_[_0xb665('0x33')](_0x2615ee['model'],_0x2615ee[_0xb665('0x30')]);_0x100d08[_0xb665('0x34')]=_[_0xb665('0x33')](_0x2615ee[_0xb665('0x35')],qs[_0xb665('0x36')](_0x3068e4[_0xb665('0x30')][_0xb665('0x36')]));_0x100d08['attributes']=_0x100d08[_0xb665('0x34')][_0xb665('0x37')]?_0x100d08[_0xb665('0x34')]:_0x2615ee[_0xb665('0x35')];if(!_0x3068e4[_0xb665('0x30')][_0xb665('0x38')](_0xb665('0x39'))){_0x100d08['limit']=qs['limit'](_0x3068e4[_0xb665('0x30')]['limit']);_0x100d08[_0xb665('0x1c')]=qs[_0xb665('0x1c')](_0x3068e4[_0xb665('0x30')]['offset']);}_0x100d08['order']=qs[_0xb665('0x3a')](_0x3068e4[_0xb665('0x30')][_0xb665('0x3a')]);_0x100d08['where']=qs['filters'](_[_0xb665('0x3b')](_0x3068e4[_0xb665('0x30')],_0x2615ee[_0xb665('0x32')]),_0x3ef0b9);if(_0x3068e4[_0xb665('0x30')][_0xb665('0x3c')]){_0x100d08[_0xb665('0x3d')]=_[_0xb665('0x3e')](_0x100d08[_0xb665('0x3d')],{'$or':_[_0xb665('0x2a')](_0x3ef0b9,function(_0x566a4c){if(_0x566a4c[_0xb665('0x2e')]!==_0xb665('0x3f')){var _0x2eec5d={};_0x2eec5d[_0x566a4c['name']]={'$like':'%'+_0x3068e4[_0xb665('0x30')]['filter']+'%'};return _0x2eec5d;}})});}_0x100d08=_[_0xb665('0x3e')]({},_0x100d08,_0x3068e4[_0xb665('0x40')]);var _0x5e7979={'where':_0x100d08[_0xb665('0x3d')]};return db['SalesforceAccount'][_0xb665('0x1d')](_0x5e7979)[_0xb665('0x23')](function(_0x2048b3){_0x1154d8[_0xb665('0x1d')]=_0x2048b3;if(_0x3068e4['query'][_0xb665('0x41')]){_0x100d08[_0xb665('0x42')]=[{'all':!![]}];}return db[_0xb665('0x2b')][_0xb665('0x43')](_0x100d08);})[_0xb665('0x23')](function(_0x408127){_0x1154d8[_0xb665('0x44')]=_0x408127;return _0x1154d8;})[_0xb665('0x23')](respondWithFilteredResult(_0x469ad1,_0x100d08))[_0xb665('0x45')](handleError(_0x469ad1,null));};exports['show']=function(_0xc1333c,_0x5ad5f4){var _0x321384={'raw':![],'where':{'id':_0xc1333c[_0xb665('0x46')]['id']}},_0x3cd68c={};_0x3cd68c[_0xb665('0x35')]=_[_0xb665('0x31')](db[_0xb665('0x2b')]['rawAttributes']);_0x3cd68c['query']=_[_0xb665('0x31')](_0xc1333c['query']);_0x3cd68c[_0xb665('0x32')]=_[_0xb665('0x33')](_0x3cd68c[_0xb665('0x35')],_0x3cd68c[_0xb665('0x30')]);_0x321384[_0xb665('0x34')]=_[_0xb665('0x33')](_0x3cd68c[_0xb665('0x35')],qs[_0xb665('0x36')](_0xc1333c[_0xb665('0x30')][_0xb665('0x36')]));_0x321384[_0xb665('0x34')]=_0x321384[_0xb665('0x34')][_0xb665('0x37')]?_0x321384['attributes']:_0x3cd68c[_0xb665('0x35')];if(_0xc1333c[_0xb665('0x30')][_0xb665('0x41')]){_0x321384['include']=[{'all':!![]}];}_0x321384=_[_0xb665('0x3e')]({},_0x321384,_0xc1333c['options']);return db[_0xb665('0x2b')][_0xb665('0x47')](_0x321384)[_0xb665('0x23')](handleEntityNotFound(_0x5ad5f4,null))[_0xb665('0x23')](respondWithResult(_0x5ad5f4,null))[_0xb665('0x45')](handleError(_0x5ad5f4,null));};exports[_0xb665('0x48')]=function(_0x3a9664,_0x486ace){return db[_0xb665('0x2b')][_0xb665('0x48')](_0x3a9664[_0xb665('0x49')],{})[_0xb665('0x23')](respondWithResult(_0x486ace,0xc9))['catch'](handleError(_0x486ace,null));};exports[_0xb665('0x4a')]=function(_0x1c6bec,_0x3a20d2){if(_0x1c6bec[_0xb665('0x49')]['id']){delete _0x1c6bec[_0xb665('0x49')]['id'];}return db['SalesforceAccount'][_0xb665('0x47')]({'where':{'id':_0x1c6bec[_0xb665('0x46')]['id']}})[_0xb665('0x23')](handleEntityNotFound(_0x3a20d2,null))['then'](saveUpdates(_0x1c6bec[_0xb665('0x49')],null))[_0xb665('0x23')](respondWithResult(_0x3a20d2,null))[_0xb665('0x45')](handleError(_0x3a20d2,null));};exports['destroy']=function(_0x53e7c4,_0x12d2a3){return db[_0xb665('0x2b')][_0xb665('0x47')]({'where':{'id':_0x53e7c4['params']['id']}})[_0xb665('0x23')](handleEntityNotFound(_0x12d2a3,null))[_0xb665('0x23')](removeEntity(_0x12d2a3,null))[_0xb665('0x45')](handleError(_0x12d2a3,null));};exports['getConfigurations']=function(_0x5b5521,_0xf6fa71,_0x1324ba){var _0x3031a5={};var _0x2bbe91={};var _0x159ce4;var _0x1d2bd3;return db[_0xb665('0x2b')][_0xb665('0x4b')]({'where':{'id':_0x5b5521[_0xb665('0x46')]['id']}})[_0xb665('0x23')](handleEntityNotFound(_0xf6fa71,null))[_0xb665('0x23')](function(_0x15a147){if(_0x15a147){_0x159ce4=_0x15a147;_0x2bbe91[_0xb665('0x35')]=_[_0xb665('0x31')](db[_0xb665('0x4c')][_0xb665('0x2c')]);_0x2bbe91[_0xb665('0x30')]=_[_0xb665('0x31')](_0x5b5521[_0xb665('0x30')]);_0x2bbe91[_0xb665('0x32')]=_[_0xb665('0x33')](_0x2bbe91['model'],_0x2bbe91[_0xb665('0x30')]);_0x3031a5[_0xb665('0x34')]=_[_0xb665('0x33')](_0x2bbe91['model'],qs['fields'](_0x5b5521[_0xb665('0x30')][_0xb665('0x36')]));_0x3031a5[_0xb665('0x34')]=_0x3031a5[_0xb665('0x34')][_0xb665('0x37')]?_0x3031a5['attributes']:_0x2bbe91[_0xb665('0x35')];_0x3031a5[_0xb665('0x4d')]=qs['sort'](_0x5b5521[_0xb665('0x30')][_0xb665('0x3a')]);_0x3031a5[_0xb665('0x3d')]=qs['filters'](_['pick'](_0x5b5521['query'],_0x2bbe91['filters']));if(_0x5b5521[_0xb665('0x30')]['filter']){_0x3031a5[_0xb665('0x3d')]=_[_0xb665('0x3e')](_0x3031a5['where'],{'$or':_[_0xb665('0x2a')](_0x3031a5[_0xb665('0x34')],function(_0x7ba7ab){var _0x37b183={};_0x37b183[_0x7ba7ab]={'$like':'%'+_0x5b5521[_0xb665('0x30')][_0xb665('0x3c')]+'%'};return _0x37b183;})});}_0x3031a5=_[_0xb665('0x3e')]({},_0x3031a5,_0x5b5521[_0xb665('0x40')]);return _0x159ce4[_0xb665('0x4e')](_0x3031a5);}})['then'](function(_0x1f6fd9){if(_0x1f6fd9){_0x1d2bd3=_0x1f6fd9[_0xb665('0x37')];if(!_0x5b5521['query'][_0xb665('0x38')](_0xb665('0x39'))){_0x3031a5[_0xb665('0x4f')]=qs[_0xb665('0x4f')](_0x5b5521[_0xb665('0x30')][_0xb665('0x4f')]);_0x3031a5[_0xb665('0x1c')]=qs['offset'](_0x5b5521['query'][_0xb665('0x1c')]);}return _0x159ce4[_0xb665('0x4e')](_0x3031a5);}})[_0xb665('0x23')](function(_0x2437ed){if(_0x2437ed){return _0x2437ed?{'count':_0x1d2bd3,'rows':_0x2437ed}:null;}})[_0xb665('0x23')](respondWithResult(_0xf6fa71,null))[_0xb665('0x45')](handleError(_0xf6fa71,null));};exports[_0xb665('0x50')]=function(_0x772171,_0x4cca13,_0x465de7){if(_0x772171[_0xb665('0x49')]['id']){delete _0x772171[_0xb665('0x49')]['id'];}return db[_0xb665('0x2b')]['findOne']({'where':{'id':_0x772171['params']['id']}})['then'](handleEntityNotFound(_0x4cca13,null))[_0xb665('0x23')](function(_0x564b56){if(_0x564b56){_0x772171['body'][_0xb665('0x51')]=_0x564b56['id'];_0x772171[_0xb665('0x49')][_0xb665('0x52')]=integrations[_0xb665('0x53')](_0x772171[_0xb665('0x49')]['channel'],_0x772171['body'][_0xb665('0x2e')]);_0x772171[_0xb665('0x49')][_0xb665('0x54')]=integrations['getDescriptions'](_0x772171[_0xb665('0x49')]['channel'],_0x772171[_0xb665('0x49')][_0xb665('0x2e')]);return db[_0xb665('0x4c')][_0xb665('0x48')](_0x772171[_0xb665('0x49')],{'include':[{'model':db[_0xb665('0x55')],'as':_0xb665('0x52')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0xb665('0x23')](respondWithResult(_0x4cca13,null))[_0xb665('0x45')](handleError(_0x4cca13,null));};exports[_0xb665('0x56')]=function(_0x296088,_0x2e0cb1,_0x21fa17){var _0x13dc85;var _0x2de642='';var _0x1a3596='Task';return db[_0xb665('0x2b')][_0xb665('0x4b')]({'where':{'id':_0x296088['params']['id']},'attributes':['id',_0xb665('0x57'),_0xb665('0x58'),_0xb665('0x59'),_0xb665('0x5a'),_0xb665('0x5b'),_0xb665('0x5c')]})['then'](handleEntityNotFound(_0x2e0cb1,null))[_0xb665('0x23')](function(_0x43533d){if(_0x43533d){_0x2de642=_0x43533d[_0xb665('0x57')];var _0x130488=_0x2de642['slice'](-0x1);if(_0x130488==='/'){_0x2de642=_0x2de642[_0xb665('0x5d')](0x0,_0x2de642[_0xb665('0x5e')](_0x130488));}_0x13dc85=new jsforce[(_0xb665('0x5f'))]({'oauth2':{'loginUrl':_0x2de642,'clientId':_0x43533d[_0xb665('0x58')],'clientSecret':_0x43533d['clientSecret']}});return _0x13dc85[_0xb665('0x60')](_0x43533d[_0xb665('0x5a')],_0x43533d[_0xb665('0x5b')][_0xb665('0x61')](_0x43533d[_0xb665('0x5c')]));}})[_0xb665('0x23')](function(_0x531b40){if(_0x531b40){if(!_['isNil'](_0x296088[_0xb665('0x30')][_0xb665('0x62')])){_0x1a3596=_0x296088[_0xb665('0x30')][_0xb665('0x62')];}return _0x13dc85[_0xb665('0x63')](_0x1a3596)[_0xb665('0x64')]();}})[_0xb665('0x23')](function(_0x5098f0){var _0x2afbf6=[_0xb665('0x65'),_0xb665('0x66'),_0xb665('0x67'),_0xb665('0x68'),_0xb665('0x69'),_0xb665('0x6a')];var _0x5f506e=[_0xb665('0x6b'),_0xb665('0x6c'),_0xb665('0x6d'),_0xb665('0x6e'),_0xb665('0x6f'),'textarea','phone'];if(_0x5098f0){_[_0xb665('0x70')](_0x5098f0[_0xb665('0x36')],function(_0x231970){return _0x2afbf6[_0xb665('0x71')](_0x231970['name'])||!_0x5f506e[_0xb665('0x71')](_0x231970[_0xb665('0x2e')]);});return{'count':_0x5098f0[_0xb665('0x36')][_0xb665('0x37')],'rows':_[_0xb665('0x2a')](_0x5098f0[_0xb665('0x36')],function(_0x39f405){return{'id':_0x39f405[_0xb665('0x27')],'name':_0x39f405[_0xb665('0x72')],'custom':_0x39f405[_0xb665('0x73')],'options':_0x39f405[_0xb665('0x74')][_0xb665('0x37')]>0x0?_[_0xb665('0x2a')](_0x39f405[_0xb665('0x74')],function(_0x2a040c){return{'name':_0x2a040c[_0xb665('0x72')],'value':_0x2a040c[_0xb665('0x75')]};}):_0x39f405[_0xb665('0x2e')]==_0xb665('0x6e')?[{'name':_0xb665('0x76'),'value':_0xb665('0x77')},{'name':_0xb665('0x78'),'value':_0xb665('0x79')}]:[]};})};}})['then'](respondWithResult(_0x2e0cb1,null))[_0xb665('0x45')](function(_0x5e7012){var _0x4580ac=_0x296088['query'][_0xb665('0x7a')]?0x1f4:_0x5e7012[_0xb665('0x7b')]||0x1f4;logger[_0xb665('0x25')](_0xb665('0x7c'),_0xb665('0x56'),_0x4580ac,JSON[_0xb665('0x7d')](_0x5e7012));delete _0x5e7012[_0xb665('0x27')];if(_0x4580ac===0x191){_0x4580ac=0x190;}_0x2e0cb1['status'](_0x4580ac)['send'](_0x296088[_0xb665('0x30')][_0xb665('0x7a')]?{'message':_0xb665('0x7e'),'statusCode':_0x5e7012[_0xb665('0x7b')]}:_0x5e7012);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index b61b322..99ba3ef 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 _0x0eec=['../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xd30042,_0x1b7b1c){var _0x1bccaa=function(_0x53d1e3){while(--_0x53d1e3){_0xd30042['push'](_0xd30042['shift']());}};_0x1bccaa(++_0x1b7b1c);}(_0x0eec,0xac));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc0ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc0ee('0x1'));var moment=require(_0xc0ee('0x2'));var BPromise=require(_0xc0ee('0x3'));var rp=require(_0xc0ee('0x4'));var fs=require('fs');var path=require(_0xc0ee('0x5'));var rimraf=require(_0xc0ee('0x6'));var config=require(_0xc0ee('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xc0ee('0x8'));module['exports']=function(_0x218797,_0x39022a){return _0x218797[_0xc0ee('0x9')](_0xc0ee('0xa'),attributes,{'tableName':_0xc0ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x863a=['SalesforceAccount','int_salesforce_accounts','util','../../config/logger','moment','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x15204b,_0x12d6af){var _0x410d73=function(_0x48e1df){while(--_0x48e1df){_0x15204b['push'](_0x15204b['shift']());}};_0x410d73(++_0x12d6af);}(_0x863a,0x107));var _0xa863=function(_0x1e6c88,_0x48e7ac){_0x1e6c88=_0x1e6c88-0x0;var _0x149c59=_0x863a[_0x1e6c88];return _0x149c59;};'use strict';var _=require('lodash');var util=require(_0xa863('0x0'));var logger=require(_0xa863('0x1'))('api');var moment=require(_0xa863('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa863('0x3'));var attributes=require(_0xa863('0x4'));var integrations=require(_0xa863('0x5'));module[_0xa863('0x6')]=function(_0x366868,_0x4ff995){return _0x366868['define'](_0xa863('0x7'),attributes,{'tableName':_0xa863('0x8'),'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 4845057..de1185e 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 _0x05e5=['stringify','ShowSalesforceAccount','SalesforceAccount','find','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetSalesforceAccount','findAll','options','attributes','limit','map','include','model'];(function(_0x2419f5,_0x409a26){var _0x464efb=function(_0x20c7aa){while(--_0x20c7aa){_0x2419f5['push'](_0x2419f5['shift']());}};_0x464efb(++_0x409a26);}(_0x05e5,0x17b));var _0x505e=function(_0x1e9c70,_0x368b6b){_0x1e9c70=_0x1e9c70-0x0;var _0x517ec3=_0x05e5[_0x1e9c70];return _0x517ec3;};'use strict';var _=require(_0x505e('0x0'));var util=require(_0x505e('0x1'));var moment=require('moment');var BPromise=require(_0x505e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x505e('0x3'));var db=require(_0x505e('0x4'))['db'];var utils=require(_0x505e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x505e('0x6'));var jayson=require(_0x505e('0x7'));var client=jayson[_0x505e('0x8')][_0x505e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3583ad,_0x1af01,_0x3b9b19){return new BPromise(function(_0x247c5f,_0x27b0e2){return client['request'](_0x3583ad,_0x3b9b19)[_0x505e('0xa')](function(_0x2f1865){logger[_0x505e('0xb')](_0x505e('0xc'),_0x1af01,_0x505e('0xd'));logger[_0x505e('0xe')](_0x505e('0xf'),_0x1af01,'request\x20sent',JSON['stringify'](_0x2f1865));if(_0x2f1865['error']){if(_0x2f1865['error'][_0x505e('0x10')]===0x1f4){logger['error'](_0x505e('0xc'),_0x1af01,_0x2f1865[_0x505e('0x11')]['message']);return _0x27b0e2(_0x2f1865[_0x505e('0x11')][_0x505e('0x12')]);}logger[_0x505e('0x11')](_0x505e('0xc'),_0x1af01,_0x2f1865[_0x505e('0x11')][_0x505e('0x12')]);return _0x247c5f(_0x2f1865['error'][_0x505e('0x12')]);}else{logger[_0x505e('0xb')](_0x505e('0xc'),_0x1af01,_0x505e('0xd'));_0x247c5f(_0x2f1865[_0x505e('0x13')][_0x505e('0x12')]);}})[_0x505e('0x14')](function(_0x2db0ae){logger['error'](_0x505e('0xc'),_0x1af01,_0x2db0ae);_0x27b0e2(_0x2db0ae);});});}exports[_0x505e('0x15')]=function(_0x40c958){var _0x4892f8=this;return new Promise(function(_0x8564d,_0x5c202d){return db['SalesforceAccount'][_0x505e('0x16')]({'raw':_0x40c958[_0x505e('0x17')]?_0x40c958[_0x505e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x40c958[_0x505e('0x17')]?_0x40c958[_0x505e('0x17')]['where']||null:null,'attributes':_0x40c958[_0x505e('0x17')]?_0x40c958[_0x505e('0x17')][_0x505e('0x18')]||null:null,'limit':_0x40c958[_0x505e('0x17')]?_0x40c958[_0x505e('0x17')][_0x505e('0x19')]||null:null,'include':_0x40c958[_0x505e('0x17')]?_0x40c958[_0x505e('0x17')]['include']?_[_0x505e('0x1a')](_0x40c958[_0x505e('0x17')]['include'],function(_0xccd660){return{'model':db[_0xccd660['model']],'as':_0xccd660['as'],'attributes':_0xccd660[_0x505e('0x18')],'include':_0xccd660['include']?_[_0x505e('0x1a')](_0xccd660[_0x505e('0x1b')],function(_0x2b1f83){return{'model':db[_0x2b1f83[_0x505e('0x1c')]],'as':_0x2b1f83['as'],'attributes':_0x2b1f83[_0x505e('0x18')],'include':_0x2b1f83['include']?_[_0x505e('0x1a')](_0x2b1f83['include'],function(_0xc9d21){return{'model':db[_0xc9d21[_0x505e('0x1c')]],'as':_0xc9d21['as'],'attributes':_0xc9d21[_0x505e('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1673a9){logger[_0x505e('0xb')](_0x505e('0x15'),_0x40c958);logger[_0x505e('0xe')](_0x505e('0x15'),_0x40c958,JSON[_0x505e('0x1d')](_0x1673a9));_0x8564d(_0x1673a9);})[_0x505e('0x14')](function(_0x580fe6){logger[_0x505e('0x11')](_0x505e('0x15'),_0x580fe6[_0x505e('0x12')],_0x40c958);_0x5c202d(_0x4892f8[_0x505e('0x11')](0x1f4,_0x580fe6[_0x505e('0x12')]));});});};exports[_0x505e('0x1e')]=function(_0xc6b6ea){var _0x176ac8=this;return new Promise(function(_0xb3d461,_0x887c28){return db[_0x505e('0x1f')][_0x505e('0x20')]({'raw':_0xc6b6ea[_0x505e('0x17')]?_0xc6b6ea[_0x505e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xc6b6ea[_0x505e('0x17')]?_0xc6b6ea['options'][_0x505e('0x21')]||null:null,'attributes':_0xc6b6ea[_0x505e('0x17')]?_0xc6b6ea[_0x505e('0x17')][_0x505e('0x18')]||null:null,'include':_0xc6b6ea[_0x505e('0x17')]?_0xc6b6ea[_0x505e('0x17')][_0x505e('0x1b')]?_[_0x505e('0x1a')](_0xc6b6ea[_0x505e('0x17')][_0x505e('0x1b')],function(_0x273f7e){return{'model':db[_0x273f7e['model']],'as':_0x273f7e['as'],'attributes':_0x273f7e[_0x505e('0x18')],'include':_0x273f7e[_0x505e('0x1b')]?_['map'](_0x273f7e[_0x505e('0x1b')],function(_0x5bbd61){return{'model':db[_0x5bbd61[_0x505e('0x1c')]],'as':_0x5bbd61['as'],'attributes':_0x5bbd61[_0x505e('0x18')],'include':_0x5bbd61[_0x505e('0x1b')]?_['map'](_0x5bbd61[_0x505e('0x1b')],function(_0x4a9e4f){return{'model':db[_0x4a9e4f[_0x505e('0x1c')]],'as':_0x4a9e4f['as'],'attributes':_0x4a9e4f[_0x505e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x505e('0xa')](function(_0x4553b5){logger[_0x505e('0xb')](_0x505e('0x1e'),_0xc6b6ea);logger[_0x505e('0xe')](_0x505e('0x1e'),_0xc6b6ea,JSON[_0x505e('0x1d')](_0x4553b5));_0xb3d461(_0x4553b5);})[_0x505e('0x14')](function(_0x1a34c5){logger['error'](_0x505e('0x1e'),_0x1a34c5[_0x505e('0x12')],_0xc6b6ea);_0x887c28(_0x176ac8['error'](0x1f4,_0x1a34c5[_0x505e('0x12')]));});});}; \ No newline at end of file +var _0xdaa1=['attributes','info','GetSalesforceAccount','stringify','ShowSalesforceAccount','where','then','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','SalesforceAccount,\x20%s,\x20%s','message','result','SalesforceAccount','options','raw','include','map','model'];(function(_0x22835e,_0x35c7b8){var _0x5dfd82=function(_0x5c16a8){while(--_0x5c16a8){_0x22835e['push'](_0x22835e['shift']());}};_0x5dfd82(++_0x35c7b8);}(_0xdaa1,0x1ba));var _0x1daa=function(_0x72848b,_0x5eeb09){_0x72848b=_0x72848b-0x0;var _0x3a3a27=_0xdaa1[_0x72848b];return _0x3a3a27;};'use strict';var _=require('lodash');var util=require(_0x1daa('0x0'));var moment=require('moment');var BPromise=require(_0x1daa('0x1'));var rs=require(_0x1daa('0x2'));var fs=require('fs');var Redis=require(_0x1daa('0x3'));var db=require(_0x1daa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1daa('0x5'));var config=require(_0x1daa('0x6'));var jayson=require(_0x1daa('0x7'));var client=jayson[_0x1daa('0x8')][_0x1daa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52650b,_0x1cdc99,_0x59055c){return new BPromise(function(_0x47ac90,_0x302d64){return client[_0x1daa('0xa')](_0x52650b,_0x59055c)['then'](function(_0x25c449){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x1cdc99,_0x1daa('0xb'));logger[_0x1daa('0xc')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1cdc99,_0x1daa('0xb'),JSON['stringify'](_0x25c449));if(_0x25c449['error']){if(_0x25c449[_0x1daa('0xd')]['code']===0x1f4){logger[_0x1daa('0xd')](_0x1daa('0xe'),_0x1cdc99,_0x25c449[_0x1daa('0xd')][_0x1daa('0xf')]);return _0x302d64(_0x25c449[_0x1daa('0xd')][_0x1daa('0xf')]);}logger[_0x1daa('0xd')](_0x1daa('0xe'),_0x1cdc99,_0x25c449[_0x1daa('0xd')][_0x1daa('0xf')]);return _0x47ac90(_0x25c449[_0x1daa('0xd')][_0x1daa('0xf')]);}else{logger['info'](_0x1daa('0xe'),_0x1cdc99,'request\x20sent');_0x47ac90(_0x25c449[_0x1daa('0x10')][_0x1daa('0xf')]);}})['catch'](function(_0x421d5b){logger[_0x1daa('0xd')](_0x1daa('0xe'),_0x1cdc99,_0x421d5b);_0x302d64(_0x421d5b);});});}exports['GetSalesforceAccount']=function(_0x8e086c){var _0x3a13cc=this;return new Promise(function(_0x1a7c42,_0x5b7381){return db[_0x1daa('0x11')]['findAll']({'raw':_0x8e086c[_0x1daa('0x12')]?_0x8e086c[_0x1daa('0x12')][_0x1daa('0x13')]===undefined?!![]:![]:!![],'where':_0x8e086c['options']?_0x8e086c[_0x1daa('0x12')]['where']||null:null,'attributes':_0x8e086c[_0x1daa('0x12')]?_0x8e086c[_0x1daa('0x12')]['attributes']||null:null,'limit':_0x8e086c[_0x1daa('0x12')]?_0x8e086c['options']['limit']||null:null,'include':_0x8e086c[_0x1daa('0x12')]?_0x8e086c[_0x1daa('0x12')][_0x1daa('0x14')]?_[_0x1daa('0x15')](_0x8e086c[_0x1daa('0x12')][_0x1daa('0x14')],function(_0x3c0117){return{'model':db[_0x3c0117[_0x1daa('0x16')]],'as':_0x3c0117['as'],'attributes':_0x3c0117['attributes'],'include':_0x3c0117[_0x1daa('0x14')]?_[_0x1daa('0x15')](_0x3c0117[_0x1daa('0x14')],function(_0xe8dcdd){return{'model':db[_0xe8dcdd[_0x1daa('0x16')]],'as':_0xe8dcdd['as'],'attributes':_0xe8dcdd[_0x1daa('0x17')],'include':_0xe8dcdd[_0x1daa('0x14')]?_[_0x1daa('0x15')](_0xe8dcdd[_0x1daa('0x14')],function(_0x2d40c3){return{'model':db[_0x2d40c3['model']],'as':_0x2d40c3['as'],'attributes':_0x2d40c3['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x138961){logger[_0x1daa('0x18')](_0x1daa('0x19'),_0x8e086c);logger['debug']('GetSalesforceAccount',_0x8e086c,JSON[_0x1daa('0x1a')](_0x138961));_0x1a7c42(_0x138961);})['catch'](function(_0x4313dd){logger['error'](_0x1daa('0x19'),_0x4313dd[_0x1daa('0xf')],_0x8e086c);_0x5b7381(_0x3a13cc[_0x1daa('0xd')](0x1f4,_0x4313dd[_0x1daa('0xf')]));});});};exports[_0x1daa('0x1b')]=function(_0x574722){var _0x25b2a9=this;return new Promise(function(_0x14bc6a,_0x497204){return db[_0x1daa('0x11')]['find']({'raw':_0x574722['options']?_0x574722[_0x1daa('0x12')][_0x1daa('0x13')]===undefined?!![]:![]:!![],'where':_0x574722[_0x1daa('0x12')]?_0x574722['options'][_0x1daa('0x1c')]||null:null,'attributes':_0x574722['options']?_0x574722[_0x1daa('0x12')][_0x1daa('0x17')]||null:null,'include':_0x574722[_0x1daa('0x12')]?_0x574722[_0x1daa('0x12')][_0x1daa('0x14')]?_[_0x1daa('0x15')](_0x574722[_0x1daa('0x12')]['include'],function(_0x2bf247){return{'model':db[_0x2bf247[_0x1daa('0x16')]],'as':_0x2bf247['as'],'attributes':_0x2bf247[_0x1daa('0x17')],'include':_0x2bf247[_0x1daa('0x14')]?_[_0x1daa('0x15')](_0x2bf247['include'],function(_0x11967d){return{'model':db[_0x11967d[_0x1daa('0x16')]],'as':_0x11967d['as'],'attributes':_0x11967d['attributes'],'include':_0x11967d[_0x1daa('0x14')]?_[_0x1daa('0x15')](_0x11967d['include'],function(_0x9ae2c2){return{'model':db[_0x9ae2c2[_0x1daa('0x16')]],'as':_0x9ae2c2['as'],'attributes':_0x9ae2c2[_0x1daa('0x17')]};}):[]};}):[]};}):[]:[]})[_0x1daa('0x1d')](function(_0x1ef981){logger['info'](_0x1daa('0x1b'),_0x574722);logger[_0x1daa('0xc')](_0x1daa('0x1b'),_0x574722,JSON['stringify'](_0x1ef981));_0x14bc6a(_0x1ef981);})[_0x1daa('0x1e')](function(_0x2fe17d){logger[_0x1daa('0xd')]('ShowSalesforceAccount',_0x2fe17d[_0x1daa('0xf')],_0x574722);_0x497204(_0x25b2a9['error'](0x1f4,_0x2fe17d['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 3af3086..4eadcd6 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x4bfdf0,_0x4dfc5b){var _0xe5f7a6=function(_0x13d91c){while(--_0x13d91c){_0x4bfdf0['push'](_0x4bfdf0['shift']());}};_0xe5f7a6(++_0x4dfc5b);}(_0xadb5,0xad));var _0x5adb=function(_0x5df6ae,_0x348af1){_0x5df6ae=_0x5df6ae-0x0;var _0x131655=_0xadb5[_0x5df6ae];return _0x131655;};'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('./intSalesforceConfiguration.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('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5d4906,_0x537ec){var _0x98fb41=function(_0x13fcc4){while(--_0x13fcc4){_0x5d4906['push'](_0x5d4906['shift']());}};_0x98fb41(++_0x537ec);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a142f,_0x49ca8c){_0x4a142f=_0x4a142f-0x0;var _0x3bbe7e=_0x5f2f[_0x4a142f];return _0x3bbe7e;};'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('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('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 f3c2e7a..7a5bcb4 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 _0x6c11=['contact','lead','account','sequelize','STRING','ENUM','Task','contact_lead'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6c11,0xe3));var _0x16c1=function(_0x32bf73,_0x724874){_0x32bf73=_0x32bf73-0x0;var _0x3325a1=_0x6c11[_0x32bf73];return _0x3325a1;};'use strict';var Sequelize=require(_0x16c1('0x0'));module['exports']={'name':{'type':Sequelize[_0x16c1('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x16c1('0x2')](_0x16c1('0x3'),'Case'),'defaultValue':_0x16c1('0x3')},'moduleSearch':{'type':Sequelize[_0x16c1('0x2')](_0x16c1('0x4'),_0x16c1('0x5'),_0x16c1('0x6'),'account_contact_lead',_0x16c1('0x7')),'defaultValue':_0x16c1('0x4')},'moduleCreate':{'type':Sequelize[_0x16c1('0x2')]('nothing',_0x16c1('0x5'),_0x16c1('0x6'),_0x16c1('0x7')),'defaultValue':_0x16c1('0x6')},'leadId':{'type':Sequelize[_0x16c1('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x16c1('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x16c1('0x1')]}}; \ No newline at end of file +var _0x28a3=['lead','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','account_contact_lead','account','nothing'];(function(_0x289280,_0x48c75b){var _0x18ae4f=function(_0x14ca20){while(--_0x14ca20){_0x289280['push'](_0x289280['shift']());}};_0x18ae4f(++_0x48c75b);}(_0x28a3,0x79));var _0x328a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x28a3[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x328a('0x0'));module[_0x328a('0x1')]={'name':{'type':Sequelize[_0x328a('0x2')]},'description':{'type':Sequelize[_0x328a('0x2')]},'ticketType':{'type':Sequelize[_0x328a('0x3')](_0x328a('0x4'),_0x328a('0x5')),'defaultValue':_0x328a('0x4')},'moduleSearch':{'type':Sequelize[_0x328a('0x3')](_0x328a('0x6'),_0x328a('0x7'),'lead',_0x328a('0x8'),_0x328a('0x9')),'defaultValue':_0x328a('0x6')},'moduleCreate':{'type':Sequelize[_0x328a('0x3')](_0x328a('0xa'),_0x328a('0x7'),'lead','account'),'defaultValue':_0x328a('0xb')},'leadId':{'type':Sequelize[_0x328a('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x328a('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x328a('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x328a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 7c3c92c..0102f59 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 _0xba64=['find','create','body','getFields','findOne','pick','getSubjects','SalesforceField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','end','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x1c11c0,_0x46ea36){var _0x169b05=function(_0x41a646){while(--_0x41a646){_0x1c11c0['push'](_0x1c11c0['shift']());}};_0x169b05(++_0x46ea36);}(_0xba64,0x1ef));var _0x4ba6=function(_0x593464,_0x342a27){_0x593464=_0x593464-0x0;var _0x3536b1=_0xba64[_0x593464];return _0x3536b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ba6('0x0'));var zipdir=require(_0x4ba6('0x1'));var jsonpatch=require(_0x4ba6('0x2'));var rp=require(_0x4ba6('0x3'));var moment=require('moment');var BPromise=require(_0x4ba6('0x4'));var Mustache=require(_0x4ba6('0x5'));var util=require('util');var path=require(_0x4ba6('0x6'));var sox=require(_0x4ba6('0x7'));var csv=require(_0x4ba6('0x8'));var ejs=require(_0x4ba6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4ba6('0xa'));var crypto=require(_0x4ba6('0xb'));var jsforce=require(_0x4ba6('0xc'));var deskjs=require(_0x4ba6('0xd'));var toCsv=require(_0x4ba6('0x8'));var querystring=require(_0x4ba6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4ba6('0xf'));var qs=require(_0x4ba6('0x10'));var as=require(_0x4ba6('0x11'));var hardwareService=require(_0x4ba6('0x12'));var logger=require(_0x4ba6('0x13'))(_0x4ba6('0x14'));var utils=require(_0x4ba6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba6('0x16'));var db=require(_0x4ba6('0x17'))['db'];function respondWithStatusCode(_0x303ff0,_0x1fc891){_0x1fc891=_0x1fc891||0xcc;return function(_0x2a2cf6){if(_0x2a2cf6){return _0x303ff0[_0x4ba6('0x18')](_0x1fc891);}return _0x303ff0[_0x4ba6('0x19')](_0x1fc891)['end']();};}function respondWithResult(_0xaa8888,_0x1d118d){_0x1d118d=_0x1d118d||0xc8;return function(_0x136027){if(_0x136027){return _0xaa8888[_0x4ba6('0x19')](_0x1d118d)['json'](_0x136027);}};}function respondWithFilteredResult(_0x26c50d,_0x3bbe47){return function(_0x546b91){if(_0x546b91){var _0x542571=typeof _0x3bbe47[_0x4ba6('0x1a')]===_0x4ba6('0x1b')&&typeof _0x3bbe47[_0x4ba6('0x1c')]===_0x4ba6('0x1b');var _0x446028=_0x546b91['count'];var _0xc16001=_0x542571?0x0:_0x3bbe47['offset'];var _0x1d64b3=_0x542571?_0x546b91[_0x4ba6('0x1d')]:_0x3bbe47[_0x4ba6('0x1a')]+_0x3bbe47[_0x4ba6('0x1c')];var _0x121a3e;if(_0x1d64b3>=_0x446028){_0x1d64b3=_0x446028;_0x121a3e=0xc8;}else{_0x121a3e=0xce;}_0x26c50d['status'](_0x121a3e);return _0x26c50d[_0x4ba6('0x1e')](_0x4ba6('0x1f'),_0xc16001+'-'+_0x1d64b3+'/'+_0x446028)[_0x4ba6('0x20')](_0x546b91);}return null;};}function patchUpdates(_0x35f1ab){return function(_0x2febf9){try{jsonpatch['apply'](_0x2febf9,_0x35f1ab,!![]);}catch(_0x1d716d){return BPromise[_0x4ba6('0x21')](_0x1d716d);}return _0x2febf9[_0x4ba6('0x22')]();};}function saveUpdates(_0x3cbbca,_0x2a3a8f){return function(_0x19da88){if(_0x19da88){return _0x19da88[_0x4ba6('0x23')](_0x3cbbca)['then'](function(_0x477a92){return _0x477a92;});}return null;};}function removeEntity(_0x2c26cf,_0xc32955){return function(_0x38c341){if(_0x38c341){return _0x38c341[_0x4ba6('0x24')]()[_0x4ba6('0x25')](function(){_0x2c26cf[_0x4ba6('0x19')](0xcc)[_0x4ba6('0x26')]();});}};}function handleEntityNotFound(_0x247e9d,_0x6b8d22){return function(_0x562eab){if(!_0x562eab){_0x247e9d[_0x4ba6('0x18')](0x194);}return _0x562eab;};}function handleError(_0xa20158,_0x596ae5){_0x596ae5=_0x596ae5||0x1f4;return function(_0x163439){logger['error'](_0x163439[_0x4ba6('0x27')]);if(_0x163439[_0x4ba6('0x28')]){delete _0x163439[_0x4ba6('0x28')];}_0xa20158['status'](_0x596ae5)[_0x4ba6('0x29')](_0x163439);};}exports['index']=function(_0x502021,_0x2a295b){var _0x471217={},_0x57a26e={},_0x4b1f67={'count':0x0,'rows':[]};var _0x4e195b=_[_0x4ba6('0x2a')](db[_0x4ba6('0x2b')][_0x4ba6('0x2c')],function(_0xd9ce6e){return{'name':_0xd9ce6e[_0x4ba6('0x2d')],'type':_0xd9ce6e[_0x4ba6('0x2e')][_0x4ba6('0x2f')]};});_0x57a26e[_0x4ba6('0x30')]=_[_0x4ba6('0x2a')](_0x4e195b,_0x4ba6('0x28'));_0x57a26e[_0x4ba6('0x31')]=_[_0x4ba6('0x32')](_0x502021[_0x4ba6('0x31')]);_0x57a26e['filters']=_[_0x4ba6('0x33')](_0x57a26e['model'],_0x57a26e[_0x4ba6('0x31')]);_0x471217[_0x4ba6('0x34')]=_['intersection'](_0x57a26e[_0x4ba6('0x30')],qs['fields'](_0x502021[_0x4ba6('0x31')][_0x4ba6('0x35')]));_0x471217[_0x4ba6('0x34')]=_0x471217[_0x4ba6('0x34')][_0x4ba6('0x36')]?_0x471217['attributes']:_0x57a26e[_0x4ba6('0x30')];if(!_0x502021[_0x4ba6('0x31')][_0x4ba6('0x37')](_0x4ba6('0x38'))){_0x471217[_0x4ba6('0x1c')]=qs[_0x4ba6('0x1c')](_0x502021[_0x4ba6('0x31')][_0x4ba6('0x1c')]);_0x471217[_0x4ba6('0x1a')]=qs['offset'](_0x502021[_0x4ba6('0x31')][_0x4ba6('0x1a')]);}_0x471217[_0x4ba6('0x39')]=qs[_0x4ba6('0x3a')](_0x502021['query']['sort']);_0x471217[_0x4ba6('0x3b')]=qs[_0x4ba6('0x3c')](_['pick'](_0x502021['query'],_0x57a26e['filters']),_0x4e195b);if(_0x502021[_0x4ba6('0x31')][_0x4ba6('0x3d')]){_0x471217['where']=_['merge'](_0x471217[_0x4ba6('0x3b')],{'$or':_[_0x4ba6('0x2a')](_0x4e195b,function(_0x1b6a2c){if(_0x1b6a2c[_0x4ba6('0x2e')]!==_0x4ba6('0x3e')){var _0x4a2b45={};_0x4a2b45[_0x1b6a2c[_0x4ba6('0x28')]]={'$like':'%'+_0x502021[_0x4ba6('0x31')][_0x4ba6('0x3d')]+'%'};return _0x4a2b45;}})});}_0x471217=_[_0x4ba6('0x3f')]({},_0x471217,_0x502021[_0x4ba6('0x40')]);var _0x143ba3={'where':_0x471217['where']};return db[_0x4ba6('0x2b')]['count'](_0x143ba3)[_0x4ba6('0x25')](function(_0xd7eeb6){_0x4b1f67[_0x4ba6('0x1d')]=_0xd7eeb6;if(_0x502021[_0x4ba6('0x31')][_0x4ba6('0x41')]){_0x471217[_0x4ba6('0x42')]=[{'all':!![]}];}return db[_0x4ba6('0x2b')][_0x4ba6('0x43')](_0x471217);})[_0x4ba6('0x25')](function(_0x1d76d2){_0x4b1f67[_0x4ba6('0x44')]=_0x1d76d2;return _0x4b1f67;})[_0x4ba6('0x25')](respondWithFilteredResult(_0x2a295b,_0x471217))[_0x4ba6('0x45')](handleError(_0x2a295b,null));};exports[_0x4ba6('0x46')]=function(_0x32e903,_0x5c7aba){var _0x2b02ec={'raw':![],'where':{'id':_0x32e903[_0x4ba6('0x47')]['id']}},_0x4e6bcf={};_0x4e6bcf['model']=_[_0x4ba6('0x32')](db[_0x4ba6('0x2b')]['rawAttributes']);_0x4e6bcf[_0x4ba6('0x31')]=_[_0x4ba6('0x32')](_0x32e903[_0x4ba6('0x31')]);_0x4e6bcf[_0x4ba6('0x3c')]=_[_0x4ba6('0x33')](_0x4e6bcf[_0x4ba6('0x30')],_0x4e6bcf['query']);_0x2b02ec[_0x4ba6('0x34')]=_[_0x4ba6('0x33')](_0x4e6bcf[_0x4ba6('0x30')],qs[_0x4ba6('0x35')](_0x32e903[_0x4ba6('0x31')][_0x4ba6('0x35')]));_0x2b02ec['attributes']=_0x2b02ec[_0x4ba6('0x34')][_0x4ba6('0x36')]?_0x2b02ec[_0x4ba6('0x34')]:_0x4e6bcf['model'];if(_0x32e903[_0x4ba6('0x31')][_0x4ba6('0x41')]){_0x2b02ec[_0x4ba6('0x42')]=[{'all':!![]}];}_0x2b02ec=_[_0x4ba6('0x3f')]({},_0x2b02ec,_0x32e903[_0x4ba6('0x40')]);return db[_0x4ba6('0x2b')][_0x4ba6('0x48')](_0x2b02ec)['then'](handleEntityNotFound(_0x5c7aba,null))['then'](respondWithResult(_0x5c7aba,null))[_0x4ba6('0x45')](handleError(_0x5c7aba,null));};exports[_0x4ba6('0x49')]=function(_0x1cff0a,_0x519fae){return db[_0x4ba6('0x2b')][_0x4ba6('0x49')](_0x1cff0a[_0x4ba6('0x4a')],{})['then'](respondWithResult(_0x519fae,0xc9))['catch'](handleError(_0x519fae,null));};exports['update']=function(_0x2e9390,_0x2eec3a){if(_0x2e9390['body']['id']){delete _0x2e9390[_0x4ba6('0x4a')]['id'];}return db['SalesforceConfiguration'][_0x4ba6('0x48')]({'where':{'id':_0x2e9390[_0x4ba6('0x47')]['id']}})[_0x4ba6('0x25')](handleEntityNotFound(_0x2eec3a,null))[_0x4ba6('0x25')](saveUpdates(_0x2e9390[_0x4ba6('0x4a')],null))[_0x4ba6('0x25')](respondWithResult(_0x2eec3a,null))[_0x4ba6('0x45')](handleError(_0x2eec3a,null));};exports[_0x4ba6('0x24')]=function(_0x53c608,_0x5559e5){return db['SalesforceConfiguration'][_0x4ba6('0x48')]({'where':{'id':_0x53c608[_0x4ba6('0x47')]['id']}})[_0x4ba6('0x25')](handleEntityNotFound(_0x5559e5,null))['then'](removeEntity(_0x5559e5,null))[_0x4ba6('0x45')](handleError(_0x5559e5,null));};exports[_0x4ba6('0x4b')]=function(_0x1de430,_0x3d3d2d,_0xbd35bf){var _0xa41a08={};var _0xb76e22={};var _0x5a9524;var _0x58c2b2;return db['SalesforceConfiguration'][_0x4ba6('0x4c')]({'where':{'id':_0x1de430['params']['id']}})[_0x4ba6('0x25')](handleEntityNotFound(_0x3d3d2d,null))[_0x4ba6('0x25')](function(_0x27c6db){if(_0x27c6db){_0x5a9524=_0x27c6db;_0xb76e22['model']=_[_0x4ba6('0x32')](db['SalesforceField'][_0x4ba6('0x2c')]);_0xb76e22[_0x4ba6('0x31')]=_[_0x4ba6('0x32')](_0x1de430[_0x4ba6('0x31')]);_0xb76e22[_0x4ba6('0x3c')]=_['intersection'](_0xb76e22[_0x4ba6('0x30')],_0xb76e22[_0x4ba6('0x31')]);_0xa41a08[_0x4ba6('0x34')]=_[_0x4ba6('0x33')](_0xb76e22[_0x4ba6('0x30')],qs[_0x4ba6('0x35')](_0x1de430[_0x4ba6('0x31')]['fields']));_0xa41a08[_0x4ba6('0x34')]=_0xa41a08['attributes'][_0x4ba6('0x36')]?_0xa41a08['attributes']:_0xb76e22['model'];_0xa41a08[_0x4ba6('0x39')]=qs['sort'](_0x1de430[_0x4ba6('0x31')][_0x4ba6('0x3a')]);_0xa41a08[_0x4ba6('0x3b')]=qs[_0x4ba6('0x3c')](_[_0x4ba6('0x4d')](_0x1de430['query'],_0xb76e22[_0x4ba6('0x3c')]));if(_0x1de430[_0x4ba6('0x31')][_0x4ba6('0x3d')]){_0xa41a08[_0x4ba6('0x3b')]=_[_0x4ba6('0x3f')](_0xa41a08[_0x4ba6('0x3b')],{'$or':_[_0x4ba6('0x2a')](_0xa41a08[_0x4ba6('0x34')],function(_0x110b47){var _0x2d9045={};_0x2d9045[_0x110b47]={'$like':'%'+_0x1de430['query'][_0x4ba6('0x3d')]+'%'};return _0x2d9045;})});}_0xa41a08=_['merge']({},_0xa41a08,_0x1de430[_0x4ba6('0x40')]);return _0x5a9524[_0x4ba6('0x4b')](_0xa41a08);}})[_0x4ba6('0x25')](function(_0x1f00c9){if(_0x1f00c9){_0x58c2b2=_0x1f00c9[_0x4ba6('0x36')];if(!_0x1de430[_0x4ba6('0x31')][_0x4ba6('0x37')]('nolimit')){_0xa41a08[_0x4ba6('0x1c')]=qs['limit'](_0x1de430[_0x4ba6('0x31')]['limit']);_0xa41a08[_0x4ba6('0x1a')]=qs[_0x4ba6('0x1a')](_0x1de430[_0x4ba6('0x31')]['offset']);}return _0x5a9524[_0x4ba6('0x4b')](_0xa41a08);}})[_0x4ba6('0x25')](function(_0x44355d){if(_0x44355d){return _0x44355d?{'count':_0x58c2b2,'rows':_0x44355d}:null;}})['then'](respondWithResult(_0x3d3d2d,null))[_0x4ba6('0x45')](handleError(_0x3d3d2d,null));};exports[_0x4ba6('0x4e')]=function(_0x2bd9e1,_0x217e0b,_0x256154){var _0x278dd5={};var _0xe77243={};var _0x5e98b5;var _0x78587e;return db[_0x4ba6('0x2b')][_0x4ba6('0x4c')]({'where':{'id':_0x2bd9e1['params']['id']}})['then'](handleEntityNotFound(_0x217e0b,null))[_0x4ba6('0x25')](function(_0x2b4e74){if(_0x2b4e74){_0x5e98b5=_0x2b4e74;_0xe77243[_0x4ba6('0x30')]=_[_0x4ba6('0x32')](db[_0x4ba6('0x4f')][_0x4ba6('0x2c')]);_0xe77243[_0x4ba6('0x31')]=_[_0x4ba6('0x32')](_0x2bd9e1[_0x4ba6('0x31')]);_0xe77243[_0x4ba6('0x3c')]=_[_0x4ba6('0x33')](_0xe77243[_0x4ba6('0x30')],_0xe77243[_0x4ba6('0x31')]);_0x278dd5[_0x4ba6('0x34')]=_[_0x4ba6('0x33')](_0xe77243[_0x4ba6('0x30')],qs[_0x4ba6('0x35')](_0x2bd9e1['query'][_0x4ba6('0x35')]));_0x278dd5[_0x4ba6('0x34')]=_0x278dd5[_0x4ba6('0x34')][_0x4ba6('0x36')]?_0x278dd5['attributes']:_0xe77243[_0x4ba6('0x30')];_0x278dd5[_0x4ba6('0x39')]=qs['sort'](_0x2bd9e1[_0x4ba6('0x31')][_0x4ba6('0x3a')]);_0x278dd5['where']=qs[_0x4ba6('0x3c')](_['pick'](_0x2bd9e1['query'],_0xe77243['filters']));if(_0x2bd9e1['query'][_0x4ba6('0x3d')]){_0x278dd5[_0x4ba6('0x3b')]=_[_0x4ba6('0x3f')](_0x278dd5['where'],{'$or':_[_0x4ba6('0x2a')](_0x278dd5['attributes'],function(_0x44e5d5){var _0x161149={};_0x161149[_0x44e5d5]={'$like':'%'+_0x2bd9e1['query']['filter']+'%'};return _0x161149;})});}_0x278dd5=_[_0x4ba6('0x3f')]({},_0x278dd5,_0x2bd9e1[_0x4ba6('0x40')]);return _0x5e98b5[_0x4ba6('0x4e')](_0x278dd5);}})['then'](function(_0x546116){if(_0x546116){_0x78587e=_0x546116['length'];if(!_0x2bd9e1['query'][_0x4ba6('0x37')](_0x4ba6('0x38'))){_0x278dd5['limit']=qs['limit'](_0x2bd9e1[_0x4ba6('0x31')][_0x4ba6('0x1c')]);_0x278dd5[_0x4ba6('0x1a')]=qs[_0x4ba6('0x1a')](_0x2bd9e1['query'][_0x4ba6('0x1a')]);}return _0x5e98b5[_0x4ba6('0x4e')](_0x278dd5);}})['then'](function(_0x4f85bf){if(_0x4f85bf){return _0x4f85bf?{'count':_0x78587e,'rows':_0x4f85bf}:null;}})['then'](respondWithResult(_0x217e0b,null))[_0x4ba6('0x45')](handleError(_0x217e0b,null));};exports[_0x4ba6('0x50')]=function(_0x1d9e80,_0x2c6aad,_0x133bc5){var _0x14b291={};var _0xd8d7ec={};var _0x297724;var _0x37a6c4;return db[_0x4ba6('0x2b')][_0x4ba6('0x4c')]({'where':{'id':_0x1d9e80[_0x4ba6('0x47')]['id']}})[_0x4ba6('0x25')](handleEntityNotFound(_0x2c6aad,null))[_0x4ba6('0x25')](function(_0x4bac16){if(_0x4bac16){_0x297724=_0x4bac16;_0xd8d7ec['model']=_[_0x4ba6('0x32')](db[_0x4ba6('0x4f')][_0x4ba6('0x2c')]);_0xd8d7ec[_0x4ba6('0x31')]=_[_0x4ba6('0x32')](_0x1d9e80[_0x4ba6('0x31')]);_0xd8d7ec[_0x4ba6('0x3c')]=_['intersection'](_0xd8d7ec[_0x4ba6('0x30')],_0xd8d7ec['query']);_0x14b291[_0x4ba6('0x34')]=_[_0x4ba6('0x33')](_0xd8d7ec[_0x4ba6('0x30')],qs[_0x4ba6('0x35')](_0x1d9e80[_0x4ba6('0x31')][_0x4ba6('0x35')]));_0x14b291[_0x4ba6('0x34')]=_0x14b291[_0x4ba6('0x34')][_0x4ba6('0x36')]?_0x14b291[_0x4ba6('0x34')]:_0xd8d7ec[_0x4ba6('0x30')];_0x14b291[_0x4ba6('0x39')]=qs[_0x4ba6('0x3a')](_0x1d9e80[_0x4ba6('0x31')]['sort']);_0x14b291['where']=qs[_0x4ba6('0x3c')](_[_0x4ba6('0x4d')](_0x1d9e80['query'],_0xd8d7ec['filters']));if(_0x1d9e80[_0x4ba6('0x31')][_0x4ba6('0x3d')]){_0x14b291[_0x4ba6('0x3b')]=_['merge'](_0x14b291[_0x4ba6('0x3b')],{'$or':_[_0x4ba6('0x2a')](_0x14b291[_0x4ba6('0x34')],function(_0x1d30e7){var _0x124c71={};_0x124c71[_0x1d30e7]={'$like':'%'+_0x1d9e80[_0x4ba6('0x31')]['filter']+'%'};return _0x124c71;})});}_0x14b291=_[_0x4ba6('0x3f')]({},_0x14b291,_0x1d9e80[_0x4ba6('0x40')]);return _0x297724[_0x4ba6('0x50')](_0x14b291);}})[_0x4ba6('0x25')](function(_0x1cab07){if(_0x1cab07){_0x37a6c4=_0x1cab07[_0x4ba6('0x36')];if(!_0x1d9e80[_0x4ba6('0x31')]['hasOwnProperty']('nolimit')){_0x14b291[_0x4ba6('0x1c')]=qs[_0x4ba6('0x1c')](_0x1d9e80[_0x4ba6('0x31')][_0x4ba6('0x1c')]);_0x14b291[_0x4ba6('0x1a')]=qs[_0x4ba6('0x1a')](_0x1d9e80['query'][_0x4ba6('0x1a')]);}return _0x297724[_0x4ba6('0x50')](_0x14b291);}})[_0x4ba6('0x25')](function(_0x9fbae5){if(_0x9fbae5){return _0x9fbae5?{'count':_0x37a6c4,'rows':_0x9fbae5}:null;}})[_0x4ba6('0x25')](respondWithResult(_0x2c6aad,null))[_0x4ba6('0x45')](handleError(_0x2c6aad,null));}; \ No newline at end of file +var _0xe20e=['sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','create','body','catch','find','params','getFields','SalesforceField','pick','getSubjects','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','reject','save','update','destroy','then','error','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x48bceb,_0x3658d8){var _0x274484=function(_0x37b589){while(--_0x37b589){_0x48bceb['push'](_0x48bceb['shift']());}};_0x274484(++_0x3658d8);}(_0xe20e,0x195));var _0xee20=function(_0x2eb47c,_0x43bdf3){_0x2eb47c=_0x2eb47c-0x0;var _0x13097b=_0xe20e[_0x2eb47c];return _0x13097b;};'use strict';var emlformat=require(_0xee20('0x0'));var rimraf=require(_0xee20('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xee20('0x2'));var rp=require(_0xee20('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xee20('0x4'));var util=require('util');var path=require(_0xee20('0x5'));var sox=require(_0xee20('0x6'));var csv=require(_0xee20('0x7'));var ejs=require(_0xee20('0x8'));var fs=require('fs');var fs_extra=require(_0xee20('0x9'));var _=require(_0xee20('0xa'));var squel=require(_0xee20('0xb'));var crypto=require(_0xee20('0xc'));var jsforce=require(_0xee20('0xd'));var deskjs=require(_0xee20('0xe'));var toCsv=require(_0xee20('0x7'));var querystring=require(_0xee20('0xf'));var Papa=require('papaparse');var Redis=require(_0xee20('0x10'));var authService=require(_0xee20('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee20('0x12'));var logger=require(_0xee20('0x13'))(_0xee20('0x14'));var utils=require(_0xee20('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xee20('0x16'));var db=require(_0xee20('0x17'))['db'];function respondWithStatusCode(_0x440b89,_0x195d17){_0x195d17=_0x195d17||0xcc;return function(_0x303dc6){if(_0x303dc6){return _0x440b89[_0xee20('0x18')](_0x195d17);}return _0x440b89[_0xee20('0x19')](_0x195d17)['end']();};}function respondWithResult(_0x3da816,_0x4e1e75){_0x4e1e75=_0x4e1e75||0xc8;return function(_0x3f6df3){if(_0x3f6df3){return _0x3da816[_0xee20('0x19')](_0x4e1e75)[_0xee20('0x1a')](_0x3f6df3);}};}function respondWithFilteredResult(_0x5d0563,_0x6a910e){return function(_0x413905){if(_0x413905){var _0xa0873e=typeof _0x6a910e[_0xee20('0x1b')]===_0xee20('0x1c')&&typeof _0x6a910e['limit']===_0xee20('0x1c');var _0x271413=_0x413905['count'];var _0x4ad007=_0xa0873e?0x0:_0x6a910e[_0xee20('0x1b')];var _0x4ea5fa=_0xa0873e?_0x413905[_0xee20('0x1d')]:_0x6a910e[_0xee20('0x1b')]+_0x6a910e[_0xee20('0x1e')];var _0x46c22e;if(_0x4ea5fa>=_0x271413){_0x4ea5fa=_0x271413;_0x46c22e=0xc8;}else{_0x46c22e=0xce;}_0x5d0563[_0xee20('0x19')](_0x46c22e);return _0x5d0563['set']('Content-Range',_0x4ad007+'-'+_0x4ea5fa+'/'+_0x271413)[_0xee20('0x1a')](_0x413905);}return null;};}function patchUpdates(_0x9ec152){return function(_0x2cf160){try{jsonpatch['apply'](_0x2cf160,_0x9ec152,!![]);}catch(_0x16941b){return BPromise[_0xee20('0x1f')](_0x16941b);}return _0x2cf160[_0xee20('0x20')]();};}function saveUpdates(_0x3f959b,_0x407215){return function(_0x534c6e){if(_0x534c6e){return _0x534c6e[_0xee20('0x21')](_0x3f959b)['then'](function(_0x181f25){return _0x181f25;});}return null;};}function removeEntity(_0x4b4134,_0x53a158){return function(_0xc9af6c){if(_0xc9af6c){return _0xc9af6c[_0xee20('0x22')]()[_0xee20('0x23')](function(){_0x4b4134['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d0db3,_0x1030de){return function(_0x96d369){if(!_0x96d369){_0x5d0db3['sendStatus'](0x194);}return _0x96d369;};}function handleError(_0x989704,_0x256250){_0x256250=_0x256250||0x1f4;return function(_0xc0e06b){logger[_0xee20('0x24')](_0xc0e06b['stack']);if(_0xc0e06b['name']){delete _0xc0e06b[_0xee20('0x25')];}_0x989704[_0xee20('0x19')](_0x256250)[_0xee20('0x26')](_0xc0e06b);};}exports[_0xee20('0x27')]=function(_0x1c3ccf,_0xc1462){var _0x5c2079={},_0x2e4090={},_0x32590b={'count':0x0,'rows':[]};var _0x148219=_['map'](db[_0xee20('0x28')][_0xee20('0x29')],function(_0x207b4c){return{'name':_0x207b4c[_0xee20('0x2a')],'type':_0x207b4c[_0xee20('0x2b')][_0xee20('0x2c')]};});_0x2e4090[_0xee20('0x2d')]=_[_0xee20('0x2e')](_0x148219,'name');_0x2e4090[_0xee20('0x2f')]=_[_0xee20('0x30')](_0x1c3ccf['query']);_0x2e4090[_0xee20('0x31')]=_[_0xee20('0x32')](_0x2e4090[_0xee20('0x2d')],_0x2e4090[_0xee20('0x2f')]);_0x5c2079[_0xee20('0x33')]=_['intersection'](_0x2e4090['model'],qs[_0xee20('0x34')](_0x1c3ccf['query'][_0xee20('0x34')]));_0x5c2079[_0xee20('0x33')]=_0x5c2079[_0xee20('0x33')][_0xee20('0x35')]?_0x5c2079[_0xee20('0x33')]:_0x2e4090[_0xee20('0x2d')];if(!_0x1c3ccf[_0xee20('0x2f')][_0xee20('0x36')](_0xee20('0x37'))){_0x5c2079['limit']=qs[_0xee20('0x1e')](_0x1c3ccf[_0xee20('0x2f')][_0xee20('0x1e')]);_0x5c2079[_0xee20('0x1b')]=qs['offset'](_0x1c3ccf[_0xee20('0x2f')][_0xee20('0x1b')]);}_0x5c2079[_0xee20('0x38')]=qs['sort'](_0x1c3ccf[_0xee20('0x2f')][_0xee20('0x39')]);_0x5c2079[_0xee20('0x3a')]=qs[_0xee20('0x31')](_['pick'](_0x1c3ccf['query'],_0x2e4090[_0xee20('0x31')]),_0x148219);if(_0x1c3ccf['query'][_0xee20('0x3b')]){_0x5c2079[_0xee20('0x3a')]=_[_0xee20('0x3c')](_0x5c2079[_0xee20('0x3a')],{'$or':_[_0xee20('0x2e')](_0x148219,function(_0xa9d42e){if(_0xa9d42e['type']!==_0xee20('0x3d')){var _0x647d7a={};_0x647d7a[_0xa9d42e['name']]={'$like':'%'+_0x1c3ccf[_0xee20('0x2f')][_0xee20('0x3b')]+'%'};return _0x647d7a;}})});}_0x5c2079=_['merge']({},_0x5c2079,_0x1c3ccf[_0xee20('0x3e')]);var _0x372560={'where':_0x5c2079[_0xee20('0x3a')]};return db['SalesforceConfiguration']['count'](_0x372560)['then'](function(_0x241283){_0x32590b['count']=_0x241283;if(_0x1c3ccf[_0xee20('0x2f')][_0xee20('0x3f')]){_0x5c2079[_0xee20('0x40')]=[{'all':!![]}];}return db[_0xee20('0x28')][_0xee20('0x41')](_0x5c2079);})[_0xee20('0x23')](function(_0x99fb51){_0x32590b[_0xee20('0x42')]=_0x99fb51;return _0x32590b;})['then'](respondWithFilteredResult(_0xc1462,_0x5c2079))['catch'](handleError(_0xc1462,null));};exports[_0xee20('0x43')]=function(_0x2e9152,_0x197a2c){var _0x8d8094={'raw':![],'where':{'id':_0x2e9152['params']['id']}},_0xa543f0={};_0xa543f0[_0xee20('0x2d')]=_[_0xee20('0x30')](db['SalesforceConfiguration'][_0xee20('0x29')]);_0xa543f0[_0xee20('0x2f')]=_[_0xee20('0x30')](_0x2e9152[_0xee20('0x2f')]);_0xa543f0[_0xee20('0x31')]=_[_0xee20('0x32')](_0xa543f0[_0xee20('0x2d')],_0xa543f0[_0xee20('0x2f')]);_0x8d8094[_0xee20('0x33')]=_['intersection'](_0xa543f0[_0xee20('0x2d')],qs[_0xee20('0x34')](_0x2e9152[_0xee20('0x2f')]['fields']));_0x8d8094[_0xee20('0x33')]=_0x8d8094[_0xee20('0x33')][_0xee20('0x35')]?_0x8d8094[_0xee20('0x33')]:_0xa543f0['model'];if(_0x2e9152['query'][_0xee20('0x3f')]){_0x8d8094[_0xee20('0x40')]=[{'all':!![]}];}_0x8d8094=_['merge']({},_0x8d8094,_0x2e9152[_0xee20('0x3e')]);return db[_0xee20('0x28')]['find'](_0x8d8094)[_0xee20('0x23')](handleEntityNotFound(_0x197a2c,null))['then'](respondWithResult(_0x197a2c,null))['catch'](handleError(_0x197a2c,null));};exports[_0xee20('0x44')]=function(_0xed0968,_0x597d10){return db[_0xee20('0x28')][_0xee20('0x44')](_0xed0968[_0xee20('0x45')],{})[_0xee20('0x23')](respondWithResult(_0x597d10,0xc9))[_0xee20('0x46')](handleError(_0x597d10,null));};exports[_0xee20('0x21')]=function(_0x4842aa,_0x177240){if(_0x4842aa[_0xee20('0x45')]['id']){delete _0x4842aa['body']['id'];}return db[_0xee20('0x28')][_0xee20('0x47')]({'where':{'id':_0x4842aa[_0xee20('0x48')]['id']}})[_0xee20('0x23')](handleEntityNotFound(_0x177240,null))['then'](saveUpdates(_0x4842aa['body'],null))[_0xee20('0x23')](respondWithResult(_0x177240,null))[_0xee20('0x46')](handleError(_0x177240,null));};exports[_0xee20('0x22')]=function(_0x2185cd,_0x14608b){return db[_0xee20('0x28')][_0xee20('0x47')]({'where':{'id':_0x2185cd[_0xee20('0x48')]['id']}})[_0xee20('0x23')](handleEntityNotFound(_0x14608b,null))[_0xee20('0x23')](removeEntity(_0x14608b,null))[_0xee20('0x46')](handleError(_0x14608b,null));};exports[_0xee20('0x49')]=function(_0x461ad4,_0x38581c,_0x51ff87){var _0x13e488={};var _0x3931d6={};var _0x31e22b;var _0xda40e0;return db[_0xee20('0x28')]['findOne']({'where':{'id':_0x461ad4[_0xee20('0x48')]['id']}})[_0xee20('0x23')](handleEntityNotFound(_0x38581c,null))[_0xee20('0x23')](function(_0x1c6adc){if(_0x1c6adc){_0x31e22b=_0x1c6adc;_0x3931d6[_0xee20('0x2d')]=_[_0xee20('0x30')](db[_0xee20('0x4a')][_0xee20('0x29')]);_0x3931d6['query']=_[_0xee20('0x30')](_0x461ad4[_0xee20('0x2f')]);_0x3931d6[_0xee20('0x31')]=_[_0xee20('0x32')](_0x3931d6[_0xee20('0x2d')],_0x3931d6[_0xee20('0x2f')]);_0x13e488['attributes']=_['intersection'](_0x3931d6[_0xee20('0x2d')],qs[_0xee20('0x34')](_0x461ad4['query']['fields']));_0x13e488[_0xee20('0x33')]=_0x13e488['attributes'][_0xee20('0x35')]?_0x13e488['attributes']:_0x3931d6['model'];_0x13e488[_0xee20('0x38')]=qs[_0xee20('0x39')](_0x461ad4[_0xee20('0x2f')]['sort']);_0x13e488[_0xee20('0x3a')]=qs[_0xee20('0x31')](_['pick'](_0x461ad4[_0xee20('0x2f')],_0x3931d6[_0xee20('0x31')]));if(_0x461ad4['query'][_0xee20('0x3b')]){_0x13e488[_0xee20('0x3a')]=_[_0xee20('0x3c')](_0x13e488[_0xee20('0x3a')],{'$or':_['map'](_0x13e488[_0xee20('0x33')],function(_0xf58381){var _0x3cea17={};_0x3cea17[_0xf58381]={'$like':'%'+_0x461ad4['query'][_0xee20('0x3b')]+'%'};return _0x3cea17;})});}_0x13e488=_[_0xee20('0x3c')]({},_0x13e488,_0x461ad4[_0xee20('0x3e')]);return _0x31e22b['getFields'](_0x13e488);}})[_0xee20('0x23')](function(_0x4153b6){if(_0x4153b6){_0xda40e0=_0x4153b6[_0xee20('0x35')];if(!_0x461ad4['query'][_0xee20('0x36')]('nolimit')){_0x13e488[_0xee20('0x1e')]=qs[_0xee20('0x1e')](_0x461ad4['query'][_0xee20('0x1e')]);_0x13e488[_0xee20('0x1b')]=qs[_0xee20('0x1b')](_0x461ad4['query']['offset']);}return _0x31e22b[_0xee20('0x49')](_0x13e488);}})[_0xee20('0x23')](function(_0x42e8f5){if(_0x42e8f5){return _0x42e8f5?{'count':_0xda40e0,'rows':_0x42e8f5}:null;}})[_0xee20('0x23')](respondWithResult(_0x38581c,null))[_0xee20('0x46')](handleError(_0x38581c,null));};exports['getSubjects']=function(_0x9e5798,_0x441129,_0x30dd4f){var _0x1b2786={};var _0x32b33f={};var _0x2489e0;var _0x262905;return db[_0xee20('0x28')]['findOne']({'where':{'id':_0x9e5798[_0xee20('0x48')]['id']}})[_0xee20('0x23')](handleEntityNotFound(_0x441129,null))[_0xee20('0x23')](function(_0x5b69ff){if(_0x5b69ff){_0x2489e0=_0x5b69ff;_0x32b33f[_0xee20('0x2d')]=_[_0xee20('0x30')](db['SalesforceField'][_0xee20('0x29')]);_0x32b33f[_0xee20('0x2f')]=_[_0xee20('0x30')](_0x9e5798[_0xee20('0x2f')]);_0x32b33f[_0xee20('0x31')]=_[_0xee20('0x32')](_0x32b33f[_0xee20('0x2d')],_0x32b33f['query']);_0x1b2786[_0xee20('0x33')]=_['intersection'](_0x32b33f['model'],qs['fields'](_0x9e5798['query'][_0xee20('0x34')]));_0x1b2786['attributes']=_0x1b2786[_0xee20('0x33')][_0xee20('0x35')]?_0x1b2786[_0xee20('0x33')]:_0x32b33f[_0xee20('0x2d')];_0x1b2786['order']=qs[_0xee20('0x39')](_0x9e5798[_0xee20('0x2f')][_0xee20('0x39')]);_0x1b2786[_0xee20('0x3a')]=qs[_0xee20('0x31')](_[_0xee20('0x4b')](_0x9e5798[_0xee20('0x2f')],_0x32b33f[_0xee20('0x31')]));if(_0x9e5798[_0xee20('0x2f')][_0xee20('0x3b')]){_0x1b2786[_0xee20('0x3a')]=_[_0xee20('0x3c')](_0x1b2786[_0xee20('0x3a')],{'$or':_[_0xee20('0x2e')](_0x1b2786[_0xee20('0x33')],function(_0x359a40){var _0xa72d01={};_0xa72d01[_0x359a40]={'$like':'%'+_0x9e5798[_0xee20('0x2f')][_0xee20('0x3b')]+'%'};return _0xa72d01;})});}_0x1b2786=_[_0xee20('0x3c')]({},_0x1b2786,_0x9e5798[_0xee20('0x3e')]);return _0x2489e0[_0xee20('0x4c')](_0x1b2786);}})['then'](function(_0x55238e){if(_0x55238e){_0x262905=_0x55238e['length'];if(!_0x9e5798[_0xee20('0x2f')][_0xee20('0x36')](_0xee20('0x37'))){_0x1b2786[_0xee20('0x1e')]=qs[_0xee20('0x1e')](_0x9e5798[_0xee20('0x2f')][_0xee20('0x1e')]);_0x1b2786['offset']=qs[_0xee20('0x1b')](_0x9e5798[_0xee20('0x2f')]['offset']);}return _0x2489e0['getSubjects'](_0x1b2786);}})['then'](function(_0x2129c0){if(_0x2129c0){return _0x2129c0?{'count':_0x262905,'rows':_0x2129c0}:null;}})[_0xee20('0x23')](respondWithResult(_0x441129,null))[_0xee20('0x46')](handleError(_0x441129,null));};exports['getDescriptions']=function(_0x5e602d,_0x546d1e,_0x163826){var _0x3b8150={};var _0xc0ed4c={};var _0x5b67db;var _0x5cdf49;return db[_0xee20('0x28')]['findOne']({'where':{'id':_0x5e602d[_0xee20('0x48')]['id']}})['then'](handleEntityNotFound(_0x546d1e,null))[_0xee20('0x23')](function(_0x2f016c){if(_0x2f016c){_0x5b67db=_0x2f016c;_0xc0ed4c[_0xee20('0x2d')]=_['keys'](db[_0xee20('0x4a')][_0xee20('0x29')]);_0xc0ed4c[_0xee20('0x2f')]=_[_0xee20('0x30')](_0x5e602d['query']);_0xc0ed4c[_0xee20('0x31')]=_[_0xee20('0x32')](_0xc0ed4c['model'],_0xc0ed4c['query']);_0x3b8150[_0xee20('0x33')]=_[_0xee20('0x32')](_0xc0ed4c['model'],qs['fields'](_0x5e602d[_0xee20('0x2f')][_0xee20('0x34')]));_0x3b8150[_0xee20('0x33')]=_0x3b8150[_0xee20('0x33')][_0xee20('0x35')]?_0x3b8150[_0xee20('0x33')]:_0xc0ed4c['model'];_0x3b8150[_0xee20('0x38')]=qs[_0xee20('0x39')](_0x5e602d['query'][_0xee20('0x39')]);_0x3b8150[_0xee20('0x3a')]=qs[_0xee20('0x31')](_[_0xee20('0x4b')](_0x5e602d[_0xee20('0x2f')],_0xc0ed4c[_0xee20('0x31')]));if(_0x5e602d[_0xee20('0x2f')][_0xee20('0x3b')]){_0x3b8150[_0xee20('0x3a')]=_['merge'](_0x3b8150[_0xee20('0x3a')],{'$or':_[_0xee20('0x2e')](_0x3b8150[_0xee20('0x33')],function(_0x55ae10){var _0x2d8866={};_0x2d8866[_0x55ae10]={'$like':'%'+_0x5e602d[_0xee20('0x2f')][_0xee20('0x3b')]+'%'};return _0x2d8866;})});}_0x3b8150=_[_0xee20('0x3c')]({},_0x3b8150,_0x5e602d[_0xee20('0x3e')]);return _0x5b67db['getDescriptions'](_0x3b8150);}})[_0xee20('0x23')](function(_0x5dba11){if(_0x5dba11){_0x5cdf49=_0x5dba11['length'];if(!_0x5e602d[_0xee20('0x2f')][_0xee20('0x36')](_0xee20('0x37'))){_0x3b8150[_0xee20('0x1e')]=qs[_0xee20('0x1e')](_0x5e602d[_0xee20('0x2f')][_0xee20('0x1e')]);_0x3b8150[_0xee20('0x1b')]=qs[_0xee20('0x1b')](_0x5e602d['query']['offset']);}return _0x5b67db['getDescriptions'](_0x3b8150);}})[_0xee20('0x23')](function(_0x235edd){if(_0x235edd){return _0x235edd?{'count':_0x5cdf49,'rows':_0x235edd}:null;}})['then'](respondWithResult(_0x546d1e,null))[_0xee20('0x46')](handleError(_0x546d1e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index fa01f99..e726f01 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 _0x5ad0=['exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x5ad0,0x12f));var _0x05ad=function(_0x4eb59e,_0x4746d9){_0x4eb59e=_0x4eb59e-0x0;var _0x473892=_0x5ad0[_0x4eb59e];return _0x473892;};'use strict';var _=require(_0x05ad('0x0'));var util=require(_0x05ad('0x1'));var logger=require(_0x05ad('0x2'))('api');var moment=require(_0x05ad('0x3'));var BPromise=require(_0x05ad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x05ad('0x5'));var rimraf=require(_0x05ad('0x6'));var config=require(_0x05ad('0x7'));var attributes=require(_0x05ad('0x8'));module[_0x05ad('0x9')]=function(_0x311324,_0x3b1824){return _0x311324['define'](_0x05ad('0xa'),attributes,{'tableName':_0x05ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8691=['request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xf1efaa,_0x3c1c70){var _0x246d15=function(_0x496bfb){while(--_0x496bfb){_0xf1efaa['push'](_0xf1efaa['shift']());}};_0x246d15(++_0x3c1c70);}(_0x8691,0xbd));var _0x1869=function(_0x243dc1,_0x5ba49e){_0x243dc1=_0x243dc1-0x0;var _0x177462=_0x8691[_0x243dc1];return _0x177462;};'use strict';var _=require(_0x1869('0x0'));var util=require(_0x1869('0x1'));var logger=require(_0x1869('0x2'))(_0x1869('0x3'));var moment=require(_0x1869('0x4'));var BPromise=require(_0x1869('0x5'));var rp=require(_0x1869('0x6'));var fs=require('fs');var path=require(_0x1869('0x7'));var rimraf=require(_0x1869('0x8'));var config=require(_0x1869('0x9'));var attributes=require(_0x1869('0xa'));module[_0x1869('0xb')]=function(_0x273599,_0x8770d0){return _0x273599[_0x1869('0xc')](_0x1869('0xd'),attributes,{'tableName':_0x1869('0xe'),'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 31485e0..9704c5c 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 _0xdc7f=['rpc','../../config/environment','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0xdc7f,0x19c));var _0xfdc7=function(_0x25a19a,_0x536079){_0x25a19a=_0x25a19a-0x0;var _0x9d8a38=_0xdc7f[_0x25a19a];return _0x9d8a38;};'use strict';var _=require('lodash');var util=require(_0xfdc7('0x0'));var moment=require(_0xfdc7('0x1'));var BPromise=require(_0xfdc7('0x2'));var rs=require(_0xfdc7('0x3'));var fs=require('fs');var Redis=require(_0xfdc7('0x4'));var db=require(_0xfdc7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfdc7('0x6'));var config=require(_0xfdc7('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x586618,_0x213ea0,_0x259f5b){return new BPromise(function(_0x55b2d9,_0x244434){return client[_0xfdc7('0x8')](_0x586618,_0x259f5b)[_0xfdc7('0x9')](function(_0x55790e){logger[_0xfdc7('0xa')](_0xfdc7('0xb'),_0x213ea0,_0xfdc7('0xc'));logger['debug'](_0xfdc7('0xd'),_0x213ea0,_0xfdc7('0xc'),JSON[_0xfdc7('0xe')](_0x55790e));if(_0x55790e[_0xfdc7('0xf')]){if(_0x55790e['error'][_0xfdc7('0x10')]===0x1f4){logger['error'](_0xfdc7('0xb'),_0x213ea0,_0x55790e[_0xfdc7('0xf')][_0xfdc7('0x11')]);return _0x244434(_0x55790e[_0xfdc7('0xf')][_0xfdc7('0x11')]);}logger[_0xfdc7('0xf')](_0xfdc7('0xb'),_0x213ea0,_0x55790e['error']['message']);return _0x55b2d9(_0x55790e[_0xfdc7('0xf')][_0xfdc7('0x11')]);}else{logger[_0xfdc7('0xa')](_0xfdc7('0xb'),_0x213ea0,_0xfdc7('0xc'));_0x55b2d9(_0x55790e[_0xfdc7('0x12')][_0xfdc7('0x11')]);}})['catch'](function(_0x22ac9f){logger[_0xfdc7('0xf')](_0xfdc7('0xb'),_0x213ea0,_0x22ac9f);_0x244434(_0x22ac9f);});});} \ No newline at end of file +var _0x50d4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x5c22fc,_0x4f68e5){var _0xe8c418=function(_0x17c712){while(--_0x17c712){_0x5c22fc['push'](_0x5c22fc['shift']());}};_0xe8c418(++_0x4f68e5);}(_0x50d4,0x1c6));var _0x450d=function(_0x23ee7a,_0x34ee45){_0x23ee7a=_0x23ee7a-0x0;var _0x44eefa=_0x50d4[_0x23ee7a];return _0x44eefa;};'use strict';var _=require('lodash');var util=require(_0x450d('0x0'));var moment=require(_0x450d('0x1'));var BPromise=require(_0x450d('0x2'));var rs=require(_0x450d('0x3'));var fs=require('fs');var Redis=require(_0x450d('0x4'));var db=require(_0x450d('0x5'))['db'];var utils=require(_0x450d('0x6'));var logger=require(_0x450d('0x7'))(_0x450d('0x8'));var config=require('../../config/environment');var jayson=require(_0x450d('0x9'));var client=jayson[_0x450d('0xa')][_0x450d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x206ba4,_0x57653b,_0x58850c){return new BPromise(function(_0x2b2e1b,_0x43a240){return client[_0x450d('0xc')](_0x206ba4,_0x58850c)['then'](function(_0x5e5d1d){logger[_0x450d('0xd')](_0x450d('0xe'),_0x57653b,_0x450d('0xf'));logger[_0x450d('0x10')](_0x450d('0x11'),_0x57653b,_0x450d('0xf'),JSON[_0x450d('0x12')](_0x5e5d1d));if(_0x5e5d1d['error']){if(_0x5e5d1d[_0x450d('0x13')][_0x450d('0x14')]===0x1f4){logger[_0x450d('0x13')](_0x450d('0xe'),_0x57653b,_0x5e5d1d[_0x450d('0x13')][_0x450d('0x15')]);return _0x43a240(_0x5e5d1d['error']['message']);}logger[_0x450d('0x13')](_0x450d('0xe'),_0x57653b,_0x5e5d1d[_0x450d('0x13')][_0x450d('0x15')]);return _0x2b2e1b(_0x5e5d1d[_0x450d('0x13')][_0x450d('0x15')]);}else{logger[_0x450d('0xd')](_0x450d('0xe'),_0x57653b,'request\x20sent');_0x2b2e1b(_0x5e5d1d[_0x450d('0x16')][_0x450d('0x15')]);}})[_0x450d('0x17')](function(_0x3a44c5){logger[_0x450d('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x57653b,_0x3a44c5);_0x43a240(_0x3a44c5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 148587f..f57e36a 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 _0xf5e9=['destroy','multer','path','express','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','show','post','isAuthenticated','create','put','update'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0xf5e9,0xc1));var _0x9f5e=function(_0x45b190,_0x6297da){_0x45b190=_0x45b190-0x0;var _0x46234d=_0xf5e9[_0x45b190];return _0x46234d;};'use strict';var multer=require(_0x9f5e('0x0'));var util=require('util');var path=require(_0x9f5e('0x1'));var timeout=require('connect-timeout');var express=require(_0x9f5e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9f5e('0x3'));var config=require(_0x9f5e('0x4'));var controller=require(_0x9f5e('0x5'));router[_0x9f5e('0x6')]('/',auth['isAuthenticated'](),controller[_0x9f5e('0x7')]);router[_0x9f5e('0x6')](_0x9f5e('0x8'),auth['isAuthenticated'](),controller[_0x9f5e('0x9')]);router[_0x9f5e('0xa')]('/',auth[_0x9f5e('0xb')](),controller[_0x9f5e('0xc')]);router[_0x9f5e('0xd')](_0x9f5e('0x8'),auth[_0x9f5e('0xb')](),controller[_0x9f5e('0xe')]);router['delete'](_0x9f5e('0x8'),auth['isAuthenticated'](),controller[_0x9f5e('0xf')]);module['exports']=router; \ No newline at end of file +var _0x68c5=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','show','create','put','/:id','delete','destroy','exports','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68c5,0xb1));var _0x568c=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x68c5[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x568c('0x0'));var util=require(_0x568c('0x1'));var path=require(_0x568c('0x2'));var timeout=require(_0x568c('0x3'));var express=require('express');var router=express[_0x568c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x568c('0x5'));var interaction=require(_0x568c('0x6'));var config=require('../../config/environment');var controller=require(_0x568c('0x7'));router[_0x568c('0x8')]('/',auth[_0x568c('0x9')](),controller[_0x568c('0xa')]);router[_0x568c('0x8')]('/:id',auth[_0x568c('0x9')](),controller[_0x568c('0xb')]);router['post']('/',auth[_0x568c('0x9')](),controller[_0x568c('0xc')]);router[_0x568c('0xd')](_0x568c('0xe'),auth[_0x568c('0x9')](),controller['update']);router[_0x568c('0xf')](_0x568c('0xe'),auth[_0x568c('0x9')](),controller[_0x568c('0x10')]);module[_0x568c('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 1fa542a..ebd8c22 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 _0xa62b=['keyValue','picklist','string','STRING','customVariable','sequelize','ENUM','variable'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xa62b,0xd5));var _0xba62=function(_0x28054d,_0x4ab7b0){_0x28054d=_0x28054d-0x0;var _0x57482f=_0xa62b[_0x28054d];return _0x57482f;};'use strict';var Sequelize=require(_0xba62('0x0'));module['exports']={'type':{'type':Sequelize[_0xba62('0x1')]('string',_0xba62('0x2'),'customVariable',_0xba62('0x3'),_0xba62('0x4')),'defaultValue':_0xba62('0x5')},'content':{'type':Sequelize[_0xba62('0x6')]},'key':{'type':Sequelize[_0xba62('0x6')]},'keyType':{'type':Sequelize[_0xba62('0x1')](_0xba62('0x5'),_0xba62('0x2'),_0xba62('0x7'))},'keyContent':{'type':Sequelize[_0xba62('0x6')]},'idField':{'type':Sequelize[_0xba62('0x6')]},'variableName':{'type':Sequelize[_0xba62('0x6')]}}; \ No newline at end of file +var _0x2a0c=['customVariable','keyValue','picklist','STRING','sequelize','string','variable'];(function(_0x39acab,_0x277d7e){var _0x1e3a13=function(_0x1a3130){while(--_0x1a3130){_0x39acab['push'](_0x39acab['shift']());}};_0x1e3a13(++_0x277d7e);}(_0x2a0c,0x123));var _0xc2a0=function(_0x78be65,_0x268a0d){_0x78be65=_0x78be65-0x0;var _0x4c8553=_0x2a0c[_0x78be65];return _0x4c8553;};'use strict';var Sequelize=require(_0xc2a0('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xc2a0('0x1'),_0xc2a0('0x2'),_0xc2a0('0x3'),_0xc2a0('0x4'),_0xc2a0('0x5')),'defaultValue':_0xc2a0('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc2a0('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xc2a0('0x1'),'variable',_0xc2a0('0x3'))},'keyContent':{'type':Sequelize[_0xc2a0('0x6')]},'idField':{'type':Sequelize[_0xc2a0('0x6')]},'variableName':{'type':Sequelize[_0xc2a0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 6210230..a50313d 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 _0xd61c=['model','keys','filters','intersection','attributes','query','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','map','SalesforceField','rawAttributes','key'];(function(_0x2fcf7f,_0x13024f){var _0x2678eb=function(_0x48fa2f){while(--_0x48fa2f){_0x2fcf7f['push'](_0x2fcf7f['shift']());}};_0x2678eb(++_0x13024f);}(_0xd61c,0xb1));var _0xcd61=function(_0x5b3361,_0x369662){_0x5b3361=_0x5b3361-0x0;var _0x22a2b3=_0xd61c[_0x5b3361];return _0x22a2b3;};'use strict';var emlformat=require(_0xcd61('0x0'));var rimraf=require(_0xcd61('0x1'));var zipdir=require(_0xcd61('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd61('0x3'));var moment=require('moment');var BPromise=require(_0xcd61('0x4'));var Mustache=require(_0xcd61('0x5'));var util=require(_0xcd61('0x6'));var path=require(_0xcd61('0x7'));var sox=require(_0xcd61('0x8'));var csv=require(_0xcd61('0x9'));var ejs=require(_0xcd61('0xa'));var fs=require('fs');var fs_extra=require(_0xcd61('0xb'));var _=require(_0xcd61('0xc'));var squel=require(_0xcd61('0xd'));var crypto=require('crypto');var jsforce=require(_0xcd61('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcd61('0x9'));var querystring=require(_0xcd61('0xf'));var Papa=require(_0xcd61('0x10'));var Redis=require('ioredis');var authService=require(_0xcd61('0x11'));var qs=require(_0xcd61('0x12'));var as=require(_0xcd61('0x13'));var hardwareService=require(_0xcd61('0x14'));var logger=require(_0xcd61('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xcd61('0x16'));var licenseUtil=require(_0xcd61('0x17'));var db=require(_0xcd61('0x18'))['db'];function respondWithStatusCode(_0x4c1f7f,_0xb6d8d9){_0xb6d8d9=_0xb6d8d9||0xcc;return function(_0x48ba0c){if(_0x48ba0c){return _0x4c1f7f['sendStatus'](_0xb6d8d9);}return _0x4c1f7f['status'](_0xb6d8d9)[_0xcd61('0x19')]();};}function respondWithResult(_0x36aa69,_0x14674c){_0x14674c=_0x14674c||0xc8;return function(_0x2d438d){if(_0x2d438d){return _0x36aa69[_0xcd61('0x1a')](_0x14674c)[_0xcd61('0x1b')](_0x2d438d);}};}function respondWithFilteredResult(_0xa30220,_0x11d8ed){return function(_0x3c2f0c){if(_0x3c2f0c){var _0x45933e=typeof _0x11d8ed[_0xcd61('0x1c')]===_0xcd61('0x1d')&&typeof _0x11d8ed[_0xcd61('0x1e')]===_0xcd61('0x1d');var _0x589c8b=_0x3c2f0c[_0xcd61('0x1f')];var _0x23d042=_0x45933e?0x0:_0x11d8ed[_0xcd61('0x1c')];var _0x3ee36b=_0x45933e?_0x3c2f0c[_0xcd61('0x1f')]:_0x11d8ed['offset']+_0x11d8ed[_0xcd61('0x1e')];var _0x4ebfd6;if(_0x3ee36b>=_0x589c8b){_0x3ee36b=_0x589c8b;_0x4ebfd6=0xc8;}else{_0x4ebfd6=0xce;}_0xa30220[_0xcd61('0x1a')](_0x4ebfd6);return _0xa30220[_0xcd61('0x20')](_0xcd61('0x21'),_0x23d042+'-'+_0x3ee36b+'/'+_0x589c8b)['json'](_0x3c2f0c);}return null;};}function patchUpdates(_0x312c03){return function(_0x585fd3){try{jsonpatch[_0xcd61('0x22')](_0x585fd3,_0x312c03,!![]);}catch(_0x4b8914){return BPromise[_0xcd61('0x23')](_0x4b8914);}return _0x585fd3[_0xcd61('0x24')]();};}function saveUpdates(_0xe330d8,_0x13b86e){return function(_0x4f2409){if(_0x4f2409){return _0x4f2409['update'](_0xe330d8)[_0xcd61('0x25')](function(_0x5c52c5){return _0x5c52c5;});}return null;};}function removeEntity(_0x5b9cac,_0x2c9774){return function(_0x30b37d){if(_0x30b37d){return _0x30b37d[_0xcd61('0x26')]()[_0xcd61('0x25')](function(){_0x5b9cac[_0xcd61('0x1a')](0xcc)[_0xcd61('0x19')]();});}};}function handleEntityNotFound(_0x2ed1d3,_0x363689){return function(_0x426f5c){if(!_0x426f5c){_0x2ed1d3[_0xcd61('0x27')](0x194);}return _0x426f5c;};}function handleError(_0x3b4073,_0x2d81b6){_0x2d81b6=_0x2d81b6||0x1f4;return function(_0x1a0d82){logger[_0xcd61('0x28')](_0x1a0d82[_0xcd61('0x29')]);if(_0x1a0d82[_0xcd61('0x2a')]){delete _0x1a0d82[_0xcd61('0x2a')];}_0x3b4073[_0xcd61('0x1a')](_0x2d81b6)['send'](_0x1a0d82);};}exports[_0xcd61('0x2b')]=function(_0x418ece,_0x2e525b){var _0x504206={},_0x5a849b={},_0x96d4ff={'count':0x0,'rows':[]};var _0x4363a7=_[_0xcd61('0x2c')](db[_0xcd61('0x2d')][_0xcd61('0x2e')],function(_0x547e59){return{'name':_0x547e59['fieldName'],'type':_0x547e59['type'][_0xcd61('0x2f')]};});_0x5a849b[_0xcd61('0x30')]=_[_0xcd61('0x2c')](_0x4363a7,_0xcd61('0x2a'));_0x5a849b['query']=_[_0xcd61('0x31')](_0x418ece['query']);_0x5a849b[_0xcd61('0x32')]=_[_0xcd61('0x33')](_0x5a849b[_0xcd61('0x30')],_0x5a849b['query']);_0x504206[_0xcd61('0x34')]=_[_0xcd61('0x33')](_0x5a849b[_0xcd61('0x30')],qs['fields'](_0x418ece[_0xcd61('0x35')][_0xcd61('0x36')]));_0x504206[_0xcd61('0x34')]=_0x504206[_0xcd61('0x34')][_0xcd61('0x37')]?_0x504206['attributes']:_0x5a849b['model'];if(!_0x418ece['query']['hasOwnProperty'](_0xcd61('0x38'))){_0x504206[_0xcd61('0x1e')]=qs[_0xcd61('0x1e')](_0x418ece['query'][_0xcd61('0x1e')]);_0x504206['offset']=qs['offset'](_0x418ece['query']['offset']);}_0x504206[_0xcd61('0x39')]=qs[_0xcd61('0x3a')](_0x418ece['query'][_0xcd61('0x3a')]);_0x504206[_0xcd61('0x3b')]=qs[_0xcd61('0x32')](_['pick'](_0x418ece['query'],_0x5a849b[_0xcd61('0x32')]),_0x4363a7);if(_0x418ece[_0xcd61('0x35')][_0xcd61('0x3c')]){_0x504206[_0xcd61('0x3b')]=_[_0xcd61('0x3d')](_0x504206[_0xcd61('0x3b')],{'$or':_[_0xcd61('0x2c')](_0x4363a7,function(_0x474095){if(_0x474095[_0xcd61('0x3e')]!==_0xcd61('0x3f')){var _0x5b663f={};_0x5b663f[_0x474095[_0xcd61('0x2a')]]={'$like':'%'+_0x418ece[_0xcd61('0x35')][_0xcd61('0x3c')]+'%'};return _0x5b663f;}})});}_0x504206=_[_0xcd61('0x3d')]({},_0x504206,_0x418ece[_0xcd61('0x40')]);var _0x2beb26={'where':_0x504206[_0xcd61('0x3b')]};return db[_0xcd61('0x2d')]['count'](_0x2beb26)[_0xcd61('0x25')](function(_0x48f2a4){_0x96d4ff[_0xcd61('0x1f')]=_0x48f2a4;if(_0x418ece[_0xcd61('0x35')][_0xcd61('0x41')]){_0x504206[_0xcd61('0x42')]=[{'all':!![]}];}return db[_0xcd61('0x2d')]['findAll'](_0x504206);})['then'](function(_0x436ece){_0x96d4ff[_0xcd61('0x43')]=_0x436ece;return _0x96d4ff;})[_0xcd61('0x25')](respondWithFilteredResult(_0x2e525b,_0x504206))[_0xcd61('0x44')](handleError(_0x2e525b,null));};exports[_0xcd61('0x45')]=function(_0x41287c,_0x144b56){var _0x5af86c={'raw':!![],'where':{'id':_0x41287c[_0xcd61('0x46')]['id']}},_0x39e1ef={};_0x39e1ef[_0xcd61('0x30')]=_[_0xcd61('0x31')](db['SalesforceField'][_0xcd61('0x2e')]);_0x39e1ef['query']=_[_0xcd61('0x31')](_0x41287c['query']);_0x39e1ef[_0xcd61('0x32')]=_[_0xcd61('0x33')](_0x39e1ef['model'],_0x39e1ef[_0xcd61('0x35')]);_0x5af86c[_0xcd61('0x34')]=_[_0xcd61('0x33')](_0x39e1ef[_0xcd61('0x30')],qs[_0xcd61('0x36')](_0x41287c[_0xcd61('0x35')][_0xcd61('0x36')]));_0x5af86c[_0xcd61('0x34')]=_0x5af86c[_0xcd61('0x34')][_0xcd61('0x37')]?_0x5af86c[_0xcd61('0x34')]:_0x39e1ef[_0xcd61('0x30')];if(_0x41287c[_0xcd61('0x35')][_0xcd61('0x41')]){_0x5af86c[_0xcd61('0x42')]=[{'all':!![]}];}_0x5af86c=_[_0xcd61('0x3d')]({},_0x5af86c,_0x41287c[_0xcd61('0x40')]);return db['SalesforceField'][_0xcd61('0x47')](_0x5af86c)['then'](handleEntityNotFound(_0x144b56,null))[_0xcd61('0x25')](respondWithResult(_0x144b56,null))[_0xcd61('0x44')](handleError(_0x144b56,null));};exports[_0xcd61('0x48')]=function(_0x15936e,_0xa710e0){return db[_0xcd61('0x2d')][_0xcd61('0x48')](_0x15936e[_0xcd61('0x49')],{})[_0xcd61('0x25')](respondWithResult(_0xa710e0,0xc9))[_0xcd61('0x44')](handleError(_0xa710e0,null));};exports[_0xcd61('0x4a')]=function(_0x446a1e,_0x2d1b25){if(_0x446a1e[_0xcd61('0x49')]['id']){delete _0x446a1e[_0xcd61('0x49')]['id'];}return db[_0xcd61('0x2d')][_0xcd61('0x47')]({'where':{'id':_0x446a1e[_0xcd61('0x46')]['id']}})[_0xcd61('0x25')](handleEntityNotFound(_0x2d1b25,null))['then'](saveUpdates(_0x446a1e[_0xcd61('0x49')],null))[_0xcd61('0x25')](respondWithResult(_0x2d1b25,null))[_0xcd61('0x44')](handleError(_0x2d1b25,null));};exports[_0xcd61('0x26')]=function(_0x346723,_0x1805f4){return db[_0xcd61('0x2d')][_0xcd61('0x47')]({'where':{'id':_0x346723['params']['id']}})[_0xcd61('0x25')](handleEntityNotFound(_0x1805f4,null))[_0xcd61('0x25')](removeEntity(_0x1805f4,null))[_0xcd61('0x44')](handleError(_0x1805f4,null));}; \ No newline at end of file +var _0x9724=['Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','SalesforceField','include','findAll','catch','show','includeAll','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','count','offset','set'];(function(_0x573939,_0x25a8b7){var _0x53645c=function(_0x4b6ef4){while(--_0x4b6ef4){_0x573939['push'](_0x573939['shift']());}};_0x53645c(++_0x25a8b7);}(_0x9724,0x77));var _0x4972=function(_0x4c3cd7,_0x305c64){_0x4c3cd7=_0x4c3cd7-0x0;var _0xdd20de=_0x9724[_0x4c3cd7];return _0xdd20de;};'use strict';var emlformat=require(_0x4972('0x0'));var rimraf=require(_0x4972('0x1'));var zipdir=require(_0x4972('0x2'));var jsonpatch=require(_0x4972('0x3'));var rp=require('request-promise');var moment=require(_0x4972('0x4'));var BPromise=require(_0x4972('0x5'));var Mustache=require(_0x4972('0x6'));var util=require(_0x4972('0x7'));var path=require(_0x4972('0x8'));var sox=require(_0x4972('0x9'));var csv=require(_0x4972('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4972('0xb'));var squel=require(_0x4972('0xc'));var crypto=require('crypto');var jsforce=require(_0x4972('0xd'));var deskjs=require(_0x4972('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4972('0xf'));var Papa=require(_0x4972('0x10'));var Redis=require(_0x4972('0x11'));var authService=require(_0x4972('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4972('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4972('0x14'))(_0x4972('0x15'));var utils=require(_0x4972('0x16'));var config=require(_0x4972('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ffba4,_0x4d1a4f){_0x4d1a4f=_0x4d1a4f||0xcc;return function(_0x3f8c07){if(_0x3f8c07){return _0x2ffba4[_0x4972('0x18')](_0x4d1a4f);}return _0x2ffba4[_0x4972('0x19')](_0x4d1a4f)['end']();};}function respondWithResult(_0x382437,_0x1d31c2){_0x1d31c2=_0x1d31c2||0xc8;return function(_0x5a00bf){if(_0x5a00bf){return _0x382437[_0x4972('0x19')](_0x1d31c2)[_0x4972('0x1a')](_0x5a00bf);}};}function respondWithFilteredResult(_0x4e8ee9,_0x56135e){return function(_0x4a6c3a){if(_0x4a6c3a){var _0x158ed1=typeof _0x56135e['offset']===_0x4972('0x1b')&&typeof _0x56135e['limit']==='undefined';var _0xdc7f9f=_0x4a6c3a[_0x4972('0x1c')];var _0x45c979=_0x158ed1?0x0:_0x56135e[_0x4972('0x1d')];var _0xbbbddf=_0x158ed1?_0x4a6c3a[_0x4972('0x1c')]:_0x56135e[_0x4972('0x1d')]+_0x56135e['limit'];var _0x43539b;if(_0xbbbddf>=_0xdc7f9f){_0xbbbddf=_0xdc7f9f;_0x43539b=0xc8;}else{_0x43539b=0xce;}_0x4e8ee9[_0x4972('0x19')](_0x43539b);return _0x4e8ee9[_0x4972('0x1e')](_0x4972('0x1f'),_0x45c979+'-'+_0xbbbddf+'/'+_0xdc7f9f)['json'](_0x4a6c3a);}return null;};}function patchUpdates(_0xc88251){return function(_0x147e9){try{jsonpatch[_0x4972('0x20')](_0x147e9,_0xc88251,!![]);}catch(_0x34adbe){return BPromise[_0x4972('0x21')](_0x34adbe);}return _0x147e9[_0x4972('0x22')]();};}function saveUpdates(_0x4c25d2,_0x5257a8){return function(_0x594d1e){if(_0x594d1e){return _0x594d1e[_0x4972('0x23')](_0x4c25d2)[_0x4972('0x24')](function(_0x3f24fb){return _0x3f24fb;});}return null;};}function removeEntity(_0x55b4c7,_0x403f9e){return function(_0x273491){if(_0x273491){return _0x273491[_0x4972('0x25')]()['then'](function(){_0x55b4c7[_0x4972('0x19')](0xcc)[_0x4972('0x26')]();});}};}function handleEntityNotFound(_0x16347a,_0xaf83aa){return function(_0x36661a){if(!_0x36661a){_0x16347a[_0x4972('0x18')](0x194);}return _0x36661a;};}function handleError(_0x498b36,_0x362c0e){_0x362c0e=_0x362c0e||0x1f4;return function(_0x5a2124){logger[_0x4972('0x27')](_0x5a2124[_0x4972('0x28')]);if(_0x5a2124[_0x4972('0x29')]){delete _0x5a2124[_0x4972('0x29')];}_0x498b36[_0x4972('0x19')](_0x362c0e)[_0x4972('0x2a')](_0x5a2124);};}exports[_0x4972('0x2b')]=function(_0x53a27b,_0x5f0675){var _0x19a397={},_0x4d85c1={},_0x5ab4da={'count':0x0,'rows':[]};var _0x502e65=_['map'](db['SalesforceField'][_0x4972('0x2c')],function(_0x37db79){return{'name':_0x37db79[_0x4972('0x2d')],'type':_0x37db79[_0x4972('0x2e')]['key']};});_0x4d85c1[_0x4972('0x2f')]=_[_0x4972('0x30')](_0x502e65,_0x4972('0x29'));_0x4d85c1[_0x4972('0x31')]=_[_0x4972('0x32')](_0x53a27b[_0x4972('0x31')]);_0x4d85c1['filters']=_[_0x4972('0x33')](_0x4d85c1[_0x4972('0x2f')],_0x4d85c1[_0x4972('0x31')]);_0x19a397[_0x4972('0x34')]=_[_0x4972('0x33')](_0x4d85c1[_0x4972('0x2f')],qs[_0x4972('0x35')](_0x53a27b['query'][_0x4972('0x35')]));_0x19a397[_0x4972('0x34')]=_0x19a397[_0x4972('0x34')]['length']?_0x19a397['attributes']:_0x4d85c1[_0x4972('0x2f')];if(!_0x53a27b['query'][_0x4972('0x36')](_0x4972('0x37'))){_0x19a397[_0x4972('0x38')]=qs[_0x4972('0x38')](_0x53a27b[_0x4972('0x31')]['limit']);_0x19a397[_0x4972('0x1d')]=qs[_0x4972('0x1d')](_0x53a27b[_0x4972('0x31')][_0x4972('0x1d')]);}_0x19a397[_0x4972('0x39')]=qs[_0x4972('0x3a')](_0x53a27b['query'][_0x4972('0x3a')]);_0x19a397['where']=qs[_0x4972('0x3b')](_[_0x4972('0x3c')](_0x53a27b['query'],_0x4d85c1[_0x4972('0x3b')]),_0x502e65);if(_0x53a27b[_0x4972('0x31')][_0x4972('0x3d')]){_0x19a397[_0x4972('0x3e')]=_[_0x4972('0x3f')](_0x19a397[_0x4972('0x3e')],{'$or':_[_0x4972('0x30')](_0x502e65,function(_0x39d930){if(_0x39d930[_0x4972('0x2e')]!=='VIRTUAL'){var _0x1e99b5={};_0x1e99b5[_0x39d930[_0x4972('0x29')]]={'$like':'%'+_0x53a27b[_0x4972('0x31')]['filter']+'%'};return _0x1e99b5;}})});}_0x19a397=_[_0x4972('0x3f')]({},_0x19a397,_0x53a27b['options']);var _0x4eab46={'where':_0x19a397[_0x4972('0x3e')]};return db[_0x4972('0x40')][_0x4972('0x1c')](_0x4eab46)['then'](function(_0x5ca6f1){_0x5ab4da[_0x4972('0x1c')]=_0x5ca6f1;if(_0x53a27b[_0x4972('0x31')]['includeAll']){_0x19a397[_0x4972('0x41')]=[{'all':!![]}];}return db[_0x4972('0x40')][_0x4972('0x42')](_0x19a397);})['then'](function(_0xe03f07){_0x5ab4da['rows']=_0xe03f07;return _0x5ab4da;})[_0x4972('0x24')](respondWithFilteredResult(_0x5f0675,_0x19a397))[_0x4972('0x43')](handleError(_0x5f0675,null));};exports[_0x4972('0x44')]=function(_0x290bbf,_0x1fc50a){var _0x12959f={'raw':!![],'where':{'id':_0x290bbf['params']['id']}},_0x35936a={};_0x35936a[_0x4972('0x2f')]=_[_0x4972('0x32')](db['SalesforceField']['rawAttributes']);_0x35936a[_0x4972('0x31')]=_['keys'](_0x290bbf['query']);_0x35936a[_0x4972('0x3b')]=_[_0x4972('0x33')](_0x35936a['model'],_0x35936a['query']);_0x12959f['attributes']=_[_0x4972('0x33')](_0x35936a[_0x4972('0x2f')],qs['fields'](_0x290bbf['query']['fields']));_0x12959f['attributes']=_0x12959f[_0x4972('0x34')]['length']?_0x12959f[_0x4972('0x34')]:_0x35936a[_0x4972('0x2f')];if(_0x290bbf['query'][_0x4972('0x45')]){_0x12959f[_0x4972('0x41')]=[{'all':!![]}];}_0x12959f=_['merge']({},_0x12959f,_0x290bbf[_0x4972('0x46')]);return db[_0x4972('0x40')][_0x4972('0x47')](_0x12959f)['then'](handleEntityNotFound(_0x1fc50a,null))[_0x4972('0x24')](respondWithResult(_0x1fc50a,null))[_0x4972('0x43')](handleError(_0x1fc50a,null));};exports[_0x4972('0x48')]=function(_0x9a587d,_0x5d4a27){return db[_0x4972('0x40')][_0x4972('0x48')](_0x9a587d[_0x4972('0x49')],{})[_0x4972('0x24')](respondWithResult(_0x5d4a27,0xc9))[_0x4972('0x43')](handleError(_0x5d4a27,null));};exports[_0x4972('0x23')]=function(_0x40bce3,_0x3ec76a){if(_0x40bce3[_0x4972('0x49')]['id']){delete _0x40bce3[_0x4972('0x49')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x40bce3['params']['id']}})[_0x4972('0x24')](handleEntityNotFound(_0x3ec76a,null))[_0x4972('0x24')](saveUpdates(_0x40bce3[_0x4972('0x49')],null))[_0x4972('0x24')](respondWithResult(_0x3ec76a,null))[_0x4972('0x43')](handleError(_0x3ec76a,null));};exports['destroy']=function(_0x297173,_0x1b65f9){return db[_0x4972('0x40')][_0x4972('0x47')]({'where':{'id':_0x297173[_0x4972('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b65f9,null))['then'](removeEntity(_0x1b65f9,null))[_0x4972('0x43')](handleError(_0x1b65f9,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index ca7be68..c2c098b 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 _0xc77a=['api','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','FieldId','util','../../config/logger'];(function(_0xc31f04,_0x165cac){var _0x2cde7b=function(_0x4373b1){while(--_0x4373b1){_0xc31f04['push'](_0xc31f04['shift']());}};_0x2cde7b(++_0x165cac);}(_0xc77a,0xd6));var _0xac77=function(_0x3c5cc7,_0x447374){_0x3c5cc7=_0x3c5cc7-0x0;var _0x2aef2a=_0xc77a[_0x3c5cc7];return _0x2aef2a;};'use strict';var _=require('lodash');var util=require(_0xac77('0x0'));var logger=require(_0xac77('0x1'))(_0xac77('0x2'));var moment=require('moment');var BPromise=require('bluebird');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(_0xac77('0x3'));module[_0xac77('0x4')]=function(_0x5b53a5,_0x10eb4c){return _0x5b53a5[_0xac77('0x5')](_0xac77('0x6'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xac77('0x7'),'fields':['idField',_0xac77('0x8')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa844=['salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','path','../../config/environment','./intSalesforceField.attributes','int_salesforce_fields'];(function(_0x51d538,_0x418eca){var _0x4eea2e=function(_0x43c34f){while(--_0x43c34f){_0x51d538['push'](_0x51d538['shift']());}};_0x4eea2e(++_0x418eca);}(_0xa844,0xf3));var _0x4a84=function(_0x4e6139,_0x31f96c){_0x4e6139=_0x4e6139-0x0;var _0x417472=_0xa844[_0x4e6139];return _0x417472;};'use strict';var _=require(_0x4a84('0x0'));var util=require(_0x4a84('0x1'));var logger=require(_0x4a84('0x2'))(_0x4a84('0x3'));var moment=require(_0x4a84('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a84('0x5'));var rimraf=require('rimraf');var config=require(_0x4a84('0x6'));var attributes=require(_0x4a84('0x7'));module['exports']=function(_0x465f38,_0x56e36d){return _0x465f38['define']('SalesforceField',attributes,{'tableName':_0x4a84('0x8'),'paranoid':![],'indexes':[{'name':_0x4a84('0x9'),'fields':[_0x4a84('0xa'),_0x4a84('0xb')],'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 861e0d3..3e77b71 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 _0x5eef=['info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then'];(function(_0x4024f4,_0x44c360){var _0x137ded=function(_0x5b680e){while(--_0x5b680e){_0x4024f4['push'](_0x4024f4['shift']());}};_0x137ded(++_0x44c360);}(_0x5eef,0x1a3));var _0xf5ee=function(_0x3bc50a,_0x4d881b){_0x3bc50a=_0x3bc50a-0x0;var _0x441d84=_0x5eef[_0x3bc50a];return _0x441d84;};'use strict';var _=require(_0xf5ee('0x0'));var util=require(_0xf5ee('0x1'));var moment=require(_0xf5ee('0x2'));var BPromise=require(_0xf5ee('0x3'));var rs=require(_0xf5ee('0x4'));var fs=require('fs');var Redis=require(_0xf5ee('0x5'));var db=require(_0xf5ee('0x6'))['db'];var utils=require(_0xf5ee('0x7'));var logger=require('../../config/logger')(_0xf5ee('0x8'));var config=require(_0xf5ee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf5ee('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34f26f,_0xcd7704,_0x571629){return new BPromise(function(_0x32253e,_0x509175){return client[_0xf5ee('0xb')](_0x34f26f,_0x571629)[_0xf5ee('0xc')](function(_0x3e8062){logger[_0xf5ee('0xd')](_0xf5ee('0xe'),_0xcd7704,_0xf5ee('0xf'));logger[_0xf5ee('0x10')](_0xf5ee('0x11'),_0xcd7704,_0xf5ee('0xf'),JSON[_0xf5ee('0x12')](_0x3e8062));if(_0x3e8062[_0xf5ee('0x13')]){if(_0x3e8062[_0xf5ee('0x13')][_0xf5ee('0x14')]===0x1f4){logger[_0xf5ee('0x13')](_0xf5ee('0xe'),_0xcd7704,_0x3e8062[_0xf5ee('0x13')][_0xf5ee('0x15')]);return _0x509175(_0x3e8062[_0xf5ee('0x13')][_0xf5ee('0x15')]);}logger[_0xf5ee('0x13')](_0xf5ee('0xe'),_0xcd7704,_0x3e8062[_0xf5ee('0x13')]['message']);return _0x32253e(_0x3e8062[_0xf5ee('0x13')][_0xf5ee('0x15')]);}else{logger['info'](_0xf5ee('0xe'),_0xcd7704,_0xf5ee('0xf'));_0x32253e(_0x3e8062[_0xf5ee('0x16')]['message']);}})[_0xf5ee('0x17')](function(_0x555f24){logger['error'](_0xf5ee('0xe'),_0xcd7704,_0x555f24);_0x509175(_0x555f24);});});} \ No newline at end of file +var _0x2664=['ioredis','../../mysqldb','jayson/promise','client','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x206acb,_0x156dd7){var _0xa85c8c=function(_0x3ccaf0){while(--_0x3ccaf0){_0x206acb['push'](_0x206acb['shift']());}};_0xa85c8c(++_0x156dd7);}(_0x2664,0x88));var _0x4266=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2664[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x4266('0x0'));var util=require(_0x4266('0x1'));var moment=require(_0x4266('0x2'));var BPromise=require(_0x4266('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4266('0x4'));var db=require(_0x4266('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4266('0x6'));var client=jayson[_0x4266('0x7')][_0x4266('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57dfab,_0x1f830b,_0x4e85bf){return new BPromise(function(_0x9fdd98,_0x13540f){return client[_0x4266('0x9')](_0x57dfab,_0x4e85bf)['then'](function(_0x2d84da){logger[_0x4266('0xa')](_0x4266('0xb'),_0x1f830b,_0x4266('0xc'));logger[_0x4266('0xd')](_0x4266('0xe'),_0x1f830b,_0x4266('0xc'),JSON[_0x4266('0xf')](_0x2d84da));if(_0x2d84da['error']){if(_0x2d84da[_0x4266('0x10')]['code']===0x1f4){logger[_0x4266('0x10')](_0x4266('0xb'),_0x1f830b,_0x2d84da[_0x4266('0x10')][_0x4266('0x11')]);return _0x13540f(_0x2d84da[_0x4266('0x10')][_0x4266('0x11')]);}logger[_0x4266('0x10')](_0x4266('0xb'),_0x1f830b,_0x2d84da[_0x4266('0x10')][_0x4266('0x11')]);return _0x9fdd98(_0x2d84da[_0x4266('0x10')][_0x4266('0x11')]);}else{logger[_0x4266('0xa')](_0x4266('0xb'),_0x1f830b,_0x4266('0xc'));_0x9fdd98(_0x2d84da[_0x4266('0x12')][_0x4266('0x11')]);}})[_0x4266('0x13')](function(_0x47519c){logger[_0x4266('0x10')](_0x4266('0xb'),_0x1f830b,_0x47519c);_0x13540f(_0x47519c);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index a540362..85ceb9a 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 _0x4e14=['isAuthenticated','/:id/configurations','getConfigurations','getFields','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','/:id'];(function(_0x107a68,_0x184059){var _0x488994=function(_0x4d25c6){while(--_0x4d25c6){_0x107a68['push'](_0x107a68['shift']());}};_0x488994(++_0x184059);}(_0x4e14,0x10c));var _0x44e1=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4e14[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x44e1('0x0'));var util=require(_0x44e1('0x1'));var path=require(_0x44e1('0x2'));var timeout=require(_0x44e1('0x3'));var express=require(_0x44e1('0x4'));var router=express[_0x44e1('0x5')]();var fs_extra=require(_0x44e1('0x6'));var auth=require(_0x44e1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x44e1('0x8'));var controller=require(_0x44e1('0x9'));router[_0x44e1('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x44e1('0xa')](_0x44e1('0xb'),auth[_0x44e1('0xc')](),controller['show']);router[_0x44e1('0xa')](_0x44e1('0xd'),auth[_0x44e1('0xc')](),controller[_0x44e1('0xe')]);router[_0x44e1('0xa')]('/:id/fields',auth[_0x44e1('0xc')](),controller[_0x44e1('0xf')]);router[_0x44e1('0x10')]('/',auth[_0x44e1('0xc')](),controller[_0x44e1('0x11')]);router[_0x44e1('0x10')](_0x44e1('0xd'),auth[_0x44e1('0xc')](),controller['addConfiguration']);router['put'](_0x44e1('0xb'),auth[_0x44e1('0xc')](),controller['update']);router[_0x44e1('0x12')](_0x44e1('0xb'),auth[_0x44e1('0xc')](),controller[_0x44e1('0x13')]);module['exports']=router; \ No newline at end of file +var _0x914c=['../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','getFields','post','addConfiguration','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xc3e481,_0x5d0d2e){var _0x41d84b=function(_0x244ad6){while(--_0x244ad6){_0xc3e481['push'](_0xc3e481['shift']());}};_0x41d84b(++_0x5d0d2e);}(_0x914c,0x122));var _0xc914=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0x914c[_0x286bfb];return _0x52b683;};'use strict';var multer=require(_0xc914('0x0'));var util=require(_0xc914('0x1'));var path=require(_0xc914('0x2'));var timeout=require(_0xc914('0x3'));var express=require(_0xc914('0x4'));var router=express[_0xc914('0x5')]();var fs_extra=require(_0xc914('0x6'));var auth=require(_0xc914('0x7'));var interaction=require(_0xc914('0x8'));var config=require(_0xc914('0x9'));var controller=require(_0xc914('0xa'));router['get']('/',auth[_0xc914('0xb')](),controller[_0xc914('0xc')]);router['get'](_0xc914('0xd'),auth['isAuthenticated'](),controller[_0xc914('0xe')]);router[_0xc914('0xf')](_0xc914('0x10'),auth[_0xc914('0xb')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0xc914('0xb')](),controller[_0xc914('0x11')]);router[_0xc914('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc914('0x12')](_0xc914('0x10'),auth[_0xc914('0xb')](),controller[_0xc914('0x13')]);router['put'](_0xc914('0xd'),auth[_0xc914('0xb')](),controller['update']);router[_0xc914('0x14')](_0xc914('0xd'),auth[_0xc914('0xb')](),controller[_0xc914('0x15')]);module[_0xc914('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 2847f81..0238ebe 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 _0x45a7=['remoteUri','sequelize','exports','STRING','username'];(function(_0xeb0459,_0x5d9b1c){var _0x431bd2=function(_0x65ca08){while(--_0x65ca08){_0xeb0459['push'](_0xeb0459['shift']());}};_0x431bd2(++_0x5d9b1c);}(_0x45a7,0x173));var _0x745a=function(_0x5869f5,_0x176fd5){_0x5869f5=_0x5869f5-0x0;var _0x6beba1=_0x45a7[_0x5869f5];return _0x6beba1;};'use strict';var Sequelize=require(_0x745a('0x0'));module[_0x745a('0x1')]={'name':{'type':Sequelize[_0x745a('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x745a('0x2')],'unique':_0x745a('0x3')},'password':{'type':Sequelize[_0x745a('0x2')]},'email':{'type':Sequelize[_0x745a('0x2')]},'remoteUri':{'type':Sequelize[_0x745a('0x2')],'unique':_0x745a('0x4')},'serverUrl':{'type':Sequelize[_0x745a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf865=['STRING','remoteUri'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xf865,0x1f0));var _0x5f86=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0xf865[_0x3b19ea];return _0x40ece9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5f86('0x0')]},'username':{'type':Sequelize[_0x5f86('0x0')],'unique':'username'},'password':{'type':Sequelize[_0x5f86('0x0')]},'email':{'type':Sequelize[_0x5f86('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x5f86('0x1')},'serverUrl':{'type':Sequelize[_0x5f86('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index ddedf7b..b116600 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 _0x90bf=['calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','includes','forEach','internalType','label','all','log','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','test','statusCode','Wrong\x20credentials','boolean','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','set','reject','save','then','destroy','end','error','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','options','include','rows','show','params','includeAll','catch','create','body','update','find','getConfigurations','findOne','ServicenowConfiguration','rawAttributes','hasOwnProperty','AccountId','Subjects','getSubjects','channel','ServicenowField','Descriptions','getFields','made_sla','knowledge','subcategory','close_code','notify','severity','category','watch_list','upon_reject','sys_updated_on','hold_reason','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','assignment_group','additional_assignee_list','description'];(function(_0x46ee2e,_0x4d9b0e){var _0x4550eb=function(_0x8b4a21){while(--_0x8b4a21){_0x46ee2e['push'](_0x46ee2e['shift']());}};_0x4550eb(++_0x4d9b0e);}(_0x90bf,0x1ba));var _0xf90b=function(_0x1c5cda,_0x3ef6e4){_0x1c5cda=_0x1c5cda-0x0;var _0x8780db=_0x90bf[_0x1c5cda];return _0x8780db;};'use strict';var emlformat=require(_0xf90b('0x0'));var rimraf=require(_0xf90b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf90b('0x2'));var rp=require(_0xf90b('0x3'));var moment=require(_0xf90b('0x4'));var BPromise=require(_0xf90b('0x5'));var Mustache=require(_0xf90b('0x6'));var util=require(_0xf90b('0x7'));var path=require(_0xf90b('0x8'));var sox=require(_0xf90b('0x9'));var csv=require(_0xf90b('0xa'));var ejs=require(_0xf90b('0xb'));var fs=require('fs');var fs_extra=require(_0xf90b('0xc'));var _=require(_0xf90b('0xd'));var squel=require('squel');var crypto=require(_0xf90b('0xe'));var jsforce=require(_0xf90b('0xf'));var deskjs=require(_0xf90b('0x10'));var toCsv=require(_0xf90b('0xa'));var querystring=require(_0xf90b('0x11'));var Papa=require(_0xf90b('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf90b('0x13'));var as=require(_0xf90b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf90b('0x15'))(_0xf90b('0x16'));var utils=require(_0xf90b('0x17'));var config=require(_0xf90b('0x18'));var licenseUtil=require(_0xf90b('0x19'));var db=require(_0xf90b('0x1a'))['db'];var integrations=require(_0xf90b('0x1b'));function respondWithStatusCode(_0x6953f4,_0x5da747){_0x5da747=_0x5da747||0xcc;return function(_0x54132d){if(_0x54132d){return _0x6953f4[_0xf90b('0x1c')](_0x5da747);}return _0x6953f4[_0xf90b('0x1d')](_0x5da747)['end']();};}function respondWithResult(_0x11c3fb,_0x4acdbf){_0x4acdbf=_0x4acdbf||0xc8;return function(_0xacc98c){if(_0xacc98c){return _0x11c3fb[_0xf90b('0x1d')](_0x4acdbf)[_0xf90b('0x1e')](_0xacc98c);}};}function respondWithFilteredResult(_0x2f0111,_0x45e101){return function(_0x2322ce){if(_0x2322ce){var _0x3de401=typeof _0x45e101[_0xf90b('0x1f')]===_0xf90b('0x20')&&typeof _0x45e101['limit']===_0xf90b('0x20');var _0x4ad122=_0x2322ce[_0xf90b('0x21')];var _0x518e58=_0x3de401?0x0:_0x45e101[_0xf90b('0x1f')];var _0x5dd41f=_0x3de401?_0x2322ce['count']:_0x45e101[_0xf90b('0x1f')]+_0x45e101['limit'];var _0x61b7d3;if(_0x5dd41f>=_0x4ad122){_0x5dd41f=_0x4ad122;_0x61b7d3=0xc8;}else{_0x61b7d3=0xce;}_0x2f0111[_0xf90b('0x1d')](_0x61b7d3);return _0x2f0111[_0xf90b('0x22')]('Content-Range',_0x518e58+'-'+_0x5dd41f+'/'+_0x4ad122)[_0xf90b('0x1e')](_0x2322ce);}return null;};}function patchUpdates(_0x519c9a){return function(_0x476865){try{jsonpatch['apply'](_0x476865,_0x519c9a,!![]);}catch(_0xae8f36){return BPromise[_0xf90b('0x23')](_0xae8f36);}return _0x476865[_0xf90b('0x24')]();};}function saveUpdates(_0x1ea613,_0x27a0c4){return function(_0x202b53){if(_0x202b53){return _0x202b53['update'](_0x1ea613)[_0xf90b('0x25')](function(_0xcb9cd0){return _0xcb9cd0;});}return null;};}function removeEntity(_0x9d67a2,_0x5390f4){return function(_0x3ef976){if(_0x3ef976){return _0x3ef976[_0xf90b('0x26')]()[_0xf90b('0x25')](function(){_0x9d67a2['status'](0xcc)[_0xf90b('0x27')]();});}};}function handleEntityNotFound(_0x2ab48f,_0x1deaef){return function(_0x13c3d6){if(!_0x13c3d6){_0x2ab48f[_0xf90b('0x1c')](0x194);}return _0x13c3d6;};}function handleError(_0x5afb4c,_0x260730){_0x260730=_0x260730||0x1f4;return function(_0x207a8f){logger[_0xf90b('0x28')](_0x207a8f[_0xf90b('0x29')]);if(_0x207a8f[_0xf90b('0x2a')]){delete _0x207a8f[_0xf90b('0x2a')];}_0x5afb4c[_0xf90b('0x1d')](_0x260730)[_0xf90b('0x2b')](_0x207a8f);};}exports[_0xf90b('0x2c')]=function(_0x1c234f,_0x3e29eb){var _0x455514={},_0x4a510d={},_0x21a97c={'count':0x0,'rows':[]};var _0x4a252=_[_0xf90b('0x2d')](db[_0xf90b('0x2e')]['rawAttributes'],function(_0x564663){return{'name':_0x564663[_0xf90b('0x2f')],'type':_0x564663[_0xf90b('0x30')][_0xf90b('0x31')]};});_0x4a510d[_0xf90b('0x32')]=_[_0xf90b('0x2d')](_0x4a252,'name');_0x4a510d[_0xf90b('0x33')]=_[_0xf90b('0x34')](_0x1c234f[_0xf90b('0x33')]);_0x4a510d[_0xf90b('0x35')]=_[_0xf90b('0x36')](_0x4a510d[_0xf90b('0x32')],_0x4a510d['query']);_0x455514[_0xf90b('0x37')]=_[_0xf90b('0x36')](_0x4a510d[_0xf90b('0x32')],qs[_0xf90b('0x38')](_0x1c234f[_0xf90b('0x33')][_0xf90b('0x38')]));_0x455514[_0xf90b('0x37')]=_0x455514[_0xf90b('0x37')][_0xf90b('0x39')]?_0x455514[_0xf90b('0x37')]:_0x4a510d[_0xf90b('0x32')];if(!_0x1c234f['query']['hasOwnProperty'](_0xf90b('0x3a'))){_0x455514[_0xf90b('0x3b')]=qs[_0xf90b('0x3b')](_0x1c234f[_0xf90b('0x33')][_0xf90b('0x3b')]);_0x455514[_0xf90b('0x1f')]=qs['offset'](_0x1c234f[_0xf90b('0x33')][_0xf90b('0x1f')]);}_0x455514[_0xf90b('0x3c')]=qs[_0xf90b('0x3d')](_0x1c234f['query']['sort']);_0x455514['where']=qs[_0xf90b('0x35')](_[_0xf90b('0x3e')](_0x1c234f['query'],_0x4a510d[_0xf90b('0x35')]),_0x4a252);if(_0x1c234f[_0xf90b('0x33')][_0xf90b('0x3f')]){_0x455514[_0xf90b('0x40')]=_[_0xf90b('0x41')](_0x455514[_0xf90b('0x40')],{'$or':_['map'](_0x4a252,function(_0x262113){if(_0x262113[_0xf90b('0x30')]!=='VIRTUAL'){var _0x223d4c={};_0x223d4c[_0x262113['name']]={'$like':'%'+_0x1c234f[_0xf90b('0x33')][_0xf90b('0x3f')]+'%'};return _0x223d4c;}})});}_0x455514=_[_0xf90b('0x41')]({},_0x455514,_0x1c234f[_0xf90b('0x42')]);var _0x37a883={'where':_0x455514[_0xf90b('0x40')]};return db[_0xf90b('0x2e')]['count'](_0x37a883)['then'](function(_0xfa8f7e){_0x21a97c[_0xf90b('0x21')]=_0xfa8f7e;if(_0x1c234f['query']['includeAll']){_0x455514[_0xf90b('0x43')]=[{'all':!![]}];}return db[_0xf90b('0x2e')]['findAll'](_0x455514);})['then'](function(_0xa268b3){_0x21a97c[_0xf90b('0x44')]=_0xa268b3;return _0x21a97c;})[_0xf90b('0x25')](respondWithFilteredResult(_0x3e29eb,_0x455514))['catch'](handleError(_0x3e29eb,null));};exports[_0xf90b('0x45')]=function(_0x3f0d5d,_0x482e63){var _0x2d7d5c={'raw':![],'where':{'id':_0x3f0d5d[_0xf90b('0x46')]['id']}},_0x11a70b={};_0x11a70b[_0xf90b('0x32')]=_['keys'](db['ServicenowAccount']['rawAttributes']);_0x11a70b[_0xf90b('0x33')]=_[_0xf90b('0x34')](_0x3f0d5d['query']);_0x11a70b[_0xf90b('0x35')]=_[_0xf90b('0x36')](_0x11a70b[_0xf90b('0x32')],_0x11a70b[_0xf90b('0x33')]);_0x2d7d5c[_0xf90b('0x37')]=_[_0xf90b('0x36')](_0x11a70b[_0xf90b('0x32')],qs[_0xf90b('0x38')](_0x3f0d5d[_0xf90b('0x33')][_0xf90b('0x38')]));_0x2d7d5c[_0xf90b('0x37')]=_0x2d7d5c[_0xf90b('0x37')]['length']?_0x2d7d5c[_0xf90b('0x37')]:_0x11a70b[_0xf90b('0x32')];if(_0x3f0d5d[_0xf90b('0x33')][_0xf90b('0x47')]){_0x2d7d5c[_0xf90b('0x43')]=[{'all':!![]}];}_0x2d7d5c=_[_0xf90b('0x41')]({},_0x2d7d5c,_0x3f0d5d[_0xf90b('0x42')]);return db[_0xf90b('0x2e')]['find'](_0x2d7d5c)['then'](handleEntityNotFound(_0x482e63,null))[_0xf90b('0x25')](respondWithResult(_0x482e63,null))[_0xf90b('0x48')](handleError(_0x482e63,null));};exports[_0xf90b('0x49')]=function(_0x1dc79d,_0x57c0be){return db[_0xf90b('0x2e')][_0xf90b('0x49')](_0x1dc79d[_0xf90b('0x4a')],{})[_0xf90b('0x25')](respondWithResult(_0x57c0be,0xc9))[_0xf90b('0x48')](handleError(_0x57c0be,null));};exports[_0xf90b('0x4b')]=function(_0x353aa6,_0x529316){if(_0x353aa6[_0xf90b('0x4a')]['id']){delete _0x353aa6[_0xf90b('0x4a')]['id'];}return db[_0xf90b('0x2e')][_0xf90b('0x4c')]({'where':{'id':_0x353aa6[_0xf90b('0x46')]['id']}})[_0xf90b('0x25')](handleEntityNotFound(_0x529316,null))['then'](saveUpdates(_0x353aa6[_0xf90b('0x4a')],null))[_0xf90b('0x25')](respondWithResult(_0x529316,null))[_0xf90b('0x48')](handleError(_0x529316,null));};exports[_0xf90b('0x26')]=function(_0x2ce21f,_0x19b166){return db[_0xf90b('0x2e')][_0xf90b('0x4c')]({'where':{'id':_0x2ce21f['params']['id']}})[_0xf90b('0x25')](handleEntityNotFound(_0x19b166,null))[_0xf90b('0x25')](removeEntity(_0x19b166,null))[_0xf90b('0x48')](handleError(_0x19b166,null));};exports[_0xf90b('0x4d')]=function(_0x2af440,_0x2cd110,_0x10ea06){var _0x55dff3={};var _0x4d8e83={};var _0x4c234c;var _0x2a790;return db[_0xf90b('0x2e')][_0xf90b('0x4e')]({'where':{'id':_0x2af440[_0xf90b('0x46')]['id']}})[_0xf90b('0x25')](handleEntityNotFound(_0x2cd110,null))[_0xf90b('0x25')](function(_0x4cf571){if(_0x4cf571){_0x4c234c=_0x4cf571;_0x4d8e83[_0xf90b('0x32')]=_[_0xf90b('0x34')](db[_0xf90b('0x4f')][_0xf90b('0x50')]);_0x4d8e83[_0xf90b('0x33')]=_['keys'](_0x2af440[_0xf90b('0x33')]);_0x4d8e83[_0xf90b('0x35')]=_['intersection'](_0x4d8e83[_0xf90b('0x32')],_0x4d8e83[_0xf90b('0x33')]);_0x55dff3[_0xf90b('0x37')]=_[_0xf90b('0x36')](_0x4d8e83[_0xf90b('0x32')],qs[_0xf90b('0x38')](_0x2af440[_0xf90b('0x33')][_0xf90b('0x38')]));_0x55dff3[_0xf90b('0x37')]=_0x55dff3[_0xf90b('0x37')]['length']?_0x55dff3[_0xf90b('0x37')]:_0x4d8e83[_0xf90b('0x32')];_0x55dff3[_0xf90b('0x3c')]=qs['sort'](_0x2af440['query'][_0xf90b('0x3d')]);_0x55dff3['where']=qs['filters'](_['pick'](_0x2af440[_0xf90b('0x33')],_0x4d8e83[_0xf90b('0x35')]));if(_0x2af440[_0xf90b('0x33')][_0xf90b('0x3f')]){_0x55dff3[_0xf90b('0x40')]=_[_0xf90b('0x41')](_0x55dff3[_0xf90b('0x40')],{'$or':_[_0xf90b('0x2d')](_0x55dff3[_0xf90b('0x37')],function(_0x1e8e1e){var _0x296410={};_0x296410[_0x1e8e1e]={'$like':'%'+_0x2af440['query'][_0xf90b('0x3f')]+'%'};return _0x296410;})});}_0x55dff3=_[_0xf90b('0x41')]({},_0x55dff3,_0x2af440[_0xf90b('0x42')]);return _0x4c234c[_0xf90b('0x4d')](_0x55dff3);}})['then'](function(_0x2604df){if(_0x2604df){_0x2a790=_0x2604df[_0xf90b('0x39')];if(!_0x2af440[_0xf90b('0x33')][_0xf90b('0x51')](_0xf90b('0x3a'))){_0x55dff3[_0xf90b('0x3b')]=qs[_0xf90b('0x3b')](_0x2af440[_0xf90b('0x33')][_0xf90b('0x3b')]);_0x55dff3[_0xf90b('0x1f')]=qs[_0xf90b('0x1f')](_0x2af440[_0xf90b('0x33')][_0xf90b('0x1f')]);}return _0x4c234c['getConfigurations'](_0x55dff3);}})['then'](function(_0x36baa7){if(_0x36baa7){return _0x36baa7?{'count':_0x2a790,'rows':_0x36baa7}:null;}})['then'](respondWithResult(_0x2cd110,null))[_0xf90b('0x48')](handleError(_0x2cd110,null));};exports['addConfiguration']=function(_0x4741b4,_0x21e8fd,_0x307d87){if(_0x4741b4[_0xf90b('0x4a')]['id']){delete _0x4741b4[_0xf90b('0x4a')]['id'];}return db[_0xf90b('0x2e')][_0xf90b('0x4e')]({'where':{'id':_0x4741b4[_0xf90b('0x46')]['id']}})[_0xf90b('0x25')](handleEntityNotFound(_0x21e8fd,null))[_0xf90b('0x25')](function(_0x1061c7){if(_0x1061c7){_0x4741b4[_0xf90b('0x4a')][_0xf90b('0x52')]=_0x1061c7['id'];_0x4741b4['body'][_0xf90b('0x53')]=integrations[_0xf90b('0x54')](_0x4741b4[_0xf90b('0x4a')][_0xf90b('0x55')],_0x4741b4[_0xf90b('0x4a')]['type']);_0x4741b4[_0xf90b('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x4741b4[_0xf90b('0x4a')]['channel'],_0x4741b4[_0xf90b('0x4a')]['type']);return db['ServicenowConfiguration'][_0xf90b('0x49')](_0x4741b4[_0xf90b('0x4a')],{'include':[{'model':db[_0xf90b('0x56')],'as':_0xf90b('0x53')},{'model':db[_0xf90b('0x56')],'as':_0xf90b('0x57')}]});}return null;})[_0xf90b('0x25')](respondWithResult(_0x21e8fd,null))[_0xf90b('0x48')](handleError(_0x21e8fd,null));};exports[_0xf90b('0x58')]=function(_0x261ff9,_0x206bf5,_0x34f203){var _0x471b4c=[_0xf90b('0x59'),'hold_reason',_0xf90b('0x5a'),_0xf90b('0x5b'),_0xf90b('0x5c'),_0xf90b('0x5d'),'incident_state',_0xf90b('0x5e'),_0xf90b('0x5f')];var _0x25d71e=['parent',_0xf90b('0x59'),'caused_by',_0xf90b('0x60'),_0xf90b('0x61'),_0xf90b('0x62'),'child_incidents',_0xf90b('0x63'),_0xf90b('0x64'),_0xf90b('0x65'),_0xf90b('0x66'),_0xf90b('0x67'),_0xf90b('0x68'),_0xf90b('0x69'),_0xf90b('0x6a'),_0xf90b('0x6b'),_0xf90b('0x6c'),_0xf90b('0x6d'),_0xf90b('0x5a'),_0xf90b('0x3c'),_0xf90b('0x6e'),_0xf90b('0x6f'),_0xf90b('0x70'),_0xf90b('0x71'),_0xf90b('0x72'),_0xf90b('0x73'),_0xf90b('0x74'),_0xf90b('0x75'),_0xf90b('0x76'),'sys_domain_path',_0xf90b('0x77'),_0xf90b('0x78'),_0xf90b('0x79'),_0xf90b('0x7a'),_0xf90b('0x7b'),_0xf90b('0x7c'),_0xf90b('0x7d'),_0xf90b('0x7e'),_0xf90b('0x7f'),_0xf90b('0x80'),_0xf90b('0x81'),_0xf90b('0x5b'),'work_notes',_0xf90b('0x82'),_0xf90b('0x5c'),'correlation_display','delivery_task','work_start',_0xf90b('0x83'),'business_stc',_0xf90b('0x84'),_0xf90b('0x85'),_0xf90b('0x86'),_0xf90b('0x5d'),'sys_class_name',_0xf90b('0x87'),_0xf90b('0x88'),_0xf90b('0x89'),_0xf90b('0x8a'),_0xf90b('0x8b'),_0xf90b('0x8c'),'reopened_by',_0xf90b('0x8d'),_0xf90b('0x8e'),_0xf90b('0x8f'),_0xf90b('0x90'),_0xf90b('0x91'),_0xf90b('0x92'),_0xf90b('0x93'),_0xf90b('0x5e'),_0xf90b('0x94'),_0xf90b('0x95'),_0xf90b('0x96'),_0xf90b('0x97'),_0xf90b('0x98'),_0xf90b('0x99'),_0xf90b('0x9a'),_0xf90b('0x9b'),_0xf90b('0x9c'),_0xf90b('0x9d'),_0xf90b('0x9e'),_0xf90b('0x9f'),_0xf90b('0x5f')];var _0xe21fa9='';var _0x17530a='';var _0x50963e=[];var _0x5415f0='';var _0x5b5212='';var _0x40c1b3=[];var _0x566a01='';var _0x3cdef2='';var _0x1feb04={};var _0x1e7fe9='';return db['ServicenowAccount'][_0xf90b('0x4e')]({'where':{'id':_0x261ff9[_0xf90b('0x46')]['id']},'attributes':['id',_0xf90b('0xa0'),'password',_0xf90b('0xa1'),_0xf90b('0xa2'),'serverUrl']})[_0xf90b('0x25')](handleEntityNotFound(_0x206bf5,null))[_0xf90b('0x25')](function(_0x43e6f9){if(_0x43e6f9){_0x1e7fe9=_0x43e6f9[_0xf90b('0xa2')];var _0x3343dd=_0x1e7fe9[_0xf90b('0xa3')](-0x1);if(_0x3343dd==='/'){_0x1e7fe9=_0x1e7fe9[_0xf90b('0xa4')](0x0,_0x1e7fe9['lastIndexOf'](_0x3343dd));}_0x3cdef2=util[_0xf90b('0xa5')](_0xf90b('0xa6'),_0x1e7fe9);_0x566a01=util[_0xf90b('0xa5')](_0xf90b('0xa7'),_0x1e7fe9);_0x1feb04={'user':_0x43e6f9['username'],'pass':_0x43e6f9['password']};var _0x4a4497={'method':_0xf90b('0xa8'),'uri':_0x3cdef2+_0xf90b('0xa9'),'auth':_0x1feb04,'json':!![]};return rp(_0x4a4497);}})[_0xf90b('0x25')](function(_0xa6c1da){if(_0xa6c1da[_0xf90b('0xaa')][_0xf90b('0x39')]>0x0){_0xe21fa9=_0xa6c1da[_0xf90b('0xaa')];}console['log'](_0xf90b('0xab'),_0xe21fa9);_0x40c1b3=[];_0x17530a=Object[_0xf90b('0xac')]([],_0xe21fa9);_['remove'](_0x17530a,function(_0x5667c5){return!_0x471b4c[_0xf90b('0xad')](_0x5667c5[_0xf90b('0x2a')]);});_0x17530a[_0xf90b('0xae')](function(_0xfe29ae){var _0x5845ab=createFieldObject(_0x566a01,_0x1feb04,_0xfe29ae[_0xf90b('0xaf')],_0xfe29ae['name'],_0xfe29ae[_0xf90b('0xb0')],![]);_0x40c1b3['push'](_0x5845ab);});return Promise[_0xf90b('0xb1')](_0x40c1b3);})[_0xf90b('0x25')](function(_0x36ef60){_0x50963e=_0x36ef60;_0x5415f0=Object[_0xf90b('0xac')]([],_0xe21fa9);console[_0xf90b('0xb2')](_0xf90b('0xb3'),_0xe21fa9);_[_0xf90b('0xb4')](_0x5415f0,function(_0x5cb2a8){return _0x25d71e[_0xf90b('0xad')](_0x5cb2a8['name']);});console[_0xf90b('0xb2')](_0xf90b('0xb5'),_0x5415f0);_0x40c1b3=[];_0x5415f0[_0xf90b('0xae')](function(_0x1bc476){var _0x56fc80=createFieldObject(_0x566a01,_0x1feb04,_0x1bc476[_0xf90b('0xaf')],_0x1bc476[_0xf90b('0x2a')],_0x1bc476[_0xf90b('0xb0')],!![]);_0x40c1b3[_0xf90b('0xb6')](_0x56fc80);});return Promise[_0xf90b('0xb1')](_0x40c1b3);})[_0xf90b('0x25')](function(_0x1ac3e2){_0x5b5212=_0x1ac3e2;var _0x3f83d8=_0x50963e[_0xf90b('0xb7')](_0x5b5212);return{'count':_0x3f83d8['length'],'rows':_0x3f83d8};})[_0xf90b('0x25')](respondWithResult(_0x206bf5,null))[_0xf90b('0x48')](function(_0x2363bb){console['log']('ServiceNow\x20error:\x20'+_0x2363bb);var _0x120b05=_0x261ff9['query'][_0xf90b('0xb8')]?0x1f4:_0x2363bb[_0xf90b('0xb9')]||0x1f4;logger[_0xf90b('0x28')](_0x2363bb[_0xf90b('0x29')]);delete _0x2363bb['name'];if(_0x120b05===0x191){_0x120b05=0x190;}_0x206bf5[_0xf90b('0x1d')](_0x120b05)['send'](_0x261ff9[_0xf90b('0x33')][_0xf90b('0xb8')]?{'message':_0xf90b('0xba'),'statusCode':_0x2363bb[_0xf90b('0xb9')]}:_0x2363bb);});};function createFieldObject(_0x2e637e,_0x4832e6,_0x217173,_0x5d1ad7,_0x3f5ae3,_0x438931){return new Promise(function(_0x371f13,_0x200d3d){var _0x5e643d={'id':_0x5d1ad7,'name':_0x3f5ae3,'custom':_0x438931};if(_0x217173===_0xf90b('0xbb')){_0x5e643d[_0xf90b('0x42')]=[{'name':'True','value':'true'},{'name':_0xf90b('0xbc'),'value':_0xf90b('0xbd')}];_0x371f13(_0x5e643d);}else{var _0x4aeebc={'method':_0xf90b('0xa8'),'uri':_0x2e637e+_0xf90b('0xbe')+_0x5d1ad7,'auth':_0x4832e6,'json':!![]};return rp(_0x4aeebc)[_0xf90b('0x25')](function(_0x87f0a7){var _0x30a132=[];if(_0x87f0a7[_0xf90b('0xaa')][_0xf90b('0x39')]>0x0){_0x87f0a7[_0xf90b('0xaa')]['forEach'](function(_0x1b8f17){if(_0x1b8f17['inactive']==='false'){var _0x4a308c={'name':_0x1b8f17[_0xf90b('0xb0')],'value':_0x1b8f17[_0xf90b('0xbf')]};_0x30a132[_0xf90b('0xb6')](_0x4a308c);}});}_0x5e643d[_0xf90b('0x42')]=_0x30a132;if(_0x5e643d['options']['length']>0x0){_0x371f13(_0x5e643d);}else{if(_0x438931==![]){_0x371f13();}else{_0x371f13(_0x5e643d);}}});}});} \ No newline at end of file +var _0xe61f=['error','stack','name','index','ServicenowAccount','rawAttributes','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','map','VIRTUAL','include','findAll','catch','show','params','includeAll','options','create','body','find','destroy','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','closed_at','delivery_plan','impact','active','work_notes_list','sys_domain_path','rfc','time_worked','business_duration','group_list','work_end','resolved_at','approval_set','correlation_display','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','send','Wrong\x20credentials','statusCode','boolean','True','true','False','false','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then'];(function(_0x1789bc,_0x1acf84){var _0x35efd1=function(_0x2329b2){while(--_0x2329b2){_0x1789bc['push'](_0x1789bc['shift']());}};_0x35efd1(++_0x1acf84);}(_0xe61f,0x145));var _0xfe61=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe61f[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xfe61('0x0'));var rimraf=require(_0xfe61('0x1'));var zipdir=require(_0xfe61('0x2'));var jsonpatch=require(_0xfe61('0x3'));var rp=require(_0xfe61('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfe61('0x5'));var util=require(_0xfe61('0x6'));var path=require(_0xfe61('0x7'));var sox=require(_0xfe61('0x8'));var csv=require(_0xfe61('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe61('0xa'));var _=require(_0xfe61('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfe61('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfe61('0x9'));var querystring=require(_0xfe61('0xd'));var Papa=require(_0xfe61('0xe'));var Redis=require(_0xfe61('0xf'));var authService=require(_0xfe61('0x10'));var qs=require(_0xfe61('0x11'));var as=require(_0xfe61('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe61('0x13'))(_0xfe61('0x14'));var utils=require('../../config/utils');var config=require(_0xfe61('0x15'));var licenseUtil=require(_0xfe61('0x16'));var db=require(_0xfe61('0x17'))['db'];var integrations=require(_0xfe61('0x18'));function respondWithStatusCode(_0xebe804,_0x149e4f){_0x149e4f=_0x149e4f||0xcc;return function(_0x4c6e68){if(_0x4c6e68){return _0xebe804[_0xfe61('0x19')](_0x149e4f);}return _0xebe804[_0xfe61('0x1a')](_0x149e4f)[_0xfe61('0x1b')]();};}function respondWithResult(_0x2081ff,_0x304568){_0x304568=_0x304568||0xc8;return function(_0x1be36a){if(_0x1be36a){return _0x2081ff[_0xfe61('0x1a')](_0x304568)[_0xfe61('0x1c')](_0x1be36a);}};}function respondWithFilteredResult(_0x2d953f,_0x3aed6c){return function(_0x8e5b42){if(_0x8e5b42){var _0x314c83=typeof _0x3aed6c[_0xfe61('0x1d')]===_0xfe61('0x1e')&&typeof _0x3aed6c[_0xfe61('0x1f')]===_0xfe61('0x1e');var _0x13d196=_0x8e5b42[_0xfe61('0x20')];var _0x4414a1=_0x314c83?0x0:_0x3aed6c[_0xfe61('0x1d')];var _0x336455=_0x314c83?_0x8e5b42[_0xfe61('0x20')]:_0x3aed6c[_0xfe61('0x1d')]+_0x3aed6c[_0xfe61('0x1f')];var _0x4c4f20;if(_0x336455>=_0x13d196){_0x336455=_0x13d196;_0x4c4f20=0xc8;}else{_0x4c4f20=0xce;}_0x2d953f[_0xfe61('0x1a')](_0x4c4f20);return _0x2d953f['set'](_0xfe61('0x21'),_0x4414a1+'-'+_0x336455+'/'+_0x13d196)[_0xfe61('0x1c')](_0x8e5b42);}return null;};}function patchUpdates(_0x173cdc){return function(_0x35c14e){try{jsonpatch[_0xfe61('0x22')](_0x35c14e,_0x173cdc,!![]);}catch(_0xcbbd59){return BPromise[_0xfe61('0x23')](_0xcbbd59);}return _0x35c14e[_0xfe61('0x24')]();};}function saveUpdates(_0x4f629b,_0x533ea0){return function(_0x3382f5){if(_0x3382f5){return _0x3382f5[_0xfe61('0x25')](_0x4f629b)[_0xfe61('0x26')](function(_0x4655cf){return _0x4655cf;});}return null;};}function removeEntity(_0x190214,_0x528436){return function(_0x2d43b8){if(_0x2d43b8){return _0x2d43b8['destroy']()[_0xfe61('0x26')](function(){_0x190214['status'](0xcc)[_0xfe61('0x1b')]();});}};}function handleEntityNotFound(_0x5e5eff,_0x3503c7){return function(_0x50a549){if(!_0x50a549){_0x5e5eff[_0xfe61('0x19')](0x194);}return _0x50a549;};}function handleError(_0x4c4925,_0x1c06fd){_0x1c06fd=_0x1c06fd||0x1f4;return function(_0x92e594){logger[_0xfe61('0x27')](_0x92e594[_0xfe61('0x28')]);if(_0x92e594[_0xfe61('0x29')]){delete _0x92e594[_0xfe61('0x29')];}_0x4c4925[_0xfe61('0x1a')](_0x1c06fd)['send'](_0x92e594);};}exports[_0xfe61('0x2a')]=function(_0x36e45b,_0x1b2c1c){var _0x5d16b0={},_0x58b268={},_0x575251={'count':0x0,'rows':[]};var _0x5686a1=_['map'](db[_0xfe61('0x2b')][_0xfe61('0x2c')],function(_0x2f3246){return{'name':_0x2f3246['fieldName'],'type':_0x2f3246[_0xfe61('0x2d')]['key']};});_0x58b268[_0xfe61('0x2e')]=_['map'](_0x5686a1,_0xfe61('0x29'));_0x58b268['query']=_[_0xfe61('0x2f')](_0x36e45b['query']);_0x58b268[_0xfe61('0x30')]=_[_0xfe61('0x31')](_0x58b268[_0xfe61('0x2e')],_0x58b268[_0xfe61('0x32')]);_0x5d16b0[_0xfe61('0x33')]=_['intersection'](_0x58b268[_0xfe61('0x2e')],qs['fields'](_0x36e45b[_0xfe61('0x32')][_0xfe61('0x34')]));_0x5d16b0['attributes']=_0x5d16b0['attributes'][_0xfe61('0x35')]?_0x5d16b0[_0xfe61('0x33')]:_0x58b268['model'];if(!_0x36e45b[_0xfe61('0x32')][_0xfe61('0x36')]('nolimit')){_0x5d16b0['limit']=qs['limit'](_0x36e45b[_0xfe61('0x32')][_0xfe61('0x1f')]);_0x5d16b0['offset']=qs[_0xfe61('0x1d')](_0x36e45b['query']['offset']);}_0x5d16b0[_0xfe61('0x37')]=qs[_0xfe61('0x38')](_0x36e45b[_0xfe61('0x32')][_0xfe61('0x38')]);_0x5d16b0['where']=qs[_0xfe61('0x30')](_[_0xfe61('0x39')](_0x36e45b['query'],_0x58b268[_0xfe61('0x30')]),_0x5686a1);if(_0x36e45b['query'][_0xfe61('0x3a')]){_0x5d16b0['where']=_[_0xfe61('0x3b')](_0x5d16b0[_0xfe61('0x3c')],{'$or':_[_0xfe61('0x3d')](_0x5686a1,function(_0xa28c8e){if(_0xa28c8e[_0xfe61('0x2d')]!==_0xfe61('0x3e')){var _0x525674={};_0x525674[_0xa28c8e[_0xfe61('0x29')]]={'$like':'%'+_0x36e45b[_0xfe61('0x32')]['filter']+'%'};return _0x525674;}})});}_0x5d16b0=_['merge']({},_0x5d16b0,_0x36e45b['options']);var _0xe32810={'where':_0x5d16b0[_0xfe61('0x3c')]};return db[_0xfe61('0x2b')][_0xfe61('0x20')](_0xe32810)[_0xfe61('0x26')](function(_0x583626){_0x575251['count']=_0x583626;if(_0x36e45b[_0xfe61('0x32')]['includeAll']){_0x5d16b0[_0xfe61('0x3f')]=[{'all':!![]}];}return db[_0xfe61('0x2b')][_0xfe61('0x40')](_0x5d16b0);})[_0xfe61('0x26')](function(_0x185e09){_0x575251['rows']=_0x185e09;return _0x575251;})[_0xfe61('0x26')](respondWithFilteredResult(_0x1b2c1c,_0x5d16b0))[_0xfe61('0x41')](handleError(_0x1b2c1c,null));};exports[_0xfe61('0x42')]=function(_0xd105af,_0x2cb45d){var _0x432ded={'raw':![],'where':{'id':_0xd105af[_0xfe61('0x43')]['id']}},_0x25437b={};_0x25437b[_0xfe61('0x2e')]=_['keys'](db[_0xfe61('0x2b')]['rawAttributes']);_0x25437b['query']=_[_0xfe61('0x2f')](_0xd105af[_0xfe61('0x32')]);_0x25437b[_0xfe61('0x30')]=_[_0xfe61('0x31')](_0x25437b['model'],_0x25437b[_0xfe61('0x32')]);_0x432ded['attributes']=_['intersection'](_0x25437b[_0xfe61('0x2e')],qs[_0xfe61('0x34')](_0xd105af['query'][_0xfe61('0x34')]));_0x432ded[_0xfe61('0x33')]=_0x432ded['attributes'][_0xfe61('0x35')]?_0x432ded[_0xfe61('0x33')]:_0x25437b['model'];if(_0xd105af[_0xfe61('0x32')][_0xfe61('0x44')]){_0x432ded[_0xfe61('0x3f')]=[{'all':!![]}];}_0x432ded=_['merge']({},_0x432ded,_0xd105af[_0xfe61('0x45')]);return db['ServicenowAccount']['find'](_0x432ded)[_0xfe61('0x26')](handleEntityNotFound(_0x2cb45d,null))[_0xfe61('0x26')](respondWithResult(_0x2cb45d,null))[_0xfe61('0x41')](handleError(_0x2cb45d,null));};exports[_0xfe61('0x46')]=function(_0x3e9e76,_0x542388){return db[_0xfe61('0x2b')][_0xfe61('0x46')](_0x3e9e76['body'],{})['then'](respondWithResult(_0x542388,0xc9))['catch'](handleError(_0x542388,null));};exports['update']=function(_0x2f70f2,_0x45efe2){if(_0x2f70f2['body']['id']){delete _0x2f70f2[_0xfe61('0x47')]['id'];}return db[_0xfe61('0x2b')][_0xfe61('0x48')]({'where':{'id':_0x2f70f2[_0xfe61('0x43')]['id']}})[_0xfe61('0x26')](handleEntityNotFound(_0x45efe2,null))[_0xfe61('0x26')](saveUpdates(_0x2f70f2[_0xfe61('0x47')],null))['then'](respondWithResult(_0x45efe2,null))[_0xfe61('0x41')](handleError(_0x45efe2,null));};exports[_0xfe61('0x49')]=function(_0x20368e,_0x40d0a2){return db['ServicenowAccount'][_0xfe61('0x48')]({'where':{'id':_0x20368e[_0xfe61('0x43')]['id']}})[_0xfe61('0x26')](handleEntityNotFound(_0x40d0a2,null))['then'](removeEntity(_0x40d0a2,null))[_0xfe61('0x41')](handleError(_0x40d0a2,null));};exports[_0xfe61('0x4a')]=function(_0x5ea85e,_0x4c13e8,_0xf688ed){var _0x1be63d={};var _0xf69f44={};var _0x5bc4c4;var _0xf885e4;return db['ServicenowAccount'][_0xfe61('0x4b')]({'where':{'id':_0x5ea85e['params']['id']}})[_0xfe61('0x26')](handleEntityNotFound(_0x4c13e8,null))[_0xfe61('0x26')](function(_0x1e866f){if(_0x1e866f){_0x5bc4c4=_0x1e866f;_0xf69f44[_0xfe61('0x2e')]=_['keys'](db[_0xfe61('0x4c')][_0xfe61('0x2c')]);_0xf69f44[_0xfe61('0x32')]=_[_0xfe61('0x2f')](_0x5ea85e[_0xfe61('0x32')]);_0xf69f44['filters']=_[_0xfe61('0x31')](_0xf69f44[_0xfe61('0x2e')],_0xf69f44['query']);_0x1be63d[_0xfe61('0x33')]=_[_0xfe61('0x31')](_0xf69f44['model'],qs[_0xfe61('0x34')](_0x5ea85e[_0xfe61('0x32')][_0xfe61('0x34')]));_0x1be63d[_0xfe61('0x33')]=_0x1be63d[_0xfe61('0x33')][_0xfe61('0x35')]?_0x1be63d['attributes']:_0xf69f44[_0xfe61('0x2e')];_0x1be63d[_0xfe61('0x37')]=qs[_0xfe61('0x38')](_0x5ea85e[_0xfe61('0x32')][_0xfe61('0x38')]);_0x1be63d[_0xfe61('0x3c')]=qs['filters'](_[_0xfe61('0x39')](_0x5ea85e[_0xfe61('0x32')],_0xf69f44[_0xfe61('0x30')]));if(_0x5ea85e['query'][_0xfe61('0x3a')]){_0x1be63d[_0xfe61('0x3c')]=_['merge'](_0x1be63d['where'],{'$or':_[_0xfe61('0x3d')](_0x1be63d['attributes'],function(_0x5a0774){var _0x43896b={};_0x43896b[_0x5a0774]={'$like':'%'+_0x5ea85e[_0xfe61('0x32')][_0xfe61('0x3a')]+'%'};return _0x43896b;})});}_0x1be63d=_['merge']({},_0x1be63d,_0x5ea85e['options']);return _0x5bc4c4[_0xfe61('0x4a')](_0x1be63d);}})['then'](function(_0x1161e8){if(_0x1161e8){_0xf885e4=_0x1161e8[_0xfe61('0x35')];if(!_0x5ea85e['query'][_0xfe61('0x36')]('nolimit')){_0x1be63d[_0xfe61('0x1f')]=qs['limit'](_0x5ea85e['query'][_0xfe61('0x1f')]);_0x1be63d[_0xfe61('0x1d')]=qs[_0xfe61('0x1d')](_0x5ea85e[_0xfe61('0x32')][_0xfe61('0x1d')]);}return _0x5bc4c4['getConfigurations'](_0x1be63d);}})['then'](function(_0x248187){if(_0x248187){return _0x248187?{'count':_0xf885e4,'rows':_0x248187}:null;}})[_0xfe61('0x26')](respondWithResult(_0x4c13e8,null))[_0xfe61('0x41')](handleError(_0x4c13e8,null));};exports[_0xfe61('0x4d')]=function(_0x23aba1,_0x321fcf,_0x4aa255){if(_0x23aba1['body']['id']){delete _0x23aba1['body']['id'];}return db['ServicenowAccount'][_0xfe61('0x4b')]({'where':{'id':_0x23aba1[_0xfe61('0x43')]['id']}})[_0xfe61('0x26')](handleEntityNotFound(_0x321fcf,null))[_0xfe61('0x26')](function(_0x53a89a){if(_0x53a89a){_0x23aba1[_0xfe61('0x47')][_0xfe61('0x4e')]=_0x53a89a['id'];_0x23aba1['body']['Subjects']=integrations[_0xfe61('0x4f')](_0x23aba1[_0xfe61('0x47')][_0xfe61('0x50')],_0x23aba1[_0xfe61('0x47')][_0xfe61('0x2d')]);_0x23aba1[_0xfe61('0x47')][_0xfe61('0x51')]=integrations[_0xfe61('0x52')](_0x23aba1[_0xfe61('0x47')][_0xfe61('0x50')],_0x23aba1[_0xfe61('0x47')][_0xfe61('0x2d')]);return db['ServicenowConfiguration']['create'](_0x23aba1['body'],{'include':[{'model':db[_0xfe61('0x53')],'as':'Subjects'},{'model':db[_0xfe61('0x53')],'as':_0xfe61('0x51')}]});}return null;})[_0xfe61('0x26')](respondWithResult(_0x321fcf,null))[_0xfe61('0x41')](handleError(_0x321fcf,null));};exports[_0xfe61('0x54')]=function(_0x1ad7f,_0x4ced69,_0x58ed7e){var _0x1f3823=[_0xfe61('0x55'),_0xfe61('0x56'),_0xfe61('0x57'),_0xfe61('0x58'),_0xfe61('0x59'),'notify',_0xfe61('0x5a'),_0xfe61('0x5b'),_0xfe61('0x5c')];var _0x2ca708=[_0xfe61('0x5d'),_0xfe61('0x55'),_0xfe61('0x5e'),_0xfe61('0x5f'),_0xfe61('0x60'),_0xfe61('0x61'),'child_incidents',_0xfe61('0x56'),'approval_history',_0xfe61('0x62'),_0xfe61('0x63'),_0xfe61('0x64'),_0xfe61('0x65'),_0xfe61('0x66'),'sys_created_on',_0xfe61('0x67'),_0xfe61('0x68'),_0xfe61('0x69'),_0xfe61('0x57'),_0xfe61('0x37'),'calendar_stc',_0xfe61('0x6a'),'cmdb_ci',_0xfe61('0x6b'),_0xfe61('0x6c'),_0xfe61('0x6d'),_0xfe61('0x6e'),'business_service','priority',_0xfe61('0x6f'),_0xfe61('0x70'),_0xfe61('0x71'),'expected_start','opened_at',_0xfe61('0x72'),_0xfe61('0x73'),_0xfe61('0x74'),'reopened_time',_0xfe61('0x75'),'caller_id',_0xfe61('0x76'),_0xfe61('0x58'),'work_notes','short_description',_0xfe61('0x59'),_0xfe61('0x77'),'delivery_task','work_start',_0xfe61('0x78'),_0xfe61('0x79'),_0xfe61('0x7a'),_0xfe61('0x7b'),_0xfe61('0x7c'),'notify',_0xfe61('0x7d'),_0xfe61('0x7e'),_0xfe61('0x7f'),_0xfe61('0x80'),_0xfe61('0x81'),_0xfe61('0x82'),'contact_type',_0xfe61('0x83'),'incident_state',_0xfe61('0x84'),_0xfe61('0x85'),'company',_0xfe61('0x86'),_0xfe61('0x87'),_0xfe61('0x88'),_0xfe61('0x5b'),_0xfe61('0x89'),_0xfe61('0x8a'),_0xfe61('0x8b'),_0xfe61('0x8c'),_0xfe61('0x8d'),_0xfe61('0x8e'),_0xfe61('0x8f'),_0xfe61('0x90'),_0xfe61('0x91'),_0xfe61('0x92'),'correlation_id',_0xfe61('0x93'),_0xfe61('0x5c')];var _0x333b95='';var _0x432a52='';var _0x4b6551=[];var _0x1ba0bd='';var _0x3013e7='';var _0x29e49d=[];var _0x37349c='';var _0x4dd817='';var _0x5b48cc={};var _0x5d90be='';return db[_0xfe61('0x2b')][_0xfe61('0x4b')]({'where':{'id':_0x1ad7f[_0xfe61('0x43')]['id']},'attributes':['id',_0xfe61('0x94'),_0xfe61('0x95'),_0xfe61('0x96'),_0xfe61('0x97'),_0xfe61('0x98')]})[_0xfe61('0x26')](handleEntityNotFound(_0x4ced69,null))[_0xfe61('0x26')](function(_0x31ce7f){if(_0x31ce7f){_0x5d90be=_0x31ce7f['remoteUri'];var _0x24530b=_0x5d90be[_0xfe61('0x99')](-0x1);if(_0x24530b==='/'){_0x5d90be=_0x5d90be[_0xfe61('0x9a')](0x0,_0x5d90be[_0xfe61('0x9b')](_0x24530b));}_0x4dd817=util[_0xfe61('0x9c')](_0xfe61('0x9d'),_0x5d90be);_0x37349c=util[_0xfe61('0x9c')](_0xfe61('0x9e'),_0x5d90be);_0x5b48cc={'user':_0x31ce7f[_0xfe61('0x94')],'pass':_0x31ce7f[_0xfe61('0x95')]};var _0x3b55cf={'method':_0xfe61('0x9f'),'uri':_0x4dd817+'incident?sysparm_display_value=all','auth':_0x5b48cc,'json':!![]};return rp(_0x3b55cf);}})[_0xfe61('0x26')](function(_0x4758d1){if(_0x4758d1[_0xfe61('0xa0')][_0xfe61('0x35')]>0x0){_0x333b95=_0x4758d1[_0xfe61('0xa0')];}console['log'](_0xfe61('0xa1'),_0x333b95);_0x29e49d=[];_0x432a52=Object[_0xfe61('0xa2')]([],_0x333b95);_[_0xfe61('0xa3')](_0x432a52,function(_0x2652c6){return!_0x1f3823[_0xfe61('0xa4')](_0x2652c6['name']);});_0x432a52[_0xfe61('0xa5')](function(_0x485e90){var _0x45b0f4=createFieldObject(_0x37349c,_0x5b48cc,_0x485e90[_0xfe61('0xa6')],_0x485e90[_0xfe61('0x29')],_0x485e90[_0xfe61('0xa7')],![]);_0x29e49d['push'](_0x45b0f4);});return Promise['all'](_0x29e49d);})[_0xfe61('0x26')](function(_0x4b1aac){_0x4b6551=_0x4b1aac;_0x1ba0bd=Object[_0xfe61('0xa2')]([],_0x333b95);console[_0xfe61('0xa8')](_0xfe61('0xa9'),_0x333b95);_[_0xfe61('0xa3')](_0x1ba0bd,function(_0x4026d0){return _0x2ca708['includes'](_0x4026d0[_0xfe61('0x29')]);});console[_0xfe61('0xa8')](_0xfe61('0xaa'),_0x1ba0bd);_0x29e49d=[];_0x1ba0bd[_0xfe61('0xa5')](function(_0x37dd97){var _0x100e80=createFieldObject(_0x37349c,_0x5b48cc,_0x37dd97[_0xfe61('0xa6')],_0x37dd97[_0xfe61('0x29')],_0x37dd97[_0xfe61('0xa7')],!![]);_0x29e49d['push'](_0x100e80);});return Promise[_0xfe61('0xab')](_0x29e49d);})[_0xfe61('0x26')](function(_0x20972e){_0x3013e7=_0x20972e;var _0x269f32=_0x4b6551[_0xfe61('0xac')](_0x3013e7);return{'count':_0x269f32['length'],'rows':_0x269f32};})['then'](respondWithResult(_0x4ced69,null))[_0xfe61('0x41')](function(_0x534e38){console['log']('ServiceNow\x20error:\x20'+_0x534e38);var _0x356d6c=_0x1ad7f[_0xfe61('0x32')]['test']?0x1f4:_0x534e38['statusCode']||0x1f4;logger[_0xfe61('0x27')](_0x534e38['stack']);delete _0x534e38['name'];if(_0x356d6c===0x191){_0x356d6c=0x190;}_0x4ced69[_0xfe61('0x1a')](_0x356d6c)[_0xfe61('0xad')](_0x1ad7f[_0xfe61('0x32')]['test']?{'message':_0xfe61('0xae'),'statusCode':_0x534e38[_0xfe61('0xaf')]}:_0x534e38);});};function createFieldObject(_0x153c4f,_0x1cb21a,_0x5a99af,_0x1f1890,_0x461e69,_0x1ff269){return new Promise(function(_0xe3aaf8,_0x4e7d34){var _0x556c6e={'id':_0x1f1890,'name':_0x461e69,'custom':_0x1ff269};if(_0x5a99af===_0xfe61('0xb0')){_0x556c6e[_0xfe61('0x45')]=[{'name':_0xfe61('0xb1'),'value':_0xfe61('0xb2')},{'name':_0xfe61('0xb3'),'value':_0xfe61('0xb4')}];_0xe3aaf8(_0x556c6e);}else{var _0x39aa71={'method':_0xfe61('0x9f'),'uri':_0x153c4f+'sys_choice?sysparm_query=name=incident^element='+_0x1f1890,'auth':_0x1cb21a,'json':!![]};return rp(_0x39aa71)[_0xfe61('0x26')](function(_0x2c899c){var _0x49cd90=[];if(_0x2c899c[_0xfe61('0xa0')][_0xfe61('0x35')]>0x0){_0x2c899c[_0xfe61('0xa0')][_0xfe61('0xa5')](function(_0x514ef2){if(_0x514ef2['inactive']===_0xfe61('0xb4')){var _0x58b5b8={'name':_0x514ef2[_0xfe61('0xa7')],'value':_0x514ef2['value']};_0x49cd90[_0xfe61('0xb5')](_0x58b5b8);}});}_0x556c6e['options']=_0x49cd90;if(_0x556c6e[_0xfe61('0x45')][_0xfe61('0x35')]>0x0){_0xe3aaf8(_0x556c6e);}else{if(_0x1ff269==![]){_0xe3aaf8();}else{_0xe3aaf8(_0x556c6e);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 7174f3d..2245200 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util'];(function(_0x274f6e,_0x4756ce){var _0x21ba1c=function(_0x505be8){while(--_0x505be8){_0x274f6e['push'](_0x274f6e['shift']());}};_0x21ba1c(++_0x4756ce);}(_0x814b,0x1a2));var _0xb814=function(_0x5f382f,_0x3f1432){_0x5f382f=_0x5f382f-0x0;var _0x3bb11b=_0x814b[_0x5f382f];return _0x3bb11b;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));var integrations=require(_0xb814('0xa'));module[_0xb814('0xb')]=function(_0x53e507,_0x3b0829){return _0x53e507[_0xb814('0xc')]('ServicenowAccount',attributes,{'tableName':_0xb814('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa630=['moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util'];(function(_0x3b0bf9,_0x5eacc2){var _0x19a160=function(_0xaa2ac6){while(--_0xaa2ac6){_0x3b0bf9['push'](_0x3b0bf9['shift']());}};_0x19a160(++_0x5eacc2);}(_0xa630,0xbe));var _0x0a63=function(_0x167bf3,_0x52408d){_0x167bf3=_0x167bf3-0x0;var _0xb4e412=_0xa630[_0x167bf3];return _0xb4e412;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a63('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a63('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var attributes=require(_0x0a63('0x6'));var integrations=require(_0x0a63('0x7'));module[_0x0a63('0x8')]=function(_0x4b7474,_0x2760b0){return _0x4b7474[_0x0a63('0x9')](_0x0a63('0xa'),attributes,{'tableName':_0x0a63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index dcc6313..54bfba9 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 _0xf395=['find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetServicenowAccount','options','attributes','limit','include','map','model','catch','ShowServicenowAccount','ServicenowAccount'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xf395,0x1ec));var _0x5f39=function(_0x2e6c1f,_0x241d49){_0x2e6c1f=_0x2e6c1f-0x0;var _0xa23058=_0xf395[_0x2e6c1f];return _0xa23058;};'use strict';var _=require('lodash');var util=require(_0x5f39('0x0'));var moment=require(_0x5f39('0x1'));var BPromise=require(_0x5f39('0x2'));var rs=require(_0x5f39('0x3'));var fs=require('fs');var Redis=require(_0x5f39('0x4'));var db=require(_0x5f39('0x5'))['db'];var utils=require(_0x5f39('0x6'));var logger=require('../../config/logger')(_0x5f39('0x7'));var config=require('../../config/environment');var jayson=require(_0x5f39('0x8'));var client=jayson[_0x5f39('0x9')][_0x5f39('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9d64a3,_0x320364,_0x506ec6){return new BPromise(function(_0x27ddb6,_0x28cd96){return client[_0x5f39('0xb')](_0x9d64a3,_0x506ec6)[_0x5f39('0xc')](function(_0x40651d){logger['info'](_0x5f39('0xd'),_0x320364,_0x5f39('0xe'));logger[_0x5f39('0xf')](_0x5f39('0x10'),_0x320364,'request\x20sent',JSON[_0x5f39('0x11')](_0x40651d));if(_0x40651d['error']){if(_0x40651d[_0x5f39('0x12')][_0x5f39('0x13')]===0x1f4){logger[_0x5f39('0x12')](_0x5f39('0xd'),_0x320364,_0x40651d['error']['message']);return _0x28cd96(_0x40651d[_0x5f39('0x12')]['message']);}logger[_0x5f39('0x12')](_0x5f39('0xd'),_0x320364,_0x40651d['error'][_0x5f39('0x14')]);return _0x27ddb6(_0x40651d[_0x5f39('0x12')][_0x5f39('0x14')]);}else{logger[_0x5f39('0x15')](_0x5f39('0xd'),_0x320364,'request\x20sent');_0x27ddb6(_0x40651d[_0x5f39('0x16')][_0x5f39('0x14')]);}})['catch'](function(_0x54a562){logger[_0x5f39('0x12')](_0x5f39('0xd'),_0x320364,_0x54a562);_0x28cd96(_0x54a562);});});}exports[_0x5f39('0x17')]=function(_0x38caad){var _0x356a87=this;return new Promise(function(_0x20dee1,_0x2b524c){return db['ServicenowAccount']['findAll']({'raw':_0x38caad[_0x5f39('0x18')]?_0x38caad[_0x5f39('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x38caad[_0x5f39('0x18')]?_0x38caad[_0x5f39('0x18')]['where']||null:null,'attributes':_0x38caad[_0x5f39('0x18')]?_0x38caad[_0x5f39('0x18')][_0x5f39('0x19')]||null:null,'limit':_0x38caad[_0x5f39('0x18')]?_0x38caad['options'][_0x5f39('0x1a')]||null:null,'include':_0x38caad['options']?_0x38caad['options'][_0x5f39('0x1b')]?_[_0x5f39('0x1c')](_0x38caad[_0x5f39('0x18')][_0x5f39('0x1b')],function(_0x4e38f8){return{'model':db[_0x4e38f8[_0x5f39('0x1d')]],'as':_0x4e38f8['as'],'attributes':_0x4e38f8[_0x5f39('0x19')],'include':_0x4e38f8['include']?_[_0x5f39('0x1c')](_0x4e38f8['include'],function(_0x91614a){return{'model':db[_0x91614a['model']],'as':_0x91614a['as'],'attributes':_0x91614a['attributes'],'include':_0x91614a['include']?_['map'](_0x91614a[_0x5f39('0x1b')],function(_0x43121f){return{'model':db[_0x43121f[_0x5f39('0x1d')]],'as':_0x43121f['as'],'attributes':_0x43121f[_0x5f39('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5f39('0xc')](function(_0x392bf1){logger['info'](_0x5f39('0x17'),_0x38caad);logger[_0x5f39('0xf')](_0x5f39('0x17'),_0x38caad,JSON[_0x5f39('0x11')](_0x392bf1));_0x20dee1(_0x392bf1);})[_0x5f39('0x1e')](function(_0xf14224){logger[_0x5f39('0x12')](_0x5f39('0x17'),_0xf14224[_0x5f39('0x14')],_0x38caad);_0x2b524c(_0x356a87['error'](0x1f4,_0xf14224[_0x5f39('0x14')]));});});};exports[_0x5f39('0x1f')]=function(_0x100ce2){var _0x187db3=this;return new Promise(function(_0xb6682b,_0x15ed05){return db[_0x5f39('0x20')][_0x5f39('0x21')]({'raw':_0x100ce2['options']?_0x100ce2[_0x5f39('0x18')][_0x5f39('0x22')]===undefined?!![]:![]:!![],'where':_0x100ce2[_0x5f39('0x18')]?_0x100ce2[_0x5f39('0x18')]['where']||null:null,'attributes':_0x100ce2[_0x5f39('0x18')]?_0x100ce2[_0x5f39('0x18')][_0x5f39('0x19')]||null:null,'include':_0x100ce2['options']?_0x100ce2[_0x5f39('0x18')]['include']?_[_0x5f39('0x1c')](_0x100ce2[_0x5f39('0x18')][_0x5f39('0x1b')],function(_0x478904){return{'model':db[_0x478904['model']],'as':_0x478904['as'],'attributes':_0x478904[_0x5f39('0x19')],'include':_0x478904[_0x5f39('0x1b')]?_[_0x5f39('0x1c')](_0x478904['include'],function(_0x48d218){return{'model':db[_0x48d218['model']],'as':_0x48d218['as'],'attributes':_0x48d218[_0x5f39('0x19')],'include':_0x48d218[_0x5f39('0x1b')]?_[_0x5f39('0x1c')](_0x48d218['include'],function(_0x5885ac){return{'model':db[_0x5885ac['model']],'as':_0x5885ac['as'],'attributes':_0x5885ac[_0x5f39('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5f39('0xc')](function(_0x38a1b5){logger[_0x5f39('0x15')](_0x5f39('0x1f'),_0x100ce2);logger[_0x5f39('0xf')](_0x5f39('0x1f'),_0x100ce2,JSON[_0x5f39('0x11')](_0x38a1b5));_0xb6682b(_0x38a1b5);})[_0x5f39('0x1e')](function(_0x3d3cf7){logger[_0x5f39('0x12')](_0x5f39('0x1f'),_0x3d3cf7[_0x5f39('0x14')],_0x100ce2);_0x15ed05(_0x187db3['error'](0x1f4,_0x3d3cf7[_0x5f39('0x14')]));});});}; \ No newline at end of file +var _0x570b=['http','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowServicenowAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0x570b,0x12a));var _0xb570=function(_0x3954cf,_0x35c9dc){_0x3954cf=_0x3954cf-0x0;var _0x524f4c=_0x570b[_0x3954cf];return _0x524f4c;};'use strict';var _=require('lodash');var util=require(_0xb570('0x0'));var moment=require(_0xb570('0x1'));var BPromise=require(_0xb570('0x2'));var rs=require(_0xb570('0x3'));var fs=require('fs');var Redis=require(_0xb570('0x4'));var db=require(_0xb570('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb570('0x6'));var client=jayson[_0xb570('0x7')][_0xb570('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27f3c4,_0x558a9e,_0x1fa88f){return new BPromise(function(_0x3fb46b,_0x29847c){return client['request'](_0x27f3c4,_0x1fa88f)[_0xb570('0x9')](function(_0x3ad6f4){logger['info'](_0xb570('0xa'),_0x558a9e,_0xb570('0xb'));logger[_0xb570('0xc')](_0xb570('0xd'),_0x558a9e,_0xb570('0xb'),JSON['stringify'](_0x3ad6f4));if(_0x3ad6f4['error']){if(_0x3ad6f4[_0xb570('0xe')][_0xb570('0xf')]===0x1f4){logger[_0xb570('0xe')](_0xb570('0xa'),_0x558a9e,_0x3ad6f4[_0xb570('0xe')]['message']);return _0x29847c(_0x3ad6f4['error'][_0xb570('0x10')]);}logger[_0xb570('0xe')](_0xb570('0xa'),_0x558a9e,_0x3ad6f4[_0xb570('0xe')]['message']);return _0x3fb46b(_0x3ad6f4[_0xb570('0xe')][_0xb570('0x10')]);}else{logger[_0xb570('0x11')](_0xb570('0xa'),_0x558a9e,_0xb570('0xb'));_0x3fb46b(_0x3ad6f4[_0xb570('0x12')]['message']);}})[_0xb570('0x13')](function(_0x58fab7){logger[_0xb570('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x558a9e,_0x58fab7);_0x29847c(_0x58fab7);});});}exports[_0xb570('0x14')]=function(_0x25df9f){var _0x132a6d=this;return new Promise(function(_0x2dec50,_0x538bfa){return db[_0xb570('0x15')][_0xb570('0x16')]({'raw':_0x25df9f[_0xb570('0x17')]?_0x25df9f[_0xb570('0x17')][_0xb570('0x18')]===undefined?!![]:![]:!![],'where':_0x25df9f[_0xb570('0x17')]?_0x25df9f[_0xb570('0x17')][_0xb570('0x19')]||null:null,'attributes':_0x25df9f[_0xb570('0x17')]?_0x25df9f[_0xb570('0x17')][_0xb570('0x1a')]||null:null,'limit':_0x25df9f[_0xb570('0x17')]?_0x25df9f[_0xb570('0x17')][_0xb570('0x1b')]||null:null,'include':_0x25df9f[_0xb570('0x17')]?_0x25df9f[_0xb570('0x17')][_0xb570('0x1c')]?_['map'](_0x25df9f['options'][_0xb570('0x1c')],function(_0x2dad0d){return{'model':db[_0x2dad0d['model']],'as':_0x2dad0d['as'],'attributes':_0x2dad0d[_0xb570('0x1a')],'include':_0x2dad0d[_0xb570('0x1c')]?_['map'](_0x2dad0d[_0xb570('0x1c')],function(_0x2ff565){return{'model':db[_0x2ff565[_0xb570('0x1d')]],'as':_0x2ff565['as'],'attributes':_0x2ff565[_0xb570('0x1a')],'include':_0x2ff565['include']?_[_0xb570('0x1e')](_0x2ff565['include'],function(_0x3f0e1d){return{'model':db[_0x3f0e1d['model']],'as':_0x3f0e1d['as'],'attributes':_0x3f0e1d[_0xb570('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb570('0x9')](function(_0x41a218){logger['info'](_0xb570('0x14'),_0x25df9f);logger[_0xb570('0xc')](_0xb570('0x14'),_0x25df9f,JSON[_0xb570('0x1f')](_0x41a218));_0x2dec50(_0x41a218);})['catch'](function(_0x3131c5){logger['error'](_0xb570('0x14'),_0x3131c5[_0xb570('0x10')],_0x25df9f);_0x538bfa(_0x132a6d[_0xb570('0xe')](0x1f4,_0x3131c5[_0xb570('0x10')]));});});};exports[_0xb570('0x20')]=function(_0x451aa6){var _0x3a5684=this;return new Promise(function(_0x5352c3,_0x45b271){return db['ServicenowAccount'][_0xb570('0x21')]({'raw':_0x451aa6['options']?_0x451aa6[_0xb570('0x17')][_0xb570('0x18')]===undefined?!![]:![]:!![],'where':_0x451aa6[_0xb570('0x17')]?_0x451aa6[_0xb570('0x17')][_0xb570('0x19')]||null:null,'attributes':_0x451aa6[_0xb570('0x17')]?_0x451aa6[_0xb570('0x17')][_0xb570('0x1a')]||null:null,'include':_0x451aa6[_0xb570('0x17')]?_0x451aa6[_0xb570('0x17')]['include']?_[_0xb570('0x1e')](_0x451aa6['options'][_0xb570('0x1c')],function(_0xd52277){return{'model':db[_0xd52277['model']],'as':_0xd52277['as'],'attributes':_0xd52277['attributes'],'include':_0xd52277[_0xb570('0x1c')]?_[_0xb570('0x1e')](_0xd52277['include'],function(_0x22c925){return{'model':db[_0x22c925[_0xb570('0x1d')]],'as':_0x22c925['as'],'attributes':_0x22c925[_0xb570('0x1a')],'include':_0x22c925[_0xb570('0x1c')]?_['map'](_0x22c925[_0xb570('0x1c')],function(_0x5b482a){return{'model':db[_0x5b482a[_0xb570('0x1d')]],'as':_0x5b482a['as'],'attributes':_0x5b482a[_0xb570('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb570('0x9')](function(_0x501453){logger['info'](_0xb570('0x20'),_0x451aa6);logger[_0xb570('0xc')](_0xb570('0x20'),_0x451aa6,JSON[_0xb570('0x1f')](_0x501453));_0x5352c3(_0x501453);})[_0xb570('0x13')](function(_0x561253){logger['error']('ShowServicenowAccount',_0x561253[_0xb570('0x10')],_0x451aa6);_0x45b271(_0x3a5684['error'](0x1f4,_0x561253[_0xb570('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index d63a233..81ca797 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 _0x753f=['destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x753f,0xd0));var _0xf753=function(_0x122cfa,_0x2d6da9){_0x122cfa=_0x122cfa-0x0;var _0x308aff=_0x753f[_0x122cfa];return _0x308aff;};'use strict';var multer=require(_0xf753('0x0'));var util=require('util');var path=require(_0xf753('0x1'));var timeout=require(_0xf753('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf753('0x3'));var auth=require(_0xf753('0x4'));var interaction=require(_0xf753('0x5'));var config=require(_0xf753('0x6'));var controller=require(_0xf753('0x7'));router[_0xf753('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf753('0x8')](_0xf753('0x9'),auth[_0xf753('0xa')](),controller[_0xf753('0xb')]);router[_0xf753('0x8')](_0xf753('0xc'),auth['isAuthenticated'](),controller[_0xf753('0xd')]);router['get']('/:id/subjects',auth[_0xf753('0xa')](),controller[_0xf753('0xe')]);router[_0xf753('0x8')](_0xf753('0xf'),auth['isAuthenticated'](),controller[_0xf753('0x10')]);router[_0xf753('0x11')]('/',auth[_0xf753('0xa')](),controller[_0xf753('0x12')]);router[_0xf753('0x13')](_0xf753('0x9'),auth['isAuthenticated'](),controller[_0xf753('0x14')]);router[_0xf753('0x15')](_0xf753('0x9'),auth[_0xf753('0xa')](),controller[_0xf753('0x16')]);module['exports']=router; \ No newline at end of file +var _0x089b=['index','/:id','/:id/fields','getFields','isAuthenticated','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get'];(function(_0x15544f,_0x2941ff){var _0x57047d=function(_0x5b5a6d){while(--_0x5b5a6d){_0x15544f['push'](_0x15544f['shift']());}};_0x57047d(++_0x2941ff);}(_0x089b,0x120));var _0xb089=function(_0x4ee4d4,_0x4caec9){_0x4ee4d4=_0x4ee4d4-0x0;var _0x5e9b76=_0x089b[_0x4ee4d4];return _0x5e9b76;};'use strict';var multer=require(_0xb089('0x0'));var util=require(_0xb089('0x1'));var path=require(_0xb089('0x2'));var timeout=require(_0xb089('0x3'));var express=require(_0xb089('0x4'));var router=express[_0xb089('0x5')]();var fs_extra=require(_0xb089('0x6'));var auth=require(_0xb089('0x7'));var interaction=require(_0xb089('0x8'));var config=require(_0xb089('0x9'));var controller=require(_0xb089('0xa'));router[_0xb089('0xb')]('/',auth['isAuthenticated'](),controller[_0xb089('0xc')]);router[_0xb089('0xb')](_0xb089('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xb089('0xb')](_0xb089('0xe'),auth['isAuthenticated'](),controller[_0xb089('0xf')]);router['get']('/:id/subjects',auth[_0xb089('0x10')](),controller['getSubjects']);router['get'](_0xb089('0x11'),auth['isAuthenticated'](),controller[_0xb089('0x12')]);router[_0xb089('0x13')]('/',auth[_0xb089('0x10')](),controller[_0xb089('0x14')]);router['put']('/:id',auth[_0xb089('0x10')](),controller[_0xb089('0x15')]);router[_0xb089('0x16')](_0xb089('0xd'),auth[_0xb089('0x10')](),controller[_0xb089('0x17')]);module[_0xb089('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 83269a2..4eb3e9f 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 _0x9adb=['exports','STRING','sequelize'];(function(_0x2b3f26,_0x468e98){var _0x1b1733=function(_0x2d30){while(--_0x2d30){_0x2b3f26['push'](_0x2b3f26['shift']());}};_0x1b1733(++_0x468e98);}(_0x9adb,0x8c));var _0xb9ad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9adb[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb9ad('0x0'));module[_0xb9ad('0x1')]={'name':{'type':Sequelize[_0xb9ad('0x2')]},'description':{'type':Sequelize[_0xb9ad('0x2')]}}; \ No newline at end of file +var _0xc645=['exports','STRING'];(function(_0x52721d,_0x434111){var _0x2a98e0=function(_0x4b70fa){while(--_0x4b70fa){_0x52721d['push'](_0x52721d['shift']());}};_0x2a98e0(++_0x434111);}(_0xc645,0x160));var _0x5c64=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xc645[_0x2dadb9];return _0x2f0097;};'use strict';var Sequelize=require('sequelize');module[_0x5c64('0x0')]={'name':{'type':Sequelize[_0x5c64('0x1')]},'description':{'type':Sequelize[_0x5c64('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 959e0b9..60e936a 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 _0x494c=['ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowConfiguration','findAll','rows','catch','params','includeAll','include','find','create','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','bluebird','sox'];(function(_0xd9e15f,_0x23f21f){var _0x551355=function(_0x4dca13){while(--_0x4dca13){_0xd9e15f['push'](_0xd9e15f['shift']());}};_0x551355(++_0x23f21f);}(_0x494c,0xe2));var _0xc494=function(_0x233379,_0x2790f8){_0x233379=_0x233379-0x0;var _0x562ec1=_0x494c[_0x233379];return _0x562ec1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc494('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc494('0x1'));var rp=require(_0xc494('0x2'));var moment=require('moment');var BPromise=require(_0xc494('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc494('0x4'));var csv=require('to-csv');var ejs=require(_0xc494('0x5'));var fs=require('fs');var fs_extra=require(_0xc494('0x6'));var _=require(_0xc494('0x7'));var squel=require(_0xc494('0x8'));var crypto=require('crypto');var jsforce=require(_0xc494('0x9'));var deskjs=require(_0xc494('0xa'));var toCsv=require(_0xc494('0xb'));var querystring=require(_0xc494('0xc'));var Papa=require(_0xc494('0xd'));var Redis=require('ioredis');var authService=require(_0xc494('0xe'));var qs=require(_0xc494('0xf'));var as=require(_0xc494('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc494('0x11'));var utils=require(_0xc494('0x12'));var config=require(_0xc494('0x13'));var licenseUtil=require(_0xc494('0x14'));var db=require(_0xc494('0x15'))['db'];function respondWithStatusCode(_0x272be6,_0x13b4db){_0x13b4db=_0x13b4db||0xcc;return function(_0xa65f4a){if(_0xa65f4a){return _0x272be6[_0xc494('0x16')](_0x13b4db);}return _0x272be6['status'](_0x13b4db)['end']();};}function respondWithResult(_0x36cdcd,_0x4ab3dc){_0x4ab3dc=_0x4ab3dc||0xc8;return function(_0x4b49b2){if(_0x4b49b2){return _0x36cdcd[_0xc494('0x17')](_0x4ab3dc)[_0xc494('0x18')](_0x4b49b2);}};}function respondWithFilteredResult(_0x375efd,_0x525512){return function(_0xd4c13d){if(_0xd4c13d){var _0x20d011=typeof _0x525512[_0xc494('0x19')]===_0xc494('0x1a')&&typeof _0x525512[_0xc494('0x1b')]===_0xc494('0x1a');var _0x55854a=_0xd4c13d[_0xc494('0x1c')];var _0x39db94=_0x20d011?0x0:_0x525512[_0xc494('0x19')];var _0x50346c=_0x20d011?_0xd4c13d[_0xc494('0x1c')]:_0x525512[_0xc494('0x19')]+_0x525512['limit'];var _0x254995;if(_0x50346c>=_0x55854a){_0x50346c=_0x55854a;_0x254995=0xc8;}else{_0x254995=0xce;}_0x375efd[_0xc494('0x17')](_0x254995);return _0x375efd[_0xc494('0x1d')](_0xc494('0x1e'),_0x39db94+'-'+_0x50346c+'/'+_0x55854a)[_0xc494('0x18')](_0xd4c13d);}return null;};}function patchUpdates(_0x5c71da){return function(_0x2fd633){try{jsonpatch[_0xc494('0x1f')](_0x2fd633,_0x5c71da,!![]);}catch(_0x226637){return BPromise[_0xc494('0x20')](_0x226637);}return _0x2fd633[_0xc494('0x21')]();};}function saveUpdates(_0x14a680,_0x226060){return function(_0x3f7f01){if(_0x3f7f01){return _0x3f7f01[_0xc494('0x22')](_0x14a680)[_0xc494('0x23')](function(_0x1af272){return _0x1af272;});}return null;};}function removeEntity(_0x34bb2a,_0x304385){return function(_0xa6a72){if(_0xa6a72){return _0xa6a72[_0xc494('0x24')]()[_0xc494('0x23')](function(){_0x34bb2a[_0xc494('0x17')](0xcc)[_0xc494('0x25')]();});}};}function handleEntityNotFound(_0x72812e,_0x40a167){return function(_0x1bc4c2){if(!_0x1bc4c2){_0x72812e['sendStatus'](0x194);}return _0x1bc4c2;};}function handleError(_0x32dd86,_0x15b061){_0x15b061=_0x15b061||0x1f4;return function(_0x34e8bd){logger['error'](_0x34e8bd['stack']);if(_0x34e8bd[_0xc494('0x26')]){delete _0x34e8bd[_0xc494('0x26')];}_0x32dd86[_0xc494('0x17')](_0x15b061)[_0xc494('0x27')](_0x34e8bd);};}exports['index']=function(_0x390c6c,_0xff6dab){var _0x1ad1b5={},_0x5d06fc={},_0xd94eff={'count':0x0,'rows':[]};var _0x4abd24=_[_0xc494('0x28')](db['ServicenowConfiguration'][_0xc494('0x29')],function(_0xc080b2){return{'name':_0xc080b2[_0xc494('0x2a')],'type':_0xc080b2[_0xc494('0x2b')]['key']};});_0x5d06fc[_0xc494('0x2c')]=_[_0xc494('0x28')](_0x4abd24,_0xc494('0x26'));_0x5d06fc[_0xc494('0x2d')]=_[_0xc494('0x2e')](_0x390c6c[_0xc494('0x2d')]);_0x5d06fc[_0xc494('0x2f')]=_['intersection'](_0x5d06fc[_0xc494('0x2c')],_0x5d06fc[_0xc494('0x2d')]);_0x1ad1b5['attributes']=_[_0xc494('0x30')](_0x5d06fc[_0xc494('0x2c')],qs[_0xc494('0x31')](_0x390c6c[_0xc494('0x2d')][_0xc494('0x31')]));_0x1ad1b5[_0xc494('0x32')]=_0x1ad1b5[_0xc494('0x32')][_0xc494('0x33')]?_0x1ad1b5[_0xc494('0x32')]:_0x5d06fc['model'];if(!_0x390c6c[_0xc494('0x2d')][_0xc494('0x34')](_0xc494('0x35'))){_0x1ad1b5[_0xc494('0x1b')]=qs[_0xc494('0x1b')](_0x390c6c[_0xc494('0x2d')][_0xc494('0x1b')]);_0x1ad1b5[_0xc494('0x19')]=qs['offset'](_0x390c6c[_0xc494('0x2d')][_0xc494('0x19')]);}_0x1ad1b5[_0xc494('0x36')]=qs[_0xc494('0x37')](_0x390c6c[_0xc494('0x2d')]['sort']);_0x1ad1b5[_0xc494('0x38')]=qs[_0xc494('0x2f')](_[_0xc494('0x39')](_0x390c6c['query'],_0x5d06fc[_0xc494('0x2f')]),_0x4abd24);if(_0x390c6c[_0xc494('0x2d')][_0xc494('0x3a')]){_0x1ad1b5['where']=_[_0xc494('0x3b')](_0x1ad1b5['where'],{'$or':_[_0xc494('0x28')](_0x4abd24,function(_0x26535e){if(_0x26535e['type']!==_0xc494('0x3c')){var _0x307515={};_0x307515[_0x26535e['name']]={'$like':'%'+_0x390c6c[_0xc494('0x2d')][_0xc494('0x3a')]+'%'};return _0x307515;}})});}_0x1ad1b5=_['merge']({},_0x1ad1b5,_0x390c6c[_0xc494('0x3d')]);var _0x3bec58={'where':_0x1ad1b5[_0xc494('0x38')]};return db[_0xc494('0x3e')][_0xc494('0x1c')](_0x3bec58)[_0xc494('0x23')](function(_0x403e1b){_0xd94eff['count']=_0x403e1b;if(_0x390c6c[_0xc494('0x2d')]['includeAll']){_0x1ad1b5['include']=[{'all':!![]}];}return db[_0xc494('0x3e')][_0xc494('0x3f')](_0x1ad1b5);})[_0xc494('0x23')](function(_0xc064cd){_0xd94eff[_0xc494('0x40')]=_0xc064cd;return _0xd94eff;})['then'](respondWithFilteredResult(_0xff6dab,_0x1ad1b5))[_0xc494('0x41')](handleError(_0xff6dab,null));};exports['show']=function(_0x4153f7,_0x271121){var _0x3a057a={'raw':![],'where':{'id':_0x4153f7[_0xc494('0x42')]['id']}},_0x4532c8={};_0x4532c8['model']=_[_0xc494('0x2e')](db[_0xc494('0x3e')][_0xc494('0x29')]);_0x4532c8[_0xc494('0x2d')]=_[_0xc494('0x2e')](_0x4153f7[_0xc494('0x2d')]);_0x4532c8[_0xc494('0x2f')]=_[_0xc494('0x30')](_0x4532c8[_0xc494('0x2c')],_0x4532c8[_0xc494('0x2d')]);_0x3a057a[_0xc494('0x32')]=_[_0xc494('0x30')](_0x4532c8[_0xc494('0x2c')],qs[_0xc494('0x31')](_0x4153f7[_0xc494('0x2d')]['fields']));_0x3a057a[_0xc494('0x32')]=_0x3a057a[_0xc494('0x32')][_0xc494('0x33')]?_0x3a057a[_0xc494('0x32')]:_0x4532c8[_0xc494('0x2c')];if(_0x4153f7[_0xc494('0x2d')][_0xc494('0x43')]){_0x3a057a[_0xc494('0x44')]=[{'all':!![]}];}_0x3a057a=_['merge']({},_0x3a057a,_0x4153f7[_0xc494('0x3d')]);return db['ServicenowConfiguration'][_0xc494('0x45')](_0x3a057a)[_0xc494('0x23')](handleEntityNotFound(_0x271121,null))[_0xc494('0x23')](respondWithResult(_0x271121,null))[_0xc494('0x41')](handleError(_0x271121,null));};exports[_0xc494('0x46')]=function(_0x1fb8f7,_0x579bb8){return db[_0xc494('0x3e')]['create'](_0x1fb8f7[_0xc494('0x47')],{})[_0xc494('0x23')](respondWithResult(_0x579bb8,0xc9))[_0xc494('0x41')](handleError(_0x579bb8,null));};exports['update']=function(_0x26c357,_0x287ad2){if(_0x26c357['body']['id']){delete _0x26c357['body']['id'];}return db[_0xc494('0x3e')][_0xc494('0x45')]({'where':{'id':_0x26c357['params']['id']}})[_0xc494('0x23')](handleEntityNotFound(_0x287ad2,null))['then'](saveUpdates(_0x26c357[_0xc494('0x47')],null))['then'](respondWithResult(_0x287ad2,null))[_0xc494('0x41')](handleError(_0x287ad2,null));};exports[_0xc494('0x24')]=function(_0x4f78a1,_0x3077ad){return db[_0xc494('0x3e')][_0xc494('0x45')]({'where':{'id':_0x4f78a1[_0xc494('0x42')]['id']}})[_0xc494('0x23')](handleEntityNotFound(_0x3077ad,null))[_0xc494('0x23')](removeEntity(_0x3077ad,null))[_0xc494('0x41')](handleError(_0x3077ad,null));};exports[_0xc494('0x48')]=function(_0x186552,_0x482c36,_0x4f77d1){var _0x1bac03={};var _0x44681d={};var _0x7f1445;var _0x3fb2ff;return db['ServicenowConfiguration'][_0xc494('0x49')]({'where':{'id':_0x186552['params']['id']}})['then'](handleEntityNotFound(_0x482c36,null))[_0xc494('0x23')](function(_0x57bb90){if(_0x57bb90){_0x7f1445=_0x57bb90;_0x44681d[_0xc494('0x2c')]=_['keys'](db[_0xc494('0x4a')][_0xc494('0x29')]);_0x44681d[_0xc494('0x2d')]=_[_0xc494('0x2e')](_0x186552[_0xc494('0x2d')]);_0x44681d[_0xc494('0x2f')]=_[_0xc494('0x30')](_0x44681d[_0xc494('0x2c')],_0x44681d['query']);_0x1bac03[_0xc494('0x32')]=_['intersection'](_0x44681d[_0xc494('0x2c')],qs['fields'](_0x186552[_0xc494('0x2d')][_0xc494('0x31')]));_0x1bac03[_0xc494('0x32')]=_0x1bac03[_0xc494('0x32')]['length']?_0x1bac03['attributes']:_0x44681d[_0xc494('0x2c')];_0x1bac03[_0xc494('0x36')]=qs[_0xc494('0x37')](_0x186552['query'][_0xc494('0x37')]);_0x1bac03[_0xc494('0x38')]=qs['filters'](_['pick'](_0x186552[_0xc494('0x2d')],_0x44681d['filters']));if(_0x186552[_0xc494('0x2d')]['filter']){_0x1bac03[_0xc494('0x38')]=_['merge'](_0x1bac03['where'],{'$or':_[_0xc494('0x28')](_0x1bac03[_0xc494('0x32')],function(_0x453092){var _0x59d02e={};_0x59d02e[_0x453092]={'$like':'%'+_0x186552[_0xc494('0x2d')][_0xc494('0x3a')]+'%'};return _0x59d02e;})});}_0x1bac03=_[_0xc494('0x3b')]({},_0x1bac03,_0x186552[_0xc494('0x3d')]);return _0x7f1445[_0xc494('0x48')](_0x1bac03);}})[_0xc494('0x23')](function(_0x5cf7ee){if(_0x5cf7ee){_0x3fb2ff=_0x5cf7ee[_0xc494('0x33')];if(!_0x186552[_0xc494('0x2d')][_0xc494('0x34')](_0xc494('0x35'))){_0x1bac03['limit']=qs[_0xc494('0x1b')](_0x186552['query']['limit']);_0x1bac03['offset']=qs[_0xc494('0x19')](_0x186552[_0xc494('0x2d')]['offset']);}return _0x7f1445['getFields'](_0x1bac03);}})[_0xc494('0x23')](function(_0x146fcb){if(_0x146fcb){return _0x146fcb?{'count':_0x3fb2ff,'rows':_0x146fcb}:null;}})['then'](respondWithResult(_0x482c36,null))[_0xc494('0x41')](handleError(_0x482c36,null));};exports[_0xc494('0x4b')]=function(_0x50dfe6,_0x188aec,_0x264601){var _0x45fb91={};var _0x3ee8ec={};var _0x2c9ffa;var _0x4102bf;return db[_0xc494('0x3e')][_0xc494('0x49')]({'where':{'id':_0x50dfe6['params']['id']}})[_0xc494('0x23')](handleEntityNotFound(_0x188aec,null))['then'](function(_0x39e9be){if(_0x39e9be){_0x2c9ffa=_0x39e9be;_0x3ee8ec['model']=_[_0xc494('0x2e')](db[_0xc494('0x4a')][_0xc494('0x29')]);_0x3ee8ec[_0xc494('0x2d')]=_[_0xc494('0x2e')](_0x50dfe6[_0xc494('0x2d')]);_0x3ee8ec['filters']=_['intersection'](_0x3ee8ec['model'],_0x3ee8ec['query']);_0x45fb91[_0xc494('0x32')]=_[_0xc494('0x30')](_0x3ee8ec['model'],qs[_0xc494('0x31')](_0x50dfe6['query'][_0xc494('0x31')]));_0x45fb91[_0xc494('0x32')]=_0x45fb91['attributes'][_0xc494('0x33')]?_0x45fb91[_0xc494('0x32')]:_0x3ee8ec['model'];_0x45fb91[_0xc494('0x36')]=qs[_0xc494('0x37')](_0x50dfe6[_0xc494('0x2d')][_0xc494('0x37')]);_0x45fb91[_0xc494('0x38')]=qs['filters'](_[_0xc494('0x39')](_0x50dfe6[_0xc494('0x2d')],_0x3ee8ec[_0xc494('0x2f')]));if(_0x50dfe6['query'][_0xc494('0x3a')]){_0x45fb91[_0xc494('0x38')]=_[_0xc494('0x3b')](_0x45fb91[_0xc494('0x38')],{'$or':_[_0xc494('0x28')](_0x45fb91[_0xc494('0x32')],function(_0x49fdb5){var _0x1d0b72={};_0x1d0b72[_0x49fdb5]={'$like':'%'+_0x50dfe6[_0xc494('0x2d')][_0xc494('0x3a')]+'%'};return _0x1d0b72;})});}_0x45fb91=_[_0xc494('0x3b')]({},_0x45fb91,_0x50dfe6[_0xc494('0x3d')]);return _0x2c9ffa[_0xc494('0x4b')](_0x45fb91);}})['then'](function(_0x413bf0){if(_0x413bf0){_0x4102bf=_0x413bf0[_0xc494('0x33')];if(!_0x50dfe6[_0xc494('0x2d')][_0xc494('0x34')](_0xc494('0x35'))){_0x45fb91[_0xc494('0x1b')]=qs['limit'](_0x50dfe6['query'][_0xc494('0x1b')]);_0x45fb91[_0xc494('0x19')]=qs['offset'](_0x50dfe6['query'][_0xc494('0x19')]);}return _0x2c9ffa[_0xc494('0x4b')](_0x45fb91);}})['then'](function(_0x351eef){if(_0x351eef){return _0x351eef?{'count':_0x4102bf,'rows':_0x351eef}:null;}})[_0xc494('0x23')](respondWithResult(_0x188aec,null))[_0xc494('0x41')](handleError(_0x188aec,null));};exports[_0xc494('0x4c')]=function(_0x381eaa,_0x5617e8,_0x578aa4){var _0x3d8a7b={};var _0x3441c9={};var _0x2aaf01;var _0x83f525;return db['ServicenowConfiguration'][_0xc494('0x49')]({'where':{'id':_0x381eaa[_0xc494('0x42')]['id']}})[_0xc494('0x23')](handleEntityNotFound(_0x5617e8,null))[_0xc494('0x23')](function(_0x4ab3e7){if(_0x4ab3e7){_0x2aaf01=_0x4ab3e7;_0x3441c9[_0xc494('0x2c')]=_['keys'](db[_0xc494('0x4a')][_0xc494('0x29')]);_0x3441c9['query']=_['keys'](_0x381eaa[_0xc494('0x2d')]);_0x3441c9[_0xc494('0x2f')]=_[_0xc494('0x30')](_0x3441c9['model'],_0x3441c9[_0xc494('0x2d')]);_0x3d8a7b[_0xc494('0x32')]=_['intersection'](_0x3441c9[_0xc494('0x2c')],qs[_0xc494('0x31')](_0x381eaa[_0xc494('0x2d')][_0xc494('0x31')]));_0x3d8a7b[_0xc494('0x32')]=_0x3d8a7b['attributes']['length']?_0x3d8a7b[_0xc494('0x32')]:_0x3441c9[_0xc494('0x2c')];_0x3d8a7b[_0xc494('0x36')]=qs['sort'](_0x381eaa[_0xc494('0x2d')][_0xc494('0x37')]);_0x3d8a7b['where']=qs[_0xc494('0x2f')](_[_0xc494('0x39')](_0x381eaa['query'],_0x3441c9[_0xc494('0x2f')]));if(_0x381eaa[_0xc494('0x2d')][_0xc494('0x3a')]){_0x3d8a7b['where']=_[_0xc494('0x3b')](_0x3d8a7b['where'],{'$or':_[_0xc494('0x28')](_0x3d8a7b[_0xc494('0x32')],function(_0x3ad1d7){var _0x202b3f={};_0x202b3f[_0x3ad1d7]={'$like':'%'+_0x381eaa[_0xc494('0x2d')]['filter']+'%'};return _0x202b3f;})});}_0x3d8a7b=_['merge']({},_0x3d8a7b,_0x381eaa[_0xc494('0x3d')]);return _0x2aaf01['getDescriptions'](_0x3d8a7b);}})[_0xc494('0x23')](function(_0x3947cb){if(_0x3947cb){_0x83f525=_0x3947cb[_0xc494('0x33')];if(!_0x381eaa[_0xc494('0x2d')][_0xc494('0x34')]('nolimit')){_0x3d8a7b[_0xc494('0x1b')]=qs[_0xc494('0x1b')](_0x381eaa[_0xc494('0x2d')][_0xc494('0x1b')]);_0x3d8a7b[_0xc494('0x19')]=qs[_0xc494('0x19')](_0x381eaa[_0xc494('0x2d')][_0xc494('0x19')]);}return _0x2aaf01['getDescriptions'](_0x3d8a7b);}})[_0xc494('0x23')](function(_0x49117b){if(_0x49117b){return _0x49117b?{'count':_0x83f525,'rows':_0x49117b}:null;}})[_0xc494('0x23')](respondWithResult(_0x5617e8,null))[_0xc494('0x41')](handleError(_0x5617e8,null));}; \ No newline at end of file +var _0xb2ea=['nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','find','create','body','params','getFields','findOne','ServicenowField','options','getSubjects','pick','hasOwnProperty','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','stack','send','index','ServicenowConfiguration','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','fields','attributes','length'];(function(_0x5c768b,_0x5e88a6){var _0x335af8=function(_0x39b04f){while(--_0x39b04f){_0x5c768b['push'](_0x5c768b['shift']());}};_0x335af8(++_0x5e88a6);}(_0xb2ea,0x112));var _0xab2e=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0xb2ea[_0x2a0738];return _0x159679;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab2e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab2e('0x1'));var rp=require(_0xab2e('0x2'));var moment=require(_0xab2e('0x3'));var BPromise=require(_0xab2e('0x4'));var Mustache=require(_0xab2e('0x5'));var util=require(_0xab2e('0x6'));var path=require('path');var sox=require(_0xab2e('0x7'));var csv=require(_0xab2e('0x8'));var ejs=require(_0xab2e('0x9'));var fs=require('fs');var fs_extra=require(_0xab2e('0xa'));var _=require(_0xab2e('0xb'));var squel=require(_0xab2e('0xc'));var crypto=require(_0xab2e('0xd'));var jsforce=require(_0xab2e('0xe'));var deskjs=require(_0xab2e('0xf'));var toCsv=require(_0xab2e('0x8'));var querystring=require('querystring');var Papa=require(_0xab2e('0x10'));var Redis=require(_0xab2e('0x11'));var authService=require(_0xab2e('0x12'));var qs=require(_0xab2e('0x13'));var as=require(_0xab2e('0x14'));var hardwareService=require(_0xab2e('0x15'));var logger=require(_0xab2e('0x16'))(_0xab2e('0x17'));var utils=require('../../config/utils');var config=require(_0xab2e('0x18'));var licenseUtil=require(_0xab2e('0x19'));var db=require(_0xab2e('0x1a'))['db'];function respondWithStatusCode(_0x1d9003,_0x12f400){_0x12f400=_0x12f400||0xcc;return function(_0x314c1e){if(_0x314c1e){return _0x1d9003[_0xab2e('0x1b')](_0x12f400);}return _0x1d9003[_0xab2e('0x1c')](_0x12f400)[_0xab2e('0x1d')]();};}function respondWithResult(_0x4f744f,_0x35d65e){_0x35d65e=_0x35d65e||0xc8;return function(_0x24720b){if(_0x24720b){return _0x4f744f[_0xab2e('0x1c')](_0x35d65e)[_0xab2e('0x1e')](_0x24720b);}};}function respondWithFilteredResult(_0x4f3ac2,_0x2d7c75){return function(_0x455cab){if(_0x455cab){var _0x5d742a=typeof _0x2d7c75[_0xab2e('0x1f')]===_0xab2e('0x20')&&typeof _0x2d7c75[_0xab2e('0x21')]===_0xab2e('0x20');var _0x2dd75b=_0x455cab[_0xab2e('0x22')];var _0x47f4ae=_0x5d742a?0x0:_0x2d7c75[_0xab2e('0x1f')];var _0x356dc4=_0x5d742a?_0x455cab[_0xab2e('0x22')]:_0x2d7c75['offset']+_0x2d7c75[_0xab2e('0x21')];var _0x10738a;if(_0x356dc4>=_0x2dd75b){_0x356dc4=_0x2dd75b;_0x10738a=0xc8;}else{_0x10738a=0xce;}_0x4f3ac2[_0xab2e('0x1c')](_0x10738a);return _0x4f3ac2[_0xab2e('0x23')](_0xab2e('0x24'),_0x47f4ae+'-'+_0x356dc4+'/'+_0x2dd75b)[_0xab2e('0x1e')](_0x455cab);}return null;};}function patchUpdates(_0x259ea5){return function(_0x5cee9e){try{jsonpatch[_0xab2e('0x25')](_0x5cee9e,_0x259ea5,!![]);}catch(_0x22cb01){return BPromise['reject'](_0x22cb01);}return _0x5cee9e['save']();};}function saveUpdates(_0x20d718,_0x15b752){return function(_0x5ac5a0){if(_0x5ac5a0){return _0x5ac5a0[_0xab2e('0x26')](_0x20d718)[_0xab2e('0x27')](function(_0x37f3c2){return _0x37f3c2;});}return null;};}function removeEntity(_0x15e6b1,_0x590109){return function(_0x477d76){if(_0x477d76){return _0x477d76[_0xab2e('0x28')]()[_0xab2e('0x27')](function(){_0x15e6b1[_0xab2e('0x1c')](0xcc)[_0xab2e('0x1d')]();});}};}function handleEntityNotFound(_0x1fb4fc,_0x398b4b){return function(_0x33a25f){if(!_0x33a25f){_0x1fb4fc[_0xab2e('0x1b')](0x194);}return _0x33a25f;};}function handleError(_0x5d6ea6,_0x2fe5fc){_0x2fe5fc=_0x2fe5fc||0x1f4;return function(_0x562797){logger['error'](_0x562797[_0xab2e('0x29')]);if(_0x562797['name']){delete _0x562797['name'];}_0x5d6ea6[_0xab2e('0x1c')](_0x2fe5fc)[_0xab2e('0x2a')](_0x562797);};}exports[_0xab2e('0x2b')]=function(_0x6affd0,_0x1f1be5){var _0x595e83={},_0x5077a3={},_0x415664={'count':0x0,'rows':[]};var _0x2e27b6=_['map'](db[_0xab2e('0x2c')][_0xab2e('0x2d')],function(_0x5ba6fb){return{'name':_0x5ba6fb[_0xab2e('0x2e')],'type':_0x5ba6fb['type'][_0xab2e('0x2f')]};});_0x5077a3[_0xab2e('0x30')]=_[_0xab2e('0x31')](_0x2e27b6,_0xab2e('0x32'));_0x5077a3[_0xab2e('0x33')]=_[_0xab2e('0x34')](_0x6affd0[_0xab2e('0x33')]);_0x5077a3[_0xab2e('0x35')]=_[_0xab2e('0x36')](_0x5077a3[_0xab2e('0x30')],_0x5077a3[_0xab2e('0x33')]);_0x595e83['attributes']=_[_0xab2e('0x36')](_0x5077a3[_0xab2e('0x30')],qs[_0xab2e('0x37')](_0x6affd0[_0xab2e('0x33')]['fields']));_0x595e83[_0xab2e('0x38')]=_0x595e83[_0xab2e('0x38')][_0xab2e('0x39')]?_0x595e83[_0xab2e('0x38')]:_0x5077a3[_0xab2e('0x30')];if(!_0x6affd0[_0xab2e('0x33')]['hasOwnProperty'](_0xab2e('0x3a'))){_0x595e83[_0xab2e('0x21')]=qs[_0xab2e('0x21')](_0x6affd0[_0xab2e('0x33')][_0xab2e('0x21')]);_0x595e83[_0xab2e('0x1f')]=qs['offset'](_0x6affd0[_0xab2e('0x33')][_0xab2e('0x1f')]);}_0x595e83[_0xab2e('0x3b')]=qs[_0xab2e('0x3c')](_0x6affd0[_0xab2e('0x33')][_0xab2e('0x3c')]);_0x595e83[_0xab2e('0x3d')]=qs[_0xab2e('0x35')](_['pick'](_0x6affd0[_0xab2e('0x33')],_0x5077a3['filters']),_0x2e27b6);if(_0x6affd0[_0xab2e('0x33')][_0xab2e('0x3e')]){_0x595e83['where']=_[_0xab2e('0x3f')](_0x595e83[_0xab2e('0x3d')],{'$or':_[_0xab2e('0x31')](_0x2e27b6,function(_0x4995f0){if(_0x4995f0[_0xab2e('0x40')]!==_0xab2e('0x41')){var _0x2dbae2={};_0x2dbae2[_0x4995f0['name']]={'$like':'%'+_0x6affd0[_0xab2e('0x33')][_0xab2e('0x3e')]+'%'};return _0x2dbae2;}})});}_0x595e83=_[_0xab2e('0x3f')]({},_0x595e83,_0x6affd0['options']);var _0xfad04={'where':_0x595e83[_0xab2e('0x3d')]};return db['ServicenowConfiguration']['count'](_0xfad04)[_0xab2e('0x27')](function(_0x35fcaf){_0x415664['count']=_0x35fcaf;if(_0x6affd0[_0xab2e('0x33')][_0xab2e('0x42')]){_0x595e83[_0xab2e('0x43')]=[{'all':!![]}];}return db[_0xab2e('0x2c')][_0xab2e('0x44')](_0x595e83);})[_0xab2e('0x27')](function(_0x4e38d8){_0x415664[_0xab2e('0x45')]=_0x4e38d8;return _0x415664;})[_0xab2e('0x27')](respondWithFilteredResult(_0x1f1be5,_0x595e83))[_0xab2e('0x46')](handleError(_0x1f1be5,null));};exports['show']=function(_0x15344c,_0xb34e6e){var _0x14970b={'raw':![],'where':{'id':_0x15344c['params']['id']}},_0x15a071={};_0x15a071[_0xab2e('0x30')]=_[_0xab2e('0x34')](db[_0xab2e('0x2c')]['rawAttributes']);_0x15a071[_0xab2e('0x33')]=_[_0xab2e('0x34')](_0x15344c[_0xab2e('0x33')]);_0x15a071[_0xab2e('0x35')]=_[_0xab2e('0x36')](_0x15a071[_0xab2e('0x30')],_0x15a071[_0xab2e('0x33')]);_0x14970b['attributes']=_[_0xab2e('0x36')](_0x15a071[_0xab2e('0x30')],qs[_0xab2e('0x37')](_0x15344c[_0xab2e('0x33')][_0xab2e('0x37')]));_0x14970b[_0xab2e('0x38')]=_0x14970b[_0xab2e('0x38')]['length']?_0x14970b[_0xab2e('0x38')]:_0x15a071[_0xab2e('0x30')];if(_0x15344c['query'][_0xab2e('0x42')]){_0x14970b[_0xab2e('0x43')]=[{'all':!![]}];}_0x14970b=_[_0xab2e('0x3f')]({},_0x14970b,_0x15344c['options']);return db[_0xab2e('0x2c')][_0xab2e('0x47')](_0x14970b)['then'](handleEntityNotFound(_0xb34e6e,null))['then'](respondWithResult(_0xb34e6e,null))[_0xab2e('0x46')](handleError(_0xb34e6e,null));};exports[_0xab2e('0x48')]=function(_0x52f595,_0x48ef5f){return db[_0xab2e('0x2c')][_0xab2e('0x48')](_0x52f595[_0xab2e('0x49')],{})[_0xab2e('0x27')](respondWithResult(_0x48ef5f,0xc9))['catch'](handleError(_0x48ef5f,null));};exports['update']=function(_0x5970de,_0x135f6a){if(_0x5970de[_0xab2e('0x49')]['id']){delete _0x5970de[_0xab2e('0x49')]['id'];}return db[_0xab2e('0x2c')][_0xab2e('0x47')]({'where':{'id':_0x5970de[_0xab2e('0x4a')]['id']}})[_0xab2e('0x27')](handleEntityNotFound(_0x135f6a,null))['then'](saveUpdates(_0x5970de[_0xab2e('0x49')],null))[_0xab2e('0x27')](respondWithResult(_0x135f6a,null))[_0xab2e('0x46')](handleError(_0x135f6a,null));};exports[_0xab2e('0x28')]=function(_0x564995,_0x44ff98){return db[_0xab2e('0x2c')][_0xab2e('0x47')]({'where':{'id':_0x564995['params']['id']}})[_0xab2e('0x27')](handleEntityNotFound(_0x44ff98,null))['then'](removeEntity(_0x44ff98,null))[_0xab2e('0x46')](handleError(_0x44ff98,null));};exports[_0xab2e('0x4b')]=function(_0x5013d1,_0x4cd96f,_0x78a1ef){var _0x5e5bfc={};var _0x3c5874={};var _0x572c42;var _0x17bc14;return db[_0xab2e('0x2c')][_0xab2e('0x4c')]({'where':{'id':_0x5013d1[_0xab2e('0x4a')]['id']}})[_0xab2e('0x27')](handleEntityNotFound(_0x4cd96f,null))[_0xab2e('0x27')](function(_0x125bef){if(_0x125bef){_0x572c42=_0x125bef;_0x3c5874['model']=_[_0xab2e('0x34')](db[_0xab2e('0x4d')]['rawAttributes']);_0x3c5874[_0xab2e('0x33')]=_['keys'](_0x5013d1[_0xab2e('0x33')]);_0x3c5874['filters']=_[_0xab2e('0x36')](_0x3c5874[_0xab2e('0x30')],_0x3c5874[_0xab2e('0x33')]);_0x5e5bfc[_0xab2e('0x38')]=_[_0xab2e('0x36')](_0x3c5874['model'],qs[_0xab2e('0x37')](_0x5013d1[_0xab2e('0x33')][_0xab2e('0x37')]));_0x5e5bfc[_0xab2e('0x38')]=_0x5e5bfc[_0xab2e('0x38')]['length']?_0x5e5bfc[_0xab2e('0x38')]:_0x3c5874[_0xab2e('0x30')];_0x5e5bfc[_0xab2e('0x3b')]=qs['sort'](_0x5013d1['query'][_0xab2e('0x3c')]);_0x5e5bfc[_0xab2e('0x3d')]=qs[_0xab2e('0x35')](_['pick'](_0x5013d1['query'],_0x3c5874['filters']));if(_0x5013d1[_0xab2e('0x33')][_0xab2e('0x3e')]){_0x5e5bfc[_0xab2e('0x3d')]=_[_0xab2e('0x3f')](_0x5e5bfc[_0xab2e('0x3d')],{'$or':_[_0xab2e('0x31')](_0x5e5bfc[_0xab2e('0x38')],function(_0x53678d){var _0x492a5={};_0x492a5[_0x53678d]={'$like':'%'+_0x5013d1[_0xab2e('0x33')][_0xab2e('0x3e')]+'%'};return _0x492a5;})});}_0x5e5bfc=_[_0xab2e('0x3f')]({},_0x5e5bfc,_0x5013d1[_0xab2e('0x4e')]);return _0x572c42[_0xab2e('0x4b')](_0x5e5bfc);}})[_0xab2e('0x27')](function(_0x5e1a62){if(_0x5e1a62){_0x17bc14=_0x5e1a62['length'];if(!_0x5013d1['query']['hasOwnProperty']('nolimit')){_0x5e5bfc[_0xab2e('0x21')]=qs['limit'](_0x5013d1['query'][_0xab2e('0x21')]);_0x5e5bfc[_0xab2e('0x1f')]=qs[_0xab2e('0x1f')](_0x5013d1['query'][_0xab2e('0x1f')]);}return _0x572c42[_0xab2e('0x4b')](_0x5e5bfc);}})[_0xab2e('0x27')](function(_0x3f59fb){if(_0x3f59fb){return _0x3f59fb?{'count':_0x17bc14,'rows':_0x3f59fb}:null;}})['then'](respondWithResult(_0x4cd96f,null))[_0xab2e('0x46')](handleError(_0x4cd96f,null));};exports[_0xab2e('0x4f')]=function(_0x4bd35f,_0x43ac4a,_0x1af617){var _0x2d3ad4={};var _0x17d1c6={};var _0x167465;var _0xb3af81;return db['ServicenowConfiguration'][_0xab2e('0x4c')]({'where':{'id':_0x4bd35f[_0xab2e('0x4a')]['id']}})[_0xab2e('0x27')](handleEntityNotFound(_0x43ac4a,null))[_0xab2e('0x27')](function(_0x3552a4){if(_0x3552a4){_0x167465=_0x3552a4;_0x17d1c6['model']=_[_0xab2e('0x34')](db['ServicenowField'][_0xab2e('0x2d')]);_0x17d1c6[_0xab2e('0x33')]=_[_0xab2e('0x34')](_0x4bd35f['query']);_0x17d1c6['filters']=_[_0xab2e('0x36')](_0x17d1c6[_0xab2e('0x30')],_0x17d1c6[_0xab2e('0x33')]);_0x2d3ad4[_0xab2e('0x38')]=_[_0xab2e('0x36')](_0x17d1c6[_0xab2e('0x30')],qs['fields'](_0x4bd35f['query'][_0xab2e('0x37')]));_0x2d3ad4[_0xab2e('0x38')]=_0x2d3ad4[_0xab2e('0x38')][_0xab2e('0x39')]?_0x2d3ad4[_0xab2e('0x38')]:_0x17d1c6[_0xab2e('0x30')];_0x2d3ad4[_0xab2e('0x3b')]=qs[_0xab2e('0x3c')](_0x4bd35f[_0xab2e('0x33')]['sort']);_0x2d3ad4[_0xab2e('0x3d')]=qs[_0xab2e('0x35')](_[_0xab2e('0x50')](_0x4bd35f[_0xab2e('0x33')],_0x17d1c6[_0xab2e('0x35')]));if(_0x4bd35f[_0xab2e('0x33')][_0xab2e('0x3e')]){_0x2d3ad4[_0xab2e('0x3d')]=_[_0xab2e('0x3f')](_0x2d3ad4[_0xab2e('0x3d')],{'$or':_[_0xab2e('0x31')](_0x2d3ad4['attributes'],function(_0x665612){var _0x2e56e4={};_0x2e56e4[_0x665612]={'$like':'%'+_0x4bd35f[_0xab2e('0x33')]['filter']+'%'};return _0x2e56e4;})});}_0x2d3ad4=_[_0xab2e('0x3f')]({},_0x2d3ad4,_0x4bd35f[_0xab2e('0x4e')]);return _0x167465['getSubjects'](_0x2d3ad4);}})[_0xab2e('0x27')](function(_0x2d8715){if(_0x2d8715){_0xb3af81=_0x2d8715[_0xab2e('0x39')];if(!_0x4bd35f[_0xab2e('0x33')][_0xab2e('0x51')]('nolimit')){_0x2d3ad4['limit']=qs['limit'](_0x4bd35f[_0xab2e('0x33')][_0xab2e('0x21')]);_0x2d3ad4[_0xab2e('0x1f')]=qs[_0xab2e('0x1f')](_0x4bd35f[_0xab2e('0x33')]['offset']);}return _0x167465[_0xab2e('0x4f')](_0x2d3ad4);}})['then'](function(_0x5b76dc){if(_0x5b76dc){return _0x5b76dc?{'count':_0xb3af81,'rows':_0x5b76dc}:null;}})[_0xab2e('0x27')](respondWithResult(_0x43ac4a,null))['catch'](handleError(_0x43ac4a,null));};exports[_0xab2e('0x52')]=function(_0x546bb6,_0x2c5221,_0x4a829e){var _0x138106={};var _0x1ba6db={};var _0xd56782;var _0x30e6db;return db[_0xab2e('0x2c')]['findOne']({'where':{'id':_0x546bb6['params']['id']}})[_0xab2e('0x27')](handleEntityNotFound(_0x2c5221,null))[_0xab2e('0x27')](function(_0x25ea5c){if(_0x25ea5c){_0xd56782=_0x25ea5c;_0x1ba6db[_0xab2e('0x30')]=_['keys'](db[_0xab2e('0x4d')][_0xab2e('0x2d')]);_0x1ba6db['query']=_[_0xab2e('0x34')](_0x546bb6[_0xab2e('0x33')]);_0x1ba6db['filters']=_[_0xab2e('0x36')](_0x1ba6db['model'],_0x1ba6db[_0xab2e('0x33')]);_0x138106[_0xab2e('0x38')]=_['intersection'](_0x1ba6db[_0xab2e('0x30')],qs[_0xab2e('0x37')](_0x546bb6[_0xab2e('0x33')]['fields']));_0x138106[_0xab2e('0x38')]=_0x138106[_0xab2e('0x38')][_0xab2e('0x39')]?_0x138106['attributes']:_0x1ba6db[_0xab2e('0x30')];_0x138106[_0xab2e('0x3b')]=qs['sort'](_0x546bb6[_0xab2e('0x33')][_0xab2e('0x3c')]);_0x138106[_0xab2e('0x3d')]=qs[_0xab2e('0x35')](_[_0xab2e('0x50')](_0x546bb6[_0xab2e('0x33')],_0x1ba6db['filters']));if(_0x546bb6['query'][_0xab2e('0x3e')]){_0x138106[_0xab2e('0x3d')]=_[_0xab2e('0x3f')](_0x138106[_0xab2e('0x3d')],{'$or':_[_0xab2e('0x31')](_0x138106[_0xab2e('0x38')],function(_0x3f889c){var _0x4c47ae={};_0x4c47ae[_0x3f889c]={'$like':'%'+_0x546bb6['query'][_0xab2e('0x3e')]+'%'};return _0x4c47ae;})});}_0x138106=_[_0xab2e('0x3f')]({},_0x138106,_0x546bb6['options']);return _0xd56782[_0xab2e('0x52')](_0x138106);}})[_0xab2e('0x27')](function(_0x684667){if(_0x684667){_0x30e6db=_0x684667[_0xab2e('0x39')];if(!_0x546bb6['query'][_0xab2e('0x51')](_0xab2e('0x3a'))){_0x138106[_0xab2e('0x21')]=qs[_0xab2e('0x21')](_0x546bb6[_0xab2e('0x33')][_0xab2e('0x21')]);_0x138106[_0xab2e('0x1f')]=qs[_0xab2e('0x1f')](_0x546bb6[_0xab2e('0x33')]['offset']);}return _0xd56782[_0xab2e('0x52')](_0x138106);}})[_0xab2e('0x27')](function(_0x36d112){if(_0x36d112){return _0x36d112?{'count':_0x30e6db,'rows':_0x36d112}:null;}})[_0xab2e('0x27')](respondWithResult(_0x2c5221,null))[_0xab2e('0x46')](handleError(_0x2c5221,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 4ebf1e1..b7762ac 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 _0xa149=['exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes'];(function(_0x21d943,_0x18d218){var _0x53d10b=function(_0x262521){while(--_0x262521){_0x21d943['push'](_0x21d943['shift']());}};_0x53d10b(++_0x18d218);}(_0xa149,0x18c));var _0x9a14=function(_0x5f457d,_0xcaefe1){_0x5f457d=_0x5f457d-0x0;var _0x24187a=_0xa149[_0x5f457d];return _0x24187a;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var logger=require(_0x9a14('0x2'))(_0x9a14('0x3'));var moment=require(_0x9a14('0x4'));var BPromise=require(_0x9a14('0x5'));var rp=require(_0x9a14('0x6'));var fs=require('fs');var path=require(_0x9a14('0x7'));var rimraf=require(_0x9a14('0x8'));var config=require('../../config/environment');var attributes=require(_0x9a14('0x9'));module[_0x9a14('0xa')]=function(_0x5abb12,_0x417648){return _0x5abb12[_0x9a14('0xb')](_0x9a14('0xc'),attributes,{'tableName':_0x9a14('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7275=['./intServicenowConfiguration.attributes','define','int_servicenow_configurations','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x5201c0,_0x171649){var _0x11222a=function(_0x3c0499){while(--_0x3c0499){_0x5201c0['push'](_0x5201c0['shift']());}};_0x11222a(++_0x171649);}(_0x7275,0x143));var _0x5727=function(_0x524811,_0x2cf6d6){_0x524811=_0x524811-0x0;var _0x39e0f9=_0x7275[_0x524811];return _0x39e0f9;};'use strict';var _=require(_0x5727('0x0'));var util=require(_0x5727('0x1'));var logger=require(_0x5727('0x2'))('api');var moment=require(_0x5727('0x3'));var BPromise=require('bluebird');var rp=require(_0x5727('0x4'));var fs=require('fs');var path=require(_0x5727('0x5'));var rimraf=require('rimraf');var config=require(_0x5727('0x6'));var attributes=require(_0x5727('0x7'));module['exports']=function(_0x4c509e,_0x4872ba){return _0x4c509e[_0x5727('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0x5727('0x9'),'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 b4627ed..6d7c196 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 _0x803f=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x401fb4,_0x104039){var _0x425b3=function(_0x17d707){while(--_0x17d707){_0x401fb4['push'](_0x401fb4['shift']());}};_0x425b3(++_0x104039);}(_0x803f,0x144));var _0xf803=function(_0x365f51,_0x3535a0){_0x365f51=_0x365f51-0x0;var _0x3faced=_0x803f[_0x365f51];return _0x3faced;};'use strict';var _=require('lodash');var util=require(_0xf803('0x0'));var moment=require(_0xf803('0x1'));var BPromise=require(_0xf803('0x2'));var rs=require(_0xf803('0x3'));var fs=require('fs');var Redis=require(_0xf803('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf803('0x5'));var logger=require(_0xf803('0x6'))(_0xf803('0x7'));var config=require(_0xf803('0x8'));var jayson=require(_0xf803('0x9'));var client=jayson[_0xf803('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b5413,_0x4291f2,_0x43ea35){return new BPromise(function(_0x38ebfe,_0x56ab14){return client['request'](_0x2b5413,_0x43ea35)[_0xf803('0xb')](function(_0x58620e){logger[_0xf803('0xc')](_0xf803('0xd'),_0x4291f2,'request\x20sent');logger[_0xf803('0xe')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4291f2,_0xf803('0xf'),JSON['stringify'](_0x58620e));if(_0x58620e['error']){if(_0x58620e[_0xf803('0x10')]['code']===0x1f4){logger['error'](_0xf803('0xd'),_0x4291f2,_0x58620e[_0xf803('0x10')][_0xf803('0x11')]);return _0x56ab14(_0x58620e['error'][_0xf803('0x11')]);}logger[_0xf803('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4291f2,_0x58620e['error'][_0xf803('0x11')]);return _0x38ebfe(_0x58620e[_0xf803('0x10')][_0xf803('0x11')]);}else{logger[_0xf803('0xc')](_0xf803('0xd'),_0x4291f2,_0xf803('0xf'));_0x38ebfe(_0x58620e['result'][_0xf803('0x11')]);}})['catch'](function(_0x27338a){logger[_0xf803('0x10')](_0xf803('0xd'),_0x4291f2,_0x27338a);_0x56ab14(_0x27338a);});});} \ No newline at end of file +var _0xea0e=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xea0e,0x153));var _0xeea0=function(_0x17ec87,_0x1d9915){_0x17ec87=_0x17ec87-0x0;var _0x3c4668=_0xea0e[_0x17ec87];return _0x3c4668;};'use strict';var _=require(_0xeea0('0x0'));var util=require(_0xeea0('0x1'));var moment=require(_0xeea0('0x2'));var BPromise=require(_0xeea0('0x3'));var rs=require(_0xeea0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeea0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeea0('0x6'))(_0xeea0('0x7'));var config=require(_0xeea0('0x8'));var jayson=require(_0xeea0('0x9'));var client=jayson[_0xeea0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14c01d,_0x5b2bea,_0x562c26){return new BPromise(function(_0x222e8b,_0x20110a){return client[_0xeea0('0xb')](_0x14c01d,_0x562c26)[_0xeea0('0xc')](function(_0x3e4e7f){logger[_0xeea0('0xd')](_0xeea0('0xe'),_0x5b2bea,_0xeea0('0xf'));logger[_0xeea0('0x10')](_0xeea0('0x11'),_0x5b2bea,_0xeea0('0xf'),JSON[_0xeea0('0x12')](_0x3e4e7f));if(_0x3e4e7f['error']){if(_0x3e4e7f[_0xeea0('0x13')][_0xeea0('0x14')]===0x1f4){logger[_0xeea0('0x13')](_0xeea0('0xe'),_0x5b2bea,_0x3e4e7f[_0xeea0('0x13')][_0xeea0('0x15')]);return _0x20110a(_0x3e4e7f[_0xeea0('0x13')][_0xeea0('0x15')]);}logger[_0xeea0('0x13')](_0xeea0('0xe'),_0x5b2bea,_0x3e4e7f['error']['message']);return _0x222e8b(_0x3e4e7f[_0xeea0('0x13')][_0xeea0('0x15')]);}else{logger['info'](_0xeea0('0xe'),_0x5b2bea,_0xeea0('0xf'));_0x222e8b(_0x3e4e7f[_0xeea0('0x16')][_0xeea0('0x15')]);}})[_0xeea0('0x17')](function(_0x1dc9c8){logger[_0xeea0('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5b2bea,_0x1dc9c8);_0x20110a(_0x1dc9c8);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 648cdfb..5cf69cb 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 _0x1e7a=['multer','util','path','Router','fs-extra','../../components/auth/service','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3dfd88,_0x5b3996){var _0x4ee798=function(_0x3c8e46){while(--_0x3c8e46){_0x3dfd88['push'](_0x3dfd88['shift']());}};_0x4ee798(++_0x5b3996);}(_0x1e7a,0x17c));var _0xa1e7=function(_0x1ef80e,_0x31b114){_0x1ef80e=_0x1ef80e-0x0;var _0x4e3b06=_0x1e7a[_0x1ef80e];return _0x4e3b06;};'use strict';var multer=require(_0xa1e7('0x0'));var util=require(_0xa1e7('0x1'));var path=require(_0xa1e7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa1e7('0x3')]();var fs_extra=require(_0xa1e7('0x4'));var auth=require(_0xa1e7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa1e7('0x6'));router['get']('/',auth[_0xa1e7('0x7')](),controller[_0xa1e7('0x8')]);router[_0xa1e7('0x9')](_0xa1e7('0xa'),auth[_0xa1e7('0x7')](),controller[_0xa1e7('0xb')]);router[_0xa1e7('0xc')]('/',auth[_0xa1e7('0x7')](),controller[_0xa1e7('0xd')]);router[_0xa1e7('0xe')](_0xa1e7('0xa'),auth[_0xa1e7('0x7')](),controller[_0xa1e7('0xf')]);router[_0xa1e7('0x10')]('/:id',auth[_0xa1e7('0x7')](),controller[_0xa1e7('0x11')]);module[_0xa1e7('0x12')]=router; \ No newline at end of file +var _0x985d=['destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x985d,0x10b));var _0xd985=function(_0x3b6a8b,_0x536a77){_0x3b6a8b=_0x3b6a8b-0x0;var _0x162812=_0x985d[_0x3b6a8b];return _0x162812;};'use strict';var multer=require(_0xd985('0x0'));var util=require(_0xd985('0x1'));var path=require(_0xd985('0x2'));var timeout=require(_0xd985('0x3'));var express=require(_0xd985('0x4'));var router=express[_0xd985('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd985('0x6'));var config=require(_0xd985('0x7'));var controller=require(_0xd985('0x8'));router[_0xd985('0x9')]('/',auth[_0xd985('0xa')](),controller[_0xd985('0xb')]);router[_0xd985('0x9')](_0xd985('0xc'),auth['isAuthenticated'](),controller[_0xd985('0xd')]);router[_0xd985('0xe')]('/',auth[_0xd985('0xa')](),controller[_0xd985('0xf')]);router[_0xd985('0x10')](_0xd985('0xc'),auth[_0xd985('0xa')](),controller['update']);router[_0xd985('0x11')]('/:id',auth[_0xd985('0xa')](),controller[_0xd985('0x12')]);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 81f1888..3549580 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 _0xd47d=['picklist','STRING','ENUM','exports','string','customVariable','keyValue'];(function(_0x4eaf72,_0x306e55){var _0x595136=function(_0x72a57b){while(--_0x72a57b){_0x4eaf72['push'](_0x4eaf72['shift']());}};_0x595136(++_0x306e55);}(_0xd47d,0x1c3));var _0xdd47=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xd47d[_0x2b5eae];return _0x5f3ac9;};'use strict';var Sequelize=require('sequelize');module[_0xdd47('0x0')]={'type':{'type':Sequelize['ENUM'](_0xdd47('0x1'),'variable',_0xdd47('0x2'),_0xdd47('0x3'),_0xdd47('0x4')),'defaultValue':_0xdd47('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdd47('0x5')]},'keyType':{'type':Sequelize[_0xdd47('0x6')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xdd47('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdd47('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdd47('0x5')]}}; \ No newline at end of file +var _0x3c68=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0x3c68,0x18a));var _0x83c6=function(_0x1e3093,_0x50ef27){_0x1e3093=_0x1e3093-0x0;var _0x3cae14=_0x3c68[_0x1e3093];return _0x3cae14;};'use strict';var Sequelize=require(_0x83c6('0x0'));module[_0x83c6('0x1')]={'type':{'type':Sequelize[_0x83c6('0x2')](_0x83c6('0x3'),_0x83c6('0x4'),_0x83c6('0x5'),_0x83c6('0x6'),_0x83c6('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x83c6('0x8')]},'key':{'type':Sequelize[_0x83c6('0x8')]},'keyType':{'type':Sequelize[_0x83c6('0x2')](_0x83c6('0x3'),_0x83c6('0x4'),_0x83c6('0x5'))},'keyContent':{'type':Sequelize[_0x83c6('0x8')]},'idField':{'type':Sequelize[_0x83c6('0x8')]},'nameField':{'type':Sequelize[_0x83c6('0x8')]},'customField':{'type':Sequelize[_0x83c6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x83c6('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index c6a8b79..a45c8f8 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 _0x2de2=['json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','ServicenowField','includeAll','include','findAll','catch','create','body','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x2de2,0x1ea));var _0x22de=function(_0x24fadb,_0x44f4a5){_0x24fadb=_0x24fadb-0x0;var _0x20c332=_0x2de2[_0x24fadb];return _0x20c332;};'use strict';var emlformat=require(_0x22de('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x22de('0x1'));var rp=require(_0x22de('0x2'));var moment=require(_0x22de('0x3'));var BPromise=require(_0x22de('0x4'));var Mustache=require(_0x22de('0x5'));var util=require('util');var path=require(_0x22de('0x6'));var sox=require('sox');var csv=require(_0x22de('0x7'));var ejs=require(_0x22de('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x22de('0x9'));var squel=require(_0x22de('0xa'));var crypto=require(_0x22de('0xb'));var jsforce=require(_0x22de('0xc'));var deskjs=require(_0x22de('0xd'));var toCsv=require(_0x22de('0x7'));var querystring=require(_0x22de('0xe'));var Papa=require('papaparse');var Redis=require(_0x22de('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x22de('0x10'));var as=require(_0x22de('0x11'));var hardwareService=require(_0x22de('0x12'));var logger=require(_0x22de('0x13'))(_0x22de('0x14'));var utils=require(_0x22de('0x15'));var config=require(_0x22de('0x16'));var licenseUtil=require(_0x22de('0x17'));var db=require(_0x22de('0x18'))['db'];function respondWithStatusCode(_0x209f15,_0x2135c1){_0x2135c1=_0x2135c1||0xcc;return function(_0x349a88){if(_0x349a88){return _0x209f15[_0x22de('0x19')](_0x2135c1);}return _0x209f15['status'](_0x2135c1)[_0x22de('0x1a')]();};}function respondWithResult(_0x40dfb6,_0x37060c){_0x37060c=_0x37060c||0xc8;return function(_0x40f8a7){if(_0x40f8a7){return _0x40dfb6[_0x22de('0x1b')](_0x37060c)[_0x22de('0x1c')](_0x40f8a7);}};}function respondWithFilteredResult(_0x2eaff3,_0x4dd5b2){return function(_0x3e7580){if(_0x3e7580){var _0x33a01d=typeof _0x4dd5b2[_0x22de('0x1d')]===_0x22de('0x1e')&&typeof _0x4dd5b2[_0x22de('0x1f')]===_0x22de('0x1e');var _0x21f0d5=_0x3e7580['count'];var _0x2e7ec7=_0x33a01d?0x0:_0x4dd5b2[_0x22de('0x1d')];var _0x1b82f9=_0x33a01d?_0x3e7580[_0x22de('0x20')]:_0x4dd5b2[_0x22de('0x1d')]+_0x4dd5b2[_0x22de('0x1f')];var _0x2392cd;if(_0x1b82f9>=_0x21f0d5){_0x1b82f9=_0x21f0d5;_0x2392cd=0xc8;}else{_0x2392cd=0xce;}_0x2eaff3[_0x22de('0x1b')](_0x2392cd);return _0x2eaff3[_0x22de('0x21')](_0x22de('0x22'),_0x2e7ec7+'-'+_0x1b82f9+'/'+_0x21f0d5)[_0x22de('0x1c')](_0x3e7580);}return null;};}function patchUpdates(_0x25c46f){return function(_0x29397a){try{jsonpatch['apply'](_0x29397a,_0x25c46f,!![]);}catch(_0x493897){return BPromise[_0x22de('0x23')](_0x493897);}return _0x29397a[_0x22de('0x24')]();};}function saveUpdates(_0x18fb6f,_0x196acd){return function(_0x40d6a5){if(_0x40d6a5){return _0x40d6a5[_0x22de('0x25')](_0x18fb6f)[_0x22de('0x26')](function(_0x531403){return _0x531403;});}return null;};}function removeEntity(_0x4303ce,_0x5aaff8){return function(_0xf656a5){if(_0xf656a5){return _0xf656a5[_0x22de('0x27')]()[_0x22de('0x26')](function(){_0x4303ce['status'](0xcc)[_0x22de('0x1a')]();});}};}function handleEntityNotFound(_0x444e1a,_0x5973c4){return function(_0x340343){if(!_0x340343){_0x444e1a['sendStatus'](0x194);}return _0x340343;};}function handleError(_0x14d068,_0x9e2d2c){_0x9e2d2c=_0x9e2d2c||0x1f4;return function(_0x55f551){logger[_0x22de('0x28')](_0x55f551[_0x22de('0x29')]);if(_0x55f551[_0x22de('0x2a')]){delete _0x55f551[_0x22de('0x2a')];}_0x14d068[_0x22de('0x1b')](_0x9e2d2c)[_0x22de('0x2b')](_0x55f551);};}exports['index']=function(_0xa78361,_0x4c1d5b){var _0x346ee2={},_0x26670c={},_0x4e220b={'count':0x0,'rows':[]};var _0x1676fa=_[_0x22de('0x2c')](db['ServicenowField'][_0x22de('0x2d')],function(_0x2da20e){return{'name':_0x2da20e[_0x22de('0x2e')],'type':_0x2da20e[_0x22de('0x2f')][_0x22de('0x30')]};});_0x26670c[_0x22de('0x31')]=_[_0x22de('0x2c')](_0x1676fa,'name');_0x26670c[_0x22de('0x32')]=_[_0x22de('0x33')](_0xa78361[_0x22de('0x32')]);_0x26670c[_0x22de('0x34')]=_[_0x22de('0x35')](_0x26670c[_0x22de('0x31')],_0x26670c[_0x22de('0x32')]);_0x346ee2[_0x22de('0x36')]=_['intersection'](_0x26670c[_0x22de('0x31')],qs[_0x22de('0x37')](_0xa78361[_0x22de('0x32')][_0x22de('0x37')]));_0x346ee2[_0x22de('0x36')]=_0x346ee2[_0x22de('0x36')][_0x22de('0x38')]?_0x346ee2['attributes']:_0x26670c[_0x22de('0x31')];if(!_0xa78361[_0x22de('0x32')][_0x22de('0x39')](_0x22de('0x3a'))){_0x346ee2['limit']=qs[_0x22de('0x1f')](_0xa78361[_0x22de('0x32')][_0x22de('0x1f')]);_0x346ee2['offset']=qs['offset'](_0xa78361[_0x22de('0x32')]['offset']);}_0x346ee2[_0x22de('0x3b')]=qs[_0x22de('0x3c')](_0xa78361[_0x22de('0x32')]['sort']);_0x346ee2['where']=qs['filters'](_[_0x22de('0x3d')](_0xa78361['query'],_0x26670c[_0x22de('0x34')]),_0x1676fa);if(_0xa78361[_0x22de('0x32')][_0x22de('0x3e')]){_0x346ee2[_0x22de('0x3f')]=_[_0x22de('0x40')](_0x346ee2[_0x22de('0x3f')],{'$or':_[_0x22de('0x2c')](_0x1676fa,function(_0x4debd1){if(_0x4debd1['type']!=='VIRTUAL'){var _0x312667={};_0x312667[_0x4debd1[_0x22de('0x2a')]]={'$like':'%'+_0xa78361[_0x22de('0x32')][_0x22de('0x3e')]+'%'};return _0x312667;}})});}_0x346ee2=_[_0x22de('0x40')]({},_0x346ee2,_0xa78361[_0x22de('0x41')]);var _0x17f9f3={'where':_0x346ee2['where']};return db[_0x22de('0x42')][_0x22de('0x20')](_0x17f9f3)[_0x22de('0x26')](function(_0x4fdfd9){_0x4e220b[_0x22de('0x20')]=_0x4fdfd9;if(_0xa78361['query'][_0x22de('0x43')]){_0x346ee2[_0x22de('0x44')]=[{'all':!![]}];}return db[_0x22de('0x42')][_0x22de('0x45')](_0x346ee2);})[_0x22de('0x26')](function(_0x32034a){_0x4e220b['rows']=_0x32034a;return _0x4e220b;})[_0x22de('0x26')](respondWithFilteredResult(_0x4c1d5b,_0x346ee2))[_0x22de('0x46')](handleError(_0x4c1d5b,null));};exports['show']=function(_0x18aa3d,_0x711631){var _0x1556d7={'raw':!![],'where':{'id':_0x18aa3d['params']['id']}},_0x500f58={};_0x500f58[_0x22de('0x31')]=_['keys'](db[_0x22de('0x42')][_0x22de('0x2d')]);_0x500f58[_0x22de('0x32')]=_[_0x22de('0x33')](_0x18aa3d[_0x22de('0x32')]);_0x500f58['filters']=_['intersection'](_0x500f58[_0x22de('0x31')],_0x500f58[_0x22de('0x32')]);_0x1556d7[_0x22de('0x36')]=_[_0x22de('0x35')](_0x500f58[_0x22de('0x31')],qs[_0x22de('0x37')](_0x18aa3d[_0x22de('0x32')]['fields']));_0x1556d7['attributes']=_0x1556d7[_0x22de('0x36')]['length']?_0x1556d7[_0x22de('0x36')]:_0x500f58[_0x22de('0x31')];if(_0x18aa3d[_0x22de('0x32')][_0x22de('0x43')]){_0x1556d7[_0x22de('0x44')]=[{'all':!![]}];}_0x1556d7=_['merge']({},_0x1556d7,_0x18aa3d['options']);return db['ServicenowField']['find'](_0x1556d7)[_0x22de('0x26')](handleEntityNotFound(_0x711631,null))[_0x22de('0x26')](respondWithResult(_0x711631,null))[_0x22de('0x46')](handleError(_0x711631,null));};exports[_0x22de('0x47')]=function(_0x4b9f56,_0x58e3e4){return db[_0x22de('0x42')][_0x22de('0x47')](_0x4b9f56['body'],{})[_0x22de('0x26')](respondWithResult(_0x58e3e4,0xc9))['catch'](handleError(_0x58e3e4,null));};exports[_0x22de('0x25')]=function(_0x5e279a,_0x176a75){if(_0x5e279a[_0x22de('0x48')]['id']){delete _0x5e279a[_0x22de('0x48')]['id'];}return db['ServicenowField'][_0x22de('0x49')]({'where':{'id':_0x5e279a['params']['id']}})[_0x22de('0x26')](handleEntityNotFound(_0x176a75,null))['then'](saveUpdates(_0x5e279a[_0x22de('0x48')],null))['then'](respondWithResult(_0x176a75,null))['catch'](handleError(_0x176a75,null));};exports[_0x22de('0x27')]=function(_0x485bfd,_0x5ec97b){return db[_0x22de('0x42')]['find']({'where':{'id':_0x485bfd['params']['id']}})[_0x22de('0x26')](handleEntityNotFound(_0x5ec97b,null))[_0x22de('0x26')](removeEntity(_0x5ec97b,null))[_0x22de('0x46')](handleError(_0x5ec97b,null));}; \ No newline at end of file +var _0xf918=['end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ServicenowField','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','where','filter','VIRTUAL','merge','options','include','rows','catch','show','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x4ce260,_0x314f48){var _0x2d56ce=function(_0x8016b){while(--_0x8016b){_0x4ce260['push'](_0x4ce260['shift']());}};_0x2d56ce(++_0x314f48);}(_0xf918,0x78));var _0x8f91=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0xf918[_0x4fbb15];return _0x436338;};'use strict';var emlformat=require(_0x8f91('0x0'));var rimraf=require(_0x8f91('0x1'));var zipdir=require(_0x8f91('0x2'));var jsonpatch=require(_0x8f91('0x3'));var rp=require(_0x8f91('0x4'));var moment=require(_0x8f91('0x5'));var BPromise=require(_0x8f91('0x6'));var Mustache=require(_0x8f91('0x7'));var util=require(_0x8f91('0x8'));var path=require(_0x8f91('0x9'));var sox=require(_0x8f91('0xa'));var csv=require(_0x8f91('0xb'));var ejs=require(_0x8f91('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f91('0xd'));var squel=require(_0x8f91('0xe'));var crypto=require('crypto');var jsforce=require(_0x8f91('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8f91('0xb'));var querystring=require(_0x8f91('0x10'));var Papa=require(_0x8f91('0x11'));var Redis=require(_0x8f91('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8f91('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8f91('0x14'));var utils=require(_0x8f91('0x15'));var config=require(_0x8f91('0x16'));var licenseUtil=require(_0x8f91('0x17'));var db=require(_0x8f91('0x18'))['db'];function respondWithStatusCode(_0xc33d0d,_0x45669a){_0x45669a=_0x45669a||0xcc;return function(_0x62233b){if(_0x62233b){return _0xc33d0d['sendStatus'](_0x45669a);}return _0xc33d0d[_0x8f91('0x19')](_0x45669a)[_0x8f91('0x1a')]();};}function respondWithResult(_0x3a3700,_0x38ee0c){_0x38ee0c=_0x38ee0c||0xc8;return function(_0x2f76dd){if(_0x2f76dd){return _0x3a3700[_0x8f91('0x19')](_0x38ee0c)[_0x8f91('0x1b')](_0x2f76dd);}};}function respondWithFilteredResult(_0x6f0ac7,_0x333ed9){return function(_0x3c5177){if(_0x3c5177){var _0x5d97ce=typeof _0x333ed9['offset']===_0x8f91('0x1c')&&typeof _0x333ed9[_0x8f91('0x1d')]===_0x8f91('0x1c');var _0x339971=_0x3c5177[_0x8f91('0x1e')];var _0x3f0c82=_0x5d97ce?0x0:_0x333ed9[_0x8f91('0x1f')];var _0x3d634a=_0x5d97ce?_0x3c5177[_0x8f91('0x1e')]:_0x333ed9[_0x8f91('0x1f')]+_0x333ed9[_0x8f91('0x1d')];var _0x201bb8;if(_0x3d634a>=_0x339971){_0x3d634a=_0x339971;_0x201bb8=0xc8;}else{_0x201bb8=0xce;}_0x6f0ac7[_0x8f91('0x19')](_0x201bb8);return _0x6f0ac7[_0x8f91('0x20')]('Content-Range',_0x3f0c82+'-'+_0x3d634a+'/'+_0x339971)['json'](_0x3c5177);}return null;};}function patchUpdates(_0x1989bf){return function(_0x34ae94){try{jsonpatch[_0x8f91('0x21')](_0x34ae94,_0x1989bf,!![]);}catch(_0x10ac6f){return BPromise[_0x8f91('0x22')](_0x10ac6f);}return _0x34ae94[_0x8f91('0x23')]();};}function saveUpdates(_0x3fb71d,_0x5206d4){return function(_0x34fd92){if(_0x34fd92){return _0x34fd92[_0x8f91('0x24')](_0x3fb71d)[_0x8f91('0x25')](function(_0x52220a){return _0x52220a;});}return null;};}function removeEntity(_0x26eded,_0x4a888e){return function(_0x3e2de2){if(_0x3e2de2){return _0x3e2de2[_0x8f91('0x26')]()[_0x8f91('0x25')](function(){_0x26eded[_0x8f91('0x19')](0xcc)[_0x8f91('0x1a')]();});}};}function handleEntityNotFound(_0x25fb35,_0x95d204){return function(_0x557a63){if(!_0x557a63){_0x25fb35[_0x8f91('0x27')](0x194);}return _0x557a63;};}function handleError(_0x3cac5a,_0x4bbd21){_0x4bbd21=_0x4bbd21||0x1f4;return function(_0x57517c){logger[_0x8f91('0x28')](_0x57517c[_0x8f91('0x29')]);if(_0x57517c[_0x8f91('0x2a')]){delete _0x57517c['name'];}_0x3cac5a[_0x8f91('0x19')](_0x4bbd21)[_0x8f91('0x2b')](_0x57517c);};}exports[_0x8f91('0x2c')]=function(_0x281fa4,_0x33ce8e){var _0x383734={},_0x41ca9f={},_0x59087d={'count':0x0,'rows':[]};var _0x287839=_[_0x8f91('0x2d')](db[_0x8f91('0x2e')][_0x8f91('0x2f')],function(_0x46edcc){return{'name':_0x46edcc['fieldName'],'type':_0x46edcc[_0x8f91('0x30')]['key']};});_0x41ca9f['model']=_[_0x8f91('0x2d')](_0x287839,_0x8f91('0x2a'));_0x41ca9f[_0x8f91('0x31')]=_[_0x8f91('0x32')](_0x281fa4[_0x8f91('0x31')]);_0x41ca9f[_0x8f91('0x33')]=_[_0x8f91('0x34')](_0x41ca9f[_0x8f91('0x35')],_0x41ca9f[_0x8f91('0x31')]);_0x383734['attributes']=_[_0x8f91('0x34')](_0x41ca9f['model'],qs[_0x8f91('0x36')](_0x281fa4['query'][_0x8f91('0x36')]));_0x383734[_0x8f91('0x37')]=_0x383734[_0x8f91('0x37')][_0x8f91('0x38')]?_0x383734[_0x8f91('0x37')]:_0x41ca9f[_0x8f91('0x35')];if(!_0x281fa4[_0x8f91('0x31')]['hasOwnProperty'](_0x8f91('0x39'))){_0x383734[_0x8f91('0x1d')]=qs[_0x8f91('0x1d')](_0x281fa4[_0x8f91('0x31')][_0x8f91('0x1d')]);_0x383734[_0x8f91('0x1f')]=qs[_0x8f91('0x1f')](_0x281fa4[_0x8f91('0x31')][_0x8f91('0x1f')]);}_0x383734[_0x8f91('0x3a')]=qs['sort'](_0x281fa4[_0x8f91('0x31')]['sort']);_0x383734[_0x8f91('0x3b')]=qs[_0x8f91('0x33')](_['pick'](_0x281fa4[_0x8f91('0x31')],_0x41ca9f['filters']),_0x287839);if(_0x281fa4[_0x8f91('0x31')][_0x8f91('0x3c')]){_0x383734[_0x8f91('0x3b')]=_['merge'](_0x383734['where'],{'$or':_[_0x8f91('0x2d')](_0x287839,function(_0x5b15be){if(_0x5b15be['type']!==_0x8f91('0x3d')){var _0x4eca2c={};_0x4eca2c[_0x5b15be['name']]={'$like':'%'+_0x281fa4[_0x8f91('0x31')][_0x8f91('0x3c')]+'%'};return _0x4eca2c;}})});}_0x383734=_[_0x8f91('0x3e')]({},_0x383734,_0x281fa4[_0x8f91('0x3f')]);var _0x29e916={'where':_0x383734[_0x8f91('0x3b')]};return db[_0x8f91('0x2e')][_0x8f91('0x1e')](_0x29e916)[_0x8f91('0x25')](function(_0x32f19b){_0x59087d[_0x8f91('0x1e')]=_0x32f19b;if(_0x281fa4[_0x8f91('0x31')]['includeAll']){_0x383734[_0x8f91('0x40')]=[{'all':!![]}];}return db[_0x8f91('0x2e')]['findAll'](_0x383734);})[_0x8f91('0x25')](function(_0x11163c){_0x59087d[_0x8f91('0x41')]=_0x11163c;return _0x59087d;})['then'](respondWithFilteredResult(_0x33ce8e,_0x383734))[_0x8f91('0x42')](handleError(_0x33ce8e,null));};exports[_0x8f91('0x43')]=function(_0x3b04d9,_0x960617){var _0x4cc5eb={'raw':!![],'where':{'id':_0x3b04d9[_0x8f91('0x44')]['id']}},_0x137ff2={};_0x137ff2['model']=_[_0x8f91('0x32')](db[_0x8f91('0x2e')][_0x8f91('0x2f')]);_0x137ff2['query']=_[_0x8f91('0x32')](_0x3b04d9[_0x8f91('0x31')]);_0x137ff2[_0x8f91('0x33')]=_[_0x8f91('0x34')](_0x137ff2[_0x8f91('0x35')],_0x137ff2[_0x8f91('0x31')]);_0x4cc5eb['attributes']=_[_0x8f91('0x34')](_0x137ff2[_0x8f91('0x35')],qs[_0x8f91('0x36')](_0x3b04d9[_0x8f91('0x31')]['fields']));_0x4cc5eb[_0x8f91('0x37')]=_0x4cc5eb[_0x8f91('0x37')][_0x8f91('0x38')]?_0x4cc5eb[_0x8f91('0x37')]:_0x137ff2[_0x8f91('0x35')];if(_0x3b04d9[_0x8f91('0x31')][_0x8f91('0x45')]){_0x4cc5eb[_0x8f91('0x40')]=[{'all':!![]}];}_0x4cc5eb=_[_0x8f91('0x3e')]({},_0x4cc5eb,_0x3b04d9[_0x8f91('0x3f')]);return db[_0x8f91('0x2e')]['find'](_0x4cc5eb)[_0x8f91('0x25')](handleEntityNotFound(_0x960617,null))[_0x8f91('0x25')](respondWithResult(_0x960617,null))[_0x8f91('0x42')](handleError(_0x960617,null));};exports['create']=function(_0x166a66,_0x1da880){return db[_0x8f91('0x2e')][_0x8f91('0x46')](_0x166a66['body'],{})[_0x8f91('0x25')](respondWithResult(_0x1da880,0xc9))[_0x8f91('0x42')](handleError(_0x1da880,null));};exports['update']=function(_0x3b8fd2,_0x173a8c){if(_0x3b8fd2[_0x8f91('0x47')]['id']){delete _0x3b8fd2[_0x8f91('0x47')]['id'];}return db[_0x8f91('0x2e')]['find']({'where':{'id':_0x3b8fd2[_0x8f91('0x44')]['id']}})['then'](handleEntityNotFound(_0x173a8c,null))[_0x8f91('0x25')](saveUpdates(_0x3b8fd2[_0x8f91('0x47')],null))['then'](respondWithResult(_0x173a8c,null))['catch'](handleError(_0x173a8c,null));};exports[_0x8f91('0x26')]=function(_0x1dbb23,_0x570098){return db[_0x8f91('0x2e')][_0x8f91('0x48')]({'where':{'id':_0x1dbb23[_0x8f91('0x44')]['id']}})[_0x8f91('0x25')](handleEntityNotFound(_0x570098,null))[_0x8f91('0x25')](removeEntity(_0x570098,null))['catch'](handleError(_0x570098,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 34a41a1..bd91595 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 _0x6aaa=['request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5ed09b,_0x450339){var _0x5b0d7e=function(_0xa57214){while(--_0xa57214){_0x5ed09b['push'](_0x5ed09b['shift']());}};_0x5b0d7e(++_0x450339);}(_0x6aaa,0x95));var _0xa6aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aaa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa6aa('0x0'));var util=require('util');var logger=require(_0xa6aa('0x1'))(_0xa6aa('0x2'));var moment=require(_0xa6aa('0x3'));var BPromise=require(_0xa6aa('0x4'));var rp=require(_0xa6aa('0x5'));var fs=require('fs');var path=require(_0xa6aa('0x6'));var rimraf=require(_0xa6aa('0x7'));var config=require(_0xa6aa('0x8'));var attributes=require(_0xa6aa('0x9'));module['exports']=function(_0xe9a812,_0x567e71){return _0xe9a812['define'](_0xa6aa('0xa'),attributes,{'tableName':_0xa6aa('0xb'),'paranoid':![],'indexes':[{'name':_0xa6aa('0xc'),'fields':[_0xa6aa('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xea49=['../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x34a8bd,_0x425a25){var _0x5533f4=function(_0x4a12c9){while(--_0x4a12c9){_0x34a8bd['push'](_0x34a8bd['shift']());}};_0x5533f4(++_0x425a25);}(_0xea49,0x1d6));var _0x9ea4=function(_0x3382f4,_0x32b70b){_0x3382f4=_0x3382f4-0x0;var _0x3a3368=_0xea49[_0x3382f4];return _0x3a3368;};'use strict';var _=require(_0x9ea4('0x0'));var util=require(_0x9ea4('0x1'));var logger=require(_0x9ea4('0x2'))(_0x9ea4('0x3'));var moment=require('moment');var BPromise=require(_0x9ea4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ea4('0x5'));var rimraf=require('rimraf');var config=require(_0x9ea4('0x6'));var attributes=require(_0x9ea4('0x7'));module[_0x9ea4('0x8')]=function(_0x12a861,_0x5b901e){return _0x12a861['define'](_0x9ea4('0x9'),attributes,{'tableName':_0x9ea4('0xa'),'paranoid':![],'indexes':[{'name':_0x9ea4('0xb'),'fields':[_0x9ea4('0xc'),_0x9ea4('0xd')],'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 3e6d9a6..f24459c 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 _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2e8c25,_0x3cb7bf){var _0x7b2bb8=function(_0x4dbe7c){while(--_0x4dbe7c){_0x2e8c25['push'](_0x2e8c25['shift']());}};_0x7b2bb8(++_0x3cb7bf);}(_0x70e0,0x17b));var _0x070e=function(_0x41f0a8,_0x353ac9){_0x41f0a8=_0x41f0a8-0x0;var _0x2ba36e=_0x70e0[_0x41f0a8];return _0x2ba36e;};'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')]('ServicenowField,\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')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\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 _0xac4a=['ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xac4a,0x13f));var _0xaac4=function(_0x345d3f,_0x2874ba){_0x345d3f=_0x345d3f-0x0;var _0x585aed=_0xac4a[_0x345d3f];return _0x585aed;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 49f767f..b08f023 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1d7265,_0x3c4c51){var _0x22ef7f=function(_0x5bfad8){while(--_0x5bfad8){_0x1d7265['push'](_0x1d7265['shift']());}};_0x22ef7f(++_0x3c4c51);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x5f0b70,_0x5c2c38){var _0x23809e=function(_0x4e7d2b){while(--_0x4e7d2b){_0x5f0b70['push'](_0x5f0b70['shift']());}};_0x23809e(++_0x5c2c38);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 63ba32e..11dd8fb 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(_0x3c5426,_0x36dc83){var _0x356e36=function(_0x1e874c){while(--_0x1e874c){_0x3c5426['push'](_0x3c5426['shift']());}};_0x356e36(++_0x36dc83);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x2d21af,_0x447810){var _0xc2612b=function(_0x4c8c09){while(--_0x4c8c09){_0x2d21af['push'](_0x2d21af['shift']());}};_0xc2612b(++_0x447810);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 22b9a9b..9954bb8 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 _0x0e2b=['include','findAll','catch','show','merge','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','rawAttributes','addConfiguration','Descriptions','getDescriptions','SugarcrmField','Subjects','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','values','module_fields','remove','includes','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','index','SugarcrmAccount','fieldName','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','options','includeAll'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x0e2b,0x122));var _0xb0e2=function(_0x11ede2,_0x47c7b0){_0x11ede2=_0x11ede2-0x0;var _0x3d937b=_0x0e2b[_0x11ede2];return _0x3d937b;};'use strict';var emlformat=require(_0xb0e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb0e2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0e2('0x2'));var moment=require(_0xb0e2('0x3'));var BPromise=require(_0xb0e2('0x4'));var Mustache=require(_0xb0e2('0x5'));var util=require('util');var path=require(_0xb0e2('0x6'));var sox=require('sox');var csv=require(_0xb0e2('0x7'));var ejs=require(_0xb0e2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb0e2('0x9'));var crypto=require(_0xb0e2('0xa'));var jsforce=require(_0xb0e2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb0e2('0x7'));var querystring=require(_0xb0e2('0xc'));var Papa=require(_0xb0e2('0xd'));var Redis=require('ioredis');var authService=require(_0xb0e2('0xe'));var qs=require(_0xb0e2('0xf'));var as=require(_0xb0e2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb0e2('0x11'));var utils=require(_0xb0e2('0x12'));var config=require(_0xb0e2('0x13'));var licenseUtil=require(_0xb0e2('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb0e2('0x15'));function respondWithStatusCode(_0x1b5a00,_0x18d96c){_0x18d96c=_0x18d96c||0xcc;return function(_0x8809d2){if(_0x8809d2){return _0x1b5a00[_0xb0e2('0x16')](_0x18d96c);}return _0x1b5a00[_0xb0e2('0x17')](_0x18d96c)['end']();};}function respondWithResult(_0x2ff7f9,_0x31289e){_0x31289e=_0x31289e||0xc8;return function(_0xba180f){if(_0xba180f){return _0x2ff7f9[_0xb0e2('0x17')](_0x31289e)[_0xb0e2('0x18')](_0xba180f);}};}function respondWithFilteredResult(_0x3a31f0,_0x16b7d6){return function(_0x3e0244){if(_0x3e0244){var _0x229426=typeof _0x16b7d6[_0xb0e2('0x19')]===_0xb0e2('0x1a')&&typeof _0x16b7d6[_0xb0e2('0x1b')]===_0xb0e2('0x1a');var _0x53323f=_0x3e0244[_0xb0e2('0x1c')];var _0x38b3fa=_0x229426?0x0:_0x16b7d6[_0xb0e2('0x19')];var _0x4e2406=_0x229426?_0x3e0244['count']:_0x16b7d6[_0xb0e2('0x19')]+_0x16b7d6[_0xb0e2('0x1b')];var _0x35547d;if(_0x4e2406>=_0x53323f){_0x4e2406=_0x53323f;_0x35547d=0xc8;}else{_0x35547d=0xce;}_0x3a31f0[_0xb0e2('0x17')](_0x35547d);return _0x3a31f0[_0xb0e2('0x1d')](_0xb0e2('0x1e'),_0x38b3fa+'-'+_0x4e2406+'/'+_0x53323f)['json'](_0x3e0244);}return null;};}function patchUpdates(_0x5240a2){return function(_0x48129d){try{jsonpatch['apply'](_0x48129d,_0x5240a2,!![]);}catch(_0x2d2101){return BPromise[_0xb0e2('0x1f')](_0x2d2101);}return _0x48129d['save']();};}function saveUpdates(_0x53581f,_0x2b1b7c){return function(_0x5aab81){if(_0x5aab81){return _0x5aab81[_0xb0e2('0x20')](_0x53581f)[_0xb0e2('0x21')](function(_0x46a2e3){return _0x46a2e3;});}return null;};}function removeEntity(_0x2f34ba,_0x3ea606){return function(_0xd75a78){if(_0xd75a78){return _0xd75a78[_0xb0e2('0x22')]()[_0xb0e2('0x21')](function(){_0x2f34ba[_0xb0e2('0x17')](0xcc)[_0xb0e2('0x23')]();});}};}function handleEntityNotFound(_0x3c92b4,_0x30a99e){return function(_0x203f43){if(!_0x203f43){_0x3c92b4[_0xb0e2('0x16')](0x194);}return _0x203f43;};}function handleError(_0x35b7dc,_0x24911f){_0x24911f=_0x24911f||0x1f4;return function(_0x172d6d){logger[_0xb0e2('0x24')](_0x172d6d[_0xb0e2('0x25')]);if(_0x172d6d[_0xb0e2('0x26')]){delete _0x172d6d[_0xb0e2('0x26')];}_0x35b7dc[_0xb0e2('0x17')](_0x24911f)['send'](_0x172d6d);};}exports[_0xb0e2('0x27')]=function(_0xaece48,_0x26c5ab){var _0x2895a4={},_0x3b1253={},_0x36dd47={'count':0x0,'rows':[]};var _0x22f2f2=_['map'](db[_0xb0e2('0x28')]['rawAttributes'],function(_0x681f37){return{'name':_0x681f37[_0xb0e2('0x29')],'type':_0x681f37['type']['key']};});_0x3b1253['model']=_[_0xb0e2('0x2a')](_0x22f2f2,_0xb0e2('0x26'));_0x3b1253[_0xb0e2('0x2b')]=_[_0xb0e2('0x2c')](_0xaece48[_0xb0e2('0x2b')]);_0x3b1253[_0xb0e2('0x2d')]=_['intersection'](_0x3b1253[_0xb0e2('0x2e')],_0x3b1253[_0xb0e2('0x2b')]);_0x2895a4[_0xb0e2('0x2f')]=_[_0xb0e2('0x30')](_0x3b1253[_0xb0e2('0x2e')],qs[_0xb0e2('0x31')](_0xaece48[_0xb0e2('0x2b')]['fields']));_0x2895a4[_0xb0e2('0x2f')]=_0x2895a4[_0xb0e2('0x2f')][_0xb0e2('0x32')]?_0x2895a4[_0xb0e2('0x2f')]:_0x3b1253['model'];if(!_0xaece48[_0xb0e2('0x2b')][_0xb0e2('0x33')](_0xb0e2('0x34'))){_0x2895a4[_0xb0e2('0x1b')]=qs[_0xb0e2('0x1b')](_0xaece48[_0xb0e2('0x2b')][_0xb0e2('0x1b')]);_0x2895a4['offset']=qs['offset'](_0xaece48[_0xb0e2('0x2b')]['offset']);}_0x2895a4[_0xb0e2('0x35')]=qs['sort'](_0xaece48['query'][_0xb0e2('0x36')]);_0x2895a4[_0xb0e2('0x37')]=qs[_0xb0e2('0x2d')](_[_0xb0e2('0x38')](_0xaece48[_0xb0e2('0x2b')],_0x3b1253[_0xb0e2('0x2d')]),_0x22f2f2);if(_0xaece48[_0xb0e2('0x2b')][_0xb0e2('0x39')]){_0x2895a4['where']=_['merge'](_0x2895a4[_0xb0e2('0x37')],{'$or':_[_0xb0e2('0x2a')](_0x22f2f2,function(_0x348edc){if(_0x348edc[_0xb0e2('0x3a')]!=='VIRTUAL'){var _0x5acaef={};_0x5acaef[_0x348edc[_0xb0e2('0x26')]]={'$like':'%'+_0xaece48['query'][_0xb0e2('0x39')]+'%'};return _0x5acaef;}})});}_0x2895a4=_['merge']({},_0x2895a4,_0xaece48[_0xb0e2('0x3b')]);var _0x1b2952={'where':_0x2895a4[_0xb0e2('0x37')]};return db['SugarcrmAccount'][_0xb0e2('0x1c')](_0x1b2952)[_0xb0e2('0x21')](function(_0x2dd6b3){_0x36dd47[_0xb0e2('0x1c')]=_0x2dd6b3;if(_0xaece48[_0xb0e2('0x2b')][_0xb0e2('0x3c')]){_0x2895a4[_0xb0e2('0x3d')]=[{'all':!![]}];}return db[_0xb0e2('0x28')][_0xb0e2('0x3e')](_0x2895a4);})[_0xb0e2('0x21')](function(_0x34dfdf){_0x36dd47['rows']=_0x34dfdf;return _0x36dd47;})['then'](respondWithFilteredResult(_0x26c5ab,_0x2895a4))[_0xb0e2('0x3f')](handleError(_0x26c5ab,null));};exports[_0xb0e2('0x40')]=function(_0x4de242,_0x2c5788){var _0x505aa3={'raw':![],'where':{'id':_0x4de242['params']['id']}},_0x5003f3={};_0x5003f3['model']=_[_0xb0e2('0x2c')](db['SugarcrmAccount']['rawAttributes']);_0x5003f3['query']=_['keys'](_0x4de242[_0xb0e2('0x2b')]);_0x5003f3[_0xb0e2('0x2d')]=_[_0xb0e2('0x30')](_0x5003f3[_0xb0e2('0x2e')],_0x5003f3[_0xb0e2('0x2b')]);_0x505aa3[_0xb0e2('0x2f')]=_['intersection'](_0x5003f3[_0xb0e2('0x2e')],qs[_0xb0e2('0x31')](_0x4de242['query']['fields']));_0x505aa3[_0xb0e2('0x2f')]=_0x505aa3[_0xb0e2('0x2f')]['length']?_0x505aa3[_0xb0e2('0x2f')]:_0x5003f3[_0xb0e2('0x2e')];if(_0x4de242[_0xb0e2('0x2b')]['includeAll']){_0x505aa3['include']=[{'all':!![]}];}_0x505aa3=_[_0xb0e2('0x41')]({},_0x505aa3,_0x4de242[_0xb0e2('0x3b')]);return db[_0xb0e2('0x28')][_0xb0e2('0x42')](_0x505aa3)[_0xb0e2('0x21')](handleEntityNotFound(_0x2c5788,null))[_0xb0e2('0x21')](respondWithResult(_0x2c5788,null))[_0xb0e2('0x3f')](handleError(_0x2c5788,null));};exports[_0xb0e2('0x43')]=function(_0x1c8f0c,_0x26b36a){return db[_0xb0e2('0x28')]['create'](_0x1c8f0c[_0xb0e2('0x44')],{})[_0xb0e2('0x21')](respondWithResult(_0x26b36a,0xc9))[_0xb0e2('0x3f')](handleError(_0x26b36a,null));};exports[_0xb0e2('0x20')]=function(_0x1603a9,_0x46aba7){if(_0x1603a9['body']['id']){delete _0x1603a9[_0xb0e2('0x44')]['id'];}return db[_0xb0e2('0x28')][_0xb0e2('0x42')]({'where':{'id':_0x1603a9[_0xb0e2('0x45')]['id']}})[_0xb0e2('0x21')](handleEntityNotFound(_0x46aba7,null))['then'](saveUpdates(_0x1603a9[_0xb0e2('0x44')],null))['then'](respondWithResult(_0x46aba7,null))[_0xb0e2('0x3f')](handleError(_0x46aba7,null));};exports['destroy']=function(_0x5ba9e0,_0x3daa0f){return db[_0xb0e2('0x28')][_0xb0e2('0x42')]({'where':{'id':_0x5ba9e0['params']['id']}})['then'](handleEntityNotFound(_0x3daa0f,null))['then'](removeEntity(_0x3daa0f,null))[_0xb0e2('0x3f')](handleError(_0x3daa0f,null));};exports[_0xb0e2('0x46')]=function(_0x3181de,_0x4e14d3,_0x40a9a3){var _0x509b4d={};var _0x11a95e={};var _0x4ad98a;var _0x4b4472;return db[_0xb0e2('0x28')][_0xb0e2('0x47')]({'where':{'id':_0x3181de['params']['id']}})['then'](handleEntityNotFound(_0x4e14d3,null))[_0xb0e2('0x21')](function(_0x37e49c){if(_0x37e49c){_0x4ad98a=_0x37e49c;_0x11a95e['model']=_[_0xb0e2('0x2c')](db[_0xb0e2('0x48')][_0xb0e2('0x49')]);_0x11a95e[_0xb0e2('0x2b')]=_[_0xb0e2('0x2c')](_0x3181de['query']);_0x11a95e[_0xb0e2('0x2d')]=_['intersection'](_0x11a95e[_0xb0e2('0x2e')],_0x11a95e[_0xb0e2('0x2b')]);_0x509b4d[_0xb0e2('0x2f')]=_[_0xb0e2('0x30')](_0x11a95e[_0xb0e2('0x2e')],qs['fields'](_0x3181de[_0xb0e2('0x2b')][_0xb0e2('0x31')]));_0x509b4d[_0xb0e2('0x2f')]=_0x509b4d[_0xb0e2('0x2f')][_0xb0e2('0x32')]?_0x509b4d[_0xb0e2('0x2f')]:_0x11a95e[_0xb0e2('0x2e')];_0x509b4d[_0xb0e2('0x35')]=qs['sort'](_0x3181de['query'][_0xb0e2('0x36')]);_0x509b4d[_0xb0e2('0x37')]=qs['filters'](_[_0xb0e2('0x38')](_0x3181de[_0xb0e2('0x2b')],_0x11a95e[_0xb0e2('0x2d')]));if(_0x3181de['query'][_0xb0e2('0x39')]){_0x509b4d[_0xb0e2('0x37')]=_[_0xb0e2('0x41')](_0x509b4d[_0xb0e2('0x37')],{'$or':_[_0xb0e2('0x2a')](_0x509b4d[_0xb0e2('0x2f')],function(_0x1e922c){var _0x744751={};_0x744751[_0x1e922c]={'$like':'%'+_0x3181de[_0xb0e2('0x2b')][_0xb0e2('0x39')]+'%'};return _0x744751;})});}_0x509b4d=_[_0xb0e2('0x41')]({},_0x509b4d,_0x3181de['options']);return _0x4ad98a[_0xb0e2('0x46')](_0x509b4d);}})['then'](function(_0x344e05){if(_0x344e05){_0x4b4472=_0x344e05[_0xb0e2('0x32')];if(!_0x3181de[_0xb0e2('0x2b')][_0xb0e2('0x33')]('nolimit')){_0x509b4d[_0xb0e2('0x1b')]=qs['limit'](_0x3181de[_0xb0e2('0x2b')][_0xb0e2('0x1b')]);_0x509b4d[_0xb0e2('0x19')]=qs[_0xb0e2('0x19')](_0x3181de['query'][_0xb0e2('0x19')]);}return _0x4ad98a[_0xb0e2('0x46')](_0x509b4d);}})[_0xb0e2('0x21')](function(_0x5dc96c){if(_0x5dc96c){return _0x5dc96c?{'count':_0x4b4472,'rows':_0x5dc96c}:null;}})[_0xb0e2('0x21')](respondWithResult(_0x4e14d3,null))[_0xb0e2('0x3f')](handleError(_0x4e14d3,null));};exports[_0xb0e2('0x4a')]=function(_0x1530f1,_0xe1de64,_0x3cfdcb){if(_0x1530f1[_0xb0e2('0x44')]['id']){delete _0x1530f1[_0xb0e2('0x44')]['id'];}return db[_0xb0e2('0x28')][_0xb0e2('0x47')]({'where':{'id':_0x1530f1[_0xb0e2('0x45')]['id']}})[_0xb0e2('0x21')](handleEntityNotFound(_0xe1de64,null))[_0xb0e2('0x21')](function(_0x3a1213){if(_0x3a1213){_0x1530f1[_0xb0e2('0x44')]['AccountId']=_0x3a1213['id'];_0x1530f1[_0xb0e2('0x44')]['Subjects']=integrations['getSubjects'](_0x1530f1[_0xb0e2('0x44')]['channel'],_0x1530f1[_0xb0e2('0x44')][_0xb0e2('0x3a')]);_0x1530f1[_0xb0e2('0x44')][_0xb0e2('0x4b')]=integrations[_0xb0e2('0x4c')](_0x1530f1['body']['channel'],_0x1530f1[_0xb0e2('0x44')][_0xb0e2('0x3a')]);return db[_0xb0e2('0x48')][_0xb0e2('0x43')](_0x1530f1[_0xb0e2('0x44')],{'include':[{'model':db[_0xb0e2('0x4d')],'as':_0xb0e2('0x4e')},{'model':db['SugarcrmField'],'as':_0xb0e2('0x4b')}]});}return null;})[_0xb0e2('0x21')](respondWithResult(_0xe1de64,null))[_0xb0e2('0x3f')](handleError(_0xe1de64,null));};exports['getFields']=function(_0x5bee44,_0x91cde5,_0x2c3db6){var _0x558b4d='';var _0x5255c1=['id',_0xb0e2('0x26'),_0xb0e2('0x4f'),_0xb0e2('0x50'),_0xb0e2('0x51'),_0xb0e2('0x52'),_0xb0e2('0x53'),_0xb0e2('0x54'),_0xb0e2('0x55'),_0xb0e2('0x56'),_0xb0e2('0x57'),'direction'];return db[_0xb0e2('0x28')][_0xb0e2('0x47')]({'where':{'id':_0x5bee44['params']['id']},'attributes':['id','username',_0xb0e2('0x58'),_0xb0e2('0x59')]})[_0xb0e2('0x21')](handleEntityNotFound(_0x91cde5,null))[_0xb0e2('0x21')](function(_0x45255e){if(_0x45255e){_0x558b4d=_0x45255e[_0xb0e2('0x59')];var _0x1c62c2=_0x558b4d[_0xb0e2('0x5a')](-0x1);if(_0x1c62c2==='/'){_0x558b4d=_0x558b4d[_0xb0e2('0x5b')](0x0,_0x558b4d[_0xb0e2('0x5c')](_0x1c62c2));}return rp({'method':_0xb0e2('0x5d'),'uri':util[_0xb0e2('0x5e')](_0xb0e2('0x5f'),_0x558b4d,_0xb0e2('0x60')),'json':!![],'form':{'method':_0xb0e2('0x61'),'input_type':_0xb0e2('0x62'),'response_type':'JSON','rest_data':JSON[_0xb0e2('0x63')]({'user_auth':{'user_name':_0x45255e['username'],'password':_0x45255e[_0xb0e2('0x58')],'encryption':_0xb0e2('0x64')},'application':_0xb0e2('0x65')})}});}})[_0xb0e2('0x21')](function(_0x9d2aea){if(_0x9d2aea&&_0x9d2aea['name']!==_0xb0e2('0x66')&&_0x9d2aea['name']!==_0xb0e2('0x67')){return rp({'method':'POST','uri':util[_0xb0e2('0x5e')](_0xb0e2('0x5f'),_0x558b4d,_0xb0e2('0x60')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xb0e2('0x62'),'response_type':_0xb0e2('0x62'),'rest_data':JSON['stringify']({'session':_0x9d2aea['id'],'module_name':_0xb0e2('0x68')})}})[_0xb0e2('0x21')](function(_0x5191f2){if(_0x5191f2){var _0x31484=_[_0xb0e2('0x69')](_0x5191f2[_0xb0e2('0x6a')]);_[_0xb0e2('0x6b')](_0x31484,function(_0x300f8a){return _0x5255c1[_0xb0e2('0x6c')](_0x300f8a[_0xb0e2('0x26')]);});return{'count':_0x31484[_0xb0e2('0x32')],'rows':_['map'](_0x31484,function(_0x28293a){return{'id':_0x28293a[_0xb0e2('0x26')],'name':_0x28293a['label'],'custom':_[_0xb0e2('0x6d')](_0x28293a[_0xb0e2('0x26')],'_c')?!![]:![],'options':_0x28293a['options']?_[_0xb0e2('0x2a')](_[_0xb0e2('0x69')](_0x28293a[_0xb0e2('0x3b')]),function(_0x534c14){return{'name':_0x534c14[_0xb0e2('0x6e')],'value':_0x534c14[_0xb0e2('0x26')]};}):[]};})};}})[_0xb0e2('0x21')](respondWithResult(_0x91cde5,null))['catch'](function(_0x21fcf5){var _0x2572ab=_0x5bee44[_0xb0e2('0x2b')][_0xb0e2('0x6f')]?0x1f4:_0x21fcf5[_0xb0e2('0x70')]||0x1f4;logger[_0xb0e2('0x24')](_0xb0e2('0x71'),_0xb0e2('0x72'),_0x2572ab,JSON[_0xb0e2('0x63')](_0x21fcf5));delete _0x21fcf5['name'];if(_0x2572ab===0x191){_0x2572ab=0x190;}_0x91cde5[_0xb0e2('0x17')](_0x2572ab)[_0xb0e2('0x73')](_0x5bee44[_0xb0e2('0x2b')][_0xb0e2('0x6f')]?{'message':_0xb0e2('0x74'),'statusCode':_0x21fcf5['statusCode']}:_0x21fcf5);});}else{var _0x4235ac=0x1f4;_0x91cde5[_0xb0e2('0x17')](_0x4235ac)[_0xb0e2('0x73')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x72bd=['hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','show','keys','find','create','catch','body','params','getConfigurations','findOne','SugarcrmConfiguration','pick','nolimit','getSubjects','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','created_by','description','date_start','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','substring','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','Invalid\x20Login','Password\x20Expired','stringify','Calls','values','module_fields','remove','includes','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','model','query','filters','intersection','attributes','fields','length'];(function(_0x40d978,_0xdd7c2e){var _0x51d920=function(_0x40ad69){while(--_0x40ad69){_0x40d978['push'](_0x40d978['shift']());}};_0x51d920(++_0xdd7c2e);}(_0x72bd,0xb3));var _0xd72b=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x72bd[_0x1a36a5];return _0x746243;};'use strict';var emlformat=require(_0xd72b('0x0'));var rimraf=require(_0xd72b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd72b('0x2'));var rp=require('request-promise');var moment=require(_0xd72b('0x3'));var BPromise=require(_0xd72b('0x4'));var Mustache=require(_0xd72b('0x5'));var util=require(_0xd72b('0x6'));var path=require(_0xd72b('0x7'));var sox=require(_0xd72b('0x8'));var csv=require(_0xd72b('0x9'));var ejs=require(_0xd72b('0xa'));var fs=require('fs');var fs_extra=require(_0xd72b('0xb'));var _=require(_0xd72b('0xc'));var squel=require(_0xd72b('0xd'));var crypto=require('crypto');var jsforce=require(_0xd72b('0xe'));var deskjs=require(_0xd72b('0xf'));var toCsv=require(_0xd72b('0x9'));var querystring=require(_0xd72b('0x10'));var Papa=require('papaparse');var Redis=require(_0xd72b('0x11'));var authService=require(_0xd72b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd72b('0x13'));var hardwareService=require(_0xd72b('0x14'));var logger=require(_0xd72b('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd72b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd72b('0x17'))['db'];var integrations=require(_0xd72b('0x18'));function respondWithStatusCode(_0x1b46dc,_0x1ee85a){_0x1ee85a=_0x1ee85a||0xcc;return function(_0x33a2c7){if(_0x33a2c7){return _0x1b46dc[_0xd72b('0x19')](_0x1ee85a);}return _0x1b46dc[_0xd72b('0x1a')](_0x1ee85a)[_0xd72b('0x1b')]();};}function respondWithResult(_0x56048f,_0x59caa5){_0x59caa5=_0x59caa5||0xc8;return function(_0x5b865f){if(_0x5b865f){return _0x56048f[_0xd72b('0x1a')](_0x59caa5)[_0xd72b('0x1c')](_0x5b865f);}};}function respondWithFilteredResult(_0x4791ee,_0x360e11){return function(_0x3996fb){if(_0x3996fb){var _0x38653b=typeof _0x360e11[_0xd72b('0x1d')]===_0xd72b('0x1e')&&typeof _0x360e11['limit']===_0xd72b('0x1e');var _0x1234f9=_0x3996fb[_0xd72b('0x1f')];var _0x4d0b04=_0x38653b?0x0:_0x360e11[_0xd72b('0x1d')];var _0x207580=_0x38653b?_0x3996fb[_0xd72b('0x1f')]:_0x360e11[_0xd72b('0x1d')]+_0x360e11[_0xd72b('0x20')];var _0x6511f3;if(_0x207580>=_0x1234f9){_0x207580=_0x1234f9;_0x6511f3=0xc8;}else{_0x6511f3=0xce;}_0x4791ee[_0xd72b('0x1a')](_0x6511f3);return _0x4791ee[_0xd72b('0x21')](_0xd72b('0x22'),_0x4d0b04+'-'+_0x207580+'/'+_0x1234f9)[_0xd72b('0x1c')](_0x3996fb);}return null;};}function patchUpdates(_0x534435){return function(_0x3c6f56){try{jsonpatch[_0xd72b('0x23')](_0x3c6f56,_0x534435,!![]);}catch(_0x38babb){return BPromise[_0xd72b('0x24')](_0x38babb);}return _0x3c6f56[_0xd72b('0x25')]();};}function saveUpdates(_0x5b0983,_0x36282a){return function(_0x379af5){if(_0x379af5){return _0x379af5['update'](_0x5b0983)[_0xd72b('0x26')](function(_0xd8d125){return _0xd8d125;});}return null;};}function removeEntity(_0x4802f3,_0x59c178){return function(_0x3c89e2){if(_0x3c89e2){return _0x3c89e2[_0xd72b('0x27')]()[_0xd72b('0x26')](function(){_0x4802f3[_0xd72b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f4c10,_0x53f8ad){return function(_0x1a0be1){if(!_0x1a0be1){_0x2f4c10[_0xd72b('0x19')](0x194);}return _0x1a0be1;};}function handleError(_0x217f2e,_0x452820){_0x452820=_0x452820||0x1f4;return function(_0x4e77f){logger[_0xd72b('0x28')](_0x4e77f[_0xd72b('0x29')]);if(_0x4e77f[_0xd72b('0x2a')]){delete _0x4e77f[_0xd72b('0x2a')];}_0x217f2e[_0xd72b('0x1a')](_0x452820)[_0xd72b('0x2b')](_0x4e77f);};}exports[_0xd72b('0x2c')]=function(_0x7144a5,_0x52c7a8){var _0x21207e={},_0x5b2796={},_0x59bf09={'count':0x0,'rows':[]};var _0x1c01ef=_[_0xd72b('0x2d')](db[_0xd72b('0x2e')][_0xd72b('0x2f')],function(_0x3496a3){return{'name':_0x3496a3['fieldName'],'type':_0x3496a3['type']['key']};});_0x5b2796[_0xd72b('0x30')]=_[_0xd72b('0x2d')](_0x1c01ef,_0xd72b('0x2a'));_0x5b2796[_0xd72b('0x31')]=_['keys'](_0x7144a5[_0xd72b('0x31')]);_0x5b2796[_0xd72b('0x32')]=_[_0xd72b('0x33')](_0x5b2796[_0xd72b('0x30')],_0x5b2796[_0xd72b('0x31')]);_0x21207e[_0xd72b('0x34')]=_[_0xd72b('0x33')](_0x5b2796[_0xd72b('0x30')],qs[_0xd72b('0x35')](_0x7144a5[_0xd72b('0x31')]['fields']));_0x21207e[_0xd72b('0x34')]=_0x21207e[_0xd72b('0x34')][_0xd72b('0x36')]?_0x21207e[_0xd72b('0x34')]:_0x5b2796[_0xd72b('0x30')];if(!_0x7144a5['query'][_0xd72b('0x37')]('nolimit')){_0x21207e[_0xd72b('0x20')]=qs[_0xd72b('0x20')](_0x7144a5['query'][_0xd72b('0x20')]);_0x21207e['offset']=qs[_0xd72b('0x1d')](_0x7144a5[_0xd72b('0x31')][_0xd72b('0x1d')]);}_0x21207e[_0xd72b('0x38')]=qs[_0xd72b('0x39')](_0x7144a5[_0xd72b('0x31')][_0xd72b('0x39')]);_0x21207e['where']=qs['filters'](_['pick'](_0x7144a5[_0xd72b('0x31')],_0x5b2796[_0xd72b('0x32')]),_0x1c01ef);if(_0x7144a5['query'][_0xd72b('0x3a')]){_0x21207e[_0xd72b('0x3b')]=_[_0xd72b('0x3c')](_0x21207e[_0xd72b('0x3b')],{'$or':_[_0xd72b('0x2d')](_0x1c01ef,function(_0x8184a9){if(_0x8184a9[_0xd72b('0x3d')]!==_0xd72b('0x3e')){var _0x1a58bf={};_0x1a58bf[_0x8184a9[_0xd72b('0x2a')]]={'$like':'%'+_0x7144a5[_0xd72b('0x31')][_0xd72b('0x3a')]+'%'};return _0x1a58bf;}})});}_0x21207e=_['merge']({},_0x21207e,_0x7144a5[_0xd72b('0x3f')]);var _0x70bcb6={'where':_0x21207e['where']};return db[_0xd72b('0x2e')][_0xd72b('0x1f')](_0x70bcb6)[_0xd72b('0x26')](function(_0x468f98){_0x59bf09[_0xd72b('0x1f')]=_0x468f98;if(_0x7144a5[_0xd72b('0x31')][_0xd72b('0x40')]){_0x21207e[_0xd72b('0x41')]=[{'all':!![]}];}return db[_0xd72b('0x2e')]['findAll'](_0x21207e);})[_0xd72b('0x26')](function(_0x331940){_0x59bf09['rows']=_0x331940;return _0x59bf09;})[_0xd72b('0x26')](respondWithFilteredResult(_0x52c7a8,_0x21207e))['catch'](handleError(_0x52c7a8,null));};exports[_0xd72b('0x42')]=function(_0x31599e,_0xfbb7f){var _0x5249a1={'raw':![],'where':{'id':_0x31599e['params']['id']}},_0x140e07={};_0x140e07['model']=_[_0xd72b('0x43')](db[_0xd72b('0x2e')]['rawAttributes']);_0x140e07[_0xd72b('0x31')]=_[_0xd72b('0x43')](_0x31599e[_0xd72b('0x31')]);_0x140e07[_0xd72b('0x32')]=_[_0xd72b('0x33')](_0x140e07[_0xd72b('0x30')],_0x140e07[_0xd72b('0x31')]);_0x5249a1['attributes']=_[_0xd72b('0x33')](_0x140e07[_0xd72b('0x30')],qs[_0xd72b('0x35')](_0x31599e[_0xd72b('0x31')][_0xd72b('0x35')]));_0x5249a1['attributes']=_0x5249a1['attributes'][_0xd72b('0x36')]?_0x5249a1[_0xd72b('0x34')]:_0x140e07[_0xd72b('0x30')];if(_0x31599e[_0xd72b('0x31')][_0xd72b('0x40')]){_0x5249a1[_0xd72b('0x41')]=[{'all':!![]}];}_0x5249a1=_[_0xd72b('0x3c')]({},_0x5249a1,_0x31599e['options']);return db[_0xd72b('0x2e')][_0xd72b('0x44')](_0x5249a1)[_0xd72b('0x26')](handleEntityNotFound(_0xfbb7f,null))[_0xd72b('0x26')](respondWithResult(_0xfbb7f,null))['catch'](handleError(_0xfbb7f,null));};exports[_0xd72b('0x45')]=function(_0x22e061,_0x35b467){return db['SugarcrmAccount'][_0xd72b('0x45')](_0x22e061['body'],{})[_0xd72b('0x26')](respondWithResult(_0x35b467,0xc9))[_0xd72b('0x46')](handleError(_0x35b467,null));};exports['update']=function(_0x4bcb8b,_0x51890f){if(_0x4bcb8b['body']['id']){delete _0x4bcb8b[_0xd72b('0x47')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x4bcb8b['params']['id']}})[_0xd72b('0x26')](handleEntityNotFound(_0x51890f,null))[_0xd72b('0x26')](saveUpdates(_0x4bcb8b[_0xd72b('0x47')],null))[_0xd72b('0x26')](respondWithResult(_0x51890f,null))[_0xd72b('0x46')](handleError(_0x51890f,null));};exports[_0xd72b('0x27')]=function(_0x5f2d6c,_0x5352c0){return db[_0xd72b('0x2e')]['find']({'where':{'id':_0x5f2d6c[_0xd72b('0x48')]['id']}})[_0xd72b('0x26')](handleEntityNotFound(_0x5352c0,null))[_0xd72b('0x26')](removeEntity(_0x5352c0,null))[_0xd72b('0x46')](handleError(_0x5352c0,null));};exports[_0xd72b('0x49')]=function(_0x76a881,_0x10ce8a,_0x168305){var _0x4212e8={};var _0xe9d6f8={};var _0x368990;var _0xeec024;return db['SugarcrmAccount'][_0xd72b('0x4a')]({'where':{'id':_0x76a881[_0xd72b('0x48')]['id']}})['then'](handleEntityNotFound(_0x10ce8a,null))[_0xd72b('0x26')](function(_0x23cefb){if(_0x23cefb){_0x368990=_0x23cefb;_0xe9d6f8[_0xd72b('0x30')]=_['keys'](db[_0xd72b('0x4b')][_0xd72b('0x2f')]);_0xe9d6f8[_0xd72b('0x31')]=_[_0xd72b('0x43')](_0x76a881[_0xd72b('0x31')]);_0xe9d6f8[_0xd72b('0x32')]=_[_0xd72b('0x33')](_0xe9d6f8['model'],_0xe9d6f8[_0xd72b('0x31')]);_0x4212e8[_0xd72b('0x34')]=_[_0xd72b('0x33')](_0xe9d6f8[_0xd72b('0x30')],qs['fields'](_0x76a881[_0xd72b('0x31')]['fields']));_0x4212e8['attributes']=_0x4212e8[_0xd72b('0x34')][_0xd72b('0x36')]?_0x4212e8[_0xd72b('0x34')]:_0xe9d6f8['model'];_0x4212e8[_0xd72b('0x38')]=qs[_0xd72b('0x39')](_0x76a881['query']['sort']);_0x4212e8['where']=qs[_0xd72b('0x32')](_[_0xd72b('0x4c')](_0x76a881[_0xd72b('0x31')],_0xe9d6f8['filters']));if(_0x76a881[_0xd72b('0x31')]['filter']){_0x4212e8[_0xd72b('0x3b')]=_[_0xd72b('0x3c')](_0x4212e8['where'],{'$or':_[_0xd72b('0x2d')](_0x4212e8[_0xd72b('0x34')],function(_0x57ebf8){var _0x161386={};_0x161386[_0x57ebf8]={'$like':'%'+_0x76a881[_0xd72b('0x31')][_0xd72b('0x3a')]+'%'};return _0x161386;})});}_0x4212e8=_[_0xd72b('0x3c')]({},_0x4212e8,_0x76a881[_0xd72b('0x3f')]);return _0x368990[_0xd72b('0x49')](_0x4212e8);}})['then'](function(_0x4de8f7){if(_0x4de8f7){_0xeec024=_0x4de8f7[_0xd72b('0x36')];if(!_0x76a881[_0xd72b('0x31')]['hasOwnProperty'](_0xd72b('0x4d'))){_0x4212e8[_0xd72b('0x20')]=qs[_0xd72b('0x20')](_0x76a881[_0xd72b('0x31')]['limit']);_0x4212e8[_0xd72b('0x1d')]=qs['offset'](_0x76a881[_0xd72b('0x31')][_0xd72b('0x1d')]);}return _0x368990['getConfigurations'](_0x4212e8);}})['then'](function(_0x115fe1){if(_0x115fe1){return _0x115fe1?{'count':_0xeec024,'rows':_0x115fe1}:null;}})[_0xd72b('0x26')](respondWithResult(_0x10ce8a,null))[_0xd72b('0x46')](handleError(_0x10ce8a,null));};exports['addConfiguration']=function(_0x129632,_0x37eb13,_0x6a990){if(_0x129632[_0xd72b('0x47')]['id']){delete _0x129632[_0xd72b('0x47')]['id'];}return db[_0xd72b('0x2e')]['findOne']({'where':{'id':_0x129632[_0xd72b('0x48')]['id']}})['then'](handleEntityNotFound(_0x37eb13,null))[_0xd72b('0x26')](function(_0x3209f3){if(_0x3209f3){_0x129632[_0xd72b('0x47')]['AccountId']=_0x3209f3['id'];_0x129632[_0xd72b('0x47')]['Subjects']=integrations[_0xd72b('0x4e')](_0x129632[_0xd72b('0x47')]['channel'],_0x129632['body'][_0xd72b('0x3d')]);_0x129632[_0xd72b('0x47')][_0xd72b('0x4f')]=integrations[_0xd72b('0x50')](_0x129632['body']['channel'],_0x129632[_0xd72b('0x47')]['type']);return db[_0xd72b('0x4b')]['create'](_0x129632['body'],{'include':[{'model':db[_0xd72b('0x51')],'as':_0xd72b('0x52')},{'model':db[_0xd72b('0x51')],'as':_0xd72b('0x4f')}]});}return null;})['then'](respondWithResult(_0x37eb13,null))[_0xd72b('0x46')](handleError(_0x37eb13,null));};exports[_0xd72b('0x53')]=function(_0x44ddac,_0x1190bf,_0x48dd65){var _0x2ab93f='';var _0x513c30=['id',_0xd72b('0x2a'),'assigned_user_id',_0xd72b('0x54'),_0xd72b('0x55'),_0xd72b('0x56'),'duration_hours',_0xd72b('0x57'),_0xd72b('0x58'),_0xd72b('0x59'),_0xd72b('0x5a'),_0xd72b('0x5b')];return db[_0xd72b('0x2e')][_0xd72b('0x4a')]({'where':{'id':_0x44ddac['params']['id']},'attributes':['id',_0xd72b('0x5c'),_0xd72b('0x5d'),_0xd72b('0x5e')]})['then'](handleEntityNotFound(_0x1190bf,null))[_0xd72b('0x26')](function(_0x368efc){if(_0x368efc){_0x2ab93f=_0x368efc['remoteUri'];var _0x17ca6c=_0x2ab93f['slice'](-0x1);if(_0x17ca6c==='/'){_0x2ab93f=_0x2ab93f[_0xd72b('0x5f')](0x0,_0x2ab93f['lastIndexOf'](_0x17ca6c));}return rp({'method':_0xd72b('0x60'),'uri':util[_0xd72b('0x61')](_0xd72b('0x62'),_0x2ab93f,_0xd72b('0x63')),'json':!![],'form':{'method':_0xd72b('0x64'),'input_type':_0xd72b('0x65'),'response_type':_0xd72b('0x65'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x368efc['username'],'password':_0x368efc[_0xd72b('0x5d')],'encryption':_0xd72b('0x66')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xd72b('0x26')](function(_0x5dca7e){if(_0x5dca7e&&_0x5dca7e[_0xd72b('0x2a')]!==_0xd72b('0x67')&&_0x5dca7e[_0xd72b('0x2a')]!==_0xd72b('0x68')){return rp({'method':'POST','uri':util['format'](_0xd72b('0x62'),_0x2ab93f,_0xd72b('0x63')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xd72b('0x65'),'response_type':_0xd72b('0x65'),'rest_data':JSON[_0xd72b('0x69')]({'session':_0x5dca7e['id'],'module_name':_0xd72b('0x6a')})}})[_0xd72b('0x26')](function(_0xa9f48a){if(_0xa9f48a){var _0x402cab=_[_0xd72b('0x6b')](_0xa9f48a[_0xd72b('0x6c')]);_[_0xd72b('0x6d')](_0x402cab,function(_0x28c72e){return _0x513c30[_0xd72b('0x6e')](_0x28c72e['name']);});return{'count':_0x402cab[_0xd72b('0x36')],'rows':_[_0xd72b('0x2d')](_0x402cab,function(_0x7db5b6){return{'id':_0x7db5b6[_0xd72b('0x2a')],'name':_0x7db5b6['label'],'custom':_[_0xd72b('0x6f')](_0x7db5b6[_0xd72b('0x2a')],'_c')?!![]:![],'options':_0x7db5b6[_0xd72b('0x3f')]?_[_0xd72b('0x2d')](_[_0xd72b('0x6b')](_0x7db5b6[_0xd72b('0x3f')]),function(_0x5e6143){return{'name':_0x5e6143[_0xd72b('0x70')],'value':_0x5e6143[_0xd72b('0x2a')]};}):[]};})};}})[_0xd72b('0x26')](respondWithResult(_0x1190bf,null))[_0xd72b('0x46')](function(_0x523c65){var _0xe61584=_0x44ddac[_0xd72b('0x31')][_0xd72b('0x71')]?0x1f4:_0x523c65[_0xd72b('0x72')]||0x1f4;logger[_0xd72b('0x28')](_0xd72b('0x73'),'getFields',_0xe61584,JSON[_0xd72b('0x69')](_0x523c65));delete _0x523c65[_0xd72b('0x2a')];if(_0xe61584===0x191){_0xe61584=0x190;}_0x1190bf['status'](_0xe61584)[_0xd72b('0x2b')](_0x44ddac[_0xd72b('0x31')][_0xd72b('0x71')]?{'message':_0xd72b('0x74'),'statusCode':_0x523c65[_0xd72b('0x72')]}:_0x523c65);});}else{var _0x146e4b=0x1f4;_0x1190bf[_0xd72b('0x1a')](_0x146e4b)[_0xd72b('0x2b')]({'message':_0xd72b('0x74'),'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 c057860..b129b9d 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 _0x2c64=['int_sugarcrm_accounts','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount'];(function(_0x263a2f,_0x1e81e3){var _0x8020e8=function(_0x39f91a){while(--_0x39f91a){_0x263a2f['push'](_0x263a2f['shift']());}};_0x8020e8(++_0x1e81e3);}(_0x2c64,0x181));var _0x42c6=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x2c64[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x42c6('0x0'));var util=require(_0x42c6('0x1'));var logger=require('../../config/logger')(_0x42c6('0x2'));var moment=require(_0x42c6('0x3'));var BPromise=require(_0x42c6('0x4'));var rp=require(_0x42c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x42c6('0x6'));var attributes=require(_0x42c6('0x7'));var integrations=require(_0x42c6('0x8'));module['exports']=function(_0x553bd9,_0x58d2d0){return _0x553bd9[_0x42c6('0x9')](_0x42c6('0xa'),attributes,{'tableName':_0x42c6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xebcd=['lodash','../../config/logger','bluebird','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xebcd,0x18c));var _0xdebc=function(_0xab9f3d,_0xb336fa){_0xab9f3d=_0xab9f3d-0x0;var _0x5283bf=_0xebcd[_0xab9f3d];return _0x5283bf;};'use strict';var _=require(_0xdebc('0x0'));var util=require('util');var logger=require(_0xdebc('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdebc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdebc('0x3'));var rimraf=require('rimraf');var config=require(_0xdebc('0x4'));var attributes=require(_0xdebc('0x5'));var integrations=require(_0xdebc('0x6'));module[_0xdebc('0x7')]=function(_0x1e5295,_0x435862){return _0x1e5295['define'](_0xdebc('0x8'),attributes,{'tableName':'int_sugarcrm_accounts','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 0e6459d..699a840 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 _0x8be5=['message','info','result','catch','options','where','attributes','limit','include','map','model','then','debug','GetSugarcrmAccount','ShowSugarcrmAccount','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8be5,0xba));var _0x58be=function(_0x2ab392,_0x25b98f){_0x2ab392=_0x2ab392-0x0;var _0x2c1a96=_0x8be5[_0x2ab392];return _0x2c1a96;};'use strict';var _=require(_0x58be('0x0'));var util=require(_0x58be('0x1'));var moment=require('moment');var BPromise=require(_0x58be('0x2'));var rs=require(_0x58be('0x3'));var fs=require('fs');var Redis=require(_0x58be('0x4'));var db=require(_0x58be('0x5'))['db'];var utils=require(_0x58be('0x6'));var logger=require(_0x58be('0x7'))(_0x58be('0x8'));var config=require(_0x58be('0x9'));var jayson=require(_0x58be('0xa'));var client=jayson['client'][_0x58be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x574d9c,_0x5251ff,_0x3ffbec){return new BPromise(function(_0x228745,_0x3c55ff){return client['request'](_0x574d9c,_0x3ffbec)['then'](function(_0x46240e){logger['info'](_0x58be('0xc'),_0x5251ff,_0x58be('0xd'));logger['debug'](_0x58be('0xe'),_0x5251ff,'request\x20sent',JSON[_0x58be('0xf')](_0x46240e));if(_0x46240e['error']){if(_0x46240e[_0x58be('0x10')][_0x58be('0x11')]===0x1f4){logger[_0x58be('0x10')](_0x58be('0xc'),_0x5251ff,_0x46240e[_0x58be('0x10')]['message']);return _0x3c55ff(_0x46240e[_0x58be('0x10')][_0x58be('0x12')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x5251ff,_0x46240e[_0x58be('0x10')][_0x58be('0x12')]);return _0x228745(_0x46240e['error'][_0x58be('0x12')]);}else{logger[_0x58be('0x13')](_0x58be('0xc'),_0x5251ff,_0x58be('0xd'));_0x228745(_0x46240e[_0x58be('0x14')][_0x58be('0x12')]);}})[_0x58be('0x15')](function(_0x3975e2){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x5251ff,_0x3975e2);_0x3c55ff(_0x3975e2);});});}exports['GetSugarcrmAccount']=function(_0x2a1b05){var _0xe73bb5=this;return new Promise(function(_0x8a3aa0,_0x346ef4){return db['SugarcrmAccount']['findAll']({'raw':_0x2a1b05['options']?_0x2a1b05[_0x58be('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2a1b05[_0x58be('0x16')]?_0x2a1b05[_0x58be('0x16')][_0x58be('0x17')]||null:null,'attributes':_0x2a1b05['options']?_0x2a1b05[_0x58be('0x16')][_0x58be('0x18')]||null:null,'limit':_0x2a1b05[_0x58be('0x16')]?_0x2a1b05['options'][_0x58be('0x19')]||null:null,'include':_0x2a1b05[_0x58be('0x16')]?_0x2a1b05['options'][_0x58be('0x1a')]?_[_0x58be('0x1b')](_0x2a1b05['options'][_0x58be('0x1a')],function(_0x44a2e9){return{'model':db[_0x44a2e9['model']],'as':_0x44a2e9['as'],'attributes':_0x44a2e9[_0x58be('0x18')],'include':_0x44a2e9[_0x58be('0x1a')]?_[_0x58be('0x1b')](_0x44a2e9['include'],function(_0x43a047){return{'model':db[_0x43a047[_0x58be('0x1c')]],'as':_0x43a047['as'],'attributes':_0x43a047[_0x58be('0x18')],'include':_0x43a047['include']?_['map'](_0x43a047[_0x58be('0x1a')],function(_0x960814){return{'model':db[_0x960814[_0x58be('0x1c')]],'as':_0x960814['as'],'attributes':_0x960814[_0x58be('0x18')]};}):[]};}):[]};}):[]:[]})[_0x58be('0x1d')](function(_0x284451){logger[_0x58be('0x13')]('GetSugarcrmAccount',_0x2a1b05);logger[_0x58be('0x1e')](_0x58be('0x1f'),_0x2a1b05,JSON[_0x58be('0xf')](_0x284451));_0x8a3aa0(_0x284451);})[_0x58be('0x15')](function(_0x1f633c){logger[_0x58be('0x10')](_0x58be('0x1f'),_0x1f633c[_0x58be('0x12')],_0x2a1b05);_0x346ef4(_0xe73bb5[_0x58be('0x10')](0x1f4,_0x1f633c[_0x58be('0x12')]));});});};exports[_0x58be('0x20')]=function(_0x5eee9d){var _0xc88be9=this;return new Promise(function(_0x415d26,_0x1a3233){return db['SugarcrmAccount']['find']({'raw':_0x5eee9d['options']?_0x5eee9d[_0x58be('0x16')][_0x58be('0x21')]===undefined?!![]:![]:!![],'where':_0x5eee9d['options']?_0x5eee9d[_0x58be('0x16')][_0x58be('0x17')]||null:null,'attributes':_0x5eee9d[_0x58be('0x16')]?_0x5eee9d[_0x58be('0x16')]['attributes']||null:null,'include':_0x5eee9d[_0x58be('0x16')]?_0x5eee9d[_0x58be('0x16')][_0x58be('0x1a')]?_[_0x58be('0x1b')](_0x5eee9d['options']['include'],function(_0x41eac2){return{'model':db[_0x41eac2[_0x58be('0x1c')]],'as':_0x41eac2['as'],'attributes':_0x41eac2[_0x58be('0x18')],'include':_0x41eac2[_0x58be('0x1a')]?_['map'](_0x41eac2[_0x58be('0x1a')],function(_0x3cb7f6){return{'model':db[_0x3cb7f6[_0x58be('0x1c')]],'as':_0x3cb7f6['as'],'attributes':_0x3cb7f6[_0x58be('0x18')],'include':_0x3cb7f6[_0x58be('0x1a')]?_[_0x58be('0x1b')](_0x3cb7f6[_0x58be('0x1a')],function(_0xf2fd63){return{'model':db[_0xf2fd63[_0x58be('0x1c')]],'as':_0xf2fd63['as'],'attributes':_0xf2fd63['attributes']};}):[]};}):[]};}):[]:[]})[_0x58be('0x1d')](function(_0x240001){logger[_0x58be('0x13')](_0x58be('0x20'),_0x5eee9d);logger['debug'](_0x58be('0x20'),_0x5eee9d,JSON[_0x58be('0xf')](_0x240001));_0x415d26(_0x240001);})[_0x58be('0x15')](function(_0x39460c){logger['error'](_0x58be('0x20'),_0x39460c[_0x58be('0x12')],_0x5eee9d);_0x1a3233(_0xc88be9['error'](0x1f4,_0x39460c[_0x58be('0x12')]));});});}; \ No newline at end of file +var _0x3059=['../../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','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x505f69,_0x56379d){var _0xd1e86c=function(_0x216963){while(--_0x216963){_0x505f69['push'](_0x505f69['shift']());}};_0xd1e86c(++_0x56379d);}(_0x3059,0x123));var _0x9305=function(_0x411bdc,_0x4756c4){_0x411bdc=_0x411bdc-0x0;var _0x31c4fa=_0x3059[_0x411bdc];return _0x31c4fa;};'use strict';var _=require(_0x9305('0x0'));var util=require(_0x9305('0x1'));var moment=require(_0x9305('0x2'));var BPromise=require(_0x9305('0x3'));var rs=require(_0x9305('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9305('0x5'));var logger=require(_0x9305('0x6'))(_0x9305('0x7'));var config=require(_0x9305('0x8'));var jayson=require(_0x9305('0x9'));var client=jayson[_0x9305('0xa')][_0x9305('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb625b2,_0x5daacf,_0x1edfc4){return new BPromise(function(_0x316e36,_0x30ccd7){return client[_0x9305('0xc')](_0xb625b2,_0x1edfc4)[_0x9305('0xd')](function(_0x47b6ed){logger[_0x9305('0xe')](_0x9305('0xf'),_0x5daacf,_0x9305('0x10'));logger[_0x9305('0x11')](_0x9305('0x12'),_0x5daacf,_0x9305('0x10'),JSON[_0x9305('0x13')](_0x47b6ed));if(_0x47b6ed['error']){if(_0x47b6ed[_0x9305('0x14')][_0x9305('0x15')]===0x1f4){logger[_0x9305('0x14')](_0x9305('0xf'),_0x5daacf,_0x47b6ed['error']['message']);return _0x30ccd7(_0x47b6ed[_0x9305('0x14')]['message']);}logger[_0x9305('0x14')](_0x9305('0xf'),_0x5daacf,_0x47b6ed[_0x9305('0x14')]['message']);return _0x316e36(_0x47b6ed[_0x9305('0x14')][_0x9305('0x16')]);}else{logger[_0x9305('0xe')](_0x9305('0xf'),_0x5daacf,_0x9305('0x10'));_0x316e36(_0x47b6ed['result']['message']);}})[_0x9305('0x17')](function(_0x3f98e8){logger[_0x9305('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x5daacf,_0x3f98e8);_0x30ccd7(_0x3f98e8);});});}exports[_0x9305('0x18')]=function(_0x18d675){var _0x4b8810=this;return new Promise(function(_0x4e7d23,_0x322a92){return db['SugarcrmAccount'][_0x9305('0x19')]({'raw':_0x18d675[_0x9305('0x1a')]?_0x18d675['options'][_0x9305('0x1b')]===undefined?!![]:![]:!![],'where':_0x18d675['options']?_0x18d675['options'][_0x9305('0x1c')]||null:null,'attributes':_0x18d675[_0x9305('0x1a')]?_0x18d675[_0x9305('0x1a')][_0x9305('0x1d')]||null:null,'limit':_0x18d675[_0x9305('0x1a')]?_0x18d675[_0x9305('0x1a')][_0x9305('0x1e')]||null:null,'include':_0x18d675[_0x9305('0x1a')]?_0x18d675['options'][_0x9305('0x1f')]?_[_0x9305('0x20')](_0x18d675[_0x9305('0x1a')][_0x9305('0x1f')],function(_0x1a3457){return{'model':db[_0x1a3457[_0x9305('0x21')]],'as':_0x1a3457['as'],'attributes':_0x1a3457[_0x9305('0x1d')],'include':_0x1a3457[_0x9305('0x1f')]?_[_0x9305('0x20')](_0x1a3457[_0x9305('0x1f')],function(_0x583270){return{'model':db[_0x583270['model']],'as':_0x583270['as'],'attributes':_0x583270[_0x9305('0x1d')],'include':_0x583270['include']?_['map'](_0x583270[_0x9305('0x1f')],function(_0x10b2ed){return{'model':db[_0x10b2ed[_0x9305('0x21')]],'as':_0x10b2ed['as'],'attributes':_0x10b2ed[_0x9305('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9305('0xd')](function(_0x5054a0){logger[_0x9305('0xe')](_0x9305('0x18'),_0x18d675);logger[_0x9305('0x11')]('GetSugarcrmAccount',_0x18d675,JSON['stringify'](_0x5054a0));_0x4e7d23(_0x5054a0);})[_0x9305('0x17')](function(_0x20f72e){logger[_0x9305('0x14')](_0x9305('0x18'),_0x20f72e[_0x9305('0x16')],_0x18d675);_0x322a92(_0x4b8810[_0x9305('0x14')](0x1f4,_0x20f72e[_0x9305('0x16')]));});});};exports[_0x9305('0x22')]=function(_0x42de74){var _0xfe1a0b=this;return new Promise(function(_0x3bd3d5,_0x3017bf){return db[_0x9305('0x23')][_0x9305('0x24')]({'raw':_0x42de74[_0x9305('0x1a')]?_0x42de74[_0x9305('0x1a')][_0x9305('0x1b')]===undefined?!![]:![]:!![],'where':_0x42de74[_0x9305('0x1a')]?_0x42de74['options'][_0x9305('0x1c')]||null:null,'attributes':_0x42de74[_0x9305('0x1a')]?_0x42de74['options'][_0x9305('0x1d')]||null:null,'include':_0x42de74[_0x9305('0x1a')]?_0x42de74[_0x9305('0x1a')][_0x9305('0x1f')]?_['map'](_0x42de74['options'][_0x9305('0x1f')],function(_0x1d0cbf){return{'model':db[_0x1d0cbf[_0x9305('0x21')]],'as':_0x1d0cbf['as'],'attributes':_0x1d0cbf[_0x9305('0x1d')],'include':_0x1d0cbf['include']?_[_0x9305('0x20')](_0x1d0cbf['include'],function(_0x16fb27){return{'model':db[_0x16fb27['model']],'as':_0x16fb27['as'],'attributes':_0x16fb27[_0x9305('0x1d')],'include':_0x16fb27[_0x9305('0x1f')]?_[_0x9305('0x20')](_0x16fb27[_0x9305('0x1f')],function(_0xaddd01){return{'model':db[_0xaddd01[_0x9305('0x21')]],'as':_0xaddd01['as'],'attributes':_0xaddd01[_0x9305('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9305('0xd')](function(_0xa18d87){logger['info'](_0x9305('0x22'),_0x42de74);logger[_0x9305('0x11')](_0x9305('0x22'),_0x42de74,JSON[_0x9305('0x13')](_0xa18d87));_0x3bd3d5(_0xa18d87);})[_0x9305('0x17')](function(_0x4d1a4b){logger[_0x9305('0x14')](_0x9305('0x22'),_0x4d1a4b[_0x9305('0x16')],_0x42de74);_0x3017bf(_0xfe1a0b[_0x9305('0x14')](0x1f4,_0x4d1a4b['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index dd3547a..5e36001 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 _0xdcfd=['create','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x402187,_0x35d3ef){var _0x17e718=function(_0x4877cc){while(--_0x4877cc){_0x402187['push'](_0x402187['shift']());}};_0x17e718(++_0x35d3ef);}(_0xdcfd,0x101));var _0xddcf=function(_0x49c68e,_0x1c1673){_0x49c68e=_0x49c68e-0x0;var _0x33032b=_0xdcfd[_0x49c68e];return _0x33032b;};'use strict';var multer=require(_0xddcf('0x0'));var util=require(_0xddcf('0x1'));var path=require(_0xddcf('0x2'));var timeout=require('connect-timeout');var express=require(_0xddcf('0x3'));var router=express[_0xddcf('0x4')]();var fs_extra=require(_0xddcf('0x5'));var auth=require(_0xddcf('0x6'));var interaction=require(_0xddcf('0x7'));var config=require('../../config/environment');var controller=require(_0xddcf('0x8'));router[_0xddcf('0x9')]('/',auth[_0xddcf('0xa')](),controller[_0xddcf('0xb')]);router[_0xddcf('0x9')](_0xddcf('0xc'),auth[_0xddcf('0xa')](),controller['show']);router[_0xddcf('0x9')]('/:id/fields',auth[_0xddcf('0xa')](),controller[_0xddcf('0xd')]);router[_0xddcf('0x9')](_0xddcf('0xe'),auth['isAuthenticated'](),controller[_0xddcf('0xf')]);router[_0xddcf('0x9')](_0xddcf('0x10'),auth['isAuthenticated'](),controller[_0xddcf('0x11')]);router[_0xddcf('0x12')]('/',auth['isAuthenticated'](),controller[_0xddcf('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xddcf('0x14')]);router[_0xddcf('0x15')](_0xddcf('0xc'),auth[_0xddcf('0xa')](),controller['destroy']);module[_0xddcf('0x16')]=router; \ No newline at end of file +var _0x7100=['/:id/descriptions','getDescriptions','post','put','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','show','get','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects'];(function(_0x4c6c74,_0x27e33e){var _0x5337cf=function(_0x358985){while(--_0x358985){_0x4c6c74['push'](_0x4c6c74['shift']());}};_0x5337cf(++_0x27e33e);}(_0x7100,0x148));var _0x0710=function(_0x4b8156,_0x437af2){_0x4b8156=_0x4b8156-0x0;var _0x4a819c=_0x7100[_0x4b8156];return _0x4a819c;};'use strict';var multer=require(_0x0710('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0710('0x1'));var express=require(_0x0710('0x2'));var router=express[_0x0710('0x3')]();var fs_extra=require(_0x0710('0x4'));var auth=require(_0x0710('0x5'));var interaction=require(_0x0710('0x6'));var config=require(_0x0710('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0710('0x8')]);router['get'](_0x0710('0x9'),auth['isAuthenticated'](),controller[_0x0710('0xa')]);router[_0x0710('0xb')](_0x0710('0xc'),auth[_0x0710('0xd')](),controller[_0x0710('0xe')]);router['get'](_0x0710('0xf'),auth[_0x0710('0xd')](),controller[_0x0710('0x10')]);router['get'](_0x0710('0x11'),auth[_0x0710('0xd')](),controller[_0x0710('0x12')]);router[_0x0710('0x13')]('/',auth[_0x0710('0xd')](),controller['create']);router[_0x0710('0x14')](_0x0710('0x9'),auth[_0x0710('0xd')](),controller[_0x0710('0x15')]);router['delete'](_0x0710('0x9'),auth[_0x0710('0xd')](),controller['destroy']);module[_0x0710('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index dc0af36..6076826 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 _0x096c=['sequelize','STRING'];(function(_0x2d1cb0,_0x33b695){var _0x150a96=function(_0x44b77a){while(--_0x44b77a){_0x2d1cb0['push'](_0x2d1cb0['shift']());}};_0x150a96(++_0x33b695);}(_0x096c,0x164));var _0xc096=function(_0x4a2936,_0x42d86c){_0x4a2936=_0x4a2936-0x0;var _0x15ffb4=_0x096c[_0x4a2936];return _0x15ffb4;};'use strict';var Sequelize=require(_0xc096('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc096('0x1')]}}; \ No newline at end of file +var _0xda5c=['sequelize','exports','STRING'];(function(_0x5afa42,_0x30a006){var _0x10e567=function(_0x1d58f8){while(--_0x1d58f8){_0x5afa42['push'](_0x5afa42['shift']());}};_0x10e567(++_0x30a006);}(_0xda5c,0x1cb));var _0xcda5=function(_0x38387c,_0x52dfdd){_0x38387c=_0x38387c-0x0;var _0xf54580=_0xda5c[_0x38387c];return _0xf54580;};'use strict';var Sequelize=require(_0xcda5('0x0'));module[_0xcda5('0x1')]={'name':{'type':Sequelize[_0xcda5('0x2')]},'description':{'type':Sequelize[_0xcda5('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index b1f34d9..bd8ebf9 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 _0x9a61=['length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','findAll','rows','show','params','include','merge','find','create','body','catch','getFields','findOne','keys','SugarcrmField','order','getSubjects','options','getDescriptions','rimraf','zip-dir','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','save','update','then','destroy','sendStatus','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0x9a61,0x1e8));var _0x19a6=function(_0x3e98dd,_0x27da76){_0x3e98dd=_0x3e98dd-0x0;var _0xfea9f4=_0x9a61[_0x3e98dd];return _0xfea9f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x19a6('0x0'));var zipdir=require(_0x19a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x19a6('0x2'));var moment=require(_0x19a6('0x3'));var BPromise=require(_0x19a6('0x4'));var Mustache=require(_0x19a6('0x5'));var util=require(_0x19a6('0x6'));var path=require(_0x19a6('0x7'));var sox=require(_0x19a6('0x8'));var csv=require(_0x19a6('0x9'));var ejs=require(_0x19a6('0xa'));var fs=require('fs');var fs_extra=require(_0x19a6('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x19a6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x19a6('0xd'));var toCsv=require(_0x19a6('0x9'));var querystring=require(_0x19a6('0xe'));var Papa=require(_0x19a6('0xf'));var Redis=require(_0x19a6('0x10'));var authService=require(_0x19a6('0x11'));var qs=require(_0x19a6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x19a6('0x13'))(_0x19a6('0x14'));var utils=require(_0x19a6('0x15'));var config=require(_0x19a6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x19a6('0x17'))['db'];function respondWithStatusCode(_0x515909,_0x45eb5){_0x45eb5=_0x45eb5||0xcc;return function(_0x554623){if(_0x554623){return _0x515909['sendStatus'](_0x45eb5);}return _0x515909[_0x19a6('0x18')](_0x45eb5)[_0x19a6('0x19')]();};}function respondWithResult(_0x5278a6,_0x3a6afb){_0x3a6afb=_0x3a6afb||0xc8;return function(_0x51d167){if(_0x51d167){return _0x5278a6[_0x19a6('0x18')](_0x3a6afb)[_0x19a6('0x1a')](_0x51d167);}};}function respondWithFilteredResult(_0x3405c9,_0x65c1a9){return function(_0x378568){if(_0x378568){var _0x2ac31a=typeof _0x65c1a9[_0x19a6('0x1b')]===_0x19a6('0x1c')&&typeof _0x65c1a9[_0x19a6('0x1d')]===_0x19a6('0x1c');var _0xe01784=_0x378568[_0x19a6('0x1e')];var _0x4b887f=_0x2ac31a?0x0:_0x65c1a9[_0x19a6('0x1b')];var _0x1d4f3b=_0x2ac31a?_0x378568[_0x19a6('0x1e')]:_0x65c1a9[_0x19a6('0x1b')]+_0x65c1a9['limit'];var _0x17a863;if(_0x1d4f3b>=_0xe01784){_0x1d4f3b=_0xe01784;_0x17a863=0xc8;}else{_0x17a863=0xce;}_0x3405c9[_0x19a6('0x18')](_0x17a863);return _0x3405c9[_0x19a6('0x1f')]('Content-Range',_0x4b887f+'-'+_0x1d4f3b+'/'+_0xe01784)['json'](_0x378568);}return null;};}function patchUpdates(_0x49427d){return function(_0xcf0e29){try{jsonpatch['apply'](_0xcf0e29,_0x49427d,!![]);}catch(_0x6d698d){return BPromise['reject'](_0x6d698d);}return _0xcf0e29[_0x19a6('0x20')]();};}function saveUpdates(_0x2b97ba,_0x506afb){return function(_0x44868a){if(_0x44868a){return _0x44868a[_0x19a6('0x21')](_0x2b97ba)[_0x19a6('0x22')](function(_0x547f4a){return _0x547f4a;});}return null;};}function removeEntity(_0x29d6b9,_0x28018a){return function(_0x2bc5b6){if(_0x2bc5b6){return _0x2bc5b6[_0x19a6('0x23')]()[_0x19a6('0x22')](function(){_0x29d6b9[_0x19a6('0x18')](0xcc)[_0x19a6('0x19')]();});}};}function handleEntityNotFound(_0x2ff180,_0x12bb3b){return function(_0x120847){if(!_0x120847){_0x2ff180[_0x19a6('0x24')](0x194);}return _0x120847;};}function handleError(_0x913711,_0x287a68){_0x287a68=_0x287a68||0x1f4;return function(_0x58e2a8){logger['error'](_0x58e2a8['stack']);if(_0x58e2a8[_0x19a6('0x25')]){delete _0x58e2a8[_0x19a6('0x25')];}_0x913711['status'](_0x287a68)[_0x19a6('0x26')](_0x58e2a8);};}exports[_0x19a6('0x27')]=function(_0x4a3403,_0x142aa0){var _0x363f05={},_0x597ee7={},_0x29abc0={'count':0x0,'rows':[]};var _0x109e9b=_[_0x19a6('0x28')](db[_0x19a6('0x29')][_0x19a6('0x2a')],function(_0x30a27a){return{'name':_0x30a27a[_0x19a6('0x2b')],'type':_0x30a27a[_0x19a6('0x2c')]['key']};});_0x597ee7[_0x19a6('0x2d')]=_['map'](_0x109e9b,_0x19a6('0x25'));_0x597ee7[_0x19a6('0x2e')]=_['keys'](_0x4a3403[_0x19a6('0x2e')]);_0x597ee7[_0x19a6('0x2f')]=_[_0x19a6('0x30')](_0x597ee7[_0x19a6('0x2d')],_0x597ee7[_0x19a6('0x2e')]);_0x363f05[_0x19a6('0x31')]=_['intersection'](_0x597ee7[_0x19a6('0x2d')],qs[_0x19a6('0x32')](_0x4a3403[_0x19a6('0x2e')][_0x19a6('0x32')]));_0x363f05[_0x19a6('0x31')]=_0x363f05[_0x19a6('0x31')][_0x19a6('0x33')]?_0x363f05[_0x19a6('0x31')]:_0x597ee7[_0x19a6('0x2d')];if(!_0x4a3403[_0x19a6('0x2e')][_0x19a6('0x34')](_0x19a6('0x35'))){_0x363f05[_0x19a6('0x1d')]=qs['limit'](_0x4a3403[_0x19a6('0x2e')][_0x19a6('0x1d')]);_0x363f05[_0x19a6('0x1b')]=qs['offset'](_0x4a3403['query']['offset']);}_0x363f05['order']=qs[_0x19a6('0x36')](_0x4a3403['query']['sort']);_0x363f05[_0x19a6('0x37')]=qs[_0x19a6('0x2f')](_[_0x19a6('0x38')](_0x4a3403[_0x19a6('0x2e')],_0x597ee7[_0x19a6('0x2f')]),_0x109e9b);if(_0x4a3403['query'][_0x19a6('0x39')]){_0x363f05[_0x19a6('0x37')]=_['merge'](_0x363f05[_0x19a6('0x37')],{'$or':_[_0x19a6('0x28')](_0x109e9b,function(_0x5665c1){if(_0x5665c1[_0x19a6('0x2c')]!==_0x19a6('0x3a')){var _0x2cfc2b={};_0x2cfc2b[_0x5665c1[_0x19a6('0x25')]]={'$like':'%'+_0x4a3403[_0x19a6('0x2e')]['filter']+'%'};return _0x2cfc2b;}})});}_0x363f05=_['merge']({},_0x363f05,_0x4a3403['options']);var _0x4b2d6b={'where':_0x363f05[_0x19a6('0x37')]};return db[_0x19a6('0x29')]['count'](_0x4b2d6b)[_0x19a6('0x22')](function(_0x434266){_0x29abc0[_0x19a6('0x1e')]=_0x434266;if(_0x4a3403[_0x19a6('0x2e')]['includeAll']){_0x363f05['include']=[{'all':!![]}];}return db[_0x19a6('0x29')][_0x19a6('0x3b')](_0x363f05);})['then'](function(_0x4621b6){_0x29abc0[_0x19a6('0x3c')]=_0x4621b6;return _0x29abc0;})[_0x19a6('0x22')](respondWithFilteredResult(_0x142aa0,_0x363f05))['catch'](handleError(_0x142aa0,null));};exports[_0x19a6('0x3d')]=function(_0x2275c5,_0x4b7079){var _0x3d0fb4={'raw':![],'where':{'id':_0x2275c5[_0x19a6('0x3e')]['id']}},_0x1d1ede={};_0x1d1ede[_0x19a6('0x2d')]=_['keys'](db['SugarcrmConfiguration'][_0x19a6('0x2a')]);_0x1d1ede['query']=_['keys'](_0x2275c5[_0x19a6('0x2e')]);_0x1d1ede[_0x19a6('0x2f')]=_[_0x19a6('0x30')](_0x1d1ede['model'],_0x1d1ede[_0x19a6('0x2e')]);_0x3d0fb4[_0x19a6('0x31')]=_['intersection'](_0x1d1ede[_0x19a6('0x2d')],qs[_0x19a6('0x32')](_0x2275c5['query'][_0x19a6('0x32')]));_0x3d0fb4[_0x19a6('0x31')]=_0x3d0fb4[_0x19a6('0x31')][_0x19a6('0x33')]?_0x3d0fb4[_0x19a6('0x31')]:_0x1d1ede[_0x19a6('0x2d')];if(_0x2275c5['query']['includeAll']){_0x3d0fb4[_0x19a6('0x3f')]=[{'all':!![]}];}_0x3d0fb4=_[_0x19a6('0x40')]({},_0x3d0fb4,_0x2275c5['options']);return db[_0x19a6('0x29')][_0x19a6('0x41')](_0x3d0fb4)['then'](handleEntityNotFound(_0x4b7079,null))[_0x19a6('0x22')](respondWithResult(_0x4b7079,null))['catch'](handleError(_0x4b7079,null));};exports[_0x19a6('0x42')]=function(_0x2224c9,_0x126fee){return db[_0x19a6('0x29')][_0x19a6('0x42')](_0x2224c9[_0x19a6('0x43')],{})[_0x19a6('0x22')](respondWithResult(_0x126fee,0xc9))['catch'](handleError(_0x126fee,null));};exports['update']=function(_0x5c25b8,_0x48ea98){if(_0x5c25b8[_0x19a6('0x43')]['id']){delete _0x5c25b8[_0x19a6('0x43')]['id'];}return db[_0x19a6('0x29')][_0x19a6('0x41')]({'where':{'id':_0x5c25b8[_0x19a6('0x3e')]['id']}})[_0x19a6('0x22')](handleEntityNotFound(_0x48ea98,null))[_0x19a6('0x22')](saveUpdates(_0x5c25b8[_0x19a6('0x43')],null))[_0x19a6('0x22')](respondWithResult(_0x48ea98,null))[_0x19a6('0x44')](handleError(_0x48ea98,null));};exports[_0x19a6('0x23')]=function(_0x3cbf20,_0x3c83cc){return db[_0x19a6('0x29')][_0x19a6('0x41')]({'where':{'id':_0x3cbf20[_0x19a6('0x3e')]['id']}})[_0x19a6('0x22')](handleEntityNotFound(_0x3c83cc,null))[_0x19a6('0x22')](removeEntity(_0x3c83cc,null))[_0x19a6('0x44')](handleError(_0x3c83cc,null));};exports[_0x19a6('0x45')]=function(_0x34dbb0,_0x548fc7,_0x3b70ed){var _0x432e90={};var _0x131d30={};var _0x3b4735;var _0x54b9d8;return db['SugarcrmConfiguration'][_0x19a6('0x46')]({'where':{'id':_0x34dbb0[_0x19a6('0x3e')]['id']}})[_0x19a6('0x22')](handleEntityNotFound(_0x548fc7,null))[_0x19a6('0x22')](function(_0x46bf0c){if(_0x46bf0c){_0x3b4735=_0x46bf0c;_0x131d30['model']=_[_0x19a6('0x47')](db[_0x19a6('0x48')][_0x19a6('0x2a')]);_0x131d30['query']=_[_0x19a6('0x47')](_0x34dbb0[_0x19a6('0x2e')]);_0x131d30['filters']=_[_0x19a6('0x30')](_0x131d30[_0x19a6('0x2d')],_0x131d30[_0x19a6('0x2e')]);_0x432e90[_0x19a6('0x31')]=_[_0x19a6('0x30')](_0x131d30['model'],qs[_0x19a6('0x32')](_0x34dbb0['query'][_0x19a6('0x32')]));_0x432e90[_0x19a6('0x31')]=_0x432e90[_0x19a6('0x31')][_0x19a6('0x33')]?_0x432e90[_0x19a6('0x31')]:_0x131d30[_0x19a6('0x2d')];_0x432e90[_0x19a6('0x49')]=qs[_0x19a6('0x36')](_0x34dbb0['query'][_0x19a6('0x36')]);_0x432e90[_0x19a6('0x37')]=qs[_0x19a6('0x2f')](_['pick'](_0x34dbb0[_0x19a6('0x2e')],_0x131d30[_0x19a6('0x2f')]));if(_0x34dbb0[_0x19a6('0x2e')][_0x19a6('0x39')]){_0x432e90['where']=_[_0x19a6('0x40')](_0x432e90['where'],{'$or':_[_0x19a6('0x28')](_0x432e90[_0x19a6('0x31')],function(_0x259121){var _0x577f03={};_0x577f03[_0x259121]={'$like':'%'+_0x34dbb0[_0x19a6('0x2e')][_0x19a6('0x39')]+'%'};return _0x577f03;})});}_0x432e90=_[_0x19a6('0x40')]({},_0x432e90,_0x34dbb0['options']);return _0x3b4735['getFields'](_0x432e90);}})['then'](function(_0x4cb13a){if(_0x4cb13a){_0x54b9d8=_0x4cb13a[_0x19a6('0x33')];if(!_0x34dbb0[_0x19a6('0x2e')][_0x19a6('0x34')](_0x19a6('0x35'))){_0x432e90['limit']=qs[_0x19a6('0x1d')](_0x34dbb0['query'][_0x19a6('0x1d')]);_0x432e90[_0x19a6('0x1b')]=qs[_0x19a6('0x1b')](_0x34dbb0[_0x19a6('0x2e')][_0x19a6('0x1b')]);}return _0x3b4735[_0x19a6('0x45')](_0x432e90);}})[_0x19a6('0x22')](function(_0x1e92a7){if(_0x1e92a7){return _0x1e92a7?{'count':_0x54b9d8,'rows':_0x1e92a7}:null;}})[_0x19a6('0x22')](respondWithResult(_0x548fc7,null))[_0x19a6('0x44')](handleError(_0x548fc7,null));};exports[_0x19a6('0x4a')]=function(_0x12d535,_0xedd0e7,_0x3c92c8){var _0x10dabd={};var _0x188f9d={};var _0x59fb04;var _0x21a6ba;return db[_0x19a6('0x29')]['findOne']({'where':{'id':_0x12d535[_0x19a6('0x3e')]['id']}})[_0x19a6('0x22')](handleEntityNotFound(_0xedd0e7,null))[_0x19a6('0x22')](function(_0x2ce162){if(_0x2ce162){_0x59fb04=_0x2ce162;_0x188f9d[_0x19a6('0x2d')]=_[_0x19a6('0x47')](db[_0x19a6('0x48')][_0x19a6('0x2a')]);_0x188f9d[_0x19a6('0x2e')]=_[_0x19a6('0x47')](_0x12d535[_0x19a6('0x2e')]);_0x188f9d[_0x19a6('0x2f')]=_['intersection'](_0x188f9d[_0x19a6('0x2d')],_0x188f9d[_0x19a6('0x2e')]);_0x10dabd[_0x19a6('0x31')]=_['intersection'](_0x188f9d[_0x19a6('0x2d')],qs[_0x19a6('0x32')](_0x12d535[_0x19a6('0x2e')]['fields']));_0x10dabd[_0x19a6('0x31')]=_0x10dabd[_0x19a6('0x31')][_0x19a6('0x33')]?_0x10dabd[_0x19a6('0x31')]:_0x188f9d[_0x19a6('0x2d')];_0x10dabd[_0x19a6('0x49')]=qs[_0x19a6('0x36')](_0x12d535[_0x19a6('0x2e')][_0x19a6('0x36')]);_0x10dabd[_0x19a6('0x37')]=qs['filters'](_[_0x19a6('0x38')](_0x12d535[_0x19a6('0x2e')],_0x188f9d[_0x19a6('0x2f')]));if(_0x12d535['query'][_0x19a6('0x39')]){_0x10dabd['where']=_['merge'](_0x10dabd['where'],{'$or':_['map'](_0x10dabd[_0x19a6('0x31')],function(_0xfda308){var _0x4d5c28={};_0x4d5c28[_0xfda308]={'$like':'%'+_0x12d535['query']['filter']+'%'};return _0x4d5c28;})});}_0x10dabd=_[_0x19a6('0x40')]({},_0x10dabd,_0x12d535[_0x19a6('0x4b')]);return _0x59fb04[_0x19a6('0x4a')](_0x10dabd);}})[_0x19a6('0x22')](function(_0x429d80){if(_0x429d80){_0x21a6ba=_0x429d80[_0x19a6('0x33')];if(!_0x12d535[_0x19a6('0x2e')][_0x19a6('0x34')](_0x19a6('0x35'))){_0x10dabd['limit']=qs[_0x19a6('0x1d')](_0x12d535[_0x19a6('0x2e')][_0x19a6('0x1d')]);_0x10dabd['offset']=qs[_0x19a6('0x1b')](_0x12d535[_0x19a6('0x2e')]['offset']);}return _0x59fb04[_0x19a6('0x4a')](_0x10dabd);}})[_0x19a6('0x22')](function(_0x58b517){if(_0x58b517){return _0x58b517?{'count':_0x21a6ba,'rows':_0x58b517}:null;}})[_0x19a6('0x22')](respondWithResult(_0xedd0e7,null))[_0x19a6('0x44')](handleError(_0xedd0e7,null));};exports[_0x19a6('0x4c')]=function(_0xc1c2f0,_0x5eb85a,_0x51af14){var _0x4fa1a1={};var _0x585773={};var _0x2a632e;var _0x447407;return db['SugarcrmConfiguration'][_0x19a6('0x46')]({'where':{'id':_0xc1c2f0[_0x19a6('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5eb85a,null))['then'](function(_0x12163b){if(_0x12163b){_0x2a632e=_0x12163b;_0x585773['model']=_[_0x19a6('0x47')](db[_0x19a6('0x48')][_0x19a6('0x2a')]);_0x585773[_0x19a6('0x2e')]=_[_0x19a6('0x47')](_0xc1c2f0[_0x19a6('0x2e')]);_0x585773[_0x19a6('0x2f')]=_['intersection'](_0x585773['model'],_0x585773[_0x19a6('0x2e')]);_0x4fa1a1['attributes']=_[_0x19a6('0x30')](_0x585773[_0x19a6('0x2d')],qs[_0x19a6('0x32')](_0xc1c2f0[_0x19a6('0x2e')][_0x19a6('0x32')]));_0x4fa1a1[_0x19a6('0x31')]=_0x4fa1a1[_0x19a6('0x31')][_0x19a6('0x33')]?_0x4fa1a1['attributes']:_0x585773[_0x19a6('0x2d')];_0x4fa1a1['order']=qs[_0x19a6('0x36')](_0xc1c2f0[_0x19a6('0x2e')][_0x19a6('0x36')]);_0x4fa1a1['where']=qs[_0x19a6('0x2f')](_[_0x19a6('0x38')](_0xc1c2f0['query'],_0x585773[_0x19a6('0x2f')]));if(_0xc1c2f0[_0x19a6('0x2e')][_0x19a6('0x39')]){_0x4fa1a1[_0x19a6('0x37')]=_[_0x19a6('0x40')](_0x4fa1a1[_0x19a6('0x37')],{'$or':_[_0x19a6('0x28')](_0x4fa1a1[_0x19a6('0x31')],function(_0x2006ee){var _0x3bee87={};_0x3bee87[_0x2006ee]={'$like':'%'+_0xc1c2f0[_0x19a6('0x2e')][_0x19a6('0x39')]+'%'};return _0x3bee87;})});}_0x4fa1a1=_[_0x19a6('0x40')]({},_0x4fa1a1,_0xc1c2f0[_0x19a6('0x4b')]);return _0x2a632e[_0x19a6('0x4c')](_0x4fa1a1);}})['then'](function(_0x172eff){if(_0x172eff){_0x447407=_0x172eff[_0x19a6('0x33')];if(!_0xc1c2f0[_0x19a6('0x2e')][_0x19a6('0x34')](_0x19a6('0x35'))){_0x4fa1a1[_0x19a6('0x1d')]=qs[_0x19a6('0x1d')](_0xc1c2f0[_0x19a6('0x2e')]['limit']);_0x4fa1a1[_0x19a6('0x1b')]=qs[_0x19a6('0x1b')](_0xc1c2f0[_0x19a6('0x2e')][_0x19a6('0x1b')]);}return _0x2a632e[_0x19a6('0x4c')](_0x4fa1a1);}})[_0x19a6('0x22')](function(_0x1f413e){if(_0x1f413e){return _0x1f413e?{'count':_0x447407,'rows':_0x1f413e}:null;}})[_0x19a6('0x22')](respondWithResult(_0x5eb85a,null))[_0x19a6('0x44')](handleError(_0x5eb85a,null));}; \ No newline at end of file +var _0x3b74=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status','Content-Range','apply','reject','update','then','destroy','stack','map','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','SugarcrmConfiguration','includeAll','include','findAll','catch','show','params','length','options','create','body','find','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','squel','crypto','jsforce','to-csv'];(function(_0x2b91ac,_0x310741){var _0xe88814=function(_0x59c51b){while(--_0x59c51b){_0x2b91ac['push'](_0x2b91ac['shift']());}};_0xe88814(++_0x310741);}(_0x3b74,0x1f3));var _0x43b7=function(_0x46ef1d,_0x24926){_0x46ef1d=_0x46ef1d-0x0;var _0x49ce69=_0x3b74[_0x46ef1d];return _0x49ce69;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x43b7('0x0'));var jsonpatch=require(_0x43b7('0x1'));var rp=require(_0x43b7('0x2'));var moment=require(_0x43b7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x43b7('0x4'));var util=require('util');var path=require(_0x43b7('0x5'));var sox=require(_0x43b7('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43b7('0x7'));var _=require('lodash');var squel=require(_0x43b7('0x8'));var crypto=require(_0x43b7('0x9'));var jsforce=require(_0x43b7('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x43b7('0xb'));var querystring=require(_0x43b7('0xc'));var Papa=require('papaparse');var Redis=require(_0x43b7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x43b7('0xe'));var as=require(_0x43b7('0xf'));var hardwareService=require(_0x43b7('0x10'));var logger=require('../../config/logger')(_0x43b7('0x11'));var utils=require(_0x43b7('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x43b7('0x13'));var db=require(_0x43b7('0x14'))['db'];function respondWithStatusCode(_0x5cf36c,_0x5efb0d){_0x5efb0d=_0x5efb0d||0xcc;return function(_0x559eef){if(_0x559eef){return _0x5cf36c[_0x43b7('0x15')](_0x5efb0d);}return _0x5cf36c['status'](_0x5efb0d)[_0x43b7('0x16')]();};}function respondWithResult(_0xbc0a2b,_0x1cad52){_0x1cad52=_0x1cad52||0xc8;return function(_0x616eab){if(_0x616eab){return _0xbc0a2b['status'](_0x1cad52)[_0x43b7('0x17')](_0x616eab);}};}function respondWithFilteredResult(_0x5e8c6c,_0x2e7f14){return function(_0x50ccb7){if(_0x50ccb7){var _0x5e6be8=typeof _0x2e7f14[_0x43b7('0x18')]==='undefined'&&typeof _0x2e7f14[_0x43b7('0x19')]==='undefined';var _0x4374bf=_0x50ccb7['count'];var _0x5be41c=_0x5e6be8?0x0:_0x2e7f14[_0x43b7('0x18')];var _0x2d240f=_0x5e6be8?_0x50ccb7[_0x43b7('0x1a')]:_0x2e7f14[_0x43b7('0x18')]+_0x2e7f14[_0x43b7('0x19')];var _0x4d4713;if(_0x2d240f>=_0x4374bf){_0x2d240f=_0x4374bf;_0x4d4713=0xc8;}else{_0x4d4713=0xce;}_0x5e8c6c[_0x43b7('0x1b')](_0x4d4713);return _0x5e8c6c['set'](_0x43b7('0x1c'),_0x5be41c+'-'+_0x2d240f+'/'+_0x4374bf)[_0x43b7('0x17')](_0x50ccb7);}return null;};}function patchUpdates(_0x11f3e5){return function(_0x5d2078){try{jsonpatch[_0x43b7('0x1d')](_0x5d2078,_0x11f3e5,!![]);}catch(_0x5c89ab){return BPromise[_0x43b7('0x1e')](_0x5c89ab);}return _0x5d2078['save']();};}function saveUpdates(_0x104404,_0x25cde9){return function(_0x2c153d){if(_0x2c153d){return _0x2c153d[_0x43b7('0x1f')](_0x104404)[_0x43b7('0x20')](function(_0x50adc9){return _0x50adc9;});}return null;};}function removeEntity(_0x19aabc,_0x5a9f86){return function(_0x56c0cc){if(_0x56c0cc){return _0x56c0cc[_0x43b7('0x21')]()[_0x43b7('0x20')](function(){_0x19aabc[_0x43b7('0x1b')](0xcc)[_0x43b7('0x16')]();});}};}function handleEntityNotFound(_0x5e48e0,_0x3025ba){return function(_0x3ad5a9){if(!_0x3ad5a9){_0x5e48e0[_0x43b7('0x15')](0x194);}return _0x3ad5a9;};}function handleError(_0x170b71,_0x2074c1){_0x2074c1=_0x2074c1||0x1f4;return function(_0xa41509){logger['error'](_0xa41509[_0x43b7('0x22')]);if(_0xa41509['name']){delete _0xa41509['name'];}_0x170b71[_0x43b7('0x1b')](_0x2074c1)['send'](_0xa41509);};}exports['index']=function(_0x3d5571,_0x2967b6){var _0x10a734={},_0x53106e={},_0x143952={'count':0x0,'rows':[]};var _0x5c8244=_[_0x43b7('0x23')](db['SugarcrmConfiguration'][_0x43b7('0x24')],function(_0x2ce1bf){return{'name':_0x2ce1bf[_0x43b7('0x25')],'type':_0x2ce1bf[_0x43b7('0x26')][_0x43b7('0x27')]};});_0x53106e[_0x43b7('0x28')]=_[_0x43b7('0x23')](_0x5c8244,_0x43b7('0x29'));_0x53106e[_0x43b7('0x2a')]=_[_0x43b7('0x2b')](_0x3d5571[_0x43b7('0x2a')]);_0x53106e['filters']=_[_0x43b7('0x2c')](_0x53106e[_0x43b7('0x28')],_0x53106e[_0x43b7('0x2a')]);_0x10a734[_0x43b7('0x2d')]=_[_0x43b7('0x2c')](_0x53106e[_0x43b7('0x28')],qs['fields'](_0x3d5571['query'][_0x43b7('0x2e')]));_0x10a734[_0x43b7('0x2d')]=_0x10a734[_0x43b7('0x2d')]['length']?_0x10a734[_0x43b7('0x2d')]:_0x53106e[_0x43b7('0x28')];if(!_0x3d5571['query'][_0x43b7('0x2f')](_0x43b7('0x30'))){_0x10a734['limit']=qs[_0x43b7('0x19')](_0x3d5571[_0x43b7('0x2a')][_0x43b7('0x19')]);_0x10a734[_0x43b7('0x18')]=qs[_0x43b7('0x18')](_0x3d5571[_0x43b7('0x2a')][_0x43b7('0x18')]);}_0x10a734['order']=qs[_0x43b7('0x31')](_0x3d5571[_0x43b7('0x2a')][_0x43b7('0x31')]);_0x10a734['where']=qs[_0x43b7('0x32')](_[_0x43b7('0x33')](_0x3d5571['query'],_0x53106e[_0x43b7('0x32')]),_0x5c8244);if(_0x3d5571[_0x43b7('0x2a')][_0x43b7('0x34')]){_0x10a734['where']=_[_0x43b7('0x35')](_0x10a734[_0x43b7('0x36')],{'$or':_['map'](_0x5c8244,function(_0xce1f21){if(_0xce1f21['type']!=='VIRTUAL'){var _0x4e915a={};_0x4e915a[_0xce1f21[_0x43b7('0x29')]]={'$like':'%'+_0x3d5571[_0x43b7('0x2a')][_0x43b7('0x34')]+'%'};return _0x4e915a;}})});}_0x10a734=_[_0x43b7('0x35')]({},_0x10a734,_0x3d5571['options']);var _0x4dbb4a={'where':_0x10a734[_0x43b7('0x36')]};return db[_0x43b7('0x37')][_0x43b7('0x1a')](_0x4dbb4a)[_0x43b7('0x20')](function(_0x1e5c85){_0x143952[_0x43b7('0x1a')]=_0x1e5c85;if(_0x3d5571['query'][_0x43b7('0x38')]){_0x10a734[_0x43b7('0x39')]=[{'all':!![]}];}return db[_0x43b7('0x37')][_0x43b7('0x3a')](_0x10a734);})[_0x43b7('0x20')](function(_0x465b0f){_0x143952['rows']=_0x465b0f;return _0x143952;})[_0x43b7('0x20')](respondWithFilteredResult(_0x2967b6,_0x10a734))[_0x43b7('0x3b')](handleError(_0x2967b6,null));};exports[_0x43b7('0x3c')]=function(_0x548f02,_0x4cbccd){var _0x47f86c={'raw':![],'where':{'id':_0x548f02[_0x43b7('0x3d')]['id']}},_0x4922c5={};_0x4922c5['model']=_[_0x43b7('0x2b')](db['SugarcrmConfiguration']['rawAttributes']);_0x4922c5[_0x43b7('0x2a')]=_['keys'](_0x548f02['query']);_0x4922c5[_0x43b7('0x32')]=_['intersection'](_0x4922c5[_0x43b7('0x28')],_0x4922c5[_0x43b7('0x2a')]);_0x47f86c[_0x43b7('0x2d')]=_[_0x43b7('0x2c')](_0x4922c5[_0x43b7('0x28')],qs['fields'](_0x548f02[_0x43b7('0x2a')][_0x43b7('0x2e')]));_0x47f86c[_0x43b7('0x2d')]=_0x47f86c[_0x43b7('0x2d')][_0x43b7('0x3e')]?_0x47f86c[_0x43b7('0x2d')]:_0x4922c5[_0x43b7('0x28')];if(_0x548f02[_0x43b7('0x2a')][_0x43b7('0x38')]){_0x47f86c[_0x43b7('0x39')]=[{'all':!![]}];}_0x47f86c=_[_0x43b7('0x35')]({},_0x47f86c,_0x548f02[_0x43b7('0x3f')]);return db['SugarcrmConfiguration']['find'](_0x47f86c)[_0x43b7('0x20')](handleEntityNotFound(_0x4cbccd,null))['then'](respondWithResult(_0x4cbccd,null))[_0x43b7('0x3b')](handleError(_0x4cbccd,null));};exports[_0x43b7('0x40')]=function(_0x3cb540,_0x1f44ae){return db[_0x43b7('0x37')][_0x43b7('0x40')](_0x3cb540['body'],{})[_0x43b7('0x20')](respondWithResult(_0x1f44ae,0xc9))['catch'](handleError(_0x1f44ae,null));};exports[_0x43b7('0x1f')]=function(_0x194df1,_0x74ec41){if(_0x194df1[_0x43b7('0x41')]['id']){delete _0x194df1[_0x43b7('0x41')]['id'];}return db['SugarcrmConfiguration'][_0x43b7('0x42')]({'where':{'id':_0x194df1['params']['id']}})[_0x43b7('0x20')](handleEntityNotFound(_0x74ec41,null))[_0x43b7('0x20')](saveUpdates(_0x194df1[_0x43b7('0x41')],null))[_0x43b7('0x20')](respondWithResult(_0x74ec41,null))[_0x43b7('0x3b')](handleError(_0x74ec41,null));};exports['destroy']=function(_0x3e77f2,_0x8873a6){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x3e77f2[_0x43b7('0x3d')]['id']}})[_0x43b7('0x20')](handleEntityNotFound(_0x8873a6,null))[_0x43b7('0x20')](removeEntity(_0x8873a6,null))[_0x43b7('0x3b')](handleError(_0x8873a6,null));};exports[_0x43b7('0x43')]=function(_0x4d2d7b,_0x491285,_0x59a20c){var _0x1f74bd={};var _0x5c026b={};var _0x44b319;var _0x4847df;return db[_0x43b7('0x37')][_0x43b7('0x44')]({'where':{'id':_0x4d2d7b[_0x43b7('0x3d')]['id']}})[_0x43b7('0x20')](handleEntityNotFound(_0x491285,null))['then'](function(_0x508fc1){if(_0x508fc1){_0x44b319=_0x508fc1;_0x5c026b[_0x43b7('0x28')]=_['keys'](db[_0x43b7('0x45')]['rawAttributes']);_0x5c026b[_0x43b7('0x2a')]=_[_0x43b7('0x2b')](_0x4d2d7b['query']);_0x5c026b['filters']=_[_0x43b7('0x2c')](_0x5c026b['model'],_0x5c026b[_0x43b7('0x2a')]);_0x1f74bd[_0x43b7('0x2d')]=_[_0x43b7('0x2c')](_0x5c026b[_0x43b7('0x28')],qs[_0x43b7('0x2e')](_0x4d2d7b[_0x43b7('0x2a')]['fields']));_0x1f74bd[_0x43b7('0x2d')]=_0x1f74bd['attributes'][_0x43b7('0x3e')]?_0x1f74bd['attributes']:_0x5c026b[_0x43b7('0x28')];_0x1f74bd[_0x43b7('0x46')]=qs['sort'](_0x4d2d7b[_0x43b7('0x2a')][_0x43b7('0x31')]);_0x1f74bd[_0x43b7('0x36')]=qs[_0x43b7('0x32')](_[_0x43b7('0x33')](_0x4d2d7b[_0x43b7('0x2a')],_0x5c026b[_0x43b7('0x32')]));if(_0x4d2d7b[_0x43b7('0x2a')][_0x43b7('0x34')]){_0x1f74bd[_0x43b7('0x36')]=_[_0x43b7('0x35')](_0x1f74bd[_0x43b7('0x36')],{'$or':_[_0x43b7('0x23')](_0x1f74bd['attributes'],function(_0x57a1b5){var _0x15e005={};_0x15e005[_0x57a1b5]={'$like':'%'+_0x4d2d7b['query'][_0x43b7('0x34')]+'%'};return _0x15e005;})});}_0x1f74bd=_[_0x43b7('0x35')]({},_0x1f74bd,_0x4d2d7b[_0x43b7('0x3f')]);return _0x44b319['getFields'](_0x1f74bd);}})[_0x43b7('0x20')](function(_0x8b4728){if(_0x8b4728){_0x4847df=_0x8b4728[_0x43b7('0x3e')];if(!_0x4d2d7b[_0x43b7('0x2a')][_0x43b7('0x2f')]('nolimit')){_0x1f74bd[_0x43b7('0x19')]=qs['limit'](_0x4d2d7b['query'][_0x43b7('0x19')]);_0x1f74bd[_0x43b7('0x18')]=qs[_0x43b7('0x18')](_0x4d2d7b[_0x43b7('0x2a')]['offset']);}return _0x44b319[_0x43b7('0x43')](_0x1f74bd);}})['then'](function(_0x2995c0){if(_0x2995c0){return _0x2995c0?{'count':_0x4847df,'rows':_0x2995c0}:null;}})[_0x43b7('0x20')](respondWithResult(_0x491285,null))[_0x43b7('0x3b')](handleError(_0x491285,null));};exports[_0x43b7('0x47')]=function(_0x444974,_0x5ce405,_0x3f66d5){var _0x38ae8f={};var _0x5347a0={};var _0x4c759a;var _0x37ef9a;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x444974[_0x43b7('0x3d')]['id']}})[_0x43b7('0x20')](handleEntityNotFound(_0x5ce405,null))[_0x43b7('0x20')](function(_0x1fc198){if(_0x1fc198){_0x4c759a=_0x1fc198;_0x5347a0[_0x43b7('0x28')]=_[_0x43b7('0x2b')](db[_0x43b7('0x45')][_0x43b7('0x24')]);_0x5347a0[_0x43b7('0x2a')]=_['keys'](_0x444974['query']);_0x5347a0['filters']=_[_0x43b7('0x2c')](_0x5347a0[_0x43b7('0x28')],_0x5347a0[_0x43b7('0x2a')]);_0x38ae8f[_0x43b7('0x2d')]=_['intersection'](_0x5347a0[_0x43b7('0x28')],qs[_0x43b7('0x2e')](_0x444974['query'][_0x43b7('0x2e')]));_0x38ae8f['attributes']=_0x38ae8f[_0x43b7('0x2d')]['length']?_0x38ae8f[_0x43b7('0x2d')]:_0x5347a0[_0x43b7('0x28')];_0x38ae8f['order']=qs[_0x43b7('0x31')](_0x444974[_0x43b7('0x2a')][_0x43b7('0x31')]);_0x38ae8f[_0x43b7('0x36')]=qs[_0x43b7('0x32')](_[_0x43b7('0x33')](_0x444974[_0x43b7('0x2a')],_0x5347a0[_0x43b7('0x32')]));if(_0x444974[_0x43b7('0x2a')]['filter']){_0x38ae8f[_0x43b7('0x36')]=_[_0x43b7('0x35')](_0x38ae8f['where'],{'$or':_[_0x43b7('0x23')](_0x38ae8f['attributes'],function(_0x400eb8){var _0xf856c5={};_0xf856c5[_0x400eb8]={'$like':'%'+_0x444974[_0x43b7('0x2a')]['filter']+'%'};return _0xf856c5;})});}_0x38ae8f=_[_0x43b7('0x35')]({},_0x38ae8f,_0x444974['options']);return _0x4c759a['getSubjects'](_0x38ae8f);}})[_0x43b7('0x20')](function(_0x2a1b51){if(_0x2a1b51){_0x37ef9a=_0x2a1b51[_0x43b7('0x3e')];if(!_0x444974['query'][_0x43b7('0x2f')](_0x43b7('0x30'))){_0x38ae8f['limit']=qs['limit'](_0x444974['query'][_0x43b7('0x19')]);_0x38ae8f[_0x43b7('0x18')]=qs[_0x43b7('0x18')](_0x444974[_0x43b7('0x2a')][_0x43b7('0x18')]);}return _0x4c759a[_0x43b7('0x47')](_0x38ae8f);}})['then'](function(_0x2cf8fa){if(_0x2cf8fa){return _0x2cf8fa?{'count':_0x37ef9a,'rows':_0x2cf8fa}:null;}})[_0x43b7('0x20')](respondWithResult(_0x5ce405,null))['catch'](handleError(_0x5ce405,null));};exports[_0x43b7('0x48')]=function(_0x1668b5,_0x324550,_0x482a84){var _0x112707={};var _0x55448f={};var _0x466a1f;var _0x45909a;return db[_0x43b7('0x37')][_0x43b7('0x44')]({'where':{'id':_0x1668b5[_0x43b7('0x3d')]['id']}})[_0x43b7('0x20')](handleEntityNotFound(_0x324550,null))[_0x43b7('0x20')](function(_0x5a3d49){if(_0x5a3d49){_0x466a1f=_0x5a3d49;_0x55448f[_0x43b7('0x28')]=_[_0x43b7('0x2b')](db[_0x43b7('0x45')][_0x43b7('0x24')]);_0x55448f['query']=_[_0x43b7('0x2b')](_0x1668b5['query']);_0x55448f[_0x43b7('0x32')]=_['intersection'](_0x55448f[_0x43b7('0x28')],_0x55448f[_0x43b7('0x2a')]);_0x112707[_0x43b7('0x2d')]=_[_0x43b7('0x2c')](_0x55448f[_0x43b7('0x28')],qs[_0x43b7('0x2e')](_0x1668b5['query'][_0x43b7('0x2e')]));_0x112707['attributes']=_0x112707[_0x43b7('0x2d')][_0x43b7('0x3e')]?_0x112707['attributes']:_0x55448f['model'];_0x112707[_0x43b7('0x46')]=qs[_0x43b7('0x31')](_0x1668b5[_0x43b7('0x2a')][_0x43b7('0x31')]);_0x112707['where']=qs[_0x43b7('0x32')](_[_0x43b7('0x33')](_0x1668b5['query'],_0x55448f[_0x43b7('0x32')]));if(_0x1668b5['query']['filter']){_0x112707['where']=_[_0x43b7('0x35')](_0x112707[_0x43b7('0x36')],{'$or':_[_0x43b7('0x23')](_0x112707[_0x43b7('0x2d')],function(_0x4318bf){var _0x54188a={};_0x54188a[_0x4318bf]={'$like':'%'+_0x1668b5[_0x43b7('0x2a')][_0x43b7('0x34')]+'%'};return _0x54188a;})});}_0x112707=_[_0x43b7('0x35')]({},_0x112707,_0x1668b5['options']);return _0x466a1f[_0x43b7('0x48')](_0x112707);}})[_0x43b7('0x20')](function(_0x2505aa){if(_0x2505aa){_0x45909a=_0x2505aa[_0x43b7('0x3e')];if(!_0x1668b5[_0x43b7('0x2a')][_0x43b7('0x2f')](_0x43b7('0x30'))){_0x112707[_0x43b7('0x19')]=qs['limit'](_0x1668b5['query'][_0x43b7('0x19')]);_0x112707[_0x43b7('0x18')]=qs['offset'](_0x1668b5[_0x43b7('0x2a')]['offset']);}return _0x466a1f[_0x43b7('0x48')](_0x112707);}})['then'](function(_0x46253e){if(_0x46253e){return _0x46253e?{'count':_0x45909a,'rows':_0x46253e}:null;}})['then'](respondWithResult(_0x324550,null))[_0x43b7('0x3b')](handleError(_0x324550,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 9d1bf09..1096f12 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 _0x21a7=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x46266b,_0x29c9a4){var _0x1f08d6=function(_0x39760d){while(--_0x39760d){_0x46266b['push'](_0x46266b['shift']());}};_0x1f08d6(++_0x29c9a4);}(_0x21a7,0xd1));var _0x721a=function(_0x1db75c,_0x58a560){_0x1db75c=_0x1db75c-0x0;var _0x16542a=_0x21a7[_0x1db75c];return _0x16542a;};'use strict';var _=require(_0x721a('0x0'));var util=require(_0x721a('0x1'));var logger=require(_0x721a('0x2'))(_0x721a('0x3'));var moment=require(_0x721a('0x4'));var BPromise=require(_0x721a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x721a('0x6'));var rimraf=require(_0x721a('0x7'));var config=require(_0x721a('0x8'));var attributes=require(_0x721a('0x9'));module[_0x721a('0xa')]=function(_0x3ecd42,_0x359eac){return _0x3ecd42[_0x721a('0xb')]('SugarcrmConfiguration',attributes,{'tableName':_0x721a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb37=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api'];(function(_0x1620c5,_0x24e835){var _0x254a31=function(_0x47795e){while(--_0x47795e){_0x1620c5['push'](_0x1620c5['shift']());}};_0x254a31(++_0x24e835);}(_0xeb37,0x114));var _0x7eb3=function(_0x1d7881,_0x5db24d){_0x1d7881=_0x1d7881-0x0;var _0x11d21e=_0xeb37[_0x1d7881];return _0x11d21e;};'use strict';var _=require(_0x7eb3('0x0'));var util=require(_0x7eb3('0x1'));var logger=require(_0x7eb3('0x2'))(_0x7eb3('0x3'));var moment=require(_0x7eb3('0x4'));var BPromise=require(_0x7eb3('0x5'));var rp=require(_0x7eb3('0x6'));var fs=require('fs');var path=require(_0x7eb3('0x7'));var rimraf=require(_0x7eb3('0x8'));var config=require(_0x7eb3('0x9'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x7eb3('0xa')]=function(_0x529766,_0xacf757){return _0x529766[_0x7eb3('0xb')](_0x7eb3('0xc'),attributes,{'tableName':_0x7eb3('0xd'),'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 81d267a..27e4797 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 _0x2db5=['code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x488b31,_0x3b3519){var _0x3822a3=function(_0x50d890){while(--_0x50d890){_0x488b31['push'](_0x488b31['shift']());}};_0x3822a3(++_0x3b3519);}(_0x2db5,0x191));var _0x52db=function(_0x2b9d5c,_0x173518){_0x2b9d5c=_0x2b9d5c-0x0;var _0x37bb93=_0x2db5[_0x2b9d5c];return _0x37bb93;};'use strict';var _=require(_0x52db('0x0'));var util=require(_0x52db('0x1'));var moment=require(_0x52db('0x2'));var BPromise=require(_0x52db('0x3'));var rs=require(_0x52db('0x4'));var fs=require('fs');var Redis=require(_0x52db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x52db('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x52db('0x7'));var jayson=require(_0x52db('0x8'));var client=jayson[_0x52db('0x9')][_0x52db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b990f,_0xf790b7,_0xb3bf3){return new BPromise(function(_0x5e8149,_0x381b5b){return client[_0x52db('0xb')](_0x5b990f,_0xb3bf3)[_0x52db('0xc')](function(_0x298f55){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0xf790b7,'request\x20sent');logger['debug'](_0x52db('0xd'),_0xf790b7,_0x52db('0xe'),JSON[_0x52db('0xf')](_0x298f55));if(_0x298f55[_0x52db('0x10')]){if(_0x298f55[_0x52db('0x10')][_0x52db('0x11')]===0x1f4){logger[_0x52db('0x10')](_0x52db('0x12'),_0xf790b7,_0x298f55[_0x52db('0x10')]['message']);return _0x381b5b(_0x298f55[_0x52db('0x10')][_0x52db('0x13')]);}logger[_0x52db('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xf790b7,_0x298f55[_0x52db('0x10')][_0x52db('0x13')]);return _0x5e8149(_0x298f55[_0x52db('0x10')][_0x52db('0x13')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0xf790b7,_0x52db('0xe'));_0x5e8149(_0x298f55[_0x52db('0x14')][_0x52db('0x13')]);}})[_0x52db('0x15')](function(_0x19d29e){logger[_0x52db('0x10')](_0x52db('0x12'),_0xf790b7,_0x19d29e);_0x381b5b(_0x19d29e);});});} \ No newline at end of file +var _0x117b=['error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2b5775,_0x4e146c){var _0x57adbc=function(_0x32bb78){while(--_0x32bb78){_0x2b5775['push'](_0x2b5775['shift']());}};_0x57adbc(++_0x4e146c);}(_0x117b,0x16d));var _0xb117=function(_0x4da2db,_0x112e8c){_0x4da2db=_0x4da2db-0x0;var _0x37ffc0=_0x117b[_0x4da2db];return _0x37ffc0;};'use strict';var _=require(_0xb117('0x0'));var util=require(_0xb117('0x1'));var moment=require('moment');var BPromise=require(_0xb117('0x2'));var rs=require(_0xb117('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb117('0x4'))['db'];var utils=require(_0xb117('0x5'));var logger=require(_0xb117('0x6'))(_0xb117('0x7'));var config=require(_0xb117('0x8'));var jayson=require(_0xb117('0x9'));var client=jayson[_0xb117('0xa')][_0xb117('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e9488,_0x258536,_0x37a58f){return new BPromise(function(_0x1133f3,_0x345122){return client[_0xb117('0xc')](_0x4e9488,_0x37a58f)[_0xb117('0xd')](function(_0x20b8bd){logger[_0xb117('0xe')](_0xb117('0xf'),_0x258536,_0xb117('0x10'));logger[_0xb117('0x11')](_0xb117('0x12'),_0x258536,_0xb117('0x10'),JSON['stringify'](_0x20b8bd));if(_0x20b8bd['error']){if(_0x20b8bd[_0xb117('0x13')][_0xb117('0x14')]===0x1f4){logger[_0xb117('0x13')](_0xb117('0xf'),_0x258536,_0x20b8bd[_0xb117('0x13')]['message']);return _0x345122(_0x20b8bd[_0xb117('0x13')][_0xb117('0x15')]);}logger[_0xb117('0x13')](_0xb117('0xf'),_0x258536,_0x20b8bd['error'][_0xb117('0x15')]);return _0x1133f3(_0x20b8bd[_0xb117('0x13')]['message']);}else{logger['info'](_0xb117('0xf'),_0x258536,_0xb117('0x10'));_0x1133f3(_0x20b8bd[_0xb117('0x16')][_0xb117('0x15')]);}})[_0xb117('0x17')](function(_0x53d4d2){logger[_0xb117('0x13')](_0xb117('0xf'),_0x258536,_0x53d4d2);_0x345122(_0x53d4d2);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index b1b6f76..9a976a9 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 _0x02eb=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','create'];(function(_0x355193,_0x394d3e){var _0x1e6904=function(_0x26db84){while(--_0x26db84){_0x355193['push'](_0x355193['shift']());}};_0x1e6904(++_0x394d3e);}(_0x02eb,0xe2));var _0xb02e=function(_0x53c02a,_0x1c906b){_0x53c02a=_0x53c02a-0x0;var _0x1e9ac9=_0x02eb[_0x53c02a];return _0x1e9ac9;};'use strict';var multer=require(_0xb02e('0x0'));var util=require(_0xb02e('0x1'));var path=require(_0xb02e('0x2'));var timeout=require(_0xb02e('0x3'));var express=require(_0xb02e('0x4'));var router=express[_0xb02e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb02e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb02e('0x7'));var controller=require(_0xb02e('0x8'));router[_0xb02e('0x9')]('/',auth[_0xb02e('0xa')](),controller[_0xb02e('0xb')]);router[_0xb02e('0x9')]('/:id',auth[_0xb02e('0xa')](),controller[_0xb02e('0xc')]);router['post']('/',auth[_0xb02e('0xa')](),controller[_0xb02e('0xd')]);router[_0xb02e('0xe')](_0xb02e('0xf'),auth[_0xb02e('0xa')](),controller[_0xb02e('0x10')]);router[_0xb02e('0x11')](_0xb02e('0xf'),auth[_0xb02e('0xa')](),controller[_0xb02e('0x12')]);module[_0xb02e('0x13')]=router; \ No newline at end of file +var _0x8bd3=['index','/:id','show','isAuthenticated','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x57ab21,_0x1dd9ac){var _0x449ac4=function(_0x43d6e2){while(--_0x43d6e2){_0x57ab21['push'](_0x57ab21['shift']());}};_0x449ac4(++_0x1dd9ac);}(_0x8bd3,0x170));var _0x38bd=function(_0x1b1365,_0x205568){_0x1b1365=_0x1b1365-0x0;var _0x5edfd8=_0x8bd3[_0x1b1365];return _0x5edfd8;};'use strict';var multer=require(_0x38bd('0x0'));var util=require(_0x38bd('0x1'));var path=require(_0x38bd('0x2'));var timeout=require(_0x38bd('0x3'));var express=require(_0x38bd('0x4'));var router=express[_0x38bd('0x5')]();var fs_extra=require(_0x38bd('0x6'));var auth=require(_0x38bd('0x7'));var interaction=require(_0x38bd('0x8'));var config=require(_0x38bd('0x9'));var controller=require(_0x38bd('0xa'));router[_0x38bd('0xb')]('/',auth['isAuthenticated'](),controller[_0x38bd('0xc')]);router['get'](_0x38bd('0xd'),auth['isAuthenticated'](),controller[_0x38bd('0xe')]);router['post']('/',auth[_0x38bd('0xf')](),controller['create']);router[_0x38bd('0x10')](_0x38bd('0xd'),auth[_0x38bd('0xf')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x38bd('0x11')]);module[_0x38bd('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 080fb87..b2ea2bb 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 _0x5149=['sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x17cafc,_0x2b3019){var _0x3b32d3=function(_0x5a8fa5){while(--_0x5a8fa5){_0x17cafc['push'](_0x17cafc['shift']());}};_0x3b32d3(++_0x2b3019);}(_0x5149,0x1cc));var _0x9514=function(_0x2a9479,_0x394989){_0x2a9479=_0x2a9479-0x0;var _0x472b13=_0x5149[_0x2a9479];return _0x472b13;};'use strict';var Sequelize=require(_0x9514('0x0'));module[_0x9514('0x1')]={'type':{'type':Sequelize[_0x9514('0x2')](_0x9514('0x3'),'variable',_0x9514('0x4'),_0x9514('0x5'),_0x9514('0x6')),'defaultValue':_0x9514('0x3')},'content':{'type':Sequelize[_0x9514('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9514('0x2')](_0x9514('0x3'),_0x9514('0x8'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9514('0x7')]},'nameField':{'type':Sequelize[_0x9514('0x7')]},'customField':{'type':Sequelize[_0x9514('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9514('0x7')]}}; \ No newline at end of file +var _0xabe0=['picklist','STRING','variable','exports','ENUM','customVariable','keyValue'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xabe0,0x168));var _0x0abe=function(_0x204a8e,_0x2c9b7d){_0x204a8e=_0x204a8e-0x0;var _0x413acb=_0xabe0[_0x204a8e];return _0x413acb;};'use strict';var Sequelize=require('sequelize');module[_0x0abe('0x0')]={'type':{'type':Sequelize[_0x0abe('0x1')]('string','variable',_0x0abe('0x2'),_0x0abe('0x3'),_0x0abe('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0abe('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0abe('0x1')]('string',_0x0abe('0x6'),_0x0abe('0x2'))},'keyContent':{'type':Sequelize[_0x0abe('0x5')]},'idField':{'type':Sequelize[_0x0abe('0x5')]},'nameField':{'type':Sequelize[_0x0abe('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c27374a..0774ff9 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 _0x6335=['papaparse','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','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SugarcrmField','count','findAll','rows','catch','show','params','filters','include','create','body','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring'];(function(_0x53497d,_0x530a14){var _0x5dfe2a=function(_0x354661){while(--_0x354661){_0x53497d['push'](_0x53497d['shift']());}};_0x5dfe2a(++_0x530a14);}(_0x6335,0xcf));var _0x5633=function(_0x2b2142,_0x9a4580){_0x2b2142=_0x2b2142-0x0;var _0x23f060=_0x6335[_0x2b2142];return _0x23f060;};'use strict';var emlformat=require(_0x5633('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5633('0x1'));var rp=require(_0x5633('0x2'));var moment=require(_0x5633('0x3'));var BPromise=require(_0x5633('0x4'));var Mustache=require(_0x5633('0x5'));var util=require(_0x5633('0x6'));var path=require(_0x5633('0x7'));var sox=require(_0x5633('0x8'));var csv=require(_0x5633('0x9'));var ejs=require(_0x5633('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5633('0xb'));var crypto=require(_0x5633('0xc'));var jsforce=require(_0x5633('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5633('0x9'));var querystring=require(_0x5633('0xe'));var Papa=require(_0x5633('0xf'));var Redis=require(_0x5633('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5633('0x11'));var as=require(_0x5633('0x12'));var hardwareService=require(_0x5633('0x13'));var logger=require(_0x5633('0x14'))(_0x5633('0x15'));var utils=require(_0x5633('0x16'));var config=require(_0x5633('0x17'));var licenseUtil=require(_0x5633('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x486757,_0x24308c){_0x24308c=_0x24308c||0xcc;return function(_0x474093){if(_0x474093){return _0x486757[_0x5633('0x19')](_0x24308c);}return _0x486757[_0x5633('0x1a')](_0x24308c)[_0x5633('0x1b')]();};}function respondWithResult(_0x16fe6e,_0x3cb8bd){_0x3cb8bd=_0x3cb8bd||0xc8;return function(_0x173dc5){if(_0x173dc5){return _0x16fe6e[_0x5633('0x1a')](_0x3cb8bd)[_0x5633('0x1c')](_0x173dc5);}};}function respondWithFilteredResult(_0x468dec,_0x30e8a1){return function(_0x9d9995){if(_0x9d9995){var _0x4b194e=typeof _0x30e8a1[_0x5633('0x1d')]===_0x5633('0x1e')&&typeof _0x30e8a1[_0x5633('0x1f')]===_0x5633('0x1e');var _0x26dbdc=_0x9d9995['count'];var _0x46f4b8=_0x4b194e?0x0:_0x30e8a1[_0x5633('0x1d')];var _0x37a14c=_0x4b194e?_0x9d9995['count']:_0x30e8a1[_0x5633('0x1d')]+_0x30e8a1['limit'];var _0x86752c;if(_0x37a14c>=_0x26dbdc){_0x37a14c=_0x26dbdc;_0x86752c=0xc8;}else{_0x86752c=0xce;}_0x468dec[_0x5633('0x1a')](_0x86752c);return _0x468dec[_0x5633('0x20')](_0x5633('0x21'),_0x46f4b8+'-'+_0x37a14c+'/'+_0x26dbdc)['json'](_0x9d9995);}return null;};}function patchUpdates(_0x236c51){return function(_0x46df72){try{jsonpatch[_0x5633('0x22')](_0x46df72,_0x236c51,!![]);}catch(_0x5b56b8){return BPromise[_0x5633('0x23')](_0x5b56b8);}return _0x46df72[_0x5633('0x24')]();};}function saveUpdates(_0x111bf6,_0x2feb10){return function(_0x1af652){if(_0x1af652){return _0x1af652[_0x5633('0x25')](_0x111bf6)[_0x5633('0x26')](function(_0x54ec7d){return _0x54ec7d;});}return null;};}function removeEntity(_0x57f47b,_0x582ac9){return function(_0x107b47){if(_0x107b47){return _0x107b47[_0x5633('0x27')]()[_0x5633('0x26')](function(){_0x57f47b['status'](0xcc)[_0x5633('0x1b')]();});}};}function handleEntityNotFound(_0x4015cd,_0x4f7e54){return function(_0x552f73){if(!_0x552f73){_0x4015cd['sendStatus'](0x194);}return _0x552f73;};}function handleError(_0x5bcb82,_0x5e024b){_0x5e024b=_0x5e024b||0x1f4;return function(_0x3d2b8d){logger[_0x5633('0x28')](_0x3d2b8d[_0x5633('0x29')]);if(_0x3d2b8d[_0x5633('0x2a')]){delete _0x3d2b8d['name'];}_0x5bcb82['status'](_0x5e024b)['send'](_0x3d2b8d);};}exports[_0x5633('0x2b')]=function(_0x884df9,_0x1b24e9){var _0x466a28={},_0x59b149={},_0x5c0ef6={'count':0x0,'rows':[]};var _0x1ef061=_[_0x5633('0x2c')](db['SugarcrmField'][_0x5633('0x2d')],function(_0x1e9182){return{'name':_0x1e9182['fieldName'],'type':_0x1e9182['type']['key']};});_0x59b149[_0x5633('0x2e')]=_['map'](_0x1ef061,_0x5633('0x2a'));_0x59b149['query']=_[_0x5633('0x2f')](_0x884df9[_0x5633('0x30')]);_0x59b149['filters']=_['intersection'](_0x59b149[_0x5633('0x2e')],_0x59b149[_0x5633('0x30')]);_0x466a28['attributes']=_[_0x5633('0x31')](_0x59b149[_0x5633('0x2e')],qs[_0x5633('0x32')](_0x884df9[_0x5633('0x30')][_0x5633('0x32')]));_0x466a28[_0x5633('0x33')]=_0x466a28['attributes'][_0x5633('0x34')]?_0x466a28[_0x5633('0x33')]:_0x59b149[_0x5633('0x2e')];if(!_0x884df9[_0x5633('0x30')][_0x5633('0x35')](_0x5633('0x36'))){_0x466a28[_0x5633('0x1f')]=qs[_0x5633('0x1f')](_0x884df9[_0x5633('0x30')][_0x5633('0x1f')]);_0x466a28[_0x5633('0x1d')]=qs[_0x5633('0x1d')](_0x884df9[_0x5633('0x30')][_0x5633('0x1d')]);}_0x466a28[_0x5633('0x37')]=qs[_0x5633('0x38')](_0x884df9['query'][_0x5633('0x38')]);_0x466a28[_0x5633('0x39')]=qs['filters'](_['pick'](_0x884df9['query'],_0x59b149['filters']),_0x1ef061);if(_0x884df9[_0x5633('0x30')][_0x5633('0x3a')]){_0x466a28[_0x5633('0x39')]=_[_0x5633('0x3b')](_0x466a28['where'],{'$or':_[_0x5633('0x2c')](_0x1ef061,function(_0x3074e4){if(_0x3074e4['type']!==_0x5633('0x3c')){var _0x5f168b={};_0x5f168b[_0x3074e4[_0x5633('0x2a')]]={'$like':'%'+_0x884df9['query'][_0x5633('0x3a')]+'%'};return _0x5f168b;}})});}_0x466a28=_[_0x5633('0x3b')]({},_0x466a28,_0x884df9[_0x5633('0x3d')]);var _0x4ce229={'where':_0x466a28[_0x5633('0x39')]};return db[_0x5633('0x3e')][_0x5633('0x3f')](_0x4ce229)[_0x5633('0x26')](function(_0x4aae32){_0x5c0ef6['count']=_0x4aae32;if(_0x884df9[_0x5633('0x30')]['includeAll']){_0x466a28['include']=[{'all':!![]}];}return db[_0x5633('0x3e')][_0x5633('0x40')](_0x466a28);})[_0x5633('0x26')](function(_0x438f58){_0x5c0ef6[_0x5633('0x41')]=_0x438f58;return _0x5c0ef6;})['then'](respondWithFilteredResult(_0x1b24e9,_0x466a28))[_0x5633('0x42')](handleError(_0x1b24e9,null));};exports[_0x5633('0x43')]=function(_0x962e30,_0x4fe878){var _0x4a1206={'raw':!![],'where':{'id':_0x962e30[_0x5633('0x44')]['id']}},_0x50ffb3={};_0x50ffb3['model']=_[_0x5633('0x2f')](db['SugarcrmField'][_0x5633('0x2d')]);_0x50ffb3[_0x5633('0x30')]=_[_0x5633('0x2f')](_0x962e30[_0x5633('0x30')]);_0x50ffb3[_0x5633('0x45')]=_['intersection'](_0x50ffb3[_0x5633('0x2e')],_0x50ffb3[_0x5633('0x30')]);_0x4a1206[_0x5633('0x33')]=_[_0x5633('0x31')](_0x50ffb3[_0x5633('0x2e')],qs[_0x5633('0x32')](_0x962e30['query'][_0x5633('0x32')]));_0x4a1206[_0x5633('0x33')]=_0x4a1206['attributes'][_0x5633('0x34')]?_0x4a1206[_0x5633('0x33')]:_0x50ffb3[_0x5633('0x2e')];if(_0x962e30[_0x5633('0x30')]['includeAll']){_0x4a1206[_0x5633('0x46')]=[{'all':!![]}];}_0x4a1206=_['merge']({},_0x4a1206,_0x962e30['options']);return db[_0x5633('0x3e')]['find'](_0x4a1206)[_0x5633('0x26')](handleEntityNotFound(_0x4fe878,null))[_0x5633('0x26')](respondWithResult(_0x4fe878,null))['catch'](handleError(_0x4fe878,null));};exports['create']=function(_0x20b85a,_0x3e38be){return db[_0x5633('0x3e')][_0x5633('0x47')](_0x20b85a[_0x5633('0x48')],{})[_0x5633('0x26')](respondWithResult(_0x3e38be,0xc9))[_0x5633('0x42')](handleError(_0x3e38be,null));};exports[_0x5633('0x25')]=function(_0x4dd32b,_0x348014){if(_0x4dd32b[_0x5633('0x48')]['id']){delete _0x4dd32b[_0x5633('0x48')]['id'];}return db[_0x5633('0x3e')][_0x5633('0x49')]({'where':{'id':_0x4dd32b[_0x5633('0x44')]['id']}})[_0x5633('0x26')](handleEntityNotFound(_0x348014,null))[_0x5633('0x26')](saveUpdates(_0x4dd32b['body'],null))[_0x5633('0x26')](respondWithResult(_0x348014,null))[_0x5633('0x42')](handleError(_0x348014,null));};exports['destroy']=function(_0x30d7b9,_0x24af2a){return db[_0x5633('0x3e')]['find']({'where':{'id':_0x30d7b9[_0x5633('0x44')]['id']}})[_0x5633('0x26')](handleEntityNotFound(_0x24af2a,null))[_0x5633('0x26')](removeEntity(_0x24af2a,null))[_0x5633('0x42')](handleError(_0x24af2a,null));}; \ No newline at end of file +var _0x0680=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','send','index','map','SugarcrmField','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x0680,0x1af));var _0x0068=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0680[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0068('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0068('0x1'));var rp=require(_0x0068('0x2'));var moment=require(_0x0068('0x3'));var BPromise=require(_0x0068('0x4'));var Mustache=require(_0x0068('0x5'));var util=require(_0x0068('0x6'));var path=require(_0x0068('0x7'));var sox=require('sox');var csv=require(_0x0068('0x8'));var ejs=require(_0x0068('0x9'));var fs=require('fs');var fs_extra=require(_0x0068('0xa'));var _=require(_0x0068('0xb'));var squel=require(_0x0068('0xc'));var crypto=require(_0x0068('0xd'));var jsforce=require(_0x0068('0xe'));var deskjs=require(_0x0068('0xf'));var toCsv=require(_0x0068('0x8'));var querystring=require(_0x0068('0x10'));var Papa=require(_0x0068('0x11'));var Redis=require(_0x0068('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0068('0x13'));var hardwareService=require(_0x0068('0x14'));var logger=require(_0x0068('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x0068('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0068('0x17'))['db'];function respondWithStatusCode(_0x5e5531,_0x3282cf){_0x3282cf=_0x3282cf||0xcc;return function(_0x59d591){if(_0x59d591){return _0x5e5531[_0x0068('0x18')](_0x3282cf);}return _0x5e5531[_0x0068('0x19')](_0x3282cf)[_0x0068('0x1a')]();};}function respondWithResult(_0x3d142d,_0x524fc5){_0x524fc5=_0x524fc5||0xc8;return function(_0x5c4508){if(_0x5c4508){return _0x3d142d['status'](_0x524fc5)[_0x0068('0x1b')](_0x5c4508);}};}function respondWithFilteredResult(_0x4d002f,_0x3da490){return function(_0x5c3040){if(_0x5c3040){var _0x1c7a19=typeof _0x3da490['offset']===_0x0068('0x1c')&&typeof _0x3da490[_0x0068('0x1d')]===_0x0068('0x1c');var _0x14e138=_0x5c3040[_0x0068('0x1e')];var _0x1f66e3=_0x1c7a19?0x0:_0x3da490[_0x0068('0x1f')];var _0x46e391=_0x1c7a19?_0x5c3040[_0x0068('0x1e')]:_0x3da490[_0x0068('0x1f')]+_0x3da490['limit'];var _0x49651c;if(_0x46e391>=_0x14e138){_0x46e391=_0x14e138;_0x49651c=0xc8;}else{_0x49651c=0xce;}_0x4d002f[_0x0068('0x19')](_0x49651c);return _0x4d002f[_0x0068('0x20')](_0x0068('0x21'),_0x1f66e3+'-'+_0x46e391+'/'+_0x14e138)[_0x0068('0x1b')](_0x5c3040);}return null;};}function patchUpdates(_0x16b132){return function(_0x107aa2){try{jsonpatch[_0x0068('0x22')](_0x107aa2,_0x16b132,!![]);}catch(_0x3dacbf){return BPromise[_0x0068('0x23')](_0x3dacbf);}return _0x107aa2[_0x0068('0x24')]();};}function saveUpdates(_0xeb355,_0x4ac59e){return function(_0xb2ea70){if(_0xb2ea70){return _0xb2ea70[_0x0068('0x25')](_0xeb355)['then'](function(_0x514d7b){return _0x514d7b;});}return null;};}function removeEntity(_0x29ce0a,_0x38abab){return function(_0x57f2aa){if(_0x57f2aa){return _0x57f2aa[_0x0068('0x26')]()[_0x0068('0x27')](function(){_0x29ce0a[_0x0068('0x19')](0xcc)[_0x0068('0x1a')]();});}};}function handleEntityNotFound(_0x1162dd,_0x2001de){return function(_0x44bdfb){if(!_0x44bdfb){_0x1162dd[_0x0068('0x18')](0x194);}return _0x44bdfb;};}function handleError(_0x4ea551,_0xe9aa19){_0xe9aa19=_0xe9aa19||0x1f4;return function(_0x422010){logger['error'](_0x422010['stack']);if(_0x422010['name']){delete _0x422010['name'];}_0x4ea551[_0x0068('0x19')](_0xe9aa19)[_0x0068('0x28')](_0x422010);};}exports[_0x0068('0x29')]=function(_0x4adad3,_0x5aa473){var _0x2f1663={},_0x1050c7={},_0x30a8b9={'count':0x0,'rows':[]};var _0x54caed=_[_0x0068('0x2a')](db[_0x0068('0x2b')][_0x0068('0x2c')],function(_0x7cc9b1){return{'name':_0x7cc9b1['fieldName'],'type':_0x7cc9b1['type']['key']};});_0x1050c7[_0x0068('0x2d')]=_['map'](_0x54caed,'name');_0x1050c7[_0x0068('0x2e')]=_[_0x0068('0x2f')](_0x4adad3['query']);_0x1050c7[_0x0068('0x30')]=_[_0x0068('0x31')](_0x1050c7[_0x0068('0x2d')],_0x1050c7[_0x0068('0x2e')]);_0x2f1663[_0x0068('0x32')]=_['intersection'](_0x1050c7['model'],qs[_0x0068('0x33')](_0x4adad3[_0x0068('0x2e')][_0x0068('0x33')]));_0x2f1663['attributes']=_0x2f1663['attributes'][_0x0068('0x34')]?_0x2f1663[_0x0068('0x32')]:_0x1050c7[_0x0068('0x2d')];if(!_0x4adad3[_0x0068('0x2e')][_0x0068('0x35')](_0x0068('0x36'))){_0x2f1663[_0x0068('0x1d')]=qs[_0x0068('0x1d')](_0x4adad3[_0x0068('0x2e')][_0x0068('0x1d')]);_0x2f1663['offset']=qs['offset'](_0x4adad3[_0x0068('0x2e')][_0x0068('0x1f')]);}_0x2f1663['order']=qs[_0x0068('0x37')](_0x4adad3['query'][_0x0068('0x37')]);_0x2f1663[_0x0068('0x38')]=qs['filters'](_[_0x0068('0x39')](_0x4adad3[_0x0068('0x2e')],_0x1050c7[_0x0068('0x30')]),_0x54caed);if(_0x4adad3[_0x0068('0x2e')][_0x0068('0x3a')]){_0x2f1663[_0x0068('0x38')]=_[_0x0068('0x3b')](_0x2f1663[_0x0068('0x38')],{'$or':_[_0x0068('0x2a')](_0x54caed,function(_0x3e35a9){if(_0x3e35a9['type']!==_0x0068('0x3c')){var _0x257957={};_0x257957[_0x3e35a9[_0x0068('0x3d')]]={'$like':'%'+_0x4adad3[_0x0068('0x2e')]['filter']+'%'};return _0x257957;}})});}_0x2f1663=_[_0x0068('0x3b')]({},_0x2f1663,_0x4adad3[_0x0068('0x3e')]);var _0x52ece7={'where':_0x2f1663['where']};return db[_0x0068('0x2b')][_0x0068('0x1e')](_0x52ece7)[_0x0068('0x27')](function(_0x59bd34){_0x30a8b9[_0x0068('0x1e')]=_0x59bd34;if(_0x4adad3[_0x0068('0x2e')][_0x0068('0x3f')]){_0x2f1663[_0x0068('0x40')]=[{'all':!![]}];}return db[_0x0068('0x2b')][_0x0068('0x41')](_0x2f1663);})[_0x0068('0x27')](function(_0x3a2301){_0x30a8b9[_0x0068('0x42')]=_0x3a2301;return _0x30a8b9;})[_0x0068('0x27')](respondWithFilteredResult(_0x5aa473,_0x2f1663))[_0x0068('0x43')](handleError(_0x5aa473,null));};exports[_0x0068('0x44')]=function(_0x56259b,_0x5b1189){var _0x336973={'raw':!![],'where':{'id':_0x56259b[_0x0068('0x45')]['id']}},_0x310a13={};_0x310a13['model']=_['keys'](db[_0x0068('0x2b')][_0x0068('0x2c')]);_0x310a13[_0x0068('0x2e')]=_[_0x0068('0x2f')](_0x56259b['query']);_0x310a13['filters']=_[_0x0068('0x31')](_0x310a13[_0x0068('0x2d')],_0x310a13[_0x0068('0x2e')]);_0x336973[_0x0068('0x32')]=_[_0x0068('0x31')](_0x310a13[_0x0068('0x2d')],qs[_0x0068('0x33')](_0x56259b[_0x0068('0x2e')]['fields']));_0x336973[_0x0068('0x32')]=_0x336973[_0x0068('0x32')]['length']?_0x336973['attributes']:_0x310a13['model'];if(_0x56259b[_0x0068('0x2e')][_0x0068('0x3f')]){_0x336973['include']=[{'all':!![]}];}_0x336973=_[_0x0068('0x3b')]({},_0x336973,_0x56259b[_0x0068('0x3e')]);return db[_0x0068('0x2b')][_0x0068('0x46')](_0x336973)[_0x0068('0x27')](handleEntityNotFound(_0x5b1189,null))['then'](respondWithResult(_0x5b1189,null))['catch'](handleError(_0x5b1189,null));};exports[_0x0068('0x47')]=function(_0x39673e,_0x3693c2){return db['SugarcrmField'][_0x0068('0x47')](_0x39673e[_0x0068('0x48')],{})[_0x0068('0x27')](respondWithResult(_0x3693c2,0xc9))[_0x0068('0x43')](handleError(_0x3693c2,null));};exports[_0x0068('0x25')]=function(_0xe076b3,_0x433cd3){if(_0xe076b3[_0x0068('0x48')]['id']){delete _0xe076b3[_0x0068('0x48')]['id'];}return db['SugarcrmField'][_0x0068('0x46')]({'where':{'id':_0xe076b3[_0x0068('0x45')]['id']}})['then'](handleEntityNotFound(_0x433cd3,null))[_0x0068('0x27')](saveUpdates(_0xe076b3[_0x0068('0x48')],null))[_0x0068('0x27')](respondWithResult(_0x433cd3,null))[_0x0068('0x43')](handleError(_0x433cd3,null));};exports[_0x0068('0x26')]=function(_0x4fae87,_0x13a556){return db[_0x0068('0x2b')][_0x0068('0x46')]({'where':{'id':_0x4fae87[_0x0068('0x45')]['id']}})['then'](handleEntityNotFound(_0x13a556,null))[_0x0068('0x27')](removeEntity(_0x13a556,null))[_0x0068('0x43')](handleError(_0x13a556,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 9909a9b..659e49b 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 _0x423e=['idField','FieldId','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x18c2dc,_0xb9441d){var _0x48fb3d=function(_0x401cc8){while(--_0x401cc8){_0x18c2dc['push'](_0x18c2dc['shift']());}};_0x48fb3d(++_0xb9441d);}(_0x423e,0x14c));var _0xe423=function(_0x6fabdb,_0x168fcd){_0x6fabdb=_0x6fabdb-0x0;var _0x58c0c2=_0x423e[_0x6fabdb];return _0x58c0c2;};'use strict';var _=require('lodash');var util=require(_0xe423('0x0'));var logger=require(_0xe423('0x1'))(_0xe423('0x2'));var moment=require(_0xe423('0x3'));var BPromise=require(_0xe423('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe423('0x5'));var rimraf=require(_0xe423('0x6'));var config=require(_0xe423('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0xe423('0x8')]=function(_0x5d0010,_0x4ffd0f){return _0x5d0010[_0xe423('0x9')](_0xe423('0xa'),attributes,{'tableName':_0xe423('0xb'),'paranoid':![],'indexes':[{'name':_0xe423('0xc'),'fields':[_0xe423('0xd'),_0xe423('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a91=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','sugarcrm_unique_index','idField'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0x5a91,0x84));var _0x15a9=function(_0x55f03a,_0x22516e){_0x55f03a=_0x55f03a-0x0;var _0x4574b7=_0x5a91[_0x55f03a];return _0x4574b7;};'use strict';var _=require(_0x15a9('0x0'));var util=require(_0x15a9('0x1'));var logger=require(_0x15a9('0x2'))(_0x15a9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x15a9('0x4'));var fs=require('fs');var path=require(_0x15a9('0x5'));var rimraf=require(_0x15a9('0x6'));var config=require(_0x15a9('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0x15a9('0x8')]=function(_0x15bb7b,_0x1d84f2){return _0x15bb7b[_0x15a9('0x9')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x15a9('0xa'),'fields':[_0x15a9('0xb'),'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 d67343e..8cd5ef1 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 _0x9d24=['SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x5e9c99,_0x5bca7c){var _0x549562=function(_0x12b23f){while(--_0x12b23f){_0x5e9c99['push'](_0x5e9c99['shift']());}};_0x549562(++_0x5bca7c);}(_0x9d24,0x175));var _0x49d2=function(_0x5e3a1b,_0x3226c3){_0x5e3a1b=_0x5e3a1b-0x0;var _0x21bf76=_0x9d24[_0x5e3a1b];return _0x21bf76;};'use strict';var _=require(_0x49d2('0x0'));var util=require(_0x49d2('0x1'));var moment=require(_0x49d2('0x2'));var BPromise=require(_0x49d2('0x3'));var rs=require(_0x49d2('0x4'));var fs=require('fs');var Redis=require(_0x49d2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x49d2('0x6'));var logger=require(_0x49d2('0x7'))(_0x49d2('0x8'));var config=require(_0x49d2('0x9'));var jayson=require(_0x49d2('0xa'));var client=jayson[_0x49d2('0xb')][_0x49d2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x597b3f,_0x35b638,_0x2baf49){return new BPromise(function(_0xb1dac6,_0x217c50){return client[_0x49d2('0xd')](_0x597b3f,_0x2baf49)[_0x49d2('0xe')](function(_0x462365){logger[_0x49d2('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x35b638,'request\x20sent');logger[_0x49d2('0x10')](_0x49d2('0x11'),_0x35b638,_0x49d2('0x12'),JSON[_0x49d2('0x13')](_0x462365));if(_0x462365[_0x49d2('0x14')]){if(_0x462365[_0x49d2('0x14')][_0x49d2('0x15')]===0x1f4){logger['error'](_0x49d2('0x16'),_0x35b638,_0x462365[_0x49d2('0x14')][_0x49d2('0x17')]);return _0x217c50(_0x462365[_0x49d2('0x14')]['message']);}logger[_0x49d2('0x14')](_0x49d2('0x16'),_0x35b638,_0x462365['error']['message']);return _0xb1dac6(_0x462365[_0x49d2('0x14')][_0x49d2('0x17')]);}else{logger[_0x49d2('0xf')](_0x49d2('0x16'),_0x35b638,_0x49d2('0x12'));_0xb1dac6(_0x462365[_0x49d2('0x18')]['message']);}})[_0x49d2('0x19')](function(_0x1d04b5){logger[_0x49d2('0x14')](_0x49d2('0x16'),_0x35b638,_0x1d04b5);_0x217c50(_0x1d04b5);});});} \ No newline at end of file +var _0x477c=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','request\x20sent','debug','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','lodash'];(function(_0x3960a9,_0x1c6799){var _0x5ba06f=function(_0x24e3e5){while(--_0x24e3e5){_0x3960a9['push'](_0x3960a9['shift']());}};_0x5ba06f(++_0x1c6799);}(_0x477c,0xf6));var _0xc477=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x477c[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xc477('0x0'));var util=require(_0xc477('0x1'));var moment=require(_0xc477('0x2'));var BPromise=require('bluebird');var rs=require(_0xc477('0x3'));var fs=require('fs');var Redis=require(_0xc477('0x4'));var db=require(_0xc477('0x5'))['db'];var utils=require(_0xc477('0x6'));var logger=require(_0xc477('0x7'))(_0xc477('0x8'));var config=require(_0xc477('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc477('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x257a9f,_0x10dc6e,_0x49534c){return new BPromise(function(_0x52ec37,_0x5a069c){return client['request'](_0x257a9f,_0x49534c)['then'](function(_0x212ec7){logger[_0xc477('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x10dc6e,_0xc477('0xc'));logger[_0xc477('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x10dc6e,_0xc477('0xc'),JSON[_0xc477('0xe')](_0x212ec7));if(_0x212ec7[_0xc477('0xf')]){if(_0x212ec7[_0xc477('0xf')][_0xc477('0x10')]===0x1f4){logger[_0xc477('0xf')](_0xc477('0x11'),_0x10dc6e,_0x212ec7[_0xc477('0xf')][_0xc477('0x12')]);return _0x5a069c(_0x212ec7[_0xc477('0xf')][_0xc477('0x12')]);}logger[_0xc477('0xf')](_0xc477('0x11'),_0x10dc6e,_0x212ec7[_0xc477('0xf')][_0xc477('0x12')]);return _0x52ec37(_0x212ec7['error'][_0xc477('0x12')]);}else{logger[_0xc477('0xb')](_0xc477('0x11'),_0x10dc6e,_0xc477('0xc'));_0x52ec37(_0x212ec7['result'][_0xc477('0x12')]);}})['catch'](function(_0x265298){logger[_0xc477('0xf')](_0xc477('0x11'),_0x10dc6e,_0x265298);_0x5a069c(_0x265298);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 46b29d6..03a827b 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 _0x70e9=['post','create','addConfiguration','put','update','delete','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x2fd2c6,_0x50553b){var _0x20cc81=function(_0x192be3){while(--_0x192be3){_0x2fd2c6['push'](_0x2fd2c6['shift']());}};_0x20cc81(++_0x50553b);}(_0x70e9,0x193));var _0x970e=function(_0x43b757,_0x2274ef){_0x43b757=_0x43b757-0x0;var _0x556af2=_0x70e9[_0x43b757];return _0x556af2;};'use strict';var multer=require('multer');var util=require(_0x970e('0x0'));var path=require(_0x970e('0x1'));var timeout=require('connect-timeout');var express=require(_0x970e('0x2'));var router=express[_0x970e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x970e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x970e('0x5'));var controller=require(_0x970e('0x6'));router[_0x970e('0x7')]('/',auth[_0x970e('0x8')](),controller[_0x970e('0x9')]);router[_0x970e('0x7')](_0x970e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x970e('0x7')](_0x970e('0xb'),auth['isAuthenticated'](),controller[_0x970e('0xc')]);router[_0x970e('0x7')](_0x970e('0xd'),auth['isAuthenticated'](),controller[_0x970e('0xe')]);router[_0x970e('0xf')]('/',auth[_0x970e('0x8')](),controller[_0x970e('0x10')]);router[_0x970e('0xf')](_0x970e('0xb'),auth['isAuthenticated'](),controller[_0x970e('0x11')]);router[_0x970e('0x12')](_0x970e('0xa'),auth[_0x970e('0x8')](),controller[_0x970e('0x13')]);router[_0x970e('0x14')](_0x970e('0xa'),auth[_0x970e('0x8')](),controller['destroy']);module[_0x970e('0x15')]=router; \ No newline at end of file +var _0x49cb=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','getFields','post','create','put','update'];(function(_0x3860f9,_0x2d1690){var _0x21f922=function(_0x50debb){while(--_0x50debb){_0x3860f9['push'](_0x3860f9['shift']());}};_0x21f922(++_0x2d1690);}(_0x49cb,0x1e6));var _0xb49c=function(_0x1dc82c,_0x4f43eb){_0x1dc82c=_0x1dc82c-0x0;var _0x39b34a=_0x49cb[_0x1dc82c];return _0x39b34a;};'use strict';var multer=require(_0xb49c('0x0'));var util=require(_0xb49c('0x1'));var path=require(_0xb49c('0x2'));var timeout=require(_0xb49c('0x3'));var express=require(_0xb49c('0x4'));var router=express[_0xb49c('0x5')]();var fs_extra=require(_0xb49c('0x6'));var auth=require(_0xb49c('0x7'));var interaction=require(_0xb49c('0x8'));var config=require(_0xb49c('0x9'));var controller=require(_0xb49c('0xa'));router[_0xb49c('0xb')]('/',auth[_0xb49c('0xc')](),controller['index']);router[_0xb49c('0xb')](_0xb49c('0xd'),auth[_0xb49c('0xc')](),controller[_0xb49c('0xe')]);router[_0xb49c('0xb')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xb49c('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0xb49c('0xf')]);router[_0xb49c('0x10')]('/',auth['isAuthenticated'](),controller[_0xb49c('0x11')]);router[_0xb49c('0x10')]('/:id/configurations',auth[_0xb49c('0xc')](),controller['addConfiguration']);router[_0xb49c('0x12')](_0xb49c('0xd'),auth[_0xb49c('0xc')](),controller[_0xb49c('0x13')]);router['delete'](_0xb49c('0xd'),auth['isAuthenticated'](),controller[_0xb49c('0x14')]);module[_0xb49c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index efd3744..6918ddb 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 _0x62bc=['HelpDesk','exports','STRING'];(function(_0x4b8cd6,_0x1ca27f){var _0x58126e=function(_0x24c099){while(--_0x24c099){_0x4b8cd6['push'](_0x4b8cd6['shift']());}};_0x58126e(++_0x1ca27f);}(_0x62bc,0x19f));var _0xc62b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62bc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc62b('0x0')]={'name':{'type':Sequelize[_0xc62b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc62b('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc62b('0x1')],'allowNull':![],'defaultValue':_0xc62b('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xc62b('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x58d7=['STRING','sequelize','exports'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x58d7,0x16f));var _0x758d=function(_0x407e79,_0x2ab526){_0x407e79=_0x407e79-0x0;var _0x2621a8=_0x58d7[_0x407e79];return _0x2621a8;};'use strict';var Sequelize=require(_0x758d('0x0'));module[_0x758d('0x1')]={'name':{'type':Sequelize[_0x758d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x758d('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x758d('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 52644d4..e0f585d 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 _0x1740=['json','reject','save','update','then','destroy','error','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','params','length','include','find','create','body','findOne','VtigerConfiguration','order','options','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','description','moduleName','serverUrl','accessKey','username','remoteUri','slice','substring','lastIndexOf','%s/webservice.php','getchallenge','POST','login','result','success','GET','describe','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x697a85,_0x238db2){var _0x4a6ba9=function(_0x4e70b7){while(--_0x4e70b7){_0x697a85['push'](_0x697a85['shift']());}};_0x4a6ba9(++_0x238db2);}(_0x1740,0x146));var _0x0174=function(_0x5d1ee9,_0x4f3fac){_0x5d1ee9=_0x5d1ee9-0x0;var _0x4b4aea=_0x1740[_0x5d1ee9];return _0x4b4aea;};'use strict';var emlformat=require(_0x0174('0x0'));var rimraf=require(_0x0174('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0174('0x2'));var moment=require('moment');var BPromise=require(_0x0174('0x3'));var Mustache=require(_0x0174('0x4'));var util=require(_0x0174('0x5'));var path=require(_0x0174('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0174('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0174('0x8'));var squel=require(_0x0174('0x9'));var crypto=require('crypto');var jsforce=require(_0x0174('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0174('0xb'));var Papa=require(_0x0174('0xc'));var Redis=require('ioredis');var authService=require(_0x0174('0xd'));var qs=require(_0x0174('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0174('0xf'));var logger=require(_0x0174('0x10'))(_0x0174('0x11'));var utils=require(_0x0174('0x12'));var config=require(_0x0174('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0174('0x14'))['db'];var integrations=require(_0x0174('0x15'));function respondWithStatusCode(_0x4a913a,_0x19400a){_0x19400a=_0x19400a||0xcc;return function(_0x23bda4){if(_0x23bda4){return _0x4a913a[_0x0174('0x16')](_0x19400a);}return _0x4a913a['status'](_0x19400a)[_0x0174('0x17')]();};}function respondWithResult(_0x394442,_0x41652a){_0x41652a=_0x41652a||0xc8;return function(_0x344fbf){if(_0x344fbf){return _0x394442[_0x0174('0x18')](_0x41652a)['json'](_0x344fbf);}};}function respondWithFilteredResult(_0x1a17fe,_0x193c02){return function(_0x3b5497){if(_0x3b5497){var _0x560245=typeof _0x193c02[_0x0174('0x19')]===_0x0174('0x1a')&&typeof _0x193c02[_0x0174('0x1b')]==='undefined';var _0x35f9c5=_0x3b5497[_0x0174('0x1c')];var _0x407907=_0x560245?0x0:_0x193c02[_0x0174('0x19')];var _0x55dd3d=_0x560245?_0x3b5497['count']:_0x193c02['offset']+_0x193c02['limit'];var _0x3afedd;if(_0x55dd3d>=_0x35f9c5){_0x55dd3d=_0x35f9c5;_0x3afedd=0xc8;}else{_0x3afedd=0xce;}_0x1a17fe['status'](_0x3afedd);return _0x1a17fe[_0x0174('0x1d')](_0x0174('0x1e'),_0x407907+'-'+_0x55dd3d+'/'+_0x35f9c5)[_0x0174('0x1f')](_0x3b5497);}return null;};}function patchUpdates(_0x1dc8f8){return function(_0x328cc7){try{jsonpatch['apply'](_0x328cc7,_0x1dc8f8,!![]);}catch(_0x260fc3){return BPromise[_0x0174('0x20')](_0x260fc3);}return _0x328cc7[_0x0174('0x21')]();};}function saveUpdates(_0x5c2f39,_0x22d5f1){return function(_0x31aab8){if(_0x31aab8){return _0x31aab8[_0x0174('0x22')](_0x5c2f39)[_0x0174('0x23')](function(_0xbe625b){return _0xbe625b;});}return null;};}function removeEntity(_0x3c9b47,_0x25964c){return function(_0x4651dc){if(_0x4651dc){return _0x4651dc[_0x0174('0x24')]()['then'](function(){_0x3c9b47[_0x0174('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x249ea8,_0x5ba18c){return function(_0x108c7d){if(!_0x108c7d){_0x249ea8['sendStatus'](0x194);}return _0x108c7d;};}function handleError(_0x5221e0,_0x425c42){_0x425c42=_0x425c42||0x1f4;return function(_0x3d6c2d){logger[_0x0174('0x25')](_0x3d6c2d[_0x0174('0x26')]);if(_0x3d6c2d[_0x0174('0x27')]){delete _0x3d6c2d[_0x0174('0x27')];}_0x5221e0['status'](_0x425c42)[_0x0174('0x28')](_0x3d6c2d);};}exports['index']=function(_0x1eb406,_0x51a134){var _0x1a1180={},_0x245409={},_0x2c7516={'count':0x0,'rows':[]};var _0x2424b5=_[_0x0174('0x29')](db[_0x0174('0x2a')][_0x0174('0x2b')],function(_0x2185e3){return{'name':_0x2185e3[_0x0174('0x2c')],'type':_0x2185e3[_0x0174('0x2d')]['key']};});_0x245409[_0x0174('0x2e')]=_[_0x0174('0x29')](_0x2424b5,_0x0174('0x27'));_0x245409[_0x0174('0x2f')]=_[_0x0174('0x30')](_0x1eb406['query']);_0x245409[_0x0174('0x31')]=_[_0x0174('0x32')](_0x245409[_0x0174('0x2e')],_0x245409[_0x0174('0x2f')]);_0x1a1180[_0x0174('0x33')]=_['intersection'](_0x245409['model'],qs[_0x0174('0x34')](_0x1eb406['query'][_0x0174('0x34')]));_0x1a1180[_0x0174('0x33')]=_0x1a1180[_0x0174('0x33')]['length']?_0x1a1180[_0x0174('0x33')]:_0x245409['model'];if(!_0x1eb406[_0x0174('0x2f')][_0x0174('0x35')](_0x0174('0x36'))){_0x1a1180[_0x0174('0x1b')]=qs[_0x0174('0x1b')](_0x1eb406[_0x0174('0x2f')][_0x0174('0x1b')]);_0x1a1180[_0x0174('0x19')]=qs[_0x0174('0x19')](_0x1eb406[_0x0174('0x2f')][_0x0174('0x19')]);}_0x1a1180['order']=qs[_0x0174('0x37')](_0x1eb406['query'][_0x0174('0x37')]);_0x1a1180['where']=qs[_0x0174('0x31')](_[_0x0174('0x38')](_0x1eb406['query'],_0x245409['filters']),_0x2424b5);if(_0x1eb406[_0x0174('0x2f')][_0x0174('0x39')]){_0x1a1180[_0x0174('0x3a')]=_[_0x0174('0x3b')](_0x1a1180[_0x0174('0x3a')],{'$or':_[_0x0174('0x29')](_0x2424b5,function(_0x142f26){if(_0x142f26[_0x0174('0x2d')]!==_0x0174('0x3c')){var _0x44b206={};_0x44b206[_0x142f26[_0x0174('0x27')]]={'$like':'%'+_0x1eb406[_0x0174('0x2f')][_0x0174('0x39')]+'%'};return _0x44b206;}})});}_0x1a1180=_['merge']({},_0x1a1180,_0x1eb406['options']);var _0x1f4c92={'where':_0x1a1180[_0x0174('0x3a')]};return db[_0x0174('0x2a')][_0x0174('0x1c')](_0x1f4c92)[_0x0174('0x23')](function(_0x569c99){_0x2c7516[_0x0174('0x1c')]=_0x569c99;if(_0x1eb406[_0x0174('0x2f')][_0x0174('0x3d')]){_0x1a1180['include']=[{'all':!![]}];}return db[_0x0174('0x2a')][_0x0174('0x3e')](_0x1a1180);})[_0x0174('0x23')](function(_0x42ae39){_0x2c7516['rows']=_0x42ae39;return _0x2c7516;})['then'](respondWithFilteredResult(_0x51a134,_0x1a1180))[_0x0174('0x3f')](handleError(_0x51a134,null));};exports[_0x0174('0x40')]=function(_0x59efc1,_0x18a8f8){var _0x1c2e4a={'raw':![],'where':{'id':_0x59efc1[_0x0174('0x41')]['id']}},_0x11a35a={};_0x11a35a[_0x0174('0x2e')]=_[_0x0174('0x30')](db[_0x0174('0x2a')][_0x0174('0x2b')]);_0x11a35a['query']=_[_0x0174('0x30')](_0x59efc1['query']);_0x11a35a[_0x0174('0x31')]=_['intersection'](_0x11a35a[_0x0174('0x2e')],_0x11a35a[_0x0174('0x2f')]);_0x1c2e4a[_0x0174('0x33')]=_[_0x0174('0x32')](_0x11a35a['model'],qs[_0x0174('0x34')](_0x59efc1['query'][_0x0174('0x34')]));_0x1c2e4a[_0x0174('0x33')]=_0x1c2e4a[_0x0174('0x33')][_0x0174('0x42')]?_0x1c2e4a[_0x0174('0x33')]:_0x11a35a[_0x0174('0x2e')];if(_0x59efc1[_0x0174('0x2f')][_0x0174('0x3d')]){_0x1c2e4a[_0x0174('0x43')]=[{'all':!![]}];}_0x1c2e4a=_[_0x0174('0x3b')]({},_0x1c2e4a,_0x59efc1['options']);return db[_0x0174('0x2a')][_0x0174('0x44')](_0x1c2e4a)[_0x0174('0x23')](handleEntityNotFound(_0x18a8f8,null))['then'](respondWithResult(_0x18a8f8,null))['catch'](handleError(_0x18a8f8,null));};exports['create']=function(_0x5b9899,_0x1a77a6){return db[_0x0174('0x2a')][_0x0174('0x45')](_0x5b9899[_0x0174('0x46')],{})['then'](respondWithResult(_0x1a77a6,0xc9))[_0x0174('0x3f')](handleError(_0x1a77a6,null));};exports[_0x0174('0x22')]=function(_0x550e49,_0x473adb){if(_0x550e49[_0x0174('0x46')]['id']){delete _0x550e49[_0x0174('0x46')]['id'];}return db[_0x0174('0x2a')]['find']({'where':{'id':_0x550e49[_0x0174('0x41')]['id']}})[_0x0174('0x23')](handleEntityNotFound(_0x473adb,null))[_0x0174('0x23')](saveUpdates(_0x550e49[_0x0174('0x46')],null))[_0x0174('0x23')](respondWithResult(_0x473adb,null))[_0x0174('0x3f')](handleError(_0x473adb,null));};exports[_0x0174('0x24')]=function(_0x2ccdcf,_0x4d51ff){return db[_0x0174('0x2a')]['find']({'where':{'id':_0x2ccdcf[_0x0174('0x41')]['id']}})['then'](handleEntityNotFound(_0x4d51ff,null))['then'](removeEntity(_0x4d51ff,null))['catch'](handleError(_0x4d51ff,null));};exports['getConfigurations']=function(_0x1bd337,_0x132192,_0x541603){var _0x3d1e6c={};var _0x1946ce={};var _0x41e083;var _0x285caf;return db[_0x0174('0x2a')][_0x0174('0x47')]({'where':{'id':_0x1bd337[_0x0174('0x41')]['id']}})[_0x0174('0x23')](handleEntityNotFound(_0x132192,null))[_0x0174('0x23')](function(_0x35e1f1){if(_0x35e1f1){_0x41e083=_0x35e1f1;_0x1946ce[_0x0174('0x2e')]=_['keys'](db[_0x0174('0x48')][_0x0174('0x2b')]);_0x1946ce[_0x0174('0x2f')]=_['keys'](_0x1bd337[_0x0174('0x2f')]);_0x1946ce[_0x0174('0x31')]=_[_0x0174('0x32')](_0x1946ce[_0x0174('0x2e')],_0x1946ce[_0x0174('0x2f')]);_0x3d1e6c['attributes']=_[_0x0174('0x32')](_0x1946ce[_0x0174('0x2e')],qs['fields'](_0x1bd337[_0x0174('0x2f')]['fields']));_0x3d1e6c[_0x0174('0x33')]=_0x3d1e6c[_0x0174('0x33')][_0x0174('0x42')]?_0x3d1e6c[_0x0174('0x33')]:_0x1946ce[_0x0174('0x2e')];_0x3d1e6c[_0x0174('0x49')]=qs[_0x0174('0x37')](_0x1bd337[_0x0174('0x2f')][_0x0174('0x37')]);_0x3d1e6c['where']=qs[_0x0174('0x31')](_['pick'](_0x1bd337[_0x0174('0x2f')],_0x1946ce[_0x0174('0x31')]));if(_0x1bd337[_0x0174('0x2f')][_0x0174('0x39')]){_0x3d1e6c[_0x0174('0x3a')]=_[_0x0174('0x3b')](_0x3d1e6c[_0x0174('0x3a')],{'$or':_['map'](_0x3d1e6c[_0x0174('0x33')],function(_0x2b69db){var _0x173154={};_0x173154[_0x2b69db]={'$like':'%'+_0x1bd337['query'][_0x0174('0x39')]+'%'};return _0x173154;})});}_0x3d1e6c=_[_0x0174('0x3b')]({},_0x3d1e6c,_0x1bd337[_0x0174('0x4a')]);return _0x41e083[_0x0174('0x4b')](_0x3d1e6c);}})[_0x0174('0x23')](function(_0x504b77){if(_0x504b77){_0x285caf=_0x504b77[_0x0174('0x42')];if(!_0x1bd337['query']['hasOwnProperty'](_0x0174('0x36'))){_0x3d1e6c[_0x0174('0x1b')]=qs['limit'](_0x1bd337['query'][_0x0174('0x1b')]);_0x3d1e6c[_0x0174('0x19')]=qs[_0x0174('0x19')](_0x1bd337[_0x0174('0x2f')][_0x0174('0x19')]);}return _0x41e083[_0x0174('0x4b')](_0x3d1e6c);}})[_0x0174('0x23')](function(_0x35d5b3){if(_0x35d5b3){return _0x35d5b3?{'count':_0x285caf,'rows':_0x35d5b3}:null;}})[_0x0174('0x23')](respondWithResult(_0x132192,null))[_0x0174('0x3f')](handleError(_0x132192,null));};exports[_0x0174('0x4c')]=function(_0x35a221,_0x4cfd4c,_0x35a840){if(_0x35a221[_0x0174('0x46')]['id']){delete _0x35a221[_0x0174('0x46')]['id'];}return db[_0x0174('0x2a')][_0x0174('0x47')]({'where':{'id':_0x35a221[_0x0174('0x41')]['id']}})[_0x0174('0x23')](handleEntityNotFound(_0x4cfd4c,null))['then'](function(_0x285dd0){if(_0x285dd0){_0x35a221[_0x0174('0x46')][_0x0174('0x4d')]=_0x285dd0['id'];_0x35a221[_0x0174('0x46')][_0x0174('0x4e')]=integrations['getSubjects'](_0x35a221[_0x0174('0x46')][_0x0174('0x4f')],_0x35a221['body'][_0x0174('0x2d')]);_0x35a221[_0x0174('0x46')][_0x0174('0x50')]=integrations[_0x0174('0x51')](_0x35a221[_0x0174('0x46')][_0x0174('0x4f')],_0x35a221[_0x0174('0x46')]['type']);return db[_0x0174('0x48')][_0x0174('0x45')](_0x35a221[_0x0174('0x46')],{'include':[{'model':db[_0x0174('0x52')],'as':_0x0174('0x4e')},{'model':db[_0x0174('0x52')],'as':_0x0174('0x50')}]});}return null;})[_0x0174('0x23')](respondWithResult(_0x4cfd4c,null))[_0x0174('0x3f')](handleError(_0x4cfd4c,null));};var md5=require(_0x0174('0x53'));exports['getFields']=function(_0x4708b4,_0x527939,_0x2cce25){var _0x2b83b9=null;var _0x2d3197=null;var _0xd68301=null;var _0x1f8d82=null;var _0xfc0ab4='';return db[_0x0174('0x2a')]['findOne']({'where':{'id':_0x4708b4[_0x0174('0x41')]['id']},'attributes':['id',_0x0174('0x27'),'username',_0x0174('0x54'),_0x0174('0x55'),'remoteUri',_0x0174('0x56'),_0x0174('0x57')]})[_0x0174('0x23')](handleEntityNotFound(_0x527939,null))[_0x0174('0x23')](function(_0x444e5a){if(_0x444e5a){_0x2b83b9=_0x444e5a[_0x0174('0x58')];_0x2d3197=_0x444e5a[_0x0174('0x57')];_0xd68301=_0x444e5a['moduleName'];_0xfc0ab4=_0x444e5a[_0x0174('0x59')];var _0x5bc87d=_0xfc0ab4[_0x0174('0x5a')](-0x1);if(_0x5bc87d==='/'){_0xfc0ab4=_0xfc0ab4[_0x0174('0x5b')](0x0,_0xfc0ab4[_0x0174('0x5c')](_0x5bc87d));}_0x1f8d82=util['format'](_0x0174('0x5d'),_0xfc0ab4);var _0x10d341={'method':'GET','uri':_0x1f8d82,'qs':{'operation':_0x0174('0x5e'),'username':_0x444e5a[_0x0174('0x58')]},'json':!![]};return rp(_0x10d341);}})[_0x0174('0x23')](function(_0x433d85){if(_0x433d85['success']){var _0x59a785={'method':_0x0174('0x5f'),'uri':_0x1f8d82,'form':{'operation':_0x0174('0x60'),'username':_0x2b83b9,'accessKey':md5(_0x433d85[_0x0174('0x61')]['token']+_0x2d3197)},'json':!![]};return rp(_0x59a785);}})[_0x0174('0x23')](function(_0x55c8ca){if(_0x55c8ca[_0x0174('0x62')]){var _0x3b73f1={'method':_0x0174('0x63'),'uri':_0x1f8d82,'qs':{'operation':_0x0174('0x64'),'username':_0x2b83b9,'sessionName':_0x55c8ca[_0x0174('0x61')]['sessionName'],'elementType':_0xd68301},'json':!![]};return rp(_0x3b73f1);}})[_0x0174('0x23')](function(_0x86f153){if(_0x86f153[_0x0174('0x62')]){var _0x4808f3=[_0x0174('0x65'),_0x0174('0x66'),_0x0174('0x67')];_[_0x0174('0x68')](_0x86f153[_0x0174('0x61')]['fields'],function(_0x1f10e9){return _0x4808f3[_0x0174('0x69')](_0x1f10e9[_0x0174('0x2d')][_0x0174('0x27')]);});_[_0x0174('0x68')](_0x86f153[_0x0174('0x61')][_0x0174('0x34')],function(_0xecde14){return _0xecde14[_0x0174('0x6a')]===_0x0174('0x6b');});return{'count':_0x86f153[_0x0174('0x61')][_0x0174('0x34')][_0x0174('0x42')],'rows':_['map'](_0x86f153[_0x0174('0x61')][_0x0174('0x34')],function(_0x23047c){return{'id':_0x23047c['name'],'name':_0x23047c[_0x0174('0x6c')],'custom':_[_0x0174('0x6d')](_0x23047c[_0x0174('0x27')],_0x0174('0x6e'))?!![]:![],'options':_0x23047c['type'][_0x0174('0x27')]===_0x0174('0x6f')&&_0x23047c[_0x0174('0x2d')]['picklistValues'][_0x0174('0x42')]>0x0?_['map'](_0x23047c[_0x0174('0x2d')][_0x0174('0x70')],function(_0x5846b4){return{'name':_0x5846b4['label'],'value':_0x5846b4[_0x0174('0x71')]};}):[]};})};}})[_0x0174('0x23')](respondWithResult(_0x527939,null))[_0x0174('0x3f')](function(_0xd1aa04){console['log'](_0x0174('0x72')+_0xd1aa04);var _0x3eb983=_0x4708b4[_0x0174('0x2f')][_0x0174('0x73')]?0x1f4:_0xd1aa04['statusCode']||0x1f4;logger[_0x0174('0x25')](_0x0174('0x74'),'getFields',_0x3eb983,JSON[_0x0174('0x75')](_0xd1aa04));delete _0xd1aa04['name'];if(_0x3eb983===0x191){_0x3eb983=0x190;}_0x527939[_0x0174('0x18')](_0x3eb983)[_0x0174('0x28')](_0x4708b4['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0xd1aa04[_0x0174('0x76')]}:_0xd1aa04);});}; \ No newline at end of file +var _0x9d89=['params','findOne','VtigerConfiguration','pick','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','serverUrl','accessKey','slice','substring','format','%s/webservice.php','GET','getchallenge','success','POST','result','token','describe','sessionName','autogenerated','reference','owner','remove','editable','startsWith','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','map','VtigerAccount','rawAttributes','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','includeAll','findAll','rows','catch','show','keys','include','options','create','body','find'];(function(_0x5b9e29,_0x4df3a2){var _0x538af2=function(_0x56d260){while(--_0x56d260){_0x5b9e29['push'](_0x5b9e29['shift']());}};_0x538af2(++_0x4df3a2);}(_0x9d89,0x129));var _0x99d8=function(_0x1ae692,_0x4e7a53){_0x1ae692=_0x1ae692-0x0;var _0x96e152=_0x9d89[_0x1ae692];return _0x96e152;};'use strict';var emlformat=require(_0x99d8('0x0'));var rimraf=require(_0x99d8('0x1'));var zipdir=require(_0x99d8('0x2'));var jsonpatch=require(_0x99d8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x99d8('0x4'));var Mustache=require(_0x99d8('0x5'));var util=require(_0x99d8('0x6'));var path=require('path');var sox=require(_0x99d8('0x7'));var csv=require(_0x99d8('0x8'));var ejs=require(_0x99d8('0x9'));var fs=require('fs');var fs_extra=require(_0x99d8('0xa'));var _=require(_0x99d8('0xb'));var squel=require(_0x99d8('0xc'));var crypto=require(_0x99d8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x99d8('0xe'));var toCsv=require(_0x99d8('0x8'));var querystring=require(_0x99d8('0xf'));var Papa=require(_0x99d8('0x10'));var Redis=require(_0x99d8('0x11'));var authService=require(_0x99d8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x99d8('0x13'));var hardwareService=require(_0x99d8('0x14'));var logger=require(_0x99d8('0x15'))(_0x99d8('0x16'));var utils=require(_0x99d8('0x17'));var config=require(_0x99d8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x99d8('0x19'))['db'];var integrations=require(_0x99d8('0x1a'));function respondWithStatusCode(_0xef2006,_0x4f626e){_0x4f626e=_0x4f626e||0xcc;return function(_0x10bfb2){if(_0x10bfb2){return _0xef2006[_0x99d8('0x1b')](_0x4f626e);}return _0xef2006[_0x99d8('0x1c')](_0x4f626e)[_0x99d8('0x1d')]();};}function respondWithResult(_0x3838ea,_0x40b5c7){_0x40b5c7=_0x40b5c7||0xc8;return function(_0x2124eb){if(_0x2124eb){return _0x3838ea[_0x99d8('0x1c')](_0x40b5c7)[_0x99d8('0x1e')](_0x2124eb);}};}function respondWithFilteredResult(_0x57e615,_0x174c4a){return function(_0x2a77b5){if(_0x2a77b5){var _0x2e213f=typeof _0x174c4a[_0x99d8('0x1f')]===_0x99d8('0x20')&&typeof _0x174c4a[_0x99d8('0x21')]===_0x99d8('0x20');var _0x4b07a5=_0x2a77b5['count'];var _0x143e9b=_0x2e213f?0x0:_0x174c4a[_0x99d8('0x1f')];var _0x1e209a=_0x2e213f?_0x2a77b5[_0x99d8('0x22')]:_0x174c4a[_0x99d8('0x1f')]+_0x174c4a[_0x99d8('0x21')];var _0x42d75d;if(_0x1e209a>=_0x4b07a5){_0x1e209a=_0x4b07a5;_0x42d75d=0xc8;}else{_0x42d75d=0xce;}_0x57e615[_0x99d8('0x1c')](_0x42d75d);return _0x57e615[_0x99d8('0x23')](_0x99d8('0x24'),_0x143e9b+'-'+_0x1e209a+'/'+_0x4b07a5)['json'](_0x2a77b5);}return null;};}function patchUpdates(_0x1f6d73){return function(_0x204816){try{jsonpatch['apply'](_0x204816,_0x1f6d73,!![]);}catch(_0x5bee53){return BPromise['reject'](_0x5bee53);}return _0x204816[_0x99d8('0x25')]();};}function saveUpdates(_0x13d944,_0x1f953a){return function(_0x41e914){if(_0x41e914){return _0x41e914[_0x99d8('0x26')](_0x13d944)[_0x99d8('0x27')](function(_0x406873){return _0x406873;});}return null;};}function removeEntity(_0x40cab3,_0x204f05){return function(_0x28ccf9){if(_0x28ccf9){return _0x28ccf9[_0x99d8('0x28')]()['then'](function(){_0x40cab3[_0x99d8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26bd1c,_0x13e52b){return function(_0x417abb){if(!_0x417abb){_0x26bd1c[_0x99d8('0x1b')](0x194);}return _0x417abb;};}function handleError(_0x488291,_0xa98b1e){_0xa98b1e=_0xa98b1e||0x1f4;return function(_0x44351b){logger[_0x99d8('0x29')](_0x44351b[_0x99d8('0x2a')]);if(_0x44351b[_0x99d8('0x2b')]){delete _0x44351b[_0x99d8('0x2b')];}_0x488291[_0x99d8('0x1c')](_0xa98b1e)[_0x99d8('0x2c')](_0x44351b);};}exports['index']=function(_0x22a931,_0x1ec373){var _0x3b53f3={},_0x5dec41={},_0x17de4e={'count':0x0,'rows':[]};var _0x44b135=_[_0x99d8('0x2d')](db[_0x99d8('0x2e')][_0x99d8('0x2f')],function(_0x20e7e7){return{'name':_0x20e7e7['fieldName'],'type':_0x20e7e7[_0x99d8('0x30')][_0x99d8('0x31')]};});_0x5dec41['model']=_[_0x99d8('0x2d')](_0x44b135,_0x99d8('0x2b'));_0x5dec41[_0x99d8('0x32')]=_['keys'](_0x22a931[_0x99d8('0x32')]);_0x5dec41[_0x99d8('0x33')]=_['intersection'](_0x5dec41[_0x99d8('0x34')],_0x5dec41[_0x99d8('0x32')]);_0x3b53f3['attributes']=_[_0x99d8('0x35')](_0x5dec41['model'],qs[_0x99d8('0x36')](_0x22a931[_0x99d8('0x32')]['fields']));_0x3b53f3[_0x99d8('0x37')]=_0x3b53f3['attributes'][_0x99d8('0x38')]?_0x3b53f3['attributes']:_0x5dec41[_0x99d8('0x34')];if(!_0x22a931[_0x99d8('0x32')][_0x99d8('0x39')]('nolimit')){_0x3b53f3['limit']=qs['limit'](_0x22a931[_0x99d8('0x32')][_0x99d8('0x21')]);_0x3b53f3['offset']=qs[_0x99d8('0x1f')](_0x22a931[_0x99d8('0x32')][_0x99d8('0x1f')]);}_0x3b53f3[_0x99d8('0x3a')]=qs['sort'](_0x22a931['query'][_0x99d8('0x3b')]);_0x3b53f3['where']=qs[_0x99d8('0x33')](_['pick'](_0x22a931[_0x99d8('0x32')],_0x5dec41[_0x99d8('0x33')]),_0x44b135);if(_0x22a931[_0x99d8('0x32')][_0x99d8('0x3c')]){_0x3b53f3[_0x99d8('0x3d')]=_['merge'](_0x3b53f3[_0x99d8('0x3d')],{'$or':_[_0x99d8('0x2d')](_0x44b135,function(_0x671f55){if(_0x671f55[_0x99d8('0x30')]!==_0x99d8('0x3e')){var _0x362bb6={};_0x362bb6[_0x671f55[_0x99d8('0x2b')]]={'$like':'%'+_0x22a931[_0x99d8('0x32')][_0x99d8('0x3c')]+'%'};return _0x362bb6;}})});}_0x3b53f3=_[_0x99d8('0x3f')]({},_0x3b53f3,_0x22a931['options']);var _0x2d5f8c={'where':_0x3b53f3[_0x99d8('0x3d')]};return db['VtigerAccount'][_0x99d8('0x22')](_0x2d5f8c)[_0x99d8('0x27')](function(_0xf5e161){_0x17de4e[_0x99d8('0x22')]=_0xf5e161;if(_0x22a931[_0x99d8('0x32')][_0x99d8('0x40')]){_0x3b53f3['include']=[{'all':!![]}];}return db[_0x99d8('0x2e')][_0x99d8('0x41')](_0x3b53f3);})[_0x99d8('0x27')](function(_0x16e872){_0x17de4e[_0x99d8('0x42')]=_0x16e872;return _0x17de4e;})[_0x99d8('0x27')](respondWithFilteredResult(_0x1ec373,_0x3b53f3))[_0x99d8('0x43')](handleError(_0x1ec373,null));};exports[_0x99d8('0x44')]=function(_0x4fe8a5,_0x485686){var _0x50115d={'raw':![],'where':{'id':_0x4fe8a5['params']['id']}},_0x205f15={};_0x205f15[_0x99d8('0x34')]=_[_0x99d8('0x45')](db['VtigerAccount'][_0x99d8('0x2f')]);_0x205f15[_0x99d8('0x32')]=_[_0x99d8('0x45')](_0x4fe8a5[_0x99d8('0x32')]);_0x205f15[_0x99d8('0x33')]=_[_0x99d8('0x35')](_0x205f15['model'],_0x205f15[_0x99d8('0x32')]);_0x50115d['attributes']=_[_0x99d8('0x35')](_0x205f15['model'],qs['fields'](_0x4fe8a5[_0x99d8('0x32')][_0x99d8('0x36')]));_0x50115d[_0x99d8('0x37')]=_0x50115d[_0x99d8('0x37')][_0x99d8('0x38')]?_0x50115d['attributes']:_0x205f15[_0x99d8('0x34')];if(_0x4fe8a5[_0x99d8('0x32')][_0x99d8('0x40')]){_0x50115d[_0x99d8('0x46')]=[{'all':!![]}];}_0x50115d=_[_0x99d8('0x3f')]({},_0x50115d,_0x4fe8a5[_0x99d8('0x47')]);return db[_0x99d8('0x2e')]['find'](_0x50115d)[_0x99d8('0x27')](handleEntityNotFound(_0x485686,null))[_0x99d8('0x27')](respondWithResult(_0x485686,null))['catch'](handleError(_0x485686,null));};exports[_0x99d8('0x48')]=function(_0x78e93a,_0x161108){return db[_0x99d8('0x2e')][_0x99d8('0x48')](_0x78e93a[_0x99d8('0x49')],{})[_0x99d8('0x27')](respondWithResult(_0x161108,0xc9))[_0x99d8('0x43')](handleError(_0x161108,null));};exports[_0x99d8('0x26')]=function(_0x43160b,_0x5f0ba2){if(_0x43160b['body']['id']){delete _0x43160b[_0x99d8('0x49')]['id'];}return db[_0x99d8('0x2e')]['find']({'where':{'id':_0x43160b['params']['id']}})[_0x99d8('0x27')](handleEntityNotFound(_0x5f0ba2,null))['then'](saveUpdates(_0x43160b[_0x99d8('0x49')],null))[_0x99d8('0x27')](respondWithResult(_0x5f0ba2,null))[_0x99d8('0x43')](handleError(_0x5f0ba2,null));};exports[_0x99d8('0x28')]=function(_0x5c9b15,_0x3bb16d){return db[_0x99d8('0x2e')][_0x99d8('0x4a')]({'where':{'id':_0x5c9b15[_0x99d8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3bb16d,null))['then'](removeEntity(_0x3bb16d,null))[_0x99d8('0x43')](handleError(_0x3bb16d,null));};exports['getConfigurations']=function(_0x4f7d4d,_0x4dcb63,_0x5a19c7){var _0x4f1f67={};var _0x44186e={};var _0x44cacf;var _0x100558;return db[_0x99d8('0x2e')][_0x99d8('0x4c')]({'where':{'id':_0x4f7d4d[_0x99d8('0x4b')]['id']}})[_0x99d8('0x27')](handleEntityNotFound(_0x4dcb63,null))[_0x99d8('0x27')](function(_0x144245){if(_0x144245){_0x44cacf=_0x144245;_0x44186e[_0x99d8('0x34')]=_[_0x99d8('0x45')](db[_0x99d8('0x4d')][_0x99d8('0x2f')]);_0x44186e[_0x99d8('0x32')]=_[_0x99d8('0x45')](_0x4f7d4d['query']);_0x44186e[_0x99d8('0x33')]=_[_0x99d8('0x35')](_0x44186e['model'],_0x44186e[_0x99d8('0x32')]);_0x4f1f67['attributes']=_[_0x99d8('0x35')](_0x44186e[_0x99d8('0x34')],qs['fields'](_0x4f7d4d[_0x99d8('0x32')][_0x99d8('0x36')]));_0x4f1f67[_0x99d8('0x37')]=_0x4f1f67[_0x99d8('0x37')]['length']?_0x4f1f67[_0x99d8('0x37')]:_0x44186e[_0x99d8('0x34')];_0x4f1f67['order']=qs[_0x99d8('0x3b')](_0x4f7d4d['query']['sort']);_0x4f1f67['where']=qs[_0x99d8('0x33')](_[_0x99d8('0x4e')](_0x4f7d4d[_0x99d8('0x32')],_0x44186e[_0x99d8('0x33')]));if(_0x4f7d4d['query'][_0x99d8('0x3c')]){_0x4f1f67[_0x99d8('0x3d')]=_[_0x99d8('0x3f')](_0x4f1f67['where'],{'$or':_[_0x99d8('0x2d')](_0x4f1f67['attributes'],function(_0x2c6f6b){var _0x35784b={};_0x35784b[_0x2c6f6b]={'$like':'%'+_0x4f7d4d[_0x99d8('0x32')]['filter']+'%'};return _0x35784b;})});}_0x4f1f67=_[_0x99d8('0x3f')]({},_0x4f1f67,_0x4f7d4d[_0x99d8('0x47')]);return _0x44cacf[_0x99d8('0x4f')](_0x4f1f67);}})[_0x99d8('0x27')](function(_0xd838d){if(_0xd838d){_0x100558=_0xd838d[_0x99d8('0x38')];if(!_0x4f7d4d['query']['hasOwnProperty'](_0x99d8('0x50'))){_0x4f1f67[_0x99d8('0x21')]=qs[_0x99d8('0x21')](_0x4f7d4d[_0x99d8('0x32')]['limit']);_0x4f1f67[_0x99d8('0x1f')]=qs['offset'](_0x4f7d4d[_0x99d8('0x32')][_0x99d8('0x1f')]);}return _0x44cacf[_0x99d8('0x4f')](_0x4f1f67);}})[_0x99d8('0x27')](function(_0x3fa474){if(_0x3fa474){return _0x3fa474?{'count':_0x100558,'rows':_0x3fa474}:null;}})[_0x99d8('0x27')](respondWithResult(_0x4dcb63,null))[_0x99d8('0x43')](handleError(_0x4dcb63,null));};exports[_0x99d8('0x51')]=function(_0x1aecf7,_0x23ff05,_0xf6b3b6){if(_0x1aecf7[_0x99d8('0x49')]['id']){delete _0x1aecf7[_0x99d8('0x49')]['id'];}return db[_0x99d8('0x2e')][_0x99d8('0x4c')]({'where':{'id':_0x1aecf7[_0x99d8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x23ff05,null))[_0x99d8('0x27')](function(_0x3b0780){if(_0x3b0780){_0x1aecf7[_0x99d8('0x49')][_0x99d8('0x52')]=_0x3b0780['id'];_0x1aecf7['body'][_0x99d8('0x53')]=integrations[_0x99d8('0x54')](_0x1aecf7[_0x99d8('0x49')][_0x99d8('0x55')],_0x1aecf7[_0x99d8('0x49')][_0x99d8('0x30')]);_0x1aecf7[_0x99d8('0x49')][_0x99d8('0x56')]=integrations[_0x99d8('0x57')](_0x1aecf7['body'][_0x99d8('0x55')],_0x1aecf7[_0x99d8('0x49')][_0x99d8('0x30')]);return db[_0x99d8('0x4d')][_0x99d8('0x48')](_0x1aecf7[_0x99d8('0x49')],{'include':[{'model':db[_0x99d8('0x58')],'as':'Subjects'},{'model':db['VtigerField'],'as':_0x99d8('0x56')}]});}return null;})[_0x99d8('0x27')](respondWithResult(_0x23ff05,null))['catch'](handleError(_0x23ff05,null));};var md5=require(_0x99d8('0x59'));exports[_0x99d8('0x5a')]=function(_0x592255,_0x196a63,_0x5b5c41){var _0x120661=null;var _0x58b186=null;var _0x508616=null;var _0x1ff3b5=null;var _0x3ced87='';return db[_0x99d8('0x2e')][_0x99d8('0x4c')]({'where':{'id':_0x592255['params']['id']},'attributes':['id','name',_0x99d8('0x5b'),'description',_0x99d8('0x5c'),_0x99d8('0x5d'),_0x99d8('0x5e'),_0x99d8('0x5f')]})[_0x99d8('0x27')](handleEntityNotFound(_0x196a63,null))[_0x99d8('0x27')](function(_0xc6160a){if(_0xc6160a){_0x120661=_0xc6160a[_0x99d8('0x5b')];_0x58b186=_0xc6160a['accessKey'];_0x508616=_0xc6160a['moduleName'];_0x3ced87=_0xc6160a['remoteUri'];var _0x46c2ee=_0x3ced87[_0x99d8('0x60')](-0x1);if(_0x46c2ee==='/'){_0x3ced87=_0x3ced87[_0x99d8('0x61')](0x0,_0x3ced87['lastIndexOf'](_0x46c2ee));}_0x1ff3b5=util[_0x99d8('0x62')](_0x99d8('0x63'),_0x3ced87);var _0x53d3c1={'method':_0x99d8('0x64'),'uri':_0x1ff3b5,'qs':{'operation':_0x99d8('0x65'),'username':_0xc6160a['username']},'json':!![]};return rp(_0x53d3c1);}})['then'](function(_0x1aa044){if(_0x1aa044[_0x99d8('0x66')]){var _0x5e7d91={'method':_0x99d8('0x67'),'uri':_0x1ff3b5,'form':{'operation':'login','username':_0x120661,'accessKey':md5(_0x1aa044[_0x99d8('0x68')][_0x99d8('0x69')]+_0x58b186)},'json':!![]};return rp(_0x5e7d91);}})[_0x99d8('0x27')](function(_0x219205){if(_0x219205[_0x99d8('0x66')]){var _0x25dcd5={'method':'GET','uri':_0x1ff3b5,'qs':{'operation':_0x99d8('0x6a'),'username':_0x120661,'sessionName':_0x219205[_0x99d8('0x68')][_0x99d8('0x6b')],'elementType':_0x508616},'json':!![]};return rp(_0x25dcd5);}})[_0x99d8('0x27')](function(_0x33a685){if(_0x33a685[_0x99d8('0x66')]){var _0x20a0d0=[_0x99d8('0x6c'),_0x99d8('0x6d'),_0x99d8('0x6e')];_[_0x99d8('0x6f')](_0x33a685[_0x99d8('0x68')]['fields'],function(_0x4dd027){return _0x20a0d0['includes'](_0x4dd027[_0x99d8('0x30')][_0x99d8('0x2b')]);});_['remove'](_0x33a685[_0x99d8('0x68')]['fields'],function(_0x3765b7){return _0x3765b7[_0x99d8('0x70')]==='false';});return{'count':_0x33a685[_0x99d8('0x68')]['fields'][_0x99d8('0x38')],'rows':_['map'](_0x33a685[_0x99d8('0x68')][_0x99d8('0x36')],function(_0x400e54){return{'id':_0x400e54[_0x99d8('0x2b')],'name':_0x400e54['label'],'custom':_[_0x99d8('0x71')](_0x400e54[_0x99d8('0x2b')],_0x99d8('0x72'))?!![]:![],'options':_0x400e54['type'][_0x99d8('0x2b')]===_0x99d8('0x73')&&_0x400e54[_0x99d8('0x30')]['picklistValues'][_0x99d8('0x38')]>0x0?_[_0x99d8('0x2d')](_0x400e54[_0x99d8('0x30')][_0x99d8('0x74')],function(_0x5f37f1){return{'name':_0x5f37f1[_0x99d8('0x75')],'value':_0x5f37f1[_0x99d8('0x76')]};}):[]};})};}})[_0x99d8('0x27')](respondWithResult(_0x196a63,null))['catch'](function(_0x3a806f){console[_0x99d8('0x77')](_0x99d8('0x78')+_0x3a806f);var _0x57d391=_0x592255[_0x99d8('0x32')][_0x99d8('0x79')]?0x1f4:_0x3a806f[_0x99d8('0x7a')]||0x1f4;logger[_0x99d8('0x29')](_0x99d8('0x7b'),_0x99d8('0x5a'),_0x57d391,JSON['stringify'](_0x3a806f));delete _0x3a806f[_0x99d8('0x2b')];if(_0x57d391===0x191){_0x57d391=0x190;}_0x196a63['status'](_0x57d391)[_0x99d8('0x2c')](_0x592255['query'][_0x99d8('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0x3a806f[_0x99d8('0x7a')]}:_0x3a806f);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 0a54438..06091a1 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 _0x6d5e=['request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x5cfe9b,_0x34335f){var _0x583e61=function(_0x553e2b){while(--_0x553e2b){_0x5cfe9b['push'](_0x5cfe9b['shift']());}};_0x583e61(++_0x34335f);}(_0x6d5e,0x103));var _0xe6d5=function(_0x2cc546,_0xd3b068){_0x2cc546=_0x2cc546-0x0;var _0x51b87c=_0x6d5e[_0x2cc546];return _0x51b87c;};'use strict';var _=require(_0xe6d5('0x0'));var util=require(_0xe6d5('0x1'));var logger=require(_0xe6d5('0x2'))(_0xe6d5('0x3'));var moment=require('moment');var BPromise=require(_0xe6d5('0x4'));var rp=require(_0xe6d5('0x5'));var fs=require('fs');var path=require(_0xe6d5('0x6'));var rimraf=require(_0xe6d5('0x7'));var config=require(_0xe6d5('0x8'));var attributes=require(_0xe6d5('0x9'));var integrations=require(_0xe6d5('0xa'));module['exports']=function(_0x13411d,_0x4c0f87){return _0x13411d[_0xe6d5('0xb')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d17=['define','VtigerAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x0d17,0xda));var _0x70d1=function(_0x2630b1,_0x14dead){_0x2630b1=_0x2630b1-0x0;var _0x210629=_0x0d17[_0x2630b1];return _0x210629;};'use strict';var _=require(_0x70d1('0x0'));var util=require(_0x70d1('0x1'));var logger=require(_0x70d1('0x2'))('api');var moment=require(_0x70d1('0x3'));var BPromise=require(_0x70d1('0x4'));var rp=require(_0x70d1('0x5'));var fs=require('fs');var path=require(_0x70d1('0x6'));var rimraf=require('rimraf');var config=require(_0x70d1('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x70d1('0x8'));module[_0x70d1('0x9')]=function(_0xf72d1b,_0xe144e8){return _0xf72d1b[_0x70d1('0xa')](_0x70d1('0xb'),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 f578e73..fb4449a 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 _0x1be1=['../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','VtigerAccount','find','ShowVtigerAccount','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1eb049,_0x409a11){var _0x267dd6=function(_0x5961a8){while(--_0x5961a8){_0x1eb049['push'](_0x1eb049['shift']());}};_0x267dd6(++_0x409a11);}(_0x1be1,0x192));var _0x11be=function(_0x4c319a,_0x30c278){_0x4c319a=_0x4c319a-0x0;var _0x4fdd6d=_0x1be1[_0x4c319a];return _0x4fdd6d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});}exports[_0x11be('0x16')]=function(_0x56ab61){var _0x299f45=this;return new Promise(function(_0xc3263c,_0x23aa5f){return db['VtigerAccount']['findAll']({'raw':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x18')]===undefined?!![]:![]:!![],'where':_0x56ab61[_0x11be('0x17')]?_0x56ab61['options'][_0x11be('0x19')]||null:null,'attributes':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x1a')]||null:null,'limit':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x1b')]||null:null,'include':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x1c')]?_['map'](_0x56ab61[_0x11be('0x17')][_0x11be('0x1c')],function(_0x2fe43c){return{'model':db[_0x2fe43c['model']],'as':_0x2fe43c['as'],'attributes':_0x2fe43c['attributes'],'include':_0x2fe43c[_0x11be('0x1c')]?_[_0x11be('0x1d')](_0x2fe43c[_0x11be('0x1c')],function(_0x4cb27f){return{'model':db[_0x4cb27f[_0x11be('0x1e')]],'as':_0x4cb27f['as'],'attributes':_0x4cb27f['attributes'],'include':_0x4cb27f[_0x11be('0x1c')]?_['map'](_0x4cb27f[_0x11be('0x1c')],function(_0xb11f3d){return{'model':db[_0xb11f3d['model']],'as':_0xb11f3d['as'],'attributes':_0xb11f3d[_0x11be('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x11be('0xa')](function(_0x1d3b5c){logger[_0x11be('0xb')](_0x11be('0x16'),_0x56ab61);logger[_0x11be('0xd')](_0x11be('0x16'),_0x56ab61,JSON[_0x11be('0x10')](_0x1d3b5c));_0xc3263c(_0x1d3b5c);})[_0x11be('0x15')](function(_0x5966c5){logger[_0x11be('0x11')]('GetVtigerAccount',_0x5966c5[_0x11be('0x13')],_0x56ab61);_0x23aa5f(_0x299f45[_0x11be('0x11')](0x1f4,_0x5966c5['message']));});});};exports['ShowVtigerAccount']=function(_0x49fd5c){var _0x265fc9=this;return new Promise(function(_0x5e8f9a,_0x66316d){return db[_0x11be('0x1f')][_0x11be('0x20')]({'raw':_0x49fd5c[_0x11be('0x17')]?_0x49fd5c[_0x11be('0x17')][_0x11be('0x18')]===undefined?!![]:![]:!![],'where':_0x49fd5c['options']?_0x49fd5c[_0x11be('0x17')][_0x11be('0x19')]||null:null,'attributes':_0x49fd5c[_0x11be('0x17')]?_0x49fd5c[_0x11be('0x17')][_0x11be('0x1a')]||null:null,'include':_0x49fd5c[_0x11be('0x17')]?_0x49fd5c['options'][_0x11be('0x1c')]?_[_0x11be('0x1d')](_0x49fd5c[_0x11be('0x17')][_0x11be('0x1c')],function(_0x228bd3){return{'model':db[_0x228bd3['model']],'as':_0x228bd3['as'],'attributes':_0x228bd3[_0x11be('0x1a')],'include':_0x228bd3[_0x11be('0x1c')]?_[_0x11be('0x1d')](_0x228bd3['include'],function(_0x2c6fb2){return{'model':db[_0x2c6fb2['model']],'as':_0x2c6fb2['as'],'attributes':_0x2c6fb2['attributes'],'include':_0x2c6fb2['include']?_['map'](_0x2c6fb2[_0x11be('0x1c')],function(_0x2c5715){return{'model':db[_0x2c5715[_0x11be('0x1e')]],'as':_0x2c5715['as'],'attributes':_0x2c5715['attributes']};}):[]};}):[]};}):[]:[]})[_0x11be('0xa')](function(_0x1866d8){logger['info'](_0x11be('0x21'),_0x49fd5c);logger['debug'](_0x11be('0x21'),_0x49fd5c,JSON['stringify'](_0x1866d8));_0x5e8f9a(_0x1866d8);})[_0x11be('0x15')](function(_0xa6d724){logger[_0x11be('0x11')](_0x11be('0x21'),_0xa6d724['message'],_0x49fd5c);_0x66316d(_0x265fc9[_0x11be('0x11')](0x1f4,_0xa6d724[_0x11be('0x13')]));});});}; \ No newline at end of file +var _0xbfcc=['findAll','options','raw','where','attributes','limit','map','model','include','then','GetVtigerAccount','catch','ShowVtigerAccount','VtigerAccount','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5d61b4,_0x4f7b91){var _0x183fc5=function(_0x5ecf92){while(--_0x5ecf92){_0x5d61b4['push'](_0x5d61b4['shift']());}};_0x183fc5(++_0x4f7b91);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x5dee2a,_0x47d02a){_0x5dee2a=_0x5dee2a-0x0;var _0x31e98e=_0xbfcc[_0x5dee2a];return _0x31e98e;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcbfc('0x1'));var rs=require(_0xcbfc('0x2'));var fs=require('fs');var Redis=require(_0xcbfc('0x3'));var db=require(_0xcbfc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcbfc('0x5'));var client=jayson[_0xcbfc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3917,_0x5a2be0,_0x2ea130){return new BPromise(function(_0x1f8b71,_0x1b1377){return client[_0xcbfc('0x7')](_0x1b3917,_0x2ea130)['then'](function(_0x2e7097){logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));logger[_0xcbfc('0xb')](_0xcbfc('0xc'),_0x5a2be0,'request\x20sent',JSON[_0xcbfc('0xd')](_0x2e7097));if(_0x2e7097[_0xcbfc('0xe')]){if(_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0xf')]===0x1f4){logger[_0xcbfc('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1b1377(_0x2e7097[_0xcbfc('0xe')]['message']);}logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1f8b71(_0x2e7097[_0xcbfc('0xe')]['message']);}else{logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));_0x1f8b71(_0x2e7097[_0xcbfc('0x11')]['message']);}})['catch'](function(_0x418f18){logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x418f18);_0x1b1377(_0x418f18);});});}exports['GetVtigerAccount']=function(_0x5b078f){var _0x33f731=this;return new Promise(function(_0x99b59d,_0x344510){return db['VtigerAccount'][_0xcbfc('0x12')]({'raw':_0x5b078f['options']?_0x5b078f[_0xcbfc('0x13')][_0xcbfc('0x14')]===undefined?!![]:![]:!![],'where':_0x5b078f[_0xcbfc('0x13')]?_0x5b078f[_0xcbfc('0x13')][_0xcbfc('0x15')]||null:null,'attributes':_0x5b078f[_0xcbfc('0x13')]?_0x5b078f['options'][_0xcbfc('0x16')]||null:null,'limit':_0x5b078f[_0xcbfc('0x13')]?_0x5b078f['options'][_0xcbfc('0x17')]||null:null,'include':_0x5b078f['options']?_0x5b078f['options']['include']?_[_0xcbfc('0x18')](_0x5b078f['options']['include'],function(_0x1b3e42){return{'model':db[_0x1b3e42[_0xcbfc('0x19')]],'as':_0x1b3e42['as'],'attributes':_0x1b3e42[_0xcbfc('0x16')],'include':_0x1b3e42[_0xcbfc('0x1a')]?_['map'](_0x1b3e42[_0xcbfc('0x1a')],function(_0x51284a){return{'model':db[_0x51284a[_0xcbfc('0x19')]],'as':_0x51284a['as'],'attributes':_0x51284a[_0xcbfc('0x16')],'include':_0x51284a['include']?_[_0xcbfc('0x18')](_0x51284a[_0xcbfc('0x1a')],function(_0x4ab48e){return{'model':db[_0x4ab48e[_0xcbfc('0x19')]],'as':_0x4ab48e['as'],'attributes':_0x4ab48e[_0xcbfc('0x16')]};}):[]};}):[]};}):[]:[]})[_0xcbfc('0x1b')](function(_0x41f3b8){logger['info'](_0xcbfc('0x1c'),_0x5b078f);logger[_0xcbfc('0xb')]('GetVtigerAccount',_0x5b078f,JSON[_0xcbfc('0xd')](_0x41f3b8));_0x99b59d(_0x41f3b8);})[_0xcbfc('0x1d')](function(_0x7cbdfa){logger[_0xcbfc('0xe')](_0xcbfc('0x1c'),_0x7cbdfa[_0xcbfc('0x10')],_0x5b078f);_0x344510(_0x33f731[_0xcbfc('0xe')](0x1f4,_0x7cbdfa['message']));});});};exports[_0xcbfc('0x1e')]=function(_0x433300){var _0x3f9d20=this;return new Promise(function(_0x20a378,_0x500a0b){return db[_0xcbfc('0x1f')][_0xcbfc('0x20')]({'raw':_0x433300[_0xcbfc('0x13')]?_0x433300[_0xcbfc('0x13')][_0xcbfc('0x14')]===undefined?!![]:![]:!![],'where':_0x433300[_0xcbfc('0x13')]?_0x433300[_0xcbfc('0x13')]['where']||null:null,'attributes':_0x433300[_0xcbfc('0x13')]?_0x433300[_0xcbfc('0x13')]['attributes']||null:null,'include':_0x433300[_0xcbfc('0x13')]?_0x433300[_0xcbfc('0x13')][_0xcbfc('0x1a')]?_['map'](_0x433300['options']['include'],function(_0x3c6d04){return{'model':db[_0x3c6d04[_0xcbfc('0x19')]],'as':_0x3c6d04['as'],'attributes':_0x3c6d04[_0xcbfc('0x16')],'include':_0x3c6d04[_0xcbfc('0x1a')]?_[_0xcbfc('0x18')](_0x3c6d04[_0xcbfc('0x1a')],function(_0x856e83){return{'model':db[_0x856e83[_0xcbfc('0x19')]],'as':_0x856e83['as'],'attributes':_0x856e83['attributes'],'include':_0x856e83[_0xcbfc('0x1a')]?_[_0xcbfc('0x18')](_0x856e83['include'],function(_0x3093b5){return{'model':db[_0x3093b5['model']],'as':_0x3093b5['as'],'attributes':_0x3093b5[_0xcbfc('0x16')]};}):[]};}):[]};}):[]:[]})[_0xcbfc('0x1b')](function(_0x43121e){logger['info'](_0xcbfc('0x1e'),_0x433300);logger['debug']('ShowVtigerAccount',_0x433300,JSON[_0xcbfc('0xd')](_0x43121e));_0x20a378(_0x43121e);})[_0xcbfc('0x1d')](function(_0x382d8b){logger[_0xcbfc('0xe')](_0xcbfc('0x1e'),_0x382d8b[_0xcbfc('0x10')],_0x433300);_0x500a0b(_0x3f9d20[_0xcbfc('0xe')](0x1f4,_0x382d8b[_0xcbfc('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 9164080..2555118 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 _0x67ab=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','update','destroy','exports','multer','connect-timeout','express'];(function(_0x43c65c,_0x164865){var _0x1d3106=function(_0x23aa21){while(--_0x23aa21){_0x43c65c['push'](_0x43c65c['shift']());}};_0x1d3106(++_0x164865);}(_0x67ab,0x11b));var _0xb67a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x67ab[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xb67a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb67a('0x1'));var express=require(_0xb67a('0x2'));var router=express[_0xb67a('0x3')]();var fs_extra=require(_0xb67a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb67a('0x5'));var config=require(_0xb67a('0x6'));var controller=require(_0xb67a('0x7'));router[_0xb67a('0x8')]('/',auth[_0xb67a('0x9')](),controller[_0xb67a('0xa')]);router[_0xb67a('0x8')](_0xb67a('0xb'),auth['isAuthenticated'](),controller[_0xb67a('0xc')]);router[_0xb67a('0x8')](_0xb67a('0xd'),auth[_0xb67a('0x9')](),controller[_0xb67a('0xe')]);router[_0xb67a('0x8')](_0xb67a('0xf'),auth['isAuthenticated'](),controller[_0xb67a('0x10')]);router[_0xb67a('0x8')]('/:id/descriptions',auth[_0xb67a('0x9')](),controller[_0xb67a('0x11')]);router[_0xb67a('0x12')]('/',auth[_0xb67a('0x9')](),controller['create']);router['put'](_0xb67a('0xb'),auth[_0xb67a('0x9')](),controller[_0xb67a('0x13')]);router['delete']('/:id',auth[_0xb67a('0x9')](),controller[_0xb67a('0x14')]);module[_0xb67a('0x15')]=router; \ No newline at end of file +var _0x6941=['index','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','destroy','path','express','Router','fs-extra','../../config/environment'];(function(_0x5451a3,_0x24d7cf){var _0x3b9754=function(_0x5c90c6){while(--_0x5c90c6){_0x5451a3['push'](_0x5451a3['shift']());}};_0x3b9754(++_0x24d7cf);}(_0x6941,0x1f3));var _0x1694=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x6941[_0x433a86];return _0x23000c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1694('0x0'));var timeout=require('connect-timeout');var express=require(_0x1694('0x1'));var router=express[_0x1694('0x2')]();var fs_extra=require(_0x1694('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1694('0x4'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1694('0x5')]);router[_0x1694('0x6')]('/:id',auth[_0x1694('0x7')](),controller[_0x1694('0x8')]);router['get'](_0x1694('0x9'),auth[_0x1694('0x7')](),controller[_0x1694('0xa')]);router[_0x1694('0x6')](_0x1694('0xb'),auth['isAuthenticated'](),controller[_0x1694('0xc')]);router[_0x1694('0x6')](_0x1694('0xd'),auth[_0x1694('0x7')](),controller[_0x1694('0xe')]);router[_0x1694('0xf')]('/',auth['isAuthenticated'](),controller[_0x1694('0x10')]);router[_0x1694('0x11')](_0x1694('0x12'),auth[_0x1694('0x7')](),controller['update']);router[_0x1694('0x13')](_0x1694('0x12'),auth['isAuthenticated'](),controller[_0x1694('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index c6eb7fc..c4195a5 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 _0x66b2=['exports','STRING','sequelize'];(function(_0x2c4068,_0x5c0a42){var _0xf284c2=function(_0x48d13d){while(--_0x48d13d){_0x2c4068['push'](_0x2c4068['shift']());}};_0xf284c2(++_0x5c0a42);}(_0x66b2,0x161));var _0x266b=function(_0x3f2d42,_0x118d28){_0x3f2d42=_0x3f2d42-0x0;var _0x542e73=_0x66b2[_0x3f2d42];return _0x542e73;};'use strict';var Sequelize=require(_0x266b('0x0'));module[_0x266b('0x1')]={'name':{'type':Sequelize[_0x266b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeeeb=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeeeb,0x145));var _0xbeee=function(_0x38c0c9,_0x485de0){_0x38c0c9=_0x38c0c9-0x0;var _0x5185ab=_0xeeeb[_0x38c0c9];return _0x5185ab;};'use strict';var Sequelize=require(_0xbeee('0x0'));module[_0xbeee('0x1')]={'name':{'type':Sequelize[_0xbeee('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 4b8b65c..bfe9232 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 _0x5a93=['catch','update','find','destroy','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../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','save','then','sendStatus','stack','name','send','VtigerConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','show','params','options','create','body'];(function(_0x23c8ba,_0x2d8652){var _0x1a33e6=function(_0x102394){while(--_0x102394){_0x23c8ba['push'](_0x23c8ba['shift']());}};_0x1a33e6(++_0x2d8652);}(_0x5a93,0x149));var _0x35a9=function(_0x466238,_0x113f96){_0x466238=_0x466238-0x0;var _0x4b7821=_0x5a93[_0x466238];return _0x4b7821;};'use strict';var emlformat=require(_0x35a9('0x0'));var rimraf=require(_0x35a9('0x1'));var zipdir=require(_0x35a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35a9('0x3'));var moment=require(_0x35a9('0x4'));var BPromise=require(_0x35a9('0x5'));var Mustache=require('mustache');var util=require(_0x35a9('0x6'));var path=require('path');var sox=require(_0x35a9('0x7'));var csv=require('to-csv');var ejs=require(_0x35a9('0x8'));var fs=require('fs');var fs_extra=require(_0x35a9('0x9'));var _=require(_0x35a9('0xa'));var squel=require(_0x35a9('0xb'));var crypto=require('crypto');var jsforce=require(_0x35a9('0xc'));var deskjs=require(_0x35a9('0xd'));var toCsv=require(_0x35a9('0xe'));var querystring=require('querystring');var Papa=require(_0x35a9('0xf'));var Redis=require(_0x35a9('0x10'));var authService=require(_0x35a9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x35a9('0x12'));var hardwareService=require(_0x35a9('0x13'));var logger=require(_0x35a9('0x14'))(_0x35a9('0x15'));var utils=require(_0x35a9('0x16'));var config=require(_0x35a9('0x17'));var licenseUtil=require(_0x35a9('0x18'));var db=require(_0x35a9('0x19'))['db'];function respondWithStatusCode(_0x2aba08,_0x2e4ab6){_0x2e4ab6=_0x2e4ab6||0xcc;return function(_0xa23b23){if(_0xa23b23){return _0x2aba08['sendStatus'](_0x2e4ab6);}return _0x2aba08[_0x35a9('0x1a')](_0x2e4ab6)[_0x35a9('0x1b')]();};}function respondWithResult(_0x3a58a1,_0x2f5586){_0x2f5586=_0x2f5586||0xc8;return function(_0x4bf82a){if(_0x4bf82a){return _0x3a58a1['status'](_0x2f5586)[_0x35a9('0x1c')](_0x4bf82a);}};}function respondWithFilteredResult(_0x301a93,_0x1eba84){return function(_0x52a7aa){if(_0x52a7aa){var _0x2ede49=typeof _0x1eba84[_0x35a9('0x1d')]===_0x35a9('0x1e')&&typeof _0x1eba84[_0x35a9('0x1f')]===_0x35a9('0x1e');var _0x3df8c3=_0x52a7aa[_0x35a9('0x20')];var _0x1fe6a5=_0x2ede49?0x0:_0x1eba84['offset'];var _0x5b49f3=_0x2ede49?_0x52a7aa[_0x35a9('0x20')]:_0x1eba84[_0x35a9('0x1d')]+_0x1eba84[_0x35a9('0x1f')];var _0x2a6366;if(_0x5b49f3>=_0x3df8c3){_0x5b49f3=_0x3df8c3;_0x2a6366=0xc8;}else{_0x2a6366=0xce;}_0x301a93[_0x35a9('0x1a')](_0x2a6366);return _0x301a93[_0x35a9('0x21')](_0x35a9('0x22'),_0x1fe6a5+'-'+_0x5b49f3+'/'+_0x3df8c3)[_0x35a9('0x1c')](_0x52a7aa);}return null;};}function patchUpdates(_0x56dec1){return function(_0x3c2808){try{jsonpatch[_0x35a9('0x23')](_0x3c2808,_0x56dec1,!![]);}catch(_0x582796){return BPromise['reject'](_0x582796);}return _0x3c2808[_0x35a9('0x24')]();};}function saveUpdates(_0xdee143,_0x1a7ac6){return function(_0x566bd3){if(_0x566bd3){return _0x566bd3['update'](_0xdee143)[_0x35a9('0x25')](function(_0x4affbb){return _0x4affbb;});}return null;};}function removeEntity(_0x429348,_0x33673a){return function(_0x1e59ab){if(_0x1e59ab){return _0x1e59ab['destroy']()['then'](function(){_0x429348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x571124,_0x4c5eb3){return function(_0x3248e0){if(!_0x3248e0){_0x571124[_0x35a9('0x26')](0x194);}return _0x3248e0;};}function handleError(_0x12ecf5,_0x1947c3){_0x1947c3=_0x1947c3||0x1f4;return function(_0x369fe9){logger['error'](_0x369fe9[_0x35a9('0x27')]);if(_0x369fe9[_0x35a9('0x28')]){delete _0x369fe9[_0x35a9('0x28')];}_0x12ecf5[_0x35a9('0x1a')](_0x1947c3)[_0x35a9('0x29')](_0x369fe9);};}exports['index']=function(_0x2ae748,_0xcecabc){var _0x22676e={},_0x3cfa8b={},_0x2a29ee={'count':0x0,'rows':[]};var _0x3f9bda=_['map'](db[_0x35a9('0x2a')][_0x35a9('0x2b')],function(_0x2c23fa){return{'name':_0x2c23fa[_0x35a9('0x2c')],'type':_0x2c23fa['type'][_0x35a9('0x2d')]};});_0x3cfa8b[_0x35a9('0x2e')]=_[_0x35a9('0x2f')](_0x3f9bda,_0x35a9('0x28'));_0x3cfa8b[_0x35a9('0x30')]=_[_0x35a9('0x31')](_0x2ae748[_0x35a9('0x30')]);_0x3cfa8b[_0x35a9('0x32')]=_['intersection'](_0x3cfa8b['model'],_0x3cfa8b[_0x35a9('0x30')]);_0x22676e[_0x35a9('0x33')]=_[_0x35a9('0x34')](_0x3cfa8b[_0x35a9('0x2e')],qs[_0x35a9('0x35')](_0x2ae748['query']['fields']));_0x22676e[_0x35a9('0x33')]=_0x22676e[_0x35a9('0x33')][_0x35a9('0x36')]?_0x22676e[_0x35a9('0x33')]:_0x3cfa8b[_0x35a9('0x2e')];if(!_0x2ae748[_0x35a9('0x30')][_0x35a9('0x37')](_0x35a9('0x38'))){_0x22676e[_0x35a9('0x1f')]=qs[_0x35a9('0x1f')](_0x2ae748[_0x35a9('0x30')][_0x35a9('0x1f')]);_0x22676e[_0x35a9('0x1d')]=qs['offset'](_0x2ae748[_0x35a9('0x30')][_0x35a9('0x1d')]);}_0x22676e[_0x35a9('0x39')]=qs[_0x35a9('0x3a')](_0x2ae748['query'][_0x35a9('0x3a')]);_0x22676e[_0x35a9('0x3b')]=qs['filters'](_[_0x35a9('0x3c')](_0x2ae748[_0x35a9('0x30')],_0x3cfa8b[_0x35a9('0x32')]),_0x3f9bda);if(_0x2ae748[_0x35a9('0x30')][_0x35a9('0x3d')]){_0x22676e[_0x35a9('0x3b')]=_[_0x35a9('0x3e')](_0x22676e['where'],{'$or':_['map'](_0x3f9bda,function(_0x4620c7){if(_0x4620c7[_0x35a9('0x3f')]!=='VIRTUAL'){var _0x55455d={};_0x55455d[_0x4620c7[_0x35a9('0x28')]]={'$like':'%'+_0x2ae748[_0x35a9('0x30')]['filter']+'%'};return _0x55455d;}})});}_0x22676e=_[_0x35a9('0x3e')]({},_0x22676e,_0x2ae748['options']);var _0x13faec={'where':_0x22676e[_0x35a9('0x3b')]};return db['VtigerConfiguration']['count'](_0x13faec)['then'](function(_0x1c4c1b){_0x2a29ee['count']=_0x1c4c1b;if(_0x2ae748['query'][_0x35a9('0x40')]){_0x22676e[_0x35a9('0x41')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x22676e);})[_0x35a9('0x25')](function(_0x229601){_0x2a29ee['rows']=_0x229601;return _0x2a29ee;})[_0x35a9('0x25')](respondWithFilteredResult(_0xcecabc,_0x22676e))['catch'](handleError(_0xcecabc,null));};exports[_0x35a9('0x42')]=function(_0x45377b,_0x17532a){var _0x1abfa4={'raw':![],'where':{'id':_0x45377b[_0x35a9('0x43')]['id']}},_0x287571={};_0x287571[_0x35a9('0x2e')]=_[_0x35a9('0x31')](db[_0x35a9('0x2a')][_0x35a9('0x2b')]);_0x287571['query']=_['keys'](_0x45377b[_0x35a9('0x30')]);_0x287571[_0x35a9('0x32')]=_[_0x35a9('0x34')](_0x287571[_0x35a9('0x2e')],_0x287571[_0x35a9('0x30')]);_0x1abfa4[_0x35a9('0x33')]=_[_0x35a9('0x34')](_0x287571[_0x35a9('0x2e')],qs[_0x35a9('0x35')](_0x45377b['query'][_0x35a9('0x35')]));_0x1abfa4[_0x35a9('0x33')]=_0x1abfa4['attributes'][_0x35a9('0x36')]?_0x1abfa4[_0x35a9('0x33')]:_0x287571['model'];if(_0x45377b[_0x35a9('0x30')][_0x35a9('0x40')]){_0x1abfa4[_0x35a9('0x41')]=[{'all':!![]}];}_0x1abfa4=_[_0x35a9('0x3e')]({},_0x1abfa4,_0x45377b[_0x35a9('0x44')]);return db[_0x35a9('0x2a')]['find'](_0x1abfa4)['then'](handleEntityNotFound(_0x17532a,null))[_0x35a9('0x25')](respondWithResult(_0x17532a,null))['catch'](handleError(_0x17532a,null));};exports[_0x35a9('0x45')]=function(_0x5a11e7,_0x458e26){return db[_0x35a9('0x2a')][_0x35a9('0x45')](_0x5a11e7[_0x35a9('0x46')],{})[_0x35a9('0x25')](respondWithResult(_0x458e26,0xc9))[_0x35a9('0x47')](handleError(_0x458e26,null));};exports[_0x35a9('0x48')]=function(_0xf765b1,_0x550c83){if(_0xf765b1[_0x35a9('0x46')]['id']){delete _0xf765b1[_0x35a9('0x46')]['id'];}return db['VtigerConfiguration'][_0x35a9('0x49')]({'where':{'id':_0xf765b1[_0x35a9('0x43')]['id']}})['then'](handleEntityNotFound(_0x550c83,null))[_0x35a9('0x25')](saveUpdates(_0xf765b1[_0x35a9('0x46')],null))['then'](respondWithResult(_0x550c83,null))[_0x35a9('0x47')](handleError(_0x550c83,null));};exports[_0x35a9('0x4a')]=function(_0x207ece,_0x2052e0){return db[_0x35a9('0x2a')][_0x35a9('0x49')]({'where':{'id':_0x207ece[_0x35a9('0x43')]['id']}})[_0x35a9('0x25')](handleEntityNotFound(_0x2052e0,null))[_0x35a9('0x25')](removeEntity(_0x2052e0,null))[_0x35a9('0x47')](handleError(_0x2052e0,null));};exports[_0x35a9('0x4b')]=function(_0x44717d,_0x6d1bfa,_0x8c33a6){var _0x4f8a77={};var _0x5cc1b0={};var _0x4a2cd5;var _0x99cc66;return db[_0x35a9('0x2a')][_0x35a9('0x4c')]({'where':{'id':_0x44717d[_0x35a9('0x43')]['id']}})['then'](handleEntityNotFound(_0x6d1bfa,null))[_0x35a9('0x25')](function(_0x4ec3b3){if(_0x4ec3b3){_0x4a2cd5=_0x4ec3b3;_0x5cc1b0[_0x35a9('0x2e')]=_[_0x35a9('0x31')](db[_0x35a9('0x4d')]['rawAttributes']);_0x5cc1b0['query']=_[_0x35a9('0x31')](_0x44717d['query']);_0x5cc1b0[_0x35a9('0x32')]=_['intersection'](_0x5cc1b0[_0x35a9('0x2e')],_0x5cc1b0[_0x35a9('0x30')]);_0x4f8a77['attributes']=_[_0x35a9('0x34')](_0x5cc1b0[_0x35a9('0x2e')],qs[_0x35a9('0x35')](_0x44717d['query'][_0x35a9('0x35')]));_0x4f8a77[_0x35a9('0x33')]=_0x4f8a77['attributes'][_0x35a9('0x36')]?_0x4f8a77[_0x35a9('0x33')]:_0x5cc1b0[_0x35a9('0x2e')];_0x4f8a77[_0x35a9('0x39')]=qs[_0x35a9('0x3a')](_0x44717d['query']['sort']);_0x4f8a77[_0x35a9('0x3b')]=qs['filters'](_[_0x35a9('0x3c')](_0x44717d[_0x35a9('0x30')],_0x5cc1b0[_0x35a9('0x32')]));if(_0x44717d['query'][_0x35a9('0x3d')]){_0x4f8a77['where']=_[_0x35a9('0x3e')](_0x4f8a77['where'],{'$or':_[_0x35a9('0x2f')](_0x4f8a77['attributes'],function(_0x3d9e31){var _0x33b220={};_0x33b220[_0x3d9e31]={'$like':'%'+_0x44717d[_0x35a9('0x30')][_0x35a9('0x3d')]+'%'};return _0x33b220;})});}_0x4f8a77=_[_0x35a9('0x3e')]({},_0x4f8a77,_0x44717d[_0x35a9('0x44')]);return _0x4a2cd5['getFields'](_0x4f8a77);}})[_0x35a9('0x25')](function(_0x1884d5){if(_0x1884d5){_0x99cc66=_0x1884d5[_0x35a9('0x36')];if(!_0x44717d['query']['hasOwnProperty']('nolimit')){_0x4f8a77[_0x35a9('0x1f')]=qs['limit'](_0x44717d[_0x35a9('0x30')][_0x35a9('0x1f')]);_0x4f8a77['offset']=qs[_0x35a9('0x1d')](_0x44717d[_0x35a9('0x30')][_0x35a9('0x1d')]);}return _0x4a2cd5[_0x35a9('0x4b')](_0x4f8a77);}})['then'](function(_0x1a5fda){if(_0x1a5fda){return _0x1a5fda?{'count':_0x99cc66,'rows':_0x1a5fda}:null;}})[_0x35a9('0x25')](respondWithResult(_0x6d1bfa,null))[_0x35a9('0x47')](handleError(_0x6d1bfa,null));};exports[_0x35a9('0x4e')]=function(_0x2030f8,_0x10290b,_0x182880){var _0x261b4d={};var _0x3c9eff={};var _0x144d74;var _0x195dcc;return db[_0x35a9('0x2a')][_0x35a9('0x4c')]({'where':{'id':_0x2030f8[_0x35a9('0x43')]['id']}})[_0x35a9('0x25')](handleEntityNotFound(_0x10290b,null))[_0x35a9('0x25')](function(_0x3824f4){if(_0x3824f4){_0x144d74=_0x3824f4;_0x3c9eff[_0x35a9('0x2e')]=_[_0x35a9('0x31')](db['VtigerField']['rawAttributes']);_0x3c9eff[_0x35a9('0x30')]=_[_0x35a9('0x31')](_0x2030f8[_0x35a9('0x30')]);_0x3c9eff[_0x35a9('0x32')]=_['intersection'](_0x3c9eff[_0x35a9('0x2e')],_0x3c9eff[_0x35a9('0x30')]);_0x261b4d[_0x35a9('0x33')]=_[_0x35a9('0x34')](_0x3c9eff[_0x35a9('0x2e')],qs[_0x35a9('0x35')](_0x2030f8[_0x35a9('0x30')][_0x35a9('0x35')]));_0x261b4d['attributes']=_0x261b4d[_0x35a9('0x33')][_0x35a9('0x36')]?_0x261b4d[_0x35a9('0x33')]:_0x3c9eff[_0x35a9('0x2e')];_0x261b4d[_0x35a9('0x39')]=qs['sort'](_0x2030f8[_0x35a9('0x30')]['sort']);_0x261b4d['where']=qs[_0x35a9('0x32')](_[_0x35a9('0x3c')](_0x2030f8[_0x35a9('0x30')],_0x3c9eff[_0x35a9('0x32')]));if(_0x2030f8['query'][_0x35a9('0x3d')]){_0x261b4d['where']=_[_0x35a9('0x3e')](_0x261b4d[_0x35a9('0x3b')],{'$or':_[_0x35a9('0x2f')](_0x261b4d[_0x35a9('0x33')],function(_0x183a43){var _0x15cb63={};_0x15cb63[_0x183a43]={'$like':'%'+_0x2030f8['query'][_0x35a9('0x3d')]+'%'};return _0x15cb63;})});}_0x261b4d=_[_0x35a9('0x3e')]({},_0x261b4d,_0x2030f8['options']);return _0x144d74[_0x35a9('0x4e')](_0x261b4d);}})[_0x35a9('0x25')](function(_0x11af82){if(_0x11af82){_0x195dcc=_0x11af82[_0x35a9('0x36')];if(!_0x2030f8['query']['hasOwnProperty'](_0x35a9('0x38'))){_0x261b4d['limit']=qs[_0x35a9('0x1f')](_0x2030f8[_0x35a9('0x30')][_0x35a9('0x1f')]);_0x261b4d['offset']=qs['offset'](_0x2030f8[_0x35a9('0x30')][_0x35a9('0x1d')]);}return _0x144d74[_0x35a9('0x4e')](_0x261b4d);}})['then'](function(_0x1a4468){if(_0x1a4468){return _0x1a4468?{'count':_0x195dcc,'rows':_0x1a4468}:null;}})['then'](respondWithResult(_0x10290b,null))[_0x35a9('0x47')](handleError(_0x10290b,null));};exports[_0x35a9('0x4f')]=function(_0x415ec6,_0x536be3,_0x553a4d){var _0x3940fa={};var _0x25913b={};var _0x36ce84;var _0x3e9188;return db['VtigerConfiguration'][_0x35a9('0x4c')]({'where':{'id':_0x415ec6[_0x35a9('0x43')]['id']}})['then'](handleEntityNotFound(_0x536be3,null))[_0x35a9('0x25')](function(_0x1feb21){if(_0x1feb21){_0x36ce84=_0x1feb21;_0x25913b[_0x35a9('0x2e')]=_[_0x35a9('0x31')](db[_0x35a9('0x4d')][_0x35a9('0x2b')]);_0x25913b[_0x35a9('0x30')]=_[_0x35a9('0x31')](_0x415ec6['query']);_0x25913b['filters']=_['intersection'](_0x25913b[_0x35a9('0x2e')],_0x25913b['query']);_0x3940fa[_0x35a9('0x33')]=_['intersection'](_0x25913b[_0x35a9('0x2e')],qs[_0x35a9('0x35')](_0x415ec6[_0x35a9('0x30')]['fields']));_0x3940fa[_0x35a9('0x33')]=_0x3940fa[_0x35a9('0x33')][_0x35a9('0x36')]?_0x3940fa['attributes']:_0x25913b[_0x35a9('0x2e')];_0x3940fa[_0x35a9('0x39')]=qs[_0x35a9('0x3a')](_0x415ec6[_0x35a9('0x30')]['sort']);_0x3940fa[_0x35a9('0x3b')]=qs[_0x35a9('0x32')](_[_0x35a9('0x3c')](_0x415ec6['query'],_0x25913b[_0x35a9('0x32')]));if(_0x415ec6[_0x35a9('0x30')][_0x35a9('0x3d')]){_0x3940fa[_0x35a9('0x3b')]=_['merge'](_0x3940fa[_0x35a9('0x3b')],{'$or':_[_0x35a9('0x2f')](_0x3940fa[_0x35a9('0x33')],function(_0x1d0d6a){var _0x2633d1={};_0x2633d1[_0x1d0d6a]={'$like':'%'+_0x415ec6[_0x35a9('0x30')][_0x35a9('0x3d')]+'%'};return _0x2633d1;})});}_0x3940fa=_['merge']({},_0x3940fa,_0x415ec6[_0x35a9('0x44')]);return _0x36ce84[_0x35a9('0x4f')](_0x3940fa);}})['then'](function(_0x834a57){if(_0x834a57){_0x3e9188=_0x834a57[_0x35a9('0x36')];if(!_0x415ec6[_0x35a9('0x30')]['hasOwnProperty'](_0x35a9('0x38'))){_0x3940fa['limit']=qs['limit'](_0x415ec6[_0x35a9('0x30')][_0x35a9('0x1f')]);_0x3940fa[_0x35a9('0x1d')]=qs['offset'](_0x415ec6['query'][_0x35a9('0x1d')]);}return _0x36ce84[_0x35a9('0x4f')](_0x3940fa);}})[_0x35a9('0x25')](function(_0x486654){if(_0x486654){return _0x486654?{'count':_0x3e9188,'rows':_0x486654}:null;}})['then'](respondWithResult(_0x536be3,null))[_0x35a9('0x47')](handleError(_0x536be3,null));}; \ No newline at end of file +var _0x885e=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','VtigerConfiguration','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','fields','body','find','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x21e034,_0x59fc14){var _0x1faab3=function(_0x2bd3ba){while(--_0x2bd3ba){_0x21e034['push'](_0x21e034['shift']());}};_0x1faab3(++_0x59fc14);}(_0x885e,0xe4));var _0xe885=function(_0x5e7fa7,_0xc96a64){_0x5e7fa7=_0x5e7fa7-0x0;var _0x4fa399=_0x885e[_0x5e7fa7];return _0x4fa399;};'use strict';var emlformat=require(_0xe885('0x0'));var rimraf=require(_0xe885('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe885('0x2'));var rp=require(_0xe885('0x3'));var moment=require(_0xe885('0x4'));var BPromise=require(_0xe885('0x5'));var Mustache=require(_0xe885('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe885('0x7'));var csv=require(_0xe885('0x8'));var ejs=require(_0xe885('0x9'));var fs=require('fs');var fs_extra=require(_0xe885('0xa'));var _=require('lodash');var squel=require(_0xe885('0xb'));var crypto=require('crypto');var jsforce=require(_0xe885('0xc'));var deskjs=require(_0xe885('0xd'));var toCsv=require(_0xe885('0x8'));var querystring=require(_0xe885('0xe'));var Papa=require(_0xe885('0xf'));var Redis=require(_0xe885('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe885('0x11'));var as=require(_0xe885('0x12'));var hardwareService=require(_0xe885('0x13'));var logger=require(_0xe885('0x14'))(_0xe885('0x15'));var utils=require(_0xe885('0x16'));var config=require(_0xe885('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe885('0x18'))['db'];function respondWithStatusCode(_0x5a9697,_0x457e0f){_0x457e0f=_0x457e0f||0xcc;return function(_0x2fc609){if(_0x2fc609){return _0x5a9697[_0xe885('0x19')](_0x457e0f);}return _0x5a9697[_0xe885('0x1a')](_0x457e0f)[_0xe885('0x1b')]();};}function respondWithResult(_0x5c7442,_0x51c10d){_0x51c10d=_0x51c10d||0xc8;return function(_0x497c18){if(_0x497c18){return _0x5c7442[_0xe885('0x1a')](_0x51c10d)[_0xe885('0x1c')](_0x497c18);}};}function respondWithFilteredResult(_0x2bf6a9,_0x443399){return function(_0x494738){if(_0x494738){var _0x516a0f=typeof _0x443399[_0xe885('0x1d')]==='undefined'&&typeof _0x443399[_0xe885('0x1e')]===_0xe885('0x1f');var _0x4176a4=_0x494738[_0xe885('0x20')];var _0x25a002=_0x516a0f?0x0:_0x443399[_0xe885('0x1d')];var _0x4f5045=_0x516a0f?_0x494738[_0xe885('0x20')]:_0x443399[_0xe885('0x1d')]+_0x443399[_0xe885('0x1e')];var _0x4142a2;if(_0x4f5045>=_0x4176a4){_0x4f5045=_0x4176a4;_0x4142a2=0xc8;}else{_0x4142a2=0xce;}_0x2bf6a9[_0xe885('0x1a')](_0x4142a2);return _0x2bf6a9[_0xe885('0x21')](_0xe885('0x22'),_0x25a002+'-'+_0x4f5045+'/'+_0x4176a4)['json'](_0x494738);}return null;};}function patchUpdates(_0x159624){return function(_0x7ed861){try{jsonpatch[_0xe885('0x23')](_0x7ed861,_0x159624,!![]);}catch(_0x30cc04){return BPromise[_0xe885('0x24')](_0x30cc04);}return _0x7ed861[_0xe885('0x25')]();};}function saveUpdates(_0x221832,_0x4375ff){return function(_0x84a30f){if(_0x84a30f){return _0x84a30f[_0xe885('0x26')](_0x221832)[_0xe885('0x27')](function(_0x6d229a){return _0x6d229a;});}return null;};}function removeEntity(_0x581f03,_0x5b7f07){return function(_0x3e5868){if(_0x3e5868){return _0x3e5868[_0xe885('0x28')]()[_0xe885('0x27')](function(){_0x581f03[_0xe885('0x1a')](0xcc)[_0xe885('0x1b')]();});}};}function handleEntityNotFound(_0x50dd42,_0x249abc){return function(_0x1cac46){if(!_0x1cac46){_0x50dd42[_0xe885('0x19')](0x194);}return _0x1cac46;};}function handleError(_0x4b4049,_0x524190){_0x524190=_0x524190||0x1f4;return function(_0x2ba36e){logger[_0xe885('0x29')](_0x2ba36e[_0xe885('0x2a')]);if(_0x2ba36e[_0xe885('0x2b')]){delete _0x2ba36e[_0xe885('0x2b')];}_0x4b4049['status'](_0x524190)['send'](_0x2ba36e);};}exports[_0xe885('0x2c')]=function(_0xa4916f,_0x1701bd){var _0x4bbbcb={},_0x370a10={},_0x1d7c84={'count':0x0,'rows':[]};var _0x2b56a8=_[_0xe885('0x2d')](db[_0xe885('0x2e')][_0xe885('0x2f')],function(_0x1187c0){return{'name':_0x1187c0[_0xe885('0x30')],'type':_0x1187c0[_0xe885('0x31')]['key']};});_0x370a10['model']=_[_0xe885('0x2d')](_0x2b56a8,_0xe885('0x2b'));_0x370a10[_0xe885('0x32')]=_['keys'](_0xa4916f['query']);_0x370a10[_0xe885('0x33')]=_[_0xe885('0x34')](_0x370a10[_0xe885('0x35')],_0x370a10[_0xe885('0x32')]);_0x4bbbcb[_0xe885('0x36')]=_[_0xe885('0x34')](_0x370a10[_0xe885('0x35')],qs['fields'](_0xa4916f[_0xe885('0x32')]['fields']));_0x4bbbcb['attributes']=_0x4bbbcb['attributes'][_0xe885('0x37')]?_0x4bbbcb[_0xe885('0x36')]:_0x370a10[_0xe885('0x35')];if(!_0xa4916f['query'][_0xe885('0x38')](_0xe885('0x39'))){_0x4bbbcb[_0xe885('0x1e')]=qs[_0xe885('0x1e')](_0xa4916f[_0xe885('0x32')]['limit']);_0x4bbbcb['offset']=qs[_0xe885('0x1d')](_0xa4916f['query'][_0xe885('0x1d')]);}_0x4bbbcb[_0xe885('0x3a')]=qs[_0xe885('0x3b')](_0xa4916f[_0xe885('0x32')][_0xe885('0x3b')]);_0x4bbbcb['where']=qs[_0xe885('0x33')](_[_0xe885('0x3c')](_0xa4916f['query'],_0x370a10['filters']),_0x2b56a8);if(_0xa4916f['query'][_0xe885('0x3d')]){_0x4bbbcb[_0xe885('0x3e')]=_[_0xe885('0x3f')](_0x4bbbcb[_0xe885('0x3e')],{'$or':_['map'](_0x2b56a8,function(_0x116428){if(_0x116428[_0xe885('0x31')]!==_0xe885('0x40')){var _0x3ec257={};_0x3ec257[_0x116428['name']]={'$like':'%'+_0xa4916f['query']['filter']+'%'};return _0x3ec257;}})});}_0x4bbbcb=_[_0xe885('0x3f')]({},_0x4bbbcb,_0xa4916f[_0xe885('0x41')]);var _0x442ca4={'where':_0x4bbbcb[_0xe885('0x3e')]};return db[_0xe885('0x2e')][_0xe885('0x20')](_0x442ca4)[_0xe885('0x27')](function(_0x45870a){_0x1d7c84[_0xe885('0x20')]=_0x45870a;if(_0xa4916f[_0xe885('0x32')][_0xe885('0x42')]){_0x4bbbcb[_0xe885('0x43')]=[{'all':!![]}];}return db[_0xe885('0x2e')][_0xe885('0x44')](_0x4bbbcb);})[_0xe885('0x27')](function(_0x49f74c){_0x1d7c84[_0xe885('0x45')]=_0x49f74c;return _0x1d7c84;})['then'](respondWithFilteredResult(_0x1701bd,_0x4bbbcb))[_0xe885('0x46')](handleError(_0x1701bd,null));};exports[_0xe885('0x47')]=function(_0x5a710c,_0x51898d){var _0x7a2219={'raw':![],'where':{'id':_0x5a710c[_0xe885('0x48')]['id']}},_0x3339f4={};_0x3339f4[_0xe885('0x35')]=_[_0xe885('0x49')](db[_0xe885('0x2e')][_0xe885('0x2f')]);_0x3339f4[_0xe885('0x32')]=_[_0xe885('0x49')](_0x5a710c[_0xe885('0x32')]);_0x3339f4[_0xe885('0x33')]=_[_0xe885('0x34')](_0x3339f4[_0xe885('0x35')],_0x3339f4[_0xe885('0x32')]);_0x7a2219[_0xe885('0x36')]=_['intersection'](_0x3339f4[_0xe885('0x35')],qs['fields'](_0x5a710c[_0xe885('0x32')][_0xe885('0x4a')]));_0x7a2219['attributes']=_0x7a2219[_0xe885('0x36')][_0xe885('0x37')]?_0x7a2219[_0xe885('0x36')]:_0x3339f4['model'];if(_0x5a710c['query'][_0xe885('0x42')]){_0x7a2219[_0xe885('0x43')]=[{'all':!![]}];}_0x7a2219=_[_0xe885('0x3f')]({},_0x7a2219,_0x5a710c[_0xe885('0x41')]);return db[_0xe885('0x2e')]['find'](_0x7a2219)[_0xe885('0x27')](handleEntityNotFound(_0x51898d,null))[_0xe885('0x27')](respondWithResult(_0x51898d,null))[_0xe885('0x46')](handleError(_0x51898d,null));};exports['create']=function(_0x4dad7c,_0x51a285){return db[_0xe885('0x2e')]['create'](_0x4dad7c[_0xe885('0x4b')],{})[_0xe885('0x27')](respondWithResult(_0x51a285,0xc9))[_0xe885('0x46')](handleError(_0x51a285,null));};exports[_0xe885('0x26')]=function(_0x20fcee,_0x5d736c){if(_0x20fcee[_0xe885('0x4b')]['id']){delete _0x20fcee['body']['id'];}return db[_0xe885('0x2e')][_0xe885('0x4c')]({'where':{'id':_0x20fcee[_0xe885('0x48')]['id']}})[_0xe885('0x27')](handleEntityNotFound(_0x5d736c,null))[_0xe885('0x27')](saveUpdates(_0x20fcee[_0xe885('0x4b')],null))[_0xe885('0x27')](respondWithResult(_0x5d736c,null))[_0xe885('0x46')](handleError(_0x5d736c,null));};exports[_0xe885('0x28')]=function(_0x5f4531,_0x11ce41){return db[_0xe885('0x2e')]['find']({'where':{'id':_0x5f4531['params']['id']}})['then'](handleEntityNotFound(_0x11ce41,null))[_0xe885('0x27')](removeEntity(_0x11ce41,null))[_0xe885('0x46')](handleError(_0x11ce41,null));};exports[_0xe885('0x4d')]=function(_0x3b866b,_0x4194a8,_0x17fddc){var _0x46484c={};var _0x4cae2c={};var _0x4aaf05;var _0x1ab4e3;return db[_0xe885('0x2e')][_0xe885('0x4e')]({'where':{'id':_0x3b866b[_0xe885('0x48')]['id']}})['then'](handleEntityNotFound(_0x4194a8,null))[_0xe885('0x27')](function(_0x1dda6b){if(_0x1dda6b){_0x4aaf05=_0x1dda6b;_0x4cae2c[_0xe885('0x35')]=_[_0xe885('0x49')](db[_0xe885('0x4f')]['rawAttributes']);_0x4cae2c[_0xe885('0x32')]=_[_0xe885('0x49')](_0x3b866b[_0xe885('0x32')]);_0x4cae2c[_0xe885('0x33')]=_[_0xe885('0x34')](_0x4cae2c['model'],_0x4cae2c[_0xe885('0x32')]);_0x46484c['attributes']=_['intersection'](_0x4cae2c[_0xe885('0x35')],qs[_0xe885('0x4a')](_0x3b866b[_0xe885('0x32')][_0xe885('0x4a')]));_0x46484c['attributes']=_0x46484c[_0xe885('0x36')][_0xe885('0x37')]?_0x46484c[_0xe885('0x36')]:_0x4cae2c[_0xe885('0x35')];_0x46484c[_0xe885('0x3a')]=qs[_0xe885('0x3b')](_0x3b866b[_0xe885('0x32')][_0xe885('0x3b')]);_0x46484c[_0xe885('0x3e')]=qs[_0xe885('0x33')](_[_0xe885('0x3c')](_0x3b866b[_0xe885('0x32')],_0x4cae2c[_0xe885('0x33')]));if(_0x3b866b[_0xe885('0x32')][_0xe885('0x3d')]){_0x46484c[_0xe885('0x3e')]=_[_0xe885('0x3f')](_0x46484c[_0xe885('0x3e')],{'$or':_[_0xe885('0x2d')](_0x46484c['attributes'],function(_0xbc0bc7){var _0x478168={};_0x478168[_0xbc0bc7]={'$like':'%'+_0x3b866b[_0xe885('0x32')]['filter']+'%'};return _0x478168;})});}_0x46484c=_[_0xe885('0x3f')]({},_0x46484c,_0x3b866b[_0xe885('0x41')]);return _0x4aaf05[_0xe885('0x4d')](_0x46484c);}})[_0xe885('0x27')](function(_0xa7ce6e){if(_0xa7ce6e){_0x1ab4e3=_0xa7ce6e[_0xe885('0x37')];if(!_0x3b866b[_0xe885('0x32')][_0xe885('0x38')](_0xe885('0x39'))){_0x46484c['limit']=qs[_0xe885('0x1e')](_0x3b866b['query'][_0xe885('0x1e')]);_0x46484c[_0xe885('0x1d')]=qs['offset'](_0x3b866b[_0xe885('0x32')]['offset']);}return _0x4aaf05[_0xe885('0x4d')](_0x46484c);}})[_0xe885('0x27')](function(_0x3cb43d){if(_0x3cb43d){return _0x3cb43d?{'count':_0x1ab4e3,'rows':_0x3cb43d}:null;}})[_0xe885('0x27')](respondWithResult(_0x4194a8,null))[_0xe885('0x46')](handleError(_0x4194a8,null));};exports['getSubjects']=function(_0x34e600,_0xace6fd,_0x299143){var _0xc6adec={};var _0x250945={};var _0x401288;var _0xfc6c9f;return db['VtigerConfiguration'][_0xe885('0x4e')]({'where':{'id':_0x34e600['params']['id']}})['then'](handleEntityNotFound(_0xace6fd,null))[_0xe885('0x27')](function(_0x10424b){if(_0x10424b){_0x401288=_0x10424b;_0x250945[_0xe885('0x35')]=_[_0xe885('0x49')](db[_0xe885('0x4f')]['rawAttributes']);_0x250945[_0xe885('0x32')]=_['keys'](_0x34e600[_0xe885('0x32')]);_0x250945[_0xe885('0x33')]=_['intersection'](_0x250945[_0xe885('0x35')],_0x250945[_0xe885('0x32')]);_0xc6adec['attributes']=_[_0xe885('0x34')](_0x250945[_0xe885('0x35')],qs[_0xe885('0x4a')](_0x34e600['query']['fields']));_0xc6adec[_0xe885('0x36')]=_0xc6adec['attributes']['length']?_0xc6adec[_0xe885('0x36')]:_0x250945[_0xe885('0x35')];_0xc6adec[_0xe885('0x3a')]=qs[_0xe885('0x3b')](_0x34e600[_0xe885('0x32')][_0xe885('0x3b')]);_0xc6adec[_0xe885('0x3e')]=qs[_0xe885('0x33')](_[_0xe885('0x3c')](_0x34e600['query'],_0x250945[_0xe885('0x33')]));if(_0x34e600[_0xe885('0x32')][_0xe885('0x3d')]){_0xc6adec[_0xe885('0x3e')]=_[_0xe885('0x3f')](_0xc6adec[_0xe885('0x3e')],{'$or':_[_0xe885('0x2d')](_0xc6adec['attributes'],function(_0x7262a7){var _0x4076a8={};_0x4076a8[_0x7262a7]={'$like':'%'+_0x34e600[_0xe885('0x32')][_0xe885('0x3d')]+'%'};return _0x4076a8;})});}_0xc6adec=_['merge']({},_0xc6adec,_0x34e600[_0xe885('0x41')]);return _0x401288['getSubjects'](_0xc6adec);}})['then'](function(_0x440602){if(_0x440602){_0xfc6c9f=_0x440602[_0xe885('0x37')];if(!_0x34e600[_0xe885('0x32')][_0xe885('0x38')](_0xe885('0x39'))){_0xc6adec[_0xe885('0x1e')]=qs[_0xe885('0x1e')](_0x34e600[_0xe885('0x32')][_0xe885('0x1e')]);_0xc6adec['offset']=qs[_0xe885('0x1d')](_0x34e600[_0xe885('0x32')][_0xe885('0x1d')]);}return _0x401288[_0xe885('0x50')](_0xc6adec);}})['then'](function(_0x4b15f6){if(_0x4b15f6){return _0x4b15f6?{'count':_0xfc6c9f,'rows':_0x4b15f6}:null;}})[_0xe885('0x27')](respondWithResult(_0xace6fd,null))['catch'](handleError(_0xace6fd,null));};exports[_0xe885('0x51')]=function(_0x54ad49,_0x1bfb8d,_0x9175d4){var _0x416c34={};var _0x4d79b8={};var _0x1d2e02;var _0x3351b4;return db[_0xe885('0x2e')][_0xe885('0x4e')]({'where':{'id':_0x54ad49[_0xe885('0x48')]['id']}})['then'](handleEntityNotFound(_0x1bfb8d,null))[_0xe885('0x27')](function(_0x4a4bbe){if(_0x4a4bbe){_0x1d2e02=_0x4a4bbe;_0x4d79b8[_0xe885('0x35')]=_[_0xe885('0x49')](db[_0xe885('0x4f')][_0xe885('0x2f')]);_0x4d79b8[_0xe885('0x32')]=_[_0xe885('0x49')](_0x54ad49['query']);_0x4d79b8['filters']=_[_0xe885('0x34')](_0x4d79b8[_0xe885('0x35')],_0x4d79b8['query']);_0x416c34[_0xe885('0x36')]=_[_0xe885('0x34')](_0x4d79b8[_0xe885('0x35')],qs[_0xe885('0x4a')](_0x54ad49[_0xe885('0x32')]['fields']));_0x416c34['attributes']=_0x416c34[_0xe885('0x36')]['length']?_0x416c34[_0xe885('0x36')]:_0x4d79b8['model'];_0x416c34[_0xe885('0x3a')]=qs[_0xe885('0x3b')](_0x54ad49['query'][_0xe885('0x3b')]);_0x416c34['where']=qs[_0xe885('0x33')](_[_0xe885('0x3c')](_0x54ad49[_0xe885('0x32')],_0x4d79b8[_0xe885('0x33')]));if(_0x54ad49[_0xe885('0x32')][_0xe885('0x3d')]){_0x416c34[_0xe885('0x3e')]=_[_0xe885('0x3f')](_0x416c34['where'],{'$or':_[_0xe885('0x2d')](_0x416c34[_0xe885('0x36')],function(_0x2ae91d){var _0x1331ba={};_0x1331ba[_0x2ae91d]={'$like':'%'+_0x54ad49[_0xe885('0x32')]['filter']+'%'};return _0x1331ba;})});}_0x416c34=_['merge']({},_0x416c34,_0x54ad49[_0xe885('0x41')]);return _0x1d2e02[_0xe885('0x51')](_0x416c34);}})[_0xe885('0x27')](function(_0x24b0dd){if(_0x24b0dd){_0x3351b4=_0x24b0dd[_0xe885('0x37')];if(!_0x54ad49[_0xe885('0x32')][_0xe885('0x38')](_0xe885('0x39'))){_0x416c34[_0xe885('0x1e')]=qs[_0xe885('0x1e')](_0x54ad49['query'][_0xe885('0x1e')]);_0x416c34[_0xe885('0x1d')]=qs[_0xe885('0x1d')](_0x54ad49[_0xe885('0x32')][_0xe885('0x1d')]);}return _0x1d2e02[_0xe885('0x51')](_0x416c34);}})[_0xe885('0x27')](function(_0x41604f){if(_0x41604f){return _0x41604f?{'count':_0x3351b4,'rows':_0x41604f}:null;}})['then'](respondWithResult(_0x1bfb8d,null))[_0xe885('0x46')](handleError(_0x1bfb8d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index e87ec03..135e7b3 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 _0x4bf7=['api','moment','bluebird','path','rimraf','../../config/environment','lodash','util','../../config/logger'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x4bf7,0x1c8));var _0x74bf=function(_0x13236f,_0x3db392){_0x13236f=_0x13236f-0x0;var _0x53b19c=_0x4bf7[_0x13236f];return _0x53b19c;};'use strict';var _=require(_0x74bf('0x0'));var util=require(_0x74bf('0x1'));var logger=require(_0x74bf('0x2'))(_0x74bf('0x3'));var moment=require(_0x74bf('0x4'));var BPromise=require(_0x74bf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x74bf('0x6'));var rimraf=require(_0x74bf('0x7'));var config=require(_0x74bf('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x57bd78,_0x133157){return _0x57bd78['define']('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2d0=['../../config/logger','moment','bluebird','request-promise','path','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x55d1ab,_0x8641de){var _0x516dba=function(_0x3f5549){while(--_0x3f5549){_0x55d1ab['push'](_0x55d1ab['shift']());}};_0x516dba(++_0x8641de);}(_0xe2d0,0xe5));var _0x0e2d=function(_0x2d03c0,_0x49efbc){_0x2d03c0=_0x2d03c0-0x0;var _0xe98bfa=_0xe2d0[_0x2d03c0];return _0xe98bfa;};'use strict';var _=require(_0x0e2d('0x0'));var util=require(_0x0e2d('0x1'));var logger=require(_0x0e2d('0x2'))('api');var moment=require(_0x0e2d('0x3'));var BPromise=require(_0x0e2d('0x4'));var rp=require(_0x0e2d('0x5'));var fs=require('fs');var path=require(_0x0e2d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0e2d('0x7'));module['exports']=function(_0x2a5b9d,_0x42bd84){return _0x2a5b9d[_0x0e2d('0x8')](_0x0e2d('0x9'),attributes,{'tableName':_0x0e2d('0xa'),'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 e6f6fcf..2aec733 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 _0xaeb8=['catch','lodash','moment','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result'];(function(_0x2f80b3,_0x2d672b){var _0x3355fe=function(_0xb4685e){while(--_0xb4685e){_0x2f80b3['push'](_0x2f80b3['shift']());}};_0x3355fe(++_0x2d672b);}(_0xaeb8,0xc9));var _0x8aeb=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0xaeb8[_0x2a0183];return _0x158c3a;};'use strict';var _=require(_0x8aeb('0x0'));var util=require('util');var moment=require(_0x8aeb('0x1'));var BPromise=require('bluebird');var rs=require(_0x8aeb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8aeb('0x3'))(_0x8aeb('0x4'));var config=require('../../config/environment');var jayson=require(_0x8aeb('0x5'));var client=jayson[_0x8aeb('0x6')][_0x8aeb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x437935,_0x2c1c24,_0x559dd9){return new BPromise(function(_0x315af9,_0x4446f4){return client[_0x8aeb('0x8')](_0x437935,_0x559dd9)[_0x8aeb('0x9')](function(_0x53db9f){logger['info'](_0x8aeb('0xa'),_0x2c1c24,'request\x20sent');logger[_0x8aeb('0xb')](_0x8aeb('0xc'),_0x2c1c24,_0x8aeb('0xd'),JSON['stringify'](_0x53db9f));if(_0x53db9f[_0x8aeb('0xe')]){if(_0x53db9f[_0x8aeb('0xe')][_0x8aeb('0xf')]===0x1f4){logger[_0x8aeb('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x2c1c24,_0x53db9f[_0x8aeb('0xe')][_0x8aeb('0x10')]);return _0x4446f4(_0x53db9f[_0x8aeb('0xe')][_0x8aeb('0x10')]);}logger[_0x8aeb('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x2c1c24,_0x53db9f[_0x8aeb('0xe')][_0x8aeb('0x10')]);return _0x315af9(_0x53db9f[_0x8aeb('0xe')]['message']);}else{logger[_0x8aeb('0x11')](_0x8aeb('0xa'),_0x2c1c24,_0x8aeb('0xd'));_0x315af9(_0x53db9f[_0x8aeb('0x12')][_0x8aeb('0x10')]);}})[_0x8aeb('0x13')](function(_0x44eb81){logger[_0x8aeb('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x2c1c24,_0x44eb81);_0x4446f4(_0x44eb81);});});} \ No newline at end of file +var _0x481b=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x34217a,_0x1f545a){var _0x23c2be=function(_0x122660){while(--_0x122660){_0x34217a['push'](_0x34217a['shift']());}};_0x23c2be(++_0x1f545a);}(_0x481b,0x147));var _0xb481=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x481b[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xb481('0x0'));var util=require(_0xb481('0x1'));var moment=require(_0xb481('0x2'));var BPromise=require(_0xb481('0x3'));var rs=require(_0xb481('0x4'));var fs=require('fs');var Redis=require(_0xb481('0x5'));var db=require(_0xb481('0x6'))['db'];var utils=require(_0xb481('0x7'));var logger=require(_0xb481('0x8'))('rpc');var config=require(_0xb481('0x9'));var jayson=require(_0xb481('0xa'));var client=jayson['client'][_0xb481('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14bc4e,_0x412618,_0x42d633){return new BPromise(function(_0x533fbd,_0x1dacab){return client[_0xb481('0xc')](_0x14bc4e,_0x42d633)[_0xb481('0xd')](function(_0x45608c){logger[_0xb481('0xe')](_0xb481('0xf'),_0x412618,_0xb481('0x10'));logger[_0xb481('0x11')](_0xb481('0x12'),_0x412618,_0xb481('0x10'),JSON[_0xb481('0x13')](_0x45608c));if(_0x45608c[_0xb481('0x14')]){if(_0x45608c[_0xb481('0x14')]['code']===0x1f4){logger[_0xb481('0x14')](_0xb481('0xf'),_0x412618,_0x45608c[_0xb481('0x14')][_0xb481('0x15')]);return _0x1dacab(_0x45608c[_0xb481('0x14')]['message']);}logger[_0xb481('0x14')](_0xb481('0xf'),_0x412618,_0x45608c[_0xb481('0x14')]['message']);return _0x533fbd(_0x45608c[_0xb481('0x14')]['message']);}else{logger[_0xb481('0xe')](_0xb481('0xf'),_0x412618,_0xb481('0x10'));_0x533fbd(_0x45608c['result'][_0xb481('0x15')]);}})[_0xb481('0x16')](function(_0x27f8e3){logger[_0xb481('0x14')](_0xb481('0xf'),_0x412618,_0x27f8e3);_0x1dacab(_0x27f8e3);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 6924b55..4a9ac7f 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 _0x53f3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','multer','path','connect-timeout','express','fs-extra'];(function(_0x525eb3,_0x549ee6){var _0x395c23=function(_0x48bc4d){while(--_0x48bc4d){_0x525eb3['push'](_0x525eb3['shift']());}};_0x395c23(++_0x549ee6);}(_0x53f3,0xb9));var _0x353f=function(_0x319df2,_0x4085fb){_0x319df2=_0x319df2-0x0;var _0x41f9df=_0x53f3[_0x319df2];return _0x41f9df;};'use strict';var multer=require(_0x353f('0x0'));var util=require('util');var path=require(_0x353f('0x1'));var timeout=require(_0x353f('0x2'));var express=require(_0x353f('0x3'));var router=express['Router']();var fs_extra=require(_0x353f('0x4'));var auth=require(_0x353f('0x5'));var interaction=require(_0x353f('0x6'));var config=require(_0x353f('0x7'));var controller=require(_0x353f('0x8'));router[_0x353f('0x9')]('/',auth['isAuthenticated'](),controller[_0x353f('0xa')]);router['get'](_0x353f('0xb'),auth[_0x353f('0xc')](),controller[_0x353f('0xd')]);router[_0x353f('0xe')]('/',auth['isAuthenticated'](),controller[_0x353f('0xf')]);router[_0x353f('0x10')](_0x353f('0xb'),auth[_0x353f('0xc')](),controller[_0x353f('0x11')]);router[_0x353f('0x12')](_0x353f('0xb'),auth[_0x353f('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8fde=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports'];(function(_0x2dfb96,_0x49142f){var _0x47350b=function(_0x2c2320){while(--_0x2c2320){_0x2dfb96['push'](_0x2dfb96['shift']());}};_0x47350b(++_0x49142f);}(_0x8fde,0x132));var _0xe8fd=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x8fde[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe8fd('0x0'));var express=require(_0xe8fd('0x1'));var router=express[_0xe8fd('0x2')]();var fs_extra=require(_0xe8fd('0x3'));var auth=require(_0xe8fd('0x4'));var interaction=require(_0xe8fd('0x5'));var config=require(_0xe8fd('0x6'));var controller=require('./intVtigerField.controller');router[_0xe8fd('0x7')]('/',auth[_0xe8fd('0x8')](),controller[_0xe8fd('0x9')]);router['get'](_0xe8fd('0xa'),auth[_0xe8fd('0x8')](),controller['show']);router['post']('/',auth[_0xe8fd('0x8')](),controller[_0xe8fd('0xb')]);router[_0xe8fd('0xc')](_0xe8fd('0xa'),auth['isAuthenticated'](),controller[_0xe8fd('0xd')]);router[_0xe8fd('0xe')](_0xe8fd('0xa'),auth['isAuthenticated'](),controller[_0xe8fd('0xf')]);module[_0xe8fd('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 361a074..0c41547 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 _0x5063=['string','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5063,0x1be));var _0x3506=function(_0x464c9b,_0x3d1eff){_0x464c9b=_0x464c9b-0x0;var _0x444434=_0x5063[_0x464c9b];return _0x444434;};'use strict';var Sequelize=require(_0x3506('0x0'));module['exports']={'type':{'type':Sequelize[_0x3506('0x1')](_0x3506('0x2'),'variable',_0x3506('0x3'),'keyValue',_0x3506('0x4')),'defaultValue':_0x3506('0x2')},'content':{'type':Sequelize[_0x3506('0x5')]},'key':{'type':Sequelize[_0x3506('0x5')]},'keyType':{'type':Sequelize[_0x3506('0x1')]('string','variable',_0x3506('0x3'))},'keyContent':{'type':Sequelize[_0x3506('0x5')]},'idField':{'type':Sequelize[_0x3506('0x5')]},'nameField':{'type':Sequelize[_0x3506('0x5')]},'customField':{'type':Sequelize[_0x3506('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf571=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xf571,0xdb));var _0x1f57=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf571[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x1f57('0x0'));module[_0x1f57('0x1')]={'type':{'type':Sequelize[_0x1f57('0x2')]('string',_0x1f57('0x3'),_0x1f57('0x4'),_0x1f57('0x5'),_0x1f57('0x6')),'defaultValue':_0x1f57('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1f57('0x8')]},'keyType':{'type':Sequelize[_0x1f57('0x2')](_0x1f57('0x7'),_0x1f57('0x3'),_0x1f57('0x4'))},'keyContent':{'type':Sequelize[_0x1f57('0x8')]},'idField':{'type':Sequelize[_0x1f57('0x8')]},'nameField':{'type':Sequelize[_0x1f57('0x8')]},'customField':{'type':Sequelize[_0x1f57('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1f57('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 13d0c5f..3af0470 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 _0x272a=['sort','filters','pick','where','merge','VIRTUAL','filter','options','findAll','params','intersection','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','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','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','send','map','VtigerField','rawAttributes','type','keys','query','model','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0xc6d35,_0x445827){var _0x41a7cb=function(_0x2b2039){while(--_0x2b2039){_0xc6d35['push'](_0xc6d35['shift']());}};_0x41a7cb(++_0x445827);}(_0x272a,0x124));var _0xa272=function(_0x568069,_0x6e813f){_0x568069=_0x568069-0x0;var _0x99f063=_0x272a[_0x568069];return _0x99f063;};'use strict';var emlformat=require(_0xa272('0x0'));var rimraf=require(_0xa272('0x1'));var zipdir=require(_0xa272('0x2'));var jsonpatch=require(_0xa272('0x3'));var rp=require('request-promise');var moment=require(_0xa272('0x4'));var BPromise=require(_0xa272('0x5'));var Mustache=require('mustache');var util=require(_0xa272('0x6'));var path=require('path');var sox=require(_0xa272('0x7'));var csv=require(_0xa272('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa272('0x9'));var _=require('lodash');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(_0xa272('0xa'));var Papa=require(_0xa272('0xb'));var Redis=require(_0xa272('0xc'));var authService=require(_0xa272('0xd'));var qs=require(_0xa272('0xe'));var as=require(_0xa272('0xf'));var hardwareService=require(_0xa272('0x10'));var logger=require(_0xa272('0x11'))(_0xa272('0x12'));var utils=require(_0xa272('0x13'));var config=require(_0xa272('0x14'));var licenseUtil=require(_0xa272('0x15'));var db=require(_0xa272('0x16'))['db'];function respondWithStatusCode(_0xc14cb4,_0xf68f6e){_0xf68f6e=_0xf68f6e||0xcc;return function(_0x2a14a9){if(_0x2a14a9){return _0xc14cb4[_0xa272('0x17')](_0xf68f6e);}return _0xc14cb4[_0xa272('0x18')](_0xf68f6e)[_0xa272('0x19')]();};}function respondWithResult(_0x34afb6,_0x42863f){_0x42863f=_0x42863f||0xc8;return function(_0x4323f1){if(_0x4323f1){return _0x34afb6[_0xa272('0x18')](_0x42863f)[_0xa272('0x1a')](_0x4323f1);}};}function respondWithFilteredResult(_0x6107a3,_0x89a58a){return function(_0x1feb36){if(_0x1feb36){var _0x3e616b=typeof _0x89a58a['offset']===_0xa272('0x1b')&&typeof _0x89a58a[_0xa272('0x1c')]===_0xa272('0x1b');var _0x2f17a4=_0x1feb36[_0xa272('0x1d')];var _0x433fe3=_0x3e616b?0x0:_0x89a58a[_0xa272('0x1e')];var _0x4a1ee8=_0x3e616b?_0x1feb36[_0xa272('0x1d')]:_0x89a58a[_0xa272('0x1e')]+_0x89a58a['limit'];var _0x46fdf1;if(_0x4a1ee8>=_0x2f17a4){_0x4a1ee8=_0x2f17a4;_0x46fdf1=0xc8;}else{_0x46fdf1=0xce;}_0x6107a3[_0xa272('0x18')](_0x46fdf1);return _0x6107a3[_0xa272('0x1f')](_0xa272('0x20'),_0x433fe3+'-'+_0x4a1ee8+'/'+_0x2f17a4)[_0xa272('0x1a')](_0x1feb36);}return null;};}function patchUpdates(_0x3e1385){return function(_0x432a41){try{jsonpatch[_0xa272('0x21')](_0x432a41,_0x3e1385,!![]);}catch(_0x423094){return BPromise[_0xa272('0x22')](_0x423094);}return _0x432a41[_0xa272('0x23')]();};}function saveUpdates(_0x5b1265,_0x3dddd5){return function(_0x2ea06a){if(_0x2ea06a){return _0x2ea06a[_0xa272('0x24')](_0x5b1265)[_0xa272('0x25')](function(_0x8bfdc0){return _0x8bfdc0;});}return null;};}function removeEntity(_0x3b5e32,_0x4e2716){return function(_0x2ac675){if(_0x2ac675){return _0x2ac675[_0xa272('0x26')]()[_0xa272('0x25')](function(){_0x3b5e32[_0xa272('0x18')](0xcc)[_0xa272('0x19')]();});}};}function handleEntityNotFound(_0x32fbdd,_0x223fbd){return function(_0x1b8761){if(!_0x1b8761){_0x32fbdd[_0xa272('0x17')](0x194);}return _0x1b8761;};}function handleError(_0x39e91d,_0x35c92b){_0x35c92b=_0x35c92b||0x1f4;return function(_0x5404a1){logger['error'](_0x5404a1['stack']);if(_0x5404a1[_0xa272('0x27')]){delete _0x5404a1['name'];}_0x39e91d['status'](_0x35c92b)[_0xa272('0x28')](_0x5404a1);};}exports['index']=function(_0xe0c5bb,_0x48da9a){var _0x1d3ac2={},_0x40b578={},_0x44bf6a={'count':0x0,'rows':[]};var _0x169bac=_[_0xa272('0x29')](db[_0xa272('0x2a')][_0xa272('0x2b')],function(_0x52d574){return{'name':_0x52d574['fieldName'],'type':_0x52d574[_0xa272('0x2c')]['key']};});_0x40b578['model']=_[_0xa272('0x29')](_0x169bac,_0xa272('0x27'));_0x40b578['query']=_[_0xa272('0x2d')](_0xe0c5bb[_0xa272('0x2e')]);_0x40b578['filters']=_['intersection'](_0x40b578[_0xa272('0x2f')],_0x40b578[_0xa272('0x2e')]);_0x1d3ac2['attributes']=_['intersection'](_0x40b578[_0xa272('0x2f')],qs[_0xa272('0x30')](_0xe0c5bb[_0xa272('0x2e')][_0xa272('0x30')]));_0x1d3ac2[_0xa272('0x31')]=_0x1d3ac2[_0xa272('0x31')]['length']?_0x1d3ac2['attributes']:_0x40b578['model'];if(!_0xe0c5bb[_0xa272('0x2e')][_0xa272('0x32')](_0xa272('0x33'))){_0x1d3ac2[_0xa272('0x1c')]=qs[_0xa272('0x1c')](_0xe0c5bb[_0xa272('0x2e')][_0xa272('0x1c')]);_0x1d3ac2['offset']=qs[_0xa272('0x1e')](_0xe0c5bb['query'][_0xa272('0x1e')]);}_0x1d3ac2[_0xa272('0x34')]=qs[_0xa272('0x35')](_0xe0c5bb[_0xa272('0x2e')][_0xa272('0x35')]);_0x1d3ac2['where']=qs[_0xa272('0x36')](_[_0xa272('0x37')](_0xe0c5bb[_0xa272('0x2e')],_0x40b578['filters']),_0x169bac);if(_0xe0c5bb['query']['filter']){_0x1d3ac2[_0xa272('0x38')]=_[_0xa272('0x39')](_0x1d3ac2[_0xa272('0x38')],{'$or':_[_0xa272('0x29')](_0x169bac,function(_0xd78d22){if(_0xd78d22[_0xa272('0x2c')]!==_0xa272('0x3a')){var _0x3492bb={};_0x3492bb[_0xd78d22[_0xa272('0x27')]]={'$like':'%'+_0xe0c5bb[_0xa272('0x2e')][_0xa272('0x3b')]+'%'};return _0x3492bb;}})});}_0x1d3ac2=_[_0xa272('0x39')]({},_0x1d3ac2,_0xe0c5bb[_0xa272('0x3c')]);var _0x8fd158={'where':_0x1d3ac2['where']};return db[_0xa272('0x2a')][_0xa272('0x1d')](_0x8fd158)['then'](function(_0x13d236){_0x44bf6a['count']=_0x13d236;if(_0xe0c5bb[_0xa272('0x2e')]['includeAll']){_0x1d3ac2['include']=[{'all':!![]}];}return db[_0xa272('0x2a')][_0xa272('0x3d')](_0x1d3ac2);})[_0xa272('0x25')](function(_0x5be236){_0x44bf6a['rows']=_0x5be236;return _0x44bf6a;})[_0xa272('0x25')](respondWithFilteredResult(_0x48da9a,_0x1d3ac2))['catch'](handleError(_0x48da9a,null));};exports['show']=function(_0x5f1781,_0x484e9a){var _0x2eb03a={'raw':!![],'where':{'id':_0x5f1781[_0xa272('0x3e')]['id']}},_0x1b2fb9={};_0x1b2fb9[_0xa272('0x2f')]=_[_0xa272('0x2d')](db[_0xa272('0x2a')]['rawAttributes']);_0x1b2fb9[_0xa272('0x2e')]=_[_0xa272('0x2d')](_0x5f1781[_0xa272('0x2e')]);_0x1b2fb9[_0xa272('0x36')]=_[_0xa272('0x3f')](_0x1b2fb9[_0xa272('0x2f')],_0x1b2fb9[_0xa272('0x2e')]);_0x2eb03a[_0xa272('0x31')]=_['intersection'](_0x1b2fb9[_0xa272('0x2f')],qs[_0xa272('0x30')](_0x5f1781[_0xa272('0x2e')]['fields']));_0x2eb03a[_0xa272('0x31')]=_0x2eb03a[_0xa272('0x31')][_0xa272('0x40')]?_0x2eb03a[_0xa272('0x31')]:_0x1b2fb9[_0xa272('0x2f')];if(_0x5f1781[_0xa272('0x2e')]['includeAll']){_0x2eb03a['include']=[{'all':!![]}];}_0x2eb03a=_['merge']({},_0x2eb03a,_0x5f1781['options']);return db['VtigerField'][_0xa272('0x41')](_0x2eb03a)['then'](handleEntityNotFound(_0x484e9a,null))[_0xa272('0x25')](respondWithResult(_0x484e9a,null))[_0xa272('0x42')](handleError(_0x484e9a,null));};exports[_0xa272('0x43')]=function(_0x399ff5,_0x3ba212){return db['VtigerField'][_0xa272('0x43')](_0x399ff5[_0xa272('0x44')],{})['then'](respondWithResult(_0x3ba212,0xc9))[_0xa272('0x42')](handleError(_0x3ba212,null));};exports[_0xa272('0x24')]=function(_0x1d7375,_0x24d9c7){if(_0x1d7375[_0xa272('0x44')]['id']){delete _0x1d7375[_0xa272('0x44')]['id'];}return db[_0xa272('0x2a')][_0xa272('0x41')]({'where':{'id':_0x1d7375[_0xa272('0x3e')]['id']}})['then'](handleEntityNotFound(_0x24d9c7,null))[_0xa272('0x25')](saveUpdates(_0x1d7375['body'],null))['then'](respondWithResult(_0x24d9c7,null))[_0xa272('0x42')](handleError(_0x24d9c7,null));};exports['destroy']=function(_0x4b72d4,_0x353ed8){return db[_0xa272('0x2a')][_0xa272('0x41')]({'where':{'id':_0x4b72d4[_0xa272('0x3e')]['id']}})[_0xa272('0x25')](handleEntityNotFound(_0x353ed8,null))[_0xa272('0x25')](removeEntity(_0x353ed8,null))[_0xa272('0x42')](handleError(_0x353ed8,null));}; \ No newline at end of file +var _0xfb7e=['request-promise','moment','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/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','destroy','then','stack','index','map','VtigerField','rawAttributes','type','key','name','query','keys','filters','intersection','model','attributes','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','length','find','create','body','update','eml-format','rimraf','zip-dir'];(function(_0x30d00e,_0x19adbf){var _0x4bd7e9=function(_0xd67a99){while(--_0xd67a99){_0x30d00e['push'](_0x30d00e['shift']());}};_0x4bd7e9(++_0x19adbf);}(_0xfb7e,0x115));var _0xefb7=function(_0x5b850c,_0x53b96e){_0x5b850c=_0x5b850c-0x0;var _0xf05202=_0xfb7e[_0x5b850c];return _0xf05202;};'use strict';var emlformat=require(_0xefb7('0x0'));var rimraf=require(_0xefb7('0x1'));var zipdir=require(_0xefb7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefb7('0x3'));var moment=require(_0xefb7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xefb7('0x5'));var path=require(_0xefb7('0x6'));var sox=require('sox');var csv=require(_0xefb7('0x7'));var ejs=require(_0xefb7('0x8'));var fs=require('fs');var fs_extra=require(_0xefb7('0x9'));var _=require(_0xefb7('0xa'));var squel=require(_0xefb7('0xb'));var crypto=require(_0xefb7('0xc'));var jsforce=require(_0xefb7('0xd'));var deskjs=require(_0xefb7('0xe'));var toCsv=require('to-csv');var querystring=require(_0xefb7('0xf'));var Papa=require('papaparse');var Redis=require(_0xefb7('0x10'));var authService=require(_0xefb7('0x11'));var qs=require(_0xefb7('0x12'));var as=require(_0xefb7('0x13'));var hardwareService=require(_0xefb7('0x14'));var logger=require('../../config/logger')(_0xefb7('0x15'));var utils=require('../../config/utils');var config=require(_0xefb7('0x16'));var licenseUtil=require(_0xefb7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x454b37,_0x34b0f4){_0x34b0f4=_0x34b0f4||0xcc;return function(_0x3e8427){if(_0x3e8427){return _0x454b37[_0xefb7('0x18')](_0x34b0f4);}return _0x454b37[_0xefb7('0x19')](_0x34b0f4)['end']();};}function respondWithResult(_0x449236,_0x154441){_0x154441=_0x154441||0xc8;return function(_0x4d4748){if(_0x4d4748){return _0x449236['status'](_0x154441)[_0xefb7('0x1a')](_0x4d4748);}};}function respondWithFilteredResult(_0x1e7d70,_0x54b0d3){return function(_0x38ddc2){if(_0x38ddc2){var _0x244a01=typeof _0x54b0d3[_0xefb7('0x1b')]===_0xefb7('0x1c')&&typeof _0x54b0d3[_0xefb7('0x1d')]==='undefined';var _0x470515=_0x38ddc2[_0xefb7('0x1e')];var _0x15c9af=_0x244a01?0x0:_0x54b0d3[_0xefb7('0x1b')];var _0x22e04e=_0x244a01?_0x38ddc2['count']:_0x54b0d3[_0xefb7('0x1b')]+_0x54b0d3['limit'];var _0x42d877;if(_0x22e04e>=_0x470515){_0x22e04e=_0x470515;_0x42d877=0xc8;}else{_0x42d877=0xce;}_0x1e7d70[_0xefb7('0x19')](_0x42d877);return _0x1e7d70['set'](_0xefb7('0x1f'),_0x15c9af+'-'+_0x22e04e+'/'+_0x470515)[_0xefb7('0x1a')](_0x38ddc2);}return null;};}function patchUpdates(_0x47f846){return function(_0x498f97){try{jsonpatch['apply'](_0x498f97,_0x47f846,!![]);}catch(_0x319aa5){return BPromise[_0xefb7('0x20')](_0x319aa5);}return _0x498f97[_0xefb7('0x21')]();};}function saveUpdates(_0x502f2e,_0x549112){return function(_0x584387){if(_0x584387){return _0x584387['update'](_0x502f2e)['then'](function(_0x209e8c){return _0x209e8c;});}return null;};}function removeEntity(_0x5b0698,_0x587efb){return function(_0x265afc){if(_0x265afc){return _0x265afc[_0xefb7('0x22')]()[_0xefb7('0x23')](function(){_0x5b0698[_0xefb7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1be6f0,_0x343fae){return function(_0x3795d6){if(!_0x3795d6){_0x1be6f0[_0xefb7('0x18')](0x194);}return _0x3795d6;};}function handleError(_0x2f73a6,_0x58ff59){_0x58ff59=_0x58ff59||0x1f4;return function(_0x209251){logger['error'](_0x209251[_0xefb7('0x24')]);if(_0x209251['name']){delete _0x209251['name'];}_0x2f73a6['status'](_0x58ff59)['send'](_0x209251);};}exports[_0xefb7('0x25')]=function(_0x11137d,_0xcbe202){var _0x4a32dd={},_0x1a4547={},_0x3d941a={'count':0x0,'rows':[]};var _0x1cdd51=_[_0xefb7('0x26')](db[_0xefb7('0x27')][_0xefb7('0x28')],function(_0x5f5112){return{'name':_0x5f5112['fieldName'],'type':_0x5f5112[_0xefb7('0x29')][_0xefb7('0x2a')]};});_0x1a4547['model']=_[_0xefb7('0x26')](_0x1cdd51,_0xefb7('0x2b'));_0x1a4547[_0xefb7('0x2c')]=_[_0xefb7('0x2d')](_0x11137d[_0xefb7('0x2c')]);_0x1a4547[_0xefb7('0x2e')]=_[_0xefb7('0x2f')](_0x1a4547[_0xefb7('0x30')],_0x1a4547['query']);_0x4a32dd['attributes']=_[_0xefb7('0x2f')](_0x1a4547[_0xefb7('0x30')],qs['fields'](_0x11137d[_0xefb7('0x2c')]['fields']));_0x4a32dd['attributes']=_0x4a32dd[_0xefb7('0x31')]['length']?_0x4a32dd[_0xefb7('0x31')]:_0x1a4547[_0xefb7('0x30')];if(!_0x11137d[_0xefb7('0x2c')]['hasOwnProperty'](_0xefb7('0x32'))){_0x4a32dd[_0xefb7('0x1d')]=qs[_0xefb7('0x1d')](_0x11137d[_0xefb7('0x2c')][_0xefb7('0x1d')]);_0x4a32dd['offset']=qs[_0xefb7('0x1b')](_0x11137d[_0xefb7('0x2c')][_0xefb7('0x1b')]);}_0x4a32dd['order']=qs[_0xefb7('0x33')](_0x11137d[_0xefb7('0x2c')][_0xefb7('0x33')]);_0x4a32dd['where']=qs[_0xefb7('0x2e')](_[_0xefb7('0x34')](_0x11137d['query'],_0x1a4547['filters']),_0x1cdd51);if(_0x11137d['query'][_0xefb7('0x35')]){_0x4a32dd[_0xefb7('0x36')]=_[_0xefb7('0x37')](_0x4a32dd[_0xefb7('0x36')],{'$or':_['map'](_0x1cdd51,function(_0x3f7b10){if(_0x3f7b10[_0xefb7('0x29')]!==_0xefb7('0x38')){var _0x57e7d6={};_0x57e7d6[_0x3f7b10[_0xefb7('0x2b')]]={'$like':'%'+_0x11137d[_0xefb7('0x2c')][_0xefb7('0x35')]+'%'};return _0x57e7d6;}})});}_0x4a32dd=_[_0xefb7('0x37')]({},_0x4a32dd,_0x11137d[_0xefb7('0x39')]);var _0x333d8e={'where':_0x4a32dd[_0xefb7('0x36')]};return db[_0xefb7('0x27')]['count'](_0x333d8e)[_0xefb7('0x23')](function(_0x3960d4){_0x3d941a[_0xefb7('0x1e')]=_0x3960d4;if(_0x11137d[_0xefb7('0x2c')][_0xefb7('0x3a')]){_0x4a32dd[_0xefb7('0x3b')]=[{'all':!![]}];}return db[_0xefb7('0x27')]['findAll'](_0x4a32dd);})['then'](function(_0x1fe47e){_0x3d941a[_0xefb7('0x3c')]=_0x1fe47e;return _0x3d941a;})[_0xefb7('0x23')](respondWithFilteredResult(_0xcbe202,_0x4a32dd))[_0xefb7('0x3d')](handleError(_0xcbe202,null));};exports[_0xefb7('0x3e')]=function(_0x566b06,_0x4906cb){var _0x579147={'raw':!![],'where':{'id':_0x566b06[_0xefb7('0x3f')]['id']}},_0x4a56f={};_0x4a56f['model']=_[_0xefb7('0x2d')](db[_0xefb7('0x27')][_0xefb7('0x28')]);_0x4a56f['query']=_[_0xefb7('0x2d')](_0x566b06['query']);_0x4a56f[_0xefb7('0x2e')]=_[_0xefb7('0x2f')](_0x4a56f['model'],_0x4a56f[_0xefb7('0x2c')]);_0x579147[_0xefb7('0x31')]=_['intersection'](_0x4a56f[_0xefb7('0x30')],qs['fields'](_0x566b06[_0xefb7('0x2c')][_0xefb7('0x40')]));_0x579147[_0xefb7('0x31')]=_0x579147[_0xefb7('0x31')][_0xefb7('0x41')]?_0x579147['attributes']:_0x4a56f[_0xefb7('0x30')];if(_0x566b06[_0xefb7('0x2c')][_0xefb7('0x3a')]){_0x579147[_0xefb7('0x3b')]=[{'all':!![]}];}_0x579147=_['merge']({},_0x579147,_0x566b06[_0xefb7('0x39')]);return db[_0xefb7('0x27')][_0xefb7('0x42')](_0x579147)['then'](handleEntityNotFound(_0x4906cb,null))[_0xefb7('0x23')](respondWithResult(_0x4906cb,null))[_0xefb7('0x3d')](handleError(_0x4906cb,null));};exports['create']=function(_0x1af49f,_0x543d92){return db['VtigerField'][_0xefb7('0x43')](_0x1af49f[_0xefb7('0x44')],{})[_0xefb7('0x23')](respondWithResult(_0x543d92,0xc9))[_0xefb7('0x3d')](handleError(_0x543d92,null));};exports[_0xefb7('0x45')]=function(_0x37d050,_0x2cb129){if(_0x37d050['body']['id']){delete _0x37d050['body']['id'];}return db[_0xefb7('0x27')][_0xefb7('0x42')]({'where':{'id':_0x37d050[_0xefb7('0x3f')]['id']}})[_0xefb7('0x23')](handleEntityNotFound(_0x2cb129,null))[_0xefb7('0x23')](saveUpdates(_0x37d050[_0xefb7('0x44')],null))[_0xefb7('0x23')](respondWithResult(_0x2cb129,null))[_0xefb7('0x3d')](handleError(_0x2cb129,null));};exports[_0xefb7('0x22')]=function(_0x5d1f81,_0x265d79){return db[_0xefb7('0x27')][_0xefb7('0x42')]({'where':{'id':_0x5d1f81[_0xefb7('0x3f')]['id']}})[_0xefb7('0x23')](handleEntityNotFound(_0x265d79,null))[_0xefb7('0x23')](removeEntity(_0x265d79,null))[_0xefb7('0x3d')](handleError(_0x265d79,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 3eca4d3..2a10dff 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 _0xef04=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','VtigerField','int_vtiger_fields','idField','FieldId','lodash','api','moment'];(function(_0xaac579,_0x58085a){var _0x2f601f=function(_0x2212e4){while(--_0x2212e4){_0xaac579['push'](_0xaac579['shift']());}};_0x2f601f(++_0x58085a);}(_0xef04,0xe7));var _0x4ef0=function(_0x2ae9ec,_0x16daf3){_0x2ae9ec=_0x2ae9ec-0x0;var _0x1dbab7=_0xef04[_0x2ae9ec];return _0x1dbab7;};'use strict';var _=require(_0x4ef0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4ef0('0x1'));var moment=require(_0x4ef0('0x2'));var BPromise=require(_0x4ef0('0x3'));var rp=require(_0x4ef0('0x4'));var fs=require('fs');var path=require(_0x4ef0('0x5'));var rimraf=require(_0x4ef0('0x6'));var config=require(_0x4ef0('0x7'));var attributes=require(_0x4ef0('0x8'));module['exports']=function(_0x404351,_0x2fb7a3){return _0x404351['define'](_0x4ef0('0x9'),attributes,{'tableName':_0x4ef0('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x4ef0('0xb'),_0x4ef0('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9105=['../../config/environment','./intVtigerField.attributes','define','int_vtiger_fields','idField','FieldId','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x5c54b6,_0x55e679){var _0x3087b0=function(_0x1ee5d4){while(--_0x1ee5d4){_0x5c54b6['push'](_0x5c54b6['shift']());}};_0x3087b0(++_0x55e679);}(_0x9105,0x1e6));var _0x5910=function(_0x5ac4a4,_0x230f0d){_0x5ac4a4=_0x5ac4a4-0x0;var _0xcd80ab=_0x9105[_0x5ac4a4];return _0xcd80ab;};'use strict';var _=require('lodash');var util=require(_0x5910('0x0'));var logger=require(_0x5910('0x1'))(_0x5910('0x2'));var moment=require('moment');var BPromise=require(_0x5910('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5910('0x4'));var rimraf=require(_0x5910('0x5'));var config=require(_0x5910('0x6'));var attributes=require(_0x5910('0x7'));module['exports']=function(_0x27257c,_0x232c96){return _0x27257c[_0x5910('0x8')]('VtigerField',attributes,{'tableName':_0x5910('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x5910('0xa'),_0x5910('0xb')],'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 a9b3843..0219746 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 _0x7100=['stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7100,0x13e));var _0x0710=function(_0x43d79c,_0x531a55){_0x43d79c=_0x43d79c-0x0;var _0x4866b0=_0x7100[_0x43d79c];return _0x4866b0;};'use strict';var _=require('lodash');var util=require(_0x0710('0x0'));var moment=require(_0x0710('0x1'));var BPromise=require('bluebird');var rs=require(_0x0710('0x2'));var fs=require('fs');var Redis=require(_0x0710('0x3'));var db=require(_0x0710('0x4'))['db'];var utils=require(_0x0710('0x5'));var logger=require(_0x0710('0x6'))(_0x0710('0x7'));var config=require(_0x0710('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0710('0x9')][_0x0710('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x265574,_0x1b0f54,_0x424d20){return new BPromise(function(_0x2aab86,_0x39f8d2){return client[_0x0710('0xb')](_0x265574,_0x424d20)[_0x0710('0xc')](function(_0x20ee60){logger[_0x0710('0xd')](_0x0710('0xe'),_0x1b0f54,_0x0710('0xf'));logger[_0x0710('0x10')](_0x0710('0x11'),_0x1b0f54,_0x0710('0xf'),JSON[_0x0710('0x12')](_0x20ee60));if(_0x20ee60[_0x0710('0x13')]){if(_0x20ee60[_0x0710('0x13')][_0x0710('0x14')]===0x1f4){logger[_0x0710('0x13')]('VtigerField,\x20%s,\x20%s',_0x1b0f54,_0x20ee60[_0x0710('0x13')][_0x0710('0x15')]);return _0x39f8d2(_0x20ee60['error'][_0x0710('0x15')]);}logger['error'](_0x0710('0xe'),_0x1b0f54,_0x20ee60[_0x0710('0x13')][_0x0710('0x15')]);return _0x2aab86(_0x20ee60[_0x0710('0x13')]['message']);}else{logger['info'](_0x0710('0xe'),_0x1b0f54,'request\x20sent');_0x2aab86(_0x20ee60[_0x0710('0x16')][_0x0710('0x15')]);}})[_0x0710('0x17')](function(_0x666ad7){logger[_0x0710('0x13')](_0x0710('0xe'),_0x1b0f54,_0x666ad7);_0x39f8d2(_0x666ad7);});});} \ No newline at end of file +var _0x5611=['VtigerField,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x3ee952,_0x565e0f){var _0xc0c8b1=function(_0x57e219){while(--_0x57e219){_0x3ee952['push'](_0x3ee952['shift']());}};_0xc0c8b1(++_0x565e0f);}(_0x5611,0x1c6));var _0x1561=function(_0x362ef7,_0x20c132){_0x362ef7=_0x362ef7-0x0;var _0x34a670=_0x5611[_0x362ef7];return _0x34a670;};'use strict';var _=require(_0x1561('0x0'));var util=require(_0x1561('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1561('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1561('0x3'));var logger=require('../../config/logger')(_0x1561('0x4'));var config=require(_0x1561('0x5'));var jayson=require(_0x1561('0x6'));var client=jayson['client'][_0x1561('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x416259,_0x479d47,_0x4786f4){return new BPromise(function(_0x4fe89d,_0x17b112){return client[_0x1561('0x8')](_0x416259,_0x4786f4)['then'](function(_0x4e4811){logger[_0x1561('0x9')](_0x1561('0xa'),_0x479d47,_0x1561('0xb'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x479d47,_0x1561('0xb'),JSON['stringify'](_0x4e4811));if(_0x4e4811[_0x1561('0xc')]){if(_0x4e4811[_0x1561('0xc')][_0x1561('0xd')]===0x1f4){logger[_0x1561('0xc')]('VtigerField,\x20%s,\x20%s',_0x479d47,_0x4e4811[_0x1561('0xc')][_0x1561('0xe')]);return _0x17b112(_0x4e4811[_0x1561('0xc')][_0x1561('0xe')]);}logger[_0x1561('0xc')](_0x1561('0xa'),_0x479d47,_0x4e4811[_0x1561('0xc')][_0x1561('0xe')]);return _0x4fe89d(_0x4e4811[_0x1561('0xc')]['message']);}else{logger['info'](_0x1561('0xa'),_0x479d47,_0x1561('0xb'));_0x4fe89d(_0x4e4811['result'][_0x1561('0xe')]);}})[_0x1561('0xf')](function(_0x817206){logger[_0x1561('0xc')]('VtigerField,\x20%s,\x20%s',_0x479d47,_0x817206);_0x17b112(_0x817206);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 9f6ce84..9c71bae 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 _0xbf11=['../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','util','connect-timeout','../../components/auth/service'];(function(_0x251eed,_0x328654){var _0x13db86=function(_0x391a9c){while(--_0x391a9c){_0x251eed['push'](_0x251eed['shift']());}};_0x13db86(++_0x328654);}(_0xbf11,0x14d));var _0x1bf1=function(_0x2976de,_0x4c546d){_0x2976de=_0x2976de-0x0;var _0xecbf51=_0xbf11[_0x2976de];return _0xecbf51;};'use strict';var multer=require('multer');var util=require(_0x1bf1('0x0'));var path=require('path');var timeout=require(_0x1bf1('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1bf1('0x2'));var interaction=require(_0x1bf1('0x3'));var config=require(_0x1bf1('0x4'));var controller=require('./intZendeskAccount.controller');router[_0x1bf1('0x5')]('/',auth[_0x1bf1('0x6')](),controller['index']);router[_0x1bf1('0x5')]('/:id',auth[_0x1bf1('0x6')](),controller[_0x1bf1('0x7')]);router[_0x1bf1('0x5')](_0x1bf1('0x8'),auth['isAuthenticated'](),controller[_0x1bf1('0x9')]);router[_0x1bf1('0x5')](_0x1bf1('0xa'),auth['isAuthenticated'](),controller[_0x1bf1('0xb')]);router[_0x1bf1('0xc')]('/',auth[_0x1bf1('0x6')](),controller[_0x1bf1('0xd')]);router[_0x1bf1('0xc')](_0x1bf1('0x8'),auth[_0x1bf1('0x6')](),controller[_0x1bf1('0xe')]);router[_0x1bf1('0xf')](_0x1bf1('0x10'),auth[_0x1bf1('0x6')](),controller[_0x1bf1('0x11')]);router[_0x1bf1('0x12')]('/:id',auth[_0x1bf1('0x6')](),controller[_0x1bf1('0x13')]);module[_0x1bf1('0x14')]=router; \ No newline at end of file +var _0xb912=['../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','update','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service'];(function(_0x29311d,_0x3f9e23){var _0xa29b8f=function(_0x2bb490){while(--_0x2bb490){_0x29311d['push'](_0x29311d['shift']());}};_0xa29b8f(++_0x3f9e23);}(_0xb912,0xb8));var _0x2b91=function(_0x4006b5,_0x153713){_0x4006b5=_0x4006b5-0x0;var _0x50cce7=_0xb912[_0x4006b5];return _0x50cce7;};'use strict';var multer=require(_0x2b91('0x0'));var util=require(_0x2b91('0x1'));var path=require('path');var timeout=require(_0x2b91('0x2'));var express=require('express');var router=express[_0x2b91('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2b91('0x4'));var config=require(_0x2b91('0x5'));var controller=require('./intZendeskAccount.controller');router[_0x2b91('0x6')]('/',auth[_0x2b91('0x7')](),controller[_0x2b91('0x8')]);router[_0x2b91('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x2b91('0x9')]);router[_0x2b91('0x6')](_0x2b91('0xa'),auth['isAuthenticated'](),controller[_0x2b91('0xb')]);router[_0x2b91('0x6')]('/:id/fields',auth[_0x2b91('0x7')](),controller[_0x2b91('0xc')]);router[_0x2b91('0xd')]('/',auth[_0x2b91('0x7')](),controller[_0x2b91('0xe')]);router[_0x2b91('0xd')](_0x2b91('0xa'),auth['isAuthenticated'](),controller[_0x2b91('0xf')]);router[_0x2b91('0x10')](_0x2b91('0x11'),auth[_0x2b91('0x7')](),controller[_0x2b91('0x12')]);router['delete'](_0x2b91('0x11'),auth[_0x2b91('0x7')](),controller[_0x2b91('0x13')]);module[_0x2b91('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index e707c7b..2d39fd3 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 _0x8a9a=['ENUM','password','token','integrationTab','newTab','exports','STRING','username','remoteUri'];(function(_0x1b2ef5,_0x490449){var _0x517665=function(_0x328285){while(--_0x328285){_0x1b2ef5['push'](_0x1b2ef5['shift']());}};_0x517665(++_0x490449);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x8a9a[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require('sequelize');module[_0xa8a9('0x0')]={'name':{'type':Sequelize[_0xa8a9('0x1')]},'description':{'type':Sequelize[_0xa8a9('0x1')]},'username':{'type':Sequelize[_0xa8a9('0x1')],'unique':_0xa8a9('0x2')},'password':{'type':Sequelize[_0xa8a9('0x1')]},'token':{'type':Sequelize[_0xa8a9('0x1')]},'remoteUri':{'type':Sequelize[_0xa8a9('0x1')],'unique':_0xa8a9('0x3')},'authType':{'type':Sequelize[_0xa8a9('0x4')](_0xa8a9('0x5'),_0xa8a9('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xa8a9('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa8a9('0x7'),_0xa8a9('0x8')),'defaultValue':_0xa8a9('0x7')}}; \ No newline at end of file +var _0xc1db=['integrationTab','sequelize','STRING','username','remoteUri','ENUM','password'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc1db,0x120));var _0xbc1d=function(_0x14ec82,_0x35e7ae){_0x14ec82=_0x14ec82-0x0;var _0x18d406=_0xc1db[_0x14ec82];return _0x18d406;};'use strict';var Sequelize=require(_0xbc1d('0x0'));module['exports']={'name':{'type':Sequelize[_0xbc1d('0x1')]},'description':{'type':Sequelize[_0xbc1d('0x1')]},'username':{'type':Sequelize[_0xbc1d('0x1')],'unique':_0xbc1d('0x2')},'password':{'type':Sequelize[_0xbc1d('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbc1d('0x1')],'unique':_0xbc1d('0x3')},'authType':{'type':Sequelize[_0xbc1d('0x4')]('password','token'),'defaultValue':_0xbc1d('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbc1d('0x6'),'newTab'),'defaultValue':_0xbc1d('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 99f77fe..f197f71 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 _0xed3c=['ZendeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','then','includeAll','include','findAll','rows','show','params','create','body','catch','find','getConfigurations','ZendeskConfiguration','order','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','position','title','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','name','send','index','map'];(function(_0x43d2c5,_0x119ecd){var _0x380d7d=function(_0x35c416){while(--_0x35c416){_0x43d2c5['push'](_0x43d2c5['shift']());}};_0x380d7d(++_0x119ecd);}(_0xed3c,0x1a6));var _0xced3=function(_0x282916,_0x29c453){_0x282916=_0x282916-0x0;var _0x317b39=_0xed3c[_0x282916];return _0x317b39;};'use strict';var emlformat=require(_0xced3('0x0'));var rimraf=require(_0xced3('0x1'));var zipdir=require(_0xced3('0x2'));var jsonpatch=require(_0xced3('0x3'));var rp=require('request-promise');var moment=require(_0xced3('0x4'));var BPromise=require(_0xced3('0x5'));var Mustache=require(_0xced3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xced3('0x7'));var csv=require(_0xced3('0x8'));var ejs=require(_0xced3('0x9'));var fs=require('fs');var fs_extra=require(_0xced3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xced3('0x14'));var db=require(_0xced3('0x15'))['db'];var integrations=require(_0xced3('0x16'));function respondWithStatusCode(_0x3b2ac4,_0x457caf){_0x457caf=_0x457caf||0xcc;return function(_0x45d9fc){if(_0x45d9fc){return _0x3b2ac4[_0xced3('0x17')](_0x457caf);}return _0x3b2ac4['status'](_0x457caf)[_0xced3('0x18')]();};}function respondWithResult(_0x5e186e,_0xf2db6f){_0xf2db6f=_0xf2db6f||0xc8;return function(_0x435616){if(_0x435616){return _0x5e186e[_0xced3('0x19')](_0xf2db6f)[_0xced3('0x1a')](_0x435616);}};}function respondWithFilteredResult(_0x4dd4c3,_0x146a21){return function(_0x322c2d){if(_0x322c2d){var _0x4acae6=typeof _0x146a21[_0xced3('0x1b')]===_0xced3('0x1c')&&typeof _0x146a21[_0xced3('0x1d')]===_0xced3('0x1c');var _0x55dbd5=_0x322c2d[_0xced3('0x1e')];var _0x4a3afe=_0x4acae6?0x0:_0x146a21[_0xced3('0x1b')];var _0x4480a6=_0x4acae6?_0x322c2d[_0xced3('0x1e')]:_0x146a21[_0xced3('0x1b')]+_0x146a21[_0xced3('0x1d')];var _0x688c97;if(_0x4480a6>=_0x55dbd5){_0x4480a6=_0x55dbd5;_0x688c97=0xc8;}else{_0x688c97=0xce;}_0x4dd4c3[_0xced3('0x19')](_0x688c97);return _0x4dd4c3[_0xced3('0x1f')](_0xced3('0x20'),_0x4a3afe+'-'+_0x4480a6+'/'+_0x55dbd5)[_0xced3('0x1a')](_0x322c2d);}return null;};}function patchUpdates(_0x2008f2){return function(_0x59dc83){try{jsonpatch['apply'](_0x59dc83,_0x2008f2,!![]);}catch(_0x5e8c44){return BPromise[_0xced3('0x21')](_0x5e8c44);}return _0x59dc83[_0xced3('0x22')]();};}function saveUpdates(_0x21e074,_0x4bf915){return function(_0x19d15c){if(_0x19d15c){return _0x19d15c[_0xced3('0x23')](_0x21e074)['then'](function(_0x559fa2){return _0x559fa2;});}return null;};}function removeEntity(_0x3adf14,_0x101708){return function(_0x219fa8){if(_0x219fa8){return _0x219fa8[_0xced3('0x24')]()['then'](function(){_0x3adf14[_0xced3('0x19')](0xcc)[_0xced3('0x18')]();});}};}function handleEntityNotFound(_0x4fc285,_0x3fb4f9){return function(_0x4da7ce){if(!_0x4da7ce){_0x4fc285[_0xced3('0x17')](0x194);}return _0x4da7ce;};}function handleError(_0x4123ba,_0x3b728d){_0x3b728d=_0x3b728d||0x1f4;return function(_0x23a570){logger[_0xced3('0x25')](_0x23a570['stack']);if(_0x23a570['name']){delete _0x23a570[_0xced3('0x26')];}_0x4123ba['status'](_0x3b728d)[_0xced3('0x27')](_0x23a570);};}exports[_0xced3('0x28')]=function(_0x4a8e85,_0x3db664){var _0x4024fa={},_0x196956={},_0x1032d6={'count':0x0,'rows':[]};var _0x4389f8=_[_0xced3('0x29')](db[_0xced3('0x2a')][_0xced3('0x2b')],function(_0x116cc7){return{'name':_0x116cc7['fieldName'],'type':_0x116cc7[_0xced3('0x2c')][_0xced3('0x2d')]};});_0x196956[_0xced3('0x2e')]=_[_0xced3('0x29')](_0x4389f8,_0xced3('0x26'));_0x196956[_0xced3('0x2f')]=_[_0xced3('0x30')](_0x4a8e85[_0xced3('0x2f')]);_0x196956[_0xced3('0x31')]=_[_0xced3('0x32')](_0x196956[_0xced3('0x2e')],_0x196956[_0xced3('0x2f')]);_0x4024fa[_0xced3('0x33')]=_[_0xced3('0x32')](_0x196956[_0xced3('0x2e')],qs[_0xced3('0x34')](_0x4a8e85[_0xced3('0x2f')][_0xced3('0x34')]));_0x4024fa[_0xced3('0x33')]=_0x4024fa[_0xced3('0x33')][_0xced3('0x35')]?_0x4024fa['attributes']:_0x196956[_0xced3('0x2e')];if(!_0x4a8e85['query'][_0xced3('0x36')](_0xced3('0x37'))){_0x4024fa[_0xced3('0x1d')]=qs[_0xced3('0x1d')](_0x4a8e85[_0xced3('0x2f')][_0xced3('0x1d')]);_0x4024fa[_0xced3('0x1b')]=qs[_0xced3('0x1b')](_0x4a8e85[_0xced3('0x2f')][_0xced3('0x1b')]);}_0x4024fa['order']=qs[_0xced3('0x38')](_0x4a8e85[_0xced3('0x2f')]['sort']);_0x4024fa[_0xced3('0x39')]=qs[_0xced3('0x31')](_[_0xced3('0x3a')](_0x4a8e85['query'],_0x196956['filters']),_0x4389f8);if(_0x4a8e85[_0xced3('0x2f')]['filter']){_0x4024fa[_0xced3('0x39')]=_[_0xced3('0x3b')](_0x4024fa['where'],{'$or':_[_0xced3('0x29')](_0x4389f8,function(_0x15ca03){if(_0x15ca03[_0xced3('0x2c')]!=='VIRTUAL'){var _0x21c0fa={};_0x21c0fa[_0x15ca03['name']]={'$like':'%'+_0x4a8e85['query'][_0xced3('0x3c')]+'%'};return _0x21c0fa;}})});}_0x4024fa=_[_0xced3('0x3b')]({},_0x4024fa,_0x4a8e85[_0xced3('0x3d')]);var _0x4e6926={'where':_0x4024fa[_0xced3('0x39')]};return db[_0xced3('0x2a')][_0xced3('0x1e')](_0x4e6926)[_0xced3('0x3e')](function(_0x28506e){_0x1032d6[_0xced3('0x1e')]=_0x28506e;if(_0x4a8e85[_0xced3('0x2f')][_0xced3('0x3f')]){_0x4024fa[_0xced3('0x40')]=[{'all':!![]}];}return db[_0xced3('0x2a')][_0xced3('0x41')](_0x4024fa);})[_0xced3('0x3e')](function(_0x16b2c7){_0x1032d6[_0xced3('0x42')]=_0x16b2c7;return _0x1032d6;})[_0xced3('0x3e')](respondWithFilteredResult(_0x3db664,_0x4024fa))['catch'](handleError(_0x3db664,null));};exports[_0xced3('0x43')]=function(_0x2ec0ad,_0x44ff72){var _0x1a6c1f={'raw':![],'where':{'id':_0x2ec0ad[_0xced3('0x44')]['id']}},_0x1de086={};_0x1de086[_0xced3('0x2e')]=_[_0xced3('0x30')](db[_0xced3('0x2a')]['rawAttributes']);_0x1de086[_0xced3('0x2f')]=_['keys'](_0x2ec0ad[_0xced3('0x2f')]);_0x1de086[_0xced3('0x31')]=_[_0xced3('0x32')](_0x1de086['model'],_0x1de086[_0xced3('0x2f')]);_0x1a6c1f[_0xced3('0x33')]=_[_0xced3('0x32')](_0x1de086[_0xced3('0x2e')],qs['fields'](_0x2ec0ad[_0xced3('0x2f')][_0xced3('0x34')]));_0x1a6c1f[_0xced3('0x33')]=_0x1a6c1f[_0xced3('0x33')][_0xced3('0x35')]?_0x1a6c1f['attributes']:_0x1de086[_0xced3('0x2e')];if(_0x2ec0ad[_0xced3('0x2f')][_0xced3('0x3f')]){_0x1a6c1f[_0xced3('0x40')]=[{'all':!![]}];}_0x1a6c1f=_[_0xced3('0x3b')]({},_0x1a6c1f,_0x2ec0ad[_0xced3('0x3d')]);return db[_0xced3('0x2a')]['find'](_0x1a6c1f)[_0xced3('0x3e')](handleEntityNotFound(_0x44ff72,null))[_0xced3('0x3e')](respondWithResult(_0x44ff72,null))['catch'](handleError(_0x44ff72,null));};exports['create']=function(_0x140df2,_0x59b586){return db[_0xced3('0x2a')][_0xced3('0x45')](_0x140df2[_0xced3('0x46')],{})[_0xced3('0x3e')](respondWithResult(_0x59b586,0xc9))[_0xced3('0x47')](handleError(_0x59b586,null));};exports[_0xced3('0x23')]=function(_0x3700ed,_0x10cc6c){if(_0x3700ed[_0xced3('0x46')]['id']){delete _0x3700ed['body']['id'];}return db[_0xced3('0x2a')][_0xced3('0x48')]({'where':{'id':_0x3700ed[_0xced3('0x44')]['id']}})[_0xced3('0x3e')](handleEntityNotFound(_0x10cc6c,null))[_0xced3('0x3e')](saveUpdates(_0x3700ed[_0xced3('0x46')],null))['then'](respondWithResult(_0x10cc6c,null))[_0xced3('0x47')](handleError(_0x10cc6c,null));};exports[_0xced3('0x24')]=function(_0x74f70,_0x409da0){return db[_0xced3('0x2a')][_0xced3('0x48')]({'where':{'id':_0x74f70[_0xced3('0x44')]['id']}})[_0xced3('0x3e')](handleEntityNotFound(_0x409da0,null))[_0xced3('0x3e')](removeEntity(_0x409da0,null))[_0xced3('0x47')](handleError(_0x409da0,null));};exports[_0xced3('0x49')]=function(_0x3e2a19,_0x4a9111,_0x1c69df){var _0x4bd3cb={};var _0x466ffb={};var _0x27ce0b;var _0xc93e05;return db['ZendeskAccount']['findOne']({'where':{'id':_0x3e2a19[_0xced3('0x44')]['id']}})[_0xced3('0x3e')](handleEntityNotFound(_0x4a9111,null))['then'](function(_0x3f41cc){if(_0x3f41cc){_0x27ce0b=_0x3f41cc;_0x466ffb['model']=_[_0xced3('0x30')](db[_0xced3('0x4a')]['rawAttributes']);_0x466ffb[_0xced3('0x2f')]=_[_0xced3('0x30')](_0x3e2a19[_0xced3('0x2f')]);_0x466ffb['filters']=_[_0xced3('0x32')](_0x466ffb['model'],_0x466ffb[_0xced3('0x2f')]);_0x4bd3cb[_0xced3('0x33')]=_[_0xced3('0x32')](_0x466ffb[_0xced3('0x2e')],qs[_0xced3('0x34')](_0x3e2a19[_0xced3('0x2f')][_0xced3('0x34')]));_0x4bd3cb[_0xced3('0x33')]=_0x4bd3cb[_0xced3('0x33')][_0xced3('0x35')]?_0x4bd3cb[_0xced3('0x33')]:_0x466ffb['model'];_0x4bd3cb[_0xced3('0x4b')]=qs[_0xced3('0x38')](_0x3e2a19[_0xced3('0x2f')][_0xced3('0x38')]);_0x4bd3cb[_0xced3('0x39')]=qs[_0xced3('0x31')](_['pick'](_0x3e2a19[_0xced3('0x2f')],_0x466ffb[_0xced3('0x31')]));if(_0x3e2a19[_0xced3('0x2f')][_0xced3('0x3c')]){_0x4bd3cb[_0xced3('0x39')]=_[_0xced3('0x3b')](_0x4bd3cb['where'],{'$or':_[_0xced3('0x29')](_0x4bd3cb['attributes'],function(_0xc0cd87){var _0x5d9813={};_0x5d9813[_0xc0cd87]={'$like':'%'+_0x3e2a19[_0xced3('0x2f')][_0xced3('0x3c')]+'%'};return _0x5d9813;})});}_0x4bd3cb=_['merge']({},_0x4bd3cb,_0x3e2a19[_0xced3('0x3d')]);return _0x27ce0b[_0xced3('0x49')](_0x4bd3cb);}})[_0xced3('0x3e')](function(_0x3bb7d5){if(_0x3bb7d5){_0xc93e05=_0x3bb7d5[_0xced3('0x35')];if(!_0x3e2a19[_0xced3('0x2f')][_0xced3('0x36')](_0xced3('0x37'))){_0x4bd3cb[_0xced3('0x1d')]=qs[_0xced3('0x1d')](_0x3e2a19[_0xced3('0x2f')][_0xced3('0x1d')]);_0x4bd3cb[_0xced3('0x1b')]=qs['offset'](_0x3e2a19[_0xced3('0x2f')][_0xced3('0x1b')]);}return _0x27ce0b[_0xced3('0x49')](_0x4bd3cb);}})[_0xced3('0x3e')](function(_0x4f8a3f){if(_0x4f8a3f){return _0x4f8a3f?{'count':_0xc93e05,'rows':_0x4f8a3f}:null;}})[_0xced3('0x3e')](respondWithResult(_0x4a9111,null))[_0xced3('0x47')](handleError(_0x4a9111,null));};exports[_0xced3('0x4c')]=function(_0x373f31,_0x2a62f5,_0x13643c){if(_0x373f31[_0xced3('0x46')]['id']){delete _0x373f31['body']['id'];}return db[_0xced3('0x2a')][_0xced3('0x4d')]({'where':{'id':_0x373f31['params']['id']}})[_0xced3('0x3e')](handleEntityNotFound(_0x2a62f5,null))[_0xced3('0x3e')](function(_0x3a9dac){if(_0x3a9dac){_0x373f31[_0xced3('0x46')]['AccountId']=_0x3a9dac['id'];_0x373f31[_0xced3('0x46')][_0xced3('0x4e')]=integrations[_0xced3('0x4f')](_0x373f31[_0xced3('0x46')][_0xced3('0x50')],_0x373f31[_0xced3('0x46')][_0xced3('0x2c')]);_0x373f31[_0xced3('0x46')][_0xced3('0x51')]=integrations[_0xced3('0x52')](_0x373f31['body'][_0xced3('0x50')],_0x373f31[_0xced3('0x46')]['type']);return db['ZendeskConfiguration'][_0xced3('0x45')](_0x373f31['body'],{'include':[{'model':db[_0xced3('0x53')],'as':_0xced3('0x4e')},{'model':db['ZendeskField'],'as':_0xced3('0x51')}]});}return null;})[_0xced3('0x3e')](respondWithResult(_0x2a62f5,null))['catch'](handleError(_0x2a62f5,null));};exports[_0xced3('0x54')]=function(_0x52ab35,_0x39eead,_0x58b66b){var _0xf8ccc6='';return db[_0xced3('0x2a')][_0xced3('0x4d')]({'where':{'id':_0x52ab35['params']['id']},'attributes':['id',_0xced3('0x55'),_0xced3('0x56'),_0xced3('0x57'),'authType',_0xced3('0x58')]})[_0xced3('0x3e')](handleEntityNotFound(_0x39eead,null))[_0xced3('0x3e')](function(_0x227ec5){if(_0x227ec5){_0xf8ccc6=_0x227ec5['remoteUri'];var _0x4a1624=_0xf8ccc6[_0xced3('0x59')](-0x1);if(_0x4a1624==='/'){_0xf8ccc6=_0xf8ccc6[_0xced3('0x5a')](0x0,_0xf8ccc6[_0xced3('0x5b')](_0x4a1624));}var _0xcddb37={'method':_0xced3('0x5c'),'uri':util[_0xced3('0x5d')]('%s/%s',_0xf8ccc6,_0xced3('0x5e')),'json':!![]};switch(_0x227ec5['authType']){case _0xced3('0x56'):_0xcddb37[_0xced3('0x5f')]={'Authorization':util[_0xced3('0x5d')](_0xced3('0x60'),new Buffer(util['format'](_0xced3('0x61'),_0x227ec5[_0xced3('0x55')],_0x227ec5['password']))['toString'](_0xced3('0x62')))};break;case _0xced3('0x57'):_0xcddb37[_0xced3('0x5f')]={'Authorization':util[_0xced3('0x5d')](_0xced3('0x60'),new Buffer(util['format'](_0xced3('0x63'),_0x227ec5[_0xced3('0x55')],_0x227ec5[_0xced3('0x57')]))[_0xced3('0x64')]('base64'))};break;default:throw new db[(_0xced3('0x65'))][(_0xced3('0x66'))](_0xced3('0x67'));}return rp(_0xcddb37);}})[_0xced3('0x3e')](function(_0x9183af){if(_0x9183af){var _0x275c7e=[_0xced3('0x68'),_0xced3('0x69'),_0xced3('0x6a'),_0xced3('0x6b')];_['remove'](_0x9183af[_0xced3('0x5e')],function(_0x1e7ff1){return _0x275c7e['includes'](_0x1e7ff1[_0xced3('0x2c')]);});return{'count':_0x9183af[_0xced3('0x5e')][_0xced3('0x35')],'rows':_[_0xced3('0x29')](_0x9183af[_0xced3('0x5e')],function(_0x5c2302){return{'id':_0x5c2302['id'],'name':_0x5c2302[_0xced3('0x6c')]>0x7?_0x5c2302[_0xced3('0x6d')]:_0x5c2302['type'],'custom':_0x5c2302[_0xced3('0x6c')]>0x7?!![]:![],'options':_0x5c2302[_0xced3('0x6e')]?_0x5c2302[_0xced3('0x6e')]:_0x5c2302[_0xced3('0x6f')]?_0x5c2302[_0xced3('0x6f')]:[]};})};}})[_0xced3('0x3e')](respondWithResult(_0x39eead,null))['catch'](function(_0x2d9a57){var _0x3d2547=_0x52ab35[_0xced3('0x2f')][_0xced3('0x70')]?0x1f4:_0x2d9a57[_0xced3('0x71')]||0x1f4;logger[_0xced3('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3d2547,JSON[_0xced3('0x72')](_0x2d9a57));delete _0x2d9a57[_0xced3('0x26')];if(_0x3d2547===0x191){_0x3d2547=0x190;}_0x39eead[_0xced3('0x19')](_0x3d2547)[_0xced3('0x27')](_0x52ab35[_0xced3('0x2f')][_0xced3('0x70')]?{'message':_0xced3('0x73'),'statusCode':_0x2d9a57['statusCode']}:_0x2d9a57);});}; \ No newline at end of file +var _0xe1e3=['assignee','remove','includes','position','title','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','end','json','undefined','count','offset','status','set','apply','save','then','destroy','name','send','ZendeskAccount','type','map','query','keys','attributes','intersection','model','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','merge','find','create','body','update','ZendeskConfiguration','length','getConfigurations','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','findOne','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','username','base64','headers','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','group'];(function(_0x28fb00,_0x1cf6f3){var _0x16fc4f=function(_0x4e9de7){while(--_0x4e9de7){_0x28fb00['push'](_0x28fb00['shift']());}};_0x16fc4f(++_0x1cf6f3);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x24b3e5,_0x4b0129){_0x24b3e5=_0x24b3e5-0x0;var _0x2988b0=_0xe1e3[_0x24b3e5];return _0x2988b0;};'use strict';var emlformat=require(_0x3e1e('0x0'));var rimraf=require(_0x3e1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e1e('0x3'));var Mustache=require('mustache');var util=require(_0x3e1e('0x4'));var path=require(_0x3e1e('0x5'));var sox=require(_0x3e1e('0x6'));var csv=require(_0x3e1e('0x7'));var ejs=require(_0x3e1e('0x8'));var fs=require('fs');var fs_extra=require(_0x3e1e('0x9'));var _=require('lodash');var squel=require(_0x3e1e('0xa'));var crypto=require(_0x3e1e('0xb'));var jsforce=require(_0x3e1e('0xc'));var deskjs=require(_0x3e1e('0xd'));var toCsv=require(_0x3e1e('0x7'));var querystring=require(_0x3e1e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e1e('0x10'));var logger=require(_0x3e1e('0x11'))(_0x3e1e('0x12'));var utils=require('../../config/utils');var config=require(_0x3e1e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x536129,_0x5c09a2){_0x5c09a2=_0x5c09a2||0xcc;return function(_0x14ad58){if(_0x14ad58){return _0x536129['sendStatus'](_0x5c09a2);}return _0x536129['status'](_0x5c09a2)[_0x3e1e('0x14')]();};}function respondWithResult(_0x8bd4cd,_0x78ee54){_0x78ee54=_0x78ee54||0xc8;return function(_0x50f221){if(_0x50f221){return _0x8bd4cd['status'](_0x78ee54)[_0x3e1e('0x15')](_0x50f221);}};}function respondWithFilteredResult(_0x1b62e6,_0x4dca60){return function(_0x26cb35){if(_0x26cb35){var _0x1f0af9=typeof _0x4dca60['offset']===_0x3e1e('0x16')&&typeof _0x4dca60['limit']===_0x3e1e('0x16');var _0x247daa=_0x26cb35[_0x3e1e('0x17')];var _0x39eaa7=_0x1f0af9?0x0:_0x4dca60[_0x3e1e('0x18')];var _0x1c181b=_0x1f0af9?_0x26cb35['count']:_0x4dca60['offset']+_0x4dca60['limit'];var _0x428e4e;if(_0x1c181b>=_0x247daa){_0x1c181b=_0x247daa;_0x428e4e=0xc8;}else{_0x428e4e=0xce;}_0x1b62e6[_0x3e1e('0x19')](_0x428e4e);return _0x1b62e6[_0x3e1e('0x1a')]('Content-Range',_0x39eaa7+'-'+_0x1c181b+'/'+_0x247daa)[_0x3e1e('0x15')](_0x26cb35);}return null;};}function patchUpdates(_0x530815){return function(_0x228991){try{jsonpatch[_0x3e1e('0x1b')](_0x228991,_0x530815,!![]);}catch(_0x474085){return BPromise['reject'](_0x474085);}return _0x228991[_0x3e1e('0x1c')]();};}function saveUpdates(_0x96396,_0xefa098){return function(_0x55dc62){if(_0x55dc62){return _0x55dc62['update'](_0x96396)[_0x3e1e('0x1d')](function(_0x1b5097){return _0x1b5097;});}return null;};}function removeEntity(_0x488f9f,_0x60e6bc){return function(_0x56ae51){if(_0x56ae51){return _0x56ae51[_0x3e1e('0x1e')]()[_0x3e1e('0x1d')](function(){_0x488f9f[_0x3e1e('0x19')](0xcc)[_0x3e1e('0x14')]();});}};}function handleEntityNotFound(_0x43d583,_0x21c898){return function(_0x4ee2b5){if(!_0x4ee2b5){_0x43d583['sendStatus'](0x194);}return _0x4ee2b5;};}function handleError(_0x44e419,_0x541ef1){_0x541ef1=_0x541ef1||0x1f4;return function(_0x55db8f){logger['error'](_0x55db8f['stack']);if(_0x55db8f[_0x3e1e('0x1f')]){delete _0x55db8f[_0x3e1e('0x1f')];}_0x44e419['status'](_0x541ef1)[_0x3e1e('0x20')](_0x55db8f);};}exports['index']=function(_0xdfcd93,_0x176bb4){var _0x53a6ff={},_0x43e029={},_0x210a84={'count':0x0,'rows':[]};var _0x45ed0e=_['map'](db[_0x3e1e('0x21')]['rawAttributes'],function(_0x591c36){return{'name':_0x591c36['fieldName'],'type':_0x591c36[_0x3e1e('0x22')]['key']};});_0x43e029['model']=_[_0x3e1e('0x23')](_0x45ed0e,_0x3e1e('0x1f'));_0x43e029[_0x3e1e('0x24')]=_[_0x3e1e('0x25')](_0xdfcd93[_0x3e1e('0x24')]);_0x43e029['filters']=_['intersection'](_0x43e029['model'],_0x43e029['query']);_0x53a6ff[_0x3e1e('0x26')]=_[_0x3e1e('0x27')](_0x43e029[_0x3e1e('0x28')],qs[_0x3e1e('0x29')](_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x29')]));_0x53a6ff[_0x3e1e('0x26')]=_0x53a6ff[_0x3e1e('0x26')]['length']?_0x53a6ff[_0x3e1e('0x26')]:_0x43e029[_0x3e1e('0x28')];if(!_0xdfcd93['query'][_0x3e1e('0x2a')](_0x3e1e('0x2b'))){_0x53a6ff[_0x3e1e('0x2c')]=qs[_0x3e1e('0x2c')](_0xdfcd93['query']['limit']);_0x53a6ff[_0x3e1e('0x18')]=qs[_0x3e1e('0x18')](_0xdfcd93['query'][_0x3e1e('0x18')]);}_0x53a6ff[_0x3e1e('0x2d')]=qs['sort'](_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x2e')]);_0x53a6ff[_0x3e1e('0x2f')]=qs[_0x3e1e('0x30')](_[_0x3e1e('0x31')](_0xdfcd93['query'],_0x43e029[_0x3e1e('0x30')]),_0x45ed0e);if(_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x32')]){_0x53a6ff[_0x3e1e('0x2f')]=_['merge'](_0x53a6ff[_0x3e1e('0x2f')],{'$or':_[_0x3e1e('0x23')](_0x45ed0e,function(_0x111da4){if(_0x111da4[_0x3e1e('0x22')]!==_0x3e1e('0x33')){var _0x25a95b={};_0x25a95b[_0x111da4[_0x3e1e('0x1f')]]={'$like':'%'+_0xdfcd93['query'][_0x3e1e('0x32')]+'%'};return _0x25a95b;}})});}_0x53a6ff=_['merge']({},_0x53a6ff,_0xdfcd93['options']);var _0x4f598e={'where':_0x53a6ff[_0x3e1e('0x2f')]};return db[_0x3e1e('0x21')]['count'](_0x4f598e)[_0x3e1e('0x1d')](function(_0xb030eb){_0x210a84['count']=_0xb030eb;if(_0xdfcd93[_0x3e1e('0x24')][_0x3e1e('0x34')]){_0x53a6ff['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x3e1e('0x35')](_0x53a6ff);})['then'](function(_0x4ff868){_0x210a84[_0x3e1e('0x36')]=_0x4ff868;return _0x210a84;})[_0x3e1e('0x1d')](respondWithFilteredResult(_0x176bb4,_0x53a6ff))[_0x3e1e('0x37')](handleError(_0x176bb4,null));};exports[_0x3e1e('0x38')]=function(_0x377a06,_0x55ea1d){var _0x5b32ad={'raw':![],'where':{'id':_0x377a06[_0x3e1e('0x39')]['id']}},_0x24b2ad={};_0x24b2ad[_0x3e1e('0x28')]=_['keys'](db[_0x3e1e('0x21')][_0x3e1e('0x3a')]);_0x24b2ad[_0x3e1e('0x24')]=_['keys'](_0x377a06[_0x3e1e('0x24')]);_0x24b2ad['filters']=_['intersection'](_0x24b2ad[_0x3e1e('0x28')],_0x24b2ad[_0x3e1e('0x24')]);_0x5b32ad[_0x3e1e('0x26')]=_[_0x3e1e('0x27')](_0x24b2ad['model'],qs['fields'](_0x377a06['query']['fields']));_0x5b32ad[_0x3e1e('0x26')]=_0x5b32ad[_0x3e1e('0x26')]['length']?_0x5b32ad['attributes']:_0x24b2ad[_0x3e1e('0x28')];if(_0x377a06[_0x3e1e('0x24')][_0x3e1e('0x34')]){_0x5b32ad['include']=[{'all':!![]}];}_0x5b32ad=_[_0x3e1e('0x3b')]({},_0x5b32ad,_0x377a06['options']);return db[_0x3e1e('0x21')][_0x3e1e('0x3c')](_0x5b32ad)[_0x3e1e('0x1d')](handleEntityNotFound(_0x55ea1d,null))[_0x3e1e('0x1d')](respondWithResult(_0x55ea1d,null))[_0x3e1e('0x37')](handleError(_0x55ea1d,null));};exports[_0x3e1e('0x3d')]=function(_0x53d32b,_0x2f14b3){return db[_0x3e1e('0x21')]['create'](_0x53d32b[_0x3e1e('0x3e')],{})[_0x3e1e('0x1d')](respondWithResult(_0x2f14b3,0xc9))['catch'](handleError(_0x2f14b3,null));};exports[_0x3e1e('0x3f')]=function(_0x347b3f,_0x2e286f){if(_0x347b3f[_0x3e1e('0x3e')]['id']){delete _0x347b3f['body']['id'];}return db[_0x3e1e('0x21')][_0x3e1e('0x3c')]({'where':{'id':_0x347b3f[_0x3e1e('0x39')]['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x2e286f,null))['then'](saveUpdates(_0x347b3f[_0x3e1e('0x3e')],null))[_0x3e1e('0x1d')](respondWithResult(_0x2e286f,null))[_0x3e1e('0x37')](handleError(_0x2e286f,null));};exports[_0x3e1e('0x1e')]=function(_0xe2516c,_0x1df5a8){return db[_0x3e1e('0x21')][_0x3e1e('0x3c')]({'where':{'id':_0xe2516c['params']['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x1df5a8,null))['then'](removeEntity(_0x1df5a8,null))['catch'](handleError(_0x1df5a8,null));};exports['getConfigurations']=function(_0x1c4269,_0x17641c,_0x5147a2){var _0x13b076={};var _0x592733={};var _0x5b2416;var _0x3eaf76;return db['ZendeskAccount']['findOne']({'where':{'id':_0x1c4269['params']['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x17641c,null))[_0x3e1e('0x1d')](function(_0x1334c8){if(_0x1334c8){_0x5b2416=_0x1334c8;_0x592733[_0x3e1e('0x28')]=_[_0x3e1e('0x25')](db[_0x3e1e('0x40')][_0x3e1e('0x3a')]);_0x592733['query']=_[_0x3e1e('0x25')](_0x1c4269['query']);_0x592733[_0x3e1e('0x30')]=_[_0x3e1e('0x27')](_0x592733[_0x3e1e('0x28')],_0x592733['query']);_0x13b076['attributes']=_[_0x3e1e('0x27')](_0x592733[_0x3e1e('0x28')],qs['fields'](_0x1c4269[_0x3e1e('0x24')]['fields']));_0x13b076['attributes']=_0x13b076[_0x3e1e('0x26')][_0x3e1e('0x41')]?_0x13b076['attributes']:_0x592733[_0x3e1e('0x28')];_0x13b076['order']=qs['sort'](_0x1c4269[_0x3e1e('0x24')]['sort']);_0x13b076[_0x3e1e('0x2f')]=qs['filters'](_[_0x3e1e('0x31')](_0x1c4269['query'],_0x592733[_0x3e1e('0x30')]));if(_0x1c4269[_0x3e1e('0x24')]['filter']){_0x13b076['where']=_['merge'](_0x13b076[_0x3e1e('0x2f')],{'$or':_[_0x3e1e('0x23')](_0x13b076[_0x3e1e('0x26')],function(_0x588189){var _0x1b04ce={};_0x1b04ce[_0x588189]={'$like':'%'+_0x1c4269[_0x3e1e('0x24')][_0x3e1e('0x32')]+'%'};return _0x1b04ce;})});}_0x13b076=_['merge']({},_0x13b076,_0x1c4269['options']);return _0x5b2416[_0x3e1e('0x42')](_0x13b076);}})['then'](function(_0x3b97a2){if(_0x3b97a2){_0x3eaf76=_0x3b97a2[_0x3e1e('0x41')];if(!_0x1c4269[_0x3e1e('0x24')]['hasOwnProperty'](_0x3e1e('0x2b'))){_0x13b076['limit']=qs[_0x3e1e('0x2c')](_0x1c4269[_0x3e1e('0x24')]['limit']);_0x13b076[_0x3e1e('0x18')]=qs['offset'](_0x1c4269[_0x3e1e('0x24')]['offset']);}return _0x5b2416[_0x3e1e('0x42')](_0x13b076);}})['then'](function(_0x31062e){if(_0x31062e){return _0x31062e?{'count':_0x3eaf76,'rows':_0x31062e}:null;}})[_0x3e1e('0x1d')](respondWithResult(_0x17641c,null))[_0x3e1e('0x37')](handleError(_0x17641c,null));};exports['addConfiguration']=function(_0x11cab1,_0x1fbcfc,_0x4e6957){if(_0x11cab1[_0x3e1e('0x3e')]['id']){delete _0x11cab1['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x11cab1[_0x3e1e('0x39')]['id']}})[_0x3e1e('0x1d')](handleEntityNotFound(_0x1fbcfc,null))[_0x3e1e('0x1d')](function(_0x4b0944){if(_0x4b0944){_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x43')]=_0x4b0944['id'];_0x11cab1[_0x3e1e('0x3e')]['Subjects']=integrations[_0x3e1e('0x44')](_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x45')],_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x22')]);_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x46')]=integrations[_0x3e1e('0x47')](_0x11cab1['body']['channel'],_0x11cab1[_0x3e1e('0x3e')][_0x3e1e('0x22')]);return db[_0x3e1e('0x40')][_0x3e1e('0x3d')](_0x11cab1[_0x3e1e('0x3e')],{'include':[{'model':db[_0x3e1e('0x48')],'as':_0x3e1e('0x49')},{'model':db[_0x3e1e('0x48')],'as':_0x3e1e('0x46')}]});}return null;})[_0x3e1e('0x1d')](respondWithResult(_0x1fbcfc,null))[_0x3e1e('0x37')](handleError(_0x1fbcfc,null));};exports[_0x3e1e('0x4a')]=function(_0x5e148e,_0x5581ee,_0x20bc4d){var _0x29ddc4='';return db[_0x3e1e('0x21')][_0x3e1e('0x4b')]({'where':{'id':_0x5e148e[_0x3e1e('0x39')]['id']},'attributes':['id','username',_0x3e1e('0x4c'),_0x3e1e('0x4d'),_0x3e1e('0x4e'),_0x3e1e('0x4f')]})[_0x3e1e('0x1d')](handleEntityNotFound(_0x5581ee,null))['then'](function(_0x8b6b28){if(_0x8b6b28){_0x29ddc4=_0x8b6b28[_0x3e1e('0x4f')];var _0xc60340=_0x29ddc4[_0x3e1e('0x50')](-0x1);if(_0xc60340==='/'){_0x29ddc4=_0x29ddc4[_0x3e1e('0x51')](0x0,_0x29ddc4[_0x3e1e('0x52')](_0xc60340));}var _0x4d0854={'method':_0x3e1e('0x53'),'uri':util[_0x3e1e('0x54')](_0x3e1e('0x55'),_0x29ddc4,_0x3e1e('0x56')),'json':!![]};switch(_0x8b6b28[_0x3e1e('0x4e')]){case _0x3e1e('0x4c'):_0x4d0854['headers']={'Authorization':util[_0x3e1e('0x54')](_0x3e1e('0x57'),new Buffer(util[_0x3e1e('0x54')](_0x3e1e('0x58'),_0x8b6b28[_0x3e1e('0x59')],_0x8b6b28[_0x3e1e('0x4c')]))['toString'](_0x3e1e('0x5a')))};break;case'token':_0x4d0854[_0x3e1e('0x5b')]={'Authorization':util[_0x3e1e('0x54')]('Basic\x20%s',new Buffer(util[_0x3e1e('0x54')](_0x3e1e('0x5c'),_0x8b6b28[_0x3e1e('0x59')],_0x8b6b28[_0x3e1e('0x4d')]))['toString'](_0x3e1e('0x5a')))};break;default:throw new db['Sequelize'][(_0x3e1e('0x5d'))](_0x3e1e('0x5e'));}return rp(_0x4d0854);}})[_0x3e1e('0x1d')](function(_0x632f99){if(_0x632f99){var _0x2ef476=[_0x3e1e('0x5f'),'description',_0x3e1e('0x60'),_0x3e1e('0x61')];_[_0x3e1e('0x62')](_0x632f99[_0x3e1e('0x56')],function(_0x4b4fd4){return _0x2ef476[_0x3e1e('0x63')](_0x4b4fd4[_0x3e1e('0x22')]);});return{'count':_0x632f99[_0x3e1e('0x56')][_0x3e1e('0x41')],'rows':_['map'](_0x632f99[_0x3e1e('0x56')],function(_0x41d98f){return{'id':_0x41d98f['id'],'name':_0x41d98f[_0x3e1e('0x64')]>0x7?_0x41d98f[_0x3e1e('0x65')]:_0x41d98f[_0x3e1e('0x22')],'custom':_0x41d98f[_0x3e1e('0x64')]>0x7?!![]:![],'options':_0x41d98f['system_field_options']?_0x41d98f['system_field_options']:_0x41d98f['custom_field_options']?_0x41d98f[_0x3e1e('0x66')]:[]};})};}})['then'](respondWithResult(_0x5581ee,null))[_0x3e1e('0x37')](function(_0x5f436f){var _0x32b5ef=_0x5e148e[_0x3e1e('0x24')][_0x3e1e('0x67')]?0x1f4:_0x5f436f[_0x3e1e('0x68')]||0x1f4;logger['error'](_0x3e1e('0x69'),'getFields',_0x32b5ef,JSON[_0x3e1e('0x6a')](_0x5f436f));delete _0x5f436f['name'];if(_0x32b5ef===0x191){_0x32b5ef=0x190;}_0x5581ee[_0x3e1e('0x19')](_0x32b5ef)[_0x3e1e('0x20')](_0x5e148e['query'][_0x3e1e('0x67')]?{'message':_0x3e1e('0x6b'),'statusCode':_0x5f436f[_0x3e1e('0x68')]}:_0x5f436f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 0d2c94f..c12f5ab 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 _0xc1e4=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x30af2b,_0x1676d6){var _0x2c5c94=function(_0x2a4c9d){while(--_0x2a4c9d){_0x30af2b['push'](_0x30af2b['shift']());}};_0x2c5c94(++_0x1676d6);}(_0xc1e4,0x17a));var _0x4c1e=function(_0x12eb0e,_0x30f40a){_0x12eb0e=_0x12eb0e-0x0;var _0x5c0b7b=_0xc1e4[_0x12eb0e];return _0x5c0b7b;};'use strict';var _=require(_0x4c1e('0x0'));var util=require('util');var logger=require(_0x4c1e('0x1'))(_0x4c1e('0x2'));var moment=require('moment');var BPromise=require(_0x4c1e('0x3'));var rp=require(_0x4c1e('0x4'));var fs=require('fs');var path=require(_0x4c1e('0x5'));var rimraf=require(_0x4c1e('0x6'));var config=require(_0x4c1e('0x7'));var attributes=require(_0x4c1e('0x8'));var integrations=require(_0x4c1e('0x9'));module[_0x4c1e('0xa')]=function(_0x5d1641,_0x1a9f85){return _0x5d1641[_0x4c1e('0xb')](_0x4c1e('0xc'),attributes,{'tableName':_0x4c1e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5036=['bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x159468,_0x19e94c){var _0x2d9008=function(_0x4cc185){while(--_0x4cc185){_0x159468['push'](_0x159468['shift']());}};_0x2d9008(++_0x19e94c);}(_0x5036,0x191));var _0x6503=function(_0xf5dbed,_0x28884b){_0xf5dbed=_0xf5dbed-0x0;var _0x1b102f=_0x5036[_0xf5dbed];return _0x1b102f;};'use strict';var _=require(_0x6503('0x0'));var util=require(_0x6503('0x1'));var logger=require(_0x6503('0x2'))(_0x6503('0x3'));var moment=require(_0x6503('0x4'));var BPromise=require(_0x6503('0x5'));var rp=require(_0x6503('0x6'));var fs=require('fs');var path=require(_0x6503('0x7'));var rimraf=require(_0x6503('0x8'));var config=require('../../config/environment');var attributes=require(_0x6503('0x9'));var integrations=require(_0x6503('0xa'));module[_0x6503('0xb')]=function(_0x2ff20f,_0x579e59){return _0x2ff20f[_0x6503('0xc')]('ZendeskAccount',attributes,{'tableName':_0x6503('0xd'),'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 e4d2c28..3f5b053 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 _0x3725=['where','attributes','limit','include','map','model','ShowZendeskAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options'];(function(_0x4bd950,_0x184ed5){var _0x5dc59a=function(_0x6ff30f){while(--_0x6ff30f){_0x4bd950['push'](_0x4bd950['shift']());}};_0x5dc59a(++_0x184ed5);}(_0x3725,0xc1));var _0x5372=function(_0x1994dd,_0x5cf6e7){_0x1994dd=_0x1994dd-0x0;var _0x7cc9bc=_0x3725[_0x1994dd];return _0x7cc9bc;};'use strict';var _=require(_0x5372('0x0'));var util=require(_0x5372('0x1'));var moment=require(_0x5372('0x2'));var BPromise=require(_0x5372('0x3'));var rs=require(_0x5372('0x4'));var fs=require('fs');var Redis=require(_0x5372('0x5'));var db=require(_0x5372('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5372('0x7'));var config=require(_0x5372('0x8'));var jayson=require(_0x5372('0x9'));var client=jayson[_0x5372('0xa')][_0x5372('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf922f,_0x25ec57,_0x393fca){return new BPromise(function(_0x30c9cd,_0xadd416){return client[_0x5372('0xc')](_0xf922f,_0x393fca)[_0x5372('0xd')](function(_0x44ab92){logger[_0x5372('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x25ec57,_0x5372('0xf'));logger[_0x5372('0x10')](_0x5372('0x11'),_0x25ec57,'request\x20sent',JSON[_0x5372('0x12')](_0x44ab92));if(_0x44ab92[_0x5372('0x13')]){if(_0x44ab92[_0x5372('0x13')][_0x5372('0x14')]===0x1f4){logger[_0x5372('0x13')](_0x5372('0x15'),_0x25ec57,_0x44ab92[_0x5372('0x13')][_0x5372('0x16')]);return _0xadd416(_0x44ab92[_0x5372('0x13')][_0x5372('0x16')]);}logger[_0x5372('0x13')](_0x5372('0x15'),_0x25ec57,_0x44ab92[_0x5372('0x13')][_0x5372('0x16')]);return _0x30c9cd(_0x44ab92[_0x5372('0x13')]['message']);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x25ec57,'request\x20sent');_0x30c9cd(_0x44ab92[_0x5372('0x17')][_0x5372('0x16')]);}})[_0x5372('0x18')](function(_0x5632d1){logger[_0x5372('0x13')](_0x5372('0x15'),_0x25ec57,_0x5632d1);_0xadd416(_0x5632d1);});});}exports[_0x5372('0x19')]=function(_0x6b67b3){var _0x4bdcfa=this;return new Promise(function(_0x5390f3,_0x4970e6){return db[_0x5372('0x1a')][_0x5372('0x1b')]({'raw':_0x6b67b3[_0x5372('0x1c')]?_0x6b67b3['options']['raw']===undefined?!![]:![]:!![],'where':_0x6b67b3[_0x5372('0x1c')]?_0x6b67b3[_0x5372('0x1c')][_0x5372('0x1d')]||null:null,'attributes':_0x6b67b3[_0x5372('0x1c')]?_0x6b67b3[_0x5372('0x1c')][_0x5372('0x1e')]||null:null,'limit':_0x6b67b3[_0x5372('0x1c')]?_0x6b67b3['options'][_0x5372('0x1f')]||null:null,'include':_0x6b67b3[_0x5372('0x1c')]?_0x6b67b3[_0x5372('0x1c')][_0x5372('0x20')]?_[_0x5372('0x21')](_0x6b67b3[_0x5372('0x1c')][_0x5372('0x20')],function(_0x3553ae){return{'model':db[_0x3553ae[_0x5372('0x22')]],'as':_0x3553ae['as'],'attributes':_0x3553ae[_0x5372('0x1e')],'include':_0x3553ae['include']?_[_0x5372('0x21')](_0x3553ae[_0x5372('0x20')],function(_0x2413da){return{'model':db[_0x2413da[_0x5372('0x22')]],'as':_0x2413da['as'],'attributes':_0x2413da[_0x5372('0x1e')],'include':_0x2413da[_0x5372('0x20')]?_['map'](_0x2413da[_0x5372('0x20')],function(_0x11e57d){return{'model':db[_0x11e57d['model']],'as':_0x11e57d['as'],'attributes':_0x11e57d[_0x5372('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c1ae7){logger[_0x5372('0xe')]('GetZendeskAccount',_0x6b67b3);logger[_0x5372('0x10')](_0x5372('0x19'),_0x6b67b3,JSON[_0x5372('0x12')](_0x3c1ae7));_0x5390f3(_0x3c1ae7);})[_0x5372('0x18')](function(_0x3309a7){logger['error'](_0x5372('0x19'),_0x3309a7[_0x5372('0x16')],_0x6b67b3);_0x4970e6(_0x4bdcfa[_0x5372('0x13')](0x1f4,_0x3309a7[_0x5372('0x16')]));});});};exports[_0x5372('0x23')]=function(_0x44d4d0){var _0x434a91=this;return new Promise(function(_0x59c032,_0x54e6b7){return db[_0x5372('0x1a')]['find']({'raw':_0x44d4d0[_0x5372('0x1c')]?_0x44d4d0[_0x5372('0x1c')][_0x5372('0x24')]===undefined?!![]:![]:!![],'where':_0x44d4d0['options']?_0x44d4d0['options'][_0x5372('0x1d')]||null:null,'attributes':_0x44d4d0[_0x5372('0x1c')]?_0x44d4d0[_0x5372('0x1c')][_0x5372('0x1e')]||null:null,'include':_0x44d4d0[_0x5372('0x1c')]?_0x44d4d0[_0x5372('0x1c')]['include']?_[_0x5372('0x21')](_0x44d4d0['options'][_0x5372('0x20')],function(_0xab51ef){return{'model':db[_0xab51ef['model']],'as':_0xab51ef['as'],'attributes':_0xab51ef[_0x5372('0x1e')],'include':_0xab51ef[_0x5372('0x20')]?_[_0x5372('0x21')](_0xab51ef[_0x5372('0x20')],function(_0x18adfe){return{'model':db[_0x18adfe[_0x5372('0x22')]],'as':_0x18adfe['as'],'attributes':_0x18adfe[_0x5372('0x1e')],'include':_0x18adfe[_0x5372('0x20')]?_[_0x5372('0x21')](_0x18adfe['include'],function(_0x5a6801){return{'model':db[_0x5a6801[_0x5372('0x22')]],'as':_0x5a6801['as'],'attributes':_0x5a6801['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xadec0){logger[_0x5372('0xe')](_0x5372('0x23'),_0x44d4d0);logger[_0x5372('0x10')](_0x5372('0x23'),_0x44d4d0,JSON['stringify'](_0xadec0));_0x59c032(_0xadec0);})['catch'](function(_0x5b1e66){logger[_0x5372('0x13')](_0x5372('0x23'),_0x5b1e66[_0x5372('0x16')],_0x44d4d0);_0x54e6b7(_0x434a91['error'](0x1f4,_0x5b1e66[_0x5372('0x16')]));});});}; \ No newline at end of file +var _0xe4ce=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ZendeskAccount','options','raw','where','attributes','model','include','map','GetZendeskAccount','find','ShowZendeskAccount'];(function(_0x5e6b89,_0x2e9e81){var _0x1a7e6d=function(_0xb60192){while(--_0xb60192){_0x5e6b89['push'](_0x5e6b89['shift']());}};_0x1a7e6d(++_0x2e9e81);}(_0xe4ce,0x198));var _0xee4c=function(_0x4b0300,_0x107ccd){_0x4b0300=_0x4b0300-0x0;var _0x2a7e86=_0xe4ce[_0x4b0300];return _0x2a7e86;};'use strict';var _=require(_0xee4c('0x0'));var util=require('util');var moment=require(_0xee4c('0x1'));var BPromise=require(_0xee4c('0x2'));var rs=require(_0xee4c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee4c('0x4'))['db'];var utils=require(_0xee4c('0x5'));var logger=require(_0xee4c('0x6'))(_0xee4c('0x7'));var config=require('../../config/environment');var jayson=require(_0xee4c('0x8'));var client=jayson['client'][_0xee4c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52a051,_0x2b7f31,_0x2bb64d){return new BPromise(function(_0x2e51c8,_0x4addc0){return client[_0xee4c('0xa')](_0x52a051,_0x2bb64d)[_0xee4c('0xb')](function(_0x5a308f){logger[_0xee4c('0xc')](_0xee4c('0xd'),_0x2b7f31,_0xee4c('0xe'));logger[_0xee4c('0xf')](_0xee4c('0x10'),_0x2b7f31,_0xee4c('0xe'),JSON[_0xee4c('0x11')](_0x5a308f));if(_0x5a308f[_0xee4c('0x12')]){if(_0x5a308f[_0xee4c('0x12')][_0xee4c('0x13')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x2b7f31,_0x5a308f[_0xee4c('0x12')][_0xee4c('0x14')]);return _0x4addc0(_0x5a308f[_0xee4c('0x12')][_0xee4c('0x14')]);}logger[_0xee4c('0x12')](_0xee4c('0xd'),_0x2b7f31,_0x5a308f[_0xee4c('0x12')][_0xee4c('0x14')]);return _0x2e51c8(_0x5a308f['error']['message']);}else{logger[_0xee4c('0xc')](_0xee4c('0xd'),_0x2b7f31,_0xee4c('0xe'));_0x2e51c8(_0x5a308f[_0xee4c('0x15')][_0xee4c('0x14')]);}})[_0xee4c('0x16')](function(_0x515ce7){logger[_0xee4c('0x12')](_0xee4c('0xd'),_0x2b7f31,_0x515ce7);_0x4addc0(_0x515ce7);});});}exports['GetZendeskAccount']=function(_0x4da0ed){var _0x4c8656=this;return new Promise(function(_0x467041,_0x45eb10){return db[_0xee4c('0x17')]['findAll']({'raw':_0x4da0ed[_0xee4c('0x18')]?_0x4da0ed[_0xee4c('0x18')][_0xee4c('0x19')]===undefined?!![]:![]:!![],'where':_0x4da0ed[_0xee4c('0x18')]?_0x4da0ed[_0xee4c('0x18')][_0xee4c('0x1a')]||null:null,'attributes':_0x4da0ed[_0xee4c('0x18')]?_0x4da0ed['options'][_0xee4c('0x1b')]||null:null,'limit':_0x4da0ed[_0xee4c('0x18')]?_0x4da0ed[_0xee4c('0x18')]['limit']||null:null,'include':_0x4da0ed[_0xee4c('0x18')]?_0x4da0ed['options']['include']?_['map'](_0x4da0ed[_0xee4c('0x18')]['include'],function(_0x573d3e){return{'model':db[_0x573d3e[_0xee4c('0x1c')]],'as':_0x573d3e['as'],'attributes':_0x573d3e[_0xee4c('0x1b')],'include':_0x573d3e[_0xee4c('0x1d')]?_[_0xee4c('0x1e')](_0x573d3e[_0xee4c('0x1d')],function(_0x46fe1d){return{'model':db[_0x46fe1d[_0xee4c('0x1c')]],'as':_0x46fe1d['as'],'attributes':_0x46fe1d[_0xee4c('0x1b')],'include':_0x46fe1d[_0xee4c('0x1d')]?_['map'](_0x46fe1d[_0xee4c('0x1d')],function(_0x5f5402){return{'model':db[_0x5f5402[_0xee4c('0x1c')]],'as':_0x5f5402['as'],'attributes':_0x5f5402[_0xee4c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xee4c('0xb')](function(_0xafb9e){logger[_0xee4c('0xc')](_0xee4c('0x1f'),_0x4da0ed);logger[_0xee4c('0xf')](_0xee4c('0x1f'),_0x4da0ed,JSON[_0xee4c('0x11')](_0xafb9e));_0x467041(_0xafb9e);})['catch'](function(_0x1593b1){logger[_0xee4c('0x12')](_0xee4c('0x1f'),_0x1593b1['message'],_0x4da0ed);_0x45eb10(_0x4c8656[_0xee4c('0x12')](0x1f4,_0x1593b1['message']));});});};exports['ShowZendeskAccount']=function(_0x2eb92f){var _0x534c83=this;return new Promise(function(_0x26ee87,_0x5f2d51){return db['ZendeskAccount'][_0xee4c('0x20')]({'raw':_0x2eb92f['options']?_0x2eb92f[_0xee4c('0x18')][_0xee4c('0x19')]===undefined?!![]:![]:!![],'where':_0x2eb92f['options']?_0x2eb92f[_0xee4c('0x18')][_0xee4c('0x1a')]||null:null,'attributes':_0x2eb92f[_0xee4c('0x18')]?_0x2eb92f['options'][_0xee4c('0x1b')]||null:null,'include':_0x2eb92f[_0xee4c('0x18')]?_0x2eb92f[_0xee4c('0x18')][_0xee4c('0x1d')]?_['map'](_0x2eb92f['options'][_0xee4c('0x1d')],function(_0x2f680c){return{'model':db[_0x2f680c['model']],'as':_0x2f680c['as'],'attributes':_0x2f680c[_0xee4c('0x1b')],'include':_0x2f680c[_0xee4c('0x1d')]?_[_0xee4c('0x1e')](_0x2f680c[_0xee4c('0x1d')],function(_0x54aa72){return{'model':db[_0x54aa72[_0xee4c('0x1c')]],'as':_0x54aa72['as'],'attributes':_0x54aa72[_0xee4c('0x1b')],'include':_0x54aa72['include']?_[_0xee4c('0x1e')](_0x54aa72['include'],function(_0x5b24e4){return{'model':db[_0x5b24e4[_0xee4c('0x1c')]],'as':_0x5b24e4['as'],'attributes':_0x5b24e4[_0xee4c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xee4c('0xb')](function(_0xe1905){logger['info'](_0xee4c('0x21'),_0x2eb92f);logger[_0xee4c('0xf')](_0xee4c('0x21'),_0x2eb92f,JSON[_0xee4c('0x11')](_0xe1905));_0x26ee87(_0xe1905);})[_0xee4c('0x16')](function(_0x24f818){logger[_0xee4c('0x12')](_0xee4c('0x21'),_0x24f818[_0xee4c('0x14')],_0x2eb92f);_0x5f2d51(_0x534c83['error'](0x1f4,_0x24f818[_0xee4c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 9cd26e1..8f4f71f 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 _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x2dc87f,_0x559c7f){var _0x3282fe=function(_0x1ec9c5){while(--_0x1ec9c5){_0x2dc87f['push'](_0x2dc87f['shift']());}};_0x3282fe(++_0x559c7f);}(_0x4fc2,0x111));var _0x24fc=function(_0x23d927,_0x2102d1){_0x23d927=_0x23d927-0x0;var _0x1ba1b9=_0x4fc2[_0x23d927];return _0x1ba1b9;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('0x19')]=router; \ No newline at end of file +var _0x7916=['getDescriptions','get','/:id/tags','getTags','post','create','setTags','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x5b6ee2,_0x254b0e){var _0x35df2d=function(_0xc8fe13){while(--_0xc8fe13){_0x5b6ee2['push'](_0x5b6ee2['shift']());}};_0x35df2d(++_0x254b0e);}(_0x7916,0x128));var _0x6791=function(_0x25fe8e,_0x5811f0){_0x25fe8e=_0x25fe8e-0x0;var _0xe8d307=_0x7916[_0x25fe8e];return _0xe8d307;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var timeout=require(_0x6791('0x2'));var express=require('express');var router=express[_0x6791('0x3')]();var fs_extra=require(_0x6791('0x4'));var auth=require(_0x6791('0x5'));var interaction=require(_0x6791('0x6'));var config=require('../../config/environment');var controller=require(_0x6791('0x7'));router['get']('/',auth[_0x6791('0x8')](),controller[_0x6791('0x9')]);router['get'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0xb')]);router['get']('/:id/fields',auth[_0x6791('0x8')](),controller[_0x6791('0xc')]);router['get'](_0x6791('0xd'),auth[_0x6791('0x8')](),controller[_0x6791('0xe')]);router['get'](_0x6791('0xf'),auth[_0x6791('0x8')](),controller[_0x6791('0x10')]);router[_0x6791('0x11')](_0x6791('0x12'),auth[_0x6791('0x8')](),controller[_0x6791('0x13')]);router[_0x6791('0x14')]('/',auth[_0x6791('0x8')](),controller[_0x6791('0x15')]);router[_0x6791('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x6791('0x16')]);router['put'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0x17')]);router[_0x6791('0x18')]('/:id',auth[_0x6791('0x8')](),controller['destroy']);module[_0x6791('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 06eacac..dc46e40 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 _0xb5fe=['STRING','exports'];(function(_0x47690d,_0x5cc6d8){var _0x3d199e=function(_0x241741){while(--_0x241741){_0x47690d['push'](_0x47690d['shift']());}};_0x3d199e(++_0x5cc6d8);}(_0xb5fe,0x1df));var _0xeb5f=function(_0x38b948,_0x392056){_0x38b948=_0x38b948-0x0;var _0x373000=_0xb5fe[_0x38b948];return _0x373000;};'use strict';var Sequelize=require('sequelize');module[_0xeb5f('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb5f('0x1')]}}; \ No newline at end of file +var _0xe351=['STRING','sequelize','exports'];(function(_0x3859b2,_0x11eba5){var _0x47462e=function(_0xea8146){while(--_0xea8146){_0x3859b2['push'](_0x3859b2['shift']());}};_0x47462e(++_0x11eba5);}(_0xe351,0x154));var _0x1e35=function(_0x1abf5e,_0x964625){_0x1abf5e=_0x1abf5e-0x0;var _0x5a0d35=_0xe351[_0x1abf5e];return _0x5a0d35;};'use strict';var Sequelize=require(_0x1e35('0x0'));module[_0x1e35('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1e35('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index fa4ebf6..bff7370 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 _0xae84=['save','update','destroy','then','error','stack','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','ZendeskField','filter','limit','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply'];(function(_0x3b8fb7,_0x1918d8){var _0x56eaca=function(_0x4c1ddb){while(--_0x4c1ddb){_0x3b8fb7['push'](_0x3b8fb7['shift']());}};_0x56eaca(++_0x1918d8);}(_0xae84,0x132));var _0x4ae8=function(_0x354642,_0x58fe5f){_0x354642=_0x354642-0x0;var _0x46a64e=_0xae84[_0x354642];return _0x46a64e;};'use strict';var emlformat=require(_0x4ae8('0x0'));var rimraf=require(_0x4ae8('0x1'));var zipdir=require(_0x4ae8('0x2'));var jsonpatch=require(_0x4ae8('0x3'));var rp=require(_0x4ae8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ae8('0x5'));var util=require(_0x4ae8('0x6'));var path=require('path');var sox=require(_0x4ae8('0x7'));var csv=require(_0x4ae8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ae8('0x9'));var _=require(_0x4ae8('0xa'));var squel=require(_0x4ae8('0xb'));var crypto=require(_0x4ae8('0xc'));var jsforce=require(_0x4ae8('0xd'));var deskjs=require(_0x4ae8('0xe'));var toCsv=require(_0x4ae8('0x8'));var querystring=require(_0x4ae8('0xf'));var Papa=require('papaparse');var Redis=require(_0x4ae8('0x10'));var authService=require(_0x4ae8('0x11'));var qs=require(_0x4ae8('0x12'));var as=require(_0x4ae8('0x13'));var hardwareService=require(_0x4ae8('0x14'));var logger=require('../../config/logger')(_0x4ae8('0x15'));var utils=require(_0x4ae8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4ae8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43d26e,_0x16f0d7){_0x16f0d7=_0x16f0d7||0xcc;return function(_0x2a0c6f){if(_0x2a0c6f){return _0x43d26e[_0x4ae8('0x18')](_0x16f0d7);}return _0x43d26e['status'](_0x16f0d7)[_0x4ae8('0x19')]();};}function respondWithResult(_0x2a8e32,_0x40d5cb){_0x40d5cb=_0x40d5cb||0xc8;return function(_0x1bf202){if(_0x1bf202){return _0x2a8e32[_0x4ae8('0x1a')](_0x40d5cb)[_0x4ae8('0x1b')](_0x1bf202);}};}function respondWithFilteredResult(_0x319483,_0x543afb){return function(_0x5bc666){if(_0x5bc666){var _0x53dccb=typeof _0x543afb['offset']===_0x4ae8('0x1c')&&typeof _0x543afb['limit']==='undefined';var _0x37d18a=_0x5bc666[_0x4ae8('0x1d')];var _0x6b9b7=_0x53dccb?0x0:_0x543afb[_0x4ae8('0x1e')];var _0x4765a6=_0x53dccb?_0x5bc666[_0x4ae8('0x1d')]:_0x543afb['offset']+_0x543afb['limit'];var _0x3f6db3;if(_0x4765a6>=_0x37d18a){_0x4765a6=_0x37d18a;_0x3f6db3=0xc8;}else{_0x3f6db3=0xce;}_0x319483['status'](_0x3f6db3);return _0x319483[_0x4ae8('0x1f')](_0x4ae8('0x20'),_0x6b9b7+'-'+_0x4765a6+'/'+_0x37d18a)[_0x4ae8('0x1b')](_0x5bc666);}return null;};}function patchUpdates(_0x16a5e4){return function(_0x28dd54){try{jsonpatch[_0x4ae8('0x21')](_0x28dd54,_0x16a5e4,!![]);}catch(_0x305423){return BPromise['reject'](_0x305423);}return _0x28dd54[_0x4ae8('0x22')]();};}function saveUpdates(_0x314fe0,_0x3e9b6b){return function(_0x4f0ca5){if(_0x4f0ca5){return _0x4f0ca5[_0x4ae8('0x23')](_0x314fe0)['then'](function(_0x17b4d6){return _0x17b4d6;});}return null;};}function removeEntity(_0x530b2c,_0x184253){return function(_0x39936e){if(_0x39936e){return _0x39936e[_0x4ae8('0x24')]()[_0x4ae8('0x25')](function(){_0x530b2c[_0x4ae8('0x1a')](0xcc)[_0x4ae8('0x19')]();});}};}function handleEntityNotFound(_0x7b25dc,_0xafc5e7){return function(_0x392701){if(!_0x392701){_0x7b25dc['sendStatus'](0x194);}return _0x392701;};}function handleError(_0x14a161,_0x213f0a){_0x213f0a=_0x213f0a||0x1f4;return function(_0x1249bb){logger[_0x4ae8('0x26')](_0x1249bb[_0x4ae8('0x27')]);if(_0x1249bb['name']){delete _0x1249bb['name'];}_0x14a161[_0x4ae8('0x1a')](_0x213f0a)[_0x4ae8('0x28')](_0x1249bb);};}exports[_0x4ae8('0x29')]=function(_0x2c241e,_0x3fc518){var _0x174050={},_0x50d627={},_0x26124e={'count':0x0,'rows':[]};var _0x53f62e=_[_0x4ae8('0x2a')](db[_0x4ae8('0x2b')][_0x4ae8('0x2c')],function(_0x35b6a0){return{'name':_0x35b6a0[_0x4ae8('0x2d')],'type':_0x35b6a0[_0x4ae8('0x2e')][_0x4ae8('0x2f')]};});_0x50d627[_0x4ae8('0x30')]=_[_0x4ae8('0x2a')](_0x53f62e,'name');_0x50d627[_0x4ae8('0x31')]=_[_0x4ae8('0x32')](_0x2c241e[_0x4ae8('0x31')]);_0x50d627['filters']=_[_0x4ae8('0x33')](_0x50d627[_0x4ae8('0x30')],_0x50d627[_0x4ae8('0x31')]);_0x174050[_0x4ae8('0x34')]=_['intersection'](_0x50d627[_0x4ae8('0x30')],qs['fields'](_0x2c241e[_0x4ae8('0x31')][_0x4ae8('0x35')]));_0x174050['attributes']=_0x174050[_0x4ae8('0x34')][_0x4ae8('0x36')]?_0x174050['attributes']:_0x50d627[_0x4ae8('0x30')];if(!_0x2c241e['query'][_0x4ae8('0x37')](_0x4ae8('0x38'))){_0x174050['limit']=qs['limit'](_0x2c241e[_0x4ae8('0x31')]['limit']);_0x174050[_0x4ae8('0x1e')]=qs[_0x4ae8('0x1e')](_0x2c241e['query'][_0x4ae8('0x1e')]);}_0x174050[_0x4ae8('0x39')]=qs['sort'](_0x2c241e[_0x4ae8('0x31')][_0x4ae8('0x3a')]);_0x174050[_0x4ae8('0x3b')]=qs[_0x4ae8('0x3c')](_[_0x4ae8('0x3d')](_0x2c241e[_0x4ae8('0x31')],_0x50d627[_0x4ae8('0x3c')]),_0x53f62e);if(_0x2c241e[_0x4ae8('0x31')]['filter']){_0x174050['where']=_[_0x4ae8('0x3e')](_0x174050[_0x4ae8('0x3b')],{'$or':_[_0x4ae8('0x2a')](_0x53f62e,function(_0x41dd78){if(_0x41dd78[_0x4ae8('0x2e')]!==_0x4ae8('0x3f')){var _0x311421={};_0x311421[_0x41dd78[_0x4ae8('0x40')]]={'$like':'%'+_0x2c241e[_0x4ae8('0x31')]['filter']+'%'};return _0x311421;}})});}_0x174050=_['merge']({},_0x174050,_0x2c241e[_0x4ae8('0x41')]);var _0x31bd20={'where':_0x174050['where']};return db[_0x4ae8('0x2b')][_0x4ae8('0x1d')](_0x31bd20)[_0x4ae8('0x25')](function(_0x4628d7){_0x26124e[_0x4ae8('0x1d')]=_0x4628d7;if(_0x2c241e[_0x4ae8('0x31')][_0x4ae8('0x42')]){_0x174050[_0x4ae8('0x43')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x4ae8('0x44')](_0x174050);})[_0x4ae8('0x25')](function(_0x29ea7c){_0x26124e[_0x4ae8('0x45')]=_0x29ea7c;return _0x26124e;})['then'](respondWithFilteredResult(_0x3fc518,_0x174050))[_0x4ae8('0x46')](handleError(_0x3fc518,null));};exports['show']=function(_0x312249,_0x3e8e9f){var _0xff6506={'raw':![],'where':{'id':_0x312249[_0x4ae8('0x47')]['id']}},_0x65e15f={};_0x65e15f[_0x4ae8('0x30')]=_[_0x4ae8('0x32')](db['ZendeskConfiguration'][_0x4ae8('0x2c')]);_0x65e15f['query']=_[_0x4ae8('0x32')](_0x312249[_0x4ae8('0x31')]);_0x65e15f[_0x4ae8('0x3c')]=_[_0x4ae8('0x33')](_0x65e15f[_0x4ae8('0x30')],_0x65e15f[_0x4ae8('0x31')]);_0xff6506['attributes']=_[_0x4ae8('0x33')](_0x65e15f[_0x4ae8('0x30')],qs[_0x4ae8('0x35')](_0x312249[_0x4ae8('0x31')][_0x4ae8('0x35')]));_0xff6506[_0x4ae8('0x34')]=_0xff6506['attributes'][_0x4ae8('0x36')]?_0xff6506[_0x4ae8('0x34')]:_0x65e15f[_0x4ae8('0x30')];if(_0x312249[_0x4ae8('0x31')][_0x4ae8('0x42')]){_0xff6506['include']=[{'all':!![]}];}_0xff6506=_[_0x4ae8('0x3e')]({},_0xff6506,_0x312249[_0x4ae8('0x41')]);return db[_0x4ae8('0x2b')][_0x4ae8('0x48')](_0xff6506)['then'](handleEntityNotFound(_0x3e8e9f,null))[_0x4ae8('0x25')](respondWithResult(_0x3e8e9f,null))[_0x4ae8('0x46')](handleError(_0x3e8e9f,null));};exports['create']=function(_0x421268,_0x3415ce){return db[_0x4ae8('0x2b')][_0x4ae8('0x49')](_0x421268[_0x4ae8('0x4a')],{})[_0x4ae8('0x25')](respondWithResult(_0x3415ce,0xc9))[_0x4ae8('0x46')](handleError(_0x3415ce,null));};exports[_0x4ae8('0x23')]=function(_0x35b76d,_0x1164e){if(_0x35b76d[_0x4ae8('0x4a')]['id']){delete _0x35b76d[_0x4ae8('0x4a')]['id'];}return db[_0x4ae8('0x2b')][_0x4ae8('0x48')]({'where':{'id':_0x35b76d[_0x4ae8('0x47')]['id']}})[_0x4ae8('0x25')](handleEntityNotFound(_0x1164e,null))['then'](saveUpdates(_0x35b76d['body'],null))['then'](respondWithResult(_0x1164e,null))[_0x4ae8('0x46')](handleError(_0x1164e,null));};exports[_0x4ae8('0x24')]=function(_0x3fdeea,_0x54eda3){return db[_0x4ae8('0x2b')][_0x4ae8('0x48')]({'where':{'id':_0x3fdeea['params']['id']}})[_0x4ae8('0x25')](handleEntityNotFound(_0x54eda3,null))[_0x4ae8('0x25')](removeEntity(_0x54eda3,null))['catch'](handleError(_0x54eda3,null));};exports[_0x4ae8('0x4b')]=function(_0x32753b,_0x34f501,_0x2ac4e8){var _0x54e794={};var _0x4ba1db={};var _0x4796b7;var _0x51e9f7;return db[_0x4ae8('0x2b')][_0x4ae8('0x4c')]({'where':{'id':_0x32753b[_0x4ae8('0x47')]['id']}})[_0x4ae8('0x25')](handleEntityNotFound(_0x34f501,null))[_0x4ae8('0x25')](function(_0x31e2fb){if(_0x31e2fb){_0x4796b7=_0x31e2fb;_0x4ba1db[_0x4ae8('0x30')]=_[_0x4ae8('0x32')](db[_0x4ae8('0x4d')]['rawAttributes']);_0x4ba1db[_0x4ae8('0x31')]=_[_0x4ae8('0x32')](_0x32753b[_0x4ae8('0x31')]);_0x4ba1db[_0x4ae8('0x3c')]=_['intersection'](_0x4ba1db[_0x4ae8('0x30')],_0x4ba1db[_0x4ae8('0x31')]);_0x54e794[_0x4ae8('0x34')]=_[_0x4ae8('0x33')](_0x4ba1db[_0x4ae8('0x30')],qs[_0x4ae8('0x35')](_0x32753b['query'][_0x4ae8('0x35')]));_0x54e794[_0x4ae8('0x34')]=_0x54e794['attributes'][_0x4ae8('0x36')]?_0x54e794[_0x4ae8('0x34')]:_0x4ba1db['model'];_0x54e794['order']=qs[_0x4ae8('0x3a')](_0x32753b[_0x4ae8('0x31')]['sort']);_0x54e794[_0x4ae8('0x3b')]=qs[_0x4ae8('0x3c')](_[_0x4ae8('0x3d')](_0x32753b['query'],_0x4ba1db[_0x4ae8('0x3c')]));if(_0x32753b[_0x4ae8('0x31')][_0x4ae8('0x4e')]){_0x54e794[_0x4ae8('0x3b')]=_[_0x4ae8('0x3e')](_0x54e794['where'],{'$or':_[_0x4ae8('0x2a')](_0x54e794[_0x4ae8('0x34')],function(_0x3293e5){var _0x279a53={};_0x279a53[_0x3293e5]={'$like':'%'+_0x32753b[_0x4ae8('0x31')][_0x4ae8('0x4e')]+'%'};return _0x279a53;})});}_0x54e794=_[_0x4ae8('0x3e')]({},_0x54e794,_0x32753b[_0x4ae8('0x41')]);return _0x4796b7['getFields'](_0x54e794);}})['then'](function(_0x528ba4){if(_0x528ba4){_0x51e9f7=_0x528ba4[_0x4ae8('0x36')];if(!_0x32753b['query']['hasOwnProperty'](_0x4ae8('0x38'))){_0x54e794['limit']=qs['limit'](_0x32753b[_0x4ae8('0x31')][_0x4ae8('0x4f')]);_0x54e794['offset']=qs['offset'](_0x32753b['query'][_0x4ae8('0x1e')]);}return _0x4796b7['getFields'](_0x54e794);}})['then'](function(_0x3832a7){if(_0x3832a7){return _0x3832a7?{'count':_0x51e9f7,'rows':_0x3832a7}:null;}})[_0x4ae8('0x25')](respondWithResult(_0x34f501,null))[_0x4ae8('0x46')](handleError(_0x34f501,null));};exports['getSubjects']=function(_0xaf87fa,_0x175dce,_0xeeb5c2){var _0x5369b2={};var _0x93da16={};var _0x2096c2;var _0x253e36;return db[_0x4ae8('0x2b')]['findOne']({'where':{'id':_0xaf87fa['params']['id']}})[_0x4ae8('0x25')](handleEntityNotFound(_0x175dce,null))[_0x4ae8('0x25')](function(_0x5854df){if(_0x5854df){_0x2096c2=_0x5854df;_0x93da16[_0x4ae8('0x30')]=_[_0x4ae8('0x32')](db['ZendeskField'][_0x4ae8('0x2c')]);_0x93da16[_0x4ae8('0x31')]=_['keys'](_0xaf87fa['query']);_0x93da16[_0x4ae8('0x3c')]=_[_0x4ae8('0x33')](_0x93da16[_0x4ae8('0x30')],_0x93da16[_0x4ae8('0x31')]);_0x5369b2[_0x4ae8('0x34')]=_[_0x4ae8('0x33')](_0x93da16[_0x4ae8('0x30')],qs[_0x4ae8('0x35')](_0xaf87fa['query'][_0x4ae8('0x35')]));_0x5369b2[_0x4ae8('0x34')]=_0x5369b2[_0x4ae8('0x34')]['length']?_0x5369b2[_0x4ae8('0x34')]:_0x93da16[_0x4ae8('0x30')];_0x5369b2[_0x4ae8('0x39')]=qs[_0x4ae8('0x3a')](_0xaf87fa['query'][_0x4ae8('0x3a')]);_0x5369b2['where']=qs[_0x4ae8('0x3c')](_[_0x4ae8('0x3d')](_0xaf87fa['query'],_0x93da16[_0x4ae8('0x3c')]));if(_0xaf87fa[_0x4ae8('0x31')][_0x4ae8('0x4e')]){_0x5369b2[_0x4ae8('0x3b')]=_['merge'](_0x5369b2[_0x4ae8('0x3b')],{'$or':_[_0x4ae8('0x2a')](_0x5369b2[_0x4ae8('0x34')],function(_0x5a5c98){var _0x2cc0cc={};_0x2cc0cc[_0x5a5c98]={'$like':'%'+_0xaf87fa['query'][_0x4ae8('0x4e')]+'%'};return _0x2cc0cc;})});}_0x5369b2=_[_0x4ae8('0x3e')]({},_0x5369b2,_0xaf87fa[_0x4ae8('0x41')]);return _0x2096c2[_0x4ae8('0x50')](_0x5369b2);}})['then'](function(_0x69ec05){if(_0x69ec05){_0x253e36=_0x69ec05['length'];if(!_0xaf87fa[_0x4ae8('0x31')][_0x4ae8('0x37')](_0x4ae8('0x38'))){_0x5369b2[_0x4ae8('0x4f')]=qs[_0x4ae8('0x4f')](_0xaf87fa['query']['limit']);_0x5369b2[_0x4ae8('0x1e')]=qs[_0x4ae8('0x1e')](_0xaf87fa[_0x4ae8('0x31')][_0x4ae8('0x1e')]);}return _0x2096c2['getSubjects'](_0x5369b2);}})['then'](function(_0x25b7cd){if(_0x25b7cd){return _0x25b7cd?{'count':_0x253e36,'rows':_0x25b7cd}:null;}})['then'](respondWithResult(_0x175dce,null))[_0x4ae8('0x46')](handleError(_0x175dce,null));};exports[_0x4ae8('0x51')]=function(_0x18c5a1,_0x231ff1,_0x562295){var _0x5c1630={};var _0x381862={};var _0x5c4a5a;var _0x181ffd;return db[_0x4ae8('0x2b')][_0x4ae8('0x4c')]({'where':{'id':_0x18c5a1[_0x4ae8('0x47')]['id']}})[_0x4ae8('0x25')](handleEntityNotFound(_0x231ff1,null))[_0x4ae8('0x25')](function(_0x3e0184){if(_0x3e0184){_0x5c4a5a=_0x3e0184;_0x381862[_0x4ae8('0x30')]=_[_0x4ae8('0x32')](db['ZendeskField'][_0x4ae8('0x2c')]);_0x381862['query']=_[_0x4ae8('0x32')](_0x18c5a1[_0x4ae8('0x31')]);_0x381862[_0x4ae8('0x3c')]=_[_0x4ae8('0x33')](_0x381862[_0x4ae8('0x30')],_0x381862[_0x4ae8('0x31')]);_0x5c1630['attributes']=_[_0x4ae8('0x33')](_0x381862[_0x4ae8('0x30')],qs[_0x4ae8('0x35')](_0x18c5a1[_0x4ae8('0x31')][_0x4ae8('0x35')]));_0x5c1630[_0x4ae8('0x34')]=_0x5c1630[_0x4ae8('0x34')]['length']?_0x5c1630['attributes']:_0x381862[_0x4ae8('0x30')];_0x5c1630[_0x4ae8('0x39')]=qs[_0x4ae8('0x3a')](_0x18c5a1['query'][_0x4ae8('0x3a')]);_0x5c1630[_0x4ae8('0x3b')]=qs[_0x4ae8('0x3c')](_[_0x4ae8('0x3d')](_0x18c5a1['query'],_0x381862[_0x4ae8('0x3c')]));if(_0x18c5a1[_0x4ae8('0x31')][_0x4ae8('0x4e')]){_0x5c1630[_0x4ae8('0x3b')]=_['merge'](_0x5c1630[_0x4ae8('0x3b')],{'$or':_[_0x4ae8('0x2a')](_0x5c1630[_0x4ae8('0x34')],function(_0x1b31bb){var _0x3f2586={};_0x3f2586[_0x1b31bb]={'$like':'%'+_0x18c5a1['query'][_0x4ae8('0x4e')]+'%'};return _0x3f2586;})});}_0x5c1630=_[_0x4ae8('0x3e')]({},_0x5c1630,_0x18c5a1[_0x4ae8('0x41')]);return _0x5c4a5a['getDescriptions'](_0x5c1630);}})[_0x4ae8('0x25')](function(_0x587a65){if(_0x587a65){_0x181ffd=_0x587a65[_0x4ae8('0x36')];if(!_0x18c5a1[_0x4ae8('0x31')][_0x4ae8('0x37')](_0x4ae8('0x38'))){_0x5c1630[_0x4ae8('0x4f')]=qs[_0x4ae8('0x4f')](_0x18c5a1['query'][_0x4ae8('0x4f')]);_0x5c1630[_0x4ae8('0x1e')]=qs[_0x4ae8('0x1e')](_0x18c5a1['query'][_0x4ae8('0x1e')]);}return _0x5c4a5a[_0x4ae8('0x51')](_0x5c1630);}})[_0x4ae8('0x25')](function(_0x52d2bb){if(_0x52d2bb){return _0x52d2bb?{'count':_0x181ffd,'rows':_0x52d2bb}:null;}})[_0x4ae8('0x25')](respondWithResult(_0x231ff1,null))[_0x4ae8('0x46')](handleError(_0x231ff1,null));};exports['getTags']=function(_0x3b09dd,_0x266366,_0x5e696e){var _0x3ff3b8={};var _0x5d4243={};var _0xcd5e7c;var _0x1301d3;return db['ZendeskConfiguration'][_0x4ae8('0x4c')]({'where':{'id':_0x3b09dd[_0x4ae8('0x47')]['id']}})[_0x4ae8('0x25')](handleEntityNotFound(_0x266366,null))[_0x4ae8('0x25')](function(_0x4ec2cb){if(_0x4ec2cb){_0xcd5e7c=_0x4ec2cb;_0x5d4243[_0x4ae8('0x30')]=_[_0x4ae8('0x32')](db['Tag'][_0x4ae8('0x2c')]);_0x5d4243[_0x4ae8('0x31')]=_[_0x4ae8('0x32')](_0x3b09dd[_0x4ae8('0x31')]);_0x5d4243[_0x4ae8('0x3c')]=_['intersection'](_0x5d4243[_0x4ae8('0x30')],_0x5d4243[_0x4ae8('0x31')]);_0x3ff3b8['attributes']=_[_0x4ae8('0x33')](_0x5d4243[_0x4ae8('0x30')],qs[_0x4ae8('0x35')](_0x3b09dd[_0x4ae8('0x31')][_0x4ae8('0x35')]));_0x3ff3b8['attributes']=_0x3ff3b8[_0x4ae8('0x34')]['length']?_0x3ff3b8[_0x4ae8('0x34')]:_0x5d4243['model'];_0x3ff3b8[_0x4ae8('0x39')]=qs['sort'](_0x3b09dd[_0x4ae8('0x31')][_0x4ae8('0x3a')]);_0x3ff3b8[_0x4ae8('0x3b')]=qs[_0x4ae8('0x3c')](_[_0x4ae8('0x3d')](_0x3b09dd[_0x4ae8('0x31')],_0x5d4243[_0x4ae8('0x3c')]));if(_0x3b09dd[_0x4ae8('0x31')][_0x4ae8('0x4e')]){_0x3ff3b8['where']=_['merge'](_0x3ff3b8['where'],{'$or':_['map'](_0x3ff3b8[_0x4ae8('0x34')],function(_0xbaa1c4){var _0x3ad4fa={};_0x3ad4fa[_0xbaa1c4]={'$like':'%'+_0x3b09dd[_0x4ae8('0x31')]['filter']+'%'};return _0x3ad4fa;})});}_0x3ff3b8=_[_0x4ae8('0x3e')]({},_0x3ff3b8,_0x3b09dd[_0x4ae8('0x41')]);return _0xcd5e7c[_0x4ae8('0x52')](_0x3ff3b8);}})[_0x4ae8('0x25')](function(_0x4aff62){if(_0x4aff62){_0x1301d3=_0x4aff62[_0x4ae8('0x36')];if(!_0x3b09dd[_0x4ae8('0x31')]['hasOwnProperty']('nolimit')){_0x3ff3b8[_0x4ae8('0x4f')]=qs[_0x4ae8('0x4f')](_0x3b09dd[_0x4ae8('0x31')][_0x4ae8('0x4f')]);_0x3ff3b8[_0x4ae8('0x1e')]=qs[_0x4ae8('0x1e')](_0x3b09dd[_0x4ae8('0x31')][_0x4ae8('0x1e')]);}return _0xcd5e7c['getTags'](_0x3ff3b8);}})[_0x4ae8('0x25')](function(_0x25d02a){if(_0x25d02a){return _0x25d02a?{'count':_0x1301d3,'rows':_0x25d02a}:null;}})[_0x4ae8('0x25')](respondWithResult(_0x266366,null))[_0x4ae8('0x46')](handleError(_0x266366,null));};exports[_0x4ae8('0x53')]=function(_0x3d5374,_0x3d77b3,_0x374c02){if(_0x3d5374[_0x4ae8('0x4a')]['id']){delete _0x3d5374[_0x4ae8('0x4a')]['id'];}return db[_0x4ae8('0x2b')]['findOne']({'where':{'id':_0x3d5374[_0x4ae8('0x47')]['id']}})[_0x4ae8('0x25')](handleEntityNotFound(_0x3d77b3,null))['then'](function(_0x375b43){if(_0x375b43){return _0x375b43['setTags'](_0x3d5374['body'][_0x4ae8('0x54')]||[]);}return null;})[_0x4ae8('0x25')](respondWithResult(_0x3d77b3,null))['catch'](handleError(_0x3d77b3,null));}; \ No newline at end of file +var _0xfdb5=['../../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','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','merge','VIRTUAL','ZendeskConfiguration','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','getFields','ZendeskField','rawAttributes','filter','hasOwnProperty','getSubjects','findOne','getDescriptions','pick','Tag','getTags','setTags','ids','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x22bee0,_0x412ecb){var _0x2d295b=function(_0x59d4b5){while(--_0x59d4b5){_0x22bee0['push'](_0x22bee0['shift']());}};_0x2d295b(++_0x412ecb);}(_0xfdb5,0x9f));var _0x5fdb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfdb5[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5fdb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5fdb('0x1'));var rp=require(_0x5fdb('0x2'));var moment=require('moment');var BPromise=require(_0x5fdb('0x3'));var Mustache=require(_0x5fdb('0x4'));var util=require(_0x5fdb('0x5'));var path=require(_0x5fdb('0x6'));var sox=require(_0x5fdb('0x7'));var csv=require(_0x5fdb('0x8'));var ejs=require(_0x5fdb('0x9'));var fs=require('fs');var fs_extra=require(_0x5fdb('0xa'));var _=require('lodash');var squel=require(_0x5fdb('0xb'));var crypto=require(_0x5fdb('0xc'));var jsforce=require(_0x5fdb('0xd'));var deskjs=require(_0x5fdb('0xe'));var toCsv=require(_0x5fdb('0x8'));var querystring=require(_0x5fdb('0xf'));var Papa=require(_0x5fdb('0x10'));var Redis=require(_0x5fdb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5fdb('0x12'));var as=require(_0x5fdb('0x13'));var hardwareService=require(_0x5fdb('0x14'));var logger=require(_0x5fdb('0x15'))(_0x5fdb('0x16'));var utils=require(_0x5fdb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5fdb('0x18'));var db=require(_0x5fdb('0x19'))['db'];function respondWithStatusCode(_0x490811,_0x307922){_0x307922=_0x307922||0xcc;return function(_0xcc3178){if(_0xcc3178){return _0x490811[_0x5fdb('0x1a')](_0x307922);}return _0x490811['status'](_0x307922)['end']();};}function respondWithResult(_0x1c39c1,_0x574e8b){_0x574e8b=_0x574e8b||0xc8;return function(_0xac249b){if(_0xac249b){return _0x1c39c1[_0x5fdb('0x1b')](_0x574e8b)[_0x5fdb('0x1c')](_0xac249b);}};}function respondWithFilteredResult(_0x38248e,_0x3084a4){return function(_0x3c1efb){if(_0x3c1efb){var _0x1e2037=typeof _0x3084a4[_0x5fdb('0x1d')]==='undefined'&&typeof _0x3084a4[_0x5fdb('0x1e')]===_0x5fdb('0x1f');var _0x56e96f=_0x3c1efb[_0x5fdb('0x20')];var _0x59b363=_0x1e2037?0x0:_0x3084a4[_0x5fdb('0x1d')];var _0x4ac946=_0x1e2037?_0x3c1efb[_0x5fdb('0x20')]:_0x3084a4[_0x5fdb('0x1d')]+_0x3084a4[_0x5fdb('0x1e')];var _0x242018;if(_0x4ac946>=_0x56e96f){_0x4ac946=_0x56e96f;_0x242018=0xc8;}else{_0x242018=0xce;}_0x38248e[_0x5fdb('0x1b')](_0x242018);return _0x38248e[_0x5fdb('0x21')](_0x5fdb('0x22'),_0x59b363+'-'+_0x4ac946+'/'+_0x56e96f)['json'](_0x3c1efb);}return null;};}function patchUpdates(_0xc37a8d){return function(_0x2f770b){try{jsonpatch[_0x5fdb('0x23')](_0x2f770b,_0xc37a8d,!![]);}catch(_0x5c574b){return BPromise[_0x5fdb('0x24')](_0x5c574b);}return _0x2f770b[_0x5fdb('0x25')]();};}function saveUpdates(_0x34a975,_0x5baa7c){return function(_0x2d3094){if(_0x2d3094){return _0x2d3094[_0x5fdb('0x26')](_0x34a975)[_0x5fdb('0x27')](function(_0x405a01){return _0x405a01;});}return null;};}function removeEntity(_0x45f763,_0x421724){return function(_0x96d1bf){if(_0x96d1bf){return _0x96d1bf[_0x5fdb('0x28')]()[_0x5fdb('0x27')](function(){_0x45f763[_0x5fdb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdafa7a,_0x436fda){return function(_0x8a1759){if(!_0x8a1759){_0xdafa7a['sendStatus'](0x194);}return _0x8a1759;};}function handleError(_0x3defba,_0x481aa1){_0x481aa1=_0x481aa1||0x1f4;return function(_0x2d1087){logger[_0x5fdb('0x29')](_0x2d1087[_0x5fdb('0x2a')]);if(_0x2d1087['name']){delete _0x2d1087[_0x5fdb('0x2b')];}_0x3defba[_0x5fdb('0x1b')](_0x481aa1)[_0x5fdb('0x2c')](_0x2d1087);};}exports[_0x5fdb('0x2d')]=function(_0x2cd7da,_0x4ceccb){var _0x1ae88f={},_0x3456d7={},_0x5b4aa0={'count':0x0,'rows':[]};var _0x3c4a82=_[_0x5fdb('0x2e')](db['ZendeskConfiguration']['rawAttributes'],function(_0x204f78){return{'name':_0x204f78[_0x5fdb('0x2f')],'type':_0x204f78[_0x5fdb('0x30')][_0x5fdb('0x31')]};});_0x3456d7[_0x5fdb('0x32')]=_[_0x5fdb('0x2e')](_0x3c4a82,'name');_0x3456d7[_0x5fdb('0x33')]=_[_0x5fdb('0x34')](_0x2cd7da['query']);_0x3456d7[_0x5fdb('0x35')]=_[_0x5fdb('0x36')](_0x3456d7[_0x5fdb('0x32')],_0x3456d7[_0x5fdb('0x33')]);_0x1ae88f['attributes']=_[_0x5fdb('0x36')](_0x3456d7[_0x5fdb('0x32')],qs[_0x5fdb('0x37')](_0x2cd7da[_0x5fdb('0x33')][_0x5fdb('0x37')]));_0x1ae88f[_0x5fdb('0x38')]=_0x1ae88f['attributes']['length']?_0x1ae88f[_0x5fdb('0x38')]:_0x3456d7[_0x5fdb('0x32')];if(!_0x2cd7da[_0x5fdb('0x33')]['hasOwnProperty'](_0x5fdb('0x39'))){_0x1ae88f[_0x5fdb('0x1e')]=qs[_0x5fdb('0x1e')](_0x2cd7da['query'][_0x5fdb('0x1e')]);_0x1ae88f[_0x5fdb('0x1d')]=qs[_0x5fdb('0x1d')](_0x2cd7da[_0x5fdb('0x33')][_0x5fdb('0x1d')]);}_0x1ae88f[_0x5fdb('0x3a')]=qs[_0x5fdb('0x3b')](_0x2cd7da[_0x5fdb('0x33')][_0x5fdb('0x3b')]);_0x1ae88f[_0x5fdb('0x3c')]=qs[_0x5fdb('0x35')](_['pick'](_0x2cd7da[_0x5fdb('0x33')],_0x3456d7['filters']),_0x3c4a82);if(_0x2cd7da[_0x5fdb('0x33')]['filter']){_0x1ae88f['where']=_[_0x5fdb('0x3d')](_0x1ae88f[_0x5fdb('0x3c')],{'$or':_[_0x5fdb('0x2e')](_0x3c4a82,function(_0x598d7f){if(_0x598d7f['type']!==_0x5fdb('0x3e')){var _0x4dbb96={};_0x4dbb96[_0x598d7f['name']]={'$like':'%'+_0x2cd7da['query']['filter']+'%'};return _0x4dbb96;}})});}_0x1ae88f=_[_0x5fdb('0x3d')]({},_0x1ae88f,_0x2cd7da['options']);var _0x152d8f={'where':_0x1ae88f['where']};return db[_0x5fdb('0x3f')][_0x5fdb('0x20')](_0x152d8f)[_0x5fdb('0x27')](function(_0x21795f){_0x5b4aa0['count']=_0x21795f;if(_0x2cd7da[_0x5fdb('0x33')][_0x5fdb('0x40')]){_0x1ae88f[_0x5fdb('0x41')]=[{'all':!![]}];}return db[_0x5fdb('0x3f')][_0x5fdb('0x42')](_0x1ae88f);})[_0x5fdb('0x27')](function(_0x297e2a){_0x5b4aa0[_0x5fdb('0x43')]=_0x297e2a;return _0x5b4aa0;})[_0x5fdb('0x27')](respondWithFilteredResult(_0x4ceccb,_0x1ae88f))[_0x5fdb('0x44')](handleError(_0x4ceccb,null));};exports[_0x5fdb('0x45')]=function(_0x5c02f7,_0x5ba66b){var _0x4a32db={'raw':![],'where':{'id':_0x5c02f7[_0x5fdb('0x46')]['id']}},_0x566e65={};_0x566e65['model']=_[_0x5fdb('0x34')](db[_0x5fdb('0x3f')]['rawAttributes']);_0x566e65[_0x5fdb('0x33')]=_[_0x5fdb('0x34')](_0x5c02f7['query']);_0x566e65[_0x5fdb('0x35')]=_[_0x5fdb('0x36')](_0x566e65[_0x5fdb('0x32')],_0x566e65[_0x5fdb('0x33')]);_0x4a32db['attributes']=_[_0x5fdb('0x36')](_0x566e65[_0x5fdb('0x32')],qs[_0x5fdb('0x37')](_0x5c02f7['query'][_0x5fdb('0x37')]));_0x4a32db['attributes']=_0x4a32db[_0x5fdb('0x38')][_0x5fdb('0x47')]?_0x4a32db[_0x5fdb('0x38')]:_0x566e65[_0x5fdb('0x32')];if(_0x5c02f7['query'][_0x5fdb('0x40')]){_0x4a32db['include']=[{'all':!![]}];}_0x4a32db=_[_0x5fdb('0x3d')]({},_0x4a32db,_0x5c02f7[_0x5fdb('0x48')]);return db['ZendeskConfiguration'][_0x5fdb('0x49')](_0x4a32db)[_0x5fdb('0x27')](handleEntityNotFound(_0x5ba66b,null))['then'](respondWithResult(_0x5ba66b,null))['catch'](handleError(_0x5ba66b,null));};exports['create']=function(_0x37572d,_0x6b1337){return db['ZendeskConfiguration'][_0x5fdb('0x4a')](_0x37572d[_0x5fdb('0x4b')],{})[_0x5fdb('0x27')](respondWithResult(_0x6b1337,0xc9))[_0x5fdb('0x44')](handleError(_0x6b1337,null));};exports[_0x5fdb('0x26')]=function(_0x339fbc,_0x4324c4){if(_0x339fbc[_0x5fdb('0x4b')]['id']){delete _0x339fbc[_0x5fdb('0x4b')]['id'];}return db[_0x5fdb('0x3f')][_0x5fdb('0x49')]({'where':{'id':_0x339fbc[_0x5fdb('0x46')]['id']}})[_0x5fdb('0x27')](handleEntityNotFound(_0x4324c4,null))[_0x5fdb('0x27')](saveUpdates(_0x339fbc[_0x5fdb('0x4b')],null))[_0x5fdb('0x27')](respondWithResult(_0x4324c4,null))['catch'](handleError(_0x4324c4,null));};exports['destroy']=function(_0x369f19,_0x1d206a){return db[_0x5fdb('0x3f')]['find']({'where':{'id':_0x369f19[_0x5fdb('0x46')]['id']}})[_0x5fdb('0x27')](handleEntityNotFound(_0x1d206a,null))['then'](removeEntity(_0x1d206a,null))[_0x5fdb('0x44')](handleError(_0x1d206a,null));};exports[_0x5fdb('0x4c')]=function(_0x148505,_0x2392e6,_0x3e71c9){var _0x3379f7={};var _0x12fcba={};var _0x459e46;var _0x12f45b;return db[_0x5fdb('0x3f')]['findOne']({'where':{'id':_0x148505[_0x5fdb('0x46')]['id']}})[_0x5fdb('0x27')](handleEntityNotFound(_0x2392e6,null))[_0x5fdb('0x27')](function(_0x665319){if(_0x665319){_0x459e46=_0x665319;_0x12fcba[_0x5fdb('0x32')]=_[_0x5fdb('0x34')](db[_0x5fdb('0x4d')][_0x5fdb('0x4e')]);_0x12fcba[_0x5fdb('0x33')]=_[_0x5fdb('0x34')](_0x148505[_0x5fdb('0x33')]);_0x12fcba[_0x5fdb('0x35')]=_[_0x5fdb('0x36')](_0x12fcba[_0x5fdb('0x32')],_0x12fcba[_0x5fdb('0x33')]);_0x3379f7[_0x5fdb('0x38')]=_['intersection'](_0x12fcba[_0x5fdb('0x32')],qs[_0x5fdb('0x37')](_0x148505[_0x5fdb('0x33')][_0x5fdb('0x37')]));_0x3379f7['attributes']=_0x3379f7[_0x5fdb('0x38')][_0x5fdb('0x47')]?_0x3379f7['attributes']:_0x12fcba[_0x5fdb('0x32')];_0x3379f7[_0x5fdb('0x3a')]=qs[_0x5fdb('0x3b')](_0x148505[_0x5fdb('0x33')]['sort']);_0x3379f7[_0x5fdb('0x3c')]=qs['filters'](_['pick'](_0x148505[_0x5fdb('0x33')],_0x12fcba['filters']));if(_0x148505['query'][_0x5fdb('0x4f')]){_0x3379f7[_0x5fdb('0x3c')]=_['merge'](_0x3379f7[_0x5fdb('0x3c')],{'$or':_[_0x5fdb('0x2e')](_0x3379f7[_0x5fdb('0x38')],function(_0x9e63b4){var _0x27de21={};_0x27de21[_0x9e63b4]={'$like':'%'+_0x148505[_0x5fdb('0x33')][_0x5fdb('0x4f')]+'%'};return _0x27de21;})});}_0x3379f7=_[_0x5fdb('0x3d')]({},_0x3379f7,_0x148505[_0x5fdb('0x48')]);return _0x459e46[_0x5fdb('0x4c')](_0x3379f7);}})[_0x5fdb('0x27')](function(_0xa7f80){if(_0xa7f80){_0x12f45b=_0xa7f80[_0x5fdb('0x47')];if(!_0x148505[_0x5fdb('0x33')][_0x5fdb('0x50')](_0x5fdb('0x39'))){_0x3379f7[_0x5fdb('0x1e')]=qs['limit'](_0x148505[_0x5fdb('0x33')][_0x5fdb('0x1e')]);_0x3379f7['offset']=qs['offset'](_0x148505[_0x5fdb('0x33')][_0x5fdb('0x1d')]);}return _0x459e46['getFields'](_0x3379f7);}})['then'](function(_0x3b79ec){if(_0x3b79ec){return _0x3b79ec?{'count':_0x12f45b,'rows':_0x3b79ec}:null;}})['then'](respondWithResult(_0x2392e6,null))['catch'](handleError(_0x2392e6,null));};exports[_0x5fdb('0x51')]=function(_0x3ef233,_0x24e5cc,_0x4dc1ef){var _0x4af566={};var _0x325079={};var _0x43b05f;var _0x5853b3;return db[_0x5fdb('0x3f')][_0x5fdb('0x52')]({'where':{'id':_0x3ef233['params']['id']}})[_0x5fdb('0x27')](handleEntityNotFound(_0x24e5cc,null))[_0x5fdb('0x27')](function(_0xff8b35){if(_0xff8b35){_0x43b05f=_0xff8b35;_0x325079[_0x5fdb('0x32')]=_[_0x5fdb('0x34')](db[_0x5fdb('0x4d')][_0x5fdb('0x4e')]);_0x325079[_0x5fdb('0x33')]=_[_0x5fdb('0x34')](_0x3ef233[_0x5fdb('0x33')]);_0x325079['filters']=_[_0x5fdb('0x36')](_0x325079[_0x5fdb('0x32')],_0x325079[_0x5fdb('0x33')]);_0x4af566[_0x5fdb('0x38')]=_[_0x5fdb('0x36')](_0x325079[_0x5fdb('0x32')],qs[_0x5fdb('0x37')](_0x3ef233[_0x5fdb('0x33')][_0x5fdb('0x37')]));_0x4af566[_0x5fdb('0x38')]=_0x4af566['attributes'][_0x5fdb('0x47')]?_0x4af566[_0x5fdb('0x38')]:_0x325079[_0x5fdb('0x32')];_0x4af566['order']=qs[_0x5fdb('0x3b')](_0x3ef233['query'][_0x5fdb('0x3b')]);_0x4af566[_0x5fdb('0x3c')]=qs[_0x5fdb('0x35')](_['pick'](_0x3ef233[_0x5fdb('0x33')],_0x325079[_0x5fdb('0x35')]));if(_0x3ef233[_0x5fdb('0x33')][_0x5fdb('0x4f')]){_0x4af566[_0x5fdb('0x3c')]=_[_0x5fdb('0x3d')](_0x4af566['where'],{'$or':_[_0x5fdb('0x2e')](_0x4af566[_0x5fdb('0x38')],function(_0xe08f81){var _0x4ae1aa={};_0x4ae1aa[_0xe08f81]={'$like':'%'+_0x3ef233[_0x5fdb('0x33')][_0x5fdb('0x4f')]+'%'};return _0x4ae1aa;})});}_0x4af566=_[_0x5fdb('0x3d')]({},_0x4af566,_0x3ef233[_0x5fdb('0x48')]);return _0x43b05f[_0x5fdb('0x51')](_0x4af566);}})['then'](function(_0x19e2c6){if(_0x19e2c6){_0x5853b3=_0x19e2c6[_0x5fdb('0x47')];if(!_0x3ef233[_0x5fdb('0x33')][_0x5fdb('0x50')](_0x5fdb('0x39'))){_0x4af566[_0x5fdb('0x1e')]=qs['limit'](_0x3ef233[_0x5fdb('0x33')][_0x5fdb('0x1e')]);_0x4af566[_0x5fdb('0x1d')]=qs[_0x5fdb('0x1d')](_0x3ef233['query'][_0x5fdb('0x1d')]);}return _0x43b05f[_0x5fdb('0x51')](_0x4af566);}})[_0x5fdb('0x27')](function(_0x4ccddc){if(_0x4ccddc){return _0x4ccddc?{'count':_0x5853b3,'rows':_0x4ccddc}:null;}})['then'](respondWithResult(_0x24e5cc,null))[_0x5fdb('0x44')](handleError(_0x24e5cc,null));};exports[_0x5fdb('0x53')]=function(_0x416bff,_0x342e89,_0x3eb66f){var _0x4fbf6a={};var _0x2ad4dd={};var _0x441f21;var _0xf69338;return db[_0x5fdb('0x3f')][_0x5fdb('0x52')]({'where':{'id':_0x416bff['params']['id']}})['then'](handleEntityNotFound(_0x342e89,null))[_0x5fdb('0x27')](function(_0x40aaee){if(_0x40aaee){_0x441f21=_0x40aaee;_0x2ad4dd[_0x5fdb('0x32')]=_['keys'](db[_0x5fdb('0x4d')][_0x5fdb('0x4e')]);_0x2ad4dd[_0x5fdb('0x33')]=_[_0x5fdb('0x34')](_0x416bff[_0x5fdb('0x33')]);_0x2ad4dd[_0x5fdb('0x35')]=_[_0x5fdb('0x36')](_0x2ad4dd[_0x5fdb('0x32')],_0x2ad4dd[_0x5fdb('0x33')]);_0x4fbf6a[_0x5fdb('0x38')]=_[_0x5fdb('0x36')](_0x2ad4dd[_0x5fdb('0x32')],qs['fields'](_0x416bff['query'][_0x5fdb('0x37')]));_0x4fbf6a['attributes']=_0x4fbf6a[_0x5fdb('0x38')][_0x5fdb('0x47')]?_0x4fbf6a[_0x5fdb('0x38')]:_0x2ad4dd[_0x5fdb('0x32')];_0x4fbf6a[_0x5fdb('0x3a')]=qs[_0x5fdb('0x3b')](_0x416bff[_0x5fdb('0x33')]['sort']);_0x4fbf6a[_0x5fdb('0x3c')]=qs['filters'](_[_0x5fdb('0x54')](_0x416bff['query'],_0x2ad4dd[_0x5fdb('0x35')]));if(_0x416bff['query']['filter']){_0x4fbf6a['where']=_[_0x5fdb('0x3d')](_0x4fbf6a[_0x5fdb('0x3c')],{'$or':_[_0x5fdb('0x2e')](_0x4fbf6a[_0x5fdb('0x38')],function(_0xe5b5f6){var _0x17df7f={};_0x17df7f[_0xe5b5f6]={'$like':'%'+_0x416bff[_0x5fdb('0x33')]['filter']+'%'};return _0x17df7f;})});}_0x4fbf6a=_[_0x5fdb('0x3d')]({},_0x4fbf6a,_0x416bff[_0x5fdb('0x48')]);return _0x441f21['getDescriptions'](_0x4fbf6a);}})['then'](function(_0x5ac433){if(_0x5ac433){_0xf69338=_0x5ac433['length'];if(!_0x416bff['query'][_0x5fdb('0x50')](_0x5fdb('0x39'))){_0x4fbf6a['limit']=qs[_0x5fdb('0x1e')](_0x416bff['query']['limit']);_0x4fbf6a[_0x5fdb('0x1d')]=qs['offset'](_0x416bff[_0x5fdb('0x33')]['offset']);}return _0x441f21[_0x5fdb('0x53')](_0x4fbf6a);}})['then'](function(_0xff34bc){if(_0xff34bc){return _0xff34bc?{'count':_0xf69338,'rows':_0xff34bc}:null;}})[_0x5fdb('0x27')](respondWithResult(_0x342e89,null))[_0x5fdb('0x44')](handleError(_0x342e89,null));};exports['getTags']=function(_0xb5420b,_0x1fc711,_0x233f45){var _0x3cafab={};var _0x2138fe={};var _0x5d8d81;var _0x1625b2;return db[_0x5fdb('0x3f')][_0x5fdb('0x52')]({'where':{'id':_0xb5420b[_0x5fdb('0x46')]['id']}})[_0x5fdb('0x27')](handleEntityNotFound(_0x1fc711,null))['then'](function(_0x336392){if(_0x336392){_0x5d8d81=_0x336392;_0x2138fe[_0x5fdb('0x32')]=_[_0x5fdb('0x34')](db[_0x5fdb('0x55')][_0x5fdb('0x4e')]);_0x2138fe[_0x5fdb('0x33')]=_[_0x5fdb('0x34')](_0xb5420b[_0x5fdb('0x33')]);_0x2138fe[_0x5fdb('0x35')]=_[_0x5fdb('0x36')](_0x2138fe[_0x5fdb('0x32')],_0x2138fe[_0x5fdb('0x33')]);_0x3cafab[_0x5fdb('0x38')]=_[_0x5fdb('0x36')](_0x2138fe[_0x5fdb('0x32')],qs[_0x5fdb('0x37')](_0xb5420b[_0x5fdb('0x33')][_0x5fdb('0x37')]));_0x3cafab[_0x5fdb('0x38')]=_0x3cafab[_0x5fdb('0x38')][_0x5fdb('0x47')]?_0x3cafab[_0x5fdb('0x38')]:_0x2138fe[_0x5fdb('0x32')];_0x3cafab[_0x5fdb('0x3a')]=qs[_0x5fdb('0x3b')](_0xb5420b[_0x5fdb('0x33')][_0x5fdb('0x3b')]);_0x3cafab[_0x5fdb('0x3c')]=qs['filters'](_[_0x5fdb('0x54')](_0xb5420b[_0x5fdb('0x33')],_0x2138fe[_0x5fdb('0x35')]));if(_0xb5420b[_0x5fdb('0x33')][_0x5fdb('0x4f')]){_0x3cafab[_0x5fdb('0x3c')]=_['merge'](_0x3cafab[_0x5fdb('0x3c')],{'$or':_[_0x5fdb('0x2e')](_0x3cafab[_0x5fdb('0x38')],function(_0x193af5){var _0xa375c9={};_0xa375c9[_0x193af5]={'$like':'%'+_0xb5420b[_0x5fdb('0x33')][_0x5fdb('0x4f')]+'%'};return _0xa375c9;})});}_0x3cafab=_['merge']({},_0x3cafab,_0xb5420b[_0x5fdb('0x48')]);return _0x5d8d81[_0x5fdb('0x56')](_0x3cafab);}})[_0x5fdb('0x27')](function(_0x44a616){if(_0x44a616){_0x1625b2=_0x44a616[_0x5fdb('0x47')];if(!_0xb5420b[_0x5fdb('0x33')][_0x5fdb('0x50')](_0x5fdb('0x39'))){_0x3cafab[_0x5fdb('0x1e')]=qs[_0x5fdb('0x1e')](_0xb5420b[_0x5fdb('0x33')][_0x5fdb('0x1e')]);_0x3cafab[_0x5fdb('0x1d')]=qs['offset'](_0xb5420b[_0x5fdb('0x33')]['offset']);}return _0x5d8d81[_0x5fdb('0x56')](_0x3cafab);}})[_0x5fdb('0x27')](function(_0x185d7d){if(_0x185d7d){return _0x185d7d?{'count':_0x1625b2,'rows':_0x185d7d}:null;}})['then'](respondWithResult(_0x1fc711,null))['catch'](handleError(_0x1fc711,null));};exports[_0x5fdb('0x57')]=function(_0x3248d8,_0x3d05a4,_0x537f55){if(_0x3248d8['body']['id']){delete _0x3248d8[_0x5fdb('0x4b')]['id'];}return db[_0x5fdb('0x3f')][_0x5fdb('0x52')]({'where':{'id':_0x3248d8[_0x5fdb('0x46')]['id']}})[_0x5fdb('0x27')](handleEntityNotFound(_0x3d05a4,null))['then'](function(_0x41b0ae){if(_0x41b0ae){return _0x41b0ae['setTags'](_0x3248d8[_0x5fdb('0x4b')][_0x5fdb('0x58')]||[]);}return null;})[_0x5fdb('0x27')](respondWithResult(_0x3d05a4,null))[_0x5fdb('0x44')](handleError(_0x3d05a4,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 47ba59c..f635312 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 _0xf7b4=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','api','moment'];(function(_0x3b53eb,_0xa95976){var _0x4166ce=function(_0x4a2a3d){while(--_0x4a2a3d){_0x3b53eb['push'](_0x3b53eb['shift']());}};_0x4166ce(++_0xa95976);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4d95d9,_0x278833){_0x4d95d9=_0x4d95d9-0x0;var _0x4685e6=_0xf7b4[_0x4d95d9];return _0x4685e6;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4f7b('0x1'));var moment=require(_0x4f7b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f7b('0x3'));var rimraf=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var attributes=require(_0x4f7b('0x6'));module[_0x4f7b('0x7')]=function(_0x2637f0,_0x427f8b){return _0x2637f0[_0x4f7b('0x8')](_0x4f7b('0x9'),attributes,{'tableName':_0x4f7b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cb4=['bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0xb50637,_0x33070e){var _0x150a7d=function(_0xc372ab){while(--_0xc372ab){_0xb50637['push'](_0xb50637['shift']());}};_0x150a7d(++_0x33070e);}(_0x6cb4,0xff));var _0x46cb=function(_0x31fdc1,_0x370a21){_0x31fdc1=_0x31fdc1-0x0;var _0xd65dd0=_0x6cb4[_0x31fdc1];return _0xd65dd0;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var logger=require(_0x46cb('0x2'))(_0x46cb('0x3'));var moment=require(_0x46cb('0x4'));var BPromise=require(_0x46cb('0x5'));var rp=require(_0x46cb('0x6'));var fs=require('fs');var path=require(_0x46cb('0x7'));var rimraf=require(_0x46cb('0x8'));var config=require('../../config/environment');var attributes=require(_0x46cb('0x9'));module['exports']=function(_0x3d9d3c,_0x4d9f1d){return _0x3d9d3c[_0x46cb('0xa')](_0x46cb('0xb'),attributes,{'tableName':_0x46cb('0xc'),'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 1e23edd..849c90d 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 _0xa526=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b5b2c,_0x959245){var _0x5e9e5f=function(_0x347508){while(--_0x347508){_0x1b5b2c['push'](_0x1b5b2c['shift']());}};_0x5e9e5f(++_0x959245);}(_0xa526,0x143));var _0x6a52=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0xa526[_0x2543d6];return _0x55213c;};'use strict';var _=require(_0x6a52('0x0'));var util=require(_0x6a52('0x1'));var moment=require(_0x6a52('0x2'));var BPromise=require(_0x6a52('0x3'));var rs=require(_0x6a52('0x4'));var fs=require('fs');var Redis=require(_0x6a52('0x5'));var db=require(_0x6a52('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a52('0x7'))(_0x6a52('0x8'));var config=require(_0x6a52('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ccd74,_0x55dac6,_0x55a63b){return new BPromise(function(_0x49b8ff,_0x1bfcbd){return client[_0x6a52('0xa')](_0x3ccd74,_0x55a63b)['then'](function(_0x514918){logger[_0x6a52('0xb')](_0x6a52('0xc'),_0x55dac6,_0x6a52('0xd'));logger[_0x6a52('0xe')](_0x6a52('0xf'),_0x55dac6,_0x6a52('0xd'),JSON[_0x6a52('0x10')](_0x514918));if(_0x514918['error']){if(_0x514918['error']['code']===0x1f4){logger[_0x6a52('0x11')](_0x6a52('0xc'),_0x55dac6,_0x514918['error'][_0x6a52('0x12')]);return _0x1bfcbd(_0x514918[_0x6a52('0x11')][_0x6a52('0x12')]);}logger['error'](_0x6a52('0xc'),_0x55dac6,_0x514918[_0x6a52('0x11')][_0x6a52('0x12')]);return _0x49b8ff(_0x514918[_0x6a52('0x11')]['message']);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x55dac6,_0x6a52('0xd'));_0x49b8ff(_0x514918['result'][_0x6a52('0x12')]);}})[_0x6a52('0x13')](function(_0x4db80e){logger[_0x6a52('0x11')](_0x6a52('0xc'),_0x55dac6,_0x4db80e);_0x1bfcbd(_0x4db80e);});});} \ No newline at end of file +var _0x4841=['debug','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x3dfadf,_0x5a6438){var _0x13ef62=function(_0x3c593a){while(--_0x3c593a){_0x3dfadf['push'](_0x3dfadf['shift']());}};_0x13ef62(++_0x5a6438);}(_0x4841,0xcc));var _0x1484=function(_0x2bca56,_0x12fb82){_0x2bca56=_0x2bca56-0x0;var _0x13e567=_0x4841[_0x2bca56];return _0x13e567;};'use strict';var _=require(_0x1484('0x0'));var util=require('util');var moment=require(_0x1484('0x1'));var BPromise=require('bluebird');var rs=require(_0x1484('0x2'));var fs=require('fs');var Redis=require(_0x1484('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1484('0x4'))('rpc');var config=require(_0x1484('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1484('0x6')][_0x1484('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f6323,_0x54f17c,_0x3d37b8){return new BPromise(function(_0x324c45,_0xb82966){return client['request'](_0x1f6323,_0x3d37b8)[_0x1484('0x8')](function(_0x248616){logger[_0x1484('0x9')](_0x1484('0xa'),_0x54f17c,_0x1484('0xb'));logger[_0x1484('0xc')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x54f17c,_0x1484('0xb'),JSON[_0x1484('0xd')](_0x248616));if(_0x248616[_0x1484('0xe')]){if(_0x248616[_0x1484('0xe')][_0x1484('0xf')]===0x1f4){logger[_0x1484('0xe')](_0x1484('0xa'),_0x54f17c,_0x248616[_0x1484('0xe')][_0x1484('0x10')]);return _0xb82966(_0x248616[_0x1484('0xe')]['message']);}logger[_0x1484('0xe')](_0x1484('0xa'),_0x54f17c,_0x248616[_0x1484('0xe')][_0x1484('0x10')]);return _0x324c45(_0x248616[_0x1484('0xe')][_0x1484('0x10')]);}else{logger[_0x1484('0x9')](_0x1484('0xa'),_0x54f17c,_0x1484('0xb'));_0x324c45(_0x248616[_0x1484('0x11')][_0x1484('0x10')]);}})['catch'](function(_0x5f15e9){logger[_0x1484('0xe')](_0x1484('0xa'),_0x54f17c,_0x5f15e9);_0xb82966(_0x5f15e9);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 2efd464..d2c0055 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 _0x18de=['isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','show','post','/:id'];(function(_0x2e4f89,_0xd6044){var _0x527fa1=function(_0x32b8de){while(--_0x32b8de){_0x2e4f89['push'](_0x2e4f89['shift']());}};_0x527fa1(++_0xd6044);}(_0x18de,0x1eb));var _0xe18d=function(_0x57b128,_0x15bf85){_0x57b128=_0x57b128-0x0;var _0x8fe81f=_0x18de[_0x57b128];return _0x8fe81f;};'use strict';var multer=require(_0xe18d('0x0'));var util=require(_0xe18d('0x1'));var path=require(_0xe18d('0x2'));var timeout=require(_0xe18d('0x3'));var express=require(_0xe18d('0x4'));var router=express['Router']();var fs_extra=require(_0xe18d('0x5'));var auth=require(_0xe18d('0x6'));var interaction=require(_0xe18d('0x7'));var config=require(_0xe18d('0x8'));var controller=require('./intZendeskField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe18d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe18d('0xa')]);router[_0xe18d('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xe18d('0xc'),auth[_0xe18d('0xd')](),controller[_0xe18d('0xe')]);router[_0xe18d('0xf')]('/:id',auth[_0xe18d('0xd')](),controller[_0xe18d('0x10')]);module[_0xe18d('0x11')]=router; \ No newline at end of file +var _0x88e8=['create','put','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x88e8,0x180));var _0x888e=function(_0x2027f5,_0x5a68c1){_0x2027f5=_0x2027f5-0x0;var _0x346d21=_0x88e8[_0x2027f5];return _0x346d21;};'use strict';var multer=require(_0x888e('0x0'));var util=require(_0x888e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x888e('0x2'));var router=express[_0x888e('0x3')]();var fs_extra=require(_0x888e('0x4'));var auth=require(_0x888e('0x5'));var interaction=require(_0x888e('0x6'));var config=require(_0x888e('0x7'));var controller=require(_0x888e('0x8'));router[_0x888e('0x9')]('/',auth[_0x888e('0xa')](),controller[_0x888e('0xb')]);router[_0x888e('0x9')](_0x888e('0xc'),auth[_0x888e('0xa')](),controller[_0x888e('0xd')]);router[_0x888e('0xe')]('/',auth[_0x888e('0xa')](),controller[_0x888e('0xf')]);router[_0x888e('0x10')]('/:id',auth[_0x888e('0xa')](),controller['update']);router[_0x888e('0x11')](_0x888e('0xc'),auth[_0x888e('0xa')](),controller[_0x888e('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 1f63fdf..1864091 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 _0x5fd8=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x5fd8,0xcd));var _0x85fd=function(_0x1593bb,_0x49383e){_0x1593bb=_0x1593bb-0x0;var _0x4acf02=_0x5fd8[_0x1593bb];return _0x4acf02;};'use strict';var Sequelize=require(_0x85fd('0x0'));module[_0x85fd('0x1')]={'type':{'type':Sequelize[_0x85fd('0x2')](_0x85fd('0x3'),_0x85fd('0x4'),_0x85fd('0x5'),_0x85fd('0x6'),_0x85fd('0x7')),'defaultValue':_0x85fd('0x3')},'content':{'type':Sequelize[_0x85fd('0x8')]},'key':{'type':Sequelize[_0x85fd('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x85fd('0x3'),_0x85fd('0x4'),_0x85fd('0x5'))},'keyContent':{'type':Sequelize[_0x85fd('0x8')]},'idField':{'type':Sequelize[_0x85fd('0x8')]},'nameField':{'type':Sequelize[_0x85fd('0x8')]},'customField':{'type':Sequelize[_0x85fd('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x85fd('0x8')]}}; \ No newline at end of file +var _0x5d7a=['sequelize','exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN'];(function(_0x2d1a97,_0x47de45){var _0x3f6601=function(_0x524733){while(--_0x524733){_0x2d1a97['push'](_0x2d1a97['shift']());}};_0x3f6601(++_0x47de45);}(_0x5d7a,0xc8));var _0xa5d7=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5d7a[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xa5d7('0x0'));module[_0xa5d7('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa5d7('0x2'),'variable',_0xa5d7('0x3'),_0xa5d7('0x4'),_0xa5d7('0x5')),'defaultValue':_0xa5d7('0x2')},'content':{'type':Sequelize[_0xa5d7('0x6')]},'key':{'type':Sequelize[_0xa5d7('0x6')]},'keyType':{'type':Sequelize[_0xa5d7('0x7')](_0xa5d7('0x2'),_0xa5d7('0x8'),_0xa5d7('0x3'))},'keyContent':{'type':Sequelize[_0xa5d7('0x6')]},'idField':{'type':Sequelize[_0xa5d7('0x6')]},'nameField':{'type':Sequelize[_0xa5d7('0x6')]},'customField':{'type':Sequelize[_0xa5d7('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa5d7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 0b49b03..dc157e2 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 _0xbacf=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','sendStatus','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','attributes'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xbacf,0xf9));var _0xfbac=function(_0x1b1f88,_0x3fe1cb){_0x1b1f88=_0x1b1f88-0x0;var _0x5045b9=_0xbacf[_0x1b1f88];return _0x5045b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfbac('0x0'));var zipdir=require(_0xfbac('0x1'));var jsonpatch=require(_0xfbac('0x2'));var rp=require(_0xfbac('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfbac('0x4'));var path=require(_0xfbac('0x5'));var sox=require(_0xfbac('0x6'));var csv=require(_0xfbac('0x7'));var ejs=require(_0xfbac('0x8'));var fs=require('fs');var fs_extra=require(_0xfbac('0x9'));var _=require(_0xfbac('0xa'));var squel=require(_0xfbac('0xb'));var crypto=require('crypto');var jsforce=require(_0xfbac('0xc'));var deskjs=require(_0xfbac('0xd'));var toCsv=require(_0xfbac('0x7'));var querystring=require(_0xfbac('0xe'));var Papa=require(_0xfbac('0xf'));var Redis=require(_0xfbac('0x10'));var authService=require(_0xfbac('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfbac('0x12'));var hardwareService=require(_0xfbac('0x13'));var logger=require(_0xfbac('0x14'))(_0xfbac('0x15'));var utils=require(_0xfbac('0x16'));var config=require(_0xfbac('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfbac('0x18'))['db'];function respondWithStatusCode(_0x4a064f,_0x428383){_0x428383=_0x428383||0xcc;return function(_0x32eb83){if(_0x32eb83){return _0x4a064f['sendStatus'](_0x428383);}return _0x4a064f[_0xfbac('0x19')](_0x428383)['end']();};}function respondWithResult(_0x3d6a2a,_0x352949){_0x352949=_0x352949||0xc8;return function(_0x4bca33){if(_0x4bca33){return _0x3d6a2a[_0xfbac('0x19')](_0x352949)[_0xfbac('0x1a')](_0x4bca33);}};}function respondWithFilteredResult(_0x332f65,_0x5e33b6){return function(_0x47677e){if(_0x47677e){var _0x2ff9f0=typeof _0x5e33b6[_0xfbac('0x1b')]===_0xfbac('0x1c')&&typeof _0x5e33b6[_0xfbac('0x1d')]===_0xfbac('0x1c');var _0x599308=_0x47677e['count'];var _0x102efe=_0x2ff9f0?0x0:_0x5e33b6['offset'];var _0x204e08=_0x2ff9f0?_0x47677e[_0xfbac('0x1e')]:_0x5e33b6[_0xfbac('0x1b')]+_0x5e33b6['limit'];var _0xf00f57;if(_0x204e08>=_0x599308){_0x204e08=_0x599308;_0xf00f57=0xc8;}else{_0xf00f57=0xce;}_0x332f65[_0xfbac('0x19')](_0xf00f57);return _0x332f65[_0xfbac('0x1f')](_0xfbac('0x20'),_0x102efe+'-'+_0x204e08+'/'+_0x599308)[_0xfbac('0x1a')](_0x47677e);}return null;};}function patchUpdates(_0xbd964){return function(_0x15dbb8){try{jsonpatch['apply'](_0x15dbb8,_0xbd964,!![]);}catch(_0x2b17b8){return BPromise['reject'](_0x2b17b8);}return _0x15dbb8[_0xfbac('0x21')]();};}function saveUpdates(_0x1219bd,_0x12e56b){return function(_0x30ffa5){if(_0x30ffa5){return _0x30ffa5['update'](_0x1219bd)[_0xfbac('0x22')](function(_0x415eb3){return _0x415eb3;});}return null;};}function removeEntity(_0x4c535c,_0x15ac9a){return function(_0x27cf5e){if(_0x27cf5e){return _0x27cf5e[_0xfbac('0x23')]()[_0xfbac('0x22')](function(){_0x4c535c[_0xfbac('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fc2fc,_0x4b3ef2){return function(_0x57f276){if(!_0x57f276){_0x1fc2fc[_0xfbac('0x24')](0x194);}return _0x57f276;};}function handleError(_0x486108,_0x52a31e){_0x52a31e=_0x52a31e||0x1f4;return function(_0x18831c){logger['error'](_0x18831c[_0xfbac('0x25')]);if(_0x18831c[_0xfbac('0x26')]){delete _0x18831c[_0xfbac('0x26')];}_0x486108['status'](_0x52a31e)[_0xfbac('0x27')](_0x18831c);};}exports[_0xfbac('0x28')]=function(_0x30dd0b,_0x44ffeb){var _0x17b7a9={},_0x470bbc={},_0x34224d={'count':0x0,'rows':[]};var _0x3c806b=_[_0xfbac('0x29')](db[_0xfbac('0x2a')][_0xfbac('0x2b')],function(_0xf008e7){return{'name':_0xf008e7[_0xfbac('0x2c')],'type':_0xf008e7[_0xfbac('0x2d')][_0xfbac('0x2e')]};});_0x470bbc[_0xfbac('0x2f')]=_['map'](_0x3c806b,'name');_0x470bbc[_0xfbac('0x30')]=_['keys'](_0x30dd0b[_0xfbac('0x30')]);_0x470bbc[_0xfbac('0x31')]=_['intersection'](_0x470bbc[_0xfbac('0x2f')],_0x470bbc[_0xfbac('0x30')]);_0x17b7a9[_0xfbac('0x32')]=_[_0xfbac('0x33')](_0x470bbc['model'],qs['fields'](_0x30dd0b[_0xfbac('0x30')][_0xfbac('0x34')]));_0x17b7a9['attributes']=_0x17b7a9[_0xfbac('0x32')][_0xfbac('0x35')]?_0x17b7a9[_0xfbac('0x32')]:_0x470bbc[_0xfbac('0x2f')];if(!_0x30dd0b[_0xfbac('0x30')][_0xfbac('0x36')](_0xfbac('0x37'))){_0x17b7a9[_0xfbac('0x1d')]=qs[_0xfbac('0x1d')](_0x30dd0b[_0xfbac('0x30')]['limit']);_0x17b7a9[_0xfbac('0x1b')]=qs['offset'](_0x30dd0b[_0xfbac('0x30')][_0xfbac('0x1b')]);}_0x17b7a9[_0xfbac('0x38')]=qs[_0xfbac('0x39')](_0x30dd0b[_0xfbac('0x30')][_0xfbac('0x39')]);_0x17b7a9[_0xfbac('0x3a')]=qs[_0xfbac('0x31')](_['pick'](_0x30dd0b[_0xfbac('0x30')],_0x470bbc[_0xfbac('0x31')]),_0x3c806b);if(_0x30dd0b[_0xfbac('0x30')]['filter']){_0x17b7a9[_0xfbac('0x3a')]=_[_0xfbac('0x3b')](_0x17b7a9[_0xfbac('0x3a')],{'$or':_[_0xfbac('0x29')](_0x3c806b,function(_0x348273){if(_0x348273[_0xfbac('0x2d')]!==_0xfbac('0x3c')){var _0x2ac26f={};_0x2ac26f[_0x348273[_0xfbac('0x26')]]={'$like':'%'+_0x30dd0b[_0xfbac('0x30')][_0xfbac('0x3d')]+'%'};return _0x2ac26f;}})});}_0x17b7a9=_[_0xfbac('0x3b')]({},_0x17b7a9,_0x30dd0b[_0xfbac('0x3e')]);var _0x4ff06f={'where':_0x17b7a9['where']};return db['ZendeskField']['count'](_0x4ff06f)[_0xfbac('0x22')](function(_0x59a133){_0x34224d[_0xfbac('0x1e')]=_0x59a133;if(_0x30dd0b[_0xfbac('0x30')][_0xfbac('0x3f')]){_0x17b7a9[_0xfbac('0x40')]=[{'all':!![]}];}return db[_0xfbac('0x2a')][_0xfbac('0x41')](_0x17b7a9);})[_0xfbac('0x22')](function(_0x2e65d4){_0x34224d[_0xfbac('0x42')]=_0x2e65d4;return _0x34224d;})[_0xfbac('0x22')](respondWithFilteredResult(_0x44ffeb,_0x17b7a9))[_0xfbac('0x43')](handleError(_0x44ffeb,null));};exports[_0xfbac('0x44')]=function(_0x389e79,_0x51ef58){var _0x3b4c98={'raw':!![],'where':{'id':_0x389e79[_0xfbac('0x45')]['id']}},_0x21c3d1={};_0x21c3d1[_0xfbac('0x2f')]=_[_0xfbac('0x46')](db[_0xfbac('0x2a')][_0xfbac('0x2b')]);_0x21c3d1[_0xfbac('0x30')]=_[_0xfbac('0x46')](_0x389e79['query']);_0x21c3d1['filters']=_[_0xfbac('0x33')](_0x21c3d1[_0xfbac('0x2f')],_0x21c3d1[_0xfbac('0x30')]);_0x3b4c98[_0xfbac('0x32')]=_[_0xfbac('0x33')](_0x21c3d1[_0xfbac('0x2f')],qs[_0xfbac('0x34')](_0x389e79['query'][_0xfbac('0x34')]));_0x3b4c98['attributes']=_0x3b4c98[_0xfbac('0x32')][_0xfbac('0x35')]?_0x3b4c98[_0xfbac('0x32')]:_0x21c3d1[_0xfbac('0x2f')];if(_0x389e79['query'][_0xfbac('0x3f')]){_0x3b4c98[_0xfbac('0x40')]=[{'all':!![]}];}_0x3b4c98=_['merge']({},_0x3b4c98,_0x389e79['options']);return db['ZendeskField'][_0xfbac('0x47')](_0x3b4c98)[_0xfbac('0x22')](handleEntityNotFound(_0x51ef58,null))[_0xfbac('0x22')](respondWithResult(_0x51ef58,null))['catch'](handleError(_0x51ef58,null));};exports[_0xfbac('0x48')]=function(_0x1a2cc6,_0x1fd953){return db[_0xfbac('0x2a')][_0xfbac('0x48')](_0x1a2cc6[_0xfbac('0x49')],{})['then'](respondWithResult(_0x1fd953,0xc9))[_0xfbac('0x43')](handleError(_0x1fd953,null));};exports[_0xfbac('0x4a')]=function(_0x2e8296,_0x10e573){if(_0x2e8296[_0xfbac('0x49')]['id']){delete _0x2e8296[_0xfbac('0x49')]['id'];}return db[_0xfbac('0x2a')][_0xfbac('0x47')]({'where':{'id':_0x2e8296['params']['id']}})['then'](handleEntityNotFound(_0x10e573,null))['then'](saveUpdates(_0x2e8296[_0xfbac('0x49')],null))[_0xfbac('0x22')](respondWithResult(_0x10e573,null))['catch'](handleError(_0x10e573,null));};exports[_0xfbac('0x23')]=function(_0xfda925,_0x1e01e6){return db[_0xfbac('0x2a')][_0xfbac('0x47')]({'where':{'id':_0xfda925[_0xfbac('0x45')]['id']}})[_0xfbac('0x22')](handleEntityNotFound(_0x1e01e6,null))[_0xfbac('0x22')](removeEntity(_0x1e01e6,null))[_0xfbac('0x43')](handleError(_0x1e01e6,null));}; \ No newline at end of file +var _0x1a52=['status','json','undefined','limit','count','offset','apply','reject','save','then','destroy','end','error','name','send','index','map','ZendeskField','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','include','find','catch','create','body','update','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xf4db42,_0x298e17){var _0xd8e9eb=function(_0x166ff1){while(--_0x166ff1){_0xf4db42['push'](_0xf4db42['shift']());}};_0xd8e9eb(++_0x298e17);}(_0x1a52,0x115));var _0x21a5=function(_0x3688ff,_0x313036){_0x3688ff=_0x3688ff-0x0;var _0x45b246=_0x1a52[_0x3688ff];return _0x45b246;};'use strict';var emlformat=require(_0x21a5('0x0'));var rimraf=require(_0x21a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x21a5('0x2'));var moment=require(_0x21a5('0x3'));var BPromise=require(_0x21a5('0x4'));var Mustache=require(_0x21a5('0x5'));var util=require(_0x21a5('0x6'));var path=require(_0x21a5('0x7'));var sox=require(_0x21a5('0x8'));var csv=require(_0x21a5('0x9'));var ejs=require(_0x21a5('0xa'));var fs=require('fs');var fs_extra=require(_0x21a5('0xb'));var _=require(_0x21a5('0xc'));var squel=require(_0x21a5('0xd'));var crypto=require(_0x21a5('0xe'));var jsforce=require(_0x21a5('0xf'));var deskjs=require(_0x21a5('0x10'));var toCsv=require(_0x21a5('0x9'));var querystring=require(_0x21a5('0x11'));var Papa=require(_0x21a5('0x12'));var Redis=require(_0x21a5('0x13'));var authService=require(_0x21a5('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x21a5('0x15'));var hardwareService=require(_0x21a5('0x16'));var logger=require(_0x21a5('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x21a5('0x18'));var db=require(_0x21a5('0x19'))['db'];function respondWithStatusCode(_0x502fd5,_0x26016c){_0x26016c=_0x26016c||0xcc;return function(_0xb0fbcc){if(_0xb0fbcc){return _0x502fd5[_0x21a5('0x1a')](_0x26016c);}return _0x502fd5[_0x21a5('0x1b')](_0x26016c)['end']();};}function respondWithResult(_0x286b9e,_0x352916){_0x352916=_0x352916||0xc8;return function(_0x199c11){if(_0x199c11){return _0x286b9e['status'](_0x352916)[_0x21a5('0x1c')](_0x199c11);}};}function respondWithFilteredResult(_0x96fb39,_0x53c545){return function(_0x1ee4db){if(_0x1ee4db){var _0x413a83=typeof _0x53c545['offset']===_0x21a5('0x1d')&&typeof _0x53c545[_0x21a5('0x1e')]==='undefined';var _0x179444=_0x1ee4db[_0x21a5('0x1f')];var _0x43585f=_0x413a83?0x0:_0x53c545[_0x21a5('0x20')];var _0x36ddb9=_0x413a83?_0x1ee4db[_0x21a5('0x1f')]:_0x53c545[_0x21a5('0x20')]+_0x53c545[_0x21a5('0x1e')];var _0x2c60be;if(_0x36ddb9>=_0x179444){_0x36ddb9=_0x179444;_0x2c60be=0xc8;}else{_0x2c60be=0xce;}_0x96fb39[_0x21a5('0x1b')](_0x2c60be);return _0x96fb39['set']('Content-Range',_0x43585f+'-'+_0x36ddb9+'/'+_0x179444)[_0x21a5('0x1c')](_0x1ee4db);}return null;};}function patchUpdates(_0x2ab1c7){return function(_0x630e14){try{jsonpatch[_0x21a5('0x21')](_0x630e14,_0x2ab1c7,!![]);}catch(_0x4e855b){return BPromise[_0x21a5('0x22')](_0x4e855b);}return _0x630e14[_0x21a5('0x23')]();};}function saveUpdates(_0x47623a,_0x4b2a0e){return function(_0x367c2d){if(_0x367c2d){return _0x367c2d['update'](_0x47623a)[_0x21a5('0x24')](function(_0x495186){return _0x495186;});}return null;};}function removeEntity(_0x4a4ea0,_0x5f37e4){return function(_0x1eb288){if(_0x1eb288){return _0x1eb288[_0x21a5('0x25')]()['then'](function(){_0x4a4ea0['status'](0xcc)[_0x21a5('0x26')]();});}};}function handleEntityNotFound(_0x2c5533,_0x48e44c){return function(_0x38661c){if(!_0x38661c){_0x2c5533[_0x21a5('0x1a')](0x194);}return _0x38661c;};}function handleError(_0x1d5c20,_0x2e27aa){_0x2e27aa=_0x2e27aa||0x1f4;return function(_0x4c9d27){logger[_0x21a5('0x27')](_0x4c9d27['stack']);if(_0x4c9d27[_0x21a5('0x28')]){delete _0x4c9d27[_0x21a5('0x28')];}_0x1d5c20['status'](_0x2e27aa)[_0x21a5('0x29')](_0x4c9d27);};}exports[_0x21a5('0x2a')]=function(_0x43f8df,_0x120c86){var _0x6ca47f={},_0x12a021={},_0x208b28={'count':0x0,'rows':[]};var _0x1030ef=_[_0x21a5('0x2b')](db[_0x21a5('0x2c')][_0x21a5('0x2d')],function(_0x124f30){return{'name':_0x124f30['fieldName'],'type':_0x124f30[_0x21a5('0x2e')][_0x21a5('0x2f')]};});_0x12a021[_0x21a5('0x30')]=_[_0x21a5('0x2b')](_0x1030ef,_0x21a5('0x28'));_0x12a021['query']=_[_0x21a5('0x31')](_0x43f8df['query']);_0x12a021[_0x21a5('0x32')]=_[_0x21a5('0x33')](_0x12a021[_0x21a5('0x30')],_0x12a021[_0x21a5('0x34')]);_0x6ca47f[_0x21a5('0x35')]=_[_0x21a5('0x33')](_0x12a021[_0x21a5('0x30')],qs[_0x21a5('0x36')](_0x43f8df['query']['fields']));_0x6ca47f[_0x21a5('0x35')]=_0x6ca47f[_0x21a5('0x35')][_0x21a5('0x37')]?_0x6ca47f[_0x21a5('0x35')]:_0x12a021[_0x21a5('0x30')];if(!_0x43f8df[_0x21a5('0x34')][_0x21a5('0x38')](_0x21a5('0x39'))){_0x6ca47f[_0x21a5('0x1e')]=qs[_0x21a5('0x1e')](_0x43f8df[_0x21a5('0x34')][_0x21a5('0x1e')]);_0x6ca47f[_0x21a5('0x20')]=qs['offset'](_0x43f8df['query']['offset']);}_0x6ca47f[_0x21a5('0x3a')]=qs[_0x21a5('0x3b')](_0x43f8df[_0x21a5('0x34')][_0x21a5('0x3b')]);_0x6ca47f[_0x21a5('0x3c')]=qs[_0x21a5('0x32')](_[_0x21a5('0x3d')](_0x43f8df[_0x21a5('0x34')],_0x12a021[_0x21a5('0x32')]),_0x1030ef);if(_0x43f8df[_0x21a5('0x34')][_0x21a5('0x3e')]){_0x6ca47f['where']=_[_0x21a5('0x3f')](_0x6ca47f[_0x21a5('0x3c')],{'$or':_[_0x21a5('0x2b')](_0x1030ef,function(_0x2c6b26){if(_0x2c6b26[_0x21a5('0x2e')]!==_0x21a5('0x40')){var _0x21a3bf={};_0x21a3bf[_0x2c6b26['name']]={'$like':'%'+_0x43f8df['query'][_0x21a5('0x3e')]+'%'};return _0x21a3bf;}})});}_0x6ca47f=_[_0x21a5('0x3f')]({},_0x6ca47f,_0x43f8df[_0x21a5('0x41')]);var _0x40781c={'where':_0x6ca47f[_0x21a5('0x3c')]};return db['ZendeskField'][_0x21a5('0x1f')](_0x40781c)[_0x21a5('0x24')](function(_0x329925){_0x208b28[_0x21a5('0x1f')]=_0x329925;if(_0x43f8df[_0x21a5('0x34')]['includeAll']){_0x6ca47f['include']=[{'all':!![]}];}return db['ZendeskField'][_0x21a5('0x42')](_0x6ca47f);})[_0x21a5('0x24')](function(_0x225113){_0x208b28[_0x21a5('0x43')]=_0x225113;return _0x208b28;})['then'](respondWithFilteredResult(_0x120c86,_0x6ca47f))['catch'](handleError(_0x120c86,null));};exports[_0x21a5('0x44')]=function(_0x553dfb,_0x3c0c24){var _0x1b4a13={'raw':!![],'where':{'id':_0x553dfb[_0x21a5('0x45')]['id']}},_0x47f2be={};_0x47f2be[_0x21a5('0x30')]=_['keys'](db[_0x21a5('0x2c')][_0x21a5('0x2d')]);_0x47f2be[_0x21a5('0x34')]=_[_0x21a5('0x31')](_0x553dfb['query']);_0x47f2be[_0x21a5('0x32')]=_[_0x21a5('0x33')](_0x47f2be[_0x21a5('0x30')],_0x47f2be[_0x21a5('0x34')]);_0x1b4a13[_0x21a5('0x35')]=_[_0x21a5('0x33')](_0x47f2be['model'],qs[_0x21a5('0x36')](_0x553dfb[_0x21a5('0x34')][_0x21a5('0x36')]));_0x1b4a13['attributes']=_0x1b4a13['attributes'][_0x21a5('0x37')]?_0x1b4a13[_0x21a5('0x35')]:_0x47f2be['model'];if(_0x553dfb[_0x21a5('0x34')]['includeAll']){_0x1b4a13[_0x21a5('0x46')]=[{'all':!![]}];}_0x1b4a13=_[_0x21a5('0x3f')]({},_0x1b4a13,_0x553dfb[_0x21a5('0x41')]);return db['ZendeskField'][_0x21a5('0x47')](_0x1b4a13)[_0x21a5('0x24')](handleEntityNotFound(_0x3c0c24,null))[_0x21a5('0x24')](respondWithResult(_0x3c0c24,null))[_0x21a5('0x48')](handleError(_0x3c0c24,null));};exports['create']=function(_0x13d494,_0x4d6aea){return db[_0x21a5('0x2c')][_0x21a5('0x49')](_0x13d494[_0x21a5('0x4a')],{})[_0x21a5('0x24')](respondWithResult(_0x4d6aea,0xc9))[_0x21a5('0x48')](handleError(_0x4d6aea,null));};exports[_0x21a5('0x4b')]=function(_0x3a6036,_0x539afa){if(_0x3a6036['body']['id']){delete _0x3a6036[_0x21a5('0x4a')]['id'];}return db[_0x21a5('0x2c')]['find']({'where':{'id':_0x3a6036[_0x21a5('0x45')]['id']}})[_0x21a5('0x24')](handleEntityNotFound(_0x539afa,null))[_0x21a5('0x24')](saveUpdates(_0x3a6036[_0x21a5('0x4a')],null))[_0x21a5('0x24')](respondWithResult(_0x539afa,null))['catch'](handleError(_0x539afa,null));};exports[_0x21a5('0x25')]=function(_0x25e276,_0x5ee7a9){return db[_0x21a5('0x2c')][_0x21a5('0x47')]({'where':{'id':_0x25e276['params']['id']}})[_0x21a5('0x24')](handleEntityNotFound(_0x5ee7a9,null))[_0x21a5('0x24')](removeEntity(_0x5ee7a9,null))[_0x21a5('0x48')](handleError(_0x5ee7a9,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 9f038a5..d973447 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 _0xa15c=['moment','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x22cf62,_0x538a68){var _0x2e47ae=function(_0x307542){while(--_0x307542){_0x22cf62['push'](_0x22cf62['shift']());}};_0x2e47ae(++_0x538a68);}(_0xa15c,0x6d));var _0xca15=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa15c[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xca15('0x0'));var util=require('util');var logger=require(_0xca15('0x1'))(_0xca15('0x2'));var moment=require(_0xca15('0x3'));var BPromise=require(_0xca15('0x4'));var rp=require(_0xca15('0x5'));var fs=require('fs');var path=require(_0xca15('0x6'));var rimraf=require('rimraf');var config=require(_0xca15('0x7'));var attributes=require(_0xca15('0x8'));module[_0xca15('0x9')]=function(_0x4b8f85,_0x48e680){return _0x4b8f85['define'](_0xca15('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xca15('0xb'),'fields':[_0xca15('0xc'),_0xca15('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x89c6=['bluebird','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0x89c6,0x1ea));var _0x689c=function(_0x4d37a9,_0xc93f73){_0x4d37a9=_0x4d37a9-0x0;var _0x464db4=_0x89c6[_0x4d37a9];return _0x464db4;};'use strict';var _=require(_0x689c('0x0'));var util=require(_0x689c('0x1'));var logger=require(_0x689c('0x2'))(_0x689c('0x3'));var moment=require(_0x689c('0x4'));var BPromise=require(_0x689c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x689c('0x6'));var rimraf=require(_0x689c('0x7'));var config=require(_0x689c('0x8'));var attributes=require(_0x689c('0x9'));module[_0x689c('0xa')]=function(_0xf8d5b5,_0x5ae06e){return _0xf8d5b5[_0x689c('0xb')](_0x689c('0xc'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x689c('0xd'),'fields':['idField',_0x689c('0xe')],'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 b708b06..98a2c22 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 _0x093e=['../../config/logger','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5565da,_0x43315c){var _0x1d36c=function(_0x54b5b9){while(--_0x54b5b9){_0x5565da['push'](_0x5565da['shift']());}};_0x1d36c(++_0x43315c);}(_0x093e,0x1a8));var _0xe093=function(_0x30932d,_0x16928f){_0x30932d=_0x30932d-0x0;var _0x28a227=_0x093e[_0x30932d];return _0x28a227;};'use strict';var _=require(_0xe093('0x0'));var util=require(_0xe093('0x1'));var moment=require(_0xe093('0x2'));var BPromise=require(_0xe093('0x3'));var rs=require(_0xe093('0x4'));var fs=require('fs');var Redis=require(_0xe093('0x5'));var db=require(_0xe093('0x6'))['db'];var utils=require(_0xe093('0x7'));var logger=require(_0xe093('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe093('0x9'));var client=jayson[_0xe093('0xa')][_0xe093('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb81a,_0x54d0b9,_0x3e3ca0){return new BPromise(function(_0xffb82e,_0x1e04dd){return client[_0xe093('0xc')](_0x3bb81a,_0x3e3ca0)[_0xe093('0xd')](function(_0x51b8cb){logger[_0xe093('0xe')](_0xe093('0xf'),_0x54d0b9,_0xe093('0x10'));logger[_0xe093('0x11')](_0xe093('0x12'),_0x54d0b9,'request\x20sent',JSON[_0xe093('0x13')](_0x51b8cb));if(_0x51b8cb[_0xe093('0x14')]){if(_0x51b8cb[_0xe093('0x14')]['code']===0x1f4){logger[_0xe093('0x14')](_0xe093('0xf'),_0x54d0b9,_0x51b8cb[_0xe093('0x14')][_0xe093('0x15')]);return _0x1e04dd(_0x51b8cb['error'][_0xe093('0x15')]);}logger[_0xe093('0x14')](_0xe093('0xf'),_0x54d0b9,_0x51b8cb[_0xe093('0x14')][_0xe093('0x15')]);return _0xffb82e(_0x51b8cb[_0xe093('0x14')][_0xe093('0x15')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x54d0b9,_0xe093('0x10'));_0xffb82e(_0x51b8cb[_0xe093('0x16')][_0xe093('0x15')]);}})[_0xe093('0x17')](function(_0x57d6c4){logger[_0xe093('0x14')](_0xe093('0xf'),_0x54d0b9,_0x57d6c4);_0x1e04dd(_0x57d6c4);});});} \ No newline at end of file +var _0xa227=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ZendeskField,\x20%s,\x20%s','message','result','lodash','bluebird','ioredis'];(function(_0x577a6c,_0x5df1f6){var _0x2a75e6=function(_0x54001c){while(--_0x54001c){_0x577a6c['push'](_0x577a6c['shift']());}};_0x2a75e6(++_0x5df1f6);}(_0xa227,0x101));var _0x7a22=function(_0x4f411d,_0x16f21e){_0x4f411d=_0x4f411d-0x0;var _0x33b4cd=_0xa227[_0x4f411d];return _0x33b4cd;};'use strict';var _=require(_0x7a22('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7a22('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a22('0x2'));var db=require(_0x7a22('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a22('0x4'))(_0x7a22('0x5'));var config=require(_0x7a22('0x6'));var jayson=require(_0x7a22('0x7'));var client=jayson[_0x7a22('0x8')][_0x7a22('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a77a3,_0x31973f,_0x33237c){return new BPromise(function(_0xd63b15,_0x5c8c48){return client['request'](_0x2a77a3,_0x33237c)[_0x7a22('0xa')](function(_0x2defe4){logger[_0x7a22('0xb')]('ZendeskField,\x20%s,\x20%s',_0x31973f,'request\x20sent');logger[_0x7a22('0xc')](_0x7a22('0xd'),_0x31973f,_0x7a22('0xe'),JSON['stringify'](_0x2defe4));if(_0x2defe4[_0x7a22('0xf')]){if(_0x2defe4['error'][_0x7a22('0x10')]===0x1f4){logger[_0x7a22('0xf')](_0x7a22('0x11'),_0x31973f,_0x2defe4[_0x7a22('0xf')][_0x7a22('0x12')]);return _0x5c8c48(_0x2defe4[_0x7a22('0xf')]['message']);}logger[_0x7a22('0xf')](_0x7a22('0x11'),_0x31973f,_0x2defe4[_0x7a22('0xf')][_0x7a22('0x12')]);return _0xd63b15(_0x2defe4[_0x7a22('0xf')][_0x7a22('0x12')]);}else{logger[_0x7a22('0xb')](_0x7a22('0x11'),_0x31973f,_0x7a22('0xe'));_0xd63b15(_0x2defe4[_0x7a22('0x13')][_0x7a22('0x12')]);}})['catch'](function(_0x51394f){logger['error'](_0x7a22('0x11'),_0x31973f,_0x51394f);_0x5c8c48(_0x51394f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index a576e2c..16eeff6 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 _0xca2d=['show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoAccount.controller','index','get','/:id'];(function(_0x5293b5,_0x46a867){var _0x146ea5=function(_0x1e9a60){while(--_0x1e9a60){_0x5293b5['push'](_0x5293b5['shift']());}};_0x146ea5(++_0x46a867);}(_0xca2d,0x12d));var _0xdca2=function(_0x5a47de,_0x57a87c){_0x5a47de=_0x5a47de-0x0;var _0x400ee6=_0xca2d[_0x5a47de];return _0x400ee6;};'use strict';var multer=require(_0xdca2('0x0'));var util=require(_0xdca2('0x1'));var path=require('path');var timeout=require(_0xdca2('0x2'));var express=require(_0xdca2('0x3'));var router=express[_0xdca2('0x4')]();var fs_extra=require(_0xdca2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdca2('0x6'));var controller=require(_0xdca2('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xdca2('0x8')]);router[_0xdca2('0x9')](_0xdca2('0xa'),auth['isAuthenticated'](),controller[_0xdca2('0xb')]);router[_0xdca2('0x9')](_0xdca2('0xc'),auth[_0xdca2('0xd')](),controller[_0xdca2('0xe')]);router[_0xdca2('0x9')](_0xdca2('0xf'),auth[_0xdca2('0xd')](),controller[_0xdca2('0x10')]);router[_0xdca2('0x11')]('/',auth[_0xdca2('0xd')](),controller[_0xdca2('0x12')]);router[_0xdca2('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xdca2('0x13')]);router[_0xdca2('0x14')](_0xdca2('0xa'),auth[_0xdca2('0xd')](),controller[_0xdca2('0x15')]);router['delete']('/:id',auth[_0xdca2('0xd')](),controller[_0xdca2('0x16')]);module[_0xdca2('0x17')]=router; \ No newline at end of file +var _0x10f7=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','express','Router'];(function(_0xcf581b,_0x4359dd){var _0x4f454d=function(_0x182d58){while(--_0x182d58){_0xcf581b['push'](_0xcf581b['shift']());}};_0x4f454d(++_0x4359dd);}(_0x10f7,0x80));var _0x710f=function(_0x343c91,_0x19a2d9){_0x343c91=_0x343c91-0x0;var _0x10c40e=_0x10f7[_0x343c91];return _0x10c40e;};'use strict';var multer=require(_0x710f('0x0'));var util=require(_0x710f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x710f('0x2'));var router=express[_0x710f('0x3')]();var fs_extra=require(_0x710f('0x4'));var auth=require(_0x710f('0x5'));var interaction=require(_0x710f('0x6'));var config=require(_0x710f('0x7'));var controller=require(_0x710f('0x8'));router[_0x710f('0x9')]('/',auth[_0x710f('0xa')](),controller[_0x710f('0xb')]);router[_0x710f('0x9')]('/:id',auth[_0x710f('0xa')](),controller['show']);router[_0x710f('0x9')](_0x710f('0xc'),auth[_0x710f('0xa')](),controller[_0x710f('0xd')]);router[_0x710f('0x9')](_0x710f('0xe'),auth[_0x710f('0xa')](),controller['getFields']);router[_0x710f('0xf')]('/',auth[_0x710f('0xa')](),controller[_0x710f('0x10')]);router['post'](_0x710f('0xc'),auth[_0x710f('0xa')](),controller[_0x710f('0x11')]);router[_0x710f('0x12')]('/:id',auth[_0x710f('0xa')](),controller['update']);router[_0x710f('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x710f('0x14')]);module[_0x710f('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index a84d638..3bb98ac 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 _0xee5b=['sequelize','STRING'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xee5b,0x1f4));var _0xbee5=function(_0x3f7c57,_0x1cdc14){_0x3f7c57=_0x3f7c57-0x0;var _0x4795c6=_0xee5b[_0x3f7c57];return _0x4795c6;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'name':{'type':Sequelize[_0xbee5('0x1')]},'description':{'type':Sequelize[_0xbee5('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xbee5('0x1')]},'clientId':{'type':Sequelize[_0xbee5('0x1')]},'clientSecret':{'type':Sequelize[_0xbee5('0x1')]},'serverUrl':{'type':Sequelize[_0xbee5('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4bc3=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4bc3,0x16e));var _0x34bc=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x4bc3[_0x2aa0e7];return _0x1472c0;};'use strict';var Sequelize=require(_0x34bc('0x0'));module[_0x34bc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x34bc('0x2')]},'host':{'type':Sequelize[_0x34bc('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x34bc('0x2')]},'clientSecret':{'type':Sequelize[_0x34bc('0x2')]},'serverUrl':{'type':Sequelize[_0x34bc('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x34bc('0x2')]},'refreshToken':{'type':Sequelize[_0x34bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index ca278a3..663c213 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 _0x55c7=['/oauth/v2/token','clientId','refresh_token','access_token','getFields','host','clientSecret','serverUrl','refreshToken','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Call_Duration','Call_Result','Call_Type','remove','api_name','system_mandatory','push','display_label','data_type','picklist','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','update','then','end','stack','name','index','map','rawAttributes','fieldName','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ZohoAccount','findAll','catch','show','params','keys','fields','includeAll','find','body','destroy','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0x55c7,0x1a3));var _0x755c=function(_0x400131,_0x49e447){_0x400131=_0x400131-0x0;var _0x2a3a2f=_0x55c7[_0x400131];return _0x2a3a2f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x755c('0x0'));var zipdir=require(_0x755c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x755c('0x2'));var Mustache=require(_0x755c('0x3'));var util=require('util');var path=require(_0x755c('0x4'));var sox=require(_0x755c('0x5'));var csv=require('to-csv');var ejs=require(_0x755c('0x6'));var fs=require('fs');var fs_extra=require(_0x755c('0x7'));var _=require(_0x755c('0x8'));var squel=require(_0x755c('0x9'));var crypto=require(_0x755c('0xa'));var jsforce=require(_0x755c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x755c('0xc'));var querystring=require('querystring');var Papa=require(_0x755c('0xd'));var Redis=require('ioredis');var authService=require(_0x755c('0xe'));var qs=require(_0x755c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x755c('0x10'))('api');var utils=require(_0x755c('0x11'));var config=require(_0x755c('0x12'));var licenseUtil=require(_0x755c('0x13'));var db=require(_0x755c('0x14'))['db'];var integrations=require(_0x755c('0x15'));function respondWithStatusCode(_0x3daed7,_0x382f2c){_0x382f2c=_0x382f2c||0xcc;return function(_0x4afd80){if(_0x4afd80){return _0x3daed7[_0x755c('0x16')](_0x382f2c);}return _0x3daed7[_0x755c('0x17')](_0x382f2c)['end']();};}function respondWithResult(_0x2b7395,_0x17b508){_0x17b508=_0x17b508||0xc8;return function(_0x33c952){if(_0x33c952){return _0x2b7395[_0x755c('0x17')](_0x17b508)['json'](_0x33c952);}};}function respondWithFilteredResult(_0x22525e,_0x477b9f){return function(_0x4362d6){if(_0x4362d6){var _0x3de53e=typeof _0x477b9f[_0x755c('0x18')]===_0x755c('0x19')&&typeof _0x477b9f[_0x755c('0x1a')]===_0x755c('0x19');var _0x4638a1=_0x4362d6[_0x755c('0x1b')];var _0x4c36c8=_0x3de53e?0x0:_0x477b9f[_0x755c('0x18')];var _0xb32c01=_0x3de53e?_0x4362d6['count']:_0x477b9f[_0x755c('0x18')]+_0x477b9f[_0x755c('0x1a')];var _0x5cf47b;if(_0xb32c01>=_0x4638a1){_0xb32c01=_0x4638a1;_0x5cf47b=0xc8;}else{_0x5cf47b=0xce;}_0x22525e[_0x755c('0x17')](_0x5cf47b);return _0x22525e[_0x755c('0x1c')](_0x755c('0x1d'),_0x4c36c8+'-'+_0xb32c01+'/'+_0x4638a1)['json'](_0x4362d6);}return null;};}function patchUpdates(_0x4307cc){return function(_0x3bff9d){try{jsonpatch[_0x755c('0x1e')](_0x3bff9d,_0x4307cc,!![]);}catch(_0x5f32d7){return BPromise['reject'](_0x5f32d7);}return _0x3bff9d['save']();};}function saveUpdates(_0x43cf32,_0x24d711){return function(_0x5297a6){if(_0x5297a6){return _0x5297a6[_0x755c('0x1f')](_0x43cf32)[_0x755c('0x20')](function(_0x40a638){return _0x40a638;});}return null;};}function removeEntity(_0x15038b,_0x410867){return function(_0x2bb68b){if(_0x2bb68b){return _0x2bb68b['destroy']()[_0x755c('0x20')](function(){_0x15038b['status'](0xcc)[_0x755c('0x21')]();});}};}function handleEntityNotFound(_0x12e0aa,_0x54d2a1){return function(_0x1e7a5c){if(!_0x1e7a5c){_0x12e0aa[_0x755c('0x16')](0x194);}return _0x1e7a5c;};}function handleError(_0x4c5979,_0x2c367d){_0x2c367d=_0x2c367d||0x1f4;return function(_0x22f524){logger['error'](_0x22f524[_0x755c('0x22')]);if(_0x22f524['name']){delete _0x22f524[_0x755c('0x23')];}_0x4c5979[_0x755c('0x17')](_0x2c367d)['send'](_0x22f524);};}exports[_0x755c('0x24')]=function(_0x4dc1aa,_0x194118){var _0x4b9110={},_0xef5644={},_0xbd3da6={'count':0x0,'rows':[]};var _0x3fcdc3=_[_0x755c('0x25')](db['ZohoAccount'][_0x755c('0x26')],function(_0x55b1f1){return{'name':_0x55b1f1[_0x755c('0x27')],'type':_0x55b1f1['type']['key']};});_0xef5644['model']=_['map'](_0x3fcdc3,'name');_0xef5644[_0x755c('0x28')]=_['keys'](_0x4dc1aa['query']);_0xef5644[_0x755c('0x29')]=_[_0x755c('0x2a')](_0xef5644[_0x755c('0x2b')],_0xef5644[_0x755c('0x28')]);_0x4b9110[_0x755c('0x2c')]=_[_0x755c('0x2a')](_0xef5644[_0x755c('0x2b')],qs['fields'](_0x4dc1aa[_0x755c('0x28')]['fields']));_0x4b9110['attributes']=_0x4b9110[_0x755c('0x2c')][_0x755c('0x2d')]?_0x4b9110[_0x755c('0x2c')]:_0xef5644[_0x755c('0x2b')];if(!_0x4dc1aa[_0x755c('0x28')][_0x755c('0x2e')](_0x755c('0x2f'))){_0x4b9110['limit']=qs['limit'](_0x4dc1aa[_0x755c('0x28')]['limit']);_0x4b9110['offset']=qs[_0x755c('0x18')](_0x4dc1aa[_0x755c('0x28')]['offset']);}_0x4b9110[_0x755c('0x30')]=qs[_0x755c('0x31')](_0x4dc1aa['query'][_0x755c('0x31')]);_0x4b9110[_0x755c('0x32')]=qs[_0x755c('0x29')](_[_0x755c('0x33')](_0x4dc1aa[_0x755c('0x28')],_0xef5644[_0x755c('0x29')]),_0x3fcdc3);if(_0x4dc1aa[_0x755c('0x28')][_0x755c('0x34')]){_0x4b9110[_0x755c('0x32')]=_[_0x755c('0x35')](_0x4b9110[_0x755c('0x32')],{'$or':_[_0x755c('0x25')](_0x3fcdc3,function(_0xf852f3){if(_0xf852f3[_0x755c('0x36')]!==_0x755c('0x37')){var _0x1dffaf={};_0x1dffaf[_0xf852f3[_0x755c('0x23')]]={'$like':'%'+_0x4dc1aa[_0x755c('0x28')][_0x755c('0x34')]+'%'};return _0x1dffaf;}})});}_0x4b9110=_[_0x755c('0x35')]({},_0x4b9110,_0x4dc1aa[_0x755c('0x38')]);var _0x323863={'where':_0x4b9110[_0x755c('0x32')]};return db[_0x755c('0x39')]['count'](_0x323863)[_0x755c('0x20')](function(_0x23308d){_0xbd3da6['count']=_0x23308d;if(_0x4dc1aa[_0x755c('0x28')]['includeAll']){_0x4b9110['include']=[{'all':!![]}];}return db[_0x755c('0x39')][_0x755c('0x3a')](_0x4b9110);})[_0x755c('0x20')](function(_0x1bf696){_0xbd3da6['rows']=_0x1bf696;return _0xbd3da6;})[_0x755c('0x20')](respondWithFilteredResult(_0x194118,_0x4b9110))[_0x755c('0x3b')](handleError(_0x194118,null));};exports[_0x755c('0x3c')]=function(_0x4fb9ce,_0x31fada){var _0x85601={'raw':![],'where':{'id':_0x4fb9ce[_0x755c('0x3d')]['id']}},_0x18779c={};_0x18779c['model']=_['keys'](db[_0x755c('0x39')]['rawAttributes']);_0x18779c[_0x755c('0x28')]=_[_0x755c('0x3e')](_0x4fb9ce[_0x755c('0x28')]);_0x18779c[_0x755c('0x29')]=_['intersection'](_0x18779c[_0x755c('0x2b')],_0x18779c['query']);_0x85601[_0x755c('0x2c')]=_['intersection'](_0x18779c['model'],qs['fields'](_0x4fb9ce[_0x755c('0x28')][_0x755c('0x3f')]));_0x85601[_0x755c('0x2c')]=_0x85601['attributes']['length']?_0x85601[_0x755c('0x2c')]:_0x18779c[_0x755c('0x2b')];if(_0x4fb9ce[_0x755c('0x28')][_0x755c('0x40')]){_0x85601['include']=[{'all':!![]}];}_0x85601=_[_0x755c('0x35')]({},_0x85601,_0x4fb9ce[_0x755c('0x38')]);return db[_0x755c('0x39')][_0x755c('0x41')](_0x85601)[_0x755c('0x20')](handleEntityNotFound(_0x31fada,null))[_0x755c('0x20')](respondWithResult(_0x31fada,null))[_0x755c('0x3b')](handleError(_0x31fada,null));};exports['create']=function(_0x69c3d1,_0x3f93fe){return db[_0x755c('0x39')]['create'](_0x69c3d1[_0x755c('0x42')],{})[_0x755c('0x20')](respondWithResult(_0x3f93fe,0xc9))[_0x755c('0x3b')](handleError(_0x3f93fe,null));};exports[_0x755c('0x1f')]=function(_0xab832,_0x5313cd){if(_0xab832[_0x755c('0x42')]['id']){delete _0xab832[_0x755c('0x42')]['id'];}return db['ZohoAccount'][_0x755c('0x41')]({'where':{'id':_0xab832['params']['id']}})[_0x755c('0x20')](handleEntityNotFound(_0x5313cd,null))[_0x755c('0x20')](saveUpdates(_0xab832['body'],null))[_0x755c('0x20')](respondWithResult(_0x5313cd,null))[_0x755c('0x3b')](handleError(_0x5313cd,null));};exports[_0x755c('0x43')]=function(_0x583323,_0x3309da){return db[_0x755c('0x39')][_0x755c('0x41')]({'where':{'id':_0x583323['params']['id']}})['then'](handleEntityNotFound(_0x3309da,null))[_0x755c('0x20')](removeEntity(_0x3309da,null))[_0x755c('0x3b')](handleError(_0x3309da,null));};exports['getConfigurations']=function(_0x4f3271,_0x564557,_0x5bdd15){var _0x59c7a7={};var _0x280c4b={};var _0xda5bf5;var _0xbb6d38;return db[_0x755c('0x39')][_0x755c('0x44')]({'where':{'id':_0x4f3271[_0x755c('0x3d')]['id']}})[_0x755c('0x20')](handleEntityNotFound(_0x564557,null))[_0x755c('0x20')](function(_0x1b9bec){if(_0x1b9bec){_0xda5bf5=_0x1b9bec;_0x280c4b[_0x755c('0x2b')]=_[_0x755c('0x3e')](db[_0x755c('0x45')][_0x755c('0x26')]);_0x280c4b[_0x755c('0x28')]=_[_0x755c('0x3e')](_0x4f3271[_0x755c('0x28')]);_0x280c4b[_0x755c('0x29')]=_[_0x755c('0x2a')](_0x280c4b[_0x755c('0x2b')],_0x280c4b[_0x755c('0x28')]);_0x59c7a7['attributes']=_[_0x755c('0x2a')](_0x280c4b[_0x755c('0x2b')],qs[_0x755c('0x3f')](_0x4f3271[_0x755c('0x28')][_0x755c('0x3f')]));_0x59c7a7[_0x755c('0x2c')]=_0x59c7a7[_0x755c('0x2c')]['length']?_0x59c7a7[_0x755c('0x2c')]:_0x280c4b[_0x755c('0x2b')];_0x59c7a7['order']=qs['sort'](_0x4f3271[_0x755c('0x28')][_0x755c('0x31')]);_0x59c7a7[_0x755c('0x32')]=qs[_0x755c('0x29')](_[_0x755c('0x33')](_0x4f3271[_0x755c('0x28')],_0x280c4b[_0x755c('0x29')]));if(_0x4f3271[_0x755c('0x28')]['filter']){_0x59c7a7[_0x755c('0x32')]=_[_0x755c('0x35')](_0x59c7a7[_0x755c('0x32')],{'$or':_[_0x755c('0x25')](_0x59c7a7[_0x755c('0x2c')],function(_0x214701){var _0x3ebd55={};_0x3ebd55[_0x214701]={'$like':'%'+_0x4f3271['query'][_0x755c('0x34')]+'%'};return _0x3ebd55;})});}_0x59c7a7=_[_0x755c('0x35')]({},_0x59c7a7,_0x4f3271[_0x755c('0x38')]);return _0xda5bf5['getConfigurations'](_0x59c7a7);}})[_0x755c('0x20')](function(_0x1f5c96){if(_0x1f5c96){_0xbb6d38=_0x1f5c96['length'];if(!_0x4f3271[_0x755c('0x28')][_0x755c('0x2e')](_0x755c('0x2f'))){_0x59c7a7['limit']=qs[_0x755c('0x1a')](_0x4f3271['query'][_0x755c('0x1a')]);_0x59c7a7[_0x755c('0x18')]=qs[_0x755c('0x18')](_0x4f3271[_0x755c('0x28')]['offset']);}return _0xda5bf5[_0x755c('0x46')](_0x59c7a7);}})[_0x755c('0x20')](function(_0x3b8395){if(_0x3b8395){return _0x3b8395?{'count':_0xbb6d38,'rows':_0x3b8395}:null;}})[_0x755c('0x20')](respondWithResult(_0x564557,null))['catch'](handleError(_0x564557,null));};exports[_0x755c('0x47')]=function(_0x271d5e,_0x748f45,_0xedf0e0){if(_0x271d5e[_0x755c('0x42')]['id']){delete _0x271d5e[_0x755c('0x42')]['id'];}return db[_0x755c('0x39')][_0x755c('0x44')]({'where':{'id':_0x271d5e[_0x755c('0x3d')]['id']}})[_0x755c('0x20')](handleEntityNotFound(_0x748f45,null))[_0x755c('0x20')](function(_0x5a40f9){if(_0x5a40f9){_0x271d5e['body'][_0x755c('0x48')]=_0x5a40f9['id'];_0x271d5e['body'][_0x755c('0x49')]=integrations[_0x755c('0x4a')](_0x271d5e[_0x755c('0x42')]['channel'],_0x271d5e[_0x755c('0x42')][_0x755c('0x36')]);_0x271d5e[_0x755c('0x42')][_0x755c('0x4b')]=integrations[_0x755c('0x4c')](_0x271d5e[_0x755c('0x42')][_0x755c('0x4d')],_0x271d5e[_0x755c('0x42')][_0x755c('0x36')]);return db[_0x755c('0x45')][_0x755c('0x4e')](_0x271d5e[_0x755c('0x42')],{'include':[{'model':db[_0x755c('0x4f')],'as':'Subjects'},{'model':db[_0x755c('0x4f')],'as':_0x755c('0x4b')}]});}return null;})[_0x755c('0x20')](respondWithResult(_0x748f45,null))['catch'](handleError(_0x748f45,null));};function getAccessToken(_0x1cdeec){return new Promise(function(_0x586e6b,_0x11dc5c){var _0x3f5462;switch(_0x1cdeec[_0x755c('0x50')]){case'US':_0x3f5462=_0x755c('0x51');break;case'AU':_0x3f5462='https://accounts.zoho.com.au';break;case'EU':_0x3f5462=_0x755c('0x52');break;case'IN':_0x3f5462='https://accounts.zoho.in';break;case'CN':_0x3f5462=_0x755c('0x53');break;default:_0x3f5462=_0x755c('0x52');break;}var _0x5bee16={'method':_0x755c('0x54'),'uri':_0x3f5462+_0x755c('0x55'),'qs':{'refresh_token':_0x1cdeec['refreshToken'],'client_id':_0x1cdeec[_0x755c('0x56')],'client_secret':_0x1cdeec['clientSecret'],'grant_type':_0x755c('0x57')},'json':!![]};return rp(_0x5bee16)[_0x755c('0x20')](function(_0x2a1b09){if(_0x2a1b09[_0x755c('0x58')]){_0x586e6b(_0x2a1b09[_0x755c('0x58')]);}else{_0x11dc5c('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x755c('0x3b')](function(_0x5e39c4){_0x11dc5c(_0x5e39c4);});});}exports[_0x755c('0x59')]=function(_0x5cfde4,_0x1e70e4,_0x27ac19){var _0x1fdcab,_0x2bd928,_0x4ecbae,_0x19e88d,_0x1951b2;return db['ZohoAccount'][_0x755c('0x44')]({'where':{'id':_0x5cfde4['params']['id']},'attributes':['id',_0x755c('0x5a'),_0x755c('0x50'),_0x755c('0x56'),_0x755c('0x5b'),_0x755c('0x5c'),'code',_0x755c('0x5d')]})['then'](handleEntityNotFound(_0x1e70e4,null))['then'](function(_0x186c08){_0x1951b2=_0x186c08;_0x1fdcab=_0x1951b2['host'];_0x2bd928=_0x1fdcab===_0x755c('0x5e')?'eu':_0x755c('0x5f');_0x4ecbae=_0x1951b2[_0x755c('0x5c')];var _0x17e1c7=_0x4ecbae[_0x755c('0x60')](-0x1);if(_0x17e1c7==='/'||_0x17e1c7==='\x5c'||_0x17e1c7===':'){_0x4ecbae=_0x4ecbae[_0x755c('0x61')](0x0,_0x4ecbae[_0x755c('0x62')](_0x17e1c7));}if(!_0x1951b2['refreshToken']){throw new Error(_0x755c('0x63'));}return getAccessToken(_0x1951b2);})['then'](function(_0x7101fe){if(_0x7101fe){return rp({'method':_0x755c('0x64'),'uri':util[_0x755c('0x65')](_0x755c('0x66'),_0x2bd928),'qs':{'module':_0x755c('0x67')},'headers':{'Authorization':_0x755c('0x68')+_0x7101fe},'json':!![]});}})[_0x755c('0x20')](function(_0x5697c3){if(_0x5697c3){if(_0x5697c3[_0x755c('0x69')]&&_0x5697c3[_0x755c('0x69')][_0x755c('0x6a')]){throw new Error(_0x5697c3[_0x755c('0x69')][_0x755c('0x6a')][_0x755c('0x6b')]);}var _0x496776=[];var _0x1452ad=[];var _0x4b0a97=[_0x755c('0x6c'),_0x755c('0x6d'),'Description','WhoId',_0x755c('0x6e'),_0x755c('0x6f'),'Call_Start_Time',_0x755c('0x70')];_0x1452ad=_[_0x755c('0x71')](_0x5697c3[_0x755c('0x3f')],function(_0x2c3067){return _0x4b0a97['includes'](_0x2c3067[_0x755c('0x72')]);});for(var _0x1b07b2=0x0;_0x1b07b2<_0x1452ad[_0x755c('0x2d')];_0x1b07b2++){if(_0x1452ad[_0x1b07b2][_0x755c('0x73')]===![]){_0x496776[_0x755c('0x74')]({'id':_0x1452ad[_0x1b07b2]['id'],'name':_0x1452ad[_0x1b07b2][_0x755c('0x75')],'custom':_0x1452ad[_0x1b07b2]['custom_field'],'options':_0x1452ad[_0x1b07b2][_0x755c('0x76')]===_0x755c('0x77')&&_0x1452ad[_0x1b07b2]['pick_list_values'][_0x755c('0x2d')]>-0x1?_[_0x755c('0x25')](_0x1452ad[_0x1b07b2]['pick_list_values'],function(_0x4682da){return{'name':_0x4682da,'value':_0x4682da};}):[]});}}return{'count':_0x496776[_0x755c('0x2d')],'rows':_0x496776};}else{return{'count':0x0,'rows':[]};}})[_0x755c('0x20')](respondWithResult(_0x1e70e4,null))['catch'](function(_0x1407ff){var _0x22b75b=_0x5cfde4[_0x755c('0x28')][_0x755c('0x78')]?0x1f4:_0x1407ff[_0x755c('0x79')]||0x1f4;logger['error'](_0x755c('0x7a'),_0x755c('0x59'),_0x22b75b,JSON[_0x755c('0x7b')](_0x1407ff));delete _0x1407ff[_0x755c('0x23')];if(_0x22b75b===0x191){_0x22b75b=0x190;}_0x1e70e4[_0x755c('0x17')](_0x22b75b)[_0x755c('0x7c')](_0x5cfde4[_0x755c('0x28')][_0x755c('0x78')]?{'message':_0x755c('0x7d'),'statusCode':_0x1407ff[_0x755c('0x79')]}:_0x1407ff);});}; \ No newline at end of file +var _0x565c=['rows','show','params','find','create','body','update','catch','getConfigurations','findOne','ZohoConfiguration','pick','addConfiguration','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Subject','WhoId','Call_Duration','Call_Result','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','stringify','send','Wrong\x20credentials','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','set','apply','save','then','destroy','sendStatus','error','name','map','ZohoAccount','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','include'];(function(_0x350798,_0x37ed77){var _0x362827=function(_0x39d738){while(--_0x39d738){_0x350798['push'](_0x350798['shift']());}};_0x362827(++_0x37ed77);}(_0x565c,0xbc));var _0xc565=function(_0x5c0f96,_0x209b86){_0x5c0f96=_0x5c0f96-0x0;var _0x150453=_0x565c[_0x5c0f96];return _0x150453;};'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(_0xc565('0x0'));var moment=require(_0xc565('0x1'));var BPromise=require(_0xc565('0x2'));var Mustache=require(_0xc565('0x3'));var util=require(_0xc565('0x4'));var path=require(_0xc565('0x5'));var sox=require(_0xc565('0x6'));var csv=require(_0xc565('0x7'));var ejs=require(_0xc565('0x8'));var fs=require('fs');var fs_extra=require(_0xc565('0x9'));var _=require(_0xc565('0xa'));var squel=require(_0xc565('0xb'));var crypto=require('crypto');var jsforce=require(_0xc565('0xc'));var deskjs=require(_0xc565('0xd'));var toCsv=require(_0xc565('0x7'));var querystring=require(_0xc565('0xe'));var Papa=require('papaparse');var Redis=require(_0xc565('0xf'));var authService=require(_0xc565('0x10'));var qs=require(_0xc565('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc565('0x12'));var logger=require(_0xc565('0x13'))(_0xc565('0x14'));var utils=require(_0xc565('0x15'));var config=require(_0xc565('0x16'));var licenseUtil=require(_0xc565('0x17'));var db=require(_0xc565('0x18'))['db'];var integrations=require(_0xc565('0x19'));function respondWithStatusCode(_0x485d44,_0x5990b4){_0x5990b4=_0x5990b4||0xcc;return function(_0x4199af){if(_0x4199af){return _0x485d44['sendStatus'](_0x5990b4);}return _0x485d44[_0xc565('0x1a')](_0x5990b4)[_0xc565('0x1b')]();};}function respondWithResult(_0x47ad05,_0x42b10d){_0x42b10d=_0x42b10d||0xc8;return function(_0x823bf0){if(_0x823bf0){return _0x47ad05[_0xc565('0x1a')](_0x42b10d)[_0xc565('0x1c')](_0x823bf0);}};}function respondWithFilteredResult(_0x38361b,_0x1b08dd){return function(_0x34899e){if(_0x34899e){var _0x35311e=typeof _0x1b08dd['offset']===_0xc565('0x1d')&&typeof _0x1b08dd[_0xc565('0x1e')]==='undefined';var _0x2b0c30=_0x34899e[_0xc565('0x1f')];var _0x59d2fd=_0x35311e?0x0:_0x1b08dd[_0xc565('0x20')];var _0x5069fa=_0x35311e?_0x34899e[_0xc565('0x1f')]:_0x1b08dd[_0xc565('0x20')]+_0x1b08dd[_0xc565('0x1e')];var _0x4f7623;if(_0x5069fa>=_0x2b0c30){_0x5069fa=_0x2b0c30;_0x4f7623=0xc8;}else{_0x4f7623=0xce;}_0x38361b['status'](_0x4f7623);return _0x38361b[_0xc565('0x21')]('Content-Range',_0x59d2fd+'-'+_0x5069fa+'/'+_0x2b0c30)[_0xc565('0x1c')](_0x34899e);}return null;};}function patchUpdates(_0x11f7c3){return function(_0x306483){try{jsonpatch[_0xc565('0x22')](_0x306483,_0x11f7c3,!![]);}catch(_0x281e5d){return BPromise['reject'](_0x281e5d);}return _0x306483[_0xc565('0x23')]();};}function saveUpdates(_0xd2487a,_0x14f2a7){return function(_0x493cce){if(_0x493cce){return _0x493cce['update'](_0xd2487a)[_0xc565('0x24')](function(_0x4de16b){return _0x4de16b;});}return null;};}function removeEntity(_0x17ecda,_0x1840f9){return function(_0x3b7fcb){if(_0x3b7fcb){return _0x3b7fcb[_0xc565('0x25')]()['then'](function(){_0x17ecda[_0xc565('0x1a')](0xcc)[_0xc565('0x1b')]();});}};}function handleEntityNotFound(_0x4ef2ba,_0x439155){return function(_0x17910e){if(!_0x17910e){_0x4ef2ba[_0xc565('0x26')](0x194);}return _0x17910e;};}function handleError(_0x210ba6,_0x287d1f){_0x287d1f=_0x287d1f||0x1f4;return function(_0x560c42){logger[_0xc565('0x27')](_0x560c42['stack']);if(_0x560c42[_0xc565('0x28')]){delete _0x560c42[_0xc565('0x28')];}_0x210ba6['status'](_0x287d1f)['send'](_0x560c42);};}exports['index']=function(_0x1d03b1,_0x43ec4b){var _0x36c073={},_0x478b5e={},_0x432c0c={'count':0x0,'rows':[]};var _0x2605a8=_[_0xc565('0x29')](db[_0xc565('0x2a')][_0xc565('0x2b')],function(_0x5051b8){return{'name':_0x5051b8[_0xc565('0x2c')],'type':_0x5051b8['type'][_0xc565('0x2d')]};});_0x478b5e[_0xc565('0x2e')]=_[_0xc565('0x29')](_0x2605a8,_0xc565('0x28'));_0x478b5e[_0xc565('0x2f')]=_[_0xc565('0x30')](_0x1d03b1[_0xc565('0x2f')]);_0x478b5e['filters']=_['intersection'](_0x478b5e[_0xc565('0x2e')],_0x478b5e[_0xc565('0x2f')]);_0x36c073[_0xc565('0x31')]=_[_0xc565('0x32')](_0x478b5e['model'],qs[_0xc565('0x33')](_0x1d03b1[_0xc565('0x2f')][_0xc565('0x33')]));_0x36c073['attributes']=_0x36c073[_0xc565('0x31')][_0xc565('0x34')]?_0x36c073[_0xc565('0x31')]:_0x478b5e['model'];if(!_0x1d03b1[_0xc565('0x2f')][_0xc565('0x35')](_0xc565('0x36'))){_0x36c073[_0xc565('0x1e')]=qs[_0xc565('0x1e')](_0x1d03b1['query'][_0xc565('0x1e')]);_0x36c073[_0xc565('0x20')]=qs[_0xc565('0x20')](_0x1d03b1[_0xc565('0x2f')][_0xc565('0x20')]);}_0x36c073[_0xc565('0x37')]=qs[_0xc565('0x38')](_0x1d03b1[_0xc565('0x2f')][_0xc565('0x38')]);_0x36c073[_0xc565('0x39')]=qs[_0xc565('0x3a')](_['pick'](_0x1d03b1[_0xc565('0x2f')],_0x478b5e[_0xc565('0x3a')]),_0x2605a8);if(_0x1d03b1[_0xc565('0x2f')][_0xc565('0x3b')]){_0x36c073[_0xc565('0x39')]=_['merge'](_0x36c073['where'],{'$or':_[_0xc565('0x29')](_0x2605a8,function(_0x8d7ef6){if(_0x8d7ef6[_0xc565('0x3c')]!==_0xc565('0x3d')){var _0x3fc782={};_0x3fc782[_0x8d7ef6[_0xc565('0x28')]]={'$like':'%'+_0x1d03b1[_0xc565('0x2f')]['filter']+'%'};return _0x3fc782;}})});}_0x36c073=_[_0xc565('0x3e')]({},_0x36c073,_0x1d03b1[_0xc565('0x3f')]);var _0x1db195={'where':_0x36c073['where']};return db[_0xc565('0x2a')][_0xc565('0x1f')](_0x1db195)['then'](function(_0x30c497){_0x432c0c[_0xc565('0x1f')]=_0x30c497;if(_0x1d03b1['query'][_0xc565('0x40')]){_0x36c073[_0xc565('0x41')]=[{'all':!![]}];}return db[_0xc565('0x2a')]['findAll'](_0x36c073);})['then'](function(_0x512bad){_0x432c0c[_0xc565('0x42')]=_0x512bad;return _0x432c0c;})['then'](respondWithFilteredResult(_0x43ec4b,_0x36c073))['catch'](handleError(_0x43ec4b,null));};exports[_0xc565('0x43')]=function(_0x4e43ac,_0x36bbd2){var _0x2e93e3={'raw':![],'where':{'id':_0x4e43ac[_0xc565('0x44')]['id']}},_0x4e2ea9={};_0x4e2ea9['model']=_[_0xc565('0x30')](db[_0xc565('0x2a')][_0xc565('0x2b')]);_0x4e2ea9['query']=_['keys'](_0x4e43ac[_0xc565('0x2f')]);_0x4e2ea9[_0xc565('0x3a')]=_['intersection'](_0x4e2ea9[_0xc565('0x2e')],_0x4e2ea9[_0xc565('0x2f')]);_0x2e93e3[_0xc565('0x31')]=_['intersection'](_0x4e2ea9[_0xc565('0x2e')],qs[_0xc565('0x33')](_0x4e43ac[_0xc565('0x2f')][_0xc565('0x33')]));_0x2e93e3['attributes']=_0x2e93e3[_0xc565('0x31')][_0xc565('0x34')]?_0x2e93e3[_0xc565('0x31')]:_0x4e2ea9[_0xc565('0x2e')];if(_0x4e43ac[_0xc565('0x2f')][_0xc565('0x40')]){_0x2e93e3[_0xc565('0x41')]=[{'all':!![]}];}_0x2e93e3=_[_0xc565('0x3e')]({},_0x2e93e3,_0x4e43ac[_0xc565('0x3f')]);return db['ZohoAccount'][_0xc565('0x45')](_0x2e93e3)[_0xc565('0x24')](handleEntityNotFound(_0x36bbd2,null))['then'](respondWithResult(_0x36bbd2,null))['catch'](handleError(_0x36bbd2,null));};exports[_0xc565('0x46')]=function(_0x4cf610,_0x446759){return db[_0xc565('0x2a')][_0xc565('0x46')](_0x4cf610[_0xc565('0x47')],{})[_0xc565('0x24')](respondWithResult(_0x446759,0xc9))['catch'](handleError(_0x446759,null));};exports[_0xc565('0x48')]=function(_0x46dd09,_0xf1afe1){if(_0x46dd09[_0xc565('0x47')]['id']){delete _0x46dd09[_0xc565('0x47')]['id'];}return db['ZohoAccount'][_0xc565('0x45')]({'where':{'id':_0x46dd09[_0xc565('0x44')]['id']}})[_0xc565('0x24')](handleEntityNotFound(_0xf1afe1,null))[_0xc565('0x24')](saveUpdates(_0x46dd09[_0xc565('0x47')],null))['then'](respondWithResult(_0xf1afe1,null))[_0xc565('0x49')](handleError(_0xf1afe1,null));};exports[_0xc565('0x25')]=function(_0x4c882f,_0x5d656d){return db['ZohoAccount'][_0xc565('0x45')]({'where':{'id':_0x4c882f[_0xc565('0x44')]['id']}})['then'](handleEntityNotFound(_0x5d656d,null))[_0xc565('0x24')](removeEntity(_0x5d656d,null))[_0xc565('0x49')](handleError(_0x5d656d,null));};exports[_0xc565('0x4a')]=function(_0x5d476b,_0x5031bd,_0x1584dc){var _0x505bc4={};var _0x2c2c6c={};var _0x2397e4;var _0x36f52f;return db['ZohoAccount'][_0xc565('0x4b')]({'where':{'id':_0x5d476b[_0xc565('0x44')]['id']}})['then'](handleEntityNotFound(_0x5031bd,null))[_0xc565('0x24')](function(_0x1582d2){if(_0x1582d2){_0x2397e4=_0x1582d2;_0x2c2c6c[_0xc565('0x2e')]=_[_0xc565('0x30')](db[_0xc565('0x4c')][_0xc565('0x2b')]);_0x2c2c6c[_0xc565('0x2f')]=_['keys'](_0x5d476b[_0xc565('0x2f')]);_0x2c2c6c[_0xc565('0x3a')]=_['intersection'](_0x2c2c6c[_0xc565('0x2e')],_0x2c2c6c['query']);_0x505bc4[_0xc565('0x31')]=_[_0xc565('0x32')](_0x2c2c6c[_0xc565('0x2e')],qs[_0xc565('0x33')](_0x5d476b[_0xc565('0x2f')][_0xc565('0x33')]));_0x505bc4[_0xc565('0x31')]=_0x505bc4['attributes'][_0xc565('0x34')]?_0x505bc4[_0xc565('0x31')]:_0x2c2c6c[_0xc565('0x2e')];_0x505bc4[_0xc565('0x37')]=qs[_0xc565('0x38')](_0x5d476b['query'][_0xc565('0x38')]);_0x505bc4[_0xc565('0x39')]=qs['filters'](_[_0xc565('0x4d')](_0x5d476b[_0xc565('0x2f')],_0x2c2c6c['filters']));if(_0x5d476b[_0xc565('0x2f')][_0xc565('0x3b')]){_0x505bc4['where']=_[_0xc565('0x3e')](_0x505bc4['where'],{'$or':_['map'](_0x505bc4['attributes'],function(_0x473af4){var _0x2362aa={};_0x2362aa[_0x473af4]={'$like':'%'+_0x5d476b[_0xc565('0x2f')][_0xc565('0x3b')]+'%'};return _0x2362aa;})});}_0x505bc4=_['merge']({},_0x505bc4,_0x5d476b['options']);return _0x2397e4[_0xc565('0x4a')](_0x505bc4);}})[_0xc565('0x24')](function(_0x3cf2dc){if(_0x3cf2dc){_0x36f52f=_0x3cf2dc[_0xc565('0x34')];if(!_0x5d476b[_0xc565('0x2f')][_0xc565('0x35')](_0xc565('0x36'))){_0x505bc4[_0xc565('0x1e')]=qs[_0xc565('0x1e')](_0x5d476b[_0xc565('0x2f')][_0xc565('0x1e')]);_0x505bc4['offset']=qs[_0xc565('0x20')](_0x5d476b[_0xc565('0x2f')][_0xc565('0x20')]);}return _0x2397e4['getConfigurations'](_0x505bc4);}})[_0xc565('0x24')](function(_0x32c032){if(_0x32c032){return _0x32c032?{'count':_0x36f52f,'rows':_0x32c032}:null;}})['then'](respondWithResult(_0x5031bd,null))[_0xc565('0x49')](handleError(_0x5031bd,null));};exports[_0xc565('0x4e')]=function(_0x2b779f,_0x50f608,_0x480cd9){if(_0x2b779f[_0xc565('0x47')]['id']){delete _0x2b779f[_0xc565('0x47')]['id'];}return db[_0xc565('0x2a')][_0xc565('0x4b')]({'where':{'id':_0x2b779f[_0xc565('0x44')]['id']}})[_0xc565('0x24')](handleEntityNotFound(_0x50f608,null))[_0xc565('0x24')](function(_0x588ff2){if(_0x588ff2){_0x2b779f[_0xc565('0x47')]['AccountId']=_0x588ff2['id'];_0x2b779f['body'][_0xc565('0x4f')]=integrations['getSubjects'](_0x2b779f[_0xc565('0x47')][_0xc565('0x50')],_0x2b779f[_0xc565('0x47')][_0xc565('0x3c')]);_0x2b779f[_0xc565('0x47')][_0xc565('0x51')]=integrations[_0xc565('0x52')](_0x2b779f[_0xc565('0x47')][_0xc565('0x50')],_0x2b779f[_0xc565('0x47')][_0xc565('0x3c')]);return db[_0xc565('0x4c')][_0xc565('0x46')](_0x2b779f[_0xc565('0x47')],{'include':[{'model':db[_0xc565('0x53')],'as':'Subjects'},{'model':db[_0xc565('0x53')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x50f608,null))[_0xc565('0x49')](handleError(_0x50f608,null));};function getAccessToken(_0xb8fca1){return new Promise(function(_0x3e2eef,_0x197edb){var _0x1b59a9;switch(_0xb8fca1[_0xc565('0x54')]){case'US':_0x1b59a9=_0xc565('0x55');break;case'AU':_0x1b59a9=_0xc565('0x56');break;case'EU':_0x1b59a9=_0xc565('0x57');break;case'IN':_0x1b59a9=_0xc565('0x58');break;case'CN':_0x1b59a9=_0xc565('0x59');break;default:_0x1b59a9=_0xc565('0x57');break;}var _0x347dd9={'method':_0xc565('0x5a'),'uri':_0x1b59a9+_0xc565('0x5b'),'qs':{'refresh_token':_0xb8fca1[_0xc565('0x5c')],'client_id':_0xb8fca1[_0xc565('0x5d')],'client_secret':_0xb8fca1[_0xc565('0x5e')],'grant_type':_0xc565('0x5f')},'json':!![]};return rp(_0x347dd9)['then'](function(_0x104f75){if(_0x104f75[_0xc565('0x60')]){_0x3e2eef(_0x104f75['access_token']);}else{_0x197edb(_0xc565('0x61'));}})['catch'](function(_0x3de82c){_0x197edb(_0x3de82c);});});}exports['getFields']=function(_0x1257a2,_0x133589,_0x536760){var _0x465ad2,_0x3c729e,_0x3e809d,_0x7b18ac,_0x579087;return db[_0xc565('0x2a')][_0xc565('0x4b')]({'where':{'id':_0x1257a2[_0xc565('0x44')]['id']},'attributes':['id',_0xc565('0x62'),_0xc565('0x54'),_0xc565('0x5d'),_0xc565('0x5e'),_0xc565('0x63'),_0xc565('0x64'),'refreshToken']})['then'](handleEntityNotFound(_0x133589,null))['then'](function(_0xf23e1a){_0x579087=_0xf23e1a;_0x465ad2=_0x579087[_0xc565('0x62')];_0x3c729e=_0x465ad2==='zoho.eu'?'eu':'com';_0x3e809d=_0x579087[_0xc565('0x63')];var _0x6b8227=_0x3e809d['slice'](-0x1);if(_0x6b8227==='/'||_0x6b8227==='\x5c'||_0x6b8227===':'){_0x3e809d=_0x3e809d[_0xc565('0x65')](0x0,_0x3e809d[_0xc565('0x66')](_0x6b8227));}if(!_0x579087[_0xc565('0x5c')]){throw new Error(_0xc565('0x67'));}return getAccessToken(_0x579087);})[_0xc565('0x24')](function(_0x39569e){if(_0x39569e){return rp({'method':'GET','uri':util[_0xc565('0x68')](_0xc565('0x69'),_0x3c729e),'qs':{'module':_0xc565('0x6a')},'headers':{'Authorization':_0xc565('0x6b')+_0x39569e},'json':!![]});}})[_0xc565('0x24')](function(_0x4c1838){if(_0x4c1838){if(_0x4c1838[_0xc565('0x6c')]&&_0x4c1838[_0xc565('0x6c')]['error']){throw new Error(_0x4c1838[_0xc565('0x6c')]['error']['message']);}var _0x137816=[];var _0xa26b53=[];var _0x4448ff=['Owner',_0xc565('0x6d'),'Description',_0xc565('0x6e'),_0xc565('0x6f'),_0xc565('0x70'),'Call_Start_Time',_0xc565('0x71')];_0xa26b53=_[_0xc565('0x72')](_0x4c1838[_0xc565('0x33')],function(_0x20c66d){return _0x4448ff[_0xc565('0x73')](_0x20c66d['api_name']);});for(var _0x3d80b0=0x0;_0x3d80b0<_0xa26b53[_0xc565('0x34')];_0x3d80b0++){if(_0xa26b53[_0x3d80b0][_0xc565('0x74')]===![]){_0x137816[_0xc565('0x75')]({'id':_0xa26b53[_0x3d80b0]['id'],'name':_0xa26b53[_0x3d80b0][_0xc565('0x76')],'custom':_0xa26b53[_0x3d80b0][_0xc565('0x77')],'options':_0xa26b53[_0x3d80b0]['data_type']===_0xc565('0x78')&&_0xa26b53[_0x3d80b0][_0xc565('0x79')][_0xc565('0x34')]>-0x1?_[_0xc565('0x29')](_0xa26b53[_0x3d80b0][_0xc565('0x79')],function(_0x283a3c){return{'name':_0x283a3c,'value':_0x283a3c};}):[]});}}return{'count':_0x137816[_0xc565('0x34')],'rows':_0x137816};}else{return{'count':0x0,'rows':[]};}})[_0xc565('0x24')](respondWithResult(_0x133589,null))['catch'](function(_0x5148a8){var _0x4249b0=_0x1257a2[_0xc565('0x2f')][_0xc565('0x7a')]?0x1f4:_0x5148a8[_0xc565('0x7b')]||0x1f4;logger[_0xc565('0x27')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4249b0,JSON[_0xc565('0x7c')](_0x5148a8));delete _0x5148a8[_0xc565('0x28')];if(_0x4249b0===0x191){_0x4249b0=0x190;}_0x133589[_0xc565('0x1a')](_0x4249b0)[_0xc565('0x7d')](_0x1257a2[_0xc565('0x2f')]['test']?{'message':_0xc565('0x7e'),'statusCode':_0x5148a8[_0xc565('0x7b')]}:_0x5148a8);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 3bb2233..b1a235a 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 _0xf788=['authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','serverUrl','host','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','clientId','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token'];(function(_0x14def5,_0x45ad02){var _0x23f6fd=function(_0x45bb35){while(--_0x45bb35){_0x14def5['push'](_0x14def5['shift']());}};_0x23f6fd(++_0x45ad02);}(_0xf788,0x195));var _0x8f78=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xf788[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x8f78('0x0'));var util=require(_0x8f78('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8f78('0x2'));var BPromise=require(_0x8f78('0x3'));var rp=require(_0x8f78('0x4'));var fs=require('fs');var path=require(_0x8f78('0x5'));var rimraf=require(_0x8f78('0x6'));var config=require(_0x8f78('0x7'));var attributes=require(_0x8f78('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8f78('0x9')]=function(_0x149c2e,_0x55921e){return _0x149c2e[_0x8f78('0xa')](_0x8f78('0xb'),attributes,{'tableName':_0x8f78('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4b3e03,_0x4b61d6,_0x379c5a){if(_0x4b3e03['changed']('zone')||_0x4b3e03[_0x8f78('0xd')]('serverUrl')||_0x4b3e03['changed'](_0x8f78('0xe'))||_0x4b3e03['changed'](_0x8f78('0xf'))||_0x4b3e03['changed'](_0x8f78('0x10'))||_0x4b3e03[_0x8f78('0xd')]('host')){var _0x3805be,_0x14fba5;_0x3805be=_0x4b3e03['serverUrl'];var _0x385fce=_0x3805be[_0x8f78('0x11')](-0x1);if(_0x385fce==='/'||_0x385fce==='\x5c'||_0x385fce===':'){_0x3805be=_0x3805be[_0x8f78('0x12')](0x0,_0x3805be[_0x8f78('0x13')](_0x385fce));}switch(_0x4b3e03['zone']){case'US':_0x14fba5=_0x8f78('0x14');break;case'AU':_0x14fba5='https://accounts.zoho.com.au';break;case'IN':_0x14fba5='https://accounts.zoho.in';break;case'CN':_0x14fba5=_0x8f78('0x15');break;default:_0x14fba5=_0x8f78('0x16');break;}var _0xad0496={'method':_0x8f78('0x17'),'uri':_0x14fba5+_0x8f78('0x18'),'form':{'grant_type':_0x8f78('0x19'),'client_id':_0x4b3e03[_0x8f78('0xe')],'client_secret':_0x4b3e03[_0x8f78('0xf')],'redirect_uri':_0x4b3e03['serverUrl'],'code':_0x4b3e03['code']},'headers':{'Content-Type':_0x8f78('0x1a')}};return rp(_0xad0496)[_0x8f78('0x1b')](function(_0x1666f4){var _0x181747=JSON[_0x8f78('0x1c')](_0x1666f4);if(_0x181747[_0x8f78('0x1d')]){_0x4b3e03[_0x8f78('0x1e')]=_0x181747[_0x8f78('0x1d')];logger[_0x8f78('0x1f')](util[_0x8f78('0x20')](_0x8f78('0x21'),_0x4b3e03[_0x8f78('0x22')],_0x4b3e03['id']));}else{logger[_0x8f78('0x23')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4b3e03[_0x8f78('0x22')],_0x4b3e03['id']),util[_0x8f78('0x24')](_0x181747,{'showHidden':![],'depth':null}));}return _0x379c5a(null,_0x4b61d6);})['catch'](function(_0x3121d0){logger[_0x8f78('0x23')](util[_0x8f78('0x20')](_0x8f78('0x25'),_0x4b3e03[_0x8f78('0x22')],_0x4b3e03['id']),util[_0x8f78('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x379c5a(_0x3121d0);});}else{return _0x379c5a(null,_0x4b61d6);}},'beforeUpdate':function(_0x304e0c,_0x30c2be,_0x105f4c){if(_0x304e0c[_0x8f78('0xd')]('zone')||_0x304e0c['changed'](_0x8f78('0x26'))||_0x304e0c['changed'](_0x8f78('0xe'))||_0x304e0c[_0x8f78('0xd')](_0x8f78('0xf'))||_0x304e0c[_0x8f78('0xd')](_0x8f78('0x10'))||_0x304e0c['changed'](_0x8f78('0x27'))){var _0x4f0970,_0x4f4e34;_0x4f0970=_0x304e0c[_0x8f78('0x26')];var _0x347971=_0x4f0970[_0x8f78('0x11')](-0x1);if(_0x347971==='/'||_0x347971==='\x5c'||_0x347971===':'){_0x4f0970=_0x4f0970['substring'](0x0,_0x4f0970[_0x8f78('0x13')](_0x347971));}switch(_0x304e0c[_0x8f78('0x28')]){case'US':_0x4f4e34=_0x8f78('0x14');break;case'AU':_0x4f4e34=_0x8f78('0x29');break;case'IN':_0x4f4e34=_0x8f78('0x2a');break;case'CN':_0x4f4e34='https://accounts.zoho.com.cn';break;default:_0x4f4e34='https://accounts.zoho.eu';break;}var _0x511c03={'method':'POST','uri':_0x4f4e34+_0x8f78('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x304e0c[_0x8f78('0xe')],'client_secret':_0x304e0c[_0x8f78('0xf')],'redirect_uri':_0x304e0c['serverUrl'],'code':_0x304e0c[_0x8f78('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x511c03)[_0x8f78('0x1b')](function(_0xcc4c8e){var _0x559fb6=JSON[_0x8f78('0x1c')](_0xcc4c8e);if(_0x559fb6[_0x8f78('0x1d')]){_0x304e0c['refreshToken']=_0x559fb6['refresh_token'];logger[_0x8f78('0x1f')](util[_0x8f78('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x304e0c['name'],_0x304e0c['id']));}else{logger[_0x8f78('0x23')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x304e0c[_0x8f78('0x22')],_0x304e0c['id']),util['inspect'](_0x559fb6,{'showHidden':![],'depth':null}));}return _0x105f4c(null,_0x30c2be);})['catch'](function(_0x3594b9){logger[_0x8f78('0x23')](util[_0x8f78('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x304e0c[_0x8f78('0x22')],_0x304e0c['id']),util[_0x8f78('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x105f4c(_0x3594b9);});}else{return _0x105f4c(null,_0x30c2be);}}}});}; \ No newline at end of file +var _0x1730=['clientId','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','then','parse','refresh_token','refreshToken','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','inspect','substring','https://accounts.zoho.in','application/x-www-form-urlencoded','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','util','api','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','int_zoho_accounts','changed','zone','serverUrl'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x1730,0x97));var _0x0173=function(_0x610e03,_0x216569){_0x610e03=_0x610e03-0x0;var _0x58f452=_0x1730[_0x610e03];return _0x58f452;};'use strict';var _=require('lodash');var util=require(_0x0173('0x0'));var logger=require('../../config/logger')(_0x0173('0x1'));var moment=require('moment');var BPromise=require(_0x0173('0x2'));var rp=require(_0x0173('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0173('0x4'));var config=require(_0x0173('0x5'));var attributes=require(_0x0173('0x6'));var integrations=require(_0x0173('0x7'));module['exports']=function(_0x331265,_0x197f49){return _0x331265[_0x0173('0x8')]('ZohoAccount',attributes,{'tableName':_0x0173('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4600ea,_0x2a4a34,_0x307531){if(_0x4600ea[_0x0173('0xa')](_0x0173('0xb'))||_0x4600ea[_0x0173('0xa')](_0x0173('0xc'))||_0x4600ea[_0x0173('0xa')](_0x0173('0xd'))||_0x4600ea[_0x0173('0xa')](_0x0173('0xe'))||_0x4600ea[_0x0173('0xa')](_0x0173('0xf'))||_0x4600ea[_0x0173('0xa')](_0x0173('0x10'))){var _0x113a20,_0x53578c;_0x113a20=_0x4600ea[_0x0173('0xc')];var _0x12062e=_0x113a20[_0x0173('0x11')](-0x1);if(_0x12062e==='/'||_0x12062e==='\x5c'||_0x12062e===':'){_0x113a20=_0x113a20['substring'](0x0,_0x113a20[_0x0173('0x12')](_0x12062e));}switch(_0x4600ea['zone']){case'US':_0x53578c=_0x0173('0x13');break;case'AU':_0x53578c=_0x0173('0x14');break;case'IN':_0x53578c='https://accounts.zoho.in';break;case'CN':_0x53578c=_0x0173('0x15');break;default:_0x53578c=_0x0173('0x16');break;}var _0x4781c4={'method':_0x0173('0x17'),'uri':_0x53578c+_0x0173('0x18'),'form':{'grant_type':_0x0173('0x19'),'client_id':_0x4600ea[_0x0173('0xd')],'client_secret':_0x4600ea[_0x0173('0xe')],'redirect_uri':_0x4600ea[_0x0173('0xc')],'code':_0x4600ea[_0x0173('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4781c4)[_0x0173('0x1a')](function(_0xc09b52){var _0x8efbe1=JSON[_0x0173('0x1b')](_0xc09b52);if(_0x8efbe1[_0x0173('0x1c')]){_0x4600ea[_0x0173('0x1d')]=_0x8efbe1['refresh_token'];logger[_0x0173('0x1e')](util[_0x0173('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4600ea[_0x0173('0x20')],_0x4600ea['id']));}else{logger[_0x0173('0x21')](util[_0x0173('0x1f')](_0x0173('0x22'),_0x4600ea[_0x0173('0x20')],_0x4600ea['id']),util['inspect'](_0x8efbe1,{'showHidden':![],'depth':null}));}return _0x307531(null,_0x2a4a34);})[_0x0173('0x23')](function(_0x59f2db){logger[_0x0173('0x21')](util[_0x0173('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4600ea[_0x0173('0x20')],_0x4600ea['id']),util[_0x0173('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x307531(_0x59f2db);});}else{return _0x307531(null,_0x2a4a34);}},'beforeUpdate':function(_0x47a6ed,_0x2547b7,_0x1f737b){if(_0x47a6ed[_0x0173('0xa')](_0x0173('0xb'))||_0x47a6ed[_0x0173('0xa')](_0x0173('0xc'))||_0x47a6ed['changed'](_0x0173('0xd'))||_0x47a6ed[_0x0173('0xa')](_0x0173('0xe'))||_0x47a6ed['changed'](_0x0173('0xf'))||_0x47a6ed['changed'](_0x0173('0x10'))){var _0x4ecdf4,_0x5b60ca;_0x4ecdf4=_0x47a6ed[_0x0173('0xc')];var _0x4bd119=_0x4ecdf4[_0x0173('0x11')](-0x1);if(_0x4bd119==='/'||_0x4bd119==='\x5c'||_0x4bd119===':'){_0x4ecdf4=_0x4ecdf4[_0x0173('0x25')](0x0,_0x4ecdf4[_0x0173('0x12')](_0x4bd119));}switch(_0x47a6ed[_0x0173('0xb')]){case'US':_0x5b60ca=_0x0173('0x13');break;case'AU':_0x5b60ca=_0x0173('0x14');break;case'IN':_0x5b60ca=_0x0173('0x26');break;case'CN':_0x5b60ca='https://accounts.zoho.com.cn';break;default:_0x5b60ca=_0x0173('0x16');break;}var _0x3c50ca={'method':'POST','uri':_0x5b60ca+_0x0173('0x18'),'form':{'grant_type':_0x0173('0x19'),'client_id':_0x47a6ed[_0x0173('0xd')],'client_secret':_0x47a6ed[_0x0173('0xe')],'redirect_uri':_0x47a6ed['serverUrl'],'code':_0x47a6ed['code']},'headers':{'Content-Type':_0x0173('0x27')}};return rp(_0x3c50ca)[_0x0173('0x1a')](function(_0x4b4b6d){var _0x1e7829=JSON[_0x0173('0x1b')](_0x4b4b6d);if(_0x1e7829[_0x0173('0x1c')]){_0x47a6ed[_0x0173('0x1d')]=_0x1e7829[_0x0173('0x1c')];logger[_0x0173('0x1e')](util[_0x0173('0x1f')](_0x0173('0x28'),_0x47a6ed[_0x0173('0x20')],_0x47a6ed['id']));}else{logger['error'](util[_0x0173('0x1f')](_0x0173('0x22'),_0x47a6ed['name'],_0x47a6ed['id']),util[_0x0173('0x24')](_0x1e7829,{'showHidden':![],'depth':null}));}return _0x1f737b(null,_0x2547b7);})[_0x0173('0x23')](function(_0x7ab0e5){logger[_0x0173('0x21')](util[_0x0173('0x1f')](_0x0173('0x22'),_0x47a6ed[_0x0173('0x20')],_0x47a6ed['id']),util[_0x0173('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x1f737b(_0x7ab0e5);});}else{return _0x1f737b(null,_0x2547b7);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 02aca5a..a047ef7 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 _0x4d68=['randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','limit','include','attributes','map','model','ShowZohoAccount','find','raw','then','lodash','util','moment','bluebird'];(function(_0x108a9b,_0x4a7f9f){var _0x309b64=function(_0x8a9d5b){while(--_0x8a9d5b){_0x108a9b['push'](_0x108a9b['shift']());}};_0x309b64(++_0x4a7f9f);}(_0x4d68,0x1c3));var _0x84d6=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x4d68[_0x59befa];return _0x1dd63d;};'use strict';var _=require(_0x84d6('0x0'));var util=require(_0x84d6('0x1'));var moment=require(_0x84d6('0x2'));var BPromise=require(_0x84d6('0x3'));var rs=require(_0x84d6('0x4'));var fs=require('fs');var Redis=require(_0x84d6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x84d6('0x6'));var logger=require('../../config/logger')(_0x84d6('0x7'));var config=require('../../config/environment');var jayson=require(_0x84d6('0x8'));var client=jayson[_0x84d6('0x9')][_0x84d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539e34,_0x561dd8,_0x218daf){return new BPromise(function(_0xa64ed3,_0x260859){return client[_0x84d6('0xb')](_0x539e34,_0x218daf)['then'](function(_0x411c7f){logger['info'](_0x84d6('0xc'),_0x561dd8,_0x84d6('0xd'));logger[_0x84d6('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x561dd8,'request\x20sent',JSON[_0x84d6('0xf')](_0x411c7f));if(_0x411c7f['error']){if(_0x411c7f[_0x84d6('0x10')][_0x84d6('0x11')]===0x1f4){logger[_0x84d6('0x10')](_0x84d6('0xc'),_0x561dd8,_0x411c7f[_0x84d6('0x10')]['message']);return _0x260859(_0x411c7f[_0x84d6('0x10')]['message']);}logger[_0x84d6('0x10')](_0x84d6('0xc'),_0x561dd8,_0x411c7f[_0x84d6('0x10')][_0x84d6('0x12')]);return _0xa64ed3(_0x411c7f[_0x84d6('0x10')][_0x84d6('0x12')]);}else{logger[_0x84d6('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x561dd8,_0x84d6('0xd'));_0xa64ed3(_0x411c7f[_0x84d6('0x14')][_0x84d6('0x12')]);}})[_0x84d6('0x15')](function(_0x385e2b){logger['error'](_0x84d6('0xc'),_0x561dd8,_0x385e2b);_0x260859(_0x385e2b);});});}exports[_0x84d6('0x16')]=function(_0x579aa8){var _0x1bd84a=this;return new Promise(function(_0x47a884,_0x309f26){return db[_0x84d6('0x17')][_0x84d6('0x18')]({'raw':_0x579aa8[_0x84d6('0x19')]?_0x579aa8[_0x84d6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x579aa8[_0x84d6('0x19')]?_0x579aa8[_0x84d6('0x19')]['where']||null:null,'attributes':_0x579aa8['options']?_0x579aa8[_0x84d6('0x19')]['attributes']||null:null,'limit':_0x579aa8['options']?_0x579aa8[_0x84d6('0x19')][_0x84d6('0x1a')]||null:null,'include':_0x579aa8[_0x84d6('0x19')]?_0x579aa8['options'][_0x84d6('0x1b')]?_['map'](_0x579aa8['options'][_0x84d6('0x1b')],function(_0x1b86f2){return{'model':db[_0x1b86f2['model']],'as':_0x1b86f2['as'],'attributes':_0x1b86f2[_0x84d6('0x1c')],'include':_0x1b86f2[_0x84d6('0x1b')]?_[_0x84d6('0x1d')](_0x1b86f2[_0x84d6('0x1b')],function(_0x5deaa5){return{'model':db[_0x5deaa5[_0x84d6('0x1e')]],'as':_0x5deaa5['as'],'attributes':_0x5deaa5['attributes'],'include':_0x5deaa5[_0x84d6('0x1b')]?_[_0x84d6('0x1d')](_0x5deaa5['include'],function(_0x500a81){return{'model':db[_0x500a81[_0x84d6('0x1e')]],'as':_0x500a81['as'],'attributes':_0x500a81['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x14eec8){logger['info'](_0x84d6('0x16'),_0x579aa8);logger['debug'](_0x84d6('0x16'),_0x579aa8,JSON[_0x84d6('0xf')](_0x14eec8));_0x47a884(_0x14eec8);})[_0x84d6('0x15')](function(_0x37adf9){logger[_0x84d6('0x10')](_0x84d6('0x16'),_0x37adf9[_0x84d6('0x12')],_0x579aa8);_0x309f26(_0x1bd84a[_0x84d6('0x10')](0x1f4,_0x37adf9[_0x84d6('0x12')]));});});};exports[_0x84d6('0x1f')]=function(_0x20c27b){var _0x1fa278=this;return new Promise(function(_0x56bc23,_0x2f60f1){return db[_0x84d6('0x17')][_0x84d6('0x20')]({'raw':_0x20c27b[_0x84d6('0x19')]?_0x20c27b[_0x84d6('0x19')][_0x84d6('0x21')]===undefined?!![]:![]:!![],'where':_0x20c27b[_0x84d6('0x19')]?_0x20c27b[_0x84d6('0x19')]['where']||null:null,'attributes':_0x20c27b[_0x84d6('0x19')]?_0x20c27b['options'][_0x84d6('0x1c')]||null:null,'include':_0x20c27b[_0x84d6('0x19')]?_0x20c27b['options'][_0x84d6('0x1b')]?_[_0x84d6('0x1d')](_0x20c27b['options'][_0x84d6('0x1b')],function(_0x6c3a2a){return{'model':db[_0x6c3a2a[_0x84d6('0x1e')]],'as':_0x6c3a2a['as'],'attributes':_0x6c3a2a[_0x84d6('0x1c')],'include':_0x6c3a2a[_0x84d6('0x1b')]?_['map'](_0x6c3a2a[_0x84d6('0x1b')],function(_0xf8d313){return{'model':db[_0xf8d313[_0x84d6('0x1e')]],'as':_0xf8d313['as'],'attributes':_0xf8d313['attributes'],'include':_0xf8d313[_0x84d6('0x1b')]?_['map'](_0xf8d313[_0x84d6('0x1b')],function(_0x525b56){return{'model':db[_0x525b56['model']],'as':_0x525b56['as'],'attributes':_0x525b56[_0x84d6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x84d6('0x22')](function(_0x45b55f){logger['info'](_0x84d6('0x1f'),_0x20c27b);logger[_0x84d6('0xe')](_0x84d6('0x1f'),_0x20c27b,JSON['stringify'](_0x45b55f));_0x56bc23(_0x45b55f);})['catch'](function(_0x531a49){logger[_0x84d6('0x10')](_0x84d6('0x1f'),_0x531a49[_0x84d6('0x12')],_0x20c27b);_0x2f60f1(_0x1fa278[_0x84d6('0x10')](0x1f4,_0x531a49[_0x84d6('0x12')]));});});}; \ No newline at end of file +var _0xf69c=['ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','GetZohoAccount','ShowZohoAccount','find','stringify','catch','lodash','moment','bluebird'];(function(_0x20e5d4,_0x4ae460){var _0x54d52a=function(_0x3c3192){while(--_0x3c3192){_0x20e5d4['push'](_0x20e5d4['shift']());}};_0x54d52a(++_0x4ae460);}(_0xf69c,0x151));var _0xcf69=function(_0x2534cf,_0x545be6){_0x2534cf=_0x2534cf-0x0;var _0x221461=_0xf69c[_0x2534cf];return _0x221461;};'use strict';var _=require(_0xcf69('0x0'));var util=require('util');var moment=require(_0xcf69('0x1'));var BPromise=require(_0xcf69('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf69('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf69('0x4'));var logger=require('../../config/logger')(_0xcf69('0x5'));var config=require('../../config/environment');var jayson=require(_0xcf69('0x6'));var client=jayson[_0xcf69('0x7')][_0xcf69('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35aa67,_0x3b7608,_0x5f1e98){return new BPromise(function(_0x38478c,_0xbeb916){return client[_0xcf69('0x9')](_0x35aa67,_0x5f1e98)[_0xcf69('0xa')](function(_0x4ab0f3){logger[_0xcf69('0xb')](_0xcf69('0xc'),_0x3b7608,_0xcf69('0xd'));logger[_0xcf69('0xe')](_0xcf69('0xf'),_0x3b7608,_0xcf69('0xd'),JSON['stringify'](_0x4ab0f3));if(_0x4ab0f3[_0xcf69('0x10')]){if(_0x4ab0f3['error'][_0xcf69('0x11')]===0x1f4){logger[_0xcf69('0x10')](_0xcf69('0xc'),_0x3b7608,_0x4ab0f3[_0xcf69('0x10')][_0xcf69('0x12')]);return _0xbeb916(_0x4ab0f3[_0xcf69('0x10')][_0xcf69('0x12')]);}logger[_0xcf69('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x3b7608,_0x4ab0f3['error']['message']);return _0x38478c(_0x4ab0f3['error'][_0xcf69('0x12')]);}else{logger['info'](_0xcf69('0xc'),_0x3b7608,_0xcf69('0xd'));_0x38478c(_0x4ab0f3[_0xcf69('0x13')][_0xcf69('0x12')]);}})['catch'](function(_0x32cbcf){logger[_0xcf69('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x3b7608,_0x32cbcf);_0xbeb916(_0x32cbcf);});});}exports['GetZohoAccount']=function(_0x438700){var _0x3198a6=this;return new Promise(function(_0x39306a,_0x318b22){return db[_0xcf69('0x14')][_0xcf69('0x15')]({'raw':_0x438700[_0xcf69('0x16')]?_0x438700[_0xcf69('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x438700[_0xcf69('0x16')]?_0x438700['options'][_0xcf69('0x17')]||null:null,'attributes':_0x438700[_0xcf69('0x16')]?_0x438700[_0xcf69('0x16')][_0xcf69('0x18')]||null:null,'limit':_0x438700[_0xcf69('0x16')]?_0x438700[_0xcf69('0x16')][_0xcf69('0x19')]||null:null,'include':_0x438700[_0xcf69('0x16')]?_0x438700[_0xcf69('0x16')][_0xcf69('0x1a')]?_[_0xcf69('0x1b')](_0x438700[_0xcf69('0x16')][_0xcf69('0x1a')],function(_0x3ae015){return{'model':db[_0x3ae015[_0xcf69('0x1c')]],'as':_0x3ae015['as'],'attributes':_0x3ae015['attributes'],'include':_0x3ae015[_0xcf69('0x1a')]?_[_0xcf69('0x1b')](_0x3ae015[_0xcf69('0x1a')],function(_0x278ce3){return{'model':db[_0x278ce3[_0xcf69('0x1c')]],'as':_0x278ce3['as'],'attributes':_0x278ce3[_0xcf69('0x18')],'include':_0x278ce3['include']?_['map'](_0x278ce3[_0xcf69('0x1a')],function(_0x59de98){return{'model':db[_0x59de98[_0xcf69('0x1c')]],'as':_0x59de98['as'],'attributes':_0x59de98[_0xcf69('0x18')]};}):[]};}):[]};}):[]:[]})[_0xcf69('0xa')](function(_0x42dbed){logger[_0xcf69('0xb')](_0xcf69('0x1d'),_0x438700);logger[_0xcf69('0xe')](_0xcf69('0x1d'),_0x438700,JSON['stringify'](_0x42dbed));_0x39306a(_0x42dbed);})['catch'](function(_0x949f5e){logger[_0xcf69('0x10')](_0xcf69('0x1d'),_0x949f5e[_0xcf69('0x12')],_0x438700);_0x318b22(_0x3198a6['error'](0x1f4,_0x949f5e[_0xcf69('0x12')]));});});};exports[_0xcf69('0x1e')]=function(_0x7a011b){var _0x477511=this;return new Promise(function(_0x42974d,_0x38c227){return db[_0xcf69('0x14')][_0xcf69('0x1f')]({'raw':_0x7a011b[_0xcf69('0x16')]?_0x7a011b[_0xcf69('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x7a011b[_0xcf69('0x16')]?_0x7a011b['options'][_0xcf69('0x17')]||null:null,'attributes':_0x7a011b[_0xcf69('0x16')]?_0x7a011b[_0xcf69('0x16')][_0xcf69('0x18')]||null:null,'include':_0x7a011b[_0xcf69('0x16')]?_0x7a011b[_0xcf69('0x16')][_0xcf69('0x1a')]?_[_0xcf69('0x1b')](_0x7a011b[_0xcf69('0x16')][_0xcf69('0x1a')],function(_0x573618){return{'model':db[_0x573618[_0xcf69('0x1c')]],'as':_0x573618['as'],'attributes':_0x573618[_0xcf69('0x18')],'include':_0x573618['include']?_[_0xcf69('0x1b')](_0x573618['include'],function(_0x4018ac){return{'model':db[_0x4018ac['model']],'as':_0x4018ac['as'],'attributes':_0x4018ac['attributes'],'include':_0x4018ac[_0xcf69('0x1a')]?_[_0xcf69('0x1b')](_0x4018ac[_0xcf69('0x1a')],function(_0x40221e){return{'model':db[_0x40221e[_0xcf69('0x1c')]],'as':_0x40221e['as'],'attributes':_0x40221e[_0xcf69('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d5217){logger[_0xcf69('0xb')](_0xcf69('0x1e'),_0x7a011b);logger[_0xcf69('0xe')](_0xcf69('0x1e'),_0x7a011b,JSON[_0xcf69('0x20')](_0x5d5217));_0x42974d(_0x5d5217);})[_0xcf69('0x21')](function(_0x474009){logger[_0xcf69('0x10')](_0xcf69('0x1e'),_0x474009[_0xcf69('0x12')],_0x7a011b);_0x38c227(_0x477511[_0xcf69('0x10')](0x1f4,_0x474009[_0xcf69('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index c9c7cec..a354483 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 _0x7e74=['/:id/subjects','/:id/descriptions','create','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','index','/:id','isAuthenticated','show','get','getFields'];(function(_0x2ba36d,_0x5a7d92){var _0x53e49d=function(_0x2c200b){while(--_0x2c200b){_0x2ba36d['push'](_0x2ba36d['shift']());}};_0x53e49d(++_0x5a7d92);}(_0x7e74,0x16e));var _0x47e7=function(_0xc788db,_0x135a58){_0xc788db=_0xc788db-0x0;var _0x48c197=_0x7e74[_0xc788db];return _0x48c197;};'use strict';var multer=require(_0x47e7('0x0'));var util=require('util');var path=require(_0x47e7('0x1'));var timeout=require(_0x47e7('0x2'));var express=require(_0x47e7('0x3'));var router=express['Router']();var fs_extra=require(_0x47e7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x47e7('0x5'));var config=require(_0x47e7('0x6'));var controller=require(_0x47e7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x47e7('0x8')]);router['get'](_0x47e7('0x9'),auth[_0x47e7('0xa')](),controller[_0x47e7('0xb')]);router[_0x47e7('0xc')]('/:id/fields',auth[_0x47e7('0xa')](),controller[_0x47e7('0xd')]);router['get'](_0x47e7('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x47e7('0xc')](_0x47e7('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x47e7('0xa')](),controller[_0x47e7('0x10')]);router['put']('/:id',auth[_0x47e7('0xa')](),controller[_0x47e7('0x11')]);router['delete']('/:id',auth[_0x47e7('0xa')](),controller[_0x47e7('0x12')]);module[_0x47e7('0x13')]=router; \ No newline at end of file +var _0xfd39=['getFields','getSubjects','/:id/descriptions','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/fields'];(function(_0x4c6f53,_0x5cf77e){var _0x406b1d=function(_0x5c31e7){while(--_0x5c31e7){_0x4c6f53['push'](_0x4c6f53['shift']());}};_0x406b1d(++_0x5cf77e);}(_0xfd39,0x1d5));var _0x9fd3=function(_0x8a1d70,_0x478d8f){_0x8a1d70=_0x8a1d70-0x0;var _0x2f6e5a=_0xfd39[_0x8a1d70];return _0x2f6e5a;};'use strict';var multer=require(_0x9fd3('0x0'));var util=require(_0x9fd3('0x1'));var path=require('path');var timeout=require(_0x9fd3('0x2'));var express=require(_0x9fd3('0x3'));var router=express['Router']();var fs_extra=require(_0x9fd3('0x4'));var auth=require(_0x9fd3('0x5'));var interaction=require(_0x9fd3('0x6'));var config=require(_0x9fd3('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x9fd3('0x8')]('/',auth[_0x9fd3('0x9')](),controller['index']);router[_0x9fd3('0x8')]('/:id',auth[_0x9fd3('0x9')](),controller['show']);router[_0x9fd3('0x8')](_0x9fd3('0xa'),auth[_0x9fd3('0x9')](),controller[_0x9fd3('0xb')]);router['get']('/:id/subjects',auth[_0x9fd3('0x9')](),controller[_0x9fd3('0xc')]);router['get'](_0x9fd3('0xd'),auth[_0x9fd3('0x9')](),controller['getDescriptions']);router['post']('/',auth[_0x9fd3('0x9')](),controller[_0x9fd3('0xe')]);router[_0x9fd3('0xf')](_0x9fd3('0x10'),auth[_0x9fd3('0x9')](),controller[_0x9fd3('0x11')]);router[_0x9fd3('0x12')](_0x9fd3('0x10'),auth[_0x9fd3('0x9')](),controller['destroy']);module[_0x9fd3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index c9d2d4e..7abad32 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 _0x41ba=['lead','sequelize','exports','STRING','ENUM','contact','nothing'];(function(_0x15adce,_0x841de0){var _0x371421=function(_0x217997){while(--_0x217997){_0x15adce['push'](_0x15adce['shift']());}};_0x371421(++_0x841de0);}(_0x41ba,0x6a));var _0xa41b=function(_0x4f448b,_0x438246){_0x4f448b=_0x4f448b-0x0;var _0x3c4a8b=_0x41ba[_0x4f448b];return _0x3c4a8b;};'use strict';var Sequelize=require(_0xa41b('0x0'));module[_0xa41b('0x1')]={'name':{'type':Sequelize[_0xa41b('0x2')]},'moduleCreate':{'type':Sequelize[_0xa41b('0x3')]('lead',_0xa41b('0x4'),_0xa41b('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xa41b('0x3')]('contact_lead',_0xa41b('0x4'),_0xa41b('0x6')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xa41b('0x2')]}}; \ No newline at end of file +var _0x813e=['nothing','contact_lead','sequelize','exports','STRING','ENUM','lead','contact'];(function(_0x28a424,_0x192c51){var _0x230939=function(_0x103fd0){while(--_0x103fd0){_0x28a424['push'](_0x28a424['shift']());}};_0x230939(++_0x192c51);}(_0x813e,0xba));var _0xe813=function(_0x56de0b,_0x1c39c1){_0x56de0b=_0x56de0b-0x0;var _0x1c05f0=_0x813e[_0x56de0b];return _0x1c05f0;};'use strict';var Sequelize=require(_0xe813('0x0'));module[_0xe813('0x1')]={'name':{'type':Sequelize[_0xe813('0x2')]},'moduleCreate':{'type':Sequelize[_0xe813('0x3')](_0xe813('0x4'),_0xe813('0x5'),_0xe813('0x6')),'defaultValue':_0xe813('0x4')},'moduleSearch':{'type':Sequelize[_0xe813('0x3')](_0xe813('0x7'),'contact',_0xe813('0x4')),'defaultValue':_0xe813('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 955e131..2aedaf6 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 _0xeb7d=['find','findOne','ZohoField','getFields','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoConfiguration','includeAll','include','params','catch','create','body'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0xeb7d,0xf3));var _0xdeb7=function(_0x2997d1,_0x37a166){_0x2997d1=_0x2997d1-0x0;var _0x77f916=_0xeb7d[_0x2997d1];return _0x77f916;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdeb7('0x0'));var zipdir=require(_0xdeb7('0x1'));var jsonpatch=require(_0xdeb7('0x2'));var rp=require(_0xdeb7('0x3'));var moment=require(_0xdeb7('0x4'));var BPromise=require(_0xdeb7('0x5'));var Mustache=require(_0xdeb7('0x6'));var util=require(_0xdeb7('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xdeb7('0x8'));var ejs=require(_0xdeb7('0x9'));var fs=require('fs');var fs_extra=require(_0xdeb7('0xa'));var _=require(_0xdeb7('0xb'));var squel=require(_0xdeb7('0xc'));var crypto=require(_0xdeb7('0xd'));var jsforce=require(_0xdeb7('0xe'));var deskjs=require(_0xdeb7('0xf'));var toCsv=require(_0xdeb7('0x8'));var querystring=require(_0xdeb7('0x10'));var Papa=require('papaparse');var Redis=require(_0xdeb7('0x11'));var authService=require(_0xdeb7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdeb7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdeb7('0x14'))('api');var utils=require(_0xdeb7('0x15'));var config=require(_0xdeb7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdeb7('0x17'))['db'];function respondWithStatusCode(_0x5cffae,_0x432ec4){_0x432ec4=_0x432ec4||0xcc;return function(_0x50fdc6){if(_0x50fdc6){return _0x5cffae[_0xdeb7('0x18')](_0x432ec4);}return _0x5cffae['status'](_0x432ec4)['end']();};}function respondWithResult(_0x1a5225,_0x85e6c5){_0x85e6c5=_0x85e6c5||0xc8;return function(_0x3fa1e9){if(_0x3fa1e9){return _0x1a5225[_0xdeb7('0x19')](_0x85e6c5)[_0xdeb7('0x1a')](_0x3fa1e9);}};}function respondWithFilteredResult(_0xa1c533,_0x2bfb67){return function(_0x3684ec){if(_0x3684ec){var _0x1445a3=typeof _0x2bfb67[_0xdeb7('0x1b')]===_0xdeb7('0x1c')&&typeof _0x2bfb67[_0xdeb7('0x1d')]===_0xdeb7('0x1c');var _0x135727=_0x3684ec[_0xdeb7('0x1e')];var _0x5f2838=_0x1445a3?0x0:_0x2bfb67[_0xdeb7('0x1b')];var _0x244c9b=_0x1445a3?_0x3684ec[_0xdeb7('0x1e')]:_0x2bfb67[_0xdeb7('0x1b')]+_0x2bfb67[_0xdeb7('0x1d')];var _0x441cf5;if(_0x244c9b>=_0x135727){_0x244c9b=_0x135727;_0x441cf5=0xc8;}else{_0x441cf5=0xce;}_0xa1c533[_0xdeb7('0x19')](_0x441cf5);return _0xa1c533['set'](_0xdeb7('0x1f'),_0x5f2838+'-'+_0x244c9b+'/'+_0x135727)[_0xdeb7('0x1a')](_0x3684ec);}return null;};}function patchUpdates(_0x4d409d){return function(_0x3d5528){try{jsonpatch[_0xdeb7('0x20')](_0x3d5528,_0x4d409d,!![]);}catch(_0x9ec081){return BPromise[_0xdeb7('0x21')](_0x9ec081);}return _0x3d5528[_0xdeb7('0x22')]();};}function saveUpdates(_0x17e034,_0x58701f){return function(_0x2927af){if(_0x2927af){return _0x2927af[_0xdeb7('0x23')](_0x17e034)['then'](function(_0x16d52a){return _0x16d52a;});}return null;};}function removeEntity(_0x45023f,_0xae11dc){return function(_0x2aba66){if(_0x2aba66){return _0x2aba66[_0xdeb7('0x24')]()[_0xdeb7('0x25')](function(){_0x45023f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x223b5b,_0x1119a6){return function(_0x28bf4c){if(!_0x28bf4c){_0x223b5b[_0xdeb7('0x18')](0x194);}return _0x28bf4c;};}function handleError(_0x53fa64,_0x3505d2){_0x3505d2=_0x3505d2||0x1f4;return function(_0x179b7b){logger[_0xdeb7('0x26')](_0x179b7b[_0xdeb7('0x27')]);if(_0x179b7b[_0xdeb7('0x28')]){delete _0x179b7b[_0xdeb7('0x28')];}_0x53fa64[_0xdeb7('0x19')](_0x3505d2)[_0xdeb7('0x29')](_0x179b7b);};}exports[_0xdeb7('0x2a')]=function(_0x24d85b,_0x19a7c9){var _0x238316={},_0x29e673={},_0x3404ec={'count':0x0,'rows':[]};var _0x2d5156=_[_0xdeb7('0x2b')](db['ZohoConfiguration'][_0xdeb7('0x2c')],function(_0x20d6f7){return{'name':_0x20d6f7[_0xdeb7('0x2d')],'type':_0x20d6f7[_0xdeb7('0x2e')][_0xdeb7('0x2f')]};});_0x29e673['model']=_[_0xdeb7('0x2b')](_0x2d5156,'name');_0x29e673[_0xdeb7('0x30')]=_[_0xdeb7('0x31')](_0x24d85b[_0xdeb7('0x30')]);_0x29e673[_0xdeb7('0x32')]=_[_0xdeb7('0x33')](_0x29e673[_0xdeb7('0x34')],_0x29e673[_0xdeb7('0x30')]);_0x238316[_0xdeb7('0x35')]=_[_0xdeb7('0x33')](_0x29e673[_0xdeb7('0x34')],qs[_0xdeb7('0x36')](_0x24d85b[_0xdeb7('0x30')]['fields']));_0x238316[_0xdeb7('0x35')]=_0x238316['attributes'][_0xdeb7('0x37')]?_0x238316[_0xdeb7('0x35')]:_0x29e673[_0xdeb7('0x34')];if(!_0x24d85b[_0xdeb7('0x30')][_0xdeb7('0x38')](_0xdeb7('0x39'))){_0x238316[_0xdeb7('0x1d')]=qs[_0xdeb7('0x1d')](_0x24d85b[_0xdeb7('0x30')][_0xdeb7('0x1d')]);_0x238316['offset']=qs['offset'](_0x24d85b[_0xdeb7('0x30')]['offset']);}_0x238316[_0xdeb7('0x3a')]=qs[_0xdeb7('0x3b')](_0x24d85b[_0xdeb7('0x30')][_0xdeb7('0x3b')]);_0x238316[_0xdeb7('0x3c')]=qs[_0xdeb7('0x32')](_[_0xdeb7('0x3d')](_0x24d85b['query'],_0x29e673['filters']),_0x2d5156);if(_0x24d85b['query'][_0xdeb7('0x3e')]){_0x238316[_0xdeb7('0x3c')]=_[_0xdeb7('0x3f')](_0x238316['where'],{'$or':_['map'](_0x2d5156,function(_0x4445ba){if(_0x4445ba[_0xdeb7('0x2e')]!==_0xdeb7('0x40')){var _0x1cd006={};_0x1cd006[_0x4445ba['name']]={'$like':'%'+_0x24d85b['query'][_0xdeb7('0x3e')]+'%'};return _0x1cd006;}})});}_0x238316=_[_0xdeb7('0x3f')]({},_0x238316,_0x24d85b[_0xdeb7('0x41')]);var _0x1df444={'where':_0x238316[_0xdeb7('0x3c')]};return db[_0xdeb7('0x42')][_0xdeb7('0x1e')](_0x1df444)['then'](function(_0x3ef5f0){_0x3404ec[_0xdeb7('0x1e')]=_0x3ef5f0;if(_0x24d85b[_0xdeb7('0x30')][_0xdeb7('0x43')]){_0x238316[_0xdeb7('0x44')]=[{'all':!![]}];}return db[_0xdeb7('0x42')]['findAll'](_0x238316);})[_0xdeb7('0x25')](function(_0x91c8a3){_0x3404ec['rows']=_0x91c8a3;return _0x3404ec;})['then'](respondWithFilteredResult(_0x19a7c9,_0x238316))['catch'](handleError(_0x19a7c9,null));};exports['show']=function(_0x8ef822,_0x491069){var _0x38110d={'raw':![],'where':{'id':_0x8ef822[_0xdeb7('0x45')]['id']}},_0x5dfe9b={};_0x5dfe9b['model']=_[_0xdeb7('0x31')](db[_0xdeb7('0x42')][_0xdeb7('0x2c')]);_0x5dfe9b[_0xdeb7('0x30')]=_[_0xdeb7('0x31')](_0x8ef822['query']);_0x5dfe9b[_0xdeb7('0x32')]=_[_0xdeb7('0x33')](_0x5dfe9b[_0xdeb7('0x34')],_0x5dfe9b[_0xdeb7('0x30')]);_0x38110d[_0xdeb7('0x35')]=_[_0xdeb7('0x33')](_0x5dfe9b[_0xdeb7('0x34')],qs[_0xdeb7('0x36')](_0x8ef822[_0xdeb7('0x30')][_0xdeb7('0x36')]));_0x38110d['attributes']=_0x38110d['attributes']['length']?_0x38110d[_0xdeb7('0x35')]:_0x5dfe9b['model'];if(_0x8ef822['query']['includeAll']){_0x38110d[_0xdeb7('0x44')]=[{'all':!![]}];}_0x38110d=_[_0xdeb7('0x3f')]({},_0x38110d,_0x8ef822[_0xdeb7('0x41')]);return db['ZohoConfiguration']['find'](_0x38110d)[_0xdeb7('0x25')](handleEntityNotFound(_0x491069,null))[_0xdeb7('0x25')](respondWithResult(_0x491069,null))[_0xdeb7('0x46')](handleError(_0x491069,null));};exports[_0xdeb7('0x47')]=function(_0x22630f,_0x5fbde1){return db['ZohoConfiguration'][_0xdeb7('0x47')](_0x22630f['body'],{})[_0xdeb7('0x25')](respondWithResult(_0x5fbde1,0xc9))[_0xdeb7('0x46')](handleError(_0x5fbde1,null));};exports[_0xdeb7('0x23')]=function(_0x4a5e8b,_0x55025f){if(_0x4a5e8b['body']['id']){delete _0x4a5e8b[_0xdeb7('0x48')]['id'];}return db[_0xdeb7('0x42')][_0xdeb7('0x49')]({'where':{'id':_0x4a5e8b[_0xdeb7('0x45')]['id']}})[_0xdeb7('0x25')](handleEntityNotFound(_0x55025f,null))[_0xdeb7('0x25')](saveUpdates(_0x4a5e8b[_0xdeb7('0x48')],null))[_0xdeb7('0x25')](respondWithResult(_0x55025f,null))[_0xdeb7('0x46')](handleError(_0x55025f,null));};exports[_0xdeb7('0x24')]=function(_0x4049e2,_0x24c881){return db['ZohoConfiguration']['find']({'where':{'id':_0x4049e2['params']['id']}})[_0xdeb7('0x25')](handleEntityNotFound(_0x24c881,null))[_0xdeb7('0x25')](removeEntity(_0x24c881,null))[_0xdeb7('0x46')](handleError(_0x24c881,null));};exports['getFields']=function(_0x114dc8,_0x3666a4,_0x130f0c){var _0x5394e7={};var _0x2ff524={};var _0x2fd91a;var _0x2f5b2a;return db['ZohoConfiguration'][_0xdeb7('0x4a')]({'where':{'id':_0x114dc8[_0xdeb7('0x45')]['id']}})['then'](handleEntityNotFound(_0x3666a4,null))[_0xdeb7('0x25')](function(_0x25e3d6){if(_0x25e3d6){_0x2fd91a=_0x25e3d6;_0x2ff524[_0xdeb7('0x34')]=_['keys'](db[_0xdeb7('0x4b')][_0xdeb7('0x2c')]);_0x2ff524[_0xdeb7('0x30')]=_[_0xdeb7('0x31')](_0x114dc8[_0xdeb7('0x30')]);_0x2ff524[_0xdeb7('0x32')]=_[_0xdeb7('0x33')](_0x2ff524[_0xdeb7('0x34')],_0x2ff524[_0xdeb7('0x30')]);_0x5394e7[_0xdeb7('0x35')]=_['intersection'](_0x2ff524['model'],qs[_0xdeb7('0x36')](_0x114dc8[_0xdeb7('0x30')][_0xdeb7('0x36')]));_0x5394e7[_0xdeb7('0x35')]=_0x5394e7['attributes'][_0xdeb7('0x37')]?_0x5394e7['attributes']:_0x2ff524[_0xdeb7('0x34')];_0x5394e7[_0xdeb7('0x3a')]=qs[_0xdeb7('0x3b')](_0x114dc8[_0xdeb7('0x30')]['sort']);_0x5394e7[_0xdeb7('0x3c')]=qs[_0xdeb7('0x32')](_[_0xdeb7('0x3d')](_0x114dc8[_0xdeb7('0x30')],_0x2ff524[_0xdeb7('0x32')]));if(_0x114dc8[_0xdeb7('0x30')][_0xdeb7('0x3e')]){_0x5394e7[_0xdeb7('0x3c')]=_['merge'](_0x5394e7[_0xdeb7('0x3c')],{'$or':_[_0xdeb7('0x2b')](_0x5394e7['attributes'],function(_0x4b19a6){var _0x5836f7={};_0x5836f7[_0x4b19a6]={'$like':'%'+_0x114dc8[_0xdeb7('0x30')]['filter']+'%'};return _0x5836f7;})});}_0x5394e7=_[_0xdeb7('0x3f')]({},_0x5394e7,_0x114dc8['options']);return _0x2fd91a[_0xdeb7('0x4c')](_0x5394e7);}})[_0xdeb7('0x25')](function(_0x42a725){if(_0x42a725){_0x2f5b2a=_0x42a725[_0xdeb7('0x37')];if(!_0x114dc8[_0xdeb7('0x30')][_0xdeb7('0x38')](_0xdeb7('0x39'))){_0x5394e7[_0xdeb7('0x1d')]=qs['limit'](_0x114dc8[_0xdeb7('0x30')][_0xdeb7('0x1d')]);_0x5394e7['offset']=qs[_0xdeb7('0x1b')](_0x114dc8['query'][_0xdeb7('0x1b')]);}return _0x2fd91a['getFields'](_0x5394e7);}})[_0xdeb7('0x25')](function(_0x39e59b){if(_0x39e59b){return _0x39e59b?{'count':_0x2f5b2a,'rows':_0x39e59b}:null;}})['then'](respondWithResult(_0x3666a4,null))[_0xdeb7('0x46')](handleError(_0x3666a4,null));};exports['getSubjects']=function(_0x4d652a,_0x420e25,_0x812cd){var _0x2945ac={};var _0xa0d037={};var _0x242e10;var _0x4b6292;return db[_0xdeb7('0x42')]['findOne']({'where':{'id':_0x4d652a[_0xdeb7('0x45')]['id']}})[_0xdeb7('0x25')](handleEntityNotFound(_0x420e25,null))[_0xdeb7('0x25')](function(_0x59bad3){if(_0x59bad3){_0x242e10=_0x59bad3;_0xa0d037[_0xdeb7('0x34')]=_[_0xdeb7('0x31')](db[_0xdeb7('0x4b')][_0xdeb7('0x2c')]);_0xa0d037[_0xdeb7('0x30')]=_[_0xdeb7('0x31')](_0x4d652a['query']);_0xa0d037[_0xdeb7('0x32')]=_['intersection'](_0xa0d037[_0xdeb7('0x34')],_0xa0d037[_0xdeb7('0x30')]);_0x2945ac[_0xdeb7('0x35')]=_[_0xdeb7('0x33')](_0xa0d037[_0xdeb7('0x34')],qs[_0xdeb7('0x36')](_0x4d652a[_0xdeb7('0x30')][_0xdeb7('0x36')]));_0x2945ac[_0xdeb7('0x35')]=_0x2945ac[_0xdeb7('0x35')][_0xdeb7('0x37')]?_0x2945ac['attributes']:_0xa0d037[_0xdeb7('0x34')];_0x2945ac[_0xdeb7('0x3a')]=qs[_0xdeb7('0x3b')](_0x4d652a[_0xdeb7('0x30')][_0xdeb7('0x3b')]);_0x2945ac[_0xdeb7('0x3c')]=qs['filters'](_[_0xdeb7('0x3d')](_0x4d652a['query'],_0xa0d037[_0xdeb7('0x32')]));if(_0x4d652a[_0xdeb7('0x30')]['filter']){_0x2945ac[_0xdeb7('0x3c')]=_[_0xdeb7('0x3f')](_0x2945ac[_0xdeb7('0x3c')],{'$or':_[_0xdeb7('0x2b')](_0x2945ac[_0xdeb7('0x35')],function(_0x15c30f){var _0x46ad69={};_0x46ad69[_0x15c30f]={'$like':'%'+_0x4d652a[_0xdeb7('0x30')][_0xdeb7('0x3e')]+'%'};return _0x46ad69;})});}_0x2945ac=_[_0xdeb7('0x3f')]({},_0x2945ac,_0x4d652a[_0xdeb7('0x41')]);return _0x242e10[_0xdeb7('0x4d')](_0x2945ac);}})['then'](function(_0x186027){if(_0x186027){_0x4b6292=_0x186027[_0xdeb7('0x37')];if(!_0x4d652a[_0xdeb7('0x30')][_0xdeb7('0x38')]('nolimit')){_0x2945ac[_0xdeb7('0x1d')]=qs['limit'](_0x4d652a[_0xdeb7('0x30')][_0xdeb7('0x1d')]);_0x2945ac[_0xdeb7('0x1b')]=qs[_0xdeb7('0x1b')](_0x4d652a[_0xdeb7('0x30')][_0xdeb7('0x1b')]);}return _0x242e10[_0xdeb7('0x4d')](_0x2945ac);}})['then'](function(_0x245187){if(_0x245187){return _0x245187?{'count':_0x4b6292,'rows':_0x245187}:null;}})[_0xdeb7('0x25')](respondWithResult(_0x420e25,null))[_0xdeb7('0x46')](handleError(_0x420e25,null));};exports[_0xdeb7('0x4e')]=function(_0x2a6ded,_0x55136c,_0x37c010){var _0xfaaa5c={};var _0x35a5f3={};var _0x33b477;var _0x5d930b;return db[_0xdeb7('0x42')][_0xdeb7('0x4a')]({'where':{'id':_0x2a6ded[_0xdeb7('0x45')]['id']}})['then'](handleEntityNotFound(_0x55136c,null))[_0xdeb7('0x25')](function(_0x578b3a){if(_0x578b3a){_0x33b477=_0x578b3a;_0x35a5f3[_0xdeb7('0x34')]=_['keys'](db[_0xdeb7('0x4b')][_0xdeb7('0x2c')]);_0x35a5f3[_0xdeb7('0x30')]=_[_0xdeb7('0x31')](_0x2a6ded[_0xdeb7('0x30')]);_0x35a5f3[_0xdeb7('0x32')]=_[_0xdeb7('0x33')](_0x35a5f3[_0xdeb7('0x34')],_0x35a5f3['query']);_0xfaaa5c['attributes']=_['intersection'](_0x35a5f3[_0xdeb7('0x34')],qs[_0xdeb7('0x36')](_0x2a6ded[_0xdeb7('0x30')]['fields']));_0xfaaa5c[_0xdeb7('0x35')]=_0xfaaa5c[_0xdeb7('0x35')][_0xdeb7('0x37')]?_0xfaaa5c[_0xdeb7('0x35')]:_0x35a5f3[_0xdeb7('0x34')];_0xfaaa5c[_0xdeb7('0x3a')]=qs['sort'](_0x2a6ded['query'][_0xdeb7('0x3b')]);_0xfaaa5c[_0xdeb7('0x3c')]=qs['filters'](_[_0xdeb7('0x3d')](_0x2a6ded[_0xdeb7('0x30')],_0x35a5f3[_0xdeb7('0x32')]));if(_0x2a6ded[_0xdeb7('0x30')][_0xdeb7('0x3e')]){_0xfaaa5c[_0xdeb7('0x3c')]=_[_0xdeb7('0x3f')](_0xfaaa5c[_0xdeb7('0x3c')],{'$or':_[_0xdeb7('0x2b')](_0xfaaa5c[_0xdeb7('0x35')],function(_0x6120bc){var _0x32b533={};_0x32b533[_0x6120bc]={'$like':'%'+_0x2a6ded['query']['filter']+'%'};return _0x32b533;})});}_0xfaaa5c=_[_0xdeb7('0x3f')]({},_0xfaaa5c,_0x2a6ded[_0xdeb7('0x41')]);return _0x33b477['getDescriptions'](_0xfaaa5c);}})[_0xdeb7('0x25')](function(_0x3deaff){if(_0x3deaff){_0x5d930b=_0x3deaff['length'];if(!_0x2a6ded[_0xdeb7('0x30')][_0xdeb7('0x38')](_0xdeb7('0x39'))){_0xfaaa5c[_0xdeb7('0x1d')]=qs[_0xdeb7('0x1d')](_0x2a6ded['query'][_0xdeb7('0x1d')]);_0xfaaa5c[_0xdeb7('0x1b')]=qs[_0xdeb7('0x1b')](_0x2a6ded[_0xdeb7('0x30')][_0xdeb7('0x1b')]);}return _0x33b477[_0xdeb7('0x4e')](_0xfaaa5c);}})[_0xdeb7('0x25')](function(_0x5b95f5){if(_0x5b95f5){return _0x5b95f5?{'count':_0x5d930b,'rows':_0x5b95f5}:null;}})[_0xdeb7('0x25')](respondWithResult(_0x55136c,null))[_0xdeb7('0x46')](handleError(_0x55136c,null));}; \ No newline at end of file +var _0x31fe=['fast-json-patch','request-promise','bluebird','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','error','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','destroy','findOne','hasOwnProperty','getFields','getSubjects','ZohoField','getDescriptions','eml-format','zip-dir'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x31fe,0x136));var _0xe31f=function(_0x1cc10a,_0x169f74){_0x1cc10a=_0x1cc10a-0x0;var _0x5391dd=_0x31fe[_0x1cc10a];return _0x5391dd;};'use strict';var emlformat=require(_0xe31f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe31f('0x1'));var jsonpatch=require(_0xe31f('0x2'));var rp=require(_0xe31f('0x3'));var moment=require('moment');var BPromise=require(_0xe31f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe31f('0x5'));var sox=require(_0xe31f('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe31f('0x7'));var _=require(_0xe31f('0x8'));var squel=require(_0xe31f('0x9'));var crypto=require(_0xe31f('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe31f('0xb'));var querystring=require('querystring');var Papa=require(_0xe31f('0xc'));var Redis=require(_0xe31f('0xd'));var authService=require(_0xe31f('0xe'));var qs=require(_0xe31f('0xf'));var as=require(_0xe31f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe31f('0x11'))(_0xe31f('0x12'));var utils=require('../../config/utils');var config=require(_0xe31f('0x13'));var licenseUtil=require(_0xe31f('0x14'));var db=require(_0xe31f('0x15'))['db'];function respondWithStatusCode(_0x35be62,_0x4deb56){_0x4deb56=_0x4deb56||0xcc;return function(_0x106654){if(_0x106654){return _0x35be62[_0xe31f('0x16')](_0x4deb56);}return _0x35be62[_0xe31f('0x17')](_0x4deb56)['end']();};}function respondWithResult(_0x1b9148,_0x4a9f72){_0x4a9f72=_0x4a9f72||0xc8;return function(_0x4a0417){if(_0x4a0417){return _0x1b9148['status'](_0x4a9f72)['json'](_0x4a0417);}};}function respondWithFilteredResult(_0x5c2d7e,_0x16f0f5){return function(_0x375966){if(_0x375966){var _0x312e17=typeof _0x16f0f5[_0xe31f('0x18')]===_0xe31f('0x19')&&typeof _0x16f0f5['limit']==='undefined';var _0x3b92a3=_0x375966[_0xe31f('0x1a')];var _0x3bdb48=_0x312e17?0x0:_0x16f0f5[_0xe31f('0x18')];var _0x1b2405=_0x312e17?_0x375966[_0xe31f('0x1a')]:_0x16f0f5[_0xe31f('0x18')]+_0x16f0f5[_0xe31f('0x1b')];var _0x36a30a;if(_0x1b2405>=_0x3b92a3){_0x1b2405=_0x3b92a3;_0x36a30a=0xc8;}else{_0x36a30a=0xce;}_0x5c2d7e[_0xe31f('0x17')](_0x36a30a);return _0x5c2d7e[_0xe31f('0x1c')](_0xe31f('0x1d'),_0x3bdb48+'-'+_0x1b2405+'/'+_0x3b92a3)['json'](_0x375966);}return null;};}function patchUpdates(_0x16b005){return function(_0x27e5eb){try{jsonpatch[_0xe31f('0x1e')](_0x27e5eb,_0x16b005,!![]);}catch(_0x5c3069){return BPromise['reject'](_0x5c3069);}return _0x27e5eb[_0xe31f('0x1f')]();};}function saveUpdates(_0x2d9a3b,_0x4bd2b5){return function(_0x5d7491){if(_0x5d7491){return _0x5d7491[_0xe31f('0x20')](_0x2d9a3b)[_0xe31f('0x21')](function(_0x940c68){return _0x940c68;});}return null;};}function removeEntity(_0x8c1bd,_0x5cb780){return function(_0x25b95d){if(_0x25b95d){return _0x25b95d['destroy']()[_0xe31f('0x21')](function(){_0x8c1bd[_0xe31f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3837ce,_0x17b5df){return function(_0x2bfb1d){if(!_0x2bfb1d){_0x3837ce[_0xe31f('0x16')](0x194);}return _0x2bfb1d;};}function handleError(_0x3d0627,_0x4b5879){_0x4b5879=_0x4b5879||0x1f4;return function(_0x146efe){logger[_0xe31f('0x22')](_0x146efe['stack']);if(_0x146efe['name']){delete _0x146efe['name'];}_0x3d0627[_0xe31f('0x17')](_0x4b5879)[_0xe31f('0x23')](_0x146efe);};}exports[_0xe31f('0x24')]=function(_0x36ec67,_0x17788e){var _0x479cf1={},_0x12835a={},_0x54f7cf={'count':0x0,'rows':[]};var _0x5b1ca1=_[_0xe31f('0x25')](db[_0xe31f('0x26')][_0xe31f('0x27')],function(_0x17095b){return{'name':_0x17095b[_0xe31f('0x28')],'type':_0x17095b[_0xe31f('0x29')][_0xe31f('0x2a')]};});_0x12835a['model']=_[_0xe31f('0x25')](_0x5b1ca1,'name');_0x12835a[_0xe31f('0x2b')]=_[_0xe31f('0x2c')](_0x36ec67[_0xe31f('0x2b')]);_0x12835a[_0xe31f('0x2d')]=_[_0xe31f('0x2e')](_0x12835a[_0xe31f('0x2f')],_0x12835a[_0xe31f('0x2b')]);_0x479cf1[_0xe31f('0x30')]=_[_0xe31f('0x2e')](_0x12835a['model'],qs[_0xe31f('0x31')](_0x36ec67[_0xe31f('0x2b')][_0xe31f('0x31')]));_0x479cf1[_0xe31f('0x30')]=_0x479cf1[_0xe31f('0x30')][_0xe31f('0x32')]?_0x479cf1[_0xe31f('0x30')]:_0x12835a['model'];if(!_0x36ec67[_0xe31f('0x2b')]['hasOwnProperty'](_0xe31f('0x33'))){_0x479cf1[_0xe31f('0x1b')]=qs[_0xe31f('0x1b')](_0x36ec67[_0xe31f('0x2b')][_0xe31f('0x1b')]);_0x479cf1[_0xe31f('0x18')]=qs[_0xe31f('0x18')](_0x36ec67[_0xe31f('0x2b')][_0xe31f('0x18')]);}_0x479cf1[_0xe31f('0x34')]=qs[_0xe31f('0x35')](_0x36ec67[_0xe31f('0x2b')][_0xe31f('0x35')]);_0x479cf1[_0xe31f('0x36')]=qs[_0xe31f('0x2d')](_[_0xe31f('0x37')](_0x36ec67['query'],_0x12835a[_0xe31f('0x2d')]),_0x5b1ca1);if(_0x36ec67[_0xe31f('0x2b')][_0xe31f('0x38')]){_0x479cf1[_0xe31f('0x36')]=_[_0xe31f('0x39')](_0x479cf1[_0xe31f('0x36')],{'$or':_[_0xe31f('0x25')](_0x5b1ca1,function(_0x428df7){if(_0x428df7['type']!==_0xe31f('0x3a')){var _0xa0d5b1={};_0xa0d5b1[_0x428df7[_0xe31f('0x3b')]]={'$like':'%'+_0x36ec67[_0xe31f('0x2b')][_0xe31f('0x38')]+'%'};return _0xa0d5b1;}})});}_0x479cf1=_[_0xe31f('0x39')]({},_0x479cf1,_0x36ec67[_0xe31f('0x3c')]);var _0x13f2f2={'where':_0x479cf1[_0xe31f('0x36')]};return db[_0xe31f('0x26')][_0xe31f('0x1a')](_0x13f2f2)[_0xe31f('0x21')](function(_0x2ac1d8){_0x54f7cf[_0xe31f('0x1a')]=_0x2ac1d8;if(_0x36ec67['query']['includeAll']){_0x479cf1['include']=[{'all':!![]}];}return db[_0xe31f('0x26')][_0xe31f('0x3d')](_0x479cf1);})[_0xe31f('0x21')](function(_0x47bb1d){_0x54f7cf[_0xe31f('0x3e')]=_0x47bb1d;return _0x54f7cf;})[_0xe31f('0x21')](respondWithFilteredResult(_0x17788e,_0x479cf1))[_0xe31f('0x3f')](handleError(_0x17788e,null));};exports[_0xe31f('0x40')]=function(_0x8a66d8,_0x2ffb2a){var _0x9b203d={'raw':![],'where':{'id':_0x8a66d8[_0xe31f('0x41')]['id']}},_0x9528f0={};_0x9528f0[_0xe31f('0x2f')]=_[_0xe31f('0x2c')](db[_0xe31f('0x26')][_0xe31f('0x27')]);_0x9528f0[_0xe31f('0x2b')]=_[_0xe31f('0x2c')](_0x8a66d8[_0xe31f('0x2b')]);_0x9528f0[_0xe31f('0x2d')]=_[_0xe31f('0x2e')](_0x9528f0['model'],_0x9528f0[_0xe31f('0x2b')]);_0x9b203d[_0xe31f('0x30')]=_['intersection'](_0x9528f0[_0xe31f('0x2f')],qs[_0xe31f('0x31')](_0x8a66d8[_0xe31f('0x2b')][_0xe31f('0x31')]));_0x9b203d['attributes']=_0x9b203d[_0xe31f('0x30')][_0xe31f('0x32')]?_0x9b203d[_0xe31f('0x30')]:_0x9528f0[_0xe31f('0x2f')];if(_0x8a66d8[_0xe31f('0x2b')][_0xe31f('0x42')]){_0x9b203d[_0xe31f('0x43')]=[{'all':!![]}];}_0x9b203d=_['merge']({},_0x9b203d,_0x8a66d8[_0xe31f('0x3c')]);return db[_0xe31f('0x26')][_0xe31f('0x44')](_0x9b203d)[_0xe31f('0x21')](handleEntityNotFound(_0x2ffb2a,null))[_0xe31f('0x21')](respondWithResult(_0x2ffb2a,null))[_0xe31f('0x3f')](handleError(_0x2ffb2a,null));};exports[_0xe31f('0x45')]=function(_0x40d479,_0x356c9b){return db[_0xe31f('0x26')][_0xe31f('0x45')](_0x40d479[_0xe31f('0x46')],{})[_0xe31f('0x21')](respondWithResult(_0x356c9b,0xc9))[_0xe31f('0x3f')](handleError(_0x356c9b,null));};exports[_0xe31f('0x20')]=function(_0x328a34,_0x10e2d7){if(_0x328a34[_0xe31f('0x46')]['id']){delete _0x328a34[_0xe31f('0x46')]['id'];}return db[_0xe31f('0x26')][_0xe31f('0x44')]({'where':{'id':_0x328a34[_0xe31f('0x41')]['id']}})['then'](handleEntityNotFound(_0x10e2d7,null))[_0xe31f('0x21')](saveUpdates(_0x328a34[_0xe31f('0x46')],null))[_0xe31f('0x21')](respondWithResult(_0x10e2d7,null))[_0xe31f('0x3f')](handleError(_0x10e2d7,null));};exports[_0xe31f('0x47')]=function(_0x367eef,_0x3a7115){return db[_0xe31f('0x26')]['find']({'where':{'id':_0x367eef[_0xe31f('0x41')]['id']}})[_0xe31f('0x21')](handleEntityNotFound(_0x3a7115,null))[_0xe31f('0x21')](removeEntity(_0x3a7115,null))[_0xe31f('0x3f')](handleError(_0x3a7115,null));};exports['getFields']=function(_0x5a0438,_0x22e233,_0x55d655){var _0x1f4bd1={};var _0x71628b={};var _0x1853a3;var _0x37def9;return db['ZohoConfiguration'][_0xe31f('0x48')]({'where':{'id':_0x5a0438[_0xe31f('0x41')]['id']}})[_0xe31f('0x21')](handleEntityNotFound(_0x22e233,null))['then'](function(_0x150027){if(_0x150027){_0x1853a3=_0x150027;_0x71628b[_0xe31f('0x2f')]=_[_0xe31f('0x2c')](db['ZohoField'][_0xe31f('0x27')]);_0x71628b[_0xe31f('0x2b')]=_[_0xe31f('0x2c')](_0x5a0438['query']);_0x71628b[_0xe31f('0x2d')]=_[_0xe31f('0x2e')](_0x71628b['model'],_0x71628b[_0xe31f('0x2b')]);_0x1f4bd1[_0xe31f('0x30')]=_[_0xe31f('0x2e')](_0x71628b['model'],qs[_0xe31f('0x31')](_0x5a0438[_0xe31f('0x2b')][_0xe31f('0x31')]));_0x1f4bd1[_0xe31f('0x30')]=_0x1f4bd1[_0xe31f('0x30')]['length']?_0x1f4bd1[_0xe31f('0x30')]:_0x71628b[_0xe31f('0x2f')];_0x1f4bd1['order']=qs[_0xe31f('0x35')](_0x5a0438['query']['sort']);_0x1f4bd1[_0xe31f('0x36')]=qs[_0xe31f('0x2d')](_[_0xe31f('0x37')](_0x5a0438[_0xe31f('0x2b')],_0x71628b[_0xe31f('0x2d')]));if(_0x5a0438[_0xe31f('0x2b')]['filter']){_0x1f4bd1['where']=_[_0xe31f('0x39')](_0x1f4bd1[_0xe31f('0x36')],{'$or':_[_0xe31f('0x25')](_0x1f4bd1[_0xe31f('0x30')],function(_0x17dfc7){var _0x31f256={};_0x31f256[_0x17dfc7]={'$like':'%'+_0x5a0438[_0xe31f('0x2b')][_0xe31f('0x38')]+'%'};return _0x31f256;})});}_0x1f4bd1=_[_0xe31f('0x39')]({},_0x1f4bd1,_0x5a0438[_0xe31f('0x3c')]);return _0x1853a3['getFields'](_0x1f4bd1);}})['then'](function(_0x512086){if(_0x512086){_0x37def9=_0x512086[_0xe31f('0x32')];if(!_0x5a0438[_0xe31f('0x2b')][_0xe31f('0x49')](_0xe31f('0x33'))){_0x1f4bd1[_0xe31f('0x1b')]=qs[_0xe31f('0x1b')](_0x5a0438[_0xe31f('0x2b')][_0xe31f('0x1b')]);_0x1f4bd1['offset']=qs[_0xe31f('0x18')](_0x5a0438[_0xe31f('0x2b')][_0xe31f('0x18')]);}return _0x1853a3[_0xe31f('0x4a')](_0x1f4bd1);}})[_0xe31f('0x21')](function(_0x58c29c){if(_0x58c29c){return _0x58c29c?{'count':_0x37def9,'rows':_0x58c29c}:null;}})['then'](respondWithResult(_0x22e233,null))[_0xe31f('0x3f')](handleError(_0x22e233,null));};exports[_0xe31f('0x4b')]=function(_0x41a55b,_0x538efc,_0x540510){var _0x5276f1={};var _0x44fc42={};var _0x3b3347;var _0x2b2e4a;return db[_0xe31f('0x26')][_0xe31f('0x48')]({'where':{'id':_0x41a55b['params']['id']}})['then'](handleEntityNotFound(_0x538efc,null))['then'](function(_0x32e4f5){if(_0x32e4f5){_0x3b3347=_0x32e4f5;_0x44fc42[_0xe31f('0x2f')]=_[_0xe31f('0x2c')](db['ZohoField'][_0xe31f('0x27')]);_0x44fc42[_0xe31f('0x2b')]=_[_0xe31f('0x2c')](_0x41a55b[_0xe31f('0x2b')]);_0x44fc42['filters']=_[_0xe31f('0x2e')](_0x44fc42[_0xe31f('0x2f')],_0x44fc42[_0xe31f('0x2b')]);_0x5276f1['attributes']=_[_0xe31f('0x2e')](_0x44fc42[_0xe31f('0x2f')],qs[_0xe31f('0x31')](_0x41a55b[_0xe31f('0x2b')][_0xe31f('0x31')]));_0x5276f1[_0xe31f('0x30')]=_0x5276f1[_0xe31f('0x30')][_0xe31f('0x32')]?_0x5276f1['attributes']:_0x44fc42[_0xe31f('0x2f')];_0x5276f1[_0xe31f('0x34')]=qs[_0xe31f('0x35')](_0x41a55b['query']['sort']);_0x5276f1[_0xe31f('0x36')]=qs[_0xe31f('0x2d')](_[_0xe31f('0x37')](_0x41a55b[_0xe31f('0x2b')],_0x44fc42['filters']));if(_0x41a55b[_0xe31f('0x2b')][_0xe31f('0x38')]){_0x5276f1[_0xe31f('0x36')]=_[_0xe31f('0x39')](_0x5276f1[_0xe31f('0x36')],{'$or':_[_0xe31f('0x25')](_0x5276f1[_0xe31f('0x30')],function(_0x523f50){var _0x42ccdb={};_0x42ccdb[_0x523f50]={'$like':'%'+_0x41a55b[_0xe31f('0x2b')]['filter']+'%'};return _0x42ccdb;})});}_0x5276f1=_[_0xe31f('0x39')]({},_0x5276f1,_0x41a55b[_0xe31f('0x3c')]);return _0x3b3347[_0xe31f('0x4b')](_0x5276f1);}})[_0xe31f('0x21')](function(_0x5239d4){if(_0x5239d4){_0x2b2e4a=_0x5239d4['length'];if(!_0x41a55b['query']['hasOwnProperty'](_0xe31f('0x33'))){_0x5276f1[_0xe31f('0x1b')]=qs[_0xe31f('0x1b')](_0x41a55b[_0xe31f('0x2b')][_0xe31f('0x1b')]);_0x5276f1[_0xe31f('0x18')]=qs['offset'](_0x41a55b[_0xe31f('0x2b')]['offset']);}return _0x3b3347[_0xe31f('0x4b')](_0x5276f1);}})[_0xe31f('0x21')](function(_0x3ca08d){if(_0x3ca08d){return _0x3ca08d?{'count':_0x2b2e4a,'rows':_0x3ca08d}:null;}})['then'](respondWithResult(_0x538efc,null))[_0xe31f('0x3f')](handleError(_0x538efc,null));};exports['getDescriptions']=function(_0x456839,_0x589055,_0x44550f){var _0x251869={};var _0x317fd5={};var _0x32d7fe;var _0x4400d1;return db[_0xe31f('0x26')][_0xe31f('0x48')]({'where':{'id':_0x456839['params']['id']}})[_0xe31f('0x21')](handleEntityNotFound(_0x589055,null))['then'](function(_0x40005f){if(_0x40005f){_0x32d7fe=_0x40005f;_0x317fd5[_0xe31f('0x2f')]=_[_0xe31f('0x2c')](db[_0xe31f('0x4c')][_0xe31f('0x27')]);_0x317fd5[_0xe31f('0x2b')]=_[_0xe31f('0x2c')](_0x456839[_0xe31f('0x2b')]);_0x317fd5[_0xe31f('0x2d')]=_[_0xe31f('0x2e')](_0x317fd5[_0xe31f('0x2f')],_0x317fd5['query']);_0x251869[_0xe31f('0x30')]=_[_0xe31f('0x2e')](_0x317fd5[_0xe31f('0x2f')],qs[_0xe31f('0x31')](_0x456839[_0xe31f('0x2b')][_0xe31f('0x31')]));_0x251869[_0xe31f('0x30')]=_0x251869[_0xe31f('0x30')][_0xe31f('0x32')]?_0x251869[_0xe31f('0x30')]:_0x317fd5[_0xe31f('0x2f')];_0x251869[_0xe31f('0x34')]=qs[_0xe31f('0x35')](_0x456839[_0xe31f('0x2b')][_0xe31f('0x35')]);_0x251869[_0xe31f('0x36')]=qs[_0xe31f('0x2d')](_['pick'](_0x456839[_0xe31f('0x2b')],_0x317fd5[_0xe31f('0x2d')]));if(_0x456839[_0xe31f('0x2b')]['filter']){_0x251869[_0xe31f('0x36')]=_['merge'](_0x251869[_0xe31f('0x36')],{'$or':_[_0xe31f('0x25')](_0x251869[_0xe31f('0x30')],function(_0x5ba72b){var _0xfb677e={};_0xfb677e[_0x5ba72b]={'$like':'%'+_0x456839[_0xe31f('0x2b')][_0xe31f('0x38')]+'%'};return _0xfb677e;})});}_0x251869=_['merge']({},_0x251869,_0x456839[_0xe31f('0x3c')]);return _0x32d7fe[_0xe31f('0x4d')](_0x251869);}})[_0xe31f('0x21')](function(_0x133bf8){if(_0x133bf8){_0x4400d1=_0x133bf8[_0xe31f('0x32')];if(!_0x456839[_0xe31f('0x2b')][_0xe31f('0x49')](_0xe31f('0x33'))){_0x251869[_0xe31f('0x1b')]=qs[_0xe31f('0x1b')](_0x456839[_0xe31f('0x2b')][_0xe31f('0x1b')]);_0x251869[_0xe31f('0x18')]=qs['offset'](_0x456839[_0xe31f('0x2b')][_0xe31f('0x18')]);}return _0x32d7fe[_0xe31f('0x4d')](_0x251869);}})[_0xe31f('0x21')](function(_0x197e85){if(_0x197e85){return _0x197e85?{'count':_0x4400d1,'rows':_0x197e85}:null;}})[_0xe31f('0x21')](respondWithResult(_0x589055,null))['catch'](handleError(_0x589055,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index a296407..2a7e8bd 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 _0xd008=['exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intZohoConfiguration.attributes'];(function(_0x59e834,_0x471eea){var _0x4e87d1=function(_0x3ee07b){while(--_0x3ee07b){_0x59e834['push'](_0x59e834['shift']());}};_0x4e87d1(++_0x471eea);}(_0xd008,0x1f2));var _0x8d00=function(_0x1d0a8f,_0x5be26e){_0x1d0a8f=_0x1d0a8f-0x0;var _0x95a168=_0xd008[_0x1d0a8f];return _0x95a168;};'use strict';var _=require(_0x8d00('0x0'));var util=require(_0x8d00('0x1'));var logger=require(_0x8d00('0x2'))(_0x8d00('0x3'));var moment=require(_0x8d00('0x4'));var BPromise=require(_0x8d00('0x5'));var rp=require(_0x8d00('0x6'));var fs=require('fs');var path=require(_0x8d00('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8d00('0x8'));module[_0x8d00('0x9')]=function(_0x4946b4,_0x4fb09c){return _0x4946b4[_0x8d00('0xa')](_0x8d00('0xb'),attributes,{'tableName':_0x8d00('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83e0=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2fae1e,_0x4997fc){var _0x59e990=function(_0x1afb11){while(--_0x1afb11){_0x2fae1e['push'](_0x2fae1e['shift']());}};_0x59e990(++_0x4997fc);}(_0x83e0,0xd6));var _0x083e=function(_0x3081d1,_0x4a06f4){_0x3081d1=_0x3081d1-0x0;var _0x427c0b=_0x83e0[_0x3081d1];return _0x427c0b;};'use strict';var _=require(_0x083e('0x0'));var util=require(_0x083e('0x1'));var logger=require(_0x083e('0x2'))(_0x083e('0x3'));var moment=require(_0x083e('0x4'));var BPromise=require(_0x083e('0x5'));var rp=require(_0x083e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x083e('0x7'));var config=require(_0x083e('0x8'));var attributes=require(_0x083e('0x9'));module[_0x083e('0xa')]=function(_0x2f30e9,_0xe2f615){return _0x2f30e9['define'](_0x083e('0xb'),attributes,{'tableName':_0x083e('0xc'),'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 3b1a897..dbe8b8c 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 _0xf7b0=['ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','request\x20sent','debug','error','ZohoConfiguration,\x20%s,\x20%s','message','info','result','lodash','util','bluebird'];(function(_0x3d7ec4,_0x55a465){var _0x2ada8d=function(_0x402c31){while(--_0x402c31){_0x3d7ec4['push'](_0x3d7ec4['shift']());}};_0x2ada8d(++_0x55a465);}(_0xf7b0,0xbd));var _0x0f7b=function(_0x25510b,_0x35c068){_0x25510b=_0x25510b-0x0;var _0xfd10f=_0xf7b0[_0x25510b];return _0xfd10f;};'use strict';var _=require(_0x0f7b('0x0'));var util=require(_0x0f7b('0x1'));var moment=require('moment');var BPromise=require(_0x0f7b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f7b('0x3'));var db=require(_0x0f7b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f7b('0x5'))('rpc');var config=require(_0x0f7b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0f7b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7e0892,_0x2d2dba,_0x1b2ed0){return new BPromise(function(_0x3eb24e,_0x32a45d){return client[_0x0f7b('0x8')](_0x7e0892,_0x1b2ed0)['then'](function(_0x588386){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x2d2dba,_0x0f7b('0x9'));logger[_0x0f7b('0xa')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x2d2dba,_0x0f7b('0x9'),JSON['stringify'](_0x588386));if(_0x588386[_0x0f7b('0xb')]){if(_0x588386[_0x0f7b('0xb')]['code']===0x1f4){logger[_0x0f7b('0xb')](_0x0f7b('0xc'),_0x2d2dba,_0x588386[_0x0f7b('0xb')][_0x0f7b('0xd')]);return _0x32a45d(_0x588386['error'][_0x0f7b('0xd')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x2d2dba,_0x588386[_0x0f7b('0xb')]['message']);return _0x3eb24e(_0x588386[_0x0f7b('0xb')][_0x0f7b('0xd')]);}else{logger[_0x0f7b('0xe')](_0x0f7b('0xc'),_0x2d2dba,_0x0f7b('0x9'));_0x3eb24e(_0x588386[_0x0f7b('0xf')][_0x0f7b('0xd')]);}})['catch'](function(_0xef9c81){logger[_0x0f7b('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x2d2dba,_0xef9c81);_0x32a45d(_0xef9c81);});});} \ No newline at end of file +var _0xa597=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x90399e,_0x5e3408){var _0x491191=function(_0x4401da){while(--_0x4401da){_0x90399e['push'](_0x90399e['shift']());}};_0x491191(++_0x5e3408);}(_0xa597,0xc0));var _0x7a59=function(_0x31e431,_0xe8984f){_0x31e431=_0x31e431-0x0;var _0x1dd7d=_0xa597[_0x31e431];return _0x1dd7d;};'use strict';var _=require(_0x7a59('0x0'));var util=require(_0x7a59('0x1'));var moment=require(_0x7a59('0x2'));var BPromise=require(_0x7a59('0x3'));var rs=require(_0x7a59('0x4'));var fs=require('fs');var Redis=require(_0x7a59('0x5'));var db=require(_0x7a59('0x6'))['db'];var utils=require(_0x7a59('0x7'));var logger=require(_0x7a59('0x8'))(_0x7a59('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7a59('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48895d,_0x4102c8,_0x3e43cd){return new BPromise(function(_0x51f4f6,_0x2dea8f){return client['request'](_0x48895d,_0x3e43cd)[_0x7a59('0xb')](function(_0x428f10){logger[_0x7a59('0xc')](_0x7a59('0xd'),_0x4102c8,_0x7a59('0xe'));logger[_0x7a59('0xf')](_0x7a59('0x10'),_0x4102c8,_0x7a59('0xe'),JSON['stringify'](_0x428f10));if(_0x428f10[_0x7a59('0x11')]){if(_0x428f10[_0x7a59('0x11')][_0x7a59('0x12')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x4102c8,_0x428f10['error'][_0x7a59('0x13')]);return _0x2dea8f(_0x428f10[_0x7a59('0x11')]['message']);}logger[_0x7a59('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x4102c8,_0x428f10['error']['message']);return _0x51f4f6(_0x428f10['error'][_0x7a59('0x13')]);}else{logger['info'](_0x7a59('0xd'),_0x4102c8,'request\x20sent');_0x51f4f6(_0x428f10[_0x7a59('0x14')][_0x7a59('0x13')]);}})[_0x7a59('0x15')](function(_0x51a62b){logger['error'](_0x7a59('0xd'),_0x4102c8,_0x51a62b);_0x2dea8f(_0x51a62b);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index f7c5ecd..f74da8d 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 _0xcce4=['post','create','delete','exports','util','express','Router','fs-extra','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcce4,0x1a8));var _0x4cce=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0xcce4[_0x12d812];return _0x3711ab;};'use strict';var multer=require('multer');var util=require(_0x4cce('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4cce('0x1'));var router=express[_0x4cce('0x2')]();var fs_extra=require(_0x4cce('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4cce('0x4'));var controller=require(_0x4cce('0x5'));router[_0x4cce('0x6')]('/',auth[_0x4cce('0x7')](),controller[_0x4cce('0x8')]);router['get'](_0x4cce('0x9'),auth[_0x4cce('0x7')](),controller[_0x4cce('0xa')]);router[_0x4cce('0xb')]('/',auth[_0x4cce('0x7')](),controller[_0x4cce('0xc')]);router['put']('/:id',auth[_0x4cce('0x7')](),controller['update']);router[_0x4cce('0xd')](_0x4cce('0x9'),auth[_0x4cce('0x7')](),controller['destroy']);module[_0x4cce('0xe')]=router; \ No newline at end of file +var _0x4eba=['delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated','post','create','update'];(function(_0x9b89c1,_0x2a7e4f){var _0xf547ae=function(_0x7409fa){while(--_0x7409fa){_0x9b89c1['push'](_0x9b89c1['shift']());}};_0xf547ae(++_0x2a7e4f);}(_0x4eba,0x123));var _0xa4eb=function(_0x49f2a1,_0x2623e0){_0x49f2a1=_0x49f2a1-0x0;var _0x1d0ad3=_0x4eba[_0x49f2a1];return _0x1d0ad3;};'use strict';var multer=require(_0xa4eb('0x0'));var util=require(_0xa4eb('0x1'));var path=require(_0xa4eb('0x2'));var timeout=require(_0xa4eb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa4eb('0x4'));var interaction=require(_0xa4eb('0x5'));var config=require(_0xa4eb('0x6'));var controller=require(_0xa4eb('0x7'));router[_0xa4eb('0x8')]('/',auth['isAuthenticated'](),controller[_0xa4eb('0x9')]);router['get'](_0xa4eb('0xa'),auth[_0xa4eb('0xb')](),controller['show']);router[_0xa4eb('0xc')]('/',auth[_0xa4eb('0xb')](),controller[_0xa4eb('0xd')]);router['put'](_0xa4eb('0xa'),auth[_0xa4eb('0xb')](),controller[_0xa4eb('0xe')]);router[_0xa4eb('0xf')](_0xa4eb('0xa'),auth[_0xa4eb('0xb')](),controller['destroy']);module[_0xa4eb('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 26bf5fe..31f5dd4 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 _0xc19d=['keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xc19d,0x8b));var _0xdc19=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xc19d[_0x616290];return _0x453879;};'use strict';var Sequelize=require(_0xdc19('0x0'));module[_0xdc19('0x1')]={'type':{'type':Sequelize[_0xdc19('0x2')](_0xdc19('0x3'),_0xdc19('0x4'),'customVariable',_0xdc19('0x5'),_0xdc19('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdc19('0x7')]},'key':{'type':Sequelize[_0xdc19('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xdc19('0x3'),'variable',_0xdc19('0x8'))},'keyContent':{'type':Sequelize[_0xdc19('0x7')]},'idField':{'type':Sequelize[_0xdc19('0x7')]},'nameField':{'type':Sequelize[_0xdc19('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdc19('0x7')]}}; \ No newline at end of file +var _0x4f26=['sequelize','exports','ENUM','string','variable','keyValue','STRING','BOOLEAN'];(function(_0x293449,_0x55e947){var _0x12c9b3=function(_0x424e83){while(--_0x424e83){_0x293449['push'](_0x293449['shift']());}};_0x12c9b3(++_0x55e947);}(_0x4f26,0xf8));var _0x64f2=function(_0x42c45b,_0x5594d6){_0x42c45b=_0x42c45b-0x0;var _0x256d4c=_0x4f26[_0x42c45b];return _0x256d4c;};'use strict';var Sequelize=require(_0x64f2('0x0'));module[_0x64f2('0x1')]={'type':{'type':Sequelize[_0x64f2('0x2')](_0x64f2('0x3'),_0x64f2('0x4'),'customVariable',_0x64f2('0x5'),'picklist'),'defaultValue':_0x64f2('0x3')},'content':{'type':Sequelize[_0x64f2('0x6')]},'key':{'type':Sequelize[_0x64f2('0x6')]},'keyType':{'type':Sequelize[_0x64f2('0x2')]('string',_0x64f2('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x64f2('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x64f2('0x6')]},'customField':{'type':Sequelize[_0x64f2('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x64f2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 531c26f..96acae3 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 _0x7508=['../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','apply','save','update','destroy','sendStatus','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','then','rows','catch','show','params','keys','include','find','create','body','eml-format','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x4dac30,_0x3d42c8){var _0x52a5ad=function(_0x328f9b){while(--_0x328f9b){_0x4dac30['push'](_0x4dac30['shift']());}};_0x52a5ad(++_0x3d42c8);}(_0x7508,0xc3));var _0x8750=function(_0x262cd9,_0x154022){_0x262cd9=_0x262cd9-0x0;var _0x53a896=_0x7508[_0x262cd9];return _0x53a896;};'use strict';var emlformat=require(_0x8750('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8750('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8750('0x2'));var moment=require('moment');var BPromise=require(_0x8750('0x3'));var Mustache=require('mustache');var util=require(_0x8750('0x4'));var path=require(_0x8750('0x5'));var sox=require('sox');var csv=require(_0x8750('0x6'));var ejs=require(_0x8750('0x7'));var fs=require('fs');var fs_extra=require(_0x8750('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8750('0x9'));var deskjs=require(_0x8750('0xa'));var toCsv=require(_0x8750('0x6'));var querystring=require(_0x8750('0xb'));var Papa=require(_0x8750('0xc'));var Redis=require('ioredis');var authService=require(_0x8750('0xd'));var qs=require(_0x8750('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8750('0xf'));var logger=require('../../config/logger')(_0x8750('0x10'));var utils=require(_0x8750('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x8750('0x12'));var db=require(_0x8750('0x13'))['db'];function respondWithStatusCode(_0x31eb34,_0x41737f){_0x41737f=_0x41737f||0xcc;return function(_0x363c35){if(_0x363c35){return _0x31eb34['sendStatus'](_0x41737f);}return _0x31eb34['status'](_0x41737f)[_0x8750('0x14')]();};}function respondWithResult(_0x1401f5,_0x7d8c61){_0x7d8c61=_0x7d8c61||0xc8;return function(_0x4bf024){if(_0x4bf024){return _0x1401f5[_0x8750('0x15')](_0x7d8c61)[_0x8750('0x16')](_0x4bf024);}};}function respondWithFilteredResult(_0x4ce091,_0x4e6de6){return function(_0x1c44bd){if(_0x1c44bd){var _0x2459fd=typeof _0x4e6de6[_0x8750('0x17')]==='undefined'&&typeof _0x4e6de6[_0x8750('0x18')]===_0x8750('0x19');var _0x37d6b6=_0x1c44bd['count'];var _0x8fb3ce=_0x2459fd?0x0:_0x4e6de6[_0x8750('0x17')];var _0x4837df=_0x2459fd?_0x1c44bd[_0x8750('0x1a')]:_0x4e6de6[_0x8750('0x17')]+_0x4e6de6[_0x8750('0x18')];var _0x16e4d9;if(_0x4837df>=_0x37d6b6){_0x4837df=_0x37d6b6;_0x16e4d9=0xc8;}else{_0x16e4d9=0xce;}_0x4ce091[_0x8750('0x15')](_0x16e4d9);return _0x4ce091[_0x8750('0x1b')]('Content-Range',_0x8fb3ce+'-'+_0x4837df+'/'+_0x37d6b6)[_0x8750('0x16')](_0x1c44bd);}return null;};}function patchUpdates(_0x37e6ce){return function(_0x4e4e10){try{jsonpatch[_0x8750('0x1c')](_0x4e4e10,_0x37e6ce,!![]);}catch(_0x11486f){return BPromise['reject'](_0x11486f);}return _0x4e4e10[_0x8750('0x1d')]();};}function saveUpdates(_0x50f9f0,_0x5dc08e){return function(_0x898d13){if(_0x898d13){return _0x898d13[_0x8750('0x1e')](_0x50f9f0)['then'](function(_0x1a3c2f){return _0x1a3c2f;});}return null;};}function removeEntity(_0x366828,_0x4d278){return function(_0x3c5376){if(_0x3c5376){return _0x3c5376[_0x8750('0x1f')]()['then'](function(){_0x366828[_0x8750('0x15')](0xcc)[_0x8750('0x14')]();});}};}function handleEntityNotFound(_0x190481,_0x59a490){return function(_0x3ee596){if(!_0x3ee596){_0x190481[_0x8750('0x20')](0x194);}return _0x3ee596;};}function handleError(_0x34a841,_0x4c5199){_0x4c5199=_0x4c5199||0x1f4;return function(_0x410e58){logger[_0x8750('0x21')](_0x410e58[_0x8750('0x22')]);if(_0x410e58[_0x8750('0x23')]){delete _0x410e58[_0x8750('0x23')];}_0x34a841[_0x8750('0x15')](_0x4c5199)[_0x8750('0x24')](_0x410e58);};}exports[_0x8750('0x25')]=function(_0x1c0d4d,_0x55a90e){var _0x551f4e={},_0x4168d8={},_0x3d15ec={'count':0x0,'rows':[]};var _0x48886e=_[_0x8750('0x26')](db[_0x8750('0x27')][_0x8750('0x28')],function(_0x5c94e8){return{'name':_0x5c94e8[_0x8750('0x29')],'type':_0x5c94e8[_0x8750('0x2a')][_0x8750('0x2b')]};});_0x4168d8[_0x8750('0x2c')]=_['map'](_0x48886e,'name');_0x4168d8[_0x8750('0x2d')]=_['keys'](_0x1c0d4d[_0x8750('0x2d')]);_0x4168d8[_0x8750('0x2e')]=_['intersection'](_0x4168d8['model'],_0x4168d8[_0x8750('0x2d')]);_0x551f4e[_0x8750('0x2f')]=_[_0x8750('0x30')](_0x4168d8[_0x8750('0x2c')],qs['fields'](_0x1c0d4d['query'][_0x8750('0x31')]));_0x551f4e[_0x8750('0x2f')]=_0x551f4e['attributes']['length']?_0x551f4e[_0x8750('0x2f')]:_0x4168d8[_0x8750('0x2c')];if(!_0x1c0d4d[_0x8750('0x2d')][_0x8750('0x32')](_0x8750('0x33'))){_0x551f4e[_0x8750('0x18')]=qs[_0x8750('0x18')](_0x1c0d4d[_0x8750('0x2d')]['limit']);_0x551f4e['offset']=qs[_0x8750('0x17')](_0x1c0d4d[_0x8750('0x2d')][_0x8750('0x17')]);}_0x551f4e[_0x8750('0x34')]=qs[_0x8750('0x35')](_0x1c0d4d[_0x8750('0x2d')][_0x8750('0x35')]);_0x551f4e[_0x8750('0x36')]=qs[_0x8750('0x2e')](_[_0x8750('0x37')](_0x1c0d4d[_0x8750('0x2d')],_0x4168d8[_0x8750('0x2e')]),_0x48886e);if(_0x1c0d4d['query'][_0x8750('0x38')]){_0x551f4e[_0x8750('0x36')]=_[_0x8750('0x39')](_0x551f4e[_0x8750('0x36')],{'$or':_['map'](_0x48886e,function(_0x219e46){if(_0x219e46[_0x8750('0x2a')]!==_0x8750('0x3a')){var _0x100168={};_0x100168[_0x219e46['name']]={'$like':'%'+_0x1c0d4d[_0x8750('0x2d')]['filter']+'%'};return _0x100168;}})});}_0x551f4e=_[_0x8750('0x39')]({},_0x551f4e,_0x1c0d4d[_0x8750('0x3b')]);var _0x5e4e81={'where':_0x551f4e[_0x8750('0x36')]};return db[_0x8750('0x27')][_0x8750('0x1a')](_0x5e4e81)['then'](function(_0x9cef8c){_0x3d15ec[_0x8750('0x1a')]=_0x9cef8c;if(_0x1c0d4d[_0x8750('0x2d')][_0x8750('0x3c')]){_0x551f4e['include']=[{'all':!![]}];}return db[_0x8750('0x27')]['findAll'](_0x551f4e);})[_0x8750('0x3d')](function(_0x1a43e9){_0x3d15ec[_0x8750('0x3e')]=_0x1a43e9;return _0x3d15ec;})[_0x8750('0x3d')](respondWithFilteredResult(_0x55a90e,_0x551f4e))[_0x8750('0x3f')](handleError(_0x55a90e,null));};exports[_0x8750('0x40')]=function(_0xd52036,_0x2aac1a){var _0x173ce2={'raw':!![],'where':{'id':_0xd52036[_0x8750('0x41')]['id']}},_0x59ae6f={};_0x59ae6f[_0x8750('0x2c')]=_[_0x8750('0x42')](db['ZohoField'][_0x8750('0x28')]);_0x59ae6f[_0x8750('0x2d')]=_[_0x8750('0x42')](_0xd52036[_0x8750('0x2d')]);_0x59ae6f[_0x8750('0x2e')]=_['intersection'](_0x59ae6f['model'],_0x59ae6f['query']);_0x173ce2['attributes']=_[_0x8750('0x30')](_0x59ae6f['model'],qs['fields'](_0xd52036[_0x8750('0x2d')]['fields']));_0x173ce2[_0x8750('0x2f')]=_0x173ce2[_0x8750('0x2f')]['length']?_0x173ce2[_0x8750('0x2f')]:_0x59ae6f[_0x8750('0x2c')];if(_0xd52036[_0x8750('0x2d')][_0x8750('0x3c')]){_0x173ce2[_0x8750('0x43')]=[{'all':!![]}];}_0x173ce2=_[_0x8750('0x39')]({},_0x173ce2,_0xd52036[_0x8750('0x3b')]);return db[_0x8750('0x27')][_0x8750('0x44')](_0x173ce2)['then'](handleEntityNotFound(_0x2aac1a,null))[_0x8750('0x3d')](respondWithResult(_0x2aac1a,null))[_0x8750('0x3f')](handleError(_0x2aac1a,null));};exports[_0x8750('0x45')]=function(_0x1c09a8,_0x45709e){return db['ZohoField']['create'](_0x1c09a8['body'],{})[_0x8750('0x3d')](respondWithResult(_0x45709e,0xc9))[_0x8750('0x3f')](handleError(_0x45709e,null));};exports[_0x8750('0x1e')]=function(_0x8b1a90,_0x350634){if(_0x8b1a90['body']['id']){delete _0x8b1a90[_0x8750('0x46')]['id'];}return db[_0x8750('0x27')]['find']({'where':{'id':_0x8b1a90[_0x8750('0x41')]['id']}})[_0x8750('0x3d')](handleEntityNotFound(_0x350634,null))[_0x8750('0x3d')](saveUpdates(_0x8b1a90[_0x8750('0x46')],null))[_0x8750('0x3d')](respondWithResult(_0x350634,null))[_0x8750('0x3f')](handleError(_0x350634,null));};exports[_0x8750('0x1f')]=function(_0x6031d9,_0x2c4e3d){return db[_0x8750('0x27')]['find']({'where':{'id':_0x6031d9[_0x8750('0x41')]['id']}})[_0x8750('0x3d')](handleEntityNotFound(_0x2c4e3d,null))[_0x8750('0x3d')](removeEntity(_0x2c4e3d,null))['catch'](handleError(_0x2c4e3d,null));}; \ No newline at end of file +var _0x86a3=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','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','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order'];(function(_0x2a549c,_0x173200){var _0x13ff59=function(_0x43b604){while(--_0x43b604){_0x2a549c['push'](_0x2a549c['shift']());}};_0x13ff59(++_0x173200);}(_0x86a3,0xf6));var _0x386a=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x86a3[_0x5037ab];return _0x512adb;};'use strict';var emlformat=require(_0x386a('0x0'));var rimraf=require(_0x386a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x386a('0x2'));var rp=require(_0x386a('0x3'));var moment=require('moment');var BPromise=require(_0x386a('0x4'));var Mustache=require('mustache');var util=require(_0x386a('0x5'));var path=require(_0x386a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x386a('0x7'));var _=require(_0x386a('0x8'));var squel=require(_0x386a('0x9'));var crypto=require(_0x386a('0xa'));var jsforce=require(_0x386a('0xb'));var deskjs=require(_0x386a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x386a('0xd'));var Papa=require(_0x386a('0xe'));var Redis=require(_0x386a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x386a('0x10'));var as=require(_0x386a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x386a('0x12'))(_0x386a('0x13'));var utils=require(_0x386a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x386a('0x15'));var db=require(_0x386a('0x16'))['db'];function respondWithStatusCode(_0x540715,_0x5e70b7){_0x5e70b7=_0x5e70b7||0xcc;return function(_0x42e71c){if(_0x42e71c){return _0x540715[_0x386a('0x17')](_0x5e70b7);}return _0x540715[_0x386a('0x18')](_0x5e70b7)['end']();};}function respondWithResult(_0x57422b,_0x21236e){_0x21236e=_0x21236e||0xc8;return function(_0x4f8b75){if(_0x4f8b75){return _0x57422b[_0x386a('0x18')](_0x21236e)['json'](_0x4f8b75);}};}function respondWithFilteredResult(_0xbb00c0,_0x45c540){return function(_0x105f41){if(_0x105f41){var _0x42f82b=typeof _0x45c540[_0x386a('0x19')]===_0x386a('0x1a')&&typeof _0x45c540[_0x386a('0x1b')]===_0x386a('0x1a');var _0x21abe5=_0x105f41[_0x386a('0x1c')];var _0xef9c71=_0x42f82b?0x0:_0x45c540[_0x386a('0x19')];var _0x9473ce=_0x42f82b?_0x105f41[_0x386a('0x1c')]:_0x45c540[_0x386a('0x19')]+_0x45c540[_0x386a('0x1b')];var _0x17c37c;if(_0x9473ce>=_0x21abe5){_0x9473ce=_0x21abe5;_0x17c37c=0xc8;}else{_0x17c37c=0xce;}_0xbb00c0[_0x386a('0x18')](_0x17c37c);return _0xbb00c0[_0x386a('0x1d')](_0x386a('0x1e'),_0xef9c71+'-'+_0x9473ce+'/'+_0x21abe5)[_0x386a('0x1f')](_0x105f41);}return null;};}function patchUpdates(_0x53af86){return function(_0x3ab642){try{jsonpatch['apply'](_0x3ab642,_0x53af86,!![]);}catch(_0x500d8d){return BPromise[_0x386a('0x20')](_0x500d8d);}return _0x3ab642[_0x386a('0x21')]();};}function saveUpdates(_0x215e64,_0x2a5413){return function(_0x401222){if(_0x401222){return _0x401222['update'](_0x215e64)[_0x386a('0x22')](function(_0x3bb6d2){return _0x3bb6d2;});}return null;};}function removeEntity(_0x4b3f1f,_0x21eb67){return function(_0x2f8ece){if(_0x2f8ece){return _0x2f8ece[_0x386a('0x23')]()[_0x386a('0x22')](function(){_0x4b3f1f['status'](0xcc)[_0x386a('0x24')]();});}};}function handleEntityNotFound(_0x4ce70c,_0x42a2b0){return function(_0x1980b5){if(!_0x1980b5){_0x4ce70c[_0x386a('0x17')](0x194);}return _0x1980b5;};}function handleError(_0x3998ba,_0x18adb2){_0x18adb2=_0x18adb2||0x1f4;return function(_0x42f088){logger[_0x386a('0x25')](_0x42f088[_0x386a('0x26')]);if(_0x42f088['name']){delete _0x42f088[_0x386a('0x27')];}_0x3998ba[_0x386a('0x18')](_0x18adb2)[_0x386a('0x28')](_0x42f088);};}exports[_0x386a('0x29')]=function(_0x429deb,_0xdf9204){var _0x607194={},_0x9a8c9={},_0xce470d={'count':0x0,'rows':[]};var _0x30d295=_[_0x386a('0x2a')](db[_0x386a('0x2b')][_0x386a('0x2c')],function(_0x2270be){return{'name':_0x2270be[_0x386a('0x2d')],'type':_0x2270be[_0x386a('0x2e')][_0x386a('0x2f')]};});_0x9a8c9[_0x386a('0x30')]=_[_0x386a('0x2a')](_0x30d295,'name');_0x9a8c9[_0x386a('0x31')]=_[_0x386a('0x32')](_0x429deb[_0x386a('0x31')]);_0x9a8c9[_0x386a('0x33')]=_['intersection'](_0x9a8c9[_0x386a('0x30')],_0x9a8c9['query']);_0x607194[_0x386a('0x34')]=_[_0x386a('0x35')](_0x9a8c9[_0x386a('0x30')],qs[_0x386a('0x36')](_0x429deb[_0x386a('0x31')][_0x386a('0x36')]));_0x607194[_0x386a('0x34')]=_0x607194[_0x386a('0x34')]['length']?_0x607194[_0x386a('0x34')]:_0x9a8c9[_0x386a('0x30')];if(!_0x429deb[_0x386a('0x31')][_0x386a('0x37')](_0x386a('0x38'))){_0x607194[_0x386a('0x1b')]=qs[_0x386a('0x1b')](_0x429deb['query'][_0x386a('0x1b')]);_0x607194[_0x386a('0x19')]=qs[_0x386a('0x19')](_0x429deb['query']['offset']);}_0x607194[_0x386a('0x39')]=qs[_0x386a('0x3a')](_0x429deb[_0x386a('0x31')][_0x386a('0x3a')]);_0x607194[_0x386a('0x3b')]=qs[_0x386a('0x33')](_[_0x386a('0x3c')](_0x429deb['query'],_0x9a8c9[_0x386a('0x33')]),_0x30d295);if(_0x429deb[_0x386a('0x31')][_0x386a('0x3d')]){_0x607194['where']=_[_0x386a('0x3e')](_0x607194[_0x386a('0x3b')],{'$or':_[_0x386a('0x2a')](_0x30d295,function(_0x37b5e1){if(_0x37b5e1[_0x386a('0x2e')]!==_0x386a('0x3f')){var _0x21f290={};_0x21f290[_0x37b5e1[_0x386a('0x27')]]={'$like':'%'+_0x429deb['query'][_0x386a('0x3d')]+'%'};return _0x21f290;}})});}_0x607194=_[_0x386a('0x3e')]({},_0x607194,_0x429deb[_0x386a('0x40')]);var _0xa0858d={'where':_0x607194['where']};return db[_0x386a('0x2b')]['count'](_0xa0858d)[_0x386a('0x22')](function(_0x343af8){_0xce470d[_0x386a('0x1c')]=_0x343af8;if(_0x429deb['query'][_0x386a('0x41')]){_0x607194[_0x386a('0x42')]=[{'all':!![]}];}return db[_0x386a('0x2b')][_0x386a('0x43')](_0x607194);})['then'](function(_0x196f83){_0xce470d[_0x386a('0x44')]=_0x196f83;return _0xce470d;})[_0x386a('0x22')](respondWithFilteredResult(_0xdf9204,_0x607194))[_0x386a('0x45')](handleError(_0xdf9204,null));};exports[_0x386a('0x46')]=function(_0x14aeb4,_0x5f34b3){var _0x57586d={'raw':!![],'where':{'id':_0x14aeb4[_0x386a('0x47')]['id']}},_0x4bc18b={};_0x4bc18b[_0x386a('0x30')]=_[_0x386a('0x32')](db['ZohoField'][_0x386a('0x2c')]);_0x4bc18b[_0x386a('0x31')]=_[_0x386a('0x32')](_0x14aeb4['query']);_0x4bc18b[_0x386a('0x33')]=_[_0x386a('0x35')](_0x4bc18b[_0x386a('0x30')],_0x4bc18b[_0x386a('0x31')]);_0x57586d[_0x386a('0x34')]=_[_0x386a('0x35')](_0x4bc18b[_0x386a('0x30')],qs[_0x386a('0x36')](_0x14aeb4['query']['fields']));_0x57586d[_0x386a('0x34')]=_0x57586d[_0x386a('0x34')]['length']?_0x57586d[_0x386a('0x34')]:_0x4bc18b[_0x386a('0x30')];if(_0x14aeb4[_0x386a('0x31')]['includeAll']){_0x57586d[_0x386a('0x42')]=[{'all':!![]}];}_0x57586d=_[_0x386a('0x3e')]({},_0x57586d,_0x14aeb4[_0x386a('0x40')]);return db[_0x386a('0x2b')][_0x386a('0x48')](_0x57586d)[_0x386a('0x22')](handleEntityNotFound(_0x5f34b3,null))['then'](respondWithResult(_0x5f34b3,null))[_0x386a('0x45')](handleError(_0x5f34b3,null));};exports[_0x386a('0x49')]=function(_0x3c866c,_0xbe9050){return db[_0x386a('0x2b')][_0x386a('0x49')](_0x3c866c[_0x386a('0x4a')],{})[_0x386a('0x22')](respondWithResult(_0xbe9050,0xc9))[_0x386a('0x45')](handleError(_0xbe9050,null));};exports[_0x386a('0x4b')]=function(_0x5ccfdd,_0x4989f3){if(_0x5ccfdd[_0x386a('0x4a')]['id']){delete _0x5ccfdd[_0x386a('0x4a')]['id'];}return db[_0x386a('0x2b')][_0x386a('0x48')]({'where':{'id':_0x5ccfdd['params']['id']}})[_0x386a('0x22')](handleEntityNotFound(_0x4989f3,null))[_0x386a('0x22')](saveUpdates(_0x5ccfdd['body'],null))['then'](respondWithResult(_0x4989f3,null))[_0x386a('0x45')](handleError(_0x4989f3,null));};exports['destroy']=function(_0xbbe6b2,_0x5c8c67){return db[_0x386a('0x2b')][_0x386a('0x48')]({'where':{'id':_0xbbe6b2['params']['id']}})[_0x386a('0x22')](handleEntityNotFound(_0x5c8c67,null))[_0x386a('0x22')](removeEntity(_0x5c8c67,null))['catch'](handleError(_0x5c8c67,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 9c734ce..4e2b986 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 _0x5204=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash'];(function(_0x499238,_0x226523){var _0x5613f7=function(_0x33cd11){while(--_0x33cd11){_0x499238['push'](_0x499238['shift']());}};_0x5613f7(++_0x226523);}(_0x5204,0xdf));var _0x4520=function(_0x845505,_0x19e5f3){_0x845505=_0x845505-0x0;var _0x2513b9=_0x5204[_0x845505];return _0x2513b9;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var logger=require('../../config/logger')(_0x4520('0x2'));var moment=require(_0x4520('0x3'));var BPromise=require(_0x4520('0x4'));var rp=require(_0x4520('0x5'));var fs=require('fs');var path=require(_0x4520('0x6'));var rimraf=require('rimraf');var config=require(_0x4520('0x7'));var attributes=require('./intZohoField.attributes');module[_0x4520('0x8')]=function(_0x209381,_0xe0a256){return _0x209381[_0x4520('0x9')](_0x4520('0xa'),attributes,{'tableName':_0x4520('0xb'),'paranoid':![],'indexes':[{'name':_0x4520('0xc'),'fields':['idField',_0x4520('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd046=['util','../../config/logger','api','bluebird','rimraf','./intZohoField.attributes','define','zoho_unique_index','idField'];(function(_0x32a265,_0x387507){var _0x56eb86=function(_0x4a1f4f){while(--_0x4a1f4f){_0x32a265['push'](_0x32a265['shift']());}};_0x56eb86(++_0x387507);}(_0xd046,0x129));var _0x6d04=function(_0x2477e0,_0x49fa23){_0x2477e0=_0x2477e0-0x0;var _0x568c28=_0xd046[_0x2477e0];return _0x568c28;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var logger=require(_0x6d04('0x1'))(_0x6d04('0x2'));var moment=require('moment');var BPromise=require(_0x6d04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d04('0x4'));var config=require('../../config/environment');var attributes=require(_0x6d04('0x5'));module['exports']=function(_0x4bacb1,_0xf3b4e7){return _0x4bacb1[_0x6d04('0x6')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x6d04('0x7'),'fields':[_0x6d04('0x8'),'FieldId'],'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 2762954..477eb23 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 _0xc9d9=['catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x36148a,_0x44bccd){var _0x49422a=function(_0x417a79){while(--_0x417a79){_0x36148a['push'](_0x36148a['shift']());}};_0x49422a(++_0x44bccd);}(_0xc9d9,0x1cd));var _0x9c9d=function(_0x563882,_0x2b1e60){_0x563882=_0x563882-0x0;var _0x216100=_0xc9d9[_0x563882];return _0x216100;};'use strict';var _=require('lodash');var util=require(_0x9c9d('0x0'));var moment=require(_0x9c9d('0x1'));var BPromise=require('bluebird');var rs=require(_0x9c9d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c9d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c9d('0x4'))(_0x9c9d('0x5'));var config=require(_0x9c9d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9c9d('0x7')][_0x9c9d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47aa25,_0x4ee86c,_0x5a5491){return new BPromise(function(_0x20ec11,_0x479855){return client[_0x9c9d('0x9')](_0x47aa25,_0x5a5491)['then'](function(_0x32551d){logger[_0x9c9d('0xa')](_0x9c9d('0xb'),_0x4ee86c,_0x9c9d('0xc'));logger['debug'](_0x9c9d('0xd'),_0x4ee86c,_0x9c9d('0xc'),JSON[_0x9c9d('0xe')](_0x32551d));if(_0x32551d['error']){if(_0x32551d[_0x9c9d('0xf')][_0x9c9d('0x10')]===0x1f4){logger[_0x9c9d('0xf')](_0x9c9d('0xb'),_0x4ee86c,_0x32551d[_0x9c9d('0xf')][_0x9c9d('0x11')]);return _0x479855(_0x32551d[_0x9c9d('0xf')][_0x9c9d('0x11')]);}logger[_0x9c9d('0xf')](_0x9c9d('0xb'),_0x4ee86c,_0x32551d[_0x9c9d('0xf')]['message']);return _0x20ec11(_0x32551d[_0x9c9d('0xf')][_0x9c9d('0x11')]);}else{logger[_0x9c9d('0xa')](_0x9c9d('0xb'),_0x4ee86c,'request\x20sent');_0x20ec11(_0x32551d[_0x9c9d('0x12')][_0x9c9d('0x11')]);}})[_0x9c9d('0x13')](function(_0x30a594){logger['error'](_0x9c9d('0xb'),_0x4ee86c,_0x30a594);_0x479855(_0x30a594);});});} \ No newline at end of file +var _0xa08b=['code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error'];(function(_0x372433,_0xb55d02){var _0x375ac3=function(_0x1c1d22){while(--_0x1c1d22){_0x372433['push'](_0x372433['shift']());}};_0x375ac3(++_0xb55d02);}(_0xa08b,0x158));var _0xba08=function(_0x1d4931,_0x2ee209){_0x1d4931=_0x1d4931-0x0;var _0x3c7b63=_0xa08b[_0x1d4931];return _0x3c7b63;};'use strict';var _=require(_0xba08('0x0'));var util=require('util');var moment=require(_0xba08('0x1'));var BPromise=require(_0xba08('0x2'));var rs=require(_0xba08('0x3'));var fs=require('fs');var Redis=require(_0xba08('0x4'));var db=require(_0xba08('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xba08('0x6'))(_0xba08('0x7'));var config=require(_0xba08('0x8'));var jayson=require(_0xba08('0x9'));var client=jayson['client'][_0xba08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x551b22,_0x4c80dd,_0x465119){return new BPromise(function(_0x35f9c2,_0x20e718){return client['request'](_0x551b22,_0x465119)[_0xba08('0xb')](function(_0x1bccb7){logger['info'](_0xba08('0xc'),_0x4c80dd,_0xba08('0xd'));logger['debug'](_0xba08('0xe'),_0x4c80dd,'request\x20sent',JSON['stringify'](_0x1bccb7));if(_0x1bccb7[_0xba08('0xf')]){if(_0x1bccb7[_0xba08('0xf')][_0xba08('0x10')]===0x1f4){logger['error'](_0xba08('0xc'),_0x4c80dd,_0x1bccb7[_0xba08('0xf')]['message']);return _0x20e718(_0x1bccb7[_0xba08('0xf')][_0xba08('0x11')]);}logger[_0xba08('0xf')](_0xba08('0xc'),_0x4c80dd,_0x1bccb7['error'][_0xba08('0x11')]);return _0x35f9c2(_0x1bccb7[_0xba08('0xf')]['message']);}else{logger[_0xba08('0x12')](_0xba08('0xc'),_0x4c80dd,_0xba08('0xd'));_0x35f9c2(_0x1bccb7['result']['message']);}})[_0xba08('0x13')](function(_0x4221c1){logger[_0xba08('0xf')](_0xba08('0xc'),_0x4c80dd,_0x4221c1);_0x20e718(_0x4221c1);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index d4e025a..3f8fffc 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x30800b,_0x3f9d0f){var _0x147605=function(_0x2893be){while(--_0x2893be){_0x30800b['push'](_0x30800b['shift']());}};_0x147605(++_0x3f9d0f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0xcb91[_0x478c8a];return _0x3b6b3e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2aa0e3,_0x35d6d3){var _0x3fba7e=function(_0x84072e){while(--_0x84072e){_0x2aa0e3['push'](_0x2aa0e3['shift']());}};_0x3fba7e(++_0x35d6d3);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index b44115b..b83a2f8 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 _0x1a58=['unique_name_and_version','app.js','INTEGER','state','sequelize','exports','STRING'];(function(_0x4083c4,_0x30b997){var _0x449222=function(_0x5f142c){while(--_0x5f142c){_0x4083c4['push'](_0x4083c4['shift']());}};_0x449222(++_0x30b997);}(_0x1a58,0x193));var _0x81a5=function(_0x2fdaf2,_0x4df953){_0x2fdaf2=_0x2fdaf2-0x0;var _0x3dd7cb=_0x1a58[_0x2fdaf2];return _0x3dd7cb;};'use strict';var Sequelize=require(_0x81a5('0x0'));module[_0x81a5('0x1')]={'name':{'type':Sequelize[_0x81a5('0x2')],'allowNull':![],'unique':_0x81a5('0x3')},'version':{'type':Sequelize[_0x81a5('0x2')],'allowNull':![],'unique':_0x81a5('0x3')},'main':{'type':Sequelize[_0x81a5('0x2')],'defaultValue':_0x81a5('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x81a5('0x2')]},'type':{'type':Sequelize[_0x81a5('0x2')]},'size':{'type':Sequelize[_0x81a5('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x81a5('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x81a5('0x2')],'unique':_0x81a5('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x81a5('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x81a5('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xff73=['exports','unique_name_and_version','STRING','app.js','INTEGER','state','sequelize'];(function(_0x157176,_0x4952ab){var _0x1a6c82=function(_0x40ee92){while(--_0x40ee92){_0x157176['push'](_0x157176['shift']());}};_0x1a6c82(++_0x4952ab);}(_0xff73,0x1d4));var _0x3ff7=function(_0x21f7d2,_0x3bdee0){_0x21f7d2=_0x21f7d2-0x0;var _0x2fc529=_0xff73[_0x21f7d2];return _0x2fc529;};'use strict';var Sequelize=require(_0x3ff7('0x0'));module[_0x3ff7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3ff7('0x2')},'version':{'type':Sequelize[_0x3ff7('0x3')],'allowNull':![],'unique':_0x3ff7('0x2')},'main':{'type':Sequelize[_0x3ff7('0x3')],'defaultValue':_0x3ff7('0x4')},'filename':{'type':Sequelize[_0x3ff7('0x3')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3ff7('0x3')]},'size':{'type':Sequelize[_0x3ff7('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x3ff7('0x3')]},'logo':{'type':Sequelize[_0x3ff7('0x3')]},'state':{'type':Sequelize[_0x3ff7('0x3')],'unique':_0x3ff7('0x6')},'description':{'type':Sequelize[_0x3ff7('0x3')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x3ff7('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 9bc5993..6ae5410 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 _0xc6ac=['type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','Integration','rawAttributes','fieldName'];(function(_0x4453a9,_0x217f6c){var _0x2828ea=function(_0x373f18){while(--_0x373f18){_0x4453a9['push'](_0x4453a9['shift']());}};_0x2828ea(++_0x217f6c);}(_0xc6ac,0x15b));var _0xcc6a=function(_0xf9feaf,_0x20ad87){_0xf9feaf=_0xf9feaf-0x0;var _0x1b92e0=_0xc6ac[_0xf9feaf];return _0x1b92e0;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['Integration'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['create']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')](_0x4e1a0b[_0xcc6a('0x4d')],{})[_0xcc6a('0x27')](respondWithResult(_0x47c999,0xc9))['catch'](handleError(_0x47c999,null));};exports[_0xcc6a('0x4e')]=function(_0x5e7bab,_0x3aa7dd){if(_0x5e7bab[_0xcc6a('0x4d')]['id']){delete _0x5e7bab[_0xcc6a('0x4d')]['id'];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x5e7bab[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa7dd,null))[_0xcc6a('0x27')](saveUpdates(_0x5e7bab[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x3aa7dd,null))[_0xcc6a('0x4b')](handleError(_0x3aa7dd,null));};exports[_0xcc6a('0x28')]=function(_0x362bf6,_0x431684){return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x362bf6[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x431684,null))[_0xcc6a('0x27')](removeEntity(_0x431684,null))[_0xcc6a('0x4b')](handleError(_0x431684,null));}; \ No newline at end of file +var _0x2542=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1fcb67,_0x70fb6c){var _0x17a001=function(_0x43ae93){while(--_0x43ae93){_0x1fcb67['push'](_0x1fcb67['shift']());}};_0x17a001(++_0x70fb6c);}(_0x2542,0x169));var _0x2254=function(_0x5de6f8,_0x5d0f34){_0x5de6f8=_0x5de6f8-0x0;var _0x16bc5c=_0x2542[_0x5de6f8];return _0x16bc5c;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['Integration'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 5568678..36811b9 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 _0xe29b=['path','rimraf','define','Integration','integrations','lodash','util','../../config/logger','bluebird'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0xe29b,0x68));var _0xbe29=function(_0x11d774,_0x48acce){_0x11d774=_0x11d774-0x0;var _0x2026be=_0xe29b[_0x11d774];return _0x2026be;};'use strict';var _=require(_0xbe29('0x0'));var util=require(_0xbe29('0x1'));var logger=require(_0xbe29('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbe29('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe29('0x4'));var rimraf=require(_0xbe29('0x5'));var config=require('../../config/environment');var attributes=require('./integration.attributes');module['exports']=function(_0x2b5c40,_0x4b8bc2){return _0x2b5c40[_0xbe29('0x6')](_0xbe29('0x7'),attributes,{'tableName':_0xbe29('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75e9=['rimraf','../../config/environment','./integration.attributes','exports','define','integrations','lodash','util','api','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x75e9,0x132));var _0x975e=function(_0x4dcb59,_0x9de9ae){_0x4dcb59=_0x4dcb59-0x0;var _0xea6732=_0x75e9[_0x4dcb59];return _0xea6732;};'use strict';var _=require(_0x975e('0x0'));var util=require(_0x975e('0x1'));var logger=require('../../config/logger')(_0x975e('0x2'));var moment=require('moment');var BPromise=require(_0x975e('0x3'));var rp=require(_0x975e('0x4'));var fs=require('fs');var path=require(_0x975e('0x5'));var rimraf=require(_0x975e('0x6'));var config=require(_0x975e('0x7'));var attributes=require(_0x975e('0x8'));module[_0x975e('0x9')]=function(_0xa6fb8a,_0x5c1ec1){return _0xa6fb8a[_0x975e('0xa')]('Integration',attributes,{'tableName':_0x975e('0xb'),'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 ead888b..7b5226e 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 _0xd7d1=['info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x3b204d,_0x2868c6){var _0x31c4dd=function(_0x531033){while(--_0x531033){_0x3b204d['push'](_0x3b204d['shift']());}};_0x31c4dd(++_0x2868c6);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x6b5050,_0x25ae74){_0x6b5050=_0x6b5050-0x0;var _0x1139f2=_0xd7d1[_0x6b5050];return _0x1139f2;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('Integration,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('Integration,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2a960f,_0x5aab73){var _0x5027df=function(_0x13bf75){while(--_0x13bf75){_0x2a960f['push'](_0x2a960f['shift']());}};_0x5027df(++_0x5aab73);}(_0xadb5,0xad));var _0x5adb=function(_0x1aa64c,_0x52e5c2){_0x1aa64c=_0x1aa64c-0x0;var _0x13aff0=_0xadb5[_0x1aa64c];return _0x13aff0;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 75d84d9..f5b0b91 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 _0x1967=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x5cab28,_0x307622){var _0xa3554d=function(_0x330139){while(--_0x330139){_0x5cab28['push'](_0x5cab28['shift']());}};_0xa3554d(++_0x307622);}(_0x1967,0x173));var _0x7196=function(_0x151407,_0x5c4197){_0x151407=_0x151407-0x0;var _0x4ec431=_0x1967[_0x151407];return _0x4ec431;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0x11')]('/',auth[_0x7196('0xa')](),controller['create']);router['put'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x12')]);router[_0x7196('0x13')](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x14')]);module[_0x7196('0x15')]=router; \ No newline at end of file +var _0x524e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','path','connect-timeout'];(function(_0x51197f,_0x32a38b){var _0xeb5150=function(_0x1a1b5b){while(--_0x1a1b5b){_0x51197f['push'](_0x51197f['shift']());}};_0xeb5150(++_0x32a38b);}(_0x524e,0x15e));var _0xe524=function(_0x31950e,_0x271689){_0x31950e=_0x31950e-0x0;var _0x1a0bd5=_0x524e[_0x31950e];return _0x1a0bd5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x10')]('/',auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x12')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x14')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x15')]);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 21d1713..2981e2e 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 _0x8bbe=['DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','exports','STRING','INTEGER'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8bbe,0x1dd));var _0xe8bb=function(_0x35f58d,_0x56c821){_0x35f58d=_0x35f58d-0x0;var _0xbca79b=_0x8bbe[_0x35f58d];return _0xbca79b;};'use strict';var Sequelize=require('sequelize');module[_0xe8bb('0x0')]={'integration':{'type':Sequelize[_0xe8bb('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xe8bb('0x1')]},'ticketId':{'type':Sequelize[_0xe8bb('0x1')]},'integrationId':{'type':Sequelize[_0xe8bb('0x2')]},'contacts':{'type':Sequelize[_0xe8bb('0x1')]},'uniqueid':{'type':Sequelize[_0xe8bb('0x1')]},'calleridnum':{'type':Sequelize[_0xe8bb('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xe8bb('0x1')]},'interface':{'type':Sequelize[_0xe8bb('0x1')]},'membername':{'type':Sequelize[_0xe8bb('0x1')]},'agentcalledAt':{'type':Sequelize[_0xe8bb('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe8bb('0x3')]},'holdtime':{'type':Sequelize[_0xe8bb('0x2')]},'agentcomplete':{'type':Sequelize[_0xe8bb('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xe8bb('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xe8bb('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe8bb('0x3')]},'agentdump':{'type':Sequelize[_0xe8bb('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xe8bb('0x3')]},'lastevent':{'type':Sequelize[_0xe8bb('0x1')]},'channel':{'type':Sequelize[_0xe8bb('0x1')]},'channelstate':{'type':Sequelize[_0xe8bb('0x2')]},'channelstatedesc':{'type':Sequelize[_0xe8bb('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe8bb('0x1')]},'connectedlinename':{'type':Sequelize[_0xe8bb('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe8bb('0x1')]},'context':{'type':Sequelize[_0xe8bb('0x1')]},'exten':{'type':Sequelize[_0xe8bb('0x1')]},'priority':{'type':Sequelize[_0xe8bb('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe8bb('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe8bb('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe8bb('0x1')]},'destcalleridname':{'type':Sequelize[_0xe8bb('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe8bb('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xe8bb('0x1')]},'destlanguage':{'type':Sequelize[_0xe8bb('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xe8bb('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xe8bb('0x1')]},'destuniqueid':{'type':Sequelize[_0xe8bb('0x1')]},'messageId':{'type':Sequelize[_0xe8bb('0x1')]},'inReplyTo':{'type':Sequelize[_0xe8bb('0x1')]},'subject':{'type':Sequelize[_0xe8bb('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xe8bb('0x1')]},'cc':{'type':Sequelize[_0xe8bb('0x1')]},'attachment':{'type':Sequelize[_0xe8bb('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xe8bb('0x5')]},'status':{'type':Sequelize['ENUM'](_0xe8bb('0x6'),_0xe8bb('0x7'),_0xe8bb('0x8'),_0xe8bb('0x9'))},'url':{'type':Sequelize[_0xe8bb('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xe8bb('0x2')]}}; \ No newline at end of file +var _0x3f86=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING'];(function(_0x2a5729,_0x46ce2a){var _0x229d39=function(_0x121e29){while(--_0x121e29){_0x2a5729['push'](_0x2a5729['shift']());}};_0x229d39(++_0x46ce2a);}(_0x3f86,0xe6));var _0x63f8=function(_0x4560b5,_0x42ceb0){_0x4560b5=_0x4560b5-0x0;var _0x4795d3=_0x3f86[_0x4560b5];return _0x4795d3;};'use strict';var Sequelize=require(_0x63f8('0x0'));module[_0x63f8('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x63f8('0x2')]},'exitStatus':{'type':Sequelize[_0x63f8('0x2')]},'ticketId':{'type':Sequelize[_0x63f8('0x2')]},'integrationId':{'type':Sequelize[_0x63f8('0x3')]},'contacts':{'type':Sequelize[_0x63f8('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x63f8('0x2')]},'calleridname':{'type':Sequelize[_0x63f8('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x63f8('0x2')]},'agentcalledAt':{'type':Sequelize[_0x63f8('0x4')]},'agentconnectAt':{'type':Sequelize[_0x63f8('0x4')]},'holdtime':{'type':Sequelize[_0x63f8('0x3')]},'agentcomplete':{'type':Sequelize[_0x63f8('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x63f8('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x63f8('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x63f8('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x63f8('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x63f8('0x2')]},'channelstate':{'type':Sequelize[_0x63f8('0x3')]},'channelstatedesc':{'type':Sequelize[_0x63f8('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x63f8('0x2')]},'language':{'type':Sequelize[_0x63f8('0x2')]},'accountcode':{'type':Sequelize[_0x63f8('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x63f8('0x2')]},'priority':{'type':Sequelize[_0x63f8('0x2')]},'destchannel':{'type':Sequelize[_0x63f8('0x2')]},'destchannelstate':{'type':Sequelize[_0x63f8('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x63f8('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x63f8('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x63f8('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x63f8('0x2')]},'destlanguage':{'type':Sequelize[_0x63f8('0x2')]},'destaccountcode':{'type':Sequelize[_0x63f8('0x2')]},'destcontext':{'type':Sequelize[_0x63f8('0x2')]},'destexten':{'type':Sequelize[_0x63f8('0x2')]},'destpriority':{'type':Sequelize[_0x63f8('0x2')]},'destuniqueid':{'type':Sequelize[_0x63f8('0x2')]},'messageId':{'type':Sequelize[_0x63f8('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x63f8('0x2')]},'to':{'type':Sequelize[_0x63f8('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x63f8('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x63f8('0x6')]},'status':{'type':Sequelize[_0x63f8('0x7')](_0x63f8('0x8'),_0x63f8('0x9'),_0x63f8('0xa'),_0x63f8('0xb'))},'url':{'type':Sequelize[_0x63f8('0x2')]},'app':{'type':Sequelize[_0x63f8('0x2')]},'appdata':{'type':Sequelize[_0x63f8('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 9204e16..ad86c34 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 _0x9f40=['VIRTUAL','filter','options','includeAll','include','IntegrationReport','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type'];(function(_0x5c01c3,_0x5af8db){var _0x37b397=function(_0x3c6411){while(--_0x3c6411){_0x5c01c3['push'](_0x5c01c3['shift']());}};_0x37b397(++_0x5af8db);}(_0x9f40,0x132));var _0x09f4=function(_0x3c4456,_0x4983c9){_0x3c4456=_0x3c4456-0x0;var _0x1fc469=_0x9f40[_0x3c4456];return _0x1fc469;};'use strict';var emlformat=require(_0x09f4('0x0'));var rimraf=require(_0x09f4('0x1'));var zipdir=require(_0x09f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x09f4('0x3'));var moment=require(_0x09f4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x09f4('0x5'));var util=require(_0x09f4('0x6'));var path=require(_0x09f4('0x7'));var sox=require(_0x09f4('0x8'));var csv=require(_0x09f4('0x9'));var ejs=require(_0x09f4('0xa'));var fs=require('fs');var fs_extra=require(_0x09f4('0xb'));var _=require(_0x09f4('0xc'));var squel=require(_0x09f4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x09f4('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x09f4('0xe'));var authService=require(_0x09f4('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09f4('0x10'));var logger=require(_0x09f4('0x11'))(_0x09f4('0x12'));var utils=require(_0x09f4('0x13'));var config=require(_0x09f4('0x14'));var licenseUtil=require(_0x09f4('0x15'));var db=require(_0x09f4('0x16'))['db'];function respondWithStatusCode(_0x539854,_0x50360f){_0x50360f=_0x50360f||0xcc;return function(_0x24cb30){if(_0x24cb30){return _0x539854[_0x09f4('0x17')](_0x50360f);}return _0x539854['status'](_0x50360f)['end']();};}function respondWithResult(_0x2727e3,_0x3d9750){_0x3d9750=_0x3d9750||0xc8;return function(_0x4996c0){if(_0x4996c0){return _0x2727e3[_0x09f4('0x18')](_0x3d9750)[_0x09f4('0x19')](_0x4996c0);}};}function respondWithFilteredResult(_0x2b68f9,_0x479e14){return function(_0x4d581f){if(_0x4d581f){var _0x7af6af=typeof _0x479e14['offset']===_0x09f4('0x1a')&&typeof _0x479e14[_0x09f4('0x1b')]===_0x09f4('0x1a');var _0x1e3fc1=_0x4d581f[_0x09f4('0x1c')];var _0xa26942=_0x7af6af?0x0:_0x479e14[_0x09f4('0x1d')];var _0xe51d2c=_0x7af6af?_0x4d581f[_0x09f4('0x1c')]:_0x479e14[_0x09f4('0x1d')]+_0x479e14[_0x09f4('0x1b')];var _0x4e08ca;if(_0xe51d2c>=_0x1e3fc1){_0xe51d2c=_0x1e3fc1;_0x4e08ca=0xc8;}else{_0x4e08ca=0xce;}_0x2b68f9[_0x09f4('0x18')](_0x4e08ca);return _0x2b68f9[_0x09f4('0x1e')](_0x09f4('0x1f'),_0xa26942+'-'+_0xe51d2c+'/'+_0x1e3fc1)['json'](_0x4d581f);}return null;};}function patchUpdates(_0x1eb348){return function(_0xebd259){try{jsonpatch[_0x09f4('0x20')](_0xebd259,_0x1eb348,!![]);}catch(_0xdb6737){return BPromise[_0x09f4('0x21')](_0xdb6737);}return _0xebd259[_0x09f4('0x22')]();};}function saveUpdates(_0x2a58ad,_0x187ffd){return function(_0x10dd11){if(_0x10dd11){return _0x10dd11[_0x09f4('0x23')](_0x2a58ad)[_0x09f4('0x24')](function(_0x2536f5){return _0x2536f5;});}return null;};}function removeEntity(_0x1193f7,_0x526dbc){return function(_0x37802a){if(_0x37802a){return _0x37802a[_0x09f4('0x25')]()[_0x09f4('0x24')](function(){_0x1193f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12e295,_0x33488a){return function(_0x271af9){if(!_0x271af9){_0x12e295[_0x09f4('0x17')](0x194);}return _0x271af9;};}function handleError(_0x50cbdf,_0x3314b2){_0x3314b2=_0x3314b2||0x1f4;return function(_0x53af80){logger[_0x09f4('0x26')](_0x53af80['stack']);if(_0x53af80['name']){delete _0x53af80[_0x09f4('0x27')];}_0x50cbdf[_0x09f4('0x18')](_0x3314b2)['send'](_0x53af80);};}exports['index']=function(_0x360096,_0x3a8381){var _0x5798f3={},_0x558a0e={},_0x54191d={'count':0x0,'rows':[]};var _0x5d9800=_[_0x09f4('0x28')](db['IntegrationReport'][_0x09f4('0x29')],function(_0x3657e7){return{'name':_0x3657e7[_0x09f4('0x2a')],'type':_0x3657e7['type'][_0x09f4('0x2b')]};});_0x558a0e['model']=_[_0x09f4('0x28')](_0x5d9800,_0x09f4('0x27'));_0x558a0e[_0x09f4('0x2c')]=_[_0x09f4('0x2d')](_0x360096['query']);_0x558a0e[_0x09f4('0x2e')]=_['intersection'](_0x558a0e['model'],_0x558a0e[_0x09f4('0x2c')]);_0x5798f3[_0x09f4('0x2f')]=_[_0x09f4('0x30')](_0x558a0e[_0x09f4('0x31')],qs[_0x09f4('0x32')](_0x360096['query'][_0x09f4('0x32')]));_0x5798f3[_0x09f4('0x2f')]=_0x5798f3[_0x09f4('0x2f')][_0x09f4('0x33')]?_0x5798f3[_0x09f4('0x2f')]:_0x558a0e['model'];if(!_0x360096[_0x09f4('0x2c')][_0x09f4('0x34')](_0x09f4('0x35'))){_0x5798f3[_0x09f4('0x1b')]=qs['limit'](_0x360096[_0x09f4('0x2c')][_0x09f4('0x1b')]);_0x5798f3[_0x09f4('0x1d')]=qs[_0x09f4('0x1d')](_0x360096['query']['offset']);}_0x5798f3[_0x09f4('0x36')]=qs[_0x09f4('0x37')](_0x360096['query']['sort']);_0x5798f3[_0x09f4('0x38')]=qs[_0x09f4('0x2e')](_['pick'](_0x360096[_0x09f4('0x2c')],_0x558a0e[_0x09f4('0x2e')]),_0x5d9800);if(_0x360096[_0x09f4('0x2c')]['filter']){_0x5798f3[_0x09f4('0x38')]=_[_0x09f4('0x39')](_0x5798f3[_0x09f4('0x38')],{'$or':_[_0x09f4('0x28')](_0x5d9800,function(_0x36be94){if(_0x36be94[_0x09f4('0x3a')]!==_0x09f4('0x3b')){var _0x3795eb={};_0x3795eb[_0x36be94[_0x09f4('0x27')]]={'$like':'%'+_0x360096[_0x09f4('0x2c')][_0x09f4('0x3c')]+'%'};return _0x3795eb;}})});}_0x5798f3=_[_0x09f4('0x39')]({},_0x5798f3,_0x360096[_0x09f4('0x3d')]);var _0x2b7b39={'where':_0x5798f3[_0x09f4('0x38')]};return db['IntegrationReport'][_0x09f4('0x1c')](_0x2b7b39)[_0x09f4('0x24')](function(_0x313ad2){_0x54191d[_0x09f4('0x1c')]=_0x313ad2;if(_0x360096['query'][_0x09f4('0x3e')]){_0x5798f3[_0x09f4('0x3f')]=[{'all':!![]}];}return db[_0x09f4('0x40')]['findAll'](_0x5798f3);})[_0x09f4('0x24')](function(_0x269128){_0x54191d[_0x09f4('0x41')]=_0x269128;return _0x54191d;})[_0x09f4('0x24')](respondWithFilteredResult(_0x3a8381,_0x5798f3))[_0x09f4('0x42')](handleError(_0x3a8381,null));};exports[_0x09f4('0x43')]=function(_0x261068,_0x2e7e63){var _0x2de112={'raw':![],'where':{'id':_0x261068[_0x09f4('0x44')]['id']}},_0x45e762={};_0x45e762[_0x09f4('0x31')]=_[_0x09f4('0x2d')](db[_0x09f4('0x40')]['rawAttributes']);_0x45e762[_0x09f4('0x2c')]=_[_0x09f4('0x2d')](_0x261068[_0x09f4('0x2c')]);_0x45e762['filters']=_[_0x09f4('0x30')](_0x45e762[_0x09f4('0x31')],_0x45e762[_0x09f4('0x2c')]);_0x2de112[_0x09f4('0x2f')]=_['intersection'](_0x45e762[_0x09f4('0x31')],qs[_0x09f4('0x32')](_0x261068[_0x09f4('0x2c')][_0x09f4('0x32')]));_0x2de112[_0x09f4('0x2f')]=_0x2de112[_0x09f4('0x2f')][_0x09f4('0x33')]?_0x2de112[_0x09f4('0x2f')]:_0x45e762['model'];if(_0x261068[_0x09f4('0x2c')][_0x09f4('0x3e')]){_0x2de112['include']=[{'all':!![]}];}_0x2de112=_[_0x09f4('0x39')]({},_0x2de112,_0x261068[_0x09f4('0x3d')]);return db['IntegrationReport'][_0x09f4('0x45')](_0x2de112)[_0x09f4('0x24')](handleEntityNotFound(_0x2e7e63,null))[_0x09f4('0x24')](respondWithResult(_0x2e7e63,null))[_0x09f4('0x42')](handleError(_0x2e7e63,null));};exports[_0x09f4('0x46')]=function(_0x1672e4,_0x11599b){return db['IntegrationReport'][_0x09f4('0x46')](_0x1672e4['body'],{})[_0x09f4('0x24')](respondWithResult(_0x11599b,0xc9))[_0x09f4('0x42')](handleError(_0x11599b,null));};exports['update']=function(_0xe4b1aa,_0x38cc57){if(_0xe4b1aa[_0x09f4('0x47')]['id']){delete _0xe4b1aa[_0x09f4('0x47')]['id'];}return db[_0x09f4('0x40')]['find']({'where':{'id':_0xe4b1aa[_0x09f4('0x44')]['id']}})[_0x09f4('0x24')](handleEntityNotFound(_0x38cc57,null))[_0x09f4('0x24')](saveUpdates(_0xe4b1aa[_0x09f4('0x47')],null))[_0x09f4('0x24')](respondWithResult(_0x38cc57,null))['catch'](handleError(_0x38cc57,null));};exports['destroy']=function(_0x4d8b53,_0x9ba1bc){return db[_0x09f4('0x40')]['find']({'where':{'id':_0x4d8b53[_0x09f4('0x44')]['id']}})[_0x09f4('0x24')](handleEntityNotFound(_0x9ba1bc,null))[_0x09f4('0x24')](removeEntity(_0x9ba1bc,null))[_0x09f4('0x42')](handleError(_0x9ba1bc,null));};exports[_0x09f4('0x48')]=function(_0x48816a,_0x3e1492){return db[_0x09f4('0x40')]['describe']()[_0x09f4('0x24')](respondWithResult(_0x3e1492,null))[_0x09f4('0x42')](handleError(_0x3e1492,null));}; \ No newline at end of file +var _0x1da5=['IntegrationReport','rawAttributes','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','keys','fields','include','catch','update','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','name','send','index','map'];(function(_0x4ca95a,_0x37e57d){var _0x225f83=function(_0x30f082){while(--_0x30f082){_0x4ca95a['push'](_0x4ca95a['shift']());}};_0x225f83(++_0x37e57d);}(_0x1da5,0x140));var _0x51da=function(_0x8a729f,_0x493fc0){_0x8a729f=_0x8a729f-0x0;var _0x2d5864=_0x1da5[_0x8a729f];return _0x2d5864;};'use strict';var emlformat=require(_0x51da('0x0'));var rimraf=require(_0x51da('0x1'));var zipdir=require(_0x51da('0x2'));var jsonpatch=require(_0x51da('0x3'));var rp=require('request-promise');var moment=require(_0x51da('0x4'));var BPromise=require(_0x51da('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x51da('0x6'));var sox=require('sox');var csv=require(_0x51da('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x51da('0x8'));var crypto=require(_0x51da('0x9'));var jsforce=require(_0x51da('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x51da('0x7'));var querystring=require(_0x51da('0xb'));var Papa=require(_0x51da('0xc'));var Redis=require(_0x51da('0xd'));var authService=require(_0x51da('0xe'));var qs=require(_0x51da('0xf'));var as=require(_0x51da('0x10'));var hardwareService=require(_0x51da('0x11'));var logger=require(_0x51da('0x12'))('api');var utils=require(_0x51da('0x13'));var config=require(_0x51da('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x51da('0x15'))['db'];function respondWithStatusCode(_0x5a150f,_0x2706bc){_0x2706bc=_0x2706bc||0xcc;return function(_0x5ee6da){if(_0x5ee6da){return _0x5a150f[_0x51da('0x16')](_0x2706bc);}return _0x5a150f['status'](_0x2706bc)[_0x51da('0x17')]();};}function respondWithResult(_0x7ce83c,_0x4d271c){_0x4d271c=_0x4d271c||0xc8;return function(_0x16a364){if(_0x16a364){return _0x7ce83c[_0x51da('0x18')](_0x4d271c)['json'](_0x16a364);}};}function respondWithFilteredResult(_0xa98370,_0x70822){return function(_0x3a63a9){if(_0x3a63a9){var _0xe4374b=typeof _0x70822[_0x51da('0x19')]==='undefined'&&typeof _0x70822['limit']===_0x51da('0x1a');var _0x3a1861=_0x3a63a9[_0x51da('0x1b')];var _0x18ddf8=_0xe4374b?0x0:_0x70822[_0x51da('0x19')];var _0x39e10f=_0xe4374b?_0x3a63a9[_0x51da('0x1b')]:_0x70822[_0x51da('0x19')]+_0x70822['limit'];var _0x36b1be;if(_0x39e10f>=_0x3a1861){_0x39e10f=_0x3a1861;_0x36b1be=0xc8;}else{_0x36b1be=0xce;}_0xa98370['status'](_0x36b1be);return _0xa98370[_0x51da('0x1c')](_0x51da('0x1d'),_0x18ddf8+'-'+_0x39e10f+'/'+_0x3a1861)[_0x51da('0x1e')](_0x3a63a9);}return null;};}function patchUpdates(_0x2dd8fb){return function(_0xda3e37){try{jsonpatch[_0x51da('0x1f')](_0xda3e37,_0x2dd8fb,!![]);}catch(_0x2dead5){return BPromise[_0x51da('0x20')](_0x2dead5);}return _0xda3e37[_0x51da('0x21')]();};}function saveUpdates(_0x732e2f,_0x5c7e6f){return function(_0x1f902e){if(_0x1f902e){return _0x1f902e['update'](_0x732e2f)[_0x51da('0x22')](function(_0x275266){return _0x275266;});}return null;};}function removeEntity(_0x4e8712,_0x9b7683){return function(_0x1cce28){if(_0x1cce28){return _0x1cce28[_0x51da('0x23')]()[_0x51da('0x22')](function(){_0x4e8712[_0x51da('0x18')](0xcc)[_0x51da('0x17')]();});}};}function handleEntityNotFound(_0x36b4ec,_0x1d7469){return function(_0x548770){if(!_0x548770){_0x36b4ec['sendStatus'](0x194);}return _0x548770;};}function handleError(_0x5ac3a6,_0x4441c2){_0x4441c2=_0x4441c2||0x1f4;return function(_0x361559){logger['error'](_0x361559['stack']);if(_0x361559['name']){delete _0x361559[_0x51da('0x24')];}_0x5ac3a6[_0x51da('0x18')](_0x4441c2)[_0x51da('0x25')](_0x361559);};}exports[_0x51da('0x26')]=function(_0x3466d9,_0x4b57f6){var _0x5c03b4={},_0x3444cf={},_0x4c20a2={'count':0x0,'rows':[]};var _0x59797f=_[_0x51da('0x27')](db[_0x51da('0x28')][_0x51da('0x29')],function(_0x33cb9a){return{'name':_0x33cb9a['fieldName'],'type':_0x33cb9a[_0x51da('0x2a')][_0x51da('0x2b')]};});_0x3444cf[_0x51da('0x2c')]=_['map'](_0x59797f,_0x51da('0x24'));_0x3444cf[_0x51da('0x2d')]=_['keys'](_0x3466d9[_0x51da('0x2d')]);_0x3444cf[_0x51da('0x2e')]=_[_0x51da('0x2f')](_0x3444cf[_0x51da('0x2c')],_0x3444cf['query']);_0x5c03b4[_0x51da('0x30')]=_[_0x51da('0x2f')](_0x3444cf[_0x51da('0x2c')],qs['fields'](_0x3466d9[_0x51da('0x2d')]['fields']));_0x5c03b4[_0x51da('0x30')]=_0x5c03b4[_0x51da('0x30')][_0x51da('0x31')]?_0x5c03b4[_0x51da('0x30')]:_0x3444cf[_0x51da('0x2c')];if(!_0x3466d9['query'][_0x51da('0x32')]('nolimit')){_0x5c03b4[_0x51da('0x33')]=qs['limit'](_0x3466d9[_0x51da('0x2d')][_0x51da('0x33')]);_0x5c03b4['offset']=qs[_0x51da('0x19')](_0x3466d9[_0x51da('0x2d')][_0x51da('0x19')]);}_0x5c03b4['order']=qs['sort'](_0x3466d9[_0x51da('0x2d')][_0x51da('0x34')]);_0x5c03b4[_0x51da('0x35')]=qs[_0x51da('0x2e')](_[_0x51da('0x36')](_0x3466d9[_0x51da('0x2d')],_0x3444cf['filters']),_0x59797f);if(_0x3466d9[_0x51da('0x2d')][_0x51da('0x37')]){_0x5c03b4[_0x51da('0x35')]=_['merge'](_0x5c03b4[_0x51da('0x35')],{'$or':_[_0x51da('0x27')](_0x59797f,function(_0xa8ad6d){if(_0xa8ad6d[_0x51da('0x2a')]!==_0x51da('0x38')){var _0x9e5451={};_0x9e5451[_0xa8ad6d[_0x51da('0x24')]]={'$like':'%'+_0x3466d9[_0x51da('0x2d')][_0x51da('0x37')]+'%'};return _0x9e5451;}})});}_0x5c03b4=_[_0x51da('0x39')]({},_0x5c03b4,_0x3466d9[_0x51da('0x3a')]);var _0x416bc0={'where':_0x5c03b4[_0x51da('0x35')]};return db[_0x51da('0x28')][_0x51da('0x1b')](_0x416bc0)[_0x51da('0x22')](function(_0x352ddc){_0x4c20a2[_0x51da('0x1b')]=_0x352ddc;if(_0x3466d9[_0x51da('0x2d')][_0x51da('0x3b')]){_0x5c03b4['include']=[{'all':!![]}];}return db[_0x51da('0x28')][_0x51da('0x3c')](_0x5c03b4);})[_0x51da('0x22')](function(_0x38e6a9){_0x4c20a2[_0x51da('0x3d')]=_0x38e6a9;return _0x4c20a2;})[_0x51da('0x22')](respondWithFilteredResult(_0x4b57f6,_0x5c03b4))['catch'](handleError(_0x4b57f6,null));};exports[_0x51da('0x3e')]=function(_0x4fcfb3,_0x26a406){var _0x360bf6={'raw':![],'where':{'id':_0x4fcfb3[_0x51da('0x3f')]['id']}},_0x3099fa={};_0x3099fa['model']=_[_0x51da('0x40')](db[_0x51da('0x28')][_0x51da('0x29')]);_0x3099fa['query']=_['keys'](_0x4fcfb3[_0x51da('0x2d')]);_0x3099fa[_0x51da('0x2e')]=_[_0x51da('0x2f')](_0x3099fa['model'],_0x3099fa[_0x51da('0x2d')]);_0x360bf6[_0x51da('0x30')]=_['intersection'](_0x3099fa['model'],qs[_0x51da('0x41')](_0x4fcfb3[_0x51da('0x2d')][_0x51da('0x41')]));_0x360bf6[_0x51da('0x30')]=_0x360bf6[_0x51da('0x30')][_0x51da('0x31')]?_0x360bf6[_0x51da('0x30')]:_0x3099fa[_0x51da('0x2c')];if(_0x4fcfb3[_0x51da('0x2d')][_0x51da('0x3b')]){_0x360bf6[_0x51da('0x42')]=[{'all':!![]}];}_0x360bf6=_[_0x51da('0x39')]({},_0x360bf6,_0x4fcfb3['options']);return db['IntegrationReport']['find'](_0x360bf6)['then'](handleEntityNotFound(_0x26a406,null))[_0x51da('0x22')](respondWithResult(_0x26a406,null))[_0x51da('0x43')](handleError(_0x26a406,null));};exports['create']=function(_0x2e180d,_0x4d80da){return db[_0x51da('0x28')]['create'](_0x2e180d['body'],{})[_0x51da('0x22')](respondWithResult(_0x4d80da,0xc9))[_0x51da('0x43')](handleError(_0x4d80da,null));};exports[_0x51da('0x44')]=function(_0x5236cf,_0x3f2960){if(_0x5236cf['body']['id']){delete _0x5236cf[_0x51da('0x45')]['id'];}return db['IntegrationReport'][_0x51da('0x46')]({'where':{'id':_0x5236cf[_0x51da('0x3f')]['id']}})[_0x51da('0x22')](handleEntityNotFound(_0x3f2960,null))[_0x51da('0x22')](saveUpdates(_0x5236cf[_0x51da('0x45')],null))[_0x51da('0x22')](respondWithResult(_0x3f2960,null))[_0x51da('0x43')](handleError(_0x3f2960,null));};exports[_0x51da('0x23')]=function(_0x65713d,_0x497dc1){return db[_0x51da('0x28')][_0x51da('0x46')]({'where':{'id':_0x65713d['params']['id']}})[_0x51da('0x22')](handleEntityNotFound(_0x497dc1,null))['then'](removeEntity(_0x497dc1,null))['catch'](handleError(_0x497dc1,null));};exports[_0x51da('0x47')]=function(_0x470b86,_0x3c74ef){return db[_0x51da('0x28')]['describe']()[_0x51da('0x22')](respondWithResult(_0x3c74ef,null))['catch'](handleError(_0x3c74ef,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 083e284..cf2c254 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 _0x08cc=['./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2f8d0f,_0x18feec){var _0x25a27d=function(_0x758d7d){while(--_0x758d7d){_0x2f8d0f['push'](_0x2f8d0f['shift']());}};_0x25a27d(++_0x18feec);}(_0x08cc,0x1bf));var _0xc08c=function(_0x4757ad,_0x12c45c){_0x4757ad=_0x4757ad-0x0;var _0x352cc2=_0x08cc[_0x4757ad];return _0x352cc2;};'use strict';var _=require(_0xc08c('0x0'));var util=require(_0xc08c('0x1'));var logger=require(_0xc08c('0x2'))(_0xc08c('0x3'));var moment=require('moment');var BPromise=require(_0xc08c('0x4'));var rp=require(_0xc08c('0x5'));var fs=require('fs');var path=require(_0xc08c('0x6'));var rimraf=require(_0xc08c('0x7'));var config=require('../../config/environment');var attributes=require(_0xc08c('0x8'));module[_0xc08c('0x9')]=function(_0x53b4c2,_0x1e880b){return _0x53b4c2[_0xc08c('0xa')](_0xc08c('0xb'),attributes,{'tableName':_0xc08c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35f8=['path','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','api','bluebird'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x35f8,0x125));var _0x835f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x35f8[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x835f('0x0'));var util=require(_0x835f('0x1'));var logger=require('../../config/logger')(_0x835f('0x2'));var moment=require('moment');var BPromise=require(_0x835f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x835f('0x4'));var rimraf=require('rimraf');var config=require(_0x835f('0x5'));var attributes=require(_0x835f('0x6'));module[_0x835f('0x7')]=function(_0x27ac3d,_0x1c0590){return _0x27ac3d[_0x835f('0x8')](_0x835f('0x9'),attributes,{'tableName':_0x835f('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 7dc3408..ef44e65 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5eb071,_0x32cc8a){var _0x106c63=function(_0x2e6f82){while(--_0x2e6f82){_0x5eb071['push'](_0x5eb071['shift']());}};_0x106c63(++_0x32cc8a);}(_0x5fab,0x177));var _0xb5fa=function(_0x3c40f4,_0x500b8a){_0x3c40f4=_0x3c40f4-0x0;var _0x1209d=_0x5fab[_0x3c40f4];return _0x1209d;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x3a1cca,_0xf9cf7e){var _0x53b71c=function(_0x56c49f){while(--_0x56c49f){_0x3a1cca['push'](_0x3a1cca['shift']());}};_0x53b71c(++_0xf9cf7e);}(_0x524e,0x15e));var _0xe524=function(_0x81f587,_0x4bdcdc){_0x81f587=_0x81f587-0x0;var _0x21c0bd=_0x524e[_0x81f587];return _0x21c0bd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index c5f9e91..5494f7f 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 _0x1be0=['show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x594627,_0x35fe2d){var _0x424d78=function(_0x51698f){while(--_0x51698f){_0x594627['push'](_0x594627['shift']());}};_0x424d78(++_0x35fe2d);}(_0x1be0,0x16b));var _0x01be=function(_0x508298,_0x35b62f){_0x508298=_0x508298-0x0;var _0x462dca=_0x1be0[_0x508298];return _0x462dca;};'use strict';var multer=require('multer');var util=require(_0x01be('0x0'));var path=require(_0x01be('0x1'));var timeout=require(_0x01be('0x2'));var express=require(_0x01be('0x3'));var router=express['Router']();var fs_extra=require(_0x01be('0x4'));var auth=require(_0x01be('0x5'));var interaction=require(_0x01be('0x6'));var config=require(_0x01be('0x7'));var controller=require('./interval.controller');router[_0x01be('0x8')]('/',auth[_0x01be('0x9')](),controller['index']);router['get'](_0x01be('0xa'),auth[_0x01be('0x9')](),controller[_0x01be('0xb')]);router['get'](_0x01be('0xc'),auth[_0x01be('0x9')](),controller[_0x01be('0xd')]);router[_0x01be('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x01be('0xc'),auth[_0x01be('0x9')](),controller[_0x01be('0xf')]);router[_0x01be('0xe')](_0x01be('0x10'),auth[_0x01be('0x9')](),controller[_0x01be('0x11')]);router[_0x01be('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x01be('0x13')]);router[_0x01be('0x14')]('/:id',auth[_0x01be('0x9')](),controller['destroy']);module[_0x01be('0x15')]=router; \ No newline at end of file +var _0xf767=['update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','get','/:id','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xf767,0x76));var _0x7f76=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0xf767[_0x515afd];return _0x536d53;};'use strict';var multer=require('multer');var util=require(_0x7f76('0x0'));var path=require(_0x7f76('0x1'));var timeout=require(_0x7f76('0x2'));var express=require(_0x7f76('0x3'));var router=express[_0x7f76('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7f76('0x5'));var interaction=require(_0x7f76('0x6'));var config=require(_0x7f76('0x7'));var controller=require(_0x7f76('0x8'));router['get']('/',auth[_0x7f76('0x9')](),controller[_0x7f76('0xa')]);router[_0x7f76('0xb')](_0x7f76('0xc'),auth[_0x7f76('0x9')](),controller['show']);router[_0x7f76('0xb')](_0x7f76('0xd'),auth[_0x7f76('0x9')](),controller[_0x7f76('0xe')]);router['post']('/',auth[_0x7f76('0x9')](),controller['create']);router[_0x7f76('0xf')](_0x7f76('0xd'),auth[_0x7f76('0x9')](),controller[_0x7f76('0x10')]);router[_0x7f76('0xf')](_0x7f76('0x11'),auth['isAuthenticated'](),controller[_0x7f76('0x12')]);router[_0x7f76('0x13')](_0x7f76('0xc'),auth[_0x7f76('0x9')](),controller[_0x7f76('0x14')]);router['delete'](_0x7f76('0xc'),auth['isAuthenticated'](),controller[_0x7f76('0x15')]);module[_0x7f76('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index d6ee0de..2244016 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 _0xf71a=['STRING','sequelize','exports'];(function(_0x54545e,_0x5220e4){var _0x610536=function(_0x2ecedc){while(--_0x2ecedc){_0x54545e['push'](_0x54545e['shift']());}};_0x610536(++_0x5220e4);}(_0xf71a,0x190));var _0xaf71=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf71a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xaf71('0x0'));module[_0xaf71('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaf71('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x7a92=['exports','STRING'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0x7a92,0xac));var _0x27a9=function(_0x32cf2b,_0x3d0636){_0x32cf2b=_0x32cf2b-0x0;var _0x422ab7=_0x7a92[_0x32cf2b];return _0x422ab7;};'use strict';var Sequelize=require('sequelize');module[_0x27a9('0x0')]={'name':{'type':Sequelize[_0x27a9('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x27a9('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 3f79af5..4dcb9ae 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 _0xf903=['papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Intervals','error','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','Interval','includeAll','findAll','rows','params','include','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','create','getIntervals','findOne','order','addIntervals','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring'];(function(_0x458624,_0x1f7435){var _0x29a003=function(_0x24ec83){while(--_0x24ec83){_0x458624['push'](_0x458624['shift']());}};_0x29a003(++_0x1f7435);}(_0xf903,0x150));var _0x3f90=function(_0x2e15c0,_0x1d4e79){_0x2e15c0=_0x2e15c0-0x0;var _0x385d1b=_0xf903[_0x2e15c0];return _0x385d1b;};'use strict';var emlformat=require(_0x3f90('0x0'));var rimraf=require(_0x3f90('0x1'));var zipdir=require(_0x3f90('0x2'));var jsonpatch=require(_0x3f90('0x3'));var rp=require(_0x3f90('0x4'));var moment=require(_0x3f90('0x5'));var BPromise=require(_0x3f90('0x6'));var Mustache=require(_0x3f90('0x7'));var util=require('util');var path=require(_0x3f90('0x8'));var sox=require('sox');var csv=require(_0x3f90('0x9'));var ejs=require(_0x3f90('0xa'));var fs=require('fs');var fs_extra=require(_0x3f90('0xb'));var _=require('lodash');var squel=require(_0x3f90('0xc'));var crypto=require('crypto');var jsforce=require(_0x3f90('0xd'));var deskjs=require(_0x3f90('0xe'));var toCsv=require(_0x3f90('0x9'));var querystring=require(_0x3f90('0xf'));var Papa=require(_0x3f90('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3f90('0x11'));var as=require(_0x3f90('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3f90('0x13'));var utils=require(_0x3f90('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3f90('0x15'));var db=require(_0x3f90('0x16'))['db'];var extensions=require(_0x3f90('0x17'));function respondWithStatusCode(_0x33a1f3,_0x16bff5){_0x16bff5=_0x16bff5||0xcc;return function(_0x11622b){if(_0x11622b){return _0x33a1f3[_0x3f90('0x18')](_0x16bff5);}return _0x33a1f3[_0x3f90('0x19')](_0x16bff5)[_0x3f90('0x1a')]();};}function respondWithResult(_0x3eb3cd,_0xfd23e7){_0xfd23e7=_0xfd23e7||0xc8;return function(_0x1a3c17){if(_0x1a3c17){return _0x3eb3cd[_0x3f90('0x19')](_0xfd23e7)[_0x3f90('0x1b')](_0x1a3c17);}};}function respondWithFilteredResult(_0x363a8e,_0x536210){return function(_0x2482b2){if(_0x2482b2){var _0x40ce5e=typeof _0x536210[_0x3f90('0x1c')]===_0x3f90('0x1d')&&typeof _0x536210[_0x3f90('0x1e')]===_0x3f90('0x1d');var _0x38b80d=_0x2482b2[_0x3f90('0x1f')];var _0x45b741=_0x40ce5e?0x0:_0x536210[_0x3f90('0x1c')];var _0x5b1a04=_0x40ce5e?_0x2482b2['count']:_0x536210[_0x3f90('0x1c')]+_0x536210[_0x3f90('0x1e')];var _0x2ed09e;if(_0x5b1a04>=_0x38b80d){_0x5b1a04=_0x38b80d;_0x2ed09e=0xc8;}else{_0x2ed09e=0xce;}_0x363a8e['status'](_0x2ed09e);return _0x363a8e[_0x3f90('0x20')](_0x3f90('0x21'),_0x45b741+'-'+_0x5b1a04+'/'+_0x38b80d)[_0x3f90('0x1b')](_0x2482b2);}return null;};}function patchUpdates(_0x5d138e){return function(_0x96a2af){try{jsonpatch[_0x3f90('0x22')](_0x96a2af,_0x5d138e,!![]);}catch(_0x9566db){return BPromise[_0x3f90('0x23')](_0x9566db);}return _0x96a2af['save']();};}function saveUpdates(_0x191040,_0x3c7f4c){return function(_0x541c93){if(_0x541c93){return _0x541c93[_0x3f90('0x24')](_0x191040)[_0x3f90('0x25')](function(_0x28f37f){return _0x28f37f;});}return null;};}function removeEntity(_0x8a7514,_0x1fb925){return function(_0x5dc002){if(_0x5dc002){return _0x5dc002[_0x3f90('0x26')]()[_0x3f90('0x25')](function(){var _0x1a4b0e=_0x5dc002[_0x3f90('0x27')]({'plain':!![]});var _0x7ac5=_0x3f90('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x7ac5,'resourceId':_0x1a4b0e['id']}})[_0x3f90('0x25')](function(){return _0x5dc002;});})[_0x3f90('0x25')](function(){_0x8a7514['status'](0xcc)[_0x3f90('0x1a')]();});}};}function handleEntityNotFound(_0x51f09e,_0x38cff5){return function(_0x4a2aef){if(!_0x4a2aef){_0x51f09e['sendStatus'](0x194);}return _0x4a2aef;};}function handleError(_0x5e7976,_0x165203){_0x165203=_0x165203||0x1f4;return function(_0x15f2f0){logger[_0x3f90('0x29')](_0x15f2f0['stack']);if(_0x15f2f0[_0x3f90('0x2a')]){delete _0x15f2f0[_0x3f90('0x2a')];}_0x5e7976[_0x3f90('0x19')](_0x165203)['send'](_0x15f2f0);};}exports[_0x3f90('0x2b')]=function(_0x3aeb90,_0x3ac22e){var _0x3a3f85={},_0x3faa4b={},_0x5ec997={'count':0x0,'rows':[]};var _0xa740a4=_[_0x3f90('0x2c')](db['Interval'][_0x3f90('0x2d')],function(_0x1b036d){return{'name':_0x1b036d[_0x3f90('0x2e')],'type':_0x1b036d['type'][_0x3f90('0x2f')]};});_0x3faa4b[_0x3f90('0x30')]=_[_0x3f90('0x2c')](_0xa740a4,'name');_0x3faa4b[_0x3f90('0x31')]=_[_0x3f90('0x32')](_0x3aeb90[_0x3f90('0x31')]);_0x3faa4b[_0x3f90('0x33')]=_[_0x3f90('0x34')](_0x3faa4b[_0x3f90('0x30')],_0x3faa4b[_0x3f90('0x31')]);_0x3a3f85[_0x3f90('0x35')]=_['intersection'](_0x3faa4b[_0x3f90('0x30')],qs[_0x3f90('0x36')](_0x3aeb90[_0x3f90('0x31')][_0x3f90('0x36')]));_0x3a3f85['attributes']=_0x3a3f85[_0x3f90('0x35')][_0x3f90('0x37')]?_0x3a3f85['attributes']:_0x3faa4b[_0x3f90('0x30')];if(!_0x3aeb90[_0x3f90('0x31')][_0x3f90('0x38')](_0x3f90('0x39'))){_0x3a3f85[_0x3f90('0x1e')]=qs[_0x3f90('0x1e')](_0x3aeb90[_0x3f90('0x31')][_0x3f90('0x1e')]);_0x3a3f85[_0x3f90('0x1c')]=qs[_0x3f90('0x1c')](_0x3aeb90[_0x3f90('0x31')][_0x3f90('0x1c')]);}_0x3a3f85['order']=qs[_0x3f90('0x3a')](_0x3aeb90['query'][_0x3f90('0x3a')]);_0x3a3f85['where']=qs[_0x3f90('0x33')](_[_0x3f90('0x3b')](_0x3aeb90['query'],_0x3faa4b['filters']),_0xa740a4);if(_0x3aeb90[_0x3f90('0x31')][_0x3f90('0x3c')]){_0x3a3f85['where']=_['merge'](_0x3a3f85[_0x3f90('0x3d')],{'$or':_['map'](_0xa740a4,function(_0x16037d){if(_0x16037d['type']!==_0x3f90('0x3e')){var _0x42fcf6={};_0x42fcf6[_0x16037d['name']]={'$like':'%'+_0x3aeb90[_0x3f90('0x31')][_0x3f90('0x3c')]+'%'};return _0x42fcf6;}})});}_0x3a3f85=_[_0x3f90('0x3f')]({},_0x3a3f85,_0x3aeb90[_0x3f90('0x40')]);var _0x4ac877={'where':_0x3a3f85['where']};return db[_0x3f90('0x41')][_0x3f90('0x1f')](_0x4ac877)[_0x3f90('0x25')](function(_0x4d9c68){_0x5ec997['count']=_0x4d9c68;if(_0x3aeb90[_0x3f90('0x31')][_0x3f90('0x42')]){_0x3a3f85['include']=[{'all':!![]}];}return db['Interval'][_0x3f90('0x43')](_0x3a3f85);})[_0x3f90('0x25')](function(_0x11b244){_0x5ec997[_0x3f90('0x44')]=_0x11b244;return _0x5ec997;})[_0x3f90('0x25')](respondWithFilteredResult(_0x3ac22e,_0x3a3f85))['catch'](handleError(_0x3ac22e,null));};exports['show']=function(_0x5d74e8,_0x5cb818){var _0x2b41f8={'raw':!![],'where':{'id':_0x5d74e8[_0x3f90('0x45')]['id']}},_0x4e033f={};_0x4e033f[_0x3f90('0x30')]=_[_0x3f90('0x32')](db[_0x3f90('0x41')][_0x3f90('0x2d')]);_0x4e033f['query']=_[_0x3f90('0x32')](_0x5d74e8[_0x3f90('0x31')]);_0x4e033f[_0x3f90('0x33')]=_[_0x3f90('0x34')](_0x4e033f[_0x3f90('0x30')],_0x4e033f[_0x3f90('0x31')]);_0x2b41f8['attributes']=_[_0x3f90('0x34')](_0x4e033f[_0x3f90('0x30')],qs[_0x3f90('0x36')](_0x5d74e8['query']['fields']));_0x2b41f8[_0x3f90('0x35')]=_0x2b41f8[_0x3f90('0x35')][_0x3f90('0x37')]?_0x2b41f8[_0x3f90('0x35')]:_0x4e033f[_0x3f90('0x30')];if(_0x5d74e8[_0x3f90('0x31')][_0x3f90('0x42')]){_0x2b41f8[_0x3f90('0x46')]=[{'all':!![]}];}_0x2b41f8=_[_0x3f90('0x3f')]({},_0x2b41f8,_0x5d74e8['options']);return db[_0x3f90('0x41')][_0x3f90('0x47')](_0x2b41f8)[_0x3f90('0x25')](handleEntityNotFound(_0x5cb818,null))[_0x3f90('0x25')](respondWithResult(_0x5cb818,null))[_0x3f90('0x48')](handleError(_0x5cb818,null));};exports['create']=function(_0x32364f,_0xcbba4b){return db['Interval']['create'](_0x32364f[_0x3f90('0x49')],{})[_0x3f90('0x25')](function(_0x39c510){var _0x40cbd5=_0x32364f[_0x3f90('0x4a')][_0x3f90('0x27')]({'plain':!![]});if(!_0x40cbd5)throw new Error(_0x3f90('0x4b'));if(_0x40cbd5['role']===_0x3f90('0x4a')){var _0x1077a7=_0x39c510[_0x3f90('0x27')]({'plain':!![]});var _0x1762b1=_0x3f90('0x28');return db['UserProfileSection'][_0x3f90('0x47')]({'where':{'name':_0x1762b1,'userProfileId':_0x40cbd5[_0x3f90('0x4c')]},'raw':!![]})[_0x3f90('0x25')](function(_0x106a1a){if(_0x106a1a&&_0x106a1a[_0x3f90('0x4d')]===0x0){return db[_0x3f90('0x4e')]['create']({'name':_0x1077a7['name'],'resourceId':_0x1077a7['id'],'type':_0x106a1a[_0x3f90('0x2a')],'sectionId':_0x106a1a['id']},{})[_0x3f90('0x25')](function(){return _0x39c510;});}else{return _0x39c510;}})[_0x3f90('0x48')](function(_0x4ec196){logger[_0x3f90('0x29')](_0x3f90('0x4f'),_0x4ec196);throw _0x4ec196;});}return _0x39c510;})[_0x3f90('0x25')](respondWithResult(_0xcbba4b,0xc9))['catch'](handleError(_0xcbba4b,null));};exports[_0x3f90('0x24')]=function(_0x2fb327,_0x2e13e7){if(_0x2fb327['body']['id']){delete _0x2fb327[_0x3f90('0x49')]['id'];}return db[_0x3f90('0x41')][_0x3f90('0x47')]({'where':{'id':_0x2fb327['params']['id']}})[_0x3f90('0x25')](handleEntityNotFound(_0x2e13e7,null))[_0x3f90('0x25')](saveUpdates(_0x2fb327['body'],null))[_0x3f90('0x25')](respondWithResult(_0x2e13e7,null))[_0x3f90('0x48')](handleError(_0x2e13e7,null));};exports[_0x3f90('0x26')]=function(_0x501589,_0x35431e){return db['Interval'][_0x3f90('0x47')]({'where':{'id':_0x501589['params']['id']}})[_0x3f90('0x25')](handleEntityNotFound(_0x35431e,null))['then'](removeEntity(_0x35431e,null))['catch'](handleError(_0x35431e,null));};exports['addInterval']=function(_0x205443,_0x311f89,_0x5ca295){if(_0x205443['body']['id']){delete _0x205443[_0x3f90('0x49')]['id'];}return db['Interval']['find']({'where':{'id':_0x205443[_0x3f90('0x45')]['id']}})[_0x3f90('0x25')](handleEntityNotFound(_0x311f89,null))[_0x3f90('0x25')](function(_0xec3414){if(_0xec3414){_0x205443[_0x3f90('0x49')][_0x3f90('0x50')]=_0xec3414['id'];return db[_0x3f90('0x41')][_0x3f90('0x51')](_0x205443[_0x3f90('0x49')]);}})[_0x3f90('0x25')](respondWithResult(_0x311f89,null))[_0x3f90('0x48')](handleError(_0x311f89,null));};exports[_0x3f90('0x52')]=function(_0x314a6f,_0xfb1f21,_0x133374){var _0x4efa1e={};var _0x2f41b3={};var _0x159f49;var _0x563390;return db[_0x3f90('0x41')][_0x3f90('0x53')]({'where':{'id':_0x314a6f[_0x3f90('0x45')]['id']}})[_0x3f90('0x25')](handleEntityNotFound(_0xfb1f21,null))[_0x3f90('0x25')](function(_0x1ca1e5){if(_0x1ca1e5){_0x159f49=_0x1ca1e5;_0x2f41b3['model']=_[_0x3f90('0x32')](db[_0x3f90('0x41')][_0x3f90('0x2d')]);_0x2f41b3[_0x3f90('0x31')]=_[_0x3f90('0x32')](_0x314a6f[_0x3f90('0x31')]);_0x2f41b3[_0x3f90('0x33')]=_['intersection'](_0x2f41b3[_0x3f90('0x30')],_0x2f41b3['query']);_0x4efa1e['attributes']=_[_0x3f90('0x34')](_0x2f41b3[_0x3f90('0x30')],qs[_0x3f90('0x36')](_0x314a6f[_0x3f90('0x31')]['fields']));_0x4efa1e['attributes']=_0x4efa1e[_0x3f90('0x35')][_0x3f90('0x37')]?_0x4efa1e[_0x3f90('0x35')]:_0x2f41b3[_0x3f90('0x30')];_0x4efa1e[_0x3f90('0x54')]=qs[_0x3f90('0x3a')](_0x314a6f[_0x3f90('0x31')][_0x3f90('0x3a')]);_0x4efa1e[_0x3f90('0x3d')]=qs[_0x3f90('0x33')](_[_0x3f90('0x3b')](_0x314a6f[_0x3f90('0x31')],_0x2f41b3[_0x3f90('0x33')]));if(_0x314a6f['query'][_0x3f90('0x3c')]){_0x4efa1e['where']=_[_0x3f90('0x3f')](_0x4efa1e[_0x3f90('0x3d')],{'$or':_[_0x3f90('0x2c')](_0x4efa1e['attributes'],function(_0x7b9c64){var _0x295bd6={};_0x295bd6[_0x7b9c64]={'$like':'%'+_0x314a6f[_0x3f90('0x31')][_0x3f90('0x3c')]+'%'};return _0x295bd6;})});}_0x4efa1e=_[_0x3f90('0x3f')]({},_0x4efa1e,_0x314a6f[_0x3f90('0x40')]);return _0x159f49[_0x3f90('0x52')](_0x4efa1e);}})[_0x3f90('0x25')](function(_0x56f856){if(_0x56f856){_0x563390=_0x56f856[_0x3f90('0x37')];if(!_0x314a6f[_0x3f90('0x31')]['hasOwnProperty'](_0x3f90('0x39'))){_0x4efa1e['limit']=qs[_0x3f90('0x1e')](_0x314a6f[_0x3f90('0x31')][_0x3f90('0x1e')]);_0x4efa1e[_0x3f90('0x1c')]=qs[_0x3f90('0x1c')](_0x314a6f[_0x3f90('0x31')]['offset']);}return _0x159f49[_0x3f90('0x52')](_0x4efa1e);}})[_0x3f90('0x25')](function(_0x21e29d){if(_0x21e29d){return _0x21e29d?{'count':_0x563390,'rows':_0x21e29d}:null;}})[_0x3f90('0x25')](respondWithResult(_0xfb1f21,null))[_0x3f90('0x48')](handleError(_0xfb1f21,null));};exports[_0x3f90('0x55')]=function(_0x2a9b54,_0x3011c5,_0x352a54){return db['Interval'][_0x3f90('0x53')]({'where':{'id':_0x2a9b54[_0x3f90('0x45')]['id']}})[_0x3f90('0x25')](handleEntityNotFound(_0x3011c5,null))[_0x3f90('0x25')](function(_0xc28f5e){if(_0xc28f5e){return db['sequelize'][_0x3f90('0x56')](function(_0x320863){return db[_0x3f90('0x41')][_0x3f90('0x26')]({'where':{'IntervalId':_0x2a9b54['params']['id']},'transaction':_0x320863})[_0x3f90('0x25')](function(_0x5c3c9f){var _0x3f0d5a=_[_0x3f90('0x2c')](_0x2a9b54[_0x3f90('0x49')],function(_0x5d12fa){delete _0x5d12fa['id'];_0x5d12fa[_0x3f90('0x50')]=_0x2a9b54[_0x3f90('0x45')]['id'];return _0x5d12fa;});return db[_0x3f90('0x41')][_0x3f90('0x57')](_0x3f0d5a,{'transaction':_0x320863});});})[_0x3f90('0x25')](function(){return db[_0x3f90('0x41')][_0x3f90('0x43')]({'where':{'IntervalId':_0x2a9b54[_0x3f90('0x45')]['id']}});});}})['then'](respondWithResult(_0x3011c5,null))['catch'](handleError(_0x3011c5,null));}; \ No newline at end of file +var _0xd5dd=['filter','merge','VIRTUAL','findAll','rows','catch','show','params','keys','includeAll','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','getIntervals','findOne','hasOwnProperty','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x450bab,_0x31e707){var _0x196705=function(_0x3c87cc){while(--_0x3c87cc){_0x450bab['push'](_0x450bab['shift']());}};_0x196705(++_0x31e707);}(_0xd5dd,0x185));var _0xdd5d=function(_0x430da3,_0x3c10b1){_0x430da3=_0x430da3-0x0;var _0x2cdc23=_0xd5dd[_0x430da3];return _0x2cdc23;};'use strict';var emlformat=require(_0xdd5d('0x0'));var rimraf=require(_0xdd5d('0x1'));var zipdir=require(_0xdd5d('0x2'));var jsonpatch=require(_0xdd5d('0x3'));var rp=require(_0xdd5d('0x4'));var moment=require(_0xdd5d('0x5'));var BPromise=require(_0xdd5d('0x6'));var Mustache=require(_0xdd5d('0x7'));var util=require(_0xdd5d('0x8'));var path=require(_0xdd5d('0x9'));var sox=require('sox');var csv=require(_0xdd5d('0xa'));var ejs=require(_0xdd5d('0xb'));var fs=require('fs');var fs_extra=require(_0xdd5d('0xc'));var _=require('lodash');var squel=require(_0xdd5d('0xd'));var crypto=require(_0xdd5d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdd5d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdd5d('0x10'));var Papa=require(_0xdd5d('0x11'));var Redis=require(_0xdd5d('0x12'));var authService=require(_0xdd5d('0x13'));var qs=require(_0xdd5d('0x14'));var as=require(_0xdd5d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd5d('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xdd5d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x366214,_0x5cd021){_0x5cd021=_0x5cd021||0xcc;return function(_0x10c277){if(_0x10c277){return _0x366214['sendStatus'](_0x5cd021);}return _0x366214[_0xdd5d('0x18')](_0x5cd021)[_0xdd5d('0x19')]();};}function respondWithResult(_0x202869,_0x567c69){_0x567c69=_0x567c69||0xc8;return function(_0x441a95){if(_0x441a95){return _0x202869[_0xdd5d('0x18')](_0x567c69)[_0xdd5d('0x1a')](_0x441a95);}};}function respondWithFilteredResult(_0x1fb53a,_0x3b52f1){return function(_0x23597d){if(_0x23597d){var _0x44c7d8=typeof _0x3b52f1[_0xdd5d('0x1b')]===_0xdd5d('0x1c')&&typeof _0x3b52f1[_0xdd5d('0x1d')]===_0xdd5d('0x1c');var _0x234388=_0x23597d[_0xdd5d('0x1e')];var _0x3dbcd7=_0x44c7d8?0x0:_0x3b52f1['offset'];var _0x28194e=_0x44c7d8?_0x23597d['count']:_0x3b52f1[_0xdd5d('0x1b')]+_0x3b52f1[_0xdd5d('0x1d')];var _0x480005;if(_0x28194e>=_0x234388){_0x28194e=_0x234388;_0x480005=0xc8;}else{_0x480005=0xce;}_0x1fb53a[_0xdd5d('0x18')](_0x480005);return _0x1fb53a['set'](_0xdd5d('0x1f'),_0x3dbcd7+'-'+_0x28194e+'/'+_0x234388)[_0xdd5d('0x1a')](_0x23597d);}return null;};}function patchUpdates(_0x2a7583){return function(_0x4342c0){try{jsonpatch['apply'](_0x4342c0,_0x2a7583,!![]);}catch(_0x10cfd6){return BPromise[_0xdd5d('0x20')](_0x10cfd6);}return _0x4342c0[_0xdd5d('0x21')]();};}function saveUpdates(_0x339f33,_0x5e4aba){return function(_0x4a6196){if(_0x4a6196){return _0x4a6196[_0xdd5d('0x22')](_0x339f33)[_0xdd5d('0x23')](function(_0x3109b2){return _0x3109b2;});}return null;};}function removeEntity(_0xa44afc,_0x4ac329){return function(_0x27b94e){if(_0x27b94e){return _0x27b94e['destroy']()[_0xdd5d('0x23')](function(){var _0x112813=_0x27b94e['get']({'plain':!![]});var _0x262b23='Intervals';return db[_0xdd5d('0x24')][_0xdd5d('0x25')]({'where':{'type':_0x262b23,'resourceId':_0x112813['id']}})['then'](function(){return _0x27b94e;});})['then'](function(){_0xa44afc['status'](0xcc)[_0xdd5d('0x19')]();});}};}function handleEntityNotFound(_0x56c693,_0x48d7a0){return function(_0x618240){if(!_0x618240){_0x56c693[_0xdd5d('0x26')](0x194);}return _0x618240;};}function handleError(_0x399fda,_0x38eef4){_0x38eef4=_0x38eef4||0x1f4;return function(_0x209a06){logger['error'](_0x209a06[_0xdd5d('0x27')]);if(_0x209a06['name']){delete _0x209a06[_0xdd5d('0x28')];}_0x399fda[_0xdd5d('0x18')](_0x38eef4)[_0xdd5d('0x29')](_0x209a06);};}exports[_0xdd5d('0x2a')]=function(_0x309be1,_0x4e5cf1){var _0x1406fd={},_0x22c95e={},_0x241c2b={'count':0x0,'rows':[]};var _0x4cbb2e=_[_0xdd5d('0x2b')](db[_0xdd5d('0x2c')][_0xdd5d('0x2d')],function(_0x2e00d2){return{'name':_0x2e00d2[_0xdd5d('0x2e')],'type':_0x2e00d2[_0xdd5d('0x2f')][_0xdd5d('0x30')]};});_0x22c95e[_0xdd5d('0x31')]=_[_0xdd5d('0x2b')](_0x4cbb2e,'name');_0x22c95e[_0xdd5d('0x32')]=_['keys'](_0x309be1[_0xdd5d('0x32')]);_0x22c95e[_0xdd5d('0x33')]=_[_0xdd5d('0x34')](_0x22c95e[_0xdd5d('0x31')],_0x22c95e[_0xdd5d('0x32')]);_0x1406fd[_0xdd5d('0x35')]=_[_0xdd5d('0x34')](_0x22c95e['model'],qs['fields'](_0x309be1['query'][_0xdd5d('0x36')]));_0x1406fd['attributes']=_0x1406fd[_0xdd5d('0x35')][_0xdd5d('0x37')]?_0x1406fd[_0xdd5d('0x35')]:_0x22c95e[_0xdd5d('0x31')];if(!_0x309be1['query']['hasOwnProperty'](_0xdd5d('0x38'))){_0x1406fd[_0xdd5d('0x1d')]=qs[_0xdd5d('0x1d')](_0x309be1[_0xdd5d('0x32')]['limit']);_0x1406fd[_0xdd5d('0x1b')]=qs['offset'](_0x309be1['query']['offset']);}_0x1406fd[_0xdd5d('0x39')]=qs[_0xdd5d('0x3a')](_0x309be1[_0xdd5d('0x32')][_0xdd5d('0x3a')]);_0x1406fd[_0xdd5d('0x3b')]=qs[_0xdd5d('0x33')](_[_0xdd5d('0x3c')](_0x309be1[_0xdd5d('0x32')],_0x22c95e[_0xdd5d('0x33')]),_0x4cbb2e);if(_0x309be1[_0xdd5d('0x32')][_0xdd5d('0x3d')]){_0x1406fd[_0xdd5d('0x3b')]=_[_0xdd5d('0x3e')](_0x1406fd['where'],{'$or':_[_0xdd5d('0x2b')](_0x4cbb2e,function(_0x5b5394){if(_0x5b5394[_0xdd5d('0x2f')]!==_0xdd5d('0x3f')){var _0x54aa05={};_0x54aa05[_0x5b5394[_0xdd5d('0x28')]]={'$like':'%'+_0x309be1['query'][_0xdd5d('0x3d')]+'%'};return _0x54aa05;}})});}_0x1406fd=_[_0xdd5d('0x3e')]({},_0x1406fd,_0x309be1['options']);var _0x4ba109={'where':_0x1406fd[_0xdd5d('0x3b')]};return db[_0xdd5d('0x2c')][_0xdd5d('0x1e')](_0x4ba109)['then'](function(_0x34b7fd){_0x241c2b[_0xdd5d('0x1e')]=_0x34b7fd;if(_0x309be1[_0xdd5d('0x32')]['includeAll']){_0x1406fd['include']=[{'all':!![]}];}return db[_0xdd5d('0x2c')][_0xdd5d('0x40')](_0x1406fd);})[_0xdd5d('0x23')](function(_0x2d97d7){_0x241c2b[_0xdd5d('0x41')]=_0x2d97d7;return _0x241c2b;})['then'](respondWithFilteredResult(_0x4e5cf1,_0x1406fd))[_0xdd5d('0x42')](handleError(_0x4e5cf1,null));};exports[_0xdd5d('0x43')]=function(_0x242e18,_0x50e9c3){var _0x2805e8={'raw':!![],'where':{'id':_0x242e18[_0xdd5d('0x44')]['id']}},_0x18c5a0={};_0x18c5a0[_0xdd5d('0x31')]=_['keys'](db[_0xdd5d('0x2c')][_0xdd5d('0x2d')]);_0x18c5a0['query']=_[_0xdd5d('0x45')](_0x242e18['query']);_0x18c5a0['filters']=_[_0xdd5d('0x34')](_0x18c5a0['model'],_0x18c5a0[_0xdd5d('0x32')]);_0x2805e8[_0xdd5d('0x35')]=_[_0xdd5d('0x34')](_0x18c5a0[_0xdd5d('0x31')],qs[_0xdd5d('0x36')](_0x242e18['query'][_0xdd5d('0x36')]));_0x2805e8['attributes']=_0x2805e8[_0xdd5d('0x35')][_0xdd5d('0x37')]?_0x2805e8[_0xdd5d('0x35')]:_0x18c5a0['model'];if(_0x242e18[_0xdd5d('0x32')][_0xdd5d('0x46')]){_0x2805e8[_0xdd5d('0x47')]=[{'all':!![]}];}_0x2805e8=_[_0xdd5d('0x3e')]({},_0x2805e8,_0x242e18[_0xdd5d('0x48')]);return db['Interval'][_0xdd5d('0x49')](_0x2805e8)[_0xdd5d('0x23')](handleEntityNotFound(_0x50e9c3,null))[_0xdd5d('0x23')](respondWithResult(_0x50e9c3,null))['catch'](handleError(_0x50e9c3,null));};exports[_0xdd5d('0x4a')]=function(_0x1fd4cb,_0xec178d){return db[_0xdd5d('0x2c')][_0xdd5d('0x4a')](_0x1fd4cb[_0xdd5d('0x4b')],{})['then'](function(_0x5caecc){var _0x2e951d=_0x1fd4cb[_0xdd5d('0x4c')][_0xdd5d('0x4d')]({'plain':!![]});if(!_0x2e951d)throw new Error(_0xdd5d('0x4e'));if(_0x2e951d[_0xdd5d('0x4f')]===_0xdd5d('0x4c')){var _0x45b0a5=_0x5caecc['get']({'plain':!![]});var _0x150154=_0xdd5d('0x50');return db[_0xdd5d('0x51')]['find']({'where':{'name':_0x150154,'userProfileId':_0x2e951d['userProfileId']},'raw':!![]})[_0xdd5d('0x23')](function(_0x40b2a1){if(_0x40b2a1&&_0x40b2a1[_0xdd5d('0x52')]===0x0){return db[_0xdd5d('0x24')][_0xdd5d('0x4a')]({'name':_0x45b0a5[_0xdd5d('0x28')],'resourceId':_0x45b0a5['id'],'type':_0x40b2a1[_0xdd5d('0x28')],'sectionId':_0x40b2a1['id']},{})[_0xdd5d('0x23')](function(){return _0x5caecc;});}else{return _0x5caecc;}})['catch'](function(_0x2e1070){logger['error'](_0xdd5d('0x53'),_0x2e1070);throw _0x2e1070;});}return _0x5caecc;})[_0xdd5d('0x23')](respondWithResult(_0xec178d,0xc9))[_0xdd5d('0x42')](handleError(_0xec178d,null));};exports[_0xdd5d('0x22')]=function(_0x1d43eb,_0x167c07){if(_0x1d43eb[_0xdd5d('0x4b')]['id']){delete _0x1d43eb[_0xdd5d('0x4b')]['id'];}return db[_0xdd5d('0x2c')][_0xdd5d('0x49')]({'where':{'id':_0x1d43eb[_0xdd5d('0x44')]['id']}})[_0xdd5d('0x23')](handleEntityNotFound(_0x167c07,null))[_0xdd5d('0x23')](saveUpdates(_0x1d43eb[_0xdd5d('0x4b')],null))[_0xdd5d('0x23')](respondWithResult(_0x167c07,null))['catch'](handleError(_0x167c07,null));};exports[_0xdd5d('0x25')]=function(_0x30acfd,_0x3f5352){return db[_0xdd5d('0x2c')][_0xdd5d('0x49')]({'where':{'id':_0x30acfd[_0xdd5d('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f5352,null))['then'](removeEntity(_0x3f5352,null))[_0xdd5d('0x42')](handleError(_0x3f5352,null));};exports['addInterval']=function(_0x559372,_0x3b2181,_0xb3f618){if(_0x559372[_0xdd5d('0x4b')]['id']){delete _0x559372[_0xdd5d('0x4b')]['id'];}return db[_0xdd5d('0x2c')][_0xdd5d('0x49')]({'where':{'id':_0x559372[_0xdd5d('0x44')]['id']}})[_0xdd5d('0x23')](handleEntityNotFound(_0x3b2181,null))[_0xdd5d('0x23')](function(_0x9f2797){if(_0x9f2797){_0x559372['body'][_0xdd5d('0x54')]=_0x9f2797['id'];return db[_0xdd5d('0x2c')][_0xdd5d('0x4a')](_0x559372['body']);}})[_0xdd5d('0x23')](respondWithResult(_0x3b2181,null))['catch'](handleError(_0x3b2181,null));};exports[_0xdd5d('0x55')]=function(_0x6e49d0,_0x59cd62,_0x9c18f7){var _0x3f108e={};var _0x295b06={};var _0x1daf6f;var _0x17bf53;return db[_0xdd5d('0x2c')][_0xdd5d('0x56')]({'where':{'id':_0x6e49d0[_0xdd5d('0x44')]['id']}})[_0xdd5d('0x23')](handleEntityNotFound(_0x59cd62,null))[_0xdd5d('0x23')](function(_0x1f9401){if(_0x1f9401){_0x1daf6f=_0x1f9401;_0x295b06[_0xdd5d('0x31')]=_['keys'](db[_0xdd5d('0x2c')]['rawAttributes']);_0x295b06[_0xdd5d('0x32')]=_[_0xdd5d('0x45')](_0x6e49d0['query']);_0x295b06['filters']=_[_0xdd5d('0x34')](_0x295b06[_0xdd5d('0x31')],_0x295b06[_0xdd5d('0x32')]);_0x3f108e[_0xdd5d('0x35')]=_[_0xdd5d('0x34')](_0x295b06[_0xdd5d('0x31')],qs[_0xdd5d('0x36')](_0x6e49d0[_0xdd5d('0x32')][_0xdd5d('0x36')]));_0x3f108e[_0xdd5d('0x35')]=_0x3f108e[_0xdd5d('0x35')][_0xdd5d('0x37')]?_0x3f108e[_0xdd5d('0x35')]:_0x295b06[_0xdd5d('0x31')];_0x3f108e[_0xdd5d('0x39')]=qs['sort'](_0x6e49d0[_0xdd5d('0x32')][_0xdd5d('0x3a')]);_0x3f108e[_0xdd5d('0x3b')]=qs[_0xdd5d('0x33')](_[_0xdd5d('0x3c')](_0x6e49d0[_0xdd5d('0x32')],_0x295b06[_0xdd5d('0x33')]));if(_0x6e49d0[_0xdd5d('0x32')][_0xdd5d('0x3d')]){_0x3f108e['where']=_[_0xdd5d('0x3e')](_0x3f108e['where'],{'$or':_[_0xdd5d('0x2b')](_0x3f108e[_0xdd5d('0x35')],function(_0xe5dc11){var _0x3bc2b7={};_0x3bc2b7[_0xe5dc11]={'$like':'%'+_0x6e49d0[_0xdd5d('0x32')][_0xdd5d('0x3d')]+'%'};return _0x3bc2b7;})});}_0x3f108e=_[_0xdd5d('0x3e')]({},_0x3f108e,_0x6e49d0[_0xdd5d('0x48')]);return _0x1daf6f[_0xdd5d('0x55')](_0x3f108e);}})['then'](function(_0x12a5ce){if(_0x12a5ce){_0x17bf53=_0x12a5ce[_0xdd5d('0x37')];if(!_0x6e49d0['query'][_0xdd5d('0x57')](_0xdd5d('0x38'))){_0x3f108e['limit']=qs[_0xdd5d('0x1d')](_0x6e49d0[_0xdd5d('0x32')][_0xdd5d('0x1d')]);_0x3f108e[_0xdd5d('0x1b')]=qs[_0xdd5d('0x1b')](_0x6e49d0[_0xdd5d('0x32')][_0xdd5d('0x1b')]);}return _0x1daf6f[_0xdd5d('0x55')](_0x3f108e);}})[_0xdd5d('0x23')](function(_0x538696){if(_0x538696){return _0x538696?{'count':_0x17bf53,'rows':_0x538696}:null;}})[_0xdd5d('0x23')](respondWithResult(_0x59cd62,null))[_0xdd5d('0x42')](handleError(_0x59cd62,null));};exports['addIntervals']=function(_0x4c1861,_0xa85056,_0x2bce56){return db[_0xdd5d('0x2c')][_0xdd5d('0x56')]({'where':{'id':_0x4c1861[_0xdd5d('0x44')]['id']}})[_0xdd5d('0x23')](handleEntityNotFound(_0xa85056,null))[_0xdd5d('0x23')](function(_0x5fd6af){if(_0x5fd6af){return db['sequelize'][_0xdd5d('0x58')](function(_0x1d8ec7){return db[_0xdd5d('0x2c')][_0xdd5d('0x25')]({'where':{'IntervalId':_0x4c1861[_0xdd5d('0x44')]['id']},'transaction':_0x1d8ec7})[_0xdd5d('0x23')](function(_0x4c1911){var _0x16ca23=_[_0xdd5d('0x2b')](_0x4c1861[_0xdd5d('0x4b')],function(_0x22cc95){delete _0x22cc95['id'];_0x22cc95['IntervalId']=_0x4c1861[_0xdd5d('0x44')]['id'];return _0x22cc95;});return db[_0xdd5d('0x2c')][_0xdd5d('0x59')](_0x16ca23,{'transaction':_0x1d8ec7});});})[_0xdd5d('0x23')](function(){return db[_0xdd5d('0x2c')][_0xdd5d('0x40')]({'where':{'IntervalId':_0x4c1861['params']['id']}});});}})[_0xdd5d('0x23')](respondWithResult(_0xa85056,null))['catch'](handleError(_0xa85056,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 0871cd1..dd6f501 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 _0xe7d0=['map','ifTime','then','reduce','./interval.attributes','../../components/extensions/rewrite','iftime','exports','Interval','tools_intervals','rewrite','interval','string','all'];(function(_0x4b68b1,_0x1b5de1){var _0x392e50=function(_0x1ccd57){while(--_0x1ccd57){_0x4b68b1['push'](_0x4b68b1['shift']());}};_0x392e50(++_0x1b5de1);}(_0xe7d0,0x1c4));var _0x0e7d=function(_0x558c4e,_0x5f57f8){_0x558c4e=_0x558c4e-0x0;var _0x3ccaba=_0xe7d0[_0x558c4e];return _0x3ccaba;};'use strict';var attributes=require(_0x0e7d('0x0'));var extensions=require(_0x0e7d('0x1'));var iftime=require('../../utils/iftime')[_0x0e7d('0x2')];module[_0x0e7d('0x3')]=function(_0xe051e1){return _0xe051e1['define'](_0x0e7d('0x4'),attributes,{'tableName':_0x0e7d('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x7e2cf9){extensions['rewrite'](_0xe051e1,_0x7e2cf9);},'afterBulkCreate':function(_0x2720f7,_0x14e279,_0x387ec0){_0x387ec0();extensions[_0x0e7d('0x6')](_0xe051e1,_0x2720f7[0x0]);},'afterUpdate':function(_0x3d7c2d){extensions['rewrite'](_0xe051e1,_0x3d7c2d);},'afterDestroy':function(_0x1b32d8){extensions[_0x0e7d('0x6')](_0xe051e1,_0x1b32d8);}},'instanceMethods':{'ifTime':function(_0x468eb8=undefined,_0x1d831d=new Date()){if(typeof this[_0x0e7d('0x7')]===_0x0e7d('0x8')){return iftime(this[_0x0e7d('0x7')],_0x468eb8,_0x1d831d);}else{return this['getIntervals']()['then'](function(_0x40eed3){return Promise[_0x0e7d('0x9')](_0x40eed3[_0x0e7d('0xa')](function(_0x662427){return _0x662427[_0x0e7d('0xb')](_0x468eb8,_0x1d831d);}));})[_0x0e7d('0xc')](function(_0x441b68){return _0x441b68[_0x0e7d('0xd')](function(_0x21b139,_0xa9160f){return _0x21b139||_0xa9160f;},![]);});}}}});}; \ No newline at end of file +var _0x8a85=['exports','define','rewrite','interval','string','getIntervals','then','all','ifTime','reduce','../../components/extensions/rewrite','iftime'];(function(_0xea7513,_0x1d3b07){var _0x83f91a=function(_0x2b619d){while(--_0x2b619d){_0xea7513['push'](_0xea7513['shift']());}};_0x83f91a(++_0x1d3b07);}(_0x8a85,0x17e));var _0x58a8=function(_0x508fdb,_0x2797a4){_0x508fdb=_0x508fdb-0x0;var _0x53ed35=_0x8a85[_0x508fdb];return _0x53ed35;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x58a8('0x0'));var iftime=require('../../utils/iftime')[_0x58a8('0x1')];module[_0x58a8('0x2')]=function(_0x5e5496){return _0x5e5496[_0x58a8('0x3')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x459253){extensions[_0x58a8('0x4')](_0x5e5496,_0x459253);},'afterBulkCreate':function(_0x170499,_0x6a70e3,_0x2a3478){_0x2a3478();extensions['rewrite'](_0x5e5496,_0x170499[0x0]);},'afterUpdate':function(_0xca0e9c){extensions['rewrite'](_0x5e5496,_0xca0e9c);},'afterDestroy':function(_0x4c7713){extensions[_0x58a8('0x4')](_0x5e5496,_0x4c7713);}},'instanceMethods':{'ifTime':function(_0x5963ab=undefined,_0x3c12ca=new Date()){if(typeof this[_0x58a8('0x5')]===_0x58a8('0x6')){return iftime(this[_0x58a8('0x5')],_0x5963ab,_0x3c12ca);}else{return this[_0x58a8('0x7')]()[_0x58a8('0x8')](function(_0x249752){return Promise[_0x58a8('0x9')](_0x249752['map'](function(_0x49a7a7){return _0x49a7a7[_0x58a8('0xa')](_0x5963ab,_0x3c12ca);}));})[_0x58a8('0x8')](function(_0x77a7ea){return _0x77a7ea[_0x58a8('0xb')](function(_0xab4188,_0x53bfec){return _0xab4188||_0x53bfec;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 0c09253..2f9851c 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 _0x30c1=['util','../../mysqldb','../../config/logger','rpc','options','raw','where','attributes','limit','include','map','model','info','GetInterval','debug','stringify','catch','error','message','ShowInterval','Interval','find','then','all','reduce','format','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','intervalIds','isArray','intervals','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','join','IntervalIftime:\x20timezone\x20=\x20%s','IntervalIftime','resolve','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30c1,0x9b));var _0x130c=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x30c1[_0x5d8018];return _0x151ac4;};'use strict';var _=require(_0x130c('0x0'));var util=require(_0x130c('0x1'));var db=require(_0x130c('0x2'))['db'];var iftime=require('../../utils/iftime')['iftime'];var logger=require(_0x130c('0x3'))(_0x130c('0x4'));exports['GetInterval']=function(_0x57fbf2){var _0xadee42=this;return new Promise(function(_0x361d0c,_0x457065){return db['Interval']['findAll']({'raw':_0x57fbf2[_0x130c('0x5')]?_0x57fbf2[_0x130c('0x5')][_0x130c('0x6')]===undefined?!![]:![]:!![],'where':_0x57fbf2[_0x130c('0x5')]?_0x57fbf2['options'][_0x130c('0x7')]||null:null,'attributes':_0x57fbf2[_0x130c('0x5')]?_0x57fbf2[_0x130c('0x5')][_0x130c('0x8')]||null:null,'limit':_0x57fbf2['options']?_0x57fbf2['options'][_0x130c('0x9')]||null:null,'include':_0x57fbf2[_0x130c('0x5')]?_0x57fbf2['options'][_0x130c('0xa')]?_[_0x130c('0xb')](_0x57fbf2[_0x130c('0x5')]['include'],function(_0x5223f3){return{'model':db[_0x5223f3['model']],'as':_0x5223f3['as'],'attributes':_0x5223f3[_0x130c('0x8')],'include':_0x5223f3[_0x130c('0xa')]?_['map'](_0x5223f3[_0x130c('0xa')],function(_0x3b1c6e){return{'model':db[_0x3b1c6e[_0x130c('0xc')]],'as':_0x3b1c6e['as'],'attributes':_0x3b1c6e[_0x130c('0x8')],'include':_0x3b1c6e[_0x130c('0xa')]?_['map'](_0x3b1c6e[_0x130c('0xa')],function(_0x186881){return{'model':db[_0x186881[_0x130c('0xc')]],'as':_0x186881['as'],'attributes':_0x186881['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a0e16){logger[_0x130c('0xd')](_0x130c('0xe'),_0x57fbf2);logger[_0x130c('0xf')](_0x130c('0xe'),_0x57fbf2,JSON[_0x130c('0x10')](_0x2a0e16));_0x361d0c(_0x2a0e16);})[_0x130c('0x11')](function(_0x47ff5d){logger[_0x130c('0x12')](_0x130c('0xe'),_0x47ff5d[_0x130c('0x13')],_0x57fbf2);_0x457065(_0xadee42[_0x130c('0x12')](0x1f4,_0x47ff5d[_0x130c('0x13')]));});});};exports[_0x130c('0x14')]=function(_0xe953c6){var _0x2c3f8e=this;return new Promise(function(_0x322860,_0x2b848d){return db[_0x130c('0x15')][_0x130c('0x16')]({'raw':_0xe953c6[_0x130c('0x5')]?_0xe953c6[_0x130c('0x5')][_0x130c('0x6')]===undefined?!![]:![]:!![],'where':_0xe953c6[_0x130c('0x5')]?_0xe953c6[_0x130c('0x5')][_0x130c('0x7')]||null:null,'attributes':_0xe953c6[_0x130c('0x5')]?_0xe953c6[_0x130c('0x5')]['attributes']||null:null,'include':_0xe953c6[_0x130c('0x5')]?_0xe953c6['options']['include']?_[_0x130c('0xb')](_0xe953c6[_0x130c('0x5')][_0x130c('0xa')],function(_0x4273db){return{'model':db[_0x4273db[_0x130c('0xc')]],'as':_0x4273db['as'],'attributes':_0x4273db[_0x130c('0x8')],'include':_0x4273db[_0x130c('0xa')]?_[_0x130c('0xb')](_0x4273db[_0x130c('0xa')],function(_0x1734d8){return{'model':db[_0x1734d8[_0x130c('0xc')]],'as':_0x1734d8['as'],'attributes':_0x1734d8[_0x130c('0x8')],'include':_0x1734d8[_0x130c('0xa')]?_['map'](_0x1734d8['include'],function(_0x234055){return{'model':db[_0x234055[_0x130c('0xc')]],'as':_0x234055['as'],'attributes':_0x234055[_0x130c('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3416a4){logger[_0x130c('0xd')](_0x130c('0x14'),_0xe953c6);logger['debug'](_0x130c('0x14'),_0xe953c6,JSON[_0x130c('0x10')](_0x3416a4));_0x322860(_0x3416a4);})[_0x130c('0x11')](function(_0x5265bc){logger[_0x130c('0x12')](_0x130c('0x14'),_0x5265bc['message'],_0xe953c6);_0x2b848d(_0x2c3f8e[_0x130c('0x12')](0x1f4,_0x5265bc[_0x130c('0x13')]));});});};function checkArrayOfIntervals(_0x5cb86e,_0x556d9a){var _0x478680=[];return db['Interval']['findAll']({'where':{'id':_0x5cb86e}})[_0x130c('0x17')](function(_0x1df0a6){_0x478680=_0x1df0a6;return Promise[_0x130c('0x18')](_0x478680['map'](function(_0x2d83e8){return _0x2d83e8['ifTime'](_0x556d9a);}));})[_0x130c('0x17')](function(_0x32b09c){var _0x38238f=_0x32b09c[_0x130c('0x19')](function(_0x2bed03,_0x4c303a){return _0x2bed03||_0x4c303a;},![]);logger[_0x130c('0xd')](util[_0x130c('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x478680['map'](function(_0x2dde6c){return _0x2dde6c['name'];})['join'](',\x20'),_0x478680[_0x130c('0xb')](function(_0x4e5c14){return _0x4e5c14['id'];})['join'](',\x20')));return _0x38238f;});}function checkSingleInterval(_0x2c8f23,_0x4f0acc){return db[_0x130c('0x15')][_0x130c('0x1b')](_0x2c8f23)['then'](function(_0x514308){if(_0x514308){logger['info'](util['format'](_0x130c('0x1c'),_0x514308[_0x130c('0x1d')],_0x514308['id']));return _0x514308['ifTime'](_0x4f0acc);}});}exports['IntervalIftime']=function(_0x1f2330){var _0x473885=_0x1f2330[_0x130c('0x1e')];var _0x35f9f3=Array[_0x130c('0x1f')](_0x1f2330[_0x130c('0x20')])?_0x1f2330[_0x130c('0x20')]:typeof _0x1f2330[_0x130c('0x20')]==='string'?[_0x1f2330[_0x130c('0x20')]]:[];var _0x5dbc2d=_0x1f2330['timezone']||undefined;var _0x485ed5=![];if(_0x35f9f3[_0x130c('0x21')]){logger[_0x130c('0xd')](util[_0x130c('0x1a')](_0x130c('0x22'),_0x35f9f3[_0x130c('0x23')](';\x20')));}if(_0x5dbc2d){logger[_0x130c('0xd')](util[_0x130c('0x1a')](_0x130c('0x24'),_0x5dbc2d));}logger[_0x130c('0xf')]('Iftime',_0x485ed5);logger['silly'](_0x130c('0x25'),_0x1f2330);return Promise[_0x130c('0x26')]()[_0x130c('0x17')](function(){if(Array[_0x130c('0x1f')](_0x473885)){return checkArrayOfIntervals(_0x473885,_0x5dbc2d);}else if(_0x473885){return checkSingleInterval(_0x473885,_0x5dbc2d);}})[_0x130c('0x17')](function(_0x100550){var _0x72a1ac=_0x35f9f3[_0x130c('0x19')](function(_0x50b1ef,_0x4c4f8c){return _0x50b1ef||iftime(_0x4c4f8c,_0x5dbc2d);},![]);_0x485ed5=_0x100550||_0x72a1ac;return _0x485ed5;})[_0x130c('0x11')](function(_0x1263de){logger[_0x130c('0x12')]('IntervalIftime',_0x1f2330,_0x1263de);throw this['error'](0x1f4,_0x1263de[_0x130c('0x13')]);});}; \ No newline at end of file +var _0x0efd=['rpc','GetInterval','Interval','findAll','options','raw','where','attributes','map','model','include','info','debug','stringify','catch','error','message','ShowInterval','find','then','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','resolve','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger'];(function(_0x594ca3,_0x34672e){var _0x54916e=function(_0x54e7fc){while(--_0x54e7fc){_0x594ca3['push'](_0x594ca3['shift']());}};_0x54916e(++_0x34672e);}(_0x0efd,0x7f));var _0xd0ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0efd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd0ef('0x0'));var db=require(_0xd0ef('0x1'))['db'];var iftime=require(_0xd0ef('0x2'))[_0xd0ef('0x3')];var logger=require(_0xd0ef('0x4'))(_0xd0ef('0x5'));exports[_0xd0ef('0x6')]=function(_0x31d4b0){var _0x2fe394=this;return new Promise(function(_0x2ebf20,_0x96f4f2){return db[_0xd0ef('0x7')][_0xd0ef('0x8')]({'raw':_0x31d4b0['options']?_0x31d4b0[_0xd0ef('0x9')][_0xd0ef('0xa')]===undefined?!![]:![]:!![],'where':_0x31d4b0[_0xd0ef('0x9')]?_0x31d4b0['options'][_0xd0ef('0xb')]||null:null,'attributes':_0x31d4b0['options']?_0x31d4b0['options'][_0xd0ef('0xc')]||null:null,'limit':_0x31d4b0[_0xd0ef('0x9')]?_0x31d4b0[_0xd0ef('0x9')]['limit']||null:null,'include':_0x31d4b0[_0xd0ef('0x9')]?_0x31d4b0[_0xd0ef('0x9')]['include']?_[_0xd0ef('0xd')](_0x31d4b0[_0xd0ef('0x9')]['include'],function(_0x335a6f){return{'model':db[_0x335a6f[_0xd0ef('0xe')]],'as':_0x335a6f['as'],'attributes':_0x335a6f[_0xd0ef('0xc')],'include':_0x335a6f['include']?_[_0xd0ef('0xd')](_0x335a6f[_0xd0ef('0xf')],function(_0x41d3e6){return{'model':db[_0x41d3e6['model']],'as':_0x41d3e6['as'],'attributes':_0x41d3e6[_0xd0ef('0xc')],'include':_0x41d3e6[_0xd0ef('0xf')]?_[_0xd0ef('0xd')](_0x41d3e6[_0xd0ef('0xf')],function(_0x99e390){return{'model':db[_0x99e390['model']],'as':_0x99e390['as'],'attributes':_0x99e390[_0xd0ef('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2676d2){logger[_0xd0ef('0x10')](_0xd0ef('0x6'),_0x31d4b0);logger[_0xd0ef('0x11')](_0xd0ef('0x6'),_0x31d4b0,JSON[_0xd0ef('0x12')](_0x2676d2));_0x2ebf20(_0x2676d2);})[_0xd0ef('0x13')](function(_0x17a7d2){logger[_0xd0ef('0x14')](_0xd0ef('0x6'),_0x17a7d2[_0xd0ef('0x15')],_0x31d4b0);_0x96f4f2(_0x2fe394[_0xd0ef('0x14')](0x1f4,_0x17a7d2['message']));});});};exports[_0xd0ef('0x16')]=function(_0x1e1288){var _0x4a6448=this;return new Promise(function(_0x3d4c6b,_0x5556c9){return db[_0xd0ef('0x7')][_0xd0ef('0x17')]({'raw':_0x1e1288['options']?_0x1e1288[_0xd0ef('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x1e1288[_0xd0ef('0x9')]?_0x1e1288['options'][_0xd0ef('0xb')]||null:null,'attributes':_0x1e1288[_0xd0ef('0x9')]?_0x1e1288[_0xd0ef('0x9')]['attributes']||null:null,'include':_0x1e1288[_0xd0ef('0x9')]?_0x1e1288[_0xd0ef('0x9')][_0xd0ef('0xf')]?_[_0xd0ef('0xd')](_0x1e1288[_0xd0ef('0x9')][_0xd0ef('0xf')],function(_0x195e83){return{'model':db[_0x195e83[_0xd0ef('0xe')]],'as':_0x195e83['as'],'attributes':_0x195e83[_0xd0ef('0xc')],'include':_0x195e83[_0xd0ef('0xf')]?_['map'](_0x195e83['include'],function(_0x4d1984){return{'model':db[_0x4d1984[_0xd0ef('0xe')]],'as':_0x4d1984['as'],'attributes':_0x4d1984['attributes'],'include':_0x4d1984['include']?_[_0xd0ef('0xd')](_0x4d1984[_0xd0ef('0xf')],function(_0x13e707){return{'model':db[_0x13e707[_0xd0ef('0xe')]],'as':_0x13e707['as'],'attributes':_0x13e707[_0xd0ef('0xc')]};}):[]};}):[]};}):[]:[]})[_0xd0ef('0x18')](function(_0x440478){logger['info'](_0xd0ef('0x16'),_0x1e1288);logger['debug'](_0xd0ef('0x16'),_0x1e1288,JSON[_0xd0ef('0x12')](_0x440478));_0x3d4c6b(_0x440478);})['catch'](function(_0x4fbb18){logger[_0xd0ef('0x14')](_0xd0ef('0x16'),_0x4fbb18[_0xd0ef('0x15')],_0x1e1288);_0x5556c9(_0x4a6448[_0xd0ef('0x14')](0x1f4,_0x4fbb18['message']));});});};function checkArrayOfIntervals(_0x33ee80,_0x94b0e6){var _0x30cfd1=[];return db[_0xd0ef('0x7')]['findAll']({'where':{'id':_0x33ee80}})[_0xd0ef('0x18')](function(_0x353272){_0x30cfd1=_0x353272;return Promise[_0xd0ef('0x19')](_0x30cfd1[_0xd0ef('0xd')](function(_0x37f3e5){return _0x37f3e5[_0xd0ef('0x1a')](_0x94b0e6);}));})[_0xd0ef('0x18')](function(_0x2eafe9){var _0x4c654b=_0x2eafe9[_0xd0ef('0x1b')](function(_0xdb454b,_0x5a2a63){return _0xdb454b||_0x5a2a63;},![]);logger[_0xd0ef('0x10')](util[_0xd0ef('0x1c')](_0xd0ef('0x1d'),_0x30cfd1[_0xd0ef('0xd')](function(_0x2a19c7){return _0x2a19c7[_0xd0ef('0x1e')];})[_0xd0ef('0x1f')](',\x20'),_0x30cfd1[_0xd0ef('0xd')](function(_0x50e33c){return _0x50e33c['id'];})[_0xd0ef('0x1f')](',\x20')));return _0x4c654b;});}function checkSingleInterval(_0x36230d,_0x4e794d){return db['Interval'][_0xd0ef('0x20')](_0x36230d)['then'](function(_0x53d8c9){if(_0x53d8c9){logger[_0xd0ef('0x10')](util['format'](_0xd0ef('0x21'),_0x53d8c9['name'],_0x53d8c9['id']));return _0x53d8c9[_0xd0ef('0x1a')](_0x4e794d);}});}exports[_0xd0ef('0x22')]=function(_0x58ac03){var _0x264ec0=_0x58ac03[_0xd0ef('0x23')];var _0x3ebec6=Array[_0xd0ef('0x24')](_0x58ac03[_0xd0ef('0x25')])?_0x58ac03[_0xd0ef('0x25')]:typeof _0x58ac03['intervals']===_0xd0ef('0x26')?[_0x58ac03[_0xd0ef('0x25')]]:[];var _0x3c5f04=_0x58ac03[_0xd0ef('0x27')]||undefined;var _0x17d470=![];if(_0x3ebec6[_0xd0ef('0x28')]){logger[_0xd0ef('0x10')](util[_0xd0ef('0x1c')](_0xd0ef('0x29'),_0x3ebec6[_0xd0ef('0x1f')](';\x20')));}if(_0x3c5f04){logger[_0xd0ef('0x10')](util['format']('IntervalIftime:\x20timezone\x20=\x20%s',_0x3c5f04));}logger['debug'](_0xd0ef('0x2a'),_0x17d470);logger['silly'](_0xd0ef('0x22'),_0x58ac03);return Promise[_0xd0ef('0x2b')]()['then'](function(){if(Array['isArray'](_0x264ec0)){return checkArrayOfIntervals(_0x264ec0,_0x3c5f04);}else if(_0x264ec0){return checkSingleInterval(_0x264ec0,_0x3c5f04);}})['then'](function(_0x58eb6a){var _0x2e3650=_0x3ebec6[_0xd0ef('0x1b')](function(_0x3bd426,_0x44f91c){return _0x3bd426||iftime(_0x44f91c,_0x3c5f04);},![]);_0x17d470=_0x58eb6a||_0x2e3650;return _0x17d470;})['catch'](function(_0x4baed2){logger['error'](_0xd0ef('0x22'),_0x58ac03,_0x4baed2);throw this[_0xd0ef('0x14')](0x1f4,_0x4baed2[_0xd0ef('0x15')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 0eeafe9..91f6674 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0xe487d5,_0x2c4edf){var _0x2e39b1=function(_0x2554fc){while(--_0x2554fc){_0xe487d5['push'](_0xe487d5['shift']());}};_0x2e39b1(++_0x2c4edf);}(_0x2ef3,0xba));var _0x32ef=function(_0x47483e,_0x2925d1){_0x47483e=_0x47483e-0x0;var _0x1711ca=_0x2ef3[_0x47483e];return _0x1711ca;};'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['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index a8cefff..c9c5015 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 _0xc510=['base64','request','setEncoding','utf8','end','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','MOTGUI','Report','description','stringify','issuetype','Bug','fields','customfield_11501','oldToken','newToken','name','customfield_11504','reason','/rest/api/2/issue','POST','application/json','toString'];(function(_0x4ef916,_0xb5e076){var _0x22633d=function(_0x1c136a){while(--_0x1c136a){_0x4ef916['push'](_0x4ef916['shift']());}};_0x22633d(++_0xb5e076);}(_0xc510,0xfc));var _0x0c51=function(_0x2c28fb,_0x527fc8){_0x2c28fb=_0x2c28fb-0x0;var _0x141b8c=_0xc510[_0x2c28fb];return _0x141b8c;};'use strict';var BPromise=require(_0x0c51('0x0'));var https=require(_0x0c51('0x1'));var logger=require(_0x0c51('0x2'))(_0x0c51('0x3'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x5b1120,_0x1c7750){var _0x5cdd9f={'fields':{'project':{'key':_0x5b1120['key']||_0x0c51('0x4')},'summary':(_0x5b1120['summary']||_0x0c51('0x5'))+'\x20from\x20'+_0x5b1120['ip'],'description':_0x5b1120[_0x0c51('0x6')]||JSON[_0x0c51('0x7')](_0x5b1120),'issuetype':{'name':_0x5b1120[_0x0c51('0x8')]||_0x0c51('0x9')}}};_0x5cdd9f[_0x0c51('0xa')]['customfield_11500']=_0x5b1120['email'];_0x5cdd9f[_0x0c51('0xa')][_0x0c51('0xb')]=_0x5b1120[_0x0c51('0xc')];_0x5cdd9f['fields']['customfield_11502']=_0x5b1120[_0x0c51('0xd')];_0x5cdd9f[_0x0c51('0xa')]['customfield_11503']=_0x5b1120[_0x0c51('0xe')];_0x5cdd9f[_0x0c51('0xa')][_0x0c51('0xf')]=_0x5b1120[_0x0c51('0x10')];_0x5cdd9f[_0x0c51('0xa')]['customfield_10102']=_0x5b1120['ip'];var _0x127577={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x0c51('0x11'),'method':_0x0c51('0x12'),'timeout':0x4e20,'headers':{'Content-Type':_0x0c51('0x13'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x0c51('0x14')](_0x0c51('0x15'))}};var _0x1ba66f=JSON[_0x0c51('0x7')](_0x5cdd9f);var _0x37a85c=https[_0x0c51('0x16')](_0x127577,function(_0x120041){_0x120041[_0x0c51('0x17')](_0x0c51('0x18'));var _0x3639fb='';_0x120041['on']('data',function(_0x4b7fb3){_0x3639fb+=_0x4b7fb3;});_0x120041['on'](_0x0c51('0x19'),function(){if(_0x1c7750){return _0x1c7750['status'](_0x120041['statusCode'])[_0x0c51('0x1a')](JSON[_0x0c51('0x1b')](_0x3639fb));}});});_0x37a85c['on'](_0x0c51('0x1c'),function(_0x5129e0){if(_0x1c7750){return _0x1c7750[_0x0c51('0x1d')](0x1f4)[_0x0c51('0x1a')]({'errors':[{'message':_0x0c51('0x1e'),'type':_0x0c51('0x1f')}]});}});_0x37a85c['write'](_0x1ba66f);_0x37a85c[_0x0c51('0x19')]();}exports['openIssue']=openIssue;exports[_0x0c51('0x20')]=function(_0x589029,_0xdcdf5a){_0x589029[_0x0c51('0x21')]['ip']=_0x589029[_0x0c51('0x22')][_0x0c51('0x23')]||_0x589029[_0x0c51('0x24')][_0x0c51('0x25')]||_0x589029[_0x0c51('0x26')][_0x0c51('0x25')]||_0x589029['connection'][_0x0c51('0x26')][_0x0c51('0x25')];return openIssue(_0x589029['body'],_0xdcdf5a);}; \ No newline at end of file +var _0xaa0b=['customfield_10102','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','data','end','status','statusCode','json','parse','error','api.jira','write','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','email','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','reason'];(function(_0x79b53e,_0x108f8d){var _0x2d4d6c=function(_0x256d7f){while(--_0x256d7f){_0x79b53e['push'](_0x79b53e['shift']());}};_0x2d4d6c(++_0x108f8d);}(_0xaa0b,0x17f));var _0xbaa0=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xaa0b[_0x616290];return _0x453879;};'use strict';var BPromise=require(_0xbaa0('0x0'));var https=require(_0xbaa0('0x1'));var logger=require('../../config/logger')(_0xbaa0('0x2'));var USERNAME=_0xbaa0('0x3');var PASSWORD=_0xbaa0('0x4');function openIssue(_0x40518e,_0x2d7954){var _0x242c6d={'fields':{'project':{'key':_0x40518e[_0xbaa0('0x5')]||'MOTGUI'},'summary':(_0x40518e[_0xbaa0('0x6')]||_0xbaa0('0x7'))+_0xbaa0('0x8')+_0x40518e['ip'],'description':_0x40518e[_0xbaa0('0x9')]||JSON[_0xbaa0('0xa')](_0x40518e),'issuetype':{'name':_0x40518e[_0xbaa0('0xb')]||_0xbaa0('0xc')}}};_0x242c6d[_0xbaa0('0xd')]['customfield_11500']=_0x40518e[_0xbaa0('0xe')];_0x242c6d[_0xbaa0('0xd')][_0xbaa0('0xf')]=_0x40518e[_0xbaa0('0x10')];_0x242c6d['fields']['customfield_11502']=_0x40518e[_0xbaa0('0x11')];_0x242c6d[_0xbaa0('0xd')][_0xbaa0('0x12')]=_0x40518e[_0xbaa0('0x13')];_0x242c6d[_0xbaa0('0xd')][_0xbaa0('0x14')]=_0x40518e[_0xbaa0('0x15')];_0x242c6d[_0xbaa0('0xd')][_0xbaa0('0x16')]=_0x40518e['ip'];var _0x1cc8a6={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xbaa0('0x17'),'method':_0xbaa0('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xbaa0('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xbaa0('0x1a')](_0xbaa0('0x1b'))}};var _0x11f6d5=JSON[_0xbaa0('0xa')](_0x242c6d);var _0x56374d=https[_0xbaa0('0x1c')](_0x1cc8a6,function(_0x21cad8){_0x21cad8['setEncoding']('utf8');var _0x4fb709='';_0x21cad8['on'](_0xbaa0('0x1d'),function(_0x322434){_0x4fb709+=_0x322434;});_0x21cad8['on'](_0xbaa0('0x1e'),function(){if(_0x2d7954){return _0x2d7954[_0xbaa0('0x1f')](_0x21cad8[_0xbaa0('0x20')])[_0xbaa0('0x21')](JSON[_0xbaa0('0x22')](_0x4fb709));}});});_0x56374d['on'](_0xbaa0('0x23'),function(_0x2ce0f4){if(_0x2d7954){return _0x2d7954[_0xbaa0('0x1f')](0x1f4)[_0xbaa0('0x21')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xbaa0('0x24')}]});}});_0x56374d[_0xbaa0('0x25')](_0x11f6d5);_0x56374d[_0xbaa0('0x1e')]();}exports[_0xbaa0('0x26')]=openIssue;exports[_0xbaa0('0x27')]=function(_0x26372d,_0x253d70){_0x26372d[_0xbaa0('0x28')]['ip']=_0x26372d['headers'][_0xbaa0('0x29')]||_0x26372d[_0xbaa0('0x2a')][_0xbaa0('0x2b')]||_0x26372d[_0xbaa0('0x2c')][_0xbaa0('0x2b')]||_0x26372d[_0xbaa0('0x2a')][_0xbaa0('0x2c')][_0xbaa0('0x2b')];return openIssue(_0x26372d[_0xbaa0('0x28')],_0x253d70);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 99b02e8..2eeb328 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 _0x9f62=['../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','post','/:id','delete','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x2a3b3e,_0x415238){var _0x3bb5f6=function(_0x26a88a){while(--_0x26a88a){_0x2a3b3e['push'](_0x2a3b3e['shift']());}};_0x3bb5f6(++_0x415238);}(_0x9f62,0x154));var _0x29f6=function(_0x4c37f6,_0x6cd9d9){_0x4c37f6=_0x4c37f6-0x0;var _0x2c0d38=_0x9f62[_0x4c37f6];return _0x2c0d38;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var controller=require(_0x29f6('0x6'));router[_0x29f6('0x7')]('/',auth['isAuthenticated'](),controller[_0x29f6('0x8')]);router[_0x29f6('0x7')](_0x29f6('0x9'),auth[_0x29f6('0xa')](),controller[_0x29f6('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x29f6('0xc')]('/',auth[_0x29f6('0xa')](),controller['create']);router['put'](_0x29f6('0xd'),auth[_0x29f6('0xa')](),controller['update']);router[_0x29f6('0xe')](_0x29f6('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x17ba,0xab));var _0xa17b=function(_0x225175,_0x1f235d){_0x225175=_0x225175-0x0;var _0x51a2d4=_0x17ba[_0x225175];return _0x51a2d4;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index a2e9b55..8bb5914 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x50e82c,_0x34f7a2){_0x50e82c=_0x50e82c-0x0;var _0x5c40b7=_0x7a54[_0x50e82c];return _0x5c40b7;};'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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a54,0x106));var _0x47a5=function(_0x28e1a3,_0x5f3100){_0x28e1a3=_0x28e1a3-0x0;var _0x572fae=_0x7a54[_0x28e1a3];return _0x572fae;};'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 410c27f..cc9ad2e 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 _0xa751=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x211de7,_0x2e6f69){var _0x2b29e0=function(_0xf2306){while(--_0xf2306){_0x211de7['push'](_0x211de7['shift']());}};_0x2b29e0(++_0x2e6f69);}(_0xa751,0x175));var _0x1a75=function(_0xfe0869,_0xfba371){_0xfe0869=_0xfe0869-0x0;var _0x13f61d=_0xa751[_0xfe0869];return _0x13f61d;};'use strict';var emlformat=require(_0x1a75('0x0'));var rimraf=require(_0x1a75('0x1'));var zipdir=require(_0x1a75('0x2'));var jsonpatch=require(_0x1a75('0x3'));var rp=require('request-promise');var moment=require(_0x1a75('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a75('0x5'));var util=require(_0x1a75('0x6'));var path=require(_0x1a75('0x7'));var sox=require('sox');var csv=require(_0x1a75('0x8'));var ejs=require(_0x1a75('0x9'));var fs=require('fs');var fs_extra=require(_0x1a75('0xa'));var _=require(_0x1a75('0xb'));var squel=require(_0x1a75('0xc'));var crypto=require(_0x1a75('0xd'));var jsforce=require(_0x1a75('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a75('0xf'));var Redis=require(_0x1a75('0x10'));var authService=require(_0x1a75('0x11'));var qs=require(_0x1a75('0x12'));var as=require(_0x1a75('0x13'));var hardwareService=require(_0x1a75('0x14'));var logger=require(_0x1a75('0x15'))(_0x1a75('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a75('0x17'))['db'];function respondWithStatusCode(_0x24e8dc,_0xae1af0){_0xae1af0=_0xae1af0||0xcc;return function(_0x1220e4){if(_0x1220e4){return _0x24e8dc['sendStatus'](_0xae1af0);}return _0x24e8dc['status'](_0xae1af0)[_0x1a75('0x18')]();};}function respondWithResult(_0xf4a616,_0x48577b){_0x48577b=_0x48577b||0xc8;return function(_0x1c84d3){if(_0x1c84d3){return _0xf4a616[_0x1a75('0x19')](_0x48577b)['json'](_0x1c84d3);}};}function respondWithFilteredResult(_0x1f3c38,_0xb4a245){return function(_0x15a1ec){if(_0x15a1ec){var _0x5883df=typeof _0xb4a245['offset']==='undefined'&&typeof _0xb4a245[_0x1a75('0x1a')]===_0x1a75('0x1b');var _0x2b6f3d=_0x15a1ec[_0x1a75('0x1c')];var _0x1b1af2=_0x5883df?0x0:_0xb4a245[_0x1a75('0x1d')];var _0x47f384=_0x5883df?_0x15a1ec[_0x1a75('0x1c')]:_0xb4a245['offset']+_0xb4a245['limit'];var _0x42df2c;if(_0x47f384>=_0x2b6f3d){_0x47f384=_0x2b6f3d;_0x42df2c=0xc8;}else{_0x42df2c=0xce;}_0x1f3c38[_0x1a75('0x19')](_0x42df2c);return _0x1f3c38['set'](_0x1a75('0x1e'),_0x1b1af2+'-'+_0x47f384+'/'+_0x2b6f3d)['json'](_0x15a1ec);}return null;};}function patchUpdates(_0x4699c9){return function(_0x3e3549){try{jsonpatch[_0x1a75('0x1f')](_0x3e3549,_0x4699c9,!![]);}catch(_0x340750){return BPromise[_0x1a75('0x20')](_0x340750);}return _0x3e3549[_0x1a75('0x21')]();};}function saveUpdates(_0x5a0ad7,_0x3ed5e9){return function(_0x4dc595){if(_0x4dc595){return _0x4dc595[_0x1a75('0x22')](_0x5a0ad7)[_0x1a75('0x23')](function(_0x320413){return _0x320413;});}return null;};}function removeEntity(_0x59e3da,_0x443ff8){return function(_0x5e6617){if(_0x5e6617){return _0x5e6617[_0x1a75('0x24')]()[_0x1a75('0x23')](function(){_0x59e3da[_0x1a75('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9fe9fe,_0x126f40){return function(_0x4dec82){if(!_0x4dec82){_0x9fe9fe[_0x1a75('0x25')](0x194);}return _0x4dec82;};}function handleError(_0x399dae,_0x5a6acc){_0x5a6acc=_0x5a6acc||0x1f4;return function(_0x168e06){logger[_0x1a75('0x26')](_0x168e06[_0x1a75('0x27')]);if(_0x168e06[_0x1a75('0x28')]){delete _0x168e06['name'];}_0x399dae[_0x1a75('0x19')](_0x5a6acc)[_0x1a75('0x29')](_0x168e06);};}exports[_0x1a75('0x2a')]=function(_0x2f5ac9,_0xf33870){var _0x9e66b9={},_0x3b6e1d={},_0x38e885={'count':0x0,'rows':[]};var _0x5518ed=_['map'](db[_0x1a75('0x2b')][_0x1a75('0x2c')],function(_0x1a0359){return{'name':_0x1a0359[_0x1a75('0x2d')],'type':_0x1a0359[_0x1a75('0x2e')][_0x1a75('0x2f')]};});_0x3b6e1d[_0x1a75('0x30')]=_[_0x1a75('0x31')](_0x5518ed,'name');_0x3b6e1d['query']=_['keys'](_0x2f5ac9[_0x1a75('0x32')]);_0x3b6e1d[_0x1a75('0x33')]=_[_0x1a75('0x34')](_0x3b6e1d[_0x1a75('0x30')],_0x3b6e1d['query']);_0x9e66b9['attributes']=_['intersection'](_0x3b6e1d[_0x1a75('0x30')],qs[_0x1a75('0x35')](_0x2f5ac9['query']['fields']));_0x9e66b9[_0x1a75('0x36')]=_0x9e66b9['attributes'][_0x1a75('0x37')]?_0x9e66b9[_0x1a75('0x36')]:_0x3b6e1d[_0x1a75('0x30')];if(!_0x2f5ac9['query']['hasOwnProperty'](_0x1a75('0x38'))){_0x9e66b9[_0x1a75('0x1a')]=qs[_0x1a75('0x1a')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x1a')]);_0x9e66b9[_0x1a75('0x1d')]=qs[_0x1a75('0x1d')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x1d')]);}_0x9e66b9[_0x1a75('0x39')]=qs[_0x1a75('0x3a')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x3a')]);_0x9e66b9[_0x1a75('0x3b')]=qs[_0x1a75('0x33')](_[_0x1a75('0x3c')](_0x2f5ac9['query'],_0x3b6e1d[_0x1a75('0x33')]),_0x5518ed);if(_0x2f5ac9['query']['filter']){_0x9e66b9[_0x1a75('0x3b')]=_[_0x1a75('0x3d')](_0x9e66b9[_0x1a75('0x3b')],{'$or':_[_0x1a75('0x31')](_0x5518ed,function(_0x2842d4){if(_0x2842d4['type']!==_0x1a75('0x3e')){var _0xc88c40={};_0xc88c40[_0x2842d4[_0x1a75('0x28')]]={'$like':'%'+_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x3f')]+'%'};return _0xc88c40;}})});}_0x9e66b9=_['merge']({},_0x9e66b9,_0x2f5ac9[_0x1a75('0x40')]);var _0x481bfe={'where':_0x9e66b9[_0x1a75('0x3b')]};return db[_0x1a75('0x2b')][_0x1a75('0x1c')](_0x481bfe)[_0x1a75('0x23')](function(_0x269ed6){_0x38e885[_0x1a75('0x1c')]=_0x269ed6;if(_0x2f5ac9[_0x1a75('0x32')]['includeAll']){_0x9e66b9['include']=[{'all':!![]}];}return db[_0x1a75('0x2b')]['findAll'](_0x9e66b9);})[_0x1a75('0x23')](function(_0x14abcf){_0x38e885[_0x1a75('0x41')]=_0x14abcf;return _0x38e885;})['then'](respondWithFilteredResult(_0xf33870,_0x9e66b9))[_0x1a75('0x42')](handleError(_0xf33870,null));};exports[_0x1a75('0x43')]=function(_0x21bfae,_0x5a2c51){var _0x292cbc={'raw':!![],'where':{'id':_0x21bfae[_0x1a75('0x44')]['id']}},_0x15fe49={};_0x15fe49[_0x1a75('0x30')]=_[_0x1a75('0x45')](db[_0x1a75('0x2b')][_0x1a75('0x2c')]);_0x15fe49['query']=_[_0x1a75('0x45')](_0x21bfae[_0x1a75('0x32')]);_0x15fe49[_0x1a75('0x33')]=_[_0x1a75('0x34')](_0x15fe49[_0x1a75('0x30')],_0x15fe49['query']);_0x292cbc[_0x1a75('0x36')]=_[_0x1a75('0x34')](_0x15fe49['model'],qs[_0x1a75('0x35')](_0x21bfae['query'][_0x1a75('0x35')]));_0x292cbc['attributes']=_0x292cbc[_0x1a75('0x36')][_0x1a75('0x37')]?_0x292cbc[_0x1a75('0x36')]:_0x15fe49[_0x1a75('0x30')];if(_0x21bfae[_0x1a75('0x32')][_0x1a75('0x46')]){_0x292cbc[_0x1a75('0x47')]=[{'all':!![]}];}_0x292cbc=_['merge']({},_0x292cbc,_0x21bfae[_0x1a75('0x40')]);return db['JscriptyAnswerReport'][_0x1a75('0x48')](_0x292cbc)[_0x1a75('0x23')](handleEntityNotFound(_0x5a2c51,null))[_0x1a75('0x23')](respondWithResult(_0x5a2c51,null))[_0x1a75('0x42')](handleError(_0x5a2c51,null));};exports[_0x1a75('0x49')]=function(_0x1bf8a0,_0x2cfacf){return db[_0x1a75('0x2b')]['create'](_0x1bf8a0[_0x1a75('0x4a')],{})[_0x1a75('0x23')](respondWithResult(_0x2cfacf,0xc9))[_0x1a75('0x42')](handleError(_0x2cfacf,null));};exports[_0x1a75('0x22')]=function(_0x385382,_0x1b76d){if(_0x385382[_0x1a75('0x4a')]['id']){delete _0x385382[_0x1a75('0x4a')]['id'];}return db[_0x1a75('0x2b')][_0x1a75('0x48')]({'where':{'id':_0x385382[_0x1a75('0x44')]['id']}})[_0x1a75('0x23')](handleEntityNotFound(_0x1b76d,null))[_0x1a75('0x23')](saveUpdates(_0x385382[_0x1a75('0x4a')],null))[_0x1a75('0x23')](respondWithResult(_0x1b76d,null))['catch'](handleError(_0x1b76d,null));};exports[_0x1a75('0x24')]=function(_0xa20c25,_0x1ae0cb){return db[_0x1a75('0x2b')][_0x1a75('0x48')]({'where':{'id':_0xa20c25[_0x1a75('0x44')]['id']}})[_0x1a75('0x23')](handleEntityNotFound(_0x1ae0cb,null))[_0x1a75('0x23')](removeEntity(_0x1ae0cb,null))['catch'](handleError(_0x1ae0cb,null));};exports[_0x1a75('0x4b')]=function(_0x5f44e3,_0x40e643){return db[_0x1a75('0x2b')][_0x1a75('0x4b')]()['then'](respondWithResult(_0x40e643,null))['catch'](handleError(_0x40e643,null));}; \ No newline at end of file +var _0x078c=['lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','JscriptyAnswerReport','count','include','rows','catch','intersection','includeAll','options','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x579088,_0x4b1ef2){var _0x477347=function(_0x277ab0){while(--_0x277ab0){_0x579088['push'](_0x579088['shift']());}};_0x477347(++_0x4b1ef2);}(_0x078c,0x19f));var _0xc078=function(_0x1f44e4,_0x22d9fd){_0x1f44e4=_0x1f44e4-0x0;var _0x591989=_0x078c[_0x1f44e4];return _0x591989;};'use strict';var emlformat=require(_0xc078('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc078('0x1'));var jsonpatch=require(_0xc078('0x2'));var rp=require('request-promise');var moment=require(_0xc078('0x3'));var BPromise=require(_0xc078('0x4'));var Mustache=require(_0xc078('0x5'));var util=require(_0xc078('0x6'));var path=require('path');var sox=require(_0xc078('0x7'));var csv=require(_0xc078('0x8'));var ejs=require(_0xc078('0x9'));var fs=require('fs');var fs_extra=require(_0xc078('0xa'));var _=require(_0xc078('0xb'));var squel=require(_0xc078('0xc'));var crypto=require(_0xc078('0xd'));var jsforce=require(_0xc078('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc078('0xf'));var Redis=require(_0xc078('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc078('0x11'));var as=require(_0xc078('0x12'));var hardwareService=require(_0xc078('0x13'));var logger=require(_0xc078('0x14'))(_0xc078('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc078('0x16'));var db=require(_0xc078('0x17'))['db'];function respondWithStatusCode(_0x3fa2be,_0x25e95d){_0x25e95d=_0x25e95d||0xcc;return function(_0x3e27c7){if(_0x3e27c7){return _0x3fa2be[_0xc078('0x18')](_0x25e95d);}return _0x3fa2be[_0xc078('0x19')](_0x25e95d)[_0xc078('0x1a')]();};}function respondWithResult(_0x11a3c3,_0x393225){_0x393225=_0x393225||0xc8;return function(_0x256d7b){if(_0x256d7b){return _0x11a3c3[_0xc078('0x19')](_0x393225)[_0xc078('0x1b')](_0x256d7b);}};}function respondWithFilteredResult(_0x36b6b1,_0x404ab0){return function(_0x5a1cbc){if(_0x5a1cbc){var _0x39e242=typeof _0x404ab0[_0xc078('0x1c')]===_0xc078('0x1d')&&typeof _0x404ab0['limit']===_0xc078('0x1d');var _0x5ab33a=_0x5a1cbc['count'];var _0xfd361b=_0x39e242?0x0:_0x404ab0['offset'];var _0x2ec2d5=_0x39e242?_0x5a1cbc['count']:_0x404ab0[_0xc078('0x1c')]+_0x404ab0[_0xc078('0x1e')];var _0x25fb75;if(_0x2ec2d5>=_0x5ab33a){_0x2ec2d5=_0x5ab33a;_0x25fb75=0xc8;}else{_0x25fb75=0xce;}_0x36b6b1['status'](_0x25fb75);return _0x36b6b1[_0xc078('0x1f')]('Content-Range',_0xfd361b+'-'+_0x2ec2d5+'/'+_0x5ab33a)[_0xc078('0x1b')](_0x5a1cbc);}return null;};}function patchUpdates(_0x2a9bbf){return function(_0x19b29b){try{jsonpatch[_0xc078('0x20')](_0x19b29b,_0x2a9bbf,!![]);}catch(_0x3f68ca){return BPromise['reject'](_0x3f68ca);}return _0x19b29b[_0xc078('0x21')]();};}function saveUpdates(_0x36efa2,_0x2e56fa){return function(_0x275cbc){if(_0x275cbc){return _0x275cbc['update'](_0x36efa2)[_0xc078('0x22')](function(_0xa4cd22){return _0xa4cd22;});}return null;};}function removeEntity(_0x3bde7a,_0x1cb7cb){return function(_0x41fac6){if(_0x41fac6){return _0x41fac6[_0xc078('0x23')]()[_0xc078('0x22')](function(){_0x3bde7a[_0xc078('0x19')](0xcc)[_0xc078('0x1a')]();});}};}function handleEntityNotFound(_0x3017a3,_0x14f677){return function(_0x531945){if(!_0x531945){_0x3017a3['sendStatus'](0x194);}return _0x531945;};}function handleError(_0x29525b,_0x5c7fc9){_0x5c7fc9=_0x5c7fc9||0x1f4;return function(_0x4a022a){logger['error'](_0x4a022a[_0xc078('0x24')]);if(_0x4a022a['name']){delete _0x4a022a[_0xc078('0x25')];}_0x29525b[_0xc078('0x19')](_0x5c7fc9)[_0xc078('0x26')](_0x4a022a);};}exports[_0xc078('0x27')]=function(_0xd43338,_0x2b257c){var _0x7c965e={},_0x3c481f={},_0x50e5d={'count':0x0,'rows':[]};var _0x43c377=_[_0xc078('0x28')](db['JscriptyAnswerReport'][_0xc078('0x29')],function(_0x560cbb){return{'name':_0x560cbb[_0xc078('0x2a')],'type':_0x560cbb[_0xc078('0x2b')][_0xc078('0x2c')]};});_0x3c481f[_0xc078('0x2d')]=_['map'](_0x43c377,_0xc078('0x25'));_0x3c481f['query']=_['keys'](_0xd43338[_0xc078('0x2e')]);_0x3c481f[_0xc078('0x2f')]=_['intersection'](_0x3c481f[_0xc078('0x2d')],_0x3c481f[_0xc078('0x2e')]);_0x7c965e[_0xc078('0x30')]=_['intersection'](_0x3c481f['model'],qs[_0xc078('0x31')](_0xd43338['query'][_0xc078('0x31')]));_0x7c965e[_0xc078('0x30')]=_0x7c965e['attributes'][_0xc078('0x32')]?_0x7c965e[_0xc078('0x30')]:_0x3c481f[_0xc078('0x2d')];if(!_0xd43338['query'][_0xc078('0x33')](_0xc078('0x34'))){_0x7c965e[_0xc078('0x1e')]=qs['limit'](_0xd43338['query'][_0xc078('0x1e')]);_0x7c965e[_0xc078('0x1c')]=qs['offset'](_0xd43338['query']['offset']);}_0x7c965e['order']=qs['sort'](_0xd43338[_0xc078('0x2e')][_0xc078('0x35')]);_0x7c965e[_0xc078('0x36')]=qs[_0xc078('0x2f')](_['pick'](_0xd43338[_0xc078('0x2e')],_0x3c481f['filters']),_0x43c377);if(_0xd43338['query'][_0xc078('0x37')]){_0x7c965e[_0xc078('0x36')]=_[_0xc078('0x38')](_0x7c965e[_0xc078('0x36')],{'$or':_[_0xc078('0x28')](_0x43c377,function(_0x2d5558){if(_0x2d5558[_0xc078('0x2b')]!==_0xc078('0x39')){var _0x534def={};_0x534def[_0x2d5558['name']]={'$like':'%'+_0xd43338['query']['filter']+'%'};return _0x534def;}})});}_0x7c965e=_[_0xc078('0x38')]({},_0x7c965e,_0xd43338['options']);var _0x122555={'where':_0x7c965e['where']};return db[_0xc078('0x3a')]['count'](_0x122555)['then'](function(_0x13e765){_0x50e5d[_0xc078('0x3b')]=_0x13e765;if(_0xd43338[_0xc078('0x2e')]['includeAll']){_0x7c965e[_0xc078('0x3c')]=[{'all':!![]}];}return db[_0xc078('0x3a')]['findAll'](_0x7c965e);})[_0xc078('0x22')](function(_0x3c2bc9){_0x50e5d[_0xc078('0x3d')]=_0x3c2bc9;return _0x50e5d;})[_0xc078('0x22')](respondWithFilteredResult(_0x2b257c,_0x7c965e))[_0xc078('0x3e')](handleError(_0x2b257c,null));};exports['show']=function(_0x3ffd96,_0x1d8e5b){var _0x3710b6={'raw':!![],'where':{'id':_0x3ffd96['params']['id']}},_0x548507={};_0x548507[_0xc078('0x2d')]=_['keys'](db['JscriptyAnswerReport'][_0xc078('0x29')]);_0x548507[_0xc078('0x2e')]=_['keys'](_0x3ffd96[_0xc078('0x2e')]);_0x548507['filters']=_[_0xc078('0x3f')](_0x548507['model'],_0x548507[_0xc078('0x2e')]);_0x3710b6[_0xc078('0x30')]=_[_0xc078('0x3f')](_0x548507[_0xc078('0x2d')],qs['fields'](_0x3ffd96[_0xc078('0x2e')][_0xc078('0x31')]));_0x3710b6[_0xc078('0x30')]=_0x3710b6[_0xc078('0x30')]['length']?_0x3710b6[_0xc078('0x30')]:_0x548507[_0xc078('0x2d')];if(_0x3ffd96[_0xc078('0x2e')][_0xc078('0x40')]){_0x3710b6[_0xc078('0x3c')]=[{'all':!![]}];}_0x3710b6=_['merge']({},_0x3710b6,_0x3ffd96[_0xc078('0x41')]);return db['JscriptyAnswerReport']['find'](_0x3710b6)['then'](handleEntityNotFound(_0x1d8e5b,null))[_0xc078('0x22')](respondWithResult(_0x1d8e5b,null))[_0xc078('0x3e')](handleError(_0x1d8e5b,null));};exports[_0xc078('0x42')]=function(_0x4c3041,_0x57abc6){return db[_0xc078('0x3a')][_0xc078('0x42')](_0x4c3041['body'],{})[_0xc078('0x22')](respondWithResult(_0x57abc6,0xc9))[_0xc078('0x3e')](handleError(_0x57abc6,null));};exports['update']=function(_0x2a846f,_0x57889b){if(_0x2a846f[_0xc078('0x43')]['id']){delete _0x2a846f[_0xc078('0x43')]['id'];}return db[_0xc078('0x3a')][_0xc078('0x44')]({'where':{'id':_0x2a846f[_0xc078('0x45')]['id']}})[_0xc078('0x22')](handleEntityNotFound(_0x57889b,null))['then'](saveUpdates(_0x2a846f[_0xc078('0x43')],null))[_0xc078('0x22')](respondWithResult(_0x57889b,null))[_0xc078('0x3e')](handleError(_0x57889b,null));};exports[_0xc078('0x23')]=function(_0x71ae97,_0x4c82c6){return db[_0xc078('0x3a')][_0xc078('0x44')]({'where':{'id':_0x71ae97['params']['id']}})[_0xc078('0x22')](handleEntityNotFound(_0x4c82c6,null))[_0xc078('0x22')](removeEntity(_0x4c82c6,null))[_0xc078('0x3e')](handleError(_0x4c82c6,null));};exports['describe']=function(_0x36456e,_0x5e3021){return db[_0xc078('0x3a')][_0xc078('0x46')]()[_0xc078('0x22')](respondWithResult(_0x5e3021,null))[_0xc078('0x3e')](handleError(_0x5e3021,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index afc341b..1f7620e 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 _0x22c8=['JscriptyAnswerReport','report_jscripty_answers','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x10a7b2,_0x37587c){var _0x5cf00e=function(_0x69b0b9){while(--_0x69b0b9){_0x10a7b2['push'](_0x10a7b2['shift']());}};_0x5cf00e(++_0x37587c);}(_0x22c8,0x178));var _0x822c=function(_0x25c988,_0xce8221){_0x25c988=_0x25c988-0x0;var _0x45fcc2=_0x22c8[_0x25c988];return _0x45fcc2;};'use strict';var _=require(_0x822c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x822c('0x1'));var moment=require(_0x822c('0x2'));var BPromise=require(_0x822c('0x3'));var rp=require(_0x822c('0x4'));var fs=require('fs');var path=require(_0x822c('0x5'));var rimraf=require(_0x822c('0x6'));var config=require(_0x822c('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x822c('0x8')]=function(_0x3895d9,_0x42e342){return _0x3895d9['define'](_0x822c('0x9'),attributes,{'tableName':_0x822c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabbb=['api','moment','bluebird','request-promise','path','rimraf','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xabbb,0x9a));var _0xbabb=function(_0x421d51,_0x5db0e2){_0x421d51=_0x421d51-0x0;var _0xd6ec31=_0xabbb[_0x421d51];return _0xd6ec31;};'use strict';var _=require(_0xbabb('0x0'));var util=require('util');var logger=require(_0xbabb('0x1'))(_0xbabb('0x2'));var moment=require(_0xbabb('0x3'));var BPromise=require(_0xbabb('0x4'));var rp=require(_0xbabb('0x5'));var fs=require('fs');var path=require(_0xbabb('0x6'));var rimraf=require(_0xbabb('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0xbabb('0x8')]=function(_0x5d6381,_0x431396){return _0x5d6381[_0xbabb('0x9')](_0xbabb('0xa'),attributes,{'tableName':_0xbabb('0xb'),'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 73326a2..5d5883d 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 _0x2464=['rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x22e353,_0xa91666){var _0x50fd8d=function(_0x17072b){while(--_0x17072b){_0x22e353['push'](_0x22e353['shift']());}};_0x50fd8d(++_0xa91666);}(_0x2464,0x1c0));var _0x4246=function(_0x10f463,_0x9f382c){_0x10f463=_0x10f463-0x0;var _0x299e90=_0x2464[_0x10f463];return _0x299e90;};'use strict';var _=require(_0x4246('0x0'));var util=require(_0x4246('0x1'));var moment=require(_0x4246('0x2'));var BPromise=require(_0x4246('0x3'));var rs=require(_0x4246('0x4'));var fs=require('fs');var Redis=require(_0x4246('0x5'));var db=require(_0x4246('0x6'))['db'];var utils=require(_0x4246('0x7'));var logger=require('../../config/logger')(_0x4246('0x8'));var config=require(_0x4246('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4246('0xa')][_0x4246('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23aa5e,_0x5b9e54,_0x26639a){return new BPromise(function(_0x4c59cc,_0x36b825){return client[_0x4246('0xc')](_0x23aa5e,_0x26639a)[_0x4246('0xd')](function(_0x578efd){logger[_0x4246('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5b9e54,_0x4246('0xf'));logger[_0x4246('0x10')](_0x4246('0x11'),_0x5b9e54,_0x4246('0xf'),JSON[_0x4246('0x12')](_0x578efd));if(_0x578efd['error']){if(_0x578efd[_0x4246('0x13')]['code']===0x1f4){logger[_0x4246('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5b9e54,_0x578efd['error']['message']);return _0x36b825(_0x578efd[_0x4246('0x13')][_0x4246('0x14')]);}logger[_0x4246('0x13')](_0x4246('0x15'),_0x5b9e54,_0x578efd[_0x4246('0x13')][_0x4246('0x14')]);return _0x4c59cc(_0x578efd[_0x4246('0x13')][_0x4246('0x14')]);}else{logger['info'](_0x4246('0x15'),_0x5b9e54,_0x4246('0xf'));_0x4c59cc(_0x578efd[_0x4246('0x16')][_0x4246('0x14')]);}})[_0x4246('0x17')](function(_0x5adae6){logger[_0x4246('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5b9e54,_0x5adae6);_0x36b825(_0x5adae6);});});} \ No newline at end of file +var _0x3d71=['util','moment','randomstring','ioredis','../../config/utils','rpc','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash'];(function(_0x943493,_0x1e9a27){var _0x26f7be=function(_0x31a217){while(--_0x31a217){_0x943493['push'](_0x943493['shift']());}};_0x26f7be(++_0x1e9a27);}(_0x3d71,0xfb));var _0x13d7=function(_0xd5db72,_0x876b27){_0xd5db72=_0xd5db72-0x0;var _0x588691=_0x3d71[_0xd5db72];return _0x588691;};'use strict';var _=require(_0x13d7('0x0'));var util=require(_0x13d7('0x1'));var moment=require(_0x13d7('0x2'));var BPromise=require('bluebird');var rs=require(_0x13d7('0x3'));var fs=require('fs');var Redis=require(_0x13d7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x13d7('0x5'));var logger=require('../../config/logger')(_0x13d7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x13d7('0x7')][_0x13d7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18e11f,_0xe6b00b,_0x5673c5){return new BPromise(function(_0x6130d0,_0x4d4b59){return client[_0x13d7('0x9')](_0x18e11f,_0x5673c5)[_0x13d7('0xa')](function(_0x2e8d89){logger['info'](_0x13d7('0xb'),_0xe6b00b,'request\x20sent');logger[_0x13d7('0xc')](_0x13d7('0xd'),_0xe6b00b,_0x13d7('0xe'),JSON[_0x13d7('0xf')](_0x2e8d89));if(_0x2e8d89[_0x13d7('0x10')]){if(_0x2e8d89[_0x13d7('0x10')]['code']===0x1f4){logger[_0x13d7('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xe6b00b,_0x2e8d89[_0x13d7('0x10')][_0x13d7('0x11')]);return _0x4d4b59(_0x2e8d89[_0x13d7('0x10')]['message']);}logger['error'](_0x13d7('0xb'),_0xe6b00b,_0x2e8d89[_0x13d7('0x10')][_0x13d7('0x11')]);return _0x6130d0(_0x2e8d89['error'][_0x13d7('0x11')]);}else{logger[_0x13d7('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xe6b00b,_0x13d7('0xe'));_0x6130d0(_0x2e8d89[_0x13d7('0x13')]['message']);}})[_0x13d7('0x14')](function(_0x5dd302){logger[_0x13d7('0x10')](_0x13d7('0xb'),_0xe6b00b,_0x5dd302);_0x4d4b59(_0x5dd302);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 3029d71..849de59 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 _0x2f6b=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','update','delete','destroy'];(function(_0x1ce575,_0xbcf48f){var _0x20118a=function(_0x2a44e4){while(--_0x2a44e4){_0x1ce575['push'](_0x1ce575['shift']());}};_0x20118a(++_0xbcf48f);}(_0x2f6b,0x151));var _0xb2f6=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0x2f6b[_0x79cd47];return _0x3b9484;};'use strict';var multer=require(_0xb2f6('0x0'));var util=require('util');var path=require(_0xb2f6('0x1'));var timeout=require('connect-timeout');var express=require(_0xb2f6('0x2'));var router=express[_0xb2f6('0x3')]();var fs_extra=require(_0xb2f6('0x4'));var auth=require(_0xb2f6('0x5'));var interaction=require(_0xb2f6('0x6'));var config=require(_0xb2f6('0x7'));var controller=require(_0xb2f6('0x8'));router[_0xb2f6('0x9')]('/',auth['isAuthenticated'](),controller[_0xb2f6('0xa')]);router[_0xb2f6('0x9')](_0xb2f6('0xb'),auth[_0xb2f6('0xc')](),controller[_0xb2f6('0xd')]);router[_0xb2f6('0x9')](_0xb2f6('0xe'),auth[_0xb2f6('0xc')](),controller[_0xb2f6('0xf')]);router['get']('/:id/answers',auth[_0xb2f6('0xc')](),controller['getAnswers']);router[_0xb2f6('0x9')](_0xb2f6('0x10'),auth[_0xb2f6('0xc')](),timeout(_0xb2f6('0x11')),controller[_0xb2f6('0x12')]);router[_0xb2f6('0x13')]('/',auth[_0xb2f6('0xc')](),controller[_0xb2f6('0x14')]);router[_0xb2f6('0x13')](_0xb2f6('0x15'),auth['isAuthenticated'](),controller[_0xb2f6('0x16')]);router[_0xb2f6('0x17')]('/:id',auth[_0xb2f6('0xc')](),controller[_0xb2f6('0x18')]);router[_0xb2f6('0x19')](_0xb2f6('0xb'),auth[_0xb2f6('0xc')](),controller[_0xb2f6('0x1a')]);module[_0xb2f6('0x1b')]=router; \ No newline at end of file +var _0x2086=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','get','/:id','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','delete','destroy','exports','multer','util','path'];(function(_0x4b9fe8,_0x51c0c2){var _0x1d2bbf=function(_0x59ba09){while(--_0x59ba09){_0x4b9fe8['push'](_0x4b9fe8['shift']());}};_0x1d2bbf(++_0x51c0c2);}(_0x2086,0x192));var _0x6208=function(_0x69258b,_0x3f057c){_0x69258b=_0x69258b-0x0;var _0x92c5d9=_0x2086[_0x69258b];return _0x92c5d9;};'use strict';var multer=require(_0x6208('0x0'));var util=require(_0x6208('0x1'));var path=require(_0x6208('0x2'));var timeout=require(_0x6208('0x3'));var express=require('express');var router=express[_0x6208('0x4')]();var fs_extra=require(_0x6208('0x5'));var auth=require(_0x6208('0x6'));var interaction=require(_0x6208('0x7'));var config=require(_0x6208('0x8'));var controller=require(_0x6208('0x9'));router['get']('/',auth[_0x6208('0xa')](),controller['index']);router[_0x6208('0xb')](_0x6208('0xc'),auth[_0x6208('0xa')](),controller[_0x6208('0xd')]);router[_0x6208('0xb')](_0x6208('0xe'),auth['isAuthenticated'](),controller[_0x6208('0xf')]);router[_0x6208('0xb')](_0x6208('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x6208('0x11'),auth['isAuthenticated'](),timeout(_0x6208('0x12')),controller[_0x6208('0x13')]);router[_0x6208('0x14')]('/',auth[_0x6208('0xa')](),controller[_0x6208('0x15')]);router[_0x6208('0x14')](_0x6208('0x16'),auth[_0x6208('0xa')](),controller[_0x6208('0x17')]);router['put'](_0x6208('0xc'),auth[_0x6208('0xa')](),controller['update']);router[_0x6208('0x18')](_0x6208('0xc'),auth[_0x6208('0xa')](),controller[_0x6208('0x19')]);module[_0x6208('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index a6f261e..9c457ed 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 _0x6981=['setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike'];(function(_0x29da9f,_0x3626e2){var _0x293252=function(_0x978302){while(--_0x978302){_0x29da9f['push'](_0x29da9f['shift']());}};_0x293252(++_0x3626e2);}(_0x6981,0x1e4));var _0x1698=function(_0x24e183,_0xc70683){_0x24e183=_0x24e183-0x0;var _0x2e31dc=_0x6981[_0x24e183];return _0x2e31dc;};'use strict';var Sequelize=require(_0x1698('0x0'));var _=require(_0x1698('0x1'));var util=require(_0x1698('0x2'));module[_0x1698('0x3')]={'name':{'type':Sequelize[_0x1698('0x4')],'unique':_0x1698('0x5')},'description':{'type':Sequelize[_0x1698('0x4')]},'formData':{'type':Sequelize[_0x1698('0x6')](_0x1698('0x7')),'set':function(_0x2a5d67){if(_[_0x1698('0x8')](_0x2a5d67)){this[_0x1698('0x9')](_0x1698('0xa'),JSON[_0x1698('0xb')](_0x2a5d67));}else if(_['isString'](_0x2a5d67)){this[_0x1698('0x9')](_0x1698('0xa'),_0x2a5d67);}else{this['setDataValue'](_0x1698('0xa'),util[_0x1698('0xc')](_0x1698('0xd'),this[_0x1698('0xe')](_0x1698('0x5'))||'',this['getDataValue'](_0x1698('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1698('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd7cd=['setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','exports','name','STRING','long','isObjectLike'];(function(_0x196a5c,_0x29990d){var _0xb25474=function(_0x4a4a29){while(--_0x4a4a29){_0x196a5c['push'](_0x196a5c['shift']());}};_0xb25474(++_0x29990d);}(_0xd7cd,0x1bb));var _0xdd7c=function(_0x2ff4d1,_0x4bddc9){_0x2ff4d1=_0x2ff4d1-0x0;var _0x56b9fe=_0xd7cd[_0x2ff4d1];return _0x56b9fe;};'use strict';var Sequelize=require(_0xdd7c('0x0'));var _=require(_0xdd7c('0x1'));var util=require('util');module[_0xdd7c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xdd7c('0x3')},'description':{'type':Sequelize[_0xdd7c('0x4')]},'formData':{'type':Sequelize['TEXT'](_0xdd7c('0x5')),'set':function(_0x22c642){if(_[_0xdd7c('0x6')](_0x22c642)){this[_0xdd7c('0x7')](_0xdd7c('0x8'),JSON[_0xdd7c('0x9')](_0x22c642));}else if(_[_0xdd7c('0xa')](_0x22c642)){this[_0xdd7c('0x7')](_0xdd7c('0x8'),_0x22c642);}else{this[_0xdd7c('0x7')](_0xdd7c('0x8'),util['format'](_0xdd7c('0xb'),this[_0xdd7c('0xc')]('name')||'',this['getDataValue'](_0xdd7c('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xdd7c('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xdd7c('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 7e38f57..3bd6d2b 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 _0x1a05=['lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','reject','then','Projects','UserProfileResource','error','stack','name','send','index','JscriptyProject','rawAttributes','type','key','map','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','keys','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','ProjectId','JscriptySessionReport','rows','getAnswers','findOne','JscriptyAnswerReport','hasOwnProperty','fromCharCode','toString','indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','setHeader','Content-disposition','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x4e4a88,_0x3b5f23){var _0x482ec6=function(_0x2a4ca7){while(--_0x2a4ca7){_0x4e4a88['push'](_0x4e4a88['shift']());}};_0x482ec6(++_0x3b5f23);}(_0x1a05,0x153));var _0x51a0=function(_0xe1075e,_0x23a2fc){_0xe1075e=_0xe1075e-0x0;var _0x1eba9f=_0x1a05[_0xe1075e];return _0x1eba9f;};'use strict';var emlformat=require(_0x51a0('0x0'));var rimraf=require(_0x51a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x51a0('0x2'));var rp=require(_0x51a0('0x3'));var moment=require(_0x51a0('0x4'));var BPromise=require(_0x51a0('0x5'));var Mustache=require(_0x51a0('0x6'));var util=require(_0x51a0('0x7'));var path=require(_0x51a0('0x8'));var sox=require(_0x51a0('0x9'));var csv=require(_0x51a0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a0('0xb'));var _=require(_0x51a0('0xc'));var squel=require(_0x51a0('0xd'));var crypto=require(_0x51a0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x51a0('0xf'));var toCsv=require(_0x51a0('0xa'));var querystring=require('querystring');var Papa=require(_0x51a0('0x10'));var Redis=require(_0x51a0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x51a0('0x12'));var as=require(_0x51a0('0x13'));var hardwareService=require(_0x51a0('0x14'));var logger=require(_0x51a0('0x15'))(_0x51a0('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x51a0('0x17'))['db'];function respondWithStatusCode(_0x1c41cf,_0x2870d7){_0x2870d7=_0x2870d7||0xcc;return function(_0x37a682){if(_0x37a682){return _0x1c41cf[_0x51a0('0x18')](_0x2870d7);}return _0x1c41cf['status'](_0x2870d7)[_0x51a0('0x19')]();};}function respondWithResult(_0x522f78,_0x350c6b){_0x350c6b=_0x350c6b||0xc8;return function(_0x29e1ce){if(_0x29e1ce){return _0x522f78['status'](_0x350c6b)['json'](_0x29e1ce);}};}function respondWithFilteredResult(_0x3c1866,_0x29589e){return function(_0x5a6449){if(_0x5a6449){var _0x275e90=typeof _0x29589e['offset']===_0x51a0('0x1a')&&typeof _0x29589e[_0x51a0('0x1b')]===_0x51a0('0x1a');var _0x152553=_0x5a6449[_0x51a0('0x1c')];var _0x31a9e7=_0x275e90?0x0:_0x29589e[_0x51a0('0x1d')];var _0x356aa1=_0x275e90?_0x5a6449[_0x51a0('0x1c')]:_0x29589e[_0x51a0('0x1d')]+_0x29589e[_0x51a0('0x1b')];var _0x5e1bbe;if(_0x356aa1>=_0x152553){_0x356aa1=_0x152553;_0x5e1bbe=0xc8;}else{_0x5e1bbe=0xce;}_0x3c1866[_0x51a0('0x1e')](_0x5e1bbe);return _0x3c1866[_0x51a0('0x1f')](_0x51a0('0x20'),_0x31a9e7+'-'+_0x356aa1+'/'+_0x152553)[_0x51a0('0x21')](_0x5a6449);}return null;};}function patchUpdates(_0x5f06ae){return function(_0x4f2458){try{jsonpatch[_0x51a0('0x22')](_0x4f2458,_0x5f06ae,!![]);}catch(_0x545e20){return BPromise[_0x51a0('0x23')](_0x545e20);}return _0x4f2458['save']();};}function saveUpdates(_0x485e61,_0x2ffba4){return function(_0x5922c7){if(_0x5922c7){return _0x5922c7['update'](_0x485e61)[_0x51a0('0x24')](function(_0x4bd85e){return _0x4bd85e;});}return null;};}function removeEntity(_0x4af6ff,_0x616fbb){return function(_0x5f3c45){if(_0x5f3c45){return _0x5f3c45['destroy']()[_0x51a0('0x24')](function(){var _0x1dbb57=_0x5f3c45['get']({'plain':!![]});var _0x3f6d52=_0x51a0('0x25');return db[_0x51a0('0x26')]['destroy']({'where':{'type':_0x3f6d52,'resourceId':_0x1dbb57['id']}})[_0x51a0('0x24')](function(){return _0x5f3c45;});})[_0x51a0('0x24')](function(){_0x4af6ff[_0x51a0('0x1e')](0xcc)[_0x51a0('0x19')]();});}};}function handleEntityNotFound(_0x4e338b,_0x22b1e0){return function(_0xd56778){if(!_0xd56778){_0x4e338b[_0x51a0('0x18')](0x194);}return _0xd56778;};}function handleError(_0x1de7ba,_0x4defe2){_0x4defe2=_0x4defe2||0x1f4;return function(_0x1f4627){logger[_0x51a0('0x27')](_0x1f4627[_0x51a0('0x28')]);if(_0x1f4627[_0x51a0('0x29')]){delete _0x1f4627[_0x51a0('0x29')];}_0x1de7ba['status'](_0x4defe2)[_0x51a0('0x2a')](_0x1f4627);};}exports[_0x51a0('0x2b')]=function(_0x5eadfb,_0x357850){var _0x4d8141={},_0x11cf4a={},_0x37e85c={'count':0x0,'rows':[]};var _0x47a50a=_['map'](db[_0x51a0('0x2c')][_0x51a0('0x2d')],function(_0x47cc8a){return{'name':_0x47cc8a['fieldName'],'type':_0x47cc8a[_0x51a0('0x2e')][_0x51a0('0x2f')]};});_0x11cf4a['model']=_[_0x51a0('0x30')](_0x47a50a,_0x51a0('0x29'));_0x11cf4a[_0x51a0('0x31')]=_['keys'](_0x5eadfb['query']);_0x11cf4a['filters']=_[_0x51a0('0x32')](_0x11cf4a[_0x51a0('0x33')],_0x11cf4a[_0x51a0('0x31')]);_0x4d8141[_0x51a0('0x34')]=_[_0x51a0('0x32')](_0x11cf4a[_0x51a0('0x33')],qs[_0x51a0('0x35')](_0x5eadfb[_0x51a0('0x31')]['fields']));_0x4d8141[_0x51a0('0x34')]=_0x4d8141[_0x51a0('0x34')][_0x51a0('0x36')]?_0x4d8141[_0x51a0('0x34')]:_0x11cf4a['model'];if(!_0x5eadfb[_0x51a0('0x31')]['hasOwnProperty'](_0x51a0('0x37'))){_0x4d8141[_0x51a0('0x1b')]=qs['limit'](_0x5eadfb[_0x51a0('0x31')][_0x51a0('0x1b')]);_0x4d8141[_0x51a0('0x1d')]=qs[_0x51a0('0x1d')](_0x5eadfb[_0x51a0('0x31')][_0x51a0('0x1d')]);}_0x4d8141[_0x51a0('0x38')]=qs[_0x51a0('0x39')](_0x5eadfb[_0x51a0('0x31')]['sort']);_0x4d8141[_0x51a0('0x3a')]=qs['filters'](_['pick'](_0x5eadfb['query'],_0x11cf4a[_0x51a0('0x3b')]),_0x47a50a);if(_0x5eadfb['query']['filter']){_0x4d8141[_0x51a0('0x3a')]=_[_0x51a0('0x3c')](_0x4d8141[_0x51a0('0x3a')],{'$or':_[_0x51a0('0x30')](_0x47a50a,function(_0x4a3133){if(_0x4a3133[_0x51a0('0x2e')]!==_0x51a0('0x3d')){var _0x46c88c={};_0x46c88c[_0x4a3133[_0x51a0('0x29')]]={'$like':'%'+_0x5eadfb[_0x51a0('0x31')][_0x51a0('0x3e')]+'%'};return _0x46c88c;}})});}_0x4d8141=_['merge']({},_0x4d8141,_0x5eadfb['options']);var _0x3facd9={'where':_0x4d8141[_0x51a0('0x3a')]};return db[_0x51a0('0x2c')][_0x51a0('0x1c')](_0x3facd9)[_0x51a0('0x24')](function(_0x303844){_0x37e85c[_0x51a0('0x1c')]=_0x303844;if(_0x5eadfb[_0x51a0('0x31')][_0x51a0('0x3f')]){_0x4d8141[_0x51a0('0x40')]=[{'all':!![]}];}return db[_0x51a0('0x2c')][_0x51a0('0x41')](_0x4d8141);})['then'](function(_0x251c5a){_0x37e85c['rows']=_0x251c5a;return _0x37e85c;})[_0x51a0('0x24')](respondWithFilteredResult(_0x357850,_0x4d8141))[_0x51a0('0x42')](handleError(_0x357850,null));};exports[_0x51a0('0x43')]=function(_0x17aa2c,_0x2583fa){var _0xb479d8={'raw':![],'where':{'id':_0x17aa2c['params']['id']}},_0x55ed10={};_0x55ed10[_0x51a0('0x33')]=_[_0x51a0('0x44')](db[_0x51a0('0x2c')][_0x51a0('0x2d')]);_0x55ed10[_0x51a0('0x31')]=_[_0x51a0('0x44')](_0x17aa2c[_0x51a0('0x31')]);_0x55ed10[_0x51a0('0x3b')]=_[_0x51a0('0x32')](_0x55ed10[_0x51a0('0x33')],_0x55ed10[_0x51a0('0x31')]);_0xb479d8[_0x51a0('0x34')]=_[_0x51a0('0x32')](_0x55ed10['model'],qs[_0x51a0('0x35')](_0x17aa2c[_0x51a0('0x31')][_0x51a0('0x35')]));_0xb479d8[_0x51a0('0x34')]=_0xb479d8['attributes']['length']?_0xb479d8['attributes']:_0x55ed10[_0x51a0('0x33')];if(_0x17aa2c[_0x51a0('0x31')]['includeAll']){_0xb479d8['include']=[{'all':!![]}];}_0xb479d8=_[_0x51a0('0x3c')]({},_0xb479d8,_0x17aa2c[_0x51a0('0x45')]);return db['JscriptyProject'][_0x51a0('0x46')](_0xb479d8)[_0x51a0('0x24')](handleEntityNotFound(_0x2583fa,null))[_0x51a0('0x24')](respondWithResult(_0x2583fa,null))[_0x51a0('0x42')](handleError(_0x2583fa,null));};exports[_0x51a0('0x47')]=function(_0x5a25ce,_0x10690d){return db[_0x51a0('0x2c')][_0x51a0('0x47')](_0x5a25ce[_0x51a0('0x48')],{})[_0x51a0('0x24')](function(_0x13bcbe){var _0x3d29f2=_0x5a25ce[_0x51a0('0x49')][_0x51a0('0x4a')]({'plain':!![]});if(!_0x3d29f2)throw new Error(_0x51a0('0x4b'));if(_0x3d29f2[_0x51a0('0x4c')]===_0x51a0('0x49')){var _0x3677a6=_0x13bcbe[_0x51a0('0x4a')]({'plain':!![]});var _0xf2c3bc=_0x51a0('0x25');return db[_0x51a0('0x4d')][_0x51a0('0x46')]({'where':{'name':_0xf2c3bc,'userProfileId':_0x3d29f2[_0x51a0('0x4e')]},'raw':!![]})[_0x51a0('0x24')](function(_0x4dcf12){if(_0x4dcf12&&_0x4dcf12[_0x51a0('0x4f')]===0x0){return db[_0x51a0('0x26')][_0x51a0('0x47')]({'name':_0x3677a6[_0x51a0('0x29')],'resourceId':_0x3677a6['id'],'type':_0x4dcf12[_0x51a0('0x29')],'sectionId':_0x4dcf12['id']},{})[_0x51a0('0x24')](function(){return _0x13bcbe;});}else{return _0x13bcbe;}})[_0x51a0('0x42')](function(_0x4b838e){logger[_0x51a0('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b838e);throw _0x4b838e;});}return _0x13bcbe;})['then'](respondWithResult(_0x10690d,0xc9))[_0x51a0('0x42')](handleError(_0x10690d,null));};exports['clone']=function(_0x53ab81,_0x48a54b){var _0x25485d={'where':{'id':_0x53ab81[_0x51a0('0x50')]['id']}},_0x11b0a0={};_0x11b0a0[_0x51a0('0x33')]=_[_0x51a0('0x44')](db[_0x51a0('0x2c')][_0x51a0('0x2d')]);_0x25485d['attributes']=_[_0x51a0('0x32')](_0x11b0a0[_0x51a0('0x33')],qs[_0x51a0('0x35')](_0x53ab81[_0x51a0('0x31')][_0x51a0('0x35')]));_0x25485d[_0x51a0('0x34')]=_0x25485d[_0x51a0('0x34')][_0x51a0('0x36')]?_0x25485d['attributes']:_0x11b0a0['model'];if(_0x53ab81['query'][_0x51a0('0x3f')]){_0x25485d['include']=[{'all':!![]}];}_0x25485d=_['merge']({},_0x25485d,_0x53ab81[_0x51a0('0x45')]);return db['JscriptyProject'][_0x51a0('0x46')](_0x25485d)[_0x51a0('0x24')](handleEntityNotFound(_0x48a54b,null))['then'](function(_0x5416bf){if(_0x5416bf){var _0x50b339=_0x5416bf[_0x51a0('0x4a')]({'plain':!![]});_0x50b339=qs[_0x51a0('0x51')](_0x50b339,['id',_0x51a0('0x52'),_0x51a0('0x53')]);_0x53ab81['body']=_[_0x51a0('0x51')](_0x53ab81['body'],['id','createdAt',_0x51a0('0x53')]);return db[_0x51a0('0x2c')][_0x51a0('0x47')](_[_0x51a0('0x3c')](_0x50b339,_0x53ab81['body']),{'include':_0x53ab81[_0x51a0('0x31')]['includeAll']?[{'all':!![]}]:undefined})[_0x51a0('0x24')](function(_0x13d549){var _0xa9cc04=_0x53ab81[_0x51a0('0x49')][_0x51a0('0x4a')]({'plain':!![]});if(!_0xa9cc04)throw new Error(_0x51a0('0x4b'));if(_0xa9cc04[_0x51a0('0x4c')]===_0x51a0('0x49')){var _0x2ef0fd=_0x13d549[_0x51a0('0x4a')]({'plain':!![]});var _0x2b4196=_0x51a0('0x25');return db[_0x51a0('0x4d')]['find']({'where':{'name':_0x2b4196,'userProfileId':_0xa9cc04['userProfileId']},'raw':!![]})[_0x51a0('0x24')](function(_0x52d0a8){if(_0x52d0a8&&_0x52d0a8[_0x51a0('0x4f')]===0x0){return db[_0x51a0('0x26')]['create']({'name':_0x2ef0fd[_0x51a0('0x29')],'resourceId':_0x2ef0fd['id'],'type':_0x52d0a8[_0x51a0('0x29')],'sectionId':_0x52d0a8['id']},{})[_0x51a0('0x24')](function(){return _0x13d549;});}else{return _0x13d549;}})['catch'](function(_0x3660a1){logger[_0x51a0('0x27')](_0x51a0('0x54'),_0x3660a1);throw _0x3660a1;});}return _0x13d549;});}})['then'](respondWithResult(_0x48a54b,0xc9))['catch'](handleError(_0x48a54b,null));};exports[_0x51a0('0x55')]=function(_0x19314c,_0x1e373c){if(_0x19314c[_0x51a0('0x48')]['id']){delete _0x19314c['body']['id'];}return db['JscriptyProject'][_0x51a0('0x46')]({'where':{'id':_0x19314c['params']['id']}})[_0x51a0('0x24')](handleEntityNotFound(_0x1e373c,null))[_0x51a0('0x24')](saveUpdates(_0x19314c[_0x51a0('0x48')],null))['then'](respondWithResult(_0x1e373c,null))['catch'](handleError(_0x1e373c,null));};exports['destroy']=function(_0x58309d,_0xc39008){return db[_0x51a0('0x2c')][_0x51a0('0x46')]({'where':{'id':_0x58309d[_0x51a0('0x50')]['id']}})['then'](handleEntityNotFound(_0xc39008,null))['then'](removeEntity(_0xc39008,null))[_0x51a0('0x42')](handleError(_0xc39008,null));};exports[_0x51a0('0x56')]=function(_0x4479b2,_0x43ac24,_0x480a86){var _0xca9d0a={'raw':!![],'where':{}};var _0x565eab={};var _0x33c17c={'count':0x0,'rows':[]};return db[_0x51a0('0x2c')]['findOne']({'where':{'id':_0x4479b2['params']['id']}})[_0x51a0('0x24')](handleEntityNotFound(_0x43ac24,null))[_0x51a0('0x24')](function(_0x3aad25){if(_0x3aad25){_0x565eab[_0x51a0('0x33')]=_[_0x51a0('0x44')](db['JscriptySessionReport']['rawAttributes']);_0x565eab[_0x51a0('0x31')]=_[_0x51a0('0x44')](_0x4479b2[_0x51a0('0x31')]);_0x565eab[_0x51a0('0x3b')]=_[_0x51a0('0x32')](_0x565eab[_0x51a0('0x33')],_0x565eab[_0x51a0('0x31')]);_0xca9d0a[_0x51a0('0x34')]=_[_0x51a0('0x32')](_0x565eab['model'],qs[_0x51a0('0x35')](_0x4479b2[_0x51a0('0x31')][_0x51a0('0x35')]));_0xca9d0a[_0x51a0('0x34')]=_0xca9d0a['attributes'][_0x51a0('0x36')]?_0xca9d0a[_0x51a0('0x34')]:_0x565eab['model'];if(!_0x4479b2[_0x51a0('0x31')]['hasOwnProperty'](_0x51a0('0x37'))){_0xca9d0a['limit']=qs[_0x51a0('0x1b')](_0x4479b2[_0x51a0('0x31')][_0x51a0('0x1b')]);_0xca9d0a[_0x51a0('0x1d')]=qs[_0x51a0('0x1d')](_0x4479b2[_0x51a0('0x31')][_0x51a0('0x1d')]);}_0xca9d0a[_0x51a0('0x38')]=qs[_0x51a0('0x39')](_0x4479b2[_0x51a0('0x31')][_0x51a0('0x39')]);_0xca9d0a['where']=qs[_0x51a0('0x3b')](_['pick'](_0x4479b2['query'],_0x565eab[_0x51a0('0x3b')]));_0xca9d0a['where'][_0x51a0('0x57')]=_0x3aad25['id'];if(_0x4479b2[_0x51a0('0x31')][_0x51a0('0x3e')]){_0xca9d0a['where']=_[_0x51a0('0x3c')](_0xca9d0a['where'],{'$or':_[_0x51a0('0x30')](_0xca9d0a['attributes'],function(_0x19883d){var _0x909ada={};_0x909ada[_0x19883d]={'$like':'%'+_0x4479b2[_0x51a0('0x31')][_0x51a0('0x3e')]+'%'};return _0x909ada;})});}_0xca9d0a=_[_0x51a0('0x3c')]({},_0xca9d0a,_0x4479b2[_0x51a0('0x45')]);return db['JscriptySessionReport'][_0x51a0('0x1c')]({'where':_0xca9d0a[_0x51a0('0x3a')]})[_0x51a0('0x24')](function(_0x349d8e){_0x33c17c[_0x51a0('0x1c')]=_0x349d8e;if(_0x4479b2[_0x51a0('0x31')][_0x51a0('0x3f')]){_0xca9d0a[_0x51a0('0x40')]=[{'all':!![]}];}return db[_0x51a0('0x58')][_0x51a0('0x41')](_0xca9d0a);})[_0x51a0('0x24')](function(_0x2280b6){_0x33c17c[_0x51a0('0x59')]=_0x2280b6;return _0x33c17c;});}})[_0x51a0('0x24')](respondWithFilteredResult(_0x43ac24,_0xca9d0a))[_0x51a0('0x42')](handleError(_0x43ac24,null));};exports[_0x51a0('0x5a')]=function(_0x3264e4,_0x43bb2b,_0x5f30da){var _0x2d5a6e={'raw':!![],'where':{}};var _0x178a3b={};var _0x3aa43c={'count':0x0,'rows':[]};return db[_0x51a0('0x2c')][_0x51a0('0x5b')]({'where':{'id':_0x3264e4[_0x51a0('0x50')]['id']}})[_0x51a0('0x24')](handleEntityNotFound(_0x43bb2b,null))['then'](function(_0x3a3bca){if(_0x3a3bca){_0x178a3b['model']=_[_0x51a0('0x44')](db[_0x51a0('0x5c')][_0x51a0('0x2d')]);_0x178a3b[_0x51a0('0x31')]=_[_0x51a0('0x44')](_0x3264e4[_0x51a0('0x31')]);_0x178a3b[_0x51a0('0x3b')]=_[_0x51a0('0x32')](_0x178a3b[_0x51a0('0x33')],_0x178a3b[_0x51a0('0x31')]);_0x2d5a6e[_0x51a0('0x34')]=_['intersection'](_0x178a3b[_0x51a0('0x33')],qs[_0x51a0('0x35')](_0x3264e4[_0x51a0('0x31')]['fields']));_0x2d5a6e[_0x51a0('0x34')]=_0x2d5a6e['attributes'][_0x51a0('0x36')]?_0x2d5a6e[_0x51a0('0x34')]:_0x178a3b[_0x51a0('0x33')];if(!_0x3264e4[_0x51a0('0x31')][_0x51a0('0x5d')](_0x51a0('0x37'))){_0x2d5a6e[_0x51a0('0x1b')]=qs[_0x51a0('0x1b')](_0x3264e4[_0x51a0('0x31')]['limit']);_0x2d5a6e[_0x51a0('0x1d')]=qs['offset'](_0x3264e4[_0x51a0('0x31')][_0x51a0('0x1d')]);}_0x2d5a6e[_0x51a0('0x38')]=qs[_0x51a0('0x39')](_0x3264e4[_0x51a0('0x31')][_0x51a0('0x39')]);_0x2d5a6e[_0x51a0('0x3a')]=qs['filters'](_['pick'](_0x3264e4[_0x51a0('0x31')],_0x178a3b['filters']));_0x2d5a6e[_0x51a0('0x3a')]['ProjectId']=_0x3a3bca['id'];if(_0x3264e4['query'][_0x51a0('0x3e')]){_0x2d5a6e[_0x51a0('0x3a')]=_['merge'](_0x2d5a6e[_0x51a0('0x3a')],{'$or':_[_0x51a0('0x30')](_0x2d5a6e[_0x51a0('0x34')],function(_0x242659){var _0x2e0ab2={};_0x2e0ab2[_0x242659]={'$like':'%'+_0x3264e4['query'][_0x51a0('0x3e')]+'%'};return _0x2e0ab2;})});}_0x2d5a6e=_['merge']({},_0x2d5a6e,_0x3264e4[_0x51a0('0x45')]);return db['JscriptyAnswerReport'][_0x51a0('0x1c')]({'where':_0x2d5a6e[_0x51a0('0x3a')]})[_0x51a0('0x24')](function(_0x1dbf83){_0x3aa43c['count']=_0x1dbf83;if(_0x3264e4[_0x51a0('0x31')][_0x51a0('0x3f')]){_0x2d5a6e[_0x51a0('0x40')]=[{'all':!![]}];}return db[_0x51a0('0x5c')]['findAll'](_0x2d5a6e);})['then'](function(_0x4ab238){_0x3aa43c[_0x51a0('0x59')]=_0x4ab238;return _0x3aa43c;});}})[_0x51a0('0x24')](respondWithFilteredResult(_0x43bb2b,_0x2d5a6e))[_0x51a0('0x42')](handleError(_0x43bb2b,null));};function char(_0x5d1ae2){return'number'===typeof _0x5d1ae2?String[_0x51a0('0x5e')][_0x51a0('0x22')](null,arguments):_0x5d1ae2;}function needsEncapsulation(_0x210d61){return!!_0x210d61&&(_0x210d61[_0x51a0('0x5f')]()[_0x51a0('0x60')](char(0xd))>=0x0||_0x210d61[_0x51a0('0x5f')]()[_0x51a0('0x60')](char(0xa))>=0x0||_0x210d61[_0x51a0('0x5f')]()[_0x51a0('0x60')](char(0x2c))>=0x0||_0x210d61[_0x51a0('0x5f')]()[_0x51a0('0x60')](char(0x22))>=0x0);}function encapsulate(_0x5f3031){var _0x938fe9=char(0x22),_0x3ff93e='\x5c'+char(0x22),_0x128ac1=_0x5f3031[_0x51a0('0x5f')]()[_0x51a0('0x61')](new RegExp(_0x938fe9,'g'),_0x3ff93e);return _0x938fe9+_0x128ac1+_0x938fe9;}exports[_0x51a0('0x62')]=function(_0x1efbd7,_0x43703b,_0x46c045){var _0x3fc348,_0x5eb1c4;var _0x1172bf={'where':{'ProjectId':_0x1efbd7[_0x51a0('0x50')]['id']}};if(_0x1efbd7[_0x51a0('0x31')][_0x51a0('0x63')]){_0x1172bf['where']['starttime']=JSON['parse'](_0x1efbd7[_0x51a0('0x31')]['startTime']);}return db[_0x51a0('0x58')][_0x51a0('0x41')](_0x1172bf)[_0x51a0('0x24')](handleEntityNotFound(_0x43703b,null))[_0x51a0('0x24')](function(_0x35e740){if(_0x35e740){_0x3fc348=_0x35e740;return db[_0x51a0('0x64')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x3fc348,'id')},'ProjectId':_0x1efbd7[_0x51a0('0x50')]['id']},'order':_0x51a0('0x65')});}})['then'](handleEntityNotFound(_0x43703b,null))[_0x51a0('0x24')](function(_0xdbe9c3){if(_0xdbe9c3){_0x5eb1c4=_0xdbe9c3;var _0x52f910={};for(var _0x1985fb=0x0,_0x1c5361=_0x5eb1c4[_0x51a0('0x36')];_0x1985fb<_0x1c5361;_0x1985fb++){if(!_0x52f910[_0x51a0('0x5d')](_0x5eb1c4[_0x1985fb]['questionId'])){_0x52f910[_0x5eb1c4[_0x1985fb][_0x51a0('0x66')]]=needsEncapsulation(_0x5eb1c4[_0x1985fb][_0x51a0('0x67')])?encapsulate(_0x5eb1c4[_0x1985fb]['question']):_0x5eb1c4[_0x1985fb][_0x51a0('0x67')];}}var _0x534b5a=[],_0x5c97c1={};for(var _0x30820d=0x0,_0x1192e4=_0x3fc348[_0x51a0('0x36')];_0x30820d<_0x1192e4;_0x30820d++){_0x5c97c1={'ProjectId':_0x1efbd7[_0x51a0('0x50')]['id'],'SessionId':_0x3fc348[_0x30820d]['id'],'StartTime':moment(_0x3fc348[_0x30820d][_0x51a0('0x68')])[_0x51a0('0x69')](_0x51a0('0x6a'))};for(var _0x549f3b=0x0,_0x16e11d=_0x5eb1c4['length'];_0x549f3b<_0x16e11d;_0x549f3b++){if(_0x5eb1c4[_0x549f3b][_0x51a0('0x6b')]==_0x3fc348[_0x30820d]['id']&&_0x52f910[_0x51a0('0x5d')](_0x5eb1c4[_0x549f3b][_0x51a0('0x66')])){_0x5c97c1[_0x52f910[_0x5eb1c4[_0x549f3b][_0x51a0('0x66')]]]=_0x5eb1c4[_0x549f3b][_0x51a0('0x6c')];}}for(var _0x4e7e92 in _0x52f910){if(!_0x5c97c1[_0x51a0('0x5d')](_0x52f910[_0x4e7e92])){_0x5c97c1[_0x52f910[_0x4e7e92]]=null;}}_0x534b5a[_0x51a0('0x6d')](_0x5c97c1);}return _0x534b5a;}})[_0x51a0('0x24')](function(_0x3c8c16){if(!_[_0x51a0('0x6e')](_0x3c8c16)){var _0xac0009=toCsv(_0x3c8c16);var _0x4fceee=Date[_0x51a0('0x6f')]();fs['writeFileSync'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1efbd7['params']['id'],_0x4fceee),_0xac0009);_0x43703b[_0x51a0('0x70')](_0x51a0('0x71'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x1efbd7[_0x51a0('0x50')]['id'],_0x4fceee));_0x43703b[_0x51a0('0x70')](_0x51a0('0x72'),'text/csv');return _0x43703b[_0x51a0('0x73')](util[_0x51a0('0x69')](_0x51a0('0x74'),_0x1efbd7[_0x51a0('0x50')]['id'],_0x4fceee));}else{return _0x43703b[_0x51a0('0x18')](0xcc);}})[_0x51a0('0x42')](handleError(_0x43703b,null));}; \ No newline at end of file +var _0x99e7=['apply','reject','save','update','then','get','Projects','UserProfileResource','destroy','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','role','user','userProfileId','clone','createdAt','updatedAt','omit','body','UserProfileSection','autoAssociation','getSessions','JscriptySessionReport','getAnswers','findOne','JscriptyAnswerReport','ProjectId','number','toString','indexOf','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range'];(function(_0x46846e,_0x4138ca){var _0xeb173f=function(_0x3e8619){while(--_0x3e8619){_0x46846e['push'](_0x46846e['shift']());}};_0xeb173f(++_0x4138ca);}(_0x99e7,0x1b5));var _0x799e=function(_0x188703,_0x596b26){_0x188703=_0x188703-0x0;var _0x1a0c81=_0x99e7[_0x188703];return _0x1a0c81;};'use strict';var emlformat=require(_0x799e('0x0'));var rimraf=require(_0x799e('0x1'));var zipdir=require(_0x799e('0x2'));var jsonpatch=require(_0x799e('0x3'));var rp=require(_0x799e('0x4'));var moment=require(_0x799e('0x5'));var BPromise=require(_0x799e('0x6'));var Mustache=require(_0x799e('0x7'));var util=require(_0x799e('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x799e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x799e('0xa'));var _=require('lodash');var squel=require(_0x799e('0xb'));var crypto=require(_0x799e('0xc'));var jsforce=require(_0x799e('0xd'));var deskjs=require(_0x799e('0xe'));var toCsv=require(_0x799e('0x9'));var querystring=require('querystring');var Papa=require(_0x799e('0xf'));var Redis=require(_0x799e('0x10'));var authService=require(_0x799e('0x11'));var qs=require(_0x799e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x799e('0x13'));var logger=require(_0x799e('0x14'))(_0x799e('0x15'));var utils=require(_0x799e('0x16'));var config=require(_0x799e('0x17'));var licenseUtil=require(_0x799e('0x18'));var db=require(_0x799e('0x19'))['db'];function respondWithStatusCode(_0x5238b8,_0x132d57){_0x132d57=_0x132d57||0xcc;return function(_0x1df95c){if(_0x1df95c){return _0x5238b8[_0x799e('0x1a')](_0x132d57);}return _0x5238b8[_0x799e('0x1b')](_0x132d57)[_0x799e('0x1c')]();};}function respondWithResult(_0x1ce347,_0x264b55){_0x264b55=_0x264b55||0xc8;return function(_0x2765e1){if(_0x2765e1){return _0x1ce347[_0x799e('0x1b')](_0x264b55)[_0x799e('0x1d')](_0x2765e1);}};}function respondWithFilteredResult(_0x5a2b6a,_0x5299a8){return function(_0x4267bc){if(_0x4267bc){var _0x41e5a5=typeof _0x5299a8[_0x799e('0x1e')]==='undefined'&&typeof _0x5299a8[_0x799e('0x1f')]===_0x799e('0x20');var _0x340fc6=_0x4267bc[_0x799e('0x21')];var _0x2a1692=_0x41e5a5?0x0:_0x5299a8['offset'];var _0x23cf81=_0x41e5a5?_0x4267bc[_0x799e('0x21')]:_0x5299a8[_0x799e('0x1e')]+_0x5299a8[_0x799e('0x1f')];var _0x4c41b8;if(_0x23cf81>=_0x340fc6){_0x23cf81=_0x340fc6;_0x4c41b8=0xc8;}else{_0x4c41b8=0xce;}_0x5a2b6a[_0x799e('0x1b')](_0x4c41b8);return _0x5a2b6a['set'](_0x799e('0x22'),_0x2a1692+'-'+_0x23cf81+'/'+_0x340fc6)[_0x799e('0x1d')](_0x4267bc);}return null;};}function patchUpdates(_0x42e195){return function(_0x2236aa){try{jsonpatch[_0x799e('0x23')](_0x2236aa,_0x42e195,!![]);}catch(_0x1b3b79){return BPromise[_0x799e('0x24')](_0x1b3b79);}return _0x2236aa[_0x799e('0x25')]();};}function saveUpdates(_0xdeb0ab,_0x11cc93){return function(_0x46375b){if(_0x46375b){return _0x46375b[_0x799e('0x26')](_0xdeb0ab)[_0x799e('0x27')](function(_0x5739e2){return _0x5739e2;});}return null;};}function removeEntity(_0x2c9820,_0x44b3ad){return function(_0x12b64e){if(_0x12b64e){return _0x12b64e['destroy']()['then'](function(){var _0x1255aa=_0x12b64e[_0x799e('0x28')]({'plain':!![]});var _0x441eb2=_0x799e('0x29');return db[_0x799e('0x2a')][_0x799e('0x2b')]({'where':{'type':_0x441eb2,'resourceId':_0x1255aa['id']}})[_0x799e('0x27')](function(){return _0x12b64e;});})[_0x799e('0x27')](function(){_0x2c9820[_0x799e('0x1b')](0xcc)[_0x799e('0x1c')]();});}};}function handleEntityNotFound(_0xde9d3c,_0x367be1){return function(_0x5eb10e){if(!_0x5eb10e){_0xde9d3c[_0x799e('0x1a')](0x194);}return _0x5eb10e;};}function handleError(_0x4b31d5,_0x159c41){_0x159c41=_0x159c41||0x1f4;return function(_0x2a5cf0){logger[_0x799e('0x2c')](_0x2a5cf0['stack']);if(_0x2a5cf0[_0x799e('0x2d')]){delete _0x2a5cf0[_0x799e('0x2d')];}_0x4b31d5[_0x799e('0x1b')](_0x159c41)[_0x799e('0x2e')](_0x2a5cf0);};}exports[_0x799e('0x2f')]=function(_0x2561ce,_0x12ee13){var _0x28ae7e={},_0x87d384={},_0x2ef906={'count':0x0,'rows':[]};var _0x20da53=_[_0x799e('0x30')](db[_0x799e('0x31')][_0x799e('0x32')],function(_0x292027){return{'name':_0x292027[_0x799e('0x33')],'type':_0x292027['type'][_0x799e('0x34')]};});_0x87d384[_0x799e('0x35')]=_[_0x799e('0x30')](_0x20da53,_0x799e('0x2d'));_0x87d384[_0x799e('0x36')]=_[_0x799e('0x37')](_0x2561ce[_0x799e('0x36')]);_0x87d384[_0x799e('0x38')]=_[_0x799e('0x39')](_0x87d384[_0x799e('0x35')],_0x87d384['query']);_0x28ae7e[_0x799e('0x3a')]=_['intersection'](_0x87d384[_0x799e('0x35')],qs[_0x799e('0x3b')](_0x2561ce[_0x799e('0x36')]['fields']));_0x28ae7e[_0x799e('0x3a')]=_0x28ae7e['attributes'][_0x799e('0x3c')]?_0x28ae7e['attributes']:_0x87d384[_0x799e('0x35')];if(!_0x2561ce['query'][_0x799e('0x3d')](_0x799e('0x3e'))){_0x28ae7e[_0x799e('0x1f')]=qs[_0x799e('0x1f')](_0x2561ce['query'][_0x799e('0x1f')]);_0x28ae7e[_0x799e('0x1e')]=qs[_0x799e('0x1e')](_0x2561ce[_0x799e('0x36')]['offset']);}_0x28ae7e[_0x799e('0x3f')]=qs['sort'](_0x2561ce['query'][_0x799e('0x40')]);_0x28ae7e[_0x799e('0x41')]=qs[_0x799e('0x38')](_[_0x799e('0x42')](_0x2561ce[_0x799e('0x36')],_0x87d384[_0x799e('0x38')]),_0x20da53);if(_0x2561ce[_0x799e('0x36')][_0x799e('0x43')]){_0x28ae7e['where']=_[_0x799e('0x44')](_0x28ae7e[_0x799e('0x41')],{'$or':_[_0x799e('0x30')](_0x20da53,function(_0x17fba7){if(_0x17fba7['type']!==_0x799e('0x45')){var _0x4cfb00={};_0x4cfb00[_0x17fba7['name']]={'$like':'%'+_0x2561ce[_0x799e('0x36')]['filter']+'%'};return _0x4cfb00;}})});}_0x28ae7e=_['merge']({},_0x28ae7e,_0x2561ce[_0x799e('0x46')]);var _0x4f5806={'where':_0x28ae7e[_0x799e('0x41')]};return db[_0x799e('0x31')][_0x799e('0x21')](_0x4f5806)['then'](function(_0x4c8d60){_0x2ef906['count']=_0x4c8d60;if(_0x2561ce[_0x799e('0x36')][_0x799e('0x47')]){_0x28ae7e[_0x799e('0x48')]=[{'all':!![]}];}return db[_0x799e('0x31')][_0x799e('0x49')](_0x28ae7e);})[_0x799e('0x27')](function(_0x29920d){_0x2ef906[_0x799e('0x4a')]=_0x29920d;return _0x2ef906;})[_0x799e('0x27')](respondWithFilteredResult(_0x12ee13,_0x28ae7e))[_0x799e('0x4b')](handleError(_0x12ee13,null));};exports[_0x799e('0x4c')]=function(_0xbb5e6d,_0x59dc7c){var _0x53c475={'raw':![],'where':{'id':_0xbb5e6d[_0x799e('0x4d')]['id']}},_0x56bee3={};_0x56bee3['model']=_[_0x799e('0x37')](db['JscriptyProject']['rawAttributes']);_0x56bee3[_0x799e('0x36')]=_[_0x799e('0x37')](_0xbb5e6d[_0x799e('0x36')]);_0x56bee3[_0x799e('0x38')]=_[_0x799e('0x39')](_0x56bee3[_0x799e('0x35')],_0x56bee3[_0x799e('0x36')]);_0x53c475[_0x799e('0x3a')]=_['intersection'](_0x56bee3[_0x799e('0x35')],qs[_0x799e('0x3b')](_0xbb5e6d[_0x799e('0x36')][_0x799e('0x3b')]));_0x53c475[_0x799e('0x3a')]=_0x53c475[_0x799e('0x3a')][_0x799e('0x3c')]?_0x53c475['attributes']:_0x56bee3[_0x799e('0x35')];if(_0xbb5e6d['query'][_0x799e('0x47')]){_0x53c475[_0x799e('0x48')]=[{'all':!![]}];}_0x53c475=_[_0x799e('0x44')]({},_0x53c475,_0xbb5e6d[_0x799e('0x46')]);return db[_0x799e('0x31')][_0x799e('0x4e')](_0x53c475)['then'](handleEntityNotFound(_0x59dc7c,null))[_0x799e('0x27')](respondWithResult(_0x59dc7c,null))[_0x799e('0x4b')](handleError(_0x59dc7c,null));};exports[_0x799e('0x4f')]=function(_0x4ce1a8,_0x4eea8c){return db[_0x799e('0x31')][_0x799e('0x4f')](_0x4ce1a8['body'],{})[_0x799e('0x27')](function(_0x31feec){var _0x46b368=_0x4ce1a8['user']['get']({'plain':!![]});if(!_0x46b368)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46b368[_0x799e('0x50')]===_0x799e('0x51')){var _0x134f6d=_0x31feec['get']({'plain':!![]});var _0x580f3c=_0x799e('0x29');return db['UserProfileSection'][_0x799e('0x4e')]({'where':{'name':_0x580f3c,'userProfileId':_0x46b368[_0x799e('0x52')]},'raw':!![]})[_0x799e('0x27')](function(_0x12be45){if(_0x12be45&&_0x12be45['autoAssociation']===0x0){return db[_0x799e('0x2a')]['create']({'name':_0x134f6d['name'],'resourceId':_0x134f6d['id'],'type':_0x12be45[_0x799e('0x2d')],'sectionId':_0x12be45['id']},{})['then'](function(){return _0x31feec;});}else{return _0x31feec;}})[_0x799e('0x4b')](function(_0x41fb99){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41fb99);throw _0x41fb99;});}return _0x31feec;})[_0x799e('0x27')](respondWithResult(_0x4eea8c,0xc9))[_0x799e('0x4b')](handleError(_0x4eea8c,null));};exports[_0x799e('0x53')]=function(_0xd09d38,_0x3d66b4){var _0x289823={'where':{'id':_0xd09d38[_0x799e('0x4d')]['id']}},_0x51870f={};_0x51870f[_0x799e('0x35')]=_['keys'](db[_0x799e('0x31')]['rawAttributes']);_0x289823[_0x799e('0x3a')]=_[_0x799e('0x39')](_0x51870f['model'],qs[_0x799e('0x3b')](_0xd09d38[_0x799e('0x36')][_0x799e('0x3b')]));_0x289823[_0x799e('0x3a')]=_0x289823[_0x799e('0x3a')][_0x799e('0x3c')]?_0x289823[_0x799e('0x3a')]:_0x51870f[_0x799e('0x35')];if(_0xd09d38[_0x799e('0x36')][_0x799e('0x47')]){_0x289823[_0x799e('0x48')]=[{'all':!![]}];}_0x289823=_[_0x799e('0x44')]({},_0x289823,_0xd09d38[_0x799e('0x46')]);return db[_0x799e('0x31')]['find'](_0x289823)['then'](handleEntityNotFound(_0x3d66b4,null))[_0x799e('0x27')](function(_0x27b9e9){if(_0x27b9e9){var _0x2ca0fe=_0x27b9e9[_0x799e('0x28')]({'plain':!![]});_0x2ca0fe=qs['omit'](_0x2ca0fe,['id',_0x799e('0x54'),_0x799e('0x55')]);_0xd09d38['body']=_[_0x799e('0x56')](_0xd09d38['body'],['id',_0x799e('0x54'),_0x799e('0x55')]);return db[_0x799e('0x31')]['create'](_[_0x799e('0x44')](_0x2ca0fe,_0xd09d38[_0x799e('0x57')]),{'include':_0xd09d38[_0x799e('0x36')][_0x799e('0x47')]?[{'all':!![]}]:undefined})[_0x799e('0x27')](function(_0x1b8c7c){var _0x90f3dd=_0xd09d38['user'][_0x799e('0x28')]({'plain':!![]});if(!_0x90f3dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x90f3dd['role']===_0x799e('0x51')){var _0x2be7c0=_0x1b8c7c[_0x799e('0x28')]({'plain':!![]});var _0x1b394c='Projects';return db[_0x799e('0x58')][_0x799e('0x4e')]({'where':{'name':_0x1b394c,'userProfileId':_0x90f3dd['userProfileId']},'raw':!![]})[_0x799e('0x27')](function(_0x588331){if(_0x588331&&_0x588331[_0x799e('0x59')]===0x0){return db[_0x799e('0x2a')][_0x799e('0x4f')]({'name':_0x2be7c0['name'],'resourceId':_0x2be7c0['id'],'type':_0x588331['name'],'sectionId':_0x588331['id']},{})[_0x799e('0x27')](function(){return _0x1b8c7c;});}else{return _0x1b8c7c;}})['catch'](function(_0x2cc1fc){logger[_0x799e('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cc1fc);throw _0x2cc1fc;});}return _0x1b8c7c;});}})['then'](respondWithResult(_0x3d66b4,0xc9))[_0x799e('0x4b')](handleError(_0x3d66b4,null));};exports[_0x799e('0x26')]=function(_0x26dc1f,_0x419a84){if(_0x26dc1f[_0x799e('0x57')]['id']){delete _0x26dc1f['body']['id'];}return db[_0x799e('0x31')][_0x799e('0x4e')]({'where':{'id':_0x26dc1f[_0x799e('0x4d')]['id']}})[_0x799e('0x27')](handleEntityNotFound(_0x419a84,null))[_0x799e('0x27')](saveUpdates(_0x26dc1f[_0x799e('0x57')],null))[_0x799e('0x27')](respondWithResult(_0x419a84,null))[_0x799e('0x4b')](handleError(_0x419a84,null));};exports[_0x799e('0x2b')]=function(_0x2f85c9,_0x302369){return db[_0x799e('0x31')][_0x799e('0x4e')]({'where':{'id':_0x2f85c9['params']['id']}})[_0x799e('0x27')](handleEntityNotFound(_0x302369,null))['then'](removeEntity(_0x302369,null))[_0x799e('0x4b')](handleError(_0x302369,null));};exports[_0x799e('0x5a')]=function(_0x428884,_0x4f2332,_0x502bde){var _0x1d4e7e={'raw':!![],'where':{}};var _0x2ee759={};var _0x5df793={'count':0x0,'rows':[]};return db[_0x799e('0x31')]['findOne']({'where':{'id':_0x428884[_0x799e('0x4d')]['id']}})[_0x799e('0x27')](handleEntityNotFound(_0x4f2332,null))[_0x799e('0x27')](function(_0x47ded8){if(_0x47ded8){_0x2ee759[_0x799e('0x35')]=_[_0x799e('0x37')](db[_0x799e('0x5b')][_0x799e('0x32')]);_0x2ee759[_0x799e('0x36')]=_['keys'](_0x428884['query']);_0x2ee759[_0x799e('0x38')]=_['intersection'](_0x2ee759[_0x799e('0x35')],_0x2ee759[_0x799e('0x36')]);_0x1d4e7e['attributes']=_[_0x799e('0x39')](_0x2ee759[_0x799e('0x35')],qs[_0x799e('0x3b')](_0x428884[_0x799e('0x36')][_0x799e('0x3b')]));_0x1d4e7e[_0x799e('0x3a')]=_0x1d4e7e[_0x799e('0x3a')][_0x799e('0x3c')]?_0x1d4e7e['attributes']:_0x2ee759[_0x799e('0x35')];if(!_0x428884['query'][_0x799e('0x3d')](_0x799e('0x3e'))){_0x1d4e7e[_0x799e('0x1f')]=qs['limit'](_0x428884[_0x799e('0x36')]['limit']);_0x1d4e7e[_0x799e('0x1e')]=qs[_0x799e('0x1e')](_0x428884[_0x799e('0x36')][_0x799e('0x1e')]);}_0x1d4e7e[_0x799e('0x3f')]=qs[_0x799e('0x40')](_0x428884['query'][_0x799e('0x40')]);_0x1d4e7e[_0x799e('0x41')]=qs[_0x799e('0x38')](_[_0x799e('0x42')](_0x428884[_0x799e('0x36')],_0x2ee759[_0x799e('0x38')]));_0x1d4e7e[_0x799e('0x41')]['ProjectId']=_0x47ded8['id'];if(_0x428884['query'][_0x799e('0x43')]){_0x1d4e7e[_0x799e('0x41')]=_[_0x799e('0x44')](_0x1d4e7e['where'],{'$or':_[_0x799e('0x30')](_0x1d4e7e[_0x799e('0x3a')],function(_0x8729f8){var _0x3fc860={};_0x3fc860[_0x8729f8]={'$like':'%'+_0x428884[_0x799e('0x36')]['filter']+'%'};return _0x3fc860;})});}_0x1d4e7e=_[_0x799e('0x44')]({},_0x1d4e7e,_0x428884[_0x799e('0x46')]);return db[_0x799e('0x5b')][_0x799e('0x21')]({'where':_0x1d4e7e[_0x799e('0x41')]})[_0x799e('0x27')](function(_0x208fea){_0x5df793[_0x799e('0x21')]=_0x208fea;if(_0x428884[_0x799e('0x36')][_0x799e('0x47')]){_0x1d4e7e[_0x799e('0x48')]=[{'all':!![]}];}return db[_0x799e('0x5b')][_0x799e('0x49')](_0x1d4e7e);})[_0x799e('0x27')](function(_0x2ad4da){_0x5df793[_0x799e('0x4a')]=_0x2ad4da;return _0x5df793;});}})['then'](respondWithFilteredResult(_0x4f2332,_0x1d4e7e))[_0x799e('0x4b')](handleError(_0x4f2332,null));};exports[_0x799e('0x5c')]=function(_0x14cf71,_0x50ce71,_0x26b9bd){var _0x3cba86={'raw':!![],'where':{}};var _0x4ae4f2={};var _0x23149f={'count':0x0,'rows':[]};return db[_0x799e('0x31')][_0x799e('0x5d')]({'where':{'id':_0x14cf71[_0x799e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x50ce71,null))['then'](function(_0x17c901){if(_0x17c901){_0x4ae4f2[_0x799e('0x35')]=_[_0x799e('0x37')](db[_0x799e('0x5e')]['rawAttributes']);_0x4ae4f2[_0x799e('0x36')]=_[_0x799e('0x37')](_0x14cf71[_0x799e('0x36')]);_0x4ae4f2['filters']=_[_0x799e('0x39')](_0x4ae4f2[_0x799e('0x35')],_0x4ae4f2['query']);_0x3cba86[_0x799e('0x3a')]=_[_0x799e('0x39')](_0x4ae4f2['model'],qs[_0x799e('0x3b')](_0x14cf71[_0x799e('0x36')][_0x799e('0x3b')]));_0x3cba86['attributes']=_0x3cba86['attributes']['length']?_0x3cba86[_0x799e('0x3a')]:_0x4ae4f2[_0x799e('0x35')];if(!_0x14cf71[_0x799e('0x36')]['hasOwnProperty']('nolimit')){_0x3cba86['limit']=qs[_0x799e('0x1f')](_0x14cf71[_0x799e('0x36')][_0x799e('0x1f')]);_0x3cba86['offset']=qs['offset'](_0x14cf71[_0x799e('0x36')]['offset']);}_0x3cba86['order']=qs['sort'](_0x14cf71['query'][_0x799e('0x40')]);_0x3cba86[_0x799e('0x41')]=qs[_0x799e('0x38')](_['pick'](_0x14cf71[_0x799e('0x36')],_0x4ae4f2['filters']));_0x3cba86[_0x799e('0x41')][_0x799e('0x5f')]=_0x17c901['id'];if(_0x14cf71[_0x799e('0x36')][_0x799e('0x43')]){_0x3cba86[_0x799e('0x41')]=_[_0x799e('0x44')](_0x3cba86[_0x799e('0x41')],{'$or':_[_0x799e('0x30')](_0x3cba86['attributes'],function(_0x2f3e59){var _0x5d43e3={};_0x5d43e3[_0x2f3e59]={'$like':'%'+_0x14cf71[_0x799e('0x36')][_0x799e('0x43')]+'%'};return _0x5d43e3;})});}_0x3cba86=_[_0x799e('0x44')]({},_0x3cba86,_0x14cf71[_0x799e('0x46')]);return db[_0x799e('0x5e')][_0x799e('0x21')]({'where':_0x3cba86[_0x799e('0x41')]})['then'](function(_0x3b9ddb){_0x23149f[_0x799e('0x21')]=_0x3b9ddb;if(_0x14cf71[_0x799e('0x36')][_0x799e('0x47')]){_0x3cba86[_0x799e('0x48')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x799e('0x49')](_0x3cba86);})['then'](function(_0x3f446c){_0x23149f[_0x799e('0x4a')]=_0x3f446c;return _0x23149f;});}})[_0x799e('0x27')](respondWithFilteredResult(_0x50ce71,_0x3cba86))['catch'](handleError(_0x50ce71,null));};function char(_0x34d4a8){return _0x799e('0x60')===typeof _0x34d4a8?String['fromCharCode'][_0x799e('0x23')](null,arguments):_0x34d4a8;}function needsEncapsulation(_0x7c7616){return!!_0x7c7616&&(_0x7c7616[_0x799e('0x61')]()[_0x799e('0x62')](char(0xd))>=0x0||_0x7c7616[_0x799e('0x61')]()[_0x799e('0x62')](char(0xa))>=0x0||_0x7c7616['toString']()[_0x799e('0x62')](char(0x2c))>=0x0||_0x7c7616[_0x799e('0x61')]()[_0x799e('0x62')](char(0x22))>=0x0);}function encapsulate(_0x269867){var _0x57fd80=char(0x22),_0xe78fbb='\x5c'+char(0x22),_0x431565=_0x269867[_0x799e('0x61')]()['replace'](new RegExp(_0x57fd80,'g'),_0xe78fbb);return _0x57fd80+_0x431565+_0x57fd80;}exports[_0x799e('0x63')]=function(_0x5cb5dc,_0x4aa3a0,_0x3cc40f){var _0x5966ed,_0x47af7f;var _0x19ab84={'where':{'ProjectId':_0x5cb5dc[_0x799e('0x4d')]['id']}};if(_0x5cb5dc['query']['startTime']){_0x19ab84['where'][_0x799e('0x64')]=JSON[_0x799e('0x65')](_0x5cb5dc[_0x799e('0x36')][_0x799e('0x66')]);}return db['JscriptySessionReport'][_0x799e('0x49')](_0x19ab84)[_0x799e('0x27')](handleEntityNotFound(_0x4aa3a0,null))[_0x799e('0x27')](function(_0x58487b){if(_0x58487b){_0x5966ed=_0x58487b;return db[_0x799e('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0x799e('0x30')](_0x5966ed,'id')},'ProjectId':_0x5cb5dc['params']['id']},'order':_0x799e('0x68')});}})[_0x799e('0x27')](handleEntityNotFound(_0x4aa3a0,null))[_0x799e('0x27')](function(_0x4d36d4){if(_0x4d36d4){_0x47af7f=_0x4d36d4;var _0x43f987={};for(var _0x5d1d99=0x0,_0x32dc86=_0x47af7f[_0x799e('0x3c')];_0x5d1d99<_0x32dc86;_0x5d1d99++){if(!_0x43f987[_0x799e('0x3d')](_0x47af7f[_0x5d1d99][_0x799e('0x69')])){_0x43f987[_0x47af7f[_0x5d1d99]['questionId']]=needsEncapsulation(_0x47af7f[_0x5d1d99][_0x799e('0x6a')])?encapsulate(_0x47af7f[_0x5d1d99][_0x799e('0x6a')]):_0x47af7f[_0x5d1d99][_0x799e('0x6a')];}}var _0xc0fe76=[],_0x584b6e={};for(var _0xef733d=0x0,_0x51b390=_0x5966ed[_0x799e('0x3c')];_0xef733d<_0x51b390;_0xef733d++){_0x584b6e={'ProjectId':_0x5cb5dc['params']['id'],'SessionId':_0x5966ed[_0xef733d]['id'],'StartTime':moment(_0x5966ed[_0xef733d]['starttime'])[_0x799e('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3f68a4=0x0,_0x16a8a2=_0x47af7f[_0x799e('0x3c')];_0x3f68a4<_0x16a8a2;_0x3f68a4++){if(_0x47af7f[_0x3f68a4][_0x799e('0x6c')]==_0x5966ed[_0xef733d]['id']&&_0x43f987[_0x799e('0x3d')](_0x47af7f[_0x3f68a4][_0x799e('0x69')])){_0x584b6e[_0x43f987[_0x47af7f[_0x3f68a4][_0x799e('0x69')]]]=_0x47af7f[_0x3f68a4][_0x799e('0x6d')];}}for(var _0x586e2f in _0x43f987){if(!_0x584b6e[_0x799e('0x3d')](_0x43f987[_0x586e2f])){_0x584b6e[_0x43f987[_0x586e2f]]=null;}}_0xc0fe76[_0x799e('0x6e')](_0x584b6e);}return _0xc0fe76;}})['then'](function(_0x3a465f){if(!_['isEmpty'](_0x3a465f)){var _0xb472ac=toCsv(_0x3a465f);var _0xabfd35=Date[_0x799e('0x6f')]();fs['writeFileSync'](util['format'](_0x799e('0x70'),_0x5cb5dc[_0x799e('0x4d')]['id'],_0xabfd35),_0xb472ac);_0x4aa3a0['setHeader'](_0x799e('0x71'),_0x799e('0x72')+util[_0x799e('0x6b')](_0x799e('0x73'),_0x5cb5dc[_0x799e('0x4d')]['id'],_0xabfd35));_0x4aa3a0['setHeader'](_0x799e('0x74'),'text/csv');return _0x4aa3a0[_0x799e('0x75')](util['format'](_0x799e('0x70'),_0x5cb5dc[_0x799e('0x4d')]['id'],_0xabfd35));}else{return _0x4aa3a0[_0x799e('0x1a')](0xcc);}})[_0x799e('0x4b')](handleError(_0x4aa3a0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index b345d73..a10f83b 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 _0x4d61=['./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x19cd5e,_0x79d45d){var _0x21f6be=function(_0x24ea0b){while(--_0x24ea0b){_0x19cd5e['push'](_0x19cd5e['shift']());}};_0x21f6be(++_0x79d45d);}(_0x4d61,0x147));var _0x14d6=function(_0x539cf6,_0x7466a2){_0x539cf6=_0x539cf6-0x0;var _0x4216b8=_0x4d61[_0x539cf6];return _0x4216b8;};'use strict';var _=require(_0x14d6('0x0'));var util=require(_0x14d6('0x1'));var logger=require(_0x14d6('0x2'))(_0x14d6('0x3'));var moment=require(_0x14d6('0x4'));var BPromise=require(_0x14d6('0x5'));var rp=require(_0x14d6('0x6'));var fs=require('fs');var path=require(_0x14d6('0x7'));var rimraf=require(_0x14d6('0x8'));var config=require('../../config/environment');var attributes=require(_0x14d6('0x9'));module[_0x14d6('0xa')]=function(_0x2920fe,_0x11b2c0){return _0x2920fe[_0x14d6('0xb')](_0x14d6('0xc'),attributes,{'tableName':_0x14d6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f42=['bluebird','path','../../config/environment','exports','define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0x7f42,0x1dd));var _0x27f4=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7f42[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x27f4('0x0'));var util=require('util');var logger=require(_0x27f4('0x1'))(_0x27f4('0x2'));var moment=require('moment');var BPromise=require(_0x27f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27f4('0x4'));var rimraf=require('rimraf');var config=require(_0x27f4('0x5'));var attributes=require('./jscriptyProject.attributes');module[_0x27f4('0x6')]=function(_0x5c9286,_0x256ac9){return _0x5c9286[_0x27f4('0x7')](_0x27f4('0x8'),attributes,{'tableName':_0x27f4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index eda34ac..9ac25e5 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(_0x31b53f,_0x26cced){var _0x395050=function(_0x3d5eb9){while(--_0x3d5eb9){_0x31b53f['push'](_0x31b53f['shift']());}};_0x395050(++_0x26cced);}(_0x70e0,0x17b));var _0x070e=function(_0x2cb0d3,_0x5699a8){_0x2cb0d3=_0x2cb0d3-0x0;var _0x2d1a62=_0x70e0[_0x2cb0d3];return _0x2d1a62;};'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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x5cd7a7,_0x34db3d){var _0x51dfa7=function(_0x2214a2){while(--_0x2214a2){_0x5cd7a7['push'](_0x5cd7a7['shift']());}};_0x51dfa7(++_0x34db3d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x21ac69,_0x2c4cf7){_0x21ac69=_0x21ac69-0x0;var _0x5c5487=_0xb43b[_0x21ac69];return _0x5c5487;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 1f44e44..da18bcb 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 _0x6b21=['./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x33b986,_0x40da5f){var _0x4ddaca=function(_0x27cd7a){while(--_0x27cd7a){_0x33b986['push'](_0x33b986['shift']());}};_0x4ddaca(++_0x40da5f);}(_0x6b21,0x156));var _0x16b2=function(_0x4ad947,_0x528c8d){_0x4ad947=_0x4ad947-0x0;var _0x45a249=_0x6b21[_0x4ad947];return _0x45a249;};'use strict';var multer=require(_0x16b2('0x0'));var util=require(_0x16b2('0x1'));var path=require(_0x16b2('0x2'));var timeout=require(_0x16b2('0x3'));var express=require(_0x16b2('0x4'));var router=express[_0x16b2('0x5')]();var fs_extra=require(_0x16b2('0x6'));var auth=require(_0x16b2('0x7'));var interaction=require(_0x16b2('0x8'));var config=require(_0x16b2('0x9'));var controller=require(_0x16b2('0xa'));router[_0x16b2('0xb')]('/',auth[_0x16b2('0xc')](),controller[_0x16b2('0xd')]);router[_0x16b2('0xb')](_0x16b2('0xe'),auth[_0x16b2('0xc')](),controller['describe']);router[_0x16b2('0xb')](_0x16b2('0xf'),auth['isAuthenticated'](),controller[_0x16b2('0x10')]);router[_0x16b2('0x11')]('/',auth['isAuthenticated'](),controller[_0x16b2('0x12')]);router[_0x16b2('0x13')](_0x16b2('0xf'),auth['isAuthenticated'](),controller[_0x16b2('0x14')]);router[_0x16b2('0x15')](_0x16b2('0xf'),auth[_0x16b2('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe26c=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x1d145f,_0x2f8571){var _0x568551=function(_0x1e52e7){while(--_0x1e52e7){_0x1d145f['push'](_0x1d145f['shift']());}};_0x568551(++_0x2f8571);}(_0xe26c,0x18c));var _0xce26=function(_0x299016,_0x55298c){_0x299016=_0x299016-0x0;var _0xb6b375=_0xe26c[_0x299016];return _0xb6b375;};'use strict';var multer=require(_0xce26('0x0'));var util=require(_0xce26('0x1'));var path=require('path');var timeout=require(_0xce26('0x2'));var express=require(_0xce26('0x3'));var router=express[_0xce26('0x4')]();var fs_extra=require(_0xce26('0x5'));var auth=require(_0xce26('0x6'));var interaction=require(_0xce26('0x7'));var config=require('../../config/environment');var controller=require(_0xce26('0x8'));router['get']('/',auth[_0xce26('0x9')](),controller[_0xce26('0xa')]);router[_0xce26('0xb')](_0xce26('0xc'),auth[_0xce26('0x9')](),controller[_0xce26('0xd')]);router[_0xce26('0xb')](_0xce26('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xce26('0xf')]('/',auth[_0xce26('0x9')](),controller[_0xce26('0x10')]);router[_0xce26('0x11')](_0xce26('0xe'),auth[_0xce26('0x9')](),controller[_0xce26('0x12')]);router[_0xce26('0x13')](_0xce26('0xe'),auth[_0xce26('0x9')](),controller[_0xce26('0x14')]);module[_0xce26('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 81af524..48aa7a1 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a54,0x106));var _0x47a5=function(_0x2e4cf6,_0x4fadf4){_0x2e4cf6=_0x2e4cf6-0x0;var _0x5cf41a=_0x7a54[_0x2e4cf6];return _0x5cf41a;};'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(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x7a54,0x106));var _0x47a5=function(_0x2e6d1a,_0x3dbc43){_0x2e6d1a=_0x2e6d1a-0x0;var _0x5eaea1=_0x7a54[_0x2e6d1a];return _0x5eaea1;};'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 0d9e113..52d9e4e 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 _0x2b20=['length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','JscriptyQuestionReport','findAll','rows','show','params','keys','rawAttributes','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','fieldName','model','query','intersection','attributes','fields'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x2b20,0xb3));var _0x02b2=function(_0x885754,_0x1894eb){_0x885754=_0x885754-0x0;var _0x14c93a=_0x2b20[_0x885754];return _0x14c93a;};'use strict';var emlformat=require(_0x02b2('0x0'));var rimraf=require(_0x02b2('0x1'));var zipdir=require(_0x02b2('0x2'));var jsonpatch=require(_0x02b2('0x3'));var rp=require(_0x02b2('0x4'));var moment=require(_0x02b2('0x5'));var BPromise=require(_0x02b2('0x6'));var Mustache=require('mustache');var util=require(_0x02b2('0x7'));var path=require(_0x02b2('0x8'));var sox=require(_0x02b2('0x9'));var csv=require(_0x02b2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x02b2('0xb'));var _=require(_0x02b2('0xc'));var squel=require('squel');var crypto=require(_0x02b2('0xd'));var jsforce=require(_0x02b2('0xe'));var deskjs=require(_0x02b2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x02b2('0x10'));var Papa=require(_0x02b2('0x11'));var Redis=require('ioredis');var authService=require(_0x02b2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x02b2('0x13'));var hardwareService=require(_0x02b2('0x14'));var logger=require(_0x02b2('0x15'))(_0x02b2('0x16'));var utils=require(_0x02b2('0x17'));var config=require(_0x02b2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x02b2('0x19'))['db'];function respondWithStatusCode(_0x1000a8,_0x4282e5){_0x4282e5=_0x4282e5||0xcc;return function(_0x562ccb){if(_0x562ccb){return _0x1000a8[_0x02b2('0x1a')](_0x4282e5);}return _0x1000a8[_0x02b2('0x1b')](_0x4282e5)[_0x02b2('0x1c')]();};}function respondWithResult(_0x523851,_0x264cb2){_0x264cb2=_0x264cb2||0xc8;return function(_0x5209ed){if(_0x5209ed){return _0x523851[_0x02b2('0x1b')](_0x264cb2)['json'](_0x5209ed);}};}function respondWithFilteredResult(_0x2cb9da,_0x2ed8d3){return function(_0x1ca434){if(_0x1ca434){var _0x43bd8a=typeof _0x2ed8d3[_0x02b2('0x1d')]===_0x02b2('0x1e')&&typeof _0x2ed8d3[_0x02b2('0x1f')]===_0x02b2('0x1e');var _0x4f5139=_0x1ca434['count'];var _0x151b68=_0x43bd8a?0x0:_0x2ed8d3['offset'];var _0x249573=_0x43bd8a?_0x1ca434[_0x02b2('0x20')]:_0x2ed8d3[_0x02b2('0x1d')]+_0x2ed8d3[_0x02b2('0x1f')];var _0x3c921a;if(_0x249573>=_0x4f5139){_0x249573=_0x4f5139;_0x3c921a=0xc8;}else{_0x3c921a=0xce;}_0x2cb9da['status'](_0x3c921a);return _0x2cb9da[_0x02b2('0x21')](_0x02b2('0x22'),_0x151b68+'-'+_0x249573+'/'+_0x4f5139)['json'](_0x1ca434);}return null;};}function patchUpdates(_0x23531c){return function(_0x52278f){try{jsonpatch[_0x02b2('0x23')](_0x52278f,_0x23531c,!![]);}catch(_0x5c392d){return BPromise[_0x02b2('0x24')](_0x5c392d);}return _0x52278f[_0x02b2('0x25')]();};}function saveUpdates(_0x368b60,_0x3b9785){return function(_0x573016){if(_0x573016){return _0x573016[_0x02b2('0x26')](_0x368b60)[_0x02b2('0x27')](function(_0x4e05e2){return _0x4e05e2;});}return null;};}function removeEntity(_0x53fd86,_0x1010be){return function(_0x3ee3fa){if(_0x3ee3fa){return _0x3ee3fa[_0x02b2('0x28')]()[_0x02b2('0x27')](function(){_0x53fd86['status'](0xcc)[_0x02b2('0x1c')]();});}};}function handleEntityNotFound(_0xadbb0,_0x56974a){return function(_0x3b311c){if(!_0x3b311c){_0xadbb0[_0x02b2('0x1a')](0x194);}return _0x3b311c;};}function handleError(_0x37f16b,_0x44bbd6){_0x44bbd6=_0x44bbd6||0x1f4;return function(_0x3b6037){logger[_0x02b2('0x29')](_0x3b6037['stack']);if(_0x3b6037[_0x02b2('0x2a')]){delete _0x3b6037[_0x02b2('0x2a')];}_0x37f16b['status'](_0x44bbd6)[_0x02b2('0x2b')](_0x3b6037);};}exports[_0x02b2('0x2c')]=function(_0x23751d,_0x2f7b4d){var _0x46cda6={},_0x3c4a27={},_0x1827f2={'count':0x0,'rows':[]};var _0x4a3b87=_[_0x02b2('0x2d')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x3996e0){return{'name':_0x3996e0[_0x02b2('0x2e')],'type':_0x3996e0['type']['key']};});_0x3c4a27[_0x02b2('0x2f')]=_[_0x02b2('0x2d')](_0x4a3b87,_0x02b2('0x2a'));_0x3c4a27['query']=_['keys'](_0x23751d[_0x02b2('0x30')]);_0x3c4a27['filters']=_[_0x02b2('0x31')](_0x3c4a27[_0x02b2('0x2f')],_0x3c4a27[_0x02b2('0x30')]);_0x46cda6[_0x02b2('0x32')]=_[_0x02b2('0x31')](_0x3c4a27['model'],qs['fields'](_0x23751d['query'][_0x02b2('0x33')]));_0x46cda6[_0x02b2('0x32')]=_0x46cda6['attributes'][_0x02b2('0x34')]?_0x46cda6[_0x02b2('0x32')]:_0x3c4a27[_0x02b2('0x2f')];if(!_0x23751d[_0x02b2('0x30')][_0x02b2('0x35')](_0x02b2('0x36'))){_0x46cda6['limit']=qs[_0x02b2('0x1f')](_0x23751d['query'][_0x02b2('0x1f')]);_0x46cda6[_0x02b2('0x1d')]=qs[_0x02b2('0x1d')](_0x23751d['query']['offset']);}_0x46cda6[_0x02b2('0x37')]=qs[_0x02b2('0x38')](_0x23751d[_0x02b2('0x30')]['sort']);_0x46cda6[_0x02b2('0x39')]=qs[_0x02b2('0x3a')](_[_0x02b2('0x3b')](_0x23751d[_0x02b2('0x30')],_0x3c4a27[_0x02b2('0x3a')]),_0x4a3b87);if(_0x23751d[_0x02b2('0x30')][_0x02b2('0x3c')]){_0x46cda6[_0x02b2('0x39')]=_[_0x02b2('0x3d')](_0x46cda6[_0x02b2('0x39')],{'$or':_[_0x02b2('0x2d')](_0x4a3b87,function(_0x1e700){if(_0x1e700[_0x02b2('0x3e')]!==_0x02b2('0x3f')){var _0x1eac50={};_0x1eac50[_0x1e700[_0x02b2('0x2a')]]={'$like':'%'+_0x23751d[_0x02b2('0x30')]['filter']+'%'};return _0x1eac50;}})});}_0x46cda6=_[_0x02b2('0x3d')]({},_0x46cda6,_0x23751d['options']);var _0x4c2e96={'where':_0x46cda6[_0x02b2('0x39')]};return db[_0x02b2('0x40')][_0x02b2('0x20')](_0x4c2e96)[_0x02b2('0x27')](function(_0x436f57){_0x1827f2['count']=_0x436f57;if(_0x23751d['query']['includeAll']){_0x46cda6['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x02b2('0x41')](_0x46cda6);})['then'](function(_0x44164d){_0x1827f2[_0x02b2('0x42')]=_0x44164d;return _0x1827f2;})['then'](respondWithFilteredResult(_0x2f7b4d,_0x46cda6))['catch'](handleError(_0x2f7b4d,null));};exports[_0x02b2('0x43')]=function(_0x2f0944,_0x1a362f){var _0x65432d={'raw':!![],'where':{'id':_0x2f0944[_0x02b2('0x44')]['id']}},_0x2cae02={};_0x2cae02[_0x02b2('0x2f')]=_[_0x02b2('0x45')](db['JscriptyQuestionReport'][_0x02b2('0x46')]);_0x2cae02['query']=_[_0x02b2('0x45')](_0x2f0944['query']);_0x2cae02[_0x02b2('0x3a')]=_[_0x02b2('0x31')](_0x2cae02['model'],_0x2cae02[_0x02b2('0x30')]);_0x65432d[_0x02b2('0x32')]=_[_0x02b2('0x31')](_0x2cae02[_0x02b2('0x2f')],qs[_0x02b2('0x33')](_0x2f0944[_0x02b2('0x30')]['fields']));_0x65432d['attributes']=_0x65432d[_0x02b2('0x32')][_0x02b2('0x34')]?_0x65432d[_0x02b2('0x32')]:_0x2cae02[_0x02b2('0x2f')];if(_0x2f0944[_0x02b2('0x30')]['includeAll']){_0x65432d['include']=[{'all':!![]}];}_0x65432d=_[_0x02b2('0x3d')]({},_0x65432d,_0x2f0944[_0x02b2('0x47')]);return db[_0x02b2('0x40')][_0x02b2('0x48')](_0x65432d)[_0x02b2('0x27')](handleEntityNotFound(_0x1a362f,null))['then'](respondWithResult(_0x1a362f,null))[_0x02b2('0x49')](handleError(_0x1a362f,null));};exports['create']=function(_0x99e01a,_0x5b4e64){return db['JscriptyQuestionReport'][_0x02b2('0x4a')](_0x99e01a[_0x02b2('0x4b')],{})[_0x02b2('0x27')](respondWithResult(_0x5b4e64,0xc9))[_0x02b2('0x49')](handleError(_0x5b4e64,null));};exports[_0x02b2('0x26')]=function(_0x936a0a,_0x4abf54){if(_0x936a0a[_0x02b2('0x4b')]['id']){delete _0x936a0a[_0x02b2('0x4b')]['id'];}return db[_0x02b2('0x40')]['find']({'where':{'id':_0x936a0a[_0x02b2('0x44')]['id']}})[_0x02b2('0x27')](handleEntityNotFound(_0x4abf54,null))[_0x02b2('0x27')](saveUpdates(_0x936a0a[_0x02b2('0x4b')],null))[_0x02b2('0x27')](respondWithResult(_0x4abf54,null))[_0x02b2('0x49')](handleError(_0x4abf54,null));};exports[_0x02b2('0x28')]=function(_0x13032b,_0x3bbb02){return db[_0x02b2('0x40')][_0x02b2('0x48')]({'where':{'id':_0x13032b['params']['id']}})[_0x02b2('0x27')](handleEntityNotFound(_0x3bbb02,null))[_0x02b2('0x27')](removeEntity(_0x3bbb02,null))[_0x02b2('0x49')](handleError(_0x3bbb02,null));};exports['describe']=function(_0x1009b7,_0x50f1a7){return db['JscriptyQuestionReport'][_0x02b2('0x4c')]()['then'](respondWithResult(_0x50f1a7,null))[_0x02b2('0x49')](handleError(_0x50f1a7,null));}; \ No newline at end of file +var _0x57e1=['sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','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','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','error','name','JscriptyQuestionReport','rawAttributes','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order'];(function(_0x54f005,_0x721e7c){var _0x139e97=function(_0x1baac9){while(--_0x1baac9){_0x54f005['push'](_0x54f005['shift']());}};_0x139e97(++_0x721e7c);}(_0x57e1,0x181));var _0x157e=function(_0x177cc9,_0x3f6fdd){_0x177cc9=_0x177cc9-0x0;var _0x2fe577=_0x57e1[_0x177cc9];return _0x2fe577;};'use strict';var emlformat=require(_0x157e('0x0'));var rimraf=require(_0x157e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x157e('0x2'));var rp=require(_0x157e('0x3'));var moment=require(_0x157e('0x4'));var BPromise=require(_0x157e('0x5'));var Mustache=require(_0x157e('0x6'));var util=require('util');var path=require(_0x157e('0x7'));var sox=require('sox');var csv=require(_0x157e('0x8'));var ejs=require(_0x157e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x157e('0xa'));var squel=require(_0x157e('0xb'));var crypto=require(_0x157e('0xc'));var jsforce=require(_0x157e('0xd'));var deskjs=require(_0x157e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x157e('0xf'));var Papa=require('papaparse');var Redis=require(_0x157e('0x10'));var authService=require(_0x157e('0x11'));var qs=require(_0x157e('0x12'));var as=require(_0x157e('0x13'));var hardwareService=require(_0x157e('0x14'));var logger=require('../../config/logger')(_0x157e('0x15'));var utils=require('../../config/utils');var config=require(_0x157e('0x16'));var licenseUtil=require(_0x157e('0x17'));var db=require(_0x157e('0x18'))['db'];function respondWithStatusCode(_0x1f516c,_0x4ee574){_0x4ee574=_0x4ee574||0xcc;return function(_0x379afb){if(_0x379afb){return _0x1f516c['sendStatus'](_0x4ee574);}return _0x1f516c[_0x157e('0x19')](_0x4ee574)[_0x157e('0x1a')]();};}function respondWithResult(_0x5aef87,_0x494880){_0x494880=_0x494880||0xc8;return function(_0x5d176a){if(_0x5d176a){return _0x5aef87[_0x157e('0x19')](_0x494880)[_0x157e('0x1b')](_0x5d176a);}};}function respondWithFilteredResult(_0xf92a1d,_0x535c94){return function(_0x3b17f5){if(_0x3b17f5){var _0x26b174=typeof _0x535c94[_0x157e('0x1c')]===_0x157e('0x1d')&&typeof _0x535c94[_0x157e('0x1e')]==='undefined';var _0x5669e6=_0x3b17f5[_0x157e('0x1f')];var _0x24cc67=_0x26b174?0x0:_0x535c94[_0x157e('0x1c')];var _0x110360=_0x26b174?_0x3b17f5[_0x157e('0x1f')]:_0x535c94[_0x157e('0x1c')]+_0x535c94['limit'];var _0x2df7b5;if(_0x110360>=_0x5669e6){_0x110360=_0x5669e6;_0x2df7b5=0xc8;}else{_0x2df7b5=0xce;}_0xf92a1d[_0x157e('0x19')](_0x2df7b5);return _0xf92a1d[_0x157e('0x20')](_0x157e('0x21'),_0x24cc67+'-'+_0x110360+'/'+_0x5669e6)[_0x157e('0x1b')](_0x3b17f5);}return null;};}function patchUpdates(_0x400a9b){return function(_0x314057){try{jsonpatch[_0x157e('0x22')](_0x314057,_0x400a9b,!![]);}catch(_0x322e2){return BPromise[_0x157e('0x23')](_0x322e2);}return _0x314057['save']();};}function saveUpdates(_0x4afc11,_0x3bc2bb){return function(_0x2e92a7){if(_0x2e92a7){return _0x2e92a7[_0x157e('0x24')](_0x4afc11)[_0x157e('0x25')](function(_0x95880d){return _0x95880d;});}return null;};}function removeEntity(_0x59e8be,_0x33c441){return function(_0x60d57d){if(_0x60d57d){return _0x60d57d['destroy']()['then'](function(){_0x59e8be[_0x157e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x171635,_0x32dbc9){return function(_0x2c7f4a){if(!_0x2c7f4a){_0x171635[_0x157e('0x26')](0x194);}return _0x2c7f4a;};}function handleError(_0x454d11,_0x1f4ef4){_0x1f4ef4=_0x1f4ef4||0x1f4;return function(_0x457d01){logger[_0x157e('0x27')](_0x457d01['stack']);if(_0x457d01[_0x157e('0x28')]){delete _0x457d01[_0x157e('0x28')];}_0x454d11[_0x157e('0x19')](_0x1f4ef4)['send'](_0x457d01);};}exports['index']=function(_0x354c2c,_0x53dcfe){var _0x6cd941={},_0x282538={},_0x2dbc8c={'count':0x0,'rows':[]};var _0x71c446=_['map'](db[_0x157e('0x29')][_0x157e('0x2a')],function(_0x302b37){return{'name':_0x302b37['fieldName'],'type':_0x302b37['type']['key']};});_0x282538['model']=_[_0x157e('0x2b')](_0x71c446,_0x157e('0x28'));_0x282538[_0x157e('0x2c')]=_['keys'](_0x354c2c['query']);_0x282538[_0x157e('0x2d')]=_[_0x157e('0x2e')](_0x282538[_0x157e('0x2f')],_0x282538[_0x157e('0x2c')]);_0x6cd941[_0x157e('0x30')]=_[_0x157e('0x2e')](_0x282538[_0x157e('0x2f')],qs[_0x157e('0x31')](_0x354c2c[_0x157e('0x2c')][_0x157e('0x31')]));_0x6cd941[_0x157e('0x30')]=_0x6cd941[_0x157e('0x30')][_0x157e('0x32')]?_0x6cd941[_0x157e('0x30')]:_0x282538['model'];if(!_0x354c2c['query'][_0x157e('0x33')]('nolimit')){_0x6cd941[_0x157e('0x1e')]=qs[_0x157e('0x1e')](_0x354c2c[_0x157e('0x2c')][_0x157e('0x1e')]);_0x6cd941[_0x157e('0x1c')]=qs['offset'](_0x354c2c['query']['offset']);}_0x6cd941[_0x157e('0x34')]=qs['sort'](_0x354c2c[_0x157e('0x2c')][_0x157e('0x35')]);_0x6cd941[_0x157e('0x36')]=qs[_0x157e('0x2d')](_[_0x157e('0x37')](_0x354c2c[_0x157e('0x2c')],_0x282538[_0x157e('0x2d')]),_0x71c446);if(_0x354c2c['query'][_0x157e('0x38')]){_0x6cd941[_0x157e('0x36')]=_[_0x157e('0x39')](_0x6cd941['where'],{'$or':_[_0x157e('0x2b')](_0x71c446,function(_0x161238){if(_0x161238[_0x157e('0x3a')]!=='VIRTUAL'){var _0xb3ebe3={};_0xb3ebe3[_0x161238[_0x157e('0x28')]]={'$like':'%'+_0x354c2c['query'][_0x157e('0x38')]+'%'};return _0xb3ebe3;}})});}_0x6cd941=_[_0x157e('0x39')]({},_0x6cd941,_0x354c2c[_0x157e('0x3b')]);var _0x55bc9f={'where':_0x6cd941[_0x157e('0x36')]};return db[_0x157e('0x29')][_0x157e('0x1f')](_0x55bc9f)['then'](function(_0x140832){_0x2dbc8c[_0x157e('0x1f')]=_0x140832;if(_0x354c2c[_0x157e('0x2c')][_0x157e('0x3c')]){_0x6cd941[_0x157e('0x3d')]=[{'all':!![]}];}return db[_0x157e('0x29')][_0x157e('0x3e')](_0x6cd941);})[_0x157e('0x25')](function(_0x563401){_0x2dbc8c[_0x157e('0x3f')]=_0x563401;return _0x2dbc8c;})[_0x157e('0x25')](respondWithFilteredResult(_0x53dcfe,_0x6cd941))[_0x157e('0x40')](handleError(_0x53dcfe,null));};exports[_0x157e('0x41')]=function(_0x2414ce,_0x4b7eb8){var _0x37bdd2={'raw':!![],'where':{'id':_0x2414ce[_0x157e('0x42')]['id']}},_0x197e6e={};_0x197e6e[_0x157e('0x2f')]=_[_0x157e('0x43')](db[_0x157e('0x29')][_0x157e('0x2a')]);_0x197e6e['query']=_[_0x157e('0x43')](_0x2414ce['query']);_0x197e6e['filters']=_[_0x157e('0x2e')](_0x197e6e['model'],_0x197e6e[_0x157e('0x2c')]);_0x37bdd2[_0x157e('0x30')]=_[_0x157e('0x2e')](_0x197e6e[_0x157e('0x2f')],qs[_0x157e('0x31')](_0x2414ce[_0x157e('0x2c')]['fields']));_0x37bdd2['attributes']=_0x37bdd2[_0x157e('0x30')][_0x157e('0x32')]?_0x37bdd2['attributes']:_0x197e6e[_0x157e('0x2f')];if(_0x2414ce[_0x157e('0x2c')]['includeAll']){_0x37bdd2[_0x157e('0x3d')]=[{'all':!![]}];}_0x37bdd2=_['merge']({},_0x37bdd2,_0x2414ce['options']);return db['JscriptyQuestionReport'][_0x157e('0x44')](_0x37bdd2)[_0x157e('0x25')](handleEntityNotFound(_0x4b7eb8,null))[_0x157e('0x25')](respondWithResult(_0x4b7eb8,null))[_0x157e('0x40')](handleError(_0x4b7eb8,null));};exports[_0x157e('0x45')]=function(_0x29db3d,_0x12b1bb){return db['JscriptyQuestionReport'][_0x157e('0x45')](_0x29db3d[_0x157e('0x46')],{})[_0x157e('0x25')](respondWithResult(_0x12b1bb,0xc9))[_0x157e('0x40')](handleError(_0x12b1bb,null));};exports[_0x157e('0x24')]=function(_0x2c93e8,_0x514b36){if(_0x2c93e8['body']['id']){delete _0x2c93e8[_0x157e('0x46')]['id'];}return db[_0x157e('0x29')][_0x157e('0x44')]({'where':{'id':_0x2c93e8[_0x157e('0x42')]['id']}})[_0x157e('0x25')](handleEntityNotFound(_0x514b36,null))[_0x157e('0x25')](saveUpdates(_0x2c93e8[_0x157e('0x46')],null))[_0x157e('0x25')](respondWithResult(_0x514b36,null))[_0x157e('0x40')](handleError(_0x514b36,null));};exports[_0x157e('0x47')]=function(_0x3bfd04,_0xf32826){return db[_0x157e('0x29')]['find']({'where':{'id':_0x3bfd04[_0x157e('0x42')]['id']}})[_0x157e('0x25')](handleEntityNotFound(_0xf32826,null))[_0x157e('0x25')](removeEntity(_0xf32826,null))[_0x157e('0x40')](handleError(_0xf32826,null));};exports['describe']=function(_0x114732,_0x203dd8){return db[_0x157e('0x29')][_0x157e('0x48')]()[_0x157e('0x25')](respondWithResult(_0x203dd8,null))[_0x157e('0x40')](handleError(_0x203dd8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 8e48cf9..5e9d7e5 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 _0x713b=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x713b,0xd9));var _0xb713=function(_0x152678,_0x11e0ac){_0x152678=_0x152678-0x0;var _0x311a9=_0x713b[_0x152678];return _0x311a9;};'use strict';var _=require('lodash');var util=require(_0xb713('0x0'));var logger=require(_0xb713('0x1'))(_0xb713('0x2'));var moment=require(_0xb713('0x3'));var BPromise=require(_0xb713('0x4'));var rp=require(_0xb713('0x5'));var fs=require('fs');var path=require(_0xb713('0x6'));var rimraf=require(_0xb713('0x7'));var config=require(_0xb713('0x8'));var attributes=require(_0xb713('0x9'));module[_0xb713('0xa')]=function(_0x5d37d3,_0x5ecf69){return _0x5d37d3[_0xb713('0xb')](_0xb713('0xc'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x226d=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x41cb74,_0x3e430c){var _0x3ff0f3=function(_0xb8b2f7){while(--_0xb8b2f7){_0x41cb74['push'](_0x41cb74['shift']());}};_0x3ff0f3(++_0x3e430c);}(_0x226d,0x1aa));var _0xd226=function(_0x26c279,_0x1ce9b8){_0x26c279=_0x26c279-0x0;var _0x196f8b=_0x226d[_0x26c279];return _0x196f8b;};'use strict';var _=require('lodash');var util=require(_0xd226('0x0'));var logger=require(_0xd226('0x1'))(_0xd226('0x2'));var moment=require('moment');var BPromise=require(_0xd226('0x3'));var rp=require(_0xd226('0x4'));var fs=require('fs');var path=require(_0xd226('0x5'));var rimraf=require(_0xd226('0x6'));var config=require(_0xd226('0x7'));var attributes=require(_0xd226('0x8'));module[_0xd226('0x9')]=function(_0x5ce18a,_0x2607fd){return _0x5ce18a[_0xd226('0xa')](_0xd226('0xb'),attributes,{'tableName':'report_jscripty_questions','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 d9fbf2f..3c59a93 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 _0xf411=['then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','../../mysqldb','jayson/promise','http','request'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf411,0x139));var _0x1f41=function(_0x2b7480,_0x46d376){_0x2b7480=_0x2b7480-0x0;var _0x22c70c=_0xf411[_0x2b7480];return _0x22c70c;};'use strict';var _=require(_0x1f41('0x0'));var util=require(_0x1f41('0x1'));var moment=require('moment');var BPromise=require(_0x1f41('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f41('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1f41('0x4'));var client=jayson['client'][_0x1f41('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1c3f30,_0x397c10,_0x1a30ef){return new BPromise(function(_0x4fbef4,_0x54fffd){return client[_0x1f41('0x6')](_0x1c3f30,_0x1a30ef)[_0x1f41('0x7')](function(_0x48ef6b){logger[_0x1f41('0x8')](_0x1f41('0x9'),_0x397c10,_0x1f41('0xa'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x397c10,'request\x20sent',JSON[_0x1f41('0xb')](_0x48ef6b));if(_0x48ef6b[_0x1f41('0xc')]){if(_0x48ef6b[_0x1f41('0xc')]['code']===0x1f4){logger[_0x1f41('0xc')](_0x1f41('0x9'),_0x397c10,_0x48ef6b[_0x1f41('0xc')][_0x1f41('0xd')]);return _0x54fffd(_0x48ef6b[_0x1f41('0xc')][_0x1f41('0xd')]);}logger[_0x1f41('0xc')](_0x1f41('0x9'),_0x397c10,_0x48ef6b[_0x1f41('0xc')]['message']);return _0x4fbef4(_0x48ef6b[_0x1f41('0xc')][_0x1f41('0xd')]);}else{logger[_0x1f41('0x8')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x397c10,'request\x20sent');_0x4fbef4(_0x48ef6b[_0x1f41('0xe')]['message']);}})[_0x1f41('0xf')](function(_0xb81c42){logger[_0x1f41('0xc')](_0x1f41('0x9'),_0x397c10,_0xb81c42);_0x54fffd(_0xb81c42);});});} \ No newline at end of file +var _0xce4c=['randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment','bluebird'];(function(_0x1c97c8,_0x28d564){var _0x2c096d=function(_0x1bf3ec){while(--_0x1bf3ec){_0x1c97c8['push'](_0x1c97c8['shift']());}};_0x2c096d(++_0x28d564);}(_0xce4c,0x1bf));var _0xcce4=function(_0x253724,_0xb8263d){_0x253724=_0x253724-0x0;var _0x272934=_0xce4c[_0x253724];return _0x272934;};'use strict';var _=require('lodash');var util=require(_0xcce4('0x0'));var moment=require(_0xcce4('0x1'));var BPromise=require(_0xcce4('0x2'));var rs=require(_0xcce4('0x3'));var fs=require('fs');var Redis=require(_0xcce4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcce4('0x5'))('rpc');var config=require(_0xcce4('0x6'));var jayson=require(_0xcce4('0x7'));var client=jayson[_0xcce4('0x8')][_0xcce4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x173634,_0x2cc8d3,_0x11c3f4){return new BPromise(function(_0x1c6aff,_0x43e96d){return client['request'](_0x173634,_0x11c3f4)[_0xcce4('0xa')](function(_0x34a25a){logger[_0xcce4('0xb')](_0xcce4('0xc'),_0x2cc8d3,_0xcce4('0xd'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x2cc8d3,'request\x20sent',JSON['stringify'](_0x34a25a));if(_0x34a25a[_0xcce4('0xe')]){if(_0x34a25a[_0xcce4('0xe')][_0xcce4('0xf')]===0x1f4){logger[_0xcce4('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2cc8d3,_0x34a25a['error'][_0xcce4('0x10')]);return _0x43e96d(_0x34a25a[_0xcce4('0xe')][_0xcce4('0x10')]);}logger['error'](_0xcce4('0xc'),_0x2cc8d3,_0x34a25a[_0xcce4('0xe')][_0xcce4('0x10')]);return _0x1c6aff(_0x34a25a[_0xcce4('0xe')][_0xcce4('0x10')]);}else{logger['info'](_0xcce4('0xc'),_0x2cc8d3,'request\x20sent');_0x1c6aff(_0x34a25a[_0xcce4('0x11')][_0xcce4('0x10')]);}})['catch'](function(_0x2e5666){logger[_0xcce4('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2cc8d3,_0x2e5666);_0x43e96d(_0x2e5666);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 8d08995..a2fb533 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 _0x433d=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','getQuestions','post','create','put','update'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x433d,0xb2));var _0xd433=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0x433d[_0x1fc84d];return _0x2658fa;};'use strict';var multer=require(_0xd433('0x0'));var util=require(_0xd433('0x1'));var path=require(_0xd433('0x2'));var timeout=require(_0xd433('0x3'));var express=require(_0xd433('0x4'));var router=express[_0xd433('0x5')]();var fs_extra=require(_0xd433('0x6'));var auth=require(_0xd433('0x7'));var interaction=require(_0xd433('0x8'));var config=require(_0xd433('0x9'));var controller=require(_0xd433('0xa'));router[_0xd433('0xb')]('/',auth[_0xd433('0xc')](),controller[_0xd433('0xd')]);router[_0xd433('0xb')]('/describe',auth[_0xd433('0xc')](),controller[_0xd433('0xe')]);router[_0xd433('0xb')](_0xd433('0xf'),auth[_0xd433('0xc')](),controller[_0xd433('0x10')]);router['get']('/:id/questions',auth[_0xd433('0xc')](),controller[_0xd433('0x11')]);router[_0xd433('0x12')]('/',auth['isAuthenticated'](),controller[_0xd433('0x13')]);router[_0xd433('0x14')](_0xd433('0xf'),auth['isAuthenticated'](),controller[_0xd433('0x15')]);router[_0xd433('0x16')](_0xd433('0xf'),auth[_0xd433('0xc')](),controller[_0xd433('0x17')]);module[_0xd433('0x18')]=router; \ No newline at end of file +var _0xfa98=['exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','create','put','delete','destroy'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xfa98,0x105));var _0x8fa9=function(_0x534b6d,_0x2080da){_0x534b6d=_0x534b6d-0x0;var _0x10c1ba=_0xfa98[_0x534b6d];return _0x10c1ba;};'use strict';var multer=require(_0x8fa9('0x0'));var util=require('util');var path=require(_0x8fa9('0x1'));var timeout=require(_0x8fa9('0x2'));var express=require(_0x8fa9('0x3'));var router=express['Router']();var fs_extra=require(_0x8fa9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8fa9('0x5'));var config=require(_0x8fa9('0x6'));var controller=require(_0x8fa9('0x7'));router[_0x8fa9('0x8')]('/',auth[_0x8fa9('0x9')](),controller['index']);router[_0x8fa9('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x8fa9('0xa')]);router[_0x8fa9('0x8')](_0x8fa9('0xb'),auth[_0x8fa9('0x9')](),controller[_0x8fa9('0xc')]);router['get'](_0x8fa9('0xd'),auth[_0x8fa9('0x9')](),controller[_0x8fa9('0xe')]);router['post']('/',auth[_0x8fa9('0x9')](),controller[_0x8fa9('0xf')]);router[_0x8fa9('0x10')]('/:id',auth[_0x8fa9('0x9')](),controller['update']);router[_0x8fa9('0x11')]('/:id',auth[_0x8fa9('0x9')](),controller[_0x8fa9('0x12')]);module[_0x8fa9('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 5ec91ed..57af6ff 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 _0x6a57=['setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE'];(function(_0x1c6bff,_0x52389b){var _0x304fa8=function(_0x5eb4ce){while(--_0x5eb4ce){_0x1c6bff['push'](_0x1c6bff['shift']());}};_0x304fa8(++_0x52389b);}(_0x6a57,0x75));var _0x76a5=function(_0x1dc2b4,_0x573a04){_0x1dc2b4=_0x1dc2b4-0x0;var _0x18af92=_0x6a57[_0x1dc2b4];return _0x18af92;};'use strict';var moment=require(_0x76a5('0x0'));var Sequelize=require(_0x76a5('0x1'));module[_0x76a5('0x2')]={'starttime':{'type':Sequelize[_0x76a5('0x3')],'set':function(_0x46a9b9){this[_0x76a5('0x4')](_0x76a5('0x5'),_0x46a9b9);this[_0x76a5('0x4')](_0x76a5('0x6'),moment()[_0x76a5('0x7')](_0x76a5('0x8')));}},'endtime':{'type':Sequelize[_0x76a5('0x3')]},'membername':{'type':Sequelize[_0x76a5('0x9')]},'projectname':{'type':Sequelize[_0x76a5('0x9')]},'queue':{'type':Sequelize[_0x76a5('0x9')]},'uniqueid':{'type':Sequelize[_0x76a5('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x76a5('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x2a8e=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports','DATE','setDataValue'];(function(_0x3964c6,_0x176742){var _0x56584c=function(_0x1e5089){while(--_0x1e5089){_0x3964c6['push'](_0x3964c6['shift']());}};_0x56584c(++_0x176742);}(_0x2a8e,0x132));var _0xe2a8=function(_0x387b64,_0x186a3c){_0x387b64=_0x387b64-0x0;var _0x387309=_0x2a8e[_0x387b64];return _0x387309;};'use strict';var moment=require(_0xe2a8('0x0'));var Sequelize=require('sequelize');module[_0xe2a8('0x1')]={'starttime':{'type':Sequelize[_0xe2a8('0x2')],'set':function(_0x11471b){this[_0xe2a8('0x3')](_0xe2a8('0x4'),_0x11471b);this[_0xe2a8('0x3')](_0xe2a8('0x5'),moment()[_0xe2a8('0x6')](_0xe2a8('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xe2a8('0x8')]},'projectname':{'type':Sequelize[_0xe2a8('0x8')]},'queue':{'type':Sequelize[_0xe2a8('0x8')]},'uniqueid':{'type':Sequelize[_0xe2a8('0x8')]},'calleridname':{'type':Sequelize[_0xe2a8('0x8')]},'calleridnum':{'type':Sequelize[_0xe2a8('0x8')]},'completed':{'type':Sequelize[_0xe2a8('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 c9fd0a0..f2ca1a1 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 _0x73bf=['describe','getQuestions','findOne','JscriptyQuestionReport','sort','SessionId','findAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','JscriptySessionReport','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','includeAll','create','body','find'];(function(_0x5354d1,_0x746d70){var _0x4d74b0=function(_0x15ac84){while(--_0x15ac84){_0x5354d1['push'](_0x5354d1['shift']());}};_0x4d74b0(++_0x746d70);}(_0x73bf,0x1e7));var _0xf73b=function(_0x19ea9d,_0x582bea){_0x19ea9d=_0x19ea9d-0x0;var _0x496114=_0x73bf[_0x19ea9d];return _0x496114;};'use strict';var emlformat=require(_0xf73b('0x0'));var rimraf=require(_0xf73b('0x1'));var zipdir=require(_0xf73b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf73b('0x3'));var moment=require(_0xf73b('0x4'));var BPromise=require(_0xf73b('0x5'));var Mustache=require(_0xf73b('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf73b('0x7'));var csv=require('to-csv');var ejs=require(_0xf73b('0x8'));var fs=require('fs');var fs_extra=require(_0xf73b('0x9'));var _=require(_0xf73b('0xa'));var squel=require(_0xf73b('0xb'));var crypto=require(_0xf73b('0xc'));var jsforce=require(_0xf73b('0xd'));var deskjs=require(_0xf73b('0xe'));var toCsv=require(_0xf73b('0xf'));var querystring=require(_0xf73b('0x10'));var Papa=require(_0xf73b('0x11'));var Redis=require('ioredis');var authService=require(_0xf73b('0x12'));var qs=require(_0xf73b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf73b('0x14'))('api');var utils=require(_0xf73b('0x15'));var config=require(_0xf73b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf73b('0x17'))['db'];function respondWithStatusCode(_0x2532a6,_0x56fdae){_0x56fdae=_0x56fdae||0xcc;return function(_0x572b70){if(_0x572b70){return _0x2532a6['sendStatus'](_0x56fdae);}return _0x2532a6[_0xf73b('0x18')](_0x56fdae)[_0xf73b('0x19')]();};}function respondWithResult(_0x49a0b8,_0x30d1a0){_0x30d1a0=_0x30d1a0||0xc8;return function(_0x53fdd0){if(_0x53fdd0){return _0x49a0b8['status'](_0x30d1a0)[_0xf73b('0x1a')](_0x53fdd0);}};}function respondWithFilteredResult(_0x555ca5,_0x2dde97){return function(_0x322d32){if(_0x322d32){var _0xd9c901=typeof _0x2dde97[_0xf73b('0x1b')]==='undefined'&&typeof _0x2dde97[_0xf73b('0x1c')]===_0xf73b('0x1d');var _0x5768ce=_0x322d32[_0xf73b('0x1e')];var _0x3780c0=_0xd9c901?0x0:_0x2dde97[_0xf73b('0x1b')];var _0x592018=_0xd9c901?_0x322d32['count']:_0x2dde97[_0xf73b('0x1b')]+_0x2dde97[_0xf73b('0x1c')];var _0x1f300e;if(_0x592018>=_0x5768ce){_0x592018=_0x5768ce;_0x1f300e=0xc8;}else{_0x1f300e=0xce;}_0x555ca5[_0xf73b('0x18')](_0x1f300e);return _0x555ca5[_0xf73b('0x1f')](_0xf73b('0x20'),_0x3780c0+'-'+_0x592018+'/'+_0x5768ce)[_0xf73b('0x1a')](_0x322d32);}return null;};}function patchUpdates(_0x2c4233){return function(_0x16a185){try{jsonpatch['apply'](_0x16a185,_0x2c4233,!![]);}catch(_0x41a3dd){return BPromise[_0xf73b('0x21')](_0x41a3dd);}return _0x16a185[_0xf73b('0x22')]();};}function saveUpdates(_0x37706f,_0x44c6c0){return function(_0x47d904){if(_0x47d904){return _0x47d904[_0xf73b('0x23')](_0x37706f)[_0xf73b('0x24')](function(_0x32d954){return _0x32d954;});}return null;};}function removeEntity(_0x53bf78,_0x496a9a){return function(_0x3b0e12){if(_0x3b0e12){return _0x3b0e12[_0xf73b('0x25')]()[_0xf73b('0x24')](function(){_0x53bf78['status'](0xcc)[_0xf73b('0x19')]();});}};}function handleEntityNotFound(_0x4e1959,_0x1ccc68){return function(_0x1397af){if(!_0x1397af){_0x4e1959['sendStatus'](0x194);}return _0x1397af;};}function handleError(_0x5e5372,_0x5241e8){_0x5241e8=_0x5241e8||0x1f4;return function(_0x1b89b6){logger[_0xf73b('0x26')](_0x1b89b6[_0xf73b('0x27')]);if(_0x1b89b6['name']){delete _0x1b89b6[_0xf73b('0x28')];}_0x5e5372['status'](_0x5241e8)['send'](_0x1b89b6);};}exports[_0xf73b('0x29')]=function(_0x2fb375,_0x185c4e){var _0x405f61={},_0x31088f={},_0x72ae0d={'count':0x0,'rows':[]};var _0x4ed20b=_[_0xf73b('0x2a')](db[_0xf73b('0x2b')]['rawAttributes'],function(_0x25783c){return{'name':_0x25783c[_0xf73b('0x2c')],'type':_0x25783c['type'][_0xf73b('0x2d')]};});_0x31088f[_0xf73b('0x2e')]=_[_0xf73b('0x2a')](_0x4ed20b,_0xf73b('0x28'));_0x31088f[_0xf73b('0x2f')]=_[_0xf73b('0x30')](_0x2fb375[_0xf73b('0x2f')]);_0x31088f['filters']=_['intersection'](_0x31088f[_0xf73b('0x2e')],_0x31088f[_0xf73b('0x2f')]);_0x405f61[_0xf73b('0x31')]=_[_0xf73b('0x32')](_0x31088f[_0xf73b('0x2e')],qs[_0xf73b('0x33')](_0x2fb375[_0xf73b('0x2f')][_0xf73b('0x33')]));_0x405f61[_0xf73b('0x31')]=_0x405f61[_0xf73b('0x31')][_0xf73b('0x34')]?_0x405f61[_0xf73b('0x31')]:_0x31088f[_0xf73b('0x2e')];if(!_0x2fb375[_0xf73b('0x2f')][_0xf73b('0x35')](_0xf73b('0x36'))){_0x405f61[_0xf73b('0x1c')]=qs['limit'](_0x2fb375[_0xf73b('0x2f')][_0xf73b('0x1c')]);_0x405f61[_0xf73b('0x1b')]=qs[_0xf73b('0x1b')](_0x2fb375[_0xf73b('0x2f')][_0xf73b('0x1b')]);}_0x405f61['order']=qs['sort'](_0x2fb375[_0xf73b('0x2f')]['sort']);_0x405f61[_0xf73b('0x37')]=qs['filters'](_[_0xf73b('0x38')](_0x2fb375[_0xf73b('0x2f')],_0x31088f[_0xf73b('0x39')]),_0x4ed20b);if(_0x2fb375[_0xf73b('0x2f')][_0xf73b('0x3a')]){_0x405f61[_0xf73b('0x37')]=_[_0xf73b('0x3b')](_0x405f61[_0xf73b('0x37')],{'$or':_[_0xf73b('0x2a')](_0x4ed20b,function(_0x11c070){if(_0x11c070[_0xf73b('0x3c')]!==_0xf73b('0x3d')){var _0x4344f6={};_0x4344f6[_0x11c070[_0xf73b('0x28')]]={'$like':'%'+_0x2fb375[_0xf73b('0x2f')]['filter']+'%'};return _0x4344f6;}})});}_0x405f61=_[_0xf73b('0x3b')]({},_0x405f61,_0x2fb375[_0xf73b('0x3e')]);var _0x2d46fa={'where':_0x405f61[_0xf73b('0x37')]};return db[_0xf73b('0x2b')]['count'](_0x2d46fa)['then'](function(_0x4ca990){_0x72ae0d[_0xf73b('0x1e')]=_0x4ca990;if(_0x2fb375['query']['includeAll']){_0x405f61[_0xf73b('0x3f')]=[{'all':!![]}];}return db[_0xf73b('0x2b')]['findAll'](_0x405f61);})[_0xf73b('0x24')](function(_0x25d58d){_0x72ae0d[_0xf73b('0x40')]=_0x25d58d;return _0x72ae0d;})[_0xf73b('0x24')](respondWithFilteredResult(_0x185c4e,_0x405f61))[_0xf73b('0x41')](handleError(_0x185c4e,null));};exports[_0xf73b('0x42')]=function(_0x39c496,_0x3df798){var _0x4480d2={'raw':!![],'where':{'id':_0x39c496[_0xf73b('0x43')]['id']}},_0xde6d86={};_0xde6d86[_0xf73b('0x2e')]=_[_0xf73b('0x30')](db[_0xf73b('0x2b')][_0xf73b('0x44')]);_0xde6d86['query']=_[_0xf73b('0x30')](_0x39c496[_0xf73b('0x2f')]);_0xde6d86[_0xf73b('0x39')]=_[_0xf73b('0x32')](_0xde6d86[_0xf73b('0x2e')],_0xde6d86[_0xf73b('0x2f')]);_0x4480d2[_0xf73b('0x31')]=_[_0xf73b('0x32')](_0xde6d86['model'],qs[_0xf73b('0x33')](_0x39c496['query'][_0xf73b('0x33')]));_0x4480d2[_0xf73b('0x31')]=_0x4480d2['attributes'][_0xf73b('0x34')]?_0x4480d2[_0xf73b('0x31')]:_0xde6d86[_0xf73b('0x2e')];if(_0x39c496['query'][_0xf73b('0x45')]){_0x4480d2[_0xf73b('0x3f')]=[{'all':!![]}];}_0x4480d2=_[_0xf73b('0x3b')]({},_0x4480d2,_0x39c496[_0xf73b('0x3e')]);return db[_0xf73b('0x2b')]['find'](_0x4480d2)[_0xf73b('0x24')](handleEntityNotFound(_0x3df798,null))[_0xf73b('0x24')](respondWithResult(_0x3df798,null))[_0xf73b('0x41')](handleError(_0x3df798,null));};exports[_0xf73b('0x46')]=function(_0x23970b,_0x126996){return db[_0xf73b('0x2b')][_0xf73b('0x46')](_0x23970b[_0xf73b('0x47')],{})[_0xf73b('0x24')](respondWithResult(_0x126996,0xc9))[_0xf73b('0x41')](handleError(_0x126996,null));};exports[_0xf73b('0x23')]=function(_0x834c23,_0x50cbe8){if(_0x834c23['body']['id']){delete _0x834c23[_0xf73b('0x47')]['id'];}return db[_0xf73b('0x2b')]['find']({'where':{'id':_0x834c23['params']['id']}})[_0xf73b('0x24')](handleEntityNotFound(_0x50cbe8,null))[_0xf73b('0x24')](saveUpdates(_0x834c23['body'],null))[_0xf73b('0x24')](respondWithResult(_0x50cbe8,null))[_0xf73b('0x41')](handleError(_0x50cbe8,null));};exports[_0xf73b('0x25')]=function(_0x4e3493,_0x963b5e){return db[_0xf73b('0x2b')][_0xf73b('0x48')]({'where':{'id':_0x4e3493[_0xf73b('0x43')]['id']}})[_0xf73b('0x24')](handleEntityNotFound(_0x963b5e,null))[_0xf73b('0x24')](removeEntity(_0x963b5e,null))[_0xf73b('0x41')](handleError(_0x963b5e,null));};exports[_0xf73b('0x49')]=function(_0x1cc820,_0x2268f6){return db[_0xf73b('0x2b')][_0xf73b('0x49')]()[_0xf73b('0x24')](respondWithResult(_0x2268f6,null))[_0xf73b('0x41')](handleError(_0x2268f6,null));};exports[_0xf73b('0x4a')]=function(_0x5c42fc,_0x35e1f1,_0x15bd4a){var _0x2a0c2d={'raw':!![],'where':{}};var _0x33f9b2={};var _0x298e53={'count':0x0,'rows':[]};return db[_0xf73b('0x2b')][_0xf73b('0x4b')]({'where':{'id':_0x5c42fc['params']['id']}})[_0xf73b('0x24')](handleEntityNotFound(_0x35e1f1,null))[_0xf73b('0x24')](function(_0x4d5328){if(_0x4d5328){_0x33f9b2[_0xf73b('0x2e')]=_['keys'](db[_0xf73b('0x4c')][_0xf73b('0x44')]);_0x33f9b2['query']=_[_0xf73b('0x30')](_0x5c42fc[_0xf73b('0x2f')]);_0x33f9b2[_0xf73b('0x39')]=_[_0xf73b('0x32')](_0x33f9b2[_0xf73b('0x2e')],_0x33f9b2[_0xf73b('0x2f')]);_0x2a0c2d[_0xf73b('0x31')]=_[_0xf73b('0x32')](_0x33f9b2[_0xf73b('0x2e')],qs[_0xf73b('0x33')](_0x5c42fc[_0xf73b('0x2f')]['fields']));_0x2a0c2d['attributes']=_0x2a0c2d['attributes'][_0xf73b('0x34')]?_0x2a0c2d[_0xf73b('0x31')]:_0x33f9b2['model'];if(!_0x5c42fc[_0xf73b('0x2f')][_0xf73b('0x35')](_0xf73b('0x36'))){_0x2a0c2d[_0xf73b('0x1c')]=qs[_0xf73b('0x1c')](_0x5c42fc[_0xf73b('0x2f')][_0xf73b('0x1c')]);_0x2a0c2d['offset']=qs[_0xf73b('0x1b')](_0x5c42fc['query'][_0xf73b('0x1b')]);}_0x2a0c2d['order']=qs[_0xf73b('0x4d')](_0x5c42fc[_0xf73b('0x2f')][_0xf73b('0x4d')]);_0x2a0c2d[_0xf73b('0x37')]=qs[_0xf73b('0x39')](_[_0xf73b('0x38')](_0x5c42fc[_0xf73b('0x2f')],_0x33f9b2[_0xf73b('0x39')]));_0x2a0c2d[_0xf73b('0x37')][_0xf73b('0x4e')]=_0x4d5328['id'];if(_0x5c42fc[_0xf73b('0x2f')][_0xf73b('0x3a')]){_0x2a0c2d['where']=_[_0xf73b('0x3b')](_0x2a0c2d[_0xf73b('0x37')],{'$or':_['map'](_0x2a0c2d[_0xf73b('0x31')],function(_0x3dbbe5){var _0x1ff0e0={};_0x1ff0e0[_0x3dbbe5]={'$like':'%'+_0x5c42fc[_0xf73b('0x2f')][_0xf73b('0x3a')]+'%'};return _0x1ff0e0;})});}_0x2a0c2d=_['merge']({},_0x2a0c2d,_0x5c42fc[_0xf73b('0x3e')]);return db[_0xf73b('0x4c')][_0xf73b('0x1e')]({'where':_0x2a0c2d[_0xf73b('0x37')]})[_0xf73b('0x24')](function(_0x3f3d87){_0x298e53['count']=_0x3f3d87;if(_0x5c42fc[_0xf73b('0x2f')][_0xf73b('0x45')]){_0x2a0c2d[_0xf73b('0x3f')]=[{'all':!![]}];}return db[_0xf73b('0x4c')][_0xf73b('0x4f')](_0x2a0c2d);})[_0xf73b('0x24')](function(_0x10a806){_0x298e53['rows']=_0x10a806;return _0x298e53;});}})[_0xf73b('0x24')](respondWithFilteredResult(_0x35e1f1,_0x2a0c2d))[_0xf73b('0x41')](handleError(_0x35e1f1,null));}; \ No newline at end of file +var _0xca4b=['destroy','then','end','sendStatus','error','stack','name','map','JscriptySessionReport','fieldName','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','rows','show','params','fields','includeAll','options','catch','create','body','find','describe','getQuestions','findOne','rawAttributes','SessionId','JscriptyQuestionReport','include','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','limit','count','offset','set','Content-Range','apply','reject','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca4b,0x1f4));var _0xbca4=function(_0x576039,_0x5df8c8){_0x576039=_0x576039-0x0;var _0xcb3055=_0xca4b[_0x576039];return _0xcb3055;};'use strict';var emlformat=require(_0xbca4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbca4('0x1'));var jsonpatch=require(_0xbca4('0x2'));var rp=require(_0xbca4('0x3'));var moment=require(_0xbca4('0x4'));var BPromise=require(_0xbca4('0x5'));var Mustache=require(_0xbca4('0x6'));var util=require(_0xbca4('0x7'));var path=require('path');var sox=require(_0xbca4('0x8'));var csv=require(_0xbca4('0x9'));var ejs=require(_0xbca4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbca4('0xb'));var crypto=require('crypto');var jsforce=require(_0xbca4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbca4('0xd'));var Papa=require('papaparse');var Redis=require(_0xbca4('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xbca4('0xf'));var as=require(_0xbca4('0x10'));var hardwareService=require(_0xbca4('0x11'));var logger=require(_0xbca4('0x12'))('api');var utils=require(_0xbca4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbca4('0x14'));var db=require(_0xbca4('0x15'))['db'];function respondWithStatusCode(_0x15629f,_0x4af4b0){_0x4af4b0=_0x4af4b0||0xcc;return function(_0x3bc67f){if(_0x3bc67f){return _0x15629f['sendStatus'](_0x4af4b0);}return _0x15629f[_0xbca4('0x16')](_0x4af4b0)['end']();};}function respondWithResult(_0x1275c0,_0x1e6742){_0x1e6742=_0x1e6742||0xc8;return function(_0x232bde){if(_0x232bde){return _0x1275c0[_0xbca4('0x16')](_0x1e6742)[_0xbca4('0x17')](_0x232bde);}};}function respondWithFilteredResult(_0x31fb7a,_0x4a6069){return function(_0x2bbf00){if(_0x2bbf00){var _0x570b15=typeof _0x4a6069['offset']==='undefined'&&typeof _0x4a6069[_0xbca4('0x18')]==='undefined';var _0x5b6a4d=_0x2bbf00[_0xbca4('0x19')];var _0x106802=_0x570b15?0x0:_0x4a6069[_0xbca4('0x1a')];var _0x81c5fd=_0x570b15?_0x2bbf00[_0xbca4('0x19')]:_0x4a6069[_0xbca4('0x1a')]+_0x4a6069['limit'];var _0x40b5f9;if(_0x81c5fd>=_0x5b6a4d){_0x81c5fd=_0x5b6a4d;_0x40b5f9=0xc8;}else{_0x40b5f9=0xce;}_0x31fb7a[_0xbca4('0x16')](_0x40b5f9);return _0x31fb7a[_0xbca4('0x1b')](_0xbca4('0x1c'),_0x106802+'-'+_0x81c5fd+'/'+_0x5b6a4d)['json'](_0x2bbf00);}return null;};}function patchUpdates(_0x1ee181){return function(_0x576d46){try{jsonpatch[_0xbca4('0x1d')](_0x576d46,_0x1ee181,!![]);}catch(_0x2db882){return BPromise[_0xbca4('0x1e')](_0x2db882);}return _0x576d46['save']();};}function saveUpdates(_0x2ae2cf,_0x13ffa3){return function(_0x1d5d80){if(_0x1d5d80){return _0x1d5d80[_0xbca4('0x1f')](_0x2ae2cf)['then'](function(_0x14e27a){return _0x14e27a;});}return null;};}function removeEntity(_0x387a30,_0x527a26){return function(_0x4ca64d){if(_0x4ca64d){return _0x4ca64d[_0xbca4('0x20')]()[_0xbca4('0x21')](function(){_0x387a30['status'](0xcc)[_0xbca4('0x22')]();});}};}function handleEntityNotFound(_0x342332,_0x515084){return function(_0x374732){if(!_0x374732){_0x342332[_0xbca4('0x23')](0x194);}return _0x374732;};}function handleError(_0x9f175a,_0x4faa67){_0x4faa67=_0x4faa67||0x1f4;return function(_0x224ed2){logger[_0xbca4('0x24')](_0x224ed2[_0xbca4('0x25')]);if(_0x224ed2[_0xbca4('0x26')]){delete _0x224ed2[_0xbca4('0x26')];}_0x9f175a[_0xbca4('0x16')](_0x4faa67)['send'](_0x224ed2);};}exports['index']=function(_0x5af4b3,_0x207f7c){var _0x3bdf9d={},_0x52a704={},_0x1b80eb={'count':0x0,'rows':[]};var _0x5e6384=_[_0xbca4('0x27')](db[_0xbca4('0x28')]['rawAttributes'],function(_0x48a722){return{'name':_0x48a722[_0xbca4('0x29')],'type':_0x48a722[_0xbca4('0x2a')]['key']};});_0x52a704[_0xbca4('0x2b')]=_['map'](_0x5e6384,'name');_0x52a704['query']=_[_0xbca4('0x2c')](_0x5af4b3[_0xbca4('0x2d')]);_0x52a704[_0xbca4('0x2e')]=_[_0xbca4('0x2f')](_0x52a704[_0xbca4('0x2b')],_0x52a704[_0xbca4('0x2d')]);_0x3bdf9d[_0xbca4('0x30')]=_[_0xbca4('0x2f')](_0x52a704[_0xbca4('0x2b')],qs['fields'](_0x5af4b3[_0xbca4('0x2d')]['fields']));_0x3bdf9d[_0xbca4('0x30')]=_0x3bdf9d[_0xbca4('0x30')][_0xbca4('0x31')]?_0x3bdf9d[_0xbca4('0x30')]:_0x52a704['model'];if(!_0x5af4b3['query'][_0xbca4('0x32')](_0xbca4('0x33'))){_0x3bdf9d['limit']=qs[_0xbca4('0x18')](_0x5af4b3[_0xbca4('0x2d')][_0xbca4('0x18')]);_0x3bdf9d['offset']=qs['offset'](_0x5af4b3[_0xbca4('0x2d')][_0xbca4('0x1a')]);}_0x3bdf9d[_0xbca4('0x34')]=qs['sort'](_0x5af4b3[_0xbca4('0x2d')][_0xbca4('0x35')]);_0x3bdf9d[_0xbca4('0x36')]=qs[_0xbca4('0x2e')](_[_0xbca4('0x37')](_0x5af4b3['query'],_0x52a704[_0xbca4('0x2e')]),_0x5e6384);if(_0x5af4b3['query'][_0xbca4('0x38')]){_0x3bdf9d['where']=_[_0xbca4('0x39')](_0x3bdf9d[_0xbca4('0x36')],{'$or':_[_0xbca4('0x27')](_0x5e6384,function(_0x1be78a){if(_0x1be78a[_0xbca4('0x2a')]!=='VIRTUAL'){var _0x37bd3e={};_0x37bd3e[_0x1be78a[_0xbca4('0x26')]]={'$like':'%'+_0x5af4b3[_0xbca4('0x2d')][_0xbca4('0x38')]+'%'};return _0x37bd3e;}})});}_0x3bdf9d=_[_0xbca4('0x39')]({},_0x3bdf9d,_0x5af4b3['options']);var _0x1b8092={'where':_0x3bdf9d[_0xbca4('0x36')]};return db[_0xbca4('0x28')][_0xbca4('0x19')](_0x1b8092)['then'](function(_0x21730b){_0x1b80eb[_0xbca4('0x19')]=_0x21730b;if(_0x5af4b3[_0xbca4('0x2d')]['includeAll']){_0x3bdf9d['include']=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x3bdf9d);})['then'](function(_0x43fcf7){_0x1b80eb[_0xbca4('0x3a')]=_0x43fcf7;return _0x1b80eb;})[_0xbca4('0x21')](respondWithFilteredResult(_0x207f7c,_0x3bdf9d))['catch'](handleError(_0x207f7c,null));};exports[_0xbca4('0x3b')]=function(_0x2b1271,_0x7a7745){var _0x5f4bae={'raw':!![],'where':{'id':_0x2b1271[_0xbca4('0x3c')]['id']}},_0x592773={};_0x592773[_0xbca4('0x2b')]=_[_0xbca4('0x2c')](db['JscriptySessionReport']['rawAttributes']);_0x592773[_0xbca4('0x2d')]=_[_0xbca4('0x2c')](_0x2b1271[_0xbca4('0x2d')]);_0x592773[_0xbca4('0x2e')]=_[_0xbca4('0x2f')](_0x592773['model'],_0x592773[_0xbca4('0x2d')]);_0x5f4bae['attributes']=_[_0xbca4('0x2f')](_0x592773[_0xbca4('0x2b')],qs[_0xbca4('0x3d')](_0x2b1271['query'][_0xbca4('0x3d')]));_0x5f4bae[_0xbca4('0x30')]=_0x5f4bae[_0xbca4('0x30')][_0xbca4('0x31')]?_0x5f4bae[_0xbca4('0x30')]:_0x592773[_0xbca4('0x2b')];if(_0x2b1271['query'][_0xbca4('0x3e')]){_0x5f4bae['include']=[{'all':!![]}];}_0x5f4bae=_[_0xbca4('0x39')]({},_0x5f4bae,_0x2b1271[_0xbca4('0x3f')]);return db['JscriptySessionReport']['find'](_0x5f4bae)['then'](handleEntityNotFound(_0x7a7745,null))['then'](respondWithResult(_0x7a7745,null))[_0xbca4('0x40')](handleError(_0x7a7745,null));};exports['create']=function(_0x2bbe86,_0x50ad8f){return db[_0xbca4('0x28')][_0xbca4('0x41')](_0x2bbe86[_0xbca4('0x42')],{})[_0xbca4('0x21')](respondWithResult(_0x50ad8f,0xc9))[_0xbca4('0x40')](handleError(_0x50ad8f,null));};exports['update']=function(_0x15d143,_0x332037){if(_0x15d143[_0xbca4('0x42')]['id']){delete _0x15d143[_0xbca4('0x42')]['id'];}return db[_0xbca4('0x28')][_0xbca4('0x43')]({'where':{'id':_0x15d143['params']['id']}})['then'](handleEntityNotFound(_0x332037,null))['then'](saveUpdates(_0x15d143[_0xbca4('0x42')],null))[_0xbca4('0x21')](respondWithResult(_0x332037,null))[_0xbca4('0x40')](handleError(_0x332037,null));};exports['destroy']=function(_0x496811,_0x2454b7){return db[_0xbca4('0x28')][_0xbca4('0x43')]({'where':{'id':_0x496811[_0xbca4('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2454b7,null))['then'](removeEntity(_0x2454b7,null))[_0xbca4('0x40')](handleError(_0x2454b7,null));};exports[_0xbca4('0x44')]=function(_0x5c8e4a,_0x1da25c){return db['JscriptySessionReport'][_0xbca4('0x44')]()[_0xbca4('0x21')](respondWithResult(_0x1da25c,null))[_0xbca4('0x40')](handleError(_0x1da25c,null));};exports[_0xbca4('0x45')]=function(_0x11906a,_0x5bd2f0,_0x1fa464){var _0x4f86db={'raw':!![],'where':{}};var _0x54ebe8={};var _0x5efa80={'count':0x0,'rows':[]};return db[_0xbca4('0x28')][_0xbca4('0x46')]({'where':{'id':_0x11906a[_0xbca4('0x3c')]['id']}})[_0xbca4('0x21')](handleEntityNotFound(_0x5bd2f0,null))[_0xbca4('0x21')](function(_0x2e7e43){if(_0x2e7e43){_0x54ebe8[_0xbca4('0x2b')]=_[_0xbca4('0x2c')](db['JscriptyQuestionReport'][_0xbca4('0x47')]);_0x54ebe8[_0xbca4('0x2d')]=_[_0xbca4('0x2c')](_0x11906a[_0xbca4('0x2d')]);_0x54ebe8[_0xbca4('0x2e')]=_[_0xbca4('0x2f')](_0x54ebe8[_0xbca4('0x2b')],_0x54ebe8[_0xbca4('0x2d')]);_0x4f86db[_0xbca4('0x30')]=_['intersection'](_0x54ebe8[_0xbca4('0x2b')],qs['fields'](_0x11906a[_0xbca4('0x2d')][_0xbca4('0x3d')]));_0x4f86db[_0xbca4('0x30')]=_0x4f86db['attributes'][_0xbca4('0x31')]?_0x4f86db[_0xbca4('0x30')]:_0x54ebe8[_0xbca4('0x2b')];if(!_0x11906a[_0xbca4('0x2d')][_0xbca4('0x32')](_0xbca4('0x33'))){_0x4f86db['limit']=qs['limit'](_0x11906a['query'][_0xbca4('0x18')]);_0x4f86db[_0xbca4('0x1a')]=qs[_0xbca4('0x1a')](_0x11906a['query'][_0xbca4('0x1a')]);}_0x4f86db['order']=qs[_0xbca4('0x35')](_0x11906a['query']['sort']);_0x4f86db[_0xbca4('0x36')]=qs[_0xbca4('0x2e')](_['pick'](_0x11906a[_0xbca4('0x2d')],_0x54ebe8[_0xbca4('0x2e')]));_0x4f86db[_0xbca4('0x36')][_0xbca4('0x48')]=_0x2e7e43['id'];if(_0x11906a['query'][_0xbca4('0x38')]){_0x4f86db['where']=_[_0xbca4('0x39')](_0x4f86db[_0xbca4('0x36')],{'$or':_['map'](_0x4f86db[_0xbca4('0x30')],function(_0xe47a2c){var _0x3c45ea={};_0x3c45ea[_0xe47a2c]={'$like':'%'+_0x11906a[_0xbca4('0x2d')][_0xbca4('0x38')]+'%'};return _0x3c45ea;})});}_0x4f86db=_[_0xbca4('0x39')]({},_0x4f86db,_0x11906a[_0xbca4('0x3f')]);return db[_0xbca4('0x49')]['count']({'where':_0x4f86db['where']})[_0xbca4('0x21')](function(_0x47b284){_0x5efa80[_0xbca4('0x19')]=_0x47b284;if(_0x11906a[_0xbca4('0x2d')][_0xbca4('0x3e')]){_0x4f86db[_0xbca4('0x4a')]=[{'all':!![]}];}return db[_0xbca4('0x49')][_0xbca4('0x4b')](_0x4f86db);})['then'](function(_0x1962ad){_0x5efa80[_0xbca4('0x3a')]=_0x1962ad;return _0x5efa80;});}})[_0xbca4('0x21')](respondWithFilteredResult(_0x5bd2f0,_0x4f86db))[_0xbca4('0x40')](handleError(_0x5bd2f0,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index a601003..0aed342 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 _0xd8fb=['lodash','util','../../config/logger','api','path','rimraf','./jscriptySessionReport.attributes','exports','JscriptySessionReport'];(function(_0x3a93e9,_0xd77f26){var _0xd4e34=function(_0x2255c8){while(--_0x2255c8){_0x3a93e9['push'](_0x3a93e9['shift']());}};_0xd4e34(++_0xd77f26);}(_0xd8fb,0x99));var _0xbd8f=function(_0x51a3c2,_0x3b6604){_0x51a3c2=_0x51a3c2-0x0;var _0x19526f=_0xd8fb[_0x51a3c2];return _0x19526f;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x46ed,0x168));var _0xd46e=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x46ed[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 5b6729e..fb611a1 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 _0xfcf0=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util','bluebird'];(function(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0xfcf0,0x138));var _0x0fcf=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0xfcf0[_0x406e46];return _0x4a3742;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});} \ No newline at end of file +var _0x68b3=['rpc','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x516be,_0x3a2be5){var _0x2efad4=function(_0x4946a2){while(--_0x4946a2){_0x516be['push'](_0x516be['shift']());}};_0x2efad4(++_0x3a2be5);}(_0x68b3,0x1d8));var _0x368b=function(_0x1d2f38,_0x4b7c23){_0x1d2f38=_0x1d2f38-0x0;var _0x532ab5=_0x68b3[_0x1d2f38];return _0x532ab5;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index fa0c3da..33b73cf 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 _0xc9a8=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','update','/download_log_file','downloadLogFile','multer','path'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc9a8,0x1da));var _0x8c9a=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xc9a8[_0x580647];return _0x5f0792;};'use strict';var multer=require(_0x8c9a('0x0'));var util=require('util');var path=require(_0x8c9a('0x1'));var timeout=require(_0x8c9a('0x2'));var express=require(_0x8c9a('0x3'));var router=express[_0x8c9a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8c9a('0x5'));var config=require(_0x8c9a('0x6'));var controller=require(_0x8c9a('0x7'));router[_0x8c9a('0x8')]('/',controller['index']);router[_0x8c9a('0x9')](_0x8c9a('0xa'),auth['isAuthenticated'](),controller[_0x8c9a('0xb')]);router[_0x8c9a('0x8')](_0x8c9a('0xc'),auth['isAuthenticated'](),controller[_0x8c9a('0xd')]);module['exports']=router; \ No newline at end of file +var _0x62bd=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x62bd,0x160));var _0xd62b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62bd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd62b('0x0'));var timeout=require(_0xd62b('0x1'));var express=require(_0xd62b('0x2'));var router=express[_0xd62b('0x3')]();var fs_extra=require(_0xd62b('0x4'));var auth=require(_0xd62b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd62b('0x6'));var controller=require('./license.controller');router[_0xd62b('0x7')]('/',controller[_0xd62b('0x8')]);router[_0xd62b('0x9')](_0xd62b('0xa'),auth[_0xd62b('0xb')](),controller[_0xd62b('0xc')]);router[_0xd62b('0x7')](_0xd62b('0xd'),auth['isAuthenticated'](),controller[_0xd62b('0xe')]);module[_0xd62b('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 3866f2f..d4e4a0b 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 _0x0091=['STRING','INTEGER','sequelize','TEXT'];(function(_0x14d307,_0x512e11){var _0x51d629=function(_0x1b8ed6){while(--_0x1b8ed6){_0x14d307['push'](_0x14d307['shift']());}};_0x51d629(++_0x512e11);}(_0x0091,0x12a));var _0x1009=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0091[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x1009('0x0'));module['exports']={'license':{'type':Sequelize[_0x1009('0x1')]},'data1':{'type':Sequelize[_0x1009('0x2')]},'data2':{'type':Sequelize[_0x1009('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x1009('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3944=['sequelize','exports','TEXT','STRING'];(function(_0x3c6105,_0x583795){var _0x553e3b=function(_0x26b45){while(--_0x26b45){_0x3c6105['push'](_0x3c6105['shift']());}};_0x553e3b(++_0x583795);}(_0x3944,0x1b0));var _0x4394=function(_0x453ac0,_0x54d1ca){_0x453ac0=_0x453ac0-0x0;var _0x19b300=_0x3944[_0x453ac0];return _0x19b300;};'use strict';var Sequelize=require(_0x4394('0x0'));module[_0x4394('0x1')]={'license':{'type':Sequelize[_0x4394('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x4394('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 7a7d236..9b0a1e9 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 _0x4223=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','../../config/license/util','index','keys','License','query','intersection','model','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','downloadLogFile','join','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','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/qs','../../components/parsers/advancedSearch'];(function(_0x17357f,_0xe5ae66){var _0x283ab9=function(_0x49013c){while(--_0x49013c){_0x17357f['push'](_0x17357f['shift']());}};_0x283ab9(++_0xe5ae66);}(_0x4223,0x1bc));var _0x3422=function(_0x2e2efa,_0x170000){_0x2e2efa=_0x2e2efa-0x0;var _0x299cc7=_0x4223[_0x2e2efa];return _0x299cc7;};'use strict';var emlformat=require(_0x3422('0x0'));var rimraf=require(_0x3422('0x1'));var zipdir=require(_0x3422('0x2'));var jsonpatch=require(_0x3422('0x3'));var rp=require(_0x3422('0x4'));var moment=require(_0x3422('0x5'));var BPromise=require(_0x3422('0x6'));var Mustache=require(_0x3422('0x7'));var util=require(_0x3422('0x8'));var path=require(_0x3422('0x9'));var sox=require(_0x3422('0xa'));var csv=require(_0x3422('0xb'));var ejs=require(_0x3422('0xc'));var fs=require('fs');var fs_extra=require(_0x3422('0xd'));var _=require(_0x3422('0xe'));var squel=require('squel');var crypto=require(_0x3422('0xf'));var jsforce=require(_0x3422('0x10'));var deskjs=require(_0x3422('0x11'));var toCsv=require(_0x3422('0xb'));var querystring=require(_0x3422('0x12'));var Papa=require(_0x3422('0x13'));var Redis=require(_0x3422('0x14'));var authService=require(_0x3422('0x15'));var qs=require(_0x3422('0x16'));var as=require(_0x3422('0x17'));var hardwareService=require(_0x3422('0x18'));var logger=require('../../config/logger')(_0x3422('0x19'));var utils=require(_0x3422('0x1a'));var config=require(_0x3422('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x3422('0x1c'))['db'];function respondWithStatusCode(_0x57723b,_0x1314c7){_0x1314c7=_0x1314c7||0xcc;return function(_0x1d3bd8){if(_0x1d3bd8){return _0x57723b[_0x3422('0x1d')](_0x1314c7);}return _0x57723b[_0x3422('0x1e')](_0x1314c7)[_0x3422('0x1f')]();};}function respondWithResult(_0x56b558,_0x2d9768){_0x2d9768=_0x2d9768||0xc8;return function(_0x35ed51){if(_0x35ed51){return _0x56b558['status'](_0x2d9768)[_0x3422('0x20')](_0x35ed51);}};}function respondWithFilteredResult(_0x3114a3,_0x260d0f){return function(_0x35c5c1){if(_0x35c5c1){var _0x2c9ead=typeof _0x260d0f[_0x3422('0x21')]===_0x3422('0x22')&&typeof _0x260d0f[_0x3422('0x23')]===_0x3422('0x22');var _0x4c478e=_0x35c5c1[_0x3422('0x24')];var _0x58ca42=_0x2c9ead?0x0:_0x260d0f[_0x3422('0x21')];var _0x27ae0b=_0x2c9ead?_0x35c5c1[_0x3422('0x24')]:_0x260d0f[_0x3422('0x21')]+_0x260d0f[_0x3422('0x23')];var _0x2fc26a;if(_0x27ae0b>=_0x4c478e){_0x27ae0b=_0x4c478e;_0x2fc26a=0xc8;}else{_0x2fc26a=0xce;}_0x3114a3[_0x3422('0x1e')](_0x2fc26a);return _0x3114a3[_0x3422('0x25')](_0x3422('0x26'),_0x58ca42+'-'+_0x27ae0b+'/'+_0x4c478e)[_0x3422('0x20')](_0x35c5c1);}return null;};}function patchUpdates(_0x3ba0f5){return function(_0x32b981){try{jsonpatch['apply'](_0x32b981,_0x3ba0f5,!![]);}catch(_0x55738e){return BPromise[_0x3422('0x27')](_0x55738e);}return _0x32b981[_0x3422('0x28')]();};}function saveUpdates(_0x135eea,_0x4c8490){return function(_0x33878c){if(_0x33878c){return _0x33878c[_0x3422('0x29')](_0x135eea)[_0x3422('0x2a')](function(_0x333b8f){return _0x333b8f;});}return null;};}function removeEntity(_0x1350c6,_0x413012){return function(_0x24971c){if(_0x24971c){return _0x24971c[_0x3422('0x2b')]()[_0x3422('0x2a')](function(){_0x1350c6[_0x3422('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51da62,_0x2b7676){return function(_0x243c90){if(!_0x243c90){_0x51da62[_0x3422('0x1d')](0x194);}return _0x243c90;};}function handleError(_0x4f9218,_0xd1dd52){_0xd1dd52=_0xd1dd52||0x1f4;return function(_0x4c05d9){logger['error'](_0x4c05d9[_0x3422('0x2c')]);if(_0x4c05d9['name']){delete _0x4c05d9[_0x3422('0x2d')];}_0x4f9218[_0x3422('0x1e')](_0xd1dd52)[_0x3422('0x2e')](_0x4c05d9);};}var utilLicense=require(_0x3422('0x2f'));exports[_0x3422('0x30')]=function(_0x8db738,_0x30e076){var _0x5d5218={'raw':!![],'where':{'id':0x1}},_0x57e4e3={};_0x57e4e3['model']=_[_0x3422('0x31')](db[_0x3422('0x32')]['rawAttributes']);_0x57e4e3[_0x3422('0x33')]=_[_0x3422('0x31')](_0x8db738[_0x3422('0x33')]);_0x57e4e3['filters']=_[_0x3422('0x34')](_0x57e4e3[_0x3422('0x35')],_0x57e4e3[_0x3422('0x33')]);_0x5d5218[_0x3422('0x36')]=_[_0x3422('0x34')](_0x57e4e3[_0x3422('0x35')],qs['fields'](_0x8db738[_0x3422('0x33')][_0x3422('0x37')]));_0x5d5218['attributes']=_0x5d5218['attributes'][_0x3422('0x38')]?_0x5d5218[_0x3422('0x36')]:_0x57e4e3['model'];_0x5d5218=_[_0x3422('0x39')]({},_0x5d5218,_0x8db738[_0x3422('0x3a')]);return utilLicense[_0x3422('0x3b')](_0x5d5218)[_0x3422('0x2a')](respondWithResult(_0x30e076,null))[_0x3422('0x3c')](handleError(_0x30e076,null));};exports[_0x3422('0x29')]=function(_0x1cfc46,_0x524eb7){if(_0x1cfc46[_0x3422('0x3d')]['id']){delete _0x1cfc46[_0x3422('0x3d')]['id'];}return db[_0x3422('0x32')][_0x3422('0x3e')]({'where':{'id':_0x1cfc46[_0x3422('0x3f')]['id']}})[_0x3422('0x2a')](handleEntityNotFound(_0x524eb7,null))['then'](function(_0x324961){var _0x2ef30f=_0x324961[_0x3422('0x40')]({'plain':!![]});return utilLicense[_0x3422('0x41')](_0x2ef30f,_0x1cfc46[_0x3422('0x3d')][_0x3422('0x42')]);})[_0x3422('0x2a')](function(_0x32d6ce){if(!_0x32d6ce[_0x3422('0x43')]){return saveUpdates(_0x1cfc46[_0x3422('0x3d')],null);}return _0x32d6ce;})[_0x3422('0x2a')](respondWithResult(_0x524eb7,null))[_0x3422('0x3c')](handleError(_0x524eb7,null));};exports[_0x3422('0x44')]=function(_0x80a1f7,_0x37c1a7){var _0x46fca1='license-info.log';var _0x1f2cd2=path[_0x3422('0x45')]('/var',_0x3422('0x46'),_0x3422('0x47'),_0x46fca1);_0x37c1a7[_0x3422('0x48')](_0x3422('0x49'),_0x3422('0x4a')+_0x46fca1);_0x37c1a7[_0x3422('0x25')](_0x3422('0x4b'),_0x3422('0x4c'));_0x37c1a7[_0x3422('0x4d')](_0x1f2cd2);}; \ No newline at end of file +var _0x4270=['length','merge','options','getLicense','catch','body','find','params','get','key','demo','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields'];(function(_0x41a76e,_0x240c5c){var _0x446db8=function(_0x43a08e){while(--_0x43a08e){_0x41a76e['push'](_0x41a76e['shift']());}};_0x446db8(++_0x240c5c);}(_0x4270,0xf5));var _0x0427=function(_0x2e23b7,_0x33654d){_0x2e23b7=_0x2e23b7-0x0;var _0x249154=_0x4270[_0x2e23b7];return _0x249154;};'use strict';var emlformat=require(_0x0427('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0427('0x1'));var jsonpatch=require(_0x0427('0x2'));var rp=require(_0x0427('0x3'));var moment=require(_0x0427('0x4'));var BPromise=require(_0x0427('0x5'));var Mustache=require(_0x0427('0x6'));var util=require(_0x0427('0x7'));var path=require(_0x0427('0x8'));var sox=require(_0x0427('0x9'));var csv=require('to-csv');var ejs=require(_0x0427('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0427('0xb'));var squel=require(_0x0427('0xc'));var crypto=require(_0x0427('0xd'));var jsforce=require(_0x0427('0xe'));var deskjs=require(_0x0427('0xf'));var toCsv=require(_0x0427('0x10'));var querystring=require(_0x0427('0x11'));var Papa=require(_0x0427('0x12'));var Redis=require(_0x0427('0x13'));var authService=require(_0x0427('0x14'));var qs=require(_0x0427('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0427('0x16'))(_0x0427('0x17'));var utils=require('../../config/utils');var config=require(_0x0427('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0427('0x19'))['db'];function respondWithStatusCode(_0x517f11,_0x3f0c0f){_0x3f0c0f=_0x3f0c0f||0xcc;return function(_0xa8addf){if(_0xa8addf){return _0x517f11[_0x0427('0x1a')](_0x3f0c0f);}return _0x517f11[_0x0427('0x1b')](_0x3f0c0f)[_0x0427('0x1c')]();};}function respondWithResult(_0x5473b4,_0x4d295a){_0x4d295a=_0x4d295a||0xc8;return function(_0x2b8968){if(_0x2b8968){return _0x5473b4[_0x0427('0x1b')](_0x4d295a)[_0x0427('0x1d')](_0x2b8968);}};}function respondWithFilteredResult(_0x13cc57,_0x2902ee){return function(_0x4da09e){if(_0x4da09e){var _0x4dd5cd=typeof _0x2902ee[_0x0427('0x1e')]===_0x0427('0x1f')&&typeof _0x2902ee[_0x0427('0x20')]===_0x0427('0x1f');var _0x296089=_0x4da09e[_0x0427('0x21')];var _0x44783c=_0x4dd5cd?0x0:_0x2902ee[_0x0427('0x1e')];var _0x1ec29d=_0x4dd5cd?_0x4da09e[_0x0427('0x21')]:_0x2902ee['offset']+_0x2902ee['limit'];var _0x1a306c;if(_0x1ec29d>=_0x296089){_0x1ec29d=_0x296089;_0x1a306c=0xc8;}else{_0x1a306c=0xce;}_0x13cc57['status'](_0x1a306c);return _0x13cc57[_0x0427('0x22')](_0x0427('0x23'),_0x44783c+'-'+_0x1ec29d+'/'+_0x296089)[_0x0427('0x1d')](_0x4da09e);}return null;};}function patchUpdates(_0x20c23e){return function(_0x1695b7){try{jsonpatch['apply'](_0x1695b7,_0x20c23e,!![]);}catch(_0x43291b){return BPromise[_0x0427('0x24')](_0x43291b);}return _0x1695b7[_0x0427('0x25')]();};}function saveUpdates(_0x36dcae,_0x366709){return function(_0xff6b43){if(_0xff6b43){return _0xff6b43[_0x0427('0x26')](_0x36dcae)[_0x0427('0x27')](function(_0x39e39e){return _0x39e39e;});}return null;};}function removeEntity(_0x4dbdc6,_0x391980){return function(_0x58b53a){if(_0x58b53a){return _0x58b53a[_0x0427('0x28')]()[_0x0427('0x27')](function(){_0x4dbdc6[_0x0427('0x1b')](0xcc)[_0x0427('0x1c')]();});}};}function handleEntityNotFound(_0x2b20a6,_0x1a599d){return function(_0x3e7397){if(!_0x3e7397){_0x2b20a6[_0x0427('0x1a')](0x194);}return _0x3e7397;};}function handleError(_0x30be25,_0x3d3d9f){_0x3d3d9f=_0x3d3d9f||0x1f4;return function(_0x3d07bb){logger['error'](_0x3d07bb[_0x0427('0x29')]);if(_0x3d07bb[_0x0427('0x2a')]){delete _0x3d07bb[_0x0427('0x2a')];}_0x30be25[_0x0427('0x1b')](_0x3d3d9f)[_0x0427('0x2b')](_0x3d07bb);};}var utilLicense=require(_0x0427('0x2c'));exports[_0x0427('0x2d')]=function(_0x488343,_0x3f2609){var _0x56968f={'raw':!![],'where':{'id':0x1}},_0xc08bfb={};_0xc08bfb[_0x0427('0x2e')]=_[_0x0427('0x2f')](db[_0x0427('0x30')][_0x0427('0x31')]);_0xc08bfb[_0x0427('0x32')]=_['keys'](_0x488343[_0x0427('0x32')]);_0xc08bfb[_0x0427('0x33')]=_[_0x0427('0x34')](_0xc08bfb[_0x0427('0x2e')],_0xc08bfb['query']);_0x56968f[_0x0427('0x35')]=_[_0x0427('0x34')](_0xc08bfb[_0x0427('0x2e')],qs[_0x0427('0x36')](_0x488343[_0x0427('0x32')][_0x0427('0x36')]));_0x56968f['attributes']=_0x56968f[_0x0427('0x35')][_0x0427('0x37')]?_0x56968f['attributes']:_0xc08bfb[_0x0427('0x2e')];_0x56968f=_[_0x0427('0x38')]({},_0x56968f,_0x488343[_0x0427('0x39')]);return utilLicense[_0x0427('0x3a')](_0x56968f)[_0x0427('0x27')](respondWithResult(_0x3f2609,null))[_0x0427('0x3b')](handleError(_0x3f2609,null));};exports['update']=function(_0x5bb3f0,_0x39b8c5){if(_0x5bb3f0['body']['id']){delete _0x5bb3f0[_0x0427('0x3c')]['id'];}return db['License'][_0x0427('0x3d')]({'where':{'id':_0x5bb3f0[_0x0427('0x3e')]['id']}})[_0x0427('0x27')](handleEntityNotFound(_0x39b8c5,null))[_0x0427('0x27')](function(_0x289496){var _0x5bd8fe=_0x289496[_0x0427('0x3f')]({'plain':!![]});return utilLicense['checkLicense'](_0x5bd8fe,_0x5bb3f0['body'][_0x0427('0x40')]);})['then'](function(_0x5e8d6e){if(!_0x5e8d6e[_0x0427('0x41')]){return saveUpdates(_0x5bb3f0[_0x0427('0x3c')],null);}return _0x5e8d6e;})['then'](respondWithResult(_0x39b8c5,null))[_0x0427('0x3b')](handleError(_0x39b8c5,null));};exports['downloadLogFile']=function(_0x5717ef,_0x2b14d){var _0x12776b=_0x0427('0x42');var _0x13f945=path[_0x0427('0x43')](_0x0427('0x44'),_0x0427('0x45'),_0x0427('0x46'),_0x12776b);_0x2b14d[_0x0427('0x47')](_0x0427('0x48'),_0x0427('0x49')+_0x12776b);_0x2b14d['set'](_0x0427('0x4a'),'text/plain');_0x2b14d['download'](_0x13f945);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index ba9c368..2eb977a 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 _0x2118=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash'];(function(_0x4fa92b,_0x7d972){var _0x2a6579=function(_0x1642a3){while(--_0x1642a3){_0x4fa92b['push'](_0x4fa92b['shift']());}};_0x2a6579(++_0x7d972);}(_0x2118,0x15e));var _0x8211=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x2118[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x8211('0x0'));var util=require('util');var logger=require(_0x8211('0x1'))(_0x8211('0x2'));var moment=require(_0x8211('0x3'));var BPromise=require('bluebird');var rp=require(_0x8211('0x4'));var fs=require('fs');var path=require(_0x8211('0x5'));var rimraf=require(_0x8211('0x6'));var config=require(_0x8211('0x7'));var attributes=require(_0x8211('0x8'));module[_0x8211('0x9')]=function(_0x400b2d,_0x509ec6){return _0x400b2d[_0x8211('0xa')](_0x8211('0xb'),attributes,{'tableName':_0x8211('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa892=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','define','License','license'];(function(_0x3e6a35,_0x6e5fb){var _0x134bcf=function(_0x68a0cd){while(--_0x68a0cd){_0x3e6a35['push'](_0x3e6a35['shift']());}};_0x134bcf(++_0x6e5fb);}(_0xa892,0x11e));var _0x2a89=function(_0x576756,_0x13d487){_0x576756=_0x576756-0x0;var _0x33c1a0=_0xa892[_0x576756];return _0x33c1a0;};'use strict';var _=require(_0x2a89('0x0'));var util=require(_0x2a89('0x1'));var logger=require(_0x2a89('0x2'))('api');var moment=require(_0x2a89('0x3'));var BPromise=require(_0x2a89('0x4'));var rp=require(_0x2a89('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a89('0x6'));var config=require(_0x2a89('0x7'));var attributes=require(_0x2a89('0x8'));module[_0x2a89('0x9')]=function(_0x28d8b5,_0x22974e){return _0x28d8b5[_0x2a89('0xa')](_0x2a89('0xb'),attributes,{'tableName':_0x2a89('0xc'),'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 06616ed..434389d 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 _0x89ef=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','License,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2e78d8,_0x36ecc4){var _0x223dd7=function(_0x1a3c1b){while(--_0x1a3c1b){_0x2e78d8['push'](_0x2e78d8['shift']());}};_0x223dd7(++_0x36ecc4);}(_0x89ef,0x1ba));var _0xf89e=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0x89ef[_0x261e29];return _0x25ef43;};'use strict';var _=require(_0xf89e('0x0'));var util=require(_0xf89e('0x1'));var moment=require(_0xf89e('0x2'));var BPromise=require(_0xf89e('0x3'));var rs=require(_0xf89e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf89e('0x5'))['db'];var utils=require(_0xf89e('0x6'));var logger=require(_0xf89e('0x7'))(_0xf89e('0x8'));var config=require(_0xf89e('0x9'));var jayson=require(_0xf89e('0xa'));var client=jayson[_0xf89e('0xb')][_0xf89e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x173738,_0x33bf8b,_0x17db91){return new BPromise(function(_0x20ab99,_0x4d9f1f){return client[_0xf89e('0xd')](_0x173738,_0x17db91)['then'](function(_0x87f30c){logger[_0xf89e('0xe')]('License,\x20%s,\x20%s',_0x33bf8b,_0xf89e('0xf'));logger[_0xf89e('0x10')](_0xf89e('0x11'),_0x33bf8b,'request\x20sent',JSON[_0xf89e('0x12')](_0x87f30c));if(_0x87f30c[_0xf89e('0x13')]){if(_0x87f30c['error'][_0xf89e('0x14')]===0x1f4){logger[_0xf89e('0x13')]('License,\x20%s,\x20%s',_0x33bf8b,_0x87f30c[_0xf89e('0x13')][_0xf89e('0x15')]);return _0x4d9f1f(_0x87f30c[_0xf89e('0x13')]['message']);}logger['error'](_0xf89e('0x16'),_0x33bf8b,_0x87f30c[_0xf89e('0x13')][_0xf89e('0x15')]);return _0x20ab99(_0x87f30c[_0xf89e('0x13')]['message']);}else{logger[_0xf89e('0xe')](_0xf89e('0x16'),_0x33bf8b,_0xf89e('0xf'));_0x20ab99(_0x87f30c[_0xf89e('0x17')][_0xf89e('0x15')]);}})[_0xf89e('0x18')](function(_0x350c78){logger[_0xf89e('0x13')]('License,\x20%s,\x20%s',_0x33bf8b,_0x350c78);_0x4d9f1f(_0x350c78);});});} \ No newline at end of file +var _0xb36f=['util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x404843,_0x497fa4){var _0x41f2de=function(_0x3912ba){while(--_0x3912ba){_0x404843['push'](_0x404843['shift']());}};_0x41f2de(++_0x497fa4);}(_0xb36f,0x168));var _0xfb36=function(_0x3dcadc,_0x39adee){_0x3dcadc=_0x3dcadc-0x0;var _0x53f547=_0xb36f[_0x3dcadc];return _0x53f547;};'use strict';var _=require(_0xfb36('0x0'));var util=require(_0xfb36('0x1'));var moment=require(_0xfb36('0x2'));var BPromise=require(_0xfb36('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfb36('0x4'));var logger=require(_0xfb36('0x5'))(_0xfb36('0x6'));var config=require('../../config/environment');var jayson=require(_0xfb36('0x7'));var client=jayson['client'][_0xfb36('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x322e99,_0x2514ca,_0xb3d244){return new BPromise(function(_0xb60e76,_0x58c8f1){return client['request'](_0x322e99,_0xb3d244)[_0xfb36('0x9')](function(_0x3a4d5a){logger['info'](_0xfb36('0xa'),_0x2514ca,_0xfb36('0xb'));logger[_0xfb36('0xc')]('License,\x20%s,\x20%s,\x20%s',_0x2514ca,_0xfb36('0xb'),JSON[_0xfb36('0xd')](_0x3a4d5a));if(_0x3a4d5a[_0xfb36('0xe')]){if(_0x3a4d5a[_0xfb36('0xe')][_0xfb36('0xf')]===0x1f4){logger['error'](_0xfb36('0xa'),_0x2514ca,_0x3a4d5a[_0xfb36('0xe')][_0xfb36('0x10')]);return _0x58c8f1(_0x3a4d5a['error'][_0xfb36('0x10')]);}logger['error'](_0xfb36('0xa'),_0x2514ca,_0x3a4d5a[_0xfb36('0xe')]['message']);return _0xb60e76(_0x3a4d5a[_0xfb36('0xe')][_0xfb36('0x10')]);}else{logger['info'](_0xfb36('0xa'),_0x2514ca,_0xfb36('0xb'));_0xb60e76(_0x3a4d5a[_0xfb36('0x11')][_0xfb36('0x10')]);}})[_0xfb36('0x12')](function(_0x3ab8a6){logger[_0xfb36('0xe')](_0xfb36('0xa'),_0x2514ca,_0x3ab8a6);_0x58c8f1(_0x3ab8a6);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 15856b5..7e477be 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 _0xbac7=['../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','post','addDisposition','/:id/canned_answers','create','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x54ed1d,_0x32a01c){var _0x1494ac=function(_0x37b56e){while(--_0x37b56e){_0x54ed1d['push'](_0x54ed1d['shift']());}};_0x1494ac(++_0x32a01c);}(_0xbac7,0x149));var _0x7bac=function(_0x5e84ad,_0x1189ec){_0x5e84ad=_0x5e84ad-0x0;var _0x5a88e5=_0xbac7[_0x5e84ad];return _0x5a88e5;};'use strict';var multer=require(_0x7bac('0x0'));var util=require(_0x7bac('0x1'));var path=require(_0x7bac('0x2'));var timeout=require(_0x7bac('0x3'));var express=require(_0x7bac('0x4'));var router=express['Router']();var fs_extra=require(_0x7bac('0x5'));var auth=require(_0x7bac('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7bac('0x7'));var controller=require(_0x7bac('0x8'));router[_0x7bac('0x9')]('/',auth[_0x7bac('0xa')](),controller[_0x7bac('0xb')]);router[_0x7bac('0x9')](_0x7bac('0xc'),auth[_0x7bac('0xa')](),controller['describe']);router['get'](_0x7bac('0xd'),auth[_0x7bac('0xa')](),controller[_0x7bac('0xe')]);router[_0x7bac('0x9')](_0x7bac('0xf'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x10')]);router[_0x7bac('0x9')]('/:id/canned_answers',auth[_0x7bac('0xa')](),controller[_0x7bac('0x11')]);router[_0x7bac('0x9')](_0x7bac('0x12'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x13')]);router['get'](_0x7bac('0x14'),auth[_0x7bac('0xa')](),controller['getSmtp']);router[_0x7bac('0x9')](_0x7bac('0x15'),auth['isAuthenticated'](),controller[_0x7bac('0x16')]);router[_0x7bac('0x9')](_0x7bac('0x17'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x18')]);router['get'](_0x7bac('0x19'),auth[_0x7bac('0xa')](),controller['getMessages']);router[_0x7bac('0x9')](_0x7bac('0x1a'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x1b')]);router[_0x7bac('0x9')](_0x7bac('0x1c'),auth[_0x7bac('0xa')](),controller['getAgents']);router[_0x7bac('0x1d')]('/:id/dispositions',auth[_0x7bac('0xa')](),controller[_0x7bac('0x1e')]);router[_0x7bac('0x1d')](_0x7bac('0x1f'),auth['isAuthenticated'](),controller['addAnswer']);router['post']('/',auth[_0x7bac('0xa')](),controller[_0x7bac('0x20')]);router[_0x7bac('0x1d')]('/:id/in_servers',auth[_0x7bac('0xa')](),controller['addImap']);router[_0x7bac('0x1d')](_0x7bac('0x14'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x21')]);router[_0x7bac('0x1d')](_0x7bac('0x15'),auth['isAuthenticated'](),controller[_0x7bac('0x22')]);router[_0x7bac('0x1d')](_0x7bac('0x17'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x23')]);router['post'](_0x7bac('0x24'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x25')]);router[_0x7bac('0x1d')]('/:id/users',auth[_0x7bac('0xa')](),controller[_0x7bac('0x26')]);router[_0x7bac('0x27')](_0x7bac('0xd'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x28')]);router[_0x7bac('0x29')](_0x7bac('0xf'),auth['isAuthenticated'](),controller[_0x7bac('0x2a')]);router[_0x7bac('0x29')](_0x7bac('0x1f'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x2b')]);router[_0x7bac('0x29')](_0x7bac('0x12'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x2c')]);router[_0x7bac('0x29')]('/:id/out_servers',auth[_0x7bac('0xa')](),controller[_0x7bac('0x2d')]);router['delete']('/:id',auth[_0x7bac('0xa')](),controller['destroy']);router[_0x7bac('0x29')](_0x7bac('0x1c'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x2e')]);module[_0x7bac('0x2f')]=router; \ No newline at end of file +var _0x0b4e=['addApplications','/:id/send','send','/:id/users','addAgents','put','delete','removeDispositions','removeImap','removeSmtp','destroy','removeAgents','exports','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','get','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','post','addDisposition','addAnswer','create','addImap','addInteraction'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0x0b4e,0xee));var _0xe0b4=function(_0x5b6b78,_0x3103e5){_0x5b6b78=_0x5b6b78-0x0;var _0x589b38=_0x0b4e[_0x5b6b78];return _0x589b38;};'use strict';var multer=require('multer');var util=require(_0xe0b4('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe0b4('0x1')]();var fs_extra=require(_0xe0b4('0x2'));var auth=require(_0xe0b4('0x3'));var interaction=require(_0xe0b4('0x4'));var config=require(_0xe0b4('0x5'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0xe0b4('0x6')](),controller[_0xe0b4('0x7')]);router['get'](_0xe0b4('0x8'),auth[_0xe0b4('0x6')](),controller[_0xe0b4('0x9')]);router['get'](_0xe0b4('0xa'),auth[_0xe0b4('0x6')](),controller['show']);router[_0xe0b4('0xb')](_0xe0b4('0xc'),auth[_0xe0b4('0x6')](),controller[_0xe0b4('0xd')]);router[_0xe0b4('0xb')](_0xe0b4('0xe'),auth[_0xe0b4('0x6')](),controller['getAnswers']);router['get'](_0xe0b4('0xf'),auth[_0xe0b4('0x6')](),controller[_0xe0b4('0x10')]);router[_0xe0b4('0xb')](_0xe0b4('0x11'),auth['isAuthenticated'](),controller[_0xe0b4('0x12')]);router[_0xe0b4('0xb')](_0xe0b4('0x13'),auth[_0xe0b4('0x6')](),controller[_0xe0b4('0x14')]);router[_0xe0b4('0xb')](_0xe0b4('0x15'),auth[_0xe0b4('0x6')](),controller['getApplications']);router[_0xe0b4('0xb')](_0xe0b4('0x16'),auth['isAuthenticated'](),controller[_0xe0b4('0x17')]);router[_0xe0b4('0xb')](_0xe0b4('0x18'),auth[_0xe0b4('0x6')](),controller[_0xe0b4('0x19')]);router[_0xe0b4('0xb')]('/:id/users',auth[_0xe0b4('0x6')](),controller['getAgents']);router[_0xe0b4('0x1a')](_0xe0b4('0xc'),auth['isAuthenticated'](),controller[_0xe0b4('0x1b')]);router[_0xe0b4('0x1a')](_0xe0b4('0xe'),auth['isAuthenticated'](),controller[_0xe0b4('0x1c')]);router[_0xe0b4('0x1a')]('/',auth[_0xe0b4('0x6')](),controller[_0xe0b4('0x1d')]);router['post'](_0xe0b4('0xf'),auth[_0xe0b4('0x6')](),controller[_0xe0b4('0x1e')]);router[_0xe0b4('0x1a')]('/:id/out_servers',auth[_0xe0b4('0x6')](),controller['addSmtp']);router['post'](_0xe0b4('0x13'),auth[_0xe0b4('0x6')](),controller[_0xe0b4('0x1f')]);router[_0xe0b4('0x1a')](_0xe0b4('0x15'),auth[_0xe0b4('0x6')](),controller[_0xe0b4('0x20')]);router['post'](_0xe0b4('0x21'),auth[_0xe0b4('0x6')](),controller[_0xe0b4('0x22')]);router['post'](_0xe0b4('0x23'),auth[_0xe0b4('0x6')](),controller[_0xe0b4('0x24')]);router[_0xe0b4('0x25')](_0xe0b4('0xa'),auth[_0xe0b4('0x6')](),controller['update']);router[_0xe0b4('0x26')]('/:id/dispositions',auth[_0xe0b4('0x6')](),controller[_0xe0b4('0x27')]);router[_0xe0b4('0x26')](_0xe0b4('0xe'),auth[_0xe0b4('0x6')](),controller['removeAnswers']);router[_0xe0b4('0x26')](_0xe0b4('0xf'),auth['isAuthenticated'](),controller[_0xe0b4('0x28')]);router[_0xe0b4('0x26')](_0xe0b4('0x11'),auth['isAuthenticated'](),controller[_0xe0b4('0x29')]);router[_0xe0b4('0x26')]('/:id',auth['isAuthenticated'](),controller[_0xe0b4('0x2a')]);router[_0xe0b4('0x26')]('/:id/users',auth[_0xe0b4('0x6')](),controller[_0xe0b4('0x2b')]);module[_0xe0b4('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 850a997..f3b6a2a 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 _0xcc69=['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','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcc69,0x7a));var _0x9cc6=function(_0x1f2b50,_0x20b570){_0x1f2b50=_0x1f2b50-0x0;var _0x5675c1=_0xcc69[_0x1f2b50];return _0x5675c1;};'use strict';var Sequelize=require(_0x9cc6('0x0'));module[_0x9cc6('0x1')]={'description':{'type':Sequelize[_0x9cc6('0x2')]},'name':{'type':Sequelize[_0x9cc6('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x9cc6('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9cc6('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9cc6('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x9cc6('0x4')]},'markAsUnread':{'type':Sequelize[_0x9cc6('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9cc6('0x5')},'fontSize':{'type':Sequelize[_0x9cc6('0x6')](0x2)[_0x9cc6('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9cc6('0x4')],'defaultValue':function(){return _0x9cc6('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9cc6('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9cc6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9cc6('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9cc6('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9cc6('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x9cc6('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9cc6('0xa'),'set':function(_0x330529){if(!_0x330529)this[_0x9cc6('0xb')](_0x9cc6('0xc'),null);this[_0x9cc6('0xb')]('mandatoryDisposition',_0x330529);}},'provider':{'type':Sequelize[_0x9cc6('0xd')](_0x9cc6('0xe'),_0x9cc6('0xf'),_0x9cc6('0x10'),_0x9cc6('0x11')),'defaultValue':null,'get':function(){if(!this[_0x9cc6('0x12')](_0x9cc6('0x13')))return _0x9cc6('0x14');return this[_0x9cc6('0x12')](_0x9cc6('0x13'));},'set':function(_0x55351c){if(_0x55351c==='custom')_0x55351c=null;return this[_0x9cc6('0xb')](_0x9cc6('0x13'),_0x55351c);}}}; \ No newline at end of file +var _0xd5b8=['exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','hotmail','yahoo','outlook365','getDataValue','provider','custom'];(function(_0x437c65,_0x4506a3){var _0x4a4e74=function(_0x4ab287){while(--_0x4ab287){_0x437c65['push'](_0x437c65['shift']());}};_0x4a4e74(++_0x4506a3);}(_0xd5b8,0x130));var _0x8d5b=function(_0x5d6ea1,_0x264820){_0x5d6ea1=_0x5d6ea1-0x0;var _0x522297=_0xd5b8[_0x5d6ea1];return _0x522297;};'use strict';var Sequelize=require('sequelize');module[_0x8d5b('0x0')]={'description':{'type':Sequelize[_0x8d5b('0x1')]},'name':{'type':Sequelize[_0x8d5b('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x8d5b('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x8d5b('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x8d5b('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x8d5b('0x3')]},'markAsUnread':{'type':Sequelize[_0x8d5b('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x8d5b('0x1')],'allowNull':![],'defaultValue':_0x8d5b('0x4')},'fontSize':{'type':Sequelize[_0x8d5b('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x8d5b('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x8d5b('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8d5b('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8d5b('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8d5b('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8d5b('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8d5b('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8d5b('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8d5b('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x8d5b('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x8d5b('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x347c6e){if(!_0x347c6e)this[_0x8d5b('0x7')](_0x8d5b('0x8'),null);this[_0x8d5b('0x7')](_0x8d5b('0x9'),_0x347c6e);}},'provider':{'type':Sequelize['ENUM']('gmail',_0x8d5b('0xa'),_0x8d5b('0xb'),_0x8d5b('0xc')),'defaultValue':null,'get':function(){if(!this[_0x8d5b('0xd')](_0x8d5b('0xe')))return _0x8d5b('0xf');return this[_0x8d5b('0xd')]('provider');},'set':function(_0x10ff24){if(_0x10ff24==='custom')_0x10ff24=null;return this[_0x8d5b('0x7')](_0x8d5b('0xe'),_0x10ff24);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index d646c74..3a61605 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 _0x2aca=['service','authentication','Imap','Smtp','MailServerIn','map','MailAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','MailServerOut','mandatoryDispositionPause','keys','find','body','provider','custom','Pause','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','findOne','hasOwnProperty','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','omit','CmContact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','Contacts','updatedAt','CloudProvider','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','sendMail','subject','attach','out','Interaction','verifySmtp','Sequelize','ValidationError','addAgents','emit','isArray','userMailAccount:remove','getAgents','util','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','client','http','request','info','MailAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','then','get','MailAccounts','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp-mail.outlook.com','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','pass','port','host','secure'];(function(_0x55abd3,_0x47e49e){var _0x4fc1dd=function(_0x18c8c){while(--_0x18c8c){_0x55abd3['push'](_0x55abd3['shift']());}};_0x4fc1dd(++_0x47e49e);}(_0x2aca,0x7c));var _0xa2ac=function(_0x3d3f94,_0x51239d){_0x3d3f94=_0x3d3f94-0x0;var _0x328bbb=_0x2aca[_0x3d3f94];return _0x328bbb;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xa2ac('0x0'));var path=require('path');var _=require(_0xa2ac('0x1'));var juice=require(_0xa2ac('0x2'));var Redis=require(_0xa2ac('0x3'));var qs=require(_0xa2ac('0x4'));var logger=require(_0xa2ac('0x5'))(_0xa2ac('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa2ac('0x7')]=_[_0xa2ac('0x8')](config[_0xa2ac('0x7')],{'host':_0xa2ac('0x9'),'port':0x18eb});var socket=require(_0xa2ac('0xa'))(new Redis(config[_0xa2ac('0x7')]));require(_0xa2ac('0xb'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xa2ac('0xc')][_0xa2ac('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x4f8f47,_0x3032be,_0x4f2576,_0x4c1e9f){return new BPromise(function(_0x147fa2,_0x51f86e){var _0x407d23=_0x4c1e9f||client;return _0x407d23[_0xa2ac('0xe')](_0x4f8f47,_0x4f2576)['then'](function(_0x1294df){logger[_0xa2ac('0xf')](_0xa2ac('0x10'),_0x3032be,'request\x20sent');logger[_0xa2ac('0x11')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3032be,'request\x20sent',JSON[_0xa2ac('0x12')](_0x1294df));if(_0x1294df[_0xa2ac('0x13')]){if(_0x1294df['error'][_0xa2ac('0x14')]===0x1f4){logger[_0xa2ac('0x13')](_0xa2ac('0x10'),_0x3032be,_0x1294df[_0xa2ac('0x13')][_0xa2ac('0x15')]);return _0x51f86e(_0x1294df[_0xa2ac('0x13')]['message']);}logger['error'](_0xa2ac('0x10'),_0x3032be,_0x1294df[_0xa2ac('0x13')][_0xa2ac('0x15')]);return _0x147fa2(_0x1294df[_0xa2ac('0x13')][_0xa2ac('0x15')]);}else{logger[_0xa2ac('0xf')](_0xa2ac('0x10'),_0x3032be,_0xa2ac('0x16'));_0x147fa2(_0x1294df[_0xa2ac('0x17')][_0xa2ac('0x15')]);}})[_0xa2ac('0x18')](function(_0x5a83b9){logger[_0xa2ac('0x13')]('MailAccount,\x20%s,\x20%s',_0x3032be,_0x5a83b9);_0x51f86e(_0x5a83b9);});});}function respondWithStatusCode(_0x6fdc9e,_0x3b52ab){_0x3b52ab=_0x3b52ab||0xcc;return function(_0x315bd2){if(_0x315bd2){return _0x6fdc9e[_0xa2ac('0x19')](_0x3b52ab);}return _0x6fdc9e[_0xa2ac('0x1a')](_0x3b52ab)[_0xa2ac('0x1b')]();};}function respondWithResult(_0x3a5218,_0x28753a){_0x28753a=_0x28753a||0xc8;return function(_0x5ddff2){if(_0x5ddff2){return _0x3a5218[_0xa2ac('0x1a')](_0x28753a)[_0xa2ac('0x1c')](_0x5ddff2);}};}function respondWithFilteredResult(_0xacba65,_0x37331c){return function(_0xde11ab){if(_0xde11ab){var _0x1551e8=typeof _0x37331c[_0xa2ac('0x1d')]===_0xa2ac('0x1e')&&typeof _0x37331c[_0xa2ac('0x1f')]===_0xa2ac('0x1e');var _0x4fe956=_0xde11ab[_0xa2ac('0x20')];var _0x3ceb74=_0x1551e8?0x0:_0x37331c[_0xa2ac('0x1d')];var _0x189be3=_0x1551e8?_0xde11ab[_0xa2ac('0x20')]:_0x37331c['offset']+_0x37331c[_0xa2ac('0x1f')];var _0x1fef33;if(_0x189be3>=_0x4fe956){_0x189be3=_0x4fe956;_0x1fef33=0xc8;}else{_0x1fef33=0xce;}_0xacba65[_0xa2ac('0x1a')](_0x1fef33);return _0xacba65[_0xa2ac('0x21')]('Content-Range',_0x3ceb74+'-'+_0x189be3+'/'+_0x4fe956)[_0xa2ac('0x1c')](_0xde11ab);}return null;};}function saveUpdates(_0x15a5bf){return function(_0x49c1ed){if(_0x49c1ed){return _0x49c1ed[_0xa2ac('0x22')](_0x15a5bf)['then'](function(_0x3d80ba){return _0x3d80ba;});}return null;};}function removeEntity(_0x2c927b){return function(_0x594171){if(_0x594171){return _0x594171[_0xa2ac('0x23')]()[_0xa2ac('0x24')](function(){var _0xed9034=_0x594171[_0xa2ac('0x25')]({'plain':!![]});var _0x481afc=_0xa2ac('0x26');return db['UserProfileResource'][_0xa2ac('0x23')]({'where':{'type':_0x481afc,'resourceId':_0xed9034['id']}})[_0xa2ac('0x24')](function(){return _0x594171;});})[_0xa2ac('0x24')](function(){_0x2c927b['status'](0xcc)[_0xa2ac('0x1b')]();});}};}function handleEntityNotFound(_0x2c4b8e){return function(_0x5ba077){if(!_0x5ba077){_0x2c4b8e[_0xa2ac('0x19')](0x194);}return _0x5ba077;};}function handleError(_0x5d39e6,_0x3b1bae){_0x3b1bae=_0x3b1bae||0x1f4;return function(_0x34c3cf){logger['error'](_0x34c3cf[_0xa2ac('0x27')]);if(_0x34c3cf[_0xa2ac('0x28')]){delete _0x34c3cf[_0xa2ac('0x28')];}_0x5d39e6[_0xa2ac('0x1a')](_0x3b1bae)[_0xa2ac('0x29')](_0x34c3cf);};}function getImapHost(_0x5a792d){switch(_0x5a792d){case _0xa2ac('0x2a'):return _0xa2ac('0x2b');case _0xa2ac('0x2c'):return _0xa2ac('0x2d');case _0xa2ac('0x2e'):return'imap-mail.outlook.com';case _0xa2ac('0x2f'):return _0xa2ac('0x30');}throw new Error(_0xa2ac('0x31'),_0x5a792d);}function getSmtpHost(_0x1f3bf5){switch(_0x1f3bf5){case _0xa2ac('0x2a'):return _0xa2ac('0x32');case _0xa2ac('0x2c'):return'smtp.mail.yahoo.com';case _0xa2ac('0x2e'):return _0xa2ac('0x33');case _0xa2ac('0x2f'):return _0xa2ac('0x34');}throw new Error(_0xa2ac('0x31'),_0x1f3bf5);}function getAuthenticationOptions(_0x56b160,_0xa2db19){var _0x13802e={};var _0x2bb652={};if(_0x56b160){_0x13802e[_0xa2ac('0x35')]=_0x2bb652[_0xa2ac('0x35')]=_0xa2db19['username'];_0x13802e[_0xa2ac('0x36')]=_0x2bb652['pass']=_0xa2db19[_0xa2ac('0x36')];if(_0xa2db19[_0xa2ac('0x37')]){_0x13802e[_0xa2ac('0x37')]=_0x2bb652['modernAuthentication']=!![];_0x13802e[_0xa2ac('0x38')]=_0x2bb652[_0xa2ac('0x38')]=_0xa2db19[_0xa2ac('0x38')];_0x13802e[_0xa2ac('0x36')]=_0x2bb652[_0xa2ac('0x39')]=null;}else{_0x13802e[_0xa2ac('0x38')]=_0x2bb652[_0xa2ac('0x38')]=null;}_0x13802e['host']=getImapHost(_0x56b160);_0x13802e[_0xa2ac('0x3a')]=0x3e1;_0x2bb652[_0xa2ac('0x3b')]=getSmtpHost(_0x56b160);_0x2bb652['port']=0x24b;_0x2bb652[_0xa2ac('0x3c')]=![];_0x13802e[_0xa2ac('0x3d')]=_0x2bb652[_0xa2ac('0x3d')]=null;}else{if(_0xa2db19['authentication']){_0x13802e[_0xa2ac('0x35')]=_0x2bb652[_0xa2ac('0x35')]=_0xa2db19['username'];_0x13802e[_0xa2ac('0x36')]=_0x2bb652[_0xa2ac('0x39')]=_0xa2db19[_0xa2ac('0x36')];}else{_0x13802e[_0xa2ac('0x3e')]=_0x2bb652[_0xa2ac('0x3e')]=![];_0x13802e[_0xa2ac('0x35')]=_0x2bb652['user']=null;_0x13802e[_0xa2ac('0x36')]=_0x2bb652['pass']=null;}_0x13802e['host']=_0xa2db19['Imap']['host'];_0x13802e[_0xa2ac('0x3a')]=_0xa2db19[_0xa2ac('0x3f')][_0xa2ac('0x3a')];_0x2bb652['host']=_0xa2db19[_0xa2ac('0x40')]['host'];_0x2bb652[_0xa2ac('0x3a')]=_0xa2db19[_0xa2ac('0x40')]['port'];}return{'Imap':_0x13802e,'Smtp':_0x2bb652};}exports['index']=function(_0x49b164,_0x4284b6){var _0x2a009b={'include':[{'model':db[_0xa2ac('0x41')],'as':_0xa2ac('0x3f')},{'model':db['MailServerOut'],'as':_0xa2ac('0x40')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4ca3a1={},_0x11684f={'count':0x0,'rows':[]};var _0x5252ba=_[_0xa2ac('0x42')](db[_0xa2ac('0x43')][_0xa2ac('0x44')],function(_0x4efd54){return{'name':_0x4efd54[_0xa2ac('0x45')],'type':_0x4efd54[_0xa2ac('0x46')]['key']};});_0x4ca3a1[_0xa2ac('0x47')]=_[_0xa2ac('0x42')](_0x5252ba,'name');_0x4ca3a1[_0xa2ac('0x48')]=_['keys'](_0x49b164[_0xa2ac('0x48')]);_0x4ca3a1[_0xa2ac('0x49')]=_[_0xa2ac('0x4a')](_0x4ca3a1[_0xa2ac('0x47')],_0x4ca3a1[_0xa2ac('0x48')]);_0x2a009b['attributes']=_['intersection'](_0x4ca3a1[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0x49b164['query'][_0xa2ac('0x4b')]));_0x2a009b[_0xa2ac('0x4c')]=_0x2a009b[_0xa2ac('0x4c')][_0xa2ac('0x4d')]?_0x2a009b[_0xa2ac('0x4c')]:_0x4ca3a1[_0xa2ac('0x47')];if(!_0x49b164[_0xa2ac('0x48')]['hasOwnProperty'](_0xa2ac('0x4e'))){_0x2a009b['limit']=qs[_0xa2ac('0x1f')](_0x49b164[_0xa2ac('0x48')]['limit']);_0x2a009b[_0xa2ac('0x1d')]=qs[_0xa2ac('0x1d')](_0x49b164['query'][_0xa2ac('0x1d')]);}_0x2a009b[_0xa2ac('0x4f')]=qs[_0xa2ac('0x50')](_0x49b164[_0xa2ac('0x48')][_0xa2ac('0x50')]);_0x2a009b['where']=qs[_0xa2ac('0x49')](_[_0xa2ac('0x51')](_0x49b164[_0xa2ac('0x48')],_0x4ca3a1[_0xa2ac('0x49')]),_0x5252ba);if(_0x49b164[_0xa2ac('0x48')][_0xa2ac('0x52')]){_0x2a009b[_0xa2ac('0x53')]=_[_0xa2ac('0x54')](_0x2a009b[_0xa2ac('0x53')],{'$or':_[_0xa2ac('0x42')](_0x5252ba,function(_0x5afc7d){if(_0x5afc7d[_0xa2ac('0x46')]!==_0xa2ac('0x55')){var _0x2fa7b8={};_0x2fa7b8[_0x5afc7d[_0xa2ac('0x28')]]={'$like':'%'+_0x49b164[_0xa2ac('0x48')][_0xa2ac('0x52')]+'%'};return _0x2fa7b8;}})});}_0x2a009b=_['merge']({},_0x2a009b,_0x49b164[_0xa2ac('0x56')]);var _0x24d353={'where':_0x2a009b[_0xa2ac('0x53')]};return db[_0xa2ac('0x43')]['count'](_0x24d353)[_0xa2ac('0x24')](function(_0x116f5e){_0x11684f[_0xa2ac('0x20')]=_0x116f5e;if(_0x49b164[_0xa2ac('0x48')][_0xa2ac('0x57')]){_0x2a009b[_0xa2ac('0x58')]=[{'all':!![]}];}return db[_0xa2ac('0x43')][_0xa2ac('0x59')](_0x2a009b);})[_0xa2ac('0x24')](function(_0xd3f8e0){_0x11684f['rows']=_0xd3f8e0;return _0x11684f;})['then'](respondWithFilteredResult(_0x4284b6,_0x2a009b))['catch'](handleError(_0x4284b6,null));};exports[_0xa2ac('0x5a')]=function(_0x5f486d,_0x32b2e1){var _0x59601c={'raw':![],'where':{'id':_0x5f486d[_0xa2ac('0x5b')]['id']},'include':[{'model':db[_0xa2ac('0x41')],'as':_0xa2ac('0x3f')},{'model':db[_0xa2ac('0x5c')],'as':_0xa2ac('0x40')},{'model':db['Pause'],'as':_0xa2ac('0x5d')}]},_0xc472de={};_0xc472de[_0xa2ac('0x47')]=_[_0xa2ac('0x5e')](db[_0xa2ac('0x43')][_0xa2ac('0x44')]);_0xc472de['query']=_['keys'](_0x5f486d[_0xa2ac('0x48')]);_0xc472de[_0xa2ac('0x49')]=_[_0xa2ac('0x4a')](_0xc472de[_0xa2ac('0x47')],_0xc472de['query']);_0x59601c[_0xa2ac('0x4c')]=_[_0xa2ac('0x4a')](_0xc472de[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0x5f486d[_0xa2ac('0x48')][_0xa2ac('0x4b')]));_0x59601c['attributes']=_0x59601c['attributes'][_0xa2ac('0x4d')]?_0x59601c[_0xa2ac('0x4c')]:_0xc472de[_0xa2ac('0x47')];if(_0x5f486d[_0xa2ac('0x48')][_0xa2ac('0x57')]){_0x59601c[_0xa2ac('0x58')]=[{'all':!![]}];}_0x59601c=_['merge']({},_0x59601c,_0x5f486d[_0xa2ac('0x56')]);return db[_0xa2ac('0x43')][_0xa2ac('0x5f')](_0x59601c)[_0xa2ac('0x24')](handleEntityNotFound(_0x32b2e1,null))[_0xa2ac('0x24')](respondWithResult(_0x32b2e1,null))[_0xa2ac('0x18')](handleError(_0x32b2e1,null));};exports[_0xa2ac('0x22')]=function(_0xcd1bb3,_0x5796fd){if(_0xcd1bb3[_0xa2ac('0x60')]['id']){delete _0xcd1bb3['body']['id'];}var _0x22dfb6=_0xcd1bb3[_0xa2ac('0x60')][_0xa2ac('0x61')]===_0xa2ac('0x62')?null:_0xcd1bb3['body']['provider'];var _0x23011e=_0xcd1bb3[_0xa2ac('0x60')][_0xa2ac('0x3f')]||{};var _0x43bbde=_0xcd1bb3[_0xa2ac('0x60')]['Smtp']||{};if(_0x22dfb6){_0x23011e[_0xa2ac('0x3b')]=getImapHost(_0x22dfb6);_0x23011e['port']=0x3e1;_0x43bbde[_0xa2ac('0x3b')]=getSmtpHost(_0x22dfb6);_0x43bbde[_0xa2ac('0x3a')]=0x24b;_0x43bbde[_0xa2ac('0x3c')]=![];}if(_0x43bbde[_0xa2ac('0x37')]){_0x43bbde[_0xa2ac('0x3c')]=![];}else{_0x43bbde['CloudProviderId']=null;}if(!_0x23011e[_0xa2ac('0x37')])_0x23011e[_0xa2ac('0x38')]=null;_0xcd1bb3[_0xa2ac('0x60')]['Imap']=_0x23011e;_0xcd1bb3[_0xa2ac('0x60')][_0xa2ac('0x40')]=_0x43bbde;return db['MailAccount'][_0xa2ac('0x5f')]({'where':{'id':_0xcd1bb3[_0xa2ac('0x5b')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xa2ac('0x40')},{'model':db[_0xa2ac('0x63')],'as':_0xa2ac('0x5d')}]})[_0xa2ac('0x24')](handleEntityNotFound(_0x5796fd,null))[_0xa2ac('0x24')](function(_0x2a7c46){if(!_0x2a7c46)throw new Error(_0xa2ac('0x64'));if(_0x2a7c46[_0xa2ac('0x3d')])delete _0xcd1bb3[_0xa2ac('0x60')][_0xa2ac('0x3f')];return _0x2a7c46;})[_0xa2ac('0x24')](saveUpdates(_0xcd1bb3[_0xa2ac('0x60')],null))['then'](function(_0x41c6b0){if(!_0xcd1bb3[_0xa2ac('0x60')][_0xa2ac('0x3f')])return _0x41c6b0;return db[_0xa2ac('0x41')][_0xa2ac('0x22')](_0xcd1bb3[_0xa2ac('0x60')][_0xa2ac('0x3f')],{'where':{'MailAccountId':_0x41c6b0['id']}})['then'](function(){return _0x41c6b0;});})[_0xa2ac('0x24')](function(_0x457f38){if(!_0xcd1bb3['body']['Smtp'])return _0x457f38;return db[_0xa2ac('0x5c')][_0xa2ac('0x22')](_0xcd1bb3[_0xa2ac('0x60')][_0xa2ac('0x40')],{'where':{'MailAccountId':_0x457f38['id']}})[_0xa2ac('0x24')](function(){return _0x457f38;});})[_0xa2ac('0x24')](respondWithResult(_0x5796fd,null))['catch'](handleError(_0x5796fd,null));};exports[_0xa2ac('0x65')]=function(_0x2ec952,_0x390c3c){return db[_0xa2ac('0x43')]['describe']()[_0xa2ac('0x24')](respondWithResult(_0x390c3c,null))['catch'](handleError(_0x390c3c,null));};exports[_0xa2ac('0x66')]=function(_0x1b99c7,_0x362bc7){if(_0x1b99c7[_0xa2ac('0x60')]['id']){delete _0x1b99c7[_0xa2ac('0x60')]['id'];}return db[_0xa2ac('0x43')]['find']({'where':{'id':_0x1b99c7['params']['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x362bc7,null))[_0xa2ac('0x24')](function(_0x59824f){if(_0x59824f){_0x1b99c7['body'][_0xa2ac('0x67')]=_0x59824f['id'];return db[_0xa2ac('0x68')][_0xa2ac('0x69')](_0x1b99c7[_0xa2ac('0x60')]);}})[_0xa2ac('0x24')](respondWithResult(_0x362bc7,null))[_0xa2ac('0x18')](handleError(_0x362bc7,null));};exports['getDispositions']=function(_0x82073c,_0x5879aa){var _0xf84e1b={'raw':![],'where':{}};var _0x21fed5={};var _0x54327e={'count':0x0,'rows':[]};return db[_0xa2ac('0x43')][_0xa2ac('0x6a')]({'where':{'id':_0x82073c[_0xa2ac('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5879aa,null))[_0xa2ac('0x24')](function(_0x3957a9){if(_0x3957a9){_0x21fed5[_0xa2ac('0x47')]=_['keys'](db['Disposition'][_0xa2ac('0x44')]);_0x21fed5[_0xa2ac('0x48')]=_[_0xa2ac('0x5e')](_0x82073c[_0xa2ac('0x48')]);_0x21fed5[_0xa2ac('0x49')]=_['intersection'](_0x21fed5['model'],_0x21fed5[_0xa2ac('0x48')]);_0xf84e1b[_0xa2ac('0x4c')]=_[_0xa2ac('0x4a')](_0x21fed5[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x4b')]));_0xf84e1b[_0xa2ac('0x4c')]=_0xf84e1b[_0xa2ac('0x4c')][_0xa2ac('0x4d')]?_0xf84e1b[_0xa2ac('0x4c')]:_0x21fed5[_0xa2ac('0x47')];if(!_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x6b')](_0xa2ac('0x4e'))){_0xf84e1b[_0xa2ac('0x1f')]=qs[_0xa2ac('0x1f')](_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x1f')]);_0xf84e1b[_0xa2ac('0x1d')]=qs[_0xa2ac('0x1d')](_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x1d')]);}_0xf84e1b[_0xa2ac('0x4f')]=qs[_0xa2ac('0x50')](_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x50')]);_0xf84e1b[_0xa2ac('0x53')]=qs[_0xa2ac('0x49')](_[_0xa2ac('0x51')](_0x82073c['query'],_0x21fed5[_0xa2ac('0x49')]));_0xf84e1b['where'][_0xa2ac('0x67')]=_0x3957a9['id'];if(_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x52')]){_0xf84e1b[_0xa2ac('0x53')]=_[_0xa2ac('0x54')](_0xf84e1b[_0xa2ac('0x53')],{'$or':_[_0xa2ac('0x42')](_0xf84e1b[_0xa2ac('0x4c')],function(_0x3ec3a0){var _0x5cb336={};_0x5cb336[_0x3ec3a0]={'$like':'%'+_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x52')]+'%'};return _0x5cb336;})});}_0xf84e1b=_['merge']({},_0xf84e1b,_0x82073c[_0xa2ac('0x56')]);return db['Disposition']['count']({'where':_0xf84e1b[_0xa2ac('0x53')]})[_0xa2ac('0x24')](function(_0x39afe5){_0x54327e[_0xa2ac('0x20')]=_0x39afe5;if(_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x57')]){_0xf84e1b[_0xa2ac('0x58')]=[{'all':!![]}];}return db[_0xa2ac('0x68')]['findAll'](_0xf84e1b);})['then'](function(_0x5665ce){_0x54327e[_0xa2ac('0x6c')]=_0x5665ce;return _0x54327e;});}})[_0xa2ac('0x24')](respondWithFilteredResult(_0x5879aa,_0xf84e1b))[_0xa2ac('0x18')](handleError(_0x5879aa,null));};exports[_0xa2ac('0x6d')]=function(_0x477562,_0xf38d23){return db['MailAccount'][_0xa2ac('0x5f')]({'where':{'id':_0x477562[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0xf38d23,null))[_0xa2ac('0x24')](function(_0x567f83){if(_0x567f83){return _0x567f83[_0xa2ac('0x6d')](_0x477562[_0xa2ac('0x48')][_0xa2ac('0x6e')]);}})[_0xa2ac('0x24')](respondWithStatusCode(_0xf38d23,null))['catch'](handleError(_0xf38d23,null));};exports[_0xa2ac('0x6f')]=function(_0x742bc5,_0x3b0531){if(_0x742bc5[_0xa2ac('0x60')]['id']){delete _0x742bc5['body']['id'];}return db[_0xa2ac('0x43')]['find']({'where':{'id':_0x742bc5['params']['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x3b0531,null))[_0xa2ac('0x24')](function(_0x718153){if(_0x718153){_0x742bc5[_0xa2ac('0x60')][_0xa2ac('0x67')]=_0x718153['id'];return db[_0xa2ac('0x70')]['create'](_0x742bc5[_0xa2ac('0x60')]);}})[_0xa2ac('0x24')](respondWithResult(_0x3b0531,null))[_0xa2ac('0x18')](handleError(_0x3b0531,null));};exports['getAnswers']=function(_0x52e104,_0x38fd89){var _0x149afc={'raw':![],'where':{}};var _0x377ae8={};var _0x338bd3={'count':0x0,'rows':[]};return db['MailAccount'][_0xa2ac('0x6a')]({'where':{'id':_0x52e104[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x38fd89,null))[_0xa2ac('0x24')](function(_0x37a889){if(_0x37a889){_0x377ae8[_0xa2ac('0x47')]=_[_0xa2ac('0x5e')](db[_0xa2ac('0x70')]['rawAttributes']);_0x377ae8[_0xa2ac('0x48')]=_[_0xa2ac('0x5e')](_0x52e104[_0xa2ac('0x48')]);_0x377ae8[_0xa2ac('0x49')]=_['intersection'](_0x377ae8[_0xa2ac('0x47')],_0x377ae8[_0xa2ac('0x48')]);_0x149afc[_0xa2ac('0x4c')]=_[_0xa2ac('0x4a')](_0x377ae8[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0x52e104[_0xa2ac('0x48')]['fields']));_0x149afc['attributes']=_0x149afc[_0xa2ac('0x4c')][_0xa2ac('0x4d')]?_0x149afc[_0xa2ac('0x4c')]:_0x377ae8[_0xa2ac('0x47')];if(!_0x52e104['query'][_0xa2ac('0x6b')](_0xa2ac('0x4e'))){_0x149afc[_0xa2ac('0x1f')]=qs[_0xa2ac('0x1f')](_0x52e104[_0xa2ac('0x48')][_0xa2ac('0x1f')]);_0x149afc[_0xa2ac('0x1d')]=qs[_0xa2ac('0x1d')](_0x52e104[_0xa2ac('0x48')][_0xa2ac('0x1d')]);}_0x149afc['order']=qs['sort'](_0x52e104[_0xa2ac('0x48')]['sort']);_0x149afc[_0xa2ac('0x53')]=qs['filters'](_['pick'](_0x52e104[_0xa2ac('0x48')],_0x377ae8[_0xa2ac('0x49')]));_0x149afc[_0xa2ac('0x53')][_0xa2ac('0x67')]=_0x37a889['id'];if(_0x52e104[_0xa2ac('0x48')][_0xa2ac('0x52')]){_0x149afc[_0xa2ac('0x53')]=_[_0xa2ac('0x54')](_0x149afc[_0xa2ac('0x53')],{'$or':_[_0xa2ac('0x42')](_0x149afc[_0xa2ac('0x4c')],function(_0x11c1df){var _0x2d976b={};_0x2d976b[_0x11c1df]={'$like':'%'+_0x52e104[_0xa2ac('0x48')][_0xa2ac('0x52')]+'%'};return _0x2d976b;})});}_0x149afc=_[_0xa2ac('0x54')]({},_0x149afc,_0x52e104[_0xa2ac('0x56')]);return db[_0xa2ac('0x70')]['count']({'where':_0x149afc['where']})[_0xa2ac('0x24')](function(_0x52e078){_0x338bd3[_0xa2ac('0x20')]=_0x52e078;if(_0x52e104[_0xa2ac('0x48')]['includeAll']){_0x149afc[_0xa2ac('0x58')]=[{'all':!![]}];}return db[_0xa2ac('0x70')]['findAll'](_0x149afc);})[_0xa2ac('0x24')](function(_0x3fa70a){_0x338bd3['rows']=_0x3fa70a;return _0x338bd3;});}})['then'](respondWithFilteredResult(_0x38fd89,_0x149afc))[_0xa2ac('0x18')](handleError(_0x38fd89,null));};exports[_0xa2ac('0x71')]=function(_0x53e7a0,_0x2e299b){return db[_0xa2ac('0x43')]['find']({'where':{'id':_0x53e7a0[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x2e299b,null))['then'](function(_0x1f2ef8){if(_0x1f2ef8){return _0x1f2ef8[_0xa2ac('0x71')](_0x53e7a0[_0xa2ac('0x48')][_0xa2ac('0x6e')]);}})['then'](respondWithStatusCode(_0x2e299b,null))[_0xa2ac('0x18')](handleError(_0x2e299b,null));};exports[_0xa2ac('0x69')]=function(_0x26a900,_0x2659b0){var _0x286de9={'name':_0x26a900[_0xa2ac('0x60')][_0xa2ac('0x28')],'key':_0x26a900['body']['key'],'provider':_0x26a900['body'][_0xa2ac('0x61')]===_0xa2ac('0x62')?null:_0x26a900[_0xa2ac('0x60')][_0xa2ac('0x61')],'email':_0x26a900[_0xa2ac('0x60')][_0xa2ac('0x72')],'ListId':_0x26a900[_0xa2ac('0x60')][_0xa2ac('0x73')],'active':!_[_0xa2ac('0x74')](_0x26a900[_0xa2ac('0x60')][_0xa2ac('0x75')])?_0x26a900[_0xa2ac('0x60')]['active']:!![],'description':_0x26a900[_0xa2ac('0x60')][_0xa2ac('0x76')]||null};var _0x27a60b=getAuthenticationOptions(_0x286de9[_0xa2ac('0x61')],_0x26a900[_0xa2ac('0x60')]);_0x286de9['Imap']=_0x27a60b[_0xa2ac('0x3f')];_0x286de9[_0xa2ac('0x40')]=_0x27a60b[_0xa2ac('0x40')];return db[_0xa2ac('0x43')][_0xa2ac('0x69')](_0x286de9,{'include':[{'model':db[_0xa2ac('0x5c')],'as':_0xa2ac('0x40')},{'model':db[_0xa2ac('0x41')],'as':_0xa2ac('0x3f')}]})[_0xa2ac('0x24')](function(_0x3dfc61){var _0x2b66ae=_0x26a900[_0xa2ac('0x35')][_0xa2ac('0x25')]({'plain':!![]});if(!_0x2b66ae)throw new Error(_0xa2ac('0x77'));if(_0x2b66ae[_0xa2ac('0x78')]===_0xa2ac('0x35')){var _0x29ca1b=_0x3dfc61[_0xa2ac('0x25')]({'plain':!![]});return db[_0xa2ac('0x79')][_0xa2ac('0x5f')]({'where':{'name':_0xa2ac('0x26'),'userProfileId':_0x2b66ae['userProfileId']},'raw':!![]})['then'](function(_0x46c501){if(_0x46c501&&_0x46c501[_0xa2ac('0x7a')]===0x0){return db[_0xa2ac('0x7b')]['create']({'name':_0x29ca1b['name'],'resourceId':_0x29ca1b['id'],'type':_0x46c501[_0xa2ac('0x28')],'sectionId':_0x46c501['id']},{})[_0xa2ac('0x24')](function(){return _0x3dfc61;});}else{return _0x3dfc61;}})[_0xa2ac('0x18')](function(_0x1075b1){logger[_0xa2ac('0x13')](_0xa2ac('0x7c'),_0x1075b1);throw _0x1075b1;});}return _0x3dfc61;})[_0xa2ac('0x24')](respondWithResult(_0x2659b0,0xc9))[_0xa2ac('0x18')](handleError(_0x2659b0,null));};exports[_0xa2ac('0x7d')]=function(_0x5e2249,_0x4e6487){return db[_0xa2ac('0x43')][_0xa2ac('0x6a')]({'where':{'id':_0x5e2249[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x4e6487,null))['then'](function(_0x1a669e){if(_0x1a669e){return _0x1a669e[_0xa2ac('0x7d')]();}return null;})[_0xa2ac('0x24')](respondWithResult(_0x4e6487,null))[_0xa2ac('0x18')](handleError(_0x4e6487,null));};exports['addImap']=function(_0x4f6111,_0x1cba91){if(_0x4f6111[_0xa2ac('0x60')]['id']){delete _0x4f6111[_0xa2ac('0x60')]['id'];}return db[_0xa2ac('0x43')][_0xa2ac('0x5f')]({'where':{'id':_0x4f6111[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x1cba91,null))[_0xa2ac('0x24')](function(_0xa1aa97){if(_0xa1aa97){_0x4f6111['body'][_0xa2ac('0x67')]=_0xa1aa97['id'];return db['MailServerIn'][_0xa2ac('0x69')](_0x4f6111[_0xa2ac('0x60')]);}})['then'](respondWithResult(_0x1cba91,null))['catch'](handleError(_0x1cba91,null));};exports[_0xa2ac('0x7e')]=function(_0x4c14a8,_0x4f791f){return db[_0xa2ac('0x43')]['findOne']({'where':{'id':_0x4c14a8[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x4f791f,null))['then'](function(_0x4fe486){if(_0x4fe486){return _0x4fe486[_0xa2ac('0x7f')](null);}return null;})[_0xa2ac('0x24')](respondWithStatusCode(_0x4f791f,null))[_0xa2ac('0x18')](handleError(_0x4f791f,null));};exports[_0xa2ac('0x80')]=function(_0x2a32cb,_0x2b4eb7){return db[_0xa2ac('0x43')][_0xa2ac('0x6a')]({'where':{'id':_0x2a32cb[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x2b4eb7,null))['then'](function(_0x4c5901){if(_0x4c5901){return _0x4c5901[_0xa2ac('0x80')]();}return null;})[_0xa2ac('0x24')](respondWithResult(_0x2b4eb7,null))[_0xa2ac('0x18')](handleError(_0x2b4eb7,null));};exports[_0xa2ac('0x81')]=function(_0xefd4bd,_0x2f5435){if(_0xefd4bd[_0xa2ac('0x60')]['id']){delete _0xefd4bd[_0xa2ac('0x60')]['id'];}return db[_0xa2ac('0x43')][_0xa2ac('0x5f')]({'where':{'id':_0xefd4bd[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x2f5435,null))[_0xa2ac('0x24')](function(_0xbde5c9){if(_0xbde5c9){_0xefd4bd['body'][_0xa2ac('0x67')]=_0xbde5c9['id'];return db[_0xa2ac('0x5c')][_0xa2ac('0x69')](_0xefd4bd[_0xa2ac('0x60')]);}})[_0xa2ac('0x24')](respondWithResult(_0x2f5435,null))[_0xa2ac('0x18')](handleError(_0x2f5435,null));};exports[_0xa2ac('0x82')]=function(_0x51df59,_0x14cc03){return db['MailAccount']['findOne']({'where':{'id':_0x51df59['params']['id']}})['then'](handleEntityNotFound(_0x14cc03,null))[_0xa2ac('0x24')](function(_0x43d3ea){if(_0x43d3ea){return _0x43d3ea[_0xa2ac('0x83')](null);}return null;})[_0xa2ac('0x24')](respondWithStatusCode(_0x14cc03,null))[_0xa2ac('0x18')](handleError(_0x14cc03,null));};exports['addInteraction']=function(_0x1f3378,_0x258878){return db[_0xa2ac('0x84')][_0xa2ac('0x5f')]({'where':{'id':_0x1f3378[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x258878,null))[_0xa2ac('0x24')](function(_0x11ac8e){if(_0x11ac8e){return _0x11ac8e['addInteraction'](_0x1f3378[_0xa2ac('0x60')][_0xa2ac('0x6e')],_[_0xa2ac('0x85')](_0x1f3378[_0xa2ac('0x60')],[_0xa2ac('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x258878,null))[_0xa2ac('0x18')](handleError(_0x258878,null));};exports['getInteractions']=function(_0xc106df,_0x3737e5){var _0x2b0ecb={'raw':![],'where':{}};var _0x2d2c69={};var _0x5a25fa={'count':0x0,'rows':[]};return db[_0xa2ac('0x43')][_0xa2ac('0x6a')]({'where':{'id':_0xc106df[_0xa2ac('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3737e5,null))['then'](function(_0x3feecc){if(_0x3feecc){_0x2d2c69[_0xa2ac('0x47')]=_[_0xa2ac('0x5e')](db[_0xa2ac('0x84')][_0xa2ac('0x44')]);_0x2d2c69[_0xa2ac('0x48')]=_[_0xa2ac('0x5e')](_0xc106df['query']);_0x2d2c69[_0xa2ac('0x49')]=_[_0xa2ac('0x4a')](_0x2d2c69[_0xa2ac('0x47')],_0x2d2c69[_0xa2ac('0x48')]);_0x2b0ecb['attributes']=_['intersection'](_0x2d2c69[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0xc106df[_0xa2ac('0x48')][_0xa2ac('0x4b')]));_0x2b0ecb[_0xa2ac('0x4c')]=_0x2b0ecb[_0xa2ac('0x4c')][_0xa2ac('0x4d')]?_0x2b0ecb[_0xa2ac('0x4c')]:_0x2d2c69[_0xa2ac('0x47')];if(!_0xc106df['query']['hasOwnProperty'](_0xa2ac('0x4e'))){_0x2b0ecb[_0xa2ac('0x1f')]=qs[_0xa2ac('0x1f')](_0xc106df[_0xa2ac('0x48')][_0xa2ac('0x1f')]);_0x2b0ecb[_0xa2ac('0x1d')]=qs[_0xa2ac('0x1d')](_0xc106df[_0xa2ac('0x48')][_0xa2ac('0x1d')]);}_0x2b0ecb[_0xa2ac('0x4f')]=qs[_0xa2ac('0x50')](_0xc106df[_0xa2ac('0x48')][_0xa2ac('0x50')]);_0x2b0ecb['where']=qs['filters'](_[_0xa2ac('0x51')](_0xc106df[_0xa2ac('0x48')],_0x2d2c69['filters']));_0x2b0ecb[_0xa2ac('0x53')][_0xa2ac('0x67')]=_0x3feecc['id'];if(_0xc106df[_0xa2ac('0x48')]['filter']){_0x2b0ecb[_0xa2ac('0x53')]=_[_0xa2ac('0x54')](_0x2b0ecb[_0xa2ac('0x53')],{'$or':_[_0xa2ac('0x42')](_0x2b0ecb[_0xa2ac('0x4c')],function(_0x15dee5){var _0x53f19a={};_0x53f19a[_0x15dee5]={'$like':'%'+_0xc106df['query'][_0xa2ac('0x52')]+'%'};return _0x53f19a;})});}_0x2b0ecb=_[_0xa2ac('0x54')]({},_0x2b0ecb,_0xc106df[_0xa2ac('0x56')]);return db['MailInteraction'][_0xa2ac('0x20')]({'where':_0x2b0ecb[_0xa2ac('0x53')]})[_0xa2ac('0x24')](function(_0x4bc4c8){_0x5a25fa[_0xa2ac('0x20')]=_0x4bc4c8;if(_0xc106df[_0xa2ac('0x48')][_0xa2ac('0x57')]){_0x2b0ecb['include']=[{'model':db[_0xa2ac('0x86')],'as':'Contact','required':![]},{'model':db[_0xa2ac('0x87')],'as':_0xa2ac('0x88'),'attributes':[_0xa2ac('0x28'),'fullname',_0xa2ac('0x89')],'required':![]},{'model':db[_0xa2ac('0x8a')],'as':_0xa2ac('0x8b'),'attributes':['id','name',_0xa2ac('0x8c')],'where':_0xc106df[_0xa2ac('0x48')][_0xa2ac('0x8d')]?{'id':_0xc106df['query']['tag']}:undefined,'required':_0xc106df[_0xa2ac('0x48')][_0xa2ac('0x8d')]?!![]:![]}];}return db['MailInteraction'][_0xa2ac('0x59')](_0x2b0ecb);})['then'](function(_0x2848b5){_0x5a25fa[_0xa2ac('0x6c')]=_0x2848b5;return _0x5a25fa;});}})[_0xa2ac('0x24')](respondWithFilteredResult(_0x3737e5,_0x2b0ecb))[_0xa2ac('0x18')](handleError(_0x3737e5,null));};exports[_0xa2ac('0x8e')]=function addApplications(_0x44e4d5,_0x311d1a){var _0x430c07=_0x44e4d5['params']['id'];var _0x1c0e1a=_0x44e4d5['body'];var _0x1cfdb3=0xc8;var _0x39a107=null;return db[_0xa2ac('0x8f')][_0xa2ac('0x90')]({'isolationLevel':db['sequelize'][_0xa2ac('0x91')][_0xa2ac('0x92')][_0xa2ac('0x93')]},function(_0x3c4aee){return db[_0xa2ac('0x43')][_0xa2ac('0x6a')]({'where':{'id':_0x430c07},'transaction':_0x3c4aee})['then'](function(_0x37e8ed){if(_0x37e8ed){return db[_0xa2ac('0x94')][_0xa2ac('0x23')]({'where':{'MailAccountId':_0x430c07},'transaction':_0x3c4aee})[_0xa2ac('0x24')](function(){var _0x5ee328=_[_0xa2ac('0x42')](_0x1c0e1a,function(_0x4709ce){_0x4709ce[_0xa2ac('0x67')]=_0x430c07;return _0x4709ce;});return db[_0xa2ac('0x94')][_0xa2ac('0x95')](_0x5ee328,{'transaction':_0x3c4aee});});}else{_0x1cfdb3=0x194;_0x39a107=[];}});})['then'](function(){if(_0x1cfdb3!==0x194){return db['MailApplication'][_0xa2ac('0x96')]({'where':{'MailAccountId':_0x430c07},'order':'priority'})[_0xa2ac('0x24')](function(_0xfe4653){_0x39a107=_0xfe4653;});}})[_0xa2ac('0x18')](function(_0x364e08){_0x1cfdb3=0x1f4;logger['error'](_0x364e08[_0xa2ac('0x27')]);if(_0x364e08['name']){delete _0x364e08[_0xa2ac('0x28')];}_0x39a107=_0x364e08;})[_0xa2ac('0x97')](function(){if(_0x39a107===null){_0x311d1a[_0xa2ac('0x19')](_0x1cfdb3);}else{if(_0x1cfdb3===0x1f4){_0x311d1a[_0xa2ac('0x1a')](_0x1cfdb3)[_0xa2ac('0x29')](_0x39a107);}else{_0x311d1a[_0xa2ac('0x1a')](_0x1cfdb3)['json'](_0x39a107);}}});};exports['getApplications']=function(_0x2875ab,_0x55affb){var _0x521d84={};var _0x39c5a1={};var _0x4825c4;var _0x3035a4;return db[_0xa2ac('0x43')]['findOne']({'where':{'id':_0x2875ab[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x55affb,null))['then'](function(_0x51aa2d){if(_0x51aa2d){_0x4825c4=_0x51aa2d;_0x39c5a1[_0xa2ac('0x47')]=_['keys'](db[_0xa2ac('0x94')][_0xa2ac('0x44')]);_0x39c5a1['query']=_[_0xa2ac('0x5e')](_0x2875ab[_0xa2ac('0x48')]);_0x39c5a1['filters']=_[_0xa2ac('0x4a')](_0x39c5a1[_0xa2ac('0x47')],_0x39c5a1[_0xa2ac('0x48')]);_0x521d84[_0xa2ac('0x4c')]=_[_0xa2ac('0x4a')](_0x39c5a1[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0x2875ab[_0xa2ac('0x48')][_0xa2ac('0x4b')]));_0x521d84[_0xa2ac('0x4c')]=_0x521d84['attributes'][_0xa2ac('0x4d')]?_0x521d84[_0xa2ac('0x4c')]:_0x39c5a1['model'];_0x521d84[_0xa2ac('0x4f')]=qs['sort'](_0x2875ab[_0xa2ac('0x48')]['sort']);_0x521d84[_0xa2ac('0x53')]=qs[_0xa2ac('0x49')](_[_0xa2ac('0x51')](_0x2875ab[_0xa2ac('0x48')],_0x39c5a1[_0xa2ac('0x49')]));if(_0x2875ab['query']['filter']){_0x521d84[_0xa2ac('0x53')]=_[_0xa2ac('0x54')](_0x521d84[_0xa2ac('0x53')],{'$or':_[_0xa2ac('0x42')](_0x521d84[_0xa2ac('0x4c')],function(_0x3986a0){var _0x2ccd25={};_0x2ccd25[_0x3986a0]={'$like':'%'+_0x2875ab[_0xa2ac('0x48')]['filter']+'%'};return _0x2ccd25;})});}_0x521d84=_[_0xa2ac('0x54')]({},_0x521d84,_0x2875ab['options']);return _0x4825c4[_0xa2ac('0x98')](_0x521d84);}})[_0xa2ac('0x24')](function(_0x472b11){if(_0x472b11){_0x3035a4=_0x472b11['length'];if(!_0x2875ab['query']['hasOwnProperty'](_0xa2ac('0x4e'))){_0x521d84['limit']=qs[_0xa2ac('0x1f')](_0x2875ab['query'][_0xa2ac('0x1f')]);_0x521d84[_0xa2ac('0x1d')]=qs['offset'](_0x2875ab[_0xa2ac('0x48')][_0xa2ac('0x1d')]);}return _0x4825c4[_0xa2ac('0x98')](_0x521d84);}})[_0xa2ac('0x24')](function(_0x47dcb2){if(_0x47dcb2){return _0x47dcb2?{'count':_0x3035a4,'rows':_0x47dcb2}:null;}})[_0xa2ac('0x24')](respondWithResult(_0x55affb,null))['catch'](handleError(_0x55affb,null));};exports[_0xa2ac('0x99')]=function(_0x480776,_0x385d75){var _0x1679c9={'raw':!![],'where':{}};var _0x2e3d3f={};var _0x534f37={'count':0x0,'rows':[]};return db[_0xa2ac('0x43')][_0xa2ac('0x6a')]({'where':{'id':_0x480776[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x385d75,null))[_0xa2ac('0x24')](function(_0x7ab205){if(_0x7ab205){_0x2e3d3f[_0xa2ac('0x47')]=_[_0xa2ac('0x5e')](db[_0xa2ac('0x9a')][_0xa2ac('0x44')]);_0x2e3d3f[_0xa2ac('0x48')]=_[_0xa2ac('0x5e')](_0x480776[_0xa2ac('0x48')]);_0x2e3d3f[_0xa2ac('0x49')]=_[_0xa2ac('0x4a')](_0x2e3d3f[_0xa2ac('0x47')],_0x2e3d3f[_0xa2ac('0x48')]);_0x1679c9[_0xa2ac('0x4c')]=_[_0xa2ac('0x4a')](_0x2e3d3f[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0x480776[_0xa2ac('0x48')]['fields']));_0x1679c9[_0xa2ac('0x4c')]=_0x1679c9[_0xa2ac('0x4c')]['length']?_0x1679c9[_0xa2ac('0x4c')]:_0x2e3d3f[_0xa2ac('0x47')];if(!_0x480776[_0xa2ac('0x48')][_0xa2ac('0x6b')]('nolimit')){_0x1679c9[_0xa2ac('0x1f')]=qs[_0xa2ac('0x1f')](_0x480776[_0xa2ac('0x48')][_0xa2ac('0x1f')]);_0x1679c9[_0xa2ac('0x1d')]=qs[_0xa2ac('0x1d')](_0x480776[_0xa2ac('0x48')][_0xa2ac('0x1d')]);}_0x1679c9['order']=qs[_0xa2ac('0x50')](_0x480776[_0xa2ac('0x48')][_0xa2ac('0x50')]);_0x1679c9[_0xa2ac('0x53')]=qs['filters'](_[_0xa2ac('0x51')](_0x480776[_0xa2ac('0x48')],_0x2e3d3f[_0xa2ac('0x49')]));_0x1679c9['where'][_0xa2ac('0x67')]=_0x7ab205['id'];if(_0x480776[_0xa2ac('0x48')][_0xa2ac('0x52')]){_0x1679c9['where']=_[_0xa2ac('0x54')](_0x1679c9[_0xa2ac('0x53')],{'$or':_[_0xa2ac('0x42')](_0x1679c9[_0xa2ac('0x4c')],function(_0x664757){var _0x13b761={};_0x13b761[_0x664757]={'$like':'%'+_0x480776['query'][_0xa2ac('0x52')]+'%'};return _0x13b761;})});}if(_0x480776[_0xa2ac('0x48')][_0xa2ac('0x9b')]){var _0x1f8cb6=_0x480776['query'][_0xa2ac('0x9b')]['split'](',');var _0xff2dea={};_0xff2dea[_0x1f8cb6[0x0]]={'$gte':moment(_0x1f8cb6[0x1])['format'](_0xa2ac('0x9c'))};_0x1679c9['where']=_['merge'](_0x1679c9['where'],_0xff2dea);}_0x1679c9=_[_0xa2ac('0x54')]({},_0x1679c9,_0x480776['options']);return db[_0xa2ac('0x9a')][_0xa2ac('0x20')]({'where':_0x1679c9[_0xa2ac('0x53')]})['then'](function(_0x3ec2e1){_0x534f37[_0xa2ac('0x20')]=_0x3ec2e1;if(_0x480776['query']['includeAll']){_0x1679c9[_0xa2ac('0x58')]=[{'all':!![]}];}return db['MailMessage'][_0xa2ac('0x59')](_0x1679c9);})[_0xa2ac('0x24')](function(_0x58bb65){if(_0x480776[_0xa2ac('0x48')][_0xa2ac('0x9d')]===_0xa2ac('0x9e')){for(var _0x1a44fe=0x0;_0x1a44fe<_0x58bb65[_0xa2ac('0x4d')];_0x1a44fe++){_0x58bb65[_0x1a44fe][_0xa2ac('0x60')]=juice(_0x58bb65[_0x1a44fe]['body']);}}_0x534f37[_0xa2ac('0x6c')]=_0x58bb65;return _0x534f37;});}})[_0xa2ac('0x24')](respondWithFilteredResult(_0x385d75,_0x1679c9))[_0xa2ac('0x18')](handleError(_0x385d75,null));};exports[_0xa2ac('0x29')]=function(_0x4c9990,_0x4164be){var _0x4a466f,_0x104458={},_0x2ef3dd;if(_0x4c9990[_0xa2ac('0x60')]['to']){_0x2ef3dd=_0x4c9990['body']['to']['split'](',')[0x0];}return db[_0xa2ac('0x43')][_0xa2ac('0x5f')]({'where':{'id':_0x4c9990[_0xa2ac('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0xa2ac('0x9f'),'include':[{'model':db['CmContact'],'as':_0xa2ac('0xa0'),'where':{'email':_0x2ef3dd},'limit':0x1,'order':[[_0xa2ac('0xa1'),'DESC']]}]},{'model':db[_0xa2ac('0x5c')],'as':_0xa2ac('0x40'),'raw':!![],'include':[{'model':db[_0xa2ac('0xa2')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x4164be,null))['then'](function(_0x27da81){if(!_0x27da81)return;_0x4a466f=_0x27da81;if(!_0x27da81[_0xa2ac('0x40')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xa2ac('0x74')](_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa3')])){_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa3')]=util[_0xa2ac('0xa4')](_0xa2ac('0xa5'),_0x27da81['name'],_0x27da81[_0xa2ac('0x72')]||_0x27da81[_0xa2ac('0x40')][_0xa2ac('0x35')]);}if(_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa6')]&&_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa6')][_0xa2ac('0x4d')]){for(var _0x2b6060=0x0;_0x2b6060<_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa6')]['length'];_0x2b6060+=0x1){_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa6')][_0x2b6060]={'filename':_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa6')][_0x2b6060][_0xa2ac('0x28')],'path':path[_0xa2ac('0xa7')](config[_0xa2ac('0xa8')],_0xa2ac('0xa9'),_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa6')][_0x2b6060][_0xa2ac('0xaa')])};}}var _0x25ca9c=_0x27da81[_0xa2ac('0xab')]();return respondWithRpcPromise('SendMail',_0xa2ac('0xac'),{'account':_0x25ca9c,'message':_0x4c9990[_0xa2ac('0x60')]});})['then'](function(_0x402c21){if(!_0x402c21)return;_0x104458=_0x402c21;if(!_0x4a466f[_0xa2ac('0x9f')])throw new Error('List\x20not\x20found');if(_0x4a466f[_0xa2ac('0x9f')][_0xa2ac('0xa0')]['length'])return _0x4a466f[_0xa2ac('0x9f')][_0xa2ac('0xa0')][0x0];return db['CmContact']['create'](_['defaults'](_0x4c9990[_0xa2ac('0x60')],{'firstName':_0x4c9990[_0xa2ac('0x60')]['to'],'email':_0x4c9990[_0xa2ac('0x60')]['to'],'phone':_0x4c9990[_0xa2ac('0x60')]['to'],'ListId':_0x4a466f[_0xa2ac('0x73')]}));})[_0xa2ac('0x24')](function(_0x308125){if(!_0x308125)return;var _0x3d0170={'UserId':_0x4c9990[_0xa2ac('0x35')]['id'],'ContactId':_0x308125['id'],'MailAccountId':_0x4a466f['id'],'inReplyTo':_0x104458['messageId'],'to':_0x4c9990[_0xa2ac('0x60')]['from'],'cc':_0x4c9990['body']['cc'],'subject':_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xad')],'attach':_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xae')],'firstMsgDirection':_0xa2ac('0xaf'),'lastMsgAt':moment()['format'](_0xa2ac('0x9c')),'lastMsgDirection':_0xa2ac('0xaf'),'Messages':[_[_0xa2ac('0x54')](_0x4c9990['body'],{'messageId':_0x104458['messageId'],'sentAt':moment()[_0xa2ac('0xa4')](_0xa2ac('0x9c')),'read':!![],'MailAccountId':_0x4a466f['id'],'UserId':_0x4c9990[_0xa2ac('0x35')]['id'],'ContactId':_0x308125['id']})]};if(_0x4c9990['body'][_0xa2ac('0xb0')]){_0x3d0170=_[_0xa2ac('0x54')](_0x3d0170,_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xb0')]);}return db['MailInteraction'][_0xa2ac('0x69')](_0x3d0170,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0xa2ac('0x24')](respondWithResult(_0x4164be,null))['catch'](handleError(_0x4164be,null));};exports[_0xa2ac('0xb1')]=function(_0x5df2ca,_0x39fab7){return db[_0xa2ac('0x43')][_0xa2ac('0x5f')]({'where':{'id':_0x5df2ca[_0xa2ac('0x5b')]['id']},'include':[{'model':db[_0xa2ac('0x5c')],'as':_0xa2ac('0x40'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa2ac('0xa2'),'raw':!![]}]}]})[_0xa2ac('0x24')](handleEntityNotFound(_0x39fab7,null))[_0xa2ac('0x24')](function(_0x163911){if(!_0x163911[_0xa2ac('0x40')])return;var _0x562e4f=_0x163911[_0xa2ac('0xab')]();return respondWithRpcPromise('VerifySmtp',_0xa2ac('0xb1'),{'account':_0x562e4f});})[_0xa2ac('0x24')](respondWithResult(_0x39fab7,null))[_0xa2ac('0x18')](handleError(_0x39fab7,null));};exports[_0xa2ac('0x23')]=function(_0x14a497,_0x4b429a){return db[_0xa2ac('0x43')][_0xa2ac('0x5f')]({'where':{'id':_0x14a497[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x4b429a,null))[_0xa2ac('0x24')](function(_0x3592db){if(_0x3592db&&_0x3592db[_0xa2ac('0x3d')]){throw new db[(_0xa2ac('0xb2'))][(_0xa2ac('0xb3'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x3592db;})[_0xa2ac('0x24')](removeEntity(_0x4b429a,null))[_0xa2ac('0x18')](handleError(_0x4b429a,null));};exports[_0xa2ac('0xb4')]=function(_0x1977a9,_0x4d82ec){return db['MailAccount'][_0xa2ac('0x5f')]({'where':{'id':_0x1977a9['params']['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x4d82ec,null))['then'](function(_0x211981){if(_0x211981){return _0x211981[_0xa2ac('0xb4')](_0x1977a9[_0xa2ac('0x60')][_0xa2ac('0x6e')],_[_0xa2ac('0x85')](_0x1977a9['body'],['ids','id'])||{})['spread'](function(_0x343737){for(var _0x33c89f=0x0;_0x33c89f<_0x1977a9['body'][_0xa2ac('0x6e')][_0xa2ac('0x4d')];_0x33c89f+=0x1){socket[_0xa2ac('0xb5')]('userMailAccount:save',{'UserId':Number(_0x1977a9[_0xa2ac('0x60')]['ids'][_0x33c89f]),'MailAccountId':Number(_0x1977a9[_0xa2ac('0x5b')]['id'])});}return _0x343737;});}})['then'](respondWithResult(_0x4d82ec,null))[_0xa2ac('0x18')](handleError(_0x4d82ec,null));};exports['removeAgents']=function(_0x2efc9a,_0x372156){return db['MailAccount']['find']({'where':{'id':_0x2efc9a['params']['id']}})['then'](handleEntityNotFound(_0x372156,null))['then'](function(_0x176267){if(_0x176267){return _0x176267['removeAgents'](_0x2efc9a[_0xa2ac('0x48')][_0xa2ac('0x6e')])['then'](function(){if(_[_0xa2ac('0xb6')](_0x2efc9a[_0xa2ac('0x48')][_0xa2ac('0x6e')])){for(var _0x39f96=0x0;_0x39f96<_0x2efc9a[_0xa2ac('0x48')][_0xa2ac('0x6e')][_0xa2ac('0x4d')];_0x39f96+=0x1){socket[_0xa2ac('0xb5')](_0xa2ac('0xb7'),{'UserId':Number(_0x2efc9a[_0xa2ac('0x48')][_0xa2ac('0x6e')][_0x39f96]),'MailAccountId':Number(_0x2efc9a[_0xa2ac('0x5b')]['id'])});}}else{socket[_0xa2ac('0xb5')]('userMailAccount:remove',{'UserId':Number(_0x2efc9a[_0xa2ac('0x48')][_0xa2ac('0x6e')]),'MailAccountId':Number(_0x2efc9a[_0xa2ac('0x5b')]['id'])});}});}})[_0xa2ac('0x24')](respondWithStatusCode(_0x372156,null))[_0xa2ac('0x18')](handleError(_0x372156,null));};exports[_0xa2ac('0xb8')]=function(_0x3a774e,_0x43a78c){var _0x5a7f03={};var _0x40b8cd={};var _0x1c1f70;var _0x2d8799;return db[_0xa2ac('0x43')][_0xa2ac('0x6a')]({'where':{'id':_0x3a774e['params']['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x43a78c,null))[_0xa2ac('0x24')](function(_0x38dacf){if(_0x38dacf){_0x1c1f70=_0x38dacf;_0x40b8cd[_0xa2ac('0x47')]=_[_0xa2ac('0x5e')](db[_0xa2ac('0x87')]['rawAttributes']);_0x40b8cd['query']=_[_0xa2ac('0x5e')](_0x3a774e[_0xa2ac('0x48')]);_0x40b8cd[_0xa2ac('0x49')]=_[_0xa2ac('0x4a')](_0x40b8cd['model'],_0x40b8cd['query']);_0x5a7f03[_0xa2ac('0x4c')]=_[_0xa2ac('0x4a')](_0x40b8cd[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0x3a774e[_0xa2ac('0x48')]['fields']));_0x5a7f03[_0xa2ac('0x4c')]=_0x5a7f03['attributes'][_0xa2ac('0x4d')]?_0x5a7f03['attributes']:_0x40b8cd[_0xa2ac('0x47')];_0x5a7f03[_0xa2ac('0x4f')]=qs[_0xa2ac('0x50')](_0x3a774e[_0xa2ac('0x48')]['sort']);_0x5a7f03[_0xa2ac('0x53')]=qs[_0xa2ac('0x49')](_[_0xa2ac('0x51')](_0x3a774e['query'],_0x40b8cd[_0xa2ac('0x49')]));if(_0x3a774e[_0xa2ac('0x48')][_0xa2ac('0x52')]){_0x5a7f03['where']=_['merge'](_0x5a7f03[_0xa2ac('0x53')],{'$or':_['map'](_0x5a7f03[_0xa2ac('0x4c')],function(_0x281b72){var _0x17c1bb={};_0x17c1bb[_0x281b72]={'$like':'%'+_0x3a774e['query'][_0xa2ac('0x52')]+'%'};return _0x17c1bb;})});}_0x5a7f03=_[_0xa2ac('0x54')]({},_0x5a7f03,_0x3a774e[_0xa2ac('0x56')]);return _0x1c1f70[_0xa2ac('0xb8')](_0x5a7f03);}})[_0xa2ac('0x24')](function(_0x128d72){if(_0x128d72){_0x2d8799=_0x128d72[_0xa2ac('0x4d')];if(!_0x3a774e[_0xa2ac('0x48')][_0xa2ac('0x6b')](_0xa2ac('0x4e'))){_0x5a7f03[_0xa2ac('0x1f')]=qs[_0xa2ac('0x1f')](_0x3a774e[_0xa2ac('0x48')][_0xa2ac('0x1f')]);_0x5a7f03[_0xa2ac('0x1d')]=qs['offset'](_0x3a774e[_0xa2ac('0x48')][_0xa2ac('0x1d')]);}return _0x1c1f70[_0xa2ac('0xb8')](_0x5a7f03);}})[_0xa2ac('0x24')](function(_0x1604f2){if(_0x1604f2){return _0x1604f2?{'count':_0x2d8799,'rows':_0x1604f2}:null;}})[_0xa2ac('0x24')](respondWithResult(_0x43a78c,null))['catch'](handleError(_0x43a78c,null));}; \ No newline at end of file +var _0xa3ee=['out','YYYY-MM-DD\x20HH:mm:ss','Interaction','getSmtpOptions','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','User','moment','bluebird','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','UserProfileResource','stack','name','send','gmail','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','pass','password','modernAuthentication','CloudProviderId','port','host','secure','authentication','Imap','Smtp','index','MailServerIn','Pause','MailAccount','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','mandatoryDispositionPause','find','body','provider','custom','params','MailServerOut','Mail\x20Account\x20not\x20found','service','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','create','getAnswers','findAll','removeAnswers','email','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','CmContact','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','finally','getApplications','getMessages','MailMessage','split','format','includeAll','inlineCss','CmList','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','SendMail','List\x20not\x20found','Contacts','ListId','messageId','subject','attach'];(function(_0x2dbe7e,_0x1866e5){var _0x15f7e4=function(_0x1b9161){while(--_0x1b9161){_0x2dbe7e['push'](_0x2dbe7e['shift']());}};_0x15f7e4(++_0x1866e5);}(_0xa3ee,0x18e));var _0xea3e=function(_0x31c091,_0x2dc544){_0x31c091=_0x31c091-0x0;var _0x40f918=_0xa3ee[_0x31c091];return _0x40f918;};'use strict';var moment=require(_0xea3e('0x0'));var BPromise=require(_0xea3e('0x1'));var util=require(_0xea3e('0x2'));var path=require(_0xea3e('0x3'));var _=require(_0xea3e('0x4'));var juice=require(_0xea3e('0x5'));var Redis=require('ioredis');var qs=require(_0xea3e('0x6'));var logger=require(_0xea3e('0x7'))(_0xea3e('0x8'));var config=require(_0xea3e('0x9'));var db=require(_0xea3e('0xa'))['db'];config[_0xea3e('0xb')]=_[_0xea3e('0xc')](config['redis'],{'host':_0xea3e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea3e('0xb')]));require(_0xea3e('0xe'))[_0xea3e('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0xea3e('0x10')][_0xea3e('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x3648ea,_0x2224d6,_0x5074da,_0x1f4a91){return new BPromise(function(_0x5a88df,_0x49821b){var _0x348e9d=_0x1f4a91||client;return _0x348e9d['request'](_0x3648ea,_0x5074da)[_0xea3e('0x12')](function(_0xc7df80){logger[_0xea3e('0x13')](_0xea3e('0x14'),_0x2224d6,_0xea3e('0x15'));logger[_0xea3e('0x16')](_0xea3e('0x17'),_0x2224d6,_0xea3e('0x15'),JSON[_0xea3e('0x18')](_0xc7df80));if(_0xc7df80[_0xea3e('0x19')]){if(_0xc7df80[_0xea3e('0x19')]['code']===0x1f4){logger['error'](_0xea3e('0x14'),_0x2224d6,_0xc7df80['error'][_0xea3e('0x1a')]);return _0x49821b(_0xc7df80[_0xea3e('0x19')][_0xea3e('0x1a')]);}logger[_0xea3e('0x19')]('MailAccount,\x20%s,\x20%s',_0x2224d6,_0xc7df80['error'][_0xea3e('0x1a')]);return _0x5a88df(_0xc7df80[_0xea3e('0x19')][_0xea3e('0x1a')]);}else{logger[_0xea3e('0x13')](_0xea3e('0x14'),_0x2224d6,'request\x20sent');_0x5a88df(_0xc7df80[_0xea3e('0x1b')][_0xea3e('0x1a')]);}})[_0xea3e('0x1c')](function(_0xf014ea){logger[_0xea3e('0x19')](_0xea3e('0x14'),_0x2224d6,_0xf014ea);_0x49821b(_0xf014ea);});});}function respondWithStatusCode(_0x2bd1aa,_0x43f753){_0x43f753=_0x43f753||0xcc;return function(_0x2c70f7){if(_0x2c70f7){return _0x2bd1aa[_0xea3e('0x1d')](_0x43f753);}return _0x2bd1aa[_0xea3e('0x1e')](_0x43f753)[_0xea3e('0x1f')]();};}function respondWithResult(_0xd084fa,_0x4c606c){_0x4c606c=_0x4c606c||0xc8;return function(_0x26014d){if(_0x26014d){return _0xd084fa['status'](_0x4c606c)[_0xea3e('0x20')](_0x26014d);}};}function respondWithFilteredResult(_0x44496c,_0x460523){return function(_0x3f94f7){if(_0x3f94f7){var _0xa2bd7a=typeof _0x460523[_0xea3e('0x21')]===_0xea3e('0x22')&&typeof _0x460523[_0xea3e('0x23')]===_0xea3e('0x22');var _0x1036f5=_0x3f94f7[_0xea3e('0x24')];var _0x17726c=_0xa2bd7a?0x0:_0x460523[_0xea3e('0x21')];var _0x388d2b=_0xa2bd7a?_0x3f94f7[_0xea3e('0x24')]:_0x460523['offset']+_0x460523[_0xea3e('0x23')];var _0x1f1fd9;if(_0x388d2b>=_0x1036f5){_0x388d2b=_0x1036f5;_0x1f1fd9=0xc8;}else{_0x1f1fd9=0xce;}_0x44496c[_0xea3e('0x1e')](_0x1f1fd9);return _0x44496c[_0xea3e('0x25')](_0xea3e('0x26'),_0x17726c+'-'+_0x388d2b+'/'+_0x1036f5)['json'](_0x3f94f7);}return null;};}function saveUpdates(_0x502d36){return function(_0x442998){if(_0x442998){return _0x442998[_0xea3e('0x27')](_0x502d36)[_0xea3e('0x12')](function(_0xa0f838){return _0xa0f838;});}return null;};}function removeEntity(_0x4bbc7e){return function(_0x4f3a96){if(_0x4f3a96){return _0x4f3a96[_0xea3e('0x28')]()[_0xea3e('0x12')](function(){var _0x5bb071=_0x4f3a96['get']({'plain':!![]});var _0x32a9fd='MailAccounts';return db[_0xea3e('0x29')][_0xea3e('0x28')]({'where':{'type':_0x32a9fd,'resourceId':_0x5bb071['id']}})[_0xea3e('0x12')](function(){return _0x4f3a96;});})['then'](function(){_0x4bbc7e[_0xea3e('0x1e')](0xcc)[_0xea3e('0x1f')]();});}};}function handleEntityNotFound(_0x4375ac){return function(_0x3c8c5a){if(!_0x3c8c5a){_0x4375ac['sendStatus'](0x194);}return _0x3c8c5a;};}function handleError(_0x2dee71,_0xfacfaa){_0xfacfaa=_0xfacfaa||0x1f4;return function(_0x5b9867){logger[_0xea3e('0x19')](_0x5b9867[_0xea3e('0x2a')]);if(_0x5b9867[_0xea3e('0x2b')]){delete _0x5b9867['name'];}_0x2dee71['status'](_0xfacfaa)[_0xea3e('0x2c')](_0x5b9867);};}function getImapHost(_0x1fca9f){switch(_0x1fca9f){case _0xea3e('0x2d'):return _0xea3e('0x2e');case'yahoo':return _0xea3e('0x2f');case'hotmail':return _0xea3e('0x30');case _0xea3e('0x31'):return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x1fca9f);}function getSmtpHost(_0x6bd628){switch(_0x6bd628){case _0xea3e('0x2d'):return _0xea3e('0x32');case _0xea3e('0x33'):return _0xea3e('0x34');case _0xea3e('0x35'):return _0xea3e('0x36');case'outlook365':return _0xea3e('0x37');}throw new Error(_0xea3e('0x38'),_0x6bd628);}function getAuthenticationOptions(_0x4415ab,_0x161162){var _0x1b86a7={};var _0xdea94={};if(_0x4415ab){_0x1b86a7[_0xea3e('0x39')]=_0xdea94[_0xea3e('0x39')]=_0x161162[_0xea3e('0x3a')];_0x1b86a7['password']=_0xdea94[_0xea3e('0x3b')]=_0x161162[_0xea3e('0x3c')];if(_0x161162[_0xea3e('0x3d')]){_0x1b86a7['modernAuthentication']=_0xdea94['modernAuthentication']=!![];_0x1b86a7[_0xea3e('0x3e')]=_0xdea94[_0xea3e('0x3e')]=_0x161162['CloudProviderId'];_0x1b86a7[_0xea3e('0x3c')]=_0xdea94[_0xea3e('0x3b')]=null;}else{_0x1b86a7[_0xea3e('0x3e')]=_0xdea94['CloudProviderId']=null;}_0x1b86a7['host']=getImapHost(_0x4415ab);_0x1b86a7[_0xea3e('0x3f')]=0x3e1;_0xdea94[_0xea3e('0x40')]=getSmtpHost(_0x4415ab);_0xdea94[_0xea3e('0x3f')]=0x24b;_0xdea94[_0xea3e('0x41')]=![];_0x1b86a7['service']=_0xdea94['service']=null;}else{if(_0x161162[_0xea3e('0x42')]){_0x1b86a7[_0xea3e('0x39')]=_0xdea94['user']=_0x161162['username'];_0x1b86a7[_0xea3e('0x3c')]=_0xdea94['pass']=_0x161162['password'];}else{_0x1b86a7[_0xea3e('0x42')]=_0xdea94['authentication']=![];_0x1b86a7[_0xea3e('0x39')]=_0xdea94[_0xea3e('0x39')]=null;_0x1b86a7['password']=_0xdea94[_0xea3e('0x3b')]=null;}_0x1b86a7[_0xea3e('0x40')]=_0x161162[_0xea3e('0x43')]['host'];_0x1b86a7[_0xea3e('0x3f')]=_0x161162[_0xea3e('0x43')]['port'];_0xdea94[_0xea3e('0x40')]=_0x161162[_0xea3e('0x44')][_0xea3e('0x40')];_0xdea94[_0xea3e('0x3f')]=_0x161162['Smtp'][_0xea3e('0x3f')];}return{'Imap':_0x1b86a7,'Smtp':_0xdea94};}exports[_0xea3e('0x45')]=function(_0x3613e9,_0x364937){var _0xd737f7={'include':[{'model':db[_0xea3e('0x46')],'as':_0xea3e('0x43')},{'model':db['MailServerOut'],'as':_0xea3e('0x44')},{'model':db[_0xea3e('0x47')],'as':'mandatoryDispositionPause'}]},_0xa19d48={},_0x53e0ef={'count':0x0,'rows':[]};var _0x44eb8d=_['map'](db[_0xea3e('0x48')][_0xea3e('0x49')],function(_0x1d49e0){return{'name':_0x1d49e0['fieldName'],'type':_0x1d49e0['type'][_0xea3e('0x4a')]};});_0xa19d48[_0xea3e('0x4b')]=_[_0xea3e('0x4c')](_0x44eb8d,_0xea3e('0x2b'));_0xa19d48[_0xea3e('0x4d')]=_[_0xea3e('0x4e')](_0x3613e9[_0xea3e('0x4d')]);_0xa19d48[_0xea3e('0x4f')]=_[_0xea3e('0x50')](_0xa19d48[_0xea3e('0x4b')],_0xa19d48['query']);_0xd737f7['attributes']=_[_0xea3e('0x50')](_0xa19d48[_0xea3e('0x4b')],qs[_0xea3e('0x51')](_0x3613e9[_0xea3e('0x4d')][_0xea3e('0x51')]));_0xd737f7[_0xea3e('0x52')]=_0xd737f7[_0xea3e('0x52')][_0xea3e('0x53')]?_0xd737f7['attributes']:_0xa19d48[_0xea3e('0x4b')];if(!_0x3613e9[_0xea3e('0x4d')][_0xea3e('0x54')](_0xea3e('0x55'))){_0xd737f7[_0xea3e('0x23')]=qs[_0xea3e('0x23')](_0x3613e9[_0xea3e('0x4d')]['limit']);_0xd737f7[_0xea3e('0x21')]=qs[_0xea3e('0x21')](_0x3613e9[_0xea3e('0x4d')]['offset']);}_0xd737f7[_0xea3e('0x56')]=qs[_0xea3e('0x57')](_0x3613e9['query'][_0xea3e('0x57')]);_0xd737f7[_0xea3e('0x58')]=qs['filters'](_[_0xea3e('0x59')](_0x3613e9['query'],_0xa19d48['filters']),_0x44eb8d);if(_0x3613e9[_0xea3e('0x4d')][_0xea3e('0x5a')]){_0xd737f7['where']=_[_0xea3e('0x5b')](_0xd737f7[_0xea3e('0x58')],{'$or':_[_0xea3e('0x4c')](_0x44eb8d,function(_0x4d7b4c){if(_0x4d7b4c[_0xea3e('0x5c')]!==_0xea3e('0x5d')){var _0x199e1b={};_0x199e1b[_0x4d7b4c[_0xea3e('0x2b')]]={'$like':'%'+_0x3613e9[_0xea3e('0x4d')][_0xea3e('0x5a')]+'%'};return _0x199e1b;}})});}_0xd737f7=_[_0xea3e('0x5b')]({},_0xd737f7,_0x3613e9[_0xea3e('0x5e')]);var _0x33acee={'where':_0xd737f7[_0xea3e('0x58')]};return db['MailAccount'][_0xea3e('0x24')](_0x33acee)['then'](function(_0x65f183){_0x53e0ef[_0xea3e('0x24')]=_0x65f183;if(_0x3613e9[_0xea3e('0x4d')]['includeAll']){_0xd737f7[_0xea3e('0x5f')]=[{'all':!![]}];}return db[_0xea3e('0x48')]['findAll'](_0xd737f7);})[_0xea3e('0x12')](function(_0x3cb7e2){_0x53e0ef[_0xea3e('0x60')]=_0x3cb7e2;return _0x53e0ef;})[_0xea3e('0x12')](respondWithFilteredResult(_0x364937,_0xd737f7))[_0xea3e('0x1c')](handleError(_0x364937,null));};exports['show']=function(_0x4cc796,_0x30b51b){var _0x4c823b={'raw':![],'where':{'id':_0x4cc796['params']['id']},'include':[{'model':db[_0xea3e('0x46')],'as':_0xea3e('0x43')},{'model':db['MailServerOut'],'as':_0xea3e('0x44')},{'model':db[_0xea3e('0x47')],'as':_0xea3e('0x61')}]},_0x4a3f6d={};_0x4a3f6d[_0xea3e('0x4b')]=_[_0xea3e('0x4e')](db['MailAccount'][_0xea3e('0x49')]);_0x4a3f6d[_0xea3e('0x4d')]=_[_0xea3e('0x4e')](_0x4cc796['query']);_0x4a3f6d[_0xea3e('0x4f')]=_[_0xea3e('0x50')](_0x4a3f6d[_0xea3e('0x4b')],_0x4a3f6d[_0xea3e('0x4d')]);_0x4c823b[_0xea3e('0x52')]=_[_0xea3e('0x50')](_0x4a3f6d[_0xea3e('0x4b')],qs[_0xea3e('0x51')](_0x4cc796[_0xea3e('0x4d')][_0xea3e('0x51')]));_0x4c823b['attributes']=_0x4c823b['attributes'][_0xea3e('0x53')]?_0x4c823b[_0xea3e('0x52')]:_0x4a3f6d['model'];if(_0x4cc796[_0xea3e('0x4d')]['includeAll']){_0x4c823b[_0xea3e('0x5f')]=[{'all':!![]}];}_0x4c823b=_['merge']({},_0x4c823b,_0x4cc796['options']);return db['MailAccount'][_0xea3e('0x62')](_0x4c823b)[_0xea3e('0x12')](handleEntityNotFound(_0x30b51b,null))['then'](respondWithResult(_0x30b51b,null))[_0xea3e('0x1c')](handleError(_0x30b51b,null));};exports['update']=function(_0x427c7f,_0x2a2d5d){if(_0x427c7f['body']['id']){delete _0x427c7f[_0xea3e('0x63')]['id'];}var _0x217f0b=_0x427c7f[_0xea3e('0x63')][_0xea3e('0x64')]===_0xea3e('0x65')?null:_0x427c7f[_0xea3e('0x63')]['provider'];var _0x405cbf=_0x427c7f['body'][_0xea3e('0x43')]||{};var _0xc565e7=_0x427c7f[_0xea3e('0x63')]['Smtp']||{};if(_0x217f0b){_0x405cbf[_0xea3e('0x40')]=getImapHost(_0x217f0b);_0x405cbf[_0xea3e('0x3f')]=0x3e1;_0xc565e7[_0xea3e('0x40')]=getSmtpHost(_0x217f0b);_0xc565e7['port']=0x24b;_0xc565e7[_0xea3e('0x41')]=![];}if(_0xc565e7[_0xea3e('0x3d')]){_0xc565e7[_0xea3e('0x41')]=![];}else{_0xc565e7[_0xea3e('0x3e')]=null;}if(!_0x405cbf[_0xea3e('0x3d')])_0x405cbf[_0xea3e('0x3e')]=null;_0x427c7f[_0xea3e('0x63')]['Imap']=_0x405cbf;_0x427c7f[_0xea3e('0x63')][_0xea3e('0x44')]=_0xc565e7;return db[_0xea3e('0x48')]['find']({'where':{'id':_0x427c7f[_0xea3e('0x66')]['id']},'include':[{'model':db[_0xea3e('0x46')],'as':_0xea3e('0x43')},{'model':db[_0xea3e('0x67')],'as':'Smtp'},{'model':db[_0xea3e('0x47')],'as':_0xea3e('0x61')}]})[_0xea3e('0x12')](handleEntityNotFound(_0x2a2d5d,null))['then'](function(_0x542b15){if(!_0x542b15)throw new Error(_0xea3e('0x68'));if(_0x542b15[_0xea3e('0x69')])delete _0x427c7f[_0xea3e('0x63')][_0xea3e('0x43')];return _0x542b15;})[_0xea3e('0x12')](saveUpdates(_0x427c7f[_0xea3e('0x63')],null))[_0xea3e('0x12')](function(_0x404f0f){if(!_0x427c7f[_0xea3e('0x63')][_0xea3e('0x43')])return _0x404f0f;return db['MailServerIn']['update'](_0x427c7f['body'][_0xea3e('0x43')],{'where':{'MailAccountId':_0x404f0f['id']}})[_0xea3e('0x12')](function(){return _0x404f0f;});})[_0xea3e('0x12')](function(_0x4b4e2a){if(!_0x427c7f['body'][_0xea3e('0x44')])return _0x4b4e2a;return db[_0xea3e('0x67')][_0xea3e('0x27')](_0x427c7f[_0xea3e('0x63')][_0xea3e('0x44')],{'where':{'MailAccountId':_0x4b4e2a['id']}})['then'](function(){return _0x4b4e2a;});})[_0xea3e('0x12')](respondWithResult(_0x2a2d5d,null))[_0xea3e('0x1c')](handleError(_0x2a2d5d,null));};exports[_0xea3e('0x6a')]=function(_0x153494,_0x355a3b){return db[_0xea3e('0x48')]['describe']()[_0xea3e('0x12')](respondWithResult(_0x355a3b,null))[_0xea3e('0x1c')](handleError(_0x355a3b,null));};exports[_0xea3e('0x6b')]=function(_0x4561a7,_0xab1005){if(_0x4561a7[_0xea3e('0x63')]['id']){delete _0x4561a7[_0xea3e('0x63')]['id'];}return db['MailAccount'][_0xea3e('0x62')]({'where':{'id':_0x4561a7[_0xea3e('0x66')]['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0xab1005,null))['then'](function(_0x2c556e){if(_0x2c556e){_0x4561a7['body'][_0xea3e('0x6c')]=_0x2c556e['id'];return db[_0xea3e('0x6d')]['create'](_0x4561a7[_0xea3e('0x63')]);}})[_0xea3e('0x12')](respondWithResult(_0xab1005,null))['catch'](handleError(_0xab1005,null));};exports[_0xea3e('0x6e')]=function(_0x2c8059,_0x1f7089){var _0x29c67c={'raw':![],'where':{}};var _0x2de9a6={};var _0x5cb17d={'count':0x0,'rows':[]};return db[_0xea3e('0x48')][_0xea3e('0x6f')]({'where':{'id':_0x2c8059[_0xea3e('0x66')]['id']}})['then'](handleEntityNotFound(_0x1f7089,null))[_0xea3e('0x12')](function(_0x9985b6){if(_0x9985b6){_0x2de9a6[_0xea3e('0x4b')]=_[_0xea3e('0x4e')](db[_0xea3e('0x6d')]['rawAttributes']);_0x2de9a6['query']=_[_0xea3e('0x4e')](_0x2c8059['query']);_0x2de9a6[_0xea3e('0x4f')]=_[_0xea3e('0x50')](_0x2de9a6[_0xea3e('0x4b')],_0x2de9a6[_0xea3e('0x4d')]);_0x29c67c[_0xea3e('0x52')]=_[_0xea3e('0x50')](_0x2de9a6[_0xea3e('0x4b')],qs[_0xea3e('0x51')](_0x2c8059[_0xea3e('0x4d')][_0xea3e('0x51')]));_0x29c67c[_0xea3e('0x52')]=_0x29c67c[_0xea3e('0x52')]['length']?_0x29c67c[_0xea3e('0x52')]:_0x2de9a6[_0xea3e('0x4b')];if(!_0x2c8059[_0xea3e('0x4d')][_0xea3e('0x54')](_0xea3e('0x55'))){_0x29c67c[_0xea3e('0x23')]=qs[_0xea3e('0x23')](_0x2c8059['query'][_0xea3e('0x23')]);_0x29c67c['offset']=qs[_0xea3e('0x21')](_0x2c8059[_0xea3e('0x4d')][_0xea3e('0x21')]);}_0x29c67c['order']=qs[_0xea3e('0x57')](_0x2c8059[_0xea3e('0x4d')]['sort']);_0x29c67c[_0xea3e('0x58')]=qs[_0xea3e('0x4f')](_[_0xea3e('0x59')](_0x2c8059[_0xea3e('0x4d')],_0x2de9a6[_0xea3e('0x4f')]));_0x29c67c['where'][_0xea3e('0x6c')]=_0x9985b6['id'];if(_0x2c8059[_0xea3e('0x4d')][_0xea3e('0x5a')]){_0x29c67c['where']=_[_0xea3e('0x5b')](_0x29c67c[_0xea3e('0x58')],{'$or':_['map'](_0x29c67c['attributes'],function(_0x417a5b){var _0x2b1d14={};_0x2b1d14[_0x417a5b]={'$like':'%'+_0x2c8059[_0xea3e('0x4d')][_0xea3e('0x5a')]+'%'};return _0x2b1d14;})});}_0x29c67c=_[_0xea3e('0x5b')]({},_0x29c67c,_0x2c8059[_0xea3e('0x5e')]);return db[_0xea3e('0x6d')][_0xea3e('0x24')]({'where':_0x29c67c['where']})['then'](function(_0x181f59){_0x5cb17d[_0xea3e('0x24')]=_0x181f59;if(_0x2c8059['query']['includeAll']){_0x29c67c['include']=[{'all':!![]}];}return db[_0xea3e('0x6d')]['findAll'](_0x29c67c);})[_0xea3e('0x12')](function(_0x15be8a){_0x5cb17d[_0xea3e('0x60')]=_0x15be8a;return _0x5cb17d;});}})['then'](respondWithFilteredResult(_0x1f7089,_0x29c67c))[_0xea3e('0x1c')](handleError(_0x1f7089,null));};exports['removeDispositions']=function(_0x41fd34,_0xee6ff5){return db['MailAccount'][_0xea3e('0x62')]({'where':{'id':_0x41fd34['params']['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0xee6ff5,null))[_0xea3e('0x12')](function(_0x1f2e27){if(_0x1f2e27){return _0x1f2e27[_0xea3e('0x70')](_0x41fd34[_0xea3e('0x4d')][_0xea3e('0x71')]);}})['then'](respondWithStatusCode(_0xee6ff5,null))[_0xea3e('0x1c')](handleError(_0xee6ff5,null));};exports['addAnswer']=function(_0x35f4a4,_0x50b0a1){if(_0x35f4a4[_0xea3e('0x63')]['id']){delete _0x35f4a4[_0xea3e('0x63')]['id'];}return db[_0xea3e('0x48')][_0xea3e('0x62')]({'where':{'id':_0x35f4a4['params']['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0x50b0a1,null))[_0xea3e('0x12')](function(_0x588807){if(_0x588807){_0x35f4a4[_0xea3e('0x63')][_0xea3e('0x6c')]=_0x588807['id'];return db[_0xea3e('0x72')][_0xea3e('0x73')](_0x35f4a4[_0xea3e('0x63')]);}})['then'](respondWithResult(_0x50b0a1,null))[_0xea3e('0x1c')](handleError(_0x50b0a1,null));};exports[_0xea3e('0x74')]=function(_0x1c7117,_0x3cc8d3){var _0xb3d228={'raw':![],'where':{}};var _0x27d762={};var _0x193ce5={'count':0x0,'rows':[]};return db[_0xea3e('0x48')][_0xea3e('0x6f')]({'where':{'id':_0x1c7117[_0xea3e('0x66')]['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0x3cc8d3,null))[_0xea3e('0x12')](function(_0x16b495){if(_0x16b495){_0x27d762[_0xea3e('0x4b')]=_[_0xea3e('0x4e')](db['CannedAnswer'][_0xea3e('0x49')]);_0x27d762[_0xea3e('0x4d')]=_[_0xea3e('0x4e')](_0x1c7117[_0xea3e('0x4d')]);_0x27d762[_0xea3e('0x4f')]=_['intersection'](_0x27d762['model'],_0x27d762[_0xea3e('0x4d')]);_0xb3d228['attributes']=_[_0xea3e('0x50')](_0x27d762[_0xea3e('0x4b')],qs[_0xea3e('0x51')](_0x1c7117[_0xea3e('0x4d')][_0xea3e('0x51')]));_0xb3d228[_0xea3e('0x52')]=_0xb3d228[_0xea3e('0x52')][_0xea3e('0x53')]?_0xb3d228[_0xea3e('0x52')]:_0x27d762['model'];if(!_0x1c7117[_0xea3e('0x4d')]['hasOwnProperty'](_0xea3e('0x55'))){_0xb3d228[_0xea3e('0x23')]=qs[_0xea3e('0x23')](_0x1c7117[_0xea3e('0x4d')][_0xea3e('0x23')]);_0xb3d228[_0xea3e('0x21')]=qs[_0xea3e('0x21')](_0x1c7117[_0xea3e('0x4d')][_0xea3e('0x21')]);}_0xb3d228[_0xea3e('0x56')]=qs['sort'](_0x1c7117[_0xea3e('0x4d')][_0xea3e('0x57')]);_0xb3d228[_0xea3e('0x58')]=qs['filters'](_[_0xea3e('0x59')](_0x1c7117[_0xea3e('0x4d')],_0x27d762[_0xea3e('0x4f')]));_0xb3d228[_0xea3e('0x58')]['MailAccountId']=_0x16b495['id'];if(_0x1c7117[_0xea3e('0x4d')][_0xea3e('0x5a')]){_0xb3d228[_0xea3e('0x58')]=_[_0xea3e('0x5b')](_0xb3d228[_0xea3e('0x58')],{'$or':_[_0xea3e('0x4c')](_0xb3d228[_0xea3e('0x52')],function(_0x15b9a1){var _0x5429c0={};_0x5429c0[_0x15b9a1]={'$like':'%'+_0x1c7117['query']['filter']+'%'};return _0x5429c0;})});}_0xb3d228=_['merge']({},_0xb3d228,_0x1c7117[_0xea3e('0x5e')]);return db['CannedAnswer'][_0xea3e('0x24')]({'where':_0xb3d228[_0xea3e('0x58')]})[_0xea3e('0x12')](function(_0x2f0de2){_0x193ce5[_0xea3e('0x24')]=_0x2f0de2;if(_0x1c7117['query']['includeAll']){_0xb3d228[_0xea3e('0x5f')]=[{'all':!![]}];}return db[_0xea3e('0x72')][_0xea3e('0x75')](_0xb3d228);})[_0xea3e('0x12')](function(_0x544005){_0x193ce5['rows']=_0x544005;return _0x193ce5;});}})[_0xea3e('0x12')](respondWithFilteredResult(_0x3cc8d3,_0xb3d228))['catch'](handleError(_0x3cc8d3,null));};exports[_0xea3e('0x76')]=function(_0x40d90d,_0x4865cf){return db[_0xea3e('0x48')]['find']({'where':{'id':_0x40d90d[_0xea3e('0x66')]['id']}})['then'](handleEntityNotFound(_0x4865cf,null))[_0xea3e('0x12')](function(_0x336e2a){if(_0x336e2a){return _0x336e2a[_0xea3e('0x76')](_0x40d90d[_0xea3e('0x4d')][_0xea3e('0x71')]);}})[_0xea3e('0x12')](respondWithStatusCode(_0x4865cf,null))['catch'](handleError(_0x4865cf,null));};exports[_0xea3e('0x73')]=function(_0x5f332c,_0xf6f8b0){var _0x16fdec={'name':_0x5f332c['body'][_0xea3e('0x2b')],'key':_0x5f332c[_0xea3e('0x63')][_0xea3e('0x4a')],'provider':_0x5f332c[_0xea3e('0x63')][_0xea3e('0x64')]===_0xea3e('0x65')?null:_0x5f332c[_0xea3e('0x63')][_0xea3e('0x64')],'email':_0x5f332c[_0xea3e('0x63')][_0xea3e('0x77')],'ListId':_0x5f332c[_0xea3e('0x63')]['ListId'],'active':!_[_0xea3e('0x78')](_0x5f332c[_0xea3e('0x63')][_0xea3e('0x79')])?_0x5f332c[_0xea3e('0x63')][_0xea3e('0x79')]:!![],'description':_0x5f332c['body'][_0xea3e('0x7a')]||null};var _0x337a24=getAuthenticationOptions(_0x16fdec[_0xea3e('0x64')],_0x5f332c[_0xea3e('0x63')]);_0x16fdec[_0xea3e('0x43')]=_0x337a24['Imap'];_0x16fdec[_0xea3e('0x44')]=_0x337a24[_0xea3e('0x44')];return db[_0xea3e('0x48')]['create'](_0x16fdec,{'include':[{'model':db[_0xea3e('0x67')],'as':_0xea3e('0x44')},{'model':db['MailServerIn'],'as':_0xea3e('0x43')}]})[_0xea3e('0x12')](function(_0x3cbfd6){var _0x4607ec=_0x5f332c[_0xea3e('0x39')]['get']({'plain':!![]});if(!_0x4607ec)throw new Error(_0xea3e('0x7b'));if(_0x4607ec['role']==='user'){var _0x51040b=_0x3cbfd6['get']({'plain':!![]});return db[_0xea3e('0x7c')][_0xea3e('0x62')]({'where':{'name':'MailAccounts','userProfileId':_0x4607ec['userProfileId']},'raw':!![]})['then'](function(_0x2e41af){if(_0x2e41af&&_0x2e41af[_0xea3e('0x7d')]===0x0){return db[_0xea3e('0x29')][_0xea3e('0x73')]({'name':_0x51040b[_0xea3e('0x2b')],'resourceId':_0x51040b['id'],'type':_0x2e41af['name'],'sectionId':_0x2e41af['id']},{})[_0xea3e('0x12')](function(){return _0x3cbfd6;});}else{return _0x3cbfd6;}})[_0xea3e('0x1c')](function(_0x18a685){logger[_0xea3e('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18a685);throw _0x18a685;});}return _0x3cbfd6;})['then'](respondWithResult(_0xf6f8b0,0xc9))[_0xea3e('0x1c')](handleError(_0xf6f8b0,null));};exports[_0xea3e('0x7e')]=function(_0xe7e80a,_0x4f03a1){return db[_0xea3e('0x48')][_0xea3e('0x6f')]({'where':{'id':_0xe7e80a[_0xea3e('0x66')]['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0x4f03a1,null))[_0xea3e('0x12')](function(_0x10fd05){if(_0x10fd05){return _0x10fd05[_0xea3e('0x7e')]();}return null;})[_0xea3e('0x12')](respondWithResult(_0x4f03a1,null))[_0xea3e('0x1c')](handleError(_0x4f03a1,null));};exports[_0xea3e('0x7f')]=function(_0x224e43,_0x1781a1){if(_0x224e43['body']['id']){delete _0x224e43[_0xea3e('0x63')]['id'];}return db[_0xea3e('0x48')][_0xea3e('0x62')]({'where':{'id':_0x224e43[_0xea3e('0x66')]['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0x1781a1,null))[_0xea3e('0x12')](function(_0x240c77){if(_0x240c77){_0x224e43[_0xea3e('0x63')][_0xea3e('0x6c')]=_0x240c77['id'];return db['MailServerIn']['create'](_0x224e43[_0xea3e('0x63')]);}})[_0xea3e('0x12')](respondWithResult(_0x1781a1,null))[_0xea3e('0x1c')](handleError(_0x1781a1,null));};exports['removeImap']=function(_0x235a79,_0x437a70){return db[_0xea3e('0x48')][_0xea3e('0x6f')]({'where':{'id':_0x235a79['params']['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0x437a70,null))[_0xea3e('0x12')](function(_0x30e5c9){if(_0x30e5c9){return _0x30e5c9[_0xea3e('0x80')](null);}return null;})['then'](respondWithStatusCode(_0x437a70,null))[_0xea3e('0x1c')](handleError(_0x437a70,null));};exports['getSmtp']=function(_0xe1a743,_0x4beed2){return db[_0xea3e('0x48')][_0xea3e('0x6f')]({'where':{'id':_0xe1a743[_0xea3e('0x66')]['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0x4beed2,null))[_0xea3e('0x12')](function(_0x340b24){if(_0x340b24){return _0x340b24[_0xea3e('0x81')]();}return null;})[_0xea3e('0x12')](respondWithResult(_0x4beed2,null))[_0xea3e('0x1c')](handleError(_0x4beed2,null));};exports[_0xea3e('0x82')]=function(_0x64875e,_0x4c940e){if(_0x64875e[_0xea3e('0x63')]['id']){delete _0x64875e[_0xea3e('0x63')]['id'];}return db['MailAccount'][_0xea3e('0x62')]({'where':{'id':_0x64875e[_0xea3e('0x66')]['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0x4c940e,null))['then'](function(_0x179d03){if(_0x179d03){_0x64875e[_0xea3e('0x63')]['MailAccountId']=_0x179d03['id'];return db['MailServerOut']['create'](_0x64875e[_0xea3e('0x63')]);}})[_0xea3e('0x12')](respondWithResult(_0x4c940e,null))[_0xea3e('0x1c')](handleError(_0x4c940e,null));};exports[_0xea3e('0x83')]=function(_0x2f1e6f,_0x47b802){return db[_0xea3e('0x48')]['findOne']({'where':{'id':_0x2f1e6f['params']['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0x47b802,null))['then'](function(_0x334823){if(_0x334823){return _0x334823[_0xea3e('0x84')](null);}return null;})[_0xea3e('0x12')](respondWithStatusCode(_0x47b802,null))[_0xea3e('0x1c')](handleError(_0x47b802,null));};exports[_0xea3e('0x85')]=function(_0x1882bf,_0x1e3669){return db['MailInteraction'][_0xea3e('0x62')]({'where':{'id':_0x1882bf[_0xea3e('0x66')]['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0x1e3669,null))[_0xea3e('0x12')](function(_0x326339){if(_0x326339){return _0x326339['addInteraction'](_0x1882bf['body'][_0xea3e('0x71')],_['omit'](_0x1882bf[_0xea3e('0x63')],[_0xea3e('0x71'),'id'])||{});}})['then'](respondWithResult(_0x1e3669,null))['catch'](handleError(_0x1e3669,null));};exports['getInteractions']=function(_0x4355a8,_0x285631){var _0x343aed={'raw':![],'where':{}};var _0x521468={};var _0x516e6c={'count':0x0,'rows':[]};return db[_0xea3e('0x48')][_0xea3e('0x6f')]({'where':{'id':_0x4355a8[_0xea3e('0x66')]['id']}})['then'](handleEntityNotFound(_0x285631,null))[_0xea3e('0x12')](function(_0x556f70){if(_0x556f70){_0x521468[_0xea3e('0x4b')]=_['keys'](db[_0xea3e('0x86')][_0xea3e('0x49')]);_0x521468[_0xea3e('0x4d')]=_[_0xea3e('0x4e')](_0x4355a8[_0xea3e('0x4d')]);_0x521468[_0xea3e('0x4f')]=_[_0xea3e('0x50')](_0x521468[_0xea3e('0x4b')],_0x521468[_0xea3e('0x4d')]);_0x343aed[_0xea3e('0x52')]=_[_0xea3e('0x50')](_0x521468[_0xea3e('0x4b')],qs[_0xea3e('0x51')](_0x4355a8['query'][_0xea3e('0x51')]));_0x343aed[_0xea3e('0x52')]=_0x343aed['attributes'][_0xea3e('0x53')]?_0x343aed[_0xea3e('0x52')]:_0x521468[_0xea3e('0x4b')];if(!_0x4355a8[_0xea3e('0x4d')][_0xea3e('0x54')](_0xea3e('0x55'))){_0x343aed[_0xea3e('0x23')]=qs[_0xea3e('0x23')](_0x4355a8[_0xea3e('0x4d')][_0xea3e('0x23')]);_0x343aed[_0xea3e('0x21')]=qs[_0xea3e('0x21')](_0x4355a8[_0xea3e('0x4d')]['offset']);}_0x343aed[_0xea3e('0x56')]=qs[_0xea3e('0x57')](_0x4355a8[_0xea3e('0x4d')][_0xea3e('0x57')]);_0x343aed[_0xea3e('0x58')]=qs[_0xea3e('0x4f')](_[_0xea3e('0x59')](_0x4355a8['query'],_0x521468[_0xea3e('0x4f')]));_0x343aed[_0xea3e('0x58')][_0xea3e('0x6c')]=_0x556f70['id'];if(_0x4355a8[_0xea3e('0x4d')][_0xea3e('0x5a')]){_0x343aed[_0xea3e('0x58')]=_[_0xea3e('0x5b')](_0x343aed[_0xea3e('0x58')],{'$or':_[_0xea3e('0x4c')](_0x343aed[_0xea3e('0x52')],function(_0x1d3cdf){var _0x454582={};_0x454582[_0x1d3cdf]={'$like':'%'+_0x4355a8[_0xea3e('0x4d')][_0xea3e('0x5a')]+'%'};return _0x454582;})});}_0x343aed=_[_0xea3e('0x5b')]({},_0x343aed,_0x4355a8['options']);return db['MailInteraction'][_0xea3e('0x24')]({'where':_0x343aed[_0xea3e('0x58')]})['then'](function(_0x122e7a){_0x516e6c[_0xea3e('0x24')]=_0x122e7a;if(_0x4355a8['query']['includeAll']){_0x343aed[_0xea3e('0x5f')]=[{'model':db[_0xea3e('0x87')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xea3e('0x88'),'attributes':[_0xea3e('0x2b'),_0xea3e('0x89'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xea3e('0x8a'),'attributes':['id',_0xea3e('0x2b'),_0xea3e('0x8b')],'where':_0x4355a8['query'][_0xea3e('0x8c')]?{'id':_0x4355a8[_0xea3e('0x4d')][_0xea3e('0x8c')]}:undefined,'required':_0x4355a8['query']['tag']?!![]:![]}];}return db[_0xea3e('0x86')]['findAll'](_0x343aed);})[_0xea3e('0x12')](function(_0x97f7cb){_0x516e6c[_0xea3e('0x60')]=_0x97f7cb;return _0x516e6c;});}})[_0xea3e('0x12')](respondWithFilteredResult(_0x285631,_0x343aed))[_0xea3e('0x1c')](handleError(_0x285631,null));};exports[_0xea3e('0x8d')]=function addApplications(_0x3872c2,_0x57da9b){var _0x1d7b31=_0x3872c2['params']['id'];var _0x5191cd=_0x3872c2[_0xea3e('0x63')];var _0x2883be=0xc8;var _0x2ac2de=null;return db[_0xea3e('0x8e')][_0xea3e('0x8f')]({'isolationLevel':db['sequelize'][_0xea3e('0x90')]['ISOLATION_LEVELS'][_0xea3e('0x91')]},function(_0x8ac932){return db[_0xea3e('0x48')]['findOne']({'where':{'id':_0x1d7b31},'transaction':_0x8ac932})[_0xea3e('0x12')](function(_0x1b89eb){if(_0x1b89eb){return db['MailApplication'][_0xea3e('0x28')]({'where':{'MailAccountId':_0x1d7b31},'transaction':_0x8ac932})[_0xea3e('0x12')](function(){var _0x59d605=_['map'](_0x5191cd,function(_0x1e3b38){_0x1e3b38[_0xea3e('0x6c')]=_0x1d7b31;return _0x1e3b38;});return db[_0xea3e('0x92')][_0xea3e('0x93')](_0x59d605,{'transaction':_0x8ac932});});}else{_0x2883be=0x194;_0x2ac2de=[];}});})['then'](function(){if(_0x2883be!==0x194){return db[_0xea3e('0x92')]['findAndCountAll']({'where':{'MailAccountId':_0x1d7b31},'order':'priority'})[_0xea3e('0x12')](function(_0x520d99){_0x2ac2de=_0x520d99;});}})[_0xea3e('0x1c')](function(_0x37da0f){_0x2883be=0x1f4;logger[_0xea3e('0x19')](_0x37da0f[_0xea3e('0x2a')]);if(_0x37da0f[_0xea3e('0x2b')]){delete _0x37da0f['name'];}_0x2ac2de=_0x37da0f;})[_0xea3e('0x94')](function(){if(_0x2ac2de===null){_0x57da9b['sendStatus'](_0x2883be);}else{if(_0x2883be===0x1f4){_0x57da9b[_0xea3e('0x1e')](_0x2883be)['send'](_0x2ac2de);}else{_0x57da9b[_0xea3e('0x1e')](_0x2883be)[_0xea3e('0x20')](_0x2ac2de);}}});};exports[_0xea3e('0x95')]=function(_0x3b9c16,_0x56115e){var _0x4c9197={};var _0x5701ab={};var _0x18774f;var _0x32424e;return db[_0xea3e('0x48')]['findOne']({'where':{'id':_0x3b9c16[_0xea3e('0x66')]['id']}})['then'](handleEntityNotFound(_0x56115e,null))[_0xea3e('0x12')](function(_0x275e1f){if(_0x275e1f){_0x18774f=_0x275e1f;_0x5701ab[_0xea3e('0x4b')]=_[_0xea3e('0x4e')](db[_0xea3e('0x92')][_0xea3e('0x49')]);_0x5701ab[_0xea3e('0x4d')]=_[_0xea3e('0x4e')](_0x3b9c16[_0xea3e('0x4d')]);_0x5701ab[_0xea3e('0x4f')]=_[_0xea3e('0x50')](_0x5701ab[_0xea3e('0x4b')],_0x5701ab['query']);_0x4c9197[_0xea3e('0x52')]=_[_0xea3e('0x50')](_0x5701ab['model'],qs[_0xea3e('0x51')](_0x3b9c16[_0xea3e('0x4d')][_0xea3e('0x51')]));_0x4c9197['attributes']=_0x4c9197[_0xea3e('0x52')][_0xea3e('0x53')]?_0x4c9197['attributes']:_0x5701ab[_0xea3e('0x4b')];_0x4c9197['order']=qs['sort'](_0x3b9c16[_0xea3e('0x4d')][_0xea3e('0x57')]);_0x4c9197[_0xea3e('0x58')]=qs[_0xea3e('0x4f')](_[_0xea3e('0x59')](_0x3b9c16[_0xea3e('0x4d')],_0x5701ab[_0xea3e('0x4f')]));if(_0x3b9c16[_0xea3e('0x4d')][_0xea3e('0x5a')]){_0x4c9197[_0xea3e('0x58')]=_[_0xea3e('0x5b')](_0x4c9197['where'],{'$or':_[_0xea3e('0x4c')](_0x4c9197['attributes'],function(_0x483591){var _0x3aacb0={};_0x3aacb0[_0x483591]={'$like':'%'+_0x3b9c16[_0xea3e('0x4d')][_0xea3e('0x5a')]+'%'};return _0x3aacb0;})});}_0x4c9197=_[_0xea3e('0x5b')]({},_0x4c9197,_0x3b9c16[_0xea3e('0x5e')]);return _0x18774f['getApplications'](_0x4c9197);}})['then'](function(_0x46337a){if(_0x46337a){_0x32424e=_0x46337a[_0xea3e('0x53')];if(!_0x3b9c16[_0xea3e('0x4d')][_0xea3e('0x54')](_0xea3e('0x55'))){_0x4c9197[_0xea3e('0x23')]=qs[_0xea3e('0x23')](_0x3b9c16['query'][_0xea3e('0x23')]);_0x4c9197[_0xea3e('0x21')]=qs[_0xea3e('0x21')](_0x3b9c16['query'][_0xea3e('0x21')]);}return _0x18774f[_0xea3e('0x95')](_0x4c9197);}})[_0xea3e('0x12')](function(_0x3f179b){if(_0x3f179b){return _0x3f179b?{'count':_0x32424e,'rows':_0x3f179b}:null;}})[_0xea3e('0x12')](respondWithResult(_0x56115e,null))['catch'](handleError(_0x56115e,null));};exports[_0xea3e('0x96')]=function(_0x133118,_0x4e1183){var _0x329e4a={'raw':!![],'where':{}};var _0x32b14f={};var _0x2f097f={'count':0x0,'rows':[]};return db[_0xea3e('0x48')]['findOne']({'where':{'id':_0x133118[_0xea3e('0x66')]['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0x4e1183,null))['then'](function(_0x522c40){if(_0x522c40){_0x32b14f[_0xea3e('0x4b')]=_[_0xea3e('0x4e')](db[_0xea3e('0x97')][_0xea3e('0x49')]);_0x32b14f[_0xea3e('0x4d')]=_[_0xea3e('0x4e')](_0x133118[_0xea3e('0x4d')]);_0x32b14f[_0xea3e('0x4f')]=_[_0xea3e('0x50')](_0x32b14f['model'],_0x32b14f[_0xea3e('0x4d')]);_0x329e4a[_0xea3e('0x52')]=_[_0xea3e('0x50')](_0x32b14f[_0xea3e('0x4b')],qs[_0xea3e('0x51')](_0x133118[_0xea3e('0x4d')]['fields']));_0x329e4a[_0xea3e('0x52')]=_0x329e4a[_0xea3e('0x52')][_0xea3e('0x53')]?_0x329e4a[_0xea3e('0x52')]:_0x32b14f[_0xea3e('0x4b')];if(!_0x133118['query'][_0xea3e('0x54')](_0xea3e('0x55'))){_0x329e4a['limit']=qs[_0xea3e('0x23')](_0x133118[_0xea3e('0x4d')][_0xea3e('0x23')]);_0x329e4a['offset']=qs[_0xea3e('0x21')](_0x133118[_0xea3e('0x4d')][_0xea3e('0x21')]);}_0x329e4a['order']=qs[_0xea3e('0x57')](_0x133118['query'][_0xea3e('0x57')]);_0x329e4a[_0xea3e('0x58')]=qs[_0xea3e('0x4f')](_[_0xea3e('0x59')](_0x133118['query'],_0x32b14f[_0xea3e('0x4f')]));_0x329e4a[_0xea3e('0x58')]['MailAccountId']=_0x522c40['id'];if(_0x133118[_0xea3e('0x4d')][_0xea3e('0x5a')]){_0x329e4a[_0xea3e('0x58')]=_['merge'](_0x329e4a[_0xea3e('0x58')],{'$or':_['map'](_0x329e4a['attributes'],function(_0x4ddba1){var _0x1d573f={};_0x1d573f[_0x4ddba1]={'$like':'%'+_0x133118[_0xea3e('0x4d')][_0xea3e('0x5a')]+'%'};return _0x1d573f;})});}if(_0x133118[_0xea3e('0x4d')]['$gte']){var _0x4a622e=_0x133118[_0xea3e('0x4d')]['$gte'][_0xea3e('0x98')](',');var _0x315140={};_0x315140[_0x4a622e[0x0]]={'$gte':moment(_0x4a622e[0x1])[_0xea3e('0x99')]('YYYY-MM-DD\x20HH:mm:ss')};_0x329e4a['where']=_[_0xea3e('0x5b')](_0x329e4a[_0xea3e('0x58')],_0x315140);}_0x329e4a=_[_0xea3e('0x5b')]({},_0x329e4a,_0x133118[_0xea3e('0x5e')]);return db[_0xea3e('0x97')][_0xea3e('0x24')]({'where':_0x329e4a[_0xea3e('0x58')]})[_0xea3e('0x12')](function(_0x3c66fe){_0x2f097f[_0xea3e('0x24')]=_0x3c66fe;if(_0x133118[_0xea3e('0x4d')][_0xea3e('0x9a')]){_0x329e4a[_0xea3e('0x5f')]=[{'all':!![]}];}return db['MailMessage'][_0xea3e('0x75')](_0x329e4a);})[_0xea3e('0x12')](function(_0x35ed58){if(_0x133118['query'][_0xea3e('0x9b')]==='true'){for(var _0x513845=0x0;_0x513845<_0x35ed58[_0xea3e('0x53')];_0x513845++){_0x35ed58[_0x513845]['body']=juice(_0x35ed58[_0x513845]['body']);}}_0x2f097f[_0xea3e('0x60')]=_0x35ed58;return _0x2f097f;});}})[_0xea3e('0x12')](respondWithFilteredResult(_0x4e1183,_0x329e4a))['catch'](handleError(_0x4e1183,null));};exports[_0xea3e('0x2c')]=function(_0x556d1f,_0x1de41a){var _0x4b8c5e,_0x59d3ef={},_0x51d9b7;if(_0x556d1f[_0xea3e('0x63')]['to']){_0x51d9b7=_0x556d1f[_0xea3e('0x63')]['to'][_0xea3e('0x98')](',')[0x0];}return db['MailAccount'][_0xea3e('0x62')]({'where':{'id':_0x556d1f[_0xea3e('0x66')]['id']},'include':[{'model':db[_0xea3e('0x9c')],'as':_0xea3e('0x9d'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x51d9b7},'limit':0x1,'order':[[_0xea3e('0x9e'),_0xea3e('0x9f')]]}]},{'model':db[_0xea3e('0x67')],'as':_0xea3e('0x44'),'raw':!![],'include':[{'model':db[_0xea3e('0xa0')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x1de41a,null))[_0xea3e('0x12')](function(_0x473080){if(!_0x473080)return;_0x4b8c5e=_0x473080;if(!_0x473080[_0xea3e('0x44')])throw new Error(_0xea3e('0xa1'));if(_[_0xea3e('0x78')](_0x556d1f[_0xea3e('0x63')][_0xea3e('0xa2')])){_0x556d1f[_0xea3e('0x63')][_0xea3e('0xa2')]=util['format'](_0xea3e('0xa3'),_0x473080['name'],_0x473080[_0xea3e('0x77')]||_0x473080['Smtp']['user']);}if(_0x556d1f[_0xea3e('0x63')][_0xea3e('0xa4')]&&_0x556d1f[_0xea3e('0x63')][_0xea3e('0xa4')][_0xea3e('0x53')]){for(var _0x2b7b9a=0x0;_0x2b7b9a<_0x556d1f[_0xea3e('0x63')]['attachments'][_0xea3e('0x53')];_0x2b7b9a+=0x1){_0x556d1f[_0xea3e('0x63')]['attachments'][_0x2b7b9a]={'filename':_0x556d1f[_0xea3e('0x63')][_0xea3e('0xa4')][_0x2b7b9a][_0xea3e('0x2b')],'path':path[_0xea3e('0xa5')](config[_0xea3e('0xa6')],_0xea3e('0xa7'),_0x556d1f[_0xea3e('0x63')][_0xea3e('0xa4')][_0x2b7b9a]['basename'])};}}var _0x124754=_0x473080['getSmtpOptions']();return respondWithRpcPromise(_0xea3e('0xa8'),'sendMail',{'account':_0x124754,'message':_0x556d1f['body']});})['then'](function(_0x5efd54){if(!_0x5efd54)return;_0x59d3ef=_0x5efd54;if(!_0x4b8c5e[_0xea3e('0x9d')])throw new Error(_0xea3e('0xa9'));if(_0x4b8c5e[_0xea3e('0x9d')][_0xea3e('0xaa')][_0xea3e('0x53')])return _0x4b8c5e[_0xea3e('0x9d')][_0xea3e('0xaa')][0x0];return db['CmContact']['create'](_[_0xea3e('0xc')](_0x556d1f[_0xea3e('0x63')],{'firstName':_0x556d1f['body']['to'],'email':_0x556d1f[_0xea3e('0x63')]['to'],'phone':_0x556d1f[_0xea3e('0x63')]['to'],'ListId':_0x4b8c5e[_0xea3e('0xab')]}));})[_0xea3e('0x12')](function(_0xe3f13b){if(!_0xe3f13b)return;var _0x235d95={'UserId':_0x556d1f[_0xea3e('0x39')]['id'],'ContactId':_0xe3f13b['id'],'MailAccountId':_0x4b8c5e['id'],'inReplyTo':_0x59d3ef[_0xea3e('0xac')],'to':_0x556d1f['body']['from'],'cc':_0x556d1f['body']['cc'],'subject':_0x556d1f[_0xea3e('0x63')][_0xea3e('0xad')],'attach':_0x556d1f[_0xea3e('0x63')][_0xea3e('0xae')],'firstMsgDirection':_0xea3e('0xaf'),'lastMsgAt':moment()[_0xea3e('0x99')](_0xea3e('0xb0')),'lastMsgDirection':'out','Messages':[_[_0xea3e('0x5b')](_0x556d1f[_0xea3e('0x63')],{'messageId':_0x59d3ef['messageId'],'sentAt':moment()[_0xea3e('0x99')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x4b8c5e['id'],'UserId':_0x556d1f[_0xea3e('0x39')]['id'],'ContactId':_0xe3f13b['id']})]};if(_0x556d1f[_0xea3e('0x63')][_0xea3e('0xb1')]){_0x235d95=_[_0xea3e('0x5b')](_0x235d95,_0x556d1f[_0xea3e('0x63')][_0xea3e('0xb1')]);}return db['MailInteraction'][_0xea3e('0x73')](_0x235d95,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0xea3e('0x12')](respondWithResult(_0x1de41a,null))[_0xea3e('0x1c')](handleError(_0x1de41a,null));};exports['verifySmtp']=function(_0x32fc57,_0x14b382){return db[_0xea3e('0x48')][_0xea3e('0x62')]({'where':{'id':_0x32fc57[_0xea3e('0x66')]['id']},'include':[{'model':db[_0xea3e('0x67')],'as':_0xea3e('0x44'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xea3e('0xa0'),'raw':!![]}]}]})[_0xea3e('0x12')](handleEntityNotFound(_0x14b382,null))['then'](function(_0x3054de){if(!_0x3054de['Smtp'])return;var _0x267956=_0x3054de[_0xea3e('0xb2')]();return respondWithRpcPromise('VerifySmtp',_0xea3e('0xb3'),{'account':_0x267956});})[_0xea3e('0x12')](respondWithResult(_0x14b382,null))[_0xea3e('0x1c')](handleError(_0x14b382,null));};exports['destroy']=function(_0x3b3310,_0x444f8a){return db[_0xea3e('0x48')][_0xea3e('0x62')]({'where':{'id':_0x3b3310[_0xea3e('0x66')]['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0x444f8a,null))[_0xea3e('0x12')](function(_0x57757d){if(_0x57757d&&_0x57757d[_0xea3e('0x69')]){throw new db[(_0xea3e('0xb4'))]['ValidationError'](_0xea3e('0xb5'));}return _0x57757d;})['then'](removeEntity(_0x444f8a,null))[_0xea3e('0x1c')](handleError(_0x444f8a,null));};exports['addAgents']=function(_0x11da25,_0xa888ab){return db[_0xea3e('0x48')][_0xea3e('0x62')]({'where':{'id':_0x11da25[_0xea3e('0x66')]['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0xa888ab,null))['then'](function(_0x5ab3d4){if(_0x5ab3d4){return _0x5ab3d4[_0xea3e('0xb6')](_0x11da25['body']['ids'],_[_0xea3e('0xb7')](_0x11da25['body'],['ids','id'])||{})[_0xea3e('0xb8')](function(_0x41f465){for(var _0x126858=0x0;_0x126858<_0x11da25['body'][_0xea3e('0x71')][_0xea3e('0x53')];_0x126858+=0x1){socket[_0xea3e('0xb9')](_0xea3e('0xba'),{'UserId':Number(_0x11da25['body'][_0xea3e('0x71')][_0x126858]),'MailAccountId':Number(_0x11da25['params']['id'])});}return _0x41f465;});}})[_0xea3e('0x12')](respondWithResult(_0xa888ab,null))['catch'](handleError(_0xa888ab,null));};exports[_0xea3e('0xbb')]=function(_0x40c4ba,_0x21cc5d){return db[_0xea3e('0x48')]['find']({'where':{'id':_0x40c4ba[_0xea3e('0x66')]['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0x21cc5d,null))['then'](function(_0x5e380c){if(_0x5e380c){return _0x5e380c['removeAgents'](_0x40c4ba['query'][_0xea3e('0x71')])[_0xea3e('0x12')](function(){if(_['isArray'](_0x40c4ba[_0xea3e('0x4d')][_0xea3e('0x71')])){for(var _0x2fabc9=0x0;_0x2fabc9<_0x40c4ba[_0xea3e('0x4d')][_0xea3e('0x71')][_0xea3e('0x53')];_0x2fabc9+=0x1){socket[_0xea3e('0xb9')](_0xea3e('0xbc'),{'UserId':Number(_0x40c4ba[_0xea3e('0x4d')][_0xea3e('0x71')][_0x2fabc9]),'MailAccountId':Number(_0x40c4ba['params']['id'])});}}else{socket[_0xea3e('0xb9')](_0xea3e('0xbc'),{'UserId':Number(_0x40c4ba[_0xea3e('0x4d')]['ids']),'MailAccountId':Number(_0x40c4ba[_0xea3e('0x66')]['id'])});}});}})[_0xea3e('0x12')](respondWithStatusCode(_0x21cc5d,null))[_0xea3e('0x1c')](handleError(_0x21cc5d,null));};exports[_0xea3e('0xbd')]=function(_0x1de4eb,_0x4b5cb9){var _0x5a3a95={};var _0x256952={};var _0x2a690c;var _0x52148e;return db[_0xea3e('0x48')][_0xea3e('0x6f')]({'where':{'id':_0x1de4eb[_0xea3e('0x66')]['id']}})[_0xea3e('0x12')](handleEntityNotFound(_0x4b5cb9,null))[_0xea3e('0x12')](function(_0x54a495){if(_0x54a495){_0x2a690c=_0x54a495;_0x256952[_0xea3e('0x4b')]=_[_0xea3e('0x4e')](db[_0xea3e('0xbe')]['rawAttributes']);_0x256952['query']=_[_0xea3e('0x4e')](_0x1de4eb['query']);_0x256952[_0xea3e('0x4f')]=_['intersection'](_0x256952[_0xea3e('0x4b')],_0x256952[_0xea3e('0x4d')]);_0x5a3a95[_0xea3e('0x52')]=_['intersection'](_0x256952['model'],qs[_0xea3e('0x51')](_0x1de4eb['query']['fields']));_0x5a3a95['attributes']=_0x5a3a95['attributes'][_0xea3e('0x53')]?_0x5a3a95[_0xea3e('0x52')]:_0x256952[_0xea3e('0x4b')];_0x5a3a95[_0xea3e('0x56')]=qs['sort'](_0x1de4eb[_0xea3e('0x4d')]['sort']);_0x5a3a95[_0xea3e('0x58')]=qs['filters'](_['pick'](_0x1de4eb['query'],_0x256952[_0xea3e('0x4f')]));if(_0x1de4eb[_0xea3e('0x4d')][_0xea3e('0x5a')]){_0x5a3a95['where']=_[_0xea3e('0x5b')](_0x5a3a95[_0xea3e('0x58')],{'$or':_[_0xea3e('0x4c')](_0x5a3a95['attributes'],function(_0x3f8fe8){var _0x37df26={};_0x37df26[_0x3f8fe8]={'$like':'%'+_0x1de4eb[_0xea3e('0x4d')][_0xea3e('0x5a')]+'%'};return _0x37df26;})});}_0x5a3a95=_[_0xea3e('0x5b')]({},_0x5a3a95,_0x1de4eb[_0xea3e('0x5e')]);return _0x2a690c['getAgents'](_0x5a3a95);}})[_0xea3e('0x12')](function(_0x176796){if(_0x176796){_0x52148e=_0x176796[_0xea3e('0x53')];if(!_0x1de4eb['query']['hasOwnProperty']('nolimit')){_0x5a3a95['limit']=qs[_0xea3e('0x23')](_0x1de4eb[_0xea3e('0x4d')][_0xea3e('0x23')]);_0x5a3a95[_0xea3e('0x21')]=qs[_0xea3e('0x21')](_0x1de4eb['query'][_0xea3e('0x21')]);}return _0x2a690c[_0xea3e('0xbd')](_0x5a3a95);}})[_0xea3e('0x12')](function(_0x465a83){if(_0x465a83){return _0x465a83?{'count':_0x52148e,'rows':_0x465a83}:null;}})['then'](respondWithResult(_0x4b5cb9,null))[_0xea3e('0x1c')](handleError(_0x4b5cb9,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 34f14c4..91d1132 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 _0xafc4=['update','remove','emit','hasOwnProperty','hook','exports','events','MailAccount','save'];(function(_0x223c0d,_0x3ec04d){var _0x207827=function(_0x39d240){while(--_0x39d240){_0x223c0d['push'](_0x223c0d['shift']());}};_0x207827(++_0x3ec04d);}(_0xafc4,0x69));var _0x4afc=function(_0x8aba1a,_0x106e8a){_0x8aba1a=_0x8aba1a-0x0;var _0x4dca9a=_0xafc4[_0x8aba1a];return _0x4dca9a;};'use strict';var EventEmitter=require(_0x4afc('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x4afc('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4afc('0x2'),'afterUpdate':_0x4afc('0x3'),'afterDestroy':_0x4afc('0x4')};function emitEvent(_0x237ea0){return function(_0x4d9dbd,_0x49f417,_0x5378e5){MailAccountEvents[_0x4afc('0x5')](_0x237ea0+':'+_0x4d9dbd['id'],_0x4d9dbd);MailAccountEvents[_0x4afc('0x5')](_0x237ea0,_0x4d9dbd);_0x5378e5(null);};}for(var e in events){if(events[_0x4afc('0x6')](e)){var event=events[e];MailAccount[_0x4afc('0x7')](e,emitEvent(event));}}module[_0x4afc('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x508a=['emit','hasOwnProperty','hook','events','MailAccount','setMaxListeners','save','update','remove'];(function(_0x58ae2c,_0x12144f){var _0x2a773d=function(_0x24dad4){while(--_0x24dad4){_0x58ae2c['push'](_0x58ae2c['shift']());}};_0x2a773d(++_0x12144f);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa508('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xa508('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa508('0x2')](0x0);var events={'afterCreate':_0xa508('0x3'),'afterUpdate':_0xa508('0x4'),'afterDestroy':_0xa508('0x5')};function emitEvent(_0x587f6a){return function(_0x8f1c7a,_0x40f2f0,_0x2e26ae){MailAccountEvents['emit'](_0x587f6a+':'+_0x8f1c7a['id'],_0x8f1c7a);MailAccountEvents[_0xa508('0x6')](_0x587f6a,_0x8f1c7a);_0x2e26ae(null);};}for(var e in events){if(events[_0xa508('0x7')](e)){var event=events[e];MailAccount[_0xa508('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 66dafa5..a54730f 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 _0x2841=['./mailAccount.attributes','exports','define','MailAccount','custom','service','provider','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','user','data5','auth','pass'];(function(_0x2a5f11,_0x24988a){var _0xc4133b=function(_0x1e06cb){while(--_0x1e06cb){_0x2a5f11['push'](_0x2a5f11['shift']());}};_0xc4133b(++_0x24988a);}(_0x2841,0xd1));var _0x1284=function(_0x239b31,_0x44a64d){_0x239b31=_0x239b31-0x0;var _0x41c8be=_0x2841[_0x239b31];return _0x41c8be;};'use strict';var attributes=require(_0x1284('0x0'));module[_0x1284('0x1')]=function(_0x3a0dad){return _0x3a0dad[_0x1284('0x2')](_0x1284('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xca4f2f=this;var _0x36be64={'id':_0xca4f2f['id'],'tls':{'rejectUnauthorized':![]}};if(_0xca4f2f['provider']!==_0x1284('0x4')){_0x36be64[_0x1284('0x5')]=_0xca4f2f[_0x1284('0x6')];}else{_0x36be64[_0x1284('0x7')]=_0xca4f2f[_0x1284('0x8')][_0x1284('0x7')];_0x36be64[_0x1284('0x9')]=_0xca4f2f[_0x1284('0x8')]['port'];_0x36be64[_0x1284('0xa')]=_0xca4f2f[_0x1284('0x8')][_0x1284('0xa')];}if(_0xca4f2f['Smtp'][_0x1284('0xb')]){if(_0xca4f2f['Smtp'][_0x1284('0xc')]){if(!_0xca4f2f[_0x1284('0x8')][_0x1284('0xd')])throw new Error(_0x1284('0xe'));_0x36be64['auth']={'type':'OAuth2','user':_0xca4f2f[_0x1284('0x8')][_0x1284('0xf')],'accessToken':_0xca4f2f[_0x1284('0x8')][_0x1284('0xd')][_0x1284('0x10')]};}else{_0x36be64[_0x1284('0x11')]={'user':_0xca4f2f[_0x1284('0x8')]['user'],'pass':_0xca4f2f['Smtp'][_0x1284('0x12')]};}}return _0x36be64;}}});}; \ No newline at end of file +var _0xc247=['data5','auth','pass','./mailAccount.attributes','exports','MailAccount','mail_accounts','provider','custom','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','user'];(function(_0x433b45,_0x530cab){var _0x5cbb11=function(_0xfbf870){while(--_0xfbf870){_0x433b45['push'](_0x433b45['shift']());}};_0x5cbb11(++_0x530cab);}(_0xc247,0x1b8));var _0x7c24=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0xc247[_0x1bb58c];return _0x277586;};'use strict';var attributes=require(_0x7c24('0x0'));module[_0x7c24('0x1')]=function(_0x6fa31b){return _0x6fa31b['define'](_0x7c24('0x2'),attributes,{'tableName':_0x7c24('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x147aac=this;var _0x5638d0={'id':_0x147aac['id'],'tls':{'rejectUnauthorized':![]}};if(_0x147aac[_0x7c24('0x4')]!==_0x7c24('0x5')){_0x5638d0[_0x7c24('0x6')]=_0x147aac[_0x7c24('0x4')];}else{_0x5638d0[_0x7c24('0x7')]=_0x147aac[_0x7c24('0x8')][_0x7c24('0x7')];_0x5638d0[_0x7c24('0x9')]=_0x147aac[_0x7c24('0x8')][_0x7c24('0x9')];_0x5638d0[_0x7c24('0xa')]=_0x147aac[_0x7c24('0x8')]['secure'];}if(_0x147aac[_0x7c24('0x8')][_0x7c24('0xb')]){if(_0x147aac[_0x7c24('0x8')][_0x7c24('0xc')]){if(!_0x147aac[_0x7c24('0x8')][_0x7c24('0xd')])throw new Error(_0x7c24('0xe'));_0x5638d0['auth']={'type':'OAuth2','user':_0x147aac[_0x7c24('0x8')][_0x7c24('0xf')],'accessToken':_0x147aac[_0x7c24('0x8')][_0x7c24('0xd')][_0x7c24('0x10')]};}else{_0x5638d0[_0x7c24('0x11')]={'user':_0x147aac[_0x7c24('0x8')][_0x7c24('0xf')],'pass':_0x147aac['Smtp'][_0x7c24('0x12')]};}}return _0x5638d0;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 4acc7bb..db3d637 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 _0xe14b=['autoclose','*,*,*,*','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','spread','update','interaction','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','User','name','UserId','unshift','waitForTheAssignedAgent','MailQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','ioredis','../../mysqldb','rpc','client','http','redis','defaults','localhost','socket.io-emitter','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','map','include','model','ShowMailAccount','find','where','smtp','setDataValue','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','List','updatedAt','DESC','MailApplication','Applications','CloudProvider','get','omit','smtpOptions','getSmtpOptions','applications','list','orderBy','priority','asc','push'];(function(_0x193ddf,_0x6f30bb){var _0x5bc6df=function(_0x70fd9e){while(--_0x70fd9e){_0x193ddf['push'](_0x193ddf['shift']());}};_0x5bc6df(++_0x6f30bb);}(_0xe14b,0x93));var _0xbe14=function(_0x3aac17,_0x514374){_0x3aac17=_0x3aac17-0x0;var _0x5dd94e=_0xe14b[_0x3aac17];return _0x5dd94e;};'use strict';var _=require(_0xbe14('0x0'));var moment=require(_0xbe14('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require(_0xbe14('0x2'));var db=require(_0xbe14('0x3'))['db'];var logger=require('../../config/logger')(_0xbe14('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbe14('0x5')][_0xbe14('0x6')]({'port':0x232c});config[_0xbe14('0x7')]=_[_0xbe14('0x8')](config[_0xbe14('0x7')],{'host':_0xbe14('0x9'),'port':0x18eb});var socket=require(_0xbe14('0xa'))(new Redis(config['redis']));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x30c355,_0x6fceff,_0xd68cd7){return new BPromise(function(_0x90b4f,_0x53c7ea){return client['request'](_0x30c355,_0xd68cd7)[_0xbe14('0xb')](function(_0x3f70cb){logger['info'](_0xbe14('0xc'),_0x6fceff,_0xbe14('0xd'));logger[_0xbe14('0xe')](_0xbe14('0xf'),_0x6fceff,_0xbe14('0xd'),JSON[_0xbe14('0x10')](_0x3f70cb));if(_0x3f70cb[_0xbe14('0x11')]){if(_0x3f70cb[_0xbe14('0x11')][_0xbe14('0x12')]===0x1f4){logger[_0xbe14('0x11')](_0xbe14('0xc'),_0x6fceff,_0x3f70cb[_0xbe14('0x11')][_0xbe14('0x13')]);return _0x53c7ea(_0x3f70cb['error']['message']);}logger[_0xbe14('0x11')](_0xbe14('0xc'),_0x6fceff,_0x3f70cb[_0xbe14('0x11')][_0xbe14('0x13')]);return _0x90b4f(_0x3f70cb['error'][_0xbe14('0x13')]);}else{logger[_0xbe14('0x14')](_0xbe14('0xc'),_0x6fceff,_0xbe14('0xd'));_0x90b4f(_0x3f70cb[_0xbe14('0x15')][_0xbe14('0x13')]);}})[_0xbe14('0x16')](function(_0x5ea1f8){logger[_0xbe14('0x11')](_0xbe14('0xc'),_0x6fceff,_0x5ea1f8);_0x53c7ea(_0x5ea1f8);});});}exports[_0xbe14('0x17')]=function(_0x433459){var _0x3249da=this;return new Promise(function(_0x37e4c1,_0x59a9e3){return db[_0xbe14('0x18')][_0xbe14('0x19')]({'raw':_0x433459[_0xbe14('0x1a')]?_0x433459[_0xbe14('0x1a')][_0xbe14('0x1b')]===undefined?!![]:![]:!![],'where':_0x433459['options']?_0x433459[_0xbe14('0x1a')]['where']||null:null,'attributes':_0x433459[_0xbe14('0x1a')]?_0x433459['options'][_0xbe14('0x1c')]||null:null,'limit':_0x433459['options']?_0x433459[_0xbe14('0x1a')][_0xbe14('0x1d')]||null:null,'include':_0x433459['options']?_0x433459[_0xbe14('0x1a')]['include']?_[_0xbe14('0x1e')](_0x433459['options'][_0xbe14('0x1f')],function(_0x5fa043){return{'model':db[_0x5fa043[_0xbe14('0x20')]],'as':_0x5fa043['as'],'attributes':_0x5fa043[_0xbe14('0x1c')],'include':_0x5fa043[_0xbe14('0x1f')]?_[_0xbe14('0x1e')](_0x5fa043['include'],function(_0x1822e0){return{'model':db[_0x1822e0[_0xbe14('0x20')]],'as':_0x1822e0['as'],'attributes':_0x1822e0[_0xbe14('0x1c')],'include':_0x1822e0[_0xbe14('0x1f')]?_['map'](_0x1822e0[_0xbe14('0x1f')],function(_0x29fc64){return{'model':db[_0x29fc64['model']],'as':_0x29fc64['as'],'attributes':_0x29fc64[_0xbe14('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbe14('0xb')](function(_0x1c7cc7){logger[_0xbe14('0x14')](_0xbe14('0x17'),_0x433459);logger[_0xbe14('0xe')](_0xbe14('0x17'),_0x433459,JSON[_0xbe14('0x10')](_0x1c7cc7));_0x37e4c1(_0x1c7cc7);})[_0xbe14('0x16')](function(_0x16a159){logger[_0xbe14('0x11')](_0xbe14('0x17'),_0x16a159[_0xbe14('0x13')],_0x433459);_0x59a9e3(_0x3249da[_0xbe14('0x11')](0x1f4,_0x16a159[_0xbe14('0x13')]));});});};exports[_0xbe14('0x21')]=function(_0x6ba36c){var _0x2ff48e=this;return new Promise(function(_0x29e76a,_0x14e7c4){return db['MailAccount'][_0xbe14('0x22')]({'raw':_0x6ba36c['options']?_0x6ba36c['options'][_0xbe14('0x1b')]===undefined?!![]:![]:!![],'where':_0x6ba36c['options']?_0x6ba36c[_0xbe14('0x1a')][_0xbe14('0x23')]||null:null,'attributes':_0x6ba36c['options']?_0x6ba36c['options']['attributes']||null:null,'include':_0x6ba36c[_0xbe14('0x1a')]?_0x6ba36c[_0xbe14('0x1a')]['include']?_[_0xbe14('0x1e')](_0x6ba36c[_0xbe14('0x1a')][_0xbe14('0x1f')],function(_0x1aa849){return{'model':db[_0x1aa849[_0xbe14('0x20')]],'as':_0x1aa849['as'],'attributes':_0x1aa849['attributes'],'include':_0x1aa849['include']?_[_0xbe14('0x1e')](_0x1aa849['include'],function(_0x5dd7aa){return{'model':db[_0x5dd7aa['model']],'as':_0x5dd7aa['as'],'attributes':_0x5dd7aa[_0xbe14('0x1c')],'include':_0x5dd7aa[_0xbe14('0x1f')]?_[_0xbe14('0x1e')](_0x5dd7aa[_0xbe14('0x1f')],function(_0x172e79){return{'model':db[_0x172e79[_0xbe14('0x20')]],'as':_0x172e79['as'],'attributes':_0x172e79[_0xbe14('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbe14('0xb')](function(_0x2d9c12){if(_0x6ba36c[_0xbe14('0x1a')][_0xbe14('0x24')]===!![])_0x2d9c12[_0xbe14('0x25')]('smtpOptions',_0x2d9c12['getSmtpOptions']());logger[_0xbe14('0x14')](_0xbe14('0x21'),_0x6ba36c);logger[_0xbe14('0xe')]('ShowMailAccount',_0x6ba36c,JSON[_0xbe14('0x10')](_0x2d9c12));_0x29e76a(_0x2d9c12);})[_0xbe14('0x16')](function(_0xeda70e){logger[_0xbe14('0x11')](_0xbe14('0x21'),_0xeda70e[_0xbe14('0x13')],_0x6ba36c);_0x14e7c4(_0x2ff48e[_0xbe14('0x11')](0x1f4,_0xeda70e[_0xbe14('0x13')]));});});};exports[_0xbe14('0x26')]=function(_0x5255ff){var _0xe51424=this;return new Promise(function(_0x841b71,_0x3463c4){var _0x1b3118={'body':_0x5255ff[_0xbe14('0x27')],'channel':_0xbe14('0x28')};var _0x548d17=_[_0xbe14('0x29')](_[_0xbe14('0x2a')](db[_0xbe14('0x2b')][_0xbe14('0x2c')]),['createdAt','updatedAt',_0xbe14('0x2d'),_0xbe14('0x2e')]);var _0x3272ae=![];if(_0x5255ff['body']['id']){delete _0x5255ff['body']['id'];}if(_[_0xbe14('0x2f')](_0x5255ff['body']['from'])){return _0x3463c4(_0xe51424[_0xbe14('0x11')](0x1f4,_0xbe14('0x30')));}if(_[_0xbe14('0x2f')](_0x5255ff['body']['body'])||_0x5255ff['body'][_0xbe14('0x27')]===''){return _0x3463c4(_0xe51424[_0xbe14('0x11')](0x1f4,_0xbe14('0x31')));}if(_['isNil'](_0x5255ff[_0xbe14('0x27')][_0xbe14('0x32')])){return _0x3463c4(_0xe51424[_0xbe14('0x11')](0x1f4,_0xbe14('0x33')+_0x548d17));}if(!_['includes'](_0x548d17,_0x5255ff['body'][_0xbe14('0x32')])){return _0x3463c4(_0xe51424[_0xbe14('0x11')](0x1f4,_0xbe14('0x34')+_0x548d17));}var _0xb2b285={};_0xb2b285[_0x5255ff[_0xbe14('0x27')]['mapKey']]=_0x5255ff['body'][_0xbe14('0x35')];return db[_0xbe14('0x18')][_0xbe14('0x22')]({'where':{'id':_0x5255ff[_0xbe14('0x36')]['id']},'include':[{'model':db['CmList'],'as':_0xbe14('0x37'),'include':[{'model':db[_0xbe14('0x2b')],'as':'Contacts','where':_0xb2b285,'limit':0x1,'order':[[_0xbe14('0x38'),_0xbe14('0x39')]]}]},{'model':db[_0xbe14('0x3a')],'as':_0xbe14('0x3b')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0xbe14('0x3c')],'as':_0xbe14('0x3c')}]}]})['then'](function(_0x5acf90){if(_0x5acf90&&_0x5acf90[_0xbe14('0x37')]){var _0x5d3726=_0x5acf90[_0xbe14('0x3d')]({'plain':!![]});_0x1b3118[_0xbe14('0x36')]=_[_0xbe14('0x3e')](_0x5d3726,[_0xbe14('0x3b'),_0xbe14('0x37')]);_0x1b3118['account'][_0xbe14('0x3f')]=_0x5acf90[_0xbe14('0x40')]();_0x1b3118[_0xbe14('0x41')]=_0x5d3726[_0xbe14('0x3b')];_0x1b3118[_0xbe14('0x42')]=_0x5d3726['List'];_0x1b3118[_0xbe14('0x41')]=_[_0xbe14('0x43')](_0x1b3118[_0xbe14('0x41')],[_0xbe14('0x44')],[_0xbe14('0x45')]);if(_0x1b3118[_0xbe14('0x36')]&&_0x1b3118['account']['autoclose']){_0x1b3118[_0xbe14('0x41')][_0xbe14('0x46')]({'id':0x0,'priority':_0x1b3118[_0xbe14('0x41')]['length']+0x1,'app':'close','appdata':_0xbe14('0x47'),'interval':_0xbe14('0x48')});}if(_0x1b3118['account'][_0xbe14('0x3b')]){delete _0x1b3118[_0xbe14('0x36')]['Applications'];}if(_0x1b3118[_0xbe14('0x36')]['List']){delete _0x1b3118[_0xbe14('0x36')][_0xbe14('0x37')];}if(_0x5d3726[_0xbe14('0x37')]['Contacts'][_0xbe14('0x49')]){return _0x5d3726[_0xbe14('0x37')]['Contacts'][0x0];}var _0x27f24b=_[_0xbe14('0x8')](_0x5255ff[_0xbe14('0x27')],{'firstName':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x35')],'ListId':_0x5d3726['ListId']});_0x27f24b[_0x5255ff[_0xbe14('0x27')][_0xbe14('0x32')]]=_0x5255ff[_0xbe14('0x27')][_0xbe14('0x35')];return db[_0xbe14('0x2b')][_0xbe14('0x4a')](_0x27f24b);}else{throw new Error(_0xbe14('0x4b'));}})['then'](function(_0x72c875){_0x1b3118[_0xbe14('0x4c')]=_0x72c875;if(_0x72c875){if(!_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x4d')]){_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x4d')]=rs[_0xbe14('0x4e')]()+'\x20'+_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')]['from'];}var _0x56bcd3={'ContactId':_0x72c875['id'],'MailAccountId':_0x5255ff['account']['id'],'inReplyTo':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x4d')],'to':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x35')],'cc':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')]['cc'],'subject':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x4f')],'attach':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x50')],'lastMsgAt':moment()[_0xbe14('0x51')](_0xbe14('0x52')),'lastMsgDirection':'in'};return db[_0xbe14('0x53')][_0xbe14('0x22')]({'where':{'closed':![],'MailAccountId':_0x5255ff[_0xbe14('0x36')]['id']},'include':[{'model':db[_0xbe14('0x54')],'as':'Messages','attributes':[_0xbe14('0x4d')],'where':{'messageId':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x55')]}}]})[_0xbe14('0xb')](function(_0x222944){if(_0x222944){return[_0x222944,![]];}return db[_0xbe14('0x53')][_0xbe14('0x4a')](_0x56bcd3)[_0xbe14('0xb')](function(_0x100d43){return[_0x100d43,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xbe14('0x56')](function(_0x442ec4,_0x2d4dd4){if(_0x442ec4){_0x3272ae=_0x2d4dd4;if(!_0x2d4dd4){return _0x442ec4[_0xbe14('0x57')]({'inReplyTo':_0x5255ff[_0xbe14('0x27')]['message'][_0xbe14('0x4d')],'to':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x35')],'cc':_0x5255ff[_0xbe14('0x27')]['message']['cc'],'subject':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x4f')],'attach':_0x442ec4[_0xbe14('0x50')]?_0x442ec4[_0xbe14('0x50')]:_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x50')],'substatus':null,'substatusAt':moment()['format'](_0xbe14('0x52')),'lastMsgAt':moment()[_0xbe14('0x51')](_0xbe14('0x52')),'lastMsgDirection':'in'});}else{return _0x442ec4;}}})[_0xbe14('0xb')](function(_0x5982b7){_0x1b3118[_0xbe14('0x58')]=_0x5982b7[_0xbe14('0x3d')]({'plain':!![]});_0x1b3118['interaction']['created']=_0x3272ae;return db[_0xbe14('0x54')][_0xbe14('0x4a')]({'body':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x27')],'MailAccountId':_0x5255ff[_0xbe14('0x36')]['id'],'MailInteractionId':_0x5982b7['id'],'direction':'in','ContactId':_0x1b3118[_0xbe14('0x4c')]['id'],'messageId':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')]['messageId'],'from':_0x5255ff['body'][_0xbe14('0x13')][_0xbe14('0x35')],'to':_0x5255ff[_0xbe14('0x27')]['message']['to'],'cc':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')]['cc'],'subject':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x4f')],'attach':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')]['attach'],'Attachments':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x59')],'originTo':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x5a')],'originCc':_0x5255ff[_0xbe14('0x27')]['message'][_0xbe14('0x5b')],'bcc':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x5c')],'ChatWebsiteId':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x5d')]||null,'originChannel':_0x5255ff[_0xbe14('0x27')]['message'][_0xbe14('0x5e')]||_0xbe14('0x5f'),'ChatOfflineMessageId':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x60')]||null},{'include':[{'model':db[_0xbe14('0x61')],'as':'Attachments'}]});})[_0xbe14('0xb')](function(_0x175213){_0x1b3118[_0xbe14('0x13')]=_0x175213;if(!_0x1b3118[_0xbe14('0x58')]['UserId']){return;}return db[_0xbe14('0x62')][_0xbe14('0x22')]({'attributes':['id',_0xbe14('0x63')],'where':{'id':_0x1b3118[_0xbe14('0x58')][_0xbe14('0x64')]}});})[_0xbe14('0xb')](function(_0x3b0828){if(_0x3b0828){_0x1b3118['applications'][_0xbe14('0x65')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3b0828[_0xbe14('0x63')]+','+(_0x1b3118['account'][_0xbe14('0x66')]||0xa),'interval':_0xbe14('0x48')});}if(!_0x1b3118[_0xbe14('0x58')]['queueId']){return;}return db[_0xbe14('0x67')][_0xbe14('0x22')]({'attributes':['id',_0xbe14('0x63')],'where':{'id':_0x1b3118['interaction'][_0xbe14('0x68')]}});})[_0xbe14('0xb')](function(_0x1737a8){if(_0x1737a8){_0x1b3118[_0xbe14('0x41')]['unshift']({'id':0x0,'priority':0x1,'app':_0xbe14('0x69'),'appdata':_0x1737a8[_0xbe14('0x63')]+','+(_0x1b3118[_0xbe14('0x36')][_0xbe14('0x6a')]||0x12c),'interval':_0xbe14('0x48')});}return respondWithRpcPromise(_0xbe14('0x6b'),_0xbe14('0x6c'),_0x1b3118);})['then'](function(_0x2ff94c){_0x841b71(_0x2ff94c);})[_0xbe14('0x16')](function(_0x2137d5){_0x3463c4(_0xe51424['error'](0x1f4,_0x2137d5[_0xbe14('0x13')]));});});}; \ No newline at end of file +var _0xc21e=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','raw','options','attributes','limit','include','map','model','then','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','rawAttributes','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','smtpOptions','orderBy','applications','priority','asc','autoclose','push','length','close','*,*,*,*','CmContact','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','spread','update','subject','interaction','created','MailMessage','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x12c8ca,_0x2526dd){var _0x31398f=function(_0x12d887){while(--_0x12d887){_0x12c8ca['push'](_0x12c8ca['shift']());}};_0x31398f(++_0x2526dd);}(_0xc21e,0x1ca));var _0xec21=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc21e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0xec21('0x0'));var BPromise=require(_0xec21('0x1'));var rs=require(_0xec21('0x2'));var Redis=require(_0xec21('0x3'));var db=require(_0xec21('0x4'))['db'];var logger=require(_0xec21('0x5'))('rpc');var config=require(_0xec21('0x6'));var jayson=require(_0xec21('0x7'));var client=jayson[_0xec21('0x8')][_0xec21('0x9')]({'port':0x232c});config[_0xec21('0xa')]=_[_0xec21('0xb')](config[_0xec21('0xa')],{'host':_0xec21('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec21('0xa')]));require(_0xec21('0xd'))[_0xec21('0xe')](socket);function respondWithRpcPromise(_0xfbab77,_0x4d478,_0x569559){return new BPromise(function(_0x110420,_0x1d5e4b){return client[_0xec21('0xf')](_0xfbab77,_0x569559)['then'](function(_0x5f059d){logger[_0xec21('0x10')](_0xec21('0x11'),_0x4d478,'request\x20sent');logger[_0xec21('0x12')](_0xec21('0x13'),_0x4d478,_0xec21('0x14'),JSON[_0xec21('0x15')](_0x5f059d));if(_0x5f059d[_0xec21('0x16')]){if(_0x5f059d['error'][_0xec21('0x17')]===0x1f4){logger['error'](_0xec21('0x11'),_0x4d478,_0x5f059d[_0xec21('0x16')][_0xec21('0x18')]);return _0x1d5e4b(_0x5f059d['error'][_0xec21('0x18')]);}logger[_0xec21('0x16')](_0xec21('0x11'),_0x4d478,_0x5f059d[_0xec21('0x16')][_0xec21('0x18')]);return _0x110420(_0x5f059d[_0xec21('0x16')][_0xec21('0x18')]);}else{logger[_0xec21('0x10')]('MailAccount,\x20%s,\x20%s',_0x4d478,_0xec21('0x14'));_0x110420(_0x5f059d[_0xec21('0x19')][_0xec21('0x18')]);}})[_0xec21('0x1a')](function(_0x3ab226){logger[_0xec21('0x16')](_0xec21('0x11'),_0x4d478,_0x3ab226);_0x1d5e4b(_0x3ab226);});});}exports[_0xec21('0x1b')]=function(_0x3c790e){var _0x350443=this;return new Promise(function(_0x4f4b12,_0x4c244b){return db[_0xec21('0x1c')][_0xec21('0x1d')]({'raw':_0x3c790e['options']?_0x3c790e['options'][_0xec21('0x1e')]===undefined?!![]:![]:!![],'where':_0x3c790e[_0xec21('0x1f')]?_0x3c790e[_0xec21('0x1f')]['where']||null:null,'attributes':_0x3c790e[_0xec21('0x1f')]?_0x3c790e[_0xec21('0x1f')][_0xec21('0x20')]||null:null,'limit':_0x3c790e['options']?_0x3c790e[_0xec21('0x1f')][_0xec21('0x21')]||null:null,'include':_0x3c790e[_0xec21('0x1f')]?_0x3c790e[_0xec21('0x1f')][_0xec21('0x22')]?_[_0xec21('0x23')](_0x3c790e['options'][_0xec21('0x22')],function(_0x26cdae){return{'model':db[_0x26cdae['model']],'as':_0x26cdae['as'],'attributes':_0x26cdae[_0xec21('0x20')],'include':_0x26cdae['include']?_[_0xec21('0x23')](_0x26cdae['include'],function(_0x4ef840){return{'model':db[_0x4ef840[_0xec21('0x24')]],'as':_0x4ef840['as'],'attributes':_0x4ef840[_0xec21('0x20')],'include':_0x4ef840[_0xec21('0x22')]?_[_0xec21('0x23')](_0x4ef840[_0xec21('0x22')],function(_0x5521e3){return{'model':db[_0x5521e3[_0xec21('0x24')]],'as':_0x5521e3['as'],'attributes':_0x5521e3['attributes']};}):[]};}):[]};}):[]:[]})[_0xec21('0x25')](function(_0x233bf9){logger[_0xec21('0x10')](_0xec21('0x1b'),_0x3c790e);logger['debug'](_0xec21('0x1b'),_0x3c790e,JSON[_0xec21('0x15')](_0x233bf9));_0x4f4b12(_0x233bf9);})[_0xec21('0x1a')](function(_0x233231){logger[_0xec21('0x16')](_0xec21('0x1b'),_0x233231[_0xec21('0x18')],_0x3c790e);_0x4c244b(_0x350443[_0xec21('0x16')](0x1f4,_0x233231[_0xec21('0x18')]));});});};exports[_0xec21('0x26')]=function(_0x43a2de){var _0x57e004=this;return new Promise(function(_0x31f861,_0x2a14aa){return db[_0xec21('0x1c')][_0xec21('0x27')]({'raw':_0x43a2de[_0xec21('0x1f')]?_0x43a2de['options'][_0xec21('0x1e')]===undefined?!![]:![]:!![],'where':_0x43a2de['options']?_0x43a2de['options']['where']||null:null,'attributes':_0x43a2de[_0xec21('0x1f')]?_0x43a2de[_0xec21('0x1f')][_0xec21('0x20')]||null:null,'include':_0x43a2de[_0xec21('0x1f')]?_0x43a2de[_0xec21('0x1f')][_0xec21('0x22')]?_[_0xec21('0x23')](_0x43a2de[_0xec21('0x1f')][_0xec21('0x22')],function(_0x1a7586){return{'model':db[_0x1a7586[_0xec21('0x24')]],'as':_0x1a7586['as'],'attributes':_0x1a7586[_0xec21('0x20')],'include':_0x1a7586['include']?_[_0xec21('0x23')](_0x1a7586[_0xec21('0x22')],function(_0x4a91a8){return{'model':db[_0x4a91a8[_0xec21('0x24')]],'as':_0x4a91a8['as'],'attributes':_0x4a91a8['attributes'],'include':_0x4a91a8['include']?_[_0xec21('0x23')](_0x4a91a8['include'],function(_0x4556c2){return{'model':db[_0x4556c2['model']],'as':_0x4556c2['as'],'attributes':_0x4556c2[_0xec21('0x20')]};}):[]};}):[]};}):[]:[]})[_0xec21('0x25')](function(_0x54b3a6){if(_0x43a2de[_0xec21('0x1f')][_0xec21('0x28')]===!![])_0x54b3a6[_0xec21('0x29')]('smtpOptions',_0x54b3a6[_0xec21('0x2a')]());logger[_0xec21('0x10')](_0xec21('0x26'),_0x43a2de);logger['debug'](_0xec21('0x26'),_0x43a2de,JSON[_0xec21('0x15')](_0x54b3a6));_0x31f861(_0x54b3a6);})[_0xec21('0x1a')](function(_0x154b8b){logger[_0xec21('0x16')]('ShowMailAccount',_0x154b8b[_0xec21('0x18')],_0x43a2de);_0x2a14aa(_0x57e004[_0xec21('0x16')](0x1f4,_0x154b8b['message']));});});};exports[_0xec21('0x2b')]=function(_0x54e642){var _0x1f0916=this;return new Promise(function(_0x18e20d,_0xf13561){var _0x49f90a={'body':_0x54e642[_0xec21('0x2c')],'channel':_0xec21('0x2d')};var _0x1093f6=_[_0xec21('0x2e')](_['keys'](db['CmContact'][_0xec21('0x2f')]),['createdAt',_0xec21('0x30'),'CompanyId',_0xec21('0x31')]);var _0x52e024=![];if(_0x54e642[_0xec21('0x2c')]['id']){delete _0x54e642[_0xec21('0x2c')]['id'];}if(_['isNil'](_0x54e642[_0xec21('0x2c')][_0xec21('0x32')])){return _0xf13561(_0x1f0916['error'](0x1f4,_0xec21('0x33')));}if(_[_0xec21('0x34')](_0x54e642[_0xec21('0x2c')][_0xec21('0x2c')])||_0x54e642[_0xec21('0x2c')][_0xec21('0x2c')]===''){return _0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0xec21('0x35')));}if(_[_0xec21('0x34')](_0x54e642['body']['mapKey'])){return _0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0xec21('0x36')+_0x1093f6));}if(!_[_0xec21('0x37')](_0x1093f6,_0x54e642['body'][_0xec21('0x38')])){return _0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0xec21('0x39')+_0x1093f6));}var _0x555d95={};_0x555d95[_0x54e642['body']['mapKey']]=_0x54e642[_0xec21('0x2c')][_0xec21('0x32')];return db[_0xec21('0x1c')][_0xec21('0x27')]({'where':{'id':_0x54e642[_0xec21('0x3a')]['id']},'include':[{'model':db[_0xec21('0x3b')],'as':_0xec21('0x3c'),'include':[{'model':db['CmContact'],'as':_0xec21('0x3d'),'where':_0x555d95,'limit':0x1,'order':[[_0xec21('0x30'),_0xec21('0x3e')]]}]},{'model':db[_0xec21('0x3f')],'as':_0xec21('0x40')},{'model':db[_0xec21('0x41')],'as':_0xec21('0x42'),'include':[{'model':db[_0xec21('0x43')],'as':'CloudProvider'}]}]})[_0xec21('0x25')](function(_0x21e67f){if(_0x21e67f&&_0x21e67f[_0xec21('0x3c')]){var _0x58e490=_0x21e67f['get']({'plain':!![]});_0x49f90a['account']=_[_0xec21('0x44')](_0x58e490,[_0xec21('0x40'),'List']);_0x49f90a[_0xec21('0x3a')][_0xec21('0x45')]=_0x21e67f[_0xec21('0x2a')]();_0x49f90a['applications']=_0x58e490[_0xec21('0x40')];_0x49f90a['list']=_0x58e490[_0xec21('0x3c')];_0x49f90a['applications']=_[_0xec21('0x46')](_0x49f90a[_0xec21('0x47')],[_0xec21('0x48')],[_0xec21('0x49')]);if(_0x49f90a[_0xec21('0x3a')]&&_0x49f90a['account'][_0xec21('0x4a')]){_0x49f90a['applications'][_0xec21('0x4b')]({'id':0x0,'priority':_0x49f90a['applications'][_0xec21('0x4c')]+0x1,'app':_0xec21('0x4d'),'appdata':_0xec21('0x4a'),'interval':_0xec21('0x4e')});}if(_0x49f90a[_0xec21('0x3a')][_0xec21('0x40')]){delete _0x49f90a['account'][_0xec21('0x40')];}if(_0x49f90a[_0xec21('0x3a')][_0xec21('0x3c')]){delete _0x49f90a[_0xec21('0x3a')]['List'];}if(_0x58e490[_0xec21('0x3c')][_0xec21('0x3d')][_0xec21('0x4c')]){return _0x58e490['List']['Contacts'][0x0];}var _0x674ba7=_['defaults'](_0x54e642[_0xec21('0x2c')],{'firstName':_0x54e642[_0xec21('0x2c')]['from'],'ListId':_0x58e490['ListId']});_0x674ba7[_0x54e642[_0xec21('0x2c')][_0xec21('0x38')]]=_0x54e642[_0xec21('0x2c')][_0xec21('0x32')];return db[_0xec21('0x4f')][_0xec21('0x50')](_0x674ba7);}else{throw new Error(_0xec21('0x51'));}})[_0xec21('0x25')](function(_0x4a5351){_0x49f90a[_0xec21('0x52')]=_0x4a5351;if(_0x4a5351){if(!_0x54e642['body'][_0xec21('0x18')]['messageId']){_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x53')]=rs[_0xec21('0x54')]()+'\x20'+_0x54e642[_0xec21('0x2c')]['message']['from'];}var _0x49cd02={'ContactId':_0x4a5351['id'],'MailAccountId':_0x54e642[_0xec21('0x3a')]['id'],'inReplyTo':_0x54e642['body'][_0xec21('0x18')][_0xec21('0x53')],'to':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x32')],'cc':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['cc'],'subject':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['subject'],'attach':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x55')],'lastMsgAt':moment()[_0xec21('0x56')](_0xec21('0x57')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x54e642[_0xec21('0x3a')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0xec21('0x53')],'where':{'messageId':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['inReplyTo']}}]})[_0xec21('0x25')](function(_0x43848f){if(_0x43848f){return[_0x43848f,![]];}return db[_0xec21('0x58')][_0xec21('0x50')](_0x49cd02)[_0xec21('0x25')](function(_0x2ae987){return[_0x2ae987,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xec21('0x59')](function(_0x1cb2b1,_0x3a4bd6){if(_0x1cb2b1){_0x52e024=_0x3a4bd6;if(!_0x3a4bd6){return _0x1cb2b1[_0xec21('0x5a')]({'inReplyTo':_0x54e642['body']['message']['messageId'],'to':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x32')],'cc':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['cc'],'subject':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x5b')],'attach':_0x1cb2b1[_0xec21('0x55')]?_0x1cb2b1[_0xec21('0x55')]:_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x55')],'substatus':null,'substatusAt':moment()[_0xec21('0x56')](_0xec21('0x57')),'lastMsgAt':moment()['format'](_0xec21('0x57')),'lastMsgDirection':'in'});}else{return _0x1cb2b1;}}})[_0xec21('0x25')](function(_0x11d9e7){_0x49f90a[_0xec21('0x5c')]=_0x11d9e7['get']({'plain':!![]});_0x49f90a['interaction'][_0xec21('0x5d')]=_0x52e024;return db[_0xec21('0x5e')][_0xec21('0x50')]({'body':_0x54e642[_0xec21('0x2c')]['body'],'MailAccountId':_0x54e642[_0xec21('0x3a')]['id'],'MailInteractionId':_0x11d9e7['id'],'direction':'in','ContactId':_0x49f90a['contact']['id'],'messageId':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x53')],'from':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')]['from'],'to':_0x54e642['body'][_0xec21('0x18')]['to'],'cc':_0x54e642[_0xec21('0x2c')]['message']['cc'],'subject':_0x54e642['body'][_0xec21('0x18')][_0xec21('0x5b')],'attach':_0x54e642['body']['message'][_0xec21('0x55')],'Attachments':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x5f')],'originTo':_0x54e642['body']['message'][_0xec21('0x60')],'originCc':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x61')],'bcc':_0x54e642[_0xec21('0x2c')]['message'][_0xec21('0x62')],'ChatWebsiteId':_0x54e642['body']['message'][_0xec21('0x63')]||null,'originChannel':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x64')]||_0xec21('0x65'),'ChatOfflineMessageId':_0x54e642[_0xec21('0x2c')][_0xec21('0x18')][_0xec21('0x66')]||null},{'include':[{'model':db[_0xec21('0x67')],'as':'Attachments'}]});})[_0xec21('0x25')](function(_0x194287){_0x49f90a['message']=_0x194287;if(!_0x49f90a['interaction'][_0xec21('0x68')]){return;}return db[_0xec21('0x69')][_0xec21('0x27')]({'attributes':['id',_0xec21('0x6a')],'where':{'id':_0x49f90a[_0xec21('0x5c')][_0xec21('0x68')]}});})['then'](function(_0x2cb4d6){if(_0x2cb4d6){_0x49f90a[_0xec21('0x47')][_0xec21('0x6b')]({'id':0x0,'priority':0x0,'app':_0xec21('0x6c'),'appdata':_0x2cb4d6[_0xec21('0x6a')]+','+(_0x49f90a[_0xec21('0x3a')][_0xec21('0x6d')]||0xa),'interval':_0xec21('0x4e')});}if(!_0x49f90a[_0xec21('0x5c')][_0xec21('0x6e')]){return;}return db[_0xec21('0x6f')][_0xec21('0x27')]({'attributes':['id',_0xec21('0x6a')],'where':{'id':_0x49f90a[_0xec21('0x5c')]['queueId']}});})[_0xec21('0x25')](function(_0x502fb8){if(_0x502fb8){_0x49f90a[_0xec21('0x47')][_0xec21('0x6b')]({'id':0x0,'priority':0x1,'app':_0xec21('0x70'),'appdata':_0x502fb8[_0xec21('0x6a')]+','+(_0x49f90a[_0xec21('0x3a')][_0xec21('0x71')]||0x12c),'interval':_0xec21('0x4e')});}return respondWithRpcPromise(_0xec21('0x72'),_0xec21('0x73'),_0x49f90a);})['then'](function(_0x44077f){_0x18e20d(_0x44077f);})[_0xec21('0x1a')](function(_0x5def11){_0xf13561(_0x1f0916[_0xec21('0x16')](0x1f4,_0x5def11[_0xec21('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 6aa7087..2008cc5 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 _0x1beb=['./mailAccount.events','save','update','emit','removeListener','register','length'];(function(_0x2c74e2,_0x20e402){var _0x35cdfc=function(_0x23aafa){while(--_0x23aafa){_0x2c74e2['push'](_0x2c74e2['shift']());}};_0x35cdfc(++_0x20e402);}(_0x1beb,0x165));var _0xb1be=function(_0x4a29dd,_0x156130){_0x4a29dd=_0x4a29dd-0x0;var _0x4fec31=_0x1beb[_0x4a29dd];return _0x4fec31;};'use strict';var MailAccountEvents=require(_0xb1be('0x0'));var events=[_0xb1be('0x1'),'remove',_0xb1be('0x2')];function createListener(_0x402425,_0x3beaaf){return function(_0x55259c){_0x3beaaf[_0xb1be('0x3')](_0x402425,_0x55259c);};}function removeListener(_0xe463e1,_0x5b6000){return function(){MailAccountEvents[_0xb1be('0x4')](_0xe463e1,_0x5b6000);};}exports[_0xb1be('0x5')]=function(_0x116394){for(var _0xe36555=0x0,_0x1b548a=events[_0xb1be('0x6')];_0xe36555<_0x1b548a;_0xe36555++){var _0x42014d=events[_0xe36555];var _0x1c8f2e=createListener('mailAccount:'+_0x42014d,_0x116394);MailAccountEvents['on'](_0x42014d,_0x1c8f2e);}}; \ No newline at end of file +var _0x8237=['./mailAccount.events','save','emit','removeListener','register','length'];(function(_0x4105fa,_0x22a667){var _0x5e197c=function(_0x5494ae){while(--_0x5494ae){_0x4105fa['push'](_0x4105fa['shift']());}};_0x5e197c(++_0x22a667);}(_0x8237,0x96));var _0x7823=function(_0xcd2eba,_0x5b50bd){_0xcd2eba=_0xcd2eba-0x0;var _0x5b32ba=_0x8237[_0xcd2eba];return _0x5b32ba;};'use strict';var MailAccountEvents=require(_0x7823('0x0'));var events=[_0x7823('0x1'),'remove','update'];function createListener(_0x28c33e,_0x254849){return function(_0x49c5ef){_0x254849[_0x7823('0x2')](_0x28c33e,_0x49c5ef);};}function removeListener(_0x4f59f1,_0x493371){return function(){MailAccountEvents[_0x7823('0x3')](_0x4f59f1,_0x493371);};}exports[_0x7823('0x4')]=function(_0x14b35d){for(var _0x3193f1=0x0,_0x4e3841=events[_0x7823('0x5')];_0x3193f1<_0x4e3841;_0x3193f1++){var _0x476ff5=events[_0x3193f1];var _0x1e5260=createListener('mailAccount:'+_0x476ff5,_0x14b35d);MailAccountEvents['on'](_0x476ff5,_0x1e5260);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 9fc3a22..a02da60 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 _0x6240=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','/:id','show','put','update'];(function(_0x4ea1c6,_0x59718b){var _0x90813e=function(_0x241a9f){while(--_0x241a9f){_0x4ea1c6['push'](_0x4ea1c6['shift']());}};_0x90813e(++_0x59718b);}(_0x6240,0x1d3));var _0x0624=function(_0x59efdf,_0x329a92){_0x59efdf=_0x59efdf-0x0;var _0x4bc3a5=_0x6240[_0x59efdf];return _0x4bc3a5;};'use strict';var multer=require(_0x0624('0x0'));var util=require(_0x0624('0x1'));var path=require(_0x0624('0x2'));var timeout=require(_0x0624('0x3'));var express=require(_0x0624('0x4'));var router=express[_0x0624('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0624('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0624('0x7'));var controller=require(_0x0624('0x8'));router['get'](_0x0624('0x9'),auth['isAuthenticated'](),controller[_0x0624('0xa')]);router[_0x0624('0xb')](_0x0624('0x9'),auth['isAuthenticated'](),controller[_0x0624('0xc')]);router[_0x0624('0xd')](_0x0624('0x9'),auth['isAuthenticated'](),controller[_0x0624('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5f78=['show','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated'];(function(_0x542f45,_0x37468a){var _0x38c609=function(_0x44259b){while(--_0x44259b){_0x542f45['push'](_0x542f45['shift']());}};_0x38c609(++_0x37468a);}(_0x5f78,0x149));var _0x85f7=function(_0x1283d4,_0x36b6f1){_0x1283d4=_0x1283d4-0x0;var _0x433643=_0x5f78[_0x1283d4];return _0x433643;};'use strict';var multer=require(_0x85f7('0x0'));var util=require('util');var path=require(_0x85f7('0x1'));var timeout=require(_0x85f7('0x2'));var express=require('express');var router=express[_0x85f7('0x3')]();var fs_extra=require(_0x85f7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x85f7('0x5'));var config=require(_0x85f7('0x6'));var controller=require(_0x85f7('0x7'));router[_0x85f7('0x8')](_0x85f7('0x9'),auth[_0x85f7('0xa')](),controller[_0x85f7('0xb')]);router[_0x85f7('0xc')](_0x85f7('0x9'),auth['isAuthenticated'](),controller[_0x85f7('0xd')]);router[_0x85f7('0xe')](_0x85f7('0x9'),auth[_0x85f7('0xa')](),controller[_0x85f7('0xf')]);module[_0x85f7('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index d1026e3..fa3c91f 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 _0xddeb=['STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x171f58,_0x35d977){var _0x3e05e2=function(_0x1fbe46){while(--_0x1fbe46){_0x171f58['push'](_0x171f58['shift']());}};_0x3e05e2(++_0x35d977);}(_0xddeb,0xcc));var _0xbdde=function(_0x36bfe3,_0x358938){_0x36bfe3=_0x36bfe3-0x0;var _0x9b0436=_0xddeb[_0x36bfe3];return _0x9b0436;};'use strict';var Sequelize=require(_0xbdde('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xbdde('0x1')],'allowNull':![],'defaultValue':_0xbdde('0x2')},'appdata':{'type':Sequelize[_0xbdde('0x3')]()},'description':{'type':Sequelize[_0xbdde('0x1')]},'interval':{'type':Sequelize[_0xbdde('0x1')],'defaultValue':_0xbdde('0x4')}}; \ No newline at end of file +var _0xe6e4=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x6306d2,_0x4ae91b){var _0x4d13aa=function(_0x3bfb2a){while(--_0x3bfb2a){_0x6306d2['push'](_0x6306d2['shift']());}};_0x4d13aa(++_0x4ae91b);}(_0xe6e4,0x13b));var _0x4e6e=function(_0xc731bb,_0x5891d4){_0xc731bb=_0xc731bb-0x0;var _0xfe197d=_0xe6e4[_0xc731bb];return _0xfe197d;};'use strict';var Sequelize=require(_0x4e6e('0x0'));module[_0x4e6e('0x1')]={'priority':{'type':Sequelize[_0x4e6e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4e6e('0x3')],'allowNull':![],'defaultValue':_0x4e6e('0x4')},'appdata':{'type':Sequelize[_0x4e6e('0x5')]()},'description':{'type':Sequelize[_0x4e6e('0x3')]},'interval':{'type':Sequelize[_0x4e6e('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index d15fdca..ed4903c 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 _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x5cef48,_0x4f4b95){var _0x2486c6=function(_0x4acbe3){while(--_0x4acbe3){_0x5cef48['push'](_0x5cef48['shift']());}};_0x2486c6(++_0x4f4b95);}(_0xe706,0xa3));var _0x6e70=function(_0x262baa,_0x283058){_0x262baa=_0x262baa-0x0;var _0x4f2257=_0xe706[_0x262baa];return _0x4f2257;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file +var _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x1fd456,_0x3b5d5f){var _0x599648=function(_0x1f8a70){while(--_0x1f8a70){_0x1fd456['push'](_0x1fd456['shift']());}};_0x599648(++_0x3b5d5f);}(_0xe706,0xa3));var _0x6e70=function(_0x4748a2,_0x5d04bd){_0x4748a2=_0x4748a2-0x0;var _0x16c342=_0xe706[_0x4748a2];return _0x16c342;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index aa2e9c6..2a3ba70 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 _0xe15f=['exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xe15f,0x1f4));var _0xfe15=function(_0x546f2b,_0x2e12ce){_0x546f2b=_0x546f2b-0x0;var _0xecd1bd=_0xe15f[_0x546f2b];return _0xecd1bd;};'use strict';var _=require(_0xfe15('0x0'));var util=require(_0xfe15('0x1'));var logger=require(_0xfe15('0x2'))(_0xfe15('0x3'));var moment=require(_0xfe15('0x4'));var BPromise=require(_0xfe15('0x5'));var rp=require(_0xfe15('0x6'));var fs=require('fs');var path=require(_0xfe15('0x7'));var rimraf=require(_0xfe15('0x8'));var config=require(_0xfe15('0x9'));var attributes=require('./mailApplication.attributes');module[_0xfe15('0xa')]=function(_0x54c577,_0x44d11f){return _0x54c577[_0xfe15('0xb')]('MailApplication',attributes,{'tableName':_0xfe15('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfe15('0xd'),'collate':_0xfe15('0xe')});}; \ No newline at end of file +var _0x74f7=['define','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x74f7,0x1be));var _0x774f=function(_0x1595ff,_0x238718){_0x1595ff=_0x1595ff-0x0;var _0x571b9d=_0x74f7[_0x1595ff];return _0x571b9d;};'use strict';var _=require(_0x774f('0x0'));var util=require(_0x774f('0x1'));var logger=require(_0x774f('0x2'))(_0x774f('0x3'));var moment=require(_0x774f('0x4'));var BPromise=require('bluebird');var rp=require(_0x774f('0x5'));var fs=require('fs');var path=require(_0x774f('0x6'));var rimraf=require('rimraf');var config=require(_0x774f('0x7'));var attributes=require('./mailApplication.attributes');module[_0x774f('0x8')]=function(_0x10a06c,_0x19dba9){return _0x10a06c[_0x774f('0x9')](_0x774f('0xa'),attributes,{'tableName':_0x774f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x774f('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 5a3c778..f1619f1 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 _0xb5b8=['then','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','MailApplication,\x20%s,\x20%s','info','result','catch','UpdateMailApplication','MailApplication','update','body','options','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x16af88,_0x1c6a15){var _0x376ddd=function(_0x13300f){while(--_0x13300f){_0x16af88['push'](_0x16af88['shift']());}};_0x376ddd(++_0x1c6a15);}(_0xb5b8,0x102));var _0x8b5b=function(_0x51e0b9,_0x44c9c0){_0x51e0b9=_0x51e0b9-0x0;var _0x2202dd=_0xb5b8[_0x51e0b9];return _0x2202dd;};'use strict';var _=require(_0x8b5b('0x0'));var util=require(_0x8b5b('0x1'));var moment=require(_0x8b5b('0x2'));var BPromise=require(_0x8b5b('0x3'));var rs=require(_0x8b5b('0x4'));var fs=require('fs');var Redis=require(_0x8b5b('0x5'));var db=require(_0x8b5b('0x6'))['db'];var utils=require(_0x8b5b('0x7'));var logger=require('../../config/logger')(_0x8b5b('0x8'));var config=require(_0x8b5b('0x9'));var jayson=require(_0x8b5b('0xa'));var client=jayson['client'][_0x8b5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cb1ff,_0x31a088,_0x255c6e){return new BPromise(function(_0x13e7a3,_0x1ae646){return client['request'](_0x4cb1ff,_0x255c6e)[_0x8b5b('0xc')](function(_0x490e56){logger['info']('MailApplication,\x20%s,\x20%s',_0x31a088,_0x8b5b('0xd'));logger[_0x8b5b('0xe')](_0x8b5b('0xf'),_0x31a088,'request\x20sent',JSON[_0x8b5b('0x10')](_0x490e56));if(_0x490e56[_0x8b5b('0x11')]){if(_0x490e56[_0x8b5b('0x11')]['code']===0x1f4){logger[_0x8b5b('0x11')]('MailApplication,\x20%s,\x20%s',_0x31a088,_0x490e56['error'][_0x8b5b('0x12')]);return _0x1ae646(_0x490e56[_0x8b5b('0x11')][_0x8b5b('0x12')]);}logger['error'](_0x8b5b('0x13'),_0x31a088,_0x490e56['error'][_0x8b5b('0x12')]);return _0x13e7a3(_0x490e56[_0x8b5b('0x11')][_0x8b5b('0x12')]);}else{logger[_0x8b5b('0x14')]('MailApplication,\x20%s,\x20%s',_0x31a088,'request\x20sent');_0x13e7a3(_0x490e56[_0x8b5b('0x15')][_0x8b5b('0x12')]);}})[_0x8b5b('0x16')](function(_0x428d32){logger[_0x8b5b('0x11')](_0x8b5b('0x13'),_0x31a088,_0x428d32);_0x1ae646(_0x428d32);});});}exports[_0x8b5b('0x17')]=function(_0x15f70e){var _0x58a8fe=this;return new Promise(function(_0x11611b,_0x5ab201){return db[_0x8b5b('0x18')][_0x8b5b('0x19')](_0x15f70e[_0x8b5b('0x1a')],{'raw':_0x15f70e['options']?_0x15f70e[_0x8b5b('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15f70e[_0x8b5b('0x1b')]?_0x15f70e[_0x8b5b('0x1b')][_0x8b5b('0x1c')]||null:null,'attributes':_0x15f70e[_0x8b5b('0x1b')]?_0x15f70e[_0x8b5b('0x1b')]['attributes']||null:null,'limit':_0x15f70e['options']?_0x15f70e[_0x8b5b('0x1b')][_0x8b5b('0x1d')]||null:null})[_0x8b5b('0xc')](function(_0x3c86a5){logger[_0x8b5b('0x14')](_0x8b5b('0x17'),_0x15f70e);logger[_0x8b5b('0xe')]('UpdateMailApplication',_0x15f70e,JSON['stringify'](_0x3c86a5));_0x11611b(_0x3c86a5);})[_0x8b5b('0x16')](function(_0x314d1b){logger[_0x8b5b('0x11')]('UpdateMailApplication',_0x314d1b[_0x8b5b('0x12')],_0x15f70e);_0x5ab201(_0x58a8fe[_0x8b5b('0x11')](0x1f4,_0x314d1b['message']));});});}; \ No newline at end of file +var _0x8d21=['where','attributes','limit','UpdateMailApplication','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','update','body','options'];(function(_0x1db2f9,_0x59ea17){var _0x56f020=function(_0x4d13cc){while(--_0x4d13cc){_0x1db2f9['push'](_0x1db2f9['shift']());}};_0x56f020(++_0x59ea17);}(_0x8d21,0x16c));var _0x18d2=function(_0x2bc6ae,_0x49d4e3){_0x2bc6ae=_0x2bc6ae-0x0;var _0x1b7e21=_0x8d21[_0x2bc6ae];return _0x1b7e21;};'use strict';var _=require(_0x18d2('0x0'));var util=require('util');var moment=require(_0x18d2('0x1'));var BPromise=require(_0x18d2('0x2'));var rs=require(_0x18d2('0x3'));var fs=require('fs');var Redis=require(_0x18d2('0x4'));var db=require(_0x18d2('0x5'))['db'];var utils=require(_0x18d2('0x6'));var logger=require('../../config/logger')(_0x18d2('0x7'));var config=require(_0x18d2('0x8'));var jayson=require(_0x18d2('0x9'));var client=jayson[_0x18d2('0xa')][_0x18d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x455f45,_0x50eea6,_0x4434e6){return new BPromise(function(_0x5b631c,_0xd18cf3){return client['request'](_0x455f45,_0x4434e6)[_0x18d2('0xc')](function(_0x563406){logger[_0x18d2('0xd')](_0x18d2('0xe'),_0x50eea6,_0x18d2('0xf'));logger[_0x18d2('0x10')](_0x18d2('0x11'),_0x50eea6,_0x18d2('0xf'),JSON[_0x18d2('0x12')](_0x563406));if(_0x563406['error']){if(_0x563406[_0x18d2('0x13')][_0x18d2('0x14')]===0x1f4){logger[_0x18d2('0x13')](_0x18d2('0xe'),_0x50eea6,_0x563406[_0x18d2('0x13')][_0x18d2('0x15')]);return _0xd18cf3(_0x563406[_0x18d2('0x13')][_0x18d2('0x15')]);}logger['error'](_0x18d2('0xe'),_0x50eea6,_0x563406[_0x18d2('0x13')][_0x18d2('0x15')]);return _0x5b631c(_0x563406[_0x18d2('0x13')][_0x18d2('0x15')]);}else{logger['info'](_0x18d2('0xe'),_0x50eea6,_0x18d2('0xf'));_0x5b631c(_0x563406['result'][_0x18d2('0x15')]);}})[_0x18d2('0x16')](function(_0x45629a){logger[_0x18d2('0x13')]('MailApplication,\x20%s,\x20%s',_0x50eea6,_0x45629a);_0xd18cf3(_0x45629a);});});}exports['UpdateMailApplication']=function(_0x421426){var _0x25b0f2=this;return new Promise(function(_0x513f6e,_0x6429aa){return db['MailApplication'][_0x18d2('0x17')](_0x421426[_0x18d2('0x18')],{'raw':_0x421426[_0x18d2('0x19')]?_0x421426[_0x18d2('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x421426[_0x18d2('0x19')]?_0x421426['options'][_0x18d2('0x1a')]||null:null,'attributes':_0x421426['options']?_0x421426[_0x18d2('0x19')][_0x18d2('0x1b')]||null:null,'limit':_0x421426[_0x18d2('0x19')]?_0x421426[_0x18d2('0x19')][_0x18d2('0x1c')]||null:null})[_0x18d2('0xc')](function(_0x528c2c){logger['info']('UpdateMailApplication',_0x421426);logger[_0x18d2('0x10')](_0x18d2('0x1d'),_0x421426,JSON['stringify'](_0x528c2c));_0x513f6e(_0x528c2c);})[_0x18d2('0x16')](function(_0x2cfc77){logger[_0x18d2('0x13')](_0x18d2('0x1d'),_0x2cfc77[_0x18d2('0x15')],_0x421426);_0x6429aa(_0x25b0f2[_0x18d2('0x13')](0x1f4,_0x2cfc77[_0x18d2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 4a50db4..e945c62 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 _0xbd3d=['destroy','removeTags','exports','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','/:id','delete','mailinteraction:destroy'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0xbd3d,0x155));var _0xdbd3=function(_0x1d76e1,_0x43ed78){_0x1d76e1=_0x1d76e1-0x0;var _0x3a9450=_0xbd3d[_0x1d76e1];return _0x3a9450;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xdbd3('0x0'));var interaction=require(_0xdbd3('0x1'));var controller=require(_0xdbd3('0x2'));router[_0xdbd3('0x3')]('/',auth[_0xdbd3('0x4')](),controller[_0xdbd3('0x5')]);router['get'](_0xdbd3('0x6'),auth['isAuthenticated'](),controller[_0xdbd3('0x7')]);router[_0xdbd3('0x3')]('/:id',auth[_0xdbd3('0x4')](),controller['show']);router[_0xdbd3('0x3')]('/:id/messages',auth[_0xdbd3('0x4')](),controller[_0xdbd3('0x8')]);router[_0xdbd3('0x3')](_0xdbd3('0x9'),auth['isAuthenticated'](),controller[_0xdbd3('0xa')]);router[_0xdbd3('0xb')]('/',auth[_0xdbd3('0x4')](),controller[_0xdbd3('0xc')]);router[_0xdbd3('0xb')](_0xdbd3('0xd'),auth['isAuthenticated'](),controller['addMessage']);router[_0xdbd3('0xb')](_0xdbd3('0xe'),auth['isAuthenticated'](),interaction[_0xdbd3('0xf')](_0xdbd3('0x10'),_0xdbd3('0x11')),controller[_0xdbd3('0x12')]);router[_0xdbd3('0x13')](_0xdbd3('0x14'),auth[_0xdbd3('0x4')](),interaction[_0xdbd3('0xf')](_0xdbd3('0x10'),'mailinteraction:update'),controller['update']);router[_0xdbd3('0x15')](_0xdbd3('0x14'),auth[_0xdbd3('0x4')](),interaction[_0xdbd3('0xf')](_0xdbd3('0x10'),_0xdbd3('0x16')),controller[_0xdbd3('0x17')]);router[_0xdbd3('0x15')]('/:id/tags',auth[_0xdbd3('0x4')](),controller[_0xdbd3('0x18')]);module[_0xdbd3('0x19')]=router; \ No newline at end of file +var _0x93b2=['addTags','put','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','index','get','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','mail'];(function(_0x5e5b6e,_0x1b2c06){var _0x2a4a51=function(_0x48fd59){while(--_0x48fd59){_0x5e5b6e['push'](_0x5e5b6e['shift']());}};_0x2a4a51(++_0x1b2c06);}(_0x93b2,0x121));var _0x293b=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x93b2[_0x46e363];return _0x3fb059;};'use strict';var express=require('express');var router=express[_0x293b('0x0')]();var auth=require(_0x293b('0x1'));var interaction=require(_0x293b('0x2'));var controller=require(_0x293b('0x3'));router['get']('/',auth[_0x293b('0x4')](),controller[_0x293b('0x5')]);router[_0x293b('0x6')]('/describe',auth[_0x293b('0x4')](),controller[_0x293b('0x7')]);router['get'](_0x293b('0x8'),auth['isAuthenticated'](),controller[_0x293b('0x9')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x293b('0xa')]);router[_0x293b('0x6')](_0x293b('0xb'),auth[_0x293b('0x4')](),controller[_0x293b('0xc')]);router[_0x293b('0xd')]('/',auth[_0x293b('0x4')](),controller[_0x293b('0xe')]);router[_0x293b('0xd')](_0x293b('0xf'),auth['isAuthenticated'](),controller[_0x293b('0x10')]);router[_0x293b('0xd')](_0x293b('0x11'),auth[_0x293b('0x4')](),interaction['tracked'](_0x293b('0x12'),'mailinteraction:addtags'),controller[_0x293b('0x13')]);router[_0x293b('0x14')](_0x293b('0x8'),auth[_0x293b('0x4')](),interaction[_0x293b('0x15')](_0x293b('0x12'),_0x293b('0x16')),controller[_0x293b('0x17')]);router[_0x293b('0x18')](_0x293b('0x8'),auth[_0x293b('0x4')](),interaction[_0x293b('0x15')]('mail',_0x293b('0x19')),controller['destroy']);router[_0x293b('0x18')]('/:id/tags',auth[_0x293b('0x4')](),controller[_0x293b('0x1a')]);module[_0x293b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 7c78ec9..b5524b8 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 _0xa77e=['BOOLEAN','DATE','STRING','TEXT','long','ENUM','INTEGER','sequelize'];(function(_0x3c1aec,_0xbbd08e){var _0x41aacb=function(_0x186481){while(--_0x186481){_0x3c1aec['push'](_0x3c1aec['shift']());}};_0x41aacb(++_0xbbd08e);}(_0xa77e,0x1df));var _0xea77=function(_0x29e0f8,_0x2f35a9){_0x29e0f8=_0x29e0f8-0x0;var _0x1c1479=_0xa77e[_0x29e0f8];return _0x1c1479;};'use strict';var Sequelize=require(_0xea77('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0xea77('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xea77('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xea77('0x3')]},'thirdDisposition':{'type':Sequelize[_0xea77('0x3')]},'note':{'type':Sequelize[_0xea77('0x3')]},'inReplyTo':{'type':Sequelize[_0xea77('0x3')](0x1fe)},'to':{'type':Sequelize[_0xea77('0x3')]},'cc':{'type':Sequelize[_0xea77('0x4')](_0xea77('0x5'))},'subject':{'type':Sequelize[_0xea77('0x4')]()},'attach':{'type':Sequelize[_0xea77('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xea77('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xea77('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xea77('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xea77('0x7')]}}; \ No newline at end of file +var _0xaa03=['out','INTEGER','sequelize','iconv','DATE','STRING','long','BOOLEAN','ENUM'];(function(_0x17ae5f,_0xe06188){var _0x5d5662=function(_0x48ebc){while(--_0x48ebc){_0x17ae5f['push'](_0x17ae5f['shift']());}};_0x5d5662(++_0xe06188);}(_0xaa03,0xf5));var _0x3aa0=function(_0xb1dd80,_0x5a0b10){_0xb1dd80=_0xb1dd80-0x0;var _0x538ad4=_0xaa03[_0xb1dd80];return _0x538ad4;};'use strict';var Sequelize=require(_0x3aa0('0x0'));var iconv=require(_0x3aa0('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3aa0('0x2')]},'disposition':{'type':Sequelize[_0x3aa0('0x3')]},'secondDisposition':{'type':Sequelize[_0x3aa0('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3aa0('0x3')]},'note':{'type':Sequelize[_0x3aa0('0x3')]},'inReplyTo':{'type':Sequelize[_0x3aa0('0x3')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x3aa0('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x3aa0('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x3aa0('0x2')]},'substatus':{'type':Sequelize[_0x3aa0('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x3aa0('0x6')]('in',_0x3aa0('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x3aa0('0x6')]('in',_0x3aa0('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x3aa0('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3aa0('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index fe98b13..cdad042 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 _0x723d=['missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','readFileSync','build','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','then','error','stack','name','send','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','body','describe','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','rows','addTags','setTags','spread','Tag','color','mailInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Messages','from','bcc','subject','createdAt','get','mkdirSync','each'];(function(_0x37d6e1,_0x522cfe){var _0xbb46db=function(_0x404aef){while(--_0x404aef){_0x37d6e1['push'](_0x37d6e1['shift']());}};_0xbb46db(++_0x522cfe);}(_0x723d,0x15c));var _0xd723=function(_0x4fd75e,_0x219e4a){_0x4fd75e=_0x4fd75e-0x0;var _0x5b6338=_0x723d[_0x4fd75e];return _0x5b6338;};'use strict';var emlformat=require(_0xd723('0x0'));var rimraf=require(_0xd723('0x1'));var zipdir=require(_0xd723('0x2'));var moment=require(_0xd723('0x3'));var BPromise=require(_0xd723('0x4'));var util=require(_0xd723('0x5'));var path=require(_0xd723('0x6'));var fs=require('fs');var _=require(_0xd723('0x7'));var juice=require('juice');var Redis=require(_0xd723('0x8'));var interaction=require(_0xd723('0x9'));var qs=require(_0xd723('0xa'));var logger=require(_0xd723('0xb'))(_0xd723('0xc'));var config=require(_0xd723('0xd'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0xd723('0xe')]=_['defaults'](config['redis'],{'host':_0xd723('0xf'),'port':0x18eb});var socket=require(_0xd723('0x10'))(new Redis(config[_0xd723('0xe')]));require(_0xd723('0x11'))[_0xd723('0x12')](socket);function respondWithStatusCode(_0x328f51,_0x321a41){_0x321a41=_0x321a41||0xcc;return function(_0x220ea7){if(_0x220ea7){return _0x328f51[_0xd723('0x13')](_0x321a41);}return _0x328f51['status'](_0x321a41)[_0xd723('0x14')]();};}function respondWithResult(_0x2675c4,_0x25364b){_0x25364b=_0x25364b||0xc8;return function(_0xc03b40){if(_0xc03b40){return _0x2675c4['status'](_0x25364b)[_0xd723('0x15')](_0xc03b40);}};}function respondWithFilteredResult(_0x431405,_0x465738){return function(_0x4bb608){if(_0x4bb608){var _0x1bb688=typeof _0x465738[_0xd723('0x16')]===_0xd723('0x17')&&typeof _0x465738[_0xd723('0x18')]===_0xd723('0x17');var _0x43b25b=_0x4bb608[_0xd723('0x19')];var _0x10b2dd=_0x1bb688?0x0:_0x465738[_0xd723('0x16')];var _0x3faab3=_0x1bb688?_0x4bb608[_0xd723('0x19')]:_0x465738[_0xd723('0x16')]+_0x465738[_0xd723('0x18')];var _0x47faa6;if(_0x3faab3>=_0x43b25b){_0x3faab3=_0x43b25b;_0x47faa6=0xc8;}else{_0x47faa6=0xce;}_0x431405[_0xd723('0x1a')](_0x47faa6);return _0x431405[_0xd723('0x1b')](_0xd723('0x1c'),_0x10b2dd+'-'+_0x3faab3+'/'+_0x43b25b)[_0xd723('0x15')](_0x4bb608);}return null;};}function saveUpdates(_0x35bea2){return function(_0x1860d2){if(_0x1860d2){return _0x1860d2[_0xd723('0x1d')](_0x35bea2)['then'](function(_0x9d7c01){return _0x9d7c01;});}return null;};}function removeEntity(_0x5e6e79){return function(_0x50d7bc){if(_0x50d7bc){return _0x50d7bc[_0xd723('0x1e')]()[_0xd723('0x1f')](function(){_0x5e6e79[_0xd723('0x1a')](0xcc)[_0xd723('0x14')]();});}};}function handleEntityNotFound(_0x177a64){return function(_0x1dd93a){if(!_0x1dd93a){_0x177a64[_0xd723('0x13')](0x194);}return _0x1dd93a;};}function handleError(_0x3b4303,_0x1d1afd){_0x1d1afd=_0x1d1afd||0x1f4;return function(_0x2624ad){logger[_0xd723('0x20')](_0x2624ad[_0xd723('0x21')]);if(_0x2624ad[_0xd723('0x22')]){delete _0x2624ad[_0xd723('0x22')];}_0x3b4303['status'](_0x1d1afd)[_0xd723('0x23')](_0x2624ad);};}exports['index']=function(_0xa365b1,_0x345b16){var _0x12303e={};var _0x1bc1ce=_[_0xd723('0x24')](db[_0xd723('0x25')][_0xd723('0x26')],function(_0x6d041a){return{'name':_0x6d041a[_0xd723('0x27')],'type':_0x6d041a[_0xd723('0x28')][_0xd723('0x29')]};});_0x12303e=qs[_0xd723('0x2a')](_0x1bc1ce,_0xa365b1);return interaction[_0xd723('0x2b')]('mail',_0xa365b1[_0xd723('0x2c')],_0xa365b1['user'],_0x12303e,_0x1bc1ce)[_0xd723('0x1f')](respondWithFilteredResult(_0x345b16,_0x12303e))[_0xd723('0x2d')](handleError(_0x345b16,null));};exports[_0xd723('0x2e')]=function(_0x4fd40d,_0x1eab2a){var _0x306ba7={'raw':![],'where':{'id':_0x4fd40d[_0xd723('0x2f')]['id']}},_0x412bdd={};_0x412bdd[_0xd723('0x30')]=_[_0xd723('0x31')](db[_0xd723('0x25')][_0xd723('0x26')]);_0x412bdd[_0xd723('0x2c')]=_['keys'](_0x4fd40d[_0xd723('0x2c')]);_0x412bdd[_0xd723('0x32')]=_[_0xd723('0x33')](_0x412bdd[_0xd723('0x30')],_0x412bdd['query']);_0x306ba7[_0xd723('0x34')]=_[_0xd723('0x33')](_0x412bdd[_0xd723('0x30')],qs[_0xd723('0x35')](_0x4fd40d[_0xd723('0x2c')]['fields']));_0x306ba7[_0xd723('0x34')]=_0x306ba7['attributes'][_0xd723('0x36')]?_0x306ba7[_0xd723('0x34')]:_0x412bdd['model'];if(_0x4fd40d[_0xd723('0x2c')][_0xd723('0x37')]){_0x306ba7[_0xd723('0x38')]=[{'all':!![]}];}_0x306ba7=_[_0xd723('0x39')]({},_0x306ba7,_0x4fd40d[_0xd723('0x3a')]);return db[_0xd723('0x25')][_0xd723('0x3b')](_0x306ba7)[_0xd723('0x1f')](handleEntityNotFound(_0x1eab2a,null))[_0xd723('0x1f')](respondWithResult(_0x1eab2a,null))[_0xd723('0x2d')](handleError(_0x1eab2a,null));};exports['create']=function(_0x3a94dc,_0x852016){return db[_0xd723('0x25')]['create'](_0x3a94dc['body'],{})[_0xd723('0x1f')](respondWithResult(_0x852016,0xc9))[_0xd723('0x2d')](handleError(_0x852016,null));};exports['update']=function(_0x1a695a,_0x30481d){if(_0x1a695a[_0xd723('0x3c')]['id']){delete _0x1a695a[_0xd723('0x3c')]['id'];}return db[_0xd723('0x25')][_0xd723('0x3b')]({'where':{'id':_0x1a695a[_0xd723('0x2f')]['id']}})[_0xd723('0x1f')](handleEntityNotFound(_0x30481d,null))[_0xd723('0x1f')](saveUpdates(_0x1a695a['body'],null))['then'](respondWithResult(_0x30481d,null))[_0xd723('0x2d')](handleError(_0x30481d,null));};exports[_0xd723('0x1e')]=function(_0x1da855,_0xcedd0){return db['MailInteraction'][_0xd723('0x3b')]({'where':{'id':_0x1da855['params']['id']}})[_0xd723('0x1f')](handleEntityNotFound(_0xcedd0,null))[_0xd723('0x1f')](removeEntity(_0xcedd0,null))['catch'](handleError(_0xcedd0,null));};exports[_0xd723('0x3d')]=function(_0x3f4bf0,_0x560116){return db['MailInteraction'][_0xd723('0x3d')]()[_0xd723('0x1f')](respondWithResult(_0x560116,null))[_0xd723('0x2d')](handleError(_0x560116,null));};exports[_0xd723('0x3e')]=function(_0x4b57fa,_0x5aab59){return db['MailMessage'][_0xd723('0x3b')]({'where':{'id':_0x4b57fa[_0xd723('0x2f')]['id']}})[_0xd723('0x1f')](handleEntityNotFound(_0x5aab59,null))['then'](function(_0x2000d4){if(_0x2000d4){return _0x2000d4['addMessage'](_0x4b57fa[_0xd723('0x3c')][_0xd723('0x3f')],_[_0xd723('0x40')](_0x4b57fa[_0xd723('0x3c')],['ids','id'])||{});}})[_0xd723('0x1f')](respondWithResult(_0x5aab59,null))['catch'](handleError(_0x5aab59,null));};exports[_0xd723('0x41')]=function(_0x35f67b,_0x47cb66){var _0x31672d={'raw':![],'where':{}};var _0x40cad6={};var _0x460c99={'count':0x0,'rows':[]};return db[_0xd723('0x25')]['findOne']({'where':{'id':_0x35f67b[_0xd723('0x2f')]['id']}})['then'](handleEntityNotFound(_0x47cb66,null))[_0xd723('0x1f')](function(_0x5ba00a){if(_0x5ba00a){_0x40cad6[_0xd723('0x30')]=_['keys'](db['MailMessage']['rawAttributes']);_0x40cad6[_0xd723('0x2c')]=_[_0xd723('0x31')](_0x35f67b[_0xd723('0x2c')]);_0x40cad6[_0xd723('0x32')]=_[_0xd723('0x33')](_0x40cad6['model'],_0x40cad6[_0xd723('0x2c')]);_0x31672d[_0xd723('0x34')]=_[_0xd723('0x33')](_0x40cad6[_0xd723('0x30')],qs['fields'](_0x35f67b['query'][_0xd723('0x35')]));_0x31672d[_0xd723('0x34')]=_0x31672d['attributes'][_0xd723('0x36')]?_0x31672d[_0xd723('0x34')]:_0x40cad6[_0xd723('0x30')];if(!_0x35f67b['query'][_0xd723('0x42')](_0xd723('0x43'))){_0x31672d[_0xd723('0x18')]=qs[_0xd723('0x18')](_0x35f67b[_0xd723('0x2c')][_0xd723('0x18')]);_0x31672d[_0xd723('0x16')]=qs[_0xd723('0x16')](_0x35f67b[_0xd723('0x2c')][_0xd723('0x16')]);}_0x31672d[_0xd723('0x44')]=qs[_0xd723('0x45')](_0x35f67b[_0xd723('0x2c')]['sort']);_0x31672d[_0xd723('0x46')]=qs[_0xd723('0x32')](_['pick'](_0x35f67b['query'],_0x40cad6[_0xd723('0x32')]));_0x31672d['where']['MailInteractionId']=_0x5ba00a['id'];if(_0x35f67b[_0xd723('0x2c')][_0xd723('0x47')]){_0x31672d[_0xd723('0x46')]=_[_0xd723('0x39')](_0x31672d[_0xd723('0x46')],{'$or':_[_0xd723('0x24')](_0x31672d[_0xd723('0x34')],function(_0x3ef09c){var _0x4674f6={};_0x4674f6[_0x3ef09c]={'$like':'%'+_0x35f67b[_0xd723('0x2c')][_0xd723('0x47')]+'%'};return _0x4674f6;})});}if(_0x35f67b[_0xd723('0x2c')]['$gte']){var _0x10eb68=_0x35f67b[_0xd723('0x2c')][_0xd723('0x48')]['split'](',');var _0x453a40={};_0x453a40[_0x10eb68[0x0]]={'$gte':moment(_0x10eb68[0x1])[_0xd723('0x49')](_0xd723('0x4a'))};_0x31672d['where']=_[_0xd723('0x39')](_0x31672d[_0xd723('0x46')],_0x453a40);}_0x31672d=_['merge']({},_0x31672d,_0x35f67b[_0xd723('0x3a')]);return db[_0xd723('0x4b')][_0xd723('0x19')]({'where':_0x31672d['where']})[_0xd723('0x1f')](function(_0x57a459){_0x460c99[_0xd723('0x19')]=_0x57a459;if(_0x35f67b['query'][_0xd723('0x37')]){_0x31672d[_0xd723('0x38')]=[{'all':!![]}];}return db['MailMessage'][_0xd723('0x2b')](_0x31672d);})['then'](function(_0x4097b0){if(_0x35f67b[_0xd723('0x2c')][_0xd723('0x4c')]===_0xd723('0x4d')){for(var _0x328d3c=0x0;_0x328d3c<_0x4097b0['length'];_0x328d3c++){_0x4097b0[_0x328d3c][_0xd723('0x3c')]=juice(_0x4097b0[_0x328d3c][_0xd723('0x3c')]);}}_0x460c99[_0xd723('0x4e')]=_0x4097b0;return _0x460c99;});}})['then'](respondWithFilteredResult(_0x47cb66,_0x31672d))[_0xd723('0x2d')](handleError(_0x47cb66,null));};exports[_0xd723('0x4f')]=function(_0x5ed15b,_0x3f7191){return db[_0xd723('0x25')][_0xd723('0x3b')]({'where':{'id':_0x5ed15b[_0xd723('0x2f')]['id']}})['then'](handleEntityNotFound(_0x3f7191,null))[_0xd723('0x1f')](function(_0x11453d){if(_0x11453d){return _0x11453d[_0xd723('0x50')](_0x5ed15b['body'][_0xd723('0x3f')],_[_0xd723('0x40')](_0x5ed15b['body'],[_0xd723('0x3f'),'id'])||{})[_0xd723('0x51')](function(){return db[_0xd723('0x52')][_0xd723('0x2b')]({'attributes':['id',_0xd723('0x22'),_0xd723('0x53')],'where':{'id':_0x5ed15b[_0xd723('0x3c')][_0xd723('0x3f')]}});})['then'](function(_0x451935){socket['emit'](_0xd723('0x54'),{'id':Number(_0x5ed15b['params']['id']),'tags':_0x451935||[]});return{'id':Number(_0x5ed15b[_0xd723('0x2f')]['id']),'tags':_0x451935||[]};});}})[_0xd723('0x1f')](respondWithResult(_0x3f7191,null))[_0xd723('0x2d')](handleError(_0x3f7191,null));};exports[_0xd723('0x55')]=function(_0x37185a,_0x33cca5){return db[_0xd723('0x25')]['find']({'where':{'id':_0x37185a['params']['id']}})[_0xd723('0x1f')](handleEntityNotFound(_0x33cca5,null))[_0xd723('0x1f')](function(_0x18396f){if(_0x18396f){return _0x18396f['removeTags'](_0x37185a[_0xd723('0x2c')][_0xd723('0x3f')]);}})['then'](respondWithStatusCode(_0x33cca5,null))[_0xd723('0x2d')](handleError(_0x33cca5,null));};exports[_0xd723('0x56')]=function(_0x3414a9,_0x111fb1){var _0x2d59f3=moment()['unix']()[_0xd723('0x57')]();var _0x5c8a2c=path[_0xd723('0x58')](config[_0xd723('0x59')],_0xd723('0x5a'),_0xd723('0x5b'),_0xd723('0x5c'));var _0x53ad09=path[_0xd723('0x58')](config[_0xd723('0x59')],'server',_0xd723('0x5b'),_0xd723('0x5d'));var _0x5dcaa5=path[_0xd723('0x58')](_0x5c8a2c,_0x2d59f3);var _0x2a1628=util[_0xd723('0x49')](_0xd723('0x5e'),_0x3414a9[_0xd723('0x2f')]['id'],_0x2d59f3);var _0x3ef0b6=path['join'](_0x5c8a2c,_0x2a1628);var _0x5509fe=[];if(_0x3414a9[_0xd723('0x2c')][_0xd723('0x5d')]){_0x5509fe[_0xd723('0x5f')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x4800cd=[{'model':db['MailMessage'],'as':_0xd723('0x60'),'attributes':['id',_0xd723('0x3c'),_0xd723('0x61'),'to','cc',_0xd723('0x62'),_0xd723('0x63'),_0xd723('0x64')],'where':{'secret':![]},'order':qs[_0xd723('0x45')]('id'),'include':_0x5509fe}];return db[_0xd723('0x25')]['find']({'where':{'id':_0x3414a9['params']['id']},'include':_0x4800cd})[_0xd723('0x1f')](handleEntityNotFound(_0x111fb1,null))[_0xd723('0x1f')](function(_0x17b318){if(_0x17b318&&_0x17b318[_0xd723('0x60')]){var _0x4d5575=_0x17b318[_0xd723('0x65')]({'plain':!![]});fs[_0xd723('0x66')](_0x5dcaa5);return BPromise[_0xd723('0x67')](_0x4d5575[_0xd723('0x60')],function(_0x2c8069,_0x4c01b8){var _0x242ac7={'from':_0x2c8069[_0xd723('0x61')],'to':_0x2c8069['to']||_0xd723('0x68'),'subject':_0x2c8069[_0xd723('0x63')],'html':htmlEntities['decode'](_0x2c8069[_0xd723('0x3c')]),'headers':{'Date':moment(_0x2c8069[_0xd723('0x64')])[_0xd723('0x49')](_0xd723('0x69'))},'attachments':[]};if(_0x2c8069['cc']){_0x242ac7[_0xd723('0x6a')]['Cc']=_0x2c8069['cc'];}if(_0x2c8069[_0xd723('0x62')]){_0x242ac7['headers'][_0xd723('0x6b')]=_0x2c8069[_0xd723('0x62')];}return new BPromise(function(_0x405ef8,_0x30613a){if(_0x2c8069['Attachments']){for(var _0x379a57=0x0;_0x379a57<_0x2c8069['Attachments'][_0xd723('0x36')];_0x379a57++){var _0x34a92f=_0x2c8069[_0xd723('0x6c')][_0x379a57];var _0x1c975a=path[_0xd723('0x58')](_0x53ad09,_0x34a92f['basename']);if(fs[_0xd723('0x6d')](_0x1c975a)){_0x242ac7[_0xd723('0x5d')][_0xd723('0x5f')]({'name':_0x34a92f[_0xd723('0x22')],'contentType':_0x34a92f[_0xd723('0x28')],'data':fs[_0xd723('0x6e')](_0x1c975a)});}}}emlformat[_0xd723('0x6f')](_0x242ac7,function(_0x329255,_0x28776e){if(_0x329255)return _0x30613a(_0x329255);fs['writeFileSync'](path['join'](_0x5dcaa5,util['format']('message%d.eml',_0x4c01b8)),_0x28776e);return _0x405ef8(_0x28776e);});});})[_0xd723('0x1f')](function(){return new BPromise(function(_0x2776f0,_0x1f47cd){zipdir(_0x5dcaa5,{'saveTo':_0x3ef0b6},function(_0x533c19,_0x3fefa3){if(_0x533c19)return _0x1f47cd(_0x533c19);return _0x2776f0(_0x3fefa3);});})['then'](function(){return new BPromise(function(_0x3de7a7,_0x26c5a9){rimraf(_0x5dcaa5,function(_0x195ba0){if(_0x195ba0)_0x26c5a9(_0x195ba0);return _0x3de7a7();});});})[_0xd723('0x1f')](function(){return _0x111fb1[_0xd723('0x56')](_0x3ef0b6,_0x2a1628,function(_0x5c42dc){if(!_0x5c42dc)fs[_0xd723('0x70')](_0x3ef0b6);});});});}else{return _0x111fb1[_0xd723('0x13')](0xc8);}})['catch'](handleError(_0x111fb1,null));}; \ No newline at end of file +var _0xbea2=['YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','addTags','setTags','omit','spread','Tag','color','mailInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','join','root','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','from','bcc','subject','createdAt','mkdirSync','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','findAll','mail','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','include','options','find','create','body','update','destroy','describe','addMessage','MailMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','merge','$gte'];(function(_0x54ff57,_0x28e122){var _0x5d0320=function(_0x2257c7){while(--_0x2257c7){_0x54ff57['push'](_0x54ff57['shift']());}};_0x5d0320(++_0x28e122);}(_0xbea2,0x192));var _0x2bea=function(_0x3209a5,_0x5b1ae5){_0x3209a5=_0x3209a5-0x0;var _0x3094b0=_0xbea2[_0x3209a5];return _0x3094b0;};'use strict';var emlformat=require(_0x2bea('0x0'));var rimraf=require(_0x2bea('0x1'));var zipdir=require(_0x2bea('0x2'));var moment=require(_0x2bea('0x3'));var BPromise=require(_0x2bea('0x4'));var util=require(_0x2bea('0x5'));var path=require('path');var fs=require('fs');var _=require(_0x2bea('0x6'));var juice=require('juice');var Redis=require(_0x2bea('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x2bea('0x8'));var logger=require(_0x2bea('0x9'))(_0x2bea('0xa'));var config=require(_0x2bea('0xb'));var db=require(_0x2bea('0xc'))['db'];var htmlEntities=require('html-entities');config[_0x2bea('0xd')]=_[_0x2bea('0xe')](config[_0x2bea('0xd')],{'host':_0x2bea('0xf'),'port':0x18eb});var socket=require(_0x2bea('0x10'))(new Redis(config['redis']));require(_0x2bea('0x11'))[_0x2bea('0x12')](socket);function respondWithStatusCode(_0x9a8987,_0x3ed4cc){_0x3ed4cc=_0x3ed4cc||0xcc;return function(_0xf86405){if(_0xf86405){return _0x9a8987[_0x2bea('0x13')](_0x3ed4cc);}return _0x9a8987[_0x2bea('0x14')](_0x3ed4cc)[_0x2bea('0x15')]();};}function respondWithResult(_0xf08dc2,_0x413893){_0x413893=_0x413893||0xc8;return function(_0x4167ce){if(_0x4167ce){return _0xf08dc2['status'](_0x413893)[_0x2bea('0x16')](_0x4167ce);}};}function respondWithFilteredResult(_0x23a2cb,_0x247dea){return function(_0x509852){if(_0x509852){var _0x151ad9=typeof _0x247dea[_0x2bea('0x17')]===_0x2bea('0x18')&&typeof _0x247dea[_0x2bea('0x19')]===_0x2bea('0x18');var _0x1c7ff0=_0x509852['count'];var _0x507abb=_0x151ad9?0x0:_0x247dea['offset'];var _0x5100d6=_0x151ad9?_0x509852[_0x2bea('0x1a')]:_0x247dea['offset']+_0x247dea['limit'];var _0x2586bb;if(_0x5100d6>=_0x1c7ff0){_0x5100d6=_0x1c7ff0;_0x2586bb=0xc8;}else{_0x2586bb=0xce;}_0x23a2cb[_0x2bea('0x14')](_0x2586bb);return _0x23a2cb[_0x2bea('0x1b')](_0x2bea('0x1c'),_0x507abb+'-'+_0x5100d6+'/'+_0x1c7ff0)[_0x2bea('0x16')](_0x509852);}return null;};}function saveUpdates(_0x2a6fe5){return function(_0x30f7a6){if(_0x30f7a6){return _0x30f7a6['update'](_0x2a6fe5)[_0x2bea('0x1d')](function(_0x56e060){return _0x56e060;});}return null;};}function removeEntity(_0x54744a){return function(_0x1986f8){if(_0x1986f8){return _0x1986f8['destroy']()[_0x2bea('0x1d')](function(){_0x54744a[_0x2bea('0x14')](0xcc)[_0x2bea('0x15')]();});}};}function handleEntityNotFound(_0x362aef){return function(_0xd9685f){if(!_0xd9685f){_0x362aef[_0x2bea('0x13')](0x194);}return _0xd9685f;};}function handleError(_0x5e9b0a,_0x105cf3){_0x105cf3=_0x105cf3||0x1f4;return function(_0x4aa539){logger[_0x2bea('0x1e')](_0x4aa539[_0x2bea('0x1f')]);if(_0x4aa539['name']){delete _0x4aa539[_0x2bea('0x20')];}_0x5e9b0a[_0x2bea('0x14')](_0x105cf3)[_0x2bea('0x21')](_0x4aa539);};}exports[_0x2bea('0x22')]=function(_0x3727e4,_0x4ef281){var _0x12ea30={};var _0x138102=_[_0x2bea('0x23')](db[_0x2bea('0x24')][_0x2bea('0x25')],function(_0x366d6d){return{'name':_0x366d6d[_0x2bea('0x26')],'type':_0x366d6d[_0x2bea('0x27')][_0x2bea('0x28')]};});_0x12ea30=qs['getOptions'](_0x138102,_0x3727e4);return interaction[_0x2bea('0x29')](_0x2bea('0x2a'),_0x3727e4[_0x2bea('0x2b')],_0x3727e4[_0x2bea('0x2c')],_0x12ea30,_0x138102)[_0x2bea('0x1d')](respondWithFilteredResult(_0x4ef281,_0x12ea30))[_0x2bea('0x2d')](handleError(_0x4ef281,null));};exports[_0x2bea('0x2e')]=function(_0x165907,_0x9baf94){var _0x5534a5={'raw':![],'where':{'id':_0x165907[_0x2bea('0x2f')]['id']}},_0x3b2b6f={};_0x3b2b6f[_0x2bea('0x30')]=_['keys'](db[_0x2bea('0x24')][_0x2bea('0x25')]);_0x3b2b6f[_0x2bea('0x2b')]=_[_0x2bea('0x31')](_0x165907[_0x2bea('0x2b')]);_0x3b2b6f[_0x2bea('0x32')]=_[_0x2bea('0x33')](_0x3b2b6f[_0x2bea('0x30')],_0x3b2b6f[_0x2bea('0x2b')]);_0x5534a5[_0x2bea('0x34')]=_['intersection'](_0x3b2b6f[_0x2bea('0x30')],qs[_0x2bea('0x35')](_0x165907[_0x2bea('0x2b')][_0x2bea('0x35')]));_0x5534a5[_0x2bea('0x34')]=_0x5534a5[_0x2bea('0x34')][_0x2bea('0x36')]?_0x5534a5[_0x2bea('0x34')]:_0x3b2b6f['model'];if(_0x165907[_0x2bea('0x2b')]['includeAll']){_0x5534a5[_0x2bea('0x37')]=[{'all':!![]}];}_0x5534a5=_['merge']({},_0x5534a5,_0x165907[_0x2bea('0x38')]);return db[_0x2bea('0x24')][_0x2bea('0x39')](_0x5534a5)[_0x2bea('0x1d')](handleEntityNotFound(_0x9baf94,null))[_0x2bea('0x1d')](respondWithResult(_0x9baf94,null))[_0x2bea('0x2d')](handleError(_0x9baf94,null));};exports['create']=function(_0x3c04cc,_0x582eda){return db['MailInteraction'][_0x2bea('0x3a')](_0x3c04cc[_0x2bea('0x3b')],{})[_0x2bea('0x1d')](respondWithResult(_0x582eda,0xc9))[_0x2bea('0x2d')](handleError(_0x582eda,null));};exports[_0x2bea('0x3c')]=function(_0x4b81d5,_0x4ff244){if(_0x4b81d5[_0x2bea('0x3b')]['id']){delete _0x4b81d5[_0x2bea('0x3b')]['id'];}return db[_0x2bea('0x24')][_0x2bea('0x39')]({'where':{'id':_0x4b81d5[_0x2bea('0x2f')]['id']}})[_0x2bea('0x1d')](handleEntityNotFound(_0x4ff244,null))[_0x2bea('0x1d')](saveUpdates(_0x4b81d5[_0x2bea('0x3b')],null))[_0x2bea('0x1d')](respondWithResult(_0x4ff244,null))[_0x2bea('0x2d')](handleError(_0x4ff244,null));};exports[_0x2bea('0x3d')]=function(_0x1d2707,_0x305c95){return db[_0x2bea('0x24')][_0x2bea('0x39')]({'where':{'id':_0x1d2707[_0x2bea('0x2f')]['id']}})['then'](handleEntityNotFound(_0x305c95,null))[_0x2bea('0x1d')](removeEntity(_0x305c95,null))[_0x2bea('0x2d')](handleError(_0x305c95,null));};exports[_0x2bea('0x3e')]=function(_0x165f40,_0x5c2849){return db[_0x2bea('0x24')]['describe']()['then'](respondWithResult(_0x5c2849,null))['catch'](handleError(_0x5c2849,null));};exports[_0x2bea('0x3f')]=function(_0x3dac4d,_0x2b75d4){return db[_0x2bea('0x40')][_0x2bea('0x39')]({'where':{'id':_0x3dac4d[_0x2bea('0x2f')]['id']}})[_0x2bea('0x1d')](handleEntityNotFound(_0x2b75d4,null))[_0x2bea('0x1d')](function(_0x5e6184){if(_0x5e6184){return _0x5e6184['addMessage'](_0x3dac4d[_0x2bea('0x3b')][_0x2bea('0x41')],_['omit'](_0x3dac4d[_0x2bea('0x3b')],['ids','id'])||{});}})[_0x2bea('0x1d')](respondWithResult(_0x2b75d4,null))[_0x2bea('0x2d')](handleError(_0x2b75d4,null));};exports[_0x2bea('0x42')]=function(_0x1b1433,_0x1d3c3b){var _0x14cf0c={'raw':![],'where':{}};var _0x3abd0b={};var _0x474bea={'count':0x0,'rows':[]};return db[_0x2bea('0x24')][_0x2bea('0x43')]({'where':{'id':_0x1b1433[_0x2bea('0x2f')]['id']}})['then'](handleEntityNotFound(_0x1d3c3b,null))[_0x2bea('0x1d')](function(_0x20238a){if(_0x20238a){_0x3abd0b[_0x2bea('0x30')]=_[_0x2bea('0x31')](db['MailMessage']['rawAttributes']);_0x3abd0b['query']=_[_0x2bea('0x31')](_0x1b1433[_0x2bea('0x2b')]);_0x3abd0b[_0x2bea('0x32')]=_[_0x2bea('0x33')](_0x3abd0b[_0x2bea('0x30')],_0x3abd0b[_0x2bea('0x2b')]);_0x14cf0c['attributes']=_[_0x2bea('0x33')](_0x3abd0b[_0x2bea('0x30')],qs['fields'](_0x1b1433['query']['fields']));_0x14cf0c[_0x2bea('0x34')]=_0x14cf0c[_0x2bea('0x34')][_0x2bea('0x36')]?_0x14cf0c['attributes']:_0x3abd0b[_0x2bea('0x30')];if(!_0x1b1433[_0x2bea('0x2b')][_0x2bea('0x44')](_0x2bea('0x45'))){_0x14cf0c[_0x2bea('0x19')]=qs[_0x2bea('0x19')](_0x1b1433['query']['limit']);_0x14cf0c['offset']=qs[_0x2bea('0x17')](_0x1b1433[_0x2bea('0x2b')][_0x2bea('0x17')]);}_0x14cf0c[_0x2bea('0x46')]=qs[_0x2bea('0x47')](_0x1b1433['query'][_0x2bea('0x47')]);_0x14cf0c[_0x2bea('0x48')]=qs[_0x2bea('0x32')](_[_0x2bea('0x49')](_0x1b1433[_0x2bea('0x2b')],_0x3abd0b['filters']));_0x14cf0c[_0x2bea('0x48')][_0x2bea('0x4a')]=_0x20238a['id'];if(_0x1b1433[_0x2bea('0x2b')][_0x2bea('0x4b')]){_0x14cf0c['where']=_[_0x2bea('0x4c')](_0x14cf0c[_0x2bea('0x48')],{'$or':_[_0x2bea('0x23')](_0x14cf0c['attributes'],function(_0x997393){var _0xfaa950={};_0xfaa950[_0x997393]={'$like':'%'+_0x1b1433[_0x2bea('0x2b')][_0x2bea('0x4b')]+'%'};return _0xfaa950;})});}if(_0x1b1433[_0x2bea('0x2b')][_0x2bea('0x4d')]){var _0x531eb2=_0x1b1433[_0x2bea('0x2b')][_0x2bea('0x4d')]['split'](',');var _0x2fd51c={};_0x2fd51c[_0x531eb2[0x0]]={'$gte':moment(_0x531eb2[0x1])['format'](_0x2bea('0x4e'))};_0x14cf0c['where']=_[_0x2bea('0x4c')](_0x14cf0c[_0x2bea('0x48')],_0x2fd51c);}_0x14cf0c=_[_0x2bea('0x4c')]({},_0x14cf0c,_0x1b1433[_0x2bea('0x38')]);return db[_0x2bea('0x40')][_0x2bea('0x1a')]({'where':_0x14cf0c[_0x2bea('0x48')]})[_0x2bea('0x1d')](function(_0x136219){_0x474bea['count']=_0x136219;if(_0x1b1433[_0x2bea('0x2b')]['includeAll']){_0x14cf0c[_0x2bea('0x37')]=[{'all':!![]}];}return db[_0x2bea('0x40')][_0x2bea('0x29')](_0x14cf0c);})['then'](function(_0x5711ac){if(_0x1b1433[_0x2bea('0x2b')][_0x2bea('0x4f')]===_0x2bea('0x50')){for(var _0x2db2df=0x0;_0x2db2df<_0x5711ac[_0x2bea('0x36')];_0x2db2df++){_0x5711ac[_0x2db2df][_0x2bea('0x3b')]=juice(_0x5711ac[_0x2db2df][_0x2bea('0x3b')]);}}_0x474bea[_0x2bea('0x51')]=_0x5711ac;return _0x474bea;});}})[_0x2bea('0x1d')](respondWithFilteredResult(_0x1d3c3b,_0x14cf0c))[_0x2bea('0x2d')](handleError(_0x1d3c3b,null));};exports[_0x2bea('0x52')]=function(_0x552cbb,_0xe88240){return db[_0x2bea('0x24')][_0x2bea('0x39')]({'where':{'id':_0x552cbb[_0x2bea('0x2f')]['id']}})['then'](handleEntityNotFound(_0xe88240,null))['then'](function(_0x3dba28){if(_0x3dba28){return _0x3dba28[_0x2bea('0x53')](_0x552cbb['body']['ids'],_[_0x2bea('0x54')](_0x552cbb[_0x2bea('0x3b')],[_0x2bea('0x41'),'id'])||{})[_0x2bea('0x55')](function(){return db[_0x2bea('0x56')][_0x2bea('0x29')]({'attributes':['id',_0x2bea('0x20'),_0x2bea('0x57')],'where':{'id':_0x552cbb[_0x2bea('0x3b')][_0x2bea('0x41')]}});})[_0x2bea('0x1d')](function(_0xc2078a){socket['emit'](_0x2bea('0x58'),{'id':Number(_0x552cbb[_0x2bea('0x2f')]['id']),'tags':_0xc2078a||[]});return{'id':Number(_0x552cbb[_0x2bea('0x2f')]['id']),'tags':_0xc2078a||[]};});}})['then'](respondWithResult(_0xe88240,null))[_0x2bea('0x2d')](handleError(_0xe88240,null));};exports[_0x2bea('0x59')]=function(_0x5caff9,_0x4ec227){return db[_0x2bea('0x24')][_0x2bea('0x39')]({'where':{'id':_0x5caff9[_0x2bea('0x2f')]['id']}})[_0x2bea('0x1d')](handleEntityNotFound(_0x4ec227,null))[_0x2bea('0x1d')](function(_0xd79885){if(_0xd79885){return _0xd79885[_0x2bea('0x59')](_0x5caff9[_0x2bea('0x2b')][_0x2bea('0x41')]);}})['then'](respondWithStatusCode(_0x4ec227,null))[_0x2bea('0x2d')](handleError(_0x4ec227,null));};exports[_0x2bea('0x5a')]=function(_0x3fbcac,_0x2d44f6){var _0x1620b4=moment()[_0x2bea('0x5b')]()[_0x2bea('0x5c')]();var _0x1ec03a=path['join'](config['root'],_0x2bea('0x5d'),_0x2bea('0x5e'),_0x2bea('0x5f'));var _0x4ffa0d=path[_0x2bea('0x60')](config[_0x2bea('0x61')],_0x2bea('0x5d'),_0x2bea('0x5e'),_0x2bea('0x62'));var _0x33f508=path[_0x2bea('0x60')](_0x1ec03a,_0x1620b4);var _0x1bed10=util[_0x2bea('0x63')](_0x2bea('0x64'),_0x3fbcac[_0x2bea('0x2f')]['id'],_0x1620b4);var _0x10a5cf=path[_0x2bea('0x60')](_0x1ec03a,_0x1bed10);var _0x59fe0a=[];if(_0x3fbcac['query']['attachments']){_0x59fe0a[_0x2bea('0x65')]({'model':db[_0x2bea('0x66')],'as':'Attachments','raw':!![]});}var _0x244327=[{'model':db[_0x2bea('0x40')],'as':_0x2bea('0x67'),'attributes':['id',_0x2bea('0x3b'),_0x2bea('0x68'),'to','cc',_0x2bea('0x69'),_0x2bea('0x6a'),_0x2bea('0x6b')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x59fe0a}];return db[_0x2bea('0x24')][_0x2bea('0x39')]({'where':{'id':_0x3fbcac[_0x2bea('0x2f')]['id']},'include':_0x244327})['then'](handleEntityNotFound(_0x2d44f6,null))[_0x2bea('0x1d')](function(_0x3477b9){if(_0x3477b9&&_0x3477b9[_0x2bea('0x67')]){var _0x1ef2d5=_0x3477b9['get']({'plain':!![]});fs[_0x2bea('0x6c')](_0x33f508);return BPromise['each'](_0x1ef2d5[_0x2bea('0x67')],function(_0xa00535,_0x1b0658){var _0x28d6d7={'from':_0xa00535[_0x2bea('0x68')],'to':_0xa00535['to']||_0x2bea('0x6d'),'subject':_0xa00535['subject'],'html':htmlEntities[_0x2bea('0x6e')](_0xa00535[_0x2bea('0x3b')]),'headers':{'Date':moment(_0xa00535['createdAt'])['format'](_0x2bea('0x6f'))},'attachments':[]};if(_0xa00535['cc']){_0x28d6d7['headers']['Cc']=_0xa00535['cc'];}if(_0xa00535[_0x2bea('0x69')]){_0x28d6d7[_0x2bea('0x70')][_0x2bea('0x71')]=_0xa00535[_0x2bea('0x69')];}return new BPromise(function(_0x1e81e1,_0x36f327){if(_0xa00535[_0x2bea('0x72')]){for(var _0x2534ba=0x0;_0x2534ba<_0xa00535[_0x2bea('0x72')][_0x2bea('0x36')];_0x2534ba++){var _0x33be58=_0xa00535['Attachments'][_0x2534ba];var _0x180d24=path[_0x2bea('0x60')](_0x4ffa0d,_0x33be58[_0x2bea('0x73')]);if(fs[_0x2bea('0x74')](_0x180d24)){_0x28d6d7[_0x2bea('0x62')]['push']({'name':_0x33be58['name'],'contentType':_0x33be58[_0x2bea('0x27')],'data':fs[_0x2bea('0x75')](_0x180d24)});}}}emlformat[_0x2bea('0x76')](_0x28d6d7,function(_0x346c56,_0x318c0b){if(_0x346c56)return _0x36f327(_0x346c56);fs['writeFileSync'](path['join'](_0x33f508,util[_0x2bea('0x63')]('message%d.eml',_0x1b0658)),_0x318c0b);return _0x1e81e1(_0x318c0b);});});})[_0x2bea('0x1d')](function(){return new BPromise(function(_0x43cf1e,_0x20971b){zipdir(_0x33f508,{'saveTo':_0x10a5cf},function(_0xb0e269,_0x2e0452){if(_0xb0e269)return _0x20971b(_0xb0e269);return _0x43cf1e(_0x2e0452);});})[_0x2bea('0x1d')](function(){return new BPromise(function(_0x5b627f,_0x5b3e98){rimraf(_0x33f508,function(_0x19c26b){if(_0x19c26b)_0x5b3e98(_0x19c26b);return _0x5b627f();});});})[_0x2bea('0x1d')](function(){return _0x2d44f6[_0x2bea('0x5a')](_0x10a5cf,_0x1bed10,function(_0x3a2d1b){if(!_0x3a2d1b)fs[_0x2bea('0x77')](_0x10a5cf);});});});}else{return _0x2d44f6[_0x2bea('0x13')](0xc8);}})['catch'](handleError(_0x2d44f6,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index e085a39..c728823 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 _0x9714=['getUsers','then','setDataValue','map','emit','hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners','update'];(function(_0x13992d,_0x3029ea){var _0x3d15bf=function(_0x3444f7){while(--_0x3444f7){_0x13992d['push'](_0x13992d['shift']());}};_0x3d15bf(++_0x3029ea);}(_0x9714,0x11b));var _0x4971=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0x9714[_0x2d9c6a];return _0xf3c918;};'use strict';var EventEmitter=require(_0x4971('0x0'));var MailInteraction=require(_0x4971('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x4971('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x4971('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4971('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e2d96){return function(_0x572d83,_0xeec5bc,_0x5bbff9){_0x572d83[_0x4971('0x5')]({'attributes':['id'],'raw':!![]})[_0x4971('0x6')](function(_0x12ae09){_0x572d83[_0x4971('0x7')]('Users',_0x12ae09[_0x4971('0x8')](function(_0x2528e2){return{'id':_0x2528e2['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x572d83['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4c16ba){_0x572d83['setDataValue']('unreadMessages',_0x4c16ba['length']);MailInteractionEvents['emit'](_0x3e2d96+':'+_0x572d83['id'],_0x572d83);MailInteractionEvents[_0x4971('0x9')](_0x3e2d96,_0x572d83);_0x5bbff9(null);})['catch'](_0x5bbff9(null));};}for(var e in events){if(events[_0x4971('0xa')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x4971('0xb')]=MailInteractionEvents; \ No newline at end of file +var _0x228f=['../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','then','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0x228f,0x10e));var _0xf228=function(_0x5d08ad,_0x138f5a){_0x5d08ad=_0x5d08ad-0x0;var _0x1894b3=_0x228f[_0x5d08ad];return _0x1894b3;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xf228('0x0'))['db'][_0xf228('0x1')];var MailMessage=require(_0xf228('0x0'))['db'][_0xf228('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf228('0x3')](0x0);var events={'afterCreate':_0xf228('0x4'),'afterUpdate':_0xf228('0x5'),'afterDestroy':_0xf228('0x6')};function emitEvent(_0x2360ca){return function(_0x14de22,_0x975cbb,_0x19adf6){_0x14de22[_0xf228('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x148921){_0x14de22[_0xf228('0x8')](_0xf228('0x9'),_0x148921[_0xf228('0xa')](function(_0x41c365){return{'id':_0x41c365['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x14de22['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf228('0xb')](function(_0x2fecb3){_0x14de22[_0xf228('0x8')](_0xf228('0xc'),_0x2fecb3[_0xf228('0xd')]);MailInteractionEvents[_0xf228('0xe')](_0x2360ca+':'+_0x14de22['id'],_0x14de22);MailInteractionEvents[_0xf228('0xe')](_0x2360ca,_0x14de22);_0x19adf6(null);})[_0xf228('0xf')](_0x19adf6(null));};}for(var e in events){if(events[_0xf228('0x10')](e)){var event=events[e];MailInteraction[_0xf228('0x11')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index e57cabe..fa27b4b 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 _0x3bb4=['substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT'];(function(_0x24a234,_0x504c09){var _0xbc39b8=function(_0x1a5566){while(--_0x1a5566){_0x24a234['push'](_0x24a234['shift']());}};_0xbc39b8(++_0x504c09);}(_0x3bb4,0x8b));var _0x43bb=function(_0x2628b0,_0xa51fc9){_0x2628b0=_0x2628b0-0x0;var _0x44c69a=_0x3bb4[_0x2628b0];return _0x44c69a;};'use strict';var _=require(_0x43bb('0x0'));var util=require('util');var logger=require(_0x43bb('0x1'))(_0x43bb('0x2'));var moment=require(_0x43bb('0x3'));var BPromise=require(_0x43bb('0x4'));var rp=require(_0x43bb('0x5'));var fs=require('fs');var path=require(_0x43bb('0x6'));var rimraf=require(_0x43bb('0x7'));var config=require(_0x43bb('0x8'));var attributes=require(_0x43bb('0x9'));module[_0x43bb('0xa')]=function(_0x586700,_0x83e6d6){return _0x586700['define'](_0x43bb('0xb'),attributes,{'tableName':_0x43bb('0xc'),'paranoid':![],'indexes':[{'name':_0x43bb('0xd'),'fields':[_0x43bb('0xe'),'to'],'type':_0x43bb('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x18661c,_0x365570,_0x5912b4){if(_0x18661c[_0x43bb('0x10')]){_0x18661c[_0x43bb('0x11')]=moment()[_0x43bb('0x12')](_0x43bb('0x13'));}if(_0x18661c[_0x43bb('0x14')]){_0x18661c[_0x43bb('0x15')]=moment()[_0x43bb('0x12')](_0x43bb('0x13'));}_0x5912b4(null,_0x365570);},'beforeUpdate':function(_0x156df9,_0x4cecb5,_0x139ce8){if(_0x156df9[_0x43bb('0x16')]('substatus')){_0x156df9[_0x43bb('0x11')]=_0x156df9[_0x43bb('0x10')]?moment()[_0x43bb('0x12')](_0x43bb('0x13')):null;}if(_0x156df9[_0x43bb('0x16')]('closed')){_0x156df9['closedAt']=moment()[_0x43bb('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x156df9[_0x43bb('0x10')]=null;_0x156df9['substatusAt']=null;}_0x139ce8(null,_0x156df9);},'afterUpdate':function(_0x4811c6,_0xa48103,_0x27ed8d){var _0x1a3436=_0x586700[_0x43bb('0x17')];var _0x2ec0f2=_0x4811c6[_0x43bb('0x18')]({'plain':!![]});if(_0x2ec0f2[_0x43bb('0x14')]){return _0x1a3436[_0x43bb('0x19')][_0x43bb('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x2ec0f2['id']}})[_0x43bb('0x1b')](function(){_0x27ed8d();})[_0x43bb('0x1c')](function(_0x58009c){_0x27ed8d(_0x58009c);});}else{_0x27ed8d();}}},'charset':_0x43bb('0x1d'),'collate':_0x43bb('0x1e')});}; \ No newline at end of file +var _0xa469=['api','moment','bluebird','request-promise','path','rimraf','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x4e0bfc,_0x4cb5cc){var _0x5082fe=function(_0x194c23){while(--_0x194c23){_0x4e0bfc['push'](_0x4e0bfc['shift']());}};_0x5082fe(++_0x4cb5cc);}(_0xa469,0xbc));var _0x9a46=function(_0x2d47f7,_0x490049){_0x2d47f7=_0x2d47f7-0x0;var _0x447a26=_0xa469[_0x2d47f7];return _0x447a26;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9a46('0x0'))(_0x9a46('0x1'));var moment=require(_0x9a46('0x2'));var BPromise=require(_0x9a46('0x3'));var rp=require(_0x9a46('0x4'));var fs=require('fs');var path=require(_0x9a46('0x5'));var rimraf=require(_0x9a46('0x6'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x232de2,_0x3b6961){return _0x232de2[_0x9a46('0x7')]('MailInteraction',attributes,{'tableName':_0x9a46('0x8'),'paranoid':![],'indexes':[{'name':_0x9a46('0x9'),'fields':[_0x9a46('0xa'),'to'],'type':_0x9a46('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5d4d69,_0x342511,_0x1ebcda){if(_0x5d4d69[_0x9a46('0xc')]){_0x5d4d69[_0x9a46('0xd')]=moment()[_0x9a46('0xe')](_0x9a46('0xf'));}if(_0x5d4d69[_0x9a46('0x10')]){_0x5d4d69[_0x9a46('0x11')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1ebcda(null,_0x342511);},'beforeUpdate':function(_0x4e4049,_0x33e1bf,_0x554d36){if(_0x4e4049[_0x9a46('0x12')](_0x9a46('0xc'))){_0x4e4049[_0x9a46('0xd')]=_0x4e4049['substatus']?moment()[_0x9a46('0xe')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x4e4049['changed']('closed')){_0x4e4049[_0x9a46('0x11')]=moment()[_0x9a46('0xe')](_0x9a46('0xf'));_0x4e4049[_0x9a46('0xc')]=null;_0x4e4049[_0x9a46('0xd')]=null;}_0x554d36(null,_0x4e4049);},'afterUpdate':function(_0x51ece9,_0x142d2a,_0x3807d8){var _0x1b49c7=_0x232de2[_0x9a46('0x13')];var _0x36cf3e=_0x51ece9[_0x9a46('0x14')]({'plain':!![]});if(_0x36cf3e[_0x9a46('0x10')]){return _0x1b49c7[_0x9a46('0x15')][_0x9a46('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x36cf3e['id']}})[_0x9a46('0x17')](function(){_0x3807d8();})[_0x9a46('0x18')](function(_0xce7687){_0x3807d8(_0xce7687);});}else{_0x3807d8();}}},'charset':_0x9a46('0x19'),'collate':_0x9a46('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 4257fa3..56eb7a5 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 _0xbc37=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','limit','debug','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis'];(function(_0x15a9cb,_0x2c5d45){var _0x4036e4=function(_0x4a97cf){while(--_0x4a97cf){_0x15a9cb['push'](_0x15a9cb['shift']());}};_0x4036e4(++_0x2c5d45);}(_0xbc37,0x11a));var _0x7bc3=function(_0x1e2b3b,_0x5e76b3){_0x1e2b3b=_0x1e2b3b-0x0;var _0x15e047=_0xbc37[_0x1e2b3b];return _0x15e047;};'use strict';var _=require(_0x7bc3('0x0'));var util=require(_0x7bc3('0x1'));var moment=require('moment');var BPromise=require(_0x7bc3('0x2'));var rs=require(_0x7bc3('0x3'));var fs=require('fs');var Redis=require(_0x7bc3('0x4'));var db=require(_0x7bc3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7bc3('0x6'))(_0x7bc3('0x7'));var config=require(_0x7bc3('0x8'));var jayson=require(_0x7bc3('0x9'));var client=jayson['client'][_0x7bc3('0xa')]({'port':0x232a});config['redis']=_[_0x7bc3('0xb')](config[_0x7bc3('0xc')],{'host':_0x7bc3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7bc3('0xc')]));require(_0x7bc3('0xe'))[_0x7bc3('0xf')](socket);function respondWithRpcPromise(_0x399883,_0x5bc8cd,_0x508dc0){return new BPromise(function(_0xf68a4,_0x1f4b40){return client[_0x7bc3('0x10')](_0x399883,_0x508dc0)[_0x7bc3('0x11')](function(_0x20c4a3){logger[_0x7bc3('0x12')](_0x7bc3('0x13'),_0x5bc8cd,'request\x20sent');logger['debug'](_0x7bc3('0x14'),_0x5bc8cd,_0x7bc3('0x15'),JSON[_0x7bc3('0x16')](_0x20c4a3));if(_0x20c4a3[_0x7bc3('0x17')]){if(_0x20c4a3[_0x7bc3('0x17')]['code']===0x1f4){logger[_0x7bc3('0x17')](_0x7bc3('0x13'),_0x5bc8cd,_0x20c4a3[_0x7bc3('0x17')][_0x7bc3('0x18')]);return _0x1f4b40(_0x20c4a3[_0x7bc3('0x17')][_0x7bc3('0x18')]);}logger['error'](_0x7bc3('0x13'),_0x5bc8cd,_0x20c4a3[_0x7bc3('0x17')][_0x7bc3('0x18')]);return _0xf68a4(_0x20c4a3[_0x7bc3('0x17')]['message']);}else{logger[_0x7bc3('0x12')](_0x7bc3('0x13'),_0x5bc8cd,_0x7bc3('0x15'));_0xf68a4(_0x20c4a3['result'][_0x7bc3('0x18')]);}})[_0x7bc3('0x19')](function(_0xf5ebe6){logger[_0x7bc3('0x17')]('MailInteraction,\x20%s,\x20%s',_0x5bc8cd,_0xf5ebe6);_0x1f4b40(_0xf5ebe6);});});}exports[_0x7bc3('0x1a')]=function(_0x7d01eb){var _0x545938=this;return new Promise(function(_0x37ddd7,_0x1aaba7){return db[_0x7bc3('0x1b')][_0x7bc3('0x1c')](_0x7d01eb[_0x7bc3('0x1d')],{'raw':_0x7d01eb[_0x7bc3('0x1e')]?_0x7d01eb['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7d01eb[_0x7bc3('0x1e')]?_0x7d01eb[_0x7bc3('0x1e')][_0x7bc3('0x1f')]||null:null,'attributes':_0x7d01eb[_0x7bc3('0x1e')]?_0x7d01eb[_0x7bc3('0x1e')][_0x7bc3('0x20')]||null:null,'limit':_0x7d01eb[_0x7bc3('0x1e')]?_0x7d01eb['options'][_0x7bc3('0x21')]||null:null})[_0x7bc3('0x11')](function(_0x2d84f6){logger[_0x7bc3('0x12')](_0x7bc3('0x1a'),_0x7d01eb);logger[_0x7bc3('0x22')](_0x7bc3('0x1a'),_0x7d01eb,JSON[_0x7bc3('0x16')](_0x2d84f6));_0x37ddd7(_0x2d84f6);})['catch'](function(_0xa599c3){logger[_0x7bc3('0x17')](_0x7bc3('0x1a'),_0xa599c3[_0x7bc3('0x18')],_0x7d01eb);_0x1aaba7(_0x545938['error'](0x1f4,_0xa599c3[_0x7bc3('0x18')]));});});};exports[_0x7bc3('0x23')]=function(_0x3eb9db){return new Promise(function(_0xd74d45,_0x446f6a){return db[_0x7bc3('0x1b')][_0x7bc3('0x24')]({'where':_0x3eb9db[_0x7bc3('0x1e')]?_0x3eb9db[_0x7bc3('0x1e')][_0x7bc3('0x1f')]||null:null})[_0x7bc3('0x11')](function(_0x2be622){if(_0x2be622){return _0x2be622[_0x7bc3('0x25')](_0x3eb9db['body'][_0x7bc3('0x26')],_['omit'](_0x3eb9db['body'],[_0x7bc3('0x26'),'id'])||{});}})[_0x7bc3('0x27')](function(_0x53f727){logger['info'](_0x7bc3('0x28'),_0x3eb9db);logger[_0x7bc3('0x22')](_0x7bc3('0x28'),_0x3eb9db,JSON[_0x7bc3('0x16')](_0x53f727));_0xd74d45(_0x53f727);})[_0x7bc3('0x19')](function(_0x53f3ab){logger[_0x7bc3('0x17')](_0x7bc3('0x28'),_0x53f3ab[_0x7bc3('0x18')],_0x3eb9db);_0x446f6a(_this['error'](0x1f4,_0x53f3ab[_0x7bc3('0x18')]));});});}; \ No newline at end of file +var _0x5549=['then','debug','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','register','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','limit'];(function(_0x3f463e,_0x2e3be5){var _0x3f44b5=function(_0xffabbe){while(--_0xffabbe){_0x3f463e['push'](_0x3f463e['shift']());}};_0x3f44b5(++_0x2e3be5);}(_0x5549,0x1f4));var _0x9554=function(_0x493f4f,_0x54764a){_0x493f4f=_0x493f4f-0x0;var _0xf425ad=_0x5549[_0x493f4f];return _0xf425ad;};'use strict';var _=require(_0x9554('0x0'));var util=require(_0x9554('0x1'));var moment=require(_0x9554('0x2'));var BPromise=require(_0x9554('0x3'));var rs=require(_0x9554('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9554('0x5'))['db'];var utils=require(_0x9554('0x6'));var logger=require(_0x9554('0x7'))(_0x9554('0x8'));var config=require(_0x9554('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9554('0xa')]['http']({'port':0x232a});config[_0x9554('0xb')]=_[_0x9554('0xc')](config[_0x9554('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9554('0xd'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x9554('0xe')](socket);function respondWithRpcPromise(_0x4d488d,_0x2d5751,_0x32923d){return new BPromise(function(_0x3fee11,_0x1aacd9){return client[_0x9554('0xf')](_0x4d488d,_0x32923d)['then'](function(_0x4adf50){logger[_0x9554('0x10')](_0x9554('0x11'),_0x2d5751,_0x9554('0x12'));logger['debug'](_0x9554('0x13'),_0x2d5751,_0x9554('0x12'),JSON[_0x9554('0x14')](_0x4adf50));if(_0x4adf50['error']){if(_0x4adf50[_0x9554('0x15')][_0x9554('0x16')]===0x1f4){logger['error'](_0x9554('0x11'),_0x2d5751,_0x4adf50[_0x9554('0x15')][_0x9554('0x17')]);return _0x1aacd9(_0x4adf50[_0x9554('0x15')]['message']);}logger[_0x9554('0x15')](_0x9554('0x11'),_0x2d5751,_0x4adf50[_0x9554('0x15')]['message']);return _0x3fee11(_0x4adf50[_0x9554('0x15')]['message']);}else{logger[_0x9554('0x10')](_0x9554('0x11'),_0x2d5751,'request\x20sent');_0x3fee11(_0x4adf50[_0x9554('0x18')][_0x9554('0x17')]);}})[_0x9554('0x19')](function(_0x2b386c){logger[_0x9554('0x15')](_0x9554('0x11'),_0x2d5751,_0x2b386c);_0x1aacd9(_0x2b386c);});});}exports[_0x9554('0x1a')]=function(_0x540285){var _0x526c19=this;return new Promise(function(_0x4221e8,_0x938c91){return db[_0x9554('0x1b')][_0x9554('0x1c')](_0x540285[_0x9554('0x1d')],{'raw':_0x540285[_0x9554('0x1e')]?_0x540285[_0x9554('0x1e')][_0x9554('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x540285['options']?_0x540285[_0x9554('0x1e')]['where']||null:null,'attributes':_0x540285[_0x9554('0x1e')]?_0x540285[_0x9554('0x1e')]['attributes']||null:null,'limit':_0x540285['options']?_0x540285[_0x9554('0x1e')][_0x9554('0x20')]||null:null})[_0x9554('0x21')](function(_0x394350){logger[_0x9554('0x10')](_0x9554('0x1a'),_0x540285);logger[_0x9554('0x22')](_0x9554('0x1a'),_0x540285,JSON[_0x9554('0x14')](_0x394350));_0x4221e8(_0x394350);})[_0x9554('0x19')](function(_0x5e94cd){logger[_0x9554('0x15')](_0x9554('0x1a'),_0x5e94cd[_0x9554('0x17')],_0x540285);_0x938c91(_0x526c19['error'](0x1f4,_0x5e94cd['message']));});});};exports['AddTagsToMailInteraction']=function(_0x4be9fd){return new Promise(function(_0x14ba0b,_0x497c13){return db[_0x9554('0x1b')][_0x9554('0x23')]({'where':_0x4be9fd[_0x9554('0x1e')]?_0x4be9fd[_0x9554('0x1e')]['where']||null:null})[_0x9554('0x21')](function(_0x2acbaf){if(_0x2acbaf){return _0x2acbaf[_0x9554('0x24')](_0x4be9fd[_0x9554('0x1d')][_0x9554('0x25')],_[_0x9554('0x26')](_0x4be9fd['body'],['ids','id'])||{});}})[_0x9554('0x27')](function(_0x38b683){logger[_0x9554('0x10')](_0x9554('0x28'),_0x4be9fd);logger[_0x9554('0x22')](_0x9554('0x28'),_0x4be9fd,JSON[_0x9554('0x14')](_0x38b683));_0x14ba0b(_0x38b683);})[_0x9554('0x19')](function(_0x4abc7b){logger[_0x9554('0x15')](_0x9554('0x28'),_0x4abc7b[_0x9554('0x17')],_0x4be9fd);_0x497c13(_this['error'](0x1f4,_0x4abc7b[_0x9554('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index f0bcf74..0eec2c4 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 _0x0802=['remove','update','removeListener','register','length','./mailInteraction.events','save'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x0802,0x124));var _0x2080=function(_0x2d47d7,_0x54092e){_0x2d47d7=_0x2d47d7-0x0;var _0x146f0b=_0x0802[_0x2d47d7];return _0x146f0b;};'use strict';var MailInteractionEvents=require(_0x2080('0x0'));var events=[_0x2080('0x1'),_0x2080('0x2'),_0x2080('0x3')];function createListener(_0x3f2ef6,_0x225a60){return function(_0x191006){_0x225a60['emit'](_0x3f2ef6,_0x191006);};}function removeListener(_0x415e87,_0x2aa729){return function(){MailInteractionEvents[_0x2080('0x4')](_0x415e87,_0x2aa729);};}exports[_0x2080('0x5')]=function(_0x2fd8ab){for(var _0x26e952=0x0,_0x1c5a84=events[_0x2080('0x6')];_0x26e952<_0x1c5a84;_0x26e952++){var _0x22a286=events[_0x26e952];var _0x4873b4=createListener('mailInteraction:'+_0x22a286,_0x2fd8ab);MailInteractionEvents['on'](_0x22a286,_0x4873b4);}}; \ No newline at end of file +var _0xdf8c=['save','register'];(function(_0x3d6544,_0x42bf34){var _0x4357ca=function(_0x2c92a4){while(--_0x2c92a4){_0x3d6544['push'](_0x3d6544['shift']());}};_0x4357ca(++_0x42bf34);}(_0xdf8c,0xf0));var _0xcdf8=function(_0x3ef5f1,_0x2cf690){_0x3ef5f1=_0x3ef5f1-0x0;var _0x234fa4=_0xdf8c[_0x3ef5f1];return _0x234fa4;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xcdf8('0x0'),'remove','update'];function createListener(_0x3baf4a,_0x3206ec){return function(_0x2baf6d){_0x3206ec['emit'](_0x3baf4a,_0x2baf6d);};}function removeListener(_0xe28473,_0x37c5d2){return function(){MailInteractionEvents['removeListener'](_0xe28473,_0x37c5d2);};}exports[_0xcdf8('0x1')]=function(_0x2be9a3){for(var _0x44ae4c=0x0,_0x2b2303=events['length'];_0x44ae4c<_0x2b2303;_0x44ae4c++){var _0x4af0d4=events[_0x44ae4c];var _0x3b6777=createListener('mailInteraction:'+_0x4af0d4,_0x2be9a3);MailInteractionEvents['on'](_0x4af0d4,_0x3b6777);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 49e610c..6465e9a 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 _0x586b=['../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','post','tracked','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x95975e,_0x51412c){var _0x5d4933=function(_0x1cb2da){while(--_0x1cb2da){_0x95975e['push'](_0x95975e['shift']());}};_0x5d4933(++_0x51412c);}(_0x586b,0x1bb));var _0xb586=function(_0x438f1f,_0x6c1d55){_0x438f1f=_0x438f1f-0x0;var _0x500b58=_0x586b[_0x438f1f];return _0x500b58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb586('0x0'));var timeout=require(_0xb586('0x1'));var express=require(_0xb586('0x2'));var router=express[_0xb586('0x3')]();var fs_extra=require(_0xb586('0x4'));var auth=require(_0xb586('0x5'));var interaction=require(_0xb586('0x6'));var config=require(_0xb586('0x7'));var controller=require('./mailMessage.controller');router['get']('/',auth[_0xb586('0x8')](),controller[_0xb586('0x9')]);router[_0xb586('0xa')](_0xb586('0xb'),auth[_0xb586('0x8')](),controller[_0xb586('0xc')]);router['get'](_0xb586('0xd'),auth[_0xb586('0x8')](),controller[_0xb586('0xe')]);router[_0xb586('0xa')](_0xb586('0xf'),auth[_0xb586('0x8')](),controller[_0xb586('0x10')]);router[_0xb586('0x11')]('/',auth['isAuthenticated'](),interaction[_0xb586('0x12')]('mail',_0xb586('0x13')),controller[_0xb586('0x14')]);router[_0xb586('0x15')]('/:id',auth[_0xb586('0x8')](),controller[_0xb586('0x16')]);router[_0xb586('0x15')](_0xb586('0x17'),auth['isAuthenticated'](),controller[_0xb586('0x18')]);router['put'](_0xb586('0x19'),auth[_0xb586('0x8')](),controller[_0xb586('0x1a')]);router[_0xb586('0x1b')](_0xb586('0xd'),auth[_0xb586('0x8')](),controller[_0xb586('0x1c')]);module[_0xb586('0x1d')]=router; \ No newline at end of file +var _0x78f0=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','post','mail','mailmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy'];(function(_0x392368,_0x1e14a5){var _0x33efe7=function(_0x385d1a){while(--_0x385d1a){_0x392368['push'](_0x392368['shift']());}};_0x33efe7(++_0x1e14a5);}(_0x78f0,0x15d));var _0x078f=function(_0x513b36,_0x55f1c4){_0x513b36=_0x513b36-0x0;var _0x19d8fb=_0x78f0[_0x513b36];return _0x19d8fb;};'use strict';var multer=require(_0x078f('0x0'));var util=require(_0x078f('0x1'));var path=require(_0x078f('0x2'));var timeout=require(_0x078f('0x3'));var express=require(_0x078f('0x4'));var router=express[_0x078f('0x5')]();var fs_extra=require(_0x078f('0x6'));var auth=require(_0x078f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x078f('0x8'));var controller=require(_0x078f('0x9'));router[_0x078f('0xa')]('/',auth[_0x078f('0xb')](),controller['index']);router[_0x078f('0xa')](_0x078f('0xc'),auth['isAuthenticated'](),controller[_0x078f('0xd')]);router[_0x078f('0xa')](_0x078f('0xe'),auth[_0x078f('0xb')](),controller[_0x078f('0xf')]);router[_0x078f('0xa')](_0x078f('0x10'),auth[_0x078f('0xb')](),controller['download']);router[_0x078f('0x11')]('/',auth[_0x078f('0xb')](),interaction['tracked'](_0x078f('0x12'),_0x078f('0x13')),controller[_0x078f('0x14')]);router[_0x078f('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x078f('0x16')]);router[_0x078f('0x15')](_0x078f('0x17'),auth[_0x078f('0xb')](),controller['accept']);router[_0x078f('0x15')](_0x078f('0x18'),auth['isAuthenticated'](),controller[_0x078f('0x19')]);router[_0x078f('0x1a')](_0x078f('0xe'),auth[_0x078f('0xb')](),controller[_0x078f('0x1b')]);module[_0x078f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 1b92d9d..0eec2d9 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 _0xfff1=['lodash','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize'];(function(_0x383494,_0x2070d2){var _0x2485e5=function(_0x37c52e){while(--_0x37c52e){_0x383494['push'](_0x383494['shift']());}};_0x2485e5(++_0x2070d2);}(_0xfff1,0xe9));var _0x1fff=function(_0x3144d7,_0x550484){_0x3144d7=_0x3144d7-0x0;var _0x354237=_0xfff1[_0x3144d7];return _0x354237;};'use strict';var Sequelize=require(_0x1fff('0x0'));var _=require(_0x1fff('0x1'));module['exports']={'body':{'type':Sequelize[_0x1fff('0x2')](_0x1fff('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x1fff('0x4'))},'read':{'type':Sequelize[_0x1fff('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1fff('0x6')]('in',_0x1fff('0x7')),'defaultValue':_0x1fff('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1fff('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x1fff('0x2')](_0x1fff('0x3'))},'cc':{'type':Sequelize[_0x1fff('0x2')](_0x1fff('0x3'))},'bcc':{'type':Sequelize[_0x1fff('0x2')](_0x1fff('0x3'))},'subject':{'type':Sequelize[_0x1fff('0x2')]},'sentAt':{'type':Sequelize[_0x1fff('0x9')]},'attach':{'type':Sequelize[_0x1fff('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x1fff('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x1fff('0x9')]},'originTo':{'type':Sequelize[_0x1fff('0x2')](_0x1fff('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0x1fff('0x3'))},'originChannel':{'type':Sequelize[_0x1fff('0x6')](_0x1fff('0xb'),_0x1fff('0xc')),'defaultValue':_0x1fff('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xf640=['Chat','Email','sequelize','lodash','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER'];(function(_0x1ce779,_0x3a8443){var _0xdc1f81=function(_0x5af0bc){while(--_0x5af0bc){_0x1ce779['push'](_0x1ce779['shift']());}};_0xdc1f81(++_0x3a8443);}(_0xf640,0x16e));var _0x0f64=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf640[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x0f64('0x0'));var _=require(_0x0f64('0x1'));module[_0x0f64('0x2')]={'body':{'type':Sequelize[_0x0f64('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x0f64('0x3')](_0x0f64('0x4'))},'read':{'type':Sequelize[_0x0f64('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0f64('0x6')]('in','out'),'defaultValue':_0x0f64('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x0f64('0x8')]},'to':{'type':Sequelize[_0x0f64('0x3')]('long')},'cc':{'type':Sequelize[_0x0f64('0x3')](_0x0f64('0x9'))},'bcc':{'type':Sequelize[_0x0f64('0x3')](_0x0f64('0x9'))},'subject':{'type':Sequelize[_0x0f64('0x3')]},'sentAt':{'type':Sequelize[_0x0f64('0xa')]},'attach':{'type':Sequelize[_0x0f64('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x0f64('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x0f64('0x3')]('long')},'originCc':{'type':Sequelize[_0x0f64('0x3')](_0x0f64('0x9'))},'originChannel':{'type':Sequelize['ENUM']('Email',_0x0f64('0xc')),'defaultValue':_0x0f64('0xd'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 71d5182..8260ef8 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 _0xdcd7=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','update','body','destroy','describe','direction','secret','split','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','List','create','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','read','UserId','user','get','MailInteraction','MailInteractionId','isNil','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','event','accept','fromString','EventManager','reject','mail','RejectMessage','QueryTypes','internal','motionChannel','download','unix','toString','server','files','message-%s.eml','bcc','subject','Attachments','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','type','build','writeFileSync','eml-format','bluebird','util','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','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','json','offset','limit','undefined','count','status','Content-Range','end','sendStatus','name','send','index','MailMessage','rawAttributes','fieldName','model','map','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters'];(function(_0x4d1f7f,_0x3c69e2){var _0xa7967b=function(_0x31c9f5){while(--_0x31c9f5){_0x4d1f7f['push'](_0x4d1f7f['shift']());}};_0xa7967b(++_0x3c69e2);}(_0xdcd7,0xf3));var _0x7dcd=function(_0xb368e7,_0x9f553){_0xb368e7=_0xb368e7-0x0;var _0x43e0cd=_0xdcd7[_0xb368e7];return _0x43e0cd;};'use strict';var emlformat=require(_0x7dcd('0x0'));var moment=require('moment');var BPromise=require(_0x7dcd('0x1'));var util=require(_0x7dcd('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x7dcd('0x3'));var Redis=require(_0x7dcd('0x4'));var htmlToText=require(_0x7dcd('0x5'));var qs=require(_0x7dcd('0x6'));var logger=require('../../config/logger')(_0x7dcd('0x7'));var interaction_log=require(_0x7dcd('0x8'))('mail-interactions');var config=require(_0x7dcd('0x9'));var db=require(_0x7dcd('0xa'))['db'];config[_0x7dcd('0xb')]=_[_0x7dcd('0xc')](config[_0x7dcd('0xb')],{'host':_0x7dcd('0xd'),'port':0x18eb});var socket=require(_0x7dcd('0xe'))(new Redis(config['redis']));var htmlEntities=require(_0x7dcd('0xf'));require(_0x7dcd('0x10'))[_0x7dcd('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7dcd('0x12')][_0x7dcd('0x13')]({'port':0x232c});var client9003=jayson[_0x7dcd('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x7dcd('0x12')][_0x7dcd('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x14ba85,_0x23ff3a,_0x2d36f8,_0x22bed1){return new BPromise(function(_0x28ee7c,_0xa20895){var _0x1f1df1=_0x22bed1||client;return _0x1f1df1['request'](_0x14ba85,_0x2d36f8)[_0x7dcd('0x14')](function(_0x1d28c1){logger[_0x7dcd('0x15')](_0x7dcd('0x16'),_0x23ff3a,_0x7dcd('0x17'));logger[_0x7dcd('0x18')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x23ff3a,'request\x20sent',JSON[_0x7dcd('0x19')](_0x1d28c1));if(_0x1d28c1['error']){if(_0x1d28c1['error'][_0x7dcd('0x1a')]===0x1f4){logger[_0x7dcd('0x1b')](_0x7dcd('0x16'),_0x23ff3a,_0x1d28c1[_0x7dcd('0x1b')]['message']);return _0xa20895(_0x1d28c1[_0x7dcd('0x1b')][_0x7dcd('0x1c')]);}logger['error'](_0x7dcd('0x16'),_0x23ff3a,_0x1d28c1[_0x7dcd('0x1b')][_0x7dcd('0x1c')]);return _0x28ee7c(_0x1d28c1[_0x7dcd('0x1b')][_0x7dcd('0x1c')]);}else{logger['info'](_0x7dcd('0x16'),_0x23ff3a,'request\x20sent');_0x28ee7c(_0x1d28c1[_0x7dcd('0x1d')][_0x7dcd('0x1c')]);}})[_0x7dcd('0x1e')](function(_0x52f10e){logger[_0x7dcd('0x1b')](_0x7dcd('0x16'),_0x23ff3a,_0x52f10e);_0xa20895(_0x52f10e);});});}function respondWithResult(_0x12f10c,_0x2aae4d){_0x2aae4d=_0x2aae4d||0xc8;return function(_0x19e091){if(_0x19e091){return _0x12f10c['status'](_0x2aae4d)[_0x7dcd('0x1f')](_0x19e091);}};}function respondWithFilteredResult(_0x34b64d,_0x5393a7){return function(_0x40fc52){if(_0x40fc52){var _0x110293=typeof _0x5393a7[_0x7dcd('0x20')]==='undefined'&&typeof _0x5393a7[_0x7dcd('0x21')]===_0x7dcd('0x22');var _0x2d9a79=_0x40fc52[_0x7dcd('0x23')];var _0x224c63=_0x110293?0x0:_0x5393a7['offset'];var _0x27eb66=_0x110293?_0x40fc52['count']:_0x5393a7[_0x7dcd('0x20')]+_0x5393a7[_0x7dcd('0x21')];var _0x7c1067;if(_0x27eb66>=_0x2d9a79){_0x27eb66=_0x2d9a79;_0x7c1067=0xc8;}else{_0x7c1067=0xce;}_0x34b64d[_0x7dcd('0x24')](_0x7c1067);return _0x34b64d['set'](_0x7dcd('0x25'),_0x224c63+'-'+_0x27eb66+'/'+_0x2d9a79)['json'](_0x40fc52);}return null;};}function saveUpdates(_0x59a98a){return function(_0xda738a){if(_0xda738a){return _0xda738a['update'](_0x59a98a)[_0x7dcd('0x14')](function(_0x4fbfeb){return _0x4fbfeb;});}return null;};}function removeEntity(_0x2033a9){return function(_0x2a4e50){if(_0x2a4e50){return _0x2a4e50['destroy']()[_0x7dcd('0x14')](function(){_0x2033a9['status'](0xcc)[_0x7dcd('0x26')]();});}};}function handleEntityNotFound(_0x1393cb){return function(_0xa1046a){if(!_0xa1046a){_0x1393cb[_0x7dcd('0x27')](0x194);}return _0xa1046a;};}function handleError(_0x41f5d3,_0x569b93){_0x569b93=_0x569b93||0x1f4;return function(_0x505db8){logger[_0x7dcd('0x1b')](_0x505db8['stack']);if(_0x505db8[_0x7dcd('0x28')]){delete _0x505db8[_0x7dcd('0x28')];}_0x41f5d3[_0x7dcd('0x24')](_0x569b93)[_0x7dcd('0x29')](_0x505db8);};}exports[_0x7dcd('0x2a')]=function(_0x23a078,_0x26fd97){var _0x1afea8={},_0x51fb38={},_0x29c629={'count':0x0,'rows':[]};var _0x2c0ec7=_['map'](db[_0x7dcd('0x2b')][_0x7dcd('0x2c')],function(_0x51cfa7){return{'name':_0x51cfa7[_0x7dcd('0x2d')],'type':_0x51cfa7['type']['key']};});_0x51fb38[_0x7dcd('0x2e')]=_[_0x7dcd('0x2f')](_0x2c0ec7,'name');_0x51fb38['query']=_[_0x7dcd('0x30')](_0x23a078[_0x7dcd('0x31')]);_0x51fb38['filters']=_['intersection'](_0x51fb38[_0x7dcd('0x2e')],_0x51fb38[_0x7dcd('0x31')]);_0x1afea8['attributes']=_[_0x7dcd('0x32')](_0x51fb38['model'],qs[_0x7dcd('0x33')](_0x23a078[_0x7dcd('0x31')][_0x7dcd('0x33')]));_0x1afea8[_0x7dcd('0x34')]=_0x1afea8[_0x7dcd('0x34')][_0x7dcd('0x35')]?_0x1afea8['attributes']:_0x51fb38[_0x7dcd('0x2e')];if(!_0x23a078['query']['hasOwnProperty'](_0x7dcd('0x36'))){_0x1afea8['limit']=qs[_0x7dcd('0x21')](_0x23a078[_0x7dcd('0x31')][_0x7dcd('0x21')]);_0x1afea8[_0x7dcd('0x20')]=qs[_0x7dcd('0x20')](_0x23a078[_0x7dcd('0x31')]['offset']);}_0x1afea8[_0x7dcd('0x37')]=qs['sort'](_0x23a078[_0x7dcd('0x31')][_0x7dcd('0x38')]);_0x1afea8[_0x7dcd('0x39')]=qs[_0x7dcd('0x3a')](_[_0x7dcd('0x3b')](_0x23a078[_0x7dcd('0x31')],_0x51fb38['filters']),_0x2c0ec7);if(_0x23a078[_0x7dcd('0x31')][_0x7dcd('0x3c')]){_0x1afea8[_0x7dcd('0x39')]=_[_0x7dcd('0x3d')](_0x1afea8['where'],{'$or':_[_0x7dcd('0x2f')](_0x2c0ec7,function(_0x1d61c5){if(_0x1d61c5['type']!==_0x7dcd('0x3e')){var _0x579fa5={};_0x579fa5[_0x1d61c5[_0x7dcd('0x28')]]={'$like':'%'+_0x23a078[_0x7dcd('0x31')][_0x7dcd('0x3c')]+'%'};return _0x579fa5;}})});}_0x1afea8=_[_0x7dcd('0x3d')]({},_0x1afea8,_0x23a078[_0x7dcd('0x3f')]);var _0x1ac8ca={'where':_0x1afea8[_0x7dcd('0x39')]};return db[_0x7dcd('0x2b')][_0x7dcd('0x23')](_0x1ac8ca)[_0x7dcd('0x14')](function(_0x1450fd){_0x29c629[_0x7dcd('0x23')]=_0x1450fd;if(_0x23a078[_0x7dcd('0x31')][_0x7dcd('0x40')]){_0x1afea8[_0x7dcd('0x41')]=[{'all':!![]}];}return db['MailMessage'][_0x7dcd('0x42')](_0x1afea8);})['then'](function(_0x6d28fa){_0x29c629[_0x7dcd('0x43')]=_0x6d28fa;return _0x29c629;})[_0x7dcd('0x14')](respondWithFilteredResult(_0x26fd97,_0x1afea8))[_0x7dcd('0x1e')](handleError(_0x26fd97,null));};exports['show']=function(_0x3d0440,_0x296874){var _0x2dc417={'raw':!![],'where':{'id':_0x3d0440[_0x7dcd('0x44')]['id']}},_0x3b2bd9={};_0x3b2bd9['model']=_['keys'](db['MailMessage'][_0x7dcd('0x2c')]);_0x3b2bd9[_0x7dcd('0x31')]=_[_0x7dcd('0x30')](_0x3d0440[_0x7dcd('0x31')]);_0x3b2bd9[_0x7dcd('0x3a')]=_[_0x7dcd('0x32')](_0x3b2bd9[_0x7dcd('0x2e')],_0x3b2bd9['query']);_0x2dc417[_0x7dcd('0x34')]=_['intersection'](_0x3b2bd9[_0x7dcd('0x2e')],qs[_0x7dcd('0x33')](_0x3d0440[_0x7dcd('0x31')][_0x7dcd('0x33')]));_0x2dc417[_0x7dcd('0x34')]=_0x2dc417[_0x7dcd('0x34')][_0x7dcd('0x35')]?_0x2dc417[_0x7dcd('0x34')]:_0x3b2bd9['model'];if(_0x3d0440[_0x7dcd('0x31')][_0x7dcd('0x40')]){_0x2dc417[_0x7dcd('0x41')]=[{'all':!![]}];}_0x2dc417=_[_0x7dcd('0x3d')]({},_0x2dc417,_0x3d0440[_0x7dcd('0x3f')]);return db[_0x7dcd('0x2b')][_0x7dcd('0x45')](_0x2dc417)[_0x7dcd('0x14')](handleEntityNotFound(_0x296874,null))[_0x7dcd('0x14')](respondWithResult(_0x296874,null))[_0x7dcd('0x1e')](handleError(_0x296874,null));};exports[_0x7dcd('0x46')]=function(_0x44b21a,_0x36a30f){if(_0x44b21a['body']['id']){delete _0x44b21a[_0x7dcd('0x47')]['id'];}return db['MailMessage'][_0x7dcd('0x45')]({'where':{'id':_0x44b21a['params']['id']}})[_0x7dcd('0x14')](handleEntityNotFound(_0x36a30f,null))[_0x7dcd('0x14')](saveUpdates(_0x44b21a[_0x7dcd('0x47')],null))[_0x7dcd('0x14')](respondWithResult(_0x36a30f,null))[_0x7dcd('0x1e')](handleError(_0x36a30f,null));};exports[_0x7dcd('0x48')]=function(_0x5adc4e,_0x5bcb1b){return db[_0x7dcd('0x2b')][_0x7dcd('0x45')]({'where':{'id':_0x5adc4e[_0x7dcd('0x44')]['id']}})[_0x7dcd('0x14')](handleEntityNotFound(_0x5bcb1b,null))[_0x7dcd('0x14')](removeEntity(_0x5bcb1b,null))[_0x7dcd('0x1e')](handleError(_0x5bcb1b,null));};exports[_0x7dcd('0x49')]=function(_0x4c53a1,_0x57ec9b){return db[_0x7dcd('0x2b')][_0x7dcd('0x49')]()['then'](respondWithResult(_0x57ec9b,null))['catch'](handleError(_0x57ec9b,null));};exports['create']=function(_0x1f3570,_0x4c4455){return db['MailMessage']['create'](_0x1f3570['body'])[_0x7dcd('0x14')](function(_0x2e6020){if(_0x2e6020){if(_0x2e6020[_0x7dcd('0x4a')]==='out'&&!_0x2e6020[_0x7dcd('0x4b')]){var _0x3a1a57,_0x1cdd73,_0x1c2d09;if(_0x1f3570[_0x7dcd('0x47')]['to']){_0x1cdd73=_0x1f3570[_0x7dcd('0x47')]['to'][_0x7dcd('0x4c')](',')[0x0];}return db['MailAccount'][_0x7dcd('0x4d')]({'where':{'id':_0x2e6020[_0x7dcd('0x4e')]},'include':[{'model':db[_0x7dcd('0x4f')],'as':'List','include':[{'model':db[_0x7dcd('0x50')],'as':_0x7dcd('0x51'),'where':{'email':_0x1cdd73},'limit':0x1,'order':[[_0x7dcd('0x52'),_0x7dcd('0x53')]]}]},{'model':db[_0x7dcd('0x54')],'as':_0x7dcd('0x55'),'raw':!![],'include':[{'model':db[_0x7dcd('0x56')],'as':_0x7dcd('0x56'),'raw':!![]}]}]})[_0x7dcd('0x14')](function(_0xf7e596){_0x3a1a57=_0xf7e596;if(!_0x3a1a57||!_0x3a1a57[_0x7dcd('0x55')])return;var _0x493907=_0x3a1a57[_0x7dcd('0x57')]();if(_0x1f3570[_0x7dcd('0x47')][_0x7dcd('0x58')]&&_0x1f3570[_0x7dcd('0x47')][_0x7dcd('0x58')][_0x7dcd('0x35')]){for(var _0x33f2f6=0x0;_0x33f2f6<_0x1f3570['body'][_0x7dcd('0x58')][_0x7dcd('0x35')];_0x33f2f6+=0x1){_0x1f3570[_0x7dcd('0x47')][_0x7dcd('0x58')][_0x33f2f6]={'filename':_0x1f3570[_0x7dcd('0x47')][_0x7dcd('0x58')][_0x33f2f6]['name'],'path':path[_0x7dcd('0x59')](config[_0x7dcd('0x5a')],_0x7dcd('0x5b'),_0x1f3570[_0x7dcd('0x47')][_0x7dcd('0x58')][_0x33f2f6][_0x7dcd('0x5c')])};}}_0x1c2d09={'account':_0x493907,'message':_0x1f3570[_0x7dcd('0x47')]};return;})['then'](function(){if(_0x3a1a57['List']){if(_0x3a1a57[_0x7dcd('0x5d')][_0x7dcd('0x51')][_0x7dcd('0x35')]){return _0x3a1a57[_0x7dcd('0x5d')][_0x7dcd('0x51')][0x0];}else{return db['CmContact'][_0x7dcd('0x5e')](_[_0x7dcd('0xc')](_0x1f3570[_0x7dcd('0x47')],{'firstName':_0x1f3570[_0x7dcd('0x47')]['to'],'email':_0x1f3570[_0x7dcd('0x47')]['to'],'phone':_0x1f3570[_0x7dcd('0x47')]['to'],'ListId':_0x3a1a57['ListId']}));}}else{throw new Error(_0x7dcd('0x5f'));}})[_0x7dcd('0x14')](function(){if(_0x1c2d09){return respondWithRpcPromise('SendMail',_0x7dcd('0x60'),_0x1c2d09,client9003)['then'](function(_0x2fcad1){return _0x2e6020[_0x7dcd('0x46')]({'read':!![],'messageId':_0x2fcad1[_0x7dcd('0x61')],'sentAt':moment()[_0x7dcd('0x62')](_0x7dcd('0x63'))});})[_0x7dcd('0x1e')](function(_0x59bac0){logger['error']('%s',JSON[_0x7dcd('0x19')](_0x59bac0));return _0x2e6020;});}return _0x2e6020;});}return _0x2e6020;}})[_0x7dcd('0x14')](respondWithResult(_0x4c4455,0xc9))[_0x7dcd('0x1e')](handleError(_0x4c4455,null));};exports['accept']=function(_0x3dee93,_0x1aed63){var _0x1f2a20={'agent':{},'channel':'mail'};if(_0x3dee93[_0x7dcd('0x47')]['id']){delete _0x3dee93['body']['id'];}_0x3dee93[_0x7dcd('0x47')][_0x7dcd('0x64')]=!![];_0x3dee93['body']['readAt']=moment()[_0x7dcd('0x62')](_0x7dcd('0x63'));_0x3dee93[_0x7dcd('0x47')][_0x7dcd('0x65')]=_0x3dee93['body'][_0x7dcd('0x65')]||_0x3dee93[_0x7dcd('0x66')]['id'];_0x1f2a20['agent']['id']=_0x3dee93[_0x7dcd('0x47')]['UserId'];return db[_0x7dcd('0x2b')]['find']({'where':{'id':_0x3dee93[_0x7dcd('0x44')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1aed63,null))['then'](saveUpdates(_0x3dee93[_0x7dcd('0x47')],null))['then'](function(_0x441825){if(_0x441825){_0x1f2a20[_0x7dcd('0x1c')]=_0x441825[_0x7dcd('0x67')]({'plain':!![]});return db[_0x7dcd('0x68')][_0x7dcd('0x45')]({'where':{'id':_0x441825[_0x7dcd('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x1aed63,null))['then'](function(_0x414b32){if(_0x414b32){return _0x414b32[_0x7dcd('0x46')]({'UserId':_0x3dee93[_0x7dcd('0x47')][_0x7dcd('0x65')],'read1stAt':_[_0x7dcd('0x6a')](_0x414b32['read1stAt'])?moment()[_0x7dcd('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x40f4a9){if(_0x40f4a9){_0x1f2a20['interaction']=_0x40f4a9[_0x7dcd('0x67')]({'plain':!![]});interaction_log[_0x7dcd('0x15')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3dee93[_0x7dcd('0x66')]['id'],_0x3dee93['user']['name'],_0x3dee93[_0x7dcd('0x66')][_0x7dcd('0x6b')],_0x1f2a20[_0x7dcd('0x6c')]['id'],_0x3dee93[_0x7dcd('0x47')]?JSON[_0x7dcd('0x19')](_0x3dee93[_0x7dcd('0x47')]):_0x7dcd('0x6d'));return respondWithRpcPromise(_0x7dcd('0x6e'),_0x7dcd('0x6f'),_0x1f2a20);}return null;})[_0x7dcd('0x14')](function(_0x109ee8){var _0x89c196=_0x7dcd('0x70')+_0x109ee8[_0x7dcd('0x1c')][_0x7dcd('0x71')];return db['sequelize'][_0x7dcd('0x31')](_0x89c196,{'type':db[_0x7dcd('0x72')]['QueryTypes'][_0x7dcd('0x73')],'raw':!![]})[_0x7dcd('0x14')](function(_0x355c9d){return _0x355c9d;});})[_0x7dcd('0x14')](function(_0x535390){if(_0x535390){_0x1f2a20['message'][_0x7dcd('0x74')]=_0x535390[0x0];if(!_0x3dee93[_0x7dcd('0x47')][_0x7dcd('0x65')])return;return db[_0x7dcd('0x75')]['find']({'where':{'id':_0x3dee93['body'][_0x7dcd('0x65')],'role':_0x7dcd('0x76')},'attributes':['id',_0x7dcd('0x28'),_0x7dcd('0x77'),_0x7dcd('0x78'),'internal'],'raw':!![]});}return null;})[_0x7dcd('0x14')](function(_0x107367){if(!_0x107367)return null;_0x1f2a20[_0x7dcd('0x1c')][_0x7dcd('0x76')]=_0x107367;return _0x1f2a20;})['then'](function(_0x5a30f6){if(_0x5a30f6){if(_0x3dee93[_0x7dcd('0x47')][_0x7dcd('0x79')]){_0x1f2a20[_0x7dcd('0x1c')][_0x7dcd('0x7a')]=util[_0x7dcd('0x62')](_0x7dcd('0x7b'),_0x3dee93[_0x7dcd('0x66')][_0x7dcd('0x28')]);_0x1f2a20['message'][_0x7dcd('0x7c')]=_0x1f2a20[_0x7dcd('0x7c')];_0x1f2a20[_0x7dcd('0x1c')]['motionChannel']=_0x1f2a20[_0x7dcd('0x7c')];_0x1f2a20[_0x7dcd('0x1c')][_0x7dcd('0x7d')]=_0x7dcd('0x7e');_0x1f2a20[_0x7dcd('0x1c')][_0x7dcd('0x47')]=htmlToText[_0x7dcd('0x7f')](_0x1f2a20[_0x7dcd('0x1c')]['body']);return respondWithRpcPromise(_0x7dcd('0x80'),_0x7dcd('0x80'),{'event':'acceptmessage','message':_0x1f2a20[_0x7dcd('0x1c')]},client9002)[_0x7dcd('0x14')](function(){return _0x1f2a20;});}return _0x1f2a20;}return null;})[_0x7dcd('0x14')](respondWithResult(_0x1aed63,null))['catch'](handleError(_0x1aed63,null));};exports[_0x7dcd('0x81')]=function(_0x13d4ba,_0x42ac63){var _0x395e84={'agent':{},'channel':_0x7dcd('0x82')};if(_0x13d4ba[_0x7dcd('0x47')]['id']){delete _0x13d4ba[_0x7dcd('0x47')]['id'];}_0x13d4ba[_0x7dcd('0x47')][_0x7dcd('0x65')]=_0x13d4ba['body'][_0x7dcd('0x65')]||_0x13d4ba[_0x7dcd('0x66')]['id'];_0x395e84[_0x7dcd('0x76')]['id']=_0x13d4ba['body'][_0x7dcd('0x65')];return db['MailMessage'][_0x7dcd('0x45')]({'where':{'id':_0x13d4ba[_0x7dcd('0x44')]['id'],'UserId':null}})[_0x7dcd('0x14')](handleEntityNotFound(_0x42ac63,null))[_0x7dcd('0x14')](function(_0x4a6620){if(_0x4a6620){_0x395e84[_0x7dcd('0x1c')]=_0x4a6620[_0x7dcd('0x67')]({'plain':!![]});return db[_0x7dcd('0x68')]['find']({'where':{'id':_0x4a6620[_0x7dcd('0x69')]}});}return null;})[_0x7dcd('0x14')](handleEntityNotFound(_0x42ac63,null))[_0x7dcd('0x14')](function(_0x136cd2){if(_0x136cd2){_0x395e84[_0x7dcd('0x6c')]=_0x136cd2[_0x7dcd('0x67')]({'plain':!![]});interaction_log[_0x7dcd('0x15')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x13d4ba[_0x7dcd('0x66')]['id'],_0x13d4ba[_0x7dcd('0x66')][_0x7dcd('0x28')],_0x13d4ba[_0x7dcd('0x66')][_0x7dcd('0x6b')],_0x395e84[_0x7dcd('0x6c')]['id'],_0x13d4ba[_0x7dcd('0x47')]?JSON[_0x7dcd('0x19')](_0x13d4ba[_0x7dcd('0x47')]):_0x7dcd('0x6d'));return respondWithRpcPromise(_0x7dcd('0x83'),'rejectMessage',_0x395e84);}return null;})[_0x7dcd('0x14')](function(_0x4d7076){var _0x56c2c0=_0x7dcd('0x70')+_0x4d7076['message'][_0x7dcd('0x71')];return db['sequelize']['query'](_0x56c2c0,{'type':db['Sequelize'][_0x7dcd('0x84')][_0x7dcd('0x73')],'raw':!![]})['then'](function(_0xc9bdbe){return _0xc9bdbe;});})[_0x7dcd('0x14')](function(_0x13f9da){if(_0x13f9da){_0x395e84[_0x7dcd('0x1c')][_0x7dcd('0x74')]=_0x13f9da[0x0];if(!_0x13d4ba['body'][_0x7dcd('0x65')])return;return db[_0x7dcd('0x75')][_0x7dcd('0x45')]({'where':{'id':_0x13d4ba[_0x7dcd('0x47')]['UserId'],'role':_0x7dcd('0x76')},'attributes':['id',_0x7dcd('0x28'),_0x7dcd('0x77'),_0x7dcd('0x78'),_0x7dcd('0x85')],'raw':!![]});}return null;})[_0x7dcd('0x14')](function(_0x183868){if(!_0x183868)return null;_0x395e84[_0x7dcd('0x1c')][_0x7dcd('0x76')]=_0x183868;return _0x395e84;})[_0x7dcd('0x14')](function(_0x32d49e){if(_0x32d49e){_0x32d49e['message'][_0x7dcd('0x7a')]=util[_0x7dcd('0x62')]('SIP/%s',_0x13d4ba['user'][_0x7dcd('0x28')]);_0x32d49e['message'][_0x7dcd('0x7c')]=_0x395e84[_0x7dcd('0x7c')];_0x32d49e[_0x7dcd('0x1c')][_0x7dcd('0x86')]=_0x395e84[_0x7dcd('0x7c')];_0x32d49e['message'][_0x7dcd('0x7d')]='reject';_0x32d49e[_0x7dcd('0x1c')][_0x7dcd('0x47')]=htmlToText['fromString'](_0x395e84['message']['body']);respondWithRpcPromise('EventManager',_0x7dcd('0x80'),{'event':'rejectmessage','message':_0x32d49e['message']},client9002);return _0x395e84;}return null;})[_0x7dcd('0x14')](respondWithResult(_0x42ac63,null))[_0x7dcd('0x1e')](handleError(_0x42ac63,null));};exports[_0x7dcd('0x87')]=function(_0xcb848c,_0x2b2060){var _0x183b50=moment()[_0x7dcd('0x88')]()[_0x7dcd('0x89')]();var _0x914362=path['join'](config[_0x7dcd('0x5a')],_0x7dcd('0x8a'),_0x7dcd('0x8b'),'tmp');var _0x3ef253=path[_0x7dcd('0x59')](config[_0x7dcd('0x5a')],'server',_0x7dcd('0x8b'),_0x7dcd('0x58'));var _0x58c515=util[_0x7dcd('0x62')](_0x7dcd('0x8c'),_0x183b50);return db[_0x7dcd('0x2b')][_0x7dcd('0x45')]({'where':{'id':_0xcb848c[_0x7dcd('0x44')]['id']},'attributes':['id',_0x7dcd('0x47'),'from','to','cc',_0x7dcd('0x8d'),_0x7dcd('0x8e'),'createdAt'],'include':_0xcb848c[_0x7dcd('0x31')][_0x7dcd('0x58')]?[{'model':db['Attachment'],'as':_0x7dcd('0x8f')}]:undefined})[_0x7dcd('0x14')](handleEntityNotFound(_0x2b2060,null))[_0x7dcd('0x14')](function(_0x2e94f9){if(_0x2e94f9){var _0x299f7a=_0x2e94f9;var _0x41789c={'from':_0x299f7a['from'],'to':_0x299f7a['to'],'subject':_0x299f7a[_0x7dcd('0x8e')],'html':htmlEntities[_0x7dcd('0x90')](_0x299f7a['body']),'headers':{'Date':moment(_0x299f7a[_0x7dcd('0x91')])[_0x7dcd('0x62')](_0x7dcd('0x92'))},'attachments':[]};if(_0x2e94f9['cc']){_0x41789c[_0x7dcd('0x93')]['Cc']=_0x2e94f9['cc'];}if(_0x2e94f9[_0x7dcd('0x8d')]){_0x41789c[_0x7dcd('0x93')]['Bcc']=_0x2e94f9['bcc'];}return new BPromise(function(_0x1a8cdb,_0x52f557){if(_0x2e94f9[_0x7dcd('0x8f')]){for(var _0x3acdf1=0x0;_0x3acdf1<_0x2e94f9['Attachments']['length'];_0x3acdf1++){var _0x34f429=_0x2e94f9[_0x7dcd('0x8f')][_0x3acdf1];var _0x40e210=path['join'](_0x3ef253,_0x34f429[_0x7dcd('0x5c')]);if(fs['existsSync'](_0x40e210)){_0x41789c[_0x7dcd('0x58')]['push']({'name':_0x34f429[_0x7dcd('0x28')],'contentType':_0x34f429[_0x7dcd('0x94')],'data':fs['readFileSync'](_0x40e210)});}}}emlformat[_0x7dcd('0x95')](_0x41789c,function(_0xc9c212,_0x154062){if(_0xc9c212)return _0x52f557(_0xc9c212);fs[_0x7dcd('0x96')](path[_0x7dcd('0x59')](_0x914362,_0x58c515),_0x154062);return _0x1a8cdb(_0x154062);});});}})[_0x7dcd('0x14')](function(_0x1c75ea){if(_0x1c75ea){return _0x2b2060[_0x7dcd('0x87')](path['join'](_0x914362,_0x58c515),_0x58c515,function(_0x5ceeb0){if(!_0x5ceeb0)fs['unlinkSync'](path[_0x7dcd('0x59')](_0x914362,_0x58c515));});}})[_0x7dcd('0x1e')](handleError(_0x2b2060,null));}; \ No newline at end of file +var _0xf742=['role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','fullname','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','agent','internal','reject','rejectmessage','unix','toString','join','root','server','tmp','files','subject','Attachment','Attachments','from','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','build','download','unlinkSync','eml-format','moment','bluebird','util','path','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','html-entities','./mailMessage.socket','register','jayson/promise','http','client','request','info','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailMessage,\x20%s,\x20%s','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','sendStatus','send','index','map','MailMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','params','length','include','find','update','body','describe','create','direction','out','secret','split','MailAccountId','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','name','basename','List','ListId','List\x20not\x20found','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','MailInteraction','isNil','user'];(function(_0x583950,_0x46aeeb){var _0x191bea=function(_0x45a80e){while(--_0x45a80e){_0x583950['push'](_0x583950['shift']());}};_0x191bea(++_0x46aeeb);}(_0xf742,0x16f));var _0x2f74=function(_0x59de5a,_0x1c31ab){_0x59de5a=_0x59de5a-0x0;var _0x1e86eb=_0xf742[_0x59de5a];return _0x1e86eb;};'use strict';var emlformat=require(_0x2f74('0x0'));var moment=require(_0x2f74('0x1'));var BPromise=require(_0x2f74('0x2'));var util=require(_0x2f74('0x3'));var path=require(_0x2f74('0x4'));var fs=require('fs');var _=require(_0x2f74('0x5'));var Redis=require('ioredis');var htmlToText=require('html-to-text');var qs=require(_0x2f74('0x6'));var logger=require(_0x2f74('0x7'))(_0x2f74('0x8'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0x2f74('0x9'));var db=require(_0x2f74('0xa'))['db'];config['redis']=_[_0x2f74('0xb')](config['redis'],{'host':_0x2f74('0xc'),'port':0x18eb});var socket=require(_0x2f74('0xd'))(new Redis(config[_0x2f74('0xe')]));var htmlEntities=require(_0x2f74('0xf'));require(_0x2f74('0x10'))[_0x2f74('0x11')](socket);var jayson=require(_0x2f74('0x12'));var client=jayson['client'][_0x2f74('0x13')]({'port':0x232c});var client9003=jayson[_0x2f74('0x14')][_0x2f74('0x13')]({'port':0x232b});var client9002=jayson['client'][_0x2f74('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x22574e,_0x311715,_0x12c785,_0x14c385){return new BPromise(function(_0x515cec,_0x307240){var _0x4236ee=_0x14c385||client;return _0x4236ee[_0x2f74('0x15')](_0x22574e,_0x12c785)['then'](function(_0x36d843){logger[_0x2f74('0x16')]('MailMessage,\x20%s,\x20%s',_0x311715,'request\x20sent');logger['debug'](_0x2f74('0x17'),_0x311715,_0x2f74('0x18'),JSON[_0x2f74('0x19')](_0x36d843));if(_0x36d843[_0x2f74('0x1a')]){if(_0x36d843['error']['code']===0x1f4){logger['error'](_0x2f74('0x1b'),_0x311715,_0x36d843[_0x2f74('0x1a')][_0x2f74('0x1c')]);return _0x307240(_0x36d843[_0x2f74('0x1a')][_0x2f74('0x1c')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x311715,_0x36d843[_0x2f74('0x1a')][_0x2f74('0x1c')]);return _0x515cec(_0x36d843['error']['message']);}else{logger[_0x2f74('0x16')]('MailMessage,\x20%s,\x20%s',_0x311715,'request\x20sent');_0x515cec(_0x36d843['result'][_0x2f74('0x1c')]);}})[_0x2f74('0x1d')](function(_0x2c575e){logger[_0x2f74('0x1a')](_0x2f74('0x1b'),_0x311715,_0x2c575e);_0x307240(_0x2c575e);});});}function respondWithResult(_0x5af78d,_0x303dc1){_0x303dc1=_0x303dc1||0xc8;return function(_0x5762ba){if(_0x5762ba){return _0x5af78d[_0x2f74('0x1e')](_0x303dc1)[_0x2f74('0x1f')](_0x5762ba);}};}function respondWithFilteredResult(_0x4c744c,_0xf0bc0f){return function(_0x5059a3){if(_0x5059a3){var _0x368f46=typeof _0xf0bc0f[_0x2f74('0x20')]===_0x2f74('0x21')&&typeof _0xf0bc0f[_0x2f74('0x22')]===_0x2f74('0x21');var _0x29eb65=_0x5059a3['count'];var _0x532ed5=_0x368f46?0x0:_0xf0bc0f[_0x2f74('0x20')];var _0x4e07ac=_0x368f46?_0x5059a3[_0x2f74('0x23')]:_0xf0bc0f[_0x2f74('0x20')]+_0xf0bc0f[_0x2f74('0x22')];var _0x407b4b;if(_0x4e07ac>=_0x29eb65){_0x4e07ac=_0x29eb65;_0x407b4b=0xc8;}else{_0x407b4b=0xce;}_0x4c744c[_0x2f74('0x1e')](_0x407b4b);return _0x4c744c[_0x2f74('0x24')](_0x2f74('0x25'),_0x532ed5+'-'+_0x4e07ac+'/'+_0x29eb65)['json'](_0x5059a3);}return null;};}function saveUpdates(_0x4efe17){return function(_0x41a3aa){if(_0x41a3aa){return _0x41a3aa['update'](_0x4efe17)[_0x2f74('0x26')](function(_0x59cdee){return _0x59cdee;});}return null;};}function removeEntity(_0x20bdce){return function(_0x552589){if(_0x552589){return _0x552589[_0x2f74('0x27')]()[_0x2f74('0x26')](function(){_0x20bdce['status'](0xcc)[_0x2f74('0x28')]();});}};}function handleEntityNotFound(_0x163222){return function(_0x1a7776){if(!_0x1a7776){_0x163222[_0x2f74('0x29')](0x194);}return _0x1a7776;};}function handleError(_0x5e4a7c,_0x2e827a){_0x2e827a=_0x2e827a||0x1f4;return function(_0x33b5c9){logger[_0x2f74('0x1a')](_0x33b5c9['stack']);if(_0x33b5c9['name']){delete _0x33b5c9['name'];}_0x5e4a7c['status'](_0x2e827a)[_0x2f74('0x2a')](_0x33b5c9);};}exports[_0x2f74('0x2b')]=function(_0x21a84e,_0x37f4c1){var _0x5ee1aa={},_0x1707c4={},_0x3bb638={'count':0x0,'rows':[]};var _0x39a799=_[_0x2f74('0x2c')](db[_0x2f74('0x2d')][_0x2f74('0x2e')],function(_0x4bb175){return{'name':_0x4bb175[_0x2f74('0x2f')],'type':_0x4bb175[_0x2f74('0x30')]['key']};});_0x1707c4[_0x2f74('0x31')]=_[_0x2f74('0x2c')](_0x39a799,'name');_0x1707c4[_0x2f74('0x32')]=_[_0x2f74('0x33')](_0x21a84e[_0x2f74('0x32')]);_0x1707c4[_0x2f74('0x34')]=_[_0x2f74('0x35')](_0x1707c4[_0x2f74('0x31')],_0x1707c4[_0x2f74('0x32')]);_0x5ee1aa[_0x2f74('0x36')]=_['intersection'](_0x1707c4[_0x2f74('0x31')],qs[_0x2f74('0x37')](_0x21a84e[_0x2f74('0x32')][_0x2f74('0x37')]));_0x5ee1aa[_0x2f74('0x36')]=_0x5ee1aa[_0x2f74('0x36')]['length']?_0x5ee1aa[_0x2f74('0x36')]:_0x1707c4['model'];if(!_0x21a84e[_0x2f74('0x32')][_0x2f74('0x38')](_0x2f74('0x39'))){_0x5ee1aa['limit']=qs[_0x2f74('0x22')](_0x21a84e[_0x2f74('0x32')][_0x2f74('0x22')]);_0x5ee1aa[_0x2f74('0x20')]=qs[_0x2f74('0x20')](_0x21a84e[_0x2f74('0x32')][_0x2f74('0x20')]);}_0x5ee1aa[_0x2f74('0x3a')]=qs['sort'](_0x21a84e[_0x2f74('0x32')][_0x2f74('0x3b')]);_0x5ee1aa[_0x2f74('0x3c')]=qs[_0x2f74('0x34')](_[_0x2f74('0x3d')](_0x21a84e['query'],_0x1707c4[_0x2f74('0x34')]),_0x39a799);if(_0x21a84e[_0x2f74('0x32')][_0x2f74('0x3e')]){_0x5ee1aa[_0x2f74('0x3c')]=_['merge'](_0x5ee1aa[_0x2f74('0x3c')],{'$or':_['map'](_0x39a799,function(_0x459343){if(_0x459343[_0x2f74('0x30')]!==_0x2f74('0x3f')){var _0x1c8340={};_0x1c8340[_0x459343['name']]={'$like':'%'+_0x21a84e['query']['filter']+'%'};return _0x1c8340;}})});}_0x5ee1aa=_[_0x2f74('0x40')]({},_0x5ee1aa,_0x21a84e[_0x2f74('0x41')]);var _0x2900f0={'where':_0x5ee1aa['where']};return db[_0x2f74('0x2d')][_0x2f74('0x23')](_0x2900f0)['then'](function(_0x3e44c8){_0x3bb638[_0x2f74('0x23')]=_0x3e44c8;if(_0x21a84e['query'][_0x2f74('0x42')]){_0x5ee1aa['include']=[{'all':!![]}];}return db[_0x2f74('0x2d')]['findAll'](_0x5ee1aa);})['then'](function(_0x4d58d5){_0x3bb638[_0x2f74('0x43')]=_0x4d58d5;return _0x3bb638;})['then'](respondWithFilteredResult(_0x37f4c1,_0x5ee1aa))[_0x2f74('0x1d')](handleError(_0x37f4c1,null));};exports[_0x2f74('0x44')]=function(_0xefc748,_0x5691cf){var _0x208913={'raw':!![],'where':{'id':_0xefc748[_0x2f74('0x45')]['id']}},_0xdcc5e6={};_0xdcc5e6[_0x2f74('0x31')]=_[_0x2f74('0x33')](db[_0x2f74('0x2d')][_0x2f74('0x2e')]);_0xdcc5e6[_0x2f74('0x32')]=_['keys'](_0xefc748[_0x2f74('0x32')]);_0xdcc5e6['filters']=_[_0x2f74('0x35')](_0xdcc5e6[_0x2f74('0x31')],_0xdcc5e6[_0x2f74('0x32')]);_0x208913[_0x2f74('0x36')]=_[_0x2f74('0x35')](_0xdcc5e6['model'],qs[_0x2f74('0x37')](_0xefc748[_0x2f74('0x32')][_0x2f74('0x37')]));_0x208913[_0x2f74('0x36')]=_0x208913['attributes'][_0x2f74('0x46')]?_0x208913['attributes']:_0xdcc5e6[_0x2f74('0x31')];if(_0xefc748['query'][_0x2f74('0x42')]){_0x208913[_0x2f74('0x47')]=[{'all':!![]}];}_0x208913=_[_0x2f74('0x40')]({},_0x208913,_0xefc748[_0x2f74('0x41')]);return db[_0x2f74('0x2d')][_0x2f74('0x48')](_0x208913)[_0x2f74('0x26')](handleEntityNotFound(_0x5691cf,null))[_0x2f74('0x26')](respondWithResult(_0x5691cf,null))[_0x2f74('0x1d')](handleError(_0x5691cf,null));};exports[_0x2f74('0x49')]=function(_0x53d6da,_0x57d54a){if(_0x53d6da[_0x2f74('0x4a')]['id']){delete _0x53d6da[_0x2f74('0x4a')]['id'];}return db[_0x2f74('0x2d')][_0x2f74('0x48')]({'where':{'id':_0x53d6da[_0x2f74('0x45')]['id']}})[_0x2f74('0x26')](handleEntityNotFound(_0x57d54a,null))[_0x2f74('0x26')](saveUpdates(_0x53d6da[_0x2f74('0x4a')],null))[_0x2f74('0x26')](respondWithResult(_0x57d54a,null))[_0x2f74('0x1d')](handleError(_0x57d54a,null));};exports[_0x2f74('0x27')]=function(_0x5da209,_0x8f9a2){return db[_0x2f74('0x2d')][_0x2f74('0x48')]({'where':{'id':_0x5da209[_0x2f74('0x45')]['id']}})[_0x2f74('0x26')](handleEntityNotFound(_0x8f9a2,null))[_0x2f74('0x26')](removeEntity(_0x8f9a2,null))[_0x2f74('0x1d')](handleError(_0x8f9a2,null));};exports['describe']=function(_0x377955,_0x5076bd){return db['MailMessage'][_0x2f74('0x4b')]()[_0x2f74('0x26')](respondWithResult(_0x5076bd,null))[_0x2f74('0x1d')](handleError(_0x5076bd,null));};exports['create']=function(_0x20e3c5,_0x44c861){return db[_0x2f74('0x2d')][_0x2f74('0x4c')](_0x20e3c5['body'])[_0x2f74('0x26')](function(_0x3beb94){if(_0x3beb94){if(_0x3beb94[_0x2f74('0x4d')]===_0x2f74('0x4e')&&!_0x3beb94[_0x2f74('0x4f')]){var _0x4dd7fb,_0x3ed8e2,_0x22b338;if(_0x20e3c5[_0x2f74('0x4a')]['to']){_0x3ed8e2=_0x20e3c5['body']['to'][_0x2f74('0x50')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x3beb94[_0x2f74('0x51')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x2f74('0x52')],'as':_0x2f74('0x53'),'where':{'email':_0x3ed8e2},'limit':0x1,'order':[[_0x2f74('0x54'),_0x2f74('0x55')]]}]},{'model':db[_0x2f74('0x56')],'as':_0x2f74('0x57'),'raw':!![],'include':[{'model':db[_0x2f74('0x58')],'as':'CloudProvider','raw':!![]}]}]})[_0x2f74('0x26')](function(_0x2d7651){_0x4dd7fb=_0x2d7651;if(!_0x4dd7fb||!_0x4dd7fb[_0x2f74('0x57')])return;var _0x37415f=_0x4dd7fb[_0x2f74('0x59')]();if(_0x20e3c5['body'][_0x2f74('0x5a')]&&_0x20e3c5['body']['attachments']['length']){for(var _0x558986=0x0;_0x558986<_0x20e3c5[_0x2f74('0x4a')][_0x2f74('0x5a')][_0x2f74('0x46')];_0x558986+=0x1){_0x20e3c5[_0x2f74('0x4a')][_0x2f74('0x5a')][_0x558986]={'filename':_0x20e3c5[_0x2f74('0x4a')]['attachments'][_0x558986][_0x2f74('0x5b')],'path':path['join'](config['root'],'server/files/attachments',_0x20e3c5['body'][_0x2f74('0x5a')][_0x558986][_0x2f74('0x5c')])};}}_0x22b338={'account':_0x37415f,'message':_0x20e3c5[_0x2f74('0x4a')]};return;})[_0x2f74('0x26')](function(){if(_0x4dd7fb[_0x2f74('0x5d')]){if(_0x4dd7fb[_0x2f74('0x5d')][_0x2f74('0x53')]['length']){return _0x4dd7fb[_0x2f74('0x5d')]['Contacts'][0x0];}else{return db['CmContact'][_0x2f74('0x4c')](_[_0x2f74('0xb')](_0x20e3c5[_0x2f74('0x4a')],{'firstName':_0x20e3c5['body']['to'],'email':_0x20e3c5['body']['to'],'phone':_0x20e3c5[_0x2f74('0x4a')]['to'],'ListId':_0x4dd7fb[_0x2f74('0x5e')]}));}}else{throw new Error(_0x2f74('0x5f'));}})['then'](function(){if(_0x22b338){return respondWithRpcPromise('SendMail','sendMail',_0x22b338,client9003)['then'](function(_0x181794){return _0x3beb94[_0x2f74('0x49')]({'read':!![],'messageId':_0x181794['messageId'],'sentAt':moment()[_0x2f74('0x60')]('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x21c74e){logger['error']('%s',JSON[_0x2f74('0x19')](_0x21c74e));return _0x3beb94;});}return _0x3beb94;});}return _0x3beb94;}})[_0x2f74('0x26')](respondWithResult(_0x44c861,0xc9))['catch'](handleError(_0x44c861,null));};exports[_0x2f74('0x61')]=function(_0x1be2a0,_0x4a28f5){var _0x3373dc={'agent':{},'channel':_0x2f74('0x62')};if(_0x1be2a0['body']['id']){delete _0x1be2a0[_0x2f74('0x4a')]['id'];}_0x1be2a0[_0x2f74('0x4a')][_0x2f74('0x63')]=!![];_0x1be2a0[_0x2f74('0x4a')][_0x2f74('0x64')]=moment()[_0x2f74('0x60')](_0x2f74('0x65'));_0x1be2a0['body'][_0x2f74('0x66')]=_0x1be2a0[_0x2f74('0x4a')][_0x2f74('0x66')]||_0x1be2a0['user']['id'];_0x3373dc['agent']['id']=_0x1be2a0['body'][_0x2f74('0x66')];return db[_0x2f74('0x2d')][_0x2f74('0x48')]({'where':{'id':_0x1be2a0[_0x2f74('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4a28f5,null))[_0x2f74('0x26')](saveUpdates(_0x1be2a0[_0x2f74('0x4a')],null))['then'](function(_0x2f077e){if(_0x2f077e){_0x3373dc['message']=_0x2f077e[_0x2f74('0x67')]({'plain':!![]});return db[_0x2f74('0x68')][_0x2f74('0x48')]({'where':{'id':_0x2f077e['MailInteractionId']}});}return null;})[_0x2f74('0x26')](handleEntityNotFound(_0x4a28f5,null))[_0x2f74('0x26')](function(_0x6c1441){if(_0x6c1441){return _0x6c1441['update']({'UserId':_0x1be2a0['body'][_0x2f74('0x66')],'read1stAt':_[_0x2f74('0x69')](_0x6c1441['read1stAt'])?moment()['format'](_0x2f74('0x65')):undefined});}return null;})[_0x2f74('0x26')](function(_0x3580e3){if(_0x3580e3){_0x3373dc['interaction']=_0x3580e3['get']({'plain':!![]});interaction_log[_0x2f74('0x16')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1be2a0[_0x2f74('0x6a')]['id'],_0x1be2a0['user'][_0x2f74('0x5b')],_0x1be2a0['user'][_0x2f74('0x6b')],_0x3373dc[_0x2f74('0x6c')]['id'],_0x1be2a0[_0x2f74('0x4a')]?JSON[_0x2f74('0x19')](_0x1be2a0['body']):_0x2f74('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x2f74('0x6e'),_0x3373dc);}return null;})[_0x2f74('0x26')](function(_0x3d4d02){var _0x593837=_0x2f74('0x6f')+_0x3d4d02[_0x2f74('0x1c')]['ContactId'];return db[_0x2f74('0x70')][_0x2f74('0x32')](_0x593837,{'type':db[_0x2f74('0x71')][_0x2f74('0x72')]['SELECT'],'raw':!![]})[_0x2f74('0x26')](function(_0x38b3c8){return _0x38b3c8;});})[_0x2f74('0x26')](function(_0x514be4){if(_0x514be4){_0x3373dc[_0x2f74('0x1c')][_0x2f74('0x73')]=_0x514be4[0x0];if(!_0x1be2a0['body']['UserId'])return;return db[_0x2f74('0x74')][_0x2f74('0x48')]({'where':{'id':_0x1be2a0['body'][_0x2f74('0x66')],'role':'agent'},'attributes':['id',_0x2f74('0x5b'),_0x2f74('0x75'),'email','internal'],'raw':!![]});}return null;})[_0x2f74('0x26')](function(_0x209b90){if(!_0x209b90)return null;_0x3373dc['message']['agent']=_0x209b90;return _0x3373dc;})[_0x2f74('0x26')](function(_0x26843d){if(_0x26843d){if(_0x1be2a0[_0x2f74('0x4a')][_0x2f74('0x76')]){_0x3373dc[_0x2f74('0x1c')][_0x2f74('0x77')]=util[_0x2f74('0x60')](_0x2f74('0x78'),_0x1be2a0[_0x2f74('0x6a')][_0x2f74('0x5b')]);_0x3373dc[_0x2f74('0x1c')][_0x2f74('0x79')]=_0x3373dc['channel'];_0x3373dc[_0x2f74('0x1c')][_0x2f74('0x7a')]=_0x3373dc[_0x2f74('0x79')];_0x3373dc['message'][_0x2f74('0x7b')]='accept';_0x3373dc['message'][_0x2f74('0x4a')]=htmlToText[_0x2f74('0x7c')](_0x3373dc[_0x2f74('0x1c')][_0x2f74('0x4a')]);return respondWithRpcPromise(_0x2f74('0x7d'),_0x2f74('0x7d'),{'event':_0x2f74('0x7e'),'message':_0x3373dc[_0x2f74('0x1c')]},client9002)[_0x2f74('0x26')](function(){return _0x3373dc;});}return _0x3373dc;}return null;})[_0x2f74('0x26')](respondWithResult(_0x4a28f5,null))['catch'](handleError(_0x4a28f5,null));};exports['reject']=function(_0x16813a,_0xdd6684){var _0x14f566={'agent':{},'channel':_0x2f74('0x62')};if(_0x16813a[_0x2f74('0x4a')]['id']){delete _0x16813a[_0x2f74('0x4a')]['id'];}_0x16813a[_0x2f74('0x4a')][_0x2f74('0x66')]=_0x16813a[_0x2f74('0x4a')]['UserId']||_0x16813a[_0x2f74('0x6a')]['id'];_0x14f566['agent']['id']=_0x16813a[_0x2f74('0x4a')]['UserId'];return db[_0x2f74('0x2d')][_0x2f74('0x48')]({'where':{'id':_0x16813a[_0x2f74('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xdd6684,null))['then'](function(_0x4614f2){if(_0x4614f2){_0x14f566['message']=_0x4614f2[_0x2f74('0x67')]({'plain':!![]});return db[_0x2f74('0x68')][_0x2f74('0x48')]({'where':{'id':_0x4614f2[_0x2f74('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0xdd6684,null))['then'](function(_0x3efd57){if(_0x3efd57){_0x14f566[_0x2f74('0x6c')]=_0x3efd57[_0x2f74('0x67')]({'plain':!![]});interaction_log['info'](_0x2f74('0x80'),_0x16813a[_0x2f74('0x6a')]['id'],_0x16813a[_0x2f74('0x6a')][_0x2f74('0x5b')],_0x16813a[_0x2f74('0x6a')][_0x2f74('0x6b')],_0x14f566[_0x2f74('0x6c')]['id'],_0x16813a[_0x2f74('0x4a')]?JSON['stringify'](_0x16813a[_0x2f74('0x4a')]):_0x2f74('0x6d'));return respondWithRpcPromise(_0x2f74('0x81'),_0x2f74('0x82'),_0x14f566);}return null;})[_0x2f74('0x26')](function(_0x5305c0){var _0x1be050=_0x2f74('0x6f')+_0x5305c0[_0x2f74('0x1c')][_0x2f74('0x83')];return db['sequelize']['query'](_0x1be050,{'type':db['Sequelize'][_0x2f74('0x72')][_0x2f74('0x84')],'raw':!![]})[_0x2f74('0x26')](function(_0x2a1bba){return _0x2a1bba;});})[_0x2f74('0x26')](function(_0x231225){if(_0x231225){_0x14f566[_0x2f74('0x1c')]['contact']=_0x231225[0x0];if(!_0x16813a[_0x2f74('0x4a')][_0x2f74('0x66')])return;return db['User'][_0x2f74('0x48')]({'where':{'id':_0x16813a['body'][_0x2f74('0x66')],'role':_0x2f74('0x85')},'attributes':['id',_0x2f74('0x5b'),'fullname','email',_0x2f74('0x86')],'raw':!![]});}return null;})[_0x2f74('0x26')](function(_0x4c0688){if(!_0x4c0688)return null;_0x14f566[_0x2f74('0x1c')]['agent']=_0x4c0688;return _0x14f566;})[_0x2f74('0x26')](function(_0xd09e99){if(_0xd09e99){_0xd09e99[_0x2f74('0x1c')][_0x2f74('0x77')]=util['format'](_0x2f74('0x78'),_0x16813a[_0x2f74('0x6a')]['name']);_0xd09e99[_0x2f74('0x1c')][_0x2f74('0x79')]=_0x14f566['channel'];_0xd09e99[_0x2f74('0x1c')][_0x2f74('0x7a')]=_0x14f566['channel'];_0xd09e99[_0x2f74('0x1c')][_0x2f74('0x7b')]=_0x2f74('0x87');_0xd09e99[_0x2f74('0x1c')][_0x2f74('0x4a')]=htmlToText[_0x2f74('0x7c')](_0x14f566[_0x2f74('0x1c')]['body']);respondWithRpcPromise(_0x2f74('0x7d'),_0x2f74('0x7d'),{'event':_0x2f74('0x88'),'message':_0xd09e99[_0x2f74('0x1c')]},client9002);return _0x14f566;}return null;})[_0x2f74('0x26')](respondWithResult(_0xdd6684,null))[_0x2f74('0x1d')](handleError(_0xdd6684,null));};exports['download']=function(_0x1be561,_0x4e374a){var _0x5790aa=moment()[_0x2f74('0x89')]()[_0x2f74('0x8a')]();var _0x37ec47=path[_0x2f74('0x8b')](config[_0x2f74('0x8c')],_0x2f74('0x8d'),'files',_0x2f74('0x8e'));var _0x203a24=path[_0x2f74('0x8b')](config[_0x2f74('0x8c')],_0x2f74('0x8d'),_0x2f74('0x8f'),_0x2f74('0x5a'));var _0x4bc1f7=util[_0x2f74('0x60')]('message-%s.eml',_0x5790aa);return db[_0x2f74('0x2d')][_0x2f74('0x48')]({'where':{'id':_0x1be561[_0x2f74('0x45')]['id']},'attributes':['id','body','from','to','cc','bcc',_0x2f74('0x90'),'createdAt'],'include':_0x1be561[_0x2f74('0x32')]['attachments']?[{'model':db[_0x2f74('0x91')],'as':_0x2f74('0x92')}]:undefined})[_0x2f74('0x26')](handleEntityNotFound(_0x4e374a,null))[_0x2f74('0x26')](function(_0xaf74b3){if(_0xaf74b3){var _0x511719=_0xaf74b3;var _0x235a3e={'from':_0x511719[_0x2f74('0x93')],'to':_0x511719['to'],'subject':_0x511719[_0x2f74('0x90')],'html':htmlEntities['decode'](_0x511719[_0x2f74('0x4a')]),'headers':{'Date':moment(_0x511719[_0x2f74('0x94')])['format'](_0x2f74('0x95'))},'attachments':[]};if(_0xaf74b3['cc']){_0x235a3e[_0x2f74('0x96')]['Cc']=_0xaf74b3['cc'];}if(_0xaf74b3[_0x2f74('0x97')]){_0x235a3e[_0x2f74('0x96')][_0x2f74('0x98')]=_0xaf74b3[_0x2f74('0x97')];}return new BPromise(function(_0x9bda2e,_0x407ab5){if(_0xaf74b3['Attachments']){for(var _0x164c59=0x0;_0x164c59<_0xaf74b3[_0x2f74('0x92')][_0x2f74('0x46')];_0x164c59++){var _0x463cb0=_0xaf74b3[_0x2f74('0x92')][_0x164c59];var _0x17bd9a=path[_0x2f74('0x8b')](_0x203a24,_0x463cb0[_0x2f74('0x5c')]);if(fs[_0x2f74('0x99')](_0x17bd9a)){_0x235a3e[_0x2f74('0x5a')][_0x2f74('0x9a')]({'name':_0x463cb0[_0x2f74('0x5b')],'contentType':_0x463cb0[_0x2f74('0x30')],'data':fs['readFileSync'](_0x17bd9a)});}}}emlformat[_0x2f74('0x9b')](_0x235a3e,function(_0x423e7d,_0x3a8943){if(_0x423e7d)return _0x407ab5(_0x423e7d);fs['writeFileSync'](path['join'](_0x37ec47,_0x4bc1f7),_0x3a8943);return _0x9bda2e(_0x3a8943);});});}})['then'](function(_0x56cd4f){if(_0x56cd4f){return _0x4e374a[_0x2f74('0x9c')](path[_0x2f74('0x8b')](_0x37ec47,_0x4bc1f7),_0x4bc1f7,function(_0x4d30b7){if(!_0x4d30b7)fs[_0x2f74('0x9d')](path[_0x2f74('0x8b')](_0x37ec47,_0x4bc1f7));});}})[_0x2f74('0x1d')](handleError(_0x4e374a,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 97ce0b1..37fc7b9 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 _0xf40a=['save','update','hook','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xf40a,0x123));var _0xaf40=function(_0x4fcd70,_0x109348){_0x4fcd70=_0x4fcd70-0x0;var _0x336588=_0xf40a[_0x4fcd70];return _0x336588;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xaf40('0x0'))['db'][_0xaf40('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xaf40('0x2')](0x0);var events={'afterCreate':_0xaf40('0x3'),'afterUpdate':_0xaf40('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1477f1){return function(_0x4bbe24,_0x1c9516,_0x3aba31){MailMessageEvents['emit'](_0x1477f1+':'+_0x4bbe24['id'],_0x4bbe24);MailMessageEvents['emit'](_0x1477f1,_0x4bbe24);_0x3aba31(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xaf40('0x5')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xc09d=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xc09d,0x1d6));var _0xdc09=function(_0x751044,_0xa9ddec){_0x751044=_0x751044-0x0;var _0x3c7ea1=_0xc09d[_0x751044];return _0x3c7ea1;};'use strict';var EventEmitter=require(_0xdc09('0x0'));var MailMessage=require(_0xdc09('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xdc09('0x2')](0x0);var events={'afterCreate':_0xdc09('0x3'),'afterUpdate':_0xdc09('0x4'),'afterDestroy':_0xdc09('0x5')};function emitEvent(_0x503ce3){return function(_0x69bcbc,_0x478415,_0x1f69a4){MailMessageEvents[_0xdc09('0x6')](_0x503ce3+':'+_0x69bcbc['id'],_0x69bcbc);MailMessageEvents[_0xdc09('0x6')](_0x503ce3,_0x69bcbc);_0x1f69a4(null);};}for(var e in events){if(events[_0xdc09('0x7')](e)){var event=events[e];MailMessage[_0xdc09('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 96771de..b7b2b21 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 _0x30b9=['MailInteraction','MailInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','get','direction','toLowerCase','out','secret','isNil'];(function(_0xd72a25,_0x37edf2){var _0x535d90=function(_0x8e516e){while(--_0x8e516e){_0xd72a25['push'](_0xd72a25['shift']());}};_0x535d90(++_0x37edf2);}(_0x30b9,0x152));var _0x930b=function(_0x1bca6c,_0x95d210){_0x1bca6c=_0x1bca6c-0x0;var _0x5dbcb5=_0x30b9[_0x1bca6c];return _0x5dbcb5;};'use strict';var _=require(_0x930b('0x0'));var util=require(_0x930b('0x1'));var logger=require('../../config/logger')(_0x930b('0x2'));var moment=require(_0x930b('0x3'));var BPromise=require(_0x930b('0x4'));var rp=require('request-promise');var htmlToText=require(_0x930b('0x5'));var fs=require('fs');var path=require(_0x930b('0x6'));var rimraf=require('rimraf');var config=require(_0x930b('0x7'));var attributes=require(_0x930b('0x8'));module[_0x930b('0x9')]=function(_0x39869e,_0x39e33c){return _0x39869e['define'](_0x930b('0xa'),attributes,{'tableName':_0x930b('0xb'),'paranoid':![],'indexes':[{'name':_0x930b('0xc'),'fields':[_0x930b('0xc')]},{'name':_0x930b('0xd'),'fields':[_0x930b('0xe'),_0x930b('0xf')],'type':_0x930b('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a9144,_0x10011b,_0x2c45bb){if(_0x3a9144[_0x930b('0x11')]){_0x3a9144['plainBody']=htmlToText[_0x930b('0x12')](_0x3a9144[_0x930b('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2c45bb(null,_0x10011b);},'afterCreate':function(_0x53a2a3,_0x100a9a,_0x59ef1c){var _0xd3555=_0x39869e['models'];var _0x1d5c05=_0x53a2a3[_0x930b('0x13')]({'plain':!![]});if(_0x1d5c05[_0x930b('0x14')]['toLowerCase']()==='in'||_0x1d5c05[_0x930b('0x14')][_0x930b('0x15')]()===_0x930b('0x16')&&!_0x1d5c05[_0x930b('0x17')]&&!_[_0x930b('0x18')](_0x1d5c05['UserId'])){_0xd3555[_0x930b('0x19')]['findOne']({'where':{'id':_0x1d5c05[_0x930b('0x1a')]}})[_0x930b('0x1b')](function(_0x4a006d){if(_0x4a006d){_0x4a006d[_0x930b('0x1c')]({'lastMsgAt':_0x1d5c05[_0x930b('0x1d')],'lastMsgDirection':_0x1d5c05[_0x930b('0x14')][_0x930b('0x15')]()});}})[_0x930b('0x1e')](function(_0x18eea6){console['error'](_0x18eea6);});}_0x59ef1c();}},'charset':_0x930b('0x1f'),'collate':_0x930b('0x20')});}; \ No newline at end of file +var _0x5dd0=['MailInteractionId','then','update','toLowerCase','catch','error','utf8mb4','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','out','secret','MailInteraction','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5dd0,0x17d));var _0x05dd=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x5dd0[_0x2be8c2];return _0x97f531;};'use strict';var _=require('lodash');var util=require(_0x05dd('0x0'));var logger=require(_0x05dd('0x1'))(_0x05dd('0x2'));var moment=require(_0x05dd('0x3'));var BPromise=require('bluebird');var rp=require(_0x05dd('0x4'));var htmlToText=require(_0x05dd('0x5'));var fs=require('fs');var path=require(_0x05dd('0x6'));var rimraf=require(_0x05dd('0x7'));var config=require(_0x05dd('0x8'));var attributes=require(_0x05dd('0x9'));module[_0x05dd('0xa')]=function(_0x26525a,_0x3184da){return _0x26525a['define'](_0x05dd('0xb'),attributes,{'tableName':_0x05dd('0xc'),'paranoid':![],'indexes':[{'name':_0x05dd('0xd'),'fields':[_0x05dd('0xd')]},{'name':_0x05dd('0xe'),'fields':[_0x05dd('0xf'),_0x05dd('0x10')],'type':_0x05dd('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x164314,_0xd84ff6,_0x2344e2){if(_0x164314[_0x05dd('0x12')]){_0x164314[_0x05dd('0xf')]=htmlToText[_0x05dd('0x13')](_0x164314['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2344e2(null,_0xd84ff6);},'afterCreate':function(_0x31878c,_0x54ec2e,_0x3fbc43){var _0x347f1f=_0x26525a[_0x05dd('0x14')];var _0x40b666=_0x31878c[_0x05dd('0x15')]({'plain':!![]});if(_0x40b666['direction']['toLowerCase']()==='in'||_0x40b666[_0x05dd('0x16')]['toLowerCase']()===_0x05dd('0x17')&&!_0x40b666[_0x05dd('0x18')]&&!_['isNil'](_0x40b666['UserId'])){_0x347f1f[_0x05dd('0x19')][_0x05dd('0x1a')]({'where':{'id':_0x40b666[_0x05dd('0x1b')]}})[_0x05dd('0x1c')](function(_0x6e06a5){if(_0x6e06a5){_0x6e06a5[_0x05dd('0x1d')]({'lastMsgAt':_0x40b666['createdAt'],'lastMsgDirection':_0x40b666['direction'][_0x05dd('0x1e')]()});}})[_0x05dd('0x1f')](function(_0x3d3b63){console[_0x05dd('0x20')](_0x3d3b63);});}_0x3fbc43();}},'charset':_0x05dd('0x21'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 2943b60..46cf7c2 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(_0x16d31d,_0x42290a){var _0x2b137e=function(_0x5b4cb7){while(--_0x5b4cb7){_0x16d31d['push'](_0x16d31d['shift']());}};_0x2b137e(++_0x42290a);}(_0x958a,0x128));var _0xa958=function(_0x284918,_0x36c13a){_0x284918=_0x284918-0x0;var _0x30b343=_0x958a[_0x284918];return _0x30b343;};'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 _0xfff0=['rpc','../../config/environment','client','http','redis','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','create','body','options','CreateMailMessage','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xe9c1f6,_0x1613be){var _0x48c6e5=function(_0xe13783){while(--_0xe13783){_0xe9c1f6['push'](_0xe9c1f6['shift']());}};_0x48c6e5(++_0x1613be);}(_0xfff0,0x139));var _0x0fff=function(_0x11f3d3,_0xe4934c){_0x11f3d3=_0x11f3d3-0x0;var _0x402c1e=_0xfff0[_0x11f3d3];return _0x402c1e;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));var BPromise=require(_0x0fff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fff('0x3'));var db=require(_0x0fff('0x4'))['db'];var utils=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fff('0x8')][_0x0fff('0x9')]({'port':0x232a});config[_0x0fff('0xa')]=_['defaults'](config[_0x0fff('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fff('0xb'))(new Redis(config['redis']));require(_0x0fff('0xc'))[_0x0fff('0xd')](socket);function respondWithRpcPromise(_0x4cc3f3,_0x227d28,_0x377b2f){return new BPromise(function(_0x1de923,_0x289e01){return client[_0x0fff('0xe')](_0x4cc3f3,_0x377b2f)[_0x0fff('0xf')](function(_0x363c0d){logger[_0x0fff('0x10')](_0x0fff('0x11'),_0x227d28,_0x0fff('0x12'));logger[_0x0fff('0x13')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x227d28,_0x0fff('0x12'),JSON['stringify'](_0x363c0d));if(_0x363c0d[_0x0fff('0x14')]){if(_0x363c0d[_0x0fff('0x14')][_0x0fff('0x15')]===0x1f4){logger[_0x0fff('0x14')]('MailMessage,\x20%s,\x20%s',_0x227d28,_0x363c0d['error'][_0x0fff('0x16')]);return _0x289e01(_0x363c0d['error']['message']);}logger['error'](_0x0fff('0x11'),_0x227d28,_0x363c0d[_0x0fff('0x14')]['message']);return _0x1de923(_0x363c0d[_0x0fff('0x14')][_0x0fff('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x227d28,'request\x20sent');_0x1de923(_0x363c0d[_0x0fff('0x17')][_0x0fff('0x16')]);}})[_0x0fff('0x18')](function(_0x3762dc){logger[_0x0fff('0x14')](_0x0fff('0x11'),_0x227d28,_0x3762dc);_0x289e01(_0x3762dc);});});}exports['CreateMailMessage']=function(_0x44a54a){var _0x136520=this;return new Promise(function(_0x48e6f9,_0x49d211){return db['MailMessage'][_0x0fff('0x19')](_0x44a54a[_0x0fff('0x1a')],{'raw':_0x44a54a[_0x0fff('0x1b')]?_0x44a54a[_0x0fff('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x0fff('0xf')](function(_0x2f8665){logger[_0x0fff('0x10')](_0x0fff('0x1c'),_0x44a54a);logger[_0x0fff('0x13')](_0x0fff('0x1c'),_0x44a54a,JSON['stringify'](_0x2f8665));_0x48e6f9(_0x2f8665);})[_0x0fff('0x18')](function(_0x29f702){logger[_0x0fff('0x14')](_0x0fff('0x1c'),_0x29f702[_0x0fff('0x16')],_0x44a54a);_0x49d211(_0x136520[_0x0fff('0x14')](0x1f4,_0x29f702['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 0a9a4f6..c1332fa 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 _0x55e0=['emit','removeListener','register','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0x3dc6f4,_0x362e2a){var _0x3b18e9=function(_0x5bf19e){while(--_0x5bf19e){_0x3dc6f4['push'](_0x3dc6f4['shift']());}};_0x3b18e9(++_0x362e2a);}(_0x55e0,0xdc));var _0x055e=function(_0x210da8,_0x3fe0e1){_0x210da8=_0x210da8-0x0;var _0x4455f7=_0x55e0[_0x210da8];return _0x4455f7;};'use strict';var MailMessageEvents=require(_0x055e('0x0'));var events=[_0x055e('0x1'),_0x055e('0x2'),_0x055e('0x3')];function createListener(_0x5b82b9,_0x578882){return function(_0x3a2ee6){_0x578882[_0x055e('0x4')](_0x5b82b9,_0x3a2ee6);};}function removeListener(_0x33cd7b,_0x2773e4){return function(){MailMessageEvents[_0x055e('0x5')](_0x33cd7b,_0x2773e4);};}exports[_0x055e('0x6')]=function(_0x490ee1){for(var _0x5239f6=0x0,_0x4384ff=events['length'];_0x5239f6<_0x4384ff;_0x5239f6++){var _0x8e7824=events[_0x5239f6];var _0x3c4cf=createListener(_0x055e('0x7')+_0x8e7824,_0x490ee1);MailMessageEvents['on'](_0x8e7824,_0x3c4cf);}}; \ No newline at end of file +var _0x13d9=['mailMessage:','./mailMessage.events','save','remove','update','removeListener','register','length'];(function(_0x4d7dec,_0x38b83c){var _0x5823a6=function(_0x57d06c){while(--_0x57d06c){_0x4d7dec['push'](_0x4d7dec['shift']());}};_0x5823a6(++_0x38b83c);}(_0x13d9,0x181));var _0x913d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x13d9[_0x14add3];return _0x4a174f;};'use strict';var MailMessageEvents=require(_0x913d('0x0'));var events=[_0x913d('0x1'),_0x913d('0x2'),_0x913d('0x3')];function createListener(_0x31eee9,_0x36caad){return function(_0x2cd728){_0x36caad['emit'](_0x31eee9,_0x2cd728);};}function removeListener(_0x3ea4e2,_0x27b9d1){return function(){MailMessageEvents[_0x913d('0x4')](_0x3ea4e2,_0x27b9d1);};}exports[_0x913d('0x5')]=function(_0x271e15){for(var _0x1dd55c=0x0,_0x3bcd3f=events[_0x913d('0x6')];_0x1dd55c<_0x3bcd3f;_0x1dd55c++){var _0x360aa3=events[_0x1dd55c];var _0x475848=createListener(_0x913d('0x7')+_0x360aa3,_0x271e15);MailMessageEvents['on'](_0x360aa3,_0x475848);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index ee514cf..0a6f13d 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 _0x9ad2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','getMembers','/:id/teams','getTeams','getAgents','create','post','addTeams','put','/:id','update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9ad2,0xb4));var _0x29ad=function(_0x11508d,_0x2f54c2){_0x11508d=_0x11508d-0x0;var _0x4f85fa=_0x9ad2[_0x11508d];return _0x4f85fa;};'use strict';var multer=require(_0x29ad('0x0'));var util=require(_0x29ad('0x1'));var path=require(_0x29ad('0x2'));var timeout=require(_0x29ad('0x3'));var express=require(_0x29ad('0x4'));var router=express[_0x29ad('0x5')]();var fs_extra=require(_0x29ad('0x6'));var auth=require(_0x29ad('0x7'));var interaction=require(_0x29ad('0x8'));var config=require(_0x29ad('0x9'));var controller=require(_0x29ad('0xa'));router[_0x29ad('0xb')]('/',auth[_0x29ad('0xc')](),controller[_0x29ad('0xd')]);router['get']('/describe',auth[_0x29ad('0xc')](),controller[_0x29ad('0xe')]);router[_0x29ad('0xb')]('/:id',auth[_0x29ad('0xc')](),controller['show']);router[_0x29ad('0xb')]('/:id/members',auth[_0x29ad('0xc')](),controller[_0x29ad('0xf')]);router[_0x29ad('0xb')](_0x29ad('0x10'),auth[_0x29ad('0xc')](),controller[_0x29ad('0x11')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x29ad('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x29ad('0x13')]);router[_0x29ad('0x14')]('/:id/teams',auth[_0x29ad('0xc')](),controller[_0x29ad('0x15')]);router[_0x29ad('0x14')]('/:id/users',auth[_0x29ad('0xc')](),controller['addAgents']);router[_0x29ad('0x16')](_0x29ad('0x17'),auth[_0x29ad('0xc')](),controller[_0x29ad('0x18')]);router[_0x29ad('0x19')](_0x29ad('0x17'),auth[_0x29ad('0xc')](),controller[_0x29ad('0x1a')]);router[_0x29ad('0x19')](_0x29ad('0x10'),auth[_0x29ad('0xc')](),controller[_0x29ad('0x1b')]);router[_0x29ad('0x19')](_0x29ad('0x1c'),auth['isAuthenticated'](),controller[_0x29ad('0x1d')]);module[_0x29ad('0x1e')]=router; \ No newline at end of file +var _0x4c6b=['getTeams','/:id/users','post','create','put','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','index','/describe','/:id','isAuthenticated','/:id/members','getMembers','/:id/teams'];(function(_0x5afde5,_0x2e7ee9){var _0x9ef10c=function(_0x9e2cf7){while(--_0x9e2cf7){_0x5afde5['push'](_0x5afde5['shift']());}};_0x9ef10c(++_0x2e7ee9);}(_0x4c6b,0x171));var _0xb4c6=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x4c6b[_0x255d5b];return _0x3e141a;};'use strict';var multer=require(_0xb4c6('0x0'));var util=require(_0xb4c6('0x1'));var path=require(_0xb4c6('0x2'));var timeout=require(_0xb4c6('0x3'));var express=require('express');var router=express[_0xb4c6('0x4')]();var fs_extra=require(_0xb4c6('0x5'));var auth=require(_0xb4c6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailQueue.controller');router[_0xb4c6('0x7')]('/',auth['isAuthenticated'](),controller[_0xb4c6('0x8')]);router['get'](_0xb4c6('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xb4c6('0x7')](_0xb4c6('0xa'),auth[_0xb4c6('0xb')](),controller['show']);router[_0xb4c6('0x7')](_0xb4c6('0xc'),auth[_0xb4c6('0xb')](),controller[_0xb4c6('0xd')]);router['get'](_0xb4c6('0xe'),auth[_0xb4c6('0xb')](),controller[_0xb4c6('0xf')]);router[_0xb4c6('0x7')](_0xb4c6('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0xb4c6('0x11')]('/',auth[_0xb4c6('0xb')](),controller[_0xb4c6('0x12')]);router[_0xb4c6('0x11')](_0xb4c6('0xe'),auth[_0xb4c6('0xb')](),controller['addTeams']);router['post'](_0xb4c6('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0xb4c6('0x13')](_0xb4c6('0xa'),auth[_0xb4c6('0xb')](),controller['update']);router[_0xb4c6('0x14')](_0xb4c6('0xa'),auth['isAuthenticated'](),controller[_0xb4c6('0x15')]);router['delete'](_0xb4c6('0xe'),auth[_0xb4c6('0xb')](),controller[_0xb4c6('0x16')]);router[_0xb4c6('0x14')]('/:id/users',auth[_0xb4c6('0xb')](),controller[_0xb4c6('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 65d3ffc..1d607ed 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 _0x2a98=['INTEGER','ENUM','rrmemory','sequelize','exports','STRING'];(function(_0x1e6111,_0x1ea521){var _0x5098c2=function(_0x3430f6){while(--_0x3430f6){_0x1e6111['push'](_0x1e6111['shift']());}};_0x5098c2(++_0x1ea521);}(_0x2a98,0x189));var _0x82a9=function(_0x15be0f,_0x3302d3){_0x15be0f=_0x15be0f-0x0;var _0x4345a7=_0x2a98[_0x15be0f];return _0x4345a7;};'use strict';var Sequelize=require(_0x82a9('0x0'));module[_0x82a9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x82a9('0x2')]},'timeout':{'type':Sequelize[_0x82a9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x82a9('0x4')](_0x82a9('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xf8af=['name','INTEGER','ENUM','beepall','roundrobin','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf8af,0xfa));var _0xff8a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf8af[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xff8a('0x0'));module['exports']={'name':{'type':Sequelize[_0xff8a('0x1')],'unique':_0xff8a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xff8a('0x1')]},'timeout':{'type':Sequelize[_0xff8a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xff8a('0x4')]('rrmemory',_0xff8a('0x5'),_0xff8a('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 095b55e..8994b9e 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 _0xabc7=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','emit','userMailQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','limit','count','set','Content-Range','then','destroy','get','MailQueues','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','MailQueue','include','query','findAll','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','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','body','describe','findOne','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','createdAt','rows','format','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','userMailQueue:save','removeTeams','select','from','join'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xabc7,0x182));var _0x7abc=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xabc7[_0x4d8ed9];return _0x1e2140;};'use strict';var BPromise=require(_0x7abc('0x0'));var util=require(_0x7abc('0x1'));var _=require(_0x7abc('0x2'));var squel=require(_0x7abc('0x3'));var Redis=require('ioredis');var qs=require(_0x7abc('0x4'));var logger=require(_0x7abc('0x5'))(_0x7abc('0x6'));var config=require(_0x7abc('0x7'));var db=require('../../mysqldb')['db'];config[_0x7abc('0x8')]=_[_0x7abc('0x9')](config['redis'],{'host':_0x7abc('0xa'),'port':0x18eb});var socket=require(_0x7abc('0xb'))(new Redis(config[_0x7abc('0x8')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x3dffe8,_0x104388){_0x104388=_0x104388||0xcc;return function(_0x16640f){if(_0x16640f){return _0x3dffe8[_0x7abc('0xc')](_0x104388);}return _0x3dffe8['status'](_0x104388)[_0x7abc('0xd')]();};}function respondWithResult(_0x195065,_0x3ac03b){_0x3ac03b=_0x3ac03b||0xc8;return function(_0x4e1416){if(_0x4e1416){return _0x195065[_0x7abc('0xe')](_0x3ac03b)[_0x7abc('0xf')](_0x4e1416);}};}function respondWithFilteredResult(_0x3877ba,_0x2f3df3){return function(_0x2ba529){if(_0x2ba529){var _0x44009f=typeof _0x2f3df3[_0x7abc('0x10')]==='undefined'&&typeof _0x2f3df3[_0x7abc('0x11')]==='undefined';var _0x3894fa=_0x2ba529[_0x7abc('0x12')];var _0x769e92=_0x44009f?0x0:_0x2f3df3['offset'];var _0x30729f=_0x44009f?_0x2ba529['count']:_0x2f3df3[_0x7abc('0x10')]+_0x2f3df3['limit'];var _0xc7c37f;if(_0x30729f>=_0x3894fa){_0x30729f=_0x3894fa;_0xc7c37f=0xc8;}else{_0xc7c37f=0xce;}_0x3877ba['status'](_0xc7c37f);return _0x3877ba[_0x7abc('0x13')](_0x7abc('0x14'),_0x769e92+'-'+_0x30729f+'/'+_0x3894fa)[_0x7abc('0xf')](_0x2ba529);}return null;};}function saveUpdates(_0x3b334b){return function(_0x3f70a2){if(_0x3f70a2){return _0x3f70a2['update'](_0x3b334b)[_0x7abc('0x15')](function(_0x35a505){return _0x35a505;});}return null;};}function removeEntity(_0x51c8c0){return function(_0x122ea7){if(_0x122ea7){return _0x122ea7[_0x7abc('0x16')]()[_0x7abc('0x15')](function(){var _0x2038ca=_0x122ea7[_0x7abc('0x17')]({'plain':!![]});var _0x35e0dc=_0x7abc('0x18');return db['UserProfileResource'][_0x7abc('0x16')]({'where':{'type':_0x35e0dc,'resourceId':_0x2038ca['id']}})[_0x7abc('0x15')](function(){return _0x122ea7;});})[_0x7abc('0x15')](function(){_0x51c8c0[_0x7abc('0xe')](0xcc)[_0x7abc('0xd')]();});}};}function handleEntityNotFound(_0xfc901b){return function(_0x49cb68){if(!_0x49cb68){_0xfc901b[_0x7abc('0xc')](0x194);}return _0x49cb68;};}function handleError(_0x507695,_0x26fdfb){_0x26fdfb=_0x26fdfb||0x1f4;return function(_0x158120){logger['error'](_0x158120['stack']);if(_0x158120[_0x7abc('0x19')]){delete _0x158120['name'];}_0x507695['status'](_0x26fdfb)[_0x7abc('0x1a')](_0x158120);};}exports[_0x7abc('0x1b')]=function(_0x1a3536,_0x28a868){var _0x479197={};var _0x3d6b8f={'count':0x0,'rows':[]};var _0x4a361c=_[_0x7abc('0x1c')](db['MailQueue'][_0x7abc('0x1d')],function(_0x5d8453){return{'name':_0x5d8453[_0x7abc('0x1e')],'type':_0x5d8453[_0x7abc('0x1f')][_0x7abc('0x20')]};});_0x479197=qs[_0x7abc('0x21')](_0x4a361c,_0x1a3536);var _0x18955c={'where':_0x479197[_0x7abc('0x22')]};return db[_0x7abc('0x23')][_0x7abc('0x12')](_0x18955c)['then'](function(_0x25858b){_0x3d6b8f['count']=_0x25858b;_0x479197[_0x7abc('0x24')]=qs[_0x7abc('0x24')](_0x1a3536[_0x7abc('0x25')]);return db['MailQueue'][_0x7abc('0x26')](_0x479197);})[_0x7abc('0x15')](function(_0x226f95){_0x3d6b8f['rows']=_0x226f95;return _0x3d6b8f;})[_0x7abc('0x15')](respondWithFilteredResult(_0x28a868,_0x479197))[_0x7abc('0x27')](handleError(_0x28a868,null));};exports[_0x7abc('0x28')]=function(_0x4b4e41,_0x474b43){var _0x178cb1={'raw':!![],'where':{'id':_0x4b4e41[_0x7abc('0x29')]['id']}},_0x2a64cf={};_0x2a64cf[_0x7abc('0x2a')]=_[_0x7abc('0x2b')](db[_0x7abc('0x23')][_0x7abc('0x1d')]);_0x2a64cf[_0x7abc('0x25')]=_[_0x7abc('0x2b')](_0x4b4e41['query']);_0x2a64cf[_0x7abc('0x2c')]=_[_0x7abc('0x2d')](_0x2a64cf['model'],_0x2a64cf[_0x7abc('0x25')]);_0x178cb1[_0x7abc('0x2e')]=_[_0x7abc('0x2d')](_0x2a64cf[_0x7abc('0x2a')],qs[_0x7abc('0x2f')](_0x4b4e41[_0x7abc('0x25')][_0x7abc('0x2f')]));_0x178cb1[_0x7abc('0x2e')]=_0x178cb1[_0x7abc('0x2e')][_0x7abc('0x30')]?_0x178cb1['attributes']:_0x2a64cf[_0x7abc('0x2a')];if(_0x4b4e41[_0x7abc('0x25')][_0x7abc('0x31')]){_0x178cb1[_0x7abc('0x24')]=[{'all':!![]}];}_0x178cb1=_[_0x7abc('0x32')]({},_0x178cb1,_0x4b4e41[_0x7abc('0x33')]);return db[_0x7abc('0x23')][_0x7abc('0x34')](_0x178cb1)['then'](handleEntityNotFound(_0x474b43,null))[_0x7abc('0x15')](respondWithResult(_0x474b43,null))[_0x7abc('0x27')](handleError(_0x474b43,null));};exports[_0x7abc('0x35')]=function(_0x3acaac,_0x2a9e69){return db['MailQueue']['create'](_0x3acaac['body'],{})[_0x7abc('0x15')](function(_0x3e85b8){var _0x30f493=_0x3acaac[_0x7abc('0x36')]['get']({'plain':!![]});if(!_0x30f493)throw new Error(_0x7abc('0x37'));if(_0x30f493[_0x7abc('0x38')]===_0x7abc('0x36')){var _0x186749=_0x3e85b8[_0x7abc('0x17')]({'plain':!![]});var _0x293484='MailQueues';return db[_0x7abc('0x39')][_0x7abc('0x34')]({'where':{'name':_0x293484,'userProfileId':_0x30f493[_0x7abc('0x3a')]},'raw':!![]})[_0x7abc('0x15')](function(_0x5d1581){if(_0x5d1581&&_0x5d1581[_0x7abc('0x3b')]===0x0){return db[_0x7abc('0x3c')][_0x7abc('0x35')]({'name':_0x186749[_0x7abc('0x19')],'resourceId':_0x186749['id'],'type':_0x5d1581[_0x7abc('0x19')],'sectionId':_0x5d1581['id']},{})[_0x7abc('0x15')](function(){return _0x3e85b8;});}else{return _0x3e85b8;}})['catch'](function(_0x46427f){logger[_0x7abc('0x3d')](_0x7abc('0x3e'),_0x46427f);throw _0x46427f;});}return _0x3e85b8;})['then'](respondWithResult(_0x2a9e69,0xc9))[_0x7abc('0x27')](handleError(_0x2a9e69,null));};exports[_0x7abc('0x3f')]=function(_0xac293,_0x448d72){if(_0xac293[_0x7abc('0x40')]['id']){delete _0xac293[_0x7abc('0x40')]['id'];}return db[_0x7abc('0x23')][_0x7abc('0x34')]({'where':{'id':_0xac293[_0x7abc('0x29')]['id']}})[_0x7abc('0x15')](handleEntityNotFound(_0x448d72,null))[_0x7abc('0x15')](saveUpdates(_0xac293[_0x7abc('0x40')],null))[_0x7abc('0x15')](respondWithResult(_0x448d72,null))[_0x7abc('0x27')](handleError(_0x448d72,null));};exports['destroy']=function(_0x451e06,_0x42cffc){return db[_0x7abc('0x23')]['find']({'where':{'id':_0x451e06[_0x7abc('0x29')]['id']}})['then'](handleEntityNotFound(_0x42cffc,null))['then'](removeEntity(_0x42cffc,null))[_0x7abc('0x27')](handleError(_0x42cffc,null));};exports[_0x7abc('0x41')]=function(_0xa22643,_0x52d1ca){return db['MailQueue'][_0x7abc('0x41')]()[_0x7abc('0x15')](respondWithResult(_0x52d1ca,null))[_0x7abc('0x27')](handleError(_0x52d1ca,null));};exports['getMembers']=function(_0x1ad3c4,_0x326fea){var _0xab63b8={'raw':!![],'where':{}},_0x53158b={},_0x3d0041;return db[_0x7abc('0x23')][_0x7abc('0x42')]({'where':{'id':_0x1ad3c4[_0x7abc('0x29')]['id']}})[_0x7abc('0x15')](handleEntityNotFound(_0x326fea,null))['then'](function(_0x52b886){if(_0x52b886){_0x3d0041=_0x52b886[_0x7abc('0x17')]({'plain':!![]});_0x53158b['model']=_[_0x7abc('0x2b')](db['UserMailQueue']['rawAttributes']);_0x53158b[_0x7abc('0x25')]=_[_0x7abc('0x2b')](_0x1ad3c4[_0x7abc('0x25')]);_0x53158b[_0x7abc('0x2c')]=_[_0x7abc('0x2d')](_0x53158b[_0x7abc('0x2a')],_0x53158b['query']);_0xab63b8[_0x7abc('0x2e')]=_['intersection'](_0x53158b[_0x7abc('0x2a')],qs[_0x7abc('0x2f')](_0x1ad3c4['query'][_0x7abc('0x2f')]));_0xab63b8[_0x7abc('0x2e')]=_0xab63b8[_0x7abc('0x2e')][_0x7abc('0x30')]?_0xab63b8[_0x7abc('0x2e')]:_0x53158b[_0x7abc('0x2a')];if(!_0x1ad3c4[_0x7abc('0x25')][_0x7abc('0x43')](_0x7abc('0x44'))){_0xab63b8[_0x7abc('0x11')]=qs[_0x7abc('0x11')](_0x1ad3c4[_0x7abc('0x25')]['limit']);_0xab63b8[_0x7abc('0x10')]=qs[_0x7abc('0x10')](_0x1ad3c4[_0x7abc('0x25')]['offset']);}_0xab63b8[_0x7abc('0x45')]=qs[_0x7abc('0x46')](_0x1ad3c4['query'][_0x7abc('0x46')]);_0xab63b8[_0x7abc('0x22')]=qs['filters'](_[_0x7abc('0x47')](_0x1ad3c4[_0x7abc('0x25')],_0x53158b[_0x7abc('0x2c')]));_0xab63b8[_0x7abc('0x22')][_0x7abc('0x48')]=_0x52b886['id'];if(_0x1ad3c4[_0x7abc('0x25')][_0x7abc('0x49')]){_0xab63b8[_0x7abc('0x22')]=_[_0x7abc('0x32')](_0xab63b8[_0x7abc('0x22')],{'$or':_[_0x7abc('0x1c')](_0xab63b8[_0x7abc('0x2e')],function(_0x56853f){var _0x1bdb39={};_0x1bdb39[_0x56853f]={'$like':'%'+_0x1ad3c4[_0x7abc('0x25')][_0x7abc('0x49')]+'%'};return _0x1bdb39;})});}_0xab63b8=_[_0x7abc('0x32')]({},_0xab63b8,_0x1ad3c4[_0x7abc('0x33')]);return db[_0x7abc('0x4a')]['findAll'](_0xab63b8);}})[_0x7abc('0x15')](function(_0x2cf0fe){if(_0x2cf0fe){return db[_0x7abc('0x4b')][_0x7abc('0x4c')]({'where':{'id':_[_0x7abc('0x1c')](_0x2cf0fe,_0x7abc('0x4d')),'role':_0x7abc('0x4e')},'attributes':['id',_0x7abc('0x19'),_0x7abc('0x4f'),'updatedAt',_0x7abc('0x50')]});}})[_0x7abc('0x15')](function(_0x38d699){if(_0x38d699){return{'count':_0x38d699['count'],'rows':_[_0x7abc('0x1c')](_0x38d699[_0x7abc('0x51')],function(_0x1a4ef1){return{'membername':_0x1a4ef1[_0x7abc('0x19')],'UserId':_0x1a4ef1['id'],'queue_name':_0x3d0041[_0x7abc('0x19')],'MailQueueId':_0x3d0041['id'],'interface':util[_0x7abc('0x52')]('%s/%s',_0x7abc('0x53'),_0x1a4ef1[_0x7abc('0x19')]),'penalty':0x0,'paused':_0x1a4ef1[_0x7abc('0x4f')],'createdAt':_0x1a4ef1[_0x7abc('0x50')],'updatedAt':_0x1a4ef1[_0x7abc('0x54')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7abc('0x15')](respondWithFilteredResult(_0x326fea,_0xab63b8))[_0x7abc('0x27')](handleError(_0x326fea,null));};exports[_0x7abc('0x55')]=function(_0x39636c,_0xc1235e){var _0x2415aa={};var _0x4d4ad8={};var _0x59d5c8;var _0x838bd5;return db[_0x7abc('0x23')][_0x7abc('0x42')]({'where':{'id':_0x39636c['params']['id']}})['then'](handleEntityNotFound(_0xc1235e,null))[_0x7abc('0x15')](function(_0x24c156){if(_0x24c156){_0x59d5c8=_0x24c156;_0x4d4ad8[_0x7abc('0x2a')]=_[_0x7abc('0x2b')](db[_0x7abc('0x56')]['rawAttributes']);_0x4d4ad8[_0x7abc('0x25')]=_[_0x7abc('0x2b')](_0x39636c[_0x7abc('0x25')]);_0x4d4ad8['filters']=_['intersection'](_0x4d4ad8[_0x7abc('0x2a')],_0x4d4ad8[_0x7abc('0x25')]);_0x2415aa[_0x7abc('0x2e')]=_[_0x7abc('0x2d')](_0x4d4ad8[_0x7abc('0x2a')],qs[_0x7abc('0x2f')](_0x39636c[_0x7abc('0x25')]['fields']));_0x2415aa[_0x7abc('0x2e')]=_0x2415aa[_0x7abc('0x2e')][_0x7abc('0x30')]?_0x2415aa[_0x7abc('0x2e')]:_0x4d4ad8[_0x7abc('0x2a')];_0x2415aa[_0x7abc('0x45')]=qs[_0x7abc('0x46')](_0x39636c['query'][_0x7abc('0x46')]);_0x2415aa[_0x7abc('0x22')]=qs['filters'](_[_0x7abc('0x47')](_0x39636c[_0x7abc('0x25')],_0x4d4ad8[_0x7abc('0x2c')]));if(_0x39636c[_0x7abc('0x25')][_0x7abc('0x49')]){_0x2415aa[_0x7abc('0x22')]=_[_0x7abc('0x32')](_0x2415aa[_0x7abc('0x22')],{'$or':_['map'](_0x2415aa[_0x7abc('0x2e')],function(_0xfdde0c){var _0x504661={};_0x504661[_0xfdde0c]={'$like':'%'+_0x39636c['query'][_0x7abc('0x49')]+'%'};return _0x504661;})});}_0x2415aa=_['merge']({},_0x2415aa,_0x39636c[_0x7abc('0x33')]);return _0x59d5c8['getTeams'](_0x2415aa);}})[_0x7abc('0x15')](function(_0x33f367){if(_0x33f367){_0x838bd5=_0x33f367[_0x7abc('0x30')];if(!_0x39636c[_0x7abc('0x25')][_0x7abc('0x43')]('nolimit')){_0x2415aa[_0x7abc('0x11')]=qs['limit'](_0x39636c[_0x7abc('0x25')][_0x7abc('0x11')]);_0x2415aa['offset']=qs[_0x7abc('0x10')](_0x39636c[_0x7abc('0x25')][_0x7abc('0x10')]);}return _0x59d5c8[_0x7abc('0x55')](_0x2415aa);}})['then'](function(_0x59dc3f){if(_0x59dc3f){return _0x59dc3f?{'count':_0x838bd5,'rows':_0x59dc3f}:null;}})[_0x7abc('0x15')](respondWithResult(_0xc1235e,null))[_0x7abc('0x27')](handleError(_0xc1235e,null));};exports[_0x7abc('0x57')]=function(_0x5be033,_0x4b3a7a){var _0x49c0ae=_0x5be033[_0x7abc('0x40')][_0x7abc('0x58')];return db[_0x7abc('0x56')][_0x7abc('0x26')]({'where':{'id':_0x49c0ae},'attributes':['id'],'include':[{'model':db[_0x7abc('0x4b')],'as':_0x7abc('0x59'),'attributes':['id',_0x7abc('0x19'),'online',_0x7abc('0x5a'),_0x7abc('0x5b')],'raw':!![]}]})[_0x7abc('0x15')](function(_0x439c5d){if(_0x439c5d){var _0x32e3ad=_[_0x7abc('0x5c')](_0x439c5d,function(_0x4c9f26){var _0x18d54b=_0x4c9f26['get']({'plain':!![]});return _0x18d54b[_0x7abc('0x59')];});return db[_0x7abc('0x23')]['find']({'where':{'id':_0x5be033[_0x7abc('0x29')]['id']}})[_0x7abc('0x15')](function(_0x53422a){return db[_0x7abc('0x5d')][_0x7abc('0x5e')](function(_0x428fb1){return _0x53422a['addTeams'](_0x49c0ae,{'transaction':_0x428fb1})['then'](function(){return BPromise[_0x7abc('0x5f')](_0x32e3ad,function(_0x245f5c){return db[_0x7abc('0x4a')][_0x7abc('0x60')]({'where':{'UserId':_0x245f5c['id'],'MailQueueId':_0x5be033[_0x7abc('0x29')]['id']},'transaction':_0x428fb1});});})[_0x7abc('0x15')](function(){_0x32e3ad['forEach'](function(_0x3ed9d9){socket['emit'](_0x7abc('0x61'),{'UserId':_0x3ed9d9['id'],'MailQueueId':_0x53422a['id']});});});});});}})[_0x7abc('0x15')](respondWithStatusCode(_0x4b3a7a,null))[_0x7abc('0x27')](handleError(_0x4b3a7a,null));};exports[_0x7abc('0x62')]=function(_0x298c8b,_0x21f6f3){return db['Team'][_0x7abc('0x26')]({'where':{'id':_0x298c8b[_0x7abc('0x25')][_0x7abc('0x58')]},'attributes':['id'],'include':[{'model':db[_0x7abc('0x4b')],'as':_0x7abc('0x59'),'attributes':['id'],'raw':!![]}]})[_0x7abc('0x15')](handleEntityNotFound(_0x21f6f3,null))['then'](function(_0x15dcaa){var _0x342862=_[_0x7abc('0x1c')](_0x15dcaa,'id');var _0x51ee0d=[];var _0x4b12be=[];var _0x4a173e=squel[_0x7abc('0x63')]();_0x4a173e['field']('tq.TeamId')[_0x7abc('0x64')]('team_has_mail_queues','tq')[_0x7abc('0x65')](_0x7abc('0x66'),'ut',_0x7abc('0x67'))[_0x7abc('0x22')](_0x7abc('0x68'),_0x298c8b[_0x7abc('0x29')]['id']);for(var _0x3dc8b8=0x0;_0x3dc8b8<_0x15dcaa['length'];_0x3dc8b8+=0x1){let _0x490ff6=_0x15dcaa[_0x3dc8b8];for(var _0x434034=0x0;_0x434034<_0x490ff6[_0x7abc('0x59')][_0x7abc('0x30')];_0x434034+=0x1){let _0x3967e8=_0x490ff6[_0x7abc('0x59')][_0x434034];var _0x11647d=_0x4a173e['clone']();_0x11647d[_0x7abc('0x22')](_0x7abc('0x69'),_0x3967e8['id']);_0x4b12be[_0x7abc('0x6a')](db[_0x7abc('0x5d')][_0x7abc('0x25')](_0x11647d['toString'](),{'type':db[_0x7abc('0x5d')][_0x7abc('0x6b')][_0x7abc('0x6c')]})[_0x7abc('0x15')](function(_0x2ae291){if(_0x2ae291[_0x7abc('0x30')]===0x1){return _0x3967e8['id'];}else{var _0x437122=_[_0x7abc('0x6d')](_[_0x7abc('0x1c')](_0x2ae291,_0x7abc('0x6e')),function(_0x19f93b){return _[_0x7abc('0x6f')](_0x342862,_0x19f93b);});if(_0x437122){return _0x3967e8['id'];}}}));}}return BPromise[_0x7abc('0x70')](_0x4b12be)[_0x7abc('0x15')](function(_0x44ea0d){_0x51ee0d=_(_0x51ee0d)[_0x7abc('0x71')](_0x44ea0d)['compact']()['value']();return db['MailQueue'][_0x7abc('0x34')]({'where':{'id':_0x298c8b[_0x7abc('0x29')]['id']}})[_0x7abc('0x15')](function(_0x552d3d){return db[_0x7abc('0x5d')][_0x7abc('0x5e')](function(_0x5ed941){return _0x552d3d[_0x7abc('0x62')](_0x298c8b[_0x7abc('0x25')][_0x7abc('0x58')],{'transaction':_0x5ed941})['then'](function(){if(!_[_0x7abc('0x72')](_0x51ee0d)){return _0x552d3d['removeAgents'](_0x51ee0d,{'transaction':_0x5ed941});}})[_0x7abc('0x15')](function(){_0x51ee0d['forEach'](function(_0x54ef28){socket[_0x7abc('0x73')](_0x7abc('0x74'),{'UserId':_0x54ef28,'MailQueueId':_0x552d3d['id']});});});});});});})[_0x7abc('0x15')](respondWithStatusCode(_0x21f6f3,null))[_0x7abc('0x27')](handleError(_0x21f6f3,null));};exports['addAgents']=function(_0x4397c7,_0x168696){return db['MailQueue']['find']({'where':{'id':_0x4397c7[_0x7abc('0x29')]['id']}})['then'](handleEntityNotFound(_0x168696,null))[_0x7abc('0x15')](function(_0x17f252){if(_0x17f252){return _0x17f252[_0x7abc('0x75')](_0x4397c7['body']['ids'],_[_0x7abc('0x76')](_0x4397c7['body'],[_0x7abc('0x58'),'id'])||{})['spread'](function(_0x3bec94){for(var _0x17bd32=0x0;_0x17bd32<_0x4397c7[_0x7abc('0x40')][_0x7abc('0x58')][_0x7abc('0x30')];_0x17bd32+=0x1){socket['emit'](_0x7abc('0x61'),{'UserId':Number(_0x4397c7[_0x7abc('0x40')][_0x7abc('0x58')][_0x17bd32]),'MailQueueId':Number(_0x4397c7[_0x7abc('0x29')]['id'])});}return _0x3bec94;});}})[_0x7abc('0x15')](respondWithResult(_0x168696,null))[_0x7abc('0x27')](handleError(_0x168696,null));};exports[_0x7abc('0x77')]=function(_0x5401cd,_0x34ca6f){return db[_0x7abc('0x23')]['find']({'where':{'id':_0x5401cd['params']['id']}})[_0x7abc('0x15')](handleEntityNotFound(_0x34ca6f,null))[_0x7abc('0x15')](function(_0x528ca5){if(_0x528ca5){return _0x528ca5['removeAgents'](_0x5401cd['query'][_0x7abc('0x58')])[_0x7abc('0x15')](function(){if(_[_0x7abc('0x78')](_0x5401cd[_0x7abc('0x25')][_0x7abc('0x58')])){for(var _0x3c963f=0x0;_0x3c963f<_0x5401cd[_0x7abc('0x25')]['ids'][_0x7abc('0x30')];_0x3c963f+=0x1){socket[_0x7abc('0x73')](_0x7abc('0x74'),{'UserId':Number(_0x5401cd[_0x7abc('0x25')][_0x7abc('0x58')][_0x3c963f]),'MailQueueId':Number(_0x5401cd[_0x7abc('0x29')]['id'])});}}else{socket[_0x7abc('0x73')](_0x7abc('0x74'),{'UserId':Number(_0x5401cd[_0x7abc('0x25')]['ids']),'MailQueueId':Number(_0x5401cd[_0x7abc('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x34ca6f,null))[_0x7abc('0x27')](handleError(_0x34ca6f,null));};exports[_0x7abc('0x79')]=function(_0x55414f,_0x569c39){var _0x377335={};var _0x248ff5={};var _0x3bdd1e;var _0x202cee;return db['MailQueue'][_0x7abc('0x42')]({'where':{'id':_0x55414f[_0x7abc('0x29')]['id']}})[_0x7abc('0x15')](handleEntityNotFound(_0x569c39,null))[_0x7abc('0x15')](function(_0x42188d){if(_0x42188d){_0x3bdd1e=_0x42188d;_0x248ff5[_0x7abc('0x2a')]=_[_0x7abc('0x2b')](db[_0x7abc('0x4b')][_0x7abc('0x1d')]);_0x248ff5[_0x7abc('0x25')]=_[_0x7abc('0x2b')](_0x55414f[_0x7abc('0x25')]);_0x248ff5[_0x7abc('0x2c')]=_[_0x7abc('0x2d')](_0x248ff5[_0x7abc('0x2a')],_0x248ff5[_0x7abc('0x25')]);_0x377335[_0x7abc('0x2e')]=_[_0x7abc('0x2d')](_0x248ff5[_0x7abc('0x2a')],qs['fields'](_0x55414f[_0x7abc('0x25')][_0x7abc('0x2f')]));_0x377335[_0x7abc('0x2e')]=_0x377335[_0x7abc('0x2e')][_0x7abc('0x30')]?_0x377335[_0x7abc('0x2e')]:_0x248ff5[_0x7abc('0x2a')];_0x377335[_0x7abc('0x45')]=qs[_0x7abc('0x46')](_0x55414f[_0x7abc('0x25')][_0x7abc('0x46')]);_0x377335[_0x7abc('0x22')]=qs[_0x7abc('0x2c')](_['pick'](_0x55414f[_0x7abc('0x25')],_0x248ff5[_0x7abc('0x2c')]));if(_0x55414f[_0x7abc('0x25')][_0x7abc('0x49')]){_0x377335[_0x7abc('0x22')]=_[_0x7abc('0x32')](_0x377335[_0x7abc('0x22')],{'$or':_[_0x7abc('0x1c')](_0x377335[_0x7abc('0x2e')],function(_0x488a57){var _0x4532fe={};_0x4532fe[_0x488a57]={'$like':'%'+_0x55414f['query']['filter']+'%'};return _0x4532fe;})});}_0x377335=_[_0x7abc('0x32')]({},_0x377335,_0x55414f['options']);return _0x3bdd1e[_0x7abc('0x79')](_0x377335);}})['then'](function(_0x18906f){if(_0x18906f){_0x202cee=_0x18906f[_0x7abc('0x30')];if(!_0x55414f['query'][_0x7abc('0x43')](_0x7abc('0x44'))){_0x377335[_0x7abc('0x11')]=qs['limit'](_0x55414f[_0x7abc('0x25')][_0x7abc('0x11')]);_0x377335[_0x7abc('0x10')]=qs[_0x7abc('0x10')](_0x55414f[_0x7abc('0x25')][_0x7abc('0x10')]);}return _0x3bdd1e[_0x7abc('0x79')](_0x377335);}})['then'](function(_0x112883){if(_0x112883){return _0x112883?{'count':_0x202cee,'rows':_0x112883}:null;}})[_0x7abc('0x15')](respondWithResult(_0x569c39,null))[_0x7abc('0x27')](handleError(_0x569c39,null));}; \ No newline at end of file +var _0x6fb4=['intersection','fields','attributes','length','includeAll','merge','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','sort','pick','MailQueueId','filter','options','User','findAndCountAll','UserId','agent','mailPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','order','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','update','then','destroy','get','MailQueues','end','error','stack','name','index','map','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','findAll','params','model','query','keys','filters'];(function(_0x1bc63c,_0x4fab1b){var _0xd9df03=function(_0x406fbc){while(--_0x406fbc){_0x1bc63c['push'](_0x1bc63c['shift']());}};_0xd9df03(++_0x4fab1b);}(_0x6fb4,0x1c3));var _0x46fb=function(_0x2cbd44,_0x2082a8){_0x2cbd44=_0x2cbd44-0x0;var _0x104514=_0x6fb4[_0x2cbd44];return _0x104514;};'use strict';var BPromise=require(_0x46fb('0x0'));var util=require(_0x46fb('0x1'));var _=require(_0x46fb('0x2'));var squel=require(_0x46fb('0x3'));var Redis=require(_0x46fb('0x4'));var qs=require(_0x46fb('0x5'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x46fb('0x6'))['db'];config[_0x46fb('0x7')]=_['defaults'](config[_0x46fb('0x7')],{'host':_0x46fb('0x8'),'port':0x18eb});var socket=require(_0x46fb('0x9'))(new Redis(config[_0x46fb('0x7')]));require(_0x46fb('0xa'))[_0x46fb('0xb')](socket);function respondWithStatusCode(_0x132938,_0x1fd924){_0x1fd924=_0x1fd924||0xcc;return function(_0x4e31c2){if(_0x4e31c2){return _0x132938[_0x46fb('0xc')](_0x1fd924);}return _0x132938[_0x46fb('0xd')](_0x1fd924)['end']();};}function respondWithResult(_0x3339a2,_0x3298f0){_0x3298f0=_0x3298f0||0xc8;return function(_0x3091e7){if(_0x3091e7){return _0x3339a2[_0x46fb('0xd')](_0x3298f0)[_0x46fb('0xe')](_0x3091e7);}};}function respondWithFilteredResult(_0x35175b,_0x3568d2){return function(_0x490337){if(_0x490337){var _0x568eaa=typeof _0x3568d2[_0x46fb('0xf')]==='undefined'&&typeof _0x3568d2[_0x46fb('0x10')]==='undefined';var _0x214765=_0x490337[_0x46fb('0x11')];var _0x16de90=_0x568eaa?0x0:_0x3568d2[_0x46fb('0xf')];var _0x21550d=_0x568eaa?_0x490337['count']:_0x3568d2['offset']+_0x3568d2[_0x46fb('0x10')];var _0x3b60cd;if(_0x21550d>=_0x214765){_0x21550d=_0x214765;_0x3b60cd=0xc8;}else{_0x3b60cd=0xce;}_0x35175b[_0x46fb('0xd')](_0x3b60cd);return _0x35175b[_0x46fb('0x12')](_0x46fb('0x13'),_0x16de90+'-'+_0x21550d+'/'+_0x214765)['json'](_0x490337);}return null;};}function saveUpdates(_0x5f59ca){return function(_0x4c52d9){if(_0x4c52d9){return _0x4c52d9[_0x46fb('0x14')](_0x5f59ca)[_0x46fb('0x15')](function(_0xef1696){return _0xef1696;});}return null;};}function removeEntity(_0x45a062){return function(_0x1ff3cd){if(_0x1ff3cd){return _0x1ff3cd[_0x46fb('0x16')]()[_0x46fb('0x15')](function(){var _0x3c107e=_0x1ff3cd[_0x46fb('0x17')]({'plain':!![]});var _0x491fad=_0x46fb('0x18');return db['UserProfileResource'][_0x46fb('0x16')]({'where':{'type':_0x491fad,'resourceId':_0x3c107e['id']}})[_0x46fb('0x15')](function(){return _0x1ff3cd;});})[_0x46fb('0x15')](function(){_0x45a062[_0x46fb('0xd')](0xcc)[_0x46fb('0x19')]();});}};}function handleEntityNotFound(_0x193046){return function(_0x262b8d){if(!_0x262b8d){_0x193046[_0x46fb('0xc')](0x194);}return _0x262b8d;};}function handleError(_0x45aee9,_0xc5cf63){_0xc5cf63=_0xc5cf63||0x1f4;return function(_0x10b623){logger[_0x46fb('0x1a')](_0x10b623[_0x46fb('0x1b')]);if(_0x10b623['name']){delete _0x10b623[_0x46fb('0x1c')];}_0x45aee9[_0x46fb('0xd')](_0xc5cf63)['send'](_0x10b623);};}exports[_0x46fb('0x1d')]=function(_0x14d755,_0x31c952){var _0x261d33={};var _0x4ea863={'count':0x0,'rows':[]};var _0x19a4f4=_[_0x46fb('0x1e')](db[_0x46fb('0x1f')][_0x46fb('0x20')],function(_0xfc9ce6){return{'name':_0xfc9ce6[_0x46fb('0x21')],'type':_0xfc9ce6[_0x46fb('0x22')][_0x46fb('0x23')]};});_0x261d33=qs[_0x46fb('0x24')](_0x19a4f4,_0x14d755);var _0x5d7f1d={'where':_0x261d33[_0x46fb('0x25')]};return db[_0x46fb('0x1f')][_0x46fb('0x11')](_0x5d7f1d)[_0x46fb('0x15')](function(_0x4d152f){_0x4ea863['count']=_0x4d152f;_0x261d33[_0x46fb('0x26')]=qs[_0x46fb('0x26')](_0x14d755['query']);return db[_0x46fb('0x1f')][_0x46fb('0x27')](_0x261d33);})[_0x46fb('0x15')](function(_0x249884){_0x4ea863['rows']=_0x249884;return _0x4ea863;})[_0x46fb('0x15')](respondWithFilteredResult(_0x31c952,_0x261d33))['catch'](handleError(_0x31c952,null));};exports['show']=function(_0x574383,_0x2fb90e){var _0x47c9cd={'raw':!![],'where':{'id':_0x574383[_0x46fb('0x28')]['id']}},_0x2e2820={};_0x2e2820[_0x46fb('0x29')]=_['keys'](db['MailQueue'][_0x46fb('0x20')]);_0x2e2820[_0x46fb('0x2a')]=_[_0x46fb('0x2b')](_0x574383[_0x46fb('0x2a')]);_0x2e2820[_0x46fb('0x2c')]=_[_0x46fb('0x2d')](_0x2e2820['model'],_0x2e2820[_0x46fb('0x2a')]);_0x47c9cd['attributes']=_[_0x46fb('0x2d')](_0x2e2820[_0x46fb('0x29')],qs[_0x46fb('0x2e')](_0x574383[_0x46fb('0x2a')][_0x46fb('0x2e')]));_0x47c9cd[_0x46fb('0x2f')]=_0x47c9cd[_0x46fb('0x2f')][_0x46fb('0x30')]?_0x47c9cd[_0x46fb('0x2f')]:_0x2e2820[_0x46fb('0x29')];if(_0x574383[_0x46fb('0x2a')][_0x46fb('0x31')]){_0x47c9cd[_0x46fb('0x26')]=[{'all':!![]}];}_0x47c9cd=_[_0x46fb('0x32')]({},_0x47c9cd,_0x574383['options']);return db['MailQueue'][_0x46fb('0x33')](_0x47c9cd)[_0x46fb('0x15')](handleEntityNotFound(_0x2fb90e,null))[_0x46fb('0x15')](respondWithResult(_0x2fb90e,null))[_0x46fb('0x34')](handleError(_0x2fb90e,null));};exports[_0x46fb('0x35')]=function(_0x4d7310,_0xfc12b7){return db['MailQueue'][_0x46fb('0x35')](_0x4d7310[_0x46fb('0x36')],{})[_0x46fb('0x15')](function(_0x37c3a6){var _0x451452=_0x4d7310['user']['get']({'plain':!![]});if(!_0x451452)throw new Error(_0x46fb('0x37'));if(_0x451452[_0x46fb('0x38')]===_0x46fb('0x39')){var _0x44548b=_0x37c3a6[_0x46fb('0x17')]({'plain':!![]});var _0x1c7d90='MailQueues';return db['UserProfileSection'][_0x46fb('0x33')]({'where':{'name':_0x1c7d90,'userProfileId':_0x451452['userProfileId']},'raw':!![]})[_0x46fb('0x15')](function(_0x132253){if(_0x132253&&_0x132253[_0x46fb('0x3a')]===0x0){return db[_0x46fb('0x3b')][_0x46fb('0x35')]({'name':_0x44548b[_0x46fb('0x1c')],'resourceId':_0x44548b['id'],'type':_0x132253[_0x46fb('0x1c')],'sectionId':_0x132253['id']},{})[_0x46fb('0x15')](function(){return _0x37c3a6;});}else{return _0x37c3a6;}})[_0x46fb('0x34')](function(_0x2ea7b2){logger[_0x46fb('0x1a')](_0x46fb('0x3c'),_0x2ea7b2);throw _0x2ea7b2;});}return _0x37c3a6;})[_0x46fb('0x15')](respondWithResult(_0xfc12b7,0xc9))[_0x46fb('0x34')](handleError(_0xfc12b7,null));};exports['update']=function(_0x1565b1,_0x1c8386){if(_0x1565b1[_0x46fb('0x36')]['id']){delete _0x1565b1[_0x46fb('0x36')]['id'];}return db[_0x46fb('0x1f')]['find']({'where':{'id':_0x1565b1[_0x46fb('0x28')]['id']}})[_0x46fb('0x15')](handleEntityNotFound(_0x1c8386,null))[_0x46fb('0x15')](saveUpdates(_0x1565b1['body'],null))[_0x46fb('0x15')](respondWithResult(_0x1c8386,null))[_0x46fb('0x34')](handleError(_0x1c8386,null));};exports['destroy']=function(_0xa5b4f4,_0x2d5e47){return db['MailQueue'][_0x46fb('0x33')]({'where':{'id':_0xa5b4f4[_0x46fb('0x28')]['id']}})[_0x46fb('0x15')](handleEntityNotFound(_0x2d5e47,null))['then'](removeEntity(_0x2d5e47,null))[_0x46fb('0x34')](handleError(_0x2d5e47,null));};exports[_0x46fb('0x3d')]=function(_0x529397,_0x3358c5){return db[_0x46fb('0x1f')][_0x46fb('0x3d')]()[_0x46fb('0x15')](respondWithResult(_0x3358c5,null))[_0x46fb('0x34')](handleError(_0x3358c5,null));};exports[_0x46fb('0x3e')]=function(_0x1769cc,_0x3dc6c9){var _0x3ffe72={'raw':!![],'where':{}},_0xdb28ba={},_0x560ac8;return db[_0x46fb('0x1f')][_0x46fb('0x3f')]({'where':{'id':_0x1769cc['params']['id']}})[_0x46fb('0x15')](handleEntityNotFound(_0x3dc6c9,null))[_0x46fb('0x15')](function(_0x149d62){if(_0x149d62){_0x560ac8=_0x149d62[_0x46fb('0x17')]({'plain':!![]});_0xdb28ba[_0x46fb('0x29')]=_[_0x46fb('0x2b')](db[_0x46fb('0x40')][_0x46fb('0x20')]);_0xdb28ba['query']=_['keys'](_0x1769cc[_0x46fb('0x2a')]);_0xdb28ba[_0x46fb('0x2c')]=_['intersection'](_0xdb28ba[_0x46fb('0x29')],_0xdb28ba['query']);_0x3ffe72[_0x46fb('0x2f')]=_[_0x46fb('0x2d')](_0xdb28ba['model'],qs[_0x46fb('0x2e')](_0x1769cc[_0x46fb('0x2a')]['fields']));_0x3ffe72['attributes']=_0x3ffe72[_0x46fb('0x2f')][_0x46fb('0x30')]?_0x3ffe72[_0x46fb('0x2f')]:_0xdb28ba['model'];if(!_0x1769cc['query'][_0x46fb('0x41')](_0x46fb('0x42'))){_0x3ffe72[_0x46fb('0x10')]=qs[_0x46fb('0x10')](_0x1769cc[_0x46fb('0x2a')]['limit']);_0x3ffe72[_0x46fb('0xf')]=qs['offset'](_0x1769cc['query'][_0x46fb('0xf')]);}_0x3ffe72['order']=qs[_0x46fb('0x43')](_0x1769cc[_0x46fb('0x2a')][_0x46fb('0x43')]);_0x3ffe72[_0x46fb('0x25')]=qs['filters'](_[_0x46fb('0x44')](_0x1769cc['query'],_0xdb28ba[_0x46fb('0x2c')]));_0x3ffe72[_0x46fb('0x25')][_0x46fb('0x45')]=_0x149d62['id'];if(_0x1769cc[_0x46fb('0x2a')][_0x46fb('0x46')]){_0x3ffe72[_0x46fb('0x25')]=_[_0x46fb('0x32')](_0x3ffe72[_0x46fb('0x25')],{'$or':_[_0x46fb('0x1e')](_0x3ffe72[_0x46fb('0x2f')],function(_0x273581){var _0xb0fee9={};_0xb0fee9[_0x273581]={'$like':'%'+_0x1769cc['query']['filter']+'%'};return _0xb0fee9;})});}_0x3ffe72=_['merge']({},_0x3ffe72,_0x1769cc[_0x46fb('0x47')]);return db[_0x46fb('0x40')][_0x46fb('0x27')](_0x3ffe72);}})[_0x46fb('0x15')](function(_0x53979a){if(_0x53979a){return db[_0x46fb('0x48')][_0x46fb('0x49')]({'where':{'id':_['map'](_0x53979a,_0x46fb('0x4a')),'role':_0x46fb('0x4b')},'attributes':['id',_0x46fb('0x1c'),_0x46fb('0x4c'),_0x46fb('0x4d'),'createdAt']});}})['then'](function(_0x23aec0){if(_0x23aec0){return{'count':_0x23aec0[_0x46fb('0x11')],'rows':_[_0x46fb('0x1e')](_0x23aec0[_0x46fb('0x4e')],function(_0xe2e168){return{'membername':_0xe2e168['name'],'UserId':_0xe2e168['id'],'queue_name':_0x560ac8[_0x46fb('0x1c')],'MailQueueId':_0x560ac8['id'],'interface':util[_0x46fb('0x4f')](_0x46fb('0x50'),_0x46fb('0x51'),_0xe2e168[_0x46fb('0x1c')]),'penalty':0x0,'paused':_0xe2e168['mailPause'],'createdAt':_0xe2e168[_0x46fb('0x52')],'updatedAt':_0xe2e168[_0x46fb('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3dc6c9,_0x3ffe72))['catch'](handleError(_0x3dc6c9,null));};exports[_0x46fb('0x53')]=function(_0x2ca9fe,_0x5ea25d){var _0x50d6ad={};var _0x12c411={};var _0x4269b8;var _0x2894d2;return db['MailQueue'][_0x46fb('0x3f')]({'where':{'id':_0x2ca9fe[_0x46fb('0x28')]['id']}})[_0x46fb('0x15')](handleEntityNotFound(_0x5ea25d,null))['then'](function(_0xc457e8){if(_0xc457e8){_0x4269b8=_0xc457e8;_0x12c411[_0x46fb('0x29')]=_[_0x46fb('0x2b')](db['Team'][_0x46fb('0x20')]);_0x12c411[_0x46fb('0x2a')]=_[_0x46fb('0x2b')](_0x2ca9fe[_0x46fb('0x2a')]);_0x12c411['filters']=_[_0x46fb('0x2d')](_0x12c411[_0x46fb('0x29')],_0x12c411[_0x46fb('0x2a')]);_0x50d6ad[_0x46fb('0x2f')]=_['intersection'](_0x12c411[_0x46fb('0x29')],qs[_0x46fb('0x2e')](_0x2ca9fe[_0x46fb('0x2a')][_0x46fb('0x2e')]));_0x50d6ad[_0x46fb('0x2f')]=_0x50d6ad[_0x46fb('0x2f')][_0x46fb('0x30')]?_0x50d6ad[_0x46fb('0x2f')]:_0x12c411[_0x46fb('0x29')];_0x50d6ad['order']=qs['sort'](_0x2ca9fe[_0x46fb('0x2a')][_0x46fb('0x43')]);_0x50d6ad[_0x46fb('0x25')]=qs[_0x46fb('0x2c')](_[_0x46fb('0x44')](_0x2ca9fe['query'],_0x12c411[_0x46fb('0x2c')]));if(_0x2ca9fe[_0x46fb('0x2a')]['filter']){_0x50d6ad[_0x46fb('0x25')]=_[_0x46fb('0x32')](_0x50d6ad['where'],{'$or':_[_0x46fb('0x1e')](_0x50d6ad[_0x46fb('0x2f')],function(_0x4d6cce){var _0x216f62={};_0x216f62[_0x4d6cce]={'$like':'%'+_0x2ca9fe[_0x46fb('0x2a')][_0x46fb('0x46')]+'%'};return _0x216f62;})});}_0x50d6ad=_[_0x46fb('0x32')]({},_0x50d6ad,_0x2ca9fe[_0x46fb('0x47')]);return _0x4269b8['getTeams'](_0x50d6ad);}})[_0x46fb('0x15')](function(_0xdccfb3){if(_0xdccfb3){_0x2894d2=_0xdccfb3[_0x46fb('0x30')];if(!_0x2ca9fe[_0x46fb('0x2a')][_0x46fb('0x41')]('nolimit')){_0x50d6ad[_0x46fb('0x10')]=qs[_0x46fb('0x10')](_0x2ca9fe[_0x46fb('0x2a')]['limit']);_0x50d6ad[_0x46fb('0xf')]=qs[_0x46fb('0xf')](_0x2ca9fe['query']['offset']);}return _0x4269b8[_0x46fb('0x53')](_0x50d6ad);}})['then'](function(_0x328cdb){if(_0x328cdb){return _0x328cdb?{'count':_0x2894d2,'rows':_0x328cdb}:null;}})[_0x46fb('0x15')](respondWithResult(_0x5ea25d,null))[_0x46fb('0x34')](handleError(_0x5ea25d,null));};exports[_0x46fb('0x54')]=function(_0x357146,_0x57ee3e){var _0x26b60d=_0x357146[_0x46fb('0x36')][_0x46fb('0x55')];return db[_0x46fb('0x56')][_0x46fb('0x27')]({'where':{'id':_0x26b60d},'attributes':['id'],'include':[{'model':db['User'],'as':_0x46fb('0x57'),'attributes':['id',_0x46fb('0x1c'),_0x46fb('0x58'),_0x46fb('0x59'),_0x46fb('0x5a')],'raw':!![]}]})[_0x46fb('0x15')](function(_0x1f7811){if(_0x1f7811){var _0x4678f4=_[_0x46fb('0x5b')](_0x1f7811,function(_0x5345b8){var _0x30a2da=_0x5345b8[_0x46fb('0x17')]({'plain':!![]});return _0x30a2da[_0x46fb('0x57')];});return db[_0x46fb('0x1f')][_0x46fb('0x33')]({'where':{'id':_0x357146[_0x46fb('0x28')]['id']}})[_0x46fb('0x15')](function(_0x387379){return db[_0x46fb('0x5c')][_0x46fb('0x5d')](function(_0x8bfb7e){return _0x387379[_0x46fb('0x54')](_0x26b60d,{'transaction':_0x8bfb7e})[_0x46fb('0x15')](function(){return BPromise[_0x46fb('0x5e')](_0x4678f4,function(_0x165cfc){return db[_0x46fb('0x40')][_0x46fb('0x5f')]({'where':{'UserId':_0x165cfc['id'],'MailQueueId':_0x357146[_0x46fb('0x28')]['id']},'transaction':_0x8bfb7e});});})[_0x46fb('0x15')](function(){_0x4678f4[_0x46fb('0x60')](function(_0x9c79b2){socket[_0x46fb('0x61')](_0x46fb('0x62'),{'UserId':_0x9c79b2['id'],'MailQueueId':_0x387379['id']});});});});});}})[_0x46fb('0x15')](respondWithStatusCode(_0x57ee3e,null))[_0x46fb('0x34')](handleError(_0x57ee3e,null));};exports[_0x46fb('0x63')]=function(_0xffe422,_0x4c6fa4){return db[_0x46fb('0x56')][_0x46fb('0x27')]({'where':{'id':_0xffe422[_0x46fb('0x2a')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x46fb('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4c6fa4,null))[_0x46fb('0x15')](function(_0x31b652){var _0x487e28=_['map'](_0x31b652,'id');var _0x29c642=[];var _0x1f3a04=[];var _0x2d857b=squel[_0x46fb('0x64')]();_0x2d857b[_0x46fb('0x65')]('tq.TeamId')[_0x46fb('0x66')]('team_has_mail_queues','tq')[_0x46fb('0x67')](_0x46fb('0x68'),'ut',_0x46fb('0x69'))[_0x46fb('0x25')](_0x46fb('0x6a'),_0xffe422[_0x46fb('0x28')]['id']);for(var _0x1110ab=0x0;_0x1110ab<_0x31b652[_0x46fb('0x30')];_0x1110ab+=0x1){let _0x28479b=_0x31b652[_0x1110ab];for(var _0x5cd426=0x0;_0x5cd426<_0x28479b[_0x46fb('0x57')][_0x46fb('0x30')];_0x5cd426+=0x1){let _0x1999e4=_0x28479b[_0x46fb('0x57')][_0x5cd426];var _0x38b0e9=_0x2d857b['clone']();_0x38b0e9['where'](_0x46fb('0x6b'),_0x1999e4['id']);_0x1f3a04[_0x46fb('0x6c')](db[_0x46fb('0x5c')][_0x46fb('0x2a')](_0x38b0e9[_0x46fb('0x6d')](),{'type':db[_0x46fb('0x5c')][_0x46fb('0x6e')][_0x46fb('0x6f')]})[_0x46fb('0x15')](function(_0x55b39c){if(_0x55b39c[_0x46fb('0x30')]===0x1){return _0x1999e4['id'];}else{var _0xe691eb=_[_0x46fb('0x70')](_[_0x46fb('0x1e')](_0x55b39c,_0x46fb('0x71')),function(_0x5d9db5){return _[_0x46fb('0x72')](_0x487e28,_0x5d9db5);});if(_0xe691eb){return _0x1999e4['id'];}}}));}}return BPromise['all'](_0x1f3a04)['then'](function(_0x24d54a){_0x29c642=_(_0x29c642)['union'](_0x24d54a)['compact']()['value']();return db[_0x46fb('0x1f')][_0x46fb('0x33')]({'where':{'id':_0xffe422[_0x46fb('0x28')]['id']}})[_0x46fb('0x15')](function(_0x2db90b){return db[_0x46fb('0x5c')][_0x46fb('0x5d')](function(_0xe324e7){return _0x2db90b[_0x46fb('0x63')](_0xffe422[_0x46fb('0x2a')][_0x46fb('0x55')],{'transaction':_0xe324e7})[_0x46fb('0x15')](function(){if(!_[_0x46fb('0x73')](_0x29c642)){return _0x2db90b[_0x46fb('0x74')](_0x29c642,{'transaction':_0xe324e7});}})[_0x46fb('0x15')](function(){_0x29c642[_0x46fb('0x60')](function(_0x49c1ba){socket[_0x46fb('0x61')](_0x46fb('0x75'),{'UserId':_0x49c1ba,'MailQueueId':_0x2db90b['id']});});});});});});})[_0x46fb('0x15')](respondWithStatusCode(_0x4c6fa4,null))[_0x46fb('0x34')](handleError(_0x4c6fa4,null));};exports[_0x46fb('0x76')]=function(_0x43dc0a,_0x58cc7e){return db[_0x46fb('0x1f')][_0x46fb('0x33')]({'where':{'id':_0x43dc0a[_0x46fb('0x28')]['id']}})[_0x46fb('0x15')](handleEntityNotFound(_0x58cc7e,null))[_0x46fb('0x15')](function(_0xb9bbc9){if(_0xb9bbc9){return _0xb9bbc9['addAgents'](_0x43dc0a[_0x46fb('0x36')][_0x46fb('0x55')],_[_0x46fb('0x77')](_0x43dc0a[_0x46fb('0x36')],['ids','id'])||{})[_0x46fb('0x78')](function(_0x28a2ae){for(var _0x400e5=0x0;_0x400e5<_0x43dc0a[_0x46fb('0x36')][_0x46fb('0x55')][_0x46fb('0x30')];_0x400e5+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0x43dc0a[_0x46fb('0x36')][_0x46fb('0x55')][_0x400e5]),'MailQueueId':Number(_0x43dc0a[_0x46fb('0x28')]['id'])});}return _0x28a2ae;});}})['then'](respondWithResult(_0x58cc7e,null))[_0x46fb('0x34')](handleError(_0x58cc7e,null));};exports['removeAgents']=function(_0x364f3c,_0x2142ef){return db[_0x46fb('0x1f')]['find']({'where':{'id':_0x364f3c['params']['id']}})[_0x46fb('0x15')](handleEntityNotFound(_0x2142ef,null))['then'](function(_0x2ee0bb){if(_0x2ee0bb){return _0x2ee0bb[_0x46fb('0x74')](_0x364f3c[_0x46fb('0x2a')]['ids'])[_0x46fb('0x15')](function(){if(_[_0x46fb('0x79')](_0x364f3c['query'][_0x46fb('0x55')])){for(var _0x1235ce=0x0;_0x1235ce<_0x364f3c['query'][_0x46fb('0x55')][_0x46fb('0x30')];_0x1235ce+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x364f3c[_0x46fb('0x2a')][_0x46fb('0x55')][_0x1235ce]),'MailQueueId':Number(_0x364f3c[_0x46fb('0x28')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x364f3c[_0x46fb('0x2a')][_0x46fb('0x55')]),'MailQueueId':Number(_0x364f3c['params']['id'])});}});}})[_0x46fb('0x15')](respondWithStatusCode(_0x2142ef,null))['catch'](handleError(_0x2142ef,null));};exports[_0x46fb('0x7a')]=function(_0x4f660e,_0x175d36){var _0x5e7a7e={};var _0x530dca={};var _0x579c00;var _0x5852f2;return db[_0x46fb('0x1f')][_0x46fb('0x3f')]({'where':{'id':_0x4f660e[_0x46fb('0x28')]['id']}})[_0x46fb('0x15')](handleEntityNotFound(_0x175d36,null))[_0x46fb('0x15')](function(_0x5e7e6f){if(_0x5e7e6f){_0x579c00=_0x5e7e6f;_0x530dca[_0x46fb('0x29')]=_['keys'](db[_0x46fb('0x48')][_0x46fb('0x20')]);_0x530dca[_0x46fb('0x2a')]=_[_0x46fb('0x2b')](_0x4f660e[_0x46fb('0x2a')]);_0x530dca[_0x46fb('0x2c')]=_[_0x46fb('0x2d')](_0x530dca['model'],_0x530dca['query']);_0x5e7a7e[_0x46fb('0x2f')]=_[_0x46fb('0x2d')](_0x530dca[_0x46fb('0x29')],qs[_0x46fb('0x2e')](_0x4f660e[_0x46fb('0x2a')][_0x46fb('0x2e')]));_0x5e7a7e['attributes']=_0x5e7a7e[_0x46fb('0x2f')][_0x46fb('0x30')]?_0x5e7a7e[_0x46fb('0x2f')]:_0x530dca[_0x46fb('0x29')];_0x5e7a7e[_0x46fb('0x7b')]=qs[_0x46fb('0x43')](_0x4f660e['query'][_0x46fb('0x43')]);_0x5e7a7e[_0x46fb('0x25')]=qs[_0x46fb('0x2c')](_[_0x46fb('0x44')](_0x4f660e[_0x46fb('0x2a')],_0x530dca['filters']));if(_0x4f660e['query']['filter']){_0x5e7a7e['where']=_[_0x46fb('0x32')](_0x5e7a7e[_0x46fb('0x25')],{'$or':_[_0x46fb('0x1e')](_0x5e7a7e[_0x46fb('0x2f')],function(_0x337c3f){var _0x5276d7={};_0x5276d7[_0x337c3f]={'$like':'%'+_0x4f660e[_0x46fb('0x2a')]['filter']+'%'};return _0x5276d7;})});}_0x5e7a7e=_['merge']({},_0x5e7a7e,_0x4f660e[_0x46fb('0x47')]);return _0x579c00['getAgents'](_0x5e7a7e);}})[_0x46fb('0x15')](function(_0x23ce44){if(_0x23ce44){_0x5852f2=_0x23ce44['length'];if(!_0x4f660e['query'][_0x46fb('0x41')](_0x46fb('0x42'))){_0x5e7a7e['limit']=qs[_0x46fb('0x10')](_0x4f660e[_0x46fb('0x2a')][_0x46fb('0x10')]);_0x5e7a7e[_0x46fb('0xf')]=qs[_0x46fb('0xf')](_0x4f660e['query'][_0x46fb('0xf')]);}return _0x579c00[_0x46fb('0x7a')](_0x5e7a7e);}})[_0x46fb('0x15')](function(_0x28dd8d){if(_0x28dd8d){return _0x28dd8d?{'count':_0x5852f2,'rows':_0x28dd8d}:null;}})['then'](respondWithResult(_0x175d36,null))[_0x46fb('0x34')](handleError(_0x175d36,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 7bba8c5..2078182 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 _0x3aea=['save','remove','emit','hasOwnProperty','hook'];(function(_0x545720,_0x3a398d){var _0x26b171=function(_0x49990c){while(--_0x49990c){_0x545720['push'](_0x545720['shift']());}};_0x26b171(++_0x3a398d);}(_0x3aea,0x140));var _0xa3ae=function(_0x4b56ac,_0x2f1d0b){_0x4b56ac=_0x4b56ac-0x0;var _0x5e995a=_0x3aea[_0x4b56ac];return _0x5e995a;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa3ae('0x0'),'afterUpdate':'update','afterDestroy':_0xa3ae('0x1')};function emitEvent(_0x37de7f){return function(_0x1bf508,_0x1392e1,_0x2fce5f){MailQueueEvents[_0xa3ae('0x2')](_0x37de7f+':'+_0x1bf508['id'],_0x1bf508);MailQueueEvents[_0xa3ae('0x2')](_0x37de7f,_0x1bf508);_0x2fce5f(null);};}for(var e in events){if(events[_0xa3ae('0x3')](e)){var event=events[e];MailQueue[_0xa3ae('0x4')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x139d=['update','emit','hasOwnProperty','hook','exports','MailQueue','setMaxListeners','save'];(function(_0x33fc5f,_0x34e6ee){var _0xd72c35=function(_0x9b7549){while(--_0x9b7549){_0x33fc5f['push'](_0x33fc5f['shift']());}};_0xd72c35(++_0x34e6ee);}(_0x139d,0x95));var _0xd139=function(_0x30d5d0,_0x337274){_0x30d5d0=_0x30d5d0-0x0;var _0x28df28=_0x139d[_0x30d5d0];return _0x28df28;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0xd139('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd139('0x1')](0x0);var events={'afterCreate':_0xd139('0x2'),'afterUpdate':_0xd139('0x3'),'afterDestroy':'remove'};function emitEvent(_0x282316){return function(_0x11b202,_0x1dfecc,_0x49b3f3){MailQueueEvents[_0xd139('0x4')](_0x282316+':'+_0x11b202['id'],_0x11b202);MailQueueEvents[_0xd139('0x4')](_0x282316,_0x11b202);_0x49b3f3(null);};}for(var e in events){if(events[_0xd139('0x5')](e)){var event=events[e];MailQueue[_0xd139('0x6')](e,emitEvent(event));}}module[_0xd139('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 8ff4a31..292c642 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 _0x8264=['bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','util','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8264,0x1d1));var _0x4826=function(_0x3d2d6f,_0x368872){_0x3d2d6f=_0x3d2d6f-0x0;var _0x5c0022=_0x8264[_0x3d2d6f];return _0x5c0022;};'use strict';var _=require('lodash');var util=require(_0x4826('0x0'));var logger=require(_0x4826('0x1'))('api');var moment=require(_0x4826('0x2'));var BPromise=require(_0x4826('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4826('0x4'));var rimraf=require(_0x4826('0x5'));var config=require(_0x4826('0x6'));var attributes=require(_0x4826('0x7'));module[_0x4826('0x8')]=function(_0x3d67a1,_0x1bde53){return _0x3d67a1[_0x4826('0x9')](_0x4826('0xa'),attributes,{'tableName':_0x4826('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa1f=['bluebird','path','rimraf','exports','define','MailQueue','mail_queues','util','../../config/logger','api'];(function(_0x9a4847,_0x4694d6){var _0x3b6e60=function(_0x4b7042){while(--_0x4b7042){_0x9a4847['push'](_0x9a4847['shift']());}};_0x3b6e60(++_0x4694d6);}(_0xaa1f,0xed));var _0xfaa1=function(_0x4dc627,_0x466c90){_0x4dc627=_0x4dc627-0x0;var _0x30ffb8=_0xaa1f[_0x4dc627];return _0x30ffb8;};'use strict';var _=require('lodash');var util=require(_0xfaa1('0x0'));var logger=require(_0xfaa1('0x1'))(_0xfaa1('0x2'));var moment=require('moment');var BPromise=require(_0xfaa1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfaa1('0x4'));var rimraf=require(_0xfaa1('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0xfaa1('0x6')]=function(_0x2f92aa,_0x53f29c){return _0x2f92aa[_0xfaa1('0x7')](_0xfaa1('0x8'),attributes,{'tableName':_0xfaa1('0x9'),'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 05f9d81..2114c9d 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 _0xf692=['info','result','catch','GetMailQueue','options','raw','where','attributes','limit','model','include','map','ShowMailQueue','MailQueue','find','lodash','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5a5a88,_0x5d0b5b){var _0x2c7efb=function(_0x3cf2d6){while(--_0x3cf2d6){_0x5a5a88['push'](_0x5a5a88['shift']());}};_0x2c7efb(++_0x5d0b5b);}(_0xf692,0x1f0));var _0x2f69=function(_0x17725e,_0x5dddf0){_0x17725e=_0x17725e-0x0;var _0x56a392=_0xf692[_0x17725e];return _0x56a392;};'use strict';var _=require(_0x2f69('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2f69('0x1'));var rs=require(_0x2f69('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2f69('0x3'));var logger=require('../../config/logger')(_0x2f69('0x4'));var config=require(_0x2f69('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2f69('0x6')]['http']({'port':0x232a});config[_0x2f69('0x7')]=_[_0x2f69('0x8')](config[_0x2f69('0x7')],{'host':_0x2f69('0x9'),'port':0x18eb});var socket=require(_0x2f69('0xa'))(new Redis(config['redis']));require(_0x2f69('0xb'))[_0x2f69('0xc')](socket);function respondWithRpcPromise(_0x257366,_0x1da749,_0x874734){return new BPromise(function(_0x5883e7,_0x59e928){return client['request'](_0x257366,_0x874734)[_0x2f69('0xd')](function(_0x123b96){logger['info'](_0x2f69('0xe'),_0x1da749,_0x2f69('0xf'));logger[_0x2f69('0x10')](_0x2f69('0x11'),_0x1da749,_0x2f69('0xf'),JSON[_0x2f69('0x12')](_0x123b96));if(_0x123b96[_0x2f69('0x13')]){if(_0x123b96[_0x2f69('0x13')][_0x2f69('0x14')]===0x1f4){logger[_0x2f69('0x13')](_0x2f69('0xe'),_0x1da749,_0x123b96[_0x2f69('0x13')][_0x2f69('0x15')]);return _0x59e928(_0x123b96[_0x2f69('0x13')]['message']);}logger[_0x2f69('0x13')](_0x2f69('0xe'),_0x1da749,_0x123b96[_0x2f69('0x13')][_0x2f69('0x15')]);return _0x5883e7(_0x123b96[_0x2f69('0x13')][_0x2f69('0x15')]);}else{logger[_0x2f69('0x16')]('MailQueue,\x20%s,\x20%s',_0x1da749,_0x2f69('0xf'));_0x5883e7(_0x123b96[_0x2f69('0x17')][_0x2f69('0x15')]);}})[_0x2f69('0x18')](function(_0x3a6bb6){logger['error'](_0x2f69('0xe'),_0x1da749,_0x3a6bb6);_0x59e928(_0x3a6bb6);});});}exports[_0x2f69('0x19')]=function(_0x474316){var _0x27d7e1=this;return new Promise(function(_0x2efea4,_0x373462){return db['MailQueue']['findAll']({'raw':_0x474316[_0x2f69('0x1a')]?_0x474316[_0x2f69('0x1a')][_0x2f69('0x1b')]===undefined?!![]:![]:!![],'where':_0x474316['options']?_0x474316[_0x2f69('0x1a')][_0x2f69('0x1c')]||null:null,'attributes':_0x474316[_0x2f69('0x1a')]?_0x474316[_0x2f69('0x1a')][_0x2f69('0x1d')]||null:null,'limit':_0x474316[_0x2f69('0x1a')]?_0x474316[_0x2f69('0x1a')][_0x2f69('0x1e')]||null:null,'include':_0x474316[_0x2f69('0x1a')]?_0x474316[_0x2f69('0x1a')]['include']?_['map'](_0x474316['options']['include'],function(_0x3bf950){return{'model':db[_0x3bf950[_0x2f69('0x1f')]],'as':_0x3bf950['as'],'attributes':_0x3bf950[_0x2f69('0x1d')],'include':_0x3bf950[_0x2f69('0x20')]?_['map'](_0x3bf950[_0x2f69('0x20')],function(_0xe7a8d3){return{'model':db[_0xe7a8d3[_0x2f69('0x1f')]],'as':_0xe7a8d3['as'],'attributes':_0xe7a8d3['attributes'],'include':_0xe7a8d3[_0x2f69('0x20')]?_[_0x2f69('0x21')](_0xe7a8d3['include'],function(_0x4499b6){return{'model':db[_0x4499b6[_0x2f69('0x1f')]],'as':_0x4499b6['as'],'attributes':_0x4499b6[_0x2f69('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2f69('0xd')](function(_0x46772e){logger['info']('GetMailQueue',_0x474316);logger[_0x2f69('0x10')](_0x2f69('0x19'),_0x474316,JSON[_0x2f69('0x12')](_0x46772e));_0x2efea4(_0x46772e);})[_0x2f69('0x18')](function(_0x2787e7){logger[_0x2f69('0x13')](_0x2f69('0x19'),_0x2787e7['message'],_0x474316);_0x373462(_0x27d7e1[_0x2f69('0x13')](0x1f4,_0x2787e7['message']));});});};exports[_0x2f69('0x22')]=function(_0x2afb11){var _0x3a4242=this;return new Promise(function(_0x214d18,_0x490b6b){return db[_0x2f69('0x23')][_0x2f69('0x24')]({'raw':_0x2afb11['options']?_0x2afb11['options']['raw']===undefined?!![]:![]:!![],'where':_0x2afb11[_0x2f69('0x1a')]?_0x2afb11[_0x2f69('0x1a')][_0x2f69('0x1c')]||null:null,'attributes':_0x2afb11[_0x2f69('0x1a')]?_0x2afb11[_0x2f69('0x1a')]['attributes']||null:null,'include':_0x2afb11[_0x2f69('0x1a')]?_0x2afb11[_0x2f69('0x1a')]['include']?_[_0x2f69('0x21')](_0x2afb11[_0x2f69('0x1a')]['include'],function(_0x437dfd){return{'model':db[_0x437dfd['model']],'as':_0x437dfd['as'],'attributes':_0x437dfd[_0x2f69('0x1d')],'include':_0x437dfd[_0x2f69('0x20')]?_[_0x2f69('0x21')](_0x437dfd[_0x2f69('0x20')],function(_0x3879f1){return{'model':db[_0x3879f1[_0x2f69('0x1f')]],'as':_0x3879f1['as'],'attributes':_0x3879f1[_0x2f69('0x1d')],'include':_0x3879f1[_0x2f69('0x20')]?_['map'](_0x3879f1['include'],function(_0x1650e2){return{'model':db[_0x1650e2[_0x2f69('0x1f')]],'as':_0x1650e2['as'],'attributes':_0x1650e2[_0x2f69('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fb4d9){logger[_0x2f69('0x16')](_0x2f69('0x22'),_0x2afb11);logger['debug']('ShowMailQueue',_0x2afb11,JSON[_0x2f69('0x12')](_0x3fb4d9));_0x214d18(_0x3fb4d9);})[_0x2f69('0x18')](function(_0x47f305){logger[_0x2f69('0x13')](_0x2f69('0x22'),_0x47f305[_0x2f69('0x15')],_0x2afb11);_0x490b6b(_0x3a4242[_0x2f69('0x13')](0x1f4,_0x47f305['message']));});});}; \ No newline at end of file +var _0x9c02=['request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll','options','raw','where','attributes','limit','include','model','map','debug','GetMailQueue','ShowMailQueue','find','lodash','util','moment','../../config/utils','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./mailQueue.socket','register'];(function(_0xc81459,_0x3da190){var _0x5140f9=function(_0x3dd857){while(--_0x3dd857){_0xc81459['push'](_0xc81459['shift']());}};_0x5140f9(++_0x3da190);}(_0x9c02,0x196));var _0x29c0=function(_0x226442,_0x3e5320){_0x226442=_0x226442-0x0;var _0x564ea5=_0x9c02[_0x226442];return _0x564ea5;};'use strict';var _=require(_0x29c0('0x0'));var util=require(_0x29c0('0x1'));var moment=require(_0x29c0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x29c0('0x3'));var logger=require('../../config/logger')(_0x29c0('0x4'));var config=require('../../config/environment');var jayson=require(_0x29c0('0x5'));var client=jayson['client'][_0x29c0('0x6')]({'port':0x232a});config[_0x29c0('0x7')]=_[_0x29c0('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x29c0('0x9'))(new Redis(config[_0x29c0('0x7')]));require(_0x29c0('0xa'))[_0x29c0('0xb')](socket);function respondWithRpcPromise(_0x27d0da,_0x529b0d,_0x4d9a25){return new BPromise(function(_0x16ba59,_0x59c44e){return client[_0x29c0('0xc')](_0x27d0da,_0x4d9a25)[_0x29c0('0xd')](function(_0x3584ca){logger[_0x29c0('0xe')](_0x29c0('0xf'),_0x529b0d,_0x29c0('0x10'));logger['debug'](_0x29c0('0x11'),_0x529b0d,_0x29c0('0x10'),JSON[_0x29c0('0x12')](_0x3584ca));if(_0x3584ca[_0x29c0('0x13')]){if(_0x3584ca[_0x29c0('0x13')][_0x29c0('0x14')]===0x1f4){logger[_0x29c0('0x13')](_0x29c0('0xf'),_0x529b0d,_0x3584ca[_0x29c0('0x13')][_0x29c0('0x15')]);return _0x59c44e(_0x3584ca[_0x29c0('0x13')][_0x29c0('0x15')]);}logger[_0x29c0('0x13')](_0x29c0('0xf'),_0x529b0d,_0x3584ca[_0x29c0('0x13')][_0x29c0('0x15')]);return _0x16ba59(_0x3584ca[_0x29c0('0x13')][_0x29c0('0x15')]);}else{logger[_0x29c0('0xe')](_0x29c0('0xf'),_0x529b0d,_0x29c0('0x10'));_0x16ba59(_0x3584ca[_0x29c0('0x16')][_0x29c0('0x15')]);}})[_0x29c0('0x17')](function(_0x1bbfc5){logger[_0x29c0('0x13')](_0x29c0('0xf'),_0x529b0d,_0x1bbfc5);_0x59c44e(_0x1bbfc5);});});}exports['GetMailQueue']=function(_0x2c1aad){var _0x6e3271=this;return new Promise(function(_0x171198,_0x3c3eb2){return db[_0x29c0('0x18')][_0x29c0('0x19')]({'raw':_0x2c1aad['options']?_0x2c1aad[_0x29c0('0x1a')][_0x29c0('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c1aad[_0x29c0('0x1a')]?_0x2c1aad[_0x29c0('0x1a')][_0x29c0('0x1c')]||null:null,'attributes':_0x2c1aad['options']?_0x2c1aad[_0x29c0('0x1a')][_0x29c0('0x1d')]||null:null,'limit':_0x2c1aad['options']?_0x2c1aad[_0x29c0('0x1a')][_0x29c0('0x1e')]||null:null,'include':_0x2c1aad[_0x29c0('0x1a')]?_0x2c1aad['options'][_0x29c0('0x1f')]?_['map'](_0x2c1aad[_0x29c0('0x1a')][_0x29c0('0x1f')],function(_0x5561af){return{'model':db[_0x5561af[_0x29c0('0x20')]],'as':_0x5561af['as'],'attributes':_0x5561af[_0x29c0('0x1d')],'include':_0x5561af[_0x29c0('0x1f')]?_[_0x29c0('0x21')](_0x5561af[_0x29c0('0x1f')],function(_0x46be76){return{'model':db[_0x46be76['model']],'as':_0x46be76['as'],'attributes':_0x46be76['attributes'],'include':_0x46be76['include']?_[_0x29c0('0x21')](_0x46be76[_0x29c0('0x1f')],function(_0x4cdf7c){return{'model':db[_0x4cdf7c['model']],'as':_0x4cdf7c['as'],'attributes':_0x4cdf7c[_0x29c0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x29c0('0xd')](function(_0x542b9c){logger['info']('GetMailQueue',_0x2c1aad);logger[_0x29c0('0x22')](_0x29c0('0x23'),_0x2c1aad,JSON[_0x29c0('0x12')](_0x542b9c));_0x171198(_0x542b9c);})['catch'](function(_0x19dd04){logger[_0x29c0('0x13')]('GetMailQueue',_0x19dd04[_0x29c0('0x15')],_0x2c1aad);_0x3c3eb2(_0x6e3271[_0x29c0('0x13')](0x1f4,_0x19dd04[_0x29c0('0x15')]));});});};exports[_0x29c0('0x24')]=function(_0x46bfd1){var _0x190425=this;return new Promise(function(_0x3452ca,_0x4c2bed){return db['MailQueue'][_0x29c0('0x25')]({'raw':_0x46bfd1[_0x29c0('0x1a')]?_0x46bfd1[_0x29c0('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x46bfd1[_0x29c0('0x1a')]?_0x46bfd1[_0x29c0('0x1a')]['where']||null:null,'attributes':_0x46bfd1['options']?_0x46bfd1[_0x29c0('0x1a')][_0x29c0('0x1d')]||null:null,'include':_0x46bfd1[_0x29c0('0x1a')]?_0x46bfd1[_0x29c0('0x1a')][_0x29c0('0x1f')]?_[_0x29c0('0x21')](_0x46bfd1[_0x29c0('0x1a')]['include'],function(_0x315bca){return{'model':db[_0x315bca['model']],'as':_0x315bca['as'],'attributes':_0x315bca[_0x29c0('0x1d')],'include':_0x315bca[_0x29c0('0x1f')]?_[_0x29c0('0x21')](_0x315bca['include'],function(_0x2c8367){return{'model':db[_0x2c8367[_0x29c0('0x20')]],'as':_0x2c8367['as'],'attributes':_0x2c8367['attributes'],'include':_0x2c8367[_0x29c0('0x1f')]?_[_0x29c0('0x21')](_0x2c8367[_0x29c0('0x1f')],function(_0x28c919){return{'model':db[_0x28c919[_0x29c0('0x20')]],'as':_0x28c919['as'],'attributes':_0x28c919[_0x29c0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x29c0('0xd')](function(_0x17e935){logger[_0x29c0('0xe')](_0x29c0('0x24'),_0x46bfd1);logger[_0x29c0('0x22')](_0x29c0('0x24'),_0x46bfd1,JSON[_0x29c0('0x12')](_0x17e935));_0x3452ca(_0x17e935);})[_0x29c0('0x17')](function(_0x3cc987){logger[_0x29c0('0x13')](_0x29c0('0x24'),_0x3cc987[_0x29c0('0x15')],_0x46bfd1);_0x4c2bed(_0x190425[_0x29c0('0x13')](0x1f4,_0x3cc987[_0x29c0('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 374f2dc..922e48a 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 _0x1a95=['emit','removeListener','register','mailQueue:','./mailQueue.events','remove'];(function(_0x4c542e,_0x5e37c1){var _0x156631=function(_0x583045){while(--_0x583045){_0x4c542e['push'](_0x4c542e['shift']());}};_0x156631(++_0x5e37c1);}(_0x1a95,0x130));var _0x51a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1a95[_0x321bb2];return _0x9c12ed;};'use strict';var MailQueueEvents=require(_0x51a9('0x0'));var events=['save',_0x51a9('0x1'),'update'];function createListener(_0x381d20,_0x465452){return function(_0x5a2470){_0x465452[_0x51a9('0x2')](_0x381d20,_0x5a2470);};}function removeListener(_0xc84688,_0x440cdc){return function(){MailQueueEvents[_0x51a9('0x3')](_0xc84688,_0x440cdc);};}exports[_0x51a9('0x4')]=function(_0x207e40){for(var _0x432df4=0x0,_0x4bd836=events['length'];_0x432df4<_0x4bd836;_0x432df4++){var _0x425950=events[_0x432df4];var _0x257001=createListener(_0x51a9('0x5')+_0x425950,_0x207e40);MailQueueEvents['on'](_0x425950,_0x257001);}}; \ No newline at end of file +var _0xee24=['./mailQueue.events','save','remove','update','emit','removeListener','length','mailQueue:'];(function(_0x578ed9,_0xd0b012){var _0x5d4d99=function(_0x29bc5b){while(--_0x29bc5b){_0x578ed9['push'](_0x578ed9['shift']());}};_0x5d4d99(++_0xd0b012);}(_0xee24,0x80));var _0x4ee2=function(_0x24bfd6,_0x40e032){_0x24bfd6=_0x24bfd6-0x0;var _0x4f46c1=_0xee24[_0x24bfd6];return _0x4f46c1;};'use strict';var MailQueueEvents=require(_0x4ee2('0x0'));var events=[_0x4ee2('0x1'),_0x4ee2('0x2'),_0x4ee2('0x3')];function createListener(_0x6bf7b6,_0x265212){return function(_0x21f009){_0x265212[_0x4ee2('0x4')](_0x6bf7b6,_0x21f009);};}function removeListener(_0x1a4776,_0x311640){return function(){MailQueueEvents[_0x4ee2('0x5')](_0x1a4776,_0x311640);};}exports['register']=function(_0x4a4675){for(var _0x2f80d8=0x0,_0x7ab08c=events[_0x4ee2('0x6')];_0x2f80d8<_0x7ab08c;_0x2f80d8++){var _0x3cc1f6=events[_0x2f80d8];var _0x5e7460=createListener(_0x4ee2('0x7')+_0x3cc1f6,_0x4a4675);MailQueueEvents['on'](_0x3cc1f6,_0x5e7460);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index a6c833b..f19be5a 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 _0x9090=['multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9090,0x1e0));var _0x0909=function(_0x52d22a,_0x461b49){_0x52d22a=_0x52d22a-0x0;var _0x5cbde6=_0x9090[_0x52d22a];return _0x5cbde6;};'use strict';var multer=require(_0x0909('0x0'));var util=require('util');var path=require(_0x0909('0x1'));var timeout=require(_0x0909('0x2'));var express=require('express');var router=express[_0x0909('0x3')]();var fs_extra=require(_0x0909('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0909('0x5'));var config=require(_0x0909('0x6'));var controller=require('./mailQueueReport.controller');router[_0x0909('0x7')]('/',auth[_0x0909('0x8')](),controller[_0x0909('0x9')]);router[_0x0909('0x7')](_0x0909('0xa'),auth[_0x0909('0x8')](),controller[_0x0909('0xb')]);router['get'](_0x0909('0xc'),auth[_0x0909('0x8')](),controller[_0x0909('0xd')]);router[_0x0909('0xe')]('/',auth[_0x0909('0x8')](),controller[_0x0909('0xf')]);router['put'](_0x0909('0xc'),auth[_0x0909('0x8')](),controller[_0x0909('0x10')]);router[_0x0909('0x11')](_0x0909('0xc'),auth[_0x0909('0x8')](),controller[_0x0909('0x12')]);module[_0x0909('0x13')]=router; \ No newline at end of file +var _0x76f5=['../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x38fe26,_0x1189c1){var _0x58db69=function(_0x1d2149){while(--_0x1d2149){_0x38fe26['push'](_0x38fe26['shift']());}};_0x58db69(++_0x1189c1);}(_0x76f5,0xaf));var _0x576f=function(_0x566894,_0x34ae85){_0x566894=_0x566894-0x0;var _0x4e40a0=_0x76f5[_0x566894];return _0x4e40a0;};'use strict';var multer=require(_0x576f('0x0'));var util=require(_0x576f('0x1'));var path=require(_0x576f('0x2'));var timeout=require(_0x576f('0x3'));var express=require(_0x576f('0x4'));var router=express[_0x576f('0x5')]();var fs_extra=require(_0x576f('0x6'));var auth=require(_0x576f('0x7'));var interaction=require(_0x576f('0x8'));var config=require(_0x576f('0x9'));var controller=require(_0x576f('0xa'));router[_0x576f('0xb')]('/',auth[_0x576f('0xc')](),controller[_0x576f('0xd')]);router[_0x576f('0xb')](_0x576f('0xe'),auth[_0x576f('0xc')](),controller[_0x576f('0xf')]);router[_0x576f('0xb')](_0x576f('0x10'),auth[_0x576f('0xc')](),controller[_0x576f('0x11')]);router['post']('/',auth[_0x576f('0xc')](),controller[_0x576f('0x12')]);router[_0x576f('0x13')]('/:id',auth[_0x576f('0xc')](),controller[_0x576f('0x14')]);router[_0x576f('0x15')]('/:id',auth[_0x576f('0xc')](),controller['destroy']);module[_0x576f('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 130389d..0bb660f 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 _0x044c=['moment','sequelize','exports','STRING','DATE'];(function(_0x17de77,_0x3c6b3f){var _0x55b344=function(_0x15957e){while(--_0x15957e){_0x17de77['push'](_0x17de77['shift']());}};_0x55b344(++_0x3c6b3f);}(_0x044c,0x1d1));var _0xc044=function(_0x5a1709,_0x341348){_0x5a1709=_0x5a1709-0x0;var _0xf0bbb=_0x044c[_0x5a1709];return _0xf0bbb;};'use strict';var moment=require(_0xc044('0x0'));var Sequelize=require(_0xc044('0x1'));module[_0xc044('0x2')]={'uniqueid':{'type':Sequelize[_0xc044('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc044('0x3')]},'joinAt':{'type':Sequelize[_0xc044('0x4')]},'leaveAt':{'type':Sequelize[_0xc044('0x4')]},'acceptAt':{'type':Sequelize[_0xc044('0x4')]},'exitAt':{'type':Sequelize[_0xc044('0x4')]},'reason':{'type':Sequelize[_0xc044('0x3')]}}; \ No newline at end of file +var _0xc765=['moment','sequelize','exports','STRING','DATE'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0xc765,0xf5));var _0x5c76=function(_0xe00497,_0x109ce6){_0xe00497=_0xe00497-0x0;var _0x46d918=_0xc765[_0xe00497];return _0x46d918;};'use strict';var moment=require(_0x5c76('0x0'));var Sequelize=require(_0x5c76('0x1'));module[_0x5c76('0x2')]={'uniqueid':{'type':Sequelize[_0x5c76('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5c76('0x3')]},'joinAt':{'type':Sequelize[_0x5c76('0x4')]},'leaveAt':{'type':Sequelize[_0x5c76('0x4')]},'acceptAt':{'type':Sequelize[_0x5c76('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5c76('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 5bf34e0..e9d8156 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 _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','MailQueueReport','rawAttributes','type','key','model','query'];(function(_0x2f83fa,_0x4877dd){var _0x175109=function(_0x4c3282){while(--_0x4c3282){_0x2f83fa['push'](_0x2f83fa['shift']());}};_0x175109(++_0x4877dd);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x3c19ec,_0x308740){_0x3c19ec=_0x3c19ec-0x0;var _0x201da6=_0xc1c6[_0x3c19ec];return _0x201da6;};'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['MailQueueReport']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['MailQueueReport'][_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['MailQueueReport'][_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['MailQueueReport']['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['MailQueueReport'][_0x6c1c('0x49')]()[_0x6c1c('0x25')](respondWithResult(_0x5489ac,null))['catch'](handleError(_0x5489ac,null));}; \ No newline at end of file +var _0x8aad=['sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x19e646,_0xb5146b){var _0x597d3a=function(_0x1619ba){while(--_0x1619ba){_0x19e646['push'](_0x19e646['shift']());}};_0x597d3a(++_0xb5146b);}(_0x8aad,0x146));var _0xd8aa=function(_0x1dead6,_0xd0a119){_0x1dead6=_0x1dead6-0x0;var _0x37d8c3=_0x8aad[_0x1dead6];return _0x37d8c3;};'use strict';var emlformat=require(_0xd8aa('0x0'));var rimraf=require(_0xd8aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8aa('0x2'));var rp=require('request-promise');var moment=require(_0xd8aa('0x3'));var BPromise=require(_0xd8aa('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd8aa('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd8aa('0x6'));var fs=require('fs');var fs_extra=require(_0xd8aa('0x7'));var _=require(_0xd8aa('0x8'));var squel=require('squel');var crypto=require(_0xd8aa('0x9'));var jsforce=require(_0xd8aa('0xa'));var deskjs=require(_0xd8aa('0xb'));var toCsv=require(_0xd8aa('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd8aa('0xd'));var authService=require(_0xd8aa('0xe'));var qs=require(_0xd8aa('0xf'));var as=require(_0xd8aa('0x10'));var hardwareService=require(_0xd8aa('0x11'));var logger=require('../../config/logger')(_0xd8aa('0x12'));var utils=require(_0xd8aa('0x13'));var config=require(_0xd8aa('0x14'));var licenseUtil=require(_0xd8aa('0x15'));var db=require(_0xd8aa('0x16'))['db'];function respondWithStatusCode(_0x6ec0eb,_0x549fad){_0x549fad=_0x549fad||0xcc;return function(_0x1e7db8){if(_0x1e7db8){return _0x6ec0eb[_0xd8aa('0x17')](_0x549fad);}return _0x6ec0eb[_0xd8aa('0x18')](_0x549fad)['end']();};}function respondWithResult(_0x5a8c79,_0x275eff){_0x275eff=_0x275eff||0xc8;return function(_0x319ffe){if(_0x319ffe){return _0x5a8c79[_0xd8aa('0x18')](_0x275eff)['json'](_0x319ffe);}};}function respondWithFilteredResult(_0x2678ed,_0x180c56){return function(_0x39b5bc){if(_0x39b5bc){var _0x404ed6=typeof _0x180c56['offset']===_0xd8aa('0x19')&&typeof _0x180c56[_0xd8aa('0x1a')]==='undefined';var _0x16d5c6=_0x39b5bc[_0xd8aa('0x1b')];var _0x32e2cd=_0x404ed6?0x0:_0x180c56[_0xd8aa('0x1c')];var _0x2d34ac=_0x404ed6?_0x39b5bc['count']:_0x180c56[_0xd8aa('0x1c')]+_0x180c56[_0xd8aa('0x1a')];var _0xb156e6;if(_0x2d34ac>=_0x16d5c6){_0x2d34ac=_0x16d5c6;_0xb156e6=0xc8;}else{_0xb156e6=0xce;}_0x2678ed[_0xd8aa('0x18')](_0xb156e6);return _0x2678ed['set'](_0xd8aa('0x1d'),_0x32e2cd+'-'+_0x2d34ac+'/'+_0x16d5c6)[_0xd8aa('0x1e')](_0x39b5bc);}return null;};}function patchUpdates(_0x46d69b){return function(_0x3588ee){try{jsonpatch[_0xd8aa('0x1f')](_0x3588ee,_0x46d69b,!![]);}catch(_0x4fe5d8){return BPromise[_0xd8aa('0x20')](_0x4fe5d8);}return _0x3588ee[_0xd8aa('0x21')]();};}function saveUpdates(_0xc4f55c,_0x5910b3){return function(_0xa7cf85){if(_0xa7cf85){return _0xa7cf85[_0xd8aa('0x22')](_0xc4f55c)[_0xd8aa('0x23')](function(_0x290849){return _0x290849;});}return null;};}function removeEntity(_0x3ef3a9,_0x16758a){return function(_0x1f64f8){if(_0x1f64f8){return _0x1f64f8[_0xd8aa('0x24')]()[_0xd8aa('0x23')](function(){_0x3ef3a9[_0xd8aa('0x18')](0xcc)[_0xd8aa('0x25')]();});}};}function handleEntityNotFound(_0x370d6f,_0x26cc66){return function(_0x5f1027){if(!_0x5f1027){_0x370d6f[_0xd8aa('0x17')](0x194);}return _0x5f1027;};}function handleError(_0x59eb3f,_0xd4d204){_0xd4d204=_0xd4d204||0x1f4;return function(_0x1f6ab2){logger[_0xd8aa('0x26')](_0x1f6ab2[_0xd8aa('0x27')]);if(_0x1f6ab2[_0xd8aa('0x28')]){delete _0x1f6ab2[_0xd8aa('0x28')];}_0x59eb3f[_0xd8aa('0x18')](_0xd4d204)[_0xd8aa('0x29')](_0x1f6ab2);};}exports['index']=function(_0x1f2a28,_0x34b792){var _0x214393={},_0x49a7c8={},_0x19a59d={'count':0x0,'rows':[]};var _0x51c6f4=_[_0xd8aa('0x2a')](db[_0xd8aa('0x2b')][_0xd8aa('0x2c')],function(_0x168a2e){return{'name':_0x168a2e[_0xd8aa('0x2d')],'type':_0x168a2e[_0xd8aa('0x2e')][_0xd8aa('0x2f')]};});_0x49a7c8[_0xd8aa('0x30')]=_['map'](_0x51c6f4,_0xd8aa('0x28'));_0x49a7c8[_0xd8aa('0x31')]=_[_0xd8aa('0x32')](_0x1f2a28[_0xd8aa('0x31')]);_0x49a7c8[_0xd8aa('0x33')]=_[_0xd8aa('0x34')](_0x49a7c8[_0xd8aa('0x30')],_0x49a7c8[_0xd8aa('0x31')]);_0x214393['attributes']=_[_0xd8aa('0x34')](_0x49a7c8[_0xd8aa('0x30')],qs[_0xd8aa('0x35')](_0x1f2a28['query'][_0xd8aa('0x35')]));_0x214393[_0xd8aa('0x36')]=_0x214393[_0xd8aa('0x36')][_0xd8aa('0x37')]?_0x214393[_0xd8aa('0x36')]:_0x49a7c8[_0xd8aa('0x30')];if(!_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x38')](_0xd8aa('0x39'))){_0x214393['limit']=qs[_0xd8aa('0x1a')](_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x1a')]);_0x214393[_0xd8aa('0x1c')]=qs[_0xd8aa('0x1c')](_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x1c')]);}_0x214393[_0xd8aa('0x3a')]=qs[_0xd8aa('0x3b')](_0x1f2a28['query'][_0xd8aa('0x3b')]);_0x214393['where']=qs[_0xd8aa('0x33')](_[_0xd8aa('0x3c')](_0x1f2a28['query'],_0x49a7c8[_0xd8aa('0x33')]),_0x51c6f4);if(_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x3d')]){_0x214393[_0xd8aa('0x3e')]=_[_0xd8aa('0x3f')](_0x214393['where'],{'$or':_['map'](_0x51c6f4,function(_0x25145c){if(_0x25145c['type']!==_0xd8aa('0x40')){var _0x7a6df2={};_0x7a6df2[_0x25145c[_0xd8aa('0x28')]]={'$like':'%'+_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x3d')]+'%'};return _0x7a6df2;}})});}_0x214393=_[_0xd8aa('0x3f')]({},_0x214393,_0x1f2a28[_0xd8aa('0x41')]);var _0x3b0220={'where':_0x214393[_0xd8aa('0x3e')]};return db[_0xd8aa('0x2b')][_0xd8aa('0x1b')](_0x3b0220)['then'](function(_0x17ebb4){_0x19a59d[_0xd8aa('0x1b')]=_0x17ebb4;if(_0x1f2a28[_0xd8aa('0x31')]['includeAll']){_0x214393[_0xd8aa('0x42')]=[{'all':!![]}];}return db[_0xd8aa('0x2b')][_0xd8aa('0x43')](_0x214393);})[_0xd8aa('0x23')](function(_0x3a0284){_0x19a59d[_0xd8aa('0x44')]=_0x3a0284;return _0x19a59d;})[_0xd8aa('0x23')](respondWithFilteredResult(_0x34b792,_0x214393))[_0xd8aa('0x45')](handleError(_0x34b792,null));};exports[_0xd8aa('0x46')]=function(_0x3f5857,_0x20c7a0){var _0x3ec42f={'raw':!![],'where':{'id':_0x3f5857[_0xd8aa('0x47')]['id']}},_0x3b26c9={};_0x3b26c9[_0xd8aa('0x30')]=_[_0xd8aa('0x32')](db[_0xd8aa('0x2b')][_0xd8aa('0x2c')]);_0x3b26c9['query']=_[_0xd8aa('0x32')](_0x3f5857[_0xd8aa('0x31')]);_0x3b26c9[_0xd8aa('0x33')]=_[_0xd8aa('0x34')](_0x3b26c9[_0xd8aa('0x30')],_0x3b26c9[_0xd8aa('0x31')]);_0x3ec42f['attributes']=_[_0xd8aa('0x34')](_0x3b26c9['model'],qs[_0xd8aa('0x35')](_0x3f5857['query'][_0xd8aa('0x35')]));_0x3ec42f['attributes']=_0x3ec42f['attributes'][_0xd8aa('0x37')]?_0x3ec42f[_0xd8aa('0x36')]:_0x3b26c9[_0xd8aa('0x30')];if(_0x3f5857[_0xd8aa('0x31')][_0xd8aa('0x48')]){_0x3ec42f[_0xd8aa('0x42')]=[{'all':!![]}];}_0x3ec42f=_['merge']({},_0x3ec42f,_0x3f5857[_0xd8aa('0x41')]);return db[_0xd8aa('0x2b')][_0xd8aa('0x49')](_0x3ec42f)[_0xd8aa('0x23')](handleEntityNotFound(_0x20c7a0,null))[_0xd8aa('0x23')](respondWithResult(_0x20c7a0,null))['catch'](handleError(_0x20c7a0,null));};exports['create']=function(_0x58cf42,_0x1fd1dc){return db[_0xd8aa('0x2b')][_0xd8aa('0x4a')](_0x58cf42[_0xd8aa('0x4b')],{})[_0xd8aa('0x23')](respondWithResult(_0x1fd1dc,0xc9))[_0xd8aa('0x45')](handleError(_0x1fd1dc,null));};exports['update']=function(_0x221e2b,_0x241e23){if(_0x221e2b['body']['id']){delete _0x221e2b[_0xd8aa('0x4b')]['id'];}return db[_0xd8aa('0x2b')][_0xd8aa('0x49')]({'where':{'id':_0x221e2b['params']['id']}})[_0xd8aa('0x23')](handleEntityNotFound(_0x241e23,null))[_0xd8aa('0x23')](saveUpdates(_0x221e2b[_0xd8aa('0x4b')],null))[_0xd8aa('0x23')](respondWithResult(_0x241e23,null))[_0xd8aa('0x45')](handleError(_0x241e23,null));};exports[_0xd8aa('0x24')]=function(_0x4f494d,_0x566d52){return db[_0xd8aa('0x2b')][_0xd8aa('0x49')]({'where':{'id':_0x4f494d[_0xd8aa('0x47')]['id']}})[_0xd8aa('0x23')](handleEntityNotFound(_0x566d52,null))[_0xd8aa('0x23')](removeEntity(_0x566d52,null))[_0xd8aa('0x45')](handleError(_0x566d52,null));};exports[_0xd8aa('0x4c')]=function(_0x4f9d21,_0x9db7e3){return db[_0xd8aa('0x2b')]['describe']()[_0xd8aa('0x23')](respondWithResult(_0x9db7e3,null))['catch'](handleError(_0x9db7e3,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 273ae08..d140e92 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 _0xa6e6=['../../config/logger','api','moment','request-promise','path','rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa6e6,0x173));var _0x6a6e=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0xa6e6[_0x48b810];return _0x23c17d;};'use strict';var _=require(_0x6a6e('0x0'));var util=require('util');var logger=require(_0x6a6e('0x1'))(_0x6a6e('0x2'));var moment=require(_0x6a6e('0x3'));var BPromise=require('bluebird');var rp=require(_0x6a6e('0x4'));var fs=require('fs');var path=require(_0x6a6e('0x5'));var rimraf=require(_0x6a6e('0x6'));var config=require('../../config/environment');var attributes=require(_0x6a6e('0x7'));module[_0x6a6e('0x8')]=function(_0xea9286,_0x1b3a78){return _0xea9286[_0x6a6e('0x9')](_0x6a6e('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x6a6e('0xb'),'fields':[_0x6a6e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8df6=['define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','moment','request-promise','path','../../config/environment','./mailQueueReport.attributes','exports'];(function(_0x5b2502,_0x2c5491){var _0x36de71=function(_0x56dcff){while(--_0x56dcff){_0x5b2502['push'](_0x5b2502['shift']());}};_0x36de71(++_0x2c5491);}(_0x8df6,0xee));var _0x68df=function(_0x381983,_0x191f93){_0x381983=_0x381983-0x0;var _0xfea6c8=_0x8df6[_0x381983];return _0xfea6c8;};'use strict';var _=require(_0x68df('0x0'));var util=require(_0x68df('0x1'));var logger=require('../../config/logger')(_0x68df('0x2'));var moment=require(_0x68df('0x3'));var BPromise=require('bluebird');var rp=require(_0x68df('0x4'));var fs=require('fs');var path=require(_0x68df('0x5'));var rimraf=require('rimraf');var config=require(_0x68df('0x6'));var attributes=require(_0x68df('0x7'));module[_0x68df('0x8')]=function(_0xdfc319,_0x4ddb4d){return _0xdfc319[_0x68df('0x9')](_0x68df('0xa'),attributes,{'tableName':_0x68df('0xb'),'paranoid':![],'indexes':[{'name':_0x68df('0xc'),'fields':[_0x68df('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 2196923..114b9c8 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 _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x58fdc5,_0x5986a){var _0x121190=function(_0x28bd5c){while(--_0x28bd5c){_0x58fdc5['push'](_0x58fdc5['shift']());}};_0x121190(++_0x5986a);}(_0x2ef3,0xba));var _0x32ef=function(_0x48f87a,_0x70eb45){_0x48f87a=_0x48f87a-0x0;var _0x2e7302=_0x2ef3[_0x48f87a];return _0x2e7302;};'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')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +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(_0x26abd9,_0x5e071c){var _0x297dd4=function(_0x4865ba){while(--_0x4865ba){_0x26abd9['push'](_0x26abd9['shift']());}};_0x297dd4(++_0x5e071c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index d007dbc..b44b967 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4e8dc2,_0x1cc1e5){var _0x3b3fd1=function(_0x858f49){while(--_0x858f49){_0x4e8dc2['push'](_0x4e8dc2['shift']());}};_0x3b3fd1(++_0x1cc1e5);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5cf586,_0x5a3bdb){var _0x5f3b0a=function(_0x5b56de){while(--_0x5b56de){_0x5cf586['push'](_0x5cf586['shift']());}};_0x5f3b0a(++_0x5a3bdb);}(_0xedd9,0xfc));var _0x9edd=function(_0x57c653,_0x40bcfd){_0x57c653=_0x57c653-0x0;var _0x54616c=_0xedd9[_0x57c653];return _0x54616c;};'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 185b174..ad41461 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 _0x8e7e=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x1f5a63,_0x511504){var _0x30bb7a=function(_0x476310){while(--_0x476310){_0x1f5a63['push'](_0x1f5a63['shift']());}};_0x30bb7a(++_0x511504);}(_0x8e7e,0xf5));var _0xe8e7=function(_0x597702,_0x1e3d0e){_0x597702=_0x597702-0x0;var _0x5bfdba=_0x8e7e[_0x597702];return _0x5bfdba;};'use strict';var Sequelize=require(_0xe8e7('0x0'));module[_0xe8e7('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe8e7('0x2')]},'authentication':{'type':Sequelize[_0xe8e7('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe8e7('0x2')]},'port':{'type':Sequelize[_0xe8e7('0x4')]},'tls':{'type':Sequelize[_0xe8e7('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xe8e7('0x5')},'connTimeout':{'type':Sequelize[_0xe8e7('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xe8e7('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5522=['sequelize','exports','STRING','INTEGER','INBOX','BOOLEAN'];(function(_0x2d1ddc,_0xa4b8d1){var _0x42ad61=function(_0x32b39a){while(--_0x32b39a){_0x2d1ddc['push'](_0x2d1ddc['shift']());}};_0x42ad61(++_0xa4b8d1);}(_0x5522,0x156));var _0x2552=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5522[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x2552('0x0'));module[_0x2552('0x1')]={'description':{'type':Sequelize[_0x2552('0x2')]},'host':{'type':Sequelize[_0x2552('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x2552('0x2')]},'password':{'type':Sequelize[_0x2552('0x2')]},'port':{'type':Sequelize[_0x2552('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x2552('0x2')],'defaultValue':_0x2552('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x2552('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x2552('0x2')]},'modernAuthentication':{'type':Sequelize[_0x2552('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 9e5fa2e..aaec85c 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 _0x610f=['exports','define','mail_servers_in','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x1b8bda,_0x43ad31){var _0x1f7050=function(_0x1d8dc6){while(--_0x1d8dc6){_0x1b8bda['push'](_0x1b8bda['shift']());}};_0x1f7050(++_0x43ad31);}(_0x610f,0x19b));var _0xf610=function(_0x701c5d,_0x47a566){_0x701c5d=_0x701c5d-0x0;var _0x617b08=_0x610f[_0x701c5d];return _0x617b08;};'use strict';var _=require(_0xf610('0x0'));var util=require(_0xf610('0x1'));var logger=require(_0xf610('0x2'))('api');var moment=require(_0xf610('0x3'));var BPromise=require('bluebird');var rp=require(_0xf610('0x4'));var fs=require('fs');var path=require(_0xf610('0x5'));var rimraf=require(_0xf610('0x6'));var config=require(_0xf610('0x7'));var attributes=require(_0xf610('0x8'));module[_0xf610('0x9')]=function(_0x561405,_0x196e0b){return _0x561405[_0xf610('0xa')]('MailServerIn',attributes,{'tableName':_0xf610('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe61d=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','MailServerIn','mail_servers_in'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xe61d,0x18c));var _0xde61=function(_0x170fc0,_0x46ff64){_0x170fc0=_0x170fc0-0x0;var _0x491e0a=_0xe61d[_0x170fc0];return _0x491e0a;};'use strict';var _=require(_0xde61('0x0'));var util=require(_0xde61('0x1'));var logger=require(_0xde61('0x2'))('api');var moment=require('moment');var BPromise=require(_0xde61('0x3'));var rp=require(_0xde61('0x4'));var fs=require('fs');var path=require(_0xde61('0x5'));var rimraf=require(_0xde61('0x6'));var config=require(_0xde61('0x7'));var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x2c0773,_0x1cffee){return _0x2c0773[_0xde61('0x8')](_0xde61('0x9'),attributes,{'tableName':_0xde61('0xa'),'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 8ae64c5..44e7044 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 _0xacdf=['../../config/environment','jayson/promise','client','request','info','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','include','map','model','then','lodash','bluebird','randomstring'];(function(_0x4d6dfc,_0x4930f8){var _0x5de503=function(_0x21788d){while(--_0x21788d){_0x4d6dfc['push'](_0x4d6dfc['shift']());}};_0x5de503(++_0x4930f8);}(_0xacdf,0x69));var _0xfacd=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xacdf[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0xfacd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfacd('0x1'));var rs=require(_0xfacd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xfacd('0x3'));var jayson=require(_0xfacd('0x4'));var client=jayson[_0xfacd('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b043b,_0x3f0f95,_0x259613){return new BPromise(function(_0x4a0109,_0xdaa112){return client[_0xfacd('0x6')](_0x3b043b,_0x259613)['then'](function(_0x42a267){logger[_0xfacd('0x7')]('MailServerIn,\x20%s,\x20%s',_0x3f0f95,_0xfacd('0x8'));logger['debug'](_0xfacd('0x9'),_0x3f0f95,_0xfacd('0x8'),JSON[_0xfacd('0xa')](_0x42a267));if(_0x42a267['error']){if(_0x42a267[_0xfacd('0xb')][_0xfacd('0xc')]===0x1f4){logger['error'](_0xfacd('0xd'),_0x3f0f95,_0x42a267[_0xfacd('0xb')][_0xfacd('0xe')]);return _0xdaa112(_0x42a267[_0xfacd('0xb')][_0xfacd('0xe')]);}logger['error'](_0xfacd('0xd'),_0x3f0f95,_0x42a267[_0xfacd('0xb')][_0xfacd('0xe')]);return _0x4a0109(_0x42a267[_0xfacd('0xb')]['message']);}else{logger[_0xfacd('0x7')](_0xfacd('0xd'),_0x3f0f95,_0xfacd('0x8'));_0x4a0109(_0x42a267[_0xfacd('0xf')][_0xfacd('0xe')]);}})[_0xfacd('0x10')](function(_0x4fac48){logger[_0xfacd('0xb')]('MailServerIn,\x20%s,\x20%s',_0x3f0f95,_0x4fac48);_0xdaa112(_0x4fac48);});});}exports[_0xfacd('0x11')]=function(_0x553153){var _0xa8efe=this;return new Promise(function(_0x7bd55a,_0x2b30d2){return db[_0xfacd('0x12')]['findAll']({'raw':_0x553153[_0xfacd('0x13')]?_0x553153['options'][_0xfacd('0x14')]===undefined?!![]:![]:!![],'where':_0x553153[_0xfacd('0x13')]?_0x553153[_0xfacd('0x13')][_0xfacd('0x15')]||null:null,'attributes':_0x553153['options']?_0x553153['options'][_0xfacd('0x16')]||null:null,'limit':_0x553153[_0xfacd('0x13')]?_0x553153[_0xfacd('0x13')]['limit']||null:null,'include':_0x553153[_0xfacd('0x13')]?_0x553153[_0xfacd('0x13')]['include']?_['map'](_0x553153['options'][_0xfacd('0x17')],function(_0x35bd94){return{'model':db[_0x35bd94['model']],'as':_0x35bd94['as'],'attributes':_0x35bd94[_0xfacd('0x16')],'include':_0x35bd94[_0xfacd('0x17')]?_[_0xfacd('0x18')](_0x35bd94[_0xfacd('0x17')],function(_0x334bac){return{'model':db[_0x334bac[_0xfacd('0x19')]],'as':_0x334bac['as'],'attributes':_0x334bac[_0xfacd('0x16')],'include':_0x334bac[_0xfacd('0x17')]?_[_0xfacd('0x18')](_0x334bac['include'],function(_0x207f52){return{'model':db[_0x207f52['model']],'as':_0x207f52['as'],'attributes':_0x207f52['attributes']};}):[]};}):[]};}):[]:[]})[_0xfacd('0x1a')](function(_0x55c48c){logger['info'](_0xfacd('0x11'),_0x553153);logger['debug'](_0xfacd('0x11'),_0x553153,JSON[_0xfacd('0xa')](_0x55c48c));_0x7bd55a(_0x55c48c);})[_0xfacd('0x10')](function(_0x574285){logger[_0xfacd('0xb')]('GetMailServerIn',_0x574285['message'],_0x553153);_0x2b30d2(_0xa8efe[_0xfacd('0xb')](0x1f4,_0x574285[_0xfacd('0xe')]));});});}; \ No newline at end of file +var _0xc547=['stringify','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','MailServerIn,\x20%s,\x20%s','message','GetMailServerIn','findAll','raw','options','where','limit','map','include','model'];(function(_0x2fdfbe,_0x1f19f7){var _0x110ffc=function(_0x5b5ebb){while(--_0x5b5ebb){_0x2fdfbe['push'](_0x2fdfbe['shift']());}};_0x110ffc(++_0x1f19f7);}(_0xc547,0x153));var _0x7c54=function(_0x1090bb,_0x44f678){_0x1090bb=_0x1090bb-0x0;var _0x36d96f=_0xc547[_0x1090bb];return _0x36d96f;};'use strict';var _=require('lodash');var util=require(_0x7c54('0x0'));var moment=require('moment');var BPromise=require(_0x7c54('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c54('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7c54('0x3'))(_0x7c54('0x4'));var config=require(_0x7c54('0x5'));var jayson=require(_0x7c54('0x6'));var client=jayson[_0x7c54('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c6674,_0x2f7af6,_0x47760f){return new BPromise(function(_0x1040f0,_0x28d46d){return client['request'](_0x4c6674,_0x47760f)[_0x7c54('0x8')](function(_0x5f392e){logger[_0x7c54('0x9')]('MailServerIn,\x20%s,\x20%s',_0x2f7af6,_0x7c54('0xa'));logger[_0x7c54('0xb')](_0x7c54('0xc'),_0x2f7af6,_0x7c54('0xa'),JSON['stringify'](_0x5f392e));if(_0x5f392e[_0x7c54('0xd')]){if(_0x5f392e[_0x7c54('0xd')]['code']===0x1f4){logger['error'](_0x7c54('0xe'),_0x2f7af6,_0x5f392e[_0x7c54('0xd')][_0x7c54('0xf')]);return _0x28d46d(_0x5f392e['error']['message']);}logger['error'](_0x7c54('0xe'),_0x2f7af6,_0x5f392e['error'][_0x7c54('0xf')]);return _0x1040f0(_0x5f392e['error'][_0x7c54('0xf')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x2f7af6,_0x7c54('0xa'));_0x1040f0(_0x5f392e['result'][_0x7c54('0xf')]);}})['catch'](function(_0x57bf21){logger[_0x7c54('0xd')](_0x7c54('0xe'),_0x2f7af6,_0x57bf21);_0x28d46d(_0x57bf21);});});}exports[_0x7c54('0x10')]=function(_0x44a7dc){var _0x2234d7=this;return new Promise(function(_0xed7452,_0x18a9c2){return db['MailServerIn'][_0x7c54('0x11')]({'raw':_0x44a7dc['options']?_0x44a7dc['options'][_0x7c54('0x12')]===undefined?!![]:![]:!![],'where':_0x44a7dc[_0x7c54('0x13')]?_0x44a7dc[_0x7c54('0x13')][_0x7c54('0x14')]||null:null,'attributes':_0x44a7dc['options']?_0x44a7dc[_0x7c54('0x13')]['attributes']||null:null,'limit':_0x44a7dc['options']?_0x44a7dc['options'][_0x7c54('0x15')]||null:null,'include':_0x44a7dc[_0x7c54('0x13')]?_0x44a7dc[_0x7c54('0x13')]['include']?_[_0x7c54('0x16')](_0x44a7dc[_0x7c54('0x13')][_0x7c54('0x17')],function(_0x29f2e0){return{'model':db[_0x29f2e0['model']],'as':_0x29f2e0['as'],'attributes':_0x29f2e0['attributes'],'include':_0x29f2e0[_0x7c54('0x17')]?_[_0x7c54('0x16')](_0x29f2e0['include'],function(_0x533d64){return{'model':db[_0x533d64['model']],'as':_0x533d64['as'],'attributes':_0x533d64['attributes'],'include':_0x533d64[_0x7c54('0x17')]?_['map'](_0x533d64[_0x7c54('0x17')],function(_0x567562){return{'model':db[_0x567562[_0x7c54('0x18')]],'as':_0x567562['as'],'attributes':_0x567562['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c54('0x8')](function(_0x32a377){logger[_0x7c54('0x9')](_0x7c54('0x10'),_0x44a7dc);logger[_0x7c54('0xb')](_0x7c54('0x10'),_0x44a7dc,JSON[_0x7c54('0x19')](_0x32a377));_0xed7452(_0x32a377);})['catch'](function(_0x57ef2c){logger['error']('GetMailServerIn',_0x57ef2c[_0x7c54('0xf')],_0x44a7dc);_0x18a9c2(_0x2234d7[_0x7c54('0xd')](0x1f4,_0x57ef2c[_0x7c54('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index b7576c8..ac357ea 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(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x7a54,0x106));var _0x47a5=function(_0x75c06e,_0x4d2240){_0x75c06e=_0x75c06e-0x0;var _0x54ab06=_0x7a54[_0x75c06e];return _0x54ab06;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7a54,0x106));var _0x47a5=function(_0x47bbbc,_0xa687eb){_0x47bbbc=_0x47bbbc-0x0;var _0x5e7fe9=_0x7a54[_0x47bbbc];return _0x5e7fe9;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 8eb0947..8bc5ee3 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 _0x2e54=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x1c2343,_0x30894a){var _0x5072c9=function(_0x5cae2b){while(--_0x5cae2b){_0x1c2343['push'](_0x1c2343['shift']());}};_0x5072c9(++_0x30894a);}(_0x2e54,0x1dd));var _0x42e5=function(_0x1acbfb,_0x2a9a44){_0x1acbfb=_0x1acbfb-0x0;var _0x1acd55=_0x2e54[_0x1acbfb];return _0x1acd55;};'use strict';var Sequelize=require(_0x42e5('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x42e5('0x1')]},'user':{'type':Sequelize[_0x42e5('0x1')]},'pass':{'type':Sequelize[_0x42e5('0x1')]},'port':{'type':Sequelize[_0x42e5('0x2')]},'secure':{'type':Sequelize[_0x42e5('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x42e5('0x1')]},'authentication':{'type':Sequelize[_0x42e5('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1c7c=['sequelize','exports','STRING','BOOLEAN'];(function(_0x13cff3,_0x5ed7b4){var _0x195b6e=function(_0x294e61){while(--_0x294e61){_0x13cff3['push'](_0x13cff3['shift']());}};_0x195b6e(++_0x5ed7b4);}(_0x1c7c,0x164));var _0xc1c7=function(_0x56de15,_0x3c9f93){_0x56de15=_0x56de15-0x0;var _0xd9b4bf=_0x1c7c[_0x56de15];return _0xd9b4bf;};'use strict';var Sequelize=require(_0xc1c7('0x0'));module[_0xc1c7('0x1')]={'description':{'type':Sequelize[_0xc1c7('0x2')]},'host':{'type':Sequelize[_0xc1c7('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xc1c7('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xc1c7('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xc1c7('0x2')]},'authentication':{'type':Sequelize[_0xc1c7('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xc1c7('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 45b4d68..1930821 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 _0xd445=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options','then','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','undefined','count','set','apply','reject','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type'];(function(_0x1b0e86,_0x33ec39){var _0xd85844=function(_0x3282ae){while(--_0x3282ae){_0x1b0e86['push'](_0x1b0e86['shift']());}};_0xd85844(++_0x33ec39);}(_0xd445,0x12e));var _0x5d44=function(_0x1bca3d,_0x142d89){_0x1bca3d=_0x1bca3d-0x0;var _0x3e0a34=_0xd445[_0x1bca3d];return _0x3e0a34;};'use strict';var emlformat=require(_0x5d44('0x0'));var rimraf=require(_0x5d44('0x1'));var zipdir=require(_0x5d44('0x2'));var jsonpatch=require(_0x5d44('0x3'));var rp=require(_0x5d44('0x4'));var moment=require(_0x5d44('0x5'));var BPromise=require(_0x5d44('0x6'));var Mustache=require('mustache');var util=require(_0x5d44('0x7'));var path=require(_0x5d44('0x8'));var sox=require(_0x5d44('0x9'));var csv=require('to-csv');var ejs=require(_0x5d44('0xa'));var fs=require('fs');var fs_extra=require(_0x5d44('0xb'));var _=require(_0x5d44('0xc'));var squel=require(_0x5d44('0xd'));var crypto=require(_0x5d44('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5d44('0xf'));var toCsv=require(_0x5d44('0x10'));var querystring=require(_0x5d44('0x11'));var Papa=require('papaparse');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('../../config/license/hardware');var logger=require(_0x5d44('0x12'))(_0x5d44('0x13'));var utils=require(_0x5d44('0x14'));var config=require(_0x5d44('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ef54b,_0x565edc){_0x565edc=_0x565edc||0xcc;return function(_0x4ba389){if(_0x4ba389){return _0x2ef54b['sendStatus'](_0x565edc);}return _0x2ef54b[_0x5d44('0x16')](_0x565edc)[_0x5d44('0x17')]();};}function respondWithResult(_0x464b1f,_0x4b037a){_0x4b037a=_0x4b037a||0xc8;return function(_0x1b7fb5){if(_0x1b7fb5){return _0x464b1f[_0x5d44('0x16')](_0x4b037a)[_0x5d44('0x18')](_0x1b7fb5);}};}function respondWithFilteredResult(_0x2bbe72,_0x5f0c45){return function(_0x5210d0){if(_0x5210d0){var _0x1c171a=typeof _0x5f0c45[_0x5d44('0x19')]==='undefined'&&typeof _0x5f0c45[_0x5d44('0x1a')]===_0x5d44('0x1b');var _0x4dc81d=_0x5210d0[_0x5d44('0x1c')];var _0x14e1de=_0x1c171a?0x0:_0x5f0c45[_0x5d44('0x19')];var _0xc33703=_0x1c171a?_0x5210d0[_0x5d44('0x1c')]:_0x5f0c45[_0x5d44('0x19')]+_0x5f0c45[_0x5d44('0x1a')];var _0x366f8d;if(_0xc33703>=_0x4dc81d){_0xc33703=_0x4dc81d;_0x366f8d=0xc8;}else{_0x366f8d=0xce;}_0x2bbe72[_0x5d44('0x16')](_0x366f8d);return _0x2bbe72[_0x5d44('0x1d')]('Content-Range',_0x14e1de+'-'+_0xc33703+'/'+_0x4dc81d)[_0x5d44('0x18')](_0x5210d0);}return null;};}function patchUpdates(_0x55dfeb){return function(_0x26dcb9){try{jsonpatch[_0x5d44('0x1e')](_0x26dcb9,_0x55dfeb,!![]);}catch(_0x157bfb){return BPromise[_0x5d44('0x1f')](_0x157bfb);}return _0x26dcb9['save']();};}function saveUpdates(_0x12855b,_0x6b63e1){return function(_0x55bbcf){if(_0x55bbcf){return _0x55bbcf['update'](_0x12855b)['then'](function(_0x16afe2){return _0x16afe2;});}return null;};}function removeEntity(_0x313afa,_0x173445){return function(_0x5e686a){if(_0x5e686a){return _0x5e686a[_0x5d44('0x20')]()['then'](function(){_0x313afa[_0x5d44('0x16')](0xcc)[_0x5d44('0x17')]();});}};}function handleEntityNotFound(_0x52687a,_0x48305b){return function(_0x20d4c3){if(!_0x20d4c3){_0x52687a['sendStatus'](0x194);}return _0x20d4c3;};}function handleError(_0x19c7ad,_0x55f1d5){_0x55f1d5=_0x55f1d5||0x1f4;return function(_0x4a101b){logger[_0x5d44('0x21')](_0x4a101b[_0x5d44('0x22')]);if(_0x4a101b['name']){delete _0x4a101b[_0x5d44('0x23')];}_0x19c7ad[_0x5d44('0x16')](_0x55f1d5)[_0x5d44('0x24')](_0x4a101b);};}exports[_0x5d44('0x25')]=function(_0x28b414,_0x485aa6){var _0x1f6bcf={},_0x2cf8b0={},_0x4a9890={'count':0x0,'rows':[]};var _0x5c87bd=_[_0x5d44('0x26')](db[_0x5d44('0x27')][_0x5d44('0x28')],function(_0x5ad86f){return{'name':_0x5ad86f[_0x5d44('0x29')],'type':_0x5ad86f[_0x5d44('0x2a')]['key']};});_0x2cf8b0[_0x5d44('0x2b')]=_[_0x5d44('0x26')](_0x5c87bd,_0x5d44('0x23'));_0x2cf8b0[_0x5d44('0x2c')]=_[_0x5d44('0x2d')](_0x28b414[_0x5d44('0x2c')]);_0x2cf8b0['filters']=_[_0x5d44('0x2e')](_0x2cf8b0[_0x5d44('0x2b')],_0x2cf8b0[_0x5d44('0x2c')]);_0x1f6bcf[_0x5d44('0x2f')]=_[_0x5d44('0x2e')](_0x2cf8b0[_0x5d44('0x2b')],qs['fields'](_0x28b414[_0x5d44('0x2c')][_0x5d44('0x30')]));_0x1f6bcf['attributes']=_0x1f6bcf[_0x5d44('0x2f')][_0x5d44('0x31')]?_0x1f6bcf[_0x5d44('0x2f')]:_0x2cf8b0[_0x5d44('0x2b')];if(!_0x28b414[_0x5d44('0x2c')][_0x5d44('0x32')]('nolimit')){_0x1f6bcf[_0x5d44('0x1a')]=qs[_0x5d44('0x1a')](_0x28b414[_0x5d44('0x2c')][_0x5d44('0x1a')]);_0x1f6bcf[_0x5d44('0x19')]=qs[_0x5d44('0x19')](_0x28b414[_0x5d44('0x2c')]['offset']);}_0x1f6bcf[_0x5d44('0x33')]=qs[_0x5d44('0x34')](_0x28b414[_0x5d44('0x2c')][_0x5d44('0x34')]);_0x1f6bcf[_0x5d44('0x35')]=qs['filters'](_['pick'](_0x28b414['query'],_0x2cf8b0[_0x5d44('0x36')]),_0x5c87bd);if(_0x28b414[_0x5d44('0x2c')][_0x5d44('0x37')]){_0x1f6bcf[_0x5d44('0x35')]=_['merge'](_0x1f6bcf[_0x5d44('0x35')],{'$or':_[_0x5d44('0x26')](_0x5c87bd,function(_0x157b1f){if(_0x157b1f['type']!==_0x5d44('0x38')){var _0x53fdf9={};_0x53fdf9[_0x157b1f[_0x5d44('0x23')]]={'$like':'%'+_0x28b414[_0x5d44('0x2c')]['filter']+'%'};return _0x53fdf9;}})});}_0x1f6bcf=_[_0x5d44('0x39')]({},_0x1f6bcf,_0x28b414[_0x5d44('0x3a')]);var _0x518b84={'where':_0x1f6bcf[_0x5d44('0x35')]};return db[_0x5d44('0x27')][_0x5d44('0x1c')](_0x518b84)[_0x5d44('0x3b')](function(_0x57234b){_0x4a9890[_0x5d44('0x1c')]=_0x57234b;if(_0x28b414[_0x5d44('0x2c')][_0x5d44('0x3c')]){_0x1f6bcf['include']=[{'all':!![]}];}return db[_0x5d44('0x27')][_0x5d44('0x3d')](_0x1f6bcf);})[_0x5d44('0x3b')](function(_0x4223ae){_0x4a9890[_0x5d44('0x3e')]=_0x4223ae;return _0x4a9890;})[_0x5d44('0x3b')](respondWithFilteredResult(_0x485aa6,_0x1f6bcf))[_0x5d44('0x3f')](handleError(_0x485aa6,null));};exports[_0x5d44('0x40')]=function(_0x5c555f,_0x16d89f){var _0x4cec48={'raw':!![],'where':{'id':_0x5c555f[_0x5d44('0x41')]['id']}},_0x13ac85={};_0x13ac85[_0x5d44('0x2b')]=_[_0x5d44('0x2d')](db[_0x5d44('0x27')]['rawAttributes']);_0x13ac85[_0x5d44('0x2c')]=_[_0x5d44('0x2d')](_0x5c555f[_0x5d44('0x2c')]);_0x13ac85['filters']=_[_0x5d44('0x2e')](_0x13ac85[_0x5d44('0x2b')],_0x13ac85[_0x5d44('0x2c')]);_0x4cec48[_0x5d44('0x2f')]=_[_0x5d44('0x2e')](_0x13ac85[_0x5d44('0x2b')],qs[_0x5d44('0x30')](_0x5c555f[_0x5d44('0x2c')][_0x5d44('0x30')]));_0x4cec48[_0x5d44('0x2f')]=_0x4cec48[_0x5d44('0x2f')][_0x5d44('0x31')]?_0x4cec48['attributes']:_0x13ac85[_0x5d44('0x2b')];if(_0x5c555f['query']['includeAll']){_0x4cec48['include']=[{'all':!![]}];}_0x4cec48=_[_0x5d44('0x39')]({},_0x4cec48,_0x5c555f[_0x5d44('0x3a')]);return db[_0x5d44('0x27')][_0x5d44('0x42')](_0x4cec48)[_0x5d44('0x3b')](handleEntityNotFound(_0x16d89f,null))[_0x5d44('0x3b')](respondWithResult(_0x16d89f,null))[_0x5d44('0x3f')](handleError(_0x16d89f,null));};exports[_0x5d44('0x43')]=function(_0x4ed527,_0xdbab07){return db[_0x5d44('0x27')][_0x5d44('0x43')](_0x4ed527[_0x5d44('0x44')],{})[_0x5d44('0x3b')](respondWithResult(_0xdbab07,0xc9))[_0x5d44('0x3f')](handleError(_0xdbab07,null));};exports['update']=function(_0x1f2e3d,_0x1c8b54){if(_0x1f2e3d[_0x5d44('0x44')]['id']){delete _0x1f2e3d[_0x5d44('0x44')]['id'];}return db[_0x5d44('0x27')][_0x5d44('0x42')]({'where':{'id':_0x1f2e3d[_0x5d44('0x41')]['id']}})[_0x5d44('0x3b')](handleEntityNotFound(_0x1c8b54,null))[_0x5d44('0x3b')](saveUpdates(_0x1f2e3d[_0x5d44('0x44')],null))['then'](respondWithResult(_0x1c8b54,null))[_0x5d44('0x3f')](handleError(_0x1c8b54,null));};exports[_0x5d44('0x20')]=function(_0x575da1,_0x565836){return db['MailServerOut'][_0x5d44('0x42')]({'where':{'id':_0x575da1[_0x5d44('0x41')]['id']}})[_0x5d44('0x3b')](handleEntityNotFound(_0x565836,null))[_0x5d44('0x3b')](removeEntity(_0x565836,null))[_0x5d44('0x3f')](handleError(_0x565836,null));}; \ No newline at end of file +var _0x55f0=['destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','querystring','papaparse','../../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','Content-Range','reject','save','update','then'];(function(_0x4f0e81,_0x1befbc){var _0x3caed0=function(_0x3b2813){while(--_0x3b2813){_0x4f0e81['push'](_0x4f0e81['shift']());}};_0x3caed0(++_0x1befbc);}(_0x55f0,0x148));var _0x055f=function(_0x4ca536,_0x57c8de){_0x4ca536=_0x4ca536-0x0;var _0x3bd35f=_0x55f0[_0x4ca536];return _0x3bd35f;};'use strict';var emlformat=require(_0x055f('0x0'));var rimraf=require(_0x055f('0x1'));var zipdir=require(_0x055f('0x2'));var jsonpatch=require(_0x055f('0x3'));var rp=require(_0x055f('0x4'));var moment=require(_0x055f('0x5'));var BPromise=require(_0x055f('0x6'));var Mustache=require(_0x055f('0x7'));var util=require(_0x055f('0x8'));var path=require(_0x055f('0x9'));var sox=require(_0x055f('0xa'));var csv=require(_0x055f('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x055f('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x055f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x055f('0xb'));var querystring=require(_0x055f('0xe'));var Papa=require(_0x055f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x055f('0x10'));var as=require(_0x055f('0x11'));var hardwareService=require(_0x055f('0x12'));var logger=require(_0x055f('0x13'))(_0x055f('0x14'));var utils=require(_0x055f('0x15'));var config=require(_0x055f('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32aede,_0x23acd2){_0x23acd2=_0x23acd2||0xcc;return function(_0x3f0581){if(_0x3f0581){return _0x32aede[_0x055f('0x17')](_0x23acd2);}return _0x32aede[_0x055f('0x18')](_0x23acd2)[_0x055f('0x19')]();};}function respondWithResult(_0x18e6bf,_0x21230c){_0x21230c=_0x21230c||0xc8;return function(_0x457206){if(_0x457206){return _0x18e6bf[_0x055f('0x18')](_0x21230c)[_0x055f('0x1a')](_0x457206);}};}function respondWithFilteredResult(_0x181948,_0x1c61e5){return function(_0x2e4148){if(_0x2e4148){var _0x399338=typeof _0x1c61e5['offset']===_0x055f('0x1b')&&typeof _0x1c61e5[_0x055f('0x1c')]===_0x055f('0x1b');var _0x1390b2=_0x2e4148[_0x055f('0x1d')];var _0x21d233=_0x399338?0x0:_0x1c61e5[_0x055f('0x1e')];var _0x19305d=_0x399338?_0x2e4148[_0x055f('0x1d')]:_0x1c61e5['offset']+_0x1c61e5[_0x055f('0x1c')];var _0x1f6d3f;if(_0x19305d>=_0x1390b2){_0x19305d=_0x1390b2;_0x1f6d3f=0xc8;}else{_0x1f6d3f=0xce;}_0x181948[_0x055f('0x18')](_0x1f6d3f);return _0x181948[_0x055f('0x1f')](_0x055f('0x20'),_0x21d233+'-'+_0x19305d+'/'+_0x1390b2)['json'](_0x2e4148);}return null;};}function patchUpdates(_0x5ce361){return function(_0x3b2ec4){try{jsonpatch['apply'](_0x3b2ec4,_0x5ce361,!![]);}catch(_0x2c7156){return BPromise[_0x055f('0x21')](_0x2c7156);}return _0x3b2ec4[_0x055f('0x22')]();};}function saveUpdates(_0x9c93b,_0x42df21){return function(_0x3f8fd1){if(_0x3f8fd1){return _0x3f8fd1[_0x055f('0x23')](_0x9c93b)[_0x055f('0x24')](function(_0x2280aa){return _0x2280aa;});}return null;};}function removeEntity(_0x249332,_0xb2ea09){return function(_0x14dce7){if(_0x14dce7){return _0x14dce7[_0x055f('0x25')]()['then'](function(){_0x249332['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc1234b,_0x60fbd4){return function(_0x4f0015){if(!_0x4f0015){_0xc1234b[_0x055f('0x17')](0x194);}return _0x4f0015;};}function handleError(_0x4de328,_0x4df9fa){_0x4df9fa=_0x4df9fa||0x1f4;return function(_0x44740d){logger[_0x055f('0x26')](_0x44740d[_0x055f('0x27')]);if(_0x44740d[_0x055f('0x28')]){delete _0x44740d[_0x055f('0x28')];}_0x4de328[_0x055f('0x18')](_0x4df9fa)[_0x055f('0x29')](_0x44740d);};}exports[_0x055f('0x2a')]=function(_0x1eb3ec,_0x3acd63){var _0x3fc70b={},_0xecc743={},_0x73fe50={'count':0x0,'rows':[]};var _0x4c74ac=_[_0x055f('0x2b')](db[_0x055f('0x2c')][_0x055f('0x2d')],function(_0x103c67){return{'name':_0x103c67['fieldName'],'type':_0x103c67['type']['key']};});_0xecc743[_0x055f('0x2e')]=_[_0x055f('0x2b')](_0x4c74ac,'name');_0xecc743[_0x055f('0x2f')]=_[_0x055f('0x30')](_0x1eb3ec[_0x055f('0x2f')]);_0xecc743['filters']=_[_0x055f('0x31')](_0xecc743[_0x055f('0x2e')],_0xecc743[_0x055f('0x2f')]);_0x3fc70b['attributes']=_['intersection'](_0xecc743[_0x055f('0x2e')],qs[_0x055f('0x32')](_0x1eb3ec[_0x055f('0x2f')][_0x055f('0x32')]));_0x3fc70b[_0x055f('0x33')]=_0x3fc70b[_0x055f('0x33')][_0x055f('0x34')]?_0x3fc70b[_0x055f('0x33')]:_0xecc743[_0x055f('0x2e')];if(!_0x1eb3ec['query'][_0x055f('0x35')](_0x055f('0x36'))){_0x3fc70b[_0x055f('0x1c')]=qs[_0x055f('0x1c')](_0x1eb3ec[_0x055f('0x2f')][_0x055f('0x1c')]);_0x3fc70b['offset']=qs[_0x055f('0x1e')](_0x1eb3ec[_0x055f('0x2f')][_0x055f('0x1e')]);}_0x3fc70b['order']=qs['sort'](_0x1eb3ec[_0x055f('0x2f')][_0x055f('0x37')]);_0x3fc70b[_0x055f('0x38')]=qs[_0x055f('0x39')](_['pick'](_0x1eb3ec[_0x055f('0x2f')],_0xecc743['filters']),_0x4c74ac);if(_0x1eb3ec[_0x055f('0x2f')][_0x055f('0x3a')]){_0x3fc70b[_0x055f('0x38')]=_['merge'](_0x3fc70b[_0x055f('0x38')],{'$or':_[_0x055f('0x2b')](_0x4c74ac,function(_0x3c6ec7){if(_0x3c6ec7[_0x055f('0x3b')]!==_0x055f('0x3c')){var _0x13eb00={};_0x13eb00[_0x3c6ec7[_0x055f('0x28')]]={'$like':'%'+_0x1eb3ec[_0x055f('0x2f')][_0x055f('0x3a')]+'%'};return _0x13eb00;}})});}_0x3fc70b=_[_0x055f('0x3d')]({},_0x3fc70b,_0x1eb3ec[_0x055f('0x3e')]);var _0x299358={'where':_0x3fc70b['where']};return db[_0x055f('0x2c')]['count'](_0x299358)[_0x055f('0x24')](function(_0x558d59){_0x73fe50[_0x055f('0x1d')]=_0x558d59;if(_0x1eb3ec['query'][_0x055f('0x3f')]){_0x3fc70b[_0x055f('0x40')]=[{'all':!![]}];}return db[_0x055f('0x2c')][_0x055f('0x41')](_0x3fc70b);})[_0x055f('0x24')](function(_0x54c10a){_0x73fe50[_0x055f('0x42')]=_0x54c10a;return _0x73fe50;})[_0x055f('0x24')](respondWithFilteredResult(_0x3acd63,_0x3fc70b))[_0x055f('0x43')](handleError(_0x3acd63,null));};exports[_0x055f('0x44')]=function(_0x12bc53,_0x2b5cca){var _0x531633={'raw':!![],'where':{'id':_0x12bc53['params']['id']}},_0x50e0f5={};_0x50e0f5[_0x055f('0x2e')]=_[_0x055f('0x30')](db[_0x055f('0x2c')][_0x055f('0x2d')]);_0x50e0f5['query']=_['keys'](_0x12bc53[_0x055f('0x2f')]);_0x50e0f5['filters']=_['intersection'](_0x50e0f5['model'],_0x50e0f5[_0x055f('0x2f')]);_0x531633[_0x055f('0x33')]=_[_0x055f('0x31')](_0x50e0f5[_0x055f('0x2e')],qs[_0x055f('0x32')](_0x12bc53['query'][_0x055f('0x32')]));_0x531633[_0x055f('0x33')]=_0x531633[_0x055f('0x33')][_0x055f('0x34')]?_0x531633['attributes']:_0x50e0f5['model'];if(_0x12bc53[_0x055f('0x2f')]['includeAll']){_0x531633['include']=[{'all':!![]}];}_0x531633=_[_0x055f('0x3d')]({},_0x531633,_0x12bc53['options']);return db[_0x055f('0x2c')][_0x055f('0x45')](_0x531633)[_0x055f('0x24')](handleEntityNotFound(_0x2b5cca,null))['then'](respondWithResult(_0x2b5cca,null))[_0x055f('0x43')](handleError(_0x2b5cca,null));};exports[_0x055f('0x46')]=function(_0x382de3,_0x262b6b){return db['MailServerOut']['create'](_0x382de3['body'],{})[_0x055f('0x24')](respondWithResult(_0x262b6b,0xc9))[_0x055f('0x43')](handleError(_0x262b6b,null));};exports[_0x055f('0x23')]=function(_0x352bb9,_0x571ab5){if(_0x352bb9[_0x055f('0x47')]['id']){delete _0x352bb9[_0x055f('0x47')]['id'];}return db[_0x055f('0x2c')][_0x055f('0x45')]({'where':{'id':_0x352bb9[_0x055f('0x48')]['id']}})['then'](handleEntityNotFound(_0x571ab5,null))[_0x055f('0x24')](saveUpdates(_0x352bb9[_0x055f('0x47')],null))['then'](respondWithResult(_0x571ab5,null))['catch'](handleError(_0x571ab5,null));};exports[_0x055f('0x25')]=function(_0x9e16dd,_0x52ceff){return db[_0x055f('0x2c')][_0x055f('0x45')]({'where':{'id':_0x9e16dd[_0x055f('0x48')]['id']}})[_0x055f('0x24')](handleEntityNotFound(_0x52ceff,null))[_0x055f('0x24')](removeEntity(_0x52ceff,null))[_0x055f('0x43')](handleError(_0x52ceff,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 7547787..271a8d4 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 _0xaf01=['MailServerOut','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x7ddaad,_0x3e215b){var _0x3daa27=function(_0x1a6c9b){while(--_0x1a6c9b){_0x7ddaad['push'](_0x7ddaad['shift']());}};_0x3daa27(++_0x3e215b);}(_0xaf01,0x161));var _0x1af0=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xaf01[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0x1af0('0x0'));var logger=require(_0x1af0('0x1'))(_0x1af0('0x2'));var moment=require('moment');var BPromise=require(_0x1af0('0x3'));var rp=require(_0x1af0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1af0('0x5'));var config=require(_0x1af0('0x6'));var attributes=require(_0x1af0('0x7'));module[_0x1af0('0x8')]=function(_0x57974b,_0x2d6a2d){return _0x57974b[_0x1af0('0x9')](_0x1af0('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae06=['api','path','rimraf','../../config/environment','./mailServerOut.attributes','define','mail_servers_out','lodash','util','../../config/logger'];(function(_0x1bc989,_0x4130ce){var _0x488ead=function(_0xf5c90c){while(--_0xf5c90c){_0x1bc989['push'](_0x1bc989['shift']());}};_0x488ead(++_0x4130ce);}(_0xae06,0x1dd));var _0x6ae0=function(_0x4251ea,_0x5d1ad8){_0x4251ea=_0x4251ea-0x0;var _0x4c3a07=_0xae06[_0x4251ea];return _0x4c3a07;};'use strict';var _=require(_0x6ae0('0x0'));var util=require(_0x6ae0('0x1'));var logger=require(_0x6ae0('0x2'))(_0x6ae0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ae0('0x4'));var rimraf=require(_0x6ae0('0x5'));var config=require(_0x6ae0('0x6'));var attributes=require(_0x6ae0('0x7'));module['exports']=function(_0xd7d398,_0x5f0037){return _0xd7d398[_0x6ae0('0x8')]('MailServerOut',attributes,{'tableName':_0x6ae0('0x9'),'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 25ce4bf..721e384 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x1e0ce5,_0xd284b0){var _0x5196d4=function(_0x371f48){while(--_0x371f48){_0x1e0ce5['push'](_0x1e0ce5['shift']());}};_0x5196d4(++_0xd284b0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2a2591,_0x958577){_0x2a2591=_0x2a2591-0x0;var _0x45bde5=_0x5f2f[_0x2a2591];return _0x45bde5;};'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')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x1993b0,_0x4729e7){_0x1993b0=_0x1993b0-0x0;var _0x284eeb=_0x7a54[_0x1993b0];return _0x284eeb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index f3c5d45..f80e442 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 _0xc310=['/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0xc310,0x1ea));var _0x0c31=function(_0x293f09,_0x357af5){_0x293f09=_0x293f09-0x0;var _0x588bd3=_0xc310[_0x293f09];return _0x588bd3;};'use strict';var multer=require(_0x0c31('0x0'));var util=require('util');var path=require(_0x0c31('0x1'));var timeout=require('connect-timeout');var express=require(_0x0c31('0x2'));var router=express[_0x0c31('0x3')]();var fs_extra=require(_0x0c31('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0c31('0x5'));var config=require(_0x0c31('0x6'));var controller=require(_0x0c31('0x7'));router[_0x0c31('0x8')]('/',auth[_0x0c31('0x9')](),controller['index']);router[_0x0c31('0x8')](_0x0c31('0xa'),auth[_0x0c31('0x9')](),controller[_0x0c31('0xb')]);router[_0x0c31('0x8')](_0x0c31('0xc'),auth[_0x0c31('0x9')](),controller['show']);router[_0x0c31('0xd')]('/',auth[_0x0c31('0x9')](),controller[_0x0c31('0xe')]);router[_0x0c31('0xf')](_0x0c31('0xc'),auth[_0x0c31('0x9')](),controller[_0x0c31('0x10')]);router[_0x0c31('0x11')](_0x0c31('0xc'),auth[_0x0c31('0x9')](),controller[_0x0c31('0x12')]);module[_0x0c31('0x13')]=router; \ No newline at end of file +var _0xd073=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','show','put','delete','/:id'];(function(_0x3db122,_0x5e6bee){var _0x325b67=function(_0x5095af){while(--_0x5095af){_0x3db122['push'](_0x3db122['shift']());}};_0x325b67(++_0x5e6bee);}(_0xd073,0xa2));var _0x3d07=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd073[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x3d07('0x0'));var util=require(_0x3d07('0x1'));var path=require(_0x3d07('0x2'));var timeout=require(_0x3d07('0x3'));var express=require('express');var router=express[_0x3d07('0x4')]();var fs_extra=require(_0x3d07('0x5'));var auth=require(_0x3d07('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3d07('0x7'));var controller=require(_0x3d07('0x8'));router[_0x3d07('0x9')]('/',auth[_0x3d07('0xa')](),controller[_0x3d07('0xb')]);router[_0x3d07('0x9')](_0x3d07('0xc'),auth[_0x3d07('0xa')](),controller[_0x3d07('0xd')]);router['get']('/:id',auth[_0x3d07('0xa')](),controller[_0x3d07('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3d07('0xf')]('/:id',auth[_0x3d07('0xa')](),controller['update']);router[_0x3d07('0x10')](_0x3d07('0x11'),auth[_0x3d07('0xa')](),controller[_0x3d07('0x12')]);module[_0x3d07('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 15fc10c..89e0e3d 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 _0x01d9=['sequelize','exports','STRING','name'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x901d('0x0'));module[_0x901d('0x1')]={'name':{'type':Sequelize[_0x901d('0x2')],'unique':_0x901d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x85d0=['STRING'];(function(_0x3269e0,_0x40c713){var _0x1895bf=function(_0x49fd25){while(--_0x49fd25){_0x3269e0['push'](_0x3269e0['shift']());}};_0x1895bf(++_0x40c713);}(_0x85d0,0x164));var _0x085d=function(_0x2788be,_0x152fab){_0x2788be=_0x2788be-0x0;var _0x33832a=_0x85d0[_0x2788be];return _0x33832a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x085d('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 6cd53f5..90ee06c 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 _0xcb7c=['end','json','offset','undefined','count','limit','reject','update','then','stack','name','index','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','params','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x5eb2be,_0x293748){var _0xe503ef=function(_0x4724d0){while(--_0x4724d0){_0x5eb2be['push'](_0x5eb2be['shift']());}};_0xe503ef(++_0x293748);}(_0xcb7c,0x76));var _0xccb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb7c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xccb7('0x0'));var rimraf=require(_0xccb7('0x1'));var zipdir=require(_0xccb7('0x2'));var jsonpatch=require(_0xccb7('0x3'));var rp=require(_0xccb7('0x4'));var moment=require(_0xccb7('0x5'));var BPromise=require(_0xccb7('0x6'));var Mustache=require('mustache');var util=require(_0xccb7('0x7'));var path=require(_0xccb7('0x8'));var sox=require(_0xccb7('0x9'));var csv=require(_0xccb7('0xa'));var ejs=require(_0xccb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xccb7('0xc'));var squel=require(_0xccb7('0xd'));var crypto=require(_0xccb7('0xe'));var jsforce=require(_0xccb7('0xf'));var deskjs=require(_0xccb7('0x10'));var toCsv=require(_0xccb7('0xa'));var querystring=require('querystring');var Papa=require(_0xccb7('0x11'));var Redis=require(_0xccb7('0x12'));var authService=require(_0xccb7('0x13'));var qs=require(_0xccb7('0x14'));var as=require(_0xccb7('0x15'));var hardwareService=require(_0xccb7('0x16'));var logger=require('../../config/logger')(_0xccb7('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xccb7('0x18'));var db=require(_0xccb7('0x19'))['db'];function respondWithStatusCode(_0x257cad,_0x169eb0){_0x169eb0=_0x169eb0||0xcc;return function(_0x35480b){if(_0x35480b){return _0x257cad[_0xccb7('0x1a')](_0x169eb0);}return _0x257cad[_0xccb7('0x1b')](_0x169eb0)[_0xccb7('0x1c')]();};}function respondWithResult(_0x2abefc,_0x130abc){_0x130abc=_0x130abc||0xc8;return function(_0x577f5b){if(_0x577f5b){return _0x2abefc[_0xccb7('0x1b')](_0x130abc)[_0xccb7('0x1d')](_0x577f5b);}};}function respondWithFilteredResult(_0x54f2db,_0x3483cc){return function(_0x250c02){if(_0x250c02){var _0xa067ee=typeof _0x3483cc[_0xccb7('0x1e')]===_0xccb7('0x1f')&&typeof _0x3483cc['limit']===_0xccb7('0x1f');var _0xb5e5d1=_0x250c02['count'];var _0x32ee61=_0xa067ee?0x0:_0x3483cc['offset'];var _0x20a996=_0xa067ee?_0x250c02[_0xccb7('0x20')]:_0x3483cc[_0xccb7('0x1e')]+_0x3483cc[_0xccb7('0x21')];var _0x355e07;if(_0x20a996>=_0xb5e5d1){_0x20a996=_0xb5e5d1;_0x355e07=0xc8;}else{_0x355e07=0xce;}_0x54f2db[_0xccb7('0x1b')](_0x355e07);return _0x54f2db['set']('Content-Range',_0x32ee61+'-'+_0x20a996+'/'+_0xb5e5d1)[_0xccb7('0x1d')](_0x250c02);}return null;};}function patchUpdates(_0x1d6d65){return function(_0x5d0395){try{jsonpatch['apply'](_0x5d0395,_0x1d6d65,!![]);}catch(_0x1d7b4b){return BPromise[_0xccb7('0x22')](_0x1d7b4b);}return _0x5d0395['save']();};}function saveUpdates(_0x47673c,_0x2b58a5){return function(_0x548051){if(_0x548051){return _0x548051[_0xccb7('0x23')](_0x47673c)['then'](function(_0x2b35cd){return _0x2b35cd;});}return null;};}function removeEntity(_0x47113d,_0x209437){return function(_0xedf19b){if(_0xedf19b){return _0xedf19b['destroy']()[_0xccb7('0x24')](function(){_0x47113d[_0xccb7('0x1b')](0xcc)[_0xccb7('0x1c')]();});}};}function handleEntityNotFound(_0x578e56,_0x252f03){return function(_0x567369){if(!_0x567369){_0x578e56[_0xccb7('0x1a')](0x194);}return _0x567369;};}function handleError(_0x4dad7f,_0x222e2d){_0x222e2d=_0x222e2d||0x1f4;return function(_0x126aec){logger['error'](_0x126aec[_0xccb7('0x25')]);if(_0x126aec[_0xccb7('0x26')]){delete _0x126aec[_0xccb7('0x26')];}_0x4dad7f['status'](_0x222e2d)['send'](_0x126aec);};}exports[_0xccb7('0x27')]=function(_0x48fd01,_0x29f7b9){var _0x46f87e={},_0x2ebbdb={},_0x132c36={'count':0x0,'rows':[]};var _0x360b33=_['map'](db[_0xccb7('0x28')][_0xccb7('0x29')],function(_0x113126){return{'name':_0x113126[_0xccb7('0x2a')],'type':_0x113126['type'][_0xccb7('0x2b')]};});_0x2ebbdb[_0xccb7('0x2c')]=_['map'](_0x360b33,_0xccb7('0x26'));_0x2ebbdb[_0xccb7('0x2d')]=_[_0xccb7('0x2e')](_0x48fd01['query']);_0x2ebbdb[_0xccb7('0x2f')]=_[_0xccb7('0x30')](_0x2ebbdb[_0xccb7('0x2c')],_0x2ebbdb[_0xccb7('0x2d')]);_0x46f87e[_0xccb7('0x31')]=_[_0xccb7('0x30')](_0x2ebbdb[_0xccb7('0x2c')],qs[_0xccb7('0x32')](_0x48fd01['query'][_0xccb7('0x32')]));_0x46f87e['attributes']=_0x46f87e[_0xccb7('0x31')][_0xccb7('0x33')]?_0x46f87e[_0xccb7('0x31')]:_0x2ebbdb[_0xccb7('0x2c')];if(!_0x48fd01[_0xccb7('0x2d')][_0xccb7('0x34')](_0xccb7('0x35'))){_0x46f87e[_0xccb7('0x21')]=qs[_0xccb7('0x21')](_0x48fd01[_0xccb7('0x2d')]['limit']);_0x46f87e[_0xccb7('0x1e')]=qs[_0xccb7('0x1e')](_0x48fd01[_0xccb7('0x2d')]['offset']);}_0x46f87e[_0xccb7('0x36')]=qs[_0xccb7('0x37')](_0x48fd01[_0xccb7('0x2d')][_0xccb7('0x37')]);_0x46f87e[_0xccb7('0x38')]=qs['filters'](_[_0xccb7('0x39')](_0x48fd01['query'],_0x2ebbdb[_0xccb7('0x2f')]),_0x360b33);if(_0x48fd01[_0xccb7('0x2d')][_0xccb7('0x3a')]){_0x46f87e['where']=_[_0xccb7('0x3b')](_0x46f87e[_0xccb7('0x38')],{'$or':_[_0xccb7('0x3c')](_0x360b33,function(_0x536ed9){if(_0x536ed9['type']!==_0xccb7('0x3d')){var _0x260e0e={};_0x260e0e[_0x536ed9[_0xccb7('0x26')]]={'$like':'%'+_0x48fd01[_0xccb7('0x2d')][_0xccb7('0x3a')]+'%'};return _0x260e0e;}})});}_0x46f87e=_[_0xccb7('0x3b')]({},_0x46f87e,_0x48fd01[_0xccb7('0x3e')]);var _0x52d896={'where':_0x46f87e[_0xccb7('0x38')]};return db[_0xccb7('0x28')][_0xccb7('0x20')](_0x52d896)['then'](function(_0x9f8eea){_0x132c36[_0xccb7('0x20')]=_0x9f8eea;if(_0x48fd01[_0xccb7('0x2d')]['includeAll']){_0x46f87e[_0xccb7('0x3f')]=[{'all':!![]}];}return db['MailSubstatus'][_0xccb7('0x40')](_0x46f87e);})[_0xccb7('0x24')](function(_0x42033f){_0x132c36[_0xccb7('0x41')]=_0x42033f;return _0x132c36;})[_0xccb7('0x24')](respondWithFilteredResult(_0x29f7b9,_0x46f87e))['catch'](handleError(_0x29f7b9,null));};exports['show']=function(_0x36f731,_0x1e618a){var _0x40ec03={'raw':!![],'where':{'id':_0x36f731[_0xccb7('0x42')]['id']}},_0x3d38ff={};_0x3d38ff[_0xccb7('0x2c')]=_[_0xccb7('0x2e')](db[_0xccb7('0x28')]['rawAttributes']);_0x3d38ff['query']=_['keys'](_0x36f731[_0xccb7('0x2d')]);_0x3d38ff[_0xccb7('0x2f')]=_[_0xccb7('0x30')](_0x3d38ff[_0xccb7('0x2c')],_0x3d38ff[_0xccb7('0x2d')]);_0x40ec03[_0xccb7('0x31')]=_[_0xccb7('0x30')](_0x3d38ff[_0xccb7('0x2c')],qs[_0xccb7('0x32')](_0x36f731[_0xccb7('0x2d')][_0xccb7('0x32')]));_0x40ec03[_0xccb7('0x31')]=_0x40ec03['attributes'][_0xccb7('0x33')]?_0x40ec03['attributes']:_0x3d38ff[_0xccb7('0x2c')];if(_0x36f731[_0xccb7('0x2d')]['includeAll']){_0x40ec03['include']=[{'all':!![]}];}_0x40ec03=_[_0xccb7('0x3b')]({},_0x40ec03,_0x36f731[_0xccb7('0x3e')]);return db[_0xccb7('0x28')][_0xccb7('0x43')](_0x40ec03)[_0xccb7('0x24')](handleEntityNotFound(_0x1e618a,null))[_0xccb7('0x24')](respondWithResult(_0x1e618a,null))[_0xccb7('0x44')](handleError(_0x1e618a,null));};exports[_0xccb7('0x45')]=function(_0x569595,_0x3c9777){return db['MailSubstatus'][_0xccb7('0x45')](_0x569595[_0xccb7('0x46')],{})['then'](respondWithResult(_0x3c9777,0xc9))[_0xccb7('0x44')](handleError(_0x3c9777,null));};exports[_0xccb7('0x23')]=function(_0x1ebd51,_0xb12a1e){if(_0x1ebd51['body']['id']){delete _0x1ebd51['body']['id'];}return db['MailSubstatus'][_0xccb7('0x43')]({'where':{'id':_0x1ebd51[_0xccb7('0x42')]['id']}})['then'](handleEntityNotFound(_0xb12a1e,null))[_0xccb7('0x24')](saveUpdates(_0x1ebd51[_0xccb7('0x46')],null))[_0xccb7('0x24')](respondWithResult(_0xb12a1e,null))[_0xccb7('0x44')](handleError(_0xb12a1e,null));};exports[_0xccb7('0x47')]=function(_0x270b2c,_0x1dff96){return db[_0xccb7('0x28')][_0xccb7('0x43')]({'where':{'id':_0x270b2c[_0xccb7('0x42')]['id']}})[_0xccb7('0x24')](handleEntityNotFound(_0x1dff96,null))[_0xccb7('0x24')](removeEntity(_0x1dff96,null))[_0xccb7('0x44')](handleError(_0x1dff96,null));};exports[_0xccb7('0x48')]=function(_0x5f0c97,_0x48d649){return db['MailSubstatus']['describe']()[_0xccb7('0x24')](respondWithResult(_0x48d649,null))[_0xccb7('0x44')](handleError(_0x48d649,null));}; \ No newline at end of file +var _0xc1c4=['body','update','find','catch','describe','eml-format','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','type','key','map','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','MailSubstatus','includeAll','include','findAll','rows','show','params','keys','length','create'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x48a098,_0x3eda79){_0x48a098=_0x48a098-0x0;var _0x4ef28d=_0xc1c4[_0x48a098];return _0x4ef28d;};'use strict';var emlformat=require(_0x4c1c('0x0'));var rimraf=require(_0x4c1c('0x1'));var zipdir=require(_0x4c1c('0x2'));var jsonpatch=require(_0x4c1c('0x3'));var rp=require(_0x4c1c('0x4'));var moment=require(_0x4c1c('0x5'));var BPromise=require(_0x4c1c('0x6'));var Mustache=require('mustache');var util=require(_0x4c1c('0x7'));var path=require(_0x4c1c('0x8'));var sox=require(_0x4c1c('0x9'));var csv=require(_0x4c1c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c1c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4c1c('0xc'));var jsforce=require(_0x4c1c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4c1c('0xa'));var querystring=require(_0x4c1c('0xe'));var Papa=require(_0x4c1c('0xf'));var Redis=require(_0x4c1c('0x10'));var authService=require(_0x4c1c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4c1c('0x12'));var logger=require(_0x4c1c('0x13'))(_0x4c1c('0x14'));var utils=require(_0x4c1c('0x15'));var config=require(_0x4c1c('0x16'));var licenseUtil=require(_0x4c1c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d596e,_0x7fbeb0){_0x7fbeb0=_0x7fbeb0||0xcc;return function(_0x18c3e7){if(_0x18c3e7){return _0x4d596e[_0x4c1c('0x18')](_0x7fbeb0);}return _0x4d596e[_0x4c1c('0x19')](_0x7fbeb0)[_0x4c1c('0x1a')]();};}function respondWithResult(_0x48f8f6,_0x160ee0){_0x160ee0=_0x160ee0||0xc8;return function(_0x53123e){if(_0x53123e){return _0x48f8f6['status'](_0x160ee0)[_0x4c1c('0x1b')](_0x53123e);}};}function respondWithFilteredResult(_0x1ff604,_0x3e37a7){return function(_0x3fde68){if(_0x3fde68){var _0x3b71de=typeof _0x3e37a7[_0x4c1c('0x1c')]===_0x4c1c('0x1d')&&typeof _0x3e37a7[_0x4c1c('0x1e')]===_0x4c1c('0x1d');var _0x2259ed=_0x3fde68[_0x4c1c('0x1f')];var _0x5a9217=_0x3b71de?0x0:_0x3e37a7[_0x4c1c('0x1c')];var _0x213019=_0x3b71de?_0x3fde68[_0x4c1c('0x1f')]:_0x3e37a7[_0x4c1c('0x1c')]+_0x3e37a7[_0x4c1c('0x1e')];var _0x3cbcd4;if(_0x213019>=_0x2259ed){_0x213019=_0x2259ed;_0x3cbcd4=0xc8;}else{_0x3cbcd4=0xce;}_0x1ff604[_0x4c1c('0x19')](_0x3cbcd4);return _0x1ff604[_0x4c1c('0x20')](_0x4c1c('0x21'),_0x5a9217+'-'+_0x213019+'/'+_0x2259ed)[_0x4c1c('0x1b')](_0x3fde68);}return null;};}function patchUpdates(_0x58aca9){return function(_0x5a22be){try{jsonpatch[_0x4c1c('0x22')](_0x5a22be,_0x58aca9,!![]);}catch(_0x53785e){return BPromise[_0x4c1c('0x23')](_0x53785e);}return _0x5a22be[_0x4c1c('0x24')]();};}function saveUpdates(_0x5937a1,_0x23377c){return function(_0x4956e0){if(_0x4956e0){return _0x4956e0['update'](_0x5937a1)[_0x4c1c('0x25')](function(_0x449b38){return _0x449b38;});}return null;};}function removeEntity(_0x33b41b,_0x13c2a1){return function(_0x3117d2){if(_0x3117d2){return _0x3117d2['destroy']()[_0x4c1c('0x25')](function(){_0x33b41b[_0x4c1c('0x19')](0xcc)[_0x4c1c('0x1a')]();});}};}function handleEntityNotFound(_0x1ec87a,_0x27f648){return function(_0x4a1e7c){if(!_0x4a1e7c){_0x1ec87a['sendStatus'](0x194);}return _0x4a1e7c;};}function handleError(_0x31bfa5,_0x4c9b2c){_0x4c9b2c=_0x4c9b2c||0x1f4;return function(_0x1104d4){logger['error'](_0x1104d4[_0x4c1c('0x26')]);if(_0x1104d4[_0x4c1c('0x27')]){delete _0x1104d4[_0x4c1c('0x27')];}_0x31bfa5['status'](_0x4c9b2c)[_0x4c1c('0x28')](_0x1104d4);};}exports[_0x4c1c('0x29')]=function(_0x3d6786,_0xb1e9b5){var _0xd9122d={},_0x281286={},_0x3ab2cb={'count':0x0,'rows':[]};var _0x20e2b8=_['map'](db['MailSubstatus']['rawAttributes'],function(_0x492665){return{'name':_0x492665['fieldName'],'type':_0x492665[_0x4c1c('0x2a')][_0x4c1c('0x2b')]};});_0x281286['model']=_[_0x4c1c('0x2c')](_0x20e2b8,_0x4c1c('0x27'));_0x281286['query']=_['keys'](_0x3d6786[_0x4c1c('0x2d')]);_0x281286[_0x4c1c('0x2e')]=_[_0x4c1c('0x2f')](_0x281286['model'],_0x281286['query']);_0xd9122d[_0x4c1c('0x30')]=_[_0x4c1c('0x2f')](_0x281286[_0x4c1c('0x31')],qs[_0x4c1c('0x32')](_0x3d6786[_0x4c1c('0x2d')]['fields']));_0xd9122d[_0x4c1c('0x30')]=_0xd9122d[_0x4c1c('0x30')]['length']?_0xd9122d[_0x4c1c('0x30')]:_0x281286[_0x4c1c('0x31')];if(!_0x3d6786['query'][_0x4c1c('0x33')](_0x4c1c('0x34'))){_0xd9122d[_0x4c1c('0x1e')]=qs[_0x4c1c('0x1e')](_0x3d6786['query']['limit']);_0xd9122d['offset']=qs[_0x4c1c('0x1c')](_0x3d6786[_0x4c1c('0x2d')][_0x4c1c('0x1c')]);}_0xd9122d['order']=qs[_0x4c1c('0x35')](_0x3d6786['query'][_0x4c1c('0x35')]);_0xd9122d[_0x4c1c('0x36')]=qs[_0x4c1c('0x2e')](_[_0x4c1c('0x37')](_0x3d6786[_0x4c1c('0x2d')],_0x281286[_0x4c1c('0x2e')]),_0x20e2b8);if(_0x3d6786[_0x4c1c('0x2d')][_0x4c1c('0x38')]){_0xd9122d[_0x4c1c('0x36')]=_[_0x4c1c('0x39')](_0xd9122d[_0x4c1c('0x36')],{'$or':_[_0x4c1c('0x2c')](_0x20e2b8,function(_0x1d8460){if(_0x1d8460[_0x4c1c('0x2a')]!==_0x4c1c('0x3a')){var _0x3c4aad={};_0x3c4aad[_0x1d8460['name']]={'$like':'%'+_0x3d6786['query'][_0x4c1c('0x38')]+'%'};return _0x3c4aad;}})});}_0xd9122d=_['merge']({},_0xd9122d,_0x3d6786[_0x4c1c('0x3b')]);var _0x23cc62={'where':_0xd9122d[_0x4c1c('0x36')]};return db[_0x4c1c('0x3c')]['count'](_0x23cc62)[_0x4c1c('0x25')](function(_0x1e44b5){_0x3ab2cb[_0x4c1c('0x1f')]=_0x1e44b5;if(_0x3d6786['query'][_0x4c1c('0x3d')]){_0xd9122d[_0x4c1c('0x3e')]=[{'all':!![]}];}return db[_0x4c1c('0x3c')][_0x4c1c('0x3f')](_0xd9122d);})[_0x4c1c('0x25')](function(_0x3f68e0){_0x3ab2cb[_0x4c1c('0x40')]=_0x3f68e0;return _0x3ab2cb;})[_0x4c1c('0x25')](respondWithFilteredResult(_0xb1e9b5,_0xd9122d))['catch'](handleError(_0xb1e9b5,null));};exports[_0x4c1c('0x41')]=function(_0x2313a4,_0x203c61){var _0x16f95c={'raw':!![],'where':{'id':_0x2313a4[_0x4c1c('0x42')]['id']}},_0x5d775e={};_0x5d775e[_0x4c1c('0x31')]=_[_0x4c1c('0x43')](db[_0x4c1c('0x3c')]['rawAttributes']);_0x5d775e['query']=_[_0x4c1c('0x43')](_0x2313a4['query']);_0x5d775e[_0x4c1c('0x2e')]=_[_0x4c1c('0x2f')](_0x5d775e[_0x4c1c('0x31')],_0x5d775e['query']);_0x16f95c[_0x4c1c('0x30')]=_[_0x4c1c('0x2f')](_0x5d775e[_0x4c1c('0x31')],qs['fields'](_0x2313a4[_0x4c1c('0x2d')][_0x4c1c('0x32')]));_0x16f95c[_0x4c1c('0x30')]=_0x16f95c[_0x4c1c('0x30')][_0x4c1c('0x44')]?_0x16f95c['attributes']:_0x5d775e[_0x4c1c('0x31')];if(_0x2313a4['query'][_0x4c1c('0x3d')]){_0x16f95c[_0x4c1c('0x3e')]=[{'all':!![]}];}_0x16f95c=_[_0x4c1c('0x39')]({},_0x16f95c,_0x2313a4[_0x4c1c('0x3b')]);return db[_0x4c1c('0x3c')]['find'](_0x16f95c)[_0x4c1c('0x25')](handleEntityNotFound(_0x203c61,null))['then'](respondWithResult(_0x203c61,null))['catch'](handleError(_0x203c61,null));};exports[_0x4c1c('0x45')]=function(_0x33a166,_0x545529){return db[_0x4c1c('0x3c')][_0x4c1c('0x45')](_0x33a166[_0x4c1c('0x46')],{})[_0x4c1c('0x25')](respondWithResult(_0x545529,0xc9))['catch'](handleError(_0x545529,null));};exports[_0x4c1c('0x47')]=function(_0x4a4054,_0x32117a){if(_0x4a4054[_0x4c1c('0x46')]['id']){delete _0x4a4054[_0x4c1c('0x46')]['id'];}return db[_0x4c1c('0x3c')]['find']({'where':{'id':_0x4a4054[_0x4c1c('0x42')]['id']}})[_0x4c1c('0x25')](handleEntityNotFound(_0x32117a,null))[_0x4c1c('0x25')](saveUpdates(_0x4a4054[_0x4c1c('0x46')],null))['then'](respondWithResult(_0x32117a,null))['catch'](handleError(_0x32117a,null));};exports['destroy']=function(_0x27568d,_0x37e8d8){return db[_0x4c1c('0x3c')][_0x4c1c('0x48')]({'where':{'id':_0x27568d[_0x4c1c('0x42')]['id']}})[_0x4c1c('0x25')](handleEntityNotFound(_0x37e8d8,null))[_0x4c1c('0x25')](removeEntity(_0x37e8d8,null))[_0x4c1c('0x49')](handleError(_0x37e8d8,null));};exports['describe']=function(_0xb56164,_0x3eda79){return db[_0x4c1c('0x3c')][_0x4c1c('0x4a')]()[_0x4c1c('0x25')](respondWithResult(_0x3eda79,null))['catch'](handleError(_0x3eda79,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index f97eb91..f0dc480 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 _0x2f96=['events','../../mysqldb','MailSubstatus','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x418a4d,_0x58f45c){var _0x395457=function(_0x4fd659){while(--_0x4fd659){_0x418a4d['push'](_0x418a4d['shift']());}};_0x395457(++_0x58f45c);}(_0x2f96,0x168));var _0x62f9=function(_0x43f614,_0x208d0b){_0x43f614=_0x43f614-0x0;var _0x4cc742=_0x2f96[_0x43f614];return _0x4cc742;};'use strict';var EventEmitter=require(_0x62f9('0x0'));var MailSubstatus=require(_0x62f9('0x1'))['db'][_0x62f9('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x62f9('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x2d1fad){return function(_0x2dbe97,_0x49eee8,_0x4336ff){MailSubstatusEvents[_0x62f9('0x4')](_0x2d1fad+':'+_0x2dbe97['id'],_0x2dbe97);MailSubstatusEvents[_0x62f9('0x4')](_0x2d1fad,_0x2dbe97);_0x4336ff(null);};}for(var e in events){if(events[_0x62f9('0x5')](e)){var event=events[e];MailSubstatus[_0x62f9('0x6')](e,emitEvent(event));}}module[_0x62f9('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x5bc4=['hook','exports','events','MailSubstatus','setMaxListeners','emit'];(function(_0x2d6cae,_0x4578a7){var _0x1fc654=function(_0x4b80b0){while(--_0x4b80b0){_0x2d6cae['push'](_0x2d6cae['shift']());}};_0x1fc654(++_0x4578a7);}(_0x5bc4,0x188));var _0x45bc=function(_0x13dd1f,_0x2aca89){_0x13dd1f=_0x13dd1f-0x0;var _0x47741f=_0x5bc4[_0x13dd1f];return _0x47741f;};'use strict';var EventEmitter=require(_0x45bc('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x45bc('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x45bc('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x259f47){return function(_0x369d3d,_0xffb033,_0x337e52){MailSubstatusEvents[_0x45bc('0x3')](_0x259f47+':'+_0x369d3d['id'],_0x369d3d);MailSubstatusEvents[_0x45bc('0x3')](_0x259f47,_0x369d3d);_0x337e52(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x45bc('0x4')](e,emitEvent(event));}}module[_0x45bc('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 a29cb2a..35c4d97 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 _0x7d18=['mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','models','define','MailSubstatus','Condition','update','name'];(function(_0x2a7a21,_0x2ba5a5){var _0x21de6e=function(_0x56957b){while(--_0x56957b){_0x2a7a21['push'](_0x2a7a21['shift']());}};_0x21de6e(++_0x2ba5a5);}(_0x7d18,0xa3));var _0x87d1=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0x7d18[_0x54a2e4];return _0x4742d0;};'use strict';var attributes=require(_0x87d1('0x0'));module['exports']=function(_0x4efe9a){var _0x303516=_0x4efe9a[_0x87d1('0x1')];return _0x4efe9a[_0x87d1('0x2')](_0x87d1('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xc60832,_0xb4e125,_0x21948f){return _0x303516[_0x87d1('0x4')][_0x87d1('0x5')]({'value':_0xc60832[_0x87d1('0x6')]},{'where':{'field':_0x87d1('0x7'),'value':_0xc60832[_0x87d1('0x8')][_0x87d1('0x6')]}})[_0x87d1('0x9')](function(){_0x21948f();})['catch'](function(_0x3ccb20){_0x21948f(_0x3ccb20);});}}});}; \ No newline at end of file +var _0x44f1=['define','mail_substatuses','Condition','name','mailSubstatus','_previousDataValues','catch','./mailSubstatus.attributes'];(function(_0x54b988,_0x16efc7){var _0x24647c=function(_0x53672a){while(--_0x53672a){_0x54b988['push'](_0x54b988['shift']());}};_0x24647c(++_0x16efc7);}(_0x44f1,0x157));var _0x144f=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x44f1[_0xc6be3a];return _0x56a310;};'use strict';var attributes=require(_0x144f('0x0'));module['exports']=function(_0x3e972e){var _0x5c4144=_0x3e972e['models'];return _0x3e972e[_0x144f('0x1')]('MailSubstatus',attributes,{'tableName':_0x144f('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4a551a,_0x2d1779,_0x33fcf0){return _0x5c4144[_0x144f('0x3')]['update']({'value':_0x4a551a[_0x144f('0x4')]},{'where':{'field':_0x144f('0x5'),'value':_0x4a551a[_0x144f('0x6')][_0x144f('0x4')]}})['then'](function(){_0x33fcf0();})[_0x144f('0x7')](function(_0x5d4277){_0x33fcf0(_0x5d4277);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index c804a14..f5c9974 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 _0xee49=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x4342f0,_0x3009c8){var _0x5ce9f0=function(_0x576eed){while(--_0x576eed){_0x4342f0['push'](_0x4342f0['shift']());}};_0x5ce9f0(++_0x3009c8);}(_0xee49,0x158));var _0x9ee4=function(_0x3661ca,_0xc9273e){_0x3661ca=_0x3661ca-0x0;var _0xf22108=_0xee49[_0x3661ca];return _0xf22108;};'use strict';var _=require(_0x9ee4('0x0'));var util=require(_0x9ee4('0x1'));var moment=require(_0x9ee4('0x2'));var BPromise=require('bluebird');var rs=require(_0x9ee4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ee4('0x4'))['db'];var utils=require(_0x9ee4('0x5'));var logger=require(_0x9ee4('0x6'))('rpc');var config=require(_0x9ee4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9ee4('0x8')][_0x9ee4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fc98f,_0x2aee2a,_0x18c455){return new BPromise(function(_0x1a711b,_0x4cb117){return client[_0x9ee4('0xa')](_0x4fc98f,_0x18c455)[_0x9ee4('0xb')](function(_0x110f86){logger['info'](_0x9ee4('0xc'),_0x2aee2a,_0x9ee4('0xd'));logger[_0x9ee4('0xe')](_0x9ee4('0xf'),_0x2aee2a,_0x9ee4('0xd'),JSON[_0x9ee4('0x10')](_0x110f86));if(_0x110f86[_0x9ee4('0x11')]){if(_0x110f86[_0x9ee4('0x11')][_0x9ee4('0x12')]===0x1f4){logger[_0x9ee4('0x11')](_0x9ee4('0xc'),_0x2aee2a,_0x110f86[_0x9ee4('0x11')][_0x9ee4('0x13')]);return _0x4cb117(_0x110f86[_0x9ee4('0x11')]['message']);}logger[_0x9ee4('0x11')](_0x9ee4('0xc'),_0x2aee2a,_0x110f86[_0x9ee4('0x11')][_0x9ee4('0x13')]);return _0x1a711b(_0x110f86[_0x9ee4('0x11')][_0x9ee4('0x13')]);}else{logger[_0x9ee4('0x14')](_0x9ee4('0xc'),_0x2aee2a,'request\x20sent');_0x1a711b(_0x110f86[_0x9ee4('0x15')][_0x9ee4('0x13')]);}})[_0x9ee4('0x16')](function(_0x1b6334){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x2aee2a,_0x1b6334);_0x4cb117(_0x1b6334);});});} \ No newline at end of file +var _0x944f=['bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util'];(function(_0x44e60d,_0x496d99){var _0x14e52b=function(_0x4ef291){while(--_0x4ef291){_0x44e60d['push'](_0x44e60d['shift']());}};_0x14e52b(++_0x496d99);}(_0x944f,0x1c0));var _0xf944=function(_0x366195,_0x50da84){_0x366195=_0x366195-0x0;var _0xf37646=_0x944f[_0x366195];return _0xf37646;};'use strict';var _=require(_0xf944('0x0'));var util=require(_0xf944('0x1'));var moment=require('moment');var BPromise=require(_0xf944('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf944('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf944('0x4'))(_0xf944('0x5'));var config=require(_0xf944('0x6'));var jayson=require(_0xf944('0x7'));var client=jayson[_0xf944('0x8')][_0xf944('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x101b40,_0x30c407,_0x38d701){return new BPromise(function(_0x14891c,_0x303b45){return client['request'](_0x101b40,_0x38d701)[_0xf944('0xa')](function(_0x22f21b){logger['info'](_0xf944('0xb'),_0x30c407,_0xf944('0xc'));logger[_0xf944('0xd')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x30c407,'request\x20sent',JSON['stringify'](_0x22f21b));if(_0x22f21b[_0xf944('0xe')]){if(_0x22f21b['error'][_0xf944('0xf')]===0x1f4){logger[_0xf944('0xe')](_0xf944('0xb'),_0x30c407,_0x22f21b[_0xf944('0xe')][_0xf944('0x10')]);return _0x303b45(_0x22f21b[_0xf944('0xe')][_0xf944('0x10')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x30c407,_0x22f21b[_0xf944('0xe')][_0xf944('0x10')]);return _0x14891c(_0x22f21b[_0xf944('0xe')][_0xf944('0x10')]);}else{logger['info'](_0xf944('0xb'),_0x30c407,_0xf944('0xc'));_0x14891c(_0x22f21b[_0xf944('0x11')]['message']);}})['catch'](function(_0x48c947){logger[_0xf944('0xe')](_0xf944('0xb'),_0x30c407,_0x48c947);_0x303b45(_0x48c947);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index ca3a41e..d101ddd 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 _0x32da=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','/describe','isAuthenticated','get','show','post','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x32da,0x1e8));var _0xa32d=function(_0x229a31,_0x5802b7){_0x229a31=_0x229a31-0x0;var _0x42799d=_0x32da[_0x229a31];return _0x42799d;};'use strict';var multer=require(_0xa32d('0x0'));var util=require(_0xa32d('0x1'));var path=require(_0xa32d('0x2'));var timeout=require(_0xa32d('0x3'));var express=require(_0xa32d('0x4'));var router=express[_0xa32d('0x5')]();var fs_extra=require(_0xa32d('0x6'));var auth=require(_0xa32d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa32d('0x8'));var controller=require('./mailTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa32d('0x9')]);router['get'](_0xa32d('0xa'),auth[_0xa32d('0xb')](),controller['describe']);router[_0xa32d('0xc')]('/:id',auth[_0xa32d('0xb')](),controller[_0xa32d('0xd')]);router[_0xa32d('0xe')]('/',auth['isAuthenticated'](),controller[_0xa32d('0xf')]);router['put'](_0xa32d('0x10'),auth['isAuthenticated'](),controller[_0xa32d('0x11')]);router[_0xa32d('0x12')]('/:id',auth[_0xa32d('0xb')](),controller[_0xa32d('0x13')]);module[_0xa32d('0x14')]=router; \ No newline at end of file +var _0x5c17=['multer','util','path','express','../../components/auth/service','./mailTransferReport.controller','get','isAuthenticated','index','post','create','put','update','delete','/:id','destroy'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5c17,0x1b0));var _0x75c1=function(_0x1f02bc,_0x4cdada){_0x1f02bc=_0x1f02bc-0x0;var _0x378387=_0x5c17[_0x1f02bc];return _0x378387;};'use strict';var multer=require(_0x75c1('0x0'));var util=require(_0x75c1('0x1'));var path=require(_0x75c1('0x2'));var timeout=require('connect-timeout');var express=require(_0x75c1('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x75c1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x75c1('0x5'));router[_0x75c1('0x6')]('/',auth[_0x75c1('0x7')](),controller[_0x75c1('0x8')]);router[_0x75c1('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x75c1('0x6')]('/:id',auth[_0x75c1('0x7')](),controller['show']);router[_0x75c1('0x9')]('/',auth[_0x75c1('0x7')](),controller[_0x75c1('0xa')]);router[_0x75c1('0xb')]('/:id',auth[_0x75c1('0x7')](),controller[_0x75c1('0xc')]);router[_0x75c1('0xd')](_0x75c1('0xe'),auth['isAuthenticated'](),controller[_0x75c1('0xf')]);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 f86cc32..03c2ce0 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x2cd889,_0x287917){var _0x37d1d0=function(_0x5e3562){while(--_0x5e3562){_0x2cd889['push'](_0x2cd889['shift']());}};_0x37d1d0(++_0x287917);}(_0xf4eb,0xec));var _0xbf4e=function(_0x48007a,_0xa484d4){_0x48007a=_0x48007a-0x0;var _0x301b72=_0xf4eb[_0x48007a];return _0x301b72;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x471f42,_0x42f139){var _0x74d148=function(_0x4dd2dd){while(--_0x4dd2dd){_0x471f42['push'](_0x471f42['shift']());}};_0x74d148(++_0x42f139);}(_0xf4eb,0xec));var _0xbf4e=function(_0x11a2e0,_0x371810){_0x11a2e0=_0x11a2e0-0x0;var _0x1639f1=_0xf4eb[_0x11a2e0];return _0x1639f1;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index fa2a243..4a0a1bd 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 _0x63ea=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','MailTransferReport','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','key','keys','filters','intersection','attributes','model','fields','query','length'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x63ea,0x13b));var _0xa63e=function(_0x1f16ea,_0x6f65e3){_0x1f16ea=_0x1f16ea-0x0;var _0x19777f=_0x63ea[_0x1f16ea];return _0x19777f;};'use strict';var emlformat=require(_0xa63e('0x0'));var rimraf=require(_0xa63e('0x1'));var zipdir=require(_0xa63e('0x2'));var jsonpatch=require(_0xa63e('0x3'));var rp=require(_0xa63e('0x4'));var moment=require(_0xa63e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa63e('0x6'));var util=require(_0xa63e('0x7'));var path=require('path');var sox=require(_0xa63e('0x8'));var csv=require(_0xa63e('0x9'));var ejs=require(_0xa63e('0xa'));var fs=require('fs');var fs_extra=require(_0xa63e('0xb'));var _=require('lodash');var squel=require(_0xa63e('0xc'));var crypto=require(_0xa63e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa63e('0xe'));var Papa=require(_0xa63e('0xf'));var Redis=require(_0xa63e('0x10'));var authService=require(_0xa63e('0x11'));var qs=require(_0xa63e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa63e('0x13'))('api');var utils=require(_0xa63e('0x14'));var config=require(_0xa63e('0x15'));var licenseUtil=require(_0xa63e('0x16'));var db=require(_0xa63e('0x17'))['db'];function respondWithStatusCode(_0x1e9243,_0x25a907){_0x25a907=_0x25a907||0xcc;return function(_0xf11523){if(_0xf11523){return _0x1e9243['sendStatus'](_0x25a907);}return _0x1e9243[_0xa63e('0x18')](_0x25a907)[_0xa63e('0x19')]();};}function respondWithResult(_0xb6a318,_0x2ba831){_0x2ba831=_0x2ba831||0xc8;return function(_0x39fc00){if(_0x39fc00){return _0xb6a318[_0xa63e('0x18')](_0x2ba831)['json'](_0x39fc00);}};}function respondWithFilteredResult(_0x1bdf32,_0x40275c){return function(_0xb97687){if(_0xb97687){var _0x569e74=typeof _0x40275c[_0xa63e('0x1a')]===_0xa63e('0x1b')&&typeof _0x40275c[_0xa63e('0x1c')]===_0xa63e('0x1b');var _0xfbea3f=_0xb97687[_0xa63e('0x1d')];var _0x39742c=_0x569e74?0x0:_0x40275c[_0xa63e('0x1a')];var _0xb652f8=_0x569e74?_0xb97687[_0xa63e('0x1d')]:_0x40275c[_0xa63e('0x1a')]+_0x40275c[_0xa63e('0x1c')];var _0xb51afa;if(_0xb652f8>=_0xfbea3f){_0xb652f8=_0xfbea3f;_0xb51afa=0xc8;}else{_0xb51afa=0xce;}_0x1bdf32[_0xa63e('0x18')](_0xb51afa);return _0x1bdf32[_0xa63e('0x1e')](_0xa63e('0x1f'),_0x39742c+'-'+_0xb652f8+'/'+_0xfbea3f)[_0xa63e('0x20')](_0xb97687);}return null;};}function patchUpdates(_0x3b69ae){return function(_0x45c72e){try{jsonpatch[_0xa63e('0x21')](_0x45c72e,_0x3b69ae,!![]);}catch(_0x16170e){return BPromise['reject'](_0x16170e);}return _0x45c72e['save']();};}function saveUpdates(_0x5e0740,_0x221d6c){return function(_0x1c8975){if(_0x1c8975){return _0x1c8975[_0xa63e('0x22')](_0x5e0740)[_0xa63e('0x23')](function(_0xb4069e){return _0xb4069e;});}return null;};}function removeEntity(_0xfc61a9,_0xda127f){return function(_0x2f5ff2){if(_0x2f5ff2){return _0x2f5ff2[_0xa63e('0x24')]()['then'](function(){_0xfc61a9[_0xa63e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50a1e8,_0x57f223){return function(_0x661aac){if(!_0x661aac){_0x50a1e8[_0xa63e('0x25')](0x194);}return _0x661aac;};}function handleError(_0x363cf8,_0x4fafc5){_0x4fafc5=_0x4fafc5||0x1f4;return function(_0x146f4d){logger[_0xa63e('0x26')](_0x146f4d[_0xa63e('0x27')]);if(_0x146f4d[_0xa63e('0x28')]){delete _0x146f4d[_0xa63e('0x28')];}_0x363cf8[_0xa63e('0x18')](_0x4fafc5)[_0xa63e('0x29')](_0x146f4d);};}exports[_0xa63e('0x2a')]=function(_0x21d7a2,_0xc50ef7){var _0x562f2f={},_0x14a7c7={},_0x297750={'count':0x0,'rows':[]};var _0x4a6039=_[_0xa63e('0x2b')](db['MailTransferReport']['rawAttributes'],function(_0x2ac359){return{'name':_0x2ac359[_0xa63e('0x2c')],'type':_0x2ac359[_0xa63e('0x2d')][_0xa63e('0x2e')]};});_0x14a7c7['model']=_[_0xa63e('0x2b')](_0x4a6039,_0xa63e('0x28'));_0x14a7c7['query']=_[_0xa63e('0x2f')](_0x21d7a2['query']);_0x14a7c7[_0xa63e('0x30')]=_[_0xa63e('0x31')](_0x14a7c7['model'],_0x14a7c7['query']);_0x562f2f[_0xa63e('0x32')]=_[_0xa63e('0x31')](_0x14a7c7[_0xa63e('0x33')],qs[_0xa63e('0x34')](_0x21d7a2[_0xa63e('0x35')][_0xa63e('0x34')]));_0x562f2f[_0xa63e('0x32')]=_0x562f2f[_0xa63e('0x32')][_0xa63e('0x36')]?_0x562f2f[_0xa63e('0x32')]:_0x14a7c7[_0xa63e('0x33')];if(!_0x21d7a2['query'][_0xa63e('0x37')](_0xa63e('0x38'))){_0x562f2f['limit']=qs[_0xa63e('0x1c')](_0x21d7a2[_0xa63e('0x35')][_0xa63e('0x1c')]);_0x562f2f[_0xa63e('0x1a')]=qs[_0xa63e('0x1a')](_0x21d7a2[_0xa63e('0x35')][_0xa63e('0x1a')]);}_0x562f2f['order']=qs[_0xa63e('0x39')](_0x21d7a2[_0xa63e('0x35')][_0xa63e('0x39')]);_0x562f2f[_0xa63e('0x3a')]=qs['filters'](_[_0xa63e('0x3b')](_0x21d7a2[_0xa63e('0x35')],_0x14a7c7[_0xa63e('0x30')]),_0x4a6039);if(_0x21d7a2['query'][_0xa63e('0x3c')]){_0x562f2f['where']=_[_0xa63e('0x3d')](_0x562f2f['where'],{'$or':_[_0xa63e('0x2b')](_0x4a6039,function(_0x4b1aed){if(_0x4b1aed[_0xa63e('0x2d')]!=='VIRTUAL'){var _0x5ac74={};_0x5ac74[_0x4b1aed[_0xa63e('0x28')]]={'$like':'%'+_0x21d7a2['query'][_0xa63e('0x3c')]+'%'};return _0x5ac74;}})});}_0x562f2f=_[_0xa63e('0x3d')]({},_0x562f2f,_0x21d7a2[_0xa63e('0x3e')]);var _0x1a69f2={'where':_0x562f2f[_0xa63e('0x3a')]};return db['MailTransferReport']['count'](_0x1a69f2)[_0xa63e('0x23')](function(_0x1cac5b){_0x297750[_0xa63e('0x1d')]=_0x1cac5b;if(_0x21d7a2[_0xa63e('0x35')]['includeAll']){_0x562f2f[_0xa63e('0x3f')]=[{'all':!![]}];}return db['MailTransferReport'][_0xa63e('0x40')](_0x562f2f);})[_0xa63e('0x23')](function(_0x4069b5){_0x297750[_0xa63e('0x41')]=_0x4069b5;return _0x297750;})[_0xa63e('0x23')](respondWithFilteredResult(_0xc50ef7,_0x562f2f))[_0xa63e('0x42')](handleError(_0xc50ef7,null));};exports['show']=function(_0x3af5da,_0x29e05e){var _0x29fcbc={'raw':!![],'where':{'id':_0x3af5da[_0xa63e('0x43')]['id']}},_0x5dc0c5={};_0x5dc0c5[_0xa63e('0x33')]=_[_0xa63e('0x2f')](db[_0xa63e('0x44')][_0xa63e('0x45')]);_0x5dc0c5['query']=_[_0xa63e('0x2f')](_0x3af5da[_0xa63e('0x35')]);_0x5dc0c5['filters']=_[_0xa63e('0x31')](_0x5dc0c5['model'],_0x5dc0c5[_0xa63e('0x35')]);_0x29fcbc['attributes']=_[_0xa63e('0x31')](_0x5dc0c5['model'],qs['fields'](_0x3af5da[_0xa63e('0x35')][_0xa63e('0x34')]));_0x29fcbc['attributes']=_0x29fcbc[_0xa63e('0x32')][_0xa63e('0x36')]?_0x29fcbc[_0xa63e('0x32')]:_0x5dc0c5[_0xa63e('0x33')];if(_0x3af5da[_0xa63e('0x35')]['includeAll']){_0x29fcbc[_0xa63e('0x3f')]=[{'all':!![]}];}_0x29fcbc=_['merge']({},_0x29fcbc,_0x3af5da[_0xa63e('0x3e')]);return db['MailTransferReport'][_0xa63e('0x46')](_0x29fcbc)['then'](handleEntityNotFound(_0x29e05e,null))[_0xa63e('0x23')](respondWithResult(_0x29e05e,null))[_0xa63e('0x42')](handleError(_0x29e05e,null));};exports[_0xa63e('0x47')]=function(_0x19c6eb,_0xa57b11){return db[_0xa63e('0x44')][_0xa63e('0x47')](_0x19c6eb[_0xa63e('0x48')],{})[_0xa63e('0x23')](respondWithResult(_0xa57b11,0xc9))[_0xa63e('0x42')](handleError(_0xa57b11,null));};exports[_0xa63e('0x22')]=function(_0x285b00,_0x22bcd7){if(_0x285b00['body']['id']){delete _0x285b00[_0xa63e('0x48')]['id'];}return db[_0xa63e('0x44')][_0xa63e('0x46')]({'where':{'id':_0x285b00['params']['id']}})['then'](handleEntityNotFound(_0x22bcd7,null))['then'](saveUpdates(_0x285b00[_0xa63e('0x48')],null))[_0xa63e('0x23')](respondWithResult(_0x22bcd7,null))[_0xa63e('0x42')](handleError(_0x22bcd7,null));};exports[_0xa63e('0x24')]=function(_0x487208,_0x38af13){return db['MailTransferReport'][_0xa63e('0x46')]({'where':{'id':_0x487208[_0xa63e('0x43')]['id']}})[_0xa63e('0x23')](handleEntityNotFound(_0x38af13,null))[_0xa63e('0x23')](removeEntity(_0x38af13,null))['catch'](handleError(_0x38af13,null));};exports[_0xa63e('0x49')]=function(_0x425707,_0x31b46b){return db['MailTransferReport'][_0xa63e('0x49')]()[_0xa63e('0x23')](respondWithResult(_0x31b46b,null))[_0xa63e('0x42')](handleError(_0x31b46b,null));}; \ No newline at end of file +var _0xbb44=['../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','then','name','send','index','MailTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','map','type','count','includeAll','findAll','rows','catch','params','rawAttributes','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x3889ae,_0x4770c3){var _0x6533dd=function(_0x4275f7){while(--_0x4275f7){_0x3889ae['push'](_0x3889ae['shift']());}};_0x6533dd(++_0x4770c3);}(_0xbb44,0x155));var _0x4bb4=function(_0x40de94,_0x8d5417){_0x40de94=_0x40de94-0x0;var _0x33fb7c=_0xbb44[_0x40de94];return _0x33fb7c;};'use strict';var emlformat=require(_0x4bb4('0x0'));var rimraf=require(_0x4bb4('0x1'));var zipdir=require(_0x4bb4('0x2'));var jsonpatch=require(_0x4bb4('0x3'));var rp=require(_0x4bb4('0x4'));var moment=require('moment');var BPromise=require(_0x4bb4('0x5'));var Mustache=require(_0x4bb4('0x6'));var util=require(_0x4bb4('0x7'));var path=require('path');var sox=require(_0x4bb4('0x8'));var csv=require('to-csv');var ejs=require(_0x4bb4('0x9'));var fs=require('fs');var fs_extra=require(_0x4bb4('0xa'));var _=require(_0x4bb4('0xb'));var squel=require(_0x4bb4('0xc'));var crypto=require('crypto');var jsforce=require(_0x4bb4('0xd'));var deskjs=require(_0x4bb4('0xe'));var toCsv=require(_0x4bb4('0xf'));var querystring=require(_0x4bb4('0x10'));var Papa=require(_0x4bb4('0x11'));var Redis=require(_0x4bb4('0x12'));var authService=require(_0x4bb4('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4bb4('0x14'))('api');var utils=require(_0x4bb4('0x15'));var config=require(_0x4bb4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4bb4('0x17'))['db'];function respondWithStatusCode(_0x11f43e,_0x4f2918){_0x4f2918=_0x4f2918||0xcc;return function(_0x3f5609){if(_0x3f5609){return _0x11f43e[_0x4bb4('0x18')](_0x4f2918);}return _0x11f43e[_0x4bb4('0x19')](_0x4f2918)[_0x4bb4('0x1a')]();};}function respondWithResult(_0x2b4042,_0x24f3a6){_0x24f3a6=_0x24f3a6||0xc8;return function(_0x2439a0){if(_0x2439a0){return _0x2b4042[_0x4bb4('0x19')](_0x24f3a6)[_0x4bb4('0x1b')](_0x2439a0);}};}function respondWithFilteredResult(_0x275d20,_0x284147){return function(_0x1e15a3){if(_0x1e15a3){var _0x5d31fe=typeof _0x284147[_0x4bb4('0x1c')]===_0x4bb4('0x1d')&&typeof _0x284147[_0x4bb4('0x1e')]===_0x4bb4('0x1d');var _0x161c82=_0x1e15a3['count'];var _0x256aa2=_0x5d31fe?0x0:_0x284147[_0x4bb4('0x1c')];var _0x5d0b90=_0x5d31fe?_0x1e15a3['count']:_0x284147[_0x4bb4('0x1c')]+_0x284147[_0x4bb4('0x1e')];var _0x46df44;if(_0x5d0b90>=_0x161c82){_0x5d0b90=_0x161c82;_0x46df44=0xc8;}else{_0x46df44=0xce;}_0x275d20[_0x4bb4('0x19')](_0x46df44);return _0x275d20[_0x4bb4('0x1f')](_0x4bb4('0x20'),_0x256aa2+'-'+_0x5d0b90+'/'+_0x161c82)['json'](_0x1e15a3);}return null;};}function patchUpdates(_0x1a133f){return function(_0x101cc7){try{jsonpatch[_0x4bb4('0x21')](_0x101cc7,_0x1a133f,!![]);}catch(_0x26dbf2){return BPromise['reject'](_0x26dbf2);}return _0x101cc7[_0x4bb4('0x22')]();};}function saveUpdates(_0x2e5b8f,_0x3405dd){return function(_0xe68734){if(_0xe68734){return _0xe68734[_0x4bb4('0x23')](_0x2e5b8f)['then'](function(_0x33986c){return _0x33986c;});}return null;};}function removeEntity(_0x1c649a,_0x573b5a){return function(_0x174589){if(_0x174589){return _0x174589[_0x4bb4('0x24')]()[_0x4bb4('0x25')](function(){_0x1c649a[_0x4bb4('0x19')](0xcc)[_0x4bb4('0x1a')]();});}};}function handleEntityNotFound(_0x1ae042,_0x1bf345){return function(_0x31e8e6){if(!_0x31e8e6){_0x1ae042[_0x4bb4('0x18')](0x194);}return _0x31e8e6;};}function handleError(_0x5c5173,_0x1d3b69){_0x1d3b69=_0x1d3b69||0x1f4;return function(_0x1cb5b9){logger['error'](_0x1cb5b9['stack']);if(_0x1cb5b9[_0x4bb4('0x26')]){delete _0x1cb5b9[_0x4bb4('0x26')];}_0x5c5173['status'](_0x1d3b69)[_0x4bb4('0x27')](_0x1cb5b9);};}exports[_0x4bb4('0x28')]=function(_0x5af595,_0x36a49d){var _0x28ec20={},_0x11184f={},_0x326ff5={'count':0x0,'rows':[]};var _0x2a7de9=_['map'](db[_0x4bb4('0x29')]['rawAttributes'],function(_0x32805d){return{'name':_0x32805d[_0x4bb4('0x2a')],'type':_0x32805d['type'][_0x4bb4('0x2b')]};});_0x11184f[_0x4bb4('0x2c')]=_['map'](_0x2a7de9,_0x4bb4('0x26'));_0x11184f[_0x4bb4('0x2d')]=_[_0x4bb4('0x2e')](_0x5af595[_0x4bb4('0x2d')]);_0x11184f[_0x4bb4('0x2f')]=_[_0x4bb4('0x30')](_0x11184f[_0x4bb4('0x2c')],_0x11184f[_0x4bb4('0x2d')]);_0x28ec20[_0x4bb4('0x31')]=_[_0x4bb4('0x30')](_0x11184f[_0x4bb4('0x2c')],qs['fields'](_0x5af595[_0x4bb4('0x2d')][_0x4bb4('0x32')]));_0x28ec20['attributes']=_0x28ec20['attributes'][_0x4bb4('0x33')]?_0x28ec20[_0x4bb4('0x31')]:_0x11184f[_0x4bb4('0x2c')];if(!_0x5af595[_0x4bb4('0x2d')]['hasOwnProperty']('nolimit')){_0x28ec20[_0x4bb4('0x1e')]=qs[_0x4bb4('0x1e')](_0x5af595[_0x4bb4('0x2d')][_0x4bb4('0x1e')]);_0x28ec20[_0x4bb4('0x1c')]=qs['offset'](_0x5af595[_0x4bb4('0x2d')][_0x4bb4('0x1c')]);}_0x28ec20[_0x4bb4('0x34')]=qs[_0x4bb4('0x35')](_0x5af595['query'][_0x4bb4('0x35')]);_0x28ec20[_0x4bb4('0x36')]=qs[_0x4bb4('0x2f')](_[_0x4bb4('0x37')](_0x5af595[_0x4bb4('0x2d')],_0x11184f[_0x4bb4('0x2f')]),_0x2a7de9);if(_0x5af595[_0x4bb4('0x2d')][_0x4bb4('0x38')]){_0x28ec20['where']=_[_0x4bb4('0x39')](_0x28ec20['where'],{'$or':_[_0x4bb4('0x3a')](_0x2a7de9,function(_0x5dde6a){if(_0x5dde6a[_0x4bb4('0x3b')]!=='VIRTUAL'){var _0x4cf23d={};_0x4cf23d[_0x5dde6a[_0x4bb4('0x26')]]={'$like':'%'+_0x5af595[_0x4bb4('0x2d')][_0x4bb4('0x38')]+'%'};return _0x4cf23d;}})});}_0x28ec20=_[_0x4bb4('0x39')]({},_0x28ec20,_0x5af595['options']);var _0x27911d={'where':_0x28ec20[_0x4bb4('0x36')]};return db['MailTransferReport'][_0x4bb4('0x3c')](_0x27911d)[_0x4bb4('0x25')](function(_0x436e95){_0x326ff5[_0x4bb4('0x3c')]=_0x436e95;if(_0x5af595['query'][_0x4bb4('0x3d')]){_0x28ec20['include']=[{'all':!![]}];}return db['MailTransferReport'][_0x4bb4('0x3e')](_0x28ec20);})[_0x4bb4('0x25')](function(_0x3c5969){_0x326ff5[_0x4bb4('0x3f')]=_0x3c5969;return _0x326ff5;})['then'](respondWithFilteredResult(_0x36a49d,_0x28ec20))[_0x4bb4('0x40')](handleError(_0x36a49d,null));};exports['show']=function(_0xc3f142,_0x513983){var _0x14368a={'raw':!![],'where':{'id':_0xc3f142[_0x4bb4('0x41')]['id']}},_0x54f9eb={};_0x54f9eb[_0x4bb4('0x2c')]=_[_0x4bb4('0x2e')](db['MailTransferReport'][_0x4bb4('0x42')]);_0x54f9eb[_0x4bb4('0x2d')]=_[_0x4bb4('0x2e')](_0xc3f142[_0x4bb4('0x2d')]);_0x54f9eb[_0x4bb4('0x2f')]=_[_0x4bb4('0x30')](_0x54f9eb[_0x4bb4('0x2c')],_0x54f9eb[_0x4bb4('0x2d')]);_0x14368a[_0x4bb4('0x31')]=_[_0x4bb4('0x30')](_0x54f9eb[_0x4bb4('0x2c')],qs['fields'](_0xc3f142['query'][_0x4bb4('0x32')]));_0x14368a[_0x4bb4('0x31')]=_0x14368a[_0x4bb4('0x31')]['length']?_0x14368a[_0x4bb4('0x31')]:_0x54f9eb[_0x4bb4('0x2c')];if(_0xc3f142['query'][_0x4bb4('0x3d')]){_0x14368a[_0x4bb4('0x43')]=[{'all':!![]}];}_0x14368a=_['merge']({},_0x14368a,_0xc3f142[_0x4bb4('0x44')]);return db[_0x4bb4('0x29')][_0x4bb4('0x45')](_0x14368a)[_0x4bb4('0x25')](handleEntityNotFound(_0x513983,null))[_0x4bb4('0x25')](respondWithResult(_0x513983,null))[_0x4bb4('0x40')](handleError(_0x513983,null));};exports[_0x4bb4('0x46')]=function(_0x48add8,_0x413bae){return db[_0x4bb4('0x29')][_0x4bb4('0x46')](_0x48add8['body'],{})[_0x4bb4('0x25')](respondWithResult(_0x413bae,0xc9))[_0x4bb4('0x40')](handleError(_0x413bae,null));};exports[_0x4bb4('0x23')]=function(_0x5181df,_0x422aed){if(_0x5181df['body']['id']){delete _0x5181df[_0x4bb4('0x47')]['id'];}return db[_0x4bb4('0x29')][_0x4bb4('0x45')]({'where':{'id':_0x5181df['params']['id']}})[_0x4bb4('0x25')](handleEntityNotFound(_0x422aed,null))[_0x4bb4('0x25')](saveUpdates(_0x5181df['body'],null))[_0x4bb4('0x25')](respondWithResult(_0x422aed,null))['catch'](handleError(_0x422aed,null));};exports[_0x4bb4('0x24')]=function(_0x373287,_0x11e030){return db['MailTransferReport'][_0x4bb4('0x45')]({'where':{'id':_0x373287[_0x4bb4('0x41')]['id']}})[_0x4bb4('0x25')](handleEntityNotFound(_0x11e030,null))[_0x4bb4('0x25')](removeEntity(_0x11e030,null))['catch'](handleError(_0x11e030,null));};exports['describe']=function(_0x599d00,_0x492b71){return db[_0x4bb4('0x29')]['describe']()[_0x4bb4('0x25')](respondWithResult(_0x492b71,null))[_0x4bb4('0x40')](handleError(_0x492b71,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 957e85d..d8fcc68 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 _0x5395=['lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5395,0x150));var _0x5539=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5395[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x5539('0x0'));var util=require('util');var logger=require(_0x5539('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5539('0x2'));var rp=require(_0x5539('0x3'));var fs=require('fs');var path=require(_0x5539('0x4'));var rimraf=require('rimraf');var config=require(_0x5539('0x5'));var attributes=require(_0x5539('0x6'));module[_0x5539('0x7')]=function(_0x751919,_0x99948d){return _0x751919[_0x5539('0x8')](_0x5539('0x9'),attributes,{'tableName':_0x5539('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5539('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a80=['path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4a80,0xbe));var _0x04a8=function(_0xd4dfdd,_0x1118ff){_0xd4dfdd=_0xd4dfdd-0x0;var _0x37264f=_0x4a80[_0xd4dfdd];return _0x37264f;};'use strict';var _=require(_0x04a8('0x0'));var util=require('util');var logger=require(_0x04a8('0x1'))(_0x04a8('0x2'));var moment=require('moment');var BPromise=require(_0x04a8('0x3'));var rp=require(_0x04a8('0x4'));var fs=require('fs');var path=require(_0x04a8('0x5'));var rimraf=require(_0x04a8('0x6'));var config=require(_0x04a8('0x7'));var attributes=require(_0x04a8('0x8'));module[_0x04a8('0x9')]=function(_0x353b43,_0x709eea){return _0x353b43[_0x04a8('0xa')]('MailTransferReport',attributes,{'tableName':_0x04a8('0xb'),'paranoid':![],'indexes':[{'name':_0x04a8('0xc'),'fields':[_0x04a8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index eba4b90..3a88d96 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 _0x0a45=['info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then'];(function(_0x26d204,_0x2b7a35){var _0x59ffa8=function(_0x323e3a){while(--_0x323e3a){_0x26d204['push'](_0x26d204['shift']());}};_0x59ffa8(++_0x2b7a35);}(_0x0a45,0xb5));var _0x50a4=function(_0x4ab59c,_0x30046e){_0x4ab59c=_0x4ab59c-0x0;var _0x263f08=_0x0a45[_0x4ab59c];return _0x263f08;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50a4('0x0'));var fs=require('fs');var Redis=require(_0x50a4('0x1'));var db=require(_0x50a4('0x2'))['db'];var utils=require(_0x50a4('0x3'));var logger=require('../../config/logger')(_0x50a4('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x50a4('0x5')][_0x50a4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x12a99d,_0x390bce,_0x145f1a){return new BPromise(function(_0x116dc4,_0x31b61e){return client[_0x50a4('0x7')](_0x12a99d,_0x145f1a)[_0x50a4('0x8')](function(_0x59ee0a){logger[_0x50a4('0x9')](_0x50a4('0xa'),_0x390bce,_0x50a4('0xb'));logger[_0x50a4('0xc')](_0x50a4('0xd'),_0x390bce,_0x50a4('0xb'),JSON[_0x50a4('0xe')](_0x59ee0a));if(_0x59ee0a[_0x50a4('0xf')]){if(_0x59ee0a[_0x50a4('0xf')]['code']===0x1f4){logger[_0x50a4('0xf')](_0x50a4('0xa'),_0x390bce,_0x59ee0a[_0x50a4('0xf')][_0x50a4('0x10')]);return _0x31b61e(_0x59ee0a['error'][_0x50a4('0x10')]);}logger[_0x50a4('0xf')](_0x50a4('0xa'),_0x390bce,_0x59ee0a['error'][_0x50a4('0x10')]);return _0x116dc4(_0x59ee0a[_0x50a4('0xf')][_0x50a4('0x10')]);}else{logger[_0x50a4('0x9')](_0x50a4('0xa'),_0x390bce,_0x50a4('0xb'));_0x116dc4(_0x59ee0a[_0x50a4('0x11')][_0x50a4('0x10')]);}})[_0x50a4('0x12')](function(_0x2046a9){logger['error'](_0x50a4('0xa'),_0x390bce,_0x2046a9);_0x31b61e(_0x2046a9);});});} \ No newline at end of file +var _0x18dd=['message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x18dd,0xab));var _0xd18d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x18dd[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xd18d('0x0'));var util=require('util');var moment=require(_0xd18d('0x1'));var BPromise=require(_0xd18d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd18d('0x3'))['db'];var utils=require(_0xd18d('0x4'));var logger=require(_0xd18d('0x5'))(_0xd18d('0x6'));var config=require('../../config/environment');var jayson=require(_0xd18d('0x7'));var client=jayson[_0xd18d('0x8')][_0xd18d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c863b,_0x227f26,_0x4870e8){return new BPromise(function(_0x182e1b,_0x4a533e){return client['request'](_0x4c863b,_0x4870e8)[_0xd18d('0xa')](function(_0x4e3826){logger[_0xd18d('0xb')](_0xd18d('0xc'),_0x227f26,_0xd18d('0xd'));logger[_0xd18d('0xe')](_0xd18d('0xf'),_0x227f26,_0xd18d('0xd'),JSON[_0xd18d('0x10')](_0x4e3826));if(_0x4e3826[_0xd18d('0x11')]){if(_0x4e3826[_0xd18d('0x11')]['code']===0x1f4){logger[_0xd18d('0x11')](_0xd18d('0xc'),_0x227f26,_0x4e3826[_0xd18d('0x11')]['message']);return _0x4a533e(_0x4e3826[_0xd18d('0x11')][_0xd18d('0x12')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x227f26,_0x4e3826['error']['message']);return _0x182e1b(_0x4e3826[_0xd18d('0x11')]['message']);}else{logger[_0xd18d('0xb')](_0xd18d('0xc'),_0x227f26,_0xd18d('0xd'));_0x182e1b(_0x4e3826[_0xd18d('0x13')]['message']);}})[_0xd18d('0x14')](function(_0x5a7975){logger[_0xd18d('0x11')](_0xd18d('0xc'),_0x227f26,_0x5a7975);_0x4a533e(_0x5a7975);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 9561566..e29a5fd 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 _0xf496=['show','post','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0xf496,0xe9));var _0x6f49=function(_0x513fa1,_0xd57322){_0x513fa1=_0x513fa1-0x0;var _0x58174d=_0xf496[_0x513fa1];return _0x58174d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f49('0x0'));var timeout=require(_0x6f49('0x1'));var express=require(_0x6f49('0x2'));var router=express[_0x6f49('0x3')]();var fs_extra=require(_0x6f49('0x4'));var auth=require(_0x6f49('0x5'));var interaction=require(_0x6f49('0x6'));var config=require(_0x6f49('0x7'));var controller=require(_0x6f49('0x8'));router[_0x6f49('0x9')]('/',auth[_0x6f49('0xa')](),controller['index']);router[_0x6f49('0x9')](_0x6f49('0xb'),auth[_0x6f49('0xa')](),controller[_0x6f49('0xc')]);router[_0x6f49('0x9')](_0x6f49('0xd'),auth[_0x6f49('0xa')](),controller[_0x6f49('0xe')]);router[_0x6f49('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6f49('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x6f49('0x10')](_0x6f49('0xd'),auth[_0x6f49('0xa')](),controller[_0x6f49('0x11')]);module[_0x6f49('0x12')]=router; \ No newline at end of file +var _0xaba5=['get','/describe','isAuthenticated','describe','/:id','post','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','index'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xaba5,0x96));var _0x5aba=function(_0x5a9427,_0x380187){_0x5a9427=_0x5a9427-0x0;var _0x23a5e3=_0xaba5[_0x5a9427];return _0x23a5e3;};'use strict';var multer=require('multer');var util=require(_0x5aba('0x0'));var path=require(_0x5aba('0x1'));var timeout=require(_0x5aba('0x2'));var express=require('express');var router=express[_0x5aba('0x3')]();var fs_extra=require(_0x5aba('0x4'));var auth=require(_0x5aba('0x5'));var interaction=require(_0x5aba('0x6'));var config=require(_0x5aba('0x7'));var controller=require(_0x5aba('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5aba('0x9')]);router[_0x5aba('0xa')](_0x5aba('0xb'),auth[_0x5aba('0xc')](),controller[_0x5aba('0xd')]);router[_0x5aba('0xa')](_0x5aba('0xe'),auth[_0x5aba('0xc')](),controller['show']);router[_0x5aba('0xf')]('/',auth[_0x5aba('0xc')](),controller['create']);router[_0x5aba('0x10')](_0x5aba('0xe'),auth[_0x5aba('0xc')](),controller[_0x5aba('0x11')]);router[_0x5aba('0x12')](_0x5aba('0xe'),auth[_0x5aba('0xc')](),controller['destroy']);module[_0x5aba('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 f7ee5d4..d15819e 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 _0xe7e8=['setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0xe7e8,0x1a9));var _0x8e7e=function(_0x27ddf5,_0x5a3e18){_0x27ddf5=_0x27ddf5-0x0;var _0x26e74a=_0xe7e8[_0x27ddf5];return _0x26e74a;};'use strict';var Sequelize=require(_0x8e7e('0x0'));var moment=require(_0x8e7e('0x1'));module[_0x8e7e('0x2')]={'channel':{'type':Sequelize[_0x8e7e('0x3')]},'membername':{'type':Sequelize[_0x8e7e('0x3')]},'interface':{'type':Sequelize[_0x8e7e('0x3')]},'type':{'type':Sequelize[_0x8e7e('0x3')],'defaultValue':_0x8e7e('0x4'),'comment':_0x8e7e('0x5')},'duration':{'type':Sequelize[_0x8e7e('0x6')]},'enterAt':{'type':Sequelize[_0x8e7e('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x8ebba8){var _0x2f5668=moment(_0x8ebba8);var _0xa17322=moment(this[_0x8e7e('0x8')](_0x8e7e('0x9')));var _0x1b89f4=_0x2f5668[_0x8e7e('0xa')](_0xa17322,_0x8e7e('0xb'));this[_0x8e7e('0xc')](_0x8e7e('0xd'),_0x8ebba8);this[_0x8e7e('0xc')](_0x8e7e('0xe'),_0x1b89f4>=0x0?_0x1b89f4:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x8e7e('0xf')},'data2':{'type':Sequelize[_0x8e7e('0x3')],'comment':_0x8e7e('0x10')},'data3':{'type':Sequelize['STRING'],'comment':_0x8e7e('0x11')},'data4':{'type':Sequelize[_0x8e7e('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x8e7e('0x3')],'comment':_0x8e7e('0x12')},'role':{'type':Sequelize[_0x8e7e('0x3')]},'internal':{'type':Sequelize[_0x8e7e('0x6')]},'uniqueid':{'type':Sequelize[_0x8e7e('0x3')]}}; \ No newline at end of file +var _0xe09e=['duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','enterAt','diff','seconds','setDataValue','exitAt'];(function(_0x2e3d63,_0xb43a9b){var _0x105946=function(_0x466785){while(--_0x466785){_0x2e3d63['push'](_0x2e3d63['shift']());}};_0x105946(++_0xb43a9b);}(_0xe09e,0x127));var _0xee09=function(_0x4381e7,_0x40314e){_0x4381e7=_0x4381e7-0x0;var _0x528bb9=_0xe09e[_0x4381e7];return _0x528bb9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xee09('0x0'));module[_0xee09('0x1')]={'channel':{'type':Sequelize[_0xee09('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xee09('0x2')]},'type':{'type':Sequelize[_0xee09('0x2')],'defaultValue':_0xee09('0x3'),'comment':_0xee09('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xee09('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x843065){var _0x36e545=moment(_0x843065);var _0x244a83=moment(this['getDataValue'](_0xee09('0x6')));var _0x262e6e=_0x36e545[_0xee09('0x7')](_0x244a83,_0xee09('0x8'));this[_0xee09('0x9')](_0xee09('0xa'),_0x843065);this[_0xee09('0x9')](_0xee09('0xb'),_0x262e6e>=0x0?_0x262e6e:null);}},'data1':{'type':Sequelize[_0xee09('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0xee09('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0xee09('0xd')},'data4':{'type':Sequelize[_0xee09('0x2')],'comment':_0xee09('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0xee09('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xee09('0x10')]},'uniqueid':{'type':Sequelize[_0xee09('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index e95f136..a05ab49 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 _0x9c44=['catch','params','find','create','body','describe','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','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x198249,_0x5e12bc){var _0x354928=function(_0x15429c){while(--_0x15429c){_0x198249['push'](_0x198249['shift']());}};_0x354928(++_0x5e12bc);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'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={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x9957=['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','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x9171e0,_0x2ee1b3){var _0x2659fb=function(_0x48eacc){while(--_0x48eacc){_0x9171e0['push'](_0x9171e0['shift']());}};_0x2659fb(++_0x2ee1b3);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index ba10263..f7008c1 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 _0xe0bf=['api','moment','bluebird','path','../../config/environment','exports','define','MemberReport','report_member','membername_interface','membername','util'];(function(_0x37842d,_0x197e1){var _0x2a3354=function(_0x7787a){while(--_0x7787a){_0x37842d['push'](_0x37842d['shift']());}};_0x2a3354(++_0x197e1);}(_0xe0bf,0xa7));var _0xfe0b=function(_0xd9e9de,_0x1feb25){_0xd9e9de=_0xd9e9de-0x0;var _0x51646c=_0xe0bf[_0xd9e9de];return _0x51646c;};'use strict';var _=require('lodash');var util=require(_0xfe0b('0x0'));var logger=require('../../config/logger')(_0xfe0b('0x1'));var moment=require(_0xfe0b('0x2'));var BPromise=require(_0xfe0b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe0b('0x4'));var rimraf=require('rimraf');var config=require(_0xfe0b('0x5'));var attributes=require('./memberReport.attributes');module[_0xfe0b('0x6')]=function(_0x180407,_0x1d75ee){return _0x180407[_0xfe0b('0x7')](_0xfe0b('0x8'),attributes,{'tableName':_0xfe0b('0x9'),'paranoid':![],'indexes':[{'name':_0xfe0b('0xa'),'fields':[_0xfe0b('0xb'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0496=['MemberReport','report_member','membername_interface','interface','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','define'];(function(_0x4489aa,_0x1126da){var _0x43b336=function(_0x1c7239){while(--_0x1c7239){_0x4489aa['push'](_0x4489aa['shift']());}};_0x43b336(++_0x1126da);}(_0x0496,0x199));var _0x6049=function(_0x5703c3,_0x15eef9){_0x5703c3=_0x5703c3-0x0;var _0x34c373=_0x0496[_0x5703c3];return _0x34c373;};'use strict';var _=require(_0x6049('0x0'));var util=require('util');var logger=require(_0x6049('0x1'))(_0x6049('0x2'));var moment=require(_0x6049('0x3'));var BPromise=require(_0x6049('0x4'));var rp=require(_0x6049('0x5'));var fs=require('fs');var path=require(_0x6049('0x6'));var rimraf=require('rimraf');var config=require(_0x6049('0x7'));var attributes=require(_0x6049('0x8'));module[_0x6049('0x9')]=function(_0x2cd3cc,_0x279c32){return _0x2cd3cc[_0x6049('0xa')](_0x6049('0xb'),attributes,{'tableName':_0x6049('0xc'),'paranoid':![],'indexes':[{'name':_0x6049('0xd'),'fields':['membername',_0x6049('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index fd5d871..9345559 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 _0x6bfc=['body','raw','CreateMemberReport','catch','UpdateMemberReport','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetMemberReport','findAll','options','attributes','limit','map','include','model','MemberReport','create'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x6bfc,0x159));var _0xc6bf=function(_0x1da0c1,_0x14ff83){_0x1da0c1=_0x1da0c1-0x0;var _0x31302b=_0x6bfc[_0x1da0c1];return _0x31302b;};'use strict';var _=require('lodash');var util=require(_0xc6bf('0x0'));var moment=require(_0xc6bf('0x1'));var BPromise=require(_0xc6bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6bf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6bf('0x4'));var logger=require('../../config/logger')(_0xc6bf('0x5'));var config=require(_0xc6bf('0x6'));var jayson=require(_0xc6bf('0x7'));var client=jayson['client'][_0xc6bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c9049,_0x47039a,_0x28d218){return new BPromise(function(_0x250311,_0x3b2815){return client[_0xc6bf('0x9')](_0x2c9049,_0x28d218)[_0xc6bf('0xa')](function(_0x52dac0){logger[_0xc6bf('0xb')](_0xc6bf('0xc'),_0x47039a,_0xc6bf('0xd'));logger[_0xc6bf('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x47039a,'request\x20sent',JSON[_0xc6bf('0xf')](_0x52dac0));if(_0x52dac0[_0xc6bf('0x10')]){if(_0x52dac0['error']['code']===0x1f4){logger[_0xc6bf('0x10')](_0xc6bf('0xc'),_0x47039a,_0x52dac0['error'][_0xc6bf('0x11')]);return _0x3b2815(_0x52dac0[_0xc6bf('0x10')][_0xc6bf('0x11')]);}logger[_0xc6bf('0x10')](_0xc6bf('0xc'),_0x47039a,_0x52dac0['error']['message']);return _0x250311(_0x52dac0[_0xc6bf('0x10')][_0xc6bf('0x11')]);}else{logger[_0xc6bf('0xb')](_0xc6bf('0xc'),_0x47039a,_0xc6bf('0xd'));_0x250311(_0x52dac0[_0xc6bf('0x12')][_0xc6bf('0x11')]);}})['catch'](function(_0x23498a){logger['error']('MemberReport,\x20%s,\x20%s',_0x47039a,_0x23498a);_0x3b2815(_0x23498a);});});}exports[_0xc6bf('0x13')]=function(_0x23a9e9){var _0x5bdc69=this;return new Promise(function(_0x370150,_0x1079db){return db['MemberReport'][_0xc6bf('0x14')]({'raw':_0x23a9e9['options']?_0x23a9e9['options']['raw']===undefined?!![]:![]:!![],'where':_0x23a9e9[_0xc6bf('0x15')]?_0x23a9e9[_0xc6bf('0x15')]['where']||null:null,'attributes':_0x23a9e9['options']?_0x23a9e9[_0xc6bf('0x15')][_0xc6bf('0x16')]||null:null,'limit':_0x23a9e9['options']?_0x23a9e9[_0xc6bf('0x15')][_0xc6bf('0x17')]||null:null,'include':_0x23a9e9[_0xc6bf('0x15')]?_0x23a9e9[_0xc6bf('0x15')]['include']?_[_0xc6bf('0x18')](_0x23a9e9[_0xc6bf('0x15')][_0xc6bf('0x19')],function(_0x1a0a50){return{'model':db[_0x1a0a50[_0xc6bf('0x1a')]],'as':_0x1a0a50['as'],'attributes':_0x1a0a50[_0xc6bf('0x16')],'include':_0x1a0a50[_0xc6bf('0x19')]?_[_0xc6bf('0x18')](_0x1a0a50['include'],function(_0x312138){return{'model':db[_0x312138[_0xc6bf('0x1a')]],'as':_0x312138['as'],'attributes':_0x312138[_0xc6bf('0x16')],'include':_0x312138['include']?_[_0xc6bf('0x18')](_0x312138[_0xc6bf('0x19')],function(_0x412e61){return{'model':db[_0x412e61[_0xc6bf('0x1a')]],'as':_0x412e61['as'],'attributes':_0x412e61[_0xc6bf('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc6bf('0xa')](function(_0x5abf52){logger['info'](_0xc6bf('0x13'),_0x23a9e9);logger['debug'](_0xc6bf('0x13'),_0x23a9e9,JSON['stringify'](_0x5abf52));_0x370150(_0x5abf52);})['catch'](function(_0x2806e6){logger[_0xc6bf('0x10')](_0xc6bf('0x13'),_0x2806e6[_0xc6bf('0x11')],_0x23a9e9);_0x1079db(_0x5bdc69['error'](0x1f4,_0x2806e6['message']));});});};exports['CreateMemberReport']=function(_0x4f0234){var _0x32407b=this;return new Promise(function(_0xf49ed7,_0x1d46bd){return db[_0xc6bf('0x1b')][_0xc6bf('0x1c')](_0x4f0234[_0xc6bf('0x1d')],{'raw':_0x4f0234[_0xc6bf('0x15')]?_0x4f0234[_0xc6bf('0x15')][_0xc6bf('0x1e')]===undefined?!![]:![]:!![]})[_0xc6bf('0xa')](function(_0x2ec79e){logger[_0xc6bf('0xb')](_0xc6bf('0x1f'),_0x4f0234);logger[_0xc6bf('0xe')](_0xc6bf('0x1f'),_0x4f0234,JSON['stringify'](_0x2ec79e));_0xf49ed7(_0x2ec79e);})[_0xc6bf('0x20')](function(_0x1245d7){logger[_0xc6bf('0x10')](_0xc6bf('0x1f'),_0x1245d7['message'],_0x4f0234);_0x1d46bd(_0x32407b['error'](0x1f4,_0x1245d7[_0xc6bf('0x11')]));});});};exports[_0xc6bf('0x21')]=function(_0x11de46){var _0x3e3d15=this;return new Promise(function(_0x2e8363,_0x5ec7ce){return db[_0xc6bf('0x1b')]['update'](_0x11de46['body'],{'raw':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')][_0xc6bf('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')]['where']||null:null,'attributes':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')]['attributes']||null:null,'limit':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')][_0xc6bf('0x17')]||null:null})['then'](function(_0x5d1dbd){logger['info'](_0xc6bf('0x21'),_0x11de46);logger[_0xc6bf('0xe')](_0xc6bf('0x21'),_0x11de46,JSON['stringify'](_0x5d1dbd));_0x2e8363(_0x5d1dbd);})[_0xc6bf('0x20')](function(_0x559eb3){logger['error'](_0xc6bf('0x21'),_0x559eb3[_0xc6bf('0x11')],_0x11de46);_0x5ec7ce(_0x3e3d15[_0xc6bf('0x10')](0x1f4,_0x559eb3['message']));});});}; \ No newline at end of file +var _0xaee6=['jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','limit','include','map','model','attributes','debug','CreateMemberReport','create','body','UpdateMemberReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaee6,0x187));var _0x6aee=function(_0x5dfa3a,_0x185a37){_0x5dfa3a=_0x5dfa3a-0x0;var _0x5d80b6=_0xaee6[_0x5dfa3a];return _0x5d80b6;};'use strict';var _=require(_0x6aee('0x0'));var util=require(_0x6aee('0x1'));var moment=require(_0x6aee('0x2'));var BPromise=require(_0x6aee('0x3'));var rs=require(_0x6aee('0x4'));var fs=require('fs');var Redis=require(_0x6aee('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6aee('0x6'));var logger=require(_0x6aee('0x7'))(_0x6aee('0x8'));var config=require('../../config/environment');var jayson=require(_0x6aee('0x9'));var client=jayson[_0x6aee('0xa')][_0x6aee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x441367,_0x437b2f,_0x19f528){return new BPromise(function(_0x366743,_0x47db4e){return client['request'](_0x441367,_0x19f528)[_0x6aee('0xc')](function(_0x5ac194){logger[_0x6aee('0xd')](_0x6aee('0xe'),_0x437b2f,_0x6aee('0xf'));logger['debug'](_0x6aee('0x10'),_0x437b2f,_0x6aee('0xf'),JSON[_0x6aee('0x11')](_0x5ac194));if(_0x5ac194[_0x6aee('0x12')]){if(_0x5ac194['error'][_0x6aee('0x13')]===0x1f4){logger['error'](_0x6aee('0xe'),_0x437b2f,_0x5ac194[_0x6aee('0x12')][_0x6aee('0x14')]);return _0x47db4e(_0x5ac194[_0x6aee('0x12')][_0x6aee('0x14')]);}logger['error'](_0x6aee('0xe'),_0x437b2f,_0x5ac194[_0x6aee('0x12')]['message']);return _0x366743(_0x5ac194['error'][_0x6aee('0x14')]);}else{logger[_0x6aee('0xd')](_0x6aee('0xe'),_0x437b2f,_0x6aee('0xf'));_0x366743(_0x5ac194[_0x6aee('0x15')][_0x6aee('0x14')]);}})[_0x6aee('0x16')](function(_0x2d84c0){logger['error'](_0x6aee('0xe'),_0x437b2f,_0x2d84c0);_0x47db4e(_0x2d84c0);});});}exports[_0x6aee('0x17')]=function(_0x511486){var _0x2c6e26=this;return new Promise(function(_0x29f71c,_0x4e041d){return db[_0x6aee('0x18')][_0x6aee('0x19')]({'raw':_0x511486[_0x6aee('0x1a')]?_0x511486[_0x6aee('0x1a')][_0x6aee('0x1b')]===undefined?!![]:![]:!![],'where':_0x511486[_0x6aee('0x1a')]?_0x511486[_0x6aee('0x1a')]['where']||null:null,'attributes':_0x511486[_0x6aee('0x1a')]?_0x511486['options']['attributes']||null:null,'limit':_0x511486[_0x6aee('0x1a')]?_0x511486[_0x6aee('0x1a')][_0x6aee('0x1c')]||null:null,'include':_0x511486[_0x6aee('0x1a')]?_0x511486[_0x6aee('0x1a')][_0x6aee('0x1d')]?_[_0x6aee('0x1e')](_0x511486[_0x6aee('0x1a')]['include'],function(_0xc1b66c){return{'model':db[_0xc1b66c['model']],'as':_0xc1b66c['as'],'attributes':_0xc1b66c['attributes'],'include':_0xc1b66c[_0x6aee('0x1d')]?_[_0x6aee('0x1e')](_0xc1b66c['include'],function(_0x3445b1){return{'model':db[_0x3445b1[_0x6aee('0x1f')]],'as':_0x3445b1['as'],'attributes':_0x3445b1['attributes'],'include':_0x3445b1[_0x6aee('0x1d')]?_[_0x6aee('0x1e')](_0x3445b1[_0x6aee('0x1d')],function(_0x1f1b19){return{'model':db[_0x1f1b19[_0x6aee('0x1f')]],'as':_0x1f1b19['as'],'attributes':_0x1f1b19[_0x6aee('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6aee('0xc')](function(_0x34f448){logger[_0x6aee('0xd')](_0x6aee('0x17'),_0x511486);logger[_0x6aee('0x21')](_0x6aee('0x17'),_0x511486,JSON[_0x6aee('0x11')](_0x34f448));_0x29f71c(_0x34f448);})[_0x6aee('0x16')](function(_0x15e0db){logger[_0x6aee('0x12')]('GetMemberReport',_0x15e0db['message'],_0x511486);_0x4e041d(_0x2c6e26[_0x6aee('0x12')](0x1f4,_0x15e0db[_0x6aee('0x14')]));});});};exports[_0x6aee('0x22')]=function(_0x30428e){var _0x4a2c8f=this;return new Promise(function(_0xb5c94d,_0x58f2d5){return db[_0x6aee('0x18')][_0x6aee('0x23')](_0x30428e[_0x6aee('0x24')],{'raw':_0x30428e[_0x6aee('0x1a')]?_0x30428e[_0x6aee('0x1a')][_0x6aee('0x1b')]===undefined?!![]:![]:!![]})[_0x6aee('0xc')](function(_0x2f1214){logger[_0x6aee('0xd')](_0x6aee('0x22'),_0x30428e);logger[_0x6aee('0x21')](_0x6aee('0x22'),_0x30428e,JSON[_0x6aee('0x11')](_0x2f1214));_0xb5c94d(_0x2f1214);})['catch'](function(_0x348405){logger[_0x6aee('0x12')](_0x6aee('0x22'),_0x348405[_0x6aee('0x14')],_0x30428e);_0x58f2d5(_0x4a2c8f[_0x6aee('0x12')](0x1f4,_0x348405[_0x6aee('0x14')]));});});};exports[_0x6aee('0x25')]=function(_0x1c9f46){var _0x4e43b2=this;return new Promise(function(_0x2eee51,_0x342ff6){return db[_0x6aee('0x18')][_0x6aee('0x26')](_0x1c9f46[_0x6aee('0x24')],{'raw':_0x1c9f46[_0x6aee('0x1a')]?_0x1c9f46[_0x6aee('0x1a')][_0x6aee('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c9f46[_0x6aee('0x1a')]?_0x1c9f46[_0x6aee('0x1a')][_0x6aee('0x27')]||null:null,'attributes':_0x1c9f46['options']?_0x1c9f46['options'][_0x6aee('0x20')]||null:null,'limit':_0x1c9f46['options']?_0x1c9f46['options'][_0x6aee('0x1c')]||null:null})[_0x6aee('0xc')](function(_0x14989e){logger['info'](_0x6aee('0x25'),_0x1c9f46);logger[_0x6aee('0x21')](_0x6aee('0x25'),_0x1c9f46,JSON[_0x6aee('0x11')](_0x14989e));_0x2eee51(_0x14989e);})['catch'](function(_0x1aba43){logger[_0x6aee('0x12')](_0x6aee('0x25'),_0x1aba43[_0x6aee('0x14')],_0x1c9f46);_0x342ff6(_0x4e43b2[_0x6aee('0x12')](0x1f4,_0x1aba43['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index c85d6ea..4da7710 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 _0x872a=['get','index','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x24096e,_0x56e8ec){var _0x391afb=function(_0x15dfd5){while(--_0x15dfd5){_0x24096e['push'](_0x24096e['shift']());}};_0x391afb(++_0x56e8ec);}(_0x872a,0x100));var _0xa872=function(_0x450c7e,_0x59840f){_0x450c7e=_0x450c7e-0x0;var _0x1842cc=_0x872a[_0x450c7e];return _0x1842cc;};'use strict';var multer=require(_0xa872('0x0'));var util=require(_0xa872('0x1'));var path=require(_0xa872('0x2'));var timeout=require(_0xa872('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa872('0x4'));var interaction=require(_0xa872('0x5'));var config=require(_0xa872('0x6'));var controller=require(_0xa872('0x7'));router[_0xa872('0x8')]('/',controller[_0xa872('0x9')]);module[_0xa872('0xa')]=router; \ No newline at end of file +var _0x4d87=['Router','fs-extra','../../config/environment','./migration.controller','get','index','util','path','connect-timeout'];(function(_0x35d8af,_0x14fd75){var _0x1d08b0=function(_0x36b437){while(--_0x36b437){_0x35d8af['push'](_0x35d8af['shift']());}};_0x1d08b0(++_0x14fd75);}(_0x4d87,0xf0));var _0x74d8=function(_0x15e50b,_0x3d941e){_0x15e50b=_0x15e50b-0x0;var _0x35e0b5=_0x4d87[_0x15e50b];return _0x35e0b5;};'use strict';var multer=require('multer');var util=require(_0x74d8('0x0'));var path=require(_0x74d8('0x1'));var timeout=require(_0x74d8('0x2'));var express=require('express');var router=express[_0x74d8('0x3')]();var fs_extra=require(_0x74d8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x74d8('0x5'));var controller=require(_0x74d8('0x6'));router[_0x74d8('0x7')]('/',controller[_0x74d8('0x8')]);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 a8f4df8..50bf99a 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 _0x580a=['STRING'];(function(_0x54c877,_0x17ba52){var _0x281de3=function(_0x57dca1){while(--_0x57dca1){_0x54c877['push'](_0x54c877['shift']());}};_0x281de3(++_0x17ba52);}(_0x580a,0x1b7));var _0xa580=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x580a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0xa580('0x0')],'unique':'version'}}; \ No newline at end of file +var _0x0426=['STRING','sequelize','exports'];(function(_0xd70e1,_0x562bdb){var _0x5c2846=function(_0x96b2e7){while(--_0x96b2e7){_0xd70e1['push'](_0xd70e1['shift']());}};_0x5c2846(++_0x562bdb);}(_0x0426,0x1f0));var _0x6042=function(_0x1896c9,_0x20d965){_0x1896c9=_0x1896c9-0x0;var _0xcc0c88=_0x0426[_0x1896c9];return _0xcc0c88;};'use strict';var Sequelize=require(_0x6042('0x0'));module[_0x6042('0x1')]={'version':{'type':Sequelize[_0x6042('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 717f525..46891fe 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 _0x0d83=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','Migration','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xa121d2,_0x53bf78){var _0x4fd840=function(_0x2a0092){while(--_0x2a0092){_0xa121d2['push'](_0xa121d2['shift']());}};_0x4fd840(++_0x53bf78);}(_0x0d83,0xc2));var _0x30d8=function(_0x5a1de0,_0x15030b){_0x5a1de0=_0x5a1de0-0x0;var _0x5a741a=_0x0d83[_0x5a1de0];return _0x5a741a;};'use strict';var emlformat=require(_0x30d8('0x0'));var rimraf=require(_0x30d8('0x1'));var zipdir=require(_0x30d8('0x2'));var jsonpatch=require(_0x30d8('0x3'));var rp=require(_0x30d8('0x4'));var moment=require('moment');var BPromise=require(_0x30d8('0x5'));var Mustache=require(_0x30d8('0x6'));var util=require(_0x30d8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x30d8('0x8'));var ejs=require(_0x30d8('0x9'));var fs=require('fs');var fs_extra=require(_0x30d8('0xa'));var _=require('lodash');var squel=require(_0x30d8('0xb'));var crypto=require(_0x30d8('0xc'));var jsforce=require(_0x30d8('0xd'));var deskjs=require(_0x30d8('0xe'));var toCsv=require(_0x30d8('0x8'));var querystring=require(_0x30d8('0xf'));var Papa=require(_0x30d8('0x10'));var Redis=require(_0x30d8('0x11'));var authService=require(_0x30d8('0x12'));var qs=require(_0x30d8('0x13'));var as=require(_0x30d8('0x14'));var hardwareService=require(_0x30d8('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x30d8('0x16'));var config=require(_0x30d8('0x17'));var licenseUtil=require(_0x30d8('0x18'));var db=require(_0x30d8('0x19'))['db'];function respondWithStatusCode(_0x4abc0e,_0xc665c){_0xc665c=_0xc665c||0xcc;return function(_0x5612a8){if(_0x5612a8){return _0x4abc0e[_0x30d8('0x1a')](_0xc665c);}return _0x4abc0e[_0x30d8('0x1b')](_0xc665c)[_0x30d8('0x1c')]();};}function respondWithResult(_0x291ce2,_0x393a8c){_0x393a8c=_0x393a8c||0xc8;return function(_0x429628){if(_0x429628){return _0x291ce2[_0x30d8('0x1b')](_0x393a8c)['json'](_0x429628);}};}function respondWithFilteredResult(_0x54627f,_0x56193e){return function(_0x4e6df7){if(_0x4e6df7){var _0x746040=typeof _0x56193e[_0x30d8('0x1d')]==='undefined'&&typeof _0x56193e[_0x30d8('0x1e')]===_0x30d8('0x1f');var _0x43a1cd=_0x4e6df7['count'];var _0x3565cd=_0x746040?0x0:_0x56193e[_0x30d8('0x1d')];var _0x1ed2bf=_0x746040?_0x4e6df7[_0x30d8('0x20')]:_0x56193e[_0x30d8('0x1d')]+_0x56193e['limit'];var _0x43f5f2;if(_0x1ed2bf>=_0x43a1cd){_0x1ed2bf=_0x43a1cd;_0x43f5f2=0xc8;}else{_0x43f5f2=0xce;}_0x54627f[_0x30d8('0x1b')](_0x43f5f2);return _0x54627f[_0x30d8('0x21')](_0x30d8('0x22'),_0x3565cd+'-'+_0x1ed2bf+'/'+_0x43a1cd)[_0x30d8('0x23')](_0x4e6df7);}return null;};}function patchUpdates(_0x483670){return function(_0x283815){try{jsonpatch[_0x30d8('0x24')](_0x283815,_0x483670,!![]);}catch(_0x5a50d3){return BPromise[_0x30d8('0x25')](_0x5a50d3);}return _0x283815[_0x30d8('0x26')]();};}function saveUpdates(_0x51facc,_0x12c52c){return function(_0x300500){if(_0x300500){return _0x300500[_0x30d8('0x27')](_0x51facc)[_0x30d8('0x28')](function(_0x5eb038){return _0x5eb038;});}return null;};}function removeEntity(_0xc8f73f,_0xf113c3){return function(_0x38c324){if(_0x38c324){return _0x38c324['destroy']()[_0x30d8('0x28')](function(){_0xc8f73f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x146382,_0x1edff5){return function(_0x510476){if(!_0x510476){_0x146382[_0x30d8('0x1a')](0x194);}return _0x510476;};}function handleError(_0x208627,_0x1654cb){_0x1654cb=_0x1654cb||0x1f4;return function(_0x5d38a9){logger[_0x30d8('0x29')](_0x5d38a9[_0x30d8('0x2a')]);if(_0x5d38a9[_0x30d8('0x2b')]){delete _0x5d38a9['name'];}_0x208627[_0x30d8('0x1b')](_0x1654cb)[_0x30d8('0x2c')](_0x5d38a9);};}exports[_0x30d8('0x2d')]=function(_0x57048b,_0x101184){var _0x66d46f={},_0x4e0b9f={},_0x16e16f={'count':0x0,'rows':[]};var _0x5c7cfb=_[_0x30d8('0x2e')](db[_0x30d8('0x2f')]['rawAttributes'],function(_0x1c96e){return{'name':_0x1c96e[_0x30d8('0x30')],'type':_0x1c96e['type'][_0x30d8('0x31')]};});_0x4e0b9f[_0x30d8('0x32')]=_[_0x30d8('0x2e')](_0x5c7cfb,_0x30d8('0x2b'));_0x4e0b9f[_0x30d8('0x33')]=_[_0x30d8('0x34')](_0x57048b[_0x30d8('0x33')]);_0x4e0b9f[_0x30d8('0x35')]=_['intersection'](_0x4e0b9f['model'],_0x4e0b9f[_0x30d8('0x33')]);_0x66d46f['attributes']=_[_0x30d8('0x36')](_0x4e0b9f['model'],qs[_0x30d8('0x37')](_0x57048b[_0x30d8('0x33')][_0x30d8('0x37')]));_0x66d46f[_0x30d8('0x38')]=_0x66d46f[_0x30d8('0x38')][_0x30d8('0x39')]?_0x66d46f[_0x30d8('0x38')]:_0x4e0b9f[_0x30d8('0x32')];if(!_0x57048b['query'][_0x30d8('0x3a')](_0x30d8('0x3b'))){_0x66d46f[_0x30d8('0x1e')]=qs['limit'](_0x57048b['query'][_0x30d8('0x1e')]);_0x66d46f[_0x30d8('0x1d')]=qs[_0x30d8('0x1d')](_0x57048b[_0x30d8('0x33')][_0x30d8('0x1d')]);}_0x66d46f[_0x30d8('0x3c')]=qs[_0x30d8('0x3d')](_0x57048b[_0x30d8('0x33')][_0x30d8('0x3d')]);_0x66d46f['where']=qs[_0x30d8('0x35')](_['pick'](_0x57048b[_0x30d8('0x33')],_0x4e0b9f['filters']),_0x5c7cfb);if(_0x57048b['query']['filter']){_0x66d46f[_0x30d8('0x3e')]=_['merge'](_0x66d46f[_0x30d8('0x3e')],{'$or':_[_0x30d8('0x2e')](_0x5c7cfb,function(_0x3073e5){if(_0x3073e5[_0x30d8('0x3f')]!==_0x30d8('0x40')){var _0x49cc90={};_0x49cc90[_0x3073e5[_0x30d8('0x2b')]]={'$like':'%'+_0x57048b[_0x30d8('0x33')][_0x30d8('0x41')]+'%'};return _0x49cc90;}})});}_0x66d46f=_[_0x30d8('0x42')]({},_0x66d46f,_0x57048b[_0x30d8('0x43')]);var _0x1bb21b={'where':_0x66d46f[_0x30d8('0x3e')]};return db[_0x30d8('0x2f')][_0x30d8('0x20')](_0x1bb21b)[_0x30d8('0x28')](function(_0x3d098c){_0x16e16f['count']=_0x3d098c;if(_0x57048b[_0x30d8('0x33')][_0x30d8('0x44')]){_0x66d46f[_0x30d8('0x45')]=[{'all':!![]}];}return db[_0x30d8('0x2f')]['findAll'](_0x66d46f);})[_0x30d8('0x28')](function(_0x48fe0d){_0x16e16f[_0x30d8('0x46')]=_0x48fe0d;return _0x16e16f;})[_0x30d8('0x28')](respondWithFilteredResult(_0x101184,_0x66d46f))['catch'](handleError(_0x101184,null));}; \ No newline at end of file +var _0xd4eb=['set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','Migration','fieldName','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status'];(function(_0x495fa3,_0x22020b){var _0x431996=function(_0x1d6637){while(--_0x1d6637){_0x495fa3['push'](_0x495fa3['shift']());}};_0x431996(++_0x22020b);}(_0xd4eb,0x68));var _0xbd4e=function(_0xce7308,_0x39f06f){_0xce7308=_0xce7308-0x0;var _0x3489b4=_0xd4eb[_0xce7308];return _0x3489b4;};'use strict';var emlformat=require(_0xbd4e('0x0'));var rimraf=require(_0xbd4e('0x1'));var zipdir=require(_0xbd4e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd4e('0x3'));var moment=require(_0xbd4e('0x4'));var BPromise=require(_0xbd4e('0x5'));var Mustache=require(_0xbd4e('0x6'));var util=require(_0xbd4e('0x7'));var path=require(_0xbd4e('0x8'));var sox=require(_0xbd4e('0x9'));var csv=require(_0xbd4e('0xa'));var ejs=require(_0xbd4e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd4e('0xc'));var squel=require(_0xbd4e('0xd'));var crypto=require(_0xbd4e('0xe'));var jsforce=require(_0xbd4e('0xf'));var deskjs=require(_0xbd4e('0x10'));var toCsv=require(_0xbd4e('0xa'));var querystring=require(_0xbd4e('0x11'));var Papa=require(_0xbd4e('0x12'));var Redis=require(_0xbd4e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xbd4e('0x14'));var as=require(_0xbd4e('0x15'));var hardwareService=require(_0xbd4e('0x16'));var logger=require('../../config/logger')(_0xbd4e('0x17'));var utils=require('../../config/utils');var config=require(_0xbd4e('0x18'));var licenseUtil=require(_0xbd4e('0x19'));var db=require(_0xbd4e('0x1a'))['db'];function respondWithStatusCode(_0x550bad,_0x382591){_0x382591=_0x382591||0xcc;return function(_0x4393bf){if(_0x4393bf){return _0x550bad[_0xbd4e('0x1b')](_0x382591);}return _0x550bad['status'](_0x382591)[_0xbd4e('0x1c')]();};}function respondWithResult(_0x34e976,_0x234877){_0x234877=_0x234877||0xc8;return function(_0x18ee00){if(_0x18ee00){return _0x34e976['status'](_0x234877)['json'](_0x18ee00);}};}function respondWithFilteredResult(_0x1d974a,_0x1fe9ab){return function(_0x39f879){if(_0x39f879){var _0x484502=typeof _0x1fe9ab[_0xbd4e('0x1d')]===_0xbd4e('0x1e')&&typeof _0x1fe9ab[_0xbd4e('0x1f')]==='undefined';var _0x2edfd2=_0x39f879[_0xbd4e('0x20')];var _0x542e43=_0x484502?0x0:_0x1fe9ab[_0xbd4e('0x1d')];var _0x3cfc3b=_0x484502?_0x39f879[_0xbd4e('0x20')]:_0x1fe9ab['offset']+_0x1fe9ab[_0xbd4e('0x1f')];var _0x678381;if(_0x3cfc3b>=_0x2edfd2){_0x3cfc3b=_0x2edfd2;_0x678381=0xc8;}else{_0x678381=0xce;}_0x1d974a[_0xbd4e('0x21')](_0x678381);return _0x1d974a[_0xbd4e('0x22')](_0xbd4e('0x23'),_0x542e43+'-'+_0x3cfc3b+'/'+_0x2edfd2)[_0xbd4e('0x24')](_0x39f879);}return null;};}function patchUpdates(_0x48d29e){return function(_0x57f15b){try{jsonpatch[_0xbd4e('0x25')](_0x57f15b,_0x48d29e,!![]);}catch(_0x1fc0d7){return BPromise[_0xbd4e('0x26')](_0x1fc0d7);}return _0x57f15b[_0xbd4e('0x27')]();};}function saveUpdates(_0x39b1dc,_0x347d38){return function(_0x20fe09){if(_0x20fe09){return _0x20fe09[_0xbd4e('0x28')](_0x39b1dc)[_0xbd4e('0x29')](function(_0x2aa26c){return _0x2aa26c;});}return null;};}function removeEntity(_0x4e28da,_0x533c2f){return function(_0x5b0ebd){if(_0x5b0ebd){return _0x5b0ebd[_0xbd4e('0x2a')]()[_0xbd4e('0x29')](function(){_0x4e28da[_0xbd4e('0x21')](0xcc)[_0xbd4e('0x1c')]();});}};}function handleEntityNotFound(_0x23f8b0,_0x1d437c){return function(_0x4de9cf){if(!_0x4de9cf){_0x23f8b0[_0xbd4e('0x1b')](0x194);}return _0x4de9cf;};}function handleError(_0x156814,_0x8fc22a){_0x8fc22a=_0x8fc22a||0x1f4;return function(_0x142bd9){logger[_0xbd4e('0x2b')](_0x142bd9['stack']);if(_0x142bd9['name']){delete _0x142bd9[_0xbd4e('0x2c')];}_0x156814[_0xbd4e('0x21')](_0x8fc22a)[_0xbd4e('0x2d')](_0x142bd9);};}exports['index']=function(_0x547e1b,_0x414047){var _0x4b8a67={},_0x3eca9b={},_0x20b295={'count':0x0,'rows':[]};var _0x1efdc6=_['map'](db[_0xbd4e('0x2e')]['rawAttributes'],function(_0x18d6d3){return{'name':_0x18d6d3[_0xbd4e('0x2f')],'type':_0x18d6d3['type']['key']};});_0x3eca9b[_0xbd4e('0x30')]=_[_0xbd4e('0x31')](_0x1efdc6,_0xbd4e('0x2c'));_0x3eca9b[_0xbd4e('0x32')]=_[_0xbd4e('0x33')](_0x547e1b['query']);_0x3eca9b['filters']=_['intersection'](_0x3eca9b['model'],_0x3eca9b[_0xbd4e('0x32')]);_0x4b8a67[_0xbd4e('0x34')]=_[_0xbd4e('0x35')](_0x3eca9b['model'],qs['fields'](_0x547e1b[_0xbd4e('0x32')][_0xbd4e('0x36')]));_0x4b8a67['attributes']=_0x4b8a67[_0xbd4e('0x34')][_0xbd4e('0x37')]?_0x4b8a67[_0xbd4e('0x34')]:_0x3eca9b['model'];if(!_0x547e1b[_0xbd4e('0x32')][_0xbd4e('0x38')]('nolimit')){_0x4b8a67[_0xbd4e('0x1f')]=qs['limit'](_0x547e1b[_0xbd4e('0x32')][_0xbd4e('0x1f')]);_0x4b8a67[_0xbd4e('0x1d')]=qs[_0xbd4e('0x1d')](_0x547e1b[_0xbd4e('0x32')][_0xbd4e('0x1d')]);}_0x4b8a67[_0xbd4e('0x39')]=qs[_0xbd4e('0x3a')](_0x547e1b[_0xbd4e('0x32')][_0xbd4e('0x3a')]);_0x4b8a67[_0xbd4e('0x3b')]=qs['filters'](_[_0xbd4e('0x3c')](_0x547e1b[_0xbd4e('0x32')],_0x3eca9b['filters']),_0x1efdc6);if(_0x547e1b['query'][_0xbd4e('0x3d')]){_0x4b8a67['where']=_[_0xbd4e('0x3e')](_0x4b8a67[_0xbd4e('0x3b')],{'$or':_[_0xbd4e('0x31')](_0x1efdc6,function(_0x20a764){if(_0x20a764[_0xbd4e('0x3f')]!==_0xbd4e('0x40')){var _0x3eb2c6={};_0x3eb2c6[_0x20a764[_0xbd4e('0x2c')]]={'$like':'%'+_0x547e1b[_0xbd4e('0x32')][_0xbd4e('0x3d')]+'%'};return _0x3eb2c6;}})});}_0x4b8a67=_[_0xbd4e('0x3e')]({},_0x4b8a67,_0x547e1b['options']);var _0x509bf3={'where':_0x4b8a67[_0xbd4e('0x3b')]};return db[_0xbd4e('0x2e')]['count'](_0x509bf3)['then'](function(_0x292ce9){_0x20b295[_0xbd4e('0x20')]=_0x292ce9;if(_0x547e1b[_0xbd4e('0x32')]['includeAll']){_0x4b8a67[_0xbd4e('0x41')]=[{'all':!![]}];}return db['Migration'][_0xbd4e('0x42')](_0x4b8a67);})[_0xbd4e('0x29')](function(_0x3553cc){_0x20b295[_0xbd4e('0x43')]=_0x3553cc;return _0x20b295;})[_0xbd4e('0x29')](respondWithFilteredResult(_0x414047,_0x4b8a67))[_0xbd4e('0x44')](handleError(_0x414047,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 7276397..6d8cf39 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 _0x9cde=['moment','bluebird','path','../../config/environment','migrations','lodash','util','../../config/logger'];(function(_0x47b8af,_0x3867a4){var _0x3a8e63=function(_0x3a90de){while(--_0x3a90de){_0x47b8af['push'](_0x47b8af['shift']());}};_0x3a8e63(++_0x3867a4);}(_0x9cde,0x15d));var _0xe9cd=function(_0x5252a1,_0x32b917){_0x5252a1=_0x5252a1-0x0;var _0x39973f=_0x9cde[_0x5252a1];return _0x39973f;};'use strict';var _=require(_0xe9cd('0x0'));var util=require(_0xe9cd('0x1'));var logger=require(_0xe9cd('0x2'))('api');var moment=require(_0xe9cd('0x3'));var BPromise=require(_0xe9cd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9cd('0x5'));var rimraf=require('rimraf');var config=require(_0xe9cd('0x6'));var attributes=require('./migration.attributes');module['exports']=function(_0x18b78b,_0x4b9c39){return _0x18b78b['define']('Migration',attributes,{'tableName':_0xe9cd('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd8e=['rimraf','../../config/environment','exports','define','Migration','migrations','util','../../config/logger','moment','request-promise','path'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xcd8e,0x150));var _0xecd8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xcd8e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xecd8('0x0'));var logger=require(_0xecd8('0x1'))('api');var moment=require(_0xecd8('0x2'));var BPromise=require('bluebird');var rp=require(_0xecd8('0x3'));var fs=require('fs');var path=require(_0xecd8('0x4'));var rimraf=require(_0xecd8('0x5'));var config=require(_0xecd8('0x6'));var attributes=require('./migration.attributes');module[_0xecd8('0x7')]=function(_0x13c820,_0x4ca024){return _0x13c820[_0xecd8('0x8')](_0xecd8('0x9'),attributes,{'tableName':_0xecd8('0xa'),'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 4d8b81a..e1f4377 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 _0xb458=['info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x273b8e,_0x48961e){var _0x33731e=function(_0x1c096b){while(--_0x1c096b){_0x273b8e['push'](_0x273b8e['shift']());}};_0x33731e(++_0x48961e);}(_0xb458,0xca));var _0x8b45=function(_0x47d804,_0x5cc88f){_0x47d804=_0x47d804-0x0;var _0x284c47=_0xb458[_0x47d804];return _0x284c47;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require(_0x8b45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x4'));var db=require(_0x8b45('0x5'))['db'];var utils=require(_0x8b45('0x6'));var logger=require(_0x8b45('0x7'))(_0x8b45('0x8'));var config=require(_0x8b45('0x9'));var jayson=require(_0x8b45('0xa'));var client=jayson[_0x8b45('0xb')][_0x8b45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x114de0,_0x15dcf4,_0x2f0c9e){return new BPromise(function(_0x1386a4,_0x54f299){return client[_0x8b45('0xd')](_0x114de0,_0x2f0c9e)['then'](function(_0x4a1617){logger[_0x8b45('0xe')](_0x8b45('0xf'),_0x15dcf4,_0x8b45('0x10'));logger['debug'](_0x8b45('0x11'),_0x15dcf4,'request\x20sent',JSON[_0x8b45('0x12')](_0x4a1617));if(_0x4a1617[_0x8b45('0x13')]){if(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x14')]===0x1f4){logger[_0x8b45('0x13')]('Migration,\x20%s,\x20%s',_0x15dcf4,_0x4a1617['error'][_0x8b45('0x15')]);return _0x54f299(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);}logger[_0x8b45('0x13')](_0x8b45('0xf'),_0x15dcf4,_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);return _0x1386a4(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);}else{logger[_0x8b45('0xe')](_0x8b45('0xf'),_0x15dcf4,_0x8b45('0x10'));_0x1386a4(_0x4a1617[_0x8b45('0x16')][_0x8b45('0x15')]);}})[_0x8b45('0x17')](function(_0x59547e){logger['error'](_0x8b45('0xf'),_0x15dcf4,_0x59547e);_0x54f299(_0x59547e);});});} \ No newline at end of file +var _0xbf1a=['../../config/environment','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xbf1a,0x7c));var _0xabf1=function(_0x587fb4,_0x4430a9){_0x587fb4=_0x587fb4-0x0;var _0x383f93=_0xbf1a[_0x587fb4];return _0x383f93;};'use strict';var _=require(_0xabf1('0x0'));var util=require(_0xabf1('0x1'));var moment=require(_0xabf1('0x2'));var BPromise=require(_0xabf1('0x3'));var rs=require(_0xabf1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabf1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xabf1('0x6'))(_0xabf1('0x7'));var config=require(_0xabf1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xabf1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f5b53,_0x3bdf07,_0x1cc1f6){return new BPromise(function(_0x1f48f5,_0x3eb992){return client[_0xabf1('0xa')](_0x4f5b53,_0x1cc1f6)[_0xabf1('0xb')](function(_0x59a7a2){logger[_0xabf1('0xc')](_0xabf1('0xd'),_0x3bdf07,_0xabf1('0xe'));logger[_0xabf1('0xf')](_0xabf1('0x10'),_0x3bdf07,_0xabf1('0xe'),JSON['stringify'](_0x59a7a2));if(_0x59a7a2[_0xabf1('0x11')]){if(_0x59a7a2[_0xabf1('0x11')][_0xabf1('0x12')]===0x1f4){logger[_0xabf1('0x11')](_0xabf1('0xd'),_0x3bdf07,_0x59a7a2[_0xabf1('0x11')][_0xabf1('0x13')]);return _0x3eb992(_0x59a7a2[_0xabf1('0x11')][_0xabf1('0x13')]);}logger[_0xabf1('0x11')]('Migration,\x20%s,\x20%s',_0x3bdf07,_0x59a7a2[_0xabf1('0x11')][_0xabf1('0x13')]);return _0x1f48f5(_0x59a7a2[_0xabf1('0x11')]['message']);}else{logger[_0xabf1('0xc')](_0xabf1('0xd'),_0x3bdf07,_0xabf1('0xe'));_0x1f48f5(_0x59a7a2[_0xabf1('0x14')]['message']);}})[_0xabf1('0x15')](function(_0x4b138d){logger[_0xabf1('0x11')](_0xabf1('0xd'),_0x3bdf07,_0x4b138d);_0x3eb992(_0x4b138d);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index a648191..491ecbf 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 _0x5bd7=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','/:id','show','post','create','delete','exports','util','path'];(function(_0x1a0054,_0x3964a2){var _0x4453e6=function(_0x25293a){while(--_0x25293a){_0x1a0054['push'](_0x1a0054['shift']());}};_0x4453e6(++_0x3964a2);}(_0x5bd7,0x12a));var _0x75bd=function(_0x42e867,_0x3541ec){_0x42e867=_0x42e867-0x0;var _0x26866c=_0x5bd7[_0x42e867];return _0x26866c;};'use strict';var multer=require('multer');var util=require(_0x75bd('0x0'));var path=require(_0x75bd('0x1'));var timeout=require(_0x75bd('0x2'));var express=require('express');var router=express[_0x75bd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x75bd('0x4'));var interaction=require(_0x75bd('0x5'));var config=require('../../config/environment');var controller=require(_0x75bd('0x6'));router[_0x75bd('0x7')]('/',auth[_0x75bd('0x8')](),controller['index']);router[_0x75bd('0x7')](_0x75bd('0x9'),auth[_0x75bd('0x8')](),controller[_0x75bd('0xa')]);router[_0x75bd('0xb')]('/',auth[_0x75bd('0x8')](),controller[_0x75bd('0xc')]);router['put'](_0x75bd('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x75bd('0xd')](_0x75bd('0x9'),auth[_0x75bd('0x8')](),controller['destroy']);module[_0x75bd('0xe')]=router; \ No newline at end of file +var _0xbeba=['/:id','create','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index'];(function(_0x7e51d6,_0x2aaac5){var _0x19dc2f=function(_0x2f8a6f){while(--_0x2f8a6f){_0x7e51d6['push'](_0x7e51d6['shift']());}};_0x19dc2f(++_0x2aaac5);}(_0xbeba,0x64));var _0xabeb=function(_0x5ef32e,_0x21b860){_0x5ef32e=_0x5ef32e-0x0;var _0x3568b7=_0xbeba[_0x5ef32e];return _0x3568b7;};'use strict';var multer=require(_0xabeb('0x0'));var util=require(_0xabeb('0x1'));var path=require('path');var timeout=require(_0xabeb('0x2'));var express=require(_0xabeb('0x3'));var router=express[_0xabeb('0x4')]();var fs_extra=require(_0xabeb('0x5'));var auth=require(_0xabeb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xabeb('0x7'));var controller=require(_0xabeb('0x8'));router[_0xabeb('0x9')]('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xb')]);router[_0xabeb('0x9')](_0xabeb('0xc'),auth[_0xabeb('0xa')](),controller['show']);router['post']('/',auth[_0xabeb('0xa')](),controller[_0xabeb('0xd')]);router['put'](_0xabeb('0xc'),auth[_0xabeb('0xa')](),controller[_0xabeb('0xe')]);router['delete'](_0xabeb('0xc'),auth[_0xabeb('0xa')](),controller['destroy']);module[_0xabeb('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 59e9480..40876d9 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 _0x9905=['stun','turn','STRING','exports','localnet','externip'];(function(_0x479971,_0x6960d1){var _0x187828=function(_0x5fe9a2){while(--_0x5fe9a2){_0x479971['push'](_0x479971['shift']());}};_0x187828(++_0x6960d1);}(_0x9905,0x105));var _0x5990=function(_0x181756,_0x249bd3){_0x181756=_0x181756-0x0;var _0x4b2fa2=_0x9905[_0x181756];return _0x4b2fa2;};'use strict';var Sequelize=require('sequelize');module[_0x5990('0x0')]={'type':{'type':Sequelize['ENUM'](_0x5990('0x1'),_0x5990('0x2'),_0x5990('0x3'),_0x5990('0x4'))},'value':{'type':Sequelize[_0x5990('0x5')]},'username':{'type':Sequelize[_0x5990('0x5')]},'password':{'type':Sequelize[_0x5990('0x5')]}}; \ No newline at end of file +var _0x3258=['exports','ENUM','localnet','externip','stun','turn','STRING'];(function(_0x11e3e7,_0x58d621){var _0x2b9eb1=function(_0x5a2096){while(--_0x5a2096){_0x11e3e7['push'](_0x11e3e7['shift']());}};_0x2b9eb1(++_0x58d621);}(_0x3258,0x17a));var _0x8325=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3258[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x8325('0x0')]={'type':{'type':Sequelize[_0x8325('0x1')](_0x8325('0x2'),_0x8325('0x3'),_0x8325('0x4'),_0x8325('0x5'))},'value':{'type':Sequelize[_0x8325('0x6')]},'username':{'type':Sequelize[_0x8325('0x6')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 70ac140..7401bc4 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 _0x3af6=['message','catch','json','limit','count','offset','status','set','Content-Range','update','destroy','sendStatus','name','map','Network','rawAttributes','type','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','readFileSync','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','root','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','join','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','STUN','server/files/templates/network.ejs','toLowerCase','path','ejs','lodash','../../components/parsers/qs','../../mysqldb','jayson/promise','client','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x47030f,_0x1edb18){var _0x3afd92=function(_0x389a4b){while(--_0x389a4b){_0x47030f['push'](_0x47030f['shift']());}};_0x3afd92(++_0x1edb18);}(_0x3af6,0x1cb));var _0x63af=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x3af6[_0x138adb];return _0x1b27f2;};'use strict';var util=require('util');var path=require(_0x63af('0x0'));var ejs=require(_0x63af('0x1'));var fs=require('fs');var _=require(_0x63af('0x2'));var qs=require(_0x63af('0x3'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x63af('0x4'))['db'];var jayson=require(_0x63af('0x5'));var client=jayson[_0x63af('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x104a6c,_0x27e3fc,_0x4fd783,_0x5bf16){return new Promise(function(_0x47afa9,_0x46d8a6){var _0x15bffc=_0x5bf16||client;return _0x15bffc[_0x63af('0x7')](_0x104a6c,_0x4fd783)[_0x63af('0x8')](function(_0x1c955b){logger['info'](_0x63af('0x9'),_0x27e3fc,_0x63af('0xa'));logger[_0x63af('0xb')](_0x63af('0xc'),_0x27e3fc,_0x63af('0xa'),JSON['stringify'](_0x1c955b));if(_0x1c955b['error']){if(_0x1c955b['error'][_0x63af('0xd')]===0x1f4){logger['error'](_0x63af('0x9'),_0x27e3fc,_0x1c955b[_0x63af('0xe')][_0x63af('0xf')]);return _0x46d8a6(_0x1c955b[_0x63af('0xe')][_0x63af('0xf')]);}logger[_0x63af('0xe')](_0x63af('0x9'),_0x27e3fc,_0x1c955b[_0x63af('0xe')][_0x63af('0xf')]);return _0x47afa9(_0x1c955b[_0x63af('0xe')][_0x63af('0xf')]);}else{logger['info'](_0x63af('0x9'),_0x27e3fc,_0x63af('0xa'));_0x47afa9(_0x1c955b['result']['message']);}})[_0x63af('0x10')](function(_0x3786ba){logger['error'](_0x63af('0x9'),_0x27e3fc,_0x3786ba);_0x46d8a6(_0x3786ba);});});}function respondWithResult(_0x3403e8,_0x15aa54){_0x15aa54=_0x15aa54||0xc8;return function(_0x28a0a5){if(_0x28a0a5){return _0x3403e8['status'](_0x15aa54)[_0x63af('0x11')](_0x28a0a5);}};}function respondWithFilteredResult(_0x405e4e,_0x5ccf2a){return function(_0x3b00fe){if(_0x3b00fe){var _0x2ac1b7=typeof _0x5ccf2a['offset']==='undefined'&&typeof _0x5ccf2a[_0x63af('0x12')]==='undefined';var _0x1e27ca=_0x3b00fe[_0x63af('0x13')];var _0x2a14c3=_0x2ac1b7?0x0:_0x5ccf2a[_0x63af('0x14')];var _0x54945a=_0x2ac1b7?_0x3b00fe['count']:_0x5ccf2a['offset']+_0x5ccf2a[_0x63af('0x12')];var _0x59c361;if(_0x54945a>=_0x1e27ca){_0x54945a=_0x1e27ca;_0x59c361=0xc8;}else{_0x59c361=0xce;}_0x405e4e[_0x63af('0x15')](_0x59c361);return _0x405e4e[_0x63af('0x16')](_0x63af('0x17'),_0x2a14c3+'-'+_0x54945a+'/'+_0x1e27ca)[_0x63af('0x11')](_0x3b00fe);}return null;};}function saveUpdates(_0x2567df){return function(_0x2628c0){if(_0x2628c0){return _0x2628c0[_0x63af('0x18')](_0x2567df)[_0x63af('0x8')](function(_0x461ea6){return _0x461ea6;});}return null;};}function removeEntity(_0x493058){return function(_0x45f8fd){if(_0x45f8fd){return _0x45f8fd[_0x63af('0x19')]()[_0x63af('0x8')](function(){_0x493058[_0x63af('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b9efa){return function(_0x226def){if(!_0x226def){_0x4b9efa[_0x63af('0x1a')](0x194);}return _0x226def;};}function handleError(_0x257468,_0x56cfa2){_0x56cfa2=_0x56cfa2||0x1f4;return function(_0x5cf327){logger[_0x63af('0xe')](_0x5cf327['stack']);if(_0x5cf327['name']){delete _0x5cf327[_0x63af('0x1b')];}_0x257468['status'](_0x56cfa2)['send'](_0x5cf327);};}exports['index']=function(_0x211178,_0x211180){var _0x2efe53={},_0xefdf2e={},_0x428ba3={'count':0x0,'rows':[]};var _0x378597=_[_0x63af('0x1c')](db[_0x63af('0x1d')][_0x63af('0x1e')],function(_0x3c4677){return{'name':_0x3c4677['fieldName'],'type':_0x3c4677[_0x63af('0x1f')]['key']};});_0xefdf2e['model']=_['map'](_0x378597,_0x63af('0x1b'));_0xefdf2e[_0x63af('0x20')]=_['keys'](_0x211178['query']);_0xefdf2e['filters']=_[_0x63af('0x21')](_0xefdf2e['model'],_0xefdf2e['query']);_0x2efe53[_0x63af('0x22')]=_[_0x63af('0x21')](_0xefdf2e[_0x63af('0x23')],qs[_0x63af('0x24')](_0x211178['query'][_0x63af('0x24')]));_0x2efe53['attributes']=_0x2efe53[_0x63af('0x22')][_0x63af('0x25')]?_0x2efe53['attributes']:_0xefdf2e[_0x63af('0x23')];if(!_0x211178[_0x63af('0x20')][_0x63af('0x26')](_0x63af('0x27'))){_0x2efe53['limit']=qs[_0x63af('0x12')](_0x211178[_0x63af('0x20')][_0x63af('0x12')]);_0x2efe53[_0x63af('0x14')]=qs['offset'](_0x211178[_0x63af('0x20')][_0x63af('0x14')]);}_0x2efe53[_0x63af('0x28')]=qs[_0x63af('0x29')](_0x211178['query'][_0x63af('0x29')]);_0x2efe53[_0x63af('0x2a')]=qs['filters'](_[_0x63af('0x2b')](_0x211178[_0x63af('0x20')],_0xefdf2e[_0x63af('0x2c')]),_0x378597);if(_0x211178[_0x63af('0x20')][_0x63af('0x2d')]){_0x2efe53['where']=_['merge'](_0x2efe53['where'],{'$or':_[_0x63af('0x1c')](_0x378597,function(_0x4c3958){if(_0x4c3958[_0x63af('0x1f')]!==_0x63af('0x2e')){var _0x1063c1={};_0x1063c1[_0x4c3958[_0x63af('0x1b')]]={'$like':'%'+_0x211178[_0x63af('0x20')]['filter']+'%'};return _0x1063c1;}})});}_0x2efe53=_[_0x63af('0x2f')]({},_0x2efe53,_0x211178[_0x63af('0x30')]);var _0x5cf493={'where':_0x2efe53['where']};return db['Network'][_0x63af('0x13')](_0x5cf493)['then'](function(_0x29e1ef){_0x428ba3[_0x63af('0x13')]=_0x29e1ef;if(_0x211178[_0x63af('0x20')][_0x63af('0x31')]){_0x2efe53[_0x63af('0x32')]=[{'all':!![]}];}return db[_0x63af('0x1d')][_0x63af('0x33')](_0x2efe53);})[_0x63af('0x8')](function(_0x53da78){_0x428ba3[_0x63af('0x34')]=_0x53da78;return _0x428ba3;})[_0x63af('0x8')](respondWithFilteredResult(_0x211180,_0x2efe53))[_0x63af('0x10')](handleError(_0x211180,null));};exports[_0x63af('0x35')]=function(_0x19fe87,_0x2c4123){var _0x9bb6f0={'raw':!![],'where':{'id':_0x19fe87[_0x63af('0x36')]['id']}},_0x54d490={};_0x54d490[_0x63af('0x23')]=_[_0x63af('0x37')](db[_0x63af('0x1d')][_0x63af('0x1e')]);_0x54d490['query']=_[_0x63af('0x37')](_0x19fe87[_0x63af('0x20')]);_0x54d490['filters']=_[_0x63af('0x21')](_0x54d490['model'],_0x54d490[_0x63af('0x20')]);_0x9bb6f0[_0x63af('0x22')]=_['intersection'](_0x54d490['model'],qs[_0x63af('0x24')](_0x19fe87[_0x63af('0x20')][_0x63af('0x24')]));_0x9bb6f0[_0x63af('0x22')]=_0x9bb6f0[_0x63af('0x22')][_0x63af('0x25')]?_0x9bb6f0[_0x63af('0x22')]:_0x54d490[_0x63af('0x23')];if(_0x19fe87[_0x63af('0x20')]['includeAll']){_0x9bb6f0[_0x63af('0x32')]=[{'all':!![]}];}_0x9bb6f0=_[_0x63af('0x2f')]({},_0x9bb6f0,_0x19fe87[_0x63af('0x30')]);return db[_0x63af('0x1d')][_0x63af('0x38')](_0x9bb6f0)[_0x63af('0x8')](handleEntityNotFound(_0x2c4123,null))['then'](respondWithResult(_0x2c4123,null))['catch'](handleError(_0x2c4123,null));};exports[_0x63af('0x39')]=function(_0x10dd5c,_0x275763){var _0x6ac3e6;return db['Network'][_0x63af('0x39')](_0x10dd5c[_0x63af('0x3a')],{'raw':!![]})[_0x63af('0x8')](function(_0x224cff){_0x6ac3e6=_0x224cff;return db['Network'][_0x63af('0x33')]({'where':{'type':_0x10dd5c[_0x63af('0x3a')]['type']},'raw':!![]});})[_0x63af('0x8')](function(_0x51dc14){if(_0x6ac3e6[_0x63af('0x1f')]['toUpperCase']()=='STUN'){var _0xb13bf4=fs[_0x63af('0x3b')](path['join'](config['root'],_0x63af('0x3c')),'utf8');var _0x1167ec=ejs[_0x63af('0x3d')](_0xb13bf4,{'networks':_0x51dc14||[]});fs[_0x63af('0x3e')](_0x63af('0x3f'),_0x1167ec);return respondWithRpcPromise(_0x63af('0x40'),_0x63af('0x39'),{'module':_0x63af('0x41')});}else if(_0x6ac3e6['type'][_0x63af('0x42')]()==_0x63af('0x43')){var _0x43f4e2=fs[_0x63af('0x3b')](path['join'](config[_0x63af('0x44')],_0x63af('0x45')),_0x63af('0x46'));var _0x2c9570=ejs[_0x63af('0x3d')](_0x43f4e2,{'networks':_0x51dc14||[]});fs[_0x63af('0x3e')](_0x63af('0x47'),_0x2c9570);return respondWithRpcPromise(_0x63af('0x40'),'create',{'module':_0x63af('0x41')});}else{var _0x182d41=fs[_0x63af('0x3b')](path[_0x63af('0x48')](config[_0x63af('0x44')],'server/files/templates/network.ejs'),_0x63af('0x46'));var _0x5d8057=ejs[_0x63af('0x3d')](_0x182d41,{'networks':_0x51dc14||[]});fs[_0x63af('0x3e')](util[_0x63af('0x49')](_0x63af('0x4a'),_0x10dd5c[_0x63af('0x3a')][_0x63af('0x1f')]['toLowerCase']()),_0x5d8057);return respondWithRpcPromise('Reload',_0x63af('0x39'),{'module':_0x63af('0x4b')});}})[_0x63af('0x8')](function(){return _0x6ac3e6;})[_0x63af('0x8')](respondWithResult(_0x275763,0xc9))[_0x63af('0x10')](handleError(_0x275763,null));};exports[_0x63af('0x18')]=function(_0x41db4e,_0x513ac9){var _0x3abab2;return db['Network'][_0x63af('0x38')]({'where':{'id':_0x41db4e[_0x63af('0x36')]['id']}})[_0x63af('0x8')](handleEntityNotFound(_0x513ac9,null))[_0x63af('0x8')](saveUpdates(_0x41db4e[_0x63af('0x3a')],null))[_0x63af('0x8')](function(_0x135370){if(_0x135370){_0x3abab2=_0x135370;return db[_0x63af('0x1d')]['findAll']({'where':{'type':_0x3abab2[_0x63af('0x1f')]},'raw':!![]});}return null;})['then'](function(_0xa2993b){if(_0x3abab2['type'][_0x63af('0x42')]()==_0x63af('0x4c')){var _0x32c75a=fs[_0x63af('0x3b')](path[_0x63af('0x48')](config[_0x63af('0x44')],_0x63af('0x3c')),_0x63af('0x46'));var _0x3583eb=ejs['render'](_0x32c75a,{'networks':_0xa2993b||[]});fs[_0x63af('0x3e')](_0x63af('0x3f'),_0x3583eb);return respondWithRpcPromise(_0x63af('0x40'),_0x63af('0x18'),{'module':'res_stun_monitor.so'});}else if(_0x3abab2[_0x63af('0x1f')][_0x63af('0x42')]()=='TURN'){var _0x30a45d=fs[_0x63af('0x3b')](path['join'](config['root'],_0x63af('0x45')),'utf8');var _0x1a367e=ejs[_0x63af('0x3d')](_0x30a45d,{'networks':_0xa2993b||[]});fs[_0x63af('0x3e')](_0x63af('0x47'),_0x1a367e);return respondWithRpcPromise('Reload',_0x63af('0x18'),{'module':_0x63af('0x41')});}else{var _0x31ebdd=fs[_0x63af('0x3b')](path[_0x63af('0x48')](config[_0x63af('0x44')],_0x63af('0x4d')),'utf8');var _0x27ce4c=ejs['render'](_0x31ebdd,{'networks':_0xa2993b||[]});fs[_0x63af('0x3e')](util[_0x63af('0x49')](_0x63af('0x4a'),_0x41db4e[_0x63af('0x3a')][_0x63af('0x1f')][_0x63af('0x4e')]()),_0x27ce4c);return respondWithRpcPromise(_0x63af('0x40'),_0x63af('0x18'),{'module':_0x63af('0x4b')});}})['then'](function(_0x3fc006){if(_0x3fc006){return _0x3abab2;}return null;})[_0x63af('0x8')](respondWithResult(_0x513ac9,null))[_0x63af('0x10')](handleError(_0x513ac9,null));};exports[_0x63af('0x19')]=function(_0x11af95,_0x3e8eba){var _0x52e069;return db[_0x63af('0x1d')][_0x63af('0x38')]({'where':{'id':_0x11af95[_0x63af('0x36')]['id']}})[_0x63af('0x8')](function(_0x40c850){_0x52e069=_0x40c850;return _0x40c850;})[_0x63af('0x8')](handleEntityNotFound(_0x3e8eba,null))[_0x63af('0x8')](removeEntity(_0x3e8eba,null))['then'](function(){if(_0x52e069){return db[_0x63af('0x1d')][_0x63af('0x33')]({'where':{'type':_0x52e069[_0x63af('0x1f')]},'raw':!![]});}})[_0x63af('0x8')](function(_0x2178f4){if(_0x52e069[_0x63af('0x1f')][_0x63af('0x42')]()==_0x63af('0x4c')){var _0x42f819=fs[_0x63af('0x3b')](path['join'](config[_0x63af('0x44')],_0x63af('0x3c')),_0x63af('0x46'));var _0x22f944=ejs[_0x63af('0x3d')](_0x42f819,{'networks':_0x2178f4||[]});fs['writeFileSync'](_0x63af('0x3f'),_0x22f944);return respondWithRpcPromise(_0x63af('0x40'),_0x63af('0x19'),{'module':_0x63af('0x41')});}else if(_0x52e069[_0x63af('0x1f')][_0x63af('0x42')]()==_0x63af('0x43')){var _0xff1ff0=fs[_0x63af('0x3b')](path[_0x63af('0x48')](config[_0x63af('0x44')],_0x63af('0x45')),_0x63af('0x46'));var _0x34e710=ejs['render'](_0xff1ff0,{'networks':_0x2178f4||[]});fs[_0x63af('0x3e')](_0x63af('0x47'),_0x34e710);return respondWithRpcPromise(_0x63af('0x40'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x484780=fs[_0x63af('0x3b')](path[_0x63af('0x48')](config[_0x63af('0x44')],_0x63af('0x4d')),_0x63af('0x46'));var _0x5d5d79=ejs[_0x63af('0x3d')](_0x484780,{'networks':_0x2178f4||[]});fs[_0x63af('0x3e')](util[_0x63af('0x49')](_0x63af('0x4a'),_0x52e069[_0x63af('0x1f')]['toLowerCase']()),_0x5d5d79);return respondWithRpcPromise(_0x63af('0x40'),_0x63af('0x19'),{'module':_0x63af('0x4b')});}})[_0x63af('0x10')](handleError(_0x3e8eba,null));}; \ No newline at end of file +var _0x35af=['attributes','intersection','fields','query','nolimit','sort','where','filter','VIRTUAL','Network','count','include','findAll','rows','show','params','length','includeAll','merge','options','create','body','toUpperCase','STUN','readFileSync','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','join','root','server/files/templates/turn_multiple.ejs','writeFileSync','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','/etc/asterisk/turn_xcally.conf','TURN','util','path','ejs','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','jayson/promise','http','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','code','Network,\x20%s,\x20%s','error','message','result','catch','status','json','offset','undefined','limit','set','Content-Range','update','destroy','sendStatus','name','map','rawAttributes','type','key','keys','filters','model'];(function(_0x2a005b,_0x2bfc21){var _0x4ea86a=function(_0x287563){while(--_0x287563){_0x2a005b['push'](_0x2a005b['shift']());}};_0x4ea86a(++_0x2bfc21);}(_0x35af,0x1c5));var _0xf35a=function(_0x42dda0,_0x331f0b){_0x42dda0=_0x42dda0-0x0;var _0x527f82=_0x35af[_0x42dda0];return _0x527f82;};'use strict';var util=require(_0xf35a('0x0'));var path=require(_0xf35a('0x1'));var ejs=require(_0xf35a('0x2'));var fs=require('fs');var _=require(_0xf35a('0x3'));var qs=require(_0xf35a('0x4'));var logger=require('../../config/logger')(_0xf35a('0x5'));var config=require(_0xf35a('0x6'));var db=require(_0xf35a('0x7'))['db'];var jayson=require(_0xf35a('0x8'));var client=jayson['client'][_0xf35a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x333fa7,_0x2f7343,_0x3f3a3c,_0x597119){return new Promise(function(_0x404055,_0x3a5dcb){var _0x414f60=_0x597119||client;return _0x414f60['request'](_0x333fa7,_0x3f3a3c)[_0xf35a('0xa')](function(_0x343e64){logger[_0xf35a('0xb')]('Network,\x20%s,\x20%s',_0x2f7343,_0xf35a('0xc'));logger['debug'](_0xf35a('0xd'),_0x2f7343,_0xf35a('0xc'),JSON[_0xf35a('0xe')](_0x343e64));if(_0x343e64['error']){if(_0x343e64['error'][_0xf35a('0xf')]===0x1f4){logger['error'](_0xf35a('0x10'),_0x2f7343,_0x343e64[_0xf35a('0x11')][_0xf35a('0x12')]);return _0x3a5dcb(_0x343e64[_0xf35a('0x11')]['message']);}logger[_0xf35a('0x11')](_0xf35a('0x10'),_0x2f7343,_0x343e64['error'][_0xf35a('0x12')]);return _0x404055(_0x343e64[_0xf35a('0x11')][_0xf35a('0x12')]);}else{logger[_0xf35a('0xb')](_0xf35a('0x10'),_0x2f7343,_0xf35a('0xc'));_0x404055(_0x343e64[_0xf35a('0x13')]['message']);}})[_0xf35a('0x14')](function(_0x49dc4e){logger[_0xf35a('0x11')](_0xf35a('0x10'),_0x2f7343,_0x49dc4e);_0x3a5dcb(_0x49dc4e);});});}function respondWithResult(_0x3268d2,_0x45c643){_0x45c643=_0x45c643||0xc8;return function(_0x4c4b27){if(_0x4c4b27){return _0x3268d2[_0xf35a('0x15')](_0x45c643)[_0xf35a('0x16')](_0x4c4b27);}};}function respondWithFilteredResult(_0x4116c6,_0x57f68c){return function(_0xd1d7f){if(_0xd1d7f){var _0x3f18bd=typeof _0x57f68c[_0xf35a('0x17')]===_0xf35a('0x18')&&typeof _0x57f68c['limit']===_0xf35a('0x18');var _0x2c3775=_0xd1d7f['count'];var _0xdf55ca=_0x3f18bd?0x0:_0x57f68c[_0xf35a('0x17')];var _0x1f8a86=_0x3f18bd?_0xd1d7f['count']:_0x57f68c[_0xf35a('0x17')]+_0x57f68c[_0xf35a('0x19')];var _0x1a95c0;if(_0x1f8a86>=_0x2c3775){_0x1f8a86=_0x2c3775;_0x1a95c0=0xc8;}else{_0x1a95c0=0xce;}_0x4116c6[_0xf35a('0x15')](_0x1a95c0);return _0x4116c6[_0xf35a('0x1a')](_0xf35a('0x1b'),_0xdf55ca+'-'+_0x1f8a86+'/'+_0x2c3775)[_0xf35a('0x16')](_0xd1d7f);}return null;};}function saveUpdates(_0xc96a01){return function(_0x547bdd){if(_0x547bdd){return _0x547bdd[_0xf35a('0x1c')](_0xc96a01)[_0xf35a('0xa')](function(_0x418c43){return _0x418c43;});}return null;};}function removeEntity(_0x1598dd){return function(_0x3e528b){if(_0x3e528b){return _0x3e528b[_0xf35a('0x1d')]()[_0xf35a('0xa')](function(){_0x1598dd[_0xf35a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43703b){return function(_0x23c03e){if(!_0x23c03e){_0x43703b[_0xf35a('0x1e')](0x194);}return _0x23c03e;};}function handleError(_0x59bfa7,_0x360d96){_0x360d96=_0x360d96||0x1f4;return function(_0xca40c2){logger[_0xf35a('0x11')](_0xca40c2['stack']);if(_0xca40c2[_0xf35a('0x1f')]){delete _0xca40c2[_0xf35a('0x1f')];}_0x59bfa7[_0xf35a('0x15')](_0x360d96)['send'](_0xca40c2);};}exports['index']=function(_0xd551a1,_0x13361d){var _0x1e1c64={},_0x1bad86={},_0xe6567a={'count':0x0,'rows':[]};var _0x299cb8=_[_0xf35a('0x20')](db['Network'][_0xf35a('0x21')],function(_0x199b85){return{'name':_0x199b85['fieldName'],'type':_0x199b85[_0xf35a('0x22')][_0xf35a('0x23')]};});_0x1bad86['model']=_[_0xf35a('0x20')](_0x299cb8,_0xf35a('0x1f'));_0x1bad86['query']=_[_0xf35a('0x24')](_0xd551a1['query']);_0x1bad86[_0xf35a('0x25')]=_['intersection'](_0x1bad86[_0xf35a('0x26')],_0x1bad86['query']);_0x1e1c64[_0xf35a('0x27')]=_[_0xf35a('0x28')](_0x1bad86[_0xf35a('0x26')],qs[_0xf35a('0x29')](_0xd551a1[_0xf35a('0x2a')][_0xf35a('0x29')]));_0x1e1c64[_0xf35a('0x27')]=_0x1e1c64['attributes']['length']?_0x1e1c64['attributes']:_0x1bad86[_0xf35a('0x26')];if(!_0xd551a1[_0xf35a('0x2a')]['hasOwnProperty'](_0xf35a('0x2b'))){_0x1e1c64[_0xf35a('0x19')]=qs[_0xf35a('0x19')](_0xd551a1[_0xf35a('0x2a')]['limit']);_0x1e1c64[_0xf35a('0x17')]=qs['offset'](_0xd551a1[_0xf35a('0x2a')][_0xf35a('0x17')]);}_0x1e1c64['order']=qs['sort'](_0xd551a1[_0xf35a('0x2a')][_0xf35a('0x2c')]);_0x1e1c64[_0xf35a('0x2d')]=qs['filters'](_['pick'](_0xd551a1['query'],_0x1bad86['filters']),_0x299cb8);if(_0xd551a1[_0xf35a('0x2a')][_0xf35a('0x2e')]){_0x1e1c64[_0xf35a('0x2d')]=_['merge'](_0x1e1c64[_0xf35a('0x2d')],{'$or':_[_0xf35a('0x20')](_0x299cb8,function(_0x18e3fe){if(_0x18e3fe[_0xf35a('0x22')]!==_0xf35a('0x2f')){var _0x119eb4={};_0x119eb4[_0x18e3fe[_0xf35a('0x1f')]]={'$like':'%'+_0xd551a1[_0xf35a('0x2a')]['filter']+'%'};return _0x119eb4;}})});}_0x1e1c64=_['merge']({},_0x1e1c64,_0xd551a1['options']);var _0x1c31e6={'where':_0x1e1c64['where']};return db[_0xf35a('0x30')][_0xf35a('0x31')](_0x1c31e6)[_0xf35a('0xa')](function(_0x41256d){_0xe6567a[_0xf35a('0x31')]=_0x41256d;if(_0xd551a1[_0xf35a('0x2a')]['includeAll']){_0x1e1c64[_0xf35a('0x32')]=[{'all':!![]}];}return db[_0xf35a('0x30')][_0xf35a('0x33')](_0x1e1c64);})[_0xf35a('0xa')](function(_0x1dc85a){_0xe6567a[_0xf35a('0x34')]=_0x1dc85a;return _0xe6567a;})['then'](respondWithFilteredResult(_0x13361d,_0x1e1c64))[_0xf35a('0x14')](handleError(_0x13361d,null));};exports[_0xf35a('0x35')]=function(_0x569fde,_0x5ed92c){var _0x12ffac={'raw':!![],'where':{'id':_0x569fde[_0xf35a('0x36')]['id']}},_0x4061f1={};_0x4061f1['model']=_[_0xf35a('0x24')](db[_0xf35a('0x30')][_0xf35a('0x21')]);_0x4061f1[_0xf35a('0x2a')]=_[_0xf35a('0x24')](_0x569fde[_0xf35a('0x2a')]);_0x4061f1[_0xf35a('0x25')]=_[_0xf35a('0x28')](_0x4061f1[_0xf35a('0x26')],_0x4061f1[_0xf35a('0x2a')]);_0x12ffac['attributes']=_['intersection'](_0x4061f1[_0xf35a('0x26')],qs[_0xf35a('0x29')](_0x569fde['query'][_0xf35a('0x29')]));_0x12ffac[_0xf35a('0x27')]=_0x12ffac[_0xf35a('0x27')][_0xf35a('0x37')]?_0x12ffac[_0xf35a('0x27')]:_0x4061f1[_0xf35a('0x26')];if(_0x569fde['query'][_0xf35a('0x38')]){_0x12ffac[_0xf35a('0x32')]=[{'all':!![]}];}_0x12ffac=_[_0xf35a('0x39')]({},_0x12ffac,_0x569fde[_0xf35a('0x3a')]);return db['Network']['find'](_0x12ffac)['then'](handleEntityNotFound(_0x5ed92c,null))[_0xf35a('0xa')](respondWithResult(_0x5ed92c,null))[_0xf35a('0x14')](handleError(_0x5ed92c,null));};exports[_0xf35a('0x3b')]=function(_0x48c04e,_0x398b8e){var _0x5643f5;return db[_0xf35a('0x30')][_0xf35a('0x3b')](_0x48c04e['body'],{'raw':!![]})[_0xf35a('0xa')](function(_0x5b85eb){_0x5643f5=_0x5b85eb;return db[_0xf35a('0x30')][_0xf35a('0x33')]({'where':{'type':_0x48c04e[_0xf35a('0x3c')]['type']},'raw':!![]});})[_0xf35a('0xa')](function(_0x341f10){if(_0x5643f5[_0xf35a('0x22')][_0xf35a('0x3d')]()==_0xf35a('0x3e')){var _0x42b79a=fs[_0xf35a('0x3f')](path['join'](config['root'],_0xf35a('0x40')),_0xf35a('0x41'));var _0x260b4e=ejs[_0xf35a('0x42')](_0x42b79a,{'networks':_0x341f10||[]});fs['writeFileSync'](_0xf35a('0x43'),_0x260b4e);return respondWithRpcPromise(_0xf35a('0x44'),_0xf35a('0x3b'),{'module':_0xf35a('0x45')});}else if(_0x5643f5[_0xf35a('0x22')][_0xf35a('0x3d')]()=='TURN'){var _0xb02ade=fs[_0xf35a('0x3f')](path[_0xf35a('0x46')](config[_0xf35a('0x47')],_0xf35a('0x48')),_0xf35a('0x41'));var _0x1aba39=ejs[_0xf35a('0x42')](_0xb02ade,{'networks':_0x341f10||[]});fs[_0xf35a('0x49')]('/etc/asterisk/turn_xcally.conf',_0x1aba39);return respondWithRpcPromise(_0xf35a('0x44'),_0xf35a('0x3b'),{'module':_0xf35a('0x45')});}else{var _0x1e8190=fs['readFileSync'](path['join'](config[_0xf35a('0x47')],_0xf35a('0x4a')),_0xf35a('0x41'));var _0x248d14=ejs[_0xf35a('0x42')](_0x1e8190,{'networks':_0x341f10||[]});fs[_0xf35a('0x49')](util[_0xf35a('0x4b')](_0xf35a('0x4c'),_0x48c04e['body'][_0xf35a('0x22')][_0xf35a('0x4d')]()),_0x248d14);return respondWithRpcPromise(_0xf35a('0x44'),_0xf35a('0x3b'),{'module':_0xf35a('0x4e')});}})[_0xf35a('0xa')](function(){return _0x5643f5;})[_0xf35a('0xa')](respondWithResult(_0x398b8e,0xc9))[_0xf35a('0x14')](handleError(_0x398b8e,null));};exports[_0xf35a('0x1c')]=function(_0x54ad21,_0xbe0e85){var _0x519e2c;return db[_0xf35a('0x30')][_0xf35a('0x4f')]({'where':{'id':_0x54ad21['params']['id']}})['then'](handleEntityNotFound(_0xbe0e85,null))[_0xf35a('0xa')](saveUpdates(_0x54ad21[_0xf35a('0x3c')],null))[_0xf35a('0xa')](function(_0x771045){if(_0x771045){_0x519e2c=_0x771045;return db[_0xf35a('0x30')][_0xf35a('0x33')]({'where':{'type':_0x519e2c[_0xf35a('0x22')]},'raw':!![]});}return null;})[_0xf35a('0xa')](function(_0x4082a6){if(_0x519e2c['type'][_0xf35a('0x3d')]()==_0xf35a('0x3e')){var _0x55f56d=fs['readFileSync'](path[_0xf35a('0x46')](config['root'],_0xf35a('0x40')),_0xf35a('0x41'));var _0x4491fb=ejs[_0xf35a('0x42')](_0x55f56d,{'networks':_0x4082a6||[]});fs['writeFileSync'](_0xf35a('0x43'),_0x4491fb);return respondWithRpcPromise(_0xf35a('0x44'),_0xf35a('0x1c'),{'module':_0xf35a('0x45')});}else if(_0x519e2c[_0xf35a('0x22')][_0xf35a('0x3d')]()=='TURN'){var _0x4a0707=fs[_0xf35a('0x3f')](path[_0xf35a('0x46')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xf35a('0x41'));var _0x1b9182=ejs[_0xf35a('0x42')](_0x4a0707,{'networks':_0x4082a6||[]});fs['writeFileSync'](_0xf35a('0x50'),_0x1b9182);return respondWithRpcPromise(_0xf35a('0x44'),_0xf35a('0x1c'),{'module':_0xf35a('0x45')});}else{var _0x7ea1e6=fs[_0xf35a('0x3f')](path['join'](config[_0xf35a('0x47')],'server/files/templates/network.ejs'),_0xf35a('0x41'));var _0x4a3105=ejs['render'](_0x7ea1e6,{'networks':_0x4082a6||[]});fs['writeFileSync'](util[_0xf35a('0x4b')]('/etc/asterisk/sip_xcally_%s.conf',_0x54ad21['body'][_0xf35a('0x22')][_0xf35a('0x4d')]()),_0x4a3105);return respondWithRpcPromise('Reload','update',{'module':_0xf35a('0x4e')});}})[_0xf35a('0xa')](function(_0x156609){if(_0x156609){return _0x519e2c;}return null;})[_0xf35a('0xa')](respondWithResult(_0xbe0e85,null))[_0xf35a('0x14')](handleError(_0xbe0e85,null));};exports[_0xf35a('0x1d')]=function(_0x21530a,_0x155290){var _0x2518c2;return db[_0xf35a('0x30')]['find']({'where':{'id':_0x21530a['params']['id']}})[_0xf35a('0xa')](function(_0x2e613f){_0x2518c2=_0x2e613f;return _0x2e613f;})['then'](handleEntityNotFound(_0x155290,null))[_0xf35a('0xa')](removeEntity(_0x155290,null))[_0xf35a('0xa')](function(){if(_0x2518c2){return db['Network']['findAll']({'where':{'type':_0x2518c2[_0xf35a('0x22')]},'raw':!![]});}})[_0xf35a('0xa')](function(_0x314934){if(_0x2518c2[_0xf35a('0x22')][_0xf35a('0x3d')]()==_0xf35a('0x3e')){var _0x586f5f=fs[_0xf35a('0x3f')](path['join'](config[_0xf35a('0x47')],_0xf35a('0x40')),'utf8');var _0x3307f9=ejs[_0xf35a('0x42')](_0x586f5f,{'networks':_0x314934||[]});fs[_0xf35a('0x49')](_0xf35a('0x43'),_0x3307f9);return respondWithRpcPromise(_0xf35a('0x44'),_0xf35a('0x1d'),{'module':'res_stun_monitor.so'});}else if(_0x2518c2[_0xf35a('0x22')][_0xf35a('0x3d')]()==_0xf35a('0x51')){var _0x4b73d0=fs[_0xf35a('0x3f')](path['join'](config[_0xf35a('0x47')],_0xf35a('0x48')),_0xf35a('0x41'));var _0x2dbc23=ejs[_0xf35a('0x42')](_0x4b73d0,{'networks':_0x314934||[]});fs[_0xf35a('0x49')](_0xf35a('0x50'),_0x2dbc23);return respondWithRpcPromise(_0xf35a('0x44'),_0xf35a('0x1d'),{'module':'res_stun_monitor.so'});}else{var _0x56afd9=fs['readFileSync'](path['join'](config['root'],_0xf35a('0x4a')),_0xf35a('0x41'));var _0x4ba8a3=ejs[_0xf35a('0x42')](_0x56afd9,{'networks':_0x314934||[]});fs[_0xf35a('0x49')](util[_0xf35a('0x4b')](_0xf35a('0x4c'),_0x2518c2[_0xf35a('0x22')]['toLowerCase']()),_0x4ba8a3);return respondWithRpcPromise('Reload',_0xf35a('0x1d'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x155290,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index f0f8e40..5d1a55e 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 _0x4876=['../../config/environment','./network.attributes','Network','network','../../config/logger','bluebird','path','rimraf'];(function(_0x54f9a6,_0x3d5d25){var _0x13b7b0=function(_0x361e3d){while(--_0x361e3d){_0x54f9a6['push'](_0x54f9a6['shift']());}};_0x13b7b0(++_0x3d5d25);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6487('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6487('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6487('0x2'));var rimraf=require(_0x6487('0x3'));var config=require(_0x6487('0x4'));var attributes=require(_0x6487('0x5'));module['exports']=function(_0x23e50b,_0x856b1c){return _0x23e50b['define'](_0x6487('0x6'),attributes,{'tableName':_0x6487('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4eb=['./network.attributes','exports','define','network','lodash','bluebird','rimraf','../../config/environment'];(function(_0x26d386,_0x1660c0){var _0x4ef9a8=function(_0x55e2d3){while(--_0x55e2d3){_0x26d386['push'](_0x26d386['shift']());}};_0x4ef9a8(++_0x1660c0);}(_0xf4eb,0xec));var _0xbf4e=function(_0x10856c,_0x3f155b){_0x10856c=_0x10856c-0x0;var _0x217559=_0xf4eb[_0x10856c];return _0x217559;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('Network',attributes,{'tableName':_0xbf4e('0x7'),'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 61bf0ef..0355458 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x416e75,_0x11df2e){_0x416e75=_0x416e75-0x0;var _0x989f5d=_0x7a54[_0x416e75];return _0x989f5d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _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(_0x483550,_0x5126ed){var _0x430532=function(_0x46dfcc){while(--_0x46dfcc){_0x483550['push'](_0x483550['shift']());}};_0x430532(++_0x5126ed);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index c119230..0f5e40a 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 _0xd1fd=['update','delete','destroy','removeAnswers','removeAgents','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','addApplications','/:id/send','send','put'];(function(_0x3c0071,_0x78f21a){var _0x1cf8dd=function(_0x520a97){while(--_0x520a97){_0x3c0071['push'](_0x3c0071['shift']());}};_0x1cf8dd(++_0x78f21a);}(_0xd1fd,0xe3));var _0xdd1f=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0xd1fd[_0x27dba4];return _0x35ec9d;};'use strict';var multer=require('multer');var util=require(_0xdd1f('0x0'));var path=require(_0xdd1f('0x1'));var timeout=require('connect-timeout');var express=require(_0xdd1f('0x2'));var router=express[_0xdd1f('0x3')]();var fs_extra=require(_0xdd1f('0x4'));var auth=require(_0xdd1f('0x5'));var interaction=require(_0xdd1f('0x6'));var config=require(_0xdd1f('0x7'));var controller=require('./openchannelAccount.controller');router[_0xdd1f('0x8')]('/',auth['isAuthenticated'](),controller[_0xdd1f('0x9')]);router['get'](_0xdd1f('0xa'),auth[_0xdd1f('0xb')](),controller['describe']);router[_0xdd1f('0x8')](_0xdd1f('0xc'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0xd')]);router['get'](_0xdd1f('0xe'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0xf')]);router[_0xdd1f('0x8')](_0xdd1f('0x10'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x11')]);router[_0xdd1f('0x8')](_0xdd1f('0x12'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x13')]);router[_0xdd1f('0x8')](_0xdd1f('0x14'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x15')]);router[_0xdd1f('0x8')](_0xdd1f('0x16'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x17')]);router[_0xdd1f('0x18')]('/',auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x19')]);router[_0xdd1f('0x18')]('/:id/dispositions',auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x1a')]);router[_0xdd1f('0x18')](_0xdd1f('0x10'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x1b')]);router[_0xdd1f('0x18')]('/:id/notify',controller['notify']);router[_0xdd1f('0x18')]('/:id/applications',auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x1c')]);router['post']('/:id/users',auth[_0xdd1f('0xb')](),controller['addAgents']);router['post'](_0xdd1f('0x1d'),auth['isAuthenticated'](),controller[_0xdd1f('0x1e')]);router[_0xdd1f('0x1f')](_0xdd1f('0xc'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x20')]);router[_0xdd1f('0x21')](_0xdd1f('0xc'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x22')]);router['delete'](_0xdd1f('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xdd1f('0x21')](_0xdd1f('0x10'),auth['isAuthenticated'](),controller[_0xdd1f('0x23')]);router[_0xdd1f('0x21')](_0xdd1f('0x16'),auth['isAuthenticated'](),controller[_0xdd1f('0x24')]);module['exports']=router; \ No newline at end of file +var _0xfbf9=['/:id/send','send','put','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','fs-extra','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','addApplications','addAgents'];(function(_0x130a7a,_0x3bee32){var _0x575162=function(_0x7c9b18){while(--_0x7c9b18){_0x130a7a['push'](_0x130a7a['shift']());}};_0x575162(++_0x3bee32);}(_0xfbf9,0x1ac));var _0x9fbf=function(_0x5c8a11,_0x10805f){_0x5c8a11=_0x5c8a11-0x0;var _0x116b22=_0xfbf9[_0x5c8a11];return _0x116b22;};'use strict';var multer=require('multer');var util=require(_0x9fbf('0x0'));var path=require(_0x9fbf('0x1'));var timeout=require('connect-timeout');var express=require(_0x9fbf('0x2'));var router=express['Router']();var fs_extra=require(_0x9fbf('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9fbf('0x4'));var config=require('../../config/environment');var controller=require(_0x9fbf('0x5'));router[_0x9fbf('0x6')]('/',auth[_0x9fbf('0x7')](),controller[_0x9fbf('0x8')]);router[_0x9fbf('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x9fbf('0x9')]);router[_0x9fbf('0x6')](_0x9fbf('0xa'),auth[_0x9fbf('0x7')](),controller[_0x9fbf('0xb')]);router[_0x9fbf('0x6')](_0x9fbf('0xc'),auth[_0x9fbf('0x7')](),controller[_0x9fbf('0xd')]);router[_0x9fbf('0x6')](_0x9fbf('0xe'),auth[_0x9fbf('0x7')](),controller['getAnswers']);router[_0x9fbf('0x6')](_0x9fbf('0xf'),auth[_0x9fbf('0x7')](),controller[_0x9fbf('0x10')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x9fbf('0x11')]);router[_0x9fbf('0x6')](_0x9fbf('0x12'),auth[_0x9fbf('0x7')](),controller[_0x9fbf('0x13')]);router[_0x9fbf('0x14')]('/',auth[_0x9fbf('0x7')](),controller[_0x9fbf('0x15')]);router[_0x9fbf('0x14')]('/:id/dispositions',auth[_0x9fbf('0x7')](),controller[_0x9fbf('0x16')]);router['post'](_0x9fbf('0xe'),auth[_0x9fbf('0x7')](),controller['addAnswer']);router['post'](_0x9fbf('0x17'),controller[_0x9fbf('0x18')]);router[_0x9fbf('0x14')]('/:id/applications',auth['isAuthenticated'](),controller[_0x9fbf('0x19')]);router['post'](_0x9fbf('0x12'),auth[_0x9fbf('0x7')](),controller[_0x9fbf('0x1a')]);router[_0x9fbf('0x14')](_0x9fbf('0x1b'),auth[_0x9fbf('0x7')](),controller[_0x9fbf('0x1c')]);router[_0x9fbf('0x1d')](_0x9fbf('0xa'),auth[_0x9fbf('0x7')](),controller['update']);router[_0x9fbf('0x1e')](_0x9fbf('0xa'),auth[_0x9fbf('0x7')](),controller['destroy']);router[_0x9fbf('0x1e')](_0x9fbf('0xc'),auth[_0x9fbf('0x7')](),controller[_0x9fbf('0x1f')]);router[_0x9fbf('0x1e')]('/:id/canned_answers',auth[_0x9fbf('0x7')](),controller[_0x9fbf('0x20')]);router['delete']('/:id/users',auth[_0x9fbf('0x7')](),controller[_0x9fbf('0x21')]);module[_0x9fbf('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index baf459f..6d26074 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 _0xe82d=['sequelize','randomstring','exports','STRING','name','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','setDataValue','mandatoryDispositionPauseId'];(function(_0x42b58a,_0x3609a7){var _0x3240a8=function(_0x39e691){while(--_0x39e691){_0x42b58a['push'](_0x42b58a['shift']());}};_0x3240a8(++_0x3609a7);}(_0xe82d,0x186));var _0xde82=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xe82d[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0xde82('0x0'));var rs=require(_0xde82('0x1'));module[_0xde82('0x2')]={'name':{'type':Sequelize[_0xde82('0x3')],'unique':_0xde82('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xde82('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xde82('0x5')]();}},'replyUri':{'type':Sequelize[_0xde82('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xde82('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xde82('0x6')],'defaultValue':function(){return _0xde82('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xde82('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xde82('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xde82('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xde82('0x3')]},'queueTransfer':{'type':Sequelize[_0xde82('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xde82('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xde82('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xde82('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xde82('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xde82('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x472be8){if(!_0x472be8)this[_0xde82('0xb')](_0xde82('0xc'),null);this[_0xde82('0xb')]('mandatoryDisposition',_0x472be8);}}}; \ No newline at end of file +var _0x8b6b=['randomstring','exports','STRING','name','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','setDataValue','mandatoryDispositionPauseId'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x8b6b,0x134));var _0xb8b6=function(_0x1e94e3,_0x4ebc7d){_0x1e94e3=_0x1e94e3-0x0;var _0x45477f=_0x8b6b[_0x1e94e3];return _0x45477f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb8b6('0x0'));module[_0xb8b6('0x1')]={'name':{'type':Sequelize[_0xb8b6('0x2')],'unique':_0xb8b6('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xb8b6('0x2')]},'token':{'type':Sequelize[_0xb8b6('0x2')],'defaultValue':function(){return rs[_0xb8b6('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xb8b6('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb8b6('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb8b6('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb8b6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb8b6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xb8b6('0x2')]},'queueTransfer':{'type':Sequelize[_0xb8b6('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb8b6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb8b6('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb8b6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb8b6('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xb8b6('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xb8b6('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x52bf40){if(!_0x52bf40)this[_0xb8b6('0x9')](_0xb8b6('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x52bf40);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index cbf0617..f74af1b 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 _0x1da9=['get','OpenchannelAccounts','end','name','send','index','map','OpenchannelAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','show','Pause','mandatoryDispositionPause','includeAll','options','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','describe','OpenchannelAccountId','Disposition','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','isNil','from','Sequelize','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','Contacts','DESC','Applications','account','applications','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','findAndCountAll','stack','json','getApplications','Contact','fullname','internal','Tag','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy'];(function(_0x13c4f8,_0x433521){var _0x5a8f4b=function(_0x1df845){while(--_0x1df845){_0x13c4f8['push'](_0x13c4f8['shift']());}};_0x5a8f4b(++_0x433521);}(_0x1da9,0x141));var _0x91da=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1da9[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x91da('0x0'));var rimraf=require(_0x91da('0x1'));var zipdir=require(_0x91da('0x2'));var jsonpatch=require(_0x91da('0x3'));var rp=require(_0x91da('0x4'));var moment=require(_0x91da('0x5'));var BPromise=require(_0x91da('0x6'));var Mustache=require(_0x91da('0x7'));var util=require(_0x91da('0x8'));var path=require(_0x91da('0x9'));var sox=require(_0x91da('0xa'));var csv=require(_0x91da('0xb'));var ejs=require(_0x91da('0xc'));var fs=require('fs');var fs_extra=require(_0x91da('0xd'));var _=require(_0x91da('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x91da('0xf'));var deskjs=require(_0x91da('0x10'));var toCsv=require(_0x91da('0xb'));var querystring=require('querystring');var Papa=require(_0x91da('0x11'));var Redis=require(_0x91da('0x12'));var authService=require(_0x91da('0x13'));var qs=require(_0x91da('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91da('0x15'));var logger=require(_0x91da('0x16'))('api');var utils=require(_0x91da('0x17'));var config=require(_0x91da('0x18'));var licenseUtil=require(_0x91da('0x19'));var db=require(_0x91da('0x1a'))['db'];config[_0x91da('0x1b')]=_[_0x91da('0x1c')](config[_0x91da('0x1b')],{'host':_0x91da('0x1d'),'port':0x18eb});var socket=require(_0x91da('0x1e'))(new Redis(config[_0x91da('0x1b')]));require('./openchannelAccount.socket')[_0x91da('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x91da('0x20')][_0x91da('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x91da('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xc1e865,_0x36c0c9,_0x404abe,_0x3a9044){return new BPromise(function(_0x40dd9f,_0x3c2593){var _0xde7544=_0x3a9044||client;return _0xde7544[_0x91da('0x22')](_0xc1e865,_0x404abe)[_0x91da('0x23')](function(_0xe024bd){logger[_0x91da('0x24')](_0x91da('0x25'),_0x36c0c9,_0x91da('0x26'));logger[_0x91da('0x27')](_0x91da('0x28'),_0x36c0c9,'request\x20sent',JSON[_0x91da('0x29')](_0xe024bd));if(_0xe024bd[_0x91da('0x2a')]){if(_0xe024bd['error'][_0x91da('0x2b')]===0x1f4){logger[_0x91da('0x2a')](_0x91da('0x25'),_0x36c0c9,_0xe024bd['error'][_0x91da('0x2c')]);return _0x3c2593(_0xe024bd[_0x91da('0x2a')][_0x91da('0x2c')]);}logger[_0x91da('0x2a')](_0x91da('0x25'),_0x36c0c9,_0xe024bd['error'][_0x91da('0x2c')]);return _0x40dd9f(_0xe024bd[_0x91da('0x2a')][_0x91da('0x2c')]);}else{logger[_0x91da('0x24')](_0x91da('0x25'),_0x36c0c9,_0x91da('0x26'));_0x40dd9f(_0xe024bd[_0x91da('0x2d')][_0x91da('0x2c')]);}})[_0x91da('0x2e')](function(_0x263463){logger[_0x91da('0x2a')](_0x91da('0x25'),_0x36c0c9,_0x263463);_0x3c2593(_0x263463);});});}function respondWithStatusCode(_0x3deb73,_0x1a9b87){_0x1a9b87=_0x1a9b87||0xcc;return function(_0x4269f2){if(_0x4269f2){return _0x3deb73[_0x91da('0x2f')](_0x1a9b87);}return _0x3deb73[_0x91da('0x30')](_0x1a9b87)['end']();};}function respondWithResult(_0x275d54,_0x572320){_0x572320=_0x572320||0xc8;return function(_0x2afa22){if(_0x2afa22){return _0x275d54['status'](_0x572320)['json'](_0x2afa22);}};}function respondWithFilteredResult(_0x3d37c4,_0x274c82){return function(_0x74a4cf){if(_0x74a4cf){var _0x5ebd61=typeof _0x274c82[_0x91da('0x31')]===_0x91da('0x32')&&typeof _0x274c82[_0x91da('0x33')]===_0x91da('0x32');var _0x15c96c=_0x74a4cf['count'];var _0x51968d=_0x5ebd61?0x0:_0x274c82[_0x91da('0x31')];var _0x304b3c=_0x5ebd61?_0x74a4cf[_0x91da('0x34')]:_0x274c82[_0x91da('0x31')]+_0x274c82[_0x91da('0x33')];var _0x5d1faa;if(_0x304b3c>=_0x15c96c){_0x304b3c=_0x15c96c;_0x5d1faa=0xc8;}else{_0x5d1faa=0xce;}_0x3d37c4[_0x91da('0x30')](_0x5d1faa);return _0x3d37c4[_0x91da('0x35')](_0x91da('0x36'),_0x51968d+'-'+_0x304b3c+'/'+_0x15c96c)['json'](_0x74a4cf);}return null;};}function patchUpdates(_0x466b67){return function(_0x13d7af){try{jsonpatch['apply'](_0x13d7af,_0x466b67,!![]);}catch(_0x5e9adb){return BPromise[_0x91da('0x37')](_0x5e9adb);}return _0x13d7af[_0x91da('0x38')]();};}function saveUpdates(_0x41a0a5,_0x367c42){return function(_0x3e3268){if(_0x3e3268){return _0x3e3268[_0x91da('0x39')](_0x41a0a5)['then'](function(_0x175384){return _0x175384;});}return null;};}function removeEntity(_0x96b8da,_0x425e9d){return function(_0x29597f){if(_0x29597f){return _0x29597f[_0x91da('0x3a')]()[_0x91da('0x23')](function(){var _0x1e88a7=_0x29597f[_0x91da('0x3b')]({'plain':!![]});var _0x77a081=_0x91da('0x3c');return db['UserProfileResource'][_0x91da('0x3a')]({'where':{'type':_0x77a081,'resourceId':_0x1e88a7['id']}})[_0x91da('0x23')](function(){return _0x29597f;});})[_0x91da('0x23')](function(){_0x96b8da[_0x91da('0x30')](0xcc)[_0x91da('0x3d')]();});}};}function handleEntityNotFound(_0x375ef0,_0x48657c){return function(_0x4e2d85){if(!_0x4e2d85){_0x375ef0[_0x91da('0x2f')](0x194);}return _0x4e2d85;};}function handleError(_0x132dfb,_0x61ed93){_0x61ed93=_0x61ed93||0x1f4;return function(_0xc94277){logger[_0x91da('0x2a')](_0xc94277['stack']);if(_0xc94277[_0x91da('0x3e')]){delete _0xc94277[_0x91da('0x3e')];}_0x132dfb[_0x91da('0x30')](_0x61ed93)[_0x91da('0x3f')](_0xc94277);};}exports[_0x91da('0x40')]=function(_0x15253a,_0x264356){var _0x370330={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x238ad2={},_0x2f5bb4={'count':0x0,'rows':[]};var _0x163870=_[_0x91da('0x41')](db[_0x91da('0x42')][_0x91da('0x43')],function(_0x3b12bb){return{'name':_0x3b12bb[_0x91da('0x44')],'type':_0x3b12bb[_0x91da('0x45')]['key']};});_0x238ad2[_0x91da('0x46')]=_[_0x91da('0x41')](_0x163870,_0x91da('0x3e'));_0x238ad2['query']=_[_0x91da('0x47')](_0x15253a[_0x91da('0x48')]);_0x238ad2[_0x91da('0x49')]=_[_0x91da('0x4a')](_0x238ad2[_0x91da('0x46')],_0x238ad2[_0x91da('0x48')]);_0x370330['attributes']=_[_0x91da('0x4a')](_0x238ad2[_0x91da('0x46')],qs[_0x91da('0x4b')](_0x15253a[_0x91da('0x48')][_0x91da('0x4b')]));_0x370330[_0x91da('0x4c')]=_0x370330['attributes'][_0x91da('0x4d')]?_0x370330[_0x91da('0x4c')]:_0x238ad2[_0x91da('0x46')];if(!_0x15253a[_0x91da('0x48')][_0x91da('0x4e')]('nolimit')){_0x370330['limit']=qs['limit'](_0x15253a[_0x91da('0x48')][_0x91da('0x33')]);_0x370330[_0x91da('0x31')]=qs[_0x91da('0x31')](_0x15253a[_0x91da('0x48')][_0x91da('0x31')]);}_0x370330[_0x91da('0x4f')]=qs[_0x91da('0x50')](_0x15253a[_0x91da('0x48')]['sort']);_0x370330[_0x91da('0x51')]=qs[_0x91da('0x49')](_[_0x91da('0x52')](_0x15253a['query'],_0x238ad2['filters']),_0x163870);if(_0x15253a[_0x91da('0x48')][_0x91da('0x53')]){_0x370330[_0x91da('0x51')]=_[_0x91da('0x54')](_0x370330[_0x91da('0x51')],{'$or':_['map'](_0x163870,function(_0x1ef97e){if(_0x1ef97e[_0x91da('0x45')]!=='VIRTUAL'){var _0x3e6ad2={};_0x3e6ad2[_0x1ef97e['name']]={'$like':'%'+_0x15253a[_0x91da('0x48')][_0x91da('0x53')]+'%'};return _0x3e6ad2;}})});}_0x370330=_[_0x91da('0x54')]({},_0x370330,_0x15253a['options']);var _0x12da71={'where':_0x370330[_0x91da('0x51')]};return db[_0x91da('0x42')][_0x91da('0x34')](_0x12da71)['then'](function(_0x4287e5){_0x2f5bb4[_0x91da('0x34')]=_0x4287e5;if(_0x15253a['query']['includeAll']){_0x370330[_0x91da('0x55')]=[{'all':!![]}];}return db[_0x91da('0x42')][_0x91da('0x56')](_0x370330);})[_0x91da('0x23')](function(_0x273456){_0x2f5bb4[_0x91da('0x57')]=_0x273456;return _0x2f5bb4;})['then'](respondWithFilteredResult(_0x264356,_0x370330))[_0x91da('0x2e')](handleError(_0x264356,null));};exports[_0x91da('0x58')]=function(_0x1a19ef,_0x5ced50){var _0x18707b={'raw':![],'where':{'id':_0x1a19ef['params']['id']},'include':[{'model':db[_0x91da('0x59')],'as':_0x91da('0x5a')}]},_0x39637a={};_0x39637a[_0x91da('0x46')]=_[_0x91da('0x47')](db[_0x91da('0x42')][_0x91da('0x43')]);_0x39637a[_0x91da('0x48')]=_['keys'](_0x1a19ef[_0x91da('0x48')]);_0x39637a['filters']=_[_0x91da('0x4a')](_0x39637a[_0x91da('0x46')],_0x39637a[_0x91da('0x48')]);_0x18707b[_0x91da('0x4c')]=_[_0x91da('0x4a')](_0x39637a[_0x91da('0x46')],qs['fields'](_0x1a19ef['query'][_0x91da('0x4b')]));_0x18707b[_0x91da('0x4c')]=_0x18707b[_0x91da('0x4c')][_0x91da('0x4d')]?_0x18707b[_0x91da('0x4c')]:_0x39637a['model'];if(_0x1a19ef[_0x91da('0x48')][_0x91da('0x5b')]){_0x18707b[_0x91da('0x55')]=[{'all':!![]}];}_0x18707b=_[_0x91da('0x54')]({},_0x18707b,_0x1a19ef[_0x91da('0x5c')]);return db[_0x91da('0x42')][_0x91da('0x5d')](_0x18707b)['then'](handleEntityNotFound(_0x5ced50,null))[_0x91da('0x23')](respondWithResult(_0x5ced50,null))[_0x91da('0x2e')](handleError(_0x5ced50,null));};exports['create']=function(_0x4c5111,_0x3b04cc){return db[_0x91da('0x42')][_0x91da('0x5e')](_0x4c5111[_0x91da('0x5f')],{})[_0x91da('0x23')](function(_0x45b17d){var _0x2b6f9d=_0x4c5111[_0x91da('0x60')][_0x91da('0x3b')]({'plain':!![]});if(!_0x2b6f9d)throw new Error(_0x91da('0x61'));if(_0x2b6f9d[_0x91da('0x62')]===_0x91da('0x60')){var _0x170c71=_0x45b17d[_0x91da('0x3b')]({'plain':!![]});var _0x455c96='OpenchannelAccounts';return db[_0x91da('0x63')][_0x91da('0x5d')]({'where':{'name':_0x455c96,'userProfileId':_0x2b6f9d[_0x91da('0x64')]},'raw':!![]})[_0x91da('0x23')](function(_0x5efde5){if(_0x5efde5&&_0x5efde5['autoAssociation']===0x0){return db['UserProfileResource'][_0x91da('0x5e')]({'name':_0x170c71['name'],'resourceId':_0x170c71['id'],'type':_0x5efde5['name'],'sectionId':_0x5efde5['id']},{})['then'](function(){return _0x45b17d;});}else{return _0x45b17d;}})[_0x91da('0x2e')](function(_0x6354fd){logger[_0x91da('0x2a')](_0x91da('0x65'),_0x6354fd);throw _0x6354fd;});}return _0x45b17d;})['then'](respondWithResult(_0x3b04cc,0xc9))[_0x91da('0x2e')](handleError(_0x3b04cc,null));};exports[_0x91da('0x39')]=function(_0x9cb767,_0xa9a7a9){if(_0x9cb767[_0x91da('0x5f')]['id']){delete _0x9cb767[_0x91da('0x5f')]['id'];}return db[_0x91da('0x42')][_0x91da('0x5d')]({'where':{'id':_0x9cb767[_0x91da('0x66')]['id']},'include':[{'model':db[_0x91da('0x59')],'as':_0x91da('0x5a')}]})[_0x91da('0x23')](handleEntityNotFound(_0xa9a7a9,null))[_0x91da('0x23')](saveUpdates(_0x9cb767['body'],null))[_0x91da('0x23')](respondWithResult(_0xa9a7a9,null))[_0x91da('0x2e')](handleError(_0xa9a7a9,null));};exports[_0x91da('0x3a')]=function(_0x4a4d9b,_0x47a8e8){return db[_0x91da('0x42')][_0x91da('0x5d')]({'where':{'id':_0x4a4d9b[_0x91da('0x66')]['id']}})['then'](handleEntityNotFound(_0x47a8e8,null))[_0x91da('0x23')](removeEntity(_0x47a8e8,null))[_0x91da('0x2e')](handleError(_0x47a8e8,null));};exports[_0x91da('0x67')]=function(_0x56bebf,_0x2de14d){return db[_0x91da('0x42')]['describe']()[_0x91da('0x23')](respondWithResult(_0x2de14d,null))['catch'](handleError(_0x2de14d,null));};exports['addDisposition']=function(_0x5d60d9,_0x44b99b,_0x547bb0){if(_0x5d60d9[_0x91da('0x5f')]['id']){delete _0x5d60d9[_0x91da('0x5f')]['id'];}return db['OpenchannelAccount'][_0x91da('0x5d')]({'where':{'id':_0x5d60d9['params']['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x44b99b,null))[_0x91da('0x23')](function(_0x18ac40){if(_0x18ac40){_0x5d60d9[_0x91da('0x5f')][_0x91da('0x68')]=_0x18ac40['id'];return db[_0x91da('0x69')][_0x91da('0x5e')](_0x5d60d9[_0x91da('0x5f')]);}})[_0x91da('0x23')](respondWithResult(_0x44b99b,null))[_0x91da('0x2e')](handleError(_0x44b99b,null));};exports['getDispositions']=function(_0x2f697d,_0x1f3be6,_0x3a5bb7){var _0x3bd489={'raw':![],'where':{}};var _0x565ecf={};var _0x21c428={'count':0x0,'rows':[]};return db[_0x91da('0x42')][_0x91da('0x6a')]({'where':{'id':_0x2f697d[_0x91da('0x66')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x1f3be6,null))[_0x91da('0x23')](function(_0x58a0bb){if(_0x58a0bb){_0x565ecf[_0x91da('0x46')]=_[_0x91da('0x47')](db[_0x91da('0x69')][_0x91da('0x43')]);_0x565ecf[_0x91da('0x48')]=_[_0x91da('0x47')](_0x2f697d[_0x91da('0x48')]);_0x565ecf[_0x91da('0x49')]=_[_0x91da('0x4a')](_0x565ecf[_0x91da('0x46')],_0x565ecf[_0x91da('0x48')]);_0x3bd489[_0x91da('0x4c')]=_[_0x91da('0x4a')](_0x565ecf[_0x91da('0x46')],qs[_0x91da('0x4b')](_0x2f697d[_0x91da('0x48')][_0x91da('0x4b')]));_0x3bd489[_0x91da('0x4c')]=_0x3bd489['attributes']['length']?_0x3bd489[_0x91da('0x4c')]:_0x565ecf[_0x91da('0x46')];if(!_0x2f697d[_0x91da('0x48')][_0x91da('0x4e')](_0x91da('0x6b'))){_0x3bd489[_0x91da('0x33')]=qs[_0x91da('0x33')](_0x2f697d['query']['limit']);_0x3bd489[_0x91da('0x31')]=qs['offset'](_0x2f697d[_0x91da('0x48')][_0x91da('0x31')]);}_0x3bd489[_0x91da('0x4f')]=qs[_0x91da('0x50')](_0x2f697d[_0x91da('0x48')][_0x91da('0x50')]);_0x3bd489['where']=qs[_0x91da('0x49')](_[_0x91da('0x52')](_0x2f697d[_0x91da('0x48')],_0x565ecf[_0x91da('0x49')]));_0x3bd489[_0x91da('0x51')][_0x91da('0x68')]=_0x58a0bb['id'];if(_0x2f697d['query']['filter']){_0x3bd489['where']=_[_0x91da('0x54')](_0x3bd489[_0x91da('0x51')],{'$or':_[_0x91da('0x41')](_0x3bd489['attributes'],function(_0x559064){var _0x176823={};_0x176823[_0x559064]={'$like':'%'+_0x2f697d[_0x91da('0x48')]['filter']+'%'};return _0x176823;})});}_0x3bd489=_[_0x91da('0x54')]({},_0x3bd489,_0x2f697d[_0x91da('0x5c')]);return db[_0x91da('0x69')][_0x91da('0x34')]({'where':_0x3bd489['where']})['then'](function(_0x5050a4){_0x21c428[_0x91da('0x34')]=_0x5050a4;if(_0x2f697d[_0x91da('0x48')]['includeAll']){_0x3bd489[_0x91da('0x55')]=[{'all':!![]}];}return db[_0x91da('0x69')][_0x91da('0x56')](_0x3bd489);})['then'](function(_0x3c0844){_0x21c428[_0x91da('0x57')]=_0x3c0844;return _0x21c428;});}})[_0x91da('0x23')](respondWithFilteredResult(_0x1f3be6,_0x3bd489))[_0x91da('0x2e')](handleError(_0x1f3be6,null));};exports[_0x91da('0x6c')]=function(_0x30b999,_0x56e042,_0x193fe4){return db[_0x91da('0x42')]['find']({'where':{'id':_0x30b999[_0x91da('0x66')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x56e042,null))[_0x91da('0x23')](function(_0x1d6c64){if(_0x1d6c64){return _0x1d6c64['removeDispositions'](_0x30b999['query'][_0x91da('0x6d')]);}})['then'](respondWithStatusCode(_0x56e042,null))['catch'](handleError(_0x56e042,null));};exports[_0x91da('0x6e')]=function(_0x305663,_0x5affa0,_0x5033c4){if(_0x305663['body']['id']){delete _0x305663[_0x91da('0x5f')]['id'];}return db[_0x91da('0x42')][_0x91da('0x5d')]({'where':{'id':_0x305663['params']['id']}})['then'](handleEntityNotFound(_0x5affa0,null))[_0x91da('0x23')](function(_0x16bc65){if(_0x16bc65){_0x305663[_0x91da('0x5f')][_0x91da('0x68')]=_0x16bc65['id'];return db[_0x91da('0x6f')][_0x91da('0x5e')](_0x305663[_0x91da('0x5f')]);}})[_0x91da('0x23')](respondWithResult(_0x5affa0,null))[_0x91da('0x2e')](handleError(_0x5affa0,null));};exports[_0x91da('0x70')]=function(_0x9c18b1,_0x140eb0,_0x4e9ab7){var _0x6912da={'raw':![],'where':{}};var _0x4cfb46={};var _0xdd4738={'count':0x0,'rows':[]};return db[_0x91da('0x42')][_0x91da('0x6a')]({'where':{'id':_0x9c18b1[_0x91da('0x66')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x140eb0,null))[_0x91da('0x23')](function(_0x24ec9a){if(_0x24ec9a){_0x4cfb46['model']=_[_0x91da('0x47')](db['CannedAnswer']['rawAttributes']);_0x4cfb46[_0x91da('0x48')]=_[_0x91da('0x47')](_0x9c18b1[_0x91da('0x48')]);_0x4cfb46[_0x91da('0x49')]=_[_0x91da('0x4a')](_0x4cfb46['model'],_0x4cfb46[_0x91da('0x48')]);_0x6912da[_0x91da('0x4c')]=_[_0x91da('0x4a')](_0x4cfb46[_0x91da('0x46')],qs[_0x91da('0x4b')](_0x9c18b1[_0x91da('0x48')][_0x91da('0x4b')]));_0x6912da[_0x91da('0x4c')]=_0x6912da[_0x91da('0x4c')][_0x91da('0x4d')]?_0x6912da[_0x91da('0x4c')]:_0x4cfb46[_0x91da('0x46')];if(!_0x9c18b1[_0x91da('0x48')]['hasOwnProperty'](_0x91da('0x6b'))){_0x6912da[_0x91da('0x33')]=qs[_0x91da('0x33')](_0x9c18b1['query'][_0x91da('0x33')]);_0x6912da[_0x91da('0x31')]=qs['offset'](_0x9c18b1['query'][_0x91da('0x31')]);}_0x6912da[_0x91da('0x4f')]=qs[_0x91da('0x50')](_0x9c18b1[_0x91da('0x48')][_0x91da('0x50')]);_0x6912da[_0x91da('0x51')]=qs[_0x91da('0x49')](_[_0x91da('0x52')](_0x9c18b1[_0x91da('0x48')],_0x4cfb46[_0x91da('0x49')]));_0x6912da[_0x91da('0x51')]['OpenchannelAccountId']=_0x24ec9a['id'];if(_0x9c18b1[_0x91da('0x48')][_0x91da('0x53')]){_0x6912da[_0x91da('0x51')]=_[_0x91da('0x54')](_0x6912da[_0x91da('0x51')],{'$or':_[_0x91da('0x41')](_0x6912da[_0x91da('0x4c')],function(_0x1fe74f){var _0x4f4f6c={};_0x4f4f6c[_0x1fe74f]={'$like':'%'+_0x9c18b1[_0x91da('0x48')]['filter']+'%'};return _0x4f4f6c;})});}_0x6912da=_[_0x91da('0x54')]({},_0x6912da,_0x9c18b1[_0x91da('0x5c')]);return db[_0x91da('0x6f')][_0x91da('0x34')]({'where':_0x6912da[_0x91da('0x51')]})[_0x91da('0x23')](function(_0x333fc5){_0xdd4738['count']=_0x333fc5;if(_0x9c18b1[_0x91da('0x48')][_0x91da('0x5b')]){_0x6912da[_0x91da('0x55')]=[{'all':!![]}];}return db[_0x91da('0x6f')][_0x91da('0x56')](_0x6912da);})['then'](function(_0xa7e29){_0xdd4738[_0x91da('0x57')]=_0xa7e29;return _0xdd4738;});}})[_0x91da('0x23')](respondWithFilteredResult(_0x140eb0,_0x6912da))[_0x91da('0x2e')](handleError(_0x140eb0,null));};exports[_0x91da('0x71')]=function(_0x2330b7,_0x1a9d77,_0x3081d4){return db[_0x91da('0x42')][_0x91da('0x5d')]({'where':{'id':_0x2330b7[_0x91da('0x66')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x1a9d77,null))[_0x91da('0x23')](function(_0x32cb9b){if(_0x32cb9b){return _0x32cb9b[_0x91da('0x71')](_0x2330b7[_0x91da('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x1a9d77,null))[_0x91da('0x2e')](handleError(_0x1a9d77,null));};exports[_0x91da('0x72')]=function(_0x2a2ea7,_0xe14ea9,_0x38060d){var _0x4d850c={'body':_0x2a2ea7[_0x91da('0x5f')],'channel':'openchannel'};var _0x42fb06=[];var _0x465d3f=[];var _0x246dee={};var _0x57b11d=![];return db[_0x91da('0x73')][_0x91da('0x67')]()[_0x91da('0x23')](function(_0x2f9557){if(!_0x2f9557){throw new db['Sequelize'][(_0x91da('0x74'))](_0x91da('0x75'));}_0x42fb06=_['difference'](_[_0x91da('0x47')](_0x2f9557),[_0x91da('0x76'),_0x91da('0x77')]);_0x465d3f=_[_0x91da('0x78')](_[_0x91da('0x47')](_0x2f9557),['createdAt',_0x91da('0x77'),'CompanyId',_0x91da('0x79')]);if(_0x2a2ea7[_0x91da('0x5f')]['id']){delete _0x2a2ea7[_0x91da('0x5f')]['id'];}if(_[_0x91da('0x7a')](_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x7b')])){throw new db[(_0x91da('0x7c'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x91da('0x7a')](_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x5f')])||_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x5f')]===''){throw new db['Sequelize'][(_0x91da('0x74'))](_0x91da('0x7d'));}if(_[_0x91da('0x7a')](_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x7e')])){throw new db[(_0x91da('0x7c'))][(_0x91da('0x74'))](_0x91da('0x7f')+_0x465d3f);}if(!_[_0x91da('0x80')](_0x465d3f,_0x2a2ea7['body'][_0x91da('0x7e')])){throw new db[(_0x91da('0x7c'))][(_0x91da('0x74'))](_0x91da('0x81')+_0x465d3f);}_0x246dee[_0x2a2ea7['body']['mapKey']]=_0x2a2ea7[_0x91da('0x5f')]['from'];})[_0x91da('0x23')](function(){return db[_0x91da('0x42')][_0x91da('0x5d')]({'where':{'id':_0x2a2ea7[_0x91da('0x66')]['id']},'include':[{'model':db[_0x91da('0x82')],'as':_0x91da('0x83'),'include':[{'model':db[_0x91da('0x73')],'as':_0x91da('0x84'),'where':_0x246dee,'limit':0x1,'order':[[_0x91da('0x77'),_0x91da('0x85')]]}]},{'model':db['OpenchannelApplication'],'as':_0x91da('0x86')}]});})[_0x91da('0x23')](handleEntityNotFound(_0xe14ea9,null))[_0x91da('0x23')](function(_0x24fdf8){if(_0x24fdf8&&_0x24fdf8[_0x91da('0x83')]){_0x4d850c[_0x91da('0x87')]=_0x24fdf8;_0x4d850c[_0x91da('0x88')]=_0x24fdf8[_0x91da('0x86')];_0x4d850c['list']=_0x24fdf8['List'];_0x4d850c[_0x91da('0x88')]=_['orderBy'](_0x4d850c[_0x91da('0x88')],['priority'],[_0x91da('0x89')]);if(_0x4d850c['account']['Applications']){delete _0x4d850c['account']['Applications'];}if(_0x4d850c[_0x91da('0x87')][_0x91da('0x83')]&&_0x4d850c[_0x91da('0x87')][_0x91da('0x83')][_0x91da('0x84')][_0x91da('0x4d')]){return _0x4d850c[_0x91da('0x87')]['List'][_0x91da('0x84')][0x0];}var _0x45e62a=_[_0x91da('0x1c')](_0x2a2ea7[_0x91da('0x5f')],{'firstName':_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x7b')],'ListId':_0x24fdf8[_0x91da('0x79')]});_0x45e62a[_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x7e')]]=_0x2a2ea7['body'][_0x91da('0x7b')];return db[_0x91da('0x73')][_0x91da('0x5e')](_0x45e62a,{'fields':_0x42fb06,'raw':!![]});}})[_0x91da('0x23')](handleEntityNotFound(_0xe14ea9,null))[_0x91da('0x23')](function(_0x328c3a){_0x4d850c[_0x91da('0x8a')]=_0x328c3a;if(_0x328c3a){var _0x21d37c={'ContactId':_0x328c3a['id'],'OpenchannelAccountId':_0x2a2ea7[_0x91da('0x66')]['id'],'from':(_0x328c3a[_0x91da('0x8b')]||'')+'\x20'+(_0x328c3a[_0x91da('0x8c')]||'')};var _0x1004f={'OpenchannelAccountId':_0x2a2ea7['params']['id'],'closed':![]};if(_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x8d')]){_0x1004f[_0x91da('0x8d')]=_0x2a2ea7['body'][_0x91da('0x8d')];return db[_0x91da('0x8e')]['find']({'where':_0x1004f})[_0x91da('0x23')](function(_0x54588c){if(_0x54588c){return[_0x54588c,![]];}_0x21d37c['threadId']=_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x8d')];_0x21d37c[_0x91da('0x8f')]=_0x2a2ea7[_0x91da('0x5f')]['externalUrl'];return db['OpenchannelInteraction'][_0x91da('0x5e')](_0x21d37c)[_0x91da('0x23')](function(_0x25c407){return[_0x25c407,!![]];});});}else{_0x1004f['threadId']=null;}_0x1004f[_0x91da('0x90')]=_0x328c3a['id'];return db[_0x91da('0x8e')][_0x91da('0x5d')]({'where':_0x1004f})[_0x91da('0x23')](function(_0x94fa85){if(_0x94fa85){return[_0x94fa85,![]];}return db[_0x91da('0x8e')][_0x91da('0x5e')](_0x21d37c)[_0x91da('0x23')](function(_0x8c24e){return[_0x8c24e,!![]];});});}})[_0x91da('0x91')](function(_0x46f80d,_0x36c082){if(_0x46f80d){_0x57b11d=_0x36c082;if(!_0x36c082){var _0x598e62={'from':(_0x4d850c['contact'][_0x91da('0x8b')]||'')+'\x20'+(_0x4d850c[_0x91da('0x8a')]['lastName']||'')};if(_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x8d')]&&_0x2a2ea7[_0x91da('0x5f')]['messageId']&&_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x8d')]!=_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x92')]){_0x598e62[_0x91da('0x8d')]=_0x2a2ea7[_0x91da('0x5f')]['messageId'];}return _0x46f80d[_0x91da('0x39')](_0x598e62);}else{return _0x46f80d;}}})[_0x91da('0x23')](function(_0x49e6d3){_0x4d850c[_0x91da('0x93')]=_0x49e6d3[_0x91da('0x3b')]({'plain':!![]});_0x4d850c[_0x91da('0x93')][_0x91da('0x94')]=_0x57b11d;if(_0x4d850c[_0x91da('0x93')][_0x91da('0x94')]){if(_0x4d850c['account'][_0x91da('0x95')]){_0x4d850c[_0x91da('0x88')][_0x91da('0x96')]({'id':0x0,'priority':_0x4d850c[_0x91da('0x88')][_0x91da('0x4d')]+0x1,'app':_0x91da('0x97'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x91da('0x98')]['create']({'body':_0x2a2ea7['body'][_0x91da('0x5f')],'OpenchannelAccountId':_0x2a2ea7[_0x91da('0x66')]['id'],'OpenchannelInteractionId':_0x49e6d3['id'],'direction':'in','ContactId':_0x4d850c[_0x91da('0x8a')]['id'],'AttachmentId':_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x99')]});})['then'](function(_0x490c53){_0x4d850c[_0x91da('0x2c')]=_0x490c53;if(!_0x4d850c[_0x91da('0x93')]['UserId'])return;return db[_0x91da('0x9a')][_0x91da('0x5d')]({'attributes':['id',_0x91da('0x3e')],'where':{'id':_0x4d850c[_0x91da('0x93')][_0x91da('0x9b')]}});})[_0x91da('0x23')](function(_0x2f4dd3){if(_0x2f4dd3){_0x4d850c[_0x91da('0x88')][_0x91da('0x9c')]({'id':0x0,'priority':0x0,'app':_0x91da('0x9d'),'appdata':_0x2f4dd3[_0x91da('0x3e')]+','+(_0x4d850c['account'][_0x91da('0x9e')]||0xa),'interval':_0x91da('0x9f')});}if(!_0x4d850c[_0x91da('0x93')][_0x91da('0xa0')])return;return db[_0x91da('0xa1')][_0x91da('0x5d')]({'attributes':['id',_0x91da('0x3e')],'where':{'id':_0x4d850c['interaction'][_0x91da('0xa0')]}});})[_0x91da('0x23')](function(_0x226a9c){if(_0x226a9c){_0x4d850c[_0x91da('0x88')][_0x91da('0x9c')]({'id':0x0,'priority':0x1,'app':_0x91da('0xa2'),'appdata':_0x226a9c[_0x91da('0x3e')]+','+(_0x4d850c['account'][_0x91da('0xa3')]||0x12c),'interval':_0x91da('0x9f')});}return respondWithRpcPromise(_0x91da('0xa4'),'startRouting',_0x4d850c);})[_0x91da('0x23')](function(_0xd3de9b){respondWithRpcPromise(_0x91da('0xa5'),_0x91da('0xa5'),{'event':_0x91da('0x72'),'message':_0xd3de9b},client9002);return _0xd3de9b;})[_0x91da('0x23')](respondWithResult(_0xe14ea9,null))[_0x91da('0x2e')](handleError(_0xe14ea9,null));};exports['addApplications']=function(_0x4c3276,_0x3a9bca){var _0x493994=_0x4c3276[_0x91da('0x66')]['id'];var _0x3f2838=_0x4c3276[_0x91da('0x5f')];var _0x56ebf9=0xc8;var _0x453095=null;return db[_0x91da('0xa6')][_0x91da('0xa7')]({'isolationLevel':db['sequelize'][_0x91da('0xa8')][_0x91da('0xa9')][_0x91da('0xaa')]},function(_0x1c84b1){return db[_0x91da('0x42')][_0x91da('0x6a')]({'where':{'id':_0x493994},'transaction':_0x1c84b1})[_0x91da('0x23')](function(_0x147e04){if(_0x147e04){return db['OpenchannelApplication'][_0x91da('0x3a')]({'where':{'OpenchannelAccountId':_0x493994},'transaction':_0x1c84b1})[_0x91da('0x23')](function(){var _0x16300e=_[_0x91da('0x41')](_0x3f2838,function(_0xdc0dfe){_0xdc0dfe[_0x91da('0x68')]=_0x493994;return _0xdc0dfe;});return db[_0x91da('0xab')]['bulkCreate'](_0x16300e,{'transaction':_0x1c84b1});});}else{_0x56ebf9=0x194;_0x453095=[];}});})[_0x91da('0x23')](function(){if(_0x56ebf9!==0x194){return db[_0x91da('0xab')][_0x91da('0xac')]({'where':{'OpenchannelAccountId':_0x493994},'order':'priority'})[_0x91da('0x23')](function(_0x38dc25){_0x453095=_0x38dc25;});}})[_0x91da('0x2e')](function(_0x5de1e9){_0x56ebf9=0x1f4;logger[_0x91da('0x2a')](_0x5de1e9[_0x91da('0xad')]);if(_0x5de1e9[_0x91da('0x3e')]){delete _0x5de1e9[_0x91da('0x3e')];}_0x453095=_0x5de1e9;})['finally'](function(){if(_0x453095===null){_0x3a9bca[_0x91da('0x2f')](_0x56ebf9);}else{if(_0x56ebf9===0x1f4){_0x3a9bca['status'](_0x56ebf9)[_0x91da('0x3f')](_0x453095);}else{_0x3a9bca[_0x91da('0x30')](_0x56ebf9)[_0x91da('0xae')](_0x453095);}}});};exports[_0x91da('0xaf')]=function(_0x5b9d68,_0x541084,_0x1d7cc0){var _0x5b2e4c={};var _0x426a8c={};var _0x5f39a4;var _0x575209;return db['OpenchannelAccount'][_0x91da('0x6a')]({'where':{'id':_0x5b9d68['params']['id']}})['then'](handleEntityNotFound(_0x541084,null))[_0x91da('0x23')](function(_0x5bc036){if(_0x5bc036){_0x5f39a4=_0x5bc036;_0x426a8c['model']=_[_0x91da('0x47')](db[_0x91da('0xab')][_0x91da('0x43')]);_0x426a8c[_0x91da('0x48')]=_[_0x91da('0x47')](_0x5b9d68[_0x91da('0x48')]);_0x426a8c[_0x91da('0x49')]=_[_0x91da('0x4a')](_0x426a8c[_0x91da('0x46')],_0x426a8c[_0x91da('0x48')]);_0x5b2e4c[_0x91da('0x4c')]=_[_0x91da('0x4a')](_0x426a8c[_0x91da('0x46')],qs[_0x91da('0x4b')](_0x5b9d68[_0x91da('0x48')][_0x91da('0x4b')]));_0x5b2e4c[_0x91da('0x4c')]=_0x5b2e4c[_0x91da('0x4c')][_0x91da('0x4d')]?_0x5b2e4c['attributes']:_0x426a8c[_0x91da('0x46')];_0x5b2e4c[_0x91da('0x4f')]=qs[_0x91da('0x50')](_0x5b9d68[_0x91da('0x48')]['sort']);_0x5b2e4c['where']=qs['filters'](_[_0x91da('0x52')](_0x5b9d68[_0x91da('0x48')],_0x426a8c[_0x91da('0x49')]));if(_0x5b9d68['query'][_0x91da('0x53')]){_0x5b2e4c[_0x91da('0x51')]=_[_0x91da('0x54')](_0x5b2e4c[_0x91da('0x51')],{'$or':_[_0x91da('0x41')](_0x5b2e4c[_0x91da('0x4c')],function(_0x17e0d6){var _0x525ed5={};_0x525ed5[_0x17e0d6]={'$like':'%'+_0x5b9d68[_0x91da('0x48')][_0x91da('0x53')]+'%'};return _0x525ed5;})});}_0x5b2e4c=_[_0x91da('0x54')]({},_0x5b2e4c,_0x5b9d68[_0x91da('0x5c')]);return _0x5f39a4['getApplications'](_0x5b2e4c);}})['then'](function(_0x6bd17f){if(_0x6bd17f){_0x575209=_0x6bd17f[_0x91da('0x4d')];if(!_0x5b9d68[_0x91da('0x48')][_0x91da('0x4e')](_0x91da('0x6b'))){_0x5b2e4c[_0x91da('0x33')]=qs[_0x91da('0x33')](_0x5b9d68['query'][_0x91da('0x33')]);_0x5b2e4c[_0x91da('0x31')]=qs[_0x91da('0x31')](_0x5b9d68[_0x91da('0x48')][_0x91da('0x31')]);}return _0x5f39a4[_0x91da('0xaf')](_0x5b2e4c);}})['then'](function(_0x31090c){if(_0x31090c){return _0x31090c?{'count':_0x575209,'rows':_0x31090c}:null;}})[_0x91da('0x23')](respondWithResult(_0x541084,null))['catch'](handleError(_0x541084,null));};exports['getInteractions']=function(_0x413d67,_0x1b3733,_0x5167d6){var _0x476677={'raw':![],'where':{}};var _0x371a52={};var _0x3d83a7={'count':0x0,'rows':[]};return db[_0x91da('0x42')][_0x91da('0x6a')]({'where':{'id':_0x413d67[_0x91da('0x66')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x1b3733,null))['then'](function(_0x3001c2){if(_0x3001c2){_0x371a52[_0x91da('0x46')]=_[_0x91da('0x47')](db[_0x91da('0x8e')][_0x91da('0x43')]);_0x371a52[_0x91da('0x48')]=_[_0x91da('0x47')](_0x413d67[_0x91da('0x48')]);_0x371a52[_0x91da('0x49')]=_[_0x91da('0x4a')](_0x371a52[_0x91da('0x46')],_0x371a52[_0x91da('0x48')]);_0x476677[_0x91da('0x4c')]=_[_0x91da('0x4a')](_0x371a52['model'],qs[_0x91da('0x4b')](_0x413d67[_0x91da('0x48')][_0x91da('0x4b')]));_0x476677['attributes']=_0x476677[_0x91da('0x4c')][_0x91da('0x4d')]?_0x476677[_0x91da('0x4c')]:_0x371a52['model'];if(!_0x413d67['query'][_0x91da('0x4e')]('nolimit')){_0x476677[_0x91da('0x33')]=qs['limit'](_0x413d67['query'][_0x91da('0x33')]);_0x476677['offset']=qs[_0x91da('0x31')](_0x413d67[_0x91da('0x48')][_0x91da('0x31')]);}_0x476677[_0x91da('0x4f')]=qs[_0x91da('0x50')](_0x413d67['query'][_0x91da('0x50')]);_0x476677['where']=qs['filters'](_[_0x91da('0x52')](_0x413d67[_0x91da('0x48')],_0x371a52[_0x91da('0x49')]));_0x476677[_0x91da('0x51')][_0x91da('0x68')]=_0x3001c2['id'];if(_0x413d67[_0x91da('0x48')][_0x91da('0x53')]){_0x476677[_0x91da('0x51')]=_[_0x91da('0x54')](_0x476677['where'],{'$or':_[_0x91da('0x41')](_0x476677['attributes'],function(_0x5b74e0){var _0x13b07d={};_0x13b07d[_0x5b74e0]={'$like':'%'+_0x413d67[_0x91da('0x48')]['filter']+'%'};return _0x13b07d;})});}_0x476677=_[_0x91da('0x54')]({},_0x476677,_0x413d67[_0x91da('0x5c')]);return db[_0x91da('0x8e')]['count']({'where':_0x476677[_0x91da('0x51')]})[_0x91da('0x23')](function(_0x4fe82e){_0x3d83a7[_0x91da('0x34')]=_0x4fe82e;if(_0x413d67[_0x91da('0x48')][_0x91da('0x5b')]){_0x476677[_0x91da('0x55')]=[{'model':db[_0x91da('0x73')],'as':_0x91da('0xb0'),'required':![]},{'model':db[_0x91da('0x9a')],'as':'Owner','attributes':[_0x91da('0x3e'),_0x91da('0xb1'),_0x91da('0xb2')],'required':![]},{'model':db[_0x91da('0xb3')],'as':'Tags','attributes':['id','name','color'],'where':_0x413d67['query'][_0x91da('0xb4')]?{'id':_0x413d67['query'][_0x91da('0xb4')]}:undefined,'required':_0x413d67['query'][_0x91da('0xb4')]?!![]:![]}];}return db[_0x91da('0x8e')][_0x91da('0x56')](_0x476677);})['then'](function(_0x50a502){_0x3d83a7[_0x91da('0x57')]=_0x50a502;return _0x3d83a7;});}})[_0x91da('0x23')](respondWithFilteredResult(_0x1b3733,_0x476677))[_0x91da('0x2e')](handleError(_0x1b3733,null));};exports[_0x91da('0xb5')]=function(_0x41b872,_0xd8233d,_0x477538){return db[_0x91da('0x42')][_0x91da('0x5d')]({'where':{'id':_0x41b872['params']['id']}})['then'](handleEntityNotFound(_0xd8233d,null))['then'](function(_0x46d5f9){if(_0x46d5f9){return _0x46d5f9[_0x91da('0xb5')](_0x41b872[_0x91da('0x5f')]['ids'],_['omit'](_0x41b872[_0x91da('0x5f')],[_0x91da('0x6d'),'id'])||{})[_0x91da('0x91')](function(_0x59ee60){for(var _0x1eb8bd=0x0;_0x1eb8bd<_0x41b872[_0x91da('0x5f')][_0x91da('0x6d')][_0x91da('0x4d')];_0x1eb8bd+=0x1){socket[_0x91da('0xb6')](_0x91da('0xb7'),{'UserId':Number(_0x41b872['body'][_0x91da('0x6d')][_0x1eb8bd]),'OpenchannelAccountId':Number(_0x41b872[_0x91da('0x66')]['id'])});}return _0x59ee60;});}})[_0x91da('0x23')](respondWithResult(_0xd8233d,null))[_0x91da('0x2e')](handleError(_0xd8233d,null));};exports[_0x91da('0xb8')]=function(_0x30e69a,_0x9ffd50,_0x4f841f){return db[_0x91da('0x42')]['find']({'where':{'id':_0x30e69a[_0x91da('0x66')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x9ffd50,null))[_0x91da('0x23')](function(_0x4bbe04){if(_0x4bbe04){return _0x4bbe04[_0x91da('0xb8')](_0x30e69a[_0x91da('0x48')]['ids'])[_0x91da('0x23')](function(){if(_[_0x91da('0xb9')](_0x30e69a[_0x91da('0x48')][_0x91da('0x6d')])){for(var _0x4591c1=0x0;_0x4591c1<_0x30e69a['query'][_0x91da('0x6d')][_0x91da('0x4d')];_0x4591c1+=0x1){socket[_0x91da('0xb6')](_0x91da('0xba'),{'UserId':Number(_0x30e69a[_0x91da('0x48')][_0x91da('0x6d')][_0x4591c1]),'OpenchannelAccountId':Number(_0x30e69a['params']['id'])});}}else{socket[_0x91da('0xb6')](_0x91da('0xba'),{'UserId':Number(_0x30e69a[_0x91da('0x48')][_0x91da('0x6d')]),'OpenchannelAccountId':Number(_0x30e69a['params']['id'])});}});}})[_0x91da('0x23')](respondWithStatusCode(_0x9ffd50,null))[_0x91da('0x2e')](handleError(_0x9ffd50,null));};exports[_0x91da('0xbb')]=function(_0x53527f,_0x47b997,_0x303e3b){var _0x2b1129={};var _0x3377b9={};var _0xd1d720;var _0x40ab4e;return db['OpenchannelAccount'][_0x91da('0x6a')]({'where':{'id':_0x53527f[_0x91da('0x66')]['id']}})['then'](handleEntityNotFound(_0x47b997,null))[_0x91da('0x23')](function(_0x17d8f7){if(_0x17d8f7){_0xd1d720=_0x17d8f7;_0x3377b9[_0x91da('0x46')]=_[_0x91da('0x47')](db[_0x91da('0x9a')][_0x91da('0x43')]);_0x3377b9[_0x91da('0x48')]=_['keys'](_0x53527f['query']);_0x3377b9[_0x91da('0x49')]=_['intersection'](_0x3377b9[_0x91da('0x46')],_0x3377b9[_0x91da('0x48')]);_0x2b1129[_0x91da('0x4c')]=_[_0x91da('0x4a')](_0x3377b9[_0x91da('0x46')],qs[_0x91da('0x4b')](_0x53527f[_0x91da('0x48')][_0x91da('0x4b')]));_0x2b1129[_0x91da('0x4c')]=_0x2b1129[_0x91da('0x4c')][_0x91da('0x4d')]?_0x2b1129['attributes']:_0x3377b9[_0x91da('0x46')];_0x2b1129[_0x91da('0x4f')]=qs['sort'](_0x53527f[_0x91da('0x48')][_0x91da('0x50')]);_0x2b1129[_0x91da('0x51')]=qs[_0x91da('0x49')](_['pick'](_0x53527f[_0x91da('0x48')],_0x3377b9[_0x91da('0x49')]));if(_0x53527f[_0x91da('0x48')]['filter']){_0x2b1129[_0x91da('0x51')]=_['merge'](_0x2b1129[_0x91da('0x51')],{'$or':_[_0x91da('0x41')](_0x2b1129['attributes'],function(_0x2288fe){var _0x4aae2a={};_0x4aae2a[_0x2288fe]={'$like':'%'+_0x53527f[_0x91da('0x48')][_0x91da('0x53')]+'%'};return _0x4aae2a;})});}_0x2b1129=_['merge']({},_0x2b1129,_0x53527f[_0x91da('0x5c')]);return _0xd1d720[_0x91da('0xbb')](_0x2b1129);}})['then'](function(_0x3e6f55){if(_0x3e6f55){_0x40ab4e=_0x3e6f55[_0x91da('0x4d')];if(!_0x53527f['query'][_0x91da('0x4e')]('nolimit')){_0x2b1129[_0x91da('0x33')]=qs[_0x91da('0x33')](_0x53527f['query'][_0x91da('0x33')]);_0x2b1129[_0x91da('0x31')]=qs[_0x91da('0x31')](_0x53527f['query'][_0x91da('0x31')]);}return _0xd1d720['getAgents'](_0x2b1129);}})[_0x91da('0x23')](function(_0x461e35){if(_0x461e35){return _0x461e35?{'count':_0x40ab4e,'rows':_0x461e35}:null;}})['then'](respondWithResult(_0x47b997,null))['catch'](handleError(_0x47b997,null));};exports['send']=function(_0xf0afab,_0x1cdd94,_0x1e80c1){var _0x4a88fc,_0x9bde05,_0x2596c3;if(_[_0x91da('0x7a')](_0xf0afab[_0x91da('0x5f')][_0x91da('0x5f')])||_0xf0afab['body'][_0x91da('0x5f')]===''){throw new db[(_0x91da('0x7c'))][(_0x91da('0x74'))](_0x91da('0x7d'));}if(_[_0x91da('0x7a')](_0xf0afab[_0x91da('0x5f')]['to'])){}_0x4a88fc=_0xf0afab[_0x91da('0x5f')]['to'];return db[_0x91da('0x42')][_0x91da('0x6a')]({'where':{'id':_0xf0afab[_0x91da('0x66')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x1cdd94,null))['then'](function(_0x5c5f5e){if(_0x5c5f5e){return db['OpenchannelAccount']['find']({'where':{'id':_0x5c5f5e['id']},'include':[{'model':db['CmList'],'as':_0x91da('0x83'),'include':[{'model':db[_0x91da('0x73')],'as':_0x91da('0x84'),'where':{[_0x5c5f5e[_0x91da('0x7e')]]:_0x4a88fc},'limit':0x1,'order':[[_0x91da('0x77'),'DESC']]}]}]})[_0x91da('0x23')](handleEntityNotFound(_0x1cdd94,null))[_0x91da('0x23')](function(_0x654ff6){if(_0x654ff6&&_0x654ff6['List']){_0x9bde05=_0x654ff6[_0x91da('0x3b')]({'plain':!![]});if(_0x9bde05[_0x91da('0x83')]&&_0x9bde05['List'][_0x91da('0x84')][_0x91da('0x4d')]){return _0x9bde05[_0x91da('0x83')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0x91da('0x1c')](_0xf0afab[_0x91da('0x5f')],{'firstName':_0x4a88fc,[_0x654ff6[_0x91da('0x7e')]]:_0x4a88fc,'phone':_0x4a88fc,'ListId':_0x9bde05[_0x91da('0x79')]}));}})['then'](handleEntityNotFound(_0x1cdd94,null))[_0x91da('0x23')](function(_0x548a7c){if(_0x548a7c){_0x2596c3=_0x548a7c;return db['OpenchannelInteraction'][_0x91da('0x5d')]({'where':{'ContactId':_0x2596c3['id'],'closed':![],'OpenchannelAccountId':_0x9bde05['id']}})[_0x91da('0x23')](function(_0x28882a){if(_0x28882a){return[_0x28882a,![]];}return db[_0x91da('0x8e')][_0x91da('0x5e')]({'UserId':_0xf0afab['user']['id'],'ContactId':_0x2596c3['id'],'OpenchannelAccountId':_0x9bde05['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_[_0x91da('0x54')](_0xf0afab[_0x91da('0x5f')],{'read':![],'body':_0xf0afab['body'][_0x91da('0x5f')],'OpenchannelAccountId':_0x9bde05['id'],'UserId':_0xf0afab[_0x91da('0x60')]['id'],'ContactId':_0x2596c3['id']})]},{'include':[{'model':db[_0x91da('0x98')],'as':_0x91da('0xbc')}]})[_0x91da('0x23')](function(_0x398834){return[_0x398834,!![]];});});}})[_0x91da('0x91')](function(_0x2b7062,_0x31eac5){if(_0x31eac5){return _0x2b7062;}return db[_0x91da('0x98')][_0x91da('0x5e')](_[_0x91da('0x54')](_0xf0afab[_0x91da('0x5f')],{'read':![],'body':_0xf0afab[_0x91da('0x5f')][_0x91da('0x5f')],'OpenchannelAccountId':_0x9bde05['id'],'OpenchannelInteractionId':_0x2b7062['id'],'UserId':_0xf0afab[_0x91da('0x60')]['id'],'ContactId':_0x2596c3['id']}))[_0x91da('0x23')](function(_0x571654){_0x2b7062[_0x91da('0xbd')][_0x91da('0xbc')]=[];_0x2b7062['dataValues'][_0x91da('0xbc')]['push'](_0x571654[_0x91da('0xbd')]);return _0x2b7062;});});}})['then'](respondWithResult(_0x1cdd94,null))[_0x91da('0x2e')](handleError(_0x1cdd94,null));}; \ No newline at end of file +var _0x82f8=['message','info','result','catch','status','end','json','offset','undefined','limit','count','set','reject','save','destroy','get','UserProfileResource','sendStatus','name','send','index','Pause','map','OpenchannelAccount','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','sort','pick','where','merge','filter','options','includeAll','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getDispositions','findOne','Disposition','nolimit','order','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','hasOwnProperty','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','CmList','List','OpenchannelApplication','Applications','applications','list','orderBy','priority','asc','account','Contacts','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','autoclose','push','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82f8,0x157));var _0x882f=function(_0x2eb460,_0x54259c){_0x2eb460=_0x2eb460-0x0;var _0x38d7d6=_0x82f8[_0x2eb460];return _0x38d7d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x882f('0x0'));var zipdir=require(_0x882f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x882f('0x2'));var moment=require(_0x882f('0x3'));var BPromise=require(_0x882f('0x4'));var Mustache=require(_0x882f('0x5'));var util=require(_0x882f('0x6'));var path=require(_0x882f('0x7'));var sox=require(_0x882f('0x8'));var csv=require(_0x882f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x882f('0xa'));var squel=require(_0x882f('0xb'));var crypto=require(_0x882f('0xc'));var jsforce=require(_0x882f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x882f('0x9'));var querystring=require('querystring');var Papa=require(_0x882f('0xe'));var Redis=require('ioredis');var authService=require(_0x882f('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x882f('0x10'));var logger=require(_0x882f('0x11'))(_0x882f('0x12'));var utils=require(_0x882f('0x13'));var config=require(_0x882f('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x882f('0x15')]=_[_0x882f('0x16')](config[_0x882f('0x15')],{'host':_0x882f('0x17'),'port':0x18eb});var socket=require(_0x882f('0x18'))(new Redis(config[_0x882f('0x15')]));require(_0x882f('0x19'))['register'](socket);var jayson=require(_0x882f('0x1a'));var client=jayson[_0x882f('0x1b')][_0x882f('0x1c')]({'port':0x232c});var client9002=jayson[_0x882f('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ca189,_0x4e9b6e,_0x264da8,_0x187ce1){return new BPromise(function(_0x3357ef,_0x3c2afc){var _0x3f72c2=_0x187ce1||client;return _0x3f72c2[_0x882f('0x1d')](_0x4ca189,_0x264da8)[_0x882f('0x1e')](function(_0x67cc4b){logger['info'](_0x882f('0x1f'),_0x4e9b6e,'request\x20sent');logger['debug'](_0x882f('0x20'),_0x4e9b6e,_0x882f('0x21'),JSON[_0x882f('0x22')](_0x67cc4b));if(_0x67cc4b[_0x882f('0x23')]){if(_0x67cc4b['error'][_0x882f('0x24')]===0x1f4){logger[_0x882f('0x23')](_0x882f('0x1f'),_0x4e9b6e,_0x67cc4b[_0x882f('0x23')][_0x882f('0x25')]);return _0x3c2afc(_0x67cc4b[_0x882f('0x23')][_0x882f('0x25')]);}logger[_0x882f('0x23')](_0x882f('0x1f'),_0x4e9b6e,_0x67cc4b['error']['message']);return _0x3357ef(_0x67cc4b['error'][_0x882f('0x25')]);}else{logger[_0x882f('0x26')](_0x882f('0x1f'),_0x4e9b6e,_0x882f('0x21'));_0x3357ef(_0x67cc4b[_0x882f('0x27')][_0x882f('0x25')]);}})[_0x882f('0x28')](function(_0x2d6f58){logger[_0x882f('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x4e9b6e,_0x2d6f58);_0x3c2afc(_0x2d6f58);});});}function respondWithStatusCode(_0x42a827,_0x2a8605){_0x2a8605=_0x2a8605||0xcc;return function(_0x51d359){if(_0x51d359){return _0x42a827['sendStatus'](_0x2a8605);}return _0x42a827[_0x882f('0x29')](_0x2a8605)[_0x882f('0x2a')]();};}function respondWithResult(_0xd284e0,_0x4cf987){_0x4cf987=_0x4cf987||0xc8;return function(_0x2ae870){if(_0x2ae870){return _0xd284e0[_0x882f('0x29')](_0x4cf987)[_0x882f('0x2b')](_0x2ae870);}};}function respondWithFilteredResult(_0x29fc23,_0x58d4ce){return function(_0x41605c){if(_0x41605c){var _0x31d0b7=typeof _0x58d4ce[_0x882f('0x2c')]===_0x882f('0x2d')&&typeof _0x58d4ce[_0x882f('0x2e')]===_0x882f('0x2d');var _0x340e9b=_0x41605c[_0x882f('0x2f')];var _0x299f62=_0x31d0b7?0x0:_0x58d4ce[_0x882f('0x2c')];var _0x97706f=_0x31d0b7?_0x41605c[_0x882f('0x2f')]:_0x58d4ce[_0x882f('0x2c')]+_0x58d4ce['limit'];var _0x19c435;if(_0x97706f>=_0x340e9b){_0x97706f=_0x340e9b;_0x19c435=0xc8;}else{_0x19c435=0xce;}_0x29fc23['status'](_0x19c435);return _0x29fc23[_0x882f('0x30')]('Content-Range',_0x299f62+'-'+_0x97706f+'/'+_0x340e9b)['json'](_0x41605c);}return null;};}function patchUpdates(_0x20aa1c){return function(_0x425d28){try{jsonpatch['apply'](_0x425d28,_0x20aa1c,!![]);}catch(_0x206624){return BPromise[_0x882f('0x31')](_0x206624);}return _0x425d28[_0x882f('0x32')]();};}function saveUpdates(_0x394a37,_0x4910ab){return function(_0x19dded){if(_0x19dded){return _0x19dded['update'](_0x394a37)['then'](function(_0x5eba63){return _0x5eba63;});}return null;};}function removeEntity(_0x20f821,_0x55aec8){return function(_0x2080ac){if(_0x2080ac){return _0x2080ac[_0x882f('0x33')]()['then'](function(){var _0x5de26e=_0x2080ac[_0x882f('0x34')]({'plain':!![]});var _0x21a279='OpenchannelAccounts';return db[_0x882f('0x35')][_0x882f('0x33')]({'where':{'type':_0x21a279,'resourceId':_0x5de26e['id']}})[_0x882f('0x1e')](function(){return _0x2080ac;});})[_0x882f('0x1e')](function(){_0x20f821[_0x882f('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe86115,_0xab6c98){return function(_0x27303e){if(!_0x27303e){_0xe86115[_0x882f('0x36')](0x194);}return _0x27303e;};}function handleError(_0x34cba3,_0x587974){_0x587974=_0x587974||0x1f4;return function(_0x1a6210){logger[_0x882f('0x23')](_0x1a6210['stack']);if(_0x1a6210[_0x882f('0x37')]){delete _0x1a6210[_0x882f('0x37')];}_0x34cba3[_0x882f('0x29')](_0x587974)[_0x882f('0x38')](_0x1a6210);};}exports[_0x882f('0x39')]=function(_0x40a82f,_0x281e89){var _0x2f5514={'include':[{'model':db[_0x882f('0x3a')],'as':'mandatoryDispositionPause'}]},_0x5038c9={},_0xc5bd03={'count':0x0,'rows':[]};var _0x2a02f9=_[_0x882f('0x3b')](db[_0x882f('0x3c')]['rawAttributes'],function(_0xa8c4e3){return{'name':_0xa8c4e3[_0x882f('0x3d')],'type':_0xa8c4e3[_0x882f('0x3e')]['key']};});_0x5038c9['model']=_[_0x882f('0x3b')](_0x2a02f9,_0x882f('0x37'));_0x5038c9[_0x882f('0x3f')]=_[_0x882f('0x40')](_0x40a82f[_0x882f('0x3f')]);_0x5038c9[_0x882f('0x41')]=_[_0x882f('0x42')](_0x5038c9[_0x882f('0x43')],_0x5038c9[_0x882f('0x3f')]);_0x2f5514[_0x882f('0x44')]=_[_0x882f('0x42')](_0x5038c9['model'],qs[_0x882f('0x45')](_0x40a82f[_0x882f('0x3f')][_0x882f('0x45')]));_0x2f5514[_0x882f('0x44')]=_0x2f5514[_0x882f('0x44')][_0x882f('0x46')]?_0x2f5514[_0x882f('0x44')]:_0x5038c9[_0x882f('0x43')];if(!_0x40a82f[_0x882f('0x3f')]['hasOwnProperty']('nolimit')){_0x2f5514['limit']=qs[_0x882f('0x2e')](_0x40a82f['query']['limit']);_0x2f5514[_0x882f('0x2c')]=qs[_0x882f('0x2c')](_0x40a82f[_0x882f('0x3f')][_0x882f('0x2c')]);}_0x2f5514['order']=qs[_0x882f('0x47')](_0x40a82f[_0x882f('0x3f')][_0x882f('0x47')]);_0x2f5514['where']=qs[_0x882f('0x41')](_[_0x882f('0x48')](_0x40a82f[_0x882f('0x3f')],_0x5038c9[_0x882f('0x41')]),_0x2a02f9);if(_0x40a82f[_0x882f('0x3f')]['filter']){_0x2f5514[_0x882f('0x49')]=_[_0x882f('0x4a')](_0x2f5514['where'],{'$or':_[_0x882f('0x3b')](_0x2a02f9,function(_0xac7be3){if(_0xac7be3[_0x882f('0x3e')]!=='VIRTUAL'){var _0x88a481={};_0x88a481[_0xac7be3['name']]={'$like':'%'+_0x40a82f[_0x882f('0x3f')][_0x882f('0x4b')]+'%'};return _0x88a481;}})});}_0x2f5514=_[_0x882f('0x4a')]({},_0x2f5514,_0x40a82f[_0x882f('0x4c')]);var _0x3b2f7b={'where':_0x2f5514[_0x882f('0x49')]};return db[_0x882f('0x3c')][_0x882f('0x2f')](_0x3b2f7b)[_0x882f('0x1e')](function(_0x5329c5){_0xc5bd03[_0x882f('0x2f')]=_0x5329c5;if(_0x40a82f[_0x882f('0x3f')][_0x882f('0x4d')]){_0x2f5514['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0x882f('0x4e')](_0x2f5514);})[_0x882f('0x1e')](function(_0x3d2947){_0xc5bd03[_0x882f('0x4f')]=_0x3d2947;return _0xc5bd03;})[_0x882f('0x1e')](respondWithFilteredResult(_0x281e89,_0x2f5514))[_0x882f('0x28')](handleError(_0x281e89,null));};exports[_0x882f('0x50')]=function(_0x4c8106,_0x424a49){var _0x4ce2bc={'raw':![],'where':{'id':_0x4c8106[_0x882f('0x51')]['id']},'include':[{'model':db[_0x882f('0x3a')],'as':_0x882f('0x52')}]},_0x25368e={};_0x25368e[_0x882f('0x43')]=_[_0x882f('0x40')](db[_0x882f('0x3c')][_0x882f('0x53')]);_0x25368e[_0x882f('0x3f')]=_[_0x882f('0x40')](_0x4c8106[_0x882f('0x3f')]);_0x25368e[_0x882f('0x41')]=_[_0x882f('0x42')](_0x25368e[_0x882f('0x43')],_0x25368e[_0x882f('0x3f')]);_0x4ce2bc[_0x882f('0x44')]=_[_0x882f('0x42')](_0x25368e[_0x882f('0x43')],qs['fields'](_0x4c8106[_0x882f('0x3f')][_0x882f('0x45')]));_0x4ce2bc[_0x882f('0x44')]=_0x4ce2bc['attributes'][_0x882f('0x46')]?_0x4ce2bc['attributes']:_0x25368e[_0x882f('0x43')];if(_0x4c8106[_0x882f('0x3f')][_0x882f('0x4d')]){_0x4ce2bc[_0x882f('0x54')]=[{'all':!![]}];}_0x4ce2bc=_[_0x882f('0x4a')]({},_0x4ce2bc,_0x4c8106[_0x882f('0x4c')]);return db['OpenchannelAccount'][_0x882f('0x55')](_0x4ce2bc)[_0x882f('0x1e')](handleEntityNotFound(_0x424a49,null))[_0x882f('0x1e')](respondWithResult(_0x424a49,null))[_0x882f('0x28')](handleError(_0x424a49,null));};exports[_0x882f('0x56')]=function(_0x195918,_0x34ef3d){return db[_0x882f('0x3c')][_0x882f('0x56')](_0x195918[_0x882f('0x57')],{})[_0x882f('0x1e')](function(_0x5bc07e){var _0x219483=_0x195918[_0x882f('0x58')]['get']({'plain':!![]});if(!_0x219483)throw new Error(_0x882f('0x59'));if(_0x219483[_0x882f('0x5a')]==='user'){var _0xf17be9=_0x5bc07e['get']({'plain':!![]});var _0x5af318='OpenchannelAccounts';return db['UserProfileSection'][_0x882f('0x55')]({'where':{'name':_0x5af318,'userProfileId':_0x219483['userProfileId']},'raw':!![]})[_0x882f('0x1e')](function(_0x2cf962){if(_0x2cf962&&_0x2cf962[_0x882f('0x5b')]===0x0){return db['UserProfileResource']['create']({'name':_0xf17be9[_0x882f('0x37')],'resourceId':_0xf17be9['id'],'type':_0x2cf962[_0x882f('0x37')],'sectionId':_0x2cf962['id']},{})[_0x882f('0x1e')](function(){return _0x5bc07e;});}else{return _0x5bc07e;}})['catch'](function(_0x22ef2d){logger[_0x882f('0x23')](_0x882f('0x5c'),_0x22ef2d);throw _0x22ef2d;});}return _0x5bc07e;})[_0x882f('0x1e')](respondWithResult(_0x34ef3d,0xc9))[_0x882f('0x28')](handleError(_0x34ef3d,null));};exports[_0x882f('0x5d')]=function(_0x35095e,_0xf96814){if(_0x35095e[_0x882f('0x57')]['id']){delete _0x35095e['body']['id'];}return db[_0x882f('0x3c')][_0x882f('0x55')]({'where':{'id':_0x35095e['params']['id']},'include':[{'model':db['Pause'],'as':_0x882f('0x52')}]})[_0x882f('0x1e')](handleEntityNotFound(_0xf96814,null))[_0x882f('0x1e')](saveUpdates(_0x35095e[_0x882f('0x57')],null))[_0x882f('0x1e')](respondWithResult(_0xf96814,null))['catch'](handleError(_0xf96814,null));};exports[_0x882f('0x33')]=function(_0x235aad,_0x59f324){return db[_0x882f('0x3c')]['find']({'where':{'id':_0x235aad['params']['id']}})[_0x882f('0x1e')](handleEntityNotFound(_0x59f324,null))[_0x882f('0x1e')](removeEntity(_0x59f324,null))['catch'](handleError(_0x59f324,null));};exports[_0x882f('0x5e')]=function(_0x5a1d40,_0x584f78){return db[_0x882f('0x3c')][_0x882f('0x5e')]()[_0x882f('0x1e')](respondWithResult(_0x584f78,null))[_0x882f('0x28')](handleError(_0x584f78,null));};exports['addDisposition']=function(_0x4550ba,_0x259fb2,_0x1122c5){if(_0x4550ba[_0x882f('0x57')]['id']){delete _0x4550ba[_0x882f('0x57')]['id'];}return db[_0x882f('0x3c')]['find']({'where':{'id':_0x4550ba['params']['id']}})[_0x882f('0x1e')](handleEntityNotFound(_0x259fb2,null))['then'](function(_0x3aefd0){if(_0x3aefd0){_0x4550ba['body']['OpenchannelAccountId']=_0x3aefd0['id'];return db['Disposition'][_0x882f('0x56')](_0x4550ba[_0x882f('0x57')]);}})['then'](respondWithResult(_0x259fb2,null))[_0x882f('0x28')](handleError(_0x259fb2,null));};exports[_0x882f('0x5f')]=function(_0x3bb298,_0x48f535,_0x4fc877){var _0xabf5c4={'raw':![],'where':{}};var _0x417d0c={};var _0x2b6192={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x882f('0x60')]({'where':{'id':_0x3bb298[_0x882f('0x51')]['id']}})[_0x882f('0x1e')](handleEntityNotFound(_0x48f535,null))[_0x882f('0x1e')](function(_0x26bf1a){if(_0x26bf1a){_0x417d0c[_0x882f('0x43')]=_[_0x882f('0x40')](db[_0x882f('0x61')][_0x882f('0x53')]);_0x417d0c[_0x882f('0x3f')]=_[_0x882f('0x40')](_0x3bb298[_0x882f('0x3f')]);_0x417d0c['filters']=_[_0x882f('0x42')](_0x417d0c[_0x882f('0x43')],_0x417d0c[_0x882f('0x3f')]);_0xabf5c4['attributes']=_[_0x882f('0x42')](_0x417d0c[_0x882f('0x43')],qs[_0x882f('0x45')](_0x3bb298[_0x882f('0x3f')][_0x882f('0x45')]));_0xabf5c4[_0x882f('0x44')]=_0xabf5c4['attributes'][_0x882f('0x46')]?_0xabf5c4[_0x882f('0x44')]:_0x417d0c[_0x882f('0x43')];if(!_0x3bb298['query']['hasOwnProperty'](_0x882f('0x62'))){_0xabf5c4['limit']=qs[_0x882f('0x2e')](_0x3bb298['query']['limit']);_0xabf5c4['offset']=qs[_0x882f('0x2c')](_0x3bb298[_0x882f('0x3f')][_0x882f('0x2c')]);}_0xabf5c4[_0x882f('0x63')]=qs[_0x882f('0x47')](_0x3bb298[_0x882f('0x3f')][_0x882f('0x47')]);_0xabf5c4['where']=qs[_0x882f('0x41')](_[_0x882f('0x48')](_0x3bb298[_0x882f('0x3f')],_0x417d0c['filters']));_0xabf5c4[_0x882f('0x49')][_0x882f('0x64')]=_0x26bf1a['id'];if(_0x3bb298[_0x882f('0x3f')][_0x882f('0x4b')]){_0xabf5c4[_0x882f('0x49')]=_[_0x882f('0x4a')](_0xabf5c4[_0x882f('0x49')],{'$or':_[_0x882f('0x3b')](_0xabf5c4[_0x882f('0x44')],function(_0x47047a){var _0x1d994b={};_0x1d994b[_0x47047a]={'$like':'%'+_0x3bb298['query'][_0x882f('0x4b')]+'%'};return _0x1d994b;})});}_0xabf5c4=_[_0x882f('0x4a')]({},_0xabf5c4,_0x3bb298[_0x882f('0x4c')]);return db['Disposition'][_0x882f('0x2f')]({'where':_0xabf5c4[_0x882f('0x49')]})[_0x882f('0x1e')](function(_0xe0ff83){_0x2b6192['count']=_0xe0ff83;if(_0x3bb298[_0x882f('0x3f')]['includeAll']){_0xabf5c4[_0x882f('0x54')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0xabf5c4);})[_0x882f('0x1e')](function(_0x34a63b){_0x2b6192[_0x882f('0x4f')]=_0x34a63b;return _0x2b6192;});}})[_0x882f('0x1e')](respondWithFilteredResult(_0x48f535,_0xabf5c4))['catch'](handleError(_0x48f535,null));};exports[_0x882f('0x65')]=function(_0x31b39a,_0x5055a1,_0x3fbf78){return db[_0x882f('0x3c')][_0x882f('0x55')]({'where':{'id':_0x31b39a[_0x882f('0x51')]['id']}})[_0x882f('0x1e')](handleEntityNotFound(_0x5055a1,null))[_0x882f('0x1e')](function(_0x17a6e3){if(_0x17a6e3){return _0x17a6e3[_0x882f('0x65')](_0x31b39a[_0x882f('0x3f')][_0x882f('0x66')]);}})[_0x882f('0x1e')](respondWithStatusCode(_0x5055a1,null))[_0x882f('0x28')](handleError(_0x5055a1,null));};exports[_0x882f('0x67')]=function(_0x494f13,_0x429ab8,_0x306174){if(_0x494f13[_0x882f('0x57')]['id']){delete _0x494f13['body']['id'];}return db[_0x882f('0x3c')]['find']({'where':{'id':_0x494f13['params']['id']}})[_0x882f('0x1e')](handleEntityNotFound(_0x429ab8,null))[_0x882f('0x1e')](function(_0x59f02b){if(_0x59f02b){_0x494f13['body'][_0x882f('0x64')]=_0x59f02b['id'];return db['CannedAnswer']['create'](_0x494f13[_0x882f('0x57')]);}})[_0x882f('0x1e')](respondWithResult(_0x429ab8,null))['catch'](handleError(_0x429ab8,null));};exports['getAnswers']=function(_0x4a7efe,_0x68a7ff,_0x1e8e7b){var _0x434ca7={'raw':![],'where':{}};var _0x15ee21={};var _0x497e29={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x882f('0x60')]({'where':{'id':_0x4a7efe['params']['id']}})[_0x882f('0x1e')](handleEntityNotFound(_0x68a7ff,null))[_0x882f('0x1e')](function(_0x4b44ff){if(_0x4b44ff){_0x15ee21[_0x882f('0x43')]=_[_0x882f('0x40')](db[_0x882f('0x68')][_0x882f('0x53')]);_0x15ee21[_0x882f('0x3f')]=_[_0x882f('0x40')](_0x4a7efe[_0x882f('0x3f')]);_0x15ee21[_0x882f('0x41')]=_[_0x882f('0x42')](_0x15ee21['model'],_0x15ee21['query']);_0x434ca7[_0x882f('0x44')]=_[_0x882f('0x42')](_0x15ee21[_0x882f('0x43')],qs[_0x882f('0x45')](_0x4a7efe[_0x882f('0x3f')][_0x882f('0x45')]));_0x434ca7['attributes']=_0x434ca7[_0x882f('0x44')][_0x882f('0x46')]?_0x434ca7[_0x882f('0x44')]:_0x15ee21[_0x882f('0x43')];if(!_0x4a7efe[_0x882f('0x3f')][_0x882f('0x69')](_0x882f('0x62'))){_0x434ca7['limit']=qs['limit'](_0x4a7efe[_0x882f('0x3f')][_0x882f('0x2e')]);_0x434ca7['offset']=qs[_0x882f('0x2c')](_0x4a7efe['query'][_0x882f('0x2c')]);}_0x434ca7[_0x882f('0x63')]=qs[_0x882f('0x47')](_0x4a7efe[_0x882f('0x3f')][_0x882f('0x47')]);_0x434ca7[_0x882f('0x49')]=qs[_0x882f('0x41')](_['pick'](_0x4a7efe[_0x882f('0x3f')],_0x15ee21[_0x882f('0x41')]));_0x434ca7[_0x882f('0x49')][_0x882f('0x64')]=_0x4b44ff['id'];if(_0x4a7efe[_0x882f('0x3f')][_0x882f('0x4b')]){_0x434ca7[_0x882f('0x49')]=_['merge'](_0x434ca7[_0x882f('0x49')],{'$or':_[_0x882f('0x3b')](_0x434ca7[_0x882f('0x44')],function(_0x5f9b9e){var _0x76ec1={};_0x76ec1[_0x5f9b9e]={'$like':'%'+_0x4a7efe[_0x882f('0x3f')][_0x882f('0x4b')]+'%'};return _0x76ec1;})});}_0x434ca7=_['merge']({},_0x434ca7,_0x4a7efe['options']);return db['CannedAnswer'][_0x882f('0x2f')]({'where':_0x434ca7[_0x882f('0x49')]})['then'](function(_0x433418){_0x497e29[_0x882f('0x2f')]=_0x433418;if(_0x4a7efe[_0x882f('0x3f')][_0x882f('0x4d')]){_0x434ca7['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x882f('0x4e')](_0x434ca7);})[_0x882f('0x1e')](function(_0x201feb){_0x497e29[_0x882f('0x4f')]=_0x201feb;return _0x497e29;});}})[_0x882f('0x1e')](respondWithFilteredResult(_0x68a7ff,_0x434ca7))['catch'](handleError(_0x68a7ff,null));};exports['removeAnswers']=function(_0x504ab7,_0x263ca0,_0x33999f){return db['OpenchannelAccount'][_0x882f('0x55')]({'where':{'id':_0x504ab7['params']['id']}})[_0x882f('0x1e')](handleEntityNotFound(_0x263ca0,null))[_0x882f('0x1e')](function(_0x44af10){if(_0x44af10){return _0x44af10[_0x882f('0x6a')](_0x504ab7[_0x882f('0x3f')][_0x882f('0x66')]);}})[_0x882f('0x1e')](respondWithStatusCode(_0x263ca0,null))[_0x882f('0x28')](handleError(_0x263ca0,null));};exports[_0x882f('0x6b')]=function(_0x5cc7b9,_0x720815,_0x39a1c2){var _0x1e23c2={'body':_0x5cc7b9[_0x882f('0x57')],'channel':_0x882f('0x6c')};var _0x50130a=[];var _0x2aee38=[];var _0x330245={};var _0x51f81=![];return db[_0x882f('0x6d')][_0x882f('0x5e')]()['then'](function(_0x4c845b){if(!_0x4c845b){throw new db['Sequelize'][(_0x882f('0x6e'))](_0x882f('0x6f'));}_0x50130a=_[_0x882f('0x70')](_['keys'](_0x4c845b),[_0x882f('0x71'),_0x882f('0x72')]);_0x2aee38=_['difference'](_['keys'](_0x4c845b),[_0x882f('0x71'),_0x882f('0x72'),_0x882f('0x73'),_0x882f('0x74')]);if(_0x5cc7b9[_0x882f('0x57')]['id']){delete _0x5cc7b9['body']['id'];}if(_['isNil'](_0x5cc7b9[_0x882f('0x57')]['from'])){throw new db[(_0x882f('0x75'))][(_0x882f('0x6e'))](_0x882f('0x76'));}if(_[_0x882f('0x77')](_0x5cc7b9[_0x882f('0x57')]['body'])||_0x5cc7b9[_0x882f('0x57')][_0x882f('0x57')]===''){throw new db[(_0x882f('0x75'))][(_0x882f('0x6e'))](_0x882f('0x78'));}if(_['isNil'](_0x5cc7b9[_0x882f('0x57')]['mapKey'])){throw new db['Sequelize'][(_0x882f('0x6e'))](_0x882f('0x79')+_0x2aee38);}if(!_[_0x882f('0x7a')](_0x2aee38,_0x5cc7b9[_0x882f('0x57')]['mapKey'])){throw new db[(_0x882f('0x75'))][(_0x882f('0x6e'))](_0x882f('0x7b')+_0x2aee38);}_0x330245[_0x5cc7b9[_0x882f('0x57')][_0x882f('0x7c')]]=_0x5cc7b9[_0x882f('0x57')][_0x882f('0x7d')];})[_0x882f('0x1e')](function(){return db['OpenchannelAccount'][_0x882f('0x55')]({'where':{'id':_0x5cc7b9[_0x882f('0x51')]['id']},'include':[{'model':db[_0x882f('0x7e')],'as':_0x882f('0x7f'),'include':[{'model':db[_0x882f('0x6d')],'as':'Contacts','where':_0x330245,'limit':0x1,'order':[[_0x882f('0x72'),'DESC']]}]},{'model':db[_0x882f('0x80')],'as':_0x882f('0x81')}]});})[_0x882f('0x1e')](handleEntityNotFound(_0x720815,null))[_0x882f('0x1e')](function(_0x2fd3dc){if(_0x2fd3dc&&_0x2fd3dc[_0x882f('0x7f')]){_0x1e23c2['account']=_0x2fd3dc;_0x1e23c2[_0x882f('0x82')]=_0x2fd3dc[_0x882f('0x81')];_0x1e23c2[_0x882f('0x83')]=_0x2fd3dc[_0x882f('0x7f')];_0x1e23c2['applications']=_[_0x882f('0x84')](_0x1e23c2[_0x882f('0x82')],[_0x882f('0x85')],[_0x882f('0x86')]);if(_0x1e23c2['account'][_0x882f('0x81')]){delete _0x1e23c2[_0x882f('0x87')][_0x882f('0x81')];}if(_0x1e23c2[_0x882f('0x87')][_0x882f('0x7f')]&&_0x1e23c2['account'][_0x882f('0x7f')][_0x882f('0x88')][_0x882f('0x46')]){return _0x1e23c2[_0x882f('0x87')][_0x882f('0x7f')][_0x882f('0x88')][0x0];}var _0x1c8743=_[_0x882f('0x16')](_0x5cc7b9[_0x882f('0x57')],{'firstName':_0x5cc7b9[_0x882f('0x57')][_0x882f('0x7d')],'ListId':_0x2fd3dc['ListId']});_0x1c8743[_0x5cc7b9[_0x882f('0x57')][_0x882f('0x7c')]]=_0x5cc7b9['body'][_0x882f('0x7d')];return db[_0x882f('0x6d')][_0x882f('0x56')](_0x1c8743,{'fields':_0x50130a,'raw':!![]});}})[_0x882f('0x1e')](handleEntityNotFound(_0x720815,null))['then'](function(_0x5bd832){_0x1e23c2[_0x882f('0x89')]=_0x5bd832;if(_0x5bd832){var _0x4f0054={'ContactId':_0x5bd832['id'],'OpenchannelAccountId':_0x5cc7b9[_0x882f('0x51')]['id'],'from':(_0x5bd832['firstName']||'')+'\x20'+(_0x5bd832[_0x882f('0x8a')]||'')};var _0x481e59={'OpenchannelAccountId':_0x5cc7b9[_0x882f('0x51')]['id'],'closed':![]};if(_0x5cc7b9[_0x882f('0x57')][_0x882f('0x8b')]){_0x481e59['threadId']=_0x5cc7b9[_0x882f('0x57')][_0x882f('0x8b')];return db[_0x882f('0x8c')][_0x882f('0x55')]({'where':_0x481e59})[_0x882f('0x1e')](function(_0x1df88a){if(_0x1df88a){return[_0x1df88a,![]];}_0x4f0054['threadId']=_0x5cc7b9[_0x882f('0x57')]['threadId'];_0x4f0054[_0x882f('0x8d')]=_0x5cc7b9[_0x882f('0x57')]['externalUrl'];return db['OpenchannelInteraction']['create'](_0x4f0054)[_0x882f('0x1e')](function(_0x5b9fc6){return[_0x5b9fc6,!![]];});});}else{_0x481e59[_0x882f('0x8b')]=null;}_0x481e59[_0x882f('0x8e')]=_0x5bd832['id'];return db['OpenchannelInteraction'][_0x882f('0x55')]({'where':_0x481e59})['then'](function(_0x551753){if(_0x551753){return[_0x551753,![]];}return db['OpenchannelInteraction']['create'](_0x4f0054)[_0x882f('0x1e')](function(_0xf7d36){return[_0xf7d36,!![]];});});}})[_0x882f('0x8f')](function(_0x47c1be,_0x4281cd){if(_0x47c1be){_0x51f81=_0x4281cd;if(!_0x4281cd){var _0x47f49f={'from':(_0x1e23c2[_0x882f('0x89')][_0x882f('0x90')]||'')+'\x20'+(_0x1e23c2['contact'][_0x882f('0x8a')]||'')};if(_0x5cc7b9[_0x882f('0x57')]['threadId']&&_0x5cc7b9[_0x882f('0x57')][_0x882f('0x91')]&&_0x5cc7b9['body'][_0x882f('0x8b')]!=_0x5cc7b9[_0x882f('0x57')][_0x882f('0x91')]){_0x47f49f[_0x882f('0x8b')]=_0x5cc7b9[_0x882f('0x57')][_0x882f('0x91')];}return _0x47c1be[_0x882f('0x5d')](_0x47f49f);}else{return _0x47c1be;}}})[_0x882f('0x1e')](function(_0x4f3b97){_0x1e23c2[_0x882f('0x92')]=_0x4f3b97['get']({'plain':!![]});_0x1e23c2['interaction'][_0x882f('0x93')]=_0x51f81;if(_0x1e23c2[_0x882f('0x92')][_0x882f('0x93')]){if(_0x1e23c2[_0x882f('0x87')][_0x882f('0x94')]){_0x1e23c2[_0x882f('0x82')][_0x882f('0x95')]({'id':0x0,'priority':_0x1e23c2[_0x882f('0x82')][_0x882f('0x46')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x882f('0x96')});}}return db[_0x882f('0x97')][_0x882f('0x56')]({'body':_0x5cc7b9[_0x882f('0x57')][_0x882f('0x57')],'OpenchannelAccountId':_0x5cc7b9[_0x882f('0x51')]['id'],'OpenchannelInteractionId':_0x4f3b97['id'],'direction':'in','ContactId':_0x1e23c2[_0x882f('0x89')]['id'],'AttachmentId':_0x5cc7b9[_0x882f('0x57')][_0x882f('0x98')]});})[_0x882f('0x1e')](function(_0xde4c72){_0x1e23c2[_0x882f('0x25')]=_0xde4c72;if(!_0x1e23c2[_0x882f('0x92')][_0x882f('0x99')])return;return db[_0x882f('0x9a')][_0x882f('0x55')]({'attributes':['id','name'],'where':{'id':_0x1e23c2[_0x882f('0x92')][_0x882f('0x99')]}});})['then'](function(_0x15d926){if(_0x15d926){_0x1e23c2[_0x882f('0x82')][_0x882f('0x9b')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x15d926[_0x882f('0x37')]+','+(_0x1e23c2[_0x882f('0x87')][_0x882f('0x9c')]||0xa),'interval':_0x882f('0x96')});}if(!_0x1e23c2[_0x882f('0x92')][_0x882f('0x9d')])return;return db['OpenchannelQueue'][_0x882f('0x55')]({'attributes':['id',_0x882f('0x37')],'where':{'id':_0x1e23c2[_0x882f('0x92')][_0x882f('0x9d')]}});})['then'](function(_0xc95d04){if(_0xc95d04){_0x1e23c2['applications'][_0x882f('0x9b')]({'id':0x0,'priority':0x1,'app':_0x882f('0x9e'),'appdata':_0xc95d04[_0x882f('0x37')]+','+(_0x1e23c2[_0x882f('0x87')][_0x882f('0x9f')]||0x12c),'interval':_0x882f('0x96')});}return respondWithRpcPromise(_0x882f('0xa0'),'startRouting',_0x1e23c2);})[_0x882f('0x1e')](function(_0x23f7cb){respondWithRpcPromise('EventManager',_0x882f('0xa1'),{'event':_0x882f('0x6b'),'message':_0x23f7cb},client9002);return _0x23f7cb;})[_0x882f('0x1e')](respondWithResult(_0x720815,null))[_0x882f('0x28')](handleError(_0x720815,null));};exports[_0x882f('0xa2')]=function(_0x2a84bd,_0xb1e968){var _0x10e6c1=_0x2a84bd[_0x882f('0x51')]['id'];var _0x22e98b=_0x2a84bd['body'];var _0x17cf80=0xc8;var _0x2cac3d=null;return db[_0x882f('0xa3')]['transaction']({'isolationLevel':db[_0x882f('0xa3')][_0x882f('0xa4')][_0x882f('0xa5')]['READ_COMMITTED']},function(_0x202392){return db[_0x882f('0x3c')][_0x882f('0x60')]({'where':{'id':_0x10e6c1},'transaction':_0x202392})[_0x882f('0x1e')](function(_0x368d27){if(_0x368d27){return db['OpenchannelApplication'][_0x882f('0x33')]({'where':{'OpenchannelAccountId':_0x10e6c1},'transaction':_0x202392})[_0x882f('0x1e')](function(){var _0x503664=_[_0x882f('0x3b')](_0x22e98b,function(_0x1db800){_0x1db800[_0x882f('0x64')]=_0x10e6c1;return _0x1db800;});return db[_0x882f('0x80')][_0x882f('0xa6')](_0x503664,{'transaction':_0x202392});});}else{_0x17cf80=0x194;_0x2cac3d=[];}});})['then'](function(){if(_0x17cf80!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x10e6c1},'order':'priority'})[_0x882f('0x1e')](function(_0x5f4c85){_0x2cac3d=_0x5f4c85;});}})[_0x882f('0x28')](function(_0x338311){_0x17cf80=0x1f4;logger[_0x882f('0x23')](_0x338311[_0x882f('0xa7')]);if(_0x338311[_0x882f('0x37')]){delete _0x338311[_0x882f('0x37')];}_0x2cac3d=_0x338311;})[_0x882f('0xa8')](function(){if(_0x2cac3d===null){_0xb1e968['sendStatus'](_0x17cf80);}else{if(_0x17cf80===0x1f4){_0xb1e968[_0x882f('0x29')](_0x17cf80)[_0x882f('0x38')](_0x2cac3d);}else{_0xb1e968[_0x882f('0x29')](_0x17cf80)[_0x882f('0x2b')](_0x2cac3d);}}});};exports['getApplications']=function(_0x9d363c,_0x3a510a,_0x370b96){var _0x447989={};var _0x114277={};var _0x3c95d8;var _0x38620c;return db[_0x882f('0x3c')]['findOne']({'where':{'id':_0x9d363c[_0x882f('0x51')]['id']}})[_0x882f('0x1e')](handleEntityNotFound(_0x3a510a,null))[_0x882f('0x1e')](function(_0xe97864){if(_0xe97864){_0x3c95d8=_0xe97864;_0x114277[_0x882f('0x43')]=_[_0x882f('0x40')](db[_0x882f('0x80')]['rawAttributes']);_0x114277[_0x882f('0x3f')]=_[_0x882f('0x40')](_0x9d363c[_0x882f('0x3f')]);_0x114277['filters']=_[_0x882f('0x42')](_0x114277[_0x882f('0x43')],_0x114277[_0x882f('0x3f')]);_0x447989[_0x882f('0x44')]=_[_0x882f('0x42')](_0x114277[_0x882f('0x43')],qs['fields'](_0x9d363c[_0x882f('0x3f')][_0x882f('0x45')]));_0x447989[_0x882f('0x44')]=_0x447989[_0x882f('0x44')]['length']?_0x447989[_0x882f('0x44')]:_0x114277['model'];_0x447989[_0x882f('0x63')]=qs[_0x882f('0x47')](_0x9d363c[_0x882f('0x3f')]['sort']);_0x447989[_0x882f('0x49')]=qs[_0x882f('0x41')](_[_0x882f('0x48')](_0x9d363c[_0x882f('0x3f')],_0x114277[_0x882f('0x41')]));if(_0x9d363c['query']['filter']){_0x447989['where']=_[_0x882f('0x4a')](_0x447989[_0x882f('0x49')],{'$or':_[_0x882f('0x3b')](_0x447989[_0x882f('0x44')],function(_0x6ea58f){var _0x4397c7={};_0x4397c7[_0x6ea58f]={'$like':'%'+_0x9d363c[_0x882f('0x3f')]['filter']+'%'};return _0x4397c7;})});}_0x447989=_['merge']({},_0x447989,_0x9d363c['options']);return _0x3c95d8[_0x882f('0xa9')](_0x447989);}})[_0x882f('0x1e')](function(_0x40d4da){if(_0x40d4da){_0x38620c=_0x40d4da['length'];if(!_0x9d363c['query'][_0x882f('0x69')]('nolimit')){_0x447989[_0x882f('0x2e')]=qs[_0x882f('0x2e')](_0x9d363c[_0x882f('0x3f')][_0x882f('0x2e')]);_0x447989[_0x882f('0x2c')]=qs['offset'](_0x9d363c['query'][_0x882f('0x2c')]);}return _0x3c95d8['getApplications'](_0x447989);}})[_0x882f('0x1e')](function(_0x14b089){if(_0x14b089){return _0x14b089?{'count':_0x38620c,'rows':_0x14b089}:null;}})[_0x882f('0x1e')](respondWithResult(_0x3a510a,null))[_0x882f('0x28')](handleError(_0x3a510a,null));};exports[_0x882f('0xaa')]=function(_0x337e5e,_0x4e1758,_0x17304f){var _0x3c695c={'raw':![],'where':{}};var _0x1f2928={};var _0x2225f3={'count':0x0,'rows':[]};return db[_0x882f('0x3c')][_0x882f('0x60')]({'where':{'id':_0x337e5e[_0x882f('0x51')]['id']}})['then'](handleEntityNotFound(_0x4e1758,null))[_0x882f('0x1e')](function(_0x2abc94){if(_0x2abc94){_0x1f2928[_0x882f('0x43')]=_[_0x882f('0x40')](db[_0x882f('0x8c')][_0x882f('0x53')]);_0x1f2928[_0x882f('0x3f')]=_[_0x882f('0x40')](_0x337e5e[_0x882f('0x3f')]);_0x1f2928[_0x882f('0x41')]=_[_0x882f('0x42')](_0x1f2928[_0x882f('0x43')],_0x1f2928[_0x882f('0x3f')]);_0x3c695c['attributes']=_['intersection'](_0x1f2928[_0x882f('0x43')],qs[_0x882f('0x45')](_0x337e5e[_0x882f('0x3f')][_0x882f('0x45')]));_0x3c695c['attributes']=_0x3c695c[_0x882f('0x44')][_0x882f('0x46')]?_0x3c695c[_0x882f('0x44')]:_0x1f2928['model'];if(!_0x337e5e['query'][_0x882f('0x69')]('nolimit')){_0x3c695c['limit']=qs[_0x882f('0x2e')](_0x337e5e[_0x882f('0x3f')][_0x882f('0x2e')]);_0x3c695c[_0x882f('0x2c')]=qs[_0x882f('0x2c')](_0x337e5e[_0x882f('0x3f')]['offset']);}_0x3c695c[_0x882f('0x63')]=qs[_0x882f('0x47')](_0x337e5e[_0x882f('0x3f')][_0x882f('0x47')]);_0x3c695c[_0x882f('0x49')]=qs[_0x882f('0x41')](_[_0x882f('0x48')](_0x337e5e[_0x882f('0x3f')],_0x1f2928['filters']));_0x3c695c[_0x882f('0x49')][_0x882f('0x64')]=_0x2abc94['id'];if(_0x337e5e[_0x882f('0x3f')][_0x882f('0x4b')]){_0x3c695c[_0x882f('0x49')]=_[_0x882f('0x4a')](_0x3c695c[_0x882f('0x49')],{'$or':_[_0x882f('0x3b')](_0x3c695c[_0x882f('0x44')],function(_0xce2311){var _0x9b6c59={};_0x9b6c59[_0xce2311]={'$like':'%'+_0x337e5e['query']['filter']+'%'};return _0x9b6c59;})});}_0x3c695c=_[_0x882f('0x4a')]({},_0x3c695c,_0x337e5e[_0x882f('0x4c')]);return db[_0x882f('0x8c')][_0x882f('0x2f')]({'where':_0x3c695c['where']})['then'](function(_0x4397f5){_0x2225f3['count']=_0x4397f5;if(_0x337e5e[_0x882f('0x3f')][_0x882f('0x4d')]){_0x3c695c['include']=[{'model':db[_0x882f('0x6d')],'as':_0x882f('0xab'),'required':![]},{'model':db['User'],'as':_0x882f('0xac'),'attributes':[_0x882f('0x37'),_0x882f('0xad'),_0x882f('0xae')],'required':![]},{'model':db[_0x882f('0xaf')],'as':_0x882f('0xb0'),'attributes':['id',_0x882f('0x37'),_0x882f('0xb1')],'where':_0x337e5e[_0x882f('0x3f')][_0x882f('0xb2')]?{'id':_0x337e5e['query']['tag']}:undefined,'required':_0x337e5e[_0x882f('0x3f')][_0x882f('0xb2')]?!![]:![]}];}return db[_0x882f('0x8c')][_0x882f('0x4e')](_0x3c695c);})[_0x882f('0x1e')](function(_0x42cc15){_0x2225f3[_0x882f('0x4f')]=_0x42cc15;return _0x2225f3;});}})[_0x882f('0x1e')](respondWithFilteredResult(_0x4e1758,_0x3c695c))[_0x882f('0x28')](handleError(_0x4e1758,null));};exports[_0x882f('0xb3')]=function(_0x205c2e,_0x5ab187,_0x392d5f){return db[_0x882f('0x3c')][_0x882f('0x55')]({'where':{'id':_0x205c2e[_0x882f('0x51')]['id']}})[_0x882f('0x1e')](handleEntityNotFound(_0x5ab187,null))['then'](function(_0x33a4d2){if(_0x33a4d2){return _0x33a4d2['addAgents'](_0x205c2e[_0x882f('0x57')][_0x882f('0x66')],_[_0x882f('0xb4')](_0x205c2e['body'],[_0x882f('0x66'),'id'])||{})[_0x882f('0x8f')](function(_0x3df7ea){for(var _0x1c27a5=0x0;_0x1c27a5<_0x205c2e['body'][_0x882f('0x66')][_0x882f('0x46')];_0x1c27a5+=0x1){socket[_0x882f('0xb5')](_0x882f('0xb6'),{'UserId':Number(_0x205c2e[_0x882f('0x57')][_0x882f('0x66')][_0x1c27a5]),'OpenchannelAccountId':Number(_0x205c2e[_0x882f('0x51')]['id'])});}return _0x3df7ea;});}})[_0x882f('0x1e')](respondWithResult(_0x5ab187,null))[_0x882f('0x28')](handleError(_0x5ab187,null));};exports[_0x882f('0xb7')]=function(_0x4944f0,_0x52962e,_0x1b4a6f){return db[_0x882f('0x3c')]['find']({'where':{'id':_0x4944f0[_0x882f('0x51')]['id']}})[_0x882f('0x1e')](handleEntityNotFound(_0x52962e,null))[_0x882f('0x1e')](function(_0x14fbb0){if(_0x14fbb0){return _0x14fbb0[_0x882f('0xb7')](_0x4944f0[_0x882f('0x3f')]['ids'])[_0x882f('0x1e')](function(){if(_['isArray'](_0x4944f0[_0x882f('0x3f')]['ids'])){for(var _0x141a94=0x0;_0x141a94<_0x4944f0[_0x882f('0x3f')][_0x882f('0x66')][_0x882f('0x46')];_0x141a94+=0x1){socket[_0x882f('0xb5')](_0x882f('0xb8'),{'UserId':Number(_0x4944f0[_0x882f('0x3f')][_0x882f('0x66')][_0x141a94]),'OpenchannelAccountId':Number(_0x4944f0[_0x882f('0x51')]['id'])});}}else{socket[_0x882f('0xb5')](_0x882f('0xb8'),{'UserId':Number(_0x4944f0[_0x882f('0x3f')]['ids']),'OpenchannelAccountId':Number(_0x4944f0['params']['id'])});}});}})[_0x882f('0x1e')](respondWithStatusCode(_0x52962e,null))[_0x882f('0x28')](handleError(_0x52962e,null));};exports[_0x882f('0xb9')]=function(_0x49e84f,_0x4f1862,_0x44cd0e){var _0x2c80d2={};var _0x4f69af={};var _0x3a2765;var _0x71b3cd;return db[_0x882f('0x3c')][_0x882f('0x60')]({'where':{'id':_0x49e84f['params']['id']}})[_0x882f('0x1e')](handleEntityNotFound(_0x4f1862,null))['then'](function(_0x257745){if(_0x257745){_0x3a2765=_0x257745;_0x4f69af[_0x882f('0x43')]=_[_0x882f('0x40')](db[_0x882f('0x9a')][_0x882f('0x53')]);_0x4f69af['query']=_[_0x882f('0x40')](_0x49e84f[_0x882f('0x3f')]);_0x4f69af[_0x882f('0x41')]=_['intersection'](_0x4f69af[_0x882f('0x43')],_0x4f69af[_0x882f('0x3f')]);_0x2c80d2[_0x882f('0x44')]=_['intersection'](_0x4f69af[_0x882f('0x43')],qs['fields'](_0x49e84f[_0x882f('0x3f')][_0x882f('0x45')]));_0x2c80d2[_0x882f('0x44')]=_0x2c80d2[_0x882f('0x44')][_0x882f('0x46')]?_0x2c80d2[_0x882f('0x44')]:_0x4f69af[_0x882f('0x43')];_0x2c80d2[_0x882f('0x63')]=qs[_0x882f('0x47')](_0x49e84f[_0x882f('0x3f')][_0x882f('0x47')]);_0x2c80d2[_0x882f('0x49')]=qs[_0x882f('0x41')](_[_0x882f('0x48')](_0x49e84f[_0x882f('0x3f')],_0x4f69af[_0x882f('0x41')]));if(_0x49e84f[_0x882f('0x3f')][_0x882f('0x4b')]){_0x2c80d2[_0x882f('0x49')]=_[_0x882f('0x4a')](_0x2c80d2['where'],{'$or':_[_0x882f('0x3b')](_0x2c80d2['attributes'],function(_0x2074de){var _0x5ac169={};_0x5ac169[_0x2074de]={'$like':'%'+_0x49e84f[_0x882f('0x3f')][_0x882f('0x4b')]+'%'};return _0x5ac169;})});}_0x2c80d2=_[_0x882f('0x4a')]({},_0x2c80d2,_0x49e84f[_0x882f('0x4c')]);return _0x3a2765['getAgents'](_0x2c80d2);}})[_0x882f('0x1e')](function(_0x8de575){if(_0x8de575){_0x71b3cd=_0x8de575[_0x882f('0x46')];if(!_0x49e84f['query'][_0x882f('0x69')](_0x882f('0x62'))){_0x2c80d2[_0x882f('0x2e')]=qs['limit'](_0x49e84f['query'][_0x882f('0x2e')]);_0x2c80d2[_0x882f('0x2c')]=qs[_0x882f('0x2c')](_0x49e84f[_0x882f('0x3f')][_0x882f('0x2c')]);}return _0x3a2765[_0x882f('0xb9')](_0x2c80d2);}})[_0x882f('0x1e')](function(_0x21d7e4){if(_0x21d7e4){return _0x21d7e4?{'count':_0x71b3cd,'rows':_0x21d7e4}:null;}})[_0x882f('0x1e')](respondWithResult(_0x4f1862,null))[_0x882f('0x28')](handleError(_0x4f1862,null));};exports['send']=function(_0x53e935,_0x4f63bb,_0x2c8a6e){var _0x336a52,_0x54982c,_0x4929de;if(_[_0x882f('0x77')](_0x53e935[_0x882f('0x57')][_0x882f('0x57')])||_0x53e935['body'][_0x882f('0x57')]===''){throw new db['Sequelize'][(_0x882f('0x6e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x882f('0x77')](_0x53e935[_0x882f('0x57')]['to'])){}_0x336a52=_0x53e935[_0x882f('0x57')]['to'];return db['OpenchannelAccount'][_0x882f('0x60')]({'where':{'id':_0x53e935[_0x882f('0x51')]['id']}})[_0x882f('0x1e')](handleEntityNotFound(_0x4f63bb,null))[_0x882f('0x1e')](function(_0x33e2c3){if(_0x33e2c3){return db[_0x882f('0x3c')][_0x882f('0x55')]({'where':{'id':_0x33e2c3['id']},'include':[{'model':db['CmList'],'as':_0x882f('0x7f'),'include':[{'model':db['CmContact'],'as':_0x882f('0x88'),'where':{[_0x33e2c3[_0x882f('0x7c')]]:_0x336a52},'limit':0x1,'order':[[_0x882f('0x72'),_0x882f('0xba')]]}]}]})['then'](handleEntityNotFound(_0x4f63bb,null))[_0x882f('0x1e')](function(_0x3ac833){if(_0x3ac833&&_0x3ac833[_0x882f('0x7f')]){_0x54982c=_0x3ac833[_0x882f('0x34')]({'plain':!![]});if(_0x54982c['List']&&_0x54982c[_0x882f('0x7f')]['Contacts'][_0x882f('0x46')]){return _0x54982c[_0x882f('0x7f')]['Contacts'][0x0];}return db[_0x882f('0x6d')][_0x882f('0x56')](_[_0x882f('0x16')](_0x53e935[_0x882f('0x57')],{'firstName':_0x336a52,[_0x3ac833[_0x882f('0x7c')]]:_0x336a52,'phone':_0x336a52,'ListId':_0x54982c[_0x882f('0x74')]}));}})[_0x882f('0x1e')](handleEntityNotFound(_0x4f63bb,null))['then'](function(_0x33c81){if(_0x33c81){_0x4929de=_0x33c81;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x4929de['id'],'closed':![],'OpenchannelAccountId':_0x54982c['id']}})[_0x882f('0x1e')](function(_0x5b96df){if(_0x5b96df){return[_0x5b96df,![]];}return db[_0x882f('0x8c')][_0x882f('0x56')]({'UserId':_0x53e935[_0x882f('0x58')]['id'],'ContactId':_0x4929de['id'],'OpenchannelAccountId':_0x54982c['id'],'lastMsgDirection':'out','firstMsgDirection':_0x882f('0xbb'),'Messages':[_['merge'](_0x53e935[_0x882f('0x57')],{'read':![],'body':_0x53e935['body'][_0x882f('0x57')],'OpenchannelAccountId':_0x54982c['id'],'UserId':_0x53e935[_0x882f('0x58')]['id'],'ContactId':_0x4929de['id']})]},{'include':[{'model':db[_0x882f('0x97')],'as':_0x882f('0xbc')}]})[_0x882f('0x1e')](function(_0x4142f4){return[_0x4142f4,!![]];});});}})['spread'](function(_0x412cfc,_0x38fbcd){if(_0x38fbcd){return _0x412cfc;}return db['OpenchannelMessage'][_0x882f('0x56')](_[_0x882f('0x4a')](_0x53e935[_0x882f('0x57')],{'read':![],'body':_0x53e935[_0x882f('0x57')][_0x882f('0x57')],'OpenchannelAccountId':_0x54982c['id'],'OpenchannelInteractionId':_0x412cfc['id'],'UserId':_0x53e935[_0x882f('0x58')]['id'],'ContactId':_0x4929de['id']}))[_0x882f('0x1e')](function(_0x2bf936){_0x412cfc[_0x882f('0xbd')]['Messages']=[];_0x412cfc[_0x882f('0xbd')]['Messages']['push'](_0x2bf936[_0x882f('0xbd')]);return _0x412cfc;});});}})['then'](respondWithResult(_0x4f63bb,null))[_0x882f('0x28')](handleError(_0x4f63bb,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 64f09bd..4d20dfa 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 _0x9348=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x1df1b5,_0xaf02e4){var _0x459a04=function(_0x1168a7){while(--_0x1168a7){_0x1df1b5['push'](_0x1df1b5['shift']());}};_0x459a04(++_0xaf02e4);}(_0x9348,0x10d));var _0x8934=function(_0x1d1a63,_0x1b1773){_0x1d1a63=_0x1d1a63-0x0;var _0x2be668=_0x9348[_0x1d1a63];return _0x2be668;};'use strict';var EventEmitter=require(_0x8934('0x0'));var OpenchannelAccount=require(_0x8934('0x1'))['db'][_0x8934('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8934('0x3')](0x0);var events={'afterCreate':_0x8934('0x4'),'afterUpdate':'update','afterDestroy':_0x8934('0x5')};function emitEvent(_0x35da0b){return function(_0x5f34d7,_0x34f94c,_0x923aa3){OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b+':'+_0x5f34d7['id'],_0x5f34d7);OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b,_0x5f34d7);_0x923aa3(null);};}for(var e in events){if(events[_0x8934('0x7')](e)){var event=events[e];OpenchannelAccount[_0x8934('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x9354=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelAccount','save'];(function(_0xc6edd1,_0x2c799e){var _0xabf2c9=function(_0x55be55){while(--_0x55be55){_0xc6edd1['push'](_0xc6edd1['shift']());}};_0xabf2c9(++_0x2c799e);}(_0x9354,0x96));var _0x4935=function(_0x2c37b2,_0x107055){_0x2c37b2=_0x2c37b2-0x0;var _0x559312=_0x9354[_0x2c37b2];return _0x559312;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x4935('0x0'))['db'][_0x4935('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4935('0x2'),'afterUpdate':_0x4935('0x3'),'afterDestroy':_0x4935('0x4')};function emitEvent(_0x280bbc){return function(_0x5327fc,_0x46c7f9,_0x2d509b){OpenchannelAccountEvents[_0x4935('0x5')](_0x280bbc+':'+_0x5327fc['id'],_0x5327fc);OpenchannelAccountEvents[_0x4935('0x5')](_0x280bbc,_0x5327fc);_0x2d509b(null);};}for(var e in events){if(events[_0x4935('0x6')](e)){var event=events[e];OpenchannelAccount[_0x4935('0x7')](e,emitEvent(event));}}module[_0x4935('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 2056947..c5f2ca3 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(_0x4f25c5,_0x227589){var _0x5a39c3=function(_0x440cf4){while(--_0x440cf4){_0x4f25c5['push'](_0x4f25c5['shift']());}};_0x5a39c3(++_0x227589);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x520a0c,_0x49eb16){var _0x501e91=function(_0x21b2a0){while(--_0x21b2a0){_0x520a0c['push'](_0x520a0c['shift']());}};_0x501e91(++_0x49eb16);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 88dd7a7..1224e79 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 _0xc2da=['code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc2da,0x124));var _0xac2d=function(_0x530db1,_0x2b9531){_0x530db1=_0x530db1-0x0;var _0x31c1f2=_0xc2da[_0x530db1];return _0x31c1f2;};'use strict';var _=require(_0xac2d('0x0'));var util=require('util');var moment=require(_0xac2d('0x1'));var BPromise=require('bluebird');var rs=require(_0xac2d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac2d('0x3'))['db'];var utils=require(_0xac2d('0x4'));var logger=require(_0xac2d('0x5'))(_0xac2d('0x6'));var config=require(_0xac2d('0x7'));var jayson=require(_0xac2d('0x8'));var client=jayson[_0xac2d('0x9')][_0xac2d('0xa')]({'port':0x232a});config[_0xac2d('0xb')]=_[_0xac2d('0xc')](config[_0xac2d('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac2d('0xb')]));require('./openchannelAccount.socket')[_0xac2d('0xd')](socket);function respondWithRpcPromise(_0x254c5c,_0x42aad8,_0x11ac79){return new BPromise(function(_0x9a01cd,_0xe5d74a){return client['request'](_0x254c5c,_0x11ac79)['then'](function(_0x2c895b){logger[_0xac2d('0xe')](_0xac2d('0xf'),_0x42aad8,_0xac2d('0x10'));logger['debug'](_0xac2d('0x11'),_0x42aad8,_0xac2d('0x10'),JSON[_0xac2d('0x12')](_0x2c895b));if(_0x2c895b[_0xac2d('0x13')]){if(_0x2c895b[_0xac2d('0x13')][_0xac2d('0x14')]===0x1f4){logger[_0xac2d('0x13')](_0xac2d('0xf'),_0x42aad8,_0x2c895b[_0xac2d('0x13')][_0xac2d('0x15')]);return _0xe5d74a(_0x2c895b[_0xac2d('0x13')][_0xac2d('0x15')]);}logger[_0xac2d('0x13')](_0xac2d('0xf'),_0x42aad8,_0x2c895b[_0xac2d('0x13')]['message']);return _0x9a01cd(_0x2c895b[_0xac2d('0x13')][_0xac2d('0x15')]);}else{logger['info'](_0xac2d('0xf'),_0x42aad8,_0xac2d('0x10'));_0x9a01cd(_0x2c895b[_0xac2d('0x16')]['message']);}})[_0xac2d('0x17')](function(_0x5da81c){logger[_0xac2d('0x13')](_0xac2d('0xf'),_0x42aad8,_0x5da81c);_0xe5d74a(_0x5da81c);});});} \ No newline at end of file +var _0x5eb8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2df7de,_0x43c7c7){var _0x3cf213=function(_0x3f283a){while(--_0x3f283a){_0x2df7de['push'](_0x2df7de['shift']());}};_0x3cf213(++_0x43c7c7);}(_0x5eb8,0xb0));var _0x85eb=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0x5eb8[_0x28f1de];return _0x5b5dad;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});config['redis']=_[_0x85eb('0xc')](config[_0x85eb('0xd')],{'host':_0x85eb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0xd')]));require('./openchannelAccount.socket')[_0x85eb('0xf')](socket);function respondWithRpcPromise(_0x40d6b6,_0x673228,_0x29030b){return new BPromise(function(_0x1dacf2,_0x73e6d0){return client[_0x85eb('0x10')](_0x40d6b6,_0x29030b)['then'](function(_0x163f32){logger[_0x85eb('0x11')]('OpenchannelAccount,\x20%s,\x20%s',_0x673228,_0x85eb('0x12'));logger[_0x85eb('0x13')](_0x85eb('0x14'),_0x673228,_0x85eb('0x12'),JSON['stringify'](_0x163f32));if(_0x163f32['error']){if(_0x163f32[_0x85eb('0x15')]['code']===0x1f4){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x73e6d0(_0x163f32[_0x85eb('0x15')]['message']);}logger[_0x85eb('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x1dacf2(_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x673228,'request\x20sent');_0x1dacf2(_0x163f32[_0x85eb('0x18')][_0x85eb('0x17')]);}})[_0x85eb('0x19')](function(_0x2e986c){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x2e986c);_0x73e6d0(_0x2e986c);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index ca63fb2..85b9708 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 _0xbe31=['update','emit','register','length','openchannelAccount:','save','remove'];(function(_0x34fab8,_0x10575b){var _0x870f0e=function(_0x2d775a){while(--_0x2d775a){_0x34fab8['push'](_0x34fab8['shift']());}};_0x870f0e(++_0x10575b);}(_0xbe31,0x83));var _0x1be3=function(_0x3cb41d,_0x2d7f6d){_0x3cb41d=_0x3cb41d-0x0;var _0x4dc372=_0xbe31[_0x3cb41d];return _0x4dc372;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x1be3('0x0'),_0x1be3('0x1'),_0x1be3('0x2')];function createListener(_0x474db2,_0x228047){return function(_0x1bd12d){_0x228047[_0x1be3('0x3')](_0x474db2,_0x1bd12d);};}function removeListener(_0x2c1ddd,_0x3aacc2){return function(){OpenchannelAccountEvents['removeListener'](_0x2c1ddd,_0x3aacc2);};}exports[_0x1be3('0x4')]=function(_0x57e6b0){for(var _0x1f09ec=0x0,_0xa757b9=events[_0x1be3('0x5')];_0x1f09ec<_0xa757b9;_0x1f09ec++){var _0x2c3965=events[_0x1f09ec];var _0x2bb749=createListener(_0x1be3('0x6')+_0x2c3965,_0x57e6b0);OpenchannelAccountEvents['on'](_0x2c3965,_0x2bb749);}}; \ No newline at end of file +var _0x153f=['update','removeListener','register','openchannelAccount:','./openchannelAccount.events','save','remove'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x153f,0x15b));var _0xf153=function(_0x318538,_0x1a72c8){_0x318538=_0x318538-0x0;var _0x520b89=_0x153f[_0x318538];return _0x520b89;};'use strict';var OpenchannelAccountEvents=require(_0xf153('0x0'));var events=[_0xf153('0x1'),_0xf153('0x2'),_0xf153('0x3')];function createListener(_0x2afb9a,_0x1ccc1c){return function(_0x3b85fc){_0x1ccc1c['emit'](_0x2afb9a,_0x3b85fc);};}function removeListener(_0x364e65,_0x5c49c7){return function(){OpenchannelAccountEvents[_0xf153('0x4')](_0x364e65,_0x5c49c7);};}exports[_0xf153('0x5')]=function(_0x342a45){for(var _0xafd987=0x0,_0x21f432=events['length'];_0xafd987<_0x21f432;_0xafd987++){var _0x17ba96=events[_0xafd987];var _0x143497=createListener(_0xf153('0x6')+_0x17ba96,_0x342a45);OpenchannelAccountEvents['on'](_0x17ba96,_0x143497);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 7096101..77d0549 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 _0xf655=['put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x142537,_0x4e3b77){var _0x31b015=function(_0x5aad4e){while(--_0x5aad4e){_0x142537['push'](_0x142537['shift']());}};_0x31b015(++_0x4e3b77);}(_0xf655,0x1b4));var _0x5f65=function(_0x501401,_0x2d8737){_0x501401=_0x501401-0x0;var _0xfd0a47=_0xf655[_0x501401];return _0xfd0a47;};'use strict';var multer=require(_0x5f65('0x0'));var util=require('util');var path=require(_0x5f65('0x1'));var timeout=require(_0x5f65('0x2'));var express=require(_0x5f65('0x3'));var router=express[_0x5f65('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5f65('0x5'));var interaction=require(_0x5f65('0x6'));var config=require(_0x5f65('0x7'));var controller=require(_0x5f65('0x8'));router[_0x5f65('0x9')]('/',auth[_0x5f65('0xa')](),controller[_0x5f65('0xb')]);router[_0x5f65('0x9')](_0x5f65('0xc'),auth[_0x5f65('0xa')](),controller[_0x5f65('0xd')]);router['post']('/',auth[_0x5f65('0xa')](),controller['create']);router[_0x5f65('0xe')](_0x5f65('0xc'),auth['isAuthenticated'](),controller[_0x5f65('0xf')]);router['delete'](_0x5f65('0xc'),auth[_0x5f65('0xa')](),controller[_0x5f65('0x10')]);module[_0x5f65('0x11')]=router; \ No newline at end of file +var _0xb7cc=['index','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xb7cc,0x184));var _0xcb7c=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xb7cc[_0x580647];return _0x5f0792;};'use strict';var multer=require(_0xcb7c('0x0'));var util=require(_0xcb7c('0x1'));var path=require(_0xcb7c('0x2'));var timeout=require(_0xcb7c('0x3'));var express=require('express');var router=express[_0xcb7c('0x4')]();var fs_extra=require(_0xcb7c('0x5'));var auth=require(_0xcb7c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcb7c('0x7'));var controller=require(_0xcb7c('0x8'));router[_0xcb7c('0x9')]('/',auth[_0xcb7c('0xa')](),controller[_0xcb7c('0xb')]);router[_0xcb7c('0x9')](_0xcb7c('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xcb7c('0xd')]('/',auth[_0xcb7c('0xa')](),controller[_0xcb7c('0xe')]);router[_0xcb7c('0xf')](_0xcb7c('0xc'),auth[_0xcb7c('0xa')](),controller[_0xcb7c('0x10')]);router[_0xcb7c('0x11')](_0xcb7c('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xcb7c('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 7117402..ff82d91 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 _0xb9c8=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x1e0ca5,_0x57fd4f){var _0x410923=function(_0x5bd94d){while(--_0x5bd94d){_0x1e0ca5['push'](_0x1e0ca5['shift']());}};_0x410923(++_0x57fd4f);}(_0xb9c8,0x19a));var _0x8b9c=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0xb9c8[_0x412342];return _0x3e62cb;};'use strict';var Sequelize=require(_0x8b9c('0x0'));module[_0x8b9c('0x1')]={'priority':{'type':Sequelize[_0x8b9c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8b9c('0x3')],'allowNull':![],'defaultValue':_0x8b9c('0x4')},'appdata':{'type':Sequelize[_0x8b9c('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8b9c('0x3')],'defaultValue':_0x8b9c('0x6')}}; \ No newline at end of file +var _0x0aa1=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x8805e5,_0x4344c2){var _0x85c6e5=function(_0x29b2e1){while(--_0x29b2e1){_0x8805e5['push'](_0x8805e5['shift']());}};_0x85c6e5(++_0x4344c2);}(_0x0aa1,0xdd));var _0x10aa=function(_0x25af66,_0x14ae91){_0x25af66=_0x25af66-0x0;var _0x90a633=_0x0aa1[_0x25af66];return _0x90a633;};'use strict';var Sequelize=require(_0x10aa('0x0'));module[_0x10aa('0x1')]={'priority':{'type':Sequelize[_0x10aa('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x10aa('0x3')],'allowNull':![],'defaultValue':_0x10aa('0x4')},'appdata':{'type':Sequelize[_0x10aa('0x5')]()},'description':{'type':Sequelize[_0x10aa('0x3')]},'interval':{'type':Sequelize[_0x10aa('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index d092c6a..3c35090 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 _0xd3ba=['OpenchannelApplication','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index'];(function(_0x2d05fa,_0x372364){var _0x10ae61=function(_0x17c8e3){while(--_0x17c8e3){_0x2d05fa['push'](_0x2d05fa['shift']());}};_0x10ae61(++_0x372364);}(_0xd3ba,0x135));var _0xad3b=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xd3ba[_0x278e3c];return _0x3e2d9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad3b('0x0'));var zipdir=require(_0xad3b('0x1'));var jsonpatch=require(_0xad3b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad3b('0x3'));var util=require(_0xad3b('0x4'));var path=require(_0xad3b('0x5'));var sox=require(_0xad3b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad3b('0x7'));var _=require(_0xad3b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xad3b('0x9'));var deskjs=require(_0xad3b('0xa'));var toCsv=require('to-csv');var querystring=require(_0xad3b('0xb'));var Papa=require(_0xad3b('0xc'));var Redis=require(_0xad3b('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xad3b('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad3b('0xf'))(_0xad3b('0x10'));var utils=require(_0xad3b('0x11'));var config=require(_0xad3b('0x12'));var licenseUtil=require(_0xad3b('0x13'));var db=require(_0xad3b('0x14'))['db'];function respondWithStatusCode(_0x5b3076,_0x2d249b){_0x2d249b=_0x2d249b||0xcc;return function(_0x1eecc6){if(_0x1eecc6){return _0x5b3076['sendStatus'](_0x2d249b);}return _0x5b3076[_0xad3b('0x15')](_0x2d249b)[_0xad3b('0x16')]();};}function respondWithResult(_0x1c0f97,_0xad22a8){_0xad22a8=_0xad22a8||0xc8;return function(_0x5dc671){if(_0x5dc671){return _0x1c0f97[_0xad3b('0x15')](_0xad22a8)['json'](_0x5dc671);}};}function respondWithFilteredResult(_0x5bd494,_0x39a003){return function(_0x31e4ef){if(_0x31e4ef){var _0x3aad37=typeof _0x39a003[_0xad3b('0x17')]===_0xad3b('0x18')&&typeof _0x39a003[_0xad3b('0x19')]===_0xad3b('0x18');var _0x1762fd=_0x31e4ef['count'];var _0x7b82b6=_0x3aad37?0x0:_0x39a003[_0xad3b('0x17')];var _0x236142=_0x3aad37?_0x31e4ef[_0xad3b('0x1a')]:_0x39a003[_0xad3b('0x17')]+_0x39a003[_0xad3b('0x19')];var _0x391df3;if(_0x236142>=_0x1762fd){_0x236142=_0x1762fd;_0x391df3=0xc8;}else{_0x391df3=0xce;}_0x5bd494[_0xad3b('0x15')](_0x391df3);return _0x5bd494[_0xad3b('0x1b')](_0xad3b('0x1c'),_0x7b82b6+'-'+_0x236142+'/'+_0x1762fd)[_0xad3b('0x1d')](_0x31e4ef);}return null;};}function patchUpdates(_0x216257){return function(_0x49550e){try{jsonpatch[_0xad3b('0x1e')](_0x49550e,_0x216257,!![]);}catch(_0x32fadd){return BPromise[_0xad3b('0x1f')](_0x32fadd);}return _0x49550e[_0xad3b('0x20')]();};}function saveUpdates(_0x91fbb6,_0x3c0cee){return function(_0x31439c){if(_0x31439c){return _0x31439c[_0xad3b('0x21')](_0x91fbb6)[_0xad3b('0x22')](function(_0x9cbe02){return _0x9cbe02;});}return null;};}function removeEntity(_0x154ada,_0x4ec2de){return function(_0x15d127){if(_0x15d127){return _0x15d127[_0xad3b('0x23')]()['then'](function(){_0x154ada[_0xad3b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf3123f,_0x4aee13){return function(_0x394f67){if(!_0x394f67){_0xf3123f[_0xad3b('0x24')](0x194);}return _0x394f67;};}function handleError(_0x9f2b54,_0x47d78f){_0x47d78f=_0x47d78f||0x1f4;return function(_0x3e6bc0){logger[_0xad3b('0x25')](_0x3e6bc0[_0xad3b('0x26')]);if(_0x3e6bc0[_0xad3b('0x27')]){delete _0x3e6bc0[_0xad3b('0x27')];}_0x9f2b54['status'](_0x47d78f)['send'](_0x3e6bc0);};}exports[_0xad3b('0x28')]=function(_0x393fc6,_0x371ac5){var _0x25bb17={},_0xbbb701={},_0x22dc5f={'count':0x0,'rows':[]};var _0x41869a=_['map'](db[_0xad3b('0x29')][_0xad3b('0x2a')],function(_0x4e77fa){return{'name':_0x4e77fa[_0xad3b('0x2b')],'type':_0x4e77fa[_0xad3b('0x2c')]['key']};});_0xbbb701['model']=_[_0xad3b('0x2d')](_0x41869a,_0xad3b('0x27'));_0xbbb701[_0xad3b('0x2e')]=_[_0xad3b('0x2f')](_0x393fc6[_0xad3b('0x2e')]);_0xbbb701[_0xad3b('0x30')]=_[_0xad3b('0x31')](_0xbbb701[_0xad3b('0x32')],_0xbbb701[_0xad3b('0x2e')]);_0x25bb17[_0xad3b('0x33')]=_['intersection'](_0xbbb701['model'],qs[_0xad3b('0x34')](_0x393fc6['query'][_0xad3b('0x34')]));_0x25bb17[_0xad3b('0x33')]=_0x25bb17[_0xad3b('0x33')][_0xad3b('0x35')]?_0x25bb17[_0xad3b('0x33')]:_0xbbb701[_0xad3b('0x32')];if(!_0x393fc6[_0xad3b('0x2e')]['hasOwnProperty'](_0xad3b('0x36'))){_0x25bb17['limit']=qs[_0xad3b('0x19')](_0x393fc6[_0xad3b('0x2e')]['limit']);_0x25bb17[_0xad3b('0x17')]=qs[_0xad3b('0x17')](_0x393fc6[_0xad3b('0x2e')]['offset']);}_0x25bb17[_0xad3b('0x37')]=qs[_0xad3b('0x38')](_0x393fc6['query'][_0xad3b('0x38')]);_0x25bb17['where']=qs[_0xad3b('0x30')](_['pick'](_0x393fc6[_0xad3b('0x2e')],_0xbbb701[_0xad3b('0x30')]),_0x41869a);if(_0x393fc6[_0xad3b('0x2e')][_0xad3b('0x39')]){_0x25bb17[_0xad3b('0x3a')]=_[_0xad3b('0x3b')](_0x25bb17[_0xad3b('0x3a')],{'$or':_['map'](_0x41869a,function(_0x3cb235){if(_0x3cb235[_0xad3b('0x2c')]!==_0xad3b('0x3c')){var _0x3e1aba={};_0x3e1aba[_0x3cb235[_0xad3b('0x27')]]={'$like':'%'+_0x393fc6[_0xad3b('0x2e')][_0xad3b('0x39')]+'%'};return _0x3e1aba;}})});}_0x25bb17=_['merge']({},_0x25bb17,_0x393fc6[_0xad3b('0x3d')]);var _0x43b05c={'where':_0x25bb17[_0xad3b('0x3a')]};return db[_0xad3b('0x29')]['count'](_0x43b05c)[_0xad3b('0x22')](function(_0x20f284){_0x22dc5f[_0xad3b('0x1a')]=_0x20f284;if(_0x393fc6[_0xad3b('0x2e')][_0xad3b('0x3e')]){_0x25bb17[_0xad3b('0x3f')]=[{'all':!![]}];}return db[_0xad3b('0x29')]['findAll'](_0x25bb17);})[_0xad3b('0x22')](function(_0x267725){_0x22dc5f[_0xad3b('0x40')]=_0x267725;return _0x22dc5f;})['then'](respondWithFilteredResult(_0x371ac5,_0x25bb17))[_0xad3b('0x41')](handleError(_0x371ac5,null));};exports['show']=function(_0x2a9cad,_0x1c109b){var _0x3a21d4={'raw':!![],'where':{'id':_0x2a9cad[_0xad3b('0x42')]['id']}},_0x568db5={};_0x568db5[_0xad3b('0x32')]=_['keys'](db['OpenchannelApplication'][_0xad3b('0x2a')]);_0x568db5['query']=_['keys'](_0x2a9cad[_0xad3b('0x2e')]);_0x568db5[_0xad3b('0x30')]=_[_0xad3b('0x31')](_0x568db5[_0xad3b('0x32')],_0x568db5[_0xad3b('0x2e')]);_0x3a21d4[_0xad3b('0x33')]=_['intersection'](_0x568db5[_0xad3b('0x32')],qs[_0xad3b('0x34')](_0x2a9cad[_0xad3b('0x2e')][_0xad3b('0x34')]));_0x3a21d4[_0xad3b('0x33')]=_0x3a21d4['attributes']['length']?_0x3a21d4[_0xad3b('0x33')]:_0x568db5[_0xad3b('0x32')];if(_0x2a9cad[_0xad3b('0x2e')][_0xad3b('0x3e')]){_0x3a21d4[_0xad3b('0x3f')]=[{'all':!![]}];}_0x3a21d4=_['merge']({},_0x3a21d4,_0x2a9cad[_0xad3b('0x3d')]);return db[_0xad3b('0x29')][_0xad3b('0x43')](_0x3a21d4)[_0xad3b('0x22')](handleEntityNotFound(_0x1c109b,null))['then'](respondWithResult(_0x1c109b,null))[_0xad3b('0x41')](handleError(_0x1c109b,null));};exports[_0xad3b('0x44')]=function(_0x25bef2,_0x4cbe7f){return db['OpenchannelApplication'][_0xad3b('0x44')](_0x25bef2[_0xad3b('0x45')],{})['then'](respondWithResult(_0x4cbe7f,0xc9))[_0xad3b('0x41')](handleError(_0x4cbe7f,null));};exports['update']=function(_0x3952c8,_0x450712){if(_0x3952c8[_0xad3b('0x45')]['id']){delete _0x3952c8[_0xad3b('0x45')]['id'];}return db[_0xad3b('0x29')][_0xad3b('0x43')]({'where':{'id':_0x3952c8[_0xad3b('0x42')]['id']}})[_0xad3b('0x22')](handleEntityNotFound(_0x450712,null))[_0xad3b('0x22')](saveUpdates(_0x3952c8['body'],null))[_0xad3b('0x22')](respondWithResult(_0x450712,null))[_0xad3b('0x41')](handleError(_0x450712,null));};exports[_0xad3b('0x23')]=function(_0x261e90,_0x2229d1){return db[_0xad3b('0x29')][_0xad3b('0x43')]({'where':{'id':_0x261e90[_0xad3b('0x42')]['id']}})['then'](handleEntityNotFound(_0x2229d1,null))[_0xad3b('0x22')](removeEntity(_0x2229d1,null))[_0xad3b('0x41')](handleError(_0x2229d1,null));}; \ No newline at end of file +var _0x5cde=['offset','limit','set','Content-Range','json','apply','reject','update','then','error','name','send','index','map','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','OpenchannelApplication','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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','status','end','undefined','count'];(function(_0x1d6f12,_0x35e2ef){var _0x5d98c6=function(_0x2329db){while(--_0x2329db){_0x1d6f12['push'](_0x1d6f12['shift']());}};_0x5d98c6(++_0x35e2ef);}(_0x5cde,0x112));var _0xe5cd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5cde[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xe5cd('0x0'));var rimraf=require(_0xe5cd('0x1'));var zipdir=require(_0xe5cd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe5cd('0x3'));var moment=require(_0xe5cd('0x4'));var BPromise=require(_0xe5cd('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe5cd('0x6'));var csv=require('to-csv');var ejs=require(_0xe5cd('0x7'));var fs=require('fs');var fs_extra=require(_0xe5cd('0x8'));var _=require(_0xe5cd('0x9'));var squel=require(_0xe5cd('0xa'));var crypto=require('crypto');var jsforce=require(_0xe5cd('0xb'));var deskjs=require(_0xe5cd('0xc'));var toCsv=require(_0xe5cd('0xd'));var querystring=require(_0xe5cd('0xe'));var Papa=require(_0xe5cd('0xf'));var Redis=require(_0xe5cd('0x10'));var authService=require(_0xe5cd('0x11'));var qs=require(_0xe5cd('0x12'));var as=require(_0xe5cd('0x13'));var hardwareService=require(_0xe5cd('0x14'));var logger=require(_0xe5cd('0x15'))('api');var utils=require(_0xe5cd('0x16'));var config=require(_0xe5cd('0x17'));var licenseUtil=require(_0xe5cd('0x18'));var db=require(_0xe5cd('0x19'))['db'];function respondWithStatusCode(_0x61e687,_0x81d098){_0x81d098=_0x81d098||0xcc;return function(_0x4f3bde){if(_0x4f3bde){return _0x61e687['sendStatus'](_0x81d098);}return _0x61e687[_0xe5cd('0x1a')](_0x81d098)[_0xe5cd('0x1b')]();};}function respondWithResult(_0x1a3c81,_0xf9290e){_0xf9290e=_0xf9290e||0xc8;return function(_0x1bab0b){if(_0x1bab0b){return _0x1a3c81[_0xe5cd('0x1a')](_0xf9290e)['json'](_0x1bab0b);}};}function respondWithFilteredResult(_0x3b41dd,_0xee8d9c){return function(_0x1cab5a){if(_0x1cab5a){var _0x3bb308=typeof _0xee8d9c['offset']===_0xe5cd('0x1c')&&typeof _0xee8d9c['limit']===_0xe5cd('0x1c');var _0x381917=_0x1cab5a[_0xe5cd('0x1d')];var _0x50139e=_0x3bb308?0x0:_0xee8d9c[_0xe5cd('0x1e')];var _0x2cce24=_0x3bb308?_0x1cab5a[_0xe5cd('0x1d')]:_0xee8d9c[_0xe5cd('0x1e')]+_0xee8d9c[_0xe5cd('0x1f')];var _0x58c3bd;if(_0x2cce24>=_0x381917){_0x2cce24=_0x381917;_0x58c3bd=0xc8;}else{_0x58c3bd=0xce;}_0x3b41dd[_0xe5cd('0x1a')](_0x58c3bd);return _0x3b41dd[_0xe5cd('0x20')](_0xe5cd('0x21'),_0x50139e+'-'+_0x2cce24+'/'+_0x381917)[_0xe5cd('0x22')](_0x1cab5a);}return null;};}function patchUpdates(_0x464f87){return function(_0x1a0c9c){try{jsonpatch[_0xe5cd('0x23')](_0x1a0c9c,_0x464f87,!![]);}catch(_0x6dc9fd){return BPromise[_0xe5cd('0x24')](_0x6dc9fd);}return _0x1a0c9c['save']();};}function saveUpdates(_0x39260a,_0x4db7ac){return function(_0x1b36f9){if(_0x1b36f9){return _0x1b36f9[_0xe5cd('0x25')](_0x39260a)[_0xe5cd('0x26')](function(_0x3c53af){return _0x3c53af;});}return null;};}function removeEntity(_0x42489a,_0x5150b4){return function(_0x41a034){if(_0x41a034){return _0x41a034['destroy']()[_0xe5cd('0x26')](function(){_0x42489a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a09c,_0x1143e5){return function(_0x1beb1b){if(!_0x1beb1b){_0x45a09c['sendStatus'](0x194);}return _0x1beb1b;};}function handleError(_0x43c724,_0x2d1b87){_0x2d1b87=_0x2d1b87||0x1f4;return function(_0x41ae4f){logger[_0xe5cd('0x27')](_0x41ae4f['stack']);if(_0x41ae4f[_0xe5cd('0x28')]){delete _0x41ae4f[_0xe5cd('0x28')];}_0x43c724[_0xe5cd('0x1a')](_0x2d1b87)[_0xe5cd('0x29')](_0x41ae4f);};}exports[_0xe5cd('0x2a')]=function(_0x322653,_0x216eba){var _0x1ccd60={},_0x4824d2={},_0x296bf5={'count':0x0,'rows':[]};var _0x504355=_[_0xe5cd('0x2b')](db['OpenchannelApplication']['rawAttributes'],function(_0x62cae1){return{'name':_0x62cae1[_0xe5cd('0x2c')],'type':_0x62cae1[_0xe5cd('0x2d')][_0xe5cd('0x2e')]};});_0x4824d2['model']=_[_0xe5cd('0x2b')](_0x504355,'name');_0x4824d2['query']=_[_0xe5cd('0x2f')](_0x322653[_0xe5cd('0x30')]);_0x4824d2[_0xe5cd('0x31')]=_[_0xe5cd('0x32')](_0x4824d2[_0xe5cd('0x33')],_0x4824d2[_0xe5cd('0x30')]);_0x1ccd60[_0xe5cd('0x34')]=_['intersection'](_0x4824d2[_0xe5cd('0x33')],qs[_0xe5cd('0x35')](_0x322653[_0xe5cd('0x30')][_0xe5cd('0x35')]));_0x1ccd60['attributes']=_0x1ccd60['attributes'][_0xe5cd('0x36')]?_0x1ccd60[_0xe5cd('0x34')]:_0x4824d2[_0xe5cd('0x33')];if(!_0x322653[_0xe5cd('0x30')][_0xe5cd('0x37')](_0xe5cd('0x38'))){_0x1ccd60[_0xe5cd('0x1f')]=qs[_0xe5cd('0x1f')](_0x322653['query']['limit']);_0x1ccd60['offset']=qs['offset'](_0x322653[_0xe5cd('0x30')][_0xe5cd('0x1e')]);}_0x1ccd60[_0xe5cd('0x39')]=qs['sort'](_0x322653['query']['sort']);_0x1ccd60[_0xe5cd('0x3a')]=qs[_0xe5cd('0x31')](_[_0xe5cd('0x3b')](_0x322653[_0xe5cd('0x30')],_0x4824d2[_0xe5cd('0x31')]),_0x504355);if(_0x322653['query'][_0xe5cd('0x3c')]){_0x1ccd60[_0xe5cd('0x3a')]=_['merge'](_0x1ccd60['where'],{'$or':_[_0xe5cd('0x2b')](_0x504355,function(_0x335af5){if(_0x335af5[_0xe5cd('0x2d')]!==_0xe5cd('0x3d')){var _0x171461={};_0x171461[_0x335af5[_0xe5cd('0x28')]]={'$like':'%'+_0x322653['query'][_0xe5cd('0x3c')]+'%'};return _0x171461;}})});}_0x1ccd60=_[_0xe5cd('0x3e')]({},_0x1ccd60,_0x322653[_0xe5cd('0x3f')]);var _0x24ecbf={'where':_0x1ccd60[_0xe5cd('0x3a')]};return db[_0xe5cd('0x40')][_0xe5cd('0x1d')](_0x24ecbf)[_0xe5cd('0x26')](function(_0x14ce7d){_0x296bf5[_0xe5cd('0x1d')]=_0x14ce7d;if(_0x322653['query'][_0xe5cd('0x41')]){_0x1ccd60[_0xe5cd('0x42')]=[{'all':!![]}];}return db[_0xe5cd('0x40')][_0xe5cd('0x43')](_0x1ccd60);})[_0xe5cd('0x26')](function(_0x52f587){_0x296bf5[_0xe5cd('0x44')]=_0x52f587;return _0x296bf5;})[_0xe5cd('0x26')](respondWithFilteredResult(_0x216eba,_0x1ccd60))['catch'](handleError(_0x216eba,null));};exports[_0xe5cd('0x45')]=function(_0x1110f2,_0x21cb44){var _0x3dc67f={'raw':!![],'where':{'id':_0x1110f2[_0xe5cd('0x46')]['id']}},_0x2c04f6={};_0x2c04f6[_0xe5cd('0x33')]=_[_0xe5cd('0x2f')](db[_0xe5cd('0x40')]['rawAttributes']);_0x2c04f6['query']=_[_0xe5cd('0x2f')](_0x1110f2[_0xe5cd('0x30')]);_0x2c04f6[_0xe5cd('0x31')]=_[_0xe5cd('0x32')](_0x2c04f6[_0xe5cd('0x33')],_0x2c04f6[_0xe5cd('0x30')]);_0x3dc67f[_0xe5cd('0x34')]=_['intersection'](_0x2c04f6['model'],qs[_0xe5cd('0x35')](_0x1110f2[_0xe5cd('0x30')][_0xe5cd('0x35')]));_0x3dc67f[_0xe5cd('0x34')]=_0x3dc67f['attributes'][_0xe5cd('0x36')]?_0x3dc67f[_0xe5cd('0x34')]:_0x2c04f6[_0xe5cd('0x33')];if(_0x1110f2[_0xe5cd('0x30')][_0xe5cd('0x41')]){_0x3dc67f[_0xe5cd('0x42')]=[{'all':!![]}];}_0x3dc67f=_[_0xe5cd('0x3e')]({},_0x3dc67f,_0x1110f2[_0xe5cd('0x3f')]);return db[_0xe5cd('0x40')][_0xe5cd('0x47')](_0x3dc67f)['then'](handleEntityNotFound(_0x21cb44,null))[_0xe5cd('0x26')](respondWithResult(_0x21cb44,null))[_0xe5cd('0x48')](handleError(_0x21cb44,null));};exports[_0xe5cd('0x49')]=function(_0x4e4096,_0x5d8ae2){return db[_0xe5cd('0x40')][_0xe5cd('0x49')](_0x4e4096[_0xe5cd('0x4a')],{})['then'](respondWithResult(_0x5d8ae2,0xc9))[_0xe5cd('0x48')](handleError(_0x5d8ae2,null));};exports[_0xe5cd('0x25')]=function(_0x699d8,_0x518026){if(_0x699d8[_0xe5cd('0x4a')]['id']){delete _0x699d8[_0xe5cd('0x4a')]['id'];}return db[_0xe5cd('0x40')]['find']({'where':{'id':_0x699d8[_0xe5cd('0x46')]['id']}})[_0xe5cd('0x26')](handleEntityNotFound(_0x518026,null))[_0xe5cd('0x26')](saveUpdates(_0x699d8['body'],null))['then'](respondWithResult(_0x518026,null))[_0xe5cd('0x48')](handleError(_0x518026,null));};exports[_0xe5cd('0x4b')]=function(_0x32799a,_0x2feeee){return db['OpenchannelApplication'][_0xe5cd('0x47')]({'where':{'id':_0x32799a['params']['id']}})['then'](handleEntityNotFound(_0x2feeee,null))['then'](removeEntity(_0x2feeee,null))[_0xe5cd('0x48')](handleError(_0x2feeee,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 82510d8..29634f6 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 _0x69a6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69a6,0xee));var _0x669a=function(_0x3c3320,_0x44d923){_0x3c3320=_0x3c3320-0x0;var _0x185305=_0x69a6[_0x3c3320];return _0x185305;};'use strict';var _=require(_0x669a('0x0'));var util=require(_0x669a('0x1'));var logger=require(_0x669a('0x2'))(_0x669a('0x3'));var moment=require(_0x669a('0x4'));var BPromise=require(_0x669a('0x5'));var rp=require(_0x669a('0x6'));var fs=require('fs');var path=require(_0x669a('0x7'));var rimraf=require(_0x669a('0x8'));var config=require(_0x669a('0x9'));var attributes=require(_0x669a('0xa'));module['exports']=function(_0x408ad5,_0x99eaf3){return _0x408ad5[_0x669a('0xb')]('OpenchannelApplication',attributes,{'tableName':_0x669a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x669a('0xd'),'collate':_0x669a('0xe')});}; \ No newline at end of file +var _0x5651=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','openchannel_applications','utf8mb4'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x5651,0x144));var _0x1565=function(_0x22bee0,_0x412ecb){_0x22bee0=_0x22bee0-0x0;var _0x2d295b=_0x5651[_0x22bee0];return _0x2d295b;};'use strict';var _=require(_0x1565('0x0'));var util=require(_0x1565('0x1'));var logger=require(_0x1565('0x2'))(_0x1565('0x3'));var moment=require(_0x1565('0x4'));var BPromise=require(_0x1565('0x5'));var rp=require(_0x1565('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1565('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0x1565('0x8')]=function(_0x5d2885,_0x4b6477){return _0x5d2885[_0x1565('0x9')]('OpenchannelApplication',attributes,{'tableName':_0x1565('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1565('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index e5381e9..38dc438 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 _0x2543=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','OpenchannelApplication','update','body','options','raw','where','attributes','limit','UpdateOpenchannelApplication'];(function(_0x43ada7,_0x542942){var _0x1a1027=function(_0x176c8b){while(--_0x176c8b){_0x43ada7['push'](_0x43ada7['shift']());}};_0x1a1027(++_0x542942);}(_0x2543,0x1ce));var _0x3254=function(_0x37a9d7,_0x2b6fde){_0x37a9d7=_0x37a9d7-0x0;var _0x1343d3=_0x2543[_0x37a9d7];return _0x1343d3;};'use strict';var _=require(_0x3254('0x0'));var util=require(_0x3254('0x1'));var moment=require(_0x3254('0x2'));var BPromise=require(_0x3254('0x3'));var rs=require(_0x3254('0x4'));var fs=require('fs');var Redis=require(_0x3254('0x5'));var db=require(_0x3254('0x6'))['db'];var utils=require(_0x3254('0x7'));var logger=require('../../config/logger')(_0x3254('0x8'));var config=require(_0x3254('0x9'));var jayson=require(_0x3254('0xa'));var client=jayson[_0x3254('0xb')][_0x3254('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x457790,_0x5646ee,_0x754f74){return new BPromise(function(_0x20a32b,_0x7c5c9f){return client[_0x3254('0xd')](_0x457790,_0x754f74)['then'](function(_0x5baf3a){logger['info'](_0x3254('0xe'),_0x5646ee,_0x3254('0xf'));logger[_0x3254('0x10')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x5646ee,_0x3254('0xf'),JSON[_0x3254('0x11')](_0x5baf3a));if(_0x5baf3a['error']){if(_0x5baf3a[_0x3254('0x12')][_0x3254('0x13')]===0x1f4){logger[_0x3254('0x12')](_0x3254('0xe'),_0x5646ee,_0x5baf3a[_0x3254('0x12')]['message']);return _0x7c5c9f(_0x5baf3a[_0x3254('0x12')][_0x3254('0x14')]);}logger[_0x3254('0x12')](_0x3254('0xe'),_0x5646ee,_0x5baf3a[_0x3254('0x12')]['message']);return _0x20a32b(_0x5baf3a[_0x3254('0x12')][_0x3254('0x14')]);}else{logger[_0x3254('0x15')](_0x3254('0xe'),_0x5646ee,_0x3254('0xf'));_0x20a32b(_0x5baf3a[_0x3254('0x16')]['message']);}})[_0x3254('0x17')](function(_0x3ac66b){logger[_0x3254('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x5646ee,_0x3ac66b);_0x7c5c9f(_0x3ac66b);});});}exports['UpdateOpenchannelApplication']=function(_0x1ccb9e){var _0xa96f9e=this;return new Promise(function(_0x8a6b6,_0x377208){return db[_0x3254('0x18')][_0x3254('0x19')](_0x1ccb9e[_0x3254('0x1a')],{'raw':_0x1ccb9e[_0x3254('0x1b')]?_0x1ccb9e[_0x3254('0x1b')][_0x3254('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ccb9e[_0x3254('0x1b')]?_0x1ccb9e['options'][_0x3254('0x1d')]||null:null,'attributes':_0x1ccb9e[_0x3254('0x1b')]?_0x1ccb9e[_0x3254('0x1b')][_0x3254('0x1e')]||null:null,'limit':_0x1ccb9e[_0x3254('0x1b')]?_0x1ccb9e[_0x3254('0x1b')][_0x3254('0x1f')]||null:null})['then'](function(_0xcc80e7){logger[_0x3254('0x15')](_0x3254('0x20'),_0x1ccb9e);logger[_0x3254('0x10')](_0x3254('0x20'),_0x1ccb9e,JSON['stringify'](_0xcc80e7));_0x8a6b6(_0xcc80e7);})[_0x3254('0x17')](function(_0x45da76){logger[_0x3254('0x12')]('UpdateOpenchannelApplication',_0x45da76[_0x3254('0x14')],_0x1ccb9e);_0x377208(_0xa96f9e[_0x3254('0x12')](0x1f4,_0x45da76[_0x3254('0x14')]));});});}; \ No newline at end of file +var _0x66c7=['http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','result','UpdateOpenchannelApplication','update','body','options','raw','where','limit','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x11574c,_0x4a20c8){var _0x73c2ed=function(_0x5d2efb){while(--_0x5d2efb){_0x11574c['push'](_0x11574c['shift']());}};_0x73c2ed(++_0x4a20c8);}(_0x66c7,0x15e));var _0x766c=function(_0x27900f,_0x1abbef){_0x27900f=_0x27900f-0x0;var _0x1b860a=_0x66c7[_0x27900f];return _0x1b860a;};'use strict';var _=require(_0x766c('0x0'));var util=require(_0x766c('0x1'));var moment=require(_0x766c('0x2'));var BPromise=require(_0x766c('0x3'));var rs=require(_0x766c('0x4'));var fs=require('fs');var Redis=require(_0x766c('0x5'));var db=require(_0x766c('0x6'))['db'];var utils=require(_0x766c('0x7'));var logger=require(_0x766c('0x8'))(_0x766c('0x9'));var config=require(_0x766c('0xa'));var jayson=require(_0x766c('0xb'));var client=jayson[_0x766c('0xc')][_0x766c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x153456,_0x2a721c,_0x31dbf1){return new BPromise(function(_0x27de21,_0x2de482){return client[_0x766c('0xe')](_0x153456,_0x31dbf1)[_0x766c('0xf')](function(_0x14023a){logger[_0x766c('0x10')](_0x766c('0x11'),_0x2a721c,_0x766c('0x12'));logger[_0x766c('0x13')](_0x766c('0x14'),_0x2a721c,'request\x20sent',JSON['stringify'](_0x14023a));if(_0x14023a[_0x766c('0x15')]){if(_0x14023a[_0x766c('0x15')]['code']===0x1f4){logger[_0x766c('0x15')](_0x766c('0x11'),_0x2a721c,_0x14023a[_0x766c('0x15')]['message']);return _0x2de482(_0x14023a[_0x766c('0x15')][_0x766c('0x16')]);}logger[_0x766c('0x15')](_0x766c('0x11'),_0x2a721c,_0x14023a['error'][_0x766c('0x16')]);return _0x27de21(_0x14023a[_0x766c('0x15')]['message']);}else{logger[_0x766c('0x10')](_0x766c('0x11'),_0x2a721c,_0x766c('0x12'));_0x27de21(_0x14023a[_0x766c('0x17')][_0x766c('0x16')]);}})['catch'](function(_0x3007cb){logger[_0x766c('0x15')](_0x766c('0x11'),_0x2a721c,_0x3007cb);_0x2de482(_0x3007cb);});});}exports[_0x766c('0x18')]=function(_0x3da47e){var _0x5b3a9c=this;return new Promise(function(_0x2d5b61,_0xb36f38){return db['OpenchannelApplication'][_0x766c('0x19')](_0x3da47e[_0x766c('0x1a')],{'raw':_0x3da47e[_0x766c('0x1b')]?_0x3da47e[_0x766c('0x1b')][_0x766c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3da47e[_0x766c('0x1b')]?_0x3da47e[_0x766c('0x1b')][_0x766c('0x1d')]||null:null,'attributes':_0x3da47e[_0x766c('0x1b')]?_0x3da47e['options']['attributes']||null:null,'limit':_0x3da47e[_0x766c('0x1b')]?_0x3da47e[_0x766c('0x1b')][_0x766c('0x1e')]||null:null})[_0x766c('0xf')](function(_0x1532ba){logger[_0x766c('0x10')](_0x766c('0x18'),_0x3da47e);logger[_0x766c('0x13')](_0x766c('0x18'),_0x3da47e,JSON[_0x766c('0x1f')](_0x1532ba));_0x2d5b61(_0x1532ba);})[_0x766c('0x20')](function(_0x32ca5e){logger[_0x766c('0x15')]('UpdateOpenchannelApplication',_0x32ca5e[_0x766c('0x16')],_0x3da47e);_0xb36f38(_0x5b3a9c[_0x766c('0x15')](0x1f4,_0x32ca5e[_0x766c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 94d6ba5..fe214db 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 _0xd5a8=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/messages','getMessages','post','create','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','openchannelinteraction:destroy','delete','removeTags','exports','multer','util','express'];(function(_0x229b07,_0x3cb3df){var _0x3e7648=function(_0x37bd56){while(--_0x37bd56){_0x229b07['push'](_0x229b07['shift']());}};_0x3e7648(++_0x3cb3df);}(_0xd5a8,0x89));var _0x8d5a=function(_0x221313,_0x4b521d){_0x221313=_0x221313-0x0;var _0xa5bd21=_0xd5a8[_0x221313];return _0xa5bd21;};'use strict';var multer=require(_0x8d5a('0x0'));var util=require(_0x8d5a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8d5a('0x2'));var router=express[_0x8d5a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8d5a('0x4'));var interaction=require(_0x8d5a('0x5'));var config=require(_0x8d5a('0x6'));var controller=require('./openchannelInteraction.controller');router[_0x8d5a('0x7')]('/',auth[_0x8d5a('0x8')](),controller['index']);router[_0x8d5a('0x7')](_0x8d5a('0x9'),auth[_0x8d5a('0x8')](),controller[_0x8d5a('0xa')]);router[_0x8d5a('0x7')](_0x8d5a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8d5a('0x7')](_0x8d5a('0xc'),auth[_0x8d5a('0x8')](),controller[_0x8d5a('0xd')]);router[_0x8d5a('0x7')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x8d5a('0xe')]('/',auth[_0x8d5a('0x8')](),controller[_0x8d5a('0xf')]);router['post']('/:id/messages',auth[_0x8d5a('0x8')](),controller[_0x8d5a('0x10')]);router[_0x8d5a('0xe')](_0x8d5a('0x11'),auth[_0x8d5a('0x8')](),interaction['tracked'](_0x8d5a('0x12'),_0x8d5a('0x13')),controller[_0x8d5a('0x14')]);router[_0x8d5a('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0x8d5a('0x16')](_0x8d5a('0x12'),_0x8d5a('0x17')),controller['update']);router['delete'](_0x8d5a('0xb'),auth[_0x8d5a('0x8')](),interaction[_0x8d5a('0x16')]('openchannel',_0x8d5a('0x18')),controller['destroy']);router[_0x8d5a('0x19')](_0x8d5a('0x11'),auth[_0x8d5a('0x8')](),controller[_0x8d5a('0x1a')]);module[_0x8d5a('0x1b')]=router; \ No newline at end of file +var _0xe271=['put','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xe271,0xb0));var _0x1e27=function(_0x259ecb,_0xd6a5dc){_0x259ecb=_0x259ecb-0x0;var _0x1598b5=_0xe271[_0x259ecb];return _0x1598b5;};'use strict';var multer=require('multer');var util=require(_0x1e27('0x0'));var path=require(_0x1e27('0x1'));var timeout=require(_0x1e27('0x2'));var express=require(_0x1e27('0x3'));var router=express[_0x1e27('0x4')]();var fs_extra=require(_0x1e27('0x5'));var auth=require(_0x1e27('0x6'));var interaction=require(_0x1e27('0x7'));var config=require(_0x1e27('0x8'));var controller=require(_0x1e27('0x9'));router[_0x1e27('0xa')]('/',auth['isAuthenticated'](),controller[_0x1e27('0xb')]);router[_0x1e27('0xa')](_0x1e27('0xc'),auth[_0x1e27('0xd')](),controller[_0x1e27('0xe')]);router[_0x1e27('0xa')](_0x1e27('0xf'),auth[_0x1e27('0xd')](),controller[_0x1e27('0x10')]);router[_0x1e27('0xa')](_0x1e27('0x11'),auth[_0x1e27('0xd')](),controller[_0x1e27('0x12')]);router[_0x1e27('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x1e27('0x13')]);router[_0x1e27('0x14')]('/',auth[_0x1e27('0xd')](),controller[_0x1e27('0x15')]);router[_0x1e27('0x14')](_0x1e27('0x11'),auth[_0x1e27('0xd')](),controller[_0x1e27('0x16')]);router[_0x1e27('0x14')](_0x1e27('0x17'),auth[_0x1e27('0xd')](),interaction[_0x1e27('0x18')](_0x1e27('0x19'),_0x1e27('0x1a')),controller[_0x1e27('0x1b')]);router[_0x1e27('0x1c')](_0x1e27('0xf'),auth[_0x1e27('0xd')](),interaction[_0x1e27('0x18')]('openchannel',_0x1e27('0x1d')),controller['update']);router[_0x1e27('0x1e')](_0x1e27('0xf'),auth[_0x1e27('0xd')](),interaction[_0x1e27('0x18')](_0x1e27('0x19'),_0x1e27('0x1f')),controller[_0x1e27('0x20')]);router[_0x1e27('0x1e')]('/:id/tags',auth[_0x1e27('0xd')](),controller[_0x1e27('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index d83dbf0..81db401 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 _0x0f92=['STRING','DATE','ENUM','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x317f3d,_0x30edf7){var _0x426133=function(_0x1d0fa8){while(--_0x1d0fa8){_0x317f3d['push'](_0x317f3d['shift']());}};_0x426133(++_0x30edf7);}(_0x0f92,0xfd));var _0x20f9=function(_0x2ee42f,_0x26daf4){_0x2ee42f=_0x2ee42f-0x0;var _0x23f5cb=_0x0f92[_0x2ee42f];return _0x23f5cb;};'use strict';var Sequelize=require(_0x20f9('0x0'));module[_0x20f9('0x1')]={'closed':{'type':Sequelize[_0x20f9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x20f9('0x3')]},'secondDisposition':{'type':Sequelize[_0x20f9('0x3')]},'thirdDisposition':{'type':Sequelize[_0x20f9('0x3')]},'note':{'type':Sequelize[_0x20f9('0x3')]},'read1stAt':{'type':Sequelize[_0x20f9('0x4')]},'threadId':{'type':Sequelize[_0x20f9('0x3')]},'externalUrl':{'type':Sequelize[_0x20f9('0x3')]},'lastMsgAt':{'type':Sequelize[_0x20f9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x20f9('0x5')]('in',_0x20f9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x20f9('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x20f9('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x20f9('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x20f9('0x7')]}}; \ No newline at end of file +var _0x1707=['out','BOOLEAN','INTEGER','sequelize','STRING','DATE','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1707,0x1df));var _0x7170=function(_0x40abae,_0x5c4f4e){_0x40abae=_0x40abae-0x0;var _0x11e230=_0x1707[_0x40abae];return _0x11e230;};'use strict';var Sequelize=require(_0x7170('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x7170('0x1')]},'secondDisposition':{'type':Sequelize[_0x7170('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7170('0x1')]},'read1stAt':{'type':Sequelize[_0x7170('0x2')]},'threadId':{'type':Sequelize[_0x7170('0x1')]},'externalUrl':{'type':Sequelize[_0x7170('0x1')]},'lastMsgAt':{'type':Sequelize[_0x7170('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x7170('0x3')]('in',_0x7170('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x7170('0x3')]('in',_0x7170('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7170('0x1')]},'autoreplyExecuted':{'type':Sequelize[_0x7170('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7170('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index e36faf4..40324f2 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 _0x0530=['limit','sort','where','pick','OpenchannelInteractionId','filter','merge','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','omit','spread','Tag','color','openchannelInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','push','fullname','CmContact','firstName','lastName','attachments','Attachment','Messages','createdAt','secret','read','Account','User','Owner','get','mkdirSync','toString','closed','closedAt','disposition','Public','Private','basename','existsSync','pipe','direction','out','System','Contact','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../mysqldb','redis','localhost','./openchannelInteraction.socket','status','end','json','offset','undefined','count','Content-Range','destroy','then','sendStatus','name','index','OpenchannelInteraction','rawAttributes','key','getOptions','openchannel','query','user','catch','show','type','from','params','model','keys','filters','attributes','intersection','fields','length','includeAll','include','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0530,0x1a9));var _0x0053=function(_0x28c5ff,_0x47abab){_0x28c5ff=_0x28c5ff-0x0;var _0x25d6c8=_0x0530[_0x28c5ff];return _0x25d6c8;};'use strict';var rimraf=require(_0x0053('0x0'));var zipdir=require(_0x0053('0x1'));var moment=require(_0x0053('0x2'));var util=require(_0x0053('0x3'));var path=require(_0x0053('0x4'));var ejs=require(_0x0053('0x5'));var fs=require('fs');var _=require(_0x0053('0x6'));var Redis=require(_0x0053('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x0053('0x8'))['db'];config[_0x0053('0x9')]=_['defaults'](config[_0x0053('0x9')],{'host':_0x0053('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0053('0x9')]));require(_0x0053('0xb'))['register'](socket);function respondWithStatusCode(_0x295e08,_0x47e78e){_0x47e78e=_0x47e78e||0xcc;return function(_0x4c1bb0){if(_0x4c1bb0){return _0x295e08['sendStatus'](_0x47e78e);}return _0x295e08[_0x0053('0xc')](_0x47e78e)[_0x0053('0xd')]();};}function respondWithResult(_0x283c37,_0x5c464d){_0x5c464d=_0x5c464d||0xc8;return function(_0x6579f1){if(_0x6579f1){return _0x283c37[_0x0053('0xc')](_0x5c464d)[_0x0053('0xe')](_0x6579f1);}};}function respondWithFilteredResult(_0x4fb30e,_0x4d2dd2){return function(_0x381ec6){if(_0x381ec6){var _0x2ae193=typeof _0x4d2dd2[_0x0053('0xf')]===_0x0053('0x10')&&typeof _0x4d2dd2['limit']===_0x0053('0x10');var _0x2c5b56=_0x381ec6[_0x0053('0x11')];var _0x153d14=_0x2ae193?0x0:_0x4d2dd2['offset'];var _0x33e1e5=_0x2ae193?_0x381ec6['count']:_0x4d2dd2['offset']+_0x4d2dd2['limit'];var _0x26d99a;if(_0x33e1e5>=_0x2c5b56){_0x33e1e5=_0x2c5b56;_0x26d99a=0xc8;}else{_0x26d99a=0xce;}_0x4fb30e[_0x0053('0xc')](_0x26d99a);return _0x4fb30e['set'](_0x0053('0x12'),_0x153d14+'-'+_0x33e1e5+'/'+_0x2c5b56)[_0x0053('0xe')](_0x381ec6);}return null;};}function saveUpdates(_0x16b66d){return function(_0x511566){if(_0x511566){return _0x511566['update'](_0x16b66d)['then'](function(_0x2851be){return _0x2851be;});}return null;};}function removeEntity(_0x473071){return function(_0x2d51ad){if(_0x2d51ad){return _0x2d51ad[_0x0053('0x13')]()[_0x0053('0x14')](function(){_0x473071[_0x0053('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11964a){return function(_0x51ae27){if(!_0x51ae27){_0x11964a[_0x0053('0x15')](0x194);}return _0x51ae27;};}function handleError(_0x510986,_0x5857ad){_0x5857ad=_0x5857ad||0x1f4;return function(_0x46e705){logger['error'](_0x46e705['stack']);if(_0x46e705[_0x0053('0x16')]){delete _0x46e705[_0x0053('0x16')];}_0x510986['status'](_0x5857ad)['send'](_0x46e705);};}exports[_0x0053('0x17')]=function(_0x1bb475,_0x17e3c5){var _0x566677={};var _0x1fffeb=_['map'](db[_0x0053('0x18')][_0x0053('0x19')],function(_0x398e4a){return{'name':_0x398e4a['fieldName'],'type':_0x398e4a['type'][_0x0053('0x1a')]};});_0x566677=qs[_0x0053('0x1b')](_0x1fffeb,_0x1bb475);return interaction['findAll'](_0x0053('0x1c'),_0x1bb475[_0x0053('0x1d')],_0x1bb475[_0x0053('0x1e')],_0x566677,_0x1fffeb)[_0x0053('0x14')](respondWithFilteredResult(_0x17e3c5,_0x566677))[_0x0053('0x1f')](handleError(_0x17e3c5,null));};exports[_0x0053('0x20')]=function(_0x592aff,_0x48bbc0){var _0x2b28cd={};if(_0x592aff[_0x0053('0x1d')][_0x0053('0x21')]&&_0x592aff['query']['type']==='from'){_0x2b28cd[_0x0053('0x22')]=_0x592aff[_0x0053('0x23')]['id'];}else{_0x2b28cd['id']=_0x592aff[_0x0053('0x23')]['id'];}var _0x37d28a={'raw':![],'where':_0x2b28cd},_0x1c7309={};_0x1c7309[_0x0053('0x24')]=_[_0x0053('0x25')](db[_0x0053('0x18')][_0x0053('0x19')]);_0x1c7309[_0x0053('0x1d')]=_[_0x0053('0x25')](_0x592aff[_0x0053('0x1d')]);_0x1c7309[_0x0053('0x26')]=_['intersection'](_0x1c7309[_0x0053('0x24')],_0x1c7309[_0x0053('0x1d')]);_0x37d28a[_0x0053('0x27')]=_[_0x0053('0x28')](_0x1c7309[_0x0053('0x24')],qs[_0x0053('0x29')](_0x592aff['query'][_0x0053('0x29')]));_0x37d28a[_0x0053('0x27')]=_0x37d28a[_0x0053('0x27')][_0x0053('0x2a')]?_0x37d28a[_0x0053('0x27')]:_0x1c7309['model'];if(_0x592aff[_0x0053('0x1d')][_0x0053('0x2b')]){_0x37d28a[_0x0053('0x2c')]=[{'all':!![]}];}_0x37d28a=_['merge']({},_0x37d28a,_0x592aff[_0x0053('0x2d')]);return db[_0x0053('0x18')][_0x0053('0x2e')](_0x37d28a)[_0x0053('0x14')](handleEntityNotFound(_0x48bbc0,null))[_0x0053('0x14')](respondWithResult(_0x48bbc0,null))[_0x0053('0x1f')](handleError(_0x48bbc0,null));};exports['create']=function(_0x44b673,_0x3a5961){return db[_0x0053('0x18')][_0x0053('0x2f')](_0x44b673['body'],{})['then'](respondWithResult(_0x3a5961,0xc9))['catch'](handleError(_0x3a5961,null));};exports['update']=function(_0x48044f,_0x2b4dbb){if(_0x48044f[_0x0053('0x30')]['id']){delete _0x48044f[_0x0053('0x30')]['id'];}return db['OpenchannelInteraction'][_0x0053('0x2e')]({'where':{'id':_0x48044f[_0x0053('0x23')]['id']}})['then'](handleEntityNotFound(_0x2b4dbb,null))[_0x0053('0x14')](saveUpdates(_0x48044f['body'],null))[_0x0053('0x14')](respondWithResult(_0x2b4dbb,null))[_0x0053('0x1f')](handleError(_0x2b4dbb,null));};exports['destroy']=function(_0x168b89,_0x3f528d){return db[_0x0053('0x18')][_0x0053('0x2e')]({'where':{'id':_0x168b89[_0x0053('0x23')]['id']}})[_0x0053('0x14')](handleEntityNotFound(_0x3f528d,null))[_0x0053('0x14')](removeEntity(_0x3f528d,null))[_0x0053('0x1f')](handleError(_0x3f528d,null));};exports[_0x0053('0x31')]=function(_0x8a635,_0xa43a90){return db[_0x0053('0x18')]['describe']()[_0x0053('0x14')](respondWithResult(_0xa43a90,null))[_0x0053('0x1f')](handleError(_0xa43a90,null));};exports[_0x0053('0x32')]=function(_0x447824,_0x227566){return db[_0x0053('0x33')]['find']({'where':{'id':_0x447824[_0x0053('0x23')]['id']}})[_0x0053('0x14')](handleEntityNotFound(_0x227566,null))['then'](function(_0x56bb4c){if(_0x56bb4c){return _0x56bb4c[_0x0053('0x32')](_0x447824[_0x0053('0x30')][_0x0053('0x34')],_['omit'](_0x447824[_0x0053('0x30')],['ids','id'])||{});}})[_0x0053('0x14')](respondWithResult(_0x227566,null))[_0x0053('0x1f')](handleError(_0x227566,null));};exports[_0x0053('0x35')]=function(_0x125d80,_0x18f15d){var _0x6e33b6={'raw':![],'where':{}};var _0x505ae2={};var _0x3cccec={'count':0x0,'rows':[]};return db[_0x0053('0x18')][_0x0053('0x36')]({'where':{'id':_0x125d80['params']['id']}})[_0x0053('0x14')](handleEntityNotFound(_0x18f15d,null))[_0x0053('0x14')](function(_0x449fa6){if(_0x449fa6){_0x505ae2[_0x0053('0x24')]=_[_0x0053('0x25')](db['OpenchannelMessage'][_0x0053('0x19')]);_0x505ae2['query']=_[_0x0053('0x25')](_0x125d80[_0x0053('0x1d')]);_0x505ae2['filters']=_[_0x0053('0x28')](_0x505ae2[_0x0053('0x24')],_0x505ae2['query']);_0x6e33b6['attributes']=_['intersection'](_0x505ae2[_0x0053('0x24')],qs[_0x0053('0x29')](_0x125d80[_0x0053('0x1d')]['fields']));_0x6e33b6[_0x0053('0x27')]=_0x6e33b6[_0x0053('0x27')][_0x0053('0x2a')]?_0x6e33b6[_0x0053('0x27')]:_0x505ae2['model'];if(!_0x125d80[_0x0053('0x1d')]['hasOwnProperty']('nolimit')){_0x6e33b6[_0x0053('0x37')]=qs['limit'](_0x125d80[_0x0053('0x1d')]['limit']);_0x6e33b6[_0x0053('0xf')]=qs[_0x0053('0xf')](_0x125d80[_0x0053('0x1d')][_0x0053('0xf')]);}_0x6e33b6['order']=qs[_0x0053('0x38')](_0x125d80[_0x0053('0x1d')]['sort']);_0x6e33b6[_0x0053('0x39')]=qs[_0x0053('0x26')](_[_0x0053('0x3a')](_0x125d80[_0x0053('0x1d')],_0x505ae2[_0x0053('0x26')]));_0x6e33b6[_0x0053('0x39')][_0x0053('0x3b')]=_0x449fa6['id'];if(_0x125d80[_0x0053('0x1d')][_0x0053('0x3c')]){_0x6e33b6[_0x0053('0x39')]=_[_0x0053('0x3d')](_0x6e33b6[_0x0053('0x39')],{'$or':_[_0x0053('0x3e')](_0x6e33b6['attributes'],function(_0x30fca2){var _0x1ab116={};_0x1ab116[_0x30fca2]={'$like':'%'+_0x125d80[_0x0053('0x1d')][_0x0053('0x3c')]+'%'};return _0x1ab116;})});}if(_0x125d80[_0x0053('0x1d')][_0x0053('0x3f')]){var _0x4fff62=_0x125d80[_0x0053('0x1d')][_0x0053('0x3f')]['split'](',');var _0x40da14={};_0x40da14[_0x4fff62[0x0]]={'$gte':moment(_0x4fff62[0x1])[_0x0053('0x40')](_0x0053('0x41'))};_0x6e33b6[_0x0053('0x39')]=_[_0x0053('0x3d')](_0x6e33b6[_0x0053('0x39')],_0x40da14);}_0x6e33b6=_[_0x0053('0x3d')]({},_0x6e33b6,_0x125d80['options']);return db['OpenchannelMessage']['count']({'where':_0x6e33b6[_0x0053('0x39')]})['then'](function(_0x584628){_0x3cccec[_0x0053('0x11')]=_0x584628;if(_0x125d80[_0x0053('0x1d')][_0x0053('0x2b')]){_0x6e33b6[_0x0053('0x2c')]=[{'all':!![]}];}return db[_0x0053('0x33')][_0x0053('0x42')](_0x6e33b6);})[_0x0053('0x14')](function(_0x3c21bb){_0x3cccec[_0x0053('0x43')]=_0x3c21bb;return _0x3cccec;});}})['then'](respondWithFilteredResult(_0x18f15d,_0x6e33b6))[_0x0053('0x1f')](handleError(_0x18f15d,null));};exports[_0x0053('0x44')]=function(_0xf8be61,_0x429568){return db[_0x0053('0x18')][_0x0053('0x2e')]({'where':{'id':_0xf8be61['params']['id']}})['then'](handleEntityNotFound(_0x429568,null))['then'](function(_0x41e4c5){if(_0x41e4c5){return _0x41e4c5['setTags'](_0xf8be61['body']['ids'],_[_0x0053('0x45')](_0xf8be61[_0x0053('0x30')],[_0x0053('0x34'),'id'])||{})[_0x0053('0x46')](function(){return db[_0x0053('0x47')][_0x0053('0x42')]({'attributes':['id',_0x0053('0x16'),_0x0053('0x48')],'where':{'id':_0xf8be61[_0x0053('0x30')][_0x0053('0x34')]}});})['then'](function(_0x230783){socket['emit'](_0x0053('0x49'),{'id':Number(_0xf8be61[_0x0053('0x23')]['id']),'tags':_0x230783||[]});return{'id':Number(_0xf8be61[_0x0053('0x23')]['id']),'tags':_0x230783||[]};});}})[_0x0053('0x14')](respondWithResult(_0x429568,null))['catch'](handleError(_0x429568,null));};exports[_0x0053('0x4a')]=function(_0x1b3ac8,_0xf5dcf7){return db['OpenchannelInteraction']['find']({'where':{'id':_0x1b3ac8[_0x0053('0x23')]['id']}})['then'](handleEntityNotFound(_0xf5dcf7,null))[_0x0053('0x14')](function(_0x3c93c0){if(_0x3c93c0){return _0x3c93c0[_0x0053('0x4a')](_0x1b3ac8[_0x0053('0x1d')]['ids']);}})[_0x0053('0x14')](respondWithStatusCode(_0xf5dcf7,null))[_0x0053('0x1f')](handleError(_0xf5dcf7,null));};exports[_0x0053('0x4b')]=function(_0x55bb74,_0x2e3bcb){var _0x25b35a=moment()[_0x0053('0x4c')]()['toString']();var _0x416feb=path['join'](config[_0x0053('0x4d')],_0x0053('0x4e'),_0x0053('0x4f'),_0x0053('0x50'));var _0x56a91e=path[_0x0053('0x51')](config[_0x0053('0x4d')],_0x0053('0x4e'),'files','attachments');var _0x1516a7=path[_0x0053('0x51')](_0x416feb,_0x25b35a);var _0x4d6819=util[_0x0053('0x40')]('transcript-%d-%s.zip',_0x55bb74[_0x0053('0x23')]['id'],_0x25b35a);var _0x3c3ecd=path[_0x0053('0x51')](_0x416feb,_0x4d6819);var _0x548d47=[];_0x548d47[_0x0053('0x52')]({'model':db['User'],'as':'User','attributes':['id',_0x0053('0x53')],'raw':!![]});_0x548d47[_0x0053('0x52')]({'model':db[_0x0053('0x54')],'as':'Contact','attributes':['id',_0x0053('0x55'),_0x0053('0x56')],'raw':!![]});if(_0x55bb74[_0x0053('0x1d')][_0x0053('0x57')]){_0x548d47[_0x0053('0x52')]({'model':db[_0x0053('0x58')],'as':_0x0053('0x58'),'raw':!![]});}var _0x5797d6=[{'model':db[_0x0053('0x33')],'as':_0x0053('0x59'),'attributes':['id',_0x0053('0x30'),_0x0053('0x5a'),'direction',_0x0053('0x5b'),_0x0053('0x5c')],'include':_0x548d47}];_0x5797d6[_0x0053('0x52')]({'model':db['OpenchannelAccount'],'as':_0x0053('0x5d'),'attributes':['id','name']});_0x5797d6[_0x0053('0x52')]({'model':db[_0x0053('0x5e')],'as':_0x0053('0x5f'),'attributes':['id',_0x0053('0x53')]});return db[_0x0053('0x18')][_0x0053('0x2e')]({'where':{'id':_0x55bb74[_0x0053('0x23')]['id']},'include':_0x5797d6})[_0x0053('0x14')](handleEntityNotFound(_0x2e3bcb,null))[_0x0053('0x14')](function(_0x1cb99c){if(_0x1cb99c){var _0x46011c=_0x1cb99c[_0x0053('0x60')]({'plain':!![]});fs[_0x0053('0x61')](_0x1516a7);var _0x33ec10={'channel':'Openchannel','account':_0x46011c[_0x0053('0x5d')][_0x0053('0x16')],'agent':_0x46011c[_0x0053('0x5f')]?_0x46011c[_0x0053('0x5f')][_0x0053('0x53')]:'N.A.','createdAt':moment(_0x46011c[_0x0053('0x5a')])[_0x0053('0x40')](_0x0053('0x41'))[_0x0053('0x62')](),'closedAt':_0x46011c[_0x0053('0x63')]?moment(_0x46011c[_0x0053('0x64')])[_0x0053('0x40')](_0x0053('0x41'))['toString']():'','disposition':_0x46011c[_0x0053('0x65')],'visibility':_0x46011c['threadId']?_0x0053('0x66'):_0x0053('0x67'),'messages':_(_0x46011c['Messages'])[_0x0053('0x3c')]({'secret':![]})['map'](function(_0x2ac1dd){if(_0x2ac1dd['Attachment']){var _0x5ad040=path[_0x0053('0x51')](_0x56a91e,_0x2ac1dd[_0x0053('0x58')][_0x0053('0x68')]);if(fs[_0x0053('0x69')](_0x5ad040)){fs['createReadStream'](_0x5ad040)[_0x0053('0x6a')](fs['createWriteStream'](path['join'](_0x1516a7,_0x2ac1dd[_0x0053('0x58')][_0x0053('0x68')])));}}return{'date':moment(_0x2ac1dd['createdAt'])[_0x0053('0x40')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0053('0x62')](),'sender':_0x2ac1dd[_0x0053('0x6b')]===_0x0053('0x6c')?_0x2ac1dd['User']?_0x2ac1dd[_0x0053('0x5e')][_0x0053('0x53')]:_0x0053('0x6d'):_0x2ac1dd['Contact'][_0x0053('0x55')]+(_0x2ac1dd[_0x0053('0x6e')]['lastName']?'\x20'+_0x2ac1dd['Contact'][_0x0053('0x56')]:''),'body':_0x2ac1dd['Attachment']?_0x2ac1dd['Attachment']['basename']:_0x2ac1dd[_0x0053('0x30')],'direction':_0x2ac1dd[_0x0053('0x6b')]===_0x0053('0x6c')?'A':'C','secret':_0x2ac1dd[_0x0053('0x5b')],'read':_0x2ac1dd[_0x0053('0x5c')],'attachment':_0x2ac1dd['Attachment']};})[_0x0053('0x6f')]()};return ejs[_0x0053('0x70')](path['join'](config[_0x0053('0x4d')],_0x0053('0x4e'),'views',_0x0053('0x71')),{'interaction':_0x33ec10})[_0x0053('0x14')](function(_0xe14468){var _0x10c5e1=path[_0x0053('0x51')](_0x1516a7,_0x0053('0x72')+_0x46011c['id']+'-'+_0x25b35a+_0x0053('0x73'));var _0x1e06aa={'path':_0x10c5e1,'channel':'Openchannel','interactionId':_0x46011c['id']};return pdf[_0x0053('0x74')](_0xe14468,_0x1e06aa);})[_0x0053('0x14')](function(){return new Promise(function(_0x3b556d,_0x2c8cac){zipdir(_0x1516a7,{'saveTo':_0x3c3ecd},function(_0x108ac7,_0x474cd6){if(_0x108ac7)return _0x2c8cac(_0x108ac7);return _0x3b556d(_0x474cd6);});})['then'](function(){return new Promise(function(_0x2f0e3a,_0x354996){rimraf(_0x1516a7,function(_0x21612b){if(_0x21612b)_0x354996(_0x21612b);return _0x2f0e3a();});});})[_0x0053('0x14')](function(){return _0x2e3bcb[_0x0053('0x4b')](_0x3c3ecd,_0x4d6819,function(_0x47ab76){if(_0x47ab76){logger[_0x0053('0x75')](_0x0053('0x76'),_0x47ab76);}else{fs[_0x0053('0x77')](_0x3c3ecd);}});});});}else{return _0x2e3bcb[_0x0053('0x15')](0xc8);}})[_0x0053('0x1f')](handleError(_0x2e3bcb,null));}; \ No newline at end of file +var _0x42d1=['transcript-','.pdf','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','stack','name','index','map','OpenchannelInteraction','rawAttributes','fieldName','key','getOptions','findAll','openchannel','query','user','catch','from','params','model','keys','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','update','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','length','nolimit','order','sort','where','filters','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','removeTags','download','join','root','tmp','server','files','attachments','format','push','User','firstName','lastName','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Account','fullname','get','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','toString','disposition','threadId','Public','basename','pipe','createWriteStream','direction','out','System','Contact','value','renderFile','downloadInteraction.ejs'];(function(_0x3b0b96,_0x1dbc73){var _0x26524c=function(_0x4fdf11){while(--_0x4fdf11){_0x3b0b96['push'](_0x3b0b96['shift']());}};_0x26524c(++_0x1dbc73);}(_0x42d1,0x109));var _0x142d=function(_0x5e8b4d,_0x4e5ba1){_0x5e8b4d=_0x5e8b4d-0x0;var _0x5d0091=_0x42d1[_0x5e8b4d];return _0x5d0091;};'use strict';var rimraf=require(_0x142d('0x0'));var zipdir=require(_0x142d('0x1'));var moment=require(_0x142d('0x2'));var util=require(_0x142d('0x3'));var path=require(_0x142d('0x4'));var ejs=require(_0x142d('0x5'));var fs=require('fs');var _=require(_0x142d('0x6'));var Redis=require(_0x142d('0x7'));var interaction=require(_0x142d('0x8'));var qs=require(_0x142d('0x9'));var pdf=require(_0x142d('0xa'));var logger=require(_0x142d('0xb'))(_0x142d('0xc'));var config=require(_0x142d('0xd'));var db=require(_0x142d('0xe'))['db'];config[_0x142d('0xf')]=_['defaults'](config[_0x142d('0xf')],{'host':_0x142d('0x10'),'port':0x18eb});var socket=require(_0x142d('0x11'))(new Redis(config[_0x142d('0xf')]));require(_0x142d('0x12'))[_0x142d('0x13')](socket);function respondWithStatusCode(_0x255630,_0x6d1331){_0x6d1331=_0x6d1331||0xcc;return function(_0x1e2d95){if(_0x1e2d95){return _0x255630[_0x142d('0x14')](_0x6d1331);}return _0x255630[_0x142d('0x15')](_0x6d1331)[_0x142d('0x16')]();};}function respondWithResult(_0x49b59f,_0x14ea27){_0x14ea27=_0x14ea27||0xc8;return function(_0x163084){if(_0x163084){return _0x49b59f['status'](_0x14ea27)[_0x142d('0x17')](_0x163084);}};}function respondWithFilteredResult(_0x59e3d0,_0x159418){return function(_0x60d2c3){if(_0x60d2c3){var _0x4c9e12=typeof _0x159418[_0x142d('0x18')]===_0x142d('0x19')&&typeof _0x159418['limit']==='undefined';var _0x2c4cd8=_0x60d2c3[_0x142d('0x1a')];var _0x21c878=_0x4c9e12?0x0:_0x159418[_0x142d('0x18')];var _0x53a32b=_0x4c9e12?_0x60d2c3[_0x142d('0x1a')]:_0x159418['offset']+_0x159418[_0x142d('0x1b')];var _0x55cee4;if(_0x53a32b>=_0x2c4cd8){_0x53a32b=_0x2c4cd8;_0x55cee4=0xc8;}else{_0x55cee4=0xce;}_0x59e3d0[_0x142d('0x15')](_0x55cee4);return _0x59e3d0[_0x142d('0x1c')](_0x142d('0x1d'),_0x21c878+'-'+_0x53a32b+'/'+_0x2c4cd8)[_0x142d('0x17')](_0x60d2c3);}return null;};}function saveUpdates(_0x5423d7){return function(_0x2eef26){if(_0x2eef26){return _0x2eef26['update'](_0x5423d7)[_0x142d('0x1e')](function(_0x572a3d){return _0x572a3d;});}return null;};}function removeEntity(_0x1638d6){return function(_0x5bc1ab){if(_0x5bc1ab){return _0x5bc1ab[_0x142d('0x1f')]()[_0x142d('0x1e')](function(){_0x1638d6[_0x142d('0x15')](0xcc)[_0x142d('0x16')]();});}};}function handleEntityNotFound(_0x544a4f){return function(_0x2b8c0d){if(!_0x2b8c0d){_0x544a4f['sendStatus'](0x194);}return _0x2b8c0d;};}function handleError(_0x4c2317,_0x4ded03){_0x4ded03=_0x4ded03||0x1f4;return function(_0x10f8b8){logger['error'](_0x10f8b8[_0x142d('0x20')]);if(_0x10f8b8[_0x142d('0x21')]){delete _0x10f8b8[_0x142d('0x21')];}_0x4c2317[_0x142d('0x15')](_0x4ded03)['send'](_0x10f8b8);};}exports[_0x142d('0x22')]=function(_0x127bdd,_0x24547e){var _0x231ebe={};var _0x45b7f2=_[_0x142d('0x23')](db[_0x142d('0x24')][_0x142d('0x25')],function(_0x27d1cf){return{'name':_0x27d1cf[_0x142d('0x26')],'type':_0x27d1cf['type'][_0x142d('0x27')]};});_0x231ebe=qs[_0x142d('0x28')](_0x45b7f2,_0x127bdd);return interaction[_0x142d('0x29')](_0x142d('0x2a'),_0x127bdd[_0x142d('0x2b')],_0x127bdd[_0x142d('0x2c')],_0x231ebe,_0x45b7f2)['then'](respondWithFilteredResult(_0x24547e,_0x231ebe))[_0x142d('0x2d')](handleError(_0x24547e,null));};exports['show']=function(_0x3c3924,_0x2cce68){var _0x2e84fc={};if(_0x3c3924[_0x142d('0x2b')]['type']&&_0x3c3924[_0x142d('0x2b')]['type']===_0x142d('0x2e')){_0x2e84fc[_0x142d('0x2e')]=_0x3c3924['params']['id'];}else{_0x2e84fc['id']=_0x3c3924[_0x142d('0x2f')]['id'];}var _0xbd637={'raw':![],'where':_0x2e84fc},_0x21c1a7={};_0x21c1a7[_0x142d('0x30')]=_[_0x142d('0x31')](db['OpenchannelInteraction']['rawAttributes']);_0x21c1a7[_0x142d('0x2b')]=_['keys'](_0x3c3924[_0x142d('0x2b')]);_0x21c1a7['filters']=_[_0x142d('0x32')](_0x21c1a7[_0x142d('0x30')],_0x21c1a7[_0x142d('0x2b')]);_0xbd637[_0x142d('0x33')]=_[_0x142d('0x32')](_0x21c1a7[_0x142d('0x30')],qs[_0x142d('0x34')](_0x3c3924[_0x142d('0x2b')][_0x142d('0x34')]));_0xbd637[_0x142d('0x33')]=_0xbd637['attributes']['length']?_0xbd637[_0x142d('0x33')]:_0x21c1a7[_0x142d('0x30')];if(_0x3c3924[_0x142d('0x2b')][_0x142d('0x35')]){_0xbd637[_0x142d('0x36')]=[{'all':!![]}];}_0xbd637=_[_0x142d('0x37')]({},_0xbd637,_0x3c3924[_0x142d('0x38')]);return db['OpenchannelInteraction'][_0x142d('0x39')](_0xbd637)['then'](handleEntityNotFound(_0x2cce68,null))['then'](respondWithResult(_0x2cce68,null))['catch'](handleError(_0x2cce68,null));};exports[_0x142d('0x3a')]=function(_0x385a00,_0xf81bab){return db[_0x142d('0x24')]['create'](_0x385a00[_0x142d('0x3b')],{})['then'](respondWithResult(_0xf81bab,0xc9))[_0x142d('0x2d')](handleError(_0xf81bab,null));};exports[_0x142d('0x3c')]=function(_0x575b2a,_0x5158c6){if(_0x575b2a['body']['id']){delete _0x575b2a[_0x142d('0x3b')]['id'];}return db['OpenchannelInteraction'][_0x142d('0x39')]({'where':{'id':_0x575b2a[_0x142d('0x2f')]['id']}})['then'](handleEntityNotFound(_0x5158c6,null))['then'](saveUpdates(_0x575b2a[_0x142d('0x3b')],null))['then'](respondWithResult(_0x5158c6,null))['catch'](handleError(_0x5158c6,null));};exports[_0x142d('0x1f')]=function(_0x41705e,_0x2125c6){return db['OpenchannelInteraction'][_0x142d('0x39')]({'where':{'id':_0x41705e[_0x142d('0x2f')]['id']}})[_0x142d('0x1e')](handleEntityNotFound(_0x2125c6,null))['then'](removeEntity(_0x2125c6,null))[_0x142d('0x2d')](handleError(_0x2125c6,null));};exports[_0x142d('0x3d')]=function(_0x146fc9,_0x4c5e5e){return db[_0x142d('0x24')][_0x142d('0x3d')]()['then'](respondWithResult(_0x4c5e5e,null))[_0x142d('0x2d')](handleError(_0x4c5e5e,null));};exports[_0x142d('0x3e')]=function(_0x5fd5a0,_0x3c1602){return db[_0x142d('0x3f')][_0x142d('0x39')]({'where':{'id':_0x5fd5a0['params']['id']}})[_0x142d('0x1e')](handleEntityNotFound(_0x3c1602,null))[_0x142d('0x1e')](function(_0x4dbb54){if(_0x4dbb54){return _0x4dbb54[_0x142d('0x3e')](_0x5fd5a0[_0x142d('0x3b')][_0x142d('0x40')],_[_0x142d('0x41')](_0x5fd5a0[_0x142d('0x3b')],[_0x142d('0x40'),'id'])||{});}})[_0x142d('0x1e')](respondWithResult(_0x3c1602,null))[_0x142d('0x2d')](handleError(_0x3c1602,null));};exports[_0x142d('0x42')]=function(_0x6b2a65,_0x3dd1d1){var _0x19f052={'raw':![],'where':{}};var _0x45320f={};var _0xeddf10={'count':0x0,'rows':[]};return db[_0x142d('0x24')][_0x142d('0x43')]({'where':{'id':_0x6b2a65[_0x142d('0x2f')]['id']}})['then'](handleEntityNotFound(_0x3dd1d1,null))[_0x142d('0x1e')](function(_0x4f6d8e){if(_0x4f6d8e){_0x45320f[_0x142d('0x30')]=_[_0x142d('0x31')](db['OpenchannelMessage'][_0x142d('0x25')]);_0x45320f['query']=_['keys'](_0x6b2a65[_0x142d('0x2b')]);_0x45320f['filters']=_[_0x142d('0x32')](_0x45320f[_0x142d('0x30')],_0x45320f[_0x142d('0x2b')]);_0x19f052[_0x142d('0x33')]=_['intersection'](_0x45320f[_0x142d('0x30')],qs[_0x142d('0x34')](_0x6b2a65['query'][_0x142d('0x34')]));_0x19f052[_0x142d('0x33')]=_0x19f052[_0x142d('0x33')][_0x142d('0x44')]?_0x19f052['attributes']:_0x45320f[_0x142d('0x30')];if(!_0x6b2a65['query']['hasOwnProperty'](_0x142d('0x45'))){_0x19f052[_0x142d('0x1b')]=qs['limit'](_0x6b2a65[_0x142d('0x2b')]['limit']);_0x19f052['offset']=qs[_0x142d('0x18')](_0x6b2a65[_0x142d('0x2b')][_0x142d('0x18')]);}_0x19f052[_0x142d('0x46')]=qs[_0x142d('0x47')](_0x6b2a65[_0x142d('0x2b')][_0x142d('0x47')]);_0x19f052[_0x142d('0x48')]=qs[_0x142d('0x49')](_['pick'](_0x6b2a65[_0x142d('0x2b')],_0x45320f[_0x142d('0x49')]));_0x19f052['where']['OpenchannelInteractionId']=_0x4f6d8e['id'];if(_0x6b2a65[_0x142d('0x2b')][_0x142d('0x4a')]){_0x19f052[_0x142d('0x48')]=_[_0x142d('0x37')](_0x19f052[_0x142d('0x48')],{'$or':_[_0x142d('0x23')](_0x19f052['attributes'],function(_0x52797a){var _0x162ebb={};_0x162ebb[_0x52797a]={'$like':'%'+_0x6b2a65[_0x142d('0x2b')][_0x142d('0x4a')]+'%'};return _0x162ebb;})});}if(_0x6b2a65[_0x142d('0x2b')][_0x142d('0x4b')]){var _0x209f33=_0x6b2a65[_0x142d('0x2b')][_0x142d('0x4b')][_0x142d('0x4c')](',');var _0xd7c866={};_0xd7c866[_0x209f33[0x0]]={'$gte':moment(_0x209f33[0x1])['format'](_0x142d('0x4d'))};_0x19f052['where']=_[_0x142d('0x37')](_0x19f052[_0x142d('0x48')],_0xd7c866);}_0x19f052=_[_0x142d('0x37')]({},_0x19f052,_0x6b2a65[_0x142d('0x38')]);return db[_0x142d('0x3f')][_0x142d('0x1a')]({'where':_0x19f052[_0x142d('0x48')]})[_0x142d('0x1e')](function(_0x2001ca){_0xeddf10[_0x142d('0x1a')]=_0x2001ca;if(_0x6b2a65['query'][_0x142d('0x35')]){_0x19f052['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x142d('0x29')](_0x19f052);})[_0x142d('0x1e')](function(_0x2295d1){_0xeddf10[_0x142d('0x4e')]=_0x2295d1;return _0xeddf10;});}})[_0x142d('0x1e')](respondWithFilteredResult(_0x3dd1d1,_0x19f052))[_0x142d('0x2d')](handleError(_0x3dd1d1,null));};exports[_0x142d('0x4f')]=function(_0x4efa2d,_0x4e8aeb){return db[_0x142d('0x24')][_0x142d('0x39')]({'where':{'id':_0x4efa2d['params']['id']}})[_0x142d('0x1e')](handleEntityNotFound(_0x4e8aeb,null))['then'](function(_0x2ec775){if(_0x2ec775){return _0x2ec775['setTags'](_0x4efa2d[_0x142d('0x3b')][_0x142d('0x40')],_[_0x142d('0x41')](_0x4efa2d[_0x142d('0x3b')],['ids','id'])||{})[_0x142d('0x50')](function(){return db[_0x142d('0x51')][_0x142d('0x29')]({'attributes':['id',_0x142d('0x21'),_0x142d('0x52')],'where':{'id':_0x4efa2d[_0x142d('0x3b')][_0x142d('0x40')]}});})['then'](function(_0x1111fc){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x4efa2d[_0x142d('0x2f')]['id']),'tags':_0x1111fc||[]});return{'id':Number(_0x4efa2d[_0x142d('0x2f')]['id']),'tags':_0x1111fc||[]};});}})[_0x142d('0x1e')](respondWithResult(_0x4e8aeb,null))['catch'](handleError(_0x4e8aeb,null));};exports['removeTags']=function(_0x1cff70,_0x21b9fc){return db[_0x142d('0x24')][_0x142d('0x39')]({'where':{'id':_0x1cff70[_0x142d('0x2f')]['id']}})[_0x142d('0x1e')](handleEntityNotFound(_0x21b9fc,null))['then'](function(_0x5dde80){if(_0x5dde80){return _0x5dde80[_0x142d('0x53')](_0x1cff70[_0x142d('0x2b')][_0x142d('0x40')]);}})[_0x142d('0x1e')](respondWithStatusCode(_0x21b9fc,null))[_0x142d('0x2d')](handleError(_0x21b9fc,null));};exports[_0x142d('0x54')]=function(_0x3ba1ed,_0x3b96d4){var _0x17d32e=moment()['unix']()['toString']();var _0x383c15=path[_0x142d('0x55')](config[_0x142d('0x56')],'server','files',_0x142d('0x57'));var _0x5dff00=path[_0x142d('0x55')](config['root'],_0x142d('0x58'),_0x142d('0x59'),_0x142d('0x5a'));var _0x4c6d28=path['join'](_0x383c15,_0x17d32e);var _0x5ab9be=util[_0x142d('0x5b')]('transcript-%d-%s.zip',_0x3ba1ed[_0x142d('0x2f')]['id'],_0x17d32e);var _0x319dc3=path[_0x142d('0x55')](_0x383c15,_0x5ab9be);var _0x75752e=[];_0x75752e[_0x142d('0x5c')]({'model':db[_0x142d('0x5d')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x75752e[_0x142d('0x5c')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x142d('0x5e'),_0x142d('0x5f')],'raw':!![]});if(_0x3ba1ed['query'][_0x142d('0x5a')]){_0x75752e[_0x142d('0x5c')]({'model':db[_0x142d('0x60')],'as':_0x142d('0x60'),'raw':!![]});}var _0x27155a=[{'model':db['OpenchannelMessage'],'as':_0x142d('0x61'),'attributes':['id',_0x142d('0x3b'),_0x142d('0x62'),'direction',_0x142d('0x63'),_0x142d('0x64')],'include':_0x75752e}];_0x27155a[_0x142d('0x5c')]({'model':db[_0x142d('0x65')],'as':_0x142d('0x66'),'attributes':['id',_0x142d('0x21')]});_0x27155a[_0x142d('0x5c')]({'model':db['User'],'as':'Owner','attributes':['id',_0x142d('0x67')]});return db[_0x142d('0x24')][_0x142d('0x39')]({'where':{'id':_0x3ba1ed['params']['id']},'include':_0x27155a})[_0x142d('0x1e')](handleEntityNotFound(_0x3b96d4,null))['then'](function(_0x13adc4){if(_0x13adc4){var _0x3f270f=_0x13adc4[_0x142d('0x68')]({'plain':!![]});fs[_0x142d('0x69')](_0x4c6d28);var _0x358675={'channel':_0x142d('0x6a'),'account':_0x3f270f['Account']['name'],'agent':_0x3f270f[_0x142d('0x6b')]?_0x3f270f['Owner'][_0x142d('0x67')]:_0x142d('0x6c'),'createdAt':moment(_0x3f270f[_0x142d('0x62')])[_0x142d('0x5b')](_0x142d('0x4d'))['toString'](),'closedAt':_0x3f270f[_0x142d('0x6d')]?moment(_0x3f270f[_0x142d('0x6e')])[_0x142d('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')[_0x142d('0x6f')]():'','disposition':_0x3f270f[_0x142d('0x70')],'visibility':_0x3f270f[_0x142d('0x71')]?_0x142d('0x72'):'Private','messages':_(_0x3f270f[_0x142d('0x61')])['filter']({'secret':![]})[_0x142d('0x23')](function(_0x41e884){if(_0x41e884[_0x142d('0x60')]){var _0x2ce54e=path['join'](_0x5dff00,_0x41e884[_0x142d('0x60')][_0x142d('0x73')]);if(fs['existsSync'](_0x2ce54e)){fs['createReadStream'](_0x2ce54e)[_0x142d('0x74')](fs[_0x142d('0x75')](path['join'](_0x4c6d28,_0x41e884[_0x142d('0x60')]['basename'])));}}return{'date':moment(_0x41e884[_0x142d('0x62')])['format'](_0x142d('0x4d'))[_0x142d('0x6f')](),'sender':_0x41e884[_0x142d('0x76')]===_0x142d('0x77')?_0x41e884['User']?_0x41e884[_0x142d('0x5d')][_0x142d('0x67')]:_0x142d('0x78'):_0x41e884[_0x142d('0x79')][_0x142d('0x5e')]+(_0x41e884[_0x142d('0x79')][_0x142d('0x5f')]?'\x20'+_0x41e884[_0x142d('0x79')][_0x142d('0x5f')]:''),'body':_0x41e884[_0x142d('0x60')]?_0x41e884[_0x142d('0x60')][_0x142d('0x73')]:_0x41e884[_0x142d('0x3b')],'direction':_0x41e884[_0x142d('0x76')]===_0x142d('0x77')?'A':'C','secret':_0x41e884[_0x142d('0x63')],'read':_0x41e884[_0x142d('0x64')],'attachment':_0x41e884[_0x142d('0x60')]};})[_0x142d('0x7a')]()};return ejs[_0x142d('0x7b')](path[_0x142d('0x55')](config[_0x142d('0x56')],_0x142d('0x58'),'views',_0x142d('0x7c')),{'interaction':_0x358675})[_0x142d('0x1e')](function(_0x4a0a73){var _0x25e61c=path[_0x142d('0x55')](_0x4c6d28,_0x142d('0x7d')+_0x3f270f['id']+'-'+_0x17d32e+_0x142d('0x7e'));var _0x11850a={'path':_0x25e61c,'channel':_0x142d('0x6a'),'interactionId':_0x3f270f['id']};return pdf['createPdfFromHTML'](_0x4a0a73,_0x11850a);})['then'](function(){return new Promise(function(_0xa615a7,_0x52a96d){zipdir(_0x4c6d28,{'saveTo':_0x319dc3},function(_0x4eb774,_0x443e4c){if(_0x4eb774)return _0x52a96d(_0x4eb774);return _0xa615a7(_0x443e4c);});})[_0x142d('0x1e')](function(){return new Promise(function(_0x3d14e1,_0x2c129a){rimraf(_0x4c6d28,function(_0x32848e){if(_0x32848e)_0x2c129a(_0x32848e);return _0x3d14e1();});});})[_0x142d('0x1e')](function(){return _0x3b96d4['download'](_0x319dc3,_0x5ab9be,function(_0x2cf623){if(_0x2cf623){logger[_0x142d('0x7f')](_0x142d('0x80'),_0x2cf623);}else{fs[_0x142d('0x81')](_0x319dc3);}});});});}else{return _0x3b96d4[_0x142d('0x14')](0xc8);}})[_0x142d('0x2d')](handleError(_0x3b96d4,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 3031090..8c4c092 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 _0x9936=['../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','Users','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x9936,0x76));var _0x6993=function(_0x250c78,_0x25b838){_0x250c78=_0x250c78-0x0;var _0x44f07a=_0x9936[_0x250c78];return _0x44f07a;};'use strict';var EventEmitter=require(_0x6993('0x0'));var OpenchannelInteraction=require(_0x6993('0x1'))['db'][_0x6993('0x2')];var OpenchannelMessage=require(_0x6993('0x1'))['db'][_0x6993('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6993('0x4')](0x0);var events={'afterCreate':_0x6993('0x5'),'afterUpdate':_0x6993('0x6'),'afterDestroy':_0x6993('0x7')};function emitEvent(_0x9e9c40){return function(_0x119034,_0x111d50,_0x4e1c16){_0x119034[_0x6993('0x8')]({'attributes':['id'],'raw':!![]})[_0x6993('0x9')](function(_0xce78fc){_0x119034['setDataValue'](_0x6993('0xa'),_0xce78fc['map'](function(_0xf0b0cb){return{'id':_0xf0b0cb['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x119034['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6993('0x9')](function(_0xb8acba){_0x119034['setDataValue']('unreadMessages',_0xb8acba[_0x6993('0xb')]);OpenchannelInteractionEvents[_0x6993('0xc')](_0x9e9c40+':'+_0x119034['id'],_0x119034);OpenchannelInteractionEvents[_0x6993('0xc')](_0x9e9c40,_0x119034);_0x4e1c16(null);})[_0x6993('0xd')](_0x4e1c16(null));};}for(var e in events){if(events[_0x6993('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x6993('0xf')](e,emitEvent(event));}}module[_0x6993('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xeace=['OpenchannelInteraction','OpenchannelMessage','save','update','remove','then','setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x294324,_0x404a3b){var _0xa29832=function(_0x5df4b6){while(--_0x5df4b6){_0x294324['push'](_0x294324['shift']());}};_0xa29832(++_0x404a3b);}(_0xeace,0xdb));var _0xeeac=function(_0x9c5d49,_0x4c5be1){_0x9c5d49=_0x9c5d49-0x0;var _0xbdb53d=_0xeace[_0x9c5d49];return _0xbdb53d;};'use strict';var EventEmitter=require(_0xeeac('0x0'));var OpenchannelInteraction=require(_0xeeac('0x1'))['db'][_0xeeac('0x2')];var OpenchannelMessage=require(_0xeeac('0x1'))['db'][_0xeeac('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeeac('0x4'),'afterUpdate':_0xeeac('0x5'),'afterDestroy':_0xeeac('0x6')};function emitEvent(_0x56dcb1){return function(_0x4b861b,_0x14018b,_0x483bcb){_0x4b861b['getUsers']({'attributes':['id'],'raw':!![]})[_0xeeac('0x7')](function(_0x3a5ded){_0x4b861b[_0xeeac('0x8')]('Users',_0x3a5ded[_0xeeac('0x9')](function(_0x81ad85){return{'id':_0x81ad85['id']};}));return OpenchannelMessage[_0xeeac('0xa')]({'where':{'OpenchannelInteractionId':_0x4b861b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeeac('0x7')](function(_0x594983){_0x4b861b[_0xeeac('0x8')](_0xeeac('0xb'),_0x594983['length']);OpenchannelInteractionEvents['emit'](_0x56dcb1+':'+_0x4b861b['id'],_0x4b861b);OpenchannelInteractionEvents[_0xeeac('0xc')](_0x56dcb1,_0x4b861b);_0x483bcb(null);})[_0xeeac('0xd')](_0x483bcb(null));};}for(var e in events){if(events[_0xeeac('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xeeac('0xf')](e,emitEvent(event));}}module[_0xeeac('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 72372e1..b8bbaf4 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 _0xe635=['define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelInteraction.attributes','exports'];(function(_0x4df6f9,_0x44bd65){var _0x4b1a73=function(_0xf5adb7){while(--_0xf5adb7){_0x4df6f9['push'](_0x4df6f9['shift']());}};_0x4b1a73(++_0x44bd65);}(_0xe635,0x1be));var _0x5e63=function(_0xf3a659,_0x33a393){_0xf3a659=_0xf3a659-0x0;var _0x2ec619=_0xe635[_0xf3a659];return _0x2ec619;};'use strict';var _=require(_0x5e63('0x0'));var util=require(_0x5e63('0x1'));var logger=require(_0x5e63('0x2'))(_0x5e63('0x3'));var moment=require(_0x5e63('0x4'));var BPromise=require(_0x5e63('0x5'));var rp=require(_0x5e63('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5e63('0x7'));var attributes=require(_0x5e63('0x8'));module[_0x5e63('0x9')]=function(_0x41fdd1,_0x2d48ac){return _0x41fdd1[_0x5e63('0xa')](_0x5e63('0xb'),attributes,{'tableName':_0x5e63('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5e63('0xd'),'collate':_0x5e63('0xe'),'hooks':{'beforeUpdate':function(_0x5cba07,_0x2794dc,_0x13501d){if(_0x5cba07[_0x5e63('0xf')](_0x5e63('0x10'))){_0x5cba07['closedAt']=moment()[_0x5e63('0x11')](_0x5e63('0x12'));}_0x13501d(null,_0x5cba07);}}});}; \ No newline at end of file +var _0x9a04=['rimraf','../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','path'];(function(_0x4c2f30,_0xa91340){var _0xb8854d=function(_0x5ddf3d){while(--_0x5ddf3d){_0x4c2f30['push'](_0x4c2f30['shift']());}};_0xb8854d(++_0xa91340);}(_0x9a04,0x1af));var _0x49a0=function(_0x112f22,_0xa6482d){_0x112f22=_0x112f22-0x0;var _0x4dd452=_0x9a04[_0x112f22];return _0x4dd452;};'use strict';var _=require('lodash');var util=require(_0x49a0('0x0'));var logger=require(_0x49a0('0x1'))(_0x49a0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x49a0('0x3'));var rimraf=require(_0x49a0('0x4'));var config=require(_0x49a0('0x5'));var attributes=require(_0x49a0('0x6'));module['exports']=function(_0x82f46b,_0x40740b){return _0x82f46b['define'](_0x49a0('0x7'),attributes,{'tableName':_0x49a0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x49a0('0x9'),'collate':_0x49a0('0xa'),'hooks':{'beforeUpdate':function(_0x2ec111,_0x5d2545,_0x1cc8cd){if(_0x2ec111['changed'](_0x49a0('0xb'))){_0x2ec111[_0x49a0('0xc')]=moment()[_0x49a0('0xd')](_0x49a0('0xe'));}_0x1cc8cd(null,_0x2ec111);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 3727954..a03a287 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 _0xedd4=['socket.io-emitter','redis','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','spread','AddTags','util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','localhost'];(function(_0x389d7c,_0x12041f){var _0x5da054=function(_0xc23dc6){while(--_0xc23dc6){_0x389d7c['push'](_0x389d7c['shift']());}};_0x5da054(++_0x12041f);}(_0xedd4,0x10e));var _0x4edd=function(_0x1b89df,_0x4cd3e9){_0x1b89df=_0x1b89df-0x0;var _0x1478a7=_0xedd4[_0x1b89df];return _0x1478a7;};'use strict';var _=require('lodash');var util=require(_0x4edd('0x0'));var moment=require('moment');var BPromise=require(_0x4edd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4edd('0x2'))['db'];var utils=require(_0x4edd('0x3'));var logger=require('../../config/logger')(_0x4edd('0x4'));var config=require('../../config/environment');var jayson=require(_0x4edd('0x5'));var client=jayson[_0x4edd('0x6')][_0x4edd('0x7')]({'port':0x232a});config['redis']=_[_0x4edd('0x8')](config['redis'],{'host':_0x4edd('0x9'),'port':0x18eb});var socket=require(_0x4edd('0xa'))(new Redis(config[_0x4edd('0xb')]));require('./openchannelInteraction.socket')[_0x4edd('0xc')](socket);function respondWithRpcPromise(_0x94e200,_0x353e16,_0x2154b8){return new BPromise(function(_0x2a43ee,_0x4d8ad9){return client[_0x4edd('0xd')](_0x94e200,_0x2154b8)[_0x4edd('0xe')](function(_0x37303c){logger[_0x4edd('0xf')](_0x4edd('0x10'),_0x353e16,'request\x20sent');logger[_0x4edd('0x11')](_0x4edd('0x12'),_0x353e16,'request\x20sent',JSON[_0x4edd('0x13')](_0x37303c));if(_0x37303c[_0x4edd('0x14')]){if(_0x37303c['error']['code']===0x1f4){logger[_0x4edd('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x353e16,_0x37303c[_0x4edd('0x14')][_0x4edd('0x15')]);return _0x4d8ad9(_0x37303c['error'][_0x4edd('0x15')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x353e16,_0x37303c[_0x4edd('0x14')][_0x4edd('0x15')]);return _0x2a43ee(_0x37303c[_0x4edd('0x14')][_0x4edd('0x15')]);}else{logger[_0x4edd('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x353e16,_0x4edd('0x16'));_0x2a43ee(_0x37303c[_0x4edd('0x17')]['message']);}})[_0x4edd('0x18')](function(_0x12cead){logger['error'](_0x4edd('0x10'),_0x353e16,_0x12cead);_0x4d8ad9(_0x12cead);});});}exports[_0x4edd('0x19')]=function(_0x50d4dc){var _0x433110=this;return new Promise(function(_0x7242ad,_0x3c4e68){return db[_0x4edd('0x1a')][_0x4edd('0x1b')](_0x50d4dc[_0x4edd('0x1c')],{'raw':_0x50d4dc[_0x4edd('0x1d')]?_0x50d4dc['options'][_0x4edd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50d4dc[_0x4edd('0x1d')]?_0x50d4dc['options'][_0x4edd('0x1f')]||null:null,'attributes':_0x50d4dc['options']?_0x50d4dc[_0x4edd('0x1d')][_0x4edd('0x20')]||null:null,'limit':_0x50d4dc[_0x4edd('0x1d')]?_0x50d4dc[_0x4edd('0x1d')][_0x4edd('0x21')]||null:null})[_0x4edd('0xe')](function(_0x7e473c){logger[_0x4edd('0xf')]('UpdateOpenchannelInteraction',_0x50d4dc);logger[_0x4edd('0x11')](_0x4edd('0x19'),_0x50d4dc,JSON[_0x4edd('0x13')](_0x7e473c));_0x7242ad(_0x7e473c);})[_0x4edd('0x18')](function(_0x5e7d42){logger[_0x4edd('0x14')](_0x4edd('0x19'),_0x5e7d42['message'],_0x50d4dc);_0x3c4e68(_0x433110[_0x4edd('0x14')](0x1f4,_0x5e7d42[_0x4edd('0x15')]));});});};exports[_0x4edd('0x22')]=function(_0xf6f89c){return new Promise(function(_0x226971,_0x12c4c6){return db['OpenchannelInteraction'][_0x4edd('0x23')]({'where':_0xf6f89c[_0x4edd('0x1d')]?_0xf6f89c[_0x4edd('0x1d')][_0x4edd('0x1f')]||null:null})[_0x4edd('0xe')](function(_0x4c8d87){if(_0x4c8d87){return _0x4c8d87[_0x4edd('0x24')](_0xf6f89c[_0x4edd('0x1c')][_0x4edd('0x25')],_['omit'](_0xf6f89c[_0x4edd('0x1c')],[_0x4edd('0x25'),'id'])||{});}})[_0x4edd('0x26')](function(_0x427aeb){logger[_0x4edd('0xf')](_0x4edd('0x27'),_0xf6f89c);logger[_0x4edd('0x11')](_0x4edd('0x27'),_0xf6f89c,JSON[_0x4edd('0x13')](_0x427aeb));_0x226971(_0x427aeb);})[_0x4edd('0x18')](function(_0x26d17b){logger[_0x4edd('0x14')](_0x4edd('0x27'),_0x26d17b[_0x4edd('0x15')],_0xf6f89c);_0x12c4c6(_this[_0x4edd('0x14')](0x1f4,_0x26d17b[_0x4edd('0x15')]));});});}; \ No newline at end of file +var _0xf507=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','update','body','options','attributes','AddTagsToOpenchannelInteraction','OpenchannelInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf507,0x75));var _0x7f50=function(_0x434339,_0x2abf5e){_0x434339=_0x434339-0x0;var _0x507ca6=_0xf507[_0x434339];return _0x507ca6;};'use strict';var _=require(_0x7f50('0x0'));var util=require(_0x7f50('0x1'));var moment=require(_0x7f50('0x2'));var BPromise=require(_0x7f50('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f50('0x4'));var db=require(_0x7f50('0x5'))['db'];var utils=require(_0x7f50('0x6'));var logger=require('../../config/logger')(_0x7f50('0x7'));var config=require(_0x7f50('0x8'));var jayson=require(_0x7f50('0x9'));var client=jayson[_0x7f50('0xa')][_0x7f50('0xb')]({'port':0x232a});config[_0x7f50('0xc')]=_['defaults'](config[_0x7f50('0xc')],{'host':_0x7f50('0xd'),'port':0x18eb});var socket=require(_0x7f50('0xe'))(new Redis(config[_0x7f50('0xc')]));require('./openchannelInteraction.socket')[_0x7f50('0xf')](socket);function respondWithRpcPromise(_0x3483dc,_0x4c2522,_0x408f7b){return new BPromise(function(_0x17e196,_0x532655){return client[_0x7f50('0x10')](_0x3483dc,_0x408f7b)[_0x7f50('0x11')](function(_0x5bf59d){logger[_0x7f50('0x12')](_0x7f50('0x13'),_0x4c2522,_0x7f50('0x14'));logger[_0x7f50('0x15')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x4c2522,_0x7f50('0x14'),JSON[_0x7f50('0x16')](_0x5bf59d));if(_0x5bf59d['error']){if(_0x5bf59d[_0x7f50('0x17')][_0x7f50('0x18')]===0x1f4){logger[_0x7f50('0x17')](_0x7f50('0x13'),_0x4c2522,_0x5bf59d[_0x7f50('0x17')]['message']);return _0x532655(_0x5bf59d[_0x7f50('0x17')][_0x7f50('0x19')]);}logger['error'](_0x7f50('0x13'),_0x4c2522,_0x5bf59d[_0x7f50('0x17')][_0x7f50('0x19')]);return _0x17e196(_0x5bf59d[_0x7f50('0x17')]['message']);}else{logger['info'](_0x7f50('0x13'),_0x4c2522,'request\x20sent');_0x17e196(_0x5bf59d[_0x7f50('0x1a')][_0x7f50('0x19')]);}})[_0x7f50('0x1b')](function(_0xdc2d1){logger[_0x7f50('0x17')](_0x7f50('0x13'),_0x4c2522,_0xdc2d1);_0x532655(_0xdc2d1);});});}exports[_0x7f50('0x1c')]=function(_0x3e0016){var _0x1197ed=this;return new Promise(function(_0x4a7e13,_0x2f4a07){return db['OpenchannelInteraction'][_0x7f50('0x1d')](_0x3e0016[_0x7f50('0x1e')],{'raw':_0x3e0016[_0x7f50('0x1f')]?_0x3e0016[_0x7f50('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e0016[_0x7f50('0x1f')]?_0x3e0016[_0x7f50('0x1f')]['where']||null:null,'attributes':_0x3e0016[_0x7f50('0x1f')]?_0x3e0016[_0x7f50('0x1f')][_0x7f50('0x20')]||null:null,'limit':_0x3e0016[_0x7f50('0x1f')]?_0x3e0016[_0x7f50('0x1f')]['limit']||null:null})[_0x7f50('0x11')](function(_0x2e76a7){logger[_0x7f50('0x12')](_0x7f50('0x1c'),_0x3e0016);logger[_0x7f50('0x15')](_0x7f50('0x1c'),_0x3e0016,JSON['stringify'](_0x2e76a7));_0x4a7e13(_0x2e76a7);})[_0x7f50('0x1b')](function(_0x537a44){logger[_0x7f50('0x17')]('UpdateOpenchannelInteraction',_0x537a44[_0x7f50('0x19')],_0x3e0016);_0x2f4a07(_0x1197ed['error'](0x1f4,_0x537a44[_0x7f50('0x19')]));});});};exports[_0x7f50('0x21')]=function(_0x2796bb){return new Promise(function(_0x164945,_0x4b94b9){return db[_0x7f50('0x22')]['find']({'where':_0x2796bb[_0x7f50('0x1f')]?_0x2796bb[_0x7f50('0x1f')][_0x7f50('0x23')]||null:null})[_0x7f50('0x11')](function(_0x1ee524){if(_0x1ee524){return _0x1ee524[_0x7f50('0x24')](_0x2796bb[_0x7f50('0x1e')][_0x7f50('0x25')],_[_0x7f50('0x26')](_0x2796bb[_0x7f50('0x1e')],[_0x7f50('0x25'),'id'])||{});}})[_0x7f50('0x27')](function(_0xc60d49){logger[_0x7f50('0x12')](_0x7f50('0x28'),_0x2796bb);logger[_0x7f50('0x15')](_0x7f50('0x28'),_0x2796bb,JSON[_0x7f50('0x16')](_0xc60d49));_0x164945(_0xc60d49);})[_0x7f50('0x1b')](function(_0xa81dc5){logger[_0x7f50('0x17')]('AddTags',_0xa81dc5[_0x7f50('0x19')],_0x2796bb);_0x4b94b9(_this['error'](0x1f4,_0xa81dc5[_0x7f50('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index bc28bb7..5abda94 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 _0xf73b=['remove','update','removeListener','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x2a1a73,_0x4d99bf){var _0x40a57c=function(_0x41e091){while(--_0x41e091){_0x2a1a73['push'](_0x2a1a73['shift']());}};_0x40a57c(++_0x4d99bf);}(_0xf73b,0x131));var _0xbf73=function(_0x582fe0,_0x5db79e){_0x582fe0=_0x582fe0-0x0;var _0xd9b691=_0xf73b[_0x582fe0];return _0xd9b691;};'use strict';var OpenchannelInteractionEvents=require(_0xbf73('0x0'));var events=['save',_0xbf73('0x1'),_0xbf73('0x2')];function createListener(_0x3d097a,_0x59d198){return function(_0x59a689){_0x59d198['emit'](_0x3d097a,_0x59a689);};}function removeListener(_0x26f541,_0x489ec5){return function(){OpenchannelInteractionEvents[_0xbf73('0x3')](_0x26f541,_0x489ec5);};}exports['register']=function(_0x8f83dd){for(var _0x5281d6=0x0,_0x1224bc=events[_0xbf73('0x4')];_0x5281d6<_0x1224bc;_0x5281d6++){var _0x2b7f52=events[_0x5281d6];var _0x50acbf=createListener(_0xbf73('0x5')+_0x2b7f52,_0x8f83dd);OpenchannelInteractionEvents['on'](_0x2b7f52,_0x50acbf);}}; \ No newline at end of file +var _0x786b=['openchannelInteraction:','./openchannelInteraction.events','remove','update','emit','removeListener','register'];(function(_0x50f582,_0x5cdf90){var _0x12e856=function(_0x5ef955){while(--_0x5ef955){_0x50f582['push'](_0x50f582['shift']());}};_0x12e856(++_0x5cdf90);}(_0x786b,0x1c8));var _0xb786=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x786b[_0x2b9b7f];return _0x4ed19a;};'use strict';var OpenchannelInteractionEvents=require(_0xb786('0x0'));var events=['save',_0xb786('0x1'),_0xb786('0x2')];function createListener(_0x23104c,_0x19a58a){return function(_0x527a72){_0x19a58a[_0xb786('0x3')](_0x23104c,_0x527a72);};}function removeListener(_0x15e07b,_0x16de3a){return function(){OpenchannelInteractionEvents[_0xb786('0x4')](_0x15e07b,_0x16de3a);};}exports[_0xb786('0x5')]=function(_0x105939){for(var _0x291b88=0x0,_0x249a5f=events['length'];_0x291b88<_0x249a5f;_0x291b88++){var _0x30640e=events[_0x291b88];var _0x35a775=createListener(_0xb786('0x6')+_0x30640e,_0x105939);OpenchannelInteractionEvents['on'](_0x30640e,_0x35a775);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 5175f15..277e508 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(_0x5293a1,_0x351c64){var _0x5085aa=function(_0x3c3bd8){while(--_0x3c3bd8){_0x5293a1['push'](_0x5293a1['shift']());}};_0x5085aa(++_0x351c64);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x168f21,_0x70b14){var _0x66dba=function(_0x59e73e){while(--_0x59e73e){_0x168f21['push'](_0x168f21['shift']());}};_0x66dba(++_0x70b14);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x19d350,_0x3c843f){_0x19d350=_0x19d350-0x0;var _0x3bfc8d=_0xcb91[_0x19d350];return _0x3bfc8d;};'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');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index a642260..788eb41 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 _0x48ac=['exports','medium','BOOLEAN','out','DATE','STRING','TEXT'];(function(_0x3aea4d,_0x295c1c){var _0x28a18a=function(_0x506d8a){while(--_0x506d8a){_0x3aea4d['push'](_0x3aea4d['shift']());}};_0x28a18a(++_0x295c1c);}(_0x48ac,0xe0));var _0xc48a=function(_0x4ee98d,_0x3826e3){_0x4ee98d=_0x4ee98d-0x0;var _0x53ca2e=_0x48ac[_0x4ee98d];return _0x53ca2e;};'use strict';var Sequelize=require('sequelize');module[_0xc48a('0x0')]={'body':{'type':Sequelize['TEXT'](_0xc48a('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc48a('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc48a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc48a('0x3')),'defaultValue':_0xc48a('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc48a('0x4')]},'providerName':{'type':Sequelize[_0xc48a('0x5')]},'providerResponse':{'type':Sequelize[_0xc48a('0x6')]}}; \ No newline at end of file +var _0xb78e=['STRING','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x581b4b,_0x450a4b){var _0x3665a1=function(_0x362bda){while(--_0x362bda){_0x581b4b['push'](_0x581b4b['shift']());}};_0x3665a1(++_0x450a4b);}(_0xb78e,0x1c9));var _0xeb78=function(_0x1cd381,_0x201eaa){_0x1cd381=_0x1cd381-0x0;var _0x17ab23=_0xb78e[_0x1cd381];return _0x17ab23;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'body':{'type':Sequelize['TEXT'](_0xeb78('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xeb78('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xeb78('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xeb78('0x4')]('in',_0xeb78('0x5')),'defaultValue':_0xeb78('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xeb78('0x6')]},'providerName':{'type':Sequelize[_0xeb78('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 8931dd4..fc1c93f 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 _0xd10b=['Sequelize','contact','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','code','error','message','catch','sendStatus','status','end','offset','limit','count','set','reject','save','destroy','stack','name','index','map','OpenchannelMessage','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','params','length','find','create','body','describe','openchannel-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','update','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId'];(function(_0x32550e,_0x3f3b89){var _0x117f89=function(_0x3c9c2e){while(--_0x3c9c2e){_0x32550e['push'](_0x32550e['shift']());}};_0x117f89(++_0x3f3b89);}(_0xd10b,0x189));var _0xbd10=function(_0x1d7c35,_0x21d2b9){_0x1d7c35=_0x1d7c35-0x0;var _0x5064ed=_0xd10b[_0x1d7c35];return _0x5064ed;};'use strict';var emlformat=require(_0xbd10('0x0'));var rimraf=require(_0xbd10('0x1'));var zipdir=require(_0xbd10('0x2'));var jsonpatch=require(_0xbd10('0x3'));var rp=require(_0xbd10('0x4'));var moment=require(_0xbd10('0x5'));var BPromise=require(_0xbd10('0x6'));var Mustache=require(_0xbd10('0x7'));var util=require('util');var path=require('path');var sox=require(_0xbd10('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd10('0x9'));var _=require(_0xbd10('0xa'));var squel=require(_0xbd10('0xb'));var crypto=require(_0xbd10('0xc'));var jsforce=require(_0xbd10('0xd'));var deskjs=require(_0xbd10('0xe'));var toCsv=require(_0xbd10('0xf'));var querystring=require(_0xbd10('0x10'));var Papa=require(_0xbd10('0x11'));var Redis=require(_0xbd10('0x12'));var authService=require(_0xbd10('0x13'));var qs=require(_0xbd10('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd10('0x15'));var logger=require(_0xbd10('0x16'))(_0xbd10('0x17'));var utils=require(_0xbd10('0x18'));var config=require(_0xbd10('0x19'));var licenseUtil=require(_0xbd10('0x1a'));var db=require(_0xbd10('0x1b'))['db'];config['redis']=_[_0xbd10('0x1c')](config['redis'],{'host':_0xbd10('0x1d'),'port':0x18eb});var socket=require(_0xbd10('0x1e'))(new Redis(config[_0xbd10('0x1f')]));require(_0xbd10('0x20'))['register'](socket);var jayson=require(_0xbd10('0x21'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xbd10('0x22')][_0xbd10('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2c74a2,_0x2ee5fc,_0x160f6e,_0x4e4d10){return new BPromise(function(_0x212399,_0x3c61c3){var _0x7efcf0=_0x4e4d10||client;return _0x7efcf0[_0xbd10('0x24')](_0x2c74a2,_0x160f6e)[_0xbd10('0x25')](function(_0x7d1f16){logger[_0xbd10('0x26')](_0xbd10('0x27'),_0x2ee5fc,_0xbd10('0x28'));logger[_0xbd10('0x29')](_0xbd10('0x2a'),_0x2ee5fc,'request\x20sent',JSON['stringify'](_0x7d1f16));if(_0x7d1f16['error']){if(_0x7d1f16['error'][_0xbd10('0x2b')]===0x1f4){logger[_0xbd10('0x2c')](_0xbd10('0x27'),_0x2ee5fc,_0x7d1f16['error']['message']);return _0x3c61c3(_0x7d1f16[_0xbd10('0x2c')][_0xbd10('0x2d')]);}logger[_0xbd10('0x2c')](_0xbd10('0x27'),_0x2ee5fc,_0x7d1f16[_0xbd10('0x2c')][_0xbd10('0x2d')]);return _0x212399(_0x7d1f16[_0xbd10('0x2c')][_0xbd10('0x2d')]);}else{logger['info'](_0xbd10('0x27'),_0x2ee5fc,'request\x20sent');_0x212399(_0x7d1f16['result'][_0xbd10('0x2d')]);}})[_0xbd10('0x2e')](function(_0x2f21d3){logger[_0xbd10('0x2c')](_0xbd10('0x27'),_0x2ee5fc,_0x2f21d3);_0x3c61c3(_0x2f21d3);});});}function respondWithStatusCode(_0x1fad34,_0xc2c6be){_0xc2c6be=_0xc2c6be||0xcc;return function(_0x4f8571){if(_0x4f8571){return _0x1fad34[_0xbd10('0x2f')](_0xc2c6be);}return _0x1fad34[_0xbd10('0x30')](_0xc2c6be)[_0xbd10('0x31')]();};}function respondWithResult(_0x2c7037,_0x56a041){_0x56a041=_0x56a041||0xc8;return function(_0x4cfd63){if(_0x4cfd63){return _0x2c7037[_0xbd10('0x30')](_0x56a041)['json'](_0x4cfd63);}};}function respondWithFilteredResult(_0x3d80c0,_0x536718){return function(_0x45db01){if(_0x45db01){var _0x1cea00=typeof _0x536718[_0xbd10('0x32')]==='undefined'&&typeof _0x536718[_0xbd10('0x33')]==='undefined';var _0x225333=_0x45db01[_0xbd10('0x34')];var _0x413526=_0x1cea00?0x0:_0x536718['offset'];var _0x43b177=_0x1cea00?_0x45db01['count']:_0x536718[_0xbd10('0x32')]+_0x536718[_0xbd10('0x33')];var _0x4e6a97;if(_0x43b177>=_0x225333){_0x43b177=_0x225333;_0x4e6a97=0xc8;}else{_0x4e6a97=0xce;}_0x3d80c0['status'](_0x4e6a97);return _0x3d80c0[_0xbd10('0x35')]('Content-Range',_0x413526+'-'+_0x43b177+'/'+_0x225333)['json'](_0x45db01);}return null;};}function patchUpdates(_0x12d13e){return function(_0xb2ee81){try{jsonpatch['apply'](_0xb2ee81,_0x12d13e,!![]);}catch(_0x66dc9b){return BPromise[_0xbd10('0x36')](_0x66dc9b);}return _0xb2ee81[_0xbd10('0x37')]();};}function saveUpdates(_0xec869,_0x416fb7){return function(_0x519914){if(_0x519914){return _0x519914['update'](_0xec869)['then'](function(_0x493246){return _0x493246;});}return null;};}function removeEntity(_0xff92e8,_0x55ae35){return function(_0x9016e0){if(_0x9016e0){return _0x9016e0[_0xbd10('0x38')]()[_0xbd10('0x25')](function(){_0xff92e8[_0xbd10('0x30')](0xcc)[_0xbd10('0x31')]();});}};}function handleEntityNotFound(_0x219c21,_0x4bb9b3){return function(_0x321a3b){if(!_0x321a3b){_0x219c21['sendStatus'](0x194);}return _0x321a3b;};}function handleError(_0x115c36,_0x58e207){_0x58e207=_0x58e207||0x1f4;return function(_0x434e7b){logger[_0xbd10('0x2c')](_0x434e7b[_0xbd10('0x39')]);if(_0x434e7b['name']){delete _0x434e7b[_0xbd10('0x3a')];}_0x115c36[_0xbd10('0x30')](_0x58e207)['send'](_0x434e7b);};}exports[_0xbd10('0x3b')]=function(_0x1fe8c1,_0x1590b7){var _0x4f1aaf={},_0x3aea73={},_0x325765={'count':0x0,'rows':[]};var _0x7d9cf7=_[_0xbd10('0x3c')](db[_0xbd10('0x3d')]['rawAttributes'],function(_0x17f84d){return{'name':_0x17f84d[_0xbd10('0x3e')],'type':_0x17f84d['type']['key']};});_0x3aea73[_0xbd10('0x3f')]=_['map'](_0x7d9cf7,_0xbd10('0x3a'));_0x3aea73[_0xbd10('0x40')]=_[_0xbd10('0x41')](_0x1fe8c1[_0xbd10('0x40')]);_0x3aea73[_0xbd10('0x42')]=_[_0xbd10('0x43')](_0x3aea73[_0xbd10('0x3f')],_0x3aea73[_0xbd10('0x40')]);_0x4f1aaf[_0xbd10('0x44')]=_['intersection'](_0x3aea73[_0xbd10('0x3f')],qs['fields'](_0x1fe8c1[_0xbd10('0x40')][_0xbd10('0x45')]));_0x4f1aaf['attributes']=_0x4f1aaf[_0xbd10('0x44')]['length']?_0x4f1aaf[_0xbd10('0x44')]:_0x3aea73[_0xbd10('0x3f')];if(!_0x1fe8c1['query'][_0xbd10('0x46')]('nolimit')){_0x4f1aaf['limit']=qs[_0xbd10('0x33')](_0x1fe8c1[_0xbd10('0x40')]['limit']);_0x4f1aaf[_0xbd10('0x32')]=qs[_0xbd10('0x32')](_0x1fe8c1[_0xbd10('0x40')][_0xbd10('0x32')]);}_0x4f1aaf['order']=qs[_0xbd10('0x47')](_0x1fe8c1['query'][_0xbd10('0x47')]);_0x4f1aaf[_0xbd10('0x48')]=qs[_0xbd10('0x42')](_[_0xbd10('0x49')](_0x1fe8c1[_0xbd10('0x40')],_0x3aea73[_0xbd10('0x42')]),_0x7d9cf7);if(_0x1fe8c1['query'][_0xbd10('0x4a')]){_0x4f1aaf[_0xbd10('0x48')]=_[_0xbd10('0x4b')](_0x4f1aaf[_0xbd10('0x48')],{'$or':_['map'](_0x7d9cf7,function(_0x23f15d){if(_0x23f15d[_0xbd10('0x4c')]!==_0xbd10('0x4d')){var _0x1e8546={};_0x1e8546[_0x23f15d[_0xbd10('0x3a')]]={'$like':'%'+_0x1fe8c1[_0xbd10('0x40')][_0xbd10('0x4a')]+'%'};return _0x1e8546;}})});}_0x4f1aaf=_[_0xbd10('0x4b')]({},_0x4f1aaf,_0x1fe8c1[_0xbd10('0x4e')]);var _0x49a162={'where':_0x4f1aaf[_0xbd10('0x48')]};return db[_0xbd10('0x3d')]['count'](_0x49a162)['then'](function(_0x3c4e56){_0x325765[_0xbd10('0x34')]=_0x3c4e56;if(_0x1fe8c1[_0xbd10('0x40')][_0xbd10('0x4f')]){_0x4f1aaf[_0xbd10('0x50')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x4f1aaf);})[_0xbd10('0x25')](function(_0x5cfe12){_0x325765[_0xbd10('0x51')]=_0x5cfe12;return _0x325765;})[_0xbd10('0x25')](respondWithFilteredResult(_0x1590b7,_0x4f1aaf))[_0xbd10('0x2e')](handleError(_0x1590b7,null));};exports['show']=function(_0x233755,_0x5c9e35){var _0x359b7f={'raw':!![],'where':{'id':_0x233755[_0xbd10('0x52')]['id']}},_0x3f918b={};_0x3f918b[_0xbd10('0x3f')]=_[_0xbd10('0x41')](db[_0xbd10('0x3d')]['rawAttributes']);_0x3f918b[_0xbd10('0x40')]=_[_0xbd10('0x41')](_0x233755[_0xbd10('0x40')]);_0x3f918b[_0xbd10('0x42')]=_[_0xbd10('0x43')](_0x3f918b['model'],_0x3f918b['query']);_0x359b7f[_0xbd10('0x44')]=_[_0xbd10('0x43')](_0x3f918b[_0xbd10('0x3f')],qs[_0xbd10('0x45')](_0x233755[_0xbd10('0x40')][_0xbd10('0x45')]));_0x359b7f[_0xbd10('0x44')]=_0x359b7f[_0xbd10('0x44')][_0xbd10('0x53')]?_0x359b7f[_0xbd10('0x44')]:_0x3f918b[_0xbd10('0x3f')];if(_0x233755[_0xbd10('0x40')]['includeAll']){_0x359b7f[_0xbd10('0x50')]=[{'all':!![]}];}_0x359b7f=_[_0xbd10('0x4b')]({},_0x359b7f,_0x233755[_0xbd10('0x4e')]);return db[_0xbd10('0x3d')][_0xbd10('0x54')](_0x359b7f)[_0xbd10('0x25')](handleEntityNotFound(_0x5c9e35,null))[_0xbd10('0x25')](respondWithResult(_0x5c9e35,null))[_0xbd10('0x2e')](handleError(_0x5c9e35,null));};exports[_0xbd10('0x55')]=function(_0x57b52b,_0x41b471){return db[_0xbd10('0x3d')][_0xbd10('0x55')](_0x57b52b[_0xbd10('0x56')],{})[_0xbd10('0x25')](respondWithResult(_0x41b471,0xc9))['catch'](handleError(_0x41b471,null));};exports['update']=function(_0x252928,_0x3834dc){if(_0x252928[_0xbd10('0x56')]['id']){delete _0x252928['body']['id'];}return db[_0xbd10('0x3d')][_0xbd10('0x54')]({'where':{'id':_0x252928['params']['id']}})['then'](handleEntityNotFound(_0x3834dc,null))[_0xbd10('0x25')](saveUpdates(_0x252928[_0xbd10('0x56')],null))['then'](respondWithResult(_0x3834dc,null))[_0xbd10('0x2e')](handleError(_0x3834dc,null));};exports[_0xbd10('0x38')]=function(_0x51972a,_0x534a94){return db[_0xbd10('0x3d')][_0xbd10('0x54')]({'where':{'id':_0x51972a['params']['id']}})[_0xbd10('0x25')](handleEntityNotFound(_0x534a94,null))['then'](removeEntity(_0x534a94,null))[_0xbd10('0x2e')](handleError(_0x534a94,null));};exports['describe']=function(_0x21169d,_0x919720){return db[_0xbd10('0x3d')][_0xbd10('0x57')]()[_0xbd10('0x25')](respondWithResult(_0x919720,null))['catch'](handleError(_0x919720,null));};var interaction_log=require(_0xbd10('0x16'))(_0xbd10('0x58'));exports['accept']=function(_0x471060,_0x4caef0,_0x44c8fa){var _0x135e62={'agent':{},'channel':'openchannel'};if(_0x471060['body']['id']){delete _0x471060[_0xbd10('0x56')]['id'];}_0x471060[_0xbd10('0x56')][_0xbd10('0x59')]=!![];_0x471060[_0xbd10('0x56')][_0xbd10('0x5a')]=moment()[_0xbd10('0x5b')](_0xbd10('0x5c'));_0x471060[_0xbd10('0x56')][_0xbd10('0x5d')]=_0x471060[_0xbd10('0x56')]['UserId']||_0x471060[_0xbd10('0x5e')]['id'];_0x135e62[_0xbd10('0x5f')]['id']=_0x471060['body'][_0xbd10('0x5d')];return db[_0xbd10('0x3d')][_0xbd10('0x54')]({'where':{'id':_0x471060[_0xbd10('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4caef0,null))['then'](saveUpdates(_0x471060[_0xbd10('0x56')],null))['then'](function(_0x5f08b6){if(_0x5f08b6){_0x135e62['message']=_0x5f08b6[_0xbd10('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0xbd10('0x54')]({'where':{'id':_0x5f08b6['OpenchannelInteractionId']}});}return null;})[_0xbd10('0x25')](handleEntityNotFound(_0x4caef0,null))['then'](function(_0x5d9c2c){if(_0x5d9c2c){return _0x5d9c2c[_0xbd10('0x61')]({'UserId':_0x471060[_0xbd10('0x56')][_0xbd10('0x5d')],'read1stAt':_[_0xbd10('0x62')](_0x5d9c2c['read1stAt'])?moment()[_0xbd10('0x5b')](_0xbd10('0x5c')):undefined});}return null;})['then'](function(_0x132a28){if(_0x132a28){_0x135e62[_0xbd10('0x63')]=_0x132a28['get']({'plain':!![]});interaction_log[_0xbd10('0x26')](_0xbd10('0x64'),_0x471060['user']['id'],_0x471060[_0xbd10('0x5e')]['name'],_0x471060['user'][_0xbd10('0x65')],_0x135e62[_0xbd10('0x63')]['id'],_0x471060[_0xbd10('0x56')]?JSON[_0xbd10('0x66')](_0x471060[_0xbd10('0x56')]):_0xbd10('0x67'));return respondWithRpcPromise(_0xbd10('0x68'),'acceptMessage',_0x135e62);}return null;})[_0xbd10('0x25')](function(_0x52e999){var _0x2e708e=_0xbd10('0x69')+_0x52e999['message']['ContactId'];return db[_0xbd10('0x6a')][_0xbd10('0x40')](_0x2e708e,{'type':db['Sequelize'][_0xbd10('0x6b')][_0xbd10('0x6c')],'raw':!![]})[_0xbd10('0x25')](function(_0x34cd29){return _0x34cd29;});})[_0xbd10('0x25')](function(_0x143342){if(_0x143342){_0x135e62['message']['contact']=_0x143342[0x0];if(!_0x471060['body']['UserId'])return;return db[_0xbd10('0x6d')][_0xbd10('0x54')]({'where':{'id':_0x471060[_0xbd10('0x56')][_0xbd10('0x5d')],'role':_0xbd10('0x5f')},'attributes':['id',_0xbd10('0x3a'),_0xbd10('0x6e'),_0xbd10('0x6f'),_0xbd10('0x70')],'raw':!![]});}return null;})['then'](function(_0x3aeaa5){if(!_0x3aeaa5)return null;_0x135e62[_0xbd10('0x2d')][_0xbd10('0x5f')]=_0x3aeaa5;return _0x135e62;})[_0xbd10('0x25')](function(_0x1a6906){if(_0x1a6906){if(_0x471060[_0xbd10('0x56')][_0xbd10('0x71')]){_0x135e62['message'][_0xbd10('0x72')]=util[_0xbd10('0x5b')](_0xbd10('0x73'),_0x471060['user']['name']);_0x135e62[_0xbd10('0x2d')][_0xbd10('0x74')]=_0x135e62[_0xbd10('0x74')];_0x135e62['message'][_0xbd10('0x75')]=_0x135e62[_0xbd10('0x74')];_0x135e62[_0xbd10('0x2d')][_0xbd10('0x76')]='accept';return respondWithRpcPromise(_0xbd10('0x77'),_0xbd10('0x77'),{'event':_0xbd10('0x78'),'message':_0x135e62['message']},client9002)[_0xbd10('0x25')](function(){return _0x135e62;});}return _0x135e62;}return null;})[_0xbd10('0x25')](respondWithResult(_0x4caef0,null))[_0xbd10('0x2e')](handleError(_0x4caef0,null));};var interaction_log=require(_0xbd10('0x16'))(_0xbd10('0x58'));exports[_0xbd10('0x36')]=function(_0x134139,_0x33d2d8,_0x37759b){var _0x3c5ebd={'agent':{},'channel':_0xbd10('0x79')};if(_0x134139[_0xbd10('0x56')]['id']){delete _0x134139[_0xbd10('0x56')]['id'];}_0x134139[_0xbd10('0x56')][_0xbd10('0x5d')]=_0x134139['body']['UserId']||_0x134139[_0xbd10('0x5e')]['id'];_0x3c5ebd[_0xbd10('0x5f')]['id']=_0x134139[_0xbd10('0x56')]['UserId'];return db['OpenchannelMessage'][_0xbd10('0x54')]({'where':{'id':_0x134139[_0xbd10('0x52')]['id'],'UserId':null}})[_0xbd10('0x25')](handleEntityNotFound(_0x33d2d8,null))[_0xbd10('0x25')](function(_0x6ec284){if(_0x6ec284){_0x3c5ebd[_0xbd10('0x2d')]=_0x6ec284[_0xbd10('0x60')]({'plain':!![]});return db[_0xbd10('0x7a')][_0xbd10('0x54')]({'where':{'id':_0x6ec284[_0xbd10('0x7b')]}});}return null;})[_0xbd10('0x25')](handleEntityNotFound(_0x33d2d8,null))['then'](function(_0x1b003d){if(_0x1b003d){_0x3c5ebd[_0xbd10('0x63')]=_0x1b003d[_0xbd10('0x60')]({'plain':!![]});interaction_log[_0xbd10('0x26')](_0xbd10('0x7c'),_0x134139[_0xbd10('0x5e')]['id'],_0x134139[_0xbd10('0x5e')][_0xbd10('0x3a')],_0x134139[_0xbd10('0x5e')][_0xbd10('0x65')],_0x3c5ebd[_0xbd10('0x63')]['id'],_0x134139['body']?JSON[_0xbd10('0x66')](_0x134139[_0xbd10('0x56')]):_0xbd10('0x67'));return respondWithRpcPromise('RejectMessage',_0xbd10('0x7d'),_0x3c5ebd);}return null;})[_0xbd10('0x25')](function(_0x464bc6){var _0x461177=_0xbd10('0x69')+_0x464bc6[_0xbd10('0x2d')][_0xbd10('0x7e')];return db[_0xbd10('0x6a')][_0xbd10('0x40')](_0x461177,{'type':db[_0xbd10('0x7f')]['QueryTypes'][_0xbd10('0x6c')],'raw':!![]})[_0xbd10('0x25')](function(_0x3d93c5){return _0x3d93c5;});})[_0xbd10('0x25')](function(_0x25b19b){if(_0x25b19b){_0x3c5ebd[_0xbd10('0x2d')][_0xbd10('0x80')]=_0x25b19b[0x0];if(!_0x134139['body'][_0xbd10('0x5d')])return;return db['User'][_0xbd10('0x54')]({'where':{'id':_0x134139[_0xbd10('0x56')][_0xbd10('0x5d')],'role':_0xbd10('0x5f')},'attributes':['id',_0xbd10('0x3a'),'fullname',_0xbd10('0x6f'),'internal'],'raw':!![]});}return null;})[_0xbd10('0x25')](function(_0x2e88d0){if(!_0x2e88d0)return null;_0x3c5ebd[_0xbd10('0x2d')][_0xbd10('0x5f')]=_0x2e88d0;return _0x3c5ebd;})[_0xbd10('0x25')](function(_0x3fd85e){if(_0x3fd85e){_0x3fd85e[_0xbd10('0x2d')][_0xbd10('0x72')]=util[_0xbd10('0x5b')](_0xbd10('0x73'),_0x134139[_0xbd10('0x5e')][_0xbd10('0x3a')]);_0x3fd85e[_0xbd10('0x2d')]['channel']=_0x3c5ebd['channel'];_0x3fd85e[_0xbd10('0x2d')]['motionChannel']=_0x3c5ebd['channel'];_0x3fd85e[_0xbd10('0x2d')][_0xbd10('0x76')]='reject';respondWithRpcPromise(_0xbd10('0x77'),_0xbd10('0x77'),{'event':_0xbd10('0x81'),'message':_0x3fd85e[_0xbd10('0x2d')]},client9002);return _0x3c5ebd;}return null;})[_0xbd10('0x25')](respondWithResult(_0x33d2d8,null))['catch'](handleError(_0x33d2d8,null));}; \ No newline at end of file +var _0x2220=['OpenchannelMessage','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','show','params','keys','rawAttributes','find','create','body','update','describe','openchannel-interactions','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','contact','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./openchannelMessage.socket','register','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','destroy','name','index','map'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x2220,0x14e));var _0x0222=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x2220[_0x525c7b];return _0x27b33e;};'use strict';var emlformat=require(_0x0222('0x0'));var rimraf=require(_0x0222('0x1'));var zipdir=require(_0x0222('0x2'));var jsonpatch=require(_0x0222('0x3'));var rp=require(_0x0222('0x4'));var moment=require(_0x0222('0x5'));var BPromise=require(_0x0222('0x6'));var Mustache=require('mustache');var util=require(_0x0222('0x7'));var path=require(_0x0222('0x8'));var sox=require(_0x0222('0x9'));var csv=require(_0x0222('0xa'));var ejs=require(_0x0222('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0222('0xc'));var squel=require(_0x0222('0xd'));var crypto=require('crypto');var jsforce=require(_0x0222('0xe'));var deskjs=require(_0x0222('0xf'));var toCsv=require(_0x0222('0xa'));var querystring=require('querystring');var Papa=require(_0x0222('0x10'));var Redis=require(_0x0222('0x11'));var authService=require(_0x0222('0x12'));var qs=require(_0x0222('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0222('0x14'));var logger=require(_0x0222('0x15'))(_0x0222('0x16'));var utils=require(_0x0222('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0222('0x18'));var db=require('../../mysqldb')['db'];config[_0x0222('0x19')]=_[_0x0222('0x1a')](config[_0x0222('0x19')],{'host':_0x0222('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0222('0x19')]));require(_0x0222('0x1c'))[_0x0222('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0222('0x1e')][_0x0222('0x1f')]({'port':0x232c});var client9002=jayson[_0x0222('0x1e')][_0x0222('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x5cf0ce,_0x5dc196,_0x1199a5,_0x93c8d){return new BPromise(function(_0x3dd6ee,_0x816f59){var _0x288fcb=_0x93c8d||client;return _0x288fcb[_0x0222('0x20')](_0x5cf0ce,_0x1199a5)[_0x0222('0x21')](function(_0x4204b4){logger['info'](_0x0222('0x22'),_0x5dc196,'request\x20sent');logger[_0x0222('0x23')](_0x0222('0x24'),_0x5dc196,'request\x20sent',JSON[_0x0222('0x25')](_0x4204b4));if(_0x4204b4[_0x0222('0x26')]){if(_0x4204b4['error'][_0x0222('0x27')]===0x1f4){logger[_0x0222('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x5dc196,_0x4204b4['error']['message']);return _0x816f59(_0x4204b4[_0x0222('0x26')][_0x0222('0x28')]);}logger['error'](_0x0222('0x22'),_0x5dc196,_0x4204b4[_0x0222('0x26')]['message']);return _0x3dd6ee(_0x4204b4[_0x0222('0x26')][_0x0222('0x28')]);}else{logger[_0x0222('0x29')](_0x0222('0x22'),_0x5dc196,'request\x20sent');_0x3dd6ee(_0x4204b4[_0x0222('0x2a')]['message']);}})[_0x0222('0x2b')](function(_0x5e4d52){logger[_0x0222('0x26')](_0x0222('0x22'),_0x5dc196,_0x5e4d52);_0x816f59(_0x5e4d52);});});}function respondWithStatusCode(_0x1a9637,_0xd785de){_0xd785de=_0xd785de||0xcc;return function(_0x59675e){if(_0x59675e){return _0x1a9637[_0x0222('0x2c')](_0xd785de);}return _0x1a9637[_0x0222('0x2d')](_0xd785de)[_0x0222('0x2e')]();};}function respondWithResult(_0x192024,_0x2aded0){_0x2aded0=_0x2aded0||0xc8;return function(_0x58a9f2){if(_0x58a9f2){return _0x192024[_0x0222('0x2d')](_0x2aded0)[_0x0222('0x2f')](_0x58a9f2);}};}function respondWithFilteredResult(_0x5b22ba,_0x115e52){return function(_0x26cd1e){if(_0x26cd1e){var _0x57c57e=typeof _0x115e52[_0x0222('0x30')]===_0x0222('0x31')&&typeof _0x115e52[_0x0222('0x32')]===_0x0222('0x31');var _0x5de96d=_0x26cd1e['count'];var _0x1d9196=_0x57c57e?0x0:_0x115e52[_0x0222('0x30')];var _0x5a452d=_0x57c57e?_0x26cd1e['count']:_0x115e52[_0x0222('0x30')]+_0x115e52[_0x0222('0x32')];var _0x2e2ff8;if(_0x5a452d>=_0x5de96d){_0x5a452d=_0x5de96d;_0x2e2ff8=0xc8;}else{_0x2e2ff8=0xce;}_0x5b22ba[_0x0222('0x2d')](_0x2e2ff8);return _0x5b22ba[_0x0222('0x33')](_0x0222('0x34'),_0x1d9196+'-'+_0x5a452d+'/'+_0x5de96d)[_0x0222('0x2f')](_0x26cd1e);}return null;};}function patchUpdates(_0x56aacc){return function(_0x3dccbf){try{jsonpatch['apply'](_0x3dccbf,_0x56aacc,!![]);}catch(_0xac2d6e){return BPromise[_0x0222('0x35')](_0xac2d6e);}return _0x3dccbf[_0x0222('0x36')]();};}function saveUpdates(_0x334cc1,_0x2a63f3){return function(_0xf3f866){if(_0xf3f866){return _0xf3f866['update'](_0x334cc1)[_0x0222('0x21')](function(_0x404d6e){return _0x404d6e;});}return null;};}function removeEntity(_0x15699a,_0x2ce7e6){return function(_0x2762b9){if(_0x2762b9){return _0x2762b9[_0x0222('0x37')]()[_0x0222('0x21')](function(){_0x15699a[_0x0222('0x2d')](0xcc)[_0x0222('0x2e')]();});}};}function handleEntityNotFound(_0x2f1058,_0x3369cd){return function(_0x282139){if(!_0x282139){_0x2f1058['sendStatus'](0x194);}return _0x282139;};}function handleError(_0x11afd5,_0x1c7f79){_0x1c7f79=_0x1c7f79||0x1f4;return function(_0x405117){logger[_0x0222('0x26')](_0x405117['stack']);if(_0x405117['name']){delete _0x405117[_0x0222('0x38')];}_0x11afd5[_0x0222('0x2d')](_0x1c7f79)['send'](_0x405117);};}exports[_0x0222('0x39')]=function(_0x5c0771,_0x3d7ecf){var _0x4df700={},_0x300978={},_0x433d2d={'count':0x0,'rows':[]};var _0x156b95=_[_0x0222('0x3a')](db[_0x0222('0x3b')]['rawAttributes'],function(_0x28cc4a){return{'name':_0x28cc4a['fieldName'],'type':_0x28cc4a[_0x0222('0x3c')][_0x0222('0x3d')]};});_0x300978[_0x0222('0x3e')]=_[_0x0222('0x3a')](_0x156b95,_0x0222('0x38'));_0x300978[_0x0222('0x3f')]=_['keys'](_0x5c0771[_0x0222('0x3f')]);_0x300978[_0x0222('0x40')]=_[_0x0222('0x41')](_0x300978['model'],_0x300978[_0x0222('0x3f')]);_0x4df700['attributes']=_['intersection'](_0x300978[_0x0222('0x3e')],qs[_0x0222('0x42')](_0x5c0771[_0x0222('0x3f')]['fields']));_0x4df700[_0x0222('0x43')]=_0x4df700[_0x0222('0x43')][_0x0222('0x44')]?_0x4df700['attributes']:_0x300978[_0x0222('0x3e')];if(!_0x5c0771[_0x0222('0x3f')][_0x0222('0x45')](_0x0222('0x46'))){_0x4df700[_0x0222('0x32')]=qs['limit'](_0x5c0771['query'][_0x0222('0x32')]);_0x4df700['offset']=qs[_0x0222('0x30')](_0x5c0771['query'][_0x0222('0x30')]);}_0x4df700[_0x0222('0x47')]=qs[_0x0222('0x48')](_0x5c0771[_0x0222('0x3f')][_0x0222('0x48')]);_0x4df700[_0x0222('0x49')]=qs[_0x0222('0x40')](_[_0x0222('0x4a')](_0x5c0771[_0x0222('0x3f')],_0x300978['filters']),_0x156b95);if(_0x5c0771[_0x0222('0x3f')][_0x0222('0x4b')]){_0x4df700['where']=_[_0x0222('0x4c')](_0x4df700[_0x0222('0x49')],{'$or':_[_0x0222('0x3a')](_0x156b95,function(_0x57f063){if(_0x57f063[_0x0222('0x3c')]!=='VIRTUAL'){var _0x1d18d7={};_0x1d18d7[_0x57f063[_0x0222('0x38')]]={'$like':'%'+_0x5c0771[_0x0222('0x3f')][_0x0222('0x4b')]+'%'};return _0x1d18d7;}})});}_0x4df700=_[_0x0222('0x4c')]({},_0x4df700,_0x5c0771[_0x0222('0x4d')]);var _0x2549e9={'where':_0x4df700[_0x0222('0x49')]};return db[_0x0222('0x3b')][_0x0222('0x4e')](_0x2549e9)[_0x0222('0x21')](function(_0x50d4e6){_0x433d2d['count']=_0x50d4e6;if(_0x5c0771['query'][_0x0222('0x4f')]){_0x4df700[_0x0222('0x50')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x4df700);})['then'](function(_0xe46fa3){_0x433d2d[_0x0222('0x51')]=_0xe46fa3;return _0x433d2d;})[_0x0222('0x21')](respondWithFilteredResult(_0x3d7ecf,_0x4df700))['catch'](handleError(_0x3d7ecf,null));};exports[_0x0222('0x52')]=function(_0x3e0eb0,_0x42162d){var _0x16bd95={'raw':!![],'where':{'id':_0x3e0eb0[_0x0222('0x53')]['id']}},_0x31ac17={};_0x31ac17[_0x0222('0x3e')]=_[_0x0222('0x54')](db['OpenchannelMessage'][_0x0222('0x55')]);_0x31ac17['query']=_['keys'](_0x3e0eb0['query']);_0x31ac17[_0x0222('0x40')]=_[_0x0222('0x41')](_0x31ac17[_0x0222('0x3e')],_0x31ac17['query']);_0x16bd95['attributes']=_[_0x0222('0x41')](_0x31ac17['model'],qs[_0x0222('0x42')](_0x3e0eb0[_0x0222('0x3f')]['fields']));_0x16bd95[_0x0222('0x43')]=_0x16bd95[_0x0222('0x43')][_0x0222('0x44')]?_0x16bd95[_0x0222('0x43')]:_0x31ac17[_0x0222('0x3e')];if(_0x3e0eb0['query'][_0x0222('0x4f')]){_0x16bd95['include']=[{'all':!![]}];}_0x16bd95=_[_0x0222('0x4c')]({},_0x16bd95,_0x3e0eb0[_0x0222('0x4d')]);return db['OpenchannelMessage'][_0x0222('0x56')](_0x16bd95)[_0x0222('0x21')](handleEntityNotFound(_0x42162d,null))[_0x0222('0x21')](respondWithResult(_0x42162d,null))[_0x0222('0x2b')](handleError(_0x42162d,null));};exports[_0x0222('0x57')]=function(_0x3598d4,_0x24a4ba){return db[_0x0222('0x3b')][_0x0222('0x57')](_0x3598d4[_0x0222('0x58')],{})[_0x0222('0x21')](respondWithResult(_0x24a4ba,0xc9))[_0x0222('0x2b')](handleError(_0x24a4ba,null));};exports[_0x0222('0x59')]=function(_0x5c4194,_0x3aa916){if(_0x5c4194[_0x0222('0x58')]['id']){delete _0x5c4194[_0x0222('0x58')]['id'];}return db[_0x0222('0x3b')]['find']({'where':{'id':_0x5c4194[_0x0222('0x53')]['id']}})[_0x0222('0x21')](handleEntityNotFound(_0x3aa916,null))[_0x0222('0x21')](saveUpdates(_0x5c4194[_0x0222('0x58')],null))[_0x0222('0x21')](respondWithResult(_0x3aa916,null))[_0x0222('0x2b')](handleError(_0x3aa916,null));};exports['destroy']=function(_0x4a36ce,_0x55b99d){return db[_0x0222('0x3b')][_0x0222('0x56')]({'where':{'id':_0x4a36ce[_0x0222('0x53')]['id']}})[_0x0222('0x21')](handleEntityNotFound(_0x55b99d,null))['then'](removeEntity(_0x55b99d,null))[_0x0222('0x2b')](handleError(_0x55b99d,null));};exports[_0x0222('0x5a')]=function(_0x14d6e9,_0x9f99f7){return db[_0x0222('0x3b')][_0x0222('0x5a')]()['then'](respondWithResult(_0x9f99f7,null))[_0x0222('0x2b')](handleError(_0x9f99f7,null));};var interaction_log=require(_0x0222('0x15'))(_0x0222('0x5b'));exports[_0x0222('0x5c')]=function(_0x240894,_0x2bc32e,_0x20a506){var _0x391b13={'agent':{},'channel':_0x0222('0x5d')};if(_0x240894[_0x0222('0x58')]['id']){delete _0x240894['body']['id'];}_0x240894[_0x0222('0x58')]['read']=!![];_0x240894['body']['readAt']=moment()[_0x0222('0x5e')](_0x0222('0x5f'));_0x240894[_0x0222('0x58')][_0x0222('0x60')]=_0x240894[_0x0222('0x58')][_0x0222('0x60')]||_0x240894[_0x0222('0x61')]['id'];_0x391b13[_0x0222('0x62')]['id']=_0x240894['body']['UserId'];return db[_0x0222('0x3b')]['find']({'where':{'id':_0x240894[_0x0222('0x53')]['id'],'UserId':null}})[_0x0222('0x21')](handleEntityNotFound(_0x2bc32e,null))[_0x0222('0x21')](saveUpdates(_0x240894['body'],null))[_0x0222('0x21')](function(_0x5c85e3){if(_0x5c85e3){_0x391b13[_0x0222('0x28')]=_0x5c85e3[_0x0222('0x63')]({'plain':!![]});return db[_0x0222('0x64')][_0x0222('0x56')]({'where':{'id':_0x5c85e3[_0x0222('0x65')]}});}return null;})[_0x0222('0x21')](handleEntityNotFound(_0x2bc32e,null))[_0x0222('0x21')](function(_0x270160){if(_0x270160){return _0x270160[_0x0222('0x59')]({'UserId':_0x240894[_0x0222('0x58')][_0x0222('0x60')],'read1stAt':_[_0x0222('0x66')](_0x270160[_0x0222('0x67')])?moment()[_0x0222('0x5e')](_0x0222('0x5f')):undefined});}return null;})['then'](function(_0x171bec){if(_0x171bec){_0x391b13['interaction']=_0x171bec[_0x0222('0x63')]({'plain':!![]});interaction_log[_0x0222('0x29')](_0x0222('0x68'),_0x240894[_0x0222('0x61')]['id'],_0x240894[_0x0222('0x61')][_0x0222('0x38')],_0x240894['user'][_0x0222('0x69')],_0x391b13[_0x0222('0x6a')]['id'],_0x240894[_0x0222('0x58')]?JSON['stringify'](_0x240894[_0x0222('0x58')]):'null');return respondWithRpcPromise(_0x0222('0x6b'),_0x0222('0x6c'),_0x391b13);}return null;})[_0x0222('0x21')](function(_0x4896d1){var _0x5c4556=_0x0222('0x6d')+_0x4896d1[_0x0222('0x28')]['ContactId'];return db[_0x0222('0x6e')][_0x0222('0x3f')](_0x5c4556,{'type':db[_0x0222('0x6f')][_0x0222('0x70')][_0x0222('0x71')],'raw':!![]})['then'](function(_0x134a27){return _0x134a27;});})[_0x0222('0x21')](function(_0x52e584){if(_0x52e584){_0x391b13[_0x0222('0x28')]['contact']=_0x52e584[0x0];if(!_0x240894['body'][_0x0222('0x60')])return;return db[_0x0222('0x72')]['find']({'where':{'id':_0x240894['body'][_0x0222('0x60')],'role':_0x0222('0x62')},'attributes':['id','name',_0x0222('0x73'),_0x0222('0x74'),'internal'],'raw':!![]});}return null;})[_0x0222('0x21')](function(_0x3adbf9){if(!_0x3adbf9)return null;_0x391b13['message'][_0x0222('0x62')]=_0x3adbf9;return _0x391b13;})[_0x0222('0x21')](function(_0x21142d){if(_0x21142d){if(_0x240894['body'][_0x0222('0x75')]){_0x391b13[_0x0222('0x28')][_0x0222('0x76')]=util['format'](_0x0222('0x77'),_0x240894[_0x0222('0x61')][_0x0222('0x38')]);_0x391b13['message'][_0x0222('0x78')]=_0x391b13['channel'];_0x391b13['message'][_0x0222('0x79')]=_0x391b13[_0x0222('0x78')];_0x391b13[_0x0222('0x28')][_0x0222('0x7a')]=_0x0222('0x5c');return respondWithRpcPromise(_0x0222('0x7b'),'EventManager',{'event':_0x0222('0x7c'),'message':_0x391b13[_0x0222('0x28')]},client9002)[_0x0222('0x21')](function(){return _0x391b13;});}return _0x391b13;}return null;})[_0x0222('0x21')](respondWithResult(_0x2bc32e,null))[_0x0222('0x2b')](handleError(_0x2bc32e,null));};var interaction_log=require(_0x0222('0x15'))(_0x0222('0x5b'));exports['reject']=function(_0xac8adc,_0x33846e,_0x43d897){var _0x3cb560={'agent':{},'channel':_0x0222('0x5d')};if(_0xac8adc[_0x0222('0x58')]['id']){delete _0xac8adc['body']['id'];}_0xac8adc[_0x0222('0x58')][_0x0222('0x60')]=_0xac8adc['body'][_0x0222('0x60')]||_0xac8adc['user']['id'];_0x3cb560[_0x0222('0x62')]['id']=_0xac8adc[_0x0222('0x58')][_0x0222('0x60')];return db[_0x0222('0x3b')][_0x0222('0x56')]({'where':{'id':_0xac8adc[_0x0222('0x53')]['id'],'UserId':null}})[_0x0222('0x21')](handleEntityNotFound(_0x33846e,null))[_0x0222('0x21')](function(_0x3b24a4){if(_0x3b24a4){_0x3cb560['message']=_0x3b24a4[_0x0222('0x63')]({'plain':!![]});return db[_0x0222('0x64')][_0x0222('0x56')]({'where':{'id':_0x3b24a4[_0x0222('0x65')]}});}return null;})[_0x0222('0x21')](handleEntityNotFound(_0x33846e,null))[_0x0222('0x21')](function(_0x30180e){if(_0x30180e){_0x3cb560[_0x0222('0x6a')]=_0x30180e['get']({'plain':!![]});interaction_log[_0x0222('0x29')](_0x0222('0x7d'),_0xac8adc[_0x0222('0x61')]['id'],_0xac8adc['user'][_0x0222('0x38')],_0xac8adc[_0x0222('0x61')]['role'],_0x3cb560[_0x0222('0x6a')]['id'],_0xac8adc[_0x0222('0x58')]?JSON[_0x0222('0x25')](_0xac8adc['body']):_0x0222('0x7e'));return respondWithRpcPromise(_0x0222('0x7f'),_0x0222('0x80'),_0x3cb560);}return null;})[_0x0222('0x21')](function(_0x2847d6){var _0x12d237=_0x0222('0x6d')+_0x2847d6[_0x0222('0x28')]['ContactId'];return db[_0x0222('0x6e')][_0x0222('0x3f')](_0x12d237,{'type':db[_0x0222('0x6f')]['QueryTypes'][_0x0222('0x71')],'raw':!![]})[_0x0222('0x21')](function(_0x4c1f1e){return _0x4c1f1e;});})[_0x0222('0x21')](function(_0x13b519){if(_0x13b519){_0x3cb560['message'][_0x0222('0x81')]=_0x13b519[0x0];if(!_0xac8adc[_0x0222('0x58')][_0x0222('0x60')])return;return db[_0x0222('0x72')][_0x0222('0x56')]({'where':{'id':_0xac8adc[_0x0222('0x58')][_0x0222('0x60')],'role':_0x0222('0x62')},'attributes':['id',_0x0222('0x38'),_0x0222('0x73'),_0x0222('0x74'),'internal'],'raw':!![]});}return null;})[_0x0222('0x21')](function(_0x8d7f44){if(!_0x8d7f44)return null;_0x3cb560[_0x0222('0x28')][_0x0222('0x62')]=_0x8d7f44;return _0x3cb560;})[_0x0222('0x21')](function(_0x1428c4){if(_0x1428c4){_0x1428c4[_0x0222('0x28')][_0x0222('0x76')]=util[_0x0222('0x5e')](_0x0222('0x77'),_0xac8adc[_0x0222('0x61')][_0x0222('0x38')]);_0x1428c4[_0x0222('0x28')]['channel']=_0x3cb560[_0x0222('0x78')];_0x1428c4[_0x0222('0x28')][_0x0222('0x79')]=_0x3cb560[_0x0222('0x78')];_0x1428c4['message'][_0x0222('0x7a')]='reject';respondWithRpcPromise(_0x0222('0x7b'),_0x0222('0x7b'),{'event':_0x0222('0x82'),'message':_0x1428c4['message']},client9002);return _0x3cb560;}return null;})[_0x0222('0x21')](respondWithResult(_0x33846e,null))[_0x0222('0x2b')](handleError(_0x33846e,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 6158797..673400f 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 _0xee97=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x46bdee,_0x3c3738){var _0x5a3fae=function(_0x255ed8){while(--_0x255ed8){_0x46bdee['push'](_0x46bdee['shift']());}};_0x5a3fae(++_0x3c3738);}(_0xee97,0x1ab));var _0x7ee9=function(_0x27f6a2,_0x5c9bf9){_0x27f6a2=_0x27f6a2-0x0;var _0xc4fd1f=_0xee97[_0x27f6a2];return _0xc4fd1f;};'use strict';var EventEmitter=require(_0x7ee9('0x0'));var OpenchannelMessage=require(_0x7ee9('0x1'))['db'][_0x7ee9('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7ee9('0x3')](0x0);var events={'afterCreate':_0x7ee9('0x4'),'afterUpdate':_0x7ee9('0x5'),'afterDestroy':_0x7ee9('0x6')};function emitEvent(_0x591de1){return function(_0x3142ee,_0x120e4e,_0x23029b){OpenchannelMessageEvents['emit'](_0x591de1+':'+_0x3142ee['id'],_0x3142ee);OpenchannelMessageEvents[_0x7ee9('0x7')](_0x591de1,_0x3142ee);_0x23029b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x7ee9('0x8')](e,emitEvent(event));}}module[_0x7ee9('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x06aa=['remove','emit','hasOwnProperty','hook','save','update'];(function(_0x4353d2,_0x3a27cb){var _0x3eed6d=function(_0x35a726){while(--_0x35a726){_0x4353d2['push'](_0x4353d2['shift']());}};_0x3eed6d(++_0x3a27cb);}(_0x06aa,0xac));var _0xa06a=function(_0x2d6272,_0x321c67){_0x2d6272=_0x2d6272-0x0;var _0x19ec27=_0x06aa[_0x2d6272];return _0x19ec27;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa06a('0x0'),'afterUpdate':_0xa06a('0x1'),'afterDestroy':_0xa06a('0x2')};function emitEvent(_0x1ebe14){return function(_0x4206ce,_0x9d5de2,_0x2438de){OpenchannelMessageEvents[_0xa06a('0x3')](_0x1ebe14+':'+_0x4206ce['id'],_0x4206ce);OpenchannelMessageEvents['emit'](_0x1ebe14,_0x4206ce);_0x2438de(null);};}for(var e in events){if(events[_0xa06a('0x4')](e)){var event=events[e];OpenchannelMessage[_0xa06a('0x5')](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 0f570cc..901a6ac 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 _0x87c1=['CmContact','describe','find','OpenchannelAccountId','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','omit','POST','method','GET','body','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','inspect','finally','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','models','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','catch','error'];(function(_0x1afa2f,_0x478dc0){var _0x95e7b3=function(_0x5b90ef){while(--_0x5b90ef){_0x1afa2f['push'](_0x1afa2f['shift']());}};_0x95e7b3(++_0x478dc0);}(_0x87c1,0x7f));var _0x187c=function(_0x3e4026,_0x443ec2){_0x3e4026=_0x3e4026-0x0;var _0x58fb46=_0x87c1[_0x3e4026];return _0x58fb46;};'use strict';var _=require(_0x187c('0x0'));var util=require('util');var logger=require(_0x187c('0x1'))('api');var moment=require(_0x187c('0x2'));var BPromise=require(_0x187c('0x3'));var rp=require(_0x187c('0x4'));var fs=require('fs');var path=require(_0x187c('0x5'));var rimraf=require(_0x187c('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module[_0x187c('0x7')]=function(_0x151ca8,_0x12678b){return _0x151ca8[_0x187c('0x8')](_0x187c('0x9'),attributes,{'tableName':_0x187c('0xa'),'paranoid':![],'indexes':[{'name':_0x187c('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x51f67e,_0x580fed,_0x2d5dc3){var _0x402c00=_0x151ca8[_0x187c('0xc')];var _0x55a602=_0x51f67e[_0x187c('0xd')]({'plain':!![]});if(_0x55a602[_0x187c('0xe')]['toLowerCase']()==='in'||_0x55a602[_0x187c('0xe')][_0x187c('0xf')]()==='out'&&!_0x55a602[_0x187c('0x10')]&&!_[_0x187c('0x11')](_0x55a602[_0x187c('0x12')])){_0x402c00[_0x187c('0x13')][_0x187c('0x14')]({'where':{'id':_0x55a602[_0x187c('0x15')]}})[_0x187c('0x16')](function(_0x49fa42){if(_0x49fa42){_0x49fa42['update']({'lastMsgAt':_0x55a602[_0x187c('0x17')],'lastMsgDirection':_0x55a602[_0x187c('0xe')][_0x187c('0xf')]()});}})[_0x187c('0x18')](function(_0xbf9033){console[_0x187c('0x19')](_0xbf9033);});}if(_0x55a602[_0x187c('0xe')]==='out'&&!_0x55a602['secret']){var _0xdcca25;_0x402c00[_0x187c('0x1a')][_0x187c('0x1b')]()[_0x187c('0x16')](function(_0x1596f7){return _0x402c00['OpenchannelAccount'][_0x187c('0x1c')]({'where':{'id':_0x55a602[_0x187c('0x1d')]},'include':[{'model':_0x402c00[_0x187c('0x13')],'as':'Interactions','where':{'id':_0x55a602[_0x187c('0x15')]},'limit':0x1,'include':[{'model':_0x402c00[_0x187c('0x1a')],'as':_0x187c('0x1e'),'attributes':_['keys'](_0x1596f7)}]}]});})[_0x187c('0x16')](function(_0x75749b){_0xdcca25=_0x75749b['get']({'plain':!![]});if(_0xdcca25&&_0xdcca25[_0x187c('0x1f')]){logger[_0x187c('0x20')](_0x187c('0x21'),_0x187c('0x22'),util[_0x187c('0x23')](_0x187c('0x24'),_0x55a602['id'],_0xdcca25[_0x187c('0x1f')]));if(_0xdcca25[_0x187c('0x25')]&&_0xdcca25[_0x187c('0x25')][_0x187c('0x26')]){_0x55a602['Interaction']=_[_0x187c('0x27')](_0xdcca25['Interactions'][0x0],'Contact');_0x55a602[_0x187c('0x1e')]=_0xdcca25[_0x187c('0x25')][0x0][_0x187c('0x1e')];}var _0x580fed={'method':_0x187c('0x28'),'uri':encodeURI(_0xdcca25[_0x187c('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x580fed[_0x187c('0x29')]){case _0x187c('0x2a'):_0x580fed['qs']=_0x55a602;break;case _0x187c('0x28'):_0x580fed[_0x187c('0x2b')]=_0x55a602;break;}return rp(_0x580fed)[_0x187c('0x16')](function(_0x206e39){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x187c('0x22'),util[_0x187c('0x23')](_0x187c('0x2c'),_0x55a602['id'],_0xdcca25[_0x187c('0x1f')]));if(_0x206e39[_0x187c('0x2b')][_0x187c('0x2d')]&&_0x206e39[_0x187c('0x2b')]['threadId']!=_0x55a602[_0x187c('0x2e')][_0x187c('0x2d')]){return _0x402c00[_0x187c('0x13')]['update']({'threadId':_0x206e39[_0x187c('0x2b')][_0x187c('0x2d')]},{'where':{'id':_0x55a602[_0x187c('0x2e')]['id']}});}else{return;}})[_0x187c('0x16')](function(){return _0x51f67e[_0x187c('0x2f')]({'read':!![]});})['catch'](function(_0x32d21b){logger[_0x187c('0x19')](_0x187c('0x21'),_0x187c('0x22'),util[_0x187c('0x30')](_0x32d21b,{'showHidden':![],'depth':null}));_0x2d5dc3();});}else{_0x2d5dc3();}})[_0x187c('0x31')](function(){_0x2d5dc3();});}else{_0x2d5dc3();}}},'charset':'utf8mb4','collate':_0x187c('0x32')});}; \ No newline at end of file +var _0x6712=['inspect','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','findOne','OpenchannelInteractionId','createdAt','catch','error','secret','CmContact','describe','OpenchannelAccount','find','keys','then','replyUri','info','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Interactions','Contact','POST','method','GET','afterCreate','threadId','OpenchannelInteraction','update','OpenchannelMessage,\x20%s,\x20%s'];(function(_0xd6fcb5,_0x526523){var _0x278ac7=function(_0x3a9512){while(--_0x3a9512){_0xd6fcb5['push'](_0xd6fcb5['shift']());}};_0x278ac7(++_0x526523);}(_0x6712,0x13c));var _0x2671=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x6712[_0x18ab2a];return _0x16dcee;};'use strict';var _=require('lodash');var util=require(_0x2671('0x0'));var logger=require(_0x2671('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2671('0x2'));var rp=require(_0x2671('0x3'));var fs=require('fs');var path=require(_0x2671('0x4'));var rimraf=require('rimraf');var config=require(_0x2671('0x5'));var attributes=require(_0x2671('0x6'));module['exports']=function(_0x11ecb7,_0x3654af){return _0x11ecb7[_0x2671('0x7')](_0x2671('0x8'),attributes,{'tableName':_0x2671('0x9'),'paranoid':![],'indexes':[{'name':_0x2671('0xa'),'fields':[_0x2671('0xb')],'type':_0x2671('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4709dd,_0x461468,_0x241b8e){var _0x34293a=_0x11ecb7[_0x2671('0xd')];var _0x7476c6=_0x4709dd['get']({'plain':!![]});if(_0x7476c6[_0x2671('0xe')][_0x2671('0xf')]()==='in'||_0x7476c6[_0x2671('0xe')]['toLowerCase']()===_0x2671('0x10')&&!_0x7476c6['secret']&&!_[_0x2671('0x11')](_0x7476c6[_0x2671('0x12')])){_0x34293a['OpenchannelInteraction'][_0x2671('0x13')]({'where':{'id':_0x7476c6[_0x2671('0x14')]}})['then'](function(_0x2f566e){if(_0x2f566e){_0x2f566e['update']({'lastMsgAt':_0x7476c6[_0x2671('0x15')],'lastMsgDirection':_0x7476c6[_0x2671('0xe')][_0x2671('0xf')]()});}})[_0x2671('0x16')](function(_0x28eb2a){console[_0x2671('0x17')](_0x28eb2a);});}if(_0x7476c6['direction']===_0x2671('0x10')&&!_0x7476c6[_0x2671('0x18')]){var _0x249c77;_0x34293a[_0x2671('0x19')][_0x2671('0x1a')]()['then'](function(_0x14095c){return _0x34293a[_0x2671('0x1b')][_0x2671('0x1c')]({'where':{'id':_0x7476c6['OpenchannelAccountId']},'include':[{'model':_0x34293a['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x7476c6[_0x2671('0x14')]},'limit':0x1,'include':[{'model':_0x34293a[_0x2671('0x19')],'as':'Contact','attributes':_[_0x2671('0x1d')](_0x14095c)}]}]});})[_0x2671('0x1e')](function(_0x4dd2b0){_0x249c77=_0x4dd2b0['get']({'plain':!![]});if(_0x249c77&&_0x249c77[_0x2671('0x1f')]){logger[_0x2671('0x20')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x2671('0x21')](_0x2671('0x22'),_0x7476c6['id'],_0x249c77[_0x2671('0x1f')]));if(_0x249c77['Interactions']&&_0x249c77['Interactions'][_0x2671('0x23')]){_0x7476c6[_0x2671('0x24')]=_[_0x2671('0x25')](_0x249c77[_0x2671('0x26')][0x0],_0x2671('0x27'));_0x7476c6[_0x2671('0x27')]=_0x249c77[_0x2671('0x26')][0x0]['Contact'];}var _0x461468={'method':_0x2671('0x28'),'uri':encodeURI(_0x249c77[_0x2671('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x461468[_0x2671('0x29')]){case _0x2671('0x2a'):_0x461468['qs']=_0x7476c6;break;case _0x2671('0x28'):_0x461468[_0x2671('0xb')]=_0x7476c6;break;}return rp(_0x461468)[_0x2671('0x1e')](function(_0x4cdc81){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2671('0x2b'),util[_0x2671('0x21')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x7476c6['id'],_0x249c77[_0x2671('0x1f')]));if(_0x4cdc81['body'][_0x2671('0x2c')]&&_0x4cdc81[_0x2671('0xb')][_0x2671('0x2c')]!=_0x7476c6[_0x2671('0x24')][_0x2671('0x2c')]){return _0x34293a[_0x2671('0x2d')]['update']({'threadId':_0x4cdc81[_0x2671('0xb')][_0x2671('0x2c')]},{'where':{'id':_0x7476c6[_0x2671('0x24')]['id']}});}else{return;}})[_0x2671('0x1e')](function(){return _0x4709dd[_0x2671('0x2e')]({'read':!![]});})[_0x2671('0x16')](function(_0x25de11){logger[_0x2671('0x17')](_0x2671('0x2f'),_0x2671('0x2b'),util[_0x2671('0x30')](_0x25de11,{'showHidden':![],'depth':null}));_0x241b8e();});}else{_0x241b8e();}})[_0x2671('0x31')](function(){_0x241b8e();});}else{_0x241b8e();}}},'charset':_0x2671('0x32'),'collate':_0x2671('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 7760459..8ee41a1 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 _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0xc3cdbc,_0x265415){var _0x4a8a2c=function(_0x1e9007){while(--_0x1e9007){_0xc3cdbc['push'](_0xc3cdbc['shift']());}};_0x4a8a2c(++_0x265415);}(_0xadb5,0xad));var _0x5adb=function(_0x3dd9ec,_0x47c75a){_0x3dd9ec=_0x3dd9ec-0x0;var _0x19220a=_0xadb5[_0x3dd9ec];return _0x19220a;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1c09c6,_0x3378f4){var _0x895cd9=function(_0x117d56){while(--_0x117d56){_0x1c09c6['push'](_0x1c09c6['shift']());}};_0x895cd9(++_0x3378f4);}(_0x5f2f,0x73));var _0xf5f2=function(_0xfadccd,_0x290136){_0xfadccd=_0xfadccd-0x0;var _0x482ac4=_0x5f2f[_0xfadccd];return _0x482ac4;};'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});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 717eb61..14e0f01 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 _0x4059=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0x4059,0xb2));var _0x9405=function(_0xca0aac,_0x23689c){_0xca0aac=_0xca0aac-0x0;var _0x58a0c1=_0x4059[_0xca0aac];return _0x58a0c1;};'use strict';var OpenchannelMessageEvents=require(_0x9405('0x0'));var events=[_0x9405('0x1'),_0x9405('0x2'),_0x9405('0x3')];function createListener(_0x12007c,_0x51ccd7){return function(_0xe43380){_0x51ccd7[_0x9405('0x4')](_0x12007c,_0xe43380);};}function removeListener(_0x230fff,_0x1fe9d1){return function(){OpenchannelMessageEvents[_0x9405('0x5')](_0x230fff,_0x1fe9d1);};}exports['register']=function(_0x904624){for(var _0x3701f3=0x0,_0x5e1b5e=events[_0x9405('0x6')];_0x3701f3<_0x5e1b5e;_0x3701f3++){var _0x18dd09=events[_0x3701f3];var _0x4fc464=createListener(_0x9405('0x7')+_0x18dd09,_0x904624);OpenchannelMessageEvents['on'](_0x18dd09,_0x4fc464);}}; \ No newline at end of file +var _0x2e41=['save','remove','update','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x2e41,0x15e));var _0x12e4=function(_0x569a45,_0x2da15b){_0x569a45=_0x569a45-0x0;var _0x1a5ef8=_0x2e41[_0x569a45];return _0x1a5ef8;};'use strict';var OpenchannelMessageEvents=require(_0x12e4('0x0'));var events=[_0x12e4('0x1'),_0x12e4('0x2'),_0x12e4('0x3')];function createListener(_0x570853,_0x7b29f1){return function(_0x38635f){_0x7b29f1[_0x12e4('0x4')](_0x570853,_0x38635f);};}function removeListener(_0x1e70b1,_0x40230e){return function(){OpenchannelMessageEvents[_0x12e4('0x5')](_0x1e70b1,_0x40230e);};}exports[_0x12e4('0x6')]=function(_0xc60957){for(var _0x5cb40a=0x0,_0xe6fb54=events[_0x12e4('0x7')];_0x5cb40a<_0xe6fb54;_0x5cb40a++){var _0x41a441=events[_0x5cb40a];var _0x38d311=createListener(_0x12e4('0x8')+_0x41a441,_0xc60957);OpenchannelMessageEvents['on'](_0x41a441,_0x38d311);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 90eea57..9f7f978 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 _0x397f=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','/:id','update','delete','removeTeams','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','show'];(function(_0x205255,_0x18ef0e){var _0x185a99=function(_0x6b3c1f){while(--_0x6b3c1f){_0x205255['push'](_0x205255['shift']());}};_0x185a99(++_0x18ef0e);}(_0x397f,0x1c2));var _0xf397=function(_0x738311,_0xba0d68){_0x738311=_0x738311-0x0;var _0x4a616=_0x397f[_0x738311];return _0x4a616;};'use strict';var multer=require('multer');var util=require(_0xf397('0x0'));var path=require(_0xf397('0x1'));var timeout=require('connect-timeout');var express=require(_0xf397('0x2'));var router=express[_0xf397('0x3')]();var fs_extra=require(_0xf397('0x4'));var auth=require(_0xf397('0x5'));var interaction=require(_0xf397('0x6'));var config=require(_0xf397('0x7'));var controller=require(_0xf397('0x8'));router[_0xf397('0x9')]('/',auth[_0xf397('0xa')](),controller[_0xf397('0xb')]);router[_0xf397('0x9')]('/describe',auth[_0xf397('0xa')](),controller[_0xf397('0xc')]);router[_0xf397('0x9')]('/:id',auth[_0xf397('0xa')](),controller[_0xf397('0xd')]);router['get'](_0xf397('0xe'),auth[_0xf397('0xa')](),controller[_0xf397('0xf')]);router[_0xf397('0x9')](_0xf397('0x10'),auth[_0xf397('0xa')](),controller[_0xf397('0x11')]);router[_0xf397('0x9')](_0xf397('0x12'),auth['isAuthenticated'](),controller[_0xf397('0x13')]);router[_0xf397('0x14')]('/',auth[_0xf397('0xa')](),controller[_0xf397('0x15')]);router[_0xf397('0x14')]('/:id/teams',auth[_0xf397('0xa')](),controller['addTeams']);router[_0xf397('0x14')](_0xf397('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0xf397('0x16')](_0xf397('0x17'),auth[_0xf397('0xa')](),controller[_0xf397('0x18')]);router['delete'](_0xf397('0x17'),auth['isAuthenticated'](),controller['destroy']);router[_0xf397('0x19')]('/:id/teams',auth[_0xf397('0xa')](),controller[_0xf397('0x1a')]);router[_0xf397('0x19')]('/:id/users',auth[_0xf397('0xa')](),controller[_0xf397('0x1b')]);module[_0xf397('0x1c')]=router; \ No newline at end of file +var _0xe062=['removeAgents','exports','multer','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','destroy','delete','removeTeams'];(function(_0x24dfb7,_0x2bf1bf){var _0x525851=function(_0xa8a946){while(--_0xa8a946){_0x24dfb7['push'](_0x24dfb7['shift']());}};_0x525851(++_0x2bf1bf);}(_0xe062,0x6e));var _0x2e06=function(_0x3952de,_0x3e3c0c){_0x3952de=_0x3952de-0x0;var _0x5e756a=_0xe062[_0x3952de];return _0x5e756a;};'use strict';var multer=require(_0x2e06('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2e06('0x1'));var auth=require(_0x2e06('0x2'));var interaction=require(_0x2e06('0x3'));var config=require(_0x2e06('0x4'));var controller=require(_0x2e06('0x5'));router[_0x2e06('0x6')]('/',auth[_0x2e06('0x7')](),controller['index']);router[_0x2e06('0x6')](_0x2e06('0x8'),auth[_0x2e06('0x7')](),controller[_0x2e06('0x9')]);router['get'](_0x2e06('0xa'),auth[_0x2e06('0x7')](),controller[_0x2e06('0xb')]);router[_0x2e06('0x6')](_0x2e06('0xc'),auth[_0x2e06('0x7')](),controller['getMembers']);router['get'](_0x2e06('0xd'),auth[_0x2e06('0x7')](),controller[_0x2e06('0xe')]);router[_0x2e06('0x6')](_0x2e06('0xf'),auth[_0x2e06('0x7')](),controller[_0x2e06('0x10')]);router[_0x2e06('0x11')]('/',auth[_0x2e06('0x7')](),controller[_0x2e06('0x12')]);router[_0x2e06('0x11')](_0x2e06('0xd'),auth[_0x2e06('0x7')](),controller[_0x2e06('0x13')]);router['post'](_0x2e06('0xf'),auth[_0x2e06('0x7')](),controller[_0x2e06('0x14')]);router[_0x2e06('0x15')](_0x2e06('0xa'),auth[_0x2e06('0x7')](),controller['update']);router['delete'](_0x2e06('0xa'),auth['isAuthenticated'](),controller[_0x2e06('0x16')]);router[_0x2e06('0x17')](_0x2e06('0xd'),auth[_0x2e06('0x7')](),controller[_0x2e06('0x18')]);router[_0x2e06('0x17')](_0x2e06('0xf'),auth[_0x2e06('0x7')](),controller[_0x2e06('0x19')]);module[_0x2e06('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 22ebbf0..b90b479 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 _0x42e4=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0x42e4,0xdf));var _0x442e=function(_0x7046e,_0x121ce1){_0x7046e=_0x7046e-0x0;var _0x256ee7=_0x42e4[_0x7046e];return _0x256ee7;};'use strict';var Sequelize=require(_0x442e('0x0'));module['exports']={'name':{'type':Sequelize[_0x442e('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x442e('0x1')]},'timeout':{'type':Sequelize[_0x442e('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x442e('0x3')](_0x442e('0x4'),_0x442e('0x5'),_0x442e('0x6'))}}; \ No newline at end of file +var _0x3bb6=['STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x451578,_0x55365e){var _0x2680e8=function(_0x163a61){while(--_0x163a61){_0x451578['push'](_0x451578['shift']());}};_0x2680e8(++_0x55365e);}(_0x3bb6,0x1c8));var _0x63bb=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3bb6[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x63bb('0x0')],'unique':_0x63bb('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x63bb('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x63bb('0x2')](_0x63bb('0x3'),_0x63bb('0x4'),_0x63bb('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index e9b54f0..4e73b0a 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 _0xd243=['map','OpenchannelQueue','fieldName','key','getOptions','where','include','query','findAll','show','params','keys','rawAttributes','filters','attributes','intersection','model','fields','length','includeAll','options','create','user','role','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','body','find','catch','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','sort','pick','filter','merge','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Team','online','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','order','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','update','then','destroy','get','UserProfileResource','error','stack','name','index'];(function(_0x6b197f,_0x1f80d5){var _0x48e0b7=function(_0x44ee8a){while(--_0x44ee8a){_0x6b197f['push'](_0x6b197f['shift']());}};_0x48e0b7(++_0x1f80d5);}(_0xd243,0x1c9));var _0x3d24=function(_0x209fee,_0x514038){_0x209fee=_0x209fee-0x0;var _0x4644c9=_0xd243[_0x209fee];return _0x4644c9;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3d24('0x0'));var squel=require('squel');var Redis=require(_0x3d24('0x1'));var qs=require(_0x3d24('0x2'));var logger=require('../../config/logger')(_0x3d24('0x3'));var config=require(_0x3d24('0x4'));var db=require('../../mysqldb')['db'];config[_0x3d24('0x5')]=_['defaults'](config[_0x3d24('0x5')],{'host':_0x3d24('0x6'),'port':0x18eb});var socket=require(_0x3d24('0x7'))(new Redis(config[_0x3d24('0x5')]));require(_0x3d24('0x8'))['register'](socket);function respondWithStatusCode(_0x58e680,_0x1e2c40){_0x1e2c40=_0x1e2c40||0xcc;return function(_0x23b33e){if(_0x23b33e){return _0x58e680[_0x3d24('0x9')](_0x1e2c40);}return _0x58e680['status'](_0x1e2c40)[_0x3d24('0xa')]();};}function respondWithResult(_0x361a5d,_0x1dfc6d){_0x1dfc6d=_0x1dfc6d||0xc8;return function(_0x4e746a){if(_0x4e746a){return _0x361a5d[_0x3d24('0xb')](_0x1dfc6d)[_0x3d24('0xc')](_0x4e746a);}};}function respondWithFilteredResult(_0x1c9094,_0x583955){return function(_0x44135e){if(_0x44135e){var _0x51cd33=typeof _0x583955[_0x3d24('0xd')]===_0x3d24('0xe')&&typeof _0x583955[_0x3d24('0xf')]==='undefined';var _0x2a149d=_0x44135e[_0x3d24('0x10')];var _0x5d8378=_0x51cd33?0x0:_0x583955[_0x3d24('0xd')];var _0x4610e8=_0x51cd33?_0x44135e[_0x3d24('0x10')]:_0x583955[_0x3d24('0xd')]+_0x583955[_0x3d24('0xf')];var _0x31359b;if(_0x4610e8>=_0x2a149d){_0x4610e8=_0x2a149d;_0x31359b=0xc8;}else{_0x31359b=0xce;}_0x1c9094['status'](_0x31359b);return _0x1c9094[_0x3d24('0x11')]('Content-Range',_0x5d8378+'-'+_0x4610e8+'/'+_0x2a149d)['json'](_0x44135e);}return null;};}function saveUpdates(_0x3965f7){return function(_0xd8e302){if(_0xd8e302){return _0xd8e302[_0x3d24('0x12')](_0x3965f7)[_0x3d24('0x13')](function(_0x5038b5){return _0x5038b5;});}return null;};}function removeEntity(_0x36d949){return function(_0x4f179d){if(_0x4f179d){return _0x4f179d[_0x3d24('0x14')]()[_0x3d24('0x13')](function(){var _0x10e45f=_0x4f179d[_0x3d24('0x15')]({'plain':!![]});var _0x53338f='OpenchannelQueues';return db[_0x3d24('0x16')][_0x3d24('0x14')]({'where':{'type':_0x53338f,'resourceId':_0x10e45f['id']}})[_0x3d24('0x13')](function(){return _0x4f179d;});})[_0x3d24('0x13')](function(){_0x36d949[_0x3d24('0xb')](0xcc)[_0x3d24('0xa')]();});}};}function handleEntityNotFound(_0x3aeb95){return function(_0x1fe70d){if(!_0x1fe70d){_0x3aeb95['sendStatus'](0x194);}return _0x1fe70d;};}function handleError(_0x102341,_0x597825){_0x597825=_0x597825||0x1f4;return function(_0x5beeaa){logger[_0x3d24('0x17')](_0x5beeaa[_0x3d24('0x18')]);if(_0x5beeaa[_0x3d24('0x19')]){delete _0x5beeaa['name'];}_0x102341[_0x3d24('0xb')](_0x597825)['send'](_0x5beeaa);};}exports[_0x3d24('0x1a')]=function(_0x52a247,_0xde10d9){var _0x3e12fd={};var _0x44d668={'count':0x0,'rows':[]};var _0x4b4a7a=_[_0x3d24('0x1b')](db[_0x3d24('0x1c')]['rawAttributes'],function(_0xe7a26f){return{'name':_0xe7a26f[_0x3d24('0x1d')],'type':_0xe7a26f['type'][_0x3d24('0x1e')]};});_0x3e12fd=qs[_0x3d24('0x1f')](_0x4b4a7a,_0x52a247);var _0x5270ee={'where':_0x3e12fd[_0x3d24('0x20')]};return db[_0x3d24('0x1c')][_0x3d24('0x10')](_0x5270ee)['then'](function(_0x83533){_0x44d668[_0x3d24('0x10')]=_0x83533;_0x3e12fd[_0x3d24('0x21')]=qs[_0x3d24('0x21')](_0x52a247[_0x3d24('0x22')]);return db['OpenchannelQueue'][_0x3d24('0x23')](_0x3e12fd);})[_0x3d24('0x13')](function(_0x356f75){_0x44d668['rows']=_0x356f75;return _0x44d668;})['then'](respondWithFilteredResult(_0xde10d9,_0x3e12fd))['catch'](handleError(_0xde10d9,null));};exports[_0x3d24('0x24')]=function(_0x466199,_0x310a7b){var _0x15c79b={'raw':!![],'where':{'id':_0x466199[_0x3d24('0x25')]['id']}},_0x59a138={};_0x59a138['model']=_[_0x3d24('0x26')](db[_0x3d24('0x1c')][_0x3d24('0x27')]);_0x59a138[_0x3d24('0x22')]=_['keys'](_0x466199[_0x3d24('0x22')]);_0x59a138[_0x3d24('0x28')]=_['intersection'](_0x59a138['model'],_0x59a138[_0x3d24('0x22')]);_0x15c79b[_0x3d24('0x29')]=_[_0x3d24('0x2a')](_0x59a138[_0x3d24('0x2b')],qs['fields'](_0x466199[_0x3d24('0x22')][_0x3d24('0x2c')]));_0x15c79b['attributes']=_0x15c79b['attributes'][_0x3d24('0x2d')]?_0x15c79b[_0x3d24('0x29')]:_0x59a138['model'];if(_0x466199[_0x3d24('0x22')][_0x3d24('0x2e')]){_0x15c79b[_0x3d24('0x21')]=[{'all':!![]}];}_0x15c79b=_['merge']({},_0x15c79b,_0x466199[_0x3d24('0x2f')]);return db[_0x3d24('0x1c')]['find'](_0x15c79b)[_0x3d24('0x13')](handleEntityNotFound(_0x310a7b,null))[_0x3d24('0x13')](respondWithResult(_0x310a7b,null))['catch'](handleError(_0x310a7b,null));};exports[_0x3d24('0x30')]=function(_0x50dd16,_0x7c0f6e){return db[_0x3d24('0x1c')]['create'](_0x50dd16['body'],{})[_0x3d24('0x13')](function(_0x22fb86){var _0x45f6dd=_0x50dd16[_0x3d24('0x31')]['get']({'plain':!![]});if(!_0x45f6dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45f6dd[_0x3d24('0x32')]===_0x3d24('0x31')){var _0x203595=_0x22fb86[_0x3d24('0x15')]({'plain':!![]});var _0x1fae5e=_0x3d24('0x33');return db[_0x3d24('0x34')]['find']({'where':{'name':_0x1fae5e,'userProfileId':_0x45f6dd[_0x3d24('0x35')]},'raw':!![]})[_0x3d24('0x13')](function(_0x3a76d5){if(_0x3a76d5&&_0x3a76d5[_0x3d24('0x36')]===0x0){return db['UserProfileResource'][_0x3d24('0x30')]({'name':_0x203595[_0x3d24('0x19')],'resourceId':_0x203595['id'],'type':_0x3a76d5[_0x3d24('0x19')],'sectionId':_0x3a76d5['id']},{})[_0x3d24('0x13')](function(){return _0x22fb86;});}else{return _0x22fb86;}})['catch'](function(_0x508cf6){logger[_0x3d24('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x508cf6);throw _0x508cf6;});}return _0x22fb86;})[_0x3d24('0x13')](respondWithResult(_0x7c0f6e,0xc9))['catch'](handleError(_0x7c0f6e,null));};exports[_0x3d24('0x12')]=function(_0x17eaea,_0x26bb53){if(_0x17eaea['body']['id']){delete _0x17eaea[_0x3d24('0x37')]['id'];}return db[_0x3d24('0x1c')][_0x3d24('0x38')]({'where':{'id':_0x17eaea['params']['id']}})[_0x3d24('0x13')](handleEntityNotFound(_0x26bb53,null))[_0x3d24('0x13')](saveUpdates(_0x17eaea['body'],null))[_0x3d24('0x13')](respondWithResult(_0x26bb53,null))['catch'](handleError(_0x26bb53,null));};exports[_0x3d24('0x14')]=function(_0x25fe1d,_0x25065f){return db['OpenchannelQueue']['find']({'where':{'id':_0x25fe1d[_0x3d24('0x25')]['id']}})[_0x3d24('0x13')](handleEntityNotFound(_0x25065f,null))[_0x3d24('0x13')](removeEntity(_0x25065f,null))[_0x3d24('0x39')](handleError(_0x25065f,null));};exports[_0x3d24('0x3a')]=function(_0x85d7b7,_0x8bf3d6){return db['OpenchannelQueue']['describe']()[_0x3d24('0x13')](respondWithResult(_0x8bf3d6,null))[_0x3d24('0x39')](handleError(_0x8bf3d6,null));};exports[_0x3d24('0x3b')]=function(_0x497d79,_0x14c732){var _0x403b1a={'raw':!![],'where':{}},_0x4ba5d6={},_0x5bad93;return db[_0x3d24('0x1c')][_0x3d24('0x3c')]({'where':{'id':_0x497d79['params']['id']}})['then'](handleEntityNotFound(_0x14c732,null))['then'](function(_0x2818a6){if(_0x2818a6){_0x5bad93=_0x2818a6['get']({'plain':!![]});_0x4ba5d6[_0x3d24('0x2b')]=_[_0x3d24('0x26')](db[_0x3d24('0x3d')][_0x3d24('0x27')]);_0x4ba5d6[_0x3d24('0x22')]=_[_0x3d24('0x26')](_0x497d79[_0x3d24('0x22')]);_0x4ba5d6['filters']=_['intersection'](_0x4ba5d6[_0x3d24('0x2b')],_0x4ba5d6[_0x3d24('0x22')]);_0x403b1a[_0x3d24('0x29')]=_[_0x3d24('0x2a')](_0x4ba5d6[_0x3d24('0x2b')],qs['fields'](_0x497d79['query']['fields']));_0x403b1a['attributes']=_0x403b1a[_0x3d24('0x29')][_0x3d24('0x2d')]?_0x403b1a[_0x3d24('0x29')]:_0x4ba5d6['model'];if(!_0x497d79[_0x3d24('0x22')][_0x3d24('0x3e')](_0x3d24('0x3f'))){_0x403b1a['limit']=qs[_0x3d24('0xf')](_0x497d79[_0x3d24('0x22')][_0x3d24('0xf')]);_0x403b1a[_0x3d24('0xd')]=qs[_0x3d24('0xd')](_0x497d79[_0x3d24('0x22')][_0x3d24('0xd')]);}_0x403b1a['order']=qs[_0x3d24('0x40')](_0x497d79[_0x3d24('0x22')]['sort']);_0x403b1a[_0x3d24('0x20')]=qs[_0x3d24('0x28')](_[_0x3d24('0x41')](_0x497d79['query'],_0x4ba5d6[_0x3d24('0x28')]));_0x403b1a['where']['OpenchannelQueueId']=_0x2818a6['id'];if(_0x497d79[_0x3d24('0x22')][_0x3d24('0x42')]){_0x403b1a[_0x3d24('0x20')]=_[_0x3d24('0x43')](_0x403b1a[_0x3d24('0x20')],{'$or':_[_0x3d24('0x1b')](_0x403b1a[_0x3d24('0x29')],function(_0x174ed9){var _0x5b5a3a={};_0x5b5a3a[_0x174ed9]={'$like':'%'+_0x497d79[_0x3d24('0x22')][_0x3d24('0x42')]+'%'};return _0x5b5a3a;})});}_0x403b1a=_[_0x3d24('0x43')]({},_0x403b1a,_0x497d79[_0x3d24('0x2f')]);return db[_0x3d24('0x3d')][_0x3d24('0x23')](_0x403b1a);}})[_0x3d24('0x13')](function(_0x37dc07){if(_0x37dc07){return db[_0x3d24('0x44')][_0x3d24('0x45')]({'where':{'id':_[_0x3d24('0x1b')](_0x37dc07,_0x3d24('0x46')),'role':_0x3d24('0x47')},'attributes':['id','name',_0x3d24('0x48'),_0x3d24('0x49'),'createdAt']});}})[_0x3d24('0x13')](function(_0x1faa54){if(_0x1faa54){return{'count':_0x1faa54[_0x3d24('0x10')],'rows':_[_0x3d24('0x1b')](_0x1faa54[_0x3d24('0x4a')],function(_0x4c9e72){return{'membername':_0x4c9e72['name'],'UserId':_0x4c9e72['id'],'queue_name':_0x5bad93[_0x3d24('0x19')],'OpenchannelQueueId':_0x5bad93['id'],'interface':util[_0x3d24('0x4b')](_0x3d24('0x4c'),_0x3d24('0x4d'),_0x4c9e72[_0x3d24('0x19')]),'penalty':0x0,'paused':_0x4c9e72[_0x3d24('0x48')],'createdAt':_0x4c9e72[_0x3d24('0x4e')],'updatedAt':_0x4c9e72[_0x3d24('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3d24('0x13')](respondWithFilteredResult(_0x14c732,_0x403b1a))[_0x3d24('0x39')](handleError(_0x14c732,null));};exports[_0x3d24('0x4f')]=function(_0x3e0a52,_0x3f5c0f){var _0x54f520={};var _0x475a50={};var _0x2a9ebf;var _0x423ad9;return db[_0x3d24('0x1c')][_0x3d24('0x3c')]({'where':{'id':_0x3e0a52[_0x3d24('0x25')]['id']}})[_0x3d24('0x13')](handleEntityNotFound(_0x3f5c0f,null))[_0x3d24('0x13')](function(_0x5b7663){if(_0x5b7663){_0x2a9ebf=_0x5b7663;_0x475a50[_0x3d24('0x2b')]=_['keys'](db['Team'][_0x3d24('0x27')]);_0x475a50[_0x3d24('0x22')]=_[_0x3d24('0x26')](_0x3e0a52[_0x3d24('0x22')]);_0x475a50['filters']=_[_0x3d24('0x2a')](_0x475a50[_0x3d24('0x2b')],_0x475a50[_0x3d24('0x22')]);_0x54f520[_0x3d24('0x29')]=_[_0x3d24('0x2a')](_0x475a50['model'],qs[_0x3d24('0x2c')](_0x3e0a52[_0x3d24('0x22')][_0x3d24('0x2c')]));_0x54f520[_0x3d24('0x29')]=_0x54f520[_0x3d24('0x29')]['length']?_0x54f520[_0x3d24('0x29')]:_0x475a50['model'];_0x54f520['order']=qs[_0x3d24('0x40')](_0x3e0a52['query'][_0x3d24('0x40')]);_0x54f520[_0x3d24('0x20')]=qs[_0x3d24('0x28')](_[_0x3d24('0x41')](_0x3e0a52[_0x3d24('0x22')],_0x475a50['filters']));if(_0x3e0a52[_0x3d24('0x22')]['filter']){_0x54f520[_0x3d24('0x20')]=_['merge'](_0x54f520[_0x3d24('0x20')],{'$or':_['map'](_0x54f520[_0x3d24('0x29')],function(_0x1f1f8f){var _0x1d432a={};_0x1d432a[_0x1f1f8f]={'$like':'%'+_0x3e0a52[_0x3d24('0x22')][_0x3d24('0x42')]+'%'};return _0x1d432a;})});}_0x54f520=_['merge']({},_0x54f520,_0x3e0a52[_0x3d24('0x2f')]);return _0x2a9ebf[_0x3d24('0x4f')](_0x54f520);}})[_0x3d24('0x13')](function(_0x273777){if(_0x273777){_0x423ad9=_0x273777[_0x3d24('0x2d')];if(!_0x3e0a52[_0x3d24('0x22')][_0x3d24('0x3e')](_0x3d24('0x3f'))){_0x54f520[_0x3d24('0xf')]=qs[_0x3d24('0xf')](_0x3e0a52[_0x3d24('0x22')][_0x3d24('0xf')]);_0x54f520['offset']=qs[_0x3d24('0xd')](_0x3e0a52[_0x3d24('0x22')][_0x3d24('0xd')]);}return _0x2a9ebf[_0x3d24('0x4f')](_0x54f520);}})[_0x3d24('0x13')](function(_0x371025){if(_0x371025){return _0x371025?{'count':_0x423ad9,'rows':_0x371025}:null;}})[_0x3d24('0x13')](respondWithResult(_0x3f5c0f,null))[_0x3d24('0x39')](handleError(_0x3f5c0f,null));};exports[_0x3d24('0x50')]=function(_0x4ed8d2,_0x2a7be2){var _0x3524da=_0x4ed8d2['body'][_0x3d24('0x51')];return db[_0x3d24('0x52')]['findAll']({'where':{'id':_0x3524da},'attributes':['id'],'include':[{'model':db[_0x3d24('0x44')],'as':'Agents','attributes':['id','name',_0x3d24('0x53'),'voicePause',_0x3d24('0x54')],'raw':!![]}]})[_0x3d24('0x13')](function(_0x15fae5){if(_0x15fae5){var _0x2fa392=_[_0x3d24('0x55')](_0x15fae5,function(_0x2a55bc){var _0xb36437=_0x2a55bc[_0x3d24('0x15')]({'plain':!![]});return _0xb36437[_0x3d24('0x56')];});return db['OpenchannelQueue'][_0x3d24('0x38')]({'where':{'id':_0x4ed8d2['params']['id']}})[_0x3d24('0x13')](function(_0x3ee3b3){return db[_0x3d24('0x57')][_0x3d24('0x58')](function(_0x255ee9){return _0x3ee3b3[_0x3d24('0x50')](_0x3524da,{'transaction':_0x255ee9})[_0x3d24('0x13')](function(){return BPromise['each'](_0x2fa392,function(_0x5aee23){return db[_0x3d24('0x3d')][_0x3d24('0x59')]({'where':{'UserId':_0x5aee23['id'],'OpenchannelQueueId':_0x4ed8d2[_0x3d24('0x25')]['id']},'transaction':_0x255ee9});});})['then'](function(){_0x2fa392[_0x3d24('0x5a')](function(_0x3a35ab){socket[_0x3d24('0x5b')](_0x3d24('0x5c'),{'UserId':_0x3a35ab['id'],'OpenchannelQueueId':_0x3ee3b3['id']});});});});});}})[_0x3d24('0x13')](respondWithStatusCode(_0x2a7be2,null))[_0x3d24('0x39')](handleError(_0x2a7be2,null));};exports[_0x3d24('0x5d')]=function(_0x3f8487,_0x2a1b74){return db[_0x3d24('0x52')][_0x3d24('0x23')]({'where':{'id':_0x3f8487[_0x3d24('0x22')][_0x3d24('0x51')]},'attributes':['id'],'include':[{'model':db[_0x3d24('0x44')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2a1b74,null))[_0x3d24('0x13')](function(_0x3efdcd){var _0x5fb018=_[_0x3d24('0x1b')](_0x3efdcd,'id');var _0x3252a2=[];var _0x372321=[];var _0x4ec0a2=squel[_0x3d24('0x5e')]();_0x4ec0a2[_0x3d24('0x5f')](_0x3d24('0x60'))[_0x3d24('0x61')](_0x3d24('0x62'),'tq')[_0x3d24('0x63')](_0x3d24('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3d24('0x20')](_0x3d24('0x65'),_0x3f8487['params']['id']);for(var _0x58adab=0x0;_0x58adab<_0x3efdcd['length'];_0x58adab+=0x1){let _0x5547e6=_0x3efdcd[_0x58adab];for(var _0x2ea59d=0x0;_0x2ea59d<_0x5547e6[_0x3d24('0x56')][_0x3d24('0x2d')];_0x2ea59d+=0x1){let _0x3acc73=_0x5547e6[_0x3d24('0x56')][_0x2ea59d];var _0x145f83=_0x4ec0a2[_0x3d24('0x66')]();_0x145f83[_0x3d24('0x20')](_0x3d24('0x67'),_0x3acc73['id']);_0x372321['push'](db[_0x3d24('0x57')][_0x3d24('0x22')](_0x145f83[_0x3d24('0x68')](),{'type':db['sequelize'][_0x3d24('0x69')][_0x3d24('0x6a')]})[_0x3d24('0x13')](function(_0x4855ca){if(_0x4855ca['length']===0x1){return _0x3acc73['id'];}else{var _0x3f7f45=_[_0x3d24('0x6b')](_[_0x3d24('0x1b')](_0x4855ca,_0x3d24('0x6c')),function(_0x48fd47){return _[_0x3d24('0x6d')](_0x5fb018,_0x48fd47);});if(_0x3f7f45){return _0x3acc73['id'];}}}));}}return BPromise[_0x3d24('0x6e')](_0x372321)['then'](function(_0x2ff9e8){_0x3252a2=_(_0x3252a2)[_0x3d24('0x6f')](_0x2ff9e8)['compact']()[_0x3d24('0x70')]();return db[_0x3d24('0x1c')][_0x3d24('0x38')]({'where':{'id':_0x3f8487[_0x3d24('0x25')]['id']}})[_0x3d24('0x13')](function(_0x205747){return db[_0x3d24('0x57')]['transaction'](function(_0x4b8fe2){return _0x205747[_0x3d24('0x5d')](_0x3f8487[_0x3d24('0x22')][_0x3d24('0x51')],{'transaction':_0x4b8fe2})['then'](function(){if(!_[_0x3d24('0x71')](_0x3252a2)){return _0x205747[_0x3d24('0x72')](_0x3252a2,{'transaction':_0x4b8fe2});}})[_0x3d24('0x13')](function(){_0x3252a2['forEach'](function(_0x44c84f){socket['emit'](_0x3d24('0x73'),{'UserId':_0x44c84f,'OpenchannelQueueId':_0x205747['id']});});});});});});})[_0x3d24('0x13')](respondWithStatusCode(_0x2a1b74,null))[_0x3d24('0x39')](handleError(_0x2a1b74,null));};exports['addAgents']=function(_0x10a8df,_0x421615){return db[_0x3d24('0x1c')][_0x3d24('0x38')]({'where':{'id':_0x10a8df[_0x3d24('0x25')]['id']}})[_0x3d24('0x13')](handleEntityNotFound(_0x421615,null))[_0x3d24('0x13')](function(_0x8816f2){if(_0x8816f2){return _0x8816f2[_0x3d24('0x74')](_0x10a8df['body'][_0x3d24('0x51')],_[_0x3d24('0x75')](_0x10a8df[_0x3d24('0x37')],[_0x3d24('0x51'),'id'])||{})['spread'](function(_0x387b61){for(var _0x4c0e29=0x0;_0x4c0e29<_0x10a8df[_0x3d24('0x37')]['ids'][_0x3d24('0x2d')];_0x4c0e29+=0x1){socket[_0x3d24('0x5b')](_0x3d24('0x5c'),{'UserId':Number(_0x10a8df['body']['ids'][_0x4c0e29]),'OpenchannelQueueId':Number(_0x10a8df['params']['id'])});}return _0x387b61;});}})['then'](respondWithResult(_0x421615,null))[_0x3d24('0x39')](handleError(_0x421615,null));};exports[_0x3d24('0x72')]=function(_0x29fb08,_0x4ae529){return db[_0x3d24('0x1c')]['find']({'where':{'id':_0x29fb08[_0x3d24('0x25')]['id']}})[_0x3d24('0x13')](handleEntityNotFound(_0x4ae529,null))[_0x3d24('0x13')](function(_0x4d513d){if(_0x4d513d){return _0x4d513d['removeAgents'](_0x29fb08[_0x3d24('0x22')][_0x3d24('0x51')])[_0x3d24('0x13')](function(){if(_[_0x3d24('0x76')](_0x29fb08[_0x3d24('0x22')][_0x3d24('0x51')])){for(var _0x1d53c5=0x0;_0x1d53c5<_0x29fb08[_0x3d24('0x22')]['ids'][_0x3d24('0x2d')];_0x1d53c5+=0x1){socket['emit'](_0x3d24('0x73'),{'UserId':Number(_0x29fb08[_0x3d24('0x22')][_0x3d24('0x51')][_0x1d53c5]),'OpenchannelQueueId':Number(_0x29fb08['params']['id'])});}}else{socket[_0x3d24('0x5b')](_0x3d24('0x73'),{'UserId':Number(_0x29fb08[_0x3d24('0x22')][_0x3d24('0x51')]),'OpenchannelQueueId':Number(_0x29fb08['params']['id'])});}});}})[_0x3d24('0x13')](respondWithStatusCode(_0x4ae529,null))['catch'](handleError(_0x4ae529,null));};exports[_0x3d24('0x77')]=function(_0x519c26,_0x32ba42){var _0x200200={};var _0x1c7150={};var _0x57ac2a;var _0x50f5bc;return db[_0x3d24('0x1c')][_0x3d24('0x3c')]({'where':{'id':_0x519c26['params']['id']}})['then'](handleEntityNotFound(_0x32ba42,null))['then'](function(_0xf48e82){if(_0xf48e82){_0x57ac2a=_0xf48e82;_0x1c7150[_0x3d24('0x2b')]=_[_0x3d24('0x26')](db['User'][_0x3d24('0x27')]);_0x1c7150[_0x3d24('0x22')]=_[_0x3d24('0x26')](_0x519c26[_0x3d24('0x22')]);_0x1c7150[_0x3d24('0x28')]=_[_0x3d24('0x2a')](_0x1c7150[_0x3d24('0x2b')],_0x1c7150['query']);_0x200200['attributes']=_['intersection'](_0x1c7150[_0x3d24('0x2b')],qs['fields'](_0x519c26['query']['fields']));_0x200200[_0x3d24('0x29')]=_0x200200[_0x3d24('0x29')][_0x3d24('0x2d')]?_0x200200[_0x3d24('0x29')]:_0x1c7150[_0x3d24('0x2b')];_0x200200[_0x3d24('0x78')]=qs[_0x3d24('0x40')](_0x519c26[_0x3d24('0x22')][_0x3d24('0x40')]);_0x200200[_0x3d24('0x20')]=qs['filters'](_[_0x3d24('0x41')](_0x519c26[_0x3d24('0x22')],_0x1c7150[_0x3d24('0x28')]));if(_0x519c26[_0x3d24('0x22')][_0x3d24('0x42')]){_0x200200[_0x3d24('0x20')]=_[_0x3d24('0x43')](_0x200200['where'],{'$or':_['map'](_0x200200[_0x3d24('0x29')],function(_0x10ffea){var _0x1a3bf9={};_0x1a3bf9[_0x10ffea]={'$like':'%'+_0x519c26[_0x3d24('0x22')]['filter']+'%'};return _0x1a3bf9;})});}_0x200200=_[_0x3d24('0x43')]({},_0x200200,_0x519c26[_0x3d24('0x2f')]);return _0x57ac2a[_0x3d24('0x77')](_0x200200);}})[_0x3d24('0x13')](function(_0x5830dc){if(_0x5830dc){_0x50f5bc=_0x5830dc[_0x3d24('0x2d')];if(!_0x519c26[_0x3d24('0x22')][_0x3d24('0x3e')]('nolimit')){_0x200200['limit']=qs[_0x3d24('0xf')](_0x519c26[_0x3d24('0x22')][_0x3d24('0xf')]);_0x200200[_0x3d24('0xd')]=qs[_0x3d24('0xd')](_0x519c26['query'][_0x3d24('0xd')]);}return _0x57ac2a['getAgents'](_0x200200);}})[_0x3d24('0x13')](function(_0x2a1e9e){if(_0x2a1e9e){return _0x2a1e9e?{'count':_0x50f5bc,'rows':_0x2a1e9e}:null;}})[_0x3d24('0x13')](respondWithResult(_0x32ba42,null))['catch'](handleError(_0x32ba42,null));}; \ No newline at end of file +var _0xb138=['order','pick','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','User','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','UserProfileResource','error','name','send','index','map','OpenchannelQueue','rawAttributes','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','find','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','UserOpenchannelQueue','hasOwnProperty','nolimit','sort','filter','options','findAndCountAll','UserId','agent','updatedAt','format','SIP','findOne','Team'];(function(_0x4f9a8b,_0x3dc526){var _0x35b045=function(_0x34368f){while(--_0x34368f){_0x4f9a8b['push'](_0x4f9a8b['shift']());}};_0x35b045(++_0x3dc526);}(_0xb138,0x196));var _0x8b13=function(_0x4cd7d8,_0xb25e03){_0x4cd7d8=_0x4cd7d8-0x0;var _0x5cf8ee=_0xb138[_0x4cd7d8];return _0x5cf8ee;};'use strict';var BPromise=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var _=require(_0x8b13('0x2'));var squel=require(_0x8b13('0x3'));var Redis=require(_0x8b13('0x4'));var qs=require(_0x8b13('0x5'));var logger=require('../../config/logger')(_0x8b13('0x6'));var config=require('../../config/environment');var db=require(_0x8b13('0x7'))['db'];config[_0x8b13('0x8')]=_[_0x8b13('0x9')](config[_0x8b13('0x8')],{'host':_0x8b13('0xa'),'port':0x18eb});var socket=require(_0x8b13('0xb'))(new Redis(config[_0x8b13('0x8')]));require(_0x8b13('0xc'))['register'](socket);function respondWithStatusCode(_0xd9b2be,_0x1e6d41){_0x1e6d41=_0x1e6d41||0xcc;return function(_0x3a8828){if(_0x3a8828){return _0xd9b2be[_0x8b13('0xd')](_0x1e6d41);}return _0xd9b2be[_0x8b13('0xe')](_0x1e6d41)[_0x8b13('0xf')]();};}function respondWithResult(_0x1f9676,_0x5f2f01){_0x5f2f01=_0x5f2f01||0xc8;return function(_0x281ea5){if(_0x281ea5){return _0x1f9676[_0x8b13('0xe')](_0x5f2f01)[_0x8b13('0x10')](_0x281ea5);}};}function respondWithFilteredResult(_0x180fbd,_0x599ccd){return function(_0x4f01d4){if(_0x4f01d4){var _0x23b6ca=typeof _0x599ccd[_0x8b13('0x11')]===_0x8b13('0x12')&&typeof _0x599ccd[_0x8b13('0x13')]==='undefined';var _0x4d8e2a=_0x4f01d4[_0x8b13('0x14')];var _0x7dc38a=_0x23b6ca?0x0:_0x599ccd[_0x8b13('0x11')];var _0x16e58a=_0x23b6ca?_0x4f01d4['count']:_0x599ccd[_0x8b13('0x11')]+_0x599ccd[_0x8b13('0x13')];var _0x330280;if(_0x16e58a>=_0x4d8e2a){_0x16e58a=_0x4d8e2a;_0x330280=0xc8;}else{_0x330280=0xce;}_0x180fbd['status'](_0x330280);return _0x180fbd[_0x8b13('0x15')](_0x8b13('0x16'),_0x7dc38a+'-'+_0x16e58a+'/'+_0x4d8e2a)['json'](_0x4f01d4);}return null;};}function saveUpdates(_0x5b17f7){return function(_0x540b3c){if(_0x540b3c){return _0x540b3c['update'](_0x5b17f7)[_0x8b13('0x17')](function(_0x21172f){return _0x21172f;});}return null;};}function removeEntity(_0x460e0b){return function(_0x1660af){if(_0x1660af){return _0x1660af[_0x8b13('0x18')]()['then'](function(){var _0x211f34=_0x1660af['get']({'plain':!![]});var _0x8693ac='OpenchannelQueues';return db[_0x8b13('0x19')][_0x8b13('0x18')]({'where':{'type':_0x8693ac,'resourceId':_0x211f34['id']}})[_0x8b13('0x17')](function(){return _0x1660af;});})[_0x8b13('0x17')](function(){_0x460e0b[_0x8b13('0xe')](0xcc)[_0x8b13('0xf')]();});}};}function handleEntityNotFound(_0x451118){return function(_0x4846cd){if(!_0x4846cd){_0x451118[_0x8b13('0xd')](0x194);}return _0x4846cd;};}function handleError(_0x3d55a0,_0x3f4999){_0x3f4999=_0x3f4999||0x1f4;return function(_0x2869c5){logger[_0x8b13('0x1a')](_0x2869c5['stack']);if(_0x2869c5[_0x8b13('0x1b')]){delete _0x2869c5[_0x8b13('0x1b')];}_0x3d55a0[_0x8b13('0xe')](_0x3f4999)[_0x8b13('0x1c')](_0x2869c5);};}exports[_0x8b13('0x1d')]=function(_0x3fcfc0,_0x3b3bea){var _0x308d09={};var _0x205a27={'count':0x0,'rows':[]};var _0x28ad50=_[_0x8b13('0x1e')](db[_0x8b13('0x1f')][_0x8b13('0x20')],function(_0x18855d){return{'name':_0x18855d['fieldName'],'type':_0x18855d[_0x8b13('0x21')][_0x8b13('0x22')]};});_0x308d09=qs[_0x8b13('0x23')](_0x28ad50,_0x3fcfc0);var _0x33328a={'where':_0x308d09[_0x8b13('0x24')]};return db[_0x8b13('0x1f')][_0x8b13('0x14')](_0x33328a)[_0x8b13('0x17')](function(_0x1103e8){_0x205a27['count']=_0x1103e8;_0x308d09[_0x8b13('0x25')]=qs[_0x8b13('0x25')](_0x3fcfc0[_0x8b13('0x26')]);return db[_0x8b13('0x1f')][_0x8b13('0x27')](_0x308d09);})[_0x8b13('0x17')](function(_0x115d48){_0x205a27[_0x8b13('0x28')]=_0x115d48;return _0x205a27;})[_0x8b13('0x17')](respondWithFilteredResult(_0x3b3bea,_0x308d09))[_0x8b13('0x29')](handleError(_0x3b3bea,null));};exports[_0x8b13('0x2a')]=function(_0x4c3c18,_0x39a7eb){var _0x50964c={'raw':!![],'where':{'id':_0x4c3c18[_0x8b13('0x2b')]['id']}},_0x38b4a2={};_0x38b4a2['model']=_['keys'](db[_0x8b13('0x1f')][_0x8b13('0x20')]);_0x38b4a2[_0x8b13('0x26')]=_[_0x8b13('0x2c')](_0x4c3c18[_0x8b13('0x26')]);_0x38b4a2[_0x8b13('0x2d')]=_[_0x8b13('0x2e')](_0x38b4a2['model'],_0x38b4a2['query']);_0x50964c[_0x8b13('0x2f')]=_['intersection'](_0x38b4a2[_0x8b13('0x30')],qs[_0x8b13('0x31')](_0x4c3c18[_0x8b13('0x26')]['fields']));_0x50964c['attributes']=_0x50964c[_0x8b13('0x2f')][_0x8b13('0x32')]?_0x50964c[_0x8b13('0x2f')]:_0x38b4a2['model'];if(_0x4c3c18[_0x8b13('0x26')][_0x8b13('0x33')]){_0x50964c['include']=[{'all':!![]}];}_0x50964c=_[_0x8b13('0x34')]({},_0x50964c,_0x4c3c18['options']);return db['OpenchannelQueue'][_0x8b13('0x35')](_0x50964c)['then'](handleEntityNotFound(_0x39a7eb,null))[_0x8b13('0x17')](respondWithResult(_0x39a7eb,null))[_0x8b13('0x29')](handleError(_0x39a7eb,null));};exports[_0x8b13('0x36')]=function(_0x499258,_0x5cef74){return db[_0x8b13('0x1f')]['create'](_0x499258[_0x8b13('0x37')],{})[_0x8b13('0x17')](function(_0x1863cc){var _0x54a11c=_0x499258[_0x8b13('0x38')][_0x8b13('0x39')]({'plain':!![]});if(!_0x54a11c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54a11c[_0x8b13('0x3a')]===_0x8b13('0x38')){var _0x5aa56e=_0x1863cc['get']({'plain':!![]});var _0x11b4e0='OpenchannelQueues';return db[_0x8b13('0x3b')][_0x8b13('0x35')]({'where':{'name':_0x11b4e0,'userProfileId':_0x54a11c[_0x8b13('0x3c')]},'raw':!![]})['then'](function(_0x140051){if(_0x140051&&_0x140051['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5aa56e[_0x8b13('0x1b')],'resourceId':_0x5aa56e['id'],'type':_0x140051[_0x8b13('0x1b')],'sectionId':_0x140051['id']},{})['then'](function(){return _0x1863cc;});}else{return _0x1863cc;}})[_0x8b13('0x29')](function(_0x15ee0d){logger['error'](_0x8b13('0x3d'),_0x15ee0d);throw _0x15ee0d;});}return _0x1863cc;})[_0x8b13('0x17')](respondWithResult(_0x5cef74,0xc9))[_0x8b13('0x29')](handleError(_0x5cef74,null));};exports[_0x8b13('0x3e')]=function(_0x572602,_0x450c29){if(_0x572602['body']['id']){delete _0x572602['body']['id'];}return db[_0x8b13('0x1f')][_0x8b13('0x35')]({'where':{'id':_0x572602[_0x8b13('0x2b')]['id']}})[_0x8b13('0x17')](handleEntityNotFound(_0x450c29,null))[_0x8b13('0x17')](saveUpdates(_0x572602[_0x8b13('0x37')],null))[_0x8b13('0x17')](respondWithResult(_0x450c29,null))[_0x8b13('0x29')](handleError(_0x450c29,null));};exports[_0x8b13('0x18')]=function(_0x479b4c,_0x1c8fa6){return db[_0x8b13('0x1f')][_0x8b13('0x35')]({'where':{'id':_0x479b4c['params']['id']}})[_0x8b13('0x17')](handleEntityNotFound(_0x1c8fa6,null))[_0x8b13('0x17')](removeEntity(_0x1c8fa6,null))['catch'](handleError(_0x1c8fa6,null));};exports[_0x8b13('0x3f')]=function(_0x59ba07,_0x39036c){return db[_0x8b13('0x1f')][_0x8b13('0x3f')]()['then'](respondWithResult(_0x39036c,null))[_0x8b13('0x29')](handleError(_0x39036c,null));};exports['getMembers']=function(_0xa5e97c,_0x3fa990){var _0x22c8f0={'raw':!![],'where':{}},_0x5e12a8={},_0x37b45c;return db[_0x8b13('0x1f')]['findOne']({'where':{'id':_0xa5e97c[_0x8b13('0x2b')]['id']}})[_0x8b13('0x17')](handleEntityNotFound(_0x3fa990,null))['then'](function(_0xc13b61){if(_0xc13b61){_0x37b45c=_0xc13b61['get']({'plain':!![]});_0x5e12a8[_0x8b13('0x30')]=_[_0x8b13('0x2c')](db[_0x8b13('0x40')][_0x8b13('0x20')]);_0x5e12a8[_0x8b13('0x26')]=_[_0x8b13('0x2c')](_0xa5e97c[_0x8b13('0x26')]);_0x5e12a8[_0x8b13('0x2d')]=_[_0x8b13('0x2e')](_0x5e12a8[_0x8b13('0x30')],_0x5e12a8[_0x8b13('0x26')]);_0x22c8f0['attributes']=_[_0x8b13('0x2e')](_0x5e12a8[_0x8b13('0x30')],qs[_0x8b13('0x31')](_0xa5e97c['query'][_0x8b13('0x31')]));_0x22c8f0[_0x8b13('0x2f')]=_0x22c8f0[_0x8b13('0x2f')][_0x8b13('0x32')]?_0x22c8f0[_0x8b13('0x2f')]:_0x5e12a8['model'];if(!_0xa5e97c[_0x8b13('0x26')][_0x8b13('0x41')](_0x8b13('0x42'))){_0x22c8f0[_0x8b13('0x13')]=qs[_0x8b13('0x13')](_0xa5e97c[_0x8b13('0x26')][_0x8b13('0x13')]);_0x22c8f0['offset']=qs[_0x8b13('0x11')](_0xa5e97c[_0x8b13('0x26')][_0x8b13('0x11')]);}_0x22c8f0['order']=qs[_0x8b13('0x43')](_0xa5e97c['query']['sort']);_0x22c8f0[_0x8b13('0x24')]=qs[_0x8b13('0x2d')](_['pick'](_0xa5e97c[_0x8b13('0x26')],_0x5e12a8['filters']));_0x22c8f0[_0x8b13('0x24')]['OpenchannelQueueId']=_0xc13b61['id'];if(_0xa5e97c[_0x8b13('0x26')][_0x8b13('0x44')]){_0x22c8f0[_0x8b13('0x24')]=_[_0x8b13('0x34')](_0x22c8f0[_0x8b13('0x24')],{'$or':_['map'](_0x22c8f0['attributes'],function(_0x1618ba){var _0x8203ca={};_0x8203ca[_0x1618ba]={'$like':'%'+_0xa5e97c[_0x8b13('0x26')][_0x8b13('0x44')]+'%'};return _0x8203ca;})});}_0x22c8f0=_[_0x8b13('0x34')]({},_0x22c8f0,_0xa5e97c[_0x8b13('0x45')]);return db['UserOpenchannelQueue'][_0x8b13('0x27')](_0x22c8f0);}})[_0x8b13('0x17')](function(_0x533327){if(_0x533327){return db['User'][_0x8b13('0x46')]({'where':{'id':_[_0x8b13('0x1e')](_0x533327,_0x8b13('0x47')),'role':_0x8b13('0x48')},'attributes':['id','name','openchannelPause',_0x8b13('0x49'),'createdAt']});}})[_0x8b13('0x17')](function(_0x1e7474){if(_0x1e7474){return{'count':_0x1e7474[_0x8b13('0x14')],'rows':_['map'](_0x1e7474[_0x8b13('0x28')],function(_0x2e817b){return{'membername':_0x2e817b['name'],'UserId':_0x2e817b['id'],'queue_name':_0x37b45c[_0x8b13('0x1b')],'OpenchannelQueueId':_0x37b45c['id'],'interface':util[_0x8b13('0x4a')]('%s/%s',_0x8b13('0x4b'),_0x2e817b['name']),'penalty':0x0,'paused':_0x2e817b['openchannelPause'],'createdAt':_0x2e817b['createdAt'],'updatedAt':_0x2e817b[_0x8b13('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8b13('0x17')](respondWithFilteredResult(_0x3fa990,_0x22c8f0))[_0x8b13('0x29')](handleError(_0x3fa990,null));};exports['getTeams']=function(_0xbc9cc0,_0x35220d){var _0x1f506c={};var _0x2ff2fa={};var _0x43ff3f;var _0x434a5b;return db[_0x8b13('0x1f')][_0x8b13('0x4c')]({'where':{'id':_0xbc9cc0[_0x8b13('0x2b')]['id']}})[_0x8b13('0x17')](handleEntityNotFound(_0x35220d,null))['then'](function(_0x5d571c){if(_0x5d571c){_0x43ff3f=_0x5d571c;_0x2ff2fa[_0x8b13('0x30')]=_[_0x8b13('0x2c')](db[_0x8b13('0x4d')][_0x8b13('0x20')]);_0x2ff2fa['query']=_['keys'](_0xbc9cc0['query']);_0x2ff2fa[_0x8b13('0x2d')]=_[_0x8b13('0x2e')](_0x2ff2fa[_0x8b13('0x30')],_0x2ff2fa[_0x8b13('0x26')]);_0x1f506c[_0x8b13('0x2f')]=_['intersection'](_0x2ff2fa[_0x8b13('0x30')],qs['fields'](_0xbc9cc0[_0x8b13('0x26')]['fields']));_0x1f506c[_0x8b13('0x2f')]=_0x1f506c['attributes'][_0x8b13('0x32')]?_0x1f506c['attributes']:_0x2ff2fa['model'];_0x1f506c[_0x8b13('0x4e')]=qs[_0x8b13('0x43')](_0xbc9cc0[_0x8b13('0x26')]['sort']);_0x1f506c[_0x8b13('0x24')]=qs['filters'](_[_0x8b13('0x4f')](_0xbc9cc0[_0x8b13('0x26')],_0x2ff2fa[_0x8b13('0x2d')]));if(_0xbc9cc0[_0x8b13('0x26')][_0x8b13('0x44')]){_0x1f506c[_0x8b13('0x24')]=_[_0x8b13('0x34')](_0x1f506c[_0x8b13('0x24')],{'$or':_[_0x8b13('0x1e')](_0x1f506c['attributes'],function(_0x7b4ff8){var _0x415f3c={};_0x415f3c[_0x7b4ff8]={'$like':'%'+_0xbc9cc0['query'][_0x8b13('0x44')]+'%'};return _0x415f3c;})});}_0x1f506c=_['merge']({},_0x1f506c,_0xbc9cc0[_0x8b13('0x45')]);return _0x43ff3f[_0x8b13('0x50')](_0x1f506c);}})[_0x8b13('0x17')](function(_0xd44f87){if(_0xd44f87){_0x434a5b=_0xd44f87[_0x8b13('0x32')];if(!_0xbc9cc0[_0x8b13('0x26')][_0x8b13('0x41')]('nolimit')){_0x1f506c[_0x8b13('0x13')]=qs[_0x8b13('0x13')](_0xbc9cc0[_0x8b13('0x26')][_0x8b13('0x13')]);_0x1f506c['offset']=qs[_0x8b13('0x11')](_0xbc9cc0[_0x8b13('0x26')][_0x8b13('0x11')]);}return _0x43ff3f[_0x8b13('0x50')](_0x1f506c);}})['then'](function(_0x481b2f){if(_0x481b2f){return _0x481b2f?{'count':_0x434a5b,'rows':_0x481b2f}:null;}})[_0x8b13('0x17')](respondWithResult(_0x35220d,null))[_0x8b13('0x29')](handleError(_0x35220d,null));};exports[_0x8b13('0x51')]=function(_0x21d47c,_0x1300b9){var _0x29f86e=_0x21d47c[_0x8b13('0x37')][_0x8b13('0x52')];return db['Team']['findAll']({'where':{'id':_0x29f86e},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8b13('0x53'),'attributes':['id',_0x8b13('0x1b'),_0x8b13('0x54'),_0x8b13('0x55'),'interface'],'raw':!![]}]})[_0x8b13('0x17')](function(_0x37c472){if(_0x37c472){var _0x20190a=_[_0x8b13('0x56')](_0x37c472,function(_0x19f40e){var _0x5ca7f3=_0x19f40e[_0x8b13('0x39')]({'plain':!![]});return _0x5ca7f3[_0x8b13('0x53')];});return db['OpenchannelQueue'][_0x8b13('0x35')]({'where':{'id':_0x21d47c[_0x8b13('0x2b')]['id']}})[_0x8b13('0x17')](function(_0x4f88b2){return db[_0x8b13('0x57')][_0x8b13('0x58')](function(_0x3c9fd6){return _0x4f88b2['addTeams'](_0x29f86e,{'transaction':_0x3c9fd6})[_0x8b13('0x17')](function(){return BPromise['each'](_0x20190a,function(_0x363092){return db[_0x8b13('0x40')][_0x8b13('0x59')]({'where':{'UserId':_0x363092['id'],'OpenchannelQueueId':_0x21d47c[_0x8b13('0x2b')]['id']},'transaction':_0x3c9fd6});});})['then'](function(){_0x20190a[_0x8b13('0x5a')](function(_0x328501){socket[_0x8b13('0x5b')](_0x8b13('0x5c'),{'UserId':_0x328501['id'],'OpenchannelQueueId':_0x4f88b2['id']});});});});});}})['then'](respondWithStatusCode(_0x1300b9,null))[_0x8b13('0x29')](handleError(_0x1300b9,null));};exports[_0x8b13('0x5d')]=function(_0x2e309b,_0x460ad8){return db[_0x8b13('0x4d')][_0x8b13('0x27')]({'where':{'id':_0x2e309b[_0x8b13('0x26')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8b13('0x5e')],'as':_0x8b13('0x53'),'attributes':['id'],'raw':!![]}]})[_0x8b13('0x17')](handleEntityNotFound(_0x460ad8,null))[_0x8b13('0x17')](function(_0xb30271){var _0x100a04=_['map'](_0xb30271,'id');var _0x3bfa09=[];var _0x19e868=[];var _0x272310=squel['select']();_0x272310['field'](_0x8b13('0x5f'))[_0x8b13('0x60')](_0x8b13('0x61'),'tq')[_0x8b13('0x62')](_0x8b13('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8b13('0x24')](_0x8b13('0x64'),_0x2e309b['params']['id']);for(var _0xce8038=0x0;_0xce8038<_0xb30271[_0x8b13('0x32')];_0xce8038+=0x1){let _0x2c6d92=_0xb30271[_0xce8038];for(var _0x3751da=0x0;_0x3751da<_0x2c6d92[_0x8b13('0x53')]['length'];_0x3751da+=0x1){let _0xe1aabd=_0x2c6d92['Agents'][_0x3751da];var _0x26d3a6=_0x272310[_0x8b13('0x65')]();_0x26d3a6['where'](_0x8b13('0x66'),_0xe1aabd['id']);_0x19e868[_0x8b13('0x67')](db[_0x8b13('0x57')]['query'](_0x26d3a6[_0x8b13('0x68')](),{'type':db[_0x8b13('0x57')][_0x8b13('0x69')][_0x8b13('0x6a')]})[_0x8b13('0x17')](function(_0x33bf61){if(_0x33bf61[_0x8b13('0x32')]===0x1){return _0xe1aabd['id'];}else{var _0x32a11d=_[_0x8b13('0x6b')](_[_0x8b13('0x1e')](_0x33bf61,_0x8b13('0x6c')),function(_0x355058){return _[_0x8b13('0x6d')](_0x100a04,_0x355058);});if(_0x32a11d){return _0xe1aabd['id'];}}}));}}return BPromise[_0x8b13('0x6e')](_0x19e868)[_0x8b13('0x17')](function(_0x3585cb){_0x3bfa09=_(_0x3bfa09)['union'](_0x3585cb)[_0x8b13('0x6f')]()[_0x8b13('0x70')]();return db[_0x8b13('0x1f')]['find']({'where':{'id':_0x2e309b[_0x8b13('0x2b')]['id']}})[_0x8b13('0x17')](function(_0x411c0f){return db['sequelize']['transaction'](function(_0x5b71fe){return _0x411c0f[_0x8b13('0x5d')](_0x2e309b['query'][_0x8b13('0x52')],{'transaction':_0x5b71fe})[_0x8b13('0x17')](function(){if(!_[_0x8b13('0x71')](_0x3bfa09)){return _0x411c0f[_0x8b13('0x72')](_0x3bfa09,{'transaction':_0x5b71fe});}})['then'](function(){_0x3bfa09[_0x8b13('0x5a')](function(_0xf3927b){socket[_0x8b13('0x5b')](_0x8b13('0x73'),{'UserId':_0xf3927b,'OpenchannelQueueId':_0x411c0f['id']});});});});});});})['then'](respondWithStatusCode(_0x460ad8,null))['catch'](handleError(_0x460ad8,null));};exports['addAgents']=function(_0x4daaad,_0x3b7636){return db['OpenchannelQueue'][_0x8b13('0x35')]({'where':{'id':_0x4daaad[_0x8b13('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3b7636,null))[_0x8b13('0x17')](function(_0x115518){if(_0x115518){return _0x115518[_0x8b13('0x74')](_0x4daaad[_0x8b13('0x37')][_0x8b13('0x52')],_[_0x8b13('0x75')](_0x4daaad['body'],[_0x8b13('0x52'),'id'])||{})[_0x8b13('0x76')](function(_0x1a944e){for(var _0x30d4b9=0x0;_0x30d4b9<_0x4daaad['body'][_0x8b13('0x52')]['length'];_0x30d4b9+=0x1){socket[_0x8b13('0x5b')](_0x8b13('0x5c'),{'UserId':Number(_0x4daaad[_0x8b13('0x37')][_0x8b13('0x52')][_0x30d4b9]),'OpenchannelQueueId':Number(_0x4daaad[_0x8b13('0x2b')]['id'])});}return _0x1a944e;});}})[_0x8b13('0x17')](respondWithResult(_0x3b7636,null))['catch'](handleError(_0x3b7636,null));};exports['removeAgents']=function(_0x119194,_0x21332b){return db['OpenchannelQueue'][_0x8b13('0x35')]({'where':{'id':_0x119194[_0x8b13('0x2b')]['id']}})[_0x8b13('0x17')](handleEntityNotFound(_0x21332b,null))[_0x8b13('0x17')](function(_0x2bd289){if(_0x2bd289){return _0x2bd289[_0x8b13('0x72')](_0x119194[_0x8b13('0x26')]['ids'])[_0x8b13('0x17')](function(){if(_[_0x8b13('0x77')](_0x119194[_0x8b13('0x26')][_0x8b13('0x52')])){for(var _0x2ac772=0x0;_0x2ac772<_0x119194['query'][_0x8b13('0x52')][_0x8b13('0x32')];_0x2ac772+=0x1){socket[_0x8b13('0x5b')](_0x8b13('0x73'),{'UserId':Number(_0x119194[_0x8b13('0x26')]['ids'][_0x2ac772]),'OpenchannelQueueId':Number(_0x119194[_0x8b13('0x2b')]['id'])});}}else{socket[_0x8b13('0x5b')]('userOpenchannelQueue:remove',{'UserId':Number(_0x119194[_0x8b13('0x26')][_0x8b13('0x52')]),'OpenchannelQueueId':Number(_0x119194[_0x8b13('0x2b')]['id'])});}});}})[_0x8b13('0x17')](respondWithStatusCode(_0x21332b,null))[_0x8b13('0x29')](handleError(_0x21332b,null));};exports[_0x8b13('0x78')]=function(_0x228550,_0xa39210){var _0x5d690d={};var _0xd9793a={};var _0x7b759b;var _0x3d43aa;return db[_0x8b13('0x1f')][_0x8b13('0x4c')]({'where':{'id':_0x228550[_0x8b13('0x2b')]['id']}})['then'](handleEntityNotFound(_0xa39210,null))[_0x8b13('0x17')](function(_0x2affda){if(_0x2affda){_0x7b759b=_0x2affda;_0xd9793a['model']=_[_0x8b13('0x2c')](db[_0x8b13('0x5e')][_0x8b13('0x20')]);_0xd9793a[_0x8b13('0x26')]=_[_0x8b13('0x2c')](_0x228550[_0x8b13('0x26')]);_0xd9793a['filters']=_['intersection'](_0xd9793a['model'],_0xd9793a[_0x8b13('0x26')]);_0x5d690d[_0x8b13('0x2f')]=_['intersection'](_0xd9793a[_0x8b13('0x30')],qs['fields'](_0x228550[_0x8b13('0x26')][_0x8b13('0x31')]));_0x5d690d[_0x8b13('0x2f')]=_0x5d690d['attributes'][_0x8b13('0x32')]?_0x5d690d['attributes']:_0xd9793a[_0x8b13('0x30')];_0x5d690d[_0x8b13('0x4e')]=qs[_0x8b13('0x43')](_0x228550['query'][_0x8b13('0x43')]);_0x5d690d[_0x8b13('0x24')]=qs[_0x8b13('0x2d')](_[_0x8b13('0x4f')](_0x228550['query'],_0xd9793a['filters']));if(_0x228550['query'][_0x8b13('0x44')]){_0x5d690d[_0x8b13('0x24')]=_['merge'](_0x5d690d[_0x8b13('0x24')],{'$or':_[_0x8b13('0x1e')](_0x5d690d[_0x8b13('0x2f')],function(_0x5a4a6c){var _0xf48fb2={};_0xf48fb2[_0x5a4a6c]={'$like':'%'+_0x228550[_0x8b13('0x26')][_0x8b13('0x44')]+'%'};return _0xf48fb2;})});}_0x5d690d=_[_0x8b13('0x34')]({},_0x5d690d,_0x228550['options']);return _0x7b759b[_0x8b13('0x78')](_0x5d690d);}})[_0x8b13('0x17')](function(_0x272a6e){if(_0x272a6e){_0x3d43aa=_0x272a6e[_0x8b13('0x32')];if(!_0x228550[_0x8b13('0x26')]['hasOwnProperty'](_0x8b13('0x42'))){_0x5d690d[_0x8b13('0x13')]=qs[_0x8b13('0x13')](_0x228550['query'][_0x8b13('0x13')]);_0x5d690d[_0x8b13('0x11')]=qs['offset'](_0x228550[_0x8b13('0x26')][_0x8b13('0x11')]);}return _0x7b759b[_0x8b13('0x78')](_0x5d690d);}})['then'](function(_0x389652){if(_0x389652){return _0x389652?{'count':_0x3d43aa,'rows':_0x389652}:null;}})[_0x8b13('0x17')](respondWithResult(_0xa39210,null))[_0x8b13('0x29')](handleError(_0xa39210,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 8009853..d6b7f82 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 _0x5393=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x2d099f,_0x40d72d){var _0x2adc30=function(_0x2a1c12){while(--_0x2a1c12){_0x2d099f['push'](_0x2d099f['shift']());}};_0x2adc30(++_0x40d72d);}(_0x5393,0x1ab));var _0x3539=function(_0x390a67,_0x426949){_0x390a67=_0x390a67-0x0;var _0x58a1fa=_0x5393[_0x390a67];return _0x58a1fa;};'use strict';var EventEmitter=require(_0x3539('0x0'));var OpenchannelQueue=require(_0x3539('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3539('0x2')](0x0);var events={'afterCreate':_0x3539('0x3'),'afterUpdate':_0x3539('0x4'),'afterDestroy':'remove'};function emitEvent(_0x13f72e){return function(_0x23f21f,_0x2817ab,_0x4d8fed){OpenchannelQueueEvents[_0x3539('0x5')](_0x13f72e+':'+_0x23f21f['id'],_0x23f21f);OpenchannelQueueEvents[_0x3539('0x5')](_0x13f72e,_0x23f21f);_0x4d8fed(null);};}for(var e in events){if(events[_0x3539('0x6')](e)){var event=events[e];OpenchannelQueue[_0x3539('0x7')](e,emitEvent(event));}}module[_0x3539('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x7d5a=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x364361,_0x4fb428){var _0x2f68f5=function(_0x1417b3){while(--_0x1417b3){_0x364361['push'](_0x364361['shift']());}};_0x2f68f5(++_0x4fb428);}(_0x7d5a,0xb8));var _0xa7d5=function(_0x35edb9,_0x2c8e90){_0x35edb9=_0x35edb9-0x0;var _0x1c29b0=_0x7d5a[_0x35edb9];return _0x1c29b0;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0xa7d5('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa7d5('0x1')](0x0);var events={'afterCreate':_0xa7d5('0x2'),'afterUpdate':_0xa7d5('0x3'),'afterDestroy':_0xa7d5('0x4')};function emitEvent(_0x4b677a){return function(_0x57388e,_0x1a87fe,_0x764f16){OpenchannelQueueEvents[_0xa7d5('0x5')](_0x4b677a+':'+_0x57388e['id'],_0x57388e);OpenchannelQueueEvents[_0xa7d5('0x5')](_0x4b677a,_0x57388e);_0x764f16(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xa7d5('0x6')](e,emitEvent(event));}}module[_0xa7d5('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index cff57b1..4fd4176 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 _0xc0bc=['bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0xc6263e,_0x405c99){var _0x38ada7=function(_0x8a9aaa){while(--_0x8a9aaa){_0xc6263e['push'](_0xc6263e['shift']());}};_0x38ada7(++_0x405c99);}(_0xc0bc,0x97));var _0xcc0b=function(_0x4689e8,_0x1a2c6e){_0x4689e8=_0x4689e8-0x0;var _0xa49476=_0xc0bc[_0x4689e8];return _0xa49476;};'use strict';var _=require(_0xcc0b('0x0'));var util=require(_0xcc0b('0x1'));var logger=require(_0xcc0b('0x2'))(_0xcc0b('0x3'));var moment=require(_0xcc0b('0x4'));var BPromise=require(_0xcc0b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc0b('0x6'));var rimraf=require(_0xcc0b('0x7'));var config=require(_0xcc0b('0x8'));var attributes=require(_0xcc0b('0x9'));module[_0xcc0b('0xa')]=function(_0x55eaf8,_0x2efefb){return _0x55eaf8[_0xcc0b('0xb')]('OpenchannelQueue',attributes,{'tableName':_0xcc0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd88d=['define','OpenchannelQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x1966ea,_0x1d5d77){var _0x3eaf3d=function(_0x187322){while(--_0x187322){_0x1966ea['push'](_0x1966ea['shift']());}};_0x3eaf3d(++_0x1d5d77);}(_0xd88d,0x106));var _0xdd88=function(_0x1b6102,_0x1fab53){_0x1b6102=_0x1b6102-0x0;var _0x5b67e2=_0xd88d[_0x1b6102];return _0x5b67e2;};'use strict';var _=require('lodash');var util=require(_0xdd88('0x0'));var logger=require(_0xdd88('0x1'))(_0xdd88('0x2'));var moment=require(_0xdd88('0x3'));var BPromise=require(_0xdd88('0x4'));var rp=require(_0xdd88('0x5'));var fs=require('fs');var path=require(_0xdd88('0x6'));var rimraf=require(_0xdd88('0x7'));var config=require(_0xdd88('0x8'));var attributes=require(_0xdd88('0x9'));module[_0xdd88('0xa')]=function(_0x63a109,_0x272ef9){return _0x63a109[_0xdd88('0xb')](_0xdd88('0xc'),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 26aa9b2..3040f26 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 _0x7509=['request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','include','map','model','ShowOpenchannelQueue','find','where','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register'];(function(_0x576ce0,_0x22f404){var _0x36f9a3=function(_0x244830){while(--_0x244830){_0x576ce0['push'](_0x576ce0['shift']());}};_0x36f9a3(++_0x22f404);}(_0x7509,0x97));var _0x9750=function(_0x397e87,_0x237eca){_0x397e87=_0x397e87-0x0;var _0x362fdd=_0x7509[_0x397e87];return _0x362fdd;};'use strict';var _=require(_0x9750('0x0'));var util=require('util');var moment=require(_0x9750('0x1'));var BPromise=require(_0x9750('0x2'));var rs=require(_0x9750('0x3'));var fs=require('fs');var Redis=require(_0x9750('0x4'));var db=require(_0x9750('0x5'))['db'];var utils=require(_0x9750('0x6'));var logger=require('../../config/logger')(_0x9750('0x7'));var config=require('../../config/environment');var jayson=require(_0x9750('0x8'));var client=jayson[_0x9750('0x9')][_0x9750('0xa')]({'port':0x232a});config[_0x9750('0xb')]=_[_0x9750('0xc')](config['redis'],{'host':_0x9750('0xd'),'port':0x18eb});var socket=require(_0x9750('0xe'))(new Redis(config[_0x9750('0xb')]));require(_0x9750('0xf'))[_0x9750('0x10')](socket);function respondWithRpcPromise(_0x57c25a,_0x18c12a,_0x5b63fe){return new BPromise(function(_0x12a876,_0x333cb4){return client[_0x9750('0x11')](_0x57c25a,_0x5b63fe)[_0x9750('0x12')](function(_0x576ba7){logger[_0x9750('0x13')](_0x9750('0x14'),_0x18c12a,_0x9750('0x15'));logger[_0x9750('0x16')](_0x9750('0x17'),_0x18c12a,_0x9750('0x15'),JSON['stringify'](_0x576ba7));if(_0x576ba7[_0x9750('0x18')]){if(_0x576ba7['error'][_0x9750('0x19')]===0x1f4){logger[_0x9750('0x18')](_0x9750('0x14'),_0x18c12a,_0x576ba7[_0x9750('0x18')][_0x9750('0x1a')]);return _0x333cb4(_0x576ba7[_0x9750('0x18')][_0x9750('0x1a')]);}logger[_0x9750('0x18')](_0x9750('0x14'),_0x18c12a,_0x576ba7['error'][_0x9750('0x1a')]);return _0x12a876(_0x576ba7['error'][_0x9750('0x1a')]);}else{logger[_0x9750('0x13')](_0x9750('0x14'),_0x18c12a,_0x9750('0x15'));_0x12a876(_0x576ba7[_0x9750('0x1b')][_0x9750('0x1a')]);}})[_0x9750('0x1c')](function(_0x132148){logger[_0x9750('0x18')](_0x9750('0x14'),_0x18c12a,_0x132148);_0x333cb4(_0x132148);});});}exports[_0x9750('0x1d')]=function(_0x1cd2d5){var _0x314f29=this;return new Promise(function(_0x29e26b,_0x51f34f){return db[_0x9750('0x1e')][_0x9750('0x1f')]({'raw':_0x1cd2d5[_0x9750('0x20')]?_0x1cd2d5['options'][_0x9750('0x21')]===undefined?!![]:![]:!![],'where':_0x1cd2d5['options']?_0x1cd2d5[_0x9750('0x20')]['where']||null:null,'attributes':_0x1cd2d5['options']?_0x1cd2d5[_0x9750('0x20')][_0x9750('0x22')]||null:null,'limit':_0x1cd2d5[_0x9750('0x20')]?_0x1cd2d5['options']['limit']||null:null,'include':_0x1cd2d5[_0x9750('0x20')]?_0x1cd2d5[_0x9750('0x20')][_0x9750('0x23')]?_[_0x9750('0x24')](_0x1cd2d5[_0x9750('0x20')][_0x9750('0x23')],function(_0x197e8d){return{'model':db[_0x197e8d[_0x9750('0x25')]],'as':_0x197e8d['as'],'attributes':_0x197e8d[_0x9750('0x22')],'include':_0x197e8d[_0x9750('0x23')]?_[_0x9750('0x24')](_0x197e8d['include'],function(_0x2b0d23){return{'model':db[_0x2b0d23[_0x9750('0x25')]],'as':_0x2b0d23['as'],'attributes':_0x2b0d23[_0x9750('0x22')],'include':_0x2b0d23[_0x9750('0x23')]?_[_0x9750('0x24')](_0x2b0d23[_0x9750('0x23')],function(_0x2e0b45){return{'model':db[_0x2e0b45[_0x9750('0x25')]],'as':_0x2e0b45['as'],'attributes':_0x2e0b45[_0x9750('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9750('0x12')](function(_0x4ef5dd){logger[_0x9750('0x13')](_0x9750('0x1d'),_0x1cd2d5);logger['debug'](_0x9750('0x1d'),_0x1cd2d5,JSON['stringify'](_0x4ef5dd));_0x29e26b(_0x4ef5dd);})[_0x9750('0x1c')](function(_0x136db9){logger[_0x9750('0x18')](_0x9750('0x1d'),_0x136db9[_0x9750('0x1a')],_0x1cd2d5);_0x51f34f(_0x314f29[_0x9750('0x18')](0x1f4,_0x136db9[_0x9750('0x1a')]));});});};exports[_0x9750('0x26')]=function(_0x41d9ec){var _0x2a63b0=this;return new Promise(function(_0x35c101,_0x20b1d8){return db[_0x9750('0x1e')][_0x9750('0x27')]({'raw':_0x41d9ec[_0x9750('0x20')]?_0x41d9ec[_0x9750('0x20')][_0x9750('0x21')]===undefined?!![]:![]:!![],'where':_0x41d9ec[_0x9750('0x20')]?_0x41d9ec[_0x9750('0x20')][_0x9750('0x28')]||null:null,'attributes':_0x41d9ec[_0x9750('0x20')]?_0x41d9ec['options'][_0x9750('0x22')]||null:null,'include':_0x41d9ec[_0x9750('0x20')]?_0x41d9ec[_0x9750('0x20')]['include']?_['map'](_0x41d9ec['options'][_0x9750('0x23')],function(_0x292a06){return{'model':db[_0x292a06[_0x9750('0x25')]],'as':_0x292a06['as'],'attributes':_0x292a06[_0x9750('0x22')],'include':_0x292a06[_0x9750('0x23')]?_[_0x9750('0x24')](_0x292a06['include'],function(_0xa168b4){return{'model':db[_0xa168b4[_0x9750('0x25')]],'as':_0xa168b4['as'],'attributes':_0xa168b4[_0x9750('0x22')],'include':_0xa168b4['include']?_[_0x9750('0x24')](_0xa168b4['include'],function(_0x53b0fd){return{'model':db[_0x53b0fd[_0x9750('0x25')]],'as':_0x53b0fd['as'],'attributes':_0x53b0fd[_0x9750('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9750('0x12')](function(_0x46848d){logger[_0x9750('0x13')]('ShowOpenchannelQueue',_0x41d9ec);logger[_0x9750('0x16')](_0x9750('0x26'),_0x41d9ec,JSON[_0x9750('0x29')](_0x46848d));_0x35c101(_0x46848d);})[_0x9750('0x1c')](function(_0x50e3a3){logger['error'](_0x9750('0x26'),_0x50e3a3['message'],_0x41d9ec);_0x20b1d8(_0x2a63b0[_0x9750('0x18')](0x1f4,_0x50e3a3['message']));});});}; \ No newline at end of file +var _0x9b81=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','find','stringify','lodash','util','moment','bluebird'];(function(_0x1a6a4c,_0x1488f2){var _0x1b9e0f=function(_0x3b133a){while(--_0x3b133a){_0x1a6a4c['push'](_0x1a6a4c['shift']());}};_0x1b9e0f(++_0x1488f2);}(_0x9b81,0xb0));var _0x19b8=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9b81[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x19b8('0x0'));var util=require(_0x19b8('0x1'));var moment=require(_0x19b8('0x2'));var BPromise=require(_0x19b8('0x3'));var rs=require(_0x19b8('0x4'));var fs=require('fs');var Redis=require(_0x19b8('0x5'));var db=require(_0x19b8('0x6'))['db'];var utils=require(_0x19b8('0x7'));var logger=require(_0x19b8('0x8'))(_0x19b8('0x9'));var config=require(_0x19b8('0xa'));var jayson=require(_0x19b8('0xb'));var client=jayson['client'][_0x19b8('0xc')]({'port':0x232a});config[_0x19b8('0xd')]=_[_0x19b8('0xe')](config['redis'],{'host':_0x19b8('0xf'),'port':0x18eb});var socket=require(_0x19b8('0x10'))(new Redis(config[_0x19b8('0xd')]));require(_0x19b8('0x11'))[_0x19b8('0x12')](socket);function respondWithRpcPromise(_0xd48f2d,_0x1a5cdd,_0x4ce218){return new BPromise(function(_0x4dac16,_0x15689c){return client[_0x19b8('0x13')](_0xd48f2d,_0x4ce218)[_0x19b8('0x14')](function(_0x36fd8b){logger[_0x19b8('0x15')](_0x19b8('0x16'),_0x1a5cdd,_0x19b8('0x17'));logger[_0x19b8('0x18')](_0x19b8('0x19'),_0x1a5cdd,_0x19b8('0x17'),JSON['stringify'](_0x36fd8b));if(_0x36fd8b[_0x19b8('0x1a')]){if(_0x36fd8b[_0x19b8('0x1a')][_0x19b8('0x1b')]===0x1f4){logger[_0x19b8('0x1a')](_0x19b8('0x16'),_0x1a5cdd,_0x36fd8b['error']['message']);return _0x15689c(_0x36fd8b[_0x19b8('0x1a')]['message']);}logger[_0x19b8('0x1a')](_0x19b8('0x16'),_0x1a5cdd,_0x36fd8b[_0x19b8('0x1a')]['message']);return _0x4dac16(_0x36fd8b[_0x19b8('0x1a')][_0x19b8('0x1c')]);}else{logger['info'](_0x19b8('0x16'),_0x1a5cdd,_0x19b8('0x17'));_0x4dac16(_0x36fd8b[_0x19b8('0x1d')]['message']);}})[_0x19b8('0x1e')](function(_0x5a81f7){logger[_0x19b8('0x1a')](_0x19b8('0x16'),_0x1a5cdd,_0x5a81f7);_0x15689c(_0x5a81f7);});});}exports['GetOpenchannelQueue']=function(_0x451845){var _0x5d2db8=this;return new Promise(function(_0x258bfb,_0x3a5bde){return db[_0x19b8('0x1f')][_0x19b8('0x20')]({'raw':_0x451845[_0x19b8('0x21')]?_0x451845[_0x19b8('0x21')][_0x19b8('0x22')]===undefined?!![]:![]:!![],'where':_0x451845[_0x19b8('0x21')]?_0x451845['options'][_0x19b8('0x23')]||null:null,'attributes':_0x451845[_0x19b8('0x21')]?_0x451845[_0x19b8('0x21')][_0x19b8('0x24')]||null:null,'limit':_0x451845['options']?_0x451845[_0x19b8('0x21')][_0x19b8('0x25')]||null:null,'include':_0x451845[_0x19b8('0x21')]?_0x451845[_0x19b8('0x21')][_0x19b8('0x26')]?_[_0x19b8('0x27')](_0x451845['options']['include'],function(_0x4e75e0){return{'model':db[_0x4e75e0[_0x19b8('0x28')]],'as':_0x4e75e0['as'],'attributes':_0x4e75e0[_0x19b8('0x24')],'include':_0x4e75e0[_0x19b8('0x26')]?_['map'](_0x4e75e0[_0x19b8('0x26')],function(_0xf8effb){return{'model':db[_0xf8effb[_0x19b8('0x28')]],'as':_0xf8effb['as'],'attributes':_0xf8effb['attributes'],'include':_0xf8effb[_0x19b8('0x26')]?_[_0x19b8('0x27')](_0xf8effb[_0x19b8('0x26')],function(_0x25204e){return{'model':db[_0x25204e['model']],'as':_0x25204e['as'],'attributes':_0x25204e[_0x19b8('0x24')]};}):[]};}):[]};}):[]:[]})[_0x19b8('0x14')](function(_0x9a900b){logger[_0x19b8('0x15')](_0x19b8('0x29'),_0x451845);logger[_0x19b8('0x18')](_0x19b8('0x29'),_0x451845,JSON['stringify'](_0x9a900b));_0x258bfb(_0x9a900b);})[_0x19b8('0x1e')](function(_0x5b9885){logger[_0x19b8('0x1a')]('GetOpenchannelQueue',_0x5b9885[_0x19b8('0x1c')],_0x451845);_0x3a5bde(_0x5d2db8[_0x19b8('0x1a')](0x1f4,_0x5b9885['message']));});});};exports[_0x19b8('0x2a')]=function(_0x586496){var _0x3e5339=this;return new Promise(function(_0x1c61fe,_0x30e971){return db['OpenchannelQueue'][_0x19b8('0x2b')]({'raw':_0x586496[_0x19b8('0x21')]?_0x586496['options'][_0x19b8('0x22')]===undefined?!![]:![]:!![],'where':_0x586496[_0x19b8('0x21')]?_0x586496[_0x19b8('0x21')][_0x19b8('0x23')]||null:null,'attributes':_0x586496['options']?_0x586496['options'][_0x19b8('0x24')]||null:null,'include':_0x586496[_0x19b8('0x21')]?_0x586496[_0x19b8('0x21')][_0x19b8('0x26')]?_[_0x19b8('0x27')](_0x586496['options']['include'],function(_0x3d3052){return{'model':db[_0x3d3052[_0x19b8('0x28')]],'as':_0x3d3052['as'],'attributes':_0x3d3052['attributes'],'include':_0x3d3052[_0x19b8('0x26')]?_[_0x19b8('0x27')](_0x3d3052[_0x19b8('0x26')],function(_0x384c52){return{'model':db[_0x384c52[_0x19b8('0x28')]],'as':_0x384c52['as'],'attributes':_0x384c52['attributes'],'include':_0x384c52[_0x19b8('0x26')]?_[_0x19b8('0x27')](_0x384c52['include'],function(_0xd410cd){return{'model':db[_0xd410cd[_0x19b8('0x28')]],'as':_0xd410cd['as'],'attributes':_0xd410cd[_0x19b8('0x24')]};}):[]};}):[]};}):[]:[]})[_0x19b8('0x14')](function(_0x16f278){logger[_0x19b8('0x15')](_0x19b8('0x2a'),_0x586496);logger[_0x19b8('0x18')]('ShowOpenchannelQueue',_0x586496,JSON[_0x19b8('0x2c')](_0x16f278));_0x1c61fe(_0x16f278);})[_0x19b8('0x1e')](function(_0x20b2f4){logger[_0x19b8('0x1a')](_0x19b8('0x2a'),_0x20b2f4[_0x19b8('0x1c')],_0x586496);_0x30e971(_0x3e5339[_0x19b8('0x1a')](0x1f4,_0x20b2f4[_0x19b8('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index c748f82..810f681 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 _0x4386=['openchannelQueue:','./openchannelQueue.events','save','update','emit','removeListener','register','length'];(function(_0x5a2ee2,_0x2dcc19){var _0xf2fcb7=function(_0x5e8640){while(--_0x5e8640){_0x5a2ee2['push'](_0x5a2ee2['shift']());}};_0xf2fcb7(++_0x2dcc19);}(_0x4386,0xe9));var _0x6438=function(_0x4b6792,_0x1098bb){_0x4b6792=_0x4b6792-0x0;var _0x406802=_0x4386[_0x4b6792];return _0x406802;};'use strict';var OpenchannelQueueEvents=require(_0x6438('0x0'));var events=[_0x6438('0x1'),'remove',_0x6438('0x2')];function createListener(_0x4205c0,_0x23f797){return function(_0xa45f25){_0x23f797[_0x6438('0x3')](_0x4205c0,_0xa45f25);};}function removeListener(_0x50427d,_0x2e6b61){return function(){OpenchannelQueueEvents[_0x6438('0x4')](_0x50427d,_0x2e6b61);};}exports[_0x6438('0x5')]=function(_0x3b6386){for(var _0x488f97=0x0,_0x5c1513=events[_0x6438('0x6')];_0x488f97<_0x5c1513;_0x488f97++){var _0x33bb55=events[_0x488f97];var _0x36bdd7=createListener(_0x6438('0x7')+_0x33bb55,_0x3b6386);OpenchannelQueueEvents['on'](_0x33bb55,_0x36bdd7);}}; \ No newline at end of file +var _0x368b=['length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener'];(function(_0x137f6f,_0x9c8c99){var _0xf67a9d=function(_0x574509){while(--_0x574509){_0x137f6f['push'](_0x137f6f['shift']());}};_0xf67a9d(++_0x9c8c99);}(_0x368b,0x1aa));var _0xb368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368b[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require(_0xb368('0x0'));var events=[_0xb368('0x1'),_0xb368('0x2'),_0xb368('0x3')];function createListener(_0x3e3c2,_0x6aa8b1){return function(_0x165e59){_0x6aa8b1[_0xb368('0x4')](_0x3e3c2,_0x165e59);};}function removeListener(_0x4e4bb8,_0x3e47ff){return function(){OpenchannelQueueEvents[_0xb368('0x5')](_0x4e4bb8,_0x3e47ff);};}exports['register']=function(_0x152f00){for(var _0x598e91=0x0,_0x3fd756=events[_0xb368('0x6')];_0x598e91<_0x3fd756;_0x598e91++){var _0x4d6e13=events[_0x598e91];var _0x413872=createListener(_0xb368('0x7')+_0x4d6e13,_0x152f00);OpenchannelQueueEvents['on'](_0x4d6e13,_0x413872);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 2b29eb0..5b51567 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 _0xa76b=['express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','exports','path','connect-timeout'];(function(_0x57ee3d,_0x35107d){var _0x18d665=function(_0x3c3901){while(--_0x3c3901){_0x57ee3d['push'](_0x57ee3d['shift']());}};_0x18d665(++_0x35107d);}(_0xa76b,0xbc));var _0xba76=function(_0xdffe7d,_0x1d258d){_0xdffe7d=_0xdffe7d-0x0;var _0x3063e0=_0xa76b[_0xdffe7d];return _0x3063e0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xba76('0x0'));var timeout=require(_0xba76('0x1'));var express=require(_0xba76('0x2'));var router=express[_0xba76('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xba76('0x4'));var interaction=require(_0xba76('0x5'));var config=require('../../config/environment');var controller=require(_0xba76('0x6'));router[_0xba76('0x7')]('/',auth[_0xba76('0x8')](),controller[_0xba76('0x9')]);router[_0xba76('0x7')](_0xba76('0xa'),auth[_0xba76('0x8')](),controller['describe']);router[_0xba76('0x7')](_0xba76('0xb'),auth[_0xba76('0x8')](),controller[_0xba76('0xc')]);router['post']('/',auth[_0xba76('0x8')](),controller[_0xba76('0xd')]);router[_0xba76('0xe')](_0xba76('0xb'),auth[_0xba76('0x8')](),controller[_0xba76('0xf')]);router[_0xba76('0x10')]('/:id',auth[_0xba76('0x8')](),controller[_0xba76('0x11')]);module[_0xba76('0x12')]=router; \ No newline at end of file +var _0xa0f1=['../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','create','put','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x1f0cdf,_0x39e943){var _0x166b95=function(_0x5b8483){while(--_0x5b8483){_0x1f0cdf['push'](_0x1f0cdf['shift']());}};_0x166b95(++_0x39e943);}(_0xa0f1,0x1af));var _0x1a0f=function(_0x57814c,_0x1a9bef){_0x57814c=_0x57814c-0x0;var _0x309115=_0xa0f1[_0x57814c];return _0x309115;};'use strict';var multer=require(_0x1a0f('0x0'));var util=require(_0x1a0f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1a0f('0x2'));var router=express[_0x1a0f('0x3')]();var fs_extra=require(_0x1a0f('0x4'));var auth=require(_0x1a0f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1a0f('0x6'));var controller=require(_0x1a0f('0x7'));router['get']('/',auth[_0x1a0f('0x8')](),controller[_0x1a0f('0x9')]);router[_0x1a0f('0xa')](_0x1a0f('0xb'),auth[_0x1a0f('0x8')](),controller[_0x1a0f('0xc')]);router[_0x1a0f('0xa')](_0x1a0f('0xd'),auth[_0x1a0f('0x8')](),controller['show']);router['post']('/',auth[_0x1a0f('0x8')](),controller[_0x1a0f('0xe')]);router[_0x1a0f('0xf')](_0x1a0f('0xd'),auth[_0x1a0f('0x8')](),controller[_0x1a0f('0x10')]);router[_0x1a0f('0x11')](_0x1a0f('0xd'),auth['isAuthenticated'](),controller[_0x1a0f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index ef5bf19..824c571 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 _0x97bf=['STRING','DATE','sequelize','exports'];(function(_0x1076de,_0x28d40b){var _0x430d82=function(_0x4b28ac){while(--_0x4b28ac){_0x1076de['push'](_0x1076de['shift']());}};_0x430d82(++_0x28d40b);}(_0x97bf,0xa2));var _0xf97b=function(_0x3a8457,_0x25b0dd){_0x3a8457=_0x3a8457-0x0;var _0x56d233=_0x97bf[_0x3a8457];return _0x56d233;};'use strict';var moment=require('moment');var Sequelize=require(_0xf97b('0x0'));module[_0xf97b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf97b('0x2')]},'joinAt':{'type':Sequelize[_0xf97b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf97b('0x3')]},'reason':{'type':Sequelize[_0xf97b('0x2')]}}; \ No newline at end of file +var _0x15d2=['DATE','sequelize','STRING'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x15d2,0x163));var _0x215d=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x15d2[_0x550d12];return _0x12103d;};'use strict';var moment=require('moment');var Sequelize=require(_0x215d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x215d('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x215d('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'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 68d1231..ad1cf8f 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 _0x67d6=['filter','options','includeAll','findAll','rows','catch','params','rawAttributes','fields','merge','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','OpenchannelQueueReport','fieldName','type','model','keys','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL'];(function(_0x4137e4,_0x442153){var _0x7b6759=function(_0x414930){while(--_0x414930){_0x4137e4['push'](_0x4137e4['shift']());}};_0x7b6759(++_0x442153);}(_0x67d6,0xa0));var _0x667d=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0x67d6[_0x254b22];return _0x1279db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x667d('0x0'));var zipdir=require(_0x667d('0x1'));var jsonpatch=require(_0x667d('0x2'));var rp=require('request-promise');var moment=require(_0x667d('0x3'));var BPromise=require(_0x667d('0x4'));var Mustache=require(_0x667d('0x5'));var util=require(_0x667d('0x6'));var path=require(_0x667d('0x7'));var sox=require('sox');var csv=require(_0x667d('0x8'));var ejs=require(_0x667d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x667d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x667d('0xb'));var toCsv=require(_0x667d('0x8'));var querystring=require(_0x667d('0xc'));var Papa=require(_0x667d('0xd'));var Redis=require(_0x667d('0xe'));var authService=require(_0x667d('0xf'));var qs=require(_0x667d('0x10'));var as=require(_0x667d('0x11'));var hardwareService=require(_0x667d('0x12'));var logger=require('../../config/logger')(_0x667d('0x13'));var utils=require('../../config/utils');var config=require(_0x667d('0x14'));var licenseUtil=require(_0x667d('0x15'));var db=require(_0x667d('0x16'))['db'];function respondWithStatusCode(_0x1312bc,_0x4d95cd){_0x4d95cd=_0x4d95cd||0xcc;return function(_0x516b41){if(_0x516b41){return _0x1312bc[_0x667d('0x17')](_0x4d95cd);}return _0x1312bc[_0x667d('0x18')](_0x4d95cd)[_0x667d('0x19')]();};}function respondWithResult(_0x34b46d,_0x5ea553){_0x5ea553=_0x5ea553||0xc8;return function(_0xaa67fa){if(_0xaa67fa){return _0x34b46d['status'](_0x5ea553)[_0x667d('0x1a')](_0xaa67fa);}};}function respondWithFilteredResult(_0x15879e,_0x156391){return function(_0x1b5b0c){if(_0x1b5b0c){var _0x16b59c=typeof _0x156391[_0x667d('0x1b')]===_0x667d('0x1c')&&typeof _0x156391[_0x667d('0x1d')]===_0x667d('0x1c');var _0x5a06d3=_0x1b5b0c[_0x667d('0x1e')];var _0x453864=_0x16b59c?0x0:_0x156391['offset'];var _0x1a1025=_0x16b59c?_0x1b5b0c[_0x667d('0x1e')]:_0x156391[_0x667d('0x1b')]+_0x156391[_0x667d('0x1d')];var _0x3b9033;if(_0x1a1025>=_0x5a06d3){_0x1a1025=_0x5a06d3;_0x3b9033=0xc8;}else{_0x3b9033=0xce;}_0x15879e['status'](_0x3b9033);return _0x15879e[_0x667d('0x1f')](_0x667d('0x20'),_0x453864+'-'+_0x1a1025+'/'+_0x5a06d3)[_0x667d('0x1a')](_0x1b5b0c);}return null;};}function patchUpdates(_0x7badda){return function(_0x1da53f){try{jsonpatch[_0x667d('0x21')](_0x1da53f,_0x7badda,!![]);}catch(_0x3d1563){return BPromise[_0x667d('0x22')](_0x3d1563);}return _0x1da53f['save']();};}function saveUpdates(_0x2a95b3,_0x1484bd){return function(_0x43ebd1){if(_0x43ebd1){return _0x43ebd1[_0x667d('0x23')](_0x2a95b3)[_0x667d('0x24')](function(_0x52e8cf){return _0x52e8cf;});}return null;};}function removeEntity(_0x31251a,_0x3d6363){return function(_0x5d4f9e){if(_0x5d4f9e){return _0x5d4f9e[_0x667d('0x25')]()[_0x667d('0x24')](function(){_0x31251a[_0x667d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x552c20,_0x4e686a){return function(_0xe874ca){if(!_0xe874ca){_0x552c20['sendStatus'](0x194);}return _0xe874ca;};}function handleError(_0x1beec5,_0x39d20b){_0x39d20b=_0x39d20b||0x1f4;return function(_0xf6273b){logger[_0x667d('0x26')](_0xf6273b[_0x667d('0x27')]);if(_0xf6273b['name']){delete _0xf6273b[_0x667d('0x28')];}_0x1beec5[_0x667d('0x18')](_0x39d20b)['send'](_0xf6273b);};}exports[_0x667d('0x29')]=function(_0x1d891b,_0x41ff78){var _0x224703={},_0x157cea={},_0x588136={'count':0x0,'rows':[]};var _0x2a7361=_[_0x667d('0x2a')](db[_0x667d('0x2b')]['rawAttributes'],function(_0x2d480e){return{'name':_0x2d480e[_0x667d('0x2c')],'type':_0x2d480e[_0x667d('0x2d')]['key']};});_0x157cea[_0x667d('0x2e')]=_[_0x667d('0x2a')](_0x2a7361,'name');_0x157cea['query']=_[_0x667d('0x2f')](_0x1d891b[_0x667d('0x30')]);_0x157cea['filters']=_['intersection'](_0x157cea['model'],_0x157cea[_0x667d('0x30')]);_0x224703[_0x667d('0x31')]=_['intersection'](_0x157cea[_0x667d('0x2e')],qs['fields'](_0x1d891b[_0x667d('0x30')]['fields']));_0x224703[_0x667d('0x31')]=_0x224703[_0x667d('0x31')][_0x667d('0x32')]?_0x224703[_0x667d('0x31')]:_0x157cea[_0x667d('0x2e')];if(!_0x1d891b[_0x667d('0x30')][_0x667d('0x33')](_0x667d('0x34'))){_0x224703[_0x667d('0x1d')]=qs[_0x667d('0x1d')](_0x1d891b[_0x667d('0x30')][_0x667d('0x1d')]);_0x224703[_0x667d('0x1b')]=qs['offset'](_0x1d891b['query'][_0x667d('0x1b')]);}_0x224703[_0x667d('0x35')]=qs[_0x667d('0x36')](_0x1d891b[_0x667d('0x30')][_0x667d('0x36')]);_0x224703[_0x667d('0x37')]=qs[_0x667d('0x38')](_[_0x667d('0x39')](_0x1d891b['query'],_0x157cea[_0x667d('0x38')]),_0x2a7361);if(_0x1d891b[_0x667d('0x30')]['filter']){_0x224703[_0x667d('0x37')]=_['merge'](_0x224703['where'],{'$or':_[_0x667d('0x2a')](_0x2a7361,function(_0x4bddcf){if(_0x4bddcf['type']!==_0x667d('0x3a')){var _0x650944={};_0x650944[_0x4bddcf[_0x667d('0x28')]]={'$like':'%'+_0x1d891b[_0x667d('0x30')][_0x667d('0x3b')]+'%'};return _0x650944;}})});}_0x224703=_['merge']({},_0x224703,_0x1d891b[_0x667d('0x3c')]);var _0x52d45c={'where':_0x224703[_0x667d('0x37')]};return db[_0x667d('0x2b')][_0x667d('0x1e')](_0x52d45c)[_0x667d('0x24')](function(_0x915b0f){_0x588136['count']=_0x915b0f;if(_0x1d891b['query'][_0x667d('0x3d')]){_0x224703['include']=[{'all':!![]}];}return db[_0x667d('0x2b')][_0x667d('0x3e')](_0x224703);})[_0x667d('0x24')](function(_0x46dec1){_0x588136[_0x667d('0x3f')]=_0x46dec1;return _0x588136;})[_0x667d('0x24')](respondWithFilteredResult(_0x41ff78,_0x224703))[_0x667d('0x40')](handleError(_0x41ff78,null));};exports['show']=function(_0x409c6d,_0x177be6){var _0x43ea19={'raw':!![],'where':{'id':_0x409c6d[_0x667d('0x41')]['id']}},_0x27a0e1={};_0x27a0e1[_0x667d('0x2e')]=_[_0x667d('0x2f')](db[_0x667d('0x2b')][_0x667d('0x42')]);_0x27a0e1[_0x667d('0x30')]=_['keys'](_0x409c6d[_0x667d('0x30')]);_0x27a0e1[_0x667d('0x38')]=_['intersection'](_0x27a0e1[_0x667d('0x2e')],_0x27a0e1[_0x667d('0x30')]);_0x43ea19[_0x667d('0x31')]=_['intersection'](_0x27a0e1['model'],qs['fields'](_0x409c6d['query'][_0x667d('0x43')]));_0x43ea19[_0x667d('0x31')]=_0x43ea19['attributes'][_0x667d('0x32')]?_0x43ea19[_0x667d('0x31')]:_0x27a0e1[_0x667d('0x2e')];if(_0x409c6d[_0x667d('0x30')][_0x667d('0x3d')]){_0x43ea19['include']=[{'all':!![]}];}_0x43ea19=_[_0x667d('0x44')]({},_0x43ea19,_0x409c6d['options']);return db[_0x667d('0x2b')][_0x667d('0x45')](_0x43ea19)['then'](handleEntityNotFound(_0x177be6,null))[_0x667d('0x24')](respondWithResult(_0x177be6,null))[_0x667d('0x40')](handleError(_0x177be6,null));};exports[_0x667d('0x46')]=function(_0x37d5fd,_0x3528c9){return db['OpenchannelQueueReport'][_0x667d('0x46')](_0x37d5fd[_0x667d('0x47')],{})[_0x667d('0x24')](respondWithResult(_0x3528c9,0xc9))[_0x667d('0x40')](handleError(_0x3528c9,null));};exports[_0x667d('0x23')]=function(_0x31b215,_0x34533c){if(_0x31b215[_0x667d('0x47')]['id']){delete _0x31b215['body']['id'];}return db[_0x667d('0x2b')][_0x667d('0x45')]({'where':{'id':_0x31b215[_0x667d('0x41')]['id']}})[_0x667d('0x24')](handleEntityNotFound(_0x34533c,null))['then'](saveUpdates(_0x31b215[_0x667d('0x47')],null))[_0x667d('0x24')](respondWithResult(_0x34533c,null))['catch'](handleError(_0x34533c,null));};exports[_0x667d('0x25')]=function(_0x54361d,_0x56d380){return db[_0x667d('0x2b')]['find']({'where':{'id':_0x54361d[_0x667d('0x41')]['id']}})[_0x667d('0x24')](handleEntityNotFound(_0x56d380,null))[_0x667d('0x24')](removeEntity(_0x56d380,null))[_0x667d('0x40')](handleError(_0x56d380,null));};exports[_0x667d('0x48')]=function(_0x45dbc6,_0x2a36c0){return db[_0x667d('0x2b')][_0x667d('0x48')]()[_0x667d('0x24')](respondWithResult(_0x2a36c0,null))[_0x667d('0x40')](handleError(_0x2a36c0,null));}; \ No newline at end of file +var _0x7a14=['offset','limit','set','Content-Range','apply','reject','update','then','end','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','findAll','rows','catch','show','params','intersection','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x7a14,0x7c));var _0x47a1=function(_0x461c07,_0x24c8c){_0x461c07=_0x461c07-0x0;var _0x44f315=_0x7a14[_0x461c07];return _0x44f315;};'use strict';var emlformat=require(_0x47a1('0x0'));var rimraf=require(_0x47a1('0x1'));var zipdir=require(_0x47a1('0x2'));var jsonpatch=require(_0x47a1('0x3'));var rp=require(_0x47a1('0x4'));var moment=require(_0x47a1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x47a1('0x6'));var util=require(_0x47a1('0x7'));var path=require(_0x47a1('0x8'));var sox=require(_0x47a1('0x9'));var csv=require(_0x47a1('0xa'));var ejs=require(_0x47a1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x47a1('0xc'));var squel=require(_0x47a1('0xd'));var crypto=require(_0x47a1('0xe'));var jsforce=require(_0x47a1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x47a1('0xa'));var querystring=require(_0x47a1('0x10'));var Papa=require('papaparse');var Redis=require(_0x47a1('0x11'));var authService=require(_0x47a1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x47a1('0x13'));var hardwareService=require(_0x47a1('0x14'));var logger=require(_0x47a1('0x15'))(_0x47a1('0x16'));var utils=require(_0x47a1('0x17'));var config=require(_0x47a1('0x18'));var licenseUtil=require(_0x47a1('0x19'));var db=require(_0x47a1('0x1a'))['db'];function respondWithStatusCode(_0x322cc,_0x28552e){_0x28552e=_0x28552e||0xcc;return function(_0x2e9fa6){if(_0x2e9fa6){return _0x322cc[_0x47a1('0x1b')](_0x28552e);}return _0x322cc[_0x47a1('0x1c')](_0x28552e)['end']();};}function respondWithResult(_0x40cef7,_0x57d526){_0x57d526=_0x57d526||0xc8;return function(_0x34b211){if(_0x34b211){return _0x40cef7[_0x47a1('0x1c')](_0x57d526)[_0x47a1('0x1d')](_0x34b211);}};}function respondWithFilteredResult(_0x223749,_0x2e937b){return function(_0x19750c){if(_0x19750c){var _0x5d805a=typeof _0x2e937b['offset']===_0x47a1('0x1e')&&typeof _0x2e937b['limit']===_0x47a1('0x1e');var _0x4cd2a7=_0x19750c[_0x47a1('0x1f')];var _0x5c4198=_0x5d805a?0x0:_0x2e937b[_0x47a1('0x20')];var _0x445ab1=_0x5d805a?_0x19750c['count']:_0x2e937b[_0x47a1('0x20')]+_0x2e937b[_0x47a1('0x21')];var _0x13ca3f;if(_0x445ab1>=_0x4cd2a7){_0x445ab1=_0x4cd2a7;_0x13ca3f=0xc8;}else{_0x13ca3f=0xce;}_0x223749[_0x47a1('0x1c')](_0x13ca3f);return _0x223749[_0x47a1('0x22')](_0x47a1('0x23'),_0x5c4198+'-'+_0x445ab1+'/'+_0x4cd2a7)[_0x47a1('0x1d')](_0x19750c);}return null;};}function patchUpdates(_0x11bf20){return function(_0xd35bbf){try{jsonpatch[_0x47a1('0x24')](_0xd35bbf,_0x11bf20,!![]);}catch(_0x2b128b){return BPromise[_0x47a1('0x25')](_0x2b128b);}return _0xd35bbf['save']();};}function saveUpdates(_0x2dce10,_0x2a18ee){return function(_0xa5b310){if(_0xa5b310){return _0xa5b310[_0x47a1('0x26')](_0x2dce10)['then'](function(_0x1396fe){return _0x1396fe;});}return null;};}function removeEntity(_0x28961b,_0x58715f){return function(_0x3182a3){if(_0x3182a3){return _0x3182a3['destroy']()[_0x47a1('0x27')](function(){_0x28961b[_0x47a1('0x1c')](0xcc)[_0x47a1('0x28')]();});}};}function handleEntityNotFound(_0x4acfe1,_0x279e4a){return function(_0x72ca9b){if(!_0x72ca9b){_0x4acfe1[_0x47a1('0x1b')](0x194);}return _0x72ca9b;};}function handleError(_0xe928fc,_0x4d17fa){_0x4d17fa=_0x4d17fa||0x1f4;return function(_0x1d2f9e){logger['error'](_0x1d2f9e['stack']);if(_0x1d2f9e[_0x47a1('0x29')]){delete _0x1d2f9e[_0x47a1('0x29')];}_0xe928fc[_0x47a1('0x1c')](_0x4d17fa)[_0x47a1('0x2a')](_0x1d2f9e);};}exports[_0x47a1('0x2b')]=function(_0x14454c,_0x228519){var _0x3051fe={},_0x39bfb4={},_0x4adfb0={'count':0x0,'rows':[]};var _0x4c2709=_[_0x47a1('0x2c')](db['OpenchannelQueueReport'][_0x47a1('0x2d')],function(_0x57dd12){return{'name':_0x57dd12[_0x47a1('0x2e')],'type':_0x57dd12[_0x47a1('0x2f')][_0x47a1('0x30')]};});_0x39bfb4['model']=_[_0x47a1('0x2c')](_0x4c2709,_0x47a1('0x29'));_0x39bfb4[_0x47a1('0x31')]=_[_0x47a1('0x32')](_0x14454c[_0x47a1('0x31')]);_0x39bfb4['filters']=_['intersection'](_0x39bfb4[_0x47a1('0x33')],_0x39bfb4[_0x47a1('0x31')]);_0x3051fe['attributes']=_['intersection'](_0x39bfb4[_0x47a1('0x33')],qs[_0x47a1('0x34')](_0x14454c['query'][_0x47a1('0x34')]));_0x3051fe[_0x47a1('0x35')]=_0x3051fe[_0x47a1('0x35')][_0x47a1('0x36')]?_0x3051fe[_0x47a1('0x35')]:_0x39bfb4[_0x47a1('0x33')];if(!_0x14454c[_0x47a1('0x31')][_0x47a1('0x37')](_0x47a1('0x38'))){_0x3051fe[_0x47a1('0x21')]=qs[_0x47a1('0x21')](_0x14454c[_0x47a1('0x31')][_0x47a1('0x21')]);_0x3051fe[_0x47a1('0x20')]=qs[_0x47a1('0x20')](_0x14454c[_0x47a1('0x31')][_0x47a1('0x20')]);}_0x3051fe[_0x47a1('0x39')]=qs[_0x47a1('0x3a')](_0x14454c['query'][_0x47a1('0x3a')]);_0x3051fe['where']=qs['filters'](_[_0x47a1('0x3b')](_0x14454c[_0x47a1('0x31')],_0x39bfb4[_0x47a1('0x3c')]),_0x4c2709);if(_0x14454c[_0x47a1('0x31')][_0x47a1('0x3d')]){_0x3051fe[_0x47a1('0x3e')]=_[_0x47a1('0x3f')](_0x3051fe['where'],{'$or':_[_0x47a1('0x2c')](_0x4c2709,function(_0x4a5ba8){if(_0x4a5ba8[_0x47a1('0x2f')]!==_0x47a1('0x40')){var _0x30ecd5={};_0x30ecd5[_0x4a5ba8[_0x47a1('0x29')]]={'$like':'%'+_0x14454c['query'][_0x47a1('0x3d')]+'%'};return _0x30ecd5;}})});}_0x3051fe=_[_0x47a1('0x3f')]({},_0x3051fe,_0x14454c[_0x47a1('0x41')]);var _0x46f140={'where':_0x3051fe[_0x47a1('0x3e')]};return db[_0x47a1('0x42')]['count'](_0x46f140)[_0x47a1('0x27')](function(_0x7a4c75){_0x4adfb0[_0x47a1('0x1f')]=_0x7a4c75;if(_0x14454c['query'][_0x47a1('0x43')]){_0x3051fe['include']=[{'all':!![]}];}return db[_0x47a1('0x42')][_0x47a1('0x44')](_0x3051fe);})[_0x47a1('0x27')](function(_0x4cc184){_0x4adfb0[_0x47a1('0x45')]=_0x4cc184;return _0x4adfb0;})[_0x47a1('0x27')](respondWithFilteredResult(_0x228519,_0x3051fe))[_0x47a1('0x46')](handleError(_0x228519,null));};exports[_0x47a1('0x47')]=function(_0x88f69a,_0x3b028a){var _0x398871={'raw':!![],'where':{'id':_0x88f69a[_0x47a1('0x48')]['id']}},_0x443449={};_0x443449['model']=_[_0x47a1('0x32')](db[_0x47a1('0x42')][_0x47a1('0x2d')]);_0x443449['query']=_[_0x47a1('0x32')](_0x88f69a['query']);_0x443449[_0x47a1('0x3c')]=_['intersection'](_0x443449[_0x47a1('0x33')],_0x443449[_0x47a1('0x31')]);_0x398871[_0x47a1('0x35')]=_[_0x47a1('0x49')](_0x443449[_0x47a1('0x33')],qs[_0x47a1('0x34')](_0x88f69a['query']['fields']));_0x398871['attributes']=_0x398871[_0x47a1('0x35')]['length']?_0x398871[_0x47a1('0x35')]:_0x443449['model'];if(_0x88f69a[_0x47a1('0x31')][_0x47a1('0x43')]){_0x398871[_0x47a1('0x4a')]=[{'all':!![]}];}_0x398871=_['merge']({},_0x398871,_0x88f69a[_0x47a1('0x41')]);return db['OpenchannelQueueReport']['find'](_0x398871)[_0x47a1('0x27')](handleEntityNotFound(_0x3b028a,null))['then'](respondWithResult(_0x3b028a,null))[_0x47a1('0x46')](handleError(_0x3b028a,null));};exports[_0x47a1('0x4b')]=function(_0x18f58f,_0x48b403){return db[_0x47a1('0x42')][_0x47a1('0x4b')](_0x18f58f[_0x47a1('0x4c')],{})['then'](respondWithResult(_0x48b403,0xc9))[_0x47a1('0x46')](handleError(_0x48b403,null));};exports[_0x47a1('0x26')]=function(_0x3737ce,_0x4657a8){if(_0x3737ce[_0x47a1('0x4c')]['id']){delete _0x3737ce[_0x47a1('0x4c')]['id'];}return db[_0x47a1('0x42')][_0x47a1('0x4d')]({'where':{'id':_0x3737ce[_0x47a1('0x48')]['id']}})[_0x47a1('0x27')](handleEntityNotFound(_0x4657a8,null))['then'](saveUpdates(_0x3737ce[_0x47a1('0x4c')],null))[_0x47a1('0x27')](respondWithResult(_0x4657a8,null))[_0x47a1('0x46')](handleError(_0x4657a8,null));};exports['destroy']=function(_0x55e618,_0x1ac252){return db[_0x47a1('0x42')]['find']({'where':{'id':_0x55e618[_0x47a1('0x48')]['id']}})[_0x47a1('0x27')](handleEntityNotFound(_0x1ac252,null))[_0x47a1('0x27')](removeEntity(_0x1ac252,null))[_0x47a1('0x46')](handleError(_0x1ac252,null));};exports['describe']=function(_0x4325ab,_0x4e2d6c){return db[_0x47a1('0x42')]['describe']()[_0x47a1('0x27')](respondWithResult(_0x4e2d6c,null))[_0x47a1('0x46')](handleError(_0x4e2d6c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index a22073d..8635ec6 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x814b,0x1a2));var _0xb814=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0x814b[_0x4e783c];return _0x2fbd6d;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x254370,_0x4aeb06){var _0x326294=function(_0x28fd5b){while(--_0x28fd5b){_0x254370['push'](_0x254370['shift']());}};_0x326294(++_0x4aeb06);}(_0x7a54,0x106));var _0x47a5=function(_0x11ec9a,_0x5ab97e){_0x11ec9a=_0x11ec9a-0x0;var _0x2efd4a=_0x7a54[_0x11ec9a];return _0x2efd4a;};'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':'uniqueid','fields':[_0x47a5('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 67605bd..69cdb2d 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 _0x0abf=['debug','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','UpdateOpenchannelQueueReport','where','attributes','limit'];(function(_0x46180a,_0x23483e){var _0x3b3e78=function(_0x18d45c){while(--_0x18d45c){_0x46180a['push'](_0x46180a['shift']());}};_0x3b3e78(++_0x23483e);}(_0x0abf,0xe8));var _0xf0ab=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0abf[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233afe,_0x57ff3b,_0x2c4628){return new BPromise(function(_0x3f7e2b,_0x3ca099){return client[_0xf0ab('0xa')](_0x233afe,_0x2c4628)['then'](function(_0x472508){logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,'request\x20sent');logger['debug'](_0xf0ab('0xd'),_0x57ff3b,'request\x20sent',JSON[_0xf0ab('0xe')](_0x472508));if(_0x472508[_0xf0ab('0xf')]){if(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x10')]===0x1f4){logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')]['message']);return _0x3ca099(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);return _0x3f7e2b(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}else{logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,_0xf0ab('0x12'));_0x3f7e2b(_0x472508[_0xf0ab('0x13')][_0xf0ab('0x11')]);}})[_0xf0ab('0x14')](function(_0x230f40){logger['error'](_0xf0ab('0xc'),_0x57ff3b,_0x230f40);_0x3ca099(_0x230f40);});});}exports[_0xf0ab('0x15')]=function(_0x1803f0){var _0x1ffeb5=this;return new Promise(function(_0x776619,_0xb9a33){return db[_0xf0ab('0x16')][_0xf0ab('0x17')](_0x1803f0[_0xf0ab('0x18')],{'raw':_0x1803f0[_0xf0ab('0x19')]?_0x1803f0[_0xf0ab('0x19')][_0xf0ab('0x1a')]===undefined?!![]:![]:!![]})[_0xf0ab('0x1b')](function(_0x22a205){logger[_0xf0ab('0xb')](_0xf0ab('0x15'),_0x1803f0);logger['debug'](_0xf0ab('0x15'),_0x1803f0,JSON[_0xf0ab('0xe')](_0x22a205));_0x776619(_0x22a205);})[_0xf0ab('0x14')](function(_0x11ab3a){logger[_0xf0ab('0xf')](_0xf0ab('0x15'),_0x11ab3a[_0xf0ab('0x11')],_0x1803f0);_0xb9a33(_0x1ffeb5[_0xf0ab('0xf')](0x1f4,_0x11ab3a[_0xf0ab('0x11')]));});});};exports[_0xf0ab('0x1c')]=function(_0x43119f){var _0x5645b2=this;return new Promise(function(_0x585841,_0x4eee21){return db[_0xf0ab('0x16')]['update'](_0x43119f[_0xf0ab('0x18')],{'raw':_0x43119f[_0xf0ab('0x19')]?_0x43119f['options'][_0xf0ab('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43119f[_0xf0ab('0x19')]?_0x43119f[_0xf0ab('0x19')][_0xf0ab('0x1d')]||null:null,'attributes':_0x43119f[_0xf0ab('0x19')]?_0x43119f['options'][_0xf0ab('0x1e')]||null:null,'limit':_0x43119f['options']?_0x43119f['options'][_0xf0ab('0x1f')]||null:null})[_0xf0ab('0x1b')](function(_0x1b223d){logger[_0xf0ab('0xb')](_0xf0ab('0x1c'),_0x43119f);logger[_0xf0ab('0x20')](_0xf0ab('0x1c'),_0x43119f,JSON[_0xf0ab('0xe')](_0x1b223d));_0x585841(_0x1b223d);})[_0xf0ab('0x14')](function(_0x2f0fcd){logger[_0xf0ab('0xf')](_0xf0ab('0x1c'),_0x2f0fcd['message'],_0x43119f);_0x4eee21(_0x5645b2[_0xf0ab('0xf')](0x1f4,_0x2f0fcd[_0xf0ab('0x11')]));});});}; \ No newline at end of file +var _0x087b=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','create','body','options','CreateOpenchannelQueueReport','catch','UpdateOpenchannelQueueReport','raw','where','attributes','limit','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5d5f72,_0x47c3b6){var _0x212656=function(_0x223b44){while(--_0x223b44){_0x5d5f72['push'](_0x5d5f72['shift']());}};_0x212656(++_0x47c3b6);}(_0x087b,0x11a));var _0xb087=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x087b[_0x344a3f];return _0x264712;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xecf080,_0x36ac30,_0x3cebbf){return new BPromise(function(_0x6d83fb,_0x1dbe9f){return client[_0xb087('0xb')](_0xecf080,_0x3cebbf)[_0xb087('0xc')](function(_0x23cdd7){logger[_0xb087('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x36ac30,_0xb087('0xe'));logger[_0xb087('0xf')](_0xb087('0x10'),_0x36ac30,_0xb087('0xe'),JSON[_0xb087('0x11')](_0x23cdd7));if(_0x23cdd7[_0xb087('0x12')]){if(_0x23cdd7[_0xb087('0x12')]['code']===0x1f4){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')]['message']);return _0x1dbe9f(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);return _0x6d83fb(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}else{logger[_0xb087('0xd')](_0xb087('0x13'),_0x36ac30,'request\x20sent');_0x6d83fb(_0x23cdd7[_0xb087('0x15')][_0xb087('0x14')]);}})['catch'](function(_0xcc4426){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0xcc4426);_0x1dbe9f(_0xcc4426);});});}exports['CreateOpenchannelQueueReport']=function(_0x330005){var _0x3c680f=this;return new Promise(function(_0x17200d,_0x45d074){return db['OpenchannelQueueReport'][_0xb087('0x16')](_0x330005[_0xb087('0x17')],{'raw':_0x330005[_0xb087('0x18')]?_0x330005[_0xb087('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5ea3dc){logger['info'](_0xb087('0x19'),_0x330005);logger[_0xb087('0xf')](_0xb087('0x19'),_0x330005,JSON[_0xb087('0x11')](_0x5ea3dc));_0x17200d(_0x5ea3dc);})[_0xb087('0x1a')](function(_0x258b4c){logger[_0xb087('0x12')]('CreateOpenchannelQueueReport',_0x258b4c[_0xb087('0x14')],_0x330005);_0x45d074(_0x3c680f[_0xb087('0x12')](0x1f4,_0x258b4c[_0xb087('0x14')]));});});};exports[_0xb087('0x1b')]=function(_0x3ad74e){var _0x4d9028=this;return new Promise(function(_0x183eab,_0xdd4216){return db['OpenchannelQueueReport']['update'](_0x3ad74e['body'],{'raw':_0x3ad74e['options']?_0x3ad74e['options'][_0xb087('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ad74e[_0xb087('0x18')]?_0x3ad74e[_0xb087('0x18')][_0xb087('0x1d')]||null:null,'attributes':_0x3ad74e[_0xb087('0x18')]?_0x3ad74e[_0xb087('0x18')][_0xb087('0x1e')]||null:null,'limit':_0x3ad74e[_0xb087('0x18')]?_0x3ad74e[_0xb087('0x18')][_0xb087('0x1f')]||null:null})[_0xb087('0xc')](function(_0x31e3e6){logger[_0xb087('0xd')](_0xb087('0x1b'),_0x3ad74e);logger['debug'](_0xb087('0x1b'),_0x3ad74e,JSON[_0xb087('0x11')](_0x31e3e6));_0x183eab(_0x31e3e6);})[_0xb087('0x1a')](function(_0x15c9ac){logger[_0xb087('0x12')](_0xb087('0x1b'),_0x15c9ac[_0xb087('0x14')],_0x3ad74e);_0xdd4216(_0x4d9028[_0xb087('0x12')](0x1f4,_0x15c9ac['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index cea00f8..b2e578d 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 _0xa473=['./openchannelTransferReport.controller','isAuthenticated','index','get','describe','/:id','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x409ec0,_0x58b73e){var _0x58cec3=function(_0x89a210){while(--_0x89a210){_0x409ec0['push'](_0x409ec0['shift']());}};_0x58cec3(++_0x58b73e);}(_0xa473,0xab));var _0x3a47=function(_0x31617f,_0x6d7afa){_0x31617f=_0x31617f-0x0;var _0x38db34=_0xa473[_0x31617f];return _0x38db34;};'use strict';var multer=require(_0x3a47('0x0'));var util=require(_0x3a47('0x1'));var path=require(_0x3a47('0x2'));var timeout=require(_0x3a47('0x3'));var express=require(_0x3a47('0x4'));var router=express[_0x3a47('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3a47('0x6'));var interaction=require(_0x3a47('0x7'));var config=require(_0x3a47('0x8'));var controller=require(_0x3a47('0x9'));router['get']('/',auth[_0x3a47('0xa')](),controller[_0x3a47('0xb')]);router[_0x3a47('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x3a47('0xd')]);router[_0x3a47('0xc')](_0x3a47('0xe'),auth[_0x3a47('0xa')](),controller['show']);router[_0x3a47('0xf')]('/',auth[_0x3a47('0xa')](),controller['create']);router[_0x3a47('0x10')]('/:id',auth[_0x3a47('0xa')](),controller['update']);router[_0x3a47('0x11')]('/:id',auth[_0x3a47('0xa')](),controller[_0x3a47('0x12')]);module[_0x3a47('0x13')]=router; \ No newline at end of file +var _0x4637=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','get','/:id','show','post','create','update','delete','destroy'];(function(_0xf67fca,_0x9b4bbe){var _0x24f5a4=function(_0x4b46d4){while(--_0x4b46d4){_0xf67fca['push'](_0xf67fca['shift']());}};_0x24f5a4(++_0x9b4bbe);}(_0x4637,0x1cf));var _0x7463=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x4637[_0x2b5eae];return _0x5f3ac9;};'use strict';var multer=require('multer');var util=require(_0x7463('0x0'));var path=require(_0x7463('0x1'));var timeout=require(_0x7463('0x2'));var express=require(_0x7463('0x3'));var router=express[_0x7463('0x4')]();var fs_extra=require(_0x7463('0x5'));var auth=require(_0x7463('0x6'));var interaction=require(_0x7463('0x7'));var config=require(_0x7463('0x8'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0x7463('0x9')](),controller['index']);router['get'](_0x7463('0xa'),auth['isAuthenticated'](),controller[_0x7463('0xb')]);router[_0x7463('0xc')](_0x7463('0xd'),auth[_0x7463('0x9')](),controller[_0x7463('0xe')]);router[_0x7463('0xf')]('/',auth[_0x7463('0x9')](),controller[_0x7463('0x10')]);router['put'](_0x7463('0xd'),auth['isAuthenticated'](),controller[_0x7463('0x11')]);router[_0x7463('0x12')]('/:id',auth[_0x7463('0x9')](),controller[_0x7463('0x13')]);module[_0x7463('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index d195a66..136dcbf 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0xa4b2cf,_0x68a28){var _0xf1584a=function(_0x30e8e6){while(--_0x30e8e6){_0xa4b2cf['push'](_0xa4b2cf['shift']());}};_0xf1584a(++_0x68a28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4c4abb,_0x39bae7){var _0x29ce07=function(_0x215186){while(--_0x215186){_0x4c4abb['push'](_0x4c4abb['shift']());}};_0x29ce07(++_0x39bae7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 56e09b3..cc93922 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 _0x0a9f=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','include','findAll','rows','show','params','keys','includeAll','find','create','body','catch','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x2bf466,_0x4929a5){var _0x856885=function(_0x102ef1){while(--_0x102ef1){_0x2bf466['push'](_0x2bf466['shift']());}};_0x856885(++_0x4929a5);}(_0x0a9f,0x169));var _0xf0a9=function(_0x31ead7,_0x2e9a7c){_0x31ead7=_0x31ead7-0x0;var _0x3516f0=_0x0a9f[_0x31ead7];return _0x3516f0;};'use strict';var emlformat=require(_0xf0a9('0x0'));var rimraf=require(_0xf0a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0a9('0x2'));var rp=require(_0xf0a9('0x3'));var moment=require('moment');var BPromise=require(_0xf0a9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf0a9('0x5'));var csv=require(_0xf0a9('0x6'));var ejs=require(_0xf0a9('0x7'));var fs=require('fs');var fs_extra=require(_0xf0a9('0x8'));var _=require(_0xf0a9('0x9'));var squel=require(_0xf0a9('0xa'));var crypto=require('crypto');var jsforce=require(_0xf0a9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf0a9('0x6'));var querystring=require(_0xf0a9('0xc'));var Papa=require(_0xf0a9('0xd'));var Redis=require(_0xf0a9('0xe'));var authService=require(_0xf0a9('0xf'));var qs=require(_0xf0a9('0x10'));var as=require(_0xf0a9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0a9('0x12'))(_0xf0a9('0x13'));var utils=require(_0xf0a9('0x14'));var config=require(_0xf0a9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf0a9('0x16'))['db'];function respondWithStatusCode(_0x18e3de,_0xd43694){_0xd43694=_0xd43694||0xcc;return function(_0x4e0a8d){if(_0x4e0a8d){return _0x18e3de[_0xf0a9('0x17')](_0xd43694);}return _0x18e3de['status'](_0xd43694)['end']();};}function respondWithResult(_0x41c465,_0xb3e18c){_0xb3e18c=_0xb3e18c||0xc8;return function(_0x35eda8){if(_0x35eda8){return _0x41c465[_0xf0a9('0x18')](_0xb3e18c)['json'](_0x35eda8);}};}function respondWithFilteredResult(_0x1bb15b,_0x25d786){return function(_0x1b86f6){if(_0x1b86f6){var _0x45888a=typeof _0x25d786[_0xf0a9('0x19')]===_0xf0a9('0x1a')&&typeof _0x25d786[_0xf0a9('0x1b')]==='undefined';var _0x1023d3=_0x1b86f6[_0xf0a9('0x1c')];var _0x765a36=_0x45888a?0x0:_0x25d786['offset'];var _0x13926a=_0x45888a?_0x1b86f6[_0xf0a9('0x1c')]:_0x25d786[_0xf0a9('0x19')]+_0x25d786[_0xf0a9('0x1b')];var _0x2f2d10;if(_0x13926a>=_0x1023d3){_0x13926a=_0x1023d3;_0x2f2d10=0xc8;}else{_0x2f2d10=0xce;}_0x1bb15b[_0xf0a9('0x18')](_0x2f2d10);return _0x1bb15b[_0xf0a9('0x1d')](_0xf0a9('0x1e'),_0x765a36+'-'+_0x13926a+'/'+_0x1023d3)[_0xf0a9('0x1f')](_0x1b86f6);}return null;};}function patchUpdates(_0x483f26){return function(_0x5fff6e){try{jsonpatch[_0xf0a9('0x20')](_0x5fff6e,_0x483f26,!![]);}catch(_0x56f08a){return BPromise[_0xf0a9('0x21')](_0x56f08a);}return _0x5fff6e['save']();};}function saveUpdates(_0x5ca62e,_0x3f4916){return function(_0x885dbd){if(_0x885dbd){return _0x885dbd[_0xf0a9('0x22')](_0x5ca62e)[_0xf0a9('0x23')](function(_0x1aff44){return _0x1aff44;});}return null;};}function removeEntity(_0x117814,_0x3dd01d){return function(_0x4b45e6){if(_0x4b45e6){return _0x4b45e6[_0xf0a9('0x24')]()[_0xf0a9('0x23')](function(){_0x117814[_0xf0a9('0x18')](0xcc)[_0xf0a9('0x25')]();});}};}function handleEntityNotFound(_0x1bb070,_0x137012){return function(_0x1697b4){if(!_0x1697b4){_0x1bb070[_0xf0a9('0x17')](0x194);}return _0x1697b4;};}function handleError(_0x572316,_0x404074){_0x404074=_0x404074||0x1f4;return function(_0x46377e){logger[_0xf0a9('0x26')](_0x46377e[_0xf0a9('0x27')]);if(_0x46377e[_0xf0a9('0x28')]){delete _0x46377e[_0xf0a9('0x28')];}_0x572316['status'](_0x404074)[_0xf0a9('0x29')](_0x46377e);};}exports[_0xf0a9('0x2a')]=function(_0x2b7413,_0x24d4b8){var _0x1f2477={},_0x1407c1={},_0x2f0472={'count':0x0,'rows':[]};var _0x1f624f=_[_0xf0a9('0x2b')](db[_0xf0a9('0x2c')][_0xf0a9('0x2d')],function(_0x1f92eb){return{'name':_0x1f92eb['fieldName'],'type':_0x1f92eb['type'][_0xf0a9('0x2e')]};});_0x1407c1[_0xf0a9('0x2f')]=_[_0xf0a9('0x2b')](_0x1f624f,'name');_0x1407c1[_0xf0a9('0x30')]=_['keys'](_0x2b7413[_0xf0a9('0x30')]);_0x1407c1[_0xf0a9('0x31')]=_[_0xf0a9('0x32')](_0x1407c1[_0xf0a9('0x2f')],_0x1407c1['query']);_0x1f2477[_0xf0a9('0x33')]=_[_0xf0a9('0x32')](_0x1407c1[_0xf0a9('0x2f')],qs['fields'](_0x2b7413['query'][_0xf0a9('0x34')]));_0x1f2477[_0xf0a9('0x33')]=_0x1f2477['attributes'][_0xf0a9('0x35')]?_0x1f2477[_0xf0a9('0x33')]:_0x1407c1[_0xf0a9('0x2f')];if(!_0x2b7413[_0xf0a9('0x30')][_0xf0a9('0x36')](_0xf0a9('0x37'))){_0x1f2477[_0xf0a9('0x1b')]=qs['limit'](_0x2b7413[_0xf0a9('0x30')][_0xf0a9('0x1b')]);_0x1f2477[_0xf0a9('0x19')]=qs[_0xf0a9('0x19')](_0x2b7413[_0xf0a9('0x30')][_0xf0a9('0x19')]);}_0x1f2477[_0xf0a9('0x38')]=qs[_0xf0a9('0x39')](_0x2b7413['query'][_0xf0a9('0x39')]);_0x1f2477[_0xf0a9('0x3a')]=qs[_0xf0a9('0x31')](_[_0xf0a9('0x3b')](_0x2b7413['query'],_0x1407c1[_0xf0a9('0x31')]),_0x1f624f);if(_0x2b7413[_0xf0a9('0x30')][_0xf0a9('0x3c')]){_0x1f2477[_0xf0a9('0x3a')]=_['merge'](_0x1f2477[_0xf0a9('0x3a')],{'$or':_[_0xf0a9('0x2b')](_0x1f624f,function(_0x435679){if(_0x435679[_0xf0a9('0x3d')]!=='VIRTUAL'){var _0x76bc7a={};_0x76bc7a[_0x435679[_0xf0a9('0x28')]]={'$like':'%'+_0x2b7413[_0xf0a9('0x30')][_0xf0a9('0x3c')]+'%'};return _0x76bc7a;}})});}_0x1f2477=_[_0xf0a9('0x3e')]({},_0x1f2477,_0x2b7413[_0xf0a9('0x3f')]);var _0x2e9b2d={'where':_0x1f2477[_0xf0a9('0x3a')]};return db[_0xf0a9('0x2c')][_0xf0a9('0x1c')](_0x2e9b2d)[_0xf0a9('0x23')](function(_0x523329){_0x2f0472[_0xf0a9('0x1c')]=_0x523329;if(_0x2b7413[_0xf0a9('0x30')]['includeAll']){_0x1f2477[_0xf0a9('0x40')]=[{'all':!![]}];}return db[_0xf0a9('0x2c')][_0xf0a9('0x41')](_0x1f2477);})[_0xf0a9('0x23')](function(_0x15a6ef){_0x2f0472[_0xf0a9('0x42')]=_0x15a6ef;return _0x2f0472;})['then'](respondWithFilteredResult(_0x24d4b8,_0x1f2477))['catch'](handleError(_0x24d4b8,null));};exports[_0xf0a9('0x43')]=function(_0x5ca41d,_0x3c3ca0){var _0x779bd0={'raw':!![],'where':{'id':_0x5ca41d[_0xf0a9('0x44')]['id']}},_0x147044={};_0x147044['model']=_[_0xf0a9('0x45')](db['OpenchannelTransferReport'][_0xf0a9('0x2d')]);_0x147044[_0xf0a9('0x30')]=_['keys'](_0x5ca41d[_0xf0a9('0x30')]);_0x147044[_0xf0a9('0x31')]=_[_0xf0a9('0x32')](_0x147044[_0xf0a9('0x2f')],_0x147044[_0xf0a9('0x30')]);_0x779bd0[_0xf0a9('0x33')]=_[_0xf0a9('0x32')](_0x147044[_0xf0a9('0x2f')],qs['fields'](_0x5ca41d[_0xf0a9('0x30')][_0xf0a9('0x34')]));_0x779bd0['attributes']=_0x779bd0[_0xf0a9('0x33')][_0xf0a9('0x35')]?_0x779bd0[_0xf0a9('0x33')]:_0x147044['model'];if(_0x5ca41d[_0xf0a9('0x30')][_0xf0a9('0x46')]){_0x779bd0['include']=[{'all':!![]}];}_0x779bd0=_[_0xf0a9('0x3e')]({},_0x779bd0,_0x5ca41d[_0xf0a9('0x3f')]);return db['OpenchannelTransferReport'][_0xf0a9('0x47')](_0x779bd0)[_0xf0a9('0x23')](handleEntityNotFound(_0x3c3ca0,null))['then'](respondWithResult(_0x3c3ca0,null))['catch'](handleError(_0x3c3ca0,null));};exports[_0xf0a9('0x48')]=function(_0x490930,_0x5aac7){return db[_0xf0a9('0x2c')][_0xf0a9('0x48')](_0x490930['body'],{})['then'](respondWithResult(_0x5aac7,0xc9))['catch'](handleError(_0x5aac7,null));};exports[_0xf0a9('0x22')]=function(_0x484e43,_0x90ed07){if(_0x484e43[_0xf0a9('0x49')]['id']){delete _0x484e43['body']['id'];}return db[_0xf0a9('0x2c')]['find']({'where':{'id':_0x484e43[_0xf0a9('0x44')]['id']}})[_0xf0a9('0x23')](handleEntityNotFound(_0x90ed07,null))[_0xf0a9('0x23')](saveUpdates(_0x484e43[_0xf0a9('0x49')],null))[_0xf0a9('0x23')](respondWithResult(_0x90ed07,null))[_0xf0a9('0x4a')](handleError(_0x90ed07,null));};exports[_0xf0a9('0x24')]=function(_0x263308,_0x484b42){return db[_0xf0a9('0x2c')][_0xf0a9('0x47')]({'where':{'id':_0x263308['params']['id']}})['then'](handleEntityNotFound(_0x484b42,null))['then'](removeEntity(_0x484b42,null))[_0xf0a9('0x4a')](handleError(_0x484b42,null));};exports[_0xf0a9('0x4b')]=function(_0x3616bd,_0x338643){return db[_0xf0a9('0x2c')][_0xf0a9('0x4b')]()['then'](respondWithResult(_0x338643,null))['catch'](handleError(_0x338643,null));}; \ No newline at end of file +var _0x86b1=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x1606b8,_0x235fff){var _0x1eef90=function(_0x2902f8){while(--_0x2902f8){_0x1606b8['push'](_0x1606b8['shift']());}};_0x1eef90(++_0x235fff);}(_0x86b1,0xe3));var _0x186b=function(_0x48c75b,_0x507d2c){_0x48c75b=_0x48c75b-0x0;var _0x311551=_0x86b1[_0x48c75b];return _0x311551;};'use strict';var emlformat=require(_0x186b('0x0'));var rimraf=require(_0x186b('0x1'));var zipdir=require(_0x186b('0x2'));var jsonpatch=require(_0x186b('0x3'));var rp=require(_0x186b('0x4'));var moment=require('moment');var BPromise=require(_0x186b('0x5'));var Mustache=require(_0x186b('0x6'));var util=require(_0x186b('0x7'));var path=require(_0x186b('0x8'));var sox=require(_0x186b('0x9'));var csv=require(_0x186b('0xa'));var ejs=require(_0x186b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x186b('0xc'));var jsforce=require(_0x186b('0xd'));var deskjs=require(_0x186b('0xe'));var toCsv=require(_0x186b('0xa'));var querystring=require(_0x186b('0xf'));var Papa=require(_0x186b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x186b('0x11'));var as=require(_0x186b('0x12'));var hardwareService=require(_0x186b('0x13'));var logger=require(_0x186b('0x14'))('api');var utils=require(_0x186b('0x15'));var config=require(_0x186b('0x16'));var licenseUtil=require(_0x186b('0x17'));var db=require(_0x186b('0x18'))['db'];function respondWithStatusCode(_0x448806,_0x4e6e83){_0x4e6e83=_0x4e6e83||0xcc;return function(_0x305750){if(_0x305750){return _0x448806[_0x186b('0x19')](_0x4e6e83);}return _0x448806['status'](_0x4e6e83)[_0x186b('0x1a')]();};}function respondWithResult(_0x45f3ea,_0x532a5b){_0x532a5b=_0x532a5b||0xc8;return function(_0x56ae94){if(_0x56ae94){return _0x45f3ea[_0x186b('0x1b')](_0x532a5b)[_0x186b('0x1c')](_0x56ae94);}};}function respondWithFilteredResult(_0x2cfe36,_0x135027){return function(_0x490c1c){if(_0x490c1c){var _0x2d9a52=typeof _0x135027[_0x186b('0x1d')]==='undefined'&&typeof _0x135027[_0x186b('0x1e')]===_0x186b('0x1f');var _0x2ffd84=_0x490c1c[_0x186b('0x20')];var _0x562510=_0x2d9a52?0x0:_0x135027[_0x186b('0x1d')];var _0x15f8f9=_0x2d9a52?_0x490c1c[_0x186b('0x20')]:_0x135027[_0x186b('0x1d')]+_0x135027['limit'];var _0xb47581;if(_0x15f8f9>=_0x2ffd84){_0x15f8f9=_0x2ffd84;_0xb47581=0xc8;}else{_0xb47581=0xce;}_0x2cfe36['status'](_0xb47581);return _0x2cfe36[_0x186b('0x21')](_0x186b('0x22'),_0x562510+'-'+_0x15f8f9+'/'+_0x2ffd84)[_0x186b('0x1c')](_0x490c1c);}return null;};}function patchUpdates(_0x5f36a6){return function(_0x48bb06){try{jsonpatch[_0x186b('0x23')](_0x48bb06,_0x5f36a6,!![]);}catch(_0x1c193d){return BPromise[_0x186b('0x24')](_0x1c193d);}return _0x48bb06['save']();};}function saveUpdates(_0x1d530f,_0x3fb2fc){return function(_0xe21bee){if(_0xe21bee){return _0xe21bee[_0x186b('0x25')](_0x1d530f)['then'](function(_0x2a3a71){return _0x2a3a71;});}return null;};}function removeEntity(_0xdf8650,_0x413d02){return function(_0x5e5686){if(_0x5e5686){return _0x5e5686[_0x186b('0x26')]()[_0x186b('0x27')](function(){_0xdf8650[_0x186b('0x1b')](0xcc)[_0x186b('0x1a')]();});}};}function handleEntityNotFound(_0x1fedb0,_0x225684){return function(_0x471c99){if(!_0x471c99){_0x1fedb0['sendStatus'](0x194);}return _0x471c99;};}function handleError(_0x44be79,_0xbd54c4){_0xbd54c4=_0xbd54c4||0x1f4;return function(_0x47981d){logger[_0x186b('0x28')](_0x47981d[_0x186b('0x29')]);if(_0x47981d[_0x186b('0x2a')]){delete _0x47981d[_0x186b('0x2a')];}_0x44be79[_0x186b('0x1b')](_0xbd54c4)[_0x186b('0x2b')](_0x47981d);};}exports['index']=function(_0x1dd80f,_0xee8a5f){var _0x2b5556={},_0x18ea88={},_0x343f5e={'count':0x0,'rows':[]};var _0x3bd48a=_[_0x186b('0x2c')](db[_0x186b('0x2d')][_0x186b('0x2e')],function(_0x614879){return{'name':_0x614879['fieldName'],'type':_0x614879['type'][_0x186b('0x2f')]};});_0x18ea88[_0x186b('0x30')]=_[_0x186b('0x2c')](_0x3bd48a,_0x186b('0x2a'));_0x18ea88['query']=_['keys'](_0x1dd80f[_0x186b('0x31')]);_0x18ea88[_0x186b('0x32')]=_[_0x186b('0x33')](_0x18ea88[_0x186b('0x30')],_0x18ea88[_0x186b('0x31')]);_0x2b5556[_0x186b('0x34')]=_[_0x186b('0x33')](_0x18ea88[_0x186b('0x30')],qs[_0x186b('0x35')](_0x1dd80f[_0x186b('0x31')][_0x186b('0x35')]));_0x2b5556[_0x186b('0x34')]=_0x2b5556['attributes'][_0x186b('0x36')]?_0x2b5556[_0x186b('0x34')]:_0x18ea88['model'];if(!_0x1dd80f[_0x186b('0x31')][_0x186b('0x37')](_0x186b('0x38'))){_0x2b5556[_0x186b('0x1e')]=qs[_0x186b('0x1e')](_0x1dd80f['query'][_0x186b('0x1e')]);_0x2b5556[_0x186b('0x1d')]=qs[_0x186b('0x1d')](_0x1dd80f[_0x186b('0x31')][_0x186b('0x1d')]);}_0x2b5556[_0x186b('0x39')]=qs[_0x186b('0x3a')](_0x1dd80f[_0x186b('0x31')][_0x186b('0x3a')]);_0x2b5556['where']=qs[_0x186b('0x32')](_[_0x186b('0x3b')](_0x1dd80f[_0x186b('0x31')],_0x18ea88['filters']),_0x3bd48a);if(_0x1dd80f[_0x186b('0x31')][_0x186b('0x3c')]){_0x2b5556['where']=_[_0x186b('0x3d')](_0x2b5556[_0x186b('0x3e')],{'$or':_['map'](_0x3bd48a,function(_0x19fa18){if(_0x19fa18[_0x186b('0x3f')]!==_0x186b('0x40')){var _0x2d8343={};_0x2d8343[_0x19fa18[_0x186b('0x2a')]]={'$like':'%'+_0x1dd80f[_0x186b('0x31')][_0x186b('0x3c')]+'%'};return _0x2d8343;}})});}_0x2b5556=_['merge']({},_0x2b5556,_0x1dd80f[_0x186b('0x41')]);var _0x2f95b3={'where':_0x2b5556[_0x186b('0x3e')]};return db[_0x186b('0x2d')][_0x186b('0x20')](_0x2f95b3)[_0x186b('0x27')](function(_0xbc3381){_0x343f5e[_0x186b('0x20')]=_0xbc3381;if(_0x1dd80f[_0x186b('0x31')][_0x186b('0x42')]){_0x2b5556['include']=[{'all':!![]}];}return db[_0x186b('0x2d')][_0x186b('0x43')](_0x2b5556);})[_0x186b('0x27')](function(_0x183fa7){_0x343f5e[_0x186b('0x44')]=_0x183fa7;return _0x343f5e;})[_0x186b('0x27')](respondWithFilteredResult(_0xee8a5f,_0x2b5556))[_0x186b('0x45')](handleError(_0xee8a5f,null));};exports['show']=function(_0xab9827,_0x1a1137){var _0x2b7572={'raw':!![],'where':{'id':_0xab9827[_0x186b('0x46')]['id']}},_0x1920c8={};_0x1920c8[_0x186b('0x30')]=_[_0x186b('0x47')](db['OpenchannelTransferReport'][_0x186b('0x2e')]);_0x1920c8['query']=_['keys'](_0xab9827['query']);_0x1920c8[_0x186b('0x32')]=_[_0x186b('0x33')](_0x1920c8['model'],_0x1920c8[_0x186b('0x31')]);_0x2b7572[_0x186b('0x34')]=_['intersection'](_0x1920c8[_0x186b('0x30')],qs[_0x186b('0x35')](_0xab9827['query']['fields']));_0x2b7572[_0x186b('0x34')]=_0x2b7572[_0x186b('0x34')]['length']?_0x2b7572[_0x186b('0x34')]:_0x1920c8['model'];if(_0xab9827[_0x186b('0x31')][_0x186b('0x42')]){_0x2b7572[_0x186b('0x48')]=[{'all':!![]}];}_0x2b7572=_[_0x186b('0x3d')]({},_0x2b7572,_0xab9827[_0x186b('0x41')]);return db[_0x186b('0x2d')][_0x186b('0x49')](_0x2b7572)['then'](handleEntityNotFound(_0x1a1137,null))[_0x186b('0x27')](respondWithResult(_0x1a1137,null))['catch'](handleError(_0x1a1137,null));};exports[_0x186b('0x4a')]=function(_0x3cf68a,_0x33f506){return db[_0x186b('0x2d')][_0x186b('0x4a')](_0x3cf68a[_0x186b('0x4b')],{})[_0x186b('0x27')](respondWithResult(_0x33f506,0xc9))[_0x186b('0x45')](handleError(_0x33f506,null));};exports[_0x186b('0x25')]=function(_0x401a13,_0x22ebe9){if(_0x401a13[_0x186b('0x4b')]['id']){delete _0x401a13['body']['id'];}return db[_0x186b('0x2d')][_0x186b('0x49')]({'where':{'id':_0x401a13[_0x186b('0x46')]['id']}})['then'](handleEntityNotFound(_0x22ebe9,null))['then'](saveUpdates(_0x401a13[_0x186b('0x4b')],null))['then'](respondWithResult(_0x22ebe9,null))[_0x186b('0x45')](handleError(_0x22ebe9,null));};exports['destroy']=function(_0x5c2e33,_0x136a0d){return db[_0x186b('0x2d')][_0x186b('0x49')]({'where':{'id':_0x5c2e33[_0x186b('0x46')]['id']}})[_0x186b('0x27')](handleEntityNotFound(_0x136a0d,null))[_0x186b('0x27')](removeEntity(_0x136a0d,null))[_0x186b('0x45')](handleError(_0x136a0d,null));};exports[_0x186b('0x4c')]=function(_0x2a015e,_0x594906){return db[_0x186b('0x2d')]['describe']()['then'](respondWithResult(_0x594906,null))[_0x186b('0x45')](handleError(_0x594906,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d42d0aa..bff07cb 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 _0x78bb=['bluebird','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78bb,0x1e4));var _0xb78b=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0x78bb[_0x1e5cc3];return _0x15c596;};'use strict';var _=require(_0xb78b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb78b('0x1'));var moment=require('moment');var BPromise=require(_0xb78b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb78b('0x3'));var attributes=require(_0xb78b('0x4'));module['exports']=function(_0x579947,_0x59297e){return _0x579947[_0xb78b('0x5')](_0xb78b('0x6'),attributes,{'tableName':_0xb78b('0x7'),'paranoid':![],'indexes':[{'name':_0xb78b('0x8'),'fields':[_0xb78b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x52ea=['../../config/logger','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','uniqueid','lodash','util'];(function(_0x1976dd,_0x520bc2){var _0xf7925b=function(_0x788253){while(--_0x788253){_0x1976dd['push'](_0x1976dd['shift']());}};_0xf7925b(++_0x520bc2);}(_0x52ea,0x112));var _0xa52e=function(_0x134bfc,_0x144d5f){_0x134bfc=_0x134bfc-0x0;var _0x2f4dcc=_0x52ea[_0x134bfc];return _0x2f4dcc;};'use strict';var _=require(_0xa52e('0x0'));var util=require(_0xa52e('0x1'));var logger=require(_0xa52e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa52e('0x3'));var fs=require('fs');var path=require(_0xa52e('0x4'));var rimraf=require(_0xa52e('0x5'));var config=require(_0xa52e('0x6'));var attributes=require(_0xa52e('0x7'));module[_0xa52e('0x8')]=function(_0x449fef,_0x14ced6){return _0x449fef[_0xa52e('0x9')](_0xa52e('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa52e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 0948a5f..640593c 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 _0x3e9d=['info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x32faaf,_0x2ed4a6){var _0x213374=function(_0x4dde79){while(--_0x4dde79){_0x32faaf['push'](_0x32faaf['shift']());}};_0x213374(++_0x2ed4a6);}(_0x3e9d,0x1ba));var _0xd3e9=function(_0x307655,_0x182c2e){_0x307655=_0x307655-0x0;var _0x17e2ae=_0x3e9d[_0x307655];return _0x17e2ae;};'use strict';var _=require(_0xd3e9('0x0'));var util=require(_0xd3e9('0x1'));var moment=require('moment');var BPromise=require(_0xd3e9('0x2'));var rs=require(_0xd3e9('0x3'));var fs=require('fs');var Redis=require(_0xd3e9('0x4'));var db=require(_0xd3e9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd3e9('0x6'));var config=require(_0xd3e9('0x7'));var jayson=require(_0xd3e9('0x8'));var client=jayson[_0xd3e9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc1de,_0x17f2b0,_0x140f2d){return new BPromise(function(_0x45364e,_0x3025f9){return client[_0xd3e9('0xa')](_0x4dc1de,_0x140f2d)[_0xd3e9('0xb')](function(_0x2944cd){logger['info'](_0xd3e9('0xc'),_0x17f2b0,_0xd3e9('0xd'));logger[_0xd3e9('0xe')](_0xd3e9('0xf'),_0x17f2b0,_0xd3e9('0xd'),JSON[_0xd3e9('0x10')](_0x2944cd));if(_0x2944cd[_0xd3e9('0x11')]){if(_0x2944cd[_0xd3e9('0x11')][_0xd3e9('0x12')]===0x1f4){logger[_0xd3e9('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x17f2b0,_0x2944cd[_0xd3e9('0x11')]['message']);return _0x3025f9(_0x2944cd['error']['message']);}logger[_0xd3e9('0x11')](_0xd3e9('0xc'),_0x17f2b0,_0x2944cd[_0xd3e9('0x11')][_0xd3e9('0x13')]);return _0x45364e(_0x2944cd[_0xd3e9('0x11')][_0xd3e9('0x13')]);}else{logger[_0xd3e9('0x14')](_0xd3e9('0xc'),_0x17f2b0,_0xd3e9('0xd'));_0x45364e(_0x2944cd['result'][_0xd3e9('0x13')]);}})['catch'](function(_0x8b9e10){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x17f2b0,_0x8b9e10);_0x3025f9(_0x8b9e10);});});} \ No newline at end of file +var _0x165d=['request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http'];(function(_0x1d6845,_0xdf6e20){var _0x5d7d5f=function(_0x24b0ad){while(--_0x24b0ad){_0x1d6845['push'](_0x1d6845['shift']());}};_0x5d7d5f(++_0xdf6e20);}(_0x165d,0x14a));var _0xd165=function(_0xdb627a,_0x4d37e8){_0xdb627a=_0xdb627a-0x0;var _0x1ddb25=_0x165d[_0xdb627a];return _0x1ddb25;};'use strict';var _=require(_0xd165('0x0'));var util=require(_0xd165('0x1'));var moment=require(_0xd165('0x2'));var BPromise=require(_0xd165('0x3'));var rs=require(_0xd165('0x4'));var fs=require('fs');var Redis=require(_0xd165('0x5'));var db=require(_0xd165('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd165('0x7'))(_0xd165('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd165('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2305bc,_0x4dccaa,_0x5eec53){return new BPromise(function(_0x3fd82e,_0x41a937){return client[_0xd165('0xa')](_0x2305bc,_0x5eec53)[_0xd165('0xb')](function(_0x3a29a0){logger[_0xd165('0xc')](_0xd165('0xd'),_0x4dccaa,_0xd165('0xe'));logger['debug'](_0xd165('0xf'),_0x4dccaa,_0xd165('0xe'),JSON[_0xd165('0x10')](_0x3a29a0));if(_0x3a29a0['error']){if(_0x3a29a0[_0xd165('0x11')]['code']===0x1f4){logger[_0xd165('0x11')](_0xd165('0xd'),_0x4dccaa,_0x3a29a0[_0xd165('0x11')][_0xd165('0x12')]);return _0x41a937(_0x3a29a0['error']['message']);}logger[_0xd165('0x11')](_0xd165('0xd'),_0x4dccaa,_0x3a29a0[_0xd165('0x11')]['message']);return _0x3fd82e(_0x3a29a0['error']['message']);}else{logger[_0xd165('0xc')](_0xd165('0xd'),_0x4dccaa,'request\x20sent');_0x3fd82e(_0x3a29a0[_0xd165('0x13')][_0xd165('0x12')]);}})['catch'](function(_0x522b83){logger[_0xd165('0x11')](_0xd165('0xd'),_0x4dccaa,_0x522b83);_0x41a937(_0x522b83);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 54eb014..9c27f8f 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 _0x1cd8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x387862,_0x3c5c4e){var _0x16d405=function(_0x113b00){while(--_0x113b00){_0x387862['push'](_0x387862['shift']());}};_0x16d405(++_0x3c5c4e);}(_0x1cd8,0x198));var _0x81cd=function(_0x373e27,_0x527f8d){_0x373e27=_0x373e27-0x0;var _0x4a336f=_0x1cd8[_0x373e27];return _0x4a336f;};'use strict';var multer=require(_0x81cd('0x0'));var util=require(_0x81cd('0x1'));var path=require(_0x81cd('0x2'));var timeout=require(_0x81cd('0x3'));var express=require(_0x81cd('0x4'));var router=express[_0x81cd('0x5')]();var fs_extra=require(_0x81cd('0x6'));var auth=require(_0x81cd('0x7'));var interaction=require(_0x81cd('0x8'));var config=require(_0x81cd('0x9'));var controller=require('./pause.controller');router[_0x81cd('0xa')]('/',auth[_0x81cd('0xb')](),controller['index']);router[_0x81cd('0xa')](_0x81cd('0xc'),auth[_0x81cd('0xb')](),controller[_0x81cd('0xd')]);router[_0x81cd('0xe')]('/',auth[_0x81cd('0xb')](),controller['create']);router[_0x81cd('0xf')](_0x81cd('0xc'),auth['isAuthenticated'](),controller[_0x81cd('0x10')]);router['delete'](_0x81cd('0xc'),auth[_0x81cd('0xb')](),controller[_0x81cd('0x11')]);module['exports']=router; \ No newline at end of file +var _0xed2a=['isAuthenticated','index','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get'];(function(_0xf2fec5,_0x436cf5){var _0x202cdf=function(_0x3eb7f1){while(--_0x3eb7f1){_0xf2fec5['push'](_0xf2fec5['shift']());}};_0x202cdf(++_0x436cf5);}(_0xed2a,0x1e8));var _0xaed2=function(_0x3e176e,_0x13a655){_0x3e176e=_0x3e176e-0x0;var _0x58f3ad=_0xed2a[_0x3e176e];return _0x58f3ad;};'use strict';var multer=require(_0xaed2('0x0'));var util=require(_0xaed2('0x1'));var path=require(_0xaed2('0x2'));var timeout=require(_0xaed2('0x3'));var express=require(_0xaed2('0x4'));var router=express[_0xaed2('0x5')]();var fs_extra=require(_0xaed2('0x6'));var auth=require(_0xaed2('0x7'));var interaction=require(_0xaed2('0x8'));var config=require(_0xaed2('0x9'));var controller=require(_0xaed2('0xa'));router[_0xaed2('0xb')]('/',auth[_0xaed2('0xc')](),controller[_0xaed2('0xd')]);router['get']('/:id',auth[_0xaed2('0xc')](),controller[_0xaed2('0xe')]);router[_0xaed2('0xf')]('/',auth[_0xaed2('0xc')](),controller['create']);router[_0xaed2('0x10')]('/:id',auth[_0xaed2('0xc')](),controller[_0xaed2('0x11')]);router['delete']('/:id',auth[_0xaed2('0xc')](),controller[_0xaed2('0x12')]);module[_0xaed2('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 2eefede..12579ac 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 _0xd612=['sequelize','exports','STRING','name'];(function(_0x1cbc66,_0x1a6273){var _0x4e1a7a=function(_0x2fb4a3){while(--_0x2fb4a3){_0x1cbc66['push'](_0x1cbc66['shift']());}};_0x4e1a7a(++_0x1a6273);}(_0xd612,0x17c));var _0x2d61=function(_0x3f26ba,_0x32c76a){_0x3f26ba=_0x3f26ba-0x0;var _0x59e313=_0xd612[_0x3f26ba];return _0x59e313;};'use strict';var Sequelize=require(_0x2d61('0x0'));module[_0x2d61('0x1')]={'name':{'type':Sequelize[_0x2d61('0x2')],'unique':_0x2d61('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2d61('0x2')]}}; \ No newline at end of file +var _0x7370=['STRING','sequelize','exports'];(function(_0x25ba43,_0x3dc763){var _0x4291d5=function(_0x789032){while(--_0x789032){_0x25ba43['push'](_0x25ba43['shift']());}};_0x4291d5(++_0x3dc763);}(_0x7370,0x1db));var _0x0737=function(_0x5d99bb,_0x10e04b){_0x5d99bb=_0x5d99bb-0x0;var _0xdfe846=_0x7370[_0x5d99bb];return _0xdfe846;};'use strict';var Sequelize=require(_0x0737('0x0'));module[_0x0737('0x1')]={'name':{'type':Sequelize[_0x0737('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index ef6829b..5de6f25 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 _0x6b8c=['lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','set','Content-Range','apply','save','update','then','destroy','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','user','get','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x2ad0ea,_0x5be9eb){var _0x39a572=function(_0x3fe486){while(--_0x3fe486){_0x2ad0ea['push'](_0x2ad0ea['shift']());}};_0x39a572(++_0x5be9eb);}(_0x6b8c,0x199));var _0xc6b8=function(_0x26a919,_0x25f029){_0x26a919=_0x26a919-0x0;var _0x326208=_0x6b8c[_0x26a919];return _0x326208;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6b8('0x0'));var zipdir=require(_0xc6b8('0x1'));var jsonpatch=require(_0xc6b8('0x2'));var rp=require(_0xc6b8('0x3'));var moment=require(_0xc6b8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc6b8('0x5'));var path=require(_0xc6b8('0x6'));var sox=require(_0xc6b8('0x7'));var csv=require(_0xc6b8('0x8'));var ejs=require(_0xc6b8('0x9'));var fs=require('fs');var fs_extra=require(_0xc6b8('0xa'));var _=require(_0xc6b8('0xb'));var squel=require('squel');var crypto=require(_0xc6b8('0xc'));var jsforce=require(_0xc6b8('0xd'));var deskjs=require(_0xc6b8('0xe'));var toCsv=require(_0xc6b8('0x8'));var querystring=require(_0xc6b8('0xf'));var Papa=require(_0xc6b8('0x10'));var Redis=require('ioredis');var authService=require(_0xc6b8('0x11'));var qs=require(_0xc6b8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6b8('0x13'))(_0xc6b8('0x14'));var utils=require(_0xc6b8('0x15'));var config=require(_0xc6b8('0x16'));var licenseUtil=require(_0xc6b8('0x17'));var db=require(_0xc6b8('0x18'))['db'];function respondWithStatusCode(_0x1956ab,_0x2bb2e0){_0x2bb2e0=_0x2bb2e0||0xcc;return function(_0x16b467){if(_0x16b467){return _0x1956ab[_0xc6b8('0x19')](_0x2bb2e0);}return _0x1956ab['status'](_0x2bb2e0)[_0xc6b8('0x1a')]();};}function respondWithResult(_0x2a5ef4,_0x53a65e){_0x53a65e=_0x53a65e||0xc8;return function(_0x34912a){if(_0x34912a){return _0x2a5ef4[_0xc6b8('0x1b')](_0x53a65e)[_0xc6b8('0x1c')](_0x34912a);}};}function respondWithFilteredResult(_0x2e34a8,_0x3b57fc){return function(_0x477743){if(_0x477743){var _0x196219=typeof _0x3b57fc['offset']==='undefined'&&typeof _0x3b57fc[_0xc6b8('0x1d')]==='undefined';var _0x2c6834=_0x477743[_0xc6b8('0x1e')];var _0x2c1199=_0x196219?0x0:_0x3b57fc['offset'];var _0x551468=_0x196219?_0x477743['count']:_0x3b57fc['offset']+_0x3b57fc[_0xc6b8('0x1d')];var _0x38afb1;if(_0x551468>=_0x2c6834){_0x551468=_0x2c6834;_0x38afb1=0xc8;}else{_0x38afb1=0xce;}_0x2e34a8[_0xc6b8('0x1b')](_0x38afb1);return _0x2e34a8[_0xc6b8('0x1f')](_0xc6b8('0x20'),_0x2c1199+'-'+_0x551468+'/'+_0x2c6834)['json'](_0x477743);}return null;};}function patchUpdates(_0x4dfb00){return function(_0x452049){try{jsonpatch[_0xc6b8('0x21')](_0x452049,_0x4dfb00,!![]);}catch(_0x1b7104){return BPromise['reject'](_0x1b7104);}return _0x452049[_0xc6b8('0x22')]();};}function saveUpdates(_0x4e823e,_0x38cf8e){return function(_0x278950){if(_0x278950){return _0x278950[_0xc6b8('0x23')](_0x4e823e)[_0xc6b8('0x24')](function(_0x4f8489){return _0x4f8489;});}return null;};}function removeEntity(_0x18d54d,_0x31eaf6){return function(_0x58e07d){if(_0x58e07d){return _0x58e07d[_0xc6b8('0x25')]()[_0xc6b8('0x24')](function(){var _0x4ffdb2=_0x58e07d['get']({'plain':!![]});var _0x1e6506=_0xc6b8('0x26');return db[_0xc6b8('0x27')][_0xc6b8('0x25')]({'where':{'type':_0x1e6506,'resourceId':_0x4ffdb2['id']}})[_0xc6b8('0x24')](function(){return _0x58e07d;});})[_0xc6b8('0x24')](function(){_0x18d54d[_0xc6b8('0x1b')](0xcc)[_0xc6b8('0x1a')]();});}};}function handleEntityNotFound(_0x4016ec,_0x135bcf){return function(_0x213c60){if(!_0x213c60){_0x4016ec[_0xc6b8('0x19')](0x194);}return _0x213c60;};}function handleError(_0xb353b0,_0x3bcdaa){_0x3bcdaa=_0x3bcdaa||0x1f4;return function(_0xec5dae){logger[_0xc6b8('0x28')](_0xec5dae[_0xc6b8('0x29')]);if(_0xec5dae[_0xc6b8('0x2a')]){delete _0xec5dae[_0xc6b8('0x2a')];}_0xb353b0['status'](_0x3bcdaa)[_0xc6b8('0x2b')](_0xec5dae);};}exports[_0xc6b8('0x2c')]=function(_0x2eca3a,_0x5adc89){var _0x411a0e={},_0x3c0c90={},_0x34254c={'count':0x0,'rows':[]};var _0xe67f68=_[_0xc6b8('0x2d')](db[_0xc6b8('0x2e')][_0xc6b8('0x2f')],function(_0x355b6a){return{'name':_0x355b6a[_0xc6b8('0x30')],'type':_0x355b6a[_0xc6b8('0x31')][_0xc6b8('0x32')]};});_0x3c0c90[_0xc6b8('0x33')]=_['map'](_0xe67f68,_0xc6b8('0x2a'));_0x3c0c90[_0xc6b8('0x34')]=_[_0xc6b8('0x35')](_0x2eca3a[_0xc6b8('0x34')]);_0x3c0c90[_0xc6b8('0x36')]=_[_0xc6b8('0x37')](_0x3c0c90[_0xc6b8('0x33')],_0x3c0c90[_0xc6b8('0x34')]);_0x411a0e[_0xc6b8('0x38')]=_[_0xc6b8('0x37')](_0x3c0c90['model'],qs[_0xc6b8('0x39')](_0x2eca3a['query'][_0xc6b8('0x39')]));_0x411a0e['attributes']=_0x411a0e[_0xc6b8('0x38')][_0xc6b8('0x3a')]?_0x411a0e['attributes']:_0x3c0c90['model'];if(!_0x2eca3a[_0xc6b8('0x34')][_0xc6b8('0x3b')](_0xc6b8('0x3c'))){_0x411a0e['limit']=qs[_0xc6b8('0x1d')](_0x2eca3a[_0xc6b8('0x34')][_0xc6b8('0x1d')]);_0x411a0e['offset']=qs[_0xc6b8('0x3d')](_0x2eca3a[_0xc6b8('0x34')][_0xc6b8('0x3d')]);}_0x411a0e[_0xc6b8('0x3e')]=qs[_0xc6b8('0x3f')](_0x2eca3a[_0xc6b8('0x34')][_0xc6b8('0x3f')]);_0x411a0e[_0xc6b8('0x40')]=qs[_0xc6b8('0x36')](_[_0xc6b8('0x41')](_0x2eca3a[_0xc6b8('0x34')],_0x3c0c90[_0xc6b8('0x36')]),_0xe67f68);if(_0x2eca3a[_0xc6b8('0x34')][_0xc6b8('0x42')]){_0x411a0e[_0xc6b8('0x40')]=_[_0xc6b8('0x43')](_0x411a0e[_0xc6b8('0x40')],{'$or':_['map'](_0xe67f68,function(_0x2a92bb){if(_0x2a92bb[_0xc6b8('0x31')]!=='VIRTUAL'){var _0x3e390d={};_0x3e390d[_0x2a92bb[_0xc6b8('0x2a')]]={'$like':'%'+_0x2eca3a[_0xc6b8('0x34')][_0xc6b8('0x42')]+'%'};return _0x3e390d;}})});}_0x411a0e=_[_0xc6b8('0x43')]({},_0x411a0e,_0x2eca3a['options']);var _0x285427={'where':_0x411a0e[_0xc6b8('0x40')]};return db[_0xc6b8('0x2e')][_0xc6b8('0x1e')](_0x285427)['then'](function(_0x3f20f8){_0x34254c[_0xc6b8('0x1e')]=_0x3f20f8;if(_0x2eca3a[_0xc6b8('0x34')][_0xc6b8('0x44')]){_0x411a0e[_0xc6b8('0x45')]=[{'all':!![]}];}return db[_0xc6b8('0x2e')][_0xc6b8('0x46')](_0x411a0e);})['then'](function(_0x2a60ef){_0x34254c[_0xc6b8('0x47')]=_0x2a60ef;return _0x34254c;})[_0xc6b8('0x24')](respondWithFilteredResult(_0x5adc89,_0x411a0e))['catch'](handleError(_0x5adc89,null));};exports[_0xc6b8('0x48')]=function(_0x51e4ce,_0x3cbf33){var _0x4f5fcc={'raw':!![],'where':{'id':_0x51e4ce[_0xc6b8('0x49')]['id']}},_0x16609e={};_0x16609e[_0xc6b8('0x33')]=_[_0xc6b8('0x35')](db[_0xc6b8('0x2e')][_0xc6b8('0x2f')]);_0x16609e[_0xc6b8('0x34')]=_[_0xc6b8('0x35')](_0x51e4ce[_0xc6b8('0x34')]);_0x16609e[_0xc6b8('0x36')]=_['intersection'](_0x16609e[_0xc6b8('0x33')],_0x16609e[_0xc6b8('0x34')]);_0x4f5fcc[_0xc6b8('0x38')]=_[_0xc6b8('0x37')](_0x16609e[_0xc6b8('0x33')],qs['fields'](_0x51e4ce['query'][_0xc6b8('0x39')]));_0x4f5fcc['attributes']=_0x4f5fcc[_0xc6b8('0x38')][_0xc6b8('0x3a')]?_0x4f5fcc['attributes']:_0x16609e[_0xc6b8('0x33')];if(_0x51e4ce[_0xc6b8('0x34')][_0xc6b8('0x44')]){_0x4f5fcc[_0xc6b8('0x45')]=[{'all':!![]}];}_0x4f5fcc=_[_0xc6b8('0x43')]({},_0x4f5fcc,_0x51e4ce[_0xc6b8('0x4a')]);return db['Pause'][_0xc6b8('0x4b')](_0x4f5fcc)[_0xc6b8('0x24')](handleEntityNotFound(_0x3cbf33,null))[_0xc6b8('0x24')](respondWithResult(_0x3cbf33,null))[_0xc6b8('0x4c')](handleError(_0x3cbf33,null));};exports[_0xc6b8('0x4d')]=function(_0x7fc6e7,_0x23821d){return db[_0xc6b8('0x2e')]['create'](_0x7fc6e7[_0xc6b8('0x4e')],{})[_0xc6b8('0x24')](function(_0x1b975a){var _0x122171=_0x7fc6e7[_0xc6b8('0x4f')][_0xc6b8('0x50')]({'plain':!![]});if(!_0x122171)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x122171[_0xc6b8('0x51')]===_0xc6b8('0x4f')){var _0x588a24=_0x1b975a['get']({'plain':!![]});var _0x3da1c8=_0xc6b8('0x26');return db[_0xc6b8('0x52')]['find']({'where':{'name':_0x3da1c8,'userProfileId':_0x122171['userProfileId']},'raw':!![]})['then'](function(_0x387d38){if(_0x387d38&&_0x387d38['autoAssociation']===0x0){return db[_0xc6b8('0x27')][_0xc6b8('0x4d')]({'name':_0x588a24[_0xc6b8('0x2a')],'resourceId':_0x588a24['id'],'type':_0x387d38[_0xc6b8('0x2a')],'sectionId':_0x387d38['id']},{})[_0xc6b8('0x24')](function(){return _0x1b975a;});}else{return _0x1b975a;}})['catch'](function(_0x54ec4f){logger['error'](_0xc6b8('0x53'),_0x54ec4f);throw _0x54ec4f;});}return _0x1b975a;})[_0xc6b8('0x24')](respondWithResult(_0x23821d,0xc9))[_0xc6b8('0x4c')](handleError(_0x23821d,null));};exports['update']=function(_0x526003,_0x535a67){if(_0x526003[_0xc6b8('0x4e')]['id']){delete _0x526003[_0xc6b8('0x4e')]['id'];}return db[_0xc6b8('0x2e')]['find']({'where':{'id':_0x526003[_0xc6b8('0x49')]['id']}})[_0xc6b8('0x24')](handleEntityNotFound(_0x535a67,null))['then'](saveUpdates(_0x526003[_0xc6b8('0x4e')],null))[_0xc6b8('0x24')](respondWithResult(_0x535a67,null))['catch'](handleError(_0x535a67,null));};exports[_0xc6b8('0x25')]=function(_0x211231,_0x257e2e){return db[_0xc6b8('0x2e')][_0xc6b8('0x4b')]({'where':{'id':_0x211231[_0xc6b8('0x49')]['id']}})[_0xc6b8('0x24')](handleEntityNotFound(_0x257e2e,null))[_0xc6b8('0x24')](removeEntity(_0x257e2e,null))[_0xc6b8('0x4c')](handleError(_0x257e2e,null));}; \ No newline at end of file +var _0x9b67=['where','filters','pick','merge','type','filter','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','fields','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','set','Content-Range','reject','save','update','then','destroy','get','Pauses','UserProfileResource','name','send','Pause','fieldName','key','model','map','query','keys','intersection','attributes','length','nolimit','sort'];(function(_0x28bcd3,_0xb27f79){var _0x2a4335=function(_0x11f8b7){while(--_0x11f8b7){_0x28bcd3['push'](_0x28bcd3['shift']());}};_0x2a4335(++_0xb27f79);}(_0x9b67,0xc6));var _0x79b6=function(_0x21acae,_0xc6c5bf){_0x21acae=_0x21acae-0x0;var _0x50553e=_0x9b67[_0x21acae];return _0x50553e;};'use strict';var emlformat=require(_0x79b6('0x0'));var rimraf=require(_0x79b6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x79b6('0x2'));var rp=require(_0x79b6('0x3'));var moment=require(_0x79b6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x79b6('0x5'));var util=require(_0x79b6('0x6'));var path=require(_0x79b6('0x7'));var sox=require(_0x79b6('0x8'));var csv=require(_0x79b6('0x9'));var ejs=require(_0x79b6('0xa'));var fs=require('fs');var fs_extra=require(_0x79b6('0xb'));var _=require(_0x79b6('0xc'));var squel=require(_0x79b6('0xd'));var crypto=require(_0x79b6('0xe'));var jsforce=require(_0x79b6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x79b6('0x9'));var querystring=require(_0x79b6('0x10'));var Papa=require(_0x79b6('0x11'));var Redis=require(_0x79b6('0x12'));var authService=require(_0x79b6('0x13'));var qs=require(_0x79b6('0x14'));var as=require(_0x79b6('0x15'));var hardwareService=require(_0x79b6('0x16'));var logger=require(_0x79b6('0x17'))(_0x79b6('0x18'));var utils=require(_0x79b6('0x19'));var config=require(_0x79b6('0x1a'));var licenseUtil=require(_0x79b6('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x472755,_0x88dc73){_0x88dc73=_0x88dc73||0xcc;return function(_0x2bc60d){if(_0x2bc60d){return _0x472755['sendStatus'](_0x88dc73);}return _0x472755[_0x79b6('0x1c')](_0x88dc73)[_0x79b6('0x1d')]();};}function respondWithResult(_0x1d5cc5,_0x1885a5){_0x1885a5=_0x1885a5||0xc8;return function(_0x4a0795){if(_0x4a0795){return _0x1d5cc5['status'](_0x1885a5)[_0x79b6('0x1e')](_0x4a0795);}};}function respondWithFilteredResult(_0x1ade88,_0x53d16c){return function(_0x4f30b5){if(_0x4f30b5){var _0x7eb2d5=typeof _0x53d16c['offset']===_0x79b6('0x1f')&&typeof _0x53d16c[_0x79b6('0x20')]===_0x79b6('0x1f');var _0x21e57e=_0x4f30b5['count'];var _0x5ea041=_0x7eb2d5?0x0:_0x53d16c['offset'];var _0x832080=_0x7eb2d5?_0x4f30b5['count']:_0x53d16c['offset']+_0x53d16c[_0x79b6('0x20')];var _0x3084d5;if(_0x832080>=_0x21e57e){_0x832080=_0x21e57e;_0x3084d5=0xc8;}else{_0x3084d5=0xce;}_0x1ade88[_0x79b6('0x1c')](_0x3084d5);return _0x1ade88[_0x79b6('0x21')](_0x79b6('0x22'),_0x5ea041+'-'+_0x832080+'/'+_0x21e57e)['json'](_0x4f30b5);}return null;};}function patchUpdates(_0x36e24d){return function(_0x20e095){try{jsonpatch['apply'](_0x20e095,_0x36e24d,!![]);}catch(_0x1decbf){return BPromise[_0x79b6('0x23')](_0x1decbf);}return _0x20e095[_0x79b6('0x24')]();};}function saveUpdates(_0x3b1aec,_0x49dd1f){return function(_0xee633e){if(_0xee633e){return _0xee633e[_0x79b6('0x25')](_0x3b1aec)[_0x79b6('0x26')](function(_0x45159f){return _0x45159f;});}return null;};}function removeEntity(_0x409302,_0x4b9882){return function(_0x470f56){if(_0x470f56){return _0x470f56[_0x79b6('0x27')]()[_0x79b6('0x26')](function(){var _0x2cab60=_0x470f56[_0x79b6('0x28')]({'plain':!![]});var _0x36bc48=_0x79b6('0x29');return db[_0x79b6('0x2a')][_0x79b6('0x27')]({'where':{'type':_0x36bc48,'resourceId':_0x2cab60['id']}})[_0x79b6('0x26')](function(){return _0x470f56;});})[_0x79b6('0x26')](function(){_0x409302[_0x79b6('0x1c')](0xcc)[_0x79b6('0x1d')]();});}};}function handleEntityNotFound(_0x4e56bc,_0x599bb7){return function(_0x8c158){if(!_0x8c158){_0x4e56bc['sendStatus'](0x194);}return _0x8c158;};}function handleError(_0x483cc7,_0x7d9a86){_0x7d9a86=_0x7d9a86||0x1f4;return function(_0x66b96c){logger['error'](_0x66b96c['stack']);if(_0x66b96c[_0x79b6('0x2b')]){delete _0x66b96c['name'];}_0x483cc7[_0x79b6('0x1c')](_0x7d9a86)[_0x79b6('0x2c')](_0x66b96c);};}exports['index']=function(_0x287c9c,_0x3ffd47){var _0x847d39={},_0x19d953={},_0x1ff3f3={'count':0x0,'rows':[]};var _0x3cf5e9=_['map'](db[_0x79b6('0x2d')]['rawAttributes'],function(_0xaa5a6d){return{'name':_0xaa5a6d[_0x79b6('0x2e')],'type':_0xaa5a6d['type'][_0x79b6('0x2f')]};});_0x19d953[_0x79b6('0x30')]=_[_0x79b6('0x31')](_0x3cf5e9,_0x79b6('0x2b'));_0x19d953[_0x79b6('0x32')]=_[_0x79b6('0x33')](_0x287c9c[_0x79b6('0x32')]);_0x19d953['filters']=_[_0x79b6('0x34')](_0x19d953[_0x79b6('0x30')],_0x19d953[_0x79b6('0x32')]);_0x847d39[_0x79b6('0x35')]=_[_0x79b6('0x34')](_0x19d953[_0x79b6('0x30')],qs['fields'](_0x287c9c[_0x79b6('0x32')]['fields']));_0x847d39[_0x79b6('0x35')]=_0x847d39['attributes'][_0x79b6('0x36')]?_0x847d39[_0x79b6('0x35')]:_0x19d953['model'];if(!_0x287c9c[_0x79b6('0x32')]['hasOwnProperty'](_0x79b6('0x37'))){_0x847d39[_0x79b6('0x20')]=qs[_0x79b6('0x20')](_0x287c9c[_0x79b6('0x32')][_0x79b6('0x20')]);_0x847d39['offset']=qs['offset'](_0x287c9c['query']['offset']);}_0x847d39['order']=qs[_0x79b6('0x38')](_0x287c9c[_0x79b6('0x32')][_0x79b6('0x38')]);_0x847d39[_0x79b6('0x39')]=qs[_0x79b6('0x3a')](_[_0x79b6('0x3b')](_0x287c9c[_0x79b6('0x32')],_0x19d953[_0x79b6('0x3a')]),_0x3cf5e9);if(_0x287c9c[_0x79b6('0x32')]['filter']){_0x847d39[_0x79b6('0x39')]=_[_0x79b6('0x3c')](_0x847d39[_0x79b6('0x39')],{'$or':_['map'](_0x3cf5e9,function(_0xbf55d7){if(_0xbf55d7[_0x79b6('0x3d')]!=='VIRTUAL'){var _0x520522={};_0x520522[_0xbf55d7[_0x79b6('0x2b')]]={'$like':'%'+_0x287c9c[_0x79b6('0x32')][_0x79b6('0x3e')]+'%'};return _0x520522;}})});}_0x847d39=_[_0x79b6('0x3c')]({},_0x847d39,_0x287c9c[_0x79b6('0x3f')]);var _0x4de6e4={'where':_0x847d39[_0x79b6('0x39')]};return db[_0x79b6('0x2d')][_0x79b6('0x40')](_0x4de6e4)[_0x79b6('0x26')](function(_0x18f322){_0x1ff3f3[_0x79b6('0x40')]=_0x18f322;if(_0x287c9c[_0x79b6('0x32')][_0x79b6('0x41')]){_0x847d39[_0x79b6('0x42')]=[{'all':!![]}];}return db[_0x79b6('0x2d')][_0x79b6('0x43')](_0x847d39);})[_0x79b6('0x26')](function(_0x21d3ee){_0x1ff3f3[_0x79b6('0x44')]=_0x21d3ee;return _0x1ff3f3;})[_0x79b6('0x26')](respondWithFilteredResult(_0x3ffd47,_0x847d39))['catch'](handleError(_0x3ffd47,null));};exports[_0x79b6('0x45')]=function(_0x5e916c,_0x54c15c){var _0x18e491={'raw':!![],'where':{'id':_0x5e916c[_0x79b6('0x46')]['id']}},_0x173512={};_0x173512[_0x79b6('0x30')]=_['keys'](db['Pause'][_0x79b6('0x47')]);_0x173512[_0x79b6('0x32')]=_['keys'](_0x5e916c[_0x79b6('0x32')]);_0x173512[_0x79b6('0x3a')]=_[_0x79b6('0x34')](_0x173512[_0x79b6('0x30')],_0x173512['query']);_0x18e491[_0x79b6('0x35')]=_[_0x79b6('0x34')](_0x173512['model'],qs[_0x79b6('0x48')](_0x5e916c['query'][_0x79b6('0x48')]));_0x18e491[_0x79b6('0x35')]=_0x18e491[_0x79b6('0x35')][_0x79b6('0x36')]?_0x18e491[_0x79b6('0x35')]:_0x173512[_0x79b6('0x30')];if(_0x5e916c[_0x79b6('0x32')][_0x79b6('0x41')]){_0x18e491[_0x79b6('0x42')]=[{'all':!![]}];}_0x18e491=_[_0x79b6('0x3c')]({},_0x18e491,_0x5e916c[_0x79b6('0x3f')]);return db[_0x79b6('0x2d')][_0x79b6('0x49')](_0x18e491)[_0x79b6('0x26')](handleEntityNotFound(_0x54c15c,null))[_0x79b6('0x26')](respondWithResult(_0x54c15c,null))[_0x79b6('0x4a')](handleError(_0x54c15c,null));};exports[_0x79b6('0x4b')]=function(_0x48ba5a,_0x4e17f3){return db['Pause'][_0x79b6('0x4b')](_0x48ba5a[_0x79b6('0x4c')],{})[_0x79b6('0x26')](function(_0xc5c9f2){var _0x23129b=_0x48ba5a['user']['get']({'plain':!![]});if(!_0x23129b)throw new Error(_0x79b6('0x4d'));if(_0x23129b[_0x79b6('0x4e')]===_0x79b6('0x4f')){var _0x1119ce=_0xc5c9f2[_0x79b6('0x28')]({'plain':!![]});var _0xf38118=_0x79b6('0x29');return db[_0x79b6('0x50')][_0x79b6('0x49')]({'where':{'name':_0xf38118,'userProfileId':_0x23129b[_0x79b6('0x51')]},'raw':!![]})[_0x79b6('0x26')](function(_0x55b15e){if(_0x55b15e&&_0x55b15e[_0x79b6('0x52')]===0x0){return db[_0x79b6('0x2a')][_0x79b6('0x4b')]({'name':_0x1119ce[_0x79b6('0x2b')],'resourceId':_0x1119ce['id'],'type':_0x55b15e[_0x79b6('0x2b')],'sectionId':_0x55b15e['id']},{})[_0x79b6('0x26')](function(){return _0xc5c9f2;});}else{return _0xc5c9f2;}})[_0x79b6('0x4a')](function(_0x11b085){logger[_0x79b6('0x53')](_0x79b6('0x54'),_0x11b085);throw _0x11b085;});}return _0xc5c9f2;})['then'](respondWithResult(_0x4e17f3,0xc9))[_0x79b6('0x4a')](handleError(_0x4e17f3,null));};exports[_0x79b6('0x25')]=function(_0x2f27ea,_0x532d20){if(_0x2f27ea[_0x79b6('0x4c')]['id']){delete _0x2f27ea['body']['id'];}return db['Pause'][_0x79b6('0x49')]({'where':{'id':_0x2f27ea[_0x79b6('0x46')]['id']}})[_0x79b6('0x26')](handleEntityNotFound(_0x532d20,null))[_0x79b6('0x26')](saveUpdates(_0x2f27ea[_0x79b6('0x4c')],null))['then'](respondWithResult(_0x532d20,null))[_0x79b6('0x4a')](handleError(_0x532d20,null));};exports[_0x79b6('0x27')]=function(_0xbe5c6a,_0x16392a){return db[_0x79b6('0x2d')][_0x79b6('0x49')]({'where':{'id':_0xbe5c6a[_0x79b6('0x46')]['id']}})[_0x79b6('0x26')](handleEntityNotFound(_0x16392a,null))[_0x79b6('0x26')](removeEntity(_0x16392a,null))['catch'](handleError(_0x16392a,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index dafbe5b..8251c4f 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 _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x4579e3,_0x457476){var _0x470ac0=function(_0xdd0392){while(--_0xdd0392){_0x4579e3['push'](_0x4579e3['shift']());}};_0x470ac0(++_0x457476);}(_0xf494,0x1c6));var _0x4f49=function(_0x2fbd8e,_0x2464fd){_0x2fbd8e=_0x2fbd8e-0x0;var _0x1995a2=_0xf494[_0x2fbd8e];return _0x1995a2;};'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')]('Pause',attributes,{'tableName':'tools_pauses','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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x1d6b55,_0x43ab65){_0x1d6b55=_0x1d6b55-0x0;var _0x1751f9=_0x7fbe[_0x1d6b55];return _0x1751f9;};'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 c5b8537..ebe3ff3 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(_0x480499,_0xa738a2){var _0x3dc16e=function(_0x51b290){while(--_0x51b290){_0x480499['push'](_0x480499['shift']());}};_0x3dc16e(++_0xa738a2);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e24d7,_0x11218f){_0x5e24d7=_0x5e24d7-0x0;var _0x10063d=_0xb10b[_0x5e24d7];return _0x10063d;};'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 _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x176ff1,_0x1b19fc){var _0x2e78cb=function(_0x5b37da){while(--_0x5b37da){_0x176ff1['push'](_0x176ff1['shift']());}};_0x2e78cb(++_0x1b19fc);}(_0x7a54,0x106));var _0x47a5=function(_0x589299,_0x593507){_0x589299=_0x589299-0x0;var _0x2cb020=_0x7a54[_0x589299];return _0x2cb020;};'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')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d80f6fb..1384af1 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 _0x17ba=['single','upload','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','download','diskStorage','join','server/files/plugins','originalname','replace','format','basename','extname','post'];(function(_0x1ba49a,_0x2b59bd){var _0x42361d=function(_0x2a00a3){while(--_0x2a00a3){_0x1ba49a['push'](_0x1ba49a['shift']());}};_0x42361d(++_0x2b59bd);}(_0x17ba,0xab));var _0xa17b=function(_0x318cb1,_0x57a0f1){_0x318cb1=_0x318cb1-0x0;var _0x209237=_0x17ba[_0x318cb1];return _0x209237;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router[_0xa17b('0xa')]('/:id/download',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);var upload=multer({'storage':multer[_0xa17b('0x12')]({'destination':function(_0x1e799a,_0x140943,_0x4382df){_0x4382df(null,path[_0xa17b('0x13')](config['root'],_0xa17b('0x14')));},'filename':function(_0x3e92e4,_0x3c3a8a,_0x52b7aa){_0x3c3a8a[_0xa17b('0x15')]=_0x3c3a8a[_0xa17b('0x15')][_0xa17b('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52b7aa(null,util[_0xa17b('0x17')]('%s-%s%s',path[_0xa17b('0x18')](_0x3c3a8a['originalname'],path[_0xa17b('0x19')](_0x3c3a8a[_0xa17b('0x15')])),Date['now'](),path[_0xa17b('0x19')](_0x3c3a8a[_0xa17b('0x15')])));}})});router[_0xa17b('0x1a')]('/',upload[_0xa17b('0x1b')]('file'),controller[_0xa17b('0x1c')]);router['post']('/webhook',controller['webhookPost']);router[_0xa17b('0x1d')](_0xa17b('0xf'),auth['isAuthenticated'](),controller[_0xa17b('0x1e')]);router[_0xa17b('0x1f')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x1f')]);module[_0xa17b('0x20')]=router; \ No newline at end of file +var _0x17ba=['single','upload','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','download','diskStorage','join','server/files/plugins','originalname','replace','format','basename','extname','post'];(function(_0xb918ef,_0x24c81f){var _0xc0aa4d=function(_0x9f9aa2){while(--_0x9f9aa2){_0xb918ef['push'](_0xb918ef['shift']());}};_0xc0aa4d(++_0x24c81f);}(_0x17ba,0xab));var _0xa17b=function(_0x1f9e86,_0x2de7cc){_0x1f9e86=_0x1f9e86-0x0;var _0x5183b1=_0x17ba[_0x1f9e86];return _0x5183b1;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router[_0xa17b('0xa')]('/:id/download',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);var upload=multer({'storage':multer[_0xa17b('0x12')]({'destination':function(_0x1e799a,_0x140943,_0x4382df){_0x4382df(null,path[_0xa17b('0x13')](config['root'],_0xa17b('0x14')));},'filename':function(_0x3e92e4,_0x3c3a8a,_0x52b7aa){_0x3c3a8a[_0xa17b('0x15')]=_0x3c3a8a[_0xa17b('0x15')][_0xa17b('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52b7aa(null,util[_0xa17b('0x17')]('%s-%s%s',path[_0xa17b('0x18')](_0x3c3a8a['originalname'],path[_0xa17b('0x19')](_0x3c3a8a[_0xa17b('0x15')])),Date['now'](),path[_0xa17b('0x19')](_0x3c3a8a[_0xa17b('0x15')])));}})});router[_0xa17b('0x1a')]('/',upload[_0xa17b('0x1b')]('file'),controller[_0xa17b('0x1c')]);router['post']('/webhook',controller['webhookPost']);router[_0xa17b('0x1d')](_0xa17b('0xf'),auth['isAuthenticated'](),controller[_0xa17b('0x1e')]);router[_0xa17b('0x1f')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x1f')]);module[_0xa17b('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index fc02d76..2198dc2 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 _0xe853=['html','script','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xe853,0xd5));var _0x3e85=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe853[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x3e85('0x0'));module[_0x3e85('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3e85('0x2')](_0x3e85('0x3'),_0x3e85('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x3e85('0x5')],'comment':_0x3e85('0x6')},'active':{'type':Sequelize[_0x3e85('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x3e85('0x2')](_0x3e85('0x8'),_0x3e85('0x9'),_0x3e85('0xa'),'never'),'defaultValue':_0x3e85('0xa'),'comment':_0x3e85('0xb')},'icon':{'type':Sequelize[_0x3e85('0x5')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x3e85('0x5')]},'scriptName':{'type':Sequelize[_0x3e85('0x5')]},'scriptPath':{'type':Sequelize[_0x3e85('0x5')]}}; \ No newline at end of file +var _0x5824=['ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x5a0ef5,_0x565082){var _0x2b2487=function(_0x3198ef){while(--_0x3198ef){_0x5a0ef5['push'](_0x5a0ef5['shift']());}};_0x2b2487(++_0x565082);}(_0x5824,0x14e));var _0x4582=function(_0x2b3ac4,_0x618103){_0x2b3ac4=_0x2b3ac4-0x0;var _0x76e80c=_0x5824[_0x2b3ac4];return _0x76e80c;};'use strict';var Sequelize=require(_0x4582('0x0'));module[_0x4582('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4582('0x2')](_0x4582('0x3'),_0x4582('0x4'))},'description':{'type':Sequelize[_0x4582('0x5')]},'version':{'type':Sequelize[_0x4582('0x5')]},'path':{'type':Sequelize[_0x4582('0x6')],'comment':_0x4582('0x7')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4582('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x4582('0x9'),_0x4582('0xa'),_0x4582('0xb'),_0x4582('0xc')),'defaultValue':_0x4582('0xb'),'comment':_0x4582('0xd')},'icon':{'type':Sequelize[_0x4582('0x6')]},'adminUrl':{'type':Sequelize[_0x4582('0x6')]},'agentUrl':{'type':Sequelize[_0x4582('0x6')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x4582('0x6')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index dce8fa3..0ebe8dd 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 _0xc0e0=['fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','download','path','join','root','server/files/plugins','format','%s.zip','zip','warning','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readdirSync','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','parameters','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon-apps','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','scriptPath','body','role','userProfileId','user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','port','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','%s%s','set','send','eml-format','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','rimraf','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','register','sendStatus','status','end','json','limit','undefined','offset','count','apply','reject','save','then','destroy','get','Plugins','stack','name','index','map','Plugin','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes'];(function(_0x3b0a16,_0x199d72){var _0x5a7ced=function(_0x54343d){while(--_0x54343d){_0x3b0a16['push'](_0x3b0a16['shift']());}};_0x5a7ced(++_0x199d72);}(_0xc0e0,0x73));var _0x0c0e=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xc0e0[_0x23e7c1];return _0x1add43;};'use strict';var emlformat=require(_0x0c0e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c0e('0x1'));var jsonpatch=require(_0x0c0e('0x2'));var rp=require(_0x0c0e('0x3'));var moment=require(_0x0c0e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0c0e('0x5'));var csv=require(_0x0c0e('0x6'));var ejs=require(_0x0c0e('0x7'));var fs=require('fs');var fs_extra=require(_0x0c0e('0x8'));var _=require(_0x0c0e('0x9'));var squel=require(_0x0c0e('0xa'));var crypto=require(_0x0c0e('0xb'));var jsforce=require(_0x0c0e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0c0e('0xd'));var Papa=require(_0x0c0e('0xe'));var extract=require('extract-zip');var rimraf=require(_0x0c0e('0xf'));var archiver=require('archiver');var Redis=require(_0x0c0e('0x10'));var authService=require(_0x0c0e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0c0e('0x12'));var hardwareService=require(_0x0c0e('0x13'));var logger=require(_0x0c0e('0x14'))(_0x0c0e('0x15'));var utils=require(_0x0c0e('0x16'));var config=require(_0x0c0e('0x17'));var licenseUtil=require(_0x0c0e('0x18'));var db=require(_0x0c0e('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0c0e('0x1a'))(new Redis(config[_0x0c0e('0x1b')]));require('./plugin.socket')[_0x0c0e('0x1c')](socket);function respondWithStatusCode(_0x32a7e7,_0x907bc0){_0x907bc0=_0x907bc0||0xcc;return function(_0x50d715){if(_0x50d715){return _0x32a7e7[_0x0c0e('0x1d')](_0x907bc0);}return _0x32a7e7[_0x0c0e('0x1e')](_0x907bc0)[_0x0c0e('0x1f')]();};}function respondWithResult(_0x1d7d0f,_0x367470){_0x367470=_0x367470||0xc8;return function(_0x1f9544){if(_0x1f9544){return _0x1d7d0f[_0x0c0e('0x1e')](_0x367470)[_0x0c0e('0x20')](_0x1f9544);}};}function respondWithFilteredResult(_0x30959d,_0x1271c9){return function(_0x2b0f9a){if(_0x2b0f9a){var _0x59c57c=typeof _0x1271c9['offset']==='undefined'&&typeof _0x1271c9[_0x0c0e('0x21')]===_0x0c0e('0x22');var _0x435555=_0x2b0f9a['count'];var _0x5777cd=_0x59c57c?0x0:_0x1271c9[_0x0c0e('0x23')];var _0x2a2c6e=_0x59c57c?_0x2b0f9a[_0x0c0e('0x24')]:_0x1271c9[_0x0c0e('0x23')]+_0x1271c9[_0x0c0e('0x21')];var _0x4f3279;if(_0x2a2c6e>=_0x435555){_0x2a2c6e=_0x435555;_0x4f3279=0xc8;}else{_0x4f3279=0xce;}_0x30959d[_0x0c0e('0x1e')](_0x4f3279);return _0x30959d['set']('Content-Range',_0x5777cd+'-'+_0x2a2c6e+'/'+_0x435555)['json'](_0x2b0f9a);}return null;};}function patchUpdates(_0x4f7d32){return function(_0x158563){try{jsonpatch[_0x0c0e('0x25')](_0x158563,_0x4f7d32,!![]);}catch(_0x54458e){return BPromise[_0x0c0e('0x26')](_0x54458e);}return _0x158563[_0x0c0e('0x27')]();};}function saveUpdates(_0x173dc3,_0x18aa19){return function(_0x1721ed){if(_0x1721ed){return _0x1721ed['update'](_0x173dc3)[_0x0c0e('0x28')](function(_0x2a8a1f){return _0x2a8a1f;});}return null;};}function removeEntity(_0xc6ad35,_0x58ddc3){return function(_0x45f0bb){if(_0x45f0bb){return _0x45f0bb[_0x0c0e('0x29')]()[_0x0c0e('0x28')](function(){var _0x5ef698=_0x45f0bb[_0x0c0e('0x2a')]({'plain':!![]});var _0x9e2023=_0x0c0e('0x2b');return db['UserProfileResource'][_0x0c0e('0x29')]({'where':{'type':_0x9e2023,'resourceId':_0x5ef698['id']}})[_0x0c0e('0x28')](function(){return _0x45f0bb;});})[_0x0c0e('0x28')](function(){_0xc6ad35[_0x0c0e('0x1e')](0xcc)[_0x0c0e('0x1f')]();});}};}function handleEntityNotFound(_0x1073f3,_0x5ce413){return function(_0x6b7351){if(!_0x6b7351){_0x1073f3['sendStatus'](0x194);}return _0x6b7351;};}function handleError(_0x3c8933,_0x152306){_0x152306=_0x152306||0x1f4;return function(_0x4eb70a){logger['error'](_0x4eb70a[_0x0c0e('0x2c')]);if(_0x4eb70a[_0x0c0e('0x2d')]){delete _0x4eb70a[_0x0c0e('0x2d')];}_0x3c8933['status'](_0x152306)['send'](_0x4eb70a);};}exports[_0x0c0e('0x2e')]=function(_0x4ecb03,_0x2d7f57){var _0x1aa3dd={},_0x1f8cb5={},_0x54bb1d={'count':0x0,'rows':[]};var _0x101d4e=_[_0x0c0e('0x2f')](db[_0x0c0e('0x30')][_0x0c0e('0x31')],function(_0x1fe4fc){return{'name':_0x1fe4fc[_0x0c0e('0x32')],'type':_0x1fe4fc['type'][_0x0c0e('0x33')]};});_0x1f8cb5['model']=_['map'](_0x101d4e,'name');_0x1f8cb5[_0x0c0e('0x34')]=_[_0x0c0e('0x35')](_0x4ecb03[_0x0c0e('0x34')]);_0x1f8cb5[_0x0c0e('0x36')]=_[_0x0c0e('0x37')](_0x1f8cb5['model'],_0x1f8cb5[_0x0c0e('0x34')]);_0x1aa3dd[_0x0c0e('0x38')]=_['intersection'](_0x1f8cb5['model'],qs[_0x0c0e('0x39')](_0x4ecb03[_0x0c0e('0x34')][_0x0c0e('0x39')]));_0x1aa3dd[_0x0c0e('0x38')]=_0x1aa3dd[_0x0c0e('0x38')][_0x0c0e('0x3a')]?_0x1aa3dd['attributes']:_0x1f8cb5[_0x0c0e('0x3b')];if(!_0x4ecb03[_0x0c0e('0x34')][_0x0c0e('0x3c')](_0x0c0e('0x3d'))){_0x1aa3dd[_0x0c0e('0x21')]=qs[_0x0c0e('0x21')](_0x4ecb03[_0x0c0e('0x34')]['limit']);_0x1aa3dd[_0x0c0e('0x23')]=qs['offset'](_0x4ecb03['query'][_0x0c0e('0x23')]);}_0x1aa3dd[_0x0c0e('0x3e')]=qs[_0x0c0e('0x3f')](_0x4ecb03[_0x0c0e('0x34')]['sort']);_0x1aa3dd[_0x0c0e('0x40')]=qs[_0x0c0e('0x36')](_[_0x0c0e('0x41')](_0x4ecb03[_0x0c0e('0x34')],_0x1f8cb5['filters']),_0x101d4e);if(_0x4ecb03['query'][_0x0c0e('0x42')]){_0x1aa3dd[_0x0c0e('0x40')]=_[_0x0c0e('0x43')](_0x1aa3dd[_0x0c0e('0x40')],{'$or':_[_0x0c0e('0x2f')](_0x101d4e,function(_0x101e1c){if(_0x101e1c[_0x0c0e('0x44')]!==_0x0c0e('0x45')){var _0x185138={};_0x185138[_0x101e1c[_0x0c0e('0x2d')]]={'$like':'%'+_0x4ecb03['query'][_0x0c0e('0x42')]+'%'};return _0x185138;}})});}_0x1aa3dd=_[_0x0c0e('0x43')]({},_0x1aa3dd,_0x4ecb03[_0x0c0e('0x46')]);var _0x270f69={'where':_0x1aa3dd[_0x0c0e('0x40')]};return db[_0x0c0e('0x30')][_0x0c0e('0x24')](_0x270f69)['then'](function(_0x3757a5){_0x54bb1d[_0x0c0e('0x24')]=_0x3757a5;if(_0x4ecb03[_0x0c0e('0x34')][_0x0c0e('0x47')]){_0x1aa3dd[_0x0c0e('0x48')]=[{'all':!![]}];}return db[_0x0c0e('0x30')][_0x0c0e('0x49')](_0x1aa3dd);})[_0x0c0e('0x28')](function(_0x364396){_0x54bb1d[_0x0c0e('0x4a')]=_0x364396;return _0x54bb1d;})['then'](respondWithFilteredResult(_0x2d7f57,_0x1aa3dd))['catch'](handleError(_0x2d7f57,null));};exports[_0x0c0e('0x4b')]=function(_0x25fd93,_0x2b394d){var _0x1e9596={'raw':!![],'where':{'id':_0x25fd93[_0x0c0e('0x4c')]['id']}},_0x448584={};_0x448584[_0x0c0e('0x3b')]=_[_0x0c0e('0x35')](db[_0x0c0e('0x30')]['rawAttributes']);_0x448584[_0x0c0e('0x34')]=_[_0x0c0e('0x35')](_0x25fd93[_0x0c0e('0x34')]);_0x448584['filters']=_[_0x0c0e('0x37')](_0x448584[_0x0c0e('0x3b')],_0x448584[_0x0c0e('0x34')]);_0x1e9596[_0x0c0e('0x38')]=_[_0x0c0e('0x37')](_0x448584['model'],qs[_0x0c0e('0x39')](_0x25fd93['query'][_0x0c0e('0x39')]));_0x1e9596['attributes']=_0x1e9596[_0x0c0e('0x38')][_0x0c0e('0x3a')]?_0x1e9596['attributes']:_0x448584[_0x0c0e('0x3b')];if(_0x25fd93[_0x0c0e('0x34')][_0x0c0e('0x47')]){_0x1e9596[_0x0c0e('0x48')]=[{'all':!![]}];}_0x1e9596=_[_0x0c0e('0x43')]({},_0x1e9596,_0x25fd93[_0x0c0e('0x46')]);return db[_0x0c0e('0x30')][_0x0c0e('0x4d')](_0x1e9596)['then'](handleEntityNotFound(_0x2b394d,null))[_0x0c0e('0x28')](respondWithResult(_0x2b394d,null))[_0x0c0e('0x4e')](handleError(_0x2b394d,null));};exports[_0x0c0e('0x4f')]=function(_0x44a4a1,_0x48bcd3,_0x83fc5){return db['Plugin'][_0x0c0e('0x4d')]({'where':{'id':_0x44a4a1[_0x0c0e('0x4c')]['id']},'attributes':[_0x0c0e('0x2d'),_0x0c0e('0x50')],'raw':!![]})[_0x0c0e('0x28')](handleEntityNotFound(_0x48bcd3,null))[_0x0c0e('0x28')](function(_0x3a32a0){if(_0x3a32a0){var _0xbc89b5=path[_0x0c0e('0x51')](config[_0x0c0e('0x52')],_0x0c0e('0x53'),util[_0x0c0e('0x54')](_0x0c0e('0x55'),path['basename'](_0x3a32a0[_0x0c0e('0x50')])));var _0x3b0008=fs['createWriteStream'](_0xbc89b5);var _0x5d9a36=archiver(_0x0c0e('0x56'),{'zlib':{'level':0x9}});_0x5d9a36['on'](_0x0c0e('0x57'),function(_0x11bd28){if(_0x11bd28[_0x0c0e('0x58')]===_0x0c0e('0x59')){logger[_0x0c0e('0x5a')](_0x11bd28);}else{throw new db[(_0x0c0e('0x5b'))][(_0x0c0e('0x5c'))](_0x0c0e('0x5d'));}});_0x5d9a36['on'](_0x0c0e('0x5a'),function(_0x5b0559){throw new db[(_0x0c0e('0x5b'))][(_0x0c0e('0x5c'))](_0x0c0e('0x5d'));});_0x5d9a36[_0x0c0e('0x5e')](_0x3b0008);_0x5d9a36[_0x0c0e('0x5f')](_0x0c0e('0x60'),{'cwd':path['join'](config[_0x0c0e('0x52')],_0x0c0e('0x53'),path[_0x0c0e('0x61')](_0x3a32a0[_0x0c0e('0x50')])),'ignore':[path[_0x0c0e('0x51')](path[_0x0c0e('0x62')](_0x3a32a0[_0x0c0e('0x50')]),_0x0c0e('0x63')),path['join'](path[_0x0c0e('0x62')](_0x3a32a0[_0x0c0e('0x50')]),_0x0c0e('0x64'))],'nodir':!![]})[_0x0c0e('0x65')]();_0x3b0008['on'](_0x0c0e('0x66'),function(){if(!fs[_0x0c0e('0x67')](_0xbc89b5)){throw new db[(_0x0c0e('0x5b'))]['Error']('Plugin\x20not\x20found');}return _0x48bcd3['download'](_0xbc89b5,util[_0x0c0e('0x54')](_0x0c0e('0x55'),path[_0x0c0e('0x62')](_0x3a32a0['path'])),function(_0x4adae4){if(_0x4adae4){throw new db[(_0x0c0e('0x5b'))][(_0x0c0e('0x5c'))](_0x0c0e('0x68'));}fs[_0x0c0e('0x69')](_0xbc89b5);logger[_0x0c0e('0x6a')](_0x0c0e('0x6b'));logger[_0x0c0e('0x6a')](_0x0c0e('0x6c'));});});}return null;})[_0x0c0e('0x4e')](handleError(_0x48bcd3,null));};exports[_0x0c0e('0x6d')]=function(_0x5045f8,_0x4b5858,_0x1bcec4){var _0x51fcbe=path[_0x0c0e('0x62')](_0x5045f8[_0x0c0e('0x6e')][_0x0c0e('0x6f')],path['extname'](_0x5045f8[_0x0c0e('0x6e')][_0x0c0e('0x6f')]));var _0x306e66=path[_0x0c0e('0x51')](config[_0x0c0e('0x52')],_0x0c0e('0x53'),_0x5045f8['file'][_0x0c0e('0x6f')]);var _0x20f841=path[_0x0c0e('0x51')](config[_0x0c0e('0x52')],_0x0c0e('0x53'),_0x51fcbe);logger[_0x0c0e('0x6a')]('Plugin\x20upload\x20filepath:\x20%s',_0x306e66);logger[_0x0c0e('0x6a')](_0x0c0e('0x70'),_0x20f841);try{fs[_0x0c0e('0x71')](_0x306e66,parseInt('0777',0x8));extract(_0x306e66,{'dir':_0x20f841},function(_0xe9de1c){if(_0xe9de1c){logger[_0x0c0e('0x5a')](_0xe9de1c);handleError(_0xe9de1c,!![]);};var _0x554a26=fs['readdirSync'](_0x20f841);if(_0x554a26['length']>0x1){removeReferences(_0x306e66,_0x20f841);logger[_0x0c0e('0x5a')]('Invalid\x20plugin\x20structure');return _0x1bcec4(new Error(_0x0c0e('0x72')));}var _0x32429b=fs[_0x0c0e('0x73')](path[_0x0c0e('0x51')](_0x20f841,_0x554a26[0x0]));if(_0x32429b['isFile']()){removeReferences(_0x306e66,_0x20f841);logger['error'](_0x0c0e('0x72'));return _0x1bcec4(new Error(_0x0c0e('0x72')));}if(_0x32429b[_0x0c0e('0x74')]()){var _0x1b3b45=fs[_0x0c0e('0x75')](path['join'](_0x20f841,_0x554a26[0x0]));if(_0x1b3b45[_0x0c0e('0x3a')]===0x0){removeReferences(_0x306e66,_0x20f841);logger[_0x0c0e('0x5a')](_0x0c0e('0x72'));return _0x1bcec4(new Error('Invalid\x20plugin\x20structure'));}var _0x3d86f3=_0x1b3b45[_0x0c0e('0x76')](function(_0x44c7a3){return _0x44c7a3==='manifest.json';});if(!_0x3d86f3){return _0x1bcec4(new Error(_0x0c0e('0x77')));}var _0x16c3ad=fs['readFileSync'](path[_0x0c0e('0x51')](_0x20f841,_0x554a26[0x0],_0x0c0e('0x78')));var _0xda5241=JSON[_0x0c0e('0x79')](_0x16c3ad);if(_0x0c0e('0x22')==typeof _0xda5241[_0x0c0e('0x2d')]){return _0x1bcec4(new Error(_0x0c0e('0x7a')));}if(_0x0c0e('0x22')==typeof _0xda5241[_0x0c0e('0x44')]){return _0x1bcec4(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x0c0e('0x22')==typeof _0xda5241[_0x0c0e('0x7b')]){return _0x1bcec4(new Error(_0x0c0e('0x7c')));}if(_0x0c0e('0x22')==typeof _0xda5241['parameters']){return _0x1bcec4(new Error(_0x0c0e('0x7d')));}if(_0xda5241[_0x0c0e('0x44')]===_0x0c0e('0x7e')){if(_0x0c0e('0x22')==typeof _0xda5241['parameters'][_0x0c0e('0x7f')]){return _0x1bcec4(new Error(_0x0c0e('0x80')));}if(_0x0c0e('0x22')==typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')]['admin']&&_0x0c0e('0x22')==typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')]['agent']){return _0x1bcec4(new Error(_0x0c0e('0x82')));}}else if(_0xda5241[_0x0c0e('0x44')]===_0x0c0e('0x83')){if(_0x0c0e('0x22')==typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x84')]){return _0x1bcec4(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0xda5241[_0x0c0e('0x81')]['scriptPath']){return _0x1bcec4(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x1bcec4(new Error(_0x0c0e('0x85')));}var _0x26c84d=_0xda5241[_0x0c0e('0x2d')];var _0x4019e3=_0xda5241[_0x0c0e('0x86')];var _0x188ccd=_0xda5241[_0x0c0e('0x44')];var _0x2b421c=_0xda5241['sidebar']?_0xda5241[_0x0c0e('0x87')]:_0x0c0e('0x88');var _0x3be0cf=_0xda5241['icon']?_0xda5241['icon']:_0x0c0e('0x89');var _0x454e9e='';var _0x246f3d='';var _0x28a253='';var _0x8991d9='';var _0xfa2eba=_0xda5241[_0x0c0e('0x7b')];if(_0x188ccd==='html'){if(_0x0c0e('0x22')!=typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')][_0x0c0e('0x8a')]){var _0x221480=_0xda5241['parameters'][_0x0c0e('0x7f')][_0x0c0e('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0x0c0e('0x8b')](_0x221480)){_0x454e9e=path[_0x0c0e('0x51')](_0x0c0e('0x8c'),_0x51fcbe,_0x554a26[0x0],_0x221480);}else{_0x454e9e=_0x221480;}}else{logger[_0x0c0e('0x6a')](_0x0c0e('0x8d'));}if(_0x0c0e('0x22')!=typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')][_0x0c0e('0x8e')]){var _0x232633=_0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')][_0x0c0e('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x0c0e('0x8b')](_0x232633)){_0x246f3d=path['join'](_0x0c0e('0x8c'),_0x51fcbe,_0x554a26[0x0],_0x232633);}else{_0x246f3d=_0x232633;}}else{logger[_0x0c0e('0x6a')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x188ccd===_0x0c0e('0x83')){_0x28a253=_0xda5241[_0x0c0e('0x81')]['scriptName'];_0x8991d9=_0xda5241[_0x0c0e('0x81')][_0x0c0e('0x8f')];if('undefined'!=typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')]){if(_0x0c0e('0x22')!=typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')]['admin']){var _0x221480=_0xda5241[_0x0c0e('0x81')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x0c0e('0x8b')](_0x221480)){_0x454e9e=path[_0x0c0e('0x51')](_0x0c0e('0x8c'),_0x51fcbe,_0x554a26[0x0],_0x221480);}else{_0x454e9e=_0x221480;}}if(_0x0c0e('0x22')!=typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')][_0x0c0e('0x8e')]){var _0x232633=_0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')][_0x0c0e('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x0c0e('0x8b')](_0x232633)){_0x246f3d=path[_0x0c0e('0x51')](_0x0c0e('0x8c'),_0x51fcbe,_0x554a26[0x0],_0x232633);}else{_0x246f3d=_0x232633;}}}}var _0x4a778c={'name':_0x26c84d,'description':_0x4019e3,'path':path[_0x0c0e('0x51')](_0x51fcbe,_0x554a26[0x0]),'type':_0x188ccd,'sidebar':_0x2b421c,'icon':_0x3be0cf,'adminUrl':_0x454e9e,'agentUrl':_0x246f3d,'scriptName':_0x28a253,'scriptPath':_0x8991d9,'version':_0xfa2eba};removeReferences(_0x306e66,null);return db[_0x0c0e('0x30')]['create'](_0x4a778c)[_0x0c0e('0x28')](function(_0x1ff946){var _0x48ee8c={'role':_0x5045f8[_0x0c0e('0x90')][_0x0c0e('0x91')],'userProfileId':_0x5045f8['body'][_0x0c0e('0x92')]};if(!_0x48ee8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48ee8c['role']===_0x0c0e('0x93')){var _0x241cbf=_0x1ff946['get']({'plain':!![]});return db['UserProfileSection'][_0x0c0e('0x4d')]({'where':{'name':'Plugins','userProfileId':_0x48ee8c[_0x0c0e('0x92')]},'raw':!![]})[_0x0c0e('0x28')](function(_0x32680e){if(_0x32680e&&_0x32680e[_0x0c0e('0x94')]===0x0){return db['UserProfileResource'][_0x0c0e('0x95')]({'name':_0x241cbf[_0x0c0e('0x2d')],'resourceId':_0x241cbf['id'],'type':_0x32680e['name'],'sectionId':_0x32680e['id']},{})['then'](function(){return _0x1ff946;});}else{return _0x1ff946;}})[_0x0c0e('0x4e')](function(_0x3b07f4){logger[_0x0c0e('0x5a')](_0x0c0e('0x96'),_0x3b07f4);throw _0x3b07f4;});}return _0x1ff946;})['then'](respondWithResult(_0x4b5858,null))[_0x0c0e('0x4e')](handleError(_0x4b5858,null));}});}catch(_0xbb3e98){_0x4b5858[_0x0c0e('0x1e')](0x1f4)['send'](_0xbb3e98);}};function removeReferences(_0x6a17e,_0x18bf82){try{if(_0x6a17e){fs[_0x0c0e('0x69')](_0x6a17e);logger[_0x0c0e('0x6a')](_0x0c0e('0x97'));}if(_0x18bf82){rimraf(_0x18bf82,function(){});logger[_0x0c0e('0x6a')](_0x0c0e('0x98'));}}catch(_0x152d14){logger[_0x0c0e('0x5a')](_0x152d14);}}exports[_0x0c0e('0x99')]=function(_0x2e2003,_0x18f7a3,_0x2baf54){return db[_0x0c0e('0x30')][_0x0c0e('0x4d')]({'where':{'id':_0x2e2003[_0x0c0e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x18f7a3,null))['then'](saveUpdates(_0x2e2003[_0x0c0e('0x90')],null))[_0x0c0e('0x28')](respondWithResult(_0x18f7a3,null))[_0x0c0e('0x4e')](handleError(_0x18f7a3,null));};exports[_0x0c0e('0x9a')]=function(_0x42bd99,_0x24a34a,_0x2df21d){return db[_0x0c0e('0x30')][_0x0c0e('0x4d')]({'where':{'id':_0x42bd99[_0x0c0e('0x4c')]['id']}})['then'](function(_0x54d330){if(_0x54d330){return _0x54d330[_0x0c0e('0x29')]();}})[_0x0c0e('0x28')](function(_0x5bcd38){rimraf(path[_0x0c0e('0x51')](config['root'],_0x0c0e('0x53'),path[_0x0c0e('0x61')](_0x5bcd38[_0x0c0e('0x50')])),function(){});return _0x5bcd38;})[_0x0c0e('0x28')](handleEntityNotFound(_0x24a34a,null))[_0x0c0e('0x28')](respondWithStatusCode(_0x24a34a,null))[_0x0c0e('0x4e')](handleError(_0x24a34a,null));};exports['webhookGet']=function(_0x4ddab5,_0x48313c,_0x1838ae){return BPromise[_0x0c0e('0x9b')]()[_0x0c0e('0x28')](function(){if(!_0x4ddab5[_0x0c0e('0x34')][_0x0c0e('0x50')]){throw new Error(_0x0c0e('0x9c'));}if(!_0x4ddab5['query']['port']){throw new Error(_0x0c0e('0x9d'));}var _0x3f7722=_0x4ddab5['query']['hostname']?_0x4ddab5['query'][_0x0c0e('0x9e')]+':'+_0x4ddab5[_0x0c0e('0x34')]['port']:_0x0c0e('0x9f')+_0x4ddab5[_0x0c0e('0x34')][_0x0c0e('0xa0')];var _0x16c6ad=_0x4ddab5[_0x0c0e('0x34')][_0x0c0e('0x20')]?_0x4ddab5['query'][_0x0c0e('0x20')]:!![];var _0x437827=_0x4ddab5[_0x0c0e('0x34')][_0x0c0e('0xa1')]?_0x4ddab5[_0x0c0e('0x34')]['encoding']:null;var _0x109a98={'method':_0x4ddab5[_0x0c0e('0xa2')],'uri':util[_0x0c0e('0x54')]('%s%s',_0x3f7722,_0x4ddab5[_0x0c0e('0x34')][_0x0c0e('0x50')]),'json':_0x16c6ad,'resolveWithFullResponse':!![],'encoding':_0x437827,'qs':_0x4ddab5['query']};if(_0x4ddab5[_0x0c0e('0xa3')]){_0x109a98['headers']=_0x4ddab5[_0x0c0e('0xa3')];if(_0x109a98['headers'][_0x0c0e('0xa4')]){delete _0x109a98[_0x0c0e('0xa3')][_0x0c0e('0xa4')];}}if(_0x109a98[_0x0c0e('0xa3')][_0x0c0e('0xa5')]){delete _0x109a98[_0x0c0e('0xa3')]['content-type'];}return rp(_0x109a98);})[_0x0c0e('0x28')](function(_0xec907d){if(_0xec907d){_0x48313c['set'](_0xec907d[_0x0c0e('0xa3')]);logger[_0x0c0e('0x6a')](_0xec907d[_0x0c0e('0x90')]);if(_[_0x0c0e('0xa6')](_0x4ddab5['query'][_0x0c0e('0x50')],_0x0c0e('0x4f'))&&_0xec907d[_0x0c0e('0xa7')]==0x1f4){return _0x48313c[_0x0c0e('0x1d')](_0xec907d[_0x0c0e('0xa7')]);}else{return _0x48313c[_0x0c0e('0x1e')](_0xec907d['statusCode'])['send'](_0xec907d['body']);}}else{return _0x48313c[_0x0c0e('0x1d')](0xc8);}})[_0x0c0e('0x4e')](handleError(_0x48313c,null));};exports[_0x0c0e('0xa8')]=function(_0x49321f,_0x113972,_0x3b4e66){return BPromise[_0x0c0e('0x9b')]()[_0x0c0e('0x28')](function(){if(!_0x49321f[_0x0c0e('0x34')][_0x0c0e('0x50')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x49321f[_0x0c0e('0x34')]['port']){throw new Error(_0x0c0e('0x9d'));}var _0x48b5b6=_0x49321f[_0x0c0e('0x34')][_0x0c0e('0x9e')]?_0x49321f['query'][_0x0c0e('0x9e')]+':'+_0x49321f[_0x0c0e('0x34')][_0x0c0e('0xa0')]:_0x0c0e('0x9f')+_0x49321f[_0x0c0e('0x34')][_0x0c0e('0xa0')];var _0x351c74=_0x49321f[_0x0c0e('0x34')][_0x0c0e('0x20')]?_0x49321f[_0x0c0e('0x34')][_0x0c0e('0x20')]:!![];var _0x289295=_0x49321f['query']['encoding']?_0x49321f[_0x0c0e('0x34')][_0x0c0e('0xa1')]:null;var _0x357bdd={'method':_0x49321f[_0x0c0e('0xa2')],'uri':util[_0x0c0e('0x54')](_0x0c0e('0xa9'),_0x48b5b6,_0x49321f[_0x0c0e('0x34')][_0x0c0e('0x50')]),'json':_0x351c74,'resolveWithFullResponse':!![],'encoding':_0x289295,'body':_0x49321f[_0x0c0e('0x90')]};if(_0x49321f['headers']){_0x357bdd[_0x0c0e('0xa3')]=_0x49321f[_0x0c0e('0xa3')];if(_0x357bdd[_0x0c0e('0xa3')]['content-length']){delete _0x357bdd['headers'][_0x0c0e('0xa4')];}}if(_0x357bdd[_0x0c0e('0xa3')][_0x0c0e('0xa5')]){delete _0x357bdd[_0x0c0e('0xa3')][_0x0c0e('0xa5')];}return rp(_0x357bdd);})[_0x0c0e('0x28')](function(_0x27ddf1){if(_0x27ddf1){_0x113972[_0x0c0e('0xaa')](_0x27ddf1[_0x0c0e('0xa3')]);logger[_0x0c0e('0x6a')](_0x27ddf1[_0x0c0e('0x90')]);return _0x113972[_0x0c0e('0x1e')](_0x27ddf1[_0x0c0e('0xa7')])[_0x0c0e('0xab')](_0x27ddf1[_0x0c0e('0x90')]);}else{return _0x113972[_0x0c0e('0x1d')](0xc8);}})[_0x0c0e('0x4e')](handleError(_0x113972,null));}; \ No newline at end of file +var _0xcf6d=['body','userProfileId','role','UserProfileSection','autoAssociation','send','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','get','Plugins','UserProfileResource','destroy','then','error','stack','name','index','Plugin','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','includeAll','rows','show','params','rawAttributes','length','include','options','find','download','join','root','server/files/plugins','format','basename','createWriteStream','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','catch','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create'];(function(_0x4c6013,_0x4cfe1c){var _0x583199=function(_0x18533d){while(--_0x18533d){_0x4c6013['push'](_0x4c6013['shift']());}};_0x583199(++_0x4cfe1c);}(_0xcf6d,0xc3));var _0xdcf6=function(_0x3fd3b6,_0x5c484c){_0x3fd3b6=_0x3fd3b6-0x0;var _0xad9404=_0xcf6d[_0x3fd3b6];return _0xad9404;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdcf6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdcf6('0x1'));var moment=require(_0xdcf6('0x2'));var BPromise=require(_0xdcf6('0x3'));var Mustache=require(_0xdcf6('0x4'));var util=require('util');var path=require(_0xdcf6('0x5'));var sox=require(_0xdcf6('0x6'));var csv=require(_0xdcf6('0x7'));var ejs=require(_0xdcf6('0x8'));var fs=require('fs');var fs_extra=require(_0xdcf6('0x9'));var _=require('lodash');var squel=require(_0xdcf6('0xa'));var crypto=require(_0xdcf6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdcf6('0xc'));var toCsv=require('to-csv');var querystring=require(_0xdcf6('0xd'));var Papa=require('papaparse');var extract=require(_0xdcf6('0xe'));var rimraf=require(_0xdcf6('0x0'));var archiver=require(_0xdcf6('0xf'));var Redis=require(_0xdcf6('0x10'));var authService=require(_0xdcf6('0x11'));var qs=require(_0xdcf6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdcf6('0x13'));var logger=require(_0xdcf6('0x14'))(_0xdcf6('0x15'));var utils=require(_0xdcf6('0x16'));var config=require(_0xdcf6('0x17'));var licenseUtil=require(_0xdcf6('0x18'));var db=require(_0xdcf6('0x19'))['db'];config[_0xdcf6('0x1a')]=_[_0xdcf6('0x1b')](config['redis'],{'host':_0xdcf6('0x1c'),'port':0x18eb});var socket=require(_0xdcf6('0x1d'))(new Redis(config[_0xdcf6('0x1a')]));require(_0xdcf6('0x1e'))[_0xdcf6('0x1f')](socket);function respondWithStatusCode(_0x3ce296,_0x15c1dc){_0x15c1dc=_0x15c1dc||0xcc;return function(_0xa428c){if(_0xa428c){return _0x3ce296[_0xdcf6('0x20')](_0x15c1dc);}return _0x3ce296[_0xdcf6('0x21')](_0x15c1dc)[_0xdcf6('0x22')]();};}function respondWithResult(_0x18b469,_0x23fd44){_0x23fd44=_0x23fd44||0xc8;return function(_0x5bd21d){if(_0x5bd21d){return _0x18b469[_0xdcf6('0x21')](_0x23fd44)['json'](_0x5bd21d);}};}function respondWithFilteredResult(_0x5f3ba6,_0x53b1ac){return function(_0x18a4ab){if(_0x18a4ab){var _0x29e99b=typeof _0x53b1ac[_0xdcf6('0x23')]===_0xdcf6('0x24')&&typeof _0x53b1ac[_0xdcf6('0x25')]===_0xdcf6('0x24');var _0x3219d4=_0x18a4ab[_0xdcf6('0x26')];var _0x52ead3=_0x29e99b?0x0:_0x53b1ac['offset'];var _0x11937b=_0x29e99b?_0x18a4ab[_0xdcf6('0x26')]:_0x53b1ac[_0xdcf6('0x23')]+_0x53b1ac[_0xdcf6('0x25')];var _0x492b74;if(_0x11937b>=_0x3219d4){_0x11937b=_0x3219d4;_0x492b74=0xc8;}else{_0x492b74=0xce;}_0x5f3ba6[_0xdcf6('0x21')](_0x492b74);return _0x5f3ba6[_0xdcf6('0x27')](_0xdcf6('0x28'),_0x52ead3+'-'+_0x11937b+'/'+_0x3219d4)[_0xdcf6('0x29')](_0x18a4ab);}return null;};}function patchUpdates(_0x1df969){return function(_0xb74238){try{jsonpatch[_0xdcf6('0x2a')](_0xb74238,_0x1df969,!![]);}catch(_0x5c9fe3){return BPromise[_0xdcf6('0x2b')](_0x5c9fe3);}return _0xb74238[_0xdcf6('0x2c')]();};}function saveUpdates(_0x5ec4b4,_0xd10a6a){return function(_0x32bcc9){if(_0x32bcc9){return _0x32bcc9[_0xdcf6('0x2d')](_0x5ec4b4)['then'](function(_0x56527f){return _0x56527f;});}return null;};}function removeEntity(_0x3b2bc2,_0x179090){return function(_0x33136c){if(_0x33136c){return _0x33136c['destroy']()['then'](function(){var _0x4d58e3=_0x33136c[_0xdcf6('0x2e')]({'plain':!![]});var _0x50bec7=_0xdcf6('0x2f');return db[_0xdcf6('0x30')][_0xdcf6('0x31')]({'where':{'type':_0x50bec7,'resourceId':_0x4d58e3['id']}})[_0xdcf6('0x32')](function(){return _0x33136c;});})['then'](function(){_0x3b2bc2[_0xdcf6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3316e7,_0x1cdbd6){return function(_0x1825b1){if(!_0x1825b1){_0x3316e7[_0xdcf6('0x20')](0x194);}return _0x1825b1;};}function handleError(_0x1b1cc2,_0x212f66){_0x212f66=_0x212f66||0x1f4;return function(_0x1c9c32){logger[_0xdcf6('0x33')](_0x1c9c32[_0xdcf6('0x34')]);if(_0x1c9c32[_0xdcf6('0x35')]){delete _0x1c9c32[_0xdcf6('0x35')];}_0x1b1cc2['status'](_0x212f66)['send'](_0x1c9c32);};}exports[_0xdcf6('0x36')]=function(_0x253dcc,_0x58eea6){var _0x561c2f={},_0x2cf80b={},_0x1daff4={'count':0x0,'rows':[]};var _0x192db9=_['map'](db[_0xdcf6('0x37')]['rawAttributes'],function(_0x35110b){return{'name':_0x35110b[_0xdcf6('0x38')],'type':_0x35110b[_0xdcf6('0x39')][_0xdcf6('0x3a')]};});_0x2cf80b[_0xdcf6('0x3b')]=_[_0xdcf6('0x3c')](_0x192db9,_0xdcf6('0x35'));_0x2cf80b[_0xdcf6('0x3d')]=_[_0xdcf6('0x3e')](_0x253dcc[_0xdcf6('0x3d')]);_0x2cf80b[_0xdcf6('0x3f')]=_[_0xdcf6('0x40')](_0x2cf80b['model'],_0x2cf80b[_0xdcf6('0x3d')]);_0x561c2f[_0xdcf6('0x41')]=_[_0xdcf6('0x40')](_0x2cf80b[_0xdcf6('0x3b')],qs[_0xdcf6('0x42')](_0x253dcc[_0xdcf6('0x3d')]['fields']));_0x561c2f[_0xdcf6('0x41')]=_0x561c2f[_0xdcf6('0x41')]['length']?_0x561c2f[_0xdcf6('0x41')]:_0x2cf80b[_0xdcf6('0x3b')];if(!_0x253dcc[_0xdcf6('0x3d')]['hasOwnProperty']('nolimit')){_0x561c2f[_0xdcf6('0x25')]=qs['limit'](_0x253dcc[_0xdcf6('0x3d')][_0xdcf6('0x25')]);_0x561c2f[_0xdcf6('0x23')]=qs[_0xdcf6('0x23')](_0x253dcc[_0xdcf6('0x3d')][_0xdcf6('0x23')]);}_0x561c2f[_0xdcf6('0x43')]=qs[_0xdcf6('0x44')](_0x253dcc[_0xdcf6('0x3d')]['sort']);_0x561c2f[_0xdcf6('0x45')]=qs[_0xdcf6('0x3f')](_[_0xdcf6('0x46')](_0x253dcc['query'],_0x2cf80b['filters']),_0x192db9);if(_0x253dcc[_0xdcf6('0x3d')][_0xdcf6('0x47')]){_0x561c2f[_0xdcf6('0x45')]=_[_0xdcf6('0x48')](_0x561c2f[_0xdcf6('0x45')],{'$or':_[_0xdcf6('0x3c')](_0x192db9,function(_0x3e32ac){if(_0x3e32ac[_0xdcf6('0x39')]!=='VIRTUAL'){var _0x274372={};_0x274372[_0x3e32ac['name']]={'$like':'%'+_0x253dcc[_0xdcf6('0x3d')][_0xdcf6('0x47')]+'%'};return _0x274372;}})});}_0x561c2f=_[_0xdcf6('0x48')]({},_0x561c2f,_0x253dcc['options']);var _0x425e27={'where':_0x561c2f[_0xdcf6('0x45')]};return db['Plugin'][_0xdcf6('0x26')](_0x425e27)['then'](function(_0x4762be){_0x1daff4[_0xdcf6('0x26')]=_0x4762be;if(_0x253dcc[_0xdcf6('0x3d')][_0xdcf6('0x49')]){_0x561c2f['include']=[{'all':!![]}];}return db['Plugin']['findAll'](_0x561c2f);})[_0xdcf6('0x32')](function(_0x4b9319){_0x1daff4[_0xdcf6('0x4a')]=_0x4b9319;return _0x1daff4;})[_0xdcf6('0x32')](respondWithFilteredResult(_0x58eea6,_0x561c2f))['catch'](handleError(_0x58eea6,null));};exports[_0xdcf6('0x4b')]=function(_0x4a4419,_0x334bcc){var _0x2aaa75={'raw':!![],'where':{'id':_0x4a4419[_0xdcf6('0x4c')]['id']}},_0x491360={};_0x491360[_0xdcf6('0x3b')]=_[_0xdcf6('0x3e')](db[_0xdcf6('0x37')][_0xdcf6('0x4d')]);_0x491360[_0xdcf6('0x3d')]=_[_0xdcf6('0x3e')](_0x4a4419[_0xdcf6('0x3d')]);_0x491360[_0xdcf6('0x3f')]=_[_0xdcf6('0x40')](_0x491360[_0xdcf6('0x3b')],_0x491360[_0xdcf6('0x3d')]);_0x2aaa75[_0xdcf6('0x41')]=_[_0xdcf6('0x40')](_0x491360[_0xdcf6('0x3b')],qs[_0xdcf6('0x42')](_0x4a4419['query']['fields']));_0x2aaa75[_0xdcf6('0x41')]=_0x2aaa75[_0xdcf6('0x41')][_0xdcf6('0x4e')]?_0x2aaa75['attributes']:_0x491360['model'];if(_0x4a4419['query']['includeAll']){_0x2aaa75[_0xdcf6('0x4f')]=[{'all':!![]}];}_0x2aaa75=_[_0xdcf6('0x48')]({},_0x2aaa75,_0x4a4419[_0xdcf6('0x50')]);return db[_0xdcf6('0x37')][_0xdcf6('0x51')](_0x2aaa75)[_0xdcf6('0x32')](handleEntityNotFound(_0x334bcc,null))[_0xdcf6('0x32')](respondWithResult(_0x334bcc,null))['catch'](handleError(_0x334bcc,null));};exports[_0xdcf6('0x52')]=function(_0x1e3d69,_0x38a789,_0x1f30a5){return db['Plugin'][_0xdcf6('0x51')]({'where':{'id':_0x1e3d69[_0xdcf6('0x4c')]['id']},'attributes':[_0xdcf6('0x35'),_0xdcf6('0x5')],'raw':!![]})['then'](handleEntityNotFound(_0x38a789,null))[_0xdcf6('0x32')](function(_0x222e0d){if(_0x222e0d){var _0x262a4b=path[_0xdcf6('0x53')](config[_0xdcf6('0x54')],_0xdcf6('0x55'),util[_0xdcf6('0x56')]('%s.zip',path[_0xdcf6('0x57')](_0x222e0d[_0xdcf6('0x5')])));var _0x5c29e2=fs[_0xdcf6('0x58')](_0x262a4b);var _0x6716d4=archiver('zip',{'zlib':{'level':0x9}});_0x6716d4['on'](_0xdcf6('0x59'),function(_0x5af04f){if(_0x5af04f[_0xdcf6('0x5a')]===_0xdcf6('0x5b')){logger[_0xdcf6('0x33')](_0x5af04f);}else{throw new db['Sequelize'][(_0xdcf6('0x5c'))](_0xdcf6('0x5d'));}});_0x6716d4['on'](_0xdcf6('0x33'),function(_0x5e2917){throw new db[(_0xdcf6('0x5e'))][(_0xdcf6('0x5c'))](_0xdcf6('0x5d'));});_0x6716d4['pipe'](_0x5c29e2);_0x6716d4['glob'](_0xdcf6('0x5f'),{'cwd':path[_0xdcf6('0x53')](config['root'],_0xdcf6('0x55'),path[_0xdcf6('0x60')](_0x222e0d[_0xdcf6('0x5')])),'ignore':[path[_0xdcf6('0x53')](path['basename'](_0x222e0d[_0xdcf6('0x5')]),_0xdcf6('0x61')),path[_0xdcf6('0x53')](path[_0xdcf6('0x57')](_0x222e0d[_0xdcf6('0x5')]),_0xdcf6('0x62'))],'nodir':!![]})[_0xdcf6('0x63')]();_0x5c29e2['on'](_0xdcf6('0x64'),function(){if(!fs[_0xdcf6('0x65')](_0x262a4b)){throw new db[(_0xdcf6('0x5e'))][(_0xdcf6('0x5c'))](_0xdcf6('0x66'));}return _0x38a789[_0xdcf6('0x52')](_0x262a4b,util['format']('%s.zip',path[_0xdcf6('0x57')](_0x222e0d[_0xdcf6('0x5')])),function(_0x1afb00){if(_0x1afb00){throw new db['Sequelize']['Error'](_0xdcf6('0x67'));}fs[_0xdcf6('0x68')](_0x262a4b);logger[_0xdcf6('0x69')](_0xdcf6('0x6a'));logger[_0xdcf6('0x69')](_0xdcf6('0x6b'));});});}return null;})[_0xdcf6('0x6c')](handleError(_0x38a789,null));};exports[_0xdcf6('0x6d')]=function(_0x4c3b93,_0x5c561b,_0x2db184){var _0x1e5055=path[_0xdcf6('0x57')](_0x4c3b93[_0xdcf6('0x6e')][_0xdcf6('0x6f')],path['extname'](_0x4c3b93[_0xdcf6('0x6e')][_0xdcf6('0x6f')]));var _0x5a5d65=path[_0xdcf6('0x53')](config[_0xdcf6('0x54')],_0xdcf6('0x55'),_0x4c3b93[_0xdcf6('0x6e')]['filename']);var _0x157ec0=path[_0xdcf6('0x53')](config[_0xdcf6('0x54')],_0xdcf6('0x55'),_0x1e5055);logger[_0xdcf6('0x69')](_0xdcf6('0x70'),_0x5a5d65);logger[_0xdcf6('0x69')](_0xdcf6('0x71'),_0x157ec0);try{fs[_0xdcf6('0x72')](_0x5a5d65,parseInt(_0xdcf6('0x73'),0x8));extract(_0x5a5d65,{'dir':_0x157ec0},function(_0x5b3960){if(_0x5b3960){logger[_0xdcf6('0x33')](_0x5b3960);handleError(_0x5b3960,!![]);};var _0xe60e37=fs[_0xdcf6('0x74')](_0x157ec0);if(_0xe60e37[_0xdcf6('0x4e')]>0x1){removeReferences(_0x5a5d65,_0x157ec0);logger[_0xdcf6('0x33')](_0xdcf6('0x75'));return _0x2db184(new Error('Invalid\x20plugin\x20structure'));}var _0x415122=fs[_0xdcf6('0x76')](path[_0xdcf6('0x53')](_0x157ec0,_0xe60e37[0x0]));if(_0x415122[_0xdcf6('0x77')]()){removeReferences(_0x5a5d65,_0x157ec0);logger['error']('Invalid\x20plugin\x20structure');return _0x2db184(new Error(_0xdcf6('0x75')));}if(_0x415122[_0xdcf6('0x78')]()){var _0x24266c=fs['readdirSync'](path[_0xdcf6('0x53')](_0x157ec0,_0xe60e37[0x0]));if(_0x24266c['length']===0x0){removeReferences(_0x5a5d65,_0x157ec0);logger[_0xdcf6('0x33')](_0xdcf6('0x75'));return _0x2db184(new Error(_0xdcf6('0x75')));}var _0x37abbf=_0x24266c[_0xdcf6('0x79')](function(_0x557eb8){return _0x557eb8==='manifest.json';});if(!_0x37abbf){return _0x2db184(new Error(_0xdcf6('0x7a')));}var _0x8618d3=fs[_0xdcf6('0x7b')](path[_0xdcf6('0x53')](_0x157ec0,_0xe60e37[0x0],_0xdcf6('0x7c')));var _0x56c5ef=JSON[_0xdcf6('0x7d')](_0x8618d3);if('undefined'==typeof _0x56c5ef[_0xdcf6('0x35')]){return _0x2db184(new Error(_0xdcf6('0x7e')));}if(_0xdcf6('0x24')==typeof _0x56c5ef[_0xdcf6('0x39')]){return _0x2db184(new Error(_0xdcf6('0x7f')));}if(_0xdcf6('0x24')==typeof _0x56c5ef[_0xdcf6('0x80')]){return _0x2db184(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xdcf6('0x24')==typeof _0x56c5ef[_0xdcf6('0x81')]){return _0x2db184(new Error(_0xdcf6('0x82')));}if(_0x56c5ef['type']===_0xdcf6('0x83')){if(_0xdcf6('0x24')==typeof _0x56c5ef[_0xdcf6('0x81')][_0xdcf6('0x84')]){return _0x2db184(new Error(_0xdcf6('0x85')));}if(_0xdcf6('0x24')==typeof _0x56c5ef[_0xdcf6('0x81')]['views']['admin']&&_0xdcf6('0x24')==typeof _0x56c5ef[_0xdcf6('0x81')][_0xdcf6('0x84')][_0xdcf6('0x86')]){return _0x2db184(new Error(_0xdcf6('0x87')));}}else if(_0x56c5ef[_0xdcf6('0x39')]===_0xdcf6('0x88')){if(_0xdcf6('0x24')==typeof _0x56c5ef['parameters'][_0xdcf6('0x89')]){return _0x2db184(new Error(_0xdcf6('0x8a')));}if(_0xdcf6('0x24')==typeof _0x56c5ef[_0xdcf6('0x81')][_0xdcf6('0x8b')]){return _0x2db184(new Error(_0xdcf6('0x8c')));}}else{return _0x2db184(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x5dfee5=_0x56c5ef['name'];var _0x1e9f74=_0x56c5ef['description'];var _0x2de99d=_0x56c5ef[_0xdcf6('0x39')];var _0x3f5fca=_0x56c5ef[_0xdcf6('0x8d')]?_0x56c5ef[_0xdcf6('0x8d')]:_0xdcf6('0x8e');var _0x371962=_0x56c5ef[_0xdcf6('0x8f')]?_0x56c5ef[_0xdcf6('0x8f')]:_0xdcf6('0x90');var _0xa6f5fe='';var _0x245b88='';var _0x33de18='';var _0x28d0b3='';var _0x43b73a=_0x56c5ef['version'];if(_0x2de99d===_0xdcf6('0x83')){if(_0xdcf6('0x24')!=typeof _0x56c5ef[_0xdcf6('0x81')][_0xdcf6('0x84')][_0xdcf6('0x91')]){var _0x7e46f6=_0x56c5ef[_0xdcf6('0x81')][_0xdcf6('0x84')][_0xdcf6('0x91')];if(!/^(f|ht)tps?:\/\//i[_0xdcf6('0x92')](_0x7e46f6)){_0xa6f5fe=path[_0xdcf6('0x53')](_0xdcf6('0x93'),_0x1e5055,_0xe60e37[0x0],_0x7e46f6);}else{_0xa6f5fe=_0x7e46f6;}}else{logger['info'](_0xdcf6('0x94'));}if(_0xdcf6('0x24')!=typeof _0x56c5ef[_0xdcf6('0x81')]['views'][_0xdcf6('0x86')]){var _0x5d00bf=_0x56c5ef['parameters']['views'][_0xdcf6('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xdcf6('0x92')](_0x5d00bf)){_0x245b88=path[_0xdcf6('0x53')]('plugins',_0x1e5055,_0xe60e37[0x0],_0x5d00bf);}else{_0x245b88=_0x5d00bf;}}else{logger[_0xdcf6('0x69')](_0xdcf6('0x95'));}}else if(_0x2de99d===_0xdcf6('0x88')){_0x33de18=_0x56c5ef[_0xdcf6('0x81')][_0xdcf6('0x89')];_0x28d0b3=_0x56c5ef['parameters'][_0xdcf6('0x8b')];if(_0xdcf6('0x24')!=typeof _0x56c5ef[_0xdcf6('0x81')]['views']){if(_0xdcf6('0x24')!=typeof _0x56c5ef[_0xdcf6('0x81')][_0xdcf6('0x84')]['admin']){var _0x7e46f6=_0x56c5ef[_0xdcf6('0x81')][_0xdcf6('0x84')][_0xdcf6('0x91')];if(!/^(f|ht)tps?:\/\//i[_0xdcf6('0x92')](_0x7e46f6)){_0xa6f5fe=path['join']('plugins',_0x1e5055,_0xe60e37[0x0],_0x7e46f6);}else{_0xa6f5fe=_0x7e46f6;}}if('undefined'!=typeof _0x56c5ef['parameters'][_0xdcf6('0x84')]['agent']){var _0x5d00bf=_0x56c5ef['parameters'][_0xdcf6('0x84')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xdcf6('0x92')](_0x5d00bf)){_0x245b88=path[_0xdcf6('0x53')]('plugins',_0x1e5055,_0xe60e37[0x0],_0x5d00bf);}else{_0x245b88=_0x5d00bf;}}}}var _0x376c6b={'name':_0x5dfee5,'description':_0x1e9f74,'path':path[_0xdcf6('0x53')](_0x1e5055,_0xe60e37[0x0]),'type':_0x2de99d,'sidebar':_0x3f5fca,'icon':_0x371962,'adminUrl':_0xa6f5fe,'agentUrl':_0x245b88,'scriptName':_0x33de18,'scriptPath':_0x28d0b3,'version':_0x43b73a};removeReferences(_0x5a5d65,null);return db['Plugin'][_0xdcf6('0x96')](_0x376c6b)[_0xdcf6('0x32')](function(_0x346d2f){var _0x4129d1={'role':_0x4c3b93['body']['role'],'userProfileId':_0x4c3b93[_0xdcf6('0x97')][_0xdcf6('0x98')]};if(!_0x4129d1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4129d1[_0xdcf6('0x99')]==='user'){var _0x41496b=_0x346d2f[_0xdcf6('0x2e')]({'plain':!![]});return db[_0xdcf6('0x9a')][_0xdcf6('0x51')]({'where':{'name':_0xdcf6('0x2f'),'userProfileId':_0x4129d1[_0xdcf6('0x98')]},'raw':!![]})['then'](function(_0x22a8b8){if(_0x22a8b8&&_0x22a8b8[_0xdcf6('0x9b')]===0x0){return db['UserProfileResource'][_0xdcf6('0x96')]({'name':_0x41496b[_0xdcf6('0x35')],'resourceId':_0x41496b['id'],'type':_0x22a8b8[_0xdcf6('0x35')],'sectionId':_0x22a8b8['id']},{})[_0xdcf6('0x32')](function(){return _0x346d2f;});}else{return _0x346d2f;}})[_0xdcf6('0x6c')](function(_0x4648cc){logger[_0xdcf6('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4648cc);throw _0x4648cc;});}return _0x346d2f;})['then'](respondWithResult(_0x5c561b,null))[_0xdcf6('0x6c')](handleError(_0x5c561b,null));}});}catch(_0x46218f){_0x5c561b[_0xdcf6('0x21')](0x1f4)[_0xdcf6('0x9c')](_0x46218f);}};function removeReferences(_0xbfb59c,_0x47ffc4){try{if(_0xbfb59c){fs['unlinkSync'](_0xbfb59c);logger[_0xdcf6('0x69')]('Zip\x20archive\x20removed');}if(_0x47ffc4){rimraf(_0x47ffc4,function(){});logger[_0xdcf6('0x69')]('Extracted\x20folder\x20removed');}}catch(_0x3093c7){logger[_0xdcf6('0x33')](_0x3093c7);}}exports[_0xdcf6('0x2d')]=function(_0xaa954c,_0x2bb5bb,_0x36a03a){return db[_0xdcf6('0x37')][_0xdcf6('0x51')]({'where':{'id':_0xaa954c[_0xdcf6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2bb5bb,null))[_0xdcf6('0x32')](saveUpdates(_0xaa954c[_0xdcf6('0x97')],null))[_0xdcf6('0x32')](respondWithResult(_0x2bb5bb,null))[_0xdcf6('0x6c')](handleError(_0x2bb5bb,null));};exports[_0xdcf6('0x9d')]=function(_0x5bec17,_0x5428fa,_0xb20d06){return db[_0xdcf6('0x37')][_0xdcf6('0x51')]({'where':{'id':_0x5bec17[_0xdcf6('0x4c')]['id']}})[_0xdcf6('0x32')](function(_0x4c8eeb){if(_0x4c8eeb){return _0x4c8eeb[_0xdcf6('0x31')]();}})['then'](function(_0x35fe43){rimraf(path[_0xdcf6('0x53')](config[_0xdcf6('0x54')],_0xdcf6('0x55'),path[_0xdcf6('0x60')](_0x35fe43[_0xdcf6('0x5')])),function(){});return _0x35fe43;})[_0xdcf6('0x32')](handleEntityNotFound(_0x5428fa,null))['then'](respondWithStatusCode(_0x5428fa,null))[_0xdcf6('0x6c')](handleError(_0x5428fa,null));};exports[_0xdcf6('0x9e')]=function(_0x610884,_0x2a5c41,_0x489b15){return BPromise[_0xdcf6('0x9f')]()[_0xdcf6('0x32')](function(){if(!_0x610884[_0xdcf6('0x3d')][_0xdcf6('0x5')]){throw new Error(_0xdcf6('0xa0'));}if(!_0x610884[_0xdcf6('0x3d')][_0xdcf6('0xa1')]){throw new Error(_0xdcf6('0xa2'));}var _0x3c66fa=_0x610884[_0xdcf6('0x3d')][_0xdcf6('0xa3')]?_0x610884[_0xdcf6('0x3d')][_0xdcf6('0xa3')]+':'+_0x610884[_0xdcf6('0x3d')][_0xdcf6('0xa1')]:_0xdcf6('0xa4')+_0x610884[_0xdcf6('0x3d')][_0xdcf6('0xa1')];var _0x99bb82=_0x610884['query']['json']?_0x610884[_0xdcf6('0x3d')][_0xdcf6('0x29')]:!![];var _0x48f963=_0x610884[_0xdcf6('0x3d')][_0xdcf6('0xa5')]?_0x610884[_0xdcf6('0x3d')][_0xdcf6('0xa5')]:null;var _0x1b0543={'method':_0x610884['method'],'uri':util[_0xdcf6('0x56')](_0xdcf6('0xa6'),_0x3c66fa,_0x610884[_0xdcf6('0x3d')]['path']),'json':_0x99bb82,'resolveWithFullResponse':!![],'encoding':_0x48f963,'qs':_0x610884[_0xdcf6('0x3d')]};if(_0x610884[_0xdcf6('0xa7')]){_0x1b0543[_0xdcf6('0xa7')]=_0x610884['headers'];if(_0x1b0543[_0xdcf6('0xa7')][_0xdcf6('0xa8')]){delete _0x1b0543[_0xdcf6('0xa7')][_0xdcf6('0xa8')];}}if(_0x1b0543['headers'][_0xdcf6('0xa9')]){delete _0x1b0543[_0xdcf6('0xa7')][_0xdcf6('0xa9')];}return rp(_0x1b0543);})[_0xdcf6('0x32')](function(_0x1d6028){if(_0x1d6028){_0x2a5c41[_0xdcf6('0x27')](_0x1d6028[_0xdcf6('0xa7')]);logger[_0xdcf6('0x69')](_0x1d6028['body']);if(_[_0xdcf6('0xaa')](_0x610884[_0xdcf6('0x3d')][_0xdcf6('0x5')],_0xdcf6('0x52'))&&_0x1d6028['statusCode']==0x1f4){return _0x2a5c41['sendStatus'](_0x1d6028[_0xdcf6('0xab')]);}else{return _0x2a5c41[_0xdcf6('0x21')](_0x1d6028[_0xdcf6('0xab')])[_0xdcf6('0x9c')](_0x1d6028['body']);}}else{return _0x2a5c41['sendStatus'](0xc8);}})[_0xdcf6('0x6c')](handleError(_0x2a5c41,null));};exports[_0xdcf6('0xac')]=function(_0x55079e,_0x1cb6f9,_0x3e4c48){return BPromise['resolve']()[_0xdcf6('0x32')](function(){if(!_0x55079e[_0xdcf6('0x3d')][_0xdcf6('0x5')]){throw new Error(_0xdcf6('0xa0'));}if(!_0x55079e['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x7a4c1e=_0x55079e[_0xdcf6('0x3d')][_0xdcf6('0xa3')]?_0x55079e['query'][_0xdcf6('0xa3')]+':'+_0x55079e[_0xdcf6('0x3d')][_0xdcf6('0xa1')]:_0xdcf6('0xa4')+_0x55079e[_0xdcf6('0x3d')]['port'];var _0x453423=_0x55079e[_0xdcf6('0x3d')][_0xdcf6('0x29')]?_0x55079e[_0xdcf6('0x3d')][_0xdcf6('0x29')]:!![];var _0x592f4b=_0x55079e['query'][_0xdcf6('0xa5')]?_0x55079e[_0xdcf6('0x3d')][_0xdcf6('0xa5')]:null;var _0x4b5c68={'method':_0x55079e['method'],'uri':util[_0xdcf6('0x56')](_0xdcf6('0xa6'),_0x7a4c1e,_0x55079e[_0xdcf6('0x3d')]['path']),'json':_0x453423,'resolveWithFullResponse':!![],'encoding':_0x592f4b,'body':_0x55079e[_0xdcf6('0x97')]};if(_0x55079e[_0xdcf6('0xa7')]){_0x4b5c68['headers']=_0x55079e['headers'];if(_0x4b5c68[_0xdcf6('0xa7')][_0xdcf6('0xa8')]){delete _0x4b5c68[_0xdcf6('0xa7')][_0xdcf6('0xa8')];}}if(_0x4b5c68[_0xdcf6('0xa7')]['content-type']){delete _0x4b5c68['headers'][_0xdcf6('0xa9')];}return rp(_0x4b5c68);})[_0xdcf6('0x32')](function(_0x559409){if(_0x559409){_0x1cb6f9['set'](_0x559409[_0xdcf6('0xa7')]);logger[_0xdcf6('0x69')](_0x559409['body']);return _0x1cb6f9[_0xdcf6('0x21')](_0x559409[_0xdcf6('0xab')])[_0xdcf6('0x9c')](_0x559409[_0xdcf6('0x97')]);}else{return _0x1cb6f9[_0xdcf6('0x20')](0xc8);}})[_0xdcf6('0x6c')](handleError(_0x1cb6f9,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index a7cb9e7..68272bc 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 _0x297f=['../../mysqldb','save','update','remove','emit','hasOwnProperty','events'];(function(_0x385358,_0x4aebf7){var _0x5bd30f=function(_0x552c4f){while(--_0x552c4f){_0x385358['push'](_0x385358['shift']());}};_0x5bd30f(++_0x4aebf7);}(_0x297f,0x1f0));var _0xf297=function(_0x45149b,_0x24a12b){_0x45149b=_0x45149b-0x0;var _0x194261=_0x297f[_0x45149b];return _0x194261;};'use strict';var EventEmitter=require(_0xf297('0x0'));var Plugin=require(_0xf297('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf297('0x2'),'afterUpdate':_0xf297('0x3'),'afterDestroy':_0xf297('0x4')};function emitEvent(_0x39ec01){return function(_0x586413,_0x462efe,_0x4a736d){PluginEvents[_0xf297('0x5')](_0x39ec01+':'+_0x586413['id'],_0x586413);PluginEvents[_0xf297('0x5')](_0x39ec01,_0x586413);_0x4a736d(null);};}for(var e in events){if(events[_0xf297('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xe829=['save','update','remove','hasOwnProperty','hook','exports','../../mysqldb','Plugin','setMaxListeners'];(function(_0x2c71bc,_0x5a03a5){var _0x4d97a5=function(_0x11f3c7){while(--_0x11f3c7){_0x2c71bc['push'](_0x2c71bc['shift']());}};_0x4d97a5(++_0x5a03a5);}(_0xe829,0xde));var _0x9e82=function(_0xb54b31,_0x4ac97c){_0xb54b31=_0xb54b31-0x0;var _0x49d88b=_0xe829[_0xb54b31];return _0x49d88b;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x9e82('0x0'))['db'][_0x9e82('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x9e82('0x2')](0x0);var events={'afterCreate':_0x9e82('0x3'),'afterUpdate':_0x9e82('0x4'),'afterDestroy':_0x9e82('0x5')};function emitEvent(_0x487d2d){return function(_0xc8aec1,_0x19ece0,_0x4bd524){PluginEvents['emit'](_0x487d2d+':'+_0xc8aec1['id'],_0xc8aec1);PluginEvents['emit'](_0x487d2d,_0xc8aec1);_0x4bd524(null);};}for(var e in events){if(events[_0x9e82('0x6')](e)){var event=events[e];Plugin[_0x9e82('0x7')](e,emitEvent(event));}}module[_0x9e82('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 318422d..832102b 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 _0x1f2f=['path','../../config/environment','./plugin.attributes','exports','define','plugins','lodash','../../config/logger','moment','request-promise'];(function(_0x273963,_0x20a0ae){var _0x462e19=function(_0xcbbf22){while(--_0xcbbf22){_0x273963['push'](_0x273963['shift']());}};_0x462e19(++_0x20a0ae);}(_0x1f2f,0x1d2));var _0xf1f2=function(_0x1e0c0e,_0x5ccb80){_0x1e0c0e=_0x1e0c0e-0x0;var _0x53fecc=_0x1f2f[_0x1e0c0e];return _0x53fecc;};'use strict';var _=require(_0xf1f2('0x0'));var util=require('util');var logger=require(_0xf1f2('0x1'))('api');var moment=require(_0xf1f2('0x2'));var BPromise=require('bluebird');var rp=require(_0xf1f2('0x3'));var fs=require('fs');var path=require(_0xf1f2('0x4'));var rimraf=require('rimraf');var config=require(_0xf1f2('0x5'));var attributes=require(_0xf1f2('0x6'));module[_0xf1f2('0x7')]=function(_0x3a30a5,_0x78012d){return _0x3a30a5[_0xf1f2('0x8')]('Plugin',attributes,{'tableName':_0xf1f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4804=['request-promise','path','rimraf','./plugin.attributes','exports','define','Plugin','plugins','util','api','moment','bluebird'];(function(_0x5c694a,_0x57e851){var _0x1ee3ca=function(_0x2afcaa){while(--_0x2afcaa){_0x5c694a['push'](_0x5c694a['shift']());}};_0x1ee3ca(++_0x57e851);}(_0x4804,0x158));var _0x4480=function(_0x2d91ba,_0x1ae50b){_0x2d91ba=_0x2d91ba-0x0;var _0x4af1f8=_0x4804[_0x2d91ba];return _0x4af1f8;};'use strict';var _=require('lodash');var util=require(_0x4480('0x0'));var logger=require('../../config/logger')(_0x4480('0x1'));var moment=require(_0x4480('0x2'));var BPromise=require(_0x4480('0x3'));var rp=require(_0x4480('0x4'));var fs=require('fs');var path=require(_0x4480('0x5'));var rimraf=require(_0x4480('0x6'));var config=require('../../config/environment');var attributes=require(_0x4480('0x7'));module[_0x4480('0x8')]=function(_0x4fb5d5,_0xc8e983){return _0x4fb5d5[_0x4480('0x9')](_0x4480('0xa'),attributes,{'tableName':_0x4480('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 17c3270..1a6e117 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 _0xa4e3=['body','options','raw','CreatePlugin','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create'];(function(_0x3056aa,_0x58f587){var _0xd4bd5c=function(_0x1a4408){while(--_0x1a4408){_0x3056aa['push'](_0x3056aa['shift']());}};_0xd4bd5c(++_0x58f587);}(_0xa4e3,0x17c));var _0x3a4e=function(_0x40c115,_0x2b91da){_0x40c115=_0x40c115-0x0;var _0x4ec04f=_0xa4e3[_0x40c115];return _0x4ec04f;};'use strict';var _=require(_0x3a4e('0x0'));var util=require(_0x3a4e('0x1'));var moment=require('moment');var BPromise=require(_0x3a4e('0x2'));var rs=require(_0x3a4e('0x3'));var fs=require('fs');var Redis=require(_0x3a4e('0x4'));var db=require(_0x3a4e('0x5'))['db'];var utils=require(_0x3a4e('0x6'));var logger=require(_0x3a4e('0x7'))(_0x3a4e('0x8'));var config=require(_0x3a4e('0x9'));var jayson=require(_0x3a4e('0xa'));var client=jayson[_0x3a4e('0xb')][_0x3a4e('0xc')]({'port':0x232a});config[_0x3a4e('0xd')]=_[_0x3a4e('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3a4e('0xf'))(new Redis(config[_0x3a4e('0xd')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x191ccb,_0x4e7ca4,_0x40e403){return new BPromise(function(_0x2f9c97,_0xb737c){return client[_0x3a4e('0x10')](_0x191ccb,_0x40e403)[_0x3a4e('0x11')](function(_0x3eadbf){logger[_0x3a4e('0x12')](_0x3a4e('0x13'),_0x4e7ca4,_0x3a4e('0x14'));logger['debug'](_0x3a4e('0x15'),_0x4e7ca4,_0x3a4e('0x14'),JSON[_0x3a4e('0x16')](_0x3eadbf));if(_0x3eadbf[_0x3a4e('0x17')]){if(_0x3eadbf['error'][_0x3a4e('0x18')]===0x1f4){logger['error'](_0x3a4e('0x13'),_0x4e7ca4,_0x3eadbf[_0x3a4e('0x17')][_0x3a4e('0x19')]);return _0xb737c(_0x3eadbf[_0x3a4e('0x17')]['message']);}logger[_0x3a4e('0x17')](_0x3a4e('0x13'),_0x4e7ca4,_0x3eadbf[_0x3a4e('0x17')][_0x3a4e('0x19')]);return _0x2f9c97(_0x3eadbf[_0x3a4e('0x17')][_0x3a4e('0x19')]);}else{logger[_0x3a4e('0x12')](_0x3a4e('0x13'),_0x4e7ca4,'request\x20sent');_0x2f9c97(_0x3eadbf[_0x3a4e('0x1a')][_0x3a4e('0x19')]);}})['catch'](function(_0x5daf23){logger['error']('Plugin,\x20%s,\x20%s',_0x4e7ca4,_0x5daf23);_0xb737c(_0x5daf23);});});}exports['CreatePlugin']=function(_0x5778c8){var _0x526e5d=this;return new Promise(function(_0x3f631f,_0xd6c77d){return db['Plugin'][_0x3a4e('0x1b')](_0x5778c8[_0x3a4e('0x1c')],{'raw':_0x5778c8[_0x3a4e('0x1d')]?_0x5778c8[_0x3a4e('0x1d')][_0x3a4e('0x1e')]===undefined?!![]:![]:!![]})[_0x3a4e('0x11')](function(_0x3dd607){logger[_0x3a4e('0x12')](_0x3a4e('0x1f'),_0x5778c8);logger[_0x3a4e('0x20')](_0x3a4e('0x1f'),_0x5778c8,JSON['stringify'](_0x3dd607));_0x3f631f(_0x3dd607);})[_0x3a4e('0x21')](function(_0x30bbda){logger[_0x3a4e('0x17')](_0x3a4e('0x1f'),_0x30bbda['message'],_0x5778c8);_0xd6c77d(_0x526e5d[_0x3a4e('0x17')](0x1f4,_0x30bbda[_0x3a4e('0x19')]));});});}; \ No newline at end of file +var _0xfd2e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreatePlugin','Plugin','create','body','options','raw','lodash'];(function(_0x3238b1,_0x94c929){var _0x5813d0=function(_0x164662){while(--_0x164662){_0x3238b1['push'](_0x3238b1['shift']());}};_0x5813d0(++_0x94c929);}(_0xfd2e,0x1a3));var _0xefd2=function(_0xcf0fbc,_0x4f4c6b){_0xcf0fbc=_0xcf0fbc-0x0;var _0x36b92c=_0xfd2e[_0xcf0fbc];return _0x36b92c;};'use strict';var _=require(_0xefd2('0x0'));var util=require(_0xefd2('0x1'));var moment=require(_0xefd2('0x2'));var BPromise=require(_0xefd2('0x3'));var rs=require(_0xefd2('0x4'));var fs=require('fs');var Redis=require(_0xefd2('0x5'));var db=require(_0xefd2('0x6'))['db'];var utils=require(_0xefd2('0x7'));var logger=require(_0xefd2('0x8'))('rpc');var config=require(_0xefd2('0x9'));var jayson=require(_0xefd2('0xa'));var client=jayson[_0xefd2('0xb')][_0xefd2('0xc')]({'port':0x232a});config[_0xefd2('0xd')]=_[_0xefd2('0xe')](config['redis'],{'host':_0xefd2('0xf'),'port':0x18eb});var socket=require(_0xefd2('0x10'))(new Redis(config[_0xefd2('0xd')]));require('./plugin.socket')[_0xefd2('0x11')](socket);function respondWithRpcPromise(_0xf65e1d,_0x4b22d8,_0x2c4676){return new BPromise(function(_0x18ba82,_0xfb8aa0){return client[_0xefd2('0x12')](_0xf65e1d,_0x2c4676)[_0xefd2('0x13')](function(_0x20cce6){logger[_0xefd2('0x14')](_0xefd2('0x15'),_0x4b22d8,'request\x20sent');logger[_0xefd2('0x16')](_0xefd2('0x17'),_0x4b22d8,_0xefd2('0x18'),JSON['stringify'](_0x20cce6));if(_0x20cce6[_0xefd2('0x19')]){if(_0x20cce6[_0xefd2('0x19')][_0xefd2('0x1a')]===0x1f4){logger[_0xefd2('0x19')](_0xefd2('0x15'),_0x4b22d8,_0x20cce6[_0xefd2('0x19')][_0xefd2('0x1b')]);return _0xfb8aa0(_0x20cce6[_0xefd2('0x19')][_0xefd2('0x1b')]);}logger['error'](_0xefd2('0x15'),_0x4b22d8,_0x20cce6[_0xefd2('0x19')][_0xefd2('0x1b')]);return _0x18ba82(_0x20cce6[_0xefd2('0x19')]['message']);}else{logger[_0xefd2('0x14')](_0xefd2('0x15'),_0x4b22d8,_0xefd2('0x18'));_0x18ba82(_0x20cce6['result'][_0xefd2('0x1b')]);}})[_0xefd2('0x1c')](function(_0xb7e65e){logger[_0xefd2('0x19')]('Plugin,\x20%s,\x20%s',_0x4b22d8,_0xb7e65e);_0xfb8aa0(_0xb7e65e);});});}exports[_0xefd2('0x1d')]=function(_0x32b230){var _0x1d4f83=this;return new Promise(function(_0x29725f,_0x654aa8){return db[_0xefd2('0x1e')][_0xefd2('0x1f')](_0x32b230[_0xefd2('0x20')],{'raw':_0x32b230[_0xefd2('0x21')]?_0x32b230['options'][_0xefd2('0x22')]===undefined?!![]:![]:!![]})[_0xefd2('0x13')](function(_0x269fc7){logger[_0xefd2('0x14')](_0xefd2('0x1d'),_0x32b230);logger[_0xefd2('0x16')](_0xefd2('0x1d'),_0x32b230,JSON['stringify'](_0x269fc7));_0x29725f(_0x269fc7);})[_0xefd2('0x1c')](function(_0xc5e578){logger[_0xefd2('0x19')](_0xefd2('0x1d'),_0xc5e578['message'],_0x32b230);_0x654aa8(_0x1d4f83[_0xefd2('0x19')](0x1f4,_0xc5e578[_0xefd2('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 05c4f60..765b4b5 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 _0x8a6a=['./plugin.events','update','emit','length','plugin:'];(function(_0x2f672a,_0x25e21a){var _0x26d058=function(_0x233387){while(--_0x233387){_0x2f672a['push'](_0x2f672a['shift']());}};_0x26d058(++_0x25e21a);}(_0x8a6a,0x96));var _0xa8a6=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8a6a[_0x311c35];return _0x5cc50c;};'use strict';var PluginEvents=require(_0xa8a6('0x0'));var events=['save','remove',_0xa8a6('0x1')];function createListener(_0x501473,_0x1a7bd7){return function(_0xbc57bf){_0x1a7bd7[_0xa8a6('0x2')](_0x501473,_0xbc57bf);};}function removeListener(_0x27a2f9,_0x2bb6fa){return function(){PluginEvents['removeListener'](_0x27a2f9,_0x2bb6fa);};}exports['register']=function(_0x4f1777){for(var _0xdbe031=0x0,_0x530649=events[_0xa8a6('0x3')];_0xdbe031<_0x530649;_0xdbe031++){var _0x2882f1=events[_0xdbe031];var _0x4d34c5=createListener(_0xa8a6('0x4')+_0x2882f1,_0x4f1777);PluginEvents['on'](_0x2882f1,_0x4d34c5);}}; \ No newline at end of file +var _0x518a=['length','plugin:','./plugin.events','save','remove','update','removeListener','register'];(function(_0x12e297,_0x52b9ae){var _0xfbe04d=function(_0x20b244){while(--_0x20b244){_0x12e297['push'](_0x12e297['shift']());}};_0xfbe04d(++_0x52b9ae);}(_0x518a,0x1b2));var _0xa518=function(_0x969204,_0x79d4bc){_0x969204=_0x969204-0x0;var _0x133e5a=_0x518a[_0x969204];return _0x133e5a;};'use strict';var PluginEvents=require(_0xa518('0x0'));var events=[_0xa518('0x1'),_0xa518('0x2'),_0xa518('0x3')];function createListener(_0x5e9076,_0x1f2dff){return function(_0x33b33a){_0x1f2dff['emit'](_0x5e9076,_0x33b33a);};}function removeListener(_0x219a45,_0x1e6486){return function(){PluginEvents[_0xa518('0x4')](_0x219a45,_0x1e6486);};}exports[_0xa518('0x5')]=function(_0x5cb98e){for(var _0x56a0dc=0x0,_0x553ed7=events[_0xa518('0x6')];_0x56a0dc<_0x553ed7;_0x56a0dc++){var _0x4dd3a3=events[_0x56a0dc];var _0x4da568=createListener(_0xa518('0x7')+_0x4dd3a3,_0x5cb98e);PluginEvents['on'](_0x4dd3a3,_0x4da568);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 1378bd4..091562c 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(_0x4698db,_0x5c99bb){var _0x547af6=function(_0x56425c){while(--_0x56425c){_0x4698db['push'](_0x4698db['shift']());}};_0x547af6(++_0x5c99bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x23bbd6,_0x385c55){var _0x522496=function(_0x31b09b){while(--_0x31b09b){_0x23bbd6['push'](_0x23bbd6['shift']());}};_0x522496(++_0x385c55);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 b697226..596d30f 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 _0xb688=['error','stack','name','send','info','index','then','reject','motion2','catch','show','describe','params','create','body','script','join','../../files/plugins','chdir','dirname','start','dump','update','stop','Unknown\x20status','destroy','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','status','json'];(function(_0x49a1a0,_0x48f776){var _0x518a4f=function(_0x313633){while(--_0x313633){_0x49a1a0['push'](_0x49a1a0['shift']());}};_0x518a4f(++_0x48f776);}(_0xb688,0xcf));var _0x8b68=function(_0x279624,_0x555b65){_0x279624=_0x279624-0x0;var _0x533513=_0xb688[_0x279624];return _0x533513;};'use strict';var _=require('lodash');var pm2=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var path=require(_0x8b68('0x3'));var exec=require(_0x8b68('0x4'))[_0x8b68('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x41030e,_0x27925d){return function(_0x30f33d){if(!_0x30f33d){_0x41030e[_0x8b68('0x6')](0x194);;}return _0x30f33d;};}function respondWithResult(_0x583d16,_0x34314e){_0x34314e=_0x34314e||0xc8;return function(_0x57ee56){if(_0x57ee56){return _0x583d16[_0x8b68('0x7')](_0x34314e)[_0x8b68('0x8')](_0x57ee56);}return null;};}function handleError(_0x130892,_0xa5571b){_0xa5571b=_0xa5571b||0x1f4;return function(_0x132617){logger[_0x8b68('0x9')](_0x132617[_0x8b68('0xa')]);if(_0x132617[_0x8b68('0xb')]){delete _0x132617[_0x8b68('0xb')];}_0x130892[_0x8b68('0x7')](_0xa5571b)[_0x8b68('0xc')](_0x132617);};}function execChildProcess(){return new BPromise(function(_0x317d01,_0x2a852a){exec('npm\x20install',function(_0x2c0f3b,_0x4426d1,_0x5e76c){logger[_0x8b68('0xd')](_0x4426d1);logger[_0x8b68('0xd')](_0x5e76c);if(_0x2c0f3b){logger[_0x8b68('0x9')](_0x2c0f3b);return _0x2a852a(_0x2c0f3b);}return _0x317d01(_0x4426d1);});});}exports[_0x8b68('0xe')]=function(_0x137c8e,_0x2686c7){return pm2['list']()[_0x8b68('0xf')](function(_0x509033){if(_0x509033){var _0x5e3c66=_[_0x8b68('0x10')](_0x509033,function(_0x1554d6){return _0x1554d6[_0x8b68('0xb')]==='express'||_0x1554d6['name']===_0x8b68('0x11');});return{'rows':_0x5e3c66,'count':_0x5e3c66['length']};}return null;})[_0x8b68('0xf')](respondWithResult(_0x2686c7,null))[_0x8b68('0x12')](handleError(_0x2686c7,null));};exports[_0x8b68('0x13')]=function(_0x10c9c6,_0x491695){return pm2[_0x8b68('0x14')](_0x10c9c6[_0x8b68('0x15')]['id'])['then'](respondWithResult(_0x491695,null))[_0x8b68('0xf')](handleEntityNotFound(_0x491695,null))[_0x8b68('0x12')](handleError(_0x491695,null));};exports[_0x8b68('0x16')]=function(_0x17f321,_0x38b7a7){if(_0x17f321['body'][_0x8b68('0xb')]&&_0x17f321[_0x8b68('0x17')][_0x8b68('0x18')]){var _0x1a9788=path[_0x8b68('0x19')](__dirname,_0x8b68('0x1a'),_0x17f321['body']['script']);var _0x23edc1=process['cwd']();process[_0x8b68('0x1b')](path[_0x8b68('0x1c')](_0x1a9788));return execChildProcess()[_0x8b68('0xf')](function(_0x21ecca){process[_0x8b68('0x1b')](_0x23edc1);return pm2[_0x8b68('0x1d')]({'name':_0x17f321['body'][_0x8b68('0xb')],'script':_0x1a9788});})[_0x8b68('0xf')](function(_0x4ca77d){pm2[_0x8b68('0x1e')]();return _0x4ca77d[0x0];})[_0x8b68('0xf')](respondWithResult(_0x38b7a7,0xc9))[_0x8b68('0x12')](handleError(_0x38b7a7,null));}else{return _0x38b7a7['status'](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8b68('0x1f')]=function(_0x448e43,_0x2ba2a3){if(_0x448e43['body']['id']){delete _0x448e43[_0x8b68('0x17')]['id'];}var _0x53aaa2={'online':'restart','stopped':_0x8b68('0x20')};if(_0x53aaa2['hasOwnProperty'](_0x448e43[_0x8b68('0x17')][_0x8b68('0x7')])){return pm2[_0x53aaa2[_0x448e43['body']['status']]](_0x448e43[_0x8b68('0x15')]['id'])[_0x8b68('0xf')](respondWithResult(_0x2ba2a3,0xc8))[_0x8b68('0x12')](handleError(_0x2ba2a3,null));}else{return _0x2ba2a3[_0x8b68('0x7')](0x1f4)[_0x8b68('0xc')]({'message':_0x8b68('0x21')});}};exports[_0x8b68('0x22')]=function(_0x5b7ed1,_0x3b6d1b){if(_0x5b7ed1['body']['id']){delete _0x5b7ed1[_0x8b68('0x17')]['id'];}if(_0x5b7ed1[_0x8b68('0x15')]['id']){return pm2['delete'](_0x5b7ed1[_0x8b68('0x15')]['id'])[_0x8b68('0xf')](function(_0x26fe0e){pm2['dump']();return _0x26fe0e[0x0];})['then'](respondWithResult(_0x3b6d1b,null))[_0x8b68('0x12')](handleError(_0x3b6d1b,null));}else{return _0x3b6d1b[_0x8b68('0x7')](0x1f4)[_0x8b68('0xc')]({'message':_0x8b68('0x23')});}}; \ No newline at end of file +var _0x4ea3=['dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','destroy','lodash','../../config/pm2','../../config/logger','api','child_process','bluebird','sendStatus','status','json','error','name','npm\x20install','info','index','list','then','reject','express','length','catch','show','describe','params','create','body','script','../../files/plugins','chdir'];(function(_0x375d6f,_0x2fb66e){var _0x2a74b6=function(_0x55a516){while(--_0x55a516){_0x375d6f['push'](_0x375d6f['shift']());}};_0x2a74b6(++_0x2fb66e);}(_0x4ea3,0x70));var _0x34ea=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4ea3[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x34ea('0x0'));var pm2=require(_0x34ea('0x1'));var logger=require(_0x34ea('0x2'))(_0x34ea('0x3'));var path=require('path');var exec=require(_0x34ea('0x4'))['exec'];var BPromise=require(_0x34ea('0x5'));function handleEntityNotFound(_0x571f1b,_0x5e5a84){return function(_0x2ce955){if(!_0x2ce955){_0x571f1b[_0x34ea('0x6')](0x194);;}return _0x2ce955;};}function respondWithResult(_0x962596,_0x123d48){_0x123d48=_0x123d48||0xc8;return function(_0x40434e){if(_0x40434e){return _0x962596[_0x34ea('0x7')](_0x123d48)[_0x34ea('0x8')](_0x40434e);}return null;};}function handleError(_0x5bec7c,_0x341727){_0x341727=_0x341727||0x1f4;return function(_0x6e9ccc){logger[_0x34ea('0x9')](_0x6e9ccc['stack']);if(_0x6e9ccc[_0x34ea('0xa')]){delete _0x6e9ccc[_0x34ea('0xa')];}_0x5bec7c['status'](_0x341727)['send'](_0x6e9ccc);};}function execChildProcess(){return new BPromise(function(_0x5bd8b6,_0x346287){exec(_0x34ea('0xb'),function(_0x58bb0d,_0x11229e,_0x29a5c8){logger[_0x34ea('0xc')](_0x11229e);logger[_0x34ea('0xc')](_0x29a5c8);if(_0x58bb0d){logger[_0x34ea('0x9')](_0x58bb0d);return _0x346287(_0x58bb0d);}return _0x5bd8b6(_0x11229e);});});}exports[_0x34ea('0xd')]=function(_0x37e1b4,_0x36af43){return pm2[_0x34ea('0xe')]()[_0x34ea('0xf')](function(_0x36a4c6){if(_0x36a4c6){var _0x5ef9ae=_[_0x34ea('0x10')](_0x36a4c6,function(_0x89e3f2){return _0x89e3f2[_0x34ea('0xa')]===_0x34ea('0x11')||_0x89e3f2[_0x34ea('0xa')]==='motion2';});return{'rows':_0x5ef9ae,'count':_0x5ef9ae[_0x34ea('0x12')]};}return null;})[_0x34ea('0xf')](respondWithResult(_0x36af43,null))[_0x34ea('0x13')](handleError(_0x36af43,null));};exports[_0x34ea('0x14')]=function(_0x5f420f,_0x2680e0){return pm2[_0x34ea('0x15')](_0x5f420f[_0x34ea('0x16')]['id'])['then'](respondWithResult(_0x2680e0,null))[_0x34ea('0xf')](handleEntityNotFound(_0x2680e0,null))[_0x34ea('0x13')](handleError(_0x2680e0,null));};exports[_0x34ea('0x17')]=function(_0x127308,_0x52af16){if(_0x127308[_0x34ea('0x18')][_0x34ea('0xa')]&&_0x127308[_0x34ea('0x18')][_0x34ea('0x19')]){var _0x4fc1a2=path['join'](__dirname,_0x34ea('0x1a'),_0x127308[_0x34ea('0x18')][_0x34ea('0x19')]);var _0x51022f=process['cwd']();process[_0x34ea('0x1b')](path[_0x34ea('0x1c')](_0x4fc1a2));return execChildProcess()[_0x34ea('0xf')](function(_0x30c4b0){process[_0x34ea('0x1b')](_0x51022f);return pm2[_0x34ea('0x1d')]({'name':_0x127308['body'][_0x34ea('0xa')],'script':_0x4fc1a2});})[_0x34ea('0xf')](function(_0x3c0983){pm2[_0x34ea('0x1e')]();return _0x3c0983[0x0];})['then'](respondWithResult(_0x52af16,0xc9))['catch'](handleError(_0x52af16,null));}else{return _0x52af16['status'](0x1f4)[_0x34ea('0x1f')]({'message':_0x34ea('0x20')});}};exports[_0x34ea('0x21')]=function(_0x4204d7,_0x5b8b3e){if(_0x4204d7[_0x34ea('0x18')]['id']){delete _0x4204d7[_0x34ea('0x18')]['id'];}var _0x27c6f7={'online':'restart','stopped':'stop'};if(_0x27c6f7['hasOwnProperty'](_0x4204d7['body'][_0x34ea('0x7')])){return pm2[_0x27c6f7[_0x4204d7[_0x34ea('0x18')][_0x34ea('0x7')]]](_0x4204d7[_0x34ea('0x16')]['id'])['then'](respondWithResult(_0x5b8b3e,0xc8))[_0x34ea('0x13')](handleError(_0x5b8b3e,null));}else{return _0x5b8b3e['status'](0x1f4)[_0x34ea('0x1f')]({'message':'Unknown\x20status'});}};exports[_0x34ea('0x22')]=function(_0x14e018,_0x3cb968){if(_0x14e018['body']['id']){delete _0x14e018[_0x34ea('0x18')]['id'];}if(_0x14e018[_0x34ea('0x16')]['id']){return pm2['delete'](_0x14e018[_0x34ea('0x16')]['id'])['then'](function(_0x1392b6){pm2[_0x34ea('0x1e')]();return _0x1392b6[0x0];})[_0x34ea('0xf')](respondWithResult(_0x3cb968,null))['catch'](handleError(_0x3cb968,null));}else{return _0x3cb968['status'](0x1f4)[_0x34ea('0x1f')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 167cdb1..4f4d8b4 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 _0xef10=['get','isAuthenticated','getAgents','/queues','getQueues','exports','Router','../../components/auth/service','./realtime.controller'];(function(_0x534c8f,_0x500079){var _0x5a57f5=function(_0x38ec0a){while(--_0x38ec0a){_0x534c8f['push'](_0x534c8f['shift']());}};_0x5a57f5(++_0x500079);}(_0xef10,0x84));var _0x0ef1=function(_0x48aa9f,_0x26e09d){_0x48aa9f=_0x48aa9f-0x0;var _0x1efb5f=_0xef10[_0x48aa9f];return _0x1efb5f;};'use strict';var express=require('express');var router=express[_0x0ef1('0x0')]();var auth=require(_0x0ef1('0x1'));var controller=require(_0x0ef1('0x2'));router[_0x0ef1('0x3')]('/agents',auth[_0x0ef1('0x4')](),controller[_0x0ef1('0x5')]);router[_0x0ef1('0x3')](_0x0ef1('0x6'),auth['isAuthenticated'](),controller[_0x0ef1('0x7')]);module[_0x0ef1('0x8')]=router; \ No newline at end of file +var _0x0d28=['../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','exports','express','Router'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x0d28,0x6a));var _0x80d2=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0x0d28[_0x219d87];return _0x22823d;};'use strict';var express=require(_0x80d2('0x0'));var router=express[_0x80d2('0x1')]();var auth=require(_0x80d2('0x2'));var controller=require(_0x80d2('0x3'));router[_0x80d2('0x4')](_0x80d2('0x5'),auth[_0x80d2('0x6')](),controller[_0x80d2('0x7')]);router[_0x80d2('0x4')]('/queues',auth[_0x80d2('0x6')](),controller['getQueues']);module[_0x80d2('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 8399506..5797227 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 _0xf0ea=['../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','count','Content-Range','json','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','length','map','rawAttributes','fieldName','key','role','agent','getOptions','raw','push','sequelize','literal','forEach','Pause','where','merge','user','online','extraQueryConditions','assign','UserProfile','getResources','User','findAndCountAll','filterAgentAttributes','getAgentStatus','includes','voice','voiceStatus','talking','sortAgentsByStatus','getRealtimeAgentsQueryFields','catch','getQueues','isValidChannel','format','startCase','Queue','type','outbound','userProfileId','Queues','name','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/parsers/qs'];(function(_0x53bde8,_0x49f0aa){var _0x2c53c7=function(_0x45b696){while(--_0x45b696){_0x53bde8['push'](_0x53bde8['shift']());}};_0x2c53c7(++_0x49f0aa);}(_0xf0ea,0x17e));var _0xaf0e=function(_0x330c6f,_0x3294f6){_0x330c6f=_0x330c6f-0x0;var _0x1f1b84=_0xf0ea[_0x330c6f];return _0x1f1b84;};'use strict';var _=require(_0xaf0e('0x0'));var util=require(_0xaf0e('0x1'));var rta=require('../../components/realtime/agents');var rtq=require('../../components/realtime/queues');var qs=require(_0xaf0e('0x2'));var utils=require(_0xaf0e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0xaf0e('0x4'))[_0xaf0e('0x5')];var APIHandleError=require(_0xaf0e('0x4'))[_0xaf0e('0x6')];function respondWithFilteredResult(_0x40a2c5,_0x37b4da){return function(_0x11a52c){if(_0x11a52c){var _0x49dcde=typeof _0x37b4da[_0xaf0e('0x7')]==='undefined'&&typeof _0x37b4da['limit']==='undefined';var _0x284e73=_0x11a52c[_0xaf0e('0x8')];var _0x5be476=_0x49dcde?0x0:_0x37b4da[_0xaf0e('0x7')];var _0x4981d1=_0x49dcde?_0x11a52c['count']:_0x37b4da[_0xaf0e('0x7')]+_0x37b4da['limit'];var _0x5847d9;if(_0x4981d1>=_0x284e73){_0x4981d1=_0x284e73;_0x5847d9=0xc8;}else{_0x5847d9=0xce;}_0x40a2c5['status'](_0x5847d9);return _0x40a2c5['set'](_0xaf0e('0x9'),_0x5be476+'-'+_0x4981d1+'/'+_0x284e73)[_0xaf0e('0xa')](_0x11a52c);}return null;};}exports['getAgents']=function(_0x31e3be,_0xc7c437){var _0x3ced98={'count':0x0,'rows':[]};var _0x4603be={};var _0x57b7f3;var _0x8b87e1=utils[_0xaf0e('0xb')]();var _0x50b210;var _0x37fac0;var _0x524c9b=_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0xd')];var _0x59052f=_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0xe')];var _0x54b196=_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0xf')];var _0x51c57a=_0x59052f===_0xaf0e('0x10')||_0x59052f===_0xaf0e('0x11')?!![]:![];var _0x53e136=[];var _0x2ae49b;var _0x5e2b8a;Promise[_0xaf0e('0x12')]()[_0xaf0e('0x13')](function(){if(_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x14')]){if(!utils['isValidChannel'](_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x14')])){throw new APIBadRequestError(util['format'](_0xaf0e('0x15'),_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x14')]));}_0x57b7f3=_0x31e3be['query'][_0xaf0e('0x14')][_0xaf0e('0x16')]();}if(!_0x31e3be['query'][_0xaf0e('0x17')]||!_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x17')]['includes'](_0xaf0e('0x18'))){_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x17')]=rta['validateSortParameter'](_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x17')]);return;}var _0x4781d6=rta['getUpdatedSortOptions'](_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x17')]);_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x17')]=_0x4781d6[_0xaf0e('0x19')][_0xaf0e('0x1a')](',');_0x2ae49b=_0x4781d6[_0xaf0e('0x1b')];})[_0xaf0e('0x13')](function(){if(!_0x524c9b){return[];}return rta[_0xaf0e('0x1c')](_0x524c9b,_0x57b7f3);})[_0xaf0e('0x13')](function(_0xe8999d){_0x53e136=_0xe8999d;return rta[_0xaf0e('0x1d')]();})['then'](function(_0x125851){_0x37fac0=_0x125851[_0xaf0e('0x1e')];if((!_0x59052f||_0x51c57a)&&!_0x2ae49b){return _0x53e136;}if(_0x2ae49b&&!_0x59052f){return rta['getSortedAgentsIdsByStatus'](_0x37fac0,_0x53e136,_0x2ae49b);}else{return rta['getAgentIdsByStatus'](_0x37fac0,_0x53e136,_0x59052f);}})[_0xaf0e('0x13')](function(_0xdd9775){_0x53e136=_0xdd9775;var _0x32b55b=![];if(_0x53e136[_0xaf0e('0x1f')]===0x0){if(_0x524c9b||_0x59052f){_0x32b55b=!![];}if(_0x51c57a){_0x32b55b=![];}}if(_0x32b55b){return _0x3ced98;}var _0x4354bd=_[_0xaf0e('0x20')](db['User'][_0xaf0e('0x21')],function(_0x3da9b3){return{'name':_0x3da9b3[_0xaf0e('0x22')],'type':_0x3da9b3['type'][_0xaf0e('0x23')]};});_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x24')]=_0xaf0e('0x25');_0x4603be=qs[_0xaf0e('0x26')](_0x4354bd,_0x31e3be);_0x4603be[_0xaf0e('0x27')]=!![];var _0xe8b2d6=[];if(_0x53e136[_0xaf0e('0x1f')]>0x0){_0xe8b2d6[_0xaf0e('0x28')]({'id':{'$in':_0x53e136}});if(_0x2ae49b&&!_0x59052f){_0x5e2b8a=[db[_0xaf0e('0x29')][_0xaf0e('0x2a')]('FIELD(id,'+_0x53e136+')')];_0x4603be[_0xaf0e('0x1b')]=_0x5e2b8a;}}if(_0x51c57a){_0x8b87e1[_0xaf0e('0x2b')](function(_0x243e1c){var _0x5a742e=!![];if(_0x59052f===_0xaf0e('0x11')&&_0x57b7f3!==_0x243e1c){_0x5a742e=![];}_0xe8b2d6[_0xaf0e('0x28')]({[_0x243e1c+_0xaf0e('0x2c')]:_0x5a742e});});if(_0x54b196){_0xe8b2d6[_0xaf0e('0x28')]({'pauseType':_0x54b196});}}else if(_0x59052f){_0x8b87e1['forEach'](function(_0x301f2c){_0xe8b2d6[_0xaf0e('0x28')]({[_0x301f2c+'Pause']:![]});});}_0x4603be[_0xaf0e('0x2d')]=_[_0xaf0e('0x2e')](_0x4603be['where'],{'$and':_0xe8b2d6});if(_0x31e3be[_0xaf0e('0x2f')]['role']===_0xaf0e('0x2f')){var _0x38d0f7={'params':{'id':_0x31e3be[_0xaf0e('0x2f')]['userProfileId']},'query':{'section':'Agents','role':_0xaf0e('0x25'),'raw':!![],'ids':_0x53e136,'customSorting':_0x5e2b8a}};if(_0x31e3be['query']['online']){_0x38d0f7['query'][_0xaf0e('0x30')]=!![];}if(_0x51c57a){_0x38d0f7['query'][_0xaf0e('0x31')]=_0xe8b2d6;}_0x38d0f7['query']=Object[_0xaf0e('0x32')](_0x38d0f7[_0xaf0e('0xc')],_0x31e3be[_0xaf0e('0xc')]);return db[_0xaf0e('0x33')][_0xaf0e('0x34')](_0x38d0f7);}return db[_0xaf0e('0x35')][_0xaf0e('0x36')](_0x4603be);})['then'](function(_0xda1aa2){_0x3ced98['count']=_0xda1aa2[_0xaf0e('0x8')];_0x50b210=_0xda1aa2[_0xaf0e('0x1e')];return _0x50b210[_0xaf0e('0x20')](function(_0x50ada4){var _0x331994=_['find'](_0x37fac0,['id',_0x50ada4['id']]);if(_0x331994){var _0x33a5f2=rta[_0xaf0e('0x37')](_0x331994);_[_0xaf0e('0x2e')](_0x50ada4,_0x33a5f2);}_0x50ada4[_0xaf0e('0x18')]=rta[_0xaf0e('0x38')](_0x50ada4);if(_0x50ada4[_0xaf0e('0x18')][_0xaf0e('0x39')](_0xaf0e('0x10'))){_0x8b87e1['forEach'](function(_0x5967cb){if(_0x50ada4[_0x5967cb+_0xaf0e('0x2c')]){if(_0x5967cb===_0xaf0e('0x3a')){if(_0x50ada4[_0xaf0e('0x3b')]!==_0xaf0e('0x3c')){_0x50ada4[_0xaf0e('0x3b')]=_0xaf0e('0x10');}}else{_0x50ada4[_0x5967cb+'Status']='pause';}}});}return _0x50ada4;});})['then'](function(_0x7f438c){if(!_0x2ae49b||_0x5e2b8a){return _0x7f438c;}return rta[_0xaf0e('0x3d')](_0x7f438c,_0x2ae49b);})[_0xaf0e('0x13')](function(_0x547780){var _0x288dfb=rta[_0xaf0e('0x3e')]();_0x3ced98[_0xaf0e('0x1e')]=_0x547780[_0xaf0e('0x20')](function(_0x4dec02){return _['pick'](_0x4dec02,_0x288dfb);});return _0x3ced98;})['then'](respondWithFilteredResult(_0xc7c437,_0x4603be))[_0xaf0e('0x3f')](APIHandleError(_0xc7c437));};exports[_0xaf0e('0x40')]=function(_0x20e72a,_0x188cfe){var _0x47099c={'count':0x0,'rows':[]};var _0x25a71e={};var _0x4f599e;var _0xd3048;var _0x4cd328;Promise[_0xaf0e('0x12')]()[_0xaf0e('0x13')](function(){if(_0x20e72a[_0xaf0e('0xc')]['channel']){if(!utils[_0xaf0e('0x41')](_0x20e72a[_0xaf0e('0xc')]['channel'])){throw new APIBadRequestError(util[_0xaf0e('0x42')](_0xaf0e('0x15'),_0x20e72a[_0xaf0e('0xc')][_0xaf0e('0x14')]));}_0x4f599e=_0x20e72a[_0xaf0e('0xc')]['channel'][_0xaf0e('0x16')]();}var _0x14d5b7=_[_0xaf0e('0x43')](_0x4f599e)+_0xaf0e('0x44');var _0x2f8d08=_[_0xaf0e('0x20')](db[_0x14d5b7][_0xaf0e('0x21')],function(_0x1b8dec){return{'name':_0x1b8dec[_0xaf0e('0x22')],'type':_0x1b8dec[_0xaf0e('0x45')][_0xaf0e('0x23')]};});if(!_0x20e72a[_0xaf0e('0xc')][_0xaf0e('0x19')]){var _0xa805cd=['id','name'];if(_0x4f599e===_0xaf0e('0x3a')){_0xa805cd[_0xaf0e('0x28')]('type');if(_0x20e72a[_0xaf0e('0xc')][_0xaf0e('0x45')]===_0xaf0e('0x46')){_0xa805cd[_0xaf0e('0x28')](['dialActive','dialMethod']);}}_0x20e72a[_0xaf0e('0xc')][_0xaf0e('0x19')]=_0xa805cd[_0xaf0e('0x1a')](',');}_0x25a71e=qs[_0xaf0e('0x26')](_0x2f8d08,_0x20e72a);if(_0x20e72a['user'][_0xaf0e('0x24')]===_0xaf0e('0x2f')){var _0x2d5a77={'params':{'id':_0x20e72a[_0xaf0e('0x2f')][_0xaf0e('0x47')]},'query':{'section':_0x4f599e===_0xaf0e('0x3a')&&_0x20e72a[_0xaf0e('0xc')]['type']===_0xaf0e('0x46')?'QueueCampaigns':_[_0xaf0e('0x43')](_0x4f599e)+_0xaf0e('0x48'),'type':_0x20e72a['query']['type'],'nolimit':!![],'sort':_0xaf0e('0x49'),'filter':_0x20e72a[_0xaf0e('0xc')][_0xaf0e('0x4a')]}};_0x2d5a77[_0xaf0e('0xc')]=Object[_0xaf0e('0x32')](_0x2d5a77['query'],_0x20e72a['query']);delete _0x2d5a77[_0xaf0e('0xc')]['id'];return db['UserProfile'][_0xaf0e('0x34')](_0x2d5a77);}return db[_0x14d5b7]['findAndCountAll'](_0x25a71e);})['then'](function(_0x3ffc43){_0x47099c[_0xaf0e('0x8')]=_0x3ffc43[_0xaf0e('0x8')];_0xd3048=_0x3ffc43[_0xaf0e('0x1e')];return rtq[_0xaf0e('0x4b')](_0x20e72a,_0x4f599e);})[_0xaf0e('0x13')](function(_0x6697ae){_0x4cd328=_0x6697ae[_0xaf0e('0x1e')];return rtq[_0xaf0e('0x4c')](_0xd3048,_0x4cd328,_0x4f599e,_0x20e72a[_0xaf0e('0xc')]['type']);})['then'](function(_0x9f1e39){_0x47099c['rows']=_0x9f1e39;return _0x47099c;})['then'](respondWithFilteredResult(_0x188cfe,_0x25a71e))[_0xaf0e('0x3f')](APIHandleError(_0x188cfe));}; \ No newline at end of file +var _0x1cbf=['online','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','find','merge','includes','voice','talking','voiceStatus','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','startCase','Queue','rawAttributes','name','outbound','dialActive','getOptions','userProfileId','QueueCampaigns','Queues','filter','getRealtimeQueues','initializeQueues','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','set','Content-Range','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','fieldName','type','key','role','agent','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','user','Agents'];(function(_0x1c0842,_0x39dca1){var _0x3e81a1=function(_0x5a0b39){while(--_0x5a0b39){_0x1c0842['push'](_0x1c0842['shift']());}};_0x3e81a1(++_0x39dca1);}(_0x1cbf,0xce));var _0xf1cb=function(_0x2fdee8,_0xa3fed7){_0x2fdee8=_0x2fdee8-0x0;var _0x5cd20b=_0x1cbf[_0x2fdee8];return _0x5cd20b;};'use strict';var _=require('lodash');var util=require('util');var rta=require(_0xf1cb('0x0'));var rtq=require(_0xf1cb('0x1'));var qs=require(_0xf1cb('0x2'));var utils=require('../../config/utils');var db=require(_0xf1cb('0x3'))['db'];var APIBadRequestError=require(_0xf1cb('0x4'))[_0xf1cb('0x5')];var APIHandleError=require('../../errors/api')[_0xf1cb('0x6')];function respondWithFilteredResult(_0x3dbeab,_0x5bd42c){return function(_0x27a29a){if(_0x27a29a){var _0x5bcc9c=typeof _0x5bd42c[_0xf1cb('0x7')]===_0xf1cb('0x8')&&typeof _0x5bd42c[_0xf1cb('0x9')]==='undefined';var _0x399a64=_0x27a29a[_0xf1cb('0xa')];var _0x3e5806=_0x5bcc9c?0x0:_0x5bd42c[_0xf1cb('0x7')];var _0x5cf53b=_0x5bcc9c?_0x27a29a[_0xf1cb('0xa')]:_0x5bd42c[_0xf1cb('0x7')]+_0x5bd42c[_0xf1cb('0x9')];var _0x3d4eb1;if(_0x5cf53b>=_0x399a64){_0x5cf53b=_0x399a64;_0x3d4eb1=0xc8;}else{_0x3d4eb1=0xce;}_0x3dbeab[_0xf1cb('0xb')](_0x3d4eb1);return _0x3dbeab[_0xf1cb('0xc')](_0xf1cb('0xd'),_0x3e5806+'-'+_0x5cf53b+'/'+_0x399a64)['json'](_0x27a29a);}return null;};}exports[_0xf1cb('0xe')]=function(_0x2585df,_0x37671a){var _0x4b8383={'count':0x0,'rows':[]};var _0x5b36bb={};var _0x5255fd;var _0x5d89a0=utils[_0xf1cb('0xf')]();var _0x5d2642;var _0x423ecc;var _0x201330=_0x2585df[_0xf1cb('0x10')][_0xf1cb('0x11')];var _0xbc2b5b=_0x2585df[_0xf1cb('0x10')][_0xf1cb('0x12')];var _0x127007=_0x2585df['query']['pauseTypeFilter'];var _0x9ba64=_0xbc2b5b===_0xf1cb('0x13')||_0xbc2b5b===_0xf1cb('0x14')?!![]:![];var _0xb35b8b=[];var _0x41e074;var _0x11ac69;Promise[_0xf1cb('0x15')]()[_0xf1cb('0x16')](function(){if(_0x2585df[_0xf1cb('0x10')][_0xf1cb('0x17')]){if(!utils[_0xf1cb('0x18')](_0x2585df[_0xf1cb('0x10')]['channel'])){throw new APIBadRequestError(util[_0xf1cb('0x19')](_0xf1cb('0x1a'),_0x2585df[_0xf1cb('0x10')]['channel']));}_0x5255fd=_0x2585df[_0xf1cb('0x10')][_0xf1cb('0x17')][_0xf1cb('0x1b')]();}if(!_0x2585df['query'][_0xf1cb('0x1c')]||!_0x2585df[_0xf1cb('0x10')][_0xf1cb('0x1c')]['includes'](_0xf1cb('0x1d'))){_0x2585df['query'][_0xf1cb('0x1c')]=rta[_0xf1cb('0x1e')](_0x2585df[_0xf1cb('0x10')]['sort']);return;}var _0x49f6a1=rta[_0xf1cb('0x1f')](_0x2585df[_0xf1cb('0x10')][_0xf1cb('0x1c')]);_0x2585df[_0xf1cb('0x10')][_0xf1cb('0x1c')]=_0x49f6a1[_0xf1cb('0x20')][_0xf1cb('0x21')](',');_0x41e074=_0x49f6a1[_0xf1cb('0x22')];})['then'](function(){if(!_0x201330){return[];}return rta[_0xf1cb('0x23')](_0x201330,_0x5255fd);})['then'](function(_0x133d95){_0xb35b8b=_0x133d95;return rta[_0xf1cb('0x24')]();})[_0xf1cb('0x16')](function(_0x5450c4){_0x423ecc=_0x5450c4[_0xf1cb('0x25')];if((!_0xbc2b5b||_0x9ba64)&&!_0x41e074){return _0xb35b8b;}if(_0x41e074&&!_0xbc2b5b){return rta[_0xf1cb('0x26')](_0x423ecc,_0xb35b8b,_0x41e074);}else{return rta[_0xf1cb('0x27')](_0x423ecc,_0xb35b8b,_0xbc2b5b);}})[_0xf1cb('0x16')](function(_0x36dfeb){_0xb35b8b=_0x36dfeb;var _0x4d5ca7=![];if(_0xb35b8b[_0xf1cb('0x28')]===0x0){if(_0x201330||_0xbc2b5b){_0x4d5ca7=!![];}if(_0x9ba64){_0x4d5ca7=![];}}if(_0x4d5ca7){return _0x4b8383;}var _0x862761=_[_0xf1cb('0x29')](db[_0xf1cb('0x2a')]['rawAttributes'],function(_0x41268e){return{'name':_0x41268e[_0xf1cb('0x2b')],'type':_0x41268e[_0xf1cb('0x2c')][_0xf1cb('0x2d')]};});_0x2585df[_0xf1cb('0x10')][_0xf1cb('0x2e')]=_0xf1cb('0x2f');_0x5b36bb=qs['getOptions'](_0x862761,_0x2585df);_0x5b36bb[_0xf1cb('0x30')]=!![];var _0x5172fd=[];if(_0xb35b8b[_0xf1cb('0x28')]>0x0){_0x5172fd[_0xf1cb('0x31')]({'id':{'$in':_0xb35b8b}});if(_0x41e074&&!_0xbc2b5b){_0x11ac69=[db[_0xf1cb('0x32')][_0xf1cb('0x33')](_0xf1cb('0x34')+_0xb35b8b+')')];_0x5b36bb[_0xf1cb('0x22')]=_0x11ac69;}}if(_0x9ba64){_0x5d89a0[_0xf1cb('0x35')](function(_0x44d807){var _0x5d9be9=!![];if(_0xbc2b5b==='*pause'&&_0x5255fd!==_0x44d807){_0x5d9be9=![];}_0x5172fd[_0xf1cb('0x31')]({[_0x44d807+_0xf1cb('0x36')]:_0x5d9be9});});if(_0x127007){_0x5172fd['push']({'pauseType':_0x127007});}}else if(_0xbc2b5b){_0x5d89a0[_0xf1cb('0x35')](function(_0x3d003b){_0x5172fd['push']({[_0x3d003b+'Pause']:![]});});}_0x5b36bb['where']=_['merge'](_0x5b36bb[_0xf1cb('0x37')],{'$and':_0x5172fd});if(_0x2585df[_0xf1cb('0x38')][_0xf1cb('0x2e')]===_0xf1cb('0x38')){var _0x1f7f3d={'params':{'id':_0x2585df[_0xf1cb('0x38')]['userProfileId']},'query':{'section':_0xf1cb('0x39'),'role':'agent','raw':!![],'ids':_0xb35b8b,'customSorting':_0x11ac69}};if(_0x2585df[_0xf1cb('0x10')][_0xf1cb('0x3a')]){_0x1f7f3d[_0xf1cb('0x10')][_0xf1cb('0x3a')]=!![];}if(_0x9ba64){_0x1f7f3d['query'][_0xf1cb('0x3b')]=_0x5172fd;}_0x1f7f3d['query']=Object[_0xf1cb('0x3c')](_0x1f7f3d[_0xf1cb('0x10')],_0x2585df[_0xf1cb('0x10')]);return db[_0xf1cb('0x3d')][_0xf1cb('0x3e')](_0x1f7f3d);}return db[_0xf1cb('0x2a')][_0xf1cb('0x3f')](_0x5b36bb);})[_0xf1cb('0x16')](function(_0x54b7c8){_0x4b8383['count']=_0x54b7c8[_0xf1cb('0xa')];_0x5d2642=_0x54b7c8[_0xf1cb('0x25')];return _0x5d2642[_0xf1cb('0x29')](function(_0x34ca31){var _0x281e95=_[_0xf1cb('0x40')](_0x423ecc,['id',_0x34ca31['id']]);if(_0x281e95){var _0x56b621=rta['filterAgentAttributes'](_0x281e95);_[_0xf1cb('0x41')](_0x34ca31,_0x56b621);}_0x34ca31[_0xf1cb('0x1d')]=rta['getAgentStatus'](_0x34ca31);if(_0x34ca31['globalStatus'][_0xf1cb('0x42')](_0xf1cb('0x13'))){_0x5d89a0[_0xf1cb('0x35')](function(_0x118631){if(_0x34ca31[_0x118631+_0xf1cb('0x36')]){if(_0x118631===_0xf1cb('0x43')){if(_0x34ca31['voiceStatus']!==_0xf1cb('0x44')){_0x34ca31[_0xf1cb('0x45')]=_0xf1cb('0x13');}}else{_0x34ca31[_0x118631+_0xf1cb('0x46')]=_0xf1cb('0x13');}}});}return _0x34ca31;});})[_0xf1cb('0x16')](function(_0x5a9278){if(!_0x41e074||_0x11ac69){return _0x5a9278;}return rta[_0xf1cb('0x47')](_0x5a9278,_0x41e074);})[_0xf1cb('0x16')](function(_0xa00fa7){var _0x373d6a=rta[_0xf1cb('0x48')]();_0x4b8383[_0xf1cb('0x25')]=_0xa00fa7[_0xf1cb('0x29')](function(_0x4bba5e){return _[_0xf1cb('0x49')](_0x4bba5e,_0x373d6a);});return _0x4b8383;})['then'](respondWithFilteredResult(_0x37671a,_0x5b36bb))[_0xf1cb('0x4a')](APIHandleError(_0x37671a));};exports['getQueues']=function(_0x3a00c8,_0x5d0921){var _0x17c5ba={'count':0x0,'rows':[]};var _0x5a7318={};var _0x3a0ca3;var _0x330e87;var _0x168f46;Promise['resolve']()['then'](function(){if(_0x3a00c8[_0xf1cb('0x10')][_0xf1cb('0x17')]){if(!utils[_0xf1cb('0x18')](_0x3a00c8[_0xf1cb('0x10')][_0xf1cb('0x17')])){throw new APIBadRequestError(util[_0xf1cb('0x19')](_0xf1cb('0x1a'),_0x3a00c8['query'][_0xf1cb('0x17')]));}_0x3a0ca3=_0x3a00c8[_0xf1cb('0x10')][_0xf1cb('0x17')]['toLowerCase']();}var _0x12541e=_[_0xf1cb('0x4b')](_0x3a0ca3)+_0xf1cb('0x4c');var _0x4ed4b5=_['map'](db[_0x12541e][_0xf1cb('0x4d')],function(_0x10a6ff){return{'name':_0x10a6ff[_0xf1cb('0x2b')],'type':_0x10a6ff[_0xf1cb('0x2c')][_0xf1cb('0x2d')]};});if(!_0x3a00c8[_0xf1cb('0x10')][_0xf1cb('0x20')]){var _0x454d60=['id',_0xf1cb('0x4e')];if(_0x3a0ca3===_0xf1cb('0x43')){_0x454d60['push']('type');if(_0x3a00c8['query'][_0xf1cb('0x2c')]===_0xf1cb('0x4f')){_0x454d60['push']([_0xf1cb('0x50'),'dialMethod']);}}_0x3a00c8[_0xf1cb('0x10')][_0xf1cb('0x20')]=_0x454d60[_0xf1cb('0x21')](',');}_0x5a7318=qs[_0xf1cb('0x51')](_0x4ed4b5,_0x3a00c8);if(_0x3a00c8[_0xf1cb('0x38')]['role']===_0xf1cb('0x38')){var _0x15ace3={'params':{'id':_0x3a00c8['user'][_0xf1cb('0x52')]},'query':{'section':_0x3a0ca3===_0xf1cb('0x43')&&_0x3a00c8['query']['type']==='outbound'?_0xf1cb('0x53'):_[_0xf1cb('0x4b')](_0x3a0ca3)+_0xf1cb('0x54'),'type':_0x3a00c8[_0xf1cb('0x10')][_0xf1cb('0x2c')],'nolimit':!![],'sort':_0xf1cb('0x4e'),'filter':_0x3a00c8['query'][_0xf1cb('0x55')]}};_0x15ace3['query']=Object[_0xf1cb('0x3c')](_0x15ace3[_0xf1cb('0x10')],_0x3a00c8[_0xf1cb('0x10')]);delete _0x15ace3['query']['id'];return db['UserProfile'][_0xf1cb('0x3e')](_0x15ace3);}return db[_0x12541e][_0xf1cb('0x3f')](_0x5a7318);})[_0xf1cb('0x16')](function(_0x366a5d){_0x17c5ba['count']=_0x366a5d[_0xf1cb('0xa')];_0x330e87=_0x366a5d[_0xf1cb('0x25')];return rtq[_0xf1cb('0x56')](_0x3a00c8,_0x3a0ca3);})[_0xf1cb('0x16')](function(_0x38ffcb){_0x168f46=_0x38ffcb[_0xf1cb('0x25')];return rtq[_0xf1cb('0x57')](_0x330e87,_0x168f46,_0x3a0ca3,_0x3a00c8['query'][_0xf1cb('0x2c')]);})[_0xf1cb('0x16')](function(_0x1389e9){_0x17c5ba[_0xf1cb('0x25')]=_0x1389e9;return _0x17c5ba;})[_0xf1cb('0x16')](respondWithFilteredResult(_0x5d0921,_0x5a7318))[_0xf1cb('0x4a')](APIHandleError(_0x5d0921));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 44d20ab..4d2703a 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2162e0,_0xd18181){var _0x162d05=function(_0x421403){while(--_0x421403){_0x2162e0['push'](_0x2162e0['shift']());}};_0x162d05(++_0xd18181);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x239cd,_0x4387e5){var _0x188f7e=function(_0x42d6e0){while(--_0x42d6e0){_0x239cd['push'](_0x239cd['shift']());}};_0x188f7e(++_0x4387e5);}(_0xe706,0xa3));var _0x6e70=function(_0x378487,_0x1fdc2c){_0x378487=_0x378487-0x0;var _0x3bb63b=_0xe706[_0x378487];return _0x3bb63b;};'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 1d07208..0e37a59 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 _0x7412=['STRING','sequelize'];(function(_0x3bae28,_0x5ca4f5){var _0xb431b=function(_0x1ef970){while(--_0x1ef970){_0x3bae28['push'](_0x3bae28['shift']());}};_0xb431b(++_0x5ca4f5);}(_0x7412,0x161));var _0x2741=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x7412[_0x17928f];return _0x500b63;};'use strict';var Sequelize=require(_0x2741('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x2741('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x2741('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x029b=['STRING','DATE','sequelize','exports'];(function(_0x566760,_0x1f7104){var _0x30ca6d=function(_0x3aa193){while(--_0x3aa193){_0x566760['push'](_0x566760['shift']());}};_0x30ca6d(++_0x1f7104);}(_0x029b,0x66));var _0xb029=function(_0xb90ec4,_0x192e2b){_0xb90ec4=_0xb90ec4-0x0;var _0x2e223f=_0x029b[_0xb90ec4];return _0x2e223f;};'use strict';var Sequelize=require(_0xb029('0x0'));module[_0xb029('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xb029('0x2')]},'scheduledat':{'type':Sequelize[_0xb029('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xb029('0x3')]},'responsetime':{'type':Sequelize[_0xb029('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xb029('0x2')]},'membername':{'type':Sequelize[_0xb029('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 3a2a471..442e14a 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 _0x659f=['./reportAgentPreview.attributes','exports','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x36cd24,_0x16f1fb){var _0x239e3d=function(_0x57c160){while(--_0x57c160){_0x36cd24['push'](_0x36cd24['shift']());}};_0x239e3d(++_0x16f1fb);}(_0x659f,0x142));var _0xf659=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x659f[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf659('0x0'));var util=require('util');var logger=require(_0xf659('0x1'))(_0xf659('0x2'));var moment=require(_0xf659('0x3'));var BPromise=require(_0xf659('0x4'));var rp=require(_0xf659('0x5'));var fs=require('fs');var path=require(_0xf659('0x6'));var rimraf=require('rimraf');var config=require(_0xf659('0x7'));var attributes=require(_0xf659('0x8'));module[_0xf659('0x9')]=function(_0x7cb3cc,_0x48dffc){return _0x7cb3cc['define']('ReportAgentPreview',attributes,{'tableName':_0xf659('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc5a=['request-promise','path','rimraf','./reportAgentPreview.attributes','exports','report_agent_preview','lodash','../../config/logger','api','bluebird'];(function(_0x378ef0,_0x3607bb){var _0x30708a=function(_0xe6b81c){while(--_0xe6b81c){_0x378ef0['push'](_0x378ef0['shift']());}};_0x30708a(++_0x3607bb);}(_0xcc5a,0x1e6));var _0xacc5=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0xcc5a[_0x2ef8f1];return _0x17498d;};'use strict';var _=require(_0xacc5('0x0'));var util=require('util');var logger=require(_0xacc5('0x1'))(_0xacc5('0x2'));var moment=require('moment');var BPromise=require(_0xacc5('0x3'));var rp=require(_0xacc5('0x4'));var fs=require('fs');var path=require(_0xacc5('0x5'));var rimraf=require(_0xacc5('0x6'));var config=require('../../config/environment');var attributes=require(_0xacc5('0x7'));module[_0xacc5('0x8')]=function(_0x4e49e2,_0x2f513a){return _0x4e49e2['define']('ReportAgentPreview',attributes,{'tableName':_0xacc5('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 48a9de1..bb2b722 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 _0x2884=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','options','raw','then','lodash','util','moment','randomstring'];(function(_0x10324d,_0xd0634e){var _0x2d72ce=function(_0x4e698e){while(--_0x4e698e){_0x10324d['push'](_0x10324d['shift']());}};_0x2d72ce(++_0xd0634e);}(_0x2884,0x11a));var _0x4288=function(_0x3c3b51,_0xe90b55){_0x3c3b51=_0x3c3b51-0x0;var _0x303246=_0x2884[_0x3c3b51];return _0x303246;};'use strict';var _=require(_0x4288('0x0'));var util=require(_0x4288('0x1'));var moment=require(_0x4288('0x2'));var BPromise=require('bluebird');var rs=require(_0x4288('0x3'));var fs=require('fs');var Redis=require(_0x4288('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4288('0x5'));var logger=require(_0x4288('0x6'))('rpc');var config=require(_0x4288('0x7'));var jayson=require(_0x4288('0x8'));var client=jayson[_0x4288('0x9')][_0x4288('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18e69a,_0x55c999,_0x341f80){return new BPromise(function(_0x43150a,_0x5ef497){return client[_0x4288('0xb')](_0x18e69a,_0x341f80)['then'](function(_0x238a77){logger[_0x4288('0xc')](_0x4288('0xd'),_0x55c999,_0x4288('0xe'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x55c999,_0x4288('0xe'),JSON[_0x4288('0xf')](_0x238a77));if(_0x238a77[_0x4288('0x10')]){if(_0x238a77['error'][_0x4288('0x11')]===0x1f4){logger[_0x4288('0x10')](_0x4288('0xd'),_0x55c999,_0x238a77['error'][_0x4288('0x12')]);return _0x5ef497(_0x238a77[_0x4288('0x10')][_0x4288('0x12')]);}logger[_0x4288('0x10')](_0x4288('0xd'),_0x55c999,_0x238a77['error'][_0x4288('0x12')]);return _0x43150a(_0x238a77[_0x4288('0x10')]['message']);}else{logger[_0x4288('0xc')](_0x4288('0xd'),_0x55c999,_0x4288('0xe'));_0x43150a(_0x238a77[_0x4288('0x13')][_0x4288('0x12')]);}})[_0x4288('0x14')](function(_0xe3dd7){logger[_0x4288('0x10')](_0x4288('0xd'),_0x55c999,_0xe3dd7);_0x5ef497(_0xe3dd7);});});}exports[_0x4288('0x15')]=function(_0x1fa2de){var _0x3c3164=this;return new Promise(function(_0x25f679,_0x46706e){return db[_0x4288('0x16')]['create'](_0x1fa2de['body'],{'raw':_0x1fa2de['options']?_0x1fa2de[_0x4288('0x17')][_0x4288('0x18')]===undefined?!![]:![]:!![]})[_0x4288('0x19')](function(_0x346ce5){logger['info']('CreateReportAgentPreview',_0x1fa2de);logger['debug'](_0x4288('0x15'),_0x1fa2de,JSON[_0x4288('0xf')](_0x346ce5));_0x25f679(_0x346ce5);})['catch'](function(_0x17ef56){logger[_0x4288('0x10')](_0x4288('0x15'),_0x17ef56[_0x4288('0x12')],_0x1fa2de);_0x46706e(_0x3c3164['error'](0x1f4,_0x17ef56[_0x4288('0x12')]));});});}; \ No newline at end of file +var _0x98fe=['code','message','info','result','catch','CreateReportAgentPreview','create','options','raw','then','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','request','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x51f652,_0x27d885){var _0x2d7627=function(_0x569d8a){while(--_0x569d8a){_0x51f652['push'](_0x51f652['shift']());}};_0x2d7627(++_0x27d885);}(_0x98fe,0xa4));var _0xe98f=function(_0x3a0210,_0x215ecb){_0x3a0210=_0x3a0210-0x0;var _0x3dbe2c=_0x98fe[_0x3a0210];return _0x3dbe2c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe98f('0x0'));var BPromise=require('bluebird');var rs=require(_0xe98f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe98f('0x2'))(_0xe98f('0x3'));var config=require(_0xe98f('0x4'));var jayson=require(_0xe98f('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1559c7,_0x4ffcce,_0x374b84){return new BPromise(function(_0x259d33,_0x14af94){return client[_0xe98f('0x6')](_0x1559c7,_0x374b84)['then'](function(_0x52ec4e){logger['info'](_0xe98f('0x7'),_0x4ffcce,'request\x20sent');logger[_0xe98f('0x8')](_0xe98f('0x9'),_0x4ffcce,_0xe98f('0xa'),JSON['stringify'](_0x52ec4e));if(_0x52ec4e[_0xe98f('0xb')]){if(_0x52ec4e[_0xe98f('0xb')][_0xe98f('0xc')]===0x1f4){logger[_0xe98f('0xb')](_0xe98f('0x7'),_0x4ffcce,_0x52ec4e[_0xe98f('0xb')]['message']);return _0x14af94(_0x52ec4e['error'][_0xe98f('0xd')]);}logger[_0xe98f('0xb')](_0xe98f('0x7'),_0x4ffcce,_0x52ec4e['error'][_0xe98f('0xd')]);return _0x259d33(_0x52ec4e[_0xe98f('0xb')][_0xe98f('0xd')]);}else{logger[_0xe98f('0xe')](_0xe98f('0x7'),_0x4ffcce,_0xe98f('0xa'));_0x259d33(_0x52ec4e[_0xe98f('0xf')][_0xe98f('0xd')]);}})[_0xe98f('0x10')](function(_0x4e5f56){logger[_0xe98f('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x4ffcce,_0x4e5f56);_0x14af94(_0x4e5f56);});});}exports[_0xe98f('0x11')]=function(_0x1d22a4){var _0xcfa848=this;return new Promise(function(_0x12b7d2,_0x188971){return db['ReportAgentPreview'][_0xe98f('0x12')](_0x1d22a4['body'],{'raw':_0x1d22a4[_0xe98f('0x13')]?_0x1d22a4[_0xe98f('0x13')][_0xe98f('0x14')]===undefined?!![]:![]:!![]})[_0xe98f('0x15')](function(_0x2b4fb2){logger['info'](_0xe98f('0x11'),_0x1d22a4);logger[_0xe98f('0x8')](_0xe98f('0x11'),_0x1d22a4,JSON['stringify'](_0x2b4fb2));_0x12b7d2(_0x2b4fb2);})[_0xe98f('0x10')](function(_0xcbb8be){logger[_0xe98f('0xb')](_0xe98f('0x11'),_0xcbb8be[_0xe98f('0xd')],_0x1d22a4);_0x188971(_0xcfa848['error'](0x1f4,_0xcbb8be[_0xe98f('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b0186c5..01c3e13 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 _0xad07=['mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7ad0('0x0'));var util=require(_0x7ad0('0x1'));var path=require('path');var express=require(_0x7ad0('0x2'));var router=express[_0x7ad0('0x3')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x7ad0('0x4')](_0x7ad0('0x5'),auth[_0x7ad0('0x6')](),controller['voiceChannels']);router[_0x7ad0('0x4')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x7ad0('0x7')]);router[_0x7ad0('0x4')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x7ad0('0x8')]);router[_0x7ad0('0x4')]('/voice/queues',auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x9')]);router[_0x7ad0('0x4')](_0x7ad0('0xa'),auth['isAuthenticated'](),controller[_0x7ad0('0xb')]);router[_0x7ad0('0x4')](_0x7ad0('0xc'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0xd')]);router[_0x7ad0('0x4')](_0x7ad0('0xe'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0xf')]);router['get'](_0x7ad0('0x10'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x11')]);router[_0x7ad0('0x4')]('/sms/queues',auth['isAuthenticated'](),controller[_0x7ad0('0x12')]);router[_0x7ad0('0x4')](_0x7ad0('0x13'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x14')]);router[_0x7ad0('0x4')](_0x7ad0('0x15'),auth[_0x7ad0('0x6')](),controller['faxQueues']);router[_0x7ad0('0x4')](_0x7ad0('0x16'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0x7ad0('0x4')]('/voice/queues/channels',auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x17')]);router['get'](_0x7ad0('0x18'),auth['isAuthenticated'](),controller[_0x7ad0('0x19')]);router['get'](_0x7ad0('0x1a'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x1b')]);router[_0x7ad0('0x4')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x7ad0('0x6')](),controller['voiceQueuesChannelRedirect']);router[_0x7ad0('0x4')](_0x7ad0('0x1c'),auth['isAuthenticated'](),controller[_0x7ad0('0x1d')]);router['put']('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x7ad0('0x1e')]);router['get'](_0x7ad0('0x1f'),auth['isAuthenticated'](),controller[_0x7ad0('0x20')]);router[_0x7ad0('0x4')](_0x7ad0('0x21'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x22')]);router[_0x7ad0('0x4')]('/agents',auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x23')]);router[_0x7ad0('0x24')](_0x7ad0('0x25'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x26')]);router[_0x7ad0('0x4')](_0x7ad0('0x27'),auth['isAuthenticated'](),controller['telephones']);router[_0x7ad0('0x4')](_0x7ad0('0x28'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x29')]);router[_0x7ad0('0x4')]('/campaigns',auth['isAuthenticated'](),controller[_0x7ad0('0x2a')]);router[_0x7ad0('0x4')](_0x7ad0('0x2b'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x2c')]);router[_0x7ad0('0x4')](_0x7ad0('0x2d'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x2e')]);router[_0x7ad0('0x4')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x7ad0('0x2f')]);router[_0x7ad0('0x4')](_0x7ad0('0x30'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x31')]);router[_0x7ad0('0x4')](_0x7ad0('0x32'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x33')]);router[_0x7ad0('0x4')](_0x7ad0('0x34'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x35')]);router['get'](_0x7ad0('0x36'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x37')]);router[_0x7ad0('0x4')](_0x7ad0('0x38'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x39')]);router[_0x7ad0('0x3a')](_0x7ad0('0x3b'),auth[_0x7ad0('0x6')](),controller['queueNotify'](_0x7ad0('0x3c')));router['get'](_0x7ad0('0x3d'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x3e')]);router['post'](_0x7ad0('0x3f'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x40')](_0x7ad0('0x41')));router['get'](_0x7ad0('0x42'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0x7ad0('0x3a')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x7ad0('0x40')](_0x7ad0('0x43')));router[_0x7ad0('0x4')](_0x7ad0('0x44'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x45')]);router['post'](_0x7ad0('0x46'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x40')]('openchannel'));router[_0x7ad0('0x4')](_0x7ad0('0x47'),auth[_0x7ad0('0x6')](),controller['showOpenchannelQueues']);router[_0x7ad0('0x3a')](_0x7ad0('0x48'),auth[_0x7ad0('0x6')](),controller['queueNotify']('sms'));router[_0x7ad0('0x3a')](_0x7ad0('0x49'),auth['isAuthenticated'](),controller['queueNotify'](_0x7ad0('0x4a')));router[_0x7ad0('0x4')](_0x7ad0('0x4b'),auth[_0x7ad0('0x6')](),controller['showSmsQueues']);router['get']('/whatsapp/queues/:id',auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x4c')]);router[_0x7ad0('0x3a')](_0x7ad0('0x4d'),auth['isAuthenticated'](),controller[_0x7ad0('0x4e')]);module[_0x7ad0('0x4f')]=router; \ No newline at end of file +var _0xda20=['agents','put','agentCapacity','/telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','/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','path','../../components/auth/service','get','/voice/channels','voiceChannels','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/whatsapp/queues','whatsappQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents'];(function(_0x3d2b29,_0x31ae1a){var _0x387973=function(_0x240e7b){while(--_0x240e7b){_0x3d2b29['push'](_0x3d2b29['shift']());}};_0x387973(++_0x31ae1a);}(_0xda20,0x1d9));var _0x0da2=function(_0x55a1c9,_0xc8aa0a){_0x55a1c9=_0x55a1c9-0x0;var _0x4dce7e=_0xda20[_0x55a1c9];return _0x4dce7e;};'use strict';var multer=require(_0x0da2('0x0'));var util=require('util');var path=require(_0x0da2('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x0da2('0x2'));var controller=require('./rpc.controller');router[_0x0da2('0x3')](_0x0da2('0x4'),auth['isAuthenticated'](),controller[_0x0da2('0x5')]);router[_0x0da2('0x3')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x0da2('0x6')](),controller[_0x0da2('0x7')]);router[_0x0da2('0x3')](_0x0da2('0x8'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x9')]);router[_0x0da2('0x3')](_0x0da2('0xa'),auth[_0x0da2('0x6')](),controller['voiceQueues']);router[_0x0da2('0x3')](_0x0da2('0xb'),auth[_0x0da2('0x6')](),controller[_0x0da2('0xc')]);router['get']('/mail/queues',auth[_0x0da2('0x6')](),controller[_0x0da2('0xd')]);router[_0x0da2('0x3')](_0x0da2('0xe'),auth[_0x0da2('0x6')](),controller[_0x0da2('0xf')]);router[_0x0da2('0x3')]('/openchannel/queues',auth[_0x0da2('0x6')](),controller['openchannelQueues']);router['get']('/sms/queues',auth[_0x0da2('0x6')](),controller['smsQueues']);router[_0x0da2('0x3')](_0x0da2('0x10'),auth['isAuthenticated'](),controller[_0x0da2('0x11')]);router[_0x0da2('0x3')]('/fax/queues',auth[_0x0da2('0x6')](),controller[_0x0da2('0x12')]);router[_0x0da2('0x3')]('/voice/queues/preview/:id',auth[_0x0da2('0x6')](),controller[_0x0da2('0x13')]);router['get']('/voice/queues/channels',auth[_0x0da2('0x6')](),controller['voiceQueuesChannels']);router[_0x0da2('0x3')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller['voiceQueuesChannel']);router['get'](_0x0da2('0x14'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x15')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x0da2('0x16')]);router[_0x0da2('0x3')](_0x0da2('0x17'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x18')]);router['put'](_0x0da2('0x17'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x19')]);router[_0x0da2('0x3')](_0x0da2('0x1a'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x1b')]);router[_0x0da2('0x3')](_0x0da2('0x1c'),auth['isAuthenticated'](),controller[_0x0da2('0x1d')]);router['get'](_0x0da2('0x1e'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x1f')]);router[_0x0da2('0x20')]('/agents/:id/capacity',auth[_0x0da2('0x6')](),controller[_0x0da2('0x21')]);router[_0x0da2('0x3')](_0x0da2('0x22'),auth[_0x0da2('0x6')](),controller['telephones']);router[_0x0da2('0x3')]('/trunks',auth[_0x0da2('0x6')](),controller[_0x0da2('0x23')]);router[_0x0da2('0x3')](_0x0da2('0x24'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x25')]);router[_0x0da2('0x3')](_0x0da2('0x26'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x27')]);router[_0x0da2('0x3')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x0da2('0x3')](_0x0da2('0x28'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0x0da2('0x3')](_0x0da2('0x29'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x2a')]);router['get'](_0x0da2('0x2b'),auth['isAuthenticated'](),controller[_0x0da2('0x2c')]);router[_0x0da2('0x3')](_0x0da2('0x2d'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x2e')]);router[_0x0da2('0x3')](_0x0da2('0x2f'),auth['isAuthenticated'](),controller[_0x0da2('0x30')]);router[_0x0da2('0x3')](_0x0da2('0x31'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x32')]);router[_0x0da2('0x33')]('/mail/queues/:id/notify',auth[_0x0da2('0x6')](),controller[_0x0da2('0x34')](_0x0da2('0x35')));router[_0x0da2('0x3')]('/mail/queues/:id',auth['isAuthenticated'](),controller[_0x0da2('0x36')]);router[_0x0da2('0x33')](_0x0da2('0x37'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x34')](_0x0da2('0x38')));router[_0x0da2('0x3')](_0x0da2('0x39'),auth[_0x0da2('0x6')](),controller['showChatQueues']);router[_0x0da2('0x33')](_0x0da2('0x3a'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x34')](_0x0da2('0x3b')));router[_0x0da2('0x3')](_0x0da2('0x3c'),auth[_0x0da2('0x6')](),controller['showFaxQueues']);router[_0x0da2('0x33')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x0da2('0x34')]('openchannel'));router[_0x0da2('0x3')](_0x0da2('0x3d'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x3e')]);router['post'](_0x0da2('0x3f'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x34')](_0x0da2('0x40')));router[_0x0da2('0x33')](_0x0da2('0x41'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x34')]('whatsapp'));router['get'](_0x0da2('0x42'),auth['isAuthenticated'](),controller[_0x0da2('0x43')]);router['get'](_0x0da2('0x44'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router['post'](_0x0da2('0x45'),auth[_0x0da2('0x6')](),controller[_0x0da2('0x46')]);module[_0x0da2('0x47')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 3b07395..a095aa1 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(_0x549502,_0x5ce153){var _0xb679c4=function(_0x122d41){while(--_0x122d41){_0x549502['push'](_0x549502['shift']());}};_0xb679c4(++_0x5ce153);}(_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 +var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x529e31,_0x25720a){var _0x3d4894=function(_0x237564){while(--_0x237564){_0x529e31['push'](_0x529e31['shift']());}};_0x3d4894(++_0x25720a);}(_0xe706,0xa3));var _0x6e70=function(_0x3051d9,_0x3de423){_0x3051d9=_0x3051d9-0x0;var _0xcc0a87=_0xe706[_0x3051d9];return _0xcc0a87;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index eebd663..a872967 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 _0xec49=['show','get','/:id/run','run','post','create','update','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','/:id'];(function(_0x4415a7,_0x5e921f){var _0x3ec6e3=function(_0x231b43){while(--_0x231b43){_0x4415a7['push'](_0x4415a7['shift']());}};_0x3ec6e3(++_0x5e921f);}(_0xec49,0x9a));var _0x9ec4=function(_0x820608,_0x6c3dc2){_0x820608=_0x820608-0x0;var _0x558912=_0xec49[_0x820608];return _0x558912;};'use strict';var multer=require('multer');var util=require(_0x9ec4('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9ec4('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x9ec4('0x2'));var interaction=require(_0x9ec4('0x3'));var config=require(_0x9ec4('0x4'));var controller=require(_0x9ec4('0x5'));router['get']('/',auth[_0x9ec4('0x6')](),controller['index']);router['get'](_0x9ec4('0x7'),auth[_0x9ec4('0x6')](),controller[_0x9ec4('0x8')]);router[_0x9ec4('0x9')](_0x9ec4('0xa'),auth[_0x9ec4('0x6')](),controller[_0x9ec4('0xb')]);router[_0x9ec4('0xc')]('/',auth['isAuthenticated'](),controller[_0x9ec4('0xd')]);router['put']('/:id',auth[_0x9ec4('0x6')](),controller[_0x9ec4('0xe')]);router[_0x9ec4('0xf')]('/:id',auth[_0x9ec4('0x6')](),controller[_0x9ec4('0x10')]);module[_0x9ec4('0x11')]=router; \ No newline at end of file +var _0x1776=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','run','post','update','destroy','exports','multer'];(function(_0x317943,_0x1a4079){var _0x5a578e=function(_0x38e9a6){while(--_0x38e9a6){_0x317943['push'](_0x317943['shift']());}};_0x5a578e(++_0x1a4079);}(_0x1776,0x8f));var _0x6177=function(_0x321dda,_0x4a0a26){_0x321dda=_0x321dda-0x0;var _0x5e259d=_0x1776[_0x321dda];return _0x5e259d;};'use strict';var multer=require(_0x6177('0x0'));var util=require(_0x6177('0x1'));var path=require(_0x6177('0x2'));var timeout=require(_0x6177('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6177('0x4'));var auth=require(_0x6177('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6177('0x6'));var controller=require('./schedule.controller');router[_0x6177('0x7')]('/',auth[_0x6177('0x8')](),controller['index']);router[_0x6177('0x7')](_0x6177('0x9'),auth[_0x6177('0x8')](),controller[_0x6177('0xa')]);router[_0x6177('0x7')]('/:id/run',auth[_0x6177('0x8')](),controller[_0x6177('0xb')]);router[_0x6177('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x6177('0x8')](),controller[_0x6177('0xd')]);router['delete'](_0x6177('0x9'),auth[_0x6177('0x8')](),controller[_0x6177('0xe')]);module[_0x6177('0xf')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index d03b3fa..ae0570b 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 _0x7b6d=['DATE','ENUM','months','weeks','days','csv','pdf','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*'];(function(_0x324800,_0x48a149){var _0x2407e5=function(_0x30cc18){while(--_0x30cc18){_0x324800['push'](_0x324800['shift']());}};_0x2407e5(++_0x48a149);}(_0x7b6d,0x95));var _0xd7b6=function(_0x4b4152,_0x374b67){_0x4b4152=_0x4b4152-0x0;var _0x4ee178=_0x7b6d[_0x4b4152];return _0x4ee178;};'use strict';var Sequelize=require(_0xd7b6('0x0'));module[_0xd7b6('0x1')]={'name':{'type':Sequelize[_0xd7b6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7b6('0x2')]},'active':{'type':Sequelize[_0xd7b6('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd7b6('0x2')],'allowNull':![],'defaultValue':_0xd7b6('0x4')},'startAt':{'type':Sequelize[_0xd7b6('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xd7b6('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd7b6('0x6')]('years','quarters',_0xd7b6('0x7'),_0xd7b6('0x8'),_0xd7b6('0x9'),'hours','minutes'),'allowNull':![],'defaultValue':_0xd7b6('0x9')},'output':{'type':Sequelize[_0xd7b6('0x6')](_0xd7b6('0xa'),_0xd7b6('0xb'),'xlsx'),'allowNull':![],'defaultValue':_0xd7b6('0xa')},'type':{'type':Sequelize[_0xd7b6('0x6')](_0xd7b6('0xc'),'default'),'allowNull':![],'defaultValue':_0xd7b6('0xc')},'sendMail':{'type':Sequelize[_0xd7b6('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xd7b6('0x2')]},'cc':{'type':Sequelize[_0xd7b6('0xd')]},'bcc':{'type':Sequelize[_0xd7b6('0xd')]},'sendIfEmpty':{'type':Sequelize[_0xd7b6('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x294a=['months','weeks','days','minutes','pdf','csv','custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters'];(function(_0x2f4d41,_0x525047){var _0x3b0bb2=function(_0x19960d){while(--_0x19960d){_0x2f4d41['push'](_0x2f4d41['shift']());}};_0x3b0bb2(++_0x525047);}(_0x294a,0x1a1));var _0xa294=function(_0x2cd9e8,_0x3520ed){_0x2cd9e8=_0x2cd9e8-0x0;var _0x2f712f=_0x294a[_0x2cd9e8];return _0x2f712f;};'use strict';var Sequelize=require(_0xa294('0x0'));module['exports']={'name':{'type':Sequelize[_0xa294('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa294('0x1')]},'active':{'type':Sequelize[_0xa294('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa294('0x1')],'allowNull':![],'defaultValue':_0xa294('0x3')},'startAt':{'type':Sequelize[_0xa294('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xa294('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xa294('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa294('0x6')]('years',_0xa294('0x7'),_0xa294('0x8'),_0xa294('0x9'),_0xa294('0xa'),'hours',_0xa294('0xb')),'allowNull':![],'defaultValue':_0xa294('0xa')},'output':{'type':Sequelize[_0xa294('0x6')]('csv',_0xa294('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0xa294('0xd')},'type':{'type':Sequelize[_0xa294('0x6')](_0xa294('0xe'),_0xa294('0xf')),'allowNull':![],'defaultValue':_0xa294('0xe')},'sendMail':{'type':Sequelize[_0xa294('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xa294('0x1')]},'cc':{'type':Sequelize[_0xa294('0x10')]},'bcc':{'type':Sequelize[_0xa294('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 1c2193e..ad4caa5 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 _0x14ff=['merge','options','Schedule','includeAll','findAll','catch','show','params','keys','length','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','Scheduler','UserProfileResource','destroy','end','error','stack','name','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','VIRTUAL'];(function(_0x561c4b,_0x1810d5){var _0x3c7e03=function(_0x28c4c6){while(--_0x28c4c6){_0x561c4b['push'](_0x561c4b['shift']());}};_0x3c7e03(++_0x1810d5);}(_0x14ff,0x14c));var _0xf14f=function(_0x1083b5,_0x109255){_0x1083b5=_0x1083b5-0x0;var _0x4dc854=_0x14ff[_0x1083b5];return _0x4dc854;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf14f('0x0'));var BPromise=require(_0xf14f('0x1'));var Mustache=require('mustache');var util=require(_0xf14f('0x2'));var path=require(_0xf14f('0x3'));var sox=require(_0xf14f('0x4'));var csv=require(_0xf14f('0x5'));var ejs=require(_0xf14f('0x6'));var fs=require('fs');var fs_extra=require(_0xf14f('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf14f('0x8'));var deskjs=require(_0xf14f('0x9'));var toCsv=require(_0xf14f('0x5'));var querystring=require(_0xf14f('0xa'));var Papa=require(_0xf14f('0xb'));var Redis=require(_0xf14f('0xc'));var authService=require(_0xf14f('0xd'));var qs=require(_0xf14f('0xe'));var as=require(_0xf14f('0xf'));var hardwareService=require(_0xf14f('0x10'));var logger=require(_0xf14f('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xf14f('0x12'));var licenseUtil=require(_0xf14f('0x13'));var db=require(_0xf14f('0x14'))['db'];function respondWithStatusCode(_0x3971d4,_0x45b742){_0x45b742=_0x45b742||0xcc;return function(_0x1ae6f7){if(_0x1ae6f7){return _0x3971d4[_0xf14f('0x15')](_0x45b742);}return _0x3971d4[_0xf14f('0x16')](_0x45b742)['end']();};}function respondWithResult(_0x9973cb,_0x590fab){_0x590fab=_0x590fab||0xc8;return function(_0x3d7d89){if(_0x3d7d89){return _0x9973cb['status'](_0x590fab)[_0xf14f('0x17')](_0x3d7d89);}};}function respondWithFilteredResult(_0xb214a7,_0xb805ee){return function(_0x10fba4){if(_0x10fba4){var _0x57a5f5=typeof _0xb805ee[_0xf14f('0x18')]===_0xf14f('0x19')&&typeof _0xb805ee[_0xf14f('0x1a')]==='undefined';var _0x4e6b9c=_0x10fba4[_0xf14f('0x1b')];var _0x1f9c3d=_0x57a5f5?0x0:_0xb805ee[_0xf14f('0x18')];var _0x40b0fe=_0x57a5f5?_0x10fba4[_0xf14f('0x1b')]:_0xb805ee['offset']+_0xb805ee[_0xf14f('0x1a')];var _0x752893;if(_0x40b0fe>=_0x4e6b9c){_0x40b0fe=_0x4e6b9c;_0x752893=0xc8;}else{_0x752893=0xce;}_0xb214a7[_0xf14f('0x16')](_0x752893);return _0xb214a7['set'](_0xf14f('0x1c'),_0x1f9c3d+'-'+_0x40b0fe+'/'+_0x4e6b9c)[_0xf14f('0x17')](_0x10fba4);}return null;};}function patchUpdates(_0x5a4e02){return function(_0x1dd08a){try{jsonpatch[_0xf14f('0x1d')](_0x1dd08a,_0x5a4e02,!![]);}catch(_0x21c54b){return BPromise[_0xf14f('0x1e')](_0x21c54b);}return _0x1dd08a[_0xf14f('0x1f')]();};}function saveUpdates(_0x4913fc,_0x43f7d8){return function(_0x378731){if(_0x378731){return _0x378731[_0xf14f('0x20')](_0x4913fc)[_0xf14f('0x21')](function(_0x4567ba){return _0x4567ba;});}return null;};}function removeEntity(_0x5c71f8,_0x5ab585){return function(_0x2b42e4){if(_0x2b42e4){return _0x2b42e4['destroy']()[_0xf14f('0x21')](function(){var _0x26581c=_0x2b42e4['get']({'plain':!![]});var _0x4ad713=_0xf14f('0x22');return db[_0xf14f('0x23')][_0xf14f('0x24')]({'where':{'type':_0x4ad713,'resourceId':_0x26581c['id']}})[_0xf14f('0x21')](function(){return _0x2b42e4;});})[_0xf14f('0x21')](function(){_0x5c71f8['status'](0xcc)[_0xf14f('0x25')]();});}};}function handleEntityNotFound(_0x3bf47b,_0x33e3f4){return function(_0x554623){if(!_0x554623){_0x3bf47b[_0xf14f('0x15')](0x194);}return _0x554623;};}function handleError(_0x2427c5,_0x324343){_0x324343=_0x324343||0x1f4;return function(_0x436f22){logger[_0xf14f('0x26')](_0x436f22[_0xf14f('0x27')]);if(_0x436f22[_0xf14f('0x28')]){delete _0x436f22['name'];}_0x2427c5[_0xf14f('0x16')](_0x324343)['send'](_0x436f22);};}exports['index']=function(_0x66e7a5,_0x415306){var _0x3777ff={},_0x4a2c2c={},_0x4d80da={'count':0x0,'rows':[]};var _0x6ecfe5=_['map'](db['Schedule'][_0xf14f('0x29')],function(_0x182ae9){return{'name':_0x182ae9[_0xf14f('0x2a')],'type':_0x182ae9[_0xf14f('0x2b')][_0xf14f('0x2c')]};});_0x4a2c2c['model']=_[_0xf14f('0x2d')](_0x6ecfe5,_0xf14f('0x28'));_0x4a2c2c[_0xf14f('0x2e')]=_['keys'](_0x66e7a5[_0xf14f('0x2e')]);_0x4a2c2c[_0xf14f('0x2f')]=_[_0xf14f('0x30')](_0x4a2c2c[_0xf14f('0x31')],_0x4a2c2c[_0xf14f('0x2e')]);_0x3777ff[_0xf14f('0x32')]=_['intersection'](_0x4a2c2c['model'],qs[_0xf14f('0x33')](_0x66e7a5[_0xf14f('0x2e')]['fields']));_0x3777ff[_0xf14f('0x32')]=_0x3777ff['attributes']['length']?_0x3777ff[_0xf14f('0x32')]:_0x4a2c2c['model'];if(!_0x66e7a5['query'][_0xf14f('0x34')]('nolimit')){_0x3777ff[_0xf14f('0x1a')]=qs[_0xf14f('0x1a')](_0x66e7a5[_0xf14f('0x2e')][_0xf14f('0x1a')]);_0x3777ff[_0xf14f('0x18')]=qs['offset'](_0x66e7a5[_0xf14f('0x2e')][_0xf14f('0x18')]);}_0x3777ff['order']=qs['sort'](_0x66e7a5[_0xf14f('0x2e')][_0xf14f('0x35')]);_0x3777ff[_0xf14f('0x36')]=qs['filters'](_[_0xf14f('0x37')](_0x66e7a5['query'],_0x4a2c2c[_0xf14f('0x2f')]),_0x6ecfe5);if(_0x66e7a5[_0xf14f('0x2e')][_0xf14f('0x38')]){_0x3777ff[_0xf14f('0x36')]=_['merge'](_0x3777ff['where'],{'$or':_[_0xf14f('0x2d')](_0x6ecfe5,function(_0x65c0ea){if(_0x65c0ea[_0xf14f('0x2b')]!==_0xf14f('0x39')){var _0x313aec={};_0x313aec[_0x65c0ea[_0xf14f('0x28')]]={'$like':'%'+_0x66e7a5[_0xf14f('0x2e')][_0xf14f('0x38')]+'%'};return _0x313aec;}})});}_0x3777ff=_[_0xf14f('0x3a')]({},_0x3777ff,_0x66e7a5[_0xf14f('0x3b')]);var _0x238f2e={'where':_0x3777ff['where']};return db[_0xf14f('0x3c')][_0xf14f('0x1b')](_0x238f2e)[_0xf14f('0x21')](function(_0x352ad1){_0x4d80da[_0xf14f('0x1b')]=_0x352ad1;if(_0x66e7a5[_0xf14f('0x2e')][_0xf14f('0x3d')]){_0x3777ff['include']=[{'all':!![]}];}return db[_0xf14f('0x3c')][_0xf14f('0x3e')](_0x3777ff);})[_0xf14f('0x21')](function(_0x12d635){_0x4d80da['rows']=_0x12d635;return _0x4d80da;})[_0xf14f('0x21')](respondWithFilteredResult(_0x415306,_0x3777ff))[_0xf14f('0x3f')](handleError(_0x415306,null));};exports[_0xf14f('0x40')]=function(_0x1621a1,_0x239025){var _0x211a94={'raw':![],'where':{'id':_0x1621a1[_0xf14f('0x41')]['id']}},_0x147c10={};_0x147c10[_0xf14f('0x31')]=_[_0xf14f('0x42')](db[_0xf14f('0x3c')][_0xf14f('0x29')]);_0x147c10['query']=_[_0xf14f('0x42')](_0x1621a1['query']);_0x147c10[_0xf14f('0x2f')]=_['intersection'](_0x147c10[_0xf14f('0x31')],_0x147c10['query']);_0x211a94['attributes']=_[_0xf14f('0x30')](_0x147c10[_0xf14f('0x31')],qs[_0xf14f('0x33')](_0x1621a1[_0xf14f('0x2e')]['fields']));_0x211a94[_0xf14f('0x32')]=_0x211a94[_0xf14f('0x32')][_0xf14f('0x43')]?_0x211a94['attributes']:_0x147c10[_0xf14f('0x31')];if(_0x1621a1[_0xf14f('0x2e')][_0xf14f('0x3d')]){_0x211a94[_0xf14f('0x44')]=[{'all':!![]}];}_0x211a94=_[_0xf14f('0x3a')]({},_0x211a94,_0x1621a1[_0xf14f('0x3b')]);return db[_0xf14f('0x3c')][_0xf14f('0x45')](_0x211a94)[_0xf14f('0x21')](handleEntityNotFound(_0x239025,null))[_0xf14f('0x21')](respondWithResult(_0x239025,null))['catch'](handleError(_0x239025,null));};exports[_0xf14f('0x46')]=function(_0x1cfe1c,_0x1ac6aa){return db[_0xf14f('0x3c')][_0xf14f('0x46')](_0x1cfe1c[_0xf14f('0x47')],{})[_0xf14f('0x21')](function(_0x1c5a3d){var _0x12b5ec=_0x1cfe1c['user'][_0xf14f('0x48')]({'plain':!![]});if(!_0x12b5ec)throw new Error(_0xf14f('0x49'));if(_0x12b5ec[_0xf14f('0x4a')]==='user'){var _0x231286=_0x1c5a3d[_0xf14f('0x48')]({'plain':!![]});var _0x9b063d=_0xf14f('0x22');return db['UserProfileSection'][_0xf14f('0x45')]({'where':{'name':_0x9b063d,'userProfileId':_0x12b5ec['userProfileId']},'raw':!![]})['then'](function(_0x4bca3b){if(_0x4bca3b&&_0x4bca3b['autoAssociation']===0x0){return db[_0xf14f('0x23')][_0xf14f('0x46')]({'name':_0x231286['name'],'resourceId':_0x231286['id'],'type':_0x4bca3b[_0xf14f('0x28')],'sectionId':_0x4bca3b['id']},{})[_0xf14f('0x21')](function(){return _0x1c5a3d;});}else{return _0x1c5a3d;}})[_0xf14f('0x3f')](function(_0x248d66){logger[_0xf14f('0x26')](_0xf14f('0x4b'),_0x248d66);throw _0x248d66;});}return _0x1c5a3d;})[_0xf14f('0x21')](respondWithResult(_0x1ac6aa,0xc9))[_0xf14f('0x3f')](handleError(_0x1ac6aa,null));};exports[_0xf14f('0x20')]=function(_0x34a911,_0x1e6104){if(_0x34a911['body']['id']){delete _0x34a911[_0xf14f('0x47')]['id'];}return db[_0xf14f('0x3c')]['find']({'where':{'id':_0x34a911[_0xf14f('0x41')]['id']}})[_0xf14f('0x21')](handleEntityNotFound(_0x1e6104,null))[_0xf14f('0x21')](saveUpdates(_0x34a911[_0xf14f('0x47')],null))[_0xf14f('0x21')](respondWithResult(_0x1e6104,null))[_0xf14f('0x3f')](handleError(_0x1e6104,null));};exports[_0xf14f('0x24')]=function(_0x4736f,_0x4cb1e6){return db[_0xf14f('0x3c')][_0xf14f('0x45')]({'where':{'id':_0x4736f['params']['id']}})['then'](handleEntityNotFound(_0x4cb1e6,null))[_0xf14f('0x21')](removeEntity(_0x4cb1e6,null))[_0xf14f('0x3f')](handleError(_0x4cb1e6,null));};exports[_0xf14f('0x4c')]=function(_0x4c2ea5,_0xa1f63d,_0x44c9ea){var _0x524c7e=require(_0xf14f('0x4d'));return db['Schedule'][_0xf14f('0x45')]({'where':{'id':_0x4c2ea5['params']['id']},'raw':!![]})[_0xf14f('0x21')](handleEntityNotFound(_0xa1f63d,null))['then'](function(){_0x524c7e[_0xf14f('0x4c')](_0x4c2ea5['params']['id']);})['then'](respondWithStatusCode(_0xa1f63d,null))[_0xf14f('0x3f')](handleError(_0xa1f63d,null));}; \ No newline at end of file +var _0x1069=['undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','map','fieldName','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','Schedule','includeAll','include','rows','catch','show','rawAttributes','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','params','run','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset'];(function(_0x39fe8c,_0x4822cd){var _0x151f1a=function(_0x4bb688){while(--_0x4bb688){_0x39fe8c['push'](_0x39fe8c['shift']());}};_0x151f1a(++_0x4822cd);}(_0x1069,0x192));var _0x9106=function(_0x266710,_0x5100cb){_0x266710=_0x266710-0x0;var _0x1f583a=_0x1069[_0x266710];return _0x1f583a;};'use strict';var emlformat=require(_0x9106('0x0'));var rimraf=require(_0x9106('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9106('0x2'));var moment=require(_0x9106('0x3'));var BPromise=require(_0x9106('0x4'));var Mustache=require(_0x9106('0x5'));var util=require(_0x9106('0x6'));var path=require(_0x9106('0x7'));var sox=require(_0x9106('0x8'));var csv=require(_0x9106('0x9'));var ejs=require(_0x9106('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9106('0xb'));var squel=require(_0x9106('0xc'));var crypto=require(_0x9106('0xd'));var jsforce=require(_0x9106('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9106('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9106('0xf'));var qs=require(_0x9106('0x10'));var as=require(_0x9106('0x11'));var hardwareService=require(_0x9106('0x12'));var logger=require(_0x9106('0x13'))(_0x9106('0x14'));var utils=require('../../config/utils');var config=require(_0x9106('0x15'));var licenseUtil=require(_0x9106('0x16'));var db=require(_0x9106('0x17'))['db'];function respondWithStatusCode(_0x2d688b,_0x4164f7){_0x4164f7=_0x4164f7||0xcc;return function(_0x2d2ac6){if(_0x2d2ac6){return _0x2d688b[_0x9106('0x18')](_0x4164f7);}return _0x2d688b['status'](_0x4164f7)[_0x9106('0x19')]();};}function respondWithResult(_0x3a8a13,_0x1df8c1){_0x1df8c1=_0x1df8c1||0xc8;return function(_0x137e95){if(_0x137e95){return _0x3a8a13[_0x9106('0x1a')](_0x1df8c1)['json'](_0x137e95);}};}function respondWithFilteredResult(_0x3915d7,_0x5a72bb){return function(_0x3c2c12){if(_0x3c2c12){var _0x2cecbd=typeof _0x5a72bb[_0x9106('0x1b')]===_0x9106('0x1c')&&typeof _0x5a72bb[_0x9106('0x1d')]===_0x9106('0x1c');var _0x2a25fe=_0x3c2c12[_0x9106('0x1e')];var _0x2beeac=_0x2cecbd?0x0:_0x5a72bb[_0x9106('0x1b')];var _0x4950dd=_0x2cecbd?_0x3c2c12['count']:_0x5a72bb[_0x9106('0x1b')]+_0x5a72bb[_0x9106('0x1d')];var _0x1b0cab;if(_0x4950dd>=_0x2a25fe){_0x4950dd=_0x2a25fe;_0x1b0cab=0xc8;}else{_0x1b0cab=0xce;}_0x3915d7[_0x9106('0x1a')](_0x1b0cab);return _0x3915d7[_0x9106('0x1f')](_0x9106('0x20'),_0x2beeac+'-'+_0x4950dd+'/'+_0x2a25fe)[_0x9106('0x21')](_0x3c2c12);}return null;};}function patchUpdates(_0x48cc76){return function(_0x21b007){try{jsonpatch[_0x9106('0x22')](_0x21b007,_0x48cc76,!![]);}catch(_0x3031bf){return BPromise['reject'](_0x3031bf);}return _0x21b007[_0x9106('0x23')]();};}function saveUpdates(_0x149e04,_0x4aad7){return function(_0x43270c){if(_0x43270c){return _0x43270c[_0x9106('0x24')](_0x149e04)[_0x9106('0x25')](function(_0x2e2d3e){return _0x2e2d3e;});}return null;};}function removeEntity(_0x4d2993,_0x3f3214){return function(_0x3b7cd2){if(_0x3b7cd2){return _0x3b7cd2[_0x9106('0x26')]()[_0x9106('0x25')](function(){var _0xb106b1=_0x3b7cd2[_0x9106('0x27')]({'plain':!![]});var _0x24ba1d=_0x9106('0x28');return db[_0x9106('0x29')]['destroy']({'where':{'type':_0x24ba1d,'resourceId':_0xb106b1['id']}})[_0x9106('0x25')](function(){return _0x3b7cd2;});})[_0x9106('0x25')](function(){_0x4d2993[_0x9106('0x1a')](0xcc)[_0x9106('0x19')]();});}};}function handleEntityNotFound(_0x557223,_0xd59a6c){return function(_0x57ffa4){if(!_0x57ffa4){_0x557223['sendStatus'](0x194);}return _0x57ffa4;};}function handleError(_0x1a760a,_0x9e22a4){_0x9e22a4=_0x9e22a4||0x1f4;return function(_0x15c1ec){logger[_0x9106('0x2a')](_0x15c1ec[_0x9106('0x2b')]);if(_0x15c1ec[_0x9106('0x2c')]){delete _0x15c1ec['name'];}_0x1a760a[_0x9106('0x1a')](_0x9e22a4)[_0x9106('0x2d')](_0x15c1ec);};}exports['index']=function(_0x4d0d59,_0x527a71){var _0x151f8d={},_0x1513de={},_0xd2be4a={'count':0x0,'rows':[]};var _0x3372ad=_[_0x9106('0x2e')](db['Schedule']['rawAttributes'],function(_0x3e4902){return{'name':_0x3e4902[_0x9106('0x2f')],'type':_0x3e4902['type'][_0x9106('0x30')]};});_0x1513de['model']=_[_0x9106('0x2e')](_0x3372ad,_0x9106('0x2c'));_0x1513de[_0x9106('0x31')]=_[_0x9106('0x32')](_0x4d0d59['query']);_0x1513de['filters']=_['intersection'](_0x1513de['model'],_0x1513de['query']);_0x151f8d[_0x9106('0x33')]=_[_0x9106('0x34')](_0x1513de[_0x9106('0x35')],qs['fields'](_0x4d0d59['query'][_0x9106('0x36')]));_0x151f8d[_0x9106('0x33')]=_0x151f8d[_0x9106('0x33')][_0x9106('0x37')]?_0x151f8d[_0x9106('0x33')]:_0x1513de[_0x9106('0x35')];if(!_0x4d0d59[_0x9106('0x31')][_0x9106('0x38')](_0x9106('0x39'))){_0x151f8d[_0x9106('0x1d')]=qs[_0x9106('0x1d')](_0x4d0d59[_0x9106('0x31')][_0x9106('0x1d')]);_0x151f8d[_0x9106('0x1b')]=qs[_0x9106('0x1b')](_0x4d0d59[_0x9106('0x31')]['offset']);}_0x151f8d[_0x9106('0x3a')]=qs['sort'](_0x4d0d59['query'][_0x9106('0x3b')]);_0x151f8d[_0x9106('0x3c')]=qs['filters'](_['pick'](_0x4d0d59['query'],_0x1513de[_0x9106('0x3d')]),_0x3372ad);if(_0x4d0d59[_0x9106('0x31')][_0x9106('0x3e')]){_0x151f8d[_0x9106('0x3c')]=_[_0x9106('0x3f')](_0x151f8d[_0x9106('0x3c')],{'$or':_['map'](_0x3372ad,function(_0x286e2a){if(_0x286e2a[_0x9106('0x40')]!==_0x9106('0x41')){var _0x2af143={};_0x2af143[_0x286e2a[_0x9106('0x2c')]]={'$like':'%'+_0x4d0d59['query'][_0x9106('0x3e')]+'%'};return _0x2af143;}})});}_0x151f8d=_['merge']({},_0x151f8d,_0x4d0d59['options']);var _0x2128ce={'where':_0x151f8d[_0x9106('0x3c')]};return db[_0x9106('0x42')]['count'](_0x2128ce)[_0x9106('0x25')](function(_0x247603){_0xd2be4a[_0x9106('0x1e')]=_0x247603;if(_0x4d0d59[_0x9106('0x31')][_0x9106('0x43')]){_0x151f8d[_0x9106('0x44')]=[{'all':!![]}];}return db[_0x9106('0x42')]['findAll'](_0x151f8d);})['then'](function(_0x2f0005){_0xd2be4a[_0x9106('0x45')]=_0x2f0005;return _0xd2be4a;})[_0x9106('0x25')](respondWithFilteredResult(_0x527a71,_0x151f8d))[_0x9106('0x46')](handleError(_0x527a71,null));};exports[_0x9106('0x47')]=function(_0x2ac5d4,_0xef1a74){var _0x487c57={'raw':![],'where':{'id':_0x2ac5d4['params']['id']}},_0x2d7040={};_0x2d7040[_0x9106('0x35')]=_[_0x9106('0x32')](db['Schedule'][_0x9106('0x48')]);_0x2d7040[_0x9106('0x31')]=_[_0x9106('0x32')](_0x2ac5d4['query']);_0x2d7040[_0x9106('0x3d')]=_['intersection'](_0x2d7040[_0x9106('0x35')],_0x2d7040[_0x9106('0x31')]);_0x487c57[_0x9106('0x33')]=_[_0x9106('0x34')](_0x2d7040[_0x9106('0x35')],qs[_0x9106('0x36')](_0x2ac5d4['query'][_0x9106('0x36')]));_0x487c57[_0x9106('0x33')]=_0x487c57['attributes']['length']?_0x487c57[_0x9106('0x33')]:_0x2d7040[_0x9106('0x35')];if(_0x2ac5d4['query'][_0x9106('0x43')]){_0x487c57['include']=[{'all':!![]}];}_0x487c57=_[_0x9106('0x3f')]({},_0x487c57,_0x2ac5d4[_0x9106('0x49')]);return db[_0x9106('0x42')][_0x9106('0x4a')](_0x487c57)[_0x9106('0x25')](handleEntityNotFound(_0xef1a74,null))['then'](respondWithResult(_0xef1a74,null))[_0x9106('0x46')](handleError(_0xef1a74,null));};exports[_0x9106('0x4b')]=function(_0x31f7b4,_0x3ba869){return db['Schedule'][_0x9106('0x4b')](_0x31f7b4[_0x9106('0x4c')],{})[_0x9106('0x25')](function(_0x1d0d2e){var _0x33c3c4=_0x31f7b4[_0x9106('0x4d')]['get']({'plain':!![]});if(!_0x33c3c4)throw new Error(_0x9106('0x4e'));if(_0x33c3c4[_0x9106('0x4f')]===_0x9106('0x4d')){var _0x56824f=_0x1d0d2e[_0x9106('0x27')]({'plain':!![]});var _0x59b287=_0x9106('0x28');return db[_0x9106('0x50')][_0x9106('0x4a')]({'where':{'name':_0x59b287,'userProfileId':_0x33c3c4[_0x9106('0x51')]},'raw':!![]})[_0x9106('0x25')](function(_0x18f59b){if(_0x18f59b&&_0x18f59b[_0x9106('0x52')]===0x0){return db[_0x9106('0x29')][_0x9106('0x4b')]({'name':_0x56824f[_0x9106('0x2c')],'resourceId':_0x56824f['id'],'type':_0x18f59b[_0x9106('0x2c')],'sectionId':_0x18f59b['id']},{})[_0x9106('0x25')](function(){return _0x1d0d2e;});}else{return _0x1d0d2e;}})[_0x9106('0x46')](function(_0x9d2b6d){logger[_0x9106('0x2a')](_0x9106('0x53'),_0x9d2b6d);throw _0x9d2b6d;});}return _0x1d0d2e;})[_0x9106('0x25')](respondWithResult(_0x3ba869,0xc9))[_0x9106('0x46')](handleError(_0x3ba869,null));};exports[_0x9106('0x24')]=function(_0xc6dd1a,_0x20d8fc){if(_0xc6dd1a[_0x9106('0x4c')]['id']){delete _0xc6dd1a[_0x9106('0x4c')]['id'];}return db[_0x9106('0x42')]['find']({'where':{'id':_0xc6dd1a[_0x9106('0x54')]['id']}})['then'](handleEntityNotFound(_0x20d8fc,null))[_0x9106('0x25')](saveUpdates(_0xc6dd1a[_0x9106('0x4c')],null))[_0x9106('0x25')](respondWithResult(_0x20d8fc,null))[_0x9106('0x46')](handleError(_0x20d8fc,null));};exports[_0x9106('0x26')]=function(_0x177459,_0x119027){return db['Schedule'][_0x9106('0x4a')]({'where':{'id':_0x177459[_0x9106('0x54')]['id']}})[_0x9106('0x25')](handleEntityNotFound(_0x119027,null))['then'](removeEntity(_0x119027,null))['catch'](handleError(_0x119027,null));};exports[_0x9106('0x55')]=function(_0x271587,_0xc7caa9,_0x3fed2f){var _0x11e690=require('../../config/schedule');return db[_0x9106('0x42')][_0x9106('0x4a')]({'where':{'id':_0x271587[_0x9106('0x54')]['id']},'raw':!![]})[_0x9106('0x25')](handleEntityNotFound(_0xc7caa9,null))['then'](function(){_0x11e690[_0x9106('0x55')](_0x271587[_0x9106('0x54')]['id']);})['then'](respondWithStatusCode(_0xc7caa9,null))[_0x9106('0x46')](handleError(_0xc7caa9,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index ac56a17..70625ac 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 _0x8488=['Schedule','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define'];(function(_0x2466ec,_0x4260dc){var _0x450c0b=function(_0x6e7ab6){while(--_0x6e7ab6){_0x2466ec['push'](_0x2466ec['shift']());}};_0x450c0b(++_0x4260dc);}(_0x8488,0x1b1));var _0x8848=function(_0xa82178,_0x5f0ad5){_0xa82178=_0xa82178-0x0;var _0x3e02c9=_0x8488[_0xa82178];return _0x3e02c9;};'use strict';var _=require(_0x8848('0x0'));var util=require(_0x8848('0x1'));var logger=require(_0x8848('0x2'))(_0x8848('0x3'));var moment=require(_0x8848('0x4'));var BPromise=require('bluebird');var rp=require(_0x8848('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8848('0x6'));var config=require(_0x8848('0x7'));var attributes=require(_0x8848('0x8'));module[_0x8848('0x9')]=function(_0x2e605c,_0xcfd7e9){return _0x2e605c[_0x8848('0xa')](_0x8848('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad6b=['./schedule.attributes','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x3e5a7b,_0x50a499){var _0x517896=function(_0x1a3cc4){while(--_0x1a3cc4){_0x3e5a7b['push'](_0x3e5a7b['shift']());}};_0x517896(++_0x50a499);}(_0xad6b,0x160));var _0xbad6=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xad6b[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xbad6('0x0'));var util=require(_0xbad6('0x1'));var logger=require(_0xbad6('0x2'))(_0xbad6('0x3'));var moment=require(_0xbad6('0x4'));var BPromise=require(_0xbad6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbad6('0x6'));var rimraf=require('rimraf');var config=require(_0xbad6('0x7'));var attributes=require(_0xbad6('0x8'));module['exports']=function(_0x506a46,_0x360343){return _0x506a46[_0xbad6('0x9')](_0xbad6('0xa'),attributes,{'tableName':_0xbad6('0xb'),'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 5e2fad7..a2a1df5 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 _0x6b90=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x23e4bf,_0x590a4f){var _0x52bd14=function(_0x4375af){while(--_0x4375af){_0x23e4bf['push'](_0x23e4bf['shift']());}};_0x52bd14(++_0x590a4f);}(_0x6b90,0x1df));var _0x06b9=function(_0xbf8ec1,_0x9169c8){_0xbf8ec1=_0xbf8ec1-0x0;var _0xc84567=_0x6b90[_0xbf8ec1];return _0xc84567;};'use strict';var _=require('lodash');var util=require(_0x06b9('0x0'));var moment=require(_0x06b9('0x1'));var BPromise=require(_0x06b9('0x2'));var rs=require(_0x06b9('0x3'));var fs=require('fs');var Redis=require(_0x06b9('0x4'));var db=require(_0x06b9('0x5'))['db'];var utils=require(_0x06b9('0x6'));var logger=require(_0x06b9('0x7'))(_0x06b9('0x8'));var config=require(_0x06b9('0x9'));var jayson=require(_0x06b9('0xa'));var client=jayson[_0x06b9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59418f,_0x3d5e3c,_0x4b6a36){return new BPromise(function(_0x455f9b,_0x392e3b){return client[_0x06b9('0xc')](_0x59418f,_0x4b6a36)['then'](function(_0x204691){logger[_0x06b9('0xd')](_0x06b9('0xe'),_0x3d5e3c,_0x06b9('0xf'));logger['debug'](_0x06b9('0x10'),_0x3d5e3c,'request\x20sent',JSON[_0x06b9('0x11')](_0x204691));if(_0x204691[_0x06b9('0x12')]){if(_0x204691['error'][_0x06b9('0x13')]===0x1f4){logger[_0x06b9('0x12')](_0x06b9('0xe'),_0x3d5e3c,_0x204691[_0x06b9('0x12')][_0x06b9('0x14')]);return _0x392e3b(_0x204691['error'][_0x06b9('0x14')]);}logger[_0x06b9('0x12')]('Schedule,\x20%s,\x20%s',_0x3d5e3c,_0x204691[_0x06b9('0x12')][_0x06b9('0x14')]);return _0x455f9b(_0x204691[_0x06b9('0x12')][_0x06b9('0x14')]);}else{logger[_0x06b9('0xd')]('Schedule,\x20%s,\x20%s',_0x3d5e3c,_0x06b9('0xf'));_0x455f9b(_0x204691[_0x06b9('0x15')]['message']);}})[_0x06b9('0x16')](function(_0x36a735){logger[_0x06b9('0x12')](_0x06b9('0xe'),_0x3d5e3c,_0x36a735);_0x392e3b(_0x36a735);});});} \ No newline at end of file +var _0xdb94=['http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0xdb94,0x136));var _0x4db9=function(_0x29b952,_0x4270ec){_0x29b952=_0x29b952-0x0;var _0xbfac2c=_0xdb94[_0x29b952];return _0xbfac2c;};'use strict';var _=require(_0x4db9('0x0'));var util=require('util');var moment=require(_0x4db9('0x1'));var BPromise=require(_0x4db9('0x2'));var rs=require(_0x4db9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4db9('0x4'));var logger=require(_0x4db9('0x5'))(_0x4db9('0x6'));var config=require(_0x4db9('0x7'));var jayson=require(_0x4db9('0x8'));var client=jayson[_0x4db9('0x9')][_0x4db9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4faa95,_0x22512e,_0x2726a6){return new BPromise(function(_0x22a96f,_0x3b51bb){return client['request'](_0x4faa95,_0x2726a6)[_0x4db9('0xb')](function(_0x388adf){logger[_0x4db9('0xc')](_0x4db9('0xd'),_0x22512e,_0x4db9('0xe'));logger['debug'](_0x4db9('0xf'),_0x22512e,_0x4db9('0xe'),JSON['stringify'](_0x388adf));if(_0x388adf['error']){if(_0x388adf['error'][_0x4db9('0x10')]===0x1f4){logger[_0x4db9('0x11')](_0x4db9('0xd'),_0x22512e,_0x388adf[_0x4db9('0x11')][_0x4db9('0x12')]);return _0x3b51bb(_0x388adf[_0x4db9('0x11')][_0x4db9('0x12')]);}logger['error'](_0x4db9('0xd'),_0x22512e,_0x388adf[_0x4db9('0x11')][_0x4db9('0x12')]);return _0x22a96f(_0x388adf['error'][_0x4db9('0x12')]);}else{logger[_0x4db9('0xc')](_0x4db9('0xd'),_0x22512e,_0x4db9('0xe'));_0x22a96f(_0x388adf[_0x4db9('0x13')][_0x4db9('0x12')]);}})['catch'](function(_0x4c86c9){logger[_0x4db9('0x11')](_0x4db9('0xd'),_0x22512e,_0x4c86c9);_0x3b51bb(_0x4c86c9);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 21332ad..7043756 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 _0x6233=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x30d521,_0x293a3f){var _0x17d2ca=function(_0x179ae7){while(--_0x179ae7){_0x30d521['push'](_0x30d521['shift']());}};_0x17d2ca(++_0x293a3f);}(_0x6233,0x160));var _0x3623=function(_0x3fadfb,_0x149cd6){_0x3fadfb=_0x3fadfb-0x0;var _0x2de459=_0x6233[_0x3fadfb];return _0x2de459;};'use strict';var multer=require(_0x3623('0x0'));var util=require(_0x3623('0x1'));var path=require(_0x3623('0x2'));var timeout=require(_0x3623('0x3'));var express=require('express');var router=express[_0x3623('0x4')]();var fs_extra=require(_0x3623('0x5'));var auth=require(_0x3623('0x6'));var interaction=require(_0x3623('0x7'));var config=require(_0x3623('0x8'));var controller=require('./screenRecording.controller');router[_0x3623('0x9')]('/',auth[_0x3623('0xa')](),controller['index']);router[_0x3623('0x9')](_0x3623('0xb'),auth['isAuthenticated'](),controller[_0x3623('0xc')]);router['get'](_0x3623('0xd'),auth[_0x3623('0xa')](),controller[_0x3623('0xe')]);router['get'](_0x3623('0xf'),auth['isAuthenticated'](),controller[_0x3623('0x10')]);router[_0x3623('0x11')]('/',auth[_0x3623('0xa')](),controller[_0x3623('0x12')]);router[_0x3623('0x13')](_0x3623('0xd'),auth[_0x3623('0xa')](),controller[_0x3623('0x14')]);router[_0x3623('0x15')](_0x3623('0xd'),auth[_0x3623('0xa')](),controller[_0x3623('0x16')]);module[_0x3623('0x17')]=router; \ No newline at end of file +var _0x5e65=['./screenRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3f01db,_0x22264b){var _0x999675=function(_0xa4282f){while(--_0xa4282f){_0x3f01db['push'](_0x3f01db['shift']());}};_0x999675(++_0x22264b);}(_0x5e65,0xcf));var _0x55e6=function(_0x33ffe2,_0x48be66){_0x33ffe2=_0x33ffe2-0x0;var _0x2368e0=_0x5e65[_0x33ffe2];return _0x2368e0;};'use strict';var multer=require(_0x55e6('0x0'));var util=require(_0x55e6('0x1'));var path=require('path');var timeout=require(_0x55e6('0x2'));var express=require(_0x55e6('0x3'));var router=express[_0x55e6('0x4')]();var fs_extra=require(_0x55e6('0x5'));var auth=require(_0x55e6('0x6'));var interaction=require(_0x55e6('0x7'));var config=require(_0x55e6('0x8'));var controller=require(_0x55e6('0x9'));router['get']('/',auth[_0x55e6('0xa')](),controller[_0x55e6('0xb')]);router[_0x55e6('0xc')](_0x55e6('0xd'),auth[_0x55e6('0xa')](),controller[_0x55e6('0xe')]);router[_0x55e6('0xc')](_0x55e6('0xf'),auth[_0x55e6('0xa')](),controller[_0x55e6('0x10')]);router[_0x55e6('0xc')](_0x55e6('0x11'),auth[_0x55e6('0xa')](),controller['download']);router[_0x55e6('0x12')]('/',auth[_0x55e6('0xa')](),controller['create']);router[_0x55e6('0x13')](_0x55e6('0xf'),auth[_0x55e6('0xa')](),controller[_0x55e6('0x14')]);router[_0x55e6('0x15')](_0x55e6('0xf'),auth['isAuthenticated'](),controller[_0x55e6('0x16')]);module[_0x55e6('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index fa1f6c3..54b203a 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 _0xeaab=['subtract','closedAt','DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','path','../../config/environment','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0xeaab,0xd9));var _0xbeaa=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xeaab[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xbeaa('0x0'));var moment=require('moment');var path=require(_0xbeaa('0x1'));var config=require(_0xbeaa('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xbeaa('0x3')](_0xbeaa('0x4'))?path[_0xbeaa('0x5')](this[_0xbeaa('0x3')](_0xbeaa('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xbeaa('0x6')]},'channel':{'type':Sequelize[_0xbeaa('0x6')]},'value':{'type':Sequelize[_0xbeaa('0x6')],'set':function(_0x2f015b){var _0x42a779=_0x2f015b[_0xbeaa('0x7')](/\\/g,'/');this[_0xbeaa('0x8')](_0xbeaa('0x4'),_0x42a779);}},'rating':{'type':Sequelize[_0xbeaa('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x389c0b){this[_0xbeaa('0x8')](_0xbeaa('0xa'),moment()[_0xbeaa('0xb')](_0x389c0b,'ms'));this[_0xbeaa('0x8')](_0xbeaa('0xc'),moment());this[_0xbeaa('0x8')]('duration',_0x389c0b);}},'startedAt':{'type':Sequelize[_0xbeaa('0xd')],'get':function(){return moment(this['getDataValue'](_0xbeaa('0xa')))[_0xbeaa('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xbeaa('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xbeaa('0x3')](_0xbeaa('0xc')))['format'](_0xbeaa('0x10'))[_0xbeaa('0xf')]();}},'createdAt':{'type':Sequelize[_0xbeaa('0xd')],'get':function(){return moment(this[_0xbeaa('0x3')](_0xbeaa('0x11')))[_0xbeaa('0xe')](_0xbeaa('0x10'))[_0xbeaa('0xf')]();}},'updatedAt':{'type':Sequelize[_0xbeaa('0xd')],'get':function(){return moment(this[_0xbeaa('0x3')](_0xbeaa('0x12')))[_0xbeaa('0xe')](_0xbeaa('0x10'))[_0xbeaa('0xf')]();}}}; \ No newline at end of file +var _0xa880=['path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','moment'];(function(_0x3b81eb,_0x175f32){var _0x149491=function(_0x454753){while(--_0x454753){_0x3b81eb['push'](_0x3b81eb['shift']());}};_0x149491(++_0x175f32);}(_0xa880,0x106));var _0x0a88=function(_0x3ff893,_0x53e2bd){_0x3ff893=_0x3ff893-0x0;var _0x246d70=_0xa880[_0x3ff893];return _0x246d70;};'use strict';var Sequelize=require(_0x0a88('0x0'));var moment=require(_0x0a88('0x1'));var path=require(_0x0a88('0x2'));var config=require(_0x0a88('0x3'));module[_0x0a88('0x4')]={'format':{'type':Sequelize[_0x0a88('0x5')],'get':function(){return this[_0x0a88('0x6')](_0x0a88('0x7'))?path[_0x0a88('0x8')](this[_0x0a88('0x6')](_0x0a88('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0a88('0x9')]},'value':{'type':Sequelize[_0x0a88('0x9')],'set':function(_0x3a576d){var _0x3f9463=_0x3a576d['replace'](/\\/g,'/');this[_0x0a88('0xa')](_0x0a88('0x7'),_0x3f9463);}},'rating':{'type':Sequelize[_0x0a88('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x512810){this['setDataValue'](_0x0a88('0xc'),moment()[_0x0a88('0xd')](_0x512810,'ms'));this[_0x0a88('0xa')](_0x0a88('0xe'),moment());this[_0x0a88('0xa')](_0x0a88('0xf'),_0x512810);}},'startedAt':{'type':Sequelize[_0x0a88('0x10')],'get':function(){return moment(this[_0x0a88('0x6')](_0x0a88('0xc')))[_0x0a88('0x11')]('MM-DD-YYYY\x20HH:mm')[_0x0a88('0x12')]();}},'closedAt':{'type':Sequelize[_0x0a88('0x10')],'get':function(){return moment(this[_0x0a88('0x6')](_0x0a88('0xe')))['format'](_0x0a88('0x13'))[_0x0a88('0x12')]();}},'createdAt':{'type':Sequelize[_0x0a88('0x10')],'get':function(){return moment(this['getDataValue'](_0x0a88('0x14')))[_0x0a88('0x11')](_0x0a88('0x13'))[_0x0a88('0x12')]();}},'updatedAt':{'type':Sequelize[_0x0a88('0x10')],'get':function(){return moment(this['getDataValue'](_0x0a88('0x15')))[_0x0a88('0x11')](_0x0a88('0x13'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index fcead26..ae07c26 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 _0x9c5a=['ScreenRecording','includeAll','findAll','rows','catch','params','include','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','decryptFile','recording','existsSync','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','map','rawAttributes','fieldName','key','model','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x119ddf,_0x4901db){_0x119ddf=_0x119ddf-0x0;var _0x112c06=_0x9c5a[_0x119ddf];return _0x112c06;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)[_0xa9c5('0x18')]();});}};}function handleEntityNotFound(_0x32fc7d,_0x4cbba1){return function(_0x40f08b){if(!_0x40f08b){_0x32fc7d[_0xa9c5('0x17')](0x194);}return _0x40f08b;};}function handleError(_0x51b64a,_0x4e8a7f){_0x4e8a7f=_0x4e8a7f||0x1f4;return function(_0x242771){logger['error'](_0x242771[_0xa9c5('0x25')]);if(_0x242771[_0xa9c5('0x26')]){delete _0x242771['name'];}_0x51b64a[_0xa9c5('0x19')](_0x4e8a7f)[_0xa9c5('0x27')](_0x242771);};}exports['index']=function(_0x413edf,_0x32baf9){var _0x198cdf={},_0x185eb8={},_0x325c65={'count':0x0,'rows':[]};var _0x4f6e70=_[_0xa9c5('0x28')](db['ScreenRecording'][_0xa9c5('0x29')],function(_0x1ef388){return{'name':_0x1ef388[_0xa9c5('0x2a')],'type':_0x1ef388['type'][_0xa9c5('0x2b')]};});_0x185eb8[_0xa9c5('0x2c')]=_['differenceBy'](_[_0xa9c5('0x28')](_0x4f6e70,_0xa9c5('0x26')),[_0xa9c5('0x2d')]);_0x185eb8[_0xa9c5('0x2e')]=_[_0xa9c5('0x2f')](_0x413edf[_0xa9c5('0x2e')]);_0x185eb8[_0xa9c5('0x30')]=_['intersection'](_0x185eb8[_0xa9c5('0x2c')],_0x185eb8[_0xa9c5('0x2e')]);_0x198cdf[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x185eb8[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x33')]));_0x198cdf['attributes']=_0x198cdf['attributes'][_0xa9c5('0x34')]?_0x198cdf[_0xa9c5('0x31')]:_0x185eb8[_0xa9c5('0x2c')];if(!_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x35')](_0xa9c5('0x36'))){_0x198cdf['limit']=qs['limit'](_0x413edf['query'][_0xa9c5('0x1c')]);_0x198cdf[_0xa9c5('0x1e')]=qs['offset'](_0x413edf[_0xa9c5('0x2e')]['offset']);}_0x198cdf[_0xa9c5('0x37')]=qs[_0xa9c5('0x38')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x38')]);_0x198cdf['where']=qs[_0xa9c5('0x30')](_[_0xa9c5('0x39')](_0x413edf[_0xa9c5('0x2e')],_0x185eb8[_0xa9c5('0x30')]),_0x4f6e70);if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x3a')]){_0x198cdf[_0xa9c5('0x3b')]=_[_0xa9c5('0x3c')](_0x198cdf['where'],{'$or':_[_0xa9c5('0x28')](_0x4f6e70,function(_0x46e5d2){if(_0x46e5d2[_0xa9c5('0x3d')]!==_0xa9c5('0x3e')){var _0x1132e0={};_0x1132e0[_0x46e5d2[_0xa9c5('0x26')]]={'$like':'%'+_0x413edf['query'][_0xa9c5('0x3a')]+'%'};return _0x1132e0;}})});}_0x198cdf=_['merge']({},_0x198cdf,_0x413edf[_0xa9c5('0x3f')]);var _0x5c89e7={'where':_0x198cdf[_0xa9c5('0x3b')]};return db[_0xa9c5('0x40')][_0xa9c5('0x1d')](_0x5c89e7)['then'](function(_0x12e19c){_0x325c65[_0xa9c5('0x1d')]=_0x12e19c;if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x198cdf['include']=[{'all':!![]}];}return db[_0xa9c5('0x40')][_0xa9c5('0x42')](_0x198cdf);})[_0xa9c5('0x24')](function(_0x45668e){_0x325c65[_0xa9c5('0x43')]=_0x45668e;return _0x325c65;})['then'](respondWithFilteredResult(_0x32baf9,_0x198cdf))[_0xa9c5('0x44')](handleError(_0x32baf9,null));};exports['show']=function(_0x1de605,_0x397614){var _0x2998ad={'raw':![],'where':{'id':_0x1de605[_0xa9c5('0x45')]['id']}},_0xc8fca4={};_0xc8fca4[_0xa9c5('0x2c')]=_[_0xa9c5('0x2f')](db[_0xa9c5('0x40')][_0xa9c5('0x29')]);_0xc8fca4[_0xa9c5('0x2e')]=_['keys'](_0x1de605[_0xa9c5('0x2e')]);_0xc8fca4[_0xa9c5('0x30')]=_[_0xa9c5('0x32')](_0xc8fca4[_0xa9c5('0x2c')],_0xc8fca4[_0xa9c5('0x2e')]);_0x2998ad[_0xa9c5('0x31')]=_['intersection'](_0xc8fca4[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x1de605['query']['fields']));_0x2998ad['attributes']=_0x2998ad['attributes']['length']?_0x2998ad[_0xa9c5('0x31')]:_0xc8fca4[_0xa9c5('0x2c')];if(_0x1de605[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x2998ad[_0xa9c5('0x46')]=[{'all':!![]}];}_0x2998ad=_[_0xa9c5('0x3c')]({},_0x2998ad,_0x1de605[_0xa9c5('0x3f')]);return db[_0xa9c5('0x40')][_0xa9c5('0x47')](_0x2998ad)[_0xa9c5('0x24')](handleEntityNotFound(_0x397614,null))[_0xa9c5('0x24')](respondWithResult(_0x397614,null))[_0xa9c5('0x44')](handleError(_0x397614,null));};exports[_0xa9c5('0x48')]=function(_0x4bf8b4,_0x1108f0){return db['ScreenRecording'][_0xa9c5('0x48')](_0x4bf8b4[_0xa9c5('0x49')],{})['then'](respondWithResult(_0x1108f0,0xc9))['catch'](handleError(_0x1108f0,null));};exports[_0xa9c5('0x23')]=function(_0x32e64a,_0xeb0720){if(_0x32e64a['body']['id']){delete _0x32e64a['body']['id'];}delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4a')];delete _0x32e64a['body'][_0xa9c5('0x4b')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4c')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4d')];return db[_0xa9c5('0x40')]['find']({'where':{'id':_0x32e64a['params']['id']}})['then'](handleEntityNotFound(_0xeb0720,null))[_0xa9c5('0x24')](saveUpdates(_0x32e64a[_0xa9c5('0x49')],null))[_0xa9c5('0x24')](respondWithResult(_0xeb0720,null))[_0xa9c5('0x44')](handleError(_0xeb0720,null));};exports[_0xa9c5('0x4e')]=function(_0x15d044,_0x56bc1d){return db[_0xa9c5('0x40')][_0xa9c5('0x4e')]()[_0xa9c5('0x24')](respondWithResult(_0x56bc1d,null))[_0xa9c5('0x44')](handleError(_0x56bc1d,null));};exports[_0xa9c5('0x4f')]=function(_0x242e8a,_0x547654,_0x4fcc44){var _0x10ff6b=require('../../components/encryptor');var _0x1b158f=![];var _0x5ea9b0={};if(_0x242e8a[_0xa9c5('0x2e')][_0xa9c5('0x3d')]&&_0x242e8a[_0xa9c5('0x2e')]['type']===_0xa9c5('0x50')){_0x5ea9b0[_0xa9c5('0x50')]=_0x242e8a[_0xa9c5('0x45')]['id'];}else{_0x5ea9b0['id']=_0x242e8a[_0xa9c5('0x45')]['id'];}return db['ScreenRecording']['find']({'where':_0x5ea9b0,'attributes':['id',_0xa9c5('0x4d')],'raw':!![]})[_0xa9c5('0x24')](handleEntityNotFound(_0x547654,null))[_0xa9c5('0x24')](function(_0x5b4323){if(_0x5b4323){var _0x31e12e=path[_0xa9c5('0x51')](config[_0xa9c5('0x52')],_0xa9c5('0x53'),_0x5b4323[_0xa9c5('0x4d')]);var _0x29b198=util[_0xa9c5('0x2d')](_0xa9c5('0x54'),_0x31e12e);if(fs['existsSync'](_0x29b198)){_0x1b158f=!![];return _0x10ff6b[_0xa9c5('0x55')](_0x29b198,_0x31e12e,config['secrets'][_0xa9c5('0x56')])[_0xa9c5('0x24')](function(){return _0x5b4323;});}return _0x5b4323;}})[_0xa9c5('0x24')](function(_0x4dfe3a){if(_0x4dfe3a){var _0x4d475a=path[_0xa9c5('0x51')](config['root'],_0xa9c5('0x53'),_0x4dfe3a[_0xa9c5('0x4d')]);if(!fs[_0xa9c5('0x57')](_0x4d475a)){throw new db[(_0xa9c5('0x58'))]['ValidationError'](_0xa9c5('0x59'));}if(_0x4dfe3a[_0xa9c5('0x5a')]){return _0x547654[_0xa9c5('0x4f')](_0x4d475a,_0x4dfe3a[_0xa9c5('0x5a')]+path['extname'](_0x4d475a),function(){if(_0x1b158f){fs['unlink'](_0x4d475a);}});}else{return _0x547654[_0xa9c5('0x4f')](_0x4d475a,function(_0x3deb64){if(_0x1b158f){fs[_0xa9c5('0x5b')](_0x4d475a);}});}}})[_0xa9c5('0x44')](function(_0x279a26){if(_0x279a26[_0xa9c5('0x5c')]==='ScreenRecording\x20not\x20found'){_0x547654[_0xa9c5('0x19')](0x194)[_0xa9c5('0x27')](_0xa9c5('0x5d'));}else{return handleError(_0x547654,null);}});};exports[_0xa9c5('0x5e')]=function(_0x2b8575,_0x372ab9){return db[_0xa9c5('0x40')][_0xa9c5('0x47')]({'where':{'id':_0x2b8575[_0xa9c5('0x45')]['id']}})[_0xa9c5('0x24')](function(_0x50d438){if(_['isNil'](_0x50d438)){throw new ReferenceError(_0xa9c5('0x5f'));}return _0x50d438;})[_0xa9c5('0x24')](function(_0x3322cc){var _0x47afaa=path['join'](config[_0xa9c5('0x52')],'server/files/screen_recordings',_0x3322cc[_0xa9c5('0x4d')]);logger[_0xa9c5('0x60')](_0xa9c5('0x61'),_0x47afaa);if(!_[_0xa9c5('0x62')](_0x3322cc[_0xa9c5('0x4d')])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}_0x47afaa=_0x47afaa+_0xa9c5('0x66');if(!_[_0xa9c5('0x62')](_0x3322cc['value'])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}return _0x3322cc;})[_0xa9c5('0x24')](function(_0x28ba54){if(!_0x28ba54)throw new InternalError();return _0x28ba54['destroy']();})['then'](function(){_0x372ab9[_0xa9c5('0x19')](0xcc)['end']();})[_0xa9c5('0x44')](handleError(_0x372ab9,null));}; \ No newline at end of file +var _0x6f47=['zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','ScreenRecording','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','duration','createdAt','closedAt','value','find','describe','uniqueid','join','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','root','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','rimraf'];(function(_0x16dc99,_0x4c6581){var _0x5f0ea0=function(_0xd52030){while(--_0xd52030){_0x16dc99['push'](_0x16dc99['shift']());}};_0x5f0ea0(++_0x4c6581);}(_0x6f47,0xc7));var _0x76f4=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x6f47[_0x1b7368];return _0x25d54c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76f4('0x0'));var zipdir=require(_0x76f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f4('0x2'));var moment=require('moment');var BPromise=require(_0x76f4('0x3'));var Mustache=require('mustache');var util=require(_0x76f4('0x4'));var path=require(_0x76f4('0x5'));var sox=require(_0x76f4('0x6'));var csv=require(_0x76f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f4('0x8'));var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0x7'));var querystring=require(_0x76f4('0xd'));var Papa=require(_0x76f4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0xf'));var as=require(_0x76f4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x11'));var utils=require(_0x76f4('0x12'));var config=require(_0x76f4('0x13'));var licenseUtil=require(_0x76f4('0x14'));var db=require(_0x76f4('0x15'))['db'];function respondWithStatusCode(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xcc;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0x16')](_0xf7e347);}return _0xafd21e['status'](_0xf7e347)[_0x76f4('0x17')]();};}function respondWithResult(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0xc8;return function(_0x4b6021){if(_0x4b6021){return _0x30dabf['status'](_0x5da1ff)[_0x76f4('0x18')](_0x4b6021);}};}function respondWithFilteredResult(_0x3dd240,_0x979946){return function(_0x40252d){if(_0x40252d){var _0x3d8f5a=typeof _0x979946[_0x76f4('0x19')]===_0x76f4('0x1a')&&typeof _0x979946[_0x76f4('0x1b')]===_0x76f4('0x1a');var _0xb159a9=_0x40252d[_0x76f4('0x1c')];var _0x2d4bd1=_0x3d8f5a?0x0:_0x979946[_0x76f4('0x19')];var _0x38450e=_0x3d8f5a?_0x40252d[_0x76f4('0x1c')]:_0x979946[_0x76f4('0x19')]+_0x979946[_0x76f4('0x1b')];var _0x3e809f;if(_0x38450e>=_0xb159a9){_0x38450e=_0xb159a9;_0x3e809f=0xc8;}else{_0x3e809f=0xce;}_0x3dd240[_0x76f4('0x1d')](_0x3e809f);return _0x3dd240[_0x76f4('0x1e')](_0x76f4('0x1f'),_0x2d4bd1+'-'+_0x38450e+'/'+_0xb159a9)[_0x76f4('0x18')](_0x40252d);}return null;};}function patchUpdates(_0x5bf3d5){return function(_0x262937){try{jsonpatch['apply'](_0x262937,_0x5bf3d5,!![]);}catch(_0x13f3b1){return BPromise[_0x76f4('0x20')](_0x13f3b1);}return _0x262937[_0x76f4('0x21')]();};}function saveUpdates(_0x517c00,_0x567f2a){return function(_0x52da65){if(_0x52da65){return _0x52da65[_0x76f4('0x22')](_0x517c00)[_0x76f4('0x23')](function(_0x14bfe5){return _0x14bfe5;});}return null;};}function removeEntity(_0x2b6d51,_0x42ef70){return function(_0x4786c9){if(_0x4786c9){return _0x4786c9[_0x76f4('0x24')]()['then'](function(){_0x2b6d51['status'](0xcc)[_0x76f4('0x17')]();});}};}function handleEntityNotFound(_0x497913,_0x288365){return function(_0x5355bd){if(!_0x5355bd){_0x497913['sendStatus'](0x194);}return _0x5355bd;};}function handleError(_0x4f6087,_0x470242){_0x470242=_0x470242||0x1f4;return function(_0x38300d){logger[_0x76f4('0x25')](_0x38300d[_0x76f4('0x26')]);if(_0x38300d[_0x76f4('0x27')]){delete _0x38300d[_0x76f4('0x27')];}_0x4f6087['status'](_0x470242)[_0x76f4('0x28')](_0x38300d);};}exports['index']=function(_0x5346be,_0x5b3f07){var _0x10ddb4={},_0x30f02e={},_0x41dea4={'count':0x0,'rows':[]};var _0x1dea0e=_['map'](db[_0x76f4('0x29')]['rawAttributes'],function(_0x259c26){return{'name':_0x259c26[_0x76f4('0x2a')],'type':_0x259c26[_0x76f4('0x2b')][_0x76f4('0x2c')]};});_0x30f02e[_0x76f4('0x2d')]=_['differenceBy'](_['map'](_0x1dea0e,_0x76f4('0x27')),[_0x76f4('0x2e')]);_0x30f02e[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0x5346be[_0x76f4('0x2f')]);_0x30f02e[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],_0x30f02e[_0x76f4('0x2f')]);_0x10ddb4[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],qs['fields'](_0x5346be['query']['fields']));_0x10ddb4['attributes']=_0x10ddb4[_0x76f4('0x33')][_0x76f4('0x34')]?_0x10ddb4[_0x76f4('0x33')]:_0x30f02e[_0x76f4('0x2d')];if(!_0x5346be[_0x76f4('0x2f')]['hasOwnProperty'](_0x76f4('0x35'))){_0x10ddb4[_0x76f4('0x1b')]=qs[_0x76f4('0x1b')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x1b')]);_0x10ddb4[_0x76f4('0x19')]=qs[_0x76f4('0x19')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x19')]);}_0x10ddb4[_0x76f4('0x36')]=qs[_0x76f4('0x37')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x37')]);_0x10ddb4[_0x76f4('0x38')]=qs[_0x76f4('0x31')](_[_0x76f4('0x39')](_0x5346be[_0x76f4('0x2f')],_0x30f02e[_0x76f4('0x31')]),_0x1dea0e);if(_0x5346be['query'][_0x76f4('0x3a')]){_0x10ddb4[_0x76f4('0x38')]=_[_0x76f4('0x3b')](_0x10ddb4['where'],{'$or':_['map'](_0x1dea0e,function(_0x237fba){if(_0x237fba['type']!==_0x76f4('0x3c')){var _0x5ac18f={};_0x5ac18f[_0x237fba[_0x76f4('0x27')]]={'$like':'%'+_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3a')]+'%'};return _0x5ac18f;}})});}_0x10ddb4=_[_0x76f4('0x3b')]({},_0x10ddb4,_0x5346be[_0x76f4('0x3d')]);var _0x2d99e3={'where':_0x10ddb4[_0x76f4('0x38')]};return db[_0x76f4('0x29')][_0x76f4('0x1c')](_0x2d99e3)[_0x76f4('0x23')](function(_0x5340a9){_0x41dea4['count']=_0x5340a9;if(_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3e')]){_0x10ddb4[_0x76f4('0x3f')]=[{'all':!![]}];}return db[_0x76f4('0x29')][_0x76f4('0x40')](_0x10ddb4);})[_0x76f4('0x23')](function(_0x42754d){_0x41dea4[_0x76f4('0x41')]=_0x42754d;return _0x41dea4;})[_0x76f4('0x23')](respondWithFilteredResult(_0x5b3f07,_0x10ddb4))['catch'](handleError(_0x5b3f07,null));};exports[_0x76f4('0x42')]=function(_0xe744af,_0x4f0d1a){var _0x5ad90a={'raw':![],'where':{'id':_0xe744af[_0x76f4('0x43')]['id']}},_0x26c411={};_0x26c411[_0x76f4('0x2d')]=_[_0x76f4('0x30')](db[_0x76f4('0x29')]['rawAttributes']);_0x26c411[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0xe744af[_0x76f4('0x2f')]);_0x26c411[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],_0x26c411['query']);_0x5ad90a[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],qs['fields'](_0xe744af['query'][_0x76f4('0x44')]));_0x5ad90a[_0x76f4('0x33')]=_0x5ad90a[_0x76f4('0x33')][_0x76f4('0x34')]?_0x5ad90a[_0x76f4('0x33')]:_0x26c411['model'];if(_0xe744af['query'][_0x76f4('0x3e')]){_0x5ad90a['include']=[{'all':!![]}];}_0x5ad90a=_[_0x76f4('0x3b')]({},_0x5ad90a,_0xe744af[_0x76f4('0x3d')]);return db['ScreenRecording']['find'](_0x5ad90a)[_0x76f4('0x23')](handleEntityNotFound(_0x4f0d1a,null))[_0x76f4('0x23')](respondWithResult(_0x4f0d1a,null))[_0x76f4('0x45')](handleError(_0x4f0d1a,null));};exports[_0x76f4('0x46')]=function(_0x55e4cc,_0x9baa0f){return db[_0x76f4('0x29')][_0x76f4('0x46')](_0x55e4cc['body'],{})[_0x76f4('0x23')](respondWithResult(_0x9baa0f,0xc9))[_0x76f4('0x45')](handleError(_0x9baa0f,null));};exports['update']=function(_0x56d905,_0x4ab620){if(_0x56d905[_0x76f4('0x47')]['id']){delete _0x56d905[_0x76f4('0x47')]['id'];}delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x48')];delete _0x56d905['body'][_0x76f4('0x49')];delete _0x56d905['body'][_0x76f4('0x4a')];delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x4b')];return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x56d905[_0x76f4('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ab620,null))[_0x76f4('0x23')](saveUpdates(_0x56d905[_0x76f4('0x47')],null))[_0x76f4('0x23')](respondWithResult(_0x4ab620,null))[_0x76f4('0x45')](handleError(_0x4ab620,null));};exports[_0x76f4('0x4d')]=function(_0x479c4b,_0x1041da){return db['ScreenRecording'][_0x76f4('0x4d')]()[_0x76f4('0x23')](respondWithResult(_0x1041da,null))[_0x76f4('0x45')](handleError(_0x1041da,null));};exports['download']=function(_0x141b1c,_0x46c944,_0x3fc794){var _0x3bec16=require('../../components/encryptor');var _0x2028e9=![];var _0xf11e07={};if(_0x141b1c[_0x76f4('0x2f')][_0x76f4('0x2b')]&&_0x141b1c['query'][_0x76f4('0x2b')]==='uniqueid'){_0xf11e07[_0x76f4('0x4e')]=_0x141b1c[_0x76f4('0x43')]['id'];}else{_0xf11e07['id']=_0x141b1c['params']['id'];}return db['ScreenRecording'][_0x76f4('0x4c')]({'where':_0xf11e07,'attributes':['id',_0x76f4('0x4b')],'raw':!![]})[_0x76f4('0x23')](handleEntityNotFound(_0x46c944,null))['then'](function(_0x27ba06){if(_0x27ba06){var _0x15ec0f=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x27ba06[_0x76f4('0x4b')]);var _0x367238=util['format']('%s.cypher',_0x15ec0f);if(fs[_0x76f4('0x50')](_0x367238)){_0x2028e9=!![];return _0x3bec16[_0x76f4('0x51')](_0x367238,_0x15ec0f,config[_0x76f4('0x52')][_0x76f4('0x53')])[_0x76f4('0x23')](function(){return _0x27ba06;});}return _0x27ba06;}})[_0x76f4('0x23')](function(_0x97be11){if(_0x97be11){var _0x36a52a=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x97be11['value']);if(!fs[_0x76f4('0x50')](_0x36a52a)){throw new db[(_0x76f4('0x54'))][(_0x76f4('0x55'))](_0x76f4('0x56'));}if(_0x97be11['filename']){return _0x46c944['download'](_0x36a52a,_0x97be11[_0x76f4('0x57')]+path['extname'](_0x36a52a),function(){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}else{return _0x46c944['download'](_0x36a52a,function(_0x4285dd){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}}})[_0x76f4('0x45')](function(_0x3317a4){if(_0x3317a4['message']===_0x76f4('0x56')){_0x46c944[_0x76f4('0x1d')](0x194)[_0x76f4('0x28')](_0x76f4('0x59'));}else{return handleError(_0x46c944,null);}});};exports[_0x76f4('0x24')]=function(_0x2a6f19,_0x46245f){return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x2a6f19[_0x76f4('0x43')]['id']}})[_0x76f4('0x23')](function(_0x320a87){if(_[_0x76f4('0x5a')](_0x320a87)){throw new ReferenceError(_0x76f4('0x5b'));}return _0x320a87;})[_0x76f4('0x23')](function(_0x551d38){var _0x5724c3=path['join'](config[_0x76f4('0x5c')],_0x76f4('0x5d'),_0x551d38[_0x76f4('0x4b')]);logger['info'](_0x76f4('0x5e'),_0x5724c3);if(!_['isNil'](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger['info'](_0x76f4('0x5f')+_0x5724c3+_0x76f4('0x60'));fs[_0x76f4('0x61')](_0x5724c3);}_0x5724c3=_0x5724c3+_0x76f4('0x62');if(!_[_0x76f4('0x5a')](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger[_0x76f4('0x63')](_0x76f4('0x5f')+_0x5724c3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76f4('0x61')](_0x5724c3);}return _0x551d38;})['then'](function(_0x318fcb){if(!_0x318fcb)throw new InternalError();return _0x318fcb[_0x76f4('0x24')]();})[_0x76f4('0x23')](function(){_0x46245f[_0x76f4('0x1d')](0xcc)[_0x76f4('0x17')]();})[_0x76f4('0x45')](handleError(_0x46245f,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 05cb697..dab479d 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 _0x4f50=['screen_recordings','interactionid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x4f50,0x1a6));var _0x04f5=function(_0x28551c,_0x2623f2){_0x28551c=_0x28551c-0x0;var _0x240140=_0x4f50[_0x28551c];return _0x240140;};'use strict';var _=require(_0x04f5('0x0'));var util=require('util');var logger=require(_0x04f5('0x1'))('api');var moment=require(_0x04f5('0x2'));var BPromise=require(_0x04f5('0x3'));var rp=require(_0x04f5('0x4'));var fs=require('fs');var path=require(_0x04f5('0x5'));var rimraf=require(_0x04f5('0x6'));var config=require(_0x04f5('0x7'));var attributes=require(_0x04f5('0x8'));module[_0x04f5('0x9')]=function(_0x23f410,_0x9f8095){return _0x23f410[_0x04f5('0xa')](_0x04f5('0xb'),attributes,{'tableName':_0x04f5('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x04f5('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ae5=['rimraf','../../config/environment','define','ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xecc551,_0x471cac){var _0x344658=function(_0x5ef130){while(--_0x5ef130){_0xecc551['push'](_0xecc551['shift']());}};_0x344658(++_0x471cac);}(_0x7ae5,0x158));var _0x57ae=function(_0xf034a4,_0x522919){_0xf034a4=_0xf034a4-0x0;var _0x37b357=_0x7ae5[_0xf034a4];return _0x37b357;};'use strict';var _=require(_0x57ae('0x0'));var util=require('util');var logger=require(_0x57ae('0x1'))(_0x57ae('0x2'));var moment=require(_0x57ae('0x3'));var BPromise=require(_0x57ae('0x4'));var rp=require(_0x57ae('0x5'));var fs=require('fs');var path=require(_0x57ae('0x6'));var rimraf=require(_0x57ae('0x7'));var config=require(_0x57ae('0x8'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x5b6986,_0x1db6bb){return _0x5b6986[_0x57ae('0x9')](_0x57ae('0xa'),attributes,{'tableName':_0x57ae('0xb'),'paranoid':![],'indexes':[{'name':_0x57ae('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 4e70fa1..15f5098 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 _0xc24c=['../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x370cac,_0x3000ff){var _0x46d1f4=function(_0x17262c){while(--_0x17262c){_0x370cac['push'](_0x370cac['shift']());}};_0x46d1f4(++_0x3000ff);}(_0xc24c,0x14a));var _0xcc24=function(_0x3900e2,_0x4226aa){_0x3900e2=_0x3900e2-0x0;var _0x6b9d5e=_0xc24c[_0x3900e2];return _0x6b9d5e;};'use strict';var _=require('lodash');var util=require(_0xcc24('0x0'));var moment=require(_0xcc24('0x1'));var BPromise=require(_0xcc24('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc24('0x3'));var db=require(_0xcc24('0x4'))['db'];var utils=require(_0xcc24('0x5'));var logger=require(_0xcc24('0x6'))(_0xcc24('0x7'));var config=require('../../config/environment');var jayson=require(_0xcc24('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1533e6,_0x111bb4,_0x2af871){return new BPromise(function(_0x14ed1b,_0xabb7e8){return client[_0xcc24('0x9')](_0x1533e6,_0x2af871)[_0xcc24('0xa')](function(_0x2748c1){logger[_0xcc24('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x111bb4,_0xcc24('0xc'));logger[_0xcc24('0xd')](_0xcc24('0xe'),_0x111bb4,_0xcc24('0xc'),JSON['stringify'](_0x2748c1));if(_0x2748c1[_0xcc24('0xf')]){if(_0x2748c1[_0xcc24('0xf')][_0xcc24('0x10')]===0x1f4){logger[_0xcc24('0xf')](_0xcc24('0x11'),_0x111bb4,_0x2748c1['error'][_0xcc24('0x12')]);return _0xabb7e8(_0x2748c1[_0xcc24('0xf')][_0xcc24('0x12')]);}logger['error'](_0xcc24('0x11'),_0x111bb4,_0x2748c1[_0xcc24('0xf')]['message']);return _0x14ed1b(_0x2748c1[_0xcc24('0xf')][_0xcc24('0x12')]);}else{logger['info'](_0xcc24('0x11'),_0x111bb4,_0xcc24('0xc'));_0x14ed1b(_0x2748c1[_0xcc24('0x13')][_0xcc24('0x12')]);}})[_0xcc24('0x14')](function(_0x4fef91){logger[_0xcc24('0xf')](_0xcc24('0x11'),_0x111bb4,_0x4fef91);_0xabb7e8(_0x4fef91);});});} \ No newline at end of file +var _0xb908=['util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','ScreenRecording,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash'];(function(_0x1c223c,_0x3cef2f){var _0x141766=function(_0x5c09ed){while(--_0x5c09ed){_0x1c223c['push'](_0x1c223c['shift']());}};_0x141766(++_0x3cef2f);}(_0xb908,0x9f));var _0x8b90=function(_0x1cb0b4,_0x1fd48d){_0x1cb0b4=_0x1cb0b4-0x0;var _0x525b60=_0xb908[_0x1cb0b4];return _0x525b60;};'use strict';var _=require(_0x8b90('0x0'));var util=require(_0x8b90('0x1'));var moment=require('moment');var BPromise=require(_0x8b90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b90('0x3'))['db'];var utils=require(_0x8b90('0x4'));var logger=require(_0x8b90('0x5'))(_0x8b90('0x6'));var config=require(_0x8b90('0x7'));var jayson=require(_0x8b90('0x8'));var client=jayson[_0x8b90('0x9')][_0x8b90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b00aa,_0x1b4d73,_0x2f8af4){return new BPromise(function(_0x4888a2,_0xdccf0d){return client['request'](_0x1b00aa,_0x2f8af4)[_0x8b90('0xb')](function(_0x11bc8d){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x1b4d73,'request\x20sent');logger['debug'](_0x8b90('0xc'),_0x1b4d73,'request\x20sent',JSON['stringify'](_0x11bc8d));if(_0x11bc8d[_0x8b90('0xd')]){if(_0x11bc8d[_0x8b90('0xd')][_0x8b90('0xe')]===0x1f4){logger[_0x8b90('0xd')](_0x8b90('0xf'),_0x1b4d73,_0x11bc8d['error'][_0x8b90('0x10')]);return _0xdccf0d(_0x11bc8d[_0x8b90('0xd')]['message']);}logger[_0x8b90('0xd')](_0x8b90('0xf'),_0x1b4d73,_0x11bc8d[_0x8b90('0xd')][_0x8b90('0x10')]);return _0x4888a2(_0x11bc8d['error'][_0x8b90('0x10')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x1b4d73,_0x8b90('0x11'));_0x4888a2(_0x11bc8d[_0x8b90('0x12')]['message']);}})[_0x8b90('0x13')](function(_0x5c0e2d){logger[_0x8b90('0xd')](_0x8b90('0xf'),_0x1b4d73,_0x5c0e2d);_0xdccf0d(_0x5c0e2d);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 01aaf20..5f8eb7c 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 _0x7503=['../../config/environment','./setting.controller','get','index','/now','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','format','%s%s','extname','originalname','single','addLogo','diskStorage','server/files/images/logos/','post','file','addLogoLogin','preferred','addPreferred','favicon','addFavicon','/:id','isAuthenticated','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2aeb13,_0x14bc69){var _0x124a94=function(_0x4f6855){while(--_0x4f6855){_0x2aeb13['push'](_0x2aeb13['shift']());}};_0x124a94(++_0x14bc69);}(_0x7503,0x183));var _0x3750=function(_0x1b8050,_0x4d12c6){_0x1b8050=_0x1b8050-0x0;var _0x1ec2b1=_0x7503[_0x1b8050];return _0x1ec2b1;};'use strict';var multer=require(_0x3750('0x0'));var util=require(_0x3750('0x1'));var path=require(_0x3750('0x2'));var timeout=require(_0x3750('0x3'));var express=require(_0x3750('0x4'));var router=express[_0x3750('0x5')]();var fs_extra=require(_0x3750('0x6'));var auth=require(_0x3750('0x7'));var interaction=require(_0x3750('0x8'));var config=require(_0x3750('0x9'));var controller=require(_0x3750('0xa'));router[_0x3750('0xb')]('/',auth['isAuthenticated'](),controller[_0x3750('0xc')]);router[_0x3750('0xb')](_0x3750('0xd'),controller['getDate']);router[_0x3750('0xb')]('/:id',controller[_0x3750('0xe')]);router[_0x3750('0xb')](_0x3750('0xf'),controller[_0x3750('0x10')]);router['get'](_0x3750('0x11'),controller[_0x3750('0x12')]);router[_0x3750('0xb')](_0x3750('0x13'),controller['gdpr']);router[_0x3750('0xb')](_0x3750('0x14'),controller[_0x3750('0x15')]);router[_0x3750('0xb')](_0x3750('0x16'),controller[_0x3750('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4b29e3,_0x107167,_0xa3afe7){_0xa3afe7(null,path[_0x3750('0x18')](config[_0x3750('0x19')],'server/files/images/logos/'));},'filename':function(_0x47c863,_0x342473,_0x1e6e38){_0x1e6e38(null,util[_0x3750('0x1a')](_0x3750('0x1b'),'logo',path[_0x3750('0x1c')](_0x342473[_0x3750('0x1d')])));}})});router['post'](_0x3750('0xf'),upload[_0x3750('0x1e')]('file'),controller[_0x3750('0x1f')]);var upload=multer({'storage':multer[_0x3750('0x20')]({'destination':function(_0x24d693,_0x2a71e6,_0x1b09dd){_0x1b09dd(null,path[_0x3750('0x18')](config[_0x3750('0x19')],_0x3750('0x21')));},'filename':function(_0x1cee91,_0x4761c2,_0x5c19ba){_0x5c19ba(null,util['format']('%s%s','logologin',path[_0x3750('0x1c')](_0x4761c2[_0x3750('0x1d')])));}})});router[_0x3750('0x22')](_0x3750('0x11'),upload[_0x3750('0x1e')](_0x3750('0x23')),controller[_0x3750('0x24')]);var upload=multer({'storage':multer[_0x3750('0x20')]({'destination':function(_0x3f3651,_0xc08e21,_0x411011){_0x411011(null,path[_0x3750('0x18')](config[_0x3750('0x19')],_0x3750('0x21')));},'filename':function(_0x42d392,_0x570944,_0x2e3ae5){_0x2e3ae5(null,util[_0x3750('0x1a')](_0x3750('0x1b'),_0x3750('0x25'),path[_0x3750('0x1c')](_0x570944['originalname'])));}})});router['post']('/:id/preferred',upload[_0x3750('0x1e')](_0x3750('0x23')),controller[_0x3750('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2efd72,_0x55f836,_0x35a30c){_0x35a30c(null,path[_0x3750('0x18')](config[_0x3750('0x19')],'server/files/images/logos/'));},'filename':function(_0x5bf743,_0xd91152,_0x3c225c){_0x3c225c(null,util[_0x3750('0x1a')](_0x3750('0x1b'),_0x3750('0x27'),path[_0x3750('0x1c')](_0xd91152['originalname'])));}})});router[_0x3750('0x22')]('/:id/favicon',upload[_0x3750('0x1e')](_0x3750('0x23')),controller[_0x3750('0x28')]);router['put'](_0x3750('0x29'),auth[_0x3750('0x2a')](),controller[_0x3750('0x2b')]);module['exports']=router; \ No newline at end of file +var _0x0af8=['/:id/logo','getLogo','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','server/files/images/logos/','format','logo','extname','originalname','post','single','file','%s%s','addLogoLogin','root','preferred','addPreferred','join','favicon','addFavicon','put','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','get','/now','getDate','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0af8,0x103));var _0x80af=function(_0xc5e75c,_0x55b82a){_0xc5e75c=_0xc5e75c-0x0;var _0x3d3c8e=_0x0af8[_0xc5e75c];return _0x3d3c8e;};'use strict';var multer=require(_0x80af('0x0'));var util=require(_0x80af('0x1'));var path=require('path');var timeout=require(_0x80af('0x2'));var express=require('express');var router=express[_0x80af('0x3')]();var fs_extra=require(_0x80af('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x80af('0x5'));var config=require(_0x80af('0x6'));var controller=require(_0x80af('0x7'));router['get']('/',auth[_0x80af('0x8')](),controller['index']);router[_0x80af('0x9')](_0x80af('0xa'),controller[_0x80af('0xb')]);router[_0x80af('0x9')](_0x80af('0xc'),controller[_0x80af('0xd')]);router[_0x80af('0x9')](_0x80af('0xe'),controller[_0x80af('0xf')]);router[_0x80af('0x9')]('/:id/logo_login',controller['getLogoLogin']);router['get'](_0x80af('0x10'),controller[_0x80af('0x11')]);router[_0x80af('0x9')]('/:id/preferred',controller[_0x80af('0x12')]);router[_0x80af('0x9')](_0x80af('0x13'),controller[_0x80af('0x14')]);var upload=multer({'storage':multer[_0x80af('0x15')]({'destination':function(_0x5cc8f8,_0x27482f,_0x1cd159){_0x1cd159(null,path['join'](config['root'],_0x80af('0x16')));},'filename':function(_0x4c1f6b,_0x4636d9,_0x56f736){_0x56f736(null,util[_0x80af('0x17')]('%s%s',_0x80af('0x18'),path[_0x80af('0x19')](_0x4636d9[_0x80af('0x1a')])));}})});router[_0x80af('0x1b')](_0x80af('0xe'),upload[_0x80af('0x1c')](_0x80af('0x1d')),controller['addLogo']);var upload=multer({'storage':multer[_0x80af('0x15')]({'destination':function(_0x234e02,_0x1e0f70,_0x2bb894){_0x2bb894(null,path['join'](config['root'],_0x80af('0x16')));},'filename':function(_0xe3eb84,_0x55ad0c,_0x262dc9){_0x262dc9(null,util[_0x80af('0x17')](_0x80af('0x1e'),'logologin',path[_0x80af('0x19')](_0x55ad0c['originalname'])));}})});router['post']('/:id/logo_login',upload[_0x80af('0x1c')](_0x80af('0x1d')),controller[_0x80af('0x1f')]);var upload=multer({'storage':multer[_0x80af('0x15')]({'destination':function(_0x3578e4,_0x59c94e,_0x5361cc){_0x5361cc(null,path['join'](config[_0x80af('0x20')],_0x80af('0x16')));},'filename':function(_0x5f4a2b,_0x2a049c,_0xf84a97){_0xf84a97(null,util[_0x80af('0x17')](_0x80af('0x1e'),_0x80af('0x21'),path[_0x80af('0x19')](_0x2a049c[_0x80af('0x1a')])));}})});router['post']('/:id/preferred',upload['single']('file'),controller[_0x80af('0x22')]);var upload=multer({'storage':multer[_0x80af('0x15')]({'destination':function(_0xd19fbc,_0x514123,_0xf67e13){_0xf67e13(null,path[_0x80af('0x23')](config[_0x80af('0x20')],_0x80af('0x16')));},'filename':function(_0x12fa68,_0x1f7c4c,_0x5e4310){_0x5e4310(null,util[_0x80af('0x17')](_0x80af('0x1e'),_0x80af('0x24'),path[_0x80af('0x19')](_0x1f7c4c[_0x80af('0x1a')])));}})});router['post']('/:id/favicon',upload[_0x80af('0x1c')](_0x80af('0x1d')),controller[_0x80af('0x25')]);router[_0x80af('0x26')](_0x80af('0xc'),auth[_0x80af('0x8')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 66bc069..0cd969a 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 _0xea63=['sequelize','exports','INTEGER','min_internal','STRING','BOOLEAN','alternate','UNSIGNED'];(function(_0x502953,_0x28de83){var _0x2fa32d=function(_0x3b3a52){while(--_0x3b3a52){_0x502953['push'](_0x502953['shift']());}};_0x2fa32d(++_0x28de83);}(_0xea63,0x120));var _0x3ea6=function(_0x21988e,_0x353aa1){_0x21988e=_0x21988e-0x0;var _0x26784e=_0xea63[_0x21988e];return _0x26784e;};'use strict';var Sequelize=require(_0x3ea6('0x0'));module[_0x3ea6('0x1')]={'min_internal':{'type':Sequelize[_0x3ea6('0x2')](0xb),'unique':_0x3ea6('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x3ea6('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x3ea6('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x3ea6('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x3ea6('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x3ea6('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x3ea6('0x4')]},'turnaddr':{'type':Sequelize[_0x3ea6('0x4')]},'turnusername':{'type':Sequelize[_0x3ea6('0x4')]},'turnpassword':{'type':Sequelize[_0x3ea6('0x4')]},'pageTitle':{'type':Sequelize[_0x3ea6('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x3ea6('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x3ea6('0x4')],'defaultValue':_0x3ea6('0x6')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x3ea6('0x4')]},'defaultPreferred':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x3ea6('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x3ea6('0x4')]},'defaultFavicon':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x3ea6('0x4')]},'sentiment':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x3ea6('0x2')]},'sentimentRegion':{'type':Sequelize[_0x3ea6('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x3ea6('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x3ea6('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x3ea6('0x2')](0x2)[_0x3ea6('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x3ea6('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x3ea6('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x8d06=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING'];(function(_0x32ca43,_0x46afdd){var _0x261c76=function(_0x275f28){while(--_0x275f28){_0x32ca43['push'](_0x32ca43['shift']());}};_0x261c76(++_0x46afdd);}(_0x8d06,0x19e));var _0x68d0=function(_0x276c89,_0x4062f9){_0x276c89=_0x276c89-0x0;var _0x432c5e=_0x8d06[_0x276c89];return _0x432c5e;};'use strict';var Sequelize=require(_0x68d0('0x0'));module[_0x68d0('0x1')]={'min_internal':{'type':Sequelize[_0x68d0('0x2')](0xb),'unique':_0x68d0('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x68d0('0x2')](0xb),'unique':_0x68d0('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x68d0('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x68d0('0x5')],'defaultValue':_0x68d0('0x6')},'logo':{'type':Sequelize[_0x68d0('0x5')]},'defaultLogo':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x68d0('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x68d0('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x68d0('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0x68d0('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x68d0('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x68d0('0x5')],'defaultValue':_0x68d0('0x8')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x68d0('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x68d0('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x68d0('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x68d0('0x5')]},'defaultPreferred':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x68d0('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x68d0('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x68d0('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x68d0('0x5')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x68d0('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x68d0('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x68d0('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x68d0('0x5')]},'bucket':{'type':Sequelize[_0x68d0('0x5')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x68d0('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x68d0('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x68d0('0x2')](0x2)[_0x68d0('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x68d0('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x68d0('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x68d0('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x68d0('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x68d0('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x68d0('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x68d0('0x7')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x68d0('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x68d0('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 9ab9ff7..9248c3a 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 _0xdbbc=['includeAll','include','rows','show','params','keys','intersection','find','body','filename','logo','file','addLogoLogin','loginLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','toLower','root','default_logo.svg','upperFirst','custom','existsSync','Sequelize','ValidationError','getLogoLogin','getLicense','default_loginLogo.svg','default','\x20not\x20found','download','gdpr','securePassword','addPreferred','../../config/license/util','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Setting'];(function(_0x478acb,_0x9d30c2){var _0x574935=function(_0x2279e5){while(--_0x2279e5){_0x478acb['push'](_0x478acb['shift']());}};_0x574935(++_0x9d30c2);}(_0xdbbc,0x19d));var _0xcdbb=function(_0x25dc19,_0xfec57c){_0x25dc19=_0x25dc19-0x0;var _0x21f424=_0xdbbc[_0x25dc19];return _0x21f424;};'use strict';var emlformat=require(_0xcdbb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcdbb('0x1'));var rp=require(_0xcdbb('0x2'));var moment=require(_0xcdbb('0x3'));var BPromise=require(_0xcdbb('0x4'));var Mustache=require(_0xcdbb('0x5'));var util=require(_0xcdbb('0x6'));var path=require(_0xcdbb('0x7'));var sox=require(_0xcdbb('0x8'));var csv=require(_0xcdbb('0x9'));var ejs=require(_0xcdbb('0xa'));var fs=require('fs');var fs_extra=require(_0xcdbb('0xb'));var _=require(_0xcdbb('0xc'));var squel=require('squel');var crypto=require(_0xcdbb('0xd'));var jsforce=require(_0xcdbb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcdbb('0x9'));var querystring=require(_0xcdbb('0xf'));var Papa=require(_0xcdbb('0x10'));var Redis=require(_0xcdbb('0x11'));var authService=require(_0xcdbb('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcdbb('0x13'));var utils=require(_0xcdbb('0x14'));var config=require(_0xcdbb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcdbb('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xcdbb('0x17')][_0xcdbb('0x18')]({'port':0x232a});function respondWithRpcPromise(_0xc0128b,_0x264e83,_0xa55411,_0x37fd72){return new BPromise(function(_0x2d2acf,_0x4db6ce){var _0x5e515c=_0x37fd72||client;return _0x5e515c[_0xcdbb('0x19')](_0xc0128b,_0xa55411)[_0xcdbb('0x1a')](function(_0x3135e1){logger[_0xcdbb('0x1b')](_0xcdbb('0x1c'),_0x264e83,_0xcdbb('0x1d'));logger['debug'](_0xcdbb('0x1e'),_0x264e83,_0xcdbb('0x1d'),JSON['stringify'](_0x3135e1));if(_0x3135e1[_0xcdbb('0x1f')]){if(_0x3135e1['error']['code']===0x1f4){logger['error'](_0xcdbb('0x1c'),_0x264e83,_0x3135e1['error'][_0xcdbb('0x20')]);return _0x4db6ce(_0x3135e1['error']['message']);}logger[_0xcdbb('0x1f')](_0xcdbb('0x1c'),_0x264e83,_0x3135e1[_0xcdbb('0x1f')][_0xcdbb('0x20')]);return _0x2d2acf(_0x3135e1[_0xcdbb('0x1f')][_0xcdbb('0x20')]);}else{logger[_0xcdbb('0x1b')](_0xcdbb('0x1c'),_0x264e83,'request\x20sent');_0x2d2acf(_0x3135e1[_0xcdbb('0x21')][_0xcdbb('0x20')]);}})[_0xcdbb('0x22')](function(_0xa0ad0){logger[_0xcdbb('0x1f')](_0xcdbb('0x1c'),_0x264e83,_0xa0ad0);_0x4db6ce(_0xa0ad0);});});}function respondWithStatusCode(_0x3c3213,_0x4912e1){_0x4912e1=_0x4912e1||0xcc;return function(_0x261722){if(_0x261722){return _0x3c3213['sendStatus'](_0x4912e1);}return _0x3c3213[_0xcdbb('0x23')](_0x4912e1)['end']();};}function respondWithResult(_0x4bd018,_0xc3b018){_0xc3b018=_0xc3b018||0xc8;return function(_0x32164f){if(_0x32164f){return _0x4bd018[_0xcdbb('0x23')](_0xc3b018)['json'](_0x32164f);}};}function respondWithFilteredResult(_0x2c0b2c,_0x28468f){return function(_0x40e4b6){if(_0x40e4b6){var _0x536dc9=typeof _0x28468f['offset']===_0xcdbb('0x24')&&typeof _0x28468f[_0xcdbb('0x25')]===_0xcdbb('0x24');var _0xb665c5=_0x40e4b6[_0xcdbb('0x26')];var _0x1d4835=_0x536dc9?0x0:_0x28468f[_0xcdbb('0x27')];var _0x20bd13=_0x536dc9?_0x40e4b6['count']:_0x28468f[_0xcdbb('0x27')]+_0x28468f[_0xcdbb('0x25')];var _0x3503e6;if(_0x20bd13>=_0xb665c5){_0x20bd13=_0xb665c5;_0x3503e6=0xc8;}else{_0x3503e6=0xce;}_0x2c0b2c[_0xcdbb('0x23')](_0x3503e6);return _0x2c0b2c[_0xcdbb('0x28')](_0xcdbb('0x29'),_0x1d4835+'-'+_0x20bd13+'/'+_0xb665c5)[_0xcdbb('0x2a')](_0x40e4b6);}return null;};}function patchUpdates(_0x2951fb){return function(_0x22f68b){try{jsonpatch[_0xcdbb('0x2b')](_0x22f68b,_0x2951fb,!![]);}catch(_0x27996a){return BPromise[_0xcdbb('0x2c')](_0x27996a);}return _0x22f68b[_0xcdbb('0x2d')]();};}function saveUpdates(_0x4aabb6,_0x3b7b16){return function(_0x333d56){if(_0x333d56){return _0x333d56['update'](_0x4aabb6)[_0xcdbb('0x1a')](function(_0x4d178f){return _0x4d178f;});}return null;};}function removeEntity(_0x3f5c72,_0x25ab66){return function(_0x2d29b7){if(_0x2d29b7){return _0x2d29b7[_0xcdbb('0x2e')]()[_0xcdbb('0x1a')](function(){_0x3f5c72['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bf51,_0xe598d9){return function(_0x48ffa1){if(!_0x48ffa1){_0x18bf51['sendStatus'](0x194);}return _0x48ffa1;};}function handleError(_0x371759,_0x177143){_0x177143=_0x177143||0x1f4;return function(_0x3cbae8){logger[_0xcdbb('0x1f')](_0x3cbae8['stack']);if(_0x3cbae8[_0xcdbb('0x2f')]){delete _0x3cbae8[_0xcdbb('0x2f')];}_0x371759[_0xcdbb('0x23')](_0x177143)[_0xcdbb('0x30')](_0x3cbae8);};}exports[_0xcdbb('0x31')]=function(_0xa16aff,_0x30a9f0){var _0x30f000={},_0x3d9b41={},_0x44cb0d={'count':0x0,'rows':[]};var _0x4588cf=_[_0xcdbb('0x32')](db['Setting'][_0xcdbb('0x33')],function(_0x36253f){return{'name':_0x36253f[_0xcdbb('0x34')],'type':_0x36253f[_0xcdbb('0x35')][_0xcdbb('0x36')]};});_0x3d9b41[_0xcdbb('0x37')]=_[_0xcdbb('0x32')](_0x4588cf,_0xcdbb('0x2f'));_0x3d9b41[_0xcdbb('0x38')]=_['keys'](_0xa16aff['query']);_0x3d9b41[_0xcdbb('0x39')]=_['intersection'](_0x3d9b41[_0xcdbb('0x37')],_0x3d9b41[_0xcdbb('0x38')]);_0x30f000['attributes']=_['intersection'](_0x3d9b41[_0xcdbb('0x37')],qs[_0xcdbb('0x3a')](_0xa16aff[_0xcdbb('0x38')][_0xcdbb('0x3a')]));_0x30f000[_0xcdbb('0x3b')]=_0x30f000[_0xcdbb('0x3b')][_0xcdbb('0x3c')]?_0x30f000[_0xcdbb('0x3b')]:_0x3d9b41['model'];if(!_0xa16aff[_0xcdbb('0x38')][_0xcdbb('0x3d')]('nolimit')){_0x30f000[_0xcdbb('0x25')]=qs[_0xcdbb('0x25')](_0xa16aff[_0xcdbb('0x38')][_0xcdbb('0x25')]);_0x30f000['offset']=qs[_0xcdbb('0x27')](_0xa16aff[_0xcdbb('0x38')][_0xcdbb('0x27')]);}_0x30f000[_0xcdbb('0x3e')]=qs['sort'](_0xa16aff[_0xcdbb('0x38')][_0xcdbb('0x3f')]);_0x30f000[_0xcdbb('0x40')]=qs[_0xcdbb('0x39')](_[_0xcdbb('0x41')](_0xa16aff[_0xcdbb('0x38')],_0x3d9b41['filters']),_0x4588cf);if(_0xa16aff['query'][_0xcdbb('0x42')]){_0x30f000[_0xcdbb('0x40')]=_[_0xcdbb('0x43')](_0x30f000['where'],{'$or':_[_0xcdbb('0x32')](_0x4588cf,function(_0x13f1da){if(_0x13f1da[_0xcdbb('0x35')]!==_0xcdbb('0x44')){var _0x1f5914={};_0x1f5914[_0x13f1da[_0xcdbb('0x2f')]]={'$like':'%'+_0xa16aff[_0xcdbb('0x38')][_0xcdbb('0x42')]+'%'};return _0x1f5914;}})});}_0x30f000=_[_0xcdbb('0x43')]({},_0x30f000,_0xa16aff[_0xcdbb('0x45')]);var _0x1519e4={'where':_0x30f000[_0xcdbb('0x40')]};return db[_0xcdbb('0x46')][_0xcdbb('0x26')](_0x1519e4)[_0xcdbb('0x1a')](function(_0x221711){_0x44cb0d[_0xcdbb('0x26')]=_0x221711;if(_0xa16aff[_0xcdbb('0x38')][_0xcdbb('0x47')]){_0x30f000[_0xcdbb('0x48')]=[{'all':!![]}];}return db[_0xcdbb('0x46')]['findAll'](_0x30f000);})[_0xcdbb('0x1a')](function(_0x504009){_0x44cb0d[_0xcdbb('0x49')]=_0x504009;return _0x44cb0d;})[_0xcdbb('0x1a')](respondWithFilteredResult(_0x30a9f0,_0x30f000))['catch'](handleError(_0x30a9f0,null));};exports[_0xcdbb('0x4a')]=function(_0x2321dc,_0x500488){var _0x3def8f={'raw':![],'where':{'id':_0x2321dc[_0xcdbb('0x4b')]['id']}},_0x1e0c27={};_0x1e0c27[_0xcdbb('0x37')]=_[_0xcdbb('0x4c')](db[_0xcdbb('0x46')]['rawAttributes']);_0x1e0c27['query']=_['keys'](_0x2321dc['query']);_0x1e0c27['filters']=_[_0xcdbb('0x4d')](_0x1e0c27[_0xcdbb('0x37')],_0x1e0c27['query']);_0x3def8f[_0xcdbb('0x3b')]=_['intersection'](_0x1e0c27['model'],qs[_0xcdbb('0x3a')](_0x2321dc[_0xcdbb('0x38')][_0xcdbb('0x3a')]));_0x3def8f['attributes']=_0x3def8f['attributes'][_0xcdbb('0x3c')]?_0x3def8f['attributes']:_0x1e0c27[_0xcdbb('0x37')];if(_0x2321dc[_0xcdbb('0x38')][_0xcdbb('0x47')]){_0x3def8f[_0xcdbb('0x48')]=[{'all':!![]}];}_0x3def8f=_[_0xcdbb('0x43')]({},_0x3def8f,_0x2321dc[_0xcdbb('0x45')]);return db[_0xcdbb('0x46')][_0xcdbb('0x4e')](_0x3def8f)[_0xcdbb('0x1a')](handleEntityNotFound(_0x500488,null))[_0xcdbb('0x1a')](respondWithResult(_0x500488,null))[_0xcdbb('0x22')](handleError(_0x500488,null));};exports['update']=function(_0x18c5f7,_0x32c45d){if(_0x18c5f7['body']['id']){delete _0x18c5f7['body']['id'];}return db[_0xcdbb('0x46')][_0xcdbb('0x4e')]({'where':{'id':_0x18c5f7[_0xcdbb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x32c45d,null))[_0xcdbb('0x1a')](saveUpdates(_0x18c5f7[_0xcdbb('0x4f')],null))[_0xcdbb('0x1a')](respondWithResult(_0x32c45d,null))[_0xcdbb('0x22')](handleError(_0x32c45d,null));};exports['addLogo']=function(_0x5c2e5c,_0x3c7cb4,_0x8164a7){if(_0x5c2e5c['file']&&_0x5c2e5c['file'][_0xcdbb('0x50')]){_0x5c2e5c[_0xcdbb('0x4f')][_0xcdbb('0x51')]=_0x5c2e5c[_0xcdbb('0x52')]['filename'];}return db['Setting']['find']({'where':{'id':_0x5c2e5c[_0xcdbb('0x4b')]['id']}})[_0xcdbb('0x1a')](handleEntityNotFound(_0x3c7cb4,null))[_0xcdbb('0x1a')](saveUpdates(_0x5c2e5c['body'],null))[_0xcdbb('0x1a')](respondWithResult(_0x3c7cb4,null))['catch'](handleError(_0x3c7cb4,null));};exports[_0xcdbb('0x53')]=function(_0x2906b0,_0x133725,_0x31fd3c){if(_0x2906b0[_0xcdbb('0x52')]&&_0x2906b0[_0xcdbb('0x52')]['filename']){_0x2906b0[_0xcdbb('0x4f')][_0xcdbb('0x54')]=_0x2906b0[_0xcdbb('0x52')][_0xcdbb('0x50')];}return db['Setting']['find']({'where':{'id':_0x2906b0[_0xcdbb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x133725,null))[_0xcdbb('0x1a')](saveUpdates(_0x2906b0['body'],null))['then'](respondWithResult(_0x133725,null))['catch'](handleError(_0x133725,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x48f3a4,_0x144dce,_0x99b7c3){var _0x2a0112=_0xcdbb('0x55');var _0x81b588={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2d064c){if(_0x2d064c){_0x81b588=_0x2d064c;}return db['Setting'][_0xcdbb('0x4e')]({'where':{'id':_0x48f3a4[_0xcdbb('0x4b')]['id']},'attributes':[_0xcdbb('0x51'),'loginLogo',_0xcdbb('0x56'),_0xcdbb('0x57'),_0xcdbb('0x58'),_0xcdbb('0x59'),_0xcdbb('0x5a'),_0xcdbb('0x5b')],'raw':!![]});})[_0xcdbb('0x1a')](handleEntityNotFound(_0x144dce,null))[_0xcdbb('0x1a')](function(_0x1c669f){if(_0x1c669f){var _0x5254f5=_0x1c669f[_0xcdbb('0x51')]&&fs['existsSync'](path[_0xcdbb('0x5c')](config['root'],_0x2a0112,_[_0xcdbb('0x5d')](_0x1c669f[_0xcdbb('0x51')])))?path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x2a0112,_[_0xcdbb('0x5d')](_0x1c669f[_0xcdbb('0x51')])):path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x2a0112,_[_0xcdbb('0x5d')](_0xcdbb('0x5f')));var _0x1dd837='default'+_[_0xcdbb('0x60')](_0xcdbb('0x51'));if(_0x1c669f[_0x1dd837]||!_0x81b588[_0xcdbb('0x61')]){_0x5254f5=path['join'](config['root'],_0x2a0112,_[_0xcdbb('0x5d')](_0xcdbb('0x5f')));}if(!fs[_0xcdbb('0x62')](_0x5254f5)){throw new db[(_0xcdbb('0x63'))][(_0xcdbb('0x64'))](_[_0xcdbb('0x60')](_0xcdbb('0x51'))+'\x20not\x20found');}return _0x144dce['download'](_0x5254f5);}})[_0xcdbb('0x22')](handleError(_0x144dce,null));};var utilLicense=require('../../config/license/util');exports[_0xcdbb('0x65')]=function(_0x15ec8c,_0x505f7b,_0xfbcece){var _0x72390b='server/files/images/logos';var _0x5969d5={'custom':![]};return utilLicense[_0xcdbb('0x66')]()[_0xcdbb('0x1a')](function(_0x16899c){if(_0x16899c){_0x5969d5=_0x16899c;}return db['Setting'][_0xcdbb('0x4e')]({'where':{'id':_0x15ec8c[_0xcdbb('0x4b')]['id']},'attributes':[_0xcdbb('0x51'),_0xcdbb('0x54'),_0xcdbb('0x56'),'favicon',_0xcdbb('0x58'),_0xcdbb('0x59'),_0xcdbb('0x5a'),_0xcdbb('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x505f7b,null))[_0xcdbb('0x1a')](function(_0x489593){if(_0x489593){var _0x3f4c99=_0x489593[_0xcdbb('0x54')]&&fs[_0xcdbb('0x62')](path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x72390b,_[_0xcdbb('0x5d')](_0x489593['loginLogo'])))?path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x72390b,_[_0xcdbb('0x5d')](_0x489593['loginLogo'])):path['join'](config['root'],_0x72390b,_[_0xcdbb('0x5d')](_0xcdbb('0x67')));var _0x2388e5=_0xcdbb('0x68')+_[_0xcdbb('0x60')](_0xcdbb('0x54'));if(_0x489593[_0x2388e5]||!_0x5969d5['custom']){_0x3f4c99=path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x72390b,_[_0xcdbb('0x5d')]('default_loginLogo.svg'));}if(!fs[_0xcdbb('0x62')](_0x3f4c99)){throw new db[(_0xcdbb('0x63'))][(_0xcdbb('0x64'))](_[_0xcdbb('0x60')](_0xcdbb('0x54'))+_0xcdbb('0x69'));}return _0x505f7b[_0xcdbb('0x6a')](_0x3f4c99);}})[_0xcdbb('0x22')](handleError(_0x505f7b,null));};exports[_0xcdbb('0x6b')]=function(_0x293880,_0x39f521){return db[_0xcdbb('0x46')][_0xcdbb('0x4e')]({'where':{'id':_0x293880[_0xcdbb('0x4b')]['id']},'attributes':[_0xcdbb('0x6c')]})[_0xcdbb('0x1a')](respondWithResult(_0x39f521,null))[_0xcdbb('0x22')](handleError(_0x39f521,null));};exports[_0xcdbb('0x6d')]=function(_0x2cbe8a,_0xc1c32e,_0x3e0f2d){if(_0x2cbe8a[_0xcdbb('0x52')]&&_0x2cbe8a[_0xcdbb('0x52')][_0xcdbb('0x50')]){_0x2cbe8a['body'][_0xcdbb('0x56')]=_0x2cbe8a[_0xcdbb('0x52')][_0xcdbb('0x50')];}return db[_0xcdbb('0x46')][_0xcdbb('0x4e')]({'where':{'id':_0x2cbe8a['params']['id']}})[_0xcdbb('0x1a')](handleEntityNotFound(_0xc1c32e,null))[_0xcdbb('0x1a')](saveUpdates(_0x2cbe8a[_0xcdbb('0x4f')],null))[_0xcdbb('0x1a')](respondWithResult(_0xc1c32e,null))[_0xcdbb('0x22')](handleError(_0xc1c32e,null));};var utilLicense=require(_0xcdbb('0x6e'));exports[_0xcdbb('0x6f')]=function(_0x3f4198,_0x3c2563,_0x26c1b8){var _0x5adbc9='server/files/images/logos';var _0x3b150d={'custom':![]};return utilLicense[_0xcdbb('0x66')]()[_0xcdbb('0x1a')](function(_0x58491f){if(_0x58491f){_0x3b150d=_0x58491f;}return db[_0xcdbb('0x46')]['find']({'where':{'id':_0x3f4198['params']['id']},'attributes':['logo',_0xcdbb('0x54'),'preferred',_0xcdbb('0x57'),_0xcdbb('0x58'),'defaultLoginLogo',_0xcdbb('0x5a'),_0xcdbb('0x5b')],'raw':!![]});})[_0xcdbb('0x1a')](handleEntityNotFound(_0x3c2563,null))[_0xcdbb('0x1a')](function(_0x41686d){if(_0x41686d){var _0x137a4f=_0x41686d[_0xcdbb('0x56')]&&fs[_0xcdbb('0x62')](path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x5adbc9,_[_0xcdbb('0x5d')](_0x41686d['preferred'])))?path['join'](config[_0xcdbb('0x5e')],_0x5adbc9,_[_0xcdbb('0x5d')](_0x41686d[_0xcdbb('0x56')])):path[_0xcdbb('0x5c')](config['root'],_0x5adbc9,_[_0xcdbb('0x5d')](_0xcdbb('0x70')));var _0x131c1f=_0xcdbb('0x68')+_[_0xcdbb('0x60')](_0xcdbb('0x56'));if(_0x41686d[_0x131c1f]||!_0x3b150d[_0xcdbb('0x61')]||!_0x3b150d['preferred']){_0x137a4f=path[_0xcdbb('0x5c')](config['root'],_0x5adbc9,_[_0xcdbb('0x5d')](_0xcdbb('0x70')));}if(!fs['existsSync'](_0x137a4f)){throw new db[(_0xcdbb('0x63'))][(_0xcdbb('0x64'))](_[_0xcdbb('0x60')](_0xcdbb('0x56'))+_0xcdbb('0x69'));}return _0x3c2563['download'](_0x137a4f);}})[_0xcdbb('0x22')](handleError(_0x3c2563,null));};exports[_0xcdbb('0x71')]=function(_0x1b59ca,_0x3eb71b,_0x346f36){if(_0x1b59ca[_0xcdbb('0x52')]&&_0x1b59ca[_0xcdbb('0x52')][_0xcdbb('0x50')]){_0x1b59ca[_0xcdbb('0x4f')][_0xcdbb('0x57')]=_0x1b59ca[_0xcdbb('0x52')][_0xcdbb('0x50')];}return db[_0xcdbb('0x46')][_0xcdbb('0x4e')]({'where':{'id':_0x1b59ca[_0xcdbb('0x4b')]['id']}})[_0xcdbb('0x1a')](handleEntityNotFound(_0x3eb71b,null))['then'](saveUpdates(_0x1b59ca['body'],null))[_0xcdbb('0x1a')](respondWithResult(_0x3eb71b,null))[_0xcdbb('0x22')](handleError(_0x3eb71b,null));};var utilLicense=require(_0xcdbb('0x6e'));exports[_0xcdbb('0x72')]=function(_0x34cbd2,_0x5e61f8,_0x4dcf89){var _0x199f52='server/files/images/logos';var _0x333742={'custom':![]};return utilLicense[_0xcdbb('0x66')]()[_0xcdbb('0x1a')](function(_0x227067){if(_0x227067){_0x333742=_0x227067;}return db['Setting'][_0xcdbb('0x4e')]({'where':{'id':_0x34cbd2['params']['id']},'attributes':['logo','loginLogo',_0xcdbb('0x56'),_0xcdbb('0x57'),_0xcdbb('0x58'),_0xcdbb('0x59'),_0xcdbb('0x5a'),_0xcdbb('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x5e61f8,null))[_0xcdbb('0x1a')](function(_0x55263f){if(_0x55263f){var _0x10ee4a=_0x55263f['favicon']&&fs['existsSync'](path['join'](config[_0xcdbb('0x5e')],_0x199f52,_[_0xcdbb('0x5d')](_0x55263f[_0xcdbb('0x57')])))?path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x199f52,_[_0xcdbb('0x5d')](_0x55263f[_0xcdbb('0x57')])):path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x199f52,_[_0xcdbb('0x5d')](_0xcdbb('0x73')));var _0x2e7adf=_0xcdbb('0x68')+_[_0xcdbb('0x60')](_0xcdbb('0x57'));if(_0x55263f[_0x2e7adf]||!_0x333742[_0xcdbb('0x61')]){_0x10ee4a=path['join'](config[_0xcdbb('0x5e')],_0x199f52,_[_0xcdbb('0x5d')](_0xcdbb('0x73')));}if(!fs[_0xcdbb('0x62')](_0x10ee4a)){throw new db['Sequelize'][(_0xcdbb('0x64'))](_[_0xcdbb('0x60')](_0xcdbb('0x57'))+_0xcdbb('0x69'));}return _0x5e61f8['download'](_0x10ee4a);}})['catch'](handleError(_0x5e61f8,null));};exports[_0xcdbb('0x74')]=function(_0x4a4a63,_0x3ca81d){var _0x52744d={'offset':moment()[_0xcdbb('0x75')]()};_0x52744d[_0xcdbb('0x76')]=moment()['utcOffset'](_0x52744d['offset'])[_0xcdbb('0x77')](_0xcdbb('0x78'));return _0x3ca81d[_0xcdbb('0x23')](0xc8)[_0xcdbb('0x30')](_0x52744d);}; \ No newline at end of file +var _0x4a77=['default_loginLogo.svg','getPreferred','default_preferred.png','default_favicon.ico','download','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/logger','api','../../config/license/util','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','undefined','count','offset','limit','set','Content-Range','reject','save','update','stack','name','index','map','Setting','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','addLogo','file','filename','body','addLogoLogin','loginLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','toLower','root','default_logo.svg','upperFirst','custom','existsSync','Sequelize','ValidationError','\x20not\x20found','getLogoLogin','default'];(function(_0x591c2f,_0x3647c6){var _0x1eddef=function(_0xab8dc0){while(--_0xab8dc0){_0x591c2f['push'](_0x591c2f['shift']());}};_0x1eddef(++_0x3647c6);}(_0x4a77,0x1ee));var _0x74a7=function(_0x433d65,_0x5d119b){_0x433d65=_0x433d65-0x0;var _0x24799c=_0x4a77[_0x433d65];return _0x24799c;};'use strict';var emlformat=require(_0x74a7('0x0'));var rimraf=require(_0x74a7('0x1'));var zipdir=require(_0x74a7('0x2'));var jsonpatch=require(_0x74a7('0x3'));var rp=require(_0x74a7('0x4'));var moment=require(_0x74a7('0x5'));var BPromise=require(_0x74a7('0x6'));var Mustache=require(_0x74a7('0x7'));var util=require('util');var path=require(_0x74a7('0x8'));var sox=require(_0x74a7('0x9'));var csv=require('to-csv');var ejs=require(_0x74a7('0xa'));var fs=require('fs');var fs_extra=require(_0x74a7('0xb'));var _=require(_0x74a7('0xc'));var squel=require(_0x74a7('0xd'));var crypto=require(_0x74a7('0xe'));var jsforce=require(_0x74a7('0xf'));var deskjs=require(_0x74a7('0x10'));var toCsv=require(_0x74a7('0x11'));var querystring=require(_0x74a7('0x12'));var Papa=require(_0x74a7('0x13'));var Redis=require(_0x74a7('0x14'));var authService=require(_0x74a7('0x15'));var qs=require(_0x74a7('0x16'));var as=require(_0x74a7('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74a7('0x18'))(_0x74a7('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x74a7('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x74a7('0x1b'));var client=jayson[_0x74a7('0x1c')][_0x74a7('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x317f64,_0x27be54,_0x198192,_0x49a27b){return new BPromise(function(_0x5aa776,_0x153c36){var _0x1ed503=_0x49a27b||client;return _0x1ed503[_0x74a7('0x1e')](_0x317f64,_0x198192)[_0x74a7('0x1f')](function(_0x455e10){logger[_0x74a7('0x20')](_0x74a7('0x21'),_0x27be54,_0x74a7('0x22'));logger[_0x74a7('0x23')](_0x74a7('0x24'),_0x27be54,_0x74a7('0x22'),JSON['stringify'](_0x455e10));if(_0x455e10[_0x74a7('0x25')]){if(_0x455e10[_0x74a7('0x25')][_0x74a7('0x26')]===0x1f4){logger[_0x74a7('0x25')](_0x74a7('0x21'),_0x27be54,_0x455e10['error']['message']);return _0x153c36(_0x455e10[_0x74a7('0x25')][_0x74a7('0x27')]);}logger[_0x74a7('0x25')](_0x74a7('0x21'),_0x27be54,_0x455e10['error'][_0x74a7('0x27')]);return _0x5aa776(_0x455e10['error']['message']);}else{logger[_0x74a7('0x20')](_0x74a7('0x21'),_0x27be54,_0x74a7('0x22'));_0x5aa776(_0x455e10[_0x74a7('0x28')][_0x74a7('0x27')]);}})[_0x74a7('0x29')](function(_0x24a1e7){logger[_0x74a7('0x25')](_0x74a7('0x21'),_0x27be54,_0x24a1e7);_0x153c36(_0x24a1e7);});});}function respondWithStatusCode(_0xd463cb,_0x1f3418){_0x1f3418=_0x1f3418||0xcc;return function(_0x207c17){if(_0x207c17){return _0xd463cb[_0x74a7('0x2a')](_0x1f3418);}return _0xd463cb[_0x74a7('0x2b')](_0x1f3418)['end']();};}function respondWithResult(_0x493028,_0x1599dd){_0x1599dd=_0x1599dd||0xc8;return function(_0x486c1a){if(_0x486c1a){return _0x493028[_0x74a7('0x2b')](_0x1599dd)['json'](_0x486c1a);}};}function respondWithFilteredResult(_0x63555a,_0x3889cd){return function(_0x4866b8){if(_0x4866b8){var _0x59ed8b=typeof _0x3889cd['offset']===_0x74a7('0x2c')&&typeof _0x3889cd['limit']==='undefined';var _0x3a75f3=_0x4866b8[_0x74a7('0x2d')];var _0x5cf554=_0x59ed8b?0x0:_0x3889cd[_0x74a7('0x2e')];var _0x77aff=_0x59ed8b?_0x4866b8[_0x74a7('0x2d')]:_0x3889cd[_0x74a7('0x2e')]+_0x3889cd[_0x74a7('0x2f')];var _0x5409bf;if(_0x77aff>=_0x3a75f3){_0x77aff=_0x3a75f3;_0x5409bf=0xc8;}else{_0x5409bf=0xce;}_0x63555a['status'](_0x5409bf);return _0x63555a[_0x74a7('0x30')](_0x74a7('0x31'),_0x5cf554+'-'+_0x77aff+'/'+_0x3a75f3)['json'](_0x4866b8);}return null;};}function patchUpdates(_0x3ccce1){return function(_0x1a4703){try{jsonpatch['apply'](_0x1a4703,_0x3ccce1,!![]);}catch(_0x18ff81){return BPromise[_0x74a7('0x32')](_0x18ff81);}return _0x1a4703[_0x74a7('0x33')]();};}function saveUpdates(_0xa7757d,_0x397144){return function(_0x2b5f5e){if(_0x2b5f5e){return _0x2b5f5e[_0x74a7('0x34')](_0xa7757d)[_0x74a7('0x1f')](function(_0x73c369){return _0x73c369;});}return null;};}function removeEntity(_0x14f381,_0xc6b4f0){return function(_0x3695c8){if(_0x3695c8){return _0x3695c8['destroy']()['then'](function(){_0x14f381[_0x74a7('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51868e,_0x158f74){return function(_0x735177){if(!_0x735177){_0x51868e['sendStatus'](0x194);}return _0x735177;};}function handleError(_0x554c53,_0x94a5ca){_0x94a5ca=_0x94a5ca||0x1f4;return function(_0x58b9c0){logger['error'](_0x58b9c0[_0x74a7('0x35')]);if(_0x58b9c0['name']){delete _0x58b9c0[_0x74a7('0x36')];}_0x554c53[_0x74a7('0x2b')](_0x94a5ca)['send'](_0x58b9c0);};}exports[_0x74a7('0x37')]=function(_0x54cf85,_0x13291e){var _0x1430ba={},_0x5971cb={},_0x55579e={'count':0x0,'rows':[]};var _0x237f34=_[_0x74a7('0x38')](db[_0x74a7('0x39')][_0x74a7('0x3a')],function(_0x5dc926){return{'name':_0x5dc926[_0x74a7('0x3b')],'type':_0x5dc926[_0x74a7('0x3c')]['key']};});_0x5971cb[_0x74a7('0x3d')]=_[_0x74a7('0x38')](_0x237f34,_0x74a7('0x36'));_0x5971cb['query']=_[_0x74a7('0x3e')](_0x54cf85['query']);_0x5971cb[_0x74a7('0x3f')]=_[_0x74a7('0x40')](_0x5971cb['model'],_0x5971cb[_0x74a7('0x41')]);_0x1430ba[_0x74a7('0x42')]=_['intersection'](_0x5971cb[_0x74a7('0x3d')],qs[_0x74a7('0x43')](_0x54cf85[_0x74a7('0x41')]['fields']));_0x1430ba[_0x74a7('0x42')]=_0x1430ba['attributes'][_0x74a7('0x44')]?_0x1430ba['attributes']:_0x5971cb['model'];if(!_0x54cf85[_0x74a7('0x41')][_0x74a7('0x45')]('nolimit')){_0x1430ba[_0x74a7('0x2f')]=qs['limit'](_0x54cf85[_0x74a7('0x41')][_0x74a7('0x2f')]);_0x1430ba[_0x74a7('0x2e')]=qs[_0x74a7('0x2e')](_0x54cf85['query'][_0x74a7('0x2e')]);}_0x1430ba[_0x74a7('0x46')]=qs[_0x74a7('0x47')](_0x54cf85[_0x74a7('0x41')][_0x74a7('0x47')]);_0x1430ba['where']=qs[_0x74a7('0x3f')](_[_0x74a7('0x48')](_0x54cf85[_0x74a7('0x41')],_0x5971cb[_0x74a7('0x3f')]),_0x237f34);if(_0x54cf85['query'][_0x74a7('0x49')]){_0x1430ba[_0x74a7('0x4a')]=_[_0x74a7('0x4b')](_0x1430ba[_0x74a7('0x4a')],{'$or':_[_0x74a7('0x38')](_0x237f34,function(_0x21d122){if(_0x21d122[_0x74a7('0x3c')]!==_0x74a7('0x4c')){var _0x40e0b2={};_0x40e0b2[_0x21d122['name']]={'$like':'%'+_0x54cf85[_0x74a7('0x41')][_0x74a7('0x49')]+'%'};return _0x40e0b2;}})});}_0x1430ba=_[_0x74a7('0x4b')]({},_0x1430ba,_0x54cf85[_0x74a7('0x4d')]);var _0x45e15b={'where':_0x1430ba[_0x74a7('0x4a')]};return db[_0x74a7('0x39')][_0x74a7('0x2d')](_0x45e15b)['then'](function(_0x1f346f){_0x55579e[_0x74a7('0x2d')]=_0x1f346f;if(_0x54cf85[_0x74a7('0x41')][_0x74a7('0x4e')]){_0x1430ba['include']=[{'all':!![]}];}return db[_0x74a7('0x39')][_0x74a7('0x4f')](_0x1430ba);})[_0x74a7('0x1f')](function(_0x1b4304){_0x55579e['rows']=_0x1b4304;return _0x55579e;})['then'](respondWithFilteredResult(_0x13291e,_0x1430ba))[_0x74a7('0x29')](handleError(_0x13291e,null));};exports[_0x74a7('0x50')]=function(_0x384ee0,_0x3075a8){var _0x42be86={'raw':![],'where':{'id':_0x384ee0[_0x74a7('0x51')]['id']}},_0x3203fa={};_0x3203fa[_0x74a7('0x3d')]=_['keys'](db[_0x74a7('0x39')][_0x74a7('0x3a')]);_0x3203fa['query']=_[_0x74a7('0x3e')](_0x384ee0[_0x74a7('0x41')]);_0x3203fa[_0x74a7('0x3f')]=_[_0x74a7('0x40')](_0x3203fa[_0x74a7('0x3d')],_0x3203fa[_0x74a7('0x41')]);_0x42be86[_0x74a7('0x42')]=_['intersection'](_0x3203fa[_0x74a7('0x3d')],qs[_0x74a7('0x43')](_0x384ee0['query'][_0x74a7('0x43')]));_0x42be86[_0x74a7('0x42')]=_0x42be86[_0x74a7('0x42')][_0x74a7('0x44')]?_0x42be86[_0x74a7('0x42')]:_0x3203fa['model'];if(_0x384ee0[_0x74a7('0x41')][_0x74a7('0x4e')]){_0x42be86[_0x74a7('0x52')]=[{'all':!![]}];}_0x42be86=_[_0x74a7('0x4b')]({},_0x42be86,_0x384ee0[_0x74a7('0x4d')]);return db[_0x74a7('0x39')]['find'](_0x42be86)[_0x74a7('0x1f')](handleEntityNotFound(_0x3075a8,null))[_0x74a7('0x1f')](respondWithResult(_0x3075a8,null))['catch'](handleError(_0x3075a8,null));};exports['update']=function(_0x2e10e9,_0x253a97){if(_0x2e10e9['body']['id']){delete _0x2e10e9['body']['id'];}return db[_0x74a7('0x39')][_0x74a7('0x53')]({'where':{'id':_0x2e10e9[_0x74a7('0x51')]['id']}})['then'](handleEntityNotFound(_0x253a97,null))[_0x74a7('0x1f')](saveUpdates(_0x2e10e9['body'],null))[_0x74a7('0x1f')](respondWithResult(_0x253a97,null))[_0x74a7('0x29')](handleError(_0x253a97,null));};exports[_0x74a7('0x54')]=function(_0x568578,_0x3558bc,_0x248782){if(_0x568578['file']&&_0x568578[_0x74a7('0x55')][_0x74a7('0x56')]){_0x568578[_0x74a7('0x57')]['logo']=_0x568578['file'][_0x74a7('0x56')];}return db[_0x74a7('0x39')][_0x74a7('0x53')]({'where':{'id':_0x568578[_0x74a7('0x51')]['id']}})[_0x74a7('0x1f')](handleEntityNotFound(_0x3558bc,null))[_0x74a7('0x1f')](saveUpdates(_0x568578[_0x74a7('0x57')],null))['then'](respondWithResult(_0x3558bc,null))[_0x74a7('0x29')](handleError(_0x3558bc,null));};exports[_0x74a7('0x58')]=function(_0x4068b5,_0x105824,_0x2825af){if(_0x4068b5['file']&&_0x4068b5['file'][_0x74a7('0x56')]){_0x4068b5[_0x74a7('0x57')][_0x74a7('0x59')]=_0x4068b5['file'][_0x74a7('0x56')];}return db[_0x74a7('0x39')][_0x74a7('0x53')]({'where':{'id':_0x4068b5[_0x74a7('0x51')]['id']}})['then'](handleEntityNotFound(_0x105824,null))[_0x74a7('0x1f')](saveUpdates(_0x4068b5[_0x74a7('0x57')],null))[_0x74a7('0x1f')](respondWithResult(_0x105824,null))['catch'](handleError(_0x105824,null));};var utilLicense=require(_0x74a7('0x1a'));exports['getLogo']=function(_0x29c147,_0x2e926c,_0x2dbe11){var _0x4dfaa5=_0x74a7('0x5a');var _0x558478={'custom':![]};return utilLicense[_0x74a7('0x5b')]()[_0x74a7('0x1f')](function(_0x3d6312){if(_0x3d6312){_0x558478=_0x3d6312;}return db['Setting'][_0x74a7('0x53')]({'where':{'id':_0x29c147[_0x74a7('0x51')]['id']},'attributes':[_0x74a7('0x5c'),_0x74a7('0x59'),_0x74a7('0x5d'),_0x74a7('0x5e'),_0x74a7('0x5f'),_0x74a7('0x60'),_0x74a7('0x61'),_0x74a7('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x2e926c,null))['then'](function(_0x44782a){if(_0x44782a){var _0x14994b=_0x44782a[_0x74a7('0x5c')]&&fs['existsSync'](path[_0x74a7('0x63')](config['root'],_0x4dfaa5,_[_0x74a7('0x64')](_0x44782a[_0x74a7('0x5c')])))?path[_0x74a7('0x63')](config[_0x74a7('0x65')],_0x4dfaa5,_[_0x74a7('0x64')](_0x44782a[_0x74a7('0x5c')])):path['join'](config[_0x74a7('0x65')],_0x4dfaa5,_[_0x74a7('0x64')](_0x74a7('0x66')));var _0x58b752='default'+_[_0x74a7('0x67')](_0x74a7('0x5c'));if(_0x44782a[_0x58b752]||!_0x558478[_0x74a7('0x68')]){_0x14994b=path[_0x74a7('0x63')](config[_0x74a7('0x65')],_0x4dfaa5,_[_0x74a7('0x64')]('default_logo.svg'));}if(!fs[_0x74a7('0x69')](_0x14994b)){throw new db[(_0x74a7('0x6a'))][(_0x74a7('0x6b'))](_[_0x74a7('0x67')](_0x74a7('0x5c'))+_0x74a7('0x6c'));}return _0x2e926c['download'](_0x14994b);}})[_0x74a7('0x29')](handleError(_0x2e926c,null));};var utilLicense=require(_0x74a7('0x1a'));exports[_0x74a7('0x6d')]=function(_0x2a8bc6,_0x50ef42,_0x4f3e66){var _0x33f698=_0x74a7('0x5a');var _0x189021={'custom':![]};return utilLicense['getLicense']()[_0x74a7('0x1f')](function(_0xde50a4){if(_0xde50a4){_0x189021=_0xde50a4;}return db['Setting'][_0x74a7('0x53')]({'where':{'id':_0x2a8bc6[_0x74a7('0x51')]['id']},'attributes':[_0x74a7('0x5c'),_0x74a7('0x59'),_0x74a7('0x5d'),_0x74a7('0x5e'),_0x74a7('0x5f'),_0x74a7('0x60'),_0x74a7('0x61'),_0x74a7('0x62')],'raw':!![]});})[_0x74a7('0x1f')](handleEntityNotFound(_0x50ef42,null))[_0x74a7('0x1f')](function(_0x2e2f9b){if(_0x2e2f9b){var _0x1c4bb7=_0x2e2f9b[_0x74a7('0x59')]&&fs[_0x74a7('0x69')](path[_0x74a7('0x63')](config[_0x74a7('0x65')],_0x33f698,_[_0x74a7('0x64')](_0x2e2f9b[_0x74a7('0x59')])))?path[_0x74a7('0x63')](config[_0x74a7('0x65')],_0x33f698,_[_0x74a7('0x64')](_0x2e2f9b['loginLogo'])):path[_0x74a7('0x63')](config['root'],_0x33f698,_[_0x74a7('0x64')]('default_loginLogo.svg'));var _0x1a78d4=_0x74a7('0x6e')+_['upperFirst']('loginLogo');if(_0x2e2f9b[_0x1a78d4]||!_0x189021[_0x74a7('0x68')]){_0x1c4bb7=path['join'](config['root'],_0x33f698,_[_0x74a7('0x64')](_0x74a7('0x6f')));}if(!fs[_0x74a7('0x69')](_0x1c4bb7)){throw new db[(_0x74a7('0x6a'))][(_0x74a7('0x6b'))](_[_0x74a7('0x67')](_0x74a7('0x59'))+_0x74a7('0x6c'));}return _0x50ef42['download'](_0x1c4bb7);}})[_0x74a7('0x29')](handleError(_0x50ef42,null));};exports['gdpr']=function(_0x35cc00,_0x578229){return db['Setting']['find']({'where':{'id':_0x35cc00['params']['id']},'attributes':['securePassword']})[_0x74a7('0x1f')](respondWithResult(_0x578229,null))[_0x74a7('0x29')](handleError(_0x578229,null));};exports['addPreferred']=function(_0x4c97d6,_0x18fe74,_0x4a2eec){if(_0x4c97d6[_0x74a7('0x55')]&&_0x4c97d6['file'][_0x74a7('0x56')]){_0x4c97d6[_0x74a7('0x57')]['preferred']=_0x4c97d6[_0x74a7('0x55')][_0x74a7('0x56')];}return db[_0x74a7('0x39')][_0x74a7('0x53')]({'where':{'id':_0x4c97d6[_0x74a7('0x51')]['id']}})[_0x74a7('0x1f')](handleEntityNotFound(_0x18fe74,null))['then'](saveUpdates(_0x4c97d6[_0x74a7('0x57')],null))[_0x74a7('0x1f')](respondWithResult(_0x18fe74,null))[_0x74a7('0x29')](handleError(_0x18fe74,null));};var utilLicense=require(_0x74a7('0x1a'));exports[_0x74a7('0x70')]=function(_0x1c0287,_0x5d6b26,_0xc0d54f){var _0x2be524=_0x74a7('0x5a');var _0x75638d={'custom':![]};return utilLicense[_0x74a7('0x5b')]()['then'](function(_0x1c14ef){if(_0x1c14ef){_0x75638d=_0x1c14ef;}return db[_0x74a7('0x39')][_0x74a7('0x53')]({'where':{'id':_0x1c0287[_0x74a7('0x51')]['id']},'attributes':[_0x74a7('0x5c'),_0x74a7('0x59'),_0x74a7('0x5d'),_0x74a7('0x5e'),'defaultLogo','defaultLoginLogo',_0x74a7('0x61'),_0x74a7('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x5d6b26,null))[_0x74a7('0x1f')](function(_0x4d3a47){if(_0x4d3a47){var _0x597c4c=_0x4d3a47[_0x74a7('0x5d')]&&fs[_0x74a7('0x69')](path[_0x74a7('0x63')](config[_0x74a7('0x65')],_0x2be524,_[_0x74a7('0x64')](_0x4d3a47['preferred'])))?path['join'](config[_0x74a7('0x65')],_0x2be524,_[_0x74a7('0x64')](_0x4d3a47[_0x74a7('0x5d')])):path[_0x74a7('0x63')](config[_0x74a7('0x65')],_0x2be524,_[_0x74a7('0x64')](_0x74a7('0x71')));var _0xe01d26=_0x74a7('0x6e')+_[_0x74a7('0x67')](_0x74a7('0x5d'));if(_0x4d3a47[_0xe01d26]||!_0x75638d[_0x74a7('0x68')]||!_0x75638d[_0x74a7('0x5d')]){_0x597c4c=path[_0x74a7('0x63')](config[_0x74a7('0x65')],_0x2be524,_['toLower'](_0x74a7('0x71')));}if(!fs[_0x74a7('0x69')](_0x597c4c)){throw new db[(_0x74a7('0x6a'))][(_0x74a7('0x6b'))](_[_0x74a7('0x67')](_0x74a7('0x5d'))+_0x74a7('0x6c'));}return _0x5d6b26['download'](_0x597c4c);}})['catch'](handleError(_0x5d6b26,null));};exports['addFavicon']=function(_0x3a19bb,_0x486f2a,_0x193ed3){if(_0x3a19bb['file']&&_0x3a19bb[_0x74a7('0x55')][_0x74a7('0x56')]){_0x3a19bb['body'][_0x74a7('0x5e')]=_0x3a19bb[_0x74a7('0x55')]['filename'];}return db[_0x74a7('0x39')]['find']({'where':{'id':_0x3a19bb[_0x74a7('0x51')]['id']}})['then'](handleEntityNotFound(_0x486f2a,null))['then'](saveUpdates(_0x3a19bb[_0x74a7('0x57')],null))[_0x74a7('0x1f')](respondWithResult(_0x486f2a,null))[_0x74a7('0x29')](handleError(_0x486f2a,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x2442d3,_0x455b47,_0x27e93a){var _0x45a757=_0x74a7('0x5a');var _0x322b43={'custom':![]};return utilLicense[_0x74a7('0x5b')]()[_0x74a7('0x1f')](function(_0x3d6fee){if(_0x3d6fee){_0x322b43=_0x3d6fee;}return db[_0x74a7('0x39')][_0x74a7('0x53')]({'where':{'id':_0x2442d3['params']['id']},'attributes':['logo',_0x74a7('0x59'),_0x74a7('0x5d'),_0x74a7('0x5e'),_0x74a7('0x5f'),_0x74a7('0x60'),'defaultPreferred',_0x74a7('0x62')],'raw':!![]});})['then'](handleEntityNotFound(_0x455b47,null))['then'](function(_0x12fcc3){if(_0x12fcc3){var _0x827e27=_0x12fcc3['favicon']&&fs[_0x74a7('0x69')](path['join'](config[_0x74a7('0x65')],_0x45a757,_['toLower'](_0x12fcc3['favicon'])))?path[_0x74a7('0x63')](config['root'],_0x45a757,_['toLower'](_0x12fcc3[_0x74a7('0x5e')])):path[_0x74a7('0x63')](config['root'],_0x45a757,_[_0x74a7('0x64')]('default_favicon.ico'));var _0x51679f=_0x74a7('0x6e')+_[_0x74a7('0x67')](_0x74a7('0x5e'));if(_0x12fcc3[_0x51679f]||!_0x322b43['custom']){_0x827e27=path[_0x74a7('0x63')](config[_0x74a7('0x65')],_0x45a757,_['toLower'](_0x74a7('0x72')));}if(!fs['existsSync'](_0x827e27)){throw new db[(_0x74a7('0x6a'))][(_0x74a7('0x6b'))](_[_0x74a7('0x67')](_0x74a7('0x5e'))+'\x20not\x20found');}return _0x455b47[_0x74a7('0x73')](_0x827e27);}})['catch'](handleError(_0x455b47,null));};exports[_0x74a7('0x74')]=function(_0x497b50,_0xd41ba8){var _0x22473d={'offset':moment()['utcOffset']()};_0x22473d['now']=moment()[_0x74a7('0x75')](_0x22473d[_0x74a7('0x2e')])[_0x74a7('0x76')](_0x74a7('0x77'));return _0xd41ba8[_0x74a7('0x2b')](0xc8)[_0x74a7('0x78')](_0x22473d);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index ac1650f..23a325b 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(_0x52e52b,_0x172445){var _0x26a280=function(_0x56c60d){while(--_0x56c60d){_0x52e52b['push'](_0x52e52b['shift']());}};_0x26a280(++_0x172445);}(_0xedd9,0xfc));var _0x9edd=function(_0x236101,_0x1daa6e){_0x236101=_0x236101-0x0;var _0x546eb5=_0xedd9[_0x236101];return _0x546eb5;};'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 _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 3060389..b8ab74b 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 _0x6760=['../../config/utils','rpc','../../config/environment','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSetting','Setting','find','options','where','map','include','model','attributes','then','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x6760,0x13a));var _0x0676=function(_0x46e39f,_0x5066c7){_0x46e39f=_0x46e39f-0x0;var _0x4bf790=_0x6760[_0x46e39f];return _0x4bf790;};'use strict';var _=require(_0x0676('0x0'));var util=require('util');var moment=require(_0x0676('0x1'));var BPromise=require(_0x0676('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0676('0x3'));var db=require(_0x0676('0x4'))['db'];var utils=require(_0x0676('0x5'));var logger=require('../../config/logger')(_0x0676('0x6'));var config=require(_0x0676('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0676('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x306570,_0x3eb932,_0x5d9617){return new BPromise(function(_0x598d5f,_0x56e8ab){return client[_0x0676('0x9')](_0x306570,_0x5d9617)['then'](function(_0x174bb8){logger[_0x0676('0xa')](_0x0676('0xb'),_0x3eb932,_0x0676('0xc'));logger[_0x0676('0xd')](_0x0676('0xe'),_0x3eb932,'request\x20sent',JSON['stringify'](_0x174bb8));if(_0x174bb8[_0x0676('0xf')]){if(_0x174bb8[_0x0676('0xf')][_0x0676('0x10')]===0x1f4){logger[_0x0676('0xf')](_0x0676('0xb'),_0x3eb932,_0x174bb8[_0x0676('0xf')][_0x0676('0x11')]);return _0x56e8ab(_0x174bb8[_0x0676('0xf')][_0x0676('0x11')]);}logger[_0x0676('0xf')](_0x0676('0xb'),_0x3eb932,_0x174bb8[_0x0676('0xf')]['message']);return _0x598d5f(_0x174bb8[_0x0676('0xf')][_0x0676('0x11')]);}else{logger[_0x0676('0xa')](_0x0676('0xb'),_0x3eb932,_0x0676('0xc'));_0x598d5f(_0x174bb8['result'][_0x0676('0x11')]);}})[_0x0676('0x12')](function(_0x25087f){logger[_0x0676('0xf')](_0x0676('0xb'),_0x3eb932,_0x25087f);_0x56e8ab(_0x25087f);});});}exports[_0x0676('0x13')]=function(_0x52424b){var _0x1acb97=this;return new Promise(function(_0x514b49,_0x505032){return db[_0x0676('0x14')][_0x0676('0x15')]({'raw':_0x52424b['options']?_0x52424b[_0x0676('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x52424b[_0x0676('0x16')]?_0x52424b[_0x0676('0x16')][_0x0676('0x17')]||null:null,'attributes':_0x52424b[_0x0676('0x16')]?_0x52424b['options']['attributes']||null:null,'include':_0x52424b[_0x0676('0x16')]?_0x52424b[_0x0676('0x16')]['include']?_[_0x0676('0x18')](_0x52424b['options'][_0x0676('0x19')],function(_0x456311){return{'model':db[_0x456311[_0x0676('0x1a')]],'as':_0x456311['as'],'attributes':_0x456311['attributes'],'include':_0x456311[_0x0676('0x19')]?_[_0x0676('0x18')](_0x456311['include'],function(_0x5635b1){return{'model':db[_0x5635b1[_0x0676('0x1a')]],'as':_0x5635b1['as'],'attributes':_0x5635b1[_0x0676('0x1b')],'include':_0x5635b1[_0x0676('0x19')]?_['map'](_0x5635b1[_0x0676('0x19')],function(_0x3863c3){return{'model':db[_0x3863c3['model']],'as':_0x3863c3['as'],'attributes':_0x3863c3['attributes']};}):[]};}):[]};}):[]:[]})[_0x0676('0x1c')](function(_0x3532b0){logger[_0x0676('0xa')](_0x0676('0x13'),_0x52424b);logger['debug'](_0x0676('0x13'),_0x52424b,JSON['stringify'](_0x3532b0));_0x514b49(_0x3532b0);})[_0x0676('0x12')](function(_0x523507){logger[_0x0676('0xf')](_0x0676('0x13'),_0x523507['message'],_0x52424b);_0x505032(_0x1acb97['error'](0x1f4,_0x523507['message']));});});}; \ No newline at end of file +var _0xbe23=['error','code','Setting,\x20%s,\x20%s','message','catch','ShowSetting','find','options','raw','where','attributes','include','model','map','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4faff7,_0x5e7f45){var _0x505410=function(_0x30b76c){while(--_0x30b76c){_0x4faff7['push'](_0x4faff7['shift']());}};_0x505410(++_0x5e7f45);}(_0xbe23,0xe7));var _0x3be2=function(_0x219d1e,_0x1931cb){_0x219d1e=_0x219d1e-0x0;var _0x28a50f=_0xbe23[_0x219d1e];return _0x28a50f;};'use strict';var _=require(_0x3be2('0x0'));var util=require(_0x3be2('0x1'));var moment=require('moment');var BPromise=require(_0x3be2('0x2'));var rs=require(_0x3be2('0x3'));var fs=require('fs');var Redis=require(_0x3be2('0x4'));var db=require(_0x3be2('0x5'))['db'];var utils=require(_0x3be2('0x6'));var logger=require(_0x3be2('0x7'))('rpc');var config=require(_0x3be2('0x8'));var jayson=require(_0x3be2('0x9'));var client=jayson['client'][_0x3be2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a0ea3,_0x338ff2,_0x572898){return new BPromise(function(_0x53dbda,_0x37d333){return client[_0x3be2('0xb')](_0x3a0ea3,_0x572898)['then'](function(_0x5db222){logger[_0x3be2('0xc')]('Setting,\x20%s,\x20%s',_0x338ff2,_0x3be2('0xd'));logger[_0x3be2('0xe')](_0x3be2('0xf'),_0x338ff2,_0x3be2('0xd'),JSON[_0x3be2('0x10')](_0x5db222));if(_0x5db222[_0x3be2('0x11')]){if(_0x5db222[_0x3be2('0x11')][_0x3be2('0x12')]===0x1f4){logger[_0x3be2('0x11')](_0x3be2('0x13'),_0x338ff2,_0x5db222[_0x3be2('0x11')][_0x3be2('0x14')]);return _0x37d333(_0x5db222['error'][_0x3be2('0x14')]);}logger[_0x3be2('0x11')]('Setting,\x20%s,\x20%s',_0x338ff2,_0x5db222[_0x3be2('0x11')][_0x3be2('0x14')]);return _0x53dbda(_0x5db222['error'][_0x3be2('0x14')]);}else{logger[_0x3be2('0xc')](_0x3be2('0x13'),_0x338ff2,_0x3be2('0xd'));_0x53dbda(_0x5db222['result']['message']);}})[_0x3be2('0x15')](function(_0x38b3b6){logger[_0x3be2('0x11')]('Setting,\x20%s,\x20%s',_0x338ff2,_0x38b3b6);_0x37d333(_0x38b3b6);});});}exports[_0x3be2('0x16')]=function(_0x115d05){var _0x23e379=this;return new Promise(function(_0x4f34ee,_0x23196b){return db['Setting'][_0x3be2('0x17')]({'raw':_0x115d05[_0x3be2('0x18')]?_0x115d05[_0x3be2('0x18')][_0x3be2('0x19')]===undefined?!![]:![]:!![],'where':_0x115d05[_0x3be2('0x18')]?_0x115d05[_0x3be2('0x18')][_0x3be2('0x1a')]||null:null,'attributes':_0x115d05[_0x3be2('0x18')]?_0x115d05[_0x3be2('0x18')][_0x3be2('0x1b')]||null:null,'include':_0x115d05[_0x3be2('0x18')]?_0x115d05['options'][_0x3be2('0x1c')]?_['map'](_0x115d05[_0x3be2('0x18')][_0x3be2('0x1c')],function(_0x25f1e1){return{'model':db[_0x25f1e1[_0x3be2('0x1d')]],'as':_0x25f1e1['as'],'attributes':_0x25f1e1[_0x3be2('0x1b')],'include':_0x25f1e1['include']?_[_0x3be2('0x1e')](_0x25f1e1[_0x3be2('0x1c')],function(_0x3d23dd){return{'model':db[_0x3d23dd['model']],'as':_0x3d23dd['as'],'attributes':_0x3d23dd['attributes'],'include':_0x3d23dd[_0x3be2('0x1c')]?_[_0x3be2('0x1e')](_0x3d23dd[_0x3be2('0x1c')],function(_0x30c29b){return{'model':db[_0x30c29b[_0x3be2('0x1d')]],'as':_0x30c29b['as'],'attributes':_0x30c29b[_0x3be2('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18e46e){logger[_0x3be2('0xc')]('ShowSetting',_0x115d05);logger[_0x3be2('0xe')](_0x3be2('0x16'),_0x115d05,JSON[_0x3be2('0x10')](_0x18e46e));_0x4f34ee(_0x18e46e);})['catch'](function(_0xc37b1c){logger[_0x3be2('0x11')](_0x3be2('0x16'),_0xc37b1c[_0x3be2('0x14')],_0x115d05);_0x23196b(_0x23e379[_0x3be2('0x11')](0x1f4,_0xc37b1c['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index b3d4433..de60ac8 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(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x33f265,_0x12cecd){var _0x1d1124=function(_0x5a68e2){while(--_0x5a68e2){_0x33f265['push'](_0x33f265['shift']());}};_0x1d1124(++_0x12cecd);}(_0x7a54,0x106));var _0x47a5=function(_0x1238d6,_0x5e90cf){_0x1238d6=_0x1238d6-0x0;var _0x2fc0d3=_0x7a54[_0x1238d6];return _0x2fc0d3;};'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['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 153cce2..df5da4c 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 _0x7608=['csc','intelepeer','ENUM','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','name','generate','twilio','skebby','clicksend','plivo'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7608,0xf3));var _0x8760=function(_0x226857,_0x183547){_0x226857=_0x226857-0x0;var _0x21281d=_0x7608[_0x226857];return _0x21281d;};'use strict';var Sequelize=require(_0x8760('0x0'));var rs=require(_0x8760('0x1'));module['exports']={'name':{'type':Sequelize[_0x8760('0x2')],'unique':_0x8760('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x8760('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8760('0x4')]();}},'phone':{'type':Sequelize[_0x8760('0x2')]},'type':{'type':Sequelize['ENUM'](_0x8760('0x5'),_0x8760('0x6'),'connectel',_0x8760('0x7'),_0x8760('0x8'),'clickatell','bandwidth',_0x8760('0x9'),'infobip',_0x8760('0xa'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x8760('0x2')]},'authToken':{'type':Sequelize[_0x8760('0x2')]},'smsMethod':{'type':Sequelize[_0x8760('0xb')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x8760('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x8760('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x8760('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x8760('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8760('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x8760('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'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[_0x8760('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8760('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8760('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8760('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8760('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8760('0xe')],'comment':_0x8760('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x8760('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3c2854){if(!_0x3c2854)this[_0x8760('0x10')](_0x8760('0x11'),null);this[_0x8760('0x10')]('mandatoryDisposition',_0x3c2854);}}}; \ No newline at end of file +var _0x534b=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','name','STRING','generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth','infobip','BOOLEAN'];(function(_0xb95d62,_0x16abe1){var _0xdc411e=function(_0x2c5aba){while(--_0x2c5aba){_0xb95d62['push'](_0xb95d62['shift']());}};_0xdc411e(++_0x16abe1);}(_0x534b,0x1d2));var _0xb534=function(_0x5ee265,_0x5ba949){_0x5ee265=_0x5ee265-0x0;var _0x4eae32=_0x534b[_0x5ee265];return _0x4eae32;};'use strict';var Sequelize=require(_0xb534('0x0'));var rs=require('randomstring');module[_0xb534('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb534('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xb534('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xb534('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb534('0x3')],'defaultValue':function(){return rs[_0xb534('0x4')]();}},'phone':{'type':Sequelize[_0xb534('0x3')]},'type':{'type':Sequelize[_0xb534('0x5')](_0xb534('0x6'),_0xb534('0x7'),'connectel',_0xb534('0x8'),_0xb534('0x9'),_0xb534('0xa'),_0xb534('0xb'),'csc',_0xb534('0xc'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xb534('0x3')]},'smsMethod':{'type':Sequelize[_0xb534('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xb534('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xb534('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xb534('0x3')]},'senderString':{'type':Sequelize[_0xb534('0x3')]},'deliveryReport':{'type':Sequelize[_0xb534('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xb534('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb534('0xe')],'defaultValue':function(){return _0xb534('0xf');}},'notificationSound':{'type':Sequelize[_0xb534('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb534('0xd')],'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[_0xb534('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb534('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb534('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb534('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb534('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb534('0xd')],'defaultValue':![],'comment':_0xb534('0x11'),'set':function(_0x42eeaa){if(!_0x42eeaa)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xb534('0x12')](_0xb534('0x13'),_0x42eeaa);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index a135bef..ac06b9e 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 _0xf70c=['attributes','intersection','length','hasOwnProperty','sort','where','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','order','pick','SmsAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','messageId','MessageSid','sender','plivo','Text','MessageUUID','infobip','results','text','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','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','Contacts','DESC','list','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','twilio','Content-Type','text/xml','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','getInteractions','SmsInteraction','Contact','Owner','fullname','internal','Tags','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','connectel','clicksend','message_id','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','statusGet','csc','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','zip-dir','request-promise','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','filters'];(function(_0x148279,_0x487999){var _0x36aa23=function(_0x3c529a){while(--_0x3c529a){_0x148279['push'](_0x148279['shift']());}};_0x36aa23(++_0x487999);}(_0xf70c,0x18f));var _0xcf70=function(_0x3e9482,_0xc9773d){_0x3e9482=_0x3e9482-0x0;var _0x42201c=_0xf70c[_0x3e9482];return _0x42201c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf70('0x0'));var zipdir=require(_0xcf70('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf70('0x2'));var moment=require('moment');var BPromise=require(_0xcf70('0x3'));var Mustache=require(_0xcf70('0x4'));var util=require('util');var path=require('path');var sox=require(_0xcf70('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf70('0x6'));var _=require(_0xcf70('0x7'));var squel=require(_0xcf70('0x8'));var crypto=require(_0xcf70('0x9'));var jsforce=require(_0xcf70('0xa'));var deskjs=require(_0xcf70('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcf70('0xc'));var Papa=require(_0xcf70('0xd'));var Redis=require('ioredis');var authService=require(_0xcf70('0xe'));var qs=require(_0xcf70('0xf'));var as=require(_0xcf70('0x10'));var hardwareService=require(_0xcf70('0x11'));var logger=require(_0xcf70('0x12'))(_0xcf70('0x13'));var utils=require(_0xcf70('0x14'));var config=require(_0xcf70('0x15'));var licenseUtil=require(_0xcf70('0x16'));var db=require(_0xcf70('0x17'))['db'];config[_0xcf70('0x18')]=_[_0xcf70('0x19')](config[_0xcf70('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xcf70('0x1a'))(new Redis(config[_0xcf70('0x18')]));require(_0xcf70('0x1b'))[_0xcf70('0x1c')](socket);var jayson=require(_0xcf70('0x1d'));var client=jayson[_0xcf70('0x1e')][_0xcf70('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x2155fb,_0x503f2a,_0x19515f,_0x428d13){return new BPromise(function(_0xb2471a,_0x415d23){var _0x16120a=_0x428d13||client;return _0x16120a[_0xcf70('0x20')](_0x2155fb,_0x19515f)[_0xcf70('0x21')](function(_0x8546){logger[_0xcf70('0x22')](_0xcf70('0x23'),_0x503f2a,'request\x20sent');logger[_0xcf70('0x24')](_0xcf70('0x25'),_0x503f2a,_0xcf70('0x26'),JSON[_0xcf70('0x27')](_0x8546));if(_0x8546[_0xcf70('0x28')]){if(_0x8546['error']['code']===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x503f2a,_0x8546['error'][_0xcf70('0x29')]);return _0x415d23(_0x8546['error']['message']);}logger[_0xcf70('0x28')](_0xcf70('0x23'),_0x503f2a,_0x8546['error']['message']);return _0xb2471a(_0x8546[_0xcf70('0x28')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x503f2a,_0xcf70('0x26'));_0xb2471a(_0x8546[_0xcf70('0x2a')][_0xcf70('0x29')]);}})[_0xcf70('0x2b')](function(_0x3fc994){logger['error'](_0xcf70('0x23'),_0x503f2a,_0x3fc994);_0x415d23(_0x3fc994);});});}function respondWithStatusCode(_0x3991a0,_0x2536e0){_0x2536e0=_0x2536e0||0xcc;return function(_0x164f7d){if(_0x164f7d){return _0x3991a0[_0xcf70('0x2c')](_0x2536e0);}return _0x3991a0[_0xcf70('0x2d')](_0x2536e0)[_0xcf70('0x2e')]();};}function respondWithResult(_0x529e73,_0x43e92a){_0x43e92a=_0x43e92a||0xc8;return function(_0xf9e4a8){if(_0xf9e4a8){return _0x529e73[_0xcf70('0x2d')](_0x43e92a)['json'](_0xf9e4a8);}};}function respondWithFilteredResult(_0x303246,_0xe17136){return function(_0xcca1f6){if(_0xcca1f6){var _0x4823e5=typeof _0xe17136[_0xcf70('0x2f')]===_0xcf70('0x30')&&typeof _0xe17136['limit']===_0xcf70('0x30');var _0x974887=_0xcca1f6[_0xcf70('0x31')];var _0x5e544d=_0x4823e5?0x0:_0xe17136[_0xcf70('0x2f')];var _0x5537a1=_0x4823e5?_0xcca1f6['count']:_0xe17136[_0xcf70('0x2f')]+_0xe17136[_0xcf70('0x32')];var _0x207ef7;if(_0x5537a1>=_0x974887){_0x5537a1=_0x974887;_0x207ef7=0xc8;}else{_0x207ef7=0xce;}_0x303246['status'](_0x207ef7);return _0x303246[_0xcf70('0x33')](_0xcf70('0x34'),_0x5e544d+'-'+_0x5537a1+'/'+_0x974887)[_0xcf70('0x35')](_0xcca1f6);}return null;};}function patchUpdates(_0x593daa){return function(_0x5b727e){try{jsonpatch[_0xcf70('0x36')](_0x5b727e,_0x593daa,!![]);}catch(_0x33332f){return BPromise[_0xcf70('0x37')](_0x33332f);}return _0x5b727e[_0xcf70('0x38')]();};}function saveUpdates(_0x380d0f,_0x4e44a3){return function(_0x25e4cf){if(_0x25e4cf){return _0x25e4cf[_0xcf70('0x39')](_0x380d0f)[_0xcf70('0x21')](function(_0x213b3c){return _0x213b3c;});}return null;};}function removeEntity(_0x1df26f,_0x34bce4){return function(_0x3722b2){if(_0x3722b2){return _0x3722b2[_0xcf70('0x3a')]()[_0xcf70('0x21')](function(){var _0x3c66c1=_0x3722b2[_0xcf70('0x3b')]({'plain':!![]});var _0x5f59ba=_0xcf70('0x3c');return db['UserProfileResource']['destroy']({'where':{'type':_0x5f59ba,'resourceId':_0x3c66c1['id']}})[_0xcf70('0x21')](function(){return _0x3722b2;});})[_0xcf70('0x21')](function(){_0x1df26f[_0xcf70('0x2d')](0xcc)[_0xcf70('0x2e')]();});}};}function handleEntityNotFound(_0x573fc8,_0x4d79cd){return function(_0x58d36c){if(!_0x58d36c){_0x573fc8['sendStatus'](0x194);}return _0x58d36c;};}function handleError(_0x21b804,_0x19a215){_0x19a215=_0x19a215||0x1f4;return function(_0x1e9fd8){logger[_0xcf70('0x28')](_0x1e9fd8[_0xcf70('0x3d')]);if(_0x1e9fd8[_0xcf70('0x3e')]){delete _0x1e9fd8[_0xcf70('0x3e')];}_0x21b804['status'](_0x19a215)[_0xcf70('0x3f')](_0x1e9fd8);};}exports[_0xcf70('0x40')]=function(_0x46cbba,_0x5a9564){var _0x576e84={'include':[{'model':db[_0xcf70('0x41')],'as':_0xcf70('0x42')}]},_0x4f3251={},_0x57b794={'count':0x0,'rows':[]};var _0x19c78d=_[_0xcf70('0x43')](db[_0xcf70('0x44')][_0xcf70('0x45')],function(_0x5aa5ca){return{'name':_0x5aa5ca[_0xcf70('0x46')],'type':_0x5aa5ca[_0xcf70('0x47')][_0xcf70('0x48')]};});_0x4f3251[_0xcf70('0x49')]=_[_0xcf70('0x43')](_0x19c78d,_0xcf70('0x3e'));_0x4f3251['query']=_[_0xcf70('0x4a')](_0x46cbba[_0xcf70('0x4b')]);_0x4f3251[_0xcf70('0x4c')]=_['intersection'](_0x4f3251[_0xcf70('0x49')],_0x4f3251[_0xcf70('0x4b')]);_0x576e84[_0xcf70('0x4d')]=_[_0xcf70('0x4e')](_0x4f3251['model'],qs['fields'](_0x46cbba[_0xcf70('0x4b')]['fields']));_0x576e84[_0xcf70('0x4d')]=_0x576e84[_0xcf70('0x4d')][_0xcf70('0x4f')]?_0x576e84[_0xcf70('0x4d')]:_0x4f3251['model'];if(!_0x46cbba[_0xcf70('0x4b')][_0xcf70('0x50')]('nolimit')){_0x576e84[_0xcf70('0x32')]=qs['limit'](_0x46cbba[_0xcf70('0x4b')][_0xcf70('0x32')]);_0x576e84[_0xcf70('0x2f')]=qs[_0xcf70('0x2f')](_0x46cbba[_0xcf70('0x4b')][_0xcf70('0x2f')]);}_0x576e84['order']=qs[_0xcf70('0x51')](_0x46cbba[_0xcf70('0x4b')][_0xcf70('0x51')]);_0x576e84[_0xcf70('0x52')]=qs[_0xcf70('0x4c')](_['pick'](_0x46cbba[_0xcf70('0x4b')],_0x4f3251[_0xcf70('0x4c')]),_0x19c78d);if(_0x46cbba[_0xcf70('0x4b')]['filter']){_0x576e84[_0xcf70('0x52')]=_['merge'](_0x576e84[_0xcf70('0x52')],{'$or':_['map'](_0x19c78d,function(_0x559cda){if(_0x559cda['type']!==_0xcf70('0x53')){var _0x4a3593={};_0x4a3593[_0x559cda['name']]={'$like':'%'+_0x46cbba[_0xcf70('0x4b')][_0xcf70('0x54')]+'%'};return _0x4a3593;}})});}_0x576e84=_[_0xcf70('0x55')]({},_0x576e84,_0x46cbba[_0xcf70('0x56')]);var _0x17d95e={'where':_0x576e84['where']};return db[_0xcf70('0x44')][_0xcf70('0x31')](_0x17d95e)['then'](function(_0x3892e3){_0x57b794['count']=_0x3892e3;if(_0x46cbba[_0xcf70('0x4b')][_0xcf70('0x57')]){_0x576e84[_0xcf70('0x58')]=[{'all':!![]}];}return db[_0xcf70('0x44')]['findAll'](_0x576e84);})[_0xcf70('0x21')](function(_0x55cb46){_0x57b794[_0xcf70('0x59')]=_0x55cb46;return _0x57b794;})['then'](respondWithFilteredResult(_0x5a9564,_0x576e84))[_0xcf70('0x2b')](handleError(_0x5a9564,null));};exports[_0xcf70('0x5a')]=function(_0x29f50a,_0x247744){var _0x1a8a44={'raw':![],'where':{'id':_0x29f50a[_0xcf70('0x5b')]['id']},'include':[{'model':db[_0xcf70('0x41')],'as':_0xcf70('0x42')}]},_0x452640={};_0x452640[_0xcf70('0x49')]=_[_0xcf70('0x4a')](db[_0xcf70('0x44')][_0xcf70('0x45')]);_0x452640['query']=_['keys'](_0x29f50a[_0xcf70('0x4b')]);_0x452640[_0xcf70('0x4c')]=_[_0xcf70('0x4e')](_0x452640[_0xcf70('0x49')],_0x452640[_0xcf70('0x4b')]);_0x1a8a44[_0xcf70('0x4d')]=_['intersection'](_0x452640[_0xcf70('0x49')],qs['fields'](_0x29f50a['query'][_0xcf70('0x5c')]));_0x1a8a44[_0xcf70('0x4d')]=_0x1a8a44[_0xcf70('0x4d')]['length']?_0x1a8a44[_0xcf70('0x4d')]:_0x452640[_0xcf70('0x49')];if(_0x29f50a[_0xcf70('0x4b')][_0xcf70('0x57')]){_0x1a8a44[_0xcf70('0x58')]=[{'all':!![]}];}_0x1a8a44=_[_0xcf70('0x55')]({},_0x1a8a44,_0x29f50a[_0xcf70('0x56')]);return db[_0xcf70('0x44')][_0xcf70('0x5d')](_0x1a8a44)['then'](handleEntityNotFound(_0x247744,null))[_0xcf70('0x21')](respondWithResult(_0x247744,null))['catch'](handleError(_0x247744,null));};exports[_0xcf70('0x5e')]=function(_0x534e56,_0x47a4bd){return db[_0xcf70('0x44')][_0xcf70('0x5e')](_0x534e56[_0xcf70('0x5f')],{})[_0xcf70('0x21')](function(_0x44ed78){var _0x48d940=_0x534e56[_0xcf70('0x60')][_0xcf70('0x3b')]({'plain':!![]});if(!_0x48d940)throw new Error(_0xcf70('0x61'));if(_0x48d940['role']===_0xcf70('0x60')){var _0x1deba5=_0x44ed78['get']({'plain':!![]});var _0x557650=_0xcf70('0x3c');return db[_0xcf70('0x62')][_0xcf70('0x5d')]({'where':{'name':_0x557650,'userProfileId':_0x48d940[_0xcf70('0x63')]},'raw':!![]})['then'](function(_0x9333fc){if(_0x9333fc&&_0x9333fc[_0xcf70('0x64')]===0x0){return db[_0xcf70('0x65')]['create']({'name':_0x1deba5[_0xcf70('0x3e')],'resourceId':_0x1deba5['id'],'type':_0x9333fc[_0xcf70('0x3e')],'sectionId':_0x9333fc['id']},{})[_0xcf70('0x21')](function(){return _0x44ed78;});}else{return _0x44ed78;}})[_0xcf70('0x2b')](function(_0x124488){logger[_0xcf70('0x28')](_0xcf70('0x66'),_0x124488);throw _0x124488;});}return _0x44ed78;})[_0xcf70('0x21')](respondWithResult(_0x47a4bd,0xc9))[_0xcf70('0x2b')](handleError(_0x47a4bd,null));};exports[_0xcf70('0x39')]=function(_0x26cc6b,_0x236a5d){if(_0x26cc6b['body']['id']){delete _0x26cc6b[_0xcf70('0x5f')]['id'];}return db[_0xcf70('0x44')]['find']({'where':{'id':_0x26cc6b['params']['id']},'include':[{'model':db[_0xcf70('0x41')],'as':'mandatoryDispositionPause'}]})[_0xcf70('0x21')](handleEntityNotFound(_0x236a5d,null))[_0xcf70('0x21')](saveUpdates(_0x26cc6b[_0xcf70('0x5f')],null))[_0xcf70('0x21')](respondWithResult(_0x236a5d,null))[_0xcf70('0x2b')](handleError(_0x236a5d,null));};exports['destroy']=function(_0x419170,_0x4ec1a2){return db[_0xcf70('0x44')][_0xcf70('0x5d')]({'where':{'id':_0x419170[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x4ec1a2,null))['then'](removeEntity(_0x4ec1a2,null))[_0xcf70('0x2b')](handleError(_0x4ec1a2,null));};exports[_0xcf70('0x67')]=function(_0x42947a,_0x23f330){return db['SmsAccount'][_0xcf70('0x67')]()[_0xcf70('0x21')](respondWithResult(_0x23f330,null))['catch'](handleError(_0x23f330,null));};exports['addDisposition']=function(_0x5e3268,_0x13ae85,_0x22fc65){if(_0x5e3268[_0xcf70('0x5f')]['id']){delete _0x5e3268['body']['id'];}return db[_0xcf70('0x44')][_0xcf70('0x5d')]({'where':{'id':_0x5e3268['params']['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x13ae85,null))[_0xcf70('0x21')](function(_0x45cbb5){if(_0x45cbb5){_0x5e3268[_0xcf70('0x5f')]['SmsAccountId']=_0x45cbb5['id'];return db[_0xcf70('0x68')][_0xcf70('0x5e')](_0x5e3268[_0xcf70('0x5f')]);}})[_0xcf70('0x21')](respondWithResult(_0x13ae85,null))[_0xcf70('0x2b')](handleError(_0x13ae85,null));};exports[_0xcf70('0x69')]=function(_0x67197a,_0x495c7c,_0x4d96d9){var _0x18f809={'raw':![],'where':{}};var _0x396cbd={};var _0x9aead9={'count':0x0,'rows':[]};return db[_0xcf70('0x44')][_0xcf70('0x6a')]({'where':{'id':_0x67197a[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x495c7c,null))[_0xcf70('0x21')](function(_0x3d3c36){if(_0x3d3c36){_0x396cbd[_0xcf70('0x49')]=_['keys'](db[_0xcf70('0x68')][_0xcf70('0x45')]);_0x396cbd['query']=_[_0xcf70('0x4a')](_0x67197a[_0xcf70('0x4b')]);_0x396cbd['filters']=_['intersection'](_0x396cbd['model'],_0x396cbd[_0xcf70('0x4b')]);_0x18f809[_0xcf70('0x4d')]=_[_0xcf70('0x4e')](_0x396cbd[_0xcf70('0x49')],qs[_0xcf70('0x5c')](_0x67197a[_0xcf70('0x4b')][_0xcf70('0x5c')]));_0x18f809[_0xcf70('0x4d')]=_0x18f809['attributes']['length']?_0x18f809[_0xcf70('0x4d')]:_0x396cbd[_0xcf70('0x49')];if(!_0x67197a['query'][_0xcf70('0x50')]('nolimit')){_0x18f809[_0xcf70('0x32')]=qs[_0xcf70('0x32')](_0x67197a[_0xcf70('0x4b')][_0xcf70('0x32')]);_0x18f809[_0xcf70('0x2f')]=qs[_0xcf70('0x2f')](_0x67197a[_0xcf70('0x4b')]['offset']);}_0x18f809[_0xcf70('0x6b')]=qs[_0xcf70('0x51')](_0x67197a[_0xcf70('0x4b')][_0xcf70('0x51')]);_0x18f809['where']=qs[_0xcf70('0x4c')](_[_0xcf70('0x6c')](_0x67197a['query'],_0x396cbd[_0xcf70('0x4c')]));_0x18f809[_0xcf70('0x52')][_0xcf70('0x6d')]=_0x3d3c36['id'];if(_0x67197a[_0xcf70('0x4b')][_0xcf70('0x54')]){_0x18f809[_0xcf70('0x52')]=_[_0xcf70('0x55')](_0x18f809[_0xcf70('0x52')],{'$or':_['map'](_0x18f809[_0xcf70('0x4d')],function(_0xa2879d){var _0x2d91ff={};_0x2d91ff[_0xa2879d]={'$like':'%'+_0x67197a['query']['filter']+'%'};return _0x2d91ff;})});}_0x18f809=_['merge']({},_0x18f809,_0x67197a[_0xcf70('0x56')]);return db[_0xcf70('0x68')][_0xcf70('0x31')]({'where':_0x18f809[_0xcf70('0x52')]})[_0xcf70('0x21')](function(_0x1bb141){_0x9aead9[_0xcf70('0x31')]=_0x1bb141;if(_0x67197a[_0xcf70('0x4b')][_0xcf70('0x57')]){_0x18f809[_0xcf70('0x58')]=[{'all':!![]}];}return db[_0xcf70('0x68')][_0xcf70('0x6e')](_0x18f809);})['then'](function(_0x6508ba){_0x9aead9['rows']=_0x6508ba;return _0x9aead9;});}})[_0xcf70('0x21')](respondWithFilteredResult(_0x495c7c,_0x18f809))[_0xcf70('0x2b')](handleError(_0x495c7c,null));};exports[_0xcf70('0x6f')]=function(_0x2c7786,_0x51e07c,_0x3446b2){return db[_0xcf70('0x44')]['find']({'where':{'id':_0x2c7786[_0xcf70('0x5b')]['id']}})['then'](handleEntityNotFound(_0x51e07c,null))[_0xcf70('0x21')](function(_0x36bd4c){if(_0x36bd4c){return _0x36bd4c['removeDispositions'](_0x2c7786['query'][_0xcf70('0x70')]);}})['then'](respondWithStatusCode(_0x51e07c,null))[_0xcf70('0x2b')](handleError(_0x51e07c,null));};exports[_0xcf70('0x71')]=function(_0x1540bd,_0x3a1b60,_0x5147ce){if(_0x1540bd['body']['id']){delete _0x1540bd['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x1540bd[_0xcf70('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3a1b60,null))[_0xcf70('0x21')](function(_0x29ac47){if(_0x29ac47){_0x1540bd[_0xcf70('0x5f')][_0xcf70('0x6d')]=_0x29ac47['id'];return db[_0xcf70('0x72')][_0xcf70('0x5e')](_0x1540bd[_0xcf70('0x5f')]);}})['then'](respondWithResult(_0x3a1b60,null))[_0xcf70('0x2b')](handleError(_0x3a1b60,null));};exports[_0xcf70('0x73')]=function(_0x15728a,_0x20eb25,_0x4078bc){var _0x2cc49f={'raw':![],'where':{}};var _0x3126fb={};var _0x538dee={'count':0x0,'rows':[]};return db['SmsAccount'][_0xcf70('0x6a')]({'where':{'id':_0x15728a[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x20eb25,null))[_0xcf70('0x21')](function(_0x539f15){if(_0x539f15){_0x3126fb[_0xcf70('0x49')]=_[_0xcf70('0x4a')](db[_0xcf70('0x72')]['rawAttributes']);_0x3126fb[_0xcf70('0x4b')]=_[_0xcf70('0x4a')](_0x15728a['query']);_0x3126fb['filters']=_['intersection'](_0x3126fb[_0xcf70('0x49')],_0x3126fb[_0xcf70('0x4b')]);_0x2cc49f['attributes']=_['intersection'](_0x3126fb['model'],qs['fields'](_0x15728a[_0xcf70('0x4b')]['fields']));_0x2cc49f['attributes']=_0x2cc49f[_0xcf70('0x4d')][_0xcf70('0x4f')]?_0x2cc49f['attributes']:_0x3126fb[_0xcf70('0x49')];if(!_0x15728a[_0xcf70('0x4b')][_0xcf70('0x50')](_0xcf70('0x74'))){_0x2cc49f[_0xcf70('0x32')]=qs[_0xcf70('0x32')](_0x15728a[_0xcf70('0x4b')][_0xcf70('0x32')]);_0x2cc49f[_0xcf70('0x2f')]=qs['offset'](_0x15728a[_0xcf70('0x4b')][_0xcf70('0x2f')]);}_0x2cc49f[_0xcf70('0x6b')]=qs[_0xcf70('0x51')](_0x15728a['query'][_0xcf70('0x51')]);_0x2cc49f[_0xcf70('0x52')]=qs[_0xcf70('0x4c')](_[_0xcf70('0x6c')](_0x15728a[_0xcf70('0x4b')],_0x3126fb[_0xcf70('0x4c')]));_0x2cc49f[_0xcf70('0x52')][_0xcf70('0x6d')]=_0x539f15['id'];if(_0x15728a[_0xcf70('0x4b')][_0xcf70('0x54')]){_0x2cc49f[_0xcf70('0x52')]=_[_0xcf70('0x55')](_0x2cc49f[_0xcf70('0x52')],{'$or':_[_0xcf70('0x43')](_0x2cc49f[_0xcf70('0x4d')],function(_0x38ec5f){var _0x482f61={};_0x482f61[_0x38ec5f]={'$like':'%'+_0x15728a['query'][_0xcf70('0x54')]+'%'};return _0x482f61;})});}_0x2cc49f=_['merge']({},_0x2cc49f,_0x15728a[_0xcf70('0x56')]);return db[_0xcf70('0x72')][_0xcf70('0x31')]({'where':_0x2cc49f['where']})[_0xcf70('0x21')](function(_0x2d5de5){_0x538dee['count']=_0x2d5de5;if(_0x15728a[_0xcf70('0x4b')]['includeAll']){_0x2cc49f[_0xcf70('0x58')]=[{'all':!![]}];}return db[_0xcf70('0x72')]['findAll'](_0x2cc49f);})[_0xcf70('0x21')](function(_0x5b11ae){_0x538dee[_0xcf70('0x59')]=_0x5b11ae;return _0x538dee;});}})[_0xcf70('0x21')](respondWithFilteredResult(_0x20eb25,_0x2cc49f))[_0xcf70('0x2b')](handleError(_0x20eb25,null));};exports[_0xcf70('0x75')]=function(_0x1c929c,_0x5a4d64,_0x2e338b){return db[_0xcf70('0x44')][_0xcf70('0x5d')]({'where':{'id':_0x1c929c['params']['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x5a4d64,null))[_0xcf70('0x21')](function(_0x4fa754){if(_0x4fa754){return _0x4fa754[_0xcf70('0x75')](_0x1c929c[_0xcf70('0x4b')]['ids']);}})['then'](respondWithStatusCode(_0x5a4d64,null))[_0xcf70('0x2b')](handleError(_0x5a4d64,null));};exports[_0xcf70('0x76')]=function(_0x168231,_0xb8cf2d,_0x4e3b5a){var _0x51ed46={'channel':_0xcf70('0x77')};var _0x18f2dc=[];var _0x6ad739=[];var _0x4c5362={};return db[_0xcf70('0x44')][_0xcf70('0x5d')]({'where':{'id':_0x168231['params']['id']},'include':[{'model':db[_0xcf70('0x78')],'as':_0xcf70('0x79')}]})[_0xcf70('0x21')](handleEntityNotFound(_0xb8cf2d,null))[_0xcf70('0x21')](function(_0x9b63b6){_0x51ed46['account']=_0x9b63b6;_0x51ed46[_0xcf70('0x7a')]=_[_0xcf70('0x7b')](_0x9b63b6[_0xcf70('0x79')],[_0xcf70('0x7c')],[_0xcf70('0x7d')]);if(_0x51ed46[_0xcf70('0x7e')][_0xcf70('0x79')]){delete _0x51ed46['account'][_0xcf70('0x79')];}return db[_0xcf70('0x7f')][_0xcf70('0x67')]();})[_0xcf70('0x21')](function(_0x54e6cc){if(!_0x54e6cc){throw new db['Sequelize'][(_0xcf70('0x80'))](_0xcf70('0x81'));}_0x18f2dc=_[_0xcf70('0x82')](_['keys'](_0x54e6cc),['createdAt','updatedAt']);_0x6ad739=_[_0xcf70('0x82')](_[_0xcf70('0x4a')](_0x54e6cc),[_0xcf70('0x83'),_0xcf70('0x84'),_0xcf70('0x85'),_0xcf70('0x86')]);_0x51ed46[_0xcf70('0x5f')]={'mapKey':_0xcf70('0x87')};if(_0x51ed46[_0xcf70('0x7e')]['type']){switch(_0x51ed46[_0xcf70('0x7e')]['type']){case'twilio':_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x88')]=_0x168231['body'][_0xcf70('0x89')];_0x51ed46[_0xcf70('0x5f')]['body']=_0x168231['body']['Body'];_0x51ed46['body'][_0xcf70('0x8a')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x8b')];break;case'skebby':_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x88')]='+'+_0x168231[_0xcf70('0x5f')][_0xcf70('0x8c')];_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x5f')]=_0x168231[_0xcf70('0x5f')]['text'];break;case'connectel':_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x88')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x88')];_0x51ed46[_0xcf70('0x5f')]['body']=_0x168231[_0xcf70('0x5f')][_0xcf70('0x29')];break;case'clicksend':_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x88')]=_0x168231[_0xcf70('0x5f')]['from'];_0x51ed46['body'][_0xcf70('0x5f')]=_0x168231['body']['body'];_0x51ed46[_0xcf70('0x5f')]['messageId']=_0x168231[_0xcf70('0x5f')]['message_id'];break;case _0xcf70('0x8d'):_0x51ed46[_0xcf70('0x5f')]['from']=_0x168231[_0xcf70('0x5f')]['From'];_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x5f')]=_0x168231['body'][_0xcf70('0x8e')];_0x51ed46['body'][_0xcf70('0x8a')]=_0x168231['body'][_0xcf70('0x8f')];break;case _0xcf70('0x90'):_0x51ed46['body'][_0xcf70('0x88')]='+'+_0x168231['body'][_0xcf70('0x91')][0x0][_0xcf70('0x88')];_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x5f')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x91')][0x0][_0xcf70('0x92')];_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x8a')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x91')][0x0]['messageId'];break;case'csc':_0x51ed46['body'][_0xcf70('0x88')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x93')];_0x51ed46['body'][_0xcf70('0x5f')]=_0x168231['body']['segmentedMessage'][_0xcf70('0x29')];break;case _0xcf70('0x94'):_0x51ed46['body']['from']=_0x168231[_0xcf70('0x5f')][_0xcf70('0x95')];_0x51ed46[_0xcf70('0x5f')]['body']=_0x168231[_0xcf70('0x5f')]['text'];_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x8a')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x96')];break;case _0xcf70('0x97'):_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x8a')]=_0x168231['body'][0x0][_0xcf70('0x29')]['id'];_0x51ed46['body'][_0xcf70('0x88')]=_0x168231[_0xcf70('0x5f')][0x0][_0xcf70('0x29')][_0xcf70('0x88')];_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x5f')]=_0x168231[_0xcf70('0x5f')][0x0]['message'][_0xcf70('0x92')];break;case _0xcf70('0x98'):_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x88')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x88')];_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x5f')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x29')];_0x51ed46['body']['messageId']=_0x168231[_0xcf70('0x5f')][_0xcf70('0x99')];break;}}if(_0x51ed46[_0xcf70('0x5f')]['id']){delete _0x51ed46[_0xcf70('0x5f')]['id'];}if(_[_0xcf70('0x9a')](_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x88')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x5f')])||_0x51ed46['body']['body']===''){throw new db[(_0xcf70('0x9b'))][(_0xcf70('0x80'))](_0xcf70('0x9c'));}if(_['isNil'](_0x51ed46['body'][_0xcf70('0x9d')])){throw new db['Sequelize'][(_0xcf70('0x80'))](_0xcf70('0x9e')+_0x6ad739);}if(!_[_0xcf70('0x9f')](_0x6ad739,_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x9d')])){throw new db[(_0xcf70('0x9b'))][(_0xcf70('0x80'))](_0xcf70('0xa0')+_0x6ad739);}_0x4c5362[_0x51ed46[_0xcf70('0x5f')]['mapKey']]=_0x51ed46[_0xcf70('0x5f')]['from'];return db[_0xcf70('0xa1')]['find']({'where':{'id':_0x51ed46[_0xcf70('0x7e')][_0xcf70('0x86')]},'include':[{'model':db['CmContact'],'as':_0xcf70('0xa2'),'where':_0x4c5362,'limit':0x1,'order':[[_0xcf70('0x84'),_0xcf70('0xa3')]]}]});})[_0xcf70('0x21')](handleEntityNotFound(_0xb8cf2d,null))[_0xcf70('0x21')](function(_0x22702a){if(_0x22702a){_0x51ed46[_0xcf70('0xa4')]=_['omit'](_0x22702a,['Contacts']);if(_0x22702a[_0xcf70('0xa2')][_0xcf70('0x4f')]){return _0x22702a['Contacts'][0x0];}var _0x4890f2=_[_0xcf70('0x19')](_0x51ed46['body'],{'firstName':_0x51ed46['body'][_0xcf70('0x88')],'ListId':_0x22702a['id']});_0x4890f2[_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x9d')]]=_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x88')];return db[_0xcf70('0x7f')][_0xcf70('0x5e')](_0x4890f2,{'fields':_0x18f2dc,'raw':!![]});}})[_0xcf70('0x21')](handleEntityNotFound(_0xb8cf2d,null))[_0xcf70('0x21')](function(_0x55d0bc){if(_0x55d0bc){_0x51ed46['contact']=_0x55d0bc;var _0x2619e5={'ContactId':_0x55d0bc['id'],'phone':_0x51ed46['body'][_0xcf70('0x88')],'SmsAccountId':_0x168231[_0xcf70('0x5b')]['id']};var _0x2b70f9={'ContactId':_0x55d0bc['id'],'SmsAccountId':_0x168231[_0xcf70('0x5b')]['id'],'closed':![]};return db['SmsInteraction'][_0xcf70('0x5d')]({'where':_0x2b70f9})[_0xcf70('0x21')](function(_0x54dea3){if(_0x54dea3){return[_0x54dea3,![]];}return db['SmsInteraction'][_0xcf70('0x5e')](_0x2619e5)[_0xcf70('0x21')](function(_0x4dd1a9){return[_0x4dd1a9,!![]];});});}})[_0xcf70('0xa5')](function(_0x158cf8,_0x1b00d5){_0x51ed46[_0xcf70('0xa6')]=_0x158cf8[_0xcf70('0x3b')]({'plain':!![]});_0x51ed46[_0xcf70('0xa6')][_0xcf70('0xa7')]=![];if(_0x1b00d5){if(_0x51ed46[_0xcf70('0x7e')][_0xcf70('0xa8')]){_0x51ed46[_0xcf70('0x7a')][_0xcf70('0xa9')]({'id':0x0,'priority':_0x51ed46[_0xcf70('0x7a')][_0xcf70('0x4f')]+0x1,'app':_0xcf70('0xaa'),'appdata':_0xcf70('0xab'),'interval':_0xcf70('0xac')});}_0x51ed46[_0xcf70('0xa6')][_0xcf70('0xa7')]=!![];}return db[_0xcf70('0xad')]['create']({'phone':_0x51ed46['body'][_0xcf70('0x88')],'messageId':_0x51ed46[_0xcf70('0x5f')]['messageId'],'body':_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x5f')],'SmsAccountId':_0x168231[_0xcf70('0x5b')]['id'],'SmsInteractionId':_0x158cf8['id'],'direction':'in','ContactId':_0x158cf8['ContactId'],'AttachmentId':_0x51ed46[_0xcf70('0x5f')][_0xcf70('0xae')]});})[_0xcf70('0x21')](function(_0x33290a){_0x51ed46['message']=_0x33290a;if(!_0x51ed46[_0xcf70('0xa6')]['UserId'])return;return db[_0xcf70('0xaf')][_0xcf70('0x5d')]({'attributes':['id',_0xcf70('0x3e')],'where':{'id':_0x51ed46[_0xcf70('0xa6')][_0xcf70('0xb0')]}});})['then'](function(_0x4e4843){if(_0x4e4843){_0x51ed46[_0xcf70('0x7a')][_0xcf70('0xb1')]({'id':0x0,'priority':0x0,'app':_0xcf70('0xb2'),'appdata':_0x4e4843[_0xcf70('0x3e')]+','+(_0x51ed46[_0xcf70('0x7e')][_0xcf70('0xb3')]||0xa),'interval':'*,*,*,*'});}if(!_0x51ed46[_0xcf70('0xa6')][_0xcf70('0xb4')])return;return db[_0xcf70('0xb5')][_0xcf70('0x5d')]({'attributes':['id',_0xcf70('0x3e')],'where':{'id':_0x51ed46[_0xcf70('0xa6')][_0xcf70('0xb4')]}});})['then'](function(_0x2d9aa0){if(_0x2d9aa0){_0x51ed46[_0xcf70('0x7a')][_0xcf70('0xb1')]({'id':0x0,'priority':0x1,'app':_0xcf70('0xb6'),'appdata':_0x2d9aa0[_0xcf70('0x3e')]+','+(_0x51ed46[_0xcf70('0x7e')][_0xcf70('0xb7')]||0x12c),'interval':_0xcf70('0xac')});}return respondWithRpcPromise(_0xcf70('0xb8'),_0xcf70('0xb9'),_0x51ed46);})[_0xcf70('0x21')](function(_0x2b61dd){if(_0x2b61dd){var _0x955e7b=0xc8;var _0x55862d=_0xcf70('0xba');logger['info'](_0xcf70('0x25'),_0x55862d,_0x955e7b,_0xcf70('0xbb'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x55862d,_0x955e7b,'entity\x20found',JSON['stringify'](_0x2b61dd));if(_0x51ed46['account'][_0xcf70('0x47')]===_0xcf70('0xbc')){return _0xb8cf2d[_0xcf70('0x2d')](_0x955e7b)[_0xcf70('0x33')](_0xcf70('0xbd'),_0xcf70('0xbe'))[_0xcf70('0x3f')]('\x0a');}else{return _0xb8cf2d[_0xcf70('0x2d')](_0x955e7b)[_0xcf70('0x35')](_0x2b61dd);}}})[_0xcf70('0x2b')](handleError(_0xb8cf2d,null));};exports[_0xcf70('0xbf')]=function(_0x3f1b8c,_0x138173){var _0x5b80c7=_0x3f1b8c[_0xcf70('0x5b')]['id'];var _0x1b5bbd=_0x3f1b8c[_0xcf70('0x5f')];var _0x2fe191=0xc8;var _0x49f804=null;return db[_0xcf70('0xc0')][_0xcf70('0xc1')]({'isolationLevel':db[_0xcf70('0xc0')][_0xcf70('0xc2')][_0xcf70('0xc3')][_0xcf70('0xc4')]},function(_0x2b450){return db[_0xcf70('0x44')][_0xcf70('0x6a')]({'where':{'id':_0x5b80c7},'transaction':_0x2b450})['then'](function(_0x484313){if(_0x484313){return db['SmsApplication'][_0xcf70('0x3a')]({'where':{'SmsAccountId':_0x5b80c7},'transaction':_0x2b450})[_0xcf70('0x21')](function(){var _0x1ef52b=_[_0xcf70('0x43')](_0x1b5bbd,function(_0x269ba5){_0x269ba5[_0xcf70('0x6d')]=_0x5b80c7;return _0x269ba5;});return db[_0xcf70('0x78')]['bulkCreate'](_0x1ef52b,{'transaction':_0x2b450});});}else{_0x2fe191=0x194;_0x49f804=[];}});})[_0xcf70('0x21')](function(){if(_0x2fe191!==0x194){return db[_0xcf70('0x78')][_0xcf70('0xc5')]({'where':{'SmsAccountId':_0x5b80c7},'order':_0xcf70('0x7c')})['then'](function(_0xeb2643){_0x49f804=_0xeb2643;});}})[_0xcf70('0x2b')](function(_0x18f96a){_0x2fe191=0x1f4;logger[_0xcf70('0x28')](_0x18f96a[_0xcf70('0x3d')]);if(_0x18f96a[_0xcf70('0x3e')]){delete _0x18f96a[_0xcf70('0x3e')];}_0x49f804=_0x18f96a;})[_0xcf70('0xc6')](function(){if(_0x49f804===null){_0x138173[_0xcf70('0x2c')](_0x2fe191);}else{if(_0x2fe191===0x1f4){_0x138173[_0xcf70('0x2d')](_0x2fe191)[_0xcf70('0x3f')](_0x49f804);}else{_0x138173[_0xcf70('0x2d')](_0x2fe191)[_0xcf70('0x35')](_0x49f804);}}});};exports[_0xcf70('0xc7')]=function(_0x168c69,_0x25a159,_0x46beb2){var _0x3e308e={};var _0x23d47d={};var _0x28f097;var _0x3d6f99;return db[_0xcf70('0x44')]['findOne']({'where':{'id':_0x168c69[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x25a159,null))[_0xcf70('0x21')](function(_0xcf179c){if(_0xcf179c){_0x28f097=_0xcf179c;_0x23d47d[_0xcf70('0x49')]=_[_0xcf70('0x4a')](db[_0xcf70('0x78')][_0xcf70('0x45')]);_0x23d47d[_0xcf70('0x4b')]=_[_0xcf70('0x4a')](_0x168c69[_0xcf70('0x4b')]);_0x23d47d[_0xcf70('0x4c')]=_[_0xcf70('0x4e')](_0x23d47d[_0xcf70('0x49')],_0x23d47d['query']);_0x3e308e['attributes']=_[_0xcf70('0x4e')](_0x23d47d['model'],qs[_0xcf70('0x5c')](_0x168c69[_0xcf70('0x4b')][_0xcf70('0x5c')]));_0x3e308e[_0xcf70('0x4d')]=_0x3e308e[_0xcf70('0x4d')][_0xcf70('0x4f')]?_0x3e308e[_0xcf70('0x4d')]:_0x23d47d[_0xcf70('0x49')];_0x3e308e[_0xcf70('0x6b')]=qs['sort'](_0x168c69['query']['sort']);_0x3e308e[_0xcf70('0x52')]=qs['filters'](_[_0xcf70('0x6c')](_0x168c69['query'],_0x23d47d['filters']));if(_0x168c69[_0xcf70('0x4b')][_0xcf70('0x54')]){_0x3e308e['where']=_[_0xcf70('0x55')](_0x3e308e[_0xcf70('0x52')],{'$or':_['map'](_0x3e308e[_0xcf70('0x4d')],function(_0x24d863){var _0x2f206e={};_0x2f206e[_0x24d863]={'$like':'%'+_0x168c69['query']['filter']+'%'};return _0x2f206e;})});}_0x3e308e=_[_0xcf70('0x55')]({},_0x3e308e,_0x168c69[_0xcf70('0x56')]);return _0x28f097[_0xcf70('0xc7')](_0x3e308e);}})['then'](function(_0x2d7818){if(_0x2d7818){_0x3d6f99=_0x2d7818['length'];if(!_0x168c69[_0xcf70('0x4b')]['hasOwnProperty'](_0xcf70('0x74'))){_0x3e308e[_0xcf70('0x32')]=qs['limit'](_0x168c69[_0xcf70('0x4b')][_0xcf70('0x32')]);_0x3e308e[_0xcf70('0x2f')]=qs[_0xcf70('0x2f')](_0x168c69['query'][_0xcf70('0x2f')]);}return _0x28f097[_0xcf70('0xc7')](_0x3e308e);}})[_0xcf70('0x21')](function(_0x170783){if(_0x170783){return _0x170783?{'count':_0x3d6f99,'rows':_0x170783}:null;}})[_0xcf70('0x21')](respondWithResult(_0x25a159,null))[_0xcf70('0x2b')](handleError(_0x25a159,null));};exports[_0xcf70('0xc8')]=function(_0x4dfd5f,_0x11af8b,_0x4469d0){var _0x54836b={'raw':![],'where':{}};var _0x44a7b8={};var _0x2acde8={'count':0x0,'rows':[]};return db[_0xcf70('0x44')]['findOne']({'where':{'id':_0x4dfd5f[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x11af8b,null))[_0xcf70('0x21')](function(_0x1ce329){if(_0x1ce329){_0x44a7b8[_0xcf70('0x49')]=_['keys'](db[_0xcf70('0xc9')][_0xcf70('0x45')]);_0x44a7b8[_0xcf70('0x4b')]=_[_0xcf70('0x4a')](_0x4dfd5f[_0xcf70('0x4b')]);_0x44a7b8['filters']=_[_0xcf70('0x4e')](_0x44a7b8[_0xcf70('0x49')],_0x44a7b8['query']);_0x54836b[_0xcf70('0x4d')]=_[_0xcf70('0x4e')](_0x44a7b8[_0xcf70('0x49')],qs[_0xcf70('0x5c')](_0x4dfd5f[_0xcf70('0x4b')]['fields']));_0x54836b[_0xcf70('0x4d')]=_0x54836b[_0xcf70('0x4d')][_0xcf70('0x4f')]?_0x54836b[_0xcf70('0x4d')]:_0x44a7b8[_0xcf70('0x49')];if(!_0x4dfd5f[_0xcf70('0x4b')][_0xcf70('0x50')](_0xcf70('0x74'))){_0x54836b[_0xcf70('0x32')]=qs[_0xcf70('0x32')](_0x4dfd5f[_0xcf70('0x4b')]['limit']);_0x54836b['offset']=qs[_0xcf70('0x2f')](_0x4dfd5f[_0xcf70('0x4b')]['offset']);}_0x54836b['order']=qs[_0xcf70('0x51')](_0x4dfd5f[_0xcf70('0x4b')][_0xcf70('0x51')]);_0x54836b['where']=qs['filters'](_[_0xcf70('0x6c')](_0x4dfd5f[_0xcf70('0x4b')],_0x44a7b8[_0xcf70('0x4c')]));_0x54836b[_0xcf70('0x52')]['SmsAccountId']=_0x1ce329['id'];if(_0x4dfd5f[_0xcf70('0x4b')][_0xcf70('0x54')]){_0x54836b[_0xcf70('0x52')]=_['merge'](_0x54836b[_0xcf70('0x52')],{'$or':_['map'](_0x54836b[_0xcf70('0x4d')],function(_0x1d7ca9){var _0x12a1c7={};_0x12a1c7[_0x1d7ca9]={'$like':'%'+_0x4dfd5f[_0xcf70('0x4b')][_0xcf70('0x54')]+'%'};return _0x12a1c7;})});}_0x54836b=_[_0xcf70('0x55')]({},_0x54836b,_0x4dfd5f['options']);return db['SmsInteraction'][_0xcf70('0x31')]({'where':_0x54836b[_0xcf70('0x52')]})[_0xcf70('0x21')](function(_0x21b7aa){_0x2acde8[_0xcf70('0x31')]=_0x21b7aa;if(_0x4dfd5f[_0xcf70('0x4b')][_0xcf70('0x57')]){_0x54836b['include']=[{'model':db['CmContact'],'as':_0xcf70('0xca'),'required':![]},{'model':db[_0xcf70('0xaf')],'as':_0xcf70('0xcb'),'attributes':[_0xcf70('0x3e'),_0xcf70('0xcc'),_0xcf70('0xcd')],'required':![]},{'model':db['Tag'],'as':_0xcf70('0xce'),'attributes':['id',_0xcf70('0x3e'),'color'],'where':_0x4dfd5f[_0xcf70('0x4b')][_0xcf70('0xcf')]?{'id':_0x4dfd5f[_0xcf70('0x4b')]['tag']}:undefined,'required':_0x4dfd5f[_0xcf70('0x4b')][_0xcf70('0xcf')]?!![]:![]}];}return db['SmsInteraction'][_0xcf70('0x6e')](_0x54836b);})[_0xcf70('0x21')](function(_0xeb52e5){_0x2acde8[_0xcf70('0x59')]=_0xeb52e5;return _0x2acde8;});}})[_0xcf70('0x21')](respondWithFilteredResult(_0x11af8b,_0x54836b))[_0xcf70('0x2b')](handleError(_0x11af8b,null));};exports['send']=function(_0x57c2d8,_0x11cd86,_0x39c967){var _0x181ef4,_0x5ee4b9,_0x2c9ed6;if(_[_0xcf70('0x9a')](_0x57c2d8[_0xcf70('0x5f')][_0xcf70('0x5f')])||_0x57c2d8[_0xcf70('0x5f')]['body']===''){throw new db[(_0xcf70('0x9b'))][(_0xcf70('0x80'))](_0xcf70('0x9c'));}if(_[_0xcf70('0x9a')](_0x57c2d8[_0xcf70('0x5f')]['to'])){throw new db[(_0xcf70('0x9b'))][(_0xcf70('0x80'))](_0xcf70('0xd0'));}_0x181ef4=_0x57c2d8['body']['to'];return db[_0xcf70('0x44')]['find']({'where':{'id':_0x57c2d8[_0xcf70('0x5b')]['id']},'include':[{'model':db[_0xcf70('0xa1')],'as':_0xcf70('0xd1'),'include':[{'model':db[_0xcf70('0x7f')],'as':_0xcf70('0xa2'),'where':{'mobile':_0x181ef4},'limit':0x1,'order':[[_0xcf70('0x84'),_0xcf70('0xa3')]]}]}]})[_0xcf70('0x21')](handleEntityNotFound(_0x11cd86,null))[_0xcf70('0x21')](function(_0x31b776){if(_0x31b776&&_0x31b776['List']){_0x5ee4b9=_0x31b776[_0xcf70('0x3b')]({'plain':!![]});if(_0x5ee4b9['List']&&_0x5ee4b9[_0xcf70('0xd1')]['Contacts']['length']){return _0x5ee4b9[_0xcf70('0xd1')]['Contacts'][0x0];}return db[_0xcf70('0x7f')]['create'](_[_0xcf70('0x19')](_0x57c2d8[_0xcf70('0x5f')],{'firstName':_0x181ef4,'mobile':_0x181ef4,'phone':_0x181ef4,'ListId':_0x5ee4b9[_0xcf70('0x86')]}));}})[_0xcf70('0x21')](handleEntityNotFound(_0x11cd86,null))[_0xcf70('0x21')](function(_0x594477){if(_0x594477){_0x2c9ed6=_0x594477;return db[_0xcf70('0xc9')][_0xcf70('0x5d')]({'where':{'ContactId':_0x2c9ed6['id'],'closed':![],'SmsAccountId':_0x5ee4b9['id']}})['then'](function(_0x158f77){if(_0x158f77){return[_0x158f77,![]];}return db['SmsInteraction'][_0xcf70('0x5e')]({'UserId':_0x57c2d8[_0xcf70('0x60')]['id'],'ContactId':_0x2c9ed6['id'],'SmsAccountId':_0x5ee4b9['id'],'phone':_0x181ef4,'firstMsgDirection':_0xcf70('0xd2'),'Messages':[_[_0xcf70('0x55')](_0x57c2d8['body'],{'read':![],'body':_0x57c2d8[_0xcf70('0x5f')]['body'],'phone':_0x181ef4,'SmsAccountId':_0x5ee4b9['id'],'UserId':_0x57c2d8[_0xcf70('0x60')]['id'],'ContactId':_0x2c9ed6['id']})]},{'include':[{'model':db[_0xcf70('0xad')],'as':_0xcf70('0xd3')}]})[_0xcf70('0x21')](function(_0x2af763){return[_0x2af763,!![]];});});}})[_0xcf70('0xa5')](function(_0x7b8947,_0x569b9a){if(_0x569b9a){return _0x7b8947;}return db[_0xcf70('0xad')][_0xcf70('0x5e')](_[_0xcf70('0x55')](_0x57c2d8['body'],{'read':![],'body':_0x57c2d8['body'][_0xcf70('0x5f')],'phone':_0x181ef4,'SmsAccountId':_0x5ee4b9['id'],'SmsInteractionId':_0x7b8947['id'],'UserId':_0x57c2d8[_0xcf70('0x60')]['id'],'ContactId':_0x2c9ed6['id']}))[_0xcf70('0x21')](function(_0xec3853){_0x7b8947[_0xcf70('0xd4')][_0xcf70('0xd3')]=[];_0x7b8947[_0xcf70('0xd4')][_0xcf70('0xd3')][_0xcf70('0xa9')](_0xec3853[_0xcf70('0xd4')]);return _0x7b8947;});})[_0xcf70('0x21')](respondWithResult(_0x11cd86,null))[_0xcf70('0x2b')](handleError(_0x11cd86,null));};exports['status']=function(_0x5eb69b,_0x172069,_0x4947df){if(_0x5eb69b['body']['id']){delete _0x5eb69b[_0xcf70('0x5f')]['id'];}var _0x45f945,_0x199059,_0x1d5866;return db[_0xcf70('0x44')][_0xcf70('0x5d')]({'where':{'id':_0x5eb69b[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x172069,null))[_0xcf70('0x21')](function(_0x3a9314){if(_0x3a9314){_0x1d5866=_0x3a9314;logger[_0xcf70('0x24')](_0xcf70('0x25'),_0xcf70('0x2d'),_0xcf70('0xd5'),_0x3a9314[_0xcf70('0x47')],util[_0xcf70('0xd6')](_0x5eb69b['body'],{'showHidden':![],'depth':null}));switch(_0x3a9314[_0xcf70('0x47')]){case _0xcf70('0xd7'):if(_0x5eb69b['body'][_0xcf70('0xd8')]&&_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x2d')]){_0x199059=_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x2d')];return db[_0xcf70('0xad')][_0xcf70('0x5d')]({'where':{'messageId':_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0xd8')]}});}break;case _0xcf70('0xd9'):if(_0x5eb69b['body']['requestid']&&_0x5eb69b['body']['statusInt']){_0x199059=_0x5eb69b[_0xcf70('0x5f')]['statusInt'];return db['SmsMessage'][_0xcf70('0x5d')]({'where':{'messageId':_0x5eb69b['body']['requestid']}});}break;case _0xcf70('0xda'):if(_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0xdb')]&&_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0xdc')]){_0x199059=_0x5eb69b[_0xcf70('0x5f')]['status_code'];return db[_0xcf70('0xad')][_0xcf70('0x5d')]({'where':{'messageId':_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0xdb')]}});}break;case _0xcf70('0x90'):var _0x4c1fba=_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x91')][0x0];if(_0x4c1fba['messageId']&&_0x4c1fba['status'][_0xcf70('0xdd')]===_0xcf70('0xde')){_0x199059=_0x4c1fba['status'][_0xcf70('0xdd')];return db[_0xcf70('0xad')][_0xcf70('0x5d')]({'where':{'messageId':_0x4c1fba[_0xcf70('0x8a')]}});}break;case'clickatell':if(_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x8a')]&&_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x2d')]){_0x199059=_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x2d')];return db['SmsMessage'][_0xcf70('0x5d')]({'where':{'messageId':_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x8a')]}});}break;case _0xcf70('0x97'):if(_0x5eb69b[_0xcf70('0x5f')][0x0][_0xcf70('0x29')]['id']){_0x199059=_0x5eb69b[_0xcf70('0x5f')][0x0][_0xcf70('0x47')];return db[_0xcf70('0xad')][_0xcf70('0x5d')]({'where':{'messageId':_0x5eb69b[_0xcf70('0x5f')][0x0][_0xcf70('0x29')]['id']}});}break;case'intelepeer':if(_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0xdf')]&&_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x2d')]){_0x199059=_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x2d')];return db[_0xcf70('0xad')][_0xcf70('0x5d')]({'where':{'messageId':_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0xdf')]}});}break;}}})['then'](handleEntityNotFound(_0x172069,null))[_0xcf70('0x21')](function(_0x497949){if(_0x497949){_0x45f945=_0x497949;switch(_0x1d5866[_0xcf70('0x47')]){case'skebby':if(_0x199059===_0xcf70('0xde')){return _0x45f945[_0xcf70('0x39')]({'read':!![]});}else{logger[_0xcf70('0x28')](_0xcf70('0x25'),_0xcf70('0x2d'),_0xcf70('0xd7'),util[_0xcf70('0xd6')](_0x5eb69b[_0xcf70('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xcf70('0xd9'):if(_0x199059==='1'){return _0x45f945[_0xcf70('0x39')]({'read':!![]});}else{logger['error'](_0xcf70('0x25'),_0xcf70('0x2d'),_0xcf70('0xd7'),util['inspect'](_0x5eb69b[_0xcf70('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xcf70('0xda'):if(!_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0xe0')]&&_0x199059>=0xc8&&_0x199059<=0xce){return _0x45f945[_0xcf70('0x39')]({'read':!![]});}else{logger[_0xcf70('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcf70('0x2d'),_0xcf70('0xda'),util[_0xcf70('0xd6')](_0x5eb69b[_0xcf70('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xcf70('0x90'):var _0x1101ae=_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x91')][0x0];if(_0x1101ae[_0xcf70('0x2d')][_0xcf70('0xdd')]===_0xcf70('0xde')){return _0x45f945[_0xcf70('0x39')]({'read':!![]});}else{logger[_0xcf70('0x28')](_0xcf70('0x25'),'status','infobip',util[_0xcf70('0xd6')](_0x5eb69b[_0xcf70('0x5f')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x199059==_0xcf70('0xe1')||_0x199059=='RECEIVED_BY_RECIPIENT'){return _0x45f945[_0xcf70('0x39')]({'read':!![]});}else{logger[_0xcf70('0x28')](_0xcf70('0x25'),_0xcf70('0x2d'),'clickatell',util[_0xcf70('0xd6')](_0x5eb69b[_0xcf70('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xcf70('0x97'):if(_0x199059==_0xcf70('0xe2')){return _0x45f945[_0xcf70('0x39')]({'read':!![]});}else{logger[_0xcf70('0x28')](_0xcf70('0x25'),'status',_0xcf70('0x97'),util['inspect'](_0x5eb69b[_0xcf70('0x5f')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x199059===_0xcf70('0xe3')||_0x199059==='ACCEPTD'){return _0x45f945['update']({'read':!![]});}else{logger[_0xcf70('0x28')](_0xcf70('0x25'),'status',_0xcf70('0x98'),util[_0xcf70('0xd6')](_0x5eb69b[_0xcf70('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x45f945;}})[_0xcf70('0x21')](respondWithResult(_0x172069,null))[_0xcf70('0x2b')](handleError(_0x172069,null));};exports[_0xcf70('0xe4')]=function(_0x3f3347,_0x35f03c,_0x59a23b){var _0x3cbe3a,_0x29b37a,_0x365121;return db['SmsAccount'][_0xcf70('0x5d')]({'where':{'id':_0x3f3347['params']['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x35f03c,null))[_0xcf70('0x21')](function(_0x4ef9b6){if(_0x4ef9b6){_0x365121=_0x4ef9b6;logger['debug'](_0xcf70('0x25'),_0xcf70('0x2d'),_0xcf70('0xd5'),_0x4ef9b6[_0xcf70('0x47')],util[_0xcf70('0xd6')](_0x3f3347[_0xcf70('0x4b')],{'showHidden':![],'depth':null}));switch(_0x4ef9b6[_0xcf70('0x47')]){case _0xcf70('0xe5'):if(_0x3f3347[_0xcf70('0x4b')]['message-id']&&_0x3f3347[_0xcf70('0x4b')][_0xcf70('0xe6')]){_0x29b37a=_0x3f3347[_0xcf70('0x4b')][_0xcf70('0xe6')];return db[_0xcf70('0xad')]['find']({'where':{'messageId':_0x3f3347[_0xcf70('0x4b')][_0xcf70('0xe7')]}});}break;}}})['then'](handleEntityNotFound(_0x35f03c,null))[_0xcf70('0x21')](function(_0x52f498){if(_0x52f498){_0x3cbe3a=_0x52f498;switch(_0x365121[_0xcf70('0x47')]){case _0xcf70('0xe5'):if(_0x29b37a==='2'||_0x29b37a==='6'){return _0x3cbe3a['update']({'read':!![]});}else{logger[_0xcf70('0x28')](_0xcf70('0x25'),_0xcf70('0x2d'),'csc',util['inspect'](_0x3f3347[_0xcf70('0x4b')],{'showHidden':![],'depth':null}));};break;}return _0x3cbe3a;}})[_0xcf70('0x21')](respondWithResult(_0x35f03c,null))[_0xcf70('0x2b')](handleError(_0x35f03c,null));};exports['addAgents']=function(_0x5ec167,_0x2bf9cb,_0x4b5fe4){return db[_0xcf70('0x44')]['find']({'where':{'id':_0x5ec167[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x2bf9cb,null))[_0xcf70('0x21')](function(_0x5793d3){if(_0x5793d3){return _0x5793d3[_0xcf70('0xe8')](_0x5ec167['body'][_0xcf70('0x70')],_['omit'](_0x5ec167[_0xcf70('0x5f')],['ids','id'])||{})[_0xcf70('0xa5')](function(_0x128765){for(var _0x394f35=0x0;_0x394f35<_0x5ec167['body']['ids']['length'];_0x394f35+=0x1){socket[_0xcf70('0xe9')](_0xcf70('0xea'),{'UserId':Number(_0x5ec167['body']['ids'][_0x394f35]),'SmsAccountId':Number(_0x5ec167[_0xcf70('0x5b')]['id'])});}return _0x128765;});}})[_0xcf70('0x21')](respondWithResult(_0x2bf9cb,null))[_0xcf70('0x2b')](handleError(_0x2bf9cb,null));};exports[_0xcf70('0xeb')]=function(_0x1fb470,_0x37c702,_0x5d18c8){return db['SmsAccount'][_0xcf70('0x5d')]({'where':{'id':_0x1fb470[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x37c702,null))[_0xcf70('0x21')](function(_0x9f6227){if(_0x9f6227){return _0x9f6227['removeAgents'](_0x1fb470[_0xcf70('0x4b')][_0xcf70('0x70')])[_0xcf70('0x21')](function(){if(_['isArray'](_0x1fb470[_0xcf70('0x4b')][_0xcf70('0x70')])){for(var _0x50188b=0x0;_0x50188b<_0x1fb470[_0xcf70('0x4b')][_0xcf70('0x70')]['length'];_0x50188b+=0x1){socket[_0xcf70('0xe9')](_0xcf70('0xec'),{'UserId':Number(_0x1fb470[_0xcf70('0x4b')]['ids'][_0x50188b]),'SmsAccountId':Number(_0x1fb470[_0xcf70('0x5b')]['id'])});}}else{socket[_0xcf70('0xe9')](_0xcf70('0xec'),{'UserId':Number(_0x1fb470[_0xcf70('0x4b')][_0xcf70('0x70')]),'SmsAccountId':Number(_0x1fb470['params']['id'])});}});}})['then'](respondWithStatusCode(_0x37c702,null))['catch'](handleError(_0x37c702,null));};exports[_0xcf70('0xed')]=function(_0x5adada,_0x2f15c3,_0xe18763){var _0x17777f={};var _0x545028={};var _0xcc60ef;var _0x293d09;return db[_0xcf70('0x44')]['findOne']({'where':{'id':_0x5adada[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x2f15c3,null))['then'](function(_0x3b11c8){if(_0x3b11c8){_0xcc60ef=_0x3b11c8;_0x545028[_0xcf70('0x49')]=_[_0xcf70('0x4a')](db[_0xcf70('0xaf')][_0xcf70('0x45')]);_0x545028[_0xcf70('0x4b')]=_['keys'](_0x5adada[_0xcf70('0x4b')]);_0x545028[_0xcf70('0x4c')]=_[_0xcf70('0x4e')](_0x545028[_0xcf70('0x49')],_0x545028[_0xcf70('0x4b')]);_0x17777f[_0xcf70('0x4d')]=_['intersection'](_0x545028[_0xcf70('0x49')],qs[_0xcf70('0x5c')](_0x5adada['query'][_0xcf70('0x5c')]));_0x17777f['attributes']=_0x17777f['attributes'][_0xcf70('0x4f')]?_0x17777f['attributes']:_0x545028[_0xcf70('0x49')];_0x17777f['order']=qs[_0xcf70('0x51')](_0x5adada[_0xcf70('0x4b')][_0xcf70('0x51')]);_0x17777f[_0xcf70('0x52')]=qs[_0xcf70('0x4c')](_[_0xcf70('0x6c')](_0x5adada[_0xcf70('0x4b')],_0x545028[_0xcf70('0x4c')]));if(_0x5adada[_0xcf70('0x4b')]['filter']){_0x17777f[_0xcf70('0x52')]=_['merge'](_0x17777f[_0xcf70('0x52')],{'$or':_[_0xcf70('0x43')](_0x17777f[_0xcf70('0x4d')],function(_0x734306){var _0xd796d9={};_0xd796d9[_0x734306]={'$like':'%'+_0x5adada[_0xcf70('0x4b')][_0xcf70('0x54')]+'%'};return _0xd796d9;})});}_0x17777f=_[_0xcf70('0x55')]({},_0x17777f,_0x5adada[_0xcf70('0x56')]);return _0xcc60ef[_0xcf70('0xed')](_0x17777f);}})[_0xcf70('0x21')](function(_0x4d2bc9){if(_0x4d2bc9){_0x293d09=_0x4d2bc9['length'];if(!_0x5adada[_0xcf70('0x4b')][_0xcf70('0x50')](_0xcf70('0x74'))){_0x17777f['limit']=qs[_0xcf70('0x32')](_0x5adada[_0xcf70('0x4b')][_0xcf70('0x32')]);_0x17777f['offset']=qs['offset'](_0x5adada['query'][_0xcf70('0x2f')]);}return _0xcc60ef['getAgents'](_0x17777f);}})[_0xcf70('0x21')](function(_0x4ec385){if(_0x4ec385){return _0x4ec385?{'count':_0x293d09,'rows':_0x4ec385}:null;}})[_0xcf70('0x21')](respondWithResult(_0x2f15c3,null))[_0xcf70('0x2b')](handleError(_0x2f15c3,null));}; \ No newline at end of file +var _0xe7bc=['List','DESC','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','DELIVERED','groupName','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','state','message-id','addAgents','spread','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','count','Content-Range','apply','reject','save','destroy','get','UserProfileResource','stack','name','send','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','params','Pause','mandatoryDispositionPause','keys','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','sort','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','SmsApplication','Applications','priority','account','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','messageId','MessageSid','skebby','from','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','Contacts','list','omit','CmContact','contact','SmsInteraction','interaction','autoclose','close','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','text/xml','addApplications','sequelize','transaction','Transaction','bulkCreate','finally','getApplications','getInteractions','Owner','internal','Tag','Tags','tag'];(function(_0x5b9a9f,_0x50d037){var _0x27205d=function(_0x3768e1){while(--_0x3768e1){_0x5b9a9f['push'](_0x5b9a9f['shift']());}};_0x27205d(++_0x50d037);}(_0xe7bc,0x108));var _0xce7b=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xe7bc[_0x5a3cf0];return _0x5a64ee;};'use strict';var emlformat=require(_0xce7b('0x0'));var rimraf=require(_0xce7b('0x1'));var zipdir=require(_0xce7b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce7b('0x3'));var moment=require('moment');var BPromise=require(_0xce7b('0x4'));var Mustache=require(_0xce7b('0x5'));var util=require(_0xce7b('0x6'));var path=require(_0xce7b('0x7'));var sox=require(_0xce7b('0x8'));var csv=require(_0xce7b('0x9'));var ejs=require(_0xce7b('0xa'));var fs=require('fs');var fs_extra=require(_0xce7b('0xb'));var _=require('lodash');var squel=require(_0xce7b('0xc'));var crypto=require(_0xce7b('0xd'));var jsforce=require(_0xce7b('0xe'));var deskjs=require(_0xce7b('0xf'));var toCsv=require(_0xce7b('0x9'));var querystring=require(_0xce7b('0x10'));var Papa=require(_0xce7b('0x11'));var Redis=require(_0xce7b('0x12'));var authService=require(_0xce7b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xce7b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xce7b('0x15'));var utils=require(_0xce7b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xce7b('0x17'));var db=require('../../mysqldb')['db'];config[_0xce7b('0x18')]=_[_0xce7b('0x19')](config[_0xce7b('0x18')],{'host':_0xce7b('0x1a'),'port':0x18eb});var socket=require(_0xce7b('0x1b'))(new Redis(config[_0xce7b('0x18')]));require(_0xce7b('0x1c'))[_0xce7b('0x1d')](socket);var jayson=require(_0xce7b('0x1e'));var client=jayson[_0xce7b('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x55081b,_0x163610,_0x36beff,_0x5b4d41){return new BPromise(function(_0x6d7847,_0x1ab79f){var _0x1d44c1=_0x5b4d41||client;return _0x1d44c1[_0xce7b('0x20')](_0x55081b,_0x36beff)[_0xce7b('0x21')](function(_0x218829){logger[_0xce7b('0x22')]('SmsAccount,\x20%s,\x20%s',_0x163610,_0xce7b('0x23'));logger[_0xce7b('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x163610,_0xce7b('0x23'),JSON[_0xce7b('0x25')](_0x218829));if(_0x218829[_0xce7b('0x26')]){if(_0x218829[_0xce7b('0x26')][_0xce7b('0x27')]===0x1f4){logger[_0xce7b('0x26')](_0xce7b('0x28'),_0x163610,_0x218829[_0xce7b('0x26')]['message']);return _0x1ab79f(_0x218829[_0xce7b('0x26')][_0xce7b('0x29')]);}logger[_0xce7b('0x26')](_0xce7b('0x28'),_0x163610,_0x218829['error'][_0xce7b('0x29')]);return _0x6d7847(_0x218829[_0xce7b('0x26')][_0xce7b('0x29')]);}else{logger[_0xce7b('0x22')](_0xce7b('0x28'),_0x163610,_0xce7b('0x23'));_0x6d7847(_0x218829[_0xce7b('0x2a')][_0xce7b('0x29')]);}})[_0xce7b('0x2b')](function(_0x4e1a02){logger[_0xce7b('0x26')](_0xce7b('0x28'),_0x163610,_0x4e1a02);_0x1ab79f(_0x4e1a02);});});}function respondWithStatusCode(_0x54ef5f,_0x37c56e){_0x37c56e=_0x37c56e||0xcc;return function(_0x4fd376){if(_0x4fd376){return _0x54ef5f[_0xce7b('0x2c')](_0x37c56e);}return _0x54ef5f[_0xce7b('0x2d')](_0x37c56e)[_0xce7b('0x2e')]();};}function respondWithResult(_0x2b4370,_0x5ccdf5){_0x5ccdf5=_0x5ccdf5||0xc8;return function(_0x56e543){if(_0x56e543){return _0x2b4370[_0xce7b('0x2d')](_0x5ccdf5)[_0xce7b('0x2f')](_0x56e543);}};}function respondWithFilteredResult(_0x53aff3,_0x364388){return function(_0x18016a){if(_0x18016a){var _0x590012=typeof _0x364388[_0xce7b('0x30')]==='undefined'&&typeof _0x364388['limit']==='undefined';var _0x16285a=_0x18016a[_0xce7b('0x31')];var _0xc5ba8b=_0x590012?0x0:_0x364388[_0xce7b('0x30')];var _0x1da404=_0x590012?_0x18016a[_0xce7b('0x31')]:_0x364388[_0xce7b('0x30')]+_0x364388['limit'];var _0x202d7f;if(_0x1da404>=_0x16285a){_0x1da404=_0x16285a;_0x202d7f=0xc8;}else{_0x202d7f=0xce;}_0x53aff3[_0xce7b('0x2d')](_0x202d7f);return _0x53aff3['set'](_0xce7b('0x32'),_0xc5ba8b+'-'+_0x1da404+'/'+_0x16285a)[_0xce7b('0x2f')](_0x18016a);}return null;};}function patchUpdates(_0x11021f){return function(_0x50aa98){try{jsonpatch[_0xce7b('0x33')](_0x50aa98,_0x11021f,!![]);}catch(_0x489379){return BPromise[_0xce7b('0x34')](_0x489379);}return _0x50aa98[_0xce7b('0x35')]();};}function saveUpdates(_0x4e8def,_0x1d1e44){return function(_0x5cb5ea){if(_0x5cb5ea){return _0x5cb5ea['update'](_0x4e8def)[_0xce7b('0x21')](function(_0x427d07){return _0x427d07;});}return null;};}function removeEntity(_0x3f9331,_0x2182ec){return function(_0x38b828){if(_0x38b828){return _0x38b828[_0xce7b('0x36')]()[_0xce7b('0x21')](function(){var _0x9781a8=_0x38b828[_0xce7b('0x37')]({'plain':!![]});var _0x7913e4='SmsAccounts';return db[_0xce7b('0x38')][_0xce7b('0x36')]({'where':{'type':_0x7913e4,'resourceId':_0x9781a8['id']}})[_0xce7b('0x21')](function(){return _0x38b828;});})['then'](function(){_0x3f9331[_0xce7b('0x2d')](0xcc)[_0xce7b('0x2e')]();});}};}function handleEntityNotFound(_0xb952bd,_0x38ae27){return function(_0x50c6c1){if(!_0x50c6c1){_0xb952bd[_0xce7b('0x2c')](0x194);}return _0x50c6c1;};}function handleError(_0x3976b3,_0x4678e5){_0x4678e5=_0x4678e5||0x1f4;return function(_0xe53ff8){logger[_0xce7b('0x26')](_0xe53ff8[_0xce7b('0x39')]);if(_0xe53ff8[_0xce7b('0x3a')]){delete _0xe53ff8[_0xce7b('0x3a')];}_0x3976b3['status'](_0x4678e5)[_0xce7b('0x3b')](_0xe53ff8);};}exports['index']=function(_0x537ed8,_0x16a2e7){var _0x3f9af3={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2c96a9={},_0x13fbcc={'count':0x0,'rows':[]};var _0x984af4=_[_0xce7b('0x3c')](db[_0xce7b('0x3d')][_0xce7b('0x3e')],function(_0x4469f8){return{'name':_0x4469f8[_0xce7b('0x3f')],'type':_0x4469f8[_0xce7b('0x40')][_0xce7b('0x41')]};});_0x2c96a9[_0xce7b('0x42')]=_['map'](_0x984af4,'name');_0x2c96a9[_0xce7b('0x43')]=_['keys'](_0x537ed8['query']);_0x2c96a9[_0xce7b('0x44')]=_[_0xce7b('0x45')](_0x2c96a9['model'],_0x2c96a9[_0xce7b('0x43')]);_0x3f9af3[_0xce7b('0x46')]=_[_0xce7b('0x45')](_0x2c96a9[_0xce7b('0x42')],qs[_0xce7b('0x47')](_0x537ed8[_0xce7b('0x43')][_0xce7b('0x47')]));_0x3f9af3[_0xce7b('0x46')]=_0x3f9af3[_0xce7b('0x46')]['length']?_0x3f9af3[_0xce7b('0x46')]:_0x2c96a9[_0xce7b('0x42')];if(!_0x537ed8[_0xce7b('0x43')][_0xce7b('0x48')](_0xce7b('0x49'))){_0x3f9af3[_0xce7b('0x4a')]=qs[_0xce7b('0x4a')](_0x537ed8[_0xce7b('0x43')]['limit']);_0x3f9af3[_0xce7b('0x30')]=qs[_0xce7b('0x30')](_0x537ed8[_0xce7b('0x43')][_0xce7b('0x30')]);}_0x3f9af3[_0xce7b('0x4b')]=qs['sort'](_0x537ed8['query']['sort']);_0x3f9af3[_0xce7b('0x4c')]=qs[_0xce7b('0x44')](_[_0xce7b('0x4d')](_0x537ed8[_0xce7b('0x43')],_0x2c96a9[_0xce7b('0x44')]),_0x984af4);if(_0x537ed8[_0xce7b('0x43')][_0xce7b('0x4e')]){_0x3f9af3[_0xce7b('0x4c')]=_[_0xce7b('0x4f')](_0x3f9af3[_0xce7b('0x4c')],{'$or':_[_0xce7b('0x3c')](_0x984af4,function(_0x52afbd){if(_0x52afbd[_0xce7b('0x40')]!==_0xce7b('0x50')){var _0x207ad9={};_0x207ad9[_0x52afbd[_0xce7b('0x3a')]]={'$like':'%'+_0x537ed8[_0xce7b('0x43')]['filter']+'%'};return _0x207ad9;}})});}_0x3f9af3=_[_0xce7b('0x4f')]({},_0x3f9af3,_0x537ed8['options']);var _0x157cd9={'where':_0x3f9af3['where']};return db[_0xce7b('0x3d')][_0xce7b('0x31')](_0x157cd9)[_0xce7b('0x21')](function(_0xbc28d1){_0x13fbcc['count']=_0xbc28d1;if(_0x537ed8['query'][_0xce7b('0x51')]){_0x3f9af3[_0xce7b('0x52')]=[{'all':!![]}];}return db[_0xce7b('0x3d')][_0xce7b('0x53')](_0x3f9af3);})[_0xce7b('0x21')](function(_0x178a35){_0x13fbcc['rows']=_0x178a35;return _0x13fbcc;})[_0xce7b('0x21')](respondWithFilteredResult(_0x16a2e7,_0x3f9af3))[_0xce7b('0x2b')](handleError(_0x16a2e7,null));};exports['show']=function(_0x346ffa,_0x148dfc){var _0x3b52ad={'raw':![],'where':{'id':_0x346ffa[_0xce7b('0x54')]['id']},'include':[{'model':db[_0xce7b('0x55')],'as':_0xce7b('0x56')}]},_0x51727a={};_0x51727a['model']=_[_0xce7b('0x57')](db[_0xce7b('0x3d')][_0xce7b('0x3e')]);_0x51727a[_0xce7b('0x43')]=_[_0xce7b('0x57')](_0x346ffa[_0xce7b('0x43')]);_0x51727a[_0xce7b('0x44')]=_[_0xce7b('0x45')](_0x51727a[_0xce7b('0x42')],_0x51727a[_0xce7b('0x43')]);_0x3b52ad['attributes']=_['intersection'](_0x51727a[_0xce7b('0x42')],qs['fields'](_0x346ffa[_0xce7b('0x43')][_0xce7b('0x47')]));_0x3b52ad[_0xce7b('0x46')]=_0x3b52ad[_0xce7b('0x46')][_0xce7b('0x58')]?_0x3b52ad[_0xce7b('0x46')]:_0x51727a[_0xce7b('0x42')];if(_0x346ffa['query'][_0xce7b('0x51')]){_0x3b52ad[_0xce7b('0x52')]=[{'all':!![]}];}_0x3b52ad=_[_0xce7b('0x4f')]({},_0x3b52ad,_0x346ffa[_0xce7b('0x59')]);return db[_0xce7b('0x3d')][_0xce7b('0x5a')](_0x3b52ad)[_0xce7b('0x21')](handleEntityNotFound(_0x148dfc,null))[_0xce7b('0x21')](respondWithResult(_0x148dfc,null))[_0xce7b('0x2b')](handleError(_0x148dfc,null));};exports[_0xce7b('0x5b')]=function(_0x42bce4,_0x56f72f){return db[_0xce7b('0x3d')]['create'](_0x42bce4[_0xce7b('0x5c')],{})[_0xce7b('0x21')](function(_0x405197){var _0x31e3b2=_0x42bce4[_0xce7b('0x5d')][_0xce7b('0x37')]({'plain':!![]});if(!_0x31e3b2)throw new Error(_0xce7b('0x5e'));if(_0x31e3b2[_0xce7b('0x5f')]===_0xce7b('0x5d')){var _0x5b2b8b=_0x405197[_0xce7b('0x37')]({'plain':!![]});var _0x4b2d44=_0xce7b('0x60');return db[_0xce7b('0x61')][_0xce7b('0x5a')]({'where':{'name':_0x4b2d44,'userProfileId':_0x31e3b2[_0xce7b('0x62')]},'raw':!![]})[_0xce7b('0x21')](function(_0x11cc34){if(_0x11cc34&&_0x11cc34[_0xce7b('0x63')]===0x0){return db['UserProfileResource'][_0xce7b('0x5b')]({'name':_0x5b2b8b[_0xce7b('0x3a')],'resourceId':_0x5b2b8b['id'],'type':_0x11cc34[_0xce7b('0x3a')],'sectionId':_0x11cc34['id']},{})[_0xce7b('0x21')](function(){return _0x405197;});}else{return _0x405197;}})['catch'](function(_0x533552){logger[_0xce7b('0x26')](_0xce7b('0x64'),_0x533552);throw _0x533552;});}return _0x405197;})[_0xce7b('0x21')](respondWithResult(_0x56f72f,0xc9))[_0xce7b('0x2b')](handleError(_0x56f72f,null));};exports[_0xce7b('0x65')]=function(_0x19504e,_0x4a73ba){if(_0x19504e[_0xce7b('0x5c')]['id']){delete _0x19504e[_0xce7b('0x5c')]['id'];}return db[_0xce7b('0x3d')]['find']({'where':{'id':_0x19504e[_0xce7b('0x54')]['id']},'include':[{'model':db[_0xce7b('0x55')],'as':_0xce7b('0x56')}]})[_0xce7b('0x21')](handleEntityNotFound(_0x4a73ba,null))['then'](saveUpdates(_0x19504e[_0xce7b('0x5c')],null))[_0xce7b('0x21')](respondWithResult(_0x4a73ba,null))[_0xce7b('0x2b')](handleError(_0x4a73ba,null));};exports['destroy']=function(_0x164acb,_0x281344){return db[_0xce7b('0x3d')]['find']({'where':{'id':_0x164acb[_0xce7b('0x54')]['id']}})['then'](handleEntityNotFound(_0x281344,null))['then'](removeEntity(_0x281344,null))[_0xce7b('0x2b')](handleError(_0x281344,null));};exports[_0xce7b('0x66')]=function(_0x3dd69f,_0x1f1fb2){return db['SmsAccount']['describe']()[_0xce7b('0x21')](respondWithResult(_0x1f1fb2,null))[_0xce7b('0x2b')](handleError(_0x1f1fb2,null));};exports[_0xce7b('0x67')]=function(_0x206e72,_0x298b18,_0x289c63){if(_0x206e72[_0xce7b('0x5c')]['id']){delete _0x206e72[_0xce7b('0x5c')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x206e72[_0xce7b('0x54')]['id']}})['then'](handleEntityNotFound(_0x298b18,null))[_0xce7b('0x21')](function(_0x50a379){if(_0x50a379){_0x206e72[_0xce7b('0x5c')][_0xce7b('0x68')]=_0x50a379['id'];return db[_0xce7b('0x69')]['create'](_0x206e72['body']);}})[_0xce7b('0x21')](respondWithResult(_0x298b18,null))[_0xce7b('0x2b')](handleError(_0x298b18,null));};exports[_0xce7b('0x6a')]=function(_0x33f8a7,_0x2f1da4,_0x331d9a){var _0x213648={'raw':![],'where':{}};var _0x2d8e6c={};var _0x288094={'count':0x0,'rows':[]};return db[_0xce7b('0x3d')][_0xce7b('0x6b')]({'where':{'id':_0x33f8a7['params']['id']}})[_0xce7b('0x21')](handleEntityNotFound(_0x2f1da4,null))[_0xce7b('0x21')](function(_0x37a894){if(_0x37a894){_0x2d8e6c[_0xce7b('0x42')]=_[_0xce7b('0x57')](db[_0xce7b('0x69')][_0xce7b('0x3e')]);_0x2d8e6c['query']=_[_0xce7b('0x57')](_0x33f8a7[_0xce7b('0x43')]);_0x2d8e6c['filters']=_[_0xce7b('0x45')](_0x2d8e6c[_0xce7b('0x42')],_0x2d8e6c[_0xce7b('0x43')]);_0x213648[_0xce7b('0x46')]=_[_0xce7b('0x45')](_0x2d8e6c['model'],qs[_0xce7b('0x47')](_0x33f8a7[_0xce7b('0x43')]['fields']));_0x213648[_0xce7b('0x46')]=_0x213648[_0xce7b('0x46')][_0xce7b('0x58')]?_0x213648[_0xce7b('0x46')]:_0x2d8e6c[_0xce7b('0x42')];if(!_0x33f8a7[_0xce7b('0x43')]['hasOwnProperty'](_0xce7b('0x49'))){_0x213648['limit']=qs[_0xce7b('0x4a')](_0x33f8a7['query'][_0xce7b('0x4a')]);_0x213648[_0xce7b('0x30')]=qs[_0xce7b('0x30')](_0x33f8a7['query'][_0xce7b('0x30')]);}_0x213648['order']=qs[_0xce7b('0x6c')](_0x33f8a7[_0xce7b('0x43')][_0xce7b('0x6c')]);_0x213648[_0xce7b('0x4c')]=qs['filters'](_[_0xce7b('0x4d')](_0x33f8a7[_0xce7b('0x43')],_0x2d8e6c['filters']));_0x213648[_0xce7b('0x4c')]['SmsAccountId']=_0x37a894['id'];if(_0x33f8a7[_0xce7b('0x43')][_0xce7b('0x4e')]){_0x213648[_0xce7b('0x4c')]=_[_0xce7b('0x4f')](_0x213648[_0xce7b('0x4c')],{'$or':_[_0xce7b('0x3c')](_0x213648[_0xce7b('0x46')],function(_0x170361){var _0x2b4f1c={};_0x2b4f1c[_0x170361]={'$like':'%'+_0x33f8a7[_0xce7b('0x43')][_0xce7b('0x4e')]+'%'};return _0x2b4f1c;})});}_0x213648=_['merge']({},_0x213648,_0x33f8a7[_0xce7b('0x59')]);return db['Disposition'][_0xce7b('0x31')]({'where':_0x213648[_0xce7b('0x4c')]})[_0xce7b('0x21')](function(_0x2b7d9c){_0x288094['count']=_0x2b7d9c;if(_0x33f8a7['query'][_0xce7b('0x51')]){_0x213648[_0xce7b('0x52')]=[{'all':!![]}];}return db[_0xce7b('0x69')][_0xce7b('0x53')](_0x213648);})[_0xce7b('0x21')](function(_0x3dfa99){_0x288094[_0xce7b('0x6d')]=_0x3dfa99;return _0x288094;});}})['then'](respondWithFilteredResult(_0x2f1da4,_0x213648))[_0xce7b('0x2b')](handleError(_0x2f1da4,null));};exports[_0xce7b('0x6e')]=function(_0x2779f0,_0x194295,_0x5db4af){return db['SmsAccount'][_0xce7b('0x5a')]({'where':{'id':_0x2779f0[_0xce7b('0x54')]['id']}})[_0xce7b('0x21')](handleEntityNotFound(_0x194295,null))[_0xce7b('0x21')](function(_0x65908){if(_0x65908){return _0x65908['removeDispositions'](_0x2779f0[_0xce7b('0x43')][_0xce7b('0x6f')]);}})['then'](respondWithStatusCode(_0x194295,null))[_0xce7b('0x2b')](handleError(_0x194295,null));};exports[_0xce7b('0x70')]=function(_0x30e569,_0x12b39e,_0x8aef31){if(_0x30e569[_0xce7b('0x5c')]['id']){delete _0x30e569['body']['id'];}return db['SmsAccount'][_0xce7b('0x5a')]({'where':{'id':_0x30e569[_0xce7b('0x54')]['id']}})[_0xce7b('0x21')](handleEntityNotFound(_0x12b39e,null))[_0xce7b('0x21')](function(_0x485d7a){if(_0x485d7a){_0x30e569['body'][_0xce7b('0x68')]=_0x485d7a['id'];return db['CannedAnswer'][_0xce7b('0x5b')](_0x30e569['body']);}})[_0xce7b('0x21')](respondWithResult(_0x12b39e,null))['catch'](handleError(_0x12b39e,null));};exports[_0xce7b('0x71')]=function(_0x20e71f,_0x38d85a,_0x1cc748){var _0x3bfccc={'raw':![],'where':{}};var _0x26ff7e={};var _0x5d5c77={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x20e71f[_0xce7b('0x54')]['id']}})[_0xce7b('0x21')](handleEntityNotFound(_0x38d85a,null))[_0xce7b('0x21')](function(_0x32b6b9){if(_0x32b6b9){_0x26ff7e[_0xce7b('0x42')]=_[_0xce7b('0x57')](db[_0xce7b('0x72')]['rawAttributes']);_0x26ff7e['query']=_[_0xce7b('0x57')](_0x20e71f[_0xce7b('0x43')]);_0x26ff7e[_0xce7b('0x44')]=_[_0xce7b('0x45')](_0x26ff7e['model'],_0x26ff7e['query']);_0x3bfccc['attributes']=_[_0xce7b('0x45')](_0x26ff7e[_0xce7b('0x42')],qs[_0xce7b('0x47')](_0x20e71f[_0xce7b('0x43')][_0xce7b('0x47')]));_0x3bfccc[_0xce7b('0x46')]=_0x3bfccc[_0xce7b('0x46')]['length']?_0x3bfccc[_0xce7b('0x46')]:_0x26ff7e[_0xce7b('0x42')];if(!_0x20e71f['query']['hasOwnProperty'](_0xce7b('0x49'))){_0x3bfccc[_0xce7b('0x4a')]=qs[_0xce7b('0x4a')](_0x20e71f[_0xce7b('0x43')][_0xce7b('0x4a')]);_0x3bfccc[_0xce7b('0x30')]=qs[_0xce7b('0x30')](_0x20e71f[_0xce7b('0x43')]['offset']);}_0x3bfccc['order']=qs['sort'](_0x20e71f[_0xce7b('0x43')]['sort']);_0x3bfccc[_0xce7b('0x4c')]=qs[_0xce7b('0x44')](_[_0xce7b('0x4d')](_0x20e71f[_0xce7b('0x43')],_0x26ff7e[_0xce7b('0x44')]));_0x3bfccc['where']['SmsAccountId']=_0x32b6b9['id'];if(_0x20e71f[_0xce7b('0x43')][_0xce7b('0x4e')]){_0x3bfccc[_0xce7b('0x4c')]=_[_0xce7b('0x4f')](_0x3bfccc[_0xce7b('0x4c')],{'$or':_[_0xce7b('0x3c')](_0x3bfccc[_0xce7b('0x46')],function(_0x4bbb38){var _0x46d915={};_0x46d915[_0x4bbb38]={'$like':'%'+_0x20e71f['query']['filter']+'%'};return _0x46d915;})});}_0x3bfccc=_[_0xce7b('0x4f')]({},_0x3bfccc,_0x20e71f[_0xce7b('0x59')]);return db[_0xce7b('0x72')][_0xce7b('0x31')]({'where':_0x3bfccc['where']})[_0xce7b('0x21')](function(_0x4f0cec){_0x5d5c77[_0xce7b('0x31')]=_0x4f0cec;if(_0x20e71f[_0xce7b('0x43')][_0xce7b('0x51')]){_0x3bfccc[_0xce7b('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0xce7b('0x53')](_0x3bfccc);})['then'](function(_0x26c2b8){_0x5d5c77[_0xce7b('0x6d')]=_0x26c2b8;return _0x5d5c77;});}})[_0xce7b('0x21')](respondWithFilteredResult(_0x38d85a,_0x3bfccc))[_0xce7b('0x2b')](handleError(_0x38d85a,null));};exports[_0xce7b('0x73')]=function(_0xf5bbeb,_0x250c6d,_0x2c7577){return db[_0xce7b('0x3d')][_0xce7b('0x5a')]({'where':{'id':_0xf5bbeb['params']['id']}})['then'](handleEntityNotFound(_0x250c6d,null))[_0xce7b('0x21')](function(_0x1c4002){if(_0x1c4002){return _0x1c4002[_0xce7b('0x73')](_0xf5bbeb[_0xce7b('0x43')][_0xce7b('0x6f')]);}})[_0xce7b('0x21')](respondWithStatusCode(_0x250c6d,null))[_0xce7b('0x2b')](handleError(_0x250c6d,null));};exports[_0xce7b('0x74')]=function(_0x5395f1,_0x2d4483,_0x2ab5d1){var _0x1d1f05={'channel':'sms'};var _0x25f666=[];var _0x1cffde=[];var _0x364bf9={};return db[_0xce7b('0x3d')][_0xce7b('0x5a')]({'where':{'id':_0x5395f1[_0xce7b('0x54')]['id']},'include':[{'model':db[_0xce7b('0x75')],'as':'Applications'}]})[_0xce7b('0x21')](handleEntityNotFound(_0x2d4483,null))[_0xce7b('0x21')](function(_0x35b3b1){_0x1d1f05['account']=_0x35b3b1;_0x1d1f05['applications']=_['orderBy'](_0x35b3b1[_0xce7b('0x76')],[_0xce7b('0x77')],['asc']);if(_0x1d1f05['account'][_0xce7b('0x76')]){delete _0x1d1f05[_0xce7b('0x78')][_0xce7b('0x76')];}return db['CmContact'][_0xce7b('0x66')]();})[_0xce7b('0x21')](function(_0x4b655a){if(!_0x4b655a){throw new db['Sequelize']['ValidationError'](_0xce7b('0x79'));}_0x25f666=_[_0xce7b('0x7a')](_['keys'](_0x4b655a),[_0xce7b('0x7b'),_0xce7b('0x7c')]);_0x1cffde=_[_0xce7b('0x7a')](_['keys'](_0x4b655a),['createdAt',_0xce7b('0x7c'),_0xce7b('0x7d'),_0xce7b('0x7e')]);_0x1d1f05['body']={'mapKey':_0xce7b('0x7f')};if(_0x1d1f05[_0xce7b('0x78')][_0xce7b('0x40')]){switch(_0x1d1f05[_0xce7b('0x78')]['type']){case _0xce7b('0x80'):_0x1d1f05[_0xce7b('0x5c')]['from']=_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x81')];_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x5c')]=_0x5395f1['body']['Body'];_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x82')]=_0x5395f1['body'][_0xce7b('0x83')];break;case _0xce7b('0x84'):_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x85')]='+'+_0x5395f1[_0xce7b('0x5c')]['sender'];_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x5c')]=_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x86')];break;case _0xce7b('0x87'):_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x85')]=_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x85')];_0x1d1f05['body'][_0xce7b('0x5c')]=_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x29')];break;case _0xce7b('0x88'):_0x1d1f05[_0xce7b('0x5c')]['from']=_0x5395f1[_0xce7b('0x5c')]['from'];_0x1d1f05['body'][_0xce7b('0x5c')]=_0x5395f1[_0xce7b('0x5c')]['body'];_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x82')]=_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x89')];break;case _0xce7b('0x8a'):_0x1d1f05[_0xce7b('0x5c')]['from']=_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x81')];_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x5c')]=_0x5395f1['body'][_0xce7b('0x8b')];_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x82')]=_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x8c')];break;case _0xce7b('0x8d'):_0x1d1f05['body'][_0xce7b('0x85')]='+'+_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x8e')][0x0]['from'];_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x5c')]=_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x8e')][0x0][_0xce7b('0x86')];_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x82')]=_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x8e')][0x0]['messageId'];break;case _0xce7b('0x8f'):_0x1d1f05['body'][_0xce7b('0x85')]=_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x90')];_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x5c')]=_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x91')]['message'];break;case _0xce7b('0x92'):_0x1d1f05['body'][_0xce7b('0x85')]=_0x5395f1['body'][_0xce7b('0x93')];_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x5c')]=_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x86')];_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x82')]=_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x94')];break;case _0xce7b('0x95'):_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x82')]=_0x5395f1['body'][0x0][_0xce7b('0x29')]['id'];_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x85')]=_0x5395f1[_0xce7b('0x5c')][0x0][_0xce7b('0x29')]['from'];_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x5c')]=_0x5395f1['body'][0x0][_0xce7b('0x29')][_0xce7b('0x86')];break;case _0xce7b('0x96'):_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x85')]=_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x85')];_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x5c')]=_0x5395f1[_0xce7b('0x5c')][_0xce7b('0x29')];_0x1d1f05['body'][_0xce7b('0x82')]=_0x5395f1['body'][_0xce7b('0x97')];break;}}if(_0x1d1f05[_0xce7b('0x5c')]['id']){delete _0x1d1f05['body']['id'];}if(_[_0xce7b('0x98')](_0x1d1f05['body'][_0xce7b('0x85')])){throw new db['Sequelize']['ValidationError'](_0xce7b('0x99'));}if(_['isNil'](_0x1d1f05['body'][_0xce7b('0x5c')])||_0x1d1f05[_0xce7b('0x5c')]['body']===''){throw new db[(_0xce7b('0x9a'))][(_0xce7b('0x9b'))](_0xce7b('0x9c'));}if(_[_0xce7b('0x98')](_0x1d1f05[_0xce7b('0x5c')]['mapKey'])){throw new db[(_0xce7b('0x9a'))]['ValidationError'](_0xce7b('0x9d')+_0x1cffde);}if(!_[_0xce7b('0x9e')](_0x1cffde,_0x1d1f05['body'][_0xce7b('0x9f')])){throw new db[(_0xce7b('0x9a'))][(_0xce7b('0x9b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1cffde);}_0x364bf9[_0x1d1f05[_0xce7b('0x5c')]['mapKey']]=_0x1d1f05['body']['from'];return db[_0xce7b('0xa0')][_0xce7b('0x5a')]({'where':{'id':_0x1d1f05[_0xce7b('0x78')][_0xce7b('0x7e')]},'include':[{'model':db['CmContact'],'as':_0xce7b('0xa1'),'where':_0x364bf9,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0xce7b('0x21')](handleEntityNotFound(_0x2d4483,null))['then'](function(_0xda6cb){if(_0xda6cb){_0x1d1f05[_0xce7b('0xa2')]=_[_0xce7b('0xa3')](_0xda6cb,[_0xce7b('0xa1')]);if(_0xda6cb[_0xce7b('0xa1')][_0xce7b('0x58')]){return _0xda6cb[_0xce7b('0xa1')][0x0];}var _0x1904df=_[_0xce7b('0x19')](_0x1d1f05[_0xce7b('0x5c')],{'firstName':_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x85')],'ListId':_0xda6cb['id']});_0x1904df[_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x9f')]]=_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x85')];return db[_0xce7b('0xa4')][_0xce7b('0x5b')](_0x1904df,{'fields':_0x25f666,'raw':!![]});}})[_0xce7b('0x21')](handleEntityNotFound(_0x2d4483,null))[_0xce7b('0x21')](function(_0x249948){if(_0x249948){_0x1d1f05[_0xce7b('0xa5')]=_0x249948;var _0x137376={'ContactId':_0x249948['id'],'phone':_0x1d1f05['body'][_0xce7b('0x85')],'SmsAccountId':_0x5395f1[_0xce7b('0x54')]['id']};var _0x3a50a7={'ContactId':_0x249948['id'],'SmsAccountId':_0x5395f1[_0xce7b('0x54')]['id'],'closed':![]};return db['SmsInteraction'][_0xce7b('0x5a')]({'where':_0x3a50a7})['then'](function(_0xe18f3b){if(_0xe18f3b){return[_0xe18f3b,![]];}return db[_0xce7b('0xa6')][_0xce7b('0x5b')](_0x137376)['then'](function(_0x5d365e){return[_0x5d365e,!![]];});});}})['spread'](function(_0x50a7b2,_0xca7742){_0x1d1f05['interaction']=_0x50a7b2[_0xce7b('0x37')]({'plain':!![]});_0x1d1f05[_0xce7b('0xa7')]['created']=![];if(_0xca7742){if(_0x1d1f05[_0xce7b('0x78')][_0xce7b('0xa8')]){_0x1d1f05['applications']['push']({'id':0x0,'priority':_0x1d1f05['applications'][_0xce7b('0x58')]+0x1,'app':_0xce7b('0xa9'),'appdata':'unmanaged','interval':_0xce7b('0xaa')});}_0x1d1f05[_0xce7b('0xa7')][_0xce7b('0xab')]=!![];}return db[_0xce7b('0xac')]['create']({'phone':_0x1d1f05['body'][_0xce7b('0x85')],'messageId':_0x1d1f05['body'][_0xce7b('0x82')],'body':_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0x5c')],'SmsAccountId':_0x5395f1[_0xce7b('0x54')]['id'],'SmsInteractionId':_0x50a7b2['id'],'direction':'in','ContactId':_0x50a7b2[_0xce7b('0xad')],'AttachmentId':_0x1d1f05[_0xce7b('0x5c')][_0xce7b('0xae')]});})['then'](function(_0x37f8eb){_0x1d1f05[_0xce7b('0x29')]=_0x37f8eb;if(!_0x1d1f05[_0xce7b('0xa7')][_0xce7b('0xaf')])return;return db[_0xce7b('0xb0')][_0xce7b('0x5a')]({'attributes':['id','name'],'where':{'id':_0x1d1f05[_0xce7b('0xa7')]['UserId']}});})[_0xce7b('0x21')](function(_0x273cdd){if(_0x273cdd){_0x1d1f05['applications'][_0xce7b('0xb1')]({'id':0x0,'priority':0x0,'app':_0xce7b('0xb2'),'appdata':_0x273cdd[_0xce7b('0x3a')]+','+(_0x1d1f05[_0xce7b('0x78')][_0xce7b('0xb3')]||0xa),'interval':_0xce7b('0xaa')});}if(!_0x1d1f05[_0xce7b('0xa7')][_0xce7b('0xb4')])return;return db[_0xce7b('0xb5')][_0xce7b('0x5a')]({'attributes':['id',_0xce7b('0x3a')],'where':{'id':_0x1d1f05[_0xce7b('0xa7')]['queueId']}});})[_0xce7b('0x21')](function(_0x291d59){if(_0x291d59){_0x1d1f05['applications'][_0xce7b('0xb1')]({'id':0x0,'priority':0x1,'app':_0xce7b('0xb6'),'appdata':_0x291d59[_0xce7b('0x3a')]+','+(_0x1d1f05[_0xce7b('0x78')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xce7b('0xb7'),_0xce7b('0xb8'),_0x1d1f05);})[_0xce7b('0x21')](function(_0xd4fbac){if(_0xd4fbac){var _0x5f5ab3=0xc8;var _0xa82e1=_0xce7b('0xb9');logger[_0xce7b('0x22')](_0xce7b('0xba'),_0xa82e1,_0x5f5ab3,_0xce7b('0xbb'));logger[_0xce7b('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xa82e1,_0x5f5ab3,_0xce7b('0xbb'),JSON['stringify'](_0xd4fbac));if(_0x1d1f05['account'][_0xce7b('0x40')]==='twilio'){return _0x2d4483[_0xce7b('0x2d')](_0x5f5ab3)['set']('Content-Type',_0xce7b('0xbc'))[_0xce7b('0x3b')]('\x0a');}else{return _0x2d4483[_0xce7b('0x2d')](_0x5f5ab3)[_0xce7b('0x2f')](_0xd4fbac);}}})[_0xce7b('0x2b')](handleError(_0x2d4483,null));};exports[_0xce7b('0xbd')]=function(_0x217261,_0x32c2ff){var _0x5cd759=_0x217261['params']['id'];var _0x14927b=_0x217261['body'];var _0x38eaf9=0xc8;var _0x5a7f01=null;return db[_0xce7b('0xbe')][_0xce7b('0xbf')]({'isolationLevel':db[_0xce7b('0xbe')][_0xce7b('0xc0')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4064aa){return db[_0xce7b('0x3d')][_0xce7b('0x6b')]({'where':{'id':_0x5cd759},'transaction':_0x4064aa})[_0xce7b('0x21')](function(_0x436bbf){if(_0x436bbf){return db['SmsApplication'][_0xce7b('0x36')]({'where':{'SmsAccountId':_0x5cd759},'transaction':_0x4064aa})[_0xce7b('0x21')](function(){var _0x297476=_['map'](_0x14927b,function(_0x42ceb4){_0x42ceb4[_0xce7b('0x68')]=_0x5cd759;return _0x42ceb4;});return db[_0xce7b('0x75')][_0xce7b('0xc1')](_0x297476,{'transaction':_0x4064aa});});}else{_0x38eaf9=0x194;_0x5a7f01=[];}});})[_0xce7b('0x21')](function(){if(_0x38eaf9!==0x194){return db[_0xce7b('0x75')]['findAndCountAll']({'where':{'SmsAccountId':_0x5cd759},'order':_0xce7b('0x77')})[_0xce7b('0x21')](function(_0x28ff82){_0x5a7f01=_0x28ff82;});}})[_0xce7b('0x2b')](function(_0x460d45){_0x38eaf9=0x1f4;logger[_0xce7b('0x26')](_0x460d45[_0xce7b('0x39')]);if(_0x460d45[_0xce7b('0x3a')]){delete _0x460d45['name'];}_0x5a7f01=_0x460d45;})[_0xce7b('0xc2')](function(){if(_0x5a7f01===null){_0x32c2ff['sendStatus'](_0x38eaf9);}else{if(_0x38eaf9===0x1f4){_0x32c2ff['status'](_0x38eaf9)[_0xce7b('0x3b')](_0x5a7f01);}else{_0x32c2ff[_0xce7b('0x2d')](_0x38eaf9)['json'](_0x5a7f01);}}});};exports[_0xce7b('0xc3')]=function(_0x3edd03,_0x4c6c28,_0x36cfe0){var _0x98a108={};var _0x44d941={};var _0xbf6ae;var _0x5d6194;return db[_0xce7b('0x3d')]['findOne']({'where':{'id':_0x3edd03[_0xce7b('0x54')]['id']}})[_0xce7b('0x21')](handleEntityNotFound(_0x4c6c28,null))[_0xce7b('0x21')](function(_0x133734){if(_0x133734){_0xbf6ae=_0x133734;_0x44d941[_0xce7b('0x42')]=_[_0xce7b('0x57')](db[_0xce7b('0x75')]['rawAttributes']);_0x44d941['query']=_[_0xce7b('0x57')](_0x3edd03['query']);_0x44d941[_0xce7b('0x44')]=_[_0xce7b('0x45')](_0x44d941[_0xce7b('0x42')],_0x44d941['query']);_0x98a108['attributes']=_[_0xce7b('0x45')](_0x44d941['model'],qs[_0xce7b('0x47')](_0x3edd03['query'][_0xce7b('0x47')]));_0x98a108[_0xce7b('0x46')]=_0x98a108[_0xce7b('0x46')][_0xce7b('0x58')]?_0x98a108[_0xce7b('0x46')]:_0x44d941['model'];_0x98a108[_0xce7b('0x4b')]=qs[_0xce7b('0x6c')](_0x3edd03[_0xce7b('0x43')][_0xce7b('0x6c')]);_0x98a108[_0xce7b('0x4c')]=qs[_0xce7b('0x44')](_['pick'](_0x3edd03[_0xce7b('0x43')],_0x44d941[_0xce7b('0x44')]));if(_0x3edd03[_0xce7b('0x43')][_0xce7b('0x4e')]){_0x98a108[_0xce7b('0x4c')]=_['merge'](_0x98a108[_0xce7b('0x4c')],{'$or':_[_0xce7b('0x3c')](_0x98a108[_0xce7b('0x46')],function(_0x403cf1){var _0x46751a={};_0x46751a[_0x403cf1]={'$like':'%'+_0x3edd03[_0xce7b('0x43')][_0xce7b('0x4e')]+'%'};return _0x46751a;})});}_0x98a108=_[_0xce7b('0x4f')]({},_0x98a108,_0x3edd03[_0xce7b('0x59')]);return _0xbf6ae['getApplications'](_0x98a108);}})[_0xce7b('0x21')](function(_0x31a002){if(_0x31a002){_0x5d6194=_0x31a002['length'];if(!_0x3edd03[_0xce7b('0x43')][_0xce7b('0x48')](_0xce7b('0x49'))){_0x98a108[_0xce7b('0x4a')]=qs[_0xce7b('0x4a')](_0x3edd03[_0xce7b('0x43')][_0xce7b('0x4a')]);_0x98a108[_0xce7b('0x30')]=qs[_0xce7b('0x30')](_0x3edd03[_0xce7b('0x43')]['offset']);}return _0xbf6ae[_0xce7b('0xc3')](_0x98a108);}})[_0xce7b('0x21')](function(_0x2c6c9b){if(_0x2c6c9b){return _0x2c6c9b?{'count':_0x5d6194,'rows':_0x2c6c9b}:null;}})['then'](respondWithResult(_0x4c6c28,null))[_0xce7b('0x2b')](handleError(_0x4c6c28,null));};exports[_0xce7b('0xc4')]=function(_0x4dddb3,_0x1aabbb,_0x2d2812){var _0x405387={'raw':![],'where':{}};var _0x1ddb4d={};var _0x15d163={'count':0x0,'rows':[]};return db[_0xce7b('0x3d')][_0xce7b('0x6b')]({'where':{'id':_0x4dddb3[_0xce7b('0x54')]['id']}})[_0xce7b('0x21')](handleEntityNotFound(_0x1aabbb,null))[_0xce7b('0x21')](function(_0x25cb3a){if(_0x25cb3a){_0x1ddb4d[_0xce7b('0x42')]=_['keys'](db['SmsInteraction'][_0xce7b('0x3e')]);_0x1ddb4d[_0xce7b('0x43')]=_[_0xce7b('0x57')](_0x4dddb3[_0xce7b('0x43')]);_0x1ddb4d['filters']=_[_0xce7b('0x45')](_0x1ddb4d[_0xce7b('0x42')],_0x1ddb4d[_0xce7b('0x43')]);_0x405387['attributes']=_[_0xce7b('0x45')](_0x1ddb4d[_0xce7b('0x42')],qs[_0xce7b('0x47')](_0x4dddb3['query'][_0xce7b('0x47')]));_0x405387['attributes']=_0x405387[_0xce7b('0x46')]['length']?_0x405387[_0xce7b('0x46')]:_0x1ddb4d['model'];if(!_0x4dddb3[_0xce7b('0x43')][_0xce7b('0x48')](_0xce7b('0x49'))){_0x405387[_0xce7b('0x4a')]=qs['limit'](_0x4dddb3['query']['limit']);_0x405387[_0xce7b('0x30')]=qs[_0xce7b('0x30')](_0x4dddb3[_0xce7b('0x43')][_0xce7b('0x30')]);}_0x405387['order']=qs[_0xce7b('0x6c')](_0x4dddb3[_0xce7b('0x43')]['sort']);_0x405387['where']=qs[_0xce7b('0x44')](_[_0xce7b('0x4d')](_0x4dddb3[_0xce7b('0x43')],_0x1ddb4d[_0xce7b('0x44')]));_0x405387['where'][_0xce7b('0x68')]=_0x25cb3a['id'];if(_0x4dddb3[_0xce7b('0x43')][_0xce7b('0x4e')]){_0x405387[_0xce7b('0x4c')]=_[_0xce7b('0x4f')](_0x405387[_0xce7b('0x4c')],{'$or':_[_0xce7b('0x3c')](_0x405387[_0xce7b('0x46')],function(_0x53e1a3){var _0x31b5b6={};_0x31b5b6[_0x53e1a3]={'$like':'%'+_0x4dddb3[_0xce7b('0x43')][_0xce7b('0x4e')]+'%'};return _0x31b5b6;})});}_0x405387=_[_0xce7b('0x4f')]({},_0x405387,_0x4dddb3[_0xce7b('0x59')]);return db[_0xce7b('0xa6')][_0xce7b('0x31')]({'where':_0x405387[_0xce7b('0x4c')]})[_0xce7b('0x21')](function(_0x5580d3){_0x15d163[_0xce7b('0x31')]=_0x5580d3;if(_0x4dddb3[_0xce7b('0x43')][_0xce7b('0x51')]){_0x405387[_0xce7b('0x52')]=[{'model':db[_0xce7b('0xa4')],'as':'Contact','required':![]},{'model':db[_0xce7b('0xb0')],'as':_0xce7b('0xc5'),'attributes':['name','fullname',_0xce7b('0xc6')],'required':![]},{'model':db[_0xce7b('0xc7')],'as':_0xce7b('0xc8'),'attributes':['id','name','color'],'where':_0x4dddb3['query'][_0xce7b('0xc9')]?{'id':_0x4dddb3[_0xce7b('0x43')][_0xce7b('0xc9')]}:undefined,'required':_0x4dddb3['query'][_0xce7b('0xc9')]?!![]:![]}];}return db[_0xce7b('0xa6')][_0xce7b('0x53')](_0x405387);})[_0xce7b('0x21')](function(_0x47e02d){_0x15d163[_0xce7b('0x6d')]=_0x47e02d;return _0x15d163;});}})['then'](respondWithFilteredResult(_0x1aabbb,_0x405387))[_0xce7b('0x2b')](handleError(_0x1aabbb,null));};exports[_0xce7b('0x3b')]=function(_0x4e889d,_0x4cce16,_0x20b638){var _0x20ff8a,_0x4075ea,_0x352cba;if(_[_0xce7b('0x98')](_0x4e889d[_0xce7b('0x5c')]['body'])||_0x4e889d[_0xce7b('0x5c')][_0xce7b('0x5c')]===''){throw new db[(_0xce7b('0x9a'))]['ValidationError'](_0xce7b('0x9c'));}if(_[_0xce7b('0x98')](_0x4e889d['body']['to'])){throw new db[(_0xce7b('0x9a'))][(_0xce7b('0x9b'))]('to\x20is\x20mandatory');}_0x20ff8a=_0x4e889d[_0xce7b('0x5c')]['to'];return db[_0xce7b('0x3d')][_0xce7b('0x5a')]({'where':{'id':_0x4e889d[_0xce7b('0x54')]['id']},'include':[{'model':db[_0xce7b('0xa0')],'as':_0xce7b('0xca'),'include':[{'model':db[_0xce7b('0xa4')],'as':_0xce7b('0xa1'),'where':{'mobile':_0x20ff8a},'limit':0x1,'order':[[_0xce7b('0x7c'),_0xce7b('0xcb')]]}]}]})[_0xce7b('0x21')](handleEntityNotFound(_0x4cce16,null))[_0xce7b('0x21')](function(_0x45dc95){if(_0x45dc95&&_0x45dc95[_0xce7b('0xca')]){_0x4075ea=_0x45dc95[_0xce7b('0x37')]({'plain':!![]});if(_0x4075ea['List']&&_0x4075ea[_0xce7b('0xca')][_0xce7b('0xa1')]['length']){return _0x4075ea['List']['Contacts'][0x0];}return db['CmContact'][_0xce7b('0x5b')](_[_0xce7b('0x19')](_0x4e889d[_0xce7b('0x5c')],{'firstName':_0x20ff8a,'mobile':_0x20ff8a,'phone':_0x20ff8a,'ListId':_0x4075ea[_0xce7b('0x7e')]}));}})[_0xce7b('0x21')](handleEntityNotFound(_0x4cce16,null))[_0xce7b('0x21')](function(_0x2c628a){if(_0x2c628a){_0x352cba=_0x2c628a;return db[_0xce7b('0xa6')][_0xce7b('0x5a')]({'where':{'ContactId':_0x352cba['id'],'closed':![],'SmsAccountId':_0x4075ea['id']}})['then'](function(_0x11bc4d){if(_0x11bc4d){return[_0x11bc4d,![]];}return db[_0xce7b('0xa6')][_0xce7b('0x5b')]({'UserId':_0x4e889d[_0xce7b('0x5d')]['id'],'ContactId':_0x352cba['id'],'SmsAccountId':_0x4075ea['id'],'phone':_0x20ff8a,'firstMsgDirection':_0xce7b('0xcc'),'Messages':[_['merge'](_0x4e889d['body'],{'read':![],'body':_0x4e889d['body'][_0xce7b('0x5c')],'phone':_0x20ff8a,'SmsAccountId':_0x4075ea['id'],'UserId':_0x4e889d[_0xce7b('0x5d')]['id'],'ContactId':_0x352cba['id']})]},{'include':[{'model':db[_0xce7b('0xac')],'as':_0xce7b('0xcd')}]})[_0xce7b('0x21')](function(_0x172d52){return[_0x172d52,!![]];});});}})['spread'](function(_0x5e3732,_0x4eba38){if(_0x4eba38){return _0x5e3732;}return db['SmsMessage'][_0xce7b('0x5b')](_[_0xce7b('0x4f')](_0x4e889d[_0xce7b('0x5c')],{'read':![],'body':_0x4e889d[_0xce7b('0x5c')]['body'],'phone':_0x20ff8a,'SmsAccountId':_0x4075ea['id'],'SmsInteractionId':_0x5e3732['id'],'UserId':_0x4e889d[_0xce7b('0x5d')]['id'],'ContactId':_0x352cba['id']}))[_0xce7b('0x21')](function(_0x169867){_0x5e3732['dataValues'][_0xce7b('0xcd')]=[];_0x5e3732[_0xce7b('0xce')][_0xce7b('0xcd')]['push'](_0x169867[_0xce7b('0xce')]);return _0x5e3732;});})['then'](respondWithResult(_0x4cce16,null))[_0xce7b('0x2b')](handleError(_0x4cce16,null));};exports[_0xce7b('0x2d')]=function(_0x30af38,_0x192d75,_0x225a89){if(_0x30af38[_0xce7b('0x5c')]['id']){delete _0x30af38[_0xce7b('0x5c')]['id'];}var _0x5e5f68,_0x1ce10c,_0x2db65d;return db[_0xce7b('0x3d')][_0xce7b('0x5a')]({'where':{'id':_0x30af38[_0xce7b('0x54')]['id']}})[_0xce7b('0x21')](handleEntityNotFound(_0x192d75,null))[_0xce7b('0x21')](function(_0x2eb174){if(_0x2eb174){_0x2db65d=_0x2eb174;logger[_0xce7b('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xce7b('0xcf'),_0x2eb174[_0xce7b('0x40')],util[_0xce7b('0xd0')](_0x30af38[_0xce7b('0x5c')],{'showHidden':![],'depth':null}));switch(_0x2eb174[_0xce7b('0x40')]){case _0xce7b('0x84'):if(_0x30af38['body'][_0xce7b('0xd1')]&&_0x30af38[_0xce7b('0x5c')][_0xce7b('0x2d')]){_0x1ce10c=_0x30af38['body'][_0xce7b('0x2d')];return db['SmsMessage'][_0xce7b('0x5a')]({'where':{'messageId':_0x30af38[_0xce7b('0x5c')][_0xce7b('0xd1')]}});}break;case'connectel':if(_0x30af38[_0xce7b('0x5c')]['requestid']&&_0x30af38[_0xce7b('0x5c')][_0xce7b('0xd2')]){_0x1ce10c=_0x30af38[_0xce7b('0x5c')][_0xce7b('0xd2')];return db[_0xce7b('0xac')][_0xce7b('0x5a')]({'where':{'messageId':_0x30af38[_0xce7b('0x5c')][_0xce7b('0xd3')]}});}break;case _0xce7b('0x88'):if(_0x30af38['body'][_0xce7b('0x89')]&&_0x30af38[_0xce7b('0x5c')]['status_code']){_0x1ce10c=_0x30af38[_0xce7b('0x5c')][_0xce7b('0xd4')];return db[_0xce7b('0xac')][_0xce7b('0x5a')]({'where':{'messageId':_0x30af38[_0xce7b('0x5c')][_0xce7b('0x89')]}});}break;case _0xce7b('0x8d'):var _0x127071=_0x30af38[_0xce7b('0x5c')][_0xce7b('0x8e')][0x0];if(_0x127071['messageId']&&_0x127071[_0xce7b('0x2d')]['groupName']===_0xce7b('0xd5')){_0x1ce10c=_0x127071[_0xce7b('0x2d')][_0xce7b('0xd6')];return db[_0xce7b('0xac')]['find']({'where':{'messageId':_0x127071[_0xce7b('0x82')]}});}break;case _0xce7b('0x92'):if(_0x30af38[_0xce7b('0x5c')][_0xce7b('0x82')]&&_0x30af38['body']['status']){_0x1ce10c=_0x30af38['body'][_0xce7b('0x2d')];return db[_0xce7b('0xac')]['find']({'where':{'messageId':_0x30af38[_0xce7b('0x5c')][_0xce7b('0x82')]}});}break;case _0xce7b('0x95'):if(_0x30af38[_0xce7b('0x5c')][0x0][_0xce7b('0x29')]['id']){_0x1ce10c=_0x30af38['body'][0x0][_0xce7b('0x40')];return db[_0xce7b('0xac')][_0xce7b('0x5a')]({'where':{'messageId':_0x30af38['body'][0x0][_0xce7b('0x29')]['id']}});}break;case _0xce7b('0x96'):if(_0x30af38['body'][_0xce7b('0xd7')]&&_0x30af38[_0xce7b('0x5c')][_0xce7b('0x2d')]){_0x1ce10c=_0x30af38[_0xce7b('0x5c')][_0xce7b('0x2d')];return db[_0xce7b('0xac')][_0xce7b('0x5a')]({'where':{'messageId':_0x30af38[_0xce7b('0x5c')][_0xce7b('0xd7')]}});}break;}}})[_0xce7b('0x21')](handleEntityNotFound(_0x192d75,null))[_0xce7b('0x21')](function(_0xe51ae3){if(_0xe51ae3){_0x5e5f68=_0xe51ae3;switch(_0x2db65d['type']){case _0xce7b('0x84'):if(_0x1ce10c===_0xce7b('0xd5')){return _0x5e5f68['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xce7b('0x2d'),_0xce7b('0x84'),util[_0xce7b('0xd0')](_0x30af38[_0xce7b('0x5c')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x1ce10c==='1'){return _0x5e5f68['update']({'read':!![]});}else{logger[_0xce7b('0x26')](_0xce7b('0xba'),'status','skebby',util[_0xce7b('0xd0')](_0x30af38['body'],{'showHidden':![],'depth':null}));}break;case _0xce7b('0x88'):if(!_0x30af38[_0xce7b('0x5c')][_0xce7b('0xd8')]&&_0x1ce10c>=0xc8&&_0x1ce10c<=0xce){return _0x5e5f68[_0xce7b('0x65')]({'read':!![]});}else{logger['error'](_0xce7b('0xba'),'status',_0xce7b('0x88'),util[_0xce7b('0xd0')](_0x30af38[_0xce7b('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xce7b('0x8d'):var _0x155706=_0x30af38[_0xce7b('0x5c')][_0xce7b('0x8e')][0x0];if(_0x155706['status'][_0xce7b('0xd6')]===_0xce7b('0xd5')){return _0x5e5f68[_0xce7b('0x65')]({'read':!![]});}else{logger[_0xce7b('0x26')](_0xce7b('0xba'),'status',_0xce7b('0x8d'),util[_0xce7b('0xd0')](_0x30af38[_0xce7b('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xce7b('0x92'):if(_0x1ce10c==_0xce7b('0xd9')||_0x1ce10c==_0xce7b('0xda')){return _0x5e5f68[_0xce7b('0x65')]({'read':!![]});}else{logger[_0xce7b('0x26')](_0xce7b('0xba'),_0xce7b('0x2d'),_0xce7b('0x92'),util[_0xce7b('0xd0')](_0x30af38['body'],{'showHidden':![],'depth':null}));}break;case _0xce7b('0x95'):if(_0x1ce10c==_0xce7b('0xdb')){return _0x5e5f68[_0xce7b('0x65')]({'read':!![]});}else{logger[_0xce7b('0x26')](_0xce7b('0xba'),_0xce7b('0x2d'),'bandwidth',util[_0xce7b('0xd0')](_0x30af38[_0xce7b('0x5c')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x1ce10c===_0xce7b('0xdc')||_0x1ce10c===_0xce7b('0xdd')){return _0x5e5f68['update']({'read':!![]});}else{logger[_0xce7b('0x26')](_0xce7b('0xba'),_0xce7b('0x2d'),_0xce7b('0x96'),util[_0xce7b('0xd0')](_0x30af38['body'],{'showHidden':![],'depth':null}));}break;}return _0x5e5f68;}})[_0xce7b('0x21')](respondWithResult(_0x192d75,null))['catch'](handleError(_0x192d75,null));};exports[_0xce7b('0xde')]=function(_0x21174c,_0x38fddf,_0x2b9d72){var _0x1f3a24,_0x5e544d,_0x1e1d2b;return db[_0xce7b('0x3d')]['find']({'where':{'id':_0x21174c['params']['id']}})[_0xce7b('0x21')](handleEntityNotFound(_0x38fddf,null))[_0xce7b('0x21')](function(_0x5aa9f1){if(_0x5aa9f1){_0x1e1d2b=_0x5aa9f1;logger[_0xce7b('0x24')](_0xce7b('0xba'),_0xce7b('0x2d'),'received\x20delivery\x20report\x20from',_0x5aa9f1[_0xce7b('0x40')],util[_0xce7b('0xd0')](_0x21174c[_0xce7b('0x43')],{'showHidden':![],'depth':null}));switch(_0x5aa9f1[_0xce7b('0x40')]){case'csc':if(_0x21174c[_0xce7b('0x43')]['message-id']&&_0x21174c['query']['state']){_0x5e544d=_0x21174c[_0xce7b('0x43')][_0xce7b('0xdf')];return db[_0xce7b('0xac')][_0xce7b('0x5a')]({'where':{'messageId':_0x21174c[_0xce7b('0x43')][_0xce7b('0xe0')]}});}break;}}})[_0xce7b('0x21')](handleEntityNotFound(_0x38fddf,null))[_0xce7b('0x21')](function(_0x14ae2b){if(_0x14ae2b){_0x1f3a24=_0x14ae2b;switch(_0x1e1d2b[_0xce7b('0x40')]){case'csc':if(_0x5e544d==='2'||_0x5e544d==='6'){return _0x1f3a24[_0xce7b('0x65')]({'read':!![]});}else{logger[_0xce7b('0x26')](_0xce7b('0xba'),_0xce7b('0x2d'),_0xce7b('0x8f'),util[_0xce7b('0xd0')](_0x21174c[_0xce7b('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x1f3a24;}})[_0xce7b('0x21')](respondWithResult(_0x38fddf,null))[_0xce7b('0x2b')](handleError(_0x38fddf,null));};exports[_0xce7b('0xe1')]=function(_0x295bed,_0x408041,_0x24b3a4){return db[_0xce7b('0x3d')][_0xce7b('0x5a')]({'where':{'id':_0x295bed['params']['id']}})['then'](handleEntityNotFound(_0x408041,null))[_0xce7b('0x21')](function(_0x4363a6){if(_0x4363a6){return _0x4363a6['addAgents'](_0x295bed[_0xce7b('0x5c')][_0xce7b('0x6f')],_[_0xce7b('0xa3')](_0x295bed[_0xce7b('0x5c')],[_0xce7b('0x6f'),'id'])||{})[_0xce7b('0xe2')](function(_0x37d6cc){for(var _0x2de729=0x0;_0x2de729<_0x295bed[_0xce7b('0x5c')][_0xce7b('0x6f')][_0xce7b('0x58')];_0x2de729+=0x1){socket['emit'](_0xce7b('0xe3'),{'UserId':Number(_0x295bed[_0xce7b('0x5c')]['ids'][_0x2de729]),'SmsAccountId':Number(_0x295bed['params']['id'])});}return _0x37d6cc;});}})[_0xce7b('0x21')](respondWithResult(_0x408041,null))['catch'](handleError(_0x408041,null));};exports[_0xce7b('0xe4')]=function(_0xac746d,_0x15cd6e,_0x4edbdb){return db[_0xce7b('0x3d')]['find']({'where':{'id':_0xac746d[_0xce7b('0x54')]['id']}})[_0xce7b('0x21')](handleEntityNotFound(_0x15cd6e,null))[_0xce7b('0x21')](function(_0x10865d){if(_0x10865d){return _0x10865d['removeAgents'](_0xac746d[_0xce7b('0x43')]['ids'])[_0xce7b('0x21')](function(){if(_[_0xce7b('0xe5')](_0xac746d['query'][_0xce7b('0x6f')])){for(var _0x45a992=0x0;_0x45a992<_0xac746d[_0xce7b('0x43')][_0xce7b('0x6f')][_0xce7b('0x58')];_0x45a992+=0x1){socket[_0xce7b('0xe6')](_0xce7b('0xe7'),{'UserId':Number(_0xac746d['query'][_0xce7b('0x6f')][_0x45a992]),'SmsAccountId':Number(_0xac746d['params']['id'])});}}else{socket[_0xce7b('0xe6')](_0xce7b('0xe7'),{'UserId':Number(_0xac746d[_0xce7b('0x43')][_0xce7b('0x6f')]),'SmsAccountId':Number(_0xac746d['params']['id'])});}});}})[_0xce7b('0x21')](respondWithStatusCode(_0x15cd6e,null))[_0xce7b('0x2b')](handleError(_0x15cd6e,null));};exports[_0xce7b('0xe8')]=function(_0xa06f19,_0x2010bf,_0x39d52a){var _0x2b2374={};var _0x38ef0f={};var _0x478d42;var _0xba49ff;return db[_0xce7b('0x3d')][_0xce7b('0x6b')]({'where':{'id':_0xa06f19[_0xce7b('0x54')]['id']}})[_0xce7b('0x21')](handleEntityNotFound(_0x2010bf,null))[_0xce7b('0x21')](function(_0x1810cd){if(_0x1810cd){_0x478d42=_0x1810cd;_0x38ef0f[_0xce7b('0x42')]=_[_0xce7b('0x57')](db[_0xce7b('0xb0')]['rawAttributes']);_0x38ef0f[_0xce7b('0x43')]=_[_0xce7b('0x57')](_0xa06f19['query']);_0x38ef0f[_0xce7b('0x44')]=_[_0xce7b('0x45')](_0x38ef0f[_0xce7b('0x42')],_0x38ef0f[_0xce7b('0x43')]);_0x2b2374[_0xce7b('0x46')]=_['intersection'](_0x38ef0f[_0xce7b('0x42')],qs['fields'](_0xa06f19[_0xce7b('0x43')]['fields']));_0x2b2374['attributes']=_0x2b2374[_0xce7b('0x46')]['length']?_0x2b2374[_0xce7b('0x46')]:_0x38ef0f[_0xce7b('0x42')];_0x2b2374[_0xce7b('0x4b')]=qs[_0xce7b('0x6c')](_0xa06f19[_0xce7b('0x43')][_0xce7b('0x6c')]);_0x2b2374[_0xce7b('0x4c')]=qs['filters'](_[_0xce7b('0x4d')](_0xa06f19[_0xce7b('0x43')],_0x38ef0f['filters']));if(_0xa06f19[_0xce7b('0x43')]['filter']){_0x2b2374[_0xce7b('0x4c')]=_[_0xce7b('0x4f')](_0x2b2374[_0xce7b('0x4c')],{'$or':_[_0xce7b('0x3c')](_0x2b2374['attributes'],function(_0x59baf8){var _0x4fc6a6={};_0x4fc6a6[_0x59baf8]={'$like':'%'+_0xa06f19[_0xce7b('0x43')][_0xce7b('0x4e')]+'%'};return _0x4fc6a6;})});}_0x2b2374=_[_0xce7b('0x4f')]({},_0x2b2374,_0xa06f19[_0xce7b('0x59')]);return _0x478d42['getAgents'](_0x2b2374);}})[_0xce7b('0x21')](function(_0x554fc4){if(_0x554fc4){_0xba49ff=_0x554fc4['length'];if(!_0xa06f19[_0xce7b('0x43')][_0xce7b('0x48')](_0xce7b('0x49'))){_0x2b2374[_0xce7b('0x4a')]=qs[_0xce7b('0x4a')](_0xa06f19[_0xce7b('0x43')][_0xce7b('0x4a')]);_0x2b2374['offset']=qs[_0xce7b('0x30')](_0xa06f19[_0xce7b('0x43')][_0xce7b('0x30')]);}return _0x478d42['getAgents'](_0x2b2374);}})[_0xce7b('0x21')](function(_0x4bd6bf){if(_0x4bd6bf){return _0x4bd6bf?{'count':_0xba49ff,'rows':_0x4bd6bf}:null;}})[_0xce7b('0x21')](respondWithResult(_0x2010bf,null))[_0xce7b('0x2b')](handleError(_0x2010bf,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 38135ca..63dd6ea 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 _0x1d09=['SmsAccount','setMaxListeners','save','update','hasOwnProperty','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d09,0x11e));var _0x91d0=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0x1d09[_0x34bd34];return _0x4e36d6;};'use strict';var EventEmitter=require(_0x91d0('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x91d0('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x91d0('0x2')](0x0);var events={'afterCreate':_0x91d0('0x3'),'afterUpdate':_0x91d0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x371787){return function(_0x773339,_0x5b27f9,_0xd91ce0){SmsAccountEvents['emit'](_0x371787+':'+_0x773339['id'],_0x773339);SmsAccountEvents['emit'](_0x371787,_0x773339);_0xd91ce0(null);};}for(var e in events){if(events[_0x91d0('0x5')](e)){var event=events[e];SmsAccount[_0x91d0('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x54c4=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x3d04e8,_0x41615f){var _0x1369c0=function(_0x3a6c05){while(--_0x3a6c05){_0x3d04e8['push'](_0x3d04e8['shift']());}};_0x1369c0(++_0x41615f);}(_0x54c4,0x1f1));var _0x454c=function(_0x52d774,_0x189db2){_0x52d774=_0x52d774-0x0;var _0x249f74=_0x54c4[_0x52d774];return _0x249f74;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x454c('0x0')](0x0);var events={'afterCreate':_0x454c('0x1'),'afterUpdate':_0x454c('0x2'),'afterDestroy':_0x454c('0x3')};function emitEvent(_0x4acc5e){return function(_0x5aa05d,_0x91f9cc,_0x3fda7a){SmsAccountEvents[_0x454c('0x4')](_0x4acc5e+':'+_0x5aa05d['id'],_0x5aa05d);SmsAccountEvents[_0x454c('0x4')](_0x4acc5e,_0x5aa05d);_0x3fda7a(null);};}for(var e in events){if(events[_0x454c('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x454c('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f0d3823..b1bfd9b 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 _0x95f8=['api','moment','bluebird','request-promise','path','rimraf','exports','sms_accounts'];(function(_0x10d2e3,_0x55572b){var _0x331450=function(_0x5c9202){while(--_0x5c9202){_0x10d2e3['push'](_0x10d2e3['shift']());}};_0x331450(++_0x55572b);}(_0x95f8,0x150));var _0x895f=function(_0x30da2e,_0x146e54){_0x30da2e=_0x30da2e-0x0;var _0x794139=_0x95f8[_0x30da2e];return _0x794139;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x895f('0x0'));var moment=require(_0x895f('0x1'));var BPromise=require(_0x895f('0x2'));var rp=require(_0x895f('0x3'));var fs=require('fs');var path=require(_0x895f('0x4'));var rimraf=require(_0x895f('0x5'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0x895f('0x6')]=function(_0x45c2d3,_0x4b26f2){return _0x45c2d3['define']('SmsAccount',attributes,{'tableName':_0x895f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1c5=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','api'];(function(_0x3a7e11,_0x5ac881){var _0xdfb82e=function(_0x55acd7){while(--_0x55acd7){_0x3a7e11['push'](_0x3a7e11['shift']());}};_0xdfb82e(++_0x5ac881);}(_0xf1c5,0x106));var _0x5f1c=function(_0x4a28cd,_0x4d1a9b){_0x4a28cd=_0x4a28cd-0x0;var _0x314cf5=_0xf1c5[_0x4a28cd];return _0x314cf5;};'use strict';var _=require(_0x5f1c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5f1c('0x1'));var moment=require(_0x5f1c('0x2'));var BPromise=require(_0x5f1c('0x3'));var rp=require(_0x5f1c('0x4'));var fs=require('fs');var path=require(_0x5f1c('0x5'));var rimraf=require(_0x5f1c('0x6'));var config=require(_0x5f1c('0x7'));var attributes=require(_0x5f1c('0x8'));module[_0x5f1c('0x9')]=function(_0xaab032,_0x75e692){return _0xaab032['define'](_0x5f1c('0xa'),attributes,{'tableName':_0x5f1c('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 b0c19db..84f62f0 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 _0x3d03=['request','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','ShowSmsAccount','find','options','raw','where','include','map','model','attributes','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register'];(function(_0x124e1f,_0x430836){var _0x59f01c=function(_0x31f2e3){while(--_0x31f2e3){_0x124e1f['push'](_0x124e1f['shift']());}};_0x59f01c(++_0x430836);}(_0x3d03,0x134));var _0x33d0=function(_0xeea277,_0x56ce7b){_0xeea277=_0xeea277-0x0;var _0x4a84cb=_0x3d03[_0xeea277];return _0x4a84cb;};'use strict';var _=require(_0x33d0('0x0'));var util=require(_0x33d0('0x1'));var moment=require(_0x33d0('0x2'));var BPromise=require('bluebird');var rs=require(_0x33d0('0x3'));var fs=require('fs');var Redis=require(_0x33d0('0x4'));var db=require(_0x33d0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x33d0('0x6'))(_0x33d0('0x7'));var config=require('../../config/environment');var jayson=require(_0x33d0('0x8'));var client=jayson[_0x33d0('0x9')][_0x33d0('0xa')]({'port':0x232a});config[_0x33d0('0xb')]=_[_0x33d0('0xc')](config[_0x33d0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x33d0('0xd'))(new Redis(config['redis']));require(_0x33d0('0xe'))[_0x33d0('0xf')](socket);function respondWithRpcPromise(_0x72f34f,_0x4be155,_0x3f3cf5){return new BPromise(function(_0x2c64f8,_0x5d820b){return client[_0x33d0('0x10')](_0x72f34f,_0x3f3cf5)['then'](function(_0x19d176){logger['info'](_0x33d0('0x11'),_0x4be155,'request\x20sent');logger[_0x33d0('0x12')](_0x33d0('0x13'),_0x4be155,_0x33d0('0x14'),JSON[_0x33d0('0x15')](_0x19d176));if(_0x19d176[_0x33d0('0x16')]){if(_0x19d176[_0x33d0('0x16')]['code']===0x1f4){logger[_0x33d0('0x16')](_0x33d0('0x11'),_0x4be155,_0x19d176[_0x33d0('0x16')][_0x33d0('0x17')]);return _0x5d820b(_0x19d176['error']['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x4be155,_0x19d176[_0x33d0('0x16')][_0x33d0('0x17')]);return _0x2c64f8(_0x19d176[_0x33d0('0x16')][_0x33d0('0x17')]);}else{logger[_0x33d0('0x18')](_0x33d0('0x11'),_0x4be155,_0x33d0('0x14'));_0x2c64f8(_0x19d176['result'][_0x33d0('0x17')]);}})[_0x33d0('0x19')](function(_0x314c23){logger['error'](_0x33d0('0x11'),_0x4be155,_0x314c23);_0x5d820b(_0x314c23);});});}exports[_0x33d0('0x1a')]=function(_0x20630e){var _0xab618b=this;return new Promise(function(_0x3b97c7,_0x5566a3){return db['SmsAccount'][_0x33d0('0x1b')]({'raw':_0x20630e[_0x33d0('0x1c')]?_0x20630e[_0x33d0('0x1c')][_0x33d0('0x1d')]===undefined?!![]:![]:!![],'where':_0x20630e[_0x33d0('0x1c')]?_0x20630e['options'][_0x33d0('0x1e')]||null:null,'attributes':_0x20630e[_0x33d0('0x1c')]?_0x20630e[_0x33d0('0x1c')]['attributes']||null:null,'include':_0x20630e[_0x33d0('0x1c')]?_0x20630e[_0x33d0('0x1c')][_0x33d0('0x1f')]?_[_0x33d0('0x20')](_0x20630e[_0x33d0('0x1c')][_0x33d0('0x1f')],function(_0x38cea3){return{'model':db[_0x38cea3[_0x33d0('0x21')]],'as':_0x38cea3['as'],'attributes':_0x38cea3[_0x33d0('0x22')],'include':_0x38cea3[_0x33d0('0x1f')]?_[_0x33d0('0x20')](_0x38cea3[_0x33d0('0x1f')],function(_0x341b64){return{'model':db[_0x341b64['model']],'as':_0x341b64['as'],'attributes':_0x341b64[_0x33d0('0x22')],'include':_0x341b64[_0x33d0('0x1f')]?_[_0x33d0('0x20')](_0x341b64['include'],function(_0x434c43){return{'model':db[_0x434c43[_0x33d0('0x21')]],'as':_0x434c43['as'],'attributes':_0x434c43[_0x33d0('0x22')]};}):[]};}):[]};}):[]:[]})[_0x33d0('0x23')](function(_0x40090c){logger[_0x33d0('0x18')]('ShowSmsAccount',_0x20630e);logger[_0x33d0('0x12')](_0x33d0('0x1a'),_0x20630e,JSON['stringify'](_0x40090c));_0x3b97c7(_0x40090c);})[_0x33d0('0x19')](function(_0x43a028){logger['error'](_0x33d0('0x1a'),_0x43a028[_0x33d0('0x17')],_0x20630e);_0x5566a3(_0xab618b[_0x33d0('0x16')](0x1f4,_0x43a028['message']));});});}; \ No newline at end of file +var _0x067e=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch','options','raw','attributes','include','map','model','ShowSmsAccount','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x328e17,_0x2b9dbb){var _0x1c9807=function(_0xd426d0){while(--_0xd426d0){_0x328e17['push'](_0x328e17['shift']());}};_0x1c9807(++_0x2b9dbb);}(_0x067e,0x102));var _0xe067=function(_0x3e2648,_0x560a44){_0x3e2648=_0x3e2648-0x0;var _0x54c629=_0x067e[_0x3e2648];return _0x54c629;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe067('0x0'));var BPromise=require('bluebird');var rs=require(_0xe067('0x1'));var fs=require('fs');var Redis=require(_0xe067('0x2'));var db=require(_0xe067('0x3'))['db'];var utils=require(_0xe067('0x4'));var logger=require('../../config/logger')(_0xe067('0x5'));var config=require('../../config/environment');var jayson=require(_0xe067('0x6'));var client=jayson[_0xe067('0x7')][_0xe067('0x8')]({'port':0x232a});config[_0xe067('0x9')]=_[_0xe067('0xa')](config[_0xe067('0x9')],{'host':_0xe067('0xb'),'port':0x18eb});var socket=require(_0xe067('0xc'))(new Redis(config[_0xe067('0x9')]));require('./smsAccount.socket')[_0xe067('0xd')](socket);function respondWithRpcPromise(_0x5bb8a6,_0x230bb3,_0xa96311){return new BPromise(function(_0x5cfccb,_0x401148){return client[_0xe067('0xe')](_0x5bb8a6,_0xa96311)[_0xe067('0xf')](function(_0x480b80){logger['info']('SmsAccount,\x20%s,\x20%s',_0x230bb3,_0xe067('0x10'));logger[_0xe067('0x11')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x230bb3,'request\x20sent',JSON[_0xe067('0x12')](_0x480b80));if(_0x480b80[_0xe067('0x13')]){if(_0x480b80[_0xe067('0x13')][_0xe067('0x14')]===0x1f4){logger['error'](_0xe067('0x15'),_0x230bb3,_0x480b80[_0xe067('0x13')][_0xe067('0x16')]);return _0x401148(_0x480b80[_0xe067('0x13')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x230bb3,_0x480b80['error'][_0xe067('0x16')]);return _0x5cfccb(_0x480b80[_0xe067('0x13')]['message']);}else{logger[_0xe067('0x17')](_0xe067('0x15'),_0x230bb3,'request\x20sent');_0x5cfccb(_0x480b80[_0xe067('0x18')][_0xe067('0x16')]);}})[_0xe067('0x19')](function(_0x317ce4){logger[_0xe067('0x13')](_0xe067('0x15'),_0x230bb3,_0x317ce4);_0x401148(_0x317ce4);});});}exports['ShowSmsAccount']=function(_0x1f5a80){var _0x307f71=this;return new Promise(function(_0x4b5192,_0x53332d){return db['SmsAccount']['find']({'raw':_0x1f5a80[_0xe067('0x1a')]?_0x1f5a80[_0xe067('0x1a')][_0xe067('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f5a80[_0xe067('0x1a')]?_0x1f5a80[_0xe067('0x1a')]['where']||null:null,'attributes':_0x1f5a80[_0xe067('0x1a')]?_0x1f5a80[_0xe067('0x1a')][_0xe067('0x1c')]||null:null,'include':_0x1f5a80[_0xe067('0x1a')]?_0x1f5a80['options'][_0xe067('0x1d')]?_[_0xe067('0x1e')](_0x1f5a80[_0xe067('0x1a')][_0xe067('0x1d')],function(_0x213bdb){return{'model':db[_0x213bdb[_0xe067('0x1f')]],'as':_0x213bdb['as'],'attributes':_0x213bdb['attributes'],'include':_0x213bdb[_0xe067('0x1d')]?_['map'](_0x213bdb[_0xe067('0x1d')],function(_0x1b838c){return{'model':db[_0x1b838c['model']],'as':_0x1b838c['as'],'attributes':_0x1b838c[_0xe067('0x1c')],'include':_0x1b838c['include']?_[_0xe067('0x1e')](_0x1b838c[_0xe067('0x1d')],function(_0x3a5464){return{'model':db[_0x3a5464[_0xe067('0x1f')]],'as':_0x3a5464['as'],'attributes':_0x3a5464[_0xe067('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe067('0xf')](function(_0x335e9b){logger[_0xe067('0x17')](_0xe067('0x20'),_0x1f5a80);logger[_0xe067('0x11')](_0xe067('0x20'),_0x1f5a80,JSON[_0xe067('0x12')](_0x335e9b));_0x4b5192(_0x335e9b);})[_0xe067('0x19')](function(_0x5953c8){logger[_0xe067('0x13')]('ShowSmsAccount',_0x5953c8[_0xe067('0x16')],_0x1f5a80);_0x53332d(_0x307f71['error'](0x1f4,_0x5953c8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 71d4d24..d6cbf87 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 45e01e8..8a4d429 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 _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x1d24a4,_0x33ad54){var _0x1f1302=function(_0x6a065b){while(--_0x6a065b){_0x1d24a4['push'](_0x1d24a4['shift']());}};_0x1f1302(++_0x33ad54);}(_0xe14b,0x93));var _0xbe14=function(_0x43550b,_0x3c20c4){_0x43550b=_0x43550b-0x0;var _0x1fee0a=_0xe14b[_0x43550b];return _0x1fee0a;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=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(_0x588bd9,_0xb130b9){var _0x279beb=function(_0x4af236){while(--_0x4af236){_0x588bd9['push'](_0x588bd9['shift']());}};_0x279beb(++_0xb130b9);}(_0x3e74,0x175));var _0x43e7=function(_0x44c222,_0x3e38bf){_0x44c222=_0x44c222-0x0;var _0x424dff=_0x3e74[_0x44c222];return _0x424dff;};'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 87bf143..819990e 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 _0xaac8=['STRING','noop','TEXT','*,*,*,*'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xaac8,0xf8));var _0x8aac=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xaac8[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8aac('0x0')],'allowNull':![],'defaultValue':_0x8aac('0x1')},'appdata':{'type':Sequelize[_0x8aac('0x2')]()},'description':{'type':Sequelize[_0x8aac('0x0')]},'interval':{'type':Sequelize[_0x8aac('0x0')],'defaultValue':_0x8aac('0x3')}}; \ No newline at end of file +var _0xa3d4=['noop','sequelize','INTEGER','STRING'];(function(_0x50221f,_0x59ef1a){var _0x5ed563=function(_0x2464b2){while(--_0x2464b2){_0x50221f['push'](_0x50221f['shift']());}};_0x5ed563(++_0x59ef1a);}(_0xa3d4,0x151));var _0x4a3d=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xa3d4[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require(_0x4a3d('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4a3d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4a3d('0x2')],'allowNull':![],'defaultValue':_0x4a3d('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x4a3d('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 5e983e2..c887f3e 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 _0xf4c9=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','name','send','index','map','SmsApplication','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','create','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4c9,0x83));var _0x9f4c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf4c9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x9f4c('0x0'));var rimraf=require(_0x9f4c('0x1'));var zipdir=require(_0x9f4c('0x2'));var jsonpatch=require(_0x9f4c('0x3'));var rp=require('request-promise');var moment=require(_0x9f4c('0x4'));var BPromise=require(_0x9f4c('0x5'));var Mustache=require(_0x9f4c('0x6'));var util=require(_0x9f4c('0x7'));var path=require(_0x9f4c('0x8'));var sox=require('sox');var csv=require(_0x9f4c('0x9'));var ejs=require(_0x9f4c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9f4c('0xb'));var jsforce=require(_0x9f4c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9f4c('0x9'));var querystring=require(_0x9f4c('0xd'));var Papa=require(_0x9f4c('0xe'));var Redis=require(_0x9f4c('0xf'));var authService=require(_0x9f4c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9f4c('0x11'));var hardwareService=require(_0x9f4c('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9f4c('0x13'));var config=require(_0x9f4c('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x451368,_0x369546){_0x369546=_0x369546||0xcc;return function(_0x5aef51){if(_0x5aef51){return _0x451368['sendStatus'](_0x369546);}return _0x451368[_0x9f4c('0x15')](_0x369546)[_0x9f4c('0x16')]();};}function respondWithResult(_0x443ed5,_0x394bc6){_0x394bc6=_0x394bc6||0xc8;return function(_0x170d77){if(_0x170d77){return _0x443ed5[_0x9f4c('0x15')](_0x394bc6)[_0x9f4c('0x17')](_0x170d77);}};}function respondWithFilteredResult(_0x321443,_0x19191b){return function(_0xcb9c8a){if(_0xcb9c8a){var _0x2de07e=typeof _0x19191b['offset']===_0x9f4c('0x18')&&typeof _0x19191b[_0x9f4c('0x19')]==='undefined';var _0x2c1f67=_0xcb9c8a[_0x9f4c('0x1a')];var _0x4cf399=_0x2de07e?0x0:_0x19191b[_0x9f4c('0x1b')];var _0x2823a7=_0x2de07e?_0xcb9c8a[_0x9f4c('0x1a')]:_0x19191b['offset']+_0x19191b['limit'];var _0x3fdada;if(_0x2823a7>=_0x2c1f67){_0x2823a7=_0x2c1f67;_0x3fdada=0xc8;}else{_0x3fdada=0xce;}_0x321443[_0x9f4c('0x15')](_0x3fdada);return _0x321443[_0x9f4c('0x1c')](_0x9f4c('0x1d'),_0x4cf399+'-'+_0x2823a7+'/'+_0x2c1f67)[_0x9f4c('0x17')](_0xcb9c8a);}return null;};}function patchUpdates(_0xf48909){return function(_0xaa7f36){try{jsonpatch['apply'](_0xaa7f36,_0xf48909,!![]);}catch(_0x32869b){return BPromise[_0x9f4c('0x1e')](_0x32869b);}return _0xaa7f36[_0x9f4c('0x1f')]();};}function saveUpdates(_0x53902d,_0xf86944){return function(_0x37892e){if(_0x37892e){return _0x37892e[_0x9f4c('0x20')](_0x53902d)['then'](function(_0x27fb36){return _0x27fb36;});}return null;};}function removeEntity(_0x28a822,_0x2eae3c){return function(_0x55b405){if(_0x55b405){return _0x55b405['destroy']()[_0x9f4c('0x21')](function(){_0x28a822[_0x9f4c('0x15')](0xcc)[_0x9f4c('0x16')]();});}};}function handleEntityNotFound(_0x5a916f,_0x157466){return function(_0x4cd7f6){if(!_0x4cd7f6){_0x5a916f['sendStatus'](0x194);}return _0x4cd7f6;};}function handleError(_0x467ee4,_0x561f1d){_0x561f1d=_0x561f1d||0x1f4;return function(_0x33f237){logger[_0x9f4c('0x22')](_0x33f237['stack']);if(_0x33f237[_0x9f4c('0x23')]){delete _0x33f237[_0x9f4c('0x23')];}_0x467ee4[_0x9f4c('0x15')](_0x561f1d)[_0x9f4c('0x24')](_0x33f237);};}exports[_0x9f4c('0x25')]=function(_0x28aa6f,_0x3c9775){var _0x50ed19={},_0x27463f={},_0x2e8e17={'count':0x0,'rows':[]};var _0x3e0024=_[_0x9f4c('0x26')](db[_0x9f4c('0x27')]['rawAttributes'],function(_0x15a1ae){return{'name':_0x15a1ae[_0x9f4c('0x28')],'type':_0x15a1ae[_0x9f4c('0x29')][_0x9f4c('0x2a')]};});_0x27463f[_0x9f4c('0x2b')]=_['map'](_0x3e0024,'name');_0x27463f[_0x9f4c('0x2c')]=_[_0x9f4c('0x2d')](_0x28aa6f[_0x9f4c('0x2c')]);_0x27463f[_0x9f4c('0x2e')]=_[_0x9f4c('0x2f')](_0x27463f['model'],_0x27463f[_0x9f4c('0x2c')]);_0x50ed19[_0x9f4c('0x30')]=_[_0x9f4c('0x2f')](_0x27463f[_0x9f4c('0x2b')],qs[_0x9f4c('0x31')](_0x28aa6f['query'][_0x9f4c('0x31')]));_0x50ed19[_0x9f4c('0x30')]=_0x50ed19['attributes']['length']?_0x50ed19[_0x9f4c('0x30')]:_0x27463f[_0x9f4c('0x2b')];if(!_0x28aa6f[_0x9f4c('0x2c')][_0x9f4c('0x32')](_0x9f4c('0x33'))){_0x50ed19[_0x9f4c('0x19')]=qs['limit'](_0x28aa6f[_0x9f4c('0x2c')][_0x9f4c('0x19')]);_0x50ed19[_0x9f4c('0x1b')]=qs[_0x9f4c('0x1b')](_0x28aa6f[_0x9f4c('0x2c')]['offset']);}_0x50ed19[_0x9f4c('0x34')]=qs[_0x9f4c('0x35')](_0x28aa6f[_0x9f4c('0x2c')][_0x9f4c('0x35')]);_0x50ed19[_0x9f4c('0x36')]=qs[_0x9f4c('0x2e')](_['pick'](_0x28aa6f[_0x9f4c('0x2c')],_0x27463f['filters']),_0x3e0024);if(_0x28aa6f['query'][_0x9f4c('0x37')]){_0x50ed19[_0x9f4c('0x36')]=_[_0x9f4c('0x38')](_0x50ed19[_0x9f4c('0x36')],{'$or':_[_0x9f4c('0x26')](_0x3e0024,function(_0x526f83){if(_0x526f83[_0x9f4c('0x29')]!==_0x9f4c('0x39')){var _0xa2a02c={};_0xa2a02c[_0x526f83[_0x9f4c('0x23')]]={'$like':'%'+_0x28aa6f[_0x9f4c('0x2c')][_0x9f4c('0x37')]+'%'};return _0xa2a02c;}})});}_0x50ed19=_[_0x9f4c('0x38')]({},_0x50ed19,_0x28aa6f[_0x9f4c('0x3a')]);var _0x50da83={'where':_0x50ed19['where']};return db[_0x9f4c('0x27')][_0x9f4c('0x1a')](_0x50da83)[_0x9f4c('0x21')](function(_0x22f7e6){_0x2e8e17['count']=_0x22f7e6;if(_0x28aa6f[_0x9f4c('0x2c')][_0x9f4c('0x3b')]){_0x50ed19[_0x9f4c('0x3c')]=[{'all':!![]}];}return db[_0x9f4c('0x27')][_0x9f4c('0x3d')](_0x50ed19);})[_0x9f4c('0x21')](function(_0xad1f63){_0x2e8e17[_0x9f4c('0x3e')]=_0xad1f63;return _0x2e8e17;})[_0x9f4c('0x21')](respondWithFilteredResult(_0x3c9775,_0x50ed19))[_0x9f4c('0x3f')](handleError(_0x3c9775,null));};exports[_0x9f4c('0x40')]=function(_0x33875d,_0x5487ab){var _0x256d6b={'raw':!![],'where':{'id':_0x33875d[_0x9f4c('0x41')]['id']}},_0x4fecd9={};_0x4fecd9['model']=_[_0x9f4c('0x2d')](db['SmsApplication'][_0x9f4c('0x42')]);_0x4fecd9[_0x9f4c('0x2c')]=_[_0x9f4c('0x2d')](_0x33875d['query']);_0x4fecd9['filters']=_['intersection'](_0x4fecd9['model'],_0x4fecd9[_0x9f4c('0x2c')]);_0x256d6b[_0x9f4c('0x30')]=_[_0x9f4c('0x2f')](_0x4fecd9['model'],qs[_0x9f4c('0x31')](_0x33875d['query'][_0x9f4c('0x31')]));_0x256d6b[_0x9f4c('0x30')]=_0x256d6b['attributes']['length']?_0x256d6b[_0x9f4c('0x30')]:_0x4fecd9['model'];if(_0x33875d[_0x9f4c('0x2c')][_0x9f4c('0x3b')]){_0x256d6b[_0x9f4c('0x3c')]=[{'all':!![]}];}_0x256d6b=_[_0x9f4c('0x38')]({},_0x256d6b,_0x33875d[_0x9f4c('0x3a')]);return db['SmsApplication']['find'](_0x256d6b)[_0x9f4c('0x21')](handleEntityNotFound(_0x5487ab,null))['then'](respondWithResult(_0x5487ab,null))[_0x9f4c('0x3f')](handleError(_0x5487ab,null));};exports[_0x9f4c('0x43')]=function(_0xf1f3e5,_0x28998f){return db[_0x9f4c('0x27')][_0x9f4c('0x43')](_0xf1f3e5[_0x9f4c('0x44')],{})[_0x9f4c('0x21')](respondWithResult(_0x28998f,0xc9))['catch'](handleError(_0x28998f,null));};exports[_0x9f4c('0x20')]=function(_0x1fcc57,_0x4502da){if(_0x1fcc57[_0x9f4c('0x44')]['id']){delete _0x1fcc57[_0x9f4c('0x44')]['id'];}return db[_0x9f4c('0x27')]['find']({'where':{'id':_0x1fcc57['params']['id']}})[_0x9f4c('0x21')](handleEntityNotFound(_0x4502da,null))[_0x9f4c('0x21')](saveUpdates(_0x1fcc57[_0x9f4c('0x44')],null))[_0x9f4c('0x21')](respondWithResult(_0x4502da,null))['catch'](handleError(_0x4502da,null));};exports[_0x9f4c('0x45')]=function(_0xa77448,_0x3ed42c){return db[_0x9f4c('0x27')][_0x9f4c('0x46')]({'where':{'id':_0xa77448[_0x9f4c('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ed42c,null))[_0x9f4c('0x21')](removeEntity(_0x3ed42c,null))[_0x9f4c('0x3f')](handleError(_0x3ed42c,null));}; \ No newline at end of file +var _0x0204=['status','end','json','limit','undefined','count','offset','set','apply','reject','save','then','destroy','error','name','index','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','SmsApplication','include','findAll','rows','catch','show','params','filters','length','includeAll','merge','create','update','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus'];(function(_0x138ecf,_0x33f7c6){var _0x1f48fc=function(_0x1a8e84){while(--_0x1a8e84){_0x138ecf['push'](_0x138ecf['shift']());}};_0x1f48fc(++_0x33f7c6);}(_0x0204,0xc2));var _0x4020=function(_0x21eddf,_0x379548){_0x21eddf=_0x21eddf-0x0;var _0x4efdb5=_0x0204[_0x21eddf];return _0x4efdb5;};'use strict';var emlformat=require(_0x4020('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4020('0x1'));var jsonpatch=require(_0x4020('0x2'));var rp=require('request-promise');var moment=require(_0x4020('0x3'));var BPromise=require(_0x4020('0x4'));var Mustache=require(_0x4020('0x5'));var util=require(_0x4020('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x4020('0x7'));var ejs=require(_0x4020('0x8'));var fs=require('fs');var fs_extra=require(_0x4020('0x9'));var _=require(_0x4020('0xa'));var squel=require(_0x4020('0xb'));var crypto=require(_0x4020('0xc'));var jsforce=require(_0x4020('0xd'));var deskjs=require(_0x4020('0xe'));var toCsv=require(_0x4020('0x7'));var querystring=require(_0x4020('0xf'));var Papa=require(_0x4020('0x10'));var Redis=require(_0x4020('0x11'));var authService=require(_0x4020('0x12'));var qs=require(_0x4020('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4020('0x14'))(_0x4020('0x15'));var utils=require(_0x4020('0x16'));var config=require(_0x4020('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ed755,_0x3d0448){_0x3d0448=_0x3d0448||0xcc;return function(_0x3eeed6){if(_0x3eeed6){return _0x4ed755[_0x4020('0x18')](_0x3d0448);}return _0x4ed755[_0x4020('0x19')](_0x3d0448)[_0x4020('0x1a')]();};}function respondWithResult(_0x300c22,_0x22abc0){_0x22abc0=_0x22abc0||0xc8;return function(_0x770b17){if(_0x770b17){return _0x300c22['status'](_0x22abc0)[_0x4020('0x1b')](_0x770b17);}};}function respondWithFilteredResult(_0x38e322,_0x13861e){return function(_0xdab872){if(_0xdab872){var _0x370336=typeof _0x13861e['offset']==='undefined'&&typeof _0x13861e[_0x4020('0x1c')]===_0x4020('0x1d');var _0x4f5e4a=_0xdab872[_0x4020('0x1e')];var _0x4c7506=_0x370336?0x0:_0x13861e[_0x4020('0x1f')];var _0x14a2ee=_0x370336?_0xdab872[_0x4020('0x1e')]:_0x13861e['offset']+_0x13861e[_0x4020('0x1c')];var _0x44339d;if(_0x14a2ee>=_0x4f5e4a){_0x14a2ee=_0x4f5e4a;_0x44339d=0xc8;}else{_0x44339d=0xce;}_0x38e322[_0x4020('0x19')](_0x44339d);return _0x38e322[_0x4020('0x20')]('Content-Range',_0x4c7506+'-'+_0x14a2ee+'/'+_0x4f5e4a)['json'](_0xdab872);}return null;};}function patchUpdates(_0x5b6be4){return function(_0x1ebecd){try{jsonpatch[_0x4020('0x21')](_0x1ebecd,_0x5b6be4,!![]);}catch(_0x527425){return BPromise[_0x4020('0x22')](_0x527425);}return _0x1ebecd[_0x4020('0x23')]();};}function saveUpdates(_0x329fd6,_0x180ada){return function(_0x4e3f22){if(_0x4e3f22){return _0x4e3f22['update'](_0x329fd6)[_0x4020('0x24')](function(_0x5f1305){return _0x5f1305;});}return null;};}function removeEntity(_0x4fecf0,_0x38ea5a){return function(_0x470892){if(_0x470892){return _0x470892[_0x4020('0x25')]()['then'](function(){_0x4fecf0[_0x4020('0x19')](0xcc)[_0x4020('0x1a')]();});}};}function handleEntityNotFound(_0x22f201,_0x5a6b32){return function(_0x249a00){if(!_0x249a00){_0x22f201[_0x4020('0x18')](0x194);}return _0x249a00;};}function handleError(_0x271c74,_0xd394a6){_0xd394a6=_0xd394a6||0x1f4;return function(_0x11f689){logger[_0x4020('0x26')](_0x11f689['stack']);if(_0x11f689[_0x4020('0x27')]){delete _0x11f689[_0x4020('0x27')];}_0x271c74[_0x4020('0x19')](_0xd394a6)['send'](_0x11f689);};}exports[_0x4020('0x28')]=function(_0x3a787a,_0x5b29a8){var _0x501c78={},_0x46e863={},_0x2988f8={'count':0x0,'rows':[]};var _0x2866d1=_[_0x4020('0x29')](db['SmsApplication'][_0x4020('0x2a')],function(_0x2e1537){return{'name':_0x2e1537[_0x4020('0x2b')],'type':_0x2e1537[_0x4020('0x2c')]['key']};});_0x46e863['model']=_[_0x4020('0x29')](_0x2866d1,_0x4020('0x27'));_0x46e863[_0x4020('0x2d')]=_[_0x4020('0x2e')](_0x3a787a[_0x4020('0x2d')]);_0x46e863['filters']=_[_0x4020('0x2f')](_0x46e863[_0x4020('0x30')],_0x46e863[_0x4020('0x2d')]);_0x501c78[_0x4020('0x31')]=_[_0x4020('0x2f')](_0x46e863[_0x4020('0x30')],qs['fields'](_0x3a787a[_0x4020('0x2d')][_0x4020('0x32')]));_0x501c78['attributes']=_0x501c78[_0x4020('0x31')]['length']?_0x501c78[_0x4020('0x31')]:_0x46e863[_0x4020('0x30')];if(!_0x3a787a[_0x4020('0x2d')][_0x4020('0x33')](_0x4020('0x34'))){_0x501c78[_0x4020('0x1c')]=qs[_0x4020('0x1c')](_0x3a787a[_0x4020('0x2d')][_0x4020('0x1c')]);_0x501c78[_0x4020('0x1f')]=qs['offset'](_0x3a787a['query']['offset']);}_0x501c78[_0x4020('0x35')]=qs[_0x4020('0x36')](_0x3a787a[_0x4020('0x2d')]['sort']);_0x501c78['where']=qs['filters'](_[_0x4020('0x37')](_0x3a787a[_0x4020('0x2d')],_0x46e863['filters']),_0x2866d1);if(_0x3a787a[_0x4020('0x2d')][_0x4020('0x38')]){_0x501c78[_0x4020('0x39')]=_['merge'](_0x501c78[_0x4020('0x39')],{'$or':_['map'](_0x2866d1,function(_0x5e5810){if(_0x5e5810[_0x4020('0x2c')]!=='VIRTUAL'){var _0x20f427={};_0x20f427[_0x5e5810['name']]={'$like':'%'+_0x3a787a[_0x4020('0x2d')][_0x4020('0x38')]+'%'};return _0x20f427;}})});}_0x501c78=_['merge']({},_0x501c78,_0x3a787a['options']);var _0x13ef35={'where':_0x501c78['where']};return db[_0x4020('0x3a')]['count'](_0x13ef35)[_0x4020('0x24')](function(_0x2e58b7){_0x2988f8[_0x4020('0x1e')]=_0x2e58b7;if(_0x3a787a['query']['includeAll']){_0x501c78[_0x4020('0x3b')]=[{'all':!![]}];}return db[_0x4020('0x3a')][_0x4020('0x3c')](_0x501c78);})[_0x4020('0x24')](function(_0x337a27){_0x2988f8[_0x4020('0x3d')]=_0x337a27;return _0x2988f8;})['then'](respondWithFilteredResult(_0x5b29a8,_0x501c78))[_0x4020('0x3e')](handleError(_0x5b29a8,null));};exports[_0x4020('0x3f')]=function(_0x2dee7a,_0x5e3431){var _0x38fb5c={'raw':!![],'where':{'id':_0x2dee7a[_0x4020('0x40')]['id']}},_0x5bcad5={};_0x5bcad5[_0x4020('0x30')]=_[_0x4020('0x2e')](db['SmsApplication'][_0x4020('0x2a')]);_0x5bcad5[_0x4020('0x2d')]=_[_0x4020('0x2e')](_0x2dee7a[_0x4020('0x2d')]);_0x5bcad5[_0x4020('0x41')]=_[_0x4020('0x2f')](_0x5bcad5[_0x4020('0x30')],_0x5bcad5[_0x4020('0x2d')]);_0x38fb5c[_0x4020('0x31')]=_['intersection'](_0x5bcad5[_0x4020('0x30')],qs[_0x4020('0x32')](_0x2dee7a[_0x4020('0x2d')][_0x4020('0x32')]));_0x38fb5c['attributes']=_0x38fb5c[_0x4020('0x31')][_0x4020('0x42')]?_0x38fb5c[_0x4020('0x31')]:_0x5bcad5[_0x4020('0x30')];if(_0x2dee7a[_0x4020('0x2d')][_0x4020('0x43')]){_0x38fb5c['include']=[{'all':!![]}];}_0x38fb5c=_[_0x4020('0x44')]({},_0x38fb5c,_0x2dee7a['options']);return db[_0x4020('0x3a')]['find'](_0x38fb5c)['then'](handleEntityNotFound(_0x5e3431,null))[_0x4020('0x24')](respondWithResult(_0x5e3431,null))['catch'](handleError(_0x5e3431,null));};exports[_0x4020('0x45')]=function(_0x3a2102,_0x588e38){return db['SmsApplication'][_0x4020('0x45')](_0x3a2102['body'],{})[_0x4020('0x24')](respondWithResult(_0x588e38,0xc9))['catch'](handleError(_0x588e38,null));};exports[_0x4020('0x46')]=function(_0x142100,_0x2a22a1){if(_0x142100[_0x4020('0x47')]['id']){delete _0x142100[_0x4020('0x47')]['id'];}return db['SmsApplication'][_0x4020('0x48')]({'where':{'id':_0x142100[_0x4020('0x40')]['id']}})[_0x4020('0x24')](handleEntityNotFound(_0x2a22a1,null))[_0x4020('0x24')](saveUpdates(_0x142100[_0x4020('0x47')],null))[_0x4020('0x24')](respondWithResult(_0x2a22a1,null))[_0x4020('0x3e')](handleError(_0x2a22a1,null));};exports[_0x4020('0x25')]=function(_0x4e0685,_0x2afa30){return db[_0x4020('0x3a')][_0x4020('0x48')]({'where':{'id':_0x4e0685[_0x4020('0x40')]['id']}})[_0x4020('0x24')](handleEntityNotFound(_0x2afa30,null))[_0x4020('0x24')](removeEntity(_0x2afa30,null))[_0x4020('0x3e')](handleError(_0x2afa30,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 0adb7d2..6e68a60 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 _0x2e9f=['bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x230078,_0x40e1b4){var _0x379ab7=function(_0x39675e){while(--_0x39675e){_0x230078['push'](_0x230078['shift']());}};_0x379ab7(++_0x40e1b4);}(_0x2e9f,0xc7));var _0xf2e9=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x2e9f[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xf2e9('0x0'));var util=require(_0xf2e9('0x1'));var logger=require(_0xf2e9('0x2'))(_0xf2e9('0x3'));var moment=require(_0xf2e9('0x4'));var BPromise=require(_0xf2e9('0x5'));var rp=require(_0xf2e9('0x6'));var fs=require('fs');var path=require(_0xf2e9('0x7'));var rimraf=require(_0xf2e9('0x8'));var config=require(_0xf2e9('0x9'));var attributes=require(_0xf2e9('0xa'));module[_0xf2e9('0xb')]=function(_0x581373,_0x51f86e){return _0x581373[_0xf2e9('0xc')](_0xf2e9('0xd'),attributes,{'tableName':_0xf2e9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf2e9('0xf'),'collate':_0xf2e9('0x10')});}; \ No newline at end of file +var _0x0704=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','exports','define','sms_applications'];(function(_0x13039d,_0x1e2cbe){var _0x2859dc=function(_0x31fe59){while(--_0x31fe59){_0x13039d['push'](_0x13039d['shift']());}};_0x2859dc(++_0x1e2cbe);}(_0x0704,0x1c2));var _0x4070=function(_0x3150ab,_0x2bc06e){_0x3150ab=_0x3150ab-0x0;var _0x244414=_0x0704[_0x3150ab];return _0x244414;};'use strict';var _=require(_0x4070('0x0'));var util=require('util');var logger=require(_0x4070('0x1'))(_0x4070('0x2'));var moment=require(_0x4070('0x3'));var BPromise=require(_0x4070('0x4'));var rp=require(_0x4070('0x5'));var fs=require('fs');var path=require(_0x4070('0x6'));var rimraf=require(_0x4070('0x7'));var config=require('../../config/environment');var attributes=require(_0x4070('0x8'));module[_0x4070('0x9')]=function(_0x2b3e13,_0x1d3af2){return _0x2b3e13[_0x4070('0xa')]('SmsApplication',attributes,{'tableName':_0x4070('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4070('0xc'),'collate':_0x4070('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index dacb79c..7b8e402 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 _0x2b29=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x2b29,0x163));var _0x92b2=function(_0x4f7f2f,_0x48b7d6){_0x4f7f2f=_0x4f7f2f-0x0;var _0x1ba18d=_0x2b29[_0x4f7f2f];return _0x1ba18d;};'use strict';var _=require('lodash');var util=require(_0x92b2('0x0'));var moment=require(_0x92b2('0x1'));var BPromise=require(_0x92b2('0x2'));var rs=require(_0x92b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92b2('0x4'))['db'];var utils=require(_0x92b2('0x5'));var logger=require(_0x92b2('0x6'))(_0x92b2('0x7'));var config=require(_0x92b2('0x8'));var jayson=require(_0x92b2('0x9'));var client=jayson['client'][_0x92b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x536e21,_0x29f183,_0x43a292){return new BPromise(function(_0x5c1d94,_0x3e2204){return client[_0x92b2('0xb')](_0x536e21,_0x43a292)[_0x92b2('0xc')](function(_0x465011){logger['info'](_0x92b2('0xd'),_0x29f183,_0x92b2('0xe'));logger[_0x92b2('0xf')](_0x92b2('0x10'),_0x29f183,_0x92b2('0xe'),JSON[_0x92b2('0x11')](_0x465011));if(_0x465011[_0x92b2('0x12')]){if(_0x465011['error'][_0x92b2('0x13')]===0x1f4){logger[_0x92b2('0x12')](_0x92b2('0xd'),_0x29f183,_0x465011['error'][_0x92b2('0x14')]);return _0x3e2204(_0x465011[_0x92b2('0x12')][_0x92b2('0x14')]);}logger[_0x92b2('0x12')](_0x92b2('0xd'),_0x29f183,_0x465011[_0x92b2('0x12')]['message']);return _0x5c1d94(_0x465011[_0x92b2('0x12')]['message']);}else{logger[_0x92b2('0x15')](_0x92b2('0xd'),_0x29f183,_0x92b2('0xe'));_0x5c1d94(_0x465011['result']['message']);}})[_0x92b2('0x16')](function(_0x5a2912){logger[_0x92b2('0x12')]('SmsApplication,\x20%s,\x20%s',_0x29f183,_0x5a2912);_0x3e2204(_0x5a2912);});});} \ No newline at end of file +var _0x8b0e=['client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0x8b0e,0x166));var _0xe8b0=function(_0x26299e,_0x394ad1){_0x26299e=_0x26299e-0x0;var _0x6c4f4a=_0x8b0e[_0x26299e];return _0x6c4f4a;};'use strict';var _=require(_0xe8b0('0x0'));var util=require(_0xe8b0('0x1'));var moment=require(_0xe8b0('0x2'));var BPromise=require(_0xe8b0('0x3'));var rs=require(_0xe8b0('0x4'));var fs=require('fs');var Redis=require(_0xe8b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe8b0('0x6'));var logger=require('../../config/logger')(_0xe8b0('0x7'));var config=require(_0xe8b0('0x8'));var jayson=require(_0xe8b0('0x9'));var client=jayson[_0xe8b0('0xa')][_0xe8b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35fe3d,_0x25faf7,_0x2e56f4){return new BPromise(function(_0x59f3a4,_0x103966){return client[_0xe8b0('0xc')](_0x35fe3d,_0x2e56f4)[_0xe8b0('0xd')](function(_0x82589f){logger[_0xe8b0('0xe')](_0xe8b0('0xf'),_0x25faf7,_0xe8b0('0x10'));logger[_0xe8b0('0x11')](_0xe8b0('0x12'),_0x25faf7,'request\x20sent',JSON['stringify'](_0x82589f));if(_0x82589f[_0xe8b0('0x13')]){if(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x14')]===0x1f4){logger['error'](_0xe8b0('0xf'),_0x25faf7,_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);return _0x103966(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);}logger[_0xe8b0('0x13')](_0xe8b0('0xf'),_0x25faf7,_0x82589f['error'][_0xe8b0('0x15')]);return _0x59f3a4(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);}else{logger['info'](_0xe8b0('0xf'),_0x25faf7,'request\x20sent');_0x59f3a4(_0x82589f['result']['message']);}})[_0xe8b0('0x16')](function(_0x3818a7){logger['error'](_0xe8b0('0xf'),_0x25faf7,_0x3818a7);_0x103966(_0x3818a7);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 6672602..dd307bc 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 _0x4fc2=['removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy'];(function(_0x121be0,_0x563c36){var _0x3d965a=function(_0x1c526d){while(--_0x1c526d){_0x121be0['push'](_0x121be0['shift']());}};_0x3d965a(++_0x563c36);}(_0x4fc2,0x111));var _0x24fc=function(_0x4445a9,_0x4d7cc8){_0x4445a9=_0x4445a9-0x0;var _0x18d7f8=_0x4fc2[_0x4445a9];return _0x18d7f8;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['show']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['post']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x13')]);router['post'](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0x16'),auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x18')),controller[_0x24fc('0x19')]);router[_0x24fc('0x1a')]('/:id',auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x1b')),controller[_0x24fc('0x1c')]);router[_0x24fc('0x1d')](_0x24fc('0xe'),auth['isAuthenticated'](),interaction[_0x24fc('0x1e')](_0x24fc('0x17'),_0x24fc('0x1f')),controller[_0x24fc('0x20')]);router['delete'](_0x24fc('0x16'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x21')]);module['exports']=router; \ No newline at end of file +var _0x4483=['isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','addTags','put','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4483,0x1a3));var _0x3448=function(_0x3bcd67,_0x2cdd6b){_0x3bcd67=_0x3bcd67-0x0;var _0x1013d6=_0x4483[_0x3bcd67];return _0x1013d6;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3448('0x13')](_0x3448('0xf'),auth['isAuthenticated'](),controller[_0x3448('0x14')]);router[_0x3448('0x13')](_0x3448('0x15'),auth['isAuthenticated'](),interaction[_0x3448('0x16')](_0x3448('0x17'),'smsinteraction:addtags'),controller[_0x3448('0x18')]);router[_0x3448('0x19')](_0x3448('0x1a'),auth['isAuthenticated'](),interaction[_0x3448('0x16')](_0x3448('0x17'),_0x3448('0x1b')),controller[_0x3448('0x1c')]);router[_0x3448('0x1d')](_0x3448('0x1a'),auth[_0x3448('0xa')](),interaction[_0x3448('0x16')]('sms',_0x3448('0x1e')),controller['destroy']);router['delete']('/:id/tags',auth[_0x3448('0xa')](),controller[_0x3448('0x1f')]);module[_0x3448('0x20')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 835a0d1..80c99bf 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 _0xd448=['exports','BOOLEAN','DATE','STRING','out','INTEGER','moment'];(function(_0x546895,_0xb414da){var _0x3b5a09=function(_0x1da01c){while(--_0x1da01c){_0x546895['push'](_0x546895['shift']());}};_0x3b5a09(++_0xb414da);}(_0xd448,0x172));var _0x8d44=function(_0x52b701,_0x435f59){_0x52b701=_0x52b701-0x0;var _0x39387c=_0xd448[_0x52b701];return _0x39387c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8d44('0x0'));module[_0x8d44('0x1')]={'closed':{'type':Sequelize[_0x8d44('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8d44('0x3')]},'disposition':{'type':Sequelize[_0x8d44('0x4')]},'secondDisposition':{'type':Sequelize[_0x8d44('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8d44('0x4')]},'note':{'type':Sequelize[_0x8d44('0x4')]},'phone':{'type':Sequelize[_0x8d44('0x4')]},'read1stAt':{'type':Sequelize[_0x8d44('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8d44('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8d44('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8d44('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8d44('0x6')]}}; \ No newline at end of file +var _0x5eef=['exports','DATE','STRING','ENUM','out','INTEGER'];(function(_0xfd681f,_0x71607d){var _0x3c0940=function(_0x58dd3e){while(--_0x58dd3e){_0xfd681f['push'](_0xfd681f['shift']());}};_0x3c0940(++_0x71607d);}(_0x5eef,0x9c));var _0xf5ee=function(_0x5307a7,_0x279f1b){_0x5307a7=_0x5307a7-0x0;var _0x5812ab=_0x5eef[_0x5307a7];return _0x5812ab;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xf5ee('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf5ee('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf5ee('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf5ee('0x2')]},'note':{'type':Sequelize[_0xf5ee('0x2')]},'phone':{'type':Sequelize[_0xf5ee('0x2')]},'read1stAt':{'type':Sequelize[_0xf5ee('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf5ee('0x3')]('in',_0xf5ee('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf5ee('0x5')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 1b5a7a9..7111af9 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 _0x58eb=['err','unlinkSync','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','sms','query','user','params','model','keys','attributes','intersection','fields','includeAll','merge','options','catch','create','body','destroy','describe','addMessage','SmsMessage','find','ids','omit','getMessages','findOne','filters','length','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','format','transcript-%d-%s.zip','push','User','CmContact','lastName','createdAt','secret','read','SmsAccount','Owner','fullname','get','mkdirSync','Sms','N.A.','closedAt','disposition','Messages','map','direction','out','firstName','Contact','value','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML'];(function(_0x23d627,_0x4eb910){var _0x5bde54=function(_0x3f36b5){while(--_0x3f36b5){_0x23d627['push'](_0x23d627['shift']());}};_0x5bde54(++_0x4eb910);}(_0x58eb,0x15e));var _0xb58e=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x58eb[_0x2aec52];return _0x3b8835;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xb58e('0x0'));var moment=require('moment');var BPromise=require(_0xb58e('0x1'));var util=require(_0xb58e('0x2'));var path=require(_0xb58e('0x3'));var ejs=require(_0xb58e('0x4'));var fs=require('fs');var _=require(_0xb58e('0x5'));var Redis=require(_0xb58e('0x6'));var interaction=require(_0xb58e('0x7'));var qs=require(_0xb58e('0x8'));var pdf=require(_0xb58e('0x9'));var logger=require(_0xb58e('0xa'))('api');var config=require(_0xb58e('0xb'));var db=require(_0xb58e('0xc'))['db'];config['redis']=_['defaults'](config[_0xb58e('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xb58e('0xe'))(new Redis(config[_0xb58e('0xd')]));require(_0xb58e('0xf'))[_0xb58e('0x10')](socket);function respondWithStatusCode(_0x2278f4,_0x50a4e3){_0x50a4e3=_0x50a4e3||0xcc;return function(_0x7ebf0b){if(_0x7ebf0b){return _0x2278f4[_0xb58e('0x11')](_0x50a4e3);}return _0x2278f4[_0xb58e('0x12')](_0x50a4e3)[_0xb58e('0x13')]();};}function respondWithResult(_0x24ac0e,_0x178fff){_0x178fff=_0x178fff||0xc8;return function(_0x25533e){if(_0x25533e){return _0x24ac0e['status'](_0x178fff)[_0xb58e('0x14')](_0x25533e);}};}function respondWithFilteredResult(_0x4e1949,_0x363283){return function(_0x4a0c13){if(_0x4a0c13){var _0x3edab1=typeof _0x363283[_0xb58e('0x15')]===_0xb58e('0x16')&&typeof _0x363283[_0xb58e('0x17')]===_0xb58e('0x16');var _0xde5f61=_0x4a0c13[_0xb58e('0x18')];var _0x3b26bb=_0x3edab1?0x0:_0x363283[_0xb58e('0x15')];var _0x3aa75c=_0x3edab1?_0x4a0c13[_0xb58e('0x18')]:_0x363283[_0xb58e('0x15')]+_0x363283[_0xb58e('0x17')];var _0x59cd7e;if(_0x3aa75c>=_0xde5f61){_0x3aa75c=_0xde5f61;_0x59cd7e=0xc8;}else{_0x59cd7e=0xce;}_0x4e1949['status'](_0x59cd7e);return _0x4e1949['set'](_0xb58e('0x19'),_0x3b26bb+'-'+_0x3aa75c+'/'+_0xde5f61)[_0xb58e('0x14')](_0x4a0c13);}return null;};}function saveUpdates(_0x4bd354){return function(_0x3382ac){if(_0x3382ac){return _0x3382ac[_0xb58e('0x1a')](_0x4bd354)['then'](function(_0x399328){return _0x399328;});}return null;};}function removeEntity(_0x2b7214){return function(_0x58884){if(_0x58884){return _0x58884['destroy']()[_0xb58e('0x1b')](function(){_0x2b7214[_0xb58e('0x12')](0xcc)[_0xb58e('0x13')]();});}};}function handleEntityNotFound(_0x5f4def){return function(_0x4e5d93){if(!_0x4e5d93){_0x5f4def[_0xb58e('0x11')](0x194);}return _0x4e5d93;};}function handleError(_0x5ad9f4,_0x179638){_0x179638=_0x179638||0x1f4;return function(_0x5c8e37){logger['error'](_0x5c8e37[_0xb58e('0x1c')]);if(_0x5c8e37['name']){delete _0x5c8e37[_0xb58e('0x1d')];}_0x5ad9f4['status'](_0x179638)[_0xb58e('0x1e')](_0x5c8e37);};}exports[_0xb58e('0x1f')]=function(_0x119207,_0x53e5e8){var _0x406313={};var _0xbc70a1=_['map'](db[_0xb58e('0x20')][_0xb58e('0x21')],function(_0x56f62d){return{'name':_0x56f62d[_0xb58e('0x22')],'type':_0x56f62d[_0xb58e('0x23')]['key']};});_0x406313=qs[_0xb58e('0x24')](_0xbc70a1,_0x119207);return interaction[_0xb58e('0x25')](_0xb58e('0x26'),_0x119207[_0xb58e('0x27')],_0x119207[_0xb58e('0x28')],_0x406313,_0xbc70a1)['then'](respondWithFilteredResult(_0x53e5e8,_0x406313))['catch'](handleError(_0x53e5e8,null));};exports['show']=function(_0x3cccb5,_0x43a239){var _0x394c9a={'raw':![],'where':{'id':_0x3cccb5[_0xb58e('0x29')]['id']}},_0x73bc9d={};_0x73bc9d[_0xb58e('0x2a')]=_['keys'](db[_0xb58e('0x20')][_0xb58e('0x21')]);_0x73bc9d[_0xb58e('0x27')]=_[_0xb58e('0x2b')](_0x3cccb5[_0xb58e('0x27')]);_0x73bc9d['filters']=_['intersection'](_0x73bc9d[_0xb58e('0x2a')],_0x73bc9d[_0xb58e('0x27')]);_0x394c9a[_0xb58e('0x2c')]=_[_0xb58e('0x2d')](_0x73bc9d[_0xb58e('0x2a')],qs['fields'](_0x3cccb5[_0xb58e('0x27')][_0xb58e('0x2e')]));_0x394c9a[_0xb58e('0x2c')]=_0x394c9a[_0xb58e('0x2c')]['length']?_0x394c9a[_0xb58e('0x2c')]:_0x73bc9d['model'];if(_0x3cccb5[_0xb58e('0x27')][_0xb58e('0x2f')]){_0x394c9a['include']=[{'all':!![]}];}_0x394c9a=_[_0xb58e('0x30')]({},_0x394c9a,_0x3cccb5[_0xb58e('0x31')]);return db[_0xb58e('0x20')]['find'](_0x394c9a)['then'](handleEntityNotFound(_0x43a239,null))[_0xb58e('0x1b')](respondWithResult(_0x43a239,null))[_0xb58e('0x32')](handleError(_0x43a239,null));};exports[_0xb58e('0x33')]=function(_0x15d44c,_0x1c3e71){return db[_0xb58e('0x20')][_0xb58e('0x33')](_0x15d44c[_0xb58e('0x34')],{})[_0xb58e('0x1b')](respondWithResult(_0x1c3e71,0xc9))[_0xb58e('0x32')](handleError(_0x1c3e71,null));};exports['update']=function(_0x223e8b,_0x1f2c38){if(_0x223e8b[_0xb58e('0x34')]['id']){delete _0x223e8b[_0xb58e('0x34')]['id'];}return db[_0xb58e('0x20')]['find']({'where':{'id':_0x223e8b[_0xb58e('0x29')]['id']}})[_0xb58e('0x1b')](handleEntityNotFound(_0x1f2c38,null))[_0xb58e('0x1b')](saveUpdates(_0x223e8b[_0xb58e('0x34')],null))[_0xb58e('0x1b')](respondWithResult(_0x1f2c38,null))[_0xb58e('0x32')](handleError(_0x1f2c38,null));};exports[_0xb58e('0x35')]=function(_0x50f17a,_0x27dace){return db['SmsInteraction']['find']({'where':{'id':_0x50f17a['params']['id']}})[_0xb58e('0x1b')](handleEntityNotFound(_0x27dace,null))[_0xb58e('0x1b')](removeEntity(_0x27dace,null))[_0xb58e('0x32')](handleError(_0x27dace,null));};exports[_0xb58e('0x36')]=function(_0x11809b,_0x4165cd){return db[_0xb58e('0x20')][_0xb58e('0x36')]()[_0xb58e('0x1b')](respondWithResult(_0x4165cd,null))[_0xb58e('0x32')](handleError(_0x4165cd,null));};exports[_0xb58e('0x37')]=function(_0x477079,_0x1c9347){return db[_0xb58e('0x38')][_0xb58e('0x39')]({'where':{'id':_0x477079[_0xb58e('0x29')]['id']}})['then'](handleEntityNotFound(_0x1c9347,null))[_0xb58e('0x1b')](function(_0x403bb9){if(_0x403bb9){return _0x403bb9[_0xb58e('0x37')](_0x477079[_0xb58e('0x34')][_0xb58e('0x3a')],_[_0xb58e('0x3b')](_0x477079[_0xb58e('0x34')],[_0xb58e('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x1c9347,null))[_0xb58e('0x32')](handleError(_0x1c9347,null));};exports[_0xb58e('0x3c')]=function(_0x162857,_0x3dd110){var _0xea6b7f={'raw':![],'where':{}};var _0x3ad68d={};var _0x5ebad2={'count':0x0,'rows':[]};return db[_0xb58e('0x20')][_0xb58e('0x3d')]({'where':{'id':_0x162857['params']['id']}})[_0xb58e('0x1b')](handleEntityNotFound(_0x3dd110,null))['then'](function(_0x51de82){if(_0x51de82){_0x3ad68d[_0xb58e('0x2a')]=_[_0xb58e('0x2b')](db[_0xb58e('0x38')][_0xb58e('0x21')]);_0x3ad68d[_0xb58e('0x27')]=_[_0xb58e('0x2b')](_0x162857[_0xb58e('0x27')]);_0x3ad68d[_0xb58e('0x3e')]=_[_0xb58e('0x2d')](_0x3ad68d[_0xb58e('0x2a')],_0x3ad68d['query']);_0xea6b7f['attributes']=_[_0xb58e('0x2d')](_0x3ad68d[_0xb58e('0x2a')],qs[_0xb58e('0x2e')](_0x162857[_0xb58e('0x27')][_0xb58e('0x2e')]));_0xea6b7f[_0xb58e('0x2c')]=_0xea6b7f[_0xb58e('0x2c')][_0xb58e('0x3f')]?_0xea6b7f[_0xb58e('0x2c')]:_0x3ad68d[_0xb58e('0x2a')];if(!_0x162857[_0xb58e('0x27')]['hasOwnProperty'](_0xb58e('0x40'))){_0xea6b7f[_0xb58e('0x17')]=qs['limit'](_0x162857[_0xb58e('0x27')][_0xb58e('0x17')]);_0xea6b7f[_0xb58e('0x15')]=qs[_0xb58e('0x15')](_0x162857[_0xb58e('0x27')]['offset']);}_0xea6b7f[_0xb58e('0x41')]=qs[_0xb58e('0x42')](_0x162857[_0xb58e('0x27')]['sort']);_0xea6b7f[_0xb58e('0x43')]=qs[_0xb58e('0x3e')](_[_0xb58e('0x44')](_0x162857['query'],_0x3ad68d['filters']));_0xea6b7f[_0xb58e('0x43')][_0xb58e('0x45')]=_0x51de82['id'];if(_0x162857[_0xb58e('0x27')][_0xb58e('0x46')]){_0xea6b7f['where']=_[_0xb58e('0x30')](_0xea6b7f[_0xb58e('0x43')],{'$or':_['map'](_0xea6b7f['attributes'],function(_0x44ecc6){var _0x5b0879={};_0x5b0879[_0x44ecc6]={'$like':'%'+_0x162857['query']['filter']+'%'};return _0x5b0879;})});}if(_0x162857[_0xb58e('0x27')][_0xb58e('0x47')]){var _0x121db6=_0x162857[_0xb58e('0x27')][_0xb58e('0x47')]['split'](',');var _0x2c035a={};_0x2c035a[_0x121db6[0x0]]={'$gte':moment(_0x121db6[0x1])['format'](_0xb58e('0x48'))};_0xea6b7f[_0xb58e('0x43')]=_[_0xb58e('0x30')](_0xea6b7f['where'],_0x2c035a);}_0xea6b7f=_[_0xb58e('0x30')]({},_0xea6b7f,_0x162857[_0xb58e('0x31')]);return db[_0xb58e('0x38')][_0xb58e('0x18')]({'where':_0xea6b7f[_0xb58e('0x43')]})[_0xb58e('0x1b')](function(_0x2bb7e1){_0x5ebad2['count']=_0x2bb7e1;if(_0x162857['query']['includeAll']){_0xea6b7f['include']=[{'all':!![]}];}return db[_0xb58e('0x38')]['findAll'](_0xea6b7f);})['then'](function(_0xebfb16){_0x5ebad2['rows']=_0xebfb16;return _0x5ebad2;});}})[_0xb58e('0x1b')](respondWithFilteredResult(_0x3dd110,_0xea6b7f))[_0xb58e('0x32')](handleError(_0x3dd110,null));};exports['addTags']=function(_0x2a6446,_0x42cb86){return db[_0xb58e('0x20')]['find']({'where':{'id':_0x2a6446[_0xb58e('0x29')]['id']}})[_0xb58e('0x1b')](handleEntityNotFound(_0x42cb86,null))[_0xb58e('0x1b')](function(_0x1b0925){if(_0x1b0925){return _0x1b0925['setTags'](_0x2a6446[_0xb58e('0x34')][_0xb58e('0x3a')],_['omit'](_0x2a6446[_0xb58e('0x34')],[_0xb58e('0x3a'),'id'])||{})['spread'](function(){return db[_0xb58e('0x49')][_0xb58e('0x25')]({'attributes':['id',_0xb58e('0x1d'),_0xb58e('0x4a')],'where':{'id':_0x2a6446[_0xb58e('0x34')]['ids']}});})['then'](function(_0x2ebd36){socket[_0xb58e('0x4b')](_0xb58e('0x4c'),{'id':Number(_0x2a6446[_0xb58e('0x29')]['id']),'tags':_0x2ebd36||[]});return{'id':Number(_0x2a6446[_0xb58e('0x29')]['id']),'tags':_0x2ebd36||[]};});}})[_0xb58e('0x1b')](respondWithResult(_0x42cb86,null))[_0xb58e('0x32')](handleError(_0x42cb86,null));};exports['removeTags']=function(_0x155ac0,_0x4195b2){return db[_0xb58e('0x20')][_0xb58e('0x39')]({'where':{'id':_0x155ac0['params']['id']}})[_0xb58e('0x1b')](handleEntityNotFound(_0x4195b2,null))[_0xb58e('0x1b')](function(_0x39e027){if(_0x39e027){return _0x39e027[_0xb58e('0x4d')](_0x155ac0[_0xb58e('0x27')][_0xb58e('0x3a')]);}})[_0xb58e('0x1b')](respondWithStatusCode(_0x4195b2,null))[_0xb58e('0x32')](handleError(_0x4195b2,null));};exports[_0xb58e('0x4e')]=function(_0x5993c0,_0xfb7bd4){var _0x2cde04=moment()[_0xb58e('0x4f')]()[_0xb58e('0x50')]();var _0x318a93=path[_0xb58e('0x51')](config[_0xb58e('0x52')],_0xb58e('0x53'),_0xb58e('0x54'),'tmp');var _0x54db15=path[_0xb58e('0x51')](_0x318a93,_0x2cde04);var _0x272846=util[_0xb58e('0x55')](_0xb58e('0x56'),_0x5993c0[_0xb58e('0x29')]['id'],_0x2cde04);var _0x4be764=path['join'](_0x318a93,_0x272846);var _0x1306ce=[];_0x1306ce[_0xb58e('0x57')]({'model':db['User'],'as':_0xb58e('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x1306ce[_0xb58e('0x57')]({'model':db[_0xb58e('0x59')],'as':'Contact','attributes':['id','firstName',_0xb58e('0x5a')],'raw':!![]});var _0x4bd50f=[{'model':db[_0xb58e('0x38')],'as':'Messages','attributes':['id',_0xb58e('0x34'),_0xb58e('0x5b'),'direction',_0xb58e('0x5c'),_0xb58e('0x5d')],'include':_0x1306ce}];_0x4bd50f[_0xb58e('0x57')]({'model':db[_0xb58e('0x5e')],'as':'Account','attributes':['id',_0xb58e('0x1d')]});_0x4bd50f[_0xb58e('0x57')]({'model':db[_0xb58e('0x58')],'as':_0xb58e('0x5f'),'attributes':['id',_0xb58e('0x60')]});return db['SmsInteraction'][_0xb58e('0x39')]({'where':{'id':_0x5993c0['params']['id']},'include':_0x4bd50f})[_0xb58e('0x1b')](handleEntityNotFound(_0xfb7bd4,null))[_0xb58e('0x1b')](function(_0x2f9997){if(_0x2f9997){var _0x5deed4=_0x2f9997[_0xb58e('0x61')]({'plain':!![]});fs[_0xb58e('0x62')](_0x54db15);var _0x45b22c={'channel':_0xb58e('0x63'),'account':_0x5deed4['Account'][_0xb58e('0x1d')],'agent':_0x5deed4[_0xb58e('0x5f')]?_0x5deed4[_0xb58e('0x5f')][_0xb58e('0x60')]:_0xb58e('0x64'),'createdAt':moment(_0x5deed4[_0xb58e('0x5b')])[_0xb58e('0x55')](_0xb58e('0x48'))[_0xb58e('0x50')](),'closedAt':_0x5deed4['closed']?moment(_0x5deed4[_0xb58e('0x65')])['format'](_0xb58e('0x48'))[_0xb58e('0x50')]():'','disposition':_0x5deed4[_0xb58e('0x66')],'messages':_(_0x5deed4[_0xb58e('0x67')])[_0xb58e('0x46')]({'secret':![]})[_0xb58e('0x68')](function(_0x548d6b){return{'date':moment(_0x548d6b[_0xb58e('0x5b')])[_0xb58e('0x55')](_0xb58e('0x48'))['toString'](),'sender':_0x548d6b[_0xb58e('0x69')]===_0xb58e('0x6a')?_0x548d6b[_0xb58e('0x58')]?_0x548d6b[_0xb58e('0x58')][_0xb58e('0x60')]:'System':_0x548d6b['Contact'][_0xb58e('0x6b')]+(_0x548d6b[_0xb58e('0x6c')]['lastName']?'\x20'+_0x548d6b['Contact']['lastName']:''),'body':_0x548d6b[_0xb58e('0x34')],'direction':_0x548d6b[_0xb58e('0x69')]==='out'?'A':'C','secret':_0x548d6b[_0xb58e('0x5c')],'read':_0x548d6b[_0xb58e('0x5d')]};})[_0xb58e('0x6d')]()};return ejs['renderFile'](path['join'](config[_0xb58e('0x52')],_0xb58e('0x53'),'views',_0xb58e('0x6e')),{'interaction':_0x45b22c})[_0xb58e('0x1b')](function(_0x433b58){var _0x37f07b=path['join'](_0x54db15,_0xb58e('0x6f')+_0x5deed4['id']+'-'+_0x2cde04+_0xb58e('0x70'));var _0x100f38={'path':_0x37f07b,'channel':_0xb58e('0x63'),'interactionId':_0x5deed4['id']};return pdf[_0xb58e('0x71')](_0x433b58,_0x100f38);})['then'](function(){return new BPromise(function(_0x2ef423,_0x5b519c){zipdir(_0x54db15,{'saveTo':_0x4be764},function(_0x4fbe7d,_0x1495c3){if(_0x4fbe7d)return _0x5b519c(_0x4fbe7d);return _0x2ef423(_0x1495c3);});})[_0xb58e('0x1b')](function(){return new BPromise(function(_0x5cc6e9,_0x50baf0){rimraf(_0x54db15,function(_0x5479ee){if(_0x5479ee)_0x50baf0(_0x5479ee);return _0x5cc6e9();});});})[_0xb58e('0x1b')](function(){return _0xfb7bd4[_0xb58e('0x4e')](_0x4be764,_0x272846,function(_0x73bb4d){if(_0x73bb4d){console['log'](_0xb58e('0x72'),_0x73bb4d);}else{fs[_0xb58e('0x73')](_0x4be764);}});});});}else{return _0xfb7bd4['sendStatus'](0xc8);}})[_0xb58e('0x32')](handleError(_0xfb7bd4,null));}; \ No newline at end of file +var _0xf9d1=['addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','read','Account','Owner','get','mkdirSync','Sms','N.A.','toString','closed','closedAt','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','moment','bluebird','util','path','ejs','lodash','../../components/export/pdf','../../config/logger','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','end','stack','name','index','map','rawAttributes','fieldName','type','key','findAll','sms','query','then','catch','show','params','model','keys','SmsInteraction','filters','intersection','attributes','fields','includeAll','include','options','find','create','body','update','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','hasOwnProperty','order','sort','where','pick','SmsInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1b1572,_0x3766be){var _0x431f37=function(_0x5272ab){while(--_0x5272ab){_0x1b1572['push'](_0x1b1572['shift']());}};_0x431f37(++_0x3766be);}(_0xf9d1,0xa2));var _0x1f9d=function(_0x195b73,_0x4ed6f3){_0x195b73=_0x195b73-0x0;var _0x5f1c59=_0xf9d1[_0x195b73];return _0x5f1c59;};'use strict';var rimraf=require(_0x1f9d('0x0'));var zipdir=require('zip-dir');var moment=require(_0x1f9d('0x1'));var BPromise=require(_0x1f9d('0x2'));var util=require(_0x1f9d('0x3'));var path=require(_0x1f9d('0x4'));var ejs=require(_0x1f9d('0x5'));var fs=require('fs');var _=require(_0x1f9d('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x1f9d('0x7'));var logger=require(_0x1f9d('0x8'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1f9d('0x9')]=_[_0x1f9d('0xa')](config['redis'],{'host':_0x1f9d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1f9d('0x9')]));require(_0x1f9d('0xc'))[_0x1f9d('0xd')](socket);function respondWithStatusCode(_0x3abbdd,_0x36e389){_0x36e389=_0x36e389||0xcc;return function(_0x317bf3){if(_0x317bf3){return _0x3abbdd[_0x1f9d('0xe')](_0x36e389);}return _0x3abbdd[_0x1f9d('0xf')](_0x36e389)['end']();};}function respondWithResult(_0x47c97b,_0x2ee75a){_0x2ee75a=_0x2ee75a||0xc8;return function(_0x12813f){if(_0x12813f){return _0x47c97b[_0x1f9d('0xf')](_0x2ee75a)[_0x1f9d('0x10')](_0x12813f);}};}function respondWithFilteredResult(_0x3f55ee,_0x2ed6ab){return function(_0x4f8f75){if(_0x4f8f75){var _0x2cf93a=typeof _0x2ed6ab[_0x1f9d('0x11')]===_0x1f9d('0x12')&&typeof _0x2ed6ab[_0x1f9d('0x13')]==='undefined';var _0x548836=_0x4f8f75[_0x1f9d('0x14')];var _0x32eaed=_0x2cf93a?0x0:_0x2ed6ab[_0x1f9d('0x11')];var _0x297604=_0x2cf93a?_0x4f8f75[_0x1f9d('0x14')]:_0x2ed6ab[_0x1f9d('0x11')]+_0x2ed6ab['limit'];var _0x353c71;if(_0x297604>=_0x548836){_0x297604=_0x548836;_0x353c71=0xc8;}else{_0x353c71=0xce;}_0x3f55ee[_0x1f9d('0xf')](_0x353c71);return _0x3f55ee[_0x1f9d('0x15')](_0x1f9d('0x16'),_0x32eaed+'-'+_0x297604+'/'+_0x548836)['json'](_0x4f8f75);}return null;};}function saveUpdates(_0x10f997){return function(_0xaa3476){if(_0xaa3476){return _0xaa3476['update'](_0x10f997)['then'](function(_0x2433bf){return _0x2433bf;});}return null;};}function removeEntity(_0x26e8bc){return function(_0x543c3e){if(_0x543c3e){return _0x543c3e['destroy']()['then'](function(){_0x26e8bc[_0x1f9d('0xf')](0xcc)[_0x1f9d('0x17')]();});}};}function handleEntityNotFound(_0xf178f7){return function(_0x5f153e){if(!_0x5f153e){_0xf178f7['sendStatus'](0x194);}return _0x5f153e;};}function handleError(_0x1676ee,_0x1b6507){_0x1b6507=_0x1b6507||0x1f4;return function(_0x12f713){logger['error'](_0x12f713[_0x1f9d('0x18')]);if(_0x12f713['name']){delete _0x12f713[_0x1f9d('0x19')];}_0x1676ee[_0x1f9d('0xf')](_0x1b6507)['send'](_0x12f713);};}exports[_0x1f9d('0x1a')]=function(_0x195b73,_0x6b1cd9){var _0x797d1b={};var _0x18a9e5=_[_0x1f9d('0x1b')](db['SmsInteraction'][_0x1f9d('0x1c')],function(_0x5e6412){return{'name':_0x5e6412[_0x1f9d('0x1d')],'type':_0x5e6412[_0x1f9d('0x1e')][_0x1f9d('0x1f')]};});_0x797d1b=qs['getOptions'](_0x18a9e5,_0x195b73);return interaction[_0x1f9d('0x20')](_0x1f9d('0x21'),_0x195b73[_0x1f9d('0x22')],_0x195b73['user'],_0x797d1b,_0x18a9e5)[_0x1f9d('0x23')](respondWithFilteredResult(_0x6b1cd9,_0x797d1b))[_0x1f9d('0x24')](handleError(_0x6b1cd9,null));};exports[_0x1f9d('0x25')]=function(_0x2433b9,_0x3521ef){var _0x33e85f={'raw':![],'where':{'id':_0x2433b9[_0x1f9d('0x26')]['id']}},_0x50fb8f={};_0x50fb8f[_0x1f9d('0x27')]=_[_0x1f9d('0x28')](db[_0x1f9d('0x29')][_0x1f9d('0x1c')]);_0x50fb8f[_0x1f9d('0x22')]=_[_0x1f9d('0x28')](_0x2433b9[_0x1f9d('0x22')]);_0x50fb8f[_0x1f9d('0x2a')]=_[_0x1f9d('0x2b')](_0x50fb8f[_0x1f9d('0x27')],_0x50fb8f[_0x1f9d('0x22')]);_0x33e85f[_0x1f9d('0x2c')]=_[_0x1f9d('0x2b')](_0x50fb8f[_0x1f9d('0x27')],qs[_0x1f9d('0x2d')](_0x2433b9[_0x1f9d('0x22')]['fields']));_0x33e85f['attributes']=_0x33e85f[_0x1f9d('0x2c')]['length']?_0x33e85f[_0x1f9d('0x2c')]:_0x50fb8f[_0x1f9d('0x27')];if(_0x2433b9[_0x1f9d('0x22')][_0x1f9d('0x2e')]){_0x33e85f[_0x1f9d('0x2f')]=[{'all':!![]}];}_0x33e85f=_['merge']({},_0x33e85f,_0x2433b9[_0x1f9d('0x30')]);return db[_0x1f9d('0x29')][_0x1f9d('0x31')](_0x33e85f)[_0x1f9d('0x23')](handleEntityNotFound(_0x3521ef,null))['then'](respondWithResult(_0x3521ef,null))['catch'](handleError(_0x3521ef,null));};exports['create']=function(_0x1fc7c3,_0x1ceda8){return db[_0x1f9d('0x29')][_0x1f9d('0x32')](_0x1fc7c3[_0x1f9d('0x33')],{})[_0x1f9d('0x23')](respondWithResult(_0x1ceda8,0xc9))[_0x1f9d('0x24')](handleError(_0x1ceda8,null));};exports[_0x1f9d('0x34')]=function(_0x199f25,_0x53b5cb){if(_0x199f25[_0x1f9d('0x33')]['id']){delete _0x199f25['body']['id'];}return db[_0x1f9d('0x29')][_0x1f9d('0x31')]({'where':{'id':_0x199f25['params']['id']}})['then'](handleEntityNotFound(_0x53b5cb,null))[_0x1f9d('0x23')](saveUpdates(_0x199f25[_0x1f9d('0x33')],null))['then'](respondWithResult(_0x53b5cb,null))['catch'](handleError(_0x53b5cb,null));};exports['destroy']=function(_0x3a3dcf,_0x6a6b17){return db[_0x1f9d('0x29')]['find']({'where':{'id':_0x3a3dcf[_0x1f9d('0x26')]['id']}})[_0x1f9d('0x23')](handleEntityNotFound(_0x6a6b17,null))['then'](removeEntity(_0x6a6b17,null))[_0x1f9d('0x24')](handleError(_0x6a6b17,null));};exports[_0x1f9d('0x35')]=function(_0x3ebeef,_0x2f184a){return db[_0x1f9d('0x29')][_0x1f9d('0x35')]()['then'](respondWithResult(_0x2f184a,null))[_0x1f9d('0x24')](handleError(_0x2f184a,null));};exports[_0x1f9d('0x36')]=function(_0xaa8053,_0x3d9708){return db[_0x1f9d('0x37')]['find']({'where':{'id':_0xaa8053['params']['id']}})[_0x1f9d('0x23')](handleEntityNotFound(_0x3d9708,null))[_0x1f9d('0x23')](function(_0x3ac0f7){if(_0x3ac0f7){return _0x3ac0f7[_0x1f9d('0x36')](_0xaa8053[_0x1f9d('0x33')][_0x1f9d('0x38')],_[_0x1f9d('0x39')](_0xaa8053[_0x1f9d('0x33')],[_0x1f9d('0x38'),'id'])||{});}})[_0x1f9d('0x23')](respondWithResult(_0x3d9708,null))['catch'](handleError(_0x3d9708,null));};exports[_0x1f9d('0x3a')]=function(_0x98322c,_0x2f6012){var _0x50d595={'raw':![],'where':{}};var _0x484153={};var _0x31d71e={'count':0x0,'rows':[]};return db[_0x1f9d('0x29')][_0x1f9d('0x3b')]({'where':{'id':_0x98322c[_0x1f9d('0x26')]['id']}})[_0x1f9d('0x23')](handleEntityNotFound(_0x2f6012,null))['then'](function(_0x33e7fd){if(_0x33e7fd){_0x484153[_0x1f9d('0x27')]=_[_0x1f9d('0x28')](db[_0x1f9d('0x37')][_0x1f9d('0x1c')]);_0x484153[_0x1f9d('0x22')]=_['keys'](_0x98322c[_0x1f9d('0x22')]);_0x484153[_0x1f9d('0x2a')]=_[_0x1f9d('0x2b')](_0x484153['model'],_0x484153[_0x1f9d('0x22')]);_0x50d595['attributes']=_['intersection'](_0x484153[_0x1f9d('0x27')],qs[_0x1f9d('0x2d')](_0x98322c[_0x1f9d('0x22')][_0x1f9d('0x2d')]));_0x50d595[_0x1f9d('0x2c')]=_0x50d595[_0x1f9d('0x2c')]['length']?_0x50d595[_0x1f9d('0x2c')]:_0x484153['model'];if(!_0x98322c['query'][_0x1f9d('0x3c')]('nolimit')){_0x50d595[_0x1f9d('0x13')]=qs[_0x1f9d('0x13')](_0x98322c[_0x1f9d('0x22')][_0x1f9d('0x13')]);_0x50d595[_0x1f9d('0x11')]=qs['offset'](_0x98322c[_0x1f9d('0x22')]['offset']);}_0x50d595[_0x1f9d('0x3d')]=qs[_0x1f9d('0x3e')](_0x98322c['query'][_0x1f9d('0x3e')]);_0x50d595[_0x1f9d('0x3f')]=qs['filters'](_[_0x1f9d('0x40')](_0x98322c[_0x1f9d('0x22')],_0x484153[_0x1f9d('0x2a')]));_0x50d595[_0x1f9d('0x3f')][_0x1f9d('0x41')]=_0x33e7fd['id'];if(_0x98322c['query'][_0x1f9d('0x42')]){_0x50d595[_0x1f9d('0x3f')]=_[_0x1f9d('0x43')](_0x50d595[_0x1f9d('0x3f')],{'$or':_[_0x1f9d('0x1b')](_0x50d595[_0x1f9d('0x2c')],function(_0x34f051){var _0x3a7401={};_0x3a7401[_0x34f051]={'$like':'%'+_0x98322c[_0x1f9d('0x22')][_0x1f9d('0x42')]+'%'};return _0x3a7401;})});}if(_0x98322c[_0x1f9d('0x22')][_0x1f9d('0x44')]){var _0xebfcd5=_0x98322c[_0x1f9d('0x22')]['$gte'][_0x1f9d('0x45')](',');var _0x51d820={};_0x51d820[_0xebfcd5[0x0]]={'$gte':moment(_0xebfcd5[0x1])[_0x1f9d('0x46')](_0x1f9d('0x47'))};_0x50d595[_0x1f9d('0x3f')]=_[_0x1f9d('0x43')](_0x50d595[_0x1f9d('0x3f')],_0x51d820);}_0x50d595=_['merge']({},_0x50d595,_0x98322c[_0x1f9d('0x30')]);return db[_0x1f9d('0x37')][_0x1f9d('0x14')]({'where':_0x50d595[_0x1f9d('0x3f')]})[_0x1f9d('0x23')](function(_0x2da08d){_0x31d71e[_0x1f9d('0x14')]=_0x2da08d;if(_0x98322c[_0x1f9d('0x22')][_0x1f9d('0x2e')]){_0x50d595[_0x1f9d('0x2f')]=[{'all':!![]}];}return db[_0x1f9d('0x37')][_0x1f9d('0x20')](_0x50d595);})['then'](function(_0x5c477b){_0x31d71e['rows']=_0x5c477b;return _0x31d71e;});}})['then'](respondWithFilteredResult(_0x2f6012,_0x50d595))[_0x1f9d('0x24')](handleError(_0x2f6012,null));};exports[_0x1f9d('0x48')]=function(_0x208239,_0x878235){return db['SmsInteraction']['find']({'where':{'id':_0x208239[_0x1f9d('0x26')]['id']}})[_0x1f9d('0x23')](handleEntityNotFound(_0x878235,null))[_0x1f9d('0x23')](function(_0x1c41cc){if(_0x1c41cc){return _0x1c41cc[_0x1f9d('0x49')](_0x208239[_0x1f9d('0x33')][_0x1f9d('0x38')],_[_0x1f9d('0x39')](_0x208239[_0x1f9d('0x33')],[_0x1f9d('0x38'),'id'])||{})[_0x1f9d('0x4a')](function(){return db[_0x1f9d('0x4b')][_0x1f9d('0x20')]({'attributes':['id','name',_0x1f9d('0x4c')],'where':{'id':_0x208239['body']['ids']}});})[_0x1f9d('0x23')](function(_0x43c9d9){socket[_0x1f9d('0x4d')]('smsInteractionTags:save',{'id':Number(_0x208239[_0x1f9d('0x26')]['id']),'tags':_0x43c9d9||[]});return{'id':Number(_0x208239[_0x1f9d('0x26')]['id']),'tags':_0x43c9d9||[]};});}})[_0x1f9d('0x23')](respondWithResult(_0x878235,null))['catch'](handleError(_0x878235,null));};exports['removeTags']=function(_0x51d070,_0x1ebc37){return db[_0x1f9d('0x29')][_0x1f9d('0x31')]({'where':{'id':_0x51d070['params']['id']}})['then'](handleEntityNotFound(_0x1ebc37,null))[_0x1f9d('0x23')](function(_0x34ee4a){if(_0x34ee4a){return _0x34ee4a[_0x1f9d('0x4e')](_0x51d070[_0x1f9d('0x22')][_0x1f9d('0x38')]);}})[_0x1f9d('0x23')](respondWithStatusCode(_0x1ebc37,null))[_0x1f9d('0x24')](handleError(_0x1ebc37,null));};exports[_0x1f9d('0x4f')]=function(_0x53e410,_0x52688b){var _0x5e6143=moment()[_0x1f9d('0x50')]()['toString']();var _0x5cca71=path[_0x1f9d('0x51')](config[_0x1f9d('0x52')],_0x1f9d('0x53'),_0x1f9d('0x54'),_0x1f9d('0x55'));var _0x3c0940=path['join'](_0x5cca71,_0x5e6143);var _0x18af21=util['format'](_0x1f9d('0x56'),_0x53e410[_0x1f9d('0x26')]['id'],_0x5e6143);var _0x37ce55=path['join'](_0x5cca71,_0x18af21);var _0x52b5f5=[];_0x52b5f5[_0x1f9d('0x57')]({'model':db[_0x1f9d('0x58')],'as':'User','attributes':['id',_0x1f9d('0x59')],'raw':!![]});_0x52b5f5[_0x1f9d('0x57')]({'model':db[_0x1f9d('0x5a')],'as':_0x1f9d('0x5b'),'attributes':['id',_0x1f9d('0x5c'),_0x1f9d('0x5d')],'raw':!![]});var _0xacfed=[{'model':db[_0x1f9d('0x37')],'as':_0x1f9d('0x5e'),'attributes':['id',_0x1f9d('0x33'),_0x1f9d('0x5f'),_0x1f9d('0x60'),'secret',_0x1f9d('0x61')],'include':_0x52b5f5}];_0xacfed[_0x1f9d('0x57')]({'model':db['SmsAccount'],'as':_0x1f9d('0x62'),'attributes':['id',_0x1f9d('0x19')]});_0xacfed[_0x1f9d('0x57')]({'model':db['User'],'as':_0x1f9d('0x63'),'attributes':['id',_0x1f9d('0x59')]});return db[_0x1f9d('0x29')][_0x1f9d('0x31')]({'where':{'id':_0x53e410[_0x1f9d('0x26')]['id']},'include':_0xacfed})[_0x1f9d('0x23')](handleEntityNotFound(_0x52688b,null))[_0x1f9d('0x23')](function(_0x398f6e){if(_0x398f6e){var _0xa83889=_0x398f6e[_0x1f9d('0x64')]({'plain':!![]});fs[_0x1f9d('0x65')](_0x3c0940);var _0x4b393f={'channel':_0x1f9d('0x66'),'account':_0xa83889['Account'][_0x1f9d('0x19')],'agent':_0xa83889[_0x1f9d('0x63')]?_0xa83889[_0x1f9d('0x63')][_0x1f9d('0x59')]:_0x1f9d('0x67'),'createdAt':moment(_0xa83889[_0x1f9d('0x5f')])[_0x1f9d('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1f9d('0x68')](),'closedAt':_0xa83889[_0x1f9d('0x69')]?moment(_0xa83889[_0x1f9d('0x6a')])['format'](_0x1f9d('0x47'))['toString']():'','disposition':_0xa83889['disposition'],'messages':_(_0xa83889['Messages'])[_0x1f9d('0x42')]({'secret':![]})['map'](function(_0xa5407a){return{'date':moment(_0xa5407a[_0x1f9d('0x5f')])[_0x1f9d('0x46')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1f9d('0x68')](),'sender':_0xa5407a['direction']===_0x1f9d('0x6b')?_0xa5407a['User']?_0xa5407a[_0x1f9d('0x58')][_0x1f9d('0x59')]:_0x1f9d('0x6c'):_0xa5407a['Contact'][_0x1f9d('0x5c')]+(_0xa5407a[_0x1f9d('0x5b')][_0x1f9d('0x5d')]?'\x20'+_0xa5407a[_0x1f9d('0x5b')][_0x1f9d('0x5d')]:''),'body':_0xa5407a[_0x1f9d('0x33')],'direction':_0xa5407a['direction']==='out'?'A':'C','secret':_0xa5407a['secret'],'read':_0xa5407a['read']};})['value']()};return ejs[_0x1f9d('0x6d')](path[_0x1f9d('0x51')](config[_0x1f9d('0x52')],_0x1f9d('0x53'),_0x1f9d('0x6e'),_0x1f9d('0x6f')),{'interaction':_0x4b393f})[_0x1f9d('0x23')](function(_0x5cd452){var _0x4a657b=path[_0x1f9d('0x51')](_0x3c0940,_0x1f9d('0x70')+_0xa83889['id']+'-'+_0x5e6143+_0x1f9d('0x71'));var _0x585332={'path':_0x4a657b,'channel':_0x1f9d('0x66'),'interactionId':_0xa83889['id']};return pdf[_0x1f9d('0x72')](_0x5cd452,_0x585332);})['then'](function(){return new BPromise(function(_0x3c3ae1,_0x4891ff){zipdir(_0x3c0940,{'saveTo':_0x37ce55},function(_0x3e6ca2,_0x17f0ad){if(_0x3e6ca2)return _0x4891ff(_0x3e6ca2);return _0x3c3ae1(_0x17f0ad);});})['then'](function(){return new BPromise(function(_0x3e1783,_0x51404e){rimraf(_0x3c0940,function(_0x21ce4f){if(_0x21ce4f)_0x51404e(_0x21ce4f);return _0x3e1783();});});})['then'](function(){return _0x52688b[_0x1f9d('0x4f')](_0x37ce55,_0x18af21,function(_0xd4e1ff){if(_0xd4e1ff){console[_0x1f9d('0x73')](_0x1f9d('0x74'),_0xd4e1ff);}else{fs['unlinkSync'](_0x37ce55);}});});});}else{return _0x52688b['sendStatus'](0xc8);}})[_0x1f9d('0x24')](handleError(_0x52688b,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 4c72ccd..cf236d2 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 _0xd914=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages'];(function(_0x1dfb1c,_0x117aac){var _0x39ef83=function(_0x1b8878){while(--_0x1b8878){_0x1dfb1c['push'](_0x1dfb1c['shift']());}};_0x39ef83(++_0x117aac);}(_0xd914,0x17f));var _0x4d91=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xd914[_0x2b5eae];return _0x5f3ac9;};'use strict';var EventEmitter=require(_0x4d91('0x0'));var SmsInteraction=require(_0x4d91('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x4d91('0x1'))['db'][_0x4d91('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4d91('0x3')](0x0);var events={'afterCreate':_0x4d91('0x4'),'afterUpdate':_0x4d91('0x5'),'afterDestroy':_0x4d91('0x6')};function emitEvent(_0x4875a2){return function(_0x1b256e,_0x5d8af4,_0x3ab6f8){_0x1b256e[_0x4d91('0x7')]({'attributes':['id'],'raw':!![]})[_0x4d91('0x8')](function(_0x27c0d5){_0x1b256e[_0x4d91('0x9')](_0x4d91('0xa'),_0x27c0d5[_0x4d91('0xb')](function(_0x2a3ca1){return{'id':_0x2a3ca1['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x1b256e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4d91('0x8')](function(_0xa4bb25){_0x1b256e[_0x4d91('0x9')](_0x4d91('0xc'),_0xa4bb25[_0x4d91('0xd')]);SmsInteractionEvents[_0x4d91('0xe')](_0x4875a2+':'+_0x1b256e['id'],_0x1b256e);SmsInteractionEvents['emit'](_0x4875a2,_0x1b256e);_0x3ab6f8(null);})['catch'](_0x3ab6f8(null));};}for(var e in events){if(events[_0x4d91('0xf')](e)){var event=events[e];SmsInteraction[_0x4d91('0x10')](e,emitEvent(event));}}module[_0x4d91('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x160f=['events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','setDataValue','findAll','then','emit','catch','hook','exports'];(function(_0xf388af,_0xc4129d){var _0x4603b9=function(_0x32ca8c){while(--_0x32ca8c){_0xf388af['push'](_0xf388af['shift']());}};_0x4603b9(++_0xc4129d);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf160('0x0'));var SmsInteraction=require(_0xf160('0x1'))['db'][_0xf160('0x2')];var SmsMessage=require(_0xf160('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xf160('0x3')](0x0);var events={'afterCreate':_0xf160('0x4'),'afterUpdate':_0xf160('0x5'),'afterDestroy':_0xf160('0x6')};function emitEvent(_0x194331){return function(_0xfdbd72,_0x4a6f3d,_0x311d63){_0xfdbd72[_0xf160('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x59440e){_0xfdbd72[_0xf160('0x8')]('Users',_0x59440e['map'](function(_0x496014){return{'id':_0x496014['id']};}));return SmsMessage[_0xf160('0x9')]({'where':{'SmsInteractionId':_0xfdbd72['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf160('0xa')](function(_0x393f70){_0xfdbd72[_0xf160('0x8')]('unreadMessages',_0x393f70['length']);SmsInteractionEvents[_0xf160('0xb')](_0x194331+':'+_0xfdbd72['id'],_0xfdbd72);SmsInteractionEvents[_0xf160('0xb')](_0x194331,_0xfdbd72);_0x311d63(null);})[_0xf160('0xc')](_0x311d63(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xf160('0xd')](e,emitEvent(event));}}module[_0xf160('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 9b662e1..c11d642 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 _0x3788=['changed','closed','util','../../config/logger','api','moment','request-promise','rimraf','./smsInteraction.attributes','define','SmsInteraction','sms_interactions'];(function(_0x463dce,_0x5d8814){var _0x28a67e=function(_0x5c3945){while(--_0x5c3945){_0x463dce['push'](_0x463dce['shift']());}};_0x28a67e(++_0x5d8814);}(_0x3788,0xfe));var _0x8378=function(_0x7957d5,_0x5e4f40){_0x7957d5=_0x7957d5-0x0;var _0x103f14=_0x3788[_0x7957d5];return _0x103f14;};'use strict';var _=require('lodash');var util=require(_0x8378('0x0'));var logger=require(_0x8378('0x1'))(_0x8378('0x2'));var moment=require(_0x8378('0x3'));var BPromise=require('bluebird');var rp=require(_0x8378('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8378('0x5'));var config=require('../../config/environment');var attributes=require(_0x8378('0x6'));module['exports']=function(_0x1f4429,_0x535fb7){return _0x1f4429[_0x8378('0x7')](_0x8378('0x8'),attributes,{'tableName':_0x8378('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x94f4b5,_0x2f2582,_0x5c842c){if(_0x94f4b5[_0x8378('0xa')](_0x8378('0xb'))){_0x94f4b5['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5c842c(null,_0x94f4b5);}}});}; \ No newline at end of file +var _0xed02=['request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed02,0x182));var _0x2ed0=function(_0xc08ffe,_0x26f43f){_0xc08ffe=_0xc08ffe-0x0;var _0x52c452=_0xed02[_0xc08ffe];return _0x52c452;};'use strict';var _=require(_0x2ed0('0x0'));var util=require('util');var logger=require(_0x2ed0('0x1'))(_0x2ed0('0x2'));var moment=require(_0x2ed0('0x3'));var BPromise=require(_0x2ed0('0x4'));var rp=require(_0x2ed0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ed0('0x6'));var config=require(_0x2ed0('0x7'));var attributes=require(_0x2ed0('0x8'));module[_0x2ed0('0x9')]=function(_0x59301e,_0x5c7fa4){return _0x59301e[_0x2ed0('0xa')](_0x2ed0('0xb'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x71f254,_0x1f52ca,_0x215083){if(_0x71f254[_0x2ed0('0xc')](_0x2ed0('0xd'))){_0x71f254[_0x2ed0('0xe')]=moment()[_0x2ed0('0xf')](_0x2ed0('0x10'));}_0x215083(null,_0x71f254);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 79dd7c3..abb0702 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 _0x7449=['jayson/promise','http','defaults','socket.io-emitter','./smsInteraction.socket','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','debug','catch','AddTagsToSmsInteraction','find','addTags','omit','ids','spread','AddTags','stringify','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x17d40a,_0x3e523d){var _0x2ae8f4=function(_0x34ba1c){while(--_0x34ba1c){_0x17d40a['push'](_0x17d40a['shift']());}};_0x2ae8f4(++_0x3e523d);}(_0x7449,0x70));var _0x9744=function(_0x5689ca,_0x59ac65){_0x5689ca=_0x5689ca-0x0;var _0x384c7d=_0x7449[_0x5689ca];return _0x384c7d;};'use strict';var _=require(_0x9744('0x0'));var util=require('util');var moment=require(_0x9744('0x1'));var BPromise=require('bluebird');var rs=require(_0x9744('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9744('0x3'))['db'];var utils=require(_0x9744('0x4'));var logger=require(_0x9744('0x5'))(_0x9744('0x6'));var config=require(_0x9744('0x7'));var jayson=require(_0x9744('0x8'));var client=jayson['client'][_0x9744('0x9')]({'port':0x232a});config['redis']=_[_0x9744('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9744('0xb'))(new Redis(config['redis']));require(_0x9744('0xc'))['register'](socket);function respondWithRpcPromise(_0x5620c3,_0x3ce8db,_0x2c95b2){return new BPromise(function(_0x17b14e,_0x3ee636){return client['request'](_0x5620c3,_0x2c95b2)[_0x9744('0xd')](function(_0x5b26c8){logger['info'](_0x9744('0xe'),_0x3ce8db,_0x9744('0xf'));logger['debug'](_0x9744('0x10'),_0x3ce8db,_0x9744('0xf'),JSON['stringify'](_0x5b26c8));if(_0x5b26c8[_0x9744('0x11')]){if(_0x5b26c8[_0x9744('0x11')][_0x9744('0x12')]===0x1f4){logger[_0x9744('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x3ce8db,_0x5b26c8[_0x9744('0x11')][_0x9744('0x13')]);return _0x3ee636(_0x5b26c8[_0x9744('0x11')][_0x9744('0x13')]);}logger[_0x9744('0x11')](_0x9744('0xe'),_0x3ce8db,_0x5b26c8[_0x9744('0x11')][_0x9744('0x13')]);return _0x17b14e(_0x5b26c8[_0x9744('0x11')]['message']);}else{logger[_0x9744('0x14')](_0x9744('0xe'),_0x3ce8db,_0x9744('0xf'));_0x17b14e(_0x5b26c8[_0x9744('0x15')][_0x9744('0x13')]);}})['catch'](function(_0x301c5f){logger[_0x9744('0x11')](_0x9744('0xe'),_0x3ce8db,_0x301c5f);_0x3ee636(_0x301c5f);});});}exports[_0x9744('0x16')]=function(_0x5e3996){var _0x50d69c=this;return new Promise(function(_0x1fd2ab,_0x35f1c8){return db[_0x9744('0x17')][_0x9744('0x18')](_0x5e3996[_0x9744('0x19')],{'raw':_0x5e3996[_0x9744('0x1a')]?_0x5e3996[_0x9744('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e3996[_0x9744('0x1a')]?_0x5e3996[_0x9744('0x1a')][_0x9744('0x1b')]||null:null,'attributes':_0x5e3996[_0x9744('0x1a')]?_0x5e3996[_0x9744('0x1a')][_0x9744('0x1c')]||null:null,'limit':_0x5e3996['options']?_0x5e3996[_0x9744('0x1a')][_0x9744('0x1d')]||null:null})[_0x9744('0xd')](function(_0x285a0f){logger[_0x9744('0x14')]('UpdateSmsInteraction',_0x5e3996);logger[_0x9744('0x1e')](_0x9744('0x16'),_0x5e3996,JSON['stringify'](_0x285a0f));_0x1fd2ab(_0x285a0f);})[_0x9744('0x1f')](function(_0x43b19b){logger['error']('UpdateSmsInteraction',_0x43b19b[_0x9744('0x13')],_0x5e3996);_0x35f1c8(_0x50d69c[_0x9744('0x11')](0x1f4,_0x43b19b[_0x9744('0x13')]));});});};exports[_0x9744('0x20')]=function(_0x39524b){return new Promise(function(_0x5b14cf,_0x41bb24){return db[_0x9744('0x17')][_0x9744('0x21')]({'where':_0x39524b[_0x9744('0x1a')]?_0x39524b[_0x9744('0x1a')][_0x9744('0x1b')]||null:null})[_0x9744('0xd')](function(_0x2a759f){if(_0x2a759f){return _0x2a759f[_0x9744('0x22')](_0x39524b['body']['ids'],_[_0x9744('0x23')](_0x39524b['body'],[_0x9744('0x24'),'id'])||{});}})[_0x9744('0x25')](function(_0x256d97){logger[_0x9744('0x14')](_0x9744('0x26'),_0x39524b);logger[_0x9744('0x1e')](_0x9744('0x26'),_0x39524b,JSON[_0x9744('0x27')](_0x256d97));_0x5b14cf(_0x256d97);})['catch'](function(_0x5f27d3){logger['error'](_0x9744('0x26'),_0x5f27d3['message'],_0x39524b);_0x41bb24(_this['error'](0x1f4,_0x5f27d3[_0x9744('0x13')]));});});}; \ No newline at end of file +var _0x7e39=['AddTags','util','ioredis','../../config/utils','../../config/logger','jayson/promise','http','redis','socket.io-emitter','register','then','info','request\x20sent','debug','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','catch','SmsInteraction','body','options','raw','where','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','find','addTags','omit','ids','spread'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x7e39,0x89));var _0x97e3=function(_0x40c13f,_0x5f32cb){_0x40c13f=_0x40c13f-0x0;var _0x262f79=_0x7e39[_0x40c13f];return _0x262f79;};'use strict';var _=require('lodash');var util=require(_0x97e3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97e3('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x97e3('0x2'));var logger=require(_0x97e3('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x97e3('0x4'));var client=jayson['client'][_0x97e3('0x5')]({'port':0x232a});config[_0x97e3('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x97e3('0x7'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x97e3('0x8')](socket);function respondWithRpcPromise(_0x33c252,_0x2e8e1b,_0x4ee47e){return new BPromise(function(_0x3ae17a,_0x2c6098){return client['request'](_0x33c252,_0x4ee47e)[_0x97e3('0x9')](function(_0x29e8c5){logger[_0x97e3('0xa')]('SmsInteraction,\x20%s,\x20%s',_0x2e8e1b,_0x97e3('0xb'));logger[_0x97e3('0xc')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x2e8e1b,_0x97e3('0xb'),JSON[_0x97e3('0xd')](_0x29e8c5));if(_0x29e8c5['error']){if(_0x29e8c5[_0x97e3('0xe')][_0x97e3('0xf')]===0x1f4){logger[_0x97e3('0xe')](_0x97e3('0x10'),_0x2e8e1b,_0x29e8c5[_0x97e3('0xe')][_0x97e3('0x11')]);return _0x2c6098(_0x29e8c5['error']['message']);}logger[_0x97e3('0xe')](_0x97e3('0x10'),_0x2e8e1b,_0x29e8c5[_0x97e3('0xe')][_0x97e3('0x11')]);return _0x3ae17a(_0x29e8c5[_0x97e3('0xe')]['message']);}else{logger['info'](_0x97e3('0x10'),_0x2e8e1b,'request\x20sent');_0x3ae17a(_0x29e8c5['result'][_0x97e3('0x11')]);}})[_0x97e3('0x12')](function(_0x57c271){logger[_0x97e3('0xe')](_0x97e3('0x10'),_0x2e8e1b,_0x57c271);_0x2c6098(_0x57c271);});});}exports['UpdateSmsInteraction']=function(_0x3d5b5f){var _0x4fcb01=this;return new Promise(function(_0x5a56ea,_0x58f5ef){return db[_0x97e3('0x13')]['update'](_0x3d5b5f[_0x97e3('0x14')],{'raw':_0x3d5b5f[_0x97e3('0x15')]?_0x3d5b5f[_0x97e3('0x15')][_0x97e3('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d5b5f[_0x97e3('0x15')]?_0x3d5b5f['options'][_0x97e3('0x17')]||null:null,'attributes':_0x3d5b5f[_0x97e3('0x15')]?_0x3d5b5f[_0x97e3('0x15')][_0x97e3('0x18')]||null:null,'limit':_0x3d5b5f[_0x97e3('0x15')]?_0x3d5b5f['options'][_0x97e3('0x19')]||null:null})[_0x97e3('0x9')](function(_0x5f27d2){logger[_0x97e3('0xa')](_0x97e3('0x1a'),_0x3d5b5f);logger[_0x97e3('0xc')]('UpdateSmsInteraction',_0x3d5b5f,JSON['stringify'](_0x5f27d2));_0x5a56ea(_0x5f27d2);})[_0x97e3('0x12')](function(_0x353c0b){logger[_0x97e3('0xe')](_0x97e3('0x1a'),_0x353c0b['message'],_0x3d5b5f);_0x58f5ef(_0x4fcb01[_0x97e3('0xe')](0x1f4,_0x353c0b[_0x97e3('0x11')]));});});};exports[_0x97e3('0x1b')]=function(_0x25c473){return new Promise(function(_0x11a7e5,_0x57f441){return db[_0x97e3('0x13')][_0x97e3('0x1c')]({'where':_0x25c473[_0x97e3('0x15')]?_0x25c473[_0x97e3('0x15')][_0x97e3('0x17')]||null:null})[_0x97e3('0x9')](function(_0x43b590){if(_0x43b590){return _0x43b590[_0x97e3('0x1d')](_0x25c473[_0x97e3('0x14')]['ids'],_[_0x97e3('0x1e')](_0x25c473['body'],[_0x97e3('0x1f'),'id'])||{});}})[_0x97e3('0x20')](function(_0x3a7c53){logger[_0x97e3('0xa')](_0x97e3('0x21'),_0x25c473);logger[_0x97e3('0xc')](_0x97e3('0x21'),_0x25c473,JSON[_0x97e3('0xd')](_0x3a7c53));_0x11a7e5(_0x3a7c53);})['catch'](function(_0x1b2121){logger[_0x97e3('0xe')]('AddTags',_0x1b2121[_0x97e3('0x11')],_0x25c473);_0x57f441(_this['error'](0x1f4,_0x1b2121[_0x97e3('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index ea05234..4c6829c 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 _0x2f47=['update','emit','register','length','smsInteraction:','save','remove'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0x2f47,0xd0));var _0x72f4=function(_0x41216b,_0x42501a){_0x41216b=_0x41216b-0x0;var _0x7d9c7a=_0x2f47[_0x41216b];return _0x7d9c7a;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x72f4('0x0'),_0x72f4('0x1'),_0x72f4('0x2')];function createListener(_0x3aebd7,_0x3e592f){return function(_0x54a4b4){_0x3e592f[_0x72f4('0x3')](_0x3aebd7,_0x54a4b4);};}function removeListener(_0x39d80f,_0xb843a6){return function(){SmsInteractionEvents['removeListener'](_0x39d80f,_0xb843a6);};}exports[_0x72f4('0x4')]=function(_0x1c3a43){for(var _0x59c220=0x0,_0x21123c=events[_0x72f4('0x5')];_0x59c220<_0x21123c;_0x59c220++){var _0x43a174=events[_0x59c220];var _0x1d401b=createListener(_0x72f4('0x6')+_0x43a174,_0x1c3a43);SmsInteractionEvents['on'](_0x43a174,_0x1d401b);}}; \ No newline at end of file +var _0xf364=['emit','removeListener','smsInteraction:','save','remove','update'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0xf364,0x1e9));var _0x4f36=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xf364[_0x5b561d];return _0x431060;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x4f36('0x0'),_0x4f36('0x1'),_0x4f36('0x2')];function createListener(_0x1b8dd2,_0x167868){return function(_0x5c87a5){_0x167868[_0x4f36('0x3')](_0x1b8dd2,_0x5c87a5);};}function removeListener(_0xdc2230,_0x318843){return function(){SmsInteractionEvents[_0x4f36('0x4')](_0xdc2230,_0x318843);};}exports['register']=function(_0x5e134f){for(var _0x4d3b0b=0x0,_0x26ca39=events['length'];_0x4d3b0b<_0x26ca39;_0x4d3b0b++){var _0x9668c3=events[_0x4d3b0b];var _0x599fb2=createListener(_0x4f36('0x5')+_0x9668c3,_0x5e134f);SmsInteractionEvents['on'](_0x9668c3,_0x599fb2);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index b8b9a6c..7ab9a29 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 _0xa789=['index','/describe','/:id','show','post','tracked','status','put','update','/:id/accept','reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa789,0x71));var _0x9a78=function(_0x44db31,_0x1adf02){_0x44db31=_0x44db31-0x0;var _0x5a574d=_0xa789[_0x44db31];return _0x5a574d;};'use strict';var multer=require(_0x9a78('0x0'));var util=require(_0x9a78('0x1'));var path=require(_0x9a78('0x2'));var timeout=require(_0x9a78('0x3'));var express=require(_0x9a78('0x4'));var router=express['Router']();var fs_extra=require(_0x9a78('0x5'));var auth=require(_0x9a78('0x6'));var interaction=require(_0x9a78('0x7'));var config=require(_0x9a78('0x8'));var controller=require(_0x9a78('0x9'));router[_0x9a78('0xa')]('/',auth[_0x9a78('0xb')](),controller[_0x9a78('0xc')]);router[_0x9a78('0xa')](_0x9a78('0xd'),auth[_0x9a78('0xb')](),controller['describe']);router['get'](_0x9a78('0xe'),auth[_0x9a78('0xb')](),controller[_0x9a78('0xf')]);router[_0x9a78('0x10')]('/',auth['isAuthenticated'](),interaction[_0x9a78('0x11')]('sms','smsmessage:create'),controller['create']);router[_0x9a78('0x10')]('/:id/status',controller[_0x9a78('0x12')]);router[_0x9a78('0x13')](_0x9a78('0xe'),auth[_0x9a78('0xb')](),controller[_0x9a78('0x14')]);router[_0x9a78('0x13')](_0x9a78('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0x9a78('0x13')]('/:id/reject',auth[_0x9a78('0xb')](),controller[_0x9a78('0x16')]);router['delete'](_0x9a78('0xe'),auth[_0x9a78('0xb')](),controller[_0x9a78('0x17')]);module[_0x9a78('0x18')]=router; \ No newline at end of file +var _0x26fb=['index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated'];(function(_0x442a28,_0xcaf5f0){var _0x640fa9=function(_0x516bfc){while(--_0x516bfc){_0x442a28['push'](_0x442a28['shift']());}};_0x640fa9(++_0xcaf5f0);}(_0x26fb,0x1f4));var _0xb26f=function(_0x33c637,_0x597c26){_0x33c637=_0x33c637-0x0;var _0x14aa20=_0x26fb[_0x33c637];return _0x14aa20;};'use strict';var multer=require(_0xb26f('0x0'));var util=require(_0xb26f('0x1'));var path=require(_0xb26f('0x2'));var timeout=require(_0xb26f('0x3'));var express=require(_0xb26f('0x4'));var router=express[_0xb26f('0x5')]();var fs_extra=require(_0xb26f('0x6'));var auth=require(_0xb26f('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb26f('0x8'));var controller=require(_0xb26f('0x9'));router[_0xb26f('0xa')]('/',auth[_0xb26f('0xb')](),controller[_0xb26f('0xc')]);router['get'](_0xb26f('0xd'),auth[_0xb26f('0xb')](),controller[_0xb26f('0xe')]);router[_0xb26f('0xa')](_0xb26f('0xf'),auth['isAuthenticated'](),controller[_0xb26f('0x10')]);router[_0xb26f('0x11')]('/',auth[_0xb26f('0xb')](),interaction[_0xb26f('0x12')](_0xb26f('0x13'),_0xb26f('0x14')),controller[_0xb26f('0x15')]);router[_0xb26f('0x11')](_0xb26f('0x16'),controller[_0xb26f('0x17')]);router[_0xb26f('0x18')](_0xb26f('0xf'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x19')]);router['put'](_0xb26f('0x1a'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x1b')]);router[_0xb26f('0x18')](_0xb26f('0x1c'),auth[_0xb26f('0xb')](),controller[_0xb26f('0x1d')]);router['delete']('/:id',auth[_0xb26f('0xb')](),controller[_0xb26f('0x1e')]);module[_0xb26f('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index b2a87ed..9cabfe3 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 _0x525e=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0x525e,0x78));var _0xe525=function(_0x474f4f,_0x2f667a){_0x474f4f=_0x474f4f-0x0;var _0x36082d=_0x525e[_0x474f4f];return _0x36082d;};'use strict';var Sequelize=require(_0xe525('0x0'));module[_0xe525('0x1')]={'body':{'type':Sequelize[_0xe525('0x2')](_0xe525('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe525('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe525('0x5')]('in',_0xe525('0x6')),'defaultValue':_0xe525('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xe525('0x7')]},'readAt':{'type':Sequelize[_0xe525('0x8')]},'secret':{'type':Sequelize[_0xe525('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe93b=['DATE','BOOLEAN','exports','TEXT','medium','ENUM','out','STRING'];(function(_0x246b52,_0x45661a){var _0xe355e9=function(_0x55b9e5){while(--_0x55b9e5){_0x246b52['push'](_0x246b52['shift']());}};_0xe355e9(++_0x45661a);}(_0xe93b,0x1c2));var _0xbe93=function(_0x152239,_0x799a8f){_0x152239=_0x152239-0x0;var _0x19bc20=_0xe93b[_0x152239];return _0x19bc20;};'use strict';var Sequelize=require('sequelize');module[_0xbe93('0x0')]={'body':{'type':Sequelize[_0xbe93('0x1')](_0xbe93('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xbe93('0x3')]('in',_0xbe93('0x4')),'defaultValue':_0xbe93('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbe93('0x5')](0xbe)},'phone':{'type':Sequelize[_0xbe93('0x5')]},'readAt':{'type':Sequelize[_0xbe93('0x6')]},'secret':{'type':Sequelize[_0xbe93('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbe93('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index f899cd1..1383027 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 _0x1e44=['SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','ContactId','QueryTypes','fullname','email','SIP/%s','rejectmessage','SmsAccount','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','name','send','index','map','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','SmsMessage','findAll','rows','show','params','rawAttributes','find','create','body','describe','sms-interactions','accept','sms','UserId','agent','get','SmsInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','user','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','internal','manual','interface','channel','motionChannel','event','EventManager','../../config/logger'];(function(_0x2db639,_0xdea495){var _0x1025b6=function(_0x39817b){while(--_0x39817b){_0x2db639['push'](_0x2db639['shift']());}};_0x1025b6(++_0xdea495);}(_0x1e44,0xb3));var _0x41e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e44[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x41e4('0x0'));var rimraf=require(_0x41e4('0x1'));var zipdir=require(_0x41e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x41e4('0x3'));var moment=require(_0x41e4('0x4'));var BPromise=require(_0x41e4('0x5'));var Mustache=require(_0x41e4('0x6'));var util=require('util');var path=require(_0x41e4('0x7'));var sox=require(_0x41e4('0x8'));var csv=require(_0x41e4('0x9'));var ejs=require(_0x41e4('0xa'));var fs=require('fs');var fs_extra=require(_0x41e4('0xb'));var _=require(_0x41e4('0xc'));var squel=require(_0x41e4('0xd'));var crypto=require(_0x41e4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x41e4('0xf'));var toCsv=require(_0x41e4('0x9'));var querystring=require(_0x41e4('0x10'));var Papa=require(_0x41e4('0x11'));var Redis=require(_0x41e4('0x12'));var authService=require(_0x41e4('0x13'));var qs=require(_0x41e4('0x14'));var as=require(_0x41e4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x41e4('0x16'));var utils=require('../../config/utils');var config=require(_0x41e4('0x17'));var licenseUtil=require(_0x41e4('0x18'));var db=require(_0x41e4('0x19'))['db'];config[_0x41e4('0x1a')]=_[_0x41e4('0x1b')](config[_0x41e4('0x1a')],{'host':_0x41e4('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x41e4('0x1d'))['register'](socket);var jayson=require(_0x41e4('0x1e'));var client=jayson['client'][_0x41e4('0x1f')]({'port':0x232c});var client9002=jayson[_0x41e4('0x20')][_0x41e4('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x508caa,_0x41238a,_0x2e9500,_0x5b207d){return new BPromise(function(_0x5bbe36,_0x56d8d1){var _0x4b5fb6=_0x5b207d||client;return _0x4b5fb6[_0x41e4('0x21')](_0x508caa,_0x2e9500)[_0x41e4('0x22')](function(_0xdd9766){logger[_0x41e4('0x23')](_0x41e4('0x24'),_0x41238a,'request\x20sent');logger['debug'](_0x41e4('0x25'),_0x41238a,_0x41e4('0x26'),JSON[_0x41e4('0x27')](_0xdd9766));if(_0xdd9766[_0x41e4('0x28')]){if(_0xdd9766[_0x41e4('0x28')][_0x41e4('0x29')]===0x1f4){logger[_0x41e4('0x28')](_0x41e4('0x24'),_0x41238a,_0xdd9766['error'][_0x41e4('0x2a')]);return _0x56d8d1(_0xdd9766['error'][_0x41e4('0x2a')]);}logger[_0x41e4('0x28')](_0x41e4('0x24'),_0x41238a,_0xdd9766[_0x41e4('0x28')][_0x41e4('0x2a')]);return _0x5bbe36(_0xdd9766[_0x41e4('0x28')]['message']);}else{logger[_0x41e4('0x23')]('SmsMessage,\x20%s,\x20%s',_0x41238a,_0x41e4('0x26'));_0x5bbe36(_0xdd9766[_0x41e4('0x2b')][_0x41e4('0x2a')]);}})[_0x41e4('0x2c')](function(_0x18fac9){logger[_0x41e4('0x28')](_0x41e4('0x24'),_0x41238a,_0x18fac9);_0x56d8d1(_0x18fac9);});});}function respondWithStatusCode(_0xe9bc87,_0x297fa1){_0x297fa1=_0x297fa1||0xcc;return function(_0x2dd222){if(_0x2dd222){return _0xe9bc87[_0x41e4('0x2d')](_0x297fa1);}return _0xe9bc87[_0x41e4('0x2e')](_0x297fa1)[_0x41e4('0x2f')]();};}function respondWithResult(_0x74ea28,_0x3f2749){_0x3f2749=_0x3f2749||0xc8;return function(_0x136fc5){if(_0x136fc5){return _0x74ea28[_0x41e4('0x2e')](_0x3f2749)[_0x41e4('0x30')](_0x136fc5);}};}function respondWithFilteredResult(_0xff795e,_0x3599c8){return function(_0x4fe8b2){if(_0x4fe8b2){var _0x16fa1b=typeof _0x3599c8[_0x41e4('0x31')]===_0x41e4('0x32')&&typeof _0x3599c8['limit']===_0x41e4('0x32');var _0x163fef=_0x4fe8b2[_0x41e4('0x33')];var _0x103e28=_0x16fa1b?0x0:_0x3599c8[_0x41e4('0x31')];var _0x1f3a8b=_0x16fa1b?_0x4fe8b2[_0x41e4('0x33')]:_0x3599c8['offset']+_0x3599c8[_0x41e4('0x34')];var _0x31b1b8;if(_0x1f3a8b>=_0x163fef){_0x1f3a8b=_0x163fef;_0x31b1b8=0xc8;}else{_0x31b1b8=0xce;}_0xff795e[_0x41e4('0x2e')](_0x31b1b8);return _0xff795e['set'](_0x41e4('0x35'),_0x103e28+'-'+_0x1f3a8b+'/'+_0x163fef)[_0x41e4('0x30')](_0x4fe8b2);}return null;};}function patchUpdates(_0x130ad0){return function(_0x530fcd){try{jsonpatch[_0x41e4('0x36')](_0x530fcd,_0x130ad0,!![]);}catch(_0x2c86fe){return BPromise[_0x41e4('0x37')](_0x2c86fe);}return _0x530fcd[_0x41e4('0x38')]();};}function saveUpdates(_0x4e1b3f,_0xec2833){return function(_0x1160da){if(_0x1160da){return _0x1160da[_0x41e4('0x39')](_0x4e1b3f)[_0x41e4('0x22')](function(_0x3b86ff){return _0x3b86ff;});}return null;};}function removeEntity(_0x5687d4,_0x22267a){return function(_0xbc5c7a){if(_0xbc5c7a){return _0xbc5c7a[_0x41e4('0x3a')]()[_0x41e4('0x22')](function(){_0x5687d4['status'](0xcc)[_0x41e4('0x2f')]();});}};}function handleEntityNotFound(_0x13164b,_0x311a05){return function(_0x31702c){if(!_0x31702c){_0x13164b['sendStatus'](0x194);}return _0x31702c;};}function handleError(_0x5c3dec,_0x5ef1c1){_0x5ef1c1=_0x5ef1c1||0x1f4;return function(_0x19362c){logger[_0x41e4('0x28')](_0x19362c['stack']);if(_0x19362c[_0x41e4('0x3b')]){delete _0x19362c['name'];}_0x5c3dec['status'](_0x5ef1c1)[_0x41e4('0x3c')](_0x19362c);};}exports[_0x41e4('0x3d')]=function(_0x210e83,_0x3de587){var _0x3696e6={},_0x2eb0aa={},_0x3a8114={'count':0x0,'rows':[]};var _0x298d05=_[_0x41e4('0x3e')](db['SmsMessage']['rawAttributes'],function(_0x54678d){return{'name':_0x54678d[_0x41e4('0x3f')],'type':_0x54678d['type'][_0x41e4('0x40')]};});_0x2eb0aa['model']=_[_0x41e4('0x3e')](_0x298d05,_0x41e4('0x3b'));_0x2eb0aa[_0x41e4('0x41')]=_[_0x41e4('0x42')](_0x210e83[_0x41e4('0x41')]);_0x2eb0aa[_0x41e4('0x43')]=_['intersection'](_0x2eb0aa['model'],_0x2eb0aa[_0x41e4('0x41')]);_0x3696e6[_0x41e4('0x44')]=_[_0x41e4('0x45')](_0x2eb0aa[_0x41e4('0x46')],qs[_0x41e4('0x47')](_0x210e83[_0x41e4('0x41')]['fields']));_0x3696e6['attributes']=_0x3696e6[_0x41e4('0x44')][_0x41e4('0x48')]?_0x3696e6[_0x41e4('0x44')]:_0x2eb0aa[_0x41e4('0x46')];if(!_0x210e83[_0x41e4('0x41')]['hasOwnProperty']('nolimit')){_0x3696e6[_0x41e4('0x34')]=qs['limit'](_0x210e83[_0x41e4('0x41')][_0x41e4('0x34')]);_0x3696e6[_0x41e4('0x31')]=qs['offset'](_0x210e83[_0x41e4('0x41')][_0x41e4('0x31')]);}_0x3696e6[_0x41e4('0x49')]=qs[_0x41e4('0x4a')](_0x210e83[_0x41e4('0x41')][_0x41e4('0x4a')]);_0x3696e6[_0x41e4('0x4b')]=qs[_0x41e4('0x43')](_[_0x41e4('0x4c')](_0x210e83[_0x41e4('0x41')],_0x2eb0aa[_0x41e4('0x43')]),_0x298d05);if(_0x210e83['query'][_0x41e4('0x4d')]){_0x3696e6['where']=_[_0x41e4('0x4e')](_0x3696e6[_0x41e4('0x4b')],{'$or':_[_0x41e4('0x3e')](_0x298d05,function(_0x448892){if(_0x448892[_0x41e4('0x4f')]!==_0x41e4('0x50')){var _0x21b983={};_0x21b983[_0x448892[_0x41e4('0x3b')]]={'$like':'%'+_0x210e83[_0x41e4('0x41')][_0x41e4('0x4d')]+'%'};return _0x21b983;}})});}_0x3696e6=_['merge']({},_0x3696e6,_0x210e83['options']);var _0x16cb47={'where':_0x3696e6[_0x41e4('0x4b')]};return db['SmsMessage']['count'](_0x16cb47)[_0x41e4('0x22')](function(_0x235ada){_0x3a8114['count']=_0x235ada;if(_0x210e83[_0x41e4('0x41')][_0x41e4('0x51')]){_0x3696e6[_0x41e4('0x52')]=[{'all':!![]}];}return db[_0x41e4('0x53')][_0x41e4('0x54')](_0x3696e6);})[_0x41e4('0x22')](function(_0x3330c1){_0x3a8114[_0x41e4('0x55')]=_0x3330c1;return _0x3a8114;})['then'](respondWithFilteredResult(_0x3de587,_0x3696e6))[_0x41e4('0x2c')](handleError(_0x3de587,null));};exports[_0x41e4('0x56')]=function(_0x5a1ac8,_0x5a594e){var _0x490948={'raw':!![],'where':{'id':_0x5a1ac8[_0x41e4('0x57')]['id']}},_0xdf65c6={};_0xdf65c6[_0x41e4('0x46')]=_[_0x41e4('0x42')](db[_0x41e4('0x53')][_0x41e4('0x58')]);_0xdf65c6[_0x41e4('0x41')]=_[_0x41e4('0x42')](_0x5a1ac8[_0x41e4('0x41')]);_0xdf65c6[_0x41e4('0x43')]=_[_0x41e4('0x45')](_0xdf65c6['model'],_0xdf65c6[_0x41e4('0x41')]);_0x490948[_0x41e4('0x44')]=_[_0x41e4('0x45')](_0xdf65c6[_0x41e4('0x46')],qs[_0x41e4('0x47')](_0x5a1ac8[_0x41e4('0x41')][_0x41e4('0x47')]));_0x490948[_0x41e4('0x44')]=_0x490948[_0x41e4('0x44')][_0x41e4('0x48')]?_0x490948[_0x41e4('0x44')]:_0xdf65c6[_0x41e4('0x46')];if(_0x5a1ac8[_0x41e4('0x41')]['includeAll']){_0x490948[_0x41e4('0x52')]=[{'all':!![]}];}_0x490948=_['merge']({},_0x490948,_0x5a1ac8['options']);return db['SmsMessage'][_0x41e4('0x59')](_0x490948)[_0x41e4('0x22')](handleEntityNotFound(_0x5a594e,null))[_0x41e4('0x22')](respondWithResult(_0x5a594e,null))[_0x41e4('0x2c')](handleError(_0x5a594e,null));};exports[_0x41e4('0x5a')]=function(_0x422f50,_0x4830da){return db['SmsMessage'][_0x41e4('0x5a')](_0x422f50[_0x41e4('0x5b')],{})[_0x41e4('0x22')](respondWithResult(_0x4830da,0xc9))[_0x41e4('0x2c')](handleError(_0x4830da,null));};exports['update']=function(_0x26fd45,_0x1cd8cc){if(_0x26fd45['body']['id']){delete _0x26fd45['body']['id'];}return db[_0x41e4('0x53')][_0x41e4('0x59')]({'where':{'id':_0x26fd45[_0x41e4('0x57')]['id']}})[_0x41e4('0x22')](handleEntityNotFound(_0x1cd8cc,null))[_0x41e4('0x22')](saveUpdates(_0x26fd45[_0x41e4('0x5b')],null))['then'](respondWithResult(_0x1cd8cc,null))[_0x41e4('0x2c')](handleError(_0x1cd8cc,null));};exports[_0x41e4('0x3a')]=function(_0x30a948,_0x242323){return db[_0x41e4('0x53')][_0x41e4('0x59')]({'where':{'id':_0x30a948[_0x41e4('0x57')]['id']}})[_0x41e4('0x22')](handleEntityNotFound(_0x242323,null))[_0x41e4('0x22')](removeEntity(_0x242323,null))[_0x41e4('0x2c')](handleError(_0x242323,null));};exports['describe']=function(_0x16bae9,_0x4911e9){return db['SmsMessage'][_0x41e4('0x5c')]()[_0x41e4('0x22')](respondWithResult(_0x4911e9,null))[_0x41e4('0x2c')](handleError(_0x4911e9,null));};var interaction_log=require('../../config/logger')(_0x41e4('0x5d'));exports[_0x41e4('0x5e')]=function(_0x37416d,_0x49185d,_0xf1c89e){var _0x2c29c1={'agent':{},'channel':_0x41e4('0x5f')};if(_0x37416d[_0x41e4('0x5b')]['id']){delete _0x37416d[_0x41e4('0x5b')]['id'];}_0x37416d[_0x41e4('0x5b')]['read']=!![];_0x37416d[_0x41e4('0x5b')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x37416d[_0x41e4('0x5b')]['UserId']=_0x37416d[_0x41e4('0x5b')][_0x41e4('0x60')]||_0x37416d['user']['id'];_0x2c29c1[_0x41e4('0x61')]['id']=_0x37416d['body'][_0x41e4('0x60')];return db[_0x41e4('0x53')][_0x41e4('0x59')]({'where':{'id':_0x37416d[_0x41e4('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x49185d,null))[_0x41e4('0x22')](saveUpdates(_0x37416d[_0x41e4('0x5b')],null))['then'](function(_0x3cc255){if(_0x3cc255){_0x2c29c1[_0x41e4('0x2a')]=_0x3cc255[_0x41e4('0x62')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x3cc255[_0x41e4('0x63')]}});}return null;})[_0x41e4('0x22')](handleEntityNotFound(_0x49185d,null))[_0x41e4('0x22')](function(_0xe7826){if(_0xe7826){return _0xe7826[_0x41e4('0x39')]({'UserId':_0x37416d[_0x41e4('0x5b')][_0x41e4('0x60')],'read1stAt':_[_0x41e4('0x64')](_0xe7826[_0x41e4('0x65')])?moment()[_0x41e4('0x66')](_0x41e4('0x67')):undefined});}return null;})[_0x41e4('0x22')](function(_0x21cb55){if(_0x21cb55){_0x2c29c1['interaction']=_0x21cb55[_0x41e4('0x62')]({'plain':!![]});interaction_log[_0x41e4('0x23')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x37416d[_0x41e4('0x68')]['id'],_0x37416d[_0x41e4('0x68')][_0x41e4('0x3b')],_0x37416d[_0x41e4('0x68')]['role'],_0x2c29c1[_0x41e4('0x69')]['id'],_0x37416d[_0x41e4('0x5b')]?JSON[_0x41e4('0x27')](_0x37416d[_0x41e4('0x5b')]):_0x41e4('0x6a'));return respondWithRpcPromise(_0x41e4('0x6b'),_0x41e4('0x6c'),_0x2c29c1);}return null;})[_0x41e4('0x22')](function(_0x539257){var _0x1df624=_0x41e4('0x6d')+_0x539257['message']['ContactId'];return db[_0x41e4('0x6e')][_0x41e4('0x41')](_0x1df624,{'type':db[_0x41e4('0x6f')]['QueryTypes'][_0x41e4('0x70')],'raw':!![]})[_0x41e4('0x22')](function(_0x462f8f){return _0x462f8f;});})[_0x41e4('0x22')](function(_0x7665){if(_0x7665){_0x2c29c1[_0x41e4('0x2a')][_0x41e4('0x71')]=_0x7665[0x0];if(!_0x37416d['body'][_0x41e4('0x60')])return;return db[_0x41e4('0x72')][_0x41e4('0x59')]({'where':{'id':_0x37416d[_0x41e4('0x5b')][_0x41e4('0x60')],'role':_0x41e4('0x61')},'attributes':['id','name','fullname','email',_0x41e4('0x73')],'raw':!![]});}return null;})['then'](function(_0x59a579){if(!_0x59a579)return null;_0x2c29c1[_0x41e4('0x2a')]['agent']=_0x59a579;return _0x2c29c1;})[_0x41e4('0x22')](function(_0x2c83ca){if(_0x2c83ca){if(_0x37416d[_0x41e4('0x5b')][_0x41e4('0x74')]){_0x2c29c1[_0x41e4('0x2a')][_0x41e4('0x75')]=util[_0x41e4('0x66')]('SIP/%s',_0x37416d[_0x41e4('0x68')][_0x41e4('0x3b')]);_0x2c29c1[_0x41e4('0x2a')][_0x41e4('0x76')]=_0x2c29c1[_0x41e4('0x76')];_0x2c29c1[_0x41e4('0x2a')][_0x41e4('0x77')]=_0x2c29c1[_0x41e4('0x76')];_0x2c29c1[_0x41e4('0x2a')][_0x41e4('0x78')]=_0x41e4('0x5e');return respondWithRpcPromise(_0x41e4('0x79'),'EventManager',{'event':'acceptmessage','message':_0x2c29c1['message']},client9002)[_0x41e4('0x22')](function(){return _0x2c29c1;});}return _0x2c29c1;}return null;})[_0x41e4('0x22')](respondWithResult(_0x49185d,null))['catch'](handleError(_0x49185d,null));};var interaction_log=require(_0x41e4('0x7a'))(_0x41e4('0x5d'));exports['reject']=function(_0x4ca991,_0x504e8d,_0x5ca509){var _0x431c9a={'agent':{},'channel':_0x41e4('0x5f')};if(_0x4ca991[_0x41e4('0x5b')]['id']){delete _0x4ca991[_0x41e4('0x5b')]['id'];}_0x4ca991[_0x41e4('0x5b')][_0x41e4('0x60')]=_0x4ca991[_0x41e4('0x5b')][_0x41e4('0x60')]||_0x4ca991['user']['id'];_0x431c9a[_0x41e4('0x61')]['id']=_0x4ca991['body'][_0x41e4('0x60')];return db[_0x41e4('0x53')][_0x41e4('0x59')]({'where':{'id':_0x4ca991[_0x41e4('0x57')]['id'],'UserId':null}})[_0x41e4('0x22')](handleEntityNotFound(_0x504e8d,null))[_0x41e4('0x22')](function(_0x50c4c6){if(_0x50c4c6){_0x431c9a[_0x41e4('0x2a')]=_0x50c4c6[_0x41e4('0x62')]({'plain':!![]});return db[_0x41e4('0x7b')][_0x41e4('0x59')]({'where':{'id':_0x50c4c6['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x504e8d,null))[_0x41e4('0x22')](function(_0x258177){if(_0x258177){_0x431c9a[_0x41e4('0x69')]=_0x258177['get']({'plain':!![]});interaction_log[_0x41e4('0x23')](_0x41e4('0x7c'),_0x4ca991[_0x41e4('0x68')]['id'],_0x4ca991['user'][_0x41e4('0x3b')],_0x4ca991[_0x41e4('0x68')][_0x41e4('0x7d')],_0x431c9a[_0x41e4('0x69')]['id'],_0x4ca991[_0x41e4('0x5b')]?JSON[_0x41e4('0x27')](_0x4ca991[_0x41e4('0x5b')]):_0x41e4('0x6a'));return respondWithRpcPromise(_0x41e4('0x7e'),'rejectMessage',_0x431c9a);}return null;})[_0x41e4('0x22')](function(_0x5aeb70){var _0x534796=_0x41e4('0x6d')+_0x5aeb70[_0x41e4('0x2a')][_0x41e4('0x7f')];return db[_0x41e4('0x6e')][_0x41e4('0x41')](_0x534796,{'type':db[_0x41e4('0x6f')][_0x41e4('0x80')]['SELECT'],'raw':!![]})[_0x41e4('0x22')](function(_0x52bdc0){return _0x52bdc0;});})[_0x41e4('0x22')](function(_0x2702e6){if(_0x2702e6){_0x431c9a[_0x41e4('0x2a')][_0x41e4('0x71')]=_0x2702e6[0x0];if(!_0x4ca991['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x4ca991['body'][_0x41e4('0x60')],'role':_0x41e4('0x61')},'attributes':['id','name',_0x41e4('0x81'),_0x41e4('0x82'),'internal'],'raw':!![]});}return null;})[_0x41e4('0x22')](function(_0x5c0702){if(!_0x5c0702)return null;_0x431c9a[_0x41e4('0x2a')]['agent']=_0x5c0702;return _0x431c9a;})[_0x41e4('0x22')](function(_0x3c4151){if(_0x3c4151){_0x3c4151['message']['interface']=util[_0x41e4('0x66')](_0x41e4('0x83'),_0x4ca991[_0x41e4('0x68')][_0x41e4('0x3b')]);_0x3c4151[_0x41e4('0x2a')][_0x41e4('0x76')]=_0x431c9a['channel'];_0x3c4151['message'][_0x41e4('0x77')]=_0x431c9a[_0x41e4('0x76')];_0x3c4151['message'][_0x41e4('0x78')]=_0x41e4('0x37');respondWithRpcPromise(_0x41e4('0x79'),_0x41e4('0x79'),{'event':_0x41e4('0x84'),'message':_0x3c4151['message']},client9002);return _0x431c9a;}return null;})[_0x41e4('0x22')](respondWithResult(_0x504e8d,null))[_0x41e4('0x2c')](handleError(_0x504e8d,null));};exports[_0x41e4('0x2e')]=function(_0x543551,_0x2c7de1,_0x2a211e){if(_0x543551['body']['id']){delete _0x543551[_0x41e4('0x5b')]['id'];}var _0x36b4ad;return db[_0x41e4('0x53')][_0x41e4('0x59')]({'where':{'id':_0x543551[_0x41e4('0x57')]['id']}})[_0x41e4('0x22')](handleEntityNotFound(_0x2c7de1,null))[_0x41e4('0x22')](function(_0x5dd2b8){if(_0x5dd2b8){_0x36b4ad=_0x5dd2b8;return db[_0x41e4('0x85')]['find']({'where':{'id':_0x5dd2b8['SmsAccountId']}});}})[_0x41e4('0x22')](handleEntityNotFound(_0x2c7de1,null))[_0x41e4('0x22')](function(_0x365fc1){if(_0x365fc1){logger[_0x41e4('0x86')](_0x41e4('0x25'),_0x41e4('0x2e'),_0x41e4('0x87'),_0x365fc1[_0x41e4('0x4f')],util[_0x41e4('0x88')](_0x543551[_0x41e4('0x5b')],{'showHidden':![],'depth':null}));switch(_0x365fc1['type']){case _0x41e4('0x89'):if(_0x543551['body'][_0x41e4('0x8a')]&&_0x543551['body']['MessageSid']===_0x36b4ad[_0x41e4('0x8b')]){return _0x36b4ad['update']({'read':!![]});}else{logger[_0x41e4('0x28')](_0x41e4('0x8c'),_0x41e4('0x2e'),_0x41e4('0x89'),util[_0x41e4('0x88')](_0x543551[_0x41e4('0x5b')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x543551['body'][_0x41e4('0x8d')]&&_0x543551[_0x41e4('0x5b')]['MessageUUID']===_0x36b4ad['messageId']&&_[_0x41e4('0x8e')]([_0x41e4('0x8f'),_0x41e4('0x90')],_0x543551[_0x41e4('0x5b')][_0x41e4('0x91')])>=0x0){return _0x36b4ad[_0x41e4('0x39')]({'read':!![]});}else{logger[_0x41e4('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x41e4('0x2e'),_0x41e4('0x92'),util[_0x41e4('0x88')](_0x543551['body'],{'showHidden':![],'depth':null}));}break;case _0x41e4('0x93'):var _0xb7c4d9=_0x543551[_0x41e4('0x5b')][_0x41e4('0x94')][0x0];if(_0xb7c4d9[_0x41e4('0x2e')][_0x41e4('0x95')]===_0x41e4('0x96')){return _0x36b4ad['update']({'read':!![]});}else{logger[_0x41e4('0x28')](_0x41e4('0x8c'),_0x41e4('0x2e'),_0x41e4('0x93'),util[_0x41e4('0x88')](_0x543551['body'],{'showHidden':![],'depth':null}));}break;}return _0x36b4ad;}})[_0x41e4('0x22')](respondWithResult(_0x2c7de1,null))[_0x41e4('0x2c')](handleError(_0x2c7de1,null));}; \ No newline at end of file +var _0x97ce=['readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteractionId','read1stAt','format','interaction','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','manual','interface','motionChannel','channel','EventManager','sms','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','email','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','update','plivo','MessageUUID','indexOf','sent','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','groupName','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','client','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','destroy','stack','name','send','index','map','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SmsMessage','includeAll','include','rows','rawAttributes','length','find','catch','body','params','describe','sms-interactions','accept','read'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x97ce,0x151));var _0xe97c=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x97ce[_0x87b0ff];return _0x3bc0b2;};'use strict';var emlformat=require(_0xe97c('0x0'));var rimraf=require(_0xe97c('0x1'));var zipdir=require(_0xe97c('0x2'));var jsonpatch=require(_0xe97c('0x3'));var rp=require('request-promise');var moment=require(_0xe97c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe97c('0x5'));var util=require('util');var path=require(_0xe97c('0x6'));var sox=require(_0xe97c('0x7'));var csv=require(_0xe97c('0x8'));var ejs=require(_0xe97c('0x9'));var fs=require('fs');var fs_extra=require(_0xe97c('0xa'));var _=require(_0xe97c('0xb'));var squel=require('squel');var crypto=require(_0xe97c('0xc'));var jsforce=require(_0xe97c('0xd'));var deskjs=require(_0xe97c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe97c('0xf'));var Papa=require('papaparse');var Redis=require(_0xe97c('0x10'));var authService=require(_0xe97c('0x11'));var qs=require(_0xe97c('0x12'));var as=require(_0xe97c('0x13'));var hardwareService=require(_0xe97c('0x14'));var logger=require(_0xe97c('0x15'))(_0xe97c('0x16'));var utils=require('../../config/utils');var config=require(_0xe97c('0x17'));var licenseUtil=require(_0xe97c('0x18'));var db=require(_0xe97c('0x19'))['db'];config[_0xe97c('0x1a')]=_[_0xe97c('0x1b')](config[_0xe97c('0x1a')],{'host':_0xe97c('0x1c'),'port':0x18eb});var socket=require(_0xe97c('0x1d'))(new Redis(config[_0xe97c('0x1a')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0xe97c('0x1e'));var client=jayson['client'][_0xe97c('0x1f')]({'port':0x232c});var client9002=jayson[_0xe97c('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bf5c7,_0x220396,_0x193a22,_0x1e436d){return new BPromise(function(_0x2e026d,_0x4e73ab){var _0x4e2044=_0x1e436d||client;return _0x4e2044['request'](_0x4bf5c7,_0x193a22)[_0xe97c('0x21')](function(_0x1ceb22){logger[_0xe97c('0x22')]('SmsMessage,\x20%s,\x20%s',_0x220396,_0xe97c('0x23'));logger[_0xe97c('0x24')](_0xe97c('0x25'),_0x220396,_0xe97c('0x23'),JSON[_0xe97c('0x26')](_0x1ceb22));if(_0x1ceb22['error']){if(_0x1ceb22[_0xe97c('0x27')][_0xe97c('0x28')]===0x1f4){logger[_0xe97c('0x27')](_0xe97c('0x29'),_0x220396,_0x1ceb22[_0xe97c('0x27')][_0xe97c('0x2a')]);return _0x4e73ab(_0x1ceb22[_0xe97c('0x27')][_0xe97c('0x2a')]);}logger[_0xe97c('0x27')](_0xe97c('0x29'),_0x220396,_0x1ceb22[_0xe97c('0x27')][_0xe97c('0x2a')]);return _0x2e026d(_0x1ceb22[_0xe97c('0x27')][_0xe97c('0x2a')]);}else{logger[_0xe97c('0x22')](_0xe97c('0x29'),_0x220396,_0xe97c('0x23'));_0x2e026d(_0x1ceb22[_0xe97c('0x2b')][_0xe97c('0x2a')]);}})['catch'](function(_0x23ff1d){logger[_0xe97c('0x27')](_0xe97c('0x29'),_0x220396,_0x23ff1d);_0x4e73ab(_0x23ff1d);});});}function respondWithStatusCode(_0x30914a,_0x61d473){_0x61d473=_0x61d473||0xcc;return function(_0x1bb9d8){if(_0x1bb9d8){return _0x30914a[_0xe97c('0x2c')](_0x61d473);}return _0x30914a[_0xe97c('0x2d')](_0x61d473)[_0xe97c('0x2e')]();};}function respondWithResult(_0x118866,_0x1684d3){_0x1684d3=_0x1684d3||0xc8;return function(_0x11502f){if(_0x11502f){return _0x118866['status'](_0x1684d3)['json'](_0x11502f);}};}function respondWithFilteredResult(_0x132678,_0x1a3f69){return function(_0x1273a2){if(_0x1273a2){var _0x27cfae=typeof _0x1a3f69[_0xe97c('0x2f')]===_0xe97c('0x30')&&typeof _0x1a3f69[_0xe97c('0x31')]==='undefined';var _0x544889=_0x1273a2[_0xe97c('0x32')];var _0x36536c=_0x27cfae?0x0:_0x1a3f69[_0xe97c('0x2f')];var _0x2a21a9=_0x27cfae?_0x1273a2['count']:_0x1a3f69['offset']+_0x1a3f69[_0xe97c('0x31')];var _0x1ab2ac;if(_0x2a21a9>=_0x544889){_0x2a21a9=_0x544889;_0x1ab2ac=0xc8;}else{_0x1ab2ac=0xce;}_0x132678[_0xe97c('0x2d')](_0x1ab2ac);return _0x132678['set']('Content-Range',_0x36536c+'-'+_0x2a21a9+'/'+_0x544889)[_0xe97c('0x33')](_0x1273a2);}return null;};}function patchUpdates(_0x12103b){return function(_0x3d894a){try{jsonpatch[_0xe97c('0x34')](_0x3d894a,_0x12103b,!![]);}catch(_0x30a269){return BPromise[_0xe97c('0x35')](_0x30a269);}return _0x3d894a[_0xe97c('0x36')]();};}function saveUpdates(_0x5177d3,_0x3df60c){return function(_0x26d41f){if(_0x26d41f){return _0x26d41f['update'](_0x5177d3)[_0xe97c('0x21')](function(_0x1a69c){return _0x1a69c;});}return null;};}function removeEntity(_0x142e2c,_0x22db3c){return function(_0x23ae98){if(_0x23ae98){return _0x23ae98[_0xe97c('0x37')]()[_0xe97c('0x21')](function(){_0x142e2c[_0xe97c('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x537611,_0x269f2e){return function(_0x8099a9){if(!_0x8099a9){_0x537611[_0xe97c('0x2c')](0x194);}return _0x8099a9;};}function handleError(_0x34e6f7,_0x4eb2a0){_0x4eb2a0=_0x4eb2a0||0x1f4;return function(_0x132e9e){logger['error'](_0x132e9e[_0xe97c('0x38')]);if(_0x132e9e[_0xe97c('0x39')]){delete _0x132e9e[_0xe97c('0x39')];}_0x34e6f7['status'](_0x4eb2a0)[_0xe97c('0x3a')](_0x132e9e);};}exports[_0xe97c('0x3b')]=function(_0x412e0a,_0xc206e){var _0x2c287c={},_0x5e54f5={},_0x2aa954={'count':0x0,'rows':[]};var _0x2cbd27=_[_0xe97c('0x3c')](db['SmsMessage']['rawAttributes'],function(_0x371830){return{'name':_0x371830['fieldName'],'type':_0x371830[_0xe97c('0x3d')]['key']};});_0x5e54f5['model']=_['map'](_0x2cbd27,_0xe97c('0x39'));_0x5e54f5[_0xe97c('0x3e')]=_[_0xe97c('0x3f')](_0x412e0a[_0xe97c('0x3e')]);_0x5e54f5[_0xe97c('0x40')]=_['intersection'](_0x5e54f5[_0xe97c('0x41')],_0x5e54f5['query']);_0x2c287c[_0xe97c('0x42')]=_[_0xe97c('0x43')](_0x5e54f5[_0xe97c('0x41')],qs[_0xe97c('0x44')](_0x412e0a[_0xe97c('0x3e')][_0xe97c('0x44')]));_0x2c287c[_0xe97c('0x42')]=_0x2c287c[_0xe97c('0x42')]['length']?_0x2c287c[_0xe97c('0x42')]:_0x5e54f5[_0xe97c('0x41')];if(!_0x412e0a[_0xe97c('0x3e')][_0xe97c('0x45')](_0xe97c('0x46'))){_0x2c287c[_0xe97c('0x31')]=qs[_0xe97c('0x31')](_0x412e0a[_0xe97c('0x3e')][_0xe97c('0x31')]);_0x2c287c[_0xe97c('0x2f')]=qs['offset'](_0x412e0a[_0xe97c('0x3e')][_0xe97c('0x2f')]);}_0x2c287c['order']=qs[_0xe97c('0x47')](_0x412e0a[_0xe97c('0x3e')][_0xe97c('0x47')]);_0x2c287c[_0xe97c('0x48')]=qs['filters'](_[_0xe97c('0x49')](_0x412e0a['query'],_0x5e54f5[_0xe97c('0x40')]),_0x2cbd27);if(_0x412e0a[_0xe97c('0x3e')][_0xe97c('0x4a')]){_0x2c287c[_0xe97c('0x48')]=_[_0xe97c('0x4b')](_0x2c287c['where'],{'$or':_[_0xe97c('0x3c')](_0x2cbd27,function(_0x197f35){if(_0x197f35[_0xe97c('0x3d')]!==_0xe97c('0x4c')){var _0x489479={};_0x489479[_0x197f35[_0xe97c('0x39')]]={'$like':'%'+_0x412e0a[_0xe97c('0x3e')]['filter']+'%'};return _0x489479;}})});}_0x2c287c=_[_0xe97c('0x4b')]({},_0x2c287c,_0x412e0a[_0xe97c('0x4d')]);var _0x4f7c04={'where':_0x2c287c['where']};return db[_0xe97c('0x4e')][_0xe97c('0x32')](_0x4f7c04)[_0xe97c('0x21')](function(_0x127b7d){_0x2aa954[_0xe97c('0x32')]=_0x127b7d;if(_0x412e0a[_0xe97c('0x3e')][_0xe97c('0x4f')]){_0x2c287c[_0xe97c('0x50')]=[{'all':!![]}];}return db[_0xe97c('0x4e')]['findAll'](_0x2c287c);})[_0xe97c('0x21')](function(_0x2fd534){_0x2aa954[_0xe97c('0x51')]=_0x2fd534;return _0x2aa954;})[_0xe97c('0x21')](respondWithFilteredResult(_0xc206e,_0x2c287c))['catch'](handleError(_0xc206e,null));};exports['show']=function(_0x12d1ba,_0x762e8a){var _0x506873={'raw':!![],'where':{'id':_0x12d1ba['params']['id']}},_0x3f0148={};_0x3f0148['model']=_['keys'](db[_0xe97c('0x4e')][_0xe97c('0x52')]);_0x3f0148[_0xe97c('0x3e')]=_[_0xe97c('0x3f')](_0x12d1ba[_0xe97c('0x3e')]);_0x3f0148[_0xe97c('0x40')]=_[_0xe97c('0x43')](_0x3f0148[_0xe97c('0x41')],_0x3f0148[_0xe97c('0x3e')]);_0x506873[_0xe97c('0x42')]=_[_0xe97c('0x43')](_0x3f0148[_0xe97c('0x41')],qs[_0xe97c('0x44')](_0x12d1ba[_0xe97c('0x3e')]['fields']));_0x506873[_0xe97c('0x42')]=_0x506873[_0xe97c('0x42')][_0xe97c('0x53')]?_0x506873['attributes']:_0x3f0148[_0xe97c('0x41')];if(_0x12d1ba['query']['includeAll']){_0x506873[_0xe97c('0x50')]=[{'all':!![]}];}_0x506873=_[_0xe97c('0x4b')]({},_0x506873,_0x12d1ba[_0xe97c('0x4d')]);return db['SmsMessage'][_0xe97c('0x54')](_0x506873)[_0xe97c('0x21')](handleEntityNotFound(_0x762e8a,null))[_0xe97c('0x21')](respondWithResult(_0x762e8a,null))[_0xe97c('0x55')](handleError(_0x762e8a,null));};exports['create']=function(_0x5b83e8,_0x476756){return db['SmsMessage']['create'](_0x5b83e8[_0xe97c('0x56')],{})[_0xe97c('0x21')](respondWithResult(_0x476756,0xc9))[_0xe97c('0x55')](handleError(_0x476756,null));};exports['update']=function(_0x189606,_0x586910){if(_0x189606['body']['id']){delete _0x189606[_0xe97c('0x56')]['id'];}return db['SmsMessage'][_0xe97c('0x54')]({'where':{'id':_0x189606[_0xe97c('0x57')]['id']}})[_0xe97c('0x21')](handleEntityNotFound(_0x586910,null))[_0xe97c('0x21')](saveUpdates(_0x189606[_0xe97c('0x56')],null))[_0xe97c('0x21')](respondWithResult(_0x586910,null))[_0xe97c('0x55')](handleError(_0x586910,null));};exports['destroy']=function(_0x5a1cfe,_0x2c1315){return db[_0xe97c('0x4e')]['find']({'where':{'id':_0x5a1cfe[_0xe97c('0x57')]['id']}})['then'](handleEntityNotFound(_0x2c1315,null))[_0xe97c('0x21')](removeEntity(_0x2c1315,null))['catch'](handleError(_0x2c1315,null));};exports[_0xe97c('0x58')]=function(_0x4ff5a5,_0x104325){return db[_0xe97c('0x4e')]['describe']()[_0xe97c('0x21')](respondWithResult(_0x104325,null))[_0xe97c('0x55')](handleError(_0x104325,null));};var interaction_log=require(_0xe97c('0x15'))(_0xe97c('0x59'));exports[_0xe97c('0x5a')]=function(_0x48c658,_0x7fb9e7,_0x3e7146){var _0x766d79={'agent':{},'channel':'sms'};if(_0x48c658[_0xe97c('0x56')]['id']){delete _0x48c658[_0xe97c('0x56')]['id'];}_0x48c658['body'][_0xe97c('0x5b')]=!![];_0x48c658[_0xe97c('0x56')][_0xe97c('0x5c')]=moment()['format'](_0xe97c('0x5d'));_0x48c658[_0xe97c('0x56')][_0xe97c('0x5e')]=_0x48c658[_0xe97c('0x56')][_0xe97c('0x5e')]||_0x48c658[_0xe97c('0x5f')]['id'];_0x766d79[_0xe97c('0x60')]['id']=_0x48c658[_0xe97c('0x56')][_0xe97c('0x5e')];return db[_0xe97c('0x4e')][_0xe97c('0x54')]({'where':{'id':_0x48c658[_0xe97c('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x7fb9e7,null))['then'](saveUpdates(_0x48c658['body'],null))[_0xe97c('0x21')](function(_0x34f311){if(_0x34f311){_0x766d79[_0xe97c('0x2a')]=_0x34f311[_0xe97c('0x61')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x34f311[_0xe97c('0x62')]}});}return null;})[_0xe97c('0x21')](handleEntityNotFound(_0x7fb9e7,null))[_0xe97c('0x21')](function(_0x5c25cc){if(_0x5c25cc){return _0x5c25cc['update']({'UserId':_0x48c658[_0xe97c('0x56')]['UserId'],'read1stAt':_['isNil'](_0x5c25cc[_0xe97c('0x63')])?moment()[_0xe97c('0x64')](_0xe97c('0x5d')):undefined});}return null;})[_0xe97c('0x21')](function(_0x621d36){if(_0x621d36){_0x766d79[_0xe97c('0x65')]=_0x621d36[_0xe97c('0x61')]({'plain':!![]});interaction_log[_0xe97c('0x22')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x48c658['user']['id'],_0x48c658['user']['name'],_0x48c658[_0xe97c('0x5f')][_0xe97c('0x66')],_0x766d79[_0xe97c('0x65')]['id'],_0x48c658['body']?JSON['stringify'](_0x48c658[_0xe97c('0x56')]):_0xe97c('0x67'));return respondWithRpcPromise(_0xe97c('0x68'),_0xe97c('0x69'),_0x766d79);}return null;})['then'](function(_0x226b5c){var _0x5b80a3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x226b5c[_0xe97c('0x2a')][_0xe97c('0x6a')];return db[_0xe97c('0x6b')][_0xe97c('0x3e')](_0x5b80a3,{'type':db[_0xe97c('0x6c')][_0xe97c('0x6d')][_0xe97c('0x6e')],'raw':!![]})['then'](function(_0x2cede6){return _0x2cede6;});})[_0xe97c('0x21')](function(_0x1362d9){if(_0x1362d9){_0x766d79[_0xe97c('0x2a')]['contact']=_0x1362d9[0x0];if(!_0x48c658[_0xe97c('0x56')]['UserId'])return;return db[_0xe97c('0x6f')][_0xe97c('0x54')]({'where':{'id':_0x48c658[_0xe97c('0x56')][_0xe97c('0x5e')],'role':_0xe97c('0x60')},'attributes':['id',_0xe97c('0x39'),_0xe97c('0x70'),'email',_0xe97c('0x71')],'raw':!![]});}return null;})[_0xe97c('0x21')](function(_0x1c2752){if(!_0x1c2752)return null;_0x766d79[_0xe97c('0x2a')][_0xe97c('0x60')]=_0x1c2752;return _0x766d79;})[_0xe97c('0x21')](function(_0x1f5433){if(_0x1f5433){if(_0x48c658[_0xe97c('0x56')][_0xe97c('0x72')]){_0x766d79[_0xe97c('0x2a')][_0xe97c('0x73')]=util[_0xe97c('0x64')]('SIP/%s',_0x48c658['user'][_0xe97c('0x39')]);_0x766d79[_0xe97c('0x2a')]['channel']=_0x766d79['channel'];_0x766d79[_0xe97c('0x2a')][_0xe97c('0x74')]=_0x766d79[_0xe97c('0x75')];_0x766d79[_0xe97c('0x2a')]['event']=_0xe97c('0x5a');return respondWithRpcPromise(_0xe97c('0x76'),_0xe97c('0x76'),{'event':'acceptmessage','message':_0x766d79['message']},client9002)[_0xe97c('0x21')](function(){return _0x766d79;});}return _0x766d79;}return null;})[_0xe97c('0x21')](respondWithResult(_0x7fb9e7,null))[_0xe97c('0x55')](handleError(_0x7fb9e7,null));};var interaction_log=require(_0xe97c('0x15'))(_0xe97c('0x59'));exports[_0xe97c('0x35')]=function(_0x37f2b7,_0x12707d,_0x239cc3){var _0x3882f6={'agent':{},'channel':_0xe97c('0x77')};if(_0x37f2b7[_0xe97c('0x56')]['id']){delete _0x37f2b7['body']['id'];}_0x37f2b7[_0xe97c('0x56')][_0xe97c('0x5e')]=_0x37f2b7[_0xe97c('0x56')][_0xe97c('0x5e')]||_0x37f2b7['user']['id'];_0x3882f6[_0xe97c('0x60')]['id']=_0x37f2b7['body'][_0xe97c('0x5e')];return db[_0xe97c('0x4e')][_0xe97c('0x54')]({'where':{'id':_0x37f2b7[_0xe97c('0x57')]['id'],'UserId':null}})[_0xe97c('0x21')](handleEntityNotFound(_0x12707d,null))[_0xe97c('0x21')](function(_0x1b5c1f){if(_0x1b5c1f){_0x3882f6[_0xe97c('0x2a')]=_0x1b5c1f[_0xe97c('0x61')]({'plain':!![]});return db[_0xe97c('0x78')]['find']({'where':{'id':_0x1b5c1f[_0xe97c('0x62')]}});}return null;})[_0xe97c('0x21')](handleEntityNotFound(_0x12707d,null))[_0xe97c('0x21')](function(_0x2ab86b){if(_0x2ab86b){_0x3882f6[_0xe97c('0x65')]=_0x2ab86b[_0xe97c('0x61')]({'plain':!![]});interaction_log['info'](_0xe97c('0x79'),_0x37f2b7[_0xe97c('0x5f')]['id'],_0x37f2b7['user'][_0xe97c('0x39')],_0x37f2b7[_0xe97c('0x5f')][_0xe97c('0x66')],_0x3882f6['interaction']['id'],_0x37f2b7[_0xe97c('0x56')]?JSON['stringify'](_0x37f2b7[_0xe97c('0x56')]):_0xe97c('0x67'));return respondWithRpcPromise('RejectMessage',_0xe97c('0x7a'),_0x3882f6);}return null;})['then'](function(_0xaf4b4c){var _0x54eb9b=_0xe97c('0x7b')+_0xaf4b4c[_0xe97c('0x2a')][_0xe97c('0x6a')];return db[_0xe97c('0x6b')][_0xe97c('0x3e')](_0x54eb9b,{'type':db[_0xe97c('0x6c')][_0xe97c('0x6d')][_0xe97c('0x6e')],'raw':!![]})['then'](function(_0x5e374d){return _0x5e374d;});})[_0xe97c('0x21')](function(_0x59765c){if(_0x59765c){_0x3882f6[_0xe97c('0x2a')][_0xe97c('0x7c')]=_0x59765c[0x0];if(!_0x37f2b7['body'][_0xe97c('0x5e')])return;return db[_0xe97c('0x6f')][_0xe97c('0x54')]({'where':{'id':_0x37f2b7[_0xe97c('0x56')][_0xe97c('0x5e')],'role':_0xe97c('0x60')},'attributes':['id','name',_0xe97c('0x70'),_0xe97c('0x7d'),_0xe97c('0x71')],'raw':!![]});}return null;})[_0xe97c('0x21')](function(_0x6763b6){if(!_0x6763b6)return null;_0x3882f6[_0xe97c('0x2a')][_0xe97c('0x60')]=_0x6763b6;return _0x3882f6;})[_0xe97c('0x21')](function(_0x3b9a30){if(_0x3b9a30){_0x3b9a30[_0xe97c('0x2a')][_0xe97c('0x73')]=util[_0xe97c('0x64')]('SIP/%s',_0x37f2b7['user'][_0xe97c('0x39')]);_0x3b9a30[_0xe97c('0x2a')][_0xe97c('0x75')]=_0x3882f6[_0xe97c('0x75')];_0x3b9a30[_0xe97c('0x2a')]['motionChannel']=_0x3882f6[_0xe97c('0x75')];_0x3b9a30['message']['event']=_0xe97c('0x35');respondWithRpcPromise(_0xe97c('0x76'),_0xe97c('0x76'),{'event':_0xe97c('0x7e'),'message':_0x3b9a30['message']},client9002);return _0x3882f6;}return null;})['then'](respondWithResult(_0x12707d,null))[_0xe97c('0x55')](handleError(_0x12707d,null));};exports['status']=function(_0x9f8ec8,_0x511cfa,_0x46eb91){if(_0x9f8ec8[_0xe97c('0x56')]['id']){delete _0x9f8ec8[_0xe97c('0x56')]['id'];}var _0xec02db;return db[_0xe97c('0x4e')][_0xe97c('0x54')]({'where':{'id':_0x9f8ec8[_0xe97c('0x57')]['id']}})[_0xe97c('0x21')](handleEntityNotFound(_0x511cfa,null))[_0xe97c('0x21')](function(_0x753668){if(_0x753668){_0xec02db=_0x753668;return db['SmsAccount'][_0xe97c('0x54')]({'where':{'id':_0x753668[_0xe97c('0x7f')]}});}})[_0xe97c('0x21')](handleEntityNotFound(_0x511cfa,null))['then'](function(_0x5bf46d){if(_0x5bf46d){logger[_0xe97c('0x24')](_0xe97c('0x25'),_0xe97c('0x2d'),_0xe97c('0x80'),_0x5bf46d[_0xe97c('0x3d')],util[_0xe97c('0x81')](_0x9f8ec8[_0xe97c('0x56')],{'showHidden':![],'depth':null}));switch(_0x5bf46d[_0xe97c('0x3d')]){case _0xe97c('0x82'):if(_0x9f8ec8['body'][_0xe97c('0x83')]&&_0x9f8ec8[_0xe97c('0x56')]['MessageSid']===_0xec02db[_0xe97c('0x84')]){return _0xec02db[_0xe97c('0x85')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe97c('0x2d'),_0xe97c('0x82'),util[_0xe97c('0x81')](_0x9f8ec8['body'],{'showHidden':![],'depth':null}));}break;case _0xe97c('0x86'):if(_0x9f8ec8[_0xe97c('0x56')][_0xe97c('0x87')]&&_0x9f8ec8['body'][_0xe97c('0x87')]===_0xec02db['messageId']&&_[_0xe97c('0x88')]([_0xe97c('0x89'),'delivered'],_0x9f8ec8[_0xe97c('0x56')][_0xe97c('0x8a')])>=0x0){return _0xec02db[_0xe97c('0x85')]({'read':!![]});}else{logger['error'](_0xe97c('0x8b'),'status',_0xe97c('0x8c'),util[_0xe97c('0x81')](_0x9f8ec8[_0xe97c('0x56')],{'showHidden':![],'depth':null}));}break;case _0xe97c('0x8d'):var _0x5b9766=_0x9f8ec8['body']['results'][0x0];if(_0x5b9766[_0xe97c('0x2d')][_0xe97c('0x8e')]==='DELIVERED'){return _0xec02db[_0xe97c('0x85')]({'read':!![]});}else{logger[_0xe97c('0x27')](_0xe97c('0x8b'),_0xe97c('0x2d'),_0xe97c('0x8d'),util[_0xe97c('0x81')](_0x9f8ec8[_0xe97c('0x56')],{'showHidden':![],'depth':null}));}break;}return _0xec02db;}})['then'](respondWithResult(_0x511cfa,null))[_0xe97c('0x55')](handleError(_0x511cfa,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 6f7858e..2e6dfcb 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 _0xac88=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','update','remove'];(function(_0x4d44ff,_0x4dbe86){var _0x2e9706=function(_0xba1c71){while(--_0xba1c71){_0x4d44ff['push'](_0x4d44ff['shift']());}};_0x2e9706(++_0x4dbe86);}(_0xac88,0x112));var _0x8ac8=function(_0x291024,_0xfbf1b){_0x291024=_0x291024-0x0;var _0x519e58=_0xac88[_0x291024];return _0x519e58;};'use strict';var EventEmitter=require(_0x8ac8('0x0'));var SmsMessage=require(_0x8ac8('0x1'))['db'][_0x8ac8('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8ac8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8ac8('0x4'),'afterDestroy':_0x8ac8('0x5')};function emitEvent(_0x2c879b){return function(_0x194d14,_0x436c89,_0x50ba87){SmsMessageEvents[_0x8ac8('0x6')](_0x2c879b+':'+_0x194d14['id'],_0x194d14);SmsMessageEvents[_0x8ac8('0x6')](_0x2c879b,_0x194d14);_0x50ba87(null);};}for(var e in events){if(events[_0x8ac8('0x7')](e)){var event=events[e];SmsMessage[_0x8ac8('0x8')](e,emitEvent(event));}}module[_0x8ac8('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x581e=['emit','hook','events','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x581e,0x188));var _0xe581=function(_0x38941a,_0x589c16){_0x38941a=_0x38941a-0x0;var _0x49bb30=_0x581e[_0x38941a];return _0x49bb30;};'use strict';var EventEmitter=require(_0xe581('0x0'));var SmsMessage=require(_0xe581('0x1'))['db'][_0xe581('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe581('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3a389a){return function(_0x12a6d3,_0x1ef38b,_0x5d49d7){SmsMessageEvents[_0xe581('0x4')](_0x3a389a+':'+_0x12a6d3['id'],_0x12a6d3);SmsMessageEvents['emit'](_0x3a389a,_0x12a6d3);_0x5d49d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xe581('0x5')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index bbf146c..2f2c5b0 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 _0xb97f=['rimraf','./smsMessage.attributes','exports','define','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','SmsInteractionId','findOne','then','update','createdAt','catch','error','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','smsMethod','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','head','clickSend','plivo','authId','Basic\x20%s','toString','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','csc','crypto','apiKey','text','timestamp','keys','sort','length','createHash','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2f7a78,_0x37febb){var _0x12d6c2=function(_0x45db81){while(--_0x45db81){_0x2f7a78['push'](_0x2f7a78['shift']());}};_0x12d6c2(++_0x37febb);}(_0xb97f,0x71));var _0xfb97=function(_0x5ccfe0,_0x4b3a33){_0x5ccfe0=_0x5ccfe0-0x0;var _0x346997=_0xb97f[_0x5ccfe0];return _0x346997;};'use strict';var _=require(_0xfb97('0x0'));var util=require(_0xfb97('0x1'));var logger=require(_0xfb97('0x2'))('api');var moment=require(_0xfb97('0x3'));var BPromise=require(_0xfb97('0x4'));var rp=require(_0xfb97('0x5'));var fs=require('fs');var path=require(_0xfb97('0x6'));var rimraf=require(_0xfb97('0x7'));var config=require('../../config/environment');var attributes=require(_0xfb97('0x8'));module[_0xfb97('0x9')]=function(_0x22d6c6,_0x3af81b){return _0x22d6c6[_0xfb97('0xa')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xfb97('0xb')]},{'name':_0xfb97('0xc'),'fields':[_0xfb97('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38242b,_0x3aa141,_0x2f6210){var _0x25ce56=_0x22d6c6[_0xfb97('0xe')];var _0x2f0df5=_0x38242b[_0xfb97('0xf')]({'plain':!![]});if(_0x2f0df5[_0xfb97('0x10')][_0xfb97('0x11')]()==='in'||_0x2f0df5['direction'][_0xfb97('0x11')]()===_0xfb97('0x12')&&!_0x2f0df5[_0xfb97('0x13')]&&!_['isNil'](_0x2f0df5['UserId'])&&!_['isNil'](_0x2f0df5[_0xfb97('0x14')])){_0x25ce56['SmsInteraction'][_0xfb97('0x15')]({'where':{'id':_0x2f0df5[_0xfb97('0x14')]}})[_0xfb97('0x16')](function(_0x1d8317){if(_0x1d8317){_0x1d8317[_0xfb97('0x17')]({'lastMsgAt':_0x2f0df5[_0xfb97('0x18')],'lastMsgDirection':_0x2f0df5[_0xfb97('0x10')]['toLowerCase']()});}})[_0xfb97('0x19')](function(_0x1f89ac){console[_0xfb97('0x1a')](_0x1f89ac);});}if(_0x2f0df5[_0xfb97('0x10')]===_0xfb97('0x12')&&!_0x2f0df5[_0xfb97('0x13')]){var _0x130267;_0x25ce56[_0xfb97('0x1b')][_0xfb97('0x1c')]({'where':{'id':_0x2f0df5['SmsAccountId']},'raw':!![]})[_0xfb97('0x16')](function(_0xd9e9a7){_0x130267=_0xd9e9a7;if(_0x130267&&_0x130267['type']){switch(_0x130267[_0xfb97('0x1d')]){case _0xfb97('0x1e'):var _0x308375=require(_0xfb97('0x1e'));if(_0x130267[_0xfb97('0x1f')]&&_0x130267[_0xfb97('0x20')]&&_0x130267[_0xfb97('0x21')]){var _0x4f5ae7=new _0x308375(_0x130267[_0xfb97('0x1f')],_0x130267[_0xfb97('0x20')]);_0x4f5ae7[_0xfb97('0x22')][_0xfb97('0x23')]({'body':_0x2f0df5['body'],'to':_0x2f0df5[_0xfb97('0x21')],'from':_0x130267['phone'],'statusCallback':_0x130267[_0xfb97('0x24')]+_0xfb97('0x25')+_0x2f0df5['id']+_0xfb97('0x26')+_0x130267[_0xfb97('0x27')]})[_0xfb97('0x16')](function(_0x168984){if(_0x168984[_0xfb97('0x28')]){return _0x38242b['update']({'messageId':_0x168984[_0xfb97('0x28')]});}})[_0xfb97('0x19')](function(_0x48a55a){logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x1e'),util['inspect'](_0x48a55a,{'showHidden':![],'depth':null}));});}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x1e'),_0xfb97('0x2b'));}break;case _0xfb97('0x2c'):var _0x5008e4=_0xfb97('0x2d');if(_0x130267[_0xfb97('0x2e')]&&_0x130267[_0xfb97('0x2f')]){var _0x319316={'recipient':[_0x2f0df5[_0xfb97('0x21')]],'message':_0x2f0df5[_0xfb97('0xd')],'message_type':_0x130267['smsMethod']};if(_0x130267['smsMethod']&&_0x130267['smsMethod']!=='SI'){_0x319316[_0xfb97('0x30')]=_0x130267[_0xfb97('0x21')];}var _0x3e200b={'url':_0x5008e4+_0xfb97('0x31')+_0x130267['username']+_0xfb97('0x32')+_0x130267[_0xfb97('0x2f')],'method':_0xfb97('0x33')};rp(_0x3e200b)[_0xfb97('0x16')](function(_0x3806cc){var _0x60b7d6=_0x3806cc[_0xfb97('0x34')](';');var _0x956a3={'user_key':_0x60b7d6[0x0],'session_key':_0x60b7d6[0x1]};_0x3e200b={'url':_0x5008e4+_0xfb97('0x35'),'method':_0xfb97('0x36'),'headers':{'user_key':_0x956a3[_0xfb97('0x37')],'Session_key':_0x956a3[_0xfb97('0x38')]},'json':!![],'body':_0x319316};return rp(_0x3e200b);})[_0xfb97('0x16')](function(_0x224be8){if(_0x224be8[_0xfb97('0x39')]>=0x1){var _0x3a649c={'messageId':_0x224be8[_0xfb97('0x3a')]};if(_0x130267[_0xfb97('0x3b')]!=='GP'||!_0x130267[_0xfb97('0x3c')]){_0x3a649c[_0xfb97('0x3d')]=!![];}return _0x38242b['update'](_0x3a649c);}else{return logger[_0xfb97('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb97('0x2a'),'skebby',util[_0xfb97('0x3e')](_0x224be8,{'showHidden':![],'depth':null}));}})[_0xfb97('0x19')](function(_0x181147){return logger['error'](_0xfb97('0x29'),'afterCreate',_0xfb97('0x2c'),util[_0xfb97('0x3e')](_0x181147,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfb97('0x2c'),_0xfb97('0x3f'));}break;case _0xfb97('0x40'):if(_0x130267[_0xfb97('0x20')]){var _0x5602ec={'recipient':_0x2f0df5[_0xfb97('0x21')],'message':_0x2f0df5[_0xfb97('0xd')],'sender':_0x130267[_0xfb97('0x41')]||_0x130267[_0xfb97('0x21')],'authorization':_0x130267['authToken']};var _0x3aa141={'method':_0xfb97('0x36'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x5602ec,'json':!![]};rp(_0x3aa141)[_0xfb97('0x16')](function(_0x7b06fe){var _0x492f67={'messageId':_0x7b06fe['requestid']};if(!_0x130267[_0xfb97('0x3c')]){_0x492f67[_0xfb97('0x3d')]=!![];}return _0x38242b[_0xfb97('0x17')](_0x492f67);})[_0xfb97('0x19')](function(_0x4011e0){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb97('0x2a'),'connectel',util[_0xfb97('0x3e')](_0x4011e0,{'showHidden':![],'depth':null}));});}else{logger[_0xfb97('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb97('0x2a'),'connectel',_0xfb97('0x42'));}break;case _0xfb97('0x43'):if(_0x130267[_0xfb97('0x2e')]&&_0x130267[_0xfb97('0x2f')]){var _0x5602ec={'messages':[{'source':'xCALLY\x20Motion','to':_0x2f0df5[_0xfb97('0x21')],'body':_0x2f0df5[_0xfb97('0xd')],'from':_0x130267[_0xfb97('0x41')]||_0x130267[_0xfb97('0x21')]}]};var _0x1c4ca0=util[_0xfb97('0x44')](_0xfb97('0x45'),_0x130267['username'],_0x130267[_0xfb97('0x2f')]);var _0x3aa141={'method':_0xfb97('0x36'),'uri':_0xfb97('0x46'),'body':_0x5602ec,'headers':{'Authorization':util[_0xfb97('0x44')]('Basic\x20%s',new Buffer(_0x1c4ca0)['toString'](_0xfb97('0x47')))},'json':!![]};rp(_0x3aa141)['then'](function(_0xad4f75){if(_0xad4f75[_0xfb97('0x48')]>=0xc8&&_0xad4f75['http_code']<=0xce){if(_0xad4f75['data']&&_0xad4f75[_0xfb97('0x49')][_0xfb97('0x4a')]>0x0){var _0x145152=_[_0xfb97('0x4b')](_0xad4f75[_0xfb97('0x49')][_0xfb97('0x22')]);var _0xa2df17={'messageId':_0x145152['message_id']};if(!_0x130267[_0xfb97('0x3c')]){_0xa2df17['read']=!![];}return _0x38242b[_0xfb97('0x17')](_0xa2df17);}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x4c'),util[_0xfb97('0x3e')](_0xad4f75,{'showHidden':![],'depth':null}));}}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x4c'),util['inspect'](_0xad4f75,{'showHidden':![],'depth':null}));}})[_0xfb97('0x19')](function(_0x466e91){logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x4c'),util[_0xfb97('0x3e')](_0x466e91,{'showHidden':![],'depth':null}));});}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),'afterCreate',_0xfb97('0x4c'),_0xfb97('0x3f'));}break;case _0xfb97('0x4d'):if(_0x130267['authId']&&_0x130267[_0xfb97('0x20')]){var _0x5602ec={'dst':_0x2f0df5[_0xfb97('0x21')],'text':_0x2f0df5[_0xfb97('0xd')],'src':_0x130267[_0xfb97('0x41')]||_0x130267[_0xfb97('0x21')],'url':_0x130267[_0xfb97('0x24')]+_0xfb97('0x25')+_0x2f0df5['id']+'/status?token='+_0x130267[_0xfb97('0x27')]};var _0x1c4ca0=util[_0xfb97('0x44')](_0xfb97('0x45'),_0x130267[_0xfb97('0x4e')],_0x130267[_0xfb97('0x20')]);var _0x3aa141={'method':'POST','uri':util[_0xfb97('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x130267['authId']),'body':_0x5602ec,'headers':{'Authorization':util[_0xfb97('0x44')](_0xfb97('0x4f'),new Buffer(_0x1c4ca0)[_0xfb97('0x50')](_0xfb97('0x47')))},'json':!![]};rp(_0x3aa141)[_0xfb97('0x16')](function(_0x34591e){var _0x2896ea={'messageId':_0x34591e[_0xfb97('0x51')][0x0]};return _0x38242b['update'](_0x2896ea);})[_0xfb97('0x19')](function(_0x20d1fb){logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x4d'),util['inspect'](_0x20d1fb,{'showHidden':![],'depth':null}));});}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xfb97('0x52'):if(_0x130267[_0xfb97('0x2e')]&&_0x130267[_0xfb97('0x2f')]){if(_0x130267[_0xfb97('0x53')]){var _0x35ac0a={'method':_0xfb97('0x36'),'uri':_0x130267['baseUrl']+_0xfb97('0x54'),'body':{'username':_0x130267[_0xfb97('0x2e')],'password':_0x130267[_0xfb97('0x2f')]},'json':!![]};return rp(_0x35ac0a)[_0xfb97('0x16')](function(_0x47e535){var _0x585612={'method':_0xfb97('0x36'),'uri':_0x130267[_0xfb97('0x53')]+_0xfb97('0x55'),'body':{'messages':[{'from':_0x130267[_0xfb97('0x21')],'destinations':[{'to':_0x2f0df5[_0xfb97('0x21')]}],'text':_0x2f0df5[_0xfb97('0xd')],'notifyUrl':_0x130267['remote']+_0xfb97('0x25')+_0x2f0df5['id']+'/status?token='+_0x130267[_0xfb97('0x27')],'notifyContentType':'application/json','callbackData':_0x130267['phone']+';'+_0x2f0df5[_0xfb97('0xd')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x47e535[_0xfb97('0x27')]},'json':!![]};return rp(_0x585612)['then'](function(_0x15580e){if(_0x15580e[_0xfb97('0x22')]){var _0x4889f6={'messageId':_0x15580e[_0xfb97('0x22')][0x0][_0xfb97('0xb')]};if(!_0x130267['deliveryReport']){_0x4889f6[_0xfb97('0x3d')]=!![];}return _0x38242b[_0xfb97('0x17')](_0x4889f6);}else{return logger['error'](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x52'),util[_0xfb97('0x3e')](_0x15580e,{'showHidden':![],'depth':null}));}});})[_0xfb97('0x19')](function(_0x4be959){return logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x52'),util[_0xfb97('0x3e')](_0x4be959,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x52'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xfb97('0x56'):var _0x56c201=require(_0xfb97('0x57'));if(_0x130267[_0xfb97('0x58')]){var _0x2eb37b={};_0x2eb37b['login']=_0x130267[_0xfb97('0x2e')];_0x2eb37b[_0xfb97('0x21')]=_0x2f0df5[_0xfb97('0x21')];_0x2eb37b['sender']=_0x130267[_0xfb97('0x21')];_0x2eb37b[_0xfb97('0x59')]=_0x2f0df5[_0xfb97('0xd')];_0x2eb37b[_0xfb97('0x5a')]=+new Date();var _0x122416='';var _0x48525e='';var _0x4ca550=Object[_0xfb97('0x5b')](_0x2eb37b);_0x4ca550[_0xfb97('0x5c')]();for(var _0xd7f1f8=0x0;_0xd7f1f8<_0x4ca550[_0xfb97('0x5d')];_0xd7f1f8++){if(_0x122416!=''){_0x122416+='&';}_0x122416+=_0x4ca550[_0xd7f1f8]+'='+encodeURIComponent(_0x2eb37b[_0x4ca550[_0xd7f1f8]]);_0x48525e+=_0x2eb37b[_0x4ca550[_0xd7f1f8]];}_0x48525e+=_0x130267[_0xfb97('0x58')];_0x48525e=_0x56c201[_0xfb97('0x5e')]('md5')[_0xfb97('0x17')](_0x48525e)[_0xfb97('0x5f')](_0xfb97('0x60'));if(_0x122416!==''){_0x122416+='&';}_0x122416+=_0xfb97('0x61')+_0x48525e;var _0x3e200b={'method':_0xfb97('0x33'),'uri':_0x130267[_0xfb97('0x53')]+_0xfb97('0x62')+_0x122416,'json':!![]};return rp(_0x3e200b)[_0xfb97('0x16')](function(_0x5d493c){var _0x93e259=Object[_0xfb97('0x5b')](_0x5d493c);if(_0x5d493c[_0x93e259[0x0]][_0xfb97('0x1a')]&&parseInt(_0x5d493c[_0x93e259[0x0]][_0xfb97('0x1a')])===0x0){var _0x5f3681={'messageId':_0x5d493c[_0x93e259[0x0]]['id_sms']};if(!_0x130267[_0xfb97('0x3c')]){_0x5f3681[_0xfb97('0x3d')]=!![];}return _0x38242b[_0xfb97('0x17')](_0x5f3681);}else{return logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x56'),util[_0xfb97('0x3e')](_0x5d493c[_0xfb97('0x1a')],{'showHidden':![],'depth':null}));}})[_0xfb97('0x19')](function(_0x554ac0){return logger[_0xfb97('0x1a')](_0xfb97('0x29'),'afterCreate',_0xfb97('0x56'),util[_0xfb97('0x3e')](_0x554ac0,{'showHidden':![],'depth':null}));});}else{logger[_0xfb97('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfb97('0x56'),_0xfb97('0x63'));}break;case _0xfb97('0x64'):if(_0x130267['apiKey']){var _0x246d1b={'method':'POST','uri':_0xfb97('0x65'),'headers':{'Authorization':_0x130267['apiKey']},'body':{'content':_0x2f0df5[_0xfb97('0xd')],'to':[_0x2f0df5['phone']],'from':_0x130267[_0xfb97('0x21')],'binary':![],'clientMessageId':'uuid','charset':_0xfb97('0x66')},'json':!![]};rp(_0x246d1b)[_0xfb97('0x16')](function(_0x57bf86){if(!_0x57bf86['error']){var _0x566a99={'messageId':_0x57bf86[_0xfb97('0x22')][0x0][_0xfb97('0x67')]};if(!_0x130267[_0xfb97('0x3c')]){_0x566a99[_0xfb97('0x3d')]=!![];}return _0x38242b[_0xfb97('0x17')](_0x566a99);}else{return logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),'clickatell',util['inspect'](_0x57bf86[_0xfb97('0x1a')],{'showHidden':![],'depth':null}));}})[_0xfb97('0x19')](function(_0x83f1d5){return logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x64'),util['inspect'](_0x83f1d5,{'showHidden':![],'depth':null}));});}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x64'),'Missing\x20parameters:\x20apiKey');}break;case _0xfb97('0x68'):if(_0x130267[_0xfb97('0x2e')]&&_0x130267[_0xfb97('0x2f')]){var _0x1c4ca0=util[_0xfb97('0x44')]('%s:%s',_0x130267[_0xfb97('0x2e')],_0x130267[_0xfb97('0x2f')]);var _0x3aa141={'method':_0xfb97('0x36'),'uri':_0xfb97('0x69')+_0x130267[_0xfb97('0x6a')]+'/messages','body':{'to':[_0x2f0df5[_0xfb97('0x21')]],'text':_0x2f0df5[_0xfb97('0xd')],'from':_0x130267[_0xfb97('0x21')],'applicationId':_0x130267[_0xfb97('0x6b')]},'headers':{'Authorization':util['format'](_0xfb97('0x4f'),new Buffer(_0x1c4ca0)['toString']('base64'))},'json':!![]};rp(_0x3aa141)['then'](function(_0x49b051){if(_0x49b051['id']){var _0xb6ec5b={'messageId':_0x49b051['id']};return _0x38242b['update'](_0xb6ec5b);}else{logger[_0xfb97('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb97('0x2a'),_0xfb97('0x68'),util['inspect'](_0x49b051,{'showHidden':![],'depth':null}));}})[_0xfb97('0x19')](function(_0x5e4ede){logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x68'),util[_0xfb97('0x3e')](_0x5e4ede,{'showHidden':![],'depth':null}));});}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),'bandwidth',_0xfb97('0x3f'));}break;case'intelepeer':if(_0x130267[_0xfb97('0x58')]){var _0x52355d={};var _0x3e200b={'method':_0xfb97('0x36'),'uri':_0xfb97('0x6c'),'headers':{'Authorization':_0xfb97('0x6d')+_0x130267[_0xfb97('0x58')],'Content-Type':_0xfb97('0x6e')},'body':{'from':_0x130267['phone'],'to':_0x2f0df5[_0xfb97('0x21')],'text':_0x2f0df5[_0xfb97('0xd')]},'json':!![]};return rp(_0x3e200b)[_0xfb97('0x16')](function(_0x2db4f7){if(_0x2db4f7[_0xfb97('0x6f')]==0xca){_0x52355d[_0xfb97('0x70')]=_0x2db4f7;var _0x29b0db={'method':_0xfb97('0x36'),'uri':_0xfb97('0x71'),'headers':{'Authorization':_0xfb97('0x6d')+_0x130267[_0xfb97('0x58')],'Content-Type':_0xfb97('0x6e')},'body':{'refid':_0x52355d['message'][_0xfb97('0x72')]},'json':!![]};return rp(_0x29b0db)[_0xfb97('0x16')](function(_0x248d85){_0x52355d[_0xfb97('0x73')]=_0x248d85;var _0x5b2a5e={'messageId':_0x52355d[_0xfb97('0x70')]['refid'],'read':!![]};return _0x38242b[_0xfb97('0x17')](_0x5b2a5e);});}else{return logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),'intelepeer',util[_0xfb97('0x3e')](_0x2db4f7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4c4940){return logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x74'),util[_0xfb97('0x3e')](_0x4c4940,{'showHidden':![],'depth':null}));});}else{return logger[_0xfb97('0x1a')](_0xfb97('0x29'),'afterCreate',_0xfb97('0x74'),_0xfb97('0x75'));}break;}}})[_0xfb97('0x76')](function(){_0x2f6210();});}else{_0x2f6210();}}},'charset':_0xfb97('0x77'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4364=['xCALLY\x20Motion','senderString','format','%s:%s','Basic\x20%s','toString','base64','data','queued_count','head','message_id','clickSend','authId','/status?token=','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','remote','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','apiKey','text','timestamp','keys','sort','length','md5','digest','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','/messages','bandwidth','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsMessage.attributes','exports','define','SmsMessage','messageId','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','catch','error','secret','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','/api/sms/messages/','then','update','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend'];(function(_0x20ba81,_0x55b5e2){var _0x53e951=function(_0x191abf){while(--_0x191abf){_0x20ba81['push'](_0x20ba81['shift']());}};_0x53e951(++_0x55b5e2);}(_0x4364,0x198));var _0x4436=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x4364[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require(_0x4436('0x0'));var logger=require(_0x4436('0x1'))(_0x4436('0x2'));var moment=require(_0x4436('0x3'));var BPromise=require(_0x4436('0x4'));var rp=require(_0x4436('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4436('0x6'));var config=require('../../config/environment');var attributes=require(_0x4436('0x7'));module[_0x4436('0x8')]=function(_0x54aa5b,_0x38bb8c){return _0x54aa5b[_0x4436('0x9')](_0x4436('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x4436('0xb'),'fields':[_0x4436('0xb')]},{'name':'fti_sms_messages','fields':[_0x4436('0xc')],'type':_0x4436('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x11b46b,_0x14ebe2,_0x2d06ee){var _0x4d35ab=_0x54aa5b['models'];var _0x5de6c1=_0x11b46b[_0x4436('0xe')]({'plain':!![]});if(_0x5de6c1[_0x4436('0xf')]['toLowerCase']()==='in'||_0x5de6c1[_0x4436('0xf')][_0x4436('0x10')]()===_0x4436('0x11')&&!_0x5de6c1['secret']&&!_[_0x4436('0x12')](_0x5de6c1[_0x4436('0x13')])&&!_[_0x4436('0x12')](_0x5de6c1[_0x4436('0x14')])){_0x4d35ab[_0x4436('0x15')][_0x4436('0x16')]({'where':{'id':_0x5de6c1['SmsInteractionId']}})['then'](function(_0x4da8a3){if(_0x4da8a3){_0x4da8a3['update']({'lastMsgAt':_0x5de6c1['createdAt'],'lastMsgDirection':_0x5de6c1[_0x4436('0xf')][_0x4436('0x10')]()});}})[_0x4436('0x17')](function(_0x450e13){console[_0x4436('0x18')](_0x450e13);});}if(_0x5de6c1['direction']===_0x4436('0x11')&&!_0x5de6c1[_0x4436('0x19')]){var _0x3c453d;_0x4d35ab[_0x4436('0x1a')]['find']({'where':{'id':_0x5de6c1[_0x4436('0x1b')]},'raw':!![]})['then'](function(_0x2f944c){_0x3c453d=_0x2f944c;if(_0x3c453d&&_0x3c453d[_0x4436('0x1c')]){switch(_0x3c453d[_0x4436('0x1c')]){case _0x4436('0x1d'):var _0x253c57=require(_0x4436('0x1d'));if(_0x3c453d[_0x4436('0x1e')]&&_0x3c453d[_0x4436('0x1f')]&&_0x3c453d[_0x4436('0x20')]){var _0x115790=new _0x253c57(_0x3c453d[_0x4436('0x1e')],_0x3c453d[_0x4436('0x1f')]);_0x115790[_0x4436('0x21')][_0x4436('0x22')]({'body':_0x5de6c1['body'],'to':_0x5de6c1[_0x4436('0x20')],'from':_0x3c453d[_0x4436('0x20')],'statusCallback':_0x3c453d['remote']+_0x4436('0x23')+_0x5de6c1['id']+'/status?token='+_0x3c453d['token']})[_0x4436('0x24')](function(_0x2c45c6){if(_0x2c45c6['sid']){return _0x11b46b[_0x4436('0x25')]({'messageId':_0x2c45c6[_0x4436('0x26')]});}})['catch'](function(_0x1f5580){logger[_0x4436('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4436('0x27'),_0x4436('0x1d'),util[_0x4436('0x28')](_0x1f5580,{'showHidden':![],'depth':null}));});}else{logger[_0x4436('0x18')](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x1d'),_0x4436('0x2a'));}break;case _0x4436('0x2b'):var _0x316014=_0x4436('0x2c');if(_0x3c453d[_0x4436('0x2d')]&&_0x3c453d[_0x4436('0x2e')]){var _0x5e695c={'recipient':[_0x5de6c1['phone']],'message':_0x5de6c1[_0x4436('0xc')],'message_type':_0x3c453d[_0x4436('0x2f')]};if(_0x3c453d['smsMethod']&&_0x3c453d[_0x4436('0x2f')]!=='SI'){_0x5e695c[_0x4436('0x30')]=_0x3c453d[_0x4436('0x20')];}var _0x3e2897={'url':_0x316014+'login?username='+_0x3c453d[_0x4436('0x2d')]+'&password='+_0x3c453d['password'],'method':_0x4436('0x31')};rp(_0x3e2897)[_0x4436('0x24')](function(_0x4d6b76){var _0x261237=_0x4d6b76[_0x4436('0x32')](';');var _0x5af568={'user_key':_0x261237[0x0],'session_key':_0x261237[0x1]};_0x3e2897={'url':_0x316014+_0x4436('0x33'),'method':_0x4436('0x34'),'headers':{'user_key':_0x5af568[_0x4436('0x35')],'Session_key':_0x5af568[_0x4436('0x36')]},'json':!![],'body':_0x5e695c};return rp(_0x3e2897);})[_0x4436('0x24')](function(_0x22b8ba){if(_0x22b8ba[_0x4436('0x37')]>=0x1){var _0x41de86={'messageId':_0x22b8ba['internal_order_id']};if(_0x3c453d[_0x4436('0x2f')]!=='GP'||!_0x3c453d[_0x4436('0x38')]){_0x41de86['read']=!![];}return _0x11b46b['update'](_0x41de86);}else{return logger[_0x4436('0x18')](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x2b'),util[_0x4436('0x28')](_0x22b8ba,{'showHidden':![],'depth':null}));}})[_0x4436('0x17')](function(_0x36be8e){return logger['error'](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x2b'),util['inspect'](_0x36be8e,{'showHidden':![],'depth':null}));});}else{logger[_0x4436('0x18')](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x2b'),_0x4436('0x39'));}break;case _0x4436('0x3a'):if(_0x3c453d['authToken']){var _0x5d9b30={'recipient':_0x5de6c1['phone'],'message':_0x5de6c1[_0x4436('0xc')],'sender':_0x3c453d['senderString']||_0x3c453d['phone'],'authorization':_0x3c453d[_0x4436('0x1f')]};var _0x14ebe2={'method':_0x4436('0x34'),'uri':_0x4436('0x3b'),'body':_0x5d9b30,'json':!![]};rp(_0x14ebe2)[_0x4436('0x24')](function(_0xe7cab3){var _0x3c76ad={'messageId':_0xe7cab3[_0x4436('0x3c')]};if(!_0x3c453d['deliveryReport']){_0x3c76ad[_0x4436('0x3d')]=!![];}return _0x11b46b['update'](_0x3c76ad);})['catch'](function(_0x5c8221){logger[_0x4436('0x18')](_0x4436('0x29'),'afterCreate',_0x4436('0x3a'),util[_0x4436('0x28')](_0x5c8221,{'showHidden':![],'depth':null}));});}else{logger[_0x4436('0x18')](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x3a'),_0x4436('0x3e'));}break;case _0x4436('0x3f'):if(_0x3c453d[_0x4436('0x2d')]&&_0x3c453d['password']){var _0x5d9b30={'messages':[{'source':_0x4436('0x40'),'to':_0x5de6c1[_0x4436('0x20')],'body':_0x5de6c1[_0x4436('0xc')],'from':_0x3c453d[_0x4436('0x41')]||_0x3c453d[_0x4436('0x20')]}]};var _0x158a8=util[_0x4436('0x42')](_0x4436('0x43'),_0x3c453d[_0x4436('0x2d')],_0x3c453d['password']);var _0x14ebe2={'method':_0x4436('0x34'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x5d9b30,'headers':{'Authorization':util['format'](_0x4436('0x44'),new Buffer(_0x158a8)[_0x4436('0x45')](_0x4436('0x46')))},'json':!![]};rp(_0x14ebe2)[_0x4436('0x24')](function(_0x3889d7){if(_0x3889d7['http_code']>=0xc8&&_0x3889d7['http_code']<=0xce){if(_0x3889d7[_0x4436('0x47')]&&_0x3889d7[_0x4436('0x47')][_0x4436('0x48')]>0x0){var _0x1b9efb=_[_0x4436('0x49')](_0x3889d7[_0x4436('0x47')][_0x4436('0x21')]);var _0x51e110={'messageId':_0x1b9efb[_0x4436('0x4a')]};if(!_0x3c453d[_0x4436('0x38')]){_0x51e110['read']=!![];}return _0x11b46b[_0x4436('0x25')](_0x51e110);}else{logger[_0x4436('0x18')](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x4b'),util[_0x4436('0x28')](_0x3889d7,{'showHidden':![],'depth':null}));}}else{logger[_0x4436('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4436('0x27'),'clickSend',util[_0x4436('0x28')](_0x3889d7,{'showHidden':![],'depth':null}));}})[_0x4436('0x17')](function(_0x155a86){logger[_0x4436('0x18')](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x4b'),util['inspect'](_0x155a86,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x4b'),_0x4436('0x39'));}break;case'plivo':if(_0x3c453d[_0x4436('0x4c')]&&_0x3c453d[_0x4436('0x1f')]){var _0x5d9b30={'dst':_0x5de6c1['phone'],'text':_0x5de6c1[_0x4436('0xc')],'src':_0x3c453d['senderString']||_0x3c453d[_0x4436('0x20')],'url':_0x3c453d['remote']+_0x4436('0x23')+_0x5de6c1['id']+_0x4436('0x4d')+_0x3c453d[_0x4436('0x4e')]};var _0x158a8=util['format'](_0x4436('0x43'),_0x3c453d[_0x4436('0x4c')],_0x3c453d[_0x4436('0x1f')]);var _0x14ebe2={'method':_0x4436('0x34'),'uri':util['format'](_0x4436('0x4f'),_0x3c453d['authId']),'body':_0x5d9b30,'headers':{'Authorization':util[_0x4436('0x42')](_0x4436('0x44'),new Buffer(_0x158a8)[_0x4436('0x45')]('base64'))},'json':!![]};rp(_0x14ebe2)[_0x4436('0x24')](function(_0x2e31fb){var _0x101562={'messageId':_0x2e31fb[_0x4436('0x50')][0x0]};return _0x11b46b[_0x4436('0x25')](_0x101562);})[_0x4436('0x17')](function(_0x36a5e2){logger[_0x4436('0x18')](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x51'),util['inspect'](_0x36a5e2,{'showHidden':![],'depth':null}));});}else{logger[_0x4436('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4436('0x51'),_0x4436('0x52'));}break;case _0x4436('0x53'):if(_0x3c453d['username']&&_0x3c453d['password']){if(_0x3c453d[_0x4436('0x54')]){var _0x1f823c={'method':'POST','uri':_0x3c453d['baseUrl']+'/auth/1/session','body':{'username':_0x3c453d[_0x4436('0x2d')],'password':_0x3c453d[_0x4436('0x2e')]},'json':!![]};return rp(_0x1f823c)[_0x4436('0x24')](function(_0x1734a6){var _0x30542a={'method':'POST','uri':_0x3c453d[_0x4436('0x54')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3c453d[_0x4436('0x20')],'destinations':[{'to':_0x5de6c1[_0x4436('0x20')]}],'text':_0x5de6c1[_0x4436('0xc')],'notifyUrl':_0x3c453d[_0x4436('0x55')]+_0x4436('0x23')+_0x5de6c1['id']+_0x4436('0x4d')+_0x3c453d[_0x4436('0x4e')],'notifyContentType':_0x4436('0x56'),'callbackData':_0x3c453d[_0x4436('0x20')]+';'+_0x5de6c1['body']}]},'headers':{'Authorization':_0x4436('0x57')+_0x1734a6['token']},'json':!![]};return rp(_0x30542a)['then'](function(_0x542ded){if(_0x542ded['messages']){var _0x83a287={'messageId':_0x542ded[_0x4436('0x21')][0x0][_0x4436('0xb')]};if(!_0x3c453d[_0x4436('0x38')]){_0x83a287[_0x4436('0x3d')]=!![];}return _0x11b46b[_0x4436('0x25')](_0x83a287);}else{return logger[_0x4436('0x18')](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x53'),util[_0x4436('0x28')](_0x542ded,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x1dcd59){return logger['error'](_0x4436('0x29'),_0x4436('0x27'),'infobip',util['inspect'](_0x1dcd59,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x53'),_0x4436('0x58'));}}else{logger['error'](_0x4436('0x29'),_0x4436('0x27'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0x4436('0x59'):var _0x529717=require('crypto');if(_0x3c453d[_0x4436('0x5a')]){var _0x392993={};_0x392993['login']=_0x3c453d[_0x4436('0x2d')];_0x392993[_0x4436('0x20')]=_0x5de6c1[_0x4436('0x20')];_0x392993['sender']=_0x3c453d['phone'];_0x392993[_0x4436('0x5b')]=_0x5de6c1[_0x4436('0xc')];_0x392993[_0x4436('0x5c')]=+new Date();var _0x493ea4='';var _0x53f153='';var _0x381d94=Object[_0x4436('0x5d')](_0x392993);_0x381d94[_0x4436('0x5e')]();for(var _0x584345=0x0;_0x584345<_0x381d94[_0x4436('0x5f')];_0x584345++){if(_0x493ea4!=''){_0x493ea4+='&';}_0x493ea4+=_0x381d94[_0x584345]+'='+encodeURIComponent(_0x392993[_0x381d94[_0x584345]]);_0x53f153+=_0x392993[_0x381d94[_0x584345]];}_0x53f153+=_0x3c453d['apiKey'];_0x53f153=_0x529717['createHash'](_0x4436('0x60'))[_0x4436('0x25')](_0x53f153)[_0x4436('0x61')]('hex');if(_0x493ea4!==''){_0x493ea4+='&';}_0x493ea4+=_0x4436('0x62')+_0x53f153;var _0x3e2897={'method':_0x4436('0x31'),'uri':_0x3c453d[_0x4436('0x54')]+_0x4436('0x63')+_0x493ea4,'json':!![]};return rp(_0x3e2897)[_0x4436('0x24')](function(_0x2ce513){var _0x5336ce=Object[_0x4436('0x5d')](_0x2ce513);if(_0x2ce513[_0x5336ce[0x0]][_0x4436('0x18')]&&parseInt(_0x2ce513[_0x5336ce[0x0]][_0x4436('0x18')])===0x0){var _0x719ca6={'messageId':_0x2ce513[_0x5336ce[0x0]]['id_sms']};if(!_0x3c453d['deliveryReport']){_0x719ca6[_0x4436('0x3d')]=!![];}return _0x11b46b[_0x4436('0x25')](_0x719ca6);}else{return logger['error'](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x59'),util[_0x4436('0x28')](_0x2ce513['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3d5cd8){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4436('0x27'),_0x4436('0x59'),util['inspect'](_0x3d5cd8,{'showHidden':![],'depth':null}));});}else{logger[_0x4436('0x18')](_0x4436('0x29'),_0x4436('0x27'),'csc',_0x4436('0x64'));}break;case _0x4436('0x65'):if(_0x3c453d['apiKey']){var _0x98f930={'method':_0x4436('0x34'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3c453d['apiKey']},'body':{'content':_0x5de6c1['body'],'to':[_0x5de6c1[_0x4436('0x20')]],'from':_0x3c453d['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x4436('0x66')},'json':!![]};rp(_0x98f930)[_0x4436('0x24')](function(_0x350b53){if(!_0x350b53[_0x4436('0x18')]){var _0x575b7c={'messageId':_0x350b53[_0x4436('0x21')][0x0][_0x4436('0x67')]};if(!_0x3c453d[_0x4436('0x38')]){_0x575b7c[_0x4436('0x3d')]=!![];}return _0x11b46b[_0x4436('0x25')](_0x575b7c);}else{return logger[_0x4436('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x4436('0x65'),util[_0x4436('0x28')](_0x350b53['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0xb1962d){return logger['error'](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x65'),util['inspect'](_0xb1962d,{'showHidden':![],'depth':null}));});}else{logger[_0x4436('0x18')](_0x4436('0x29'),'afterCreate',_0x4436('0x65'),'Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x3c453d[_0x4436('0x2d')]&&_0x3c453d['password']){var _0x158a8=util[_0x4436('0x42')](_0x4436('0x43'),_0x3c453d[_0x4436('0x2d')],_0x3c453d[_0x4436('0x2e')]);var _0x14ebe2={'method':'POST','uri':_0x4436('0x68')+_0x3c453d['accountId']+_0x4436('0x69'),'body':{'to':[_0x5de6c1[_0x4436('0x20')]],'text':_0x5de6c1[_0x4436('0xc')],'from':_0x3c453d[_0x4436('0x20')],'applicationId':_0x3c453d['applicationId']},'headers':{'Authorization':util[_0x4436('0x42')](_0x4436('0x44'),new Buffer(_0x158a8)[_0x4436('0x45')]('base64'))},'json':!![]};rp(_0x14ebe2)[_0x4436('0x24')](function(_0x18a5b6){if(_0x18a5b6['id']){var _0x262880={'messageId':_0x18a5b6['id']};return _0x11b46b[_0x4436('0x25')](_0x262880);}else{logger[_0x4436('0x18')](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x6a'),util['inspect'](_0x18a5b6,{'showHidden':![],'depth':null}));}})[_0x4436('0x17')](function(_0x3d5bfc){logger[_0x4436('0x18')](_0x4436('0x29'),_0x4436('0x27'),'bandwidth',util[_0x4436('0x28')](_0x3d5bfc,{'showHidden':![],'depth':null}));});}else{logger[_0x4436('0x18')](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x6a'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x3c453d[_0x4436('0x5a')]){var _0x409c76={};var _0x3e2897={'method':_0x4436('0x34'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x4436('0x6b')+_0x3c453d[_0x4436('0x5a')],'Content-Type':_0x4436('0x56')},'body':{'from':_0x3c453d[_0x4436('0x20')],'to':_0x5de6c1[_0x4436('0x20')],'text':_0x5de6c1['body']},'json':!![]};return rp(_0x3e2897)['then'](function(_0x411c25){if(_0x411c25[_0x4436('0x6c')]==0xca){_0x409c76[_0x4436('0x6d')]=_0x411c25;var _0xa0b5ba={'method':_0x4436('0x34'),'uri':_0x4436('0x6e'),'headers':{'Authorization':'Bearer\x20'+_0x3c453d[_0x4436('0x5a')],'Content-Type':'application/json'},'body':{'refid':_0x409c76['message'][_0x4436('0x6f')]},'json':!![]};return rp(_0xa0b5ba)[_0x4436('0x24')](function(_0x265cd5){_0x409c76[_0x4436('0x70')]=_0x265cd5;var _0x53d2ac={'messageId':_0x409c76['message'][_0x4436('0x6f')],'read':!![]};return _0x11b46b['update'](_0x53d2ac);});}else{return logger[_0x4436('0x18')](_0x4436('0x29'),_0x4436('0x27'),_0x4436('0x71'),util[_0x4436('0x28')](_0x411c25,{'showHidden':![],'depth':null}));}})[_0x4436('0x17')](function(_0x3fd986){return logger['error'](_0x4436('0x29'),_0x4436('0x27'),'intelepeer',util[_0x4436('0x28')](_0x3fd986,{'showHidden':![],'depth':null}));});}else{return logger[_0x4436('0x18')](_0x4436('0x29'),'afterCreate',_0x4436('0x71'),_0x4436('0x72'));}break;}}})[_0x4436('0x73')](function(){_0x2d06ee();});}else{_0x2d06ee();}}},'charset':_0x4436('0x74'),'collate':_0x4436('0x75')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index b495ed8..64e79af 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 _0xb050=['options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','CreateSmsMessage','SmsMessage','create'];(function(_0x215393,_0x4c406d){var _0x595198=function(_0x5d641f){while(--_0x5d641f){_0x215393['push'](_0x215393['shift']());}};_0x595198(++_0x4c406d);}(_0xb050,0x195));var _0x0b05=function(_0x36596f,_0x460a0a){_0x36596f=_0x36596f-0x0;var _0x3d2be8=_0xb050[_0x36596f];return _0x3d2be8;};'use strict';var _=require(_0x0b05('0x0'));var util=require(_0x0b05('0x1'));var moment=require(_0x0b05('0x2'));var BPromise=require(_0x0b05('0x3'));var rs=require(_0x0b05('0x4'));var fs=require('fs');var Redis=require(_0x0b05('0x5'));var db=require(_0x0b05('0x6'))['db'];var utils=require(_0x0b05('0x7'));var logger=require(_0x0b05('0x8'))('rpc');var config=require(_0x0b05('0x9'));var jayson=require(_0x0b05('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x0b05('0xb')](config[_0x0b05('0xc')],{'host':_0x0b05('0xd'),'port':0x18eb});var socket=require(_0x0b05('0xe'))(new Redis(config['redis']));require(_0x0b05('0xf'))['register'](socket);function respondWithRpcPromise(_0x2740a8,_0x5e643f,_0x2ee45c){return new BPromise(function(_0x51ac02,_0x362c2c){return client[_0x0b05('0x10')](_0x2740a8,_0x2ee45c)[_0x0b05('0x11')](function(_0x22eb03){logger['info'](_0x0b05('0x12'),_0x5e643f,_0x0b05('0x13'));logger[_0x0b05('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5e643f,'request\x20sent',JSON['stringify'](_0x22eb03));if(_0x22eb03['error']){if(_0x22eb03['error'][_0x0b05('0x15')]===0x1f4){logger[_0x0b05('0x16')](_0x0b05('0x12'),_0x5e643f,_0x22eb03['error']['message']);return _0x362c2c(_0x22eb03['error'][_0x0b05('0x17')]);}logger[_0x0b05('0x16')](_0x0b05('0x12'),_0x5e643f,_0x22eb03['error'][_0x0b05('0x17')]);return _0x51ac02(_0x22eb03[_0x0b05('0x16')][_0x0b05('0x17')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x5e643f,'request\x20sent');_0x51ac02(_0x22eb03[_0x0b05('0x18')][_0x0b05('0x17')]);}})[_0x0b05('0x19')](function(_0x371e60){logger['error'](_0x0b05('0x12'),_0x5e643f,_0x371e60);_0x362c2c(_0x371e60);});});}exports[_0x0b05('0x1a')]=function(_0x3cb597){var _0x50caca=this;return new Promise(function(_0x135848,_0x4e7866){return db[_0x0b05('0x1b')][_0x0b05('0x1c')](_0x3cb597['body'],{'raw':_0x3cb597[_0x0b05('0x1d')]?_0x3cb597[_0x0b05('0x1d')][_0x0b05('0x1e')]===undefined?!![]:![]:!![]})[_0x0b05('0x11')](function(_0x4ae22b){logger['info'](_0x0b05('0x1a'),_0x3cb597);logger[_0x0b05('0x14')]('CreateSmsMessage',_0x3cb597,JSON['stringify'](_0x4ae22b));_0x135848(_0x4ae22b);})['catch'](function(_0x594afc){logger['error'](_0x0b05('0x1a'),_0x594afc['message'],_0x3cb597);_0x4e7866(_0x50caca['error'](0x1f4,_0x594afc[_0x0b05('0x17')]));});});}; \ No newline at end of file +var _0xbad3=['../../mysqldb','../../config/utils','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','debug','stringify','code','SmsMessage,\x20%s,\x20%s','error','message','request\x20sent','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','util','bluebird','randomstring'];(function(_0x2a3c0a,_0x163f5c){var _0x1703a2=function(_0x471dfe){while(--_0x471dfe){_0x2a3c0a['push'](_0x2a3c0a['shift']());}};_0x1703a2(++_0x163f5c);}(_0xbad3,0x10b));var _0x3bad=function(_0x5161ad,_0x51b9b0){_0x5161ad=_0x5161ad-0x0;var _0x4936a8=_0xbad3[_0x5161ad];return _0x4936a8;};'use strict';var _=require('lodash');var util=require(_0x3bad('0x0'));var moment=require('moment');var BPromise=require(_0x3bad('0x1'));var rs=require(_0x3bad('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bad('0x3'))['db'];var utils=require(_0x3bad('0x4'));var logger=require(_0x3bad('0x5'))(_0x3bad('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x3bad('0x7')]=_[_0x3bad('0x8')](config[_0x3bad('0x7')],{'host':_0x3bad('0x9'),'port':0x18eb});var socket=require(_0x3bad('0xa'))(new Redis(config[_0x3bad('0x7')]));require(_0x3bad('0xb'))[_0x3bad('0xc')](socket);function respondWithRpcPromise(_0x2ccd13,_0x32143f,_0x4145a0){return new BPromise(function(_0x358f89,_0x4e96a0){return client[_0x3bad('0xd')](_0x2ccd13,_0x4145a0)[_0x3bad('0xe')](function(_0x4d745d){logger[_0x3bad('0xf')]('SmsMessage,\x20%s,\x20%s',_0x32143f,'request\x20sent');logger[_0x3bad('0x10')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x32143f,'request\x20sent',JSON[_0x3bad('0x11')](_0x4d745d));if(_0x4d745d['error']){if(_0x4d745d['error'][_0x3bad('0x12')]===0x1f4){logger['error'](_0x3bad('0x13'),_0x32143f,_0x4d745d[_0x3bad('0x14')][_0x3bad('0x15')]);return _0x4e96a0(_0x4d745d[_0x3bad('0x14')][_0x3bad('0x15')]);}logger['error'](_0x3bad('0x13'),_0x32143f,_0x4d745d[_0x3bad('0x14')][_0x3bad('0x15')]);return _0x358f89(_0x4d745d['error'][_0x3bad('0x15')]);}else{logger[_0x3bad('0xf')]('SmsMessage,\x20%s,\x20%s',_0x32143f,_0x3bad('0x16'));_0x358f89(_0x4d745d[_0x3bad('0x17')][_0x3bad('0x15')]);}})[_0x3bad('0x18')](function(_0x4ec224){logger[_0x3bad('0x14')]('SmsMessage,\x20%s,\x20%s',_0x32143f,_0x4ec224);_0x4e96a0(_0x4ec224);});});}exports[_0x3bad('0x19')]=function(_0x1ebed9){var _0x3626fc=this;return new Promise(function(_0x568320,_0x4e11b1){return db[_0x3bad('0x1a')]['create'](_0x1ebed9[_0x3bad('0x1b')],{'raw':_0x1ebed9[_0x3bad('0x1c')]?_0x1ebed9[_0x3bad('0x1c')][_0x3bad('0x1d')]===undefined?!![]:![]:!![]})[_0x3bad('0xe')](function(_0x378efa){logger[_0x3bad('0xf')](_0x3bad('0x19'),_0x1ebed9);logger[_0x3bad('0x10')]('CreateSmsMessage',_0x1ebed9,JSON[_0x3bad('0x11')](_0x378efa));_0x568320(_0x378efa);})['catch'](function(_0x390529){logger[_0x3bad('0x14')](_0x3bad('0x19'),_0x390529[_0x3bad('0x15')],_0x1ebed9);_0x4e11b1(_0x3626fc[_0x3bad('0x14')](0x1f4,_0x390529[_0x3bad('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 6c25d43..6c5225d 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 _0x26b2=['removeListener','length','smsMessage:','./smsMessage.events','save','remove','emit'];(function(_0x4d8764,_0xd13d7b){var _0x4e0b49=function(_0x56126a){while(--_0x56126a){_0x4d8764['push'](_0x4d8764['shift']());}};_0x4e0b49(++_0xd13d7b);}(_0x26b2,0xe3));var _0x226b=function(_0x29cedf,_0x1d0dc1){_0x29cedf=_0x29cedf-0x0;var _0x235826=_0x26b2[_0x29cedf];return _0x235826;};'use strict';var SmsMessageEvents=require(_0x226b('0x0'));var events=[_0x226b('0x1'),_0x226b('0x2'),'update'];function createListener(_0x59b890,_0x572fb4){return function(_0x4a1ae4){_0x572fb4[_0x226b('0x3')](_0x59b890,_0x4a1ae4);};}function removeListener(_0x41dac8,_0x39ee32){return function(){SmsMessageEvents[_0x226b('0x4')](_0x41dac8,_0x39ee32);};}exports['register']=function(_0x1590cc){for(var _0x468114=0x0,_0x180733=events[_0x226b('0x5')];_0x468114<_0x180733;_0x468114++){var _0x3c8a5b=events[_0x468114];var _0x1a56aa=createListener(_0x226b('0x6')+_0x3c8a5b,_0x1590cc);SmsMessageEvents['on'](_0x3c8a5b,_0x1a56aa);}}; \ No newline at end of file +var _0xa13f=['smsMessage:','./smsMessage.events','update','emit','removeListener','register'];(function(_0x1de43c,_0xaa29de){var _0x296d3e=function(_0x50b76f){while(--_0x50b76f){_0x1de43c['push'](_0x1de43c['shift']());}};_0x296d3e(++_0xaa29de);}(_0xa13f,0x157));var _0xfa13=function(_0x414104,_0x344d09){_0x414104=_0x414104-0x0;var _0x3212d9=_0xa13f[_0x414104];return _0x3212d9;};'use strict';var SmsMessageEvents=require(_0xfa13('0x0'));var events=['save','remove',_0xfa13('0x1')];function createListener(_0x57194b,_0x1bb2d2){return function(_0x551ee8){_0x1bb2d2[_0xfa13('0x2')](_0x57194b,_0x551ee8);};}function removeListener(_0x5d9842,_0x59a651){return function(){SmsMessageEvents[_0xfa13('0x3')](_0x5d9842,_0x59a651);};}exports[_0xfa13('0x4')]=function(_0x28ed9e){for(var _0x443adc=0x0,_0x3b2c76=events['length'];_0x443adc<_0x3b2c76;_0x443adc++){var _0x3fadaa=events[_0x443adc];var _0x26bf83=createListener(_0xfa13('0x5')+_0x3fadaa,_0x28ed9e);SmsMessageEvents['on'](_0x3fadaa,_0x26bf83);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 4fe0396..60d3824 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 _0x4231=['fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','/:id','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','express'];(function(_0x556b2c,_0x579e4b){var _0x32da88=function(_0x3b1413){while(--_0x3b1413){_0x556b2c['push'](_0x556b2c['shift']());}};_0x32da88(++_0x579e4b);}(_0x4231,0x79));var _0x1423=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x4231[_0x284bc3];return _0x41ac81;};'use strict';var multer=require(_0x1423('0x0'));var util=require(_0x1423('0x1'));var path=require(_0x1423('0x2'));var timeout=require('connect-timeout');var express=require(_0x1423('0x3'));var router=express['Router']();var fs_extra=require(_0x1423('0x4'));var auth=require(_0x1423('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1423('0x6'));var controller=require(_0x1423('0x7'));router['get']('/',auth[_0x1423('0x8')](),controller[_0x1423('0x9')]);router['get']('/describe',auth[_0x1423('0x8')](),controller['describe']);router['get'](_0x1423('0xa'),auth[_0x1423('0x8')](),controller['show']);router[_0x1423('0xb')](_0x1423('0xc'),auth[_0x1423('0x8')](),controller[_0x1423('0xd')]);router['get'](_0x1423('0xe'),auth[_0x1423('0x8')](),controller[_0x1423('0xf')]);router['get'](_0x1423('0x10'),auth[_0x1423('0x8')](),controller['getAgents']);router[_0x1423('0x11')]('/',auth['isAuthenticated'](),controller[_0x1423('0x12')]);router[_0x1423('0x11')]('/:id/teams',auth[_0x1423('0x8')](),controller['addTeams']);router['post'](_0x1423('0x10'),auth[_0x1423('0x8')](),controller[_0x1423('0x13')]);router[_0x1423('0x14')](_0x1423('0xa'),auth[_0x1423('0x8')](),controller['update']);router[_0x1423('0x15')](_0x1423('0xa'),auth[_0x1423('0x8')](),controller[_0x1423('0x16')]);router[_0x1423('0x15')](_0x1423('0xe'),auth[_0x1423('0x8')](),controller['removeTeams']);router[_0x1423('0x15')](_0x1423('0x10'),auth[_0x1423('0x8')](),controller[_0x1423('0x17')]);module[_0x1423('0x18')]=router; \ No newline at end of file +var _0x78e3=['show','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe'];(function(_0x998a45,_0x2d20d3){var _0x28d1f1=function(_0x445735){while(--_0x445735){_0x998a45['push'](_0x998a45['shift']());}};_0x28d1f1(++_0x2d20d3);}(_0x78e3,0x1d2));var _0x378e=function(_0x7dd851,_0x16b36a){_0x7dd851=_0x7dd851-0x0;var _0x29eb3d=_0x78e3[_0x7dd851];return _0x29eb3d;};'use strict';var multer=require(_0x378e('0x0'));var util=require(_0x378e('0x1'));var path=require(_0x378e('0x2'));var timeout=require('connect-timeout');var express=require(_0x378e('0x3'));var router=express[_0x378e('0x4')]();var fs_extra=require(_0x378e('0x5'));var auth=require(_0x378e('0x6'));var interaction=require(_0x378e('0x7'));var config=require(_0x378e('0x8'));var controller=require(_0x378e('0x9'));router[_0x378e('0xa')]('/',auth[_0x378e('0xb')](),controller[_0x378e('0xc')]);router[_0x378e('0xa')]('/describe',auth[_0x378e('0xb')](),controller[_0x378e('0xd')]);router[_0x378e('0xa')]('/:id',auth[_0x378e('0xb')](),controller[_0x378e('0xe')]);router['get']('/:id/members',auth[_0x378e('0xb')](),controller['getMembers']);router[_0x378e('0xa')](_0x378e('0xf'),auth['isAuthenticated'](),controller[_0x378e('0x10')]);router[_0x378e('0xa')](_0x378e('0x11'),auth[_0x378e('0xb')](),controller[_0x378e('0x12')]);router[_0x378e('0x13')]('/',auth['isAuthenticated'](),controller[_0x378e('0x14')]);router['post'](_0x378e('0xf'),auth[_0x378e('0xb')](),controller[_0x378e('0x15')]);router[_0x378e('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x378e('0x16')]);router['put'](_0x378e('0x17'),auth[_0x378e('0xb')](),controller[_0x378e('0x18')]);router[_0x378e('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x378e('0x1a')]);router[_0x378e('0x19')](_0x378e('0xf'),auth['isAuthenticated'](),controller[_0x378e('0x1b')]);router[_0x378e('0x19')]('/:id/users',auth[_0x378e('0xb')](),controller[_0x378e('0x1c')]);module[_0x378e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 6c4805f..e7eeabd 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 _0x89e5=['sequelize','exports','name','STRING','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x43d79c,_0x531a55){var _0x4866b0=function(_0x847a){while(--_0x847a){_0x43d79c['push'](_0x43d79c['shift']());}};_0x4866b0(++_0x531a55);}(_0x89e5,0x1d0));var _0x589e=function(_0x3c05a8,_0x17c094){_0x3c05a8=_0x3c05a8-0x0;var _0x1fffc1=_0x89e5[_0x3c05a8];return _0x1fffc1;};'use strict';var Sequelize=require(_0x589e('0x0'));module[_0x589e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x589e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x589e('0x3')]},'timeout':{'type':Sequelize[_0x589e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x589e('0x5'),_0x589e('0x6'),_0x589e('0x7'))}}; \ No newline at end of file +var _0xac33=['sequelize','exports','name','STRING','INTEGER','rrmemory'];(function(_0x5a47ff,_0x3055e7){var _0x9474bc=function(_0x44ded0){while(--_0x44ded0){_0x5a47ff['push'](_0x5a47ff['shift']());}};_0x9474bc(++_0x3055e7);}(_0xac33,0x14a));var _0x3ac3=function(_0x42322d,_0x5567b8){_0x42322d=_0x42322d-0x0;var _0x409906=_0xac33[_0x42322d];return _0x409906;};'use strict';var Sequelize=require(_0x3ac3('0x0'));module[_0x3ac3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3ac3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3ac3('0x3')]},'timeout':{'type':Sequelize[_0x3ac3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x3ac3('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 244ba0d..3ecd258 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 _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3db122,_0x5e6bee){_0x3db122=_0x3db122-0x0;var _0x325b67=_0x0b0e[_0x3db122];return _0x325b67;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));}; \ No newline at end of file +var _0x2032=['offset','limit','set','Content-Range','json','update','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','show','keys','filters','intersection','attributes','model','fields','options','find','catch','body','user','UserProfileSection','autoAssociation','params','describe','findOne','UserSmsQueue','hasOwnProperty','order','sort','SmsQueueId','filter','merge','findAll','User','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','length','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','transaction','isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','count'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0x2032,0xd9));var _0x2203=function(_0x4906a6,_0x44583c){_0x4906a6=_0x4906a6-0x0;var _0x77bf76=_0x2032[_0x4906a6];return _0x77bf76;};'use strict';var BPromise=require('bluebird');var util=require(_0x2203('0x0'));var _=require(_0x2203('0x1'));var squel=require(_0x2203('0x2'));var Redis=require('ioredis');var qs=require(_0x2203('0x3'));var logger=require(_0x2203('0x4'))('api');var config=require(_0x2203('0x5'));var db=require(_0x2203('0x6'))['db'];config[_0x2203('0x7')]=_[_0x2203('0x8')](config[_0x2203('0x7')],{'host':_0x2203('0x9'),'port':0x18eb});var socket=require(_0x2203('0xa'))(new Redis(config[_0x2203('0x7')]));require(_0x2203('0xb'))[_0x2203('0xc')](socket);function respondWithStatusCode(_0x2999ed,_0x5ecf9e){_0x5ecf9e=_0x5ecf9e||0xcc;return function(_0x526ae0){if(_0x526ae0){return _0x2999ed[_0x2203('0xd')](_0x5ecf9e);}return _0x2999ed['status'](_0x5ecf9e)[_0x2203('0xe')]();};}function respondWithResult(_0x2972f3,_0x6339c4){_0x6339c4=_0x6339c4||0xc8;return function(_0x5b19df){if(_0x5b19df){return _0x2972f3[_0x2203('0xf')](_0x6339c4)['json'](_0x5b19df);}};}function respondWithFilteredResult(_0x3f690a,_0x4b73be){return function(_0x297459){if(_0x297459){var _0x1abb51=typeof _0x4b73be['offset']==='undefined'&&typeof _0x4b73be['limit']==='undefined';var _0x4bad7c=_0x297459[_0x2203('0x10')];var _0x538b30=_0x1abb51?0x0:_0x4b73be['offset'];var _0x21a3af=_0x1abb51?_0x297459[_0x2203('0x10')]:_0x4b73be[_0x2203('0x11')]+_0x4b73be[_0x2203('0x12')];var _0x226209;if(_0x21a3af>=_0x4bad7c){_0x21a3af=_0x4bad7c;_0x226209=0xc8;}else{_0x226209=0xce;}_0x3f690a[_0x2203('0xf')](_0x226209);return _0x3f690a[_0x2203('0x13')](_0x2203('0x14'),_0x538b30+'-'+_0x21a3af+'/'+_0x4bad7c)[_0x2203('0x15')](_0x297459);}return null;};}function saveUpdates(_0x3053f3){return function(_0x5129fb){if(_0x5129fb){return _0x5129fb[_0x2203('0x16')](_0x3053f3)[_0x2203('0x17')](function(_0x4893ff){return _0x4893ff;});}return null;};}function removeEntity(_0x3f9ef6){return function(_0x8906e1){if(_0x8906e1){return _0x8906e1['destroy']()[_0x2203('0x17')](function(){var _0x5ee83c=_0x8906e1[_0x2203('0x18')]({'plain':!![]});var _0x310b8c=_0x2203('0x19');return db[_0x2203('0x1a')][_0x2203('0x1b')]({'where':{'type':_0x310b8c,'resourceId':_0x5ee83c['id']}})[_0x2203('0x17')](function(){return _0x8906e1;});})['then'](function(){_0x3f9ef6[_0x2203('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac866){return function(_0x15f543){if(!_0x15f543){_0x5ac866['sendStatus'](0x194);}return _0x15f543;};}function handleError(_0x3b8ef9,_0x5bfe61){_0x5bfe61=_0x5bfe61||0x1f4;return function(_0x5d4c4e){logger[_0x2203('0x1c')](_0x5d4c4e['stack']);if(_0x5d4c4e['name']){delete _0x5d4c4e[_0x2203('0x1d')];}_0x3b8ef9[_0x2203('0xf')](_0x5bfe61)[_0x2203('0x1e')](_0x5d4c4e);};}exports[_0x2203('0x1f')]=function(_0x1244f4,_0x3114ef){var _0x49c12={};var _0x250349={'count':0x0,'rows':[]};var _0x576378=_[_0x2203('0x20')](db[_0x2203('0x21')][_0x2203('0x22')],function(_0x5f11bf){return{'name':_0x5f11bf[_0x2203('0x23')],'type':_0x5f11bf[_0x2203('0x24')]['key']};});_0x49c12=qs[_0x2203('0x25')](_0x576378,_0x1244f4);var _0xd91f5d={'where':_0x49c12[_0x2203('0x26')]};return db[_0x2203('0x21')][_0x2203('0x10')](_0xd91f5d)[_0x2203('0x17')](function(_0x9c53f){_0x250349['count']=_0x9c53f;_0x49c12[_0x2203('0x27')]=qs[_0x2203('0x27')](_0x1244f4[_0x2203('0x28')]);return db[_0x2203('0x21')]['findAll'](_0x49c12);})[_0x2203('0x17')](function(_0x21ff0d){_0x250349[_0x2203('0x29')]=_0x21ff0d;return _0x250349;})[_0x2203('0x17')](respondWithFilteredResult(_0x3114ef,_0x49c12))['catch'](handleError(_0x3114ef,null));};exports[_0x2203('0x2a')]=function(_0x50aa17,_0x5e6560){var _0x5c0157={'raw':!![],'where':{'id':_0x50aa17['params']['id']}},_0x1d5f74={};_0x1d5f74['model']=_[_0x2203('0x2b')](db[_0x2203('0x21')][_0x2203('0x22')]);_0x1d5f74[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x50aa17['query']);_0x1d5f74[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x1d5f74['model'],_0x1d5f74[_0x2203('0x28')]);_0x5c0157[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0x1d5f74[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x50aa17[_0x2203('0x28')][_0x2203('0x30')]));_0x5c0157[_0x2203('0x2e')]=_0x5c0157[_0x2203('0x2e')]['length']?_0x5c0157[_0x2203('0x2e')]:_0x1d5f74[_0x2203('0x2f')];if(_0x50aa17['query']['includeAll']){_0x5c0157[_0x2203('0x27')]=[{'all':!![]}];}_0x5c0157=_['merge']({},_0x5c0157,_0x50aa17[_0x2203('0x31')]);return db[_0x2203('0x21')][_0x2203('0x32')](_0x5c0157)['then'](handleEntityNotFound(_0x5e6560,null))['then'](respondWithResult(_0x5e6560,null))[_0x2203('0x33')](handleError(_0x5e6560,null));};exports['create']=function(_0x2d0365,_0x5cfe5e){return db[_0x2203('0x21')]['create'](_0x2d0365[_0x2203('0x34')],{})[_0x2203('0x17')](function(_0x4311d1){var _0x40a793=_0x2d0365[_0x2203('0x35')]['get']({'plain':!![]});if(!_0x40a793)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a793['role']===_0x2203('0x35')){var _0x25a2dc=_0x4311d1[_0x2203('0x18')]({'plain':!![]});var _0x3b0c7a=_0x2203('0x19');return db[_0x2203('0x36')][_0x2203('0x32')]({'where':{'name':_0x3b0c7a,'userProfileId':_0x40a793['userProfileId']},'raw':!![]})[_0x2203('0x17')](function(_0x1b12c3){if(_0x1b12c3&&_0x1b12c3[_0x2203('0x37')]===0x0){return db[_0x2203('0x1a')]['create']({'name':_0x25a2dc['name'],'resourceId':_0x25a2dc['id'],'type':_0x1b12c3[_0x2203('0x1d')],'sectionId':_0x1b12c3['id']},{})['then'](function(){return _0x4311d1;});}else{return _0x4311d1;}})[_0x2203('0x33')](function(_0x446209){logger[_0x2203('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x446209);throw _0x446209;});}return _0x4311d1;})['then'](respondWithResult(_0x5cfe5e,0xc9))[_0x2203('0x33')](handleError(_0x5cfe5e,null));};exports[_0x2203('0x16')]=function(_0x368444,_0x1e09f3){if(_0x368444[_0x2203('0x34')]['id']){delete _0x368444[_0x2203('0x34')]['id'];}return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x368444[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e09f3,null))[_0x2203('0x17')](saveUpdates(_0x368444[_0x2203('0x34')],null))[_0x2203('0x17')](respondWithResult(_0x1e09f3,null))[_0x2203('0x33')](handleError(_0x1e09f3,null));};exports[_0x2203('0x1b')]=function(_0x36b8e4,_0x1e34a0){return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x36b8e4[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e34a0,null))[_0x2203('0x17')](removeEntity(_0x1e34a0,null))['catch'](handleError(_0x1e34a0,null));};exports['describe']=function(_0x1c6661,_0x48129c){return db[_0x2203('0x21')][_0x2203('0x39')]()[_0x2203('0x17')](respondWithResult(_0x48129c,null))[_0x2203('0x33')](handleError(_0x48129c,null));};exports['getMembers']=function(_0x289146,_0x102803){var _0x5cd8c6={'raw':!![],'where':{}},_0x29bd91={},_0x381b3e;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x289146['params']['id']}})['then'](handleEntityNotFound(_0x102803,null))[_0x2203('0x17')](function(_0x5707c8){if(_0x5707c8){_0x381b3e=_0x5707c8['get']({'plain':!![]});_0x29bd91[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x3b')]['rawAttributes']);_0x29bd91['query']=_[_0x2203('0x2b')](_0x289146[_0x2203('0x28')]);_0x29bd91[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x29bd91[_0x2203('0x2f')],_0x29bd91[_0x2203('0x28')]);_0x5cd8c6['attributes']=_[_0x2203('0x2d')](_0x29bd91['model'],qs[_0x2203('0x30')](_0x289146[_0x2203('0x28')][_0x2203('0x30')]));_0x5cd8c6[_0x2203('0x2e')]=_0x5cd8c6['attributes']['length']?_0x5cd8c6[_0x2203('0x2e')]:_0x29bd91[_0x2203('0x2f')];if(!_0x289146[_0x2203('0x28')][_0x2203('0x3c')]('nolimit')){_0x5cd8c6['limit']=qs['limit'](_0x289146[_0x2203('0x28')][_0x2203('0x12')]);_0x5cd8c6['offset']=qs[_0x2203('0x11')](_0x289146[_0x2203('0x28')]['offset']);}_0x5cd8c6[_0x2203('0x3d')]=qs[_0x2203('0x3e')](_0x289146[_0x2203('0x28')][_0x2203('0x3e')]);_0x5cd8c6['where']=qs[_0x2203('0x2c')](_['pick'](_0x289146[_0x2203('0x28')],_0x29bd91[_0x2203('0x2c')]));_0x5cd8c6['where'][_0x2203('0x3f')]=_0x5707c8['id'];if(_0x289146[_0x2203('0x28')][_0x2203('0x40')]){_0x5cd8c6[_0x2203('0x26')]=_[_0x2203('0x41')](_0x5cd8c6[_0x2203('0x26')],{'$or':_['map'](_0x5cd8c6['attributes'],function(_0x2f2537){var _0x524356={};_0x524356[_0x2f2537]={'$like':'%'+_0x289146['query'][_0x2203('0x40')]+'%'};return _0x524356;})});}_0x5cd8c6=_[_0x2203('0x41')]({},_0x5cd8c6,_0x289146[_0x2203('0x31')]);return db['UserSmsQueue'][_0x2203('0x42')](_0x5cd8c6);}})['then'](function(_0x5ddf9e){if(_0x5ddf9e){return db[_0x2203('0x43')]['findAndCountAll']({'where':{'id':_['map'](_0x5ddf9e,'UserId'),'role':_0x2203('0x44')},'attributes':['id',_0x2203('0x1d'),_0x2203('0x45'),_0x2203('0x46'),_0x2203('0x47')]});}})[_0x2203('0x17')](function(_0x2baea2){if(_0x2baea2){return{'count':_0x2baea2[_0x2203('0x10')],'rows':_[_0x2203('0x20')](_0x2baea2[_0x2203('0x29')],function(_0x384a59){return{'membername':_0x384a59[_0x2203('0x1d')],'UserId':_0x384a59['id'],'queue_name':_0x381b3e['name'],'SmsQueueId':_0x381b3e['id'],'interface':util['format'](_0x2203('0x48'),_0x2203('0x49'),_0x384a59[_0x2203('0x1d')]),'penalty':0x0,'paused':_0x384a59[_0x2203('0x45')],'createdAt':_0x384a59[_0x2203('0x47')],'updatedAt':_0x384a59[_0x2203('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x102803,_0x5cd8c6))['catch'](handleError(_0x102803,null));};exports[_0x2203('0x4a')]=function(_0x34358e,_0x21ee59){var _0x1e6d21={};var _0xcab922={};var _0x7b0b9c;var _0x133d22;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x34358e[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x21ee59,null))['then'](function(_0x1ea97a){if(_0x1ea97a){_0x7b0b9c=_0x1ea97a;_0xcab922[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x4b')][_0x2203('0x22')]);_0xcab922[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x34358e[_0x2203('0x28')]);_0xcab922[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],_0xcab922[_0x2203('0x28')]);_0x1e6d21[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x34358e[_0x2203('0x28')][_0x2203('0x30')]));_0x1e6d21[_0x2203('0x2e')]=_0x1e6d21[_0x2203('0x2e')]['length']?_0x1e6d21[_0x2203('0x2e')]:_0xcab922[_0x2203('0x2f')];_0x1e6d21[_0x2203('0x3d')]=qs['sort'](_0x34358e[_0x2203('0x28')][_0x2203('0x3e')]);_0x1e6d21[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x34358e['query'],_0xcab922[_0x2203('0x2c')]));if(_0x34358e[_0x2203('0x28')][_0x2203('0x40')]){_0x1e6d21['where']=_['merge'](_0x1e6d21['where'],{'$or':_['map'](_0x1e6d21['attributes'],function(_0x418d48){var _0xbc9f88={};_0xbc9f88[_0x418d48]={'$like':'%'+_0x34358e[_0x2203('0x28')][_0x2203('0x40')]+'%'};return _0xbc9f88;})});}_0x1e6d21=_[_0x2203('0x41')]({},_0x1e6d21,_0x34358e[_0x2203('0x31')]);return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0x56dcbe){if(_0x56dcbe){_0x133d22=_0x56dcbe['length'];if(!_0x34358e[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x1e6d21[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x34358e[_0x2203('0x28')][_0x2203('0x12')]);_0x1e6d21[_0x2203('0x11')]=qs[_0x2203('0x11')](_0x34358e[_0x2203('0x28')][_0x2203('0x11')]);}return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0xae45a5){if(_0xae45a5){return _0xae45a5?{'count':_0x133d22,'rows':_0xae45a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x21ee59,null))[_0x2203('0x33')](handleError(_0x21ee59,null));};exports[_0x2203('0x4e')]=function(_0x173ac1,_0xa15021){var _0x4b2e4f=_0x173ac1[_0x2203('0x34')]['ids'];return db[_0x2203('0x4b')]['findAll']({'where':{'id':_0x4b2e4f},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':_0x2203('0x4f'),'attributes':['id',_0x2203('0x1d'),_0x2203('0x50'),_0x2203('0x51'),_0x2203('0x52')],'raw':!![]}]})[_0x2203('0x17')](function(_0x2eab08){if(_0x2eab08){var _0x4e9a01=_['flatMap'](_0x2eab08,function(_0x38903b){var _0x34593a=_0x38903b[_0x2203('0x18')]({'plain':!![]});return _0x34593a['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x173ac1[_0x2203('0x38')]['id']}})[_0x2203('0x17')](function(_0x20385b){return db[_0x2203('0x53')]['transaction'](function(_0x2f7850){return _0x20385b['addTeams'](_0x4b2e4f,{'transaction':_0x2f7850})[_0x2203('0x17')](function(){return BPromise[_0x2203('0x54')](_0x4e9a01,function(_0xe3bee5){return db[_0x2203('0x3b')][_0x2203('0x55')]({'where':{'UserId':_0xe3bee5['id'],'SmsQueueId':_0x173ac1['params']['id']},'transaction':_0x2f7850});});})[_0x2203('0x17')](function(){_0x4e9a01[_0x2203('0x56')](function(_0x18663f){socket['emit'](_0x2203('0x57'),{'UserId':_0x18663f['id'],'SmsQueueId':_0x20385b['id']});});});});});}})[_0x2203('0x17')](respondWithStatusCode(_0xa15021,null))[_0x2203('0x33')](handleError(_0xa15021,null));};exports[_0x2203('0x58')]=function(_0x1c65f9,_0x4356fe){return db[_0x2203('0x4b')][_0x2203('0x42')]({'where':{'id':_0x1c65f9[_0x2203('0x28')][_0x2203('0x59')]},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2203('0x17')](handleEntityNotFound(_0x4356fe,null))[_0x2203('0x17')](function(_0x21b755){var _0x2da37c=_[_0x2203('0x20')](_0x21b755,'id');var _0x52c35e=[];var _0x23f7b1=[];var _0x2a5a4b=squel[_0x2203('0x5a')]();_0x2a5a4b[_0x2203('0x5b')](_0x2203('0x5c'))[_0x2203('0x5d')]('team_has_sms_queues','tq')['join'](_0x2203('0x5e'),'ut',_0x2203('0x5f'))[_0x2203('0x26')](_0x2203('0x60'),_0x1c65f9[_0x2203('0x38')]['id']);for(var _0x4fd029=0x0;_0x4fd029<_0x21b755[_0x2203('0x61')];_0x4fd029+=0x1){let _0x3cb792=_0x21b755[_0x4fd029];for(var _0x4e539b=0x0;_0x4e539b<_0x3cb792['Agents']['length'];_0x4e539b+=0x1){let _0x4fc51a=_0x3cb792['Agents'][_0x4e539b];var _0x2952fc=_0x2a5a4b[_0x2203('0x62')]();_0x2952fc[_0x2203('0x26')]('ut.UserId\x20=\x20?',_0x4fc51a['id']);_0x23f7b1['push'](db['sequelize'][_0x2203('0x28')](_0x2952fc[_0x2203('0x63')](),{'type':db[_0x2203('0x53')][_0x2203('0x64')][_0x2203('0x65')]})[_0x2203('0x17')](function(_0x3d1797){if(_0x3d1797['length']===0x1){return _0x4fc51a['id'];}else{var _0x3bf2c9=_[_0x2203('0x66')](_[_0x2203('0x20')](_0x3d1797,_0x2203('0x67')),function(_0x35ff6b){return _[_0x2203('0x68')](_0x2da37c,_0x35ff6b);});if(_0x3bf2c9){return _0x4fc51a['id'];}}}));}}return BPromise[_0x2203('0x69')](_0x23f7b1)['then'](function(_0x188722){_0x52c35e=_(_0x52c35e)['union'](_0x188722)['compact']()[_0x2203('0x6a')]();return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x1c65f9[_0x2203('0x38')]['id']}})['then'](function(_0x29d545){return db[_0x2203('0x53')][_0x2203('0x6b')](function(_0x461f90){return _0x29d545[_0x2203('0x58')](_0x1c65f9[_0x2203('0x28')]['ids'],{'transaction':_0x461f90})[_0x2203('0x17')](function(){if(!_[_0x2203('0x6c')](_0x52c35e)){return _0x29d545['removeAgents'](_0x52c35e,{'transaction':_0x461f90});}})['then'](function(){_0x52c35e[_0x2203('0x56')](function(_0x3fe71b){socket[_0x2203('0x6d')](_0x2203('0x6e'),{'UserId':_0x3fe71b,'SmsQueueId':_0x29d545['id']});});});});});});})[_0x2203('0x17')](respondWithStatusCode(_0x4356fe,null))[_0x2203('0x33')](handleError(_0x4356fe,null));};exports[_0x2203('0x6f')]=function(_0x3c41bf,_0x4749df){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x3c41bf[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x4749df,null))[_0x2203('0x17')](function(_0x7589a7){if(_0x7589a7){return _0x7589a7[_0x2203('0x6f')](_0x3c41bf['body']['ids'],_[_0x2203('0x70')](_0x3c41bf[_0x2203('0x34')],['ids','id'])||{})[_0x2203('0x71')](function(_0x447a95){for(var _0x5b5e95=0x0;_0x5b5e95<_0x3c41bf[_0x2203('0x34')][_0x2203('0x59')]['length'];_0x5b5e95+=0x1){socket[_0x2203('0x6d')](_0x2203('0x57'),{'UserId':Number(_0x3c41bf['body'][_0x2203('0x59')][_0x5b5e95]),'SmsQueueId':Number(_0x3c41bf[_0x2203('0x38')]['id'])});}return _0x447a95;});}})[_0x2203('0x17')](respondWithResult(_0x4749df,null))[_0x2203('0x33')](handleError(_0x4749df,null));};exports['removeAgents']=function(_0x511c66,_0x2df837){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x511c66['params']['id']}})['then'](handleEntityNotFound(_0x2df837,null))[_0x2203('0x17')](function(_0x199bec){if(_0x199bec){return _0x199bec[_0x2203('0x72')](_0x511c66['query']['ids'])[_0x2203('0x17')](function(){if(_[_0x2203('0x73')](_0x511c66['query'][_0x2203('0x59')])){for(var _0x2de64d=0x0;_0x2de64d<_0x511c66['query'][_0x2203('0x59')]['length'];_0x2de64d+=0x1){socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66['query']['ids'][_0x2de64d]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}}else{socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66[_0x2203('0x28')][_0x2203('0x59')]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2df837,null))[_0x2203('0x33')](handleError(_0x2df837,null));};exports['getAgents']=function(_0x3f31e0,_0x3edb38){var _0x486563={};var _0x4358c1={};var _0x4096f4;var _0x5bd4e4;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x3f31e0[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x3edb38,null))[_0x2203('0x17')](function(_0x5d73a7){if(_0x5d73a7){_0x4096f4=_0x5d73a7;_0x4358c1[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x43')][_0x2203('0x22')]);_0x4358c1[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x3f31e0['query']);_0x4358c1[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x4358c1['model'],_0x4358c1[_0x2203('0x28')]);_0x486563['attributes']=_[_0x2203('0x2d')](_0x4358c1[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x3f31e0['query'][_0x2203('0x30')]));_0x486563[_0x2203('0x2e')]=_0x486563[_0x2203('0x2e')][_0x2203('0x61')]?_0x486563[_0x2203('0x2e')]:_0x4358c1[_0x2203('0x2f')];_0x486563[_0x2203('0x3d')]=qs['sort'](_0x3f31e0['query'][_0x2203('0x3e')]);_0x486563[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x3f31e0[_0x2203('0x28')],_0x4358c1[_0x2203('0x2c')]));if(_0x3f31e0[_0x2203('0x28')]['filter']){_0x486563[_0x2203('0x26')]=_[_0x2203('0x41')](_0x486563['where'],{'$or':_[_0x2203('0x20')](_0x486563['attributes'],function(_0xc3dac5){var _0xbd1866={};_0xbd1866[_0xc3dac5]={'$like':'%'+_0x3f31e0['query'][_0x2203('0x40')]+'%'};return _0xbd1866;})});}_0x486563=_[_0x2203('0x41')]({},_0x486563,_0x3f31e0[_0x2203('0x31')]);return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x36ab7f){if(_0x36ab7f){_0x5bd4e4=_0x36ab7f[_0x2203('0x61')];if(!_0x3f31e0[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x486563[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x3f31e0['query'][_0x2203('0x12')]);_0x486563['offset']=qs[_0x2203('0x11')](_0x3f31e0[_0x2203('0x28')][_0x2203('0x11')]);}return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x2159a5){if(_0x2159a5){return _0x2159a5?{'count':_0x5bd4e4,'rows':_0x2159a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x3edb38,null))[_0x2203('0x33')](handleError(_0x3edb38,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 51b0c77..68ee4b8 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 _0x25e6=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x4a1862,_0x397ea1){var _0x4cbcc9=function(_0x11598f){while(--_0x11598f){_0x4a1862['push'](_0x4a1862['shift']());}};_0x4cbcc9(++_0x397ea1);}(_0x25e6,0x146));var _0x625e=function(_0x54b012,_0x4948f){_0x54b012=_0x54b012-0x0;var _0x31eea5=_0x25e6[_0x54b012];return _0x31eea5;};'use strict';var EventEmitter=require(_0x625e('0x0'));var SmsQueue=require(_0x625e('0x1'))['db'][_0x625e('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x625e('0x3')](0x0);var events={'afterCreate':_0x625e('0x4'),'afterUpdate':_0x625e('0x5'),'afterDestroy':_0x625e('0x6')};function emitEvent(_0x2a3bd8){return function(_0x37ee52,_0x3d889e,_0x327246){SmsQueueEvents[_0x625e('0x7')](_0x2a3bd8+':'+_0x37ee52['id'],_0x37ee52);SmsQueueEvents[_0x625e('0x7')](_0x2a3bd8,_0x37ee52);_0x327246(null);};}for(var e in events){if(events[_0x625e('0x8')](e)){var event=events[e];SmsQueue[_0x625e('0x9')](e,emitEvent(event));}}module[_0x625e('0xa')]=SmsQueueEvents; \ No newline at end of file +var _0xbbec=['setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb','SmsQueue'];(function(_0x57e8b0,_0x189430){var _0x17987b=function(_0x33551){while(--_0x33551){_0x57e8b0['push'](_0x57e8b0['shift']());}};_0x17987b(++_0x189430);}(_0xbbec,0xe7));var _0xcbbe=function(_0x3f5164,_0xac8eae){_0x3f5164=_0x3f5164-0x0;var _0x2521a3=_0xbbec[_0x3f5164];return _0x2521a3;};'use strict';var EventEmitter=require(_0xcbbe('0x0'));var SmsQueue=require(_0xcbbe('0x1'))['db'][_0xcbbe('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xcbbe('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcbbe('0x4'),'afterDestroy':_0xcbbe('0x5')};function emitEvent(_0x5921a3){return function(_0x415a22,_0x518a30,_0x535c60){SmsQueueEvents['emit'](_0x5921a3+':'+_0x415a22['id'],_0x415a22);SmsQueueEvents[_0xcbbe('0x6')](_0x5921a3,_0x415a22);_0x535c60(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xcbbe('0x7')](e,emitEvent(event));}}module[_0xcbbe('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 590abb0..f58116b 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 _0x75fd=['api','bluebird','request-promise','path','./smsQueue.attributes','SmsQueue','lodash','../../config/logger'];(function(_0x2aab2e,_0x5deafa){var _0x9391e4=function(_0x5eb6ce){while(--_0x5eb6ce){_0x2aab2e['push'](_0x2aab2e['shift']());}};_0x9391e4(++_0x5deafa);}(_0x75fd,0xee));var _0xd75f=function(_0x34607a,_0x1d0ae4){_0x34607a=_0x34607a-0x0;var _0x9d1926=_0x75fd[_0x34607a];return _0x9d1926;};'use strict';var _=require(_0xd75f('0x0'));var util=require('util');var logger=require(_0xd75f('0x1'))(_0xd75f('0x2'));var moment=require('moment');var BPromise=require(_0xd75f('0x3'));var rp=require(_0xd75f('0x4'));var fs=require('fs');var path=require(_0xd75f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd75f('0x6'));module['exports']=function(_0x375e8d,_0x5d8196){return _0x375e8d['define'](_0xd75f('0x7'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0721=['SmsQueue','sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x0721,0x9e));var _0x1072=function(_0x7767c3,_0x4825ac){_0x7767c3=_0x7767c3-0x0;var _0x1f22a1=_0x0721[_0x7767c3];return _0x1f22a1;};'use strict';var _=require(_0x1072('0x0'));var util=require('util');var logger=require(_0x1072('0x1'))(_0x1072('0x2'));var moment=require(_0x1072('0x3'));var BPromise=require(_0x1072('0x4'));var rp=require(_0x1072('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1072('0x6'));var config=require(_0x1072('0x7'));var attributes=require('./smsQueue.attributes');module[_0x1072('0x8')]=function(_0x5a36bc,_0x27d7fa){return _0x5a36bc[_0x1072('0x9')](_0x1072('0xa'),attributes,{'tableName':_0x1072('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 48ee8f1..e0b8a12 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 _0x0504=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','raw','options','where','attributes','limit','include','map','model','debug','ShowSmsQueue'];(function(_0x277108,_0x550276){var _0x36999f=function(_0x9da2d5){while(--_0x9da2d5){_0x277108['push'](_0x277108['shift']());}};_0x36999f(++_0x550276);}(_0x0504,0x1ee));var _0x4050=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x0504[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x4050('0x0'));var util=require(_0x4050('0x1'));var moment=require(_0x4050('0x2'));var BPromise=require('bluebird');var rs=require(_0x4050('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4050('0x4'))['db'];var utils=require(_0x4050('0x5'));var logger=require('../../config/logger')(_0x4050('0x6'));var config=require(_0x4050('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4050('0x8')][_0x4050('0x9')]({'port':0x232a});config['redis']=_[_0x4050('0xa')](config[_0x4050('0xb')],{'host':_0x4050('0xc'),'port':0x18eb});var socket=require(_0x4050('0xd'))(new Redis(config[_0x4050('0xb')]));require(_0x4050('0xe'))['register'](socket);function respondWithRpcPromise(_0x369899,_0x302cd2,_0x3534b8){return new BPromise(function(_0x39b017,_0x1030c7){return client[_0x4050('0xf')](_0x369899,_0x3534b8)[_0x4050('0x10')](function(_0x582b71){logger[_0x4050('0x11')](_0x4050('0x12'),_0x302cd2,_0x4050('0x13'));logger['debug'](_0x4050('0x14'),_0x302cd2,'request\x20sent',JSON[_0x4050('0x15')](_0x582b71));if(_0x582b71[_0x4050('0x16')]){if(_0x582b71[_0x4050('0x16')][_0x4050('0x17')]===0x1f4){logger[_0x4050('0x16')](_0x4050('0x12'),_0x302cd2,_0x582b71['error'][_0x4050('0x18')]);return _0x1030c7(_0x582b71[_0x4050('0x16')]['message']);}logger[_0x4050('0x16')](_0x4050('0x12'),_0x302cd2,_0x582b71[_0x4050('0x16')][_0x4050('0x18')]);return _0x39b017(_0x582b71[_0x4050('0x16')]['message']);}else{logger[_0x4050('0x11')](_0x4050('0x12'),_0x302cd2,_0x4050('0x13'));_0x39b017(_0x582b71['result']['message']);}})[_0x4050('0x19')](function(_0x4f1a48){logger[_0x4050('0x16')]('SmsQueue,\x20%s,\x20%s',_0x302cd2,_0x4f1a48);_0x1030c7(_0x4f1a48);});});}exports[_0x4050('0x1a')]=function(_0x3ddee3){var _0x425d06=this;return new Promise(function(_0x3af908,_0x492d19){return db[_0x4050('0x1b')]['findAll']({'raw':_0x3ddee3['options']?_0x3ddee3['options'][_0x4050('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ddee3[_0x4050('0x1d')]?_0x3ddee3[_0x4050('0x1d')][_0x4050('0x1e')]||null:null,'attributes':_0x3ddee3[_0x4050('0x1d')]?_0x3ddee3[_0x4050('0x1d')][_0x4050('0x1f')]||null:null,'limit':_0x3ddee3[_0x4050('0x1d')]?_0x3ddee3[_0x4050('0x1d')][_0x4050('0x20')]||null:null,'include':_0x3ddee3[_0x4050('0x1d')]?_0x3ddee3[_0x4050('0x1d')][_0x4050('0x21')]?_[_0x4050('0x22')](_0x3ddee3[_0x4050('0x1d')][_0x4050('0x21')],function(_0xcd73f8){return{'model':db[_0xcd73f8[_0x4050('0x23')]],'as':_0xcd73f8['as'],'attributes':_0xcd73f8[_0x4050('0x1f')],'include':_0xcd73f8['include']?_[_0x4050('0x22')](_0xcd73f8[_0x4050('0x21')],function(_0x1e38b0){return{'model':db[_0x1e38b0[_0x4050('0x23')]],'as':_0x1e38b0['as'],'attributes':_0x1e38b0['attributes'],'include':_0x1e38b0[_0x4050('0x21')]?_[_0x4050('0x22')](_0x1e38b0[_0x4050('0x21')],function(_0xfc263b){return{'model':db[_0xfc263b[_0x4050('0x23')]],'as':_0xfc263b['as'],'attributes':_0xfc263b[_0x4050('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57e90b){logger[_0x4050('0x11')](_0x4050('0x1a'),_0x3ddee3);logger[_0x4050('0x24')](_0x4050('0x1a'),_0x3ddee3,JSON[_0x4050('0x15')](_0x57e90b));_0x3af908(_0x57e90b);})[_0x4050('0x19')](function(_0x4a92b9){logger[_0x4050('0x16')]('GetSmsQueue',_0x4a92b9[_0x4050('0x18')],_0x3ddee3);_0x492d19(_0x425d06[_0x4050('0x16')](0x1f4,_0x4a92b9[_0x4050('0x18')]));});});};exports[_0x4050('0x25')]=function(_0x53481a){var _0x52773c=this;return new Promise(function(_0x49d4be,_0x4dac4a){return db['SmsQueue']['find']({'raw':_0x53481a['options']?_0x53481a[_0x4050('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x53481a[_0x4050('0x1d')]?_0x53481a[_0x4050('0x1d')][_0x4050('0x1e')]||null:null,'attributes':_0x53481a[_0x4050('0x1d')]?_0x53481a[_0x4050('0x1d')][_0x4050('0x1f')]||null:null,'include':_0x53481a[_0x4050('0x1d')]?_0x53481a['options'][_0x4050('0x21')]?_[_0x4050('0x22')](_0x53481a[_0x4050('0x1d')][_0x4050('0x21')],function(_0x3d1c13){return{'model':db[_0x3d1c13['model']],'as':_0x3d1c13['as'],'attributes':_0x3d1c13[_0x4050('0x1f')],'include':_0x3d1c13[_0x4050('0x21')]?_[_0x4050('0x22')](_0x3d1c13[_0x4050('0x21')],function(_0x47b5e9){return{'model':db[_0x47b5e9['model']],'as':_0x47b5e9['as'],'attributes':_0x47b5e9[_0x4050('0x1f')],'include':_0x47b5e9[_0x4050('0x21')]?_[_0x4050('0x22')](_0x47b5e9[_0x4050('0x21')],function(_0xb86ce2){return{'model':db[_0xb86ce2['model']],'as':_0xb86ce2['as'],'attributes':_0xb86ce2[_0x4050('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x665be8){logger[_0x4050('0x11')](_0x4050('0x25'),_0x53481a);logger[_0x4050('0x24')](_0x4050('0x25'),_0x53481a,JSON[_0x4050('0x15')](_0x665be8));_0x49d4be(_0x665be8);})[_0x4050('0x19')](function(_0x3f6009){logger[_0x4050('0x16')](_0x4050('0x25'),_0x3f6009[_0x4050('0x18')],_0x53481a);_0x4dac4a(_0x52773c['error'](0x1f4,_0x3f6009[_0x4050('0x18')]));});});}; \ No newline at end of file +var _0x7f94=['GetSmsQueue','where','ShowSmsQueue','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./smsQueue.socket','register','then','info','request\x20sent','debug','stringify','error','SmsQueue,\x20%s,\x20%s','message','result','SmsQueue','findAll','options','raw','limit','include','map','model','attributes'];(function(_0x7e4505,_0x13335f){var _0xda3942=function(_0x43a7da){while(--_0x43a7da){_0x7e4505['push'](_0x7e4505['shift']());}};_0xda3942(++_0x13335f);}(_0x7f94,0x1e4));var _0x47f9=function(_0xf73177,_0x35529f){_0xf73177=_0xf73177-0x0;var _0x2aaafa=_0x7f94[_0xf73177];return _0x2aaafa;};'use strict';var _=require(_0x47f9('0x0'));var util=require(_0x47f9('0x1'));var moment=require(_0x47f9('0x2'));var BPromise=require(_0x47f9('0x3'));var rs=require(_0x47f9('0x4'));var fs=require('fs');var Redis=require(_0x47f9('0x5'));var db=require(_0x47f9('0x6'))['db'];var utils=require(_0x47f9('0x7'));var logger=require(_0x47f9('0x8'))(_0x47f9('0x9'));var config=require('../../config/environment');var jayson=require(_0x47f9('0xa'));var client=jayson[_0x47f9('0xb')]['http']({'port':0x232a});config['redis']=_[_0x47f9('0xc')](config['redis'],{'host':_0x47f9('0xd'),'port':0x18eb});var socket=require(_0x47f9('0xe'))(new Redis(config[_0x47f9('0xf')]));require(_0x47f9('0x10'))[_0x47f9('0x11')](socket);function respondWithRpcPromise(_0x588bdb,_0x577e0b,_0x4f161f){return new BPromise(function(_0xf486f,_0x1e46ce){return client['request'](_0x588bdb,_0x4f161f)[_0x47f9('0x12')](function(_0x58d63b){logger[_0x47f9('0x13')]('SmsQueue,\x20%s,\x20%s',_0x577e0b,_0x47f9('0x14'));logger[_0x47f9('0x15')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x577e0b,_0x47f9('0x14'),JSON[_0x47f9('0x16')](_0x58d63b));if(_0x58d63b[_0x47f9('0x17')]){if(_0x58d63b[_0x47f9('0x17')]['code']===0x1f4){logger['error'](_0x47f9('0x18'),_0x577e0b,_0x58d63b['error'][_0x47f9('0x19')]);return _0x1e46ce(_0x58d63b[_0x47f9('0x17')][_0x47f9('0x19')]);}logger['error'](_0x47f9('0x18'),_0x577e0b,_0x58d63b[_0x47f9('0x17')][_0x47f9('0x19')]);return _0xf486f(_0x58d63b[_0x47f9('0x17')][_0x47f9('0x19')]);}else{logger[_0x47f9('0x13')](_0x47f9('0x18'),_0x577e0b,_0x47f9('0x14'));_0xf486f(_0x58d63b[_0x47f9('0x1a')][_0x47f9('0x19')]);}})['catch'](function(_0x27ac08){logger[_0x47f9('0x17')](_0x47f9('0x18'),_0x577e0b,_0x27ac08);_0x1e46ce(_0x27ac08);});});}exports['GetSmsQueue']=function(_0x2cbc20){var _0x26ab10=this;return new Promise(function(_0x5e1366,_0x1e1128){return db[_0x47f9('0x1b')][_0x47f9('0x1c')]({'raw':_0x2cbc20[_0x47f9('0x1d')]?_0x2cbc20[_0x47f9('0x1d')][_0x47f9('0x1e')]===undefined?!![]:![]:!![],'where':_0x2cbc20[_0x47f9('0x1d')]?_0x2cbc20['options']['where']||null:null,'attributes':_0x2cbc20[_0x47f9('0x1d')]?_0x2cbc20[_0x47f9('0x1d')]['attributes']||null:null,'limit':_0x2cbc20['options']?_0x2cbc20[_0x47f9('0x1d')][_0x47f9('0x1f')]||null:null,'include':_0x2cbc20[_0x47f9('0x1d')]?_0x2cbc20[_0x47f9('0x1d')][_0x47f9('0x20')]?_[_0x47f9('0x21')](_0x2cbc20[_0x47f9('0x1d')]['include'],function(_0xa051f3){return{'model':db[_0xa051f3[_0x47f9('0x22')]],'as':_0xa051f3['as'],'attributes':_0xa051f3['attributes'],'include':_0xa051f3[_0x47f9('0x20')]?_[_0x47f9('0x21')](_0xa051f3[_0x47f9('0x20')],function(_0x3dfd41){return{'model':db[_0x3dfd41[_0x47f9('0x22')]],'as':_0x3dfd41['as'],'attributes':_0x3dfd41[_0x47f9('0x23')],'include':_0x3dfd41[_0x47f9('0x20')]?_['map'](_0x3dfd41['include'],function(_0x1023c1){return{'model':db[_0x1023c1['model']],'as':_0x1023c1['as'],'attributes':_0x1023c1['attributes']};}):[]};}):[]};}):[]:[]})[_0x47f9('0x12')](function(_0x257459){logger[_0x47f9('0x13')](_0x47f9('0x24'),_0x2cbc20);logger[_0x47f9('0x15')](_0x47f9('0x24'),_0x2cbc20,JSON[_0x47f9('0x16')](_0x257459));_0x5e1366(_0x257459);})['catch'](function(_0x42af6f){logger[_0x47f9('0x17')]('GetSmsQueue',_0x42af6f[_0x47f9('0x19')],_0x2cbc20);_0x1e1128(_0x26ab10[_0x47f9('0x17')](0x1f4,_0x42af6f[_0x47f9('0x19')]));});});};exports['ShowSmsQueue']=function(_0x57b48d){var _0x5d230d=this;return new Promise(function(_0x6d7046,_0x57f26e){return db['SmsQueue']['find']({'raw':_0x57b48d['options']?_0x57b48d[_0x47f9('0x1d')][_0x47f9('0x1e')]===undefined?!![]:![]:!![],'where':_0x57b48d['options']?_0x57b48d['options'][_0x47f9('0x25')]||null:null,'attributes':_0x57b48d['options']?_0x57b48d[_0x47f9('0x1d')]['attributes']||null:null,'include':_0x57b48d[_0x47f9('0x1d')]?_0x57b48d[_0x47f9('0x1d')][_0x47f9('0x20')]?_[_0x47f9('0x21')](_0x57b48d[_0x47f9('0x1d')][_0x47f9('0x20')],function(_0x15dd92){return{'model':db[_0x15dd92[_0x47f9('0x22')]],'as':_0x15dd92['as'],'attributes':_0x15dd92[_0x47f9('0x23')],'include':_0x15dd92[_0x47f9('0x20')]?_[_0x47f9('0x21')](_0x15dd92[_0x47f9('0x20')],function(_0x23c2e2){return{'model':db[_0x23c2e2[_0x47f9('0x22')]],'as':_0x23c2e2['as'],'attributes':_0x23c2e2[_0x47f9('0x23')],'include':_0x23c2e2[_0x47f9('0x20')]?_[_0x47f9('0x21')](_0x23c2e2[_0x47f9('0x20')],function(_0x2a6015){return{'model':db[_0x2a6015[_0x47f9('0x22')]],'as':_0x2a6015['as'],'attributes':_0x2a6015[_0x47f9('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e557b){logger['info'](_0x47f9('0x26'),_0x57b48d);logger[_0x47f9('0x15')](_0x47f9('0x26'),_0x57b48d,JSON[_0x47f9('0x16')](_0x2e557b));_0x6d7046(_0x2e557b);})[_0x47f9('0x27')](function(_0x39c25a){logger[_0x47f9('0x17')](_0x47f9('0x26'),_0x39c25a[_0x47f9('0x19')],_0x57b48d);_0x57f26e(_0x5d230d[_0x47f9('0x17')](0x1f4,_0x39c25a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 15532ff..456e59a 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 _0xbe95=['removeListener','length','./smsQueue.events','save','remove','update','emit'];(function(_0x5bedd3,_0x5ed9ec){var _0x3ad7e8=function(_0x4b2a3a){while(--_0x4b2a3a){_0x5bedd3['push'](_0x5bedd3['shift']());}};_0x3ad7e8(++_0x5ed9ec);}(_0xbe95,0x152));var _0x5be9=function(_0x2e24c6,_0x1f83e1){_0x2e24c6=_0x2e24c6-0x0;var _0x350907=_0xbe95[_0x2e24c6];return _0x350907;};'use strict';var SmsQueueEvents=require(_0x5be9('0x0'));var events=[_0x5be9('0x1'),_0x5be9('0x2'),_0x5be9('0x3')];function createListener(_0x37f146,_0x59212e){return function(_0x3229b2){_0x59212e[_0x5be9('0x4')](_0x37f146,_0x3229b2);};}function removeListener(_0xb0ef5b,_0x3e5162){return function(){SmsQueueEvents[_0x5be9('0x5')](_0xb0ef5b,_0x3e5162);};}exports['register']=function(_0x22f9e5){for(var _0x460734=0x0,_0x42403c=events[_0x5be9('0x6')];_0x460734<_0x42403c;_0x460734++){var _0x4affe5=events[_0x460734];var _0x1410f9=createListener('smsQueue:'+_0x4affe5,_0x22f9e5);SmsQueueEvents['on'](_0x4affe5,_0x1410f9);}}; \ No newline at end of file +var _0xbcee=['register','length','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0x4e7e1a,_0x4f2f3d){var _0x8dc7da=function(_0x306b2f){while(--_0x306b2f){_0x4e7e1a['push'](_0x4e7e1a['shift']());}};_0x8dc7da(++_0x4f2f3d);}(_0xbcee,0x172));var _0xebce=function(_0x4b79a3,_0x2fa7ac){_0x4b79a3=_0x4b79a3-0x0;var _0x3f9ad8=_0xbcee[_0x4b79a3];return _0x3f9ad8;};'use strict';var SmsQueueEvents=require(_0xebce('0x0'));var events=[_0xebce('0x1'),_0xebce('0x2'),_0xebce('0x3')];function createListener(_0x20193b,_0x219525){return function(_0x9c3a94){_0x219525[_0xebce('0x4')](_0x20193b,_0x9c3a94);};}function removeListener(_0x2df4ba,_0x40fec4){return function(){SmsQueueEvents[_0xebce('0x5')](_0x2df4ba,_0x40fec4);};}exports[_0xebce('0x6')]=function(_0x2e9470){for(var _0x5b11a0=0x0,_0x390a93=events[_0xebce('0x7')];_0x5b11a0<_0x390a93;_0x5b11a0++){var _0x40a21c=events[_0x5b11a0];var _0x13174d=createListener('smsQueue:'+_0x40a21c,_0x2e9470);SmsQueueEvents['on'](_0x40a21c,_0x13174d);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 3d6c1a8..ee64a2e 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 _0x4350=['/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','isAuthenticated'];(function(_0x867b4a,_0x1441ca){var _0x1260f4=function(_0xae9a96){while(--_0xae9a96){_0x867b4a['push'](_0x867b4a['shift']());}};_0x1260f4(++_0x1441ca);}(_0x4350,0x1d0));var _0x0435=function(_0x5ef0a1,_0x632b77){_0x5ef0a1=_0x5ef0a1-0x0;var _0x3a25c7=_0x4350[_0x5ef0a1];return _0x3a25c7;};'use strict';var multer=require(_0x0435('0x0'));var util=require(_0x0435('0x1'));var path=require('path');var timeout=require(_0x0435('0x2'));var express=require('express');var router=express[_0x0435('0x3')]();var fs_extra=require(_0x0435('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0435('0x5'));var config=require(_0x0435('0x6'));var controller=require(_0x0435('0x7'));router[_0x0435('0x8')]('/',auth['isAuthenticated'](),controller[_0x0435('0x9')]);router['get']('/describe',auth[_0x0435('0xa')](),controller['describe']);router['get'](_0x0435('0xb'),auth['isAuthenticated'](),controller[_0x0435('0xc')]);router[_0x0435('0xd')]('/',auth['isAuthenticated'](),controller[_0x0435('0xe')]);router['put'](_0x0435('0xb'),auth[_0x0435('0xa')](),controller[_0x0435('0xf')]);router[_0x0435('0x10')](_0x0435('0xb'),auth[_0x0435('0xa')](),controller[_0x0435('0x11')]);module[_0x0435('0x12')]=router; \ No newline at end of file +var _0x4677=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','exports','multer','util','path'];(function(_0x5bd58b,_0x53f018){var _0xf1bee6=function(_0x56308b){while(--_0x56308b){_0x5bd58b['push'](_0x5bd58b['shift']());}};_0xf1bee6(++_0x53f018);}(_0x4677,0x105));var _0x7467=function(_0x233de0,_0x28c804){_0x233de0=_0x233de0-0x0;var _0x1fe7ef=_0x4677[_0x233de0];return _0x1fe7ef;};'use strict';var multer=require(_0x7467('0x0'));var util=require(_0x7467('0x1'));var path=require(_0x7467('0x2'));var timeout=require(_0x7467('0x3'));var express=require(_0x7467('0x4'));var router=express[_0x7467('0x5')]();var fs_extra=require(_0x7467('0x6'));var auth=require(_0x7467('0x7'));var interaction=require(_0x7467('0x8'));var config=require(_0x7467('0x9'));var controller=require(_0x7467('0xa'));router[_0x7467('0xb')]('/',auth[_0x7467('0xc')](),controller[_0x7467('0xd')]);router['get'](_0x7467('0xe'),auth[_0x7467('0xc')](),controller['describe']);router[_0x7467('0xb')](_0x7467('0xf'),auth[_0x7467('0xc')](),controller[_0x7467('0x10')]);router['post']('/',auth[_0x7467('0xc')](),controller[_0x7467('0x11')]);router[_0x7467('0x12')](_0x7467('0xf'),auth[_0x7467('0xc')](),controller[_0x7467('0x13')]);router[_0x7467('0x14')]('/:id',auth[_0x7467('0xc')](),controller['destroy']);module[_0x7467('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index f59f980..bfaf0b4 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 _0x5a4d=['STRING','DATE','sequelize','exports'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x5a4d,0x1ea));var _0xd5a4=function(_0x38c3ef,_0x4851a2){_0x38c3ef=_0x38c3ef-0x0;var _0x421227=_0x5a4d[_0x38c3ef];return _0x421227;};'use strict';var moment=require('moment');var Sequelize=require(_0xd5a4('0x0'));module[_0xd5a4('0x1')]={'uniqueid':{'type':Sequelize[_0xd5a4('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd5a4('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd5a4('0x3')]},'exitAt':{'type':Sequelize[_0xd5a4('0x3')]},'reason':{'type':Sequelize[_0xd5a4('0x2')]}}; \ No newline at end of file +var _0x9352=['DATE','moment','sequelize','exports'];(function(_0x17cf89,_0x5760db){var _0x4bd758=function(_0xacf7f0){while(--_0xacf7f0){_0x17cf89['push'](_0x17cf89['shift']());}};_0x4bd758(++_0x5760db);}(_0x9352,0x17d));var _0x2935=function(_0x11acb8,_0x5163e3){_0x11acb8=_0x11acb8-0x0;var _0x1ef228=_0x9352[_0x11acb8];return _0x1ef228;};'use strict';var moment=require(_0x2935('0x0'));var Sequelize=require(_0x2935('0x1'));module[_0x2935('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2935('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x2935('0x3')]},'exitAt':{'type':Sequelize[_0x2935('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index cd813f1..41be7e1 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 _0xb2ed=['show','params','include','find','create','body','destroy','eml-format','rimraf','zip-dir','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','offset','count','set','apply','reject','save','update','then','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0xb2ed,0x18d));var _0xdb2e=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0xb2ed[_0x1ae4a9];return _0x54d0b0;};'use strict';var emlformat=require(_0xdb2e('0x0'));var rimraf=require(_0xdb2e('0x1'));var zipdir=require(_0xdb2e('0x2'));var jsonpatch=require(_0xdb2e('0x3'));var rp=require('request-promise');var moment=require(_0xdb2e('0x4'));var BPromise=require(_0xdb2e('0x5'));var Mustache=require(_0xdb2e('0x6'));var util=require(_0xdb2e('0x7'));var path=require(_0xdb2e('0x8'));var sox=require(_0xdb2e('0x9'));var csv=require('to-csv');var ejs=require(_0xdb2e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdb2e('0xb'));var squel=require(_0xdb2e('0xc'));var crypto=require(_0xdb2e('0xd'));var jsforce=require(_0xdb2e('0xe'));var deskjs=require(_0xdb2e('0xf'));var toCsv=require(_0xdb2e('0x10'));var querystring=require(_0xdb2e('0x11'));var Papa=require(_0xdb2e('0x12'));var Redis=require('ioredis');var authService=require(_0xdb2e('0x13'));var qs=require(_0xdb2e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb2e('0x15'));var logger=require(_0xdb2e('0x16'))(_0xdb2e('0x17'));var utils=require(_0xdb2e('0x18'));var config=require(_0xdb2e('0x19'));var licenseUtil=require(_0xdb2e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x585653,_0x4418a1){_0x4418a1=_0x4418a1||0xcc;return function(_0x5175fb){if(_0x5175fb){return _0x585653[_0xdb2e('0x1b')](_0x4418a1);}return _0x585653[_0xdb2e('0x1c')](_0x4418a1)[_0xdb2e('0x1d')]();};}function respondWithResult(_0x3d67a0,_0x57fada){_0x57fada=_0x57fada||0xc8;return function(_0x5b4e04){if(_0x5b4e04){return _0x3d67a0['status'](_0x57fada)[_0xdb2e('0x1e')](_0x5b4e04);}};}function respondWithFilteredResult(_0x250744,_0x3a4c18){return function(_0x355ced){if(_0x355ced){var _0x524bf7=typeof _0x3a4c18['offset']==='undefined'&&typeof _0x3a4c18[_0xdb2e('0x1f')]==='undefined';var _0x5c98a0=_0x355ced['count'];var _0x40f051=_0x524bf7?0x0:_0x3a4c18[_0xdb2e('0x20')];var _0x14573b=_0x524bf7?_0x355ced[_0xdb2e('0x21')]:_0x3a4c18['offset']+_0x3a4c18[_0xdb2e('0x1f')];var _0x9c5d5d;if(_0x14573b>=_0x5c98a0){_0x14573b=_0x5c98a0;_0x9c5d5d=0xc8;}else{_0x9c5d5d=0xce;}_0x250744[_0xdb2e('0x1c')](_0x9c5d5d);return _0x250744[_0xdb2e('0x22')]('Content-Range',_0x40f051+'-'+_0x14573b+'/'+_0x5c98a0)[_0xdb2e('0x1e')](_0x355ced);}return null;};}function patchUpdates(_0x35e8b1){return function(_0xce05c2){try{jsonpatch[_0xdb2e('0x23')](_0xce05c2,_0x35e8b1,!![]);}catch(_0x58375b){return BPromise[_0xdb2e('0x24')](_0x58375b);}return _0xce05c2[_0xdb2e('0x25')]();};}function saveUpdates(_0x3dab0c,_0x38449c){return function(_0x3486d9){if(_0x3486d9){return _0x3486d9[_0xdb2e('0x26')](_0x3dab0c)[_0xdb2e('0x27')](function(_0x59e61c){return _0x59e61c;});}return null;};}function removeEntity(_0x516d98,_0x9d3dba){return function(_0x4ebb9c){if(_0x4ebb9c){return _0x4ebb9c['destroy']()['then'](function(){_0x516d98[_0xdb2e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56f49d,_0x5202b1){return function(_0x10ec6d){if(!_0x10ec6d){_0x56f49d[_0xdb2e('0x1b')](0x194);}return _0x10ec6d;};}function handleError(_0x1eb9d2,_0x51aecb){_0x51aecb=_0x51aecb||0x1f4;return function(_0x536bf1){logger[_0xdb2e('0x28')](_0x536bf1[_0xdb2e('0x29')]);if(_0x536bf1[_0xdb2e('0x2a')]){delete _0x536bf1[_0xdb2e('0x2a')];}_0x1eb9d2[_0xdb2e('0x1c')](_0x51aecb)['send'](_0x536bf1);};}exports[_0xdb2e('0x2b')]=function(_0x26ad0f,_0x55ac6f){var _0x450986={},_0x474f93={},_0x5e9325={'count':0x0,'rows':[]};var _0x22d797=_[_0xdb2e('0x2c')](db[_0xdb2e('0x2d')][_0xdb2e('0x2e')],function(_0x1b0991){return{'name':_0x1b0991[_0xdb2e('0x2f')],'type':_0x1b0991[_0xdb2e('0x30')]['key']};});_0x474f93[_0xdb2e('0x31')]=_[_0xdb2e('0x2c')](_0x22d797,'name');_0x474f93[_0xdb2e('0x32')]=_[_0xdb2e('0x33')](_0x26ad0f['query']);_0x474f93['filters']=_[_0xdb2e('0x34')](_0x474f93[_0xdb2e('0x31')],_0x474f93[_0xdb2e('0x32')]);_0x450986[_0xdb2e('0x35')]=_[_0xdb2e('0x34')](_0x474f93[_0xdb2e('0x31')],qs[_0xdb2e('0x36')](_0x26ad0f['query'][_0xdb2e('0x36')]));_0x450986[_0xdb2e('0x35')]=_0x450986[_0xdb2e('0x35')][_0xdb2e('0x37')]?_0x450986[_0xdb2e('0x35')]:_0x474f93[_0xdb2e('0x31')];if(!_0x26ad0f[_0xdb2e('0x32')][_0xdb2e('0x38')](_0xdb2e('0x39'))){_0x450986[_0xdb2e('0x1f')]=qs[_0xdb2e('0x1f')](_0x26ad0f[_0xdb2e('0x32')][_0xdb2e('0x1f')]);_0x450986[_0xdb2e('0x20')]=qs[_0xdb2e('0x20')](_0x26ad0f[_0xdb2e('0x32')][_0xdb2e('0x20')]);}_0x450986[_0xdb2e('0x3a')]=qs[_0xdb2e('0x3b')](_0x26ad0f[_0xdb2e('0x32')][_0xdb2e('0x3b')]);_0x450986['where']=qs[_0xdb2e('0x3c')](_[_0xdb2e('0x3d')](_0x26ad0f[_0xdb2e('0x32')],_0x474f93['filters']),_0x22d797);if(_0x26ad0f[_0xdb2e('0x32')][_0xdb2e('0x3e')]){_0x450986[_0xdb2e('0x3f')]=_[_0xdb2e('0x40')](_0x450986['where'],{'$or':_['map'](_0x22d797,function(_0x3e5d05){if(_0x3e5d05[_0xdb2e('0x30')]!==_0xdb2e('0x41')){var _0x2261c8={};_0x2261c8[_0x3e5d05[_0xdb2e('0x2a')]]={'$like':'%'+_0x26ad0f[_0xdb2e('0x32')][_0xdb2e('0x3e')]+'%'};return _0x2261c8;}})});}_0x450986=_[_0xdb2e('0x40')]({},_0x450986,_0x26ad0f[_0xdb2e('0x42')]);var _0x15d6b1={'where':_0x450986['where']};return db['SmsQueueReport'][_0xdb2e('0x21')](_0x15d6b1)[_0xdb2e('0x27')](function(_0x2c363e){_0x5e9325[_0xdb2e('0x21')]=_0x2c363e;if(_0x26ad0f[_0xdb2e('0x32')][_0xdb2e('0x43')]){_0x450986['include']=[{'all':!![]}];}return db[_0xdb2e('0x2d')][_0xdb2e('0x44')](_0x450986);})[_0xdb2e('0x27')](function(_0x592bd5){_0x5e9325[_0xdb2e('0x45')]=_0x592bd5;return _0x5e9325;})[_0xdb2e('0x27')](respondWithFilteredResult(_0x55ac6f,_0x450986))[_0xdb2e('0x46')](handleError(_0x55ac6f,null));};exports[_0xdb2e('0x47')]=function(_0x188f67,_0x512cd0){var _0x5eaaa2={'raw':!![],'where':{'id':_0x188f67[_0xdb2e('0x48')]['id']}},_0x3a7c8f={};_0x3a7c8f[_0xdb2e('0x31')]=_[_0xdb2e('0x33')](db[_0xdb2e('0x2d')][_0xdb2e('0x2e')]);_0x3a7c8f['query']=_['keys'](_0x188f67[_0xdb2e('0x32')]);_0x3a7c8f[_0xdb2e('0x3c')]=_[_0xdb2e('0x34')](_0x3a7c8f['model'],_0x3a7c8f['query']);_0x5eaaa2[_0xdb2e('0x35')]=_[_0xdb2e('0x34')](_0x3a7c8f[_0xdb2e('0x31')],qs['fields'](_0x188f67[_0xdb2e('0x32')][_0xdb2e('0x36')]));_0x5eaaa2['attributes']=_0x5eaaa2['attributes']['length']?_0x5eaaa2[_0xdb2e('0x35')]:_0x3a7c8f[_0xdb2e('0x31')];if(_0x188f67[_0xdb2e('0x32')][_0xdb2e('0x43')]){_0x5eaaa2[_0xdb2e('0x49')]=[{'all':!![]}];}_0x5eaaa2=_['merge']({},_0x5eaaa2,_0x188f67['options']);return db[_0xdb2e('0x2d')][_0xdb2e('0x4a')](_0x5eaaa2)[_0xdb2e('0x27')](handleEntityNotFound(_0x512cd0,null))[_0xdb2e('0x27')](respondWithResult(_0x512cd0,null))[_0xdb2e('0x46')](handleError(_0x512cd0,null));};exports[_0xdb2e('0x4b')]=function(_0x1c31b2,_0x41f5a9){return db[_0xdb2e('0x2d')]['create'](_0x1c31b2['body'],{})['then'](respondWithResult(_0x41f5a9,0xc9))[_0xdb2e('0x46')](handleError(_0x41f5a9,null));};exports['update']=function(_0x55b16a,_0x178695){if(_0x55b16a[_0xdb2e('0x4c')]['id']){delete _0x55b16a[_0xdb2e('0x4c')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x55b16a[_0xdb2e('0x48')]['id']}})['then'](handleEntityNotFound(_0x178695,null))['then'](saveUpdates(_0x55b16a[_0xdb2e('0x4c')],null))[_0xdb2e('0x27')](respondWithResult(_0x178695,null))[_0xdb2e('0x46')](handleError(_0x178695,null));};exports[_0xdb2e('0x4d')]=function(_0x423fb8,_0x2e417e){return db['SmsQueueReport'][_0xdb2e('0x4a')]({'where':{'id':_0x423fb8['params']['id']}})[_0xdb2e('0x27')](handleEntityNotFound(_0x2e417e,null))[_0xdb2e('0x27')](removeEntity(_0x2e417e,null))[_0xdb2e('0x46')](handleError(_0x2e417e,null));};exports['describe']=function(_0xabc13e,_0x12ebba){return db[_0xdb2e('0x2d')]['describe']()[_0xdb2e('0x27')](respondWithResult(_0x12ebba,null))[_0xdb2e('0x46')](handleError(_0x12ebba,null));}; \ No newline at end of file +var _0xeacb=['options','includeAll','include','findAll','rows','keys','fields','find','catch','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','save','destroy','then','sendStatus','stack','name','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','length','order','sort','filters','pick','where','VIRTUAL','merge'];(function(_0xe441a6,_0x3459f6){var _0x5faec8=function(_0x5a1720){while(--_0x5a1720){_0xe441a6['push'](_0xe441a6['shift']());}};_0x5faec8(++_0x3459f6);}(_0xeacb,0x121));var _0xbeac=function(_0x48959e,_0x5e7257){_0x48959e=_0x48959e-0x0;var _0x30c1fb=_0xeacb[_0x48959e];return _0x30c1fb;};'use strict';var emlformat=require(_0xbeac('0x0'));var rimraf=require(_0xbeac('0x1'));var zipdir=require(_0xbeac('0x2'));var jsonpatch=require(_0xbeac('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbeac('0x4'));var Mustache=require(_0xbeac('0x5'));var util=require(_0xbeac('0x6'));var path=require(_0xbeac('0x7'));var sox=require(_0xbeac('0x8'));var csv=require('to-csv');var ejs=require(_0xbeac('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbeac('0xa'));var crypto=require(_0xbeac('0xb'));var jsforce=require(_0xbeac('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbeac('0xd'));var querystring=require(_0xbeac('0xe'));var Papa=require(_0xbeac('0xf'));var Redis=require(_0xbeac('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbeac('0x11'));var as=require(_0xbeac('0x12'));var hardwareService=require(_0xbeac('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbeac('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbeac('0x15'));var db=require(_0xbeac('0x16'))['db'];function respondWithStatusCode(_0x517de6,_0x2dc934){_0x2dc934=_0x2dc934||0xcc;return function(_0x2fe4ca){if(_0x2fe4ca){return _0x517de6['sendStatus'](_0x2dc934);}return _0x517de6['status'](_0x2dc934)[_0xbeac('0x17')]();};}function respondWithResult(_0x299db3,_0x262557){_0x262557=_0x262557||0xc8;return function(_0x4e1882){if(_0x4e1882){return _0x299db3[_0xbeac('0x18')](_0x262557)['json'](_0x4e1882);}};}function respondWithFilteredResult(_0x457bf5,_0x1e65f5){return function(_0x55b279){if(_0x55b279){var _0x448f15=typeof _0x1e65f5[_0xbeac('0x19')]===_0xbeac('0x1a')&&typeof _0x1e65f5[_0xbeac('0x1b')]===_0xbeac('0x1a');var _0xf59f83=_0x55b279[_0xbeac('0x1c')];var _0x4fbe95=_0x448f15?0x0:_0x1e65f5[_0xbeac('0x19')];var _0x3302aa=_0x448f15?_0x55b279['count']:_0x1e65f5[_0xbeac('0x19')]+_0x1e65f5[_0xbeac('0x1b')];var _0x194737;if(_0x3302aa>=_0xf59f83){_0x3302aa=_0xf59f83;_0x194737=0xc8;}else{_0x194737=0xce;}_0x457bf5[_0xbeac('0x18')](_0x194737);return _0x457bf5[_0xbeac('0x1d')](_0xbeac('0x1e'),_0x4fbe95+'-'+_0x3302aa+'/'+_0xf59f83)['json'](_0x55b279);}return null;};}function patchUpdates(_0x40d269){return function(_0x3b80d4){try{jsonpatch['apply'](_0x3b80d4,_0x40d269,!![]);}catch(_0x2c8889){return BPromise['reject'](_0x2c8889);}return _0x3b80d4[_0xbeac('0x1f')]();};}function saveUpdates(_0x168e4a,_0x26836b){return function(_0x1687d7){if(_0x1687d7){return _0x1687d7['update'](_0x168e4a)['then'](function(_0x5d2019){return _0x5d2019;});}return null;};}function removeEntity(_0x42f5a3,_0x1ad5e4){return function(_0xfb9d53){if(_0xfb9d53){return _0xfb9d53[_0xbeac('0x20')]()[_0xbeac('0x21')](function(){_0x42f5a3[_0xbeac('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x471cd0,_0x52c1b8){return function(_0x589269){if(!_0x589269){_0x471cd0[_0xbeac('0x22')](0x194);}return _0x589269;};}function handleError(_0x5cbbf1,_0x41903b){_0x41903b=_0x41903b||0x1f4;return function(_0x6787e2){logger['error'](_0x6787e2[_0xbeac('0x23')]);if(_0x6787e2[_0xbeac('0x24')]){delete _0x6787e2['name'];}_0x5cbbf1[_0xbeac('0x18')](_0x41903b)['send'](_0x6787e2);};}exports[_0xbeac('0x25')]=function(_0x58811e,_0x2df715){var _0x325883={},_0x457312={},_0x559ba7={'count':0x0,'rows':[]};var _0x1eb0e9=_['map'](db[_0xbeac('0x26')][_0xbeac('0x27')],function(_0x47c679){return{'name':_0x47c679[_0xbeac('0x28')],'type':_0x47c679[_0xbeac('0x29')][_0xbeac('0x2a')]};});_0x457312[_0xbeac('0x2b')]=_[_0xbeac('0x2c')](_0x1eb0e9,'name');_0x457312['query']=_['keys'](_0x58811e[_0xbeac('0x2d')]);_0x457312['filters']=_[_0xbeac('0x2e')](_0x457312[_0xbeac('0x2b')],_0x457312[_0xbeac('0x2d')]);_0x325883[_0xbeac('0x2f')]=_[_0xbeac('0x2e')](_0x457312['model'],qs['fields'](_0x58811e['query']['fields']));_0x325883[_0xbeac('0x2f')]=_0x325883[_0xbeac('0x2f')][_0xbeac('0x30')]?_0x325883[_0xbeac('0x2f')]:_0x457312['model'];if(!_0x58811e[_0xbeac('0x2d')]['hasOwnProperty']('nolimit')){_0x325883[_0xbeac('0x1b')]=qs[_0xbeac('0x1b')](_0x58811e[_0xbeac('0x2d')][_0xbeac('0x1b')]);_0x325883['offset']=qs[_0xbeac('0x19')](_0x58811e[_0xbeac('0x2d')][_0xbeac('0x19')]);}_0x325883[_0xbeac('0x31')]=qs[_0xbeac('0x32')](_0x58811e['query']['sort']);_0x325883['where']=qs[_0xbeac('0x33')](_[_0xbeac('0x34')](_0x58811e['query'],_0x457312['filters']),_0x1eb0e9);if(_0x58811e[_0xbeac('0x2d')]['filter']){_0x325883[_0xbeac('0x35')]=_['merge'](_0x325883[_0xbeac('0x35')],{'$or':_[_0xbeac('0x2c')](_0x1eb0e9,function(_0x2c7dcd){if(_0x2c7dcd[_0xbeac('0x29')]!==_0xbeac('0x36')){var _0x3ff516={};_0x3ff516[_0x2c7dcd[_0xbeac('0x24')]]={'$like':'%'+_0x58811e[_0xbeac('0x2d')]['filter']+'%'};return _0x3ff516;}})});}_0x325883=_[_0xbeac('0x37')]({},_0x325883,_0x58811e[_0xbeac('0x38')]);var _0x4069bb={'where':_0x325883['where']};return db[_0xbeac('0x26')][_0xbeac('0x1c')](_0x4069bb)[_0xbeac('0x21')](function(_0x3d06bc){_0x559ba7[_0xbeac('0x1c')]=_0x3d06bc;if(_0x58811e[_0xbeac('0x2d')][_0xbeac('0x39')]){_0x325883[_0xbeac('0x3a')]=[{'all':!![]}];}return db[_0xbeac('0x26')][_0xbeac('0x3b')](_0x325883);})[_0xbeac('0x21')](function(_0x484819){_0x559ba7[_0xbeac('0x3c')]=_0x484819;return _0x559ba7;})[_0xbeac('0x21')](respondWithFilteredResult(_0x2df715,_0x325883))['catch'](handleError(_0x2df715,null));};exports['show']=function(_0x2dabad,_0x2321dc){var _0x787d5f={'raw':!![],'where':{'id':_0x2dabad['params']['id']}},_0x3ff620={};_0x3ff620[_0xbeac('0x2b')]=_[_0xbeac('0x3d')](db[_0xbeac('0x26')][_0xbeac('0x27')]);_0x3ff620[_0xbeac('0x2d')]=_['keys'](_0x2dabad['query']);_0x3ff620[_0xbeac('0x33')]=_[_0xbeac('0x2e')](_0x3ff620[_0xbeac('0x2b')],_0x3ff620[_0xbeac('0x2d')]);_0x787d5f[_0xbeac('0x2f')]=_[_0xbeac('0x2e')](_0x3ff620[_0xbeac('0x2b')],qs[_0xbeac('0x3e')](_0x2dabad[_0xbeac('0x2d')][_0xbeac('0x3e')]));_0x787d5f['attributes']=_0x787d5f['attributes']['length']?_0x787d5f[_0xbeac('0x2f')]:_0x3ff620[_0xbeac('0x2b')];if(_0x2dabad[_0xbeac('0x2d')][_0xbeac('0x39')]){_0x787d5f['include']=[{'all':!![]}];}_0x787d5f=_['merge']({},_0x787d5f,_0x2dabad[_0xbeac('0x38')]);return db['SmsQueueReport'][_0xbeac('0x3f')](_0x787d5f)[_0xbeac('0x21')](handleEntityNotFound(_0x2321dc,null))['then'](respondWithResult(_0x2321dc,null))[_0xbeac('0x40')](handleError(_0x2321dc,null));};exports['create']=function(_0x26fa54,_0x27cc9e){return db[_0xbeac('0x26')]['create'](_0x26fa54[_0xbeac('0x41')],{})[_0xbeac('0x21')](respondWithResult(_0x27cc9e,0xc9))[_0xbeac('0x40')](handleError(_0x27cc9e,null));};exports[_0xbeac('0x42')]=function(_0x308ebf,_0x5a4aad){if(_0x308ebf[_0xbeac('0x41')]['id']){delete _0x308ebf[_0xbeac('0x41')]['id'];}return db[_0xbeac('0x26')][_0xbeac('0x3f')]({'where':{'id':_0x308ebf['params']['id']}})[_0xbeac('0x21')](handleEntityNotFound(_0x5a4aad,null))[_0xbeac('0x21')](saveUpdates(_0x308ebf[_0xbeac('0x41')],null))['then'](respondWithResult(_0x5a4aad,null))[_0xbeac('0x40')](handleError(_0x5a4aad,null));};exports[_0xbeac('0x20')]=function(_0x358b54,_0x25c695){return db['SmsQueueReport']['find']({'where':{'id':_0x358b54[_0xbeac('0x43')]['id']}})[_0xbeac('0x21')](handleEntityNotFound(_0x25c695,null))[_0xbeac('0x21')](removeEntity(_0x25c695,null))[_0xbeac('0x40')](handleError(_0x25c695,null));};exports[_0xbeac('0x44')]=function(_0x34aa13,_0x3962aa){return db[_0xbeac('0x26')][_0xbeac('0x44')]()['then'](respondWithResult(_0x3962aa,null))[_0xbeac('0x40')](handleError(_0x3962aa,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index d65e956..6fcd141 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x58e575,_0x21f2b4){var _0x16b06a=function(_0x421737){while(--_0x421737){_0x58e575['push'](_0x58e575['shift']());}};_0x16b06a(++_0x21f2b4);}(_0xb7e7,0x121));var _0x7b7e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xb7e7[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index c49fd1a..b18d182 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 _0xaccd=['create','body','options','raw','UpdateSmsQueueReport','update','limit','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport'];(function(_0x4dc3ac,_0x46853c){var _0x1cfa22=function(_0x3a82ae){while(--_0x3a82ae){_0x4dc3ac['push'](_0x4dc3ac['shift']());}};_0x1cfa22(++_0x46853c);}(_0xaccd,0x100));var _0xdacc=function(_0x31a1c8,_0x1febb8){_0x31a1c8=_0x31a1c8-0x0;var _0x2d38ef=_0xaccd[_0x31a1c8];return _0x2d38ef;};'use strict';var _=require('lodash');var util=require(_0xdacc('0x0'));var moment=require(_0xdacc('0x1'));var BPromise=require(_0xdacc('0x2'));var rs=require(_0xdacc('0x3'));var fs=require('fs');var Redis=require(_0xdacc('0x4'));var db=require(_0xdacc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdacc('0x6'))(_0xdacc('0x7'));var config=require('../../config/environment');var jayson=require(_0xdacc('0x8'));var client=jayson[_0xdacc('0x9')][_0xdacc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x495ec0,_0x260d04,_0x2adb33){return new BPromise(function(_0x329a19,_0x4cccd5){return client[_0xdacc('0xb')](_0x495ec0,_0x2adb33)[_0xdacc('0xc')](function(_0x4e2d0a){logger[_0xdacc('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x260d04,_0xdacc('0xe'));logger['debug'](_0xdacc('0xf'),_0x260d04,_0xdacc('0xe'),JSON[_0xdacc('0x10')](_0x4e2d0a));if(_0x4e2d0a[_0xdacc('0x11')]){if(_0x4e2d0a['error']['code']===0x1f4){logger[_0xdacc('0x11')](_0xdacc('0x12'),_0x260d04,_0x4e2d0a[_0xdacc('0x11')][_0xdacc('0x13')]);return _0x4cccd5(_0x4e2d0a[_0xdacc('0x11')][_0xdacc('0x13')]);}logger[_0xdacc('0x11')](_0xdacc('0x12'),_0x260d04,_0x4e2d0a['error'][_0xdacc('0x13')]);return _0x329a19(_0x4e2d0a[_0xdacc('0x11')][_0xdacc('0x13')]);}else{logger[_0xdacc('0xd')](_0xdacc('0x12'),_0x260d04,_0xdacc('0xe'));_0x329a19(_0x4e2d0a[_0xdacc('0x14')][_0xdacc('0x13')]);}})[_0xdacc('0x15')](function(_0x11d1c8){logger[_0xdacc('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x260d04,_0x11d1c8);_0x4cccd5(_0x11d1c8);});});}exports[_0xdacc('0x16')]=function(_0x54e963){var _0x3ab33a=this;return new Promise(function(_0x2ce6fe,_0x3feff1){return db['SmsQueueReport'][_0xdacc('0x17')](_0x54e963[_0xdacc('0x18')],{'raw':_0x54e963[_0xdacc('0x19')]?_0x54e963[_0xdacc('0x19')][_0xdacc('0x1a')]===undefined?!![]:![]:!![]})[_0xdacc('0xc')](function(_0xb52c95){logger['info'](_0xdacc('0x16'),_0x54e963);logger['debug'](_0xdacc('0x16'),_0x54e963,JSON[_0xdacc('0x10')](_0xb52c95));_0x2ce6fe(_0xb52c95);})[_0xdacc('0x15')](function(_0x25ec04){logger[_0xdacc('0x11')](_0xdacc('0x16'),_0x25ec04[_0xdacc('0x13')],_0x54e963);_0x3feff1(_0x3ab33a['error'](0x1f4,_0x25ec04['message']));});});};exports[_0xdacc('0x1b')]=function(_0x594898){var _0x17f46a=this;return new Promise(function(_0x52548f,_0x1b996e){return db['SmsQueueReport'][_0xdacc('0x1c')](_0x594898[_0xdacc('0x18')],{'raw':_0x594898['options']?_0x594898['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x594898[_0xdacc('0x19')]?_0x594898[_0xdacc('0x19')]['where']||null:null,'attributes':_0x594898[_0xdacc('0x19')]?_0x594898[_0xdacc('0x19')]['attributes']||null:null,'limit':_0x594898['options']?_0x594898[_0xdacc('0x19')][_0xdacc('0x1d')]||null:null})[_0xdacc('0xc')](function(_0x31bc56){logger['info'](_0xdacc('0x1b'),_0x594898);logger[_0xdacc('0x1e')]('UpdateSmsQueueReport',_0x594898,JSON['stringify'](_0x31bc56));_0x52548f(_0x31bc56);})[_0xdacc('0x15')](function(_0x34773f){logger[_0xdacc('0x11')](_0xdacc('0x1b'),_0x34773f[_0xdacc('0x13')],_0x594898);_0x1b996e(_0x17f46a[_0xdacc('0x11')](0x1f4,_0x34773f[_0xdacc('0x13')]));});});}; \ No newline at end of file +var _0x8b59=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','create','body','options','raw','debug','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','lodash','bluebird','randomstring'];(function(_0x1c4504,_0x1305be){var _0x1a98cb=function(_0x17ec13){while(--_0x17ec13){_0x1c4504['push'](_0x1c4504['shift']());}};_0x1a98cb(++_0x1305be);}(_0x8b59,0x1d9));var _0x98b5=function(_0x3d913f,_0x3d7c6c){_0x3d913f=_0x3d913f-0x0;var _0x3b1d9e=_0x8b59[_0x3d913f];return _0x3b1d9e;};'use strict';var _=require(_0x98b5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x98b5('0x1'));var rs=require(_0x98b5('0x2'));var fs=require('fs');var Redis=require(_0x98b5('0x3'));var db=require(_0x98b5('0x4'))['db'];var utils=require(_0x98b5('0x5'));var logger=require(_0x98b5('0x6'))(_0x98b5('0x7'));var config=require(_0x98b5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x98b5('0x9')][_0x98b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14e329,_0x231233,_0x289757){return new BPromise(function(_0x1f28ca,_0xec2a23){return client['request'](_0x14e329,_0x289757)[_0x98b5('0xb')](function(_0x543f1e){logger[_0x98b5('0xc')](_0x98b5('0xd'),_0x231233,_0x98b5('0xe'));logger['debug'](_0x98b5('0xf'),_0x231233,'request\x20sent',JSON[_0x98b5('0x10')](_0x543f1e));if(_0x543f1e[_0x98b5('0x11')]){if(_0x543f1e[_0x98b5('0x11')][_0x98b5('0x12')]===0x1f4){logger[_0x98b5('0x11')](_0x98b5('0xd'),_0x231233,_0x543f1e[_0x98b5('0x11')][_0x98b5('0x13')]);return _0xec2a23(_0x543f1e[_0x98b5('0x11')][_0x98b5('0x13')]);}logger[_0x98b5('0x11')](_0x98b5('0xd'),_0x231233,_0x543f1e[_0x98b5('0x11')]['message']);return _0x1f28ca(_0x543f1e['error'][_0x98b5('0x13')]);}else{logger[_0x98b5('0xc')](_0x98b5('0xd'),_0x231233,_0x98b5('0xe'));_0x1f28ca(_0x543f1e[_0x98b5('0x14')]['message']);}})[_0x98b5('0x15')](function(_0x3ca978){logger[_0x98b5('0x11')](_0x98b5('0xd'),_0x231233,_0x3ca978);_0xec2a23(_0x3ca978);});});}exports[_0x98b5('0x16')]=function(_0x782fa7){var _0xd74fd9=this;return new Promise(function(_0x591c6a,_0x2de0b1){return db['SmsQueueReport'][_0x98b5('0x17')](_0x782fa7[_0x98b5('0x18')],{'raw':_0x782fa7[_0x98b5('0x19')]?_0x782fa7[_0x98b5('0x19')][_0x98b5('0x1a')]===undefined?!![]:![]:!![]})[_0x98b5('0xb')](function(_0x19d990){logger[_0x98b5('0xc')](_0x98b5('0x16'),_0x782fa7);logger[_0x98b5('0x1b')](_0x98b5('0x16'),_0x782fa7,JSON[_0x98b5('0x10')](_0x19d990));_0x591c6a(_0x19d990);})[_0x98b5('0x15')](function(_0x4f9c0e){logger[_0x98b5('0x11')]('CreateSmsQueueReport',_0x4f9c0e[_0x98b5('0x13')],_0x782fa7);_0x2de0b1(_0xd74fd9[_0x98b5('0x11')](0x1f4,_0x4f9c0e[_0x98b5('0x13')]));});});};exports[_0x98b5('0x1c')]=function(_0x4839c5){var _0x47f012=this;return new Promise(function(_0x577535,_0x233460){return db[_0x98b5('0x1d')][_0x98b5('0x1e')](_0x4839c5[_0x98b5('0x18')],{'raw':_0x4839c5[_0x98b5('0x19')]?_0x4839c5[_0x98b5('0x19')][_0x98b5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4839c5[_0x98b5('0x19')]?_0x4839c5[_0x98b5('0x19')][_0x98b5('0x1f')]||null:null,'attributes':_0x4839c5[_0x98b5('0x19')]?_0x4839c5[_0x98b5('0x19')][_0x98b5('0x20')]||null:null,'limit':_0x4839c5[_0x98b5('0x19')]?_0x4839c5[_0x98b5('0x19')][_0x98b5('0x21')]||null:null})[_0x98b5('0xb')](function(_0x39ea88){logger['info'](_0x98b5('0x1c'),_0x4839c5);logger[_0x98b5('0x1b')](_0x98b5('0x1c'),_0x4839c5,JSON[_0x98b5('0x10')](_0x39ea88));_0x577535(_0x39ea88);})[_0x98b5('0x15')](function(_0x2f467e){logger[_0x98b5('0x11')]('UpdateSmsQueueReport',_0x2f467e[_0x98b5('0x13')],_0x4839c5);_0x233460(_0x47f012[_0x98b5('0x11')](0x1f4,_0x2f467e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index bb8818d..86e6c46 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 _0xdbf5=['show','post','put','update','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x3ebecb,_0x59203c){_0x3ebecb=_0x3ebecb-0x0;var _0x47f512=_0xdbf5[_0x3ebecb];return _0x47f512;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')]('/',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xa')]);router[_0x5dbf('0x8')](_0x5dbf('0xb'),auth[_0x5dbf('0x9')](),controller['describe']);router[_0x5dbf('0x8')]('/:id',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xc')]);router[_0x5dbf('0xd')]('/',auth[_0x5dbf('0x9')](),controller['create']);router[_0x5dbf('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5dbf('0xf')]);router['delete']('/:id',auth[_0x5dbf('0x9')](),controller['destroy']);module[_0x5dbf('0x10')]=router; \ No newline at end of file +var _0xac95=['/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','describe'];(function(_0x5dbaa7,_0x1f6d4a){var _0x481319=function(_0x116e27){while(--_0x116e27){_0x5dbaa7['push'](_0x5dbaa7['shift']());}};_0x481319(++_0x1f6d4a);}(_0xac95,0xa8));var _0x5ac9=function(_0x16df68,_0x517ba7){_0x16df68=_0x16df68-0x0;var _0x1b5bbe=_0xac95[_0x16df68];return _0x1b5bbe;};'use strict';var multer=require(_0x5ac9('0x0'));var util=require(_0x5ac9('0x1'));var path=require(_0x5ac9('0x2'));var timeout=require(_0x5ac9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5ac9('0x4'));var auth=require(_0x5ac9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5ac9('0x6'));var controller=require(_0x5ac9('0x7'));router['get']('/',auth[_0x5ac9('0x8')](),controller[_0x5ac9('0x9')]);router[_0x5ac9('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x5ac9('0xb')]);router[_0x5ac9('0xa')](_0x5ac9('0xc'),auth[_0x5ac9('0x8')](),controller[_0x5ac9('0xd')]);router[_0x5ac9('0xe')]('/',auth['isAuthenticated'](),controller[_0x5ac9('0xf')]);router[_0x5ac9('0x10')]('/:id',auth[_0x5ac9('0x8')](),controller['update']);router[_0x5ac9('0x11')]('/:id',auth[_0x5ac9('0x8')](),controller[_0x5ac9('0x12')]);module[_0x5ac9('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 456fd55..b7e4db3 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x27a7d3,_0x24ca5b){var _0x107ab8=function(_0x5e7453){while(--_0x5e7453){_0x27a7d3['push'](_0x27a7d3['shift']());}};_0x107ab8(++_0x24ca5b);}(_0x54ef,0x112));var _0xf54e=function(_0x92bb2c,_0x54ca05){_0x92bb2c=_0x92bb2c-0x0;var _0x4a6525=_0x54ef[_0x92bb2c];return _0x4a6525;};'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 +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x1e58c8,_0x29bf55){var _0x4cdc58=function(_0x1279ec){while(--_0x1279ec){_0x1e58c8['push'](_0x1e58c8['shift']());}};_0x4cdc58(++_0x29bf55);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x00bb[_0x4fc9e6];return _0x551d28;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index f7e77ce..879bbab 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 _0x115f=['rows','catch','show','params','length','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','SmsTransferReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','findAll'];(function(_0x33d124,_0x536de7){var _0x30f108=function(_0x3d7299){while(--_0x3d7299){_0x33d124['push'](_0x33d124['shift']());}};_0x30f108(++_0x536de7);}(_0x115f,0x17d));var _0xf115=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x115f[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0xf115('0x0'));var rimraf=require(_0xf115('0x1'));var zipdir=require(_0xf115('0x2'));var jsonpatch=require(_0xf115('0x3'));var rp=require(_0xf115('0x4'));var moment=require(_0xf115('0x5'));var BPromise=require(_0xf115('0x6'));var Mustache=require(_0xf115('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf115('0x8'));var csv=require(_0xf115('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf115('0xa'));var squel=require(_0xf115('0xb'));var crypto=require(_0xf115('0xc'));var jsforce=require(_0xf115('0xd'));var deskjs=require(_0xf115('0xe'));var toCsv=require(_0xf115('0x9'));var querystring=require(_0xf115('0xf'));var Papa=require(_0xf115('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf115('0x11'));var as=require(_0xf115('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf115('0x13'))(_0xf115('0x14'));var utils=require('../../config/utils');var config=require(_0xf115('0x15'));var licenseUtil=require(_0xf115('0x16'));var db=require(_0xf115('0x17'))['db'];function respondWithStatusCode(_0x5288ba,_0x2019f1){_0x2019f1=_0x2019f1||0xcc;return function(_0xc80fa1){if(_0xc80fa1){return _0x5288ba[_0xf115('0x18')](_0x2019f1);}return _0x5288ba[_0xf115('0x19')](_0x2019f1)['end']();};}function respondWithResult(_0x434bf7,_0x38abc7){_0x38abc7=_0x38abc7||0xc8;return function(_0x1c5da4){if(_0x1c5da4){return _0x434bf7[_0xf115('0x19')](_0x38abc7)[_0xf115('0x1a')](_0x1c5da4);}};}function respondWithFilteredResult(_0x211e7f,_0x157c47){return function(_0x37e0f8){if(_0x37e0f8){var _0x399971=typeof _0x157c47[_0xf115('0x1b')]===_0xf115('0x1c')&&typeof _0x157c47[_0xf115('0x1d')]===_0xf115('0x1c');var _0x4722ae=_0x37e0f8[_0xf115('0x1e')];var _0x2787f1=_0x399971?0x0:_0x157c47[_0xf115('0x1b')];var _0x3e764c=_0x399971?_0x37e0f8[_0xf115('0x1e')]:_0x157c47['offset']+_0x157c47[_0xf115('0x1d')];var _0x4b3495;if(_0x3e764c>=_0x4722ae){_0x3e764c=_0x4722ae;_0x4b3495=0xc8;}else{_0x4b3495=0xce;}_0x211e7f['status'](_0x4b3495);return _0x211e7f[_0xf115('0x1f')](_0xf115('0x20'),_0x2787f1+'-'+_0x3e764c+'/'+_0x4722ae)['json'](_0x37e0f8);}return null;};}function patchUpdates(_0x4c4a47){return function(_0x2266bd){try{jsonpatch[_0xf115('0x21')](_0x2266bd,_0x4c4a47,!![]);}catch(_0x58fd5a){return BPromise['reject'](_0x58fd5a);}return _0x2266bd[_0xf115('0x22')]();};}function saveUpdates(_0x462ff0,_0x432d42){return function(_0x3a064b){if(_0x3a064b){return _0x3a064b[_0xf115('0x23')](_0x462ff0)[_0xf115('0x24')](function(_0x1cc74c){return _0x1cc74c;});}return null;};}function removeEntity(_0x42a7ee,_0x3d0434){return function(_0x2256d8){if(_0x2256d8){return _0x2256d8[_0xf115('0x25')]()[_0xf115('0x24')](function(){_0x42a7ee[_0xf115('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x976283,_0x5375d1){return function(_0x1c5138){if(!_0x1c5138){_0x976283[_0xf115('0x18')](0x194);}return _0x1c5138;};}function handleError(_0xfd5996,_0x2cf839){_0x2cf839=_0x2cf839||0x1f4;return function(_0x1c273f){logger['error'](_0x1c273f[_0xf115('0x26')]);if(_0x1c273f[_0xf115('0x27')]){delete _0x1c273f[_0xf115('0x27')];}_0xfd5996[_0xf115('0x19')](_0x2cf839)[_0xf115('0x28')](_0x1c273f);};}exports[_0xf115('0x29')]=function(_0x5677b,_0x28ffd9){var _0x58ad15={},_0x153ac6={},_0x3c80de={'count':0x0,'rows':[]};var _0x2ba8d1=_[_0xf115('0x2a')](db[_0xf115('0x2b')]['rawAttributes'],function(_0x47340e){return{'name':_0x47340e[_0xf115('0x2c')],'type':_0x47340e[_0xf115('0x2d')][_0xf115('0x2e')]};});_0x153ac6[_0xf115('0x2f')]=_[_0xf115('0x2a')](_0x2ba8d1,_0xf115('0x27'));_0x153ac6['query']=_[_0xf115('0x30')](_0x5677b[_0xf115('0x31')]);_0x153ac6[_0xf115('0x32')]=_[_0xf115('0x33')](_0x153ac6[_0xf115('0x2f')],_0x153ac6['query']);_0x58ad15[_0xf115('0x34')]=_[_0xf115('0x33')](_0x153ac6[_0xf115('0x2f')],qs[_0xf115('0x35')](_0x5677b['query'][_0xf115('0x35')]));_0x58ad15[_0xf115('0x34')]=_0x58ad15['attributes']['length']?_0x58ad15[_0xf115('0x34')]:_0x153ac6[_0xf115('0x2f')];if(!_0x5677b[_0xf115('0x31')][_0xf115('0x36')](_0xf115('0x37'))){_0x58ad15[_0xf115('0x1d')]=qs['limit'](_0x5677b[_0xf115('0x31')][_0xf115('0x1d')]);_0x58ad15[_0xf115('0x1b')]=qs[_0xf115('0x1b')](_0x5677b[_0xf115('0x31')][_0xf115('0x1b')]);}_0x58ad15[_0xf115('0x38')]=qs[_0xf115('0x39')](_0x5677b[_0xf115('0x31')][_0xf115('0x39')]);_0x58ad15['where']=qs[_0xf115('0x32')](_['pick'](_0x5677b[_0xf115('0x31')],_0x153ac6[_0xf115('0x32')]),_0x2ba8d1);if(_0x5677b[_0xf115('0x31')][_0xf115('0x3a')]){_0x58ad15[_0xf115('0x3b')]=_[_0xf115('0x3c')](_0x58ad15[_0xf115('0x3b')],{'$or':_['map'](_0x2ba8d1,function(_0x27b222){if(_0x27b222['type']!==_0xf115('0x3d')){var _0x3e62d8={};_0x3e62d8[_0x27b222[_0xf115('0x27')]]={'$like':'%'+_0x5677b[_0xf115('0x31')]['filter']+'%'};return _0x3e62d8;}})});}_0x58ad15=_[_0xf115('0x3c')]({},_0x58ad15,_0x5677b['options']);var _0x4dc4e1={'where':_0x58ad15[_0xf115('0x3b')]};return db[_0xf115('0x2b')][_0xf115('0x1e')](_0x4dc4e1)[_0xf115('0x24')](function(_0x1f476a){_0x3c80de['count']=_0x1f476a;if(_0x5677b[_0xf115('0x31')]['includeAll']){_0x58ad15['include']=[{'all':!![]}];}return db[_0xf115('0x2b')][_0xf115('0x3e')](_0x58ad15);})[_0xf115('0x24')](function(_0x3180b9){_0x3c80de[_0xf115('0x3f')]=_0x3180b9;return _0x3c80de;})['then'](respondWithFilteredResult(_0x28ffd9,_0x58ad15))[_0xf115('0x40')](handleError(_0x28ffd9,null));};exports[_0xf115('0x41')]=function(_0x18eb87,_0x11e006){var _0x4baf9b={'raw':!![],'where':{'id':_0x18eb87[_0xf115('0x42')]['id']}},_0x20880c={};_0x20880c['model']=_[_0xf115('0x30')](db[_0xf115('0x2b')]['rawAttributes']);_0x20880c[_0xf115('0x31')]=_[_0xf115('0x30')](_0x18eb87[_0xf115('0x31')]);_0x20880c[_0xf115('0x32')]=_[_0xf115('0x33')](_0x20880c[_0xf115('0x2f')],_0x20880c[_0xf115('0x31')]);_0x4baf9b['attributes']=_['intersection'](_0x20880c['model'],qs['fields'](_0x18eb87['query'][_0xf115('0x35')]));_0x4baf9b[_0xf115('0x34')]=_0x4baf9b['attributes'][_0xf115('0x43')]?_0x4baf9b[_0xf115('0x34')]:_0x20880c['model'];if(_0x18eb87[_0xf115('0x31')][_0xf115('0x44')]){_0x4baf9b[_0xf115('0x45')]=[{'all':!![]}];}_0x4baf9b=_[_0xf115('0x3c')]({},_0x4baf9b,_0x18eb87['options']);return db[_0xf115('0x2b')][_0xf115('0x46')](_0x4baf9b)['then'](handleEntityNotFound(_0x11e006,null))[_0xf115('0x24')](respondWithResult(_0x11e006,null))[_0xf115('0x40')](handleError(_0x11e006,null));};exports[_0xf115('0x47')]=function(_0x11f915,_0x55cacf){return db[_0xf115('0x2b')][_0xf115('0x47')](_0x11f915[_0xf115('0x48')],{})[_0xf115('0x24')](respondWithResult(_0x55cacf,0xc9))[_0xf115('0x40')](handleError(_0x55cacf,null));};exports['update']=function(_0x90625e,_0x34d13b){if(_0x90625e[_0xf115('0x48')]['id']){delete _0x90625e[_0xf115('0x48')]['id'];}return db[_0xf115('0x2b')]['find']({'where':{'id':_0x90625e[_0xf115('0x42')]['id']}})[_0xf115('0x24')](handleEntityNotFound(_0x34d13b,null))[_0xf115('0x24')](saveUpdates(_0x90625e[_0xf115('0x48')],null))['then'](respondWithResult(_0x34d13b,null))[_0xf115('0x40')](handleError(_0x34d13b,null));};exports[_0xf115('0x25')]=function(_0x3cf69d,_0x1f0905){return db['SmsTransferReport'][_0xf115('0x46')]({'where':{'id':_0x3cf69d[_0xf115('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f0905,null))[_0xf115('0x24')](removeEntity(_0x1f0905,null))[_0xf115('0x40')](handleError(_0x1f0905,null));};exports[_0xf115('0x49')]=function(_0x27511f,_0x2b4bf2){return db['SmsTransferReport'][_0xf115('0x49')]()[_0xf115('0x24')](respondWithResult(_0x2b4bf2,null))[_0xf115('0x40')](handleError(_0x2b4bf2,null));}; \ No newline at end of file +var _0xac61=['../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','SmsTransferReport','fieldName','key','map','query','filters','model','attributes','intersection','length','nolimit','order','sort','pick','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','fields','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0xac61,0x119));var _0x1ac6=function(_0x3427e7,_0x4134b5){_0x3427e7=_0x3427e7-0x0;var _0x17f758=_0xac61[_0x3427e7];return _0x17f758;};'use strict';var emlformat=require(_0x1ac6('0x0'));var rimraf=require(_0x1ac6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ac6('0x2'));var rp=require(_0x1ac6('0x3'));var moment=require(_0x1ac6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1ac6('0x5'));var util=require(_0x1ac6('0x6'));var path=require(_0x1ac6('0x7'));var sox=require(_0x1ac6('0x8'));var csv=require(_0x1ac6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1ac6('0xa'));var _=require(_0x1ac6('0xb'));var squel=require('squel');var crypto=require(_0x1ac6('0xc'));var jsforce=require(_0x1ac6('0xd'));var deskjs=require(_0x1ac6('0xe'));var toCsv=require(_0x1ac6('0x9'));var querystring=require(_0x1ac6('0xf'));var Papa=require('papaparse');var Redis=require(_0x1ac6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1ac6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ac6('0x12'));var logger=require(_0x1ac6('0x13'))(_0x1ac6('0x14'));var utils=require(_0x1ac6('0x15'));var config=require(_0x1ac6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ac6('0x17'))['db'];function respondWithStatusCode(_0x2e4787,_0xe09ff0){_0xe09ff0=_0xe09ff0||0xcc;return function(_0x2a3810){if(_0x2a3810){return _0x2e4787[_0x1ac6('0x18')](_0xe09ff0);}return _0x2e4787[_0x1ac6('0x19')](_0xe09ff0)[_0x1ac6('0x1a')]();};}function respondWithResult(_0x57f265,_0x5211c1){_0x5211c1=_0x5211c1||0xc8;return function(_0x3f21ab){if(_0x3f21ab){return _0x57f265[_0x1ac6('0x19')](_0x5211c1)['json'](_0x3f21ab);}};}function respondWithFilteredResult(_0x294d78,_0x829a2f){return function(_0x32004a){if(_0x32004a){var _0x3c2b04=typeof _0x829a2f[_0x1ac6('0x1b')]==='undefined'&&typeof _0x829a2f[_0x1ac6('0x1c')]==='undefined';var _0x343ed1=_0x32004a['count'];var _0x1c3227=_0x3c2b04?0x0:_0x829a2f[_0x1ac6('0x1b')];var _0x55515a=_0x3c2b04?_0x32004a[_0x1ac6('0x1d')]:_0x829a2f[_0x1ac6('0x1b')]+_0x829a2f[_0x1ac6('0x1c')];var _0x240291;if(_0x55515a>=_0x343ed1){_0x55515a=_0x343ed1;_0x240291=0xc8;}else{_0x240291=0xce;}_0x294d78['status'](_0x240291);return _0x294d78[_0x1ac6('0x1e')](_0x1ac6('0x1f'),_0x1c3227+'-'+_0x55515a+'/'+_0x343ed1)[_0x1ac6('0x20')](_0x32004a);}return null;};}function patchUpdates(_0x125348){return function(_0x2f82da){try{jsonpatch[_0x1ac6('0x21')](_0x2f82da,_0x125348,!![]);}catch(_0x36e079){return BPromise[_0x1ac6('0x22')](_0x36e079);}return _0x2f82da[_0x1ac6('0x23')]();};}function saveUpdates(_0x2578c8,_0x319254){return function(_0x2a57bc){if(_0x2a57bc){return _0x2a57bc['update'](_0x2578c8)[_0x1ac6('0x24')](function(_0x1ca423){return _0x1ca423;});}return null;};}function removeEntity(_0x98bffc,_0xe8cb9d){return function(_0x115eb0){if(_0x115eb0){return _0x115eb0[_0x1ac6('0x25')]()[_0x1ac6('0x24')](function(){_0x98bffc[_0x1ac6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11007d,_0x2e5bda){return function(_0x98534d){if(!_0x98534d){_0x11007d['sendStatus'](0x194);}return _0x98534d;};}function handleError(_0x223f9a,_0x477945){_0x477945=_0x477945||0x1f4;return function(_0x1db94e){logger[_0x1ac6('0x26')](_0x1db94e[_0x1ac6('0x27')]);if(_0x1db94e[_0x1ac6('0x28')]){delete _0x1db94e[_0x1ac6('0x28')];}_0x223f9a[_0x1ac6('0x19')](_0x477945)['send'](_0x1db94e);};}exports[_0x1ac6('0x29')]=function(_0x2ae977,_0x316017){var _0x1b76ba={},_0x2c542c={},_0x2ae676={'count':0x0,'rows':[]};var _0x2a8d29=_['map'](db[_0x1ac6('0x2a')]['rawAttributes'],function(_0x472bfd){return{'name':_0x472bfd[_0x1ac6('0x2b')],'type':_0x472bfd['type'][_0x1ac6('0x2c')]};});_0x2c542c['model']=_[_0x1ac6('0x2d')](_0x2a8d29,'name');_0x2c542c[_0x1ac6('0x2e')]=_['keys'](_0x2ae977[_0x1ac6('0x2e')]);_0x2c542c[_0x1ac6('0x2f')]=_['intersection'](_0x2c542c[_0x1ac6('0x30')],_0x2c542c[_0x1ac6('0x2e')]);_0x1b76ba[_0x1ac6('0x31')]=_[_0x1ac6('0x32')](_0x2c542c[_0x1ac6('0x30')],qs['fields'](_0x2ae977[_0x1ac6('0x2e')]['fields']));_0x1b76ba[_0x1ac6('0x31')]=_0x1b76ba[_0x1ac6('0x31')][_0x1ac6('0x33')]?_0x1b76ba[_0x1ac6('0x31')]:_0x2c542c[_0x1ac6('0x30')];if(!_0x2ae977['query']['hasOwnProperty'](_0x1ac6('0x34'))){_0x1b76ba[_0x1ac6('0x1c')]=qs['limit'](_0x2ae977[_0x1ac6('0x2e')][_0x1ac6('0x1c')]);_0x1b76ba[_0x1ac6('0x1b')]=qs[_0x1ac6('0x1b')](_0x2ae977['query'][_0x1ac6('0x1b')]);}_0x1b76ba[_0x1ac6('0x35')]=qs[_0x1ac6('0x36')](_0x2ae977[_0x1ac6('0x2e')]['sort']);_0x1b76ba['where']=qs[_0x1ac6('0x2f')](_[_0x1ac6('0x37')](_0x2ae977[_0x1ac6('0x2e')],_0x2c542c[_0x1ac6('0x2f')]),_0x2a8d29);if(_0x2ae977[_0x1ac6('0x2e')]['filter']){_0x1b76ba['where']=_[_0x1ac6('0x38')](_0x1b76ba[_0x1ac6('0x39')],{'$or':_[_0x1ac6('0x2d')](_0x2a8d29,function(_0x5ae80d){if(_0x5ae80d[_0x1ac6('0x3a')]!==_0x1ac6('0x3b')){var _0x3d4e9a={};_0x3d4e9a[_0x5ae80d[_0x1ac6('0x28')]]={'$like':'%'+_0x2ae977[_0x1ac6('0x2e')]['filter']+'%'};return _0x3d4e9a;}})});}_0x1b76ba=_['merge']({},_0x1b76ba,_0x2ae977[_0x1ac6('0x3c')]);var _0x221862={'where':_0x1b76ba[_0x1ac6('0x39')]};return db[_0x1ac6('0x2a')][_0x1ac6('0x1d')](_0x221862)[_0x1ac6('0x24')](function(_0x3f6ed1){_0x2ae676[_0x1ac6('0x1d')]=_0x3f6ed1;if(_0x2ae977[_0x1ac6('0x2e')][_0x1ac6('0x3d')]){_0x1b76ba[_0x1ac6('0x3e')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x1ac6('0x3f')](_0x1b76ba);})[_0x1ac6('0x24')](function(_0x40a784){_0x2ae676[_0x1ac6('0x40')]=_0x40a784;return _0x2ae676;})[_0x1ac6('0x24')](respondWithFilteredResult(_0x316017,_0x1b76ba))[_0x1ac6('0x41')](handleError(_0x316017,null));};exports[_0x1ac6('0x42')]=function(_0x2bb463,_0x174cb8){var _0x4c1a63={'raw':!![],'where':{'id':_0x2bb463[_0x1ac6('0x43')]['id']}},_0x9f06fb={};_0x9f06fb[_0x1ac6('0x30')]=_[_0x1ac6('0x44')](db[_0x1ac6('0x2a')][_0x1ac6('0x45')]);_0x9f06fb[_0x1ac6('0x2e')]=_[_0x1ac6('0x44')](_0x2bb463[_0x1ac6('0x2e')]);_0x9f06fb[_0x1ac6('0x2f')]=_['intersection'](_0x9f06fb[_0x1ac6('0x30')],_0x9f06fb[_0x1ac6('0x2e')]);_0x4c1a63[_0x1ac6('0x31')]=_['intersection'](_0x9f06fb[_0x1ac6('0x30')],qs['fields'](_0x2bb463[_0x1ac6('0x2e')][_0x1ac6('0x46')]));_0x4c1a63[_0x1ac6('0x31')]=_0x4c1a63[_0x1ac6('0x31')][_0x1ac6('0x33')]?_0x4c1a63[_0x1ac6('0x31')]:_0x9f06fb[_0x1ac6('0x30')];if(_0x2bb463[_0x1ac6('0x2e')][_0x1ac6('0x3d')]){_0x4c1a63[_0x1ac6('0x3e')]=[{'all':!![]}];}_0x4c1a63=_['merge']({},_0x4c1a63,_0x2bb463[_0x1ac6('0x3c')]);return db[_0x1ac6('0x2a')][_0x1ac6('0x47')](_0x4c1a63)['then'](handleEntityNotFound(_0x174cb8,null))[_0x1ac6('0x24')](respondWithResult(_0x174cb8,null))['catch'](handleError(_0x174cb8,null));};exports[_0x1ac6('0x48')]=function(_0x209926,_0x2431ad){return db[_0x1ac6('0x2a')]['create'](_0x209926[_0x1ac6('0x49')],{})['then'](respondWithResult(_0x2431ad,0xc9))['catch'](handleError(_0x2431ad,null));};exports[_0x1ac6('0x4a')]=function(_0x4a7594,_0x3a8ff8){if(_0x4a7594[_0x1ac6('0x49')]['id']){delete _0x4a7594['body']['id'];}return db[_0x1ac6('0x2a')][_0x1ac6('0x47')]({'where':{'id':_0x4a7594[_0x1ac6('0x43')]['id']}})['then'](handleEntityNotFound(_0x3a8ff8,null))['then'](saveUpdates(_0x4a7594[_0x1ac6('0x49')],null))[_0x1ac6('0x24')](respondWithResult(_0x3a8ff8,null))[_0x1ac6('0x41')](handleError(_0x3a8ff8,null));};exports[_0x1ac6('0x25')]=function(_0x24f37b,_0x4bb635){return db[_0x1ac6('0x2a')][_0x1ac6('0x47')]({'where':{'id':_0x24f37b[_0x1ac6('0x43')]['id']}})[_0x1ac6('0x24')](handleEntityNotFound(_0x4bb635,null))[_0x1ac6('0x24')](removeEntity(_0x4bb635,null))[_0x1ac6('0x41')](handleError(_0x4bb635,null));};exports[_0x1ac6('0x4b')]=function(_0x15e563,_0x5ae50e){return db[_0x1ac6('0x2a')][_0x1ac6('0x4b')]()['then'](respondWithResult(_0x5ae50e,null))[_0x1ac6('0x41')](handleError(_0x5ae50e,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 318b189..4d6d4dd 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 _0x3685=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4e4a90,_0x3bb089){var _0x4a6b89=function(_0x367eb1){while(--_0x367eb1){_0x4e4a90['push'](_0x4e4a90['shift']());}};_0x4a6b89(++_0x3bb089);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5368('0x0'));var util=require('util');var logger=require(_0x5368('0x1'))(_0x5368('0x2'));var moment=require(_0x5368('0x3'));var BPromise=require(_0x5368('0x4'));var rp=require(_0x5368('0x5'));var fs=require('fs');var path=require(_0x5368('0x6'));var rimraf=require(_0x5368('0x7'));var config=require(_0x5368('0x8'));var attributes=require(_0x5368('0x9'));module[_0x5368('0xa')]=function(_0x4fc6ed,_0x1a4450){return _0x4fc6ed[_0x5368('0xb')](_0x5368('0xc'),attributes,{'tableName':_0x5368('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5368('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x42b0=['api','bluebird','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport','report_sms_transfer','lodash','util'];(function(_0x494f4b,_0x26a068){var _0x3e2192=function(_0xccf4df){while(--_0xccf4df){_0x494f4b['push'](_0x494f4b['shift']());}};_0x3e2192(++_0x26a068);}(_0x42b0,0xbc));var _0x042b=function(_0x27a3be,_0x5dea43){_0x27a3be=_0x27a3be-0x0;var _0x16d496=_0x42b0[_0x27a3be];return _0x16d496;};'use strict';var _=require(_0x042b('0x0'));var util=require(_0x042b('0x1'));var logger=require('../../config/logger')(_0x042b('0x2'));var moment=require('moment');var BPromise=require(_0x042b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x042b('0x4'));var config=require(_0x042b('0x5'));var attributes=require(_0x042b('0x6'));module[_0x042b('0x7')]=function(_0x135bc1,_0x5d194a){return _0x135bc1['define'](_0x042b('0x8'),attributes,{'tableName':_0x042b('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index a9bd42d..6923aa9 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 _0xf23b=['SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x526b9b,_0x16dc98){var _0x5618e6=function(_0x31283c){while(--_0x31283c){_0x526b9b['push'](_0x526b9b['shift']());}};_0x5618e6(++_0x16dc98);}(_0xf23b,0x133));var _0xbf23=function(_0x323e02,_0x2b1ac6){_0x323e02=_0x323e02-0x0;var _0x1a9772=_0xf23b[_0x323e02];return _0x1a9772;};'use strict';var _=require(_0xbf23('0x0'));var util=require(_0xbf23('0x1'));var moment=require(_0xbf23('0x2'));var BPromise=require(_0xbf23('0x3'));var rs=require(_0xbf23('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf23('0x5'))['db'];var utils=require(_0xbf23('0x6'));var logger=require(_0xbf23('0x7'))('rpc');var config=require(_0xbf23('0x8'));var jayson=require(_0xbf23('0x9'));var client=jayson[_0xbf23('0xa')][_0xbf23('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18857b,_0x4c0869,_0x4b5e1e){return new BPromise(function(_0x41b721,_0x486c02){return client[_0xbf23('0xc')](_0x18857b,_0x4b5e1e)[_0xbf23('0xd')](function(_0x378d37){logger[_0xbf23('0xe')](_0xbf23('0xf'),_0x4c0869,'request\x20sent');logger[_0xbf23('0x10')](_0xbf23('0x11'),_0x4c0869,_0xbf23('0x12'),JSON[_0xbf23('0x13')](_0x378d37));if(_0x378d37[_0xbf23('0x14')]){if(_0x378d37[_0xbf23('0x14')]['code']===0x1f4){logger[_0xbf23('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x4c0869,_0x378d37[_0xbf23('0x14')]['message']);return _0x486c02(_0x378d37[_0xbf23('0x14')][_0xbf23('0x15')]);}logger['error'](_0xbf23('0xf'),_0x4c0869,_0x378d37['error']['message']);return _0x41b721(_0x378d37[_0xbf23('0x14')][_0xbf23('0x15')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x4c0869,_0xbf23('0x12'));_0x41b721(_0x378d37['result'][_0xbf23('0x15')]);}})[_0xbf23('0x16')](function(_0x3e3575){logger[_0xbf23('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x4c0869,_0x3e3575);_0x486c02(_0x3e3575);});});} \ No newline at end of file +var _0xf53f=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x4adcc5,_0x30623f){var _0x350fab=function(_0x4a865d){while(--_0x4a865d){_0x4adcc5['push'](_0x4adcc5['shift']());}};_0x350fab(++_0x30623f);}(_0xf53f,0x8d));var _0xff53=function(_0x364024,_0x1d6a2e){_0x364024=_0x364024-0x0;var _0x1de29d=_0xf53f[_0x364024];return _0x1de29d;};'use strict';var _=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var moment=require(_0xff53('0x2'));var BPromise=require(_0xff53('0x3'));var rs=require(_0xff53('0x4'));var fs=require('fs');var Redis=require(_0xff53('0x5'));var db=require(_0xff53('0x6'))['db'];var utils=require(_0xff53('0x7'));var logger=require(_0xff53('0x8'))(_0xff53('0x9'));var config=require(_0xff53('0xa'));var jayson=require(_0xff53('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27b397,_0x5751e7,_0x1c27bb){return new BPromise(function(_0x122746,_0x1bc4b3){return client['request'](_0x27b397,_0x1c27bb)['then'](function(_0x3c001d){logger['info'](_0xff53('0xc'),_0x5751e7,_0xff53('0xd'));logger['debug'](_0xff53('0xe'),_0x5751e7,_0xff53('0xd'),JSON['stringify'](_0x3c001d));if(_0x3c001d[_0xff53('0xf')]){if(_0x3c001d[_0xff53('0xf')][_0xff53('0x10')]===0x1f4){logger['error'](_0xff53('0xc'),_0x5751e7,_0x3c001d[_0xff53('0xf')][_0xff53('0x11')]);return _0x1bc4b3(_0x3c001d['error'][_0xff53('0x11')]);}logger[_0xff53('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x5751e7,_0x3c001d['error']['message']);return _0x122746(_0x3c001d['error'][_0xff53('0x11')]);}else{logger[_0xff53('0x12')](_0xff53('0xc'),_0x5751e7,'request\x20sent');_0x122746(_0x3c001d[_0xff53('0x13')]['message']);}})['catch'](function(_0x12e90b){logger[_0xff53('0xf')](_0xff53('0xc'),_0x5751e7,_0x12e90b);_0x1bc4b3(_0x12e90b);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index eb745d5..b4bbf80 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 _0xb18d=['get','isAuthenticated','index','show','/:id/download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','post','file','create','/:id','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb18d,0x17e));var _0xdb18=function(_0x37bd25,_0x3d52c1){_0x37bd25=_0x37bd25-0x0;var _0x1142f4=_0xb18d[_0x37bd25];return _0x1142f4;};'use strict';var multer=require(_0xdb18('0x0'));var util=require(_0xdb18('0x1'));var path=require(_0xdb18('0x2'));var timeout=require(_0xdb18('0x3'));var express=require(_0xdb18('0x4'));var router=express[_0xdb18('0x5')]();var fs_extra=require(_0xdb18('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdb18('0x7'));var config=require(_0xdb18('0x8'));var controller=require(_0xdb18('0x9'));router[_0xdb18('0xa')]('/',auth[_0xdb18('0xb')](),controller[_0xdb18('0xc')]);router[_0xdb18('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xdb18('0xd')]);router['get'](_0xdb18('0xe'),auth[_0xdb18('0xb')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4a74cd,_0x5ce3a4,_0x36ab7a){_0x36ab7a(null,path[_0xdb18('0xf')](config[_0xdb18('0x10')],_0xdb18('0x11')));},'filename':function(_0x326acf,_0xc33497,_0x52378a){_0xc33497[_0xdb18('0x12')]=_0xc33497[_0xdb18('0x12')][_0xdb18('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52378a(null,util[_0xdb18('0x14')](_0xdb18('0x15'),path[_0xdb18('0x16')](_0xc33497[_0xdb18('0x12')],path['extname'](_0xc33497[_0xdb18('0x12')])),Date['now'](),path['extname'](_0xc33497[_0xdb18('0x12')])));}})});router[_0xdb18('0x17')]('/',upload['single'](_0xdb18('0x18')),controller[_0xdb18('0x19')]);router['put'](_0xdb18('0x1a'),auth[_0xdb18('0xb')](),controller['update']);router[_0xdb18('0x1b')](_0xdb18('0x1a'),auth[_0xdb18('0xb')](),controller[_0xdb18('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x0b77=['join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','extname','single','file','create','put','isAuthenticated','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','/:id/download','download'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x0b77,0x16d));var _0x70b7=function(_0x453e2b,_0x4f1258){_0x453e2b=_0x453e2b-0x0;var _0x50f306=_0x0b77[_0x453e2b];return _0x50f306;};'use strict';var multer=require('multer');var util=require(_0x70b7('0x0'));var path=require(_0x70b7('0x1'));var timeout=require(_0x70b7('0x2'));var express=require(_0x70b7('0x3'));var router=express[_0x70b7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x70b7('0x5'));var interaction=require(_0x70b7('0x6'));var config=require(_0x70b7('0x7'));var controller=require('./sound.controller');router[_0x70b7('0x8')]('/',auth['isAuthenticated'](),controller[_0x70b7('0x9')]);router[_0x70b7('0x8')](_0x70b7('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x70b7('0x8')](_0x70b7('0xb'),auth['isAuthenticated'](),controller[_0x70b7('0xc')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x14ae67,_0x39ae5c,_0x9c1fe2){_0x9c1fe2(null,path[_0x70b7('0xd')](config[_0x70b7('0xe')],_0x70b7('0xf')));},'filename':function(_0x236828,_0x5a7076,_0x169389){_0x5a7076['originalname']=_0x5a7076[_0x70b7('0x10')][_0x70b7('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x169389(null,util['format'](_0x70b7('0x12'),path['basename'](_0x5a7076['originalname'],path[_0x70b7('0x13')](_0x5a7076['originalname'])),Date['now'](),path[_0x70b7('0x13')](_0x5a7076[_0x70b7('0x10')])));}})});router['post']('/',upload[_0x70b7('0x14')](_0x70b7('0x15')),controller[_0x70b7('0x16')]);router[_0x70b7('0x17')](_0x70b7('0xa'),auth[_0x70b7('0x18')](),controller['update']);router[_0x70b7('0x19')](_0x70b7('0xa'),auth['isAuthenticated'](),controller[_0x70b7('0x19')]);module[_0x70b7('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 78e79e7..703303c 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 _0x3ffb=['BIGINT','INTEGER','sequelize','STRING','FLOAT'];(function(_0x361e5d,_0x15e1a4){var _0x4c303d=function(_0x504f9f){while(--_0x504f9f){_0x361e5d['push'](_0x361e5d['shift']());}};_0x4c303d(++_0x15e1a4);}(_0x3ffb,0xfc));var _0xb3ff=function(_0x5d0a55,_0x56a92f){_0x5d0a55=_0x5d0a55-0x0;var _0x53ad00=_0x3ffb[_0x5d0a55];return _0x53ad00;};'use strict';var Sequelize=require(_0xb3ff('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xb3ff('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xb3ff('0x1')]},'original_duration':{'type':Sequelize[_0xb3ff('0x2')]},'original_sampleCount':{'type':Sequelize[_0xb3ff('0x3')]},'original_channelCount':{'type':Sequelize[_0xb3ff('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xb3ff('0x4')]},'converted_format':{'type':Sequelize[_0xb3ff('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xb3ff('0x3')]},'converted_channelCount':{'type':Sequelize[_0xb3ff('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xb3ff('0x4')]}}; \ No newline at end of file +var _0x340d=['BIGINT','exports','STRING','name','FLOAT','INTEGER'];(function(_0x1a62aa,_0x27f866){var _0x913e84=function(_0x47d5c5){while(--_0x47d5c5){_0x1a62aa['push'](_0x1a62aa['shift']());}};_0x913e84(++_0x27f866);}(_0x340d,0x181));var _0xd340=function(_0x3138c2,_0x33baf3){_0x3138c2=_0x3138c2-0x0;var _0x2e8403=_0x340d[_0x3138c2];return _0x2e8403;};'use strict';var Sequelize=require('sequelize');module[_0xd340('0x0')]={'name':{'type':Sequelize[_0xd340('0x1')],'unique':_0xd340('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xd340('0x1')]},'display_name':{'type':Sequelize[_0xd340('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xd340('0x1')]},'original_format':{'type':Sequelize[_0xd340('0x1')]},'original_duration':{'type':Sequelize[_0xd340('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xd340('0x4')]},'original_bitRate':{'type':Sequelize[_0xd340('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xd340('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xd340('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index da82cd2..d6194d5 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 _0x9d7f=['stack','name','send','index','map','Sound','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','includeAll','include','findAll','rows','params','merge','options','find','download','save_name','converted_format','existsSync','join','root','Sequelize','Sound\x20not\x20found','server/files/sounds/converted','%s.%s','catch','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','format','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','Sounds','error'];(function(_0x2d4e30,_0x3f3569){var _0x5e3c76=function(_0x4203ad){while(--_0x4203ad){_0x2d4e30['push'](_0x2d4e30['shift']());}};_0x5e3c76(++_0x3f3569);}(_0x9d7f,0x148));var _0xf9d7=function(_0x5cae6f,_0x3c8bb1){_0x5cae6f=_0x5cae6f-0x0;var _0x284ff4=_0x9d7f[_0x5cae6f];return _0x284ff4;};'use strict';var emlformat=require(_0xf9d7('0x0'));var rimraf=require(_0xf9d7('0x1'));var zipdir=require(_0xf9d7('0x2'));var jsonpatch=require(_0xf9d7('0x3'));var rp=require(_0xf9d7('0x4'));var moment=require(_0xf9d7('0x5'));var BPromise=require(_0xf9d7('0x6'));var Mustache=require(_0xf9d7('0x7'));var util=require(_0xf9d7('0x8'));var path=require('path');var sox=require(_0xf9d7('0x9'));var csv=require(_0xf9d7('0xa'));var ejs=require(_0xf9d7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf9d7('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf9d7('0xd'));var deskjs=require(_0xf9d7('0xe'));var toCsv=require(_0xf9d7('0xa'));var querystring=require('querystring');var Papa=require(_0xf9d7('0xf'));var Redis=require('ioredis');var authService=require(_0xf9d7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf9d7('0x11'))('api');var utils=require(_0xf9d7('0x12'));var config=require(_0xf9d7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xf9d7('0x14'))['db'];function respondWithStatusCode(_0x5f437f,_0x4c15f9){_0x4c15f9=_0x4c15f9||0xcc;return function(_0x27586a){if(_0x27586a){return _0x5f437f[_0xf9d7('0x15')](_0x4c15f9);}return _0x5f437f[_0xf9d7('0x16')](_0x4c15f9)[_0xf9d7('0x17')]();};}function respondWithResult(_0x1cb1a6,_0x5d6002){_0x5d6002=_0x5d6002||0xc8;return function(_0x526eca){if(_0x526eca){return _0x1cb1a6[_0xf9d7('0x16')](_0x5d6002)[_0xf9d7('0x18')](_0x526eca);}};}function respondWithFilteredResult(_0x36f1a5,_0x158664){return function(_0x22c396){if(_0x22c396){var _0x420c83=typeof _0x158664[_0xf9d7('0x19')]===_0xf9d7('0x1a')&&typeof _0x158664[_0xf9d7('0x1b')]===_0xf9d7('0x1a');var _0x17dcad=_0x22c396[_0xf9d7('0x1c')];var _0x393d78=_0x420c83?0x0:_0x158664[_0xf9d7('0x19')];var _0x28fa31=_0x420c83?_0x22c396[_0xf9d7('0x1c')]:_0x158664['offset']+_0x158664[_0xf9d7('0x1b')];var _0x3fe71f;if(_0x28fa31>=_0x17dcad){_0x28fa31=_0x17dcad;_0x3fe71f=0xc8;}else{_0x3fe71f=0xce;}_0x36f1a5[_0xf9d7('0x16')](_0x3fe71f);return _0x36f1a5['set'](_0xf9d7('0x1d'),_0x393d78+'-'+_0x28fa31+'/'+_0x17dcad)[_0xf9d7('0x18')](_0x22c396);}return null;};}function patchUpdates(_0x445317){return function(_0x282cbd){try{jsonpatch['apply'](_0x282cbd,_0x445317,!![]);}catch(_0x510343){return BPromise[_0xf9d7('0x1e')](_0x510343);}return _0x282cbd[_0xf9d7('0x1f')]();};}function saveUpdates(_0x265dee,_0x312721){return function(_0x2da988){if(_0x2da988){return _0x2da988[_0xf9d7('0x20')](_0x265dee)[_0xf9d7('0x21')](function(_0x40abd5){return _0x40abd5;});}return null;};}function removeEntity(_0x165876,_0x4fccd9){return function(_0x46365a){if(_0x46365a){return _0x46365a[_0xf9d7('0x22')]()[_0xf9d7('0x21')](function(){var _0x28aee7=_0x46365a[_0xf9d7('0x23')]({'plain':!![]});var _0x41a727=_0xf9d7('0x24');return db['UserProfileResource'][_0xf9d7('0x22')]({'where':{'type':_0x41a727,'resourceId':_0x28aee7['id']}})[_0xf9d7('0x21')](function(){return _0x46365a;});})['then'](function(){_0x165876[_0xf9d7('0x16')](0xcc)[_0xf9d7('0x17')]();});}};}function handleEntityNotFound(_0x19e648,_0x3d61b0){return function(_0x5a5d1e){if(!_0x5a5d1e){_0x19e648[_0xf9d7('0x15')](0x194);}return _0x5a5d1e;};}function handleError(_0x4294fe,_0x481a2c){_0x481a2c=_0x481a2c||0x1f4;return function(_0x1c2058){logger[_0xf9d7('0x25')](_0x1c2058[_0xf9d7('0x26')]);if(_0x1c2058[_0xf9d7('0x27')]){delete _0x1c2058[_0xf9d7('0x27')];}_0x4294fe[_0xf9d7('0x16')](_0x481a2c)[_0xf9d7('0x28')](_0x1c2058);};}exports[_0xf9d7('0x29')]=function(_0x44a57e,_0x3e763d){var _0x198f41={},_0x50cf53={},_0x4c1797={'count':0x0,'rows':[]};var _0xe5f22a=_[_0xf9d7('0x2a')](db[_0xf9d7('0x2b')][_0xf9d7('0x2c')],function(_0x6f453a){return{'name':_0x6f453a[_0xf9d7('0x2d')],'type':_0x6f453a[_0xf9d7('0x2e')]['key']};});_0x50cf53[_0xf9d7('0x2f')]=_[_0xf9d7('0x2a')](_0xe5f22a,'name');_0x50cf53[_0xf9d7('0x30')]=_[_0xf9d7('0x31')](_0x44a57e[_0xf9d7('0x30')]);_0x50cf53[_0xf9d7('0x32')]=_[_0xf9d7('0x33')](_0x50cf53['model'],_0x50cf53[_0xf9d7('0x30')]);_0x198f41[_0xf9d7('0x34')]=_['intersection'](_0x50cf53[_0xf9d7('0x2f')],qs[_0xf9d7('0x35')](_0x44a57e[_0xf9d7('0x30')]['fields']));_0x198f41[_0xf9d7('0x34')]=_0x198f41[_0xf9d7('0x34')][_0xf9d7('0x36')]?_0x198f41[_0xf9d7('0x34')]:_0x50cf53['model'];if(!_0x44a57e['query'][_0xf9d7('0x37')](_0xf9d7('0x38'))){_0x198f41['limit']=qs[_0xf9d7('0x1b')](_0x44a57e[_0xf9d7('0x30')][_0xf9d7('0x1b')]);_0x198f41['offset']=qs['offset'](_0x44a57e['query'][_0xf9d7('0x19')]);}_0x198f41[_0xf9d7('0x39')]=qs[_0xf9d7('0x3a')](_0x44a57e['query'][_0xf9d7('0x3a')]);_0x198f41[_0xf9d7('0x3b')]=qs[_0xf9d7('0x32')](_['pick'](_0x44a57e['query'],_0x50cf53[_0xf9d7('0x32')]),_0xe5f22a);if(_0x44a57e[_0xf9d7('0x30')][_0xf9d7('0x3c')]){_0x198f41['where']=_['merge'](_0x198f41[_0xf9d7('0x3b')],{'$or':_[_0xf9d7('0x2a')](_0xe5f22a,function(_0x3c6f9d){if(_0x3c6f9d[_0xf9d7('0x2e')]!=='VIRTUAL'){var _0x44a064={};_0x44a064[_0x3c6f9d[_0xf9d7('0x27')]]={'$like':'%'+_0x44a57e[_0xf9d7('0x30')][_0xf9d7('0x3c')]+'%'};return _0x44a064;}})});}_0x198f41=_['merge']({},_0x198f41,_0x44a57e['options']);var _0x2640ca={'where':_0x198f41[_0xf9d7('0x3b')]};return db['Sound'][_0xf9d7('0x1c')](_0x2640ca)[_0xf9d7('0x21')](function(_0x50b00a){_0x4c1797[_0xf9d7('0x1c')]=_0x50b00a;if(_0x44a57e[_0xf9d7('0x30')][_0xf9d7('0x3d')]){_0x198f41[_0xf9d7('0x3e')]=[{'all':!![]}];}return db['Sound'][_0xf9d7('0x3f')](_0x198f41);})[_0xf9d7('0x21')](function(_0x57654c){_0x4c1797[_0xf9d7('0x40')]=_0x57654c;return _0x4c1797;})[_0xf9d7('0x21')](respondWithFilteredResult(_0x3e763d,_0x198f41))['catch'](handleError(_0x3e763d,null));};exports['show']=function(_0x48070c,_0x291391){var _0xf5a595={'raw':!![],'where':{'id':_0x48070c[_0xf9d7('0x41')]['id']}},_0xb6525d={};_0xb6525d['model']=_[_0xf9d7('0x31')](db[_0xf9d7('0x2b')][_0xf9d7('0x2c')]);_0xb6525d[_0xf9d7('0x30')]=_[_0xf9d7('0x31')](_0x48070c['query']);_0xb6525d[_0xf9d7('0x32')]=_[_0xf9d7('0x33')](_0xb6525d[_0xf9d7('0x2f')],_0xb6525d[_0xf9d7('0x30')]);_0xf5a595[_0xf9d7('0x34')]=_[_0xf9d7('0x33')](_0xb6525d[_0xf9d7('0x2f')],qs[_0xf9d7('0x35')](_0x48070c[_0xf9d7('0x30')][_0xf9d7('0x35')]));_0xf5a595[_0xf9d7('0x34')]=_0xf5a595[_0xf9d7('0x34')][_0xf9d7('0x36')]?_0xf5a595[_0xf9d7('0x34')]:_0xb6525d[_0xf9d7('0x2f')];if(_0x48070c['query'][_0xf9d7('0x3d')]){_0xf5a595[_0xf9d7('0x3e')]=[{'all':!![]}];}_0xf5a595=_[_0xf9d7('0x42')]({},_0xf5a595,_0x48070c[_0xf9d7('0x43')]);return db[_0xf9d7('0x2b')][_0xf9d7('0x44')](_0xf5a595)[_0xf9d7('0x21')](handleEntityNotFound(_0x291391,null))[_0xf9d7('0x21')](respondWithResult(_0x291391,null))['catch'](handleError(_0x291391,null));};exports[_0xf9d7('0x45')]=function(_0x306c01,_0x39edcb,_0x202022){return db['Sound']['find']({'where':{'id':_0x306c01[_0xf9d7('0x41')]['id']},'attributes':['name',_0xf9d7('0x46'),_0xf9d7('0x47')],'raw':!![]})[_0xf9d7('0x21')](handleEntityNotFound(_0x39edcb,null))[_0xf9d7('0x21')](function(_0x3a1050){if(_0x3a1050){if(!fs[_0xf9d7('0x48')](path[_0xf9d7('0x49')](config[_0xf9d7('0x4a')],'server/files/sounds/converted',_0x3a1050['save_name']+'.'+_0x3a1050[_0xf9d7('0x47')]))){throw new db[(_0xf9d7('0x4b'))]['ValidationError'](_0xf9d7('0x4c'));}return _0x39edcb[_0xf9d7('0x45')](path[_0xf9d7('0x49')](config[_0xf9d7('0x4a')],_0xf9d7('0x4d'),util['format'](_0xf9d7('0x4e'),_0x3a1050[_0xf9d7('0x46')],_0x3a1050[_0xf9d7('0x47')])),util['format'](_0xf9d7('0x4e'),_0x3a1050[_0xf9d7('0x27')],_0x3a1050[_0xf9d7('0x47')]));}return null;})[_0xf9d7('0x4f')](handleError(_0x39edcb,null));};exports[_0xf9d7('0x50')]=function(_0xfdb004,_0x1c7afd,_0x2a01ef){var _0x58bbd8={'name':path[_0xf9d7('0x51')](_0xfdb004[_0xf9d7('0x52')][_0xf9d7('0x53')],path[_0xf9d7('0x54')](_0xfdb004['file'][_0xf9d7('0x53')])),'save_name':path['basename'](_0xfdb004[_0xf9d7('0x52')][_0xf9d7('0x55')],path[_0xf9d7('0x54')](_0xfdb004[_0xf9d7('0x52')][_0xf9d7('0x55')])),'original_format':path[_0xf9d7('0x54')](_0xfdb004[_0xf9d7('0x52')][_0xf9d7('0x53')])['substring'](0x1),'converted_format':_0xf9d7('0x56')};var _0x17b031=path[_0xf9d7('0x49')](config[_0xf9d7('0x4a')],_0xf9d7('0x57'),_0xfdb004[_0xf9d7('0x52')]['filename']);var _0x510677=path[_0xf9d7('0x49')](config[_0xf9d7('0x4a')],_0xf9d7('0x4d'),util[_0xf9d7('0x58')](_0xf9d7('0x4e'),path[_0xf9d7('0x51')](_0xfdb004[_0xf9d7('0x52')][_0xf9d7('0x55')],path['extname'](_0xfdb004[_0xf9d7('0x52')][_0xf9d7('0x55')])),_0x58bbd8[_0xf9d7('0x47')]));logger[_0xf9d7('0x59')](_0xf9d7('0x5a'),_0x17b031);logger[_0xf9d7('0x59')](_0xf9d7('0x5b'),_0x510677);try{fs[_0xf9d7('0x5c')](_0x17b031,parseInt(_0xf9d7('0x5d'),0x8));var _0x1aac35=sox[_0xf9d7('0x5e')](_0x17b031,_0x510677,{'sampleRate':0x1f40,'format':_0xf9d7('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1aac35['on'](_0xf9d7('0x25'),function(_0x49e581){fs[_0xf9d7('0x5f')](_0x17b031);_0x1c7afd[_0xf9d7('0x16')](0x1f4)['send'](_0x49e581);});_0x1aac35['on'](_0xf9d7('0x60'),function(_0x355e6e){_0x58bbd8['original_duration']=isNaN(_0x355e6e[_0xf9d7('0x61')])?null:_0x355e6e[_0xf9d7('0x61')]*0x3e8;_0x58bbd8[_0xf9d7('0x62')]=isNaN(_0x355e6e[_0xf9d7('0x63')])?null:_0x355e6e['sampleCount'];_0x58bbd8[_0xf9d7('0x64')]=isNaN(_0x355e6e['channelCount'])?null:_0x355e6e[_0xf9d7('0x65')];_0x58bbd8[_0xf9d7('0x66')]=isNaN(_0x355e6e[_0xf9d7('0x67')])?null:_0x355e6e[_0xf9d7('0x67')];_0x58bbd8[_0xf9d7('0x68')]=isNaN(_0x355e6e[_0xf9d7('0x69')])?null:_0x355e6e['sampleRate'];});_0x1aac35['on'](_0xf9d7('0x6a'),function(_0x4433d0){_0x58bbd8[_0xf9d7('0x6b')]=isNaN(_0x4433d0[_0xf9d7('0x61')])?null:_0x4433d0['duration']*0x3e8;_0x58bbd8['converted_sampleCount']=isNaN(_0x4433d0['sampleCount'])?null:_0x4433d0[_0xf9d7('0x63')];_0x58bbd8[_0xf9d7('0x6c')]=isNaN(_0x4433d0[_0xf9d7('0x65')])?null:_0x4433d0['channelCount'];_0x58bbd8[_0xf9d7('0x6d')]=isNaN(_0x4433d0[_0xf9d7('0x67')])?null:_0x4433d0[_0xf9d7('0x67')];_0x58bbd8[_0xf9d7('0x6e')]=isNaN(_0x4433d0[_0xf9d7('0x69')])?null:_0x4433d0['sampleRate'];});_0x1aac35['on']('end',function(){fs[_0xf9d7('0x5c')](_0x510677,parseInt('0777',0x8));return db[_0xf9d7('0x2b')][_0xf9d7('0x50')](_0x58bbd8)[_0xf9d7('0x21')](function(_0x36c4f5){var _0xcb8445={'role':_0xfdb004[_0xf9d7('0x6f')][_0xf9d7('0x70')],'userProfileId':_0xfdb004[_0xf9d7('0x6f')][_0xf9d7('0x71')]};if(!_0xcb8445)throw new Error(_0xf9d7('0x72'));if(_0xcb8445[_0xf9d7('0x70')]===_0xf9d7('0x73')){var _0x589f8a=_0x36c4f5[_0xf9d7('0x23')]({'plain':!![]});return db['UserProfileSection'][_0xf9d7('0x44')]({'where':{'name':_0xf9d7('0x24'),'userProfileId':_0xcb8445['userProfileId']},'raw':!![]})[_0xf9d7('0x21')](function(_0x2e957c){if(_0x2e957c&&_0x2e957c['autoAssociation']===0x0){return db[_0xf9d7('0x74')][_0xf9d7('0x50')]({'name':_0x589f8a[_0xf9d7('0x27')],'resourceId':_0x589f8a['id'],'type':_0x2e957c['name'],'sectionId':_0x2e957c['id']},{})[_0xf9d7('0x21')](function(){return _0x36c4f5;});}else{return _0x36c4f5;}})[_0xf9d7('0x4f')](function(_0x57b19f){logger[_0xf9d7('0x25')](_0xf9d7('0x75'),_0x57b19f);throw _0x57b19f;});}return _0x36c4f5;})[_0xf9d7('0x21')](respondWithResult(_0x1c7afd,null))[_0xf9d7('0x4f')](handleError(_0x1c7afd,null));});_0x1aac35[_0xf9d7('0x76')]();}catch(_0x3896ac){_0x1c7afd[_0xf9d7('0x16')](0x1f4)[_0xf9d7('0x28')](_0x3896ac);}};exports[_0xf9d7('0x20')]=function(_0x459173,_0x4129b1,_0x273f0a){return db[_0xf9d7('0x2b')]['find']({'where':{'id':_0x459173[_0xf9d7('0x41')]['id']}})[_0xf9d7('0x21')](handleEntityNotFound(_0x4129b1,null))['then'](saveUpdates(_[_0xf9d7('0x77')](_0x459173[_0xf9d7('0x6f')],[_0xf9d7('0x27'),'description']),null))['then'](respondWithResult(_0x4129b1,null))[_0xf9d7('0x4f')](handleError(_0x4129b1,null));};exports[_0xf9d7('0x78')]=function(_0x3b07bd,_0x2d2078,_0x96cb43){return db['Sound']['find']({'where':{'id':_0x3b07bd[_0xf9d7('0x41')]['id']}})[_0xf9d7('0x21')](function(_0x5729a6){if(_0x5729a6){return _0x5729a6[_0xf9d7('0x22')]();}})[_0xf9d7('0x21')](function(_0x395a54){var _0x55ba44=path[_0xf9d7('0x49')](config[_0xf9d7('0x4a')],_0xf9d7('0x57'),util['format'](_0xf9d7('0x4e'),_0x395a54[_0xf9d7('0x46')],_0x395a54[_0xf9d7('0x79')]));var _0x3a1fe7=path[_0xf9d7('0x49')](config['root'],'server/files/sounds/converted',util[_0xf9d7('0x58')](_0xf9d7('0x4e'),_0x395a54[_0xf9d7('0x46')],_0x395a54['converted_format']));fs['unlinkSync'](_0x55ba44);fs['unlinkSync'](_0x3a1fe7);return _0x395a54;})[_0xf9d7('0x21')](function(_0x244699){if(_0x244699){return _0x2d2078[_0xf9d7('0x16')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x2d2078,null))['catch'](handleError(_0x2d2078,null));}; \ No newline at end of file +var _0x1c2d=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','rawAttributes','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','delete','original_format','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x1c2d,0x1d6));var _0xd1c2=function(_0x2f8437,_0x206ece){_0x2f8437=_0x2f8437-0x0;var _0x5079f5=_0x1c2d[_0x2f8437];return _0x5079f5;};'use strict';var emlformat=require(_0xd1c2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1c2('0x1'));var jsonpatch=require(_0xd1c2('0x2'));var rp=require(_0xd1c2('0x3'));var moment=require(_0xd1c2('0x4'));var BPromise=require(_0xd1c2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1c2('0x6'));var sox=require('sox');var csv=require(_0xd1c2('0x7'));var ejs=require(_0xd1c2('0x8'));var fs=require('fs');var fs_extra=require(_0xd1c2('0x9'));var _=require(_0xd1c2('0xa'));var squel=require('squel');var crypto=require(_0xd1c2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd1c2('0xc'));var toCsv=require(_0xd1c2('0x7'));var querystring=require('querystring');var Papa=require(_0xd1c2('0xd'));var Redis=require('ioredis');var authService=require(_0xd1c2('0xe'));var qs=require(_0xd1c2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1c2('0x10'));var logger=require(_0xd1c2('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd1c2('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xd1c2('0x13'))['db'];function respondWithStatusCode(_0x334b07,_0x1f5d15){_0x1f5d15=_0x1f5d15||0xcc;return function(_0x5cd1d7){if(_0x5cd1d7){return _0x334b07[_0xd1c2('0x14')](_0x1f5d15);}return _0x334b07[_0xd1c2('0x15')](_0x1f5d15)[_0xd1c2('0x16')]();};}function respondWithResult(_0x2e316b,_0x3ff0fa){_0x3ff0fa=_0x3ff0fa||0xc8;return function(_0x3f7071){if(_0x3f7071){return _0x2e316b[_0xd1c2('0x15')](_0x3ff0fa)[_0xd1c2('0x17')](_0x3f7071);}};}function respondWithFilteredResult(_0x1b7f62,_0x565810){return function(_0x2fc660){if(_0x2fc660){var _0x205c39=typeof _0x565810[_0xd1c2('0x18')]===_0xd1c2('0x19')&&typeof _0x565810[_0xd1c2('0x1a')]===_0xd1c2('0x19');var _0x19ff6c=_0x2fc660[_0xd1c2('0x1b')];var _0x283322=_0x205c39?0x0:_0x565810[_0xd1c2('0x18')];var _0x482610=_0x205c39?_0x2fc660[_0xd1c2('0x1b')]:_0x565810[_0xd1c2('0x18')]+_0x565810[_0xd1c2('0x1a')];var _0x3b881d;if(_0x482610>=_0x19ff6c){_0x482610=_0x19ff6c;_0x3b881d=0xc8;}else{_0x3b881d=0xce;}_0x1b7f62[_0xd1c2('0x15')](_0x3b881d);return _0x1b7f62['set'](_0xd1c2('0x1c'),_0x283322+'-'+_0x482610+'/'+_0x19ff6c)['json'](_0x2fc660);}return null;};}function patchUpdates(_0x1c6379){return function(_0x17db42){try{jsonpatch[_0xd1c2('0x1d')](_0x17db42,_0x1c6379,!![]);}catch(_0x527673){return BPromise[_0xd1c2('0x1e')](_0x527673);}return _0x17db42[_0xd1c2('0x1f')]();};}function saveUpdates(_0x2ce0d8,_0x5c843d){return function(_0x166173){if(_0x166173){return _0x166173[_0xd1c2('0x20')](_0x2ce0d8)[_0xd1c2('0x21')](function(_0x2aac6d){return _0x2aac6d;});}return null;};}function removeEntity(_0x3677dc,_0x3437aa){return function(_0x433fb7){if(_0x433fb7){return _0x433fb7[_0xd1c2('0x22')]()[_0xd1c2('0x21')](function(){var _0x43371c=_0x433fb7['get']({'plain':!![]});var _0x4f1dc1=_0xd1c2('0x23');return db[_0xd1c2('0x24')]['destroy']({'where':{'type':_0x4f1dc1,'resourceId':_0x43371c['id']}})[_0xd1c2('0x21')](function(){return _0x433fb7;});})['then'](function(){_0x3677dc[_0xd1c2('0x15')](0xcc)[_0xd1c2('0x16')]();});}};}function handleEntityNotFound(_0x9c3af8,_0x5f795){return function(_0x310d36){if(!_0x310d36){_0x9c3af8[_0xd1c2('0x14')](0x194);}return _0x310d36;};}function handleError(_0x27378e,_0x3b70cd){_0x3b70cd=_0x3b70cd||0x1f4;return function(_0x2294ee){logger[_0xd1c2('0x25')](_0x2294ee[_0xd1c2('0x26')]);if(_0x2294ee['name']){delete _0x2294ee[_0xd1c2('0x27')];}_0x27378e[_0xd1c2('0x15')](_0x3b70cd)[_0xd1c2('0x28')](_0x2294ee);};}exports[_0xd1c2('0x29')]=function(_0x178cfa,_0x2bc587){var _0x1dadf8={},_0x1dbdf7={},_0x50ab14={'count':0x0,'rows':[]};var _0x4c0617=_[_0xd1c2('0x2a')](db[_0xd1c2('0x2b')]['rawAttributes'],function(_0x22684e){return{'name':_0x22684e[_0xd1c2('0x2c')],'type':_0x22684e[_0xd1c2('0x2d')][_0xd1c2('0x2e')]};});_0x1dbdf7[_0xd1c2('0x2f')]=_['map'](_0x4c0617,_0xd1c2('0x27'));_0x1dbdf7['query']=_['keys'](_0x178cfa[_0xd1c2('0x30')]);_0x1dbdf7[_0xd1c2('0x31')]=_[_0xd1c2('0x32')](_0x1dbdf7[_0xd1c2('0x2f')],_0x1dbdf7['query']);_0x1dadf8[_0xd1c2('0x33')]=_[_0xd1c2('0x32')](_0x1dbdf7[_0xd1c2('0x2f')],qs[_0xd1c2('0x34')](_0x178cfa[_0xd1c2('0x30')][_0xd1c2('0x34')]));_0x1dadf8[_0xd1c2('0x33')]=_0x1dadf8['attributes'][_0xd1c2('0x35')]?_0x1dadf8[_0xd1c2('0x33')]:_0x1dbdf7[_0xd1c2('0x2f')];if(!_0x178cfa[_0xd1c2('0x30')]['hasOwnProperty']('nolimit')){_0x1dadf8[_0xd1c2('0x1a')]=qs['limit'](_0x178cfa[_0xd1c2('0x30')][_0xd1c2('0x1a')]);_0x1dadf8['offset']=qs[_0xd1c2('0x18')](_0x178cfa[_0xd1c2('0x30')][_0xd1c2('0x18')]);}_0x1dadf8[_0xd1c2('0x36')]=qs['sort'](_0x178cfa[_0xd1c2('0x30')][_0xd1c2('0x37')]);_0x1dadf8[_0xd1c2('0x38')]=qs[_0xd1c2('0x31')](_['pick'](_0x178cfa[_0xd1c2('0x30')],_0x1dbdf7[_0xd1c2('0x31')]),_0x4c0617);if(_0x178cfa[_0xd1c2('0x30')]['filter']){_0x1dadf8[_0xd1c2('0x38')]=_['merge'](_0x1dadf8[_0xd1c2('0x38')],{'$or':_[_0xd1c2('0x2a')](_0x4c0617,function(_0x92942d){if(_0x92942d[_0xd1c2('0x2d')]!==_0xd1c2('0x39')){var _0x5d1df8={};_0x5d1df8[_0x92942d[_0xd1c2('0x27')]]={'$like':'%'+_0x178cfa[_0xd1c2('0x30')]['filter']+'%'};return _0x5d1df8;}})});}_0x1dadf8=_[_0xd1c2('0x3a')]({},_0x1dadf8,_0x178cfa[_0xd1c2('0x3b')]);var _0x3b11c4={'where':_0x1dadf8[_0xd1c2('0x38')]};return db[_0xd1c2('0x2b')][_0xd1c2('0x1b')](_0x3b11c4)['then'](function(_0x23cec4){_0x50ab14[_0xd1c2('0x1b')]=_0x23cec4;if(_0x178cfa[_0xd1c2('0x30')][_0xd1c2('0x3c')]){_0x1dadf8[_0xd1c2('0x3d')]=[{'all':!![]}];}return db[_0xd1c2('0x2b')][_0xd1c2('0x3e')](_0x1dadf8);})[_0xd1c2('0x21')](function(_0x53fe69){_0x50ab14['rows']=_0x53fe69;return _0x50ab14;})['then'](respondWithFilteredResult(_0x2bc587,_0x1dadf8))[_0xd1c2('0x3f')](handleError(_0x2bc587,null));};exports['show']=function(_0x4ed681,_0x39a6c4){var _0x2101b1={'raw':!![],'where':{'id':_0x4ed681[_0xd1c2('0x40')]['id']}},_0x167dd8={};_0x167dd8[_0xd1c2('0x2f')]=_[_0xd1c2('0x41')](db[_0xd1c2('0x2b')][_0xd1c2('0x42')]);_0x167dd8[_0xd1c2('0x30')]=_[_0xd1c2('0x41')](_0x4ed681[_0xd1c2('0x30')]);_0x167dd8[_0xd1c2('0x31')]=_[_0xd1c2('0x32')](_0x167dd8['model'],_0x167dd8[_0xd1c2('0x30')]);_0x2101b1[_0xd1c2('0x33')]=_['intersection'](_0x167dd8[_0xd1c2('0x2f')],qs[_0xd1c2('0x34')](_0x4ed681[_0xd1c2('0x30')][_0xd1c2('0x34')]));_0x2101b1[_0xd1c2('0x33')]=_0x2101b1[_0xd1c2('0x33')][_0xd1c2('0x35')]?_0x2101b1[_0xd1c2('0x33')]:_0x167dd8['model'];if(_0x4ed681['query']['includeAll']){_0x2101b1[_0xd1c2('0x3d')]=[{'all':!![]}];}_0x2101b1=_[_0xd1c2('0x3a')]({},_0x2101b1,_0x4ed681['options']);return db[_0xd1c2('0x2b')][_0xd1c2('0x43')](_0x2101b1)[_0xd1c2('0x21')](handleEntityNotFound(_0x39a6c4,null))['then'](respondWithResult(_0x39a6c4,null))[_0xd1c2('0x3f')](handleError(_0x39a6c4,null));};exports[_0xd1c2('0x44')]=function(_0x5219e3,_0x2193ca,_0x1b35db){return db[_0xd1c2('0x2b')][_0xd1c2('0x43')]({'where':{'id':_0x5219e3[_0xd1c2('0x40')]['id']},'attributes':[_0xd1c2('0x27'),_0xd1c2('0x45'),_0xd1c2('0x46')],'raw':!![]})['then'](handleEntityNotFound(_0x2193ca,null))['then'](function(_0x15a907){if(_0x15a907){if(!fs[_0xd1c2('0x47')](path[_0xd1c2('0x48')](config[_0xd1c2('0x49')],_0xd1c2('0x4a'),_0x15a907[_0xd1c2('0x45')]+'.'+_0x15a907[_0xd1c2('0x46')]))){throw new db['Sequelize'][(_0xd1c2('0x4b'))](_0xd1c2('0x4c'));}return _0x2193ca[_0xd1c2('0x44')](path[_0xd1c2('0x48')](config[_0xd1c2('0x49')],_0xd1c2('0x4a'),util[_0xd1c2('0x4d')]('%s.%s',_0x15a907['save_name'],_0x15a907['converted_format'])),util['format'](_0xd1c2('0x4e'),_0x15a907['name'],_0x15a907['converted_format']));}return null;})[_0xd1c2('0x3f')](handleError(_0x2193ca,null));};exports[_0xd1c2('0x4f')]=function(_0x6c3862,_0xd6e6ee,_0x2728ee){var _0x1c17e8={'name':path[_0xd1c2('0x50')](_0x6c3862[_0xd1c2('0x51')][_0xd1c2('0x52')],path[_0xd1c2('0x53')](_0x6c3862[_0xd1c2('0x51')][_0xd1c2('0x52')])),'save_name':path[_0xd1c2('0x50')](_0x6c3862[_0xd1c2('0x51')][_0xd1c2('0x54')],path[_0xd1c2('0x53')](_0x6c3862['file'][_0xd1c2('0x54')])),'original_format':path['extname'](_0x6c3862[_0xd1c2('0x51')]['originalname'])[_0xd1c2('0x55')](0x1),'converted_format':'wav'};var _0xdbba7a=path[_0xd1c2('0x48')](config[_0xd1c2('0x49')],_0xd1c2('0x56'),_0x6c3862[_0xd1c2('0x51')][_0xd1c2('0x54')]);var _0x4a975e=path[_0xd1c2('0x48')](config[_0xd1c2('0x49')],_0xd1c2('0x4a'),util[_0xd1c2('0x4d')](_0xd1c2('0x4e'),path[_0xd1c2('0x50')](_0x6c3862[_0xd1c2('0x51')]['filename'],path[_0xd1c2('0x53')](_0x6c3862['file'][_0xd1c2('0x54')])),_0x1c17e8[_0xd1c2('0x46')]));logger[_0xd1c2('0x57')]('Sound\x20upload\x20filepath:\x20%s',_0xdbba7a);logger[_0xd1c2('0x57')](_0xd1c2('0x58'),_0x4a975e);try{fs[_0xd1c2('0x59')](_0xdbba7a,parseInt(_0xd1c2('0x5a'),0x8));var _0xefbbd0=sox[_0xd1c2('0x5b')](_0xdbba7a,_0x4a975e,{'sampleRate':0x1f40,'format':_0xd1c2('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xefbbd0['on'](_0xd1c2('0x25'),function(_0x11706c){fs['unlinkSync'](_0xdbba7a);_0xd6e6ee[_0xd1c2('0x15')](0x1f4)['send'](_0x11706c);});_0xefbbd0['on'](_0xd1c2('0x5d'),function(_0x90d486){_0x1c17e8[_0xd1c2('0x5e')]=isNaN(_0x90d486[_0xd1c2('0x5f')])?null:_0x90d486[_0xd1c2('0x5f')]*0x3e8;_0x1c17e8[_0xd1c2('0x60')]=isNaN(_0x90d486[_0xd1c2('0x61')])?null:_0x90d486[_0xd1c2('0x61')];_0x1c17e8[_0xd1c2('0x62')]=isNaN(_0x90d486[_0xd1c2('0x63')])?null:_0x90d486[_0xd1c2('0x63')];_0x1c17e8[_0xd1c2('0x64')]=isNaN(_0x90d486[_0xd1c2('0x65')])?null:_0x90d486[_0xd1c2('0x65')];_0x1c17e8[_0xd1c2('0x66')]=isNaN(_0x90d486[_0xd1c2('0x67')])?null:_0x90d486[_0xd1c2('0x67')];});_0xefbbd0['on'](_0xd1c2('0x68'),function(_0x25e75c){_0x1c17e8[_0xd1c2('0x69')]=isNaN(_0x25e75c[_0xd1c2('0x5f')])?null:_0x25e75c[_0xd1c2('0x5f')]*0x3e8;_0x1c17e8[_0xd1c2('0x6a')]=isNaN(_0x25e75c[_0xd1c2('0x61')])?null:_0x25e75c[_0xd1c2('0x61')];_0x1c17e8[_0xd1c2('0x6b')]=isNaN(_0x25e75c[_0xd1c2('0x63')])?null:_0x25e75c['channelCount'];_0x1c17e8[_0xd1c2('0x6c')]=isNaN(_0x25e75c[_0xd1c2('0x65')])?null:_0x25e75c[_0xd1c2('0x65')];_0x1c17e8['converted_sampleRate']=isNaN(_0x25e75c[_0xd1c2('0x67')])?null:_0x25e75c[_0xd1c2('0x67')];});_0xefbbd0['on'](_0xd1c2('0x16'),function(){fs[_0xd1c2('0x59')](_0x4a975e,parseInt(_0xd1c2('0x5a'),0x8));return db[_0xd1c2('0x2b')]['create'](_0x1c17e8)[_0xd1c2('0x21')](function(_0x39402e){var _0x8760dd={'role':_0x6c3862[_0xd1c2('0x6d')][_0xd1c2('0x6e')],'userProfileId':_0x6c3862[_0xd1c2('0x6d')][_0xd1c2('0x6f')]};if(!_0x8760dd)throw new Error(_0xd1c2('0x70'));if(_0x8760dd[_0xd1c2('0x6e')]===_0xd1c2('0x71')){var _0x3cbe37=_0x39402e[_0xd1c2('0x72')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xd1c2('0x23'),'userProfileId':_0x8760dd['userProfileId']},'raw':!![]})[_0xd1c2('0x21')](function(_0x4287be){if(_0x4287be&&_0x4287be[_0xd1c2('0x73')]===0x0){return db[_0xd1c2('0x24')][_0xd1c2('0x4f')]({'name':_0x3cbe37[_0xd1c2('0x27')],'resourceId':_0x3cbe37['id'],'type':_0x4287be[_0xd1c2('0x27')],'sectionId':_0x4287be['id']},{})['then'](function(){return _0x39402e;});}else{return _0x39402e;}})[_0xd1c2('0x3f')](function(_0xa36bbe){logger[_0xd1c2('0x25')](_0xd1c2('0x74'),_0xa36bbe);throw _0xa36bbe;});}return _0x39402e;})[_0xd1c2('0x21')](respondWithResult(_0xd6e6ee,null))[_0xd1c2('0x3f')](handleError(_0xd6e6ee,null));});_0xefbbd0['start']();}catch(_0xb18d24){_0xd6e6ee[_0xd1c2('0x15')](0x1f4)['send'](_0xb18d24);}};exports[_0xd1c2('0x20')]=function(_0x6a9454,_0x3d4baa,_0x23b0e2){return db[_0xd1c2('0x2b')][_0xd1c2('0x43')]({'where':{'id':_0x6a9454[_0xd1c2('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d4baa,null))[_0xd1c2('0x21')](saveUpdates(_[_0xd1c2('0x75')](_0x6a9454[_0xd1c2('0x6d')],['name','description']),null))[_0xd1c2('0x21')](respondWithResult(_0x3d4baa,null))['catch'](handleError(_0x3d4baa,null));};exports[_0xd1c2('0x76')]=function(_0x38fb96,_0x3351d1,_0x581a95){return db[_0xd1c2('0x2b')][_0xd1c2('0x43')]({'where':{'id':_0x38fb96[_0xd1c2('0x40')]['id']}})[_0xd1c2('0x21')](function(_0x35301d){if(_0x35301d){return _0x35301d[_0xd1c2('0x22')]();}})[_0xd1c2('0x21')](function(_0x8767ac){var _0x42be45=path[_0xd1c2('0x48')](config[_0xd1c2('0x49')],_0xd1c2('0x56'),util[_0xd1c2('0x4d')](_0xd1c2('0x4e'),_0x8767ac['save_name'],_0x8767ac[_0xd1c2('0x77')]));var _0x12a570=path[_0xd1c2('0x48')](config['root'],_0xd1c2('0x4a'),util[_0xd1c2('0x4d')](_0xd1c2('0x4e'),_0x8767ac[_0xd1c2('0x45')],_0x8767ac[_0xd1c2('0x46')]));fs[_0xd1c2('0x78')](_0x42be45);fs[_0xd1c2('0x78')](_0x12a570);return _0x8767ac;})[_0xd1c2('0x21')](function(_0x3daf9f){if(_0x3daf9f){return _0x3351d1['status'](0xcc)[_0xd1c2('0x16')]();}})[_0xd1c2('0x21')](handleEntityNotFound(_0x3351d1,null))['catch'](handleError(_0x3351d1,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 9647030..11a3c8b 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 _0x91ea=['Sound','tools_sounds','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports'];(function(_0x5f2e01,_0x2d5765){var _0xd508f6=function(_0x119454){while(--_0x119454){_0x5f2e01['push'](_0x5f2e01['shift']());}};_0xd508f6(++_0x2d5765);}(_0x91ea,0x195));var _0xa91e=function(_0x999c6e,_0x2fdef4){_0x999c6e=_0x999c6e-0x0;var _0x37e20c=_0x91ea[_0x999c6e];return _0x37e20c;};'use strict';var _=require(_0xa91e('0x0'));var util=require(_0xa91e('0x1'));var logger=require('../../config/logger')(_0xa91e('0x2'));var moment=require(_0xa91e('0x3'));var BPromise=require(_0xa91e('0x4'));var rp=require(_0xa91e('0x5'));var fs=require('fs');var path=require(_0xa91e('0x6'));var rimraf=require(_0xa91e('0x7'));var config=require(_0xa91e('0x8'));var attributes=require(_0xa91e('0x9'));module[_0xa91e('0xa')]=function(_0x48eb53,_0x46b2a3){return _0x48eb53['define'](_0xa91e('0xb'),attributes,{'tableName':_0xa91e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe293=['tools_sounds','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','Sound'];(function(_0x3f8022,_0x5c9c49){var _0x41f1de=function(_0x4726f9){while(--_0x4726f9){_0x3f8022['push'](_0x3f8022['shift']());}};_0x41f1de(++_0x5c9c49);}(_0xe293,0x12d));var _0x3e29=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0xe293[_0x1d7037];return _0x4d6568;};'use strict';var _=require(_0x3e29('0x0'));var util=require('util');var logger=require(_0x3e29('0x1'))(_0x3e29('0x2'));var moment=require(_0x3e29('0x3'));var BPromise=require('bluebird');var rp=require(_0x3e29('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e29('0x5'));var config=require(_0x3e29('0x6'));var attributes=require('./sound.attributes');module[_0x3e29('0x7')]=function(_0x3f6389,_0x5598c4){return _0x3f6389['define'](_0x3e29('0x8'),attributes,{'tableName':_0x3e29('0x9'),'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 053e98e..67918c3 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 _0xee46=['options','raw','attributes','include','map','model','ShowSound','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','Sound','find'];(function(_0x3bd2c0,_0xbe4fa0){var _0x57b005=function(_0x365fc2){while(--_0x365fc2){_0x3bd2c0['push'](_0x3bd2c0['shift']());}};_0x57b005(++_0xbe4fa0);}(_0xee46,0x128));var _0x6ee4=function(_0x47ab72,_0x5dbf3e){_0x47ab72=_0x47ab72-0x0;var _0x204b9d=_0xee46[_0x47ab72];return _0x204b9d;};'use strict';var _=require(_0x6ee4('0x0'));var util=require(_0x6ee4('0x1'));var moment=require(_0x6ee4('0x2'));var BPromise=require(_0x6ee4('0x3'));var rs=require(_0x6ee4('0x4'));var fs=require('fs');var Redis=require(_0x6ee4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ee4('0x6'))(_0x6ee4('0x7'));var config=require(_0x6ee4('0x8'));var jayson=require(_0x6ee4('0x9'));var client=jayson[_0x6ee4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x509f84,_0x1b6f7c,_0x174f0b){return new BPromise(function(_0x522f15,_0x184695){return client[_0x6ee4('0xb')](_0x509f84,_0x174f0b)[_0x6ee4('0xc')](function(_0x4ee176){logger['info'](_0x6ee4('0xd'),_0x1b6f7c,_0x6ee4('0xe'));logger[_0x6ee4('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x1b6f7c,_0x6ee4('0xe'),JSON['stringify'](_0x4ee176));if(_0x4ee176['error']){if(_0x4ee176[_0x6ee4('0x10')][_0x6ee4('0x11')]===0x1f4){logger[_0x6ee4('0x10')](_0x6ee4('0xd'),_0x1b6f7c,_0x4ee176[_0x6ee4('0x10')][_0x6ee4('0x12')]);return _0x184695(_0x4ee176[_0x6ee4('0x10')][_0x6ee4('0x12')]);}logger[_0x6ee4('0x10')](_0x6ee4('0xd'),_0x1b6f7c,_0x4ee176['error'][_0x6ee4('0x12')]);return _0x522f15(_0x4ee176[_0x6ee4('0x10')]['message']);}else{logger[_0x6ee4('0x13')]('Sound,\x20%s,\x20%s',_0x1b6f7c,_0x6ee4('0xe'));_0x522f15(_0x4ee176[_0x6ee4('0x14')]['message']);}})[_0x6ee4('0x15')](function(_0x55926d){logger[_0x6ee4('0x10')](_0x6ee4('0xd'),_0x1b6f7c,_0x55926d);_0x184695(_0x55926d);});});}exports['ShowSound']=function(_0x3dfea2){var _0x163f59=this;return new Promise(function(_0x476865,_0x15e515){return db[_0x6ee4('0x16')][_0x6ee4('0x17')]({'raw':_0x3dfea2['options']?_0x3dfea2[_0x6ee4('0x18')][_0x6ee4('0x19')]===undefined?!![]:![]:!![],'where':_0x3dfea2[_0x6ee4('0x18')]?_0x3dfea2[_0x6ee4('0x18')]['where']||null:null,'attributes':_0x3dfea2[_0x6ee4('0x18')]?_0x3dfea2[_0x6ee4('0x18')][_0x6ee4('0x1a')]||null:null,'include':_0x3dfea2[_0x6ee4('0x18')]?_0x3dfea2['options'][_0x6ee4('0x1b')]?_[_0x6ee4('0x1c')](_0x3dfea2[_0x6ee4('0x18')][_0x6ee4('0x1b')],function(_0x38c1b6){return{'model':db[_0x38c1b6[_0x6ee4('0x1d')]],'as':_0x38c1b6['as'],'attributes':_0x38c1b6[_0x6ee4('0x1a')],'include':_0x38c1b6[_0x6ee4('0x1b')]?_['map'](_0x38c1b6[_0x6ee4('0x1b')],function(_0x427ae8){return{'model':db[_0x427ae8[_0x6ee4('0x1d')]],'as':_0x427ae8['as'],'attributes':_0x427ae8[_0x6ee4('0x1a')],'include':_0x427ae8[_0x6ee4('0x1b')]?_['map'](_0x427ae8[_0x6ee4('0x1b')],function(_0x6e9f10){return{'model':db[_0x6e9f10[_0x6ee4('0x1d')]],'as':_0x6e9f10['as'],'attributes':_0x6e9f10[_0x6ee4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6ee4('0xc')](function(_0x1d16f2){logger['info']('ShowSound',_0x3dfea2);logger[_0x6ee4('0xf')](_0x6ee4('0x1e'),_0x3dfea2,JSON[_0x6ee4('0x1f')](_0x1d16f2));_0x476865(_0x1d16f2);})['catch'](function(_0x1b412f){logger[_0x6ee4('0x10')]('ShowSound',_0x1b412f[_0x6ee4('0x12')],_0x3dfea2);_0x15e515(_0x163f59[_0x6ee4('0x10')](0x1f4,_0x1b412f['message']));});});}; \ No newline at end of file +var _0xee9f=['lodash','util','bluebird','../../config/utils','../../config/environment','client','http','request','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','ShowSound','options','raw','attributes','map','model','include','then','catch'];(function(_0x11d39d,_0x50331e){var _0xff1afe=function(_0x5b88b0){while(--_0x5b88b0){_0x11d39d['push'](_0x11d39d['shift']());}};_0xff1afe(++_0x50331e);}(_0xee9f,0x6c));var _0xfee9=function(_0x49fd3d,_0x464210){_0x49fd3d=_0x49fd3d-0x0;var _0x107ed9=_0xee9f[_0x49fd3d];return _0x107ed9;};'use strict';var _=require(_0xfee9('0x0'));var util=require(_0xfee9('0x1'));var moment=require('moment');var BPromise=require(_0xfee9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfee9('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xfee9('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xfee9('0x5')][_0xfee9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x43fa3e,_0x2c999b,_0xc7e339){return new BPromise(function(_0x1ca2d5,_0x2d2032){return client[_0xfee9('0x7')](_0x43fa3e,_0xc7e339)['then'](function(_0x10b956){logger['info'](_0xfee9('0x8'),_0x2c999b,_0xfee9('0x9'));logger[_0xfee9('0xa')](_0xfee9('0xb'),_0x2c999b,'request\x20sent',JSON[_0xfee9('0xc')](_0x10b956));if(_0x10b956['error']){if(_0x10b956['error'][_0xfee9('0xd')]===0x1f4){logger[_0xfee9('0xe')](_0xfee9('0x8'),_0x2c999b,_0x10b956[_0xfee9('0xe')][_0xfee9('0xf')]);return _0x2d2032(_0x10b956[_0xfee9('0xe')]['message']);}logger[_0xfee9('0xe')](_0xfee9('0x8'),_0x2c999b,_0x10b956[_0xfee9('0xe')][_0xfee9('0xf')]);return _0x1ca2d5(_0x10b956['error']['message']);}else{logger[_0xfee9('0x10')](_0xfee9('0x8'),_0x2c999b,_0xfee9('0x9'));_0x1ca2d5(_0x10b956[_0xfee9('0x11')][_0xfee9('0xf')]);}})['catch'](function(_0x89543){logger[_0xfee9('0xe')](_0xfee9('0x8'),_0x2c999b,_0x89543);_0x2d2032(_0x89543);});});}exports[_0xfee9('0x12')]=function(_0x2f55a8){var _0x3f3433=this;return new Promise(function(_0x29e8e7,_0x5eb454){return db['Sound']['find']({'raw':_0x2f55a8[_0xfee9('0x13')]?_0x2f55a8['options'][_0xfee9('0x14')]===undefined?!![]:![]:!![],'where':_0x2f55a8[_0xfee9('0x13')]?_0x2f55a8['options']['where']||null:null,'attributes':_0x2f55a8['options']?_0x2f55a8['options'][_0xfee9('0x15')]||null:null,'include':_0x2f55a8['options']?_0x2f55a8['options']['include']?_[_0xfee9('0x16')](_0x2f55a8[_0xfee9('0x13')]['include'],function(_0x4e970e){return{'model':db[_0x4e970e[_0xfee9('0x17')]],'as':_0x4e970e['as'],'attributes':_0x4e970e[_0xfee9('0x15')],'include':_0x4e970e[_0xfee9('0x18')]?_[_0xfee9('0x16')](_0x4e970e['include'],function(_0x34ce51){return{'model':db[_0x34ce51[_0xfee9('0x17')]],'as':_0x34ce51['as'],'attributes':_0x34ce51['attributes'],'include':_0x34ce51[_0xfee9('0x18')]?_[_0xfee9('0x16')](_0x34ce51['include'],function(_0x150036){return{'model':db[_0x150036[_0xfee9('0x17')]],'as':_0x150036['as'],'attributes':_0x150036[_0xfee9('0x15')]};}):[]};}):[]};}):[]:[]})[_0xfee9('0x19')](function(_0x4a27db){logger[_0xfee9('0x10')](_0xfee9('0x12'),_0x2f55a8);logger['debug'](_0xfee9('0x12'),_0x2f55a8,JSON['stringify'](_0x4a27db));_0x29e8e7(_0x4a27db);})[_0xfee9('0x1a')](function(_0x28dafc){logger[_0xfee9('0xe')](_0xfee9('0x12'),_0x28dafc['message'],_0x2f55a8);_0x5eb454(_0x3f3433['error'](0x1f4,_0x28dafc[_0xfee9('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 70d2d89..f54c836 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x1460ab,_0x74d06e){var _0x1eeb5c=function(_0x28de38){while(--_0x28de38){_0x1460ab['push'](_0x1460ab['shift']());}};_0x1eeb5c(++_0x74d06e);}(_0x4fc2,0x111));var _0x24fc=function(_0x482af4,_0x841ba7){_0x482af4=_0x482af4-0x0;var _0x266fbb=_0x4fc2[_0x482af4];return _0x266fbb;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router; \ No newline at end of file +var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x5c2935,_0x57a86e){var _0x29fd1d=function(_0x16998f){while(--_0x16998f){_0x5c2935['push'](_0x5c2935['shift']());}};_0x29fd1d(++_0x57a86e);}(_0xda2d,0x102));var _0xdda2=function(_0x58302a,_0x6463){_0x58302a=_0x58302a-0x0;var _0x1ed0b1=_0xda2d[_0x58302a];return _0x1ed0b1;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('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 cad887a..6712fd5 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 _0xbed2=['sequelize','STRING','TEXT','medium','ENUM','out'];(function(_0x104d23,_0x39fb6c){var _0x1988c5=function(_0x1c839f){while(--_0x1c839f){_0x104d23['push'](_0x104d23['shift']());}};_0x1988c5(++_0x39fb6c);}(_0xbed2,0xf0));var _0x2bed=function(_0x39c8f2,_0x23df6c){_0x39c8f2=_0x39c8f2-0x0;var _0x445526=_0xbed2[_0x39c8f2];return _0x445526;};'use strict';var Sequelize=require(_0x2bed('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x2bed('0x1')]},'body':{'type':Sequelize[_0x2bed('0x2')](_0x2bed('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x2bed('0x4')]('in',_0x2bed('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x2bed('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1023=['exports','STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x115785,_0x4d16fa){var _0x35224b=function(_0x584b39){while(--_0x584b39){_0x115785['push'](_0x115785['shift']());}};_0x35224b(++_0x4d16fa);}(_0x1023,0xd8));var _0x3102=function(_0x474d97,_0x5909ce){_0x474d97=_0x474d97-0x0;var _0x1edf25=_0x1023[_0x474d97];return _0x1edf25;};'use strict';var Sequelize=require(_0x3102('0x0'));module[_0x3102('0x1')]={'uniqueid':{'type':Sequelize[_0x3102('0x2')]},'body':{'type':Sequelize[_0x3102('0x3')](_0x3102('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x3102('0x5')]('in',_0x3102('0x6')),'defaultValue':_0x3102('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 935dfc6..a3b9aaf 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 _0x536e=['ejs','lodash','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','map','SquareMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','type','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','update','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x536e,0x111));var _0xe536=function(_0x50d2db,_0x47481f){_0x50d2db=_0x50d2db-0x0;var _0x1c7e27=_0x536e[_0x50d2db];return _0x1c7e27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe536('0x0'));var zipdir=require(_0xe536('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe536('0x2'));var BPromise=require(_0xe536('0x3'));var Mustache=require(_0xe536('0x4'));var util=require(_0xe536('0x5'));var path=require(_0xe536('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe536('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe536('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe536('0x9'));var toCsv=require(_0xe536('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe536('0xb'));var authService=require(_0xe536('0xc'));var qs=require(_0xe536('0xd'));var as=require(_0xe536('0xe'));var hardwareService=require(_0xe536('0xf'));var logger=require(_0xe536('0x10'))(_0xe536('0x11'));var utils=require(_0xe536('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe536('0x13'))['db'];function respondWithStatusCode(_0x40767e,_0x3429df){_0x3429df=_0x3429df||0xcc;return function(_0x3f1ea4){if(_0x3f1ea4){return _0x40767e[_0xe536('0x14')](_0x3429df);}return _0x40767e[_0xe536('0x15')](_0x3429df)[_0xe536('0x16')]();};}function respondWithResult(_0x185969,_0x5e8c5c){_0x5e8c5c=_0x5e8c5c||0xc8;return function(_0x3df7e7){if(_0x3df7e7){return _0x185969[_0xe536('0x15')](_0x5e8c5c)[_0xe536('0x17')](_0x3df7e7);}};}function respondWithFilteredResult(_0x562bf3,_0x451e7b){return function(_0x1d5939){if(_0x1d5939){var _0x16bd53=typeof _0x451e7b[_0xe536('0x18')]==='undefined'&&typeof _0x451e7b[_0xe536('0x19')]===_0xe536('0x1a');var _0x2ae487=_0x1d5939['count'];var _0x342988=_0x16bd53?0x0:_0x451e7b[_0xe536('0x18')];var _0x571570=_0x16bd53?_0x1d5939[_0xe536('0x1b')]:_0x451e7b[_0xe536('0x18')]+_0x451e7b[_0xe536('0x19')];var _0xeac20e;if(_0x571570>=_0x2ae487){_0x571570=_0x2ae487;_0xeac20e=0xc8;}else{_0xeac20e=0xce;}_0x562bf3['status'](_0xeac20e);return _0x562bf3[_0xe536('0x1c')](_0xe536('0x1d'),_0x342988+'-'+_0x571570+'/'+_0x2ae487)['json'](_0x1d5939);}return null;};}function patchUpdates(_0x2940ff){return function(_0x410656){try{jsonpatch[_0xe536('0x1e')](_0x410656,_0x2940ff,!![]);}catch(_0x4287ff){return BPromise[_0xe536('0x1f')](_0x4287ff);}return _0x410656[_0xe536('0x20')]();};}function saveUpdates(_0x49f603,_0x31dc6c){return function(_0x587879){if(_0x587879){return _0x587879['update'](_0x49f603)['then'](function(_0x19b839){return _0x19b839;});}return null;};}function removeEntity(_0x5ba038,_0x2a3818){return function(_0x16fb7c){if(_0x16fb7c){return _0x16fb7c[_0xe536('0x21')]()[_0xe536('0x22')](function(){_0x5ba038[_0xe536('0x15')](0xcc)[_0xe536('0x16')]();});}};}function handleEntityNotFound(_0x595785,_0xba2c27){return function(_0x32893f){if(!_0x32893f){_0x595785[_0xe536('0x14')](0x194);}return _0x32893f;};}function handleError(_0x24605f,_0x43f25e){_0x43f25e=_0x43f25e||0x1f4;return function(_0x197f09){logger['error'](_0x197f09[_0xe536('0x23')]);if(_0x197f09[_0xe536('0x24')]){delete _0x197f09[_0xe536('0x24')];}_0x24605f['status'](_0x43f25e)[_0xe536('0x25')](_0x197f09);};}exports['index']=function(_0x48a8e2,_0x497bba){var _0x177aff={},_0x2faeb3={},_0x1a7205={'count':0x0,'rows':[]};var _0x33ec18=_[_0xe536('0x26')](db[_0xe536('0x27')][_0xe536('0x28')],function(_0x1c29ed){return{'name':_0x1c29ed[_0xe536('0x29')],'type':_0x1c29ed['type'][_0xe536('0x2a')]};});_0x2faeb3[_0xe536('0x2b')]=_[_0xe536('0x26')](_0x33ec18,_0xe536('0x24'));_0x2faeb3['query']=_[_0xe536('0x2c')](_0x48a8e2[_0xe536('0x2d')]);_0x2faeb3[_0xe536('0x2e')]=_[_0xe536('0x2f')](_0x2faeb3[_0xe536('0x2b')],_0x2faeb3[_0xe536('0x2d')]);_0x177aff[_0xe536('0x30')]=_[_0xe536('0x2f')](_0x2faeb3[_0xe536('0x2b')],qs[_0xe536('0x31')](_0x48a8e2[_0xe536('0x2d')][_0xe536('0x31')]));_0x177aff[_0xe536('0x30')]=_0x177aff[_0xe536('0x30')]['length']?_0x177aff[_0xe536('0x30')]:_0x2faeb3['model'];if(!_0x48a8e2[_0xe536('0x2d')]['hasOwnProperty'](_0xe536('0x32'))){_0x177aff[_0xe536('0x19')]=qs['limit'](_0x48a8e2[_0xe536('0x2d')]['limit']);_0x177aff[_0xe536('0x18')]=qs[_0xe536('0x18')](_0x48a8e2[_0xe536('0x2d')][_0xe536('0x18')]);}_0x177aff[_0xe536('0x33')]=qs[_0xe536('0x34')](_0x48a8e2[_0xe536('0x2d')][_0xe536('0x34')]);_0x177aff[_0xe536('0x35')]=qs[_0xe536('0x2e')](_[_0xe536('0x36')](_0x48a8e2['query'],_0x2faeb3[_0xe536('0x2e')]),_0x33ec18);if(_0x48a8e2[_0xe536('0x2d')][_0xe536('0x37')]){_0x177aff[_0xe536('0x35')]=_['merge'](_0x177aff[_0xe536('0x35')],{'$or':_[_0xe536('0x26')](_0x33ec18,function(_0x33365b){if(_0x33365b[_0xe536('0x38')]!=='VIRTUAL'){var _0x5ad164={};_0x5ad164[_0x33365b[_0xe536('0x24')]]={'$like':'%'+_0x48a8e2[_0xe536('0x2d')][_0xe536('0x37')]+'%'};return _0x5ad164;}})});}_0x177aff=_['merge']({},_0x177aff,_0x48a8e2[_0xe536('0x39')]);var _0x14f9ad={'where':_0x177aff[_0xe536('0x35')]};return db[_0xe536('0x27')][_0xe536('0x1b')](_0x14f9ad)[_0xe536('0x22')](function(_0x3d54c7){_0x1a7205[_0xe536('0x1b')]=_0x3d54c7;if(_0x48a8e2[_0xe536('0x2d')][_0xe536('0x3a')]){_0x177aff[_0xe536('0x3b')]=[{'all':!![]}];}return db[_0xe536('0x27')][_0xe536('0x3c')](_0x177aff);})[_0xe536('0x22')](function(_0x52f4cf){_0x1a7205[_0xe536('0x3d')]=_0x52f4cf;return _0x1a7205;})[_0xe536('0x22')](respondWithFilteredResult(_0x497bba,_0x177aff))[_0xe536('0x3e')](handleError(_0x497bba,null));};exports[_0xe536('0x3f')]=function(_0x2b9537,_0x23910f){var _0x4eaeee={'raw':!![],'where':{'id':_0x2b9537[_0xe536('0x40')]['id']}},_0x4d3fc9={};_0x4d3fc9[_0xe536('0x2b')]=_[_0xe536('0x2c')](db[_0xe536('0x27')]['rawAttributes']);_0x4d3fc9[_0xe536('0x2d')]=_['keys'](_0x2b9537['query']);_0x4d3fc9['filters']=_[_0xe536('0x2f')](_0x4d3fc9[_0xe536('0x2b')],_0x4d3fc9[_0xe536('0x2d')]);_0x4eaeee[_0xe536('0x30')]=_[_0xe536('0x2f')](_0x4d3fc9[_0xe536('0x2b')],qs[_0xe536('0x31')](_0x2b9537[_0xe536('0x2d')][_0xe536('0x31')]));_0x4eaeee[_0xe536('0x30')]=_0x4eaeee[_0xe536('0x30')]['length']?_0x4eaeee[_0xe536('0x30')]:_0x4d3fc9[_0xe536('0x2b')];if(_0x2b9537['query'][_0xe536('0x3a')]){_0x4eaeee[_0xe536('0x3b')]=[{'all':!![]}];}_0x4eaeee=_[_0xe536('0x41')]({},_0x4eaeee,_0x2b9537[_0xe536('0x39')]);return db[_0xe536('0x27')][_0xe536('0x42')](_0x4eaeee)['then'](handleEntityNotFound(_0x23910f,null))[_0xe536('0x22')](respondWithResult(_0x23910f,null))[_0xe536('0x3e')](handleError(_0x23910f,null));};exports[_0xe536('0x43')]=function(_0x17055b,_0x2c91ba){return db['SquareMessage'][_0xe536('0x43')](_0x17055b[_0xe536('0x44')],{})[_0xe536('0x22')](respondWithResult(_0x2c91ba,0xc9))[_0xe536('0x3e')](handleError(_0x2c91ba,null));};exports[_0xe536('0x45')]=function(_0xb0c2a0,_0x3f2803){if(_0xb0c2a0[_0xe536('0x44')]['id']){delete _0xb0c2a0['body']['id'];}return db['SquareMessage'][_0xe536('0x42')]({'where':{'id':_0xb0c2a0[_0xe536('0x40')]['id']}})[_0xe536('0x22')](handleEntityNotFound(_0x3f2803,null))['then'](saveUpdates(_0xb0c2a0[_0xe536('0x44')],null))[_0xe536('0x22')](respondWithResult(_0x3f2803,null))[_0xe536('0x3e')](handleError(_0x3f2803,null));};exports[_0xe536('0x21')]=function(_0x350ab1,_0x3245a2){return db[_0xe536('0x27')][_0xe536('0x42')]({'where':{'id':_0x350ab1[_0xe536('0x40')]['id']}})[_0xe536('0x22')](handleEntityNotFound(_0x3245a2,null))[_0xe536('0x22')](removeEntity(_0x3245a2,null))[_0xe536('0x3e')](handleError(_0x3245a2,null));}; \ No newline at end of file +var _0x4e39=['then','destroy','error','stack','name','index','map','SquareMessage','fieldName','type','key','query','filters','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','rawAttributes','intersection','fields','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','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','offset','undefined','limit','count','json','apply','reject','save','update'];(function(_0x4b418f,_0xbe8444){var _0x19cb10=function(_0x45d205){while(--_0x45d205){_0x4b418f['push'](_0x4b418f['shift']());}};_0x19cb10(++_0xbe8444);}(_0x4e39,0x14d));var _0x94e3=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0x4e39[_0x2cfb48];return _0xc4594f;};'use strict';var emlformat=require(_0x94e3('0x0'));var rimraf=require(_0x94e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x94e3('0x2'));var rp=require(_0x94e3('0x3'));var moment=require(_0x94e3('0x4'));var BPromise=require(_0x94e3('0x5'));var Mustache=require(_0x94e3('0x6'));var util=require(_0x94e3('0x7'));var path=require(_0x94e3('0x8'));var sox=require('sox');var csv=require(_0x94e3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94e3('0xa'));var _=require(_0x94e3('0xb'));var squel=require(_0x94e3('0xc'));var crypto=require('crypto');var jsforce=require(_0x94e3('0xd'));var deskjs=require(_0x94e3('0xe'));var toCsv=require(_0x94e3('0x9'));var querystring=require(_0x94e3('0xf'));var Papa=require(_0x94e3('0x10'));var Redis=require('ioredis');var authService=require(_0x94e3('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94e3('0x12'));var logger=require(_0x94e3('0x13'))(_0x94e3('0x14'));var utils=require(_0x94e3('0x15'));var config=require(_0x94e3('0x16'));var licenseUtil=require(_0x94e3('0x17'));var db=require(_0x94e3('0x18'))['db'];function respondWithStatusCode(_0x35b85b,_0xb37ead){_0xb37ead=_0xb37ead||0xcc;return function(_0xca9c62){if(_0xca9c62){return _0x35b85b[_0x94e3('0x19')](_0xb37ead);}return _0x35b85b[_0x94e3('0x1a')](_0xb37ead)[_0x94e3('0x1b')]();};}function respondWithResult(_0x24ddda,_0x3818c8){_0x3818c8=_0x3818c8||0xc8;return function(_0x51362e){if(_0x51362e){return _0x24ddda[_0x94e3('0x1a')](_0x3818c8)['json'](_0x51362e);}};}function respondWithFilteredResult(_0xfc75d7,_0x4bb2b9){return function(_0x267319){if(_0x267319){var _0x52f480=typeof _0x4bb2b9[_0x94e3('0x1c')]===_0x94e3('0x1d')&&typeof _0x4bb2b9[_0x94e3('0x1e')]===_0x94e3('0x1d');var _0x35268e=_0x267319['count'];var _0x5e8a27=_0x52f480?0x0:_0x4bb2b9[_0x94e3('0x1c')];var _0x423899=_0x52f480?_0x267319[_0x94e3('0x1f')]:_0x4bb2b9[_0x94e3('0x1c')]+_0x4bb2b9[_0x94e3('0x1e')];var _0x8fb0a6;if(_0x423899>=_0x35268e){_0x423899=_0x35268e;_0x8fb0a6=0xc8;}else{_0x8fb0a6=0xce;}_0xfc75d7[_0x94e3('0x1a')](_0x8fb0a6);return _0xfc75d7['set']('Content-Range',_0x5e8a27+'-'+_0x423899+'/'+_0x35268e)[_0x94e3('0x20')](_0x267319);}return null;};}function patchUpdates(_0xf29dc2){return function(_0x2ea676){try{jsonpatch[_0x94e3('0x21')](_0x2ea676,_0xf29dc2,!![]);}catch(_0x1dce6c){return BPromise[_0x94e3('0x22')](_0x1dce6c);}return _0x2ea676[_0x94e3('0x23')]();};}function saveUpdates(_0x584a63,_0x33fa5d){return function(_0x5c933b){if(_0x5c933b){return _0x5c933b[_0x94e3('0x24')](_0x584a63)[_0x94e3('0x25')](function(_0x4362cc){return _0x4362cc;});}return null;};}function removeEntity(_0x56a119,_0x27ec4e){return function(_0x398ba9){if(_0x398ba9){return _0x398ba9[_0x94e3('0x26')]()[_0x94e3('0x25')](function(){_0x56a119[_0x94e3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c0e93,_0x40f6be){return function(_0x8d55f1){if(!_0x8d55f1){_0x4c0e93[_0x94e3('0x19')](0x194);}return _0x8d55f1;};}function handleError(_0x42da6f,_0x176222){_0x176222=_0x176222||0x1f4;return function(_0x3fbf25){logger[_0x94e3('0x27')](_0x3fbf25[_0x94e3('0x28')]);if(_0x3fbf25[_0x94e3('0x29')]){delete _0x3fbf25[_0x94e3('0x29')];}_0x42da6f[_0x94e3('0x1a')](_0x176222)['send'](_0x3fbf25);};}exports[_0x94e3('0x2a')]=function(_0x3bbf01,_0x26620c){var _0x123a68={},_0x1b0352={},_0x285102={'count':0x0,'rows':[]};var _0x34c635=_[_0x94e3('0x2b')](db[_0x94e3('0x2c')]['rawAttributes'],function(_0xce2183){return{'name':_0xce2183[_0x94e3('0x2d')],'type':_0xce2183[_0x94e3('0x2e')][_0x94e3('0x2f')]};});_0x1b0352['model']=_[_0x94e3('0x2b')](_0x34c635,'name');_0x1b0352[_0x94e3('0x30')]=_['keys'](_0x3bbf01[_0x94e3('0x30')]);_0x1b0352[_0x94e3('0x31')]=_['intersection'](_0x1b0352[_0x94e3('0x32')],_0x1b0352[_0x94e3('0x30')]);_0x123a68[_0x94e3('0x33')]=_['intersection'](_0x1b0352[_0x94e3('0x32')],qs['fields'](_0x3bbf01[_0x94e3('0x30')]['fields']));_0x123a68[_0x94e3('0x33')]=_0x123a68[_0x94e3('0x33')]['length']?_0x123a68[_0x94e3('0x33')]:_0x1b0352['model'];if(!_0x3bbf01[_0x94e3('0x30')][_0x94e3('0x34')](_0x94e3('0x35'))){_0x123a68[_0x94e3('0x1e')]=qs['limit'](_0x3bbf01[_0x94e3('0x30')][_0x94e3('0x1e')]);_0x123a68[_0x94e3('0x1c')]=qs['offset'](_0x3bbf01['query'][_0x94e3('0x1c')]);}_0x123a68[_0x94e3('0x36')]=qs[_0x94e3('0x37')](_0x3bbf01[_0x94e3('0x30')][_0x94e3('0x37')]);_0x123a68[_0x94e3('0x38')]=qs['filters'](_[_0x94e3('0x39')](_0x3bbf01[_0x94e3('0x30')],_0x1b0352[_0x94e3('0x31')]),_0x34c635);if(_0x3bbf01[_0x94e3('0x30')][_0x94e3('0x3a')]){_0x123a68[_0x94e3('0x38')]=_[_0x94e3('0x3b')](_0x123a68[_0x94e3('0x38')],{'$or':_['map'](_0x34c635,function(_0x27f6fc){if(_0x27f6fc['type']!==_0x94e3('0x3c')){var _0x4de0a3={};_0x4de0a3[_0x27f6fc[_0x94e3('0x29')]]={'$like':'%'+_0x3bbf01['query'][_0x94e3('0x3a')]+'%'};return _0x4de0a3;}})});}_0x123a68=_['merge']({},_0x123a68,_0x3bbf01[_0x94e3('0x3d')]);var _0x2b86c7={'where':_0x123a68[_0x94e3('0x38')]};return db[_0x94e3('0x2c')][_0x94e3('0x1f')](_0x2b86c7)[_0x94e3('0x25')](function(_0x3b76bd){_0x285102[_0x94e3('0x1f')]=_0x3b76bd;if(_0x3bbf01[_0x94e3('0x30')][_0x94e3('0x3e')]){_0x123a68[_0x94e3('0x3f')]=[{'all':!![]}];}return db[_0x94e3('0x2c')][_0x94e3('0x40')](_0x123a68);})['then'](function(_0x11ef68){_0x285102['rows']=_0x11ef68;return _0x285102;})['then'](respondWithFilteredResult(_0x26620c,_0x123a68))[_0x94e3('0x41')](handleError(_0x26620c,null));};exports['show']=function(_0x381054,_0x1f831f){var _0x370483={'raw':!![],'where':{'id':_0x381054[_0x94e3('0x42')]['id']}},_0xcac14d={};_0xcac14d[_0x94e3('0x32')]=_[_0x94e3('0x43')](db[_0x94e3('0x2c')][_0x94e3('0x44')]);_0xcac14d[_0x94e3('0x30')]=_['keys'](_0x381054['query']);_0xcac14d[_0x94e3('0x31')]=_[_0x94e3('0x45')](_0xcac14d[_0x94e3('0x32')],_0xcac14d[_0x94e3('0x30')]);_0x370483[_0x94e3('0x33')]=_[_0x94e3('0x45')](_0xcac14d['model'],qs[_0x94e3('0x46')](_0x381054['query'][_0x94e3('0x46')]));_0x370483[_0x94e3('0x33')]=_0x370483['attributes']['length']?_0x370483[_0x94e3('0x33')]:_0xcac14d[_0x94e3('0x32')];if(_0x381054['query'][_0x94e3('0x3e')]){_0x370483[_0x94e3('0x3f')]=[{'all':!![]}];}_0x370483=_[_0x94e3('0x3b')]({},_0x370483,_0x381054[_0x94e3('0x3d')]);return db[_0x94e3('0x2c')]['find'](_0x370483)[_0x94e3('0x25')](handleEntityNotFound(_0x1f831f,null))[_0x94e3('0x25')](respondWithResult(_0x1f831f,null))[_0x94e3('0x41')](handleError(_0x1f831f,null));};exports[_0x94e3('0x47')]=function(_0x35f824,_0x29d1ed){return db[_0x94e3('0x2c')][_0x94e3('0x47')](_0x35f824['body'],{})[_0x94e3('0x25')](respondWithResult(_0x29d1ed,0xc9))[_0x94e3('0x41')](handleError(_0x29d1ed,null));};exports[_0x94e3('0x24')]=function(_0x25771c,_0x86ce98){if(_0x25771c[_0x94e3('0x48')]['id']){delete _0x25771c[_0x94e3('0x48')]['id'];}return db[_0x94e3('0x2c')]['find']({'where':{'id':_0x25771c[_0x94e3('0x42')]['id']}})[_0x94e3('0x25')](handleEntityNotFound(_0x86ce98,null))[_0x94e3('0x25')](saveUpdates(_0x25771c[_0x94e3('0x48')],null))[_0x94e3('0x25')](respondWithResult(_0x86ce98,null))[_0x94e3('0x41')](handleError(_0x86ce98,null));};exports[_0x94e3('0x26')]=function(_0x33f27c,_0x1393df){return db[_0x94e3('0x2c')][_0x94e3('0x49')]({'where':{'id':_0x33f27c[_0x94e3('0x42')]['id']}})[_0x94e3('0x25')](handleEntityNotFound(_0x1393df,null))['then'](removeEntity(_0x1393df,null))[_0x94e3('0x41')](handleError(_0x1393df,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 8cfe4ae..659e0b7 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 _0xfdea=['lodash','util','../../config/logger','moment','request-promise','../../config/environment','exports','define','SquareMessage','square_messages'];(function(_0x22fa59,_0x59c7b7){var _0x38cab6=function(_0x19c880){while(--_0x19c880){_0x22fa59['push'](_0x22fa59['shift']());}};_0x38cab6(++_0x59c7b7);}(_0xfdea,0x1a4));var _0xafde=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xfdea[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xafde('0x0'));var util=require(_0xafde('0x1'));var logger=require(_0xafde('0x2'))('api');var moment=require(_0xafde('0x3'));var BPromise=require('bluebird');var rp=require(_0xafde('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xafde('0x5'));var attributes=require('./squareMessage.attributes');module[_0xafde('0x6')]=function(_0x369d9e,_0x1f2dd3){return _0x369d9e[_0xafde('0x7')](_0xafde('0x8'),attributes,{'tableName':_0xafde('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fdf=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x5fdf,0x173));var _0xf5fd=function(_0x3da832,_0x2133f1){_0x3da832=_0x3da832-0x0;var _0xe602f2=_0x5fdf[_0x3da832];return _0xe602f2;};'use strict';var _=require(_0xf5fd('0x0'));var util=require('util');var logger=require(_0xf5fd('0x1'))('api');var moment=require(_0xf5fd('0x2'));var BPromise=require(_0xf5fd('0x3'));var rp=require(_0xf5fd('0x4'));var fs=require('fs');var path=require(_0xf5fd('0x5'));var rimraf=require(_0xf5fd('0x6'));var config=require(_0xf5fd('0x7'));var attributes=require(_0xf5fd('0x8'));module[_0xf5fd('0x9')]=function(_0x20e325,_0x1470b3){return _0x20e325[_0xf5fd('0xa')](_0xf5fd('0xb'),attributes,{'tableName':_0xf5fd('0xc'),'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 9a96ef4..3e1b109 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 _0xf030=['error','code','message','info','result','catch','CreateSquareMessage','SquareMessage','create','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xf030,0x177));var _0x0f03=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf030[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x0f03('0x0'));var util=require('util');var moment=require(_0x0f03('0x1'));var BPromise=require(_0x0f03('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f03('0x3'));var db=require(_0x0f03('0x4'))['db'];var utils=require(_0x0f03('0x5'));var logger=require(_0x0f03('0x6'))(_0x0f03('0x7'));var config=require(_0x0f03('0x8'));var jayson=require(_0x0f03('0x9'));var client=jayson['client'][_0x0f03('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x291415,_0x810758,_0x536568){return new BPromise(function(_0x42e0ed,_0x5f5b5b){return client[_0x0f03('0xb')](_0x291415,_0x536568)[_0x0f03('0xc')](function(_0x85aeef){logger['info'](_0x0f03('0xd'),_0x810758,'request\x20sent');logger['debug'](_0x0f03('0xe'),_0x810758,_0x0f03('0xf'),JSON[_0x0f03('0x10')](_0x85aeef));if(_0x85aeef[_0x0f03('0x11')]){if(_0x85aeef['error'][_0x0f03('0x12')]===0x1f4){logger[_0x0f03('0x11')](_0x0f03('0xd'),_0x810758,_0x85aeef[_0x0f03('0x11')][_0x0f03('0x13')]);return _0x5f5b5b(_0x85aeef[_0x0f03('0x11')][_0x0f03('0x13')]);}logger[_0x0f03('0x11')](_0x0f03('0xd'),_0x810758,_0x85aeef[_0x0f03('0x11')][_0x0f03('0x13')]);return _0x42e0ed(_0x85aeef[_0x0f03('0x11')][_0x0f03('0x13')]);}else{logger[_0x0f03('0x14')](_0x0f03('0xd'),_0x810758,_0x0f03('0xf'));_0x42e0ed(_0x85aeef[_0x0f03('0x15')][_0x0f03('0x13')]);}})[_0x0f03('0x16')](function(_0x4fd052){logger[_0x0f03('0x11')]('SquareMessage,\x20%s,\x20%s',_0x810758,_0x4fd052);_0x5f5b5b(_0x4fd052);});});}exports[_0x0f03('0x17')]=function(_0x540658){var _0xedaa70=this;return new Promise(function(_0x1f4954,_0xc34c8c){return db[_0x0f03('0x18')][_0x0f03('0x19')](_0x540658['body'],{'raw':_0x540658[_0x0f03('0x1a')]?_0x540658[_0x0f03('0x1a')][_0x0f03('0x1b')]===undefined?!![]:![]:!![]})[_0x0f03('0xc')](function(_0x3b1822){logger[_0x0f03('0x14')]('CreateSquareMessage',_0x540658);logger['debug']('CreateSquareMessage',_0x540658,JSON['stringify'](_0x3b1822));_0x1f4954(_0x3b1822);})[_0x0f03('0x16')](function(_0x40f101){logger['error'](_0x0f03('0x17'),_0x40f101['message'],_0x540658);_0xc34c8c(_0xedaa70[_0x0f03('0x11')](0x1f4,_0x40f101[_0x0f03('0x13')]));});});}; \ No newline at end of file +var _0xb1c6=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','catch','CreateSquareMessage','create','body','options','raw','then','debug','lodash','util','bluebird','randomstring'];(function(_0x21bf8c,_0x31b084){var _0x2e5a0c=function(_0x49488f){while(--_0x49488f){_0x21bf8c['push'](_0x21bf8c['shift']());}};_0x2e5a0c(++_0x31b084);}(_0xb1c6,0x19c));var _0x6b1c=function(_0x8955b3,_0x3af8b4){_0x8955b3=_0x8955b3-0x0;var _0x369673=_0xb1c6[_0x8955b3];return _0x369673;};'use strict';var _=require(_0x6b1c('0x0'));var util=require(_0x6b1c('0x1'));var moment=require('moment');var BPromise=require(_0x6b1c('0x2'));var rs=require(_0x6b1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b1c('0x4'))['db'];var utils=require(_0x6b1c('0x5'));var logger=require(_0x6b1c('0x6'))('rpc');var config=require(_0x6b1c('0x7'));var jayson=require(_0x6b1c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x555edd,_0x41e865,_0x243e77){return new BPromise(function(_0x435698,_0x188d51){return client[_0x6b1c('0x9')](_0x555edd,_0x243e77)['then'](function(_0x76eca9){logger[_0x6b1c('0xa')]('SquareMessage,\x20%s,\x20%s',_0x41e865,_0x6b1c('0xb'));logger['debug'](_0x6b1c('0xc'),_0x41e865,_0x6b1c('0xb'),JSON[_0x6b1c('0xd')](_0x76eca9));if(_0x76eca9[_0x6b1c('0xe')]){if(_0x76eca9[_0x6b1c('0xe')][_0x6b1c('0xf')]===0x1f4){logger[_0x6b1c('0xe')](_0x6b1c('0x10'),_0x41e865,_0x76eca9[_0x6b1c('0xe')][_0x6b1c('0x11')]);return _0x188d51(_0x76eca9[_0x6b1c('0xe')][_0x6b1c('0x11')]);}logger[_0x6b1c('0xe')](_0x6b1c('0x10'),_0x41e865,_0x76eca9[_0x6b1c('0xe')]['message']);return _0x435698(_0x76eca9[_0x6b1c('0xe')]['message']);}else{logger[_0x6b1c('0xa')]('SquareMessage,\x20%s,\x20%s',_0x41e865,_0x6b1c('0xb'));_0x435698(_0x76eca9['result'][_0x6b1c('0x11')]);}})[_0x6b1c('0x12')](function(_0x5998e5){logger[_0x6b1c('0xe')](_0x6b1c('0x10'),_0x41e865,_0x5998e5);_0x188d51(_0x5998e5);});});}exports[_0x6b1c('0x13')]=function(_0x50a612){var _0xfcee5=this;return new Promise(function(_0x134776,_0x304cad){return db['SquareMessage'][_0x6b1c('0x14')](_0x50a612[_0x6b1c('0x15')],{'raw':_0x50a612['options']?_0x50a612[_0x6b1c('0x16')][_0x6b1c('0x17')]===undefined?!![]:![]:!![]})[_0x6b1c('0x18')](function(_0x3f1ce5){logger[_0x6b1c('0xa')]('CreateSquareMessage',_0x50a612);logger[_0x6b1c('0x19')](_0x6b1c('0x13'),_0x50a612,JSON[_0x6b1c('0xd')](_0x3f1ce5));_0x134776(_0x3f1ce5);})['catch'](function(_0x4dd904){logger[_0x6b1c('0xe')]('CreateSquareMessage',_0x4dd904['message'],_0x50a612);_0x304cad(_0xfcee5[_0x6b1c('0xe')](0x1f4,_0x4dd904[_0x6b1c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 39bea0a..85c2a0d 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 _0x1604=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','test','post','update','delete','destroy','exports','multer'];(function(_0x29a904,_0x13a67e){var _0x307e74=function(_0x55046f){while(--_0x55046f){_0x29a904['push'](_0x29a904['shift']());}};_0x307e74(++_0x13a67e);}(_0x1604,0x107));var _0x4160=function(_0x4b8575,_0xb21ebe){_0x4b8575=_0x4b8575-0x0;var _0xacbd81=_0x1604[_0x4b8575];return _0xacbd81;};'use strict';var multer=require(_0x4160('0x0'));var util=require(_0x4160('0x1'));var path=require(_0x4160('0x2'));var timeout=require(_0x4160('0x3'));var express=require('express');var router=express[_0x4160('0x4')]();var fs_extra=require(_0x4160('0x5'));var auth=require(_0x4160('0x6'));var interaction=require(_0x4160('0x7'));var config=require(_0x4160('0x8'));var controller=require(_0x4160('0x9'));router[_0x4160('0xa')]('/',auth[_0x4160('0xb')](),controller[_0x4160('0xc')]);router['get'](_0x4160('0xd'),auth['isAuthenticated'](),controller[_0x4160('0xe')]);router[_0x4160('0xa')](_0x4160('0xf'),auth['isAuthenticated'](),timeout('15s'),controller[_0x4160('0x10')]);router[_0x4160('0x11')]('/',auth[_0x4160('0xb')](),controller['create']);router['put'](_0x4160('0xd'),auth[_0x4160('0xb')](),controller[_0x4160('0x12')]);router[_0x4160('0x13')](_0x4160('0xd'),auth[_0x4160('0xb')](),controller[_0x4160('0x14')]);module[_0x4160('0x15')]=router; \ No newline at end of file +var _0x616a=['destroy','exports','multer','util','path','express','Router','fs-extra','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','test','post','create','update','delete'];(function(_0x3cc4d2,_0x2a8505){var _0x5168d1=function(_0x11af71){while(--_0x11af71){_0x3cc4d2['push'](_0x3cc4d2['shift']());}};_0x5168d1(++_0x2a8505);}(_0x616a,0x16b));var _0xa616=function(_0xe4be7,_0x1d17a6){_0xe4be7=_0xe4be7-0x0;var _0x2b45d3=_0x616a[_0xe4be7];return _0x2b45d3;};'use strict';var multer=require(_0xa616('0x0'));var util=require(_0xa616('0x1'));var path=require(_0xa616('0x2'));var timeout=require('connect-timeout');var express=require(_0xa616('0x3'));var router=express[_0xa616('0x4')]();var fs_extra=require(_0xa616('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa616('0x6'));router[_0xa616('0x7')]('/',auth[_0xa616('0x8')](),controller['index']);router[_0xa616('0x7')](_0xa616('0x9'),auth[_0xa616('0x8')](),controller[_0xa616('0xa')]);router[_0xa616('0x7')](_0xa616('0xb'),auth['isAuthenticated'](),timeout('15s'),controller[_0xa616('0xc')]);router[_0xa616('0xd')]('/',auth[_0xa616('0x8')](),controller[_0xa616('0xe')]);router['put']('/:id',auth[_0xa616('0x8')](),controller[_0xa616('0xf')]);router[_0xa616('0x10')](_0xa616('0x9'),auth[_0xa616('0x8')](),controller[_0xa616('0x11')]);module[_0xa616('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 412fd39..b1b499e 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 _0x0276=['exports','STRING','sequelize'];(function(_0x1348c0,_0x7a9608){var _0x8a6441=function(_0x41ba2a){while(--_0x41ba2a){_0x1348c0['push'](_0x1348c0['shift']());}};_0x8a6441(++_0x7a9608);}(_0x0276,0xd7));var _0x6027=function(_0x3a177b,_0x10d9fe){_0x3a177b=_0x3a177b-0x0;var _0x205959=_0x0276[_0x3a177b];return _0x205959;};'use strict';var Sequelize=require(_0x6027('0x0'));module[_0x6027('0x1')]={'name':{'type':Sequelize[_0x6027('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x17a3=['sequelize','exports'];(function(_0x3e26e9,_0x10f299){var _0x1382fe=function(_0x2ef3bd){while(--_0x2ef3bd){_0x3e26e9['push'](_0x3e26e9['shift']());}};_0x1382fe(++_0x10f299);}(_0x17a3,0x162));var _0x317a=function(_0x27e228,_0x264e92){_0x27e228=_0x27e228-0x0;var _0xb52a4c=_0x17a3[_0x27e228];return _0xb52a4c;};'use strict';var Sequelize=require(_0x317a('0x0'));module[_0x317a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 78445c6..b7fc3ac 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 _0xeeeb=['ODBC','UserProfileResource','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','count','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','crypto','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','set','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x32daac,_0x24ad7f){var _0x28ecd0=function(_0x29f33e){while(--_0x29f33e){_0x32daac['push'](_0x32daac['shift']());}};_0x28ecd0(++_0x24ad7f);}(_0xeeeb,0x80));var _0xbeee=function(_0x4a65f4,_0x31defe){_0x4a65f4=_0x4a65f4-0x0;var _0x5b3c63=_0xeeeb[_0x4a65f4];return _0x5b3c63;};'use strict';var emlformat=require(_0xbeee('0x0'));var rimraf=require(_0xbeee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbeee('0x2'));var rp=require(_0xbeee('0x3'));var moment=require(_0xbeee('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xbeee('0x5'));var sox=require(_0xbeee('0x6'));var csv=require(_0xbeee('0x7'));var ejs=require(_0xbeee('0x8'));var fs=require('fs');var fs_extra=require(_0xbeee('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbeee('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbeee('0x7'));var querystring=require('querystring');var Papa=require(_0xbeee('0xb'));var Redis=require(_0xbeee('0xc'));var authService=require(_0xbeee('0xd'));var qs=require(_0xbeee('0xe'));var as=require(_0xbeee('0xf'));var hardwareService=require(_0xbeee('0x10'));var logger=require(_0xbeee('0x11'))('api');var utils=require(_0xbeee('0x12'));var config=require(_0xbeee('0x13'));var licenseUtil=require(_0xbeee('0x14'));var db=require(_0xbeee('0x15'))['db'];function respondWithStatusCode(_0x55d7d8,_0x3f479e){_0x3f479e=_0x3f479e||0xcc;return function(_0x212573){if(_0x212573){return _0x55d7d8[_0xbeee('0x16')](_0x3f479e);}return _0x55d7d8[_0xbeee('0x17')](_0x3f479e)[_0xbeee('0x18')]();};}function respondWithResult(_0x270cbb,_0x3acc9b){_0x3acc9b=_0x3acc9b||0xc8;return function(_0x2b371d){if(_0x2b371d){return _0x270cbb[_0xbeee('0x17')](_0x3acc9b)[_0xbeee('0x19')](_0x2b371d);}};}function respondWithFilteredResult(_0x2eee3f,_0x4a38f1){return function(_0x51c9d6){if(_0x51c9d6){var _0xc29484=typeof _0x4a38f1[_0xbeee('0x1a')]===_0xbeee('0x1b')&&typeof _0x4a38f1[_0xbeee('0x1c')]==='undefined';var _0x583982=_0x51c9d6['count'];var _0x4e266a=_0xc29484?0x0:_0x4a38f1['offset'];var _0x434620=_0xc29484?_0x51c9d6['count']:_0x4a38f1[_0xbeee('0x1a')]+_0x4a38f1[_0xbeee('0x1c')];var _0x2bf716;if(_0x434620>=_0x583982){_0x434620=_0x583982;_0x2bf716=0xc8;}else{_0x2bf716=0xce;}_0x2eee3f[_0xbeee('0x17')](_0x2bf716);return _0x2eee3f[_0xbeee('0x1d')](_0xbeee('0x1e'),_0x4e266a+'-'+_0x434620+'/'+_0x583982)['json'](_0x51c9d6);}return null;};}function patchUpdates(_0x109cb9){return function(_0x37e0a6){try{jsonpatch[_0xbeee('0x1f')](_0x37e0a6,_0x109cb9,!![]);}catch(_0x8939c5){return BPromise[_0xbeee('0x20')](_0x8939c5);}return _0x37e0a6[_0xbeee('0x21')]();};}function saveUpdates(_0x5b3f59,_0x5f0dc7){return function(_0x451b30){if(_0x451b30){return _0x451b30[_0xbeee('0x22')](_0x5b3f59)[_0xbeee('0x23')](function(_0x506da4){return _0x506da4;});}return null;};}function removeEntity(_0x1fb7ae,_0x943e01){return function(_0x16e777){if(_0x16e777){return _0x16e777[_0xbeee('0x24')]()['then'](function(){var _0x512976=_0x16e777[_0xbeee('0x25')]({'plain':!![]});var _0x46428e=_0xbeee('0x26');return db[_0xbeee('0x27')]['destroy']({'where':{'type':_0x46428e,'resourceId':_0x512976['id']}})[_0xbeee('0x23')](function(){return _0x16e777;});})[_0xbeee('0x23')](function(){_0x1fb7ae[_0xbeee('0x17')](0xcc)[_0xbeee('0x18')]();});}};}function handleEntityNotFound(_0x138939,_0x5df055){return function(_0x593944){if(!_0x593944){_0x138939[_0xbeee('0x16')](0x194);}return _0x593944;};}function handleError(_0x11aea0,_0xbc94ca){_0xbc94ca=_0xbc94ca||0x1f4;return function(_0x545883){logger[_0xbeee('0x28')](_0x545883[_0xbeee('0x29')]);if(_0x545883['name']){delete _0x545883[_0xbeee('0x2a')];}_0x11aea0[_0xbeee('0x17')](_0xbc94ca)['send'](_0x545883);};}exports[_0xbeee('0x2b')]=function(_0xd9c888,_0x40b206){var _0x15d102={},_0x8940c1={},_0x5b2022={'count':0x0,'rows':[]};var _0x19f931=_[_0xbeee('0x2c')](db[_0xbeee('0x2d')][_0xbeee('0x2e')],function(_0x2dad1e){return{'name':_0x2dad1e[_0xbeee('0x2f')],'type':_0x2dad1e[_0xbeee('0x30')]['key']};});_0x8940c1[_0xbeee('0x31')]=_[_0xbeee('0x2c')](_0x19f931,_0xbeee('0x2a'));_0x8940c1['query']=_[_0xbeee('0x32')](_0xd9c888[_0xbeee('0x33')]);_0x8940c1[_0xbeee('0x34')]=_['intersection'](_0x8940c1[_0xbeee('0x31')],_0x8940c1[_0xbeee('0x33')]);_0x15d102[_0xbeee('0x35')]=_['intersection'](_0x8940c1[_0xbeee('0x31')],qs[_0xbeee('0x36')](_0xd9c888[_0xbeee('0x33')][_0xbeee('0x36')]));_0x15d102['attributes']=_0x15d102[_0xbeee('0x35')][_0xbeee('0x37')]?_0x15d102[_0xbeee('0x35')]:_0x8940c1[_0xbeee('0x31')];if(!_0xd9c888['query'][_0xbeee('0x38')]('nolimit')){_0x15d102[_0xbeee('0x1c')]=qs[_0xbeee('0x1c')](_0xd9c888[_0xbeee('0x33')][_0xbeee('0x1c')]);_0x15d102[_0xbeee('0x1a')]=qs[_0xbeee('0x1a')](_0xd9c888[_0xbeee('0x33')]['offset']);}_0x15d102[_0xbeee('0x39')]=qs['sort'](_0xd9c888[_0xbeee('0x33')][_0xbeee('0x3a')]);_0x15d102['where']=qs[_0xbeee('0x34')](_['pick'](_0xd9c888['query'],_0x8940c1['filters']),_0x19f931);if(_0xd9c888[_0xbeee('0x33')]['filter']){_0x15d102[_0xbeee('0x3b')]=_[_0xbeee('0x3c')](_0x15d102[_0xbeee('0x3b')],{'$or':_[_0xbeee('0x2c')](_0x19f931,function(_0xcface){if(_0xcface['type']!=='VIRTUAL'){var _0x1470e0={};_0x1470e0[_0xcface[_0xbeee('0x2a')]]={'$like':'%'+_0xd9c888[_0xbeee('0x33')][_0xbeee('0x3d')]+'%'};return _0x1470e0;}})});}_0x15d102=_['merge']({},_0x15d102,_0xd9c888[_0xbeee('0x3e')]);var _0x23342c={'where':_0x15d102[_0xbeee('0x3b')]};return db['SquareOdbc']['count'](_0x23342c)['then'](function(_0x5598c0){_0x5b2022[_0xbeee('0x3f')]=_0x5598c0;if(_0xd9c888['query'][_0xbeee('0x40')]){_0x15d102[_0xbeee('0x41')]=[{'all':!![]}];}return db[_0xbeee('0x2d')][_0xbeee('0x42')](_0x15d102);})[_0xbeee('0x23')](function(_0x272e69){_0x5b2022[_0xbeee('0x43')]=_0x272e69;return _0x5b2022;})[_0xbeee('0x23')](respondWithFilteredResult(_0x40b206,_0x15d102))[_0xbeee('0x44')](handleError(_0x40b206,null));};exports['show']=function(_0x181ba7,_0x803cdf){var _0x49c6c6={'raw':!![],'where':{'id':_0x181ba7[_0xbeee('0x45')]['id']}},_0x26e942={};_0x26e942[_0xbeee('0x31')]=_[_0xbeee('0x32')](db[_0xbeee('0x2d')][_0xbeee('0x2e')]);_0x26e942['query']=_[_0xbeee('0x32')](_0x181ba7[_0xbeee('0x33')]);_0x26e942[_0xbeee('0x34')]=_[_0xbeee('0x46')](_0x26e942[_0xbeee('0x31')],_0x26e942[_0xbeee('0x33')]);_0x49c6c6[_0xbeee('0x35')]=_[_0xbeee('0x46')](_0x26e942[_0xbeee('0x31')],qs[_0xbeee('0x36')](_0x181ba7[_0xbeee('0x33')][_0xbeee('0x36')]));_0x49c6c6[_0xbeee('0x35')]=_0x49c6c6['attributes']['length']?_0x49c6c6[_0xbeee('0x35')]:_0x26e942[_0xbeee('0x31')];if(_0x181ba7['query'][_0xbeee('0x40')]){_0x49c6c6[_0xbeee('0x41')]=[{'all':!![]}];}_0x49c6c6=_[_0xbeee('0x3c')]({},_0x49c6c6,_0x181ba7[_0xbeee('0x3e')]);return db[_0xbeee('0x2d')][_0xbeee('0x47')](_0x49c6c6)[_0xbeee('0x23')](handleEntityNotFound(_0x803cdf,null))[_0xbeee('0x23')](respondWithResult(_0x803cdf,null))[_0xbeee('0x44')](handleError(_0x803cdf,null));};exports['create']=function(_0x548d3a,_0xf09d99){return db[_0xbeee('0x2d')][_0xbeee('0x48')](_0x548d3a[_0xbeee('0x49')],{})[_0xbeee('0x23')](function(_0x38d9b7){var _0x325167=_0x548d3a[_0xbeee('0x4a')][_0xbeee('0x25')]({'plain':!![]});if(!_0x325167)throw new Error(_0xbeee('0x4b'));if(_0x325167['role']==='user'){var _0x2607cd=_0x38d9b7[_0xbeee('0x25')]({'plain':!![]});var _0x5ea4fb=_0xbeee('0x26');return db[_0xbeee('0x4c')][_0xbeee('0x47')]({'where':{'name':_0x5ea4fb,'userProfileId':_0x325167[_0xbeee('0x4d')]},'raw':!![]})['then'](function(_0x9a24af){if(_0x9a24af&&_0x9a24af[_0xbeee('0x4e')]===0x0){return db[_0xbeee('0x27')]['create']({'name':_0x2607cd[_0xbeee('0x2a')],'resourceId':_0x2607cd['id'],'type':_0x9a24af[_0xbeee('0x2a')],'sectionId':_0x9a24af['id']},{})['then'](function(){return _0x38d9b7;});}else{return _0x38d9b7;}})[_0xbeee('0x44')](function(_0x360d41){logger['error'](_0xbeee('0x4f'),_0x360d41);throw _0x360d41;});}return _0x38d9b7;})['then'](respondWithResult(_0xf09d99,0xc9))[_0xbeee('0x44')](handleError(_0xf09d99,null));};exports[_0xbeee('0x22')]=function(_0x4d5061,_0x26997b){if(_0x4d5061[_0xbeee('0x49')]['id']){delete _0x4d5061[_0xbeee('0x49')]['id'];}return db[_0xbeee('0x2d')][_0xbeee('0x47')]({'where':{'id':_0x4d5061[_0xbeee('0x45')]['id']}})['then'](handleEntityNotFound(_0x26997b,null))[_0xbeee('0x23')](saveUpdates(_0x4d5061[_0xbeee('0x49')],null))[_0xbeee('0x23')](respondWithResult(_0x26997b,null))[_0xbeee('0x44')](handleError(_0x26997b,null));};exports[_0xbeee('0x24')]=function(_0x257a90,_0x318a7c){return db[_0xbeee('0x2d')][_0xbeee('0x47')]({'where':{'id':_0x257a90[_0xbeee('0x45')]['id']}})[_0xbeee('0x23')](handleEntityNotFound(_0x318a7c,null))[_0xbeee('0x23')](removeEntity(_0x318a7c,null))[_0xbeee('0x44')](handleError(_0x318a7c,null));};exports['test']=function(_0x1631f1,_0x3b9253,_0x59ce9d){var _0x33540a;return db[_0xbeee('0x2d')]['find']({'where':{'id':_0x1631f1[_0xbeee('0x45')]['id']},'attributes':['id',_0xbeee('0x50')]})[_0xbeee('0x23')](handleEntityNotFound(_0x3b9253,null))['then'](function(_0xec2cb1){if(_0xec2cb1){var _0x46f922=require(_0xbeee('0x51'))();_0x46f922['openSync'](_0xec2cb1[_0xbeee('0x50')]);_0x46f922[_0xbeee('0x52')]();return _0xec2cb1;}})['then'](respondWithResult(_0x3b9253,null))[_0xbeee('0x44')](handleError(_0x3b9253,null));}; \ No newline at end of file +var _0xe1d5=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','dsn','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x27d19e,_0x417b1d){var _0x210195=function(_0x1771a7){while(--_0x1771a7){_0x27d19e['push'](_0x27d19e['shift']());}};_0x210195(++_0x417b1d);}(_0xe1d5,0x19f));var _0x5e1d=function(_0x2527c5,_0x1ee5f0){_0x2527c5=_0x2527c5-0x0;var _0x2344dc=_0xe1d5[_0x2527c5];return _0x2344dc;};'use strict';var emlformat=require(_0x5e1d('0x0'));var rimraf=require(_0x5e1d('0x1'));var zipdir=require(_0x5e1d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e1d('0x3'));var moment=require(_0x5e1d('0x4'));var BPromise=require(_0x5e1d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5e1d('0x6'));var ejs=require(_0x5e1d('0x7'));var fs=require('fs');var fs_extra=require(_0x5e1d('0x8'));var _=require('lodash');var squel=require(_0x5e1d('0x9'));var crypto=require('crypto');var jsforce=require(_0x5e1d('0xa'));var deskjs=require(_0x5e1d('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5e1d('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5e1d('0xd'));var qs=require(_0x5e1d('0xe'));var as=require(_0x5e1d('0xf'));var hardwareService=require(_0x5e1d('0x10'));var logger=require(_0x5e1d('0x11'))(_0x5e1d('0x12'));var utils=require(_0x5e1d('0x13'));var config=require(_0x5e1d('0x14'));var licenseUtil=require(_0x5e1d('0x15'));var db=require(_0x5e1d('0x16'))['db'];function respondWithStatusCode(_0x411238,_0x5659da){_0x5659da=_0x5659da||0xcc;return function(_0x3a05f9){if(_0x3a05f9){return _0x411238[_0x5e1d('0x17')](_0x5659da);}return _0x411238[_0x5e1d('0x18')](_0x5659da)[_0x5e1d('0x19')]();};}function respondWithResult(_0x5d1a89,_0x5ec83f){_0x5ec83f=_0x5ec83f||0xc8;return function(_0x5f4fc8){if(_0x5f4fc8){return _0x5d1a89[_0x5e1d('0x18')](_0x5ec83f)['json'](_0x5f4fc8);}};}function respondWithFilteredResult(_0x4c26a8,_0x886b74){return function(_0x558216){if(_0x558216){var _0x4acc64=typeof _0x886b74[_0x5e1d('0x1a')]==='undefined'&&typeof _0x886b74[_0x5e1d('0x1b')]===_0x5e1d('0x1c');var _0x4c9226=_0x558216[_0x5e1d('0x1d')];var _0x3aac83=_0x4acc64?0x0:_0x886b74['offset'];var _0x56db25=_0x4acc64?_0x558216[_0x5e1d('0x1d')]:_0x886b74[_0x5e1d('0x1a')]+_0x886b74['limit'];var _0xa6b1c8;if(_0x56db25>=_0x4c9226){_0x56db25=_0x4c9226;_0xa6b1c8=0xc8;}else{_0xa6b1c8=0xce;}_0x4c26a8['status'](_0xa6b1c8);return _0x4c26a8['set'](_0x5e1d('0x1e'),_0x3aac83+'-'+_0x56db25+'/'+_0x4c9226)[_0x5e1d('0x1f')](_0x558216);}return null;};}function patchUpdates(_0x43234b){return function(_0x53a011){try{jsonpatch['apply'](_0x53a011,_0x43234b,!![]);}catch(_0x13351f){return BPromise[_0x5e1d('0x20')](_0x13351f);}return _0x53a011[_0x5e1d('0x21')]();};}function saveUpdates(_0x56faae,_0x261e26){return function(_0x47debc){if(_0x47debc){return _0x47debc[_0x5e1d('0x22')](_0x56faae)[_0x5e1d('0x23')](function(_0x54fcd8){return _0x54fcd8;});}return null;};}function removeEntity(_0x5c205d,_0x16b671){return function(_0x2916c9){if(_0x2916c9){return _0x2916c9[_0x5e1d('0x24')]()[_0x5e1d('0x23')](function(){var _0x3cd827=_0x2916c9[_0x5e1d('0x25')]({'plain':!![]});var _0x213afa='ODBC';return db[_0x5e1d('0x26')][_0x5e1d('0x24')]({'where':{'type':_0x213afa,'resourceId':_0x3cd827['id']}})['then'](function(){return _0x2916c9;});})['then'](function(){_0x5c205d[_0x5e1d('0x18')](0xcc)[_0x5e1d('0x19')]();});}};}function handleEntityNotFound(_0x4127f4,_0x2bfe44){return function(_0x5a988c){if(!_0x5a988c){_0x4127f4['sendStatus'](0x194);}return _0x5a988c;};}function handleError(_0x3e89dd,_0x102e78){_0x102e78=_0x102e78||0x1f4;return function(_0x216104){logger[_0x5e1d('0x27')](_0x216104[_0x5e1d('0x28')]);if(_0x216104[_0x5e1d('0x29')]){delete _0x216104[_0x5e1d('0x29')];}_0x3e89dd[_0x5e1d('0x18')](_0x102e78)['send'](_0x216104);};}exports[_0x5e1d('0x2a')]=function(_0xad1b7,_0x19dde5){var _0x49a12c={},_0x418da0={},_0xa4e31c={'count':0x0,'rows':[]};var _0x18dfbd=_[_0x5e1d('0x2b')](db[_0x5e1d('0x2c')][_0x5e1d('0x2d')],function(_0x5c9345){return{'name':_0x5c9345[_0x5e1d('0x2e')],'type':_0x5c9345[_0x5e1d('0x2f')][_0x5e1d('0x30')]};});_0x418da0[_0x5e1d('0x31')]=_[_0x5e1d('0x2b')](_0x18dfbd,'name');_0x418da0[_0x5e1d('0x32')]=_[_0x5e1d('0x33')](_0xad1b7[_0x5e1d('0x32')]);_0x418da0['filters']=_[_0x5e1d('0x34')](_0x418da0[_0x5e1d('0x31')],_0x418da0[_0x5e1d('0x32')]);_0x49a12c[_0x5e1d('0x35')]=_[_0x5e1d('0x34')](_0x418da0['model'],qs[_0x5e1d('0x36')](_0xad1b7[_0x5e1d('0x32')][_0x5e1d('0x36')]));_0x49a12c[_0x5e1d('0x35')]=_0x49a12c[_0x5e1d('0x35')][_0x5e1d('0x37')]?_0x49a12c[_0x5e1d('0x35')]:_0x418da0[_0x5e1d('0x31')];if(!_0xad1b7[_0x5e1d('0x32')][_0x5e1d('0x38')](_0x5e1d('0x39'))){_0x49a12c[_0x5e1d('0x1b')]=qs['limit'](_0xad1b7['query'][_0x5e1d('0x1b')]);_0x49a12c[_0x5e1d('0x1a')]=qs[_0x5e1d('0x1a')](_0xad1b7[_0x5e1d('0x32')][_0x5e1d('0x1a')]);}_0x49a12c[_0x5e1d('0x3a')]=qs[_0x5e1d('0x3b')](_0xad1b7['query'][_0x5e1d('0x3b')]);_0x49a12c[_0x5e1d('0x3c')]=qs['filters'](_[_0x5e1d('0x3d')](_0xad1b7['query'],_0x418da0[_0x5e1d('0x3e')]),_0x18dfbd);if(_0xad1b7['query'][_0x5e1d('0x3f')]){_0x49a12c['where']=_[_0x5e1d('0x40')](_0x49a12c[_0x5e1d('0x3c')],{'$or':_['map'](_0x18dfbd,function(_0x4de263){if(_0x4de263[_0x5e1d('0x2f')]!==_0x5e1d('0x41')){var _0x221cf0={};_0x221cf0[_0x4de263[_0x5e1d('0x29')]]={'$like':'%'+_0xad1b7['query'][_0x5e1d('0x3f')]+'%'};return _0x221cf0;}})});}_0x49a12c=_['merge']({},_0x49a12c,_0xad1b7[_0x5e1d('0x42')]);var _0x2449f1={'where':_0x49a12c['where']};return db[_0x5e1d('0x2c')][_0x5e1d('0x1d')](_0x2449f1)[_0x5e1d('0x23')](function(_0x4c5125){_0xa4e31c[_0x5e1d('0x1d')]=_0x4c5125;if(_0xad1b7[_0x5e1d('0x32')][_0x5e1d('0x43')]){_0x49a12c[_0x5e1d('0x44')]=[{'all':!![]}];}return db[_0x5e1d('0x2c')][_0x5e1d('0x45')](_0x49a12c);})[_0x5e1d('0x23')](function(_0x477827){_0xa4e31c[_0x5e1d('0x46')]=_0x477827;return _0xa4e31c;})[_0x5e1d('0x23')](respondWithFilteredResult(_0x19dde5,_0x49a12c))[_0x5e1d('0x47')](handleError(_0x19dde5,null));};exports[_0x5e1d('0x48')]=function(_0x165c01,_0x1dbd7e){var _0x18bb5a={'raw':!![],'where':{'id':_0x165c01[_0x5e1d('0x49')]['id']}},_0x5d328f={};_0x5d328f['model']=_['keys'](db[_0x5e1d('0x2c')][_0x5e1d('0x2d')]);_0x5d328f[_0x5e1d('0x32')]=_['keys'](_0x165c01[_0x5e1d('0x32')]);_0x5d328f['filters']=_[_0x5e1d('0x34')](_0x5d328f[_0x5e1d('0x31')],_0x5d328f['query']);_0x18bb5a[_0x5e1d('0x35')]=_[_0x5e1d('0x34')](_0x5d328f[_0x5e1d('0x31')],qs[_0x5e1d('0x36')](_0x165c01['query']['fields']));_0x18bb5a[_0x5e1d('0x35')]=_0x18bb5a[_0x5e1d('0x35')]['length']?_0x18bb5a['attributes']:_0x5d328f[_0x5e1d('0x31')];if(_0x165c01['query'][_0x5e1d('0x43')]){_0x18bb5a[_0x5e1d('0x44')]=[{'all':!![]}];}_0x18bb5a=_[_0x5e1d('0x40')]({},_0x18bb5a,_0x165c01[_0x5e1d('0x42')]);return db[_0x5e1d('0x2c')][_0x5e1d('0x4a')](_0x18bb5a)[_0x5e1d('0x23')](handleEntityNotFound(_0x1dbd7e,null))['then'](respondWithResult(_0x1dbd7e,null))[_0x5e1d('0x47')](handleError(_0x1dbd7e,null));};exports[_0x5e1d('0x4b')]=function(_0x120d41,_0x3ca3ce){return db[_0x5e1d('0x2c')][_0x5e1d('0x4b')](_0x120d41[_0x5e1d('0x4c')],{})[_0x5e1d('0x23')](function(_0x1ac7aa){var _0x48092c=_0x120d41[_0x5e1d('0x4d')]['get']({'plain':!![]});if(!_0x48092c)throw new Error(_0x5e1d('0x4e'));if(_0x48092c[_0x5e1d('0x4f')]==='user'){var _0x44a456=_0x1ac7aa[_0x5e1d('0x25')]({'plain':!![]});var _0x149e08='ODBC';return db[_0x5e1d('0x50')]['find']({'where':{'name':_0x149e08,'userProfileId':_0x48092c['userProfileId']},'raw':!![]})['then'](function(_0x420cae){if(_0x420cae&&_0x420cae[_0x5e1d('0x51')]===0x0){return db[_0x5e1d('0x26')][_0x5e1d('0x4b')]({'name':_0x44a456['name'],'resourceId':_0x44a456['id'],'type':_0x420cae[_0x5e1d('0x29')],'sectionId':_0x420cae['id']},{})['then'](function(){return _0x1ac7aa;});}else{return _0x1ac7aa;}})[_0x5e1d('0x47')](function(_0x21045b){logger[_0x5e1d('0x27')](_0x5e1d('0x52'),_0x21045b);throw _0x21045b;});}return _0x1ac7aa;})['then'](respondWithResult(_0x3ca3ce,0xc9))[_0x5e1d('0x47')](handleError(_0x3ca3ce,null));};exports[_0x5e1d('0x22')]=function(_0x5802b0,_0x48e2d1){if(_0x5802b0[_0x5e1d('0x4c')]['id']){delete _0x5802b0[_0x5e1d('0x4c')]['id'];}return db['SquareOdbc'][_0x5e1d('0x4a')]({'where':{'id':_0x5802b0[_0x5e1d('0x49')]['id']}})[_0x5e1d('0x23')](handleEntityNotFound(_0x48e2d1,null))[_0x5e1d('0x23')](saveUpdates(_0x5802b0[_0x5e1d('0x4c')],null))['then'](respondWithResult(_0x48e2d1,null))[_0x5e1d('0x47')](handleError(_0x48e2d1,null));};exports[_0x5e1d('0x24')]=function(_0x5d25cf,_0xec4372){return db[_0x5e1d('0x2c')][_0x5e1d('0x4a')]({'where':{'id':_0x5d25cf[_0x5e1d('0x49')]['id']}})[_0x5e1d('0x23')](handleEntityNotFound(_0xec4372,null))[_0x5e1d('0x23')](removeEntity(_0xec4372,null))[_0x5e1d('0x47')](handleError(_0xec4372,null));};exports[_0x5e1d('0x53')]=function(_0x249686,_0x353821,_0x99d433){var _0x39781d;return db[_0x5e1d('0x2c')][_0x5e1d('0x4a')]({'where':{'id':_0x249686[_0x5e1d('0x49')]['id']},'attributes':['id','dsn']})[_0x5e1d('0x23')](handleEntityNotFound(_0x353821,null))[_0x5e1d('0x23')](function(_0x4978cf){if(_0x4978cf){var _0x198a79=require(_0x5e1d('0x54'))();_0x198a79['openSync'](_0x4978cf[_0x5e1d('0x55')]);_0x198a79[_0x5e1d('0x56')]();return _0x4978cf;}})[_0x5e1d('0x23')](respondWithResult(_0x353821,null))[_0x5e1d('0x47')](handleError(_0x353821,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 795a2a1..457f415 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 _0xf77c=['request-promise','path','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc','../../config/logger','api','moment','bluebird'];(function(_0x4b8412,_0x235b3d){var _0x1ed9ed=function(_0x455209){while(--_0x455209){_0x4b8412['push'](_0x4b8412['shift']());}};_0x1ed9ed(++_0x235b3d);}(_0xf77c,0x1a0));var _0xcf77=function(_0x4c1f1f,_0x3aa18d){_0x4c1f1f=_0x4c1f1f-0x0;var _0x4f9e3c=_0xf77c[_0x4c1f1f];return _0x4f9e3c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcf77('0x0'))(_0xcf77('0x1'));var moment=require(_0xcf77('0x2'));var BPromise=require(_0xcf77('0x3'));var rp=require(_0xcf77('0x4'));var fs=require('fs');var path=require(_0xcf77('0x5'));var rimraf=require(_0xcf77('0x6'));var config=require(_0xcf77('0x7'));var attributes=require('./squareOdbc.attributes');module[_0xcf77('0x8')]=function(_0xfafc1a,_0xdef53a){return _0xfafc1a[_0xcf77('0x9')](_0xcf77('0xa'),attributes,{'tableName':_0xcf77('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa429=['request-promise','path','rimraf','./squareOdbc.attributes','SquareOdbc','lodash','util','../../config/logger','moment','bluebird'];(function(_0x40ebff,_0x1dd15e){var _0x40122a=function(_0xae6174){while(--_0xae6174){_0x40ebff['push'](_0x40ebff['shift']());}};_0x40122a(++_0x1dd15e);}(_0xa429,0x127));var _0x9a42=function(_0x419b48,_0x15663b){_0x419b48=_0x419b48-0x0;var _0x24f7e0=_0xa429[_0x419b48];return _0x24f7e0;};'use strict';var _=require(_0x9a42('0x0'));var util=require(_0x9a42('0x1'));var logger=require(_0x9a42('0x2'))('api');var moment=require(_0x9a42('0x3'));var BPromise=require(_0x9a42('0x4'));var rp=require(_0x9a42('0x5'));var fs=require('fs');var path=require(_0x9a42('0x6'));var rimraf=require(_0x9a42('0x7'));var config=require('../../config/environment');var attributes=require(_0x9a42('0x8'));module['exports']=function(_0x3038c7,_0x508d72){return _0x3038c7['define'](_0x9a42('0x9'),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 e75acd1..38e9876 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 _0xd2d3=['include','map','model','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','SquareOdbc,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ShowSquareOdbc','options','attributes'];(function(_0x26aa24,_0xcd5d8c){var _0xf90f88=function(_0x113459){while(--_0x113459){_0x26aa24['push'](_0x26aa24['shift']());}};_0xf90f88(++_0xcd5d8c);}(_0xd2d3,0x14f));var _0x3d2d=function(_0x1da239,_0x3cf474){_0x1da239=_0x1da239-0x0;var _0x15a4e7=_0xd2d3[_0x1da239];return _0x15a4e7;};'use strict';var _=require(_0x3d2d('0x0'));var util=require(_0x3d2d('0x1'));var moment=require(_0x3d2d('0x2'));var BPromise=require(_0x3d2d('0x3'));var rs=require(_0x3d2d('0x4'));var fs=require('fs');var Redis=require(_0x3d2d('0x5'));var db=require(_0x3d2d('0x6'))['db'];var utils=require(_0x3d2d('0x7'));var logger=require(_0x3d2d('0x8'))(_0x3d2d('0x9'));var config=require('../../config/environment');var jayson=require(_0x3d2d('0xa'));var client=jayson[_0x3d2d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8f0571,_0x4782c3,_0x3f1990){return new BPromise(function(_0x238b6b,_0x56eb56){return client[_0x3d2d('0xc')](_0x8f0571,_0x3f1990)['then'](function(_0x5cebda){logger['info'](_0x3d2d('0xd'),_0x4782c3,_0x3d2d('0xe'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x4782c3,_0x3d2d('0xe'),JSON[_0x3d2d('0xf')](_0x5cebda));if(_0x5cebda[_0x3d2d('0x10')]){if(_0x5cebda[_0x3d2d('0x10')][_0x3d2d('0x11')]===0x1f4){logger['error'](_0x3d2d('0xd'),_0x4782c3,_0x5cebda[_0x3d2d('0x10')]['message']);return _0x56eb56(_0x5cebda[_0x3d2d('0x10')]['message']);}logger[_0x3d2d('0x10')](_0x3d2d('0xd'),_0x4782c3,_0x5cebda[_0x3d2d('0x10')]['message']);return _0x238b6b(_0x5cebda['error'][_0x3d2d('0x12')]);}else{logger[_0x3d2d('0x13')](_0x3d2d('0xd'),_0x4782c3,_0x3d2d('0xe'));_0x238b6b(_0x5cebda[_0x3d2d('0x14')][_0x3d2d('0x12')]);}})[_0x3d2d('0x15')](function(_0x4f056e){logger[_0x3d2d('0x10')](_0x3d2d('0xd'),_0x4782c3,_0x4f056e);_0x56eb56(_0x4f056e);});});}exports[_0x3d2d('0x16')]=function(_0x403e56){var _0x3ff3ae=this;return new Promise(function(_0x17e3d3,_0x393ae0){return db['SquareOdbc']['find']({'raw':_0x403e56[_0x3d2d('0x17')]?_0x403e56[_0x3d2d('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x403e56[_0x3d2d('0x17')]?_0x403e56[_0x3d2d('0x17')]['where']||null:null,'attributes':_0x403e56[_0x3d2d('0x17')]?_0x403e56[_0x3d2d('0x17')][_0x3d2d('0x18')]||null:null,'include':_0x403e56[_0x3d2d('0x17')]?_0x403e56[_0x3d2d('0x17')][_0x3d2d('0x19')]?_[_0x3d2d('0x1a')](_0x403e56[_0x3d2d('0x17')][_0x3d2d('0x19')],function(_0x44fc9b){return{'model':db[_0x44fc9b[_0x3d2d('0x1b')]],'as':_0x44fc9b['as'],'attributes':_0x44fc9b[_0x3d2d('0x18')],'include':_0x44fc9b[_0x3d2d('0x19')]?_[_0x3d2d('0x1a')](_0x44fc9b[_0x3d2d('0x19')],function(_0x177b95){return{'model':db[_0x177b95['model']],'as':_0x177b95['as'],'attributes':_0x177b95[_0x3d2d('0x18')],'include':_0x177b95[_0x3d2d('0x19')]?_[_0x3d2d('0x1a')](_0x177b95[_0x3d2d('0x19')],function(_0x5cae76){return{'model':db[_0x5cae76[_0x3d2d('0x1b')]],'as':_0x5cae76['as'],'attributes':_0x5cae76[_0x3d2d('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3d2d('0x1c')](function(_0x833b80){logger[_0x3d2d('0x13')](_0x3d2d('0x16'),_0x403e56);logger[_0x3d2d('0x1d')](_0x3d2d('0x16'),_0x403e56,JSON[_0x3d2d('0xf')](_0x833b80));_0x17e3d3(_0x833b80);})[_0x3d2d('0x15')](function(_0xe4f022){logger[_0x3d2d('0x10')](_0x3d2d('0x16'),_0xe4f022[_0x3d2d('0x12')],_0x403e56);_0x393ae0(_0x3ff3ae[_0x3d2d('0x10')](0x1f4,_0xe4f022['message']));});});}; \ No newline at end of file +var _0x23ab=['ShowSquareOdbc','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch','SquareOdbc','options','raw','where','attributes','map','model','include'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x23ab,0x1f1));var _0xb23a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x23ab[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0xb23a('0x0'));var moment=require(_0xb23a('0x1'));var BPromise=require(_0xb23a('0x2'));var rs=require(_0xb23a('0x3'));var fs=require('fs');var Redis=require(_0xb23a('0x4'));var db=require(_0xb23a('0x5'))['db'];var utils=require(_0xb23a('0x6'));var logger=require(_0xb23a('0x7'))(_0xb23a('0x8'));var config=require(_0xb23a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb23a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf44976,_0x394fe9,_0x1ab89d){return new BPromise(function(_0x1391d3,_0x274a6b){return client[_0xb23a('0xb')](_0xf44976,_0x1ab89d)[_0xb23a('0xc')](function(_0x5e16df){logger[_0xb23a('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x394fe9,'request\x20sent');logger['debug'](_0xb23a('0xe'),_0x394fe9,_0xb23a('0xf'),JSON[_0xb23a('0x10')](_0x5e16df));if(_0x5e16df[_0xb23a('0x11')]){if(_0x5e16df[_0xb23a('0x11')][_0xb23a('0x12')]===0x1f4){logger[_0xb23a('0x11')](_0xb23a('0x13'),_0x394fe9,_0x5e16df['error'][_0xb23a('0x14')]);return _0x274a6b(_0x5e16df['error'][_0xb23a('0x14')]);}logger['error'](_0xb23a('0x13'),_0x394fe9,_0x5e16df['error'][_0xb23a('0x14')]);return _0x1391d3(_0x5e16df[_0xb23a('0x11')]['message']);}else{logger['info'](_0xb23a('0x13'),_0x394fe9,'request\x20sent');_0x1391d3(_0x5e16df[_0xb23a('0x15')]['message']);}})[_0xb23a('0x16')](function(_0x23d25f){logger[_0xb23a('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x394fe9,_0x23d25f);_0x274a6b(_0x23d25f);});});}exports['ShowSquareOdbc']=function(_0x5d5fac){var _0x12720a=this;return new Promise(function(_0x3df29e,_0x510ede){return db[_0xb23a('0x17')]['find']({'raw':_0x5d5fac[_0xb23a('0x18')]?_0x5d5fac['options'][_0xb23a('0x19')]===undefined?!![]:![]:!![],'where':_0x5d5fac[_0xb23a('0x18')]?_0x5d5fac['options'][_0xb23a('0x1a')]||null:null,'attributes':_0x5d5fac[_0xb23a('0x18')]?_0x5d5fac[_0xb23a('0x18')][_0xb23a('0x1b')]||null:null,'include':_0x5d5fac[_0xb23a('0x18')]?_0x5d5fac[_0xb23a('0x18')]['include']?_[_0xb23a('0x1c')](_0x5d5fac[_0xb23a('0x18')]['include'],function(_0xe73c2e){return{'model':db[_0xe73c2e[_0xb23a('0x1d')]],'as':_0xe73c2e['as'],'attributes':_0xe73c2e[_0xb23a('0x1b')],'include':_0xe73c2e[_0xb23a('0x1e')]?_[_0xb23a('0x1c')](_0xe73c2e[_0xb23a('0x1e')],function(_0x121249){return{'model':db[_0x121249['model']],'as':_0x121249['as'],'attributes':_0x121249[_0xb23a('0x1b')],'include':_0x121249[_0xb23a('0x1e')]?_['map'](_0x121249[_0xb23a('0x1e')],function(_0x149734){return{'model':db[_0x149734[_0xb23a('0x1d')]],'as':_0x149734['as'],'attributes':_0x149734[_0xb23a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb23a('0xc')](function(_0x1e7fab){logger[_0xb23a('0xd')](_0xb23a('0x1f'),_0x5d5fac);logger[_0xb23a('0x20')](_0xb23a('0x1f'),_0x5d5fac,JSON[_0xb23a('0x10')](_0x1e7fab));_0x3df29e(_0x1e7fab);})['catch'](function(_0x56ba97){logger[_0xb23a('0x11')](_0xb23a('0x1f'),_0x56ba97[_0xb23a('0x14')],_0x5d5fac);_0x510ede(_0x12720a[_0xb23a('0x11')](0x1f4,_0x56ba97[_0xb23a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 5ff35a3..74aa2bf 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 _0x8667=['put','update','delete','/:id','destroy','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create'];(function(_0x2b4388,_0x1cbaaa){var _0x2fce40=function(_0x1ec89a){while(--_0x1ec89a){_0x2b4388['push'](_0x2b4388['shift']());}};_0x2fce40(++_0x1cbaaa);}(_0x8667,0x186));var _0x7866=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8667[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7866('0x0'));var timeout=require(_0x7866('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7866('0x2'));var interaction=require(_0x7866('0x3'));var config=require(_0x7866('0x4'));var controller=require('./squareProject.controller');router[_0x7866('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7866('0x5')]('/:id',auth[_0x7866('0x6')](),controller[_0x7866('0x7')]);router[_0x7866('0x8')]('/',auth[_0x7866('0x6')](),controller[_0x7866('0x9')]);router[_0x7866('0xa')]('/:id',auth[_0x7866('0x6')](),controller[_0x7866('0xb')]);router[_0x7866('0xc')](_0x7866('0xd'),auth[_0x7866('0x6')](),controller[_0x7866('0xe')]);module[_0x7866('0xf')]=router; \ No newline at end of file +var _0xe9cf=['express','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3108d9,_0xf08d6){var _0x1455e6=function(_0xfd5906){while(--_0xfd5906){_0x3108d9['push'](_0x3108d9['shift']());}};_0x1455e6(++_0xf08d6);}(_0xe9cf,0x1b4));var _0xfe9c=function(_0x4b366e,_0x479e1f){_0x4b366e=_0x4b366e-0x0;var _0x464dff=_0xe9cf[_0x4b366e];return _0x464dff;};'use strict';var multer=require(_0xfe9c('0x0'));var util=require(_0xfe9c('0x1'));var path=require(_0xfe9c('0x2'));var timeout=require(_0xfe9c('0x3'));var express=require(_0xfe9c('0x4'));var router=express['Router']();var fs_extra=require(_0xfe9c('0x5'));var auth=require(_0xfe9c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfe9c('0x7'));var controller=require(_0xfe9c('0x8'));router[_0xfe9c('0x9')]('/',auth[_0xfe9c('0xa')](),controller[_0xfe9c('0xb')]);router[_0xfe9c('0x9')](_0xfe9c('0xc'),auth[_0xfe9c('0xa')](),controller[_0xfe9c('0xd')]);router['post']('/',auth[_0xfe9c('0xa')](),controller[_0xfe9c('0xe')]);router[_0xfe9c('0xf')](_0xfe9c('0xc'),auth[_0xfe9c('0xa')](),controller[_0xfe9c('0x10')]);router[_0xfe9c('0x11')](_0xfe9c('0xc'),auth[_0xfe9c('0xa')](),controller[_0xfe9c('0x12')]);module[_0xfe9c('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 97bc6e2..32769f6 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 _0x0a05=['toString','utf8','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','getDataValue'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x0a05,0x9e));var _0x50a0=function(_0x31ddba,_0x28ec26){_0x31ddba=_0x31ddba-0x0;var _0x3f014c=_0x0a05[_0x31ddba];return _0x3f014c;};'use strict';var Sequelize=require(_0x50a0('0x0'));module[_0x50a0('0x1')]={'name':{'type':Sequelize[_0x50a0('0x2')],'unique':_0x50a0('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x50a0('0x2')]},'notes':{'type':Sequelize[_0x50a0('0x4')]},'preproduction':{'type':Sequelize[_0x50a0('0x5')]('long'),'get':function(){if(this[_0x50a0('0x6')]('preproduction')){return this[_0x50a0('0x6')]('preproduction')[_0x50a0('0x7')](_0x50a0('0x8'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x50a0('0x6')](_0x50a0('0x9'))){return this[_0x50a0('0x6')](_0x50a0('0x9'))['toString'](_0x50a0('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x50a0('0xa')]}}; \ No newline at end of file +var _0xcd94=['getDataValue','toString','utf8','production','exports','STRING','name','TEXT','BLOB','long','preproduction'];(function(_0x27a842,_0x30049e){var _0x2b02c1=function(_0x5daaa4){while(--_0x5daaa4){_0x27a842['push'](_0x27a842['shift']());}};_0x2b02c1(++_0x30049e);}(_0xcd94,0x19b));var _0x4cd9=function(_0x2df387,_0x1d3ea1){_0x2df387=_0x2df387-0x0;var _0x3b1708=_0xcd94[_0x2df387];return _0x3b1708;};'use strict';var Sequelize=require('sequelize');module[_0x4cd9('0x0')]={'name':{'type':Sequelize[_0x4cd9('0x1')],'unique':_0x4cd9('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4cd9('0x1')]},'notes':{'type':Sequelize[_0x4cd9('0x3')]},'preproduction':{'type':Sequelize[_0x4cd9('0x4')](_0x4cd9('0x5')),'get':function(){if(this['getDataValue'](_0x4cd9('0x6'))){return this[_0x4cd9('0x7')](_0x4cd9('0x6'))[_0x4cd9('0x8')](_0x4cd9('0x9'));}}},'production':{'type':Sequelize[_0x4cd9('0x4')](_0x4cd9('0x5')),'get':function(){if(this[_0x4cd9('0x7')](_0x4cd9('0xa'))){return this['getDataValue']('production')[_0x4cd9('0x8')](_0x4cd9('0x9'));}}},'savedAt':{'type':Sequelize['DATE']},'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 4b86fe9..2c00a94 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 _0xcc3f=['where','pick','merge','type','VIRTUAL','filter','options','findAll','rows','catch','show','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','production','find','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','register','json','offset','limit','undefined','count','status','set','Content-Range','update','destroy','then','get','SquareProjects','publish','agi','end','sendStatus','name','send','map','SquareProject','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcc3f,0xa4));var _0xfcc3=function(_0x3aee3b,_0x2fe0dc){_0x3aee3b=_0x3aee3b-0x0;var _0x1cf89c=_0xcc3f[_0x3aee3b];return _0x1cf89c;};'use strict';var _=require(_0xfcc3('0x0'));var Redis=require(_0xfcc3('0x1'));var qs=require(_0xfcc3('0x2'));var logger=require(_0xfcc3('0x3'))(_0xfcc3('0x4'));var config=require(_0xfcc3('0x5'));var db=require('../../mysqldb')['db'];config[_0xfcc3('0x6')]=_['defaults'](config['redis'],{'host':_0xfcc3('0x7'),'port':0x18eb});var socket=require(_0xfcc3('0x8'))(new Redis(config[_0xfcc3('0x6')]));require(_0xfcc3('0x9'))[_0xfcc3('0xa')](socket);function respondWithResult(_0x3de300,_0x23b3fb){_0x23b3fb=_0x23b3fb||0xc8;return function(_0x25f12d){if(_0x25f12d){return _0x3de300['status'](_0x23b3fb)[_0xfcc3('0xb')](_0x25f12d);}};}function respondWithFilteredResult(_0x8a882f,_0x233c3e){return function(_0x272a05){if(_0x272a05){var _0x52d7f1=typeof _0x233c3e[_0xfcc3('0xc')]==='undefined'&&typeof _0x233c3e[_0xfcc3('0xd')]===_0xfcc3('0xe');var _0x41d107=_0x272a05[_0xfcc3('0xf')];var _0x4be562=_0x52d7f1?0x0:_0x233c3e[_0xfcc3('0xc')];var _0x2d3515=_0x52d7f1?_0x272a05[_0xfcc3('0xf')]:_0x233c3e[_0xfcc3('0xc')]+_0x233c3e[_0xfcc3('0xd')];var _0x5cc7cd;if(_0x2d3515>=_0x41d107){_0x2d3515=_0x41d107;_0x5cc7cd=0xc8;}else{_0x5cc7cd=0xce;}_0x8a882f[_0xfcc3('0x10')](_0x5cc7cd);return _0x8a882f[_0xfcc3('0x11')](_0xfcc3('0x12'),_0x4be562+'-'+_0x2d3515+'/'+_0x41d107)[_0xfcc3('0xb')](_0x272a05);}return null;};}function saveUpdates(_0x60a34f){return function(_0x287fa7){if(_0x287fa7){return _0x287fa7[_0xfcc3('0x13')](_0x60a34f)['then'](function(_0x1449c1){return _0x1449c1;});}return null;};}function removeEntity(_0x4a425c){return function(_0x4fee86){if(_0x4fee86){return _0x4fee86[_0xfcc3('0x14')]()[_0xfcc3('0x15')](function(){var _0x133880=_0x4fee86[_0xfcc3('0x16')]({'plain':!![]});var _0x51a5fb=_0xfcc3('0x17');return db['UserProfileResource'][_0xfcc3('0x14')]({'where':{'type':_0x51a5fb,'resourceId':_0x133880['id']}})['then'](function(){return _0x4fee86;});})[_0xfcc3('0x15')](function(){var _0x3b26c9=new Redis(config[_0xfcc3('0x6')]);_0x3b26c9[_0xfcc3('0x18')](_0xfcc3('0x19'),JSON['stringify']({'id':_0x4fee86['id'],'deleted':!![]}));})['then'](function(){_0x4a425c[_0xfcc3('0x10')](0xcc)[_0xfcc3('0x1a')]();});}};}function handleEntityNotFound(_0x188de7){return function(_0x534a7c){if(!_0x534a7c){_0x188de7[_0xfcc3('0x1b')](0x194);}return _0x534a7c;};}function handleError(_0x28ef27,_0x35436b){_0x35436b=_0x35436b||0x1f4;return function(_0x30ea57){logger['error'](_0x30ea57['stack']);if(_0x30ea57[_0xfcc3('0x1c')]){delete _0x30ea57[_0xfcc3('0x1c')];}_0x28ef27[_0xfcc3('0x10')](_0x35436b)[_0xfcc3('0x1d')](_0x30ea57);};}exports['index']=function(_0x29b0d5,_0x20c24e){var _0x33325b={},_0x3c0001={},_0x5b4c5e={'count':0x0,'rows':[]};var _0x3a0f7e=_[_0xfcc3('0x1e')](db[_0xfcc3('0x1f')][_0xfcc3('0x20')],function(_0x4f62a8){return{'name':_0x4f62a8[_0xfcc3('0x21')],'type':_0x4f62a8['type']['key']};});_0x3c0001[_0xfcc3('0x22')]=_[_0xfcc3('0x1e')](_0x3a0f7e,_0xfcc3('0x1c'));_0x3c0001[_0xfcc3('0x23')]=_[_0xfcc3('0x24')](_0x29b0d5['query']);_0x3c0001[_0xfcc3('0x25')]=_[_0xfcc3('0x26')](_0x3c0001[_0xfcc3('0x22')],_0x3c0001[_0xfcc3('0x23')]);_0x33325b['attributes']=_[_0xfcc3('0x26')](_0x3c0001[_0xfcc3('0x22')],qs[_0xfcc3('0x27')](_0x29b0d5[_0xfcc3('0x23')][_0xfcc3('0x27')]));_0x33325b[_0xfcc3('0x28')]=_0x33325b[_0xfcc3('0x28')][_0xfcc3('0x29')]?_0x33325b[_0xfcc3('0x28')]:_0x3c0001[_0xfcc3('0x22')];if(!_0x29b0d5[_0xfcc3('0x23')][_0xfcc3('0x2a')](_0xfcc3('0x2b'))){_0x33325b[_0xfcc3('0xd')]=qs['limit'](_0x29b0d5[_0xfcc3('0x23')][_0xfcc3('0xd')]);_0x33325b[_0xfcc3('0xc')]=qs['offset'](_0x29b0d5[_0xfcc3('0x23')][_0xfcc3('0xc')]);}_0x33325b[_0xfcc3('0x2c')]=qs['sort'](_0x29b0d5[_0xfcc3('0x23')][_0xfcc3('0x2d')]);_0x33325b[_0xfcc3('0x2e')]=qs[_0xfcc3('0x25')](_[_0xfcc3('0x2f')](_0x29b0d5[_0xfcc3('0x23')],_0x3c0001[_0xfcc3('0x25')]),_0x3a0f7e);if(_0x29b0d5[_0xfcc3('0x23')]['filter']){_0x33325b[_0xfcc3('0x2e')]=_[_0xfcc3('0x30')](_0x33325b[_0xfcc3('0x2e')],{'$or':_['map'](_0x3a0f7e,function(_0x6861f5){if(_0x6861f5[_0xfcc3('0x31')]!==_0xfcc3('0x32')){var _0x36e2c0={};_0x36e2c0[_0x6861f5['name']]={'$like':'%'+_0x29b0d5[_0xfcc3('0x23')][_0xfcc3('0x33')]+'%'};return _0x36e2c0;}})});}_0x33325b=_[_0xfcc3('0x30')]({},_0x33325b,_0x29b0d5[_0xfcc3('0x34')]);var _0x539a1a={'where':_0x33325b[_0xfcc3('0x2e')]};return db['SquareProject'][_0xfcc3('0xf')](_0x539a1a)[_0xfcc3('0x15')](function(_0x1a5dba){_0x5b4c5e[_0xfcc3('0xf')]=_0x1a5dba;if(_0x29b0d5[_0xfcc3('0x23')]['includeAll']){_0x33325b['include']=[{'all':!![]}];}return db[_0xfcc3('0x1f')][_0xfcc3('0x35')](_0x33325b);})[_0xfcc3('0x15')](function(_0x349d56){_0x5b4c5e[_0xfcc3('0x36')]=_0x349d56;return _0x5b4c5e;})[_0xfcc3('0x15')](respondWithFilteredResult(_0x20c24e,_0x33325b))[_0xfcc3('0x37')](handleError(_0x20c24e,null));};exports[_0xfcc3('0x38')]=function(_0x2926a0,_0x54060f){var _0x53d351={'raw':![],'where':{'id':_0x2926a0['params']['id']}},_0x56792c={};_0x56792c[_0xfcc3('0x22')]=_[_0xfcc3('0x24')](db[_0xfcc3('0x1f')]['rawAttributes']);_0x56792c[_0xfcc3('0x23')]=_[_0xfcc3('0x24')](_0x2926a0[_0xfcc3('0x23')]);_0x56792c[_0xfcc3('0x25')]=_[_0xfcc3('0x26')](_0x56792c[_0xfcc3('0x22')],_0x56792c['query']);_0x53d351['attributes']=_[_0xfcc3('0x26')](_0x56792c[_0xfcc3('0x22')],qs[_0xfcc3('0x27')](_0x2926a0[_0xfcc3('0x23')][_0xfcc3('0x27')]));_0x53d351[_0xfcc3('0x28')]=_0x53d351[_0xfcc3('0x28')]['length']?_0x53d351['attributes']:_0x56792c[_0xfcc3('0x22')];if(_0x2926a0[_0xfcc3('0x23')][_0xfcc3('0x39')]){_0x53d351['include']=[{'all':!![]}];}_0x53d351=_['merge']({},_0x53d351,_0x2926a0['options']);return db[_0xfcc3('0x1f')]['find'](_0x53d351)[_0xfcc3('0x15')](handleEntityNotFound(_0x54060f,null))[_0xfcc3('0x15')](respondWithResult(_0x54060f,null))['catch'](handleError(_0x54060f,null));};exports[_0xfcc3('0x3a')]=function(_0x64d53a,_0x5bbd80){return db[_0xfcc3('0x1f')][_0xfcc3('0x3a')](_0x64d53a['body'],{})[_0xfcc3('0x15')](function(_0x3b0c11){var _0x1d0550=_0x64d53a[_0xfcc3('0x3b')][_0xfcc3('0x16')]({'plain':!![]});if(!_0x1d0550)throw new Error(_0xfcc3('0x3c'));if(_0x1d0550[_0xfcc3('0x3d')]===_0xfcc3('0x3b')){var _0x3142dd=_0x3b0c11[_0xfcc3('0x16')]({'plain':!![]});var _0x2eaae5=_0xfcc3('0x17');return db[_0xfcc3('0x3e')]['find']({'where':{'name':_0x2eaae5,'userProfileId':_0x1d0550[_0xfcc3('0x3f')]},'raw':!![]})[_0xfcc3('0x15')](function(_0x52e5bd){if(_0x52e5bd&&_0x52e5bd['autoAssociation']===0x0){return db['UserProfileResource'][_0xfcc3('0x3a')]({'name':_0x3142dd[_0xfcc3('0x1c')],'resourceId':_0x3142dd['id'],'type':_0x52e5bd['name'],'sectionId':_0x52e5bd['id']},{})[_0xfcc3('0x15')](function(){return _0x3b0c11;});}else{return _0x3b0c11;}})[_0xfcc3('0x37')](function(_0x214ffb){logger[_0xfcc3('0x40')](_0xfcc3('0x41'),_0x214ffb);throw _0x214ffb;});}return _0x3b0c11;})[_0xfcc3('0x15')](respondWithResult(_0x5bbd80,0xc9))['catch'](handleError(_0x5bbd80,null));};exports['update']=function(_0x139f9f,_0x5e3f34){if(_0x139f9f[_0xfcc3('0x42')]['id']){delete _0x139f9f[_0xfcc3('0x42')]['id'];}return db[_0xfcc3('0x1f')]['find']({'where':{'id':_0x139f9f[_0xfcc3('0x43')]['id']}})[_0xfcc3('0x15')](handleEntityNotFound(_0x5e3f34,null))['then'](saveUpdates(_0x139f9f['body'],null))[_0xfcc3('0x15')](function(_0x478bbd){if(!_0x478bbd)return;var _0x3101a9=_0x478bbd[_0xfcc3('0x16')]({'plain':!![]});return _0x3101a9;})[_0xfcc3('0x15')](function(_0x499f9a){var _0x43fbd2=new Redis(config[_0xfcc3('0x6')]);_0x43fbd2[_0xfcc3('0x18')]('agi',JSON['stringify'](_['pick'](_0x499f9a,['id',_0xfcc3('0x1c'),_0xfcc3('0x44')])));return _0x499f9a;})['then'](respondWithResult(_0x5e3f34,null))[_0xfcc3('0x37')](handleError(_0x5e3f34,null));};exports['destroy']=function(_0xe586f9,_0xc8c213){return db['SquareProject'][_0xfcc3('0x45')]({'where':{'id':_0xe586f9[_0xfcc3('0x43')]['id']}})[_0xfcc3('0x15')](handleEntityNotFound(_0xc8c213,null))[_0xfcc3('0x15')](removeEntity(_0xc8c213,null))[_0xfcc3('0x37')](handleError(_0xc8c213,null));}; \ No newline at end of file +var _0xcb8e=['keys','intersection','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','publish','production','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','UserProfileResource','agi','stringify','end','sendStatus','error','name','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','include','findAll','catch','params'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0xcb8e,0x16e));var _0xecb8=function(_0x812835,_0x5c66bc){_0x812835=_0x812835-0x0;var _0x263def=_0xcb8e[_0x812835];return _0x263def;};'use strict';var _=require('lodash');var Redis=require(_0xecb8('0x0'));var qs=require(_0xecb8('0x1'));var logger=require('../../config/logger')(_0xecb8('0x2'));var config=require(_0xecb8('0x3'));var db=require(_0xecb8('0x4'))['db'];config[_0xecb8('0x5')]=_[_0xecb8('0x6')](config[_0xecb8('0x5')],{'host':_0xecb8('0x7'),'port':0x18eb});var socket=require(_0xecb8('0x8'))(new Redis(config['redis']));require('./squareProject.socket')[_0xecb8('0x9')](socket);function respondWithResult(_0x413b8c,_0x84713e){_0x84713e=_0x84713e||0xc8;return function(_0x26f35c){if(_0x26f35c){return _0x413b8c[_0xecb8('0xa')](_0x84713e)['json'](_0x26f35c);}};}function respondWithFilteredResult(_0x398630,_0xe843c6){return function(_0x515547){if(_0x515547){var _0x33ea0f=typeof _0xe843c6[_0xecb8('0xb')]===_0xecb8('0xc')&&typeof _0xe843c6['limit']===_0xecb8('0xc');var _0x30d3af=_0x515547['count'];var _0x48549d=_0x33ea0f?0x0:_0xe843c6[_0xecb8('0xb')];var _0x36aee0=_0x33ea0f?_0x515547[_0xecb8('0xd')]:_0xe843c6[_0xecb8('0xb')]+_0xe843c6[_0xecb8('0xe')];var _0x27e6fa;if(_0x36aee0>=_0x30d3af){_0x36aee0=_0x30d3af;_0x27e6fa=0xc8;}else{_0x27e6fa=0xce;}_0x398630[_0xecb8('0xa')](_0x27e6fa);return _0x398630[_0xecb8('0xf')](_0xecb8('0x10'),_0x48549d+'-'+_0x36aee0+'/'+_0x30d3af)[_0xecb8('0x11')](_0x515547);}return null;};}function saveUpdates(_0x543d4c){return function(_0x50e5a4){if(_0x50e5a4){return _0x50e5a4[_0xecb8('0x12')](_0x543d4c)[_0xecb8('0x13')](function(_0x207293){return _0x207293;});}return null;};}function removeEntity(_0x268406){return function(_0xe28169){if(_0xe28169){return _0xe28169[_0xecb8('0x14')]()['then'](function(){var _0x3835dd=_0xe28169['get']({'plain':!![]});var _0x278fd7='SquareProjects';return db[_0xecb8('0x15')][_0xecb8('0x14')]({'where':{'type':_0x278fd7,'resourceId':_0x3835dd['id']}})['then'](function(){return _0xe28169;});})[_0xecb8('0x13')](function(){var _0x163fdb=new Redis(config['redis']);_0x163fdb['publish'](_0xecb8('0x16'),JSON[_0xecb8('0x17')]({'id':_0xe28169['id'],'deleted':!![]}));})[_0xecb8('0x13')](function(){_0x268406[_0xecb8('0xa')](0xcc)[_0xecb8('0x18')]();});}};}function handleEntityNotFound(_0x1db35e){return function(_0x4ba59b){if(!_0x4ba59b){_0x1db35e[_0xecb8('0x19')](0x194);}return _0x4ba59b;};}function handleError(_0x55bad0,_0x35bcaa){_0x35bcaa=_0x35bcaa||0x1f4;return function(_0x1dee8c){logger[_0xecb8('0x1a')](_0x1dee8c['stack']);if(_0x1dee8c[_0xecb8('0x1b')]){delete _0x1dee8c['name'];}_0x55bad0[_0xecb8('0xa')](_0x35bcaa)['send'](_0x1dee8c);};}exports[_0xecb8('0x1c')]=function(_0x2abbd2,_0xd3f975){var _0x539d94={},_0x33f8b7={},_0x5ce6e9={'count':0x0,'rows':[]};var _0x185242=_[_0xecb8('0x1d')](db[_0xecb8('0x1e')][_0xecb8('0x1f')],function(_0x4f8524){return{'name':_0x4f8524[_0xecb8('0x20')],'type':_0x4f8524[_0xecb8('0x21')][_0xecb8('0x22')]};});_0x33f8b7[_0xecb8('0x23')]=_['map'](_0x185242,_0xecb8('0x1b'));_0x33f8b7['query']=_['keys'](_0x2abbd2[_0xecb8('0x24')]);_0x33f8b7['filters']=_['intersection'](_0x33f8b7[_0xecb8('0x23')],_0x33f8b7[_0xecb8('0x24')]);_0x539d94[_0xecb8('0x25')]=_['intersection'](_0x33f8b7[_0xecb8('0x23')],qs[_0xecb8('0x26')](_0x2abbd2[_0xecb8('0x24')][_0xecb8('0x26')]));_0x539d94[_0xecb8('0x25')]=_0x539d94[_0xecb8('0x25')][_0xecb8('0x27')]?_0x539d94[_0xecb8('0x25')]:_0x33f8b7['model'];if(!_0x2abbd2[_0xecb8('0x24')][_0xecb8('0x28')]('nolimit')){_0x539d94[_0xecb8('0xe')]=qs[_0xecb8('0xe')](_0x2abbd2[_0xecb8('0x24')][_0xecb8('0xe')]);_0x539d94['offset']=qs['offset'](_0x2abbd2[_0xecb8('0x24')][_0xecb8('0xb')]);}_0x539d94[_0xecb8('0x29')]=qs[_0xecb8('0x2a')](_0x2abbd2[_0xecb8('0x24')][_0xecb8('0x2a')]);_0x539d94['where']=qs[_0xecb8('0x2b')](_[_0xecb8('0x2c')](_0x2abbd2['query'],_0x33f8b7[_0xecb8('0x2b')]),_0x185242);if(_0x2abbd2['query']['filter']){_0x539d94[_0xecb8('0x2d')]=_[_0xecb8('0x2e')](_0x539d94['where'],{'$or':_['map'](_0x185242,function(_0x5bc6fd){if(_0x5bc6fd[_0xecb8('0x21')]!==_0xecb8('0x2f')){var _0x50607c={};_0x50607c[_0x5bc6fd[_0xecb8('0x1b')]]={'$like':'%'+_0x2abbd2['query'][_0xecb8('0x30')]+'%'};return _0x50607c;}})});}_0x539d94=_[_0xecb8('0x2e')]({},_0x539d94,_0x2abbd2[_0xecb8('0x31')]);var _0x4f9ecd={'where':_0x539d94[_0xecb8('0x2d')]};return db[_0xecb8('0x1e')][_0xecb8('0xd')](_0x4f9ecd)[_0xecb8('0x13')](function(_0x3eb675){_0x5ce6e9['count']=_0x3eb675;if(_0x2abbd2[_0xecb8('0x24')]['includeAll']){_0x539d94[_0xecb8('0x32')]=[{'all':!![]}];}return db[_0xecb8('0x1e')][_0xecb8('0x33')](_0x539d94);})[_0xecb8('0x13')](function(_0x1af4ea){_0x5ce6e9['rows']=_0x1af4ea;return _0x5ce6e9;})[_0xecb8('0x13')](respondWithFilteredResult(_0xd3f975,_0x539d94))[_0xecb8('0x34')](handleError(_0xd3f975,null));};exports['show']=function(_0x423cc7,_0x2d743c){var _0x45eb28={'raw':![],'where':{'id':_0x423cc7[_0xecb8('0x35')]['id']}},_0x36185a={};_0x36185a[_0xecb8('0x23')]=_[_0xecb8('0x36')](db[_0xecb8('0x1e')][_0xecb8('0x1f')]);_0x36185a[_0xecb8('0x24')]=_[_0xecb8('0x36')](_0x423cc7['query']);_0x36185a['filters']=_[_0xecb8('0x37')](_0x36185a['model'],_0x36185a['query']);_0x45eb28[_0xecb8('0x25')]=_['intersection'](_0x36185a[_0xecb8('0x23')],qs['fields'](_0x423cc7[_0xecb8('0x24')][_0xecb8('0x26')]));_0x45eb28[_0xecb8('0x25')]=_0x45eb28[_0xecb8('0x25')]['length']?_0x45eb28[_0xecb8('0x25')]:_0x36185a[_0xecb8('0x23')];if(_0x423cc7['query'][_0xecb8('0x38')]){_0x45eb28[_0xecb8('0x32')]=[{'all':!![]}];}_0x45eb28=_[_0xecb8('0x2e')]({},_0x45eb28,_0x423cc7[_0xecb8('0x31')]);return db['SquareProject'][_0xecb8('0x39')](_0x45eb28)[_0xecb8('0x13')](handleEntityNotFound(_0x2d743c,null))[_0xecb8('0x13')](respondWithResult(_0x2d743c,null))['catch'](handleError(_0x2d743c,null));};exports[_0xecb8('0x3a')]=function(_0x33298b,_0x3b6857){return db[_0xecb8('0x1e')][_0xecb8('0x3a')](_0x33298b[_0xecb8('0x3b')],{})['then'](function(_0x5cf716){var _0x235fea=_0x33298b[_0xecb8('0x3c')][_0xecb8('0x3d')]({'plain':!![]});if(!_0x235fea)throw new Error(_0xecb8('0x3e'));if(_0x235fea[_0xecb8('0x3f')]==='user'){var _0x260a5a=_0x5cf716[_0xecb8('0x3d')]({'plain':!![]});var _0x3d7c3c=_0xecb8('0x40');return db[_0xecb8('0x41')][_0xecb8('0x39')]({'where':{'name':_0x3d7c3c,'userProfileId':_0x235fea[_0xecb8('0x42')]},'raw':!![]})[_0xecb8('0x13')](function(_0x18ed22){if(_0x18ed22&&_0x18ed22[_0xecb8('0x43')]===0x0){return db[_0xecb8('0x15')][_0xecb8('0x3a')]({'name':_0x260a5a[_0xecb8('0x1b')],'resourceId':_0x260a5a['id'],'type':_0x18ed22[_0xecb8('0x1b')],'sectionId':_0x18ed22['id']},{})[_0xecb8('0x13')](function(){return _0x5cf716;});}else{return _0x5cf716;}})[_0xecb8('0x34')](function(_0x545944){logger[_0xecb8('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x545944);throw _0x545944;});}return _0x5cf716;})[_0xecb8('0x13')](respondWithResult(_0x3b6857,0xc9))[_0xecb8('0x34')](handleError(_0x3b6857,null));};exports[_0xecb8('0x12')]=function(_0x2f1aef,_0x2867a7){if(_0x2f1aef['body']['id']){delete _0x2f1aef[_0xecb8('0x3b')]['id'];}return db[_0xecb8('0x1e')][_0xecb8('0x39')]({'where':{'id':_0x2f1aef['params']['id']}})[_0xecb8('0x13')](handleEntityNotFound(_0x2867a7,null))[_0xecb8('0x13')](saveUpdates(_0x2f1aef['body'],null))[_0xecb8('0x13')](function(_0x42e0ef){if(!_0x42e0ef)return;var _0x2ae2a7=_0x42e0ef[_0xecb8('0x3d')]({'plain':!![]});return _0x2ae2a7;})[_0xecb8('0x13')](function(_0x4cf87d){var _0x329d73=new Redis(config[_0xecb8('0x5')]);_0x329d73[_0xecb8('0x44')]('agi',JSON['stringify'](_[_0xecb8('0x2c')](_0x4cf87d,['id','name',_0xecb8('0x45')])));return _0x4cf87d;})['then'](respondWithResult(_0x2867a7,null))[_0xecb8('0x34')](handleError(_0x2867a7,null));};exports['destroy']=function(_0x586e15,_0x2ad02e){return db[_0xecb8('0x1e')][_0xecb8('0x39')]({'where':{'id':_0x586e15[_0xecb8('0x35')]['id']}})['then'](handleEntityNotFound(_0x2ad02e,null))[_0xecb8('0x13')](removeEntity(_0x2ad02e,null))[_0xecb8('0x34')](handleError(_0x2ad02e,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 0de49d5..f660c51 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 _0x55c3=['../../mysqldb','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0xb6eb3c,_0x2b7e4c){var _0x140a2f=function(_0x2049fd){while(--_0x2049fd){_0xb6eb3c['push'](_0xb6eb3c['shift']());}};_0x140a2f(++_0x2b7e4c);}(_0x55c3,0x8f));var _0x355c=function(_0x3384d7,_0xa746d4){_0x3384d7=_0x3384d7-0x0;var _0x492c58=_0x55c3[_0x3384d7];return _0x492c58;};'use strict';var EventEmitter=require(_0x355c('0x0'));var SquareProject=require(_0x355c('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x355c('0x2')](0x0);var events={'afterCreate':_0x355c('0x3'),'afterUpdate':_0x355c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x488a22){return function(_0x30d3cf,_0x97b62d,_0x1ab918){SquareProjectEvents[_0x355c('0x5')](_0x488a22+':'+_0x30d3cf['id'],_0x30d3cf);SquareProjectEvents[_0x355c('0x5')](_0x488a22,_0x30d3cf);_0x1ab918(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x355c('0x6')](e,emitEvent(event));}}module[_0x355c('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xf68b=['emit','hasOwnProperty','events','SquareProject','setMaxListeners','save','update'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xf68b,0x1e5));var _0xbf68=function(_0x599e65,_0x104a8b){_0x599e65=_0x599e65-0x0;var _0x271f05=_0xf68b[_0x599e65];return _0x271f05;};'use strict';var EventEmitter=require(_0xbf68('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xbf68('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xbf68('0x2')](0x0);var events={'afterCreate':_0xbf68('0x3'),'afterUpdate':_0xbf68('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2abb90){return function(_0x2b6190,_0x5176c1,_0x17257e){SquareProjectEvents[_0xbf68('0x5')](_0x2abb90+':'+_0x2b6190['id'],_0x2b6190);SquareProjectEvents['emit'](_0x2abb90,_0x2b6190);_0x17257e(null);};}for(var e in events){if(events[_0xbf68('0x6')](e)){var event=events[e];SquareProject['hook'](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 381c6e8..58aee3c 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 _0x092c=['square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject'];(function(_0x4fb046,_0x35329c){var _0x1f3c93=function(_0x155757){while(--_0x155757){_0x4fb046['push'](_0x4fb046['shift']());}};_0x1f3c93(++_0x35329c);}(_0x092c,0x74));var _0xc092=function(_0x46c5da,_0x40ec83){_0x46c5da=_0x46c5da-0x0;var _0x3b4169=_0x092c[_0x46c5da];return _0x3b4169;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc092('0x0'))(_0xc092('0x1'));var moment=require('moment');var BPromise=require(_0xc092('0x2'));var rp=require(_0xc092('0x3'));var fs=require('fs');var path=require(_0xc092('0x4'));var rimraf=require(_0xc092('0x5'));var config=require(_0xc092('0x6'));var attributes=require(_0xc092('0x7'));module[_0xc092('0x8')]=function(_0x5e727d,_0x487f3c){return _0x5e727d['define'](_0xc092('0x9'),attributes,{'tableName':_0xc092('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5dbb07,_0x35fc35,_0x1c56e6){if(_0x5dbb07[_0xc092('0xb')](_0xc092('0xc'))){_0x5dbb07[_0xc092('0xd')]=moment()[_0xc092('0xe')](_0xc092('0xf'));}if(_0x5dbb07[_0xc092('0xb')](_0xc092('0x10'))){_0x5dbb07[_0xc092('0x11')]=moment()[_0xc092('0xe')](_0xc092('0xf'));}_0x1c56e6(null,_0x5dbb07);}}});}; \ No newline at end of file +var _0xec7b=['format','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt'];(function(_0x32cfcc,_0x3e5a86){var _0x25a88c=function(_0x5772c1){while(--_0x5772c1){_0x32cfcc['push'](_0x32cfcc['shift']());}};_0x25a88c(++_0x3e5a86);}(_0xec7b,0x1a5));var _0xbec7=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xec7b[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0xbec7('0x0'));var util=require(_0xbec7('0x1'));var logger=require(_0xbec7('0x2'))('api');var moment=require(_0xbec7('0x3'));var BPromise=require(_0xbec7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbec7('0x5'));var rimraf=require(_0xbec7('0x6'));var config=require(_0xbec7('0x7'));var attributes=require(_0xbec7('0x8'));module[_0xbec7('0x9')]=function(_0x43a578,_0x651019){return _0x43a578[_0xbec7('0xa')](_0xbec7('0xb'),attributes,{'tableName':_0xbec7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5bffc0,_0x194a91,_0x50ae72){if(_0x5bffc0[_0xbec7('0xd')](_0xbec7('0xe'))){_0x5bffc0[_0xbec7('0xf')]=moment()['format'](_0xbec7('0x10'));}if(_0x5bffc0['changed'](_0xbec7('0x11'))){_0x5bffc0[_0xbec7('0x12')]=moment()[_0xbec7('0x13')](_0xbec7('0x10'));}_0x50ae72(null,_0x5bffc0);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index aad13b6..e7174f7 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 _0x686a=['socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','model','map','info','debug','stringify','catch','error','message','then','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','localhost'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0x686a,0x154));var _0xa686=function(_0x2d3d0d,_0x67ac82){_0x2d3d0d=_0x2d3d0d-0x0;var _0xca35b6=_0x686a[_0x2d3d0d];return _0xca35b6;};'use strict';var _=require(_0xa686('0x0'));var Redis=require(_0xa686('0x1'));var db=require(_0xa686('0x2'))['db'];var logger=require(_0xa686('0x3'))(_0xa686('0x4'));var config=require(_0xa686('0x5'));config[_0xa686('0x6')]=_['defaults'](config[_0xa686('0x6')],{'host':_0xa686('0x7'),'port':0x18eb});var socket=require(_0xa686('0x8'))(new Redis(config[_0xa686('0x6')]));require('./squareProject.socket')[_0xa686('0x9')](socket);exports[_0xa686('0xa')]=function(_0x408450){var _0x4176c0=this;return new Promise(function(_0x3605e1,_0x43ab9f){return db[_0xa686('0xb')][_0xa686('0xc')]({'raw':_0x408450['options']?_0x408450[_0xa686('0xd')][_0xa686('0xe')]===undefined?!![]:![]:!![],'where':_0x408450[_0xa686('0xd')]?_0x408450[_0xa686('0xd')][_0xa686('0xf')]||null:null,'attributes':_0x408450['options']?_0x408450[_0xa686('0xd')][_0xa686('0x10')]||null:null,'limit':_0x408450[_0xa686('0xd')]?_0x408450[_0xa686('0xd')][_0xa686('0x11')]||null:null,'include':_0x408450[_0xa686('0xd')]?_0x408450[_0xa686('0xd')][_0xa686('0x12')]?_['map'](_0x408450[_0xa686('0xd')]['include'],function(_0x33102f){return{'model':db[_0x33102f[_0xa686('0x13')]],'as':_0x33102f['as'],'attributes':_0x33102f['attributes'],'include':_0x33102f['include']?_['map'](_0x33102f['include'],function(_0x51e9fa){return{'model':db[_0x51e9fa[_0xa686('0x13')]],'as':_0x51e9fa['as'],'attributes':_0x51e9fa[_0xa686('0x10')],'include':_0x51e9fa[_0xa686('0x12')]?_[_0xa686('0x14')](_0x51e9fa[_0xa686('0x12')],function(_0x55fe3c){return{'model':db[_0x55fe3c[_0xa686('0x13')]],'as':_0x55fe3c['as'],'attributes':_0x55fe3c[_0xa686('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd76532){logger[_0xa686('0x15')](_0xa686('0xa'),_0x408450);logger[_0xa686('0x16')](_0xa686('0xa'),_0x408450,JSON[_0xa686('0x17')](_0xd76532));_0x3605e1(_0xd76532);})[_0xa686('0x18')](function(_0x1de252){logger[_0xa686('0x19')]('GetSquareProjects',_0x1de252[_0xa686('0x1a')],_0x408450);_0x43ab9f(_0x4176c0['error'](0x1f4,_0x1de252[_0xa686('0x1a')]));});});};exports['ShowSquareProject']=function(_0x1b816f){var _0x47f815=this;return new Promise(function(_0xa7d46d,_0x34faaf){return db[_0xa686('0xb')]['find']({'raw':_0x1b816f[_0xa686('0xd')]?_0x1b816f['options'][_0xa686('0xe')]===undefined?!![]:![]:!![],'where':_0x1b816f['options']?_0x1b816f[_0xa686('0xd')]['where']||null:null,'attributes':_0x1b816f[_0xa686('0xd')]?_0x1b816f['options'][_0xa686('0x10')]||null:null,'include':_0x1b816f[_0xa686('0xd')]?_0x1b816f['options'][_0xa686('0x12')]?_[_0xa686('0x14')](_0x1b816f['options'][_0xa686('0x12')],function(_0x2721c1){return{'model':db[_0x2721c1[_0xa686('0x13')]],'as':_0x2721c1['as'],'attributes':_0x2721c1[_0xa686('0x10')],'include':_0x2721c1[_0xa686('0x12')]?_['map'](_0x2721c1['include'],function(_0x104b2c){return{'model':db[_0x104b2c[_0xa686('0x13')]],'as':_0x104b2c['as'],'attributes':_0x104b2c[_0xa686('0x10')],'include':_0x104b2c[_0xa686('0x12')]?_['map'](_0x104b2c['include'],function(_0x52c77b){return{'model':db[_0x52c77b[_0xa686('0x13')]],'as':_0x52c77b['as'],'attributes':_0x52c77b[_0xa686('0x10')]};}):[]};}):[]};}):[]:[]})[_0xa686('0x1b')](function(_0xff75ed){logger[_0xa686('0x15')]('ShowSquareProject',_0x1b816f);logger['debug'](_0xa686('0x1c'),_0x1b816f,JSON['stringify'](_0xff75ed));_0xa7d46d(_0xff75ed);})[_0xa686('0x18')](function(_0xe8a579){logger[_0xa686('0x19')](_0xa686('0x1c'),_0xe8a579[_0xa686('0x1a')],_0x1b816f);_0x34faaf(_0x47f815[_0xa686('0x19')](0x1f4,_0xe8a579[_0xa686('0x1a')]));});});}; \ No newline at end of file +var _0x03c1=['SquareProject','options','raw','attributes','limit','map','include','model','then','debug','stringify','error','message','where','ShowSquareProject','catch','lodash','ioredis','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects'];(function(_0x623e7,_0x1bef7d){var _0x121131=function(_0x59b734){while(--_0x59b734){_0x623e7['push'](_0x623e7['shift']());}};_0x121131(++_0x1bef7d);}(_0x03c1,0x13c));var _0x103c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x03c1[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x103c('0x0'));var Redis=require(_0x103c('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x103c('0x2'))('rpc');var config=require(_0x103c('0x3'));config[_0x103c('0x4')]=_['defaults'](config[_0x103c('0x4')],{'host':_0x103c('0x5'),'port':0x18eb});var socket=require(_0x103c('0x6'))(new Redis(config['redis']));require(_0x103c('0x7'))['register'](socket);exports[_0x103c('0x8')]=function(_0x11085f){var _0x469e37=this;return new Promise(function(_0x38d798,_0x164c87){return db[_0x103c('0x9')]['findAll']({'raw':_0x11085f[_0x103c('0xa')]?_0x11085f[_0x103c('0xa')][_0x103c('0xb')]===undefined?!![]:![]:!![],'where':_0x11085f[_0x103c('0xa')]?_0x11085f['options']['where']||null:null,'attributes':_0x11085f[_0x103c('0xa')]?_0x11085f[_0x103c('0xa')][_0x103c('0xc')]||null:null,'limit':_0x11085f[_0x103c('0xa')]?_0x11085f[_0x103c('0xa')][_0x103c('0xd')]||null:null,'include':_0x11085f[_0x103c('0xa')]?_0x11085f['options']['include']?_[_0x103c('0xe')](_0x11085f[_0x103c('0xa')][_0x103c('0xf')],function(_0x5dbaa5){return{'model':db[_0x5dbaa5[_0x103c('0x10')]],'as':_0x5dbaa5['as'],'attributes':_0x5dbaa5['attributes'],'include':_0x5dbaa5[_0x103c('0xf')]?_[_0x103c('0xe')](_0x5dbaa5[_0x103c('0xf')],function(_0x4d1891){return{'model':db[_0x4d1891['model']],'as':_0x4d1891['as'],'attributes':_0x4d1891[_0x103c('0xc')],'include':_0x4d1891[_0x103c('0xf')]?_[_0x103c('0xe')](_0x4d1891[_0x103c('0xf')],function(_0x8c69f6){return{'model':db[_0x8c69f6[_0x103c('0x10')]],'as':_0x8c69f6['as'],'attributes':_0x8c69f6[_0x103c('0xc')]};}):[]};}):[]};}):[]:[]})[_0x103c('0x11')](function(_0x334ddc){logger['info'](_0x103c('0x8'),_0x11085f);logger[_0x103c('0x12')](_0x103c('0x8'),_0x11085f,JSON[_0x103c('0x13')](_0x334ddc));_0x38d798(_0x334ddc);})['catch'](function(_0x12b562){logger[_0x103c('0x14')](_0x103c('0x8'),_0x12b562[_0x103c('0x15')],_0x11085f);_0x164c87(_0x469e37[_0x103c('0x14')](0x1f4,_0x12b562[_0x103c('0x15')]));});});};exports['ShowSquareProject']=function(_0x45d156){var _0x485930=this;return new Promise(function(_0x59a79c,_0x425597){return db[_0x103c('0x9')]['find']({'raw':_0x45d156[_0x103c('0xa')]?_0x45d156[_0x103c('0xa')][_0x103c('0xb')]===undefined?!![]:![]:!![],'where':_0x45d156[_0x103c('0xa')]?_0x45d156[_0x103c('0xa')][_0x103c('0x16')]||null:null,'attributes':_0x45d156[_0x103c('0xa')]?_0x45d156[_0x103c('0xa')]['attributes']||null:null,'include':_0x45d156['options']?_0x45d156[_0x103c('0xa')][_0x103c('0xf')]?_[_0x103c('0xe')](_0x45d156[_0x103c('0xa')][_0x103c('0xf')],function(_0x3b1e97){return{'model':db[_0x3b1e97[_0x103c('0x10')]],'as':_0x3b1e97['as'],'attributes':_0x3b1e97[_0x103c('0xc')],'include':_0x3b1e97[_0x103c('0xf')]?_['map'](_0x3b1e97[_0x103c('0xf')],function(_0x3650ad){return{'model':db[_0x3650ad[_0x103c('0x10')]],'as':_0x3650ad['as'],'attributes':_0x3650ad[_0x103c('0xc')],'include':_0x3650ad[_0x103c('0xf')]?_[_0x103c('0xe')](_0x3650ad['include'],function(_0x3d2146){return{'model':db[_0x3d2146[_0x103c('0x10')]],'as':_0x3d2146['as'],'attributes':_0x3d2146[_0x103c('0xc')]};}):[]};}):[]};}):[]:[]})[_0x103c('0x11')](function(_0xd4abef){logger['info'](_0x103c('0x17'),_0x45d156);logger[_0x103c('0x12')](_0x103c('0x17'),_0x45d156,JSON[_0x103c('0x13')](_0xd4abef));_0x59a79c(_0xd4abef);})[_0x103c('0x18')](function(_0x4bdf76){logger['error'](_0x103c('0x17'),_0x4bdf76['message'],_0x45d156);_0x425597(_0x485930[_0x103c('0x14')](0x1f4,_0x4bdf76[_0x103c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index aaec0d7..784e5f5 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 _0x9b2a=['update','emit','removeListener','register','length','squareProject:','./squareProject.events','save','remove'];(function(_0x49d592,_0x5c7e18){var _0x31dca6=function(_0x1354af){while(--_0x1354af){_0x49d592['push'](_0x49d592['shift']());}};_0x31dca6(++_0x5c7e18);}(_0x9b2a,0x69));var _0xa9b2=function(_0x4c0fb6,_0x222b06){_0x4c0fb6=_0x4c0fb6-0x0;var _0xbd6340=_0x9b2a[_0x4c0fb6];return _0xbd6340;};'use strict';var SquareProjectEvents=require(_0xa9b2('0x0'));var events=[_0xa9b2('0x1'),_0xa9b2('0x2'),_0xa9b2('0x3')];function createListener(_0x434647,_0x4ffee9){return function(_0x4b23e1){_0x4ffee9[_0xa9b2('0x4')](_0x434647,_0x4b23e1);};}function removeListener(_0x3f6639,_0x28f99b){return function(){SquareProjectEvents[_0xa9b2('0x5')](_0x3f6639,_0x28f99b);};}exports[_0xa9b2('0x6')]=function(_0x4f268e){for(var _0x43c3a8=0x0,_0x5eada6=events[_0xa9b2('0x7')];_0x43c3a8<_0x5eada6;_0x43c3a8++){var _0x10ef5c=events[_0x43c3a8];var _0x4c9321=createListener(_0xa9b2('0x8')+_0x10ef5c,_0x4f268e);SquareProjectEvents['on'](_0x10ef5c,_0x4c9321);}}; \ No newline at end of file +var _0xe951=['./squareProject.events','update','emit','removeListener','register','length','squareProject:'];(function(_0x47b34e,_0x4e1c61){var _0x2563da=function(_0x5e374a){while(--_0x5e374a){_0x47b34e['push'](_0x47b34e['shift']());}};_0x2563da(++_0x4e1c61);}(_0xe951,0x134));var _0x1e95=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xe951[_0x166d93];return _0xba708;};'use strict';var SquareProjectEvents=require(_0x1e95('0x0'));var events=['save','remove',_0x1e95('0x1')];function createListener(_0x27cd3e,_0x30e119){return function(_0x58f380){_0x30e119[_0x1e95('0x2')](_0x27cd3e,_0x58f380);};}function removeListener(_0x5d49e6,_0x45ff88){return function(){SquareProjectEvents[_0x1e95('0x3')](_0x5d49e6,_0x45ff88);};}exports[_0x1e95('0x4')]=function(_0x3af4c3){for(var _0x5f873c=0x0,_0x42aefc=events[_0x1e95('0x5')];_0x5f873c<_0x42aefc;_0x5f873c++){var _0x9eed1e=events[_0x5f873c];var _0x51901e=createListener(_0x1e95('0x6')+_0x9eed1e,_0x3af4c3);SquareProjectEvents['on'](_0x9eed1e,_0x51901e);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index d7a2a77..0886622 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 _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x27412b,_0x4cc0f7){var _0x5c8b27=function(_0x2ff6a4){while(--_0x2ff6a4){_0x27412b['push'](_0x27412b['shift']());}};_0x5c8b27(++_0x4cc0f7);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0x7fbe[_0x2181b1];return _0x530548;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x34045c,_0x4b6eed){var _0x206857=function(_0x307f08){while(--_0x307f08){_0x34045c['push'](_0x34045c['shift']());}};_0x206857(++_0x4b6eed);}(_0xe14b,0x93));var _0xbe14=function(_0x2b9a55,_0x4a7309){_0x2b9a55=_0x2b9a55-0x0;var _0x4629dd=_0xe14b[_0x2b9a55];return _0x4629dd;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 8e387c2..3fd156f 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 _0x032e=['VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x2bd45b,_0x117bec){var _0x519aae=function(_0x514d09){while(--_0x514d09){_0x2bd45b['push'](_0x2bd45b['shift']());}};_0x519aae(++_0x117bec);}(_0x032e,0x124));var _0xe032=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x032e[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0xe032('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe032('0x1')]},'callerid':{'type':Sequelize[_0xe032('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xe032('0x1')]},'priority':{'type':Sequelize[_0xe032('0x1')]},'accountcode':{'type':Sequelize[_0xe032('0x1')]},'dnid':{'type':Sequelize[_0xe032('0x1')]},'projectName':{'type':Sequelize[_0xe032('0x1')]},'saveName':{'type':Sequelize[_0xe032('0x1')]},'filename':{'type':Sequelize[_0xe032('0x1')]},'savePath':{'type':Sequelize[_0xe032('0x1')]},'format':{'type':Sequelize[_0xe032('0x2')],'get':function(){var _0x1576c8='';var _0x3289b0=this[_0xe032('0x3')](_0xe032('0x4'));if(_0x3289b0){_0x1576c8=_0x3289b0[_0xe032('0x5')](_0x3289b0[_0xe032('0x6')]('.'));}return _0x1576c8;}}}; \ No newline at end of file +var _0xeec6=['sequelize','exports','STRING','getDataValue','savePath','lastIndexOf'];(function(_0x32f165,_0x1e4d17){var _0x16aa86=function(_0x44a23f){while(--_0x44a23f){_0x32f165['push'](_0x32f165['shift']());}};_0x16aa86(++_0x1e4d17);}(_0xeec6,0x1c2));var _0x6eec=function(_0x455893,_0x909838){_0x455893=_0x455893-0x0;var _0x3851e8=_0xeec6[_0x455893];return _0x3851e8;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'uniqueid':{'type':Sequelize[_0x6eec('0x2')]},'callerid':{'type':Sequelize[_0x6eec('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6eec('0x2')]},'extension':{'type':Sequelize[_0x6eec('0x2')]},'priority':{'type':Sequelize[_0x6eec('0x2')]},'accountcode':{'type':Sequelize[_0x6eec('0x2')]},'dnid':{'type':Sequelize[_0x6eec('0x2')]},'projectName':{'type':Sequelize[_0x6eec('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x6eec('0x2')]},'savePath':{'type':Sequelize[_0x6eec('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x5a5e47='';var _0x1c810e=this[_0x6eec('0x3')](_0x6eec('0x4'));if(_0x1c810e){_0x5a5e47=_0x1c810e['substring'](_0x1c810e[_0x6eec('0x5')]('.'));}return _0x5a5e47;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 3f1fcaf..7566f16 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 _0xec20=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','SquareRecording','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','filename','extname','unlink','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec20,0xb5));var _0x0ec2=function(_0x4d8b1d,_0x3c42bf){_0x4d8b1d=_0x4d8b1d-0x0;var _0x467bfb=_0xec20[_0x4d8b1d];return _0x467bfb;};'use strict';var emlformat=require(_0x0ec2('0x0'));var rimraf=require(_0x0ec2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ec2('0x2'));var rp=require(_0x0ec2('0x3'));var moment=require('moment');var BPromise=require(_0x0ec2('0x4'));var Mustache=require(_0x0ec2('0x5'));var util=require(_0x0ec2('0x6'));var path=require(_0x0ec2('0x7'));var sox=require(_0x0ec2('0x8'));var csv=require(_0x0ec2('0x9'));var ejs=require(_0x0ec2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ec2('0xb'));var squel=require(_0x0ec2('0xc'));var crypto=require(_0x0ec2('0xd'));var jsforce=require(_0x0ec2('0xe'));var deskjs=require(_0x0ec2('0xf'));var toCsv=require(_0x0ec2('0x9'));var querystring=require(_0x0ec2('0x10'));var Papa=require(_0x0ec2('0x11'));var Redis=require(_0x0ec2('0x12'));var authService=require(_0x0ec2('0x13'));var qs=require(_0x0ec2('0x14'));var as=require(_0x0ec2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0ec2('0x16'));var utils=require(_0x0ec2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0ec2('0x18'));var db=require(_0x0ec2('0x19'))['db'];function respondWithStatusCode(_0x2513bf,_0x33dfe5){_0x33dfe5=_0x33dfe5||0xcc;return function(_0xc54c79){if(_0xc54c79){return _0x2513bf[_0x0ec2('0x1a')](_0x33dfe5);}return _0x2513bf['status'](_0x33dfe5)[_0x0ec2('0x1b')]();};}function respondWithResult(_0x5de80d,_0x4b9204){_0x4b9204=_0x4b9204||0xc8;return function(_0x66ce1){if(_0x66ce1){return _0x5de80d['status'](_0x4b9204)[_0x0ec2('0x1c')](_0x66ce1);}};}function respondWithFilteredResult(_0x344e4c,_0x9e7113){return function(_0x2cee99){if(_0x2cee99){var _0x10af1b=typeof _0x9e7113['offset']===_0x0ec2('0x1d')&&typeof _0x9e7113[_0x0ec2('0x1e')]===_0x0ec2('0x1d');var _0xf48c59=_0x2cee99[_0x0ec2('0x1f')];var _0x58bdf1=_0x10af1b?0x0:_0x9e7113[_0x0ec2('0x20')];var _0x3906a3=_0x10af1b?_0x2cee99[_0x0ec2('0x1f')]:_0x9e7113[_0x0ec2('0x20')]+_0x9e7113[_0x0ec2('0x1e')];var _0x15d82a;if(_0x3906a3>=_0xf48c59){_0x3906a3=_0xf48c59;_0x15d82a=0xc8;}else{_0x15d82a=0xce;}_0x344e4c['status'](_0x15d82a);return _0x344e4c[_0x0ec2('0x21')](_0x0ec2('0x22'),_0x58bdf1+'-'+_0x3906a3+'/'+_0xf48c59)[_0x0ec2('0x1c')](_0x2cee99);}return null;};}function patchUpdates(_0x536d82){return function(_0xfb88fe){try{jsonpatch[_0x0ec2('0x23')](_0xfb88fe,_0x536d82,!![]);}catch(_0x3fd375){return BPromise[_0x0ec2('0x24')](_0x3fd375);}return _0xfb88fe[_0x0ec2('0x25')]();};}function saveUpdates(_0x3cb274,_0x65ae2d){return function(_0x1e46d0){if(_0x1e46d0){return _0x1e46d0[_0x0ec2('0x26')](_0x3cb274)[_0x0ec2('0x27')](function(_0xb6962f){return _0xb6962f;});}return null;};}function removeEntity(_0x1a14b1,_0xcd5763){return function(_0x30dc2b){if(_0x30dc2b){return _0x30dc2b[_0x0ec2('0x28')]()[_0x0ec2('0x27')](function(){_0x1a14b1[_0x0ec2('0x29')](0xcc)[_0x0ec2('0x1b')]();});}};}function handleEntityNotFound(_0x31c4c1,_0x59f99d){return function(_0x5f48fa){if(!_0x5f48fa){_0x31c4c1[_0x0ec2('0x1a')](0x194);}return _0x5f48fa;};}function handleError(_0xacb0c9,_0x33e2de){_0x33e2de=_0x33e2de||0x1f4;return function(_0x2875de){logger[_0x0ec2('0x2a')](_0x2875de[_0x0ec2('0x2b')]);if(_0x2875de[_0x0ec2('0x2c')]){delete _0x2875de[_0x0ec2('0x2c')];}_0xacb0c9['status'](_0x33e2de)[_0x0ec2('0x2d')](_0x2875de);};}exports[_0x0ec2('0x2e')]=function(_0x504dde,_0x126259){var _0x4717f3={},_0x3a5130={},_0xfe514d={'count':0x0,'rows':[]};var _0x54db71=_[_0x0ec2('0x2f')](db[_0x0ec2('0x30')]['rawAttributes'],function(_0x52c6d2){return{'name':_0x52c6d2[_0x0ec2('0x31')],'type':_0x52c6d2[_0x0ec2('0x32')][_0x0ec2('0x33')]};});_0x3a5130[_0x0ec2('0x34')]=_[_0x0ec2('0x2f')](_0x54db71,_0x0ec2('0x2c'));_0x3a5130[_0x0ec2('0x35')]=_['keys'](_0x504dde[_0x0ec2('0x35')]);_0x3a5130[_0x0ec2('0x36')]=_[_0x0ec2('0x37')](_0x3a5130[_0x0ec2('0x34')],_0x3a5130['query']);_0x4717f3[_0x0ec2('0x38')]=_[_0x0ec2('0x37')](_0x3a5130[_0x0ec2('0x34')],qs[_0x0ec2('0x39')](_0x504dde[_0x0ec2('0x35')][_0x0ec2('0x39')]));_0x4717f3[_0x0ec2('0x38')]=_0x4717f3[_0x0ec2('0x38')][_0x0ec2('0x3a')]?_0x4717f3[_0x0ec2('0x38')]:_0x3a5130[_0x0ec2('0x34')];if(!_0x504dde[_0x0ec2('0x35')]['hasOwnProperty'](_0x0ec2('0x3b'))){_0x4717f3[_0x0ec2('0x1e')]=qs[_0x0ec2('0x1e')](_0x504dde[_0x0ec2('0x35')][_0x0ec2('0x1e')]);_0x4717f3[_0x0ec2('0x20')]=qs[_0x0ec2('0x20')](_0x504dde[_0x0ec2('0x35')][_0x0ec2('0x20')]);}_0x4717f3[_0x0ec2('0x3c')]=qs['sort'](_0x504dde[_0x0ec2('0x35')][_0x0ec2('0x3d')]);_0x4717f3[_0x0ec2('0x3e')]=qs[_0x0ec2('0x36')](_['pick'](_0x504dde[_0x0ec2('0x35')],_0x3a5130['filters']),_0x54db71);if(_0x504dde[_0x0ec2('0x35')][_0x0ec2('0x3f')]){_0x4717f3[_0x0ec2('0x3e')]=_[_0x0ec2('0x40')](_0x4717f3[_0x0ec2('0x3e')],{'$or':_[_0x0ec2('0x2f')](_0x54db71,function(_0x2bef78){if(_0x2bef78[_0x0ec2('0x32')]!==_0x0ec2('0x41')){var _0x18bcdc={};_0x18bcdc[_0x2bef78[_0x0ec2('0x2c')]]={'$like':'%'+_0x504dde[_0x0ec2('0x35')][_0x0ec2('0x3f')]+'%'};return _0x18bcdc;}})});}_0x4717f3=_[_0x0ec2('0x40')]({},_0x4717f3,_0x504dde[_0x0ec2('0x42')]);var _0x392673={'where':_0x4717f3[_0x0ec2('0x3e')]};return db[_0x0ec2('0x30')][_0x0ec2('0x1f')](_0x392673)[_0x0ec2('0x27')](function(_0x31e6a3){_0xfe514d['count']=_0x31e6a3;if(_0x504dde[_0x0ec2('0x35')][_0x0ec2('0x43')]){_0x4717f3[_0x0ec2('0x44')]=[{'all':!![]}];}return db[_0x0ec2('0x30')][_0x0ec2('0x45')](_0x4717f3);})[_0x0ec2('0x27')](function(_0x26ed57){_0xfe514d['rows']=_0x26ed57;return _0xfe514d;})[_0x0ec2('0x27')](respondWithFilteredResult(_0x126259,_0x4717f3))[_0x0ec2('0x46')](handleError(_0x126259,null));};exports[_0x0ec2('0x47')]=function(_0x47111d,_0x37386b){var _0x3f925e={'raw':!![],'where':{'id':_0x47111d[_0x0ec2('0x48')]['id']}},_0x374727={};_0x374727[_0x0ec2('0x34')]=_[_0x0ec2('0x49')](db['SquareRecording'][_0x0ec2('0x4a')]);_0x374727['query']=_['keys'](_0x47111d['query']);_0x374727[_0x0ec2('0x36')]=_['intersection'](_0x374727[_0x0ec2('0x34')],_0x374727['query']);_0x3f925e['attributes']=_[_0x0ec2('0x37')](_0x374727['model'],qs[_0x0ec2('0x39')](_0x47111d['query']['fields']));_0x3f925e[_0x0ec2('0x38')]=_0x3f925e[_0x0ec2('0x38')][_0x0ec2('0x3a')]?_0x3f925e[_0x0ec2('0x38')]:_0x374727[_0x0ec2('0x34')];if(_0x47111d['query'][_0x0ec2('0x43')]){_0x3f925e[_0x0ec2('0x44')]=[{'all':!![]}];}_0x3f925e=_['merge']({},_0x3f925e,_0x47111d[_0x0ec2('0x42')]);return db[_0x0ec2('0x30')][_0x0ec2('0x4b')](_0x3f925e)[_0x0ec2('0x27')](handleEntityNotFound(_0x37386b,null))[_0x0ec2('0x27')](respondWithResult(_0x37386b,null))['catch'](handleError(_0x37386b,null));};exports[_0x0ec2('0x4c')]=function(_0x6bed50,_0x41758c){return db['SquareRecording'][_0x0ec2('0x4c')](_0x6bed50[_0x0ec2('0x4d')],{})[_0x0ec2('0x27')](respondWithResult(_0x41758c,0xc9))[_0x0ec2('0x46')](handleError(_0x41758c,null));};exports[_0x0ec2('0x26')]=function(_0x10d4ef,_0x59f39c){if(_0x10d4ef['body']['id']){delete _0x10d4ef['body']['id'];}return db[_0x0ec2('0x30')][_0x0ec2('0x4b')]({'where':{'id':_0x10d4ef[_0x0ec2('0x48')]['id']}})[_0x0ec2('0x27')](handleEntityNotFound(_0x59f39c,null))[_0x0ec2('0x27')](saveUpdates(_0x10d4ef[_0x0ec2('0x4d')],null))[_0x0ec2('0x27')](respondWithResult(_0x59f39c,null))['catch'](handleError(_0x59f39c,null));};exports[_0x0ec2('0x4e')]=function(_0x3ceedf,_0x3445df,_0x1018b1){var _0x28972c=require(_0x0ec2('0x4f'));var _0x3c1ed0=![];var _0x215d7c={};if(_0x3ceedf['query'][_0x0ec2('0x32')]&&_0x3ceedf[_0x0ec2('0x35')][_0x0ec2('0x32')]===_0x0ec2('0x50')){_0x215d7c['uniqueid']=_0x3ceedf[_0x0ec2('0x48')]['id'];}else{_0x215d7c['id']=_0x3ceedf[_0x0ec2('0x48')]['id'];}return db[_0x0ec2('0x30')][_0x0ec2('0x4b')]({'where':_0x215d7c,'attributes':['id',_0x0ec2('0x51'),'filename'],'raw':!![]})[_0x0ec2('0x27')](handleEntityNotFound(_0x3445df,null))[_0x0ec2('0x27')](function(_0x9d26ba){if(_0x9d26ba){var _0x4e387a=_0x9d26ba[_0x0ec2('0x51')];var _0x51f41f=util[_0x0ec2('0x52')](_0x0ec2('0x53'),_0x4e387a);if(fs['existsSync'](_0x51f41f)){_0x3c1ed0=!![];return _0x28972c[_0x0ec2('0x54')](_0x51f41f,_0x4e387a,config[_0x0ec2('0x55')][_0x0ec2('0x56')])['then'](function(){return _0x9d26ba;});}return _0x9d26ba;}})[_0x0ec2('0x27')](function(_0x86a36f){if(_0x86a36f){var _0xa84898=_0x86a36f[_0x0ec2('0x51')];if(!fs[_0x0ec2('0x57')](_0xa84898)){throw new db['Sequelize']['ValidationError']('SquareRecording\x20not\x20found');}if(_0x86a36f['filename']){return _0x3445df[_0x0ec2('0x4e')](_0xa84898,_0x86a36f[_0x0ec2('0x58')]+path[_0x0ec2('0x59')](_0xa84898),function(){if(_0x3c1ed0){fs[_0x0ec2('0x5a')](_0xa84898);}});}else{return _0x3445df[_0x0ec2('0x4e')](_0xa84898,function(_0x4d4364){if(_0x3c1ed0){fs[_0x0ec2('0x5a')](_0xa84898);}});}}})[_0x0ec2('0x46')](function(_0x1ae58a){if(_0x1ae58a['message']===_0x0ec2('0x5b')){_0x3445df[_0x0ec2('0x29')](0x194)[_0x0ec2('0x2d')](_0x0ec2('0x5c'));}else{return handleError(_0x3445df,null);}});};exports[_0x0ec2('0x28')]=function(_0x3f92b5,_0x129eff){return db[_0x0ec2('0x30')][_0x0ec2('0x4b')]({'where':{'id':_0x3f92b5['params']['id']}})[_0x0ec2('0x27')](function(_0x6ae248){if(_[_0x0ec2('0x5d')](_0x6ae248)){throw new ReferenceError(_0x0ec2('0x5e'));}return _0x6ae248;})['then'](function(_0x3f51a5){var _0x4f21b6=_0x3f51a5[_0x0ec2('0x51')];logger[_0x0ec2('0x5f')](_0x0ec2('0x60'),_0x4f21b6);if(!_[_0x0ec2('0x5d')](_0x3f51a5[_0x0ec2('0x51')])&&fs[_0x0ec2('0x57')](_0x4f21b6)){logger[_0x0ec2('0x5f')](_0x0ec2('0x61')+_0x4f21b6+_0x0ec2('0x62'));fs[_0x0ec2('0x63')](_0x4f21b6);}_0x4f21b6=_0x4f21b6+'.cypher';if(!_[_0x0ec2('0x5d')](_0x3f51a5['savePath'])&&fs[_0x0ec2('0x57')](_0x4f21b6)){logger[_0x0ec2('0x5f')](_0x0ec2('0x61')+_0x4f21b6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0ec2('0x63')](_0x4f21b6);}return _0x3f51a5;})[_0x0ec2('0x27')](function(_0x25866c){if(!_0x25866c)throw new InternalError();return _0x25866c[_0x0ec2('0x28')]();})[_0x0ec2('0x27')](function(){_0x129eff[_0x0ec2('0x29')](0xcc)['end']();})[_0x0ec2('0x46')](handleError(_0x129eff,null));}; \ No newline at end of file +var _0x9630=['savePath','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','count','offset','limit','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','SquareRecording','include','findAll','rows','catch','keys','includeAll','find','create','body','download','../../components/encryptor','params','format','%s.cypher','existsSync','decryptFile','secrets','recording'];(function(_0x100d97,_0x313de1){var _0x53135b=function(_0x1c71de){while(--_0x1c71de){_0x100d97['push'](_0x100d97['shift']());}};_0x53135b(++_0x313de1);}(_0x9630,0x1d7));var _0x0963=function(_0x422181,_0x418762){_0x422181=_0x422181-0x0;var _0x89c999=_0x9630[_0x422181];return _0x89c999;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0963('0x0'));var zipdir=require(_0x0963('0x1'));var jsonpatch=require(_0x0963('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0963('0x3'));var Mustache=require(_0x0963('0x4'));var util=require(_0x0963('0x5'));var path=require(_0x0963('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0963('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0963('0x8'));var jsforce=require(_0x0963('0x9'));var deskjs=require(_0x0963('0xa'));var toCsv=require(_0x0963('0xb'));var querystring=require(_0x0963('0xc'));var Papa=require(_0x0963('0xd'));var Redis=require('ioredis');var authService=require(_0x0963('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0963('0xf'));var hardwareService=require(_0x0963('0x10'));var logger=require('../../config/logger')(_0x0963('0x11'));var utils=require(_0x0963('0x12'));var config=require(_0x0963('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0963('0x14'))['db'];function respondWithStatusCode(_0x3f95cc,_0x5e2edb){_0x5e2edb=_0x5e2edb||0xcc;return function(_0x4750ef){if(_0x4750ef){return _0x3f95cc['sendStatus'](_0x5e2edb);}return _0x3f95cc[_0x0963('0x15')](_0x5e2edb)[_0x0963('0x16')]();};}function respondWithResult(_0x144e2f,_0x405c16){_0x405c16=_0x405c16||0xc8;return function(_0x49f2f0){if(_0x49f2f0){return _0x144e2f[_0x0963('0x15')](_0x405c16)[_0x0963('0x17')](_0x49f2f0);}};}function respondWithFilteredResult(_0x29b2f6,_0x2eb4bd){return function(_0x3b1b67){if(_0x3b1b67){var _0x58bc22=typeof _0x2eb4bd['offset']===_0x0963('0x18')&&typeof _0x2eb4bd['limit']===_0x0963('0x18');var _0x3cf237=_0x3b1b67[_0x0963('0x19')];var _0x5e3d57=_0x58bc22?0x0:_0x2eb4bd[_0x0963('0x1a')];var _0x2742fb=_0x58bc22?_0x3b1b67[_0x0963('0x19')]:_0x2eb4bd[_0x0963('0x1a')]+_0x2eb4bd[_0x0963('0x1b')];var _0xb2a3bd;if(_0x2742fb>=_0x3cf237){_0x2742fb=_0x3cf237;_0xb2a3bd=0xc8;}else{_0xb2a3bd=0xce;}_0x29b2f6[_0x0963('0x15')](_0xb2a3bd);return _0x29b2f6[_0x0963('0x1c')]('Content-Range',_0x5e3d57+'-'+_0x2742fb+'/'+_0x3cf237)[_0x0963('0x17')](_0x3b1b67);}return null;};}function patchUpdates(_0x161507){return function(_0x429ae6){try{jsonpatch[_0x0963('0x1d')](_0x429ae6,_0x161507,!![]);}catch(_0x4b3c30){return BPromise['reject'](_0x4b3c30);}return _0x429ae6[_0x0963('0x1e')]();};}function saveUpdates(_0x140226,_0x5c0e24){return function(_0x27bc6c){if(_0x27bc6c){return _0x27bc6c[_0x0963('0x1f')](_0x140226)[_0x0963('0x20')](function(_0xa683dd){return _0xa683dd;});}return null;};}function removeEntity(_0x3a893b,_0xb155d4){return function(_0x155354){if(_0x155354){return _0x155354[_0x0963('0x21')]()['then'](function(){_0x3a893b[_0x0963('0x15')](0xcc)[_0x0963('0x16')]();});}};}function handleEntityNotFound(_0x490deb,_0x40d31f){return function(_0x4f138f){if(!_0x4f138f){_0x490deb[_0x0963('0x22')](0x194);}return _0x4f138f;};}function handleError(_0x19fe63,_0x48ce3c){_0x48ce3c=_0x48ce3c||0x1f4;return function(_0x4fb9d6){logger[_0x0963('0x23')](_0x4fb9d6[_0x0963('0x24')]);if(_0x4fb9d6[_0x0963('0x25')]){delete _0x4fb9d6[_0x0963('0x25')];}_0x19fe63[_0x0963('0x15')](_0x48ce3c)[_0x0963('0x26')](_0x4fb9d6);};}exports['index']=function(_0x2ebb59,_0x455f80){var _0x5318e8={},_0x37c105={},_0x38c6ae={'count':0x0,'rows':[]};var _0x600b29=_[_0x0963('0x27')](db['SquareRecording'][_0x0963('0x28')],function(_0xefc95e){return{'name':_0xefc95e['fieldName'],'type':_0xefc95e[_0x0963('0x29')][_0x0963('0x2a')]};});_0x37c105['model']=_[_0x0963('0x27')](_0x600b29,_0x0963('0x25'));_0x37c105[_0x0963('0x2b')]=_['keys'](_0x2ebb59[_0x0963('0x2b')]);_0x37c105[_0x0963('0x2c')]=_['intersection'](_0x37c105[_0x0963('0x2d')],_0x37c105['query']);_0x5318e8[_0x0963('0x2e')]=_[_0x0963('0x2f')](_0x37c105['model'],qs[_0x0963('0x30')](_0x2ebb59['query'][_0x0963('0x30')]));_0x5318e8['attributes']=_0x5318e8['attributes'][_0x0963('0x31')]?_0x5318e8[_0x0963('0x2e')]:_0x37c105[_0x0963('0x2d')];if(!_0x2ebb59['query'][_0x0963('0x32')](_0x0963('0x33'))){_0x5318e8[_0x0963('0x1b')]=qs[_0x0963('0x1b')](_0x2ebb59[_0x0963('0x2b')]['limit']);_0x5318e8['offset']=qs['offset'](_0x2ebb59['query'][_0x0963('0x1a')]);}_0x5318e8[_0x0963('0x34')]=qs[_0x0963('0x35')](_0x2ebb59['query']['sort']);_0x5318e8[_0x0963('0x36')]=qs[_0x0963('0x2c')](_['pick'](_0x2ebb59['query'],_0x37c105['filters']),_0x600b29);if(_0x2ebb59[_0x0963('0x2b')]['filter']){_0x5318e8[_0x0963('0x36')]=_[_0x0963('0x37')](_0x5318e8[_0x0963('0x36')],{'$or':_[_0x0963('0x27')](_0x600b29,function(_0x34115e){if(_0x34115e[_0x0963('0x29')]!=='VIRTUAL'){var _0x3f3986={};_0x3f3986[_0x34115e[_0x0963('0x25')]]={'$like':'%'+_0x2ebb59['query']['filter']+'%'};return _0x3f3986;}})});}_0x5318e8=_[_0x0963('0x37')]({},_0x5318e8,_0x2ebb59['options']);var _0x180232={'where':_0x5318e8['where']};return db[_0x0963('0x38')]['count'](_0x180232)[_0x0963('0x20')](function(_0x102bfd){_0x38c6ae['count']=_0x102bfd;if(_0x2ebb59[_0x0963('0x2b')]['includeAll']){_0x5318e8[_0x0963('0x39')]=[{'all':!![]}];}return db['SquareRecording'][_0x0963('0x3a')](_0x5318e8);})[_0x0963('0x20')](function(_0x3d8181){_0x38c6ae[_0x0963('0x3b')]=_0x3d8181;return _0x38c6ae;})['then'](respondWithFilteredResult(_0x455f80,_0x5318e8))[_0x0963('0x3c')](handleError(_0x455f80,null));};exports['show']=function(_0xf39e39,_0x588cb7){var _0x335314={'raw':!![],'where':{'id':_0xf39e39['params']['id']}},_0x38b548={};_0x38b548[_0x0963('0x2d')]=_[_0x0963('0x3d')](db[_0x0963('0x38')][_0x0963('0x28')]);_0x38b548['query']=_[_0x0963('0x3d')](_0xf39e39['query']);_0x38b548['filters']=_['intersection'](_0x38b548[_0x0963('0x2d')],_0x38b548['query']);_0x335314[_0x0963('0x2e')]=_[_0x0963('0x2f')](_0x38b548['model'],qs['fields'](_0xf39e39[_0x0963('0x2b')][_0x0963('0x30')]));_0x335314[_0x0963('0x2e')]=_0x335314[_0x0963('0x2e')][_0x0963('0x31')]?_0x335314['attributes']:_0x38b548[_0x0963('0x2d')];if(_0xf39e39[_0x0963('0x2b')][_0x0963('0x3e')]){_0x335314[_0x0963('0x39')]=[{'all':!![]}];}_0x335314=_[_0x0963('0x37')]({},_0x335314,_0xf39e39['options']);return db[_0x0963('0x38')][_0x0963('0x3f')](_0x335314)['then'](handleEntityNotFound(_0x588cb7,null))[_0x0963('0x20')](respondWithResult(_0x588cb7,null))[_0x0963('0x3c')](handleError(_0x588cb7,null));};exports[_0x0963('0x40')]=function(_0x5be39e,_0x48b739){return db[_0x0963('0x38')][_0x0963('0x40')](_0x5be39e['body'],{})[_0x0963('0x20')](respondWithResult(_0x48b739,0xc9))['catch'](handleError(_0x48b739,null));};exports[_0x0963('0x1f')]=function(_0x4c9b81,_0x6e61f0){if(_0x4c9b81[_0x0963('0x41')]['id']){delete _0x4c9b81[_0x0963('0x41')]['id'];}return db[_0x0963('0x38')]['find']({'where':{'id':_0x4c9b81['params']['id']}})['then'](handleEntityNotFound(_0x6e61f0,null))['then'](saveUpdates(_0x4c9b81[_0x0963('0x41')],null))['then'](respondWithResult(_0x6e61f0,null))['catch'](handleError(_0x6e61f0,null));};exports[_0x0963('0x42')]=function(_0x110a78,_0x3fbed1,_0x359154){var _0x4e1acc=require(_0x0963('0x43'));var _0x472e4a=![];var _0x466ba1={};if(_0x110a78[_0x0963('0x2b')][_0x0963('0x29')]&&_0x110a78[_0x0963('0x2b')][_0x0963('0x29')]==='uniqueid'){_0x466ba1['uniqueid']=_0x110a78['params']['id'];}else{_0x466ba1['id']=_0x110a78[_0x0963('0x44')]['id'];}return db[_0x0963('0x38')][_0x0963('0x3f')]({'where':_0x466ba1,'attributes':['id','savePath','filename'],'raw':!![]})[_0x0963('0x20')](handleEntityNotFound(_0x3fbed1,null))[_0x0963('0x20')](function(_0x41b00d){if(_0x41b00d){var _0x52b398=_0x41b00d['savePath'];var _0x5b2487=util[_0x0963('0x45')](_0x0963('0x46'),_0x52b398);if(fs[_0x0963('0x47')](_0x5b2487)){_0x472e4a=!![];return _0x4e1acc[_0x0963('0x48')](_0x5b2487,_0x52b398,config[_0x0963('0x49')][_0x0963('0x4a')])[_0x0963('0x20')](function(){return _0x41b00d;});}return _0x41b00d;}})[_0x0963('0x20')](function(_0x199b81){if(_0x199b81){var _0x47f596=_0x199b81[_0x0963('0x4b')];if(!fs[_0x0963('0x47')](_0x47f596)){throw new db[(_0x0963('0x4c'))][(_0x0963('0x4d'))](_0x0963('0x4e'));}if(_0x199b81[_0x0963('0x4f')]){return _0x3fbed1[_0x0963('0x42')](_0x47f596,_0x199b81['filename']+path[_0x0963('0x50')](_0x47f596),function(){if(_0x472e4a){fs[_0x0963('0x51')](_0x47f596);}});}else{return _0x3fbed1[_0x0963('0x42')](_0x47f596,function(_0x58bf53){if(_0x472e4a){fs[_0x0963('0x51')](_0x47f596);}});}}})[_0x0963('0x3c')](function(_0x7a2a98){if(_0x7a2a98[_0x0963('0x52')]===_0x0963('0x4e')){_0x3fbed1[_0x0963('0x15')](0x194)['send'](_0x0963('0x53'));}else{return handleError(_0x3fbed1,null);}});};exports['destroy']=function(_0x21fc64,_0x13108f){return db['SquareRecording'][_0x0963('0x3f')]({'where':{'id':_0x21fc64[_0x0963('0x44')]['id']}})[_0x0963('0x20')](function(_0x24a9ef){if(_[_0x0963('0x54')](_0x24a9ef)){throw new ReferenceError(_0x0963('0x55'));}return _0x24a9ef;})[_0x0963('0x20')](function(_0xb7cb4e){var _0x24bf88=_0xb7cb4e[_0x0963('0x4b')];logger[_0x0963('0x56')](_0x0963('0x57'),_0x24bf88);if(!_[_0x0963('0x54')](_0xb7cb4e['savePath'])&&fs['existsSync'](_0x24bf88)){logger['info'](_0x0963('0x58')+_0x24bf88+_0x0963('0x59'));fs[_0x0963('0x5a')](_0x24bf88);}_0x24bf88=_0x24bf88+'.cypher';if(!_['isNil'](_0xb7cb4e['savePath'])&&fs['existsSync'](_0x24bf88)){logger[_0x0963('0x56')](_0x0963('0x58')+_0x24bf88+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0963('0x5a')](_0x24bf88);}return _0xb7cb4e;})[_0x0963('0x20')](function(_0xa635fc){if(!_0xa635fc)throw new InternalError();return _0xa635fc[_0x0963('0x21')]();})[_0x0963('0x20')](function(){_0x13108f[_0x0963('0x15')](0xcc)[_0x0963('0x16')]();})['catch'](handleError(_0x13108f,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index a2a88c9..38d0368 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 _0x9b09=['util','api','moment','request-promise','rimraf','./squareRecording.attributes','exports','define','square_recordings','lodash'];(function(_0x1a4aea,_0x24fc64){var _0x24a48a=function(_0x286d5a){while(--_0x286d5a){_0x1a4aea['push'](_0x1a4aea['shift']());}};_0x24a48a(++_0x24fc64);}(_0x9b09,0x1ad));var _0x99b0=function(_0x25f797,_0x449916){_0x25f797=_0x25f797-0x0;var _0x157fdd=_0x9b09[_0x25f797];return _0x157fdd;};'use strict';var _=require(_0x99b0('0x0'));var util=require(_0x99b0('0x1'));var logger=require('../../config/logger')(_0x99b0('0x2'));var moment=require(_0x99b0('0x3'));var BPromise=require('bluebird');var rp=require(_0x99b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x99b0('0x5'));var config=require('../../config/environment');var attributes=require(_0x99b0('0x6'));module[_0x99b0('0x7')]=function(_0x498180,_0x466c23){return _0x498180[_0x99b0('0x8')]('SquareRecording',attributes,{'tableName':_0x99b0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68b3=['exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0x68b3,0x1d8));var _0x368b=function(_0x723dce,_0x245f2e){_0x723dce=_0x723dce-0x0;var _0xe5464c=_0x68b3[_0x723dce];return _0xe5464c;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var logger=require(_0x368b('0x2'))(_0x368b('0x3'));var moment=require(_0x368b('0x4'));var BPromise=require('bluebird');var rp=require(_0x368b('0x5'));var fs=require('fs');var path=require(_0x368b('0x6'));var rimraf=require(_0x368b('0x7'));var config=require(_0x368b('0x8'));var attributes=require('./squareRecording.attributes');module[_0x368b('0x9')]=function(_0x41b15b,_0x104dad){return _0x41b15b[_0x368b('0xa')](_0x368b('0xb'),attributes,{'tableName':_0x368b('0xc'),'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 0d318a6..db6ff09 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 _0x5628=['request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','SquareRecording','create','body','options','raw','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','client','http','request','info','SquareRecording,\x20%s,\x20%s'];(function(_0x33f30a,_0x243d8d){var _0x422d3d=function(_0x22b717){while(--_0x22b717){_0x33f30a['push'](_0x33f30a['shift']());}};_0x422d3d(++_0x243d8d);}(_0x5628,0xc5));var _0x8562=function(_0x3475f3,_0x534e11){_0x3475f3=_0x3475f3-0x0;var _0x21c52e=_0x5628[_0x3475f3];return _0x21c52e;};'use strict';var _=require(_0x8562('0x0'));var util=require('util');var moment=require(_0x8562('0x1'));var BPromise=require(_0x8562('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8562('0x3'));var db=require(_0x8562('0x4'))['db'];var utils=require(_0x8562('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8562('0x6')][_0x8562('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4b7083,_0x614f2f,_0x561e0d){return new BPromise(function(_0x44b8b4,_0x22ae18){return client[_0x8562('0x8')](_0x4b7083,_0x561e0d)['then'](function(_0x4e871c){logger[_0x8562('0x9')](_0x8562('0xa'),_0x614f2f,_0x8562('0xb'));logger[_0x8562('0xc')](_0x8562('0xd'),_0x614f2f,_0x8562('0xb'),JSON[_0x8562('0xe')](_0x4e871c));if(_0x4e871c[_0x8562('0xf')]){if(_0x4e871c[_0x8562('0xf')][_0x8562('0x10')]===0x1f4){logger[_0x8562('0xf')](_0x8562('0xa'),_0x614f2f,_0x4e871c['error'][_0x8562('0x11')]);return _0x22ae18(_0x4e871c[_0x8562('0xf')][_0x8562('0x11')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x614f2f,_0x4e871c[_0x8562('0xf')][_0x8562('0x11')]);return _0x44b8b4(_0x4e871c[_0x8562('0xf')][_0x8562('0x11')]);}else{logger[_0x8562('0x9')](_0x8562('0xa'),_0x614f2f,_0x8562('0xb'));_0x44b8b4(_0x4e871c[_0x8562('0x12')][_0x8562('0x11')]);}})['catch'](function(_0x1f66a6){logger[_0x8562('0xf')]('SquareRecording,\x20%s,\x20%s',_0x614f2f,_0x1f66a6);_0x22ae18(_0x1f66a6);});});}exports[_0x8562('0x13')]=function(_0x364838){var _0x1d559d=this;return new Promise(function(_0x13a98e,_0x52aa07){return db[_0x8562('0x14')][_0x8562('0x15')](_0x364838[_0x8562('0x16')],{'raw':_0x364838[_0x8562('0x17')]?_0x364838[_0x8562('0x17')][_0x8562('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2fa3e2){logger['info'](_0x8562('0x13'),_0x364838);logger['debug']('CreateSquareRecording',_0x364838,JSON[_0x8562('0xe')](_0x2fa3e2));_0x13a98e(_0x2fa3e2);})[_0x8562('0x19')](function(_0x377ad4){logger['error'](_0x8562('0x13'),_0x377ad4[_0x8562('0x11')],_0x364838);_0x52aa07(_0x1d559d[_0x8562('0xf')](0x1f4,_0x377ad4[_0x8562('0x11')]));});});}; \ No newline at end of file +var _0xf79e=['SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x385467,_0x298239){var _0x5ed67e=function(_0x4b252c){while(--_0x4b252c){_0x385467['push'](_0x385467['shift']());}};_0x5ed67e(++_0x298239);}(_0xf79e,0x16b));var _0xef79=function(_0x5cac54,_0x431445){_0x5cac54=_0x5cac54-0x0;var _0x399d30=_0xf79e[_0x5cac54];return _0x399d30;};'use strict';var _=require(_0xef79('0x0'));var util=require('util');var moment=require(_0xef79('0x1'));var BPromise=require(_0xef79('0x2'));var rs=require(_0xef79('0x3'));var fs=require('fs');var Redis=require(_0xef79('0x4'));var db=require(_0xef79('0x5'))['db'];var utils=require(_0xef79('0x6'));var logger=require(_0xef79('0x7'))(_0xef79('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xef79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ac264,_0x5cbdc8,_0x462462){return new BPromise(function(_0x4708c4,_0x146939){return client['request'](_0x5ac264,_0x462462)[_0xef79('0xa')](function(_0x5760ac){logger[_0xef79('0xb')](_0xef79('0xc'),_0x5cbdc8,_0xef79('0xd'));logger[_0xef79('0xe')](_0xef79('0xf'),_0x5cbdc8,'request\x20sent',JSON[_0xef79('0x10')](_0x5760ac));if(_0x5760ac[_0xef79('0x11')]){if(_0x5760ac['error'][_0xef79('0x12')]===0x1f4){logger[_0xef79('0x11')](_0xef79('0xc'),_0x5cbdc8,_0x5760ac[_0xef79('0x11')][_0xef79('0x13')]);return _0x146939(_0x5760ac['error'][_0xef79('0x13')]);}logger[_0xef79('0x11')](_0xef79('0xc'),_0x5cbdc8,_0x5760ac['error']['message']);return _0x4708c4(_0x5760ac[_0xef79('0x11')][_0xef79('0x13')]);}else{logger[_0xef79('0xb')](_0xef79('0xc'),_0x5cbdc8,_0xef79('0xd'));_0x4708c4(_0x5760ac['result'][_0xef79('0x13')]);}})[_0xef79('0x14')](function(_0x1e35a4){logger['error'](_0xef79('0xc'),_0x5cbdc8,_0x1e35a4);_0x146939(_0x1e35a4);});});}exports[_0xef79('0x15')]=function(_0x2a4d5a){var _0x5f5798=this;return new Promise(function(_0x1b9e4c,_0x58e267){return db[_0xef79('0x16')][_0xef79('0x17')](_0x2a4d5a[_0xef79('0x18')],{'raw':_0x2a4d5a['options']?_0x2a4d5a[_0xef79('0x19')][_0xef79('0x1a')]===undefined?!![]:![]:!![]})[_0xef79('0xa')](function(_0x292c7e){logger[_0xef79('0xb')](_0xef79('0x15'),_0x2a4d5a);logger[_0xef79('0xe')](_0xef79('0x15'),_0x2a4d5a,JSON[_0xef79('0x10')](_0x292c7e));_0x1b9e4c(_0x292c7e);})[_0xef79('0x14')](function(_0xe3cf47){logger['error'](_0xef79('0x15'),_0xe3cf47[_0xef79('0x13')],_0x2a4d5a);_0x58e267(_0x5f5798[_0xef79('0x11')](0x1f4,_0xe3cf47['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 744ce12..0978b78 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(_0x1bde77,_0x470905){var _0x44e5e1=function(_0x216043){while(--_0x216043){_0x1bde77['push'](_0x1bde77['shift']());}};_0x44e5e1(++_0x470905);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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(_0x629cde,_0x1ee493){var _0x178f77=function(_0x4c075d){while(--_0x4c075d){_0x629cde['push'](_0x629cde['shift']());}};_0x178f77(++_0x1ee493);}(_0xe706,0xa3));var _0x6e70=function(_0x390752,_0x42cad3){_0x390752=_0x390752-0x0;var _0x5eca55=_0xe706[_0x390752];return _0x5eca55;};'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 20782ce..15012a2 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 _0x0efc=['DATE','BOOLEAN','exports','STRING'];(function(_0x23c801,_0x4ebd81){var _0x3baf14=function(_0x5a749f){while(--_0x5a749f){_0x23c801['push'](_0x23c801['shift']());}};_0x3baf14(++_0x4ebd81);}(_0x0efc,0x1ee));var _0xc0ef=function(_0x1f8a2a,_0x906b0f){_0x1f8a2a=_0x1f8a2a-0x0;var _0x4dcaa7=_0x0efc[_0x1f8a2a];return _0x4dcaa7;};'use strict';var Sequelize=require('sequelize');module[_0xc0ef('0x0')]={'network':{'type':Sequelize[_0xc0ef('0x1')]},'network_script':{'type':Sequelize[_0xc0ef('0x1')]},'request':{'type':Sequelize[_0xc0ef('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc0ef('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xc0ef('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xc0ef('0x1')]},'dnid':{'type':Sequelize[_0xc0ef('0x1')]},'rdnis':{'type':Sequelize[_0xc0ef('0x1')]},'context':{'type':Sequelize[_0xc0ef('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc0ef('0x1')]},'enhanced':{'type':Sequelize[_0xc0ef('0x1')]},'accountcode':{'type':Sequelize[_0xc0ef('0x1')]},'threadid':{'type':Sequelize[_0xc0ef('0x1')]},'project_name':{'type':Sequelize[_0xc0ef('0x1')]},'joinAt':{'type':Sequelize[_0xc0ef('0x2')]},'leaveAt':{'type':Sequelize[_0xc0ef('0x2')]},'bot':{'type':Sequelize[_0xc0ef('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa2b8=['sequelize','STRING','DATE'];(function(_0x36fcf6,_0x512d47){var _0x20c794=function(_0x427b9f){while(--_0x427b9f){_0x36fcf6['push'](_0x36fcf6['shift']());}};_0x20c794(++_0x512d47);}(_0xa2b8,0x14d));var _0x8a2b=function(_0x39f5be,_0x20fe17){_0x39f5be=_0x39f5be-0x0;var _0x6f3d7e=_0xa2b8[_0x39f5be];return _0x6f3d7e;};'use strict';var Sequelize=require(_0x8a2b('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x8a2b('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8a2b('0x1')]},'language':{'type':Sequelize[_0x8a2b('0x1')]},'type':{'type':Sequelize[_0x8a2b('0x1')]},'uniqueid':{'type':Sequelize[_0x8a2b('0x1')]},'version':{'type':Sequelize[_0x8a2b('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8a2b('0x1')]},'callingpres':{'type':Sequelize[_0x8a2b('0x1')]},'callingani2':{'type':Sequelize[_0x8a2b('0x1')]},'callington':{'type':Sequelize[_0x8a2b('0x1')]},'callingtns':{'type':Sequelize[_0x8a2b('0x1')]},'dnid':{'type':Sequelize[_0x8a2b('0x1')]},'rdnis':{'type':Sequelize[_0x8a2b('0x1')]},'context':{'type':Sequelize[_0x8a2b('0x1')]},'extension':{'type':Sequelize[_0x8a2b('0x1')]},'priority':{'type':Sequelize[_0x8a2b('0x1')]},'enhanced':{'type':Sequelize[_0x8a2b('0x1')]},'accountcode':{'type':Sequelize[_0x8a2b('0x1')]},'threadid':{'type':Sequelize[_0x8a2b('0x1')]},'project_name':{'type':Sequelize[_0x8a2b('0x1')]},'joinAt':{'type':Sequelize[_0x8a2b('0x2')]},'leaveAt':{'type':Sequelize[_0x8a2b('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 82d29c8..b9dfba3 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 _0xf69b=['rimraf','zip-dir','fast-json-patch','request-promise','moment','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','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SquareReport','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','eml-format'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0xf69b,0x185));var _0xbf69=function(_0x3c9b67,_0x1b021e){_0x3c9b67=_0x3c9b67-0x0;var _0x565d95=_0xf69b[_0x3c9b67];return _0x565d95;};'use strict';var emlformat=require(_0xbf69('0x0'));var rimraf=require(_0xbf69('0x1'));var zipdir=require(_0xbf69('0x2'));var jsonpatch=require(_0xbf69('0x3'));var rp=require(_0xbf69('0x4'));var moment=require(_0xbf69('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbf69('0x6'));var util=require(_0xbf69('0x7'));var path=require('path');var sox=require(_0xbf69('0x8'));var csv=require(_0xbf69('0x9'));var ejs=require(_0xbf69('0xa'));var fs=require('fs');var fs_extra=require(_0xbf69('0xb'));var _=require(_0xbf69('0xc'));var squel=require(_0xbf69('0xd'));var crypto=require('crypto');var jsforce=require(_0xbf69('0xe'));var deskjs=require(_0xbf69('0xf'));var toCsv=require(_0xbf69('0x9'));var querystring=require('querystring');var Papa=require(_0xbf69('0x10'));var Redis=require('ioredis');var authService=require(_0xbf69('0x11'));var qs=require(_0xbf69('0x12'));var as=require(_0xbf69('0x13'));var hardwareService=require(_0xbf69('0x14'));var logger=require(_0xbf69('0x15'))(_0xbf69('0x16'));var utils=require(_0xbf69('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbf69('0x18'));var db=require(_0xbf69('0x19'))['db'];function respondWithStatusCode(_0x432155,_0x5eb286){_0x5eb286=_0x5eb286||0xcc;return function(_0xcd0bce){if(_0xcd0bce){return _0x432155[_0xbf69('0x1a')](_0x5eb286);}return _0x432155[_0xbf69('0x1b')](_0x5eb286)[_0xbf69('0x1c')]();};}function respondWithResult(_0x5bbbaa,_0x1a5591){_0x1a5591=_0x1a5591||0xc8;return function(_0x14c010){if(_0x14c010){return _0x5bbbaa['status'](_0x1a5591)[_0xbf69('0x1d')](_0x14c010);}};}function respondWithFilteredResult(_0x1a9406,_0xff741d){return function(_0x39f66e){if(_0x39f66e){var _0x3aa749=typeof _0xff741d[_0xbf69('0x1e')]===_0xbf69('0x1f')&&typeof _0xff741d[_0xbf69('0x20')]==='undefined';var _0x3fafbb=_0x39f66e[_0xbf69('0x21')];var _0x5e7a3c=_0x3aa749?0x0:_0xff741d[_0xbf69('0x1e')];var _0x5dfa38=_0x3aa749?_0x39f66e[_0xbf69('0x21')]:_0xff741d['offset']+_0xff741d[_0xbf69('0x20')];var _0x57c6b4;if(_0x5dfa38>=_0x3fafbb){_0x5dfa38=_0x3fafbb;_0x57c6b4=0xc8;}else{_0x57c6b4=0xce;}_0x1a9406[_0xbf69('0x1b')](_0x57c6b4);return _0x1a9406['set'](_0xbf69('0x22'),_0x5e7a3c+'-'+_0x5dfa38+'/'+_0x3fafbb)[_0xbf69('0x1d')](_0x39f66e);}return null;};}function patchUpdates(_0x13d83b){return function(_0x1ab71b){try{jsonpatch[_0xbf69('0x23')](_0x1ab71b,_0x13d83b,!![]);}catch(_0xf860d7){return BPromise[_0xbf69('0x24')](_0xf860d7);}return _0x1ab71b['save']();};}function saveUpdates(_0x5b6109,_0x50325a){return function(_0x41ea0b){if(_0x41ea0b){return _0x41ea0b[_0xbf69('0x25')](_0x5b6109)[_0xbf69('0x26')](function(_0x192ff2){return _0x192ff2;});}return null;};}function removeEntity(_0x3cdf41,_0x29e1a7){return function(_0x22548b){if(_0x22548b){return _0x22548b[_0xbf69('0x27')]()['then'](function(){_0x3cdf41[_0xbf69('0x1b')](0xcc)[_0xbf69('0x1c')]();});}};}function handleEntityNotFound(_0x4bab3d,_0x2f97ef){return function(_0x44806e){if(!_0x44806e){_0x4bab3d[_0xbf69('0x1a')](0x194);}return _0x44806e;};}function handleError(_0x124cda,_0x29784b){_0x29784b=_0x29784b||0x1f4;return function(_0x818c2c){logger[_0xbf69('0x28')](_0x818c2c[_0xbf69('0x29')]);if(_0x818c2c[_0xbf69('0x2a')]){delete _0x818c2c[_0xbf69('0x2a')];}_0x124cda[_0xbf69('0x1b')](_0x29784b)['send'](_0x818c2c);};}exports[_0xbf69('0x2b')]=function(_0x516057,_0x1d8377){var _0x1f7fe2={},_0x19e9c8={},_0x4a913a={'count':0x0,'rows':[]};var _0x316f9d=_['map'](db['SquareReport']['rawAttributes'],function(_0x22cd6f){return{'name':_0x22cd6f[_0xbf69('0x2c')],'type':_0x22cd6f[_0xbf69('0x2d')][_0xbf69('0x2e')]};});_0x19e9c8['model']=_[_0xbf69('0x2f')](_0x316f9d,'name');_0x19e9c8[_0xbf69('0x30')]=_[_0xbf69('0x31')](_0x516057['query']);_0x19e9c8[_0xbf69('0x32')]=_[_0xbf69('0x33')](_0x19e9c8['model'],_0x19e9c8['query']);_0x1f7fe2[_0xbf69('0x34')]=_[_0xbf69('0x33')](_0x19e9c8[_0xbf69('0x35')],qs[_0xbf69('0x36')](_0x516057['query'][_0xbf69('0x36')]));_0x1f7fe2[_0xbf69('0x34')]=_0x1f7fe2[_0xbf69('0x34')][_0xbf69('0x37')]?_0x1f7fe2[_0xbf69('0x34')]:_0x19e9c8[_0xbf69('0x35')];if(!_0x516057[_0xbf69('0x30')][_0xbf69('0x38')](_0xbf69('0x39'))){_0x1f7fe2[_0xbf69('0x20')]=qs['limit'](_0x516057[_0xbf69('0x30')]['limit']);_0x1f7fe2[_0xbf69('0x1e')]=qs[_0xbf69('0x1e')](_0x516057[_0xbf69('0x30')][_0xbf69('0x1e')]);}_0x1f7fe2[_0xbf69('0x3a')]=qs['sort'](_0x516057['query'][_0xbf69('0x3b')]);_0x1f7fe2['where']=qs[_0xbf69('0x32')](_[_0xbf69('0x3c')](_0x516057[_0xbf69('0x30')],_0x19e9c8[_0xbf69('0x32')]),_0x316f9d);if(_0x516057[_0xbf69('0x30')][_0xbf69('0x3d')]){_0x1f7fe2[_0xbf69('0x3e')]=_[_0xbf69('0x3f')](_0x1f7fe2[_0xbf69('0x3e')],{'$or':_[_0xbf69('0x2f')](_0x316f9d,function(_0x25f098){if(_0x25f098[_0xbf69('0x2d')]!==_0xbf69('0x40')){var _0x3aa48d={};_0x3aa48d[_0x25f098[_0xbf69('0x2a')]]={'$like':'%'+_0x516057[_0xbf69('0x30')][_0xbf69('0x3d')]+'%'};return _0x3aa48d;}})});}_0x1f7fe2=_[_0xbf69('0x3f')]({},_0x1f7fe2,_0x516057['options']);var _0x1de75a={'where':_0x1f7fe2[_0xbf69('0x3e')]};return db[_0xbf69('0x41')][_0xbf69('0x21')](_0x1de75a)[_0xbf69('0x26')](function(_0x28f2f8){_0x4a913a[_0xbf69('0x21')]=_0x28f2f8;if(_0x516057[_0xbf69('0x30')][_0xbf69('0x42')]){_0x1f7fe2['include']=[{'all':!![]}];}return db[_0xbf69('0x41')][_0xbf69('0x43')](_0x1f7fe2);})[_0xbf69('0x26')](function(_0x1a64c7){_0x4a913a[_0xbf69('0x44')]=_0x1a64c7;return _0x4a913a;})[_0xbf69('0x26')](respondWithFilteredResult(_0x1d8377,_0x1f7fe2))[_0xbf69('0x45')](handleError(_0x1d8377,null));};exports[_0xbf69('0x46')]=function(_0xa2841c,_0x1a359c){var _0x3365ca={'raw':!![],'where':{'id':_0xa2841c[_0xbf69('0x47')]['id']}},_0x4c7735={};_0x4c7735[_0xbf69('0x35')]=_['keys'](db[_0xbf69('0x41')][_0xbf69('0x48')]);_0x4c7735[_0xbf69('0x30')]=_[_0xbf69('0x31')](_0xa2841c[_0xbf69('0x30')]);_0x4c7735[_0xbf69('0x32')]=_[_0xbf69('0x33')](_0x4c7735[_0xbf69('0x35')],_0x4c7735[_0xbf69('0x30')]);_0x3365ca['attributes']=_[_0xbf69('0x33')](_0x4c7735['model'],qs['fields'](_0xa2841c[_0xbf69('0x30')]['fields']));_0x3365ca[_0xbf69('0x34')]=_0x3365ca[_0xbf69('0x34')][_0xbf69('0x37')]?_0x3365ca[_0xbf69('0x34')]:_0x4c7735[_0xbf69('0x35')];if(_0xa2841c[_0xbf69('0x30')][_0xbf69('0x42')]){_0x3365ca[_0xbf69('0x49')]=[{'all':!![]}];}_0x3365ca=_[_0xbf69('0x3f')]({},_0x3365ca,_0xa2841c['options']);return db[_0xbf69('0x41')][_0xbf69('0x4a')](_0x3365ca)[_0xbf69('0x26')](handleEntityNotFound(_0x1a359c,null))[_0xbf69('0x26')](respondWithResult(_0x1a359c,null))[_0xbf69('0x45')](handleError(_0x1a359c,null));};exports[_0xbf69('0x4b')]=function(_0x63101e,_0x260acc){return db[_0xbf69('0x41')]['create'](_0x63101e[_0xbf69('0x4c')],{})[_0xbf69('0x26')](respondWithResult(_0x260acc,0xc9))[_0xbf69('0x45')](handleError(_0x260acc,null));};exports['update']=function(_0x1ed189,_0x13652a){if(_0x1ed189[_0xbf69('0x4c')]['id']){delete _0x1ed189[_0xbf69('0x4c')]['id'];}return db[_0xbf69('0x41')]['find']({'where':{'id':_0x1ed189['params']['id']}})[_0xbf69('0x26')](handleEntityNotFound(_0x13652a,null))[_0xbf69('0x26')](saveUpdates(_0x1ed189[_0xbf69('0x4c')],null))['then'](respondWithResult(_0x13652a,null))[_0xbf69('0x45')](handleError(_0x13652a,null));};exports[_0xbf69('0x27')]=function(_0x22a29c,_0x5030ef){return db[_0xbf69('0x41')]['find']({'where':{'id':_0x22a29c[_0xbf69('0x47')]['id']}})['then'](handleEntityNotFound(_0x5030ef,null))[_0xbf69('0x26')](removeEntity(_0x5030ef,null))['catch'](handleError(_0x5030ef,null));};exports['describe']=function(_0x542fcc,_0x42f34c){return db[_0xbf69('0x41')][_0xbf69('0x4d')]()[_0xbf69('0x26')](respondWithResult(_0x42f34c,null))[_0xbf69('0x45')](handleError(_0x42f34c,null));}; \ No newline at end of file +var _0x8ea9=['set','Content-Range','json','apply','save','update','then','error','stack','name','send','index','map','SquareReport','fieldName','type','key','keys','query','filters','attributes','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','rows','catch','params','rawAttributes','intersection','fields','length','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ea9,0x1a3));var _0x98ea=function(_0x24d8bb,_0x3b6314){_0x24d8bb=_0x24d8bb-0x0;var _0x412177=_0x8ea9[_0x24d8bb];return _0x412177;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x98ea('0x0'));var zipdir=require(_0x98ea('0x1'));var jsonpatch=require(_0x98ea('0x2'));var rp=require('request-promise');var moment=require(_0x98ea('0x3'));var BPromise=require(_0x98ea('0x4'));var Mustache=require(_0x98ea('0x5'));var util=require(_0x98ea('0x6'));var path=require(_0x98ea('0x7'));var sox=require('sox');var csv=require(_0x98ea('0x8'));var ejs=require(_0x98ea('0x9'));var fs=require('fs');var fs_extra=require(_0x98ea('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98ea('0xb'));var deskjs=require(_0x98ea('0xc'));var toCsv=require(_0x98ea('0x8'));var querystring=require(_0x98ea('0xd'));var Papa=require(_0x98ea('0xe'));var Redis=require('ioredis');var authService=require(_0x98ea('0xf'));var qs=require(_0x98ea('0x10'));var as=require(_0x98ea('0x11'));var hardwareService=require(_0x98ea('0x12'));var logger=require(_0x98ea('0x13'))(_0x98ea('0x14'));var utils=require(_0x98ea('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x98ea('0x16'));var db=require(_0x98ea('0x17'))['db'];function respondWithStatusCode(_0x1323ae,_0x42071d){_0x42071d=_0x42071d||0xcc;return function(_0x1d1d84){if(_0x1d1d84){return _0x1323ae[_0x98ea('0x18')](_0x42071d);}return _0x1323ae['status'](_0x42071d)[_0x98ea('0x19')]();};}function respondWithResult(_0x4e33a0,_0x2cdc08){_0x2cdc08=_0x2cdc08||0xc8;return function(_0x1df954){if(_0x1df954){return _0x4e33a0[_0x98ea('0x1a')](_0x2cdc08)['json'](_0x1df954);}};}function respondWithFilteredResult(_0x132879,_0x38cc69){return function(_0x121b79){if(_0x121b79){var _0x3e6fbf=typeof _0x38cc69[_0x98ea('0x1b')]===_0x98ea('0x1c')&&typeof _0x38cc69[_0x98ea('0x1d')]===_0x98ea('0x1c');var _0x4921e7=_0x121b79[_0x98ea('0x1e')];var _0x4d9350=_0x3e6fbf?0x0:_0x38cc69[_0x98ea('0x1b')];var _0x34c9b4=_0x3e6fbf?_0x121b79[_0x98ea('0x1e')]:_0x38cc69[_0x98ea('0x1b')]+_0x38cc69['limit'];var _0x404da7;if(_0x34c9b4>=_0x4921e7){_0x34c9b4=_0x4921e7;_0x404da7=0xc8;}else{_0x404da7=0xce;}_0x132879[_0x98ea('0x1a')](_0x404da7);return _0x132879[_0x98ea('0x1f')](_0x98ea('0x20'),_0x4d9350+'-'+_0x34c9b4+'/'+_0x4921e7)[_0x98ea('0x21')](_0x121b79);}return null;};}function patchUpdates(_0x277f8a){return function(_0x21e7fa){try{jsonpatch[_0x98ea('0x22')](_0x21e7fa,_0x277f8a,!![]);}catch(_0x5d736f){return BPromise['reject'](_0x5d736f);}return _0x21e7fa[_0x98ea('0x23')]();};}function saveUpdates(_0x55a493,_0x399452){return function(_0x22a844){if(_0x22a844){return _0x22a844[_0x98ea('0x24')](_0x55a493)['then'](function(_0x313b35){return _0x313b35;});}return null;};}function removeEntity(_0x4a5b47,_0x4cfeb0){return function(_0x1c38b3){if(_0x1c38b3){return _0x1c38b3['destroy']()[_0x98ea('0x25')](function(){_0x4a5b47[_0x98ea('0x1a')](0xcc)[_0x98ea('0x19')]();});}};}function handleEntityNotFound(_0x1d4206,_0x19cff9){return function(_0x179486){if(!_0x179486){_0x1d4206['sendStatus'](0x194);}return _0x179486;};}function handleError(_0x39976c,_0x1d073c){_0x1d073c=_0x1d073c||0x1f4;return function(_0x4a7b86){logger[_0x98ea('0x26')](_0x4a7b86[_0x98ea('0x27')]);if(_0x4a7b86[_0x98ea('0x28')]){delete _0x4a7b86[_0x98ea('0x28')];}_0x39976c[_0x98ea('0x1a')](_0x1d073c)[_0x98ea('0x29')](_0x4a7b86);};}exports[_0x98ea('0x2a')]=function(_0xab32ca,_0xa2ef9d){var _0x9ab5e0={},_0x38f1a1={},_0xb3042f={'count':0x0,'rows':[]};var _0x5c3815=_[_0x98ea('0x2b')](db[_0x98ea('0x2c')]['rawAttributes'],function(_0x11def9){return{'name':_0x11def9[_0x98ea('0x2d')],'type':_0x11def9[_0x98ea('0x2e')][_0x98ea('0x2f')]};});_0x38f1a1['model']=_['map'](_0x5c3815,_0x98ea('0x28'));_0x38f1a1['query']=_[_0x98ea('0x30')](_0xab32ca[_0x98ea('0x31')]);_0x38f1a1[_0x98ea('0x32')]=_['intersection'](_0x38f1a1['model'],_0x38f1a1[_0x98ea('0x31')]);_0x9ab5e0[_0x98ea('0x33')]=_['intersection'](_0x38f1a1[_0x98ea('0x34')],qs['fields'](_0xab32ca['query']['fields']));_0x9ab5e0['attributes']=_0x9ab5e0['attributes']['length']?_0x9ab5e0['attributes']:_0x38f1a1[_0x98ea('0x34')];if(!_0xab32ca['query'][_0x98ea('0x35')](_0x98ea('0x36'))){_0x9ab5e0['limit']=qs[_0x98ea('0x1d')](_0xab32ca['query'][_0x98ea('0x1d')]);_0x9ab5e0[_0x98ea('0x1b')]=qs[_0x98ea('0x1b')](_0xab32ca['query'][_0x98ea('0x1b')]);}_0x9ab5e0[_0x98ea('0x37')]=qs['sort'](_0xab32ca[_0x98ea('0x31')][_0x98ea('0x38')]);_0x9ab5e0[_0x98ea('0x39')]=qs[_0x98ea('0x32')](_[_0x98ea('0x3a')](_0xab32ca[_0x98ea('0x31')],_0x38f1a1[_0x98ea('0x32')]),_0x5c3815);if(_0xab32ca[_0x98ea('0x31')]['filter']){_0x9ab5e0[_0x98ea('0x39')]=_[_0x98ea('0x3b')](_0x9ab5e0['where'],{'$or':_[_0x98ea('0x2b')](_0x5c3815,function(_0x122cdc){if(_0x122cdc[_0x98ea('0x2e')]!=='VIRTUAL'){var _0x54f7c7={};_0x54f7c7[_0x122cdc['name']]={'$like':'%'+_0xab32ca['query'][_0x98ea('0x3c')]+'%'};return _0x54f7c7;}})});}_0x9ab5e0=_['merge']({},_0x9ab5e0,_0xab32ca[_0x98ea('0x3d')]);var _0x526cb9={'where':_0x9ab5e0[_0x98ea('0x39')]};return db[_0x98ea('0x2c')][_0x98ea('0x1e')](_0x526cb9)[_0x98ea('0x25')](function(_0x490794){_0xb3042f[_0x98ea('0x1e')]=_0x490794;if(_0xab32ca[_0x98ea('0x31')]['includeAll']){_0x9ab5e0[_0x98ea('0x3e')]=[{'all':!![]}];}return db[_0x98ea('0x2c')]['findAll'](_0x9ab5e0);})[_0x98ea('0x25')](function(_0x4922b3){_0xb3042f[_0x98ea('0x3f')]=_0x4922b3;return _0xb3042f;})[_0x98ea('0x25')](respondWithFilteredResult(_0xa2ef9d,_0x9ab5e0))[_0x98ea('0x40')](handleError(_0xa2ef9d,null));};exports['show']=function(_0x46b2ed,_0x34ef08){var _0x1c6760={'raw':!![],'where':{'id':_0x46b2ed[_0x98ea('0x41')]['id']}},_0x2a1531={};_0x2a1531[_0x98ea('0x34')]=_[_0x98ea('0x30')](db[_0x98ea('0x2c')][_0x98ea('0x42')]);_0x2a1531[_0x98ea('0x31')]=_[_0x98ea('0x30')](_0x46b2ed[_0x98ea('0x31')]);_0x2a1531[_0x98ea('0x32')]=_[_0x98ea('0x43')](_0x2a1531[_0x98ea('0x34')],_0x2a1531[_0x98ea('0x31')]);_0x1c6760['attributes']=_[_0x98ea('0x43')](_0x2a1531['model'],qs['fields'](_0x46b2ed['query'][_0x98ea('0x44')]));_0x1c6760['attributes']=_0x1c6760[_0x98ea('0x33')][_0x98ea('0x45')]?_0x1c6760[_0x98ea('0x33')]:_0x2a1531['model'];if(_0x46b2ed['query']['includeAll']){_0x1c6760['include']=[{'all':!![]}];}_0x1c6760=_[_0x98ea('0x3b')]({},_0x1c6760,_0x46b2ed[_0x98ea('0x3d')]);return db[_0x98ea('0x2c')][_0x98ea('0x46')](_0x1c6760)[_0x98ea('0x25')](handleEntityNotFound(_0x34ef08,null))[_0x98ea('0x25')](respondWithResult(_0x34ef08,null))[_0x98ea('0x40')](handleError(_0x34ef08,null));};exports[_0x98ea('0x47')]=function(_0x369cc1,_0x1bc1a6){return db[_0x98ea('0x2c')][_0x98ea('0x47')](_0x369cc1[_0x98ea('0x48')],{})[_0x98ea('0x25')](respondWithResult(_0x1bc1a6,0xc9))[_0x98ea('0x40')](handleError(_0x1bc1a6,null));};exports[_0x98ea('0x24')]=function(_0x2d7901,_0x39f4b1){if(_0x2d7901[_0x98ea('0x48')]['id']){delete _0x2d7901['body']['id'];}return db[_0x98ea('0x2c')][_0x98ea('0x46')]({'where':{'id':_0x2d7901[_0x98ea('0x41')]['id']}})[_0x98ea('0x25')](handleEntityNotFound(_0x39f4b1,null))['then'](saveUpdates(_0x2d7901[_0x98ea('0x48')],null))['then'](respondWithResult(_0x39f4b1,null))[_0x98ea('0x40')](handleError(_0x39f4b1,null));};exports[_0x98ea('0x49')]=function(_0x4445c6,_0x13be1c){return db[_0x98ea('0x2c')][_0x98ea('0x46')]({'where':{'id':_0x4445c6[_0x98ea('0x41')]['id']}})['then'](handleEntityNotFound(_0x13be1c,null))[_0x98ea('0x25')](removeEntity(_0x13be1c,null))['catch'](handleError(_0x13be1c,null));};exports[_0x98ea('0x4a')]=function(_0x4ce24e,_0x3083d7){return db[_0x98ea('0x2c')][_0x98ea('0x4a')]()[_0x98ea('0x25')](respondWithResult(_0x3083d7,null))[_0x98ea('0x40')](handleError(_0x3083d7,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 4422e8a..5265e2c 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 _0xf293=['request-promise','path','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','bluebird'];(function(_0x4c06a6,_0x249410){var _0x5917f3=function(_0x3f1e69){while(--_0x3f1e69){_0x4c06a6['push'](_0x4c06a6['shift']());}};_0x5917f3(++_0x249410);}(_0xf293,0x11c));var _0x3f29=function(_0x215010,_0x294f69){_0x215010=_0x215010-0x0;var _0x26869a=_0xf293[_0x215010];return _0x26869a;};'use strict';var _=require(_0x3f29('0x0'));var util=require(_0x3f29('0x1'));var logger=require(_0x3f29('0x2'))(_0x3f29('0x3'));var moment=require('moment');var BPromise=require(_0x3f29('0x4'));var rp=require(_0x3f29('0x5'));var fs=require('fs');var path=require(_0x3f29('0x6'));var rimraf=require(_0x3f29('0x7'));var config=require('../../config/environment');var attributes=require(_0x3f29('0x8'));module[_0x3f29('0x9')]=function(_0xaab013,_0x59f821){return _0xaab013[_0x3f29('0xa')](_0x3f29('0xb'),attributes,{'tableName':_0x3f29('0xc'),'paranoid':![],'indexes':[{'name':_0x3f29('0xd'),'fields':[_0x3f29('0xe'),_0x3f29('0xf')]},{'name':_0x3f29('0x10'),'fields':[_0x3f29('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c17=['uid_pname','uniqueid','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x2c17,0xe0));var _0x72c1=function(_0x18d9da,_0x688c55){_0x18d9da=_0x18d9da-0x0;var _0xa087fc=_0x2c17[_0x18d9da];return _0xa087fc;};'use strict';var _=require(_0x72c1('0x0'));var util=require(_0x72c1('0x1'));var logger=require(_0x72c1('0x2'))(_0x72c1('0x3'));var moment=require(_0x72c1('0x4'));var BPromise=require(_0x72c1('0x5'));var rp=require(_0x72c1('0x6'));var fs=require('fs');var path=require(_0x72c1('0x7'));var rimraf=require(_0x72c1('0x8'));var config=require(_0x72c1('0x9'));var attributes=require(_0x72c1('0xa'));module[_0x72c1('0xb')]=function(_0x5baddc,_0x5629df){return _0x5baddc[_0x72c1('0xc')](_0x72c1('0xd'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x72c1('0xe'),'fields':[_0x72c1('0xf'),'project_name']},{'name':'leaveAt','fields':[_0x72c1('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 9c90c6e..3295f49 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 _0x0b67=['raw','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateSquareReport','create','body','options','debug','UpdateSquareReport','SquareReport','update'];(function(_0x5ad084,_0xce6302){var _0x117fa7=function(_0x4ad169){while(--_0x4ad169){_0x5ad084['push'](_0x5ad084['shift']());}};_0x117fa7(++_0xce6302);}(_0x0b67,0xdb));var _0x70b6=function(_0x2285a1,_0x52076c){_0x2285a1=_0x2285a1-0x0;var _0x180da2=_0x0b67[_0x2285a1];return _0x180da2;};'use strict';var _=require(_0x70b6('0x0'));var util=require(_0x70b6('0x1'));var moment=require(_0x70b6('0x2'));var BPromise=require(_0x70b6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x70b6('0x4'))['db'];var utils=require(_0x70b6('0x5'));var logger=require(_0x70b6('0x6'))(_0x70b6('0x7'));var config=require(_0x70b6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x70b6('0x9')][_0x70b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c6f62,_0x54aa71,_0x5eaae1){return new BPromise(function(_0xb4d20c,_0xe4bf6f){return client[_0x70b6('0xb')](_0x2c6f62,_0x5eaae1)[_0x70b6('0xc')](function(_0x2f606c){logger['info'](_0x70b6('0xd'),_0x54aa71,_0x70b6('0xe'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x54aa71,'request\x20sent',JSON[_0x70b6('0xf')](_0x2f606c));if(_0x2f606c[_0x70b6('0x10')]){if(_0x2f606c[_0x70b6('0x10')][_0x70b6('0x11')]===0x1f4){logger[_0x70b6('0x10')](_0x70b6('0xd'),_0x54aa71,_0x2f606c[_0x70b6('0x10')][_0x70b6('0x12')]);return _0xe4bf6f(_0x2f606c['error'][_0x70b6('0x12')]);}logger[_0x70b6('0x10')](_0x70b6('0xd'),_0x54aa71,_0x2f606c['error'][_0x70b6('0x12')]);return _0xb4d20c(_0x2f606c[_0x70b6('0x10')]['message']);}else{logger[_0x70b6('0x13')]('SquareReport,\x20%s,\x20%s',_0x54aa71,_0x70b6('0xe'));_0xb4d20c(_0x2f606c['result'][_0x70b6('0x12')]);}})[_0x70b6('0x14')](function(_0x13e89a){logger[_0x70b6('0x10')](_0x70b6('0xd'),_0x54aa71,_0x13e89a);_0xe4bf6f(_0x13e89a);});});}exports[_0x70b6('0x15')]=function(_0x3e00c2){var _0x828c16=this;return new Promise(function(_0x442163,_0x250d5b){return db['SquareReport'][_0x70b6('0x16')](_0x3e00c2[_0x70b6('0x17')],{'raw':_0x3e00c2[_0x70b6('0x18')]?_0x3e00c2['options']['raw']===undefined?!![]:![]:!![]})[_0x70b6('0xc')](function(_0x48195f){logger[_0x70b6('0x13')](_0x70b6('0x15'),_0x3e00c2);logger[_0x70b6('0x19')](_0x70b6('0x15'),_0x3e00c2,JSON[_0x70b6('0xf')](_0x48195f));_0x442163(_0x48195f);})[_0x70b6('0x14')](function(_0x43a122){logger[_0x70b6('0x10')](_0x70b6('0x15'),_0x43a122['message'],_0x3e00c2);_0x250d5b(_0x828c16['error'](0x1f4,_0x43a122[_0x70b6('0x12')]));});});};exports[_0x70b6('0x1a')]=function(_0x379ff0){var _0x5d43fd=this;return new Promise(function(_0x49e4f4,_0x4a6295){return db[_0x70b6('0x1b')][_0x70b6('0x1c')](_0x379ff0[_0x70b6('0x17')],{'raw':_0x379ff0[_0x70b6('0x18')]?_0x379ff0[_0x70b6('0x18')][_0x70b6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x379ff0[_0x70b6('0x18')]?_0x379ff0[_0x70b6('0x18')]['where']||null:null,'attributes':_0x379ff0[_0x70b6('0x18')]?_0x379ff0[_0x70b6('0x18')]['attributes']||null:null,'limit':_0x379ff0[_0x70b6('0x18')]?_0x379ff0[_0x70b6('0x18')][_0x70b6('0x1e')]||null:null})[_0x70b6('0xc')](function(_0x58cc13){logger[_0x70b6('0x13')](_0x70b6('0x1a'),_0x379ff0);logger['debug'](_0x70b6('0x1a'),_0x379ff0,JSON[_0x70b6('0xf')](_0x58cc13));_0x49e4f4(_0x58cc13);})[_0x70b6('0x14')](function(_0x18f577){logger['error'](_0x70b6('0x1a'),_0x18f577[_0x70b6('0x12')],_0x379ff0);_0x4a6295(_0x5d43fd[_0x70b6('0x10')](0x1f4,_0x18f577[_0x70b6('0x12')]));});});}; \ No newline at end of file +var _0xca49=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s','message','info','result','catch','CreateSquareReport','SquareReport','create','options','update','raw','attributes','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x125436,_0x10252b){var _0x30cd60=function(_0x1b0d65){while(--_0x1b0d65){_0x125436['push'](_0x125436['shift']());}};_0x30cd60(++_0x10252b);}(_0xca49,0xba));var _0x9ca4=function(_0x3b8f2e,_0x5a99a8){_0x3b8f2e=_0x3b8f2e-0x0;var _0x1433d5=_0xca49[_0x3b8f2e];return _0x1433d5;};'use strict';var _=require(_0x9ca4('0x0'));var util=require(_0x9ca4('0x1'));var moment=require(_0x9ca4('0x2'));var BPromise=require(_0x9ca4('0x3'));var rs=require(_0x9ca4('0x4'));var fs=require('fs');var Redis=require(_0x9ca4('0x5'));var db=require(_0x9ca4('0x6'))['db'];var utils=require(_0x9ca4('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x9ca4('0x8'));var jayson=require(_0x9ca4('0x9'));var client=jayson[_0x9ca4('0xa')][_0x9ca4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12ced2,_0x55f1cb,_0x56a74e){return new BPromise(function(_0x1b8ffe,_0x1c0c0b){return client['request'](_0x12ced2,_0x56a74e)[_0x9ca4('0xc')](function(_0x5c819d){logger['info']('SquareReport,\x20%s,\x20%s',_0x55f1cb,_0x9ca4('0xd'));logger[_0x9ca4('0xe')](_0x9ca4('0xf'),_0x55f1cb,_0x9ca4('0xd'),JSON[_0x9ca4('0x10')](_0x5c819d));if(_0x5c819d[_0x9ca4('0x11')]){if(_0x5c819d[_0x9ca4('0x11')][_0x9ca4('0x12')]===0x1f4){logger['error'](_0x9ca4('0x13'),_0x55f1cb,_0x5c819d[_0x9ca4('0x11')][_0x9ca4('0x14')]);return _0x1c0c0b(_0x5c819d['error'][_0x9ca4('0x14')]);}logger['error'](_0x9ca4('0x13'),_0x55f1cb,_0x5c819d['error']['message']);return _0x1b8ffe(_0x5c819d['error']['message']);}else{logger[_0x9ca4('0x15')]('SquareReport,\x20%s,\x20%s',_0x55f1cb,_0x9ca4('0xd'));_0x1b8ffe(_0x5c819d[_0x9ca4('0x16')][_0x9ca4('0x14')]);}})[_0x9ca4('0x17')](function(_0x11e4f2){logger[_0x9ca4('0x11')]('SquareReport,\x20%s,\x20%s',_0x55f1cb,_0x11e4f2);_0x1c0c0b(_0x11e4f2);});});}exports[_0x9ca4('0x18')]=function(_0xbdaa3a){var _0xb4af0c=this;return new Promise(function(_0x470085,_0x17b09a){return db[_0x9ca4('0x19')][_0x9ca4('0x1a')](_0xbdaa3a['body'],{'raw':_0xbdaa3a['options']?_0xbdaa3a[_0x9ca4('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x9ca4('0xc')](function(_0x4caa6d){logger[_0x9ca4('0x15')](_0x9ca4('0x18'),_0xbdaa3a);logger['debug'](_0x9ca4('0x18'),_0xbdaa3a,JSON['stringify'](_0x4caa6d));_0x470085(_0x4caa6d);})[_0x9ca4('0x17')](function(_0x5d2ef8){logger['error'](_0x9ca4('0x18'),_0x5d2ef8[_0x9ca4('0x14')],_0xbdaa3a);_0x17b09a(_0xb4af0c['error'](0x1f4,_0x5d2ef8[_0x9ca4('0x14')]));});});};exports['UpdateSquareReport']=function(_0x24d25a){var _0x564815=this;return new Promise(function(_0xf8bd30,_0x18488b){return db[_0x9ca4('0x19')][_0x9ca4('0x1c')](_0x24d25a['body'],{'raw':_0x24d25a[_0x9ca4('0x1b')]?_0x24d25a[_0x9ca4('0x1b')][_0x9ca4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24d25a[_0x9ca4('0x1b')]?_0x24d25a[_0x9ca4('0x1b')]['where']||null:null,'attributes':_0x24d25a[_0x9ca4('0x1b')]?_0x24d25a['options'][_0x9ca4('0x1e')]||null:null,'limit':_0x24d25a[_0x9ca4('0x1b')]?_0x24d25a['options']['limit']||null:null})[_0x9ca4('0xc')](function(_0x3e9fdc){logger['info'](_0x9ca4('0x1f'),_0x24d25a);logger[_0x9ca4('0xe')](_0x9ca4('0x1f'),_0x24d25a,JSON['stringify'](_0x3e9fdc));_0xf8bd30(_0x3e9fdc);})['catch'](function(_0x444cea){logger[_0x9ca4('0x11')](_0x9ca4('0x1f'),_0x444cea[_0x9ca4('0x14')],_0x24d25a);_0x18488b(_0x564815[_0x9ca4('0x11')](0x1f4,_0x444cea['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 1ee7d85..85ed12d 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 _0xa727=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','/describe','get','/:id','post','create','put'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0xa727,0x17d));var _0x7a72=function(_0x23c00c,_0x5f496b){_0x23c00c=_0x23c00c-0x0;var _0xcd2f14=_0xa727[_0x23c00c];return _0xcd2f14;};'use strict';var multer=require(_0x7a72('0x0'));var util=require(_0x7a72('0x1'));var path=require(_0x7a72('0x2'));var timeout=require(_0x7a72('0x3'));var express=require(_0x7a72('0x4'));var router=express[_0x7a72('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7a72('0x6'));var interaction=require(_0x7a72('0x7'));var config=require(_0x7a72('0x8'));var controller=require(_0x7a72('0x9'));router['get']('/',auth[_0x7a72('0xa')](),controller[_0x7a72('0xb')]);router['get'](_0x7a72('0xc'),auth[_0x7a72('0xa')](),controller['describe']);router[_0x7a72('0xd')](_0x7a72('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x7a72('0xf')]('/',auth[_0x7a72('0xa')](),controller[_0x7a72('0x10')]);router[_0x7a72('0x11')](_0x7a72('0xe'),auth[_0x7a72('0xa')](),controller[_0x7a72('0x12')]);router['delete'](_0x7a72('0xe'),auth[_0x7a72('0xa')](),controller[_0x7a72('0x13')]);module[_0x7a72('0x14')]=router; \ No newline at end of file +var _0xb413=['/:id','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb413,0xee));var _0x3b41=function(_0x33e0bc,_0x2cbc73){_0x33e0bc=_0x33e0bc-0x0;var _0x3510c4=_0xb413[_0x33e0bc];return _0x3510c4;};'use strict';var multer=require('multer');var util=require(_0x3b41('0x0'));var path=require('path');var timeout=require(_0x3b41('0x1'));var express=require(_0x3b41('0x2'));var router=express[_0x3b41('0x3')]();var fs_extra=require(_0x3b41('0x4'));var auth=require(_0x3b41('0x5'));var interaction=require(_0x3b41('0x6'));var config=require(_0x3b41('0x7'));var controller=require(_0x3b41('0x8'));router[_0x3b41('0x9')]('/',auth[_0x3b41('0xa')](),controller[_0x3b41('0xb')]);router[_0x3b41('0x9')](_0x3b41('0xc'),auth['isAuthenticated'](),controller[_0x3b41('0xd')]);router[_0x3b41('0x9')](_0x3b41('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x3b41('0xa')](),controller[_0x3b41('0xf')]);router[_0x3b41('0x10')]('/:id',auth[_0x3b41('0xa')](),controller[_0x3b41('0x11')]);router[_0x3b41('0x12')](_0x3b41('0xe'),auth['isAuthenticated'](),controller[_0x3b41('0x13')]);module[_0x3b41('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index b8981da..4835adf 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 _0x4c99=['TEXT','sequelize','exports','STRING'];(function(_0x4671df,_0x515197){var _0xc77c8c=function(_0x12c0ff){while(--_0x12c0ff){_0x4671df['push'](_0x4671df['shift']());}};_0xc77c8c(++_0x515197);}(_0x4c99,0xfd));var _0x94c9=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x4c99[_0x346737];return _0x1ade2e;};'use strict';var Sequelize=require(_0x94c9('0x0'));module[_0x94c9('0x1')]={'uniqueid':{'type':Sequelize[_0x94c9('0x2')]},'node':{'type':Sequelize[_0x94c9('0x2')]},'application':{'type':Sequelize[_0x94c9('0x2')]},'data':{'type':Sequelize[_0x94c9('0x3')]},'project_name':{'type':Sequelize[_0x94c9('0x2')]},'callerid':{'type':Sequelize[_0x94c9('0x2')]}}; \ No newline at end of file +var _0x5567=['TEXT','exports','STRING'];(function(_0x5240ed,_0x50e8d5){var _0x3b6231=function(_0x39c649){while(--_0x39c649){_0x5240ed['push'](_0x5240ed['shift']());}};_0x3b6231(++_0x50e8d5);}(_0x5567,0x136));var _0x7556=function(_0x5178e9,_0x55e327){_0x5178e9=_0x5178e9-0x0;var _0xa2504a=_0x5567[_0x5178e9];return _0xa2504a;};'use strict';var Sequelize=require('sequelize');module[_0x7556('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x7556('0x1')]},'application':{'type':Sequelize[_0x7556('0x1')]},'data':{'type':Sequelize[_0x7556('0x2')]},'project_name':{'type':Sequelize[_0x7556('0x1')]},'callerid':{'type':Sequelize[_0x7556('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index c75d65d..0514916 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 _0xd324=['status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','order','pick','filter','where','merge','VIRTUAL','SquareDetailsReport','includeAll','include','findAll','rows','params','options','find','create','body','catch','describe','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x420df7,_0x5e15bf){var _0x20f465=function(_0x3a7861){while(--_0x3a7861){_0x420df7['push'](_0x420df7['shift']());}};_0x20f465(++_0x5e15bf);}(_0xd324,0x116));var _0x4d32=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0xd324[_0x2d8d69];return _0x39ae22;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d32('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4d32('0x1'));var moment=require('moment');var BPromise=require(_0x4d32('0x2'));var Mustache=require(_0x4d32('0x3'));var util=require(_0x4d32('0x4'));var path=require(_0x4d32('0x5'));var sox=require(_0x4d32('0x6'));var csv=require(_0x4d32('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4d32('0x8'));var _=require('lodash');var squel=require(_0x4d32('0x9'));var crypto=require(_0x4d32('0xa'));var jsforce=require(_0x4d32('0xb'));var deskjs=require(_0x4d32('0xc'));var toCsv=require(_0x4d32('0x7'));var querystring=require(_0x4d32('0xd'));var Papa=require(_0x4d32('0xe'));var Redis=require(_0x4d32('0xf'));var authService=require(_0x4d32('0x10'));var qs=require(_0x4d32('0x11'));var as=require(_0x4d32('0x12'));var hardwareService=require(_0x4d32('0x13'));var logger=require(_0x4d32('0x14'))(_0x4d32('0x15'));var utils=require('../../config/utils');var config=require(_0x4d32('0x16'));var licenseUtil=require(_0x4d32('0x17'));var db=require(_0x4d32('0x18'))['db'];function respondWithStatusCode(_0x735b87,_0xada3d0){_0xada3d0=_0xada3d0||0xcc;return function(_0x3cf2b6){if(_0x3cf2b6){return _0x735b87[_0x4d32('0x19')](_0xada3d0);}return _0x735b87[_0x4d32('0x1a')](_0xada3d0)[_0x4d32('0x1b')]();};}function respondWithResult(_0x56fdde,_0x4883e2){_0x4883e2=_0x4883e2||0xc8;return function(_0x5b1753){if(_0x5b1753){return _0x56fdde['status'](_0x4883e2)[_0x4d32('0x1c')](_0x5b1753);}};}function respondWithFilteredResult(_0x43dd23,_0x380ed6){return function(_0x305633){if(_0x305633){var _0x493181=typeof _0x380ed6['offset']===_0x4d32('0x1d')&&typeof _0x380ed6[_0x4d32('0x1e')]===_0x4d32('0x1d');var _0x4aa963=_0x305633[_0x4d32('0x1f')];var _0xb04bdd=_0x493181?0x0:_0x380ed6[_0x4d32('0x20')];var _0x3120f7=_0x493181?_0x305633[_0x4d32('0x1f')]:_0x380ed6[_0x4d32('0x20')]+_0x380ed6[_0x4d32('0x1e')];var _0x53608e;if(_0x3120f7>=_0x4aa963){_0x3120f7=_0x4aa963;_0x53608e=0xc8;}else{_0x53608e=0xce;}_0x43dd23[_0x4d32('0x1a')](_0x53608e);return _0x43dd23[_0x4d32('0x21')](_0x4d32('0x22'),_0xb04bdd+'-'+_0x3120f7+'/'+_0x4aa963)[_0x4d32('0x1c')](_0x305633);}return null;};}function patchUpdates(_0x43732d){return function(_0x1baf28){try{jsonpatch[_0x4d32('0x23')](_0x1baf28,_0x43732d,!![]);}catch(_0x4bf034){return BPromise[_0x4d32('0x24')](_0x4bf034);}return _0x1baf28[_0x4d32('0x25')]();};}function saveUpdates(_0x54b17a,_0x1e2d36){return function(_0x262e55){if(_0x262e55){return _0x262e55[_0x4d32('0x26')](_0x54b17a)[_0x4d32('0x27')](function(_0x13324d){return _0x13324d;});}return null;};}function removeEntity(_0x2fd62e,_0x509808){return function(_0x393b07){if(_0x393b07){return _0x393b07[_0x4d32('0x28')]()[_0x4d32('0x27')](function(){_0x2fd62e['status'](0xcc)[_0x4d32('0x1b')]();});}};}function handleEntityNotFound(_0x3c1f0b,_0x332bb2){return function(_0x51cd18){if(!_0x51cd18){_0x3c1f0b[_0x4d32('0x19')](0x194);}return _0x51cd18;};}function handleError(_0x106766,_0x1e47e7){_0x1e47e7=_0x1e47e7||0x1f4;return function(_0x467f14){logger[_0x4d32('0x29')](_0x467f14[_0x4d32('0x2a')]);if(_0x467f14[_0x4d32('0x2b')]){delete _0x467f14[_0x4d32('0x2b')];}_0x106766[_0x4d32('0x1a')](_0x1e47e7)[_0x4d32('0x2c')](_0x467f14);};}exports['index']=function(_0x2c2875,_0xd290f4){var _0x5c8330={},_0x24aa28={},_0x5a492c={'count':0x0,'rows':[]};var _0x31809e=_['map'](db['SquareDetailsReport'][_0x4d32('0x2d')],function(_0x290d01){return{'name':_0x290d01[_0x4d32('0x2e')],'type':_0x290d01[_0x4d32('0x2f')][_0x4d32('0x30')]};});_0x24aa28['model']=_[_0x4d32('0x31')](_0x31809e,_0x4d32('0x2b'));_0x24aa28[_0x4d32('0x32')]=_[_0x4d32('0x33')](_0x2c2875[_0x4d32('0x32')]);_0x24aa28[_0x4d32('0x34')]=_['intersection'](_0x24aa28[_0x4d32('0x35')],_0x24aa28[_0x4d32('0x32')]);_0x5c8330[_0x4d32('0x36')]=_[_0x4d32('0x37')](_0x24aa28[_0x4d32('0x35')],qs[_0x4d32('0x38')](_0x2c2875[_0x4d32('0x32')][_0x4d32('0x38')]));_0x5c8330[_0x4d32('0x36')]=_0x5c8330[_0x4d32('0x36')][_0x4d32('0x39')]?_0x5c8330[_0x4d32('0x36')]:_0x24aa28['model'];if(!_0x2c2875[_0x4d32('0x32')]['hasOwnProperty']('nolimit')){_0x5c8330['limit']=qs[_0x4d32('0x1e')](_0x2c2875[_0x4d32('0x32')][_0x4d32('0x1e')]);_0x5c8330['offset']=qs[_0x4d32('0x20')](_0x2c2875[_0x4d32('0x32')]['offset']);}_0x5c8330[_0x4d32('0x3a')]=qs['sort'](_0x2c2875[_0x4d32('0x32')]['sort']);_0x5c8330['where']=qs[_0x4d32('0x34')](_[_0x4d32('0x3b')](_0x2c2875['query'],_0x24aa28[_0x4d32('0x34')]),_0x31809e);if(_0x2c2875[_0x4d32('0x32')][_0x4d32('0x3c')]){_0x5c8330[_0x4d32('0x3d')]=_[_0x4d32('0x3e')](_0x5c8330['where'],{'$or':_[_0x4d32('0x31')](_0x31809e,function(_0x13268f){if(_0x13268f[_0x4d32('0x2f')]!==_0x4d32('0x3f')){var _0x55f9c3={};_0x55f9c3[_0x13268f[_0x4d32('0x2b')]]={'$like':'%'+_0x2c2875[_0x4d32('0x32')][_0x4d32('0x3c')]+'%'};return _0x55f9c3;}})});}_0x5c8330=_['merge']({},_0x5c8330,_0x2c2875['options']);var _0x427d38={'where':_0x5c8330['where']};return db[_0x4d32('0x40')][_0x4d32('0x1f')](_0x427d38)[_0x4d32('0x27')](function(_0x2e8ef8){_0x5a492c[_0x4d32('0x1f')]=_0x2e8ef8;if(_0x2c2875[_0x4d32('0x32')][_0x4d32('0x41')]){_0x5c8330[_0x4d32('0x42')]=[{'all':!![]}];}return db[_0x4d32('0x40')][_0x4d32('0x43')](_0x5c8330);})[_0x4d32('0x27')](function(_0x808d3b){_0x5a492c[_0x4d32('0x44')]=_0x808d3b;return _0x5a492c;})['then'](respondWithFilteredResult(_0xd290f4,_0x5c8330))['catch'](handleError(_0xd290f4,null));};exports['show']=function(_0x56cc25,_0x59a0d7){var _0x34e304={'raw':!![],'where':{'id':_0x56cc25[_0x4d32('0x45')]['id']}},_0x1dba99={};_0x1dba99['model']=_[_0x4d32('0x33')](db[_0x4d32('0x40')][_0x4d32('0x2d')]);_0x1dba99[_0x4d32('0x32')]=_[_0x4d32('0x33')](_0x56cc25['query']);_0x1dba99[_0x4d32('0x34')]=_[_0x4d32('0x37')](_0x1dba99['model'],_0x1dba99[_0x4d32('0x32')]);_0x34e304['attributes']=_[_0x4d32('0x37')](_0x1dba99[_0x4d32('0x35')],qs[_0x4d32('0x38')](_0x56cc25['query'][_0x4d32('0x38')]));_0x34e304[_0x4d32('0x36')]=_0x34e304[_0x4d32('0x36')]['length']?_0x34e304[_0x4d32('0x36')]:_0x1dba99[_0x4d32('0x35')];if(_0x56cc25[_0x4d32('0x32')][_0x4d32('0x41')]){_0x34e304[_0x4d32('0x42')]=[{'all':!![]}];}_0x34e304=_[_0x4d32('0x3e')]({},_0x34e304,_0x56cc25[_0x4d32('0x46')]);return db[_0x4d32('0x40')][_0x4d32('0x47')](_0x34e304)[_0x4d32('0x27')](handleEntityNotFound(_0x59a0d7,null))['then'](respondWithResult(_0x59a0d7,null))['catch'](handleError(_0x59a0d7,null));};exports[_0x4d32('0x48')]=function(_0x88b2a2,_0x634522){return db[_0x4d32('0x40')][_0x4d32('0x48')](_0x88b2a2[_0x4d32('0x49')],{})[_0x4d32('0x27')](respondWithResult(_0x634522,0xc9))[_0x4d32('0x4a')](handleError(_0x634522,null));};exports[_0x4d32('0x26')]=function(_0x44022d,_0x3c037b){if(_0x44022d['body']['id']){delete _0x44022d['body']['id'];}return db[_0x4d32('0x40')]['find']({'where':{'id':_0x44022d['params']['id']}})[_0x4d32('0x27')](handleEntityNotFound(_0x3c037b,null))[_0x4d32('0x27')](saveUpdates(_0x44022d[_0x4d32('0x49')],null))['then'](respondWithResult(_0x3c037b,null))['catch'](handleError(_0x3c037b,null));};exports['destroy']=function(_0x1cd6fa,_0x162200){return db['SquareDetailsReport']['find']({'where':{'id':_0x1cd6fa[_0x4d32('0x45')]['id']}})[_0x4d32('0x27')](handleEntityNotFound(_0x162200,null))[_0x4d32('0x27')](removeEntity(_0x162200,null))[_0x4d32('0x4a')](handleError(_0x162200,null));};exports[_0x4d32('0x4b')]=function(_0x3c2013,_0x11ff50){return db[_0x4d32('0x40')]['describe']()['then'](respondWithResult(_0x11ff50,null))[_0x4d32('0x4a')](handleError(_0x11ff50,null));}; \ No newline at end of file +var _0x13a3=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','SquareDetailsReport','fieldName'];(function(_0x596565,_0x1258ad){var _0x474b1b=function(_0x2bbf2d){while(--_0x2bbf2d){_0x596565['push'](_0x596565['shift']());}};_0x474b1b(++_0x1258ad);}(_0x13a3,0x102));var _0x313a=function(_0x3beabf,_0x2092b9){_0x3beabf=_0x3beabf-0x0;var _0x43ce4b=_0x13a3[_0x3beabf];return _0x43ce4b;};'use strict';var emlformat=require(_0x313a('0x0'));var rimraf=require(_0x313a('0x1'));var zipdir=require(_0x313a('0x2'));var jsonpatch=require(_0x313a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x313a('0x4'));var Mustache=require(_0x313a('0x5'));var util=require(_0x313a('0x6'));var path=require(_0x313a('0x7'));var sox=require(_0x313a('0x8'));var csv=require(_0x313a('0x9'));var ejs=require(_0x313a('0xa'));var fs=require('fs');var fs_extra=require(_0x313a('0xb'));var _=require(_0x313a('0xc'));var squel=require(_0x313a('0xd'));var crypto=require('crypto');var jsforce=require(_0x313a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x313a('0x9'));var querystring=require('querystring');var Papa=require(_0x313a('0xf'));var Redis=require(_0x313a('0x10'));var authService=require(_0x313a('0x11'));var qs=require(_0x313a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x313a('0x13'));var logger=require(_0x313a('0x14'))('api');var utils=require(_0x313a('0x15'));var config=require(_0x313a('0x16'));var licenseUtil=require(_0x313a('0x17'));var db=require(_0x313a('0x18'))['db'];function respondWithStatusCode(_0x231c30,_0x23c5ac){_0x23c5ac=_0x23c5ac||0xcc;return function(_0x4698f8){if(_0x4698f8){return _0x231c30[_0x313a('0x19')](_0x23c5ac);}return _0x231c30[_0x313a('0x1a')](_0x23c5ac)['end']();};}function respondWithResult(_0x22b922,_0x404a08){_0x404a08=_0x404a08||0xc8;return function(_0x4f7eda){if(_0x4f7eda){return _0x22b922[_0x313a('0x1a')](_0x404a08)[_0x313a('0x1b')](_0x4f7eda);}};}function respondWithFilteredResult(_0x308505,_0x2bb112){return function(_0x58cba8){if(_0x58cba8){var _0x5b1b78=typeof _0x2bb112[_0x313a('0x1c')]==='undefined'&&typeof _0x2bb112[_0x313a('0x1d')]===_0x313a('0x1e');var _0x4eb77e=_0x58cba8[_0x313a('0x1f')];var _0x27082a=_0x5b1b78?0x0:_0x2bb112[_0x313a('0x1c')];var _0x14c331=_0x5b1b78?_0x58cba8['count']:_0x2bb112['offset']+_0x2bb112[_0x313a('0x1d')];var _0x1a71de;if(_0x14c331>=_0x4eb77e){_0x14c331=_0x4eb77e;_0x1a71de=0xc8;}else{_0x1a71de=0xce;}_0x308505[_0x313a('0x1a')](_0x1a71de);return _0x308505['set'](_0x313a('0x20'),_0x27082a+'-'+_0x14c331+'/'+_0x4eb77e)[_0x313a('0x1b')](_0x58cba8);}return null;};}function patchUpdates(_0xbb08de){return function(_0xa10dfd){try{jsonpatch[_0x313a('0x21')](_0xa10dfd,_0xbb08de,!![]);}catch(_0xd2dfa5){return BPromise[_0x313a('0x22')](_0xd2dfa5);}return _0xa10dfd[_0x313a('0x23')]();};}function saveUpdates(_0x5f6e24,_0x3e4ebb){return function(_0x4645cb){if(_0x4645cb){return _0x4645cb['update'](_0x5f6e24)['then'](function(_0x131def){return _0x131def;});}return null;};}function removeEntity(_0x535440,_0x56e46f){return function(_0x5e2a23){if(_0x5e2a23){return _0x5e2a23[_0x313a('0x24')]()[_0x313a('0x25')](function(){_0x535440[_0x313a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa2d521,_0x34d1ad){return function(_0x4e27eb){if(!_0x4e27eb){_0xa2d521[_0x313a('0x19')](0x194);}return _0x4e27eb;};}function handleError(_0x159dc2,_0x5eced4){_0x5eced4=_0x5eced4||0x1f4;return function(_0x3d00d8){logger[_0x313a('0x26')](_0x3d00d8[_0x313a('0x27')]);if(_0x3d00d8[_0x313a('0x28')]){delete _0x3d00d8['name'];}_0x159dc2[_0x313a('0x1a')](_0x5eced4)[_0x313a('0x29')](_0x3d00d8);};}exports[_0x313a('0x2a')]=function(_0x5520d2,_0x13c665){var _0x7d694={},_0x2c6d1c={},_0x323288={'count':0x0,'rows':[]};var _0x1e355e=_[_0x313a('0x2b')](db[_0x313a('0x2c')]['rawAttributes'],function(_0x18597c){return{'name':_0x18597c[_0x313a('0x2d')],'type':_0x18597c[_0x313a('0x2e')][_0x313a('0x2f')]};});_0x2c6d1c[_0x313a('0x30')]=_['map'](_0x1e355e,_0x313a('0x28'));_0x2c6d1c[_0x313a('0x31')]=_[_0x313a('0x32')](_0x5520d2[_0x313a('0x31')]);_0x2c6d1c[_0x313a('0x33')]=_[_0x313a('0x34')](_0x2c6d1c[_0x313a('0x30')],_0x2c6d1c[_0x313a('0x31')]);_0x7d694[_0x313a('0x35')]=_[_0x313a('0x34')](_0x2c6d1c['model'],qs[_0x313a('0x36')](_0x5520d2['query']['fields']));_0x7d694[_0x313a('0x35')]=_0x7d694['attributes'][_0x313a('0x37')]?_0x7d694[_0x313a('0x35')]:_0x2c6d1c[_0x313a('0x30')];if(!_0x5520d2['query'][_0x313a('0x38')](_0x313a('0x39'))){_0x7d694[_0x313a('0x1d')]=qs[_0x313a('0x1d')](_0x5520d2[_0x313a('0x31')][_0x313a('0x1d')]);_0x7d694[_0x313a('0x1c')]=qs[_0x313a('0x1c')](_0x5520d2[_0x313a('0x31')][_0x313a('0x1c')]);}_0x7d694['order']=qs[_0x313a('0x3a')](_0x5520d2[_0x313a('0x31')][_0x313a('0x3a')]);_0x7d694[_0x313a('0x3b')]=qs['filters'](_[_0x313a('0x3c')](_0x5520d2['query'],_0x2c6d1c[_0x313a('0x33')]),_0x1e355e);if(_0x5520d2[_0x313a('0x31')]['filter']){_0x7d694[_0x313a('0x3b')]=_[_0x313a('0x3d')](_0x7d694[_0x313a('0x3b')],{'$or':_[_0x313a('0x2b')](_0x1e355e,function(_0x34f1e2){if(_0x34f1e2[_0x313a('0x2e')]!=='VIRTUAL'){var _0x1c181e={};_0x1c181e[_0x34f1e2[_0x313a('0x28')]]={'$like':'%'+_0x5520d2['query']['filter']+'%'};return _0x1c181e;}})});}_0x7d694=_[_0x313a('0x3d')]({},_0x7d694,_0x5520d2[_0x313a('0x3e')]);var _0x42235d={'where':_0x7d694['where']};return db[_0x313a('0x2c')][_0x313a('0x1f')](_0x42235d)[_0x313a('0x25')](function(_0x5f46b7){_0x323288[_0x313a('0x1f')]=_0x5f46b7;if(_0x5520d2[_0x313a('0x31')][_0x313a('0x3f')]){_0x7d694[_0x313a('0x40')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x313a('0x41')](_0x7d694);})['then'](function(_0x2868f1){_0x323288[_0x313a('0x42')]=_0x2868f1;return _0x323288;})['then'](respondWithFilteredResult(_0x13c665,_0x7d694))[_0x313a('0x43')](handleError(_0x13c665,null));};exports[_0x313a('0x44')]=function(_0x22272d,_0x300506){var _0x4ca6d0={'raw':!![],'where':{'id':_0x22272d[_0x313a('0x45')]['id']}},_0x3886a8={};_0x3886a8[_0x313a('0x30')]=_[_0x313a('0x32')](db[_0x313a('0x2c')][_0x313a('0x46')]);_0x3886a8[_0x313a('0x31')]=_['keys'](_0x22272d['query']);_0x3886a8['filters']=_[_0x313a('0x34')](_0x3886a8[_0x313a('0x30')],_0x3886a8[_0x313a('0x31')]);_0x4ca6d0[_0x313a('0x35')]=_[_0x313a('0x34')](_0x3886a8['model'],qs['fields'](_0x22272d[_0x313a('0x31')][_0x313a('0x36')]));_0x4ca6d0[_0x313a('0x35')]=_0x4ca6d0[_0x313a('0x35')][_0x313a('0x37')]?_0x4ca6d0[_0x313a('0x35')]:_0x3886a8[_0x313a('0x30')];if(_0x22272d['query'][_0x313a('0x3f')]){_0x4ca6d0[_0x313a('0x40')]=[{'all':!![]}];}_0x4ca6d0=_[_0x313a('0x3d')]({},_0x4ca6d0,_0x22272d[_0x313a('0x3e')]);return db[_0x313a('0x2c')][_0x313a('0x47')](_0x4ca6d0)[_0x313a('0x25')](handleEntityNotFound(_0x300506,null))[_0x313a('0x25')](respondWithResult(_0x300506,null))[_0x313a('0x43')](handleError(_0x300506,null));};exports['create']=function(_0x52e595,_0x48bc0a){return db[_0x313a('0x2c')][_0x313a('0x48')](_0x52e595['body'],{})[_0x313a('0x25')](respondWithResult(_0x48bc0a,0xc9))[_0x313a('0x43')](handleError(_0x48bc0a,null));};exports[_0x313a('0x49')]=function(_0x5d4c47,_0xe56be){if(_0x5d4c47[_0x313a('0x4a')]['id']){delete _0x5d4c47[_0x313a('0x4a')]['id'];}return db[_0x313a('0x2c')][_0x313a('0x47')]({'where':{'id':_0x5d4c47[_0x313a('0x45')]['id']}})[_0x313a('0x25')](handleEntityNotFound(_0xe56be,null))[_0x313a('0x25')](saveUpdates(_0x5d4c47[_0x313a('0x4a')],null))[_0x313a('0x25')](respondWithResult(_0xe56be,null))[_0x313a('0x43')](handleError(_0xe56be,null));};exports[_0x313a('0x24')]=function(_0x40d199,_0x4a53f4){return db[_0x313a('0x2c')][_0x313a('0x47')]({'where':{'id':_0x40d199['params']['id']}})[_0x313a('0x25')](handleEntityNotFound(_0x4a53f4,null))[_0x313a('0x25')](removeEntity(_0x4a53f4,null))['catch'](handleError(_0x4a53f4,null));};exports['describe']=function(_0xbcad07,_0x177072){return db[_0x313a('0x2c')][_0x313a('0x4b')]()[_0x313a('0x25')](respondWithResult(_0x177072,null))[_0x313a('0x43')](handleError(_0x177072,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index af97793..f16acd1 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 _0x41b6=['lodash','util','api','request-promise','rimraf','./squareReportDetail.attributes','define','SquareDetailsReport'];(function(_0x19c765,_0x5c7831){var _0x6e07a0=function(_0x594bb8){while(--_0x594bb8){_0x19c765['push'](_0x19c765['shift']());}};_0x6e07a0(++_0x5c7831);}(_0x41b6,0x158));var _0x641b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41b6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x641b('0x0'));var util=require(_0x641b('0x1'));var logger=require('../../config/logger')(_0x641b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x641b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x641b('0x4'));var config=require('../../config/environment');var attributes=require(_0x641b('0x5'));module['exports']=function(_0x395fbb,_0x3e3a66){return _0x395fbb[_0x641b('0x6')](_0x641b('0x7'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bb6=['report_square_details','util','../../config/logger','moment','path','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bb6,0xe7));var _0x67bb=function(_0x5b8b29,_0x13c2a6){_0x5b8b29=_0x5b8b29-0x0;var _0x3d7612=_0x7bb6[_0x5b8b29];return _0x3d7612;};'use strict';var _=require('lodash');var util=require(_0x67bb('0x0'));var logger=require(_0x67bb('0x1'))('api');var moment=require(_0x67bb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x67bb('0x3'));var rimraf=require('rimraf');var config=require(_0x67bb('0x4'));var attributes=require(_0x67bb('0x5'));module[_0x67bb('0x6')]=function(_0xdb1434,_0x382b26){return _0xdb1434[_0x67bb('0x7')](_0x67bb('0x8'),attributes,{'tableName':_0x67bb('0x9'),'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 bde0311..cd7cb40 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 _0xb9be=['then','info','SquareDetailsReport,\x20%s,\x20%s','debug','stringify','error','code','request\x20sent','result','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x370d3d,_0x1e1f4a){var _0x5bfcaf=function(_0x4a57c7){while(--_0x4a57c7){_0x370d3d['push'](_0x370d3d['shift']());}};_0x5bfcaf(++_0x1e1f4a);}(_0xb9be,0xc5));var _0xeb9b=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0xb9be[_0x3f3f40];return _0x403b7a;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var moment=require(_0xeb9b('0x2'));var BPromise=require(_0xeb9b('0x3'));var rs=require(_0xeb9b('0x4'));var fs=require('fs');var Redis=require(_0xeb9b('0x5'));var db=require(_0xeb9b('0x6'))['db'];var utils=require(_0xeb9b('0x7'));var logger=require(_0xeb9b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb9b('0x9'));var client=jayson[_0xeb9b('0xa')][_0xeb9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49a8b9,_0x1ee7e0,_0x58ca1d){return new BPromise(function(_0x210eeb,_0x28dc5f){return client[_0xeb9b('0xc')](_0x49a8b9,_0x58ca1d)[_0xeb9b('0xd')](function(_0x418204){logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,'request\x20sent');logger[_0xeb9b('0x10')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1ee7e0,'request\x20sent',JSON[_0xeb9b('0x11')](_0x418204));if(_0x418204[_0xeb9b('0x12')]){if(_0x418204['error'][_0xeb9b('0x13')]===0x1f4){logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x28dc5f(_0x418204['error']['message']);}logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x210eeb(_0x418204['error']['message']);}else{logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,_0xeb9b('0x14'));_0x210eeb(_0x418204[_0xeb9b('0x15')][_0xeb9b('0x16')]);}})[_0xeb9b('0x17')](function(_0x239ccf){logger['error'](_0xeb9b('0xf'),_0x1ee7e0,_0x239ccf);_0x28dc5f(_0x239ccf);});});}exports[_0xeb9b('0x18')]=function(_0x21aca6){var _0x3a11e3=this;return new Promise(function(_0x3cbe3e,_0x1a140c){return db[_0xeb9b('0x19')][_0xeb9b('0x1a')](_0x21aca6[_0xeb9b('0x1b')],{'raw':_0x21aca6[_0xeb9b('0x1c')]?_0x21aca6['options'][_0xeb9b('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5d5f54){logger[_0xeb9b('0xe')](_0xeb9b('0x18'),_0x21aca6);logger['debug'](_0xeb9b('0x18'),_0x21aca6,JSON[_0xeb9b('0x11')](_0x5d5f54));_0x3cbe3e(_0x5d5f54);})[_0xeb9b('0x17')](function(_0x37d7e0){logger[_0xeb9b('0x12')](_0xeb9b('0x18'),_0x37d7e0[_0xeb9b('0x16')],_0x21aca6);_0x1a140c(_0x3a11e3[_0xeb9b('0x12')](0x1f4,_0x37d7e0[_0xeb9b('0x16')]));});});}; \ No newline at end of file +var _0x351d=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','then'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x351d,0x90));var _0xd351=function(_0x3b4161,_0x1cf4f4){_0x3b4161=_0x3b4161-0x0;var _0x10377c=_0x351d[_0x3b4161];return _0x10377c;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var moment=require(_0xd351('0x1'));var BPromise=require(_0xd351('0x2'));var rs=require(_0xd351('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd351('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd351('0x5'))(_0xd351('0x6'));var config=require('../../config/environment');var jayson=require(_0xd351('0x7'));var client=jayson[_0xd351('0x8')][_0xd351('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5318b2,_0x16b3f7,_0x235aa0){return new BPromise(function(_0x4e1b06,_0x2e9a2a){return client[_0xd351('0xa')](_0x5318b2,_0x235aa0)['then'](function(_0x586c60){logger[_0xd351('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x16b3f7,_0xd351('0xc'));logger[_0xd351('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x16b3f7,_0xd351('0xc'),JSON[_0xd351('0xe')](_0x586c60));if(_0x586c60['error']){if(_0x586c60[_0xd351('0xf')]['code']===0x1f4){logger['error'](_0xd351('0x10'),_0x16b3f7,_0x586c60[_0xd351('0xf')][_0xd351('0x11')]);return _0x2e9a2a(_0x586c60[_0xd351('0xf')]['message']);}logger[_0xd351('0xf')](_0xd351('0x10'),_0x16b3f7,_0x586c60['error'][_0xd351('0x11')]);return _0x4e1b06(_0x586c60[_0xd351('0xf')][_0xd351('0x11')]);}else{logger[_0xd351('0xb')](_0xd351('0x10'),_0x16b3f7,'request\x20sent');_0x4e1b06(_0x586c60[_0xd351('0x12')]['message']);}})['catch'](function(_0x2c6708){logger['error'](_0xd351('0x10'),_0x16b3f7,_0x2c6708);_0x2e9a2a(_0x2c6708);});});}exports[_0xd351('0x13')]=function(_0x4e0164){var _0x4c6693=this;return new Promise(function(_0x1e1a3c,_0x2bfc53){return db[_0xd351('0x14')][_0xd351('0x15')](_0x4e0164['body'],{'raw':_0x4e0164[_0xd351('0x16')]?_0x4e0164['options']['raw']===undefined?!![]:![]:!![]})[_0xd351('0x17')](function(_0x4a427b){logger[_0xd351('0xb')](_0xd351('0x13'),_0x4e0164);logger[_0xd351('0xd')](_0xd351('0x13'),_0x4e0164,JSON[_0xd351('0xe')](_0x4a427b));_0x1e1a3c(_0x4a427b);})['catch'](function(_0x18625b){logger[_0xd351('0xf')](_0xd351('0x13'),_0x18625b['message'],_0x4e0164);_0x2bfc53(_0x4c6693[_0xd351('0xf')](0x1f4,_0x18625b[_0xd351('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index bd47597..7e5833c 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 _0xef8d=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','exports','express'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xef8d,0xe7));var _0xdef8=function(_0x2c90c1,_0x446eda){_0x2c90c1=_0x2c90c1-0x0;var _0xcb55d4=_0xef8d[_0x2c90c1];return _0xcb55d4;};'use strict';var express=require(_0xdef8('0x0'));var router=express[_0xdef8('0x1')]();var auth=require(_0xdef8('0x2'));var controller=require(_0xdef8('0x3'));router[_0xdef8('0x4')]('/',auth[_0xdef8('0x5')](),controller['index']);router['get'](_0xdef8('0x6'),auth[_0xdef8('0x5')](),controller['killProcess']);module[_0xdef8('0x7')]=router; \ No newline at end of file +var _0x7ef6=['../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess','exports'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x7ef6,0xaf));var _0x67ef=function(_0xc4e84c,_0x17972b){_0xc4e84c=_0xc4e84c-0x0;var _0x490013=_0x7ef6[_0xc4e84c];return _0x490013;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x67ef('0x0'));var controller=require(_0x67ef('0x1'));router[_0x67ef('0x2')]('/',auth[_0x67ef('0x3')](),controller['index']);router[_0x67ef('0x2')](_0x67ef('0x4'),auth['isAuthenticated'](),controller[_0x67ef('0x5')]);module[_0x67ef('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 32a52a5..1d3aa73 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 _0xd89c=['../../config/logger','api','util','bluebird','error','inspect','name','status','send','index','getAllData','then','json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xd89c,0x85));var _0xcd89=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd89c[_0x19e35c];return _0x3e1fe8;};'use strict';var info=require(_0xcd89('0x0'));var exec=require(_0xcd89('0x1'))['exec'];var logger=require(_0xcd89('0x2'))(_0xcd89('0x3'));var util=require(_0xcd89('0x4'));var BPromise=require(_0xcd89('0x5'));var _=require('lodash');function handleError(_0x38e4c9,_0x44c372,_0x410b2c){_0x44c372=_0x44c372||0x1f4;return function(_0x1bb681){logger[_0xcd89('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x410b2c,_0x44c372,util[_0xcd89('0x7')](_0x1bb681,{'showHidden':![],'depth':null}));delete _0x1bb681[_0xcd89('0x8')];_0x38e4c9[_0xcd89('0x9')](_0x44c372)[_0xcd89('0xa')](_0x1bb681);};}exports[_0xcd89('0xb')]=function(_0x3252f8,_0x2f4b47){return info[_0xcd89('0xc')]()[_0xcd89('0xd')](function(_0x44a2e4){return _0x2f4b47['status'](0xc8)['json'](_0x44a2e4);})['catch'](function(_0x37f7f7){return _0x2f4b47[_0xcd89('0x9')](0x1f4)[_0xcd89('0xe')](_0x37f7f7);});};exports['killProcess']=function(_0x36a194,_0x4aed06){var _0x35e097=[_0xcd89('0xf')];return new BPromise(function(_0x4ad089,_0x50b5ef){return exec(util[_0xcd89('0x10')](_0xcd89('0x11'),_0x36a194[_0xcd89('0x12')][_0xcd89('0x13')]),function(_0x3cac19,_0x48b5be,_0x259aa5){if(_0x3cac19){return _0x50b5ef(_0x3cac19);}return _0x4ad089(_0x48b5be);});})[_0xcd89('0xd')](function(_0x48f021){var _0x599163=![];var _0x34e666=_0x48f021[_0xcd89('0x14')](/\n/);for(var _0x3ce60e=0x0,_0x50439e=_0x35e097[_0xcd89('0x15')];_0x3ce60e<_0x50439e,_0x599163===![];_0x3ce60e+=0x1){if(_0x48f021[_0xcd89('0x16')](_0x35e097[_0x3ce60e])>=0x0){_0x599163=!![];}}if(!_0x599163){throw new Error(util[_0xcd89('0x10')](_0xcd89('0x17'),_0x36a194[_0xcd89('0x12')]['pid']));}process[_0xcd89('0x18')](_0x36a194[_0xcd89('0x12')][_0xcd89('0x13')],_0xcd89('0x19'));return _0x4aed06[_0xcd89('0x9')](0xc8)[_0xcd89('0xe')]({'message':util[_0xcd89('0x10')](_0xcd89('0x1a'),_0x36a194[_0xcd89('0x12')][_0xcd89('0x13')])});})['catch'](handleError(_0x4aed06,null,'killProcess'));}; \ No newline at end of file +var _0x38e9=['getAllData','json','catch','status','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','send'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0x38e9,0xef));var _0x938e=function(_0x2b93a5,_0x31934c){_0x2b93a5=_0x2b93a5-0x0;var _0x4111dc=_0x38e9[_0x2b93a5];return _0x4111dc;};'use strict';var info=require(_0x938e('0x0'));var exec=require(_0x938e('0x1'))[_0x938e('0x2')];var logger=require(_0x938e('0x3'))(_0x938e('0x4'));var util=require(_0x938e('0x5'));var BPromise=require(_0x938e('0x6'));var _=require(_0x938e('0x7'));function handleError(_0x13f7e5,_0x2832c,_0x55c79a){_0x2832c=_0x2832c||0x1f4;return function(_0xda4b25){logger[_0x938e('0x8')](_0x938e('0x9'),_0x55c79a,_0x2832c,util['inspect'](_0xda4b25,{'showHidden':![],'depth':null}));delete _0xda4b25['name'];_0x13f7e5['status'](_0x2832c)[_0x938e('0xa')](_0xda4b25);};}exports['index']=function(_0x3620ac,_0x2942f7){return info[_0x938e('0xb')]()['then'](function(_0x5614f0){return _0x2942f7['status'](0xc8)[_0x938e('0xc')](_0x5614f0);})[_0x938e('0xd')](function(_0x538462){return _0x2942f7[_0x938e('0xe')](0x1f4)['json'](_0x538462);});};exports[_0x938e('0xf')]=function(_0x4aa27f,_0x56dd07){var _0x7e6e2c=[_0x938e('0x10')];return new BPromise(function(_0x144896,_0x1db1d6){return exec(util[_0x938e('0x11')](_0x938e('0x12'),_0x4aa27f[_0x938e('0x13')][_0x938e('0x14')]),function(_0x2681b5,_0x593f49,_0x4491d7){if(_0x2681b5){return _0x1db1d6(_0x2681b5);}return _0x144896(_0x593f49);});})[_0x938e('0x15')](function(_0xcf761d){var _0xd5b98=![];var _0x515286=_0xcf761d['split'](/\n/);for(var _0x3200dc=0x0,_0x1acc36=_0x7e6e2c['length'];_0x3200dc<_0x1acc36,_0xd5b98===![];_0x3200dc+=0x1){if(_0xcf761d['indexOf'](_0x7e6e2c[_0x3200dc])>=0x0){_0xd5b98=!![];}}if(!_0xd5b98){throw new Error(util[_0x938e('0x11')](_0x938e('0x16'),_0x4aa27f[_0x938e('0x13')]['pid']));}process['kill'](_0x4aa27f[_0x938e('0x13')][_0x938e('0x14')],_0x938e('0x17'));return _0x56dd07[_0x938e('0xe')](0xc8)[_0x938e('0xc')]({'message':util[_0x938e('0x11')](_0x938e('0x18'),_0x4aa27f[_0x938e('0x13')]['pid'])});})['catch'](handleError(_0x56dd07,null,_0x938e('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 8020a26..d70078f 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 _0xb466=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x3297ce,_0x12d594){var _0x566b08=function(_0x37ba06){while(--_0x37ba06){_0x3297ce['push'](_0x3297ce['shift']());}};_0x566b08(++_0x12d594);}(_0xb466,0x6d));var _0x6b46=function(_0x1a3160,_0x3061a9){_0x1a3160=_0x1a3160-0x0;var _0x3e07cf=_0xb466[_0x1a3160];return _0x3e07cf;};'use strict';var multer=require(_0x6b46('0x0'));var util=require('util');var path=require(_0x6b46('0x1'));var timeout=require(_0x6b46('0x2'));var express=require('express');var router=express[_0x6b46('0x3')]();var fs_extra=require(_0x6b46('0x4'));var auth=require(_0x6b46('0x5'));var interaction=require(_0x6b46('0x6'));var config=require(_0x6b46('0x7'));var controller=require(_0x6b46('0x8'));router[_0x6b46('0x9')]('/',auth[_0x6b46('0xa')](),controller[_0x6b46('0xb')]);router[_0x6b46('0x9')](_0x6b46('0xc'),auth['isAuthenticated'](),controller[_0x6b46('0xd')]);router[_0x6b46('0xe')]('/',auth[_0x6b46('0xa')](),controller[_0x6b46('0xf')]);router[_0x6b46('0x10')]('/:id',auth[_0x6b46('0xa')](),controller[_0x6b46('0x11')]);router[_0x6b46('0x12')](_0x6b46('0xc'),auth['isAuthenticated'](),controller[_0x6b46('0x13')]);module[_0x6b46('0x14')]=router; \ No newline at end of file +var _0x242f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','path'];(function(_0x4b94b2,_0x239ac7){var _0x41f2d6=function(_0xf52012){while(--_0xf52012){_0x4b94b2['push'](_0x4b94b2['shift']());}};_0x41f2d6(++_0x239ac7);}(_0x242f,0x129));var _0xf242=function(_0x38b0f2,_0x23b2b9){_0x38b0f2=_0x38b0f2-0x0;var _0x2ee050=_0x242f[_0x38b0f2];return _0x2ee050;};'use strict';var multer=require(_0xf242('0x0'));var util=require(_0xf242('0x1'));var path=require(_0xf242('0x2'));var timeout=require('connect-timeout');var express=require(_0xf242('0x3'));var router=express[_0xf242('0x4')]();var fs_extra=require(_0xf242('0x5'));var auth=require(_0xf242('0x6'));var interaction=require(_0xf242('0x7'));var config=require(_0xf242('0x8'));var controller=require(_0xf242('0x9'));router[_0xf242('0xa')]('/',auth[_0xf242('0xb')](),controller[_0xf242('0xc')]);router[_0xf242('0xa')](_0xf242('0xd'),auth[_0xf242('0xb')](),controller[_0xf242('0xe')]);router[_0xf242('0xf')]('/',auth[_0xf242('0xb')](),controller['create']);router[_0xf242('0x10')](_0xf242('0xd'),auth[_0xf242('0xb')](),controller[_0xf242('0x11')]);router[_0xf242('0x12')](_0xf242('0xd'),auth[_0xf242('0xb')](),controller[_0xf242('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 394a5a5..fe702f9 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 _0xf1f9=['name','sequelize','exports','STRING'];(function(_0x2aa2ff,_0x573663){var _0x234c17=function(_0x474bad){while(--_0x474bad){_0x2aa2ff['push'](_0x2aa2ff['shift']());}};_0x234c17(++_0x573663);}(_0xf1f9,0x1cd));var _0x9f1f=function(_0x30d6c6,_0x5e51dc){_0x30d6c6=_0x30d6c6-0x0;var _0x4bb109=_0xf1f9[_0x30d6c6];return _0x4bb109;};'use strict';var Sequelize=require(_0x9f1f('0x0'));module[_0x9f1f('0x1')]={'name':{'type':Sequelize[_0x9f1f('0x2')],'unique':_0x9f1f('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x9f1f('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x9f1f('0x2')]}}; \ No newline at end of file +var _0x0565=['name','#0091EA','sequelize','exports','STRING'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x0565,0xf2));var _0x5056=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x0565[_0x2dadb9];return _0x2f0097;};'use strict';var Sequelize=require(_0x5056('0x0'));module[_0x5056('0x1')]={'name':{'type':Sequelize[_0x5056('0x2')],'unique':_0x5056('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x5056('0x2')],'defaultValue':_0x5056('0x4')},'description':{'type':Sequelize[_0x5056('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 75368df..f8b26fd 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 _0x407f=['filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','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','update','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','Tags','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x5c31ba,_0x5b60d9){var _0x3a305f=function(_0x4155a7){while(--_0x4155a7){_0x5c31ba['push'](_0x5c31ba['shift']());}};_0x3a305f(++_0x5b60d9);}(_0x407f,0xc2));var _0xf407=function(_0x7c9f1d,_0x4b7628){_0x7c9f1d=_0x7c9f1d-0x0;var _0x1b24bd=_0x407f[_0x7c9f1d];return _0x1b24bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf407('0x0'));var rp=require(_0xf407('0x1'));var moment=require(_0xf407('0x2'));var BPromise=require(_0xf407('0x3'));var Mustache=require(_0xf407('0x4'));var util=require(_0xf407('0x5'));var path=require(_0xf407('0x6'));var sox=require(_0xf407('0x7'));var csv=require(_0xf407('0x8'));var ejs=require(_0xf407('0x9'));var fs=require('fs');var fs_extra=require(_0xf407('0xa'));var _=require(_0xf407('0xb'));var squel=require(_0xf407('0xc'));var crypto=require(_0xf407('0xd'));var jsforce=require(_0xf407('0xe'));var deskjs=require(_0xf407('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf407('0x10'));var Papa=require(_0xf407('0x11'));var Redis=require(_0xf407('0x12'));var authService=require(_0xf407('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf407('0x14'))(_0xf407('0x15'));var utils=require(_0xf407('0x16'));var config=require(_0xf407('0x17'));var licenseUtil=require(_0xf407('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ee485,_0x3f4ca0){_0x3f4ca0=_0x3f4ca0||0xcc;return function(_0x3b26ae){if(_0x3b26ae){return _0x2ee485[_0xf407('0x19')](_0x3f4ca0);}return _0x2ee485[_0xf407('0x1a')](_0x3f4ca0)[_0xf407('0x1b')]();};}function respondWithResult(_0x242f43,_0x5257ef){_0x5257ef=_0x5257ef||0xc8;return function(_0x5d80ab){if(_0x5d80ab){return _0x242f43['status'](_0x5257ef)[_0xf407('0x1c')](_0x5d80ab);}};}function respondWithFilteredResult(_0x593e36,_0x454710){return function(_0x4c1320){if(_0x4c1320){var _0x48fd5d=typeof _0x454710[_0xf407('0x1d')]===_0xf407('0x1e')&&typeof _0x454710[_0xf407('0x1f')]===_0xf407('0x1e');var _0x351252=_0x4c1320[_0xf407('0x20')];var _0x4ddbe6=_0x48fd5d?0x0:_0x454710[_0xf407('0x1d')];var _0x588fe4=_0x48fd5d?_0x4c1320[_0xf407('0x20')]:_0x454710[_0xf407('0x1d')]+_0x454710[_0xf407('0x1f')];var _0x334c1a;if(_0x588fe4>=_0x351252){_0x588fe4=_0x351252;_0x334c1a=0xc8;}else{_0x334c1a=0xce;}_0x593e36[_0xf407('0x1a')](_0x334c1a);return _0x593e36[_0xf407('0x21')]('Content-Range',_0x4ddbe6+'-'+_0x588fe4+'/'+_0x351252)[_0xf407('0x1c')](_0x4c1320);}return null;};}function patchUpdates(_0x39febd){return function(_0x2f7ed0){try{jsonpatch[_0xf407('0x22')](_0x2f7ed0,_0x39febd,!![]);}catch(_0x4eb0c3){return BPromise[_0xf407('0x23')](_0x4eb0c3);}return _0x2f7ed0[_0xf407('0x24')]();};}function saveUpdates(_0x23659c,_0xa6f11e){return function(_0x5f32bb){if(_0x5f32bb){return _0x5f32bb['update'](_0x23659c)[_0xf407('0x25')](function(_0x100e6e){return _0x100e6e;});}return null;};}function removeEntity(_0x2558a1,_0x2cea00){return function(_0x9406cf){if(_0x9406cf){return _0x9406cf[_0xf407('0x26')]()[_0xf407('0x25')](function(){var _0x5aecf2=_0x9406cf[_0xf407('0x27')]({'plain':!![]});var _0x1996c8=_0xf407('0x28');return db['UserProfileResource'][_0xf407('0x26')]({'where':{'type':_0x1996c8,'resourceId':_0x5aecf2['id']}})[_0xf407('0x25')](function(){return _0x9406cf;});})[_0xf407('0x25')](function(){_0x2558a1[_0xf407('0x1a')](0xcc)[_0xf407('0x1b')]();});}};}function handleEntityNotFound(_0x187c93,_0x524b34){return function(_0x3953c5){if(!_0x3953c5){_0x187c93['sendStatus'](0x194);}return _0x3953c5;};}function handleError(_0x4fc4df,_0x949669){_0x949669=_0x949669||0x1f4;return function(_0x115dce){logger[_0xf407('0x29')](_0x115dce[_0xf407('0x2a')]);if(_0x115dce[_0xf407('0x2b')]){delete _0x115dce[_0xf407('0x2b')];}_0x4fc4df['status'](_0x949669)[_0xf407('0x2c')](_0x115dce);};}exports[_0xf407('0x2d')]=function(_0xa91b61,_0x89915b){var _0x15cd8d={},_0x5e12da={},_0x4a763e={'count':0x0,'rows':[]};var _0xce3a12=_[_0xf407('0x2e')](db[_0xf407('0x2f')][_0xf407('0x30')],function(_0x153287){return{'name':_0x153287[_0xf407('0x31')],'type':_0x153287[_0xf407('0x32')]['key']};});_0x5e12da[_0xf407('0x33')]=_['map'](_0xce3a12,_0xf407('0x2b'));_0x5e12da[_0xf407('0x34')]=_['keys'](_0xa91b61['query']);_0x5e12da['filters']=_[_0xf407('0x35')](_0x5e12da[_0xf407('0x33')],_0x5e12da['query']);_0x15cd8d[_0xf407('0x36')]=_[_0xf407('0x35')](_0x5e12da[_0xf407('0x33')],qs[_0xf407('0x37')](_0xa91b61['query']['fields']));_0x15cd8d[_0xf407('0x36')]=_0x15cd8d[_0xf407('0x36')][_0xf407('0x38')]?_0x15cd8d[_0xf407('0x36')]:_0x5e12da[_0xf407('0x33')];if(!_0xa91b61[_0xf407('0x34')][_0xf407('0x39')](_0xf407('0x3a'))){_0x15cd8d[_0xf407('0x1f')]=qs[_0xf407('0x1f')](_0xa91b61['query'][_0xf407('0x1f')]);_0x15cd8d['offset']=qs[_0xf407('0x1d')](_0xa91b61[_0xf407('0x34')][_0xf407('0x1d')]);}_0x15cd8d[_0xf407('0x3b')]=qs[_0xf407('0x3c')](_0xa91b61['query'][_0xf407('0x3c')]);_0x15cd8d[_0xf407('0x3d')]=qs[_0xf407('0x3e')](_[_0xf407('0x3f')](_0xa91b61['query'],_0x5e12da[_0xf407('0x3e')]),_0xce3a12);if(_0xa91b61[_0xf407('0x34')][_0xf407('0x40')]){_0x15cd8d['where']=_['merge'](_0x15cd8d[_0xf407('0x3d')],{'$or':_['map'](_0xce3a12,function(_0x573fae){if(_0x573fae[_0xf407('0x32')]!==_0xf407('0x41')){var _0x4890ae={};_0x4890ae[_0x573fae[_0xf407('0x2b')]]={'$like':'%'+_0xa91b61[_0xf407('0x34')][_0xf407('0x40')]+'%'};return _0x4890ae;}})});}_0x15cd8d=_[_0xf407('0x42')]({},_0x15cd8d,_0xa91b61[_0xf407('0x43')]);var _0x5c27c4={'where':_0x15cd8d[_0xf407('0x3d')]};return db['Tag']['count'](_0x5c27c4)[_0xf407('0x25')](function(_0x1ddb15){_0x4a763e['count']=_0x1ddb15;if(_0xa91b61[_0xf407('0x34')][_0xf407('0x44')]){_0x15cd8d[_0xf407('0x45')]=[{'all':!![]}];}return db[_0xf407('0x2f')][_0xf407('0x46')](_0x15cd8d);})[_0xf407('0x25')](function(_0x1c8f17){_0x4a763e[_0xf407('0x47')]=_0x1c8f17;return _0x4a763e;})['then'](respondWithFilteredResult(_0x89915b,_0x15cd8d))[_0xf407('0x48')](handleError(_0x89915b,null));};exports['show']=function(_0x2def2e,_0x571188){var _0x444b01={'raw':!![],'where':{'id':_0x2def2e[_0xf407('0x49')]['id']}},_0x56ea2b={};_0x56ea2b[_0xf407('0x33')]=_[_0xf407('0x4a')](db[_0xf407('0x2f')][_0xf407('0x30')]);_0x56ea2b[_0xf407('0x34')]=_[_0xf407('0x4a')](_0x2def2e['query']);_0x56ea2b[_0xf407('0x3e')]=_[_0xf407('0x35')](_0x56ea2b[_0xf407('0x33')],_0x56ea2b[_0xf407('0x34')]);_0x444b01[_0xf407('0x36')]=_[_0xf407('0x35')](_0x56ea2b['model'],qs[_0xf407('0x37')](_0x2def2e[_0xf407('0x34')][_0xf407('0x37')]));_0x444b01[_0xf407('0x36')]=_0x444b01[_0xf407('0x36')][_0xf407('0x38')]?_0x444b01['attributes']:_0x56ea2b[_0xf407('0x33')];if(_0x2def2e[_0xf407('0x34')][_0xf407('0x44')]){_0x444b01['include']=[{'all':!![]}];}_0x444b01=_[_0xf407('0x42')]({},_0x444b01,_0x2def2e['options']);return db[_0xf407('0x2f')][_0xf407('0x4b')](_0x444b01)[_0xf407('0x25')](handleEntityNotFound(_0x571188,null))[_0xf407('0x25')](respondWithResult(_0x571188,null))['catch'](handleError(_0x571188,null));};exports[_0xf407('0x4c')]=function(_0x3b6c44,_0x16cf14){return db['Tag']['create'](_0x3b6c44[_0xf407('0x4d')],{})[_0xf407('0x25')](function(_0x45e9ab){var _0x4799c1=_0x3b6c44[_0xf407('0x4e')][_0xf407('0x27')]({'plain':!![]});if(!_0x4799c1)throw new Error(_0xf407('0x4f'));if(_0x4799c1[_0xf407('0x50')]==='user'){var _0x1282df=_0x45e9ab[_0xf407('0x27')]({'plain':!![]});var _0x4e8483=_0xf407('0x28');return db[_0xf407('0x51')][_0xf407('0x4b')]({'where':{'name':_0x4e8483,'userProfileId':_0x4799c1['userProfileId']},'raw':!![]})[_0xf407('0x25')](function(_0xd168af){if(_0xd168af&&_0xd168af[_0xf407('0x52')]===0x0){return db[_0xf407('0x53')]['create']({'name':_0x1282df[_0xf407('0x2b')],'resourceId':_0x1282df['id'],'type':_0xd168af[_0xf407('0x2b')],'sectionId':_0xd168af['id']},{})['then'](function(){return _0x45e9ab;});}else{return _0x45e9ab;}})[_0xf407('0x48')](function(_0x588fd7){logger[_0xf407('0x29')](_0xf407('0x54'),_0x588fd7);throw _0x588fd7;});}return _0x45e9ab;})['then'](respondWithResult(_0x16cf14,0xc9))[_0xf407('0x48')](handleError(_0x16cf14,null));};exports[_0xf407('0x55')]=function(_0x4b161b,_0x289d00){if(_0x4b161b['body']['id']){delete _0x4b161b['body']['id'];}return db[_0xf407('0x2f')][_0xf407('0x4b')]({'where':{'id':_0x4b161b[_0xf407('0x49')]['id']}})[_0xf407('0x25')](handleEntityNotFound(_0x289d00,null))[_0xf407('0x25')](saveUpdates(_0x4b161b[_0xf407('0x4d')],null))['then'](respondWithResult(_0x289d00,null))['catch'](handleError(_0x289d00,null));};exports[_0xf407('0x26')]=function(_0x34cdf1,_0x417bdd){return db[_0xf407('0x2f')][_0xf407('0x4b')]({'where':{'id':_0x34cdf1[_0xf407('0x49')]['id']}})['then'](handleEntityNotFound(_0x417bdd,null))[_0xf407('0x25')](removeEntity(_0x417bdd,null))[_0xf407('0x48')](handleError(_0x417bdd,null));}; \ No newline at end of file +var _0xd382=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','create','body','user','role','UserProfileSection','find','autoAssociation','error','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','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../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','get','Tags','UserProfileResource','destroy','name','send','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x1e1d07,_0x299b1e){var _0x225dce=function(_0x21fb0a){while(--_0x21fb0a){_0x1e1d07['push'](_0x1e1d07['shift']());}};_0x225dce(++_0x299b1e);}(_0xd382,0x1b6));var _0x2d38=function(_0x12e427,_0x84c666){_0x12e427=_0x12e427-0x0;var _0x237797=_0xd382[_0x12e427];return _0x237797;};'use strict';var emlformat=require(_0x2d38('0x0'));var rimraf=require(_0x2d38('0x1'));var zipdir=require(_0x2d38('0x2'));var jsonpatch=require(_0x2d38('0x3'));var rp=require(_0x2d38('0x4'));var moment=require(_0x2d38('0x5'));var BPromise=require(_0x2d38('0x6'));var Mustache=require(_0x2d38('0x7'));var util=require(_0x2d38('0x8'));var path=require(_0x2d38('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d38('0xa'));var _=require(_0x2d38('0xb'));var squel=require('squel');var crypto=require(_0x2d38('0xc'));var jsforce=require(_0x2d38('0xd'));var deskjs=require(_0x2d38('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2d38('0xf'));var Redis=require(_0x2d38('0x10'));var authService=require(_0x2d38('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2d38('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2d38('0x13'))(_0x2d38('0x14'));var utils=require(_0x2d38('0x15'));var config=require(_0x2d38('0x16'));var licenseUtil=require(_0x2d38('0x17'));var db=require(_0x2d38('0x18'))['db'];function respondWithStatusCode(_0x3c068b,_0x4ed69b){_0x4ed69b=_0x4ed69b||0xcc;return function(_0x3dd2c1){if(_0x3dd2c1){return _0x3c068b[_0x2d38('0x19')](_0x4ed69b);}return _0x3c068b[_0x2d38('0x1a')](_0x4ed69b)[_0x2d38('0x1b')]();};}function respondWithResult(_0x149ac2,_0x5cc0a4){_0x5cc0a4=_0x5cc0a4||0xc8;return function(_0x1c7c1d){if(_0x1c7c1d){return _0x149ac2[_0x2d38('0x1a')](_0x5cc0a4)[_0x2d38('0x1c')](_0x1c7c1d);}};}function respondWithFilteredResult(_0x1a2e74,_0x408141){return function(_0xf346b2){if(_0xf346b2){var _0xc6de5a=typeof _0x408141[_0x2d38('0x1d')]===_0x2d38('0x1e')&&typeof _0x408141[_0x2d38('0x1f')]===_0x2d38('0x1e');var _0x13b3fd=_0xf346b2[_0x2d38('0x20')];var _0x1e3028=_0xc6de5a?0x0:_0x408141[_0x2d38('0x1d')];var _0x9904e0=_0xc6de5a?_0xf346b2['count']:_0x408141[_0x2d38('0x1d')]+_0x408141[_0x2d38('0x1f')];var _0x508b8b;if(_0x9904e0>=_0x13b3fd){_0x9904e0=_0x13b3fd;_0x508b8b=0xc8;}else{_0x508b8b=0xce;}_0x1a2e74[_0x2d38('0x1a')](_0x508b8b);return _0x1a2e74[_0x2d38('0x21')](_0x2d38('0x22'),_0x1e3028+'-'+_0x9904e0+'/'+_0x13b3fd)['json'](_0xf346b2);}return null;};}function patchUpdates(_0x46f8be){return function(_0x5ed42e){try{jsonpatch['apply'](_0x5ed42e,_0x46f8be,!![]);}catch(_0xed190){return BPromise[_0x2d38('0x23')](_0xed190);}return _0x5ed42e[_0x2d38('0x24')]();};}function saveUpdates(_0x3892a5,_0x19e658){return function(_0x3138bc){if(_0x3138bc){return _0x3138bc[_0x2d38('0x25')](_0x3892a5)[_0x2d38('0x26')](function(_0x24e2cb){return _0x24e2cb;});}return null;};}function removeEntity(_0x383a0e,_0x584e1f){return function(_0x3283b4){if(_0x3283b4){return _0x3283b4['destroy']()[_0x2d38('0x26')](function(){var _0x530fd9=_0x3283b4[_0x2d38('0x27')]({'plain':!![]});var _0xfa9bd=_0x2d38('0x28');return db[_0x2d38('0x29')][_0x2d38('0x2a')]({'where':{'type':_0xfa9bd,'resourceId':_0x530fd9['id']}})[_0x2d38('0x26')](function(){return _0x3283b4;});})[_0x2d38('0x26')](function(){_0x383a0e['status'](0xcc)[_0x2d38('0x1b')]();});}};}function handleEntityNotFound(_0x3f0f7a,_0x34599a){return function(_0x3d18cd){if(!_0x3d18cd){_0x3f0f7a[_0x2d38('0x19')](0x194);}return _0x3d18cd;};}function handleError(_0xe73710,_0x81299c){_0x81299c=_0x81299c||0x1f4;return function(_0x3a6437){logger['error'](_0x3a6437['stack']);if(_0x3a6437['name']){delete _0x3a6437[_0x2d38('0x2b')];}_0xe73710[_0x2d38('0x1a')](_0x81299c)[_0x2d38('0x2c')](_0x3a6437);};}exports['index']=function(_0x29a38c,_0x4b5891){var _0x2b84cc={},_0x210283={},_0x11e27b={'count':0x0,'rows':[]};var _0x4e8674=_[_0x2d38('0x2d')](db[_0x2d38('0x2e')][_0x2d38('0x2f')],function(_0x52a3ce){return{'name':_0x52a3ce[_0x2d38('0x30')],'type':_0x52a3ce[_0x2d38('0x31')][_0x2d38('0x32')]};});_0x210283[_0x2d38('0x33')]=_[_0x2d38('0x2d')](_0x4e8674,_0x2d38('0x2b'));_0x210283['query']=_[_0x2d38('0x34')](_0x29a38c[_0x2d38('0x35')]);_0x210283[_0x2d38('0x36')]=_[_0x2d38('0x37')](_0x210283['model'],_0x210283[_0x2d38('0x35')]);_0x2b84cc[_0x2d38('0x38')]=_[_0x2d38('0x37')](_0x210283[_0x2d38('0x33')],qs[_0x2d38('0x39')](_0x29a38c[_0x2d38('0x35')][_0x2d38('0x39')]));_0x2b84cc[_0x2d38('0x38')]=_0x2b84cc[_0x2d38('0x38')][_0x2d38('0x3a')]?_0x2b84cc['attributes']:_0x210283['model'];if(!_0x29a38c[_0x2d38('0x35')][_0x2d38('0x3b')](_0x2d38('0x3c'))){_0x2b84cc[_0x2d38('0x1f')]=qs[_0x2d38('0x1f')](_0x29a38c[_0x2d38('0x35')][_0x2d38('0x1f')]);_0x2b84cc[_0x2d38('0x1d')]=qs[_0x2d38('0x1d')](_0x29a38c[_0x2d38('0x35')][_0x2d38('0x1d')]);}_0x2b84cc[_0x2d38('0x3d')]=qs[_0x2d38('0x3e')](_0x29a38c['query'][_0x2d38('0x3e')]);_0x2b84cc[_0x2d38('0x3f')]=qs[_0x2d38('0x36')](_[_0x2d38('0x40')](_0x29a38c['query'],_0x210283[_0x2d38('0x36')]),_0x4e8674);if(_0x29a38c[_0x2d38('0x35')][_0x2d38('0x41')]){_0x2b84cc[_0x2d38('0x3f')]=_[_0x2d38('0x42')](_0x2b84cc[_0x2d38('0x3f')],{'$or':_[_0x2d38('0x2d')](_0x4e8674,function(_0x1084a5){if(_0x1084a5[_0x2d38('0x31')]!==_0x2d38('0x43')){var _0x3cd072={};_0x3cd072[_0x1084a5[_0x2d38('0x2b')]]={'$like':'%'+_0x29a38c[_0x2d38('0x35')][_0x2d38('0x41')]+'%'};return _0x3cd072;}})});}_0x2b84cc=_['merge']({},_0x2b84cc,_0x29a38c[_0x2d38('0x44')]);var _0x1db297={'where':_0x2b84cc['where']};return db['Tag'][_0x2d38('0x20')](_0x1db297)[_0x2d38('0x26')](function(_0x28110c){_0x11e27b['count']=_0x28110c;if(_0x29a38c[_0x2d38('0x35')][_0x2d38('0x45')]){_0x2b84cc[_0x2d38('0x46')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x2b84cc);})[_0x2d38('0x26')](function(_0x59de7d){_0x11e27b[_0x2d38('0x47')]=_0x59de7d;return _0x11e27b;})[_0x2d38('0x26')](respondWithFilteredResult(_0x4b5891,_0x2b84cc))[_0x2d38('0x48')](handleError(_0x4b5891,null));};exports['show']=function(_0x50cb25,_0x166af1){var _0x907c4f={'raw':!![],'where':{'id':_0x50cb25['params']['id']}},_0x306d6d={};_0x306d6d[_0x2d38('0x33')]=_[_0x2d38('0x34')](db[_0x2d38('0x2e')]['rawAttributes']);_0x306d6d[_0x2d38('0x35')]=_[_0x2d38('0x34')](_0x50cb25[_0x2d38('0x35')]);_0x306d6d['filters']=_['intersection'](_0x306d6d[_0x2d38('0x33')],_0x306d6d[_0x2d38('0x35')]);_0x907c4f[_0x2d38('0x38')]=_[_0x2d38('0x37')](_0x306d6d['model'],qs[_0x2d38('0x39')](_0x50cb25[_0x2d38('0x35')][_0x2d38('0x39')]));_0x907c4f['attributes']=_0x907c4f[_0x2d38('0x38')]['length']?_0x907c4f['attributes']:_0x306d6d[_0x2d38('0x33')];if(_0x50cb25[_0x2d38('0x35')][_0x2d38('0x45')]){_0x907c4f[_0x2d38('0x46')]=[{'all':!![]}];}_0x907c4f=_['merge']({},_0x907c4f,_0x50cb25['options']);return db[_0x2d38('0x2e')]['find'](_0x907c4f)[_0x2d38('0x26')](handleEntityNotFound(_0x166af1,null))[_0x2d38('0x26')](respondWithResult(_0x166af1,null))[_0x2d38('0x48')](handleError(_0x166af1,null));};exports[_0x2d38('0x49')]=function(_0x35a2ae,_0x1b94de){return db[_0x2d38('0x2e')][_0x2d38('0x49')](_0x35a2ae[_0x2d38('0x4a')],{})['then'](function(_0x218c61){var _0x481320=_0x35a2ae[_0x2d38('0x4b')][_0x2d38('0x27')]({'plain':!![]});if(!_0x481320)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x481320[_0x2d38('0x4c')]===_0x2d38('0x4b')){var _0x187ba3=_0x218c61[_0x2d38('0x27')]({'plain':!![]});var _0x275078=_0x2d38('0x28');return db[_0x2d38('0x4d')][_0x2d38('0x4e')]({'where':{'name':_0x275078,'userProfileId':_0x481320['userProfileId']},'raw':!![]})[_0x2d38('0x26')](function(_0x8d781e){if(_0x8d781e&&_0x8d781e[_0x2d38('0x4f')]===0x0){return db[_0x2d38('0x29')][_0x2d38('0x49')]({'name':_0x187ba3[_0x2d38('0x2b')],'resourceId':_0x187ba3['id'],'type':_0x8d781e[_0x2d38('0x2b')],'sectionId':_0x8d781e['id']},{})[_0x2d38('0x26')](function(){return _0x218c61;});}else{return _0x218c61;}})[_0x2d38('0x48')](function(_0x5c7dd5){logger[_0x2d38('0x50')](_0x2d38('0x51'),_0x5c7dd5);throw _0x5c7dd5;});}return _0x218c61;})['then'](respondWithResult(_0x1b94de,0xc9))['catch'](handleError(_0x1b94de,null));};exports[_0x2d38('0x25')]=function(_0x5ba127,_0x208ae0){if(_0x5ba127[_0x2d38('0x4a')]['id']){delete _0x5ba127['body']['id'];}return db['Tag'][_0x2d38('0x4e')]({'where':{'id':_0x5ba127[_0x2d38('0x52')]['id']}})[_0x2d38('0x26')](handleEntityNotFound(_0x208ae0,null))[_0x2d38('0x26')](saveUpdates(_0x5ba127[_0x2d38('0x4a')],null))[_0x2d38('0x26')](respondWithResult(_0x208ae0,null))[_0x2d38('0x48')](handleError(_0x208ae0,null));};exports[_0x2d38('0x2a')]=function(_0x1348f8,_0x24c107){return db[_0x2d38('0x2e')]['find']({'where':{'id':_0x1348f8[_0x2d38('0x52')]['id']}})['then'](handleEntityNotFound(_0x24c107,null))['then'](removeEntity(_0x24c107,null))[_0x2d38('0x48')](handleError(_0x24c107,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 5fe4f3a..1d2bdc8 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 _0x176d=['../../config/environment','./tag.attributes','exports','define','Tag','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x2c645b,_0x313fd4){var _0x511ba8=function(_0x2ec9bd){while(--_0x2ec9bd){_0x2c645b['push'](_0x2c645b['shift']());}};_0x511ba8(++_0x313fd4);}(_0x176d,0x16d));var _0xd176=function(_0x186aa1,_0x2dc40c){_0x186aa1=_0x186aa1-0x0;var _0x355f9b=_0x176d[_0x186aa1];return _0x355f9b;};'use strict';var _=require(_0xd176('0x0'));var util=require(_0xd176('0x1'));var logger=require(_0xd176('0x2'))(_0xd176('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd176('0x4'));var fs=require('fs');var path=require(_0xd176('0x5'));var rimraf=require(_0xd176('0x6'));var config=require(_0xd176('0x7'));var attributes=require(_0xd176('0x8'));module[_0xd176('0x9')]=function(_0x8ef23e,_0x4cbcba){return _0x8ef23e[_0xd176('0xa')](_0xd176('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09b2=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags'];(function(_0x2536e0,_0x5c5e3f){var _0x50d1d9=function(_0x132a98){while(--_0x132a98){_0x2536e0['push'](_0x2536e0['shift']());}};_0x50d1d9(++_0x5c5e3f);}(_0x09b2,0x150));var _0x209b=function(_0xd0f620,_0x30033a){_0xd0f620=_0xd0f620-0x0;var _0x3c1a3a=_0x09b2[_0xd0f620];return _0x3c1a3a;};'use strict';var _=require(_0x209b('0x0'));var util=require(_0x209b('0x1'));var logger=require(_0x209b('0x2'))(_0x209b('0x3'));var moment=require('moment');var BPromise=require(_0x209b('0x4'));var rp=require(_0x209b('0x5'));var fs=require('fs');var path=require(_0x209b('0x6'));var rimraf=require(_0x209b('0x7'));var config=require(_0x209b('0x8'));var attributes=require(_0x209b('0x9'));module[_0x209b('0xa')]=function(_0x3a8835,_0x48d409){return _0x3a8835[_0x209b('0xb')](_0x209b('0xc'),attributes,{'tableName':_0x209b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 51831a3..f4fa9b0 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 _0x54f3=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','then','info','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','util'];(function(_0x5db506,_0x3026cb){var _0x2a67cb=function(_0x3f8ef4){while(--_0x3f8ef4){_0x5db506['push'](_0x5db506['shift']());}};_0x2a67cb(++_0x3026cb);}(_0x54f3,0x120));var _0x354f=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x54f3[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0x354f('0x0'));var moment=require(_0x354f('0x1'));var BPromise=require(_0x354f('0x2'));var rs=require(_0x354f('0x3'));var fs=require('fs');var Redis=require(_0x354f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x354f('0x5'))(_0x354f('0x6'));var config=require(_0x354f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x354f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51cd16,_0x1da503,_0x4311ad){return new BPromise(function(_0x2f111a,_0x173e1d){return client['request'](_0x51cd16,_0x4311ad)[_0x354f('0x9')](function(_0x5d1e5d){logger[_0x354f('0xa')](_0x354f('0xb'),_0x1da503,'request\x20sent');logger['debug'](_0x354f('0xc'),_0x1da503,_0x354f('0xd'),JSON['stringify'](_0x5d1e5d));if(_0x5d1e5d[_0x354f('0xe')]){if(_0x5d1e5d[_0x354f('0xe')]['code']===0x1f4){logger[_0x354f('0xe')](_0x354f('0xb'),_0x1da503,_0x5d1e5d[_0x354f('0xe')][_0x354f('0xf')]);return _0x173e1d(_0x5d1e5d[_0x354f('0xe')][_0x354f('0xf')]);}logger[_0x354f('0xe')]('Tag,\x20%s,\x20%s',_0x1da503,_0x5d1e5d[_0x354f('0xe')][_0x354f('0xf')]);return _0x2f111a(_0x5d1e5d[_0x354f('0xe')]['message']);}else{logger[_0x354f('0xa')](_0x354f('0xb'),_0x1da503,_0x354f('0xd'));_0x2f111a(_0x5d1e5d['result']['message']);}})[_0x354f('0x10')](function(_0x1d7627){logger[_0x354f('0xe')](_0x354f('0xb'),_0x1da503,_0x1d7627);_0x173e1d(_0x1d7627);});});} \ No newline at end of file +var _0x7341=['debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x5844e6,_0x38a107){var _0x53e56e=function(_0x4902ed){while(--_0x4902ed){_0x5844e6['push'](_0x5844e6['shift']());}};_0x53e56e(++_0x38a107);}(_0x7341,0xe4));var _0x1734=function(_0x10a350,_0x3c0b79){_0x10a350=_0x10a350-0x0;var _0x53f034=_0x7341[_0x10a350];return _0x53f034;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1734('0x0'));var BPromise=require('bluebird');var rs=require(_0x1734('0x1'));var fs=require('fs');var Redis=require(_0x1734('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1734('0x3'));var logger=require(_0x1734('0x4'))(_0x1734('0x5'));var config=require(_0x1734('0x6'));var jayson=require(_0x1734('0x7'));var client=jayson[_0x1734('0x8')][_0x1734('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c7349,_0x1ca30b,_0x2c223d){return new BPromise(function(_0x45c529,_0x5b8977){return client[_0x1734('0xa')](_0x4c7349,_0x2c223d)['then'](function(_0x56f0d5){logger[_0x1734('0xb')](_0x1734('0xc'),_0x1ca30b,_0x1734('0xd'));logger[_0x1734('0xe')](_0x1734('0xf'),_0x1ca30b,_0x1734('0xd'),JSON[_0x1734('0x10')](_0x56f0d5));if(_0x56f0d5[_0x1734('0x11')]){if(_0x56f0d5[_0x1734('0x11')][_0x1734('0x12')]===0x1f4){logger['error'](_0x1734('0xc'),_0x1ca30b,_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);return _0x5b8977(_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);}logger[_0x1734('0x11')](_0x1734('0xc'),_0x1ca30b,_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);return _0x45c529(_0x56f0d5[_0x1734('0x11')][_0x1734('0x13')]);}else{logger[_0x1734('0xb')](_0x1734('0xc'),_0x1ca30b,_0x1734('0xd'));_0x45c529(_0x56f0d5[_0x1734('0x14')][_0x1734('0x13')]);}})[_0x1734('0x15')](function(_0x1ea188){logger[_0x1734('0x11')]('Tag,\x20%s,\x20%s',_0x1ca30b,_0x1ea188);_0x5b8977(_0x1ea188);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 568405c..119b957 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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 20807a0..6af4508 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 _0xd8b0=['exports','sequelize'];(function(_0x57255c,_0x513036){var _0xf58e8e=function(_0x2a6ece){while(--_0x2a6ece){_0x57255c['push'](_0x57255c['shift']());}};_0xf58e8e(++_0x513036);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x247bd8,_0x343a69){var _0x45d68b=function(_0x3358d5){while(--_0x3358d5){_0x247bd8['push'](_0x247bd8['shift']());}};_0x45d68b(++_0x343a69);}(_0xb10b,0x12a));var _0xbb10=function(_0x20e882,_0x16185c){_0x20e882=_0x20e882-0x0;var _0x3e0dbe=_0xb10b[_0x20e882];return _0x3e0dbe;};'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 4adbb62..4d83de0 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 _0x1450=['interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','UserVoicePrefix','addAgents','spread','removeAgents','Queue:remove','getAgents','nolimit','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','offset','limit','count','set','reject','save','update','then','error','stack','name','send','map','Team','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','rawAttributes','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','sequelize','transaction','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','destroy','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queues','addQueues','isValidChannel','add','ids','removeQueues','remove','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','TeamVoiceQueue','User','Queue','findOrCreate','QueueId','online','voicePause'];(function(_0x5f03ed,_0x3cde1a){var _0x2a8eb3=function(_0x3026e9){while(--_0x3026e9){_0x5f03ed['push'](_0x5f03ed['shift']());}};_0x2a8eb3(++_0x3cde1a);}(_0x1450,0x1df));var _0x0145=function(_0x2a40f4,_0x3383bf){_0x2a40f4=_0x2a40f4-0x0;var _0x203c70=_0x1450[_0x2a40f4];return _0x203c70;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0145('0x0'));var zipdir=require(_0x0145('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0145('0x2'));var moment=require(_0x0145('0x3'));var BPromise=require(_0x0145('0x4'));var Mustache=require('mustache');var util=require(_0x0145('0x5'));var path=require(_0x0145('0x6'));var sox=require(_0x0145('0x7'));var csv=require(_0x0145('0x8'));var ejs=require(_0x0145('0x9'));var fs=require('fs');var fs_extra=require(_0x0145('0xa'));var _=require(_0x0145('0xb'));var squel=require(_0x0145('0xc'));var crypto=require('crypto');var jsforce=require(_0x0145('0xd'));var deskjs=require(_0x0145('0xe'));var toCsv=require(_0x0145('0x8'));var querystring=require(_0x0145('0xf'));var Papa=require(_0x0145('0x10'));var Redis=require('ioredis');var authService=require(_0x0145('0x11'));var qs=require(_0x0145('0x12'));var as=require(_0x0145('0x13'));var hardwareService=require(_0x0145('0x14'));var logger=require(_0x0145('0x15'))(_0x0145('0x16'));var utils=require(_0x0145('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0145('0x18'))['db'];config[_0x0145('0x19')]=_[_0x0145('0x1a')](config['redis'],{'host':_0x0145('0x1b'),'port':0x18eb});var socket=require(_0x0145('0x1c'))(new Redis(config[_0x0145('0x19')]));require(_0x0145('0x1d'))[_0x0145('0x1e')](socket);function respondWithStatusCode(_0x1bfec7,_0x2e0b41){_0x2e0b41=_0x2e0b41||0xcc;return function(_0x2fa37b){if(_0x2fa37b){return _0x1bfec7['sendStatus'](_0x2e0b41);}return _0x1bfec7[_0x0145('0x1f')](_0x2e0b41)[_0x0145('0x20')]();};}function respondWithResult(_0x570457,_0x5836c0){_0x5836c0=_0x5836c0||0xc8;return function(_0x36ed69){if(_0x36ed69){return _0x570457[_0x0145('0x1f')](_0x5836c0)[_0x0145('0x21')](_0x36ed69);}};}function respondWithFilteredResult(_0x2095cb,_0x34b2f5){return function(_0x58fda1){if(_0x58fda1){var _0x31c663=typeof _0x34b2f5[_0x0145('0x22')]==='undefined'&&typeof _0x34b2f5[_0x0145('0x23')]==='undefined';var _0x2d7160=_0x58fda1[_0x0145('0x24')];var _0x1318d7=_0x31c663?0x0:_0x34b2f5[_0x0145('0x22')];var _0x21d5e6=_0x31c663?_0x58fda1['count']:_0x34b2f5[_0x0145('0x22')]+_0x34b2f5[_0x0145('0x23')];var _0x3072f3;if(_0x21d5e6>=_0x2d7160){_0x21d5e6=_0x2d7160;_0x3072f3=0xc8;}else{_0x3072f3=0xce;}_0x2095cb[_0x0145('0x1f')](_0x3072f3);return _0x2095cb[_0x0145('0x25')]('Content-Range',_0x1318d7+'-'+_0x21d5e6+'/'+_0x2d7160)[_0x0145('0x21')](_0x58fda1);}return null;};}function patchUpdates(_0x1f5640){return function(_0x3f6699){try{jsonpatch['apply'](_0x3f6699,_0x1f5640,!![]);}catch(_0x3d3ba9){return BPromise[_0x0145('0x26')](_0x3d3ba9);}return _0x3f6699[_0x0145('0x27')]();};}function saveUpdates(_0x45ac0c,_0xc0ec39){return function(_0x4bdc97){if(_0x4bdc97){return _0x4bdc97[_0x0145('0x28')](_0x45ac0c)[_0x0145('0x29')](function(_0xbf16dd){return _0xbf16dd;});}return null;};}function handleEntityNotFound(_0x51f07f,_0xfb36fa){return function(_0x105237){if(!_0x105237){_0x51f07f['sendStatus'](0x194);}return _0x105237;};}function handleError(_0x50b507,_0x17cd16){_0x17cd16=_0x17cd16||0x1f4;return function(_0x1f52d7){logger[_0x0145('0x2a')](_0x1f52d7[_0x0145('0x2b')]);if(_0x1f52d7[_0x0145('0x2c')]){delete _0x1f52d7[_0x0145('0x2c')];}_0x50b507['status'](_0x17cd16)[_0x0145('0x2d')](_0x1f52d7);};}exports['index']=function(_0x5425ba,_0x59f6c4){var _0x41280a={},_0x29ba47={},_0x4903e5={'count':0x0,'rows':[]};var _0x324435=_[_0x0145('0x2e')](db[_0x0145('0x2f')]['rawAttributes'],function(_0xaf1fe){return{'name':_0xaf1fe[_0x0145('0x30')],'type':_0xaf1fe[_0x0145('0x31')][_0x0145('0x32')]};});_0x29ba47[_0x0145('0x33')]=_[_0x0145('0x2e')](_0x324435,'name');_0x29ba47[_0x0145('0x34')]=_[_0x0145('0x35')](_0x5425ba[_0x0145('0x34')]);_0x29ba47[_0x0145('0x36')]=_[_0x0145('0x37')](_0x29ba47[_0x0145('0x33')],_0x29ba47[_0x0145('0x34')]);_0x41280a[_0x0145('0x38')]=_[_0x0145('0x37')](_0x29ba47[_0x0145('0x33')],qs['fields'](_0x5425ba[_0x0145('0x34')][_0x0145('0x39')]));_0x41280a[_0x0145('0x38')]=_0x41280a[_0x0145('0x38')][_0x0145('0x3a')]?_0x41280a[_0x0145('0x38')]:_0x29ba47[_0x0145('0x33')];if(!_0x5425ba[_0x0145('0x34')][_0x0145('0x3b')]('nolimit')){_0x41280a[_0x0145('0x23')]=qs[_0x0145('0x23')](_0x5425ba[_0x0145('0x34')][_0x0145('0x23')]);_0x41280a[_0x0145('0x22')]=qs[_0x0145('0x22')](_0x5425ba['query'][_0x0145('0x22')]);}_0x41280a[_0x0145('0x3c')]=qs[_0x0145('0x3d')](_0x5425ba[_0x0145('0x34')]['sort']);_0x41280a[_0x0145('0x3e')]=qs[_0x0145('0x36')](_[_0x0145('0x3f')](_0x5425ba[_0x0145('0x34')],_0x29ba47[_0x0145('0x36')]),_0x324435);if(_0x5425ba['query'][_0x0145('0x40')]){_0x41280a[_0x0145('0x3e')]=_[_0x0145('0x41')](_0x41280a['where'],{'$or':_[_0x0145('0x2e')](_0x324435,function(_0x1190ab){if(_0x1190ab[_0x0145('0x31')]!=='VIRTUAL'){var _0x42c847={};_0x42c847[_0x1190ab[_0x0145('0x2c')]]={'$like':'%'+_0x5425ba[_0x0145('0x34')][_0x0145('0x40')]+'%'};return _0x42c847;}})});}_0x41280a=_[_0x0145('0x41')]({},_0x41280a,_0x5425ba[_0x0145('0x42')]);var _0x389b75={'where':_0x41280a[_0x0145('0x3e')]};return db['Team'][_0x0145('0x24')](_0x389b75)[_0x0145('0x29')](function(_0x2b7fd8){_0x4903e5[_0x0145('0x24')]=_0x2b7fd8;if(_0x5425ba[_0x0145('0x34')][_0x0145('0x43')]){_0x41280a[_0x0145('0x44')]=[{'all':!![]}];}return db[_0x0145('0x2f')][_0x0145('0x45')](_0x41280a);})[_0x0145('0x29')](function(_0x1ffc05){_0x4903e5['rows']=_0x1ffc05;return _0x4903e5;})[_0x0145('0x29')](respondWithFilteredResult(_0x59f6c4,_0x41280a))['catch'](handleError(_0x59f6c4,null));};exports[_0x0145('0x46')]=function(_0x165220,_0x4bd57f){var _0x916057={'raw':![],'where':{'id':_0x165220['params']['id']}},_0x26f45a={};_0x26f45a[_0x0145('0x33')]=_[_0x0145('0x35')](db[_0x0145('0x2f')][_0x0145('0x47')]);_0x26f45a[_0x0145('0x34')]=_[_0x0145('0x35')](_0x165220[_0x0145('0x34')]);_0x26f45a[_0x0145('0x36')]=_[_0x0145('0x37')](_0x26f45a[_0x0145('0x33')],_0x26f45a[_0x0145('0x34')]);_0x916057[_0x0145('0x38')]=_['intersection'](_0x26f45a[_0x0145('0x33')],qs[_0x0145('0x39')](_0x165220[_0x0145('0x34')][_0x0145('0x39')]));_0x916057[_0x0145('0x38')]=_0x916057[_0x0145('0x38')][_0x0145('0x3a')]?_0x916057[_0x0145('0x38')]:_0x26f45a['model'];if(_0x165220[_0x0145('0x34')][_0x0145('0x43')]){_0x916057[_0x0145('0x44')]=[{'all':!![]}];}_0x916057=_[_0x0145('0x41')]({},_0x916057,_0x165220['options']);return db[_0x0145('0x2f')][_0x0145('0x48')](_0x916057)[_0x0145('0x29')](handleEntityNotFound(_0x4bd57f,null))[_0x0145('0x29')](respondWithResult(_0x4bd57f,null))[_0x0145('0x49')](handleError(_0x4bd57f,null));};exports[_0x0145('0x4a')]=function(_0x44816a,_0x5e8a39){return db[_0x0145('0x2f')][_0x0145('0x4a')](_0x44816a[_0x0145('0x4b')],{})[_0x0145('0x29')](function(_0x308f3f){var _0x39f4bd=_0x44816a[_0x0145('0x4c')][_0x0145('0x4d')]({'plain':!![]});if(!_0x39f4bd)throw new Error(_0x0145('0x4e'));if(_0x39f4bd[_0x0145('0x4f')]===_0x0145('0x4c')){var _0x588340=_0x308f3f[_0x0145('0x4d')]({'plain':!![]});var _0xd1eb53='Teams';return db[_0x0145('0x50')]['find']({'where':{'name':_0xd1eb53,'userProfileId':_0x39f4bd['userProfileId']},'raw':!![]})[_0x0145('0x29')](function(_0x317185){if(_0x317185&&_0x317185[_0x0145('0x51')]===0x0){return db[_0x0145('0x52')][_0x0145('0x4a')]({'name':_0x588340[_0x0145('0x2c')],'resourceId':_0x588340['id'],'type':_0x317185[_0x0145('0x2c')],'sectionId':_0x317185['id']},{})[_0x0145('0x29')](function(){return _0x308f3f;});}else{return _0x308f3f;}})[_0x0145('0x49')](function(_0x4a90fd){logger[_0x0145('0x2a')](_0x0145('0x53'),_0x4a90fd);throw _0x4a90fd;});}return _0x308f3f;})['then'](respondWithResult(_0x5e8a39,0xc9))['catch'](handleError(_0x5e8a39,null));};exports[_0x0145('0x28')]=function(_0xe757b6,_0x35b47b){if(_0xe757b6[_0x0145('0x4b')]['id']){delete _0xe757b6[_0x0145('0x4b')]['id'];}return db['Team'][_0x0145('0x48')]({'where':{'id':_0xe757b6[_0x0145('0x54')]['id']}})[_0x0145('0x29')](handleEntityNotFound(_0x35b47b,null))['then'](saveUpdates(_0xe757b6[_0x0145('0x4b')],null))[_0x0145('0x29')](respondWithResult(_0x35b47b,null))['catch'](handleError(_0x35b47b,null));};exports['destroy']=function(_0x228a24,_0x2c2719){var _0x5e23bb=_0x228a24[_0x0145('0x54')]['id'];var _0x216d3d=[];return db[_0x0145('0x55')][_0x0145('0x56')](function(_0x449e27){var _0x491f20='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x5e23bb;return db[_0x0145('0x55')][_0x0145('0x34')](_0x491f20,{'type':db[_0x0145('0x57')][_0x0145('0x58')]['SELECT'],'raw':!![],'transaction':_0x449e27})['then'](function(_0x5bb073){_0x216d3d=_[_0x0145('0x2e')](_0x5bb073,function(_0x58eb35){return Number(_0x58eb35[_0x0145('0x59')]);});})[_0x0145('0x29')](function(){var _0x30dc53=_0x0145('0x5a')+_0x5e23bb;return db['sequelize']['query'](_0x30dc53,{'type':db[_0x0145('0x57')][_0x0145('0x58')][_0x0145('0x5b')],'raw':!![],'transaction':_0x449e27});})[_0x0145('0x29')](function(_0x493573){var _0x32ecdb=_[_0x0145('0x2e')](_0x493573,function(_0x4fb2de){return Number(_0x4fb2de[_0x0145('0x5c')]);});return db[_0x0145('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x216d3d},'VoiceQueueId':{'$in':_0x32ecdb}},'transaction':_0x449e27});})['then'](function(){var _0x34d1fb=_0x0145('0x5e')+_0x5e23bb;return db[_0x0145('0x55')][_0x0145('0x34')](_0x34d1fb,{'type':db[_0x0145('0x57')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x449e27});})['then'](function(_0xe46cde){var _0x2cb7d1=_[_0x0145('0x2e')](_0xe46cde,function(_0x2a04ea){return Number(_0x2a04ea[_0x0145('0x5f')]);});return db[_0x0145('0x60')][_0x0145('0x61')]({'where':{'UserId':{'$in':_0x216d3d},'MailQueueId':{'$in':_0x2cb7d1}},'transaction':_0x449e27});})[_0x0145('0x29')](function(){var _0x200cc9=_0x0145('0x62')+_0x5e23bb;return db['sequelize']['query'](_0x200cc9,{'type':db[_0x0145('0x57')][_0x0145('0x58')]['SELECT'],'raw':!![],'transaction':_0x449e27});})['then'](function(_0x58f7d8){var _0x32cc9c=_['map'](_0x58f7d8,function(_0x399d73){return Number(_0x399d73['SmsQueueId']);});return db['UserSmsQueue'][_0x0145('0x61')]({'where':{'UserId':{'$in':_0x216d3d},'SmsQueueId':{'$in':_0x32cc9c}},'transaction':_0x449e27});})['then'](function(){var _0x1e7543=_0x0145('0x63')+_0x5e23bb;return db['sequelize'][_0x0145('0x34')](_0x1e7543,{'type':db[_0x0145('0x57')]['QueryTypes'][_0x0145('0x5b')],'raw':!![],'transaction':_0x449e27});})[_0x0145('0x29')](function(_0x2c67a0){var _0x423778=_['map'](_0x2c67a0,function(_0x580e88){return Number(_0x580e88['ChatQueueId']);});return db['UserChatQueue'][_0x0145('0x61')]({'where':{'UserId':{'$in':_0x216d3d},'ChatQueueId':{'$in':_0x423778}},'transaction':_0x449e27});})[_0x0145('0x29')](function(){var _0x3825e3=_0x0145('0x64')+_0x5e23bb;return db[_0x0145('0x55')]['query'](_0x3825e3,{'type':db[_0x0145('0x57')][_0x0145('0x58')][_0x0145('0x5b')],'raw':!![],'transaction':_0x449e27});})[_0x0145('0x29')](function(_0x4d8c92){var _0x20508e=_[_0x0145('0x2e')](_0x4d8c92,function(_0x30da67){return Number(_0x30da67[_0x0145('0x65')]);});return db[_0x0145('0x66')]['destroy']({'where':{'UserId':{'$in':_0x216d3d},'FaxQueueId':{'$in':_0x20508e}},'transaction':_0x449e27});})[_0x0145('0x29')](function(){var _0x18c1df=_0x0145('0x67')+_0x5e23bb;return db['sequelize'][_0x0145('0x34')](_0x18c1df,{'type':db[_0x0145('0x57')]['QueryTypes'][_0x0145('0x5b')],'raw':!![],'transaction':_0x449e27});})[_0x0145('0x29')](function(_0x43b9c3){var _0x58097d=_[_0x0145('0x2e')](_0x43b9c3,function(_0x56fd73){return Number(_0x56fd73[_0x0145('0x68')]);});return db['UserOpenchannelQueue'][_0x0145('0x61')]({'where':{'UserId':{'$in':_0x216d3d},'OpenchannelQueueId':{'$in':_0x58097d}},'transaction':_0x449e27});})['then'](function(){var _0x22edf8=_0x0145('0x69')+_0x5e23bb;return db[_0x0145('0x55')][_0x0145('0x34')](_0x22edf8,{'type':db[_0x0145('0x57')][_0x0145('0x58')]['SELECT'],'raw':!![],'transaction':_0x449e27});})[_0x0145('0x29')](function(_0x4eb02b){var _0x5577c8=_[_0x0145('0x2e')](_0x4eb02b,function(_0xc40e41){return Number(_0xc40e41[_0x0145('0x6a')]);});return db[_0x0145('0x6b')][_0x0145('0x61')]({'where':{'UserId':{'$in':_0x216d3d},'WhatsappQueueId':{'$in':_0x5577c8}},'transaction':_0x449e27});})[_0x0145('0x29')](function(){return db[_0x0145('0x6c')][_0x0145('0x48')]({'where':{'TeamId':_0x5e23bb}});})[_0x0145('0x29')](function(_0x3fb732){if(_0x3fb732===null){return;}return db['UserVoicePrefix'][_0x0145('0x61')]({'where':{'UserId':{'$in':_0x216d3d},'VoicePrefixId':_0x3fb732[_0x0145('0x6d')]},'transaction':_0x449e27});})[_0x0145('0x29')](function(){return db[_0x0145('0x2f')][_0x0145('0x61')]({'where':{'id':_0x5e23bb},'cascade':!![],'transaction':_0x449e27});})[_0x0145('0x29')](function(_0x5e43b8){if(_0x5e43b8===0x0){_0x2c2719['sendStatus'](0x194);}else{return db[_0x0145('0x52')]['destroy']({'where':{'type':'Teams','resourceId':_0x5e23bb},'cascade':!![],'transaction':_0x449e27})['then'](function(){_0x2c2719['status'](0xcc)[_0x0145('0x20')]();});}})[_0x0145('0x49')](function(_0x11aa5a){_0x2c2719['status'](0x1f4)[_0x0145('0x2d')](_0x11aa5a);});});};exports[_0x0145('0x6e')]=function(_0x12c796,_0x371d17,_0x283b69){return db[_0x0145('0x2f')][_0x0145('0x6f')]({'where':{'id':_0x12c796['params']['id']}})[_0x0145('0x29')](handleEntityNotFound(_0x371d17,null))[_0x0145('0x29')](function(_0x270261){if(!_0x12c796[_0x0145('0x34')][_0x0145('0x70')]||!utils['isValidChannel'](_0x12c796['query']['channel'])){throw new db[(_0x0145('0x57'))][(_0x0145('0x71'))](_0x0145('0x72'));}var _0x2b95b1={};var _0x32175e={};_0x32175e[_0x0145('0x33')]=_['keys'](db[_[_0x0145('0x73')](_0x12c796['query'][_0x0145('0x70')][_0x0145('0x74')]())+'Queue'][_0x0145('0x47')]);_0x32175e[_0x0145('0x34')]=_['keys'](_0x12c796[_0x0145('0x34')]);_0x32175e['filters']=_[_0x0145('0x37')](_0x32175e[_0x0145('0x33')],_0x32175e[_0x0145('0x34')]);_0x2b95b1['attributes']=_[_0x0145('0x37')](_0x32175e[_0x0145('0x33')],qs['fields'](_0x12c796[_0x0145('0x34')][_0x0145('0x39')]));_0x2b95b1['attributes']=_0x2b95b1[_0x0145('0x38')][_0x0145('0x3a')]?_0x2b95b1['attributes']:_0x32175e[_0x0145('0x33')];_0x2b95b1[_0x0145('0x23')]=qs['limit'](_0x12c796[_0x0145('0x34')][_0x0145('0x23')]);_0x2b95b1[_0x0145('0x22')]=qs['offset'](_0x12c796[_0x0145('0x34')]['offset']);_0x2b95b1['order']=qs['sort'](_0x12c796[_0x0145('0x34')][_0x0145('0x3d')]);_0x2b95b1[_0x0145('0x3e')]=qs['filters'](_[_0x0145('0x3f')](_0x12c796[_0x0145('0x34')],_0x32175e[_0x0145('0x36')]));_0x2b95b1=_[_0x0145('0x41')]({},_0x2b95b1,_0x12c796[_0x0145('0x42')]);return _0x270261['get'+_[_0x0145('0x73')](_0x12c796[_0x0145('0x34')][_0x0145('0x70')][_0x0145('0x74')]())+_0x0145('0x75')](_0x2b95b1);})[_0x0145('0x29')](respondWithResult(_0x371d17,null))[_0x0145('0x49')](handleError(_0x371d17,null));};exports[_0x0145('0x76')]=function(_0x2aacb7,_0xd91655,_0xc8423){return db[_0x0145('0x2f')]['findOne']({'where':{'id':_0x2aacb7['params']['id']}})['then'](function(_0x54a275){if(_0x54a275){if(!_0x2aacb7[_0x0145('0x4b')][_0x0145('0x70')]||!utils[_0x0145('0x77')](_0x2aacb7['body'][_0x0145('0x70')])){throw new db['Sequelize'][(_0x0145('0x71'))](_0x0145('0x72'));}return _0x54a275[_0x0145('0x78')+_[_0x0145('0x73')](_0x2aacb7[_0x0145('0x4b')]['channel'][_0x0145('0x74')]())+_0x0145('0x75')](_0x2aacb7[_0x0145('0x4b')][_0x0145('0x79')]);}return null;})[_0x0145('0x29')](handleEntityNotFound(_0xd91655,null))['then'](respondWithStatusCode(_0xd91655,null))['catch'](handleError(_0xd91655,null));};exports[_0x0145('0x7a')]=function(_0x4a6589,_0x130277,_0x3fc7d6){return db[_0x0145('0x2f')][_0x0145('0x6f')]({'where':{'id':_0x4a6589[_0x0145('0x54')]['id']}})[_0x0145('0x29')](function(_0x41fffb){if(_0x41fffb){if(!_0x4a6589[_0x0145('0x34')][_0x0145('0x70')]||!utils[_0x0145('0x77')](_0x4a6589[_0x0145('0x34')][_0x0145('0x70')])){throw new db['Sequelize']['ValidationError'](_0x0145('0x72'));}return _0x41fffb[_0x0145('0x7b')+_[_0x0145('0x73')](_0x4a6589[_0x0145('0x34')][_0x0145('0x70')][_0x0145('0x74')]())+_0x0145('0x75')](_0x4a6589[_0x0145('0x34')][_0x0145('0x79')]);}return null;})[_0x0145('0x29')](handleEntityNotFound(_0x130277,null))[_0x0145('0x29')](respondWithStatusCode(_0x130277,null))[_0x0145('0x49')](handleError(_0x130277,null));};exports['addAgents']=function(_0x2cb16b,_0x247dca){var _0x144518=_[_0x0145('0x7c')](_0x2cb16b[_0x0145('0x4b')][_0x0145('0x79')])?_0x2cb16b['body']['ids']:[_0x2cb16b[_0x0145('0x4b')][_0x0145('0x79')]];var _0x48bfb3=_0x2cb16b[_0x0145('0x54')]['id'];return db['Team'][_0x0145('0x48')]({'where':{'id':_0x48bfb3}})[_0x0145('0x29')](handleEntityNotFound(_0x247dca,null))[_0x0145('0x29')](function(_0x2b06b2){if(_0x2b06b2){var _0x4923fa=[_0x0145('0x7d'),_0x0145('0x7e'),_0x0145('0x7f'),_0x0145('0x80'),_0x0145('0x81'),_0x0145('0x82'),_0x0145('0x83')];return db[_0x0145('0x55')][_0x0145('0x56')](function(_0x5c10f3){var _0x2705a3=_['map'](_0x4923fa,function(_0x79c841){var _0x2f6f22={'attributes':['id','name']};if(_0x79c841==='Voice'){_0x2f6f22[_0x0145('0x84')]={'attributes':[_0x0145('0x85')]};}return _0x2b06b2[_0x0145('0x4d')+_0x79c841+_0x0145('0x75')](_0x2f6f22)[_0x0145('0x29')](function(_0x4d94c0){var _0x3890c0=_[_0x0145('0x2e')](_0x4d94c0,function(_0x5b1eb9){var _0x5552c6=_[_0x0145('0x2e')](_0x144518,function(_0x849508){var _0x25e6c7={'where':{'UserId':_0x849508,[_0x79c841+'QueueId']:_0x5b1eb9['id']},'transaction':_0x5c10f3};if(_0x79c841==='Voice'){_0x25e6c7['defaults']={'penalty':_0x5b1eb9[_0x0145('0x86')][_0x0145('0x85')]};}return db[_0x0145('0x87')+_0x79c841+_0x0145('0x88')][_0x0145('0x89')](_0x25e6c7)[_0x0145('0x29')](function(){socket['emit']('user'+_0x79c841+'Queue:save',{'UserId':_0x849508,[_0x79c841+_0x0145('0x8a')]:_0x5b1eb9['id']});if(_0x79c841!=='Voice'){return;}return db[_0x0145('0x87')][_0x0145('0x45')]({'where':{'id':_0x144518,'online':0x1},'attributes':['id',_0x0145('0x2c'),_0x0145('0x8b'),_0x0145('0x8c'),_0x0145('0x8d')],'raw':!![]})[_0x0145('0x29')](function(_0x426279){var _0x1bfc29=_[_0x0145('0x2e')](_0x426279,function(_0xbf3b79){return db[_0x0145('0x8e')][_0x0145('0x8f')]({'membername':_0xbf3b79[_0x0145('0x2c')],'UserId':_0xbf3b79['id'],'queue_name':_0x5b1eb9[_0x0145('0x2c')],'VoiceQueueId':_0x5b1eb9['id'],'interface':_[_0x0145('0x90')](_0xbf3b79['interface'])?util[_0x0145('0x91')](_0x0145('0x92'),_0xbf3b79['name']):_0xbf3b79[_0x0145('0x8d')],'paused':_0xbf3b79[_0x0145('0x8c')]||![],'penalty':_0x5b1eb9[_0x0145('0x86')][_0x0145('0x85')]},{'transaction':_0x5c10f3});});return Promise['all'](_0x1bfc29);});});});return Promise[_0x0145('0x93')](_0x5552c6);});return Promise['all'](_0x3890c0);})[_0x0145('0x29')](function(){return db[_0x0145('0x6c')][_0x0145('0x6f')]({'where':{'teamId':_0x48bfb3}})['then'](function(_0x428d16){if(_0x428d16){var _0x3c6f04=_['map'](_0x144518,function(_0x50d79a){db[_0x0145('0x94')][_0x0145('0x8f')]({'UserId':_0x50d79a,'VoicePrefixId':_0x428d16[_0x0145('0x6d')]});});return Promise[_0x0145('0x93')](_0x3c6f04);}});});});return Promise[_0x0145('0x93')](_0x2705a3)[_0x0145('0x29')](function(){return _0x2b06b2[_0x0145('0x95')](_0x144518,{'transaction':_0x5c10f3})[_0x0145('0x96')](function(_0x45c27b){return _0x45c27b;});});});}})[_0x0145('0x29')](respondWithResult(_0x247dca,null))[_0x0145('0x49')](handleError(_0x247dca,null));};exports['removeAgents']=function(_0x563072,_0xe3640a){var _0x50454b=_[_0x0145('0x7c')](_0x563072[_0x0145('0x34')][_0x0145('0x79')])?_0x563072[_0x0145('0x34')][_0x0145('0x79')]:[_0x563072[_0x0145('0x34')][_0x0145('0x79')]];var _0xfbb792=_0x563072['params']['id'];return db[_0x0145('0x2f')]['find']({'where':{'id':_0xfbb792}})[_0x0145('0x29')](handleEntityNotFound(_0xe3640a,null))[_0x0145('0x29')](function(_0x12b62c){if(_0x12b62c){var _0x21941b=[_0x0145('0x7d'),_0x0145('0x7e'),_0x0145('0x7f'),'Sms',_0x0145('0x81'),_0x0145('0x82'),_0x0145('0x83')];return db['sequelize']['transaction'](function(_0x32d166){var _0x429561=_[_0x0145('0x2e')](_0x21941b,function(_0x2789d2){var _0x3af2d1={'attributes':['id','name']};return _0x12b62c[_0x0145('0x4d')+_0x2789d2+_0x0145('0x75')](_0x3af2d1)[_0x0145('0x29')](function(_0x1b0658){var _0xa1214f=_['map'](_0x1b0658,function(_0x3afd01){return _0x3afd01[_0x0145('0x97')](_0x50454b,{'transaction':_0x32d166})[_0x0145('0x29')](function(){var _0x9ef705=_[_0x0145('0x2e')](_0x50454b,function(_0x4537f5){socket['emit'](_0x0145('0x4c')+_0x2789d2+_0x0145('0x98'),{'UserId':Number(_0x4537f5),[_0x2789d2+_0x0145('0x8a')]:_0x3afd01['id']});if(_0x2789d2!=='Voice'){return;}return db[_0x0145('0x8e')][_0x0145('0x61')]({'where':{'VoiceQueueId':_0x3afd01['id'],'UserId':_0x4537f5},'transaction':_0x32d166});});return Promise[_0x0145('0x93')](_0x9ef705);});});return Promise[_0x0145('0x93')](_0xa1214f);});});return Promise['all'](_0x429561)['then'](function(){return _0x12b62c[_0x0145('0x97')](_0x50454b,{'transaction':_0x32d166});})[_0x0145('0x29')](function(){return db[_0x0145('0x6c')]['findOne']({'where':{'teamId':_0xfbb792}})[_0x0145('0x29')](function(_0xf1bb80){if(_0xf1bb80){var _0x3ca29a=_[_0x0145('0x2e')](_0x50454b,function(_0x473df1){db[_0x0145('0x94')]['destroy']({'where':{'UserId':_0x473df1,'VoicePrefixId':_0xf1bb80[_0x0145('0x6d')]}});});return Promise[_0x0145('0x93')](_0x3ca29a);}});});});}})['then'](respondWithStatusCode(_0xe3640a,null))[_0x0145('0x49')](handleError(_0xe3640a,null));};exports[_0x0145('0x99')]=function(_0x5d3375,_0x531373,_0x3d895b){var _0x5b552b={};var _0x14b8c5={};var _0x1fd98a;var _0x3638d0;return db[_0x0145('0x2f')]['findOne']({'where':{'id':_0x5d3375[_0x0145('0x54')]['id']}})[_0x0145('0x29')](handleEntityNotFound(_0x531373,null))[_0x0145('0x29')](function(_0x4d49ac){if(_0x4d49ac){_0x1fd98a=_0x4d49ac;_0x14b8c5['model']=_[_0x0145('0x35')](db[_0x0145('0x87')][_0x0145('0x47')]);_0x14b8c5[_0x0145('0x34')]=_[_0x0145('0x35')](_0x5d3375[_0x0145('0x34')]);_0x14b8c5[_0x0145('0x36')]=_['intersection'](_0x14b8c5[_0x0145('0x33')],_0x14b8c5[_0x0145('0x34')]);_0x5b552b[_0x0145('0x38')]=_['intersection'](_0x14b8c5[_0x0145('0x33')],qs[_0x0145('0x39')](_0x5d3375[_0x0145('0x34')]['fields']));_0x5b552b[_0x0145('0x38')]=_0x5b552b[_0x0145('0x38')][_0x0145('0x3a')]?_0x5b552b[_0x0145('0x38')]:_0x14b8c5[_0x0145('0x33')];_0x5b552b[_0x0145('0x3c')]=qs[_0x0145('0x3d')](_0x5d3375[_0x0145('0x34')]['sort']);_0x5b552b['where']=qs[_0x0145('0x36')](_[_0x0145('0x3f')](_0x5d3375[_0x0145('0x34')],_0x14b8c5[_0x0145('0x36')]));if(_0x5d3375[_0x0145('0x34')]['filter']){_0x5b552b['where']=_[_0x0145('0x41')](_0x5b552b['where'],{'$or':_[_0x0145('0x2e')](_0x5b552b[_0x0145('0x38')],function(_0x126fc5){var _0x107237={};_0x107237[_0x126fc5]={'$like':'%'+_0x5d3375[_0x0145('0x34')][_0x0145('0x40')]+'%'};return _0x107237;})});}_0x5b552b=_['merge']({},_0x5b552b,_0x5d3375[_0x0145('0x42')]);return _0x1fd98a[_0x0145('0x99')](_0x5b552b);}})[_0x0145('0x29')](function(_0x20266d){if(_0x20266d){_0x3638d0=_0x20266d[_0x0145('0x3a')];if(!_0x5d3375[_0x0145('0x34')]['hasOwnProperty'](_0x0145('0x9a'))){_0x5b552b[_0x0145('0x23')]=qs[_0x0145('0x23')](_0x5d3375[_0x0145('0x34')][_0x0145('0x23')]);_0x5b552b[_0x0145('0x22')]=qs['offset'](_0x5d3375[_0x0145('0x34')][_0x0145('0x22')]);}return _0x1fd98a[_0x0145('0x99')](_0x5b552b);}})[_0x0145('0x29')](function(_0x209bd2){if(_0x209bd2){return _0x209bd2?{'count':_0x3638d0,'rows':_0x209bd2}:null;}})['then'](respondWithResult(_0x531373,null))[_0x0145('0x49')](handleError(_0x531373,null));}; \ No newline at end of file +var _0x3739=['destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','UserMailQueue','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','rawAttributes','Queues','addQueues','add','ids','removeQueues','remove','addAgents','Sms','Fax','Openchannel','Voice','through','penalty','defaults','TeamVoiceQueue','User','findOrCreate','Queue:save','QueueId','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','UserVoicePrefix','spread','removeAgents','isArray','Chat','Mail','emit','Queue:remove','getAgents','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./team.socket','register','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','then','stack','name','send','index','map','fieldName','type','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','Team','includeAll','include','findAll','catch','show','params','options','find','create','user','get','role','Teams','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x44fff9,_0x2898cd){var _0x30a104=function(_0xf496d7){while(--_0xf496d7){_0x44fff9['push'](_0x44fff9['shift']());}};_0x30a104(++_0x2898cd);}(_0x3739,0xe1));var _0x9373=function(_0x4b6847,_0x50c4d6){_0x4b6847=_0x4b6847-0x0;var _0x562863=_0x3739[_0x4b6847];return _0x562863;};'use strict';var emlformat=require(_0x9373('0x0'));var rimraf=require(_0x9373('0x1'));var zipdir=require(_0x9373('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9373('0x3'));var moment=require(_0x9373('0x4'));var BPromise=require(_0x9373('0x5'));var Mustache=require(_0x9373('0x6'));var util=require(_0x9373('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9373('0x8'));var ejs=require(_0x9373('0x9'));var fs=require('fs');var fs_extra=require(_0x9373('0xa'));var _=require(_0x9373('0xb'));var squel=require(_0x9373('0xc'));var crypto=require(_0x9373('0xd'));var jsforce=require(_0x9373('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9373('0x8'));var querystring=require(_0x9373('0xf'));var Papa=require(_0x9373('0x10'));var Redis=require('ioredis');var authService=require(_0x9373('0x11'));var qs=require(_0x9373('0x12'));var as=require(_0x9373('0x13'));var hardwareService=require(_0x9373('0x14'));var logger=require(_0x9373('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x9373('0x16'));var licenseUtil=require(_0x9373('0x17'));var db=require(_0x9373('0x18'))['db'];config[_0x9373('0x19')]=_['defaults'](config['redis'],{'host':_0x9373('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9373('0x19')]));require(_0x9373('0x1b'))[_0x9373('0x1c')](socket);function respondWithStatusCode(_0x585fdc,_0x16d4d5){_0x16d4d5=_0x16d4d5||0xcc;return function(_0x1648b9){if(_0x1648b9){return _0x585fdc[_0x9373('0x1d')](_0x16d4d5);}return _0x585fdc[_0x9373('0x1e')](_0x16d4d5)[_0x9373('0x1f')]();};}function respondWithResult(_0x503104,_0x33bb29){_0x33bb29=_0x33bb29||0xc8;return function(_0x1d37f5){if(_0x1d37f5){return _0x503104['status'](_0x33bb29)['json'](_0x1d37f5);}};}function respondWithFilteredResult(_0x1dc46a,_0x5c2a1c){return function(_0x3d8cdb){if(_0x3d8cdb){var _0x1d59cf=typeof _0x5c2a1c[_0x9373('0x20')]==='undefined'&&typeof _0x5c2a1c[_0x9373('0x21')]===_0x9373('0x22');var _0x2648b7=_0x3d8cdb[_0x9373('0x23')];var _0x14fa5c=_0x1d59cf?0x0:_0x5c2a1c['offset'];var _0x1c672c=_0x1d59cf?_0x3d8cdb['count']:_0x5c2a1c[_0x9373('0x20')]+_0x5c2a1c[_0x9373('0x21')];var _0x340061;if(_0x1c672c>=_0x2648b7){_0x1c672c=_0x2648b7;_0x340061=0xc8;}else{_0x340061=0xce;}_0x1dc46a['status'](_0x340061);return _0x1dc46a['set'](_0x9373('0x24'),_0x14fa5c+'-'+_0x1c672c+'/'+_0x2648b7)[_0x9373('0x25')](_0x3d8cdb);}return null;};}function patchUpdates(_0x2bda8f){return function(_0x148204){try{jsonpatch[_0x9373('0x26')](_0x148204,_0x2bda8f,!![]);}catch(_0x175f8d){return BPromise[_0x9373('0x27')](_0x175f8d);}return _0x148204[_0x9373('0x28')]();};}function saveUpdates(_0x262c1d,_0x4b8fa1){return function(_0x3a3402){if(_0x3a3402){return _0x3a3402['update'](_0x262c1d)[_0x9373('0x29')](function(_0x2cca62){return _0x2cca62;});}return null;};}function handleEntityNotFound(_0x4348fc,_0xc1474b){return function(_0x4611a2){if(!_0x4611a2){_0x4348fc[_0x9373('0x1d')](0x194);}return _0x4611a2;};}function handleError(_0x33fa06,_0x32051d){_0x32051d=_0x32051d||0x1f4;return function(_0x2b2445){logger['error'](_0x2b2445[_0x9373('0x2a')]);if(_0x2b2445['name']){delete _0x2b2445[_0x9373('0x2b')];}_0x33fa06[_0x9373('0x1e')](_0x32051d)[_0x9373('0x2c')](_0x2b2445);};}exports[_0x9373('0x2d')]=function(_0x3a9c9c,_0x155c1b){var _0x3e757b={},_0x522b12={},_0x31eeac={'count':0x0,'rows':[]};var _0x1639c6=_[_0x9373('0x2e')](db['Team']['rawAttributes'],function(_0x52c5fa){return{'name':_0x52c5fa[_0x9373('0x2f')],'type':_0x52c5fa[_0x9373('0x30')]['key']};});_0x522b12['model']=_[_0x9373('0x2e')](_0x1639c6,_0x9373('0x2b'));_0x522b12[_0x9373('0x31')]=_[_0x9373('0x32')](_0x3a9c9c[_0x9373('0x31')]);_0x522b12[_0x9373('0x33')]=_['intersection'](_0x522b12[_0x9373('0x34')],_0x522b12[_0x9373('0x31')]);_0x3e757b['attributes']=_[_0x9373('0x35')](_0x522b12['model'],qs['fields'](_0x3a9c9c[_0x9373('0x31')][_0x9373('0x36')]));_0x3e757b[_0x9373('0x37')]=_0x3e757b[_0x9373('0x37')][_0x9373('0x38')]?_0x3e757b['attributes']:_0x522b12[_0x9373('0x34')];if(!_0x3a9c9c['query'][_0x9373('0x39')]('nolimit')){_0x3e757b[_0x9373('0x21')]=qs[_0x9373('0x21')](_0x3a9c9c[_0x9373('0x31')][_0x9373('0x21')]);_0x3e757b[_0x9373('0x20')]=qs[_0x9373('0x20')](_0x3a9c9c['query'][_0x9373('0x20')]);}_0x3e757b[_0x9373('0x3a')]=qs[_0x9373('0x3b')](_0x3a9c9c[_0x9373('0x31')][_0x9373('0x3b')]);_0x3e757b['where']=qs[_0x9373('0x33')](_[_0x9373('0x3c')](_0x3a9c9c['query'],_0x522b12[_0x9373('0x33')]),_0x1639c6);if(_0x3a9c9c['query'][_0x9373('0x3d')]){_0x3e757b[_0x9373('0x3e')]=_[_0x9373('0x3f')](_0x3e757b[_0x9373('0x3e')],{'$or':_[_0x9373('0x2e')](_0x1639c6,function(_0x1bdcdc){if(_0x1bdcdc[_0x9373('0x30')]!==_0x9373('0x40')){var _0x38e30b={};_0x38e30b[_0x1bdcdc[_0x9373('0x2b')]]={'$like':'%'+_0x3a9c9c['query'][_0x9373('0x3d')]+'%'};return _0x38e30b;}})});}_0x3e757b=_['merge']({},_0x3e757b,_0x3a9c9c['options']);var _0x573462={'where':_0x3e757b[_0x9373('0x3e')]};return db[_0x9373('0x41')][_0x9373('0x23')](_0x573462)[_0x9373('0x29')](function(_0x2ba9e3){_0x31eeac[_0x9373('0x23')]=_0x2ba9e3;if(_0x3a9c9c[_0x9373('0x31')][_0x9373('0x42')]){_0x3e757b[_0x9373('0x43')]=[{'all':!![]}];}return db[_0x9373('0x41')][_0x9373('0x44')](_0x3e757b);})['then'](function(_0x56372a){_0x31eeac['rows']=_0x56372a;return _0x31eeac;})['then'](respondWithFilteredResult(_0x155c1b,_0x3e757b))[_0x9373('0x45')](handleError(_0x155c1b,null));};exports[_0x9373('0x46')]=function(_0x476760,_0x34faf5){var _0x1323e4={'raw':![],'where':{'id':_0x476760[_0x9373('0x47')]['id']}},_0x25b96b={};_0x25b96b['model']=_[_0x9373('0x32')](db[_0x9373('0x41')]['rawAttributes']);_0x25b96b[_0x9373('0x31')]=_[_0x9373('0x32')](_0x476760['query']);_0x25b96b['filters']=_[_0x9373('0x35')](_0x25b96b[_0x9373('0x34')],_0x25b96b[_0x9373('0x31')]);_0x1323e4[_0x9373('0x37')]=_[_0x9373('0x35')](_0x25b96b['model'],qs[_0x9373('0x36')](_0x476760[_0x9373('0x31')]['fields']));_0x1323e4[_0x9373('0x37')]=_0x1323e4[_0x9373('0x37')]['length']?_0x1323e4[_0x9373('0x37')]:_0x25b96b[_0x9373('0x34')];if(_0x476760[_0x9373('0x31')][_0x9373('0x42')]){_0x1323e4[_0x9373('0x43')]=[{'all':!![]}];}_0x1323e4=_[_0x9373('0x3f')]({},_0x1323e4,_0x476760[_0x9373('0x48')]);return db[_0x9373('0x41')][_0x9373('0x49')](_0x1323e4)['then'](handleEntityNotFound(_0x34faf5,null))['then'](respondWithResult(_0x34faf5,null))[_0x9373('0x45')](handleError(_0x34faf5,null));};exports[_0x9373('0x4a')]=function(_0x165659,_0x351e22){return db[_0x9373('0x41')]['create'](_0x165659['body'],{})[_0x9373('0x29')](function(_0xdb69d3){var _0x302e5b=_0x165659[_0x9373('0x4b')][_0x9373('0x4c')]({'plain':!![]});if(!_0x302e5b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x302e5b[_0x9373('0x4d')]===_0x9373('0x4b')){var _0x1e0b45=_0xdb69d3[_0x9373('0x4c')]({'plain':!![]});var _0x2909b7=_0x9373('0x4e');return db['UserProfileSection'][_0x9373('0x49')]({'where':{'name':_0x2909b7,'userProfileId':_0x302e5b[_0x9373('0x4f')]},'raw':!![]})[_0x9373('0x29')](function(_0xabafc2){if(_0xabafc2&&_0xabafc2[_0x9373('0x50')]===0x0){return db[_0x9373('0x51')][_0x9373('0x4a')]({'name':_0x1e0b45[_0x9373('0x2b')],'resourceId':_0x1e0b45['id'],'type':_0xabafc2[_0x9373('0x2b')],'sectionId':_0xabafc2['id']},{})[_0x9373('0x29')](function(){return _0xdb69d3;});}else{return _0xdb69d3;}})['catch'](function(_0x457a9a){logger[_0x9373('0x52')](_0x9373('0x53'),_0x457a9a);throw _0x457a9a;});}return _0xdb69d3;})[_0x9373('0x29')](respondWithResult(_0x351e22,0xc9))['catch'](handleError(_0x351e22,null));};exports['update']=function(_0x34949c,_0x134cca){if(_0x34949c[_0x9373('0x54')]['id']){delete _0x34949c[_0x9373('0x54')]['id'];}return db[_0x9373('0x41')][_0x9373('0x49')]({'where':{'id':_0x34949c[_0x9373('0x47')]['id']}})['then'](handleEntityNotFound(_0x134cca,null))[_0x9373('0x29')](saveUpdates(_0x34949c[_0x9373('0x54')],null))[_0x9373('0x29')](respondWithResult(_0x134cca,null))[_0x9373('0x45')](handleError(_0x134cca,null));};exports[_0x9373('0x55')]=function(_0x5438ba,_0x32c9c2){var _0x125d53=_0x5438ba[_0x9373('0x47')]['id'];var _0xcac864=[];return db['sequelize'][_0x9373('0x56')](function(_0x1e5b1d){var _0x23c682=_0x9373('0x57')+_0x125d53;return db[_0x9373('0x58')]['query'](_0x23c682,{'type':db[_0x9373('0x59')][_0x9373('0x5a')][_0x9373('0x5b')],'raw':!![],'transaction':_0x1e5b1d})[_0x9373('0x29')](function(_0x4afbf1){_0xcac864=_[_0x9373('0x2e')](_0x4afbf1,function(_0x15d6e3){return Number(_0x15d6e3['UserId']);});})[_0x9373('0x29')](function(){var _0x2d880b=_0x9373('0x5c')+_0x125d53;return db[_0x9373('0x58')][_0x9373('0x31')](_0x2d880b,{'type':db[_0x9373('0x59')]['QueryTypes'][_0x9373('0x5b')],'raw':!![],'transaction':_0x1e5b1d});})[_0x9373('0x29')](function(_0x128ad1){var _0x73e0fe=_['map'](_0x128ad1,function(_0x4a7812){return Number(_0x4a7812[_0x9373('0x5d')]);});return db[_0x9373('0x5e')][_0x9373('0x55')]({'where':{'UserId':{'$in':_0xcac864},'VoiceQueueId':{'$in':_0x73e0fe}},'transaction':_0x1e5b1d});})[_0x9373('0x29')](function(){var _0x273913='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x125d53;return db[_0x9373('0x58')][_0x9373('0x31')](_0x273913,{'type':db[_0x9373('0x59')][_0x9373('0x5a')]['SELECT'],'raw':!![],'transaction':_0x1e5b1d});})[_0x9373('0x29')](function(_0x347221){var _0x160a8c=_['map'](_0x347221,function(_0x13d50e){return Number(_0x13d50e['MailQueueId']);});return db[_0x9373('0x5f')][_0x9373('0x55')]({'where':{'UserId':{'$in':_0xcac864},'MailQueueId':{'$in':_0x160a8c}},'transaction':_0x1e5b1d});})['then'](function(){var _0x4ca8b2='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x125d53;return db[_0x9373('0x58')][_0x9373('0x31')](_0x4ca8b2,{'type':db[_0x9373('0x59')][_0x9373('0x5a')]['SELECT'],'raw':!![],'transaction':_0x1e5b1d});})[_0x9373('0x29')](function(_0x513b21){var _0x4c08ec=_[_0x9373('0x2e')](_0x513b21,function(_0xb8e53f){return Number(_0xb8e53f['SmsQueueId']);});return db[_0x9373('0x60')]['destroy']({'where':{'UserId':{'$in':_0xcac864},'SmsQueueId':{'$in':_0x4c08ec}},'transaction':_0x1e5b1d});})[_0x9373('0x29')](function(){var _0x31dcca=_0x9373('0x61')+_0x125d53;return db[_0x9373('0x58')][_0x9373('0x31')](_0x31dcca,{'type':db[_0x9373('0x59')][_0x9373('0x5a')][_0x9373('0x5b')],'raw':!![],'transaction':_0x1e5b1d});})[_0x9373('0x29')](function(_0x5ae630){var _0x101c90=_[_0x9373('0x2e')](_0x5ae630,function(_0x445a9c){return Number(_0x445a9c[_0x9373('0x62')]);});return db[_0x9373('0x63')][_0x9373('0x55')]({'where':{'UserId':{'$in':_0xcac864},'ChatQueueId':{'$in':_0x101c90}},'transaction':_0x1e5b1d});})[_0x9373('0x29')](function(){var _0x31873b='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x125d53;return db['sequelize'][_0x9373('0x31')](_0x31873b,{'type':db[_0x9373('0x59')][_0x9373('0x5a')]['SELECT'],'raw':!![],'transaction':_0x1e5b1d});})[_0x9373('0x29')](function(_0x23b2ff){var _0x2fd979=_[_0x9373('0x2e')](_0x23b2ff,function(_0x3dc068){return Number(_0x3dc068[_0x9373('0x64')]);});return db[_0x9373('0x65')]['destroy']({'where':{'UserId':{'$in':_0xcac864},'FaxQueueId':{'$in':_0x2fd979}},'transaction':_0x1e5b1d});})[_0x9373('0x29')](function(){var _0x3dd2da='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x125d53;return db[_0x9373('0x58')][_0x9373('0x31')](_0x3dd2da,{'type':db[_0x9373('0x59')][_0x9373('0x5a')][_0x9373('0x5b')],'raw':!![],'transaction':_0x1e5b1d});})['then'](function(_0x1a16a4){var _0x52bef9=_[_0x9373('0x2e')](_0x1a16a4,function(_0x1e9522){return Number(_0x1e9522[_0x9373('0x66')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0xcac864},'OpenchannelQueueId':{'$in':_0x52bef9}},'transaction':_0x1e5b1d});})[_0x9373('0x29')](function(){var _0x7a85c4=_0x9373('0x67')+_0x125d53;return db['sequelize']['query'](_0x7a85c4,{'type':db['Sequelize'][_0x9373('0x5a')]['SELECT'],'raw':!![],'transaction':_0x1e5b1d});})[_0x9373('0x29')](function(_0x537085){var _0x5bfe5a=_[_0x9373('0x2e')](_0x537085,function(_0x36cb62){return Number(_0x36cb62['WhatsappQueueId']);});return db[_0x9373('0x68')][_0x9373('0x55')]({'where':{'UserId':{'$in':_0xcac864},'WhatsappQueueId':{'$in':_0x5bfe5a}},'transaction':_0x1e5b1d});})[_0x9373('0x29')](function(){return db[_0x9373('0x69')][_0x9373('0x49')]({'where':{'TeamId':_0x125d53}});})[_0x9373('0x29')](function(_0x1609c8){if(_0x1609c8===null){return;}return db['UserVoicePrefix'][_0x9373('0x55')]({'where':{'UserId':{'$in':_0xcac864},'VoicePrefixId':_0x1609c8[_0x9373('0x6a')]},'transaction':_0x1e5b1d});})[_0x9373('0x29')](function(){return db['Team'][_0x9373('0x55')]({'where':{'id':_0x125d53},'cascade':!![],'transaction':_0x1e5b1d});})[_0x9373('0x29')](function(_0x3d3fca){if(_0x3d3fca===0x0){_0x32c9c2['sendStatus'](0x194);}else{return db[_0x9373('0x51')][_0x9373('0x55')]({'where':{'type':'Teams','resourceId':_0x125d53},'cascade':!![],'transaction':_0x1e5b1d})['then'](function(){_0x32c9c2['status'](0xcc)[_0x9373('0x1f')]();});}})[_0x9373('0x45')](function(_0x4f9aa2){_0x32c9c2[_0x9373('0x1e')](0x1f4)[_0x9373('0x2c')](_0x4f9aa2);});});};exports[_0x9373('0x6b')]=function(_0x5be65a,_0x3197f2,_0x2ce041){return db['Team'][_0x9373('0x6c')]({'where':{'id':_0x5be65a[_0x9373('0x47')]['id']}})[_0x9373('0x29')](handleEntityNotFound(_0x3197f2,null))['then'](function(_0x36c672){if(!_0x5be65a[_0x9373('0x31')][_0x9373('0x6d')]||!utils[_0x9373('0x6e')](_0x5be65a[_0x9373('0x31')][_0x9373('0x6d')])){throw new db[(_0x9373('0x59'))][(_0x9373('0x6f'))](_0x9373('0x70'));}var _0x5c9533={};var _0x688dd3={};_0x688dd3['model']=_[_0x9373('0x32')](db[_[_0x9373('0x71')](_0x5be65a[_0x9373('0x31')]['channel'][_0x9373('0x72')]())+_0x9373('0x73')][_0x9373('0x74')]);_0x688dd3[_0x9373('0x31')]=_['keys'](_0x5be65a['query']);_0x688dd3[_0x9373('0x33')]=_[_0x9373('0x35')](_0x688dd3[_0x9373('0x34')],_0x688dd3[_0x9373('0x31')]);_0x5c9533[_0x9373('0x37')]=_[_0x9373('0x35')](_0x688dd3[_0x9373('0x34')],qs[_0x9373('0x36')](_0x5be65a[_0x9373('0x31')][_0x9373('0x36')]));_0x5c9533[_0x9373('0x37')]=_0x5c9533[_0x9373('0x37')][_0x9373('0x38')]?_0x5c9533['attributes']:_0x688dd3[_0x9373('0x34')];_0x5c9533[_0x9373('0x21')]=qs[_0x9373('0x21')](_0x5be65a[_0x9373('0x31')]['limit']);_0x5c9533[_0x9373('0x20')]=qs[_0x9373('0x20')](_0x5be65a[_0x9373('0x31')][_0x9373('0x20')]);_0x5c9533['order']=qs[_0x9373('0x3b')](_0x5be65a[_0x9373('0x31')][_0x9373('0x3b')]);_0x5c9533[_0x9373('0x3e')]=qs[_0x9373('0x33')](_[_0x9373('0x3c')](_0x5be65a['query'],_0x688dd3[_0x9373('0x33')]));_0x5c9533=_[_0x9373('0x3f')]({},_0x5c9533,_0x5be65a[_0x9373('0x48')]);return _0x36c672[_0x9373('0x4c')+_[_0x9373('0x71')](_0x5be65a[_0x9373('0x31')][_0x9373('0x6d')][_0x9373('0x72')]())+_0x9373('0x75')](_0x5c9533);})[_0x9373('0x29')](respondWithResult(_0x3197f2,null))['catch'](handleError(_0x3197f2,null));};exports[_0x9373('0x76')]=function(_0x827e4,_0x15ccf3,_0x5ab808){return db[_0x9373('0x41')][_0x9373('0x6c')]({'where':{'id':_0x827e4[_0x9373('0x47')]['id']}})[_0x9373('0x29')](function(_0x4cec8f){if(_0x4cec8f){if(!_0x827e4[_0x9373('0x54')][_0x9373('0x6d')]||!utils[_0x9373('0x6e')](_0x827e4['body'][_0x9373('0x6d')])){throw new db['Sequelize'][(_0x9373('0x6f'))](_0x9373('0x70'));}return _0x4cec8f[_0x9373('0x77')+_[_0x9373('0x71')](_0x827e4[_0x9373('0x54')][_0x9373('0x6d')][_0x9373('0x72')]())+_0x9373('0x75')](_0x827e4['body'][_0x9373('0x78')]);}return null;})['then'](handleEntityNotFound(_0x15ccf3,null))[_0x9373('0x29')](respondWithStatusCode(_0x15ccf3,null))[_0x9373('0x45')](handleError(_0x15ccf3,null));};exports[_0x9373('0x79')]=function(_0x53d8ab,_0xab1ccc,_0x331144){return db[_0x9373('0x41')][_0x9373('0x6c')]({'where':{'id':_0x53d8ab[_0x9373('0x47')]['id']}})[_0x9373('0x29')](function(_0x52a951){if(_0x52a951){if(!_0x53d8ab['query'][_0x9373('0x6d')]||!utils[_0x9373('0x6e')](_0x53d8ab[_0x9373('0x31')][_0x9373('0x6d')])){throw new db[(_0x9373('0x59'))][(_0x9373('0x6f'))](_0x9373('0x70'));}return _0x52a951[_0x9373('0x7a')+_[_0x9373('0x71')](_0x53d8ab['query']['channel']['toLowerCase']())+'Queues'](_0x53d8ab['query']['ids']);}return null;})['then'](handleEntityNotFound(_0xab1ccc,null))[_0x9373('0x29')](respondWithStatusCode(_0xab1ccc,null))[_0x9373('0x45')](handleError(_0xab1ccc,null));};exports[_0x9373('0x7b')]=function(_0x34e8c3,_0x3640b3){var _0x2a0777=_['isArray'](_0x34e8c3[_0x9373('0x54')][_0x9373('0x78')])?_0x34e8c3[_0x9373('0x54')][_0x9373('0x78')]:[_0x34e8c3[_0x9373('0x54')][_0x9373('0x78')]];var _0x3f7f56=_0x34e8c3[_0x9373('0x47')]['id'];return db[_0x9373('0x41')][_0x9373('0x49')]({'where':{'id':_0x3f7f56}})[_0x9373('0x29')](handleEntityNotFound(_0x3640b3,null))[_0x9373('0x29')](function(_0x444215){if(_0x444215){var _0x390dc1=['Voice','Chat','Mail',_0x9373('0x7c'),_0x9373('0x7d'),_0x9373('0x7e'),'Whatsapp'];return db[_0x9373('0x58')][_0x9373('0x56')](function(_0x3633d1){var _0x5bb15e=_[_0x9373('0x2e')](_0x390dc1,function(_0x354f60){var _0x902364={'attributes':['id',_0x9373('0x2b')]};if(_0x354f60===_0x9373('0x7f')){_0x902364[_0x9373('0x80')]={'attributes':[_0x9373('0x81')]};}return _0x444215[_0x9373('0x4c')+_0x354f60+_0x9373('0x75')](_0x902364)[_0x9373('0x29')](function(_0x49810b){var _0x9b8060=_[_0x9373('0x2e')](_0x49810b,function(_0x24cbf2){var _0x3cc729=_[_0x9373('0x2e')](_0x2a0777,function(_0x4414cb){var _0x5976b2={'where':{'UserId':_0x4414cb,[_0x354f60+'QueueId']:_0x24cbf2['id']},'transaction':_0x3633d1};if(_0x354f60==='Voice'){_0x5976b2[_0x9373('0x82')]={'penalty':_0x24cbf2[_0x9373('0x83')][_0x9373('0x81')]};}return db[_0x9373('0x84')+_0x354f60+_0x9373('0x73')][_0x9373('0x85')](_0x5976b2)[_0x9373('0x29')](function(){socket['emit'](_0x9373('0x4b')+_0x354f60+_0x9373('0x86'),{'UserId':_0x4414cb,[_0x354f60+_0x9373('0x87')]:_0x24cbf2['id']});if(_0x354f60!==_0x9373('0x7f')){return;}return db[_0x9373('0x84')][_0x9373('0x44')]({'where':{'id':_0x2a0777,'online':0x1},'attributes':['id',_0x9373('0x2b'),_0x9373('0x88'),_0x9373('0x89'),_0x9373('0x8a')],'raw':!![]})[_0x9373('0x29')](function(_0x2dddcc){var _0x1c60ef=_[_0x9373('0x2e')](_0x2dddcc,function(_0x5aef46){return db[_0x9373('0x8b')][_0x9373('0x8c')]({'membername':_0x5aef46[_0x9373('0x2b')],'UserId':_0x5aef46['id'],'queue_name':_0x24cbf2['name'],'VoiceQueueId':_0x24cbf2['id'],'interface':_[_0x9373('0x8d')](_0x5aef46['interface'])?util[_0x9373('0x8e')](_0x9373('0x8f'),_0x5aef46['name']):_0x5aef46['interface'],'paused':_0x5aef46[_0x9373('0x89')]||![],'penalty':_0x24cbf2[_0x9373('0x83')][_0x9373('0x81')]},{'transaction':_0x3633d1});});return Promise['all'](_0x1c60ef);});});});return Promise[_0x9373('0x90')](_0x3cc729);});return Promise[_0x9373('0x90')](_0x9b8060);})['then'](function(){return db[_0x9373('0x69')][_0x9373('0x6c')]({'where':{'teamId':_0x3f7f56}})[_0x9373('0x29')](function(_0x4ef66e){if(_0x4ef66e){var _0x17a6f6=_[_0x9373('0x2e')](_0x2a0777,function(_0x561604){db[_0x9373('0x91')][_0x9373('0x8c')]({'UserId':_0x561604,'VoicePrefixId':_0x4ef66e[_0x9373('0x6a')]});});return Promise[_0x9373('0x90')](_0x17a6f6);}});});});return Promise[_0x9373('0x90')](_0x5bb15e)['then'](function(){return _0x444215[_0x9373('0x7b')](_0x2a0777,{'transaction':_0x3633d1})[_0x9373('0x92')](function(_0x6b7ead){return _0x6b7ead;});});});}})[_0x9373('0x29')](respondWithResult(_0x3640b3,null))['catch'](handleError(_0x3640b3,null));};exports[_0x9373('0x93')]=function(_0x42abdd,_0x2bbbdf){var _0x82cd24=_[_0x9373('0x94')](_0x42abdd[_0x9373('0x31')][_0x9373('0x78')])?_0x42abdd[_0x9373('0x31')][_0x9373('0x78')]:[_0x42abdd[_0x9373('0x31')][_0x9373('0x78')]];var _0x1ade9c=_0x42abdd[_0x9373('0x47')]['id'];return db[_0x9373('0x41')][_0x9373('0x49')]({'where':{'id':_0x1ade9c}})[_0x9373('0x29')](handleEntityNotFound(_0x2bbbdf,null))['then'](function(_0x367e90){if(_0x367e90){var _0x1b3aef=['Voice',_0x9373('0x95'),_0x9373('0x96'),_0x9373('0x7c'),_0x9373('0x7d'),_0x9373('0x7e'),'Whatsapp'];return db[_0x9373('0x58')][_0x9373('0x56')](function(_0x3f84e3){var _0xcd0d5=_[_0x9373('0x2e')](_0x1b3aef,function(_0xe6e45b){var _0x4403b5={'attributes':['id',_0x9373('0x2b')]};return _0x367e90[_0x9373('0x4c')+_0xe6e45b+_0x9373('0x75')](_0x4403b5)[_0x9373('0x29')](function(_0x3611dd){var _0x1cf3fc=_[_0x9373('0x2e')](_0x3611dd,function(_0x2da1d8){return _0x2da1d8[_0x9373('0x93')](_0x82cd24,{'transaction':_0x3f84e3})[_0x9373('0x29')](function(){var _0x59459c=_['map'](_0x82cd24,function(_0x1d3f55){socket[_0x9373('0x97')]('user'+_0xe6e45b+_0x9373('0x98'),{'UserId':Number(_0x1d3f55),[_0xe6e45b+_0x9373('0x87')]:_0x2da1d8['id']});if(_0xe6e45b!==_0x9373('0x7f')){return;}return db['UserVoiceQueueRt'][_0x9373('0x55')]({'where':{'VoiceQueueId':_0x2da1d8['id'],'UserId':_0x1d3f55},'transaction':_0x3f84e3});});return Promise['all'](_0x59459c);});});return Promise['all'](_0x1cf3fc);});});return Promise['all'](_0xcd0d5)[_0x9373('0x29')](function(){return _0x367e90[_0x9373('0x93')](_0x82cd24,{'transaction':_0x3f84e3});})[_0x9373('0x29')](function(){return db[_0x9373('0x69')][_0x9373('0x6c')]({'where':{'teamId':_0x1ade9c}})[_0x9373('0x29')](function(_0x552175){if(_0x552175){var _0x214537=_[_0x9373('0x2e')](_0x82cd24,function(_0x15d96e){db[_0x9373('0x91')][_0x9373('0x55')]({'where':{'UserId':_0x15d96e,'VoicePrefixId':_0x552175[_0x9373('0x6a')]}});});return Promise[_0x9373('0x90')](_0x214537);}});});});}})[_0x9373('0x29')](respondWithStatusCode(_0x2bbbdf,null))[_0x9373('0x45')](handleError(_0x2bbbdf,null));};exports[_0x9373('0x99')]=function(_0x232e21,_0x1ff253,_0x1742da){var _0x18035c={};var _0x49ee5b={};var _0xf41474;var _0x1ab34b;return db[_0x9373('0x41')][_0x9373('0x6c')]({'where':{'id':_0x232e21[_0x9373('0x47')]['id']}})[_0x9373('0x29')](handleEntityNotFound(_0x1ff253,null))[_0x9373('0x29')](function(_0x539b51){if(_0x539b51){_0xf41474=_0x539b51;_0x49ee5b['model']=_['keys'](db['User'][_0x9373('0x74')]);_0x49ee5b['query']=_[_0x9373('0x32')](_0x232e21[_0x9373('0x31')]);_0x49ee5b[_0x9373('0x33')]=_[_0x9373('0x35')](_0x49ee5b[_0x9373('0x34')],_0x49ee5b[_0x9373('0x31')]);_0x18035c[_0x9373('0x37')]=_[_0x9373('0x35')](_0x49ee5b['model'],qs[_0x9373('0x36')](_0x232e21[_0x9373('0x31')][_0x9373('0x36')]));_0x18035c['attributes']=_0x18035c[_0x9373('0x37')][_0x9373('0x38')]?_0x18035c[_0x9373('0x37')]:_0x49ee5b[_0x9373('0x34')];_0x18035c[_0x9373('0x3a')]=qs[_0x9373('0x3b')](_0x232e21[_0x9373('0x31')][_0x9373('0x3b')]);_0x18035c[_0x9373('0x3e')]=qs[_0x9373('0x33')](_[_0x9373('0x3c')](_0x232e21['query'],_0x49ee5b[_0x9373('0x33')]));if(_0x232e21[_0x9373('0x31')][_0x9373('0x3d')]){_0x18035c[_0x9373('0x3e')]=_[_0x9373('0x3f')](_0x18035c[_0x9373('0x3e')],{'$or':_[_0x9373('0x2e')](_0x18035c[_0x9373('0x37')],function(_0x5a738f){var _0x5b9641={};_0x5b9641[_0x5a738f]={'$like':'%'+_0x232e21[_0x9373('0x31')][_0x9373('0x3d')]+'%'};return _0x5b9641;})});}_0x18035c=_[_0x9373('0x3f')]({},_0x18035c,_0x232e21[_0x9373('0x48')]);return _0xf41474[_0x9373('0x99')](_0x18035c);}})[_0x9373('0x29')](function(_0x949848){if(_0x949848){_0x1ab34b=_0x949848['length'];if(!_0x232e21['query'][_0x9373('0x39')](_0x9373('0x9a'))){_0x18035c[_0x9373('0x21')]=qs[_0x9373('0x21')](_0x232e21[_0x9373('0x31')][_0x9373('0x21')]);_0x18035c[_0x9373('0x20')]=qs['offset'](_0x232e21['query'][_0x9373('0x20')]);}return _0xf41474[_0x9373('0x99')](_0x18035c);}})[_0x9373('0x29')](function(_0xfbef6b){if(_0xfbef6b){return _0xfbef6b?{'count':_0x1ab34b,'rows':_0xfbef6b}:null;}})[_0x9373('0x29')](respondWithResult(_0x1ff253,null))[_0x9373('0x45')](handleError(_0x1ff253,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index db0fcf5..41054c7 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 _0x66b7=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x66b7,0x14a));var _0x766b=function(_0x136031,_0x4c913f){_0x136031=_0x136031-0x0;var _0x943566=_0x66b7[_0x136031];return _0x943566;};'use strict';var EventEmitter=require(_0x766b('0x0'));var Team=require(_0x766b('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x766b('0x2')](0x0);var events={'afterCreate':_0x766b('0x3'),'afterUpdate':_0x766b('0x4'),'afterDestroy':_0x766b('0x5')};function emitEvent(_0x46e32e){return function(_0x13702e,_0x48a325,_0xaa1e48){TeamEvents['emit'](_0x46e32e+':'+_0x13702e['id'],_0x13702e);TeamEvents['emit'](_0x46e32e,_0x13702e);_0xaa1e48(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x766b('0x6')](e,emitEvent(event));}}module[_0x766b('0x7')]=TeamEvents; \ No newline at end of file +var _0x36d3=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x5575cd,_0x7a4fc6){var _0x35bc3e=function(_0x944f44){while(--_0x944f44){_0x5575cd['push'](_0x5575cd['shift']());}};_0x35bc3e(++_0x7a4fc6);}(_0x36d3,0x177));var _0x336d=function(_0x1760c2,_0x2a1fb5){_0x1760c2=_0x1760c2-0x0;var _0x32f4ed=_0x36d3[_0x1760c2];return _0x32f4ed;};'use strict';var EventEmitter=require(_0x336d('0x0'));var Team=require(_0x336d('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x336d('0x2')](0x0);var events={'afterCreate':_0x336d('0x3'),'afterUpdate':_0x336d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x282399){return function(_0x17797b,_0x35faf8,_0xadaf9a){TeamEvents[_0x336d('0x5')](_0x282399+':'+_0x17797b['id'],_0x17797b);TeamEvents['emit'](_0x282399,_0x17797b);_0xadaf9a(null);};}for(var e in events){if(events[_0x336d('0x6')](e)){var event=events[e];Team[_0x336d('0x7')](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 2d1c08d..0201d3c 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 _0xcfc3=['channel','catch','Team','Chat','Fax','Mail','Openchannel','Voice','lodash','./team.attributes','get','Queues','then','map','setDataValue'];(function(_0x89452,_0x2cd867){var _0x1c0c02=function(_0x27033c){while(--_0x27033c){_0x89452['push'](_0x89452['shift']());}};_0x1c0c02(++_0x2cd867);}(_0xcfc3,0x1ac));var _0x3cfc=function(_0x13f5a2,_0x435893){_0x13f5a2=_0x13f5a2-0x0;var _0x1c2719=_0xcfc3[_0x13f5a2];return _0x1c2719;};'use strict';var _=require(_0x3cfc('0x0'));var attributes=require(_0x3cfc('0x1'));function getQueuesByChannel(_0x185916,_0x1ec1e9){var _0x3217fb=_0x3cfc('0x2')+_0x1ec1e9+_0x3cfc('0x3');return _0x185916[_0x3217fb]()[_0x3cfc('0x4')](function(_0x200d49){return _[_0x3cfc('0x5')](_0x200d49,function(_0x1b0b25){_0x1b0b25[_0x3cfc('0x6')](_0x3cfc('0x7'),_0x1ec1e9);return _0x1b0b25;});})[_0x3cfc('0x8')](function(_0x4f14f1){throw _0x4f14f1;});}module['exports']=function(_0x45fe9f){return _0x45fe9f['define'](_0x3cfc('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x28c06f=this;var _0x442c39=[_0x3cfc('0xa'),_0x3cfc('0xb'),_0x3cfc('0xc'),_0x3cfc('0xd'),'Sms',_0x3cfc('0xe'),'Whatsapp'];return Promise['resolve']()[_0x3cfc('0x4')](function(){var _0x44dab4=_['map'](_0x442c39,function(_0x5886f0){return getQueuesByChannel(_0x28c06f,_0x5886f0);});return Promise['all'](_0x44dab4);})[_0x3cfc('0x8')](function(_0x15c9be){throw _0x15c9be;});}}});}; \ No newline at end of file +var _0x23b0=['catch','lodash','get','map','setDataValue','channel','exports','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','resolve','then','all'];(function(_0x55cd5a,_0x4272d4){var _0x6615be=function(_0x13ccdd){while(--_0x13ccdd){_0x55cd5a['push'](_0x55cd5a['shift']());}};_0x6615be(++_0x4272d4);}(_0x23b0,0x121));var _0x023b=function(_0x27a972,_0x1202fa){_0x27a972=_0x27a972-0x0;var _0x2770bd=_0x23b0[_0x27a972];return _0x2770bd;};'use strict';var _=require(_0x023b('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x482272,_0x136a97){var _0x214bc0=_0x023b('0x1')+_0x136a97+'Queues';return _0x482272[_0x214bc0]()['then'](function(_0x18afe1){return _[_0x023b('0x2')](_0x18afe1,function(_0x3c0da6){_0x3c0da6[_0x023b('0x3')](_0x023b('0x4'),_0x136a97);return _0x3c0da6;});})['catch'](function(_0x53f707){throw _0x53f707;});}module[_0x023b('0x5')]=function(_0x25ad44){return _0x25ad44['define'](_0x023b('0x6'),attributes,{'tableName':_0x023b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x2d82a6=this;var _0x31f6b4=[_0x023b('0x8'),_0x023b('0x9'),_0x023b('0xa'),_0x023b('0xb'),_0x023b('0xc'),_0x023b('0xd'),'Whatsapp'];return Promise[_0x023b('0xe')]()[_0x023b('0xf')](function(){var _0x10b1bd=_[_0x023b('0x2')](_0x31f6b4,function(_0x563a86){return getQueuesByChannel(_0x2d82a6,_0x563a86);});return Promise[_0x023b('0x10')](_0x10b1bd);})[_0x023b('0x11')](function(_0x3f6e5e){throw _0x3f6e5e;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index f3f66bb..75da10b 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 _0x32ca=['Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x2392c4,_0x9c9aed){var _0x158f6e=function(_0x9c066b){while(--_0x9c066b){_0x2392c4['push'](_0x2392c4['shift']());}};_0x158f6e(++_0x9c9aed);}(_0x32ca,0x13f));var _0xa32c=function(_0x32b5b1,_0x1da9ad){_0x32b5b1=_0x32b5b1-0x0;var _0x1fcc4c=_0x32ca[_0x32b5b1];return _0x1fcc4c;};'use strict';var _=require(_0xa32c('0x0'));var util=require('util');var moment=require(_0xa32c('0x1'));var BPromise=require(_0xa32c('0x2'));var rs=require(_0xa32c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa32c('0x4'));var logger=require(_0xa32c('0x5'))('rpc');var config=require(_0xa32c('0x6'));var jayson=require(_0xa32c('0x7'));var client=jayson[_0xa32c('0x8')][_0xa32c('0x9')]({'port':0x232a});config['redis']=_[_0xa32c('0xa')](config[_0xa32c('0xb')],{'host':_0xa32c('0xc'),'port':0x18eb});var socket=require(_0xa32c('0xd'))(new Redis(config[_0xa32c('0xb')]));require('./team.socket')[_0xa32c('0xe')](socket);function respondWithRpcPromise(_0x49fd03,_0x17ab8c,_0x15d8a8){return new BPromise(function(_0x165c4c,_0x12f2e7){return client[_0xa32c('0xf')](_0x49fd03,_0x15d8a8)['then'](function(_0x54cb48){logger[_0xa32c('0x10')](_0xa32c('0x11'),_0x17ab8c,_0xa32c('0x12'));logger['debug'](_0xa32c('0x13'),_0x17ab8c,_0xa32c('0x12'),JSON[_0xa32c('0x14')](_0x54cb48));if(_0x54cb48['error']){if(_0x54cb48[_0xa32c('0x15')][_0xa32c('0x16')]===0x1f4){logger[_0xa32c('0x15')]('Team,\x20%s,\x20%s',_0x17ab8c,_0x54cb48[_0xa32c('0x15')][_0xa32c('0x17')]);return _0x12f2e7(_0x54cb48[_0xa32c('0x15')][_0xa32c('0x17')]);}logger[_0xa32c('0x15')](_0xa32c('0x11'),_0x17ab8c,_0x54cb48['error'][_0xa32c('0x17')]);return _0x165c4c(_0x54cb48['error'][_0xa32c('0x17')]);}else{logger[_0xa32c('0x10')](_0xa32c('0x11'),_0x17ab8c,_0xa32c('0x12'));_0x165c4c(_0x54cb48[_0xa32c('0x18')][_0xa32c('0x17')]);}})[_0xa32c('0x19')](function(_0x3b62aa){logger['error'](_0xa32c('0x11'),_0x17ab8c,_0x3b62aa);_0x12f2e7(_0x3b62aa);});});} \ No newline at end of file +var _0xd8a5=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x29e871,_0x330b98){var _0x3380e3=function(_0x26eeae){while(--_0x26eeae){_0x29e871['push'](_0x29e871['shift']());}};_0x3380e3(++_0x330b98);}(_0xd8a5,0x160));var _0x5d8a=function(_0x17d1a2,_0x177328){_0x17d1a2=_0x17d1a2-0x0;var _0x2f167c=_0xd8a5[_0x17d1a2];return _0x2f167c;};'use strict';var _=require(_0x5d8a('0x0'));var util=require('util');var moment=require(_0x5d8a('0x1'));var BPromise=require(_0x5d8a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d8a('0x3'));var db=require(_0x5d8a('0x4'))['db'];var utils=require(_0x5d8a('0x5'));var logger=require(_0x5d8a('0x6'))(_0x5d8a('0x7'));var config=require(_0x5d8a('0x8'));var jayson=require(_0x5d8a('0x9'));var client=jayson[_0x5d8a('0xa')][_0x5d8a('0xb')]({'port':0x232a});config[_0x5d8a('0xc')]=_[_0x5d8a('0xd')](config[_0x5d8a('0xc')],{'host':_0x5d8a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d8a('0xc')]));require(_0x5d8a('0xf'))[_0x5d8a('0x10')](socket);function respondWithRpcPromise(_0x6de8fa,_0x3392cf,_0x5a0eb7){return new BPromise(function(_0x40ae14,_0xf20ccb){return client[_0x5d8a('0x11')](_0x6de8fa,_0x5a0eb7)[_0x5d8a('0x12')](function(_0x5219aa){logger[_0x5d8a('0x13')](_0x5d8a('0x14'),_0x3392cf,'request\x20sent');logger[_0x5d8a('0x15')](_0x5d8a('0x16'),_0x3392cf,_0x5d8a('0x17'),JSON[_0x5d8a('0x18')](_0x5219aa));if(_0x5219aa[_0x5d8a('0x19')]){if(_0x5219aa[_0x5d8a('0x19')][_0x5d8a('0x1a')]===0x1f4){logger[_0x5d8a('0x19')](_0x5d8a('0x14'),_0x3392cf,_0x5219aa[_0x5d8a('0x19')][_0x5d8a('0x1b')]);return _0xf20ccb(_0x5219aa[_0x5d8a('0x19')]['message']);}logger['error'](_0x5d8a('0x14'),_0x3392cf,_0x5219aa[_0x5d8a('0x19')]['message']);return _0x40ae14(_0x5219aa[_0x5d8a('0x19')][_0x5d8a('0x1b')]);}else{logger[_0x5d8a('0x13')](_0x5d8a('0x14'),_0x3392cf,'request\x20sent');_0x40ae14(_0x5219aa[_0x5d8a('0x1c')]['message']);}})[_0x5d8a('0x1d')](function(_0x380e52){logger[_0x5d8a('0x19')](_0x5d8a('0x14'),_0x3392cf,_0x380e52);_0xf20ccb(_0x380e52);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 346104f..d64d31a 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 _0xa74f=['emit','removeListener','length','team:','remove'];(function(_0x1cf9eb,_0xe1a336){var _0x3dd1a4=function(_0x3a9353){while(--_0x3a9353){_0x1cf9eb['push'](_0x1cf9eb['shift']());}};_0x3dd1a4(++_0xe1a336);}(_0xa74f,0x9a));var _0xfa74=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xa74f[_0x2d2c16];return _0x53f2fb;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0xfa74('0x0'),'update'];function createListener(_0x4b5765,_0x29e4c8){return function(_0x110824){_0x29e4c8[_0xfa74('0x1')](_0x4b5765,_0x110824);};}function removeListener(_0x25a9b7,_0x5b367b){return function(){TeamEvents[_0xfa74('0x2')](_0x25a9b7,_0x5b367b);};}exports['register']=function(_0x543cfe){for(var _0x43dd2f=0x0,_0x9ddbd2=events[_0xfa74('0x3')];_0x43dd2f<_0x9ddbd2;_0x43dd2f++){var _0x2d9fa9=events[_0x43dd2f];var _0x287921=createListener(_0xfa74('0x4')+_0x2d9fa9,_0x543cfe);TeamEvents['on'](_0x2d9fa9,_0x287921);}}; \ No newline at end of file +var _0x7f91=['register','length','./team.events','remove','removeListener'];(function(_0x3e5237,_0x3845d8){var _0x252880=function(_0x580d15){while(--_0x580d15){_0x3e5237['push'](_0x3e5237['shift']());}};_0x252880(++_0x3845d8);}(_0x7f91,0x93));var _0x17f9=function(_0x45ea78,_0x31678e){_0x45ea78=_0x45ea78-0x0;var _0xd722b7=_0x7f91[_0x45ea78];return _0xd722b7;};'use strict';var TeamEvents=require(_0x17f9('0x0'));var events=['save',_0x17f9('0x1'),'update'];function createListener(_0x5004ac,_0x22cb0d){return function(_0x1f254f){_0x22cb0d['emit'](_0x5004ac,_0x1f254f);};}function removeListener(_0x1d9bf8,_0x4da047){return function(){TeamEvents[_0x17f9('0x2')](_0x1d9bf8,_0x4da047);};}exports[_0x17f9('0x3')]=function(_0x1021ce){for(var _0x4ba671=0x0,_0x5d0eb1=events[_0x17f9('0x4')];_0x4ba671<_0x5d0eb1;_0x4ba671++){var _0x33baff=events[_0x4ba671];var _0x58c636=createListener('team:'+_0x33baff,_0x1021ce);TeamEvents['on'](_0x33baff,_0x58c636);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 70966c2..0ee55a9 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 _0x4ea3=['INTEGER','sequelize','exports'];(function(_0x15cf93,_0x5b1029){var _0x2afb0a=function(_0x5413ed){while(--_0x5413ed){_0x15cf93['push'](_0x15cf93['shift']());}};_0x2afb0a(++_0x5b1029);}(_0x4ea3,0x70));var _0x34ea=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4ea3[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x34ea('0x0'));module[_0x34ea('0x1')]={'TeamId':{'type':Sequelize[_0x34ea('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x34ea('0x2')]}}; \ No newline at end of file +var _0x834d=['exports','INTEGER','sequelize'];(function(_0x2ffbd9,_0x5c73e8){var _0x8c1900=function(_0x3d32f2){while(--_0x3d32f2){_0x2ffbd9['push'](_0x2ffbd9['shift']());}};_0x8c1900(++_0x5c73e8);}(_0x834d,0x140));var _0xd834=function(_0x29fd0b,_0x459e7a){_0x29fd0b=_0x29fd0b-0x0;var _0x4e37c8=_0x834d[_0x29fd0b];return _0x4e37c8;};'use strict';var Sequelize=require(_0xd834('0x0'));module[_0xd834('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xd834('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index e6d866a..3b8c9d8 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 _0xc6fe=['bluebird','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','api','moment'];(function(_0x507abf,_0x102de1){var _0x93bddf=function(_0x1230d8){while(--_0x1230d8){_0x507abf['push'](_0x507abf['shift']());}};_0x93bddf(++_0x102de1);}(_0xc6fe,0xbc));var _0xec6f=function(_0x3df373,_0x45de06){_0x3df373=_0x3df373-0x0;var _0x43f399=_0xc6fe[_0x3df373];return _0x43f399;};'use strict';var _=require(_0xec6f('0x0'));var util=require(_0xec6f('0x1'));var logger=require('../../config/logger')(_0xec6f('0x2'));var moment=require(_0xec6f('0x3'));var BPromise=require(_0xec6f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec6f('0x5'));var rimraf=require('rimraf');var config=require(_0xec6f('0x6'));var attributes=require(_0xec6f('0x7'));module[_0xec6f('0x8')]=function(_0x2f64ea,_0x4adbb8){return _0x2f64ea[_0xec6f('0x9')](_0xec6f('0xa'),attributes,{'tableName':_0xec6f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15f9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x15f9,0xf7));var _0x915f=function(_0x928f8b,_0x40e7e0){_0x928f8b=_0x928f8b-0x0;var _0x5c8e6e=_0x15f9[_0x928f8b];return _0x5c8e6e;};'use strict';var _=require(_0x915f('0x0'));var util=require(_0x915f('0x1'));var logger=require(_0x915f('0x2'))(_0x915f('0x3'));var moment=require(_0x915f('0x4'));var BPromise=require(_0x915f('0x5'));var rp=require(_0x915f('0x6'));var fs=require('fs');var path=require(_0x915f('0x7'));var rimraf=require(_0x915f('0x8'));var config=require('../../config/environment');var attributes=require(_0x915f('0x9'));module[_0x915f('0xa')]=function(_0x37972d,_0x44264e){return _0x37972d['define'](_0x915f('0xb'),attributes,{'tableName':_0x915f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 5e4e863..d7591ac 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x160a50,_0x4d6597){var _0xabf8d5=function(_0x26a228){while(--_0x26a228){_0x160a50['push'](_0x160a50['shift']());}};_0xabf8d5(++_0x4d6597);}(_0xedd9,0xfc));var _0x9edd=function(_0x1c81af,_0x57b08b){_0x1c81af=_0x1c81af-0x0;var _0x328228=_0xedd9[_0x1c81af];return _0x328228;};'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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x36cbd8,_0x18b1ad){var _0x4058d0=function(_0x323e60){while(--_0x323e60){_0x36cbd8['push'](_0x36cbd8['shift']());}};_0x4058d0(++_0x18b1ad);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 5caa101..ed191af 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 _0x79fc=['INTEGER','exports'];(function(_0x5706dd,_0xdad318){var _0x4606b6=function(_0xf36185){while(--_0xf36185){_0x5706dd['push'](_0x5706dd['shift']());}};_0x4606b6(++_0xdad318);}(_0x79fc,0x1db));var _0xc79f=function(_0x43b9df,_0x48e578){_0x43b9df=_0x43b9df-0x0;var _0xb0cb10=_0x79fc[_0x43b9df];return _0xb0cb10;};'use strict';var Sequelize=require('sequelize');module[_0xc79f('0x0')]={'penalty':{'type':Sequelize[_0xc79f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x89db=['exports'];(function(_0x27e580,_0x833f06){var _0xd9d966=function(_0x490dad){while(--_0x490dad){_0x27e580['push'](_0x27e580['shift']());}};_0xd9d966(++_0x833f06);}(_0x89db,0xdf));var _0xb89d=function(_0x34aab7,_0x29c67a){_0x34aab7=_0x34aab7-0x0;var _0x20a062=_0x89db[_0x34aab7];return _0x20a062;};'use strict';var Sequelize=require('sequelize');module[_0xb89d('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 2f55664..b926f3d 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 _0x130d=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5459c1,_0x36f6f0){var _0x3f99b5=function(_0x512bea){while(--_0x512bea){_0x5459c1['push'](_0x5459c1['shift']());}};_0x3f99b5(++_0x36f6f0);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var util=require('util');var logger=require(_0xd130('0x1'))('api');var moment=require(_0xd130('0x2'));var BPromise=require(_0xd130('0x3'));var rp=require(_0xd130('0x4'));var fs=require('fs');var path=require(_0xd130('0x5'));var rimraf=require(_0xd130('0x6'));var config=require(_0xd130('0x7'));var attributes=require(_0xd130('0x8'));module[_0xd130('0x9')]=function(_0x287e61,_0x4689a8){return _0x287e61[_0xd130('0xa')](_0xd130('0xb'),attributes,{'tableName':_0xd130('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdad2=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','util'];(function(_0x5d3b01,_0x452450){var _0x432f8a=function(_0x5d477d){while(--_0x5d477d){_0x5d3b01['push'](_0x5d3b01['shift']());}};_0x432f8a(++_0x452450);}(_0xdad2,0x14c));var _0x2dad=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xdad2[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x2dad('0x0'));var logger=require(_0x2dad('0x1'))('api');var moment=require(_0x2dad('0x2'));var BPromise=require(_0x2dad('0x3'));var rp=require(_0x2dad('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2dad('0x5'));var config=require(_0x2dad('0x6'));var attributes=require('./teamVoiceQueue.attributes');module[_0x2dad('0x7')]=function(_0x36a054,_0x27ca04){return _0x36a054[_0x2dad('0x8')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','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 8a25e4d..e92053d 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 _0xb088=['request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x51b64b,_0x306317){var _0x4167a8=function(_0x4e7b74){while(--_0x4e7b74){_0x51b64b['push'](_0x51b64b['shift']());}};_0x4167a8(++_0x306317);}(_0xb088,0x7b));var _0x8b08=function(_0x3da885,_0x5b66cc){_0x3da885=_0x3da885-0x0;var _0x1c4569=_0xb088[_0x3da885];return _0x1c4569;};'use strict';var _=require(_0x8b08('0x0'));var util=require(_0x8b08('0x1'));var moment=require(_0x8b08('0x2'));var BPromise=require(_0x8b08('0x3'));var rs=require(_0x8b08('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b08('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b08('0x6'))(_0x8b08('0x7'));var config=require(_0x8b08('0x8'));var jayson=require(_0x8b08('0x9'));var client=jayson['client'][_0x8b08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17dd63,_0xe29c94,_0x4ec834){return new BPromise(function(_0x3f2890,_0x242c07){return client[_0x8b08('0xb')](_0x17dd63,_0x4ec834)[_0x8b08('0xc')](function(_0x2c67ad){logger[_0x8b08('0xd')](_0x8b08('0xe'),_0xe29c94,_0x8b08('0xf'));logger[_0x8b08('0x10')](_0x8b08('0x11'),_0xe29c94,'request\x20sent',JSON[_0x8b08('0x12')](_0x2c67ad));if(_0x2c67ad[_0x8b08('0x13')]){if(_0x2c67ad[_0x8b08('0x13')][_0x8b08('0x14')]===0x1f4){logger[_0x8b08('0x13')](_0x8b08('0xe'),_0xe29c94,_0x2c67ad[_0x8b08('0x13')][_0x8b08('0x15')]);return _0x242c07(_0x2c67ad[_0x8b08('0x13')][_0x8b08('0x15')]);}logger[_0x8b08('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0xe29c94,_0x2c67ad[_0x8b08('0x13')]['message']);return _0x3f2890(_0x2c67ad['error']['message']);}else{logger['info'](_0x8b08('0xe'),_0xe29c94,'request\x20sent');_0x3f2890(_0x2c67ad[_0x8b08('0x16')]['message']);}})['catch'](function(_0x1d6499){logger['error'](_0x8b08('0xe'),_0xe29c94,_0x1d6499);_0x242c07(_0x1d6499);});});} \ No newline at end of file +var _0x8d5b=['../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4dbdd3,_0x531daf){var _0x2049e9=function(_0x13b003){while(--_0x13b003){_0x4dbdd3['push'](_0x4dbdd3['shift']());}};_0x2049e9(++_0x531daf);}(_0x8d5b,0x19f));var _0xb8d5=function(_0x46d9c9,_0x39a084){_0x46d9c9=_0x46d9c9-0x0;var _0x46b104=_0x8d5b[_0x46d9c9];return _0x46b104;};'use strict';var _=require(_0xb8d5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb8d5('0x1'));var rs=require(_0xb8d5('0x2'));var fs=require('fs');var Redis=require(_0xb8d5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb8d5('0x4'));var logger=require(_0xb8d5('0x5'))(_0xb8d5('0x6'));var config=require(_0xb8d5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb8d5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x493e5b,_0x15bcd0,_0xba9d6e){return new BPromise(function(_0x2df97e,_0x4b2adf){return client[_0xb8d5('0x9')](_0x493e5b,_0xba9d6e)[_0xb8d5('0xa')](function(_0x443bff){logger[_0xb8d5('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x15bcd0,_0xb8d5('0xc'));logger['debug'](_0xb8d5('0xd'),_0x15bcd0,_0xb8d5('0xc'),JSON[_0xb8d5('0xe')](_0x443bff));if(_0x443bff[_0xb8d5('0xf')]){if(_0x443bff[_0xb8d5('0xf')]['code']===0x1f4){logger['error'](_0xb8d5('0x10'),_0x15bcd0,_0x443bff[_0xb8d5('0xf')][_0xb8d5('0x11')]);return _0x4b2adf(_0x443bff['error'][_0xb8d5('0x11')]);}logger[_0xb8d5('0xf')](_0xb8d5('0x10'),_0x15bcd0,_0x443bff[_0xb8d5('0xf')][_0xb8d5('0x11')]);return _0x2df97e(_0x443bff[_0xb8d5('0xf')][_0xb8d5('0x11')]);}else{logger[_0xb8d5('0xb')](_0xb8d5('0x10'),_0x15bcd0,_0xb8d5('0xc'));_0x2df97e(_0x443bff[_0xb8d5('0x12')][_0xb8d5('0x11')]);}})[_0xb8d5('0x13')](function(_0x308fae){logger[_0xb8d5('0xf')](_0xb8d5('0x10'),_0x15bcd0,_0x308fae);_0x4b2adf(_0x308fae);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 3fa85c5..d3d7cbb 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 _0x46c1=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','util','path'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0x46c1,0x7c));var _0x146c=function(_0x1b63e1,_0x30a406){_0x1b63e1=_0x1b63e1-0x0;var _0x18e513=_0x46c1[_0x1b63e1];return _0x18e513;};'use strict';var multer=require('multer');var util=require(_0x146c('0x0'));var path=require(_0x146c('0x1'));var timeout=require(_0x146c('0x2'));var express=require(_0x146c('0x3'));var router=express[_0x146c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x146c('0x5'));var interaction=require(_0x146c('0x6'));var config=require(_0x146c('0x7'));var controller=require(_0x146c('0x8'));router[_0x146c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x146c('0x9')](_0x146c('0xa'),auth[_0x146c('0xb')](),controller['show']);router[_0x146c('0xc')]('/',auth['isAuthenticated'](),controller[_0x146c('0xd')]);router[_0x146c('0xe')]('/:id',auth[_0x146c('0xb')](),controller[_0x146c('0xf')]);router[_0x146c('0x10')](_0x146c('0xa'),auth['isAuthenticated'](),controller[_0x146c('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe61c=['put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x5a6de2,_0x5c8b10){var _0x2c0525=function(_0x59d072){while(--_0x59d072){_0x5a6de2['push'](_0x5a6de2['shift']());}};_0x2c0525(++_0x5c8b10);}(_0xe61c,0xee));var _0xce61=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xe61c[_0x4a7631];return _0x1a5a6f;};'use strict';var multer=require(_0xce61('0x0'));var util=require('util');var path=require(_0xce61('0x1'));var timeout=require(_0xce61('0x2'));var express=require(_0xce61('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xce61('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xce61('0x5'));var controller=require(_0xce61('0x6'));router[_0xce61('0x7')]('/',auth[_0xce61('0x8')](),controller[_0xce61('0x9')]);router[_0xce61('0x7')](_0xce61('0xa'),auth['isAuthenticated'](),controller[_0xce61('0xb')]);router[_0xce61('0xc')]('/',auth[_0xce61('0x8')](),controller[_0xce61('0xd')]);router[_0xce61('0xe')](_0xce61('0xa'),auth[_0xce61('0x8')](),controller['update']);router[_0xce61('0xf')](_0xce61('0xa'),auth['isAuthenticated'](),controller[_0xce61('0x10')]);module[_0xce61('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 048ecfa..ef51581 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 _0x634b=['exports','STRING','TEXT'];(function(_0x1ef01c,_0x5a0b84){var _0x42c8ed=function(_0x3531cd){while(--_0x3531cd){_0x1ef01c['push'](_0x1ef01c['shift']());}};_0x42c8ed(++_0x5a0b84);}(_0x634b,0x153));var _0xb634=function(_0x16560c,_0x5a0b94){_0x16560c=_0x16560c-0x0;var _0x16b918=_0x634b[_0x16560c];return _0x16b918;};'use strict';var Sequelize=require('sequelize');module[_0xb634('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb634('0x1')]},'html':{'type':Sequelize[_0xb634('0x2')]}}; \ No newline at end of file +var _0x75b8=['sequelize','STRING','TEXT'];(function(_0x4c54eb,_0x42cff7){var _0x25d5a8=function(_0xdab0c3){while(--_0xdab0c3){_0x4c54eb['push'](_0x4c54eb['shift']());}};_0x25d5a8(++_0x42cff7);}(_0x75b8,0x90));var _0x875b=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0x75b8[_0x2ed7d1];return _0x38ae3c;};'use strict';var Sequelize=require(_0x875b('0x0'));module['exports']={'name':{'type':Sequelize[_0x875b('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x875b('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 21ad0b2..df9bc6c 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 _0x7278=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','Templates','UserProfileResource','end','stack','name','send','index','map','Template','rawAttributes','type','key','model','query','keys','filters','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','intersection','include','create','body','user','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel'];(function(_0x1e476b,_0x4ac7b3){var _0x4a75b2=function(_0x34e816){while(--_0x34e816){_0x1e476b['push'](_0x1e476b['shift']());}};_0x4a75b2(++_0x4ac7b3);}(_0x7278,0xed));var _0x8727=function(_0x3a1ae3,_0x35197e){_0x3a1ae3=_0x3a1ae3-0x0;var _0xb193b8=_0x7278[_0x3a1ae3];return _0xb193b8;};'use strict';var emlformat=require(_0x8727('0x0'));var rimraf=require(_0x8727('0x1'));var zipdir=require(_0x8727('0x2'));var jsonpatch=require(_0x8727('0x3'));var rp=require(_0x8727('0x4'));var moment=require(_0x8727('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8727('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8727('0x7'));var csv=require(_0x8727('0x8'));var ejs=require(_0x8727('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8727('0xa'));var squel=require(_0x8727('0xb'));var crypto=require(_0x8727('0xc'));var jsforce=require(_0x8727('0xd'));var deskjs=require(_0x8727('0xe'));var toCsv=require(_0x8727('0x8'));var querystring=require(_0x8727('0xf'));var Papa=require(_0x8727('0x10'));var Redis=require(_0x8727('0x11'));var authService=require(_0x8727('0x12'));var qs=require(_0x8727('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8727('0x14'));var logger=require(_0x8727('0x15'))(_0x8727('0x16'));var utils=require(_0x8727('0x17'));var config=require(_0x8727('0x18'));var licenseUtil=require(_0x8727('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f3342,_0x13d3be){_0x13d3be=_0x13d3be||0xcc;return function(_0x5be272){if(_0x5be272){return _0x4f3342[_0x8727('0x1a')](_0x13d3be);}return _0x4f3342[_0x8727('0x1b')](_0x13d3be)['end']();};}function respondWithResult(_0x14489f,_0x33c4ef){_0x33c4ef=_0x33c4ef||0xc8;return function(_0x5dbed0){if(_0x5dbed0){return _0x14489f[_0x8727('0x1b')](_0x33c4ef)[_0x8727('0x1c')](_0x5dbed0);}};}function respondWithFilteredResult(_0x403642,_0x528a9b){return function(_0x44919d){if(_0x44919d){var _0x4c789c=typeof _0x528a9b[_0x8727('0x1d')]===_0x8727('0x1e')&&typeof _0x528a9b['limit']==='undefined';var _0x453a52=_0x44919d[_0x8727('0x1f')];var _0x599edf=_0x4c789c?0x0:_0x528a9b['offset'];var _0x1903ed=_0x4c789c?_0x44919d[_0x8727('0x1f')]:_0x528a9b['offset']+_0x528a9b[_0x8727('0x20')];var _0x1b37c8;if(_0x1903ed>=_0x453a52){_0x1903ed=_0x453a52;_0x1b37c8=0xc8;}else{_0x1b37c8=0xce;}_0x403642[_0x8727('0x1b')](_0x1b37c8);return _0x403642[_0x8727('0x21')](_0x8727('0x22'),_0x599edf+'-'+_0x1903ed+'/'+_0x453a52)[_0x8727('0x1c')](_0x44919d);}return null;};}function patchUpdates(_0x109055){return function(_0x1422cb){try{jsonpatch['apply'](_0x1422cb,_0x109055,!![]);}catch(_0x40e56b){return BPromise['reject'](_0x40e56b);}return _0x1422cb['save']();};}function saveUpdates(_0x2e75d3,_0x2feb33){return function(_0x25a003){if(_0x25a003){return _0x25a003[_0x8727('0x23')](_0x2e75d3)[_0x8727('0x24')](function(_0x4d9073){return _0x4d9073;});}return null;};}function removeEntity(_0x136ffc,_0x187351){return function(_0x2f0e88){if(_0x2f0e88){return _0x2f0e88[_0x8727('0x25')]()['then'](function(){var _0x338c55=_0x2f0e88[_0x8727('0x26')]({'plain':!![]});var _0x53ff4e=_0x8727('0x27');return db[_0x8727('0x28')][_0x8727('0x25')]({'where':{'type':_0x53ff4e,'resourceId':_0x338c55['id']}})['then'](function(){return _0x2f0e88;});})[_0x8727('0x24')](function(){_0x136ffc[_0x8727('0x1b')](0xcc)[_0x8727('0x29')]();});}};}function handleEntityNotFound(_0x572411,_0x1e3e91){return function(_0x5740fc){if(!_0x5740fc){_0x572411[_0x8727('0x1a')](0x194);}return _0x5740fc;};}function handleError(_0x50f90c,_0x40ed92){_0x40ed92=_0x40ed92||0x1f4;return function(_0x9f626d){logger['error'](_0x9f626d[_0x8727('0x2a')]);if(_0x9f626d[_0x8727('0x2b')]){delete _0x9f626d[_0x8727('0x2b')];}_0x50f90c['status'](_0x40ed92)[_0x8727('0x2c')](_0x9f626d);};}exports[_0x8727('0x2d')]=function(_0x48e1a2,_0x231ee5){var _0x47c254={},_0x107921={},_0x5a259a={'count':0x0,'rows':[]};var _0x363ab1=_[_0x8727('0x2e')](db[_0x8727('0x2f')][_0x8727('0x30')],function(_0x17f197){return{'name':_0x17f197['fieldName'],'type':_0x17f197[_0x8727('0x31')][_0x8727('0x32')]};});_0x107921[_0x8727('0x33')]=_[_0x8727('0x2e')](_0x363ab1,_0x8727('0x2b'));_0x107921[_0x8727('0x34')]=_[_0x8727('0x35')](_0x48e1a2[_0x8727('0x34')]);_0x107921[_0x8727('0x36')]=_['intersection'](_0x107921[_0x8727('0x33')],_0x107921[_0x8727('0x34')]);_0x47c254['attributes']=_['intersection'](_0x107921[_0x8727('0x33')],qs[_0x8727('0x37')](_0x48e1a2[_0x8727('0x34')]['fields']));_0x47c254['attributes']=_0x47c254['attributes'][_0x8727('0x38')]?_0x47c254[_0x8727('0x39')]:_0x107921[_0x8727('0x33')];if(!_0x48e1a2[_0x8727('0x34')][_0x8727('0x3a')](_0x8727('0x3b'))){_0x47c254[_0x8727('0x20')]=qs[_0x8727('0x20')](_0x48e1a2['query'][_0x8727('0x20')]);_0x47c254[_0x8727('0x1d')]=qs['offset'](_0x48e1a2[_0x8727('0x34')][_0x8727('0x1d')]);}_0x47c254[_0x8727('0x3c')]=qs[_0x8727('0x3d')](_0x48e1a2[_0x8727('0x34')][_0x8727('0x3d')]);_0x47c254['where']=qs[_0x8727('0x36')](_[_0x8727('0x3e')](_0x48e1a2[_0x8727('0x34')],_0x107921[_0x8727('0x36')]),_0x363ab1);if(_0x48e1a2[_0x8727('0x34')][_0x8727('0x3f')]){_0x47c254[_0x8727('0x40')]=_['merge'](_0x47c254[_0x8727('0x40')],{'$or':_[_0x8727('0x2e')](_0x363ab1,function(_0x45bb7c){if(_0x45bb7c[_0x8727('0x31')]!==_0x8727('0x41')){var _0xf6b6d1={};_0xf6b6d1[_0x45bb7c[_0x8727('0x2b')]]={'$like':'%'+_0x48e1a2[_0x8727('0x34')][_0x8727('0x3f')]+'%'};return _0xf6b6d1;}})});}_0x47c254=_[_0x8727('0x42')]({},_0x47c254,_0x48e1a2[_0x8727('0x43')]);var _0x5b2dca={'where':_0x47c254[_0x8727('0x40')]};return db[_0x8727('0x2f')][_0x8727('0x1f')](_0x5b2dca)[_0x8727('0x24')](function(_0x556b11){_0x5a259a['count']=_0x556b11;if(_0x48e1a2[_0x8727('0x34')][_0x8727('0x44')]){_0x47c254['include']=[{'all':!![]}];}return db[_0x8727('0x2f')][_0x8727('0x45')](_0x47c254);})[_0x8727('0x24')](function(_0x1f0b1c){_0x5a259a[_0x8727('0x46')]=_0x1f0b1c;return _0x5a259a;})['then'](respondWithFilteredResult(_0x231ee5,_0x47c254))[_0x8727('0x47')](handleError(_0x231ee5,null));};exports[_0x8727('0x48')]=function(_0x5ea8b0,_0x409f16){var _0x32b5a8={'raw':!![],'where':{'id':_0x5ea8b0[_0x8727('0x49')]['id']}},_0x2f4a5e={};_0x2f4a5e[_0x8727('0x33')]=_[_0x8727('0x35')](db['Template'][_0x8727('0x30')]);_0x2f4a5e[_0x8727('0x34')]=_['keys'](_0x5ea8b0['query']);_0x2f4a5e[_0x8727('0x36')]=_[_0x8727('0x4a')](_0x2f4a5e[_0x8727('0x33')],_0x2f4a5e[_0x8727('0x34')]);_0x32b5a8[_0x8727('0x39')]=_[_0x8727('0x4a')](_0x2f4a5e[_0x8727('0x33')],qs[_0x8727('0x37')](_0x5ea8b0['query'][_0x8727('0x37')]));_0x32b5a8['attributes']=_0x32b5a8[_0x8727('0x39')][_0x8727('0x38')]?_0x32b5a8[_0x8727('0x39')]:_0x2f4a5e[_0x8727('0x33')];if(_0x5ea8b0['query'][_0x8727('0x44')]){_0x32b5a8[_0x8727('0x4b')]=[{'all':!![]}];}_0x32b5a8=_[_0x8727('0x42')]({},_0x32b5a8,_0x5ea8b0[_0x8727('0x43')]);return db[_0x8727('0x2f')]['find'](_0x32b5a8)[_0x8727('0x24')](handleEntityNotFound(_0x409f16,null))[_0x8727('0x24')](respondWithResult(_0x409f16,null))[_0x8727('0x47')](handleError(_0x409f16,null));};exports[_0x8727('0x4c')]=function(_0x56466e,_0x23b148){return db[_0x8727('0x2f')][_0x8727('0x4c')](_0x56466e[_0x8727('0x4d')],{})['then'](function(_0x266324){var _0x23e708=_0x56466e[_0x8727('0x4e')]['get']({'plain':!![]});if(!_0x23e708)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23e708['role']===_0x8727('0x4e')){var _0x95d7f1=_0x266324[_0x8727('0x26')]({'plain':!![]});var _0x5a9365=_0x8727('0x27');return db[_0x8727('0x4f')][_0x8727('0x50')]({'where':{'name':_0x5a9365,'userProfileId':_0x23e708['userProfileId']},'raw':!![]})[_0x8727('0x24')](function(_0x375010){if(_0x375010&&_0x375010['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x95d7f1['name'],'resourceId':_0x95d7f1['id'],'type':_0x375010[_0x8727('0x2b')],'sectionId':_0x375010['id']},{})[_0x8727('0x24')](function(){return _0x266324;});}else{return _0x266324;}})[_0x8727('0x47')](function(_0x1f60c3){logger[_0x8727('0x51')](_0x8727('0x52'),_0x1f60c3);throw _0x1f60c3;});}return _0x266324;})[_0x8727('0x24')](respondWithResult(_0x23b148,0xc9))[_0x8727('0x47')](handleError(_0x23b148,null));};exports['update']=function(_0x11a162,_0x4de416){if(_0x11a162[_0x8727('0x4d')]['id']){delete _0x11a162[_0x8727('0x4d')]['id'];}return db[_0x8727('0x2f')]['find']({'where':{'id':_0x11a162[_0x8727('0x49')]['id']}})[_0x8727('0x24')](handleEntityNotFound(_0x4de416,null))[_0x8727('0x24')](saveUpdates(_0x11a162[_0x8727('0x4d')],null))[_0x8727('0x24')](respondWithResult(_0x4de416,null))['catch'](handleError(_0x4de416,null));};exports[_0x8727('0x25')]=function(_0x5ac410,_0x3892d8){return db[_0x8727('0x2f')][_0x8727('0x50')]({'where':{'id':_0x5ac410[_0x8727('0x49')]['id']}})[_0x8727('0x24')](handleEntityNotFound(_0x3892d8,null))['then'](removeEntity(_0x3892d8,null))[_0x8727('0x47')](handleError(_0x3892d8,null));}; \ No newline at end of file +var _0x7211=['UserProfileResource','error','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','rows','catch','show','fields','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','destroy','then'];(function(_0x3be085,_0x42e70f){var _0x39bfd2=function(_0x49185f){while(--_0x49185f){_0x3be085['push'](_0x3be085['shift']());}};_0x39bfd2(++_0x42e70f);}(_0x7211,0x181));var _0x1721=function(_0x51d9fc,_0x47161d){_0x51d9fc=_0x51d9fc-0x0;var _0x91d94d=_0x7211[_0x51d9fc];return _0x91d94d;};'use strict';var emlformat=require(_0x1721('0x0'));var rimraf=require(_0x1721('0x1'));var zipdir=require(_0x1721('0x2'));var jsonpatch=require(_0x1721('0x3'));var rp=require(_0x1721('0x4'));var moment=require('moment');var BPromise=require(_0x1721('0x5'));var Mustache=require(_0x1721('0x6'));var util=require('util');var path=require(_0x1721('0x7'));var sox=require(_0x1721('0x8'));var csv=require(_0x1721('0x9'));var ejs=require(_0x1721('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1721('0xb'));var crypto=require('crypto');var jsforce=require(_0x1721('0xc'));var deskjs=require(_0x1721('0xd'));var toCsv=require(_0x1721('0x9'));var querystring=require(_0x1721('0xe'));var Papa=require(_0x1721('0xf'));var Redis=require(_0x1721('0x10'));var authService=require(_0x1721('0x11'));var qs=require(_0x1721('0x12'));var as=require(_0x1721('0x13'));var hardwareService=require(_0x1721('0x14'));var logger=require(_0x1721('0x15'))('api');var utils=require(_0x1721('0x16'));var config=require(_0x1721('0x17'));var licenseUtil=require(_0x1721('0x18'));var db=require(_0x1721('0x19'))['db'];function respondWithStatusCode(_0x3bf560,_0x56c4ba){_0x56c4ba=_0x56c4ba||0xcc;return function(_0x5571fa){if(_0x5571fa){return _0x3bf560[_0x1721('0x1a')](_0x56c4ba);}return _0x3bf560[_0x1721('0x1b')](_0x56c4ba)[_0x1721('0x1c')]();};}function respondWithResult(_0x24917d,_0x27e9a0){_0x27e9a0=_0x27e9a0||0xc8;return function(_0x4c7a8d){if(_0x4c7a8d){return _0x24917d[_0x1721('0x1b')](_0x27e9a0)[_0x1721('0x1d')](_0x4c7a8d);}};}function respondWithFilteredResult(_0xc3f693,_0x4352af){return function(_0x34173f){if(_0x34173f){var _0x3c0b3b=typeof _0x4352af[_0x1721('0x1e')]==='undefined'&&typeof _0x4352af['limit']===_0x1721('0x1f');var _0x3ed19c=_0x34173f[_0x1721('0x20')];var _0x4787e9=_0x3c0b3b?0x0:_0x4352af[_0x1721('0x1e')];var _0x45a4df=_0x3c0b3b?_0x34173f['count']:_0x4352af[_0x1721('0x1e')]+_0x4352af[_0x1721('0x21')];var _0xb5aa36;if(_0x45a4df>=_0x3ed19c){_0x45a4df=_0x3ed19c;_0xb5aa36=0xc8;}else{_0xb5aa36=0xce;}_0xc3f693[_0x1721('0x1b')](_0xb5aa36);return _0xc3f693[_0x1721('0x22')]('Content-Range',_0x4787e9+'-'+_0x45a4df+'/'+_0x3ed19c)['json'](_0x34173f);}return null;};}function patchUpdates(_0x33b537){return function(_0x13b047){try{jsonpatch[_0x1721('0x23')](_0x13b047,_0x33b537,!![]);}catch(_0x7a75b7){return BPromise[_0x1721('0x24')](_0x7a75b7);}return _0x13b047[_0x1721('0x25')]();};}function saveUpdates(_0x53b27f,_0xd5d696){return function(_0x5a97fd){if(_0x5a97fd){return _0x5a97fd['update'](_0x53b27f)['then'](function(_0x1345c2){return _0x1345c2;});}return null;};}function removeEntity(_0x5e2dfe,_0x263743){return function(_0x165099){if(_0x165099){return _0x165099[_0x1721('0x26')]()[_0x1721('0x27')](function(){var _0x536cc0=_0x165099['get']({'plain':!![]});var _0x3ce068='Templates';return db[_0x1721('0x28')][_0x1721('0x26')]({'where':{'type':_0x3ce068,'resourceId':_0x536cc0['id']}})[_0x1721('0x27')](function(){return _0x165099;});})[_0x1721('0x27')](function(){_0x5e2dfe[_0x1721('0x1b')](0xcc)[_0x1721('0x1c')]();});}};}function handleEntityNotFound(_0x6956ce,_0x55e7ad){return function(_0x3876a1){if(!_0x3876a1){_0x6956ce['sendStatus'](0x194);}return _0x3876a1;};}function handleError(_0x54aac7,_0x41956d){_0x41956d=_0x41956d||0x1f4;return function(_0x5d139b){logger[_0x1721('0x29')](_0x5d139b['stack']);if(_0x5d139b['name']){delete _0x5d139b['name'];}_0x54aac7[_0x1721('0x1b')](_0x41956d)[_0x1721('0x2a')](_0x5d139b);};}exports[_0x1721('0x2b')]=function(_0x181b06,_0x2ab3b1){var _0x15554c={},_0x1eaffc={},_0x365bd6={'count':0x0,'rows':[]};var _0x37fe2e=_[_0x1721('0x2c')](db[_0x1721('0x2d')][_0x1721('0x2e')],function(_0x185730){return{'name':_0x185730[_0x1721('0x2f')],'type':_0x185730[_0x1721('0x30')][_0x1721('0x31')]};});_0x1eaffc[_0x1721('0x32')]=_[_0x1721('0x2c')](_0x37fe2e,'name');_0x1eaffc[_0x1721('0x33')]=_[_0x1721('0x34')](_0x181b06[_0x1721('0x33')]);_0x1eaffc[_0x1721('0x35')]=_['intersection'](_0x1eaffc[_0x1721('0x32')],_0x1eaffc[_0x1721('0x33')]);_0x15554c[_0x1721('0x36')]=_[_0x1721('0x37')](_0x1eaffc['model'],qs['fields'](_0x181b06[_0x1721('0x33')]['fields']));_0x15554c[_0x1721('0x36')]=_0x15554c[_0x1721('0x36')][_0x1721('0x38')]?_0x15554c[_0x1721('0x36')]:_0x1eaffc['model'];if(!_0x181b06[_0x1721('0x33')][_0x1721('0x39')](_0x1721('0x3a'))){_0x15554c[_0x1721('0x21')]=qs[_0x1721('0x21')](_0x181b06[_0x1721('0x33')]['limit']);_0x15554c[_0x1721('0x1e')]=qs[_0x1721('0x1e')](_0x181b06[_0x1721('0x33')][_0x1721('0x1e')]);}_0x15554c[_0x1721('0x3b')]=qs[_0x1721('0x3c')](_0x181b06[_0x1721('0x33')][_0x1721('0x3c')]);_0x15554c[_0x1721('0x3d')]=qs[_0x1721('0x35')](_[_0x1721('0x3e')](_0x181b06[_0x1721('0x33')],_0x1eaffc['filters']),_0x37fe2e);if(_0x181b06[_0x1721('0x33')]['filter']){_0x15554c[_0x1721('0x3d')]=_[_0x1721('0x3f')](_0x15554c[_0x1721('0x3d')],{'$or':_[_0x1721('0x2c')](_0x37fe2e,function(_0x160584){if(_0x160584[_0x1721('0x30')]!=='VIRTUAL'){var _0x12a855={};_0x12a855[_0x160584['name']]={'$like':'%'+_0x181b06[_0x1721('0x33')][_0x1721('0x40')]+'%'};return _0x12a855;}})});}_0x15554c=_['merge']({},_0x15554c,_0x181b06[_0x1721('0x41')]);var _0x4951d4={'where':_0x15554c[_0x1721('0x3d')]};return db[_0x1721('0x2d')]['count'](_0x4951d4)[_0x1721('0x27')](function(_0x58ce7b){_0x365bd6[_0x1721('0x20')]=_0x58ce7b;if(_0x181b06[_0x1721('0x33')]['includeAll']){_0x15554c[_0x1721('0x42')]=[{'all':!![]}];}return db[_0x1721('0x2d')]['findAll'](_0x15554c);})[_0x1721('0x27')](function(_0x564778){_0x365bd6[_0x1721('0x43')]=_0x564778;return _0x365bd6;})[_0x1721('0x27')](respondWithFilteredResult(_0x2ab3b1,_0x15554c))[_0x1721('0x44')](handleError(_0x2ab3b1,null));};exports[_0x1721('0x45')]=function(_0x399187,_0x3ffb20){var _0x788f5e={'raw':!![],'where':{'id':_0x399187['params']['id']}},_0x33a9cd={};_0x33a9cd['model']=_[_0x1721('0x34')](db['Template'][_0x1721('0x2e')]);_0x33a9cd['query']=_[_0x1721('0x34')](_0x399187[_0x1721('0x33')]);_0x33a9cd['filters']=_[_0x1721('0x37')](_0x33a9cd['model'],_0x33a9cd['query']);_0x788f5e[_0x1721('0x36')]=_[_0x1721('0x37')](_0x33a9cd[_0x1721('0x32')],qs[_0x1721('0x46')](_0x399187['query']['fields']));_0x788f5e[_0x1721('0x36')]=_0x788f5e[_0x1721('0x36')][_0x1721('0x38')]?_0x788f5e['attributes']:_0x33a9cd['model'];if(_0x399187[_0x1721('0x33')][_0x1721('0x47')]){_0x788f5e[_0x1721('0x42')]=[{'all':!![]}];}_0x788f5e=_[_0x1721('0x3f')]({},_0x788f5e,_0x399187[_0x1721('0x41')]);return db[_0x1721('0x2d')][_0x1721('0x48')](_0x788f5e)[_0x1721('0x27')](handleEntityNotFound(_0x3ffb20,null))[_0x1721('0x27')](respondWithResult(_0x3ffb20,null))[_0x1721('0x44')](handleError(_0x3ffb20,null));};exports[_0x1721('0x49')]=function(_0x233690,_0x51e1e6){return db[_0x1721('0x2d')][_0x1721('0x49')](_0x233690[_0x1721('0x4a')],{})['then'](function(_0x57def6){var _0x3e8237=_0x233690[_0x1721('0x4b')][_0x1721('0x4c')]({'plain':!![]});if(!_0x3e8237)throw new Error(_0x1721('0x4d'));if(_0x3e8237[_0x1721('0x4e')]==='user'){var _0x560a48=_0x57def6[_0x1721('0x4c')]({'plain':!![]});var _0x20e28e=_0x1721('0x4f');return db['UserProfileSection']['find']({'where':{'name':_0x20e28e,'userProfileId':_0x3e8237[_0x1721('0x50')]},'raw':!![]})[_0x1721('0x27')](function(_0x2161f0){if(_0x2161f0&&_0x2161f0[_0x1721('0x51')]===0x0){return db['UserProfileResource'][_0x1721('0x49')]({'name':_0x560a48[_0x1721('0x52')],'resourceId':_0x560a48['id'],'type':_0x2161f0[_0x1721('0x52')],'sectionId':_0x2161f0['id']},{})['then'](function(){return _0x57def6;});}else{return _0x57def6;}})[_0x1721('0x44')](function(_0x299ad4){logger[_0x1721('0x29')](_0x1721('0x53'),_0x299ad4);throw _0x299ad4;});}return _0x57def6;})[_0x1721('0x27')](respondWithResult(_0x51e1e6,0xc9))[_0x1721('0x44')](handleError(_0x51e1e6,null));};exports['update']=function(_0x2fd964,_0x3f273c){if(_0x2fd964['body']['id']){delete _0x2fd964[_0x1721('0x4a')]['id'];}return db['Template']['find']({'where':{'id':_0x2fd964[_0x1721('0x54')]['id']}})[_0x1721('0x27')](handleEntityNotFound(_0x3f273c,null))['then'](saveUpdates(_0x2fd964[_0x1721('0x4a')],null))[_0x1721('0x27')](respondWithResult(_0x3f273c,null))[_0x1721('0x44')](handleError(_0x3f273c,null));};exports[_0x1721('0x26')]=function(_0x289152,_0x35115d){return db[_0x1721('0x2d')]['find']({'where':{'id':_0x289152['params']['id']}})[_0x1721('0x27')](handleEntityNotFound(_0x35115d,null))['then'](removeEntity(_0x35115d,null))['catch'](handleError(_0x35115d,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 8d62355..5e18f92 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 _0xff59=['rimraf','../../config/environment','./template.attributes','define','tools_templates','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xff59,0xd1));var _0x9ff5=function(_0x48c382,_0x161059){_0x48c382=_0x48c382-0x0;var _0x3b3b22=_0xff59[_0x48c382];return _0x3b3b22;};'use strict';var _=require(_0x9ff5('0x0'));var util=require(_0x9ff5('0x1'));var logger=require(_0x9ff5('0x2'))(_0x9ff5('0x3'));var moment=require(_0x9ff5('0x4'));var BPromise=require('bluebird');var rp=require(_0x9ff5('0x5'));var fs=require('fs');var path=require(_0x9ff5('0x6'));var rimraf=require(_0x9ff5('0x7'));var config=require(_0x9ff5('0x8'));var attributes=require(_0x9ff5('0x9'));module['exports']=function(_0x27361a,_0x3ac453){return _0x27361a[_0x9ff5('0xa')]('Template',attributes,{'tableName':_0x9ff5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c0b=['rimraf','../../config/environment','./template.attributes','exports','define','tools_templates','util','../../config/logger','api','moment','request-promise','path'];(function(_0x5411cb,_0x1cd69d){var _0x32727a=function(_0x22a762){while(--_0x22a762){_0x5411cb['push'](_0x5411cb['shift']());}};_0x32727a(++_0x1cd69d);}(_0x3c0b,0xf6));var _0xb3c0=function(_0x31c6c4,_0x2ce86c){_0x31c6c4=_0x31c6c4-0x0;var _0x4ada2b=_0x3c0b[_0x31c6c4];return _0x4ada2b;};'use strict';var _=require('lodash');var util=require(_0xb3c0('0x0'));var logger=require(_0xb3c0('0x1'))(_0xb3c0('0x2'));var moment=require(_0xb3c0('0x3'));var BPromise=require('bluebird');var rp=require(_0xb3c0('0x4'));var fs=require('fs');var path=require(_0xb3c0('0x5'));var rimraf=require(_0xb3c0('0x6'));var config=require(_0xb3c0('0x7'));var attributes=require(_0xb3c0('0x8'));module[_0xb3c0('0x9')]=function(_0x6a0f2b,_0x28a2){return _0x6a0f2b[_0xb3c0('0xa')]('Template',attributes,{'tableName':_0xb3c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index ac3ee5d..103a099 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 _0x3ec1=['model','map','then','GetTemplate','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','http','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','options','raw','attributes','limit','include'];(function(_0x8c7bc1,_0x5eb8a5){var _0x47ae8d=function(_0x16ab51){while(--_0x16ab51){_0x8c7bc1['push'](_0x8c7bc1['shift']());}};_0x47ae8d(++_0x5eb8a5);}(_0x3ec1,0xad));var _0x13ec=function(_0x2d8ddc,_0x35b941){_0x2d8ddc=_0x2d8ddc-0x0;var _0x5c7a4a=_0x3ec1[_0x2d8ddc];return _0x5c7a4a;};'use strict';var _=require(_0x13ec('0x0'));var util=require(_0x13ec('0x1'));var moment=require(_0x13ec('0x2'));var BPromise=require(_0x13ec('0x3'));var rs=require(_0x13ec('0x4'));var fs=require('fs');var Redis=require(_0x13ec('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x13ec('0x6'))(_0x13ec('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x13ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15d5f1,_0x12eb8b,_0x35551c){return new BPromise(function(_0x42fd2d,_0x436b80){return client['request'](_0x15d5f1,_0x35551c)['then'](function(_0x1e9b52){logger['info'](_0x13ec('0x9'),_0x12eb8b,'request\x20sent');logger['debug'](_0x13ec('0xa'),_0x12eb8b,_0x13ec('0xb'),JSON[_0x13ec('0xc')](_0x1e9b52));if(_0x1e9b52[_0x13ec('0xd')]){if(_0x1e9b52[_0x13ec('0xd')][_0x13ec('0xe')]===0x1f4){logger[_0x13ec('0xd')](_0x13ec('0x9'),_0x12eb8b,_0x1e9b52[_0x13ec('0xd')]['message']);return _0x436b80(_0x1e9b52['error'][_0x13ec('0xf')]);}logger['error'](_0x13ec('0x9'),_0x12eb8b,_0x1e9b52[_0x13ec('0xd')][_0x13ec('0xf')]);return _0x42fd2d(_0x1e9b52['error'][_0x13ec('0xf')]);}else{logger[_0x13ec('0x10')]('Template,\x20%s,\x20%s',_0x12eb8b,'request\x20sent');_0x42fd2d(_0x1e9b52['result'][_0x13ec('0xf')]);}})[_0x13ec('0x11')](function(_0x26e433){logger[_0x13ec('0xd')](_0x13ec('0x9'),_0x12eb8b,_0x26e433);_0x436b80(_0x26e433);});});}exports['GetTemplate']=function(_0x1ce523){var _0x6c996=this;return new Promise(function(_0x5e7b1b,_0x36884b){return db['Template']['findAll']({'raw':_0x1ce523[_0x13ec('0x12')]?_0x1ce523[_0x13ec('0x12')][_0x13ec('0x13')]===undefined?!![]:![]:!![],'where':_0x1ce523[_0x13ec('0x12')]?_0x1ce523[_0x13ec('0x12')]['where']||null:null,'attributes':_0x1ce523[_0x13ec('0x12')]?_0x1ce523[_0x13ec('0x12')][_0x13ec('0x14')]||null:null,'limit':_0x1ce523[_0x13ec('0x12')]?_0x1ce523[_0x13ec('0x12')][_0x13ec('0x15')]||null:null,'include':_0x1ce523['options']?_0x1ce523['options'][_0x13ec('0x16')]?_['map'](_0x1ce523[_0x13ec('0x12')]['include'],function(_0x471a9b){return{'model':db[_0x471a9b[_0x13ec('0x17')]],'as':_0x471a9b['as'],'attributes':_0x471a9b[_0x13ec('0x14')],'include':_0x471a9b[_0x13ec('0x16')]?_[_0x13ec('0x18')](_0x471a9b[_0x13ec('0x16')],function(_0x1b39b1){return{'model':db[_0x1b39b1[_0x13ec('0x17')]],'as':_0x1b39b1['as'],'attributes':_0x1b39b1[_0x13ec('0x14')],'include':_0x1b39b1[_0x13ec('0x16')]?_['map'](_0x1b39b1['include'],function(_0x4ed6aa){return{'model':db[_0x4ed6aa[_0x13ec('0x17')]],'as':_0x4ed6aa['as'],'attributes':_0x4ed6aa['attributes']};}):[]};}):[]};}):[]:[]})[_0x13ec('0x19')](function(_0x301fdf){logger[_0x13ec('0x10')](_0x13ec('0x1a'),_0x1ce523);logger[_0x13ec('0x1b')]('GetTemplate',_0x1ce523,JSON[_0x13ec('0xc')](_0x301fdf));_0x5e7b1b(_0x301fdf);})[_0x13ec('0x11')](function(_0x58ce55){logger[_0x13ec('0xd')](_0x13ec('0x1a'),_0x58ce55[_0x13ec('0xf')],_0x1ce523);_0x36884b(_0x6c996[_0x13ec('0xd')](0x1f4,_0x58ce55[_0x13ec('0xf')]));});});}; \ No newline at end of file +var _0x08a4=['../../config/environment','client','http','request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTemplate','Template','options','raw','attributes','limit','map','model','include','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0x08a4,0x179));var _0x408a=function(_0x3383b0,_0x361572){_0x3383b0=_0x3383b0-0x0;var _0x3ce4f2=_0x08a4[_0x3383b0];return _0x3ce4f2;};'use strict';var _=require(_0x408a('0x0'));var util=require(_0x408a('0x1'));var moment=require(_0x408a('0x2'));var BPromise=require('bluebird');var rs=require(_0x408a('0x3'));var fs=require('fs');var Redis=require(_0x408a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x408a('0x5'));var logger=require('../../config/logger')(_0x408a('0x6'));var config=require(_0x408a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x408a('0x8')][_0x408a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x410feb,_0x40ddd0,_0x108c00){return new BPromise(function(_0x5ab26e,_0x5d1dd2){return client[_0x408a('0xa')](_0x410feb,_0x108c00)[_0x408a('0xb')](function(_0x4ec98d){logger[_0x408a('0xc')](_0x408a('0xd'),_0x40ddd0,'request\x20sent');logger[_0x408a('0xe')](_0x408a('0xf'),_0x40ddd0,_0x408a('0x10'),JSON[_0x408a('0x11')](_0x4ec98d));if(_0x4ec98d[_0x408a('0x12')]){if(_0x4ec98d[_0x408a('0x12')][_0x408a('0x13')]===0x1f4){logger[_0x408a('0x12')](_0x408a('0xd'),_0x40ddd0,_0x4ec98d['error'][_0x408a('0x14')]);return _0x5d1dd2(_0x4ec98d[_0x408a('0x12')][_0x408a('0x14')]);}logger[_0x408a('0x12')](_0x408a('0xd'),_0x40ddd0,_0x4ec98d[_0x408a('0x12')]['message']);return _0x5ab26e(_0x4ec98d[_0x408a('0x12')]['message']);}else{logger[_0x408a('0xc')](_0x408a('0xd'),_0x40ddd0,_0x408a('0x10'));_0x5ab26e(_0x4ec98d[_0x408a('0x15')][_0x408a('0x14')]);}})[_0x408a('0x16')](function(_0x2c05b4){logger['error'](_0x408a('0xd'),_0x40ddd0,_0x2c05b4);_0x5d1dd2(_0x2c05b4);});});}exports[_0x408a('0x17')]=function(_0x447c27){var _0x17c866=this;return new Promise(function(_0x26feba,_0x1ae934){return db[_0x408a('0x18')]['findAll']({'raw':_0x447c27['options']?_0x447c27[_0x408a('0x19')][_0x408a('0x1a')]===undefined?!![]:![]:!![],'where':_0x447c27['options']?_0x447c27[_0x408a('0x19')]['where']||null:null,'attributes':_0x447c27['options']?_0x447c27[_0x408a('0x19')][_0x408a('0x1b')]||null:null,'limit':_0x447c27[_0x408a('0x19')]?_0x447c27['options'][_0x408a('0x1c')]||null:null,'include':_0x447c27[_0x408a('0x19')]?_0x447c27[_0x408a('0x19')]['include']?_[_0x408a('0x1d')](_0x447c27[_0x408a('0x19')]['include'],function(_0x19965f){return{'model':db[_0x19965f[_0x408a('0x1e')]],'as':_0x19965f['as'],'attributes':_0x19965f['attributes'],'include':_0x19965f['include']?_[_0x408a('0x1d')](_0x19965f[_0x408a('0x1f')],function(_0x568146){return{'model':db[_0x568146[_0x408a('0x1e')]],'as':_0x568146['as'],'attributes':_0x568146[_0x408a('0x1b')],'include':_0x568146['include']?_[_0x408a('0x1d')](_0x568146['include'],function(_0x2aaa61){return{'model':db[_0x2aaa61[_0x408a('0x1e')]],'as':_0x2aaa61['as'],'attributes':_0x2aaa61[_0x408a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x408a('0xb')](function(_0x6010ab){logger[_0x408a('0xc')](_0x408a('0x17'),_0x447c27);logger['debug']('GetTemplate',_0x447c27,JSON['stringify'](_0x6010ab));_0x26feba(_0x6010ab);})[_0x408a('0x16')](function(_0x3c2f41){logger[_0x408a('0x12')]('GetTemplate',_0x3c2f41[_0x408a('0x14')],_0x447c27);_0x1ae934(_0x17c866['error'](0x1f4,_0x3c2f41[_0x408a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 10ecf0c..e5cd0e3 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 _0x4f14=['/:id/any_conditions','post','addAllCondition','addAnyCondition','/:id/actions','addAction','put','/:id','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','get','show','/:id/all_conditions','getAllConditions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4f14,0xb3));var _0x44f1=function(_0x4cc811,_0xeddc61){_0x4cc811=_0x4cc811-0x0;var _0x3d4866=_0x4f14[_0x4cc811];return _0x3d4866;};'use strict';var multer=require('multer');var util=require(_0x44f1('0x0'));var path=require('path');var timeout=require(_0x44f1('0x1'));var express=require(_0x44f1('0x2'));var router=express[_0x44f1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x44f1('0x4'));var interaction=require(_0x44f1('0x5'));var config=require(_0x44f1('0x6'));var controller=require(_0x44f1('0x7'));router['get']('/',auth[_0x44f1('0x8')](),controller['index']);router[_0x44f1('0x9')]('/:id',auth[_0x44f1('0x8')](),controller[_0x44f1('0xa')]);router['get'](_0x44f1('0xb'),auth[_0x44f1('0x8')](),controller[_0x44f1('0xc')]);router['get'](_0x44f1('0xd'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x44f1('0x9')]('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router[_0x44f1('0xe')]('/',auth[_0x44f1('0x8')](),controller['create']);router[_0x44f1('0xe')]('/:id/all_conditions',auth[_0x44f1('0x8')](),controller[_0x44f1('0xf')]);router[_0x44f1('0xe')](_0x44f1('0xd'),auth[_0x44f1('0x8')](),controller[_0x44f1('0x10')]);router[_0x44f1('0xe')](_0x44f1('0x11'),auth['isAuthenticated'](),controller[_0x44f1('0x12')]);router[_0x44f1('0x13')](_0x44f1('0x14'),auth[_0x44f1('0x8')](),controller[_0x44f1('0x15')]);router['delete'](_0x44f1('0x14'),auth[_0x44f1('0x8')](),controller[_0x44f1('0x16')]);module[_0x44f1('0x17')]=router; \ No newline at end of file +var _0x6ccc=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0x6ccc,0x197));var _0xc6cc=function(_0x2ce9d,_0x4ff962){_0x2ce9d=_0x2ce9d-0x0;var _0x578428=_0x6ccc[_0x2ce9d];return _0x578428;};'use strict';var multer=require(_0xc6cc('0x0'));var util=require(_0xc6cc('0x1'));var path=require('path');var timeout=require(_0xc6cc('0x2'));var express=require(_0xc6cc('0x3'));var router=express[_0xc6cc('0x4')]();var fs_extra=require(_0xc6cc('0x5'));var auth=require(_0xc6cc('0x6'));var interaction=require(_0xc6cc('0x7'));var config=require(_0xc6cc('0x8'));var controller=require('./trigger.controller');router[_0xc6cc('0x9')]('/',auth[_0xc6cc('0xa')](),controller[_0xc6cc('0xb')]);router[_0xc6cc('0x9')](_0xc6cc('0xc'),auth[_0xc6cc('0xa')](),controller['show']);router[_0xc6cc('0x9')](_0xc6cc('0xd'),auth[_0xc6cc('0xa')](),controller[_0xc6cc('0xe')]);router[_0xc6cc('0x9')](_0xc6cc('0xf'),auth[_0xc6cc('0xa')](),controller[_0xc6cc('0x10')]);router[_0xc6cc('0x9')](_0xc6cc('0x11'),auth[_0xc6cc('0xa')](),controller[_0xc6cc('0x12')]);router[_0xc6cc('0x13')]('/',auth['isAuthenticated'](),controller[_0xc6cc('0x14')]);router[_0xc6cc('0x13')](_0xc6cc('0xd'),auth[_0xc6cc('0xa')](),controller[_0xc6cc('0x15')]);router[_0xc6cc('0x13')](_0xc6cc('0xf'),auth[_0xc6cc('0xa')](),controller[_0xc6cc('0x16')]);router[_0xc6cc('0x13')](_0xc6cc('0x11'),auth[_0xc6cc('0xa')](),controller[_0xc6cc('0x17')]);router[_0xc6cc('0x18')](_0xc6cc('0xc'),auth[_0xc6cc('0xa')](),controller[_0xc6cc('0x19')]);router[_0xc6cc('0x1a')](_0xc6cc('0xc'),auth[_0xc6cc('0xa')](),controller[_0xc6cc('0x1b')]);module[_0xc6cc('0x1c')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index fa7d3da..1e22911 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 _0x7aba=['STRING'];(function(_0x149d2a,_0x298e38){var _0x539e97=function(_0x27898c){while(--_0x27898c){_0x149d2a['push'](_0x149d2a['shift']());}};_0x539e97(++_0x298e38);}(_0x7aba,0x1ba));var _0xa7ab=function(_0x3429ea,_0x1a2cae){_0x3429ea=_0x3429ea-0x0;var _0x2680df=_0x7aba[_0x3429ea];return _0x2680df;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa7ab('0x0')]},'channel':{'type':Sequelize[_0xa7ab('0x0')]},'description':{'type':Sequelize[_0xa7ab('0x0')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7929=['BOOLEAN','exports','STRING'];(function(_0x1b30c4,_0x5cd2d9){var _0x1a180a=function(_0x4b2cf9){while(--_0x4b2cf9){_0x1b30c4['push'](_0x1b30c4['shift']());}};_0x1a180a(++_0x5cd2d9);}(_0x7929,0x106));var _0x9792=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x7929[_0x173452];return _0xee3fd0;};'use strict';var Sequelize=require('sequelize');module[_0x9792('0x0')]={'name':{'type':Sequelize[_0x9792('0x1')]},'channel':{'type':Sequelize[_0x9792('0x1')]},'description':{'type':Sequelize[_0x9792('0x1')]},'status':{'type':Sequelize[_0x9792('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 746999d..3f8807a 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 _0x022c=['Action','getActions','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','count','offset','status','Content-Range','update','then','destroy','get','Triggers','UserProfileResource','end','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','addAnyCondition','getAllConditions','findOne','Condition','pick','getAnyConditions','addAction'];(function(_0xf62e6c,_0x160938){var _0x14234f=function(_0x16fe1d){while(--_0x16fe1d){_0xf62e6c['push'](_0xf62e6c['shift']());}};_0x14234f(++_0x160938);}(_0x022c,0x16e));var _0xc022=function(_0xc7cb34,_0x1f4326){_0xc7cb34=_0xc7cb34-0x0;var _0x424a82=_0x022c[_0xc7cb34];return _0x424a82;};'use strict';var emlformat=require(_0xc022('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc022('0x1'));var jsonpatch=require(_0xc022('0x2'));var rp=require('request-promise');var moment=require(_0xc022('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc022('0x4'));var path=require(_0xc022('0x5'));var sox=require(_0xc022('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc022('0x7'));var _=require(_0xc022('0x8'));var squel=require(_0xc022('0x9'));var crypto=require(_0xc022('0xa'));var jsforce=require(_0xc022('0xb'));var deskjs=require(_0xc022('0xc'));var toCsv=require(_0xc022('0xd'));var querystring=require(_0xc022('0xe'));var Papa=require(_0xc022('0xf'));var Redis=require(_0xc022('0x10'));var authService=require(_0xc022('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc022('0x12'));var hardwareService=require(_0xc022('0x13'));var logger=require('../../config/logger')(_0xc022('0x14'));var utils=require(_0xc022('0x15'));var config=require(_0xc022('0x16'));var licenseUtil=require(_0xc022('0x17'));var db=require(_0xc022('0x18'))['db'];function respondWithStatusCode(_0x187492,_0x7fcb55){_0x7fcb55=_0x7fcb55||0xcc;return function(_0x41cdb7){if(_0x41cdb7){return _0x187492[_0xc022('0x19')](_0x7fcb55);}return _0x187492['status'](_0x7fcb55)['end']();};}function respondWithResult(_0x4ff686,_0x440003){_0x440003=_0x440003||0xc8;return function(_0x24a6dc){if(_0x24a6dc){return _0x4ff686['status'](_0x440003)[_0xc022('0x1a')](_0x24a6dc);}};}function respondWithFilteredResult(_0xd570cd,_0x6cbdac){return function(_0x20c0ad){if(_0x20c0ad){var _0x1a0007=typeof _0x6cbdac['offset']==='undefined'&&typeof _0x6cbdac['limit']===_0xc022('0x1b');var _0x173277=_0x20c0ad[_0xc022('0x1c')];var _0x539021=_0x1a0007?0x0:_0x6cbdac[_0xc022('0x1d')];var _0xed3108=_0x1a0007?_0x20c0ad[_0xc022('0x1c')]:_0x6cbdac['offset']+_0x6cbdac['limit'];var _0x472550;if(_0xed3108>=_0x173277){_0xed3108=_0x173277;_0x472550=0xc8;}else{_0x472550=0xce;}_0xd570cd[_0xc022('0x1e')](_0x472550);return _0xd570cd['set'](_0xc022('0x1f'),_0x539021+'-'+_0xed3108+'/'+_0x173277)[_0xc022('0x1a')](_0x20c0ad);}return null;};}function patchUpdates(_0xd90705){return function(_0x11d93e){try{jsonpatch['apply'](_0x11d93e,_0xd90705,!![]);}catch(_0x4e9401){return BPromise['reject'](_0x4e9401);}return _0x11d93e['save']();};}function saveUpdates(_0x2b282d,_0x13101c){return function(_0x35c82e){if(_0x35c82e){return _0x35c82e[_0xc022('0x20')](_0x2b282d)[_0xc022('0x21')](function(_0x2d207f){return _0x2d207f;});}return null;};}function removeEntity(_0x266739,_0x1a1776){return function(_0xcb84a9){if(_0xcb84a9){return _0xcb84a9[_0xc022('0x22')]()[_0xc022('0x21')](function(){var _0x488d4c=_0xcb84a9[_0xc022('0x23')]({'plain':!![]});var _0x235645=_0xc022('0x24');return db[_0xc022('0x25')][_0xc022('0x22')]({'where':{'type':_0x235645,'resourceId':_0x488d4c['id']}})['then'](function(){return _0xcb84a9;});})[_0xc022('0x21')](function(){_0x266739['status'](0xcc)[_0xc022('0x26')]();});}};}function handleEntityNotFound(_0x88f865,_0x11d1eb){return function(_0x2e3423){if(!_0x2e3423){_0x88f865[_0xc022('0x19')](0x194);}return _0x2e3423;};}function handleError(_0x180bbd,_0x31fd9a){_0x31fd9a=_0x31fd9a||0x1f4;return function(_0x51d6dc){logger[_0xc022('0x27')](_0x51d6dc[_0xc022('0x28')]);if(_0x51d6dc[_0xc022('0x29')]){delete _0x51d6dc[_0xc022('0x29')];}_0x180bbd[_0xc022('0x1e')](_0x31fd9a)[_0xc022('0x2a')](_0x51d6dc);};}exports[_0xc022('0x2b')]=function(_0xfe190a,_0x5babb3){var _0x13d635={},_0x1a6590={},_0x1b7403={'count':0x0,'rows':[]};var _0x4a9021=_[_0xc022('0x2c')](db[_0xc022('0x2d')][_0xc022('0x2e')],function(_0x2149fe){return{'name':_0x2149fe[_0xc022('0x2f')],'type':_0x2149fe[_0xc022('0x30')]['key']};});_0x1a6590[_0xc022('0x31')]=_['map'](_0x4a9021,_0xc022('0x29'));_0x1a6590[_0xc022('0x32')]=_[_0xc022('0x33')](_0xfe190a[_0xc022('0x32')]);_0x1a6590[_0xc022('0x34')]=_['intersection'](_0x1a6590['model'],_0x1a6590['query']);_0x13d635[_0xc022('0x35')]=_['intersection'](_0x1a6590['model'],qs[_0xc022('0x36')](_0xfe190a[_0xc022('0x32')][_0xc022('0x36')]));_0x13d635[_0xc022('0x35')]=_0x13d635[_0xc022('0x35')][_0xc022('0x37')]?_0x13d635['attributes']:_0x1a6590[_0xc022('0x31')];if(!_0xfe190a[_0xc022('0x32')][_0xc022('0x38')](_0xc022('0x39'))){_0x13d635[_0xc022('0x3a')]=qs[_0xc022('0x3a')](_0xfe190a['query'][_0xc022('0x3a')]);_0x13d635[_0xc022('0x1d')]=qs[_0xc022('0x1d')](_0xfe190a[_0xc022('0x32')][_0xc022('0x1d')]);}_0x13d635[_0xc022('0x3b')]=qs[_0xc022('0x3c')](_0xfe190a[_0xc022('0x32')][_0xc022('0x3c')]);_0x13d635[_0xc022('0x3d')]=qs['filters'](_['pick'](_0xfe190a[_0xc022('0x32')],_0x1a6590['filters']),_0x4a9021);if(_0xfe190a[_0xc022('0x32')][_0xc022('0x3e')]){_0x13d635['where']=_[_0xc022('0x3f')](_0x13d635[_0xc022('0x3d')],{'$or':_[_0xc022('0x2c')](_0x4a9021,function(_0x42b7fe){if(_0x42b7fe[_0xc022('0x30')]!==_0xc022('0x40')){var _0x1b4b20={};_0x1b4b20[_0x42b7fe[_0xc022('0x29')]]={'$like':'%'+_0xfe190a[_0xc022('0x32')][_0xc022('0x3e')]+'%'};return _0x1b4b20;}})});}_0x13d635=_['merge']({},_0x13d635,_0xfe190a[_0xc022('0x41')]);var _0x30a2fa={'where':_0x13d635['where']};return db[_0xc022('0x2d')][_0xc022('0x1c')](_0x30a2fa)[_0xc022('0x21')](function(_0x1fa2ec){_0x1b7403[_0xc022('0x1c')]=_0x1fa2ec;if(_0xfe190a[_0xc022('0x32')][_0xc022('0x42')]){_0x13d635[_0xc022('0x43')]=[{'all':!![]}];}return db['Trigger'][_0xc022('0x44')](_0x13d635);})['then'](function(_0x1b718b){_0x1b7403[_0xc022('0x45')]=_0x1b718b;return _0x1b7403;})[_0xc022('0x21')](respondWithFilteredResult(_0x5babb3,_0x13d635))[_0xc022('0x46')](handleError(_0x5babb3,null));};exports['show']=function(_0x58edaf,_0x4f7942){var _0x559403={'raw':![],'where':{'id':_0x58edaf[_0xc022('0x47')]['id']}},_0x18a28f={};_0x18a28f[_0xc022('0x31')]=_['keys'](db['Trigger']['rawAttributes']);_0x18a28f[_0xc022('0x32')]=_[_0xc022('0x33')](_0x58edaf[_0xc022('0x32')]);_0x18a28f[_0xc022('0x34')]=_[_0xc022('0x48')](_0x18a28f[_0xc022('0x31')],_0x18a28f[_0xc022('0x32')]);_0x559403[_0xc022('0x35')]=_[_0xc022('0x48')](_0x18a28f[_0xc022('0x31')],qs[_0xc022('0x36')](_0x58edaf[_0xc022('0x32')][_0xc022('0x36')]));_0x559403[_0xc022('0x35')]=_0x559403['attributes']['length']?_0x559403[_0xc022('0x35')]:_0x18a28f[_0xc022('0x31')];if(_0x58edaf[_0xc022('0x32')]['includeAll']){_0x559403[_0xc022('0x43')]=[{'all':!![]}];}_0x559403=_['merge']({},_0x559403,_0x58edaf[_0xc022('0x41')]);return db[_0xc022('0x2d')][_0xc022('0x49')](_0x559403)[_0xc022('0x21')](handleEntityNotFound(_0x4f7942,null))[_0xc022('0x21')](respondWithResult(_0x4f7942,null))[_0xc022('0x46')](handleError(_0x4f7942,null));};exports[_0xc022('0x4a')]=function(_0x4a13a7,_0x1393bc){return db[_0xc022('0x2d')][_0xc022('0x4a')](_0x4a13a7[_0xc022('0x4b')],{})['then'](function(_0x198a8c){var _0xf5da63=_0x4a13a7[_0xc022('0x4c')][_0xc022('0x23')]({'plain':!![]});if(!_0xf5da63)throw new Error(_0xc022('0x4d'));if(_0xf5da63[_0xc022('0x4e')]===_0xc022('0x4c')){var _0x7f69c9=_0x198a8c[_0xc022('0x23')]({'plain':!![]});var _0x4d30a1='Triggers';return db[_0xc022('0x4f')]['find']({'where':{'name':_0x4d30a1,'userProfileId':_0xf5da63['userProfileId']},'raw':!![]})['then'](function(_0x50e55b){if(_0x50e55b&&_0x50e55b['autoAssociation']===0x0){return db['UserProfileResource'][_0xc022('0x4a')]({'name':_0x7f69c9[_0xc022('0x29')],'resourceId':_0x7f69c9['id'],'type':_0x50e55b['name'],'sectionId':_0x50e55b['id']},{})[_0xc022('0x21')](function(){return _0x198a8c;});}else{return _0x198a8c;}})[_0xc022('0x46')](function(_0x3a8b3f){logger[_0xc022('0x27')](_0xc022('0x50'),_0x3a8b3f);throw _0x3a8b3f;});}return _0x198a8c;})['then'](respondWithResult(_0x1393bc,0xc9))[_0xc022('0x46')](handleError(_0x1393bc,null));};exports[_0xc022('0x20')]=function(_0x1e91d1,_0x5c883e){if(_0x1e91d1[_0xc022('0x4b')]['id']){delete _0x1e91d1[_0xc022('0x4b')]['id'];}return db[_0xc022('0x2d')][_0xc022('0x49')]({'where':{'id':_0x1e91d1['params']['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x5c883e,null))[_0xc022('0x21')](saveUpdates(_0x1e91d1[_0xc022('0x4b')],null))[_0xc022('0x21')](respondWithResult(_0x5c883e,null))[_0xc022('0x46')](handleError(_0x5c883e,null));};exports[_0xc022('0x22')]=function(_0x269498,_0x462635){return db[_0xc022('0x2d')][_0xc022('0x49')]({'where':{'id':_0x269498[_0xc022('0x47')]['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x462635,null))['then'](removeEntity(_0x462635,null))[_0xc022('0x46')](handleError(_0x462635,null));};exports[_0xc022('0x51')]=function(_0x4cc8ce,_0x4a56e2,_0x4061a5){if(_0x4cc8ce['body']['id']){delete _0x4cc8ce[_0xc022('0x4b')]['id'];}return db[_0xc022('0x2d')][_0xc022('0x49')]({'where':{'id':_0x4cc8ce['params']['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x4a56e2,null))[_0xc022('0x21')](function(_0x28080f){if(_0x28080f){_0x4cc8ce[_0xc022('0x4b')]['TriggerAllId']=_0x28080f['id'];return db['Condition'][_0xc022('0x4a')](_0x4cc8ce[_0xc022('0x4b')]);}})[_0xc022('0x21')](respondWithResult(_0x4a56e2,null))[_0xc022('0x46')](handleError(_0x4a56e2,null));};exports[_0xc022('0x52')]=function(_0x21b3e4,_0x38a631,_0x490e5a){if(_0x21b3e4[_0xc022('0x4b')]['id']){delete _0x21b3e4[_0xc022('0x4b')]['id'];}return db['Trigger'][_0xc022('0x49')]({'where':{'id':_0x21b3e4[_0xc022('0x47')]['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x38a631,null))[_0xc022('0x21')](function(_0x456971){if(_0x456971){_0x21b3e4['body']['TriggerAnyId']=_0x456971['id'];return db['Condition'][_0xc022('0x4a')](_0x21b3e4['body']);}})[_0xc022('0x21')](respondWithResult(_0x38a631,null))[_0xc022('0x46')](handleError(_0x38a631,null));};exports[_0xc022('0x53')]=function(_0x20e42e,_0x91d261,_0x3ff03f){var _0x46ca8b={};var _0x2a8068={};var _0x23af34;var _0x55b4dd;return db[_0xc022('0x2d')][_0xc022('0x54')]({'where':{'id':_0x20e42e['params']['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x91d261,null))[_0xc022('0x21')](function(_0x4e4fc7){if(_0x4e4fc7){_0x23af34=_0x4e4fc7;_0x2a8068['model']=_['keys'](db[_0xc022('0x55')][_0xc022('0x2e')]);_0x2a8068[_0xc022('0x32')]=_[_0xc022('0x33')](_0x20e42e[_0xc022('0x32')]);_0x2a8068[_0xc022('0x34')]=_[_0xc022('0x48')](_0x2a8068['model'],_0x2a8068[_0xc022('0x32')]);_0x46ca8b['attributes']=_[_0xc022('0x48')](_0x2a8068[_0xc022('0x31')],qs[_0xc022('0x36')](_0x20e42e[_0xc022('0x32')][_0xc022('0x36')]));_0x46ca8b['attributes']=_0x46ca8b[_0xc022('0x35')]['length']?_0x46ca8b['attributes']:_0x2a8068[_0xc022('0x31')];_0x46ca8b[_0xc022('0x3b')]=qs[_0xc022('0x3c')](_0x20e42e['query'][_0xc022('0x3c')]);_0x46ca8b[_0xc022('0x3d')]=qs[_0xc022('0x34')](_[_0xc022('0x56')](_0x20e42e[_0xc022('0x32')],_0x2a8068[_0xc022('0x34')]));if(_0x20e42e['query'][_0xc022('0x3e')]){_0x46ca8b[_0xc022('0x3d')]=_[_0xc022('0x3f')](_0x46ca8b[_0xc022('0x3d')],{'$or':_[_0xc022('0x2c')](_0x46ca8b[_0xc022('0x35')],function(_0x4f1f3e){var _0x2887db={};_0x2887db[_0x4f1f3e]={'$like':'%'+_0x20e42e[_0xc022('0x32')]['filter']+'%'};return _0x2887db;})});}_0x46ca8b=_['merge']({},_0x46ca8b,_0x20e42e['options']);return _0x23af34[_0xc022('0x53')](_0x46ca8b);}})[_0xc022('0x21')](function(_0x15e269){if(_0x15e269){_0x55b4dd=_0x15e269[_0xc022('0x37')];if(!_0x20e42e[_0xc022('0x32')]['hasOwnProperty']('nolimit')){_0x46ca8b['limit']=qs[_0xc022('0x3a')](_0x20e42e[_0xc022('0x32')][_0xc022('0x3a')]);_0x46ca8b[_0xc022('0x1d')]=qs[_0xc022('0x1d')](_0x20e42e['query'][_0xc022('0x1d')]);}return _0x23af34['getAllConditions'](_0x46ca8b);}})['then'](function(_0x425bde){if(_0x425bde){return _0x425bde?{'count':_0x55b4dd,'rows':_0x425bde}:null;}})[_0xc022('0x21')](respondWithResult(_0x91d261,null))[_0xc022('0x46')](handleError(_0x91d261,null));};exports['getAnyConditions']=function(_0x355c75,_0x4cdec2,_0x212f9e){var _0x2cf06c={};var _0x6e574a={};var _0x2a0bcd;var _0x442e80;return db[_0xc022('0x2d')]['findOne']({'where':{'id':_0x355c75[_0xc022('0x47')]['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x4cdec2,null))[_0xc022('0x21')](function(_0x2584b6){if(_0x2584b6){_0x2a0bcd=_0x2584b6;_0x6e574a[_0xc022('0x31')]=_[_0xc022('0x33')](db[_0xc022('0x55')][_0xc022('0x2e')]);_0x6e574a['query']=_['keys'](_0x355c75[_0xc022('0x32')]);_0x6e574a[_0xc022('0x34')]=_[_0xc022('0x48')](_0x6e574a['model'],_0x6e574a[_0xc022('0x32')]);_0x2cf06c[_0xc022('0x35')]=_['intersection'](_0x6e574a['model'],qs[_0xc022('0x36')](_0x355c75[_0xc022('0x32')][_0xc022('0x36')]));_0x2cf06c[_0xc022('0x35')]=_0x2cf06c[_0xc022('0x35')][_0xc022('0x37')]?_0x2cf06c[_0xc022('0x35')]:_0x6e574a['model'];_0x2cf06c[_0xc022('0x3b')]=qs['sort'](_0x355c75[_0xc022('0x32')][_0xc022('0x3c')]);_0x2cf06c[_0xc022('0x3d')]=qs[_0xc022('0x34')](_[_0xc022('0x56')](_0x355c75[_0xc022('0x32')],_0x6e574a[_0xc022('0x34')]));if(_0x355c75['query']['filter']){_0x2cf06c['where']=_[_0xc022('0x3f')](_0x2cf06c[_0xc022('0x3d')],{'$or':_[_0xc022('0x2c')](_0x2cf06c[_0xc022('0x35')],function(_0x27b37d){var _0x31a5fc={};_0x31a5fc[_0x27b37d]={'$like':'%'+_0x355c75[_0xc022('0x32')][_0xc022('0x3e')]+'%'};return _0x31a5fc;})});}_0x2cf06c=_['merge']({},_0x2cf06c,_0x355c75['options']);return _0x2a0bcd[_0xc022('0x57')](_0x2cf06c);}})['then'](function(_0x17d14b){if(_0x17d14b){_0x442e80=_0x17d14b[_0xc022('0x37')];if(!_0x355c75['query'][_0xc022('0x38')](_0xc022('0x39'))){_0x2cf06c[_0xc022('0x3a')]=qs[_0xc022('0x3a')](_0x355c75[_0xc022('0x32')][_0xc022('0x3a')]);_0x2cf06c[_0xc022('0x1d')]=qs['offset'](_0x355c75[_0xc022('0x32')][_0xc022('0x1d')]);}return _0x2a0bcd['getAnyConditions'](_0x2cf06c);}})[_0xc022('0x21')](function(_0x24c2d7){if(_0x24c2d7){return _0x24c2d7?{'count':_0x442e80,'rows':_0x24c2d7}:null;}})[_0xc022('0x21')](respondWithResult(_0x4cdec2,null))[_0xc022('0x46')](handleError(_0x4cdec2,null));};exports[_0xc022('0x58')]=function(_0x5d4ff5,_0x313295,_0xaf1632){if(_0x5d4ff5[_0xc022('0x4b')]['id']){delete _0x5d4ff5[_0xc022('0x4b')]['id'];}return db[_0xc022('0x2d')]['find']({'where':{'id':_0x5d4ff5[_0xc022('0x47')]['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x313295,null))['then'](function(_0x38482d){if(_0x38482d){_0x5d4ff5[_0xc022('0x4b')]['TriggerId']=_0x38482d['id'];return db[_0xc022('0x59')][_0xc022('0x4a')](_0x5d4ff5[_0xc022('0x4b')]);}})[_0xc022('0x21')](respondWithResult(_0x313295,null))[_0xc022('0x46')](handleError(_0x313295,null));};exports[_0xc022('0x5a')]=function(_0x4f9133,_0x4afefa,_0x2cbd70){var _0x342c08={};var _0x151637={};var _0x36cf24;var _0x5650ff;return db[_0xc022('0x2d')]['findOne']({'where':{'id':_0x4f9133[_0xc022('0x47')]['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x4afefa,null))['then'](function(_0x3c7138){if(_0x3c7138){_0x36cf24=_0x3c7138;_0x151637[_0xc022('0x31')]=_[_0xc022('0x33')](db[_0xc022('0x59')][_0xc022('0x2e')]);_0x151637[_0xc022('0x32')]=_[_0xc022('0x33')](_0x4f9133[_0xc022('0x32')]);_0x151637['filters']=_[_0xc022('0x48')](_0x151637[_0xc022('0x31')],_0x151637[_0xc022('0x32')]);_0x342c08['attributes']=_[_0xc022('0x48')](_0x151637['model'],qs[_0xc022('0x36')](_0x4f9133[_0xc022('0x32')][_0xc022('0x36')]));_0x342c08['attributes']=_0x342c08[_0xc022('0x35')]['length']?_0x342c08[_0xc022('0x35')]:_0x151637['model'];_0x342c08[_0xc022('0x3b')]=qs[_0xc022('0x3c')](_0x4f9133[_0xc022('0x32')][_0xc022('0x3c')]);_0x342c08['where']=qs['filters'](_[_0xc022('0x56')](_0x4f9133[_0xc022('0x32')],_0x151637[_0xc022('0x34')]));if(_0x4f9133[_0xc022('0x32')][_0xc022('0x3e')]){_0x342c08[_0xc022('0x3d')]=_['merge'](_0x342c08[_0xc022('0x3d')],{'$or':_[_0xc022('0x2c')](_0x342c08[_0xc022('0x35')],function(_0x3dd33b){var _0x2d65c7={};_0x2d65c7[_0x3dd33b]={'$like':'%'+_0x4f9133[_0xc022('0x32')][_0xc022('0x3e')]+'%'};return _0x2d65c7;})});}_0x342c08=_['merge']({},_0x342c08,_0x4f9133[_0xc022('0x41')]);return _0x36cf24['getActions'](_0x342c08);}})[_0xc022('0x21')](function(_0x4bbd6e){if(_0x4bbd6e){_0x5650ff=_0x4bbd6e[_0xc022('0x37')];if(!_0x4f9133[_0xc022('0x32')][_0xc022('0x38')]('nolimit')){_0x342c08[_0xc022('0x3a')]=qs[_0xc022('0x3a')](_0x4f9133['query'][_0xc022('0x3a')]);_0x342c08[_0xc022('0x1d')]=qs['offset'](_0x4f9133[_0xc022('0x32')]['offset']);}return _0x36cf24[_0xc022('0x5a')](_0x342c08);}})['then'](function(_0x33faae){if(_0x33faae){return _0x33faae?{'count':_0x5650ff,'rows':_0x33faae}:null;}})[_0xc022('0x21')](respondWithResult(_0x4afefa,null))[_0xc022('0x46')](handleError(_0x4afefa,null));}; \ No newline at end of file +var _0x4dde=['TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','hasOwnProperty','getAnyConditions','TriggerId','getActions','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','map','Trigger','rawAttributes','fieldName','type','key','keys','query','filters','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','intersection','find','create','body','user','Triggers','UserProfileSection','userProfileId','UserProfileResource','addAllCondition'];(function(_0x3cffb3,_0x284b2d){var _0x57a846=function(_0x32a354){while(--_0x32a354){_0x3cffb3['push'](_0x3cffb3['shift']());}};_0x57a846(++_0x284b2d);}(_0x4dde,0x186));var _0xe4dd=function(_0x4528a5,_0x3de947){_0x4528a5=_0x4528a5-0x0;var _0x112316=_0x4dde[_0x4528a5];return _0x112316;};'use strict';var emlformat=require(_0xe4dd('0x0'));var rimraf=require(_0xe4dd('0x1'));var zipdir=require(_0xe4dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe4dd('0x3'));var moment=require(_0xe4dd('0x4'));var BPromise=require(_0xe4dd('0x5'));var Mustache=require(_0xe4dd('0x6'));var util=require(_0xe4dd('0x7'));var path=require(_0xe4dd('0x8'));var sox=require(_0xe4dd('0x9'));var csv=require('to-csv');var ejs=require(_0xe4dd('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4dd('0xb'));var squel=require(_0xe4dd('0xc'));var crypto=require(_0xe4dd('0xd'));var jsforce=require(_0xe4dd('0xe'));var deskjs=require(_0xe4dd('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe4dd('0x10'));var Papa=require(_0xe4dd('0x11'));var Redis=require('ioredis');var authService=require(_0xe4dd('0x12'));var qs=require(_0xe4dd('0x13'));var as=require(_0xe4dd('0x14'));var hardwareService=require(_0xe4dd('0x15'));var logger=require(_0xe4dd('0x16'))(_0xe4dd('0x17'));var utils=require(_0xe4dd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe4dd('0x19'));var db=require(_0xe4dd('0x1a'))['db'];function respondWithStatusCode(_0x54c7d3,_0x578452){_0x578452=_0x578452||0xcc;return function(_0x4f80e8){if(_0x4f80e8){return _0x54c7d3[_0xe4dd('0x1b')](_0x578452);}return _0x54c7d3[_0xe4dd('0x1c')](_0x578452)[_0xe4dd('0x1d')]();};}function respondWithResult(_0x433030,_0x17639e){_0x17639e=_0x17639e||0xc8;return function(_0x393b69){if(_0x393b69){return _0x433030[_0xe4dd('0x1c')](_0x17639e)[_0xe4dd('0x1e')](_0x393b69);}};}function respondWithFilteredResult(_0x15d241,_0xb075eb){return function(_0x1b6cf7){if(_0x1b6cf7){var _0x4d0909=typeof _0xb075eb['offset']===_0xe4dd('0x1f')&&typeof _0xb075eb[_0xe4dd('0x20')]==='undefined';var _0x247ed4=_0x1b6cf7[_0xe4dd('0x21')];var _0x1f03bd=_0x4d0909?0x0:_0xb075eb[_0xe4dd('0x22')];var _0x2410f6=_0x4d0909?_0x1b6cf7[_0xe4dd('0x21')]:_0xb075eb[_0xe4dd('0x22')]+_0xb075eb[_0xe4dd('0x20')];var _0x13832c;if(_0x2410f6>=_0x247ed4){_0x2410f6=_0x247ed4;_0x13832c=0xc8;}else{_0x13832c=0xce;}_0x15d241[_0xe4dd('0x1c')](_0x13832c);return _0x15d241[_0xe4dd('0x23')](_0xe4dd('0x24'),_0x1f03bd+'-'+_0x2410f6+'/'+_0x247ed4)[_0xe4dd('0x1e')](_0x1b6cf7);}return null;};}function patchUpdates(_0x35ddd6){return function(_0x2f2d8c){try{jsonpatch[_0xe4dd('0x25')](_0x2f2d8c,_0x35ddd6,!![]);}catch(_0x1783a9){return BPromise[_0xe4dd('0x26')](_0x1783a9);}return _0x2f2d8c[_0xe4dd('0x27')]();};}function saveUpdates(_0x3f67f1,_0x4c7030){return function(_0x50571f){if(_0x50571f){return _0x50571f[_0xe4dd('0x28')](_0x3f67f1)[_0xe4dd('0x29')](function(_0x55b024){return _0x55b024;});}return null;};}function removeEntity(_0x3becbe,_0x3a98e8){return function(_0x49239d){if(_0x49239d){return _0x49239d[_0xe4dd('0x2a')]()[_0xe4dd('0x29')](function(){var _0x53a33a=_0x49239d[_0xe4dd('0x2b')]({'plain':!![]});var _0xa08281='Triggers';return db['UserProfileResource'][_0xe4dd('0x2a')]({'where':{'type':_0xa08281,'resourceId':_0x53a33a['id']}})[_0xe4dd('0x29')](function(){return _0x49239d;});})[_0xe4dd('0x29')](function(){_0x3becbe['status'](0xcc)[_0xe4dd('0x1d')]();});}};}function handleEntityNotFound(_0x266e35,_0x560b7c){return function(_0x132332){if(!_0x132332){_0x266e35[_0xe4dd('0x1b')](0x194);}return _0x132332;};}function handleError(_0x52570e,_0x20d413){_0x20d413=_0x20d413||0x1f4;return function(_0x3a91f0){logger[_0xe4dd('0x2c')](_0x3a91f0[_0xe4dd('0x2d')]);if(_0x3a91f0[_0xe4dd('0x2e')]){delete _0x3a91f0[_0xe4dd('0x2e')];}_0x52570e[_0xe4dd('0x1c')](_0x20d413)[_0xe4dd('0x2f')](_0x3a91f0);};}exports['index']=function(_0x276d41,_0x1c1fa4){var _0x413e60={},_0x5d7071={},_0x5e1577={'count':0x0,'rows':[]};var _0x3612f7=_[_0xe4dd('0x30')](db[_0xe4dd('0x31')][_0xe4dd('0x32')],function(_0x80aac4){return{'name':_0x80aac4[_0xe4dd('0x33')],'type':_0x80aac4[_0xe4dd('0x34')][_0xe4dd('0x35')]};});_0x5d7071['model']=_[_0xe4dd('0x30')](_0x3612f7,_0xe4dd('0x2e'));_0x5d7071['query']=_[_0xe4dd('0x36')](_0x276d41[_0xe4dd('0x37')]);_0x5d7071[_0xe4dd('0x38')]=_['intersection'](_0x5d7071[_0xe4dd('0x39')],_0x5d7071[_0xe4dd('0x37')]);_0x413e60['attributes']=_['intersection'](_0x5d7071['model'],qs[_0xe4dd('0x3a')](_0x276d41[_0xe4dd('0x37')][_0xe4dd('0x3a')]));_0x413e60[_0xe4dd('0x3b')]=_0x413e60[_0xe4dd('0x3b')][_0xe4dd('0x3c')]?_0x413e60['attributes']:_0x5d7071['model'];if(!_0x276d41['query']['hasOwnProperty'](_0xe4dd('0x3d'))){_0x413e60[_0xe4dd('0x20')]=qs[_0xe4dd('0x20')](_0x276d41[_0xe4dd('0x37')][_0xe4dd('0x20')]);_0x413e60['offset']=qs[_0xe4dd('0x22')](_0x276d41[_0xe4dd('0x37')][_0xe4dd('0x22')]);}_0x413e60[_0xe4dd('0x3e')]=qs['sort'](_0x276d41[_0xe4dd('0x37')][_0xe4dd('0x3f')]);_0x413e60['where']=qs[_0xe4dd('0x38')](_[_0xe4dd('0x40')](_0x276d41[_0xe4dd('0x37')],_0x5d7071[_0xe4dd('0x38')]),_0x3612f7);if(_0x276d41[_0xe4dd('0x37')][_0xe4dd('0x41')]){_0x413e60[_0xe4dd('0x42')]=_[_0xe4dd('0x43')](_0x413e60[_0xe4dd('0x42')],{'$or':_['map'](_0x3612f7,function(_0xa74144){if(_0xa74144[_0xe4dd('0x34')]!=='VIRTUAL'){var _0x367ce6={};_0x367ce6[_0xa74144['name']]={'$like':'%'+_0x276d41[_0xe4dd('0x37')][_0xe4dd('0x41')]+'%'};return _0x367ce6;}})});}_0x413e60=_[_0xe4dd('0x43')]({},_0x413e60,_0x276d41[_0xe4dd('0x44')]);var _0x5cc63e={'where':_0x413e60['where']};return db[_0xe4dd('0x31')][_0xe4dd('0x21')](_0x5cc63e)[_0xe4dd('0x29')](function(_0xbcc750){_0x5e1577[_0xe4dd('0x21')]=_0xbcc750;if(_0x276d41[_0xe4dd('0x37')][_0xe4dd('0x45')]){_0x413e60[_0xe4dd('0x46')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x413e60);})['then'](function(_0x16c2be){_0x5e1577[_0xe4dd('0x47')]=_0x16c2be;return _0x5e1577;})['then'](respondWithFilteredResult(_0x1c1fa4,_0x413e60))[_0xe4dd('0x48')](handleError(_0x1c1fa4,null));};exports[_0xe4dd('0x49')]=function(_0x151f26,_0x313a4e){var _0x559913={'raw':![],'where':{'id':_0x151f26[_0xe4dd('0x4a')]['id']}},_0x3f3a21={};_0x3f3a21[_0xe4dd('0x39')]=_[_0xe4dd('0x36')](db['Trigger']['rawAttributes']);_0x3f3a21[_0xe4dd('0x37')]=_[_0xe4dd('0x36')](_0x151f26['query']);_0x3f3a21[_0xe4dd('0x38')]=_[_0xe4dd('0x4b')](_0x3f3a21[_0xe4dd('0x39')],_0x3f3a21[_0xe4dd('0x37')]);_0x559913[_0xe4dd('0x3b')]=_[_0xe4dd('0x4b')](_0x3f3a21[_0xe4dd('0x39')],qs['fields'](_0x151f26[_0xe4dd('0x37')]['fields']));_0x559913['attributes']=_0x559913[_0xe4dd('0x3b')]['length']?_0x559913[_0xe4dd('0x3b')]:_0x3f3a21['model'];if(_0x151f26[_0xe4dd('0x37')][_0xe4dd('0x45')]){_0x559913['include']=[{'all':!![]}];}_0x559913=_[_0xe4dd('0x43')]({},_0x559913,_0x151f26[_0xe4dd('0x44')]);return db[_0xe4dd('0x31')][_0xe4dd('0x4c')](_0x559913)[_0xe4dd('0x29')](handleEntityNotFound(_0x313a4e,null))[_0xe4dd('0x29')](respondWithResult(_0x313a4e,null))[_0xe4dd('0x48')](handleError(_0x313a4e,null));};exports[_0xe4dd('0x4d')]=function(_0x4c7fa5,_0x1e7784){return db[_0xe4dd('0x31')][_0xe4dd('0x4d')](_0x4c7fa5[_0xe4dd('0x4e')],{})[_0xe4dd('0x29')](function(_0x40badb){var _0x5d288c=_0x4c7fa5['user'][_0xe4dd('0x2b')]({'plain':!![]});if(!_0x5d288c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d288c['role']===_0xe4dd('0x4f')){var _0x232448=_0x40badb[_0xe4dd('0x2b')]({'plain':!![]});var _0xf9d19=_0xe4dd('0x50');return db[_0xe4dd('0x51')][_0xe4dd('0x4c')]({'where':{'name':_0xf9d19,'userProfileId':_0x5d288c[_0xe4dd('0x52')]},'raw':!![]})[_0xe4dd('0x29')](function(_0x4ba126){if(_0x4ba126&&_0x4ba126['autoAssociation']===0x0){return db[_0xe4dd('0x53')][_0xe4dd('0x4d')]({'name':_0x232448['name'],'resourceId':_0x232448['id'],'type':_0x4ba126[_0xe4dd('0x2e')],'sectionId':_0x4ba126['id']},{})[_0xe4dd('0x29')](function(){return _0x40badb;});}else{return _0x40badb;}})[_0xe4dd('0x48')](function(_0x46a019){logger[_0xe4dd('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46a019);throw _0x46a019;});}return _0x40badb;})[_0xe4dd('0x29')](respondWithResult(_0x1e7784,0xc9))[_0xe4dd('0x48')](handleError(_0x1e7784,null));};exports[_0xe4dd('0x28')]=function(_0x36b1f9,_0x4516a8){if(_0x36b1f9[_0xe4dd('0x4e')]['id']){delete _0x36b1f9[_0xe4dd('0x4e')]['id'];}return db[_0xe4dd('0x31')][_0xe4dd('0x4c')]({'where':{'id':_0x36b1f9[_0xe4dd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4516a8,null))[_0xe4dd('0x29')](saveUpdates(_0x36b1f9['body'],null))['then'](respondWithResult(_0x4516a8,null))[_0xe4dd('0x48')](handleError(_0x4516a8,null));};exports[_0xe4dd('0x2a')]=function(_0x44f631,_0x4dc81b){return db[_0xe4dd('0x31')]['find']({'where':{'id':_0x44f631[_0xe4dd('0x4a')]['id']}})[_0xe4dd('0x29')](handleEntityNotFound(_0x4dc81b,null))['then'](removeEntity(_0x4dc81b,null))[_0xe4dd('0x48')](handleError(_0x4dc81b,null));};exports[_0xe4dd('0x54')]=function(_0x3e36d6,_0x4d1a60,_0x1d246d){if(_0x3e36d6[_0xe4dd('0x4e')]['id']){delete _0x3e36d6['body']['id'];}return db['Trigger'][_0xe4dd('0x4c')]({'where':{'id':_0x3e36d6[_0xe4dd('0x4a')]['id']}})[_0xe4dd('0x29')](handleEntityNotFound(_0x4d1a60,null))['then'](function(_0x3ecb3){if(_0x3ecb3){_0x3e36d6[_0xe4dd('0x4e')][_0xe4dd('0x55')]=_0x3ecb3['id'];return db[_0xe4dd('0x56')][_0xe4dd('0x4d')](_0x3e36d6[_0xe4dd('0x4e')]);}})[_0xe4dd('0x29')](respondWithResult(_0x4d1a60,null))[_0xe4dd('0x48')](handleError(_0x4d1a60,null));};exports[_0xe4dd('0x57')]=function(_0x228638,_0x51f5f5,_0x37e557){if(_0x228638[_0xe4dd('0x4e')]['id']){delete _0x228638[_0xe4dd('0x4e')]['id'];}return db[_0xe4dd('0x31')]['find']({'where':{'id':_0x228638['params']['id']}})[_0xe4dd('0x29')](handleEntityNotFound(_0x51f5f5,null))['then'](function(_0x38c048){if(_0x38c048){_0x228638[_0xe4dd('0x4e')][_0xe4dd('0x58')]=_0x38c048['id'];return db[_0xe4dd('0x56')]['create'](_0x228638[_0xe4dd('0x4e')]);}})[_0xe4dd('0x29')](respondWithResult(_0x51f5f5,null))['catch'](handleError(_0x51f5f5,null));};exports[_0xe4dd('0x59')]=function(_0x13a5bc,_0x57e0d6,_0xaa87ba){var _0x2b6ba9={};var _0xefda33={};var _0x998b04;var _0x4152de;return db[_0xe4dd('0x31')]['findOne']({'where':{'id':_0x13a5bc[_0xe4dd('0x4a')]['id']}})[_0xe4dd('0x29')](handleEntityNotFound(_0x57e0d6,null))[_0xe4dd('0x29')](function(_0x2fa5f6){if(_0x2fa5f6){_0x998b04=_0x2fa5f6;_0xefda33[_0xe4dd('0x39')]=_['keys'](db[_0xe4dd('0x56')][_0xe4dd('0x32')]);_0xefda33[_0xe4dd('0x37')]=_['keys'](_0x13a5bc['query']);_0xefda33[_0xe4dd('0x38')]=_[_0xe4dd('0x4b')](_0xefda33[_0xe4dd('0x39')],_0xefda33[_0xe4dd('0x37')]);_0x2b6ba9['attributes']=_['intersection'](_0xefda33[_0xe4dd('0x39')],qs['fields'](_0x13a5bc[_0xe4dd('0x37')][_0xe4dd('0x3a')]));_0x2b6ba9[_0xe4dd('0x3b')]=_0x2b6ba9['attributes'][_0xe4dd('0x3c')]?_0x2b6ba9[_0xe4dd('0x3b')]:_0xefda33[_0xe4dd('0x39')];_0x2b6ba9['order']=qs[_0xe4dd('0x3f')](_0x13a5bc[_0xe4dd('0x37')][_0xe4dd('0x3f')]);_0x2b6ba9[_0xe4dd('0x42')]=qs[_0xe4dd('0x38')](_['pick'](_0x13a5bc[_0xe4dd('0x37')],_0xefda33[_0xe4dd('0x38')]));if(_0x13a5bc[_0xe4dd('0x37')][_0xe4dd('0x41')]){_0x2b6ba9[_0xe4dd('0x42')]=_['merge'](_0x2b6ba9['where'],{'$or':_[_0xe4dd('0x30')](_0x2b6ba9['attributes'],function(_0x5d908e){var _0x1adf0e={};_0x1adf0e[_0x5d908e]={'$like':'%'+_0x13a5bc[_0xe4dd('0x37')][_0xe4dd('0x41')]+'%'};return _0x1adf0e;})});}_0x2b6ba9=_[_0xe4dd('0x43')]({},_0x2b6ba9,_0x13a5bc['options']);return _0x998b04[_0xe4dd('0x59')](_0x2b6ba9);}})[_0xe4dd('0x29')](function(_0x1b36f4){if(_0x1b36f4){_0x4152de=_0x1b36f4[_0xe4dd('0x3c')];if(!_0x13a5bc[_0xe4dd('0x37')][_0xe4dd('0x5a')]('nolimit')){_0x2b6ba9[_0xe4dd('0x20')]=qs[_0xe4dd('0x20')](_0x13a5bc[_0xe4dd('0x37')][_0xe4dd('0x20')]);_0x2b6ba9[_0xe4dd('0x22')]=qs[_0xe4dd('0x22')](_0x13a5bc[_0xe4dd('0x37')][_0xe4dd('0x22')]);}return _0x998b04[_0xe4dd('0x59')](_0x2b6ba9);}})[_0xe4dd('0x29')](function(_0x5d6dea){if(_0x5d6dea){return _0x5d6dea?{'count':_0x4152de,'rows':_0x5d6dea}:null;}})['then'](respondWithResult(_0x57e0d6,null))['catch'](handleError(_0x57e0d6,null));};exports['getAnyConditions']=function(_0x242362,_0x29d877,_0x451f2e){var _0x2fd36f={};var _0x23306e={};var _0x21e30e;var _0xe1ac8b;return db[_0xe4dd('0x31')]['findOne']({'where':{'id':_0x242362[_0xe4dd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x29d877,null))['then'](function(_0x27ffae){if(_0x27ffae){_0x21e30e=_0x27ffae;_0x23306e['model']=_[_0xe4dd('0x36')](db[_0xe4dd('0x56')][_0xe4dd('0x32')]);_0x23306e[_0xe4dd('0x37')]=_[_0xe4dd('0x36')](_0x242362[_0xe4dd('0x37')]);_0x23306e[_0xe4dd('0x38')]=_['intersection'](_0x23306e[_0xe4dd('0x39')],_0x23306e[_0xe4dd('0x37')]);_0x2fd36f[_0xe4dd('0x3b')]=_[_0xe4dd('0x4b')](_0x23306e[_0xe4dd('0x39')],qs[_0xe4dd('0x3a')](_0x242362[_0xe4dd('0x37')]['fields']));_0x2fd36f['attributes']=_0x2fd36f[_0xe4dd('0x3b')][_0xe4dd('0x3c')]?_0x2fd36f[_0xe4dd('0x3b')]:_0x23306e[_0xe4dd('0x39')];_0x2fd36f[_0xe4dd('0x3e')]=qs[_0xe4dd('0x3f')](_0x242362[_0xe4dd('0x37')][_0xe4dd('0x3f')]);_0x2fd36f[_0xe4dd('0x42')]=qs['filters'](_[_0xe4dd('0x40')](_0x242362[_0xe4dd('0x37')],_0x23306e[_0xe4dd('0x38')]));if(_0x242362[_0xe4dd('0x37')][_0xe4dd('0x41')]){_0x2fd36f[_0xe4dd('0x42')]=_['merge'](_0x2fd36f[_0xe4dd('0x42')],{'$or':_[_0xe4dd('0x30')](_0x2fd36f[_0xe4dd('0x3b')],function(_0x14284b){var _0x365711={};_0x365711[_0x14284b]={'$like':'%'+_0x242362['query'][_0xe4dd('0x41')]+'%'};return _0x365711;})});}_0x2fd36f=_[_0xe4dd('0x43')]({},_0x2fd36f,_0x242362['options']);return _0x21e30e[_0xe4dd('0x5b')](_0x2fd36f);}})[_0xe4dd('0x29')](function(_0x14bf02){if(_0x14bf02){_0xe1ac8b=_0x14bf02[_0xe4dd('0x3c')];if(!_0x242362[_0xe4dd('0x37')][_0xe4dd('0x5a')](_0xe4dd('0x3d'))){_0x2fd36f[_0xe4dd('0x20')]=qs[_0xe4dd('0x20')](_0x242362[_0xe4dd('0x37')][_0xe4dd('0x20')]);_0x2fd36f['offset']=qs[_0xe4dd('0x22')](_0x242362[_0xe4dd('0x37')][_0xe4dd('0x22')]);}return _0x21e30e[_0xe4dd('0x5b')](_0x2fd36f);}})[_0xe4dd('0x29')](function(_0x31a6ec){if(_0x31a6ec){return _0x31a6ec?{'count':_0xe1ac8b,'rows':_0x31a6ec}:null;}})['then'](respondWithResult(_0x29d877,null))['catch'](handleError(_0x29d877,null));};exports['addAction']=function(_0x522559,_0x547dcf,_0x31082e){if(_0x522559[_0xe4dd('0x4e')]['id']){delete _0x522559[_0xe4dd('0x4e')]['id'];}return db[_0xe4dd('0x31')][_0xe4dd('0x4c')]({'where':{'id':_0x522559[_0xe4dd('0x4a')]['id']}})[_0xe4dd('0x29')](handleEntityNotFound(_0x547dcf,null))['then'](function(_0x355f40){if(_0x355f40){_0x522559[_0xe4dd('0x4e')][_0xe4dd('0x5c')]=_0x355f40['id'];return db['Action']['create'](_0x522559[_0xe4dd('0x4e')]);}})['then'](respondWithResult(_0x547dcf,null))[_0xe4dd('0x48')](handleError(_0x547dcf,null));};exports[_0xe4dd('0x5d')]=function(_0x3fb4e0,_0x368217,_0xe6e735){var _0x1eea24={};var _0xf7fafa={};var _0x32d78a;var _0xe7862a;return db[_0xe4dd('0x31')][_0xe4dd('0x5e')]({'where':{'id':_0x3fb4e0[_0xe4dd('0x4a')]['id']}})[_0xe4dd('0x29')](handleEntityNotFound(_0x368217,null))[_0xe4dd('0x29')](function(_0x4c8515){if(_0x4c8515){_0x32d78a=_0x4c8515;_0xf7fafa[_0xe4dd('0x39')]=_[_0xe4dd('0x36')](db['Action']['rawAttributes']);_0xf7fafa[_0xe4dd('0x37')]=_[_0xe4dd('0x36')](_0x3fb4e0[_0xe4dd('0x37')]);_0xf7fafa[_0xe4dd('0x38')]=_[_0xe4dd('0x4b')](_0xf7fafa['model'],_0xf7fafa[_0xe4dd('0x37')]);_0x1eea24['attributes']=_['intersection'](_0xf7fafa[_0xe4dd('0x39')],qs[_0xe4dd('0x3a')](_0x3fb4e0[_0xe4dd('0x37')][_0xe4dd('0x3a')]));_0x1eea24[_0xe4dd('0x3b')]=_0x1eea24[_0xe4dd('0x3b')][_0xe4dd('0x3c')]?_0x1eea24[_0xe4dd('0x3b')]:_0xf7fafa[_0xe4dd('0x39')];_0x1eea24['order']=qs['sort'](_0x3fb4e0[_0xe4dd('0x37')][_0xe4dd('0x3f')]);_0x1eea24[_0xe4dd('0x42')]=qs[_0xe4dd('0x38')](_[_0xe4dd('0x40')](_0x3fb4e0[_0xe4dd('0x37')],_0xf7fafa['filters']));if(_0x3fb4e0[_0xe4dd('0x37')][_0xe4dd('0x41')]){_0x1eea24['where']=_[_0xe4dd('0x43')](_0x1eea24[_0xe4dd('0x42')],{'$or':_[_0xe4dd('0x30')](_0x1eea24[_0xe4dd('0x3b')],function(_0x4bd9e0){var _0x4519ca={};_0x4519ca[_0x4bd9e0]={'$like':'%'+_0x3fb4e0[_0xe4dd('0x37')][_0xe4dd('0x41')]+'%'};return _0x4519ca;})});}_0x1eea24=_[_0xe4dd('0x43')]({},_0x1eea24,_0x3fb4e0[_0xe4dd('0x44')]);return _0x32d78a[_0xe4dd('0x5d')](_0x1eea24);}})[_0xe4dd('0x29')](function(_0x368576){if(_0x368576){_0xe7862a=_0x368576[_0xe4dd('0x3c')];if(!_0x3fb4e0[_0xe4dd('0x37')][_0xe4dd('0x5a')]('nolimit')){_0x1eea24['limit']=qs[_0xe4dd('0x20')](_0x3fb4e0['query']['limit']);_0x1eea24[_0xe4dd('0x22')]=qs[_0xe4dd('0x22')](_0x3fb4e0[_0xe4dd('0x37')][_0xe4dd('0x22')]);}return _0x32d78a['getActions'](_0x1eea24);}})[_0xe4dd('0x29')](function(_0x34573d){if(_0x34573d){return _0x34573d?{'count':_0xe7862a,'rows':_0x34573d}:null;}})[_0xe4dd('0x29')](respondWithResult(_0x368217,null))[_0xe4dd('0x48')](handleError(_0x368217,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index cd4c1cf..b25c999 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 _0x0faf=['path','rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x0faf,0x132));var _0xf0fa=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x0faf[_0x3718b7];return _0xf8c91e;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var logger=require(_0xf0fa('0x1'))(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var BPromise=require(_0xf0fa('0x4'));var rp=require(_0xf0fa('0x5'));var fs=require('fs');var path=require(_0xf0fa('0x6'));var rimraf=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var attributes=require(_0xf0fa('0x9'));module['exports']=function(_0x3637a3,_0x44ffa0){return _0x3637a3[_0xf0fa('0xa')](_0xf0fa('0xb'),attributes,{'tableName':_0xf0fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36f1=['request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','../../config/logger','moment','bluebird'];(function(_0x399a1e,_0x5d7c30){var _0x1077e1=function(_0x48ec56){while(--_0x48ec56){_0x399a1e['push'](_0x399a1e['shift']());}};_0x1077e1(++_0x5d7c30);}(_0x36f1,0xb0));var _0x136f=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x36f1[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x136f('0x0'));var util=require('util');var logger=require(_0x136f('0x1'))('api');var moment=require(_0x136f('0x2'));var BPromise=require(_0x136f('0x3'));var rp=require(_0x136f('0x4'));var fs=require('fs');var path=require(_0x136f('0x5'));var rimraf=require(_0x136f('0x6'));var config=require(_0x136f('0x7'));var attributes=require(_0x136f('0x8'));module[_0x136f('0x9')]=function(_0x5b00b5,_0x430433){return _0x5b00b5['define'](_0x136f('0xa'),attributes,{'tableName':_0x136f('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 7cafdec..c4e93d8 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 _0x175c=['../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','raw','where','attributes','map','include','model','GetTrigger','ShowTrigger','Trigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x39b7cf,_0x8c6fc8){var _0x2dacbf=function(_0x58c7a3){while(--_0x58c7a3){_0x39b7cf['push'](_0x39b7cf['shift']());}};_0x2dacbf(++_0x8c6fc8);}(_0x175c,0x18e));var _0xc175=function(_0x15eb08,_0x442680){_0x15eb08=_0x15eb08-0x0;var _0x24f733=_0x175c[_0x15eb08];return _0x24f733;};'use strict';var _=require(_0xc175('0x0'));var util=require(_0xc175('0x1'));var moment=require(_0xc175('0x2'));var BPromise=require(_0xc175('0x3'));var rs=require(_0xc175('0x4'));var fs=require('fs');var Redis=require(_0xc175('0x5'));var db=require(_0xc175('0x6'))['db'];var utils=require(_0xc175('0x7'));var logger=require('../../config/logger')(_0xc175('0x8'));var config=require(_0xc175('0x9'));var jayson=require(_0xc175('0xa'));var client=jayson[_0xc175('0xb')][_0xc175('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a7348,_0x29d697,_0x385e08){return new BPromise(function(_0xc95ec0,_0x438074){return client[_0xc175('0xd')](_0x4a7348,_0x385e08)[_0xc175('0xe')](function(_0x2b5cd0){logger[_0xc175('0xf')](_0xc175('0x10'),_0x29d697,_0xc175('0x11'));logger[_0xc175('0x12')](_0xc175('0x13'),_0x29d697,_0xc175('0x11'),JSON[_0xc175('0x14')](_0x2b5cd0));if(_0x2b5cd0['error']){if(_0x2b5cd0[_0xc175('0x15')][_0xc175('0x16')]===0x1f4){logger[_0xc175('0x15')](_0xc175('0x10'),_0x29d697,_0x2b5cd0[_0xc175('0x15')]['message']);return _0x438074(_0x2b5cd0['error'][_0xc175('0x17')]);}logger['error'](_0xc175('0x10'),_0x29d697,_0x2b5cd0['error']['message']);return _0xc95ec0(_0x2b5cd0[_0xc175('0x15')][_0xc175('0x17')]);}else{logger[_0xc175('0xf')](_0xc175('0x10'),_0x29d697,_0xc175('0x11'));_0xc95ec0(_0x2b5cd0['result'][_0xc175('0x17')]);}})[_0xc175('0x18')](function(_0x585ba3){logger[_0xc175('0x15')]('Trigger,\x20%s,\x20%s',_0x29d697,_0x585ba3);_0x438074(_0x585ba3);});});}exports['GetTrigger']=function(_0x4839cc){var _0x3415a5=this;return new Promise(function(_0x5b6d90,_0x4d5f6f){return db['Trigger'][_0xc175('0x19')]({'raw':_0x4839cc[_0xc175('0x1a')]?_0x4839cc[_0xc175('0x1a')][_0xc175('0x1b')]===undefined?!![]:![]:!![],'where':_0x4839cc['options']?_0x4839cc[_0xc175('0x1a')][_0xc175('0x1c')]||null:null,'attributes':_0x4839cc['options']?_0x4839cc[_0xc175('0x1a')][_0xc175('0x1d')]||null:null,'limit':_0x4839cc[_0xc175('0x1a')]?_0x4839cc[_0xc175('0x1a')]['limit']||null:null,'include':_0x4839cc['options']?_0x4839cc['options']['include']?_[_0xc175('0x1e')](_0x4839cc[_0xc175('0x1a')][_0xc175('0x1f')],function(_0x4fa849){return{'model':db[_0x4fa849[_0xc175('0x20')]],'as':_0x4fa849['as'],'attributes':_0x4fa849[_0xc175('0x1d')],'include':_0x4fa849[_0xc175('0x1f')]?_[_0xc175('0x1e')](_0x4fa849[_0xc175('0x1f')],function(_0x1b9e08){return{'model':db[_0x1b9e08[_0xc175('0x20')]],'as':_0x1b9e08['as'],'attributes':_0x1b9e08[_0xc175('0x1d')],'include':_0x1b9e08[_0xc175('0x1f')]?_[_0xc175('0x1e')](_0x1b9e08['include'],function(_0x262aba){return{'model':db[_0x262aba[_0xc175('0x20')]],'as':_0x262aba['as'],'attributes':_0x262aba[_0xc175('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc175('0xe')](function(_0x56ce6b){logger[_0xc175('0xf')]('GetTrigger',_0x4839cc);logger[_0xc175('0x12')]('GetTrigger',_0x4839cc,JSON[_0xc175('0x14')](_0x56ce6b));_0x5b6d90(_0x56ce6b);})[_0xc175('0x18')](function(_0x382eaa){logger['error'](_0xc175('0x21'),_0x382eaa[_0xc175('0x17')],_0x4839cc);_0x4d5f6f(_0x3415a5['error'](0x1f4,_0x382eaa[_0xc175('0x17')]));});});};exports[_0xc175('0x22')]=function(_0x1b2dd9){var _0x2c7279=this;return new Promise(function(_0x206001,_0x173f73){return db[_0xc175('0x23')][_0xc175('0x24')]({'raw':_0x1b2dd9[_0xc175('0x1a')]?_0x1b2dd9[_0xc175('0x1a')][_0xc175('0x1b')]===undefined?!![]:![]:!![],'where':_0x1b2dd9['options']?_0x1b2dd9[_0xc175('0x1a')][_0xc175('0x1c')]||null:null,'attributes':_0x1b2dd9[_0xc175('0x1a')]?_0x1b2dd9[_0xc175('0x1a')][_0xc175('0x1d')]||null:null,'include':_0x1b2dd9[_0xc175('0x1a')]?_0x1b2dd9[_0xc175('0x1a')][_0xc175('0x1f')]?_['map'](_0x1b2dd9[_0xc175('0x1a')][_0xc175('0x1f')],function(_0x319a12){return{'model':db[_0x319a12[_0xc175('0x20')]],'as':_0x319a12['as'],'attributes':_0x319a12[_0xc175('0x1d')],'include':_0x319a12[_0xc175('0x1f')]?_[_0xc175('0x1e')](_0x319a12[_0xc175('0x1f')],function(_0x234e4c){return{'model':db[_0x234e4c['model']],'as':_0x234e4c['as'],'attributes':_0x234e4c[_0xc175('0x1d')],'include':_0x234e4c[_0xc175('0x1f')]?_[_0xc175('0x1e')](_0x234e4c[_0xc175('0x1f')],function(_0x315ce5){return{'model':db[_0x315ce5[_0xc175('0x20')]],'as':_0x315ce5['as'],'attributes':_0x315ce5['attributes']};}):[]};}):[]};}):[]:[]})[_0xc175('0xe')](function(_0x521f70){logger[_0xc175('0xf')](_0xc175('0x22'),_0x1b2dd9);logger[_0xc175('0x12')](_0xc175('0x22'),_0x1b2dd9,JSON[_0xc175('0x14')](_0x521f70));_0x206001(_0x521f70);})[_0xc175('0x18')](function(_0x2d0d52){logger[_0xc175('0x15')]('ShowTrigger',_0x2d0d52[_0xc175('0x17')],_0x1b2dd9);_0x173f73(_0x2c7279['error'](0x1f4,_0x2d0d52[_0xc175('0x17')]));});});}; \ No newline at end of file +var _0x6fca=['findAll','options','raw','where','limit','include','map','model','attributes','ShowTrigger','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetTrigger','Trigger'];(function(_0x1a547e,_0x5917d3){var _0x5ebdaf=function(_0x158b24){while(--_0x158b24){_0x1a547e['push'](_0x1a547e['shift']());}};_0x5ebdaf(++_0x5917d3);}(_0x6fca,0x14f));var _0xa6fc=function(_0x3e9be1,_0x2fac9c){_0x3e9be1=_0x3e9be1-0x0;var _0x41518b=_0x6fca[_0x3e9be1];return _0x41518b;};'use strict';var _=require(_0xa6fc('0x0'));var util=require(_0xa6fc('0x1'));var moment=require('moment');var BPromise=require(_0xa6fc('0x2'));var rs=require(_0xa6fc('0x3'));var fs=require('fs');var Redis=require(_0xa6fc('0x4'));var db=require(_0xa6fc('0x5'))['db'];var utils=require(_0xa6fc('0x6'));var logger=require(_0xa6fc('0x7'))(_0xa6fc('0x8'));var config=require('../../config/environment');var jayson=require(_0xa6fc('0x9'));var client=jayson[_0xa6fc('0xa')][_0xa6fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53b453,_0x17e6fc,_0x2e89d4){return new BPromise(function(_0x3fe8e6,_0x1a099b){return client[_0xa6fc('0xc')](_0x53b453,_0x2e89d4)[_0xa6fc('0xd')](function(_0x23ed3e){logger[_0xa6fc('0xe')](_0xa6fc('0xf'),_0x17e6fc,_0xa6fc('0x10'));logger[_0xa6fc('0x11')]('Trigger,\x20%s,\x20%s,\x20%s',_0x17e6fc,_0xa6fc('0x10'),JSON[_0xa6fc('0x12')](_0x23ed3e));if(_0x23ed3e[_0xa6fc('0x13')]){if(_0x23ed3e['error']['code']===0x1f4){logger[_0xa6fc('0x13')](_0xa6fc('0xf'),_0x17e6fc,_0x23ed3e[_0xa6fc('0x13')][_0xa6fc('0x14')]);return _0x1a099b(_0x23ed3e[_0xa6fc('0x13')]['message']);}logger[_0xa6fc('0x13')](_0xa6fc('0xf'),_0x17e6fc,_0x23ed3e[_0xa6fc('0x13')][_0xa6fc('0x14')]);return _0x3fe8e6(_0x23ed3e[_0xa6fc('0x13')][_0xa6fc('0x14')]);}else{logger[_0xa6fc('0xe')](_0xa6fc('0xf'),_0x17e6fc,_0xa6fc('0x10'));_0x3fe8e6(_0x23ed3e[_0xa6fc('0x15')][_0xa6fc('0x14')]);}})[_0xa6fc('0x16')](function(_0x94ed38){logger[_0xa6fc('0x13')](_0xa6fc('0xf'),_0x17e6fc,_0x94ed38);_0x1a099b(_0x94ed38);});});}exports[_0xa6fc('0x17')]=function(_0x5dcce7){var _0x44fa40=this;return new Promise(function(_0xb15087,_0xb940e8){return db[_0xa6fc('0x18')][_0xa6fc('0x19')]({'raw':_0x5dcce7['options']?_0x5dcce7[_0xa6fc('0x1a')][_0xa6fc('0x1b')]===undefined?!![]:![]:!![],'where':_0x5dcce7['options']?_0x5dcce7[_0xa6fc('0x1a')][_0xa6fc('0x1c')]||null:null,'attributes':_0x5dcce7['options']?_0x5dcce7[_0xa6fc('0x1a')]['attributes']||null:null,'limit':_0x5dcce7['options']?_0x5dcce7[_0xa6fc('0x1a')][_0xa6fc('0x1d')]||null:null,'include':_0x5dcce7[_0xa6fc('0x1a')]?_0x5dcce7['options'][_0xa6fc('0x1e')]?_[_0xa6fc('0x1f')](_0x5dcce7['options'][_0xa6fc('0x1e')],function(_0x95a5ab){return{'model':db[_0x95a5ab[_0xa6fc('0x20')]],'as':_0x95a5ab['as'],'attributes':_0x95a5ab[_0xa6fc('0x21')],'include':_0x95a5ab['include']?_['map'](_0x95a5ab[_0xa6fc('0x1e')],function(_0x1a582d){return{'model':db[_0x1a582d[_0xa6fc('0x20')]],'as':_0x1a582d['as'],'attributes':_0x1a582d[_0xa6fc('0x21')],'include':_0x1a582d['include']?_[_0xa6fc('0x1f')](_0x1a582d['include'],function(_0x3051b7){return{'model':db[_0x3051b7['model']],'as':_0x3051b7['as'],'attributes':_0x3051b7[_0xa6fc('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa6fc('0xd')](function(_0x109238){logger[_0xa6fc('0xe')](_0xa6fc('0x17'),_0x5dcce7);logger['debug'](_0xa6fc('0x17'),_0x5dcce7,JSON[_0xa6fc('0x12')](_0x109238));_0xb15087(_0x109238);})['catch'](function(_0x15b1d1){logger[_0xa6fc('0x13')](_0xa6fc('0x17'),_0x15b1d1[_0xa6fc('0x14')],_0x5dcce7);_0xb940e8(_0x44fa40[_0xa6fc('0x13')](0x1f4,_0x15b1d1[_0xa6fc('0x14')]));});});};exports[_0xa6fc('0x22')]=function(_0xbab203){var _0x51c3b2=this;return new Promise(function(_0x540574,_0x2c4287){return db[_0xa6fc('0x18')][_0xa6fc('0x23')]({'raw':_0xbab203[_0xa6fc('0x1a')]?_0xbab203[_0xa6fc('0x1a')][_0xa6fc('0x1b')]===undefined?!![]:![]:!![],'where':_0xbab203[_0xa6fc('0x1a')]?_0xbab203['options'][_0xa6fc('0x1c')]||null:null,'attributes':_0xbab203[_0xa6fc('0x1a')]?_0xbab203[_0xa6fc('0x1a')][_0xa6fc('0x21')]||null:null,'include':_0xbab203['options']?_0xbab203[_0xa6fc('0x1a')][_0xa6fc('0x1e')]?_[_0xa6fc('0x1f')](_0xbab203['options'][_0xa6fc('0x1e')],function(_0x5bf407){return{'model':db[_0x5bf407[_0xa6fc('0x20')]],'as':_0x5bf407['as'],'attributes':_0x5bf407['attributes'],'include':_0x5bf407[_0xa6fc('0x1e')]?_[_0xa6fc('0x1f')](_0x5bf407[_0xa6fc('0x1e')],function(_0x486936){return{'model':db[_0x486936[_0xa6fc('0x20')]],'as':_0x486936['as'],'attributes':_0x486936['attributes'],'include':_0x486936[_0xa6fc('0x1e')]?_[_0xa6fc('0x1f')](_0x486936[_0xa6fc('0x1e')],function(_0x2234d7){return{'model':db[_0x2234d7[_0xa6fc('0x20')]],'as':_0x2234d7['as'],'attributes':_0x2234d7[_0xa6fc('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x838f9){logger['info']('ShowTrigger',_0xbab203);logger[_0xa6fc('0x11')](_0xa6fc('0x22'),_0xbab203,JSON[_0xa6fc('0x12')](_0x838f9));_0x540574(_0x838f9);})[_0xa6fc('0x16')](function(_0x349de2){logger['error'](_0xa6fc('0x22'),_0x349de2[_0xa6fc('0x14')],_0xbab203);_0x2c4287(_0x51c3b2['error'](0x1f4,_0x349de2[_0xa6fc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 8695aaa..d76f2b3 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 _0xa814=['exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','clone','post','delete'];(function(_0x1aec60,_0x34fe2a){var _0x4b7422=function(_0x33f0f5){while(--_0x33f0f5){_0x1aec60['push'](_0x1aec60['shift']());}};_0x4b7422(++_0x34fe2a);}(_0xa814,0x161));var _0x4a81=function(_0x529942,_0x272e1a){_0x529942=_0x529942-0x0;var _0x48cd0d=_0xa814[_0x529942];return _0x48cd0d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4a81('0x0'));var timeout=require(_0x4a81('0x1'));var express=require(_0x4a81('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4a81('0x3'));var interaction=require(_0x4a81('0x4'));var config=require('../../config/environment');var controller=require(_0x4a81('0x5'));router[_0x4a81('0x6')]('/',auth[_0x4a81('0x7')](),controller[_0x4a81('0x8')]);router[_0x4a81('0x6')](_0x4a81('0x9'),auth[_0x4a81('0x7')](),controller[_0x4a81('0xa')]);router['post'](_0x4a81('0xb'),auth['isAuthenticated'](),controller[_0x4a81('0xc')]);router[_0x4a81('0xd')]('/',auth[_0x4a81('0x7')](),controller['create']);router['put']('/:id',auth[_0x4a81('0x7')](),controller['update']);router[_0x4a81('0xe')](_0x4a81('0x9'),auth[_0x4a81('0x7')](),controller['destroy']);module[_0x4a81('0xf')]=router; \ No newline at end of file +var _0x2748=['/:id','post','/:id/clone','clone','create','update','delete','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated'];(function(_0x3e2fe6,_0x334f09){var _0x59d813=function(_0x256f2f){while(--_0x256f2f){_0x3e2fe6['push'](_0x3e2fe6['shift']());}};_0x59d813(++_0x334f09);}(_0x2748,0x1a5));var _0x8274=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x2748[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x8274('0x0'));var path=require(_0x8274('0x1'));var timeout=require('connect-timeout');var express=require(_0x8274('0x2'));var router=express[_0x8274('0x3')]();var fs_extra=require(_0x8274('0x4'));var auth=require(_0x8274('0x5'));var interaction=require(_0x8274('0x6'));var config=require(_0x8274('0x7'));var controller=require(_0x8274('0x8'));router[_0x8274('0x9')]('/',auth[_0x8274('0xa')](),controller['index']);router[_0x8274('0x9')](_0x8274('0xb'),auth[_0x8274('0xa')](),controller['show']);router[_0x8274('0xc')](_0x8274('0xd'),auth[_0x8274('0xa')](),controller[_0x8274('0xe')]);router[_0x8274('0xc')]('/',auth['isAuthenticated'](),controller[_0x8274('0xf')]);router['put'](_0x8274('0xb'),auth[_0x8274('0xa')](),controller[_0x8274('0x10')]);router[_0x8274('0x11')](_0x8274('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 127bf43..d3c372b 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 _0x160d=['name','user','peer','friend','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','udp','setDataValue','join','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','yes','nonat','update','outgoing','force_rport,comedia','nat','all','allow','ulaw;alaw;gsm','split','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','\x22\x22\x20<>','always','accept','uac','uas','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING'];(function(_0xb74c89,_0x246040){var _0xe4ccef=function(_0x12b652){while(--_0x12b652){_0xb74c89['push'](_0xb74c89['shift']());}};_0xe4ccef(++_0x246040);}(_0x160d,0xc1));var _0xd160=function(_0x23d880,_0x25a936){_0x23d880=_0x23d880-0x0;var _0x589344=_0x160d[_0x23d880];return _0x589344;};'use strict';var Sequelize=require(_0xd160('0x0'));module[_0xd160('0x1')]={'name':{'type':Sequelize[_0xd160('0x2')],'allowNull':![],'unique':_0xd160('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0xd160('0x4'),_0xd160('0x5')),'allowNull':![],'defaultValue':_0xd160('0x6')},'context':{'type':Sequelize[_0xd160('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x8'),'ALLOWED_PASSED_SCREEN',_0xd160('0x9'),'ALLOWED','PROHIB_NOT_SCREENED',_0xd160('0xa'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0xd160('0x2')]},'permit':{'type':Sequelize[_0xd160('0x2')]},'secret':{'type':Sequelize[_0xd160('0x2')]},'md5secret':{'type':Sequelize[_0xd160('0x2')]},'remotesecret':{'type':Sequelize[_0xd160('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xd160('0xb'),'set':function(_0x11f0df){this[_0xd160('0xc')]('transport',_0x11f0df?_0x11f0df[_0xd160('0xd')](','):null);},'get':function(){return this[_0xd160('0xe')](_0xd160('0xf'))?this[_0xd160('0xe')](_0xd160('0xf'))['split'](','):null;},'comment':_0xd160('0x10')},'dtmfmode':{'type':Sequelize['ENUM'](_0xd160('0x11'),_0xd160('0x12'),_0xd160('0x13'),'inband','auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no',_0xd160('0x15'),_0xd160('0x16'),_0xd160('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd160('0x2')]},'directmediadeny':{'type':Sequelize[_0xd160('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xd160('0x18'),'set':function(_0xe915d8){this[_0xd160('0xc')](_0xd160('0x19'),_0xe915d8?_0xe915d8['join'](','):null);},'get':function(){return this[_0xd160('0xe')](_0xd160('0x19'))?this[_0xd160('0xe')](_0xd160('0x19'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xd160('0x2')]},'pickupgroup':{'type':Sequelize[_0xd160('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xd160('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd160('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd160('0x2')],'defaultValue':_0xd160('0x1a')},'allow':{'type':Sequelize[_0xd160('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2fedbf){this[_0xd160('0xc')](_0xd160('0x1b'),_0x2fedbf?_0x2fedbf[_0xd160('0xd')](';'):_0xd160('0x1c'));},'get':function(){return this[_0xd160('0xe')](_0xd160('0x1b'))?this[_0xd160('0xe')](_0xd160('0x1b'))[_0xd160('0x1d')](';'):null;},'comment':_0xd160('0x1e')},'autoframing':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no')},'insecure':{'type':Sequelize[_0xd160('0x2')],'defaultValue':_0xd160('0x1f'),'set':function(_0x46e37e){this[_0xd160('0xc')](_0xd160('0x20'),_0x46e37e?_0x46e37e[_0xd160('0xd')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xd160('0xe')](_0xd160('0x20'))['split'](','):null;},'comment':_0xd160('0x21')},'trustrpid':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd160('0x7')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd160('0x7')]('yes','no',_0xd160('0x22'))},'promiscredir':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no')},'useclientcode':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no')},'accountcode':{'type':Sequelize[_0xd160('0x23')](0xb)},'setvar':{'type':Sequelize[_0xd160('0x2')]},'callerid':{'type':Sequelize[_0xd160('0x2')],'defaultValue':_0xd160('0x24')},'amaflags':{'type':Sequelize[_0xd160('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xd160('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no',_0xd160('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd160('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no')},'mailbox':{'type':Sequelize[_0xd160('0x2')]},'session_timers':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x26'),'refuse','originate')},'session_expires':{'type':Sequelize[_0xd160('0x23')](0xb)},'session_minse':{'type':Sequelize[_0xd160('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x27'),'uas'),'defaultValue':_0xd160('0x28')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xd160('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xd160('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xd160('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xd160('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd160('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd160('0x2')]},'callbackextension':{'type':Sequelize[_0xd160('0x2')]},'timert1':{'type':Sequelize[_0xd160('0x23')](0xb)},'timerb':{'type':Sequelize[_0xd160('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd160('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xd160('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xd160('0x2')]},'maxforwards':{'type':Sequelize[_0xd160('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no')},'force_avp':{'type':Sequelize[_0xd160('0x7')]('yes','no')},'icesupport':{'type':Sequelize[_0xd160('0x7')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xd160('0x7')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no',_0xd160('0x29'),_0xd160('0x2a'))},'dtlsrekey':{'type':Sequelize[_0xd160('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd160('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xd160('0x2')]},'dtlscipher':{'type':Sequelize[_0xd160('0x2')]},'dtlscafile':{'type':Sequelize[_0xd160('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x2b'),_0xd160('0x2c'),_0xd160('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xd160('0x2')]},'call_limit':{'type':Sequelize[_0xd160('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xd160('0x2')]},'mohsuggest':{'type':Sequelize[_0xd160('0x2')]},'parkinglot':{'type':Sequelize[_0xd160('0x2')]},'description':{'type':Sequelize[_0xd160('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xd160('0x2e')},'canreinvite':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no','nonat',_0xd160('0x16'),_0xd160('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xd160('0x2')]},'otherFields':{'type':Sequelize[_0xd160('0x2')]},'active':{'type':Sequelize[_0xd160('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0xa502=['accept','refuse','originate','uas','pai','fingerprint','active','passive','actpass','dynamic','nonat','update','sequelize','exports','STRING','name','ENUM','friend','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','yes','outgoing','force_rport,comedia','nat','join','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\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xa502,0x194));var _0x2a50=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa502[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x2a50('0x0'));module[_0x2a50('0x1')]={'name':{'type':Sequelize[_0x2a50('0x2')],'allowNull':![],'unique':_0x2a50('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x5'),'user','peer'),'allowNull':![],'defaultValue':_0x2a50('0x5')},'context':{'type':Sequelize[_0x2a50('0x2')],'allowNull':![],'defaultValue':_0x2a50('0x6')},'callingpres':{'type':Sequelize[_0x2a50('0x4')]('ALLOWED_NOT_SCREENED',_0x2a50('0x7'),_0x2a50('0x8'),_0x2a50('0x9'),_0x2a50('0xa'),_0x2a50('0xb'),_0x2a50('0xc'),_0x2a50('0xd'))},'deny':{'type':Sequelize[_0x2a50('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x2a50('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x2a50('0x2')]},'transport':{'type':Sequelize[_0x2a50('0x2')],'defaultValue':_0x2a50('0xe'),'set':function(_0x282cdf){this[_0x2a50('0xf')](_0x2a50('0x10'),_0x282cdf?_0x282cdf['join'](','):null);},'get':function(){return this[_0x2a50('0x11')](_0x2a50('0x10'))?this[_0x2a50('0x11')](_0x2a50('0x10'))[_0x2a50('0x12')](','):null;},'comment':_0x2a50('0x13')},'dtmfmode':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x14'),'info',_0x2a50('0x15'),'inband','auto'),'defaultValue':_0x2a50('0x14')},'directmedia':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x16'),'no','nonat','update',_0x2a50('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2a50('0x2')]},'directmediadeny':{'type':Sequelize[_0x2a50('0x2')]},'nat':{'type':Sequelize[_0x2a50('0x2')],'defaultValue':_0x2a50('0x18'),'set':function(_0x3416cb){this[_0x2a50('0xf')](_0x2a50('0x19'),_0x3416cb?_0x3416cb[_0x2a50('0x1a')](','):null);},'get':function(){return this['getDataValue'](_0x2a50('0x19'))?this[_0x2a50('0x11')]('nat')[_0x2a50('0x12')](','):null;},'comment':_0x2a50('0x1b')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x2a50('0x2')]},'pickupgroup':{'type':Sequelize[_0x2a50('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x2a50('0x2')]},'language':{'type':Sequelize[_0x2a50('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2a50('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2a50('0x2')],'defaultValue':_0x2a50('0x1c')},'allow':{'type':Sequelize[_0x2a50('0x2')],'allowNull':![],'defaultValue':_0x2a50('0x1d'),'set':function(_0x2a9051){this[_0x2a50('0xf')](_0x2a50('0x1e'),_0x2a9051?_0x2a9051['join'](';'):_0x2a50('0x1d'));},'get':function(){return this[_0x2a50('0x11')](_0x2a50('0x1e'))?this[_0x2a50('0x11')](_0x2a50('0x1e'))[_0x2a50('0x12')](';'):null;},'comment':_0x2a50('0x1f')},'autoframing':{'type':Sequelize['ENUM'](_0x2a50('0x16'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x2a50('0x20'),'set':function(_0x148333){this[_0x2a50('0xf')](_0x2a50('0x21'),_0x148333?_0x148333[_0x2a50('0x1a')](','):null);},'get':function(){return this[_0x2a50('0x11')]('insecure')?this[_0x2a50('0x11')](_0x2a50('0x21'))[_0x2a50('0x12')](','):null;},'comment':_0x2a50('0x22')},'trustrpid':{'type':Sequelize[_0x2a50('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2a50('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x16'),'no','never')},'promiscredir':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x16'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x2a50('0x16'),'no')},'accountcode':{'type':Sequelize[_0x2a50('0x23')](0xb)},'setvar':{'type':Sequelize[_0x2a50('0x2')]},'callerid':{'type':Sequelize[_0x2a50('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x2a50('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x2a50('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x2a50('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x2a50('0x16'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x2a50('0x2')]},'videosupport':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x16'),'no',_0x2a50('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2a50('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x16'),'no')},'mailbox':{'type':Sequelize[_0x2a50('0x2')]},'session_timers':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x25'),_0x2a50('0x26'),_0x2a50('0x27'))},'session_expires':{'type':Sequelize[_0x2a50('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x2a50('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x2a50('0x4')]('uac',_0x2a50('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x2a50('0x2')]},'regexten':{'type':Sequelize[_0x2a50('0x2')]},'fromdomain':{'type':Sequelize[_0x2a50('0x2')]},'fromuser':{'type':Sequelize[_0x2a50('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x2a50('0x16'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x2a50('0x2')]},'defaultuser':{'type':Sequelize[_0x2a50('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x2a50('0x4')]('yes','no',_0x2a50('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2a50('0x2')]},'callbackextension':{'type':Sequelize[_0x2a50('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x2a50('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2a50('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x2a50('0x2')]},'contactdeny':{'type':Sequelize[_0x2a50('0x2')]},'contactacl':{'type':Sequelize[_0x2a50('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2a50('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2a50('0x2')]},'maxforwards':{'type':Sequelize[_0x2a50('0x23')](0xb)},'encryption':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x16'),'no')},'force_avp':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x16'),'no')},'icesupport':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x2a50('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x16'),'no',_0x2a50('0x2a'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x2a50('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2a50('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x2a50('0x2')]},'dtlscapath':{'type':Sequelize[_0x2a50('0x2')]},'dtlssetup':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x2b'),_0x2a50('0x2c'),_0x2a50('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2a50('0x2')]},'recordofffeature':{'type':Sequelize[_0x2a50('0x2')]},'call_limit':{'type':Sequelize[_0x2a50('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x2a50('0x4')](_0x2a50('0x16'),'no')},'vmexten':{'type':Sequelize[_0x2a50('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x2a50('0x2')]},'parkinglot':{'type':Sequelize[_0x2a50('0x2')]},'description':{'type':Sequelize[_0x2a50('0x2')]},'host':{'type':Sequelize[_0x2a50('0x2')],'defaultValue':_0x2a50('0x2e')},'canreinvite':{'type':Sequelize['ENUM'](_0x2a50('0x16'),'no',_0x2a50('0x2f'),_0x2a50('0x30'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2a50('0x2')]},'otherFields':{'type':Sequelize[_0x2a50('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2a50('0x2')],'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 8bd310d..f11788a 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 _0x9a19=['query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','show','include','find','clone','params','omit','updatedAt','body','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','autoAssociation','findAll','readFileSync','writeFileSync','Reload','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type'];(function(_0x1de83e,_0xc143c8){var _0x5a54d9=function(_0x2caeae){while(--_0x2caeae){_0x1de83e['push'](_0x1de83e['shift']());}};_0x5a54d9(++_0xc143c8);}(_0x9a19,0x114));var _0x99a1=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x9a19[_0x3cc9d9];return _0x1a425d;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];var jayson=require(_0x99a1('0x19'));var client=jayson[_0x99a1('0x1a')][_0x99a1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf713b9,_0x40c19c,_0x3a865c,_0x47815e){return new BPromise(function(_0xe1a1f,_0x3c9ef4){var _0x39ee55=_0x47815e||client;return _0x39ee55['request'](_0xf713b9,_0x3a865c)[_0x99a1('0x1c')](function(_0x3e45d4){logger[_0x99a1('0x1d')](_0x99a1('0x1e'),_0x40c19c,_0x99a1('0x1f'));logger[_0x99a1('0x20')](_0x99a1('0x21'),_0x40c19c,'request\x20sent',JSON['stringify'](_0x3e45d4));if(_0x3e45d4[_0x99a1('0x22')]){if(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x23')]===0x1f4){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);return _0x3c9ef4(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);}logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4['error'][_0x99a1('0x24')]);return _0xe1a1f(_0x3e45d4[_0x99a1('0x22')]['message']);}else{logger[_0x99a1('0x1d')]('Trunk,\x20%s,\x20%s',_0x40c19c,_0x99a1('0x1f'));_0xe1a1f(_0x3e45d4[_0x99a1('0x25')][_0x99a1('0x24')]);}})[_0x99a1('0x26')](function(_0x5a88c6){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x5a88c6);_0x3c9ef4(_0x5a88c6);});});}function respondWithStatusCode(_0x483c17,_0x44df2d){_0x44df2d=_0x44df2d||0xcc;return function(_0x5b5dfa){if(_0x5b5dfa){return _0x483c17[_0x99a1('0x27')](_0x44df2d);}return _0x483c17[_0x99a1('0x28')](_0x44df2d)[_0x99a1('0x29')]();};}function respondWithResult(_0xdaa27d,_0x3c813){_0x3c813=_0x3c813||0xc8;return function(_0x491341){if(_0x491341){return _0xdaa27d['status'](_0x3c813)[_0x99a1('0x2a')](_0x491341);}};}function respondWithFilteredResult(_0x5dabd9,_0x5dc733){return function(_0xafea84){if(_0xafea84){var _0x440879=typeof _0x5dc733[_0x99a1('0x2b')]===_0x99a1('0x2c')&&typeof _0x5dc733[_0x99a1('0x2d')]===_0x99a1('0x2c');var _0x183037=_0xafea84['count'];var _0xf41b0d=_0x440879?0x0:_0x5dc733['offset'];var _0x255197=_0x440879?_0xafea84[_0x99a1('0x2e')]:_0x5dc733[_0x99a1('0x2b')]+_0x5dc733['limit'];var _0x371edf;if(_0x255197>=_0x183037){_0x255197=_0x183037;_0x371edf=0xc8;}else{_0x371edf=0xce;}_0x5dabd9[_0x99a1('0x28')](_0x371edf);return _0x5dabd9['set'](_0x99a1('0x2f'),_0xf41b0d+'-'+_0x255197+'/'+_0x183037)[_0x99a1('0x2a')](_0xafea84);}return null;};}function patchUpdates(_0x36aa34){return function(_0x303d1e){try{jsonpatch[_0x99a1('0x30')](_0x303d1e,_0x36aa34,!![]);}catch(_0x969f6e){return BPromise[_0x99a1('0x31')](_0x969f6e);}return _0x303d1e[_0x99a1('0x32')]();};}function saveUpdates(_0x52da8d,_0x4960e4){return function(_0x3fa342){if(_0x3fa342){return _0x3fa342['update'](_0x52da8d)[_0x99a1('0x1c')](function(_0x400581){return _0x400581;});}return null;};}function removeEntity(_0x5b1a79,_0xa5972b){return function(_0x3503d5){if(_0x3503d5){return _0x3503d5[_0x99a1('0x33')]()[_0x99a1('0x1c')](function(){var _0x13f4db=_0x3503d5[_0x99a1('0x34')]({'plain':!![]});var _0x3081cd=_0x99a1('0x35');return db[_0x99a1('0x36')][_0x99a1('0x33')]({'where':{'type':_0x3081cd,'resourceId':_0x13f4db['id']}})[_0x99a1('0x1c')](function(){return _0x3503d5;});})[_0x99a1('0x1c')](function(){_0x5b1a79[_0x99a1('0x28')](0xcc)[_0x99a1('0x29')]();});}};}function handleEntityNotFound(_0x55005e,_0x53fed5){return function(_0x46e3f2){if(!_0x46e3f2){_0x55005e[_0x99a1('0x27')](0x194);}return _0x46e3f2;};}function handleError(_0x416a36,_0x4131e0){_0x4131e0=_0x4131e0||0x1f4;return function(_0x2690bd){logger[_0x99a1('0x22')](_0x2690bd[_0x99a1('0x37')]);if(_0x2690bd['name']){delete _0x2690bd[_0x99a1('0x38')];}_0x416a36[_0x99a1('0x28')](_0x4131e0)['send'](_0x2690bd);};}exports[_0x99a1('0x39')]=function(_0x2d328c,_0x391afa){var _0x3cd1a0={},_0x430cbc={},_0x399fd4={'count':0x0,'rows':[]};var _0x30e8a9=_[_0x99a1('0x3a')](db[_0x99a1('0x3b')][_0x99a1('0x3c')],function(_0x1da3e7){return{'name':_0x1da3e7[_0x99a1('0x3d')],'type':_0x1da3e7[_0x99a1('0x3e')]['key']};});_0x430cbc['model']=_['map'](_0x30e8a9,_0x99a1('0x38'));_0x430cbc[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x2d328c[_0x99a1('0x3f')]);_0x430cbc[_0x99a1('0x41')]=_['intersection'](_0x430cbc[_0x99a1('0x42')],_0x430cbc[_0x99a1('0x3f')]);_0x3cd1a0[_0x99a1('0x43')]=_['intersection'](_0x430cbc['model'],qs[_0x99a1('0x44')](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x3cd1a0['attributes']=_0x3cd1a0[_0x99a1('0x43')][_0x99a1('0x45')]?_0x3cd1a0[_0x99a1('0x43')]:_0x430cbc[_0x99a1('0x42')];if(!_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x46')](_0x99a1('0x47'))){_0x3cd1a0[_0x99a1('0x2d')]=qs[_0x99a1('0x2d')](_0x2d328c[_0x99a1('0x3f')]['limit']);_0x3cd1a0[_0x99a1('0x2b')]=qs[_0x99a1('0x2b')](_0x2d328c[_0x99a1('0x3f')]['offset']);}_0x3cd1a0[_0x99a1('0x48')]=qs['sort'](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x49')]);_0x3cd1a0[_0x99a1('0x4a')]=qs[_0x99a1('0x41')](_[_0x99a1('0x4b')](_0x2d328c[_0x99a1('0x3f')],_0x430cbc['filters']),_0x30e8a9);if(_0x2d328c[_0x99a1('0x3f')]['filter']){_0x3cd1a0[_0x99a1('0x4a')]=_[_0x99a1('0x4c')](_0x3cd1a0[_0x99a1('0x4a')],{'$or':_[_0x99a1('0x3a')](_0x30e8a9,function(_0x3a0b44){if(_0x3a0b44[_0x99a1('0x3e')]!==_0x99a1('0x4d')){var _0x3861b6={};_0x3861b6[_0x3a0b44[_0x99a1('0x38')]]={'$like':'%'+_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x4e')]+'%'};return _0x3861b6;}})});}_0x3cd1a0=_['merge']({},_0x3cd1a0,_0x2d328c[_0x99a1('0x4f')]);var _0x330e3b={'where':_0x3cd1a0['where']};return db[_0x99a1('0x3b')][_0x99a1('0x2e')](_0x330e3b)[_0x99a1('0x1c')](function(_0x2e377b){_0x399fd4[_0x99a1('0x2e')]=_0x2e377b;if(_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x50')]){_0x3cd1a0['include']=[{'all':!![]}];}return db[_0x99a1('0x3b')]['findAll'](_0x3cd1a0);})[_0x99a1('0x1c')](function(_0x269798){_0x399fd4['rows']=_0x269798;return _0x399fd4;})['then'](respondWithFilteredResult(_0x391afa,_0x3cd1a0))[_0x99a1('0x26')](handleError(_0x391afa,null));};exports[_0x99a1('0x51')]=function(_0x462c15,_0x4519fb){var _0xee2b1b={'raw':![],'where':{'id':_0x462c15['params']['id']}},_0x597836={};_0x597836['model']=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x597836[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x462c15[_0x99a1('0x3f')]);_0x597836[_0x99a1('0x41')]=_['intersection'](_0x597836[_0x99a1('0x42')],_0x597836[_0x99a1('0x3f')]);_0xee2b1b[_0x99a1('0x43')]=_['intersection'](_0x597836[_0x99a1('0x42')],qs['fields'](_0x462c15['query'][_0x99a1('0x44')]));_0xee2b1b[_0x99a1('0x43')]=_0xee2b1b[_0x99a1('0x43')][_0x99a1('0x45')]?_0xee2b1b[_0x99a1('0x43')]:_0x597836[_0x99a1('0x42')];if(_0x462c15[_0x99a1('0x3f')][_0x99a1('0x50')]){_0xee2b1b[_0x99a1('0x52')]=[{'all':!![]}];}_0xee2b1b=_['merge']({},_0xee2b1b,_0x462c15[_0x99a1('0x4f')]);return db['Trunk'][_0x99a1('0x53')](_0xee2b1b)[_0x99a1('0x1c')](handleEntityNotFound(_0x4519fb,null))['then'](respondWithResult(_0x4519fb,null))[_0x99a1('0x26')](handleError(_0x4519fb,null));};exports[_0x99a1('0x54')]=function(_0x469e10,_0x2b2d63){var _0x2800d5={'where':{'id':_0x469e10[_0x99a1('0x55')]['id']}},_0x1bff78={};_0x1bff78[_0x99a1('0x42')]=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x2800d5[_0x99a1('0x43')]=_['intersection'](_0x1bff78['model'],qs[_0x99a1('0x44')](_0x469e10[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x2800d5[_0x99a1('0x43')]=_0x2800d5[_0x99a1('0x43')]['length']?_0x2800d5[_0x99a1('0x43')]:_0x1bff78[_0x99a1('0x42')];if(_0x469e10['query'][_0x99a1('0x50')]){_0x2800d5[_0x99a1('0x52')]=[{'all':!![]}];}_0x2800d5=_[_0x99a1('0x4c')]({},_0x2800d5,_0x469e10[_0x99a1('0x4f')]);return db[_0x99a1('0x3b')]['find'](_0x2800d5)[_0x99a1('0x1c')](handleEntityNotFound(_0x2b2d63,null))[_0x99a1('0x1c')](function(_0x1bb1cb){if(_0x1bb1cb){var _0x22811f=_0x1bb1cb[_0x99a1('0x34')]({'plain':!![]});_0x22811f=qs[_0x99a1('0x56')](_0x22811f,['id','createdAt',_0x99a1('0x57')]);_0x469e10[_0x99a1('0x58')]=_['omit'](_0x469e10[_0x99a1('0x58')],['id',_0x99a1('0x59'),_0x99a1('0x57')]);return db[_0x99a1('0x3b')][_0x99a1('0x5a')](_['merge'](_0x22811f,_0x469e10[_0x99a1('0x58')]),{'include':_0x469e10['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x38ce3c){var _0x3f7c16=_0x469e10['user']['get']({'plain':!![]});if(!_0x3f7c16)throw new Error(_0x99a1('0x5b'));if(_0x3f7c16['role']===_0x99a1('0x5c')){var _0x263db3=_0x38ce3c[_0x99a1('0x34')]({'plain':!![]});var _0x180c1e='Trunks';return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x180c1e,'userProfileId':_0x3f7c16[_0x99a1('0x5e')]},'raw':!![]})['then'](function(_0x3a62c6){if(_0x3a62c6&&_0x3a62c6['autoAssociation']===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x263db3[_0x99a1('0x38')],'resourceId':_0x263db3['id'],'type':_0x3a62c6[_0x99a1('0x38')],'sectionId':_0x3a62c6['id']},{})[_0x99a1('0x1c')](function(){return _0x38ce3c;});}else{return _0x38ce3c;}})['catch'](function(_0x4d37f8){logger['error'](_0x99a1('0x5f'),_0x4d37f8);throw _0x4d37f8;});}return _0x38ce3c;});}})[_0x99a1('0x1c')](respondWithResult(_0x2b2d63,0xc9))['catch'](handleError(_0x2b2d63,null));};exports['create']=function(_0x1fe7af,_0x2f5587,_0x401c8f){var _0x509d4f;return db['Trunk'][_0x99a1('0x5a')](_0x1fe7af['body'],{'raw':!![]})[_0x99a1('0x1c')](function(_0x129690){_0x509d4f=_0x129690;return db[_0x99a1('0x3b')]['findAll']({'raw':!![]});})[_0x99a1('0x1c')](function(_0x28c7d8){var _0x4ac99e=fs['readFileSync'](path[_0x99a1('0x60')](config['root'],_0x99a1('0x61')),_0x99a1('0x62'));var _0x30a0a5=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x3d0ff6=ejs['render'](_0x4ac99e,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x65'),_0x3d0ff6);if(_0x509d4f[_0x99a1('0x66')]){var _0x1750d5=ejs[_0x99a1('0x67')](_0x30a0a5,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x68'),_0x1750d5);}})['then'](function(){return respondWithRpcPromise('Reload',_0x99a1('0x5a'),{'module':_0x99a1('0x69')});})[_0x99a1('0x1c')](function(){var _0x525969=_0x1fe7af[_0x99a1('0x5c')][_0x99a1('0x34')]({'plain':!![]});if(!_0x525969)throw new Error(_0x99a1('0x5b'));if(_0x525969[_0x99a1('0x6a')]===_0x99a1('0x5c')){var _0x4ae313=_0x509d4f[_0x99a1('0x34')]({'plain':!![]});return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x99a1('0x35'),'userProfileId':_0x525969[_0x99a1('0x5e')]},'raw':!![]})[_0x99a1('0x1c')](function(_0x5e42be){if(_0x5e42be&&_0x5e42be[_0x99a1('0x6b')]===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x4ae313[_0x99a1('0x38')],'resourceId':_0x4ae313['id'],'type':_0x5e42be[_0x99a1('0x38')],'sectionId':_0x5e42be['id']},{})['then'](function(){return _0x509d4f;});}else{return _0x509d4f;}})[_0x99a1('0x26')](function(_0x68c944){logger[_0x99a1('0x22')](_0x99a1('0x5f'),_0x68c944);throw _0x68c944;});}return _0x509d4f;})[_0x99a1('0x1c')](respondWithResult(_0x2f5587,0xc9))[_0x99a1('0x26')](handleError(_0x2f5587,null));};exports['update']=function(_0xaa953e,_0x33d96b,_0x4a5617){var _0x56716a;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0xaa953e['params']['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x33d96b,null))[_0x99a1('0x1c')](saveUpdates(_0xaa953e[_0x99a1('0x58')],null))[_0x99a1('0x1c')](function(_0x43156f){if(_0x43156f){_0x56716a=_0x43156f;return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});}})[_0x99a1('0x1c')](function(_0x4260d7){if(_0x4260d7){var _0x3e099c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],'server/files/templates/trunk.ejs'),_0x99a1('0x62'));var _0x5a9a7d=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0xbbbe26=ejs[_0x99a1('0x67')](_0x3e099c,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0xbbbe26);var _0x361ce6=ejs['render'](_0x5a9a7d,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x68'),_0x361ce6);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x70'),{'module':_0x99a1('0x69')});}return null;})[_0x99a1('0x1c')](function(_0x6dab29){if(_0x6dab29){return _0x56716a;}})[_0x99a1('0x1c')](respondWithResult(_0x33d96b,null))['catch'](handleError(_0x33d96b,null));};exports['destroy']=function(_0x51c289,_0x2dd29b,_0x353f25){var _0x53cdb3;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0x51c289[_0x99a1('0x55')]['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x2dd29b,null))['then'](removeEntity(_0x2dd29b,null))[_0x99a1('0x1c')](function(){return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});})[_0x99a1('0x1c')](function(_0x4e9fe9){var _0x24aa05=fs['readFileSync'](path['join'](config['root'],_0x99a1('0x61')),'utf8');var _0xb7744c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x444e43=ejs['render'](_0x24aa05,{'trunks':_0x4e9fe9});var _0x4fcd65=ejs[_0x99a1('0x67')](_0xb7744c,{'trunks':_0x4e9fe9});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0x444e43);fs['writeFileSync'](_0x99a1('0x68'),_0x4fcd65);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x33'),{'module':'chan_sip.so'});})[_0x99a1('0x26')](handleError(_0x2dd29b,null));}; \ No newline at end of file +var _0x55ca=['catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','Trunk','rawAttributes','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','length','options','find','clone','omit','updatedAt','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','readFileSync','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0xddf6de,_0x32543f){var _0x3f002c=function(_0x2cf5f1){while(--_0x2cf5f1){_0xddf6de['push'](_0xddf6de['shift']());}};_0x3f002c(++_0x32543f);}(_0x55ca,0x126));var _0xa55c=function(_0x1521be,_0x34aa83){_0x1521be=_0x1521be-0x0;var _0x156a8e=_0x55ca[_0x1521be];return _0x156a8e;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('Trunk,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){var _0x54ca97=_0xcbaf2e[_0xa55c('0x30')]({'plain':!![]});var _0x19733e='Trunks';return db[_0xa55c('0x31')][_0xa55c('0x2f')]({'where':{'type':_0x19733e,'resourceId':_0x54ca97['id']}})[_0xa55c('0x1a')](function(){return _0xcbaf2e;});})[_0xa55c('0x1a')](function(){_0x24d44d[_0xa55c('0x25')](0xcc)[_0xa55c('0x32')]();});}};}function handleEntityNotFound(_0x3ce1b3,_0x222d4b){return function(_0x3959e3){if(!_0x3959e3){_0x3ce1b3['sendStatus'](0x194);}return _0x3959e3;};}function handleError(_0x5f3e99,_0x4b23d3){_0x4b23d3=_0x4b23d3||0x1f4;return function(_0x3fd75f){logger[_0xa55c('0x21')](_0x3fd75f[_0xa55c('0x33')]);if(_0x3fd75f['name']){delete _0x3fd75f[_0xa55c('0x34')];}_0x5f3e99['status'](_0x4b23d3)[_0xa55c('0x35')](_0x3fd75f);};}exports['index']=function(_0x18c6f1,_0x39267c){var _0x3c0ec1={},_0x4d3eb5={},_0x7c4a47={'count':0x0,'rows':[]};var _0x30f23b=_['map'](db[_0xa55c('0x36')][_0xa55c('0x37')],function(_0x4d9083){return{'name':_0x4d9083['fieldName'],'type':_0x4d9083[_0xa55c('0x38')]['key']};});_0x4d3eb5[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x30f23b,'name');_0x4d3eb5['query']=_['keys'](_0x18c6f1['query']);_0x4d3eb5[_0xa55c('0x3b')]=_[_0xa55c('0x3c')](_0x4d3eb5[_0xa55c('0x39')],_0x4d3eb5[_0xa55c('0x3d')]);_0x3c0ec1[_0xa55c('0x3e')]=_['intersection'](_0x4d3eb5[_0xa55c('0x39')],qs[_0xa55c('0x3f')](_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x3f')]));_0x3c0ec1[_0xa55c('0x3e')]=_0x3c0ec1[_0xa55c('0x3e')]['length']?_0x3c0ec1[_0xa55c('0x3e')]:_0x4d3eb5['model'];if(!_0x18c6f1['query'][_0xa55c('0x40')](_0xa55c('0x41'))){_0x3c0ec1['limit']=qs[_0xa55c('0x2a')](_0x18c6f1['query']['limit']);_0x3c0ec1[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x18c6f1[_0xa55c('0x3d')]['offset']);}_0x3c0ec1[_0xa55c('0x42')]=qs[_0xa55c('0x43')](_0x18c6f1['query'][_0xa55c('0x43')]);_0x3c0ec1['where']=qs[_0xa55c('0x3b')](_[_0xa55c('0x44')](_0x18c6f1['query'],_0x4d3eb5[_0xa55c('0x3b')]),_0x30f23b);if(_0x18c6f1[_0xa55c('0x3d')]['filter']){_0x3c0ec1[_0xa55c('0x45')]=_[_0xa55c('0x46')](_0x3c0ec1[_0xa55c('0x45')],{'$or':_['map'](_0x30f23b,function(_0x334f52){if(_0x334f52['type']!==_0xa55c('0x47')){var _0x3a8af4={};_0x3a8af4[_0x334f52[_0xa55c('0x34')]]={'$like':'%'+_0x18c6f1['query'][_0xa55c('0x48')]+'%'};return _0x3a8af4;}})});}_0x3c0ec1=_[_0xa55c('0x46')]({},_0x3c0ec1,_0x18c6f1['options']);var _0x3d19f5={'where':_0x3c0ec1[_0xa55c('0x45')]};return db['Trunk'][_0xa55c('0x29')](_0x3d19f5)[_0xa55c('0x1a')](function(_0x52f9a7){_0x7c4a47[_0xa55c('0x29')]=_0x52f9a7;if(_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x49')]){_0x3c0ec1[_0xa55c('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0xa55c('0x4b')](_0x3c0ec1);})['then'](function(_0x2157d6){_0x7c4a47[_0xa55c('0x4c')]=_0x2157d6;return _0x7c4a47;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x39267c,_0x3c0ec1))['catch'](handleError(_0x39267c,null));};exports[_0xa55c('0x4d')]=function(_0x250b00,_0x574fe9){var _0x5be06={'raw':![],'where':{'id':_0x250b00[_0xa55c('0x4e')]['id']}},_0x34de95={};_0x34de95[_0xa55c('0x39')]=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x34de95[_0xa55c('0x3d')]=_[_0xa55c('0x4f')](_0x250b00[_0xa55c('0x3d')]);_0x34de95['filters']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],_0x34de95[_0xa55c('0x3d')]);_0x5be06['attributes']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],qs['fields'](_0x250b00[_0xa55c('0x3d')]['fields']));_0x5be06[_0xa55c('0x3e')]=_0x5be06[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x5be06[_0xa55c('0x3e')]:_0x34de95[_0xa55c('0x39')];if(_0x250b00['query'][_0xa55c('0x49')]){_0x5be06[_0xa55c('0x4a')]=[{'all':!![]}];}_0x5be06=_['merge']({},_0x5be06,_0x250b00[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x5be06)[_0xa55c('0x1a')](handleEntityNotFound(_0x574fe9,null))['then'](respondWithResult(_0x574fe9,null))['catch'](handleError(_0x574fe9,null));};exports[_0xa55c('0x53')]=function(_0x250dea,_0x3ca5b8){var _0x44ac57={'where':{'id':_0x250dea[_0xa55c('0x4e')]['id']}},_0x54cbde={};_0x54cbde['model']=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x44ac57[_0xa55c('0x3e')]=_[_0xa55c('0x3c')](_0x54cbde['model'],qs[_0xa55c('0x3f')](_0x250dea['query'][_0xa55c('0x3f')]));_0x44ac57[_0xa55c('0x3e')]=_0x44ac57[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x44ac57[_0xa55c('0x3e')]:_0x54cbde[_0xa55c('0x39')];if(_0x250dea[_0xa55c('0x3d')]['includeAll']){_0x44ac57[_0xa55c('0x4a')]=[{'all':!![]}];}_0x44ac57=_[_0xa55c('0x46')]({},_0x44ac57,_0x250dea[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x44ac57)['then'](handleEntityNotFound(_0x3ca5b8,null))[_0xa55c('0x1a')](function(_0x3cd40d){if(_0x3cd40d){var _0x28bac4=_0x3cd40d[_0xa55c('0x30')]({'plain':!![]});_0x28bac4=qs[_0xa55c('0x54')](_0x28bac4,['id','createdAt',_0xa55c('0x55')]);_0x250dea[_0xa55c('0x56')]=_[_0xa55c('0x54')](_0x250dea[_0xa55c('0x56')],['id',_0xa55c('0x57'),'updatedAt']);return db[_0xa55c('0x36')]['create'](_[_0xa55c('0x46')](_0x28bac4,_0x250dea['body']),{'include':_0x250dea[_0xa55c('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x1a')](function(_0x1333da){var _0x21d6b4=_0x250dea[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x21d6b4)throw new Error(_0xa55c('0x59'));if(_0x21d6b4[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0x14b515=_0x1333da[_0xa55c('0x30')]({'plain':!![]});var _0x51c736=_0xa55c('0x5b');return db[_0xa55c('0x5c')]['find']({'where':{'name':_0x51c736,'userProfileId':_0x21d6b4[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x3e3b4b){if(_0x3e3b4b&&_0x3e3b4b[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')][_0xa55c('0x5f')]({'name':_0x14b515[_0xa55c('0x34')],'resourceId':_0x14b515['id'],'type':_0x3e3b4b[_0xa55c('0x34')],'sectionId':_0x3e3b4b['id']},{})['then'](function(){return _0x1333da;});}else{return _0x1333da;}})[_0xa55c('0x24')](function(_0x475131){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x475131);throw _0x475131;});}return _0x1333da;});}})[_0xa55c('0x1a')](respondWithResult(_0x3ca5b8,0xc9))[_0xa55c('0x24')](handleError(_0x3ca5b8,null));};exports[_0xa55c('0x5f')]=function(_0x4249c1,_0x25d5a1,_0x4a08ca){var _0x347562;return db[_0xa55c('0x36')][_0xa55c('0x5f')](_0x4249c1[_0xa55c('0x56')],{'raw':!![]})[_0xa55c('0x1a')](function(_0x10e711){_0x347562=_0x10e711;return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x3178a6){var _0x3bbc4b=fs['readFileSync'](path[_0xa55c('0x61')](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0x129bb4=fs['readFileSync'](path['join'](config[_0xa55c('0x64')],_0xa55c('0x65')),_0xa55c('0x63'));var _0x42529f=ejs['render'](_0x3bbc4b,{'trunks':_0x3178a6||[]});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x42529f);if(_0x347562[_0xa55c('0x68')]){var _0x3a9910=ejs[_0xa55c('0x69')](_0x129bb4,{'trunks':_0x3178a6||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3a9910);}})[_0xa55c('0x1a')](function(){return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x5f'),{'module':_0xa55c('0x6b')});})[_0xa55c('0x1a')](function(){var _0x4b2032=_0x4249c1[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x4b2032)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2032[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0xa340fb=_0x347562['get']({'plain':!![]});return db[_0xa55c('0x5c')][_0xa55c('0x52')]({'where':{'name':_0xa55c('0x5b'),'userProfileId':_0x4b2032[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x506f74){if(_0x506f74&&_0x506f74[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')]['create']({'name':_0xa340fb['name'],'resourceId':_0xa340fb['id'],'type':_0x506f74[_0xa55c('0x34')],'sectionId':_0x506f74['id']},{})['then'](function(){return _0x347562;});}else{return _0x347562;}})[_0xa55c('0x24')](function(_0x5ca0bc){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x5ca0bc);throw _0x5ca0bc;});}return _0x347562;})[_0xa55c('0x1a')](respondWithResult(_0x25d5a1,0xc9))[_0xa55c('0x24')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x2e')]=function(_0xff7b1c,_0x16dfc6,_0x5d8551){var _0x463195;return db[_0xa55c('0x36')][_0xa55c('0x52')]({'where':{'id':_0xff7b1c[_0xa55c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16dfc6,null))[_0xa55c('0x1a')](saveUpdates(_0xff7b1c[_0xa55c('0x56')],null))[_0xa55c('0x1a')](function(_0x2298ac){if(_0x2298ac){_0x463195=_0x2298ac;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa55c('0x1a')](function(_0x428872){if(_0x428872){var _0x12e3a8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0xd33c9c=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x65')),'utf8');var _0x19497b=ejs['render'](_0x12e3a8,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x19497b);var _0x36ded7=ejs[_0xa55c('0x69')](_0xd33c9c,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x36ded7);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2e'),{'module':_0xa55c('0x6b')});}return null;})[_0xa55c('0x1a')](function(_0x576a1b){if(_0x576a1b){return _0x463195;}})['then'](respondWithResult(_0x16dfc6,null))[_0xa55c('0x24')](handleError(_0x16dfc6,null));};exports[_0xa55c('0x2f')]=function(_0xc2ad5c,_0x256db0,_0x1622cb){var _0x137728;return db['Trunk'][_0xa55c('0x52')]({'where':{'id':_0xc2ad5c[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x256db0,null))[_0xa55c('0x1a')](removeEntity(_0x256db0,null))[_0xa55c('0x1a')](function(){return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x58b670){var _0x25d09d=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x62')),'utf8');var _0x2685d8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x65')),_0xa55c('0x63'));var _0x5c2229=ejs['render'](_0x25d09d,{'trunks':_0x58b670});var _0x579726=ejs['render'](_0x2685d8,{'trunks':_0x58b670});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x5c2229);fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x579726);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2f'),{'module':'chan_sip.so'});})[_0xa55c('0x24')](handleError(_0x256db0,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index e34cd40..5378747 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 _0xaf5d=['../../config/environment','./trunk.attributes','exports','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0xcafced,_0x321e54){var _0x309e4f=function(_0x377107){while(--_0x377107){_0xcafced['push'](_0xcafced['shift']());}};_0x309e4f(++_0x321e54);}(_0xaf5d,0x143));var _0xdaf5=function(_0x112cca,_0x1e2b0a){_0x112cca=_0x112cca-0x0;var _0x3eacf1=_0xaf5d[_0x112cca];return _0x3eacf1;};'use strict';var _=require(_0xdaf5('0x0'));var util=require(_0xdaf5('0x1'));var logger=require(_0xdaf5('0x2'))(_0xdaf5('0x3'));var moment=require(_0xdaf5('0x4'));var BPromise=require(_0xdaf5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdaf5('0x6'));var config=require(_0xdaf5('0x7'));var attributes=require(_0xdaf5('0x8'));module[_0xdaf5('0x9')]=function(_0x222f4b,_0x138b19){return _0x222f4b['define']('Trunk',attributes,{'tableName':_0xdaf5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9f9=['request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','bluebird'];(function(_0x220231,_0x4cded8){var _0x37531e=function(_0x966b1b){while(--_0x966b1b){_0x220231['push'](_0x220231['shift']());}};_0x37531e(++_0x4cded8);}(_0xb9f9,0x95));var _0x9b9f=function(_0x276517,_0x4d19e6){_0x276517=_0x276517-0x0;var _0x75ec0c=_0xb9f9[_0x276517];return _0x75ec0c;};'use strict';var _=require(_0x9b9f('0x0'));var util=require(_0x9b9f('0x1'));var logger=require(_0x9b9f('0x2'))(_0x9b9f('0x3'));var moment=require('moment');var BPromise=require(_0x9b9f('0x4'));var rp=require(_0x9b9f('0x5'));var fs=require('fs');var path=require(_0x9b9f('0x6'));var rimraf=require(_0x9b9f('0x7'));var config=require(_0x9b9f('0x8'));var attributes=require(_0x9b9f('0x9'));module[_0x9b9f('0xa')]=function(_0x30b998,_0x3bd146){return _0x30b998[_0x9b9f('0xb')](_0x9b9f('0xc'),attributes,{'tableName':_0x9b9f('0xd'),'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 70be4bc..eb1d95c 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 _0xa0f7=['options','raw','where','attributes','limit','include','map','model','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','findAll'];(function(_0x876443,_0x291f94){var _0x58ae19=function(_0x441923){while(--_0x441923){_0x876443['push'](_0x876443['shift']());}};_0x58ae19(++_0x291f94);}(_0xa0f7,0xe8));var _0x7a0f=function(_0x494c5a,_0x42a134){_0x494c5a=_0x494c5a-0x0;var _0x1764bf=_0xa0f7[_0x494c5a];return _0x1764bf;};'use strict';var _=require(_0x7a0f('0x0'));var util=require(_0x7a0f('0x1'));var moment=require(_0x7a0f('0x2'));var BPromise=require(_0x7a0f('0x3'));var rs=require(_0x7a0f('0x4'));var fs=require('fs');var Redis=require(_0x7a0f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a0f('0x6'));var logger=require('../../config/logger')(_0x7a0f('0x7'));var config=require(_0x7a0f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7a0f('0x9')][_0x7a0f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41161e,_0x5632dc,_0x4b6f63){return new BPromise(function(_0x4cdef7,_0x278819){return client[_0x7a0f('0xb')](_0x41161e,_0x4b6f63)[_0x7a0f('0xc')](function(_0x1ab914){logger[_0x7a0f('0xd')]('Trunk,\x20%s,\x20%s',_0x5632dc,_0x7a0f('0xe'));logger[_0x7a0f('0xf')](_0x7a0f('0x10'),_0x5632dc,'request\x20sent',JSON[_0x7a0f('0x11')](_0x1ab914));if(_0x1ab914[_0x7a0f('0x12')]){if(_0x1ab914['error'][_0x7a0f('0x13')]===0x1f4){logger[_0x7a0f('0x12')](_0x7a0f('0x14'),_0x5632dc,_0x1ab914[_0x7a0f('0x12')][_0x7a0f('0x15')]);return _0x278819(_0x1ab914[_0x7a0f('0x12')]['message']);}logger['error'](_0x7a0f('0x14'),_0x5632dc,_0x1ab914[_0x7a0f('0x12')]['message']);return _0x4cdef7(_0x1ab914['error'][_0x7a0f('0x15')]);}else{logger['info'](_0x7a0f('0x14'),_0x5632dc,_0x7a0f('0xe'));_0x4cdef7(_0x1ab914[_0x7a0f('0x16')]['message']);}})[_0x7a0f('0x17')](function(_0x9cfc96){logger['error'](_0x7a0f('0x14'),_0x5632dc,_0x9cfc96);_0x278819(_0x9cfc96);});});}exports[_0x7a0f('0x18')]=function(_0x2c1ab5){var _0x1ace23=this;return new Promise(function(_0x2f43d9,_0x53fb6a){return db[_0x7a0f('0x19')][_0x7a0f('0x1a')]({'raw':_0x2c1ab5[_0x7a0f('0x1b')]?_0x2c1ab5[_0x7a0f('0x1b')][_0x7a0f('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c1ab5[_0x7a0f('0x1b')]?_0x2c1ab5['options'][_0x7a0f('0x1d')]||null:null,'attributes':_0x2c1ab5[_0x7a0f('0x1b')]?_0x2c1ab5[_0x7a0f('0x1b')][_0x7a0f('0x1e')]||null:null,'limit':_0x2c1ab5[_0x7a0f('0x1b')]?_0x2c1ab5[_0x7a0f('0x1b')][_0x7a0f('0x1f')]||null:null,'include':_0x2c1ab5[_0x7a0f('0x1b')]?_0x2c1ab5[_0x7a0f('0x1b')][_0x7a0f('0x20')]?_[_0x7a0f('0x21')](_0x2c1ab5[_0x7a0f('0x1b')][_0x7a0f('0x20')],function(_0x51ac02){return{'model':db[_0x51ac02[_0x7a0f('0x22')]],'as':_0x51ac02['as'],'attributes':_0x51ac02[_0x7a0f('0x1e')],'include':_0x51ac02[_0x7a0f('0x20')]?_['map'](_0x51ac02['include'],function(_0x29aff1){return{'model':db[_0x29aff1[_0x7a0f('0x22')]],'as':_0x29aff1['as'],'attributes':_0x29aff1['attributes'],'include':_0x29aff1[_0x7a0f('0x20')]?_[_0x7a0f('0x21')](_0x29aff1[_0x7a0f('0x20')],function(_0x36732d){return{'model':db[_0x36732d[_0x7a0f('0x22')]],'as':_0x36732d['as'],'attributes':_0x36732d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xf8a87c){logger[_0x7a0f('0xd')](_0x7a0f('0x18'),_0x2c1ab5);logger[_0x7a0f('0xf')](_0x7a0f('0x18'),_0x2c1ab5,JSON[_0x7a0f('0x11')](_0xf8a87c));_0x2f43d9(_0xf8a87c);})['catch'](function(_0x9353bb){logger[_0x7a0f('0x12')](_0x7a0f('0x18'),_0x9353bb[_0x7a0f('0x15')],_0x2c1ab5);_0x53fb6a(_0x1ace23[_0x7a0f('0x12')](0x1f4,_0x9353bb[_0x7a0f('0x15')]));});});};exports[_0x7a0f('0x23')]=function(_0x341b20){var _0x19ca2c=this;return new Promise(function(_0x1a49b9,_0xe6890e){return db[_0x7a0f('0x19')][_0x7a0f('0x24')]({'raw':_0x341b20[_0x7a0f('0x1b')]?_0x341b20[_0x7a0f('0x1b')][_0x7a0f('0x1c')]===undefined?!![]:![]:!![],'where':_0x341b20[_0x7a0f('0x1b')]?_0x341b20[_0x7a0f('0x1b')][_0x7a0f('0x1d')]||null:null,'attributes':_0x341b20[_0x7a0f('0x1b')]?_0x341b20['options'][_0x7a0f('0x1e')]||null:null,'include':_0x341b20['options']?_0x341b20[_0x7a0f('0x1b')]['include']?_[_0x7a0f('0x21')](_0x341b20[_0x7a0f('0x1b')][_0x7a0f('0x20')],function(_0x2f2d66){return{'model':db[_0x2f2d66[_0x7a0f('0x22')]],'as':_0x2f2d66['as'],'attributes':_0x2f2d66['attributes'],'include':_0x2f2d66[_0x7a0f('0x20')]?_[_0x7a0f('0x21')](_0x2f2d66[_0x7a0f('0x20')],function(_0x1faa76){return{'model':db[_0x1faa76[_0x7a0f('0x22')]],'as':_0x1faa76['as'],'attributes':_0x1faa76['attributes'],'include':_0x1faa76[_0x7a0f('0x20')]?_[_0x7a0f('0x21')](_0x1faa76[_0x7a0f('0x20')],function(_0x2fe2dc){return{'model':db[_0x2fe2dc[_0x7a0f('0x22')]],'as':_0x2fe2dc['as'],'attributes':_0x2fe2dc[_0x7a0f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7a0f('0xc')](function(_0x3d40f7){logger['info'](_0x7a0f('0x23'),_0x341b20);logger['debug']('ShowTrunk',_0x341b20,JSON[_0x7a0f('0x11')](_0x3d40f7));_0x1a49b9(_0x3d40f7);})['catch'](function(_0x8d7f50){logger[_0x7a0f('0x12')]('ShowTrunk',_0x8d7f50[_0x7a0f('0x15')],_0x341b20);_0xe6890e(_0x19ca2c['error'](0x1f4,_0x8d7f50[_0x7a0f('0x15')]));});});}; \ No newline at end of file +var _0x8627=['message','info','result','catch','GetTrunk','Trunk','options','raw','where','attributes','map','include','model','debug','stringify','ShowTrunk','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Trunk,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5d4bdb,_0x2ce160){var _0x409a47=function(_0x20d78f){while(--_0x20d78f){_0x5d4bdb['push'](_0x5d4bdb['shift']());}};_0x409a47(++_0x2ce160);}(_0x8627,0xd1));var _0x7862=function(_0x1baeba,_0x5a3327){_0x1baeba=_0x1baeba-0x0;var _0x5794a1=_0x8627[_0x1baeba];return _0x5794a1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7862('0x0'));var BPromise=require(_0x7862('0x1'));var rs=require(_0x7862('0x2'));var fs=require('fs');var Redis=require(_0x7862('0x3'));var db=require(_0x7862('0x4'))['db'];var utils=require(_0x7862('0x5'));var logger=require(_0x7862('0x6'))(_0x7862('0x7'));var config=require(_0x7862('0x8'));var jayson=require(_0x7862('0x9'));var client=jayson['client'][_0x7862('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f1bb8,_0x1fa876,_0x2d400d){return new BPromise(function(_0x6c1ec5,_0x1cdd31){return client['request'](_0x5f1bb8,_0x2d400d)[_0x7862('0xb')](function(_0x3a2f5a){logger['info'](_0x7862('0xc'),_0x1fa876,_0x7862('0xd'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x1fa876,_0x7862('0xd'),JSON['stringify'](_0x3a2f5a));if(_0x3a2f5a[_0x7862('0xe')]){if(_0x3a2f5a[_0x7862('0xe')]['code']===0x1f4){logger['error'](_0x7862('0xc'),_0x1fa876,_0x3a2f5a[_0x7862('0xe')]['message']);return _0x1cdd31(_0x3a2f5a[_0x7862('0xe')][_0x7862('0xf')]);}logger[_0x7862('0xe')](_0x7862('0xc'),_0x1fa876,_0x3a2f5a['error'][_0x7862('0xf')]);return _0x6c1ec5(_0x3a2f5a[_0x7862('0xe')][_0x7862('0xf')]);}else{logger[_0x7862('0x10')]('Trunk,\x20%s,\x20%s',_0x1fa876,_0x7862('0xd'));_0x6c1ec5(_0x3a2f5a[_0x7862('0x11')][_0x7862('0xf')]);}})[_0x7862('0x12')](function(_0x2cae75){logger[_0x7862('0xe')](_0x7862('0xc'),_0x1fa876,_0x2cae75);_0x1cdd31(_0x2cae75);});});}exports[_0x7862('0x13')]=function(_0x12b3a8){var _0x57c508=this;return new Promise(function(_0x5c4ddf,_0x28bb2c){return db[_0x7862('0x14')]['findAll']({'raw':_0x12b3a8[_0x7862('0x15')]?_0x12b3a8[_0x7862('0x15')][_0x7862('0x16')]===undefined?!![]:![]:!![],'where':_0x12b3a8[_0x7862('0x15')]?_0x12b3a8[_0x7862('0x15')][_0x7862('0x17')]||null:null,'attributes':_0x12b3a8[_0x7862('0x15')]?_0x12b3a8[_0x7862('0x15')][_0x7862('0x18')]||null:null,'limit':_0x12b3a8[_0x7862('0x15')]?_0x12b3a8[_0x7862('0x15')]['limit']||null:null,'include':_0x12b3a8['options']?_0x12b3a8['options']['include']?_[_0x7862('0x19')](_0x12b3a8['options'][_0x7862('0x1a')],function(_0x52a1e0){return{'model':db[_0x52a1e0['model']],'as':_0x52a1e0['as'],'attributes':_0x52a1e0[_0x7862('0x18')],'include':_0x52a1e0[_0x7862('0x1a')]?_['map'](_0x52a1e0[_0x7862('0x1a')],function(_0x778f9f){return{'model':db[_0x778f9f[_0x7862('0x1b')]],'as':_0x778f9f['as'],'attributes':_0x778f9f[_0x7862('0x18')],'include':_0x778f9f[_0x7862('0x1a')]?_[_0x7862('0x19')](_0x778f9f[_0x7862('0x1a')],function(_0x2f6701){return{'model':db[_0x2f6701[_0x7862('0x1b')]],'as':_0x2f6701['as'],'attributes':_0x2f6701[_0x7862('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7862('0xb')](function(_0x2ac9f8){logger[_0x7862('0x10')](_0x7862('0x13'),_0x12b3a8);logger[_0x7862('0x1c')]('GetTrunk',_0x12b3a8,JSON[_0x7862('0x1d')](_0x2ac9f8));_0x5c4ddf(_0x2ac9f8);})[_0x7862('0x12')](function(_0x4691){logger['error']('GetTrunk',_0x4691[_0x7862('0xf')],_0x12b3a8);_0x28bb2c(_0x57c508[_0x7862('0xe')](0x1f4,_0x4691[_0x7862('0xf')]));});});};exports[_0x7862('0x1e')]=function(_0x412960){var _0x1ee7d7=this;return new Promise(function(_0x450298,_0x43ea83){return db[_0x7862('0x14')][_0x7862('0x1f')]({'raw':_0x412960['options']?_0x412960[_0x7862('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x412960[_0x7862('0x15')]?_0x412960[_0x7862('0x15')][_0x7862('0x17')]||null:null,'attributes':_0x412960[_0x7862('0x15')]?_0x412960['options'][_0x7862('0x18')]||null:null,'include':_0x412960[_0x7862('0x15')]?_0x412960[_0x7862('0x15')]['include']?_[_0x7862('0x19')](_0x412960[_0x7862('0x15')][_0x7862('0x1a')],function(_0x6a3a7f){return{'model':db[_0x6a3a7f[_0x7862('0x1b')]],'as':_0x6a3a7f['as'],'attributes':_0x6a3a7f[_0x7862('0x18')],'include':_0x6a3a7f[_0x7862('0x1a')]?_[_0x7862('0x19')](_0x6a3a7f['include'],function(_0x3cb885){return{'model':db[_0x3cb885[_0x7862('0x1b')]],'as':_0x3cb885['as'],'attributes':_0x3cb885[_0x7862('0x18')],'include':_0x3cb885[_0x7862('0x1a')]?_[_0x7862('0x19')](_0x3cb885[_0x7862('0x1a')],function(_0x19cef7){return{'model':db[_0x19cef7['model']],'as':_0x19cef7['as'],'attributes':_0x19cef7[_0x7862('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7862('0xb')](function(_0x951e2b){logger[_0x7862('0x10')]('ShowTrunk',_0x412960);logger[_0x7862('0x1c')](_0x7862('0x1e'),_0x412960,JSON[_0x7862('0x1d')](_0x951e2b));_0x450298(_0x951e2b);})[_0x7862('0x12')](function(_0x5830d2){logger['error'](_0x7862('0x1e'),_0x5830d2[_0x7862('0xf')],_0x412960);_0x43ea83(_0x1ee7d7[_0x7862('0xe')](0x1f4,_0x5830d2[_0x7862('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index f59e07e..98c2a8a 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 _0x3d5a=['update','exports','express','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated'];(function(_0x14d26e,_0x10645d){var _0x3c2282=function(_0x1ab037){while(--_0x1ab037){_0x14d26e['push'](_0x14d26e['shift']());}};_0x3c2282(++_0x10645d);}(_0x3d5a,0x1a0));var _0xa3d5=function(_0x20fa63,_0x65c8d3){_0x20fa63=_0x20fa63-0x0;var _0x4c37ae=_0x3d5a[_0x20fa63];return _0x4c37ae;};'use strict';var express=require(_0xa3d5('0x0'));var router=express[_0xa3d5('0x1')]();var auth=require(_0xa3d5('0x2'));var controller=require(_0xa3d5('0x3'));router[_0xa3d5('0x4')](_0xa3d5('0x5'),auth[_0xa3d5('0x6')](),controller[_0xa3d5('0x7')]);module[_0xa3d5('0x8')]=router; \ No newline at end of file +var _0x5347=['../../components/auth/service','./user-setting.controller','put','/:id','update','exports','express'];(function(_0x5a225d,_0x50de4f){var _0x3b8bd2=function(_0x1461a1){while(--_0x1461a1){_0x5a225d['push'](_0x5a225d['shift']());}};_0x3b8bd2(++_0x50de4f);}(_0x5347,0x1c6));var _0x7534=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0x5347[_0x50a004];return _0x5e9992;};'use strict';var express=require(_0x7534('0x0'));var router=express['Router']();var auth=require(_0x7534('0x1'));var controller=require(_0x7534('0x2'));router[_0x7534('0x3')](_0x7534('0x4'),auth['isAuthenticated'](),controller[_0x7534('0x5')]);module[_0x7534('0x6')]=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 16fd5f1..1d7eb40 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 _0xa96e=['warning','info','debug','exports','BOOLEAN','TEXT','DATE','INTEGER','UserId','error'];(function(_0x45b9b5,_0x3bb244){var _0x2fd55c=function(_0x33f0e6){while(--_0x33f0e6){_0x45b9b5['push'](_0x45b9b5['shift']());}};_0x2fd55c(++_0x3bb244);}(_0xa96e,0x149));var _0xea96=function(_0x252a77,_0x5f36e7){_0x252a77=_0x252a77-0x0;var _0x1217c2=_0xa96e[_0x252a77];return _0x1217c2;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xea96('0x0'),_0xea96('0x1'),_0xea96('0x2'),_0xea96('0x3')];module[_0xea96('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xea96('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xea96('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xea96('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xea96('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xea96('0x8')],'unique':_0xea96('0x9')}}; \ No newline at end of file +var _0x3c8a=['TEXT','DATE','INTEGER','UserId','sequelize','warning','debug','ENUM','error','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3c8a,0x72));var _0xa3c8=function(_0x9b7721,_0x36ef2f){_0x9b7721=_0x9b7721-0x0;var _0x2c92de=_0x3c8a[_0x9b7721];return _0x2c92de;};'use strict';var Sequelize=require(_0xa3c8('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xa3c8('0x1'),'info',_0xa3c8('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xa3c8('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xa3c8('0x4'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xa3c8('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xa3c8('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xa3c8('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xa3c8('0x8')],'unique':_0xa3c8('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 8b2f927..2c0f19c 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 _0x3379=['then','catch','lodash','ioredis','../../config/logger','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','defaults','localhost','status','json','update','sendStatus','error','stack','name','send','user','role','admin','Invalid\x20user\x20setting\x20id','params'];(function(_0x5e941e,_0x178858){var _0x172fb0=function(_0x36321b){while(--_0x36321b){_0x5e941e['push'](_0x5e941e['shift']());}};_0x172fb0(++_0x178858);}(_0x3379,0x115));var _0x9337=function(_0x4af320,_0x10b274){_0x4af320=_0x4af320-0x0;var _0x178fce=_0x3379[_0x4af320];return _0x178fce;};'use strict';var _=require(_0x9337('0x0'));var Redis=require(_0x9337('0x1'));var logger=require(_0x9337('0x2'))(_0x9337('0x3'));var config=require('../../config/environment');var db=require(_0x9337('0x4'))['db'];var socket=require(_0x9337('0x5'))(new Redis(config[_0x9337('0x6')]));require(_0x9337('0x7'))['register'](socket);config[_0x9337('0x6')]=_[_0x9337('0x8')](config[_0x9337('0x6')],{'host':_0x9337('0x9'),'port':0x18eb});function respondWithResult(_0x5a59ab,_0x16e2a4){_0x16e2a4=_0x16e2a4||0xc8;return function(_0x5b1986){if(_0x5b1986){return _0x5a59ab[_0x9337('0xa')](_0x16e2a4)[_0x9337('0xb')](_0x5b1986);}};}function saveUpdates(_0x240bfc){return function(_0x175eb2){if(_0x175eb2){return _0x175eb2[_0x9337('0xc')](_0x240bfc)['then'](function(_0xd9b084){return _0xd9b084;});}return null;};}function handleEntityNotFound(_0x1630bf){return function(_0xc985d1){if(!_0xc985d1){_0x1630bf[_0x9337('0xd')](0x194);}return _0xc985d1;};}function handleError(_0x26995d,_0x5dc1b5){_0x5dc1b5=_0x5dc1b5||0x1f4;return function(_0x2ee523){logger[_0x9337('0xe')](_0x2ee523[_0x9337('0xf')]);if(_0x2ee523[_0x9337('0x10')]){delete _0x2ee523[_0x9337('0x10')];}_0x26995d[_0x9337('0xa')](_0x5dc1b5)[_0x9337('0x11')](_0x2ee523);};}exports['update']=function(_0x4dafd1,_0xa58254){if(_0x4dafd1[_0x9337('0x12')][_0x9337('0x13')]!==_0x9337('0x14'))throw new Error('Unauthorized');if(isNaN(Number(_0x4dafd1['params']['id'])))throw new Error(_0x9337('0x15'));return db['UserSetting']['find']({'where':{'id':_0x4dafd1[_0x9337('0x16')]['id']}})[_0x9337('0x17')](handleEntityNotFound(_0xa58254,null))[_0x9337('0x17')](saveUpdates(_0x4dafd1['body'],null))[_0x9337('0x17')](respondWithResult(_0xa58254,null))[_0x9337('0x18')](handleError(_0xa58254,null));}; \ No newline at end of file +var _0xe0c3=['localhost','status','json','update','then','sendStatus','error','stack','name','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','lodash','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register'];(function(_0x2eb6fa,_0x598ca9){var _0x1e92a8=function(_0x3686f8){while(--_0x3686f8){_0x2eb6fa['push'](_0x2eb6fa['shift']());}};_0x1e92a8(++_0x598ca9);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3e0c('0x0'));var Redis=require('ioredis');var logger=require(_0x3e0c('0x1'))(_0x3e0c('0x2'));var config=require(_0x3e0c('0x3'));var db=require(_0x3e0c('0x4'))['db'];var socket=require(_0x3e0c('0x5'))(new Redis(config[_0x3e0c('0x6')]));require(_0x3e0c('0x7'))[_0x3e0c('0x8')](socket);config[_0x3e0c('0x6')]=_['defaults'](config['redis'],{'host':_0x3e0c('0x9'),'port':0x18eb});function respondWithResult(_0x1e339a,_0x3f6607){_0x3f6607=_0x3f6607||0xc8;return function(_0x243b5b){if(_0x243b5b){return _0x1e339a[_0x3e0c('0xa')](_0x3f6607)[_0x3e0c('0xb')](_0x243b5b);}};}function saveUpdates(_0x1dbe0f){return function(_0x448907){if(_0x448907){return _0x448907[_0x3e0c('0xc')](_0x1dbe0f)[_0x3e0c('0xd')](function(_0x9372d8){return _0x9372d8;});}return null;};}function handleEntityNotFound(_0x4f7e71){return function(_0x5dca37){if(!_0x5dca37){_0x4f7e71[_0x3e0c('0xe')](0x194);}return _0x5dca37;};}function handleError(_0x2a0b19,_0x13ce3e){_0x13ce3e=_0x13ce3e||0x1f4;return function(_0x2c7540){logger[_0x3e0c('0xf')](_0x2c7540[_0x3e0c('0x10')]);if(_0x2c7540[_0x3e0c('0x11')]){delete _0x2c7540['name'];}_0x2a0b19[_0x3e0c('0xa')](_0x13ce3e)['send'](_0x2c7540);};}exports[_0x3e0c('0xc')]=function(_0x23a6a8,_0x5d0ab7){if(_0x23a6a8[_0x3e0c('0x12')][_0x3e0c('0x13')]!==_0x3e0c('0x14'))throw new Error(_0x3e0c('0x15'));if(isNaN(Number(_0x23a6a8[_0x3e0c('0x16')]['id'])))throw new Error(_0x3e0c('0x17'));return db[_0x3e0c('0x18')][_0x3e0c('0x19')]({'where':{'id':_0x23a6a8[_0x3e0c('0x16')]['id']}})[_0x3e0c('0xd')](handleEntityNotFound(_0x5d0ab7,null))[_0x3e0c('0xd')](saveUpdates(_0x23a6a8[_0x3e0c('0x1a')],null))['then'](respondWithResult(_0x5d0ab7,null))['catch'](handleError(_0x5d0ab7,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 dd2c076..74e65c5 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 _0xc447=['hook','exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0xea1fe8,_0x123813){var _0xe6da33=function(_0x27d1e3){while(--_0x27d1e3){_0xea1fe8['push'](_0xea1fe8['shift']());}};_0xe6da33(++_0x123813);}(_0xc447,0x1b2));var _0x7c44=function(_0x4ba9e9,_0x148eb9){_0x4ba9e9=_0x4ba9e9-0x0;var _0x146d0f=_0xc447[_0x4ba9e9];return _0x146d0f;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x7c44('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x7c44('0x1')](0x0);var events={'afterCreate':_0x7c44('0x2'),'afterUpdate':_0x7c44('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54e0f8){return function(_0x4dedf0,_0x1fb306,_0x506cdf){UserSettingEvents[_0x7c44('0x4')](_0x54e0f8+':'+_0x4dedf0['id'],_0x4dedf0);UserSettingEvents['emit'](_0x54e0f8,_0x4dedf0);_0x506cdf(null);};}for(var e in events){if(events[_0x7c44('0x5')](e)){var event=events[e];UserSetting[_0x7c44('0x6')](e,emitEvent(event));}}module[_0x7c44('0x7')]=UserSettingEvents; \ No newline at end of file +var _0x56c2=['UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x468236,_0x5cf62d){var _0x1c6c7d=function(_0x31e44c){while(--_0x31e44c){_0x468236['push'](_0x468236['shift']());}};_0x1c6c7d(++_0x5cf62d);}(_0x56c2,0xaf));var _0x256c=function(_0xf7dd0f,_0x396c3b){_0xf7dd0f=_0xf7dd0f-0x0;var _0x3fc64b=_0x56c2[_0xf7dd0f];return _0x3fc64b;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x256c('0x0'))['db'][_0x256c('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x256c('0x2')](0x0);var events={'afterCreate':_0x256c('0x3'),'afterUpdate':_0x256c('0x4'),'afterDestroy':_0x256c('0x5')};function emitEvent(_0x53dd11){return function(_0x503c35,_0x560aa9,_0x117fd0){UserSettingEvents[_0x256c('0x6')](_0x53dd11+':'+_0x503c35['id'],_0x503c35);UserSettingEvents[_0x256c('0x6')](_0x53dd11,_0x503c35);_0x117fd0(null);};}for(var e in events){if(events[_0x256c('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 23b4420..8fa32a4 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 _0xd757=['./user-setting.attributes','exports','define','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x5f36f5,_0x645bb3){var _0x3c1c2c=function(_0xb4b4a2){while(--_0xb4b4a2){_0x5f36f5['push'](_0x5f36f5['shift']());}};_0x3c1c2c(++_0x645bb3);}(_0xd757,0x1e5));var _0x7d75=function(_0x216384,_0x5d863e){_0x216384=_0x216384-0x0;var _0x19a108=_0xd757[_0x216384];return _0x19a108;};'use strict';var attributes=require(_0x7d75('0x0'));module[_0x7d75('0x1')]=function(_0xe5c184){return _0xe5c184[_0x7d75('0x2')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x379a63){if(!_0x379a63[_0x7d75('0x3')])_0x379a63['clientSideLoggingEnabledSince']=null;else if(_0x379a63[_0x7d75('0x4')]===null)_0x379a63[_0x7d75('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x6ae2=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting'];(function(_0x14362a,_0x5c23bb){var _0x41d613=function(_0x218aea){while(--_0x218aea){_0x14362a['push'](_0x14362a['shift']());}};_0x41d613(++_0x5c23bb);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x46f3f8,_0x12c74b){_0x46f3f8=_0x46f3f8-0x0;var _0xbc57cd=_0x6ae2[_0x46f3f8];return _0xbc57cd;};'use strict';var attributes=require(_0x26ae('0x0'));module[_0x26ae('0x1')]=function(_0x118942){return _0x118942[_0x26ae('0x2')](_0x26ae('0x3'),attributes,{'tableName':_0x26ae('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xde8ef3){if(!_0xde8ef3[_0x26ae('0x5')])_0xde8ef3[_0x26ae('0x6')]=null;else if(_0xde8ef3['clientSideLoggingEnabledSince']===null)_0xde8ef3[_0x26ae('0x6')]=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 7859757..321d518 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 _0x4012=['UserId','register','length','user-setting:','./user-setting.events','remove','update','emit','user-setting:update','user-setting:update:user-'];(function(_0x5c7d79,_0x26a45b){var _0x2c7e12=function(_0x33298f){while(--_0x33298f){_0x5c7d79['push'](_0x5c7d79['shift']());}};_0x2c7e12(++_0x26a45b);}(_0x4012,0xd6));var _0x2401=function(_0x3ed24f,_0x5c9202){_0x3ed24f=_0x3ed24f-0x0;var _0x3f2e59=_0x4012[_0x3ed24f];return _0x3f2e59;};'use strict';var UserSettingEvents=require(_0x2401('0x0'));var events=['save',_0x2401('0x1'),_0x2401('0x2')];function createListener(_0x56c6cc,_0x362b73){return function(_0x806284){_0x362b73[_0x2401('0x3')](_0x56c6cc,_0x806284);if(_0x56c6cc===_0x2401('0x4')){_0x362b73[_0x2401('0x3')](_0x2401('0x5')+_0x806284[_0x2401('0x6')],_0x806284);}};}exports[_0x2401('0x7')]=function(_0x38123b){for(var _0x85f35f=0x0,_0x184814=events[_0x2401('0x8')];_0x85f35f<_0x184814;_0x85f35f++){var _0x267711=events[_0x85f35f];var _0x1fb21f=createListener(_0x2401('0x9')+_0x267711,_0x38123b);UserSettingEvents['on'](_0x267711,_0x1fb21f);}}; \ No newline at end of file +var _0xb4ab=['user-setting:','./user-setting.events','save','remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register','length'];(function(_0x538c9b,_0x63a54c){var _0x47c4f8=function(_0x1cb253){while(--_0x1cb253){_0x538c9b['push'](_0x538c9b['shift']());}};_0x47c4f8(++_0x63a54c);}(_0xb4ab,0x1da));var _0xbb4a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb4ab[_0x20a584];return _0x4b41a8;};'use strict';var UserSettingEvents=require(_0xbb4a('0x0'));var events=[_0xbb4a('0x1'),_0xbb4a('0x2'),_0xbb4a('0x3')];function createListener(_0xdefbf4,_0x49339c){return function(_0x26130d){_0x49339c[_0xbb4a('0x4')](_0xdefbf4,_0x26130d);if(_0xdefbf4===_0xbb4a('0x5')){_0x49339c[_0xbb4a('0x4')](_0xbb4a('0x6')+_0x26130d[_0xbb4a('0x7')],_0x26130d);}};}exports[_0xbb4a('0x8')]=function(_0x152ca7){for(var _0x3c74e1=0x0,_0x22e948=events[_0xbb4a('0x9')];_0x3c74e1<_0x22e948;_0x3c74e1++){var _0xccbe95=events[_0x3c74e1];var _0x118f58=createListener(_0xbb4a('0xa')+_0xccbe95,_0x152ca7);UserSettingEvents['on'](_0xccbe95,_0x118f58);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 61da088..35d2925 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 _0x7c27=['createApiKey','put','update','changePassword','delete','removeQueues','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeApiKey','/:id/messengerSoundNotification','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','describe','whoami','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getApiKey','post','addContacts','create','/create_many','diskStorage','root','server/files/images/','%s-%s','originalname','single','file','addAvatar','login','/:id/logout','logout','/:id/pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/whatsapp_interactions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key'];(function(_0x356a00,_0x5e00c9){var _0x18946f=function(_0x178ef9){while(--_0x178ef9){_0x356a00['push'](_0x356a00['shift']());}};_0x18946f(++_0x5e00c9);}(_0x7c27,0x14a));var _0x77c2=function(_0x2f1962,_0x5e4663){_0x2f1962=_0x2f1962-0x0;var _0x50ef57=_0x7c27[_0x2f1962];return _0x50ef57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x77c2('0x0'));var timeout=require(_0x77c2('0x1'));var express=require(_0x77c2('0x2'));var router=express[_0x77c2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x77c2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77c2('0x5'));var controller=require(_0x77c2('0x6'));router[_0x77c2('0x7')]('/',auth[_0x77c2('0x8')](),controller['index']);router[_0x77c2('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x77c2('0x9')]);router[_0x77c2('0x7')]('/whoami',auth['isAuthenticated'](),controller[_0x77c2('0xa')]);router[_0x77c2('0x7')]('/presence',auth[_0x77c2('0x8')](),controller['getPresence']);router['get'](_0x77c2('0xb'),auth['isAuthenticated'](),controller[_0x77c2('0xc')]);router['get'](_0x77c2('0xd'),controller['getAvatar']);router[_0x77c2('0x7')](_0x77c2('0xe'),auth['isAuthenticated'](),controller[_0x77c2('0xf')]);router[_0x77c2('0x7')](_0x77c2('0x10'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x11')]);router['get'](_0x77c2('0x12'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x13')]);router['get'](_0x77c2('0x14'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x15')]);router[_0x77c2('0x7')](_0x77c2('0x16'),auth['isAuthenticated'](),controller[_0x77c2('0x17')]);router[_0x77c2('0x7')](_0x77c2('0x18'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x19')]);router['get'](_0x77c2('0x1a'),auth[_0x77c2('0x8')](),controller['getScreenRecordings']);router[_0x77c2('0x7')](_0x77c2('0x1b'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x1c')]);router[_0x77c2('0x7')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x77c2('0x1d')]);router[_0x77c2('0x7')](_0x77c2('0x1e'),auth[_0x77c2('0x8')](),controller['getMailInteractions']);router['get'](_0x77c2('0x1f'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x20')]);router[_0x77c2('0x7')]('/:id/fax/interactions',auth[_0x77c2('0x8')](),controller['getFaxInteractions']);router[_0x77c2('0x7')](_0x77c2('0x21'),auth['isAuthenticated'](),controller[_0x77c2('0x22')]);router['get'](_0x77c2('0x23'),auth[_0x77c2('0x8')](),controller['getTeams']);router['get'](_0x77c2('0x24'),auth['isAuthenticated'](),controller[_0x77c2('0x25')]);router[_0x77c2('0x7')](_0x77c2('0x26'),auth[_0x77c2('0x8')](),controller['getAgents']);router[_0x77c2('0x7')](_0x77c2('0x27'),auth['isAuthenticated'](),controller[_0x77c2('0x28')]);router[_0x77c2('0x7')](_0x77c2('0x29'),auth['isAuthenticated'](),controller[_0x77c2('0x2a')]);router[_0x77c2('0x7')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x77c2('0x2b')]);router[_0x77c2('0x7')](_0x77c2('0x2c'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x2d')]);router['get'](_0x77c2('0x2e'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x2f')]);router['get'](_0x77c2('0x30'),auth[_0x77c2('0x8')](),controller['getChatWebsites']);router['get'](_0x77c2('0x31'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x32')]);router[_0x77c2('0x7')](_0x77c2('0x33'),auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0x77c2('0x7')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x77c2('0x34')]);router[_0x77c2('0x35')](_0x77c2('0x10'),auth['isAuthenticated'](),controller[_0x77c2('0x36')]);router[_0x77c2('0x35')]('/',auth[_0x77c2('0x8')](),controller[_0x77c2('0x37')]);router[_0x77c2('0x35')](_0x77c2('0x38'),auth[_0x77c2('0x8')](),controller['bulkCreate']);router['post'](_0x77c2('0x12'),auth[_0x77c2('0x8')](),controller['addQueues']);var upload=multer({'storage':multer[_0x77c2('0x39')]({'destination':function(_0x448e5f,_0x35788f,_0x29e502){_0x29e502(null,path['join'](config[_0x77c2('0x3a')],_0x77c2('0x3b')));},'filename':function(_0x3f0f42,_0x1afe54,_0x1d7e48){_0x1d7e48(null,util['format'](_0x77c2('0x3c'),Date['now'](),_0x1afe54[_0x77c2('0x3d')]));}})});router['post'](_0x77c2('0xd'),upload[_0x77c2('0x3e')](_0x77c2('0x3f')),controller[_0x77c2('0x40')]);router[_0x77c2('0x35')]('/:id/login',auth[_0x77c2('0x8')](),controller[_0x77c2('0x41')]);router['post'](_0x77c2('0x42'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x43')]);router[_0x77c2('0x35')](_0x77c2('0x44'),auth[_0x77c2('0x8')](),controller['pause']);router['post']('/:id/unpause',auth['isAuthenticated'](),controller[_0x77c2('0x45')]);router[_0x77c2('0x35')]('/:id/teams',auth[_0x77c2('0x8')](),controller[_0x77c2('0x46')]);router['post'](_0x77c2('0x47'),auth['isAuthenticated'](),controller[_0x77c2('0x48')]);router['post'](_0x77c2('0x49'),auth[_0x77c2('0x8')](),controller['addMailInteractions']);router[_0x77c2('0x35')](_0x77c2('0x4a'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x4b')]);router[_0x77c2('0x35')](_0x77c2('0x4c'),auth['isAuthenticated'](),controller['addSmsInteractions']);router['post']('/:id/openchannel_interactions',auth[_0x77c2('0x8')](),controller['addOpenchannelInteractions']);router['post'](_0x77c2('0x4d'),auth[_0x77c2('0x8')](),controller['addWhatsappInteractions']);router[_0x77c2('0x35')](_0x77c2('0x29'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x4e')]);router[_0x77c2('0x35')](_0x77c2('0x4f'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x50')]);router[_0x77c2('0x35')]('/:id/openchannel_accounts',auth[_0x77c2('0x8')](),controller[_0x77c2('0x51')]);router[_0x77c2('0x35')](_0x77c2('0x2e'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x52')]);router[_0x77c2('0x35')](_0x77c2('0x30'),auth['isAuthenticated'](),controller[_0x77c2('0x53')]);router['post'](_0x77c2('0x31'),auth['isAuthenticated'](),controller[_0x77c2('0x54')]);router[_0x77c2('0x35')](_0x77c2('0x55'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x56')]);router[_0x77c2('0x57')](_0x77c2('0xb'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x58')]);router[_0x77c2('0x57')]('/:id/password',auth['isAuthenticated'](),controller[_0x77c2('0x59')]);router[_0x77c2('0x5a')](_0x77c2('0x12'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x5b')]);router[_0x77c2('0x5a')](_0x77c2('0x23'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x77c2('0x5a')](_0x77c2('0xb'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x5c')]);router['delete'](_0x77c2('0x47'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x5d')]);router['delete'](_0x77c2('0x49'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x5e')]);router[_0x77c2('0x5a')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x77c2('0x5f')]);router[_0x77c2('0x5a')](_0x77c2('0x4c'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x60')]);router[_0x77c2('0x5a')](_0x77c2('0x61'),auth[_0x77c2('0x8')](),controller['removeOpenchannelInteractions']);router[_0x77c2('0x5a')](_0x77c2('0x4d'),auth['isAuthenticated'](),controller[_0x77c2('0x62')]);router[_0x77c2('0x5a')](_0x77c2('0x29'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x63')]);router[_0x77c2('0x5a')](_0x77c2('0x4f'),auth[_0x77c2('0x8')](),controller['removeMailAccounts']);router[_0x77c2('0x5a')]('/:id/openchannel_accounts',auth[_0x77c2('0x8')](),controller[_0x77c2('0x64')]);router['delete'](_0x77c2('0x2e'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x65')]);router[_0x77c2('0x5a')](_0x77c2('0x30'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x77c2('0x5a')](_0x77c2('0x31'),auth[_0x77c2('0x8')](),controller['removeWhatsappAccounts']);router['delete'](_0x77c2('0x55'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x66')]);router['post'](_0x77c2('0x67'),auth[_0x77c2('0x8')](),controller['messengerSoundNotification']);module['exports']=router; \ No newline at end of file +var _0xb6f3=['getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','getScheduledCalls','getApiKey','addContacts','post','/create_many','bulkCreate','diskStorage','%s-%s','originalname','file','login','/:id/logout','logout','pause','/:id/unpause','/:id/teams','addTeams','addChatInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','removeQueues','delete','removeTeams','/:id/chat_interactions','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeFaxAccounts','removeSmsAccounts','/:id/api_key','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings'];(function(_0xdd9f41,_0x23cdfa){var _0xa6425c=function(_0xc41dae){while(--_0xc41dae){_0xdd9f41['push'](_0xdd9f41['shift']());}};_0xa6425c(++_0x23cdfa);}(_0xb6f3,0x12a));var _0x3b6f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb6f3[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x3b6f('0x0'));var util=require('util');var path=require(_0x3b6f('0x1'));var timeout=require(_0x3b6f('0x2'));var express=require(_0x3b6f('0x3'));var router=express[_0x3b6f('0x4')]();var fs_extra=require(_0x3b6f('0x5'));var auth=require(_0x3b6f('0x6'));var interaction=require(_0x3b6f('0x7'));var config=require(_0x3b6f('0x8'));var controller=require('./user.controller');router[_0x3b6f('0x9')]('/',auth[_0x3b6f('0xa')](),controller[_0x3b6f('0xb')]);router[_0x3b6f('0x9')](_0x3b6f('0xc'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0xd')]);router[_0x3b6f('0x9')](_0x3b6f('0xe'),auth['isAuthenticated'](),controller[_0x3b6f('0xf')]);router[_0x3b6f('0x9')](_0x3b6f('0x10'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x11')]);router['get'](_0x3b6f('0x12'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x13')]);router[_0x3b6f('0x9')](_0x3b6f('0x14'),controller[_0x3b6f('0x15')]);router[_0x3b6f('0x9')](_0x3b6f('0x16'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x17')]);router['get'](_0x3b6f('0x18'),auth[_0x3b6f('0xa')](),controller['getContacts']);router[_0x3b6f('0x9')](_0x3b6f('0x19'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x1a')]);router[_0x3b6f('0x9')]('/:id/queues_rt',auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x1b')]);router[_0x3b6f('0x9')]('/:id/groups',auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x1c')]);router[_0x3b6f('0x9')](_0x3b6f('0x1d'),auth['isAuthenticated'](),controller[_0x3b6f('0x1e')]);router['get'](_0x3b6f('0x1f'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x20')]);router['get'](_0x3b6f('0x21'),auth['isAuthenticated'](),controller[_0x3b6f('0x22')]);router[_0x3b6f('0x9')](_0x3b6f('0x23'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x24')]);router['get']('/:id/mail/interactions',auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x25')]);router[_0x3b6f('0x9')](_0x3b6f('0x26'),auth[_0x3b6f('0xa')](),controller['getSmsInteractions']);router[_0x3b6f('0x9')](_0x3b6f('0x27'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x28')]);router[_0x3b6f('0x9')](_0x3b6f('0x29'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x2a')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0x3b6f('0x2b')]);router[_0x3b6f('0x9')](_0x3b6f('0x2c'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x2d')]);router[_0x3b6f('0x9')](_0x3b6f('0x2e'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x2f')]);router[_0x3b6f('0x9')](_0x3b6f('0x30'),auth[_0x3b6f('0xa')](),controller['getVoicePrefixes']);router['get'](_0x3b6f('0x31'),auth['isAuthenticated'](),controller[_0x3b6f('0x32')]);router['get'](_0x3b6f('0x33'),auth['isAuthenticated'](),controller[_0x3b6f('0x34')]);router['get'](_0x3b6f('0x35'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x36')]);router[_0x3b6f('0x9')](_0x3b6f('0x37'),auth['isAuthenticated'](),controller[_0x3b6f('0x38')]);router[_0x3b6f('0x9')]('/:id/chat_websites',auth[_0x3b6f('0xa')](),controller['getChatWebsites']);router[_0x3b6f('0x9')](_0x3b6f('0x39'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router['get']('/:id/scheduled_calls',auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x3a')]);router[_0x3b6f('0x9')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x3b6f('0x3b')]);router['post'](_0x3b6f('0x18'),auth['isAuthenticated'](),controller[_0x3b6f('0x3c')]);router[_0x3b6f('0x3d')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3b6f('0x3d')](_0x3b6f('0x3e'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x3f')]);router[_0x3b6f('0x3d')](_0x3b6f('0x19'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x3b6f('0x40')]({'destination':function(_0x302d86,_0xb906ba,_0x5b0084){_0x5b0084(null,path['join'](config['root'],'server/files/images/'));},'filename':function(_0x4f13ab,_0x3effeb,_0x18cebf){_0x18cebf(null,util['format'](_0x3b6f('0x41'),Date['now'](),_0x3effeb[_0x3b6f('0x42')]));}})});router['post'](_0x3b6f('0x14'),upload['single'](_0x3b6f('0x43')),controller['addAvatar']);router[_0x3b6f('0x3d')]('/:id/login',auth['isAuthenticated'](),controller[_0x3b6f('0x44')]);router[_0x3b6f('0x3d')](_0x3b6f('0x45'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x46')]);router[_0x3b6f('0x3d')]('/:id/pause',auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x47')]);router[_0x3b6f('0x3d')](_0x3b6f('0x48'),auth[_0x3b6f('0xa')](),controller['unpause']);router[_0x3b6f('0x3d')](_0x3b6f('0x49'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x4a')]);router['post']('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x3b6f('0x4b')]);router[_0x3b6f('0x3d')]('/:id/mail_interactions',auth[_0x3b6f('0xa')](),controller['addMailInteractions']);router['post'](_0x3b6f('0x4c'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x4d')]);router[_0x3b6f('0x3d')](_0x3b6f('0x4e'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x4f')]);router[_0x3b6f('0x3d')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x3b6f('0x50')]);router[_0x3b6f('0x3d')](_0x3b6f('0x51'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x52')]);router[_0x3b6f('0x3d')]('/:id/fax_accounts',auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x53')]);router[_0x3b6f('0x3d')](_0x3b6f('0x33'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x54')]);router[_0x3b6f('0x3d')](_0x3b6f('0x35'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x55')]);router[_0x3b6f('0x3d')](_0x3b6f('0x37'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x56')]);router[_0x3b6f('0x3d')](_0x3b6f('0x57'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x58')]);router[_0x3b6f('0x3d')](_0x3b6f('0x39'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x59')]);router[_0x3b6f('0x3d')]('/:id/api_key',auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x5a')]);router[_0x3b6f('0x5b')](_0x3b6f('0x12'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x5c')]);router[_0x3b6f('0x5b')](_0x3b6f('0x5d'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x5e')]);router['delete']('/:id/queues',auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x5f')]);router[_0x3b6f('0x60')](_0x3b6f('0x49'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x61')]);router['delete'](_0x3b6f('0x12'),auth['isAuthenticated'](),controller['destroy']);router[_0x3b6f('0x60')](_0x3b6f('0x62'),auth['isAuthenticated'](),controller[_0x3b6f('0x63')]);router[_0x3b6f('0x60')](_0x3b6f('0x64'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x65')]);router['delete'](_0x3b6f('0x4c'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0x3b6f('0x60')](_0x3b6f('0x4e'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x66')]);router[_0x3b6f('0x60')](_0x3b6f('0x67'),auth[_0x3b6f('0xa')](),controller['removeOpenchannelInteractions']);router['delete'](_0x3b6f('0x51'),auth[_0x3b6f('0xa')](),controller['removeWhatsappInteractions']);router['delete'](_0x3b6f('0x31'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x68')]);router[_0x3b6f('0x60')](_0x3b6f('0x33'),auth[_0x3b6f('0xa')](),controller['removeMailAccounts']);router[_0x3b6f('0x60')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x3b6f('0x60')]('/:id/sms_accounts',auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x69')]);router[_0x3b6f('0x60')](_0x3b6f('0x57'),auth[_0x3b6f('0xa')](),controller['removeChatWebsites']);router[_0x3b6f('0x60')](_0x3b6f('0x39'),auth[_0x3b6f('0xa')](),controller['removeWhatsappAccounts']);router[_0x3b6f('0x60')](_0x3b6f('0x6a'),auth[_0x3b6f('0xa')](),controller[_0x3b6f('0x6b')]);router[_0x3b6f('0x3d')](_0x3b6f('0x6c'),auth['isAuthenticated'](),controller[_0x3b6f('0x6d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index c82c442..92af569 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 _0x6dcc=['STRING','callerid','format','getDataValue','internal','ENUM','user','agent','local','INTEGER','accountcode','fullname','BOOLEAN','DATE','dynamic','peer','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','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','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','passive','actpass','update,nonat','TEXT','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','rtcp_mux','dtlsverify','dtlscertfile','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser'];(function(_0x46252a,_0x561222){var _0x1acfc9=function(_0x55a473){while(--_0x55a473){_0x46252a['push'](_0x46252a['shift']());}};_0x1acfc9(++_0x561222);}(_0x6dcc,0xeb));var _0xc6dc=function(_0x2984fb,_0x5c4a5c){_0x2984fb=_0x2984fb-0x0;var _0x44f03c=_0x6dcc[_0x2984fb];return _0x44f03c;};'use strict';var Sequelize=require(_0xc6dc('0x0'));var moment=require(_0xc6dc('0x1'));var util=require(_0xc6dc('0x2'));var _=require(_0xc6dc('0x3'));module[_0xc6dc('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc6dc('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xcf1a91){this[_0xc6dc('0x6')](_0xc6dc('0x5'),_0xcf1a91);this['setDataValue'](_0xc6dc('0x7'),_0xcf1a91);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':![],'set':function(_0x5dd920){this[_0xc6dc('0x6')]('fullname',_0x5dd920);this[_0xc6dc('0x6')](_0xc6dc('0x9'),util[_0xc6dc('0xa')]('\x22%s\x22\x20<%s>',_0x5dd920,this[_0xc6dc('0xb')](_0xc6dc('0xc'))));}},'alias':{'type':Sequelize[_0xc6dc('0x8')]},'email':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0xd2ce11){if(_0xd2ce11){this[_0xc6dc('0x6')]('email',_0xd2ce11['toLowerCase']());}}},'role':{'type':Sequelize[_0xc6dc('0xd')]('admin',_0xc6dc('0xe'),_0xc6dc('0xf'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xc6dc('0x8')],'defaultValue':_0xc6dc('0x10')},'internal':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':![],'unique':_0xc6dc('0xc'),'set':function(_0x821982){this['setDataValue'](_0xc6dc('0xc'),_0x821982);this[_0xc6dc('0x6')](_0xc6dc('0x12'),_0x821982);this[_0xc6dc('0x6')]('callerid',util[_0xc6dc('0xa')]('\x22%s\x22\x20<%s>',this[_0xc6dc('0xb')](_0xc6dc('0x13')),_0x821982));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xc6dc('0x8')]},'zipcode':{'type':Sequelize[_0xc6dc('0x8')]},'userpic':{'type':Sequelize[_0xc6dc('0x8')]},'city':{'type':Sequelize[_0xc6dc('0x8')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xc6dc('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xc6dc('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc6dc('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc6dc('0x16')},'ipaddr':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'port':{'type':Sequelize[_0xc6dc('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0xc6dc('0xe'),_0xc6dc('0x17')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xc6dc('0xd')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0xc6dc('0x18'),'ALLOWED',_0xc6dc('0x19'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0xc6dc('0x1a')),'allowNull':!![]},'deny':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'permit':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'secret':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![],'defaultValue':'udp','set':function(_0x1bfbfb){this[_0xc6dc('0x6')](_0xc6dc('0x1b'),_0x1bfbfb?_0x1bfbfb[_0xc6dc('0x1c')](','):null);},'get':function(){return this[_0xc6dc('0xb')](_0xc6dc('0x1b'))?this[_0xc6dc('0xb')]('transport')[_0xc6dc('0x1d')](','):null;},'comment':_0xc6dc('0x1e')},'dtmfmode':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x1f'),'info',_0xc6dc('0x20'),'inband',_0xc6dc('0x21')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no','nonat',_0xc6dc('0x23'),_0xc6dc('0x24')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'nat':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![],'defaultValue':_0xc6dc('0x25'),'set':function(_0x518d1f){this['setDataValue'](_0xc6dc('0x26'),_0x518d1f?_0x518d1f[_0xc6dc('0x1c')](','):null);},'get':function(){return this[_0xc6dc('0xb')]('nat')?this[_0xc6dc('0xb')]('nat')[_0xc6dc('0x1d')](','):null;},'comment':_0xc6dc('0x27')},'callgroup':{'type':Sequelize[_0xc6dc('0x8')]},'namedcallgroup':{'type':Sequelize[_0xc6dc('0x8')]},'pickupgroup':{'type':Sequelize[_0xc6dc('0x8')]},'namedpickupgroup':{'type':Sequelize[_0xc6dc('0x8')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc6dc('0x8')]},'disallow':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':![],'defaultValue':_0xc6dc('0x28')},'allow':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':![],'defaultValue':_0xc6dc('0x29'),'set':function(_0x257078){this[_0xc6dc('0x6')](_0xc6dc('0x2a'),_0x257078?_0x257078[_0xc6dc('0x1c')](';'):_0xc6dc('0x29'));},'get':function(){return this[_0xc6dc('0xb')]('allow')?this['getDataValue']('allow')[_0xc6dc('0x1d')](';'):null;},'comment':_0xc6dc('0x2b')},'autoframing':{'type':Sequelize['ENUM'](_0xc6dc('0x22'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![],'set':function(_0x4cfeb6){this['setDataValue'](_0xc6dc('0x2c'),_0x4cfeb6?_0x4cfeb6['join'](','):null);},'get':function(){return this['getDataValue'](_0xc6dc('0x2c'))?this[_0xc6dc('0xb')](_0xc6dc('0x2c'))[_0xc6dc('0x1d')](','):null;},'comment':_0xc6dc('0x2d')},'trustrpid':{'type':Sequelize['ENUM'](_0xc6dc('0x22'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc6dc('0xd')]('yes','no',_0xc6dc('0x2e')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![],'defaultValue':_0xc6dc('0x2f')},'amaflags':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xc6dc('0x22'),'no'),'allowNull':!![],'defaultValue':_0xc6dc('0x22')},'busylevel':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xc6dc('0x22'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc6dc('0xd')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xc6dc('0x22'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'template':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no',_0xc6dc('0x30')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xc6dc('0x22'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x31'),_0xc6dc('0x32'),_0xc6dc('0x33')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc6dc('0xd')]('uac',_0xc6dc('0x34')),'allowNull':!![],'defaultValue':_0xc6dc('0x34')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xc6dc('0x22'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xc6dc('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc6dc('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc6dc('0xd')]('yes','no',_0xc6dc('0x35'),_0xc6dc('0x36')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc6dc('0xd')]('active',_0xc6dc('0x37'),_0xc6dc('0x38')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xc6dc('0xd')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc6dc('0xd')]('yes','no','nonat',_0xc6dc('0x23'),_0xc6dc('0x39')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc6dc('0x8')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xc6dc('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc6dc('0x3a')]},'showWebBar':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0,'set':function(_0x21d22c){this[_0xc6dc('0x6')]('showWebBar',_0x21d22c);var _0x38bf05=this[_0xc6dc('0x3b')]({'plain':!![]});switch(_0x21d22c){case 0x0:case 0x1:var _0x1d6da7=_0x38bf05['transport']?_[_0xc6dc('0x3c')](_0x38bf05[_0xc6dc('0x1b')])?_0x38bf05['transport'][_0xc6dc('0x1c')]():_0x38bf05['transport']:'udp';if(_0x1d6da7===_0xc6dc('0x3d')){_0x1d6da7=_0xc6dc('0x3e');}this['setDataValue'](_0xc6dc('0x1b'),_0x1d6da7);this['setDataValue'](_0xc6dc('0x3f'),'no');this[_0xc6dc('0x6')](_0xc6dc('0x40'),null);this[_0xc6dc('0x6')](_0xc6dc('0x41'),null);this[_0xc6dc('0x6')](_0xc6dc('0x42'),null);this['setDataValue'](_0xc6dc('0x43'),null);this[_0xc6dc('0x6')]('dtlsverify',null);this[_0xc6dc('0x6')]('dtlssetup',null);this[_0xc6dc('0x6')]('dtlscertfile',null);this[_0xc6dc('0x6')]('dtlsprivatekey',null);this[_0xc6dc('0x6')](_0xc6dc('0x44'),'no');break;case 0x2:this[_0xc6dc('0x6')](_0xc6dc('0x1b'),_0xc6dc('0x3d'));this[_0xc6dc('0x6')]('encryption',_0xc6dc('0x22'));this[_0xc6dc('0x6')](_0xc6dc('0x40'),'yes');this[_0xc6dc('0x6')]('force_avp',_0xc6dc('0x22'));this[_0xc6dc('0x6')](_0xc6dc('0x42'),_0xc6dc('0x22'));this[_0xc6dc('0x6')]('dtlsenable','yes');this['setDataValue'](_0xc6dc('0x45'),'no');this[_0xc6dc('0x6')]('dtlssetup',_0xc6dc('0x38'));this[_0xc6dc('0x6')](_0xc6dc('0x46'),_0x38bf05[_0xc6dc('0x46')]||'/etc/pki/tls/certs/motion.crt');this[_0xc6dc('0x6')](_0xc6dc('0x47'),_0x38bf05[_0xc6dc('0x47')]||'/etc/pki/tls/private/motion.key');this[_0xc6dc('0x6')](_0xc6dc('0x44'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xc6dc('0x3a')],'set':function(_0x433f53){this['setDataValue'](_0xc6dc('0x48'),_0x433f53?_0x433f53[_0xc6dc('0x1c')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_[_0xc6dc('0x49')](this[_0xc6dc('0xb')](_0xc6dc('0x48'))[_0xc6dc('0x1d')](','),function(_0xe7ca8d){return parseInt(_0xe7ca8d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc6dc('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xc6dc('0x8')]},'phoneBarUnconditional':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc6dc('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xc6dc('0x8')]},'phoneBarEnableJaws':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc6dc('0x4a')],'get':function(){return this['getDataValue'](_0xc6dc('0x4b'))?this[_0xc6dc('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0xc6dc('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![],'set':function(_0xc8c036){if(typeof _0xc8c036===_0xc6dc('0x4c')){var _0x45586e=_0xc8c036==='1'?!![]:_0xc8c036==='0'?![]:_0xc8c036===_0xc6dc('0x4d')?!![]:_0xc8c036==='false'?![]:![];this[_0xc6dc('0x6')]('screenrecording',_0x45586e);}else{this['setDataValue']('screenrecording',_0xc8c036);}}},'blocked':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![],'set':function(_0x5a0536){this['setDataValue']('blocked',_0x5a0536);if(_0x5a0536===!![]){this[_0xc6dc('0x6')](_0xc6dc('0x4e'),moment());this[_0xc6dc('0x6')](_0xc6dc('0x4f'),0x0);}else{this[_0xc6dc('0x6')](_0xc6dc('0x4e'),null);}}},'blockedAt':{'type':Sequelize[_0xc6dc('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xc6dc('0x11')](0x5)[_0xc6dc('0x50')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]}}; \ No newline at end of file +var _0x2c3b=['ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','always','accept','refuse','uas','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','get','isArray','wss','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','rtcp_mux','encryption','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','exports','STRING','name','setDataValue','fullname','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','agent','telephone','local','INTEGER','internal','callerid','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','ENUM','friend','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','split','info','inband','auto','rfc2833','nonat','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all'];(function(_0x38d08c,_0x5bb814){var _0x2a93c4=function(_0x144db7){while(--_0x144db7){_0x38d08c['push'](_0x38d08c['shift']());}};_0x2a93c4(++_0x5bb814);}(_0x2c3b,0x85));var _0xb2c3=function(_0x13a0d6,_0x9a1972){_0x13a0d6=_0x13a0d6-0x0;var _0x241df1=_0x2c3b[_0x13a0d6];return _0x241df1;};'use strict';var Sequelize=require(_0xb2c3('0x0'));var moment=require(_0xb2c3('0x1'));var util=require(_0xb2c3('0x2'));var _=require('lodash');module[_0xb2c3('0x3')]={'name':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x42818e){this['setDataValue'](_0xb2c3('0x5'),_0x42818e);this[_0xb2c3('0x6')]('defaultuser',_0x42818e);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x27d743){this['setDataValue'](_0xb2c3('0x7'),_0x27d743);this['setDataValue']('callerid',util[_0xb2c3('0x8')](_0xb2c3('0x9'),_0x27d743,this[_0xb2c3('0xa')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb2c3('0xb'),'validate':{'isEmail':!![]},'set':function(_0x384333){if(_0x384333){this[_0xb2c3('0x6')](_0xb2c3('0xb'),_0x384333['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0xb2c3('0xc'),_0xb2c3('0xd'),_0xb2c3('0xe'),_0xb2c3('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xb2c3('0x4')],'defaultValue':_0xb2c3('0x10')},'internal':{'type':Sequelize[_0xb2c3('0x11')](0xb),'allowNull':![],'unique':_0xb2c3('0x12'),'set':function(_0x4579fe){this[_0xb2c3('0x6')](_0xb2c3('0x12'),_0x4579fe);this[_0xb2c3('0x6')]('accountcode',_0x4579fe);this['setDataValue'](_0xb2c3('0x13'),util[_0xb2c3('0x8')]('\x22%s\x22\x20<%s>',this[_0xb2c3('0xa')](_0xb2c3('0x7')),_0x4579fe));}},'salt':{'type':Sequelize[_0xb2c3('0x4')]},'phone':{'type':Sequelize[_0xb2c3('0x4')]},'mobile':{'type':Sequelize[_0xb2c3('0x4')]},'address':{'type':Sequelize[_0xb2c3('0x4')]},'zipcode':{'type':Sequelize[_0xb2c3('0x4')]},'userpic':{'type':Sequelize[_0xb2c3('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xb2c3('0x15')]},'voicePause':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xb2c3('0x4')],'defaultValue':_0xb2c3('0x16')},'lastPauseAt':{'type':Sequelize[_0xb2c3('0x15')]},'chatCapacity':{'type':Sequelize[_0xb2c3('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xb2c3('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xb2c3('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xb2c3('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xb2c3('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xb2c3('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xb2c3('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xb2c3('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb2c3('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![],'defaultValue':_0xb2c3('0x17')},'ipaddr':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0xb2c3('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xb2c3('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xb2c3('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x19'),_0xb2c3('0xd'),'peer'),'allowNull':!![],'defaultValue':_0xb2c3('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x1a'),'ALLOWED_PASSED_SCREEN',_0xb2c3('0x1b'),_0xb2c3('0x1c'),_0xb2c3('0x1d'),_0xb2c3('0x1e'),_0xb2c3('0x1f'),_0xb2c3('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![],'defaultValue':_0xb2c3('0x21'),'set':function(_0x558543){this[_0xb2c3('0x6')]('transport',_0x558543?_0x558543[_0xb2c3('0x22')](','):null);},'get':function(){return this[_0xb2c3('0xa')](_0xb2c3('0x23'))?this[_0xb2c3('0xa')](_0xb2c3('0x23'))[_0xb2c3('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xb2c3('0x18')]('rfc2833',_0xb2c3('0x25'),'shortinfo',_0xb2c3('0x26'),_0xb2c3('0x27')),'allowNull':!![],'defaultValue':_0xb2c3('0x28')},'directmedia':{'type':Sequelize[_0xb2c3('0x18')]('yes','no',_0xb2c3('0x29'),_0xb2c3('0x2a'),_0xb2c3('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xb2c3('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![],'defaultValue':_0xb2c3('0x2d'),'set':function(_0x291d6){this[_0xb2c3('0x6')](_0xb2c3('0x2e'),_0x291d6?_0x291d6[_0xb2c3('0x22')](','):null);},'get':function(){return this['getDataValue'](_0xb2c3('0x2e'))?this[_0xb2c3('0xa')](_0xb2c3('0x2e'))[_0xb2c3('0x24')](','):null;},'comment':_0xb2c3('0x2f')},'callgroup':{'type':Sequelize[_0xb2c3('0x4')]},'namedcallgroup':{'type':Sequelize[_0xb2c3('0x4')]},'pickupgroup':{'type':Sequelize[_0xb2c3('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xb2c3('0x4')]},'language':{'type':Sequelize[_0xb2c3('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb2c3('0x4')]},'disallow':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':![],'defaultValue':_0xb2c3('0x30')},'allow':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':![],'defaultValue':_0xb2c3('0x31'),'set':function(_0x4104ee){this[_0xb2c3('0x6')](_0xb2c3('0x32'),_0x4104ee?_0x4104ee[_0xb2c3('0x22')](';'):_0xb2c3('0x31'));},'get':function(){return this[_0xb2c3('0xa')](_0xb2c3('0x32'))?this['getDataValue'](_0xb2c3('0x32'))[_0xb2c3('0x24')](';'):null;},'comment':_0xb2c3('0x33')},'autoframing':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![],'set':function(_0xe6cdaf){this['setDataValue'](_0xb2c3('0x34'),_0xe6cdaf?_0xe6cdaf['join'](','):null);},'get':function(){return this[_0xb2c3('0xa')](_0xb2c3('0x34'))?this[_0xb2c3('0xa')](_0xb2c3('0x34'))[_0xb2c3('0x24')](','):null;},'comment':_0xb2c3('0x35')},'trustrpid':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xb2c3('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xb2c3('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xb2c3('0x2c')},'busylevel':{'type':Sequelize[_0xb2c3('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xb2c3('0x18')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xb2c3('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no',_0xb2c3('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x37'),_0xb2c3('0x38'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb2c3('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xb2c3('0x18')]('uac','uas'),'allowNull':!![],'defaultValue':_0xb2c3('0x39')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xb2c3('0x2c')},'keepalive':{'type':Sequelize[_0xb2c3('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xb2c3('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb2c3('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb2c3('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xb2c3('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xb2c3('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xb2c3('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xb2c3('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no',_0xb2c3('0x3a'),_0xb2c3('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xb2c3('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x3c'),_0xb2c3('0x3d'),_0xb2c3('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xb2c3('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xb2c3('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xb2c3('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xb2c3('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xb2c3('0x18')](_0xb2c3('0x2c'),'no','nonat','update',_0xb2c3('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xb2c3('0x15')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xb2c3('0x40')]},'showWebBar':{'type':Sequelize[_0xb2c3('0x11')],'defaultValue':0x0,'set':function(_0x3d0006){this[_0xb2c3('0x6')]('showWebBar',_0x3d0006);var _0x39fec2=this[_0xb2c3('0x41')]({'plain':!![]});switch(_0x3d0006){case 0x0:case 0x1:var _0x5381b5=_0x39fec2[_0xb2c3('0x23')]?_[_0xb2c3('0x42')](_0x39fec2[_0xb2c3('0x23')])?_0x39fec2[_0xb2c3('0x23')][_0xb2c3('0x22')]():_0x39fec2[_0xb2c3('0x23')]:'udp';if(_0x5381b5===_0xb2c3('0x43')){_0x5381b5=_0xb2c3('0x21');}this[_0xb2c3('0x6')](_0xb2c3('0x23'),_0x5381b5);this['setDataValue']('encryption','no');this[_0xb2c3('0x6')](_0xb2c3('0x44'),null);this['setDataValue'](_0xb2c3('0x45'),null);this['setDataValue'](_0xb2c3('0x46'),null);this[_0xb2c3('0x6')](_0xb2c3('0x47'),null);this['setDataValue'](_0xb2c3('0x48'),null);this['setDataValue'](_0xb2c3('0x49'),null);this[_0xb2c3('0x6')]('dtlscertfile',null);this[_0xb2c3('0x6')]('dtlsprivatekey',null);this[_0xb2c3('0x6')](_0xb2c3('0x4a'),'no');break;case 0x2:this[_0xb2c3('0x6')]('transport',_0xb2c3('0x43'));this[_0xb2c3('0x6')](_0xb2c3('0x4b'),_0xb2c3('0x2c'));this[_0xb2c3('0x6')](_0xb2c3('0x44'),_0xb2c3('0x2c'));this[_0xb2c3('0x6')]('force_avp',_0xb2c3('0x2c'));this[_0xb2c3('0x6')](_0xb2c3('0x46'),_0xb2c3('0x2c'));this[_0xb2c3('0x6')]('dtlsenable','yes');this[_0xb2c3('0x6')](_0xb2c3('0x48'),'no');this[_0xb2c3('0x6')](_0xb2c3('0x49'),_0xb2c3('0x3e'));this[_0xb2c3('0x6')](_0xb2c3('0x4c'),_0x39fec2['dtlscertfile']||_0xb2c3('0x4d'));this['setDataValue']('dtlsprivatekey',_0x39fec2[_0xb2c3('0x4e')]||_0xb2c3('0x4f'));this[_0xb2c3('0x6')]('rtcp_mux',_0xb2c3('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0xb2c3('0x40')],'set':function(_0x5255cd){this['setDataValue'](_0xb2c3('0x50'),_0x5255cd?_0x5255cd[_0xb2c3('0x22')](','):[]);},'get':function(){return this[_0xb2c3('0xa')]('permissions')?_[_0xb2c3('0x51')](this[_0xb2c3('0xa')](_0xb2c3('0x50'))[_0xb2c3('0x24')](','),function(_0x5aa695){return parseInt(_0x5aa695,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xb2c3('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xb2c3('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xb2c3('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xb2c3('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xb2c3('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xb2c3('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xb2c3('0x52')],'get':function(){return this[_0xb2c3('0xa')](_0xb2c3('0x53'))?this['getDataValue']('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0xb2c3('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x5b2128){if(typeof _0x5b2128==='string'){var _0x2a677c=_0x5b2128==='1'?!![]:_0x5b2128==='0'?![]:_0x5b2128===_0xb2c3('0x54')?!![]:_0x5b2128===_0xb2c3('0x55')?![]:![];this[_0xb2c3('0x6')](_0xb2c3('0x56'),_0x2a677c);}else{this['setDataValue'](_0xb2c3('0x56'),_0x5b2128);}}},'blocked':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![],'set':function(_0x327ce9){this['setDataValue'](_0xb2c3('0x57'),_0x327ce9);if(_0x327ce9===!![]){this['setDataValue'](_0xb2c3('0x58'),moment());this[_0xb2c3('0x6')](_0xb2c3('0x59'),0x0);}else{this['setDataValue'](_0xb2c3('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0xb2c3('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xb2c3('0x11')](0x5)[_0xb2c3('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xb2c3('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xb2c3('0x11')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xb2c3('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xb2c3('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xb2c3('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xb2c3('0x11')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 06d4661..d7b6dd1 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 _0xccd4=['params','merge','chat','whatsapp','mail','catch','update','body','describe','addContacts','ids','Setting','securePassword','validatePasswordPattern','password','max','isNil','min_internal','internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','length','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','110','105','108','109','100','111','114','115','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Agents','autoAssociation','error','bulkCreate','some','map','findAll','isEmpty','compact','UserProfileResource','oldPassword','Sequelize','ValidationError','authenticate','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','spread','QueueId','VoiceQueue','voice','format','interface','penalty','UserVoiceQueueRt','removeQueues','remove','isArray','Queue:remove','addAvatar','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','userpic','download','join','server/files/images/','getOpenTabs','sms','ChatOpenTabs','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','CmList','List','color','tag','model','keys','Queue','filters','intersection','fields','sort','pick','Unknown\x20role','hasOwnProperty','nolimit','getVoiceQueuesRt','order','options','getGroups','ChatGroup','VoiceRecording','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','headers','x-forwarded-for','connection','remoteAddress','UserVoiceQueue.penalty','upsert','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','removeAgent','UserVoicePrefix','VoicePrefixId','getLists','getAgents','getVoiceQueues','get','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','user_has_chat_interactions:save','removeChatInteractions','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','VoicePrefix','getVoicePrefixes','getFaxAccounts','addFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','concat','$or','$gte','$lt','$ne','$eq','$not','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','firstName','CmContact','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','nonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','ringing','inbound','flatten','lower','col','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','charAt','slice','select','ui.','InteractionId','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','enabled','moment','path','squel','../../components/auth/service','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','defaults','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','agent','emit','userNotification:recalc:','destroy','role','Users','user','Telephones','telephone','filter','ignore','value','includes','find','stack','name','send','User','rawAttributes','fieldName','type','key','previousPasswords','resetPasswordToken','resetPasswordExpires','index','getOptions','where','query','includeAll','include','userSetting','true','UserSetting','attributes','push','rows','openTabs','dataValues','fax','openchannel','all','show'];(function(_0x4ea5d2,_0x31d8cd){var _0xffe9e1=function(_0x5baeac){while(--_0x5baeac){_0x4ea5d2['push'](_0x4ea5d2['shift']());}};_0xffe9e1(++_0x31d8cd);}(_0xccd4,0x137));var _0x4ccd=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xccd4[_0xf71120];return _0xbe2fd3;};'use strict';var moment=require(_0x4ccd('0x0'));var util=require('util');var path=require(_0x4ccd('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4ccd('0x2'));var Redis=require('ioredis');var authService=require(_0x4ccd('0x3'));var contacts=require('../../components/contacts');var qs=require(_0x4ccd('0x4'));var rta=require(_0x4ccd('0x5'));var logger=require(_0x4ccd('0x6'))(_0x4ccd('0x7'));var utils=require('../../config/utils');var config=require(_0x4ccd('0x8'));var licenseUtil=require(_0x4ccd('0x9'));var APIBadRequestError=require(_0x4ccd('0xa'))[_0x4ccd('0xb')];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIHandleError=require(_0x4ccd('0xa'))[_0x4ccd('0xc')];var db=require(_0x4ccd('0xd'))['db'];var socket=require(_0x4ccd('0xe'))(new Redis(config[_0x4ccd('0xf')]));require(_0x4ccd('0x10'))['register'](socket);config[_0x4ccd('0xf')]=_[_0x4ccd('0x11')](config[_0x4ccd('0xf')],{'host':_0x4ccd('0x12'),'port':0x18eb});var values;function respondWithStatusCode(_0x50931c,_0x3665e4){_0x3665e4=_0x3665e4||0xcc;return function(_0x1fdf6d){if(_0x1fdf6d){return _0x50931c[_0x4ccd('0x13')](_0x3665e4);}return _0x50931c[_0x4ccd('0x14')](_0x3665e4)[_0x4ccd('0x15')]();};}function respondWithResult(_0x507c44,_0x569170){_0x569170=_0x569170||0xc8;return function(_0x4a8c5c){if(_0x4a8c5c){return _0x507c44[_0x4ccd('0x14')](_0x569170)[_0x4ccd('0x16')](_0x4a8c5c);}};}function respondWithFilteredResult(_0x5d3128,_0x8e8c30){return function(_0x1e466f){if(_0x1e466f){var _0x4a3c6d=typeof _0x8e8c30[_0x4ccd('0x17')]===_0x4ccd('0x18')&&typeof _0x8e8c30[_0x4ccd('0x19')]==='undefined';var _0x2f6b45=_0x1e466f[_0x4ccd('0x1a')];var _0x199919=_0x4a3c6d?0x0:_0x8e8c30[_0x4ccd('0x17')];var _0x1315bd=_0x4a3c6d?_0x1e466f[_0x4ccd('0x1a')]:_0x8e8c30[_0x4ccd('0x17')]+_0x8e8c30[_0x4ccd('0x19')];var _0x32c715;if(_0x1315bd>=_0x2f6b45){_0x1315bd=_0x2f6b45;_0x32c715=0xc8;}else{_0x32c715=0xce;}_0x5d3128['status'](_0x32c715);return _0x5d3128[_0x4ccd('0x1b')](_0x4ccd('0x1c'),_0x199919+'-'+_0x1315bd+'/'+_0x2f6b45)[_0x4ccd('0x16')](_0x1e466f);}return null;};}function saveUpdates(_0x3dbf7e){return function(_0x4bfabb){if(_0x4bfabb){return _0x4bfabb['update'](_0x3dbf7e)[_0x4ccd('0x1d')](function(_0x300024){if(_0x300024['role']===_0x4ccd('0x1e')){socket[_0x4ccd('0x1f')](_0x4ccd('0x20')+_0x300024['id'],_0x300024);}return _0x300024;});}return null;};}function removeEntity(_0x17da11){return function(_0x52addd){if(_0x52addd){return _0x52addd[_0x4ccd('0x21')]()[_0x4ccd('0x1d')](function(){var _0x152828=_0x52addd['get']({'plain':!![]});if(_0x152828[_0x4ccd('0x22')]==='admin')return;var _0x1b6097=[{'name':_0x4ccd('0x23'),'value':_0x4ccd('0x24'),'ignore':!![]},{'name':'Agents','value':_0x4ccd('0x1e'),'ignore':![]},{'name':_0x4ccd('0x25'),'value':_0x4ccd('0x26'),'ignore':![]}];var _0xd1b386=_(_0x1b6097)[_0x4ccd('0x27')](_0x4ccd('0x28'))['map'](_0x4ccd('0x29'))[_0x4ccd('0x29')]();if(_[_0x4ccd('0x2a')](_0xd1b386,_0x152828['role'])){return;}var _0x28c57a=_[_0x4ccd('0x2b')](_0x1b6097,[_0x4ccd('0x29'),_0x152828[_0x4ccd('0x22')]])['name'];return db['UserProfileResource'][_0x4ccd('0x21')]({'where':{'type':_0x28c57a,'resourceId':_0x152828['id']}})[_0x4ccd('0x1d')](function(){return _0x52addd;});})[_0x4ccd('0x1d')](function(){_0x17da11[_0x4ccd('0x14')](0xcc)[_0x4ccd('0x15')]();});}};}function handleEntityNotFound(_0x16a04f){return function(_0x29311f){if(!_0x29311f){_0x16a04f[_0x4ccd('0x13')](0x194);}return _0x29311f;};}function handleError(_0x3173ea,_0x399eb5){_0x399eb5=_0x399eb5||0x1f4;return function(_0x254553){logger['error'](_0x254553[_0x4ccd('0x2c')]);if(_0x254553[_0x4ccd('0x2d')]){delete _0x254553[_0x4ccd('0x2d')];}_0x3173ea[_0x4ccd('0x14')](_0x399eb5)[_0x4ccd('0x2e')](_0x254553);};}function getUserAttributes(){return _(db[_0x4ccd('0x2f')][_0x4ccd('0x30')])['map'](function(_0x488b68){return{'name':_0x488b68[_0x4ccd('0x31')],'type':_0x488b68[_0x4ccd('0x32')][_0x4ccd('0x33')]};})[_0x4ccd('0x27')](function(_0x270972){return!['password','salt',_0x4ccd('0x34'),_0x4ccd('0x35'),_0x4ccd('0x36'),'md5secret']['includes'](_0x270972[_0x4ccd('0x2d')]);})[_0x4ccd('0x29')]();}exports[_0x4ccd('0x37')]=function(_0x5d10f6,_0x581d9d){var _0xdfb745={},_0x3ccc78={'count':0x0,'rows':[]};var _0x4e52ce=getUserAttributes();_0xdfb745=qs[_0x4ccd('0x38')](_0x4e52ce,_0x5d10f6);var _0x312736={'where':_0xdfb745[_0x4ccd('0x39')]};return db[_0x4ccd('0x2f')][_0x4ccd('0x1a')](_0x312736)[_0x4ccd('0x1d')](function(_0x308124){_0x3ccc78[_0x4ccd('0x1a')]=_0x308124;if(_0x5d10f6[_0x4ccd('0x3a')][_0x4ccd('0x3b')]){_0xdfb745[_0x4ccd('0x3c')]=[{'all':!![]}];}if(_0x5d10f6[_0x4ccd('0x3a')][_0x4ccd('0x3d')]===_0x4ccd('0x3e')){_0xdfb745[_0x4ccd('0x3c')]=[{'model':db[_0x4ccd('0x3f')],'as':_0x4ccd('0x3d')}];}if(!_[_0x4ccd('0x2a')](_0xdfb745['attributes'],'id')){_0xdfb745[_0x4ccd('0x40')][_0x4ccd('0x41')]('id');}return db[_0x4ccd('0x2f')]['findAll'](_0xdfb745);})[_0x4ccd('0x1d')](function(_0x4362e8){_0x3ccc78[_0x4ccd('0x42')]=_0x4362e8;if(_0x5d10f6[_0x4ccd('0x3a')][_0x4ccd('0x43')]===_0x4ccd('0x3e')){var _0x23bd55=[];for(var _0x528081=0x0;_0x528081<_0x3ccc78[_0x4ccd('0x42')]['length'];_0x528081++){_0x23bd55[_0x4ccd('0x41')](get_open_tabs('chat',_0x3ccc78['rows'][_0x528081][_0x4ccd('0x44')]));_0x23bd55[_0x4ccd('0x41')](get_open_tabs('sms',_0x3ccc78['rows'][_0x528081]['dataValues']));_0x23bd55['push'](get_open_tabs(_0x4ccd('0x45'),_0x3ccc78[_0x4ccd('0x42')][_0x528081]['dataValues']));_0x23bd55[_0x4ccd('0x41')](get_open_tabs('mail',_0x3ccc78[_0x4ccd('0x42')][_0x528081]['dataValues']));_0x23bd55[_0x4ccd('0x41')](get_open_tabs(_0x4ccd('0x46'),_0x3ccc78[_0x4ccd('0x42')][_0x528081]['dataValues']));_0x23bd55[_0x4ccd('0x41')](get_open_tabs('whatsapp',_0x3ccc78[_0x4ccd('0x42')][_0x528081][_0x4ccd('0x44')]));}return Promise[_0x4ccd('0x47')](_0x23bd55)[_0x4ccd('0x1d')](function(){return _0x3ccc78;});}else{return _0x3ccc78;}})[_0x4ccd('0x1d')](respondWithFilteredResult(_0x581d9d,_0xdfb745))['catch'](handleError(_0x581d9d,null));};exports[_0x4ccd('0x48')]=function(_0x43c396,_0x1cadd3){var _0x18ca34=getUserAttributes();_0x43c396[_0x4ccd('0x3a')]['id']=_0x43c396[_0x4ccd('0x49')]['id'];var _0x5dc5e8=qs[_0x4ccd('0x38')](_0x18ca34,_0x43c396);if(_0x43c396[_0x4ccd('0x3a')][_0x4ccd('0x3b')]){_0x5dc5e8[_0x4ccd('0x3c')]=[{'all':!![]}];}if(_0x43c396[_0x4ccd('0x3a')][_0x4ccd('0x3d')]===_0x4ccd('0x3e')){_0x5dc5e8['include']=[{'model':db[_0x4ccd('0x3f')],'as':_0x4ccd('0x3d')}];}_0x5dc5e8=_[_0x4ccd('0x4a')]({},_0x5dc5e8,_0x43c396['options']);if(!_[_0x4ccd('0x2a')](_0x5dc5e8[_0x4ccd('0x40')],'id')){_0x5dc5e8[_0x4ccd('0x40')][_0x4ccd('0x41')]('id');}return db['User'][_0x4ccd('0x2b')](_0x5dc5e8)[_0x4ccd('0x1d')](handleEntityNotFound(_0x1cadd3,null))['then'](function(_0x5e4e92){var _0x2cb0b2=[];values=_0x5e4e92;if(_0x43c396[_0x4ccd('0x3a')][_0x4ccd('0x43')]==='true'){_0x2cb0b2[_0x4ccd('0x41')](get_open_tabs(_0x4ccd('0x4b'),_0x5e4e92['dataValues']));_0x2cb0b2[_0x4ccd('0x41')](get_open_tabs('sms',_0x5e4e92['dataValues']));_0x2cb0b2['push'](get_open_tabs(_0x4ccd('0x46'),_0x5e4e92[_0x4ccd('0x44')]));_0x2cb0b2[_0x4ccd('0x41')](get_open_tabs(_0x4ccd('0x4c'),_0x5e4e92['dataValues']));_0x2cb0b2['push'](get_open_tabs(_0x4ccd('0x45'),_0x5e4e92[_0x4ccd('0x44')]));_0x2cb0b2['push'](get_open_tabs(_0x4ccd('0x4d'),_0x5e4e92[_0x4ccd('0x44')]));return Promise[_0x4ccd('0x47')](_0x2cb0b2);}else{return values;}})['then'](function(){return values;})[_0x4ccd('0x1d')](respondWithResult(_0x1cadd3,null))[_0x4ccd('0x4e')](handleError(_0x1cadd3,null));};exports[_0x4ccd('0x4f')]=function(_0x35a6d0,_0x2678c5){if(_0x35a6d0[_0x4ccd('0x50')]['id']){delete _0x35a6d0[_0x4ccd('0x50')]['id'];}delete _0x35a6d0[_0x4ccd('0x50')][_0x4ccd('0x22')];return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x35a6d0['params']['id']}})['then'](handleEntityNotFound(_0x2678c5,null))[_0x4ccd('0x1d')](saveUpdates(_0x35a6d0['body'],null))[_0x4ccd('0x1d')](respondWithResult(_0x2678c5,null))[_0x4ccd('0x4e')](handleError(_0x2678c5,null));};exports[_0x4ccd('0x51')]=function(_0xfcc0d9,_0x377860){return db[_0x4ccd('0x2f')][_0x4ccd('0x51')]()['then'](respondWithResult(_0x377860,null))[_0x4ccd('0x4e')](handleError(_0x377860,null));};exports[_0x4ccd('0x52')]=function(_0x44bcce,_0x37b62f){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x44bcce[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x37b62f,null))['then'](function(_0x2b6dbc){if(_0x2b6dbc){return _0x2b6dbc['addContacts'](_0x44bcce['body'][_0x4ccd('0x53')],_['omit'](_0x44bcce[_0x4ccd('0x50')],[_0x4ccd('0x53'),'id'])||{});}})[_0x4ccd('0x1d')](respondWithResult(_0x37b62f,null))[_0x4ccd('0x4e')](handleError(_0x37b62f,null));};function validateUser(_0x4e819f){return new Promise(function(_0x5a9e63,_0x5eced8){if(_0x4e819f['internal'])return _0x5a9e63(_0x4e819f);return db[_0x4ccd('0x54')]['findById'](0x1)['then'](function(_0x4690c1){if(_0x4690c1[_0x4ccd('0x55')])authService[_0x4ccd('0x56')](_0x4e819f[_0x4ccd('0x57')]);db['User'][_0x4ccd('0x58')]('internal')['then'](function(_0x226d91){if(_[_0x4ccd('0x59')](_0x226d91)){_0x4e819f['internal']=_0x4690c1['min_internal']||0x1;return;}if(_[_0x4ccd('0x59')](_0x4690c1[_0x4ccd('0x5a')])||_0x4690c1[_0x4ccd('0x5a')]===_0x226d91){_0x4e819f[_0x4ccd('0x5b')]=_0x226d91+0x1;return;}if(_0x4690c1[_0x4ccd('0x5a')]>_0x226d91){_0x4e819f[_0x4ccd('0x5b')]=_0x4690c1[_0x4ccd('0x5a')];return;}return db[_0x4ccd('0x5c')][_0x4ccd('0x3a')](_0x4ccd('0x5d'),{'type':db['sequelize'][_0x4ccd('0x5e')][_0x4ccd('0x5f')]})[_0x4ccd('0x1d')](function(_0x195103){if(_0x195103&&_0x195103[_0x4ccd('0x60')]){for(var _0x1ab633=0x0,_0x4470a4=_0x195103[_0x4ccd('0x60')];_0x1ab633<_0x4470a4&&_[_0x4ccd('0x59')](_0x4e819f[_0x4ccd('0x5b')]);_0x1ab633++){if(_0x4690c1[_0x4ccd('0x5a')]<=_0x195103[_0x1ab633][_0x4ccd('0x61')]){_0x4e819f[_0x4ccd('0x5b')]=_0x195103[_0x1ab633][_0x4ccd('0x61')];}else if(_0x4690c1[_0x4ccd('0x5a')]>_0x195103[_0x1ab633][_0x4ccd('0x61')]&&_0x4690c1['min_internal']<=_0x195103[_0x1ab633]['to']){_0x4e819f['internal']=_0x4690c1['min_internal'];}}}if(_['isNil'](_0x4e819f[_0x4ccd('0x5b')])){_0x4e819f[_0x4ccd('0x5b')]=_0x226d91+0x1;}return _0x5a9e63(_0x4e819f);});});})[_0x4ccd('0x4e')](function(_0x3473dd){_0x5eced8(_0x3473dd);});});}function updateUser(_0x29467c){return new Promise(function(_0x38a08d,_0x191fce){try{if(_0x29467c[_0x4ccd('0x62')]){_0x29467c[_0x4ccd('0x63')]=_0x29467c[_0x4ccd('0x5b')];_0x29467c[_0x4ccd('0x64')]={'mailbox':_0x29467c[_0x4ccd('0x5b')],'password':_0x29467c[_0x4ccd('0x57')],'fullname':_0x29467c[_0x4ccd('0x65')],'email':_0x29467c[_0x4ccd('0x66')]};}if(_0x29467c['role']===_0x4ccd('0x1e')){if(!_0x29467c[_0x4ccd('0x67')])_0x29467c[_0x4ccd('0x67')]=[_0x4ccd('0x68'),_0x4ccd('0x69'),_0x4ccd('0x6a'),_0x4ccd('0x6b'),_0x4ccd('0x6c'),'104',_0x4ccd('0x6d'),'106','107',_0x4ccd('0x6e'),_0x4ccd('0x6f'),_0x4ccd('0x70'),_0x4ccd('0x71'),_0x4ccd('0x72'),_0x4ccd('0x73')];}_0x38a08d(_0x29467c);}catch(_0x392d18){_0x191fce(_0x392d18);}});}exports[_0x4ccd('0x74')]=function(_0x1c97ae,_0x22b46a){if(_0x1c97ae['user']['role']===_0x4ccd('0x1e'))throw new Error(_0x4ccd('0x75'));if(_0x1c97ae['body'][_0x4ccd('0x22')]===_0x4ccd('0x24')&&_0x1c97ae[_0x4ccd('0x24')][_0x4ccd('0x22')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x1c97ae['body'][_0x4ccd('0x22')]===_0x4ccd('0x76')&&_0x1c97ae[_0x4ccd('0x24')][_0x4ccd('0x22')]!==_0x4ccd('0x76')){throw new Error(_0x4ccd('0x77'));}return licenseUtil[_0x4ccd('0x78')]([_0x1c97ae[_0x4ccd('0x50')]])[_0x4ccd('0x1d')](function(){return validateUser(_0x1c97ae[_0x4ccd('0x50')]);})['then'](function(_0x2579bc){return updateUser(_0x2579bc)['then'](function(_0x4f0ec0){if(_0x4f0ec0['role']===_0x4ccd('0x76')){_0x4f0ec0[_0x4ccd('0x79')]=_0x1c97ae['user'][_0x4ccd('0x79')];delete _0x4f0ec0[_0x4ccd('0x7a')];}return _0x4f0ec0;});})[_0x4ccd('0x1d')](function(_0x51d338){return db['User'][_0x4ccd('0x74')](_0x51d338,{'include':[{'model':db['VoiceMail'],'as':_0x4ccd('0x64')}]});})['then'](function(_0x5d4a50){if(_0x1c97ae['body'][_0x4ccd('0x22')]===_0x4ccd('0x24'))return _0x5d4a50;if(_0x1c97ae[_0x4ccd('0x24')][_0x4ccd('0x22')]!==_0x4ccd('0x24'))return _0x5d4a50;return db[_0x4ccd('0x7b')][_0x4ccd('0x2b')]({'where':{'name':_0x5d4a50[_0x4ccd('0x22')]===_0x4ccd('0x1e')?_0x4ccd('0x7c'):_0x4ccd('0x25'),'userProfileId':_0x1c97ae[_0x4ccd('0x24')][_0x4ccd('0x7a')]},'raw':!![]})[_0x4ccd('0x1d')](function(_0x53a9e2){if(!_0x53a9e2||_0x53a9e2[_0x4ccd('0x7d')]!=0x0)return _0x5d4a50;return db['UserProfileResource'][_0x4ccd('0x74')]({'name':_0x5d4a50[_0x4ccd('0x2d')],'resourceId':_0x5d4a50['id'],'type':_0x53a9e2[_0x4ccd('0x2d')],'sectionId':_0x53a9e2['id']},{})[_0x4ccd('0x1d')](function(){return _0x5d4a50;});})[_0x4ccd('0x4e')](function(_0x3c3c3e){logger[_0x4ccd('0x7e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c3c3e);throw _0x3c3c3e;});})[_0x4ccd('0x1d')](respondWithResult(_0x22b46a,0xc9))[_0x4ccd('0x4e')](handleError(_0x22b46a,null));};exports[_0x4ccd('0x7f')]=function(_0x4f9fa2,_0x26b10d){var _0x4be9f0=_0x4f9fa2[_0x4ccd('0x50')];var _0x2a2dce=[];if(_0x4f9fa2[_0x4ccd('0x24')][_0x4ccd('0x22')]==='agent')throw new Error('Unauthorized');if(_[_0x4ccd('0x80')](_0x4be9f0,[_0x4ccd('0x22'),'user'])&&_0x4f9fa2[_0x4ccd('0x24')][_0x4ccd('0x22')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x4be9f0,['role',_0x4ccd('0x76')])&&_0x4f9fa2[_0x4ccd('0x24')][_0x4ccd('0x22')]!==_0x4ccd('0x76')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x4be9f0)[_0x4ccd('0x1d')](function(){return validateUser(_0x4be9f0[0x0]);})[_0x4ccd('0x1d')](function(){for(var _0x437aa2=0x1;_0x437aa2<_0x4be9f0[_0x4ccd('0x60')];_0x437aa2++){var _0x47c6d8=_0x4be9f0[_0x437aa2-0x1][_0x4ccd('0x5b')];if(!_0x4be9f0[_0x437aa2][_0x4ccd('0x5b')])_0x4be9f0[_0x437aa2][_0x4ccd('0x5b')]=_0x47c6d8+0x1;_0x2a2dce['push'](validateUser(_0x4be9f0[_0x437aa2]));}return Promise[_0x4ccd('0x47')](_0x2a2dce);})['then'](function(){_0x2a2dce=[];for(var _0x1b98ae=0x0;_0x1b98ae<_0x4be9f0[_0x4ccd('0x60')];_0x1b98ae++){_0x2a2dce['push'](updateUser(_0x4be9f0[_0x1b98ae]));}return Promise[_0x4ccd('0x47')](_0x2a2dce);})[_0x4ccd('0x1d')](function(){_0x2a2dce=_0x4be9f0[_0x4ccd('0x81')](function(_0x307d12){return db['User'][_0x4ccd('0x74')](_0x307d12,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x4ccd('0x1d')](function(_0x2161c6){_0x307d12['id']=_0x2161c6['id'];return _0x307d12;});});return Promise['all'](_0x2a2dce);})[_0x4ccd('0x1d')](function(_0x34522e){if(_0x4f9fa2[_0x4ccd('0x50')][_0x4ccd('0x22')]==='user')return _0x34522e;if(_0x4f9fa2[_0x4ccd('0x24')][_0x4ccd('0x22')]!==_0x4ccd('0x24'))return _0x34522e;var _0xeed117=_[_0x4ccd('0x80')](_0x34522e,function(_0x17d7ce){return _0x17d7ce[_0x4ccd('0x22')]===_0x4ccd('0x1e')||_0x17d7ce['role']==='telephone';});if(!_0xeed117)return _0x34522e;return db[_0x4ccd('0x7b')][_0x4ccd('0x82')]({'where':{'name':{'$or':[_0x4ccd('0x7c'),_0x4ccd('0x25')]},'userProfileId':_0x4f9fa2[_0x4ccd('0x24')]['userProfileId']},'raw':!![]})['then'](function(_0x2a0cf3){if(_[_0x4ccd('0x83')](_0x2a0cf3)||!_['some'](_0x2a0cf3,['autoAssociation',0x0]))return _0x34522e;_0x2a2dce=[];var _0x10e7f1=_(_0x2a0cf3)[_0x4ccd('0x81')](function(_0x4865f2){if(_0x4865f2[_0x4ccd('0x7d')]===0x1)return;return _0x4865f2[_0x4ccd('0x2d')]===_0x4ccd('0x7c')?_0x4ccd('0x1e'):_0x4ccd('0x26');})[_0x4ccd('0x84')]()[_0x4ccd('0x29')]();for(var _0x259930=0x0;_0x259930<_0x34522e[_0x4ccd('0x60')];_0x259930++){if(!_[_0x4ccd('0x2a')](_0x10e7f1,_0x34522e[_0x259930][_0x4ccd('0x22')]))return;var _0x108a72=_0x34522e[_0x259930]['role']===_0x4ccd('0x1e')?_0x4ccd('0x7c'):'Telephones';_0x2a2dce['push'](db[_0x4ccd('0x85')][_0x4ccd('0x74')]({'name':_0x34522e[_0x259930]['name'],'resourceId':_0x34522e[_0x259930]['id'],'type':_0x108a72,'sectionId':_[_0x4ccd('0x2b')](_0x2a0cf3,[_0x4ccd('0x2d'),_0x108a72])['id']},{}));}return Promise[_0x4ccd('0x47')](_0x2a2dce);});})['then'](respondWithResult(_0x26b10d,0xc9))[_0x4ccd('0x4e')](handleError(_0x26b10d,null));};exports['changePassword']=function(_0x1eb4a6,_0x394da1){if(_0x1eb4a6[_0x4ccd('0x50')]['id']){delete _0x1eb4a6['body']['id'];}return db['User']['find']({'where':{'id':_0x1eb4a6[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](function(_0x2b365c){if(!_0x2b365c)return null;if(_0x2b365c['id']===_0x1eb4a6[_0x4ccd('0x24')]['id']){if(!_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x86')]||!_0x1eb4a6[_0x4ccd('0x50')]['newPassword']){throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x2b365c[_0x4ccd('0x89')](_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x86')])){throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))](_0x4ccd('0x8a'));}if(_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x86')]===_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x8b')]){throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))](_0x4ccd('0x8c'));}}else if(_0x1eb4a6[_0x4ccd('0x24')]['role']==='admin'){if(!_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x8b')]){throw new db[(_0x4ccd('0x87'))]['ValidationError'](_0x4ccd('0x8d'));}}else if(_0x1eb4a6['user'][_0x4ccd('0x22')]===_0x4ccd('0x24')){if(!_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x8b')]){throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))](_0x4ccd('0x8d'));}if(_0x2b365c['role']!==_0x4ccd('0x1e')){throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))](_0x4ccd('0x75'));}}else{throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))](_0x4ccd('0x75'));}return _0x2b365c;})[_0x4ccd('0x1d')](handleEntityNotFound(_0x394da1,null))[_0x4ccd('0x1d')](function(_0x516c1d){return db[_0x4ccd('0x54')][_0x4ccd('0x8e')]({'attributes':['id',_0x4ccd('0x55'),'enforcePasswordHistory',_0x4ccd('0x8f')]})[_0x4ccd('0x1d')](function(_0x26e97b){if(_0x26e97b['securePassword'])authService[_0x4ccd('0x56')](_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x8b')]);if(!_0x26e97b['enforcePasswordHistory']||!_0x516c1d[_0x4ccd('0x34')])return _0x516c1d;authService[_0x4ccd('0x90')](_0x1eb4a6[_0x4ccd('0x50')]['newPassword'],_0x516c1d[_0x4ccd('0x34')],_0x26e97b['passwordHistoryLimit']);return _0x516c1d;})['then'](saveUpdates({'password':_0x1eb4a6[_0x4ccd('0x50')]['newPassword'],'passwordResetAt':_0x1eb4a6[_0x4ccd('0x24')]['id']==_0x1eb4a6[_0x4ccd('0x49')]['id']?moment():null,'previousPasswords':authService[_0x4ccd('0x91')](_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x8b')],_0x516c1d[_0x4ccd('0x34')])},null));})['then'](respondWithResult(_0x394da1,null))[_0x4ccd('0x4e')](handleError(_0x394da1,null));};exports[_0x4ccd('0x92')]=function(_0x228051,_0x538434){var _0x35b19b=_0x228051[_0x4ccd('0x50')][_0x4ccd('0x93')];return db['User'][_0x4ccd('0x2b')]({'where':{'id':_0x228051['params']['id']},'attributes':['id','name',_0x4ccd('0x22'),_0x4ccd('0x94'),_0x4ccd('0x95'),_0x4ccd('0x96'),'interface']})['then'](handleEntityNotFound(_0x538434,null))['then'](function(_0x1c143d){if(_0x1c143d){if(!utils[_0x4ccd('0x97')](_0x35b19b)){throw new db[(_0x4ccd('0x87'))]['ValidationError'](_0x4ccd('0x98'));}return _0x1c143d[_0x4ccd('0x99')+_[_0x4ccd('0x9a')](_0x35b19b[_0x4ccd('0x9b')]())+_0x4ccd('0x9c')](_0x228051[_0x4ccd('0x50')][_0x4ccd('0x53')],{'penalty':_0x228051[_0x4ccd('0x50')]['penalty']||0x0})[_0x4ccd('0x9d')](function(_0x445797){for(var _0x46a3c9=0x0;_0x46a3c9<_0x228051[_0x4ccd('0x50')][_0x4ccd('0x53')][_0x4ccd('0x60')];_0x46a3c9+=0x1){var _0x532e62={'UserId':Number(_0x228051[_0x4ccd('0x49')]['id'])};_0x532e62[_['capitalize'](_0x35b19b[_0x4ccd('0x9b')]())+_0x4ccd('0x9e')]=Number(_0x228051[_0x4ccd('0x50')][_0x4ccd('0x53')][_0x46a3c9]);socket[_0x4ccd('0x1f')](_0x4ccd('0x24')+_[_0x4ccd('0x9a')](_0x35b19b[_0x4ccd('0x9b')]())+'Queue:save',_0x532e62);}return _0x445797;})['then'](function(){if(_0x35b19b==='voice'){return db[_0x4ccd('0x9f')][_0x4ccd('0x82')]({'where':{'id':_0x228051[_0x4ccd('0x50')][_0x4ccd('0x53')]||[]},'raw':!![],'attributes':['id',_0x4ccd('0x2d')]});}})[_0x4ccd('0x1d')](function(_0x3e5882){var _0x577cd0=_0x1c143d['get']({'plain':!![]});var _0x3ae363=[];if(_0x35b19b===_0x4ccd('0xa0')&&_0x577cd0[_0x4ccd('0x22')]==='agent'&&_0x577cd0['online']){for(let _0x3b1422=0x0;_0x3b1422<_0x3e5882['length'];_0x3b1422+=0x1){_0x3ae363[_0x4ccd('0x41')]({'membername':_0x577cd0[_0x4ccd('0x2d')],'UserId':_0x577cd0['id'],'queue_name':_0x3e5882[_0x3b1422]['name'],'VoiceQueueId':_0x3e5882[_0x3b1422]['id'],'interface':_[_0x4ccd('0x59')](_0x577cd0['interface'])?util[_0x4ccd('0xa1')]('SIP/%s',_0x577cd0[_0x4ccd('0x2d')]):_0x577cd0[_0x4ccd('0xa2')],'paused':_0x577cd0[_0x4ccd('0x96')]||![],'penalty':_0x228051['body'][_0x4ccd('0xa3')]||0x0});}return Promise[_0x4ccd('0x47')](_0x3ae363['map'](function(_0x5010af){return db[_0x4ccd('0xa4')]['upsert'](_0x5010af);}));}return _0x1c143d;});}})[_0x4ccd('0x1d')](respondWithStatusCode(_0x538434,null))[_0x4ccd('0x4e')](handleError(_0x538434,null));};exports[_0x4ccd('0xa5')]=function(_0x3d8d50,_0x550531){var _0x3528ce,_0x275839;return db['User']['find']({'where':{'id':_0x3d8d50[_0x4ccd('0x49')]['id']},'attributes':['id',_0x4ccd('0x2d'),_0x4ccd('0x22')]})['then'](handleEntityNotFound(_0x550531,null))[_0x4ccd('0x1d')](function(_0x3bc3c4){if(_0x3bc3c4){_0x3528ce=_0x3bc3c4;if(!_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x93')]||!utils[_0x4ccd('0x97')](_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x93')])){throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))]('Unknown\x20channel');}return _0x3bc3c4[_0x4ccd('0xa6')+_['capitalize'](_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x93')]['toLowerCase']())+_0x4ccd('0x9c')](_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x53')]);}})['then'](function(_0x3ce603){if(_[_0x4ccd('0xa7')](_0x3d8d50['query']['ids'])){for(var _0x1c93be=0x0;_0x1c93be<_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x53')][_0x4ccd('0x60')];_0x1c93be+=0x1){_0x275839={'UserId':Number(_0x3d8d50['params']['id'])};_0x275839[_['capitalize'](_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x93')]['toLowerCase']())+'QueueId']=Number(_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x53')][_0x1c93be]);socket[_0x4ccd('0x1f')](_0x4ccd('0x24')+_[_0x4ccd('0x9a')](_0x3d8d50[_0x4ccd('0x3a')]['channel'][_0x4ccd('0x9b')]())+_0x4ccd('0xa8'),_0x275839);}}else{_0x275839={'UserId':Number(_0x3d8d50['params']['id'])};_0x275839[_[_0x4ccd('0x9a')](_0x3d8d50[_0x4ccd('0x3a')]['channel'][_0x4ccd('0x9b')]())+_0x4ccd('0x9e')]=Number(_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x53')]);socket['emit'](_0x4ccd('0x24')+_[_0x4ccd('0x9a')](_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x93')][_0x4ccd('0x9b')]())+_0x4ccd('0xa8'),_0x275839);}return _0x3ce603;})[_0x4ccd('0x1d')](function(){if(_0x3d8d50[_0x4ccd('0x3a')]['channel']===_0x4ccd('0xa0')){return db[_0x4ccd('0xa4')]['destroy']({'where':{'UserId':_0x3d8d50[_0x4ccd('0x49')]['id'],'VoiceQueueId':_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x53')]},'individualHooks':!![]})[_0x4ccd('0x1d')](function(){return _0x3528ce;});}return _0x3528ce;})[_0x4ccd('0x1d')](respondWithStatusCode(_0x550531,null))[_0x4ccd('0x4e')](handleError(_0x550531,null));};exports[_0x4ccd('0xa9')]=function(_0x212547,_0x24def7){_0x212547[_0x4ccd('0x50')]['userpic']=_0x212547[_0x4ccd('0xaa')][_0x4ccd('0xab')];return db['User'][_0x4ccd('0x2b')]({'where':{'id':_0x212547[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x24def7,null))[_0x4ccd('0x1d')](saveUpdates(_0x212547[_0x4ccd('0x50')],null))[_0x4ccd('0x1d')](respondWithResult(_0x24def7,null))[_0x4ccd('0x4e')](handleError(_0x24def7,null));};exports[_0x4ccd('0xac')]=function(_0x1befd0,_0x3956d0){var _0x3597eb=path['join'](config[_0x4ccd('0xad')],_0x4ccd('0xae'));return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x1befd0['params']['id']},'attributes':['id',_0x4ccd('0xaf')],'raw':!![]})[_0x4ccd('0x1d')](handleEntityNotFound(_0x3956d0,null))[_0x4ccd('0x1d')](function(_0x1d1de7){if(_0x1d1de7){if(_[_0x4ccd('0x59')](_0x1d1de7[_0x4ccd('0xaf')])){return _0x3956d0[_0x4ccd('0xb0')](_0x3597eb);}else{if(!fs['existsSync'](path['join'](config[_0x4ccd('0xad')],'server/files/images/',_0x1d1de7[_0x4ccd('0xaf')]))){return _0x3956d0[_0x4ccd('0xb0')](_0x3597eb);}return _0x3956d0[_0x4ccd('0xb0')](path[_0x4ccd('0xb1')](config[_0x4ccd('0xad')],_0x4ccd('0xb2'),_0x1d1de7[_0x4ccd('0xaf')]));}}})[_0x4ccd('0x4e')](handleError(_0x3956d0,null));};exports[_0x4ccd('0xb3')]=function(_0x58a5e5,_0xb5317){return db[_0x4ccd('0x2f')]['find']({'where':{'id':_0x58a5e5[_0x4ccd('0x49')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0xb5317,null))[_0x4ccd('0x1d')](function(_0xc06831){var _0x58baae=[];values=_0xc06831[_0x4ccd('0x44')];_0x58baae[_0x4ccd('0x41')](get_open_tabs('chat',_0xc06831['dataValues']));_0x58baae['push'](get_open_tabs(_0x4ccd('0xb4'),_0xc06831[_0x4ccd('0x44')]));_0x58baae[_0x4ccd('0x41')](get_open_tabs(_0x4ccd('0x46'),_0xc06831['dataValues']));_0x58baae[_0x4ccd('0x41')](get_open_tabs('whatsapp',_0xc06831['dataValues']));_0x58baae[_0x4ccd('0x41')](get_open_tabs('fax',_0xc06831[_0x4ccd('0x44')]));_0x58baae['push'](get_open_tabs(_0x4ccd('0x4d'),_0xc06831[_0x4ccd('0x44')]));return Promise[_0x4ccd('0x47')](_0x58baae);})[_0x4ccd('0x1d')](function(_0x1cfed2){if(_0x1cfed2){var _0x593315=_[_0x4ccd('0x81')](values[_0x4ccd('0xb5')],function(_0x31edca){return{'channel':'CHAT','id':_0x31edca['id'],'createdAt':_0x31edca['createdAt']};});var _0x498aa7=_['map'](values[_0x4ccd('0xb6')],function(_0x3bccef){return{'channel':_0x4ccd('0xb7'),'id':_0x3bccef['id'],'createdAt':_0x3bccef[_0x4ccd('0xb8')]};});var _0x1479ff=_[_0x4ccd('0x81')](values[_0x4ccd('0xb9')],function(_0x471857){return{'channel':_0x4ccd('0xba'),'id':_0x471857['id'],'createdAt':_0x471857[_0x4ccd('0xb8')]};});var _0x47fd2e=_[_0x4ccd('0x81')](values['MailOpenTabs'],function(_0x3cce7d){return{'channel':_0x4ccd('0xbb'),'id':_0x3cce7d['id'],'createdAt':_0x3cce7d[_0x4ccd('0xb8')]};});var _0x1c9b1a=_[_0x4ccd('0x81')](values[_0x4ccd('0xbc')],function(_0xe11a6b){return{'channel':_0x4ccd('0xbd'),'id':_0xe11a6b['id'],'createdAt':_0xe11a6b[_0x4ccd('0xb8')]};});var _0x15a586=_[_0x4ccd('0x81')](values[_0x4ccd('0xbe')],function(_0x173edf){return{'channel':_0x4ccd('0xbf'),'id':_0x173edf['id'],'createdAt':_0x173edf[_0x4ccd('0xb8')]};});var _0xcb2579=_['concat'](_0x593315,_0x498aa7,_0x1479ff,_0x47fd2e,_0x1c9b1a,_0x15a586);var _0xe876f0={'count':_0xcb2579[_0x4ccd('0x60')],'rows':_0xcb2579};return _0xe876f0;}else return null;})[_0x4ccd('0x1d')](respondWithResult(_0xb5317,null))[_0x4ccd('0x4e')](handleError(_0xb5317,null));};exports[_0x4ccd('0xc0')]=function(_0x371ace,_0xfb33f3){var _0x34b1c2={};return db[_0x4ccd('0x2f')]['findOne']({'where':{'id':_0x371ace[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](function(_0x1f22a1){if(!_0x1f22a1){throw new APINotFoundError(util[_0x4ccd('0xa1')]('User\x20with\x20id\x20%s\x20not\x20found',_0x371ace[_0x4ccd('0x49')]['id']));}return contacts['describe']();})[_0x4ccd('0x1d')](function(_0x5b990d){_0x371ace[_0x4ccd('0x3a')][_0x4ccd('0x2f')]=_0x371ace[_0x4ccd('0x49')]['id'];_0x34b1c2=qs[_0x4ccd('0x38')](_0x5b990d,_0x371ace);if(_0x371ace[_0x4ccd('0x3a')]['hasOwnProperty'](_0x4ccd('0x3b'))){_0x34b1c2[_0x4ccd('0x3c')]=[{'model':db[_0x4ccd('0xc1')],'as':_0x4ccd('0xc2'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x4ccd('0xc3')],'where':_0x371ace[_0x4ccd('0x3a')][_0x4ccd('0xc4')]?{'id':_0x371ace[_0x4ccd('0x3a')][_0x4ccd('0xc4')]}:undefined,'required':_0x371ace[_0x4ccd('0x3a')]['tag']?!![]:![]}];}return contacts[_0x4ccd('0x82')](_0x371ace[_0x4ccd('0x3a')],_0x371ace[_0x4ccd('0x24')],_0x34b1c2,_0x5b990d);})[_0x4ccd('0x1d')](respondWithFilteredResult(_0xfb33f3,_0x34b1c2))[_0x4ccd('0x4e')](APIHandleError(_0xfb33f3));};exports['getQueues']=function(_0x47f6f1,_0x1aa6fb){var _0x2b9525;var _0x3b3310={};var _0x19478c;return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x47f6f1['params']['id']},'attributes':['id',_0x4ccd('0x2d'),_0x4ccd('0x22')]})[_0x4ccd('0x1d')](handleEntityNotFound(_0x1aa6fb,null))[_0x4ccd('0x1d')](function(_0x47fef2){if(!utils[_0x4ccd('0x97')](_0x47f6f1[_0x4ccd('0x3a')][_0x4ccd('0x93')])){throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))](_0x4ccd('0x98'));}_0x2b9525=_0x47fef2;var _0x3b55e1={};_0x3b55e1[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db[_[_0x4ccd('0x9a')](_0x47f6f1['query'][_0x4ccd('0x93')])+_0x4ccd('0xc7')][_0x4ccd('0x30')]);_0x3b55e1[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x47f6f1[_0x4ccd('0x3a')]);_0x3b55e1[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x3b55e1[_0x4ccd('0xc5')],_0x3b55e1[_0x4ccd('0x3a')]);_0x3b3310[_0x4ccd('0x40')]=_['intersection'](_0x3b55e1[_0x4ccd('0xc5')],qs['fields'](_0x47f6f1[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x3b3310[_0x4ccd('0x40')]=_0x3b3310['attributes']['length']?_0x3b3310['attributes']:_0x3b55e1[_0x4ccd('0xc5')];_0x3b3310['order']=qs[_0x4ccd('0xcb')](_0x47f6f1[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x3b3310[_0x4ccd('0x39')]=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x47f6f1[_0x4ccd('0x3a')],_0x3b55e1['filters']));if(_0x47f6f1[_0x4ccd('0x3a')]['filter']){_0x3b3310[_0x4ccd('0x39')]=_['merge'](_0x3b3310['where'],{'$or':_[_0x4ccd('0x81')](_0x3b3310['attributes'],function(_0x4a5271){var _0x3b800f={};_0x3b800f[_0x4a5271]={'$like':'%'+_0x47f6f1[_0x4ccd('0x3a')]['filter']+'%'};return _0x3b800f;})});}_0x3b3310=_[_0x4ccd('0x4a')]({},_0x3b3310,_0x47f6f1['options']);switch(_0x2b9525['role']){case _0x4ccd('0x76'):return db[_[_0x4ccd('0x9a')](_0x47f6f1[_0x4ccd('0x3a')]['channel'])+_0x4ccd('0xc7')][_0x4ccd('0x82')](_0x3b3310);case _0x4ccd('0x24'):case'agent':return _0x2b9525['get'+_[_0x4ccd('0x9a')](_0x47f6f1[_0x4ccd('0x3a')][_0x4ccd('0x93')])+'Queues'](_0x3b3310);default:throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))](_0x4ccd('0xcd'));}})[_0x4ccd('0x1d')](function(_0x1deca4){_0x19478c=_0x1deca4[_0x4ccd('0x60')];if(!_0x47f6f1[_0x4ccd('0x3a')][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x3b3310[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x47f6f1[_0x4ccd('0x3a')]['limit']);_0x3b3310[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x47f6f1[_0x4ccd('0x3a')][_0x4ccd('0x17')]);}switch(_0x2b9525[_0x4ccd('0x22')]){case _0x4ccd('0x76'):return db[_[_0x4ccd('0x9a')](_0x47f6f1['query'][_0x4ccd('0x93')])+_0x4ccd('0xc7')][_0x4ccd('0x82')](_0x3b3310);case _0x4ccd('0x24'):case _0x4ccd('0x1e'):return _0x2b9525['get'+_[_0x4ccd('0x9a')](_0x47f6f1[_0x4ccd('0x3a')][_0x4ccd('0x93')])+_0x4ccd('0x9c')](_0x3b3310);}})['then'](function(_0x2a98d4){return{'count':_0x19478c,'rows':_0x2a98d4};})[_0x4ccd('0x1d')](respondWithResult(_0x1aa6fb,null))[_0x4ccd('0x4e')](handleError(_0x1aa6fb,null));};exports[_0x4ccd('0xd0')]=function(_0x307ee6,_0x1e23e8){var _0x126bc7={};var _0x28132a={};var _0x8252c9;var _0x51709f;return db[_0x4ccd('0x2f')]['findOne']({'where':{'id':_0x307ee6['params']['id']}})['then'](handleEntityNotFound(_0x1e23e8,null))['then'](function(_0xdd2bca){if(_0xdd2bca){_0x8252c9=_0xdd2bca;_0x28132a['model']=_[_0x4ccd('0xc6')](db[_0x4ccd('0xa4')]['rawAttributes']);_0x28132a[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x307ee6['query']);_0x28132a[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x28132a[_0x4ccd('0xc5')],_0x28132a[_0x4ccd('0x3a')]);_0x126bc7['attributes']=_[_0x4ccd('0xc9')](_0x28132a[_0x4ccd('0xc5')],qs[_0x4ccd('0xca')](_0x307ee6[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x126bc7['attributes']=_0x126bc7[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x126bc7[_0x4ccd('0x40')]:_0x28132a[_0x4ccd('0xc5')];_0x126bc7[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x307ee6[_0x4ccd('0x3a')]['sort']);_0x126bc7['where']=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x307ee6[_0x4ccd('0x3a')],_0x28132a[_0x4ccd('0xc8')]));if(_0x307ee6[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x126bc7[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x126bc7[_0x4ccd('0x39')],{'$or':_['map'](_0x126bc7[_0x4ccd('0x40')],function(_0x56a918){var _0x5c9969={};_0x5c9969[_0x56a918]={'$like':'%'+_0x307ee6[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x5c9969;})});}_0x126bc7=_[_0x4ccd('0x4a')]({},_0x126bc7,_0x307ee6[_0x4ccd('0xd2')]);return _0x8252c9[_0x4ccd('0xd0')](_0x126bc7);}})['then'](function(_0x3dd830){if(_0x3dd830){_0x51709f=_0x3dd830[_0x4ccd('0x60')];if(!_0x307ee6[_0x4ccd('0x3a')]['hasOwnProperty'](_0x4ccd('0xcf'))){_0x126bc7[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x307ee6['query']['limit']);_0x126bc7[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x307ee6['query'][_0x4ccd('0x17')]);}return _0x8252c9['getVoiceQueuesRt'](_0x126bc7);}})['then'](function(_0x4510cd){if(_0x4510cd){return _0x4510cd?{'count':_0x51709f,'rows':_0x4510cd}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x1e23e8,null))[_0x4ccd('0x4e')](handleError(_0x1e23e8,null));};exports[_0x4ccd('0xd3')]=function(_0x5ce74c,_0x4b31ae){var _0x18e7d3={};var _0x543265={};var _0x506374;var _0x1063f2;return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x5ce74c[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x4b31ae,null))[_0x4ccd('0x1d')](function(_0x564e37){if(_0x564e37){_0x506374=_0x564e37;_0x543265[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db[_0x4ccd('0xd4')][_0x4ccd('0x30')]);_0x543265[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x5ce74c[_0x4ccd('0x3a')]);_0x543265[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x543265[_0x4ccd('0xc5')],_0x543265[_0x4ccd('0x3a')]);_0x18e7d3[_0x4ccd('0x40')]=_['intersection'](_0x543265['model'],qs['fields'](_0x5ce74c[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x18e7d3[_0x4ccd('0x40')]=_0x18e7d3[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x18e7d3[_0x4ccd('0x40')]:_0x543265['model'];_0x18e7d3[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x5ce74c[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x18e7d3[_0x4ccd('0x39')]=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x5ce74c[_0x4ccd('0x3a')],_0x543265[_0x4ccd('0xc8')]));if(_0x5ce74c[_0x4ccd('0x3a')]['filter']){_0x18e7d3[_0x4ccd('0x39')]=_['merge'](_0x18e7d3[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x18e7d3[_0x4ccd('0x40')],function(_0x5f43fe){var _0x447e22={};_0x447e22[_0x5f43fe]={'$like':'%'+_0x5ce74c[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x447e22;})});}_0x18e7d3=_[_0x4ccd('0x4a')]({},_0x18e7d3,_0x5ce74c['options']);return _0x506374[_0x4ccd('0xd3')](_0x18e7d3);}})[_0x4ccd('0x1d')](function(_0x2ddda3){if(_0x2ddda3){_0x1063f2=_0x2ddda3[_0x4ccd('0x60')];if(!_0x5ce74c['query'][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x18e7d3['limit']=qs[_0x4ccd('0x19')](_0x5ce74c[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x18e7d3['offset']=qs['offset'](_0x5ce74c[_0x4ccd('0x3a')]['offset']);}return _0x506374[_0x4ccd('0xd3')](_0x18e7d3);}})[_0x4ccd('0x1d')](function(_0x5054c4){if(_0x5054c4){return _0x5054c4?{'count':_0x1063f2,'rows':_0x5054c4}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x4b31ae,null))[_0x4ccd('0x4e')](handleError(_0x4b31ae,null));};exports['getRecordings']=function(_0x158a61,_0x2dc5e7){var _0x14830f={'raw':!![],'where':{}};var _0xb97f67={};var _0x42a0ed={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x158a61[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x2dc5e7,null))['then'](function(_0x12e06c){if(_0x12e06c){_0xb97f67[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db[_0x4ccd('0xd5')]['rawAttributes']);_0xb97f67['query']=_[_0x4ccd('0xc6')](_0x158a61[_0x4ccd('0x3a')]);_0xb97f67[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0xb97f67[_0x4ccd('0xc5')],_0xb97f67['query']);_0x14830f[_0x4ccd('0x40')]=_[_0x4ccd('0xc9')](_0xb97f67[_0x4ccd('0xc5')],qs['fields'](_0x158a61[_0x4ccd('0x3a')]['fields']));_0x14830f[_0x4ccd('0x40')]=_0x14830f[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x14830f['attributes']:_0xb97f67[_0x4ccd('0xc5')];if(!_0x158a61['query'][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x14830f[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x158a61[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x14830f[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x158a61['query'][_0x4ccd('0x17')]);}_0x14830f[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x158a61[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x14830f[_0x4ccd('0x39')]=qs['filters'](_[_0x4ccd('0xcc')](_0x158a61[_0x4ccd('0x3a')],_0xb97f67[_0x4ccd('0xc8')]));_0x14830f['where']['UserId']=_0x12e06c['id'];if(_0x158a61[_0x4ccd('0x3a')]['filter']){_0x14830f[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x14830f[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x14830f[_0x4ccd('0x40')],function(_0x2eba71){var _0x1ff731={};_0x1ff731[_0x2eba71]={'$like':'%'+_0x158a61[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x1ff731;})});}_0x14830f=_[_0x4ccd('0x4a')]({},_0x14830f,_0x158a61[_0x4ccd('0xd2')]);return db[_0x4ccd('0xd5')][_0x4ccd('0x1a')]({'where':_0x14830f[_0x4ccd('0x39')]})[_0x4ccd('0x1d')](function(_0x2c47c3){_0x42a0ed[_0x4ccd('0x1a')]=_0x2c47c3;if(_0x158a61['query'][_0x4ccd('0x3b')]){_0x14830f[_0x4ccd('0x3c')]=[{'all':!![]}];}return db[_0x4ccd('0xd5')][_0x4ccd('0x82')](_0x14830f);})[_0x4ccd('0x1d')](function(_0x4e09eb){_0x42a0ed[_0x4ccd('0x42')]=_0x4e09eb;return _0x42a0ed;});}})[_0x4ccd('0x1d')](respondWithFilteredResult(_0x2dc5e7,_0x14830f))[_0x4ccd('0x4e')](handleError(_0x2dc5e7,null));};exports['getScreenRecordings']=function(_0x31d2a6,_0x5d60a7){var _0x18cc25={'raw':!![],'where':{}};var _0x174ca0={};var _0x23321f={'count':0x0,'rows':[]};return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x31d2a6['params']['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x5d60a7,null))[_0x4ccd('0x1d')](function(_0x576bba){if(_0x576bba){_0x174ca0[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db[_0x4ccd('0xd6')][_0x4ccd('0x30')]);_0x174ca0[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x31d2a6[_0x4ccd('0x3a')]);_0x174ca0[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x174ca0['model'],_0x174ca0[_0x4ccd('0x3a')]);_0x18cc25[_0x4ccd('0x40')]=_[_0x4ccd('0xc9')](_0x174ca0[_0x4ccd('0xc5')],qs[_0x4ccd('0xca')](_0x31d2a6['query'][_0x4ccd('0xca')]));_0x18cc25[_0x4ccd('0x40')]=_0x18cc25[_0x4ccd('0x40')]['length']?_0x18cc25[_0x4ccd('0x40')]:_0x174ca0[_0x4ccd('0xc5')];if(!_0x31d2a6[_0x4ccd('0x3a')][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x18cc25['limit']=qs[_0x4ccd('0x19')](_0x31d2a6[_0x4ccd('0x3a')]['limit']);_0x18cc25['offset']=qs[_0x4ccd('0x17')](_0x31d2a6['query'][_0x4ccd('0x17')]);}_0x18cc25[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x31d2a6['query'][_0x4ccd('0xcb')]);_0x18cc25[_0x4ccd('0x39')]=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x31d2a6[_0x4ccd('0x3a')],_0x174ca0['filters']));_0x18cc25['where'][_0x4ccd('0xd7')]=_0x576bba['id'];if(_0x31d2a6[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x18cc25[_0x4ccd('0x39')]=_['merge'](_0x18cc25[_0x4ccd('0x39')],{'$or':_['map'](_0x18cc25[_0x4ccd('0x40')],function(_0x55bdfa){var _0x5777a3={};_0x5777a3[_0x55bdfa]={'$like':'%'+_0x31d2a6[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x5777a3;})});}_0x18cc25=_[_0x4ccd('0x4a')]({},_0x18cc25,_0x31d2a6[_0x4ccd('0xd2')]);return db[_0x4ccd('0xd6')]['count']({'where':_0x18cc25['where']})[_0x4ccd('0x1d')](function(_0x353754){_0x23321f[_0x4ccd('0x1a')]=_0x353754;if(_0x31d2a6[_0x4ccd('0x3a')][_0x4ccd('0x3b')]){_0x18cc25['include']=[{'all':!![]}];}return db[_0x4ccd('0xd6')][_0x4ccd('0x82')](_0x18cc25);})[_0x4ccd('0x1d')](function(_0x4ae68e){_0x23321f[_0x4ccd('0x42')]=_0x4ae68e;return _0x23321f;});}})[_0x4ccd('0x1d')](respondWithFilteredResult(_0x5d60a7,_0x18cc25))[_0x4ccd('0x4e')](handleError(_0x5d60a7,null));};exports[_0x4ccd('0xd8')]=function(_0x51e1e9,_0x220d84){var _0x14cc10={};var _0x3797a1={};var _0x1c8634;var _0x5d07b2;return db[_0x4ccd('0x2f')]['findOne']({'where':{'id':_0x51e1e9['params']['id']}})['then'](handleEntityNotFound(_0x220d84,null))[_0x4ccd('0x1d')](function(_0x3cc34b){if(_0x3cc34b){_0x1c8634=_0x3cc34b;_0x3797a1[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db[_0x4ccd('0xd9')][_0x4ccd('0x30')]);_0x3797a1[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x51e1e9['query']);_0x3797a1['filters']=_[_0x4ccd('0xc9')](_0x3797a1[_0x4ccd('0xc5')],_0x3797a1[_0x4ccd('0x3a')]);_0x14cc10[_0x4ccd('0x40')]=_['intersection'](_0x3797a1[_0x4ccd('0xc5')],qs['fields'](_0x51e1e9[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x14cc10[_0x4ccd('0x40')]=_0x14cc10['attributes'][_0x4ccd('0x60')]?_0x14cc10[_0x4ccd('0x40')]:_0x3797a1[_0x4ccd('0xc5')];_0x14cc10[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x51e1e9[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x14cc10['where']=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x51e1e9['query'],_0x3797a1['filters']));if(_0x51e1e9[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x14cc10[_0x4ccd('0x39')]=_['merge'](_0x14cc10[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x14cc10['attributes'],function(_0x488068){var _0x16404f={};_0x16404f[_0x488068]={'$like':'%'+_0x51e1e9[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x16404f;})});}_0x14cc10=_['merge']({},_0x14cc10,_0x51e1e9[_0x4ccd('0xd2')]);return _0x1c8634['getChatInteractions'](_0x14cc10);}})['then'](function(_0x37291e){if(_0x37291e){_0x5d07b2=_0x37291e[_0x4ccd('0x60')];if(!_0x51e1e9['query'][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x14cc10[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x51e1e9[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x14cc10[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x51e1e9[_0x4ccd('0x3a')]['offset']);}return _0x1c8634[_0x4ccd('0xd8')](_0x14cc10);}})[_0x4ccd('0x1d')](function(_0x211066){if(_0x211066){return _0x211066?{'count':_0x5d07b2,'rows':_0x211066}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x220d84,null))[_0x4ccd('0x4e')](handleError(_0x220d84,null));};exports[_0x4ccd('0xda')]=function(_0x4fd621,_0x5ddc60){var _0x4b47e1={};var _0x439471={};var _0x5b6e05;var _0x3dc4a0;return db[_0x4ccd('0x2f')]['findOne']({'where':{'id':_0x4fd621[_0x4ccd('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ddc60,null))['then'](function(_0x1bcbf0){if(_0x1bcbf0){_0x5b6e05=_0x1bcbf0;_0x439471[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db['OpenchannelInteraction'][_0x4ccd('0x30')]);_0x439471[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x4fd621['query']);_0x439471[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x439471['model'],_0x439471[_0x4ccd('0x3a')]);_0x4b47e1[_0x4ccd('0x40')]=_['intersection'](_0x439471[_0x4ccd('0xc5')],qs[_0x4ccd('0xca')](_0x4fd621['query'][_0x4ccd('0xca')]));_0x4b47e1[_0x4ccd('0x40')]=_0x4b47e1[_0x4ccd('0x40')]['length']?_0x4b47e1[_0x4ccd('0x40')]:_0x439471['model'];_0x4b47e1[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x4fd621[_0x4ccd('0x3a')]['sort']);_0x4b47e1[_0x4ccd('0x39')]=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x4fd621[_0x4ccd('0x3a')],_0x439471['filters']));if(_0x4fd621[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x4b47e1[_0x4ccd('0x39')]=_['merge'](_0x4b47e1[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x4b47e1['attributes'],function(_0x3b788f){var _0x484ed3={};_0x484ed3[_0x3b788f]={'$like':'%'+_0x4fd621[_0x4ccd('0x3a')]['filter']+'%'};return _0x484ed3;})});}_0x4b47e1=_['merge']({},_0x4b47e1,_0x4fd621[_0x4ccd('0xd2')]);return _0x5b6e05['getOpenchannelInteractions'](_0x4b47e1);}})['then'](function(_0x158a26){if(_0x158a26){_0x3dc4a0=_0x158a26['length'];if(!_0x4fd621[_0x4ccd('0x3a')]['hasOwnProperty'](_0x4ccd('0xcf'))){_0x4b47e1[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x4fd621[_0x4ccd('0x3a')]['limit']);_0x4b47e1[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x4fd621['query']['offset']);}return _0x5b6e05['getOpenchannelInteractions'](_0x4b47e1);}})['then'](function(_0x16318d){if(_0x16318d){return _0x16318d?{'count':_0x3dc4a0,'rows':_0x16318d}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x5ddc60,null))[_0x4ccd('0x4e')](handleError(_0x5ddc60,null));};exports[_0x4ccd('0xdb')]=function(_0x592ea1,_0x4a2a4b){var _0x294c35={'raw':!![],'where':{}};var _0x12225d={};var _0x422b44={'count':0x0,'rows':[]};return db['User'][_0x4ccd('0x8e')]({'where':{'id':_0x592ea1['params']['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x4a2a4b,null))[_0x4ccd('0x1d')](function(_0x50ab38){if(_0x50ab38){_0x12225d[_0x4ccd('0xc5')]=_['keys'](db[_0x4ccd('0xdc')]['rawAttributes']);_0x12225d['query']=_['keys'](_0x592ea1[_0x4ccd('0x3a')]);_0x12225d[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x12225d['model'],_0x12225d[_0x4ccd('0x3a')]);_0x294c35['attributes']=_['intersection'](_0x12225d['model'],qs['fields'](_0x592ea1[_0x4ccd('0x3a')]['fields']));_0x294c35[_0x4ccd('0x40')]=_0x294c35['attributes'][_0x4ccd('0x60')]?_0x294c35[_0x4ccd('0x40')]:_0x12225d[_0x4ccd('0xc5')];if(!_0x592ea1['query']['hasOwnProperty'](_0x4ccd('0xcf'))){_0x294c35['limit']=qs[_0x4ccd('0x19')](_0x592ea1['query'][_0x4ccd('0x19')]);_0x294c35[_0x4ccd('0x17')]=qs['offset'](_0x592ea1[_0x4ccd('0x3a')][_0x4ccd('0x17')]);}_0x294c35[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x592ea1[_0x4ccd('0x3a')]['sort']);_0x294c35[_0x4ccd('0x39')]=qs['filters'](_[_0x4ccd('0xcc')](_0x592ea1[_0x4ccd('0x3a')],_0x12225d[_0x4ccd('0xc8')]));_0x294c35[_0x4ccd('0x39')][_0x4ccd('0xd7')]=_0x50ab38['id'];if(_0x592ea1[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x294c35[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x294c35['where'],{'$or':_[_0x4ccd('0x81')](_0x294c35[_0x4ccd('0x40')],function(_0x4b8ba6){var _0x1b1c78={};_0x1b1c78[_0x4b8ba6]={'$like':'%'+_0x592ea1[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x1b1c78;})});}_0x294c35=_[_0x4ccd('0x4a')]({},_0x294c35,_0x592ea1[_0x4ccd('0xd2')]);return db[_0x4ccd('0xdc')][_0x4ccd('0x1a')]({'where':_0x294c35['where']})[_0x4ccd('0x1d')](function(_0x26dc98){_0x422b44[_0x4ccd('0x1a')]=_0x26dc98;if(_0x592ea1[_0x4ccd('0x3a')]['includeAll']){_0x294c35['include']=[{'all':!![]}];}return db[_0x4ccd('0xdc')][_0x4ccd('0x82')](_0x294c35);})['then'](function(_0x1beb84){_0x422b44[_0x4ccd('0x42')]=_0x1beb84;return _0x422b44;});}})[_0x4ccd('0x1d')](respondWithFilteredResult(_0x4a2a4b,_0x294c35))['catch'](handleError(_0x4a2a4b,null));};exports[_0x4ccd('0xdd')]=function(_0x5ac40c,_0x16f384){var _0x203c66={};var _0xd711a0={};var _0x14c5f5;var _0xd79842;return db[_0x4ccd('0x2f')]['findOne']({'where':{'id':_0x5ac40c['params']['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x16f384,null))['then'](function(_0x5c3a04){if(_0x5c3a04){_0x14c5f5=_0x5c3a04;_0xd711a0[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db['SmsInteraction'][_0x4ccd('0x30')]);_0xd711a0['query']=_[_0x4ccd('0xc6')](_0x5ac40c[_0x4ccd('0x3a')]);_0xd711a0[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0xd711a0[_0x4ccd('0xc5')],_0xd711a0['query']);_0x203c66['attributes']=_['intersection'](_0xd711a0[_0x4ccd('0xc5')],qs[_0x4ccd('0xca')](_0x5ac40c[_0x4ccd('0x3a')]['fields']));_0x203c66[_0x4ccd('0x40')]=_0x203c66[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x203c66[_0x4ccd('0x40')]:_0xd711a0['model'];_0x203c66[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x5ac40c[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x203c66[_0x4ccd('0x39')]=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x5ac40c[_0x4ccd('0x3a')],_0xd711a0[_0x4ccd('0xc8')]));if(_0x5ac40c[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x203c66[_0x4ccd('0x39')]=_['merge'](_0x203c66[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x203c66[_0x4ccd('0x40')],function(_0x3ea55c){var _0x512208={};_0x512208[_0x3ea55c]={'$like':'%'+_0x5ac40c[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x512208;})});}_0x203c66=_['merge']({},_0x203c66,_0x5ac40c[_0x4ccd('0xd2')]);return _0x14c5f5[_0x4ccd('0xdd')](_0x203c66);}})['then'](function(_0x902bb0){if(_0x902bb0){_0xd79842=_0x902bb0['length'];if(!_0x5ac40c[_0x4ccd('0x3a')][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x203c66['limit']=qs['limit'](_0x5ac40c['query'][_0x4ccd('0x19')]);_0x203c66[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x5ac40c[_0x4ccd('0x3a')][_0x4ccd('0x17')]);}return _0x14c5f5[_0x4ccd('0xdd')](_0x203c66);}})[_0x4ccd('0x1d')](function(_0x412ed2){if(_0x412ed2){return _0x412ed2?{'count':_0xd79842,'rows':_0x412ed2}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x16f384,null))[_0x4ccd('0x4e')](handleError(_0x16f384,null));};exports[_0x4ccd('0xde')]=function(_0x33b29d,_0x1f82ba){var _0x340173={};var _0x247ff5={};var _0x517fbc;var _0x26c187;return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x33b29d[_0x4ccd('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f82ba,null))['then'](function(_0x5175f7){if(_0x5175f7){_0x517fbc=_0x5175f7;_0x247ff5[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db[_0x4ccd('0xdf')]['rawAttributes']);_0x247ff5[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x33b29d[_0x4ccd('0x3a')]);_0x247ff5[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x247ff5[_0x4ccd('0xc5')],_0x247ff5[_0x4ccd('0x3a')]);_0x340173[_0x4ccd('0x40')]=_[_0x4ccd('0xc9')](_0x247ff5[_0x4ccd('0xc5')],qs['fields'](_0x33b29d[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x340173[_0x4ccd('0x40')]=_0x340173[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x340173[_0x4ccd('0x40')]:_0x247ff5['model'];_0x340173[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x33b29d[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x340173['where']=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x33b29d[_0x4ccd('0x3a')],_0x247ff5[_0x4ccd('0xc8')]));if(_0x33b29d[_0x4ccd('0x3a')]['filter']){_0x340173[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x340173[_0x4ccd('0x39')],{'$or':_['map'](_0x340173[_0x4ccd('0x40')],function(_0x7d7934){var _0xbd75ea={};_0xbd75ea[_0x7d7934]={'$like':'%'+_0x33b29d[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0xbd75ea;})});}_0x340173=_[_0x4ccd('0x4a')]({},_0x340173,_0x33b29d[_0x4ccd('0xd2')]);return _0x517fbc[_0x4ccd('0xde')](_0x340173);}})['then'](function(_0x4ce4de){if(_0x4ce4de){_0x26c187=_0x4ce4de[_0x4ccd('0x60')];if(!_0x33b29d[_0x4ccd('0x3a')]['hasOwnProperty'](_0x4ccd('0xcf'))){_0x340173[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x33b29d[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x340173[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x33b29d[_0x4ccd('0x3a')][_0x4ccd('0x17')]);}return _0x517fbc['getFaxInteractions'](_0x340173);}})[_0x4ccd('0x1d')](function(_0x310bf7){if(_0x310bf7){return _0x310bf7?{'count':_0x26c187,'rows':_0x310bf7}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x1f82ba,null))['catch'](handleError(_0x1f82ba,null));};exports[_0x4ccd('0xe0')]=function(_0x4c6803,_0x53b421){var _0x194b72={};var _0x462d2d={};var _0x57a526;var _0x44f32b;return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x4c6803['params']['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x53b421,null))[_0x4ccd('0x1d')](function(_0x56dd4d){if(_0x56dd4d){_0x57a526=_0x56dd4d;_0x462d2d[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db['WhatsappInteraction'][_0x4ccd('0x30')]);_0x462d2d[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x4c6803[_0x4ccd('0x3a')]);_0x462d2d[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x462d2d[_0x4ccd('0xc5')],_0x462d2d[_0x4ccd('0x3a')]);_0x194b72[_0x4ccd('0x40')]=_['intersection'](_0x462d2d['model'],qs[_0x4ccd('0xca')](_0x4c6803[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x194b72['attributes']=_0x194b72[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x194b72[_0x4ccd('0x40')]:_0x462d2d[_0x4ccd('0xc5')];_0x194b72[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x4c6803[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x194b72[_0x4ccd('0x39')]=qs['filters'](_['pick'](_0x4c6803['query'],_0x462d2d[_0x4ccd('0xc8')]));if(_0x4c6803[_0x4ccd('0x3a')]['filter']){_0x194b72['where']=_[_0x4ccd('0x4a')](_0x194b72[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x194b72[_0x4ccd('0x40')],function(_0x301c62){var _0xbceb79={};_0xbceb79[_0x301c62]={'$like':'%'+_0x4c6803['query']['filter']+'%'};return _0xbceb79;})});}_0x194b72=_[_0x4ccd('0x4a')]({},_0x194b72,_0x4c6803['options']);return _0x57a526['getWhatsappInteractions'](_0x194b72);}})['then'](function(_0x32171f){if(_0x32171f){_0x44f32b=_0x32171f[_0x4ccd('0x60')];if(!_0x4c6803[_0x4ccd('0x3a')][_0x4ccd('0xce')]('nolimit')){_0x194b72[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x4c6803[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x194b72['offset']=qs[_0x4ccd('0x17')](_0x4c6803[_0x4ccd('0x3a')][_0x4ccd('0x17')]);}return _0x57a526['getWhatsappInteractions'](_0x194b72);}})[_0x4ccd('0x1d')](function(_0x4052a0){if(_0x4052a0){return _0x4052a0?{'count':_0x44f32b,'rows':_0x4052a0}:null;}})['then'](respondWithResult(_0x53b421,null))[_0x4ccd('0x4e')](handleError(_0x53b421,null));};exports[_0x4ccd('0xe1')]=function(_0x468d2e,_0x3b19ed,_0x56abc8){var _0x1cface;var _0x514c93;var _0x2155d4;var _0x400614=!_[_0x4ccd('0x59')](_0x468d2e['params']['id'])?_0x468d2e[_0x4ccd('0x49')]['id']:!_[_0x4ccd('0x59')](_0x468d2e[_0x4ccd('0x24')]['id'])?_0x468d2e[_0x4ccd('0x24')]['id']:null;return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x400614,'role':{'$or':[_0x4ccd('0x76'),_0x4ccd('0x24'),'agent']}},'attributes':['id',_0x4ccd('0x2d'),_0x4ccd('0xe2'),_0x4ccd('0xe3'),_0x4ccd('0x22'),_0x4ccd('0x5b'),_0x4ccd('0x95')]})[_0x4ccd('0x1d')](function(_0x6d2b67){if(_0x6d2b67){if(_0x6d2b67['role']===_0x4ccd('0x1e')){_0x1cface=_0x6d2b67;if(_0x468d2e[_0x4ccd('0x50')][_0x4ccd('0xa2')]){_0x2155d4=util[_0x4ccd('0xa1')](_0x4ccd('0xe4'),_0x1cface[_0x468d2e['body'][_0x4ccd('0xa2')]]);}else if(_0x468d2e[_0x4ccd('0x50')][_0x4ccd('0xe5')]){_0x2155d4=util[_0x4ccd('0xa1')](_0x4ccd('0xe6'),_0x468d2e[_0x4ccd('0x50')]['intrf']);}else{_0x2155d4=util[_0x4ccd('0xa1')]('SIP/%s',_0x1cface[_0x4ccd('0x2d')]);}socket['to'](util['format'](_0x4ccd('0xe7'),_0x1cface[_0x4ccd('0x2d')]))[_0x4ccd('0x1f')]('user:forcelogout',{'user':{'id':_0x1cface['id'],'name':_0x1cface['name']},'ip':_0x468d2e[_0x4ccd('0xe8')][_0x4ccd('0xe9')]||_0x468d2e[_0x4ccd('0xea')]['remoteAddress']||_0x468d2e['socket'][_0x4ccd('0xeb')]||_0x468d2e[_0x4ccd('0xea')]['socket'][_0x4ccd('0xeb')]});return db['UserVoiceQueueRt'][_0x4ccd('0x21')]({'where':{'membername':_0x1cface[_0x4ccd('0x2d')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x4ccd('0x88'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x4ccd('0x1d')](function(){if(_0x1cface){return _0x1cface['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x5bb607){if(_0x1cface){if(_0x5bb607){_0x514c93=_0x5bb607;if(_0x514c93[_0x4ccd('0x60')]){var _0x5ed746=_0x514c93[_0x4ccd('0x81')](function(_0x4a4d87){var _0x4a1239={'membername':_0x1cface['name'],'UserId':_0x1cface['id'],'queue_name':_0x4a4d87[_0x4ccd('0x2d')],'VoiceQueueId':_0x4a4d87['id'],'interface':_0x2155d4,'paused':_0x1cface[_0x4ccd('0x95')]||![],'penalty':_0x4a4d87[_0x4ccd('0xec')]||0x0};return db['UserVoiceQueueRt'][_0x4ccd('0xed')](_0x4a1239);});return Promise[_0x4ccd('0x47')](_0x5ed746);}}}})[_0x4ccd('0x1d')](function(){if(_0x1cface){return db[_0x4ccd('0xee')][_0x4ccd('0x82')]({'where':{'membername':_0x1cface[_0x4ccd('0x2d')],'exitAt':null}});}})[_0x4ccd('0x1d')](function(_0x4cbbd2){if(_0x1cface){var _0x7837c5=[];_0x4cbbd2[_0x4ccd('0xef')](function(_0x976059){_0x7837c5['push'](_0x976059['update']({'exitAt':moment()[_0x4ccd('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x7837c5);}})[_0x4ccd('0x1d')](function(){if(_0x1cface){var _0x5c1b8=[];var _0x4baa03=[];var _0x35c6ec=utils[_0x4ccd('0xf0')]();var _0x45a9f7={'membername':_0x1cface['name'],'interface':_0x2155d4,'enterAt':moment()[_0x4ccd('0xa1')](_0x4ccd('0xf1')),'role':_0x1cface[_0x4ccd('0x22')],'internal':_0x1cface[_0x4ccd('0x5b')]};_0x35c6ec[_0x4ccd('0xef')](function(_0x14333a){_0x5c1b8[_0x4ccd('0x41')](_[_0x4ccd('0x4a')]({'channel':_0x14333a,'type':_0x4ccd('0xf2'),'data1':_0x468d2e[_0x4ccd('0x50')][_0x4ccd('0xf3')],'data2':_0x2155d4},_0x45a9f7));if(_0x1cface['loginInPause']){_0x4baa03[_0x4ccd('0x41')](_['merge']({'channel':_0x14333a,'type':_0x4ccd('0xf4'),'data1':_0x4ccd('0xf5')},_0x45a9f7));}});return db['MemberReport']['bulkCreate'](_0x5c1b8['concat'](_0x4baa03),{'individualHooks':!![]});}})[_0x4ccd('0x1d')](function(){if(_0x1cface){return _0x1cface['update']({'online':!![],'lastLoginAt':moment()[_0x4ccd('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1cface['loginInPause']||![],'mailPause':_0x1cface[_0x4ccd('0x95')]||![],'chatPause':_0x1cface['loginInPause']||![],'faxPause':_0x1cface[_0x4ccd('0x95')]||![],'smsPause':_0x1cface[_0x4ccd('0x95')]||![],'openchannelPause':_0x1cface[_0x4ccd('0x95')]||![],'whatsappPause':_0x1cface[_0x4ccd('0x95')]||![],'pauseType':_0x1cface[_0x4ccd('0x95')]?_0x4ccd('0xf5'):null,'interface':_0x2155d4,'lastPauseAt':moment()[_0x4ccd('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x1b518e){if(_0x468d2e[_0x4ccd('0xf6')]){return _0x56abc8();}else{return Promise[_0x4ccd('0xf7')](_0x1b518e)['then'](respondWithResult(_0x3b19ed,null));}})[_0x4ccd('0x4e')](handleError(_0x3b19ed,null));};exports[_0x4ccd('0xf8')]=function(_0x111a48,_0x1fcd69){var _0x400f58;return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x111a48['params']['id'],'role':_0x4ccd('0x1e')},'attributes':['id',_0x4ccd('0x2d'),_0x4ccd('0x22')]})[_0x4ccd('0x1d')](handleEntityNotFound(_0x1fcd69,null))['then'](function(_0x357bed){if(_0x357bed){_0x400f58=_0x357bed;return db[_0x4ccd('0xa4')]['destroy']({'where':{'membername':_0x400f58[_0x4ccd('0x2d')]},'individualHooks':!![]});}})[_0x4ccd('0x1d')](function(){return db[_0x4ccd('0xee')][_0x4ccd('0x82')]({'where':{'membername':_0x400f58[_0x4ccd('0x2d')],'exitAt':null}});})[_0x4ccd('0x1d')](function(_0x128921){var _0x5ba95e=[];_0x128921['forEach'](function(_0x53ca93){_0x5ba95e[_0x4ccd('0x41')](_0x53ca93['update']({'exitAt':moment()['format'](_0x4ccd('0xf1'))}));});return Promise[_0x4ccd('0x47')](_0x5ba95e);})[_0x4ccd('0x1d')](function(){return _0x400f58[_0x4ccd('0x4f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x4ccd('0x1d')](respondWithResult(_0x1fcd69,null))[_0x4ccd('0x4e')](handleError(_0x1fcd69,null));};exports[_0x4ccd('0xf9')]=function(_0x4b3e65,_0x6f9e80){var _0x15883c;return db['UserVoiceQueueRt'][_0x4ccd('0x4f')]({'paused':0x1},{'where':{'UserId':_0x4b3e65[_0x4ccd('0x49')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x4b3e65['params']['id'],'role':_0x4ccd('0x1e')},'attributes':['id',_0x4ccd('0x2d'),_0x4ccd('0x22'),_0x4ccd('0x5b'),_0x4ccd('0xa2'),_0x4ccd('0x94')]});})[_0x4ccd('0x1d')](handleEntityNotFound(_0x6f9e80,null))['then'](function(_0x3dfc3e){if(_0x3dfc3e){_0x15883c=_0x3dfc3e;return db[_0x4ccd('0xee')][_0x4ccd('0x82')]({'where':{'membername':_0x15883c['name'],'type':_0x4ccd('0xf4'),'exitAt':null}});}})['then'](function(_0x4fd3ef){if(_0x4fd3ef[_0x4ccd('0x60')]){var _0x70b32a=moment()['format'](_0x4ccd('0xf1'));for(var _0x48dc26=0x0,_0x38b6a1=_0x4fd3ef[_0x4ccd('0x60')];_0x48dc26<_0x38b6a1;_0x48dc26++){_0x4fd3ef[_0x48dc26]['updateAttributes']({'exitAt':_0x70b32a});}}})[_0x4ccd('0x1d')](function(){var _0x4968ca=[];var _0x50150c=utils[_0x4ccd('0xf0')]();_0x50150c[_0x4ccd('0xef')](function(_0x25d769){_0x4968ca['push']({'channel':_0x25d769,'membername':_0x15883c[_0x4ccd('0x2d')],'interface':_['isNil'](_0x15883c[_0x4ccd('0xa2')])?util[_0x4ccd('0xa1')]('SIP/%s',_0x15883c[_0x4ccd('0x2d')]):_0x15883c[_0x4ccd('0xa2')],'type':_0x4ccd('0xf4'),'enterAt':moment()[_0x4ccd('0xa1')](_0x4ccd('0xf1')),'data1':_0x4b3e65[_0x4ccd('0x50')][_0x4ccd('0x32')]||_0x4ccd('0xfa'),'role':_0x15883c[_0x4ccd('0x22')],'internal':_0x15883c[_0x4ccd('0x5b')]});});return db['MemberReport']['bulkCreate'](_0x4968ca,{'individualHooks':!![]});})[_0x4ccd('0x1d')](function(){return _0x15883c['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4b3e65[_0x4ccd('0x50')]['type']||_0x4ccd('0xfa'),'lastPauseAt':moment()[_0x4ccd('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x4ccd('0x1d')](respondWithResult(_0x6f9e80,null))['catch'](handleError(_0x6f9e80,null));};exports[_0x4ccd('0xfb')]=function(_0x215305,_0x5c0a60){if(_0x215305[_0x4ccd('0x50')]['channel']&&!utils[_0x4ccd('0x97')](_0x215305[_0x4ccd('0x50')]['channel'])){throw new APIBadRequestError(util[_0x4ccd('0xa1')](_0x4ccd('0xfc'),_0x215305['body']['channel']));}return db[_0x4ccd('0x2f')]['find']({'where':{'id':_0x215305[_0x4ccd('0x49')]['id']},'attributes':['id','name',_0x4ccd('0x22'),_0x4ccd('0x5b'),_0x4ccd('0xa2'),_0x4ccd('0x94'),'voicePause',_0x4ccd('0xfd'),_0x4ccd('0xfe'),_0x4ccd('0xff'),'openchannelPause',_0x4ccd('0x100'),_0x4ccd('0x101'),_0x4ccd('0x102'),_0x4ccd('0x103')]})[_0x4ccd('0x1d')](function(_0x1701ee){if(!_0x1701ee){throw new APINotFoundError(util[_0x4ccd('0xa1')](_0x4ccd('0x104'),_0x215305['params']['id']));}return _0x1701ee[_0x4ccd('0xfb')](_0x215305[_0x4ccd('0x50')][_0x4ccd('0x93')]);})['then'](respondWithResult(_0x5c0a60,null))[_0x4ccd('0x4e')](APIHandleError(_0x5c0a60));};exports[_0x4ccd('0x105')]=function(_0x344cce,_0x5084c7){var _0x41e63d={};var _0x1d44d6={};var _0x20bd7e;var _0x538e09;return db[_0x4ccd('0x2f')]['findOne']({'where':{'id':_0x344cce[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x5084c7,null))['then'](function(_0x28d71f){if(_0x28d71f){_0x20bd7e=_0x28d71f;_0x1d44d6['model']=_[_0x4ccd('0xc6')](db[_0x4ccd('0x106')]['rawAttributes']);_0x1d44d6['query']=_['keys'](_0x344cce[_0x4ccd('0x3a')]);_0x1d44d6[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x1d44d6['model'],_0x1d44d6[_0x4ccd('0x3a')]);_0x41e63d[_0x4ccd('0x40')]=_[_0x4ccd('0xc9')](_0x1d44d6[_0x4ccd('0xc5')],qs['fields'](_0x344cce[_0x4ccd('0x3a')]['fields']));_0x41e63d['attributes']=_0x41e63d['attributes']['length']?_0x41e63d[_0x4ccd('0x40')]:_0x1d44d6[_0x4ccd('0xc5')];_0x41e63d[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x344cce['query']['sort']);_0x41e63d['where']=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x344cce[_0x4ccd('0x3a')],_0x1d44d6['filters']));if(_0x344cce['query']['filter']){_0x41e63d[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x41e63d[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x41e63d[_0x4ccd('0x40')],function(_0x11190c){var _0x5e337c={};_0x5e337c[_0x11190c]={'$like':'%'+_0x344cce[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x5e337c;})});}_0x41e63d=_[_0x4ccd('0x4a')]({},_0x41e63d,_0x344cce['options']);return _0x20bd7e[_0x4ccd('0x105')](_0x41e63d);}})[_0x4ccd('0x1d')](function(_0x237101){if(_0x237101){_0x538e09=_0x237101[_0x4ccd('0x60')];if(!_0x344cce[_0x4ccd('0x3a')][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x41e63d[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x344cce[_0x4ccd('0x3a')]['limit']);_0x41e63d[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x344cce['query']['offset']);}return _0x20bd7e[_0x4ccd('0x105')](_0x41e63d);}})[_0x4ccd('0x1d')](function(_0xe12d95){if(_0xe12d95){return _0xe12d95?{'count':_0x538e09,'rows':_0xe12d95}:null;}})['then'](respondWithResult(_0x5084c7,null))['catch'](handleError(_0x5084c7,null));};exports[_0x4ccd('0x107')]=function(_0x49f723,_0x2da64f){var _0x57d59=_0x49f723[_0x4ccd('0x49')]['id'];var _0x2d0ad1=_0x49f723[_0x4ccd('0x50')]?_0x49f723[_0x4ccd('0x50')]['ids']:null;var _0xf357a5=[];return Promise[_0x4ccd('0xf7')]()['then'](function(){if(!_0x2d0ad1)throw new APIBadRequestError(_0x4ccd('0x108'));})[_0x4ccd('0x1d')](function(){return db[_0x4ccd('0x2f')]['findOne']({'where':{'id':_0x57d59}});})[_0x4ccd('0x1d')](function(_0x581997){if(!_0x581997)throw new APINotFoundError(util[_0x4ccd('0xa1')](_0x4ccd('0x104'),_0x49f723['params']['id']));return db[_0x4ccd('0x5c')]['transaction'](function(_0x35d8e2){return _0x581997['addTeams'](_0x2d0ad1,{'transaction':_0x35d8e2})[_0x4ccd('0x1d')](function(){return db['Team'][_0x4ccd('0x82')]({'where':{'id':{'$in':_0x2d0ad1}}});})[_0x4ccd('0x1d')](function(_0xba128b){var _0x218b1f=_['map'](_0xba128b,function(_0x2944b8){return _0x2944b8['getAssociatedQueues']();});return Promise['all'](_0x218b1f);})[_0x4ccd('0x1d')](function(_0x46a0fb){_0xf357a5=_[_0x4ccd('0x109')](_0x46a0fb);var _0x5a5208=_['map'](_0xf357a5,function(_0xd94d34){return _0xd94d34[_0x4ccd('0x10a')](_0x581997['id'],{'transaction':_0x35d8e2});});return Promise[_0x4ccd('0x47')](_0x5a5208);})[_0x4ccd('0x1d')](function(){if(!_0x581997[_0x4ccd('0x94')])return;var _0x3a0178=_[_0x4ccd('0x27')](_0xf357a5,function(_0x4b469c){return _0x4b469c[_0x4ccd('0x10b')](_0x4ccd('0x93'))===_0x4ccd('0x10c');});var _0x41a378=_[_0x4ccd('0x81')](_0x3a0178,function(_0x448382){return db[_0x4ccd('0xa4')][_0x4ccd('0xed')]({'membername':_0x581997[_0x4ccd('0x2d')],'UserId':_0x581997['id'],'queue_name':_0x448382[_0x4ccd('0x2d')],'VoiceQueueId':_0x448382['id'],'interface':_[_0x4ccd('0x59')](_0x581997[_0x4ccd('0xa2')])?util[_0x4ccd('0xa1')](_0x4ccd('0xe6'),_0x581997[_0x4ccd('0x2d')]):_0x581997[_0x4ccd('0xa2')],'paused':_0x581997['voicePause']||![],'penalty':_0x581997[_0x4ccd('0xa3')]},{'transaction':_0x35d8e2});});return Promise[_0x4ccd('0x47')](_0x41a378);})['then'](function(){return db[_0x4ccd('0x10d')][_0x4ccd('0x82')]({'where':{'teamId':{'$in':_0x2d0ad1}}});})['then'](function(_0x416a13){var _0x218dbf=_[_0x4ccd('0x81')](_0x416a13,function(_0x2a2e88){return db['UserVoicePrefix'][_0x4ccd('0x74')]({'UserId':_0x581997['id'],'VoicePrefixId':_0x2a2e88['VoicePrefixId']},{'transaction':_0x35d8e2});});return Promise[_0x4ccd('0x47')](_0x218dbf);});});})[_0x4ccd('0x1d')](function(){for(var _0x42a132=0x0;_0x42a132<_0xf357a5['length'];_0x42a132++){var _0x45840e=_0xf357a5[_0x42a132][_0x4ccd('0x10b')](_0x4ccd('0x93'));var _0x463b20=_0x45840e+_0x4ccd('0x9e');socket['emit']('user'+_0x45840e+_0x4ccd('0x10e'),{'UserId':_0x57d59,['queueField']:_0xf357a5[_0x42a132]['id']});}})['then'](respondWithStatusCode(_0x2da64f,null))['catch'](APIHandleError(_0x2da64f));};exports[_0x4ccd('0x10f')]=function(_0x1ecffe,_0x105b0e){var _0x31c7ee=_0x1ecffe[_0x4ccd('0x49')]['id'];var _0x2ff8cd=null;if(_0x1ecffe['query'][_0x4ccd('0x53')]){_0x2ff8cd=_[_0x4ccd('0xa7')](_0x1ecffe[_0x4ccd('0x3a')]['ids'])?_0x1ecffe[_0x4ccd('0x3a')]['ids']:[_0x1ecffe['query'][_0x4ccd('0x53')]];}var _0x237be1=[];return Promise[_0x4ccd('0xf7')]()[_0x4ccd('0x1d')](function(){if(!_0x2ff8cd)throw new APIBadRequestError(_0x4ccd('0x110'));})['then'](function(){return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x31c7ee}});})[_0x4ccd('0x1d')](function(_0x561c1b){if(!_0x561c1b)throw new APINotFoundError(util[_0x4ccd('0xa1')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1ecffe['params']['id']));return db[_0x4ccd('0x5c')][_0x4ccd('0x111')](function(_0x23c8c9){return _0x561c1b['removeTeams'](_0x2ff8cd,{'transaction':_0x23c8c9})[_0x4ccd('0x1d')](function(){return db[_0x4ccd('0x106')][_0x4ccd('0x82')]({'where':{'id':{'$in':_0x2ff8cd}}});})[_0x4ccd('0x1d')](function(_0x352a87){var _0x288225=_[_0x4ccd('0x81')](_0x352a87,function(_0x47f934){return _0x47f934[_0x4ccd('0x112')]();});return Promise['all'](_0x288225);})[_0x4ccd('0x1d')](function(_0x5e090e){_0x237be1=_[_0x4ccd('0x109')](_0x5e090e);var _0x2f5ec3=_[_0x4ccd('0x81')](_0x237be1,function(_0x185386){return _0x185386[_0x4ccd('0x113')](_0x561c1b['id'],{'transaction':_0x23c8c9});});return Promise[_0x4ccd('0x47')](_0x2f5ec3);})[_0x4ccd('0x1d')](function(){if(!_0x561c1b['online'])return;var _0x29bc7e=_[_0x4ccd('0x27')](_0x237be1,function(_0x4885b9){return _0x4885b9[_0x4ccd('0x10b')](_0x4ccd('0x93'))==='Voice';});var _0x2922aa=_[_0x4ccd('0x81')](_0x29bc7e,function(_0x51e103){return db['UserVoiceQueueRt'][_0x4ccd('0x21')]({'where':{'VoiceQueueId':_0x51e103['id'],'UserId':_0x561c1b['id']},'transaction':_0x23c8c9});});return Promise['all'](_0x2922aa);})[_0x4ccd('0x1d')](function(){return db[_0x4ccd('0x10d')][_0x4ccd('0x82')]({'where':{'teamId':{'$in':_0x2ff8cd}}});})[_0x4ccd('0x1d')](function(_0xc2f96e){var _0x1ae2a2=_[_0x4ccd('0x81')](_0xc2f96e,function(_0x59b1d4){return db[_0x4ccd('0x114')][_0x4ccd('0x21')]({'where':{'UserId':_0x561c1b['id'],'VoicePrefixId':_0x59b1d4[_0x4ccd('0x115')]}},{'transaction':_0x23c8c9});});return Promise['all'](_0x1ae2a2);});});})['then'](function(){for(var _0x3d58f9=0x0;_0x3d58f9<_0x237be1[_0x4ccd('0x60')];_0x3d58f9++){var _0x599a00=_0x237be1[_0x3d58f9][_0x4ccd('0x10b')](_0x4ccd('0x93'));var _0x12a841=_0x599a00+_0x4ccd('0x9e');socket['emit'](_0x4ccd('0x24')+_0x599a00+_0x4ccd('0xa8'),{'UserId':_0x31c7ee,['queueField']:_0x237be1[_0x3d58f9]['id']});}})[_0x4ccd('0x1d')](respondWithStatusCode(_0x105b0e,null))[_0x4ccd('0x4e')](APIHandleError(_0x105b0e));};exports[_0x4ccd('0x116')]=function(_0x14c34a,_0x300d10){var _0x585041={};var _0x5076db={};var _0x230fab;var _0x2a3bec;return db['User'][_0x4ccd('0x8e')]({'where':{'id':_0x14c34a['params']['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x300d10,null))[_0x4ccd('0x1d')](function(_0x286e0e){if(_0x286e0e){_0x230fab=_0x286e0e;_0x5076db['model']=_[_0x4ccd('0xc6')](db[_0x4ccd('0xc1')]['rawAttributes']);_0x5076db[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x14c34a[_0x4ccd('0x3a')]);_0x5076db['filters']=_[_0x4ccd('0xc9')](_0x5076db[_0x4ccd('0xc5')],_0x5076db['query']);_0x585041[_0x4ccd('0x40')]=_['intersection'](_0x5076db[_0x4ccd('0xc5')],qs[_0x4ccd('0xca')](_0x14c34a['query'][_0x4ccd('0xca')]));_0x585041[_0x4ccd('0x40')]=_0x585041[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x585041[_0x4ccd('0x40')]:_0x5076db[_0x4ccd('0xc5')];_0x585041[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x14c34a['query']['sort']);_0x585041[_0x4ccd('0x39')]=qs['filters'](_[_0x4ccd('0xcc')](_0x14c34a[_0x4ccd('0x3a')],_0x5076db[_0x4ccd('0xc8')]));if(_0x14c34a[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x585041['where']=_['merge'](_0x585041[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x585041[_0x4ccd('0x40')],function(_0x5bd5bf){var _0x1a5472={};_0x1a5472[_0x5bd5bf]={'$like':'%'+_0x14c34a[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x1a5472;})});}_0x585041=_[_0x4ccd('0x4a')]({},_0x585041,_0x14c34a[_0x4ccd('0xd2')]);return _0x230fab[_0x4ccd('0x116')](_0x585041);}})[_0x4ccd('0x1d')](function(_0x111654){if(_0x111654){_0x2a3bec=_0x111654[_0x4ccd('0x60')];if(!_0x14c34a['query'][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x585041[_0x4ccd('0x19')]=qs['limit'](_0x14c34a[_0x4ccd('0x3a')]['limit']);_0x585041[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x14c34a[_0x4ccd('0x3a')][_0x4ccd('0x17')]);}return _0x230fab[_0x4ccd('0x116')](_0x585041);}})[_0x4ccd('0x1d')](function(_0x4c1a68){if(_0x4c1a68){return _0x4c1a68?{'count':_0x2a3bec,'rows':_0x4c1a68}:null;}})['then'](respondWithResult(_0x300d10,null))[_0x4ccd('0x4e')](handleError(_0x300d10,null));};exports[_0x4ccd('0x117')]=function(_0x54887f,_0x25a062){var _0x3964d9={};var _0x1e60cf={};var _0x5dc128;return db['User'][_0x4ccd('0x8e')]({'where':{'id':_0x54887f[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x25a062,null))[_0x4ccd('0x1d')](function(_0x33e0fb){if(_0x33e0fb){_0x5dc128=_0x33e0fb;_0x1e60cf['model']=_[_0x4ccd('0xc6')](db['User']['rawAttributes']);_0x1e60cf[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x54887f[_0x4ccd('0x3a')]);_0x1e60cf['filters']=_[_0x4ccd('0xc9')](_0x1e60cf[_0x4ccd('0xc5')],_0x1e60cf[_0x4ccd('0x3a')]);_0x3964d9['attributes']=_[_0x4ccd('0xc9')](_0x1e60cf[_0x4ccd('0xc5')],qs[_0x4ccd('0xca')](_0x54887f[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x3964d9[_0x4ccd('0x40')]=_0x3964d9['attributes']['length']?_0x3964d9[_0x4ccd('0x40')]:_0x1e60cf[_0x4ccd('0xc5')];_0x3964d9[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x54887f[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x3964d9[_0x4ccd('0x39')]=qs['filters'](_[_0x4ccd('0xcc')](_0x54887f['query'],_0x1e60cf['filters']));if(_0x54887f[_0x4ccd('0x3a')]['filter']){_0x3964d9[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x3964d9['where'],{'$or':_[_0x4ccd('0x81')](_0x3964d9[_0x4ccd('0x40')],function(_0x212ce8){var _0x5dafa7={};_0x5dafa7[_0x212ce8]={'$like':'%'+_0x54887f['query']['filter']+'%'};return _0x5dafa7;})});}_0x3964d9[_0x4ccd('0xc5')]=db[_0x4ccd('0x2f')];_0x3964d9['as']='Agents';_0x3964d9=_[_0x4ccd('0x4a')]({},_0x3964d9,_0x54887f[_0x4ccd('0xd2')]);return _0x5dc128[_0x4ccd('0x118')]({'include':[_0x3964d9]});}})['then'](function(_0xdd2734){if(_0xdd2734){var _0xa08013={},_0x3c184d=[];for(var _0x34ba73=0x0;_0x34ba73<_0xdd2734[_0x4ccd('0x60')];_0x34ba73+=0x1){for(var _0x241a73=0x0,_0x44c0f4;_0x241a73<_0xdd2734[_0x34ba73]['Agents'][_0x4ccd('0x60')];_0x241a73+=0x1){_0x44c0f4=_0xdd2734[_0x34ba73][_0x4ccd('0x7c')][_0x241a73][_0x4ccd('0x119')]({'plain':!![]});_0xa08013[_0x44c0f4['id']]=_0x44c0f4;}}_0xa08013=_[_0x4ccd('0x11a')](_0xa08013);for(var _0x3f8294=qs[_0x4ccd('0x17')](_0x54887f['query']['offset']);_0x3f8294<_0xa08013[_0x4ccd('0x60')]&&_0x3c184d['length']=_0x2af5a3){_0x2a1eaf=_0x2af5a3;_0x507cbc=0xc8;}else{_0x507cbc=0xce;}_0x26fd1f[_0xa31f('0x13')](_0x507cbc);return _0x26fd1f[_0xa31f('0x19')](_0xa31f('0x1a'),_0x195f34+'-'+_0x2a1eaf+'/'+_0x2af5a3)[_0xa31f('0x14')](_0x3cc1ad);}return null;};}function saveUpdates(_0x5212a9){return function(_0xcf3ab9){if(_0xcf3ab9){return _0xcf3ab9[_0xa31f('0x1b')](_0x5212a9)[_0xa31f('0x1c')](function(_0x1e18d8){if(_0x1e18d8[_0xa31f('0x1d')]===_0xa31f('0x1e')){socket[_0xa31f('0x1f')]('userNotification:recalc:'+_0x1e18d8['id'],_0x1e18d8);}return _0x1e18d8;});}return null;};}function removeEntity(_0x1a5c33){return function(_0x17fd42){if(_0x17fd42){return _0x17fd42[_0xa31f('0x20')]()['then'](function(){var _0x2e7f37=_0x17fd42['get']({'plain':!![]});if(_0x2e7f37[_0xa31f('0x1d')]==='admin')return;var _0x3425fc=[{'name':_0xa31f('0x21'),'value':_0xa31f('0x22'),'ignore':!![]},{'name':_0xa31f('0x23'),'value':_0xa31f('0x1e'),'ignore':![]},{'name':_0xa31f('0x24'),'value':_0xa31f('0x25'),'ignore':![]}];var _0x11b1fa=_(_0x3425fc)[_0xa31f('0x26')](_0xa31f('0x27'))[_0xa31f('0x28')](_0xa31f('0x29'))[_0xa31f('0x29')]();if(_[_0xa31f('0x2a')](_0x11b1fa,_0x2e7f37[_0xa31f('0x1d')])){return;}var _0x334086=_['find'](_0x3425fc,['value',_0x2e7f37[_0xa31f('0x1d')]])['name'];return db[_0xa31f('0x2b')][_0xa31f('0x20')]({'where':{'type':_0x334086,'resourceId':_0x2e7f37['id']}})[_0xa31f('0x1c')](function(){return _0x17fd42;});})[_0xa31f('0x1c')](function(){_0x1a5c33[_0xa31f('0x13')](0xcc)[_0xa31f('0x12')]();});}};}function handleEntityNotFound(_0xc89271){return function(_0x7bafa7){if(!_0x7bafa7){_0xc89271['sendStatus'](0x194);}return _0x7bafa7;};}function handleError(_0x5b79ef,_0x5d33d5){_0x5d33d5=_0x5d33d5||0x1f4;return function(_0x4a6f47){logger['error'](_0x4a6f47[_0xa31f('0x2c')]);if(_0x4a6f47[_0xa31f('0x2d')]){delete _0x4a6f47[_0xa31f('0x2d')];}_0x5b79ef[_0xa31f('0x13')](_0x5d33d5)[_0xa31f('0x2e')](_0x4a6f47);};}function getUserAttributes(){return _(db[_0xa31f('0x2f')][_0xa31f('0x30')])[_0xa31f('0x28')](function(_0x5cdfab){return{'name':_0x5cdfab['fieldName'],'type':_0x5cdfab['type'][_0xa31f('0x31')]};})['filter'](function(_0x120258){return![_0xa31f('0x32'),_0xa31f('0x33'),_0xa31f('0x34'),_0xa31f('0x35'),_0xa31f('0x36'),'md5secret']['includes'](_0x120258['name']);})['value']();}exports['index']=function(_0x592d02,_0x778ec5){var _0x3034d8={},_0x282082={'count':0x0,'rows':[]};var _0x27c536=getUserAttributes();_0x3034d8=qs[_0xa31f('0x37')](_0x27c536,_0x592d02);var _0xbcee0a={'where':_0x3034d8[_0xa31f('0x38')]};return db[_0xa31f('0x2f')][_0xa31f('0x17')](_0xbcee0a)[_0xa31f('0x1c')](function(_0x2778f4){_0x282082[_0xa31f('0x17')]=_0x2778f4;if(_0x592d02[_0xa31f('0x39')][_0xa31f('0x3a')]){_0x3034d8[_0xa31f('0x3b')]=[{'all':!![]}];}if(_0x592d02['query']['userSetting']===_0xa31f('0x3c')){_0x3034d8['include']=[{'model':db[_0xa31f('0x3d')],'as':_0xa31f('0x3e')}];}if(!_[_0xa31f('0x2a')](_0x3034d8[_0xa31f('0x3f')],'id')){_0x3034d8[_0xa31f('0x3f')]['push']('id');}return db['User'][_0xa31f('0x40')](_0x3034d8);})['then'](function(_0xbecef4){_0x282082['rows']=_0xbecef4;if(_0x592d02['query']['openTabs']===_0xa31f('0x3c')){var _0x22f0aa=[];for(var _0x416d06=0x0;_0x416d06<_0x282082['rows'][_0xa31f('0x41')];_0x416d06++){_0x22f0aa['push'](get_open_tabs('chat',_0x282082[_0xa31f('0x42')][_0x416d06][_0xa31f('0x43')]));_0x22f0aa[_0xa31f('0x44')](get_open_tabs(_0xa31f('0x45'),_0x282082[_0xa31f('0x42')][_0x416d06][_0xa31f('0x43')]));_0x22f0aa[_0xa31f('0x44')](get_open_tabs(_0xa31f('0x46'),_0x282082[_0xa31f('0x42')][_0x416d06][_0xa31f('0x43')]));_0x22f0aa['push'](get_open_tabs(_0xa31f('0x47'),_0x282082[_0xa31f('0x42')][_0x416d06][_0xa31f('0x43')]));_0x22f0aa[_0xa31f('0x44')](get_open_tabs('openchannel',_0x282082[_0xa31f('0x42')][_0x416d06][_0xa31f('0x43')]));_0x22f0aa[_0xa31f('0x44')](get_open_tabs(_0xa31f('0x48'),_0x282082[_0xa31f('0x42')][_0x416d06][_0xa31f('0x43')]));}return Promise['all'](_0x22f0aa)[_0xa31f('0x1c')](function(){return _0x282082;});}else{return _0x282082;}})[_0xa31f('0x1c')](respondWithFilteredResult(_0x778ec5,_0x3034d8))[_0xa31f('0x49')](handleError(_0x778ec5,null));};exports[_0xa31f('0x4a')]=function(_0x57c6ba,_0xe6f8e5){var _0x15e489=getUserAttributes();_0x57c6ba[_0xa31f('0x39')]['id']=_0x57c6ba['params']['id'];var _0x437b01=qs['getOptions'](_0x15e489,_0x57c6ba);if(_0x57c6ba[_0xa31f('0x39')][_0xa31f('0x3a')]){_0x437b01[_0xa31f('0x3b')]=[{'all':!![]}];}if(_0x57c6ba[_0xa31f('0x39')][_0xa31f('0x3e')]===_0xa31f('0x3c')){_0x437b01['include']=[{'model':db[_0xa31f('0x3d')],'as':_0xa31f('0x3e')}];}_0x437b01=_[_0xa31f('0x4b')]({},_0x437b01,_0x57c6ba[_0xa31f('0x4c')]);if(!_[_0xa31f('0x2a')](_0x437b01[_0xa31f('0x3f')],'id')){_0x437b01[_0xa31f('0x3f')][_0xa31f('0x44')]('id');}return db[_0xa31f('0x2f')][_0xa31f('0x4d')](_0x437b01)['then'](handleEntityNotFound(_0xe6f8e5,null))[_0xa31f('0x1c')](function(_0x585b82){var _0x55702b=[];values=_0x585b82;if(_0x57c6ba[_0xa31f('0x39')][_0xa31f('0x4e')]===_0xa31f('0x3c')){_0x55702b[_0xa31f('0x44')](get_open_tabs(_0xa31f('0x4f'),_0x585b82['dataValues']));_0x55702b[_0xa31f('0x44')](get_open_tabs(_0xa31f('0x45'),_0x585b82[_0xa31f('0x43')]));_0x55702b['push'](get_open_tabs(_0xa31f('0x50'),_0x585b82[_0xa31f('0x43')]));_0x55702b[_0xa31f('0x44')](get_open_tabs(_0xa31f('0x48'),_0x585b82[_0xa31f('0x43')]));_0x55702b[_0xa31f('0x44')](get_open_tabs(_0xa31f('0x46'),_0x585b82[_0xa31f('0x43')]));_0x55702b[_0xa31f('0x44')](get_open_tabs(_0xa31f('0x47'),_0x585b82[_0xa31f('0x43')]));return Promise['all'](_0x55702b);}else{return values;}})[_0xa31f('0x1c')](function(){return values;})[_0xa31f('0x1c')](respondWithResult(_0xe6f8e5,null))[_0xa31f('0x49')](handleError(_0xe6f8e5,null));};exports[_0xa31f('0x1b')]=function(_0x53d729,_0x209106){if(_0x53d729['body']['id']){delete _0x53d729[_0xa31f('0x51')]['id'];}delete _0x53d729[_0xa31f('0x51')]['role'];return db[_0xa31f('0x2f')][_0xa31f('0x4d')]({'where':{'id':_0x53d729['params']['id']}})[_0xa31f('0x1c')](handleEntityNotFound(_0x209106,null))[_0xa31f('0x1c')](saveUpdates(_0x53d729['body'],null))[_0xa31f('0x1c')](respondWithResult(_0x209106,null))[_0xa31f('0x49')](handleError(_0x209106,null));};exports[_0xa31f('0x52')]=function(_0x459fe3,_0x233625){return db['User']['describe']()[_0xa31f('0x1c')](respondWithResult(_0x233625,null))[_0xa31f('0x49')](handleError(_0x233625,null));};exports[_0xa31f('0x53')]=function(_0x3cf168,_0x46add5){return db['User'][_0xa31f('0x4d')]({'where':{'id':_0x3cf168[_0xa31f('0x54')]['id']}})['then'](handleEntityNotFound(_0x46add5,null))[_0xa31f('0x1c')](function(_0x9f80d){if(_0x9f80d){return _0x9f80d['addContacts'](_0x3cf168['body'][_0xa31f('0x55')],_[_0xa31f('0x56')](_0x3cf168[_0xa31f('0x51')],[_0xa31f('0x55'),'id'])||{});}})[_0xa31f('0x1c')](respondWithResult(_0x46add5,null))['catch'](handleError(_0x46add5,null));};function validateUser(_0x4ed306){return new Promise(function(_0x150cc7,_0x2bdf26){if(_0x4ed306['internal'])return _0x150cc7(_0x4ed306);return db[_0xa31f('0x57')]['findById'](0x1)['then'](function(_0x348ecc){if(_0x348ecc[_0xa31f('0x58')])authService[_0xa31f('0x59')](_0x4ed306[_0xa31f('0x32')]);db['User'][_0xa31f('0x5a')](_0xa31f('0x5b'))[_0xa31f('0x1c')](function(_0x4f234a){if(_['isNil'](_0x4f234a)){_0x4ed306[_0xa31f('0x5b')]=_0x348ecc[_0xa31f('0x5c')]||0x1;return;}if(_[_0xa31f('0x5d')](_0x348ecc[_0xa31f('0x5c')])||_0x348ecc[_0xa31f('0x5c')]===_0x4f234a){_0x4ed306[_0xa31f('0x5b')]=_0x4f234a+0x1;return;}if(_0x348ecc[_0xa31f('0x5c')]>_0x4f234a){_0x4ed306['internal']=_0x348ecc[_0xa31f('0x5c')];return;}return db[_0xa31f('0x5e')][_0xa31f('0x39')](_0xa31f('0x5f'),{'type':db[_0xa31f('0x5e')][_0xa31f('0x60')][_0xa31f('0x61')]})['then'](function(_0x2d4bc0){if(_0x2d4bc0&&_0x2d4bc0[_0xa31f('0x41')]){for(var _0x33744d=0x0,_0x36b045=_0x2d4bc0[_0xa31f('0x41')];_0x33744d<_0x36b045&&_['isNil'](_0x4ed306['internal']);_0x33744d++){if(_0x348ecc[_0xa31f('0x5c')]<=_0x2d4bc0[_0x33744d][_0xa31f('0x62')]){_0x4ed306[_0xa31f('0x5b')]=_0x2d4bc0[_0x33744d]['from'];}else if(_0x348ecc[_0xa31f('0x5c')]>_0x2d4bc0[_0x33744d][_0xa31f('0x62')]&&_0x348ecc['min_internal']<=_0x2d4bc0[_0x33744d]['to']){_0x4ed306[_0xa31f('0x5b')]=_0x348ecc[_0xa31f('0x5c')];}}}if(_[_0xa31f('0x5d')](_0x4ed306[_0xa31f('0x5b')])){_0x4ed306[_0xa31f('0x5b')]=_0x4f234a+0x1;}return _0x150cc7(_0x4ed306);});});})['catch'](function(_0x2bd3cb){_0x2bdf26(_0x2bd3cb);});});}function updateUser(_0x2ea783){return new Promise(function(_0x429752,_0x271431){try{if(_0x2ea783[_0xa31f('0x63')]){_0x2ea783[_0xa31f('0x64')]=_0x2ea783['internal'];_0x2ea783[_0xa31f('0x65')]={'mailbox':_0x2ea783[_0xa31f('0x5b')],'password':_0x2ea783['password'],'fullname':_0x2ea783[_0xa31f('0x66')],'email':_0x2ea783['email']};}if(_0x2ea783[_0xa31f('0x1d')]===_0xa31f('0x1e')){if(!_0x2ea783[_0xa31f('0x67')])_0x2ea783['permissions']=[_0xa31f('0x68'),_0xa31f('0x69'),_0xa31f('0x6a'),_0xa31f('0x6b'),'110',_0xa31f('0x6c'),'105',_0xa31f('0x6d'),_0xa31f('0x6e'),_0xa31f('0x6f'),_0xa31f('0x70'),'100','111',_0xa31f('0x71'),_0xa31f('0x72')];}_0x429752(_0x2ea783);}catch(_0x330cee){_0x271431(_0x330cee);}});}exports[_0xa31f('0x73')]=function(_0x101cb6,_0x4856e9){if(_0x101cb6[_0xa31f('0x22')]['role']===_0xa31f('0x1e'))throw new Error(_0xa31f('0x74'));if(_0x101cb6[_0xa31f('0x51')]['role']===_0xa31f('0x22')&&_0x101cb6['user'][_0xa31f('0x1d')]!=='admin'){throw new Error(_0xa31f('0x75'));}if(_0x101cb6[_0xa31f('0x51')][_0xa31f('0x1d')]===_0xa31f('0x76')&&_0x101cb6[_0xa31f('0x22')]['role']!==_0xa31f('0x76')){throw new Error(_0xa31f('0x77'));}return licenseUtil[_0xa31f('0x78')]([_0x101cb6[_0xa31f('0x51')]])[_0xa31f('0x1c')](function(){return validateUser(_0x101cb6['body']);})[_0xa31f('0x1c')](function(_0x2dfae3){return updateUser(_0x2dfae3)[_0xa31f('0x1c')](function(_0xf6f5e5){if(_0xf6f5e5['role']===_0xa31f('0x76')){_0xf6f5e5[_0xa31f('0x79')]=_0x101cb6['user'][_0xa31f('0x79')];delete _0xf6f5e5[_0xa31f('0x7a')];}return _0xf6f5e5;});})['then'](function(_0x1d73ea){return db['User']['create'](_0x1d73ea,{'include':[{'model':db[_0xa31f('0x65')],'as':_0xa31f('0x65')}]});})[_0xa31f('0x1c')](function(_0x198d6e){if(_0x101cb6[_0xa31f('0x51')][_0xa31f('0x1d')]===_0xa31f('0x22'))return _0x198d6e;if(_0x101cb6[_0xa31f('0x22')][_0xa31f('0x1d')]!==_0xa31f('0x22'))return _0x198d6e;return db[_0xa31f('0x7b')]['find']({'where':{'name':_0x198d6e['role']==='agent'?_0xa31f('0x23'):_0xa31f('0x24'),'userProfileId':_0x101cb6[_0xa31f('0x22')]['userProfileId']},'raw':!![]})[_0xa31f('0x1c')](function(_0x452655){if(!_0x452655||_0x452655[_0xa31f('0x7c')]!=0x0)return _0x198d6e;return db[_0xa31f('0x2b')][_0xa31f('0x73')]({'name':_0x198d6e['name'],'resourceId':_0x198d6e['id'],'type':_0x452655['name'],'sectionId':_0x452655['id']},{})[_0xa31f('0x1c')](function(){return _0x198d6e;});})[_0xa31f('0x49')](function(_0x430777){logger[_0xa31f('0x7d')](_0xa31f('0x7e'),_0x430777);throw _0x430777;});})[_0xa31f('0x1c')](respondWithResult(_0x4856e9,0xc9))[_0xa31f('0x49')](handleError(_0x4856e9,null));};exports[_0xa31f('0x7f')]=function(_0x1d3b23,_0x34d6ff){var _0x1a1b3f=_0x1d3b23[_0xa31f('0x51')];var _0x536317=[];if(_0x1d3b23[_0xa31f('0x22')][_0xa31f('0x1d')]===_0xa31f('0x1e'))throw new Error(_0xa31f('0x74'));if(_['some'](_0x1a1b3f,[_0xa31f('0x1d'),_0xa31f('0x22')])&&_0x1d3b23[_0xa31f('0x22')][_0xa31f('0x1d')]!==_0xa31f('0x76')){throw new Error(_0xa31f('0x75'));}if(_[_0xa31f('0x80')](_0x1a1b3f,[_0xa31f('0x1d'),_0xa31f('0x76')])&&_0x1d3b23[_0xa31f('0x22')]['role']!==_0xa31f('0x76')){throw new Error(_0xa31f('0x81'));}return licenseUtil[_0xa31f('0x78')](_0x1a1b3f)['then'](function(){return validateUser(_0x1a1b3f[0x0]);})[_0xa31f('0x1c')](function(){for(var _0x48da26=0x1;_0x48da26<_0x1a1b3f['length'];_0x48da26++){var _0x3815f1=_0x1a1b3f[_0x48da26-0x1][_0xa31f('0x5b')];if(!_0x1a1b3f[_0x48da26]['internal'])_0x1a1b3f[_0x48da26][_0xa31f('0x5b')]=_0x3815f1+0x1;_0x536317[_0xa31f('0x44')](validateUser(_0x1a1b3f[_0x48da26]));}return Promise[_0xa31f('0x82')](_0x536317);})[_0xa31f('0x1c')](function(){_0x536317=[];for(var _0x3533fb=0x0;_0x3533fb<_0x1a1b3f[_0xa31f('0x41')];_0x3533fb++){_0x536317[_0xa31f('0x44')](updateUser(_0x1a1b3f[_0x3533fb]));}return Promise[_0xa31f('0x82')](_0x536317);})['then'](function(){_0x536317=_0x1a1b3f['map'](function(_0x44c6c2){return db[_0xa31f('0x2f')][_0xa31f('0x73')](_0x44c6c2,{'include':[{'model':db[_0xa31f('0x65')],'as':_0xa31f('0x65')}]})[_0xa31f('0x1c')](function(_0x5e08aa){_0x44c6c2['id']=_0x5e08aa['id'];return _0x44c6c2;});});return Promise[_0xa31f('0x82')](_0x536317);})[_0xa31f('0x1c')](function(_0x13d689){if(_0x1d3b23[_0xa31f('0x51')]['role']===_0xa31f('0x22'))return _0x13d689;if(_0x1d3b23[_0xa31f('0x22')][_0xa31f('0x1d')]!==_0xa31f('0x22'))return _0x13d689;var _0x186ec2=_[_0xa31f('0x80')](_0x13d689,function(_0x4a1777){return _0x4a1777[_0xa31f('0x1d')]===_0xa31f('0x1e')||_0x4a1777[_0xa31f('0x1d')]==='telephone';});if(!_0x186ec2)return _0x13d689;return db['UserProfileSection'][_0xa31f('0x40')]({'where':{'name':{'$or':[_0xa31f('0x23'),_0xa31f('0x24')]},'userProfileId':_0x1d3b23['user'][_0xa31f('0x7a')]},'raw':!![]})[_0xa31f('0x1c')](function(_0x6ec8b4){if(_[_0xa31f('0x83')](_0x6ec8b4)||!_[_0xa31f('0x80')](_0x6ec8b4,['autoAssociation',0x0]))return _0x13d689;_0x536317=[];var _0x3a690b=_(_0x6ec8b4)[_0xa31f('0x28')](function(_0x2fb389){if(_0x2fb389[_0xa31f('0x7c')]===0x1)return;return _0x2fb389[_0xa31f('0x2d')]===_0xa31f('0x23')?_0xa31f('0x1e'):'telephone';})[_0xa31f('0x84')]()[_0xa31f('0x29')]();for(var _0x59e514=0x0;_0x59e514<_0x13d689['length'];_0x59e514++){if(!_[_0xa31f('0x2a')](_0x3a690b,_0x13d689[_0x59e514][_0xa31f('0x1d')]))return;var _0xe0abc=_0x13d689[_0x59e514][_0xa31f('0x1d')]===_0xa31f('0x1e')?_0xa31f('0x23'):'Telephones';_0x536317[_0xa31f('0x44')](db['UserProfileResource'][_0xa31f('0x73')]({'name':_0x13d689[_0x59e514]['name'],'resourceId':_0x13d689[_0x59e514]['id'],'type':_0xe0abc,'sectionId':_[_0xa31f('0x4d')](_0x6ec8b4,[_0xa31f('0x2d'),_0xe0abc])['id']},{}));}return Promise[_0xa31f('0x82')](_0x536317);});})['then'](respondWithResult(_0x34d6ff,0xc9))[_0xa31f('0x49')](handleError(_0x34d6ff,null));};exports['changePassword']=function(_0x3645dd,_0x532815){if(_0x3645dd[_0xa31f('0x51')]['id']){delete _0x3645dd['body']['id'];}return db[_0xa31f('0x2f')][_0xa31f('0x4d')]({'where':{'id':_0x3645dd[_0xa31f('0x54')]['id']}})['then'](function(_0x2e8af2){if(!_0x2e8af2)return null;if(_0x2e8af2['id']===_0x3645dd['user']['id']){if(!_0x3645dd[_0xa31f('0x51')]['oldPassword']||!_0x3645dd['body'][_0xa31f('0x85')]){throw new db['Sequelize']['ValidationError'](_0xa31f('0x86'));}if(!_0x2e8af2[_0xa31f('0x87')](_0x3645dd[_0xa31f('0x51')][_0xa31f('0x88')])){throw new db[(_0xa31f('0x89'))][(_0xa31f('0x8a'))](_0xa31f('0x8b'));}if(_0x3645dd['body']['oldPassword']===_0x3645dd[_0xa31f('0x51')]['newPassword']){throw new db[(_0xa31f('0x89'))][(_0xa31f('0x8a'))](_0xa31f('0x8c'));}}else if(_0x3645dd[_0xa31f('0x22')][_0xa31f('0x1d')]===_0xa31f('0x76')){if(!_0x3645dd[_0xa31f('0x51')]['newPassword']){throw new db[(_0xa31f('0x89'))][(_0xa31f('0x8a'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x3645dd[_0xa31f('0x22')][_0xa31f('0x1d')]===_0xa31f('0x22')){if(!_0x3645dd['body'][_0xa31f('0x85')]){throw new db[(_0xa31f('0x89'))][(_0xa31f('0x8a'))](_0xa31f('0x8d'));}if(_0x2e8af2['role']!=='agent'){throw new db[(_0xa31f('0x89'))]['ValidationError'](_0xa31f('0x74'));}}else{throw new db[(_0xa31f('0x89'))][(_0xa31f('0x8a'))](_0xa31f('0x74'));}return _0x2e8af2;})[_0xa31f('0x1c')](handleEntityNotFound(_0x532815,null))[_0xa31f('0x1c')](function(_0xb9ce10){return db[_0xa31f('0x57')][_0xa31f('0x8e')]({'attributes':['id',_0xa31f('0x58'),_0xa31f('0x8f'),_0xa31f('0x90')]})[_0xa31f('0x1c')](function(_0x57fae8){if(_0x57fae8[_0xa31f('0x58')])authService[_0xa31f('0x59')](_0x3645dd[_0xa31f('0x51')][_0xa31f('0x85')]);if(!_0x57fae8[_0xa31f('0x8f')]||!_0xb9ce10[_0xa31f('0x34')])return _0xb9ce10;authService['validatePasswordHistory'](_0x3645dd['body']['newPassword'],_0xb9ce10[_0xa31f('0x34')],_0x57fae8[_0xa31f('0x90')]);return _0xb9ce10;})['then'](saveUpdates({'password':_0x3645dd['body'][_0xa31f('0x85')],'passwordResetAt':_0x3645dd['user']['id']==_0x3645dd[_0xa31f('0x54')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x3645dd[_0xa31f('0x51')][_0xa31f('0x85')],_0xb9ce10[_0xa31f('0x34')])},null));})['then'](respondWithResult(_0x532815,null))[_0xa31f('0x49')](handleError(_0x532815,null));};exports[_0xa31f('0x91')]=function(_0x482e10,_0x566a69){var _0xa730b2=_0x482e10[_0xa31f('0x51')][_0xa31f('0x92')];return db['User']['find']({'where':{'id':_0x482e10[_0xa31f('0x54')]['id']},'attributes':['id',_0xa31f('0x2d'),_0xa31f('0x1d'),_0xa31f('0x93'),_0xa31f('0x94'),'voicePause','interface']})[_0xa31f('0x1c')](handleEntityNotFound(_0x566a69,null))['then'](function(_0x182a87){if(_0x182a87){if(!utils[_0xa31f('0x95')](_0xa730b2)){throw new db[(_0xa31f('0x89'))]['ValidationError'](_0xa31f('0x96'));}return _0x182a87['add'+_['capitalize'](_0xa730b2[_0xa31f('0x97')]())+'Queues'](_0x482e10[_0xa31f('0x51')]['ids'],{'penalty':_0x482e10['body'][_0xa31f('0x98')]||0x0})['spread'](function(_0x3d49eb){for(var _0x401520=0x0;_0x401520<_0x482e10['body'][_0xa31f('0x55')][_0xa31f('0x41')];_0x401520+=0x1){var _0xe7dd1a={'UserId':Number(_0x482e10[_0xa31f('0x54')]['id'])};_0xe7dd1a[_[_0xa31f('0x99')](_0xa730b2[_0xa31f('0x97')]())+_0xa31f('0x9a')]=Number(_0x482e10[_0xa31f('0x51')][_0xa31f('0x55')][_0x401520]);socket[_0xa31f('0x1f')](_0xa31f('0x22')+_['capitalize'](_0xa730b2[_0xa31f('0x97')]())+'Queue:save',_0xe7dd1a);}return _0x3d49eb;})[_0xa31f('0x1c')](function(){if(_0xa730b2==='voice'){return db['VoiceQueue']['findAll']({'where':{'id':_0x482e10[_0xa31f('0x51')][_0xa31f('0x55')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xa31f('0x1c')](function(_0x39e203){var _0x237f54=_0x182a87[_0xa31f('0x9b')]({'plain':!![]});var _0x11b63a=[];if(_0xa730b2===_0xa31f('0x9c')&&_0x237f54[_0xa31f('0x1d')]==='agent'&&_0x237f54[_0xa31f('0x93')]){for(let _0x57ebe1=0x0;_0x57ebe1<_0x39e203['length'];_0x57ebe1+=0x1){_0x11b63a[_0xa31f('0x44')]({'membername':_0x237f54[_0xa31f('0x2d')],'UserId':_0x237f54['id'],'queue_name':_0x39e203[_0x57ebe1][_0xa31f('0x2d')],'VoiceQueueId':_0x39e203[_0x57ebe1]['id'],'interface':_['isNil'](_0x237f54['interface'])?util[_0xa31f('0x9d')](_0xa31f('0x9e'),_0x237f54[_0xa31f('0x2d')]):_0x237f54[_0xa31f('0x9f')],'paused':_0x237f54[_0xa31f('0xa0')]||![],'penalty':_0x482e10[_0xa31f('0x51')][_0xa31f('0x98')]||0x0});}return Promise[_0xa31f('0x82')](_0x11b63a[_0xa31f('0x28')](function(_0x5d01a1){return db[_0xa31f('0xa1')]['upsert'](_0x5d01a1);}));}return _0x182a87;});}})[_0xa31f('0x1c')](respondWithStatusCode(_0x566a69,null))[_0xa31f('0x49')](handleError(_0x566a69,null));};exports[_0xa31f('0xa2')]=function(_0x58829d,_0x18fd9e){var _0x21d860,_0x301daf;return db[_0xa31f('0x2f')][_0xa31f('0x4d')]({'where':{'id':_0x58829d[_0xa31f('0x54')]['id']},'attributes':['id',_0xa31f('0x2d'),'role']})[_0xa31f('0x1c')](handleEntityNotFound(_0x18fd9e,null))[_0xa31f('0x1c')](function(_0x24d2a1){if(_0x24d2a1){_0x21d860=_0x24d2a1;if(!_0x58829d['query'][_0xa31f('0x92')]||!utils[_0xa31f('0x95')](_0x58829d['query'][_0xa31f('0x92')])){throw new db[(_0xa31f('0x89'))][(_0xa31f('0x8a'))](_0xa31f('0x96'));}return _0x24d2a1[_0xa31f('0xa3')+_[_0xa31f('0x99')](_0x58829d[_0xa31f('0x39')][_0xa31f('0x92')][_0xa31f('0x97')]())+_0xa31f('0xa4')](_0x58829d[_0xa31f('0x39')][_0xa31f('0x55')]);}})[_0xa31f('0x1c')](function(_0xd6902a){if(_[_0xa31f('0xa5')](_0x58829d[_0xa31f('0x39')]['ids'])){for(var _0x2ba481=0x0;_0x2ba481<_0x58829d[_0xa31f('0x39')][_0xa31f('0x55')]['length'];_0x2ba481+=0x1){_0x301daf={'UserId':Number(_0x58829d[_0xa31f('0x54')]['id'])};_0x301daf[_['capitalize'](_0x58829d[_0xa31f('0x39')][_0xa31f('0x92')][_0xa31f('0x97')]())+'QueueId']=Number(_0x58829d[_0xa31f('0x39')]['ids'][_0x2ba481]);socket[_0xa31f('0x1f')](_0xa31f('0x22')+_[_0xa31f('0x99')](_0x58829d[_0xa31f('0x39')]['channel']['toLowerCase']())+'Queue:remove',_0x301daf);}}else{_0x301daf={'UserId':Number(_0x58829d[_0xa31f('0x54')]['id'])};_0x301daf[_[_0xa31f('0x99')](_0x58829d[_0xa31f('0x39')][_0xa31f('0x92')][_0xa31f('0x97')]())+_0xa31f('0x9a')]=Number(_0x58829d[_0xa31f('0x39')][_0xa31f('0x55')]);socket['emit'](_0xa31f('0x22')+_[_0xa31f('0x99')](_0x58829d[_0xa31f('0x39')][_0xa31f('0x92')][_0xa31f('0x97')]())+_0xa31f('0xa6'),_0x301daf);}return _0xd6902a;})[_0xa31f('0x1c')](function(){if(_0x58829d[_0xa31f('0x39')][_0xa31f('0x92')]===_0xa31f('0x9c')){return db['UserVoiceQueueRt'][_0xa31f('0x20')]({'where':{'UserId':_0x58829d[_0xa31f('0x54')]['id'],'VoiceQueueId':_0x58829d[_0xa31f('0x39')][_0xa31f('0x55')]},'individualHooks':!![]})['then'](function(){return _0x21d860;});}return _0x21d860;})[_0xa31f('0x1c')](respondWithStatusCode(_0x18fd9e,null))[_0xa31f('0x49')](handleError(_0x18fd9e,null));};exports[_0xa31f('0xa7')]=function(_0x56b0e7,_0x1b1fd6){_0x56b0e7[_0xa31f('0x51')][_0xa31f('0xa8')]=_0x56b0e7[_0xa31f('0xa9')][_0xa31f('0xaa')];return db[_0xa31f('0x2f')][_0xa31f('0x4d')]({'where':{'id':_0x56b0e7[_0xa31f('0x54')]['id']}})['then'](handleEntityNotFound(_0x1b1fd6,null))[_0xa31f('0x1c')](saveUpdates(_0x56b0e7[_0xa31f('0x51')],null))[_0xa31f('0x1c')](respondWithResult(_0x1b1fd6,null))['catch'](handleError(_0x1b1fd6,null));};exports[_0xa31f('0xab')]=function(_0x485684,_0x3c5353){var _0x1c1efa=path[_0xa31f('0xac')](config['root'],_0xa31f('0xad'));return db[_0xa31f('0x2f')][_0xa31f('0x4d')]({'where':{'id':_0x485684[_0xa31f('0x54')]['id']},'attributes':['id',_0xa31f('0xa8')],'raw':!![]})['then'](handleEntityNotFound(_0x3c5353,null))[_0xa31f('0x1c')](function(_0x35793c){if(_0x35793c){if(_[_0xa31f('0x5d')](_0x35793c[_0xa31f('0xa8')])){return _0x3c5353[_0xa31f('0xae')](_0x1c1efa);}else{if(!fs['existsSync'](path['join'](config[_0xa31f('0xaf')],_0xa31f('0xb0'),_0x35793c[_0xa31f('0xa8')]))){return _0x3c5353[_0xa31f('0xae')](_0x1c1efa);}return _0x3c5353[_0xa31f('0xae')](path[_0xa31f('0xac')](config[_0xa31f('0xaf')],_0xa31f('0xb0'),_0x35793c[_0xa31f('0xa8')]));}}})[_0xa31f('0x49')](handleError(_0x3c5353,null));};exports[_0xa31f('0xb1')]=function(_0x24331b,_0x7a4c98){return db[_0xa31f('0x2f')]['find']({'where':{'id':_0x24331b[_0xa31f('0x54')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x7a4c98,null))['then'](function(_0x4b0475){var _0xcb057d=[];values=_0x4b0475[_0xa31f('0x43')];_0xcb057d[_0xa31f('0x44')](get_open_tabs(_0xa31f('0x4f'),_0x4b0475['dataValues']));_0xcb057d[_0xa31f('0x44')](get_open_tabs(_0xa31f('0x45'),_0x4b0475[_0xa31f('0x43')]));_0xcb057d['push'](get_open_tabs('openchannel',_0x4b0475[_0xa31f('0x43')]));_0xcb057d['push'](get_open_tabs(_0xa31f('0x48'),_0x4b0475[_0xa31f('0x43')]));_0xcb057d[_0xa31f('0x44')](get_open_tabs(_0xa31f('0x46'),_0x4b0475['dataValues']));_0xcb057d[_0xa31f('0x44')](get_open_tabs(_0xa31f('0x47'),_0x4b0475[_0xa31f('0x43')]));return Promise['all'](_0xcb057d);})['then'](function(_0xbdaf31){if(_0xbdaf31){var _0x53c637=_[_0xa31f('0x28')](values[_0xa31f('0xb2')],function(_0x233fa6){return{'channel':_0xa31f('0xb3'),'id':_0x233fa6['id'],'createdAt':_0x233fa6[_0xa31f('0xb4')]};});var _0x510078=_['map'](values[_0xa31f('0xb5')],function(_0x404a5f){return{'channel':_0xa31f('0xb6'),'id':_0x404a5f['id'],'createdAt':_0x404a5f[_0xa31f('0xb4')]};});var _0x3b5d77=_['map'](values[_0xa31f('0xb7')],function(_0x35a19d){return{'channel':_0xa31f('0xb8'),'id':_0x35a19d['id'],'createdAt':_0x35a19d[_0xa31f('0xb4')]};});var _0x3cbb06=_['map'](values[_0xa31f('0xb9')],function(_0x5ee548){return{'channel':_0xa31f('0xba'),'id':_0x5ee548['id'],'createdAt':_0x5ee548['createdAt']};});var _0x43eac1=_[_0xa31f('0x28')](values[_0xa31f('0xbb')],function(_0x451723){return{'channel':'SMS','id':_0x451723['id'],'createdAt':_0x451723[_0xa31f('0xb4')]};});var _0x468264=_[_0xa31f('0x28')](values[_0xa31f('0xbc')],function(_0xfd0790){return{'channel':'WHATSAPP','id':_0xfd0790['id'],'createdAt':_0xfd0790[_0xa31f('0xb4')]};});var _0x28ee98=_[_0xa31f('0xbd')](_0x53c637,_0x510078,_0x3b5d77,_0x3cbb06,_0x43eac1,_0x468264);var _0x55c114={'count':_0x28ee98[_0xa31f('0x41')],'rows':_0x28ee98};return _0x55c114;}else return null;})[_0xa31f('0x1c')](respondWithResult(_0x7a4c98,null))[_0xa31f('0x49')](handleError(_0x7a4c98,null));};exports[_0xa31f('0xbe')]=function(_0x1571c2,_0x2c7554){var _0x4484f8={};return db[_0xa31f('0x2f')][_0xa31f('0x8e')]({'where':{'id':_0x1571c2[_0xa31f('0x54')]['id']}})[_0xa31f('0x1c')](function(_0x44cd06){if(!_0x44cd06){throw new APINotFoundError(util[_0xa31f('0x9d')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1571c2[_0xa31f('0x54')]['id']));}return contacts[_0xa31f('0x52')]();})[_0xa31f('0x1c')](function(_0x584cf4){_0x1571c2[_0xa31f('0x39')][_0xa31f('0x2f')]=_0x1571c2[_0xa31f('0x54')]['id'];_0x4484f8=qs[_0xa31f('0x37')](_0x584cf4,_0x1571c2);if(_0x1571c2[_0xa31f('0x39')][_0xa31f('0xbf')](_0xa31f('0x3a'))){_0x4484f8[_0xa31f('0x3b')]=[{'model':db[_0xa31f('0xc0')],'as':_0xa31f('0xc1'),'required':![]},{'model':db[_0xa31f('0xc2')],'as':_0xa31f('0xc3'),'attributes':['id',_0xa31f('0x2d'),'color'],'where':_0x1571c2['query'][_0xa31f('0xc4')]?{'id':_0x1571c2[_0xa31f('0x39')][_0xa31f('0xc4')]}:undefined,'required':_0x1571c2[_0xa31f('0x39')][_0xa31f('0xc4')]?!![]:![]}];}return contacts[_0xa31f('0x40')](_0x1571c2['query'],_0x1571c2[_0xa31f('0x22')],_0x4484f8,_0x584cf4);})[_0xa31f('0x1c')](respondWithFilteredResult(_0x2c7554,_0x4484f8))[_0xa31f('0x49')](APIHandleError(_0x2c7554));};exports[_0xa31f('0xc5')]=function(_0x182919,_0x5e5463){var _0x1dcd5b;var _0x383d3b={};var _0x2c51bd;return db[_0xa31f('0x2f')]['findOne']({'where':{'id':_0x182919['params']['id']},'attributes':['id',_0xa31f('0x2d'),_0xa31f('0x1d')]})[_0xa31f('0x1c')](handleEntityNotFound(_0x5e5463,null))[_0xa31f('0x1c')](function(_0x50499e){if(!utils[_0xa31f('0x95')](_0x182919['query'][_0xa31f('0x92')])){throw new db['Sequelize'][(_0xa31f('0x8a'))](_0xa31f('0x96'));}_0x1dcd5b=_0x50499e;var _0x2004f7={};_0x2004f7['model']=_[_0xa31f('0xc6')](db[_[_0xa31f('0x99')](_0x182919['query'][_0xa31f('0x92')])+_0xa31f('0xc7')]['rawAttributes']);_0x2004f7['query']=_[_0xa31f('0xc6')](_0x182919[_0xa31f('0x39')]);_0x2004f7[_0xa31f('0xc8')]=_[_0xa31f('0xc9')](_0x2004f7[_0xa31f('0xca')],_0x2004f7[_0xa31f('0x39')]);_0x383d3b[_0xa31f('0x3f')]=_[_0xa31f('0xc9')](_0x2004f7['model'],qs[_0xa31f('0xcb')](_0x182919[_0xa31f('0x39')]['fields']));_0x383d3b[_0xa31f('0x3f')]=_0x383d3b[_0xa31f('0x3f')][_0xa31f('0x41')]?_0x383d3b[_0xa31f('0x3f')]:_0x2004f7[_0xa31f('0xca')];_0x383d3b[_0xa31f('0xcc')]=qs[_0xa31f('0xcd')](_0x182919[_0xa31f('0x39')][_0xa31f('0xcd')]);_0x383d3b[_0xa31f('0x38')]=qs[_0xa31f('0xc8')](_[_0xa31f('0xce')](_0x182919[_0xa31f('0x39')],_0x2004f7[_0xa31f('0xc8')]));if(_0x182919[_0xa31f('0x39')][_0xa31f('0x26')]){_0x383d3b[_0xa31f('0x38')]=_[_0xa31f('0x4b')](_0x383d3b[_0xa31f('0x38')],{'$or':_[_0xa31f('0x28')](_0x383d3b[_0xa31f('0x3f')],function(_0x5972b6){var _0x3d2480={};_0x3d2480[_0x5972b6]={'$like':'%'+_0x182919['query'][_0xa31f('0x26')]+'%'};return _0x3d2480;})});}_0x383d3b=_['merge']({},_0x383d3b,_0x182919[_0xa31f('0x4c')]);switch(_0x1dcd5b['role']){case _0xa31f('0x76'):return db[_[_0xa31f('0x99')](_0x182919[_0xa31f('0x39')][_0xa31f('0x92')])+'Queue']['findAll'](_0x383d3b);case _0xa31f('0x22'):case _0xa31f('0x1e'):return _0x1dcd5b[_0xa31f('0x9b')+_[_0xa31f('0x99')](_0x182919[_0xa31f('0x39')][_0xa31f('0x92')])+_0xa31f('0xa4')](_0x383d3b);default:throw new db[(_0xa31f('0x89'))]['ValidationError'](_0xa31f('0xcf'));}})[_0xa31f('0x1c')](function(_0x387b94){_0x2c51bd=_0x387b94[_0xa31f('0x41')];if(!_0x182919['query'][_0xa31f('0xbf')](_0xa31f('0xd0'))){_0x383d3b[_0xa31f('0x18')]=qs[_0xa31f('0x18')](_0x182919[_0xa31f('0x39')]['limit']);_0x383d3b[_0xa31f('0x15')]=qs[_0xa31f('0x15')](_0x182919['query']['offset']);}switch(_0x1dcd5b[_0xa31f('0x1d')]){case _0xa31f('0x76'):return db[_[_0xa31f('0x99')](_0x182919[_0xa31f('0x39')]['channel'])+_0xa31f('0xc7')]['findAll'](_0x383d3b);case _0xa31f('0x22'):case _0xa31f('0x1e'):return _0x1dcd5b[_0xa31f('0x9b')+_['capitalize'](_0x182919[_0xa31f('0x39')]['channel'])+_0xa31f('0xa4')](_0x383d3b);}})[_0xa31f('0x1c')](function(_0x114101){return{'count':_0x2c51bd,'rows':_0x114101};})[_0xa31f('0x1c')](respondWithResult(_0x5e5463,null))[_0xa31f('0x49')](handleError(_0x5e5463,null));};exports[_0xa31f('0xd1')]=function(_0xc4475c,_0x274a43){var _0x12b813={};var _0x5da8d0={};var _0x112d7d;var _0x4714fe;return db[_0xa31f('0x2f')][_0xa31f('0x8e')]({'where':{'id':_0xc4475c[_0xa31f('0x54')]['id']}})['then'](handleEntityNotFound(_0x274a43,null))[_0xa31f('0x1c')](function(_0x527081){if(_0x527081){_0x112d7d=_0x527081;_0x5da8d0['model']=_[_0xa31f('0xc6')](db[_0xa31f('0xa1')][_0xa31f('0x30')]);_0x5da8d0[_0xa31f('0x39')]=_[_0xa31f('0xc6')](_0xc4475c[_0xa31f('0x39')]);_0x5da8d0[_0xa31f('0xc8')]=_['intersection'](_0x5da8d0['model'],_0x5da8d0[_0xa31f('0x39')]);_0x12b813[_0xa31f('0x3f')]=_[_0xa31f('0xc9')](_0x5da8d0[_0xa31f('0xca')],qs['fields'](_0xc4475c[_0xa31f('0x39')]['fields']));_0x12b813[_0xa31f('0x3f')]=_0x12b813[_0xa31f('0x3f')]['length']?_0x12b813[_0xa31f('0x3f')]:_0x5da8d0[_0xa31f('0xca')];_0x12b813['order']=qs[_0xa31f('0xcd')](_0xc4475c[_0xa31f('0x39')]['sort']);_0x12b813[_0xa31f('0x38')]=qs[_0xa31f('0xc8')](_[_0xa31f('0xce')](_0xc4475c[_0xa31f('0x39')],_0x5da8d0[_0xa31f('0xc8')]));if(_0xc4475c['query'][_0xa31f('0x26')]){_0x12b813[_0xa31f('0x38')]=_[_0xa31f('0x4b')](_0x12b813[_0xa31f('0x38')],{'$or':_['map'](_0x12b813[_0xa31f('0x3f')],function(_0x163359){var _0x29df68={};_0x29df68[_0x163359]={'$like':'%'+_0xc4475c['query'][_0xa31f('0x26')]+'%'};return _0x29df68;})});}_0x12b813=_[_0xa31f('0x4b')]({},_0x12b813,_0xc4475c[_0xa31f('0x4c')]);return _0x112d7d[_0xa31f('0xd1')](_0x12b813);}})[_0xa31f('0x1c')](function(_0x294c74){if(_0x294c74){_0x4714fe=_0x294c74[_0xa31f('0x41')];if(!_0xc4475c[_0xa31f('0x39')][_0xa31f('0xbf')](_0xa31f('0xd0'))){_0x12b813[_0xa31f('0x18')]=qs[_0xa31f('0x18')](_0xc4475c[_0xa31f('0x39')][_0xa31f('0x18')]);_0x12b813['offset']=qs[_0xa31f('0x15')](_0xc4475c[_0xa31f('0x39')][_0xa31f('0x15')]);}return _0x112d7d[_0xa31f('0xd1')](_0x12b813);}})[_0xa31f('0x1c')](function(_0x1e15b2){if(_0x1e15b2){return _0x1e15b2?{'count':_0x4714fe,'rows':_0x1e15b2}:null;}})[_0xa31f('0x1c')](respondWithResult(_0x274a43,null))[_0xa31f('0x49')](handleError(_0x274a43,null));};exports[_0xa31f('0xd2')]=function(_0x4e501e,_0x405db0){var _0x7aaf30={};var _0x331bb2={};var _0x2eec32;var _0x2dc914;return db['User']['findOne']({'where':{'id':_0x4e501e[_0xa31f('0x54')]['id']}})[_0xa31f('0x1c')](handleEntityNotFound(_0x405db0,null))['then'](function(_0x3f1eb5){if(_0x3f1eb5){_0x2eec32=_0x3f1eb5;_0x331bb2[_0xa31f('0xca')]=_[_0xa31f('0xc6')](db['ChatGroup'][_0xa31f('0x30')]);_0x331bb2['query']=_['keys'](_0x4e501e[_0xa31f('0x39')]);_0x331bb2[_0xa31f('0xc8')]=_['intersection'](_0x331bb2[_0xa31f('0xca')],_0x331bb2[_0xa31f('0x39')]);_0x7aaf30['attributes']=_['intersection'](_0x331bb2[_0xa31f('0xca')],qs[_0xa31f('0xcb')](_0x4e501e[_0xa31f('0x39')][_0xa31f('0xcb')]));_0x7aaf30['attributes']=_0x7aaf30[_0xa31f('0x3f')][_0xa31f('0x41')]?_0x7aaf30[_0xa31f('0x3f')]:_0x331bb2[_0xa31f('0xca')];_0x7aaf30[_0xa31f('0xcc')]=qs[_0xa31f('0xcd')](_0x4e501e[_0xa31f('0x39')]['sort']);_0x7aaf30['where']=qs[_0xa31f('0xc8')](_[_0xa31f('0xce')](_0x4e501e[_0xa31f('0x39')],_0x331bb2[_0xa31f('0xc8')]));if(_0x4e501e['query']['filter']){_0x7aaf30[_0xa31f('0x38')]=_['merge'](_0x7aaf30[_0xa31f('0x38')],{'$or':_[_0xa31f('0x28')](_0x7aaf30[_0xa31f('0x3f')],function(_0x595ef2){var _0x5b85ea={};_0x5b85ea[_0x595ef2]={'$like':'%'+_0x4e501e[_0xa31f('0x39')]['filter']+'%'};return _0x5b85ea;})});}_0x7aaf30=_['merge']({},_0x7aaf30,_0x4e501e[_0xa31f('0x4c')]);return _0x2eec32[_0xa31f('0xd2')](_0x7aaf30);}})[_0xa31f('0x1c')](function(_0xb5e757){if(_0xb5e757){_0x2dc914=_0xb5e757[_0xa31f('0x41')];if(!_0x4e501e[_0xa31f('0x39')][_0xa31f('0xbf')](_0xa31f('0xd0'))){_0x7aaf30[_0xa31f('0x18')]=qs['limit'](_0x4e501e[_0xa31f('0x39')]['limit']);_0x7aaf30[_0xa31f('0x15')]=qs[_0xa31f('0x15')](_0x4e501e['query'][_0xa31f('0x15')]);}return _0x2eec32[_0xa31f('0xd2')](_0x7aaf30);}})[_0xa31f('0x1c')](function(_0xbfbcd6){if(_0xbfbcd6){return _0xbfbcd6?{'count':_0x2dc914,'rows':_0xbfbcd6}:null;}})[_0xa31f('0x1c')](respondWithResult(_0x405db0,null))[_0xa31f('0x49')](handleError(_0x405db0,null));};exports[_0xa31f('0xd3')]=function(_0x5fcfb4,_0x300b5b){var _0x20153c={'raw':!![],'where':{}};var _0x677f4e={};var _0x4237ee={'count':0x0,'rows':[]};return db[_0xa31f('0x2f')]['findOne']({'where':{'id':_0x5fcfb4[_0xa31f('0x54')]['id']}})[_0xa31f('0x1c')](handleEntityNotFound(_0x300b5b,null))[_0xa31f('0x1c')](function(_0x5478c4){if(_0x5478c4){_0x677f4e[_0xa31f('0xca')]=_[_0xa31f('0xc6')](db[_0xa31f('0xd4')][_0xa31f('0x30')]);_0x677f4e['query']=_[_0xa31f('0xc6')](_0x5fcfb4[_0xa31f('0x39')]);_0x677f4e[_0xa31f('0xc8')]=_[_0xa31f('0xc9')](_0x677f4e[_0xa31f('0xca')],_0x677f4e[_0xa31f('0x39')]);_0x20153c[_0xa31f('0x3f')]=_[_0xa31f('0xc9')](_0x677f4e[_0xa31f('0xca')],qs[_0xa31f('0xcb')](_0x5fcfb4[_0xa31f('0x39')][_0xa31f('0xcb')]));_0x20153c[_0xa31f('0x3f')]=_0x20153c[_0xa31f('0x3f')][_0xa31f('0x41')]?_0x20153c[_0xa31f('0x3f')]:_0x677f4e[_0xa31f('0xca')];if(!_0x5fcfb4['query']['hasOwnProperty'](_0xa31f('0xd0'))){_0x20153c['limit']=qs[_0xa31f('0x18')](_0x5fcfb4[_0xa31f('0x39')][_0xa31f('0x18')]);_0x20153c[_0xa31f('0x15')]=qs[_0xa31f('0x15')](_0x5fcfb4[_0xa31f('0x39')][_0xa31f('0x15')]);}_0x20153c[_0xa31f('0xcc')]=qs[_0xa31f('0xcd')](_0x5fcfb4['query'][_0xa31f('0xcd')]);_0x20153c[_0xa31f('0x38')]=qs[_0xa31f('0xc8')](_[_0xa31f('0xce')](_0x5fcfb4[_0xa31f('0x39')],_0x677f4e[_0xa31f('0xc8')]));_0x20153c[_0xa31f('0x38')]['UserId']=_0x5478c4['id'];if(_0x5fcfb4[_0xa31f('0x39')][_0xa31f('0x26')]){_0x20153c[_0xa31f('0x38')]=_[_0xa31f('0x4b')](_0x20153c['where'],{'$or':_['map'](_0x20153c['attributes'],function(_0x1a709b){var _0x10e798={};_0x10e798[_0x1a709b]={'$like':'%'+_0x5fcfb4[_0xa31f('0x39')]['filter']+'%'};return _0x10e798;})});}_0x20153c=_[_0xa31f('0x4b')]({},_0x20153c,_0x5fcfb4[_0xa31f('0x4c')]);return db[_0xa31f('0xd4')][_0xa31f('0x17')]({'where':_0x20153c[_0xa31f('0x38')]})['then'](function(_0x4079f3){_0x4237ee[_0xa31f('0x17')]=_0x4079f3;if(_0x5fcfb4[_0xa31f('0x39')][_0xa31f('0x3a')]){_0x20153c[_0xa31f('0x3b')]=[{'all':!![]}];}return db[_0xa31f('0xd4')][_0xa31f('0x40')](_0x20153c);})[_0xa31f('0x1c')](function(_0x31742e){_0x4237ee['rows']=_0x31742e;return _0x4237ee;});}})[_0xa31f('0x1c')](respondWithFilteredResult(_0x300b5b,_0x20153c))[_0xa31f('0x49')](handleError(_0x300b5b,null));};exports[_0xa31f('0xd5')]=function(_0x4d441f,_0x27d414){var _0x440a01={'raw':!![],'where':{}};var _0x404487={};var _0xa60e9b={'count':0x0,'rows':[]};return db[_0xa31f('0x2f')][_0xa31f('0x8e')]({'where':{'id':_0x4d441f[_0xa31f('0x54')]['id']}})[_0xa31f('0x1c')](handleEntityNotFound(_0x27d414,null))[_0xa31f('0x1c')](function(_0x47f0f8){if(_0x47f0f8){_0x404487['model']=_['keys'](db[_0xa31f('0xd6')][_0xa31f('0x30')]);_0x404487[_0xa31f('0x39')]=_[_0xa31f('0xc6')](_0x4d441f[_0xa31f('0x39')]);_0x404487['filters']=_['intersection'](_0x404487[_0xa31f('0xca')],_0x404487['query']);_0x440a01['attributes']=_[_0xa31f('0xc9')](_0x404487[_0xa31f('0xca')],qs[_0xa31f('0xcb')](_0x4d441f[_0xa31f('0x39')][_0xa31f('0xcb')]));_0x440a01[_0xa31f('0x3f')]=_0x440a01[_0xa31f('0x3f')]['length']?_0x440a01['attributes']:_0x404487[_0xa31f('0xca')];if(!_0x4d441f[_0xa31f('0x39')][_0xa31f('0xbf')](_0xa31f('0xd0'))){_0x440a01[_0xa31f('0x18')]=qs['limit'](_0x4d441f['query'][_0xa31f('0x18')]);_0x440a01[_0xa31f('0x15')]=qs[_0xa31f('0x15')](_0x4d441f['query'][_0xa31f('0x15')]);}_0x440a01['order']=qs[_0xa31f('0xcd')](_0x4d441f[_0xa31f('0x39')][_0xa31f('0xcd')]);_0x440a01[_0xa31f('0x38')]=qs[_0xa31f('0xc8')](_[_0xa31f('0xce')](_0x4d441f[_0xa31f('0x39')],_0x404487[_0xa31f('0xc8')]));_0x440a01['where'][_0xa31f('0xd7')]=_0x47f0f8['id'];if(_0x4d441f[_0xa31f('0x39')][_0xa31f('0x26')]){_0x440a01[_0xa31f('0x38')]=_['merge'](_0x440a01[_0xa31f('0x38')],{'$or':_['map'](_0x440a01[_0xa31f('0x3f')],function(_0x126c5a){var _0x22721e={};_0x22721e[_0x126c5a]={'$like':'%'+_0x4d441f['query']['filter']+'%'};return _0x22721e;})});}_0x440a01=_['merge']({},_0x440a01,_0x4d441f['options']);return db[_0xa31f('0xd6')]['count']({'where':_0x440a01[_0xa31f('0x38')]})[_0xa31f('0x1c')](function(_0x452e74){_0xa60e9b['count']=_0x452e74;if(_0x4d441f['query'][_0xa31f('0x3a')]){_0x440a01[_0xa31f('0x3b')]=[{'all':!![]}];}return db['ScreenRecording'][_0xa31f('0x40')](_0x440a01);})['then'](function(_0x113b77){_0xa60e9b[_0xa31f('0x42')]=_0x113b77;return _0xa60e9b;});}})[_0xa31f('0x1c')](respondWithFilteredResult(_0x27d414,_0x440a01))[_0xa31f('0x49')](handleError(_0x27d414,null));};exports[_0xa31f('0xd8')]=function(_0x12ce73,_0xb553f1){var _0xcb70e1={};var _0x592dd6={};var _0x13abab;var _0x1b808c;return db[_0xa31f('0x2f')][_0xa31f('0x8e')]({'where':{'id':_0x12ce73['params']['id']}})['then'](handleEntityNotFound(_0xb553f1,null))[_0xa31f('0x1c')](function(_0x3f49f9){if(_0x3f49f9){_0x13abab=_0x3f49f9;_0x592dd6[_0xa31f('0xca')]=_[_0xa31f('0xc6')](db[_0xa31f('0xd9')]['rawAttributes']);_0x592dd6[_0xa31f('0x39')]=_[_0xa31f('0xc6')](_0x12ce73['query']);_0x592dd6[_0xa31f('0xc8')]=_[_0xa31f('0xc9')](_0x592dd6[_0xa31f('0xca')],_0x592dd6['query']);_0xcb70e1[_0xa31f('0x3f')]=_[_0xa31f('0xc9')](_0x592dd6['model'],qs[_0xa31f('0xcb')](_0x12ce73[_0xa31f('0x39')][_0xa31f('0xcb')]));_0xcb70e1[_0xa31f('0x3f')]=_0xcb70e1[_0xa31f('0x3f')][_0xa31f('0x41')]?_0xcb70e1['attributes']:_0x592dd6['model'];_0xcb70e1[_0xa31f('0xcc')]=qs[_0xa31f('0xcd')](_0x12ce73[_0xa31f('0x39')][_0xa31f('0xcd')]);_0xcb70e1[_0xa31f('0x38')]=qs['filters'](_['pick'](_0x12ce73[_0xa31f('0x39')],_0x592dd6[_0xa31f('0xc8')]));if(_0x12ce73[_0xa31f('0x39')]['filter']){_0xcb70e1[_0xa31f('0x38')]=_['merge'](_0xcb70e1['where'],{'$or':_['map'](_0xcb70e1[_0xa31f('0x3f')],function(_0x3ced39){var _0x140de3={};_0x140de3[_0x3ced39]={'$like':'%'+_0x12ce73['query']['filter']+'%'};return _0x140de3;})});}_0xcb70e1=_[_0xa31f('0x4b')]({},_0xcb70e1,_0x12ce73[_0xa31f('0x4c')]);return _0x13abab[_0xa31f('0xd8')](_0xcb70e1);}})[_0xa31f('0x1c')](function(_0x19ccdb){if(_0x19ccdb){_0x1b808c=_0x19ccdb[_0xa31f('0x41')];if(!_0x12ce73[_0xa31f('0x39')][_0xa31f('0xbf')]('nolimit')){_0xcb70e1['limit']=qs[_0xa31f('0x18')](_0x12ce73[_0xa31f('0x39')][_0xa31f('0x18')]);_0xcb70e1[_0xa31f('0x15')]=qs[_0xa31f('0x15')](_0x12ce73['query']['offset']);}return _0x13abab[_0xa31f('0xd8')](_0xcb70e1);}})[_0xa31f('0x1c')](function(_0x236b9f){if(_0x236b9f){return _0x236b9f?{'count':_0x1b808c,'rows':_0x236b9f}:null;}})['then'](respondWithResult(_0xb553f1,null))[_0xa31f('0x49')](handleError(_0xb553f1,null));};exports['getOpenchannelInteractions']=function(_0x52a878,_0x1fd521){var _0x11c8a9={};var _0x57861d={};var _0x3b863c;var _0x3e2efc;return db[_0xa31f('0x2f')][_0xa31f('0x8e')]({'where':{'id':_0x52a878[_0xa31f('0x54')]['id']}})['then'](handleEntityNotFound(_0x1fd521,null))['then'](function(_0x182784){if(_0x182784){_0x3b863c=_0x182784;_0x57861d[_0xa31f('0xca')]=_[_0xa31f('0xc6')](db[_0xa31f('0xda')][_0xa31f('0x30')]);_0x57861d[_0xa31f('0x39')]=_[_0xa31f('0xc6')](_0x52a878[_0xa31f('0x39')]);_0x57861d['filters']=_[_0xa31f('0xc9')](_0x57861d[_0xa31f('0xca')],_0x57861d[_0xa31f('0x39')]);_0x11c8a9[_0xa31f('0x3f')]=_[_0xa31f('0xc9')](_0x57861d[_0xa31f('0xca')],qs[_0xa31f('0xcb')](_0x52a878[_0xa31f('0x39')][_0xa31f('0xcb')]));_0x11c8a9[_0xa31f('0x3f')]=_0x11c8a9[_0xa31f('0x3f')]['length']?_0x11c8a9[_0xa31f('0x3f')]:_0x57861d[_0xa31f('0xca')];_0x11c8a9[_0xa31f('0xcc')]=qs[_0xa31f('0xcd')](_0x52a878['query'][_0xa31f('0xcd')]);_0x11c8a9['where']=qs[_0xa31f('0xc8')](_[_0xa31f('0xce')](_0x52a878[_0xa31f('0x39')],_0x57861d['filters']));if(_0x52a878[_0xa31f('0x39')]['filter']){_0x11c8a9[_0xa31f('0x38')]=_[_0xa31f('0x4b')](_0x11c8a9['where'],{'$or':_[_0xa31f('0x28')](_0x11c8a9[_0xa31f('0x3f')],function(_0x3c2548){var _0x2b4807={};_0x2b4807[_0x3c2548]={'$like':'%'+_0x52a878[_0xa31f('0x39')][_0xa31f('0x26')]+'%'};return _0x2b4807;})});}_0x11c8a9=_[_0xa31f('0x4b')]({},_0x11c8a9,_0x52a878[_0xa31f('0x4c')]);return _0x3b863c[_0xa31f('0xdb')](_0x11c8a9);}})['then'](function(_0xc152ed){if(_0xc152ed){_0x3e2efc=_0xc152ed[_0xa31f('0x41')];if(!_0x52a878[_0xa31f('0x39')][_0xa31f('0xbf')](_0xa31f('0xd0'))){_0x11c8a9[_0xa31f('0x18')]=qs[_0xa31f('0x18')](_0x52a878[_0xa31f('0x39')]['limit']);_0x11c8a9['offset']=qs['offset'](_0x52a878['query'][_0xa31f('0x15')]);}return _0x3b863c[_0xa31f('0xdb')](_0x11c8a9);}})['then'](function(_0x441e9e){if(_0x441e9e){return _0x441e9e?{'count':_0x3e2efc,'rows':_0x441e9e}:null;}})[_0xa31f('0x1c')](respondWithResult(_0x1fd521,null))[_0xa31f('0x49')](handleError(_0x1fd521,null));};exports[_0xa31f('0xdc')]=function(_0x31f97b,_0xd0fb4b){var _0x3cf6aa={'raw':!![],'where':{}};var _0x2f9735={};var _0x264e0b={'count':0x0,'rows':[]};return db[_0xa31f('0x2f')][_0xa31f('0x8e')]({'where':{'id':_0x31f97b[_0xa31f('0x54')]['id']}})[_0xa31f('0x1c')](handleEntityNotFound(_0xd0fb4b,null))[_0xa31f('0x1c')](function(_0x38c03d){if(_0x38c03d){_0x2f9735['model']=_[_0xa31f('0xc6')](db[_0xa31f('0xdd')][_0xa31f('0x30')]);_0x2f9735[_0xa31f('0x39')]=_['keys'](_0x31f97b['query']);_0x2f9735['filters']=_[_0xa31f('0xc9')](_0x2f9735[_0xa31f('0xca')],_0x2f9735['query']);_0x3cf6aa[_0xa31f('0x3f')]=_[_0xa31f('0xc9')](_0x2f9735['model'],qs['fields'](_0x31f97b[_0xa31f('0x39')][_0xa31f('0xcb')]));_0x3cf6aa[_0xa31f('0x3f')]=_0x3cf6aa['attributes'][_0xa31f('0x41')]?_0x3cf6aa['attributes']:_0x2f9735[_0xa31f('0xca')];if(!_0x31f97b[_0xa31f('0x39')][_0xa31f('0xbf')](_0xa31f('0xd0'))){_0x3cf6aa[_0xa31f('0x18')]=qs[_0xa31f('0x18')](_0x31f97b[_0xa31f('0x39')][_0xa31f('0x18')]);_0x3cf6aa[_0xa31f('0x15')]=qs['offset'](_0x31f97b['query'][_0xa31f('0x15')]);}_0x3cf6aa[_0xa31f('0xcc')]=qs['sort'](_0x31f97b[_0xa31f('0x39')][_0xa31f('0xcd')]);_0x3cf6aa[_0xa31f('0x38')]=qs[_0xa31f('0xc8')](_[_0xa31f('0xce')](_0x31f97b['query'],_0x2f9735[_0xa31f('0xc8')]));_0x3cf6aa['where']['UserId']=_0x38c03d['id'];if(_0x31f97b['query'][_0xa31f('0x26')]){_0x3cf6aa['where']=_[_0xa31f('0x4b')](_0x3cf6aa['where'],{'$or':_['map'](_0x3cf6aa[_0xa31f('0x3f')],function(_0x52a395){var _0x1a9a59={};_0x1a9a59[_0x52a395]={'$like':'%'+_0x31f97b[_0xa31f('0x39')]['filter']+'%'};return _0x1a9a59;})});}_0x3cf6aa=_[_0xa31f('0x4b')]({},_0x3cf6aa,_0x31f97b[_0xa31f('0x4c')]);return db[_0xa31f('0xdd')]['count']({'where':_0x3cf6aa[_0xa31f('0x38')]})[_0xa31f('0x1c')](function(_0x589e48){_0x264e0b[_0xa31f('0x17')]=_0x589e48;if(_0x31f97b[_0xa31f('0x39')][_0xa31f('0x3a')]){_0x3cf6aa['include']=[{'all':!![]}];}return db[_0xa31f('0xdd')][_0xa31f('0x40')](_0x3cf6aa);})[_0xa31f('0x1c')](function(_0x5d7860){_0x264e0b['rows']=_0x5d7860;return _0x264e0b;});}})[_0xa31f('0x1c')](respondWithFilteredResult(_0xd0fb4b,_0x3cf6aa))[_0xa31f('0x49')](handleError(_0xd0fb4b,null));};exports[_0xa31f('0xde')]=function(_0x5a6a32,_0x78a1b2){var _0x5e77d7={};var _0x32266d={};var _0x448db9;var _0x2ff6be;return db[_0xa31f('0x2f')][_0xa31f('0x8e')]({'where':{'id':_0x5a6a32[_0xa31f('0x54')]['id']}})[_0xa31f('0x1c')](handleEntityNotFound(_0x78a1b2,null))['then'](function(_0x1fbc7a){if(_0x1fbc7a){_0x448db9=_0x1fbc7a;_0x32266d[_0xa31f('0xca')]=_[_0xa31f('0xc6')](db[_0xa31f('0xdf')]['rawAttributes']);_0x32266d[_0xa31f('0x39')]=_[_0xa31f('0xc6')](_0x5a6a32[_0xa31f('0x39')]);_0x32266d[_0xa31f('0xc8')]=_[_0xa31f('0xc9')](_0x32266d[_0xa31f('0xca')],_0x32266d[_0xa31f('0x39')]);_0x5e77d7[_0xa31f('0x3f')]=_[_0xa31f('0xc9')](_0x32266d[_0xa31f('0xca')],qs[_0xa31f('0xcb')](_0x5a6a32[_0xa31f('0x39')]['fields']));_0x5e77d7[_0xa31f('0x3f')]=_0x5e77d7[_0xa31f('0x3f')]['length']?_0x5e77d7[_0xa31f('0x3f')]:_0x32266d[_0xa31f('0xca')];_0x5e77d7['order']=qs['sort'](_0x5a6a32[_0xa31f('0x39')][_0xa31f('0xcd')]);_0x5e77d7[_0xa31f('0x38')]=qs[_0xa31f('0xc8')](_[_0xa31f('0xce')](_0x5a6a32[_0xa31f('0x39')],_0x32266d[_0xa31f('0xc8')]));if(_0x5a6a32['query'][_0xa31f('0x26')]){_0x5e77d7[_0xa31f('0x38')]=_[_0xa31f('0x4b')](_0x5e77d7[_0xa31f('0x38')],{'$or':_[_0xa31f('0x28')](_0x5e77d7[_0xa31f('0x3f')],function(_0x3a7916){var _0x34d106={};_0x34d106[_0x3a7916]={'$like':'%'+_0x5a6a32[_0xa31f('0x39')][_0xa31f('0x26')]+'%'};return _0x34d106;})});}_0x5e77d7=_['merge']({},_0x5e77d7,_0x5a6a32[_0xa31f('0x4c')]);return _0x448db9[_0xa31f('0xde')](_0x5e77d7);}})[_0xa31f('0x1c')](function(_0x5ac077){if(_0x5ac077){_0x2ff6be=_0x5ac077['length'];if(!_0x5a6a32[_0xa31f('0x39')][_0xa31f('0xbf')](_0xa31f('0xd0'))){_0x5e77d7['limit']=qs[_0xa31f('0x18')](_0x5a6a32[_0xa31f('0x39')][_0xa31f('0x18')]);_0x5e77d7[_0xa31f('0x15')]=qs[_0xa31f('0x15')](_0x5a6a32['query'][_0xa31f('0x15')]);}return _0x448db9[_0xa31f('0xde')](_0x5e77d7);}})[_0xa31f('0x1c')](function(_0x4a28e4){if(_0x4a28e4){return _0x4a28e4?{'count':_0x2ff6be,'rows':_0x4a28e4}:null;}})[_0xa31f('0x1c')](respondWithResult(_0x78a1b2,null))[_0xa31f('0x49')](handleError(_0x78a1b2,null));};exports[_0xa31f('0xe0')]=function(_0x4ef11e,_0x3b950b){var _0x30d2cd={};var _0x3a5710={};var _0x3df145;var _0x5a46aa;return db[_0xa31f('0x2f')][_0xa31f('0x8e')]({'where':{'id':_0x4ef11e[_0xa31f('0x54')]['id']}})[_0xa31f('0x1c')](handleEntityNotFound(_0x3b950b,null))[_0xa31f('0x1c')](function(_0x344761){if(_0x344761){_0x3df145=_0x344761;_0x3a5710[_0xa31f('0xca')]=_[_0xa31f('0xc6')](db[_0xa31f('0xe1')][_0xa31f('0x30')]);_0x3a5710[_0xa31f('0x39')]=_[_0xa31f('0xc6')](_0x4ef11e[_0xa31f('0x39')]);_0x3a5710[_0xa31f('0xc8')]=_[_0xa31f('0xc9')](_0x3a5710[_0xa31f('0xca')],_0x3a5710[_0xa31f('0x39')]);_0x30d2cd[_0xa31f('0x3f')]=_[_0xa31f('0xc9')](_0x3a5710[_0xa31f('0xca')],qs['fields'](_0x4ef11e[_0xa31f('0x39')]['fields']));_0x30d2cd['attributes']=_0x30d2cd['attributes'][_0xa31f('0x41')]?_0x30d2cd[_0xa31f('0x3f')]:_0x3a5710[_0xa31f('0xca')];_0x30d2cd[_0xa31f('0xcc')]=qs['sort'](_0x4ef11e[_0xa31f('0x39')][_0xa31f('0xcd')]);_0x30d2cd[_0xa31f('0x38')]=qs[_0xa31f('0xc8')](_[_0xa31f('0xce')](_0x4ef11e[_0xa31f('0x39')],_0x3a5710[_0xa31f('0xc8')]));if(_0x4ef11e[_0xa31f('0x39')][_0xa31f('0x26')]){_0x30d2cd[_0xa31f('0x38')]=_[_0xa31f('0x4b')](_0x30d2cd[_0xa31f('0x38')],{'$or':_['map'](_0x30d2cd[_0xa31f('0x3f')],function(_0x2a285c){var _0x3ac784={};_0x3ac784[_0x2a285c]={'$like':'%'+_0x4ef11e[_0xa31f('0x39')][_0xa31f('0x26')]+'%'};return _0x3ac784;})});}_0x30d2cd=_[_0xa31f('0x4b')]({},_0x30d2cd,_0x4ef11e['options']);return _0x3df145['getFaxInteractions'](_0x30d2cd);}})[_0xa31f('0x1c')](function(_0x412ff4){if(_0x412ff4){_0x5a46aa=_0x412ff4[_0xa31f('0x41')];if(!_0x4ef11e[_0xa31f('0x39')][_0xa31f('0xbf')](_0xa31f('0xd0'))){_0x30d2cd[_0xa31f('0x18')]=qs[_0xa31f('0x18')](_0x4ef11e[_0xa31f('0x39')][_0xa31f('0x18')]);_0x30d2cd['offset']=qs[_0xa31f('0x15')](_0x4ef11e['query'][_0xa31f('0x15')]);}return _0x3df145[_0xa31f('0xe0')](_0x30d2cd);}})[_0xa31f('0x1c')](function(_0x506849){if(_0x506849){return _0x506849?{'count':_0x5a46aa,'rows':_0x506849}:null;}})[_0xa31f('0x1c')](respondWithResult(_0x3b950b,null))[_0xa31f('0x49')](handleError(_0x3b950b,null));};exports[_0xa31f('0xe2')]=function(_0x1e9804,_0x40f6fd){var _0x3b5269={};var _0x434915={};var _0x2f2c13;var _0x293d09;return db[_0xa31f('0x2f')][_0xa31f('0x8e')]({'where':{'id':_0x1e9804[_0xa31f('0x54')]['id']}})['then'](handleEntityNotFound(_0x40f6fd,null))[_0xa31f('0x1c')](function(_0x23fd17){if(_0x23fd17){_0x2f2c13=_0x23fd17;_0x434915[_0xa31f('0xca')]=_[_0xa31f('0xc6')](db['WhatsappInteraction']['rawAttributes']);_0x434915[_0xa31f('0x39')]=_[_0xa31f('0xc6')](_0x1e9804[_0xa31f('0x39')]);_0x434915['filters']=_[_0xa31f('0xc9')](_0x434915[_0xa31f('0xca')],_0x434915['query']);_0x3b5269[_0xa31f('0x3f')]=_['intersection'](_0x434915['model'],qs[_0xa31f('0xcb')](_0x1e9804[_0xa31f('0x39')][_0xa31f('0xcb')]));_0x3b5269[_0xa31f('0x3f')]=_0x3b5269[_0xa31f('0x3f')][_0xa31f('0x41')]?_0x3b5269[_0xa31f('0x3f')]:_0x434915[_0xa31f('0xca')];_0x3b5269[_0xa31f('0xcc')]=qs[_0xa31f('0xcd')](_0x1e9804[_0xa31f('0x39')]['sort']);_0x3b5269[_0xa31f('0x38')]=qs[_0xa31f('0xc8')](_[_0xa31f('0xce')](_0x1e9804[_0xa31f('0x39')],_0x434915[_0xa31f('0xc8')]));if(_0x1e9804[_0xa31f('0x39')][_0xa31f('0x26')]){_0x3b5269[_0xa31f('0x38')]=_[_0xa31f('0x4b')](_0x3b5269[_0xa31f('0x38')],{'$or':_[_0xa31f('0x28')](_0x3b5269[_0xa31f('0x3f')],function(_0x2a4783){var _0x1b8e38={};_0x1b8e38[_0x2a4783]={'$like':'%'+_0x1e9804[_0xa31f('0x39')][_0xa31f('0x26')]+'%'};return _0x1b8e38;})});}_0x3b5269=_[_0xa31f('0x4b')]({},_0x3b5269,_0x1e9804['options']);return _0x2f2c13['getWhatsappInteractions'](_0x3b5269);}})['then'](function(_0x112954){if(_0x112954){_0x293d09=_0x112954['length'];if(!_0x1e9804[_0xa31f('0x39')][_0xa31f('0xbf')]('nolimit')){_0x3b5269[_0xa31f('0x18')]=qs[_0xa31f('0x18')](_0x1e9804[_0xa31f('0x39')][_0xa31f('0x18')]);_0x3b5269[_0xa31f('0x15')]=qs[_0xa31f('0x15')](_0x1e9804[_0xa31f('0x39')]['offset']);}return _0x2f2c13['getWhatsappInteractions'](_0x3b5269);}})[_0xa31f('0x1c')](function(_0x33a88f){if(_0x33a88f){return _0x33a88f?{'count':_0x293d09,'rows':_0x33a88f}:null;}})[_0xa31f('0x1c')](respondWithResult(_0x40f6fd,null))[_0xa31f('0x49')](handleError(_0x40f6fd,null));};exports[_0xa31f('0xe3')]=function(_0x438309,_0x35b87e,_0x50c1f2){var _0x2ae83a;var _0x2b2942;var _0xe2776b;var _0xd477ce=!_[_0xa31f('0x5d')](_0x438309[_0xa31f('0x54')]['id'])?_0x438309[_0xa31f('0x54')]['id']:!_[_0xa31f('0x5d')](_0x438309[_0xa31f('0x22')]['id'])?_0x438309['user']['id']:null;return db[_0xa31f('0x2f')]['find']({'where':{'id':_0xd477ce,'role':{'$or':[_0xa31f('0x76'),_0xa31f('0x22'),_0xa31f('0x1e')]}},'attributes':['id',_0xa31f('0x2d'),_0xa31f('0xe4'),_0xa31f('0xe5'),_0xa31f('0x1d'),'internal',_0xa31f('0x94')]})[_0xa31f('0x1c')](function(_0x138ff4){if(_0x138ff4){if(_0x138ff4[_0xa31f('0x1d')]===_0xa31f('0x1e')){_0x2ae83a=_0x138ff4;if(_0x438309[_0xa31f('0x51')][_0xa31f('0x9f')]){_0xe2776b=util[_0xa31f('0x9d')](_0xa31f('0xe6'),_0x2ae83a[_0x438309[_0xa31f('0x51')]['interface']]);}else if(_0x438309[_0xa31f('0x51')][_0xa31f('0xe7')]){_0xe2776b=util['format'](_0xa31f('0x9e'),_0x438309[_0xa31f('0x51')][_0xa31f('0xe7')]);}else{_0xe2776b=util[_0xa31f('0x9d')](_0xa31f('0x9e'),_0x2ae83a[_0xa31f('0x2d')]);}socket['to'](util[_0xa31f('0x9d')](_0xa31f('0xe8'),_0x2ae83a['name']))['emit'](_0xa31f('0xe9'),{'user':{'id':_0x2ae83a['id'],'name':_0x2ae83a[_0xa31f('0x2d')]},'ip':_0x438309[_0xa31f('0xea')]['x-forwarded-for']||_0x438309['connection'][_0xa31f('0xeb')]||_0x438309['socket'][_0xa31f('0xeb')]||_0x438309[_0xa31f('0xec')][_0xa31f('0xed')][_0xa31f('0xeb')]});return db[_0xa31f('0xa1')][_0xa31f('0x20')]({'where':{'membername':_0x2ae83a[_0xa31f('0x2d')]},'individualHooks':!![]});}}else{throw new db[(_0xa31f('0x89'))][(_0xa31f('0x8a'))](_0xa31f('0xee'));}})[_0xa31f('0x1c')](function(){if(_0x2ae83a){return _0x2ae83a[_0xa31f('0xef')]({'raw':!![]});}})['then'](function(_0x14783c){if(_0x2ae83a){if(_0x14783c){_0x2b2942=_0x14783c;if(_0x2b2942[_0xa31f('0x41')]){var _0x550c05=_0x2b2942['map'](function(_0x4fe427){var _0x105a62={'membername':_0x2ae83a[_0xa31f('0x2d')],'UserId':_0x2ae83a['id'],'queue_name':_0x4fe427[_0xa31f('0x2d')],'VoiceQueueId':_0x4fe427['id'],'interface':_0xe2776b,'paused':_0x2ae83a[_0xa31f('0x94')]||![],'penalty':_0x4fe427[_0xa31f('0xf0')]||0x0};return db[_0xa31f('0xa1')]['upsert'](_0x105a62);});return Promise[_0xa31f('0x82')](_0x550c05);}}}})[_0xa31f('0x1c')](function(){if(_0x2ae83a){return db[_0xa31f('0xf1')]['findAll']({'where':{'membername':_0x2ae83a[_0xa31f('0x2d')],'exitAt':null}});}})[_0xa31f('0x1c')](function(_0x2e46ea){if(_0x2ae83a){var _0x490483=[];_0x2e46ea['forEach'](function(_0x22c926){_0x490483[_0xa31f('0x44')](_0x22c926[_0xa31f('0x1b')]({'exitAt':moment()[_0xa31f('0x9d')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xa31f('0x82')](_0x490483);}})[_0xa31f('0x1c')](function(){if(_0x2ae83a){var _0x54284a=[];var _0x45ec2a=[];var _0x4321a1=utils['getChannels']();var _0x3f6fcf={'membername':_0x2ae83a['name'],'interface':_0xe2776b,'enterAt':moment()['format'](_0xa31f('0xf2')),'role':_0x2ae83a[_0xa31f('0x1d')],'internal':_0x2ae83a[_0xa31f('0x5b')]};_0x4321a1[_0xa31f('0xf3')](function(_0x5c5d7b){_0x54284a[_0xa31f('0x44')](_['merge']({'channel':_0x5c5d7b,'type':_0xa31f('0xf4'),'data1':_0x438309[_0xa31f('0x51')]['device'],'data2':_0xe2776b},_0x3f6fcf));if(_0x2ae83a['loginInPause']){_0x45ec2a[_0xa31f('0x44')](_[_0xa31f('0x4b')]({'channel':_0x5c5d7b,'type':'PAUSE','data1':_0xa31f('0xf5')},_0x3f6fcf));}});return db[_0xa31f('0xf1')]['bulkCreate'](_0x54284a[_0xa31f('0xbd')](_0x45ec2a),{'individualHooks':!![]});}})[_0xa31f('0x1c')](function(){if(_0x2ae83a){return _0x2ae83a[_0xa31f('0x1b')]({'online':!![],'lastLoginAt':moment()[_0xa31f('0x9d')](_0xa31f('0xf2')),'voicePause':_0x2ae83a[_0xa31f('0x94')]||![],'mailPause':_0x2ae83a['loginInPause']||![],'chatPause':_0x2ae83a['loginInPause']||![],'faxPause':_0x2ae83a[_0xa31f('0x94')]||![],'smsPause':_0x2ae83a['loginInPause']||![],'openchannelPause':_0x2ae83a[_0xa31f('0x94')]||![],'whatsappPause':_0x2ae83a[_0xa31f('0x94')]||![],'pauseType':_0x2ae83a['loginInPause']?_0xa31f('0xf5'):null,'interface':_0xe2776b,'lastPauseAt':moment()[_0xa31f('0x9d')](_0xa31f('0xf2'))});}})[_0xa31f('0x1c')](function(_0x254269){if(_0x438309[_0xa31f('0xf6')]){return _0x50c1f2();}else{return Promise[_0xa31f('0xf7')](_0x254269)[_0xa31f('0x1c')](respondWithResult(_0x35b87e,null));}})[_0xa31f('0x49')](handleError(_0x35b87e,null));};exports[_0xa31f('0xf8')]=function(_0x5ec4f3,_0x25b104){var _0x4454cc;return db['User']['find']({'where':{'id':_0x5ec4f3[_0xa31f('0x54')]['id'],'role':_0xa31f('0x1e')},'attributes':['id',_0xa31f('0x2d'),_0xa31f('0x1d')]})[_0xa31f('0x1c')](handleEntityNotFound(_0x25b104,null))[_0xa31f('0x1c')](function(_0x3ad4ab){if(_0x3ad4ab){_0x4454cc=_0x3ad4ab;return db[_0xa31f('0xa1')][_0xa31f('0x20')]({'where':{'membername':_0x4454cc['name']},'individualHooks':!![]});}})[_0xa31f('0x1c')](function(){return db[_0xa31f('0xf1')][_0xa31f('0x40')]({'where':{'membername':_0x4454cc[_0xa31f('0x2d')],'exitAt':null}});})['then'](function(_0x4f3df8){var _0x34f3ea=[];_0x4f3df8[_0xa31f('0xf3')](function(_0x419977){_0x34f3ea[_0xa31f('0x44')](_0x419977[_0xa31f('0x1b')]({'exitAt':moment()[_0xa31f('0x9d')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x34f3ea);})[_0xa31f('0x1c')](function(){return _0x4454cc[_0xa31f('0x1b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa31f('0x1c')](respondWithResult(_0x25b104,null))[_0xa31f('0x49')](handleError(_0x25b104,null));};exports['pause']=function(_0x59723e,_0x4b9ae8){var _0x3c7490;return db[_0xa31f('0xa1')][_0xa31f('0x1b')]({'paused':0x1},{'where':{'UserId':_0x59723e[_0xa31f('0x54')]['id']},'individualHooks':!![]})[_0xa31f('0x1c')](function(){return db[_0xa31f('0x2f')][_0xa31f('0x4d')]({'where':{'id':_0x59723e[_0xa31f('0x54')]['id'],'role':_0xa31f('0x1e')},'attributes':['id',_0xa31f('0x2d'),_0xa31f('0x1d'),_0xa31f('0x5b'),_0xa31f('0x9f'),_0xa31f('0x93')]});})['then'](handleEntityNotFound(_0x4b9ae8,null))[_0xa31f('0x1c')](function(_0x436466){if(_0x436466){_0x3c7490=_0x436466;return db[_0xa31f('0xf1')][_0xa31f('0x40')]({'where':{'membername':_0x3c7490[_0xa31f('0x2d')],'type':_0xa31f('0xf9'),'exitAt':null}});}})[_0xa31f('0x1c')](function(_0x2212a9){if(_0x2212a9[_0xa31f('0x41')]){var _0x2dc8e7=moment()['format'](_0xa31f('0xf2'));for(var _0x4cb725=0x0,_0x4c9081=_0x2212a9[_0xa31f('0x41')];_0x4cb725<_0x4c9081;_0x4cb725++){_0x2212a9[_0x4cb725]['updateAttributes']({'exitAt':_0x2dc8e7});}}})[_0xa31f('0x1c')](function(){var _0x2a59e6=[];var _0x3e3abf=utils[_0xa31f('0xfa')]();_0x3e3abf[_0xa31f('0xf3')](function(_0x50df33){_0x2a59e6[_0xa31f('0x44')]({'channel':_0x50df33,'membername':_0x3c7490[_0xa31f('0x2d')],'interface':_[_0xa31f('0x5d')](_0x3c7490[_0xa31f('0x9f')])?util['format'](_0xa31f('0x9e'),_0x3c7490[_0xa31f('0x2d')]):_0x3c7490[_0xa31f('0x9f')],'type':_0xa31f('0xf9'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x59723e['body']['type']||_0xa31f('0xfb'),'role':_0x3c7490[_0xa31f('0x1d')],'internal':_0x3c7490[_0xa31f('0x5b')]});});return db[_0xa31f('0xf1')]['bulkCreate'](_0x2a59e6,{'individualHooks':!![]});})[_0xa31f('0x1c')](function(){return _0x3c7490[_0xa31f('0x1b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x59723e[_0xa31f('0x51')][_0xa31f('0xfc')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xa31f('0x9d')](_0xa31f('0xf2'))});})[_0xa31f('0x1c')](respondWithResult(_0x4b9ae8,null))[_0xa31f('0x49')](handleError(_0x4b9ae8,null));};exports['unpause']=function(_0x4c11f3,_0x30973c){if(_0x4c11f3['body'][_0xa31f('0x92')]&&!utils['isValidChannel'](_0x4c11f3['body']['channel'])){throw new APIBadRequestError(util[_0xa31f('0x9d')](_0xa31f('0xfd'),_0x4c11f3['body'][_0xa31f('0x92')]));}return db[_0xa31f('0x2f')]['find']({'where':{'id':_0x4c11f3[_0xa31f('0x54')]['id']},'attributes':['id','name',_0xa31f('0x1d'),_0xa31f('0x5b'),_0xa31f('0x9f'),_0xa31f('0x93'),_0xa31f('0xa0'),'mailPause',_0xa31f('0xfe'),_0xa31f('0xff'),_0xa31f('0x100'),_0xa31f('0x101'),_0xa31f('0x102'),_0xa31f('0x103'),_0xa31f('0x104')]})[_0xa31f('0x1c')](function(_0x4d43d4){if(!_0x4d43d4){throw new APINotFoundError(util[_0xa31f('0x9d')]('User\x20with\x20id\x20%s\x20not\x20found',_0x4c11f3[_0xa31f('0x54')]['id']));}return _0x4d43d4['unpause'](_0x4c11f3[_0xa31f('0x51')][_0xa31f('0x92')]);})[_0xa31f('0x1c')](respondWithResult(_0x30973c,null))['catch'](APIHandleError(_0x30973c));};exports[_0xa31f('0x105')]=function(_0x1384b0,_0x17af6d){var _0x5cb09b={};var _0x530b3a={};var _0x45e2ff;var _0x33fff3;return db[_0xa31f('0x2f')][_0xa31f('0x8e')]({'where':{'id':_0x1384b0['params']['id']}})['then'](handleEntityNotFound(_0x17af6d,null))[_0xa31f('0x1c')](function(_0x191515){if(_0x191515){_0x45e2ff=_0x191515;_0x530b3a[_0xa31f('0xca')]=_[_0xa31f('0xc6')](db[_0xa31f('0x106')][_0xa31f('0x30')]);_0x530b3a[_0xa31f('0x39')]=_[_0xa31f('0xc6')](_0x1384b0[_0xa31f('0x39')]);_0x530b3a[_0xa31f('0xc8')]=_[_0xa31f('0xc9')](_0x530b3a[_0xa31f('0xca')],_0x530b3a[_0xa31f('0x39')]);_0x5cb09b[_0xa31f('0x3f')]=_[_0xa31f('0xc9')](_0x530b3a['model'],qs[_0xa31f('0xcb')](_0x1384b0[_0xa31f('0x39')]['fields']));_0x5cb09b[_0xa31f('0x3f')]=_0x5cb09b[_0xa31f('0x3f')][_0xa31f('0x41')]?_0x5cb09b[_0xa31f('0x3f')]:_0x530b3a[_0xa31f('0xca')];_0x5cb09b[_0xa31f('0xcc')]=qs[_0xa31f('0xcd')](_0x1384b0[_0xa31f('0x39')][_0xa31f('0xcd')]);_0x5cb09b['where']=qs[_0xa31f('0xc8')](_[_0xa31f('0xce')](_0x1384b0[_0xa31f('0x39')],_0x530b3a[_0xa31f('0xc8')]));if(_0x1384b0[_0xa31f('0x39')][_0xa31f('0x26')]){_0x5cb09b['where']=_['merge'](_0x5cb09b[_0xa31f('0x38')],{'$or':_['map'](_0x5cb09b['attributes'],function(_0x358631){var _0x260705={};_0x260705[_0x358631]={'$like':'%'+_0x1384b0[_0xa31f('0x39')]['filter']+'%'};return _0x260705;})});}_0x5cb09b=_[_0xa31f('0x4b')]({},_0x5cb09b,_0x1384b0[_0xa31f('0x4c')]);return _0x45e2ff['getTeams'](_0x5cb09b);}})[_0xa31f('0x1c')](function(_0xc2683){if(_0xc2683){_0x33fff3=_0xc2683[_0xa31f('0x41')];if(!_0x1384b0['query'][_0xa31f('0xbf')](_0xa31f('0xd0'))){_0x5cb09b['limit']=qs['limit'](_0x1384b0['query'][_0xa31f('0x18')]);_0x5cb09b['offset']=qs[_0xa31f('0x15')](_0x1384b0[_0xa31f('0x39')][_0xa31f('0x15')]);}return _0x45e2ff['getTeams'](_0x5cb09b);}})[_0xa31f('0x1c')](function(_0x37504a){if(_0x37504a){return _0x37504a?{'count':_0x33fff3,'rows':_0x37504a}:null;}})[_0xa31f('0x1c')](respondWithResult(_0x17af6d,null))[_0xa31f('0x49')](handleError(_0x17af6d,null));};exports[_0xa31f('0x107')]=function(_0x407785,_0x3e0d9a){var _0x5b0acf=_0x407785[_0xa31f('0x54')]['id'];var _0x303123=_0x407785[_0xa31f('0x51')]?_0x407785[_0xa31f('0x51')][_0xa31f('0x55')]:null;var _0x4d7796=[];return Promise[_0xa31f('0xf7')]()[_0xa31f('0x1c')](function(){if(!_0x303123)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xa31f('0x1c')](function(){return db[_0xa31f('0x2f')][_0xa31f('0x8e')]({'where':{'id':_0x5b0acf}});})[_0xa31f('0x1c')](function(_0x5cff46){if(!_0x5cff46)throw new APINotFoundError(util['format'](_0xa31f('0x108'),_0x407785[_0xa31f('0x54')]['id']));return db[_0xa31f('0x5e')][_0xa31f('0x109')](function(_0x494f79){return _0x5cff46['addTeams'](_0x303123,{'transaction':_0x494f79})[_0xa31f('0x1c')](function(){return db[_0xa31f('0x106')]['findAll']({'where':{'id':{'$in':_0x303123}}});})[_0xa31f('0x1c')](function(_0x4630de){var _0x475263=_[_0xa31f('0x28')](_0x4630de,function(_0x121372){return _0x121372[_0xa31f('0x10a')]();});return Promise[_0xa31f('0x82')](_0x475263);})[_0xa31f('0x1c')](function(_0x1a9190){_0x4d7796=_['flattenDeep'](_0x1a9190);var _0xee2e5=_[_0xa31f('0x28')](_0x4d7796,function(_0x4e2200){return _0x4e2200[_0xa31f('0x10b')](_0x5cff46['id'],{'transaction':_0x494f79});});return Promise['all'](_0xee2e5);})['then'](function(){if(!_0x5cff46[_0xa31f('0x93')])return;var _0x283c15=_[_0xa31f('0x26')](_0x4d7796,function(_0x20c816){return _0x20c816[_0xa31f('0x10c')]('channel')===_0xa31f('0x10d');});var _0x434b4a=_[_0xa31f('0x28')](_0x283c15,function(_0x5560ca){return db[_0xa31f('0xa1')][_0xa31f('0x10e')]({'membername':_0x5cff46[_0xa31f('0x2d')],'UserId':_0x5cff46['id'],'queue_name':_0x5560ca[_0xa31f('0x2d')],'VoiceQueueId':_0x5560ca['id'],'interface':_[_0xa31f('0x5d')](_0x5cff46[_0xa31f('0x9f')])?util[_0xa31f('0x9d')](_0xa31f('0x9e'),_0x5cff46[_0xa31f('0x2d')]):_0x5cff46[_0xa31f('0x9f')],'paused':_0x5cff46['voicePause']||![],'penalty':_0x5cff46[_0xa31f('0x98')]},{'transaction':_0x494f79});});return Promise[_0xa31f('0x82')](_0x434b4a);})[_0xa31f('0x1c')](function(){return db[_0xa31f('0x10f')][_0xa31f('0x40')]({'where':{'teamId':{'$in':_0x303123}}});})['then'](function(_0x1f51bd){var _0x45b96c=_[_0xa31f('0x28')](_0x1f51bd,function(_0x321931){return db[_0xa31f('0x110')][_0xa31f('0x73')]({'UserId':_0x5cff46['id'],'VoicePrefixId':_0x321931[_0xa31f('0x111')]},{'transaction':_0x494f79});});return Promise['all'](_0x45b96c);});});})[_0xa31f('0x1c')](function(){for(var _0x1b3355=0x0;_0x1b3355<_0x4d7796[_0xa31f('0x41')];_0x1b3355++){var _0x592081=_0x4d7796[_0x1b3355][_0xa31f('0x10c')](_0xa31f('0x92'));var _0x4d0a5a=_0x592081+_0xa31f('0x9a');socket[_0xa31f('0x1f')](_0xa31f('0x22')+_0x592081+'Queue:save',{'UserId':_0x5b0acf,['queueField']:_0x4d7796[_0x1b3355]['id']});}})[_0xa31f('0x1c')](respondWithStatusCode(_0x3e0d9a,null))['catch'](APIHandleError(_0x3e0d9a));};exports['removeTeams']=function(_0x80fbcf,_0x208955){var _0x5d0972=_0x80fbcf[_0xa31f('0x54')]['id'];var _0x544c08=null;if(_0x80fbcf[_0xa31f('0x39')][_0xa31f('0x55')]){_0x544c08=_['isArray'](_0x80fbcf[_0xa31f('0x39')][_0xa31f('0x55')])?_0x80fbcf[_0xa31f('0x39')][_0xa31f('0x55')]:[_0x80fbcf[_0xa31f('0x39')]['ids']];}var _0x99222c=[];return Promise[_0xa31f('0xf7')]()['then'](function(){if(!_0x544c08)throw new APIBadRequestError(_0xa31f('0x112'));})[_0xa31f('0x1c')](function(){return db[_0xa31f('0x2f')][_0xa31f('0x8e')]({'where':{'id':_0x5d0972}});})['then'](function(_0x96dea7){if(!_0x96dea7)throw new APINotFoundError(util[_0xa31f('0x9d')](_0xa31f('0x108'),_0x80fbcf[_0xa31f('0x54')]['id']));return db['sequelize']['transaction'](function(_0x455554){return _0x96dea7['removeTeams'](_0x544c08,{'transaction':_0x455554})['then'](function(){return db[_0xa31f('0x106')][_0xa31f('0x40')]({'where':{'id':{'$in':_0x544c08}}});})[_0xa31f('0x1c')](function(_0x537f03){var _0x130721=_['map'](_0x537f03,function(_0x32be09){return _0x32be09[_0xa31f('0x10a')]();});return Promise[_0xa31f('0x82')](_0x130721);})[_0xa31f('0x1c')](function(_0x3decee){_0x99222c=_[_0xa31f('0x113')](_0x3decee);var _0x236167=_[_0xa31f('0x28')](_0x99222c,function(_0x15a221){return _0x15a221[_0xa31f('0x114')](_0x96dea7['id'],{'transaction':_0x455554});});return Promise['all'](_0x236167);})[_0xa31f('0x1c')](function(){if(!_0x96dea7[_0xa31f('0x93')])return;var _0x228dbf=_[_0xa31f('0x26')](_0x99222c,function(_0x3e4579){return _0x3e4579[_0xa31f('0x10c')]('channel')===_0xa31f('0x10d');});var _0x4a6248=_['map'](_0x228dbf,function(_0x2c996e){return db[_0xa31f('0xa1')][_0xa31f('0x20')]({'where':{'VoiceQueueId':_0x2c996e['id'],'UserId':_0x96dea7['id']},'transaction':_0x455554});});return Promise[_0xa31f('0x82')](_0x4a6248);})[_0xa31f('0x1c')](function(){return db[_0xa31f('0x10f')]['findAll']({'where':{'teamId':{'$in':_0x544c08}}});})[_0xa31f('0x1c')](function(_0x10ed0c){var _0x33a325=_[_0xa31f('0x28')](_0x10ed0c,function(_0x4b2513){return db[_0xa31f('0x110')]['destroy']({'where':{'UserId':_0x96dea7['id'],'VoicePrefixId':_0x4b2513[_0xa31f('0x111')]}},{'transaction':_0x455554});});return Promise[_0xa31f('0x82')](_0x33a325);});});})[_0xa31f('0x1c')](function(){for(var _0x2646ef=0x0;_0x2646ef<_0x99222c[_0xa31f('0x41')];_0x2646ef++){var _0x54c60d=_0x99222c[_0x2646ef]['getDataValue'](_0xa31f('0x92'));var _0xca919b=_0x54c60d+_0xa31f('0x9a');socket[_0xa31f('0x1f')](_0xa31f('0x22')+_0x54c60d+_0xa31f('0xa6'),{'UserId':_0x5d0972,['queueField']:_0x99222c[_0x2646ef]['id']});}})[_0xa31f('0x1c')](respondWithStatusCode(_0x208955,null))['catch'](APIHandleError(_0x208955));};exports[_0xa31f('0x115')]=function(_0x5a86cd,_0x1e2d47){var _0x56f584={};var _0x1c3022={};var _0x2539d7;var _0x173c28;return db['User'][_0xa31f('0x8e')]({'where':{'id':_0x5a86cd[_0xa31f('0x54')]['id']}})[_0xa31f('0x1c')](handleEntityNotFound(_0x1e2d47,null))[_0xa31f('0x1c')](function(_0x2c4a79){if(_0x2c4a79){_0x2539d7=_0x2c4a79;_0x1c3022[_0xa31f('0xca')]=_[_0xa31f('0xc6')](db['CmList'][_0xa31f('0x30')]);_0x1c3022[_0xa31f('0x39')]=_[_0xa31f('0xc6')](_0x5a86cd[_0xa31f('0x39')]);_0x1c3022[_0xa31f('0xc8')]=_[_0xa31f('0xc9')](_0x1c3022['model'],_0x1c3022['query']);_0x56f584[_0xa31f('0x3f')]=_['intersection'](_0x1c3022[_0xa31f('0xca')],qs['fields'](_0x5a86cd['query'][_0xa31f('0xcb')]));_0x56f584[_0xa31f('0x3f')]=_0x56f584[_0xa31f('0x3f')][_0xa31f('0x41')]?_0x56f584[_0xa31f('0x3f')]:_0x1c3022[_0xa31f('0xca')];_0x56f584['order']=qs['sort'](_0x5a86cd[_0xa31f('0x39')]['sort']);_0x56f584[_0xa31f('0x38')]=qs['filters'](_[_0xa31f('0xce')](_0x5a86cd[_0xa31f('0x39')],_0x1c3022[_0xa31f('0xc8')]));if(_0x5a86cd[_0xa31f('0x39')]['filter']){_0x56f584['where']=_['merge'](_0x56f584['where'],{'$or':_['map'](_0x56f584[_0xa31f('0x3f')],function(_0x3bd7c9){var _0x150b3e={};_0x150b3e[_0x3bd7c9]={'$like':'%'+_0x5a86cd[_0xa31f('0x39')][_0xa31f('0x26')]+'%'};return _0x150b3e;})});}_0x56f584=_['merge']({},_0x56f584,_0x5a86cd[_0xa31f('0x4c')]);return _0x2539d7['getLists'](_0x56f584);}})[_0xa31f('0x1c')](function(_0x13765c){if(_0x13765c){_0x173c28=_0x13765c['length'];if(!_0x5a86cd[_0xa31f('0x39')][_0xa31f('0xbf')](_0xa31f('0xd0'))){_0x56f584['limit']=qs[_0xa31f('0x18')](_0x5a86cd[_0xa31f('0x39')][_0xa31f('0x18')]);_0x56f584[_0xa31f('0x15')]=qs['offset'](_0x5a86cd[_0xa31f('0x39')][_0xa31f('0x15')]);}return _0x2539d7[_0xa31f('0x115')](_0x56f584);}})[_0xa31f('0x1c')](function(_0x3993bf){if(_0x3993bf){return _0x3993bf?{'count':_0x173c28,'rows':_0x3993bf}:null;}})[_0xa31f('0x1c')](respondWithResult(_0x1e2d47,null))['catch'](handleError(_0x1e2d47,null));};exports[_0xa31f('0x116')]=function(_0x1d5f00,_0x4c0df5){var _0x59fce6={};var _0x3793c7={};var _0x6cab08;return db[_0xa31f('0x2f')][_0xa31f('0x8e')]({'where':{'id':_0x1d5f00[_0xa31f('0x54')]['id']}})[_0xa31f('0x1c')](handleEntityNotFound(_0x4c0df5,null))[_0xa31f('0x1c')](function(_0x217d37){if(_0x217d37){_0x6cab08=_0x217d37;_0x3793c7[_0xa31f('0xca')]=_[_0xa31f('0xc6')](db['User'][_0xa31f('0x30')]);_0x3793c7[_0xa31f('0x39')]=_[_0xa31f('0xc6')](_0x1d5f00[_0xa31f('0x39')]);_0x3793c7[_0xa31f('0xc8')]=_[_0xa31f('0xc9')](_0x3793c7[_0xa31f('0xca')],_0x3793c7['query']);_0x59fce6[_0xa31f('0x3f')]=_['intersection'](_0x3793c7[_0xa31f('0xca')],qs[_0xa31f('0xcb')](_0x1d5f00[_0xa31f('0x39')][_0xa31f('0xcb')]));_0x59fce6[_0xa31f('0x3f')]=_0x59fce6[_0xa31f('0x3f')]['length']?_0x59fce6[_0xa31f('0x3f')]:_0x3793c7[_0xa31f('0xca')];_0x59fce6[_0xa31f('0xcc')]=qs[_0xa31f('0xcd')](_0x1d5f00[_0xa31f('0x39')][_0xa31f('0xcd')]);_0x59fce6[_0xa31f('0x38')]=qs['filters'](_[_0xa31f('0xce')](_0x1d5f00['query'],_0x3793c7[_0xa31f('0xc8')]));if(_0x1d5f00['query'][_0xa31f('0x26')]){_0x59fce6['where']=_[_0xa31f('0x4b')](_0x59fce6[_0xa31f('0x38')],{'$or':_[_0xa31f('0x28')](_0x59fce6[_0xa31f('0x3f')],function(_0x47297c){var _0x538935={};_0x538935[_0x47297c]={'$like':'%'+_0x1d5f00[_0xa31f('0x39')][_0xa31f('0x26')]+'%'};return _0x538935;})});}_0x59fce6[_0xa31f('0xca')]=db[_0xa31f('0x2f')];_0x59fce6['as']=_0xa31f('0x23');_0x59fce6=_[_0xa31f('0x4b')]({},_0x59fce6,_0x1d5f00[_0xa31f('0x4c')]);return _0x6cab08[_0xa31f('0xef')]({'include':[_0x59fce6]});}})[_0xa31f('0x1c')](function(_0x229c8e){if(_0x229c8e){var _0x1e6331={},_0x154664=[];for(var _0x2aabf7=0x0;_0x2aabf7<_0x229c8e['length'];_0x2aabf7+=0x1){for(var _0x2d0217=0x0,_0x4664f6;_0x2d0217<_0x229c8e[_0x2aabf7][_0xa31f('0x23')][_0xa31f('0x41')];_0x2d0217+=0x1){_0x4664f6=_0x229c8e[_0x2aabf7][_0xa31f('0x23')][_0x2d0217][_0xa31f('0x9b')]({'plain':!![]});_0x1e6331[_0x4664f6['id']]=_0x4664f6;}}_0x1e6331=_[_0xa31f('0x117')](_0x1e6331);for(var _0xae6127=qs[_0xa31f('0x15')](_0x1d5f00[_0xa31f('0x39')][_0xa31f('0x15')]);_0xae6127<_0x1e6331[_0xa31f('0x41')]&&_0x154664[_0xa31f('0x41')]=_0x21d21f[_0x1e45('0x49')]){throw new Error(_0x1e45('0x4a'));}})['then'](function(){if(_0x56a5e1){return db[_0x1e45('0x42')][_0x1e45('0x4b')]({'where':{'membername':_0x56a5e1[_0x1e45('0x1f')]},'individualHooks':!![]});}})[_0x1e45('0x15')](function(){if(_0x56a5e1){return _0x56a5e1[_0x1e45('0x4c')]({'raw':!![]});}})[_0x1e45('0x15')](function(_0x5b0f03){if(_0x56a5e1){if(_0x5b0f03){var _0x125d97=[];_0x49e0ab=_0x5b0f03;if(_0x49e0ab['length']){for(var _0x4727a8=0x0;_0x4727a8<_0x49e0ab[_0x1e45('0x28')];_0x4727a8++){_0x125d97[_0x1e45('0x43')](db[_0x1e45('0x42')][_0x1e45('0x4d')]({'membername':_0x56a5e1[_0x1e45('0x1f')],'UserId':_0x56a5e1['id'],'queue_name':_0x49e0ab[_0x4727a8][_0x1e45('0x1f')],'VoiceQueueId':_0x49e0ab[_0x4727a8]['id'],'interface':_0x565c60,'paused':_0x56a5e1[_0x1e45('0x4e')]||![],'penalty':_0x49e0ab[_0x4727a8]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x125d97);}}}})[_0x1e45('0x15')](function(){if(_0x56a5e1){return db[_0x1e45('0x26')]['findAll']({'where':{'membername':_0x56a5e1[_0x1e45('0x1f')],'exitAt':null}});}})['then'](function(_0x3bd18e){if(_0x56a5e1){if(_0x3bd18e&&_0x3bd18e[_0x1e45('0x28')]){var _0x158ff5=[];_0x3bd18e[_0x1e45('0x2c')](function(_0x598ced){_0x158ff5[_0x1e45('0x43')](_0x598ced[_0x1e45('0x25')]({'exitAt':moment()[_0x1e45('0x23')](_0x1e45('0x29'))}));});return BPromise[_0x1e45('0x44')](_0x158ff5);}}})[_0x1e45('0x15')](function(){if(_0x56a5e1){var _0x3b6d1e=[];var _0xd33f9a=[];var _0x1e0d4e=utils[_0x1e45('0x2b')]();var _0x5aea3c={'membername':_0x56a5e1[_0x1e45('0x1f')],'interface':_0x565c60,'enterAt':moment()[_0x1e45('0x23')](_0x1e45('0x29')),'role':_0x56a5e1[_0x1e45('0x20')],'internal':_0x56a5e1[_0x1e45('0x21')]};_0x1e0d4e['forEach'](function(_0x1ddf00){_0x3b6d1e[_0x1e45('0x43')](_[_0x1e45('0x4f')]({'channel':_0x1ddf00,'type':'LOGIN','data1':'callysquare','data2':_0x565c60},_0x5aea3c));if(_0x56a5e1['loginInPause']){_0xd33f9a['push'](_['merge']({'channel':_0x1ddf00,'type':_0x1e45('0x27'),'data1':_0x1e45('0x50')},_0x5aea3c));}});return db[_0x1e45('0x26')][_0x1e45('0x32')](_0x3b6d1e[_0x1e45('0x51')](_0xd33f9a),{'individualHooks':!![]});}})[_0x1e45('0x15')](function(){if(_0x56a5e1){return _0x56a5e1[_0x1e45('0x25')]({'online':!![],'lastLoginAt':moment()[_0x1e45('0x23')](_0x1e45('0x29')),'voicePause':_0x56a5e1[_0x1e45('0x4e')]||![],'mailPause':_0x56a5e1['loginInPause']||![],'chatPause':_0x56a5e1['loginInPause']||![],'faxPause':_0x56a5e1[_0x1e45('0x4e')]||![],'smsPause':_0x56a5e1[_0x1e45('0x4e')]||![],'openchannelPause':_0x56a5e1[_0x1e45('0x4e')]||![],'pauseType':_0x56a5e1[_0x1e45('0x4e')]?_0x1e45('0x50'):null,'lastPauseAt':moment()['format'](_0x1e45('0x29')),'interface':_0x565c60});}})['then'](function(_0x2eb133){_0x713eac(_0x2eb133);})[_0x1e45('0x17')](function(_0x2eefb3){_0x27bd0f(_0xbb9bdb[_0x1e45('0x18')](0x1f4,_0x2eefb3[_0x1e45('0x19')]));});});}; \ No newline at end of file +var _0x2360=['bulkCreate','concat','catch','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','redis','defaults','localhost','./user.socket','register','User','findAll','options','raw','where','attributes','limit','include','model','map','then','GetUser','debug','stringify','error','message','ShowUser','find','info','PauseUser','name','role','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','PAUSE','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','forEach','push','isNil','interface','SIP/%s','type','DEFAULT\x20PAUSE','internal','body','uniqueid','MemberReport','UnpauseUser','resolve','channel','isValidChannel','findOne','online','voicePause','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','unpause','system','LogoutUser','destroy','all','LoginUser','phone','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','getChannels','merge','callysquare','LOGININPAUSE'];(function(_0x3eaa42,_0x340128){var _0x2fb1bd=function(_0x1da511){while(--_0x1da511){_0x3eaa42['push'](_0x3eaa42['shift']());}};_0x2fb1bd(++_0x340128);}(_0x2360,0x10b));var _0x0236=function(_0x1e2de7,_0x130960){_0x1e2de7=_0x1e2de7-0x0;var _0xeaf538=_0x2360[_0x1e2de7];return _0xeaf538;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var Redis=require(_0x0236('0x0'));var db=require(_0x0236('0x1'))['db'];var utils=require(_0x0236('0x2'));var logger=require(_0x0236('0x3'))(_0x0236('0x4'));var config=require('../../config/environment');config[_0x0236('0x5')]=_[_0x0236('0x6')](config[_0x0236('0x5')],{'host':_0x0236('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0236('0x8'))[_0x0236('0x9')](socket);exports['GetUser']=function(_0x3ef137){var _0x421adc=this;return new Promise(function(_0x54ec1e,_0x1e89c1){return db[_0x0236('0xa')][_0x0236('0xb')]({'raw':_0x3ef137[_0x0236('0xc')]?_0x3ef137[_0x0236('0xc')][_0x0236('0xd')]===undefined?!![]:![]:!![],'where':_0x3ef137[_0x0236('0xc')]?_0x3ef137['options'][_0x0236('0xe')]||null:null,'attributes':_0x3ef137[_0x0236('0xc')]?_0x3ef137[_0x0236('0xc')][_0x0236('0xf')]||null:null,'limit':_0x3ef137[_0x0236('0xc')]?_0x3ef137[_0x0236('0xc')][_0x0236('0x10')]||null:null,'include':_0x3ef137['options']?_0x3ef137['options'][_0x0236('0x11')]?_['map'](_0x3ef137[_0x0236('0xc')][_0x0236('0x11')],function(_0x33bc87){return{'model':db[_0x33bc87[_0x0236('0x12')]],'as':_0x33bc87['as'],'attributes':_0x33bc87[_0x0236('0xf')],'include':_0x33bc87[_0x0236('0x11')]?_[_0x0236('0x13')](_0x33bc87[_0x0236('0x11')],function(_0x2c0ad8){return{'model':db[_0x2c0ad8['model']],'as':_0x2c0ad8['as'],'attributes':_0x2c0ad8['attributes'],'include':_0x2c0ad8[_0x0236('0x11')]?_[_0x0236('0x13')](_0x2c0ad8[_0x0236('0x11')],function(_0x75940f){return{'model':db[_0x75940f[_0x0236('0x12')]],'as':_0x75940f['as'],'attributes':_0x75940f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0236('0x14')](function(_0x4c7660){logger['info'](_0x0236('0x15'),_0x3ef137);logger[_0x0236('0x16')]('GetUser',_0x3ef137,JSON[_0x0236('0x17')](_0x4c7660));_0x54ec1e(_0x4c7660);})['catch'](function(_0x23ee47){logger[_0x0236('0x18')](_0x0236('0x15'),_0x23ee47[_0x0236('0x19')],_0x3ef137);_0x1e89c1(_0x421adc[_0x0236('0x18')](0x1f4,_0x23ee47[_0x0236('0x19')]));});});};exports[_0x0236('0x1a')]=function(_0x437d9d){var _0x17f623=this;return new Promise(function(_0x3f9673,_0x3caec4){return db['User'][_0x0236('0x1b')]({'raw':_0x437d9d[_0x0236('0xc')]?_0x437d9d[_0x0236('0xc')][_0x0236('0xd')]===undefined?!![]:![]:!![],'where':_0x437d9d[_0x0236('0xc')]?_0x437d9d[_0x0236('0xc')]['where']||null:null,'attributes':_0x437d9d[_0x0236('0xc')]?_0x437d9d['options']['attributes']||null:null,'include':_0x437d9d[_0x0236('0xc')]?_0x437d9d[_0x0236('0xc')][_0x0236('0x11')]?_[_0x0236('0x13')](_0x437d9d[_0x0236('0xc')][_0x0236('0x11')],function(_0x576ace){return{'model':db[_0x576ace[_0x0236('0x12')]],'as':_0x576ace['as'],'attributes':_0x576ace[_0x0236('0xf')],'include':_0x576ace[_0x0236('0x11')]?_[_0x0236('0x13')](_0x576ace[_0x0236('0x11')],function(_0x2de6d9){return{'model':db[_0x2de6d9[_0x0236('0x12')]],'as':_0x2de6d9['as'],'attributes':_0x2de6d9[_0x0236('0xf')],'include':_0x2de6d9['include']?_['map'](_0x2de6d9[_0x0236('0x11')],function(_0xceb1c2){return{'model':db[_0xceb1c2['model']],'as':_0xceb1c2['as'],'attributes':_0xceb1c2[_0x0236('0xf')]};}):[]};}):[]};}):[]:[]})[_0x0236('0x14')](function(_0x49a2dd){logger[_0x0236('0x1c')](_0x0236('0x1a'),_0x437d9d);logger[_0x0236('0x16')]('ShowUser',_0x437d9d,JSON['stringify'](_0x49a2dd));_0x3f9673(_0x49a2dd);})['catch'](function(_0x27b2bc){logger['error'](_0x0236('0x1a'),_0x27b2bc[_0x0236('0x19')],_0x437d9d);_0x3caec4(_0x17f623[_0x0236('0x18')](0x1f4,_0x27b2bc[_0x0236('0x19')]));});});};exports[_0x0236('0x1d')]=function(_0x2c7d73){var _0x15cf44;return db['User'][_0x0236('0x1b')]({'where':_0x2c7d73[_0x0236('0xc')][_0x0236('0xe')]||{},'attributes':['id',_0x0236('0x1e'),_0x0236('0x1f'),'internal','interface']})[_0x0236('0x14')](function(_0x1fe3ab){if(!_0x1fe3ab){throw new Error(util[_0x0236('0x20')](_0x0236('0x21'),_0x2c7d73[_0x0236('0x22')]['id']));}_0x15cf44=_0x1fe3ab;return db[_0x0236('0x23')][_0x0236('0x24')]({'paused':0x1},{'where':{'UserId':_0x15cf44['id']},'individualHooks':!![]});})[_0x0236('0x14')](function(){return db['MemberReport'][_0x0236('0xb')]({'where':{'membername':_0x15cf44[_0x0236('0x1e')],'type':_0x0236('0x25'),'exitAt':null}});})[_0x0236('0x14')](function(_0x4251d9){if(_0x4251d9&&_0x4251d9['length']){var _0x98b0b2=moment()[_0x0236('0x20')](_0x0236('0x26'));for(var _0x1c5c8e=0x0,_0x2a6a76=_0x4251d9[_0x0236('0x27')];_0x1c5c8e<_0x2a6a76;_0x1c5c8e++){_0x4251d9[_0x1c5c8e][_0x0236('0x28')]({'exitAt':_0x98b0b2});}}})[_0x0236('0x14')](function(){var _0x14eeaa=[];var _0x1ef1da=utils['getChannels']();_0x1ef1da[_0x0236('0x29')](function(_0x518076){_0x14eeaa[_0x0236('0x2a')]({'channel':_0x518076,'membername':_0x15cf44[_0x0236('0x1e')],'interface':_[_0x0236('0x2b')](_0x15cf44[_0x0236('0x2c')])?util[_0x0236('0x20')](_0x0236('0x2d'),_0x15cf44[_0x0236('0x1e')]):_0x15cf44[_0x0236('0x2c')],'type':_0x0236('0x25'),'enterAt':moment()[_0x0236('0x20')](_0x0236('0x26')),'data1':_0x2c7d73['body'][_0x0236('0x2e')]||_0x0236('0x2f'),'role':_0x15cf44['role'],'internal':_0x15cf44[_0x0236('0x30')],'uniqueid':_0x2c7d73[_0x0236('0x31')][_0x0236('0x32')]||null});});return db[_0x0236('0x33')]['bulkCreate'](_0x14eeaa,{'individualHooks':!![]});})[_0x0236('0x14')](function(){return _0x15cf44[_0x0236('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2c7d73[_0x0236('0x31')][_0x0236('0x2e')]||_0x0236('0x2f'),'lastPauseAt':moment()[_0x0236('0x20')](_0x0236('0x26'))});})['catch'](function(_0x32ced9){throw _0x32ced9;});};exports[_0x0236('0x34')]=function(_0x13ff2d){return Promise[_0x0236('0x35')]()['then'](function(){if(_0x13ff2d['body'][_0x0236('0x36')]&&!utils[_0x0236('0x37')](_0x13ff2d['body'][_0x0236('0x36')])){throw new Error(util[_0x0236('0x20')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x13ff2d[_0x0236('0x31')][_0x0236('0x36')]));}return db[_0x0236('0xa')][_0x0236('0x38')]({'where':_0x13ff2d[_0x0236('0xc')][_0x0236('0xe')]||{},'attributes':['id',_0x0236('0x1e'),_0x0236('0x1f'),_0x0236('0x30'),'interface',_0x0236('0x39'),_0x0236('0x3a'),_0x0236('0x3b'),_0x0236('0x3c'),'faxPause',_0x0236('0x3d'),_0x0236('0x3e'),_0x0236('0x3f'),_0x0236('0x40'),'lastPauseAt']});})[_0x0236('0x14')](function(_0x47dbab){if(!_0x47dbab){throw new Error(util[_0x0236('0x20')](_0x0236('0x21'),_0x13ff2d['params']['id']));}return _0x47dbab[_0x0236('0x41')](_0x13ff2d[_0x0236('0x31')][_0x0236('0x36')],_0x0236('0x42'));})['catch'](function(_0x2f02a2){throw _0x2f02a2;});};exports[_0x0236('0x43')]=function(_0x4bfc94){var _0x34cfab=this;return new Promise(function(_0x3472ac,_0x67a537){var _0x354143;return db['User'][_0x0236('0x38')]({'where':_0x4bfc94[_0x0236('0xc')][_0x0236('0xe')]||{},'attributes':['id',_0x0236('0x1e')]})[_0x0236('0x14')](function(_0x11078e){if(_0x11078e){_0x354143=_0x11078e;return db[_0x0236('0x23')][_0x0236('0x44')]({'where':{'membername':_0x354143['name']},'individualHooks':!![]});}})['then'](function(){if(_0x354143){return db[_0x0236('0x33')]['findAll']({'where':{'membername':_0x354143[_0x0236('0x1e')],'exitAt':null}});}})['then'](function(_0x5531eb){if(_0x354143){if(_0x5531eb&&_0x5531eb['length']){var _0x323299=[];_0x5531eb[_0x0236('0x29')](function(_0x2a0bf8){_0x323299['push'](_0x2a0bf8[_0x0236('0x24')]({'exitAt':moment()[_0x0236('0x20')](_0x0236('0x26'))}));});return BPromise[_0x0236('0x45')](_0x323299);}}})[_0x0236('0x14')](function(){if(_0x354143){return _0x354143[_0x0236('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x0236('0x14')](function(_0x8da292){_0x3472ac(_0x8da292);})['catch'](function(_0x1f87fd){_0x67a537(_0x34cfab[_0x0236('0x18')](0x1f4,_0x1f87fd[_0x0236('0x19')]));});});};exports[_0x0236('0x46')]=function(_0x2d6f31){var _0x373527=this;return new Promise(function(_0x75acf0,_0x471aa3){var _0x184650;var _0x279c04;var _0x8e8e02;var _0x3d378f;return db[_0x0236('0xa')]['findOne']({'where':_0x2d6f31[_0x0236('0xc')][_0x0236('0xe')]||{},'attributes':['id',_0x0236('0x1e'),'role','mobile',_0x0236('0x47'),_0x0236('0x30'),'loginInPause',_0x0236('0x2c')]})[_0x0236('0x14')](function(_0x5edc09){if(_0x5edc09){_0x184650=_0x5edc09;_0x3d378f=_0x2d6f31[_0x0236('0x31')][_0x0236('0x2c')]?_0x2d6f31[_0x0236('0x31')][_0x0236('0x2c')]:util[_0x0236('0x20')](_0x0236('0x2d'),_0x184650[_0x0236('0x1e')]);return db['User']['count']({'where':{'role':_0x0236('0x48'),'online':!![],'id':{'$ne':_0x184650['id']}}});}})[_0x0236('0x14')](function(_0x115f62){if(_0x115f62){_0x8e8e02=_0x115f62;return require(_0x0236('0x49'))[_0x0236('0x4a')]();}})[_0x0236('0x14')](function(_0x1d69ab){if(_0x1d69ab&&_0x1d69ab[_0x0236('0x4b')]&&_0x8e8e02>=_0x1d69ab[_0x0236('0x4b')]){throw new Error(_0x0236('0x4c'));}})[_0x0236('0x14')](function(){if(_0x184650){return db['UserVoiceQueueRt'][_0x0236('0x44')]({'where':{'membername':_0x184650[_0x0236('0x1e')]},'individualHooks':!![]});}})[_0x0236('0x14')](function(){if(_0x184650){return _0x184650[_0x0236('0x4d')]({'raw':!![]});}})[_0x0236('0x14')](function(_0x399d44){if(_0x184650){if(_0x399d44){var _0x19fdf0=[];_0x279c04=_0x399d44;if(_0x279c04[_0x0236('0x27')]){for(var _0xfd3227=0x0;_0xfd3227<_0x279c04[_0x0236('0x27')];_0xfd3227++){_0x19fdf0[_0x0236('0x2a')](db[_0x0236('0x23')][_0x0236('0x4e')]({'membername':_0x184650[_0x0236('0x1e')],'UserId':_0x184650['id'],'queue_name':_0x279c04[_0xfd3227][_0x0236('0x1e')],'VoiceQueueId':_0x279c04[_0xfd3227]['id'],'interface':_0x3d378f,'paused':_0x184650[_0x0236('0x4f')]||![],'penalty':_0x279c04[_0xfd3227][_0x0236('0x50')]||0x0}));}return BPromise['all'](_0x19fdf0);}}}})[_0x0236('0x14')](function(){if(_0x184650){return db['MemberReport']['findAll']({'where':{'membername':_0x184650['name'],'exitAt':null}});}})[_0x0236('0x14')](function(_0x2cb407){if(_0x184650){if(_0x2cb407&&_0x2cb407[_0x0236('0x27')]){var _0xff7d1d=[];_0x2cb407[_0x0236('0x29')](function(_0x570672){_0xff7d1d[_0x0236('0x2a')](_0x570672[_0x0236('0x24')]({'exitAt':moment()['format'](_0x0236('0x26'))}));});return BPromise[_0x0236('0x45')](_0xff7d1d);}}})[_0x0236('0x14')](function(){if(_0x184650){var _0x599a43=[];var _0x566228=[];var _0x2f3df5=utils[_0x0236('0x51')]();var _0x3ada25={'membername':_0x184650[_0x0236('0x1e')],'interface':_0x3d378f,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x184650['role'],'internal':_0x184650[_0x0236('0x30')]};_0x2f3df5[_0x0236('0x29')](function(_0x400564){_0x599a43[_0x0236('0x2a')](_[_0x0236('0x52')]({'channel':_0x400564,'type':'LOGIN','data1':_0x0236('0x53'),'data2':_0x3d378f},_0x3ada25));if(_0x184650[_0x0236('0x4f')]){_0x566228[_0x0236('0x2a')](_[_0x0236('0x52')]({'channel':_0x400564,'type':'PAUSE','data1':_0x0236('0x54')},_0x3ada25));}});return db[_0x0236('0x33')][_0x0236('0x55')](_0x599a43[_0x0236('0x56')](_0x566228),{'individualHooks':!![]});}})[_0x0236('0x14')](function(){if(_0x184650){return _0x184650[_0x0236('0x24')]({'online':!![],'lastLoginAt':moment()['format'](_0x0236('0x26')),'voicePause':_0x184650[_0x0236('0x4f')]||![],'mailPause':_0x184650['loginInPause']||![],'chatPause':_0x184650[_0x0236('0x4f')]||![],'faxPause':_0x184650[_0x0236('0x4f')]||![],'smsPause':_0x184650['loginInPause']||![],'openchannelPause':_0x184650[_0x0236('0x4f')]||![],'pauseType':_0x184650[_0x0236('0x4f')]?_0x0236('0x54'):null,'lastPauseAt':moment()[_0x0236('0x20')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x3d378f});}})[_0x0236('0x14')](function(_0x284721){_0x75acf0(_0x284721);})[_0x0236('0x57')](function(_0x522237){_0x471aa3(_0x373527[_0x0236('0x18')](0x1f4,_0x522237[_0x0236('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index f303d1e..919d6d6 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 _0x8cd8=['register','length','user:','./user.events','save','emit','removeListener'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x8cd8,0x8f));var _0x88cd=function(_0x5719e4,_0x3aa0b9){_0x5719e4=_0x5719e4-0x0;var _0x1d74f7=_0x8cd8[_0x5719e4];return _0x1d74f7;};'use strict';var UserEvents=require(_0x88cd('0x0'));var events=[_0x88cd('0x1'),'remove','update'];function createListener(_0x2d46c5,_0x225e1f){return function(_0x21b8da){_0x225e1f[_0x88cd('0x2')](_0x2d46c5,_0x21b8da);};}function removeListener(_0x5be626,_0x4f9a97){return function(){UserEvents[_0x88cd('0x3')](_0x5be626,_0x4f9a97);};}exports[_0x88cd('0x4')]=function(_0x4578f1){for(var _0x4d9e2f=0x0,_0x5c1f74=events[_0x88cd('0x5')];_0x4d9e2f<_0x5c1f74;_0x4d9e2f++){var _0x2c5755=events[_0x4d9e2f];var _0x36aefc=createListener(_0x88cd('0x6')+_0x2c5755,_0x4578f1);UserEvents['on'](_0x2c5755,_0x36aefc);}}; \ No newline at end of file +var _0x86ad=['./user.events','update','emit','removeListener','register','length','user:'];(function(_0x55257d,_0x3998ec){var _0x4d296d=function(_0x522f05){while(--_0x522f05){_0x55257d['push'](_0x55257d['shift']());}};_0x4d296d(++_0x3998ec);}(_0x86ad,0x8c));var _0xd86a=function(_0x46ed31,_0x3f2b58){_0x46ed31=_0x46ed31-0x0;var _0x4d7b2a=_0x86ad[_0x46ed31];return _0x4d7b2a;};'use strict';var UserEvents=require(_0xd86a('0x0'));var events=['save','remove',_0xd86a('0x1')];function createListener(_0x4ca324,_0x43f83a){return function(_0x334cb1){_0x43f83a[_0xd86a('0x2')](_0x4ca324,_0x334cb1);};}function removeListener(_0x2af8f4,_0x2eea78){return function(){UserEvents[_0xd86a('0x3')](_0x2af8f4,_0x2eea78);};}exports[_0xd86a('0x4')]=function(_0x530908){for(var _0x39b0ec=0x0,_0x40320d=events[_0xd86a('0x5')];_0x39b0ec<_0x40320d;_0x39b0ec++){var _0x4d8bc0=events[_0x39b0ec];var _0x22f7ff=createListener(_0xd86a('0x6')+_0x4d8bc0,_0x530908);UserEvents['on'](_0x4d8bc0,_0x22f7ff);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index bcf6036..d1255da 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x37bcd8,_0x27bed9){var _0x422480=function(_0x510db3){while(--_0x510db3){_0x37bcd8['push'](_0x37bcd8['shift']());}};_0x422480(++_0x27bed9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2924d3,_0x43216b){var _0x4be4e4=function(_0x57446b){while(--_0x57446b){_0x2924d3['push'](_0x2924d3['shift']());}};_0x4be4e4(++_0x43216b);}(_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 20ee21f..0bf3a82 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 _0xf5cd=['sequelize','exports','INTEGER'];(function(_0x5aaa92,_0x432b00){var _0x3f0367=function(_0x5a517e){while(--_0x5a517e){_0x5aaa92['push'](_0x5aaa92['shift']());}};_0x3f0367(++_0x432b00);}(_0xf5cd,0x1bf));var _0xdf5c=function(_0x31e16a,_0x210c6c){_0x31e16a=_0x31e16a-0x0;var _0x58e686=_0xf5cd[_0x31e16a];return _0x58e686;};'use strict';var Sequelize=require(_0xdf5c('0x0'));module[_0xdf5c('0x1')]={'penalty':{'type':Sequelize[_0xdf5c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x89d4=['INTEGER','sequelize','exports'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x89d4,0xc1));var _0x489d=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0x89d4[_0x220afa];return _0x1b79d1;};'use strict';var Sequelize=require(_0x489d('0x0'));module[_0x489d('0x1')]={'penalty':{'type':Sequelize[_0x489d('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 143920d..47873af 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 _0xd2cd=['path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','lodash','util','../../config/logger','request-promise'];(function(_0x166283,_0x32b4b2){var _0x5ee5cc=function(_0x395b3b){while(--_0x395b3b){_0x166283['push'](_0x166283['shift']());}};_0x5ee5cc(++_0x32b4b2);}(_0xd2cd,0xb7));var _0xdd2c=function(_0x2aae31,_0x1014a2){_0x2aae31=_0x2aae31-0x0;var _0x379006=_0xd2cd[_0x2aae31];return _0x379006;};'use strict';var _=require(_0xdd2c('0x0'));var util=require(_0xdd2c('0x1'));var logger=require(_0xdd2c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdd2c('0x3'));var fs=require('fs');var path=require(_0xdd2c('0x4'));var rimraf=require(_0xdd2c('0x5'));var config=require(_0xdd2c('0x6'));var attributes=require(_0xdd2c('0x7'));module[_0xdd2c('0x8')]=function(_0x5f3684,_0x4b87d4){return _0x5f3684[_0xdd2c('0x9')](_0xdd2c('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87fe=['define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x575966,_0x18939e){var _0x515c28=function(_0x392dfa){while(--_0x392dfa){_0x575966['push'](_0x575966['shift']());}};_0x515c28(++_0x18939e);}(_0x87fe,0x121));var _0xe87f=function(_0x1d3791,_0x51c613){_0x1d3791=_0x1d3791-0x0;var _0x40fbf5=_0x87fe[_0x1d3791];return _0x40fbf5;};'use strict';var _=require(_0xe87f('0x0'));var util=require('util');var logger=require(_0xe87f('0x1'))(_0xe87f('0x2'));var moment=require(_0xe87f('0x3'));var BPromise=require(_0xe87f('0x4'));var rp=require(_0xe87f('0x5'));var fs=require('fs');var path=require(_0xe87f('0x6'));var rimraf=require(_0xe87f('0x7'));var config=require(_0xe87f('0x8'));var attributes=require('./userChatQueue.attributes');module[_0xe87f('0x9')]=function(_0x56fc8c,_0x40b141){return _0x56fc8c[_0xe87f('0xa')](_0xe87f('0xb'),attributes,{'tableName':_0xe87f('0xc'),'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 5d3acbf..4d9780f 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 _0xa8e3=['request','then','info','request\x20sent','debug','stringify','error','message','UserChatQueue,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x1404be,_0x4f4384){var _0xeaf7c1=function(_0x4fb590){while(--_0x4fb590){_0x1404be['push'](_0x1404be['shift']());}};_0xeaf7c1(++_0x4f4384);}(_0xa8e3,0x1c3));var _0x3a8e=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0xa8e3[_0x595013];return _0x2a29e3;};'use strict';var _=require(_0x3a8e('0x0'));var util=require('util');var moment=require(_0x3a8e('0x1'));var BPromise=require(_0x3a8e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a8e('0x3'))['db'];var utils=require(_0x3a8e('0x4'));var logger=require('../../config/logger')(_0x3a8e('0x5'));var config=require(_0x3a8e('0x6'));var jayson=require(_0x3a8e('0x7'));var client=jayson[_0x3a8e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54619c,_0x7a09eb,_0x5d58b9){return new BPromise(function(_0x5a362d,_0x32a878){return client[_0x3a8e('0x9')](_0x54619c,_0x5d58b9)[_0x3a8e('0xa')](function(_0x11381f){logger[_0x3a8e('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x7a09eb,_0x3a8e('0xc'));logger[_0x3a8e('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x7a09eb,_0x3a8e('0xc'),JSON[_0x3a8e('0xe')](_0x11381f));if(_0x11381f['error']){if(_0x11381f[_0x3a8e('0xf')]['code']===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x7a09eb,_0x11381f[_0x3a8e('0xf')]['message']);return _0x32a878(_0x11381f[_0x3a8e('0xf')][_0x3a8e('0x10')]);}logger[_0x3a8e('0xf')](_0x3a8e('0x11'),_0x7a09eb,_0x11381f[_0x3a8e('0xf')][_0x3a8e('0x10')]);return _0x5a362d(_0x11381f[_0x3a8e('0xf')][_0x3a8e('0x10')]);}else{logger[_0x3a8e('0xb')](_0x3a8e('0x11'),_0x7a09eb,_0x3a8e('0xc'));_0x5a362d(_0x11381f[_0x3a8e('0x12')]['message']);}})[_0x3a8e('0x13')](function(_0x4e0ee2){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x7a09eb,_0x4e0ee2);_0x32a878(_0x4e0ee2);});});} \ No newline at end of file +var _0x3b9c=['message','info','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x3b9c,0xbd));var _0xc3b9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3b9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc3b9('0x0'));var moment=require('moment');var BPromise=require(_0xc3b9('0x1'));var rs=require(_0xc3b9('0x2'));var fs=require('fs');var Redis=require(_0xc3b9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc3b9('0x4'))('rpc');var config=require(_0xc3b9('0x5'));var jayson=require(_0xc3b9('0x6'));var client=jayson['client'][_0xc3b9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x102f68,_0x7e3e6e,_0x132a03){return new BPromise(function(_0x5afd60,_0x58ea88){return client['request'](_0x102f68,_0x132a03)[_0xc3b9('0x8')](function(_0x1f0e65){logger['info'](_0xc3b9('0x9'),_0x7e3e6e,_0xc3b9('0xa'));logger[_0xc3b9('0xb')](_0xc3b9('0xc'),_0x7e3e6e,_0xc3b9('0xa'),JSON['stringify'](_0x1f0e65));if(_0x1f0e65['error']){if(_0x1f0e65[_0xc3b9('0xd')][_0xc3b9('0xe')]===0x1f4){logger[_0xc3b9('0xd')](_0xc3b9('0x9'),_0x7e3e6e,_0x1f0e65['error'][_0xc3b9('0xf')]);return _0x58ea88(_0x1f0e65['error'][_0xc3b9('0xf')]);}logger[_0xc3b9('0xd')](_0xc3b9('0x9'),_0x7e3e6e,_0x1f0e65[_0xc3b9('0xd')][_0xc3b9('0xf')]);return _0x5afd60(_0x1f0e65[_0xc3b9('0xd')][_0xc3b9('0xf')]);}else{logger[_0xc3b9('0x10')](_0xc3b9('0x9'),_0x7e3e6e,_0xc3b9('0xa'));_0x5afd60(_0x1f0e65['result']['message']);}})['catch'](function(_0x5016a0){logger[_0xc3b9('0xd')](_0xc3b9('0x9'),_0x7e3e6e,_0x5016a0);_0x58ea88(_0x5016a0);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 818c54d..13aec1f 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3059d0,_0x254157){var _0x58e2ad=function(_0x353431){while(--_0x353431){_0x3059d0['push'](_0x3059d0['shift']());}};_0x58e2ad(++_0x254157);}(_0x70e0,0x17b));var _0x070e=function(_0x1d7fcf,_0x49f676){_0x1d7fcf=_0x1d7fcf-0x0;var _0x56b54a=_0x70e0[_0x1d7fcf];return _0x56b54a;};'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(_0x262ee7,_0x52ee92){var _0x1dc842=function(_0x4bf54a){while(--_0x4bf54a){_0x262ee7['push'](_0x262ee7['shift']());}};_0x1dc842(++_0x52ee92);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'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 915c578..bc1f05a 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 _0xf8a8=['INTEGER','STRING','sequelize'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0xf8a8,0x10d));var _0x8f8a=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xf8a8[_0x543084];return _0x306a57;};'use strict';var Sequelize=require(_0x8f8a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8f8a('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8f8a('0x2')]}}; \ No newline at end of file +var _0x2f89=['sequelize','exports','INTEGER','STRING'];(function(_0xda6d0f,_0x35e271){var _0x244540=function(_0x30f643){while(--_0x30f643){_0xda6d0f['push'](_0xda6d0f['shift']());}};_0x244540(++_0x35e271);}(_0x2f89,0x1e8));var _0x92f8=function(_0x3c010c,_0x222930){_0x3c010c=_0x3c010c-0x0;var _0x11683c=_0x2f89[_0x3c010c];return _0x11683c;};'use strict';var Sequelize=require(_0x92f8('0x0'));module[_0x92f8('0x1')]={'penalty':{'type':Sequelize[_0x92f8('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x92f8('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x92f8('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index cfc8c72..6621d61 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 _0x3401=['exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3401,0x163));var _0x1340=function(_0x82bb9c,_0x45d0f2){_0x82bb9c=_0x82bb9c-0x0;var _0x2b15ba=_0x3401[_0x82bb9c];return _0x2b15ba;};'use strict';var _=require(_0x1340('0x0'));var util=require(_0x1340('0x1'));var logger=require(_0x1340('0x2'))(_0x1340('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1340('0x4'));var fs=require('fs');var path=require(_0x1340('0x5'));var rimraf=require(_0x1340('0x6'));var config=require(_0x1340('0x7'));var attributes=require(_0x1340('0x8'));module[_0x1340('0x9')]=function(_0x3f34d9,_0x525935){return _0x3f34d9[_0x1340('0xa')](_0x1340('0xb'),attributes,{'tableName':_0x1340('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb5=['exports','define','UserFaxQueue','util','api','bluebird','rimraf'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0xadb5,0x129));var _0x5adb=function(_0x546ea7,_0x2d223d){_0x546ea7=_0x546ea7-0x0;var _0x32042f=_0xadb5[_0x546ea7];return _0x32042f;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require('moment');var BPromise=require(_0x5adb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5adb('0x3'));var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0x5adb('0x4')]=function(_0x2e4849,_0x2c7582){return _0x2e4849[_0x5adb('0x5')](_0x5adb('0x6'),attributes,{'tableName':'user_has_fax_queues','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 7d3483b..013dbf6 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 _0x5d96=['code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d96,0x137));var _0x65d9=function(_0x550b35,_0xa48bb6){_0x550b35=_0x550b35-0x0;var _0x3fbb95=_0x5d96[_0x550b35];return _0x3fbb95;};'use strict';var _=require(_0x65d9('0x0'));var util=require('util');var moment=require(_0x65d9('0x1'));var BPromise=require(_0x65d9('0x2'));var rs=require(_0x65d9('0x3'));var fs=require('fs');var Redis=require(_0x65d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x65d9('0x5'))(_0x65d9('0x6'));var config=require(_0x65d9('0x7'));var jayson=require(_0x65d9('0x8'));var client=jayson['client'][_0x65d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x389a94,_0x522018,_0xd3011f){return new BPromise(function(_0x176db4,_0x5098e2){return client[_0x65d9('0xa')](_0x389a94,_0xd3011f)[_0x65d9('0xb')](function(_0x4a2d15){logger[_0x65d9('0xc')](_0x65d9('0xd'),_0x522018,_0x65d9('0xe'));logger[_0x65d9('0xf')](_0x65d9('0x10'),_0x522018,'request\x20sent',JSON[_0x65d9('0x11')](_0x4a2d15));if(_0x4a2d15[_0x65d9('0x12')]){if(_0x4a2d15[_0x65d9('0x12')][_0x65d9('0x13')]===0x1f4){logger['error'](_0x65d9('0xd'),_0x522018,_0x4a2d15[_0x65d9('0x12')][_0x65d9('0x14')]);return _0x5098e2(_0x4a2d15['error'][_0x65d9('0x14')]);}logger[_0x65d9('0x12')](_0x65d9('0xd'),_0x522018,_0x4a2d15[_0x65d9('0x12')]['message']);return _0x176db4(_0x4a2d15[_0x65d9('0x12')][_0x65d9('0x14')]);}else{logger[_0x65d9('0xc')](_0x65d9('0xd'),_0x522018,_0x65d9('0xe'));_0x176db4(_0x4a2d15[_0x65d9('0x15')][_0x65d9('0x14')]);}})['catch'](function(_0xc39f04){logger['error'](_0x65d9('0xd'),_0x522018,_0xc39f04);_0x5098e2(_0xc39f04);});});} \ No newline at end of file +var _0xe8b3=['jayson/promise','client','http','request','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','randomstring','ioredis','rpc','../../config/environment'];(function(_0x561e0b,_0x3738fd){var _0x3a9496=function(_0x601e7d){while(--_0x601e7d){_0x561e0b['push'](_0x561e0b['shift']());}};_0x3a9496(++_0x3738fd);}(_0xe8b3,0xf1));var _0x3e8b=function(_0x5c8a11,_0x10805f){_0x5c8a11=_0x5c8a11-0x0;var _0x116b22=_0xe8b3[_0x5c8a11];return _0x116b22;};'use strict';var _=require(_0x3e8b('0x0'));var util=require(_0x3e8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3e8b('0x2'));var fs=require('fs');var Redis=require(_0x3e8b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3e8b('0x4'));var config=require(_0x3e8b('0x5'));var jayson=require(_0x3e8b('0x6'));var client=jayson[_0x3e8b('0x7')][_0x3e8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21ef43,_0x243b73,_0x3d8f70){return new BPromise(function(_0x458465,_0x133f2a){return client[_0x3e8b('0x9')](_0x21ef43,_0x3d8f70)['then'](function(_0x45ed05){logger['info'](_0x3e8b('0xa'),_0x243b73,'request\x20sent');logger['debug'](_0x3e8b('0xb'),_0x243b73,_0x3e8b('0xc'),JSON[_0x3e8b('0xd')](_0x45ed05));if(_0x45ed05[_0x3e8b('0xe')]){if(_0x45ed05['error'][_0x3e8b('0xf')]===0x1f4){logger[_0x3e8b('0xe')](_0x3e8b('0xa'),_0x243b73,_0x45ed05[_0x3e8b('0xe')][_0x3e8b('0x10')]);return _0x133f2a(_0x45ed05['error'][_0x3e8b('0x10')]);}logger['error'](_0x3e8b('0xa'),_0x243b73,_0x45ed05[_0x3e8b('0xe')][_0x3e8b('0x10')]);return _0x458465(_0x45ed05[_0x3e8b('0xe')]['message']);}else{logger[_0x3e8b('0x11')](_0x3e8b('0xa'),_0x243b73,_0x3e8b('0xc'));_0x458465(_0x45ed05[_0x3e8b('0x12')]['message']);}})['catch'](function(_0x1d8dd9){logger[_0x3e8b('0xe')](_0x3e8b('0xa'),_0x243b73,_0x1d8dd9);_0x133f2a(_0x1d8dd9);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 1c972d2..4539568 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x26f67d,_0x15aac7){var _0x26de83=function(_0x3f04c1){while(--_0x3f04c1){_0x26f67d['push'](_0x26f67d['shift']());}};_0x26de83(++_0x15aac7);}(_0xedd9,0xfc));var _0x9edd=function(_0xf90af4,_0x5d6ebe){_0xf90af4=_0xf90af4-0x0;var _0x3261a5=_0xedd9[_0xf90af4];return _0x3261a5;};'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 +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3369a8,_0xfea8b1){var _0x4b5e69=function(_0x58760f){while(--_0x58760f){_0x3369a8['push'](_0x3369a8['shift']());}};_0x4b5e69(++_0xfea8b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 20dff4a..becf6fd 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 _0x3863=['INTEGER'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x3863,0x72));var _0x3386=function(_0x4d5a59,_0x599a32){_0x4d5a59=_0x4d5a59-0x0;var _0xface5a=_0x3863[_0x4d5a59];return _0xface5a;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x3386('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x31be=['exports','INTEGER','sequelize'];(function(_0x167397,_0x5c676b){var _0x12e031=function(_0x3c4733){while(--_0x3c4733){_0x167397['push'](_0x167397['shift']());}};_0x12e031(++_0x5c676b);}(_0x31be,0xd4));var _0xe31b=function(_0x176fa5,_0x48fb62){_0x176fa5=_0x176fa5-0x0;var _0x1373af=_0x31be[_0x176fa5];return _0x1373af;};'use strict';var Sequelize=require(_0xe31b('0x0'));module[_0xe31b('0x1')]={'penalty':{'type':Sequelize[_0xe31b('0x2')],'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 52575c9..678ac1c 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 _0xbd94=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbd94,0x113));var _0x4bd9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbd94[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4bd9('0x0'));var util=require(_0x4bd9('0x1'));var logger=require(_0x4bd9('0x2'))(_0x4bd9('0x3'));var moment=require(_0x4bd9('0x4'));var BPromise=require(_0x4bd9('0x5'));var rp=require(_0x4bd9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4bd9('0x7'));var config=require('../../config/environment');var attributes=require(_0x4bd9('0x8'));module[_0x4bd9('0x9')]=function(_0x4a8726,_0x5dc6cc){return _0x4a8726[_0x4bd9('0xa')](_0x4bd9('0xb'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaac6=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','UserMailQueue','user_has_mail_queues','lodash'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xaac6,0x13f));var _0x6aac=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0xaac6[_0x1e4a8e];return _0x5408f9;};'use strict';var _=require(_0x6aac('0x0'));var util=require(_0x6aac('0x1'));var logger=require(_0x6aac('0x2'))(_0x6aac('0x3'));var moment=require('moment');var BPromise=require(_0x6aac('0x4'));var rp=require(_0x6aac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6aac('0x6'));var attributes=require('./userMailQueue.attributes');module[_0x6aac('0x7')]=function(_0x38b765,_0x2d4511){return _0x38b765['define'](_0x6aac('0x8'),attributes,{'tableName':_0x6aac('0x9'),'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 f115e72..c4d888c 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x48feef,_0xde9e77){var _0x1d9e12=function(_0x1f583b){while(--_0x1f583b){_0x48feef['push'](_0x48feef['shift']());}};_0x1d9e12(++_0xde9e77);}(_0x34e8,0x12c));var _0x834e=function(_0x17d480,_0x4000ba){_0x17d480=_0x17d480-0x0;var _0x2b795b=_0x34e8[_0x17d480];return _0x2b795b;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +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(_0x5bf390,_0x4077ba){var _0x25b2a3=function(_0x4f982d){while(--_0x4f982d){_0x5bf390['push'](_0x5bf390['shift']());}};_0x25b2a3(++_0x4077ba);}(_0x6aa7,0x178));var _0x76aa=function(_0x17c218,_0x673dc4){_0x17c218=_0x17c218-0x0;var _0x405a48=_0x6aa7[_0x17c218];return _0x405a48;};'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 diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 41d907e..99e5315 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 _0xeb0b=['fs-extra','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','util','path','connect-timeout'];(function(_0x268e9b,_0xb422e2){var _0x30d633=function(_0x5b655e){while(--_0x5b655e){_0x268e9b['push'](_0x268e9b['shift']());}};_0x30d633(++_0xb422e2);}(_0xeb0b,0x1b5));var _0xbeb0=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xeb0b[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0xbeb0('0x0'));var path=require(_0xbeb0('0x1'));var timeout=require(_0xbeb0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbeb0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbeb0('0x4'));var config=require('../../config/environment');var controller=require(_0xbeb0('0x5'));router[_0xbeb0('0x6')]('/',auth[_0xbeb0('0x7')](),controller[_0xbeb0('0x8')]);module[_0xbeb0('0x9')]=router; \ No newline at end of file +var _0xc492=['./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','express','Router','fs-extra','../../config/environment'];(function(_0x1de2fc,_0x5d8196){var _0x341950=function(_0x326988){while(--_0x326988){_0x1de2fc['push'](_0x1de2fc['shift']());}};_0x341950(++_0x5d8196);}(_0xc492,0x195));var _0x2c49=function(_0x343d64,_0xb52198){_0x343d64=_0x343d64-0x0;var _0x5317ed=_0xc492[_0x343d64];return _0x5317ed;};'use strict';var multer=require(_0x2c49('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2c49('0x1'));var router=express[_0x2c49('0x2')]();var fs_extra=require(_0x2c49('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2c49('0x4'));var controller=require(_0x2c49('0x5'));router[_0x2c49('0x6')]('/',auth[_0x2c49('0x7')](),controller[_0x2c49('0x8')]);module[_0x2c49('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 0efbdd1..0371624 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 _0x76d3=['STRING','sequelize','exports','TEXT'];(function(_0x8a72b5,_0x4bc41f){var _0x2eadfd=function(_0x516942){while(--_0x516942){_0x8a72b5['push'](_0x8a72b5['shift']());}};_0x2eadfd(++_0x4bc41f);}(_0x76d3,0x15d));var _0x376d=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x76d3[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x376d('0x0'));module[_0x376d('0x1')]={'body':{'type':Sequelize[_0x376d('0x2')]},'senderName':{'type':Sequelize[_0x376d('0x3')]},'recipientsId':{'type':Sequelize[_0x376d('0x2')]},'recipientsDescription':{'type':Sequelize[_0x376d('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xcb55=['STRING','TEXT','sequelize','exports'];(function(_0x31cae7,_0x297087){var _0x3f8521=function(_0x150422){while(--_0x150422){_0x31cae7['push'](_0x31cae7['shift']());}};_0x3f8521(++_0x297087);}(_0xcb55,0x16a));var _0x5cb5=function(_0x3228d7,_0x39d396){_0x3228d7=_0x3228d7-0x0;var _0x51fdba=_0xcb55[_0x3228d7];return _0x51fdba;};'use strict';var Sequelize=require(_0x5cb5('0x0'));module[_0x5cb5('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x5cb5('0x2')]},'recipientsId':{'type':Sequelize[_0x5cb5('0x3')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 3143201..d6225ed 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 _0x1e4b=['model','senderName','user','recipientsDescription','isEmpty','beep','sortBy','join','UserNotification','create','forEach','recipient','userNotification:send','catch','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','view','startCase','toLowerCase','User','union','ids','includes','queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','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','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end','status','json','limit','offset','set','reject','then','destroy','error','stack','name','send','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','some'];(function(_0x51ec85,_0x46832c){var _0x59f6e8=function(_0x1deccd){while(--_0x1deccd){_0x51ec85['push'](_0x51ec85['shift']());}};_0x59f6e8(++_0x46832c);}(_0x1e4b,0x198));var _0xb1e4=function(_0xf777d5,_0x13ae62){_0xf777d5=_0xf777d5-0x0;var _0x879dff=_0x1e4b[_0xf777d5];return _0x879dff;};'use strict';var emlformat=require(_0xb1e4('0x0'));var rimraf=require(_0xb1e4('0x1'));var zipdir=require(_0xb1e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb1e4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb1e4('0x4'));var util=require(_0xb1e4('0x5'));var path=require(_0xb1e4('0x6'));var sox=require('sox');var csv=require(_0xb1e4('0x7'));var ejs=require(_0xb1e4('0x8'));var fs=require('fs');var fs_extra=require(_0xb1e4('0x9'));var _=require(_0xb1e4('0xa'));var squel=require(_0xb1e4('0xb'));var crypto=require('crypto');var jsforce=require(_0xb1e4('0xc'));var deskjs=require(_0xb1e4('0xd'));var toCsv=require(_0xb1e4('0x7'));var querystring=require(_0xb1e4('0xe'));var Papa=require('papaparse');var Redis=require(_0xb1e4('0xf'));var authService=require(_0xb1e4('0x10'));var qs=require(_0xb1e4('0x11'));var as=require(_0xb1e4('0x12'));var hardwareService=require(_0xb1e4('0x13'));var logger=require('../../config/logger')(_0xb1e4('0x14'));var utils=require(_0xb1e4('0x15'));var config=require(_0xb1e4('0x16'));var licenseUtil=require(_0xb1e4('0x17'));var db=require(_0xb1e4('0x18'))['db'];config[_0xb1e4('0x19')]=_[_0xb1e4('0x1a')](config[_0xb1e4('0x19')],{'host':_0xb1e4('0x1b'),'port':0x18eb});var socket=require(_0xb1e4('0x1c'))(new Redis(config[_0xb1e4('0x19')]));require(_0xb1e4('0x1d'))[_0xb1e4('0x1e')](socket);function respondWithStatusCode(_0x285202,_0x330bc4){_0x330bc4=_0x330bc4||0xcc;return function(_0x593ba8){if(_0x593ba8){return _0x285202[_0xb1e4('0x1f')](_0x330bc4);}return _0x285202['status'](_0x330bc4)[_0xb1e4('0x20')]();};}function respondWithResult(_0x534076,_0x176656){_0x176656=_0x176656||0xc8;return function(_0x45cbb2){if(_0x45cbb2){return _0x534076[_0xb1e4('0x21')](_0x176656)[_0xb1e4('0x22')](_0x45cbb2);}};}function respondWithFilteredResult(_0x26a813,_0x5737be){return function(_0x4fe9d5){if(_0x4fe9d5){var _0x52ef47=typeof _0x5737be['offset']==='undefined'&&typeof _0x5737be[_0xb1e4('0x23')]==='undefined';var _0xe49e06=_0x4fe9d5['count'];var _0x100c39=_0x52ef47?0x0:_0x5737be[_0xb1e4('0x24')];var _0x3dd9d4=_0x52ef47?_0x4fe9d5['count']:_0x5737be[_0xb1e4('0x24')]+_0x5737be[_0xb1e4('0x23')];var _0x4fdc9e;if(_0x3dd9d4>=_0xe49e06){_0x3dd9d4=_0xe49e06;_0x4fdc9e=0xc8;}else{_0x4fdc9e=0xce;}_0x26a813['status'](_0x4fdc9e);return _0x26a813[_0xb1e4('0x25')]('Content-Range',_0x100c39+'-'+_0x3dd9d4+'/'+_0xe49e06)['json'](_0x4fe9d5);}return null;};}function patchUpdates(_0x47c53d){return function(_0x4f99b1){try{jsonpatch['apply'](_0x4f99b1,_0x47c53d,!![]);}catch(_0x31a0cf){return BPromise[_0xb1e4('0x26')](_0x31a0cf);}return _0x4f99b1['save']();};}function saveUpdates(_0x25005,_0x4a4822){return function(_0x40d106){if(_0x40d106){return _0x40d106['update'](_0x25005)[_0xb1e4('0x27')](function(_0x406a51){return _0x406a51;});}return null;};}function removeEntity(_0x3cdd7b,_0x1efc46){return function(_0x2166c1){if(_0x2166c1){return _0x2166c1[_0xb1e4('0x28')]()[_0xb1e4('0x27')](function(){_0x3cdd7b['status'](0xcc)[_0xb1e4('0x20')]();});}};}function handleEntityNotFound(_0x5cd487,_0x15d23f){return function(_0x358aff){if(!_0x358aff){_0x5cd487[_0xb1e4('0x1f')](0x194);}return _0x358aff;};}function handleError(_0x432c6b,_0x39640f){_0x39640f=_0x39640f||0x1f4;return function(_0x2450c4){logger[_0xb1e4('0x29')](_0x2450c4[_0xb1e4('0x2a')]);if(_0x2450c4['name']){delete _0x2450c4[_0xb1e4('0x2b')];}_0x432c6b[_0xb1e4('0x21')](_0x39640f)[_0xb1e4('0x2c')](_0x2450c4);};}exports['sendUserNotification']=function(_0x536e15,_0x3e6d4f,_0x51db9b){if(!_0x536e15[_0xb1e4('0x2d')][_0xb1e4('0x2e')]('text')&&!_0x536e15['body'][_0xb1e4('0x2e')](_0xb1e4('0x2f'))){throw new db[(_0xb1e4('0x30'))][(_0xb1e4('0x31'))](_0xb1e4('0x32'));}else{if(_0x536e15['body']['hasOwnProperty'](_0xb1e4('0x2f'))&&!_0x536e15[_0xb1e4('0x2d')][_0xb1e4('0x2e')]('view')){throw new db[(_0xb1e4('0x30'))][(_0xb1e4('0x31'))](_0xb1e4('0x33'));}if(!_0x536e15[_0xb1e4('0x2d')]['hasOwnProperty'](_0xb1e4('0x34'))){throw new db[(_0xb1e4('0x30'))][(_0xb1e4('0x31'))](_0xb1e4('0x35'));}else{try{var _0x1b7dee=JSON[_0xb1e4('0x36')](_0x536e15['body'][_0xb1e4('0x34')]);}catch(_0x462ddd){logger[_0xb1e4('0x29')](_0x462ddd);throw new db[(_0xb1e4('0x30'))][(_0xb1e4('0x31'))](_0xb1e4('0x37'));}var _0x1f4565=['chatqueue',_0xb1e4('0x38'),_0xb1e4('0x39'),'openchannelqueue',_0xb1e4('0x3a'),_0xb1e4('0x3b'),_0xb1e4('0x3c'),'team','user'];if(_[_0xb1e4('0x3d')](_0x1b7dee,function(_0x43083b){return!_['includes'](_0x1f4565,_0x43083b[_0xb1e4('0x3e')]['toLowerCase']());})){throw new db['Sequelize']['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x3a69b9={};_0x3a69b9[_0xb1e4('0x3f')]=_0x536e15[_0xb1e4('0x2d')][_0xb1e4('0x2e')](_0xb1e4('0x3f'))?_0x536e15[_0xb1e4('0x2d')][_0xb1e4('0x3f')]:_0x536e15[_0xb1e4('0x40')]['fullname'];_0x3a69b9[_0xb1e4('0x41')]=_[_0xb1e4('0x42')](_0x536e15[_0xb1e4('0x2d')][_0xb1e4('0x41')])?null:_0x536e15[_0xb1e4('0x2d')][_0xb1e4('0x41')];_0x3a69b9['beep']=_0x536e15[_0xb1e4('0x2d')][_0xb1e4('0x43')]||![];_0x3a69b9['SenderId']=_0x536e15[_0xb1e4('0x40')]['id'];return getContent(_0x536e15[_0xb1e4('0x2d')])[_0xb1e4('0x27')](function(_0x503358){_0x3a69b9['body']=_0x503358;return getRecipients(_0x1b7dee);})[_0xb1e4('0x27')](function(_0xc023a7){_0x3a69b9['recipientsId']=_[_0xb1e4('0x44')](_0xc023a7)[_0xb1e4('0x45')](',');return db['sequelize']['transaction'](function(_0x184935){return db[_0xb1e4('0x46')][_0xb1e4('0x47')](_0x3a69b9,{'raw':!![],'transaction':_0x184935})[_0xb1e4('0x27')](function(_0x180199){var _0x466d1f={'sender':_0x3a69b9[_0xb1e4('0x3f')],'description':_0x3a69b9[_0xb1e4('0x41')],'content':_0x3a69b9[_0xb1e4('0x2d')],'beep':_0x3a69b9['beep']};_0xc023a7[_0xb1e4('0x48')](function(_0x20db67){_0x466d1f[_0xb1e4('0x49')]=_0x20db67;socket['emit'](_0xb1e4('0x4a'),_0x466d1f);});return _0x180199;});});})[_0xb1e4('0x27')](respondWithResult(_0x3e6d4f,0xc9))[_0xb1e4('0x4b')](handleError(_0x3e6d4f,null));};function getContent(_0x1248a5){return new BPromise(function(_0x39b3f8,_0x3f8c26){if(_0x1248a5[_0xb1e4('0x4c')]){_0x39b3f8(_0x1248a5[_0xb1e4('0x4c')]);return;}return db[_0xb1e4('0x4d')][_0xb1e4('0x4e')]({'attributes':['html'],'where':{'id':_0x1248a5[_0xb1e4('0x2f')]},'raw':!![]})[_0xb1e4('0x27')](function(_0xdcc282){if(!_0xdcc282)throw new db[(_0xb1e4('0x30'))][(_0xb1e4('0x31'))](_0xb1e4('0x4f'));var _0x477594=Mustache['render'](_0xdcc282[_0xb1e4('0x50')],_0x1248a5[_0xb1e4('0x51')]);_0x39b3f8(_0x477594);})['catch'](function(_0x43e0e3){_0x3f8c26(_0x43e0e3);});});}function getRecipients(_0x15aa7f){return new BPromise(function(_0x5a1eb3,_0x413d4c){var _0x184eff=[];var _0x182e24=[];_0x15aa7f[_0xb1e4('0x48')](function(_0x4222a9){var _0x4db182=_[_0xb1e4('0x52')](_0x4222a9[_0xb1e4('0x3e')][_0xb1e4('0x53')]());if(_0x4db182===_0xb1e4('0x54')){_0x184eff=_[_0xb1e4('0x55')](_0x184eff,_0x4222a9[_0xb1e4('0x56')]);}else{if(_[_0xb1e4('0x57')](_0x4db182,_0xb1e4('0x58')))_0x4db182=_0x4db182['replace'](_0xb1e4('0x58'),'Queue');_0x4222a9[_0xb1e4('0x56')][_0xb1e4('0x48')](function(_0x4a56eb){_0x182e24[_0xb1e4('0x59')](getAgents(_0x4db182,_0x4a56eb));});}});return BPromise[_0xb1e4('0x5a')](_0x182e24)['then'](function(_0x10213d){_0x184eff=_['union'](_0x184eff,_[_0xb1e4('0x5b')](_0x10213d));_0x5a1eb3(_0x184eff);})['catch'](function(_0x5a8e44){_0x413d4c(_0x5a8e44);});});}function getAgents(_0x1c8542,_0x43577a){return new BPromise(function(_0x573bca,_0x180946){return db[_0x1c8542][_0xb1e4('0x4e')]({'where':{'id':_0x43577a}})[_0xb1e4('0x27')](function(_0x18f289){return _0x18f289[_0xb1e4('0x5c')]({'attributes':['id'],'raw':!![]})[_0xb1e4('0x27')](function(_0x3862a7){var _0x180eea=_[_0xb1e4('0x5d')](_0x3862a7,'id');_0x573bca(_0x180eea);});})[_0xb1e4('0x4b')](function(_0x5d37ea){_0x180946(_0x5d37ea);});});} \ No newline at end of file +var _0xed2e=['recipientsId','sortBy','join','forEach','emit','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','User','union','ids','replace','Queue','flatten','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','sendUserNotification','text','body','hasOwnProperty','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','beep','SenderId'];(function(_0x39bfc7,_0x39ca27){var _0x275d33=function(_0x21f66f){while(--_0x21f66f){_0x39bfc7['push'](_0x39bfc7['shift']());}};_0x275d33(++_0x39ca27);}(_0xed2e,0x132));var _0xeed2=function(_0x4b589f,_0x2c9bbb){_0x4b589f=_0x4b589f-0x0;var _0x4f0a37=_0xed2e[_0x4b589f];return _0x4f0a37;};'use strict';var emlformat=require(_0xeed2('0x0'));var rimraf=require(_0xeed2('0x1'));var zipdir=require(_0xeed2('0x2'));var jsonpatch=require(_0xeed2('0x3'));var rp=require(_0xeed2('0x4'));var moment=require(_0xeed2('0x5'));var BPromise=require(_0xeed2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeed2('0x7'));var sox=require(_0xeed2('0x8'));var csv=require(_0xeed2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeed2('0xa'));var _=require(_0xeed2('0xb'));var squel=require(_0xeed2('0xc'));var crypto=require(_0xeed2('0xd'));var jsforce=require(_0xeed2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xeed2('0x9'));var querystring=require(_0xeed2('0xf'));var Papa=require(_0xeed2('0x10'));var Redis=require(_0xeed2('0x11'));var authService=require(_0xeed2('0x12'));var qs=require(_0xeed2('0x13'));var as=require(_0xeed2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeed2('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xeed2('0x16'));var licenseUtil=require(_0xeed2('0x17'));var db=require(_0xeed2('0x18'))['db'];config[_0xeed2('0x19')]=_[_0xeed2('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeed2('0x1b'))(new Redis(config[_0xeed2('0x19')]));require(_0xeed2('0x1c'))[_0xeed2('0x1d')](socket);function respondWithStatusCode(_0x466f82,_0x2b1d1c){_0x2b1d1c=_0x2b1d1c||0xcc;return function(_0x5226e5){if(_0x5226e5){return _0x466f82[_0xeed2('0x1e')](_0x2b1d1c);}return _0x466f82[_0xeed2('0x1f')](_0x2b1d1c)[_0xeed2('0x20')]();};}function respondWithResult(_0x3a03d1,_0x21d709){_0x21d709=_0x21d709||0xc8;return function(_0x597663){if(_0x597663){return _0x3a03d1[_0xeed2('0x1f')](_0x21d709)['json'](_0x597663);}};}function respondWithFilteredResult(_0x395e51,_0x18b16a){return function(_0x585a9f){if(_0x585a9f){var _0x1f5dc4=typeof _0x18b16a[_0xeed2('0x21')]===_0xeed2('0x22')&&typeof _0x18b16a[_0xeed2('0x23')]===_0xeed2('0x22');var _0xba9735=_0x585a9f[_0xeed2('0x24')];var _0x1e0fbd=_0x1f5dc4?0x0:_0x18b16a['offset'];var _0xc0b323=_0x1f5dc4?_0x585a9f[_0xeed2('0x24')]:_0x18b16a[_0xeed2('0x21')]+_0x18b16a[_0xeed2('0x23')];var _0x4849ea;if(_0xc0b323>=_0xba9735){_0xc0b323=_0xba9735;_0x4849ea=0xc8;}else{_0x4849ea=0xce;}_0x395e51[_0xeed2('0x1f')](_0x4849ea);return _0x395e51[_0xeed2('0x25')](_0xeed2('0x26'),_0x1e0fbd+'-'+_0xc0b323+'/'+_0xba9735)[_0xeed2('0x27')](_0x585a9f);}return null;};}function patchUpdates(_0x449256){return function(_0x463671){try{jsonpatch[_0xeed2('0x28')](_0x463671,_0x449256,!![]);}catch(_0x18219a){return BPromise[_0xeed2('0x29')](_0x18219a);}return _0x463671[_0xeed2('0x2a')]();};}function saveUpdates(_0x153672,_0x441547){return function(_0x220a32){if(_0x220a32){return _0x220a32['update'](_0x153672)[_0xeed2('0x2b')](function(_0x27dad0){return _0x27dad0;});}return null;};}function removeEntity(_0x282e9f,_0x1f2bd7){return function(_0x5e2035){if(_0x5e2035){return _0x5e2035[_0xeed2('0x2c')]()[_0xeed2('0x2b')](function(){_0x282e9f[_0xeed2('0x1f')](0xcc)[_0xeed2('0x20')]();});}};}function handleEntityNotFound(_0x5a34f6,_0x39dc7d){return function(_0x283392){if(!_0x283392){_0x5a34f6['sendStatus'](0x194);}return _0x283392;};}function handleError(_0x304589,_0x152d71){_0x152d71=_0x152d71||0x1f4;return function(_0x1554e2){logger[_0xeed2('0x2d')](_0x1554e2[_0xeed2('0x2e')]);if(_0x1554e2[_0xeed2('0x2f')]){delete _0x1554e2['name'];}_0x304589[_0xeed2('0x1f')](_0x152d71)[_0xeed2('0x30')](_0x1554e2);};}exports[_0xeed2('0x31')]=function(_0x4d4065,_0x43f7c9,_0x1e8697){if(!_0x4d4065['body']['hasOwnProperty'](_0xeed2('0x32'))&&!_0x4d4065[_0xeed2('0x33')][_0xeed2('0x34')]('TemplateId')){throw new db[(_0xeed2('0x35'))]['ValidationError'](_0xeed2('0x36'));}else{if(_0x4d4065[_0xeed2('0x33')]['hasOwnProperty'](_0xeed2('0x37'))&&!_0x4d4065['body'][_0xeed2('0x34')](_0xeed2('0x38'))){throw new db[(_0xeed2('0x35'))][(_0xeed2('0x39'))](_0xeed2('0x3a'));}if(!_0x4d4065[_0xeed2('0x33')][_0xeed2('0x34')](_0xeed2('0x3b'))){throw new db['Sequelize'][(_0xeed2('0x39'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x2b3db5=JSON['parse'](_0x4d4065[_0xeed2('0x33')]['recipients']);}catch(_0x3fc11a){logger['error'](_0x3fc11a);throw new db['Sequelize'][(_0xeed2('0x39'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x6415ba=[_0xeed2('0x3c'),_0xeed2('0x3d'),_0xeed2('0x3e'),_0xeed2('0x3f'),_0xeed2('0x40'),_0xeed2('0x41'),_0xeed2('0x42'),_0xeed2('0x43'),'user'];if(_[_0xeed2('0x44')](_0x2b3db5,function(_0x47fa18){return!_[_0xeed2('0x45')](_0x6415ba,_0x47fa18[_0xeed2('0x46')][_0xeed2('0x47')]());})){throw new db[(_0xeed2('0x35'))][(_0xeed2('0x39'))](_0xeed2('0x48'));}}}var _0x76a060={};_0x76a060['senderName']=_0x4d4065['body'][_0xeed2('0x34')](_0xeed2('0x49'))?_0x4d4065[_0xeed2('0x33')][_0xeed2('0x49')]:_0x4d4065[_0xeed2('0x4a')]['fullname'];_0x76a060[_0xeed2('0x4b')]=_['isEmpty'](_0x4d4065['body'][_0xeed2('0x4b')])?null:_0x4d4065[_0xeed2('0x33')]['recipientsDescription'];_0x76a060[_0xeed2('0x4c')]=_0x4d4065['body'][_0xeed2('0x4c')]||![];_0x76a060[_0xeed2('0x4d')]=_0x4d4065[_0xeed2('0x4a')]['id'];return getContent(_0x4d4065[_0xeed2('0x33')])['then'](function(_0x405d91){_0x76a060['body']=_0x405d91;return getRecipients(_0x2b3db5);})[_0xeed2('0x2b')](function(_0xd104db){_0x76a060[_0xeed2('0x4e')]=_[_0xeed2('0x4f')](_0xd104db)[_0xeed2('0x50')](',');return db['sequelize']['transaction'](function(_0x589054){return db['UserNotification']['create'](_0x76a060,{'raw':!![],'transaction':_0x589054})[_0xeed2('0x2b')](function(_0x3398a2){var _0x39a039={'sender':_0x76a060[_0xeed2('0x49')],'description':_0x76a060[_0xeed2('0x4b')],'content':_0x76a060[_0xeed2('0x33')],'beep':_0x76a060[_0xeed2('0x4c')]};_0xd104db[_0xeed2('0x51')](function(_0x56b1af){_0x39a039['recipient']=_0x56b1af;socket[_0xeed2('0x52')]('userNotification:send',_0x39a039);});return _0x3398a2;});});})[_0xeed2('0x2b')](respondWithResult(_0x43f7c9,0xc9))[_0xeed2('0x53')](handleError(_0x43f7c9,null));};function getContent(_0x478e66){return new BPromise(function(_0x4a37b1,_0x33f394){if(_0x478e66[_0xeed2('0x32')]){_0x4a37b1(_0x478e66[_0xeed2('0x32')]);return;}return db[_0xeed2('0x54')][_0xeed2('0x55')]({'attributes':[_0xeed2('0x56')],'where':{'id':_0x478e66[_0xeed2('0x37')]},'raw':!![]})['then'](function(_0xd77f6b){if(!_0xd77f6b)throw new db[(_0xeed2('0x35'))]['ValidationError'](_0xeed2('0x57'));var _0x28d1d4=Mustache['render'](_0xd77f6b[_0xeed2('0x56')],_0x478e66[_0xeed2('0x38')]);_0x4a37b1(_0x28d1d4);})[_0xeed2('0x53')](function(_0x31d322){_0x33f394(_0x31d322);});});}function getRecipients(_0x27b6d0){return new BPromise(function(_0x344ce8,_0x44f132){var _0x304ed4=[];var _0x190df2=[];_0x27b6d0[_0xeed2('0x51')](function(_0x5bedac){var _0x48a7a3=_[_0xeed2('0x58')](_0x5bedac['model'][_0xeed2('0x47')]());if(_0x48a7a3===_0xeed2('0x59')){_0x304ed4=_[_0xeed2('0x5a')](_0x304ed4,_0x5bedac[_0xeed2('0x5b')]);}else{if(_['includes'](_0x48a7a3,'queue'))_0x48a7a3=_0x48a7a3[_0xeed2('0x5c')]('queue',_0xeed2('0x5d'));_0x5bedac['ids']['forEach'](function(_0x23ab56){_0x190df2['push'](getAgents(_0x48a7a3,_0x23ab56));});}});return BPromise['all'](_0x190df2)['then'](function(_0x5b69c2){_0x304ed4=_[_0xeed2('0x5a')](_0x304ed4,_[_0xeed2('0x5e')](_0x5b69c2));_0x344ce8(_0x304ed4);})[_0xeed2('0x53')](function(_0x5468c8){_0x44f132(_0x5468c8);});});}function getAgents(_0x1e2887,_0x2f0544){return new BPromise(function(_0x4248e3,_0x1a7249){return db[_0x1e2887][_0xeed2('0x55')]({'where':{'id':_0x2f0544}})[_0xeed2('0x2b')](function(_0x191b79){return _0x191b79[_0xeed2('0x5f')]({'attributes':['id'],'raw':!![]})['then'](function(_0x568681){var _0x49f995=_['map'](_0x568681,'id');_0x4248e3(_0x49f995);});})[_0xeed2('0x53')](function(_0x5c09bc){_0x1a7249(_0x5c09bc);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 3d3365b..2720572 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 _0x81d1=['../../mysqldb','UserNotification','save','remove','emit','hook','events'];(function(_0x4fa489,_0x4cba6b){var _0x41d2ce=function(_0x364060){while(--_0x364060){_0x4fa489['push'](_0x4fa489['shift']());}};_0x41d2ce(++_0x4cba6b);}(_0x81d1,0x172));var _0x181d=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x81d1[_0x25d386];return _0x857f4a;};'use strict';var EventEmitter=require(_0x181d('0x0'));var UserNotification=require(_0x181d('0x1'))['db'][_0x181d('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x181d('0x3'),'afterUpdate':'update','afterDestroy':_0x181d('0x4')};function emitEvent(_0x9593ad){return function(_0x111070,_0x3a26ac,_0x53171f){UserNotificationEvents[_0x181d('0x5')](_0x9593ad+':'+_0x111070['id'],_0x111070);UserNotificationEvents['emit'](_0x9593ad,_0x111070);_0x53171f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x181d('0x6')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0xce54=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners','update'];(function(_0x584a3c,_0x2fb7e6){var _0x6faa33=function(_0x587372){while(--_0x587372){_0x584a3c['push'](_0x584a3c['shift']());}};_0x6faa33(++_0x2fb7e6);}(_0xce54,0x136));var _0x4ce5=function(_0x34d9d5,_0x6aff42){_0x34d9d5=_0x34d9d5-0x0;var _0x10f583=_0xce54[_0x34d9d5];return _0x10f583;};'use strict';var EventEmitter=require(_0x4ce5('0x0'));var UserNotification=require(_0x4ce5('0x1'))['db'][_0x4ce5('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x4ce5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4ce5('0x4'),'afterDestroy':_0x4ce5('0x5')};function emitEvent(_0x1b45fd){return function(_0x360407,_0x15cb1a,_0x2c77cc){UserNotificationEvents[_0x4ce5('0x6')](_0x1b45fd+':'+_0x360407['id'],_0x360407);UserNotificationEvents[_0x4ce5('0x6')](_0x1b45fd,_0x360407);_0x2c77cc(null);};}for(var e in events){if(events[_0x4ce5('0x7')](e)){var event=events[e];UserNotification[_0x4ce5('0x8')](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 e74b51c..1c6af5e 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 _0x1fd0=['UserNotification','userNotifications','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x241d79,_0x3f6cd7){var _0x355805=function(_0x34e153){while(--_0x34e153){_0x241d79['push'](_0x241d79['shift']());}};_0x355805(++_0x3f6cd7);}(_0x1fd0,0x1bd));var _0x01fd=function(_0x92bcf4,_0x168a93){_0x92bcf4=_0x92bcf4-0x0;var _0x2bb264=_0x1fd0[_0x92bcf4];return _0x2bb264;};'use strict';var _=require(_0x01fd('0x0'));var util=require(_0x01fd('0x1'));var logger=require(_0x01fd('0x2'))(_0x01fd('0x3'));var moment=require('moment');var BPromise=require(_0x01fd('0x4'));var rp=require(_0x01fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01fd('0x6'));var config=require(_0x01fd('0x7'));var attributes=require('./userNotification.attributes');module[_0x01fd('0x8')]=function(_0x1b787c,_0x4f0c8f){return _0x1b787c[_0x01fd('0x9')](_0x01fd('0xa'),attributes,{'tableName':_0x01fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01fd('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x75c5=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x75c5,0xfb));var _0x575c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75c5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x575c('0x0'));var util=require(_0x575c('0x1'));var logger=require(_0x575c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x575c('0x3'));var rp=require(_0x575c('0x4'));var fs=require('fs');var path=require(_0x575c('0x5'));var rimraf=require(_0x575c('0x6'));var config=require(_0x575c('0x7'));var attributes=require('./userNotification.attributes');module[_0x575c('0x8')]=function(_0x38da2a,_0x62e644){return _0x38da2a[_0x575c('0x9')](_0x575c('0xa'),attributes,{'tableName':_0x575c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x575c('0xc'),'collate':_0x575c('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 8948831..4514ae2 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 _0x9fc2=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x22b832,_0x4696fe){var _0x3b47bc=function(_0x1d2f01){while(--_0x1d2f01){_0x22b832['push'](_0x22b832['shift']());}};_0x3b47bc(++_0x4696fe);}(_0x9fc2,0x181));var _0x29fc=function(_0x504197,_0x53304f){_0x504197=_0x504197-0x0;var _0x4ca27c=_0x9fc2[_0x504197];return _0x4ca27c;};'use strict';var _=require(_0x29fc('0x0'));var util=require(_0x29fc('0x1'));var moment=require(_0x29fc('0x2'));var BPromise=require(_0x29fc('0x3'));var rs=require(_0x29fc('0x4'));var fs=require('fs');var Redis=require(_0x29fc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x29fc('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x29fc('0x7'));var jayson=require(_0x29fc('0x8'));var client=jayson[_0x29fc('0x9')][_0x29fc('0xa')]({'port':0x232a});config[_0x29fc('0xb')]=_[_0x29fc('0xc')](config['redis'],{'host':_0x29fc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x29fc('0xb')]));require(_0x29fc('0xe'))['register'](socket);function respondWithRpcPromise(_0x3108fe,_0x5a49b7,_0x2dc86f){return new BPromise(function(_0x1dd43b,_0x24291f){return client[_0x29fc('0xf')](_0x3108fe,_0x2dc86f)[_0x29fc('0x10')](function(_0x1f9493){logger[_0x29fc('0x11')](_0x29fc('0x12'),_0x5a49b7,_0x29fc('0x13'));logger[_0x29fc('0x14')](_0x29fc('0x15'),_0x5a49b7,_0x29fc('0x13'),JSON[_0x29fc('0x16')](_0x1f9493));if(_0x1f9493[_0x29fc('0x17')]){if(_0x1f9493[_0x29fc('0x17')]['code']===0x1f4){logger[_0x29fc('0x17')](_0x29fc('0x12'),_0x5a49b7,_0x1f9493[_0x29fc('0x17')]['message']);return _0x24291f(_0x1f9493[_0x29fc('0x17')]['message']);}logger[_0x29fc('0x17')](_0x29fc('0x12'),_0x5a49b7,_0x1f9493[_0x29fc('0x17')][_0x29fc('0x18')]);return _0x1dd43b(_0x1f9493['error']['message']);}else{logger[_0x29fc('0x11')](_0x29fc('0x12'),_0x5a49b7,'request\x20sent');_0x1dd43b(_0x1f9493['result']['message']);}})[_0x29fc('0x19')](function(_0x2beb79){logger[_0x29fc('0x17')](_0x29fc('0x12'),_0x5a49b7,_0x2beb79);_0x24291f(_0x2beb79);});});} \ No newline at end of file +var _0xfd4b=['../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x104bef,_0x265d37){var _0x8918fa=function(_0x4be512){while(--_0x4be512){_0x104bef['push'](_0x104bef['shift']());}};_0x8918fa(++_0x265d37);}(_0xfd4b,0x1aa));var _0xbfd4=function(_0x276231,_0x1c20f1){_0x276231=_0x276231-0x0;var _0x2178b4=_0xfd4b[_0x276231];return _0x2178b4;};'use strict';var _=require(_0xbfd4('0x0'));var util=require(_0xbfd4('0x1'));var moment=require(_0xbfd4('0x2'));var BPromise=require(_0xbfd4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfd4('0x4'));var db=require(_0xbfd4('0x5'))['db'];var utils=require(_0xbfd4('0x6'));var logger=require(_0xbfd4('0x7'))(_0xbfd4('0x8'));var config=require('../../config/environment');var jayson=require(_0xbfd4('0x9'));var client=jayson['client'][_0xbfd4('0xa')]({'port':0x232a});config[_0xbfd4('0xb')]=_[_0xbfd4('0xc')](config[_0xbfd4('0xb')],{'host':_0xbfd4('0xd'),'port':0x18eb});var socket=require(_0xbfd4('0xe'))(new Redis(config[_0xbfd4('0xb')]));require(_0xbfd4('0xf'))[_0xbfd4('0x10')](socket);function respondWithRpcPromise(_0x349188,_0x5d9fab,_0x161928){return new BPromise(function(_0x3d5c19,_0x53ef5d){return client[_0xbfd4('0x11')](_0x349188,_0x161928)[_0xbfd4('0x12')](function(_0x11f2f8){logger[_0xbfd4('0x13')](_0xbfd4('0x14'),_0x5d9fab,_0xbfd4('0x15'));logger[_0xbfd4('0x16')](_0xbfd4('0x17'),_0x5d9fab,_0xbfd4('0x15'),JSON[_0xbfd4('0x18')](_0x11f2f8));if(_0x11f2f8[_0xbfd4('0x19')]){if(_0x11f2f8[_0xbfd4('0x19')]['code']===0x1f4){logger[_0xbfd4('0x19')](_0xbfd4('0x14'),_0x5d9fab,_0x11f2f8[_0xbfd4('0x19')]['message']);return _0x53ef5d(_0x11f2f8[_0xbfd4('0x19')][_0xbfd4('0x1a')]);}logger[_0xbfd4('0x19')](_0xbfd4('0x14'),_0x5d9fab,_0x11f2f8[_0xbfd4('0x19')][_0xbfd4('0x1a')]);return _0x3d5c19(_0x11f2f8[_0xbfd4('0x19')][_0xbfd4('0x1a')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x5d9fab,_0xbfd4('0x15'));_0x3d5c19(_0x11f2f8['result'][_0xbfd4('0x1a')]);}})['catch'](function(_0x45442b){logger[_0xbfd4('0x19')](_0xbfd4('0x14'),_0x5d9fab,_0x45442b);_0x53ef5d(_0x45442b);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 814a8ba..0f63a68 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 _0x42b0=['save','update','removeListener','register','length','userNotification:','./userNotification.events'];(function(_0x52ff2d,_0x5c7dfe){var _0xd7085=function(_0xa538d7){while(--_0xa538d7){_0x52ff2d['push'](_0x52ff2d['shift']());}};_0xd7085(++_0x5c7dfe);}(_0x42b0,0x110));var _0x042b=function(_0x1fd8b3,_0x3bd29a){_0x1fd8b3=_0x1fd8b3-0x0;var _0x1f461f=_0x42b0[_0x1fd8b3];return _0x1f461f;};'use strict';var UserNotificationEvents=require(_0x042b('0x0'));var events=[_0x042b('0x1'),'remove',_0x042b('0x2')];function createListener(_0x77a98a,_0x563019){return function(_0x5ca0a9){_0x563019['emit'](_0x77a98a,_0x5ca0a9);};}function removeListener(_0x10f20b,_0x25c2ea){return function(){UserNotificationEvents[_0x042b('0x3')](_0x10f20b,_0x25c2ea);};}exports[_0x042b('0x4')]=function(_0x397560){for(var _0x342870=0x0,_0x2ca192=events[_0x042b('0x5')];_0x342870<_0x2ca192;_0x342870++){var _0xc23d8d=events[_0x342870];var _0x6d0fe1=createListener(_0x042b('0x6')+_0xc23d8d,_0x397560);UserNotificationEvents['on'](_0xc23d8d,_0x6d0fe1);}}; \ No newline at end of file +var _0xd40d=['remove','update','emit','register','length','userNotification:','save'];(function(_0x452bed,_0x128e55){var _0x4bb2cf=function(_0x41f9b1){while(--_0x41f9b1){_0x452bed['push'](_0x452bed['shift']());}};_0x4bb2cf(++_0x128e55);}(_0xd40d,0x179));var _0xdd40=function(_0xa8f7a,_0x49777c){_0xa8f7a=_0xa8f7a-0x0;var _0x3c491d=_0xd40d[_0xa8f7a];return _0x3c491d;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xdd40('0x0'),_0xdd40('0x1'),_0xdd40('0x2')];function createListener(_0x4de0a7,_0x43b685){return function(_0x5b11fb){_0x43b685[_0xdd40('0x3')](_0x4de0a7,_0x5b11fb);};}function removeListener(_0x2ab050,_0x511127){return function(){UserNotificationEvents['removeListener'](_0x2ab050,_0x511127);};}exports[_0xdd40('0x4')]=function(_0x1c010e){for(var _0xcbd97f=0x0,_0x3609e1=events[_0xdd40('0x5')];_0xcbd97f<_0x3609e1;_0xcbd97f++){var _0x378f0f=events[_0xcbd97f];var _0x1acf07=createListener(_0xdd40('0x6')+_0x378f0f,_0x1c010e);UserNotificationEvents['on'](_0x378f0f,_0x1acf07);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index d1c120f..7b0c311 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x512066,_0x1c9ca1){var _0x2b99bd=function(_0x1fe14c){while(--_0x1fe14c){_0x512066['push'](_0x512066['shift']());}};_0x2b99bd(++_0x1c9ca1);}(_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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3b0042,_0x8e7550){var _0x41bf57=function(_0x2bb397){while(--_0x2bb397){_0x3b0042['push'](_0x3b0042['shift']());}};_0x41bf57(++_0x8e7550);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 8539fe2..431fa0f 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 _0x4332=['INTEGER','sequelize'];(function(_0x282c9e,_0x356ff6){var _0x11f3ce=function(_0x1cd7c7){while(--_0x1cd7c7){_0x282c9e['push'](_0x282c9e['shift']());}};_0x11f3ce(++_0x356ff6);}(_0x4332,0x73));var _0x2433=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4332[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x2433('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x2433('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4e3d=['exports','sequelize'];(function(_0x5d5553,_0x511280){var _0x40721e=function(_0x37ed18){while(--_0x37ed18){_0x5d5553['push'](_0x5d5553['shift']());}};_0x40721e(++_0x511280);}(_0x4e3d,0x85));var _0xd4e3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4e3d[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xd4e3('0x0'));module[_0xd4e3('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 3236d6d..3a4be9f 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 _0x82fd=['rimraf','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x37130c,_0x2d3df5){var _0x4cac49=function(_0x124603){while(--_0x124603){_0x37130c['push'](_0x37130c['shift']());}};_0x4cac49(++_0x2d3df5);}(_0x82fd,0xc0));var _0xd82f=function(_0x3e9014,_0x4c7c50){_0x3e9014=_0x3e9014-0x0;var _0x1fbbc5=_0x82fd[_0x3e9014];return _0x1fbbc5;};'use strict';var _=require(_0xd82f('0x0'));var util=require('util');var logger=require(_0xd82f('0x1'))(_0xd82f('0x2'));var moment=require('moment');var BPromise=require(_0xd82f('0x3'));var rp=require(_0xd82f('0x4'));var fs=require('fs');var path=require(_0xd82f('0x5'));var rimraf=require(_0xd82f('0x6'));var config=require('../../config/environment');var attributes=require(_0xd82f('0x7'));module[_0xd82f('0x8')]=function(_0x3c62e7,_0x269ee5){return _0x3c62e7[_0xd82f('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0xd82f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x387d=['api','moment','bluebird','request-promise','path','rimraf','define','UserOpenchannelQueue','lodash','util','../../config/logger'];(function(_0x3f9f43,_0x46199d){var _0x460fd2=function(_0x3cd37c){while(--_0x3cd37c){_0x3f9f43['push'](_0x3f9f43['shift']());}};_0x460fd2(++_0x46199d);}(_0x387d,0x15d));var _0xd387=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x387d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xd387('0x0'));var util=require(_0xd387('0x1'));var logger=require(_0xd387('0x2'))(_0xd387('0x3'));var moment=require(_0xd387('0x4'));var BPromise=require(_0xd387('0x5'));var rp=require(_0xd387('0x6'));var fs=require('fs');var path=require(_0xd387('0x7'));var rimraf=require(_0xd387('0x8'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x4079ec,_0x4b3295){return _0x4079ec[_0xd387('0x9')](_0xd387('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 5ab1820..5b6ae79 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 _0x1067=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x1067,0x7f));var _0x7106=function(_0x20960e,_0x467b28){_0x20960e=_0x20960e-0x0;var _0x313fe8=_0x1067[_0x20960e];return _0x313fe8;};'use strict';var _=require(_0x7106('0x0'));var util=require('util');var moment=require(_0x7106('0x1'));var BPromise=require(_0x7106('0x2'));var rs=require(_0x7106('0x3'));var fs=require('fs');var Redis=require(_0x7106('0x4'));var db=require(_0x7106('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7106('0x6'))(_0x7106('0x7'));var config=require('../../config/environment');var jayson=require(_0x7106('0x8'));var client=jayson[_0x7106('0x9')][_0x7106('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dfaca,_0x34955f,_0x551602){return new BPromise(function(_0x2738ef,_0x53cc60){return client[_0x7106('0xb')](_0x4dfaca,_0x551602)[_0x7106('0xc')](function(_0x33a22f){logger[_0x7106('0xd')](_0x7106('0xe'),_0x34955f,_0x7106('0xf'));logger[_0x7106('0x10')](_0x7106('0x11'),_0x34955f,_0x7106('0xf'),JSON['stringify'](_0x33a22f));if(_0x33a22f[_0x7106('0x12')]){if(_0x33a22f[_0x7106('0x12')]['code']===0x1f4){logger[_0x7106('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x34955f,_0x33a22f[_0x7106('0x12')][_0x7106('0x13')]);return _0x53cc60(_0x33a22f[_0x7106('0x12')][_0x7106('0x13')]);}logger['error'](_0x7106('0xe'),_0x34955f,_0x33a22f[_0x7106('0x12')][_0x7106('0x13')]);return _0x2738ef(_0x33a22f[_0x7106('0x12')]['message']);}else{logger[_0x7106('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x34955f,_0x7106('0xf'));_0x2738ef(_0x33a22f[_0x7106('0x14')][_0x7106('0x13')]);}})[_0x7106('0x15')](function(_0x9e8276){logger[_0x7106('0x12')](_0x7106('0xe'),_0x34955f,_0x9e8276);_0x53cc60(_0x9e8276);});});} \ No newline at end of file +var _0xcf2f=['stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x333cee,_0x17f8b7){var _0x4cb8ce=function(_0x500dd4){while(--_0x500dd4){_0x333cee['push'](_0x333cee['shift']());}};_0x4cb8ce(++_0x17f8b7);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x2c12e3,_0x1ee4ab){_0x2c12e3=_0x2c12e3-0x0;var _0x5fb3c1=_0xcf2f[_0x2c12e3];return _0x5fb3c1;};'use strict';var _=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var moment=require(_0xfcf2('0x2'));var BPromise=require(_0xfcf2('0x3'));var rs=require(_0xfcf2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcf2('0x5'))['db'];var utils=require(_0xfcf2('0x6'));var logger=require(_0xfcf2('0x7'))(_0xfcf2('0x8'));var config=require(_0xfcf2('0x9'));var jayson=require(_0xfcf2('0xa'));var client=jayson[_0xfcf2('0xb')][_0xfcf2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41d4bd,_0x157f48,_0x16b6b2){return new BPromise(function(_0x34f444,_0xb4c510){return client[_0xfcf2('0xd')](_0x41d4bd,_0x16b6b2)['then'](function(_0x575f33){logger['info'](_0xfcf2('0xe'),_0x157f48,_0xfcf2('0xf'));logger['debug'](_0xfcf2('0x10'),_0x157f48,_0xfcf2('0xf'),JSON[_0xfcf2('0x11')](_0x575f33));if(_0x575f33[_0xfcf2('0x12')]){if(_0x575f33['error']['code']===0x1f4){logger[_0xfcf2('0x12')](_0xfcf2('0xe'),_0x157f48,_0x575f33[_0xfcf2('0x12')][_0xfcf2('0x13')]);return _0xb4c510(_0x575f33['error'][_0xfcf2('0x13')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x157f48,_0x575f33['error'][_0xfcf2('0x13')]);return _0x34f444(_0x575f33['error'][_0xfcf2('0x13')]);}else{logger[_0xfcf2('0x14')](_0xfcf2('0xe'),_0x157f48,_0xfcf2('0xf'));_0x34f444(_0x575f33[_0xfcf2('0x15')][_0xfcf2('0x13')]);}})[_0xfcf2('0x16')](function(_0x4d64ce){logger[_0xfcf2('0x12')](_0xfcf2('0xe'),_0x157f48,_0x4d64ce);_0xb4c510(_0x4d64ce);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e3121be..883523d 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 _0x7fb7=['express','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','put','delete','destroy','removeResources','exports','multer','util','path','connect-timeout'];(function(_0x285430,_0x1c8b55){var _0x468ad1=function(_0x439f36){while(--_0x439f36){_0x285430['push'](_0x285430['shift']());}};_0x468ad1(++_0x1c8b55);}(_0x7fb7,0x13b));var _0x77fb=function(_0x552fce,_0x3f24bc){_0x552fce=_0x552fce-0x0;var _0x3e27a2=_0x7fb7[_0x552fce];return _0x3e27a2;};'use strict';var multer=require(_0x77fb('0x0'));var util=require(_0x77fb('0x1'));var path=require(_0x77fb('0x2'));var timeout=require(_0x77fb('0x3'));var express=require(_0x77fb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x77fb('0x5'));var interaction=require(_0x77fb('0x6'));var config=require('../../config/environment');var controller=require(_0x77fb('0x7'));router[_0x77fb('0x8')]('/',auth[_0x77fb('0x9')](),controller[_0x77fb('0xa')]);router[_0x77fb('0x8')](_0x77fb('0xb'),auth['isAuthenticated'](),controller[_0x77fb('0xc')]);router[_0x77fb('0x8')](_0x77fb('0xd'),auth['isAuthenticated'](),controller[_0x77fb('0xe')]);router[_0x77fb('0x8')](_0x77fb('0xf'),auth[_0x77fb('0x9')](),controller[_0x77fb('0x10')]);router[_0x77fb('0x8')](_0x77fb('0x11'),auth[_0x77fb('0x9')](),controller[_0x77fb('0x12')]);router[_0x77fb('0x13')]('/',auth['isAuthenticated'](),controller[_0x77fb('0x14')]);router['post'](_0x77fb('0x15'),auth[_0x77fb('0x9')](),controller[_0x77fb('0x16')]);router[_0x77fb('0x13')](_0x77fb('0xf'),auth[_0x77fb('0x9')](),controller[_0x77fb('0x17')]);router[_0x77fb('0x13')](_0x77fb('0x11'),auth[_0x77fb('0x9')](),controller['addResources']);router[_0x77fb('0x18')](_0x77fb('0xd'),auth[_0x77fb('0x9')](),controller['update']);router[_0x77fb('0x19')](_0x77fb('0xd'),auth[_0x77fb('0x9')](),controller[_0x77fb('0x1a')]);router[_0x77fb('0x19')](_0x77fb('0xf'),auth[_0x77fb('0x9')](),controller['removeSections']);router[_0x77fb('0x19')](_0x77fb('0x11'),auth[_0x77fb('0x9')](),controller[_0x77fb('0x1b')]);module[_0x77fb('0x1c')]=router; \ No newline at end of file +var _0x24b6=['post','create','/:id/clone','clone','addSections','/:id/resources','addResources','put','/:id','update','delete','removeSections','removeResources','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','/describe','describe','get','/:id/sections','getSections','getResources'];(function(_0x4bce7c,_0x2e4d8a){var _0x5645c6=function(_0xe26be4){while(--_0xe26be4){_0x4bce7c['push'](_0x4bce7c['shift']());}};_0x5645c6(++_0x2e4d8a);}(_0x24b6,0x1a4));var _0x624b=function(_0x2f4524,_0x56ecaf){_0x2f4524=_0x2f4524-0x0;var _0x162329=_0x24b6[_0x2f4524];return _0x162329;};'use strict';var multer=require(_0x624b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x624b('0x1'));var express=require(_0x624b('0x2'));var router=express[_0x624b('0x3')]();var fs_extra=require(_0x624b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x624b('0x5'));var config=require(_0x624b('0x6'));var controller=require(_0x624b('0x7'));router['get']('/',auth[_0x624b('0x8')](),controller['index']);router['get'](_0x624b('0x9'),auth['isAuthenticated'](),controller[_0x624b('0xa')]);router[_0x624b('0xb')]('/:id',auth[_0x624b('0x8')](),controller['show']);router[_0x624b('0xb')](_0x624b('0xc'),auth[_0x624b('0x8')](),controller[_0x624b('0xd')]);router[_0x624b('0xb')]('/:id/resources',auth[_0x624b('0x8')](),controller[_0x624b('0xe')]);router[_0x624b('0xf')]('/',auth[_0x624b('0x8')](),controller[_0x624b('0x10')]);router[_0x624b('0xf')](_0x624b('0x11'),auth[_0x624b('0x8')](),controller[_0x624b('0x12')]);router['post'](_0x624b('0xc'),auth[_0x624b('0x8')](),controller[_0x624b('0x13')]);router[_0x624b('0xf')](_0x624b('0x14'),auth[_0x624b('0x8')](),controller[_0x624b('0x15')]);router[_0x624b('0x16')](_0x624b('0x17'),auth['isAuthenticated'](),controller[_0x624b('0x18')]);router[_0x624b('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x624b('0xc'),auth[_0x624b('0x8')](),controller[_0x624b('0x1a')]);router['delete'](_0x624b('0x14'),auth[_0x624b('0x8')](),controller[_0x624b('0x1b')]);module[_0x624b('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 9aa9b8b..524ec9b 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 _0x7497=['STRING','name','crudPermissions','join','getDataValue','BOOLEAN','sequelize'];(function(_0x423549,_0x242e63){var _0xdcb104=function(_0x6bff59){while(--_0x6bff59){_0x423549['push'](_0x423549['shift']());}};_0xdcb104(++_0x242e63);}(_0x7497,0x187));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7749('0x0'));module['exports']={'name':{'type':Sequelize[_0x7749('0x1')],'allowNull':![],'unique':_0x7749('0x2')},'crudPermissions':{'type':Sequelize[_0x7749('0x1')],'set':function(_0x4449af){this['setDataValue'](_0x7749('0x3'),_0x4449af?_0x4449af[_0x7749('0x4')](''):[]);},'get':function(){return this[_0x7749('0x5')]('crudPermissions')?this['getDataValue'](_0x7749('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x7749('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x7749('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x7749('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7749('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x7749('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7749('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x7749('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7749('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2887=['exports','STRING','name','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2887,0x1af));var _0x7288=function(_0x3ebe6b,_0x50bbf7){_0x3ebe6b=_0x3ebe6b-0x0;var _0x334cfc=_0x2887[_0x3ebe6b];return _0x334cfc;};'use strict';var Sequelize=require(_0x7288('0x0'));module[_0x7288('0x1')]={'name':{'type':Sequelize[_0x7288('0x2')],'allowNull':![],'unique':_0x7288('0x3')},'crudPermissions':{'type':Sequelize[_0x7288('0x2')],'set':function(_0x3960aa){this['setDataValue'](_0x7288('0x4'),_0x3960aa?_0x3960aa[_0x7288('0x5')](''):[]);},'get':function(){return this[_0x7288('0x6')](_0x7288('0x4'))?this[_0x7288('0x6')](_0x7288('0x4'))[_0x7288('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x7288('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x7288('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x7288('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7288('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x7288('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7288('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x7288('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7288('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 2e54103..fcee178 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 _0x4d86=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','clone','merge','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','describe','addSections','ids','enabled','includes','subsections','concat','push','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','offset','undefined','limit','count','status','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','keys','query','filters','intersection'];(function(_0x5f26b0,_0x357294){var _0x2aaf0f=function(_0x1daf64){while(--_0x1daf64){_0x5f26b0['push'](_0x5f26b0['shift']());}};_0x2aaf0f(++_0x357294);}(_0x4d86,0x128));var _0x64d8=function(_0x452e4e,_0x532b7d){_0x452e4e=_0x452e4e-0x0;var _0xea0521=_0x4d86[_0x452e4e];return _0xea0521;};'use strict';var emlformat=require(_0x64d8('0x0'));var rimraf=require(_0x64d8('0x1'));var zipdir=require(_0x64d8('0x2'));var jsonpatch=require(_0x64d8('0x3'));var rp=require(_0x64d8('0x4'));var moment=require(_0x64d8('0x5'));var BPromise=require(_0x64d8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x64d8('0x7'));var sox=require(_0x64d8('0x8'));var csv=require(_0x64d8('0x9'));var ejs=require(_0x64d8('0xa'));var fs=require('fs');var fs_extra=require(_0x64d8('0xb'));var _=require(_0x64d8('0xc'));var squel=require(_0x64d8('0xd'));var crypto=require(_0x64d8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x64d8('0xf'));var toCsv=require(_0x64d8('0x9'));var querystring=require(_0x64d8('0x10'));var Papa=require(_0x64d8('0x11'));var Redis=require(_0x64d8('0x12'));var authService=require(_0x64d8('0x13'));var qs=require(_0x64d8('0x14'));var as=require(_0x64d8('0x15'));var hardwareService=require(_0x64d8('0x16'));var logger=require(_0x64d8('0x17'))(_0x64d8('0x18'));var utils=require(_0x64d8('0x19'));var config=require(_0x64d8('0x1a'));var licenseUtil=require(_0x64d8('0x1b'));var db=require('../../mysqldb')['db'];config[_0x64d8('0x1c')]=_[_0x64d8('0x1d')](config[_0x64d8('0x1c')],{'host':_0x64d8('0x1e'),'port':0x18eb});var socket=require(_0x64d8('0x1f'))(new Redis(config[_0x64d8('0x1c')]));require(_0x64d8('0x20'))[_0x64d8('0x21')](socket);function respondWithStatusCode(_0x22ed1f,_0x3e6ccf){_0x3e6ccf=_0x3e6ccf||0xcc;return function(_0x2ec036){if(_0x2ec036){return _0x22ed1f[_0x64d8('0x22')](_0x3e6ccf);}return _0x22ed1f['status'](_0x3e6ccf)['end']();};}function respondWithResult(_0x34504f,_0x279bc6){_0x279bc6=_0x279bc6||0xc8;return function(_0x58004a){if(_0x58004a){return _0x34504f['status'](_0x279bc6)['json'](_0x58004a);}};}function respondWithFilteredResult(_0x5acd63,_0x109bfd){return function(_0x2edad6){if(_0x2edad6){var _0x20bed9=typeof _0x109bfd[_0x64d8('0x23')]===_0x64d8('0x24')&&typeof _0x109bfd[_0x64d8('0x25')]===_0x64d8('0x24');var _0x1a2fc6=_0x2edad6[_0x64d8('0x26')];var _0x2f4134=_0x20bed9?0x0:_0x109bfd[_0x64d8('0x23')];var _0x16605c=_0x20bed9?_0x2edad6[_0x64d8('0x26')]:_0x109bfd['offset']+_0x109bfd[_0x64d8('0x25')];var _0x1ae731;if(_0x16605c>=_0x1a2fc6){_0x16605c=_0x1a2fc6;_0x1ae731=0xc8;}else{_0x1ae731=0xce;}_0x5acd63[_0x64d8('0x27')](_0x1ae731);return _0x5acd63[_0x64d8('0x28')](_0x64d8('0x29'),_0x2f4134+'-'+_0x16605c+'/'+_0x1a2fc6)[_0x64d8('0x2a')](_0x2edad6);}return null;};}function patchUpdates(_0x4e4332){return function(_0x10e68f){try{jsonpatch['apply'](_0x10e68f,_0x4e4332,!![]);}catch(_0x3f40d9){return BPromise[_0x64d8('0x2b')](_0x3f40d9);}return _0x10e68f[_0x64d8('0x2c')]();};}function saveUpdates(_0x4c2183,_0x17d4c1){return function(_0x55ce44){if(_0x55ce44){return _0x55ce44[_0x64d8('0x2d')](_0x4c2183)['then'](function(_0x27b72d){return _0x27b72d;});}return null;};}function removeEntity(_0x1ae277,_0x5e6354){return function(_0x2c2563){if(_0x2c2563){return _0x2c2563[_0x64d8('0x2e')]()[_0x64d8('0x2f')](function(){_0x1ae277[_0x64d8('0x27')](0xcc)[_0x64d8('0x30')]();});}};}function handleEntityNotFound(_0x3d47d8,_0x349d5b){return function(_0x5c6e94){if(!_0x5c6e94){_0x3d47d8['sendStatus'](0x194);}return _0x5c6e94;};}function handleError(_0x2f8ced,_0x3220ce){_0x3220ce=_0x3220ce||0x1f4;return function(_0x20c182){logger[_0x64d8('0x31')](_0x20c182[_0x64d8('0x32')]);if(_0x20c182[_0x64d8('0x33')]){delete _0x20c182[_0x64d8('0x33')];}_0x2f8ced[_0x64d8('0x27')](_0x3220ce)[_0x64d8('0x34')](_0x20c182);};}exports[_0x64d8('0x35')]=function(_0x2d6bd7,_0x24a4e3){var _0x13215b={},_0x34f7aa={},_0x492fee={'count':0x0,'rows':[]};var _0x28d0a6=_[_0x64d8('0x36')](db[_0x64d8('0x37')][_0x64d8('0x38')],function(_0x31642){return{'name':_0x31642[_0x64d8('0x39')],'type':_0x31642[_0x64d8('0x3a')][_0x64d8('0x3b')]};});_0x34f7aa['model']=_[_0x64d8('0x36')](_0x28d0a6,'name');_0x34f7aa['query']=_[_0x64d8('0x3c')](_0x2d6bd7[_0x64d8('0x3d')]);_0x34f7aa[_0x64d8('0x3e')]=_[_0x64d8('0x3f')](_0x34f7aa[_0x64d8('0x40')],_0x34f7aa[_0x64d8('0x3d')]);_0x13215b[_0x64d8('0x41')]=_['intersection'](_0x34f7aa[_0x64d8('0x40')],qs[_0x64d8('0x42')](_0x2d6bd7[_0x64d8('0x3d')][_0x64d8('0x42')]));_0x13215b[_0x64d8('0x41')]=_0x13215b[_0x64d8('0x41')][_0x64d8('0x43')]?_0x13215b[_0x64d8('0x41')]:_0x34f7aa[_0x64d8('0x40')];if(!_0x2d6bd7[_0x64d8('0x3d')][_0x64d8('0x44')](_0x64d8('0x45'))){_0x13215b[_0x64d8('0x25')]=qs[_0x64d8('0x25')](_0x2d6bd7[_0x64d8('0x3d')][_0x64d8('0x25')]);_0x13215b['offset']=qs[_0x64d8('0x23')](_0x2d6bd7[_0x64d8('0x3d')][_0x64d8('0x23')]);}_0x13215b[_0x64d8('0x46')]=qs[_0x64d8('0x47')](_0x2d6bd7[_0x64d8('0x3d')][_0x64d8('0x47')]);_0x13215b['where']=qs[_0x64d8('0x3e')](_[_0x64d8('0x48')](_0x2d6bd7[_0x64d8('0x3d')],_0x34f7aa[_0x64d8('0x3e')]),_0x28d0a6);if(_0x2d6bd7[_0x64d8('0x3d')][_0x64d8('0x49')]){_0x13215b[_0x64d8('0x4a')]=_['merge'](_0x13215b[_0x64d8('0x4a')],{'$or':_['map'](_0x28d0a6,function(_0x53206e){if(_0x53206e[_0x64d8('0x3a')]!==_0x64d8('0x4b')){var _0x39ece4={};_0x39ece4[_0x53206e[_0x64d8('0x33')]]={'$like':'%'+_0x2d6bd7[_0x64d8('0x3d')][_0x64d8('0x49')]+'%'};return _0x39ece4;}})});}_0x13215b=_['merge']({},_0x13215b,_0x2d6bd7[_0x64d8('0x4c')]);var _0x8a98b0={'where':_0x13215b[_0x64d8('0x4a')]};return db[_0x64d8('0x37')]['count'](_0x8a98b0)[_0x64d8('0x2f')](function(_0x1072e9){_0x492fee[_0x64d8('0x26')]=_0x1072e9;if(_0x2d6bd7['query'][_0x64d8('0x4d')]){_0x13215b['include']=[{'all':!![]}];}return db[_0x64d8('0x37')][_0x64d8('0x4e')](_0x13215b);})[_0x64d8('0x2f')](function(_0x5eb8bd){_0x492fee[_0x64d8('0x4f')]=_0x5eb8bd;return _0x492fee;})[_0x64d8('0x2f')](respondWithFilteredResult(_0x24a4e3,_0x13215b))[_0x64d8('0x50')](handleError(_0x24a4e3,null));};exports[_0x64d8('0x51')]=function(_0x5bee87,_0x3c9220){var _0x215ec2={'raw':![],'where':{'id':_0x5bee87[_0x64d8('0x52')]['id']}},_0x2511d1={};_0x2511d1[_0x64d8('0x40')]=_[_0x64d8('0x3c')](db['UserProfile']['rawAttributes']);_0x2511d1[_0x64d8('0x3d')]=_[_0x64d8('0x3c')](_0x5bee87['query']);_0x2511d1[_0x64d8('0x3e')]=_[_0x64d8('0x3f')](_0x2511d1[_0x64d8('0x40')],_0x2511d1[_0x64d8('0x3d')]);_0x215ec2[_0x64d8('0x41')]=_['intersection'](_0x2511d1[_0x64d8('0x40')],qs[_0x64d8('0x42')](_0x5bee87[_0x64d8('0x3d')][_0x64d8('0x42')]));_0x215ec2[_0x64d8('0x41')]=_0x215ec2[_0x64d8('0x41')][_0x64d8('0x43')]?_0x215ec2[_0x64d8('0x41')]:_0x2511d1[_0x64d8('0x40')];if(_0x5bee87['query'][_0x64d8('0x4d')]){_0x215ec2[_0x64d8('0x53')]=[{'all':!![]}];}_0x215ec2=_['merge']({},_0x215ec2,_0x5bee87[_0x64d8('0x4c')]);return db[_0x64d8('0x37')][_0x64d8('0x54')](_0x215ec2)[_0x64d8('0x2f')](handleEntityNotFound(_0x3c9220,null))[_0x64d8('0x2f')](respondWithResult(_0x3c9220,null))['catch'](handleError(_0x3c9220,null));};exports['create']=function(_0xeb064d,_0x5c8f5d){return db[_0x64d8('0x37')][_0x64d8('0x55')](_0xeb064d[_0x64d8('0x56')],{})[_0x64d8('0x2f')](respondWithResult(_0x5c8f5d,0xc9))[_0x64d8('0x50')](handleError(_0x5c8f5d,null));};exports[_0x64d8('0x57')]=function(_0x2da0c1,_0x4c0f87){var _0x3c927d={'where':{'id':_0x2da0c1[_0x64d8('0x52')]['id']}},_0x50495f={};_0x50495f['model']=_[_0x64d8('0x3c')](db[_0x64d8('0x37')][_0x64d8('0x38')]);_0x3c927d['attributes']=_[_0x64d8('0x3f')](_0x50495f[_0x64d8('0x40')],qs[_0x64d8('0x42')](_0x2da0c1[_0x64d8('0x3d')][_0x64d8('0x42')]));_0x3c927d[_0x64d8('0x41')]=_0x3c927d[_0x64d8('0x41')][_0x64d8('0x43')]?_0x3c927d[_0x64d8('0x41')]:_0x50495f['model'];if(_0x2da0c1['query'][_0x64d8('0x4d')]){_0x3c927d['include']=[{'all':!![]}];}_0x3c927d=_[_0x64d8('0x58')]({},_0x3c927d,_0x2da0c1['options']);return db['UserProfile'][_0x64d8('0x54')](_0x3c927d)[_0x64d8('0x2f')](handleEntityNotFound(_0x4c0f87,null))[_0x64d8('0x2f')](function(_0x5d4227){if(_0x5d4227){var _0x2835a2=_0x5d4227[_0x64d8('0x59')]({'plain':!![]});_0x2835a2=qs[_0x64d8('0x5a')](_0x2835a2,['id','createdAt',_0x64d8('0x5b'),_0x64d8('0x5c')]);_0x2da0c1[_0x64d8('0x56')]=_['omit'](_0x2da0c1[_0x64d8('0x56')],['id',_0x64d8('0x5d'),_0x64d8('0x5b')]);return db[_0x64d8('0x5e')][_0x64d8('0x5f')](function(_0x23f522){return db['UserProfile'][_0x64d8('0x55')](_[_0x64d8('0x58')](_0x2835a2,_0x2da0c1[_0x64d8('0x56')]),{'include':_0x2da0c1['query'][_0x64d8('0x4d')]?[{'all':!![]}]:undefined,'transaction':_0x23f522})[_0x64d8('0x2f')](function(_0x53b560){var _0x3cd6c3=_0x53b560['get']({'plain':!![]});return db[_0x64d8('0x60')][_0x64d8('0x4e')]({'where':{'userProfileId':_0x2da0c1[_0x64d8('0x52')]['id']},'raw':!![]})[_0x64d8('0x2f')](function(_0x4ec457){if(_0x4ec457){return BPromise[_0x64d8('0x61')](_0x4ec457,function(_0x399eac){return new BPromise(function(_0x20716d,_0x58ecef){if(_0x399eac[_0x64d8('0x62')]===null||_0x399eac['autoAssociation']===0x1)_0x20716d(null);return db['UserProfileResource'][_0x64d8('0x4e')]({'where':{'sectionId':_0x399eac['id']},'raw':!![]})[_0x64d8('0x2f')](function(_0x1f2692){var _0x55298a=_[_0x64d8('0x36')](_0x1f2692,function(_0x54e6fe){return qs[_0x64d8('0x5a')](_0x54e6fe,['id',_0x64d8('0x5d'),_0x64d8('0x5b'),_0x64d8('0x63')]);});_0x20716d(_0x55298a);})[_0x64d8('0x50')](function(_0x51493e){_0x58ecef(_0x51493e);});})[_0x64d8('0x2f')](function(_0x8496c9){var _0xd61137=qs[_0x64d8('0x5a')](_0x399eac,['id','createdAt',_0x64d8('0x5b')]);_0xd61137[_0x64d8('0x64')]=_0x3cd6c3['id'];if(_0x8496c9)_0xd61137[_0x64d8('0x65')]=_0x8496c9;return _0xd61137;})[_0x64d8('0x2f')](function(_0x735a){return db[_0x64d8('0x60')][_0x64d8('0x55')](_0x735a,{'include':[{'model':db[_0x64d8('0x66')],'as':'Resources'}],'raw':!![],'transaction':_0x23f522});});})[_0x64d8('0x2f')](function(){return _0x3cd6c3;});}});});});}})[_0x64d8('0x2f')](respondWithResult(_0x4c0f87,0xc9))[_0x64d8('0x50')](handleError(_0x4c0f87,null));};exports[_0x64d8('0x2d')]=function(_0x1ab2d6,_0x262fca){if(_0x1ab2d6[_0x64d8('0x56')]['id']){delete _0x1ab2d6[_0x64d8('0x56')]['id'];}return db[_0x64d8('0x37')][_0x64d8('0x54')]({'where':{'id':_0x1ab2d6[_0x64d8('0x52')]['id']}})[_0x64d8('0x2f')](handleEntityNotFound(_0x262fca,null))[_0x64d8('0x2f')](saveUpdates(_0x1ab2d6[_0x64d8('0x56')],null))[_0x64d8('0x2f')](respondWithResult(_0x262fca,null))[_0x64d8('0x50')](handleError(_0x262fca,null));};exports[_0x64d8('0x2e')]=function(_0x322b66,_0x33295c){return db[_0x64d8('0x37')][_0x64d8('0x54')]({'where':{'id':_0x322b66[_0x64d8('0x52')]['id']}})[_0x64d8('0x2f')](handleEntityNotFound(_0x33295c,null))[_0x64d8('0x2f')](removeEntity(_0x33295c,null))['catch'](handleError(_0x33295c,null));};exports['describe']=function(_0x3050b2,_0x13a9ea){return db[_0x64d8('0x37')][_0x64d8('0x67')]()['then'](respondWithResult(_0x13a9ea,null))[_0x64d8('0x50')](handleError(_0x13a9ea,null));};exports[_0x64d8('0x68')]=function(_0x2451bc,_0x1861e7){var _0x33067c=_0x2451bc[_0x64d8('0x56')];return db['UserProfile']['find']({'where':{'id':_0x2451bc[_0x64d8('0x52')]['id']}})[_0x64d8('0x2f')](handleEntityNotFound(_0x1861e7,null))[_0x64d8('0x2f')](function(_0x474a84){if(_0x474a84){return db['sequelize'][_0x64d8('0x5f')](function(_0x5526f2){return db[_0x64d8('0x60')][_0x64d8('0x2e')]({'where':{'userProfileId':_0x2451bc['params']['id'],'sectionId':_[_0x64d8('0x36')](_0x33067c,function(_0x167192){return _0x167192['sectionId'];})},'transaction':_0x5526f2})[_0x64d8('0x2f')](function(){var _0x3a917a=_[_0x64d8('0x36')](_0x33067c,function(_0x4a69ef){_0x4a69ef[_0x64d8('0x64')]=_0x2451bc['params']['id'];return _0x4a69ef;});var _0x4dc58f=[];return BPromise[_0x64d8('0x61')](_0x3a917a,function(_0x4abaed){return db['UserProfileSection'][_0x64d8('0x55')](_0x4abaed,{'include':[{'model':db['UserProfileResource'],'as':_0x64d8('0x65')}],'raw':!![],'transaction':_0x5526f2})[_0x64d8('0x2f')](function(_0x484feb){_0x4dc58f['push'](_0x484feb[_0x64d8('0x59')]({'plain':!![]}));});})[_0x64d8('0x2f')](function(){return _0x4dc58f;});});});}})['then'](function(_0x23a5e6){return _0x23a5e6;})[_0x64d8('0x2f')](respondWithResult(_0x1861e7,null))[_0x64d8('0x50')](handleError(_0x1861e7,null));};exports['removeSections']=function(_0xacb9f0,_0xd371cb){var _0x3164cc;return db[_0x64d8('0x37')][_0x64d8('0x54')]({'where':{'id':_0xacb9f0['params']['id']},'attributes':['id',_0x64d8('0x33')]})[_0x64d8('0x2f')](handleEntityNotFound(_0xd371cb,null))[_0x64d8('0x2f')](function(_0x385757){if(_0x385757){_0x3164cc=_0x385757;return db[_0x64d8('0x60')]['destroy']({'where':{'userProfileId':_0xacb9f0[_0x64d8('0x52')]['id'],'sectionId':_0xacb9f0[_0x64d8('0x3d')][_0x64d8('0x69')]}});}})[_0x64d8('0x2f')](function(){return _0x3164cc;})['then'](respondWithStatusCode(_0xd371cb,null))[_0x64d8('0x50')](handleError(_0xd371cb,null));};exports['getSections']=function(_0x3e0d78,_0x50cf2b){var _0x25e114=[];var _0x26c16a=[];return db[_0x64d8('0x60')][_0x64d8('0x4e')]({'where':{'userProfileId':_0x3e0d78['params']['id']},'raw':!![]})['then'](function(_0x356ac7){_0x25e114=_[_0x64d8('0x49')](_0x356ac7,function(_0x8ae7d2){return _0x8ae7d2[_0x64d8('0x6a')]===0x1||_[_0x64d8('0x6b')]([0x3eb,0x709],_0x8ae7d2[_0x64d8('0x63')]);});if(!_['isEmpty'](_0x25e114)){return _[_0x64d8('0x36')](_0x25e114,function(_0x4240ee){return _0x4240ee[_0x64d8('0x63')];});}else{return;}})[_0x64d8('0x2f')](function(_0x3840d6){if(_0x3840d6)_0x26c16a=_0x3840d6;if(_[_0x64d8('0x6b')](_0x26c16a,0x64)){var _0xe13c1e=_[_0x64d8('0x54')](_0x25e114,{'sectionId':0x64});return hasDefaultDashboard(_0xe13c1e)[_0x64d8('0x2f')](function(_0x517032){return _[_0x64d8('0x36')](_0x25e114,function(_0x18769f){if(_0x18769f[_0x64d8('0x63')]===0x64){_0x18769f['subsections']=_0x517032;}return _0x18769f;});});}else{return;}})[_0x64d8('0x2f')](function(_0x5264d1){if(_0x5264d1)_0x25e114=_0x5264d1;if(_[_0x64d8('0x6b')](_0x26c16a,0x3eb)){var _0x26e37b=_[_0x64d8('0x54')](_0x25e114,{'sectionId':0x3eb});return getCustomDashboards(_0x26e37b)[_0x64d8('0x2f')](function(_0x31be34){return _[_0x64d8('0x36')](_0x25e114,function(_0x40c4aa){if(_0x26e37b[_0x64d8('0x6a')]){if(_0x40c4aa[_0x64d8('0x63')]===0x3eb){_0x40c4aa[_0x64d8('0x6c')]=_0x31be34;}}else{if(_0x40c4aa[_0x64d8('0x63')]===0x64){if(!_0x40c4aa[_0x64d8('0x6c')]){_0x40c4aa[_0x64d8('0x6c')]=[];}_0x40c4aa[_0x64d8('0x6c')]=_0x40c4aa[_0x64d8('0x6c')][_0x64d8('0x6d')](_0x31be34);}}return _0x40c4aa;});});}else{return;}})[_0x64d8('0x2f')](function(_0x1c76c3){if(_0x1c76c3)_0x25e114=_0x1c76c3;if(_[_0x64d8('0x6b')](_0x26c16a,0x709)){var _0xf005bd=_[_0x64d8('0x54')](_0x25e114,{'sectionId':0x709});return getPlugins(_0xf005bd)[_0x64d8('0x2f')](function(_0x1a5b65){if(_0xf005bd['enabled']){return _[_0x64d8('0x36')](_0x25e114,function(_0x32b7d8){if(_0x32b7d8[_0x64d8('0x63')]===0x709){_0x32b7d8['subsections']=_0x1a5b65;}return _0x32b7d8;});}else{var _0x3e7f29={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1a5b65};var _0x11f890=_[_0x64d8('0x36')](_0x25e114);_0x11f890[_0x64d8('0x6e')](_0x3e7f29);return _0x11f890;}});}else{return;}})[_0x64d8('0x2f')](function(_0x32b0fa){if(_0x32b0fa)_0x25e114=_0x32b0fa;return _[_0x64d8('0x49')](_0x25e114,[_0x64d8('0x6a'),0x1]);})['then'](respondWithResult(_0x50cf2b,null))[_0x64d8('0x50')](handleError(_0x50cf2b,null));};function hasDefaultDashboard(_0x31de35){var _0x3853e6=[0x65];return new BPromise(function(_0x7c9d73,_0x3cc59e){try{if(_0x31de35[_0x64d8('0x62')]){_0x7c9d73(_0x3853e6);}else{return db['UserProfileResource'][_0x64d8('0x6f')]({'where':{'sectionId':_0x31de35['id']},'raw':!![]})[_0x64d8('0x2f')](function(_0x15937b){_0x15937b?_0x7c9d73(_0x3853e6):_0x7c9d73();});}}catch(_0x46f828){_0x3cc59e(_0x46f828);}});}function getCustomDashboards(_0x2f66f8){var _0x444437=[];return new BPromise(function(_0x31b14d,_0xf15578){try{if(_0x2f66f8[_0x64d8('0x62')]){return db[_0x64d8('0x70')][_0x64d8('0x4e')]({'raw':!![]})['then'](function(_0x15836a){_0x15836a[_0x64d8('0x71')](function(_0x5b22d8){_0x444437[_0x64d8('0x6e')](_0x5b22d8['id']+0x1869f);});_0x31b14d(_0x444437);});}else{return db[_0x64d8('0x66')][_0x64d8('0x4e')]({'where':{'sectionId':_0x2f66f8['id']},'raw':!![]})[_0x64d8('0x2f')](function(_0x11dd15){_0x11dd15['forEach'](function(_0x46d487){_0x444437[_0x64d8('0x6e')](_0x46d487[_0x64d8('0x72')]+0x1869f);});_0x31b14d(_0x444437);});}}catch(_0x52730b){_0xf15578(_0x52730b);}});}function getPlugins(_0x3e1666){var _0x23a623=[];return new BPromise(function(_0x2a538e,_0x2bb063){try{if(_0x3e1666['autoAssociation']){return db[_0x64d8('0x73')][_0x64d8('0x4e')]({'raw':!![]})[_0x64d8('0x2f')](function(_0xccef3a){_0xccef3a[_0x64d8('0x71')](function(_0x19940f){_0x23a623['push'](_0x19940f['id']+0x15b38);});_0x2a538e(_0x23a623);});}else{return db[_0x64d8('0x66')][_0x64d8('0x4e')]({'where':{'sectionId':_0x3e1666['id']},'raw':!![]})[_0x64d8('0x2f')](function(_0x3269b0){_0x3269b0[_0x64d8('0x71')](function(_0x460a5c){_0x23a623['push'](_0x460a5c[_0x64d8('0x72')]+0x15b38);});_0x2a538e(_0x23a623);});}}catch(_0x564652){_0x2bb063(_0x564652);}});}exports['addResources']=function(_0x1b31ab,_0x4dcc5d){return db['UserProfile']['find']({'where':{'id':_0x1b31ab[_0x64d8('0x52')]['id']}})[_0x64d8('0x2f')](handleEntityNotFound(_0x4dcc5d,null))['then'](function(_0x326c53){if(_0x326c53){return db[_0x64d8('0x5e')][_0x64d8('0x5f')](function(_0x1cf1fb){return db[_0x64d8('0x60')][_0x64d8('0x4e')]({'where':{'userProfileId':_0x1b31ab[_0x64d8('0x52')]['id']},'attributes':['id'],'raw':!![]})[_0x64d8('0x2f')](function(_0x3646ab){if(_0x3646ab){return db[_0x64d8('0x60')][_0x64d8('0x2e')]({'where':{'userProfileId':_0x1b31ab[_0x64d8('0x52')]['id'],'id':_['map'](_0x3646ab,function(_0x3215f5){return _0x3215f5['id'];})},'transaction':_0x1cf1fb});}})[_0x64d8('0x2f')](function(_0xfd2e2){var _0x402b15=_[_0x64d8('0x36')](_0x1b31ab[_0x64d8('0x56')],function(_0x4e5c98){_0x4e5c98[_0x64d8('0x64')]=_0x1b31ab[_0x64d8('0x52')]['id'];return _0x4e5c98;});return db[_0x64d8('0x60')][_0x64d8('0x74')](_0x402b15,{'raw':!![],'transaction':_0x1cf1fb});})[_0x64d8('0x2f')](function(_0x2c776a){var _0x3e07c4=_[_0x64d8('0x49')](_[_0x64d8('0x36')](_0x2c776a,function(_0x25453e){return _0x25453e[_0x64d8('0x59')]({'plain':!![]});}),{'includeAll':![]});if(_0x3e07c4){return db[_0x64d8('0x60')]['findAll']({'where':{'userProfileId':_0x1b31ab[_0x64d8('0x52')]['id'],'sectionId':_['map'](_0x3e07c4,function(_0x6556f){return _0x6556f['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x35f151){var _0x57d1ba=_['map'](_0x1b31ab[_0x64d8('0x56')],function(_0x472de4){_0x472de4['userProfileId']=_0x1b31ab[_0x64d8('0x52')]['id'];return _0x472de4;});return db[_0x64d8('0x66')][_0x64d8('0x74')](_0x57d1ba,{'raw':!![],'transaction':_0x1cf1fb});});}})[_0x64d8('0x50')](handleError(_0x4dcc5d,null));});}})[_0x64d8('0x2f')](function(_0x27eafe){var _0x2eee2f=_[_0x64d8('0x36')](_0x27eafe,function(_0x5bf34e){return _0x5bf34e[_0x64d8('0x59')]({'plain':!![]});});})[_0x64d8('0x2f')](respondWithResult(_0x4dcc5d,null))[_0x64d8('0x50')](handleError(_0x4dcc5d,null));};exports[_0x64d8('0x75')]=function(_0x21654d,_0x2cc701,_0x5d0da8){return db['UserProfile'][_0x64d8('0x54')]({'where':{'id':_0x21654d[_0x64d8('0x52')]['id']}})[_0x64d8('0x2f')](handleEntityNotFound(_0x2cc701,null))[_0x64d8('0x2f')](function(_0x3be597){if(_0x3be597){return _0x3be597[_0x64d8('0x75')](_0x21654d['query'][_0x64d8('0x69')]);}})['then'](respondWithStatusCode(_0x2cc701,null))['catch'](handleError(_0x2cc701,null));};exports[_0x64d8('0x76')]=function(_0x221e05,_0x2483c2){var _0x28d896={};if(!_0x221e05[_0x64d8('0x3d')]['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x221e05[_0x64d8('0x3d')][_0x64d8('0x44')](_0x64d8('0x45'))){_0x28d896['limit']=qs[_0x64d8('0x25')](_0x221e05['query'][_0x64d8('0x25')]);_0x28d896[_0x64d8('0x23')]=qs[_0x64d8('0x23')](_0x221e05['query'][_0x64d8('0x23')]);}return db[_0x64d8('0x37')][_0x64d8('0x54')]({'where':{'id':_0x221e05[_0x64d8('0x52')]['id']}})['then'](function(_0x243efe){if(!_0x243efe)throw new Error(_0x64d8('0x77')+_0x221e05[_0x64d8('0x52')]['id']);return db[_0x64d8('0x37')][_0x64d8('0x76')](_0x221e05);})[_0x64d8('0x2f')](respondWithFilteredResult(_0x2483c2,_0x28d896))[_0x64d8('0x50')](handleError(_0x2483c2,null));}; \ No newline at end of file +var _0x121d=['ids','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','includeAll','options','UserProfile','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','push','removeSections'];(function(_0x504ad4,_0x298f63){var _0x522f5d=function(_0x661018){while(--_0x661018){_0x504ad4['push'](_0x504ad4['shift']());}};_0x522f5d(++_0x298f63);}(_0x121d,0xea));var _0xd121=function(_0x49a691,_0x40595a){_0x49a691=_0x49a691-0x0;var _0x462239=_0x121d[_0x49a691];return _0x462239;};'use strict';var emlformat=require(_0xd121('0x0'));var rimraf=require(_0xd121('0x1'));var zipdir=require(_0xd121('0x2'));var jsonpatch=require(_0xd121('0x3'));var rp=require(_0xd121('0x4'));var moment=require(_0xd121('0x5'));var BPromise=require(_0xd121('0x6'));var Mustache=require(_0xd121('0x7'));var util=require(_0xd121('0x8'));var path=require(_0xd121('0x9'));var sox=require(_0xd121('0xa'));var csv=require(_0xd121('0xb'));var ejs=require(_0xd121('0xc'));var fs=require('fs');var fs_extra=require(_0xd121('0xd'));var _=require('lodash');var squel=require(_0xd121('0xe'));var crypto=require('crypto');var jsforce=require(_0xd121('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd121('0xb'));var querystring=require(_0xd121('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd121('0x11'));var as=require(_0xd121('0x12'));var hardwareService=require(_0xd121('0x13'));var logger=require(_0xd121('0x14'))(_0xd121('0x15'));var utils=require(_0xd121('0x16'));var config=require(_0xd121('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd121('0x18'))['db'];config[_0xd121('0x19')]=_['defaults'](config[_0xd121('0x19')],{'host':_0xd121('0x1a'),'port':0x18eb});var socket=require(_0xd121('0x1b'))(new Redis(config[_0xd121('0x19')]));require('./userProfile.socket')[_0xd121('0x1c')](socket);function respondWithStatusCode(_0x3577a2,_0x2bfac3){_0x2bfac3=_0x2bfac3||0xcc;return function(_0x5e4dc3){if(_0x5e4dc3){return _0x3577a2[_0xd121('0x1d')](_0x2bfac3);}return _0x3577a2[_0xd121('0x1e')](_0x2bfac3)['end']();};}function respondWithResult(_0xc71a1b,_0x5e68e1){_0x5e68e1=_0x5e68e1||0xc8;return function(_0x43a36b){if(_0x43a36b){return _0xc71a1b[_0xd121('0x1e')](_0x5e68e1)[_0xd121('0x1f')](_0x43a36b);}};}function respondWithFilteredResult(_0x352806,_0x565e94){return function(_0x4ccf7f){if(_0x4ccf7f){var _0x41f455=typeof _0x565e94[_0xd121('0x20')]==='undefined'&&typeof _0x565e94[_0xd121('0x21')]==='undefined';var _0x4dcad8=_0x4ccf7f['count'];var _0x4e9408=_0x41f455?0x0:_0x565e94[_0xd121('0x20')];var _0x4e4fdc=_0x41f455?_0x4ccf7f[_0xd121('0x22')]:_0x565e94[_0xd121('0x20')]+_0x565e94[_0xd121('0x21')];var _0x707ad5;if(_0x4e4fdc>=_0x4dcad8){_0x4e4fdc=_0x4dcad8;_0x707ad5=0xc8;}else{_0x707ad5=0xce;}_0x352806[_0xd121('0x1e')](_0x707ad5);return _0x352806['set'](_0xd121('0x23'),_0x4e9408+'-'+_0x4e4fdc+'/'+_0x4dcad8)[_0xd121('0x1f')](_0x4ccf7f);}return null;};}function patchUpdates(_0x504b26){return function(_0x3d60fe){try{jsonpatch['apply'](_0x3d60fe,_0x504b26,!![]);}catch(_0x2b4f70){return BPromise[_0xd121('0x24')](_0x2b4f70);}return _0x3d60fe[_0xd121('0x25')]();};}function saveUpdates(_0x14272d,_0x679fa6){return function(_0x393d1d){if(_0x393d1d){return _0x393d1d[_0xd121('0x26')](_0x14272d)[_0xd121('0x27')](function(_0x1c39d3){return _0x1c39d3;});}return null;};}function removeEntity(_0x1d99f1,_0x3a1aa2){return function(_0x4df06c){if(_0x4df06c){return _0x4df06c[_0xd121('0x28')]()[_0xd121('0x27')](function(){_0x1d99f1[_0xd121('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x213897,_0x259fee){return function(_0x198a93){if(!_0x198a93){_0x213897[_0xd121('0x1d')](0x194);}return _0x198a93;};}function handleError(_0x51cf56,_0x1ba0d2){_0x1ba0d2=_0x1ba0d2||0x1f4;return function(_0x52e5d0){logger['error'](_0x52e5d0[_0xd121('0x29')]);if(_0x52e5d0[_0xd121('0x2a')]){delete _0x52e5d0['name'];}_0x51cf56[_0xd121('0x1e')](_0x1ba0d2)[_0xd121('0x2b')](_0x52e5d0);};}exports[_0xd121('0x2c')]=function(_0x1654a3,_0x2102fb){var _0x378935={},_0x105f16={},_0x148605={'count':0x0,'rows':[]};var _0xa6d042=_[_0xd121('0x2d')](db['UserProfile'][_0xd121('0x2e')],function(_0x56edf8){return{'name':_0x56edf8[_0xd121('0x2f')],'type':_0x56edf8[_0xd121('0x30')][_0xd121('0x31')]};});_0x105f16['model']=_[_0xd121('0x2d')](_0xa6d042,_0xd121('0x2a'));_0x105f16[_0xd121('0x32')]=_[_0xd121('0x33')](_0x1654a3['query']);_0x105f16[_0xd121('0x34')]=_[_0xd121('0x35')](_0x105f16['model'],_0x105f16[_0xd121('0x32')]);_0x378935[_0xd121('0x36')]=_[_0xd121('0x35')](_0x105f16[_0xd121('0x37')],qs[_0xd121('0x38')](_0x1654a3[_0xd121('0x32')][_0xd121('0x38')]));_0x378935[_0xd121('0x36')]=_0x378935[_0xd121('0x36')][_0xd121('0x39')]?_0x378935[_0xd121('0x36')]:_0x105f16[_0xd121('0x37')];if(!_0x1654a3[_0xd121('0x32')]['hasOwnProperty'](_0xd121('0x3a'))){_0x378935[_0xd121('0x21')]=qs['limit'](_0x1654a3[_0xd121('0x32')][_0xd121('0x21')]);_0x378935[_0xd121('0x20')]=qs[_0xd121('0x20')](_0x1654a3['query']['offset']);}_0x378935[_0xd121('0x3b')]=qs['sort'](_0x1654a3[_0xd121('0x32')]['sort']);_0x378935[_0xd121('0x3c')]=qs['filters'](_[_0xd121('0x3d')](_0x1654a3[_0xd121('0x32')],_0x105f16[_0xd121('0x34')]),_0xa6d042);if(_0x1654a3[_0xd121('0x32')]['filter']){_0x378935[_0xd121('0x3c')]=_[_0xd121('0x3e')](_0x378935[_0xd121('0x3c')],{'$or':_[_0xd121('0x2d')](_0xa6d042,function(_0x51820e){if(_0x51820e['type']!==_0xd121('0x3f')){var _0x50f352={};_0x50f352[_0x51820e[_0xd121('0x2a')]]={'$like':'%'+_0x1654a3[_0xd121('0x32')][_0xd121('0x40')]+'%'};return _0x50f352;}})});}_0x378935=_[_0xd121('0x3e')]({},_0x378935,_0x1654a3['options']);var _0x274381={'where':_0x378935['where']};return db['UserProfile'][_0xd121('0x22')](_0x274381)[_0xd121('0x27')](function(_0x32c837){_0x148605[_0xd121('0x22')]=_0x32c837;if(_0x1654a3[_0xd121('0x32')]['includeAll']){_0x378935[_0xd121('0x41')]=[{'all':!![]}];}return db['UserProfile'][_0xd121('0x42')](_0x378935);})[_0xd121('0x27')](function(_0x15da65){_0x148605[_0xd121('0x43')]=_0x15da65;return _0x148605;})[_0xd121('0x27')](respondWithFilteredResult(_0x2102fb,_0x378935))[_0xd121('0x44')](handleError(_0x2102fb,null));};exports['show']=function(_0x367046,_0x449567){var _0x80d3ff={'raw':![],'where':{'id':_0x367046[_0xd121('0x45')]['id']}},_0x3aaed5={};_0x3aaed5[_0xd121('0x37')]=_[_0xd121('0x33')](db['UserProfile'][_0xd121('0x2e')]);_0x3aaed5[_0xd121('0x32')]=_[_0xd121('0x33')](_0x367046[_0xd121('0x32')]);_0x3aaed5[_0xd121('0x34')]=_[_0xd121('0x35')](_0x3aaed5[_0xd121('0x37')],_0x3aaed5[_0xd121('0x32')]);_0x80d3ff[_0xd121('0x36')]=_[_0xd121('0x35')](_0x3aaed5[_0xd121('0x37')],qs[_0xd121('0x38')](_0x367046['query'][_0xd121('0x38')]));_0x80d3ff['attributes']=_0x80d3ff[_0xd121('0x36')][_0xd121('0x39')]?_0x80d3ff[_0xd121('0x36')]:_0x3aaed5[_0xd121('0x37')];if(_0x367046[_0xd121('0x32')][_0xd121('0x46')]){_0x80d3ff['include']=[{'all':!![]}];}_0x80d3ff=_[_0xd121('0x3e')]({},_0x80d3ff,_0x367046[_0xd121('0x47')]);return db[_0xd121('0x48')][_0xd121('0x49')](_0x80d3ff)[_0xd121('0x27')](handleEntityNotFound(_0x449567,null))[_0xd121('0x27')](respondWithResult(_0x449567,null))[_0xd121('0x44')](handleError(_0x449567,null));};exports[_0xd121('0x4a')]=function(_0x2dd49b,_0x37d665){return db['UserProfile'][_0xd121('0x4a')](_0x2dd49b[_0xd121('0x4b')],{})[_0xd121('0x27')](respondWithResult(_0x37d665,0xc9))[_0xd121('0x44')](handleError(_0x37d665,null));};exports[_0xd121('0x4c')]=function(_0x41316b,_0x57a0f6){var _0x3746e0={'where':{'id':_0x41316b['params']['id']}},_0x3d3a0c={};_0x3d3a0c[_0xd121('0x37')]=_[_0xd121('0x33')](db[_0xd121('0x48')][_0xd121('0x2e')]);_0x3746e0['attributes']=_[_0xd121('0x35')](_0x3d3a0c[_0xd121('0x37')],qs['fields'](_0x41316b[_0xd121('0x32')]['fields']));_0x3746e0[_0xd121('0x36')]=_0x3746e0[_0xd121('0x36')][_0xd121('0x39')]?_0x3746e0[_0xd121('0x36')]:_0x3d3a0c[_0xd121('0x37')];if(_0x41316b[_0xd121('0x32')][_0xd121('0x46')]){_0x3746e0[_0xd121('0x41')]=[{'all':!![]}];}_0x3746e0=_['merge']({},_0x3746e0,_0x41316b['options']);return db[_0xd121('0x48')][_0xd121('0x49')](_0x3746e0)[_0xd121('0x27')](handleEntityNotFound(_0x57a0f6,null))['then'](function(_0x473643){if(_0x473643){var _0x4b33d4=_0x473643[_0xd121('0x4d')]({'plain':!![]});_0x4b33d4=qs[_0xd121('0x4e')](_0x4b33d4,['id',_0xd121('0x4f'),_0xd121('0x50'),_0xd121('0x51')]);_0x41316b['body']=_[_0xd121('0x4e')](_0x41316b['body'],['id',_0xd121('0x4f'),_0xd121('0x50')]);return db[_0xd121('0x52')][_0xd121('0x53')](function(_0x49fbe4){return db[_0xd121('0x48')]['create'](_['merge'](_0x4b33d4,_0x41316b[_0xd121('0x4b')]),{'include':_0x41316b[_0xd121('0x32')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x49fbe4})['then'](function(_0x487486){var _0x4c6575=_0x487486[_0xd121('0x4d')]({'plain':!![]});return db[_0xd121('0x54')][_0xd121('0x42')]({'where':{'userProfileId':_0x41316b[_0xd121('0x45')]['id']},'raw':!![]})['then'](function(_0xf0f25d){if(_0xf0f25d){return BPromise[_0xd121('0x55')](_0xf0f25d,function(_0x59b1ca){return new BPromise(function(_0x41d856,_0x2bbf1e){if(_0x59b1ca[_0xd121('0x56')]===null||_0x59b1ca[_0xd121('0x56')]===0x1)_0x41d856(null);return db[_0xd121('0x57')][_0xd121('0x42')]({'where':{'sectionId':_0x59b1ca['id']},'raw':!![]})[_0xd121('0x27')](function(_0x3ed10b){var _0xc8a038=_['map'](_0x3ed10b,function(_0x2ca462){return qs[_0xd121('0x4e')](_0x2ca462,['id',_0xd121('0x4f'),_0xd121('0x50'),_0xd121('0x58')]);});_0x41d856(_0xc8a038);})[_0xd121('0x44')](function(_0x59af91){_0x2bbf1e(_0x59af91);});})['then'](function(_0x518142){var _0x502391=qs[_0xd121('0x4e')](_0x59b1ca,['id',_0xd121('0x4f'),_0xd121('0x50')]);_0x502391[_0xd121('0x59')]=_0x4c6575['id'];if(_0x518142)_0x502391[_0xd121('0x5a')]=_0x518142;return _0x502391;})['then'](function(_0x535379){return db[_0xd121('0x54')][_0xd121('0x4a')](_0x535379,{'include':[{'model':db[_0xd121('0x57')],'as':_0xd121('0x5a')}],'raw':!![],'transaction':_0x49fbe4});});})[_0xd121('0x27')](function(){return _0x4c6575;});}});});});}})['then'](respondWithResult(_0x57a0f6,0xc9))['catch'](handleError(_0x57a0f6,null));};exports['update']=function(_0x2b31d5,_0x235d4e){if(_0x2b31d5['body']['id']){delete _0x2b31d5[_0xd121('0x4b')]['id'];}return db[_0xd121('0x48')]['find']({'where':{'id':_0x2b31d5[_0xd121('0x45')]['id']}})[_0xd121('0x27')](handleEntityNotFound(_0x235d4e,null))[_0xd121('0x27')](saveUpdates(_0x2b31d5['body'],null))[_0xd121('0x27')](respondWithResult(_0x235d4e,null))[_0xd121('0x44')](handleError(_0x235d4e,null));};exports[_0xd121('0x28')]=function(_0x43b643,_0x53fa84){return db[_0xd121('0x48')][_0xd121('0x49')]({'where':{'id':_0x43b643[_0xd121('0x45')]['id']}})[_0xd121('0x27')](handleEntityNotFound(_0x53fa84,null))[_0xd121('0x27')](removeEntity(_0x53fa84,null))['catch'](handleError(_0x53fa84,null));};exports['describe']=function(_0x167481,_0x47dd41){return db[_0xd121('0x48')]['describe']()[_0xd121('0x27')](respondWithResult(_0x47dd41,null))['catch'](handleError(_0x47dd41,null));};exports['addSections']=function(_0x1142fc,_0x5b038d){var _0x27a372=_0x1142fc[_0xd121('0x4b')];return db[_0xd121('0x48')][_0xd121('0x49')]({'where':{'id':_0x1142fc[_0xd121('0x45')]['id']}})[_0xd121('0x27')](handleEntityNotFound(_0x5b038d,null))[_0xd121('0x27')](function(_0x3a4142){if(_0x3a4142){return db[_0xd121('0x52')][_0xd121('0x53')](function(_0x124699){return db[_0xd121('0x54')]['destroy']({'where':{'userProfileId':_0x1142fc[_0xd121('0x45')]['id'],'sectionId':_[_0xd121('0x2d')](_0x27a372,function(_0xe25631){return _0xe25631['sectionId'];})},'transaction':_0x124699})[_0xd121('0x27')](function(){var _0x417738=_[_0xd121('0x2d')](_0x27a372,function(_0x57ef83){_0x57ef83[_0xd121('0x59')]=_0x1142fc[_0xd121('0x45')]['id'];return _0x57ef83;});var _0x2b1b17=[];return BPromise[_0xd121('0x55')](_0x417738,function(_0x3cb2a0){return db[_0xd121('0x54')]['create'](_0x3cb2a0,{'include':[{'model':db[_0xd121('0x57')],'as':'Resources'}],'raw':!![],'transaction':_0x124699})['then'](function(_0x3cc2ab){_0x2b1b17[_0xd121('0x5b')](_0x3cc2ab[_0xd121('0x4d')]({'plain':!![]}));});})['then'](function(){return _0x2b1b17;});});});}})[_0xd121('0x27')](function(_0x126631){return _0x126631;})[_0xd121('0x27')](respondWithResult(_0x5b038d,null))[_0xd121('0x44')](handleError(_0x5b038d,null));};exports[_0xd121('0x5c')]=function(_0xa8e76c,_0x3fa073){var _0x4d9022;return db[_0xd121('0x48')][_0xd121('0x49')]({'where':{'id':_0xa8e76c['params']['id']},'attributes':['id',_0xd121('0x2a')]})[_0xd121('0x27')](handleEntityNotFound(_0x3fa073,null))[_0xd121('0x27')](function(_0x2bd9f4){if(_0x2bd9f4){_0x4d9022=_0x2bd9f4;return db[_0xd121('0x54')][_0xd121('0x28')]({'where':{'userProfileId':_0xa8e76c['params']['id'],'sectionId':_0xa8e76c[_0xd121('0x32')][_0xd121('0x5d')]}});}})[_0xd121('0x27')](function(){return _0x4d9022;})[_0xd121('0x27')](respondWithStatusCode(_0x3fa073,null))[_0xd121('0x44')](handleError(_0x3fa073,null));};exports['getSections']=function(_0x35f425,_0x2b6866){var _0x3ca264=[];var _0x5c2e7c=[];return db[_0xd121('0x54')][_0xd121('0x42')]({'where':{'userProfileId':_0x35f425[_0xd121('0x45')]['id']},'raw':!![]})['then'](function(_0x268780){_0x3ca264=_[_0xd121('0x40')](_0x268780,function(_0x235848){return _0x235848[_0xd121('0x5e')]===0x1||_[_0xd121('0x5f')]([0x3eb,0x709],_0x235848[_0xd121('0x58')]);});if(!_[_0xd121('0x60')](_0x3ca264)){return _[_0xd121('0x2d')](_0x3ca264,function(_0x43e1b7){return _0x43e1b7[_0xd121('0x58')];});}else{return;}})[_0xd121('0x27')](function(_0x3cf45c){if(_0x3cf45c)_0x5c2e7c=_0x3cf45c;if(_[_0xd121('0x5f')](_0x5c2e7c,0x64)){var _0x459823=_[_0xd121('0x49')](_0x3ca264,{'sectionId':0x64});return hasDefaultDashboard(_0x459823)[_0xd121('0x27')](function(_0x588f0d){return _[_0xd121('0x2d')](_0x3ca264,function(_0xb86f6b){if(_0xb86f6b[_0xd121('0x58')]===0x64){_0xb86f6b[_0xd121('0x61')]=_0x588f0d;}return _0xb86f6b;});});}else{return;}})[_0xd121('0x27')](function(_0x4647a7){if(_0x4647a7)_0x3ca264=_0x4647a7;if(_[_0xd121('0x5f')](_0x5c2e7c,0x3eb)){var _0x5c587e=_['find'](_0x3ca264,{'sectionId':0x3eb});return getCustomDashboards(_0x5c587e)[_0xd121('0x27')](function(_0xda2926){return _[_0xd121('0x2d')](_0x3ca264,function(_0x465289){if(_0x5c587e['enabled']){if(_0x465289['sectionId']===0x3eb){_0x465289[_0xd121('0x61')]=_0xda2926;}}else{if(_0x465289[_0xd121('0x58')]===0x64){if(!_0x465289['subsections']){_0x465289['subsections']=[];}_0x465289[_0xd121('0x61')]=_0x465289[_0xd121('0x61')]['concat'](_0xda2926);}}return _0x465289;});});}else{return;}})['then'](function(_0x62303a){if(_0x62303a)_0x3ca264=_0x62303a;if(_[_0xd121('0x5f')](_0x5c2e7c,0x709)){var _0x1b9baf=_[_0xd121('0x49')](_0x3ca264,{'sectionId':0x709});return getPlugins(_0x1b9baf)[_0xd121('0x27')](function(_0x265e82){if(_0x1b9baf[_0xd121('0x5e')]){return _[_0xd121('0x2d')](_0x3ca264,function(_0x315a65){if(_0x315a65[_0xd121('0x58')]===0x709){_0x315a65[_0xd121('0x61')]=_0x265e82;}return _0x315a65;});}else{var _0x1c2157={'sectionId':0x76c,'enabled':0x1,'subsections':_0x265e82};var _0x4fba3a=_[_0xd121('0x2d')](_0x3ca264);_0x4fba3a[_0xd121('0x5b')](_0x1c2157);return _0x4fba3a;}});}else{return;}})['then'](function(_0x369b8d){if(_0x369b8d)_0x3ca264=_0x369b8d;return _[_0xd121('0x40')](_0x3ca264,[_0xd121('0x5e'),0x1]);})[_0xd121('0x27')](respondWithResult(_0x2b6866,null))[_0xd121('0x44')](handleError(_0x2b6866,null));};function hasDefaultDashboard(_0x1316ef){var _0x30090f=[0x65];return new BPromise(function(_0x32a512,_0x1ac0d7){try{if(_0x1316ef['autoAssociation']){_0x32a512(_0x30090f);}else{return db['UserProfileResource'][_0xd121('0x62')]({'where':{'sectionId':_0x1316ef['id']},'raw':!![]})[_0xd121('0x27')](function(_0xc10d03){_0xc10d03?_0x32a512(_0x30090f):_0x32a512();});}}catch(_0x9c3c43){_0x1ac0d7(_0x9c3c43);}});}function getCustomDashboards(_0x33bc82){var _0x1668a3=[];return new BPromise(function(_0xa4a6b3,_0x45301a){try{if(_0x33bc82[_0xd121('0x56')]){return db[_0xd121('0x63')][_0xd121('0x42')]({'raw':!![]})[_0xd121('0x27')](function(_0x223c17){_0x223c17[_0xd121('0x64')](function(_0x16cf7e){_0x1668a3[_0xd121('0x5b')](_0x16cf7e['id']+0x1869f);});_0xa4a6b3(_0x1668a3);});}else{return db[_0xd121('0x57')][_0xd121('0x42')]({'where':{'sectionId':_0x33bc82['id']},'raw':!![]})['then'](function(_0x579a6a){_0x579a6a[_0xd121('0x64')](function(_0xa8517f){_0x1668a3[_0xd121('0x5b')](_0xa8517f[_0xd121('0x65')]+0x1869f);});_0xa4a6b3(_0x1668a3);});}}catch(_0x4a4e73){_0x45301a(_0x4a4e73);}});}function getPlugins(_0x40ba37){var _0x33f217=[];return new BPromise(function(_0x4b8e20,_0x4d2ac1){try{if(_0x40ba37[_0xd121('0x56')]){return db[_0xd121('0x66')]['findAll']({'raw':!![]})[_0xd121('0x27')](function(_0x354361){_0x354361[_0xd121('0x64')](function(_0x2d48f9){_0x33f217['push'](_0x2d48f9['id']+0x15b38);});_0x4b8e20(_0x33f217);});}else{return db[_0xd121('0x57')][_0xd121('0x42')]({'where':{'sectionId':_0x40ba37['id']},'raw':!![]})[_0xd121('0x27')](function(_0x553241){_0x553241['forEach'](function(_0x2cbb5a){_0x33f217[_0xd121('0x5b')](_0x2cbb5a[_0xd121('0x65')]+0x15b38);});_0x4b8e20(_0x33f217);});}}catch(_0x575331){_0x4d2ac1(_0x575331);}});}exports['addResources']=function(_0x15a477,_0x28ae93){return db[_0xd121('0x48')]['find']({'where':{'id':_0x15a477[_0xd121('0x45')]['id']}})[_0xd121('0x27')](handleEntityNotFound(_0x28ae93,null))[_0xd121('0x27')](function(_0x2298d0){if(_0x2298d0){return db['sequelize'][_0xd121('0x53')](function(_0x232513){return db[_0xd121('0x54')][_0xd121('0x42')]({'where':{'userProfileId':_0x15a477[_0xd121('0x45')]['id']},'attributes':['id'],'raw':!![]})[_0xd121('0x27')](function(_0x36af80){if(_0x36af80){return db[_0xd121('0x54')][_0xd121('0x28')]({'where':{'userProfileId':_0x15a477['params']['id'],'id':_['map'](_0x36af80,function(_0x1c2952){return _0x1c2952['id'];})},'transaction':_0x232513});}})[_0xd121('0x27')](function(_0x139473){var _0x1969e3=_[_0xd121('0x2d')](_0x15a477[_0xd121('0x4b')],function(_0x9fe1be){_0x9fe1be[_0xd121('0x59')]=_0x15a477[_0xd121('0x45')]['id'];return _0x9fe1be;});return db[_0xd121('0x54')][_0xd121('0x67')](_0x1969e3,{'raw':!![],'transaction':_0x232513});})[_0xd121('0x27')](function(_0x4895a7){var _0x22c839=_[_0xd121('0x40')](_[_0xd121('0x2d')](_0x4895a7,function(_0x4949e8){return _0x4949e8[_0xd121('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x22c839){return db['UserProfileSection'][_0xd121('0x42')]({'where':{'userProfileId':_0x15a477[_0xd121('0x45')]['id'],'sectionId':_[_0xd121('0x2d')](_0x22c839,function(_0x246121){return _0x246121[_0xd121('0x58')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xd121('0x27')](function(_0x1e5573){var _0x3159dd=_[_0xd121('0x2d')](_0x15a477[_0xd121('0x4b')],function(_0x5696bd){_0x5696bd[_0xd121('0x59')]=_0x15a477[_0xd121('0x45')]['id'];return _0x5696bd;});return db[_0xd121('0x57')][_0xd121('0x67')](_0x3159dd,{'raw':!![],'transaction':_0x232513});});}})[_0xd121('0x44')](handleError(_0x28ae93,null));});}})[_0xd121('0x27')](function(_0x432389){var _0x238885=_[_0xd121('0x2d')](_0x432389,function(_0x5db802){return _0x5db802['get']({'plain':!![]});});})[_0xd121('0x27')](respondWithResult(_0x28ae93,null))[_0xd121('0x44')](handleError(_0x28ae93,null));};exports[_0xd121('0x68')]=function(_0x1e1d0c,_0x1e5dc1,_0x5ba7f0){return db[_0xd121('0x48')][_0xd121('0x49')]({'where':{'id':_0x1e1d0c[_0xd121('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e5dc1,null))[_0xd121('0x27')](function(_0x210956){if(_0x210956){return _0x210956[_0xd121('0x68')](_0x1e1d0c['query'][_0xd121('0x5d')]);}})[_0xd121('0x27')](respondWithStatusCode(_0x1e5dc1,null))[_0xd121('0x44')](handleError(_0x1e5dc1,null));};exports[_0xd121('0x69')]=function(_0xeb8853,_0x5b0bc7){var _0x4baef9={};if(!_0xeb8853[_0xd121('0x32')][_0xd121('0x6a')])throw new Error('Missing\x20section\x20parameter');if(!_0xeb8853[_0xd121('0x32')][_0xd121('0x6b')](_0xd121('0x3a'))){_0x4baef9['limit']=qs[_0xd121('0x21')](_0xeb8853[_0xd121('0x32')][_0xd121('0x21')]);_0x4baef9[_0xd121('0x20')]=qs['offset'](_0xeb8853['query'][_0xd121('0x20')]);}return db[_0xd121('0x48')]['find']({'where':{'id':_0xeb8853['params']['id']}})['then'](function(_0x548c0c){if(!_0x548c0c)throw new Error(_0xd121('0x6c')+_0xeb8853[_0xd121('0x45')]['id']);return db[_0xd121('0x48')]['getResources'](_0xeb8853);})[_0xd121('0x27')](respondWithFilteredResult(_0x5b0bc7,_0x4baef9))['catch'](handleError(_0x5b0bc7,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 1f416b9..ca7d0a7 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 _0xda81=['exports','events','../../mysqldb','UserProfile','save','update','remove','emit','hook'];(function(_0x1e4930,_0x3dd666){var _0x558ac3=function(_0xdacaf5){while(--_0xdacaf5){_0x1e4930['push'](_0x1e4930['shift']());}};_0x558ac3(++_0x3dd666);}(_0xda81,0x1c3));var _0x1da8=function(_0x32d004,_0x36ab76){_0x32d004=_0x32d004-0x0;var _0x45d0eb=_0xda81[_0x32d004];return _0x45d0eb;};'use strict';var EventEmitter=require(_0x1da8('0x0'));var UserProfile=require(_0x1da8('0x1'))['db'][_0x1da8('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1da8('0x3'),'afterUpdate':_0x1da8('0x4'),'afterDestroy':_0x1da8('0x5')};function emitEvent(_0x177870){return function(_0x48421c,_0x3357ac,_0x2692c1){UserProfileEvents['emit'](_0x177870+':'+_0x48421c['id'],_0x48421c);UserProfileEvents[_0x1da8('0x6')](_0x177870,_0x48421c);_0x2692c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x1da8('0x7')](e,emitEvent(event));}}module[_0x1da8('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x1967=['exports','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2740b3,_0x4248a1){var _0x1d21f8=function(_0x2f0f02){while(--_0x2f0f02){_0x2740b3['push'](_0x2740b3['shift']());}};_0x1d21f8(++_0x4248a1);}(_0x1967,0x173));var _0x7196=function(_0x57abb3,_0x2ebbb7){_0x57abb3=_0x57abb3-0x0;var _0x3ea0b7=_0x1967[_0x57abb3];return _0x3ea0b7;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x7196('0x0'))['db'][_0x7196('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7196('0x2')](0x0);var events={'afterCreate':_0x7196('0x3'),'afterUpdate':_0x7196('0x4'),'afterDestroy':_0x7196('0x5')};function emitEvent(_0x302f34){return function(_0x1aaddd,_0x458ae8,_0x3ae43f){UserProfileEvents['emit'](_0x302f34+':'+_0x1aaddd['id'],_0x1aaddd);UserProfileEvents[_0x7196('0x6')](_0x302f34,_0x1aaddd);_0x3ae43f(null);};}for(var e in events){if(events[_0x7196('0x7')](e)){var event=events[e];UserProfile[_0x7196('0x8')](e,emitEvent(event));}}module[_0x7196('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 520b71c..f6a63bf 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 _0x85b5=['map','name','resolve','UserProfileResource','resourceId','type','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','agent','Telephones','membername','telephone','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','VoiceQueues','users','User','Users','role','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','cannedanswers','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','Schedule','Sound','tags','Tag','Template','triggers','Trigger','trunks','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','SELECT','select','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','isEmpty','length','UserProfileSection','find','params','all','ignore','push','autoAssociation','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','key','AnalyticExtractedReport','foreignKey','forEach','merge','include','reportType','DefaultReports','CustomReports','count','ids','customSorting','extraQueryConditions','includeAll','color','tag','ThroughTags','rows','true','dataValues','fax','mail','whatsapp','lodash','./userProfile.attributes','squel','exports','models','field','filter','value','findAll','then','catch','model','associatedResources'];(function(_0x16d991,_0x3f07cc){var _0x4f41c3=function(_0x18d679){while(--_0x18d679){_0x16d991['push'](_0x16d991['shift']());}};_0x4f41c3(++_0x3f07cc);}(_0x85b5,0x16d));var _0x585b=function(_0x2a2c14,_0x14c174){_0x2a2c14=_0x2a2c14-0x0;var _0x311239=_0x85b5[_0x2a2c14];return _0x311239;};'use strict';var _=require(_0x585b('0x0'));var attributes=require(_0x585b('0x1'));var squel=require(_0x585b('0x2'));module[_0x585b('0x3')]=function(_0x538449){var _0x1094f2=_0x538449[_0x585b('0x4')];function _0x256b2e(_0x2649f0,_0x1b33b0){return new Promise(function(_0x388f44,_0x3db147){if(!_0x1b33b0)return _0x388f44(null);var _0x55be5d=_0x1b33b0['filter']?{[_0x1b33b0['filter'][_0x585b('0x5')]]:_0x1b33b0[_0x585b('0x6')][_0x585b('0x7')]}:undefined;return _0x1094f2[_0x2649f0][_0x585b('0x8')]({'where':_0x55be5d,'raw':!![]})[_0x585b('0x9')](function(_0x543d4e){_0x1b33b0['associatedResources']=_['map'](_0x543d4e,'id');_0x388f44(_0x1b33b0);})[_0x585b('0xa')](function(_0xdc30a){_0x3db147(_0xdc30a);});});}function _0x4b6778(_0xcf05ec,_0x5c0109){return new Promise(function(_0x58d372,_0x28aeb3){var _0xb4935a=_0xcf05ec['filter']?{[_0xcf05ec[_0x585b('0x6')][_0x585b('0x5')]]:_0xcf05ec[_0x585b('0x6')][_0x585b('0x7')]}:undefined;return _0x1094f2[_0xcf05ec[_0x585b('0xb')]][_0x585b('0x8')]({'where':_0xb4935a,'raw':!![]})[_0x585b('0x9')](function(_0x2fef29){_0x5c0109[_0x585b('0xc')]=_[_0x585b('0xd')](_0x2fef29,function(_0x2d675f){return _0x2d675f[_0x585b('0xe')];});_0x58d372(_0x5c0109);})[_0x585b('0xa')](function(_0x29b843){_0x28aeb3(_0x29b843);});});}function _0x57b635(_0x15dba3,_0x4e85f3,_0x85b9f7){if(!_0x4e85f3)return Promise[_0x585b('0xf')](null);return new Promise(function(_0x5bcf90,_0x421e1e){return _0x1094f2[_0x585b('0x10')][_0x585b('0x8')]({'where':{'sectionId':_0x4e85f3['id']},'raw':!![]})[_0x585b('0x9')](function(_0x2960f3){if(_0x15dba3[_0x585b('0x5')]&&_0x15dba3[_0x585b('0x5')]!=='id'){_0x4e85f3[_0x585b('0xc')]=_[_0x585b('0xd')](_0x2960f3,function(_0xf121c8){return _0xf121c8[_0x15dba3['field']];});}else{if(_0x85b9f7==='AnalyticExtractedReport'){_0x4e85f3[_0x585b('0xc')]=_[_0x585b('0xd')](_0x2960f3,function(_0x1e3733){return{'id':_0x1e3733[_0x585b('0x11')],'type':_0x1e3733[_0x585b('0x12')]};});}else{_0x4e85f3[_0x585b('0xc')]=_[_0x585b('0xd')](_0x2960f3,function(_0x36a1b4){return _0x36a1b4['resourceId'];});}}_0x5bcf90(_0x4e85f3);})['catch'](function(_0x24be0d){_0x421e1e(_0x24be0d);});});}function _0x1def1f(_0x25eb94,_0x53cdca){var _0x9dae10={'parentSections':[]};switch(_0x25eb94['toLowerCase']()){case _0x585b('0x13'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x15');break;case _0x585b('0x16'):_0x9dae10['childModel']=_0x585b('0x17');break;case _0x585b('0x18'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x19');_0x9dae10[_0x585b('0x1a')]=[{'name':_0x585b('0x1b'),'field':_0x585b('0xe'),'foreignKey':_0x585b('0x1c')}];break;case _0x585b('0x1d'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x1e');break;case _0x585b('0x1f'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x20');_0x9dae10[_0x585b('0x1a')]=[{'name':_0x585b('0x21'),'field':'id','foreignKey':_0x585b('0x22')}];break;case _0x585b('0x23'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x24');break;case _0x585b('0x25'):_0x9dae10[_0x585b('0x14')]='CmCompany';break;case _0x585b('0x26'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x27');break;case _0x585b('0x28'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x29');break;case'chatwebsites':_0x9dae10[_0x585b('0x14')]='ChatWebsite';break;case'faxqueues':_0x9dae10[_0x585b('0x14')]=_0x585b('0x2a');break;case _0x585b('0x2b'):_0x9dae10['childModel']='FaxAccount';break;case _0x585b('0x2c'):case _0x585b('0x2d'):case _0x585b('0x2e'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x2f');break;case _0x585b('0x30'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x31');break;case _0x585b('0x32'):_0x9dae10['childModel']=_0x585b('0x33');break;case'voicerecordings':_0x9dae10[_0x585b('0x14')]=_0x585b('0x34');_0x9dae10[_0x585b('0x1a')]=[{'name':_0x585b('0x35'),'field':_0x585b('0xe'),'foreignKey':'membername','model':'User','filter':{'field':'role','value':[_0x585b('0x36')]}},{'name':_0x585b('0x37'),'field':'name','foreignKey':_0x585b('0x38'),'model':'User','filter':{'field':'role','value':[_0x585b('0x39')]}},{'name':'VoiceQueues','field':_0x585b('0xe'),'foreignKey':_0x585b('0x3a'),'model':'VoiceQueue','filter':{'field':_0x585b('0x12'),'value':[_0x585b('0x3b')]}},{'name':_0x585b('0x3c'),'field':_0x585b('0xe'),'foreignKey':'queue','model':_0x585b('0x3d'),'filter':{'field':'type','value':[_0x585b('0x3e')]}}];break;case _0x585b('0x3f'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x40');break;case _0x585b('0x41'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x42');break;case'voiceprefixes':_0x9dae10[_0x585b('0x14')]=_0x585b('0x43');break;case _0x585b('0x44'):_0x9dae10[_0x585b('0x14')]='Campaign';break;case'mailqueues':_0x9dae10[_0x585b('0x14')]=_0x585b('0x45');break;case _0x585b('0x46'):_0x9dae10['childModel']=_0x585b('0x47');break;case _0x585b('0x48'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x49');break;case _0x585b('0x4a'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x4b');break;case'openchannelaccounts':_0x9dae10['childModel']=_0x585b('0x4c');break;case'smsqueues':_0x9dae10[_0x585b('0x14')]=_0x585b('0x4d');break;case _0x585b('0x4e'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x4f');break;case _0x585b('0x50'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x51');break;case _0x585b('0x52'):_0x9dae10[_0x585b('0x14')]='WhatsappAccount';break;case _0x585b('0x53'):_0x9dae10['childModel']=_0x585b('0x54');break;case _0x585b('0x55'):case _0x585b('0x56'):_0x9dae10['childModel']=_0x585b('0x3d');if(_0x53cdca){_0x9dae10[_0x585b('0x1a')]=[{'name':_0x585b('0x57')},{'name':'QueueCampaigns'}];}break;case _0x585b('0x58'):case'agents':case'telephones':_0x9dae10['childModel']=_0x585b('0x59');if(_0x53cdca){_0x9dae10[_0x585b('0x1a')]=[{'name':_0x585b('0x5a'),'filter':{'field':_0x585b('0x5b'),'value':[_0x585b('0x5c'),_0x585b('0x5d')]},'ignore':!![]},{'name':_0x585b('0x35')},{'name':_0x585b('0x37')}];}break;case _0x585b('0x5e'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x5f');break;case _0x585b('0x60'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x61');break;case _0x585b('0x62'):_0x9dae10[_0x585b('0x14')]='FreshdeskAccount';break;case _0x585b('0x63'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x64');break;case _0x585b('0x65'):_0x9dae10[_0x585b('0x14')]='DeskAccount';break;case _0x585b('0x66'):_0x9dae10[_0x585b('0x14')]='ZohoAccount';break;case'vtigeraccounts':_0x9dae10['childModel']=_0x585b('0x59');break;case _0x585b('0x67'):_0x9dae10[_0x585b('0x14')]='CannedAnswer';break;case'dispositions':_0x9dae10[_0x585b('0x14')]=_0x585b('0x68');break;case _0x585b('0x69'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x6a');break;case _0x585b('0x6b'):_0x9dae10['childModel']='Interval';break;case _0x585b('0x6c'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x6d');break;case _0x585b('0x6e'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x6f');break;case'sounds':_0x9dae10['childModel']=_0x585b('0x70');break;case _0x585b('0x71'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x72');break;case'templates':_0x9dae10[_0x585b('0x14')]=_0x585b('0x73');break;case _0x585b('0x74'):_0x9dae10['childModel']=_0x585b('0x75');break;case _0x585b('0x76'):_0x9dae10['childModel']='Trunk';break;case _0x585b('0x77'):_0x9dae10['childModel']=_0x585b('0x78');break;case _0x585b('0x79'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x7a');break;case _0x585b('0x7b'):_0x9dae10[_0x585b('0x14')]='AnalyticExtractedReport';_0x9dae10[_0x585b('0x1a')]=[{'name':_0x585b('0x7c'),'field':'id','foreignKey':_0x585b('0x7d')}];break;case _0x585b('0x7e'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x7f');break;}return _0x9dae10;}function _0x12f55d(_0x7fd662,_0x1ed758){var _0x45f888=_0x7fd662[_0x585b('0x80')](0x0)['toUpperCase']()+_0x7fd662['slice'](0x1);var _0xdd52e5={'type':_0x1094f2['Sequelize']['QueryTypes'][_0x585b('0x81')],'raw':!![]};return new Promise(function(_0x1d817f,_0x41a54d){var _0x32ea7e=squel[_0x585b('0x82')]()[_0x585b('0x5')]('ui.'+_0x45f888+'InteractionId','id')[_0x585b('0x5')](_0x585b('0x83'))[_0x585b('0x84')]('user_has_'+_0x7fd662+_0x585b('0x85'),'ui')[_0x585b('0x86')](_0x585b('0x87'),_0x1ed758['id']);return _0x1094f2[_0x585b('0x88')][_0x585b('0x89')](_0x32ea7e[_0x585b('0x8a')](),_0xdd52e5)[_0x585b('0x9')](function(_0x5a0ea4){_0x1ed758[_0x45f888+'OpenTabs']=_0x5a0ea4;_0x1d817f(_0x5a0ea4);})[_0x585b('0xa')](function(_0x157279){_0x41a54d(_0x157279);});});}return _0x538449[_0x585b('0x8b')](_0x585b('0x8c'),attributes,{'tableName':_0x585b('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x301dc4){var _0x239515=require(_0x585b('0x8e'));var _0x502ab5={'raw':_0x301dc4[_0x585b('0x89')][_0x585b('0x8f')],'where':{}};var _0x2cf352={};var _0x17c3d4={'count':0x0,'rows':[]};var _0x265ef8=_0x301dc4[_0x585b('0x89')][_0x585b('0x90')];var _0x745812=_0x301dc4['query']['mergeResources']||![];var _0xc62840=_0x1def1f(_0x265ef8,_0x745812);if(!_0xc62840[_0x585b('0x14')])throw new Error('Invalid\x20section\x20\x27'+_0x265ef8+'\x27');var _0x920ebf=[{'name':_0x265ef8}];if(!_[_0x585b('0x91')](_0xc62840[_0x585b('0x1a')]))_0x920ebf=_0xc62840[_0x585b('0x1a')];var _0x17cdae=[];for(var _0x14eced=0x0;_0x14eced<_0x920ebf[_0x585b('0x92')];_0x14eced++){_0x17cdae['push'](_0x1094f2[_0x585b('0x93')][_0x585b('0x94')]({'where':{'userProfileId':_0x301dc4[_0x585b('0x95')]['id'],'name':_0x920ebf[_0x14eced][_0x585b('0xe')]},'raw':!![]}));}return Promise[_0x585b('0x96')](_0x17cdae)[_0x585b('0x9')](function(_0x28fa38){var _0x49957c=_[_0x585b('0x6')](_0x28fa38,function(_0x3c8a76){return _0x3c8a76?_0x3c8a76:undefined;});var _0x15983c=_[_0x585b('0x6')](_0x920ebf,[_0x585b('0x97'),!![]]);var _0x5e3ebf=_[_0x585b('0x91')](_0x49957c)&&_[_0x585b('0x91')](_0x15983c)?null:_['union'](_0x15983c,_0x49957c);if(!_0x5e3ebf)return null;var _0x227d89=[];for(var _0x51f977=0x0;_0x51f977<_0x5e3ebf[_0x585b('0x92')];_0x51f977++){var _0x45f0a9=_['find'](_0x920ebf,function(_0x1dc9b4){return _0x5e3ebf[_0x51f977]?_0x1dc9b4[_0x585b('0xe')]===_0x5e3ebf[_0x51f977][_0x585b('0xe')]:null;});if(_0x45f0a9){if(_0x5e3ebf[_0x51f977][_0x585b('0x97')]){_0x227d89[_0x585b('0x98')](_0x256b2e(_0xc62840['childModel'],_0x5e3ebf[_0x51f977]));}else{if(!_0x5e3ebf[_0x51f977][_0x585b('0x99')]){_0x227d89[_0x585b('0x98')](_0x57b635(_0x45f0a9,_0x5e3ebf[_0x51f977],_0xc62840['childModel']));}else{if(_0x45f0a9[_0x585b('0xb')]){_0x227d89['push'](_0x4b6778(_0x45f0a9,_0x5e3ebf[_0x51f977]));}}}}}return Promise[_0x585b('0x96')](_0x227d89);})[_0x585b('0x9')](function(_0x4b7674){var _0x4270f9=_0x4b7674;var _0x4b3131=null;if(_0x4270f9){_0x4b3131=_0x4270f9['length']===0x1?_0x4270f9[0x0]:null;}if(!_0x4b3131&&!_0x4270f9)return _0x17c3d4;var _0x1331d1=_0x1094f2[_0xc62840['childModel']]['rawAttributes'];_0x2cf352[_0x585b('0xb')]=_[_0x585b('0x9a')](_0x1331d1);_0x2cf352[_0x585b('0x89')]=_[_0x585b('0x9a')](_0x301dc4[_0x585b('0x89')]);_0x2cf352[_0x585b('0x9b')]=_['intersection'](_0x2cf352[_0x585b('0xb')],_0x2cf352[_0x585b('0x89')]);_0x502ab5[_0x585b('0x9c')]=_[_0x585b('0x9d')](_0x2cf352[_0x585b('0xb')],_0x239515[_0x585b('0x9e')](_0x301dc4[_0x585b('0x89')]['fields']));_0x502ab5[_0x585b('0x9c')]=_0x502ab5['attributes'][_0x585b('0x92')]?_0x502ab5[_0x585b('0x9c')]:_0x2cf352[_0x585b('0xb')];if(!_0x301dc4[_0x585b('0x89')][_0x585b('0x9f')](_0x585b('0xa0'))){_0x502ab5[_0x585b('0xa1')]=_0x239515['limit'](_0x301dc4[_0x585b('0x89')]['limit']);_0x502ab5[_0x585b('0xa2')]=_0x239515[_0x585b('0xa2')](_0x301dc4[_0x585b('0x89')]['offset']);}_0x502ab5[_0x585b('0xa3')]=_0x239515['sort'](_0x301dc4['query'][_0x585b('0xa4')]);_0x502ab5[_0x585b('0x86')]=_0x239515[_0x585b('0x9b')](_[_0x585b('0xa5')](_0x301dc4[_0x585b('0x89')],_0x2cf352[_0x585b('0x9b')]));if(_0x301dc4[_0x585b('0x89')][_0x585b('0x6')]){_0x502ab5[_0x585b('0x86')]=_['merge'](_0x502ab5[_0x585b('0x86')],{'$or':_[_0x585b('0xd')](_0x1331d1,function(_0xc37f78){if(_0xc37f78[_0x585b('0x12')][_0x585b('0xa6')]!=='VIRTUAL'){var _0x42885a={};_0x42885a[_0xc37f78[_0x585b('0x5')]]={'$like':'%'+_0x301dc4['query'][_0x585b('0x6')]+'%'};return _0x42885a;}})});}var _0x394aa2=[];var _0x3fba90=null;var _0x196072={};if(_0x4b3131){_0x3fba90=_[_0x585b('0x94')](_0x920ebf,[_0x585b('0xe'),_0x4b3131[_0x585b('0xe')]]);if(_0x3fba90[_0x585b('0x5')]){_0x196072={};if(_0xc62840['childModel']===_0x585b('0xa7')){_0x196072[_0x3fba90[_0x585b('0xa8')]]=_[_0x585b('0xd')](_0x4b3131[_0x585b('0xc')],'id');}else{_0x196072[_0x3fba90[_0x585b('0xa8')]]=_0x4b3131[_0x585b('0xc')];}_0x394aa2[_0x585b('0x98')](_0x196072);}else{_0x502ab5[_0x585b('0x86')]['id']=_0x4b3131[_0x585b('0xc')];}}else{for(var _0xde8b21=0x0;_0xde8b21<_0x4270f9[_0x585b('0x92')];_0xde8b21++){_0x3fba90=_[_0x585b('0x94')](_0x920ebf,['name',_0x4270f9[_0xde8b21][_0x585b('0xe')]]);if(_0x3fba90[_0x585b('0x5')]){_0x196072={};_0x196072[_0x3fba90[_0x585b('0xa8')]]=_0x4270f9[_0xde8b21][_0x585b('0xc')];_0x394aa2[_0x585b('0x98')](_0x196072);}else{if(!_0x502ab5[_0x585b('0x86')]['id'])_0x502ab5[_0x585b('0x86')]['id']=[];_0x4270f9[_0xde8b21][_0x585b('0xc')][_0x585b('0xa9')](function(_0x4b8f4d){_0x502ab5[_0x585b('0x86')]['id'][_0x585b('0x98')](_0x4b8f4d);});}}}if(!_['isEmpty'](_0x394aa2)){_0x502ab5[_0x585b('0x86')]=_[_0x585b('0xaa')](_0x502ab5[_0x585b('0x86')],{'$and':{'$or':_0x394aa2}});}_0x502ab5=_[_0x585b('0xaa')]({},_0x502ab5,_0x301dc4['options']);if(_0x4b3131&&!_0x4b3131[_0x585b('0x99')]&&_0xc62840['childModel']===_0x585b('0xa7')){if(_0x301dc4[_0x585b('0x89')]['includeAll']){_0x502ab5[_0x585b('0xab')]=[{'all':!![]}];}return _0x1094f2[_0xc62840['childModel']][_0x585b('0x8')](_0x502ab5)['then'](function(_0x53c977){var _0x30efbb=[];_0x53c977[_0x585b('0xa9')](function(_0x3abb50){var _0x20aeed;switch(_0x3abb50[_0x585b('0xac')]){case'default':_0x20aeed=_[_0x585b('0x94')](_0x4b3131[_0x585b('0xc')],function(_0x28bb7a){return _0x28bb7a['id']===_0x3abb50[_0x585b('0x7d')]&&_0x28bb7a['type']===_0x585b('0xad');});break;case'custom':_0x20aeed=_[_0x585b('0x94')](_0x4b3131[_0x585b('0xc')],function(_0x41ae59){return _0x41ae59['id']===_0x3abb50[_0x585b('0x7d')]&&_0x41ae59[_0x585b('0x12')]===_0x585b('0xae');});break;}if(_0x20aeed)_0x30efbb['push'](_0x3abb50);});_0x17c3d4[_0x585b('0xaf')]=_0x30efbb['length'];_0x17c3d4['rows']=_0x30efbb;return _0x17c3d4;});}else{if(!_[_0x585b('0x91')](_0x301dc4[_0x585b('0x89')][_0x585b('0xb0')])){_0x502ab5[_0x585b('0x86')]['id']=_0x502ab5[_0x585b('0x86')]['id']?_[_0x585b('0x9d')](_0x502ab5[_0x585b('0x86')]['id'],_0x301dc4[_0x585b('0x89')][_0x585b('0xb0')]):_0x301dc4[_0x585b('0x89')][_0x585b('0xb0')];if(_0x301dc4[_0x585b('0x89')][_0x585b('0xb1')]){_0x502ab5[_0x585b('0xa3')]=_0x301dc4[_0x585b('0x89')][_0x585b('0xb1')];}}if(_0x301dc4[_0x585b('0x89')][_0x585b('0xb2')]){_0x502ab5[_0x585b('0x86')]=_['merge'](_0x502ab5[_0x585b('0x86')],{'$and':_0x301dc4[_0x585b('0x89')]['extraQueryConditions']});}return _0x1094f2[_0xc62840[_0x585b('0x14')]][_0x585b('0xaf')]({'where':_0x502ab5[_0x585b('0x86')]})['then'](function(_0x31292a){_0x17c3d4[_0x585b('0xaf')]=_0x31292a;if(_0x301dc4['query'][_0x585b('0xb3')]){if(_0xc62840[_0x585b('0x14')]===_0x585b('0x20')){_0x502ab5[_0x585b('0xab')]=[{'model':_0x1094f2[_0x585b('0x72')],'as':'Tags','attributes':['id','name',_0x585b('0xb4')],'required':_0x301dc4['query'][_0x585b('0xb5')]?!![]:![]},{'model':_0x1094f2[_0x585b('0x72')],'as':_0x585b('0xb6'),'attributes':['id',_0x585b('0xe'),_0x585b('0xb4')],'through':_0x301dc4['query'][_0x585b('0xb5')]?{'attributes':[],'where':{'TagId':_0x301dc4[_0x585b('0x89')][_0x585b('0xb5')]||undefined}}:{},'required':_0x301dc4['query'][_0x585b('0xb5')]?!![]:![]}];}else{_0x502ab5[_0x585b('0xab')]=[{'all':!![]}];}}return _0x1094f2[_0xc62840[_0x585b('0x14')]]['findAll'](_0x502ab5);})[_0x585b('0x9')](function(_0x32248c){_0x17c3d4[_0x585b('0xb7')]=_0x32248c;if(_0x265ef8==='Agents'&&_0x301dc4['query']['openTabs']===_0x585b('0xb8')){var _0x1c7ec2=[];for(var _0x289370=0x0;_0x289370<_0x17c3d4[_0x585b('0xb7')]['length'];_0x289370++){_0x1c7ec2[_0x585b('0x98')](_0x12f55d('chat',_0x17c3d4[_0x585b('0xb7')][_0x289370][_0x585b('0xb9')]));_0x1c7ec2[_0x585b('0x98')](_0x12f55d('sms',_0x17c3d4[_0x585b('0xb7')][_0x289370]['dataValues']));_0x1c7ec2[_0x585b('0x98')](_0x12f55d(_0x585b('0xba'),_0x17c3d4[_0x585b('0xb7')][_0x289370][_0x585b('0xb9')]));_0x1c7ec2[_0x585b('0x98')](_0x12f55d(_0x585b('0xbb'),_0x17c3d4[_0x585b('0xb7')][_0x289370][_0x585b('0xb9')]));_0x1c7ec2[_0x585b('0x98')](_0x12f55d('openchannel',_0x17c3d4[_0x585b('0xb7')][_0x289370]['dataValues']));_0x1c7ec2[_0x585b('0x98')](_0x12f55d(_0x585b('0xbc'),_0x17c3d4['rows'][_0x289370][_0x585b('0xb9')]));}return Promise[_0x585b('0x96')](_0x1c7ec2)[_0x585b('0x9')](function(){return _0x17c3d4;});}return _0x17c3d4;});}});}}});}; \ No newline at end of file +var _0xa3ac=['resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','internalroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','User','telephone','VoiceQueues','queue','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','Campaign','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','telephones','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','Interval','scheduler','sounds','Sound','tags','Tag','templates','triggers','trunks','Trunk','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','isEmpty','length','UserProfileSection','find','params','ignore','union','push','autoAssociation','all','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','merge','key','VIRTUAL','foreignKey','forEach','reportType','default','custom','reportId','rows','ids','customSorting','extraQueryConditions','count','CmContact','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','fax','whatsapp','lodash','./userProfile.attributes','exports','models','filter','field','findAll','then','associatedResources','map','catch','model'];(function(_0x2a6530,_0x129984){var _0x485fc0=function(_0x22c385){while(--_0x22c385){_0x2a6530['push'](_0x2a6530['shift']());}};_0x485fc0(++_0x129984);}(_0xa3ac,0xae));var _0xca3a=function(_0x23714f,_0x1c1850){_0x23714f=_0x23714f-0x0;var _0x185221=_0xa3ac[_0x23714f];return _0x185221;};'use strict';var _=require(_0xca3a('0x0'));var attributes=require(_0xca3a('0x1'));var squel=require('squel');module[_0xca3a('0x2')]=function(_0x5a9b90){var _0x5c6578=_0x5a9b90[_0xca3a('0x3')];function _0x460ede(_0x63027e,_0x56f039){return new Promise(function(_0x23d1d1,_0x56039c){if(!_0x56f039)return _0x23d1d1(null);var _0x5c62d2=_0x56f039[_0xca3a('0x4')]?{[_0x56f039['filter'][_0xca3a('0x5')]]:_0x56f039['filter']['value']}:undefined;return _0x5c6578[_0x63027e][_0xca3a('0x6')]({'where':_0x5c62d2,'raw':!![]})[_0xca3a('0x7')](function(_0x5bf658){_0x56f039[_0xca3a('0x8')]=_[_0xca3a('0x9')](_0x5bf658,'id');_0x23d1d1(_0x56f039);})[_0xca3a('0xa')](function(_0x3206d4){_0x56039c(_0x3206d4);});});}function _0x21e189(_0x19a4ac,_0x1d2ed3){return new Promise(function(_0x21ddbd,_0x27e663){var _0x15f20f=_0x19a4ac['filter']?{[_0x19a4ac[_0xca3a('0x4')][_0xca3a('0x5')]]:_0x19a4ac[_0xca3a('0x4')]['value']}:undefined;return _0x5c6578[_0x19a4ac[_0xca3a('0xb')]][_0xca3a('0x6')]({'where':_0x15f20f,'raw':!![]})[_0xca3a('0x7')](function(_0x4fa836){_0x1d2ed3[_0xca3a('0x8')]=_[_0xca3a('0x9')](_0x4fa836,function(_0x31e944){return _0x31e944['name'];});_0x21ddbd(_0x1d2ed3);})['catch'](function(_0x2f1666){_0x27e663(_0x2f1666);});});}function _0x2d7baa(_0x46a543,_0x3f8b85,_0x376353){if(!_0x3f8b85)return Promise[_0xca3a('0xc')](null);return new Promise(function(_0x561fbd,_0x1a92f1){return _0x5c6578[_0xca3a('0xd')][_0xca3a('0x6')]({'where':{'sectionId':_0x3f8b85['id']},'raw':!![]})[_0xca3a('0x7')](function(_0x26b513){if(_0x46a543[_0xca3a('0x5')]&&_0x46a543[_0xca3a('0x5')]!=='id'){_0x3f8b85[_0xca3a('0x8')]=_['map'](_0x26b513,function(_0xf72ca7){return _0xf72ca7[_0x46a543[_0xca3a('0x5')]];});}else{if(_0x376353===_0xca3a('0xe')){_0x3f8b85[_0xca3a('0x8')]=_['map'](_0x26b513,function(_0x2273a5){return{'id':_0x2273a5[_0xca3a('0xf')],'type':_0x2273a5[_0xca3a('0x10')]};});}else{_0x3f8b85[_0xca3a('0x8')]=_[_0xca3a('0x9')](_0x26b513,function(_0x19242d){return _0x19242d['resourceId'];});}}_0x561fbd(_0x3f8b85);})['catch'](function(_0x1c5e38){_0x1a92f1(_0x1c5e38);});});}function _0x4f122c(_0x8c1695,_0x1305c7){var _0x43cb43={'parentSections':[]};switch(_0x8c1695[_0xca3a('0x11')]()){case _0xca3a('0x12'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x14');break;case _0xca3a('0x15'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x16');break;case'squarerecordings':_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x17');_0x43cb43[_0xca3a('0x18')]=[{'name':_0xca3a('0x19'),'field':_0xca3a('0x1a'),'foreignKey':_0xca3a('0x1b')}];break;case _0xca3a('0x1c'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x1d');break;case'contacts':_0x43cb43[_0xca3a('0x13')]='CmContact';_0x43cb43['parentSections']=[{'name':_0xca3a('0x1e'),'field':'id','foreignKey':_0xca3a('0x1f')}];break;case _0xca3a('0x20'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x21');break;case _0xca3a('0x22'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x23');break;case _0xca3a('0x24'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x25');break;case _0xca3a('0x26'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x27');break;case _0xca3a('0x28'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x29');break;case _0xca3a('0x2a'):_0x43cb43[_0xca3a('0x13')]='FaxQueue';break;case _0xca3a('0x2b'):_0x43cb43[_0xca3a('0x13')]='FaxAccount';break;case'inboundroutes':case _0xca3a('0x2c'):case'outboundroutes':_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x2d');break;case _0xca3a('0x2e'):_0x43cb43['childModel']='VoiceContext';break;case _0xca3a('0x2f'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x30');break;case _0xca3a('0x31'):_0x43cb43['childModel']=_0xca3a('0x32');_0x43cb43[_0xca3a('0x18')]=[{'name':_0xca3a('0x33'),'field':_0xca3a('0x1a'),'foreignKey':_0xca3a('0x34'),'model':'User','filter':{'field':_0xca3a('0x35'),'value':[_0xca3a('0x36')]}},{'name':'Telephones','field':_0xca3a('0x1a'),'foreignKey':_0xca3a('0x34'),'model':_0xca3a('0x37'),'filter':{'field':'role','value':[_0xca3a('0x38')]}},{'name':_0xca3a('0x39'),'field':_0xca3a('0x1a'),'foreignKey':_0xca3a('0x3a'),'model':'VoiceQueue','filter':{'field':_0xca3a('0x10'),'value':['inbound']}},{'name':_0xca3a('0x3b'),'field':_0xca3a('0x1a'),'foreignKey':_0xca3a('0x3a'),'model':_0xca3a('0x3c'),'filter':{'field':_0xca3a('0x10'),'value':[_0xca3a('0x3d')]}}];break;case _0xca3a('0x3e'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x3f');break;case _0xca3a('0x40'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x41');break;case'voiceprefixes':_0x43cb43['childModel']='VoicePrefix';break;case'ivrcampaigns':_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x42');break;case'mailqueues':_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x43');break;case _0xca3a('0x44'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x45');break;case'mailsubstatuses':_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x46');break;case _0xca3a('0x47'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x48');break;case _0xca3a('0x49'):_0x43cb43[_0xca3a('0x13')]='OpenchannelAccount';break;case _0xca3a('0x4a'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x4b');break;case'smsaccounts':_0x43cb43['childModel']=_0xca3a('0x4c');break;case _0xca3a('0x4d'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x4e');break;case _0xca3a('0x4f'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x50');break;case _0xca3a('0x51'):_0x43cb43[_0xca3a('0x13')]='Team';break;case _0xca3a('0x52'):case _0xca3a('0x53'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x3c');if(_0x1305c7){_0x43cb43['parentSections']=[{'name':_0xca3a('0x39')},{'name':_0xca3a('0x3b')}];}break;case _0xca3a('0x54'):case'agents':case _0xca3a('0x55'):_0x43cb43['childModel']=_0xca3a('0x37');if(_0x1305c7){_0x43cb43['parentSections']=[{'name':'Users','filter':{'field':_0xca3a('0x35'),'value':[_0xca3a('0x56'),'user']},'ignore':!![]},{'name':_0xca3a('0x33')},{'name':'Telephones'}];}break;case _0xca3a('0x57'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x58');break;case _0xca3a('0x59'):_0x43cb43['childModel']=_0xca3a('0x5a');break;case _0xca3a('0x5b'):_0x43cb43['childModel']=_0xca3a('0x5c');break;case'sugarcrmaccounts':_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x5d');break;case _0xca3a('0x5e'):_0x43cb43['childModel']=_0xca3a('0x5f');break;case _0xca3a('0x60'):_0x43cb43[_0xca3a('0x13')]='ZohoAccount';break;case _0xca3a('0x61'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x37');break;case _0xca3a('0x62'):_0x43cb43[_0xca3a('0x13')]='CannedAnswer';break;case _0xca3a('0x63'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x64');break;case _0xca3a('0x65'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x66');break;case'intervals':_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x67');break;case'pauses':_0x43cb43[_0xca3a('0x13')]='Pause';break;case _0xca3a('0x68'):_0x43cb43[_0xca3a('0x13')]='Schedule';break;case _0xca3a('0x69'):_0x43cb43['childModel']=_0xca3a('0x6a');break;case _0xca3a('0x6b'):_0x43cb43['childModel']=_0xca3a('0x6c');break;case _0xca3a('0x6d'):_0x43cb43[_0xca3a('0x13')]='Template';break;case _0xca3a('0x6e'):_0x43cb43[_0xca3a('0x13')]='Trigger';break;case _0xca3a('0x6f'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x70');break;case'variables':_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x71');break;case _0xca3a('0x72'):_0x43cb43[_0xca3a('0x13')]='Plugin';break;case _0xca3a('0x73'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0xe');_0x43cb43[_0xca3a('0x18')]=[{'name':_0xca3a('0x74'),'field':'id','foreignKey':'reportId'}];break;case _0xca3a('0x75'):_0x43cb43[_0xca3a('0x13')]=_0xca3a('0x76');break;}return _0x43cb43;}function _0x583b45(_0x452753,_0x227c4c){var _0x4486cd=_0x452753[_0xca3a('0x77')](0x0)[_0xca3a('0x78')]()+_0x452753['slice'](0x1);var _0x49baed={'type':_0x5c6578[_0xca3a('0x79')][_0xca3a('0x7a')][_0xca3a('0x7b')],'raw':!![]};return new Promise(function(_0x29d7bd,_0x410f8a){var _0x221adb=squel[_0xca3a('0x7c')]()[_0xca3a('0x5')]('ui.'+_0x4486cd+_0xca3a('0x7d'),'id')[_0xca3a('0x5')](_0xca3a('0x7e'))[_0xca3a('0x7f')](_0xca3a('0x80')+_0x452753+_0xca3a('0x81'),'ui')[_0xca3a('0x82')]('ui.UserId\x20=\x20?',_0x227c4c['id']);return _0x5c6578[_0xca3a('0x83')]['query'](_0x221adb[_0xca3a('0x84')](),_0x49baed)[_0xca3a('0x7')](function(_0x48da64){_0x227c4c[_0x4486cd+_0xca3a('0x85')]=_0x48da64;_0x29d7bd(_0x48da64);})[_0xca3a('0xa')](function(_0x2dbc24){_0x410f8a(_0x2dbc24);});});}return _0x5a9b90[_0xca3a('0x86')](_0xca3a('0x87'),attributes,{'tableName':_0xca3a('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3df904){var _0x414bd9=require(_0xca3a('0x89'));var _0x25db4b={'raw':_0x3df904['query'][_0xca3a('0x8a')],'where':{}};var _0x518c33={};var _0x318288={'count':0x0,'rows':[]};var _0x3e92f1=_0x3df904['query'][_0xca3a('0x8b')];var _0xd1f653=_0x3df904['query'][_0xca3a('0x8c')]||![];var _0x35aebd=_0x4f122c(_0x3e92f1,_0xd1f653);if(!_0x35aebd[_0xca3a('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0x3e92f1+'\x27');var _0x37bb21=[{'name':_0x3e92f1}];if(!_[_0xca3a('0x8d')](_0x35aebd[_0xca3a('0x18')]))_0x37bb21=_0x35aebd[_0xca3a('0x18')];var _0x2a94f7=[];for(var _0x2dd2e0=0x0;_0x2dd2e0<_0x37bb21[_0xca3a('0x8e')];_0x2dd2e0++){_0x2a94f7['push'](_0x5c6578[_0xca3a('0x8f')][_0xca3a('0x90')]({'where':{'userProfileId':_0x3df904[_0xca3a('0x91')]['id'],'name':_0x37bb21[_0x2dd2e0][_0xca3a('0x1a')]},'raw':!![]}));}return Promise['all'](_0x2a94f7)[_0xca3a('0x7')](function(_0xa68733){var _0x234a1f=_[_0xca3a('0x4')](_0xa68733,function(_0x47f673){return _0x47f673?_0x47f673:undefined;});var _0x113b7b=_[_0xca3a('0x4')](_0x37bb21,[_0xca3a('0x92'),!![]]);var _0x4087b0=_[_0xca3a('0x8d')](_0x234a1f)&&_[_0xca3a('0x8d')](_0x113b7b)?null:_[_0xca3a('0x93')](_0x113b7b,_0x234a1f);if(!_0x4087b0)return null;var _0x22020f=[];for(var _0x581036=0x0;_0x581036<_0x4087b0['length'];_0x581036++){var _0x29f1e3=_[_0xca3a('0x90')](_0x37bb21,function(_0x2086a5){return _0x4087b0[_0x581036]?_0x2086a5[_0xca3a('0x1a')]===_0x4087b0[_0x581036][_0xca3a('0x1a')]:null;});if(_0x29f1e3){if(_0x4087b0[_0x581036][_0xca3a('0x92')]){_0x22020f[_0xca3a('0x94')](_0x460ede(_0x35aebd[_0xca3a('0x13')],_0x4087b0[_0x581036]));}else{if(!_0x4087b0[_0x581036][_0xca3a('0x95')]){_0x22020f[_0xca3a('0x94')](_0x2d7baa(_0x29f1e3,_0x4087b0[_0x581036],_0x35aebd['childModel']));}else{if(_0x29f1e3['model']){_0x22020f[_0xca3a('0x94')](_0x21e189(_0x29f1e3,_0x4087b0[_0x581036]));}}}}}return Promise[_0xca3a('0x96')](_0x22020f);})[_0xca3a('0x7')](function(_0x2ac737){var _0x276148=_0x2ac737;var _0x2bb607=null;if(_0x276148){_0x2bb607=_0x276148[_0xca3a('0x8e')]===0x1?_0x276148[0x0]:null;}if(!_0x2bb607&&!_0x276148)return _0x318288;var _0x2e13b3=_0x5c6578[_0x35aebd[_0xca3a('0x13')]]['rawAttributes'];_0x518c33[_0xca3a('0xb')]=_[_0xca3a('0x97')](_0x2e13b3);_0x518c33[_0xca3a('0x98')]=_['keys'](_0x3df904[_0xca3a('0x98')]);_0x518c33[_0xca3a('0x99')]=_['intersection'](_0x518c33[_0xca3a('0xb')],_0x518c33[_0xca3a('0x98')]);_0x25db4b[_0xca3a('0x9a')]=_['intersection'](_0x518c33[_0xca3a('0xb')],_0x414bd9[_0xca3a('0x9b')](_0x3df904[_0xca3a('0x98')][_0xca3a('0x9b')]));_0x25db4b['attributes']=_0x25db4b[_0xca3a('0x9a')][_0xca3a('0x8e')]?_0x25db4b[_0xca3a('0x9a')]:_0x518c33[_0xca3a('0xb')];if(!_0x3df904[_0xca3a('0x98')][_0xca3a('0x9c')](_0xca3a('0x9d'))){_0x25db4b[_0xca3a('0x9e')]=_0x414bd9[_0xca3a('0x9e')](_0x3df904['query'][_0xca3a('0x9e')]);_0x25db4b[_0xca3a('0x9f')]=_0x414bd9[_0xca3a('0x9f')](_0x3df904['query']['offset']);}_0x25db4b[_0xca3a('0xa0')]=_0x414bd9['sort'](_0x3df904[_0xca3a('0x98')]['sort']);_0x25db4b[_0xca3a('0x82')]=_0x414bd9['filters'](_['pick'](_0x3df904[_0xca3a('0x98')],_0x518c33[_0xca3a('0x99')]));if(_0x3df904['query'][_0xca3a('0x4')]){_0x25db4b[_0xca3a('0x82')]=_[_0xca3a('0xa1')](_0x25db4b['where'],{'$or':_[_0xca3a('0x9')](_0x2e13b3,function(_0x48ae65){if(_0x48ae65[_0xca3a('0x10')][_0xca3a('0xa2')]!==_0xca3a('0xa3')){var _0x2fc753={};_0x2fc753[_0x48ae65[_0xca3a('0x5')]]={'$like':'%'+_0x3df904[_0xca3a('0x98')][_0xca3a('0x4')]+'%'};return _0x2fc753;}})});}var _0x461c45=[];var _0xa123c0=null;var _0x5b5fff={};if(_0x2bb607){_0xa123c0=_[_0xca3a('0x90')](_0x37bb21,[_0xca3a('0x1a'),_0x2bb607[_0xca3a('0x1a')]]);if(_0xa123c0[_0xca3a('0x5')]){_0x5b5fff={};if(_0x35aebd[_0xca3a('0x13')]===_0xca3a('0xe')){_0x5b5fff[_0xa123c0[_0xca3a('0xa4')]]=_[_0xca3a('0x9')](_0x2bb607[_0xca3a('0x8')],'id');}else{_0x5b5fff[_0xa123c0['foreignKey']]=_0x2bb607['associatedResources'];}_0x461c45[_0xca3a('0x94')](_0x5b5fff);}else{_0x25db4b[_0xca3a('0x82')]['id']=_0x2bb607[_0xca3a('0x8')];}}else{for(var _0x2b11fe=0x0;_0x2b11fe<_0x276148[_0xca3a('0x8e')];_0x2b11fe++){_0xa123c0=_[_0xca3a('0x90')](_0x37bb21,[_0xca3a('0x1a'),_0x276148[_0x2b11fe][_0xca3a('0x1a')]]);if(_0xa123c0[_0xca3a('0x5')]){_0x5b5fff={};_0x5b5fff[_0xa123c0[_0xca3a('0xa4')]]=_0x276148[_0x2b11fe][_0xca3a('0x8')];_0x461c45[_0xca3a('0x94')](_0x5b5fff);}else{if(!_0x25db4b[_0xca3a('0x82')]['id'])_0x25db4b[_0xca3a('0x82')]['id']=[];_0x276148[_0x2b11fe][_0xca3a('0x8')][_0xca3a('0xa5')](function(_0xc2b8c2){_0x25db4b[_0xca3a('0x82')]['id']['push'](_0xc2b8c2);});}}}if(!_['isEmpty'](_0x461c45)){_0x25db4b[_0xca3a('0x82')]=_['merge'](_0x25db4b[_0xca3a('0x82')],{'$and':{'$or':_0x461c45}});}_0x25db4b=_[_0xca3a('0xa1')]({},_0x25db4b,_0x3df904['options']);if(_0x2bb607&&!_0x2bb607[_0xca3a('0x95')]&&_0x35aebd[_0xca3a('0x13')]==='AnalyticExtractedReport'){if(_0x3df904['query']['includeAll']){_0x25db4b['include']=[{'all':!![]}];}return _0x5c6578[_0x35aebd[_0xca3a('0x13')]]['findAll'](_0x25db4b)[_0xca3a('0x7')](function(_0x262edc){var _0x4b7bf7=[];_0x262edc[_0xca3a('0xa5')](function(_0x362547){var _0x30e145;switch(_0x362547[_0xca3a('0xa6')]){case _0xca3a('0xa7'):_0x30e145=_[_0xca3a('0x90')](_0x2bb607[_0xca3a('0x8')],function(_0x1520ac){return _0x1520ac['id']===_0x362547['reportId']&&_0x1520ac['type']==='DefaultReports';});break;case _0xca3a('0xa8'):_0x30e145=_['find'](_0x2bb607[_0xca3a('0x8')],function(_0x2ee6fd){return _0x2ee6fd['id']===_0x362547[_0xca3a('0xa9')]&&_0x2ee6fd[_0xca3a('0x10')]==='CustomReports';});break;}if(_0x30e145)_0x4b7bf7[_0xca3a('0x94')](_0x362547);});_0x318288['count']=_0x4b7bf7[_0xca3a('0x8e')];_0x318288[_0xca3a('0xaa')]=_0x4b7bf7;return _0x318288;});}else{if(!_[_0xca3a('0x8d')](_0x3df904[_0xca3a('0x98')]['ids'])){_0x25db4b['where']['id']=_0x25db4b[_0xca3a('0x82')]['id']?_['intersection'](_0x25db4b[_0xca3a('0x82')]['id'],_0x3df904[_0xca3a('0x98')]['ids']):_0x3df904['query'][_0xca3a('0xab')];if(_0x3df904[_0xca3a('0x98')]['customSorting']){_0x25db4b['order']=_0x3df904[_0xca3a('0x98')][_0xca3a('0xac')];}}if(_0x3df904[_0xca3a('0x98')][_0xca3a('0xad')]){_0x25db4b[_0xca3a('0x82')]=_[_0xca3a('0xa1')](_0x25db4b[_0xca3a('0x82')],{'$and':_0x3df904[_0xca3a('0x98')][_0xca3a('0xad')]});}return _0x5c6578[_0x35aebd['childModel']][_0xca3a('0xae')]({'where':_0x25db4b[_0xca3a('0x82')]})[_0xca3a('0x7')](function(_0x471b63){_0x318288[_0xca3a('0xae')]=_0x471b63;if(_0x3df904[_0xca3a('0x98')]['includeAll']){if(_0x35aebd[_0xca3a('0x13')]===_0xca3a('0xaf')){_0x25db4b['include']=[{'model':_0x5c6578[_0xca3a('0x6c')],'as':_0xca3a('0xb0'),'attributes':['id',_0xca3a('0x1a'),_0xca3a('0xb1')],'required':_0x3df904[_0xca3a('0x98')][_0xca3a('0xb2')]?!![]:![]},{'model':_0x5c6578[_0xca3a('0x6c')],'as':_0xca3a('0xb3'),'attributes':['id',_0xca3a('0x1a'),'color'],'through':_0x3df904[_0xca3a('0x98')][_0xca3a('0xb2')]?{'attributes':[],'where':{'TagId':_0x3df904[_0xca3a('0x98')][_0xca3a('0xb2')]||undefined}}:{},'required':_0x3df904['query'][_0xca3a('0xb2')]?!![]:![]}];}else{_0x25db4b['include']=[{'all':!![]}];}}return _0x5c6578[_0x35aebd['childModel']][_0xca3a('0x6')](_0x25db4b);})[_0xca3a('0x7')](function(_0x4437f7){_0x318288[_0xca3a('0xaa')]=_0x4437f7;if(_0x3e92f1==='Agents'&&_0x3df904[_0xca3a('0x98')][_0xca3a('0xb4')]===_0xca3a('0xb5')){var _0x332257=[];for(var _0xbe6c7f=0x0;_0xbe6c7f<_0x318288['rows'][_0xca3a('0x8e')];_0xbe6c7f++){_0x332257[_0xca3a('0x94')](_0x583b45(_0xca3a('0xb6'),_0x318288[_0xca3a('0xaa')][_0xbe6c7f][_0xca3a('0xb7')]));_0x332257[_0xca3a('0x94')](_0x583b45('sms',_0x318288[_0xca3a('0xaa')][_0xbe6c7f][_0xca3a('0xb7')]));_0x332257['push'](_0x583b45(_0xca3a('0xb8'),_0x318288[_0xca3a('0xaa')][_0xbe6c7f][_0xca3a('0xb7')]));_0x332257[_0xca3a('0x94')](_0x583b45('mail',_0x318288[_0xca3a('0xaa')][_0xbe6c7f][_0xca3a('0xb7')]));_0x332257[_0xca3a('0x94')](_0x583b45('openchannel',_0x318288['rows'][_0xbe6c7f][_0xca3a('0xb7')]));_0x332257[_0xca3a('0x94')](_0x583b45(_0xca3a('0xb9'),_0x318288[_0xca3a('0xaa')][_0xbe6c7f][_0xca3a('0xb7')]));}return Promise[_0xca3a('0x96')](_0x332257)[_0xca3a('0x7')](function(){return _0x318288;});}return _0x318288;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index d00e5f9..c398f11 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 _0x2aa3=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x581fe5,_0xf845c){var _0x4982c2=function(_0x242ab4){while(--_0x242ab4){_0x581fe5['push'](_0x581fe5['shift']());}};_0x4982c2(++_0xf845c);}(_0x2aa3,0x83));var _0x32aa=function(_0x2cb275,_0x47332a){_0x2cb275=_0x2cb275-0x0;var _0x46976f=_0x2aa3[_0x2cb275];return _0x46976f;};'use strict';var _=require(_0x32aa('0x0'));var util=require(_0x32aa('0x1'));var moment=require(_0x32aa('0x2'));var BPromise=require(_0x32aa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32aa('0x4'))['db'];var utils=require(_0x32aa('0x5'));var logger=require(_0x32aa('0x6'))(_0x32aa('0x7'));var config=require(_0x32aa('0x8'));var jayson=require(_0x32aa('0x9'));var client=jayson['client'][_0x32aa('0xa')]({'port':0x232a});config[_0x32aa('0xb')]=_[_0x32aa('0xc')](config[_0x32aa('0xb')],{'host':_0x32aa('0xd'),'port':0x18eb});var socket=require(_0x32aa('0xe'))(new Redis(config[_0x32aa('0xb')]));require(_0x32aa('0xf'))['register'](socket);function respondWithRpcPromise(_0x21bee0,_0x56992d,_0x3d61ee){return new BPromise(function(_0x448505,_0x39f58e){return client[_0x32aa('0x10')](_0x21bee0,_0x3d61ee)['then'](function(_0x339b72){logger[_0x32aa('0x11')](_0x32aa('0x12'),_0x56992d,'request\x20sent');logger[_0x32aa('0x13')](_0x32aa('0x14'),_0x56992d,_0x32aa('0x15'),JSON[_0x32aa('0x16')](_0x339b72));if(_0x339b72[_0x32aa('0x17')]){if(_0x339b72[_0x32aa('0x17')][_0x32aa('0x18')]===0x1f4){logger[_0x32aa('0x17')]('UserProfile,\x20%s,\x20%s',_0x56992d,_0x339b72[_0x32aa('0x17')][_0x32aa('0x19')]);return _0x39f58e(_0x339b72[_0x32aa('0x17')][_0x32aa('0x19')]);}logger[_0x32aa('0x17')]('UserProfile,\x20%s,\x20%s',_0x56992d,_0x339b72[_0x32aa('0x17')][_0x32aa('0x19')]);return _0x448505(_0x339b72[_0x32aa('0x17')][_0x32aa('0x19')]);}else{logger[_0x32aa('0x11')]('UserProfile,\x20%s,\x20%s',_0x56992d,'request\x20sent');_0x448505(_0x339b72[_0x32aa('0x1a')][_0x32aa('0x19')]);}})[_0x32aa('0x1b')](function(_0x52a182){logger['error'](_0x32aa('0x12'),_0x56992d,_0x52a182);_0x39f58e(_0x52a182);});});} \ No newline at end of file +var _0x5f2f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x1980bf,_0x9cda10){var _0x352a25=function(_0x39b558){while(--_0x39b558){_0x1980bf['push'](_0x1980bf['shift']());}};_0x352a25(++_0x9cda10);}(_0x5f2f,0x73));var _0xf5f2=function(_0x33b3ee,_0x62a38d){_0x33b3ee=_0x33b3ee-0x0;var _0x29a6c2=_0x5f2f[_0x33b3ee];return _0x29a6c2;};'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});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./userProfile.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 8c384df..4c65a4c 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 _0x7228=['update','emit','length','userProfile:','./userProfile.events','save','remove'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0x7228,0x1d9));var _0x8722=function(_0x268d75,_0x4ea6c2){_0x268d75=_0x268d75-0x0;var _0x2d302c=_0x7228[_0x268d75];return _0x2d302c;};'use strict';var UserProfileEvents=require(_0x8722('0x0'));var events=[_0x8722('0x1'),_0x8722('0x2'),_0x8722('0x3')];function createListener(_0x42ee90,_0x32f31e){return function(_0x532a9b){_0x32f31e[_0x8722('0x4')](_0x42ee90,_0x532a9b);};}function removeListener(_0x5827ef,_0x4764ca){return function(){UserProfileEvents['removeListener'](_0x5827ef,_0x4764ca);};}exports['register']=function(_0x1875b4){for(var _0x20bc95=0x0,_0x472e16=events[_0x8722('0x5')];_0x20bc95<_0x472e16;_0x20bc95++){var _0x5548cf=events[_0x20bc95];var _0x3f65e2=createListener(_0x8722('0x6')+_0x5548cf,_0x1875b4);UserProfileEvents['on'](_0x5548cf,_0x3f65e2);}}; \ No newline at end of file +var _0x1f7c=['emit','removeListener','length','userProfile:','./userProfile.events','update'];(function(_0x2ba8cc,_0x2ccb6d){var _0x53b54c=function(_0x37042a){while(--_0x37042a){_0x2ba8cc['push'](_0x2ba8cc['shift']());}};_0x53b54c(++_0x2ccb6d);}(_0x1f7c,0x7c));var _0xc1f7=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x1f7c[_0x4a7631];return _0x1a5a6f;};'use strict';var UserProfileEvents=require(_0xc1f7('0x0'));var events=['save','remove',_0xc1f7('0x1')];function createListener(_0x4c121b,_0x489b27){return function(_0x1bfffd){_0x489b27[_0xc1f7('0x2')](_0x4c121b,_0x1bfffd);};}function removeListener(_0x2cf896,_0x54f595){return function(){UserProfileEvents[_0xc1f7('0x3')](_0x2cf896,_0x54f595);};}exports['register']=function(_0x507c46){for(var _0x50e72b=0x0,_0x38416f=events[_0xc1f7('0x4')];_0x50e72b<_0x38416f;_0x50e72b++){var _0x3a2861=events[_0x50e72b];var _0x224d30=createListener(_0xc1f7('0x5')+_0x3a2861,_0x507c46);UserProfileEvents['on'](_0x3a2861,_0x224d30);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index cea9741..055aa36 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 _0x2a23=['update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','put'];(function(_0x1c2482,_0x29e23f){var _0x268ab7=function(_0x200383){while(--_0x200383){_0x1c2482['push'](_0x1c2482['shift']());}};_0x268ab7(++_0x29e23f);}(_0x2a23,0x1be));var _0x32a2=function(_0x40e5ee,_0x494688){_0x40e5ee=_0x40e5ee-0x0;var _0x1d481a=_0x2a23[_0x40e5ee];return _0x1d481a;};'use strict';var multer=require(_0x32a2('0x0'));var util=require(_0x32a2('0x1'));var path=require(_0x32a2('0x2'));var timeout=require(_0x32a2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x32a2('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x32a2('0x5'));router[_0x32a2('0x6')]('/',auth['isAuthenticated'](),controller[_0x32a2('0x7')]);router['get'](_0x32a2('0x8'),auth[_0x32a2('0x9')](),controller[_0x32a2('0xa')]);router[_0x32a2('0x6')](_0x32a2('0xb'),auth[_0x32a2('0x9')](),controller['show']);router['post']('/',auth[_0x32a2('0x9')](),controller['create']);router[_0x32a2('0xc')](_0x32a2('0xb'),auth['isAuthenticated'](),controller[_0x32a2('0xd')]);router[_0x32a2('0xe')](_0x32a2('0xb'),auth[_0x32a2('0x9')](),controller[_0x32a2('0xf')]);module[_0x32a2('0x10')]=router; \ No newline at end of file +var _0xfe80=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get'];(function(_0x58f41b,_0x5b3ab2){var _0xf15bb=function(_0x1ef7c1){while(--_0x1ef7c1){_0x58f41b['push'](_0x58f41b['shift']());}};_0xf15bb(++_0x5b3ab2);}(_0xfe80,0xbf));var _0x0fe8=function(_0xfbd146,_0x3b21d1){_0xfbd146=_0xfbd146-0x0;var _0x12e100=_0xfe80[_0xfbd146];return _0x12e100;};'use strict';var multer=require(_0x0fe8('0x0'));var util=require('util');var path=require(_0x0fe8('0x1'));var timeout=require(_0x0fe8('0x2'));var express=require(_0x0fe8('0x3'));var router=express[_0x0fe8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0fe8('0x5'));var interaction=require(_0x0fe8('0x6'));var config=require('../../config/environment');var controller=require(_0x0fe8('0x7'));router[_0x0fe8('0x8')]('/',auth[_0x0fe8('0x9')](),controller[_0x0fe8('0xa')]);router[_0x0fe8('0x8')](_0x0fe8('0xb'),auth[_0x0fe8('0x9')](),controller[_0x0fe8('0xc')]);router[_0x0fe8('0x8')](_0x0fe8('0xd'),auth[_0x0fe8('0x9')](),controller[_0x0fe8('0xe')]);router[_0x0fe8('0xf')]('/',auth[_0x0fe8('0x9')](),controller[_0x0fe8('0x10')]);router[_0x0fe8('0x11')](_0x0fe8('0xd'),auth[_0x0fe8('0x9')](),controller['update']);router[_0x0fe8('0x12')](_0x0fe8('0xd'),auth['isAuthenticated'](),controller[_0x0fe8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 19cb0d4..623d5a3 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 _0x9ee7=['INTEGER','sequelize','STRING'];(function(_0x78da55,_0xd7609f){var _0x238afb=function(_0x4a6339){while(--_0x4a6339){_0x78da55['push'](_0x78da55['shift']());}};_0x238afb(++_0xd7609f);}(_0x9ee7,0x142));var _0x79ee=function(_0x4da19e,_0x2a76fb){_0x4da19e=_0x4da19e-0x0;var _0x4ededc=_0x9ee7[_0x4da19e];return _0x4ededc;};'use strict';var Sequelize=require(_0x79ee('0x0'));module['exports']={'name':{'type':Sequelize[_0x79ee('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x79ee('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x79ee('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8efe=['STRING','sequelize','INTEGER'];(function(_0x3b6f58,_0x5870de){var _0x987c61=function(_0x3a9281){while(--_0x3a9281){_0x3b6f58['push'](_0x3b6f58['shift']());}};_0x987c61(++_0x5870de);}(_0x8efe,0x13c));var _0xe8ef=function(_0x553c09,_0x580878){_0x553c09=_0x553c09-0x0;var _0x31d32c=_0x8efe[_0x553c09];return _0x31d32c;};'use strict';var Sequelize=require(_0xe8ef('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe8ef('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe8ef('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 5e657c1..8b211b7 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 _0xafc4=['update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','UserProfileResource','includeAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x116fe8,_0x28d5b6){var _0x5b9f9e=function(_0x34c46c){while(--_0x34c46c){_0x116fe8['push'](_0x116fe8['shift']());}};_0x5b9f9e(++_0x28d5b6);}(_0xafc4,0x69));var _0x4afc=function(_0x4910e1,_0x147dce){_0x4910e1=_0x4910e1-0x0;var _0x4129fb=_0xafc4[_0x4910e1];return _0x4129fb;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['UserProfileResource'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['UserProfileResource']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));};exports[_0x4afc('0x45')]=function(_0x3625c9,_0x387834){return db[_0x4afc('0x3d')][_0x4afc('0x45')]()[_0x4afc('0x25')](respondWithResult(_0x387834,null))[_0x4afc('0x3f')](handleError(_0x387834,null));}; \ No newline at end of file +var _0xf61e=['where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','update','body','params','describe','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','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','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','UserProfileResource','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order'];(function(_0x5805cb,_0x476664){var _0x3f5888=function(_0x1e3fdf){while(--_0x1e3fdf){_0x5805cb['push'](_0x5805cb['shift']());}};_0x3f5888(++_0x476664);}(_0xf61e,0x191));var _0xef61=function(_0x38c30d,_0x11985e){_0x38c30d=_0x38c30d-0x0;var _0x45a0b5=_0xf61e[_0x38c30d];return _0x45a0b5;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['UserProfileResource']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')](_0x5e614b['body'],{})[_0xef61('0x28')](respondWithResult(_0x47b09d,0xc9))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x2904e0,_0x13bb20){if(_0x2904e0[_0xef61('0x4a')]['id']){delete _0x2904e0[_0xef61('0x4a')]['id'];}return db['UserProfileResource'][_0xef61('0x47')]({'where':{'id':_0x2904e0['params']['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x13bb20,null))[_0xef61('0x28')](saveUpdates(_0x2904e0[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x13bb20,null))[_0xef61('0x45')](handleError(_0x13bb20,null));};exports[_0xef61('0x27')]=function(_0x3e23eb,_0x1565c7){return db[_0xef61('0x30')]['find']({'where':{'id':_0x3e23eb[_0xef61('0x4b')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x1565c7,null))['then'](removeEntity(_0x1565c7,null))['catch'](handleError(_0x1565c7,null));};exports[_0xef61('0x4c')]=function(_0x1ce127,_0x504389){return db[_0xef61('0x30')]['describe']()[_0xef61('0x28')](respondWithResult(_0x504389,null))[_0xef61('0x45')](handleError(_0x504389,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 01f105f..9c3fa2e 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 _0xd6d7=['define','compositeIndex','resourceId','sectionId','lodash','moment','bluebird','request-promise','path','rimraf','./userProfileResource.attributes'];(function(_0x17150a,_0x2a08ae){var _0x32451a=function(_0x2458e8){while(--_0x2458e8){_0x17150a['push'](_0x17150a['shift']());}};_0x32451a(++_0x2a08ae);}(_0xd6d7,0x138));var _0x7d6d=function(_0x42df8f,_0x4e5dd2){_0x42df8f=_0x42df8f-0x0;var _0x2af7f3=_0xd6d7[_0x42df8f];return _0x2af7f3;};'use strict';var _=require(_0x7d6d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7d6d('0x1'));var BPromise=require(_0x7d6d('0x2'));var rp=require(_0x7d6d('0x3'));var fs=require('fs');var path=require(_0x7d6d('0x4'));var rimraf=require(_0x7d6d('0x5'));var config=require('../../config/environment');var attributes=require(_0x7d6d('0x6'));module['exports']=function(_0x20d7a2,_0x1ad50f){return _0x20d7a2[_0x7d6d('0x7')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x7d6d('0x8'),'fields':[_0x7d6d('0x9'),_0x7d6d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2804=['define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./userProfileResource.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2804,0x1b6));var _0x4280=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2804[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x4280('0x0'));var util=require(_0x4280('0x1'));var logger=require(_0x4280('0x2'))(_0x4280('0x3'));var moment=require('moment');var BPromise=require(_0x4280('0x4'));var rp=require(_0x4280('0x5'));var fs=require('fs');var path=require(_0x4280('0x6'));var rimraf=require(_0x4280('0x7'));var config=require('../../config/environment');var attributes=require(_0x4280('0x8'));module[_0x4280('0x9')]=function(_0x47635e,_0x126438){return _0x47635e[_0x4280('0xa')](_0x4280('0xb'),attributes,{'tableName':_0x4280('0xc'),'paranoid':![],'indexes':[{'name':_0x4280('0xd'),'fields':[_0x4280('0xe'),_0x4280('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index e5cc0c5..21060bd 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 _0x7232=['jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2e10b1,_0x845b82){var _0x41de8b=function(_0x3cad6d){while(--_0x3cad6d){_0x2e10b1['push'](_0x2e10b1['shift']());}};_0x41de8b(++_0x845b82);}(_0x7232,0x151));var _0x2723=function(_0x101ed0,_0x1d4893){_0x101ed0=_0x101ed0-0x0;var _0x26d33c=_0x7232[_0x101ed0];return _0x26d33c;};'use strict';var _=require(_0x2723('0x0'));var util=require(_0x2723('0x1'));var moment=require(_0x2723('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2723('0x3'));var db=require(_0x2723('0x4'))['db'];var utils=require(_0x2723('0x5'));var logger=require(_0x2723('0x6'))('rpc');var config=require(_0x2723('0x7'));var jayson=require(_0x2723('0x8'));var client=jayson['client'][_0x2723('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eafbb,_0x2860c8,_0x300d75){return new BPromise(function(_0x3b1dcb,_0x2950f5){return client[_0x2723('0xa')](_0x2eafbb,_0x300d75)[_0x2723('0xb')](function(_0x506035){logger[_0x2723('0xc')](_0x2723('0xd'),_0x2860c8,_0x2723('0xe'));logger[_0x2723('0xf')](_0x2723('0x10'),_0x2860c8,_0x2723('0xe'),JSON[_0x2723('0x11')](_0x506035));if(_0x506035[_0x2723('0x12')]){if(_0x506035[_0x2723('0x12')][_0x2723('0x13')]===0x1f4){logger[_0x2723('0x12')](_0x2723('0xd'),_0x2860c8,_0x506035[_0x2723('0x12')][_0x2723('0x14')]);return _0x2950f5(_0x506035[_0x2723('0x12')][_0x2723('0x14')]);}logger[_0x2723('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x2860c8,_0x506035[_0x2723('0x12')][_0x2723('0x14')]);return _0x3b1dcb(_0x506035['error']['message']);}else{logger[_0x2723('0xc')](_0x2723('0xd'),_0x2860c8,_0x2723('0xe'));_0x3b1dcb(_0x506035[_0x2723('0x15')][_0x2723('0x14')]);}})[_0x2723('0x16')](function(_0x1b62e1){logger[_0x2723('0x12')](_0x2723('0xd'),_0x2860c8,_0x1b62e1);_0x2950f5(_0x1b62e1);});});} \ No newline at end of file +var _0xa5bd=['jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0xa5bd,0x134));var _0xda5b=function(_0x14691c,_0xe1c878){_0x14691c=_0x14691c-0x0;var _0xbec98=_0xa5bd[_0x14691c];return _0xbec98;};'use strict';var _=require('lodash');var util=require(_0xda5b('0x0'));var moment=require(_0xda5b('0x1'));var BPromise=require(_0xda5b('0x2'));var rs=require(_0xda5b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda5b('0x4'))['db'];var utils=require(_0xda5b('0x5'));var logger=require(_0xda5b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xda5b('0x7'));var client=jayson[_0xda5b('0x8')][_0xda5b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9c6975,_0x5b372b,_0x514362){return new BPromise(function(_0x551a10,_0x693a6c){return client[_0xda5b('0xa')](_0x9c6975,_0x514362)[_0xda5b('0xb')](function(_0xdd7b61){logger[_0xda5b('0xc')](_0xda5b('0xd'),_0x5b372b,'request\x20sent');logger[_0xda5b('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x5b372b,_0xda5b('0xf'),JSON[_0xda5b('0x10')](_0xdd7b61));if(_0xdd7b61['error']){if(_0xdd7b61[_0xda5b('0x11')][_0xda5b('0x12')]===0x1f4){logger[_0xda5b('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x5b372b,_0xdd7b61[_0xda5b('0x11')][_0xda5b('0x13')]);return _0x693a6c(_0xdd7b61[_0xda5b('0x11')]['message']);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x5b372b,_0xdd7b61[_0xda5b('0x11')]['message']);return _0x551a10(_0xdd7b61['error']['message']);}else{logger[_0xda5b('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x5b372b,_0xda5b('0xf'));_0x551a10(_0xdd7b61['result']['message']);}})[_0xda5b('0x14')](function(_0x270dd5){logger[_0xda5b('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x5b372b,_0x270dd5);_0x693a6c(_0x270dd5);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index e4371a3..0079278 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 _0xea9e=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create','put','delete','destroy','exports'];(function(_0x719236,_0x3615f8){var _0x3ae92d=function(_0x539f7a){while(--_0x539f7a){_0x719236['push'](_0x719236['shift']());}};_0x3ae92d(++_0x3615f8);}(_0xea9e,0x1a2));var _0xeea9=function(_0x478ff7,_0x771e3a){_0x478ff7=_0x478ff7-0x0;var _0x3d995d=_0xea9e[_0x478ff7];return _0x3d995d;};'use strict';var multer=require(_0xeea9('0x0'));var util=require(_0xeea9('0x1'));var path=require(_0xeea9('0x2'));var timeout=require(_0xeea9('0x3'));var express=require(_0xeea9('0x4'));var router=express[_0xeea9('0x5')]();var fs_extra=require(_0xeea9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xeea9('0x7'));var config=require(_0xeea9('0x8'));var controller=require(_0xeea9('0x9'));router[_0xeea9('0xa')]('/',auth['isAuthenticated'](),controller[_0xeea9('0xb')]);router['get'](_0xeea9('0xc'),auth['isAuthenticated'](),controller[_0xeea9('0xd')]);router[_0xeea9('0xa')](_0xeea9('0xe'),auth[_0xeea9('0xf')](),controller['show']);router[_0xeea9('0x10')]('/',auth[_0xeea9('0xf')](),controller[_0xeea9('0x11')]);router[_0xeea9('0x12')]('/:id',auth[_0xeea9('0xf')](),controller['update']);router[_0xeea9('0x13')](_0xeea9('0xe'),auth['isAuthenticated'](),controller[_0xeea9('0x14')]);module[_0xeea9('0x15')]=router; \ No newline at end of file +var _0xedd2=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x144234,_0x1bf575){var _0x231101=function(_0x13c209){while(--_0x13c209){_0x144234['push'](_0x144234['shift']());}};_0x231101(++_0x1bf575);}(_0xedd2,0xa5));var _0x2edd=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xedd2[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require(_0x2edd('0x0'));var path=require('path');var timeout=require(_0x2edd('0x1'));var express=require('express');var router=express[_0x2edd('0x2')]();var fs_extra=require(_0x2edd('0x3'));var auth=require(_0x2edd('0x4'));var interaction=require(_0x2edd('0x5'));var config=require(_0x2edd('0x6'));var controller=require('./userProfileSection.controller');router[_0x2edd('0x7')]('/',auth[_0x2edd('0x8')](),controller[_0x2edd('0x9')]);router['get'](_0x2edd('0xa'),auth[_0x2edd('0x8')](),controller[_0x2edd('0xb')]);router[_0x2edd('0x7')](_0x2edd('0xc'),auth['isAuthenticated'](),controller[_0x2edd('0xd')]);router[_0x2edd('0xe')]('/',auth['isAuthenticated'](),controller[_0x2edd('0xf')]);router['put'](_0x2edd('0xc'),auth[_0x2edd('0x8')](),controller[_0x2edd('0x10')]);router[_0x2edd('0x11')](_0x2edd('0xc'),auth[_0x2edd('0x8')](),controller[_0x2edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 2d37bf9..21466bc 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 _0x14a0=['INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x325f6a,_0x26d98c){var _0x5a5fd5=function(_0x38b3bb){while(--_0x38b3bb){_0x325f6a['push'](_0x325f6a['shift']());}};_0x5a5fd5(++_0x26d98c);}(_0x14a0,0x8e));var _0x014a=function(_0x1b617a,_0x5ec7ed){_0x1b617a=_0x1b617a-0x0;var _0x3a6d8a=_0x14a0[_0x1b617a];return _0x3a6d8a;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'name':{'type':Sequelize[_0x014a('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x014a('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x014a('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x014a('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x014a('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x014a('0x1')],'set':function(_0x521a59){this['setDataValue'](_0x014a('0x4'),_0x521a59?_0x521a59[_0x014a('0x5')](''):[]);},'get':function(){return this[_0x014a('0x6')]('crudPermissions')?this['getDataValue'](_0x014a('0x4'))[_0x014a('0x7')](''):[];}}}; \ No newline at end of file +var _0x373d=['STRING','INTEGER','BOOLEAN','setDataValue','getDataValue','crudPermissions','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x373d,0x1e2));var _0xd373=function(_0x3a0585,_0x12062b){_0x3a0585=_0x3a0585-0x0;var _0xbdc3fc=_0x373d[_0x3a0585];return _0xbdc3fc;};'use strict';var Sequelize=require(_0xd373('0x0'));module['exports']={'name':{'type':Sequelize[_0xd373('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xd373('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd373('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd373('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd373('0x1')],'set':function(_0x547fca){this[_0xd373('0x4')]('crudPermissions',_0x547fca?_0x547fca['join'](''):[]);},'get':function(){return this[_0xd373('0x5')](_0xd373('0x6'))?this[_0xd373('0x5')](_0xd373('0x6'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 1f311d1..be70037 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 _0x6030=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','intersection','model','query','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','show','keys','includeAll','catch','body','find','params','describe','eml-format'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x6030,0x1f0));var _0x0603=function(_0x5c2b71,_0x536489){_0x5c2b71=_0x5c2b71-0x0;var _0x327870=_0x6030[_0x5c2b71];return _0x327870;};'use strict';var emlformat=require(_0x0603('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0603('0x1'));var jsonpatch=require(_0x0603('0x2'));var rp=require(_0x0603('0x3'));var moment=require(_0x0603('0x4'));var BPromise=require(_0x0603('0x5'));var Mustache=require(_0x0603('0x6'));var util=require(_0x0603('0x7'));var path=require(_0x0603('0x8'));var sox=require(_0x0603('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0603('0xa'));var _=require('lodash');var squel=require(_0x0603('0xb'));var crypto=require('crypto');var jsforce=require(_0x0603('0xc'));var deskjs=require(_0x0603('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0603('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0603('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0603('0x10'));var hardwareService=require(_0x0603('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x0603('0x12'));var config=require(_0x0603('0x13'));var licenseUtil=require(_0x0603('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb489dd,_0x5a6539){_0x5a6539=_0x5a6539||0xcc;return function(_0x1dac31){if(_0x1dac31){return _0xb489dd[_0x0603('0x15')](_0x5a6539);}return _0xb489dd['status'](_0x5a6539)[_0x0603('0x16')]();};}function respondWithResult(_0x251d8b,_0x5d411c){_0x5d411c=_0x5d411c||0xc8;return function(_0x5953b4){if(_0x5953b4){return _0x251d8b[_0x0603('0x17')](_0x5d411c)['json'](_0x5953b4);}};}function respondWithFilteredResult(_0x87accd,_0x5cdbf0){return function(_0x1683d4){if(_0x1683d4){var _0x33e17f=typeof _0x5cdbf0[_0x0603('0x18')]==='undefined'&&typeof _0x5cdbf0[_0x0603('0x19')]==='undefined';var _0x1c1cfe=_0x1683d4[_0x0603('0x1a')];var _0x5a8f95=_0x33e17f?0x0:_0x5cdbf0[_0x0603('0x18')];var _0x12f4a8=_0x33e17f?_0x1683d4[_0x0603('0x1a')]:_0x5cdbf0[_0x0603('0x18')]+_0x5cdbf0[_0x0603('0x19')];var _0x4b97d9;if(_0x12f4a8>=_0x1c1cfe){_0x12f4a8=_0x1c1cfe;_0x4b97d9=0xc8;}else{_0x4b97d9=0xce;}_0x87accd['status'](_0x4b97d9);return _0x87accd['set'](_0x0603('0x1b'),_0x5a8f95+'-'+_0x12f4a8+'/'+_0x1c1cfe)[_0x0603('0x1c')](_0x1683d4);}return null;};}function patchUpdates(_0x553e92){return function(_0x56341e){try{jsonpatch[_0x0603('0x1d')](_0x56341e,_0x553e92,!![]);}catch(_0x18d070){return BPromise[_0x0603('0x1e')](_0x18d070);}return _0x56341e[_0x0603('0x1f')]();};}function saveUpdates(_0x13c647,_0xc77313){return function(_0x5d75d7){if(_0x5d75d7){return _0x5d75d7[_0x0603('0x20')](_0x13c647)[_0x0603('0x21')](function(_0x326de6){return _0x326de6;});}return null;};}function removeEntity(_0x457462,_0x3e7364){return function(_0x122757){if(_0x122757){return _0x122757[_0x0603('0x22')]()[_0x0603('0x21')](function(){_0x457462[_0x0603('0x17')](0xcc)[_0x0603('0x16')]();});}};}function handleEntityNotFound(_0x15d5dc,_0x695cde){return function(_0xaf72cf){if(!_0xaf72cf){_0x15d5dc[_0x0603('0x15')](0x194);}return _0xaf72cf;};}function handleError(_0x382f4a,_0x248c75){_0x248c75=_0x248c75||0x1f4;return function(_0xd3d10){logger[_0x0603('0x23')](_0xd3d10[_0x0603('0x24')]);if(_0xd3d10[_0x0603('0x25')]){delete _0xd3d10[_0x0603('0x25')];}_0x382f4a[_0x0603('0x17')](_0x248c75)[_0x0603('0x26')](_0xd3d10);};}exports[_0x0603('0x27')]=function(_0x479654,_0x2a423f){var _0x1c6f5d={},_0x28a503={},_0x1fa14f={'count':0x0,'rows':[]};var _0x71b9a9=_[_0x0603('0x28')](db[_0x0603('0x29')][_0x0603('0x2a')],function(_0x3e4252){return{'name':_0x3e4252[_0x0603('0x2b')],'type':_0x3e4252[_0x0603('0x2c')][_0x0603('0x2d')]};});_0x28a503['model']=_['map'](_0x71b9a9,_0x0603('0x25'));_0x28a503['query']=_['keys'](_0x479654['query']);_0x28a503['filters']=_[_0x0603('0x2e')](_0x28a503[_0x0603('0x2f')],_0x28a503[_0x0603('0x30')]);_0x1c6f5d[_0x0603('0x31')]=_['intersection'](_0x28a503['model'],qs['fields'](_0x479654[_0x0603('0x30')][_0x0603('0x32')]));_0x1c6f5d[_0x0603('0x31')]=_0x1c6f5d[_0x0603('0x31')][_0x0603('0x33')]?_0x1c6f5d[_0x0603('0x31')]:_0x28a503[_0x0603('0x2f')];if(!_0x479654[_0x0603('0x30')]['hasOwnProperty'](_0x0603('0x34'))){_0x1c6f5d[_0x0603('0x19')]=qs[_0x0603('0x19')](_0x479654['query'][_0x0603('0x19')]);_0x1c6f5d[_0x0603('0x18')]=qs[_0x0603('0x18')](_0x479654[_0x0603('0x30')]['offset']);}_0x1c6f5d[_0x0603('0x35')]=qs['sort'](_0x479654[_0x0603('0x30')]['sort']);_0x1c6f5d[_0x0603('0x36')]=qs[_0x0603('0x37')](_[_0x0603('0x38')](_0x479654['query'],_0x28a503[_0x0603('0x37')]),_0x71b9a9);if(_0x479654[_0x0603('0x30')][_0x0603('0x39')]){_0x1c6f5d[_0x0603('0x36')]=_[_0x0603('0x3a')](_0x1c6f5d[_0x0603('0x36')],{'$or':_['map'](_0x71b9a9,function(_0x4e1a49){if(_0x4e1a49[_0x0603('0x2c')]!==_0x0603('0x3b')){var _0x4ece12={};_0x4ece12[_0x4e1a49['name']]={'$like':'%'+_0x479654[_0x0603('0x30')][_0x0603('0x39')]+'%'};return _0x4ece12;}})});}_0x1c6f5d=_['merge']({},_0x1c6f5d,_0x479654[_0x0603('0x3c')]);var _0x5951f5={'where':_0x1c6f5d[_0x0603('0x36')]};return db[_0x0603('0x29')]['count'](_0x5951f5)['then'](function(_0x3d6108){_0x1fa14f[_0x0603('0x1a')]=_0x3d6108;if(_0x479654['query']['includeAll']){_0x1c6f5d['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x0603('0x3d')](_0x1c6f5d);})[_0x0603('0x21')](function(_0x503f27){_0x1fa14f[_0x0603('0x3e')]=_0x503f27;return _0x1fa14f;})[_0x0603('0x21')](respondWithFilteredResult(_0x2a423f,_0x1c6f5d))['catch'](handleError(_0x2a423f,null));};exports[_0x0603('0x3f')]=function(_0x190f6d,_0x15d183){var _0x3b95de={'raw':![],'where':{'id':_0x190f6d['params']['id']}},_0x5d5cc0={};_0x5d5cc0['model']=_[_0x0603('0x40')](db['UserProfileSection'][_0x0603('0x2a')]);_0x5d5cc0[_0x0603('0x30')]=_['keys'](_0x190f6d[_0x0603('0x30')]);_0x5d5cc0[_0x0603('0x37')]=_[_0x0603('0x2e')](_0x5d5cc0[_0x0603('0x2f')],_0x5d5cc0[_0x0603('0x30')]);_0x3b95de[_0x0603('0x31')]=_[_0x0603('0x2e')](_0x5d5cc0[_0x0603('0x2f')],qs['fields'](_0x190f6d[_0x0603('0x30')]['fields']));_0x3b95de[_0x0603('0x31')]=_0x3b95de['attributes']['length']?_0x3b95de[_0x0603('0x31')]:_0x5d5cc0[_0x0603('0x2f')];if(_0x190f6d[_0x0603('0x30')][_0x0603('0x41')]){_0x3b95de['include']=[{'all':!![]}];}_0x3b95de=_[_0x0603('0x3a')]({},_0x3b95de,_0x190f6d[_0x0603('0x3c')]);return db[_0x0603('0x29')]['find'](_0x3b95de)[_0x0603('0x21')](handleEntityNotFound(_0x15d183,null))[_0x0603('0x21')](respondWithResult(_0x15d183,null))[_0x0603('0x42')](handleError(_0x15d183,null));};exports['create']=function(_0x1c3b3e,_0x1c9297){return db[_0x0603('0x29')]['create'](_0x1c3b3e['body'],{})[_0x0603('0x21')](respondWithResult(_0x1c9297,0xc9))['catch'](handleError(_0x1c9297,null));};exports[_0x0603('0x20')]=function(_0x1a372b,_0x372950){if(_0x1a372b[_0x0603('0x43')]['id']){delete _0x1a372b[_0x0603('0x43')]['id'];}return db[_0x0603('0x29')][_0x0603('0x44')]({'where':{'id':_0x1a372b[_0x0603('0x45')]['id']}})[_0x0603('0x21')](handleEntityNotFound(_0x372950,null))[_0x0603('0x21')](saveUpdates(_0x1a372b['body'],null))[_0x0603('0x21')](respondWithResult(_0x372950,null))[_0x0603('0x42')](handleError(_0x372950,null));};exports['destroy']=function(_0x20af69,_0x3dc7a0){return db[_0x0603('0x29')][_0x0603('0x44')]({'where':{'id':_0x20af69[_0x0603('0x45')]['id']}})[_0x0603('0x21')](handleEntityNotFound(_0x3dc7a0,null))[_0x0603('0x21')](removeEntity(_0x3dc7a0,null))['catch'](handleError(_0x3dc7a0,null));};exports[_0x0603('0x46')]=function(_0x3f02be,_0x1efae0){return db['UserProfileSection'][_0x0603('0x46')]()[_0x0603('0x21')](respondWithResult(_0x1efae0,null))[_0x0603('0x42')](handleError(_0x1efae0,null));}; \ No newline at end of file +var _0xbcb1=['options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','pick','merge','map','type','VIRTUAL','filter'];(function(_0x5a80ef,_0x46af15){var _0x3b7e1f=function(_0x5c8b31){while(--_0x5c8b31){_0x5a80ef['push'](_0x5a80ef['shift']());}};_0x3b7e1f(++_0x46af15);}(_0xbcb1,0x1d9));var _0x1bcb=function(_0xec306d,_0x2c44af){_0xec306d=_0xec306d-0x0;var _0x4fd78a=_0xbcb1[_0xec306d];return _0x4fd78a;};'use strict';var emlformat=require(_0x1bcb('0x0'));var rimraf=require(_0x1bcb('0x1'));var zipdir=require(_0x1bcb('0x2'));var jsonpatch=require(_0x1bcb('0x3'));var rp=require(_0x1bcb('0x4'));var moment=require(_0x1bcb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1bcb('0x6'));var util=require(_0x1bcb('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1bcb('0x8'));var ejs=require(_0x1bcb('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1bcb('0xa'));var jsforce=require(_0x1bcb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1bcb('0x8'));var querystring=require('querystring');var Papa=require(_0x1bcb('0xc'));var Redis=require(_0x1bcb('0xd'));var authService=require(_0x1bcb('0xe'));var qs=require(_0x1bcb('0xf'));var as=require(_0x1bcb('0x10'));var hardwareService=require(_0x1bcb('0x11'));var logger=require(_0x1bcb('0x12'))(_0x1bcb('0x13'));var utils=require(_0x1bcb('0x14'));var config=require(_0x1bcb('0x15'));var licenseUtil=require(_0x1bcb('0x16'));var db=require(_0x1bcb('0x17'))['db'];function respondWithStatusCode(_0x4f41f7,_0x483784){_0x483784=_0x483784||0xcc;return function(_0x22496e){if(_0x22496e){return _0x4f41f7[_0x1bcb('0x18')](_0x483784);}return _0x4f41f7[_0x1bcb('0x19')](_0x483784)['end']();};}function respondWithResult(_0x1f185b,_0x45b146){_0x45b146=_0x45b146||0xc8;return function(_0x3036bc){if(_0x3036bc){return _0x1f185b[_0x1bcb('0x19')](_0x45b146)[_0x1bcb('0x1a')](_0x3036bc);}};}function respondWithFilteredResult(_0x2e6ff5,_0xdd04fe){return function(_0x1abac9){if(_0x1abac9){var _0x36e278=typeof _0xdd04fe['offset']===_0x1bcb('0x1b')&&typeof _0xdd04fe[_0x1bcb('0x1c')]===_0x1bcb('0x1b');var _0x58260b=_0x1abac9[_0x1bcb('0x1d')];var _0x4c29db=_0x36e278?0x0:_0xdd04fe['offset'];var _0x96e5cf=_0x36e278?_0x1abac9['count']:_0xdd04fe['offset']+_0xdd04fe[_0x1bcb('0x1c')];var _0x3c7228;if(_0x96e5cf>=_0x58260b){_0x96e5cf=_0x58260b;_0x3c7228=0xc8;}else{_0x3c7228=0xce;}_0x2e6ff5[_0x1bcb('0x19')](_0x3c7228);return _0x2e6ff5[_0x1bcb('0x1e')](_0x1bcb('0x1f'),_0x4c29db+'-'+_0x96e5cf+'/'+_0x58260b)[_0x1bcb('0x1a')](_0x1abac9);}return null;};}function patchUpdates(_0x941fd3){return function(_0x5b07f9){try{jsonpatch[_0x1bcb('0x20')](_0x5b07f9,_0x941fd3,!![]);}catch(_0x39f466){return BPromise[_0x1bcb('0x21')](_0x39f466);}return _0x5b07f9['save']();};}function saveUpdates(_0x4b04ac,_0x4a6f0d){return function(_0x12b7be){if(_0x12b7be){return _0x12b7be[_0x1bcb('0x22')](_0x4b04ac)[_0x1bcb('0x23')](function(_0x3654fe){return _0x3654fe;});}return null;};}function removeEntity(_0x39b1a7,_0x4e8820){return function(_0x45dfdf){if(_0x45dfdf){return _0x45dfdf[_0x1bcb('0x24')]()[_0x1bcb('0x23')](function(){_0x39b1a7[_0x1bcb('0x19')](0xcc)[_0x1bcb('0x25')]();});}};}function handleEntityNotFound(_0xe41470,_0x543c8d){return function(_0x940cc8){if(!_0x940cc8){_0xe41470['sendStatus'](0x194);}return _0x940cc8;};}function handleError(_0xacd4f2,_0x1a9bdd){_0x1a9bdd=_0x1a9bdd||0x1f4;return function(_0x2e14e5){logger[_0x1bcb('0x26')](_0x2e14e5[_0x1bcb('0x27')]);if(_0x2e14e5['name']){delete _0x2e14e5[_0x1bcb('0x28')];}_0xacd4f2[_0x1bcb('0x19')](_0x1a9bdd)[_0x1bcb('0x29')](_0x2e14e5);};}exports[_0x1bcb('0x2a')]=function(_0x6613dc,_0x11dde5){var _0x5dab26={},_0x163545={},_0x4f5794={'count':0x0,'rows':[]};var _0x743480=_['map'](db[_0x1bcb('0x2b')][_0x1bcb('0x2c')],function(_0x1eda22){return{'name':_0x1eda22[_0x1bcb('0x2d')],'type':_0x1eda22['type'][_0x1bcb('0x2e')]};});_0x163545['model']=_['map'](_0x743480,_0x1bcb('0x28'));_0x163545['query']=_[_0x1bcb('0x2f')](_0x6613dc[_0x1bcb('0x30')]);_0x163545[_0x1bcb('0x31')]=_['intersection'](_0x163545[_0x1bcb('0x32')],_0x163545[_0x1bcb('0x30')]);_0x5dab26[_0x1bcb('0x33')]=_[_0x1bcb('0x34')](_0x163545[_0x1bcb('0x32')],qs[_0x1bcb('0x35')](_0x6613dc[_0x1bcb('0x30')][_0x1bcb('0x35')]));_0x5dab26[_0x1bcb('0x33')]=_0x5dab26[_0x1bcb('0x33')][_0x1bcb('0x36')]?_0x5dab26[_0x1bcb('0x33')]:_0x163545[_0x1bcb('0x32')];if(!_0x6613dc[_0x1bcb('0x30')][_0x1bcb('0x37')]('nolimit')){_0x5dab26[_0x1bcb('0x1c')]=qs[_0x1bcb('0x1c')](_0x6613dc[_0x1bcb('0x30')]['limit']);_0x5dab26[_0x1bcb('0x38')]=qs[_0x1bcb('0x38')](_0x6613dc[_0x1bcb('0x30')][_0x1bcb('0x38')]);}_0x5dab26[_0x1bcb('0x39')]=qs['sort'](_0x6613dc[_0x1bcb('0x30')][_0x1bcb('0x3a')]);_0x5dab26[_0x1bcb('0x3b')]=qs[_0x1bcb('0x31')](_[_0x1bcb('0x3c')](_0x6613dc[_0x1bcb('0x30')],_0x163545[_0x1bcb('0x31')]),_0x743480);if(_0x6613dc[_0x1bcb('0x30')]['filter']){_0x5dab26[_0x1bcb('0x3b')]=_[_0x1bcb('0x3d')](_0x5dab26[_0x1bcb('0x3b')],{'$or':_[_0x1bcb('0x3e')](_0x743480,function(_0x5bab04){if(_0x5bab04[_0x1bcb('0x3f')]!==_0x1bcb('0x40')){var _0x58568f={};_0x58568f[_0x5bab04[_0x1bcb('0x28')]]={'$like':'%'+_0x6613dc[_0x1bcb('0x30')][_0x1bcb('0x41')]+'%'};return _0x58568f;}})});}_0x5dab26=_[_0x1bcb('0x3d')]({},_0x5dab26,_0x6613dc[_0x1bcb('0x42')]);var _0x373b87={'where':_0x5dab26[_0x1bcb('0x3b')]};return db[_0x1bcb('0x2b')][_0x1bcb('0x1d')](_0x373b87)['then'](function(_0x33bd6a){_0x4f5794[_0x1bcb('0x1d')]=_0x33bd6a;if(_0x6613dc[_0x1bcb('0x30')][_0x1bcb('0x43')]){_0x5dab26[_0x1bcb('0x44')]=[{'all':!![]}];}return db[_0x1bcb('0x2b')][_0x1bcb('0x45')](_0x5dab26);})[_0x1bcb('0x23')](function(_0x2615ad){_0x4f5794[_0x1bcb('0x46')]=_0x2615ad;return _0x4f5794;})[_0x1bcb('0x23')](respondWithFilteredResult(_0x11dde5,_0x5dab26))[_0x1bcb('0x47')](handleError(_0x11dde5,null));};exports['show']=function(_0x239565,_0x5c599d){var _0x22d10f={'raw':![],'where':{'id':_0x239565[_0x1bcb('0x48')]['id']}},_0x2f9b1c={};_0x2f9b1c[_0x1bcb('0x32')]=_[_0x1bcb('0x2f')](db['UserProfileSection'][_0x1bcb('0x2c')]);_0x2f9b1c[_0x1bcb('0x30')]=_['keys'](_0x239565['query']);_0x2f9b1c[_0x1bcb('0x31')]=_[_0x1bcb('0x34')](_0x2f9b1c['model'],_0x2f9b1c[_0x1bcb('0x30')]);_0x22d10f[_0x1bcb('0x33')]=_[_0x1bcb('0x34')](_0x2f9b1c['model'],qs[_0x1bcb('0x35')](_0x239565['query']['fields']));_0x22d10f[_0x1bcb('0x33')]=_0x22d10f[_0x1bcb('0x33')][_0x1bcb('0x36')]?_0x22d10f[_0x1bcb('0x33')]:_0x2f9b1c[_0x1bcb('0x32')];if(_0x239565[_0x1bcb('0x30')][_0x1bcb('0x43')]){_0x22d10f[_0x1bcb('0x44')]=[{'all':!![]}];}_0x22d10f=_[_0x1bcb('0x3d')]({},_0x22d10f,_0x239565[_0x1bcb('0x42')]);return db[_0x1bcb('0x2b')][_0x1bcb('0x49')](_0x22d10f)['then'](handleEntityNotFound(_0x5c599d,null))[_0x1bcb('0x23')](respondWithResult(_0x5c599d,null))[_0x1bcb('0x47')](handleError(_0x5c599d,null));};exports[_0x1bcb('0x4a')]=function(_0xd91879,_0x45756f){return db['UserProfileSection'][_0x1bcb('0x4a')](_0xd91879[_0x1bcb('0x4b')],{})[_0x1bcb('0x23')](respondWithResult(_0x45756f,0xc9))['catch'](handleError(_0x45756f,null));};exports['update']=function(_0x7fa9d5,_0x37a0ba){if(_0x7fa9d5['body']['id']){delete _0x7fa9d5['body']['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x7fa9d5[_0x1bcb('0x48')]['id']}})[_0x1bcb('0x23')](handleEntityNotFound(_0x37a0ba,null))[_0x1bcb('0x23')](saveUpdates(_0x7fa9d5[_0x1bcb('0x4b')],null))['then'](respondWithResult(_0x37a0ba,null))[_0x1bcb('0x47')](handleError(_0x37a0ba,null));};exports[_0x1bcb('0x24')]=function(_0x34d963,_0x2432a9){return db[_0x1bcb('0x2b')][_0x1bcb('0x49')]({'where':{'id':_0x34d963[_0x1bcb('0x48')]['id']}})['then'](handleEntityNotFound(_0x2432a9,null))[_0x1bcb('0x23')](removeEntity(_0x2432a9,null))['catch'](handleError(_0x2432a9,null));};exports[_0x1bcb('0x4c')]=function(_0x4fc9a6,_0x2da2dc){return db[_0x1bcb('0x2b')][_0x1bcb('0x4c')]()[_0x1bcb('0x23')](respondWithResult(_0x2da2dc,null))[_0x1bcb('0x47')](handleError(_0x2da2dc,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 51b8b0f..de6838c 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 _0x1537=['util','api','path','rimraf','./userProfileSection.attributes','exports','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash'];(function(_0x46b3af,_0x589b29){var _0x52f73d=function(_0xa53629){while(--_0xa53629){_0x46b3af['push'](_0x46b3af['shift']());}};_0x52f73d(++_0x589b29);}(_0x1537,0x83));var _0x7153=function(_0x375d91,_0x1423ac){_0x375d91=_0x375d91-0x0;var _0x5cb33a=_0x1537[_0x375d91];return _0x5cb33a;};'use strict';var _=require(_0x7153('0x0'));var util=require(_0x7153('0x1'));var logger=require('../../config/logger')(_0x7153('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7153('0x3'));var rimraf=require(_0x7153('0x4'));var config=require('../../config/environment');var attributes=require(_0x7153('0x5'));module[_0x7153('0x6')]=function(_0x19b587,_0x53f3c1){return _0x19b587['define'](_0x7153('0x7'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x7153('0x8'),'fields':[_0x7153('0x9'),_0x7153('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe5b1=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash'];(function(_0x1e0499,_0x2222ed){var _0x527766=function(_0xac41b8){while(--_0xac41b8){_0x1e0499['push'](_0x1e0499['shift']());}};_0x527766(++_0x2222ed);}(_0xe5b1,0x9f));var _0x1e5b=function(_0x435044,_0x36ab8e){_0x435044=_0x435044-0x0;var _0x33d4c6=_0xe5b1[_0x435044];return _0x33d4c6;};'use strict';var _=require(_0x1e5b('0x0'));var util=require(_0x1e5b('0x1'));var logger=require(_0x1e5b('0x2'))(_0x1e5b('0x3'));var moment=require(_0x1e5b('0x4'));var BPromise=require(_0x1e5b('0x5'));var rp=require(_0x1e5b('0x6'));var fs=require('fs');var path=require(_0x1e5b('0x7'));var rimraf=require(_0x1e5b('0x8'));var config=require(_0x1e5b('0x9'));var attributes=require(_0x1e5b('0xa'));module['exports']=function(_0xeec1c9,_0x14cf1e){return _0xeec1c9[_0x1e5b('0xb')]('UserProfileSection',attributes,{'tableName':_0x1e5b('0xc'),'paranoid':![],'indexes':[{'name':_0x1e5b('0xd'),'fields':[_0x1e5b('0xe'),_0x1e5b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 120077a..efd2cc1 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 _0xdc00=['debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','then','UserProfileSection,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc00,0xfe));var _0x0dc0=function(_0x5da2f6,_0x29e2eb){_0x5da2f6=_0x5da2f6-0x0;var _0x40471b=_0xdc00[_0x5da2f6];return _0x40471b;};'use strict';var _=require(_0x0dc0('0x0'));var util=require('util');var moment=require(_0x0dc0('0x1'));var BPromise=require(_0x0dc0('0x2'));var rs=require(_0x0dc0('0x3'));var fs=require('fs');var Redis=require(_0x0dc0('0x4'));var db=require(_0x0dc0('0x5'))['db'];var utils=require(_0x0dc0('0x6'));var logger=require(_0x0dc0('0x7'))('rpc');var config=require(_0x0dc0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e0635,_0x2a3756,_0x5f52ff){return new BPromise(function(_0x3085e2,_0x367552){return client['request'](_0x5e0635,_0x5f52ff)[_0x0dc0('0x9')](function(_0x5a38f6){logger['info'](_0x0dc0('0xa'),_0x2a3756,_0x0dc0('0xb'));logger[_0x0dc0('0xc')](_0x0dc0('0xd'),_0x2a3756,_0x0dc0('0xb'),JSON[_0x0dc0('0xe')](_0x5a38f6));if(_0x5a38f6[_0x0dc0('0xf')]){if(_0x5a38f6[_0x0dc0('0xf')][_0x0dc0('0x10')]===0x1f4){logger[_0x0dc0('0xf')](_0x0dc0('0xa'),_0x2a3756,_0x5a38f6[_0x0dc0('0xf')]['message']);return _0x367552(_0x5a38f6[_0x0dc0('0xf')][_0x0dc0('0x11')]);}logger[_0x0dc0('0xf')](_0x0dc0('0xa'),_0x2a3756,_0x5a38f6[_0x0dc0('0xf')][_0x0dc0('0x11')]);return _0x3085e2(_0x5a38f6[_0x0dc0('0xf')]['message']);}else{logger['info'](_0x0dc0('0xa'),_0x2a3756,_0x0dc0('0xb'));_0x3085e2(_0x5a38f6['result'][_0x0dc0('0x11')]);}})[_0x0dc0('0x12')](function(_0x5205b5){logger[_0x0dc0('0xf')](_0x0dc0('0xa'),_0x2a3756,_0x5205b5);_0x367552(_0x5205b5);});});} \ No newline at end of file +var _0x0260=['client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x389f1b,_0xf76fa0){var _0x506875=function(_0x4e86ca){while(--_0x4e86ca){_0x389f1b['push'](_0x389f1b['shift']());}};_0x506875(++_0xf76fa0);}(_0x0260,0x1d9));var _0x0026=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x0260[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0x0026('0x0'));var util=require(_0x0026('0x1'));var moment=require(_0x0026('0x2'));var BPromise=require(_0x0026('0x3'));var rs=require(_0x0026('0x4'));var fs=require('fs');var Redis=require(_0x0026('0x5'));var db=require(_0x0026('0x6'))['db'];var utils=require(_0x0026('0x7'));var logger=require('../../config/logger')(_0x0026('0x8'));var config=require('../../config/environment');var jayson=require(_0x0026('0x9'));var client=jayson[_0x0026('0xa')][_0x0026('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x428702,_0x3aec64,_0x3dcb86){return new BPromise(function(_0x2365fe,_0xdc3be0){return client['request'](_0x428702,_0x3dcb86)[_0x0026('0xc')](function(_0x1109a7){logger[_0x0026('0xd')](_0x0026('0xe'),_0x3aec64,_0x0026('0xf'));logger[_0x0026('0x10')](_0x0026('0x11'),_0x3aec64,_0x0026('0xf'),JSON['stringify'](_0x1109a7));if(_0x1109a7[_0x0026('0x12')]){if(_0x1109a7['error']['code']===0x1f4){logger[_0x0026('0x12')](_0x0026('0xe'),_0x3aec64,_0x1109a7['error'][_0x0026('0x13')]);return _0xdc3be0(_0x1109a7[_0x0026('0x12')][_0x0026('0x13')]);}logger['error'](_0x0026('0xe'),_0x3aec64,_0x1109a7[_0x0026('0x12')]['message']);return _0x2365fe(_0x1109a7[_0x0026('0x12')][_0x0026('0x13')]);}else{logger[_0x0026('0xd')](_0x0026('0xe'),_0x3aec64,_0x0026('0xf'));_0x2365fe(_0x1109a7['result'][_0x0026('0x13')]);}})[_0x0026('0x14')](function(_0x397a72){logger[_0x0026('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x3aec64,_0x397a72);_0xdc3be0(_0x397a72);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index b8bb1bb..11526ac 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1213ca,_0x47436f){var _0x29b347=function(_0x446301){while(--_0x446301){_0x1213ca['push'](_0x1213ca['shift']());}};_0x29b347(++_0x47436f);}(_0xe706,0xa3));var _0x6e70=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0xe706[_0x336ca2];return _0xda59a6;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3f2828,_0x1f6e57){var _0x5ee69d=function(_0x17670e){while(--_0x17670e){_0x3f2828['push'](_0x3f2828['shift']());}};_0x5ee69d(++_0x1f6e57);}(_0x70e0,0x17b));var _0x070e=function(_0x1f8343,_0x3a597e){_0x1f8343=_0x1f8343-0x0;var _0x53c5f8=_0x70e0[_0x1f8343];return _0x53c5f8;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 2a782bf..d44c261 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 _0xfdab=['exports'];(function(_0x5ee0ee,_0x3ce413){var _0x198093=function(_0x29dcc9){while(--_0x29dcc9){_0x5ee0ee['push'](_0x5ee0ee['shift']());}};_0x198093(++_0x3ce413);}(_0xfdab,0x99));var _0xbfda=function(_0x24942f,_0x475eee){_0x24942f=_0x24942f-0x0;var _0x1f0d95=_0xfdab[_0x24942f];return _0x1f0d95;};'use strict';var Sequelize=require('sequelize');module[_0xbfda('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6a13=['sequelize','exports','INTEGER'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x6a13,0x6c));var _0x36a1=function(_0x14ef81,_0x18d32b){_0x14ef81=_0x14ef81-0x0;var _0x546c2d=_0x6a13[_0x14ef81];return _0x546c2d;};'use strict';var Sequelize=require(_0x36a1('0x0'));module[_0x36a1('0x1')]={'penalty':{'type':Sequelize[_0x36a1('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index aca51bc..6d2ee42 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 _0xfc46=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger'];(function(_0x14e442,_0x36b1bd){var _0x1385e2=function(_0x2535b5){while(--_0x2535b5){_0x14e442['push'](_0x14e442['shift']());}};_0x1385e2(++_0x36b1bd);}(_0xfc46,0x9a));var _0x6fc4=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0xfc46[_0x3042c5];return _0x7cd140;};'use strict';var _=require(_0x6fc4('0x0'));var util=require('util');var logger=require(_0x6fc4('0x1'))(_0x6fc4('0x2'));var moment=require(_0x6fc4('0x3'));var BPromise=require('bluebird');var rp=require(_0x6fc4('0x4'));var fs=require('fs');var path=require(_0x6fc4('0x5'));var rimraf=require(_0x6fc4('0x6'));var config=require(_0x6fc4('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0x6fc4('0x8')]=function(_0xf57aa9,_0x3100a0){return _0xf57aa9[_0x6fc4('0x9')](_0x6fc4('0xa'),attributes,{'tableName':_0x6fc4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8fb=['lodash','util','../../config/logger','api','path','rimraf','./userSmsQueue.attributes','exports','UserSmsQueue'];(function(_0x3e87b2,_0x42f457){var _0x12e40e=function(_0x5bf813){while(--_0x5bf813){_0x3e87b2['push'](_0x3e87b2['shift']());}};_0x12e40e(++_0x42f457);}(_0xd8fb,0x99));var _0xbd8f=function(_0x44393c,_0x70fccf){_0x44393c=_0x44393c-0x0;var _0x257162=_0xd8fb[_0x44393c];return _0x257162;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 615ac44..c45afbf 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 _0xbe7c=['request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x8ae2ad,_0x5dece2){var _0xf971d3=function(_0x36b2e5){while(--_0x36b2e5){_0x8ae2ad['push'](_0x8ae2ad['shift']());}};_0xf971d3(++_0x5dece2);}(_0xbe7c,0x6e));var _0xcbe7=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbe7c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xcbe7('0x0'));var util=require(_0xcbe7('0x1'));var moment=require(_0xcbe7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbe7('0x3'));var db=require(_0xcbe7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcbe7('0x5'));var config=require(_0xcbe7('0x6'));var jayson=require(_0xcbe7('0x7'));var client=jayson[_0xcbe7('0x8')][_0xcbe7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xde5a26,_0x149e94,_0x2c337b){return new BPromise(function(_0x4a4683,_0x3af9db){return client['request'](_0xde5a26,_0x2c337b)['then'](function(_0x54e286){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x149e94,_0xcbe7('0xa'));logger[_0xcbe7('0xb')](_0xcbe7('0xc'),_0x149e94,_0xcbe7('0xa'),JSON['stringify'](_0x54e286));if(_0x54e286[_0xcbe7('0xd')]){if(_0x54e286[_0xcbe7('0xd')][_0xcbe7('0xe')]===0x1f4){logger[_0xcbe7('0xd')](_0xcbe7('0xf'),_0x149e94,_0x54e286['error'][_0xcbe7('0x10')]);return _0x3af9db(_0x54e286[_0xcbe7('0xd')][_0xcbe7('0x10')]);}logger[_0xcbe7('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x149e94,_0x54e286[_0xcbe7('0xd')][_0xcbe7('0x10')]);return _0x4a4683(_0x54e286[_0xcbe7('0xd')][_0xcbe7('0x10')]);}else{logger[_0xcbe7('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x149e94,_0xcbe7('0xa'));_0x4a4683(_0x54e286[_0xcbe7('0x12')]['message']);}})[_0xcbe7('0x13')](function(_0x2e99a2){logger[_0xcbe7('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x149e94,_0x2e99a2);_0x3af9db(_0x2e99a2);});});} \ No newline at end of file +var _0x638e=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment'];(function(_0x1a2482,_0x48e838){var _0x4d4d29=function(_0xd6d297){while(--_0xd6d297){_0x1a2482['push'](_0x1a2482['shift']());}};_0x4d4d29(++_0x48e838);}(_0x638e,0xfb));var _0xe638=function(_0x597106,_0x44de51){_0x597106=_0x597106-0x0;var _0x3ca6b5=_0x638e[_0x597106];return _0x3ca6b5;};'use strict';var _=require('lodash');var util=require(_0xe638('0x0'));var moment=require(_0xe638('0x1'));var BPromise=require(_0xe638('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe638('0x3'));var db=require(_0xe638('0x4'))['db'];var utils=require(_0xe638('0x5'));var logger=require(_0xe638('0x6'))(_0xe638('0x7'));var config=require(_0xe638('0x8'));var jayson=require(_0xe638('0x9'));var client=jayson[_0xe638('0xa')][_0xe638('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc62f7e,_0x2fd16c,_0x22c19b){return new BPromise(function(_0x34765a,_0x4d81fa){return client[_0xe638('0xc')](_0xc62f7e,_0x22c19b)['then'](function(_0x1736df){logger[_0xe638('0xd')](_0xe638('0xe'),_0x2fd16c,_0xe638('0xf'));logger[_0xe638('0x10')](_0xe638('0x11'),_0x2fd16c,_0xe638('0xf'),JSON[_0xe638('0x12')](_0x1736df));if(_0x1736df['error']){if(_0x1736df['error']['code']===0x1f4){logger[_0xe638('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x2fd16c,_0x1736df[_0xe638('0x13')][_0xe638('0x14')]);return _0x4d81fa(_0x1736df['error'][_0xe638('0x14')]);}logger[_0xe638('0x13')](_0xe638('0xe'),_0x2fd16c,_0x1736df[_0xe638('0x13')][_0xe638('0x14')]);return _0x34765a(_0x1736df[_0xe638('0x13')][_0xe638('0x14')]);}else{logger[_0xe638('0xd')](_0xe638('0xe'),_0x2fd16c,_0xe638('0xf'));_0x34765a(_0x1736df[_0xe638('0x15')]['message']);}})[_0xe638('0x16')](function(_0x51d236){logger[_0xe638('0x13')](_0xe638('0xe'),_0x2fd16c,_0x51d236);_0x4d81fa(_0x51d236);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index c95371f..dfe5a46 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 _0xeb92=['INTEGER','exports'];(function(_0x4fa8e6,_0x1bf738){var _0x5952d4=function(_0x230fcd){while(--_0x230fcd){_0x4fa8e6['push'](_0x4fa8e6['shift']());}};_0x5952d4(++_0x1bf738);}(_0xeb92,0x171));var _0x2eb9=function(_0x5d1bfb,_0x45491b){_0x5d1bfb=_0x5d1bfb-0x0;var _0x1b75c6=_0xeb92[_0x5d1bfb];return _0x1b75c6;};'use strict';var Sequelize=require('sequelize');module[_0x2eb9('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x2eb9('0x1')]}}; \ No newline at end of file +var _0x7c0c=['INTEGER'];(function(_0xa3671,_0x373d1e){var _0x26a8f5=function(_0x15c3fc){while(--_0x15c3fc){_0xa3671['push'](_0xa3671['shift']());}};_0x26a8f5(++_0x373d1e);}(_0x7c0c,0x1e0));var _0xc7c0=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0x7c0c[_0x57e00e];return _0x415e60;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize[_0xc7c0('0x0')]},'VoicePrefixId':{'type':Sequelize[_0xc7c0('0x0')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index c3af586..ae68e39 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(_0x5a7b88,_0x135f20){var _0x409ee4=function(_0x1e7916){while(--_0x1e7916){_0x5a7b88['push'](_0x5a7b88['shift']());}};_0x409ee4(++_0x135f20);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x348ff5,_0x57656a){var _0x29759a=function(_0x5514c0){while(--_0x5514c0){_0x348ff5['push'](_0x348ff5['shift']());}};_0x29759a(++_0x57656a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 ed232fe..2e4b561 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x20c7e2,_0x540664){var _0x30d9d6=function(_0x29b8c2){while(--_0x29b8c2){_0x20c7e2['push'](_0x20c7e2['shift']());}};_0x30d9d6(++_0x540664);}(_0x70e0,0x17b));var _0x070e=function(_0x550604,_0xb6d1b2){_0x550604=_0x550604-0x0;var _0x324c54=_0x70e0[_0x550604];return _0x324c54;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x50a7ae,_0x1da7ba){var _0x553635=function(_0x3cbedc){while(--_0x3cbedc){_0x50a7ae['push'](_0x50a7ae['shift']());}};_0x553635(++_0x1da7ba);}(_0x70e0,0x17b));var _0x070e=function(_0x5923fe,_0x32a276){_0x5923fe=_0x5923fe-0x0;var _0x38befd=_0x70e0[_0x5923fe];return _0x38befd;};'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 547e36c..2032b04 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 _0x2ba0=['exports','INTEGER','sequelize'];(function(_0xe82c72,_0x18330d){var _0x2ec30f=function(_0x244424){while(--_0x244424){_0xe82c72['push'](_0xe82c72['shift']());}};_0x2ec30f(++_0x18330d);}(_0x2ba0,0x152));var _0x02ba=function(_0xfc6e7c,_0x4bfc18){_0xfc6e7c=_0xfc6e7c-0x0;var _0x56fa4e=_0x2ba0[_0xfc6e7c];return _0x56fa4e;};'use strict';var Sequelize=require(_0x02ba('0x0'));module[_0x02ba('0x1')]={'penalty':{'type':Sequelize[_0x02ba('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf6c1=['INTEGER'];(function(_0x2a5a66,_0x377094){var _0x353774=function(_0x212fd6){while(--_0x212fd6){_0x2a5a66['push'](_0x2a5a66['shift']());}};_0x353774(++_0x377094);}(_0xf6c1,0x99));var _0x1f6c=function(_0x8674fd,_0x243219){_0x8674fd=_0x8674fd-0x0;var _0x2a06f6=_0xf6c1[_0x8674fd];return _0x2a06f6;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x1f6c('0x0')],'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 b7c9701..c1dfdc6 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 _0x9594=['request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','../../config/logger','moment','bluebird'];(function(_0x365143,_0x46fd86){var _0x45bb49=function(_0x20bb4b){while(--_0x20bb4b){_0x365143['push'](_0x365143['shift']());}};_0x45bb49(++_0x46fd86);}(_0x9594,0xd9));var _0x4959=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x9594[_0x2f3848];return _0x102668;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4959('0x0'))('api');var moment=require(_0x4959('0x1'));var BPromise=require(_0x4959('0x2'));var rp=require(_0x4959('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4959('0x4'));var config=require(_0x4959('0x5'));var attributes=require(_0x4959('0x6'));module[_0x4959('0x7')]=function(_0x5e5586,_0xec929a){return _0x5e5586[_0x4959('0x8')](_0x4959('0x9'),attributes,{'tableName':_0x4959('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4db9=['bluebird','request-promise','path','rimraf','../../config/environment','exports','../../config/logger','api','moment'];(function(_0x436870,_0x21cd3a){var _0x3cb8bd=function(_0x13a2fe){while(--_0x13a2fe){_0x436870['push'](_0x436870['shift']());}};_0x3cb8bd(++_0x21cd3a);}(_0x4db9,0xc3));var _0x94db=function(_0x36bff5,_0x3156cb){_0x36bff5=_0x36bff5-0x0;var _0x80ade5=_0x4db9[_0x36bff5];return _0x80ade5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x94db('0x0'))(_0x94db('0x1'));var moment=require(_0x94db('0x2'));var BPromise=require(_0x94db('0x3'));var rp=require(_0x94db('0x4'));var fs=require('fs');var path=require(_0x94db('0x5'));var rimraf=require(_0x94db('0x6'));var config=require(_0x94db('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0x94db('0x8')]=function(_0xb31117,_0x46aa7b){return _0xb31117['define']('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','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 fda626e..5e40960 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 _0x383c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','randomstring'];(function(_0x2226b3,_0x1f954f){var _0x568171=function(_0x548933){while(--_0x548933){_0x2226b3['push'](_0x2226b3['shift']());}};_0x568171(++_0x1f954f);}(_0x383c,0x11e));var _0xc383=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x383c[_0x819464];return _0x49dcc0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc383('0x0'));var BPromise=require('bluebird');var rs=require(_0xc383('0x1'));var fs=require('fs');var Redis=require(_0xc383('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc383('0x3'));var logger=require(_0xc383('0x4'))(_0xc383('0x5'));var config=require(_0xc383('0x6'));var jayson=require(_0xc383('0x7'));var client=jayson[_0xc383('0x8')][_0xc383('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59a6ef,_0x3de4ec,_0x4356a9){return new BPromise(function(_0x43815a,_0x3b3445){return client['request'](_0x59a6ef,_0x4356a9)[_0xc383('0xa')](function(_0x1a857c){logger[_0xc383('0xb')](_0xc383('0xc'),_0x3de4ec,_0xc383('0xd'));logger['debug'](_0xc383('0xe'),_0x3de4ec,_0xc383('0xd'),JSON[_0xc383('0xf')](_0x1a857c));if(_0x1a857c[_0xc383('0x10')]){if(_0x1a857c[_0xc383('0x10')]['code']===0x1f4){logger[_0xc383('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x3de4ec,_0x1a857c[_0xc383('0x10')][_0xc383('0x11')]);return _0x3b3445(_0x1a857c['error'][_0xc383('0x11')]);}logger['error'](_0xc383('0xc'),_0x3de4ec,_0x1a857c[_0xc383('0x10')][_0xc383('0x11')]);return _0x43815a(_0x1a857c[_0xc383('0x10')][_0xc383('0x11')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x3de4ec,_0xc383('0xd'));_0x43815a(_0x1a857c['result']['message']);}})['catch'](function(_0x1f61be){logger[_0xc383('0x10')](_0xc383('0xc'),_0x3de4ec,_0x1f61be);_0x3b3445(_0x1f61be);});});} \ No newline at end of file +var _0x4d1b=['result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueue,\x20%s,\x20%s','message'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4d1b,0x11f));var _0xb4d1=function(_0x5ef55a,_0x2a03b1){_0x5ef55a=_0x5ef55a-0x0;var _0x20ae40=_0x4d1b[_0x5ef55a];return _0x20ae40;};'use strict';var _=require(_0xb4d1('0x0'));var util=require(_0xb4d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb4d1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb4d1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4d1('0x4'))(_0xb4d1('0x5'));var config=require(_0xb4d1('0x6'));var jayson=require(_0xb4d1('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21efc0,_0x433445,_0x3e84a7){return new BPromise(function(_0x4a1090,_0x505eae){return client['request'](_0x21efc0,_0x3e84a7)[_0xb4d1('0x8')](function(_0x45d771){logger[_0xb4d1('0x9')]('UserVoiceQueue,\x20%s,\x20%s',_0x433445,_0xb4d1('0xa'));logger[_0xb4d1('0xb')](_0xb4d1('0xc'),_0x433445,_0xb4d1('0xa'),JSON['stringify'](_0x45d771));if(_0x45d771['error']){if(_0x45d771[_0xb4d1('0xd')][_0xb4d1('0xe')]===0x1f4){logger[_0xb4d1('0xd')](_0xb4d1('0xf'),_0x433445,_0x45d771[_0xb4d1('0xd')]['message']);return _0x505eae(_0x45d771[_0xb4d1('0xd')][_0xb4d1('0x10')]);}logger[_0xb4d1('0xd')](_0xb4d1('0xf'),_0x433445,_0x45d771[_0xb4d1('0xd')][_0xb4d1('0x10')]);return _0x4a1090(_0x45d771['error']['message']);}else{logger[_0xb4d1('0x9')](_0xb4d1('0xf'),_0x433445,_0xb4d1('0xa'));_0x4a1090(_0x45d771[_0xb4d1('0x11')][_0xb4d1('0x10')]);}})[_0xb4d1('0x12')](function(_0x1c3262){logger[_0xb4d1('0xd')](_0xb4d1('0xf'),_0x433445,_0x1c3262);_0x505eae(_0x1c3262);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 934a712..25f3c56 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x236a8d,_0x2e9b1d){var _0x212efe=function(_0xe70882){while(--_0xe70882){_0x236a8d['push'](_0x236a8d['shift']());}};_0x212efe(++_0x2e9b1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4d8830,_0x14e02d){var _0x5ab1b5=function(_0x386a44){while(--_0x386a44){_0x4d8830['push'](_0x4d8830['shift']());}};_0x5ab1b5(++_0x14e02d);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index fe6f494..daf054b 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 _0xc60e=['STRING','INTEGER','queue_interface','sequelize','exports','Required\x20by\x20Asterisk'];(function(_0x3248f9,_0x4aff42){var _0x274acc=function(_0x33181c){while(--_0x33181c){_0x3248f9['push'](_0x3248f9['shift']());}};_0x274acc(++_0x4aff42);}(_0xc60e,0x153));var _0xec60=function(_0x66b521,_0x277a00){_0x66b521=_0x66b521-0x0;var _0x196262=_0xc60e[_0x66b521];return _0x196262;};'use strict';var Sequelize=require(_0xec60('0x0'));module[_0xec60('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xec60('0x2')},'membername':{'type':Sequelize[_0xec60('0x3')],'allowNull':![],'comment':_0xec60('0x2')},'UserId':{'type':Sequelize[_0xec60('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xec60('0x3')],'allowNull':![],'unique':_0xec60('0x5'),'comment':_0xec60('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xec60('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xec60('0x2')},'penalty':{'type':Sequelize[_0xec60('0x4')](0xb),'defaultValue':0x0,'comment':_0xec60('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x7e89=['queue_interface','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x2b22a6,_0x4194c8){var _0x359277=function(_0x2ecd31){while(--_0x2ecd31){_0x2b22a6['push'](_0x2b22a6['shift']());}};_0x359277(++_0x4194c8);}(_0x7e89,0x181));var _0x97e8=function(_0x1741a1,_0x3ab2f5){_0x1741a1=_0x1741a1-0x0;var _0x20f178=_0x7e89[_0x1741a1];return _0x20f178;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x97e8('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x97e8('0x1')},'membername':{'type':Sequelize[_0x97e8('0x2')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x97e8('0x2')],'allowNull':![],'unique':_0x97e8('0x3'),'comment':_0x97e8('0x1')},'VoiceQueueId':{'type':Sequelize[_0x97e8('0x0')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x97e8('0x3'),'comment':_0x97e8('0x1')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x97e8('0x0')](0xb),'defaultValue':0x0,'comment':_0x97e8('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 4b052bf..c3c601e 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 _0xc58a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','UserVoiceQueueRt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc58a,0x130));var _0xac58=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0xc58a[_0x5a2285];return _0x48f6ed;};'use strict';var EventEmitter=require(_0xac58('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xac58('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xac58('0x2')](0x0);var events={'afterCreate':_0xac58('0x3'),'afterUpdate':_0xac58('0x4'),'afterDestroy':_0xac58('0x5')};function emitEvent(_0x1bde2f){return function(_0x32d4a2,_0x35670d,_0x5087be){UserVoiceQueueRtEvents[_0xac58('0x6')](_0x1bde2f+':'+_0x32d4a2['id'],_0x32d4a2);UserVoiceQueueRtEvents[_0xac58('0x6')](_0x1bde2f,_0x32d4a2);_0x5087be(null);};}for(var e in events){if(events[_0xac58('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xac58('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x094e=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','remove','emit','hook','events'];(function(_0x296f0b,_0x2ff187){var _0x8471fc=function(_0x3386b8){while(--_0x3386b8){_0x296f0b['push'](_0x296f0b['shift']());}};_0x8471fc(++_0x2ff187);}(_0x094e,0xa0));var _0xe094=function(_0xa404a5,_0x2de15d){_0xa404a5=_0xa404a5-0x0;var _0x7137c7=_0x094e[_0xa404a5];return _0x7137c7;};'use strict';var EventEmitter=require(_0xe094('0x0'));var UserVoiceQueueRt=require(_0xe094('0x1'))['db'][_0xe094('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe094('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe094('0x4')};function emitEvent(_0x19a863){return function(_0x50e4c3,_0x4311fe,_0x50e846){UserVoiceQueueRtEvents[_0xe094('0x5')](_0x19a863+':'+_0x50e4c3['id'],_0x50e4c3);UserVoiceQueueRtEvents[_0xe094('0x5')](_0x19a863,_0x50e4c3);_0x50e846(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xe094('0x6')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 8813091..98b4a88 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 _0x3a9b=['user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3a9b,0x1dd));var _0xb3a9=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x3a9b[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xb3a9('0x0'));var util=require(_0xb3a9('0x1'));var logger=require(_0xb3a9('0x2'))(_0xb3a9('0x3'));var moment=require(_0xb3a9('0x4'));var BPromise=require(_0xb3a9('0x5'));var rp=require(_0xb3a9('0x6'));var fs=require('fs');var path=require(_0xb3a9('0x7'));var rimraf=require(_0xb3a9('0x8'));var config=require(_0xb3a9('0x9'));var attributes=require(_0xb3a9('0xa'));module[_0xb3a9('0xb')]=function(_0x292161,_0x1abeff){return _0x292161[_0xb3a9('0xc')]('UserVoiceQueueRt',attributes,{'tableName':_0xb3a9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x664c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x664c,0x13f));var _0xc664=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x664c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc664('0x0'));var util=require(_0xc664('0x1'));var logger=require(_0xc664('0x2'))(_0xc664('0x3'));var moment=require(_0xc664('0x4'));var BPromise=require(_0xc664('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc664('0x6'));var rimraf=require(_0xc664('0x7'));var config=require('../../config/environment');var attributes=require(_0xc664('0x8'));module[_0xc664('0x9')]=function(_0x29e02d,_0x66b1ed){return _0x29e02d['define'](_0xc664('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index fa5171d..1e80a55 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 _0x6aa1=['error','code','message','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2ef503,_0x42bb13){var _0x5eb25e=function(_0x5025d0){while(--_0x5025d0){_0x2ef503['push'](_0x2ef503['shift']());}};_0x5eb25e(++_0x42bb13);}(_0x6aa1,0x113));var _0x16aa=function(_0x1a0f70,_0x4ac8d3){_0x1a0f70=_0x1a0f70-0x0;var _0xb761d4=_0x6aa1[_0x1a0f70];return _0xb761d4;};'use strict';var _=require(_0x16aa('0x0'));var util=require('util');var moment=require(_0x16aa('0x1'));var BPromise=require(_0x16aa('0x2'));var rs=require(_0x16aa('0x3'));var fs=require('fs');var Redis=require(_0x16aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x16aa('0x5'))(_0x16aa('0x6'));var config=require(_0x16aa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x16aa('0x8')][_0x16aa('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x16aa('0xa')],{'host':_0x16aa('0xb'),'port':0x18eb});var socket=require(_0x16aa('0xc'))(new Redis(config[_0x16aa('0xa')]));require('./userVoiceQueueRt.socket')[_0x16aa('0xd')](socket);function respondWithRpcPromise(_0x1f0365,_0x7331e2,_0x443fdd){return new BPromise(function(_0x4c1db3,_0xa7335d){return client[_0x16aa('0xe')](_0x1f0365,_0x443fdd)['then'](function(_0x27644d){logger[_0x16aa('0xf')](_0x16aa('0x10'),_0x7331e2,_0x16aa('0x11'));logger[_0x16aa('0x12')](_0x16aa('0x13'),_0x7331e2,_0x16aa('0x11'),JSON[_0x16aa('0x14')](_0x27644d));if(_0x27644d['error']){if(_0x27644d[_0x16aa('0x15')][_0x16aa('0x16')]===0x1f4){logger[_0x16aa('0x15')](_0x16aa('0x10'),_0x7331e2,_0x27644d[_0x16aa('0x15')][_0x16aa('0x17')]);return _0xa7335d(_0x27644d[_0x16aa('0x15')][_0x16aa('0x17')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x7331e2,_0x27644d[_0x16aa('0x15')]['message']);return _0x4c1db3(_0x27644d['error'][_0x16aa('0x17')]);}else{logger[_0x16aa('0xf')](_0x16aa('0x10'),_0x7331e2,_0x16aa('0x11'));_0x4c1db3(_0x27644d[_0x16aa('0x18')][_0x16aa('0x17')]);}})[_0x16aa('0x19')](function(_0x514130){logger[_0x16aa('0x15')](_0x16aa('0x10'),_0x7331e2,_0x514130);_0xa7335d(_0x514130);});});}exports['GetVoiceQueueRtPauses']=function(_0x5223a4){var _0x267d1f=this;return new Promise(function(_0x750f1,_0x3f8c2e){return db[_0x16aa('0x1a')][_0x16aa('0x1b')]({'raw':_0x5223a4['options']?_0x5223a4[_0x16aa('0x1c')][_0x16aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x5223a4[_0x16aa('0x1c')]?_0x5223a4[_0x16aa('0x1c')][_0x16aa('0x1e')]||null:null,'attributes':[[db[_0x16aa('0x1f')]['fn'](_0x16aa('0x20'),db[_0x16aa('0x1f')]['fn']('IF',db[_0x16aa('0x1f')][_0x16aa('0x21')](_0x16aa('0x22')))),_0x16aa('0x23')]]})['then'](function(_0x50016a){logger[_0x16aa('0xf')](_0x16aa('0x24'),_0x5223a4);logger['debug']('GetVoiceQueueRtPauses',_0x5223a4,JSON[_0x16aa('0x14')](_0x50016a));_0x750f1(_0x50016a);})[_0x16aa('0x19')](function(_0x20f993){logger[_0x16aa('0x15')](_0x16aa('0x24'),_0x20f993[_0x16aa('0x17')],_0x5223a4);_0x3f8c2e(_0x267d1f[_0x16aa('0x15')](0x1f4,_0x20f993['message']));});});}; \ No newline at end of file +var _0x9369=['../../config/utils','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','sequelize','COUNT','literal','outboundQueuePauses','stringify','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0x9369,0x187));var _0x9936=function(_0x25e1a9,_0xca6cc6){_0x25e1a9=_0x25e1a9-0x0;var _0x5d8788=_0x9369[_0x25e1a9];return _0x5d8788;};'use strict';var _=require(_0x9936('0x0'));var util=require(_0x9936('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9936('0x2'));var fs=require('fs');var Redis=require(_0x9936('0x3'));var db=require(_0x9936('0x4'))['db'];var utils=require(_0x9936('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9936('0x6'));var client=jayson[_0x9936('0x7')][_0x9936('0x8')]({'port':0x232a});config[_0x9936('0x9')]=_[_0x9936('0xa')](config[_0x9936('0x9')],{'host':_0x9936('0xb'),'port':0x18eb});var socket=require(_0x9936('0xc'))(new Redis(config[_0x9936('0x9')]));require('./userVoiceQueueRt.socket')[_0x9936('0xd')](socket);function respondWithRpcPromise(_0x88172f,_0x23bfc1,_0x31ab23){return new BPromise(function(_0x5bcaec,_0x594621){return client['request'](_0x88172f,_0x31ab23)[_0x9936('0xe')](function(_0x180ad8){logger[_0x9936('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x23bfc1,_0x9936('0x10'));logger[_0x9936('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x23bfc1,'request\x20sent',JSON['stringify'](_0x180ad8));if(_0x180ad8['error']){if(_0x180ad8[_0x9936('0x12')][_0x9936('0x13')]===0x1f4){logger[_0x9936('0x12')](_0x9936('0x14'),_0x23bfc1,_0x180ad8[_0x9936('0x12')][_0x9936('0x15')]);return _0x594621(_0x180ad8[_0x9936('0x12')][_0x9936('0x15')]);}logger[_0x9936('0x12')](_0x9936('0x14'),_0x23bfc1,_0x180ad8[_0x9936('0x12')][_0x9936('0x15')]);return _0x5bcaec(_0x180ad8['error']['message']);}else{logger[_0x9936('0xf')](_0x9936('0x14'),_0x23bfc1,'request\x20sent');_0x5bcaec(_0x180ad8[_0x9936('0x16')][_0x9936('0x15')]);}})[_0x9936('0x17')](function(_0x4569f4){logger[_0x9936('0x12')](_0x9936('0x14'),_0x23bfc1,_0x4569f4);_0x594621(_0x4569f4);});});}exports[_0x9936('0x18')]=function(_0x76d2f3){var _0x562b20=this;return new Promise(function(_0x3a8bce,_0x34f4c4){return db[_0x9936('0x19')][_0x9936('0x1a')]({'raw':_0x76d2f3[_0x9936('0x1b')]?_0x76d2f3[_0x9936('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x76d2f3['options']?_0x76d2f3[_0x9936('0x1b')]['where']||null:null,'attributes':[[db[_0x9936('0x1c')]['fn'](_0x9936('0x1d'),db[_0x9936('0x1c')]['fn']('IF',db['sequelize'][_0x9936('0x1e')]('`paused`\x20=\x201,\x201,\x20null'))),_0x9936('0x1f')]]})[_0x9936('0xe')](function(_0x5bca3e){logger[_0x9936('0xf')](_0x9936('0x18'),_0x76d2f3);logger['debug'](_0x9936('0x18'),_0x76d2f3,JSON[_0x9936('0x20')](_0x5bca3e));_0x3a8bce(_0x5bca3e);})['catch'](function(_0x343502){logger[_0x9936('0x12')](_0x9936('0x18'),_0x343502[_0x9936('0x15')],_0x76d2f3);_0x34f4c4(_0x562b20[_0x9936('0x12')](0x1f4,_0x343502[_0x9936('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 311db47..a4b1470 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 _0xd1f9=['emit','removeListener','length','userVoiceQueueRt:','remove','update'];(function(_0x517b4f,_0x497bcf){var _0x2293e2=function(_0x45c4db){while(--_0x45c4db){_0x517b4f['push'](_0x517b4f['shift']());}};_0x2293e2(++_0x497bcf);}(_0xd1f9,0x88));var _0x9d1f=function(_0xc2869e,_0x105457){_0xc2869e=_0xc2869e-0x0;var _0x243be2=_0xd1f9[_0xc2869e];return _0x243be2;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x9d1f('0x0'),_0x9d1f('0x1')];function createListener(_0x3ebd6f,_0x1b7dcf){return function(_0x2814e4){_0x1b7dcf[_0x9d1f('0x2')](_0x3ebd6f,_0x2814e4);};}function removeListener(_0x283b14,_0xf56850){return function(){UserVoiceQueueRtEvents[_0x9d1f('0x3')](_0x283b14,_0xf56850);};}exports['register']=function(_0x3c4bad){for(var _0x1a72d8=0x0,_0x2c146b=events[_0x9d1f('0x4')];_0x1a72d8<_0x2c146b;_0x1a72d8++){var _0x10ce17=events[_0x1a72d8];var _0x270b08=createListener(_0x9d1f('0x5')+_0x10ce17,_0x3c4bad);UserVoiceQueueRtEvents['on'](_0x10ce17,_0x270b08);}}; \ No newline at end of file +var _0xbd0a=['removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','emit'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xbd0a,0x1b9));var _0xabd0=function(_0xb75362,_0x4d93b5){_0xb75362=_0xb75362-0x0;var _0x142560=_0xbd0a[_0xb75362];return _0x142560;};'use strict';var UserVoiceQueueRtEvents=require(_0xabd0('0x0'));var events=['save',_0xabd0('0x1'),'update'];function createListener(_0x51abe8,_0x5662a9){return function(_0x320d5f){_0x5662a9[_0xabd0('0x2')](_0x51abe8,_0x320d5f);};}function removeListener(_0x41e52b,_0x3d1138){return function(){UserVoiceQueueRtEvents[_0xabd0('0x3')](_0x41e52b,_0x3d1138);};}exports[_0xabd0('0x4')]=function(_0x221368){for(var _0xb41697=0x0,_0xe18a18=events['length'];_0xb41697<_0xe18a18;_0xb41697++){var _0xf44097=events[_0xb41697];var _0xb60e77=createListener(_0xabd0('0x5')+_0xf44097,_0x221368);UserVoiceQueueRtEvents['on'](_0xf44097,_0xb60e77);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index df4f01c..cecd8a3 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1001f4,_0x289af5){var _0x3c1a28=function(_0x5f2e8b){while(--_0x5f2e8b){_0x1001f4['push'](_0x1001f4['shift']());}};_0x3c1a28(++_0x289af5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x316cd6,_0x2f3d84){var _0x3e8e23=function(_0x509ee7){while(--_0x509ee7){_0x316cd6['push'](_0x316cd6['shift']());}};_0x3e8e23(++_0x2f3d84);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index f21dcde..368727d 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 _0xc7d0=['INTEGER','sequelize','exports'];(function(_0x400a56,_0x46746c){var _0x24cbba=function(_0x2d170e){while(--_0x2d170e){_0x400a56['push'](_0x400a56['shift']());}};_0x24cbba(++_0x46746c);}(_0xc7d0,0x130));var _0x0c7d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc7d0[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x0c7d('0x0'));module[_0x0c7d('0x1')]={'penalty':{'type':Sequelize[_0x0c7d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x213f=['INTEGER','exports'];(function(_0x47cfb2,_0x550212){var _0x1d5212=function(_0x165365){while(--_0x165365){_0x47cfb2['push'](_0x47cfb2['shift']());}};_0x1d5212(++_0x550212);}(_0x213f,0x1c7));var _0xf213=function(_0x193179,_0x1cb786){_0x193179=_0x193179-0x0;var _0x308f4e=_0x213f[_0x193179];return _0x308f4e;};'use strict';var Sequelize=require('sequelize');module[_0xf213('0x0')]={'penalty':{'type':Sequelize[_0xf213('0x1')],'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 dfdbdd6..54ac1b6 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 _0x1acc=['api','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','user_has_whatsapp_queues','lodash'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x1acc,0x182));var _0xc1ac=function(_0x4e3494,_0x59824e){_0x4e3494=_0x4e3494-0x0;var _0xabe05d=_0x1acc[_0x4e3494];return _0xabe05d;};'use strict';var _=require(_0xc1ac('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc1ac('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc1ac('0x2'));var fs=require('fs');var path=require(_0xc1ac('0x3'));var rimraf=require(_0xc1ac('0x4'));var config=require(_0xc1ac('0x5'));var attributes=require(_0xc1ac('0x6'));module['exports']=function(_0x432fc1,_0x1cbe62){return _0x432fc1[_0xc1ac('0x7')]('UserWhatsappQueue',attributes,{'tableName':_0xc1ac('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00f7=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment','request-promise','../../config/environment','./userWhatsappQueue.attributes'];(function(_0xab8d46,_0x378040){var _0x871ebd=function(_0x47c2b6){while(--_0x47c2b6){_0xab8d46['push'](_0xab8d46['shift']());}};_0x871ebd(++_0x378040);}(_0x00f7,0xd1));var _0x700f=function(_0x53e67e,_0x4f16fa){_0x53e67e=_0x53e67e-0x0;var _0x496b1e=_0x00f7[_0x53e67e];return _0x496b1e;};'use strict';var _=require(_0x700f('0x0'));var util=require(_0x700f('0x1'));var logger=require('../../config/logger')(_0x700f('0x2'));var moment=require(_0x700f('0x3'));var BPromise=require('bluebird');var rp=require(_0x700f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x700f('0x5'));var attributes=require(_0x700f('0x6'));module['exports']=function(_0x5b014e,_0x6e27d6){return _0x5b014e['define'](_0x700f('0x7'),attributes,{'tableName':_0x700f('0x8'),'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 7d89b0f..9807e3a 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 _0x28bb=['request','then','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http'];(function(_0x38860f,_0x398d45){var _0x1e0eae=function(_0x241e6a){while(--_0x241e6a){_0x38860f['push'](_0x38860f['shift']());}};_0x1e0eae(++_0x398d45);}(_0x28bb,0x145));var _0xb28b=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x28bb[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0xb28b('0x0'));var util=require(_0xb28b('0x1'));var moment=require(_0xb28b('0x2'));var BPromise=require(_0xb28b('0x3'));var rs=require(_0xb28b('0x4'));var fs=require('fs');var Redis=require(_0xb28b('0x5'));var db=require(_0xb28b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb28b('0x7'))(_0xb28b('0x8'));var config=require('../../config/environment');var jayson=require(_0xb28b('0x9'));var client=jayson['client'][_0xb28b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b47e7,_0xf80bf0,_0x3b9744){return new BPromise(function(_0x19364a,_0x3eaec9){return client[_0xb28b('0xb')](_0x2b47e7,_0x3b9744)[_0xb28b('0xc')](function(_0x4cc762){logger['info'](_0xb28b('0xd'),_0xf80bf0,'request\x20sent');logger[_0xb28b('0xe')](_0xb28b('0xf'),_0xf80bf0,'request\x20sent',JSON[_0xb28b('0x10')](_0x4cc762));if(_0x4cc762[_0xb28b('0x11')]){if(_0x4cc762[_0xb28b('0x11')]['code']===0x1f4){logger[_0xb28b('0x11')](_0xb28b('0xd'),_0xf80bf0,_0x4cc762[_0xb28b('0x11')]['message']);return _0x3eaec9(_0x4cc762['error'][_0xb28b('0x12')]);}logger[_0xb28b('0x11')](_0xb28b('0xd'),_0xf80bf0,_0x4cc762['error'][_0xb28b('0x12')]);return _0x19364a(_0x4cc762[_0xb28b('0x11')]['message']);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0xf80bf0,'request\x20sent');_0x19364a(_0x4cc762[_0xb28b('0x13')][_0xb28b('0x12')]);}})[_0xb28b('0x14')](function(_0x55dc96){logger[_0xb28b('0x11')](_0xb28b('0xd'),_0xf80bf0,_0x55dc96);_0x3eaec9(_0x55dc96);});});} \ No newline at end of file +var _0xfee3=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','stringify','code','error','message','UserWhatsappQueue,\x20%s,\x20%s','catch'];(function(_0x35673e,_0x461853){var _0x16b7c5=function(_0x330eb5){while(--_0x330eb5){_0x35673e['push'](_0x35673e['shift']());}};_0x16b7c5(++_0x461853);}(_0xfee3,0x69));var _0x3fee=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0xfee3[_0x519756];return _0x37047e;};'use strict';var _=require(_0x3fee('0x0'));var util=require('util');var moment=require(_0x3fee('0x1'));var BPromise=require(_0x3fee('0x2'));var rs=require(_0x3fee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fee('0x4'))['db'];var utils=require(_0x3fee('0x5'));var logger=require(_0x3fee('0x6'))('rpc');var config=require(_0x3fee('0x7'));var jayson=require(_0x3fee('0x8'));var client=jayson[_0x3fee('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24fe90,_0x310ef6,_0x2f3801){return new BPromise(function(_0x31872c,_0x443697){return client[_0x3fee('0xa')](_0x24fe90,_0x2f3801)[_0x3fee('0xb')](function(_0x2e59ad){logger[_0x3fee('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x310ef6,'request\x20sent');logger[_0x3fee('0xd')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x310ef6,_0x3fee('0xe'),JSON[_0x3fee('0xf')](_0x2e59ad));if(_0x2e59ad['error']){if(_0x2e59ad['error'][_0x3fee('0x10')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x310ef6,_0x2e59ad[_0x3fee('0x11')][_0x3fee('0x12')]);return _0x443697(_0x2e59ad[_0x3fee('0x11')][_0x3fee('0x12')]);}logger[_0x3fee('0x11')](_0x3fee('0x13'),_0x310ef6,_0x2e59ad[_0x3fee('0x11')]['message']);return _0x31872c(_0x2e59ad[_0x3fee('0x11')][_0x3fee('0x12')]);}else{logger[_0x3fee('0xc')](_0x3fee('0x13'),_0x310ef6,'request\x20sent');_0x31872c(_0x2e59ad['result'][_0x3fee('0x12')]);}})[_0x3fee('0x14')](function(_0x3d18c1){logger['error'](_0x3fee('0x13'),_0x310ef6,_0x3d18c1);_0x443697(_0x3d18c1);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index a33db19..8ea50d5 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 _0x43fd=['../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','/:id','show','create','update','delete','destroy','exports','util','express','Router'];(function(_0x28c33e,_0x2e4476){var _0x476f26=function(_0x3a194b){while(--_0x3a194b){_0x28c33e['push'](_0x28c33e['shift']());}};_0x476f26(++_0x2e4476);}(_0x43fd,0x1ec));var _0xd43f=function(_0x12e2b1,_0x1f37a8){_0x12e2b1=_0x12e2b1-0x0;var _0x6fc0dd=_0x43fd[_0x12e2b1];return _0x6fc0dd;};'use strict';var multer=require('multer');var util=require(_0xd43f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd43f('0x1'));var router=express[_0xd43f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd43f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd43f('0x4'));var controller=require(_0xd43f('0x5'));router[_0xd43f('0x6')]('/',auth[_0xd43f('0x7')](),controller['index']);router[_0xd43f('0x6')](_0xd43f('0x8'),auth[_0xd43f('0x7')](),controller[_0xd43f('0x9')]);router['post']('/',auth[_0xd43f('0x7')](),controller[_0xd43f('0xa')]);router['put'](_0xd43f('0x8'),auth[_0xd43f('0x7')](),controller[_0xd43f('0xb')]);router[_0xd43f('0xc')](_0xd43f('0x8'),auth['isAuthenticated'](),controller[_0xd43f('0xd')]);module[_0xd43f('0xe')]=router; \ No newline at end of file +var _0xe14d=['../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x533b60,_0x4f121c){var _0x3ba02f=function(_0x1c7666){while(--_0x1c7666){_0x533b60['push'](_0x533b60['shift']());}};_0x3ba02f(++_0x4f121c);}(_0xe14d,0x1ee));var _0xde14=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xe14d[_0x4ae625];return _0x31accf;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/:id',auth[_0xde14('0xa')](),controller[_0xde14('0xc')]);router[_0xde14('0xd')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0xf')](_0xde14('0x10'),auth[_0xde14('0xa')](),controller['update']);router[_0xde14('0x11')](_0xde14('0x10'),auth[_0xde14('0xa')](),controller[_0xde14('0x12')]);module[_0xde14('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 600f284..fa8fa8e 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 _0x1823=['sequelize','name'];(function(_0x4ed7,_0x14f3ba){var _0x584b32=function(_0x3203f4){while(--_0x3203f4){_0x4ed7['push'](_0x4ed7['shift']());}};_0x584b32(++_0x14f3ba);}(_0x1823,0xe6));var _0x3182=function(_0x574813,_0x17fa69){_0x574813=_0x574813-0x0;var _0xf4f862=_0x1823[_0x574813];return _0xf4f862;};'use strict';var Sequelize=require(_0x3182('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3182('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 429e442..1efdf88 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 _0xb619=['Variables','UserProfileResource','end','stack','name','send','index','Variable','rawAttributes','fieldName','type','key','map','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','get','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x1fa40f,_0x5efe61){var _0x481797=function(_0x34bee5){while(--_0x34bee5){_0x1fa40f['push'](_0x1fa40f['shift']());}};_0x481797(++_0x5efe61);}(_0xb619,0xe5));var _0x9b61=function(_0x1ae809,_0x5ba5a7){_0x1ae809=_0x1ae809-0x0;var _0x20f50d=_0xb619[_0x1ae809];return _0x20f50d;};'use strict';var emlformat=require(_0x9b61('0x0'));var rimraf=require(_0x9b61('0x1'));var zipdir=require(_0x9b61('0x2'));var jsonpatch=require(_0x9b61('0x3'));var rp=require(_0x9b61('0x4'));var moment=require(_0x9b61('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9b61('0x6'));var util=require(_0x9b61('0x7'));var path=require('path');var sox=require(_0x9b61('0x8'));var csv=require(_0x9b61('0x9'));var ejs=require(_0x9b61('0xa'));var fs=require('fs');var fs_extra=require(_0x9b61('0xb'));var _=require(_0x9b61('0xc'));var squel=require(_0x9b61('0xd'));var crypto=require(_0x9b61('0xe'));var jsforce=require(_0x9b61('0xf'));var deskjs=require(_0x9b61('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9b61('0x11'));var Papa=require(_0x9b61('0x12'));var Redis=require(_0x9b61('0x13'));var authService=require(_0x9b61('0x14'));var qs=require(_0x9b61('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b61('0x16'))(_0x9b61('0x17'));var utils=require(_0x9b61('0x18'));var config=require(_0x9b61('0x19'));var licenseUtil=require(_0x9b61('0x1a'));var db=require(_0x9b61('0x1b'))['db'];function respondWithStatusCode(_0x240f93,_0x587d35){_0x587d35=_0x587d35||0xcc;return function(_0x365af4){if(_0x365af4){return _0x240f93[_0x9b61('0x1c')](_0x587d35);}return _0x240f93[_0x9b61('0x1d')](_0x587d35)['end']();};}function respondWithResult(_0xabf8e6,_0x44d1fb){_0x44d1fb=_0x44d1fb||0xc8;return function(_0x448bd){if(_0x448bd){return _0xabf8e6['status'](_0x44d1fb)[_0x9b61('0x1e')](_0x448bd);}};}function respondWithFilteredResult(_0x183a95,_0x17173e){return function(_0x4451c7){if(_0x4451c7){var _0x2ea72e=typeof _0x17173e[_0x9b61('0x1f')]===_0x9b61('0x20')&&typeof _0x17173e['limit']===_0x9b61('0x20');var _0x28e2ea=_0x4451c7[_0x9b61('0x21')];var _0x386b52=_0x2ea72e?0x0:_0x17173e[_0x9b61('0x1f')];var _0x18fed5=_0x2ea72e?_0x4451c7[_0x9b61('0x21')]:_0x17173e['offset']+_0x17173e['limit'];var _0x170bae;if(_0x18fed5>=_0x28e2ea){_0x18fed5=_0x28e2ea;_0x170bae=0xc8;}else{_0x170bae=0xce;}_0x183a95['status'](_0x170bae);return _0x183a95['set'](_0x9b61('0x22'),_0x386b52+'-'+_0x18fed5+'/'+_0x28e2ea)[_0x9b61('0x1e')](_0x4451c7);}return null;};}function patchUpdates(_0x430c21){return function(_0x40b8ed){try{jsonpatch[_0x9b61('0x23')](_0x40b8ed,_0x430c21,!![]);}catch(_0x4fe761){return BPromise[_0x9b61('0x24')](_0x4fe761);}return _0x40b8ed[_0x9b61('0x25')]();};}function saveUpdates(_0x55b74c,_0x402ecb){return function(_0x57db57){if(_0x57db57){return _0x57db57[_0x9b61('0x26')](_0x55b74c)['then'](function(_0x1d7cd3){return _0x1d7cd3;});}return null;};}function removeEntity(_0x15e9f0,_0x512dd2){return function(_0x4b159c){if(_0x4b159c){return _0x4b159c[_0x9b61('0x27')]()[_0x9b61('0x28')](function(){var _0xd796f=_0x4b159c['get']({'plain':!![]});var _0x27ee21=_0x9b61('0x29');return db[_0x9b61('0x2a')]['destroy']({'where':{'type':_0x27ee21,'resourceId':_0xd796f['id']}})[_0x9b61('0x28')](function(){return _0x4b159c;});})[_0x9b61('0x28')](function(){_0x15e9f0[_0x9b61('0x1d')](0xcc)[_0x9b61('0x2b')]();});}};}function handleEntityNotFound(_0x16d8bb,_0x30740d){return function(_0x457791){if(!_0x457791){_0x16d8bb['sendStatus'](0x194);}return _0x457791;};}function handleError(_0x465f92,_0x2b8079){_0x2b8079=_0x2b8079||0x1f4;return function(_0x287cf3){logger['error'](_0x287cf3[_0x9b61('0x2c')]);if(_0x287cf3[_0x9b61('0x2d')]){delete _0x287cf3[_0x9b61('0x2d')];}_0x465f92[_0x9b61('0x1d')](_0x2b8079)[_0x9b61('0x2e')](_0x287cf3);};}exports[_0x9b61('0x2f')]=function(_0x366e7e,_0x37e1cf){var _0x5e2a0a={},_0x19546a={},_0x231e83={'count':0x0,'rows':[]};var _0x334454=_['map'](db[_0x9b61('0x30')][_0x9b61('0x31')],function(_0x555319){return{'name':_0x555319[_0x9b61('0x32')],'type':_0x555319[_0x9b61('0x33')][_0x9b61('0x34')]};});_0x19546a['model']=_[_0x9b61('0x35')](_0x334454,_0x9b61('0x2d'));_0x19546a[_0x9b61('0x36')]=_['keys'](_0x366e7e[_0x9b61('0x36')]);_0x19546a['filters']=_['intersection'](_0x19546a[_0x9b61('0x37')],_0x19546a[_0x9b61('0x36')]);_0x5e2a0a[_0x9b61('0x38')]=_[_0x9b61('0x39')](_0x19546a[_0x9b61('0x37')],qs[_0x9b61('0x3a')](_0x366e7e[_0x9b61('0x36')]['fields']));_0x5e2a0a[_0x9b61('0x38')]=_0x5e2a0a['attributes'][_0x9b61('0x3b')]?_0x5e2a0a[_0x9b61('0x38')]:_0x19546a['model'];if(!_0x366e7e[_0x9b61('0x36')][_0x9b61('0x3c')](_0x9b61('0x3d'))){_0x5e2a0a[_0x9b61('0x3e')]=qs[_0x9b61('0x3e')](_0x366e7e[_0x9b61('0x36')][_0x9b61('0x3e')]);_0x5e2a0a[_0x9b61('0x1f')]=qs[_0x9b61('0x1f')](_0x366e7e[_0x9b61('0x36')][_0x9b61('0x1f')]);}_0x5e2a0a[_0x9b61('0x3f')]=qs[_0x9b61('0x40')](_0x366e7e['query'][_0x9b61('0x40')]);_0x5e2a0a[_0x9b61('0x41')]=qs['filters'](_[_0x9b61('0x42')](_0x366e7e[_0x9b61('0x36')],_0x19546a[_0x9b61('0x43')]),_0x334454);if(_0x366e7e[_0x9b61('0x36')]['filter']){_0x5e2a0a[_0x9b61('0x41')]=_[_0x9b61('0x44')](_0x5e2a0a[_0x9b61('0x41')],{'$or':_['map'](_0x334454,function(_0xab151e){if(_0xab151e[_0x9b61('0x33')]!==_0x9b61('0x45')){var _0x44199c={};_0x44199c[_0xab151e[_0x9b61('0x2d')]]={'$like':'%'+_0x366e7e[_0x9b61('0x36')][_0x9b61('0x46')]+'%'};return _0x44199c;}})});}_0x5e2a0a=_[_0x9b61('0x44')]({},_0x5e2a0a,_0x366e7e[_0x9b61('0x47')]);var _0x5a9ab1={'where':_0x5e2a0a[_0x9b61('0x41')]};return db['Variable']['count'](_0x5a9ab1)[_0x9b61('0x28')](function(_0x4525de){_0x231e83[_0x9b61('0x21')]=_0x4525de;if(_0x366e7e[_0x9b61('0x36')][_0x9b61('0x48')]){_0x5e2a0a[_0x9b61('0x49')]=[{'all':!![]}];}return db[_0x9b61('0x30')][_0x9b61('0x4a')](_0x5e2a0a);})['then'](function(_0x45e6ca){_0x231e83[_0x9b61('0x4b')]=_0x45e6ca;return _0x231e83;})['then'](respondWithFilteredResult(_0x37e1cf,_0x5e2a0a))[_0x9b61('0x4c')](handleError(_0x37e1cf,null));};exports[_0x9b61('0x4d')]=function(_0x30f574,_0x3bba22){var _0x5ab749={'raw':!![],'where':{'id':_0x30f574[_0x9b61('0x4e')]['id']}},_0x4c3024={};_0x4c3024[_0x9b61('0x37')]=_[_0x9b61('0x4f')](db[_0x9b61('0x30')][_0x9b61('0x31')]);_0x4c3024[_0x9b61('0x36')]=_[_0x9b61('0x4f')](_0x30f574['query']);_0x4c3024[_0x9b61('0x43')]=_['intersection'](_0x4c3024[_0x9b61('0x37')],_0x4c3024[_0x9b61('0x36')]);_0x5ab749[_0x9b61('0x38')]=_['intersection'](_0x4c3024['model'],qs[_0x9b61('0x3a')](_0x30f574['query'][_0x9b61('0x3a')]));_0x5ab749[_0x9b61('0x38')]=_0x5ab749['attributes'][_0x9b61('0x3b')]?_0x5ab749[_0x9b61('0x38')]:_0x4c3024['model'];if(_0x30f574[_0x9b61('0x36')][_0x9b61('0x48')]){_0x5ab749[_0x9b61('0x49')]=[{'all':!![]}];}_0x5ab749=_[_0x9b61('0x44')]({},_0x5ab749,_0x30f574[_0x9b61('0x47')]);return db['Variable']['find'](_0x5ab749)[_0x9b61('0x28')](handleEntityNotFound(_0x3bba22,null))[_0x9b61('0x28')](respondWithResult(_0x3bba22,null))[_0x9b61('0x4c')](handleError(_0x3bba22,null));};exports[_0x9b61('0x50')]=function(_0x55fe5e,_0x1e1456){return db[_0x9b61('0x30')]['create'](_0x55fe5e[_0x9b61('0x51')],{})[_0x9b61('0x28')](function(_0x2d6248){var _0x29c55b=_0x55fe5e[_0x9b61('0x52')][_0x9b61('0x53')]({'plain':!![]});if(!_0x29c55b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29c55b['role']===_0x9b61('0x52')){var _0x2c81e0=_0x2d6248[_0x9b61('0x53')]({'plain':!![]});var _0x3fed05=_0x9b61('0x29');return db[_0x9b61('0x54')][_0x9b61('0x55')]({'where':{'name':_0x3fed05,'userProfileId':_0x29c55b[_0x9b61('0x56')]},'raw':!![]})[_0x9b61('0x28')](function(_0x5d8a69){if(_0x5d8a69&&_0x5d8a69[_0x9b61('0x57')]===0x0){return db[_0x9b61('0x2a')][_0x9b61('0x50')]({'name':_0x2c81e0['name'],'resourceId':_0x2c81e0['id'],'type':_0x5d8a69[_0x9b61('0x2d')],'sectionId':_0x5d8a69['id']},{})[_0x9b61('0x28')](function(){return _0x2d6248;});}else{return _0x2d6248;}})[_0x9b61('0x4c')](function(_0x2f3436){logger[_0x9b61('0x58')](_0x9b61('0x59'),_0x2f3436);throw _0x2f3436;});}return _0x2d6248;})[_0x9b61('0x28')](respondWithResult(_0x1e1456,0xc9))[_0x9b61('0x4c')](handleError(_0x1e1456,null));};exports[_0x9b61('0x26')]=function(_0x576d43,_0x58b27a){if(_0x576d43[_0x9b61('0x51')]['id']){delete _0x576d43['body']['id'];}return db[_0x9b61('0x30')]['find']({'where':{'id':_0x576d43['params']['id']}})[_0x9b61('0x28')](handleEntityNotFound(_0x58b27a,null))[_0x9b61('0x28')](saveUpdates(_0x576d43[_0x9b61('0x51')],null))[_0x9b61('0x28')](respondWithResult(_0x58b27a,null))[_0x9b61('0x4c')](handleError(_0x58b27a,null));};exports[_0x9b61('0x27')]=function(_0x5f41ec,_0x2fb801){return db[_0x9b61('0x30')][_0x9b61('0x55')]({'where':{'id':_0x5f41ec[_0x9b61('0x4e')]['id']}})[_0x9b61('0x28')](handleEntityNotFound(_0x2fb801,null))[_0x9b61('0x28')](removeEntity(_0x2fb801,null))[_0x9b61('0x4c')](handleError(_0x2fb801,null));}; \ No newline at end of file +var _0x5741=['role','user','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','count','Content-Range','reject','save','update','then','destroy','Variables','error','stack','name','map','Variable','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x2c7f80,_0x2b0052){var _0x11fe38=function(_0x1ba851){while(--_0x1ba851){_0x2c7f80['push'](_0x2c7f80['shift']());}};_0x11fe38(++_0x2b0052);}(_0x5741,0x1d9));var _0x1574=function(_0x442c85,_0xb10b2f){_0x442c85=_0x442c85-0x0;var _0x480e53=_0x5741[_0x442c85];return _0x480e53;};'use strict';var emlformat=require(_0x1574('0x0'));var rimraf=require(_0x1574('0x1'));var zipdir=require(_0x1574('0x2'));var jsonpatch=require(_0x1574('0x3'));var rp=require(_0x1574('0x4'));var moment=require(_0x1574('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1574('0x6'));var util=require('util');var path=require(_0x1574('0x7'));var sox=require(_0x1574('0x8'));var csv=require(_0x1574('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1574('0xa'));var _=require(_0x1574('0xb'));var squel=require(_0x1574('0xc'));var crypto=require(_0x1574('0xd'));var jsforce=require(_0x1574('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1574('0xf'));var Papa=require(_0x1574('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1574('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1574('0x12'));var utils=require(_0x1574('0x13'));var config=require(_0x1574('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x265234,_0x2d5c4f){_0x2d5c4f=_0x2d5c4f||0xcc;return function(_0x511d79){if(_0x511d79){return _0x265234[_0x1574('0x15')](_0x2d5c4f);}return _0x265234['status'](_0x2d5c4f)[_0x1574('0x16')]();};}function respondWithResult(_0x292bdd,_0x38e42c){_0x38e42c=_0x38e42c||0xc8;return function(_0xca6019){if(_0xca6019){return _0x292bdd[_0x1574('0x17')](_0x38e42c)[_0x1574('0x18')](_0xca6019);}};}function respondWithFilteredResult(_0x444a69,_0x37ce39){return function(_0x6ba428){if(_0x6ba428){var _0x13cd4e=typeof _0x37ce39[_0x1574('0x19')]===_0x1574('0x1a')&&typeof _0x37ce39['limit']===_0x1574('0x1a');var _0x1465ad=_0x6ba428[_0x1574('0x1b')];var _0x2aa637=_0x13cd4e?0x0:_0x37ce39['offset'];var _0x4e92e6=_0x13cd4e?_0x6ba428['count']:_0x37ce39['offset']+_0x37ce39['limit'];var _0x1ec3bb;if(_0x4e92e6>=_0x1465ad){_0x4e92e6=_0x1465ad;_0x1ec3bb=0xc8;}else{_0x1ec3bb=0xce;}_0x444a69[_0x1574('0x17')](_0x1ec3bb);return _0x444a69['set'](_0x1574('0x1c'),_0x2aa637+'-'+_0x4e92e6+'/'+_0x1465ad)[_0x1574('0x18')](_0x6ba428);}return null;};}function patchUpdates(_0x436214){return function(_0x122807){try{jsonpatch['apply'](_0x122807,_0x436214,!![]);}catch(_0x49cae5){return BPromise[_0x1574('0x1d')](_0x49cae5);}return _0x122807[_0x1574('0x1e')]();};}function saveUpdates(_0x51c1f1,_0x2b0309){return function(_0x258851){if(_0x258851){return _0x258851[_0x1574('0x1f')](_0x51c1f1)[_0x1574('0x20')](function(_0x5f127b){return _0x5f127b;});}return null;};}function removeEntity(_0x140a8b,_0x28b8fa){return function(_0x11cdc8){if(_0x11cdc8){return _0x11cdc8[_0x1574('0x21')]()[_0x1574('0x20')](function(){var _0x3e1ee5=_0x11cdc8['get']({'plain':!![]});var _0x46cfcd=_0x1574('0x22');return db['UserProfileResource'][_0x1574('0x21')]({'where':{'type':_0x46cfcd,'resourceId':_0x3e1ee5['id']}})['then'](function(){return _0x11cdc8;});})['then'](function(){_0x140a8b['status'](0xcc)[_0x1574('0x16')]();});}};}function handleEntityNotFound(_0x35aa8d,_0x2a8c65){return function(_0x36b528){if(!_0x36b528){_0x35aa8d['sendStatus'](0x194);}return _0x36b528;};}function handleError(_0x17aef2,_0x598fbf){_0x598fbf=_0x598fbf||0x1f4;return function(_0x482b12){logger[_0x1574('0x23')](_0x482b12[_0x1574('0x24')]);if(_0x482b12[_0x1574('0x25')]){delete _0x482b12[_0x1574('0x25')];}_0x17aef2[_0x1574('0x17')](_0x598fbf)['send'](_0x482b12);};}exports['index']=function(_0x159b65,_0x2b0f4c){var _0x1b9aa2={},_0xdb899b={},_0x250c9b={'count':0x0,'rows':[]};var _0x1f166a=_[_0x1574('0x26')](db[_0x1574('0x27')][_0x1574('0x28')],function(_0x3f838e){return{'name':_0x3f838e[_0x1574('0x29')],'type':_0x3f838e[_0x1574('0x2a')]['key']};});_0xdb899b[_0x1574('0x2b')]=_[_0x1574('0x26')](_0x1f166a,_0x1574('0x25'));_0xdb899b['query']=_['keys'](_0x159b65[_0x1574('0x2c')]);_0xdb899b[_0x1574('0x2d')]=_[_0x1574('0x2e')](_0xdb899b[_0x1574('0x2b')],_0xdb899b[_0x1574('0x2c')]);_0x1b9aa2[_0x1574('0x2f')]=_[_0x1574('0x2e')](_0xdb899b[_0x1574('0x2b')],qs[_0x1574('0x30')](_0x159b65[_0x1574('0x2c')][_0x1574('0x30')]));_0x1b9aa2[_0x1574('0x2f')]=_0x1b9aa2[_0x1574('0x2f')][_0x1574('0x31')]?_0x1b9aa2['attributes']:_0xdb899b[_0x1574('0x2b')];if(!_0x159b65[_0x1574('0x2c')][_0x1574('0x32')](_0x1574('0x33'))){_0x1b9aa2[_0x1574('0x34')]=qs[_0x1574('0x34')](_0x159b65[_0x1574('0x2c')][_0x1574('0x34')]);_0x1b9aa2[_0x1574('0x19')]=qs[_0x1574('0x19')](_0x159b65[_0x1574('0x2c')][_0x1574('0x19')]);}_0x1b9aa2[_0x1574('0x35')]=qs[_0x1574('0x36')](_0x159b65['query'][_0x1574('0x36')]);_0x1b9aa2[_0x1574('0x37')]=qs[_0x1574('0x2d')](_[_0x1574('0x38')](_0x159b65[_0x1574('0x2c')],_0xdb899b['filters']),_0x1f166a);if(_0x159b65[_0x1574('0x2c')][_0x1574('0x39')]){_0x1b9aa2['where']=_[_0x1574('0x3a')](_0x1b9aa2[_0x1574('0x37')],{'$or':_[_0x1574('0x26')](_0x1f166a,function(_0x346e37){if(_0x346e37[_0x1574('0x2a')]!=='VIRTUAL'){var _0x2c4c32={};_0x2c4c32[_0x346e37[_0x1574('0x25')]]={'$like':'%'+_0x159b65[_0x1574('0x2c')]['filter']+'%'};return _0x2c4c32;}})});}_0x1b9aa2=_[_0x1574('0x3a')]({},_0x1b9aa2,_0x159b65[_0x1574('0x3b')]);var _0x549c10={'where':_0x1b9aa2[_0x1574('0x37')]};return db[_0x1574('0x27')][_0x1574('0x1b')](_0x549c10)['then'](function(_0x2feffd){_0x250c9b[_0x1574('0x1b')]=_0x2feffd;if(_0x159b65[_0x1574('0x2c')][_0x1574('0x3c')]){_0x1b9aa2['include']=[{'all':!![]}];}return db['Variable'][_0x1574('0x3d')](_0x1b9aa2);})[_0x1574('0x20')](function(_0x3a22b2){_0x250c9b[_0x1574('0x3e')]=_0x3a22b2;return _0x250c9b;})['then'](respondWithFilteredResult(_0x2b0f4c,_0x1b9aa2))[_0x1574('0x3f')](handleError(_0x2b0f4c,null));};exports[_0x1574('0x40')]=function(_0x291960,_0x441b11){var _0x228351={'raw':!![],'where':{'id':_0x291960[_0x1574('0x41')]['id']}},_0x13dc27={};_0x13dc27[_0x1574('0x2b')]=_[_0x1574('0x42')](db[_0x1574('0x27')][_0x1574('0x28')]);_0x13dc27[_0x1574('0x2c')]=_[_0x1574('0x42')](_0x291960[_0x1574('0x2c')]);_0x13dc27[_0x1574('0x2d')]=_[_0x1574('0x2e')](_0x13dc27[_0x1574('0x2b')],_0x13dc27[_0x1574('0x2c')]);_0x228351[_0x1574('0x2f')]=_['intersection'](_0x13dc27[_0x1574('0x2b')],qs[_0x1574('0x30')](_0x291960[_0x1574('0x2c')][_0x1574('0x30')]));_0x228351[_0x1574('0x2f')]=_0x228351[_0x1574('0x2f')]['length']?_0x228351['attributes']:_0x13dc27[_0x1574('0x2b')];if(_0x291960[_0x1574('0x2c')][_0x1574('0x3c')]){_0x228351[_0x1574('0x43')]=[{'all':!![]}];}_0x228351=_[_0x1574('0x3a')]({},_0x228351,_0x291960[_0x1574('0x3b')]);return db[_0x1574('0x27')][_0x1574('0x44')](_0x228351)[_0x1574('0x20')](handleEntityNotFound(_0x441b11,null))['then'](respondWithResult(_0x441b11,null))['catch'](handleError(_0x441b11,null));};exports[_0x1574('0x45')]=function(_0x3504b9,_0x3a900b){return db['Variable'][_0x1574('0x45')](_0x3504b9[_0x1574('0x46')],{})[_0x1574('0x20')](function(_0x588b11){var _0x5cffd6=_0x3504b9['user'][_0x1574('0x47')]({'plain':!![]});if(!_0x5cffd6)throw new Error(_0x1574('0x48'));if(_0x5cffd6[_0x1574('0x49')]===_0x1574('0x4a')){var _0x1e5655=_0x588b11[_0x1574('0x47')]({'plain':!![]});var _0x2aade7='Variables';return db['UserProfileSection'][_0x1574('0x44')]({'where':{'name':_0x2aade7,'userProfileId':_0x5cffd6[_0x1574('0x4b')]},'raw':!![]})[_0x1574('0x20')](function(_0x26a2da){if(_0x26a2da&&_0x26a2da['autoAssociation']===0x0){return db[_0x1574('0x4c')][_0x1574('0x45')]({'name':_0x1e5655[_0x1574('0x25')],'resourceId':_0x1e5655['id'],'type':_0x26a2da[_0x1574('0x25')],'sectionId':_0x26a2da['id']},{})[_0x1574('0x20')](function(){return _0x588b11;});}else{return _0x588b11;}})[_0x1574('0x3f')](function(_0x578676){logger[_0x1574('0x23')](_0x1574('0x4d'),_0x578676);throw _0x578676;});}return _0x588b11;})[_0x1574('0x20')](respondWithResult(_0x3a900b,0xc9))[_0x1574('0x3f')](handleError(_0x3a900b,null));};exports[_0x1574('0x1f')]=function(_0x9b2bce,_0x51d34a){if(_0x9b2bce[_0x1574('0x46')]['id']){delete _0x9b2bce['body']['id'];}return db['Variable'][_0x1574('0x44')]({'where':{'id':_0x9b2bce['params']['id']}})[_0x1574('0x20')](handleEntityNotFound(_0x51d34a,null))['then'](saveUpdates(_0x9b2bce[_0x1574('0x46')],null))[_0x1574('0x20')](respondWithResult(_0x51d34a,null))[_0x1574('0x3f')](handleError(_0x51d34a,null));};exports[_0x1574('0x21')]=function(_0x3aa437,_0x2ff71f){return db[_0x1574('0x27')][_0x1574('0x44')]({'where':{'id':_0x3aa437['params']['id']}})[_0x1574('0x20')](handleEntityNotFound(_0x2ff71f,null))[_0x1574('0x20')](removeEntity(_0x2ff71f,null))[_0x1574('0x3f')](handleError(_0x2ff71f,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index dd17609..e811b68 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 _0x3ec0=['request-promise','path','rimraf','../../config/environment','exports','define','Variable','tools_variables','util','api','bluebird'];(function(_0x3a2ee2,_0x59d56b){var _0x1e7d1e=function(_0x815530){while(--_0x815530){_0x3a2ee2['push'](_0x3a2ee2['shift']());}};_0x1e7d1e(++_0x59d56b);}(_0x3ec0,0x152));var _0x03ec=function(_0x432376,_0x54481a){_0x432376=_0x432376-0x0;var _0x2dfdf1=_0x3ec0[_0x432376];return _0x2dfdf1;};'use strict';var _=require('lodash');var util=require(_0x03ec('0x0'));var logger=require('../../config/logger')(_0x03ec('0x1'));var moment=require('moment');var BPromise=require(_0x03ec('0x2'));var rp=require(_0x03ec('0x3'));var fs=require('fs');var path=require(_0x03ec('0x4'));var rimraf=require(_0x03ec('0x5'));var config=require(_0x03ec('0x6'));var attributes=require('./variable.attributes');module[_0x03ec('0x7')]=function(_0x1aed07,_0x22848e){return _0x1aed07[_0x03ec('0x8')](_0x03ec('0x9'),attributes,{'tableName':_0x03ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x27a0=['./variable.attributes','exports','define','Variable','tools_variables','util','../../config/logger','bluebird','../../config/environment'];(function(_0x5b474c,_0x426d87){var _0x273b2c=function(_0x2a3fcf){while(--_0x2a3fcf){_0x5b474c['push'](_0x5b474c['shift']());}};_0x273b2c(++_0x426d87);}(_0x27a0,0x1e2));var _0x027a=function(_0x40872b,_0x294564){_0x40872b=_0x40872b-0x0;var _0x5f3807=_0x27a0[_0x40872b];return _0x5f3807;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var logger=require(_0x027a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x027a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x027a('0x3'));var attributes=require(_0x027a('0x4'));module[_0x027a('0x5')]=function(_0x2be935,_0x4f8ad9){return _0x2be935[_0x027a('0x6')](_0x027a('0x7'),attributes,{'tableName':_0x027a('0x8'),'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 cbe6a7a..987179d 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 _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x395b37,_0x2f1905){var _0x52853e=function(_0x41614f){while(--_0x41614f){_0x395b37['push'](_0x395b37['shift']());}};_0x52853e(++_0x2f1905);}(_0x7217,0x19e));var _0x7721=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x7217[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x391316,_0x2005d9){var _0x16f18f=function(_0x1d37fe){while(--_0x1d37fe){_0x391316['push'](_0x391316['shift']());}};_0x16f18f(++_0x2005d9);}(_0x6aa7,0x178));var _0x76aa=function(_0x4f8909,_0x2a0917){_0x4f8909=_0x4f8909-0x0;var _0x21e68b=_0x6aa7[_0x4f8909];return _0x21e68b;};'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);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 4776103..775c400 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 _0x749c=['exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','/reset','canUpdate','reset','pull','/restart','restart','/migrations','migrations'];(function(_0x5ea952,_0xc78c71){var _0x45d14e=function(_0x7f3429){while(--_0x7f3429){_0x5ea952['push'](_0x5ea952['shift']());}};_0x45d14e(++_0xc78c71);}(_0x749c,0x1bb));var _0xc749=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x749c[_0x41d432];return _0x1650f9;};'use strict';var express=require(_0xc749('0x0'));var router=express[_0xc749('0x1')]();var auth=require(_0xc749('0x2'));var controller=require(_0xc749('0x3'));router[_0xc749('0x4')]('/',controller[_0xc749('0x5')]);router['get'](_0xc749('0x6'),auth[_0xc749('0x7')](),auth['canUpdate'](),controller['fetch']);router['get'](_0xc749('0x8'),auth[_0xc749('0x7')](),auth[_0xc749('0x9')](),controller[_0xc749('0xa')]);router['get']('/pull',auth[_0xc749('0x7')](),auth[_0xc749('0x9')](),controller[_0xc749('0xb')]);router[_0xc749('0x4')](_0xc749('0xc'),auth[_0xc749('0x7')](),controller[_0xc749('0xd')]);router['get'](_0xc749('0xe'),controller[_0xc749('0xf')]);module[_0xc749('0x10')]=router; \ No newline at end of file +var _0x6b37=['isAuthenticated','canUpdate','reset','/pull','pull','/migrations','migrations','express','Router','./version.controller','get','index','/fetch','fetch','/reset'];(function(_0x384373,_0x370cc5){var _0x3a8a25=function(_0x8bb874){while(--_0x8bb874){_0x384373['push'](_0x384373['shift']());}};_0x3a8a25(++_0x370cc5);}(_0x6b37,0x16f));var _0x76b3=function(_0x43ef9b,_0x5ecb6d){_0x43ef9b=_0x43ef9b-0x0;var _0x5abccf=_0x6b37[_0x43ef9b];return _0x5abccf;};'use strict';var express=require(_0x76b3('0x0'));var router=express[_0x76b3('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x76b3('0x2'));router[_0x76b3('0x3')]('/',controller[_0x76b3('0x4')]);router['get'](_0x76b3('0x5'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x76b3('0x6')]);router[_0x76b3('0x3')](_0x76b3('0x7'),auth[_0x76b3('0x8')](),auth[_0x76b3('0x9')](),controller[_0x76b3('0xa')]);router[_0x76b3('0x3')](_0x76b3('0xb'),auth[_0x76b3('0x8')](),auth[_0x76b3('0x9')](),controller[_0x76b3('0xc')]);router[_0x76b3('0x3')]('/restart',auth[_0x76b3('0x8')](),controller['restart']);router['get'](_0x76b3('0xd'),controller[_0x76b3('0xe')]);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 1cdef1c..50f2c9b 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 _0xeea2=['reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','readdirSync','join','server','migrations','replace','.js','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','update','root','index','exports','query','latest','fetch','tags','json','status','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master'];(function(_0x598b78,_0xf4ee7e){var _0x6392fa=function(_0x810353){while(--_0x810353){_0x598b78['push'](_0x598b78['shift']());}};_0x6392fa(++_0xf4ee7e);}(_0xeea2,0x89));var _0x2eea=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xeea2[_0x5f3f88];return _0xd08119;};'use strict';var Umzug=require(_0x2eea('0x0'));var path=require(_0x2eea('0x1'));var fs=require('fs');var _=require(_0x2eea('0x2'));var pkginfo=require(_0x2eea('0x3'))(module,_0x2eea('0x4'));var compareVersions=require(_0x2eea('0x5'));var exec=require(_0x2eea('0x6'))[_0x2eea('0x7')];var db=require(_0x2eea('0x8'))['db'];var config=require('../../config/environment');var pm2=require(_0x2eea('0x9'));var logger=require('../../config/logger')(_0x2eea('0xa'));var git=require('simple-git')(config[_0x2eea('0xb')]);exports[_0x2eea('0xc')]=function(_0x2a9631,_0x1389b3){var _0x28be63={'current':module[_0x2eea('0xd')]['version'],'phonebar':0x2};if(_0x2a9631['query']&&_0x2a9631[_0x2eea('0xe')][_0x2eea('0xf')]){return git[_0x2eea('0x10')]()[_0x2eea('0x11')](function(_0x355383,_0xc55cd1){_0x28be63['latest']=(_0x355383?module['exports'][_0x2eea('0x4')]:_0xc55cd1['latest'])||'2.0.0';return _0x1389b3['status'](0xc8)[_0x2eea('0x12')](_0x28be63);});}else{return _0x1389b3[_0x2eea('0x13')](0xc8)[_0x2eea('0x12')](_0x28be63);}};exports['fetch']=function(_0x5975bd,_0x3a5e28){return git[_0x2eea('0x10')]([_0x2eea('0x14'),_0x2eea('0x15')],function(_0x41019c){if(_0x41019c){logger['error'](_0x41019c);return _0x3a5e28[_0x2eea('0x13')](0x1f4)[_0x2eea('0x12')](_0x41019c);}logger[_0x2eea('0x16')](_0x2eea('0x17'));return _0x3a5e28[_0x2eea('0x13')](0xc8)['json']({'output':_0x2eea('0x18')});});};exports[_0x2eea('0x19')]=function(_0x2c26f7,_0xc1af9e){return git[_0x2eea('0x19')]([_0x2eea('0x1a'),_0x2eea('0x1b')],function(_0x528b43){if(_0x528b43){logger[_0x2eea('0x1c')](_0x528b43);return _0xc1af9e[_0x2eea('0x13')](0x1f4)['json'](_0x528b43);}logger[_0x2eea('0x16')](_0x2eea('0x1d'));return _0xc1af9e['status'](0xc8)['json']({'output':_0x2eea('0x1e')});});};exports['pull']=function(_0x1e1703,_0x57f2e4){exec(_0x2eea('0x1f'),function(_0x54edf4,_0x5c1558,_0x5da295){logger[_0x2eea('0x16')](_0x5c1558);logger[_0x2eea('0x16')](_0x5da295);if(_0x54edf4){logger['error'](_0x54edf4);return _0x57f2e4[_0x2eea('0x13')](0x1f4)['json'](_0x54edf4);}return _0x57f2e4[_0x2eea('0x13')](0xc8)[_0x2eea('0x12')]({'output':_0x5c1558});});};exports[_0x2eea('0x20')]=function(_0x3d78d0,_0x13216c){return pm2[_0x2eea('0x20')]('motion2')[_0x2eea('0x21')](function(_0x5c2314){logger[_0x2eea('0x16')](_0x2eea('0x22'),_0x5c2314);return _0x13216c[_0x2eea('0x13')](0xc8)[_0x2eea('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x2eea('0x23')](function(_0x10db1b){logger[_0x2eea('0x1c')](_0x10db1b);return _0x13216c[_0x2eea('0x13')](0x1f4)[_0x2eea('0x12')](_0x10db1b);});};exports['migrations']=function(_0xdd6120,_0x2ad541){var _0x3f87b7=fs[_0x2eea('0x24')](path[_0x2eea('0x25')](config['root'],_0x2eea('0x26'),_0x2eea('0x27')));var _0x2ee0f4=[];for(var _0x4700ad=0x0;_0x4700ad<_0x3f87b7['length'];_0x4700ad++){var _0x33e539=_0x3f87b7[_0x4700ad][_0x2eea('0x28')](_0x2eea('0x29'),'');if(compareVersions(module[_0x2eea('0xd')]['version'],_0x33e539)===-0x1){_0x2ee0f4['push'](_0x33e539);}}if(_0x2ee0f4[_0x2eea('0x2a')]){var _0xaa3457=_0x2ee0f4[_0x2eea('0x2b')](compareVersions);var _0x39f35a=new Umzug({'storage':_0x2eea('0x2c'),'storageOptions':{'model':db[_0x2eea('0x2d')],'modelName':'Migration','columnName':_0x2eea('0x4')},'migrations':{'params':[db[_0x2eea('0x2c')][_0x2eea('0x2e')](),db[_0x2eea('0x2c')][_0x2eea('0x2f')],function(){throw new Error(_0x2eea('0x30'));}],'path':path[_0x2eea('0x25')](config[_0x2eea('0xb')],_0x2eea('0x26'),_0x2eea('0x27')),'pattern':/\.js$/}});_0x39f35a['up']({'migrations':_[_0x2eea('0x31')](_0xaa3457,function(_0x1962bf){return _0x1962bf+_0x2eea('0x29');})})[_0x2eea('0x21')](function(){return _0x2ad541['status'](0xc8)[_0x2eea('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x2eea('0xd')]['version']+_0x2eea('0x32')+_[_0x2eea('0x33')](_0xaa3457),'migrations':_['join'](_0xaa3457)});})['catch'](function(_0x30e751){if(_0x30e751 instanceof db[_0x2eea('0x2c')][_0x2eea('0x34')]){return _0x2ad541[_0x2eea('0x13')](0xc8)[_0x2eea('0x12')]({'output':_0x2eea('0x35')});}else{return _0x2ad541[_0x2eea('0x13')](0x1f4)['json'](_0x30e751);}});}else{return _0x2ad541['status'](0xc8)[_0x2eea('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x12c4=['../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','root','index','exports','query','tags','latest','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','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','migrations','readdirSync','join','server','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','exec'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x12c4,0xde));var _0x412c=function(_0x25a59a,_0x543efd){_0x25a59a=_0x25a59a-0x0;var _0x352cd0=_0x12c4[_0x25a59a];return _0x352cd0;};'use strict';var Umzug=require(_0x412c('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x412c('0x1'));var pkginfo=require(_0x412c('0x2'))(module,_0x412c('0x3'));var compareVersions=require(_0x412c('0x4'));var exec=require('child_process')[_0x412c('0x5')];var db=require(_0x412c('0x6'))['db'];var config=require(_0x412c('0x7'));var pm2=require(_0x412c('0x8'));var logger=require(_0x412c('0x9'))(_0x412c('0xa'));var git=require('simple-git')(config[_0x412c('0xb')]);exports[_0x412c('0xc')]=function(_0xca6229,_0x374812){var _0x2bbb3d={'current':module[_0x412c('0xd')][_0x412c('0x3')],'phonebar':0x2};if(_0xca6229[_0x412c('0xe')]&&_0xca6229[_0x412c('0xe')]['latest']){return git['fetch']()[_0x412c('0xf')](function(_0x13a96b,_0x5dc969){_0x2bbb3d[_0x412c('0x10')]=(_0x13a96b?module['exports']['version']:_0x5dc969[_0x412c('0x10')])||_0x412c('0x11');return _0x374812[_0x412c('0x12')](0xc8)[_0x412c('0x13')](_0x2bbb3d);});}else{return _0x374812[_0x412c('0x12')](0xc8)['json'](_0x2bbb3d);}};exports[_0x412c('0x14')]=function(_0x2f6b4c,_0x10b068){return git[_0x412c('0x14')]([_0x412c('0x15'),_0x412c('0x16')],function(_0x1e4964){if(_0x1e4964){logger[_0x412c('0x17')](_0x1e4964);return _0x10b068[_0x412c('0x12')](0x1f4)[_0x412c('0x13')](_0x1e4964);}logger[_0x412c('0x18')](_0x412c('0x19'));return _0x10b068[_0x412c('0x12')](0xc8)[_0x412c('0x13')]({'output':_0x412c('0x1a')});});};exports[_0x412c('0x1b')]=function(_0x38c927,_0x24491d){return git[_0x412c('0x1b')]([_0x412c('0x1c'),_0x412c('0x1d')],function(_0x285704){if(_0x285704){logger[_0x412c('0x17')](_0x285704);return _0x24491d[_0x412c('0x12')](0x1f4)[_0x412c('0x13')](_0x285704);}logger['info'](_0x412c('0x1e'));return _0x24491d['status'](0xc8)[_0x412c('0x13')]({'output':_0x412c('0x1f')});});};exports['pull']=function(_0x113090,_0x520050){exec(_0x412c('0x20'),function(_0xc07f57,_0x48163b,_0x1010dc){logger[_0x412c('0x18')](_0x48163b);logger[_0x412c('0x18')](_0x1010dc);if(_0xc07f57){logger[_0x412c('0x17')](_0xc07f57);return _0x520050[_0x412c('0x12')](0x1f4)[_0x412c('0x13')](_0xc07f57);}return _0x520050[_0x412c('0x12')](0xc8)[_0x412c('0x13')]({'output':_0x48163b});});};exports[_0x412c('0x21')]=function(_0x111102,_0x3ea1c6){return pm2[_0x412c('0x21')](_0x412c('0x22'))[_0x412c('0x23')](function(_0x69409b){logger[_0x412c('0x18')](_0x412c('0x24'),_0x69409b);return _0x3ea1c6[_0x412c('0x12')](0xc8)[_0x412c('0x13')]({'output':_0x412c('0x25')});})['catch'](function(_0x297cf4){logger[_0x412c('0x17')](_0x297cf4);return _0x3ea1c6['status'](0x1f4)[_0x412c('0x13')](_0x297cf4);});};exports[_0x412c('0x26')]=function(_0x130fe2,_0xd90fc){var _0x33e978=fs[_0x412c('0x27')](path[_0x412c('0x28')](config[_0x412c('0xb')],_0x412c('0x29'),_0x412c('0x26')));var _0x49f53d=[];for(var _0x29a386=0x0;_0x29a386<_0x33e978['length'];_0x29a386++){var _0x3de4eb=_0x33e978[_0x29a386][_0x412c('0x2a')](_0x412c('0x2b'),'');if(compareVersions(module['exports'][_0x412c('0x3')],_0x3de4eb)===-0x1){_0x49f53d['push'](_0x3de4eb);}}if(_0x49f53d['length']){var _0x72ab2d=_0x49f53d[_0x412c('0x2c')](compareVersions);var _0x4fff48=new Umzug({'storage':_0x412c('0x2d'),'storageOptions':{'model':db[_0x412c('0x2e')],'modelName':_0x412c('0x2e'),'columnName':'version'},'migrations':{'params':[db[_0x412c('0x2d')][_0x412c('0x2f')](),db['sequelize'][_0x412c('0x30')],function(){throw new Error(_0x412c('0x31'));}],'path':path[_0x412c('0x28')](config[_0x412c('0xb')],'server',_0x412c('0x26')),'pattern':/\.js$/}});_0x4fff48['up']({'migrations':_[_0x412c('0x32')](_0x72ab2d,function(_0xadbd1f){return _0xadbd1f+'.js';})})[_0x412c('0x23')](function(){return _0xd90fc[_0x412c('0x12')](0xc8)['json']({'output':_0x412c('0x33')+module[_0x412c('0xd')][_0x412c('0x3')]+_0x412c('0x34')+_[_0x412c('0x35')](_0x72ab2d),'migrations':_[_0x412c('0x28')](_0x72ab2d)});})[_0x412c('0x36')](function(_0x299e46){if(_0x299e46 instanceof db[_0x412c('0x2d')][_0x412c('0x37')]){return _0xd90fc[_0x412c('0x12')](0xc8)[_0x412c('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0xd90fc['status'](0x1f4)[_0x412c('0x13')](_0x299e46);}});}else{return _0xd90fc['status'](0xc8)[_0x412c('0x13')]({'output':_0x412c('0x38')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 75ea13f..4d0c013 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 _0x4513=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','show','post','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5d28e0,_0x4bb9d8){var _0x53a924=function(_0x28b506){while(--_0x28b506){_0x5d28e0['push'](_0x5d28e0['shift']());}};_0x53a924(++_0x4bb9d8);}(_0x4513,0x19e));var _0x3451=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4513[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0x3451('0x0'));var util=require(_0x3451('0x1'));var path=require(_0x3451('0x2'));var timeout=require(_0x3451('0x3'));var express=require(_0x3451('0x4'));var router=express[_0x3451('0x5')]();var fs_extra=require(_0x3451('0x6'));var auth=require(_0x3451('0x7'));var interaction=require(_0x3451('0x8'));var config=require(_0x3451('0x9'));var controller=require(_0x3451('0xa'));router[_0x3451('0xb')]('/',auth[_0x3451('0xc')](),controller[_0x3451('0xd')]);router['get']('/describe',auth[_0x3451('0xc')](),controller[_0x3451('0xe')]);router[_0x3451('0xb')]('/:id',auth[_0x3451('0xc')](),controller[_0x3451('0xf')]);router[_0x3451('0x10')]('/',auth[_0x3451('0xc')](),controller['create']);router[_0x3451('0x11')](_0x3451('0x12'),auth[_0x3451('0xc')](),controller['update']);router[_0x3451('0x13')](_0x3451('0x12'),auth['isAuthenticated'](),controller[_0x3451('0x14')]);module[_0x3451('0x15')]=router; \ No newline at end of file +var _0xda90=['/:id','show','post','create','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x1ba43c,_0x5bd2e8){var _0x2f60eb=function(_0x349dff){while(--_0x349dff){_0x1ba43c['push'](_0x1ba43c['shift']());}};_0x2f60eb(++_0x5bd2e8);}(_0xda90,0x17f));var _0x0da9=function(_0x414b1e,_0x3da40e){_0x414b1e=_0x414b1e-0x0;var _0x24d1d6=_0xda90[_0x414b1e];return _0x24d1d6;};'use strict';var multer=require('multer');var util=require(_0x0da9('0x0'));var path=require(_0x0da9('0x1'));var timeout=require(_0x0da9('0x2'));var express=require(_0x0da9('0x3'));var router=express['Router']();var fs_extra=require(_0x0da9('0x4'));var auth=require(_0x0da9('0x5'));var interaction=require(_0x0da9('0x6'));var config=require('../../config/environment');var controller=require(_0x0da9('0x7'));router[_0x0da9('0x8')]('/',auth['isAuthenticated'](),controller[_0x0da9('0x9')]);router['get'](_0x0da9('0xa'),auth[_0x0da9('0xb')](),controller[_0x0da9('0xc')]);router['get'](_0x0da9('0xd'),auth[_0x0da9('0xb')](),controller[_0x0da9('0xe')]);router[_0x0da9('0xf')]('/',auth[_0x0da9('0xb')](),controller[_0x0da9('0x10')]);router['put'](_0x0da9('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0da9('0xd'),auth[_0x0da9('0xb')](),controller[_0x0da9('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 0c7f96c..de35300 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 _0x87d9=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x3bbda6,_0x4568ef){var _0x11fdcf=function(_0xfb8d31){while(--_0xfb8d31){_0x3bbda6['push'](_0x3bbda6['shift']());}};_0x11fdcf(++_0x4568ef);}(_0x87d9,0x143));var _0x987d=function(_0x336c8b,_0x56b55b){_0x336c8b=_0x336c8b-0x0;var _0x4dd2f6=_0x87d9[_0x336c8b];return _0x4dd2f6;};'use strict';var Sequelize=require(_0x987d('0x0'));module['exports']={'type':{'type':Sequelize[_0x987d('0x1')]},'uniqueid':{'type':Sequelize[_0x987d('0x1')]},'calleridnum':{'type':Sequelize[_0x987d('0x1')]},'calleridname':{'type':Sequelize[_0x987d('0x1')]},'queue':{'type':Sequelize[_0x987d('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x987d('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x987d('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x987d('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x987d('0x2')]},'holdtime':{'type':Sequelize[_0x987d('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x987d('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x987d('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x987d('0x3')]},'agentacw':{'type':Sequelize[_0x987d('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x987d('0x3')]},'reason':{'type':Sequelize[_0x987d('0x1')]},'lastevent':{'type':Sequelize[_0x987d('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x987d('0x3')]},'channelstatedesc':{'type':Sequelize[_0x987d('0x1')]},'connectedlinenum':{'type':Sequelize[_0x987d('0x1')]},'connectedlinename':{'type':Sequelize[_0x987d('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x987d('0x1')]},'context':{'type':Sequelize[_0x987d('0x1')]},'exten':{'type':Sequelize[_0x987d('0x1')]},'priority':{'type':Sequelize[_0x987d('0x1')]},'destchannel':{'type':Sequelize[_0x987d('0x1')]},'destchannelstate':{'type':Sequelize[_0x987d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x987d('0x1')]},'destcalleridnum':{'type':Sequelize[_0x987d('0x1')]},'destcalleridname':{'type':Sequelize[_0x987d('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x987d('0x1')]},'destaccountcode':{'type':Sequelize[_0x987d('0x1')]},'destcontext':{'type':Sequelize[_0x987d('0x1')]},'destexten':{'type':Sequelize[_0x987d('0x1')]},'destpriority':{'type':Sequelize[_0x987d('0x1')]},'destuniqueid':{'type':Sequelize[_0x987d('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x987d('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x987d('0x1')]},'transfer':{'type':Sequelize[_0x987d('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x987d('0x1')],'comment':_0x987d('0x5')},'transferexten':{'type':Sequelize[_0x987d('0x1')]},'transferuniqueid':{'type':Sequelize[_0x987d('0x1')]},'agententerreason':{'type':Sequelize[_0x987d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb9be=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x30d1b5,_0x27ffb9){var _0x572855=function(_0x3f8181){while(--_0x3f8181){_0x30d1b5['push'](_0x30d1b5['shift']());}};_0x572855(++_0x27ffb9);}(_0xb9be,0xc5));var _0xeb9b=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0xb9be[_0x836465];return _0x2150ea;};'use strict';var Sequelize=require(_0xeb9b('0x0'));module[_0xeb9b('0x1')]={'type':{'type':Sequelize[_0xeb9b('0x2')]},'uniqueid':{'type':Sequelize[_0xeb9b('0x2')]},'calleridnum':{'type':Sequelize[_0xeb9b('0x2')]},'calleridname':{'type':Sequelize[_0xeb9b('0x2')]},'queue':{'type':Sequelize[_0xeb9b('0x2')]},'interface':{'type':Sequelize[_0xeb9b('0x2')]},'membername':{'type':Sequelize[_0xeb9b('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xeb9b('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xeb9b('0x3')]},'agentdumpAt':{'type':Sequelize[_0xeb9b('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xeb9b('0x5')]},'agentacw':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xeb9b('0x5')]},'reason':{'type':Sequelize[_0xeb9b('0x2')]},'lastevent':{'type':Sequelize[_0xeb9b('0x2')]},'channel':{'type':Sequelize[_0xeb9b('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xeb9b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xeb9b('0x2')]},'accountcode':{'type':Sequelize[_0xeb9b('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xeb9b('0x2')]},'priority':{'type':Sequelize[_0xeb9b('0x2')]},'destchannel':{'type':Sequelize[_0xeb9b('0x2')]},'destchannelstate':{'type':Sequelize[_0xeb9b('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xeb9b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xeb9b('0x2')]},'destlanguage':{'type':Sequelize[_0xeb9b('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xeb9b('0x2')]},'destuniqueid':{'type':Sequelize[_0xeb9b('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xeb9b('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xeb9b('0x2')]},'transfer':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xeb9b('0x2')],'comment':_0xeb9b('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xeb9b('0x2')]},'agententerreason':{'type':Sequelize[_0xeb9b('0x5')],'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 0ffa47a..73297d6 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(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 8e82dad..1444bcb 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 _0xf2ca=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_agent','uniqueid','lodash','util'];(function(_0x4d641c,_0x22f431){var _0x113068=function(_0x4b27ef){while(--_0x4b27ef){_0x4d641c['push'](_0x4d641c['shift']());}};_0x113068(++_0x22f431);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x318dda,_0x1aa800){_0x318dda=_0x318dda-0x0;var _0x3f97ca=_0xf2ca[_0x318dda];return _0x3f97ca;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('api');var moment=require(_0xaf2c('0x3'));var BPromise=require(_0xaf2c('0x4'));var rp=require(_0xaf2c('0x5'));var fs=require('fs');var path=require(_0xaf2c('0x6'));var rimraf=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0xaf2c('0x9')]=function(_0x100d17,_0x297740){return _0x100d17[_0xaf2c('0xa')]('VoiceAgentReport',attributes,{'tableName':_0xaf2c('0xb'),'paranoid':![],'indexes':[{'fields':[_0xaf2c('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8a28=['destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','uniqueid'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8a28,0xfd));var _0x88a2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8a28[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x88a2('0x0'));var util=require(_0x88a2('0x1'));var logger=require(_0x88a2('0x2'))(_0x88a2('0x3'));var moment=require(_0x88a2('0x4'));var BPromise=require(_0x88a2('0x5'));var rp=require(_0x88a2('0x6'));var fs=require('fs');var path=require(_0x88a2('0x7'));var rimraf=require('rimraf');var config=require(_0x88a2('0x8'));var attributes=require(_0x88a2('0x9'));module[_0x88a2('0xa')]=function(_0x438e32,_0x29ce92){return _0x438e32['define'](_0x88a2('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x88a2('0xc'),_0x88a2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index cb9545e..064dedc 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 _0x6df6=['info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateVoiceAgentReport','VoiceAgentReport','then','UpdateVoiceAgentReport','body','options','raw','where','limit','catch','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','request'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x6df6,0x64));var _0x66df=function(_0xb1174e,_0x1e68a7){_0xb1174e=_0xb1174e-0x0;var _0x285bac=_0x6df6[_0xb1174e];return _0x285bac;};'use strict';var _=require('lodash');var util=require(_0x66df('0x0'));var moment=require(_0x66df('0x1'));var BPromise=require(_0x66df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x66df('0x3'));var db=require(_0x66df('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x66df('0x5'));var config=require(_0x66df('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ba367,_0x475a1d,_0x1e0fac){return new BPromise(function(_0x1b8442,_0x29467c){return client[_0x66df('0x7')](_0x3ba367,_0x1e0fac)['then'](function(_0x17e436){logger[_0x66df('0x8')](_0x66df('0x9'),_0x475a1d,'request\x20sent');logger[_0x66df('0xa')](_0x66df('0xb'),_0x475a1d,_0x66df('0xc'),JSON[_0x66df('0xd')](_0x17e436));if(_0x17e436[_0x66df('0xe')]){if(_0x17e436['error']['code']===0x1f4){logger[_0x66df('0xe')](_0x66df('0x9'),_0x475a1d,_0x17e436[_0x66df('0xe')]['message']);return _0x29467c(_0x17e436[_0x66df('0xe')][_0x66df('0xf')]);}logger[_0x66df('0xe')](_0x66df('0x9'),_0x475a1d,_0x17e436[_0x66df('0xe')]['message']);return _0x1b8442(_0x17e436['error'][_0x66df('0xf')]);}else{logger[_0x66df('0x8')](_0x66df('0x9'),_0x475a1d,_0x66df('0xc'));_0x1b8442(_0x17e436[_0x66df('0x10')]['message']);}})['catch'](function(_0x49a9d0){logger[_0x66df('0xe')](_0x66df('0x9'),_0x475a1d,_0x49a9d0);_0x29467c(_0x49a9d0);});});}exports[_0x66df('0x11')]=function(_0x5c9bfe){var _0x366926=this;return new Promise(function(_0x407fc1,_0x512078){return db[_0x66df('0x12')]['create'](_0x5c9bfe['body'],{'raw':_0x5c9bfe['options']?_0x5c9bfe['options']['raw']===undefined?!![]:![]:!![]})[_0x66df('0x13')](function(_0x415007){logger[_0x66df('0x8')](_0x66df('0x11'),_0x5c9bfe);logger['debug']('CreateVoiceAgentReport',_0x5c9bfe,JSON[_0x66df('0xd')](_0x415007));_0x407fc1(_0x415007);})['catch'](function(_0xd1691b){logger[_0x66df('0xe')]('CreateVoiceAgentReport',_0xd1691b[_0x66df('0xf')],_0x5c9bfe);_0x512078(_0x366926[_0x66df('0xe')](0x1f4,_0xd1691b[_0x66df('0xf')]));});});};exports[_0x66df('0x14')]=function(_0x30e839){var _0x2e45e7=this;return new Promise(function(_0x52f226,_0x51822f){return db[_0x66df('0x12')]['update'](_0x30e839[_0x66df('0x15')],{'raw':_0x30e839[_0x66df('0x16')]?_0x30e839[_0x66df('0x16')][_0x66df('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30e839[_0x66df('0x16')]?_0x30e839['options'][_0x66df('0x18')]||null:null,'attributes':_0x30e839['options']?_0x30e839[_0x66df('0x16')]['attributes']||null:null,'limit':_0x30e839[_0x66df('0x16')]?_0x30e839[_0x66df('0x16')][_0x66df('0x19')]||null:null})[_0x66df('0x13')](function(_0xbf10f7){logger[_0x66df('0x8')]('UpdateVoiceAgentReport',_0x30e839);logger['debug'](_0x66df('0x14'),_0x30e839,JSON[_0x66df('0xd')](_0xbf10f7));_0x52f226(_0xbf10f7);})[_0x66df('0x1a')](function(_0xbbd28d){logger[_0x66df('0xe')](_0x66df('0x14'),_0xbbd28d[_0x66df('0xf')],_0x30e839);_0x51822f(_0x2e45e7[_0x66df('0xe')](0x1f4,_0xbbd28d[_0x66df('0xf')]));});});}; \ No newline at end of file +var _0xbdbc=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','catch','UpdateVoiceAgentReport','body','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x24af69,_0x43b29c){var _0x1740eb=function(_0x3c6012){while(--_0x3c6012){_0x24af69['push'](_0x24af69['shift']());}};_0x1740eb(++_0x43b29c);}(_0xbdbc,0x15a));var _0xcbdb=function(_0x4ec520,_0x15fee2){_0x4ec520=_0x4ec520-0x0;var _0xed49d7=_0xbdbc[_0x4ec520];return _0xed49d7;};'use strict';var _=require(_0xcbdb('0x0'));var util=require(_0xcbdb('0x1'));var moment=require(_0xcbdb('0x2'));var BPromise=require(_0xcbdb('0x3'));var rs=require(_0xcbdb('0x4'));var fs=require('fs');var Redis=require(_0xcbdb('0x5'));var db=require(_0xcbdb('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcbdb('0x7'));var config=require(_0xcbdb('0x8'));var jayson=require(_0xcbdb('0x9'));var client=jayson[_0xcbdb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2152b2,_0x528b42,_0x3bf3c9){return new BPromise(function(_0x273dcf,_0x3b4d6d){return client[_0xcbdb('0xb')](_0x2152b2,_0x3bf3c9)[_0xcbdb('0xc')](function(_0x181783){logger[_0xcbdb('0xd')](_0xcbdb('0xe'),_0x528b42,_0xcbdb('0xf'));logger[_0xcbdb('0x10')](_0xcbdb('0x11'),_0x528b42,'request\x20sent',JSON[_0xcbdb('0x12')](_0x181783));if(_0x181783[_0xcbdb('0x13')]){if(_0x181783['error'][_0xcbdb('0x14')]===0x1f4){logger['error'](_0xcbdb('0xe'),_0x528b42,_0x181783[_0xcbdb('0x13')][_0xcbdb('0x15')]);return _0x3b4d6d(_0x181783['error'][_0xcbdb('0x15')]);}logger[_0xcbdb('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x528b42,_0x181783['error'][_0xcbdb('0x15')]);return _0x273dcf(_0x181783[_0xcbdb('0x13')][_0xcbdb('0x15')]);}else{logger[_0xcbdb('0xd')](_0xcbdb('0xe'),_0x528b42,_0xcbdb('0xf'));_0x273dcf(_0x181783[_0xcbdb('0x16')]['message']);}})['catch'](function(_0x559213){logger[_0xcbdb('0x13')](_0xcbdb('0xe'),_0x528b42,_0x559213);_0x3b4d6d(_0x559213);});});}exports[_0xcbdb('0x17')]=function(_0x450437){var _0xaa3453=this;return new Promise(function(_0x260b83,_0x4c8696){return db[_0xcbdb('0x18')][_0xcbdb('0x19')](_0x450437['body'],{'raw':_0x450437[_0xcbdb('0x1a')]?_0x450437[_0xcbdb('0x1a')][_0xcbdb('0x1b')]===undefined?!![]:![]:!![]})[_0xcbdb('0xc')](function(_0x293b73){logger['info'](_0xcbdb('0x17'),_0x450437);logger[_0xcbdb('0x10')](_0xcbdb('0x17'),_0x450437,JSON[_0xcbdb('0x12')](_0x293b73));_0x260b83(_0x293b73);})[_0xcbdb('0x1c')](function(_0x3eeecd){logger[_0xcbdb('0x13')](_0xcbdb('0x17'),_0x3eeecd['message'],_0x450437);_0x4c8696(_0xaa3453[_0xcbdb('0x13')](0x1f4,_0x3eeecd[_0xcbdb('0x15')]));});});};exports[_0xcbdb('0x1d')]=function(_0x13b14a){var _0x4453d1=this;return new Promise(function(_0x272883,_0x154420){return db[_0xcbdb('0x18')]['update'](_0x13b14a[_0xcbdb('0x1e')],{'raw':_0x13b14a[_0xcbdb('0x1a')]?_0x13b14a[_0xcbdb('0x1a')][_0xcbdb('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13b14a[_0xcbdb('0x1a')]?_0x13b14a[_0xcbdb('0x1a')][_0xcbdb('0x1f')]||null:null,'attributes':_0x13b14a[_0xcbdb('0x1a')]?_0x13b14a['options']['attributes']||null:null,'limit':_0x13b14a[_0xcbdb('0x1a')]?_0x13b14a[_0xcbdb('0x1a')][_0xcbdb('0x20')]||null:null})[_0xcbdb('0xc')](function(_0x4bdba3){logger[_0xcbdb('0xd')](_0xcbdb('0x1d'),_0x13b14a);logger[_0xcbdb('0x10')](_0xcbdb('0x1d'),_0x13b14a,JSON[_0xcbdb('0x12')](_0x4bdba3));_0x272883(_0x4bdba3);})[_0xcbdb('0x1c')](function(_0x53733f){logger['error'](_0xcbdb('0x1d'),_0x53733f[_0xcbdb('0x15')],_0x13b14a);_0x154420(_0x4453d1[_0xcbdb('0x13')](0x1f4,_0x53733f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index d31b365..6d044ef 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 _0x24ca=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x24ca,0x1bc));var _0xa24c=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0x24ca[_0x439d59];return _0x3670c7;};'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')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xb')]);router[_0xa24c('0x9')](_0xa24c('0xc'),auth[_0xa24c('0xa')](),controller['describe']);router[_0xa24c('0x9')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller['show']);router[_0xa24c('0xe')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller[_0xa24c('0x11')]);router[_0xa24c('0x12')](_0xa24c('0xd'),auth['isAuthenticated'](),controller[_0xa24c('0x13')]);module[_0xa24c('0x14')]=router; \ No newline at end of file +var _0xd0bb=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','util','path'];(function(_0x40f945,_0x456b45){var _0x1d7fd1=function(_0x4e99e5){while(--_0x4e99e5){_0x40f945['push'](_0x40f945['shift']());}};_0x1d7fd1(++_0x456b45);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x1eed52,_0x1bb3c1){_0x1eed52=_0x1eed52-0x0;var _0x57782a=_0xd0bb[_0x1eed52];return _0x57782a;};'use strict';var multer=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var path=require(_0xbd0b('0x2'));var timeout=require('connect-timeout');var express=require(_0xbd0b('0x3'));var router=express['Router']();var fs_extra=require(_0xbd0b('0x4'));var auth=require(_0xbd0b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd0b('0x6'));var controller=require('./voiceCallReport.controller');router[_0xbd0b('0x7')]('/',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x9')]);router[_0xbd0b('0x7')](_0xbd0b('0xa'),auth['isAuthenticated'](),controller[_0xbd0b('0xb')]);router[_0xbd0b('0x7')](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbd0b('0xe')]);router[_0xbd0b('0xf')]('/:id',auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x10')]);router['delete'](_0xbd0b('0xc'),auth[_0xbd0b('0x8')](),controller[_0xbd0b('0x11')]);module[_0xbd0b('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 67a99fc..9e82009 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 _0xe5fc=['INTEGER','sequelize','STRING','ENUM','inbound','outbound-fax','TEXT','DATE'];(function(_0x320329,_0x1056bd){var _0x3987ba=function(_0x2c4dc5){while(--_0x2c4dc5){_0x320329['push'](_0x320329['shift']());}};_0x3987ba(++_0x1056bd);}(_0xe5fc,0x109));var _0xce5f=function(_0x270970,_0x1188f3){_0x270970=_0x270970-0x0;var _0x33199c=_0xe5fc[_0x270970];return _0x33199c;};'use strict';var Sequelize=require(_0xce5f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xce5f('0x1')]},'type':{'type':Sequelize[_0xce5f('0x2')](_0xce5f('0x3'),'internal','outbound','inbound-fax',_0xce5f('0x4'),'dialer')},'tag':{'type':Sequelize[_0xce5f('0x1')]},'accountcode':{'type':Sequelize[_0xce5f('0x1')]},'source':{'type':Sequelize[_0xce5f('0x1')]},'destination':{'type':Sequelize[_0xce5f('0x1')]},'destinationcontext':{'type':Sequelize[_0xce5f('0x1')]},'callerid':{'type':Sequelize[_0xce5f('0x1')]},'channel':{'type':Sequelize[_0xce5f('0x1')]},'destinationchannel':{'type':Sequelize[_0xce5f('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xce5f('0x5')]},'starttime':{'type':Sequelize[_0xce5f('0x6')]},'systemanswertime':{'type':Sequelize[_0xce5f('0x6')]},'answertime':{'type':Sequelize[_0xce5f('0x6')]},'endtime':{'type':Sequelize[_0xce5f('0x6')]},'duration':{'type':Sequelize[_0xce5f('0x7')]},'billableseconds':{'type':Sequelize[_0xce5f('0x7')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xce5f('0x1')]},'amaflags':{'type':Sequelize[_0xce5f('0x1')]},'userfield':{'type':Sequelize[_0xce5f('0x1')]},'userDisposition':{'type':Sequelize[_0xce5f('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xce5f('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xce5f('0x1')]},'note':{'type':Sequelize[_0xce5f('0x1')]},'prefix':{'type':Sequelize[_0xce5f('0x1')]},'routeid':{'type':Sequelize[_0xce5f('0x7')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3c91=['INTEGER','sequelize','exports','STRING','internal','outbound','inbound-fax','dialer','TEXT','DATE'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3c91,0x1af));var _0x13c9=function(_0x403f2f,_0x2cc078){_0x403f2f=_0x403f2f-0x0;var _0x2e6bea=_0x3c91[_0x403f2f];return _0x2e6bea;};'use strict';var Sequelize=require(_0x13c9('0x0'));module[_0x13c9('0x1')]={'uniqueid':{'type':Sequelize[_0x13c9('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0x13c9('0x3'),_0x13c9('0x4'),_0x13c9('0x5'),'outbound-fax',_0x13c9('0x6'))},'tag':{'type':Sequelize[_0x13c9('0x2')]},'accountcode':{'type':Sequelize[_0x13c9('0x2')]},'source':{'type':Sequelize[_0x13c9('0x2')]},'destination':{'type':Sequelize[_0x13c9('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x13c9('0x2')]},'destinationchannel':{'type':Sequelize[_0x13c9('0x2')]},'lastapplication':{'type':Sequelize[_0x13c9('0x2')]},'lastdata':{'type':Sequelize[_0x13c9('0x7')]},'starttime':{'type':Sequelize[_0x13c9('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x13c9('0x8')]},'duration':{'type':Sequelize[_0x13c9('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x13c9('0x2')]},'amaflags':{'type':Sequelize[_0x13c9('0x2')]},'userfield':{'type':Sequelize[_0x13c9('0x2')]},'userDisposition':{'type':Sequelize[_0x13c9('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x13c9('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x13c9('0x2')]},'note':{'type':Sequelize[_0x13c9('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x13c9('0x9')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index b4211fe..9284127 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 _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x239e5a,_0x2defe1){var _0x3669e2=function(_0x1b89cb){while(--_0x1b89cb){_0x239e5a['push'](_0x239e5a['shift']());}};_0x3669e2(++_0x2defe1);}(_0xb10b,0x12a));var _0xbb10=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0xb10b[_0x2d91c6];return _0x3a8d19;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file +var _0xadb5=['filter','VIRTUAL','merge','options','includeAll','include','fullname','User','findAll','rows','show','rawAttributes','length','find','catch','body','params','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters'];(function(_0x37ae26,_0x2ecd70){var _0x1b1902=function(_0x5a6ae0){while(--_0x5a6ae0){_0x37ae26['push'](_0x37ae26['shift']());}};_0x1b1902(++_0x2ecd70);}(_0xadb5,0xad));var _0x5adb=function(_0x51c59e,_0x1dbcd2){_0x51c59e=_0x51c59e-0x0;var _0x448533=_0xadb5[_0x51c59e];return _0x448533;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['VoiceCallReport']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'attributes':['id',_0x5adb('0x26'),_0x5adb('0x40'),'alias'],'model':db['User'],'as':_0x5adb('0x41')}];}return db['VoiceCallReport'][_0x5adb('0x42')](_0x5d457e);})[_0x5adb('0x22')](function(_0x299746){_0x1eac55[_0x5adb('0x43')]=_0x299746;return _0x1eac55;})[_0x5adb('0x22')](respondWithFilteredResult(_0x49992e,_0x5d457e))['catch'](handleError(_0x49992e,null));};exports[_0x5adb('0x44')]=function(_0x565b03,_0x508690){var _0x4160ad={'raw':!![],'where':{'id':_0x565b03['params']['id']}},_0x1a256c={};_0x1a256c[_0x5adb('0x2e')]=_[_0x5adb('0x30')](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x1a256c[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x565b03[_0x5adb('0x2f')]);_0x1a256c['filters']=_['intersection'](_0x1a256c[_0x5adb('0x2e')],_0x1a256c[_0x5adb('0x2f')]);_0x4160ad[_0x5adb('0x32')]=_[_0x5adb('0x31')](_0x1a256c['model'],qs['fields'](_0x565b03[_0x5adb('0x2f')][_0x5adb('0x33')]));_0x4160ad[_0x5adb('0x32')]=_0x4160ad[_0x5adb('0x32')][_0x5adb('0x46')]?_0x4160ad['attributes']:_0x1a256c[_0x5adb('0x2e')];if(_0x565b03[_0x5adb('0x2f')]['includeAll']){_0x4160ad[_0x5adb('0x3f')]=[{'all':!![]}];}_0x4160ad=_[_0x5adb('0x3c')]({},_0x4160ad,_0x565b03[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')][_0x5adb('0x47')](_0x4160ad)[_0x5adb('0x22')](handleEntityNotFound(_0x508690,null))[_0x5adb('0x22')](respondWithResult(_0x508690,null))[_0x5adb('0x48')](handleError(_0x508690,null));};exports['create']=function(_0x3a925b,_0x57dc8b){return db['VoiceCallReport']['create'](_0x3a925b[_0x5adb('0x49')],{})[_0x5adb('0x22')](respondWithResult(_0x57dc8b,0xc9))[_0x5adb('0x48')](handleError(_0x57dc8b,null));};exports['destroy']=function(_0x2ad69d,_0x5cbab5){return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'id':_0x2ad69d[_0x5adb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5cbab5,null))[_0x5adb('0x22')](removeEntity(_0x5cbab5,null))['catch'](handleError(_0x5cbab5,null));};exports[_0x5adb('0x4b')]=function(_0x6dc067,_0x55c535){return db[_0x5adb('0x2a')][_0x5adb('0x4b')]()[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x48')](handleError(_0x55c535,null));};exports[_0x5adb('0x21')]=function(_0x4cb36c,_0x36b847){if(_0x4cb36c[_0x5adb('0x49')][_0x5adb('0x4c')]){delete _0x4cb36c[_0x5adb('0x49')]['uniqueid'];}return db[_0x5adb('0x2a')][_0x5adb('0x47')]({'where':{'uniqueid':_0x4cb36c[_0x5adb('0x4a')]['id'],'UserId':{'$or':[null,_0x4cb36c['user']['id']]}}})[_0x5adb('0x22')](handleEntityNotFound(_0x36b847,null))[_0x5adb('0x22')](saveUpdates(_0x4cb36c[_0x5adb('0x49')],null))[_0x5adb('0x22')](respondWithResult(_0x36b847,null))['catch'](handleError(_0x36b847,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index cca63e8..db87e4d 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 _0x7a35=['./voiceCallReport.attributes','define','uniqueid','lodash','api','moment','bluebird','path','../../config/environment'];(function(_0x10be5b,_0x252653){var _0x223763=function(_0x51b089){while(--_0x51b089){_0x10be5b['push'](_0x10be5b['shift']());}};_0x223763(++_0x252653);}(_0x7a35,0x1d7));var _0x57a3=function(_0xc106ce,_0x2c20cc){_0xc106ce=_0xc106ce-0x0;var _0x55260c=_0x7a35[_0xc106ce];return _0x55260c;};'use strict';var _=require(_0x57a3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x57a3('0x1'));var moment=require(_0x57a3('0x2'));var BPromise=require(_0x57a3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x57a3('0x4'));var rimraf=require('rimraf');var config=require(_0x57a3('0x5'));var attributes=require(_0x57a3('0x6'));module['exports']=function(_0x1c9ba4,_0x1b5011){return _0x1c9ba4[_0x57a3('0x7')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x57a3('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4dfb=['../../config/logger','api','moment','bluebird','request-promise','path','./voiceCallReport.attributes','exports','define','report_call','uniqueid','util'];(function(_0x1a80a8,_0x38fd21){var _0x37fd38=function(_0x4975d8){while(--_0x4975d8){_0x1a80a8['push'](_0x1a80a8['shift']());}};_0x37fd38(++_0x38fd21);}(_0x4dfb,0x6b));var _0xb4df=function(_0x5bd749,_0x2d9af1){_0x5bd749=_0x5bd749-0x0;var _0x324695=_0x4dfb[_0x5bd749];return _0x324695;};'use strict';var _=require('lodash');var util=require(_0xb4df('0x0'));var logger=require(_0xb4df('0x1'))(_0xb4df('0x2'));var moment=require(_0xb4df('0x3'));var BPromise=require(_0xb4df('0x4'));var rp=require(_0xb4df('0x5'));var fs=require('fs');var path=require(_0xb4df('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb4df('0x7'));module[_0xb4df('0x8')]=function(_0x56950e,_0x34e304){return _0x56950e[_0xb4df('0x9')]('VoiceCallReport',attributes,{'tableName':_0xb4df('0xa'),'paranoid':![],'indexes':[{'fields':[_0xb4df('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 3993d40..15ed6e2 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 _0x6294=['../../config/utils','../../config/logger','../../config/environment','client','http','request','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','include','map','model','debug','catch','CreateVoiceCallReport','then','UpdateVoiceCallReport','body','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3886b0,_0x3bf4e4){var _0x17f99d=function(_0x209441){while(--_0x209441){_0x3886b0['push'](_0x3886b0['shift']());}};_0x17f99d(++_0x3bf4e4);}(_0x6294,0x1e7));var _0x4629=function(_0x5186c7,_0x2cd0c5){_0x5186c7=_0x5186c7-0x0;var _0x27f5f0=_0x6294[_0x5186c7];return _0x27f5f0;};'use strict';var _=require(_0x4629('0x0'));var util=require(_0x4629('0x1'));var moment=require(_0x4629('0x2'));var BPromise=require(_0x4629('0x3'));var rs=require(_0x4629('0x4'));var fs=require('fs');var Redis=require(_0x4629('0x5'));var db=require(_0x4629('0x6'))['db'];var utils=require(_0x4629('0x7'));var logger=require(_0x4629('0x8'))('rpc');var config=require(_0x4629('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4629('0xa')][_0x4629('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3facd0,_0x33c523,_0x47d942){return new BPromise(function(_0x43de24,_0x1675a7){return client[_0x4629('0xc')](_0x3facd0,_0x47d942)['then'](function(_0x411b1e){logger['info'](_0x4629('0xd'),_0x33c523,'request\x20sent');logger['debug'](_0x4629('0xe'),_0x33c523,_0x4629('0xf'),JSON[_0x4629('0x10')](_0x411b1e));if(_0x411b1e[_0x4629('0x11')]){if(_0x411b1e[_0x4629('0x11')][_0x4629('0x12')]===0x1f4){logger[_0x4629('0x11')](_0x4629('0xd'),_0x33c523,_0x411b1e[_0x4629('0x11')][_0x4629('0x13')]);return _0x1675a7(_0x411b1e[_0x4629('0x11')][_0x4629('0x13')]);}logger[_0x4629('0x11')](_0x4629('0xd'),_0x33c523,_0x411b1e['error'][_0x4629('0x13')]);return _0x43de24(_0x411b1e[_0x4629('0x11')][_0x4629('0x13')]);}else{logger[_0x4629('0x14')](_0x4629('0xd'),_0x33c523,_0x4629('0xf'));_0x43de24(_0x411b1e[_0x4629('0x15')]['message']);}})['catch'](function(_0x4dc6e9){logger[_0x4629('0x11')](_0x4629('0xd'),_0x33c523,_0x4dc6e9);_0x1675a7(_0x4dc6e9);});});}exports[_0x4629('0x16')]=function(_0x2d9500){var _0x5a1b5d=this;return new Promise(function(_0x28c866,_0x535ad8){return db[_0x4629('0x17')][_0x4629('0x18')]({'raw':_0x2d9500[_0x4629('0x19')]?_0x2d9500[_0x4629('0x19')][_0x4629('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d9500[_0x4629('0x19')]?_0x2d9500[_0x4629('0x19')]['where']||null:null,'attributes':_0x2d9500[_0x4629('0x19')]?_0x2d9500['options'][_0x4629('0x1b')]||null:null,'limit':_0x2d9500[_0x4629('0x19')]?_0x2d9500['options']['limit']||null:null,'include':_0x2d9500[_0x4629('0x19')]?_0x2d9500[_0x4629('0x19')][_0x4629('0x1c')]?_[_0x4629('0x1d')](_0x2d9500[_0x4629('0x19')][_0x4629('0x1c')],function(_0x23eebd){return{'model':db[_0x23eebd[_0x4629('0x1e')]],'as':_0x23eebd['as'],'attributes':_0x23eebd['attributes'],'include':_0x23eebd[_0x4629('0x1c')]?_[_0x4629('0x1d')](_0x23eebd['include'],function(_0x16dec8){return{'model':db[_0x16dec8[_0x4629('0x1e')]],'as':_0x16dec8['as'],'attributes':_0x16dec8[_0x4629('0x1b')],'include':_0x16dec8[_0x4629('0x1c')]?_[_0x4629('0x1d')](_0x16dec8[_0x4629('0x1c')],function(_0x2f82b9){return{'model':db[_0x2f82b9[_0x4629('0x1e')]],'as':_0x2f82b9['as'],'attributes':_0x2f82b9[_0x4629('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c005f){logger[_0x4629('0x14')](_0x4629('0x16'),_0x2d9500);logger[_0x4629('0x1f')](_0x4629('0x16'),_0x2d9500,JSON[_0x4629('0x10')](_0x5c005f));_0x28c866(_0x5c005f);})[_0x4629('0x20')](function(_0x312039){logger['error'](_0x4629('0x16'),_0x312039[_0x4629('0x13')],_0x2d9500);_0x535ad8(_0x5a1b5d[_0x4629('0x11')](0x1f4,_0x312039['message']));});});};exports[_0x4629('0x21')]=function(_0xc6afbb){var _0x5a8e1f=this;return new Promise(function(_0x3a2051,_0x5aabfa){return db[_0x4629('0x17')]['create'](_0xc6afbb['body'],{'raw':_0xc6afbb[_0x4629('0x19')]?_0xc6afbb[_0x4629('0x19')][_0x4629('0x1a')]===undefined?!![]:![]:!![]})[_0x4629('0x22')](function(_0x6e6cef){logger['info']('CreateVoiceCallReport',_0xc6afbb);logger['debug'](_0x4629('0x21'),_0xc6afbb,JSON[_0x4629('0x10')](_0x6e6cef));_0x3a2051(_0x6e6cef);})[_0x4629('0x20')](function(_0x32f0a7){logger[_0x4629('0x11')](_0x4629('0x21'),_0x32f0a7[_0x4629('0x13')],_0xc6afbb);_0x5aabfa(_0x5a8e1f[_0x4629('0x11')](0x1f4,_0x32f0a7['message']));});});};exports[_0x4629('0x23')]=function(_0x30af5c){var _0x40df0d=this;return new Promise(function(_0x283636,_0x33bc5b){return db[_0x4629('0x17')]['update'](_0x30af5c[_0x4629('0x24')],{'raw':_0x30af5c['options']?_0x30af5c['options'][_0x4629('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30af5c[_0x4629('0x19')]?_0x30af5c[_0x4629('0x19')]['where']||null:null,'attributes':_0x30af5c[_0x4629('0x19')]?_0x30af5c['options'][_0x4629('0x1b')]||null:null,'limit':_0x30af5c[_0x4629('0x19')]?_0x30af5c[_0x4629('0x19')][_0x4629('0x25')]||null:null})[_0x4629('0x22')](function(_0x184f98){logger[_0x4629('0x14')](_0x4629('0x23'),_0x30af5c);logger['debug']('UpdateVoiceCallReport',_0x30af5c,JSON[_0x4629('0x10')](_0x184f98));_0x283636(_0x184f98);})['catch'](function(_0x2311b8){logger[_0x4629('0x11')]('UpdateVoiceCallReport',_0x2311b8[_0x4629('0x13')],_0x30af5c);_0x33bc5b(_0x40df0d[_0x4629('0x11')](0x1f4,_0x2311b8[_0x4629('0x13')]));});});}; \ No newline at end of file +var _0xd891=['VoiceCallReport,\x20%s,\x20%s,\x20%s','code','message','error','info','result','catch','GetVoiceCallReport','options','raw','attributes','limit','include','model','map','stringify','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1b41a0,_0x24e232){var _0x5e5e27=function(_0x33c16f){while(--_0x33c16f){_0x1b41a0['push'](_0x1b41a0['shift']());}};_0x5e5e27(++_0x24e232);}(_0xd891,0x137));var _0x1d89=function(_0x578749,_0x3c172b){_0x578749=_0x578749-0x0;var _0x572117=_0xd891[_0x578749];return _0x572117;};'use strict';var _=require(_0x1d89('0x0'));var util=require(_0x1d89('0x1'));var moment=require('moment');var BPromise=require(_0x1d89('0x2'));var rs=require(_0x1d89('0x3'));var fs=require('fs');var Redis=require(_0x1d89('0x4'));var db=require(_0x1d89('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d89('0x6'))('rpc');var config=require(_0x1d89('0x7'));var jayson=require(_0x1d89('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fd494,_0x5b9592,_0x50ef93){return new BPromise(function(_0x2a2301,_0x3a4860){return client['request'](_0x3fd494,_0x50ef93)[_0x1d89('0x9')](function(_0x3ceadf){logger['info'](_0x1d89('0xa'),_0x5b9592,_0x1d89('0xb'));logger[_0x1d89('0xc')](_0x1d89('0xd'),_0x5b9592,_0x1d89('0xb'),JSON['stringify'](_0x3ceadf));if(_0x3ceadf['error']){if(_0x3ceadf['error'][_0x1d89('0xe')]===0x1f4){logger['error'](_0x1d89('0xa'),_0x5b9592,_0x3ceadf['error'][_0x1d89('0xf')]);return _0x3a4860(_0x3ceadf[_0x1d89('0x10')][_0x1d89('0xf')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x5b9592,_0x3ceadf['error']['message']);return _0x2a2301(_0x3ceadf['error'][_0x1d89('0xf')]);}else{logger[_0x1d89('0x11')](_0x1d89('0xa'),_0x5b9592,'request\x20sent');_0x2a2301(_0x3ceadf[_0x1d89('0x12')][_0x1d89('0xf')]);}})[_0x1d89('0x13')](function(_0x1e80e5){logger[_0x1d89('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x5b9592,_0x1e80e5);_0x3a4860(_0x1e80e5);});});}exports[_0x1d89('0x14')]=function(_0x20193a){var _0x6aa988=this;return new Promise(function(_0x45ff2d,_0x572e55){return db['VoiceCallReport']['findAll']({'raw':_0x20193a[_0x1d89('0x15')]?_0x20193a[_0x1d89('0x15')][_0x1d89('0x16')]===undefined?!![]:![]:!![],'where':_0x20193a[_0x1d89('0x15')]?_0x20193a[_0x1d89('0x15')]['where']||null:null,'attributes':_0x20193a['options']?_0x20193a[_0x1d89('0x15')][_0x1d89('0x17')]||null:null,'limit':_0x20193a['options']?_0x20193a[_0x1d89('0x15')][_0x1d89('0x18')]||null:null,'include':_0x20193a[_0x1d89('0x15')]?_0x20193a[_0x1d89('0x15')][_0x1d89('0x19')]?_['map'](_0x20193a['options'][_0x1d89('0x19')],function(_0x569eec){return{'model':db[_0x569eec[_0x1d89('0x1a')]],'as':_0x569eec['as'],'attributes':_0x569eec[_0x1d89('0x17')],'include':_0x569eec[_0x1d89('0x19')]?_['map'](_0x569eec[_0x1d89('0x19')],function(_0x3312f0){return{'model':db[_0x3312f0[_0x1d89('0x1a')]],'as':_0x3312f0['as'],'attributes':_0x3312f0[_0x1d89('0x17')],'include':_0x3312f0[_0x1d89('0x19')]?_[_0x1d89('0x1b')](_0x3312f0[_0x1d89('0x19')],function(_0x3f6dfd){return{'model':db[_0x3f6dfd[_0x1d89('0x1a')]],'as':_0x3f6dfd['as'],'attributes':_0x3f6dfd[_0x1d89('0x17')]};}):[]};}):[]};}):[]:[]})[_0x1d89('0x9')](function(_0x4330af){logger[_0x1d89('0x11')](_0x1d89('0x14'),_0x20193a);logger[_0x1d89('0xc')](_0x1d89('0x14'),_0x20193a,JSON[_0x1d89('0x1c')](_0x4330af));_0x45ff2d(_0x4330af);})[_0x1d89('0x13')](function(_0x3a77d8){logger[_0x1d89('0x10')]('GetVoiceCallReport',_0x3a77d8[_0x1d89('0xf')],_0x20193a);_0x572e55(_0x6aa988[_0x1d89('0x10')](0x1f4,_0x3a77d8[_0x1d89('0xf')]));});});};exports[_0x1d89('0x1d')]=function(_0x19a3ee){var _0x36d746=this;return new Promise(function(_0x48c434,_0x33ea99){return db[_0x1d89('0x1e')][_0x1d89('0x1f')](_0x19a3ee[_0x1d89('0x20')],{'raw':_0x19a3ee[_0x1d89('0x15')]?_0x19a3ee[_0x1d89('0x15')][_0x1d89('0x16')]===undefined?!![]:![]:!![]})[_0x1d89('0x9')](function(_0x20f6e5){logger[_0x1d89('0x11')](_0x1d89('0x1d'),_0x19a3ee);logger['debug']('CreateVoiceCallReport',_0x19a3ee,JSON[_0x1d89('0x1c')](_0x20f6e5));_0x48c434(_0x20f6e5);})[_0x1d89('0x13')](function(_0x19f53e){logger[_0x1d89('0x10')](_0x1d89('0x1d'),_0x19f53e['message'],_0x19a3ee);_0x33ea99(_0x36d746[_0x1d89('0x10')](0x1f4,_0x19f53e[_0x1d89('0xf')]));});});};exports[_0x1d89('0x21')]=function(_0x599609){var _0x172361=this;return new Promise(function(_0x125b6e,_0x52dce3){return db['VoiceCallReport'][_0x1d89('0x22')](_0x599609[_0x1d89('0x20')],{'raw':_0x599609[_0x1d89('0x15')]?_0x599609[_0x1d89('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x599609[_0x1d89('0x15')]?_0x599609['options'][_0x1d89('0x23')]||null:null,'attributes':_0x599609[_0x1d89('0x15')]?_0x599609[_0x1d89('0x15')]['attributes']||null:null,'limit':_0x599609['options']?_0x599609['options'][_0x1d89('0x18')]||null:null})['then'](function(_0x584cd7){logger[_0x1d89('0x11')](_0x1d89('0x21'),_0x599609);logger[_0x1d89('0xc')](_0x1d89('0x21'),_0x599609,JSON['stringify'](_0x584cd7));_0x125b6e(_0x584cd7);})['catch'](function(_0x2fbe2d){logger[_0x1d89('0x10')](_0x1d89('0x21'),_0x2fbe2d[_0x1d89('0xf')],_0x599609);_0x52dce3(_0x172361['error'](0x1f4,_0x2fbe2d[_0x1d89('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 45c766d..7e8d048 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 _0xe475=['/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index'];(function(_0x3e700d,_0x222e29){var _0x529259=function(_0x34d29d){while(--_0x34d29d){_0x3e700d['push'](_0x3e700d['shift']());}};_0x529259(++_0x222e29);}(_0xe475,0xa8));var _0x5e47=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe475[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5e47('0x0'));var util=require(_0x5e47('0x1'));var path=require(_0x5e47('0x2'));var timeout=require(_0x5e47('0x3'));var express=require(_0x5e47('0x4'));var router=express[_0x5e47('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5e47('0x6'));var config=require(_0x5e47('0x7'));var controller=require(_0x5e47('0x8'));router[_0x5e47('0x9')]('/',auth[_0x5e47('0xa')](),controller[_0x5e47('0xb')]);router[_0x5e47('0x9')](_0x5e47('0xc'),auth['isAuthenticated'](),controller[_0x5e47('0xd')]);router['post']('/',auth[_0x5e47('0xa')](),controller[_0x5e47('0xe')]);router[_0x5e47('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5e47('0x10')]);router[_0x5e47('0x11')]('/:id',auth[_0x5e47('0xa')](),controller[_0x5e47('0x12')]);module[_0x5e47('0x13')]=router; \ No newline at end of file +var _0x8e9e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra'];(function(_0x38c7e3,_0x34b4bc){var _0x34b66f=function(_0x46c913){while(--_0x46c913){_0x38c7e3['push'](_0x38c7e3['shift']());}};_0x34b66f(++_0x34b4bc);}(_0x8e9e,0x1d7));var _0xe8e9=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x8e9e[_0x34bf97];return _0x292719;};'use strict';var multer=require('multer');var util=require(_0xe8e9('0x0'));var path=require('path');var timeout=require(_0xe8e9('0x1'));var express=require('express');var router=express[_0xe8e9('0x2')]();var fs_extra=require(_0xe8e9('0x3'));var auth=require(_0xe8e9('0x4'));var interaction=require(_0xe8e9('0x5'));var config=require(_0xe8e9('0x6'));var controller=require(_0xe8e9('0x7'));router[_0xe8e9('0x8')]('/',auth['isAuthenticated'](),controller[_0xe8e9('0x9')]);router[_0xe8e9('0x8')](_0xe8e9('0xa'),auth[_0xe8e9('0xb')](),controller['show']);router[_0xe8e9('0xc')]('/',auth[_0xe8e9('0xb')](),controller[_0xe8e9('0xd')]);router[_0xe8e9('0xe')]('/:id',auth[_0xe8e9('0xb')](),controller[_0xe8e9('0xf')]);router[_0xe8e9('0x10')](_0xe8e9('0xa'),auth['isAuthenticated'](),controller[_0xe8e9('0x11')]);module[_0xe8e9('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 33ed367..f436e64 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 _0x01c6=['join','getDataValue','split','BOOLEAN','sequelize','STRING','name','setDataValue','options'];(function(_0x31a39f,_0x368fd5){var _0x81cde=function(_0x1998a0){while(--_0x1998a0){_0x31a39f['push'](_0x31a39f['shift']());}};_0x81cde(++_0x368fd5);}(_0x01c6,0xa6));var _0x601c=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0x01c6[_0x4bacb6];return _0x58c029;};'use strict';var Sequelize=require(_0x601c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x601c('0x1')],'unique':_0x601c('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x601c('0x1')],'set':function(_0x1ba517){this[_0x601c('0x3')](_0x601c('0x4'),_0x1ba517?_0x1ba517[_0x601c('0x5')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0x601c('0x6')](_0x601c('0x4'))[_0x601c('0x7')](''):[];}},'auth':{'type':Sequelize[_0x601c('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x601c('0x1')]},'record':{'type':Sequelize[_0x601c('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x601c('0x1')]},'description':{'type':Sequelize[_0x601c('0x1')]}}; \ No newline at end of file +var _0x8e38=['name','join','getDataValue','options','BOOLEAN','sequelize','exports','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8e38,0xfd));var _0x88e3=function(_0x5124de,_0x3f6728){_0x5124de=_0x5124de-0x0;var _0x5f2121=_0x8e38[_0x5124de];return _0x5f2121;};'use strict';var Sequelize=require(_0x88e3('0x0'));module[_0x88e3('0x1')]={'name':{'type':Sequelize[_0x88e3('0x2')]},'prefix':{'type':Sequelize[_0x88e3('0x2')],'unique':_0x88e3('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x88e3('0x2')],'set':function(_0x53c40d){this['setDataValue']('options',_0x53c40d?_0x53c40d[_0x88e3('0x4')](''):[]);},'get':function(){return this[_0x88e3('0x5')](_0x88e3('0x6'))?this[_0x88e3('0x5')](_0x88e3('0x6'))['split'](''):[];}},'auth':{'type':Sequelize[_0x88e3('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x88e3('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x88e3('0x2')]},'description':{'type':Sequelize[_0x88e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 9098de2..29163f5 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 _0x74b1=['merge','options','VoiceChanSpy','includeAll','include','show','params','find','catch','create','body','user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL'];(function(_0x2e48b0,_0xc0acb6){var _0x3d2d42=function(_0x5b31e2){while(--_0x5b31e2){_0x2e48b0['push'](_0x2e48b0['shift']());}};_0x3d2d42(++_0xc0acb6);}(_0x74b1,0xb5));var _0x174b=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0x74b1[_0x587693];return _0x510a1a;};'use strict';var emlformat=require(_0x174b('0x0'));var rimraf=require(_0x174b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x174b('0x2'));var rp=require(_0x174b('0x3'));var moment=require('moment');var BPromise=require(_0x174b('0x4'));var Mustache=require(_0x174b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x174b('0x6'));var ejs=require(_0x174b('0x7'));var fs=require('fs');var fs_extra=require(_0x174b('0x8'));var _=require('lodash');var squel=require(_0x174b('0x9'));var crypto=require(_0x174b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x174b('0x6'));var querystring=require('querystring');var Papa=require(_0x174b('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x174b('0xc'));var as=require(_0x174b('0xd'));var hardwareService=require(_0x174b('0xe'));var logger=require(_0x174b('0xf'))(_0x174b('0x10'));var utils=require(_0x174b('0x11'));var config=require(_0x174b('0x12'));var licenseUtil=require(_0x174b('0x13'));var db=require(_0x174b('0x14'))['db'];function respondWithStatusCode(_0x4ea947,_0x70fa85){_0x70fa85=_0x70fa85||0xcc;return function(_0xc996e){if(_0xc996e){return _0x4ea947[_0x174b('0x15')](_0x70fa85);}return _0x4ea947[_0x174b('0x16')](_0x70fa85)[_0x174b('0x17')]();};}function respondWithResult(_0x44b778,_0xe9c224){_0xe9c224=_0xe9c224||0xc8;return function(_0x43143b){if(_0x43143b){return _0x44b778[_0x174b('0x16')](_0xe9c224)['json'](_0x43143b);}};}function respondWithFilteredResult(_0x1c5579,_0xde8235){return function(_0x210a3c){if(_0x210a3c){var _0x4a7aeb=typeof _0xde8235['offset']===_0x174b('0x18')&&typeof _0xde8235[_0x174b('0x19')]===_0x174b('0x18');var _0x209dd4=_0x210a3c[_0x174b('0x1a')];var _0x31f801=_0x4a7aeb?0x0:_0xde8235['offset'];var _0x1049dc=_0x4a7aeb?_0x210a3c[_0x174b('0x1a')]:_0xde8235[_0x174b('0x1b')]+_0xde8235[_0x174b('0x19')];var _0x2bef75;if(_0x1049dc>=_0x209dd4){_0x1049dc=_0x209dd4;_0x2bef75=0xc8;}else{_0x2bef75=0xce;}_0x1c5579[_0x174b('0x16')](_0x2bef75);return _0x1c5579[_0x174b('0x1c')](_0x174b('0x1d'),_0x31f801+'-'+_0x1049dc+'/'+_0x209dd4)[_0x174b('0x1e')](_0x210a3c);}return null;};}function patchUpdates(_0x1458a1){return function(_0x4e58f0){try{jsonpatch[_0x174b('0x1f')](_0x4e58f0,_0x1458a1,!![]);}catch(_0x49d32e){return BPromise['reject'](_0x49d32e);}return _0x4e58f0[_0x174b('0x20')]();};}function saveUpdates(_0x568b3f,_0x537ac3){return function(_0x2c09ad){if(_0x2c09ad){return _0x2c09ad[_0x174b('0x21')](_0x568b3f)[_0x174b('0x22')](function(_0x55f2ac){return _0x55f2ac;});}return null;};}function removeEntity(_0x150304,_0x4da1da){return function(_0x3b57c5){if(_0x3b57c5){return _0x3b57c5[_0x174b('0x23')]()[_0x174b('0x22')](function(){var _0x294aac=_0x3b57c5[_0x174b('0x24')]({'plain':!![]});var _0x242295='ChanSpies';return db['UserProfileResource'][_0x174b('0x23')]({'where':{'type':_0x242295,'resourceId':_0x294aac['id']}})[_0x174b('0x22')](function(){return _0x3b57c5;});})[_0x174b('0x22')](function(){_0x150304[_0x174b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x276384,_0x3215bd){return function(_0x583b0c){if(!_0x583b0c){_0x276384[_0x174b('0x15')](0x194);}return _0x583b0c;};}function handleError(_0x2eb1cb,_0x17a237){_0x17a237=_0x17a237||0x1f4;return function(_0x50f947){logger[_0x174b('0x25')](_0x50f947[_0x174b('0x26')]);if(_0x50f947['name']){delete _0x50f947[_0x174b('0x27')];}_0x2eb1cb['status'](_0x17a237)[_0x174b('0x28')](_0x50f947);};}exports[_0x174b('0x29')]=function(_0x220206,_0x3e6fb0){var _0x2a7ec2={},_0x580731={},_0x22bf34={'count':0x0,'rows':[]};var _0x3a72a9=_[_0x174b('0x2a')](db['VoiceChanSpy'][_0x174b('0x2b')],function(_0x146a08){return{'name':_0x146a08[_0x174b('0x2c')],'type':_0x146a08['type'][_0x174b('0x2d')]};});_0x580731['model']=_['map'](_0x3a72a9,_0x174b('0x27'));_0x580731[_0x174b('0x2e')]=_[_0x174b('0x2f')](_0x220206[_0x174b('0x2e')]);_0x580731['filters']=_[_0x174b('0x30')](_0x580731[_0x174b('0x31')],_0x580731[_0x174b('0x2e')]);_0x2a7ec2[_0x174b('0x32')]=_[_0x174b('0x30')](_0x580731[_0x174b('0x31')],qs[_0x174b('0x33')](_0x220206['query'][_0x174b('0x33')]));_0x2a7ec2['attributes']=_0x2a7ec2['attributes'][_0x174b('0x34')]?_0x2a7ec2[_0x174b('0x32')]:_0x580731[_0x174b('0x31')];if(!_0x220206[_0x174b('0x2e')][_0x174b('0x35')]('nolimit')){_0x2a7ec2[_0x174b('0x19')]=qs[_0x174b('0x19')](_0x220206[_0x174b('0x2e')][_0x174b('0x19')]);_0x2a7ec2[_0x174b('0x1b')]=qs[_0x174b('0x1b')](_0x220206[_0x174b('0x2e')][_0x174b('0x1b')]);}_0x2a7ec2[_0x174b('0x36')]=qs['sort'](_0x220206['query'][_0x174b('0x37')]);_0x2a7ec2[_0x174b('0x38')]=qs[_0x174b('0x39')](_[_0x174b('0x3a')](_0x220206[_0x174b('0x2e')],_0x580731['filters']),_0x3a72a9);if(_0x220206['query'][_0x174b('0x3b')]){_0x2a7ec2[_0x174b('0x38')]=_['merge'](_0x2a7ec2[_0x174b('0x38')],{'$or':_[_0x174b('0x2a')](_0x3a72a9,function(_0x1cdefc){if(_0x1cdefc[_0x174b('0x3c')]!==_0x174b('0x3d')){var _0xcbae0f={};_0xcbae0f[_0x1cdefc['name']]={'$like':'%'+_0x220206['query'][_0x174b('0x3b')]+'%'};return _0xcbae0f;}})});}_0x2a7ec2=_[_0x174b('0x3e')]({},_0x2a7ec2,_0x220206[_0x174b('0x3f')]);var _0x5015ce={'where':_0x2a7ec2[_0x174b('0x38')]};return db[_0x174b('0x40')][_0x174b('0x1a')](_0x5015ce)[_0x174b('0x22')](function(_0x1d1d2b){_0x22bf34[_0x174b('0x1a')]=_0x1d1d2b;if(_0x220206[_0x174b('0x2e')][_0x174b('0x41')]){_0x2a7ec2[_0x174b('0x42')]=[{'all':!![]}];}return db[_0x174b('0x40')]['findAll'](_0x2a7ec2);})[_0x174b('0x22')](function(_0xf9dd00){_0x22bf34['rows']=_0xf9dd00;return _0x22bf34;})[_0x174b('0x22')](respondWithFilteredResult(_0x3e6fb0,_0x2a7ec2))['catch'](handleError(_0x3e6fb0,null));};exports[_0x174b('0x43')]=function(_0x6fbdc4,_0x468059){var _0x4c9cb4={'raw':![],'where':{'id':_0x6fbdc4[_0x174b('0x44')]['id']}},_0x1fa140={};_0x1fa140['model']=_['keys'](db[_0x174b('0x40')][_0x174b('0x2b')]);_0x1fa140['query']=_['keys'](_0x6fbdc4[_0x174b('0x2e')]);_0x1fa140[_0x174b('0x39')]=_[_0x174b('0x30')](_0x1fa140[_0x174b('0x31')],_0x1fa140['query']);_0x4c9cb4[_0x174b('0x32')]=_['intersection'](_0x1fa140['model'],qs[_0x174b('0x33')](_0x6fbdc4[_0x174b('0x2e')][_0x174b('0x33')]));_0x4c9cb4['attributes']=_0x4c9cb4[_0x174b('0x32')]['length']?_0x4c9cb4['attributes']:_0x1fa140[_0x174b('0x31')];if(_0x6fbdc4[_0x174b('0x2e')]['includeAll']){_0x4c9cb4[_0x174b('0x42')]=[{'all':!![]}];}_0x4c9cb4=_[_0x174b('0x3e')]({},_0x4c9cb4,_0x6fbdc4[_0x174b('0x3f')]);return db[_0x174b('0x40')][_0x174b('0x45')](_0x4c9cb4)[_0x174b('0x22')](handleEntityNotFound(_0x468059,null))[_0x174b('0x22')](respondWithResult(_0x468059,null))[_0x174b('0x46')](handleError(_0x468059,null));};exports[_0x174b('0x47')]=function(_0x565ad0,_0x4cd165){return db['VoiceChanSpy'][_0x174b('0x47')](_0x565ad0[_0x174b('0x48')],{})[_0x174b('0x22')](function(_0x12ae01){var _0x38cb5e=_0x565ad0[_0x174b('0x49')]['get']({'plain':!![]});if(!_0x38cb5e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38cb5e[_0x174b('0x4a')]===_0x174b('0x49')){var _0x41d309=_0x12ae01[_0x174b('0x24')]({'plain':!![]});var _0xd27c7d=_0x174b('0x4b');return db[_0x174b('0x4c')][_0x174b('0x45')]({'where':{'name':_0xd27c7d,'userProfileId':_0x38cb5e[_0x174b('0x4d')]},'raw':!![]})['then'](function(_0x306b23){if(_0x306b23&&_0x306b23[_0x174b('0x4e')]===0x0){return db[_0x174b('0x4f')][_0x174b('0x47')]({'name':_0x41d309[_0x174b('0x27')],'resourceId':_0x41d309['id'],'type':_0x306b23[_0x174b('0x27')],'sectionId':_0x306b23['id']},{})[_0x174b('0x22')](function(){return _0x12ae01;});}else{return _0x12ae01;}})[_0x174b('0x46')](function(_0x39dd9d){logger['error'](_0x174b('0x50'),_0x39dd9d);throw _0x39dd9d;});}return _0x12ae01;})['then'](respondWithResult(_0x4cd165,0xc9))['catch'](handleError(_0x4cd165,null));};exports[_0x174b('0x21')]=function(_0x50f3e3,_0x55bc56){if(_0x50f3e3[_0x174b('0x48')]['id']){delete _0x50f3e3[_0x174b('0x48')]['id'];}return db[_0x174b('0x40')][_0x174b('0x45')]({'where':{'id':_0x50f3e3[_0x174b('0x44')]['id']}})[_0x174b('0x22')](handleEntityNotFound(_0x55bc56,null))['then'](saveUpdates(_0x50f3e3[_0x174b('0x48')],null))[_0x174b('0x22')](respondWithResult(_0x55bc56,null))['catch'](handleError(_0x55bc56,null));};exports[_0x174b('0x23')]=function(_0x256d6e,_0x201869){return db['VoiceChanSpy']['find']({'where':{'id':_0x256d6e[_0x174b('0x44')]['id']}})['then'](handleEntityNotFound(_0x201869,null))['then'](removeEntity(_0x201869,null))[_0x174b('0x46')](handleError(_0x201869,null));}; \ No newline at end of file +var _0x2bbb=['json','offset','undefined','limit','count','Content-Range','reject','update','then','get','UserProfileResource','destroy','sendStatus','error','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','findAll','catch','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x5d9df0,_0x5ee28f){var _0x446354=function(_0x24474f){while(--_0x24474f){_0x5d9df0['push'](_0x5d9df0['shift']());}};_0x446354(++_0x5ee28f);}(_0x2bbb,0x85));var _0xb2bb=function(_0x579d56,_0x539656){_0x579d56=_0x579d56-0x0;var _0x4da7f1=_0x2bbb[_0x579d56];return _0x4da7f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2bb('0x0'));var zipdir=require(_0xb2bb('0x1'));var jsonpatch=require(_0xb2bb('0x2'));var rp=require('request-promise');var moment=require(_0xb2bb('0x3'));var BPromise=require(_0xb2bb('0x4'));var Mustache=require(_0xb2bb('0x5'));var util=require(_0xb2bb('0x6'));var path=require(_0xb2bb('0x7'));var sox=require(_0xb2bb('0x8'));var csv=require('to-csv');var ejs=require(_0xb2bb('0x9'));var fs=require('fs');var fs_extra=require(_0xb2bb('0xa'));var _=require('lodash');var squel=require(_0xb2bb('0xb'));var crypto=require(_0xb2bb('0xc'));var jsforce=require(_0xb2bb('0xd'));var deskjs=require(_0xb2bb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb2bb('0xf'));var Papa=require('papaparse');var Redis=require(_0xb2bb('0x10'));var authService=require(_0xb2bb('0x11'));var qs=require(_0xb2bb('0x12'));var as=require(_0xb2bb('0x13'));var hardwareService=require(_0xb2bb('0x14'));var logger=require('../../config/logger')(_0xb2bb('0x15'));var utils=require('../../config/utils');var config=require(_0xb2bb('0x16'));var licenseUtil=require(_0xb2bb('0x17'));var db=require(_0xb2bb('0x18'))['db'];function respondWithStatusCode(_0x43950f,_0x38ea15){_0x38ea15=_0x38ea15||0xcc;return function(_0x14c05e){if(_0x14c05e){return _0x43950f['sendStatus'](_0x38ea15);}return _0x43950f[_0xb2bb('0x19')](_0x38ea15)[_0xb2bb('0x1a')]();};}function respondWithResult(_0x332903,_0x2905e2){_0x2905e2=_0x2905e2||0xc8;return function(_0x50a32e){if(_0x50a32e){return _0x332903[_0xb2bb('0x19')](_0x2905e2)[_0xb2bb('0x1b')](_0x50a32e);}};}function respondWithFilteredResult(_0x3bb017,_0x28b73c){return function(_0x367c6f){if(_0x367c6f){var _0x48d630=typeof _0x28b73c[_0xb2bb('0x1c')]===_0xb2bb('0x1d')&&typeof _0x28b73c[_0xb2bb('0x1e')]===_0xb2bb('0x1d');var _0x2dcb2d=_0x367c6f[_0xb2bb('0x1f')];var _0x35c4de=_0x48d630?0x0:_0x28b73c[_0xb2bb('0x1c')];var _0x8d2033=_0x48d630?_0x367c6f[_0xb2bb('0x1f')]:_0x28b73c[_0xb2bb('0x1c')]+_0x28b73c[_0xb2bb('0x1e')];var _0x5e8d6a;if(_0x8d2033>=_0x2dcb2d){_0x8d2033=_0x2dcb2d;_0x5e8d6a=0xc8;}else{_0x5e8d6a=0xce;}_0x3bb017[_0xb2bb('0x19')](_0x5e8d6a);return _0x3bb017['set'](_0xb2bb('0x20'),_0x35c4de+'-'+_0x8d2033+'/'+_0x2dcb2d)['json'](_0x367c6f);}return null;};}function patchUpdates(_0x3e7028){return function(_0x8f37d9){try{jsonpatch['apply'](_0x8f37d9,_0x3e7028,!![]);}catch(_0x302cd4){return BPromise[_0xb2bb('0x21')](_0x302cd4);}return _0x8f37d9['save']();};}function saveUpdates(_0x5ab483,_0x4a428f){return function(_0x2f1e0f){if(_0x2f1e0f){return _0x2f1e0f[_0xb2bb('0x22')](_0x5ab483)[_0xb2bb('0x23')](function(_0x494344){return _0x494344;});}return null;};}function removeEntity(_0x297d52,_0x2b1f94){return function(_0x250c3f){if(_0x250c3f){return _0x250c3f['destroy']()[_0xb2bb('0x23')](function(){var _0x962b0a=_0x250c3f[_0xb2bb('0x24')]({'plain':!![]});var _0x14aba5='ChanSpies';return db[_0xb2bb('0x25')][_0xb2bb('0x26')]({'where':{'type':_0x14aba5,'resourceId':_0x962b0a['id']}})[_0xb2bb('0x23')](function(){return _0x250c3f;});})['then'](function(){_0x297d52[_0xb2bb('0x19')](0xcc)[_0xb2bb('0x1a')]();});}};}function handleEntityNotFound(_0x400fff,_0x35949b){return function(_0x149ab2){if(!_0x149ab2){_0x400fff[_0xb2bb('0x27')](0x194);}return _0x149ab2;};}function handleError(_0x4a1b3d,_0x279baa){_0x279baa=_0x279baa||0x1f4;return function(_0x48d96f){logger[_0xb2bb('0x28')](_0x48d96f['stack']);if(_0x48d96f[_0xb2bb('0x29')]){delete _0x48d96f[_0xb2bb('0x29')];}_0x4a1b3d['status'](_0x279baa)[_0xb2bb('0x2a')](_0x48d96f);};}exports['index']=function(_0x232f27,_0x115202){var _0x51a013={},_0xef2655={},_0x8cbc9f={'count':0x0,'rows':[]};var _0x214649=_[_0xb2bb('0x2b')](db[_0xb2bb('0x2c')][_0xb2bb('0x2d')],function(_0x289d11){return{'name':_0x289d11[_0xb2bb('0x2e')],'type':_0x289d11[_0xb2bb('0x2f')][_0xb2bb('0x30')]};});_0xef2655[_0xb2bb('0x31')]=_['map'](_0x214649,_0xb2bb('0x29'));_0xef2655[_0xb2bb('0x32')]=_[_0xb2bb('0x33')](_0x232f27[_0xb2bb('0x32')]);_0xef2655[_0xb2bb('0x34')]=_['intersection'](_0xef2655[_0xb2bb('0x31')],_0xef2655[_0xb2bb('0x32')]);_0x51a013[_0xb2bb('0x35')]=_[_0xb2bb('0x36')](_0xef2655[_0xb2bb('0x31')],qs['fields'](_0x232f27['query'][_0xb2bb('0x37')]));_0x51a013[_0xb2bb('0x35')]=_0x51a013['attributes'][_0xb2bb('0x38')]?_0x51a013[_0xb2bb('0x35')]:_0xef2655['model'];if(!_0x232f27[_0xb2bb('0x32')]['hasOwnProperty'](_0xb2bb('0x39'))){_0x51a013[_0xb2bb('0x1e')]=qs['limit'](_0x232f27[_0xb2bb('0x32')][_0xb2bb('0x1e')]);_0x51a013[_0xb2bb('0x1c')]=qs[_0xb2bb('0x1c')](_0x232f27['query'][_0xb2bb('0x1c')]);}_0x51a013[_0xb2bb('0x3a')]=qs[_0xb2bb('0x3b')](_0x232f27[_0xb2bb('0x32')][_0xb2bb('0x3b')]);_0x51a013[_0xb2bb('0x3c')]=qs[_0xb2bb('0x34')](_[_0xb2bb('0x3d')](_0x232f27[_0xb2bb('0x32')],_0xef2655['filters']),_0x214649);if(_0x232f27[_0xb2bb('0x32')][_0xb2bb('0x3e')]){_0x51a013[_0xb2bb('0x3c')]=_[_0xb2bb('0x3f')](_0x51a013[_0xb2bb('0x3c')],{'$or':_[_0xb2bb('0x2b')](_0x214649,function(_0x397589){if(_0x397589[_0xb2bb('0x2f')]!=='VIRTUAL'){var _0x24888c={};_0x24888c[_0x397589['name']]={'$like':'%'+_0x232f27[_0xb2bb('0x32')][_0xb2bb('0x3e')]+'%'};return _0x24888c;}})});}_0x51a013=_[_0xb2bb('0x3f')]({},_0x51a013,_0x232f27[_0xb2bb('0x40')]);var _0x546945={'where':_0x51a013[_0xb2bb('0x3c')]};return db['VoiceChanSpy']['count'](_0x546945)[_0xb2bb('0x23')](function(_0x51c19b){_0x8cbc9f[_0xb2bb('0x1f')]=_0x51c19b;if(_0x232f27['query']['includeAll']){_0x51a013['include']=[{'all':!![]}];}return db[_0xb2bb('0x2c')][_0xb2bb('0x41')](_0x51a013);})[_0xb2bb('0x23')](function(_0x5dab12){_0x8cbc9f['rows']=_0x5dab12;return _0x8cbc9f;})[_0xb2bb('0x23')](respondWithFilteredResult(_0x115202,_0x51a013))[_0xb2bb('0x42')](handleError(_0x115202,null));};exports['show']=function(_0x1f808d,_0xd7b090){var _0x500918={'raw':![],'where':{'id':_0x1f808d[_0xb2bb('0x43')]['id']}},_0x44b65f={};_0x44b65f['model']=_['keys'](db[_0xb2bb('0x2c')][_0xb2bb('0x2d')]);_0x44b65f[_0xb2bb('0x32')]=_[_0xb2bb('0x33')](_0x1f808d['query']);_0x44b65f[_0xb2bb('0x34')]=_[_0xb2bb('0x36')](_0x44b65f[_0xb2bb('0x31')],_0x44b65f[_0xb2bb('0x32')]);_0x500918[_0xb2bb('0x35')]=_[_0xb2bb('0x36')](_0x44b65f['model'],qs[_0xb2bb('0x37')](_0x1f808d['query'][_0xb2bb('0x37')]));_0x500918[_0xb2bb('0x35')]=_0x500918[_0xb2bb('0x35')][_0xb2bb('0x38')]?_0x500918[_0xb2bb('0x35')]:_0x44b65f[_0xb2bb('0x31')];if(_0x1f808d[_0xb2bb('0x32')][_0xb2bb('0x44')]){_0x500918['include']=[{'all':!![]}];}_0x500918=_[_0xb2bb('0x3f')]({},_0x500918,_0x1f808d['options']);return db[_0xb2bb('0x2c')][_0xb2bb('0x45')](_0x500918)[_0xb2bb('0x23')](handleEntityNotFound(_0xd7b090,null))['then'](respondWithResult(_0xd7b090,null))[_0xb2bb('0x42')](handleError(_0xd7b090,null));};exports[_0xb2bb('0x46')]=function(_0x4a3fb2,_0x47ac7d){return db['VoiceChanSpy'][_0xb2bb('0x46')](_0x4a3fb2['body'],{})[_0xb2bb('0x23')](function(_0x2cbeb3){var _0x5f351e=_0x4a3fb2[_0xb2bb('0x47')][_0xb2bb('0x24')]({'plain':!![]});if(!_0x5f351e)throw new Error(_0xb2bb('0x48'));if(_0x5f351e[_0xb2bb('0x49')]===_0xb2bb('0x47')){var _0xb883ef=_0x2cbeb3[_0xb2bb('0x24')]({'plain':!![]});var _0x52d100=_0xb2bb('0x4a');return db[_0xb2bb('0x4b')][_0xb2bb('0x45')]({'where':{'name':_0x52d100,'userProfileId':_0x5f351e[_0xb2bb('0x4c')]},'raw':!![]})['then'](function(_0x444426){if(_0x444426&&_0x444426[_0xb2bb('0x4d')]===0x0){return db['UserProfileResource'][_0xb2bb('0x46')]({'name':_0xb883ef[_0xb2bb('0x29')],'resourceId':_0xb883ef['id'],'type':_0x444426[_0xb2bb('0x29')],'sectionId':_0x444426['id']},{})[_0xb2bb('0x23')](function(){return _0x2cbeb3;});}else{return _0x2cbeb3;}})['catch'](function(_0x38e6df){logger[_0xb2bb('0x28')](_0xb2bb('0x4e'),_0x38e6df);throw _0x38e6df;});}return _0x2cbeb3;})['then'](respondWithResult(_0x47ac7d,0xc9))[_0xb2bb('0x42')](handleError(_0x47ac7d,null));};exports[_0xb2bb('0x22')]=function(_0x48222c,_0x165cee){if(_0x48222c[_0xb2bb('0x4f')]['id']){delete _0x48222c[_0xb2bb('0x4f')]['id'];}return db[_0xb2bb('0x2c')][_0xb2bb('0x45')]({'where':{'id':_0x48222c[_0xb2bb('0x43')]['id']}})[_0xb2bb('0x23')](handleEntityNotFound(_0x165cee,null))[_0xb2bb('0x23')](saveUpdates(_0x48222c[_0xb2bb('0x4f')],null))[_0xb2bb('0x23')](respondWithResult(_0x165cee,null))['catch'](handleError(_0x165cee,null));};exports[_0xb2bb('0x26')]=function(_0x341ee3,_0x231b42){return db['VoiceChanSpy'][_0xb2bb('0x45')]({'where':{'id':_0x341ee3['params']['id']}})[_0xb2bb('0x23')](handleEntityNotFound(_0x231b42,null))['then'](removeEntity(_0x231b42,null))[_0xb2bb('0x42')](handleError(_0x231b42,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 05fdf63..c2a5152 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 _0x7ce6=['record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','concat','internal','User','findAll','agent','then','exports','models','define','length','VoiceExtension','bulkCreate','catch','destroy','util','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','push','merge','Set','chanspy'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0x7ce6,0x11d));var _0x67ce=function(_0x159dc1,_0x31140b){_0x159dc1=_0x159dc1-0x0;var _0x37c7bd=_0x7ce6[_0x159dc1];return _0x37c7bd;};'use strict';var _=require('lodash');var util=require(_0x67ce('0x0'));var BPromise=require('bluebird');var attributes=require(_0x67ce('0x1'));var getUserApplications=function(_0x4a683d,_0x2f2752,_0x54e1e2){var _0xc0aa9f=0x1;var _0x38a50a=[];var _0x29079b={'context':_0x2f2752['context']||_0x67ce('0x2'),'exten':util[_0x67ce('0x3')](_0x67ce('0x4'),_0x4a683d[_0x67ce('0x5')],_0x54e1e2),'type':_0x67ce('0x6'),'isApp':![],'ChanSpyId':_0x4a683d['id'],'UserId':_0x2f2752['id']};_0x38a50a[_0x67ce('0x7')](_[_0x67ce('0x8')]({'app':_0x67ce('0x9'),'appdata':util[_0x67ce('0x3')]('CDR(type)=%s',_0x67ce('0xa')),'priority':_0xc0aa9f++},_0x29079b));if(_0x4a683d[_0x67ce('0xb')]){_0x38a50a['push'](_[_0x67ce('0x8')]({'app':_0x67ce('0xc'),'appdata':util[_0x67ce('0x3')](_0x67ce('0xd'),_0x4a683d[_0x67ce('0xe')]),'priority':_0xc0aa9f++},_0x29079b));}if(_0x4a683d[_0x67ce('0xf')]){_0x38a50a[_0x67ce('0x7')](_[_0x67ce('0x8')]({'app':_0x67ce('0x10'),'appdata':_0x4a683d[_0x67ce('0x11')],'priority':_0xc0aa9f++},_0x29079b));}_0x38a50a[_0x67ce('0x7')](_[_0x67ce('0x8')]({'app':_0x67ce('0x12'),'appdata':util[_0x67ce('0x3')](_0x67ce('0x13'),_0x2f2752[_0x67ce('0x14')],_0x4a683d[_0x67ce('0x15')]?_0x4a683d[_0x67ce('0x15')]['join'](''):''),'priority':_0xc0aa9f++},_0x29079b));if(_0x4a683d[_0x67ce('0xb')]){_0x38a50a['push'](_['merge']({'app':_0x67ce('0x16'),'priority':_0xc0aa9f++},_0x29079b));}return _0x38a50a;};var getChanSpyApplications=function(_0x56c28f,_0x7c2eeb){var _0x263b58=[];for(var _0x1ede3c=0x0,_0xd272af=0x1;_0x1ede3c<_0x7c2eeb['length'];_0x1ede3c++,_0xd272af=0x1){_0x263b58=_0x263b58[_0x67ce('0x17')](getUserApplications(_0x56c28f,_0x7c2eeb[_0x1ede3c],_0x7c2eeb[_0x1ede3c][_0x67ce('0x18')]));if(_0x7c2eeb[_0x1ede3c][_0x67ce('0x18')]!=_0x7c2eeb[_0x1ede3c][_0x67ce('0x14')]){_0x263b58=_0x263b58['concat'](getUserApplications(_0x56c28f,_0x7c2eeb[_0x1ede3c],_0x7c2eeb[_0x1ede3c][_0x67ce('0x14')]));}}return _0x263b58;};var getChanSpyPromise=function(_0x13b130,_0x4e8ed4){return new BPromise(function(_0x441669,_0x36efaf){return _0x13b130[_0x67ce('0x19')][_0x67ce('0x1a')]({'attributes':['id',_0x67ce('0x14'),_0x67ce('0x18')],'where':{'role':_0x67ce('0x1b'),'chanspy':!![]},'raw':!![]})[_0x67ce('0x1c')](function(_0x5355d9){if(_0x5355d9){return _0x441669(getChanSpyApplications(_0x4e8ed4,_0x5355d9));}return _0x441669([]);})['catch'](function(_0x29df4a){_0x36efaf(_0x29df4a);});});};module[_0x67ce('0x1d')]=function(_0x44b572,_0x6a81e7){var _0xebb270=_0x44b572[_0x67ce('0x1e')];return _0x44b572[_0x67ce('0x1f')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f555a,_0x5e76e8,_0x27e935){return getChanSpyPromise(_0xebb270,_0x1f555a)['then'](function(_0x1b7812){if(_0x1b7812&&_0x1b7812[_0x67ce('0x20')]){return _0xebb270[_0x67ce('0x21')][_0x67ce('0x22')](_0x1b7812);}})[_0x67ce('0x1c')](function(){_0x27e935();})[_0x67ce('0x23')](function(_0xcdffe2){_0x27e935(_0xcdffe2);});},'afterUpdate':function(_0x5782c7,_0x165007,_0x2a192d){return _0xebb270[_0x67ce('0x21')][_0x67ce('0x24')]({'where':{'ChanSpyId':_0x5782c7['id']}})[_0x67ce('0x1c')](function(){return getChanSpyPromise(_0xebb270,_0x5782c7);})[_0x67ce('0x1c')](function(_0x29216e){if(_0x29216e&&_0x29216e[_0x67ce('0x20')]){return _0xebb270[_0x67ce('0x21')][_0x67ce('0x22')](_0x29216e);}})[_0x67ce('0x1c')](function(){_0x2a192d();})[_0x67ce('0x23')](function(_0xa4172){_0x2a192d(_0xa4172);});},'afterDestroy':function(_0x55fb29,_0xc728bf,_0x22198f){return _0xebb270[_0x67ce('0x21')][_0x67ce('0x24')]({'where':{'ChanSpyId':_0x55fb29['id']}})[_0x67ce('0x1c')](function(){_0x22198f();})[_0x67ce('0x23')](function(_0x24fa5c){_0x22198f(_0x24fa5c);});}}});}; \ No newline at end of file +var _0x21f2=['VoiceExtension','bulkCreate','lodash','util','./voiceChanSpy.attributes','context','from-sip','prefix','system','push','Set','chanspy','record','merge','MixMonitor','format','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','User','findAll','agent','then','catch','define','VoiceChanSpy'];(function(_0x371fdd,_0x546ace){var _0x1bbc92=function(_0x11dbd1){while(--_0x11dbd1){_0x371fdd['push'](_0x371fdd['shift']());}};_0x1bbc92(++_0x546ace);}(_0x21f2,0xd4));var _0x221f=function(_0x29a066,_0x221eb2){_0x29a066=_0x29a066-0x0;var _0x2c7dc5=_0x21f2[_0x29a066];return _0x2c7dc5;};'use strict';var _=require(_0x221f('0x0'));var util=require(_0x221f('0x1'));var BPromise=require('bluebird');var attributes=require(_0x221f('0x2'));var getUserApplications=function(_0x23845b,_0x435ac0,_0x16610b){var _0x532be0=0x1;var _0x22a1f8=[];var _0x3061c0={'context':_0x435ac0[_0x221f('0x3')]||_0x221f('0x4'),'exten':util['format']('%s%s',_0x23845b[_0x221f('0x5')],_0x16610b),'type':_0x221f('0x6'),'isApp':![],'ChanSpyId':_0x23845b['id'],'UserId':_0x435ac0['id']};_0x22a1f8[_0x221f('0x7')](_['merge']({'app':_0x221f('0x8'),'appdata':util['format']('CDR(type)=%s',_0x221f('0x9')),'priority':_0x532be0++},_0x3061c0));if(_0x23845b[_0x221f('0xa')]){_0x22a1f8['push'](_[_0x221f('0xb')]({'app':_0x221f('0xc'),'appdata':util[_0x221f('0xd')](_0x221f('0xe'),_0x23845b[_0x221f('0xf')]),'priority':_0x532be0++},_0x3061c0));}if(_0x23845b[_0x221f('0x10')]){_0x22a1f8[_0x221f('0x7')](_[_0x221f('0xb')]({'app':_0x221f('0x11'),'appdata':_0x23845b[_0x221f('0x12')],'priority':_0x532be0++},_0x3061c0));}_0x22a1f8[_0x221f('0x7')](_[_0x221f('0xb')]({'app':'ChanSpy','appdata':util[_0x221f('0xd')](_0x221f('0x13'),_0x435ac0[_0x221f('0x14')],_0x23845b[_0x221f('0x15')]?_0x23845b['options'][_0x221f('0x16')](''):''),'priority':_0x532be0++},_0x3061c0));if(_0x23845b['record']){_0x22a1f8['push'](_['merge']({'app':_0x221f('0x17'),'priority':_0x532be0++},_0x3061c0));}return _0x22a1f8;};var getChanSpyApplications=function(_0x10ec2d,_0x4cec04){var _0x391460=[];for(var _0x18f113=0x0,_0x4f1f19=0x1;_0x18f113<_0x4cec04[_0x221f('0x18')];_0x18f113++,_0x4f1f19=0x1){_0x391460=_0x391460['concat'](getUserApplications(_0x10ec2d,_0x4cec04[_0x18f113],_0x4cec04[_0x18f113][_0x221f('0x19')]));if(_0x4cec04[_0x18f113][_0x221f('0x19')]!=_0x4cec04[_0x18f113][_0x221f('0x14')]){_0x391460=_0x391460['concat'](getUserApplications(_0x10ec2d,_0x4cec04[_0x18f113],_0x4cec04[_0x18f113][_0x221f('0x14')]));}}return _0x391460;};var getChanSpyPromise=function(_0x2a1412,_0x327fa9){return new BPromise(function(_0x403f02,_0x4c6586){return _0x2a1412[_0x221f('0x1a')][_0x221f('0x1b')]({'attributes':['id',_0x221f('0x14'),_0x221f('0x19')],'where':{'role':_0x221f('0x1c'),'chanspy':!![]},'raw':!![]})[_0x221f('0x1d')](function(_0x834cd2){if(_0x834cd2){return _0x403f02(getChanSpyApplications(_0x327fa9,_0x834cd2));}return _0x403f02([]);})[_0x221f('0x1e')](function(_0x3baf72){_0x4c6586(_0x3baf72);});});};module['exports']=function(_0x33cf11,_0x16fe9e){var _0x3ef241=_0x33cf11['models'];return _0x33cf11[_0x221f('0x1f')](_0x221f('0x20'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e5161,_0xa11d92,_0x3ced52){return getChanSpyPromise(_0x3ef241,_0x5e5161)['then'](function(_0x495aef){if(_0x495aef&&_0x495aef[_0x221f('0x18')]){return _0x3ef241[_0x221f('0x21')][_0x221f('0x22')](_0x495aef);}})[_0x221f('0x1d')](function(){_0x3ced52();})['catch'](function(_0x13380d){_0x3ced52(_0x13380d);});},'afterUpdate':function(_0x1c80f2,_0x5dfab7,_0x4e3b60){return _0x3ef241[_0x221f('0x21')]['destroy']({'where':{'ChanSpyId':_0x1c80f2['id']}})[_0x221f('0x1d')](function(){return getChanSpyPromise(_0x3ef241,_0x1c80f2);})['then'](function(_0x255bdc){if(_0x255bdc&&_0x255bdc['length']){return _0x3ef241[_0x221f('0x21')][_0x221f('0x22')](_0x255bdc);}})['then'](function(){_0x4e3b60();})[_0x221f('0x1e')](function(_0x5c809f){_0x4e3b60(_0x5c809f);});},'afterDestroy':function(_0x143a59,_0x14c3ab,_0x19dce5){return _0x3ef241['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x143a59['id']}})[_0x221f('0x1d')](function(){_0x19dce5();})['catch'](function(_0x426abc){_0x19dce5(_0x426abc);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index b83aa9d..36240d7 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 _0xeffd=['stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x2bc8a2,_0x4ddb0c){var _0x81b093=function(_0x174854){while(--_0x174854){_0x2bc8a2['push'](_0x2bc8a2['shift']());}};_0x81b093(++_0x4ddb0c);}(_0xeffd,0x6b));var _0xdeff=function(_0x4f06fa,_0x31c38b){_0x4f06fa=_0x4f06fa-0x0;var _0x25c1a1=_0xeffd[_0x4f06fa];return _0x25c1a1;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x281ad7,_0x256323,_0x39878e){return new BPromise(function(_0x12e953,_0x24897a){return client['request'](_0x281ad7,_0x39878e)[_0xdeff('0xd')](function(_0x45a8a6){logger[_0xdeff('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x256323,_0xdeff('0xf'));logger[_0xdeff('0x10')](_0xdeff('0x11'),_0x256323,_0xdeff('0xf'),JSON[_0xdeff('0x12')](_0x45a8a6));if(_0x45a8a6[_0xdeff('0x13')]){if(_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x14')]===0x1f4){logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')]['message']);return _0x24897a(_0x45a8a6[_0xdeff('0x13')]['message']);}logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x16')]);return _0x12e953(_0x45a8a6[_0xdeff('0x13')]['message']);}else{logger[_0xdeff('0xe')](_0xdeff('0x15'),_0x256323,_0xdeff('0xf'));_0x12e953(_0x45a8a6[_0xdeff('0x17')][_0xdeff('0x16')]);}})[_0xdeff('0x18')](function(_0x577244){logger['error'](_0xdeff('0x15'),_0x256323,_0x577244);_0x24897a(_0x577244);});});} \ No newline at end of file +var _0xee5b=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xee5b,0x1f4));var _0xbee5=function(_0x26dc63,_0x52da63){_0x26dc63=_0x26dc63-0x0;var _0x215fad=_0xee5b[_0x26dc63];return _0x215fad;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var moment=require(_0xbee5('0x1'));var BPromise=require(_0xbee5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require(_0xbee5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee5('0x7'));var client=jayson[_0xbee5('0x8')][_0xbee5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x804ab8,_0x4f5065,_0x5505e3){return new BPromise(function(_0x53d5b9,_0x5baf5c){return client['request'](_0x804ab8,_0x5505e3)[_0xbee5('0xa')](function(_0x7dda04){logger[_0xbee5('0xb')](_0xbee5('0xc'),_0x4f5065,'request\x20sent');logger[_0xbee5('0xd')](_0xbee5('0xe'),_0x4f5065,_0xbee5('0xf'),JSON[_0xbee5('0x10')](_0x7dda04));if(_0x7dda04[_0xbee5('0x11')]){if(_0x7dda04[_0xbee5('0x11')][_0xbee5('0x12')]===0x1f4){logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error'][_0xbee5('0x13')]);return _0x5baf5c(_0x7dda04['error'][_0xbee5('0x13')]);}logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error']['message']);return _0x53d5b9(_0x7dda04[_0xbee5('0x11')]['message']);}else{logger[_0xbee5('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 18f3de8..365822a 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 _0x39a2=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','show','post','put','/:id','update','delete','exports'];(function(_0x3afaf6,_0x3336a7){var _0x49d92c=function(_0x388064){while(--_0x388064){_0x3afaf6['push'](_0x3afaf6['shift']());}};_0x49d92c(++_0x3336a7);}(_0x39a2,0x121));var _0x239a=function(_0x4dbdda,_0x11f07c){_0x4dbdda=_0x4dbdda-0x0;var _0x1acbf1=_0x39a2[_0x4dbdda];return _0x1acbf1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x239a('0x0'));var timeout=require(_0x239a('0x1'));var express=require(_0x239a('0x2'));var router=express['Router']();var fs_extra=require(_0x239a('0x3'));var auth=require(_0x239a('0x4'));var interaction=require(_0x239a('0x5'));var config=require(_0x239a('0x6'));var controller=require(_0x239a('0x7'));router['get']('/',auth[_0x239a('0x8')](),controller[_0x239a('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x239a('0xa')]);router[_0x239a('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x239a('0xc')](_0x239a('0xd'),auth['isAuthenticated'](),controller[_0x239a('0xe')]);router[_0x239a('0xf')](_0x239a('0xd'),auth[_0x239a('0x8')](),controller['destroy']);module[_0x239a('0x10')]=router; \ No newline at end of file +var _0xa347=['../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','show','post','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0xa347,0x9b));var _0x7a34=function(_0x5e848d,_0x1dbd20){_0x5e848d=_0x5e848d-0x0;var _0x3785e5=_0xa347[_0x5e848d];return _0x3785e5;};'use strict';var multer=require(_0x7a34('0x0'));var util=require(_0x7a34('0x1'));var path=require('path');var timeout=require(_0x7a34('0x2'));var express=require(_0x7a34('0x3'));var router=express[_0x7a34('0x4')]();var fs_extra=require(_0x7a34('0x5'));var auth=require(_0x7a34('0x6'));var interaction=require(_0x7a34('0x7'));var config=require('../../config/environment');var controller=require(_0x7a34('0x8'));router[_0x7a34('0x9')]('/',auth[_0x7a34('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7a34('0xb')]);router[_0x7a34('0xc')]('/',auth[_0x7a34('0xa')](),controller['create']);router[_0x7a34('0xd')](_0x7a34('0xe'),auth[_0x7a34('0xa')](),controller[_0x7a34('0xf')]);router[_0x7a34('0x10')](_0x7a34('0xe'),auth[_0x7a34('0xa')](),controller[_0x7a34('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index f16fc84..a2c042b 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 _0xe33a=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x290741,_0x53c0d9){var _0xfced6f=function(_0x3c00f7){while(--_0x3c00f7){_0x290741['push'](_0x290741['shift']());}};_0xfced6f(++_0x53c0d9);}(_0xe33a,0x7c));var _0xae33=function(_0x2d976e,_0x28b640){_0x2d976e=_0x2d976e-0x0;var _0x454f6f=_0xe33a[_0x2d976e];return _0x454f6f;};'use strict';var Sequelize=require(_0xae33('0x0'));module[_0xae33('0x1')]={'name':{'type':Sequelize[_0xae33('0x2')],'unique':_0xae33('0x3')},'description':{'type':Sequelize[_0xae33('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xae33('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x318b=['STRING','name','BOOLEAN','sequelize'];(function(_0x2534a0,_0xda89db){var _0x3209c0=function(_0x1342c3){while(--_0x1342c3){_0x2534a0['push'](_0x2534a0['shift']());}};_0x3209c0(++_0xda89db);}(_0x318b,0x1cf));var _0xb318=function(_0x83d48e,_0x507328){_0x83d48e=_0x83d48e-0x0;var _0x26f1d1=_0x318b[_0x83d48e];return _0x26f1d1;};'use strict';var Sequelize=require(_0xb318('0x0'));module['exports']={'name':{'type':Sequelize[_0xb318('0x1')],'unique':_0xb318('0x2')},'description':{'type':Sequelize[_0xb318('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xb318('0x3')],'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 d2b1614..0bd9c4f 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 _0xb328=['../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','Contexts','UserProfileResource','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','VoiceContext','includeAll','rows','show','params','rawAttributes','keys','include','find','create','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','readFileSync','chan_sip.so','findAll','destroy','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x5a636f,_0x3fec2b){var _0x6a8cfb=function(_0x20e6ca){while(--_0x20e6ca){_0x5a636f['push'](_0x5a636f['shift']());}};_0x6a8cfb(++_0x3fec2b);}(_0xb328,0xb7));var _0x8b32=function(_0x2b4550,_0x1f55cf){_0x2b4550=_0x2b4550-0x0;var _0x9285e2=_0xb328[_0x2b4550];return _0x9285e2;};'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(_0x8b32('0x0'));var moment=require(_0x8b32('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8b32('0x2'));var path=require(_0x8b32('0x3'));var sox=require('sox');var csv=require(_0x8b32('0x4'));var ejs=require(_0x8b32('0x5'));var fs=require('fs');var fs_extra=require(_0x8b32('0x6'));var _=require('lodash');var squel=require(_0x8b32('0x7'));var crypto=require('crypto');var jsforce=require(_0x8b32('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b32('0x9'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8b32('0xa'));var hardwareService=require(_0x8b32('0xb'));var logger=require('../../config/logger')(_0x8b32('0xc'));var utils=require(_0x8b32('0xd'));var config=require(_0x8b32('0xe'));var licenseUtil=require(_0x8b32('0xf'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8b32('0x10'));var client=jayson[_0x8b32('0x11')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f78fe,_0xc0a24e,_0x363de9,_0x3e3c25){return new BPromise(function(_0x62ea8f,_0x39dcfb){var _0x2be68d=_0x3e3c25||client;return _0x2be68d[_0x8b32('0x12')](_0x5f78fe,_0x363de9)[_0x8b32('0x13')](function(_0x5f2f16){logger[_0x8b32('0x14')](_0x8b32('0x15'),_0xc0a24e,'request\x20sent');logger[_0x8b32('0x16')](_0x8b32('0x17'),_0xc0a24e,_0x8b32('0x18'),JSON['stringify'](_0x5f2f16));if(_0x5f2f16[_0x8b32('0x19')]){if(_0x5f2f16[_0x8b32('0x19')][_0x8b32('0x1a')]===0x1f4){logger[_0x8b32('0x19')](_0x8b32('0x15'),_0xc0a24e,_0x5f2f16[_0x8b32('0x19')][_0x8b32('0x1b')]);return _0x39dcfb(_0x5f2f16[_0x8b32('0x19')][_0x8b32('0x1b')]);}logger[_0x8b32('0x19')](_0x8b32('0x15'),_0xc0a24e,_0x5f2f16[_0x8b32('0x19')][_0x8b32('0x1b')]);return _0x62ea8f(_0x5f2f16[_0x8b32('0x19')][_0x8b32('0x1b')]);}else{logger[_0x8b32('0x14')](_0x8b32('0x15'),_0xc0a24e,_0x8b32('0x18'));_0x62ea8f(_0x5f2f16[_0x8b32('0x1c')][_0x8b32('0x1b')]);}})[_0x8b32('0x1d')](function(_0x17aea9){logger[_0x8b32('0x19')](_0x8b32('0x15'),_0xc0a24e,_0x17aea9);_0x39dcfb(_0x17aea9);});});}function respondWithStatusCode(_0x3b438a,_0x433175){_0x433175=_0x433175||0xcc;return function(_0x577d27){if(_0x577d27){return _0x3b438a[_0x8b32('0x1e')](_0x433175);}return _0x3b438a[_0x8b32('0x1f')](_0x433175)[_0x8b32('0x20')]();};}function respondWithResult(_0x2ad9db,_0x1ead2e){_0x1ead2e=_0x1ead2e||0xc8;return function(_0x5d480e){if(_0x5d480e){return _0x2ad9db[_0x8b32('0x1f')](_0x1ead2e)[_0x8b32('0x21')](_0x5d480e);}};}function respondWithFilteredResult(_0x2944cf,_0x4b3366){return function(_0x5e20ee){if(_0x5e20ee){var _0x11560f=typeof _0x4b3366['offset']===_0x8b32('0x22')&&typeof _0x4b3366['limit']==='undefined';var _0x536505=_0x5e20ee[_0x8b32('0x23')];var _0x3eaaec=_0x11560f?0x0:_0x4b3366[_0x8b32('0x24')];var _0x4f741e=_0x11560f?_0x5e20ee[_0x8b32('0x23')]:_0x4b3366[_0x8b32('0x24')]+_0x4b3366[_0x8b32('0x25')];var _0x57bd7c;if(_0x4f741e>=_0x536505){_0x4f741e=_0x536505;_0x57bd7c=0xc8;}else{_0x57bd7c=0xce;}_0x2944cf['status'](_0x57bd7c);return _0x2944cf[_0x8b32('0x26')](_0x8b32('0x27'),_0x3eaaec+'-'+_0x4f741e+'/'+_0x536505)[_0x8b32('0x21')](_0x5e20ee);}return null;};}function patchUpdates(_0x318220){return function(_0x2d86ee){try{jsonpatch[_0x8b32('0x28')](_0x2d86ee,_0x318220,!![]);}catch(_0x1ee27c){return BPromise[_0x8b32('0x29')](_0x1ee27c);}return _0x2d86ee[_0x8b32('0x2a')]();};}function saveUpdates(_0x12086d,_0x40fa1f){return function(_0x2c1700){if(_0x2c1700){return _0x2c1700['update'](_0x12086d)['then'](function(_0x52ecb0){return _0x52ecb0;});}return null;};}function removeEntity(_0x2ed0d9,_0x56085b){return function(_0x2f73d4){if(_0x2f73d4){return _0x2f73d4['destroy']()[_0x8b32('0x13')](function(){var _0x558201=_0x2f73d4['get']({'plain':!![]});var _0x42c096=_0x8b32('0x2b');return db[_0x8b32('0x2c')]['destroy']({'where':{'type':_0x42c096,'resourceId':_0x558201['id']}})['then'](function(){return _0x2f73d4;});})[_0x8b32('0x13')](function(){_0x2ed0d9[_0x8b32('0x1f')](0xcc)[_0x8b32('0x20')]();});}};}function handleEntityNotFound(_0x2dd85b,_0x377272){return function(_0x332020){if(!_0x332020){_0x2dd85b[_0x8b32('0x1e')](0x194);}return _0x332020;};}function handleError(_0x29e59c,_0x29393a){_0x29393a=_0x29393a||0x1f4;return function(_0x83198d){logger[_0x8b32('0x19')](_0x83198d['stack']);if(_0x83198d[_0x8b32('0x2d')]){delete _0x83198d['name'];}_0x29e59c[_0x8b32('0x1f')](_0x29393a)[_0x8b32('0x2e')](_0x83198d);};}exports[_0x8b32('0x2f')]=function(_0x5669eb,_0x450a6b){var _0xf01d3a={},_0x4560f5={},_0x58a94c={'count':0x0,'rows':[]};var _0x1c452e=_[_0x8b32('0x30')](db['VoiceContext']['rawAttributes'],function(_0xc9ce2a){return{'name':_0xc9ce2a[_0x8b32('0x31')],'type':_0xc9ce2a[_0x8b32('0x32')][_0x8b32('0x33')]};});_0x4560f5[_0x8b32('0x34')]=_[_0x8b32('0x30')](_0x1c452e,_0x8b32('0x2d'));_0x4560f5[_0x8b32('0x35')]=_['keys'](_0x5669eb['query']);_0x4560f5[_0x8b32('0x36')]=_[_0x8b32('0x37')](_0x4560f5['model'],_0x4560f5[_0x8b32('0x35')]);_0xf01d3a[_0x8b32('0x38')]=_[_0x8b32('0x37')](_0x4560f5[_0x8b32('0x34')],qs[_0x8b32('0x39')](_0x5669eb[_0x8b32('0x35')][_0x8b32('0x39')]));_0xf01d3a[_0x8b32('0x38')]=_0xf01d3a[_0x8b32('0x38')][_0x8b32('0x3a')]?_0xf01d3a[_0x8b32('0x38')]:_0x4560f5[_0x8b32('0x34')];if(!_0x5669eb['query'][_0x8b32('0x3b')](_0x8b32('0x3c'))){_0xf01d3a[_0x8b32('0x25')]=qs[_0x8b32('0x25')](_0x5669eb[_0x8b32('0x35')]['limit']);_0xf01d3a[_0x8b32('0x24')]=qs['offset'](_0x5669eb['query'][_0x8b32('0x24')]);}_0xf01d3a[_0x8b32('0x3d')]=qs[_0x8b32('0x3e')](_0x5669eb[_0x8b32('0x35')][_0x8b32('0x3e')]);_0xf01d3a[_0x8b32('0x3f')]=qs[_0x8b32('0x36')](_[_0x8b32('0x40')](_0x5669eb[_0x8b32('0x35')],_0x4560f5[_0x8b32('0x36')]),_0x1c452e);if(_0x5669eb[_0x8b32('0x35')]['filter']){_0xf01d3a[_0x8b32('0x3f')]=_[_0x8b32('0x41')](_0xf01d3a[_0x8b32('0x3f')],{'$or':_[_0x8b32('0x30')](_0x1c452e,function(_0xdc6293){if(_0xdc6293[_0x8b32('0x32')]!=='VIRTUAL'){var _0x4a52be={};_0x4a52be[_0xdc6293[_0x8b32('0x2d')]]={'$like':'%'+_0x5669eb[_0x8b32('0x35')]['filter']+'%'};return _0x4a52be;}})});}_0xf01d3a=_[_0x8b32('0x41')]({},_0xf01d3a,_0x5669eb[_0x8b32('0x42')]);var _0x42e4f0={'where':_0xf01d3a[_0x8b32('0x3f')]};return db[_0x8b32('0x43')]['count'](_0x42e4f0)['then'](function(_0x1fb784){_0x58a94c['count']=_0x1fb784;if(_0x5669eb['query'][_0x8b32('0x44')]){_0xf01d3a['include']=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0xf01d3a);})[_0x8b32('0x13')](function(_0x16fd99){_0x58a94c[_0x8b32('0x45')]=_0x16fd99;return _0x58a94c;})[_0x8b32('0x13')](respondWithFilteredResult(_0x450a6b,_0xf01d3a))[_0x8b32('0x1d')](handleError(_0x450a6b,null));};exports[_0x8b32('0x46')]=function(_0x9e75fe,_0x88e52d){var _0x210710={'raw':![],'where':{'id':_0x9e75fe[_0x8b32('0x47')]['id']}},_0xccb6a0={};_0xccb6a0[_0x8b32('0x34')]=_['keys'](db['VoiceContext'][_0x8b32('0x48')]);_0xccb6a0['query']=_[_0x8b32('0x49')](_0x9e75fe['query']);_0xccb6a0[_0x8b32('0x36')]=_['intersection'](_0xccb6a0['model'],_0xccb6a0[_0x8b32('0x35')]);_0x210710['attributes']=_[_0x8b32('0x37')](_0xccb6a0[_0x8b32('0x34')],qs[_0x8b32('0x39')](_0x9e75fe[_0x8b32('0x35')][_0x8b32('0x39')]));_0x210710[_0x8b32('0x38')]=_0x210710[_0x8b32('0x38')][_0x8b32('0x3a')]?_0x210710[_0x8b32('0x38')]:_0xccb6a0['model'];if(_0x9e75fe[_0x8b32('0x35')][_0x8b32('0x44')]){_0x210710[_0x8b32('0x4a')]=[{'all':!![]}];}_0x210710=_[_0x8b32('0x41')]({},_0x210710,_0x9e75fe[_0x8b32('0x42')]);return db[_0x8b32('0x43')][_0x8b32('0x4b')](_0x210710)[_0x8b32('0x13')](handleEntityNotFound(_0x88e52d,null))['then'](respondWithResult(_0x88e52d,null))[_0x8b32('0x1d')](handleError(_0x88e52d,null));};exports[_0x8b32('0x4c')]=function(_0xb0191d,_0x555f9e,_0x468120){var _0x1d10f7;return db[_0x8b32('0x43')]['create'](_0xb0191d['body'],{'raw':!![]})[_0x8b32('0x13')](function(_0x45736e){_0x1d10f7=_0x45736e;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x1b95b5){var _0x2ca63b=fs['readFileSync'](path[_0x8b32('0x4d')](config[_0x8b32('0x4e')],_0x8b32('0x4f')),_0x8b32('0x50'));var _0x1ec13a=ejs[_0x8b32('0x51')](_0x2ca63b,{'contexts':_0x1b95b5||[]});fs[_0x8b32('0x52')](_0x8b32('0x53'),_0x1ec13a);})['then'](function(){return respondWithRpcPromise(_0x8b32('0x54'),_0x8b32('0x4c'),{'module':'chan_sip.so'});})[_0x8b32('0x13')](function(){var _0x16bdbd=_0xb0191d[_0x8b32('0x55')][_0x8b32('0x56')]({'plain':!![]});if(!_0x16bdbd)throw new Error(_0x8b32('0x57'));if(_0x16bdbd[_0x8b32('0x58')]===_0x8b32('0x55')){var _0x50a4c5=_0x1d10f7[_0x8b32('0x56')]({'plain':!![]});return db[_0x8b32('0x59')][_0x8b32('0x4b')]({'where':{'name':'Contexts','userProfileId':_0x16bdbd['userProfileId']},'raw':!![]})['then'](function(_0x5ae6ba){if(_0x5ae6ba&&_0x5ae6ba[_0x8b32('0x5a')]===0x0){return db[_0x8b32('0x2c')]['create']({'name':_0x50a4c5[_0x8b32('0x2d')],'resourceId':_0x50a4c5['id'],'type':_0x5ae6ba[_0x8b32('0x2d')],'sectionId':_0x5ae6ba['id']},{})[_0x8b32('0x13')](function(){return _0x1d10f7;});}else{return _0x1d10f7;}})[_0x8b32('0x1d')](function(_0x131d46){logger['error'](_0x8b32('0x5b'),_0x131d46);throw _0x131d46;});}return _0x1d10f7;})['then'](respondWithResult(_0x555f9e,0xc9))[_0x8b32('0x1d')](handleError(_0x555f9e,null));};exports[_0x8b32('0x5c')]=function(_0xececad,_0x1ef80d,_0x3025b5){var _0x45d0e2;return db[_0x8b32('0x43')][_0x8b32('0x4b')]({'where':{'id':_0xececad[_0x8b32('0x47')]['id']}})[_0x8b32('0x13')](handleEntityNotFound(_0x1ef80d,null))[_0x8b32('0x13')](saveUpdates(_0xececad[_0x8b32('0x5d')],null))['then'](function(_0x518b6f){if(_0x518b6f){_0x45d0e2=_0x518b6f;return db[_0x8b32('0x43')]['findAll']({'raw':!![]});}})[_0x8b32('0x13')](function(_0x49e8e2){var _0x997fde=fs[_0x8b32('0x5e')](path[_0x8b32('0x4d')](config[_0x8b32('0x4e')],_0x8b32('0x4f')),'utf8');var _0x4da3fd=ejs[_0x8b32('0x51')](_0x997fde,{'contexts':_0x49e8e2||[]});fs['writeFileSync'](_0x8b32('0x53'),_0x4da3fd);})[_0x8b32('0x13')](function(){return respondWithRpcPromise(_0x8b32('0x54'),_0x8b32('0x5c'),{'module':_0x8b32('0x5f')});})[_0x8b32('0x13')](function(){return _0x45d0e2;})[_0x8b32('0x13')](respondWithResult(_0x1ef80d,null))[_0x8b32('0x1d')](handleError(_0x1ef80d,null));};exports['destroy']=function(_0x55466a,_0x2e2d1e,_0x5cd41e){var _0x1fd605;return db['VoiceContext'][_0x8b32('0x4b')]({'where':{'id':_0x55466a[_0x8b32('0x47')]['id']}})[_0x8b32('0x13')](handleEntityNotFound(_0x2e2d1e,null))[_0x8b32('0x13')](removeEntity(_0x2e2d1e,null))['then'](function(){return db['VoiceContext'][_0x8b32('0x60')]({'raw':!![]});})[_0x8b32('0x13')](function(_0x41329a){var _0x12462e=fs[_0x8b32('0x5e')](path['join'](config[_0x8b32('0x4e')],_0x8b32('0x4f')),'utf8');var _0xac1fc7=ejs[_0x8b32('0x51')](_0x12462e,{'contexts':_0x41329a});fs[_0x8b32('0x52')](_0x8b32('0x53'),_0xac1fc7);return respondWithRpcPromise(_0x8b32('0x54'),_0x8b32('0x61'),{'module':_0x8b32('0x5f')});})[_0x8b32('0x1d')](handleError(_0x2e2d1e,null));}; \ No newline at end of file +var _0xc577=['create','body','readFileSync','join','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','utf8','params','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','then','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','VoiceContext,\x20%s,\x20%s','info','catch','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','update','destroy','Contexts','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','type','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','include','findAll','rows','show','keys','length','includeAll','find'];(function(_0x3d9176,_0x399d6f){var _0x12adc5=function(_0x700b01){while(--_0x700b01){_0x3d9176['push'](_0x3d9176['shift']());}};_0x12adc5(++_0x399d6f);}(_0xc577,0xd9));var _0x7c57=function(_0x382500,_0x43e04e){_0x382500=_0x382500-0x0;var _0x4aa842=_0xc577[_0x382500];return _0x4aa842;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c57('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7c57('0x1'));var moment=require(_0x7c57('0x2'));var BPromise=require(_0x7c57('0x3'));var Mustache=require(_0x7c57('0x4'));var util=require('util');var path=require(_0x7c57('0x5'));var sox=require(_0x7c57('0x6'));var csv=require(_0x7c57('0x7'));var ejs=require(_0x7c57('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c57('0x9'));var squel=require('squel');var crypto=require(_0x7c57('0xa'));var jsforce=require(_0x7c57('0xb'));var deskjs=require(_0x7c57('0xc'));var toCsv=require(_0x7c57('0x7'));var querystring=require('querystring');var Papa=require(_0x7c57('0xd'));var Redis=require(_0x7c57('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7c57('0xf'));var hardwareService=require(_0x7c57('0x10'));var logger=require(_0x7c57('0x11'))(_0x7c57('0x12'));var utils=require(_0x7c57('0x13'));var config=require(_0x7c57('0x14'));var licenseUtil=require(_0x7c57('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7c57('0x16'));var client=jayson[_0x7c57('0x17')][_0x7c57('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x46722c,_0x56a68a,_0x4e5ec6,_0x4189d3){return new BPromise(function(_0x55acc5,_0x49ed2a){var _0x5a9700=_0x4189d3||client;return _0x5a9700['request'](_0x46722c,_0x4e5ec6)[_0x7c57('0x19')](function(_0x48cec7){logger['info']('VoiceContext,\x20%s,\x20%s',_0x56a68a,_0x7c57('0x1a'));logger[_0x7c57('0x1b')](_0x7c57('0x1c'),_0x56a68a,_0x7c57('0x1a'),JSON['stringify'](_0x48cec7));if(_0x48cec7['error']){if(_0x48cec7[_0x7c57('0x1d')][_0x7c57('0x1e')]===0x1f4){logger[_0x7c57('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x56a68a,_0x48cec7['error'][_0x7c57('0x1f')]);return _0x49ed2a(_0x48cec7['error'][_0x7c57('0x1f')]);}logger['error'](_0x7c57('0x20'),_0x56a68a,_0x48cec7[_0x7c57('0x1d')][_0x7c57('0x1f')]);return _0x55acc5(_0x48cec7['error'][_0x7c57('0x1f')]);}else{logger[_0x7c57('0x21')](_0x7c57('0x20'),_0x56a68a,_0x7c57('0x1a'));_0x55acc5(_0x48cec7['result'][_0x7c57('0x1f')]);}})[_0x7c57('0x22')](function(_0x1de3d5){logger['error'](_0x7c57('0x20'),_0x56a68a,_0x1de3d5);_0x49ed2a(_0x1de3d5);});});}function respondWithStatusCode(_0x5dd523,_0x4d4997){_0x4d4997=_0x4d4997||0xcc;return function(_0x238d6b){if(_0x238d6b){return _0x5dd523[_0x7c57('0x23')](_0x4d4997);}return _0x5dd523[_0x7c57('0x24')](_0x4d4997)[_0x7c57('0x25')]();};}function respondWithResult(_0x183ff0,_0x581464){_0x581464=_0x581464||0xc8;return function(_0x2467df){if(_0x2467df){return _0x183ff0[_0x7c57('0x24')](_0x581464)[_0x7c57('0x26')](_0x2467df);}};}function respondWithFilteredResult(_0x19ebc8,_0x5eb481){return function(_0x4f1e00){if(_0x4f1e00){var _0x2c6fd8=typeof _0x5eb481[_0x7c57('0x27')]===_0x7c57('0x28')&&typeof _0x5eb481['limit']===_0x7c57('0x28');var _0x48a1c4=_0x4f1e00['count'];var _0x2f0e53=_0x2c6fd8?0x0:_0x5eb481[_0x7c57('0x27')];var _0x432b05=_0x2c6fd8?_0x4f1e00[_0x7c57('0x29')]:_0x5eb481['offset']+_0x5eb481['limit'];var _0x51f2b0;if(_0x432b05>=_0x48a1c4){_0x432b05=_0x48a1c4;_0x51f2b0=0xc8;}else{_0x51f2b0=0xce;}_0x19ebc8['status'](_0x51f2b0);return _0x19ebc8[_0x7c57('0x2a')]('Content-Range',_0x2f0e53+'-'+_0x432b05+'/'+_0x48a1c4)['json'](_0x4f1e00);}return null;};}function patchUpdates(_0x41516b){return function(_0x58d586){try{jsonpatch[_0x7c57('0x2b')](_0x58d586,_0x41516b,!![]);}catch(_0x523cd5){return BPromise[_0x7c57('0x2c')](_0x523cd5);}return _0x58d586['save']();};}function saveUpdates(_0x541783,_0x23fcae){return function(_0x39c68b){if(_0x39c68b){return _0x39c68b[_0x7c57('0x2d')](_0x541783)[_0x7c57('0x19')](function(_0x2ee988){return _0x2ee988;});}return null;};}function removeEntity(_0x2cf48f,_0x3b922f){return function(_0x5111e2){if(_0x5111e2){return _0x5111e2[_0x7c57('0x2e')]()['then'](function(){var _0x5a8349=_0x5111e2['get']({'plain':!![]});var _0x48d562=_0x7c57('0x2f');return db[_0x7c57('0x30')][_0x7c57('0x2e')]({'where':{'type':_0x48d562,'resourceId':_0x5a8349['id']}})[_0x7c57('0x19')](function(){return _0x5111e2;});})[_0x7c57('0x19')](function(){_0x2cf48f[_0x7c57('0x24')](0xcc)[_0x7c57('0x25')]();});}};}function handleEntityNotFound(_0x2b4e07,_0x4fda1b){return function(_0x287a61){if(!_0x287a61){_0x2b4e07[_0x7c57('0x23')](0x194);}return _0x287a61;};}function handleError(_0x592559,_0x1cdc03){_0x1cdc03=_0x1cdc03||0x1f4;return function(_0x212e70){logger[_0x7c57('0x1d')](_0x212e70[_0x7c57('0x31')]);if(_0x212e70[_0x7c57('0x32')]){delete _0x212e70['name'];}_0x592559[_0x7c57('0x24')](_0x1cdc03)['send'](_0x212e70);};}exports[_0x7c57('0x33')]=function(_0x14aac7,_0x15de98){var _0x93e747={},_0x3a3f89={},_0x50ea8a={'count':0x0,'rows':[]};var _0x3bc554=_[_0x7c57('0x34')](db[_0x7c57('0x35')][_0x7c57('0x36')],function(_0x4a0503){return{'name':_0x4a0503['fieldName'],'type':_0x4a0503[_0x7c57('0x37')]['key']};});_0x3a3f89['model']=_['map'](_0x3bc554,_0x7c57('0x32'));_0x3a3f89[_0x7c57('0x38')]=_['keys'](_0x14aac7['query']);_0x3a3f89[_0x7c57('0x39')]=_['intersection'](_0x3a3f89[_0x7c57('0x3a')],_0x3a3f89[_0x7c57('0x38')]);_0x93e747[_0x7c57('0x3b')]=_[_0x7c57('0x3c')](_0x3a3f89[_0x7c57('0x3a')],qs[_0x7c57('0x3d')](_0x14aac7[_0x7c57('0x38')][_0x7c57('0x3d')]));_0x93e747['attributes']=_0x93e747[_0x7c57('0x3b')]['length']?_0x93e747[_0x7c57('0x3b')]:_0x3a3f89[_0x7c57('0x3a')];if(!_0x14aac7[_0x7c57('0x38')][_0x7c57('0x3e')](_0x7c57('0x3f'))){_0x93e747[_0x7c57('0x40')]=qs[_0x7c57('0x40')](_0x14aac7[_0x7c57('0x38')][_0x7c57('0x40')]);_0x93e747['offset']=qs[_0x7c57('0x27')](_0x14aac7[_0x7c57('0x38')][_0x7c57('0x27')]);}_0x93e747[_0x7c57('0x41')]=qs['sort'](_0x14aac7[_0x7c57('0x38')][_0x7c57('0x42')]);_0x93e747['where']=qs['filters'](_[_0x7c57('0x43')](_0x14aac7[_0x7c57('0x38')],_0x3a3f89[_0x7c57('0x39')]),_0x3bc554);if(_0x14aac7[_0x7c57('0x38')][_0x7c57('0x44')]){_0x93e747[_0x7c57('0x45')]=_[_0x7c57('0x46')](_0x93e747[_0x7c57('0x45')],{'$or':_[_0x7c57('0x34')](_0x3bc554,function(_0xcbf163){if(_0xcbf163['type']!=='VIRTUAL'){var _0x11df82={};_0x11df82[_0xcbf163['name']]={'$like':'%'+_0x14aac7['query'][_0x7c57('0x44')]+'%'};return _0x11df82;}})});}_0x93e747=_[_0x7c57('0x46')]({},_0x93e747,_0x14aac7[_0x7c57('0x47')]);var _0x127bc9={'where':_0x93e747['where']};return db[_0x7c57('0x35')][_0x7c57('0x29')](_0x127bc9)[_0x7c57('0x19')](function(_0x3db067){_0x50ea8a[_0x7c57('0x29')]=_0x3db067;if(_0x14aac7[_0x7c57('0x38')]['includeAll']){_0x93e747[_0x7c57('0x48')]=[{'all':!![]}];}return db['VoiceContext'][_0x7c57('0x49')](_0x93e747);})[_0x7c57('0x19')](function(_0x4b71a5){_0x50ea8a[_0x7c57('0x4a')]=_0x4b71a5;return _0x50ea8a;})[_0x7c57('0x19')](respondWithFilteredResult(_0x15de98,_0x93e747))['catch'](handleError(_0x15de98,null));};exports[_0x7c57('0x4b')]=function(_0x3b5206,_0x384522){var _0x70552e={'raw':![],'where':{'id':_0x3b5206['params']['id']}},_0x28af3a={};_0x28af3a[_0x7c57('0x3a')]=_[_0x7c57('0x4c')](db[_0x7c57('0x35')]['rawAttributes']);_0x28af3a[_0x7c57('0x38')]=_[_0x7c57('0x4c')](_0x3b5206[_0x7c57('0x38')]);_0x28af3a[_0x7c57('0x39')]=_[_0x7c57('0x3c')](_0x28af3a[_0x7c57('0x3a')],_0x28af3a[_0x7c57('0x38')]);_0x70552e['attributes']=_[_0x7c57('0x3c')](_0x28af3a[_0x7c57('0x3a')],qs[_0x7c57('0x3d')](_0x3b5206[_0x7c57('0x38')][_0x7c57('0x3d')]));_0x70552e[_0x7c57('0x3b')]=_0x70552e[_0x7c57('0x3b')][_0x7c57('0x4d')]?_0x70552e[_0x7c57('0x3b')]:_0x28af3a[_0x7c57('0x3a')];if(_0x3b5206[_0x7c57('0x38')][_0x7c57('0x4e')]){_0x70552e[_0x7c57('0x48')]=[{'all':!![]}];}_0x70552e=_[_0x7c57('0x46')]({},_0x70552e,_0x3b5206[_0x7c57('0x47')]);return db['VoiceContext'][_0x7c57('0x4f')](_0x70552e)[_0x7c57('0x19')](handleEntityNotFound(_0x384522,null))[_0x7c57('0x19')](respondWithResult(_0x384522,null))[_0x7c57('0x22')](handleError(_0x384522,null));};exports[_0x7c57('0x50')]=function(_0x4cf9bd,_0x3d4058,_0x5413cb){var _0x102f16;return db['VoiceContext'][_0x7c57('0x50')](_0x4cf9bd[_0x7c57('0x51')],{'raw':!![]})[_0x7c57('0x19')](function(_0x1bc6e3){_0x102f16=_0x1bc6e3;return db['VoiceContext'][_0x7c57('0x49')]({'raw':!![]});})['then'](function(_0x5956fc){var _0x3a1916=fs[_0x7c57('0x52')](path[_0x7c57('0x53')](config['root'],_0x7c57('0x54')),'utf8');var _0x501a95=ejs[_0x7c57('0x55')](_0x3a1916,{'contexts':_0x5956fc||[]});fs[_0x7c57('0x56')](_0x7c57('0x57'),_0x501a95);})[_0x7c57('0x19')](function(){return respondWithRpcPromise(_0x7c57('0x58'),'create',{'module':_0x7c57('0x59')});})[_0x7c57('0x19')](function(){var _0x308c30=_0x4cf9bd[_0x7c57('0x5a')][_0x7c57('0x5b')]({'plain':!![]});if(!_0x308c30)throw new Error(_0x7c57('0x5c'));if(_0x308c30['role']===_0x7c57('0x5a')){var _0x1932c9=_0x102f16['get']({'plain':!![]});return db[_0x7c57('0x5d')][_0x7c57('0x4f')]({'where':{'name':_0x7c57('0x2f'),'userProfileId':_0x308c30[_0x7c57('0x5e')]},'raw':!![]})[_0x7c57('0x19')](function(_0x5ed473){if(_0x5ed473&&_0x5ed473['autoAssociation']===0x0){return db[_0x7c57('0x30')][_0x7c57('0x50')]({'name':_0x1932c9[_0x7c57('0x32')],'resourceId':_0x1932c9['id'],'type':_0x5ed473['name'],'sectionId':_0x5ed473['id']},{})[_0x7c57('0x19')](function(){return _0x102f16;});}else{return _0x102f16;}})['catch'](function(_0x25ac18){logger['error'](_0x7c57('0x5f'),_0x25ac18);throw _0x25ac18;});}return _0x102f16;})[_0x7c57('0x19')](respondWithResult(_0x3d4058,0xc9))[_0x7c57('0x22')](handleError(_0x3d4058,null));};exports['update']=function(_0x22f93b,_0x2a2db1,_0x1b0fda){var _0xb5d25a;return db[_0x7c57('0x35')][_0x7c57('0x4f')]({'where':{'id':_0x22f93b['params']['id']}})['then'](handleEntityNotFound(_0x2a2db1,null))[_0x7c57('0x19')](saveUpdates(_0x22f93b[_0x7c57('0x51')],null))[_0x7c57('0x19')](function(_0x50d2b2){if(_0x50d2b2){_0xb5d25a=_0x50d2b2;return db[_0x7c57('0x35')]['findAll']({'raw':!![]});}})[_0x7c57('0x19')](function(_0x5685c1){var _0x1bff0a=fs[_0x7c57('0x52')](path[_0x7c57('0x53')](config[_0x7c57('0x60')],_0x7c57('0x54')),_0x7c57('0x61'));var _0x4899fe=ejs[_0x7c57('0x55')](_0x1bff0a,{'contexts':_0x5685c1||[]});fs['writeFileSync'](_0x7c57('0x57'),_0x4899fe);})[_0x7c57('0x19')](function(){return respondWithRpcPromise(_0x7c57('0x58'),_0x7c57('0x2d'),{'module':_0x7c57('0x59')});})[_0x7c57('0x19')](function(){return _0xb5d25a;})[_0x7c57('0x19')](respondWithResult(_0x2a2db1,null))[_0x7c57('0x22')](handleError(_0x2a2db1,null));};exports['destroy']=function(_0x3a7149,_0x3eaa9d,_0x286b76){var _0x5391cb;return db[_0x7c57('0x35')][_0x7c57('0x4f')]({'where':{'id':_0x3a7149[_0x7c57('0x62')]['id']}})['then'](handleEntityNotFound(_0x3eaa9d,null))['then'](removeEntity(_0x3eaa9d,null))['then'](function(){return db[_0x7c57('0x35')][_0x7c57('0x49')]({'raw':!![]});})[_0x7c57('0x19')](function(_0x1b9ef2){var _0x357c61=fs[_0x7c57('0x52')](path['join'](config[_0x7c57('0x60')],'server/files/templates/context.ejs'),_0x7c57('0x61'));var _0x378246=ejs['render'](_0x357c61,{'contexts':_0x1b9ef2});fs[_0x7c57('0x56')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x378246);return respondWithRpcPromise('Reload','destroy',{'module':_0x7c57('0x59')});})[_0x7c57('0x22')](handleError(_0x3eaa9d,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 04fd801..6a498b9 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 _0xd7ca=['rimraf','../../config/environment','exports','define','VoiceContext','voice_contexts','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52ea08,_0x15d935){var _0x28d546=function(_0x4a3aa7){while(--_0x4a3aa7){_0x52ea08['push'](_0x52ea08['shift']());}};_0x28d546(++_0x15d935);}(_0xd7ca,0xa0));var _0xad7c=function(_0x34e7ef,_0x531a94){_0x34e7ef=_0x34e7ef-0x0;var _0x595878=_0xd7ca[_0x34e7ef];return _0x595878;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xad7c('0x0'))(_0xad7c('0x1'));var moment=require(_0xad7c('0x2'));var BPromise=require(_0xad7c('0x3'));var rp=require(_0xad7c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad7c('0x5'));var config=require(_0xad7c('0x6'));var attributes=require('./voiceContext.attributes');module[_0xad7c('0x7')]=function(_0xf2244a,_0x1ddbc5){return _0xf2244a[_0xad7c('0x8')](_0xad7c('0x9'),attributes,{'tableName':_0xad7c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7008=['../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x33ce26,_0x4685b1){var _0x5aad96=function(_0x4d7b89){while(--_0x4d7b89){_0x33ce26['push'](_0x33ce26['shift']());}};_0x5aad96(++_0x4685b1);}(_0x7008,0x185));var _0x8700=function(_0x3f5d0b,_0x383a49){_0x3f5d0b=_0x3f5d0b-0x0;var _0x589df0=_0x7008[_0x3f5d0b];return _0x589df0;};'use strict';var _=require(_0x8700('0x0'));var util=require(_0x8700('0x1'));var logger=require(_0x8700('0x2'))(_0x8700('0x3'));var moment=require('moment');var BPromise=require(_0x8700('0x4'));var rp=require(_0x8700('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8700('0x6'));var config=require(_0x8700('0x7'));var attributes=require(_0x8700('0x8'));module[_0x8700('0x9')]=function(_0x3470a4,_0xf9a514){return _0x3470a4[_0x8700('0xa')]('VoiceContext',attributes,{'tableName':_0x8700('0xb'),'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 8124673..8534b21 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 _0x8135=['info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x4c79f4,_0x1a9829){var _0x1a705b=function(_0xbc585b){while(--_0xbc585b){_0x4c79f4['push'](_0x4c79f4['shift']());}};_0x1a705b(++_0x1a9829);}(_0x8135,0x171));var _0x5813=function(_0x51a96a,_0xfd3e84){_0x51a96a=_0x51a96a-0x0;var _0x4207d8=_0x8135[_0x51a96a];return _0x4207d8;};'use strict';var _=require(_0x5813('0x0'));var util=require(_0x5813('0x1'));var moment=require('moment');var BPromise=require(_0x5813('0x2'));var rs=require(_0x5813('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5813('0x4'));var logger=require(_0x5813('0x5'))(_0x5813('0x6'));var config=require(_0x5813('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5813('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x517898,_0x4fd2c8,_0x5c6798){return new BPromise(function(_0x32f39e,_0x209cb3){return client[_0x5813('0x9')](_0x517898,_0x5c6798)[_0x5813('0xa')](function(_0x5a4be3){logger[_0x5813('0xb')](_0x5813('0xc'),_0x4fd2c8,_0x5813('0xd'));logger['debug'](_0x5813('0xe'),_0x4fd2c8,_0x5813('0xd'),JSON['stringify'](_0x5a4be3));if(_0x5a4be3[_0x5813('0xf')]){if(_0x5a4be3[_0x5813('0xf')][_0x5813('0x10')]===0x1f4){logger['error'](_0x5813('0xc'),_0x4fd2c8,_0x5a4be3[_0x5813('0xf')]['message']);return _0x209cb3(_0x5a4be3[_0x5813('0xf')]['message']);}logger[_0x5813('0xf')](_0x5813('0xc'),_0x4fd2c8,_0x5a4be3[_0x5813('0xf')]['message']);return _0x32f39e(_0x5a4be3[_0x5813('0xf')][_0x5813('0x11')]);}else{logger[_0x5813('0xb')](_0x5813('0xc'),_0x4fd2c8,_0x5813('0xd'));_0x32f39e(_0x5a4be3[_0x5813('0x12')]['message']);}})[_0x5813('0x13')](function(_0x16cbe5){logger[_0x5813('0xf')](_0x5813('0xc'),_0x4fd2c8,_0x16cbe5);_0x209cb3(_0x16cbe5);});});} \ No newline at end of file +var _0x4d41=['request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','VoiceContext,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then'];(function(_0x4eb36b,_0x559b66){var _0x591d65=function(_0xfac404){while(--_0xfac404){_0x4eb36b['push'](_0x4eb36b['shift']());}};_0x591d65(++_0x559b66);}(_0x4d41,0x153));var _0x14d4=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x4d41[_0xcf5436];return _0xc4f5c8;};'use strict';var _=require(_0x14d4('0x0'));var util=require(_0x14d4('0x1'));var moment=require(_0x14d4('0x2'));var BPromise=require('bluebird');var rs=require(_0x14d4('0x3'));var fs=require('fs');var Redis=require(_0x14d4('0x4'));var db=require(_0x14d4('0x5'))['db'];var utils=require(_0x14d4('0x6'));var logger=require(_0x14d4('0x7'))(_0x14d4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x14d4('0x9')][_0x14d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f7d30,_0x586569,_0x5a6cc0){return new BPromise(function(_0x5af0d5,_0x38ad4e){return client[_0x14d4('0xb')](_0x2f7d30,_0x5a6cc0)[_0x14d4('0xc')](function(_0x466286){logger['info']('VoiceContext,\x20%s,\x20%s',_0x586569,_0x14d4('0xd'));logger[_0x14d4('0xe')](_0x14d4('0xf'),_0x586569,'request\x20sent',JSON['stringify'](_0x466286));if(_0x466286[_0x14d4('0x10')]){if(_0x466286['error'][_0x14d4('0x11')]===0x1f4){logger[_0x14d4('0x10')]('VoiceContext,\x20%s,\x20%s',_0x586569,_0x466286[_0x14d4('0x10')][_0x14d4('0x12')]);return _0x38ad4e(_0x466286[_0x14d4('0x10')][_0x14d4('0x12')]);}logger[_0x14d4('0x10')](_0x14d4('0x13'),_0x586569,_0x466286[_0x14d4('0x10')][_0x14d4('0x12')]);return _0x5af0d5(_0x466286[_0x14d4('0x10')]['message']);}else{logger[_0x14d4('0x14')](_0x14d4('0x13'),_0x586569,_0x14d4('0xd'));_0x5af0d5(_0x466286['result'][_0x14d4('0x12')]);}})[_0x14d4('0x15')](function(_0x2eafb9){logger[_0x14d4('0x10')](_0x14d4('0x13'),_0x586569,_0x2eafb9);_0x38ad4e(_0x2eafb9);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 890a5ab..d9d9b11 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 _0xaab2=['show','post','create','put','update','delete','destroy','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3f013d,_0x192af1){var _0x4481a3=function(_0x51de9f){while(--_0x51de9f){_0x3f013d['push'](_0x3f013d['shift']());}};_0x4481a3(++_0x192af1);}(_0xaab2,0x15b));var _0x2aab=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xaab2[_0x28947d];return _0x12d2ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2aab('0x0'));var timeout=require(_0x2aab('0x1'));var express=require(_0x2aab('0x2'));var router=express['Router']();var fs_extra=require(_0x2aab('0x3'));var auth=require(_0x2aab('0x4'));var interaction=require(_0x2aab('0x5'));var config=require('../../config/environment');var controller=require(_0x2aab('0x6'));router[_0x2aab('0x7')]('/',auth[_0x2aab('0x8')](),controller[_0x2aab('0x9')]);router[_0x2aab('0x7')](_0x2aab('0xa'),auth[_0x2aab('0x8')](),controller[_0x2aab('0xb')]);router[_0x2aab('0x7')](_0x2aab('0xc'),auth[_0x2aab('0x8')](),controller[_0x2aab('0xd')]);router[_0x2aab('0xe')]('/',auth['isAuthenticated'](),controller[_0x2aab('0xf')]);router[_0x2aab('0x10')](_0x2aab('0xc'),auth[_0x2aab('0x8')](),controller[_0x2aab('0x11')]);router[_0x2aab('0x12')]('/:id',auth[_0x2aab('0x8')](),controller[_0x2aab('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbaa8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','create','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x3a7e8b,_0x59bac4){var _0x250d46=function(_0x135675){while(--_0x135675){_0x3a7e8b['push'](_0x3a7e8b['shift']());}};_0x250d46(++_0x59bac4);}(_0xbaa8,0x1a5));var _0x8baa=function(_0x56ea30,_0x56a1d6){_0x56ea30=_0x56ea30-0x0;var _0x4632ad=_0xbaa8[_0x56ea30];return _0x4632ad;};'use strict';var multer=require(_0x8baa('0x0'));var util=require(_0x8baa('0x1'));var path=require(_0x8baa('0x2'));var timeout=require(_0x8baa('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8baa('0x4'));var auth=require(_0x8baa('0x5'));var interaction=require(_0x8baa('0x6'));var config=require(_0x8baa('0x7'));var controller=require('./voiceDialReport.controller');router[_0x8baa('0x8')]('/',auth[_0x8baa('0x9')](),controller['index']);router[_0x8baa('0x8')](_0x8baa('0xa'),auth[_0x8baa('0x9')](),controller['describe']);router[_0x8baa('0x8')](_0x8baa('0xb'),auth['isAuthenticated'](),controller[_0x8baa('0xc')]);router['post']('/',auth[_0x8baa('0x9')](),controller[_0x8baa('0xd')]);router[_0x8baa('0xe')](_0x8baa('0xb'),auth['isAuthenticated'](),controller[_0x8baa('0xf')]);router['delete'](_0x8baa('0xb'),auth[_0x8baa('0x9')](),controller[_0x8baa('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index d199e97..71a2c4b 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 _0x6aa7=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x1c9fa8,_0x48fb2f){var _0x20c648=function(_0x2773af){while(--_0x2773af){_0x1c9fa8['push'](_0x1c9fa8['shift']());}};_0x20c648(++_0x48fb2f);}(_0x6aa7,0x178));var _0x76aa=function(_0x66906b,_0x3da330){_0x66906b=_0x66906b-0x0;var _0x417902=_0x6aa7[_0x66906b];return _0x417902;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'channelstate':{'type':Sequelize[_0x76aa('0x2')]},'channelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x76aa('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x2')]},'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'linkedid':{'type':Sequelize[_0x76aa('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x76aa('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'destlanguage':{'type':Sequelize[_0x76aa('0x1')]},'destaccountcode':{'type':Sequelize[_0x76aa('0x1')]},'destcontext':{'type':Sequelize[_0x76aa('0x1')]},'destexten':{'type':Sequelize[_0x76aa('0x1')]},'destpriority':{'type':Sequelize[_0x76aa('0x2')]},'destuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'destlinkedid':{'type':Sequelize[_0x76aa('0x1')]},'dialstring':{'type':Sequelize[_0x76aa('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x76aa('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x76aa('0x3')]},'lastevent':{'type':Sequelize[_0x76aa('0x1')],'comment':_0x76aa('0x4')},'routeId':{'type':Sequelize[_0x76aa('0x2')]},'duration':{'type':Sequelize[_0x76aa('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x008c=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x6e83db,_0x442361){var _0x14f28d=function(_0x296cac){while(--_0x296cac){_0x6e83db['push'](_0x6e83db['shift']());}};_0x14f28d(++_0x442361);}(_0x008c,0x188));var _0xc008=function(_0x12b40a,_0x2a06ae){_0x12b40a=_0x12b40a-0x0;var _0x4e549c=_0x008c[_0x12b40a];return _0x4e549c;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'privilege':{'type':Sequelize[_0xc008('0x2')]},'channel':{'type':Sequelize[_0xc008('0x2')]},'channelstate':{'type':Sequelize[_0xc008('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc008('0x2')]},'calleridname':{'type':Sequelize[_0xc008('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'connectedlinename':{'type':Sequelize[_0xc008('0x2')]},'language':{'type':Sequelize[_0xc008('0x2')]},'accountcode':{'type':Sequelize[_0xc008('0x2')]},'context':{'type':Sequelize[_0xc008('0x2')]},'exten':{'type':Sequelize[_0xc008('0x2')]},'priority':{'type':Sequelize[_0xc008('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xc008('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc008('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc008('0x2')]},'destexten':{'type':Sequelize[_0xc008('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xc008('0x2')]},'destlinkedid':{'type':Sequelize[_0xc008('0x2')]},'dialstring':{'type':Sequelize[_0xc008('0x2')]},'dialstatus':{'type':Sequelize[_0xc008('0x2')]},'starttime':{'type':Sequelize[_0xc008('0x4')]},'answertime':{'type':Sequelize[_0xc008('0x4')]},'endtime':{'type':Sequelize[_0xc008('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xc008('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xc008('0x3')]},'billableseconds':{'type':Sequelize[_0xc008('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 62f477f..4875b2e 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 _0x2b5f=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','where','merge','VIRTUAL','VoiceDialReport','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0x2b5f,0x15d));var _0xf2b5=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2b5f[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2b5('0x0'));var zipdir=require(_0xf2b5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2b5('0x2'));var moment=require(_0xf2b5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf2b5('0x4'));var sox=require(_0xf2b5('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf2b5('0x6'));var _=require(_0xf2b5('0x7'));var squel=require(_0xf2b5('0x8'));var crypto=require(_0xf2b5('0x9'));var jsforce=require(_0xf2b5('0xa'));var deskjs=require(_0xf2b5('0xb'));var toCsv=require(_0xf2b5('0xc'));var querystring=require(_0xf2b5('0xd'));var Papa=require(_0xf2b5('0xe'));var Redis=require(_0xf2b5('0xf'));var authService=require(_0xf2b5('0x10'));var qs=require(_0xf2b5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf2b5('0x12'));var logger=require(_0xf2b5('0x13'))('api');var utils=require(_0xf2b5('0x14'));var config=require(_0xf2b5('0x15'));var licenseUtil=require(_0xf2b5('0x16'));var db=require(_0xf2b5('0x17'))['db'];function respondWithStatusCode(_0x5b3cf3,_0x4d63fe){_0x4d63fe=_0x4d63fe||0xcc;return function(_0x31d070){if(_0x31d070){return _0x5b3cf3[_0xf2b5('0x18')](_0x4d63fe);}return _0x5b3cf3[_0xf2b5('0x19')](_0x4d63fe)[_0xf2b5('0x1a')]();};}function respondWithResult(_0x2768a2,_0x4a8bfb){_0x4a8bfb=_0x4a8bfb||0xc8;return function(_0xa9bc62){if(_0xa9bc62){return _0x2768a2['status'](_0x4a8bfb)['json'](_0xa9bc62);}};}function respondWithFilteredResult(_0x6270f5,_0x58d224){return function(_0x5163d4){if(_0x5163d4){var _0x450678=typeof _0x58d224[_0xf2b5('0x1b')]==='undefined'&&typeof _0x58d224['limit']===_0xf2b5('0x1c');var _0x1134b4=_0x5163d4[_0xf2b5('0x1d')];var _0x27a857=_0x450678?0x0:_0x58d224[_0xf2b5('0x1b')];var _0x1d806b=_0x450678?_0x5163d4[_0xf2b5('0x1d')]:_0x58d224['offset']+_0x58d224[_0xf2b5('0x1e')];var _0x497844;if(_0x1d806b>=_0x1134b4){_0x1d806b=_0x1134b4;_0x497844=0xc8;}else{_0x497844=0xce;}_0x6270f5[_0xf2b5('0x19')](_0x497844);return _0x6270f5[_0xf2b5('0x1f')](_0xf2b5('0x20'),_0x27a857+'-'+_0x1d806b+'/'+_0x1134b4)['json'](_0x5163d4);}return null;};}function patchUpdates(_0x54cdb9){return function(_0x14283b){try{jsonpatch[_0xf2b5('0x21')](_0x14283b,_0x54cdb9,!![]);}catch(_0x45bc4c){return BPromise[_0xf2b5('0x22')](_0x45bc4c);}return _0x14283b[_0xf2b5('0x23')]();};}function saveUpdates(_0x1e5102,_0x3b799d){return function(_0x4e558f){if(_0x4e558f){return _0x4e558f[_0xf2b5('0x24')](_0x1e5102)['then'](function(_0x5efe7d){return _0x5efe7d;});}return null;};}function removeEntity(_0x51d07a,_0x1d6a0a){return function(_0xfb02d){if(_0xfb02d){return _0xfb02d[_0xf2b5('0x25')]()[_0xf2b5('0x26')](function(){_0x51d07a['status'](0xcc)[_0xf2b5('0x1a')]();});}};}function handleEntityNotFound(_0xb214a5,_0x344923){return function(_0x5e9f2a){if(!_0x5e9f2a){_0xb214a5['sendStatus'](0x194);}return _0x5e9f2a;};}function handleError(_0x31d0dd,_0x13123e){_0x13123e=_0x13123e||0x1f4;return function(_0x459951){logger['error'](_0x459951[_0xf2b5('0x27')]);if(_0x459951[_0xf2b5('0x28')]){delete _0x459951[_0xf2b5('0x28')];}_0x31d0dd[_0xf2b5('0x19')](_0x13123e)[_0xf2b5('0x29')](_0x459951);};}exports['index']=function(_0x4d3061,_0x5a3832){var _0x100548={},_0x496ca4={},_0x1ffddd={'count':0x0,'rows':[]};var _0x31f69d=_['map'](db['VoiceDialReport'][_0xf2b5('0x2a')],function(_0x2ecb29){return{'name':_0x2ecb29['fieldName'],'type':_0x2ecb29[_0xf2b5('0x2b')][_0xf2b5('0x2c')]};});_0x496ca4[_0xf2b5('0x2d')]=_[_0xf2b5('0x2e')](_0x31f69d,_0xf2b5('0x28'));_0x496ca4[_0xf2b5('0x2f')]=_[_0xf2b5('0x30')](_0x4d3061['query']);_0x496ca4['filters']=_[_0xf2b5('0x31')](_0x496ca4[_0xf2b5('0x2d')],_0x496ca4[_0xf2b5('0x2f')]);_0x100548[_0xf2b5('0x32')]=_[_0xf2b5('0x31')](_0x496ca4[_0xf2b5('0x2d')],qs['fields'](_0x4d3061[_0xf2b5('0x2f')][_0xf2b5('0x33')]));_0x100548[_0xf2b5('0x32')]=_0x100548['attributes'][_0xf2b5('0x34')]?_0x100548[_0xf2b5('0x32')]:_0x496ca4[_0xf2b5('0x2d')];if(!_0x4d3061['query'][_0xf2b5('0x35')](_0xf2b5('0x36'))){_0x100548['limit']=qs['limit'](_0x4d3061[_0xf2b5('0x2f')][_0xf2b5('0x1e')]);_0x100548[_0xf2b5('0x1b')]=qs[_0xf2b5('0x1b')](_0x4d3061[_0xf2b5('0x2f')][_0xf2b5('0x1b')]);}_0x100548['order']=qs[_0xf2b5('0x37')](_0x4d3061[_0xf2b5('0x2f')][_0xf2b5('0x37')]);_0x100548['where']=qs['filters'](_[_0xf2b5('0x38')](_0x4d3061['query'],_0x496ca4[_0xf2b5('0x39')]),_0x31f69d);if(_0x4d3061[_0xf2b5('0x2f')]['filter']){_0x100548[_0xf2b5('0x3a')]=_[_0xf2b5('0x3b')](_0x100548[_0xf2b5('0x3a')],{'$or':_['map'](_0x31f69d,function(_0x15e70b){if(_0x15e70b[_0xf2b5('0x2b')]!==_0xf2b5('0x3c')){var _0x153b33={};_0x153b33[_0x15e70b['name']]={'$like':'%'+_0x4d3061['query']['filter']+'%'};return _0x153b33;}})});}_0x100548=_['merge']({},_0x100548,_0x4d3061['options']);var _0xcb526d={'where':_0x100548[_0xf2b5('0x3a')]};return db[_0xf2b5('0x3d')][_0xf2b5('0x1d')](_0xcb526d)[_0xf2b5('0x26')](function(_0x243028){_0x1ffddd[_0xf2b5('0x1d')]=_0x243028;if(_0x4d3061[_0xf2b5('0x2f')][_0xf2b5('0x3e')]){_0x100548[_0xf2b5('0x3f')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xf2b5('0x40')](_0x100548);})[_0xf2b5('0x26')](function(_0x30f32b){_0x1ffddd[_0xf2b5('0x41')]=_0x30f32b;return _0x1ffddd;})[_0xf2b5('0x26')](respondWithFilteredResult(_0x5a3832,_0x100548))[_0xf2b5('0x42')](handleError(_0x5a3832,null));};exports[_0xf2b5('0x43')]=function(_0x13120b,_0x821fe1){var _0x407bae={'raw':!![],'where':{'id':_0x13120b['params']['id']}},_0x181dae={};_0x181dae[_0xf2b5('0x2d')]=_[_0xf2b5('0x30')](db['VoiceDialReport'][_0xf2b5('0x2a')]);_0x181dae[_0xf2b5('0x2f')]=_[_0xf2b5('0x30')](_0x13120b[_0xf2b5('0x2f')]);_0x181dae['filters']=_[_0xf2b5('0x31')](_0x181dae[_0xf2b5('0x2d')],_0x181dae[_0xf2b5('0x2f')]);_0x407bae[_0xf2b5('0x32')]=_[_0xf2b5('0x31')](_0x181dae[_0xf2b5('0x2d')],qs[_0xf2b5('0x33')](_0x13120b[_0xf2b5('0x2f')][_0xf2b5('0x33')]));_0x407bae[_0xf2b5('0x32')]=_0x407bae[_0xf2b5('0x32')][_0xf2b5('0x34')]?_0x407bae[_0xf2b5('0x32')]:_0x181dae[_0xf2b5('0x2d')];if(_0x13120b['query'][_0xf2b5('0x3e')]){_0x407bae[_0xf2b5('0x3f')]=[{'all':!![]}];}_0x407bae=_[_0xf2b5('0x3b')]({},_0x407bae,_0x13120b['options']);return db[_0xf2b5('0x3d')][_0xf2b5('0x44')](_0x407bae)[_0xf2b5('0x26')](handleEntityNotFound(_0x821fe1,null))[_0xf2b5('0x26')](respondWithResult(_0x821fe1,null))['catch'](handleError(_0x821fe1,null));};exports[_0xf2b5('0x45')]=function(_0x454642,_0x5a4135){return db['VoiceDialReport']['create'](_0x454642[_0xf2b5('0x46')],{})['then'](respondWithResult(_0x5a4135,0xc9))[_0xf2b5('0x42')](handleError(_0x5a4135,null));};exports[_0xf2b5('0x24')]=function(_0x3db03d,_0x5d4adf){if(_0x3db03d['body']['id']){delete _0x3db03d['body']['id'];}return db[_0xf2b5('0x3d')][_0xf2b5('0x44')]({'where':{'id':_0x3db03d[_0xf2b5('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d4adf,null))[_0xf2b5('0x26')](saveUpdates(_0x3db03d[_0xf2b5('0x46')],null))[_0xf2b5('0x26')](respondWithResult(_0x5d4adf,null))[_0xf2b5('0x42')](handleError(_0x5d4adf,null));};exports[_0xf2b5('0x25')]=function(_0x513424,_0x3f4f06){return db[_0xf2b5('0x3d')][_0xf2b5('0x44')]({'where':{'id':_0x513424[_0xf2b5('0x47')]['id']}})[_0xf2b5('0x26')](handleEntityNotFound(_0x3f4f06,null))[_0xf2b5('0x26')](removeEntity(_0x3f4f06,null))[_0xf2b5('0x42')](handleError(_0x3f4f06,null));};exports[_0xf2b5('0x48')]=function(_0x1228a2,_0xa87558){return db[_0xf2b5('0x3d')][_0xf2b5('0x48')]()[_0xf2b5('0x26')](respondWithResult(_0xa87558,null))['catch'](handleError(_0xa87558,null));}; \ No newline at end of file +var _0x9f47=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','map','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceDialReport','findAll','rows','catch','params','keys','rawAttributes','find','create','body','destroy','describe','eml-format','rimraf','zip-dir'];(function(_0x2ce08c,_0x58ce90){var _0x3db6bd=function(_0x24c3a5){while(--_0x24c3a5){_0x2ce08c['push'](_0x2ce08c['shift']());}};_0x3db6bd(++_0x58ce90);}(_0x9f47,0x1d1));var _0x79f4=function(_0x90ae6b,_0x119509){_0x90ae6b=_0x90ae6b-0x0;var _0x44f507=_0x9f47[_0x90ae6b];return _0x44f507;};'use strict';var emlformat=require(_0x79f4('0x0'));var rimraf=require(_0x79f4('0x1'));var zipdir=require(_0x79f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x79f4('0x3'));var moment=require(_0x79f4('0x4'));var BPromise=require(_0x79f4('0x5'));var Mustache=require(_0x79f4('0x6'));var util=require(_0x79f4('0x7'));var path=require(_0x79f4('0x8'));var sox=require(_0x79f4('0x9'));var csv=require(_0x79f4('0xa'));var ejs=require(_0x79f4('0xb'));var fs=require('fs');var fs_extra=require(_0x79f4('0xc'));var _=require(_0x79f4('0xd'));var squel=require('squel');var crypto=require(_0x79f4('0xe'));var jsforce=require(_0x79f4('0xf'));var deskjs=require(_0x79f4('0x10'));var toCsv=require(_0x79f4('0xa'));var querystring=require(_0x79f4('0x11'));var Papa=require(_0x79f4('0x12'));var Redis=require(_0x79f4('0x13'));var authService=require(_0x79f4('0x14'));var qs=require(_0x79f4('0x15'));var as=require(_0x79f4('0x16'));var hardwareService=require(_0x79f4('0x17'));var logger=require(_0x79f4('0x18'))(_0x79f4('0x19'));var utils=require(_0x79f4('0x1a'));var config=require(_0x79f4('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x79f4('0x1c'))['db'];function respondWithStatusCode(_0x11961c,_0x1c3f28){_0x1c3f28=_0x1c3f28||0xcc;return function(_0x1d733c){if(_0x1d733c){return _0x11961c['sendStatus'](_0x1c3f28);}return _0x11961c[_0x79f4('0x1d')](_0x1c3f28)['end']();};}function respondWithResult(_0x540299,_0x23dc70){_0x23dc70=_0x23dc70||0xc8;return function(_0x674f01){if(_0x674f01){return _0x540299['status'](_0x23dc70)[_0x79f4('0x1e')](_0x674f01);}};}function respondWithFilteredResult(_0x199b40,_0x3429b0){return function(_0x12e113){if(_0x12e113){var _0x3e40d1=typeof _0x3429b0[_0x79f4('0x1f')]===_0x79f4('0x20')&&typeof _0x3429b0[_0x79f4('0x21')]===_0x79f4('0x20');var _0x464197=_0x12e113[_0x79f4('0x22')];var _0x4253e8=_0x3e40d1?0x0:_0x3429b0[_0x79f4('0x1f')];var _0x516b86=_0x3e40d1?_0x12e113[_0x79f4('0x22')]:_0x3429b0[_0x79f4('0x1f')]+_0x3429b0[_0x79f4('0x21')];var _0x110e4b;if(_0x516b86>=_0x464197){_0x516b86=_0x464197;_0x110e4b=0xc8;}else{_0x110e4b=0xce;}_0x199b40['status'](_0x110e4b);return _0x199b40[_0x79f4('0x23')](_0x79f4('0x24'),_0x4253e8+'-'+_0x516b86+'/'+_0x464197)[_0x79f4('0x1e')](_0x12e113);}return null;};}function patchUpdates(_0x40a257){return function(_0x1956eb){try{jsonpatch[_0x79f4('0x25')](_0x1956eb,_0x40a257,!![]);}catch(_0x22aef2){return BPromise[_0x79f4('0x26')](_0x22aef2);}return _0x1956eb['save']();};}function saveUpdates(_0x107f99,_0x188a1d){return function(_0x1d80df){if(_0x1d80df){return _0x1d80df[_0x79f4('0x27')](_0x107f99)[_0x79f4('0x28')](function(_0x4036f1){return _0x4036f1;});}return null;};}function removeEntity(_0x575e4c,_0x1e09a6){return function(_0x4e96cd){if(_0x4e96cd){return _0x4e96cd['destroy']()[_0x79f4('0x28')](function(){_0x575e4c[_0x79f4('0x1d')](0xcc)[_0x79f4('0x29')]();});}};}function handleEntityNotFound(_0x562ddd,_0x3bc1dd){return function(_0x14796a){if(!_0x14796a){_0x562ddd['sendStatus'](0x194);}return _0x14796a;};}function handleError(_0x5284c9,_0x335975){_0x335975=_0x335975||0x1f4;return function(_0x50444d){logger[_0x79f4('0x2a')](_0x50444d[_0x79f4('0x2b')]);if(_0x50444d[_0x79f4('0x2c')]){delete _0x50444d[_0x79f4('0x2c')];}_0x5284c9[_0x79f4('0x1d')](_0x335975)['send'](_0x50444d);};}exports['index']=function(_0x1634fc,_0x1daf8f){var _0x455e9e={},_0x4ebb5d={},_0x4f6768={'count':0x0,'rows':[]};var _0x31f645=_[_0x79f4('0x2d')](db['VoiceDialReport']['rawAttributes'],function(_0x373346){return{'name':_0x373346['fieldName'],'type':_0x373346[_0x79f4('0x2e')]['key']};});_0x4ebb5d[_0x79f4('0x2f')]=_['map'](_0x31f645,'name');_0x4ebb5d[_0x79f4('0x30')]=_['keys'](_0x1634fc[_0x79f4('0x30')]);_0x4ebb5d[_0x79f4('0x31')]=_['intersection'](_0x4ebb5d[_0x79f4('0x2f')],_0x4ebb5d[_0x79f4('0x30')]);_0x455e9e['attributes']=_[_0x79f4('0x32')](_0x4ebb5d[_0x79f4('0x2f')],qs[_0x79f4('0x33')](_0x1634fc[_0x79f4('0x30')]['fields']));_0x455e9e[_0x79f4('0x34')]=_0x455e9e[_0x79f4('0x34')][_0x79f4('0x35')]?_0x455e9e[_0x79f4('0x34')]:_0x4ebb5d['model'];if(!_0x1634fc['query'][_0x79f4('0x36')](_0x79f4('0x37'))){_0x455e9e[_0x79f4('0x21')]=qs['limit'](_0x1634fc['query'][_0x79f4('0x21')]);_0x455e9e[_0x79f4('0x1f')]=qs[_0x79f4('0x1f')](_0x1634fc[_0x79f4('0x30')][_0x79f4('0x1f')]);}_0x455e9e[_0x79f4('0x38')]=qs[_0x79f4('0x39')](_0x1634fc[_0x79f4('0x30')][_0x79f4('0x39')]);_0x455e9e[_0x79f4('0x3a')]=qs[_0x79f4('0x31')](_[_0x79f4('0x3b')](_0x1634fc[_0x79f4('0x30')],_0x4ebb5d[_0x79f4('0x31')]),_0x31f645);if(_0x1634fc[_0x79f4('0x30')][_0x79f4('0x3c')]){_0x455e9e[_0x79f4('0x3a')]=_[_0x79f4('0x3d')](_0x455e9e[_0x79f4('0x3a')],{'$or':_[_0x79f4('0x2d')](_0x31f645,function(_0x3d7fbf){if(_0x3d7fbf[_0x79f4('0x2e')]!==_0x79f4('0x3e')){var _0xcf89e2={};_0xcf89e2[_0x3d7fbf[_0x79f4('0x2c')]]={'$like':'%'+_0x1634fc[_0x79f4('0x30')][_0x79f4('0x3c')]+'%'};return _0xcf89e2;}})});}_0x455e9e=_[_0x79f4('0x3d')]({},_0x455e9e,_0x1634fc[_0x79f4('0x3f')]);var _0x4644a3={'where':_0x455e9e[_0x79f4('0x3a')]};return db['VoiceDialReport'][_0x79f4('0x22')](_0x4644a3)['then'](function(_0x431f28){_0x4f6768[_0x79f4('0x22')]=_0x431f28;if(_0x1634fc['query'][_0x79f4('0x40')]){_0x455e9e[_0x79f4('0x41')]=[{'all':!![]}];}return db[_0x79f4('0x42')][_0x79f4('0x43')](_0x455e9e);})[_0x79f4('0x28')](function(_0x110578){_0x4f6768[_0x79f4('0x44')]=_0x110578;return _0x4f6768;})[_0x79f4('0x28')](respondWithFilteredResult(_0x1daf8f,_0x455e9e))[_0x79f4('0x45')](handleError(_0x1daf8f,null));};exports['show']=function(_0x198d0e,_0x2e8b6c){var _0x2dbad3={'raw':!![],'where':{'id':_0x198d0e[_0x79f4('0x46')]['id']}},_0x4342a9={};_0x4342a9['model']=_[_0x79f4('0x47')](db[_0x79f4('0x42')][_0x79f4('0x48')]);_0x4342a9['query']=_['keys'](_0x198d0e[_0x79f4('0x30')]);_0x4342a9['filters']=_[_0x79f4('0x32')](_0x4342a9[_0x79f4('0x2f')],_0x4342a9[_0x79f4('0x30')]);_0x2dbad3[_0x79f4('0x34')]=_[_0x79f4('0x32')](_0x4342a9[_0x79f4('0x2f')],qs[_0x79f4('0x33')](_0x198d0e[_0x79f4('0x30')][_0x79f4('0x33')]));_0x2dbad3['attributes']=_0x2dbad3[_0x79f4('0x34')][_0x79f4('0x35')]?_0x2dbad3[_0x79f4('0x34')]:_0x4342a9[_0x79f4('0x2f')];if(_0x198d0e['query'][_0x79f4('0x40')]){_0x2dbad3[_0x79f4('0x41')]=[{'all':!![]}];}_0x2dbad3=_['merge']({},_0x2dbad3,_0x198d0e['options']);return db[_0x79f4('0x42')][_0x79f4('0x49')](_0x2dbad3)['then'](handleEntityNotFound(_0x2e8b6c,null))[_0x79f4('0x28')](respondWithResult(_0x2e8b6c,null))['catch'](handleError(_0x2e8b6c,null));};exports[_0x79f4('0x4a')]=function(_0x4e30e3,_0x45d328){return db[_0x79f4('0x42')]['create'](_0x4e30e3[_0x79f4('0x4b')],{})[_0x79f4('0x28')](respondWithResult(_0x45d328,0xc9))['catch'](handleError(_0x45d328,null));};exports[_0x79f4('0x27')]=function(_0x83e114,_0x51da02){if(_0x83e114['body']['id']){delete _0x83e114[_0x79f4('0x4b')]['id'];}return db['VoiceDialReport'][_0x79f4('0x49')]({'where':{'id':_0x83e114['params']['id']}})['then'](handleEntityNotFound(_0x51da02,null))[_0x79f4('0x28')](saveUpdates(_0x83e114['body'],null))[_0x79f4('0x28')](respondWithResult(_0x51da02,null))[_0x79f4('0x45')](handleError(_0x51da02,null));};exports[_0x79f4('0x4c')]=function(_0x4fc78d,_0x31068d){return db[_0x79f4('0x42')][_0x79f4('0x49')]({'where':{'id':_0x4fc78d['params']['id']}})[_0x79f4('0x28')](handleEntityNotFound(_0x31068d,null))[_0x79f4('0x28')](removeEntity(_0x31068d,null))['catch'](handleError(_0x31068d,null));};exports[_0x79f4('0x4d')]=function(_0x387e52,_0x3f5195){return db['VoiceDialReport']['describe']()[_0x79f4('0x28')](respondWithResult(_0x3f5195,null))[_0x79f4('0x45')](handleError(_0x3f5195,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index c23e552..52f6105 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 _0xdc0d=['rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','uniqueid','lodash','util','moment','bluebird','path'];(function(_0x3ff2a7,_0x4bd7d1){var _0xb7c07a=function(_0x1b1612){while(--_0x1b1612){_0x3ff2a7['push'](_0x3ff2a7['shift']());}};_0xb7c07a(++_0x4bd7d1);}(_0xdc0d,0xc1));var _0xddc0=function(_0x37c525,_0x4682e8){_0x37c525=_0x37c525-0x0;var _0x1a1151=_0xdc0d[_0x37c525];return _0x1a1151;};'use strict';var _=require(_0xddc0('0x0'));var util=require(_0xddc0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xddc0('0x2'));var BPromise=require(_0xddc0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddc0('0x4'));var rimraf=require(_0xddc0('0x5'));var config=require(_0xddc0('0x6'));var attributes=require(_0xddc0('0x7'));module['exports']=function(_0x9ee883,_0x43ef0b){return _0x9ee883[_0xddc0('0x8')](_0xddc0('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xddc0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf7c4=['bluebird','request-promise','path','../../config/environment','exports','define','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x3fc193,_0x401204){var _0x2aaa56=function(_0x16a6fe){while(--_0x16a6fe){_0x3fc193['push'](_0x3fc193['shift']());}};_0x2aaa56(++_0x401204);}(_0xf7c4,0xc2));var _0x4f7c=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xf7c4[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x4f7c('0x0'));var util=require(_0x4f7c('0x1'));var logger=require(_0x4f7c('0x2'))('api');var moment=require(_0x4f7c('0x3'));var BPromise=require(_0x4f7c('0x4'));var rp=require(_0x4f7c('0x5'));var fs=require('fs');var path=require(_0x4f7c('0x6'));var rimraf=require('rimraf');var config=require(_0x4f7c('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0x4f7c('0x8')]=function(_0x4a4f65,_0x1171a8){return _0x4a4f65[_0x4f7c('0x9')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x4f7c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index bb20431..945c824 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 _0xe107=['raw','UpdateVoiceDialReport','where','attributes','limit','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe107,0xd1));var _0x7e10=function(_0x2a9368,_0x1d4056){_0x2a9368=_0x2a9368-0x0;var _0x38fb55=_0xe107[_0x2a9368];return _0x38fb55;};'use strict';var _=require(_0x7e10('0x0'));var util=require(_0x7e10('0x1'));var moment=require(_0x7e10('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e10('0x3'))['db'];var utils=require(_0x7e10('0x4'));var logger=require(_0x7e10('0x5'))(_0x7e10('0x6'));var config=require(_0x7e10('0x7'));var jayson=require(_0x7e10('0x8'));var client=jayson[_0x7e10('0x9')][_0x7e10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a9082,_0xebd9a8,_0x2746eb){return new BPromise(function(_0x22fb6b,_0x51c8b0){return client[_0x7e10('0xb')](_0x4a9082,_0x2746eb)[_0x7e10('0xc')](function(_0x3350c6){logger[_0x7e10('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0xebd9a8,_0x7e10('0xe'));logger[_0x7e10('0xf')](_0x7e10('0x10'),_0xebd9a8,_0x7e10('0xe'),JSON[_0x7e10('0x11')](_0x3350c6));if(_0x3350c6['error']){if(_0x3350c6[_0x7e10('0x12')][_0x7e10('0x13')]===0x1f4){logger['error'](_0x7e10('0x14'),_0xebd9a8,_0x3350c6[_0x7e10('0x12')]['message']);return _0x51c8b0(_0x3350c6[_0x7e10('0x12')][_0x7e10('0x15')]);}logger[_0x7e10('0x12')](_0x7e10('0x14'),_0xebd9a8,_0x3350c6[_0x7e10('0x12')][_0x7e10('0x15')]);return _0x22fb6b(_0x3350c6[_0x7e10('0x12')][_0x7e10('0x15')]);}else{logger[_0x7e10('0xd')](_0x7e10('0x14'),_0xebd9a8,_0x7e10('0xe'));_0x22fb6b(_0x3350c6[_0x7e10('0x16')][_0x7e10('0x15')]);}})[_0x7e10('0x17')](function(_0x372e6a){logger[_0x7e10('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0xebd9a8,_0x372e6a);_0x51c8b0(_0x372e6a);});});}exports[_0x7e10('0x18')]=function(_0x4b54f6){var _0x512f6a=this;return new Promise(function(_0x3c774f,_0x37e7bd){return db[_0x7e10('0x19')][_0x7e10('0x1a')](_0x4b54f6[_0x7e10('0x1b')],{'raw':_0x4b54f6[_0x7e10('0x1c')]?_0x4b54f6[_0x7e10('0x1c')][_0x7e10('0x1d')]===undefined?!![]:![]:!![]})[_0x7e10('0xc')](function(_0x23a7c7){logger[_0x7e10('0xd')](_0x7e10('0x18'),_0x4b54f6);logger['debug'](_0x7e10('0x18'),_0x4b54f6,JSON[_0x7e10('0x11')](_0x23a7c7));_0x3c774f(_0x23a7c7);})[_0x7e10('0x17')](function(_0x370614){logger[_0x7e10('0x12')]('CreateVoiceDialReport',_0x370614[_0x7e10('0x15')],_0x4b54f6);_0x37e7bd(_0x512f6a[_0x7e10('0x12')](0x1f4,_0x370614[_0x7e10('0x15')]));});});};exports[_0x7e10('0x1e')]=function(_0x55e8ec){var _0x1b2460=this;return new Promise(function(_0x186234,_0x228804){return db['VoiceDialReport']['update'](_0x55e8ec[_0x7e10('0x1b')],{'raw':_0x55e8ec['options']?_0x55e8ec[_0x7e10('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55e8ec[_0x7e10('0x1c')]?_0x55e8ec['options'][_0x7e10('0x1f')]||null:null,'attributes':_0x55e8ec[_0x7e10('0x1c')]?_0x55e8ec[_0x7e10('0x1c')][_0x7e10('0x20')]||null:null,'limit':_0x55e8ec['options']?_0x55e8ec['options'][_0x7e10('0x21')]||null:null})[_0x7e10('0xc')](function(_0x46c9e3){logger[_0x7e10('0xd')](_0x7e10('0x1e'),_0x55e8ec);logger[_0x7e10('0xf')](_0x7e10('0x1e'),_0x55e8ec,JSON[_0x7e10('0x11')](_0x46c9e3));_0x186234(_0x46c9e3);})[_0x7e10('0x17')](function(_0x20c7d4){logger[_0x7e10('0x12')](_0x7e10('0x1e'),_0x20c7d4[_0x7e10('0x15')],_0x55e8ec);_0x228804(_0x1b2460[_0x7e10('0x12')](0x1f4,_0x20c7d4['message']));});});}; \ No newline at end of file +var _0x89fe=['http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','body','where','limit','UpdateVoiceDialReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x89fe,0x73));var _0xe89f=function(_0x1f9086,_0x2ec3ab){_0x1f9086=_0x1f9086-0x0;var _0x40d8f9=_0x89fe[_0x1f9086];return _0x40d8f9;};'use strict';var _=require(_0xe89f('0x0'));var util=require(_0xe89f('0x1'));var moment=require('moment');var BPromise=require(_0xe89f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe89f('0x3'));var db=require(_0xe89f('0x4'))['db'];var utils=require(_0xe89f('0x5'));var logger=require(_0xe89f('0x6'))('rpc');var config=require(_0xe89f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe89f('0x8')][_0xe89f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14f7c7,_0x53aeb0,_0x1d47b6){return new BPromise(function(_0x347567,_0x5a11b){return client[_0xe89f('0xa')](_0x14f7c7,_0x1d47b6)[_0xe89f('0xb')](function(_0x24e7e0){logger['info'](_0xe89f('0xc'),_0x53aeb0,_0xe89f('0xd'));logger[_0xe89f('0xe')](_0xe89f('0xf'),_0x53aeb0,_0xe89f('0xd'),JSON[_0xe89f('0x10')](_0x24e7e0));if(_0x24e7e0[_0xe89f('0x11')]){if(_0x24e7e0[_0xe89f('0x11')][_0xe89f('0x12')]===0x1f4){logger['error'](_0xe89f('0xc'),_0x53aeb0,_0x24e7e0['error'][_0xe89f('0x13')]);return _0x5a11b(_0x24e7e0[_0xe89f('0x11')]['message']);}logger['error'](_0xe89f('0xc'),_0x53aeb0,_0x24e7e0['error'][_0xe89f('0x13')]);return _0x347567(_0x24e7e0[_0xe89f('0x11')][_0xe89f('0x13')]);}else{logger[_0xe89f('0x14')](_0xe89f('0xc'),_0x53aeb0,'request\x20sent');_0x347567(_0x24e7e0['result'][_0xe89f('0x13')]);}})[_0xe89f('0x15')](function(_0x1be05c){logger[_0xe89f('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x53aeb0,_0x1be05c);_0x5a11b(_0x1be05c);});});}exports[_0xe89f('0x16')]=function(_0x3b38ef){var _0x1ad3f1=this;return new Promise(function(_0x383fed,_0xc9b039){return db[_0xe89f('0x17')][_0xe89f('0x18')](_0x3b38ef['body'],{'raw':_0x3b38ef[_0xe89f('0x19')]?_0x3b38ef[_0xe89f('0x19')][_0xe89f('0x1a')]===undefined?!![]:![]:!![]})[_0xe89f('0xb')](function(_0x4e7ee4){logger[_0xe89f('0x14')](_0xe89f('0x16'),_0x3b38ef);logger[_0xe89f('0xe')](_0xe89f('0x16'),_0x3b38ef,JSON[_0xe89f('0x10')](_0x4e7ee4));_0x383fed(_0x4e7ee4);})[_0xe89f('0x15')](function(_0x11accb){logger['error'](_0xe89f('0x16'),_0x11accb[_0xe89f('0x13')],_0x3b38ef);_0xc9b039(_0x1ad3f1[_0xe89f('0x11')](0x1f4,_0x11accb[_0xe89f('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0xb8f1aa){var _0x350aca=this;return new Promise(function(_0x42177f,_0x2c00ee){return db[_0xe89f('0x17')]['update'](_0xb8f1aa[_0xe89f('0x1b')],{'raw':_0xb8f1aa[_0xe89f('0x19')]?_0xb8f1aa[_0xe89f('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb8f1aa[_0xe89f('0x19')]?_0xb8f1aa[_0xe89f('0x19')][_0xe89f('0x1c')]||null:null,'attributes':_0xb8f1aa[_0xe89f('0x19')]?_0xb8f1aa[_0xe89f('0x19')]['attributes']||null:null,'limit':_0xb8f1aa[_0xe89f('0x19')]?_0xb8f1aa[_0xe89f('0x19')][_0xe89f('0x1d')]||null:null})[_0xe89f('0xb')](function(_0x3e57bb){logger[_0xe89f('0x14')](_0xe89f('0x1e'),_0xb8f1aa);logger[_0xe89f('0xe')](_0xe89f('0x1e'),_0xb8f1aa,JSON[_0xe89f('0x10')](_0x3e57bb));_0x42177f(_0x3e57bb);})['catch'](function(_0x5d018f){logger['error'](_0xe89f('0x1e'),_0x5d018f['message'],_0xb8f1aa);_0x2c00ee(_0x350aca[_0xe89f('0x11')](0x1f4,_0x5d018f['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 0d4f3e0..cca0c9e 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 _0x8a11=['get','show','post','isAuthenticated','create','/:id/applications','addApplications','put','/:id','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x8a11,0x197));var _0x18a1=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x8a11[_0x102ff9];return _0x24fa97;};'use strict';var multer=require(_0x18a1('0x0'));var util=require(_0x18a1('0x1'));var path=require('path');var timeout=require(_0x18a1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x18a1('0x3'));var auth=require(_0x18a1('0x4'));var interaction=require(_0x18a1('0x5'));var config=require(_0x18a1('0x6'));var controller=require('./voiceExtension.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x18a1('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x18a1('0x8')]);router[_0x18a1('0x9')]('/',auth[_0x18a1('0xa')](),controller[_0x18a1('0xb')]);router['post'](_0x18a1('0xc'),auth[_0x18a1('0xa')](),controller[_0x18a1('0xd')]);router[_0x18a1('0xe')](_0x18a1('0xf'),auth[_0x18a1('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x18a1('0x10')]);module[_0x18a1('0x11')]=router; \ No newline at end of file +var _0x15cc=['get','/:id','show','post','create','addApplications','put','update','destroy','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','isAuthenticated','index'];(function(_0x4b0975,_0x592fcc){var _0x2f75dc=function(_0x415635){while(--_0x415635){_0x4b0975['push'](_0x4b0975['shift']());}};_0x2f75dc(++_0x592fcc);}(_0x15cc,0xac));var _0xc15c=function(_0x2ce715,_0x22e80c){_0x2ce715=_0x2ce715-0x0;var _0x41c7bb=_0x15cc[_0x2ce715];return _0x41c7bb;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc15c('0x0'));var express=require('express');var router=express[_0xc15c('0x1')]();var fs_extra=require(_0xc15c('0x2'));var auth=require(_0xc15c('0x3'));var interaction=require(_0xc15c('0x4'));var config=require('../../config/environment');var controller=require(_0xc15c('0x5'));router['get']('/',auth[_0xc15c('0x6')](),controller[_0xc15c('0x7')]);router[_0xc15c('0x8')](_0xc15c('0x9'),auth[_0xc15c('0x6')](),controller[_0xc15c('0xa')]);router[_0xc15c('0xb')]('/',auth[_0xc15c('0x6')](),controller[_0xc15c('0xc')]);router[_0xc15c('0xb')]('/:id/applications',auth[_0xc15c('0x6')](),controller[_0xc15c('0xd')]);router[_0xc15c('0xe')](_0xc15c('0x9'),auth[_0xc15c('0x6')](),controller[_0xc15c('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc15c('0x10')]);module[_0xc15c('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index db8fab3..0e3d906 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 _0xdeb4=['ENUM','outbound','internal','inbound-fax','outbound-fax','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp'];(function(_0x3d01d3,_0x122dc6){var _0x31ab40=function(_0x43b96c){while(--_0x43b96c){_0x3d01d3['push'](_0x3d01d3['shift']());}};_0x31ab40(++_0x122dc6);}(_0xdeb4,0xd8));var _0x4deb=function(_0x5e552f,_0x105a3e){_0x5e552f=_0x5e552f-0x0;var _0x37fc52=_0xdeb4[_0x5e552f];return _0x37fc52;};'use strict';var Sequelize=require(_0x4deb('0x0'));module[_0x4deb('0x1')]={'context':{'type':Sequelize[_0x4deb('0x2')],'allowNull':![],'unique':_0x4deb('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4deb('0x2')],'allowNull':![],'unique':_0x4deb('0x3')},'priority':{'type':Sequelize[_0x4deb('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x4deb('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4deb('0x4')},'appdata':{'type':Sequelize[_0x4deb('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4deb('0x5')]('inbound',_0x4deb('0x6'),_0x4deb('0x7'),_0x4deb('0x8'),_0x4deb('0x9'),'system','any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4deb('0x2')],'allowNull':![],'defaultValue':_0x4deb('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x4deb('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4deb('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x4deb('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4deb('0xc')]},'recordingFormat':{'type':Sequelize[_0x4deb('0x2')],'defaultValue':_0x4deb('0xd')},'answer':{'type':Sequelize[_0x4deb('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4deb('0xe')],'get':function(_0x348515){return this[_0x4deb('0xf')](_0x4deb('0x10'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x8fbe=['VIRTUAL','getDataValue','exten','sequelize','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x54c977,_0x382295){var _0x53a048=function(_0x4e7d61){while(--_0x4e7d61){_0x54c977['push'](_0x54c977['shift']());}};_0x53a048(++_0x382295);}(_0x8fbe,0xad));var _0xe8fb=function(_0x351eed,_0x12fc58){_0x351eed=_0x351eed-0x0;var _0x5a82b5=_0x8fbe[_0x351eed];return _0x5a82b5;};'use strict';var Sequelize=require(_0xe8fb('0x0'));module['exports']={'context':{'type':Sequelize[_0xe8fb('0x1')],'allowNull':![],'unique':_0xe8fb('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xe8fb('0x1')],'allowNull':![],'unique':_0xe8fb('0x2')},'priority':{'type':Sequelize[_0xe8fb('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xe8fb('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xe8fb('0x1')],'allowNull':![],'defaultValue':_0xe8fb('0x3')},'appdata':{'type':Sequelize[_0xe8fb('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xe8fb('0x4')](_0xe8fb('0x5'),_0xe8fb('0x6'),_0xe8fb('0x7'),'inbound-fax',_0xe8fb('0x8'),'system',_0xe8fb('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe8fb('0x1')],'allowNull':![],'defaultValue':_0xe8fb('0xa')},'IntervalId':{'type':Sequelize[_0xe8fb('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xe8fb('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xe8fb('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xe8fb('0xb')]},'recordingFormat':{'type':Sequelize[_0xe8fb('0x1')],'defaultValue':_0xe8fb('0xd')},'answer':{'type':Sequelize[_0xe8fb('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xe8fb('0xe')],'get':function(_0x8152f9){return this[_0xe8fb('0xf')](_0xe8fb('0x10'));}},'alias':{'type':Sequelize[_0xe8fb('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index b8777b5..4563138 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 _0xa63e=['rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','map','value','includes','find','type','name','UserProfileResource','error','stack','send','index','VoiceExtension'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0xa63e,0x96));var _0xea63=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa63e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xea63('0x0'));var Redis=require(_0xea63('0x1'));var qs=require(_0xea63('0x2'));var logger=require(_0xea63('0x3'))(_0xea63('0x4'));var config=require(_0xea63('0x5'));var db=require(_0xea63('0x6'))['db'];config[_0xea63('0x7')]=_[_0xea63('0x8')](config['redis'],{'host':_0xea63('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea63('0x7')]));require(_0xea63('0xa'))[_0xea63('0xb')](socket);function respondWithStatusCode(_0x1600d4,_0x3f7722){_0x3f7722=_0x3f7722||0xcc;return function(_0x56bc91){if(_0x56bc91){return _0x1600d4[_0xea63('0xc')](_0x3f7722);}return _0x1600d4[_0xea63('0xd')](_0x3f7722)[_0xea63('0xe')]();};}function respondWithResult(_0x1b718d,_0x1f1ee4){_0x1f1ee4=_0x1f1ee4||0xc8;return function(_0x1a3f6f){if(_0x1a3f6f){return _0x1b718d[_0xea63('0xd')](_0x1f1ee4)[_0xea63('0xf')](_0x1a3f6f);}};}function respondWithFilteredResult(_0x3818d3,_0x2ed120){return function(_0x2e8c4d){if(_0x2e8c4d){var _0x5c0479=typeof _0x2ed120[_0xea63('0x10')]===_0xea63('0x11')&&typeof _0x2ed120['limit']===_0xea63('0x11');var _0x3d6ce0=_0x2e8c4d['count'];var _0xd16d5f=_0x5c0479?0x0:_0x2ed120[_0xea63('0x10')];var _0x2d62f7=_0x5c0479?_0x2e8c4d[_0xea63('0x12')]:_0x2ed120[_0xea63('0x10')]+_0x2ed120['limit'];var _0x4d44da;if(_0x2d62f7>=_0x3d6ce0){_0x2d62f7=_0x3d6ce0;_0x4d44da=0xc8;}else{_0x4d44da=0xce;}_0x3818d3['status'](_0x4d44da);return _0x3818d3[_0xea63('0x13')](_0xea63('0x14'),_0xd16d5f+'-'+_0x2d62f7+'/'+_0x3d6ce0)['json'](_0x2e8c4d);}return null;};}function removeEntity(_0x242846){return function(_0x209178){if(_0x209178){return _0x209178[_0xea63('0x15')]()[_0xea63('0x16')](function(){var _0x5b392e=_0x209178[_0xea63('0x17')]({'plain':!![]});var _0x299a19=[{'name':_0xea63('0x18'),'value':_0xea63('0x19'),'ignore':![]},{'name':_0xea63('0x1a'),'value':_0xea63('0x1b'),'ignore':![]},{'name':'InternalRoutes','value':_0xea63('0x1c'),'ignore':![]}];var _0x3f7c47=_(_0x299a19)[_0xea63('0x1d')]('ignore')[_0xea63('0x1e')](_0xea63('0x1f'))[_0xea63('0x1f')]();if(_[_0xea63('0x20')](_0x3f7c47,_0x5b392e['type'])){return;}var _0x416d08=_[_0xea63('0x21')](_0x299a19,['value',_0x5b392e[_0xea63('0x22')]])[_0xea63('0x23')];return db[_0xea63('0x24')][_0xea63('0x15')]({'where':{'type':_0x416d08,'resourceId':_0x5b392e['id']}})[_0xea63('0x16')](function(){return _0x209178;});})[_0xea63('0x16')](function(){_0x242846['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x453741){return function(_0x4f9306){if(!_0x4f9306){_0x453741[_0xea63('0xc')](0x194);}return _0x4f9306;};}function handleError(_0x525aaa,_0x12ec9d){_0x12ec9d=_0x12ec9d||0x1f4;return function(_0x3bee04){logger[_0xea63('0x25')](_0x3bee04[_0xea63('0x26')]);if(_0x3bee04[_0xea63('0x23')]){delete _0x3bee04[_0xea63('0x23')];}_0x525aaa[_0xea63('0xd')](_0x12ec9d)[_0xea63('0x27')](_0x3bee04);};}exports[_0xea63('0x28')]=function(_0x5a2790,_0x439904){var _0x429b57={},_0x32dbbf={},_0x5eef9d={'count':0x0,'rows':[]};var _0xc39c7f=_[_0xea63('0x1e')](db[_0xea63('0x29')][_0xea63('0x2a')],function(_0x4cdec4){return{'name':_0x4cdec4['fieldName'],'type':_0x4cdec4[_0xea63('0x22')]['key']};});_0x32dbbf[_0xea63('0x2b')]=_[_0xea63('0x1e')](_0xc39c7f,'name');_0x32dbbf[_0xea63('0x2c')]=_['keys'](_0x5a2790['query']);_0x32dbbf[_0xea63('0x2d')]=_[_0xea63('0x2e')](_0x32dbbf[_0xea63('0x2b')],_0x32dbbf[_0xea63('0x2c')]);_0x429b57[_0xea63('0x2f')]=_[_0xea63('0x2e')](_0x32dbbf[_0xea63('0x2b')],qs[_0xea63('0x30')](_0x5a2790[_0xea63('0x2c')][_0xea63('0x30')]));_0x429b57[_0xea63('0x2f')]=_0x429b57[_0xea63('0x2f')][_0xea63('0x31')]?_0x429b57[_0xea63('0x2f')]:_0x32dbbf['model'];if(!_0x5a2790[_0xea63('0x2c')][_0xea63('0x32')](_0xea63('0x33'))){_0x429b57[_0xea63('0x34')]=qs[_0xea63('0x34')](_0x5a2790[_0xea63('0x2c')][_0xea63('0x34')]);_0x429b57[_0xea63('0x10')]=qs['offset'](_0x5a2790[_0xea63('0x2c')]['offset']);}_0x429b57[_0xea63('0x35')]=qs['sort'](_0x5a2790[_0xea63('0x2c')][_0xea63('0x36')]);_0x429b57[_0xea63('0x37')]=qs['filters'](_[_0xea63('0x38')](_0x5a2790[_0xea63('0x2c')],_0x32dbbf[_0xea63('0x2d')]),_0xc39c7f);if(_0x5a2790[_0xea63('0x2c')][_0xea63('0x1d')]){_0x429b57[_0xea63('0x37')]=_[_0xea63('0x39')](_0x429b57[_0xea63('0x37')],{'$or':_[_0xea63('0x1e')](_0xc39c7f,function(_0x2f5505){if(_0x2f5505[_0xea63('0x22')]!==_0xea63('0x3a')){var _0x488a14={};_0x488a14[_0x2f5505[_0xea63('0x23')]]={'$like':'%'+_0x5a2790[_0xea63('0x2c')][_0xea63('0x1d')]+'%'};return _0x488a14;}})});}_0x429b57=_['merge']({},_0x429b57,_0x5a2790[_0xea63('0x3b')]);var _0x2d604f={'where':_0x429b57[_0xea63('0x37')]};return db['VoiceExtension'][_0xea63('0x12')](_0x2d604f)[_0xea63('0x16')](function(_0x260777){_0x5eef9d[_0xea63('0x12')]=_0x260777;if(_0x5a2790[_0xea63('0x2c')][_0xea63('0x3c')]){_0x429b57['include']=[{'all':!![]}];}return db[_0xea63('0x29')][_0xea63('0x3d')](_0x429b57);})['then'](function(_0x4f6733){_0x5eef9d[_0xea63('0x3e')]=_0x4f6733;return _0x5eef9d;})[_0xea63('0x16')](respondWithFilteredResult(_0x439904,_0x429b57))[_0xea63('0x3f')](handleError(_0x439904,null));};exports[_0xea63('0x40')]=function(_0x3daf51,_0x227ebe){var _0x72537={'raw':![],'where':{'id':_0x3daf51[_0xea63('0x41')]['id']}},_0x21bfd8={};_0x21bfd8['model']=_['keys'](db[_0xea63('0x29')][_0xea63('0x2a')]);_0x21bfd8[_0xea63('0x2c')]=_[_0xea63('0x42')](_0x3daf51[_0xea63('0x2c')]);_0x21bfd8['filters']=_[_0xea63('0x2e')](_0x21bfd8[_0xea63('0x2b')],_0x21bfd8[_0xea63('0x2c')]);_0x72537[_0xea63('0x2f')]=_[_0xea63('0x2e')](_0x21bfd8[_0xea63('0x2b')],qs['fields'](_0x3daf51[_0xea63('0x2c')][_0xea63('0x30')]));_0x72537[_0xea63('0x2f')]=_0x72537[_0xea63('0x2f')][_0xea63('0x31')]?_0x72537[_0xea63('0x2f')]:_0x21bfd8[_0xea63('0x2b')];if(_0x3daf51[_0xea63('0x2c')]['includeAll']){_0x72537[_0xea63('0x43')]=[{'all':!![]}];}_0x72537=_[_0xea63('0x39')]({},_0x72537,_0x3daf51[_0xea63('0x3b')]);return db[_0xea63('0x29')][_0xea63('0x21')](_0x72537)[_0xea63('0x16')](handleEntityNotFound(_0x227ebe,null))[_0xea63('0x16')](respondWithResult(_0x227ebe,null))[_0xea63('0x3f')](handleError(_0x227ebe,null));};exports[_0xea63('0x15')]=function(_0x4ae530,_0x63d5cf){return db['VoiceExtension']['find']({'where':{'id':_0x4ae530[_0xea63('0x41')]['id']}})[_0xea63('0x16')](handleEntityNotFound(_0x63d5cf,null))[_0xea63('0x16')](removeEntity(_0x63d5cf,null))[_0xea63('0x3f')](handleError(_0x63d5cf,null));};exports[_0xea63('0x44')]=function(_0x292de9,_0xe33dbb){if(_0x292de9[_0xea63('0x45')][_0xea63('0x22')]==='outbound'&&!_[_0xea63('0x46')](_0x292de9[_0xea63('0x45')][_0xea63('0x47')],'_')){_0x292de9[_0xea63('0x45')][_0xea63('0x47')]='_'['concat'](_0x292de9['body'][_0xea63('0x47')]);}return db[_0xea63('0x29')][_0xea63('0x44')](_0x292de9[_0xea63('0x45')],{'raw':![]})[_0xea63('0x16')](function(_0x2e31c2){var _0x2566f4=_0x292de9[_0xea63('0x48')]['get']({'plain':!![]});if(!_0x2566f4)throw new Error(_0xea63('0x49'));if(_0x2566f4['role']===_0xea63('0x48')){var _0x424ab2=_0x2e31c2[_0xea63('0x17')]({'plain':!![]});var _0x1ba79b=[{'name':_0xea63('0x18'),'value':_0xea63('0x19')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0xea63('0x4a'),'value':_0xea63('0x1c')}];var _0x260972=_['find'](_0x1ba79b,['value',_0x424ab2[_0xea63('0x22')]])[_0xea63('0x23')];return db[_0xea63('0x4b')][_0xea63('0x21')]({'where':{'name':_0x260972,'userProfileId':_0x2566f4[_0xea63('0x4c')]},'raw':!![]})[_0xea63('0x16')](function(_0x4e60d6){if(_0x4e60d6&&_0x4e60d6[_0xea63('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x424ab2['name'],'resourceId':_0x424ab2['id'],'type':_0x4e60d6[_0xea63('0x23')],'sectionId':_0x4e60d6['id']},{})[_0xea63('0x16')](function(){return _0x2e31c2;});}else{return _0x2e31c2;}})[_0xea63('0x3f')](function(_0x15a458){logger[_0xea63('0x25')](_0xea63('0x4e'),_0x15a458);throw _0x15a458;});}return _0x2e31c2;})[_0xea63('0x16')](respondWithResult(_0xe33dbb,0xc9))['catch'](handleError(_0xe33dbb,null));};exports[_0xea63('0x4f')]=function(_0x4c47d7,_0x2ae74b){if(_0x4c47d7[_0xea63('0x45')]['id']){delete _0x4c47d7[_0xea63('0x45')]['id'];}return db[_0xea63('0x29')][_0xea63('0x21')]({'where':{'id':_0x4c47d7['params']['id']}})[_0xea63('0x16')](handleEntityNotFound(_0x2ae74b,null))[_0xea63('0x16')](function(_0x4602c2){if(_0x4602c2){return db[_0xea63('0x29')]['update'](_[_0xea63('0x38')](_0x4c47d7['body'],[_0xea63('0x47'),_0xea63('0x50'),_0xea63('0x51'),'recordingFormat',_0xea63('0x52'),_0xea63('0x53'),_0xea63('0x54')]),{'where':{'context':_0x4602c2['context'],'exten':_0x4602c2[_0xea63('0x47')]},'individualHooks':!![]})[_0xea63('0x16')](function(_0x53756e){return _0x53756e;});}return null;})[_0xea63('0x16')](respondWithStatusCode(_0x2ae74b,null))['catch'](handleError(_0x2ae74b,null));};exports[_0xea63('0x55')]=function(_0xfbb794,_0x1e749b){var _0x3cd335=_0xfbb794[_0xea63('0x41')]['id'];var _0x2c494d=_0xfbb794[_0xea63('0x45')];var _0x265797=0xc8;var _0x185c91=null;return db[_0xea63('0x56')][_0xea63('0x57')]({'isolationLevel':db[_0xea63('0x56')][_0xea63('0x58')][_0xea63('0x59')]['READ_COMMITTED']},function(_0x528109){return db[_0xea63('0x29')][_0xea63('0x5a')]({'where':{'id':_0x3cd335},'transaction':_0x528109})[_0xea63('0x16')](function(_0x26e403){if(_0x26e403){return db['VoiceExtension'][_0xea63('0x15')]({'where':{'VoiceExtensionId':_0x3cd335},'transaction':_0x528109})[_0xea63('0x16')](function(){var _0xf9b5e5=_['map'](_0x2c494d,function(_0x29ee1c){_0x29ee1c['VoiceExtensionId']=_0x3cd335;_0x29ee1c['isApp']=!![];return _0x29ee1c;});return _0x26e403[_0xea63('0x5b')](_0xf9b5e5);})[_0xea63('0x16')](function(_0x1f9aa6){return db[_0xea63('0x29')][_0xea63('0x5c')](_0x1f9aa6,{'transaction':_0x528109});});}else{_0x265797=0x194;_0x185c91=[];}});})['then'](function(){if(_0x265797!==0x194){return db[_0xea63('0x29')][_0xea63('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3cd335},'order':_0xea63('0x5e')})['then'](function(_0x10bba0){_0x185c91=_0x10bba0;});}})['catch'](function(_0x2fcc7e){_0x265797=0x1f4;logger[_0xea63('0x25')](_0x2fcc7e['stack']);if(_0x2fcc7e['name']){delete _0x2fcc7e[_0xea63('0x23')];}_0x185c91=_0x2fcc7e;})[_0xea63('0x5f')](function(){if(_0x185c91===null){_0x1e749b[_0xea63('0xc')](_0x265797);}else{if(_0x265797===0x1f4){_0x1e749b[_0xea63('0xd')](_0x265797)[_0xea63('0x27')](_0x185c91);}else{_0x1e749b[_0xea63('0xd')](_0x265797)[_0xea63('0xf')](_0x185c91);}}});}; \ No newline at end of file +var _0x643a=['ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','destroy','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','find','type','name','UserProfileResource','error','send','VoiceExtension','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','include','catch','create','exten','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','cutdigits','mandatoryDisposition','alias','addApplications','transaction','sequelize','Transaction','VoiceExtensionId','isApp','bulkCreate','cast(priority\x20as\x20unsigned)','stack','finally','sendStatus','lodash'];(function(_0x392adf,_0x28f965){var _0x1f6594=function(_0x39a500){while(--_0x39a500){_0x392adf['push'](_0x392adf['shift']());}};_0x1f6594(++_0x28f965);}(_0x643a,0x107));var _0xa643=function(_0xa5fdf4,_0x553bc8){_0xa5fdf4=_0xa5fdf4-0x0;var _0x45a73d=_0x643a[_0xa5fdf4];return _0x45a73d;};'use strict';var _=require(_0xa643('0x0'));var Redis=require(_0xa643('0x1'));var qs=require(_0xa643('0x2'));var logger=require(_0xa643('0x3'))(_0xa643('0x4'));var config=require(_0xa643('0x5'));var db=require(_0xa643('0x6'))['db'];config[_0xa643('0x7')]=_[_0xa643('0x8')](config[_0xa643('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xa643('0x9'))(new Redis(config[_0xa643('0x7')]));require(_0xa643('0xa'))[_0xa643('0xb')](socket);function respondWithStatusCode(_0x2f75fa,_0x55d8d3){_0x55d8d3=_0x55d8d3||0xcc;return function(_0x3946fe){if(_0x3946fe){return _0x2f75fa['sendStatus'](_0x55d8d3);}return _0x2f75fa[_0xa643('0xc')](_0x55d8d3)[_0xa643('0xd')]();};}function respondWithResult(_0x1e1d5c,_0x248982){_0x248982=_0x248982||0xc8;return function(_0xbdcf79){if(_0xbdcf79){return _0x1e1d5c[_0xa643('0xc')](_0x248982)[_0xa643('0xe')](_0xbdcf79);}};}function respondWithFilteredResult(_0x449303,_0x5b8df0){return function(_0x52f1e3){if(_0x52f1e3){var _0x16e9f4=typeof _0x5b8df0[_0xa643('0xf')]===_0xa643('0x10')&&typeof _0x5b8df0['limit']===_0xa643('0x10');var _0xb58dec=_0x52f1e3[_0xa643('0x11')];var _0x3ffc10=_0x16e9f4?0x0:_0x5b8df0[_0xa643('0xf')];var _0x19e89d=_0x16e9f4?_0x52f1e3[_0xa643('0x11')]:_0x5b8df0[_0xa643('0xf')]+_0x5b8df0[_0xa643('0x12')];var _0x33ff3c;if(_0x19e89d>=_0xb58dec){_0x19e89d=_0xb58dec;_0x33ff3c=0xc8;}else{_0x33ff3c=0xce;}_0x449303[_0xa643('0xc')](_0x33ff3c);return _0x449303[_0xa643('0x13')](_0xa643('0x14'),_0x3ffc10+'-'+_0x19e89d+'/'+_0xb58dec)[_0xa643('0xe')](_0x52f1e3);}return null;};}function removeEntity(_0x3ba372){return function(_0xcfa8fc){if(_0xcfa8fc){return _0xcfa8fc[_0xa643('0x15')]()[_0xa643('0x16')](function(){var _0x4a2fd0=_0xcfa8fc['get']({'plain':!![]});var _0x142361=[{'name':_0xa643('0x17'),'value':_0xa643('0x18'),'ignore':![]},{'name':_0xa643('0x19'),'value':_0xa643('0x1a'),'ignore':![]},{'name':_0xa643('0x1b'),'value':_0xa643('0x1c'),'ignore':![]}];var _0xa514ef=_(_0x142361)['filter'](_0xa643('0x1d'))[_0xa643('0x1e')](_0xa643('0x1f'))[_0xa643('0x1f')]();if(_[_0xa643('0x20')](_0xa514ef,_0x4a2fd0['type'])){return;}var _0x49c3ae=_[_0xa643('0x21')](_0x142361,[_0xa643('0x1f'),_0x4a2fd0[_0xa643('0x22')]])[_0xa643('0x23')];return db[_0xa643('0x24')][_0xa643('0x15')]({'where':{'type':_0x49c3ae,'resourceId':_0x4a2fd0['id']}})['then'](function(){return _0xcfa8fc;});})[_0xa643('0x16')](function(){_0x3ba372['status'](0xcc)[_0xa643('0xd')]();});}};}function handleEntityNotFound(_0x15bb58){return function(_0x460f87){if(!_0x460f87){_0x15bb58['sendStatus'](0x194);}return _0x460f87;};}function handleError(_0xabd5d8,_0x27b5d2){_0x27b5d2=_0x27b5d2||0x1f4;return function(_0x15a2fc){logger[_0xa643('0x25')](_0x15a2fc['stack']);if(_0x15a2fc[_0xa643('0x23')]){delete _0x15a2fc['name'];}_0xabd5d8[_0xa643('0xc')](_0x27b5d2)[_0xa643('0x26')](_0x15a2fc);};}exports['index']=function(_0x4a6d42,_0x2c5600){var _0x533572={},_0x26cf74={},_0x222b98={'count':0x0,'rows':[]};var _0x58300b=_['map'](db[_0xa643('0x27')][_0xa643('0x28')],function(_0x73247a){return{'name':_0x73247a[_0xa643('0x29')],'type':_0x73247a[_0xa643('0x22')][_0xa643('0x2a')]};});_0x26cf74[_0xa643('0x2b')]=_[_0xa643('0x1e')](_0x58300b,_0xa643('0x23'));_0x26cf74['query']=_[_0xa643('0x2c')](_0x4a6d42[_0xa643('0x2d')]);_0x26cf74[_0xa643('0x2e')]=_[_0xa643('0x2f')](_0x26cf74[_0xa643('0x2b')],_0x26cf74['query']);_0x533572[_0xa643('0x30')]=_[_0xa643('0x2f')](_0x26cf74[_0xa643('0x2b')],qs[_0xa643('0x31')](_0x4a6d42[_0xa643('0x2d')][_0xa643('0x31')]));_0x533572[_0xa643('0x30')]=_0x533572[_0xa643('0x30')][_0xa643('0x32')]?_0x533572['attributes']:_0x26cf74['model'];if(!_0x4a6d42['query'][_0xa643('0x33')]('nolimit')){_0x533572[_0xa643('0x12')]=qs['limit'](_0x4a6d42['query'][_0xa643('0x12')]);_0x533572[_0xa643('0xf')]=qs[_0xa643('0xf')](_0x4a6d42['query'][_0xa643('0xf')]);}_0x533572['order']=qs['sort'](_0x4a6d42[_0xa643('0x2d')]['sort']);_0x533572[_0xa643('0x34')]=qs[_0xa643('0x2e')](_[_0xa643('0x35')](_0x4a6d42[_0xa643('0x2d')],_0x26cf74['filters']),_0x58300b);if(_0x4a6d42['query'][_0xa643('0x36')]){_0x533572[_0xa643('0x34')]=_['merge'](_0x533572[_0xa643('0x34')],{'$or':_['map'](_0x58300b,function(_0x32fa0b){if(_0x32fa0b[_0xa643('0x22')]!==_0xa643('0x37')){var _0x1005e5={};_0x1005e5[_0x32fa0b[_0xa643('0x23')]]={'$like':'%'+_0x4a6d42[_0xa643('0x2d')][_0xa643('0x36')]+'%'};return _0x1005e5;}})});}_0x533572=_['merge']({},_0x533572,_0x4a6d42[_0xa643('0x38')]);var _0x12d909={'where':_0x533572['where']};return db[_0xa643('0x27')][_0xa643('0x11')](_0x12d909)[_0xa643('0x16')](function(_0x414a01){_0x222b98[_0xa643('0x11')]=_0x414a01;if(_0x4a6d42[_0xa643('0x2d')][_0xa643('0x39')]){_0x533572['include']=[{'all':!![]}];}return db[_0xa643('0x27')][_0xa643('0x3a')](_0x533572);})['then'](function(_0x442489){_0x222b98[_0xa643('0x3b')]=_0x442489;return _0x222b98;})[_0xa643('0x16')](respondWithFilteredResult(_0x2c5600,_0x533572))['catch'](handleError(_0x2c5600,null));};exports[_0xa643('0x3c')]=function(_0x22b8b4,_0x12406c){var _0x5940fc={'raw':![],'where':{'id':_0x22b8b4[_0xa643('0x3d')]['id']}},_0xa08a2c={};_0xa08a2c[_0xa643('0x2b')]=_['keys'](db[_0xa643('0x27')][_0xa643('0x28')]);_0xa08a2c[_0xa643('0x2d')]=_[_0xa643('0x2c')](_0x22b8b4[_0xa643('0x2d')]);_0xa08a2c[_0xa643('0x2e')]=_[_0xa643('0x2f')](_0xa08a2c[_0xa643('0x2b')],_0xa08a2c[_0xa643('0x2d')]);_0x5940fc['attributes']=_[_0xa643('0x2f')](_0xa08a2c[_0xa643('0x2b')],qs[_0xa643('0x31')](_0x22b8b4[_0xa643('0x2d')][_0xa643('0x31')]));_0x5940fc[_0xa643('0x30')]=_0x5940fc[_0xa643('0x30')][_0xa643('0x32')]?_0x5940fc['attributes']:_0xa08a2c[_0xa643('0x2b')];if(_0x22b8b4[_0xa643('0x2d')]['includeAll']){_0x5940fc[_0xa643('0x3e')]=[{'all':!![]}];}_0x5940fc=_['merge']({},_0x5940fc,_0x22b8b4[_0xa643('0x38')]);return db[_0xa643('0x27')][_0xa643('0x21')](_0x5940fc)['then'](handleEntityNotFound(_0x12406c,null))[_0xa643('0x16')](respondWithResult(_0x12406c,null))[_0xa643('0x3f')](handleError(_0x12406c,null));};exports['destroy']=function(_0x79a6c3,_0x490b0d){return db['VoiceExtension']['find']({'where':{'id':_0x79a6c3[_0xa643('0x3d')]['id']}})['then'](handleEntityNotFound(_0x490b0d,null))[_0xa643('0x16')](removeEntity(_0x490b0d,null))[_0xa643('0x3f')](handleError(_0x490b0d,null));};exports[_0xa643('0x40')]=function(_0x26b097,_0x1918fb){if(_0x26b097['body'][_0xa643('0x22')]===_0xa643('0x1a')&&!_['startsWith'](_0x26b097['body'][_0xa643('0x41')],'_')){_0x26b097['body']['exten']='_'['concat'](_0x26b097[_0xa643('0x42')][_0xa643('0x41')]);}return db[_0xa643('0x27')]['create'](_0x26b097[_0xa643('0x42')],{'raw':![]})[_0xa643('0x16')](function(_0x3abdd0){var _0x4dd938=_0x26b097[_0xa643('0x43')]['get']({'plain':!![]});if(!_0x4dd938)throw new Error(_0xa643('0x44'));if(_0x4dd938['role']==='user'){var _0x2a8ca8=_0x3abdd0[_0xa643('0x45')]({'plain':!![]});var _0x2ec3ac=[{'name':'InboundRoutes','value':'inbound'},{'name':_0xa643('0x19'),'value':_0xa643('0x1a')},{'name':'InternalRoutes','value':_0xa643('0x1c')}];var _0x9d456d=_[_0xa643('0x21')](_0x2ec3ac,[_0xa643('0x1f'),_0x2a8ca8[_0xa643('0x22')]])['name'];return db['UserProfileSection'][_0xa643('0x21')]({'where':{'name':_0x9d456d,'userProfileId':_0x4dd938['userProfileId']},'raw':!![]})[_0xa643('0x16')](function(_0x5e624a){if(_0x5e624a&&_0x5e624a[_0xa643('0x46')]===0x0){return db[_0xa643('0x24')]['create']({'name':_0x2a8ca8[_0xa643('0x23')],'resourceId':_0x2a8ca8['id'],'type':_0x5e624a[_0xa643('0x23')],'sectionId':_0x5e624a['id']},{})[_0xa643('0x16')](function(){return _0x3abdd0;});}else{return _0x3abdd0;}})['catch'](function(_0x3959ec){logger[_0xa643('0x25')](_0xa643('0x47'),_0x3959ec);throw _0x3959ec;});}return _0x3abdd0;})[_0xa643('0x16')](respondWithResult(_0x1918fb,0xc9))[_0xa643('0x3f')](handleError(_0x1918fb,null));};exports['update']=function(_0x3bcc63,_0x543355){if(_0x3bcc63[_0xa643('0x42')]['id']){delete _0x3bcc63[_0xa643('0x42')]['id'];}return db['VoiceExtension'][_0xa643('0x21')]({'where':{'id':_0x3bcc63[_0xa643('0x3d')]['id']}})[_0xa643('0x16')](handleEntityNotFound(_0x543355,null))[_0xa643('0x16')](function(_0x37317a){if(_0x37317a){return db[_0xa643('0x27')]['update'](_[_0xa643('0x35')](_0x3bcc63[_0xa643('0x42')],[_0xa643('0x41'),_0xa643('0x48'),_0xa643('0x49'),'recordingFormat',_0xa643('0x4a'),_0xa643('0x4b'),_0xa643('0x4c')]),{'where':{'context':_0x37317a[_0xa643('0x48')],'exten':_0x37317a[_0xa643('0x41')]},'individualHooks':!![]})[_0xa643('0x16')](function(_0x320042){return _0x320042;});}return null;})['then'](respondWithStatusCode(_0x543355,null))[_0xa643('0x3f')](handleError(_0x543355,null));};exports[_0xa643('0x4d')]=function(_0x511f72,_0x29aa01){var _0x2b2bb6=_0x511f72['params']['id'];var _0x2277ef=_0x511f72[_0xa643('0x42')];var _0x92f388=0xc8;var _0x1616f0=null;return db['sequelize'][_0xa643('0x4e')]({'isolationLevel':db[_0xa643('0x4f')][_0xa643('0x50')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x13ecdb){return db['VoiceExtension']['findOne']({'where':{'id':_0x2b2bb6},'transaction':_0x13ecdb})[_0xa643('0x16')](function(_0x536ff4){if(_0x536ff4){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x2b2bb6},'transaction':_0x13ecdb})[_0xa643('0x16')](function(){var _0x4d9360=_['map'](_0x2277ef,function(_0x4926cc){_0x4926cc[_0xa643('0x51')]=_0x2b2bb6;_0x4926cc[_0xa643('0x52')]=!![];return _0x4926cc;});return _0x536ff4['createRouting'](_0x4d9360);})[_0xa643('0x16')](function(_0x4b6c06){return db['VoiceExtension'][_0xa643('0x53')](_0x4b6c06,{'transaction':_0x13ecdb});});}else{_0x92f388=0x194;_0x1616f0=[];}});})[_0xa643('0x16')](function(){if(_0x92f388!==0x194){return db[_0xa643('0x27')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x2b2bb6},'order':_0xa643('0x54')})['then'](function(_0x3a3075){_0x1616f0=_0x3a3075;});}})[_0xa643('0x3f')](function(_0x3d4b04){_0x92f388=0x1f4;logger[_0xa643('0x25')](_0x3d4b04[_0xa643('0x55')]);if(_0x3d4b04[_0xa643('0x23')]){delete _0x3d4b04['name'];}_0x1616f0=_0x3d4b04;})[_0xa643('0x56')](function(){if(_0x1616f0===null){_0x29aa01[_0xa643('0x57')](_0x92f388);}else{if(_0x92f388===0x1f4){_0x29aa01[_0xa643('0xc')](_0x92f388)['send'](_0x1616f0);}else{_0x29aa01[_0xa643('0xc')](_0x92f388)['json'](_0x1616f0);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 78643da..b470a4b 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 _0xee94=['emit','hasOwnProperty','hook','events','../../mysqldb','VoiceExtension','update','remove'];(function(_0x1f7d31,_0x1ad0ae){var _0x3696b2=function(_0x2cd8cf){while(--_0x2cd8cf){_0x1f7d31['push'](_0x1f7d31['shift']());}};_0x3696b2(++_0x1ad0ae);}(_0xee94,0x1e3));var _0x4ee9=function(_0x2e0030,_0x3c7c6b){_0x2e0030=_0x2e0030-0x0;var _0x294c61=_0xee94[_0x2e0030];return _0x294c61;};'use strict';var EventEmitter=require(_0x4ee9('0x0'));var VoiceExtension=require(_0x4ee9('0x1'))['db'][_0x4ee9('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4ee9('0x3'),'afterDestroy':_0x4ee9('0x4')};function emitEvent(_0x525999){return function(_0x5e4485,_0x211f14,_0x541099){VoiceExtensionEvents['emit'](_0x525999+':'+_0x5e4485['id'],_0x5e4485);VoiceExtensionEvents[_0x4ee9('0x5')](_0x525999,_0x5e4485);_0x541099(null);};}for(var e in events){if(events[_0x4ee9('0x6')](e)){var event=events[e];VoiceExtension[_0x4ee9('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xc10e=['hasOwnProperty','hook','exports','events','VoiceExtension','setMaxListeners','save','update'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc10e,0x173));var _0xec10=function(_0x1a93a5,_0x13f256){_0x1a93a5=_0x1a93a5-0x0;var _0x4893a2=_0xc10e[_0x1a93a5];return _0x4893a2;};'use strict';var EventEmitter=require(_0xec10('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xec10('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xec10('0x2')](0x0);var events={'afterCreate':_0xec10('0x3'),'afterUpdate':_0xec10('0x4'),'afterDestroy':'remove'};function emitEvent(_0x59f843){return function(_0x3a1352,_0x1e36db,_0x3fda06){VoiceExtensionEvents['emit'](_0x59f843+':'+_0x3a1352['id'],_0x3a1352);VoiceExtensionEvents['emit'](_0x59f843,_0x3a1352);_0x3fda06(null);};}for(var e in events){if(events[_0xec10('0x5')](e)){var event=events[e];VoiceExtension[_0xec10('0x6')](e,emitEvent(event));}}module[_0xec10('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 57cc8ca..bcdce09 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 _0xcd28=['Set','CDR(type)=','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','${EXTEN:','${EXTEN}','ExecIf','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','timeout','options','url','length','name','param','split','prefix','phone','SIP','trunk','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','intervals','IntervalId','map','filter','tag','toLowerCase','CDR(tag)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','type'];(function(_0x485574,_0x9216c9){var _0x32ac05=function(_0xf57ddb){while(--_0xf57ddb){_0x485574['push'](_0x485574['shift']());}};_0x32ac05(++_0x9216c9);}(_0xcd28,0x18c));var _0x8cd2=function(_0x50206e,_0x1a906c){_0x50206e=_0x50206e-0x0;var _0x39cdaa=_0xcd28[_0x50206e];return _0x39cdaa;};'use strict';var _=require('lodash');var attributes=require(_0x8cd2('0x0'));module[_0x8cd2('0x1')]=function(_0xb78e1e){var _0x228f5b=_0xb78e1e[_0x8cd2('0x2')];function _0x167aee(_0x11533c){var _0x84713c=0x2;var _0x11fe9c=[{'type':_0x11533c[_0x8cd2('0x3')],'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x5')+_0x11533c[_0x8cd2('0x3')],'context':_0x11533c['context'],'exten':_0x11533c[_0x8cd2('0x6')],'priority':_0x84713c++,'VoiceExtensionId':_0x11533c['id']},{'type':_0x11533c[_0x8cd2('0x3')],'app':_0x11533c[_0x8cd2('0x7')]?_0x8cd2('0x4'):_0x8cd2('0x8'),'appdata':_0x11533c[_0x8cd2('0x7')]?_0x8cd2('0x9')+_0x11533c[_0x8cd2('0x7')]:_0x8cd2('0xa'),'context':_0x11533c[_0x8cd2('0xb')],'exten':_0x11533c[_0x8cd2('0x6')],'priority':_0x84713c++,'VoiceExtensionId':_0x11533c['id']}];if(_0x11533c[_0x8cd2('0x3')]===_0x8cd2('0xc')){_0x11fe9c[_0x8cd2('0xd')]({'type':'inbound','app':_0x8cd2('0x4'),'appdata':_0x8cd2('0xe')+_0x11533c['id'],'context':_0x11533c[_0x8cd2('0xb')],'exten':_0x11533c[_0x8cd2('0x6')],'priority':_0x84713c++,'VoiceExtensionId':_0x11533c['id']});}_0x11fe9c['push']({'type':_0x11533c[_0x8cd2('0x3')],'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0xf'),'context':_0x11533c[_0x8cd2('0xb')],'exten':_0x11533c[_0x8cd2('0x6')],'priority':_0x84713c++,'VoiceExtensionId':_0x11533c['id']},{'type':_0x11533c[_0x8cd2('0x3')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x11533c[_0x8cd2('0xb')],'exten':_0x11533c['exten'],'priority':_0x84713c++,'VoiceExtensionId':_0x11533c['id']},{'type':_0x11533c[_0x8cd2('0x3')],'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x10'),'context':_0x11533c[_0x8cd2('0xb')],'exten':_0x11533c[_0x8cd2('0x6')],'priority':_0x84713c++,'VoiceExtensionId':_0x11533c['id']});return _0x11fe9c;}function _0x3ace79(_0x338e23){var _0x3fc46c=0x2;var _0xcc2c0a=[{'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':'CDR(type)=outbound','context':_0x338e23['context'],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':'outbound','app':_0x338e23['alias']?_0x8cd2('0x4'):_0x8cd2('0x8'),'appdata':_0x338e23[_0x8cd2('0x7')]?_0x8cd2('0x9')+_0x338e23[_0x8cd2('0x7')]:_0x8cd2('0xa'),'context':_0x338e23[_0x8cd2('0xb')],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':'outbound','app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x12')+(_0x338e23['cutdigits']?_0x8cd2('0x13')+_0x338e23['cutdigits']+'}':_0x8cd2('0x14')),'context':_0x338e23[_0x8cd2('0xb')],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':_0x8cd2('0x11'),'app':'Set','appdata':'CDR(routeid)='+_0x338e23['id'],'context':_0x338e23['context'],'exten':_0x338e23['exten'],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':'outbound','app':_0x8cd2('0x15'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3fc46c+0x2)+'):Goto('+(_0x3fc46c+0x1)+')','context':_0x338e23['context'],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':_0x338e23[_0x8cd2('0x16')]?_0x8cd2('0x17')+_0x338e23['cutdigits']+'}':_0x8cd2('0x18'),'context':_0x338e23['context'],'exten':_0x338e23['exten'],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x338e23['context'],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x19'),'context':_0x338e23['context'],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x10'),'context':_0x338e23['context'],'exten':_0x338e23['exten'],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':'outboundrouteid='+_0x338e23['id'],'context':_0x338e23[_0x8cd2('0xb')],'exten':_0x338e23['exten'],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']}];if(_0x338e23[_0x8cd2('0x1a')](_0x8cd2('0x1b'))&&_0x338e23[_0x8cd2('0x1b')]!==_0x8cd2('0x1c')){_0xcc2c0a['push']({'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x338e23[_0x8cd2('0xb')],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x1d')+_0x338e23[_0x8cd2('0x1b')]||'wav','context':_0x338e23[_0x8cd2('0xb')],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']});}return _0xcc2c0a;}function _0x2bcd48(_0x2d2290,_0x1b80fc){var _0x5a2b04=[{'name':'trunk','param':0x0},{'name':_0x8cd2('0x1e'),'param':0x1},{'name':_0x8cd2('0x1f'),'param':0x2},{'name':_0x8cd2('0x20'),'param':0x3}];var _0x36980f={};var _0x207078=_0x1b80fc['split'](',');var _0x473bcb=[];for(var _0x1a64cd=0x0;_0x1a64cd<_0x5a2b04[_0x8cd2('0x21')];_0x1a64cd++){switch(_0x5a2b04[_0x1a64cd][_0x8cd2('0x22')]){case'trunk':_0x36980f['trunk']=_0x207078[_0x5a2b04[_0x1a64cd][_0x8cd2('0x23')]]['split']('/')[0x1];_0x36980f['phone']=_0x207078[_0x5a2b04[_0x1a64cd][_0x8cd2('0x23')]][_0x8cd2('0x24')]('/')[0x2];_0x36980f[_0x8cd2('0x25')]=_0x36980f['phone']?_0x36980f[_0x8cd2('0x26')]['split']('$')[0x0]:undefined;_0x36980f['phone']=_0x2d2290['cutdigits']?(_0x36980f[_0x8cd2('0x25')]||'')+'${EXTEN:'+_0x2d2290[_0x8cd2('0x16')]+'}':(_0x36980f[_0x8cd2('0x25')]||'')+_0x8cd2('0x14');_0x473bcb[_0x5a2b04[_0x1a64cd][_0x8cd2('0x23')]]=[_0x8cd2('0x27'),_0x36980f[_0x8cd2('0x28')],_0x36980f[_0x8cd2('0x26')]][_0x8cd2('0x29')]('/');break;case _0x8cd2('0x1f'):_0x36980f[_0x8cd2('0x1f')]=_0x207078[_0x5a2b04[_0x1a64cd]['param']];if(_0x2d2290[_0x8cd2('0x1b')]!==_0x8cd2('0x1c')){if(_0x36980f[_0x8cd2('0x1f')][_0x8cd2('0x2a')](_0x8cd2('0x2b'))<0x0){_0x36980f[_0x8cd2('0x1f')]+=_0x8cd2('0x2b');}}else{_0x36980f[_0x8cd2('0x1f')]=_0x36980f[_0x8cd2('0x1f')][_0x8cd2('0x2c')](_0x8cd2('0x2b'),'');}_0x473bcb[_0x5a2b04[_0x1a64cd][_0x8cd2('0x23')]]=_0x36980f[_0x8cd2('0x1f')];break;default:_0x473bcb[_0x5a2b04[_0x1a64cd][_0x8cd2('0x23')]]=_0x207078[_0x5a2b04[_0x1a64cd][_0x8cd2('0x23')]];}}return _0x473bcb['join'](',');}function _0x1b45aa(_0x2a0f42,_0x2f520d,_0x2c1b26){return new Promise(function(_0x433d0d,_0x147ce0){var _0x4d5f9e=[];if(_[_0x8cd2('0x2d')](_0x2f520d))return _0x433d0d(_0x4d5f9e);_0x228f5b[_0x8cd2('0x2e')][_0x8cd2('0x2f')]({'attributes':['id',_0x8cd2('0x30'),'IntervalId'],'raw':!![]})[_0x8cd2('0x31')](function(_0x1bddf9){for(var _0x3570eb=0x0,_0x50af5b=0x0;_0x3570eb<_0x2f520d[_0x8cd2('0x21')];_0x3570eb++,_0x50af5b=0x0){var _0xc958c3=_0x2f520d[_0x3570eb];var _0x59a22f=[];var _0x388dd6=[];delete _0xc958c3['id'];if(_0xc958c3[_0x8cd2('0x30')]!=='*,*,*,*'){_0xc958c3[_0x8cd2('0x32')]=[_0xc958c3[_0x8cd2('0x30')]];}else{_0xc958c3['intervals']=_0xc958c3[_0x8cd2('0x33')]?_[_0x8cd2('0x34')](_[_0x8cd2('0x35')](_0x1bddf9,{'IntervalId':_0xc958c3[_0x8cd2('0x33')]}),_0x8cd2('0x30')):[];}_0xc958c3[_0x8cd2('0xb')]=_0x2a0f42[_0x8cd2('0xb')];_0xc958c3[_0x8cd2('0x6')]=_0x2a0f42[_0x8cd2('0x6')];if(_0xc958c3[_0x8cd2('0x3')])_0xc958c3[_0x8cd2('0x3')]=_0xc958c3[_0x8cd2('0x3')]['toLowerCase']();if(_0x2a0f42['type']===_0x8cd2('0x11')){if(_0xc958c3['hasOwnProperty']('tag')&&_0xc958c3[_0x8cd2('0x36')]&&_0xc958c3['tag']!=='--'){_0x59a22f[_0x8cd2('0xd')]({'type':_0xc958c3[_0x8cd2('0x3')][_0x8cd2('0x37')](),'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x38')+_0xc958c3['tag'],'context':_0x2a0f42['context'],'exten':_0x2a0f42[_0x8cd2('0x6')],'priority':_0xc958c3[_0x8cd2('0x32')]['length']+_0x2c1b26+_0x50af5b++,'VoiceExtensionId':_0x2a0f42['id']});}_0x59a22f['push']({'type':_0xc958c3[_0x8cd2('0x3')][_0x8cd2('0x37')](),'app':_0x8cd2('0x15'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0xc958c3['callerID']?'Set(CALLERID(all)='+_0xc958c3[_0x8cd2('0x39')]+')':_0x8cd2('0x3a')),'context':_0x2a0f42[_0x8cd2('0xb')],'exten':_0x2a0f42[_0x8cd2('0x6')],'priority':_0xc958c3[_0x8cd2('0x32')][_0x8cd2('0x21')]+_0x2c1b26+_0x50af5b++,'VoiceExtensionId':_0x2a0f42['id']});}else{if(_0xc958c3['hasOwnProperty'](_0x8cd2('0x3b'))){if([_0x8cd2('0x3c'),_0x8cd2('0x3d')][_0x8cd2('0x3e')](_0xc958c3['app'][_0x8cd2('0x37')]())&&_0xc958c3[_0x8cd2('0x3f')]!=='custom'){if(_0xc958c3[_0x8cd2('0x3b')]){_0x59a22f[_0x8cd2('0xd')]({'type':_0xc958c3[_0x8cd2('0x3')]['toLowerCase'](),'app':_0x8cd2('0x15'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2a0f42[_0x8cd2('0xb')],'exten':_0x2a0f42[_0x8cd2('0x6')],'priority':_0xc958c3[_0x8cd2('0x32')][_0x8cd2('0x21')]+_0x2c1b26+_0x50af5b++,'VoiceExtensionId':_0x2a0f42['id']});_0x59a22f[_0x8cd2('0xd')]({'type':_0xc958c3[_0x8cd2('0x3')][_0x8cd2('0x37')](),'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x40'),'context':_0x2a0f42['context'],'exten':_0x2a0f42[_0x8cd2('0x6')],'priority':_0xc958c3[_0x8cd2('0x32')][_0x8cd2('0x21')]+_0x2c1b26+_0x50af5b++,'VoiceExtensionId':_0x2a0f42['id']});}else{_0x59a22f[_0x8cd2('0xd')]({'type':_0xc958c3[_0x8cd2('0x3')][_0x8cd2('0x37')](),'app':'ExecIf','appdata':_0x8cd2('0x41'),'context':_0x2a0f42[_0x8cd2('0xb')],'exten':_0x2a0f42[_0x8cd2('0x6')],'priority':_0xc958c3[_0x8cd2('0x32')][_0x8cd2('0x21')]+_0x2c1b26+_0x50af5b++,'VoiceExtensionId':_0x2a0f42['id']});_0x59a22f[_0x8cd2('0xd')]({'type':_0xc958c3[_0x8cd2('0x3')][_0x8cd2('0x37')](),'app':'Set','appdata':_0x8cd2('0x42'),'context':_0x2a0f42['context'],'exten':_0x2a0f42[_0x8cd2('0x6')],'priority':_0xc958c3['intervals'][_0x8cd2('0x21')]+_0x2c1b26+_0x50af5b++,'VoiceExtensionId':_0x2a0f42['id']});}}}}for(var _0x1e1161=0x0;_0x1e1161<_0xc958c3[_0x8cd2('0x32')][_0x8cd2('0x21')];_0x1e1161++){var _0x16e51d=_0x2c1b26+_0xc958c3['intervals'][_0x8cd2('0x21')];var _0x2edf68=_0x1e1161===_0xc958c3[_0x8cd2('0x32')][_0x8cd2('0x21')]-0x1?_0x2c1b26+_0x59a22f[_0x8cd2('0x21')]+_0x388dd6[_0x8cd2('0x21')]+0x2:_0x2c1b26+_0x1e1161+0x1;_0x59a22f[_0x8cd2('0x43')](_0x1e1161,0x0,{'type':_0x2a0f42['type'],'app':_0x8cd2('0x44'),'appdata':_0xc958c3['intervals'][_0x1e1161]+'?'+_0x2a0f42[_0x8cd2('0xb')]+_0x8cd2('0x45')+_0x16e51d+':'+_0x2a0f42[_0x8cd2('0xb')]+',${EXTEN},'+_0x2edf68,'exten':_0x2a0f42[_0x8cd2('0x6')],'context':_0x2a0f42['context'],'priority':_0x2c1b26+_0x1e1161,'VoiceExtensionId':_0x2a0f42['id']});}if(_0xc958c3['appType']==='outboundDial'){_0xc958c3[_0x8cd2('0x46')]=_0x2bcd48(_0x2a0f42,_0xc958c3['appdata']);}if(_0xc958c3[_0x8cd2('0x3f')]==='agi'){_0x59a22f['push']({'type':_0xc958c3['type'][_0x8cd2('0x37')](),'app':'Set','appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x2a0f42[_0x8cd2('0xb')],'exten':_0x2a0f42[_0x8cd2('0x6')],'priority':_0xc958c3[_0x8cd2('0x32')][_0x8cd2('0x21')]+_0x2c1b26+_0x50af5b++,'VoiceExtensionId':_0x2a0f42['id']});}_0xc958c3[_0x8cd2('0x47')]=_0x59a22f[_0x8cd2('0x21')]?_[_0x8cd2('0x48')](_0x59a22f)[_0x8cd2('0x47')]+0x1:_0x2c1b26;_0x4d5f9e=_[_0x8cd2('0x49')](_0x4d5f9e,_0x59a22f,[_0xc958c3],_0x388dd6);_0x2c1b26=_[_0x8cd2('0x48')](_0x4d5f9e)['priority']+0x1;}return _0x433d0d(_0x4d5f9e);})[_0x8cd2('0x4a')](function(_0x1e81a0){_0x147ce0(_0x1e81a0);});});}return _0xb78e1e[_0x8cd2('0x4b')](_0x8cd2('0x4c'),attributes,{'tableName':_0x8cd2('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x331c26){var _0x683ac2=this[_0x8cd2('0x4e')]({'plain':!![]});var _0x3c563e=_0x683ac2['type']===_0x8cd2('0x11')?_0x3ace79(_0x683ac2):_0x167aee(_0x683ac2);return _0x1b45aa(_0x683ac2,_0x331c26,_[_0x8cd2('0x48')](_0x3c563e)[_0x8cd2('0x47')]+0x1)[_0x8cd2('0x31')](function(_0x4027f8){var _0x31ec4f=_['concat'](_0x3c563e,_0x4027f8);_0x31ec4f[_0x8cd2('0xd')]({'type':_0x683ac2['type'],'app':_0x8cd2('0x4f'),'exten':_0x683ac2[_0x8cd2('0x6')],'context':_0x683ac2['context'],'priority':_[_0x8cd2('0x48')](_0x31ec4f)['priority']+0x1,'VoiceExtensionId':_0x683ac2['id']});return _0x31ec4f;});}}});}; \ No newline at end of file +var _0xce5c=['prefix','${EXTEN}','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','IntervalId','interval','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appdata','agi','priority','last','concat','catch','VoiceExtension','get','then','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','${EXTEN:','ExecIf','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','length','name','param','phone','split'];(function(_0x1e12c8,_0x545e60){var _0x14aae2=function(_0x44b9ba){while(--_0x44b9ba){_0x1e12c8['push'](_0x1e12c8['shift']());}};_0x14aae2(++_0x545e60);}(_0xce5c,0x79));var _0xcce5=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0xce5c[_0x53abe5];return _0xc1c37e;};'use strict';var _=require(_0xcce5('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xcce5('0x1')]=function(_0x5da03d){var _0x48d247=_0x5da03d[_0xcce5('0x2')];function _0xbb77a1(_0x44b2c7){var _0x54c88f=0x2;var _0xa39fa4=[{'type':_0x44b2c7[_0xcce5('0x3')],'app':_0xcce5('0x4'),'appdata':_0xcce5('0x5')+_0x44b2c7[_0xcce5('0x3')],'context':_0x44b2c7[_0xcce5('0x6')],'exten':_0x44b2c7[_0xcce5('0x7')],'priority':_0x54c88f++,'VoiceExtensionId':_0x44b2c7['id']},{'type':_0x44b2c7[_0xcce5('0x3')],'app':_0x44b2c7[_0xcce5('0x8')]?'Set':_0xcce5('0x9'),'appdata':_0x44b2c7[_0xcce5('0x8')]?_0xcce5('0xa')+_0x44b2c7[_0xcce5('0x8')]:_0xcce5('0xb'),'context':_0x44b2c7[_0xcce5('0x6')],'exten':_0x44b2c7[_0xcce5('0x7')],'priority':_0x54c88f++,'VoiceExtensionId':_0x44b2c7['id']}];if(_0x44b2c7[_0xcce5('0x3')]===_0xcce5('0xc')){_0xa39fa4[_0xcce5('0xd')]({'type':_0xcce5('0xc'),'app':_0xcce5('0x4'),'appdata':_0xcce5('0xe')+_0x44b2c7['id'],'context':_0x44b2c7['context'],'exten':_0x44b2c7[_0xcce5('0x7')],'priority':_0x54c88f++,'VoiceExtensionId':_0x44b2c7['id']});}_0xa39fa4['push']({'type':_0x44b2c7['type'],'app':_0xcce5('0x4'),'appdata':_0xcce5('0xf'),'context':_0x44b2c7['context'],'exten':_0x44b2c7[_0xcce5('0x7')],'priority':_0x54c88f++,'VoiceExtensionId':_0x44b2c7['id']},{'type':_0x44b2c7[_0xcce5('0x3')],'app':_0xcce5('0x4'),'appdata':_0xcce5('0x10'),'context':_0x44b2c7['context'],'exten':_0x44b2c7[_0xcce5('0x7')],'priority':_0x54c88f++,'VoiceExtensionId':_0x44b2c7['id']},{'type':_0x44b2c7[_0xcce5('0x3')],'app':_0xcce5('0x4'),'appdata':_0xcce5('0x11'),'context':_0x44b2c7[_0xcce5('0x6')],'exten':_0x44b2c7[_0xcce5('0x7')],'priority':_0x54c88f++,'VoiceExtensionId':_0x44b2c7['id']});return _0xa39fa4;}function _0x3ff50f(_0x350eaf){var _0x1cbc67=0x2;var _0x45f8da=[{'type':'outbound','app':_0xcce5('0x4'),'appdata':_0xcce5('0x12'),'context':_0x350eaf['context'],'exten':_0x350eaf[_0xcce5('0x7')],'priority':_0x1cbc67++,'VoiceExtensionId':_0x350eaf['id']},{'type':_0xcce5('0x13'),'app':_0x350eaf[_0xcce5('0x8')]?_0xcce5('0x4'):'NoOp','appdata':_0x350eaf[_0xcce5('0x8')]?_0xcce5('0xa')+_0x350eaf['alias']:_0xcce5('0xb'),'context':_0x350eaf[_0xcce5('0x6')],'exten':_0x350eaf[_0xcce5('0x7')],'priority':_0x1cbc67++,'VoiceExtensionId':_0x350eaf['id']},{'type':_0xcce5('0x13'),'app':_0xcce5('0x4'),'appdata':_0xcce5('0x14')+(_0x350eaf['cutdigits']?_0xcce5('0x15')+_0x350eaf['cutdigits']+'}':'${EXTEN}'),'context':_0x350eaf['context'],'exten':_0x350eaf['exten'],'priority':_0x1cbc67++,'VoiceExtensionId':_0x350eaf['id']},{'type':_0xcce5('0x13'),'app':_0xcce5('0x4'),'appdata':_0xcce5('0xe')+_0x350eaf['id'],'context':_0x350eaf[_0xcce5('0x6')],'exten':_0x350eaf[_0xcce5('0x7')],'priority':_0x1cbc67++,'VoiceExtensionId':_0x350eaf['id']},{'type':_0xcce5('0x13'),'app':_0xcce5('0x16'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x1cbc67+0x2)+_0xcce5('0x17')+(_0x1cbc67+0x1)+')','context':_0x350eaf[_0xcce5('0x6')],'exten':_0x350eaf['exten'],'priority':_0x1cbc67++,'VoiceExtensionId':_0x350eaf['id']},{'type':'outbound','app':_0xcce5('0x4'),'appdata':_0x350eaf[_0xcce5('0x18')]?_0xcce5('0x19')+_0x350eaf[_0xcce5('0x18')]+'}':_0xcce5('0x1a'),'context':_0x350eaf[_0xcce5('0x6')],'exten':_0x350eaf[_0xcce5('0x7')],'priority':_0x1cbc67++,'VoiceExtensionId':_0x350eaf['id']},{'type':_0xcce5('0x13'),'app':_0xcce5('0x4'),'appdata':_0xcce5('0xf'),'context':_0x350eaf[_0xcce5('0x6')],'exten':_0x350eaf[_0xcce5('0x7')],'priority':_0x1cbc67++,'VoiceExtensionId':_0x350eaf['id']},{'type':_0xcce5('0x13'),'app':_0xcce5('0x4'),'appdata':_0xcce5('0x10'),'context':_0x350eaf['context'],'exten':_0x350eaf[_0xcce5('0x7')],'priority':_0x1cbc67++,'VoiceExtensionId':_0x350eaf['id']},{'type':_0xcce5('0x13'),'app':'Set','appdata':_0xcce5('0x11'),'context':_0x350eaf['context'],'exten':_0x350eaf[_0xcce5('0x7')],'priority':_0x1cbc67++,'VoiceExtensionId':_0x350eaf['id']},{'type':_0xcce5('0x13'),'app':'Set','appdata':_0xcce5('0x1b')+_0x350eaf['id'],'context':_0x350eaf[_0xcce5('0x6')],'exten':_0x350eaf[_0xcce5('0x7')],'priority':_0x1cbc67++,'VoiceExtensionId':_0x350eaf['id']}];if(_0x350eaf[_0xcce5('0x1c')]('recordingFormat')&&_0x350eaf[_0xcce5('0x1d')]!==_0xcce5('0x1e')){_0x45f8da[_0xcce5('0xd')]({'type':'outbound','app':_0xcce5('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x350eaf[_0xcce5('0x6')],'exten':_0x350eaf[_0xcce5('0x7')],'priority':_0x1cbc67++,'VoiceExtensionId':_0x350eaf['id']},{'type':'outbound','app':_0xcce5('0x4'),'appdata':_0xcce5('0x1f')+_0x350eaf[_0xcce5('0x1d')]||_0xcce5('0x20'),'context':_0x350eaf[_0xcce5('0x6')],'exten':_0x350eaf[_0xcce5('0x7')],'priority':_0x1cbc67++,'VoiceExtensionId':_0x350eaf['id']});}return _0x45f8da;}function _0x14a48e(_0x4beaa9,_0x496098){var _0x2e3248=[{'name':_0xcce5('0x21'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xcce5('0x22'),'param':0x2},{'name':_0xcce5('0x23'),'param':0x3}];var _0x2f692a={};var _0x3043f0=_0x496098['split'](',');var _0x2ad305=[];for(var _0xf07982=0x0;_0xf07982<_0x2e3248[_0xcce5('0x24')];_0xf07982++){switch(_0x2e3248[_0xf07982][_0xcce5('0x25')]){case'trunk':_0x2f692a[_0xcce5('0x21')]=_0x3043f0[_0x2e3248[_0xf07982][_0xcce5('0x26')]]['split']('/')[0x1];_0x2f692a[_0xcce5('0x27')]=_0x3043f0[_0x2e3248[_0xf07982][_0xcce5('0x26')]][_0xcce5('0x28')]('/')[0x2];_0x2f692a[_0xcce5('0x29')]=_0x2f692a[_0xcce5('0x27')]?_0x2f692a['phone'][_0xcce5('0x28')]('$')[0x0]:undefined;_0x2f692a['phone']=_0x4beaa9[_0xcce5('0x18')]?(_0x2f692a['prefix']||'')+_0xcce5('0x15')+_0x4beaa9[_0xcce5('0x18')]+'}':(_0x2f692a[_0xcce5('0x29')]||'')+_0xcce5('0x2a');_0x2ad305[_0x2e3248[_0xf07982][_0xcce5('0x26')]]=['SIP',_0x2f692a[_0xcce5('0x21')],_0x2f692a[_0xcce5('0x27')]]['join']('/');break;case _0xcce5('0x22'):_0x2f692a[_0xcce5('0x22')]=_0x3043f0[_0x2e3248[_0xf07982][_0xcce5('0x26')]];if(_0x4beaa9[_0xcce5('0x1d')]!==_0xcce5('0x1e')){if(_0x2f692a[_0xcce5('0x22')][_0xcce5('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x2f692a['options']+=_0xcce5('0x2c');}}else{_0x2f692a[_0xcce5('0x22')]=_0x2f692a['options'][_0xcce5('0x2d')](_0xcce5('0x2c'),'');}_0x2ad305[_0x2e3248[_0xf07982][_0xcce5('0x26')]]=_0x2f692a[_0xcce5('0x22')];break;default:_0x2ad305[_0x2e3248[_0xf07982][_0xcce5('0x26')]]=_0x3043f0[_0x2e3248[_0xf07982][_0xcce5('0x26')]];}}return _0x2ad305['join'](',');}function _0x4874f8(_0x106eab,_0x3352c6,_0x486b65){return new Promise(function(_0x51a3ae,_0x1ea8e1){var _0x284a70=[];if(_['isEmpty'](_0x3352c6))return _0x51a3ae(_0x284a70);_0x48d247[_0xcce5('0x2e')][_0xcce5('0x2f')]({'attributes':['id','interval',_0xcce5('0x30')],'raw':!![]})['then'](function(_0x3f50c0){for(var _0x109c7a=0x0,_0x4cb7c7=0x0;_0x109c7a<_0x3352c6[_0xcce5('0x24')];_0x109c7a++,_0x4cb7c7=0x0){var _0x3285e3=_0x3352c6[_0x109c7a];var _0x5ab24a=[];var _0xe1f573=[];delete _0x3285e3['id'];if(_0x3285e3[_0xcce5('0x31')]!==_0xcce5('0x32')){_0x3285e3[_0xcce5('0x33')]=[_0x3285e3[_0xcce5('0x31')]];}else{_0x3285e3[_0xcce5('0x33')]=_0x3285e3[_0xcce5('0x30')]?_[_0xcce5('0x34')](_['filter'](_0x3f50c0,{'IntervalId':_0x3285e3[_0xcce5('0x30')]}),_0xcce5('0x31')):[];}_0x3285e3[_0xcce5('0x6')]=_0x106eab[_0xcce5('0x6')];_0x3285e3[_0xcce5('0x7')]=_0x106eab[_0xcce5('0x7')];if(_0x3285e3['type'])_0x3285e3[_0xcce5('0x3')]=_0x3285e3[_0xcce5('0x3')][_0xcce5('0x35')]();if(_0x106eab[_0xcce5('0x3')]===_0xcce5('0x13')){if(_0x3285e3[_0xcce5('0x1c')](_0xcce5('0x36'))&&_0x3285e3['tag']&&_0x3285e3[_0xcce5('0x36')]!=='--'){_0x5ab24a[_0xcce5('0xd')]({'type':_0x3285e3[_0xcce5('0x3')]['toLowerCase'](),'app':_0xcce5('0x4'),'appdata':_0xcce5('0x37')+_0x3285e3[_0xcce5('0x36')],'context':_0x106eab[_0xcce5('0x6')],'exten':_0x106eab[_0xcce5('0x7')],'priority':_0x3285e3['intervals'][_0xcce5('0x24')]+_0x486b65+_0x4cb7c7++,'VoiceExtensionId':_0x106eab['id']});}_0x5ab24a[_0xcce5('0xd')]({'type':_0x3285e3[_0xcce5('0x3')]['toLowerCase'](),'app':_0xcce5('0x16'),'appdata':_0xcce5('0x38')+(_0x3285e3[_0xcce5('0x39')]?'Set(CALLERID(all)='+_0x3285e3[_0xcce5('0x39')]+')':_0xcce5('0x3a')),'context':_0x106eab['context'],'exten':_0x106eab[_0xcce5('0x7')],'priority':_0x3285e3[_0xcce5('0x33')][_0xcce5('0x24')]+_0x486b65+_0x4cb7c7++,'VoiceExtensionId':_0x106eab['id']});}else{if(_0x3285e3[_0xcce5('0x1c')](_0xcce5('0x3b'))){if([_0xcce5('0x3c'),_0xcce5('0x3d')][_0xcce5('0x3e')](_0x3285e3[_0xcce5('0x3f')][_0xcce5('0x35')]())&&_0x3285e3[_0xcce5('0x40')]!=='custom'){if(_0x3285e3[_0xcce5('0x3b')]){_0x5ab24a[_0xcce5('0xd')]({'type':_0x3285e3[_0xcce5('0x3')][_0xcce5('0x35')](),'app':'ExecIf','appdata':_0xcce5('0x41'),'context':_0x106eab[_0xcce5('0x6')],'exten':_0x106eab['exten'],'priority':_0x3285e3[_0xcce5('0x33')]['length']+_0x486b65+_0x4cb7c7++,'VoiceExtensionId':_0x106eab['id']});_0x5ab24a['push']({'type':_0x3285e3[_0xcce5('0x3')][_0xcce5('0x35')](),'app':'Set','appdata':_0xcce5('0x42'),'context':_0x106eab[_0xcce5('0x6')],'exten':_0x106eab[_0xcce5('0x7')],'priority':_0x3285e3[_0xcce5('0x33')][_0xcce5('0x24')]+_0x486b65+_0x4cb7c7++,'VoiceExtensionId':_0x106eab['id']});}else{_0x5ab24a[_0xcce5('0xd')]({'type':_0x3285e3['type']['toLowerCase'](),'app':_0xcce5('0x16'),'appdata':_0xcce5('0x43'),'context':_0x106eab['context'],'exten':_0x106eab[_0xcce5('0x7')],'priority':_0x3285e3[_0xcce5('0x33')]['length']+_0x486b65+_0x4cb7c7++,'VoiceExtensionId':_0x106eab['id']});_0x5ab24a[_0xcce5('0xd')]({'type':_0x3285e3[_0xcce5('0x3')][_0xcce5('0x35')](),'app':_0xcce5('0x4'),'appdata':_0xcce5('0x44'),'context':_0x106eab[_0xcce5('0x6')],'exten':_0x106eab[_0xcce5('0x7')],'priority':_0x3285e3[_0xcce5('0x33')][_0xcce5('0x24')]+_0x486b65+_0x4cb7c7++,'VoiceExtensionId':_0x106eab['id']});}}}}for(var _0x2925f7=0x0;_0x2925f7<_0x3285e3[_0xcce5('0x33')]['length'];_0x2925f7++){var _0xf7ace1=_0x486b65+_0x3285e3[_0xcce5('0x33')][_0xcce5('0x24')];var _0x131ddd=_0x2925f7===_0x3285e3[_0xcce5('0x33')][_0xcce5('0x24')]-0x1?_0x486b65+_0x5ab24a['length']+_0xe1f573['length']+0x2:_0x486b65+_0x2925f7+0x1;_0x5ab24a['splice'](_0x2925f7,0x0,{'type':_0x106eab[_0xcce5('0x3')],'app':_0xcce5('0x45'),'appdata':_0x3285e3[_0xcce5('0x33')][_0x2925f7]+'?'+_0x106eab[_0xcce5('0x6')]+',${EXTEN},'+_0xf7ace1+':'+_0x106eab[_0xcce5('0x6')]+_0xcce5('0x46')+_0x131ddd,'exten':_0x106eab[_0xcce5('0x7')],'context':_0x106eab[_0xcce5('0x6')],'priority':_0x486b65+_0x2925f7,'VoiceExtensionId':_0x106eab['id']});}if(_0x3285e3[_0xcce5('0x40')]==='outboundDial'){_0x3285e3['appdata']=_0x14a48e(_0x106eab,_0x3285e3[_0xcce5('0x47')]);}if(_0x3285e3[_0xcce5('0x40')]===_0xcce5('0x48')){_0x5ab24a['push']({'type':_0x3285e3['type'][_0xcce5('0x35')](),'app':_0xcce5('0x4'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x106eab[_0xcce5('0x6')],'exten':_0x106eab[_0xcce5('0x7')],'priority':_0x3285e3[_0xcce5('0x33')][_0xcce5('0x24')]+_0x486b65+_0x4cb7c7++,'VoiceExtensionId':_0x106eab['id']});}_0x3285e3[_0xcce5('0x49')]=_0x5ab24a[_0xcce5('0x24')]?_[_0xcce5('0x4a')](_0x5ab24a)[_0xcce5('0x49')]+0x1:_0x486b65;_0x284a70=_[_0xcce5('0x4b')](_0x284a70,_0x5ab24a,[_0x3285e3],_0xe1f573);_0x486b65=_[_0xcce5('0x4a')](_0x284a70)[_0xcce5('0x49')]+0x1;}return _0x51a3ae(_0x284a70);})[_0xcce5('0x4c')](function(_0x5ca4c1){_0x1ea8e1(_0x5ca4c1);});});}return _0x5da03d['define'](_0xcce5('0x4d'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4d774a){var _0x470b99=this[_0xcce5('0x4e')]({'plain':!![]});var _0x4112e8=_0x470b99['type']===_0xcce5('0x13')?_0x3ff50f(_0x470b99):_0xbb77a1(_0x470b99);return _0x4874f8(_0x470b99,_0x4d774a,_[_0xcce5('0x4a')](_0x4112e8)['priority']+0x1)[_0xcce5('0x4f')](function(_0x47f700){var _0x5a7c79=_[_0xcce5('0x4b')](_0x4112e8,_0x47f700);_0x5a7c79[_0xcce5('0xd')]({'type':_0x470b99[_0xcce5('0x3')],'app':_0xcce5('0x50'),'exten':_0x470b99['exten'],'context':_0x470b99[_0xcce5('0x6')],'priority':_[_0xcce5('0x4a')](_0x5a7c79)['priority']+0x1,'VoiceExtensionId':_0x470b99['id']});return _0x5a7c79;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index b6af6cf..0faaba9 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 _0x3a0f=['GetVoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceExtension.socket','register','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','VoiceExtension,\x20%s,\x20%s','result','catch'];(function(_0x32ceb3,_0x29fe45){var _0x391dd4=function(_0x4ceece){while(--_0x4ceece){_0x32ceb3['push'](_0x32ceb3['shift']());}};_0x391dd4(++_0x29fe45);}(_0x3a0f,0x145));var _0xf3a0=function(_0x15ba95,_0x114d6b){_0x15ba95=_0x15ba95-0x0;var _0x4fdf02=_0x3a0f[_0x15ba95];return _0x4fdf02;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf3a0('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3a0('0x1'));var db=require(_0xf3a0('0x2'))['db'];var utils=require(_0xf3a0('0x3'));var logger=require(_0xf3a0('0x4'))(_0xf3a0('0x5'));var config=require(_0xf3a0('0x6'));var jayson=require(_0xf3a0('0x7'));var client=jayson[_0xf3a0('0x8')]['http']({'port':0x232a});config[_0xf3a0('0x9')]=_[_0xf3a0('0xa')](config[_0xf3a0('0x9')],{'host':_0xf3a0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3a0('0x9')]));require(_0xf3a0('0xc'))[_0xf3a0('0xd')](socket);function respondWithRpcPromise(_0x12970e,_0x4acd91,_0x185cf7){return new BPromise(function(_0x3d2d63,_0x40d12a){return client['request'](_0x12970e,_0x185cf7)[_0xf3a0('0xe')](function(_0x318e6a){logger[_0xf3a0('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x4acd91,_0xf3a0('0x10'));logger[_0xf3a0('0x11')](_0xf3a0('0x12'),_0x4acd91,'request\x20sent',JSON['stringify'](_0x318e6a));if(_0x318e6a[_0xf3a0('0x13')]){if(_0x318e6a[_0xf3a0('0x13')][_0xf3a0('0x14')]===0x1f4){logger[_0xf3a0('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x4acd91,_0x318e6a[_0xf3a0('0x13')][_0xf3a0('0x15')]);return _0x40d12a(_0x318e6a[_0xf3a0('0x13')][_0xf3a0('0x15')]);}logger[_0xf3a0('0x13')](_0xf3a0('0x16'),_0x4acd91,_0x318e6a[_0xf3a0('0x13')][_0xf3a0('0x15')]);return _0x3d2d63(_0x318e6a['error']['message']);}else{logger[_0xf3a0('0xf')](_0xf3a0('0x16'),_0x4acd91,_0xf3a0('0x10'));_0x3d2d63(_0x318e6a[_0xf3a0('0x17')][_0xf3a0('0x15')]);}})[_0xf3a0('0x18')](function(_0x5e04b7){logger['error'](_0xf3a0('0x16'),_0x4acd91,_0x5e04b7);_0x40d12a(_0x5e04b7);});});}exports[_0xf3a0('0x19')]=function(_0x66660c){var _0x431fe5=this;return new Promise(function(_0x25c2f4,_0x4f36ae){return db['VoiceExtension'][_0xf3a0('0x1a')]({'raw':_0x66660c['options']?_0x66660c[_0xf3a0('0x1b')][_0xf3a0('0x1c')]===undefined?!![]:![]:!![],'where':_0x66660c[_0xf3a0('0x1b')]?_0x66660c[_0xf3a0('0x1b')][_0xf3a0('0x1d')]||null:null,'attributes':_0x66660c[_0xf3a0('0x1b')]?_0x66660c[_0xf3a0('0x1b')][_0xf3a0('0x1e')]||null:null,'limit':_0x66660c[_0xf3a0('0x1b')]?_0x66660c[_0xf3a0('0x1b')][_0xf3a0('0x1f')]||null:null,'include':_0x66660c[_0xf3a0('0x1b')]?_0x66660c[_0xf3a0('0x1b')][_0xf3a0('0x20')]?_[_0xf3a0('0x21')](_0x66660c['options'][_0xf3a0('0x20')],function(_0x182ce6){return{'model':db[_0x182ce6[_0xf3a0('0x22')]],'as':_0x182ce6['as'],'attributes':_0x182ce6[_0xf3a0('0x1e')],'include':_0x182ce6[_0xf3a0('0x20')]?_[_0xf3a0('0x21')](_0x182ce6[_0xf3a0('0x20')],function(_0x7f90dd){return{'model':db[_0x7f90dd['model']],'as':_0x7f90dd['as'],'attributes':_0x7f90dd['attributes'],'include':_0x7f90dd['include']?_[_0xf3a0('0x21')](_0x7f90dd[_0xf3a0('0x20')],function(_0x252f89){return{'model':db[_0x252f89[_0xf3a0('0x22')]],'as':_0x252f89['as'],'attributes':_0x252f89['attributes']};}):[]};}):[]};}):[]:[]})[_0xf3a0('0xe')](function(_0x13e65a){logger[_0xf3a0('0xf')](_0xf3a0('0x19'),_0x66660c);logger[_0xf3a0('0x11')](_0xf3a0('0x19'),_0x66660c,JSON['stringify'](_0x13e65a));_0x25c2f4(_0x13e65a);})[_0xf3a0('0x18')](function(_0x1065bd){logger[_0xf3a0('0x13')](_0xf3a0('0x19'),_0x1065bd[_0xf3a0('0x15')],_0x66660c);_0x4f36ae(_0x431fe5[_0xf3a0('0x13')](0x1f4,_0x1065bd['message']));});});}; \ No newline at end of file +var _0x49e5=['include','map','model','attributes','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where'];(function(_0x196220,_0x1dc336){var _0x441794=function(_0x40c736){while(--_0x40c736){_0x196220['push'](_0x196220['shift']());}};_0x441794(++_0x1dc336);}(_0x49e5,0x71));var _0x549e=function(_0x3103f7,_0x58b835){_0x3103f7=_0x3103f7-0x0;var _0x55cc98=_0x49e5[_0x3103f7];return _0x55cc98;};'use strict';var _=require(_0x549e('0x0'));var util=require(_0x549e('0x1'));var moment=require(_0x549e('0x2'));var BPromise=require(_0x549e('0x3'));var rs=require(_0x549e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x549e('0x5'))['db'];var utils=require(_0x549e('0x6'));var logger=require(_0x549e('0x7'))(_0x549e('0x8'));var config=require(_0x549e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x549e('0xa')]['http']({'port':0x232a});config['redis']=_[_0x549e('0xb')](config[_0x549e('0xc')],{'host':_0x549e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceExtension.socket')[_0x549e('0xe')](socket);function respondWithRpcPromise(_0x28a6a2,_0x254556,_0x468c6c){return new BPromise(function(_0x3b484d,_0xd821e8){return client['request'](_0x28a6a2,_0x468c6c)[_0x549e('0xf')](function(_0x546af4){logger[_0x549e('0x10')](_0x549e('0x11'),_0x254556,_0x549e('0x12'));logger['debug'](_0x549e('0x13'),_0x254556,_0x549e('0x12'),JSON[_0x549e('0x14')](_0x546af4));if(_0x546af4['error']){if(_0x546af4[_0x549e('0x15')][_0x549e('0x16')]===0x1f4){logger[_0x549e('0x15')](_0x549e('0x11'),_0x254556,_0x546af4[_0x549e('0x15')][_0x549e('0x17')]);return _0xd821e8(_0x546af4[_0x549e('0x15')][_0x549e('0x17')]);}logger[_0x549e('0x15')](_0x549e('0x11'),_0x254556,_0x546af4[_0x549e('0x15')][_0x549e('0x17')]);return _0x3b484d(_0x546af4[_0x549e('0x15')][_0x549e('0x17')]);}else{logger[_0x549e('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x254556,_0x549e('0x12'));_0x3b484d(_0x546af4[_0x549e('0x18')]['message']);}})[_0x549e('0x19')](function(_0x3f17c6){logger[_0x549e('0x15')](_0x549e('0x11'),_0x254556,_0x3f17c6);_0xd821e8(_0x3f17c6);});});}exports[_0x549e('0x1a')]=function(_0x10cdbe){var _0x311de3=this;return new Promise(function(_0x3dd01a,_0x16e9d1){return db[_0x549e('0x1b')][_0x549e('0x1c')]({'raw':_0x10cdbe[_0x549e('0x1d')]?_0x10cdbe[_0x549e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x10cdbe['options']?_0x10cdbe['options'][_0x549e('0x1e')]||null:null,'attributes':_0x10cdbe[_0x549e('0x1d')]?_0x10cdbe[_0x549e('0x1d')]['attributes']||null:null,'limit':_0x10cdbe['options']?_0x10cdbe[_0x549e('0x1d')]['limit']||null:null,'include':_0x10cdbe[_0x549e('0x1d')]?_0x10cdbe[_0x549e('0x1d')][_0x549e('0x1f')]?_[_0x549e('0x20')](_0x10cdbe[_0x549e('0x1d')]['include'],function(_0x48e480){return{'model':db[_0x48e480[_0x549e('0x21')]],'as':_0x48e480['as'],'attributes':_0x48e480[_0x549e('0x22')],'include':_0x48e480[_0x549e('0x1f')]?_[_0x549e('0x20')](_0x48e480['include'],function(_0x4d54a3){return{'model':db[_0x4d54a3[_0x549e('0x21')]],'as':_0x4d54a3['as'],'attributes':_0x4d54a3[_0x549e('0x22')],'include':_0x4d54a3[_0x549e('0x1f')]?_[_0x549e('0x20')](_0x4d54a3[_0x549e('0x1f')],function(_0x49c9d2){return{'model':db[_0x49c9d2[_0x549e('0x21')]],'as':_0x49c9d2['as'],'attributes':_0x49c9d2[_0x549e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x549e('0xf')](function(_0x5e116f){logger['info'](_0x549e('0x1a'),_0x10cdbe);logger[_0x549e('0x23')](_0x549e('0x1a'),_0x10cdbe,JSON[_0x549e('0x14')](_0x5e116f));_0x3dd01a(_0x5e116f);})[_0x549e('0x19')](function(_0x13b293){logger[_0x549e('0x15')](_0x549e('0x1a'),_0x13b293[_0x549e('0x17')],_0x10cdbe);_0x16e9d1(_0x311de3[_0x549e('0x15')](0x1f4,_0x13b293['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 68bbeaf..a23c745 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(_0x5de390,_0x5b955f){var _0x1d8685=function(_0x444fa8){while(--_0x444fa8){_0x5de390['push'](_0x5de390['shift']());}};_0x1d8685(++_0x5b955f);}(_0x1261,0x144));var _0x1126=function(_0x5e6d65,_0x5db89c){_0x5e6d65=_0x5e6d65-0x0;var _0x5e1f75=_0x1261[_0x5e6d65];return _0x5e1f75;};'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 _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x5202f9,_0x300a19){var _0x136d7e=function(_0x5bb26c){while(--_0x5bb26c){_0x5202f9['push'](_0x5202f9['shift']());}};_0x136d7e(++_0x300a19);}(_0x5fc3,0xa8));var _0x35fc=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0x5fc3[_0x135904];return _0x1ce7d5;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 5d3ce8c..77197f7 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 _0x7046=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','getMessages','post','create','put','update'];(function(_0x4bd06e,_0x593701){var _0x85ebb=function(_0x26a7f2){while(--_0x26a7f2){_0x4bd06e['push'](_0x4bd06e['shift']());}};_0x85ebb(++_0x593701);}(_0x7046,0x144));var _0x6704=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7046[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var fs_extra=require(_0x6704('0x5'));var auth=require(_0x6704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6704('0x7'));var controller=require(_0x6704('0x8'));router[_0x6704('0x9')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xb')]);router['get'](_0x6704('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6704('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6704('0xd')]);router[_0x6704('0xe')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xf')]);router[_0x6704('0x10')](_0x6704('0xc'),auth[_0x6704('0xa')](),controller[_0x6704('0x11')]);router['delete'](_0x6704('0xc'),auth[_0x6704('0xa')](),controller['destroy']);module[_0x6704('0x12')]=router; \ No newline at end of file +var _0xba34=['getMessages','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','show','/:id/messages'];(function(_0x40ea2a,_0x1f21db){var _0x432be2=function(_0x460ea3){while(--_0x460ea3){_0x40ea2a['push'](_0x40ea2a['shift']());}};_0x432be2(++_0x1f21db);}(_0xba34,0x119));var _0x4ba3=function(_0x1368d4,_0xa213ee){_0x1368d4=_0x1368d4-0x0;var _0x327709=_0xba34[_0x1368d4];return _0x327709;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/:id',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x12')]);router[_0x4ba3('0x13')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 6557d84..e8d7ce8 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 _0x4b7d=['email','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','getDataValue','\x20-\x20','sequelize','exports','STRING','contest_mailbox'];(function(_0x457a87,_0x5ea87f){var _0x390362=function(_0x37e75d){while(--_0x37e75d){_0x457a87['push'](_0x457a87['shift']());}};_0x390362(++_0x5ea87f);}(_0x4b7d,0x1e6));var _0xd4b7=function(_0xd55b64,_0x21f609){_0xd55b64=_0xd55b64-0x0;var _0x2dca2a=_0x4b7d[_0xd55b64];return _0x2dca2a;};'use strict';var Sequelize=require(_0xd4b7('0x0'));module[_0xd4b7('0x1')]={'customer_id':{'type':Sequelize[_0xd4b7('0x2')]},'context':{'type':Sequelize[_0xd4b7('0x2')],'defaultValue':'from-voicemail','unique':_0xd4b7('0x3')},'mailbox':{'type':Sequelize[_0xd4b7('0x2')],'defaultValue':'','allowNull':![],'unique':_0xd4b7('0x3')},'password':{'type':Sequelize[_0xd4b7('0x2')]},'fullname':{'type':Sequelize[_0xd4b7('0x2')]},'email':{'type':Sequelize[_0xd4b7('0x2')],'validate':{'isEmail':!![]},'set':function(_0x25feec){this['setDataValue'](_0xd4b7('0x4'),typeof _0x25feec===_0xd4b7('0x5')&&_0x25feec[_0xd4b7('0x6')]()?_0x25feec[_0xd4b7('0x6')]():null);}},'pager':{'type':Sequelize[_0xd4b7('0x2')]},'tz':{'type':Sequelize[_0xd4b7('0x2')],'defaultValue':_0xd4b7('0x7')},'attach':{'type':Sequelize[_0xd4b7('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xd4b7('0x8')]('yes','no'),'defaultValue':_0xd4b7('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xd4b7('0x2')]},'callback':{'type':Sequelize[_0xd4b7('0x2')]},'review':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xd4b7('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':_0xd4b7('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':_0xd4b7('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xd4b7('0x2')]},'emailbody':{'type':Sequelize[_0xd4b7('0x2')]},'maxsecs':{'type':Sequelize[_0xd4b7('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd4b7('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xd4b7('0xc')]('fullname')+_0xd4b7('0xd')+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0x11df=['\x20-\x20','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname'];(function(_0x554fa0,_0x58ff39){var _0x19ae8a=function(_0xee4c3e){while(--_0xee4c3e){_0x554fa0['push'](_0x554fa0['shift']());}};_0x19ae8a(++_0x58ff39);}(_0x11df,0x10c));var _0xf11d=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x11df[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require(_0xf11d('0x0'));module[_0xf11d('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf11d('0x2')],'defaultValue':'from-voicemail','unique':_0xf11d('0x3')},'mailbox':{'type':Sequelize[_0xf11d('0x2')],'defaultValue':'','allowNull':![],'unique':_0xf11d('0x3')},'password':{'type':Sequelize[_0xf11d('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0xc84695){this[_0xf11d('0x4')](_0xf11d('0x5'),typeof _0xc84695===_0xf11d('0x6')&&_0xc84695['trim']()?_0xc84695[_0xf11d('0x7')]():null);}},'pager':{'type':Sequelize[_0xf11d('0x2')]},'tz':{'type':Sequelize[_0xf11d('0x2')],'defaultValue':_0xf11d('0x8')},'attach':{'type':Sequelize[_0xf11d('0x9')](_0xf11d('0xa'),'no'),'defaultValue':_0xf11d('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xf11d('0x9')](_0xf11d('0xa'),'no'),'defaultValue':_0xf11d('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xf11d('0x2')]},'review':{'type':Sequelize[_0xf11d('0x9')](_0xf11d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xf11d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf11d('0x9')](_0xf11d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf11d('0x9')](_0xf11d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf11d('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf11d('0x9')](_0xf11d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xf11d('0x9')](_0xf11d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf11d('0x9')](_0xf11d('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xf11d('0x9')](_0xf11d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf11d('0x9')](_0xf11d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf11d('0x9')](_0xf11d('0xa'),'no'),'defaultValue':_0xf11d('0xa'),'allowNull':![]},'stamp':{'type':_0xf11d('0xc')},'emailsubject':{'type':Sequelize[_0xf11d('0x2')]},'emailbody':{'type':Sequelize[_0xf11d('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf11d('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf11d('0xe')],'get':function(){return this[_0xf11d('0xf')](_0xf11d('0x10'))+_0xf11d('0x11')+this[_0xf11d('0xf')](_0xf11d('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 4d3ec19..a9a97e1 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 _0x58a4=['catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x5492e8,_0x139fb4){var _0x3c39e4=function(_0x45e07c){while(--_0x45e07c){_0x5492e8['push'](_0x5492e8['shift']());}};_0x3c39e4(++_0x139fb4);}(_0x58a4,0xbf));var _0x458a=function(_0x14790f,_0x432b5f){_0x14790f=_0x14790f-0x0;var _0x5acc1f=_0x58a4[_0x14790f];return _0x5acc1f;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];function respondWithStatusCode(_0xee09c6,_0x2a4934){_0x2a4934=_0x2a4934||0xcc;return function(_0x2e788b){if(_0x2e788b){return _0xee09c6['sendStatus'](_0x2a4934);}return _0xee09c6['status'](_0x2a4934)[_0x458a('0x1a')]();};}function respondWithResult(_0x56436f,_0x2c7528){_0x2c7528=_0x2c7528||0xc8;return function(_0x44f683){if(_0x44f683){return _0x56436f[_0x458a('0x1b')](_0x2c7528)[_0x458a('0x1c')](_0x44f683);}};}function respondWithFilteredResult(_0xad80f9,_0x29acee){return function(_0x507b0f){if(_0x507b0f){var _0x4b26be=typeof _0x29acee['offset']===_0x458a('0x1d')&&typeof _0x29acee[_0x458a('0x1e')]===_0x458a('0x1d');var _0x5c5b41=_0x507b0f[_0x458a('0x1f')];var _0x260c87=_0x4b26be?0x0:_0x29acee[_0x458a('0x20')];var _0x392986=_0x4b26be?_0x507b0f[_0x458a('0x1f')]:_0x29acee['offset']+_0x29acee['limit'];var _0x178db9;if(_0x392986>=_0x5c5b41){_0x392986=_0x5c5b41;_0x178db9=0xc8;}else{_0x178db9=0xce;}_0xad80f9['status'](_0x178db9);return _0xad80f9[_0x458a('0x21')](_0x458a('0x22'),_0x260c87+'-'+_0x392986+'/'+_0x5c5b41)['json'](_0x507b0f);}return null;};}function patchUpdates(_0x468416){return function(_0x55a588){try{jsonpatch[_0x458a('0x23')](_0x55a588,_0x468416,!![]);}catch(_0x1c79cb){return BPromise['reject'](_0x1c79cb);}return _0x55a588[_0x458a('0x24')]();};}function saveUpdates(_0xead884,_0x5a2bcb){return function(_0xa6b8ff){if(_0xa6b8ff){return _0xa6b8ff['update'](_0xead884)[_0x458a('0x25')](function(_0x5bca42){return _0x5bca42;});}return null;};}function removeEntity(_0x4080fc,_0x5dfc6c){return function(_0x36b08e){if(_0x36b08e){return _0x36b08e[_0x458a('0x26')]()[_0x458a('0x25')](function(){var _0xcda8cc=_0x36b08e[_0x458a('0x27')]({'plain':!![]});var _0x19bd5=_0x458a('0x28');return db[_0x458a('0x29')][_0x458a('0x26')]({'where':{'type':_0x19bd5,'resourceId':_0xcda8cc['id']}})[_0x458a('0x25')](function(){return _0x36b08e;});})[_0x458a('0x25')](function(){_0x4080fc[_0x458a('0x1b')](0xcc)[_0x458a('0x1a')]();});}};}function handleEntityNotFound(_0x5a55b7,_0xb94bd9){return function(_0x112fa6){if(!_0x112fa6){_0x5a55b7['sendStatus'](0x194);}return _0x112fa6;};}function handleError(_0x5df150,_0x41b23d){_0x41b23d=_0x41b23d||0x1f4;return function(_0x596fe2){logger[_0x458a('0x2a')](_0x596fe2[_0x458a('0x2b')]);if(_0x596fe2[_0x458a('0x2c')]){delete _0x596fe2['name'];}_0x5df150[_0x458a('0x1b')](_0x41b23d)[_0x458a('0x2d')](_0x596fe2);};}exports[_0x458a('0x2e')]=function(_0x562c36,_0x47e20d){var _0x18c890={},_0x4cf059={},_0x185f1c={'count':0x0,'rows':[]};var _0x56e0b9=_[_0x458a('0x2f')](db[_0x458a('0x30')]['rawAttributes'],function(_0x309a6a){return{'name':_0x309a6a[_0x458a('0x31')],'type':_0x309a6a[_0x458a('0x32')]['key']};});_0x4cf059[_0x458a('0x33')]=_[_0x458a('0x2f')](_0x56e0b9,_0x458a('0x2c'));_0x4cf059[_0x458a('0x34')]=_[_0x458a('0x35')](_0x562c36['query']);_0x4cf059[_0x458a('0x36')]=_[_0x458a('0x37')](_0x4cf059[_0x458a('0x33')],_0x4cf059[_0x458a('0x34')]);_0x18c890[_0x458a('0x38')]=_[_0x458a('0x37')](_0x4cf059['model'],qs[_0x458a('0x39')](_0x562c36[_0x458a('0x34')][_0x458a('0x39')]));_0x18c890[_0x458a('0x38')]=_0x18c890[_0x458a('0x38')][_0x458a('0x3a')]?_0x18c890[_0x458a('0x38')]:_0x4cf059[_0x458a('0x33')];if(!_0x562c36[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x18c890[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x562c36[_0x458a('0x34')][_0x458a('0x1e')]);_0x18c890[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x562c36[_0x458a('0x34')][_0x458a('0x20')]);}_0x18c890[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x562c36[_0x458a('0x34')][_0x458a('0x3d')]);_0x18c890[_0x458a('0x3e')]=qs[_0x458a('0x36')](_['pick'](_0x562c36[_0x458a('0x34')],_0x4cf059[_0x458a('0x36')]),_0x56e0b9);if(_0x562c36[_0x458a('0x34')][_0x458a('0x3f')]){_0x18c890[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x18c890[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x56e0b9,function(_0x41d125){if(_0x41d125[_0x458a('0x32')]!==_0x458a('0x41')){var _0x4efbeb={};_0x4efbeb[_0x41d125[_0x458a('0x2c')]]={'$like':'%'+_0x562c36[_0x458a('0x34')]['filter']+'%'};return _0x4efbeb;}})});}_0x18c890=_[_0x458a('0x40')]({},_0x18c890,_0x562c36[_0x458a('0x42')]);var _0x4286a3={'where':_0x18c890['where']};return db[_0x458a('0x30')][_0x458a('0x1f')](_0x4286a3)[_0x458a('0x25')](function(_0x1e51d2){_0x185f1c[_0x458a('0x1f')]=_0x1e51d2;if(_0x562c36[_0x458a('0x34')][_0x458a('0x43')]){_0x18c890[_0x458a('0x44')]=[{'all':!![]}];}return db['VoiceMail'][_0x458a('0x45')](_0x18c890);})[_0x458a('0x25')](function(_0x2b9030){_0x185f1c['rows']=_0x2b9030;return _0x185f1c;})[_0x458a('0x25')](respondWithFilteredResult(_0x47e20d,_0x18c890))[_0x458a('0x46')](handleError(_0x47e20d,null));};exports['show']=function(_0x598707,_0x124f64){var _0x2be08f={'raw':!![],'where':{'id':_0x598707[_0x458a('0x47')]['id']}},_0x36c391={};_0x36c391['model']=_['keys'](db[_0x458a('0x30')][_0x458a('0x48')]);_0x36c391[_0x458a('0x34')]=_[_0x458a('0x35')](_0x598707['query']);_0x36c391[_0x458a('0x36')]=_[_0x458a('0x37')](_0x36c391['model'],_0x36c391[_0x458a('0x34')]);_0x2be08f['attributes']=_[_0x458a('0x37')](_0x36c391[_0x458a('0x33')],qs[_0x458a('0x39')](_0x598707['query'][_0x458a('0x39')]));_0x2be08f[_0x458a('0x38')]=_0x2be08f[_0x458a('0x38')]['length']?_0x2be08f['attributes']:_0x36c391[_0x458a('0x33')];if(_0x598707[_0x458a('0x34')][_0x458a('0x43')]){_0x2be08f['include']=[{'all':!![]}];}_0x2be08f=_['merge']({},_0x2be08f,_0x598707[_0x458a('0x42')]);return db[_0x458a('0x30')][_0x458a('0x49')](_0x2be08f)[_0x458a('0x25')](handleEntityNotFound(_0x124f64,null))[_0x458a('0x25')](respondWithResult(_0x124f64,null))[_0x458a('0x46')](handleError(_0x124f64,null));};exports[_0x458a('0x4a')]=function(_0x30cdaf,_0xb22232){return db[_0x458a('0x30')][_0x458a('0x4a')](_0x30cdaf[_0x458a('0x4b')],{})[_0x458a('0x25')](function(_0x1b0c11){var _0x1ddc39=_0x30cdaf[_0x458a('0x4c')]['get']({'plain':!![]});if(!_0x1ddc39)throw new Error(_0x458a('0x4d'));if(_0x1ddc39[_0x458a('0x4e')]===_0x458a('0x4c')){var _0x396bb3=_0x1b0c11[_0x458a('0x27')]({'plain':!![]});var _0x5630cf='Voicemails';return db['UserProfileSection'][_0x458a('0x49')]({'where':{'name':_0x5630cf,'userProfileId':_0x1ddc39['userProfileId']},'raw':!![]})[_0x458a('0x25')](function(_0x58946){if(_0x58946&&_0x58946[_0x458a('0x4f')]===0x0){return db[_0x458a('0x29')][_0x458a('0x4a')]({'name':_0x396bb3['name'],'resourceId':_0x396bb3['id'],'type':_0x58946['name'],'sectionId':_0x58946['id']},{})[_0x458a('0x25')](function(){return _0x1b0c11;});}else{return _0x1b0c11;}})[_0x458a('0x46')](function(_0x2587a1){logger[_0x458a('0x2a')](_0x458a('0x50'),_0x2587a1);throw _0x2587a1;});}return _0x1b0c11;})['then'](respondWithResult(_0xb22232,0xc9))[_0x458a('0x46')](handleError(_0xb22232,null));};exports['update']=function(_0xa51e28,_0x5b428c){if(_0xa51e28[_0x458a('0x4b')]['id']){delete _0xa51e28['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0xa51e28[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x5b428c,null))['then'](saveUpdates(_0xa51e28[_0x458a('0x4b')],null))[_0x458a('0x25')](respondWithResult(_0x5b428c,null))[_0x458a('0x46')](handleError(_0x5b428c,null));};exports['destroy']=function(_0x2c1230,_0x212de5){return db[_0x458a('0x30')][_0x458a('0x49')]({'where':{'id':_0x2c1230[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x212de5,null))['then'](removeEntity(_0x212de5,null))[_0x458a('0x46')](handleError(_0x212de5,null));};exports[_0x458a('0x51')]=function(_0x45325f,_0x39e5b5,_0x3ab86a){return db[_0x458a('0x30')][_0x458a('0x52')]({'where':{'id':_0x45325f[_0x458a('0x47')]['id']}})['then'](handleEntityNotFound(_0x39e5b5,null))[_0x458a('0x25')](function(_0x4abe93){var _0x1f93ad;var _0x2921ba={},_0x222aa4={};_0x222aa4[_0x458a('0x33')]=_['keys'](db['VoiceMailMessage'][_0x458a('0x48')]);_0x222aa4[_0x458a('0x34')]=_[_0x458a('0x35')](_0x45325f[_0x458a('0x34')]);_0x222aa4[_0x458a('0x36')]=_[_0x458a('0x37')](_0x222aa4['model'],_0x222aa4[_0x458a('0x34')]);_0x2921ba[_0x458a('0x38')]=_['intersection'](_0x222aa4[_0x458a('0x33')],qs['fields'](_0x45325f[_0x458a('0x34')][_0x458a('0x39')]));_0x2921ba[_0x458a('0x38')]=_0x2921ba[_0x458a('0x38')][_0x458a('0x3a')]?_0x2921ba[_0x458a('0x38')]:_0x222aa4[_0x458a('0x33')];if(!_0x45325f[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x2921ba[_0x458a('0x1e')]=qs['limit'](_0x45325f[_0x458a('0x34')][_0x458a('0x1e')]);_0x2921ba['offset']=qs[_0x458a('0x20')](_0x45325f[_0x458a('0x34')]['offset']);}_0x2921ba[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x45325f['query'][_0x458a('0x3d')]);_0x2921ba[_0x458a('0x3e')]=qs[_0x458a('0x36')](_[_0x458a('0x53')](_0x45325f[_0x458a('0x34')],_0x222aa4[_0x458a('0x36')]));if(_0x45325f[_0x458a('0x34')][_0x458a('0x3f')]){_0x2921ba['where']=_[_0x458a('0x40')](_0x2921ba[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x2921ba[_0x458a('0x38')],function(_0x250238){var _0x2930ae={};_0x2930ae[_0x250238]={'$like':'%'+_0x45325f[_0x458a('0x34')][_0x458a('0x3f')]+'%'};return _0x2930ae;})});}_0x2921ba[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x2921ba['where'],{'mailboxuser':_0x4abe93[_0x458a('0x54')]});_0x2921ba=_['merge']({},_0x2921ba,_0x45325f[_0x458a('0x42')]);return db[_0x458a('0x55')][_0x458a('0x56')](_0x2921ba)[_0x458a('0x25')](respondWithFilteredResult(_0x39e5b5,_0x2921ba));})[_0x458a('0x46')](handleError(_0x39e5b5,null));}; \ No newline at end of file +var _0x1339=['../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','offset','Content-Range','then','destroy','get','Voicemails','UserProfileResource','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VoiceMail','count','includeAll','include','findAll','catch','show','params','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','pick','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1339,0x1ed));var _0x9133=function(_0x462e9b,_0xb57d66){_0x462e9b=_0x462e9b-0x0;var _0x5de8b8=_0x1339[_0x462e9b];return _0x5de8b8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9133('0x0'));var jsonpatch=require(_0x9133('0x1'));var rp=require(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require(_0x9133('0x4'));var Mustache=require(_0x9133('0x5'));var util=require(_0x9133('0x6'));var path=require(_0x9133('0x7'));var sox=require('sox');var csv=require(_0x9133('0x8'));var ejs=require(_0x9133('0x9'));var fs=require('fs');var fs_extra=require(_0x9133('0xa'));var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x8'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var licenseUtil=require(_0x9133('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb64550,_0x7cc59e){_0x7cc59e=_0x7cc59e||0xcc;return function(_0x4bbfdc){if(_0x4bbfdc){return _0xb64550['sendStatus'](_0x7cc59e);}return _0xb64550[_0x9133('0x1a')](_0x7cc59e)['end']();};}function respondWithResult(_0x22132a,_0x439e1a){_0x439e1a=_0x439e1a||0xc8;return function(_0x17dfd1){if(_0x17dfd1){return _0x22132a[_0x9133('0x1a')](_0x439e1a)[_0x9133('0x1b')](_0x17dfd1);}};}function respondWithFilteredResult(_0x4327b3,_0x49cc5d){return function(_0x13f8fc){if(_0x13f8fc){var _0x1e23ce=typeof _0x49cc5d['offset']===_0x9133('0x1c')&&typeof _0x49cc5d[_0x9133('0x1d')]===_0x9133('0x1c');var _0x427663=_0x13f8fc['count'];var _0x1f3484=_0x1e23ce?0x0:_0x49cc5d['offset'];var _0x3c48ef=_0x1e23ce?_0x13f8fc['count']:_0x49cc5d[_0x9133('0x1e')]+_0x49cc5d[_0x9133('0x1d')];var _0x5e8620;if(_0x3c48ef>=_0x427663){_0x3c48ef=_0x427663;_0x5e8620=0xc8;}else{_0x5e8620=0xce;}_0x4327b3[_0x9133('0x1a')](_0x5e8620);return _0x4327b3['set'](_0x9133('0x1f'),_0x1f3484+'-'+_0x3c48ef+'/'+_0x427663)['json'](_0x13f8fc);}return null;};}function patchUpdates(_0x5e4f0c){return function(_0x2f7354){try{jsonpatch['apply'](_0x2f7354,_0x5e4f0c,!![]);}catch(_0x12c2d4){return BPromise['reject'](_0x12c2d4);}return _0x2f7354['save']();};}function saveUpdates(_0x4c846e,_0x2e99a1){return function(_0x2dcfb8){if(_0x2dcfb8){return _0x2dcfb8['update'](_0x4c846e)[_0x9133('0x20')](function(_0x3f5d0e){return _0x3f5d0e;});}return null;};}function removeEntity(_0xff08d5,_0x26190c){return function(_0x4f26e8){if(_0x4f26e8){return _0x4f26e8[_0x9133('0x21')]()['then'](function(){var _0x187e32=_0x4f26e8[_0x9133('0x22')]({'plain':!![]});var _0x3f278d=_0x9133('0x23');return db[_0x9133('0x24')][_0x9133('0x21')]({'where':{'type':_0x3f278d,'resourceId':_0x187e32['id']}})[_0x9133('0x20')](function(){return _0x4f26e8;});})[_0x9133('0x20')](function(){_0xff08d5[_0x9133('0x1a')](0xcc)[_0x9133('0x25')]();});}};}function handleEntityNotFound(_0x51de62,_0x517e7b){return function(_0x477bf1){if(!_0x477bf1){_0x51de62[_0x9133('0x26')](0x194);}return _0x477bf1;};}function handleError(_0x428e18,_0x348486){_0x348486=_0x348486||0x1f4;return function(_0x4de894){logger['error'](_0x4de894[_0x9133('0x27')]);if(_0x4de894[_0x9133('0x28')]){delete _0x4de894[_0x9133('0x28')];}_0x428e18[_0x9133('0x1a')](_0x348486)[_0x9133('0x29')](_0x4de894);};}exports[_0x9133('0x2a')]=function(_0x48c713,_0x58afe0){var _0x5a27c1={},_0x1ad222={},_0x4a4a8e={'count':0x0,'rows':[]};var _0x43b5f3=_[_0x9133('0x2b')](db['VoiceMail'][_0x9133('0x2c')],function(_0x5dd90b){return{'name':_0x5dd90b[_0x9133('0x2d')],'type':_0x5dd90b[_0x9133('0x2e')][_0x9133('0x2f')]};});_0x1ad222['model']=_[_0x9133('0x2b')](_0x43b5f3,_0x9133('0x28'));_0x1ad222[_0x9133('0x30')]=_['keys'](_0x48c713[_0x9133('0x30')]);_0x1ad222[_0x9133('0x31')]=_[_0x9133('0x32')](_0x1ad222['model'],_0x1ad222[_0x9133('0x30')]);_0x5a27c1[_0x9133('0x33')]=_[_0x9133('0x32')](_0x1ad222[_0x9133('0x34')],qs['fields'](_0x48c713[_0x9133('0x30')][_0x9133('0x35')]));_0x5a27c1['attributes']=_0x5a27c1[_0x9133('0x33')][_0x9133('0x36')]?_0x5a27c1[_0x9133('0x33')]:_0x1ad222[_0x9133('0x34')];if(!_0x48c713[_0x9133('0x30')][_0x9133('0x37')](_0x9133('0x38'))){_0x5a27c1[_0x9133('0x1d')]=qs[_0x9133('0x1d')](_0x48c713[_0x9133('0x30')][_0x9133('0x1d')]);_0x5a27c1['offset']=qs[_0x9133('0x1e')](_0x48c713[_0x9133('0x30')]['offset']);}_0x5a27c1[_0x9133('0x39')]=qs[_0x9133('0x3a')](_0x48c713[_0x9133('0x30')][_0x9133('0x3a')]);_0x5a27c1[_0x9133('0x3b')]=qs[_0x9133('0x31')](_['pick'](_0x48c713['query'],_0x1ad222[_0x9133('0x31')]),_0x43b5f3);if(_0x48c713[_0x9133('0x30')][_0x9133('0x3c')]){_0x5a27c1[_0x9133('0x3b')]=_[_0x9133('0x3d')](_0x5a27c1[_0x9133('0x3b')],{'$or':_[_0x9133('0x2b')](_0x43b5f3,function(_0x2ee83e){if(_0x2ee83e[_0x9133('0x2e')]!=='VIRTUAL'){var _0xafd8f9={};_0xafd8f9[_0x2ee83e[_0x9133('0x28')]]={'$like':'%'+_0x48c713[_0x9133('0x30')][_0x9133('0x3c')]+'%'};return _0xafd8f9;}})});}_0x5a27c1=_[_0x9133('0x3d')]({},_0x5a27c1,_0x48c713['options']);var _0x3c691e={'where':_0x5a27c1[_0x9133('0x3b')]};return db[_0x9133('0x3e')][_0x9133('0x3f')](_0x3c691e)['then'](function(_0x146734){_0x4a4a8e[_0x9133('0x3f')]=_0x146734;if(_0x48c713[_0x9133('0x30')][_0x9133('0x40')]){_0x5a27c1[_0x9133('0x41')]=[{'all':!![]}];}return db[_0x9133('0x3e')][_0x9133('0x42')](_0x5a27c1);})['then'](function(_0x7f6cd9){_0x4a4a8e['rows']=_0x7f6cd9;return _0x4a4a8e;})['then'](respondWithFilteredResult(_0x58afe0,_0x5a27c1))[_0x9133('0x43')](handleError(_0x58afe0,null));};exports[_0x9133('0x44')]=function(_0x46156d,_0x264df4){var _0xdd485f={'raw':!![],'where':{'id':_0x46156d[_0x9133('0x45')]['id']}},_0x2d2bf7={};_0x2d2bf7[_0x9133('0x34')]=_[_0x9133('0x46')](db['VoiceMail'][_0x9133('0x2c')]);_0x2d2bf7[_0x9133('0x30')]=_[_0x9133('0x46')](_0x46156d['query']);_0x2d2bf7['filters']=_[_0x9133('0x32')](_0x2d2bf7[_0x9133('0x34')],_0x2d2bf7['query']);_0xdd485f[_0x9133('0x33')]=_[_0x9133('0x32')](_0x2d2bf7[_0x9133('0x34')],qs[_0x9133('0x35')](_0x46156d[_0x9133('0x30')]['fields']));_0xdd485f[_0x9133('0x33')]=_0xdd485f[_0x9133('0x33')][_0x9133('0x36')]?_0xdd485f['attributes']:_0x2d2bf7[_0x9133('0x34')];if(_0x46156d[_0x9133('0x30')]['includeAll']){_0xdd485f['include']=[{'all':!![]}];}_0xdd485f=_[_0x9133('0x3d')]({},_0xdd485f,_0x46156d[_0x9133('0x47')]);return db[_0x9133('0x3e')][_0x9133('0x48')](_0xdd485f)[_0x9133('0x20')](handleEntityNotFound(_0x264df4,null))[_0x9133('0x20')](respondWithResult(_0x264df4,null))[_0x9133('0x43')](handleError(_0x264df4,null));};exports[_0x9133('0x49')]=function(_0x23f134,_0xf07fbb){return db[_0x9133('0x3e')][_0x9133('0x49')](_0x23f134['body'],{})['then'](function(_0xf2e098){var _0x4dc2f3=_0x23f134[_0x9133('0x4a')][_0x9133('0x22')]({'plain':!![]});if(!_0x4dc2f3)throw new Error(_0x9133('0x4b'));if(_0x4dc2f3[_0x9133('0x4c')]==='user'){var _0x2a3848=_0xf2e098[_0x9133('0x22')]({'plain':!![]});var _0x799772='Voicemails';return db[_0x9133('0x4d')][_0x9133('0x48')]({'where':{'name':_0x799772,'userProfileId':_0x4dc2f3[_0x9133('0x4e')]},'raw':!![]})['then'](function(_0x14c825){if(_0x14c825&&_0x14c825['autoAssociation']===0x0){return db[_0x9133('0x24')][_0x9133('0x49')]({'name':_0x2a3848[_0x9133('0x28')],'resourceId':_0x2a3848['id'],'type':_0x14c825[_0x9133('0x28')],'sectionId':_0x14c825['id']},{})['then'](function(){return _0xf2e098;});}else{return _0xf2e098;}})['catch'](function(_0x2f09f6){logger[_0x9133('0x4f')](_0x9133('0x50'),_0x2f09f6);throw _0x2f09f6;});}return _0xf2e098;})[_0x9133('0x20')](respondWithResult(_0xf07fbb,0xc9))[_0x9133('0x43')](handleError(_0xf07fbb,null));};exports['update']=function(_0x554bb9,_0x33599b){if(_0x554bb9[_0x9133('0x51')]['id']){delete _0x554bb9['body']['id'];}return db[_0x9133('0x3e')][_0x9133('0x48')]({'where':{'id':_0x554bb9['params']['id']}})['then'](handleEntityNotFound(_0x33599b,null))['then'](saveUpdates(_0x554bb9[_0x9133('0x51')],null))['then'](respondWithResult(_0x33599b,null))[_0x9133('0x43')](handleError(_0x33599b,null));};exports[_0x9133('0x21')]=function(_0x439258,_0x3d6daa){return db['VoiceMail'][_0x9133('0x48')]({'where':{'id':_0x439258['params']['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x3d6daa,null))[_0x9133('0x20')](removeEntity(_0x3d6daa,null))[_0x9133('0x43')](handleError(_0x3d6daa,null));};exports[_0x9133('0x52')]=function(_0x3b9927,_0x3534bf,_0x56861c){return db['VoiceMail']['findOne']({'where':{'id':_0x3b9927[_0x9133('0x45')]['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x3534bf,null))[_0x9133('0x20')](function(_0x54a330){var _0x3f4cd7;var _0x1f6684={},_0x415d55={};_0x415d55[_0x9133('0x34')]=_[_0x9133('0x46')](db[_0x9133('0x53')][_0x9133('0x2c')]);_0x415d55[_0x9133('0x30')]=_['keys'](_0x3b9927[_0x9133('0x30')]);_0x415d55['filters']=_[_0x9133('0x32')](_0x415d55['model'],_0x415d55[_0x9133('0x30')]);_0x1f6684[_0x9133('0x33')]=_['intersection'](_0x415d55['model'],qs[_0x9133('0x35')](_0x3b9927[_0x9133('0x30')][_0x9133('0x35')]));_0x1f6684[_0x9133('0x33')]=_0x1f6684[_0x9133('0x33')][_0x9133('0x36')]?_0x1f6684[_0x9133('0x33')]:_0x415d55[_0x9133('0x34')];if(!_0x3b9927[_0x9133('0x30')][_0x9133('0x37')](_0x9133('0x38'))){_0x1f6684['limit']=qs[_0x9133('0x1d')](_0x3b9927['query'][_0x9133('0x1d')]);_0x1f6684[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x3b9927[_0x9133('0x30')][_0x9133('0x1e')]);}_0x1f6684['order']=qs[_0x9133('0x3a')](_0x3b9927[_0x9133('0x30')][_0x9133('0x3a')]);_0x1f6684[_0x9133('0x3b')]=qs['filters'](_[_0x9133('0x54')](_0x3b9927[_0x9133('0x30')],_0x415d55[_0x9133('0x31')]));if(_0x3b9927[_0x9133('0x30')]['filter']){_0x1f6684['where']=_[_0x9133('0x3d')](_0x1f6684[_0x9133('0x3b')],{'$or':_[_0x9133('0x2b')](_0x1f6684[_0x9133('0x33')],function(_0x28cc46){var _0x2cfaf8={};_0x2cfaf8[_0x28cc46]={'$like':'%'+_0x3b9927['query'][_0x9133('0x3c')]+'%'};return _0x2cfaf8;})});}_0x1f6684[_0x9133('0x3b')]=_[_0x9133('0x3d')](_0x1f6684[_0x9133('0x3b')],{'mailboxuser':_0x54a330['mailbox']});_0x1f6684=_[_0x9133('0x3d')]({},_0x1f6684,_0x3b9927['options']);return db[_0x9133('0x53')][_0x9133('0x55')](_0x1f6684)[_0x9133('0x20')](respondWithFilteredResult(_0x3534bf,_0x1f6684));})[_0x9133('0x43')](handleError(_0x3534bf,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index a358ae8..ca66d61 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 _0x8bbf=['path','rimraf','exports','context','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x214a25,_0x15071d){var _0x405988=function(_0x5c6fc1){while(--_0x5c6fc1){_0x214a25['push'](_0x214a25['shift']());}};_0x405988(++_0x15071d);}(_0x8bbf,0xe0));var _0xf8bb=function(_0x638432,_0x301655){_0x638432=_0x638432-0x0;var _0x24dc70=_0x8bbf[_0x638432];return _0x24dc70;};'use strict';var _=require(_0xf8bb('0x0'));var util=require(_0xf8bb('0x1'));var logger=require(_0xf8bb('0x2'))(_0xf8bb('0x3'));var moment=require(_0xf8bb('0x4'));var BPromise=require('bluebird');var rp=require(_0xf8bb('0x5'));var fs=require('fs');var path=require(_0xf8bb('0x6'));var rimraf=require(_0xf8bb('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0xf8bb('0x8')]=function(_0x387ced,_0x29d592){return _0x387ced['define']('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0xf8bb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3dee=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox','context'];(function(_0xc0b62d,_0x26f687){var _0x502ca0=function(_0x178608){while(--_0x178608){_0xc0b62d['push'](_0xc0b62d['shift']());}};_0x502ca0(++_0x26f687);}(_0x3dee,0x1ed));var _0xe3de=function(_0x1617d2,_0x2469ce){_0x1617d2=_0x1617d2-0x0;var _0x3743a5=_0x3dee[_0x1617d2];return _0x3743a5;};'use strict';var _=require(_0xe3de('0x0'));var util=require(_0xe3de('0x1'));var logger=require(_0xe3de('0x2'))(_0xe3de('0x3'));var moment=require(_0xe3de('0x4'));var BPromise=require(_0xe3de('0x5'));var rp=require(_0xe3de('0x6'));var fs=require('fs');var path=require(_0xe3de('0x7'));var rimraf=require(_0xe3de('0x8'));var config=require(_0xe3de('0x9'));var attributes=require(_0xe3de('0xa'));module[_0xe3de('0xb')]=function(_0x2b274c,_0x4a2466){return _0x2b274c[_0xe3de('0xc')]('VoiceMail',attributes,{'tableName':_0xe3de('0xd'),'paranoid':![],'indexes':[{'name':_0xe3de('0xe'),'fields':[_0xe3de('0xf'),_0xe3de('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 0fbee4e..678dee6 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 _0x053d=['code','message','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error'];(function(_0x12a73c,_0x23549e){var _0x3f67ad=function(_0x22f485){while(--_0x22f485){_0x12a73c['push'](_0x12a73c['shift']());}};_0x3f67ad(++_0x23549e);}(_0x053d,0x1e6));var _0xd053=function(_0xe7b203,_0x717f0c){_0xe7b203=_0xe7b203-0x0;var _0x49939d=_0x053d[_0xe7b203];return _0x49939d;};'use strict';var _=require(_0xd053('0x0'));var util=require(_0xd053('0x1'));var moment=require(_0xd053('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd053('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd053('0x4'));var logger=require(_0xd053('0x5'))(_0xd053('0x6'));var config=require(_0xd053('0x7'));var jayson=require(_0xd053('0x8'));var client=jayson[_0xd053('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d37cd,_0x3db8d4,_0xbb17e){return new BPromise(function(_0xe1dcc7,_0x986641){return client[_0xd053('0xa')](_0x4d37cd,_0xbb17e)[_0xd053('0xb')](function(_0x318c11){logger[_0xd053('0xc')](_0xd053('0xd'),_0x3db8d4,_0xd053('0xe'));logger[_0xd053('0xf')](_0xd053('0x10'),_0x3db8d4,'request\x20sent',JSON['stringify'](_0x318c11));if(_0x318c11[_0xd053('0x11')]){if(_0x318c11[_0xd053('0x11')][_0xd053('0x12')]===0x1f4){logger['error'](_0xd053('0xd'),_0x3db8d4,_0x318c11[_0xd053('0x11')][_0xd053('0x13')]);return _0x986641(_0x318c11['error'][_0xd053('0x13')]);}logger[_0xd053('0x11')](_0xd053('0xd'),_0x3db8d4,_0x318c11[_0xd053('0x11')][_0xd053('0x13')]);return _0xe1dcc7(_0x318c11[_0xd053('0x11')][_0xd053('0x13')]);}else{logger[_0xd053('0xc')](_0xd053('0xd'),_0x3db8d4,_0xd053('0xe'));_0xe1dcc7(_0x318c11['result']['message']);}})[_0xd053('0x14')](function(_0x29eb0d){logger[_0xd053('0x11')](_0xd053('0xd'),_0x3db8d4,_0x29eb0d);_0x986641(_0x29eb0d);});});} \ No newline at end of file +var _0x9474=['request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceMail,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9474,0x125));var _0x4947=function(_0x1301aa,_0x4da5c4){_0x1301aa=_0x1301aa-0x0;var _0x5146a1=_0x9474[_0x1301aa];return _0x5146a1;};'use strict';var _=require(_0x4947('0x0'));var util=require('util');var moment=require(_0x4947('0x1'));var BPromise=require(_0x4947('0x2'));var rs=require(_0x4947('0x3'));var fs=require('fs');var Redis=require(_0x4947('0x4'));var db=require(_0x4947('0x5'))['db'];var utils=require(_0x4947('0x6'));var logger=require(_0x4947('0x7'))(_0x4947('0x8'));var config=require(_0x4947('0x9'));var jayson=require(_0x4947('0xa'));var client=jayson[_0x4947('0xb')][_0x4947('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3169d7,_0x34eb74,_0x2637db){return new BPromise(function(_0x2df4f1,_0x183783){return client['request'](_0x3169d7,_0x2637db)['then'](function(_0x3df62a){logger[_0x4947('0xd')](_0x4947('0xe'),_0x34eb74,_0x4947('0xf'));logger['debug'](_0x4947('0x10'),_0x34eb74,'request\x20sent',JSON[_0x4947('0x11')](_0x3df62a));if(_0x3df62a[_0x4947('0x12')]){if(_0x3df62a[_0x4947('0x12')][_0x4947('0x13')]===0x1f4){logger['error'](_0x4947('0xe'),_0x34eb74,_0x3df62a[_0x4947('0x12')][_0x4947('0x14')]);return _0x183783(_0x3df62a[_0x4947('0x12')]['message']);}logger[_0x4947('0x12')](_0x4947('0xe'),_0x34eb74,_0x3df62a[_0x4947('0x12')]['message']);return _0x2df4f1(_0x3df62a['error'][_0x4947('0x14')]);}else{logger['info'](_0x4947('0xe'),_0x34eb74,_0x4947('0xf'));_0x2df4f1(_0x3df62a[_0x4947('0x15')][_0x4947('0x14')]);}})['catch'](function(_0x552733){logger[_0x4947('0x12')](_0x4947('0xe'),_0x34eb74,_0x552733);_0x183783(_0x552733);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index f6dcde9..0b88191 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 _0xeaa2=['connect-timeout','Router','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','download','post','create','put','destroy','util','path'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0xeaa2,0xee));var _0x2eaa=function(_0x291a25,_0x31ae01){_0x291a25=_0x291a25-0x0;var _0x380fab=_0xeaa2[_0x291a25];return _0x380fab;};'use strict';var multer=require('multer');var util=require(_0x2eaa('0x0'));var path=require(_0x2eaa('0x1'));var timeout=require(_0x2eaa('0x2'));var express=require('express');var router=express[_0x2eaa('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2eaa('0x4'));var controller=require(_0x2eaa('0x5'));router[_0x2eaa('0x6')]('/',auth[_0x2eaa('0x7')](),controller['index']);router[_0x2eaa('0x6')](_0x2eaa('0x8'),auth[_0x2eaa('0x7')](),controller[_0x2eaa('0x9')]);router[_0x2eaa('0x6')]('/:id/download',auth[_0x2eaa('0x7')](),controller[_0x2eaa('0xa')]);router[_0x2eaa('0xb')]('/',auth[_0x2eaa('0x7')](),controller[_0x2eaa('0xc')]);router[_0x2eaa('0xd')](_0x2eaa('0x8'),auth[_0x2eaa('0x7')](),controller['update']);router['delete'](_0x2eaa('0x8'),auth[_0x2eaa('0x7')](),controller[_0x2eaa('0xe')]);module['exports']=router; \ No newline at end of file +var _0x032b=['fs-extra','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','/:id/download','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2f5b72,_0x479d68){var _0x4e5c05=function(_0x344ba0){while(--_0x344ba0){_0x2f5b72['push'](_0x2f5b72['shift']());}};_0x4e5c05(++_0x479d68);}(_0x032b,0x11b));var _0xb032=function(_0x76bd2,_0x487abe){_0x76bd2=_0x76bd2-0x0;var _0x2e50f3=_0x032b[_0x76bd2];return _0x2e50f3;};'use strict';var multer=require(_0xb032('0x0'));var util=require(_0xb032('0x1'));var path=require(_0xb032('0x2'));var timeout=require(_0xb032('0x3'));var express=require(_0xb032('0x4'));var router=express[_0xb032('0x5')]();var fs_extra=require(_0xb032('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb032('0x7'));var config=require('../../config/environment');var controller=require(_0xb032('0x8'));router[_0xb032('0x9')]('/',auth[_0xb032('0xa')](),controller['index']);router['get']('/:id',auth[_0xb032('0xa')](),controller['show']);router['get'](_0xb032('0xb'),auth[_0xb032('0xa')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xb032('0xc')]);router[_0xb032('0xd')]('/:id',auth[_0xb032('0xa')](),controller['update']);router[_0xb032('0xe')]('/:id',auth[_0xb032('0xa')](),controller[_0xb032('0xf')]);module[_0xb032('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 21dada2..3bbd219 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 _0x4fe7=['sequelize','exports','VIRTUAL','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fe7,0xc8));var _0x74fe=function(_0x51d703,_0x2606bb){_0x51d703=_0x51d703-0x0;var _0x14a194=_0x4fe7[_0x51d703];return _0x14a194;};'use strict';var Sequelize=require(_0x74fe('0x0'));module[_0x74fe('0x1')]={'name':{'type':Sequelize[_0x74fe('0x2')],'get':function(_0x5b7404){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x74fe('0x4')](_0x74fe('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'stamp':{'type':_0x74fe('0x6'),'defaultValue':Sequelize['literal'](_0x74fe('0x7'))}}; \ No newline at end of file +var _0x7f9c=['exports','VIRTUAL','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x38fb3a,_0x555204){var _0x49727b=function(_0x1d5535){while(--_0x1d5535){_0x38fb3a['push'](_0x38fb3a['shift']());}};_0x49727b(++_0x555204);}(_0x7f9c,0x17a));var _0xc7f9=function(_0x4f5b7c,_0x2d5c8b){_0x4f5b7c=_0x4f5b7c-0x0;var _0x4ce2bb=_0x7f9c[_0x4f5b7c];return _0x4ce2bb;};'use strict';var Sequelize=require('sequelize');module[_0xc7f9('0x0')]={'name':{'type':Sequelize[_0xc7f9('0x1')],'get':function(_0x41e9a6){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xc7f9('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc7f9('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xc7f9('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xc7f9('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xc7f9('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc7f9('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xc7f9('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xc7f9('0x4')](_0xc7f9('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xc7f9('0x6'),'defaultValue':Sequelize[_0xc7f9('0x7')](_0xc7f9('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 84ef125..522a80c 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 _0x0c25=['Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','VoiceMailMessage','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','body','catch','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x0c25,0x124));var _0x50c2=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0x0c25[_0x384231];return _0x2480bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x50c2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50c2('0x1'));var rp=require(_0x50c2('0x2'));var moment=require(_0x50c2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x50c2('0x4'));var sox=require(_0x50c2('0x5'));var csv=require(_0x50c2('0x6'));var ejs=require(_0x50c2('0x7'));var fs=require('fs');var fs_extra=require(_0x50c2('0x8'));var _=require(_0x50c2('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x50c2('0xa'));var deskjs=require(_0x50c2('0xb'));var toCsv=require('to-csv');var querystring=require(_0x50c2('0xc'));var Papa=require('papaparse');var Redis=require(_0x50c2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x50c2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x50c2('0xf'));var logger=require(_0x50c2('0x10'))('api');var utils=require(_0x50c2('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50c2('0x12'))['db'];function respondWithStatusCode(_0x26dfee,_0x7c8928){_0x7c8928=_0x7c8928||0xcc;return function(_0x5bebdd){if(_0x5bebdd){return _0x26dfee[_0x50c2('0x13')](_0x7c8928);}return _0x26dfee[_0x50c2('0x14')](_0x7c8928)[_0x50c2('0x15')]();};}function respondWithResult(_0x340185,_0x512dbb){_0x512dbb=_0x512dbb||0xc8;return function(_0x547512){if(_0x547512){return _0x340185['status'](_0x512dbb)[_0x50c2('0x16')](_0x547512);}};}function respondWithFilteredResult(_0x23787f,_0x33659f){return function(_0x593937){if(_0x593937){var _0x288328=typeof _0x33659f[_0x50c2('0x17')]===_0x50c2('0x18')&&typeof _0x33659f[_0x50c2('0x19')]===_0x50c2('0x18');var _0x4a26b2=_0x593937['count'];var _0x6a92cd=_0x288328?0x0:_0x33659f['offset'];var _0x2b6c49=_0x288328?_0x593937[_0x50c2('0x1a')]:_0x33659f[_0x50c2('0x17')]+_0x33659f['limit'];var _0x2dde96;if(_0x2b6c49>=_0x4a26b2){_0x2b6c49=_0x4a26b2;_0x2dde96=0xc8;}else{_0x2dde96=0xce;}_0x23787f[_0x50c2('0x14')](_0x2dde96);return _0x23787f[_0x50c2('0x1b')](_0x50c2('0x1c'),_0x6a92cd+'-'+_0x2b6c49+'/'+_0x4a26b2)[_0x50c2('0x16')](_0x593937);}return null;};}function patchUpdates(_0x156d49){return function(_0x85b7a7){try{jsonpatch[_0x50c2('0x1d')](_0x85b7a7,_0x156d49,!![]);}catch(_0xca088b){return BPromise[_0x50c2('0x1e')](_0xca088b);}return _0x85b7a7[_0x50c2('0x1f')]();};}function saveUpdates(_0x41ea17,_0x52bceb){return function(_0x1b2688){if(_0x1b2688){return _0x1b2688[_0x50c2('0x20')](_0x41ea17)['then'](function(_0x167533){return _0x167533;});}return null;};}function removeEntity(_0x2d6b9d,_0x43a5f7){return function(_0x341238){if(_0x341238){return _0x341238[_0x50c2('0x21')]()[_0x50c2('0x22')](function(){_0x2d6b9d[_0x50c2('0x14')](0xcc)[_0x50c2('0x15')]();});}};}function handleEntityNotFound(_0x1ba0ed,_0x19f1bd){return function(_0x54a52b){if(!_0x54a52b){_0x1ba0ed[_0x50c2('0x13')](0x194);}return _0x54a52b;};}function handleError(_0x197697,_0x8151b6){_0x8151b6=_0x8151b6||0x1f4;return function(_0x32b05c){logger['error'](_0x32b05c[_0x50c2('0x23')]);if(_0x32b05c[_0x50c2('0x24')]){delete _0x32b05c[_0x50c2('0x24')];}_0x197697[_0x50c2('0x14')](_0x8151b6)[_0x50c2('0x25')](_0x32b05c);};}exports[_0x50c2('0x26')]=function(_0xa6246a,_0x5630b4){var _0x102550={},_0x2c8b97={},_0x3d213f={'count':0x0,'rows':[]};var _0x19b3c7=_[_0x50c2('0x27')](db[_0x50c2('0x28')]['rawAttributes'],function(_0x169342){return{'name':_0x169342[_0x50c2('0x29')],'type':_0x169342[_0x50c2('0x2a')][_0x50c2('0x2b')]};});_0x2c8b97[_0x50c2('0x2c')]=_[_0x50c2('0x2d')](_['map'](_0x19b3c7,_0x50c2('0x24')),['name']);_0x2c8b97[_0x50c2('0x2e')]=_[_0x50c2('0x2f')](_0xa6246a[_0x50c2('0x2e')]);_0x2c8b97[_0x50c2('0x30')]=_[_0x50c2('0x31')](_0x2c8b97[_0x50c2('0x2c')],_0x2c8b97[_0x50c2('0x2e')]);_0x102550['attributes']=_[_0x50c2('0x31')](_0x2c8b97[_0x50c2('0x2c')],qs[_0x50c2('0x32')](_0xa6246a[_0x50c2('0x2e')][_0x50c2('0x32')]));_0x102550[_0x50c2('0x33')]=_0x102550[_0x50c2('0x33')][_0x50c2('0x34')]?_0x102550['attributes']:_0x2c8b97[_0x50c2('0x2c')];if(!_0xa6246a[_0x50c2('0x2e')]['hasOwnProperty'](_0x50c2('0x35'))){_0x102550[_0x50c2('0x19')]=qs[_0x50c2('0x19')](_0xa6246a[_0x50c2('0x2e')][_0x50c2('0x19')]);_0x102550[_0x50c2('0x17')]=qs[_0x50c2('0x17')](_0xa6246a[_0x50c2('0x2e')]['offset']);}_0x102550[_0x50c2('0x36')]=qs['sort'](_0xa6246a[_0x50c2('0x2e')][_0x50c2('0x37')]);_0x102550['where']=qs[_0x50c2('0x30')](_[_0x50c2('0x38')](_0xa6246a[_0x50c2('0x2e')],_0x2c8b97['filters']),_0x19b3c7);if(_0xa6246a[_0x50c2('0x2e')][_0x50c2('0x39')]){_0x102550[_0x50c2('0x3a')]=_[_0x50c2('0x3b')](_0x102550[_0x50c2('0x3a')],{'$or':_[_0x50c2('0x27')](_0x19b3c7,function(_0x157a28){if(_0x157a28[_0x50c2('0x2a')]!==_0x50c2('0x3c')){var _0x486866={};_0x486866[_0x157a28[_0x50c2('0x24')]]={'$like':'%'+_0xa6246a[_0x50c2('0x2e')][_0x50c2('0x39')]+'%'};return _0x486866;}})});}_0x102550=_[_0x50c2('0x3b')]({},_0x102550,_0xa6246a[_0x50c2('0x3d')]);var _0x2e7fae={'where':_0x102550['where']};return db[_0x50c2('0x28')]['count'](_0x2e7fae)[_0x50c2('0x22')](function(_0x84f7e1){_0x3d213f[_0x50c2('0x1a')]=_0x84f7e1;if(_0xa6246a[_0x50c2('0x2e')][_0x50c2('0x3e')]){_0x102550[_0x50c2('0x3f')]=[{'all':!![]}];}return db[_0x50c2('0x28')][_0x50c2('0x40')](_0x102550);})['then'](function(_0x4ef2be){_0x3d213f[_0x50c2('0x41')]=_0x4ef2be;return _0x3d213f;})[_0x50c2('0x22')](respondWithFilteredResult(_0x5630b4,_0x102550))['catch'](handleError(_0x5630b4,null));};exports['show']=function(_0x471a00,_0x33cb8c){var _0xaec00={'raw':!![],'where':{'id':_0x471a00[_0x50c2('0x42')]['id']}},_0x5f3929={};_0x5f3929[_0x50c2('0x2c')]=_[_0x50c2('0x2f')](db[_0x50c2('0x28')][_0x50c2('0x43')]);_0x5f3929[_0x50c2('0x2e')]=_[_0x50c2('0x2f')](_0x471a00[_0x50c2('0x2e')]);_0x5f3929[_0x50c2('0x30')]=_[_0x50c2('0x31')](_0x5f3929[_0x50c2('0x2c')],_0x5f3929[_0x50c2('0x2e')]);_0xaec00[_0x50c2('0x33')]=_['intersection'](_0x5f3929['model'],qs[_0x50c2('0x32')](_0x471a00['query'][_0x50c2('0x32')]));_0xaec00[_0x50c2('0x33')]=_0xaec00[_0x50c2('0x33')][_0x50c2('0x34')]?_0xaec00[_0x50c2('0x33')]:_0x5f3929[_0x50c2('0x2c')];if(_0x471a00[_0x50c2('0x2e')][_0x50c2('0x3e')]){_0xaec00[_0x50c2('0x3f')]=[{'all':!![]}];}_0xaec00=_['merge']({},_0xaec00,_0x471a00[_0x50c2('0x3d')]);return db[_0x50c2('0x28')][_0x50c2('0x44')](_0xaec00)[_0x50c2('0x22')](handleEntityNotFound(_0x33cb8c,null))[_0x50c2('0x22')](respondWithResult(_0x33cb8c,null))['catch'](handleError(_0x33cb8c,null));};exports['create']=function(_0x5acb63,_0x6e46bf){return db['VoiceMailMessage']['create'](_0x5acb63[_0x50c2('0x45')],{})['then'](respondWithResult(_0x6e46bf,0xc9))[_0x50c2('0x46')](handleError(_0x6e46bf,null));};exports[_0x50c2('0x20')]=function(_0x3b5813,_0x242ab0){if(_0x3b5813[_0x50c2('0x45')]['id']){delete _0x3b5813[_0x50c2('0x45')]['id'];}return db[_0x50c2('0x28')]['find']({'where':{'id':_0x3b5813[_0x50c2('0x42')]['id']}})['then'](handleEntityNotFound(_0x242ab0,null))[_0x50c2('0x22')](saveUpdates(_0x3b5813[_0x50c2('0x45')],null))[_0x50c2('0x22')](respondWithResult(_0x242ab0,null))[_0x50c2('0x46')](handleError(_0x242ab0,null));};exports[_0x50c2('0x21')]=function(_0x390e25,_0x4189d1){return db[_0x50c2('0x28')][_0x50c2('0x44')]({'where':{'id':_0x390e25[_0x50c2('0x42')]['id']}})[_0x50c2('0x22')](handleEntityNotFound(_0x4189d1,null))[_0x50c2('0x22')](removeEntity(_0x4189d1,null))[_0x50c2('0x46')](handleError(_0x4189d1,null));};exports[_0x50c2('0x47')]=function(_0x2111bc,_0x242e42,_0x1af7e8){return db[_0x50c2('0x28')][_0x50c2('0x44')]({'where':{'id':_0x2111bc['params']['id']},'attributes':['id',_0x50c2('0x48'),_0x50c2('0x49')]})[_0x50c2('0x22')](handleEntityNotFound(_0x242e42,null))[_0x50c2('0x22')](function(_0x28ce25){if(_0x28ce25){if(!_0x28ce25[_0x50c2('0x48')]){throw new db['Sequelize'][(_0x50c2('0x4a'))](_0x50c2('0x4b'));}var _0x34c7b9={'Content-Type':_0x50c2('0x4c'),'Content-Disposition':_0x50c2('0x4d')};if(_0x28ce25[_0x50c2('0x49')]){_0x34c7b9[_0x50c2('0x4e')]=_0x50c2('0x4f')+_0x28ce25['msg_id']+'.wav\x22';}_0x242e42[_0x50c2('0x1b')](_0x34c7b9);return _0x242e42[_0x50c2('0x25')](new Buffer(_0x28ce25[_0x50c2('0x48')]));}})[_0x50c2('0x46')](handleError(_0x242e42,null));}; \ No newline at end of file +var _0x3955=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','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','limit','undefined','count','apply','reject','save','update','destroy','then','error','name','send','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','VoiceMailMessage','findAll','rows','catch','show','params','rawAttributes','find','create','body','download','recording','msg_id','Sequelize','ValidationError','audio/wav','Content-Disposition','set'];(function(_0x2d0581,_0x39236c){var _0xe43ad1=function(_0x2d9fcb){while(--_0x2d9fcb){_0x2d0581['push'](_0x2d0581['shift']());}};_0xe43ad1(++_0x39236c);}(_0x3955,0xae));var _0x5395=function(_0x26dc64,_0x4ff8c7){_0x26dc64=_0x26dc64-0x0;var _0x3dc951=_0x3955[_0x26dc64];return _0x3dc951;};'use strict';var emlformat=require(_0x5395('0x0'));var rimraf=require(_0x5395('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5395('0x2'));var rp=require(_0x5395('0x3'));var moment=require(_0x5395('0x4'));var BPromise=require(_0x5395('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5395('0x6'));var sox=require(_0x5395('0x7'));var csv=require('to-csv');var ejs=require(_0x5395('0x8'));var fs=require('fs');var fs_extra=require(_0x5395('0x9'));var _=require(_0x5395('0xa'));var squel=require(_0x5395('0xb'));var crypto=require(_0x5395('0xc'));var jsforce=require(_0x5395('0xd'));var deskjs=require(_0x5395('0xe'));var toCsv=require(_0x5395('0xf'));var querystring=require(_0x5395('0x10'));var Papa=require(_0x5395('0x11'));var Redis=require(_0x5395('0x12'));var authService=require(_0x5395('0x13'));var qs=require(_0x5395('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5395('0x15'));var logger=require(_0x5395('0x16'))('api');var utils=require(_0x5395('0x17'));var config=require(_0x5395('0x18'));var licenseUtil=require(_0x5395('0x19'));var db=require(_0x5395('0x1a'))['db'];function respondWithStatusCode(_0x4373ad,_0x45ac33){_0x45ac33=_0x45ac33||0xcc;return function(_0x56af53){if(_0x56af53){return _0x4373ad[_0x5395('0x1b')](_0x45ac33);}return _0x4373ad[_0x5395('0x1c')](_0x45ac33)[_0x5395('0x1d')]();};}function respondWithResult(_0x210241,_0x5b15e1){_0x5b15e1=_0x5b15e1||0xc8;return function(_0x4daa0b){if(_0x4daa0b){return _0x210241[_0x5395('0x1c')](_0x5b15e1)[_0x5395('0x1e')](_0x4daa0b);}};}function respondWithFilteredResult(_0x56041a,_0x538028){return function(_0x18ed03){if(_0x18ed03){var _0x36171a=typeof _0x538028['offset']==='undefined'&&typeof _0x538028[_0x5395('0x1f')]===_0x5395('0x20');var _0x8526eb=_0x18ed03['count'];var _0x2381ea=_0x36171a?0x0:_0x538028['offset'];var _0x312e86=_0x36171a?_0x18ed03[_0x5395('0x21')]:_0x538028['offset']+_0x538028[_0x5395('0x1f')];var _0x31c16;if(_0x312e86>=_0x8526eb){_0x312e86=_0x8526eb;_0x31c16=0xc8;}else{_0x31c16=0xce;}_0x56041a['status'](_0x31c16);return _0x56041a['set']('Content-Range',_0x2381ea+'-'+_0x312e86+'/'+_0x8526eb)[_0x5395('0x1e')](_0x18ed03);}return null;};}function patchUpdates(_0xb143a5){return function(_0x61fafa){try{jsonpatch[_0x5395('0x22')](_0x61fafa,_0xb143a5,!![]);}catch(_0x1876fc){return BPromise[_0x5395('0x23')](_0x1876fc);}return _0x61fafa[_0x5395('0x24')]();};}function saveUpdates(_0x44ad4d,_0x2a532a){return function(_0x48339e){if(_0x48339e){return _0x48339e[_0x5395('0x25')](_0x44ad4d)['then'](function(_0x49d6fe){return _0x49d6fe;});}return null;};}function removeEntity(_0x312b3e,_0x403398){return function(_0x3949bb){if(_0x3949bb){return _0x3949bb[_0x5395('0x26')]()[_0x5395('0x27')](function(){_0x312b3e[_0x5395('0x1c')](0xcc)[_0x5395('0x1d')]();});}};}function handleEntityNotFound(_0x561e67,_0x4964bf){return function(_0x412859){if(!_0x412859){_0x561e67[_0x5395('0x1b')](0x194);}return _0x412859;};}function handleError(_0x17427e,_0x1dd0e4){_0x1dd0e4=_0x1dd0e4||0x1f4;return function(_0x4a0a60){logger[_0x5395('0x28')](_0x4a0a60['stack']);if(_0x4a0a60[_0x5395('0x29')]){delete _0x4a0a60[_0x5395('0x29')];}_0x17427e[_0x5395('0x1c')](_0x1dd0e4)[_0x5395('0x2a')](_0x4a0a60);};}exports['index']=function(_0x1eef93,_0x30941b){var _0x25639f={},_0x4a38be={},_0x4896c4={'count':0x0,'rows':[]};var _0x2327c5=_['map'](db['VoiceMailMessage']['rawAttributes'],function(_0x5d57ce){return{'name':_0x5d57ce[_0x5395('0x2b')],'type':_0x5d57ce[_0x5395('0x2c')][_0x5395('0x2d')]};});_0x4a38be[_0x5395('0x2e')]=_[_0x5395('0x2f')](_['map'](_0x2327c5,'name'),[_0x5395('0x29')]);_0x4a38be[_0x5395('0x30')]=_[_0x5395('0x31')](_0x1eef93[_0x5395('0x30')]);_0x4a38be[_0x5395('0x32')]=_[_0x5395('0x33')](_0x4a38be[_0x5395('0x2e')],_0x4a38be[_0x5395('0x30')]);_0x25639f[_0x5395('0x34')]=_['intersection'](_0x4a38be[_0x5395('0x2e')],qs[_0x5395('0x35')](_0x1eef93[_0x5395('0x30')]['fields']));_0x25639f['attributes']=_0x25639f[_0x5395('0x34')][_0x5395('0x36')]?_0x25639f[_0x5395('0x34')]:_0x4a38be[_0x5395('0x2e')];if(!_0x1eef93[_0x5395('0x30')][_0x5395('0x37')](_0x5395('0x38'))){_0x25639f[_0x5395('0x1f')]=qs[_0x5395('0x1f')](_0x1eef93[_0x5395('0x30')][_0x5395('0x1f')]);_0x25639f[_0x5395('0x39')]=qs[_0x5395('0x39')](_0x1eef93[_0x5395('0x30')][_0x5395('0x39')]);}_0x25639f[_0x5395('0x3a')]=qs[_0x5395('0x3b')](_0x1eef93[_0x5395('0x30')][_0x5395('0x3b')]);_0x25639f[_0x5395('0x3c')]=qs['filters'](_[_0x5395('0x3d')](_0x1eef93[_0x5395('0x30')],_0x4a38be[_0x5395('0x32')]),_0x2327c5);if(_0x1eef93[_0x5395('0x30')][_0x5395('0x3e')]){_0x25639f[_0x5395('0x3c')]=_[_0x5395('0x3f')](_0x25639f[_0x5395('0x3c')],{'$or':_[_0x5395('0x40')](_0x2327c5,function(_0x5dc98c){if(_0x5dc98c['type']!==_0x5395('0x41')){var _0x3e9012={};_0x3e9012[_0x5dc98c[_0x5395('0x29')]]={'$like':'%'+_0x1eef93[_0x5395('0x30')]['filter']+'%'};return _0x3e9012;}})});}_0x25639f=_['merge']({},_0x25639f,_0x1eef93[_0x5395('0x42')]);var _0x5804fe={'where':_0x25639f[_0x5395('0x3c')]};return db['VoiceMailMessage'][_0x5395('0x21')](_0x5804fe)['then'](function(_0x582491){_0x4896c4['count']=_0x582491;if(_0x1eef93[_0x5395('0x30')][_0x5395('0x43')]){_0x25639f[_0x5395('0x44')]=[{'all':!![]}];}return db[_0x5395('0x45')][_0x5395('0x46')](_0x25639f);})[_0x5395('0x27')](function(_0x1370eb){_0x4896c4[_0x5395('0x47')]=_0x1370eb;return _0x4896c4;})['then'](respondWithFilteredResult(_0x30941b,_0x25639f))[_0x5395('0x48')](handleError(_0x30941b,null));};exports[_0x5395('0x49')]=function(_0x3027af,_0x11bc0b){var _0x325463={'raw':!![],'where':{'id':_0x3027af[_0x5395('0x4a')]['id']}},_0x18397f={};_0x18397f[_0x5395('0x2e')]=_['keys'](db[_0x5395('0x45')][_0x5395('0x4b')]);_0x18397f[_0x5395('0x30')]=_[_0x5395('0x31')](_0x3027af[_0x5395('0x30')]);_0x18397f['filters']=_[_0x5395('0x33')](_0x18397f[_0x5395('0x2e')],_0x18397f[_0x5395('0x30')]);_0x325463[_0x5395('0x34')]=_[_0x5395('0x33')](_0x18397f[_0x5395('0x2e')],qs[_0x5395('0x35')](_0x3027af['query'][_0x5395('0x35')]));_0x325463['attributes']=_0x325463[_0x5395('0x34')][_0x5395('0x36')]?_0x325463[_0x5395('0x34')]:_0x18397f[_0x5395('0x2e')];if(_0x3027af[_0x5395('0x30')]['includeAll']){_0x325463[_0x5395('0x44')]=[{'all':!![]}];}_0x325463=_[_0x5395('0x3f')]({},_0x325463,_0x3027af[_0x5395('0x42')]);return db[_0x5395('0x45')][_0x5395('0x4c')](_0x325463)['then'](handleEntityNotFound(_0x11bc0b,null))[_0x5395('0x27')](respondWithResult(_0x11bc0b,null))[_0x5395('0x48')](handleError(_0x11bc0b,null));};exports[_0x5395('0x4d')]=function(_0x2fabb7,_0x3d3d0f){return db[_0x5395('0x45')]['create'](_0x2fabb7[_0x5395('0x4e')],{})['then'](respondWithResult(_0x3d3d0f,0xc9))['catch'](handleError(_0x3d3d0f,null));};exports['update']=function(_0x411954,_0x206f4d){if(_0x411954[_0x5395('0x4e')]['id']){delete _0x411954['body']['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x411954['params']['id']}})['then'](handleEntityNotFound(_0x206f4d,null))[_0x5395('0x27')](saveUpdates(_0x411954[_0x5395('0x4e')],null))[_0x5395('0x27')](respondWithResult(_0x206f4d,null))[_0x5395('0x48')](handleError(_0x206f4d,null));};exports[_0x5395('0x26')]=function(_0x22f4ea,_0xfd82dc){return db[_0x5395('0x45')][_0x5395('0x4c')]({'where':{'id':_0x22f4ea['params']['id']}})[_0x5395('0x27')](handleEntityNotFound(_0xfd82dc,null))[_0x5395('0x27')](removeEntity(_0xfd82dc,null))['catch'](handleError(_0xfd82dc,null));};exports[_0x5395('0x4f')]=function(_0x369d4e,_0xbecda0,_0x4f404b){return db[_0x5395('0x45')]['find']({'where':{'id':_0x369d4e[_0x5395('0x4a')]['id']},'attributes':['id',_0x5395('0x50'),_0x5395('0x51')]})['then'](handleEntityNotFound(_0xbecda0,null))['then'](function(_0xe3c01e){if(_0xe3c01e){if(!_0xe3c01e[_0x5395('0x50')]){throw new db[(_0x5395('0x52'))][(_0x5395('0x53'))]('VoiceMailMessage\x20not\x20found');}var _0x1a289d={'Content-Type':_0x5395('0x54'),'Content-Disposition':'attachment'};if(_0xe3c01e[_0x5395('0x51')]){_0x1a289d[_0x5395('0x55')]='attachment;\x20filename=\x22'+_0xe3c01e['msg_id']+'.wav\x22';}_0xbecda0[_0x5395('0x56')](_0x1a289d);return _0xbecda0[_0x5395('0x2a')](new Buffer(_0xe3c01e[_0x5395('0x50')]));}})[_0x5395('0x48')](handleError(_0xbecda0,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 398b171..540a874 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 _0x9810=['path','define','VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4df6f9,_0x44bd65){var _0x4b1a73=function(_0xf5adb7){while(--_0xf5adb7){_0x4df6f9['push'](_0x4df6f9['shift']());}};_0x4b1a73(++_0x44bd65);}(_0x9810,0x11c));var _0x0981=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x9810[_0x1ebc6c];return _0x3a826d;};'use strict';var _=require(_0x0981('0x0'));var util=require(_0x0981('0x1'));var logger=require(_0x0981('0x2'))(_0x0981('0x3'));var moment=require(_0x0981('0x4'));var BPromise=require(_0x0981('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0981('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x963b5e,_0x1daea1){return _0x963b5e[_0x0981('0x7')](_0x0981('0x8'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x0981('0x9'),'fields':[_0x0981('0x9')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1b7d=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x4f44ed,_0x2f7f86){var _0x141081=function(_0x11e86d){while(--_0x11e86d){_0x4f44ed['push'](_0x4f44ed['shift']());}};_0x141081(++_0x2f7f86);}(_0x1b7d,0x11e));var _0xd1b7=function(_0x5bfc04,_0x8d29bc){_0x5bfc04=_0x5bfc04-0x0;var _0x4511c3=_0x1b7d[_0x5bfc04];return _0x4511c3;};'use strict';var _=require(_0xd1b7('0x0'));var util=require('util');var logger=require(_0xd1b7('0x1'))(_0xd1b7('0x2'));var moment=require('moment');var BPromise=require(_0xd1b7('0x3'));var rp=require(_0xd1b7('0x4'));var fs=require('fs');var path=require(_0xd1b7('0x5'));var rimraf=require(_0xd1b7('0x6'));var config=require(_0xd1b7('0x7'));var attributes=require('./voiceMailMessage.attributes');module[_0xd1b7('0x8')]=function(_0x362fb3,_0x4aa427){return _0x362fb3[_0xd1b7('0x9')](_0xd1b7('0xa'),attributes,{'tableName':_0xd1b7('0xb'),'paranoid':![],'indexes':[{'name':_0xd1b7('0xc'),'fields':[_0xd1b7('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index c9858f5..56bd771 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 _0x37af=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','debug','request\x20sent','error','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x50a75e,_0x41e663){var _0x304e15=function(_0x35b6a1){while(--_0x35b6a1){_0x50a75e['push'](_0x50a75e['shift']());}};_0x304e15(++_0x41e663);}(_0x37af,0x70));var _0xf37a=function(_0x425e3d,_0x19279a){_0x425e3d=_0x425e3d-0x0;var _0x41ceb3=_0x37af[_0x425e3d];return _0x41ceb3;};'use strict';var _=require(_0xf37a('0x0'));var util=require(_0xf37a('0x1'));var moment=require(_0xf37a('0x2'));var BPromise=require(_0xf37a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf37a('0x4'));var db=require(_0xf37a('0x5'))['db'];var utils=require(_0xf37a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf37a('0x7'));var client=jayson['client'][_0xf37a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13d4a0,_0x36819d,_0x374071){return new BPromise(function(_0xd71ee0,_0x11311a){return client[_0xf37a('0x9')](_0x13d4a0,_0x374071)[_0xf37a('0xa')](function(_0x3a6384){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x36819d,'request\x20sent');logger[_0xf37a('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x36819d,_0xf37a('0xc'),JSON['stringify'](_0x3a6384));if(_0x3a6384[_0xf37a('0xd')]){if(_0x3a6384[_0xf37a('0xd')]['code']===0x1f4){logger[_0xf37a('0xd')](_0xf37a('0xe'),_0x36819d,_0x3a6384[_0xf37a('0xd')][_0xf37a('0xf')]);return _0x11311a(_0x3a6384['error'][_0xf37a('0xf')]);}logger[_0xf37a('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x36819d,_0x3a6384[_0xf37a('0xd')][_0xf37a('0xf')]);return _0xd71ee0(_0x3a6384[_0xf37a('0xd')][_0xf37a('0xf')]);}else{logger[_0xf37a('0x10')](_0xf37a('0xe'),_0x36819d,_0xf37a('0xc'));_0xd71ee0(_0x3a6384[_0xf37a('0x11')][_0xf37a('0xf')]);}})[_0xf37a('0x12')](function(_0x213e96){logger[_0xf37a('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x36819d,_0x213e96);_0x11311a(_0x213e96);});});} \ No newline at end of file +var _0x583d=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1a7d1d,_0x30d70f){var _0x244216=function(_0x1a5673){while(--_0x1a5673){_0x1a7d1d['push'](_0x1a7d1d['shift']());}};_0x244216(++_0x30d70f);}(_0x583d,0xf2));var _0xd583=function(_0xcb7aa9,_0x214ae6){_0xcb7aa9=_0xcb7aa9-0x0;var _0x3ab5d2=_0x583d[_0xcb7aa9];return _0x3ab5d2;};'use strict';var _=require(_0xd583('0x0'));var util=require(_0xd583('0x1'));var moment=require(_0xd583('0x2'));var BPromise=require(_0xd583('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd583('0x4'))['db'];var utils=require(_0xd583('0x5'));var logger=require(_0xd583('0x6'))(_0xd583('0x7'));var config=require(_0xd583('0x8'));var jayson=require(_0xd583('0x9'));var client=jayson['client'][_0xd583('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x201d52,_0x38b414,_0x5d65d9){return new BPromise(function(_0x34ba40,_0x53b686){return client[_0xd583('0xb')](_0x201d52,_0x5d65d9)['then'](function(_0xe54638){logger[_0xd583('0xc')](_0xd583('0xd'),_0x38b414,_0xd583('0xe'));logger['debug'](_0xd583('0xf'),_0x38b414,_0xd583('0xe'),JSON[_0xd583('0x10')](_0xe54638));if(_0xe54638[_0xd583('0x11')]){if(_0xe54638[_0xd583('0x11')][_0xd583('0x12')]===0x1f4){logger[_0xd583('0x11')](_0xd583('0xd'),_0x38b414,_0xe54638['error'][_0xd583('0x13')]);return _0x53b686(_0xe54638[_0xd583('0x11')][_0xd583('0x13')]);}logger['error'](_0xd583('0xd'),_0x38b414,_0xe54638['error'][_0xd583('0x13')]);return _0x34ba40(_0xe54638['error'][_0xd583('0x13')]);}else{logger[_0xd583('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x38b414,_0xd583('0xe'));_0x34ba40(_0xe54638[_0xd583('0x14')][_0xd583('0x13')]);}})[_0xd583('0x15')](function(_0x2685b9){logger['error'](_0xd583('0xd'),_0x38b414,_0x2685b9);_0x53b686(_0x2685b9);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index f3ce5e9..0600dc2 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 _0xcb24=['removeSound','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','addSound','put','delete','/:id','/:id/sounds/:id2'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xcb24,0xe8));var _0x4cb2=function(_0x4b9c4e,_0x4587c8){_0x4b9c4e=_0x4b9c4e-0x0;var _0x1040e4=_0xcb24[_0x4b9c4e];return _0x1040e4;};'use strict';var multer=require(_0x4cb2('0x0'));var util=require(_0x4cb2('0x1'));var path=require(_0x4cb2('0x2'));var timeout=require(_0x4cb2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4cb2('0x4'));var auth=require(_0x4cb2('0x5'));var interaction=require(_0x4cb2('0x6'));var config=require(_0x4cb2('0x7'));var controller=require(_0x4cb2('0x8'));router[_0x4cb2('0x9')]('/',auth[_0x4cb2('0xa')](),controller[_0x4cb2('0xb')]);router[_0x4cb2('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4cb2('0xc')]);router[_0x4cb2('0x9')](_0x4cb2('0xd'),auth[_0x4cb2('0xa')](),controller[_0x4cb2('0xe')]);router[_0x4cb2('0xf')]('/',auth[_0x4cb2('0xa')](),controller['create']);router[_0x4cb2('0xf')](_0x4cb2('0xd'),auth[_0x4cb2('0xa')](),controller[_0x4cb2('0x10')]);router[_0x4cb2('0x11')]('/:id',auth[_0x4cb2('0xa')](),controller['update']);router[_0x4cb2('0x12')](_0x4cb2('0x13'),auth[_0x4cb2('0xa')](),controller['destroy']);router[_0x4cb2('0x12')](_0x4cb2('0x14'),auth['isAuthenticated'](),controller[_0x4cb2('0x15')]);module[_0x4cb2('0x16')]=router; \ No newline at end of file +var _0xa3b2=['removeSound','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2'];(function(_0x3d5371,_0x24ebd7){var _0x4631e3=function(_0x2a2e41){while(--_0x2a2e41){_0x3d5371['push'](_0x3d5371['shift']());}};_0x4631e3(++_0x24ebd7);}(_0xa3b2,0x1aa));var _0x2a3b=function(_0x264194,_0x48ee77){_0x264194=_0x264194-0x0;var _0x584be0=_0xa3b2[_0x264194];return _0x584be0;};'use strict';var multer=require(_0x2a3b('0x0'));var util=require(_0x2a3b('0x1'));var path=require(_0x2a3b('0x2'));var timeout=require(_0x2a3b('0x3'));var express=require(_0x2a3b('0x4'));var router=express[_0x2a3b('0x5')]();var fs_extra=require(_0x2a3b('0x6'));var auth=require(_0x2a3b('0x7'));var interaction=require(_0x2a3b('0x8'));var config=require('../../config/environment');var controller=require(_0x2a3b('0x9'));router[_0x2a3b('0xa')]('/',auth[_0x2a3b('0xb')](),controller[_0x2a3b('0xc')]);router[_0x2a3b('0xa')](_0x2a3b('0xd'),auth[_0x2a3b('0xb')](),controller[_0x2a3b('0xe')]);router[_0x2a3b('0xa')]('/:id/sounds',auth[_0x2a3b('0xb')](),controller[_0x2a3b('0xf')]);router[_0x2a3b('0x10')]('/',auth[_0x2a3b('0xb')](),controller[_0x2a3b('0x11')]);router['post']('/:id/sounds',auth[_0x2a3b('0xb')](),controller[_0x2a3b('0x12')]);router[_0x2a3b('0x13')](_0x2a3b('0xd'),auth[_0x2a3b('0xb')](),controller[_0x2a3b('0x14')]);router[_0x2a3b('0x15')](_0x2a3b('0xd'),auth[_0x2a3b('0xb')](),controller[_0x2a3b('0x16')]);router[_0x2a3b('0x15')](_0x2a3b('0x17'),auth['isAuthenticated'](),controller[_0x2a3b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 0845262..9e03847 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 _0x9c38=['alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','custom','files','quietmp3','mp3','STRING'];(function(_0x386788,_0x2cf702){var _0x3d5e7f=function(_0x156e5e){while(--_0x156e5e){_0x386788['push'](_0x386788['shift']());}};_0x3d5e7f(++_0x2cf702);}(_0x9c38,0x10b));var _0x89c3=function(_0x4e027f,_0x431ddc){_0x4e027f=_0x4e027f-0x0;var _0x141300=_0x9c38[_0x4e027f];return _0x141300;};'use strict';var Sequelize=require(_0x89c3('0x0'));module[_0x89c3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x89c3('0x2')},'mode':{'type':Sequelize[_0x89c3('0x3')](_0x89c3('0x4'),_0x89c3('0x5'),'mp3nb','quietmp3nb',_0x89c3('0x6'),_0x89c3('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x89c3('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x89c3('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x89c3('0x8')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x89c3('0x9')},'format':{'type':Sequelize[_0x89c3('0x8')],'allowNull':!![]},'stamp':{'type':_0x89c3('0xa')},'defaultEntry':{'type':Sequelize[_0x89c3('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x18ab=['BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','quietmp3nb','mp3','TIMESTAMP'];(function(_0x4ffa64,_0x271035){var _0x5da001=function(_0x7d1940){while(--_0x7d1940){_0x4ffa64['push'](_0x4ffa64['shift']());}};_0x5da001(++_0x271035);}(_0x18ab,0x1ae));var _0xb18a=function(_0x420c66,_0x14eece){_0x420c66=_0x420c66-0x0;var _0x3664f4=_0x18ab[_0x420c66];return _0x3664f4;};'use strict';var Sequelize=require(_0xb18a('0x0'));module[_0xb18a('0x1')]={'name':{'type':Sequelize[_0xb18a('0x2')],'allowNull':![],'unique':_0xb18a('0x3')},'mode':{'type':Sequelize[_0xb18a('0x4')](_0xb18a('0x5'),_0xb18a('0x6'),'mp3nb',_0xb18a('0x7'),'quietmp3',_0xb18a('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xb18a('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xb18a('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xb18a('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xb18a('0x2')],'allowNull':!![]},'stamp':{'type':_0xb18a('0x9')},'defaultEntry':{'type':Sequelize[_0xb18a('0xa')],'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 ade9120..9175e49 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 _0x1453=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','name','map','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','VoiceMusicOnHold','findAll','rows','catch','show','params','rawAttributes','find','body','create','sequelize','mode','files','directory','join','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','removeSound','id2','Sequelize','getSounds','order','pick','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1453,0x152));var _0x3145=function(_0x588cb5,_0x41250c){_0x588cb5=_0x588cb5-0x0;var _0x4547aa=_0x1453[_0x588cb5];return _0x4547aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3145('0x0'));var zipdir=require(_0x3145('0x1'));var jsonpatch=require(_0x3145('0x2'));var rp=require(_0x3145('0x3'));var moment=require(_0x3145('0x4'));var BPromise=require(_0x3145('0x5'));var Mustache=require(_0x3145('0x6'));var util=require('util');var path=require(_0x3145('0x7'));var sox=require(_0x3145('0x8'));var csv=require('to-csv');var ejs=require(_0x3145('0x9'));var fs=require('fs');var fs_extra=require(_0x3145('0xa'));var _=require(_0x3145('0xb'));var squel=require(_0x3145('0xc'));var crypto=require(_0x3145('0xd'));var jsforce=require(_0x3145('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3145('0xf'));var querystring=require(_0x3145('0x10'));var Papa=require(_0x3145('0x11'));var Redis=require(_0x3145('0x12'));var authService=require(_0x3145('0x13'));var qs=require(_0x3145('0x14'));var as=require(_0x3145('0x15'));var hardwareService=require(_0x3145('0x16'));var logger=require(_0x3145('0x17'))(_0x3145('0x18'));var utils=require(_0x3145('0x19'));var config=require(_0x3145('0x1a'));var licenseUtil=require(_0x3145('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6f0a66,_0x196f93){_0x196f93=_0x196f93||0xcc;return function(_0x4724ad){if(_0x4724ad){return _0x6f0a66[_0x3145('0x1c')](_0x196f93);}return _0x6f0a66['status'](_0x196f93)[_0x3145('0x1d')]();};}function respondWithResult(_0x6fd737,_0x48f777){_0x48f777=_0x48f777||0xc8;return function(_0x18bdd8){if(_0x18bdd8){return _0x6fd737[_0x3145('0x1e')](_0x48f777)[_0x3145('0x1f')](_0x18bdd8);}};}function respondWithFilteredResult(_0x1ab02f,_0x2bc50c){return function(_0x3b1e6b){if(_0x3b1e6b){var _0x352c45=typeof _0x2bc50c[_0x3145('0x20')]===_0x3145('0x21')&&typeof _0x2bc50c[_0x3145('0x22')]===_0x3145('0x21');var _0x5015f9=_0x3b1e6b[_0x3145('0x23')];var _0x146685=_0x352c45?0x0:_0x2bc50c[_0x3145('0x20')];var _0x16f3aa=_0x352c45?_0x3b1e6b[_0x3145('0x23')]:_0x2bc50c[_0x3145('0x20')]+_0x2bc50c[_0x3145('0x22')];var _0x30498e;if(_0x16f3aa>=_0x5015f9){_0x16f3aa=_0x5015f9;_0x30498e=0xc8;}else{_0x30498e=0xce;}_0x1ab02f[_0x3145('0x1e')](_0x30498e);return _0x1ab02f[_0x3145('0x24')](_0x3145('0x25'),_0x146685+'-'+_0x16f3aa+'/'+_0x5015f9)[_0x3145('0x1f')](_0x3b1e6b);}return null;};}function patchUpdates(_0x3e5e7d){return function(_0x5668ee){try{jsonpatch[_0x3145('0x26')](_0x5668ee,_0x3e5e7d,!![]);}catch(_0x260e1e){return BPromise['reject'](_0x260e1e);}return _0x5668ee['save']();};}function saveUpdates(_0x3c9c67,_0x2c403f){return function(_0x477146){if(_0x477146){return _0x477146[_0x3145('0x27')](_0x3c9c67)[_0x3145('0x28')](function(_0x2743b6){return _0x2743b6;});}return null;};}function removeEntity(_0x54399d,_0x105f6e){return function(_0x1afa7){if(_0x1afa7){return _0x1afa7[_0x3145('0x29')]()[_0x3145('0x28')](function(){var _0x43c2b7=_0x1afa7[_0x3145('0x2a')]({'plain':!![]});var _0x154e32=_0x3145('0x2b');return db[_0x3145('0x2c')][_0x3145('0x29')]({'where':{'type':_0x154e32,'resourceId':_0x43c2b7['id']}})[_0x3145('0x28')](function(){return _0x1afa7;});})[_0x3145('0x28')](function(){_0x54399d[_0x3145('0x1e')](0xcc)[_0x3145('0x1d')]();});}};}function handleEntityNotFound(_0x3466d8,_0x4c2e8a){return function(_0x2c521e){if(!_0x2c521e){_0x3466d8['sendStatus'](0x194);}return _0x2c521e;};}function handleError(_0x4fabcf,_0x1a7de1){_0x1a7de1=_0x1a7de1||0x1f4;return function(_0x191576){logger[_0x3145('0x2d')](_0x191576['stack']);if(_0x191576[_0x3145('0x2e')]){delete _0x191576[_0x3145('0x2e')];}_0x4fabcf['status'](_0x1a7de1)['send'](_0x191576);};}exports['index']=function(_0x26835b,_0x5b8c09){var _0x344aa7={},_0x34e1df={},_0x410af0={'count':0x0,'rows':[]};var _0x32471d=_[_0x3145('0x2f')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x370552){return{'name':_0x370552['fieldName'],'type':_0x370552[_0x3145('0x30')][_0x3145('0x31')]};});_0x34e1df['model']=_[_0x3145('0x2f')](_0x32471d,_0x3145('0x2e'));_0x34e1df['query']=_[_0x3145('0x32')](_0x26835b[_0x3145('0x33')]);_0x34e1df[_0x3145('0x34')]=_[_0x3145('0x35')](_0x34e1df[_0x3145('0x36')],_0x34e1df[_0x3145('0x33')]);_0x344aa7[_0x3145('0x37')]=_[_0x3145('0x35')](_0x34e1df[_0x3145('0x36')],qs[_0x3145('0x38')](_0x26835b[_0x3145('0x33')][_0x3145('0x38')]));_0x344aa7[_0x3145('0x37')]=_0x344aa7['attributes'][_0x3145('0x39')]?_0x344aa7[_0x3145('0x37')]:_0x34e1df[_0x3145('0x36')];if(!_0x26835b[_0x3145('0x33')][_0x3145('0x3a')](_0x3145('0x3b'))){_0x344aa7[_0x3145('0x22')]=qs[_0x3145('0x22')](_0x26835b[_0x3145('0x33')][_0x3145('0x22')]);_0x344aa7[_0x3145('0x20')]=qs[_0x3145('0x20')](_0x26835b[_0x3145('0x33')][_0x3145('0x20')]);}_0x344aa7['order']=qs[_0x3145('0x3c')](_0x26835b[_0x3145('0x33')][_0x3145('0x3c')]);delete _0x26835b[_0x3145('0x33')][_0x3145('0x3c')];_0x344aa7[_0x3145('0x3d')]=qs[_0x3145('0x34')](_['pick'](_0x26835b['query'],_0x34e1df[_0x3145('0x34')]),_0x32471d);if(_0x26835b[_0x3145('0x33')][_0x3145('0x3e')]){_0x344aa7[_0x3145('0x3d')]=_[_0x3145('0x3f')](_0x344aa7[_0x3145('0x3d')],{'$or':_[_0x3145('0x2f')](_0x32471d,function(_0x1b9af4){if(_0x1b9af4[_0x3145('0x30')]!==_0x3145('0x40')){var _0xf99fe7={};_0xf99fe7[_0x1b9af4[_0x3145('0x2e')]]={'$like':'%'+_0x26835b['query'][_0x3145('0x3e')]+'%'};return _0xf99fe7;}})});}_0x344aa7=_['merge']({},_0x344aa7,_0x26835b[_0x3145('0x41')]);var _0x3568ad={'where':_0x344aa7[_0x3145('0x3d')]};return db['VoiceMusicOnHold'][_0x3145('0x23')](_0x3568ad)['then'](function(_0x4d035c){_0x410af0[_0x3145('0x23')]=_0x4d035c;if(_0x26835b['query'][_0x3145('0x42')]){_0x344aa7[_0x3145('0x43')]=[{'all':!![]}];}return db[_0x3145('0x44')][_0x3145('0x45')](_0x344aa7);})['then'](function(_0x442971){_0x410af0[_0x3145('0x46')]=_0x442971;return _0x410af0;})[_0x3145('0x28')](respondWithFilteredResult(_0x5b8c09,_0x344aa7))[_0x3145('0x47')](handleError(_0x5b8c09,null));};exports[_0x3145('0x48')]=function(_0x5c0e66,_0x192b96){var _0x2374f9={'raw':![],'where':{'id':_0x5c0e66[_0x3145('0x49')]['id']}},_0x94ad00={};_0x94ad00[_0x3145('0x36')]=_[_0x3145('0x32')](db['VoiceMusicOnHold'][_0x3145('0x4a')]);_0x94ad00[_0x3145('0x33')]=_[_0x3145('0x32')](_0x5c0e66[_0x3145('0x33')]);_0x94ad00[_0x3145('0x34')]=_['intersection'](_0x94ad00[_0x3145('0x36')],_0x94ad00[_0x3145('0x33')]);_0x2374f9['attributes']=_[_0x3145('0x35')](_0x94ad00[_0x3145('0x36')],qs[_0x3145('0x38')](_0x5c0e66[_0x3145('0x33')][_0x3145('0x38')]));_0x2374f9['attributes']=_0x2374f9[_0x3145('0x37')][_0x3145('0x39')]?_0x2374f9[_0x3145('0x37')]:_0x94ad00[_0x3145('0x36')];if(_0x5c0e66[_0x3145('0x33')][_0x3145('0x42')]){_0x2374f9[_0x3145('0x43')]=[{'all':!![]}];}_0x2374f9=_['merge']({},_0x2374f9,_0x5c0e66['options']);return db[_0x3145('0x44')][_0x3145('0x4b')](_0x2374f9)[_0x3145('0x28')](handleEntityNotFound(_0x192b96,null))[_0x3145('0x28')](respondWithResult(_0x192b96,null))[_0x3145('0x47')](handleError(_0x192b96,null));};exports[_0x3145('0x27')]=function(_0x454df7,_0x573765){if(_0x454df7[_0x3145('0x4c')]['id']){delete _0x454df7['body']['id'];}return db[_0x3145('0x44')][_0x3145('0x4b')]({'where':{'id':_0x454df7[_0x3145('0x49')]['id']}})[_0x3145('0x28')](handleEntityNotFound(_0x573765,null))[_0x3145('0x28')](saveUpdates(_0x454df7[_0x3145('0x4c')],null))['then'](respondWithResult(_0x573765,null))[_0x3145('0x47')](handleError(_0x573765,null));};exports[_0x3145('0x4d')]=function(_0x3e782c,_0x209ff1,_0x52fc30){return db[_0x3145('0x4e')]['transaction'](function(_0x3b731c){if(_0x3e782c[_0x3145('0x4c')][_0x3145('0x4f')]===_0x3145('0x50')){_0x3e782c[_0x3145('0x4c')][_0x3145('0x51')]=path[_0x3145('0x52')](config['root'],_0x3145('0x53'),_0x3e782c[_0x3145('0x4c')][_0x3145('0x2e')]);}return db[_0x3145('0x44')]['create'](_0x3e782c[_0x3145('0x4c')],{'transaction':_0x3b731c})[_0x3145('0x28')](function(_0x2bdd96){if(_0x3e782c['body'][_0x3145('0x4f')]==='files'){fs[_0x3145('0x54')](_0x2bdd96[_0x3145('0x51')],parseInt(_0x3145('0x55'),0x8));}var _0x15bbbe=_0x3e782c[_0x3145('0x56')]['get']({'plain':!![]});if(!_0x15bbbe)throw new Error(_0x3145('0x57'));if(_0x15bbbe[_0x3145('0x58')]===_0x3145('0x56')){var _0x22f341=_0x2bdd96['get']({'plain':!![]});return db['UserProfileSection'][_0x3145('0x4b')]({'where':{'name':'MusicOnHolds','userProfileId':_0x15bbbe['userProfileId']},'raw':!![]})[_0x3145('0x28')](function(_0x34769f){if(_0x34769f&&_0x34769f['autoAssociation']===0x0){return db['UserProfileResource'][_0x3145('0x4d')]({'name':_0x22f341['name'],'resourceId':_0x22f341['id'],'type':_0x34769f[_0x3145('0x2e')],'sectionId':_0x34769f['id']},{})[_0x3145('0x28')](function(){return _0x2bdd96;});}else{return _0x2bdd96;}})[_0x3145('0x47')](function(_0x3c0479){logger['error'](_0x3145('0x59'),_0x3c0479);});}return _0x2bdd96;});})[_0x3145('0x28')](respondWithResult(_0x209ff1,0xc9))[_0x3145('0x47')](handleError(_0x209ff1,null));};exports['destroy']=function(_0xceeaaa,_0x4a64bc,_0x34c77e){var _0x185604;return db[_0x3145('0x44')][_0x3145('0x4b')]({'where':{'id':_0xceeaaa[_0x3145('0x49')]['id']}})[_0x3145('0x28')](function(_0x4ceb84){if(_0x4ceb84){return db['sequelize'][_0x3145('0x5a')](function(_0x1e7d25){return _0x4ceb84[_0x3145('0x29')]({'transaction':_0x1e7d25,'raw':!![]})[_0x3145('0x28')](function(_0x17aea6){if(_0x17aea6[_0x3145('0x51')]){fs[_0x3145('0x5b')](_0x17aea6[_0x3145('0x51')])[_0x3145('0x5c')](function(_0x38e2a7){fs[_0x3145('0x5d')](path[_0x3145('0x52')](_0x17aea6[_0x3145('0x51')],_0x38e2a7));});fs[_0x3145('0x5e')](_0x17aea6[_0x3145('0x51')]);}return _0x17aea6;});})['catch'](function(_0x22ae72){throw new db['Sequelize'][(_0x3145('0x5f'))](_0x22ae72[_0x3145('0x60')]);});}})['then'](handleEntityNotFound(_0x4a64bc,null))[_0x3145('0x28')](removeEntity(_0x4a64bc,null))[_0x3145('0x47')](handleError(_0x4a64bc,null));};exports['addSound']=function(_0x303b3b,_0x107e12,_0x164a92){return db[_0x3145('0x4e')][_0x3145('0x5a')](function(_0x4b0c35){var _0x5d17e3;return db[_0x3145('0x44')][_0x3145('0x4b')]({'where':{'id':_0x303b3b[_0x3145('0x49')]['id']}})[_0x3145('0x28')](function(_0x213a6b){if(_0x213a6b){_0x5d17e3=_0x213a6b;return _0x213a6b['addSound'](_0x303b3b[_0x3145('0x4c')]['id'],{'transaction':_0x4b0c35});}})[_0x3145('0x28')](function(_0x12d6b7){if(_0x12d6b7){return db[_0x3145('0x61')][_0x3145('0x62')]({'where':{'id':_0x303b3b[_0x3145('0x4c')]['id']},'attributes':['id',_0x3145('0x2e'),_0x3145('0x63'),_0x3145('0x64'),_0x3145('0x65')],'raw':!![]});}})[_0x3145('0x28')](function(_0x2cfbb1){if(_0x2cfbb1){var _0x3f56a0=path[_0x3145('0x52')](config[_0x3145('0x66')],_0x3145('0x67'),util[_0x3145('0x68')](_0x3145('0x69'),path[_0x3145('0x6a')](_0x2cfbb1[_0x3145('0x63')],path['extname'](_0x2cfbb1['save_name'])),_0x2cfbb1[_0x3145('0x64')]));var _0x5c6a82=path[_0x3145('0x52')](config['root'],'server/files/moh',_0x5d17e3[_0x3145('0x2e')],util[_0x3145('0x68')](_0x3145('0x69'),_0x2cfbb1[_0x3145('0x2e')],_0x2cfbb1[_0x3145('0x64')]));fs[_0x3145('0x6b')](_0x3f56a0,_0x5c6a82);return _0x2cfbb1;}})[_0x3145('0x47')](function(_0x4614fe){throw new db['Sequelize'][(_0x3145('0x5f'))](_0x4614fe['message']);});})[_0x3145('0x28')](handleEntityNotFound(_0x107e12,null))[_0x3145('0x28')](respondWithResult(_0x107e12,0xc9))['catch'](handleError(_0x107e12,null));};exports[_0x3145('0x6c')]=function(_0x5d57a1,_0xdfe77c,_0xace144){return db['sequelize']['transaction'](function(_0x15c9c6){var _0x5099f5;return db[_0x3145('0x44')]['findOne']({'where':{'id':_0x5d57a1[_0x3145('0x49')]['id']}})[_0x3145('0x28')](handleEntityNotFound(_0xdfe77c,null))['then'](function(_0x2d25af){if(_0x2d25af){_0x5099f5=_0x2d25af;return _0x2d25af[_0x3145('0x6c')](_0x5d57a1[_0x3145('0x49')]['id2']);}})[_0x3145('0x28')](function(_0x427b49){if(_0x427b49){return db[_0x3145('0x61')][_0x3145('0x62')]({'where':{'id':_0x5d57a1[_0x3145('0x49')][_0x3145('0x6d')]},'attributes':['id',_0x3145('0x2e'),_0x3145('0x63'),_0x3145('0x64'),'createdAt'],'raw':!![]});}})[_0x3145('0x28')](function(_0x242a4e){if(_0x242a4e){fs[_0x3145('0x5d')](path[_0x3145('0x52')](_0x5099f5[_0x3145('0x51')],util[_0x3145('0x68')]('%s.%s',_0x242a4e[_0x3145('0x2e')],_0x242a4e['converted_format'])));return _0x242a4e;}})['catch'](function(_0x599ff8){throw new db[(_0x3145('0x6e'))][(_0x3145('0x5f'))](_0x599ff8[_0x3145('0x60')]);});})[_0x3145('0x28')](handleEntityNotFound(_0xdfe77c,null))[_0x3145('0x28')](respondWithStatusCode(_0xdfe77c,0xcc))[_0x3145('0x47')](handleError(_0xdfe77c,null));};exports[_0x3145('0x6f')]=function(_0x3b4877,_0x2d6916,_0x251bc1){var _0x4b41de={};var _0x14a7ab={};var _0x37592f;var _0x2ff68a;return db['VoiceMusicOnHold'][_0x3145('0x62')]({'where':{'id':_0x3b4877[_0x3145('0x49')]['id']}})[_0x3145('0x28')](handleEntityNotFound(_0x2d6916,null))[_0x3145('0x28')](function(_0x45d759){if(_0x45d759){_0x37592f=_0x45d759;_0x14a7ab['model']=_[_0x3145('0x32')](db[_0x3145('0x61')]['rawAttributes']);_0x14a7ab['query']=_[_0x3145('0x32')](_0x3b4877[_0x3145('0x33')]);_0x14a7ab[_0x3145('0x34')]=_[_0x3145('0x35')](_0x14a7ab[_0x3145('0x36')],_0x14a7ab[_0x3145('0x33')]);_0x4b41de[_0x3145('0x37')]=_[_0x3145('0x35')](_0x14a7ab['model'],qs[_0x3145('0x38')](_0x3b4877[_0x3145('0x33')][_0x3145('0x38')]));_0x4b41de[_0x3145('0x37')]=_0x4b41de[_0x3145('0x37')][_0x3145('0x39')]?_0x4b41de[_0x3145('0x37')]:_0x14a7ab[_0x3145('0x36')];_0x4b41de[_0x3145('0x70')]=qs[_0x3145('0x3c')](_0x3b4877[_0x3145('0x33')][_0x3145('0x3c')]);_0x4b41de['where']=qs[_0x3145('0x34')](_[_0x3145('0x71')](_0x3b4877['query'],_0x14a7ab[_0x3145('0x34')]));if(_0x3b4877[_0x3145('0x33')][_0x3145('0x3e')]){_0x4b41de['where']=_[_0x3145('0x3f')](_0x4b41de['where'],{'$or':_[_0x3145('0x2f')](_0x4b41de[_0x3145('0x37')],function(_0x51ec25){var _0x312a2a={};_0x312a2a[_0x51ec25]={'$like':'%'+_0x3b4877[_0x3145('0x33')][_0x3145('0x3e')]+'%'};return _0x312a2a;})});}_0x4b41de=_[_0x3145('0x3f')]({},_0x4b41de,_0x3b4877[_0x3145('0x41')]);return _0x37592f['getSounds'](_0x4b41de);}})[_0x3145('0x28')](function(_0x3e41cb){if(_0x3e41cb){_0x2ff68a=_0x3e41cb['length'];if(!_0x3b4877[_0x3145('0x33')][_0x3145('0x3a')](_0x3145('0x3b'))){_0x4b41de[_0x3145('0x22')]=qs['limit'](_0x3b4877['query']['limit']);_0x4b41de[_0x3145('0x20')]=qs[_0x3145('0x20')](_0x3b4877[_0x3145('0x33')][_0x3145('0x20')]);}return _0x37592f['getSounds'](_0x4b41de);}})['then'](function(_0x417061){if(_0x417061){return _0x417061?{'count':_0x2ff68a,'rows':_0x417061}:null;}})[_0x3145('0x28')](respondWithResult(_0x2d6916,null))[_0x3145('0x47')](handleError(_0x2d6916,null));}; \ No newline at end of file +var _0x5c63=['ValidationError','removeSound','findOne','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','set','reject','save','update','then','destroy','get','MusicOnHolds','error','name','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filter','merge','options','VoiceMusicOnHold','includeAll','include','findAll','rows','intersection','find','catch','body','params','create','transaction','mode','directory','join','root','files','0777','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','readdirSync','forEach','unlinkSync','Sequelize','message','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname'];(function(_0x21a314,_0xbe022b){var _0x3eb9f6=function(_0x3b53ff){while(--_0x3b53ff){_0x21a314['push'](_0x21a314['shift']());}};_0x3eb9f6(++_0xbe022b);}(_0x5c63,0x139));var _0x35c6=function(_0x3253c0,_0x361c69){_0x3253c0=_0x3253c0-0x0;var _0x1e37d7=_0x5c63[_0x3253c0];return _0x1e37d7;};'use strict';var emlformat=require(_0x35c6('0x0'));var rimraf=require(_0x35c6('0x1'));var zipdir=require(_0x35c6('0x2'));var jsonpatch=require(_0x35c6('0x3'));var rp=require(_0x35c6('0x4'));var moment=require('moment');var BPromise=require(_0x35c6('0x5'));var Mustache=require(_0x35c6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x35c6('0x7'));var csv=require(_0x35c6('0x8'));var ejs=require(_0x35c6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35c6('0xa'));var squel=require(_0x35c6('0xb'));var crypto=require(_0x35c6('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x35c6('0x8'));var querystring=require('querystring');var Papa=require(_0x35c6('0xd'));var Redis=require(_0x35c6('0xe'));var authService=require(_0x35c6('0xf'));var qs=require(_0x35c6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35c6('0x11'));var logger=require(_0x35c6('0x12'))(_0x35c6('0x13'));var utils=require(_0x35c6('0x14'));var config=require(_0x35c6('0x15'));var licenseUtil=require(_0x35c6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ba09c,_0x1195cf){_0x1195cf=_0x1195cf||0xcc;return function(_0x29b4b4){if(_0x29b4b4){return _0x2ba09c[_0x35c6('0x17')](_0x1195cf);}return _0x2ba09c['status'](_0x1195cf)[_0x35c6('0x18')]();};}function respondWithResult(_0x87c175,_0x313df3){_0x313df3=_0x313df3||0xc8;return function(_0xb2898c){if(_0xb2898c){return _0x87c175[_0x35c6('0x19')](_0x313df3)[_0x35c6('0x1a')](_0xb2898c);}};}function respondWithFilteredResult(_0x4d487a,_0xaeae88){return function(_0x55e990){if(_0x55e990){var _0x9a6a33=typeof _0xaeae88['offset']===_0x35c6('0x1b')&&typeof _0xaeae88[_0x35c6('0x1c')]==='undefined';var _0x4e1617=_0x55e990[_0x35c6('0x1d')];var _0x3abbc1=_0x9a6a33?0x0:_0xaeae88['offset'];var _0x579b08=_0x9a6a33?_0x55e990[_0x35c6('0x1d')]:_0xaeae88['offset']+_0xaeae88[_0x35c6('0x1c')];var _0xadd62a;if(_0x579b08>=_0x4e1617){_0x579b08=_0x4e1617;_0xadd62a=0xc8;}else{_0xadd62a=0xce;}_0x4d487a[_0x35c6('0x19')](_0xadd62a);return _0x4d487a[_0x35c6('0x1e')]('Content-Range',_0x3abbc1+'-'+_0x579b08+'/'+_0x4e1617)[_0x35c6('0x1a')](_0x55e990);}return null;};}function patchUpdates(_0x7f32e5){return function(_0x33a7f2){try{jsonpatch['apply'](_0x33a7f2,_0x7f32e5,!![]);}catch(_0x381d8f){return BPromise[_0x35c6('0x1f')](_0x381d8f);}return _0x33a7f2[_0x35c6('0x20')]();};}function saveUpdates(_0x3af4a7,_0xb4977c){return function(_0x293199){if(_0x293199){return _0x293199[_0x35c6('0x21')](_0x3af4a7)[_0x35c6('0x22')](function(_0x67c842){return _0x67c842;});}return null;};}function removeEntity(_0x1297b3,_0x5c8871){return function(_0x38a4c5){if(_0x38a4c5){return _0x38a4c5[_0x35c6('0x23')]()[_0x35c6('0x22')](function(){var _0x1a6793=_0x38a4c5[_0x35c6('0x24')]({'plain':!![]});var _0x30373f=_0x35c6('0x25');return db['UserProfileResource'][_0x35c6('0x23')]({'where':{'type':_0x30373f,'resourceId':_0x1a6793['id']}})[_0x35c6('0x22')](function(){return _0x38a4c5;});})[_0x35c6('0x22')](function(){_0x1297b3['status'](0xcc)[_0x35c6('0x18')]();});}};}function handleEntityNotFound(_0xfc6578,_0x418196){return function(_0x438b52){if(!_0x438b52){_0xfc6578['sendStatus'](0x194);}return _0x438b52;};}function handleError(_0x320d24,_0x4e8366){_0x4e8366=_0x4e8366||0x1f4;return function(_0x3ac023){logger[_0x35c6('0x26')](_0x3ac023['stack']);if(_0x3ac023[_0x35c6('0x27')]){delete _0x3ac023[_0x35c6('0x27')];}_0x320d24[_0x35c6('0x19')](_0x4e8366)['send'](_0x3ac023);};}exports['index']=function(_0xe5cff9,_0x2ba47c){var _0x210d58={},_0x399fa9={},_0x4ba85b={'count':0x0,'rows':[]};var _0xd27126=_[_0x35c6('0x28')](db['VoiceMusicOnHold'][_0x35c6('0x29')],function(_0xc869b0){return{'name':_0xc869b0[_0x35c6('0x2a')],'type':_0xc869b0[_0x35c6('0x2b')]['key']};});_0x399fa9[_0x35c6('0x2c')]=_[_0x35c6('0x28')](_0xd27126,_0x35c6('0x27'));_0x399fa9['query']=_[_0x35c6('0x2d')](_0xe5cff9[_0x35c6('0x2e')]);_0x399fa9[_0x35c6('0x2f')]=_['intersection'](_0x399fa9['model'],_0x399fa9[_0x35c6('0x2e')]);_0x210d58[_0x35c6('0x30')]=_['intersection'](_0x399fa9['model'],qs[_0x35c6('0x31')](_0xe5cff9[_0x35c6('0x2e')][_0x35c6('0x31')]));_0x210d58[_0x35c6('0x30')]=_0x210d58[_0x35c6('0x30')][_0x35c6('0x32')]?_0x210d58[_0x35c6('0x30')]:_0x399fa9['model'];if(!_0xe5cff9[_0x35c6('0x2e')][_0x35c6('0x33')](_0x35c6('0x34'))){_0x210d58[_0x35c6('0x1c')]=qs[_0x35c6('0x1c')](_0xe5cff9[_0x35c6('0x2e')]['limit']);_0x210d58[_0x35c6('0x35')]=qs[_0x35c6('0x35')](_0xe5cff9[_0x35c6('0x2e')][_0x35c6('0x35')]);}_0x210d58['order']=qs[_0x35c6('0x36')](_0xe5cff9[_0x35c6('0x2e')][_0x35c6('0x36')]);delete _0xe5cff9[_0x35c6('0x2e')][_0x35c6('0x36')];_0x210d58[_0x35c6('0x37')]=qs[_0x35c6('0x2f')](_['pick'](_0xe5cff9['query'],_0x399fa9[_0x35c6('0x2f')]),_0xd27126);if(_0xe5cff9[_0x35c6('0x2e')][_0x35c6('0x38')]){_0x210d58[_0x35c6('0x37')]=_[_0x35c6('0x39')](_0x210d58['where'],{'$or':_[_0x35c6('0x28')](_0xd27126,function(_0x29de27){if(_0x29de27[_0x35c6('0x2b')]!=='VIRTUAL'){var _0x19f4c5={};_0x19f4c5[_0x29de27['name']]={'$like':'%'+_0xe5cff9[_0x35c6('0x2e')]['filter']+'%'};return _0x19f4c5;}})});}_0x210d58=_['merge']({},_0x210d58,_0xe5cff9[_0x35c6('0x3a')]);var _0x38f354={'where':_0x210d58[_0x35c6('0x37')]};return db[_0x35c6('0x3b')][_0x35c6('0x1d')](_0x38f354)[_0x35c6('0x22')](function(_0x35178f){_0x4ba85b[_0x35c6('0x1d')]=_0x35178f;if(_0xe5cff9['query'][_0x35c6('0x3c')]){_0x210d58[_0x35c6('0x3d')]=[{'all':!![]}];}return db[_0x35c6('0x3b')][_0x35c6('0x3e')](_0x210d58);})[_0x35c6('0x22')](function(_0x1e3281){_0x4ba85b[_0x35c6('0x3f')]=_0x1e3281;return _0x4ba85b;})['then'](respondWithFilteredResult(_0x2ba47c,_0x210d58))['catch'](handleError(_0x2ba47c,null));};exports['show']=function(_0xc7919a,_0x540923){var _0x3a55c8={'raw':![],'where':{'id':_0xc7919a['params']['id']}},_0x28209b={};_0x28209b[_0x35c6('0x2c')]=_[_0x35c6('0x2d')](db[_0x35c6('0x3b')][_0x35c6('0x29')]);_0x28209b[_0x35c6('0x2e')]=_[_0x35c6('0x2d')](_0xc7919a['query']);_0x28209b[_0x35c6('0x2f')]=_[_0x35c6('0x40')](_0x28209b[_0x35c6('0x2c')],_0x28209b['query']);_0x3a55c8['attributes']=_[_0x35c6('0x40')](_0x28209b[_0x35c6('0x2c')],qs[_0x35c6('0x31')](_0xc7919a['query'][_0x35c6('0x31')]));_0x3a55c8[_0x35c6('0x30')]=_0x3a55c8['attributes']['length']?_0x3a55c8[_0x35c6('0x30')]:_0x28209b[_0x35c6('0x2c')];if(_0xc7919a[_0x35c6('0x2e')][_0x35c6('0x3c')]){_0x3a55c8[_0x35c6('0x3d')]=[{'all':!![]}];}_0x3a55c8=_['merge']({},_0x3a55c8,_0xc7919a['options']);return db['VoiceMusicOnHold'][_0x35c6('0x41')](_0x3a55c8)[_0x35c6('0x22')](handleEntityNotFound(_0x540923,null))[_0x35c6('0x22')](respondWithResult(_0x540923,null))[_0x35c6('0x42')](handleError(_0x540923,null));};exports['update']=function(_0x59738e,_0xb20f1b){if(_0x59738e[_0x35c6('0x43')]['id']){delete _0x59738e[_0x35c6('0x43')]['id'];}return db[_0x35c6('0x3b')][_0x35c6('0x41')]({'where':{'id':_0x59738e[_0x35c6('0x44')]['id']}})[_0x35c6('0x22')](handleEntityNotFound(_0xb20f1b,null))[_0x35c6('0x22')](saveUpdates(_0x59738e['body'],null))['then'](respondWithResult(_0xb20f1b,null))['catch'](handleError(_0xb20f1b,null));};exports[_0x35c6('0x45')]=function(_0x1b8542,_0x5e4d96,_0x5acb5f){return db['sequelize'][_0x35c6('0x46')](function(_0x324e4a){if(_0x1b8542['body'][_0x35c6('0x47')]==='files'){_0x1b8542[_0x35c6('0x43')][_0x35c6('0x48')]=path[_0x35c6('0x49')](config[_0x35c6('0x4a')],'server/files/moh',_0x1b8542[_0x35c6('0x43')]['name']);}return db[_0x35c6('0x3b')][_0x35c6('0x45')](_0x1b8542[_0x35c6('0x43')],{'transaction':_0x324e4a})[_0x35c6('0x22')](function(_0x101e71){if(_0x1b8542['body']['mode']===_0x35c6('0x4b')){fs['mkdirSync'](_0x101e71[_0x35c6('0x48')],parseInt(_0x35c6('0x4c'),0x8));}var _0xceffbc=_0x1b8542['user'][_0x35c6('0x24')]({'plain':!![]});if(!_0xceffbc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xceffbc[_0x35c6('0x4d')]===_0x35c6('0x4e')){var _0x4576fc=_0x101e71[_0x35c6('0x24')]({'plain':!![]});return db[_0x35c6('0x4f')][_0x35c6('0x41')]({'where':{'name':_0x35c6('0x25'),'userProfileId':_0xceffbc[_0x35c6('0x50')]},'raw':!![]})[_0x35c6('0x22')](function(_0x35d11a){if(_0x35d11a&&_0x35d11a[_0x35c6('0x51')]===0x0){return db[_0x35c6('0x52')][_0x35c6('0x45')]({'name':_0x4576fc[_0x35c6('0x27')],'resourceId':_0x4576fc['id'],'type':_0x35d11a[_0x35c6('0x27')],'sectionId':_0x35d11a['id']},{})[_0x35c6('0x22')](function(){return _0x101e71;});}else{return _0x101e71;}})[_0x35c6('0x42')](function(_0x8c6dfe){logger['error'](_0x35c6('0x53'),_0x8c6dfe);});}return _0x101e71;});})['then'](respondWithResult(_0x5e4d96,0xc9))[_0x35c6('0x42')](handleError(_0x5e4d96,null));};exports['destroy']=function(_0x271c27,_0x47585a,_0x13f8d4){var _0xdb75a5;return db[_0x35c6('0x3b')][_0x35c6('0x41')]({'where':{'id':_0x271c27[_0x35c6('0x44')]['id']}})[_0x35c6('0x22')](function(_0x356b55){if(_0x356b55){return db[_0x35c6('0x54')]['transaction'](function(_0x52c814){return _0x356b55[_0x35c6('0x23')]({'transaction':_0x52c814,'raw':!![]})[_0x35c6('0x22')](function(_0x259b2e){if(_0x259b2e['directory']){fs[_0x35c6('0x55')](_0x259b2e[_0x35c6('0x48')])[_0x35c6('0x56')](function(_0x54ae32){fs[_0x35c6('0x57')](path[_0x35c6('0x49')](_0x259b2e[_0x35c6('0x48')],_0x54ae32));});fs['rmdirSync'](_0x259b2e[_0x35c6('0x48')]);}return _0x259b2e;});})[_0x35c6('0x42')](function(_0x4bb6e7){throw new db[(_0x35c6('0x58'))]['ValidationError'](_0x4bb6e7[_0x35c6('0x59')]);});}})[_0x35c6('0x22')](handleEntityNotFound(_0x47585a,null))['then'](removeEntity(_0x47585a,null))[_0x35c6('0x42')](handleError(_0x47585a,null));};exports[_0x35c6('0x5a')]=function(_0x42e3bb,_0x662176,_0xa16608){return db[_0x35c6('0x54')][_0x35c6('0x46')](function(_0x2e503a){var _0x197986;return db[_0x35c6('0x3b')][_0x35c6('0x41')]({'where':{'id':_0x42e3bb[_0x35c6('0x44')]['id']}})[_0x35c6('0x22')](function(_0x101c7b){if(_0x101c7b){_0x197986=_0x101c7b;return _0x101c7b['addSound'](_0x42e3bb[_0x35c6('0x43')]['id'],{'transaction':_0x2e503a});}})[_0x35c6('0x22')](function(_0x57320e){if(_0x57320e){return db[_0x35c6('0x5b')]['findOne']({'where':{'id':_0x42e3bb[_0x35c6('0x43')]['id']},'attributes':['id',_0x35c6('0x27'),_0x35c6('0x5c'),_0x35c6('0x5d'),_0x35c6('0x5e')],'raw':!![]});}})[_0x35c6('0x22')](function(_0x40b97b){if(_0x40b97b){var _0x12bcbd=path['join'](config[_0x35c6('0x4a')],_0x35c6('0x5f'),util[_0x35c6('0x60')](_0x35c6('0x61'),path['basename'](_0x40b97b[_0x35c6('0x5c')],path[_0x35c6('0x62')](_0x40b97b[_0x35c6('0x5c')])),_0x40b97b[_0x35c6('0x5d')]));var _0x12ce4a=path[_0x35c6('0x49')](config[_0x35c6('0x4a')],'server/files/moh',_0x197986['name'],util[_0x35c6('0x60')](_0x35c6('0x61'),_0x40b97b[_0x35c6('0x27')],_0x40b97b[_0x35c6('0x5d')]));fs['symlinkSync'](_0x12bcbd,_0x12ce4a);return _0x40b97b;}})['catch'](function(_0x28aa7f){throw new db[(_0x35c6('0x58'))][(_0x35c6('0x63'))](_0x28aa7f[_0x35c6('0x59')]);});})[_0x35c6('0x22')](handleEntityNotFound(_0x662176,null))['then'](respondWithResult(_0x662176,0xc9))[_0x35c6('0x42')](handleError(_0x662176,null));};exports[_0x35c6('0x64')]=function(_0x4c5d91,_0x5bdbc1,_0x5c42fa){return db[_0x35c6('0x54')][_0x35c6('0x46')](function(_0x4d2c3c){var _0x59f0e8;return db['VoiceMusicOnHold'][_0x35c6('0x65')]({'where':{'id':_0x4c5d91[_0x35c6('0x44')]['id']}})['then'](handleEntityNotFound(_0x5bdbc1,null))[_0x35c6('0x22')](function(_0x29d8f4){if(_0x29d8f4){_0x59f0e8=_0x29d8f4;return _0x29d8f4[_0x35c6('0x64')](_0x4c5d91[_0x35c6('0x44')]['id2']);}})[_0x35c6('0x22')](function(_0x536c9e){if(_0x536c9e){return db[_0x35c6('0x5b')][_0x35c6('0x65')]({'where':{'id':_0x4c5d91[_0x35c6('0x44')]['id2']},'attributes':['id','name',_0x35c6('0x5c'),_0x35c6('0x5d'),_0x35c6('0x5e')],'raw':!![]});}})[_0x35c6('0x22')](function(_0x3bc10a){if(_0x3bc10a){fs['unlinkSync'](path['join'](_0x59f0e8[_0x35c6('0x48')],util[_0x35c6('0x60')](_0x35c6('0x61'),_0x3bc10a[_0x35c6('0x27')],_0x3bc10a['converted_format'])));return _0x3bc10a;}})[_0x35c6('0x42')](function(_0x43a768){throw new db[(_0x35c6('0x58'))][(_0x35c6('0x63'))](_0x43a768[_0x35c6('0x59')]);});})['then'](handleEntityNotFound(_0x5bdbc1,null))[_0x35c6('0x22')](respondWithStatusCode(_0x5bdbc1,0xcc))[_0x35c6('0x42')](handleError(_0x5bdbc1,null));};exports[_0x35c6('0x66')]=function(_0x31473c,_0x4a2175,_0x1c9ec1){var _0x13be9d={};var _0x7562a4={};var _0x8d8cd8;var _0x345f9a;return db[_0x35c6('0x3b')][_0x35c6('0x65')]({'where':{'id':_0x31473c[_0x35c6('0x44')]['id']}})[_0x35c6('0x22')](handleEntityNotFound(_0x4a2175,null))[_0x35c6('0x22')](function(_0x18b21b){if(_0x18b21b){_0x8d8cd8=_0x18b21b;_0x7562a4['model']=_[_0x35c6('0x2d')](db[_0x35c6('0x5b')][_0x35c6('0x29')]);_0x7562a4[_0x35c6('0x2e')]=_[_0x35c6('0x2d')](_0x31473c[_0x35c6('0x2e')]);_0x7562a4[_0x35c6('0x2f')]=_['intersection'](_0x7562a4[_0x35c6('0x2c')],_0x7562a4[_0x35c6('0x2e')]);_0x13be9d[_0x35c6('0x30')]=_[_0x35c6('0x40')](_0x7562a4[_0x35c6('0x2c')],qs[_0x35c6('0x31')](_0x31473c[_0x35c6('0x2e')][_0x35c6('0x31')]));_0x13be9d['attributes']=_0x13be9d[_0x35c6('0x30')][_0x35c6('0x32')]?_0x13be9d[_0x35c6('0x30')]:_0x7562a4[_0x35c6('0x2c')];_0x13be9d['order']=qs[_0x35c6('0x36')](_0x31473c[_0x35c6('0x2e')][_0x35c6('0x36')]);_0x13be9d[_0x35c6('0x37')]=qs[_0x35c6('0x2f')](_['pick'](_0x31473c['query'],_0x7562a4[_0x35c6('0x2f')]));if(_0x31473c[_0x35c6('0x2e')]['filter']){_0x13be9d[_0x35c6('0x37')]=_[_0x35c6('0x39')](_0x13be9d[_0x35c6('0x37')],{'$or':_[_0x35c6('0x28')](_0x13be9d[_0x35c6('0x30')],function(_0x7d983f){var _0x4a4efd={};_0x4a4efd[_0x7d983f]={'$like':'%'+_0x31473c[_0x35c6('0x2e')][_0x35c6('0x38')]+'%'};return _0x4a4efd;})});}_0x13be9d=_['merge']({},_0x13be9d,_0x31473c['options']);return _0x8d8cd8[_0x35c6('0x66')](_0x13be9d);}})['then'](function(_0xa46722){if(_0xa46722){_0x345f9a=_0xa46722[_0x35c6('0x32')];if(!_0x31473c['query']['hasOwnProperty']('nolimit')){_0x13be9d[_0x35c6('0x1c')]=qs[_0x35c6('0x1c')](_0x31473c[_0x35c6('0x2e')][_0x35c6('0x1c')]);_0x13be9d[_0x35c6('0x35')]=qs[_0x35c6('0x35')](_0x31473c[_0x35c6('0x2e')][_0x35c6('0x35')]);}return _0x8d8cd8[_0x35c6('0x66')](_0x13be9d);}})[_0x35c6('0x22')](function(_0x2f5856){if(_0x2f5856){return _0x2f5856?{'count':_0x345f9a,'rows':_0x2f5856}:null;}})['then'](respondWithResult(_0x4a2175,null))[_0x35c6('0x42')](handleError(_0x4a2175,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 8bbe22b..eb6b211 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 _0xeb0c=['api','bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xeb0c,0x1de));var _0xceb0=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xeb0c[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require(_0xceb0('0x0'));var util=require('util');var logger=require(_0xceb0('0x1'))(_0xceb0('0x2'));var moment=require('moment');var BPromise=require(_0xceb0('0x3'));var rp=require(_0xceb0('0x4'));var fs=require('fs');var path=require(_0xceb0('0x5'));var rimraf=require('rimraf');var config=require(_0xceb0('0x6'));var attributes=require(_0xceb0('0x7'));module[_0xceb0('0x8')]=function(_0x333b1f,_0x1334b4){return _0x333b1f[_0xceb0('0x9')](_0xceb0('0xa'),attributes,{'tableName':_0xceb0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b91=['path','rimraf','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1715be,_0x3a59f5){var _0x264c37=function(_0x2decb3){while(--_0x2decb3){_0x1715be['push'](_0x1715be['shift']());}};_0x264c37(++_0x3a59f5);}(_0x0b91,0x12d));var _0x10b9=function(_0x440e36,_0x47b615){_0x440e36=_0x440e36-0x0;var _0x97921e=_0x0b91[_0x440e36];return _0x97921e;};'use strict';var _=require(_0x10b9('0x0'));var util=require(_0x10b9('0x1'));var logger=require(_0x10b9('0x2'))(_0x10b9('0x3'));var moment=require(_0x10b9('0x4'));var BPromise=require(_0x10b9('0x5'));var rp=require(_0x10b9('0x6'));var fs=require('fs');var path=require(_0x10b9('0x7'));var rimraf=require(_0x10b9('0x8'));var config=require(_0x10b9('0x9'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x10b9('0xa')]=function(_0x5da2f1,_0x19ee44){return _0x5da2f1[_0x10b9('0xb')](_0x10b9('0xc'),attributes,{'tableName':_0x10b9('0xd'),'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 1fb9941..5e0d9a3 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xb3d8e8,_0x455772){var _0x5f4d40=function(_0x5d04a8){while(--_0x5d04a8){_0xb3d8e8['push'](_0xb3d8e8['shift']());}};_0x5f4d40(++_0x455772);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1a6e20,_0x584ca0){var _0x2464d4=function(_0x13bc6d){while(--_0x13bc6d){_0x1a6e20['push'](_0x1a6e20['shift']());}};_0x2464d4(++_0x584ca0);}(_0xe706,0xa3));var _0x6e70=function(_0x27a824,_0x50dc82){_0x27a824=_0x27a824-0x0;var _0x5a1a7b=_0xe706[_0x27a824];return _0x5a1a7b;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 8161aa9..976e91d 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 _0x6d6f=['post','create','addAgents','put','update','removeAgents','delete','removeTeams','exports','connect-timeout','express','Router','../../components/auth/service','./voicePrefix.controller','isAuthenticated','get','/:id','show','/:id/users','/:id/teams','getTeams'];(function(_0xe04198,_0x1bd4ab){var _0x1a9526=function(_0x162988){while(--_0x162988){_0xe04198['push'](_0xe04198['shift']());}};_0x1a9526(++_0x1bd4ab);}(_0x6d6f,0x159));var _0xf6d6=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0x6d6f[_0x17bb31];return _0x505c71;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf6d6('0x0'));var express=require(_0xf6d6('0x1'));var router=express[_0xf6d6('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf6d6('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf6d6('0x4'));router['get']('/',auth[_0xf6d6('0x5')](),controller['index']);router['get']('/describe',auth[_0xf6d6('0x5')](),controller['describe']);router[_0xf6d6('0x6')](_0xf6d6('0x7'),auth[_0xf6d6('0x5')](),controller[_0xf6d6('0x8')]);router[_0xf6d6('0x6')](_0xf6d6('0x9'),auth[_0xf6d6('0x5')](),controller['getAgents']);router[_0xf6d6('0x6')](_0xf6d6('0xa'),auth[_0xf6d6('0x5')](),controller[_0xf6d6('0xb')]);router[_0xf6d6('0xc')]('/',auth['isAuthenticated'](),controller[_0xf6d6('0xd')]);router['post']('/:id/users',auth[_0xf6d6('0x5')](),controller[_0xf6d6('0xe')]);router[_0xf6d6('0xc')](_0xf6d6('0xa'),auth['isAuthenticated'](),controller['addTeams']);router[_0xf6d6('0xf')](_0xf6d6('0x7'),auth[_0xf6d6('0x5')](),controller[_0xf6d6('0x10')]);router['delete'](_0xf6d6('0x7'),auth[_0xf6d6('0x5')](),controller['destroy']);router['delete']('/:id/users',auth[_0xf6d6('0x5')](),controller[_0xf6d6('0x11')]);router[_0xf6d6('0x12')](_0xf6d6('0xa'),auth[_0xf6d6('0x5')](),controller[_0xf6d6('0x13')]);module[_0xf6d6('0x14')]=router; \ No newline at end of file +var _0xdf67=['isAuthenticated','/describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xdf67,0x117));var _0x7df6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf67[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7df6('0x0'));var util=require(_0x7df6('0x1'));var path=require(_0x7df6('0x2'));var timeout=require(_0x7df6('0x3'));var express=require('express');var router=express[_0x7df6('0x4')]();var fs_extra=require(_0x7df6('0x5'));var auth=require(_0x7df6('0x6'));var interaction=require(_0x7df6('0x7'));var config=require(_0x7df6('0x8'));var controller=require(_0x7df6('0x9'));router[_0x7df6('0xa')]('/',auth[_0x7df6('0xb')](),controller['index']);router[_0x7df6('0xa')](_0x7df6('0xc'),auth[_0x7df6('0xb')](),controller['describe']);router[_0x7df6('0xa')](_0x7df6('0xd'),auth[_0x7df6('0xb')](),controller[_0x7df6('0xe')]);router[_0x7df6('0xa')](_0x7df6('0xf'),auth['isAuthenticated'](),controller[_0x7df6('0x10')]);router[_0x7df6('0xa')](_0x7df6('0x11'),auth[_0x7df6('0xb')](),controller[_0x7df6('0x12')]);router[_0x7df6('0x13')]('/',auth['isAuthenticated'](),controller[_0x7df6('0x14')]);router[_0x7df6('0x13')](_0x7df6('0xf'),auth[_0x7df6('0xb')](),controller[_0x7df6('0x15')]);router[_0x7df6('0x13')]('/:id/teams',auth[_0x7df6('0xb')](),controller[_0x7df6('0x16')]);router[_0x7df6('0x17')](_0x7df6('0xd'),auth[_0x7df6('0xb')](),controller[_0x7df6('0x18')]);router[_0x7df6('0x19')]('/:id',auth[_0x7df6('0xb')](),controller['destroy']);router[_0x7df6('0x19')](_0x7df6('0xf'),auth[_0x7df6('0xb')](),controller[_0x7df6('0x1a')]);router[_0x7df6('0x19')](_0x7df6('0x11'),auth[_0x7df6('0xb')](),controller[_0x7df6('0x1b')]);module[_0x7df6('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 10a8e3b..9a89605 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 _0x8db3=['getDataValue','exports','STRING','VIRTUAL','system-'];(function(_0xbc1bfb,_0x552523){var _0x37954d=function(_0x5ebafb){while(--_0x5ebafb){_0xbc1bfb['push'](_0xbc1bfb['shift']());}};_0x37954d(++_0x552523);}(_0x8db3,0x13c));var _0x38db=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x8db3[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require('sequelize');module[_0x38db('0x0')]={'name':{'type':Sequelize[_0x38db('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x38db('0x2')],'get':function(_0x4e4d69){return _0x38db('0x3')+this[_0x38db('0x4')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x38db('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x59f7=['INTEGER','exports','name','VIRTUAL','system-','getDataValue','STRING'];(function(_0x55a3a6,_0x565802){var _0x398a8f=function(_0x447d57){while(--_0x447d57){_0x55a3a6['push'](_0x55a3a6['shift']());}};_0x398a8f(++_0x565802);}(_0x59f7,0xa2));var _0x759f=function(_0x432795,_0x68ec4){_0x432795=_0x432795-0x0;var _0x18629a=_0x59f7[_0x432795];return _0x18629a;};'use strict';var Sequelize=require('sequelize');module[_0x759f('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x759f('0x1')},'prefix':{'type':Sequelize[_0x759f('0x2')],'get':function(_0x15878f){return _0x759f('0x3')+this[_0x759f('0x4')](_0x759f('0x1'))+'-';}},'description':{'type':Sequelize[_0x759f('0x5')]},'callerIdAll':{'type':Sequelize[_0x759f('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x759f('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5cac0e7..06c3bf2 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 _0x8f59=['../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','includeAll','find','describe','create','sequelize','transaction','body','VoiceExtensionId','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','priority','appdata','VoicePrefixId','VoiceExtension','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','params','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','Team','getTeams','Agents','online','voicePause','interface','flatMap','addTeams','each','TeamVoicePrefix','upsert','findOrCreate','forEach','removeTeams','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','compact','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service'];(function(_0x47d80a,_0x420364){var _0x43405b=function(_0x22ce2b){while(--_0x22ce2b){_0x47d80a['push'](_0x47d80a['shift']());}};_0x43405b(++_0x420364);}(_0x8f59,0x11d));var _0x98f5=function(_0x4d9a93,_0x547671){_0x4d9a93=_0x4d9a93-0x0;var _0xe200a0=_0x8f59[_0x4d9a93];return _0xe200a0;};'use strict';var emlformat=require(_0x98f5('0x0'));var rimraf=require(_0x98f5('0x1'));var zipdir=require(_0x98f5('0x2'));var jsonpatch=require(_0x98f5('0x3'));var rp=require(_0x98f5('0x4'));var moment=require(_0x98f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x98f5('0x6'));var util=require(_0x98f5('0x7'));var path=require(_0x98f5('0x8'));var sox=require(_0x98f5('0x9'));var csv=require('to-csv');var ejs=require(_0x98f5('0xa'));var fs=require('fs');var fs_extra=require(_0x98f5('0xb'));var _=require(_0x98f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0xf'));var querystring=require('querystring');var Papa=require(_0x98f5('0x10'));var Redis=require(_0x98f5('0x11'));var authService=require(_0x98f5('0x12'));var qs=require(_0x98f5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98f5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x98f5('0x15'));var config=require(_0x98f5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x98f5('0x17'))['db'];config[_0x98f5('0x18')]=_[_0x98f5('0x19')](config[_0x98f5('0x18')],{'host':_0x98f5('0x1a'),'port':0x18eb});var socket=require(_0x98f5('0x1b'))(new Redis(config['redis']));require(_0x98f5('0x1c'))[_0x98f5('0x1d')](socket);function respondWithStatusCode(_0x5b8bab,_0x9df84){_0x9df84=_0x9df84||0xcc;return function(_0x3d6b5c){if(_0x3d6b5c){return _0x5b8bab[_0x98f5('0x1e')](_0x9df84);}return _0x5b8bab['status'](_0x9df84)[_0x98f5('0x1f')]();};}function respondWithResult(_0xc7a49b,_0x113545){_0x113545=_0x113545||0xc8;return function(_0x5bb486){if(_0x5bb486){return _0xc7a49b[_0x98f5('0x20')](_0x113545)[_0x98f5('0x21')](_0x5bb486);}};}function respondWithFilteredResult(_0x574644,_0x1df52d){return function(_0x51a567){if(_0x51a567){var _0x10c57c=typeof _0x1df52d[_0x98f5('0x22')]===_0x98f5('0x23')&&typeof _0x1df52d[_0x98f5('0x24')]===_0x98f5('0x23');var _0xa4477c=_0x51a567['count'];var _0xf88f34=_0x10c57c?0x0:_0x1df52d['offset'];var _0xd1209d=_0x10c57c?_0x51a567[_0x98f5('0x25')]:_0x1df52d['offset']+_0x1df52d[_0x98f5('0x24')];var _0x2933d1;if(_0xd1209d>=_0xa4477c){_0xd1209d=_0xa4477c;_0x2933d1=0xc8;}else{_0x2933d1=0xce;}_0x574644[_0x98f5('0x20')](_0x2933d1);return _0x574644[_0x98f5('0x26')](_0x98f5('0x27'),_0xf88f34+'-'+_0xd1209d+'/'+_0xa4477c)[_0x98f5('0x21')](_0x51a567);}return null;};}function patchUpdates(_0x38b46d){return function(_0x5ac2b7){try{jsonpatch[_0x98f5('0x28')](_0x5ac2b7,_0x38b46d,!![]);}catch(_0x49ee4e){return BPromise[_0x98f5('0x29')](_0x49ee4e);}return _0x5ac2b7['save']();};}function saveUpdates(_0x44bfbb,_0x40c69b){return function(_0x106b24){if(_0x106b24){return _0x106b24[_0x98f5('0x2a')](_0x44bfbb)[_0x98f5('0x2b')](function(_0x18052d){return _0x18052d;});}return null;};}function removeEntity(_0x46dbd4,_0x58d506){return function(_0x27a533){if(_0x27a533){return _0x27a533[_0x98f5('0x2c')]()['then'](function(){var _0x1a1c55=_0x27a533[_0x98f5('0x2d')]({'plain':!![]});var _0x5b08c2=_0x98f5('0x2e');return db[_0x98f5('0x2f')][_0x98f5('0x2c')]({'where':{'type':_0x5b08c2,'resourceId':_0x1a1c55['id']}})[_0x98f5('0x2b')](function(){return _0x27a533;});})[_0x98f5('0x2b')](function(){_0x46dbd4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x428c85,_0x71661e){return function(_0x18bb29){if(!_0x18bb29){_0x428c85[_0x98f5('0x1e')](0x194);}return _0x18bb29;};}function handleError(_0x15bf92,_0x1ae531){_0x1ae531=_0x1ae531||0x1f4;return function(_0x5e9d73){logger[_0x98f5('0x30')](_0x5e9d73[_0x98f5('0x31')]);if(_0x5e9d73[_0x98f5('0x32')]){delete _0x5e9d73[_0x98f5('0x32')];}_0x15bf92[_0x98f5('0x20')](_0x1ae531)[_0x98f5('0x33')](_0x5e9d73);};}exports['index']=function(_0x1e7027,_0x4d4b5c){var _0x229495={},_0x1e193c={},_0x492771={'count':0x0,'rows':[]};var _0x45ca95=_[_0x98f5('0x34')](db[_0x98f5('0x35')][_0x98f5('0x36')],function(_0x45e55c){return{'name':_0x45e55c[_0x98f5('0x37')],'type':_0x45e55c[_0x98f5('0x38')][_0x98f5('0x39')]};});_0x1e193c[_0x98f5('0x3a')]=_[_0x98f5('0x34')](_0x45ca95,_0x98f5('0x32'));_0x1e193c[_0x98f5('0x3b')]=_[_0x98f5('0x3c')](_0x1e7027[_0x98f5('0x3b')]);_0x1e193c[_0x98f5('0x3d')]=_[_0x98f5('0x3e')](_0x1e193c[_0x98f5('0x3a')],_0x1e193c[_0x98f5('0x3b')]);_0x229495[_0x98f5('0x3f')]=_[_0x98f5('0x3e')](_0x1e193c['model'],qs[_0x98f5('0x40')](_0x1e7027['query']['fields']));_0x229495[_0x98f5('0x3f')]=_0x229495[_0x98f5('0x3f')][_0x98f5('0x41')]?_0x229495[_0x98f5('0x3f')]:_0x1e193c['model'];if(!_0x1e7027[_0x98f5('0x3b')][_0x98f5('0x42')](_0x98f5('0x43'))){_0x229495['limit']=qs[_0x98f5('0x24')](_0x1e7027[_0x98f5('0x3b')]['limit']);_0x229495[_0x98f5('0x22')]=qs[_0x98f5('0x22')](_0x1e7027[_0x98f5('0x3b')]['offset']);}_0x229495[_0x98f5('0x44')]=qs[_0x98f5('0x45')](_0x1e7027[_0x98f5('0x3b')][_0x98f5('0x45')]);_0x229495[_0x98f5('0x46')]=qs['filters'](_['pick'](_0x1e7027[_0x98f5('0x3b')],_0x1e193c[_0x98f5('0x3d')]),_0x45ca95);if(_0x1e7027[_0x98f5('0x3b')][_0x98f5('0x47')]){_0x229495[_0x98f5('0x46')]=_[_0x98f5('0x48')](_0x229495['where'],{'$or':_['map'](_0x45ca95,function(_0x3f6394){if(_0x3f6394[_0x98f5('0x38')]!==_0x98f5('0x49')){var _0x2f9638={};_0x2f9638[_0x3f6394['name']]={'$like':'%'+_0x1e7027['query'][_0x98f5('0x47')]+'%'};return _0x2f9638;}})});}_0x229495=_[_0x98f5('0x48')]({},_0x229495,_0x1e7027[_0x98f5('0x4a')]);var _0x110aa7={'where':_0x229495['where']};return db['VoicePrefix'][_0x98f5('0x25')](_0x110aa7)[_0x98f5('0x2b')](function(_0x372c33){_0x492771['count']=_0x372c33;if(_0x1e7027[_0x98f5('0x3b')]['includeAll']){_0x229495[_0x98f5('0x4b')]=[{'all':!![]}];}return db['VoicePrefix'][_0x98f5('0x4c')](_0x229495);})[_0x98f5('0x2b')](function(_0x1b8d40){_0x492771['rows']=_0x1b8d40;return _0x492771;})[_0x98f5('0x2b')](respondWithFilteredResult(_0x4d4b5c,_0x229495))[_0x98f5('0x4d')](handleError(_0x4d4b5c,null));};exports['show']=function(_0x3b5dee,_0xd27e7c){var _0x5ed787={'raw':![],'where':{'id':_0x3b5dee['params']['id']}},_0x42ec3e={};_0x42ec3e[_0x98f5('0x3a')]=_[_0x98f5('0x3c')](db['VoicePrefix']['rawAttributes']);_0x42ec3e['query']=_['keys'](_0x3b5dee[_0x98f5('0x3b')]);_0x42ec3e['filters']=_[_0x98f5('0x3e')](_0x42ec3e[_0x98f5('0x3a')],_0x42ec3e[_0x98f5('0x3b')]);_0x5ed787[_0x98f5('0x3f')]=_[_0x98f5('0x3e')](_0x42ec3e[_0x98f5('0x3a')],qs['fields'](_0x3b5dee[_0x98f5('0x3b')][_0x98f5('0x40')]));_0x5ed787[_0x98f5('0x3f')]=_0x5ed787[_0x98f5('0x3f')][_0x98f5('0x41')]?_0x5ed787[_0x98f5('0x3f')]:_0x42ec3e['model'];if(_0x3b5dee[_0x98f5('0x3b')][_0x98f5('0x4e')]){_0x5ed787[_0x98f5('0x4b')]=[{'all':!![]}];}_0x5ed787=_[_0x98f5('0x48')]({},_0x5ed787,_0x3b5dee['options']);return db[_0x98f5('0x35')][_0x98f5('0x4f')](_0x5ed787)[_0x98f5('0x2b')](handleEntityNotFound(_0xd27e7c,null))[_0x98f5('0x2b')](respondWithResult(_0xd27e7c,null))[_0x98f5('0x4d')](handleError(_0xd27e7c,null));};exports['destroy']=function(_0x8d7ebd,_0x254005){return db['VoicePrefix'][_0x98f5('0x4f')]({'where':{'id':_0x8d7ebd['params']['id']}})[_0x98f5('0x2b')](handleEntityNotFound(_0x254005,null))['then'](removeEntity(_0x254005,null))[_0x98f5('0x4d')](handleError(_0x254005,null));};exports[_0x98f5('0x50')]=function(_0x3114a4,_0x5b495e){return db[_0x98f5('0x35')][_0x98f5('0x50')]()[_0x98f5('0x2b')](respondWithResult(_0x5b495e,null))[_0x98f5('0x4d')](handleError(_0x5b495e,null));};exports[_0x98f5('0x51')]=function(_0xf39073,_0x37e620){var _0x1891ac;return db[_0x98f5('0x52')][_0x98f5('0x53')](function(_0x50343c){return db[_0x98f5('0x35')][_0x98f5('0x51')](_0xf39073[_0x98f5('0x54')],{'transaction':_0x50343c})[_0x98f5('0x2b')](function(_0x1289a7){_0x1891ac=_0x1289a7[_0x98f5('0x2d')]({'plain':!![]});return db['VoiceExtension'][_0x98f5('0x4f')]({'where':{'id':_0x1891ac[_0x98f5('0x55')]},'raw':!![]})[_0x98f5('0x2b')](function(_0x4663f2){return createVoicePrefixExtensions(_0x1891ac,_0x4663f2,_0x50343c);});});})[_0x98f5('0x2b')](function(){var _0x15c514=_0xf39073['user']['get']({'plain':!![]});if(!_0x15c514)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15c514[_0x98f5('0x56')]===_0x98f5('0x57')){var _0x372c49=_0x1891ac;return db[_0x98f5('0x58')]['find']({'where':{'name':_0x98f5('0x2e'),'userProfileId':_0x15c514['userProfileId']},'raw':!![]})[_0x98f5('0x2b')](function(_0x583be6){if(_0x583be6&&_0x583be6['autoAssociation']===0x0){return db[_0x98f5('0x2f')][_0x98f5('0x51')]({'name':_0x372c49[_0x98f5('0x32')],'resourceId':_0x372c49['id'],'type':_0x583be6['name'],'sectionId':_0x583be6['id']},{})['then'](function(){return _0x1891ac;});}else{return _0x1891ac;}})[_0x98f5('0x4d')](function(_0x139ca3){logger['error'](_0x98f5('0x59'),_0x139ca3);throw _0x139ca3;});}return _0x1891ac;})[_0x98f5('0x2b')](respondWithResult(_0x37e620,null))['catch'](handleError(_0x37e620,null));};function Extension(_0x400f32,_0x974509,_0x8e6975,_0x53249f){this[_0x98f5('0x5a')]=_0x98f5('0x5b');this[_0x98f5('0x5c')]=_0x400f32;this[_0x98f5('0x5d')]=_0x8e6975;this[_0x98f5('0x38')]=_0x98f5('0x5e');this[_0x98f5('0x5f')]='Voice\x20Prefix\x20Extension';this[_0x98f5('0x60')]=_0x974509;this[_0x98f5('0x61')]=_0x53249f;}function createVoicePrefixExtensions(_0x3f2da8,_0x58041d,_0x577552){return new BPromise(function(_0x43b8de,_0x43edfc){var _0x5ae48c=new Extension(formatPrefixName(_0x3f2da8['prefix']),0x1,'NoOp','Voice\x20Prefix');_0x5ae48c[_0x98f5('0x62')]=_0x3f2da8['id'];return db['VoiceExtension'][_0x98f5('0x51')](_0x5ae48c,{'transaction':_0x577552})[_0x98f5('0x2b')](function(_0x44149f){var _0x368567=_0x44149f[_0x98f5('0x2d')]({'plain':!![]});var _0x26cc86=_[_0x98f5('0x34')](addVoicePrefixExtensions(_0x3f2da8,_0x58041d),function(_0x9758e8){_0x9758e8['VoiceExtensionId']=_0x368567['id'];_0x9758e8['VoicePrefixId']=_0x3f2da8['id'];return _0x9758e8;});return db[_0x98f5('0x63')]['bulkCreate'](_0x26cc86,{'transaction':_0x577552})[_0x98f5('0x2b')](function(_0x4ae63d){if(!_0x4ae63d){return _0x43edfc(_0x98f5('0x64'));}else{return _0x43b8de(_0x4ae63d);}})['catch'](function(_0x1cd03f){return _0x43edfc(_0x1cd03f);});});;});};function addVoicePrefixExtensions(_0x56b308,_0x4a1de1){var _0x595aee=[];var _0x2d9cd8=formatPrefixName(_0x56b308['prefix']);_0x595aee[_0x98f5('0x65')](new Extension(_0x2d9cd8,0x2,_0x98f5('0x66'),_0x98f5('0x67')+_0x56b308['name']));if(_0x56b308['callerIdAll']){_0x595aee['push'](new Extension(_0x2d9cd8,0x3,_0x98f5('0x66'),_0x98f5('0x68')+_0x56b308['callerIdAll']));}else{_0x595aee['push'](new Extension(_0x2d9cd8,0x3,_0x98f5('0x69'),_0x98f5('0x6a')));}_0x595aee[_0x98f5('0x65')](new Extension(_0x2d9cd8,0x4,_0x98f5('0x6b'),_0x4a1de1[_0x98f5('0x5a')]+','+_0x98f5('0x6c')+(0x8+_0x56b308[_0x98f5('0x32')][_0x98f5('0x41')])+'}'+','+0x1));return _0x595aee;}function formatPrefixName(_0x139d2c){var _0x4fc5d6='_';for(var _0x35e965=0x0;_0x35e965<_0x139d2c[_0x98f5('0x41')];_0x35e965++){if(_0x139d2c[_0x98f5('0x6d')](_0x35e965)=='-'){_0x4fc5d6+=_0x139d2c[_0x98f5('0x6d')](_0x35e965);}else{_0x4fc5d6+='['+_0x139d2c['charAt'](_0x35e965)+']';}}_0x4fc5d6+='.';return _0x4fc5d6;}exports[_0x98f5('0x2a')]=function(_0x48b175,_0x42c7a6,_0x5760b3){var _0x1d54d8=_0x48b175[_0x98f5('0x54')];_0x1d54d8['prefix']=_0x98f5('0x6e')+_0x1d54d8[_0x98f5('0x32')]+'-';return db[_0x98f5('0x52')]['transaction'](function(_0x45413e){return db[_0x98f5('0x35')][_0x98f5('0x2a')](_0x1d54d8,{'where':{'id':_0x1d54d8['id']},'transaction':_0x45413e})[_0x98f5('0x2b')](function(){return db[_0x98f5('0x63')][_0x98f5('0x2c')]({'where':{'VoicePrefixId':_0x1d54d8['id']},'transaction':_0x45413e})[_0x98f5('0x2b')](function(){return db[_0x98f5('0x63')][_0x98f5('0x4f')]({'where':{'id':_0x1d54d8['VoiceExtensionId']},'raw':!![]})[_0x98f5('0x2b')](function(_0x486ff6){return createVoicePrefixExtensions(_0x1d54d8,_0x486ff6,_0x45413e);});});});})[_0x98f5('0x2b')](function(){return db[_0x98f5('0x35')][_0x98f5('0x6f')](_0x1d54d8['id']);})[_0x98f5('0x2b')](respondWithResult(_0x42c7a6,null))['catch'](handleError(_0x42c7a6,null));};exports[_0x98f5('0x70')]=function(_0x23bf5f,_0x57b9c1,_0x540c00){return db['VoicePrefix'][_0x98f5('0x4f')]({'where':{'id':_0x23bf5f[_0x98f5('0x71')]['id']}})[_0x98f5('0x2b')](handleEntityNotFound(_0x57b9c1,null))[_0x98f5('0x2b')](function(_0x5427a3){if(_0x5427a3){return _0x5427a3['addAgents'](_0x23bf5f[_0x98f5('0x54')][_0x98f5('0x72')],_['omit'](_0x23bf5f[_0x98f5('0x54')],[_0x98f5('0x72'),'id'])||{})[_0x98f5('0x73')](function(_0x28aa43){for(var _0x258ee7=0x0;_0x258ee7<_0x23bf5f[_0x98f5('0x54')][_0x98f5('0x72')][_0x98f5('0x41')];_0x258ee7+=0x1){socket[_0x98f5('0x74')](_0x98f5('0x75'),{'UserId':Number(_0x23bf5f[_0x98f5('0x54')]['ids'][_0x258ee7]),'VoicePrefixId':Number(_0x23bf5f['params']['id'])});}return _0x28aa43;});}})[_0x98f5('0x2b')](respondWithResult(_0x57b9c1,null))[_0x98f5('0x4d')](handleError(_0x57b9c1,null));};exports[_0x98f5('0x76')]=function(_0x54c7f9,_0x28d910,_0x3303d4){return db['VoicePrefix'][_0x98f5('0x4f')]({'where':{'id':_0x54c7f9[_0x98f5('0x71')]['id']}})['then'](handleEntityNotFound(_0x28d910,null))['then'](function(_0x4dfef7){if(_0x4dfef7){return _0x4dfef7['removeAgents'](_0x54c7f9[_0x98f5('0x3b')][_0x98f5('0x72')])['then'](function(){if(_[_0x98f5('0x77')](_0x54c7f9[_0x98f5('0x3b')]['ids'])){for(var _0x2afe1d=0x0;_0x2afe1d<_0x54c7f9['query']['ids'][_0x98f5('0x41')];_0x2afe1d+=0x1){socket[_0x98f5('0x74')](_0x98f5('0x78'),{'UserId':Number(_0x54c7f9[_0x98f5('0x3b')]['ids'][_0x2afe1d]),'VoicePrefixId':Number(_0x54c7f9[_0x98f5('0x71')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x54c7f9['query'][_0x98f5('0x72')]),'VoicePrefixId':Number(_0x54c7f9[_0x98f5('0x71')]['id'])});}});}})[_0x98f5('0x2b')](respondWithStatusCode(_0x28d910,null))[_0x98f5('0x4d')](handleError(_0x28d910,null));};exports[_0x98f5('0x79')]=function(_0x3ab0dc,_0x36048c,_0x11e72a){var _0x1a3a76={};var _0x2aa9a4={};var _0x485a15;var _0x40b6fa;return db[_0x98f5('0x35')][_0x98f5('0x7a')]({'where':{'id':_0x3ab0dc[_0x98f5('0x71')]['id']}})['then'](handleEntityNotFound(_0x36048c,null))[_0x98f5('0x2b')](function(_0x1aba52){if(_0x1aba52){_0x485a15=_0x1aba52;_0x2aa9a4['model']=_[_0x98f5('0x3c')](db[_0x98f5('0x7b')][_0x98f5('0x36')]);_0x2aa9a4['query']=_[_0x98f5('0x3c')](_0x3ab0dc[_0x98f5('0x3b')]);_0x2aa9a4[_0x98f5('0x3d')]=_[_0x98f5('0x3e')](_0x2aa9a4[_0x98f5('0x3a')],_0x2aa9a4[_0x98f5('0x3b')]);_0x1a3a76['attributes']=_['intersection'](_0x2aa9a4[_0x98f5('0x3a')],qs[_0x98f5('0x40')](_0x3ab0dc[_0x98f5('0x3b')][_0x98f5('0x40')]));_0x1a3a76['attributes']=_0x1a3a76[_0x98f5('0x3f')][_0x98f5('0x41')]?_0x1a3a76['attributes']:_0x2aa9a4['model'];_0x1a3a76[_0x98f5('0x44')]=qs['sort'](_0x3ab0dc[_0x98f5('0x3b')][_0x98f5('0x45')]);_0x1a3a76[_0x98f5('0x46')]=qs['filters'](_[_0x98f5('0x7c')](_0x3ab0dc[_0x98f5('0x3b')],_0x2aa9a4['filters']));if(_0x3ab0dc[_0x98f5('0x3b')][_0x98f5('0x47')]){_0x1a3a76[_0x98f5('0x46')]=_[_0x98f5('0x48')](_0x1a3a76['where'],{'$or':_['map'](_0x1a3a76[_0x98f5('0x3f')],function(_0x1e32f1){var _0x514dea={};_0x514dea[_0x1e32f1]={'$like':'%'+_0x3ab0dc[_0x98f5('0x3b')][_0x98f5('0x47')]+'%'};return _0x514dea;})});}_0x1a3a76=_[_0x98f5('0x48')]({},_0x1a3a76,_0x3ab0dc['options']);return _0x485a15[_0x98f5('0x79')](_0x1a3a76);}})[_0x98f5('0x2b')](function(_0x2de7e7){if(_0x2de7e7){_0x40b6fa=_0x2de7e7[_0x98f5('0x41')];if(!_0x3ab0dc['query'][_0x98f5('0x42')]('nolimit')){_0x1a3a76[_0x98f5('0x24')]=qs[_0x98f5('0x24')](_0x3ab0dc['query'][_0x98f5('0x24')]);_0x1a3a76[_0x98f5('0x22')]=qs[_0x98f5('0x22')](_0x3ab0dc[_0x98f5('0x3b')]['offset']);}return _0x485a15[_0x98f5('0x79')](_0x1a3a76);}})['then'](function(_0x6c3951){if(_0x6c3951){return _0x6c3951?{'count':_0x40b6fa,'rows':_0x6c3951}:null;}})['then'](respondWithResult(_0x36048c,null))[_0x98f5('0x4d')](handleError(_0x36048c,null));};exports['getTeams']=function(_0x1ba9a2,_0x193cbb,_0x3a411f){var _0x1a04f6={};var _0x40eb2f={};var _0x421e3c;var _0x1e28b7;return db[_0x98f5('0x35')][_0x98f5('0x7a')]({'where':{'id':_0x1ba9a2[_0x98f5('0x71')]['id']}})[_0x98f5('0x2b')](handleEntityNotFound(_0x193cbb,null))[_0x98f5('0x2b')](function(_0x5bec4f){if(_0x5bec4f){_0x421e3c=_0x5bec4f;_0x40eb2f['model']=_[_0x98f5('0x3c')](db[_0x98f5('0x7d')]['rawAttributes']);_0x40eb2f[_0x98f5('0x3b')]=_[_0x98f5('0x3c')](_0x1ba9a2[_0x98f5('0x3b')]);_0x40eb2f[_0x98f5('0x3d')]=_[_0x98f5('0x3e')](_0x40eb2f[_0x98f5('0x3a')],_0x40eb2f['query']);_0x1a04f6[_0x98f5('0x3f')]=_[_0x98f5('0x3e')](_0x40eb2f[_0x98f5('0x3a')],qs[_0x98f5('0x40')](_0x1ba9a2[_0x98f5('0x3b')][_0x98f5('0x40')]));_0x1a04f6['attributes']=_0x1a04f6[_0x98f5('0x3f')]['length']?_0x1a04f6[_0x98f5('0x3f')]:_0x40eb2f[_0x98f5('0x3a')];_0x1a04f6[_0x98f5('0x44')]=qs[_0x98f5('0x45')](_0x1ba9a2[_0x98f5('0x3b')][_0x98f5('0x45')]);_0x1a04f6[_0x98f5('0x46')]=qs[_0x98f5('0x3d')](_['pick'](_0x1ba9a2['query'],_0x40eb2f[_0x98f5('0x3d')]));if(_0x1ba9a2['query'][_0x98f5('0x47')]){_0x1a04f6[_0x98f5('0x46')]=_[_0x98f5('0x48')](_0x1a04f6['where'],{'$or':_['map'](_0x1a04f6['attributes'],function(_0x20cbaf){var _0x45779d={};_0x45779d[_0x20cbaf]={'$like':'%'+_0x1ba9a2[_0x98f5('0x3b')][_0x98f5('0x47')]+'%'};return _0x45779d;})});}_0x1a04f6=_[_0x98f5('0x48')]({},_0x1a04f6,_0x1ba9a2['options']);return _0x421e3c[_0x98f5('0x7e')](_0x1a04f6);}})[_0x98f5('0x2b')](function(_0x163f7e){if(_0x163f7e){_0x1e28b7=_0x163f7e[_0x98f5('0x41')];if(!_0x1ba9a2[_0x98f5('0x3b')][_0x98f5('0x42')](_0x98f5('0x43'))){_0x1a04f6[_0x98f5('0x24')]=qs[_0x98f5('0x24')](_0x1ba9a2[_0x98f5('0x3b')]['limit']);_0x1a04f6[_0x98f5('0x22')]=qs[_0x98f5('0x22')](_0x1ba9a2[_0x98f5('0x3b')][_0x98f5('0x22')]);}return _0x421e3c[_0x98f5('0x7e')](_0x1a04f6);}})['then'](function(_0x3af4fc){if(_0x3af4fc){return _0x3af4fc?{'count':_0x1e28b7,'rows':_0x3af4fc}:null;}})[_0x98f5('0x2b')](respondWithResult(_0x193cbb,null))[_0x98f5('0x4d')](handleError(_0x193cbb,null));};exports['addTeams']=function(_0x87ae6,_0x14a01b,_0x31282d){var _0x2e85ad=_0x87ae6[_0x98f5('0x54')][_0x98f5('0x72')];var _0x2a983e;return db[_0x98f5('0x7d')][_0x98f5('0x4c')]({'where':{'id':_0x2e85ad},'attributes':['id'],'include':[{'model':db['User'],'as':_0x98f5('0x7f'),'attributes':['id','name',_0x98f5('0x80'),_0x98f5('0x81'),_0x98f5('0x82')],'raw':!![]}]})[_0x98f5('0x2b')](function(_0x1f90ce){if(_0x1f90ce){_0x2a983e=_0x1f90ce;var _0x2bf55c=_[_0x98f5('0x83')](_0x1f90ce,function(_0x54eb1d){var _0x1aa66f=_0x54eb1d[_0x98f5('0x2d')]({'plain':!![]});return _0x1aa66f[_0x98f5('0x7f')];});return db['VoicePrefix'][_0x98f5('0x4f')]({'where':{'id':_0x87ae6[_0x98f5('0x71')]['id']}})[_0x98f5('0x2b')](function(_0x37a1a7){return db[_0x98f5('0x52')][_0x98f5('0x53')](function(_0x55de57){return _0x37a1a7[_0x98f5('0x84')](_0x2e85ad,{'transaction':_0x55de57})[_0x98f5('0x2b')](function(){return BPromise[_0x98f5('0x85')](_0x2a983e,function(_0x462498){return db[_0x98f5('0x86')][_0x98f5('0x87')]({'TeamId':_0x462498['id'],'VoicePrefixId':_0x87ae6[_0x98f5('0x71')]['id']},{'transaction':_0x55de57});});})[_0x98f5('0x2b')](function(){return BPromise[_0x98f5('0x85')](_0x2bf55c,function(_0x2adc96){return db['UserVoicePrefix'][_0x98f5('0x88')]({'where':{'UserId':_0x2adc96['id'],'VoicePrefixId':_0x87ae6[_0x98f5('0x71')]['id']},'transaction':_0x55de57});});})[_0x98f5('0x2b')](function(){_0x2bf55c[_0x98f5('0x89')](function(_0x4c06c3){socket[_0x98f5('0x74')](_0x98f5('0x75'),{'UserId':_0x4c06c3['id'],'VoicePrefixId':_0x37a1a7['id']});});});});});}})[_0x98f5('0x2b')](respondWithStatusCode(_0x14a01b,null))['catch'](handleError(_0x14a01b,null));};exports[_0x98f5('0x8a')]=function(_0x29f1af,_0x165c5c,_0x401ec7){return db[_0x98f5('0x7d')]['findAll']({'where':{'id':_0x29f1af['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x98f5('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x98f5('0x2b')](handleEntityNotFound(_0x165c5c,null))['then'](function(_0x55edfd){var _0x339388=_[_0x98f5('0x34')](_0x55edfd,'id');var _0x1f1e6c=[];var _0x22009b=[];var _0x269fe1=squel['select']();_0x269fe1['field'](_0x98f5('0x8b'))[_0x98f5('0x8c')](_0x98f5('0x8d'),'tq')['join'](_0x98f5('0x8e'),'ut',_0x98f5('0x8f'))['where']('VoicePrefixId\x20=\x20?',_0x29f1af[_0x98f5('0x71')]['id']);for(var _0x4a8f92=0x0;_0x4a8f92<_0x55edfd['length'];_0x4a8f92+=0x1){let _0x20b788=_0x55edfd[_0x4a8f92];for(var _0x1743a8=0x0;_0x1743a8<_0x20b788[_0x98f5('0x7f')][_0x98f5('0x41')];_0x1743a8+=0x1){let _0x18bb66=_0x20b788[_0x98f5('0x7f')][_0x1743a8];var _0x1f1b89=_0x269fe1['clone']();_0x1f1b89[_0x98f5('0x46')](_0x98f5('0x90'),_0x18bb66['id']);_0x22009b[_0x98f5('0x65')](db[_0x98f5('0x52')]['query'](_0x1f1b89[_0x98f5('0x91')](),{'type':db[_0x98f5('0x52')][_0x98f5('0x92')][_0x98f5('0x93')]})[_0x98f5('0x2b')](function(_0x10d7d0){if(_0x10d7d0[_0x98f5('0x41')]===0x1){return _0x18bb66['id'];}else{var _0x4cc03e=_['every'](_[_0x98f5('0x34')](_0x10d7d0,_0x98f5('0x94')),function(_0x1068ff){return _[_0x98f5('0x95')](_0x339388,_0x1068ff);});if(_0x4cc03e){return _0x18bb66['id'];}}}));}}return BPromise['all'](_0x22009b)['then'](function(_0x2ddef8){_0x1f1e6c=_(_0x1f1e6c)['union'](_0x2ddef8)[_0x98f5('0x96')]()[_0x98f5('0x97')]();return db[_0x98f5('0x35')][_0x98f5('0x4f')]({'where':{'id':_0x29f1af[_0x98f5('0x71')]['id']}})[_0x98f5('0x2b')](function(_0x1d1949){return db['sequelize'][_0x98f5('0x53')](function(_0x2391f1){return _0x1d1949['removeTeams'](_0x29f1af[_0x98f5('0x3b')][_0x98f5('0x72')],{'transaction':_0x2391f1})[_0x98f5('0x2b')](function(){if(!_['isEmpty'](_0x1f1e6c)){return _0x1d1949['removeAgents'](_0x1f1e6c,{'transaction':_0x2391f1});}})[_0x98f5('0x2b')](function(){_0x1f1e6c[_0x98f5('0x89')](function(_0x4de795){socket['emit'](_0x98f5('0x78'),{'UserId':_0x4de795,'VoicePrefixId':_0x1d1949['id']});});});});});});})[_0x98f5('0x2b')](respondWithStatusCode(_0x165c5c,null))[_0x98f5('0x4d')](handleError(_0x165c5c,null));}; \ No newline at end of file +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(_0x7dacfe,_0x23d6a5){var _0x112a5c=function(_0x54793a){while(--_0x54793a){_0x7dacfe['push'](_0x7dacfe['shift']());}};_0x112a5c(++_0x23d6a5);}(_0x4991,0xf7));var _0x1499=function(_0x4e32a1,_0x17de7b){_0x4e32a1=_0x4e32a1-0x0;var _0x2af27c=_0x4991[_0x4e32a1];return _0x2af27c;};'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 diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index b6b259c..fc29852 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 _0x3d4e=['exports','events','VoicePrefix','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x481da5,_0x288957){var _0x2ba6e2=function(_0x445454){while(--_0x445454){_0x481da5['push'](_0x481da5['shift']());}};_0x2ba6e2(++_0x288957);}(_0x3d4e,0x160));var _0xe3d4=function(_0x46de37,_0x4ceaea){_0x46de37=_0x46de37-0x0;var _0x5c6aae=_0x3d4e[_0x46de37];return _0x5c6aae;};'use strict';var EventEmitter=require(_0xe3d4('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xe3d4('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe3d4('0x2')](0x0);var events={'afterCreate':_0xe3d4('0x3'),'afterUpdate':_0xe3d4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x256640){return function(_0x9ac433,_0x2c5439,_0xfeadbc){VoicePrefixEvents[_0xe3d4('0x5')](_0x256640+':'+_0x9ac433['id'],_0x9ac433);VoicePrefixEvents['emit'](_0x256640,_0x9ac433);_0xfeadbc(null);};}for(var e in events){if(events[_0xe3d4('0x6')](e)){var event=events[e];VoicePrefix[_0xe3d4('0x7')](e,emitEvent(event));}}module[_0xe3d4('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x3189=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3189,0x19e));var _0x9318=function(_0xc41335,_0x4cc8e1){_0xc41335=_0xc41335-0x0;var _0xb7ae06=_0x3189[_0xc41335];return _0xb7ae06;};'use strict';var EventEmitter=require(_0x9318('0x0'));var VoicePrefix=require(_0x9318('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9318('0x2')](0x0);var events={'afterCreate':_0x9318('0x3'),'afterUpdate':_0x9318('0x4'),'afterDestroy':_0x9318('0x5')};function emitEvent(_0x37b201){return function(_0x198241,_0xc8e19,_0x7148ad){VoicePrefixEvents['emit'](_0x37b201+':'+_0x198241['id'],_0x198241);VoicePrefixEvents[_0x9318('0x6')](_0x37b201,_0x198241);_0x7148ad(null);};}for(var e in events){if(events[_0x9318('0x7')](e)){var event=events[e];VoicePrefix[_0x9318('0x8')](e,emitEvent(event));}}module[_0x9318('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 9ab1891..d4bea27 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 _0x7fa8=['define','VoicePrefix','lodash','util','api','moment','request-promise','path','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x5945fa,_0x5b286c){var _0x367090=function(_0x4cadd1){while(--_0x4cadd1){_0x5945fa['push'](_0x5945fa['shift']());}};_0x367090(++_0x5b286c);}(_0x7fa8,0xbd));var _0x87fa=function(_0x3c2407,_0x3c9a47){_0x3c2407=_0x3c2407-0x0;var _0x5d2eac=_0x7fa8[_0x3c2407];return _0x5d2eac;};'use strict';var _=require(_0x87fa('0x0'));var util=require(_0x87fa('0x1'));var logger=require('../../config/logger')(_0x87fa('0x2'));var moment=require(_0x87fa('0x3'));var BPromise=require('bluebird');var rp=require(_0x87fa('0x4'));var fs=require('fs');var path=require(_0x87fa('0x5'));var rimraf=require('rimraf');var config=require(_0x87fa('0x6'));var attributes=require(_0x87fa('0x7'));module[_0x87fa('0x8')]=function(_0x670ee6,_0x3e3ce6){return _0x670ee6[_0x87fa('0x9')](_0x87fa('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9f4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes'];(function(_0x4e0026,_0x2b52b6){var _0x3f8ee7=function(_0x31d891){while(--_0x31d891){_0x4e0026['push'](_0x4e0026['shift']());}};_0x3f8ee7(++_0x2b52b6);}(_0xf9f4,0x179));var _0x4f9f=function(_0x1ee1ba,_0x2883e7){_0x1ee1ba=_0x1ee1ba-0x0;var _0x1cf9b7=_0xf9f4[_0x1ee1ba];return _0x1cf9b7;};'use strict';var _=require(_0x4f9f('0x0'));var util=require(_0x4f9f('0x1'));var logger=require(_0x4f9f('0x2'))(_0x4f9f('0x3'));var moment=require(_0x4f9f('0x4'));var BPromise=require(_0x4f9f('0x5'));var rp=require(_0x4f9f('0x6'));var fs=require('fs');var path=require(_0x4f9f('0x7'));var rimraf=require('rimraf');var config=require(_0x4f9f('0x8'));var attributes=require(_0x4f9f('0x9'));module['exports']=function(_0x474c3a,_0xc58d89){return _0x474c3a[_0x4f9f('0xa')](_0x4f9f('0xb'),attributes,{'tableName':_0x4f9f('0xc'),'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 a84ed8f..2adc154 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 _0xa017=['jayson/promise','redis','defaults','register','request','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x11f893,_0x259935){var _0x400fa8=function(_0x25933b){while(--_0x25933b){_0x11f893['push'](_0x11f893['shift']());}};_0x400fa8(++_0x259935);}(_0xa017,0x1f1));var _0x7a01=function(_0x542c89,_0x449203){_0x542c89=_0x542c89-0x0;var _0xaa2a8a=_0xa017[_0x542c89];return _0xaa2a8a;};'use strict';var _=require(_0x7a01('0x0'));var util=require(_0x7a01('0x1'));var moment=require(_0x7a01('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a01('0x3'));var db=require(_0x7a01('0x4'))['db'];var utils=require(_0x7a01('0x5'));var logger=require(_0x7a01('0x6'))(_0x7a01('0x7'));var config=require(_0x7a01('0x8'));var jayson=require(_0x7a01('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x7a01('0xa')]=_[_0x7a01('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7a01('0xa')]));require('./voicePrefix.socket')[_0x7a01('0xc')](socket);function respondWithRpcPromise(_0x36e3f5,_0x639e05,_0x355d50){return new BPromise(function(_0x1cedf4,_0x32a982){return client[_0x7a01('0xd')](_0x36e3f5,_0x355d50)['then'](function(_0x124e89){logger['info'](_0x7a01('0xe'),_0x639e05,_0x7a01('0xf'));logger[_0x7a01('0x10')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x639e05,_0x7a01('0xf'),JSON[_0x7a01('0x11')](_0x124e89));if(_0x124e89[_0x7a01('0x12')]){if(_0x124e89[_0x7a01('0x12')][_0x7a01('0x13')]===0x1f4){logger[_0x7a01('0x12')](_0x7a01('0xe'),_0x639e05,_0x124e89[_0x7a01('0x12')][_0x7a01('0x14')]);return _0x32a982(_0x124e89[_0x7a01('0x12')][_0x7a01('0x14')]);}logger[_0x7a01('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x639e05,_0x124e89['error']['message']);return _0x1cedf4(_0x124e89[_0x7a01('0x12')]['message']);}else{logger[_0x7a01('0x15')](_0x7a01('0xe'),_0x639e05,_0x7a01('0xf'));_0x1cedf4(_0x124e89['result'][_0x7a01('0x14')]);}})[_0x7a01('0x16')](function(_0x1f013c){logger['error'](_0x7a01('0xe'),_0x639e05,_0x1f013c);_0x32a982(_0x1f013c);});});} \ No newline at end of file +var _0x07d7=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoicePrefix,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1eb8ff,_0x5cc062){var _0x347319=function(_0x15689f){while(--_0x15689f){_0x1eb8ff['push'](_0x1eb8ff['shift']());}};_0x347319(++_0x5cc062);}(_0x07d7,0x85));var _0x707d=function(_0xc14df7,_0x163f90){_0xc14df7=_0xc14df7-0x0;var _0x34a445=_0x07d7[_0xc14df7];return _0x34a445;};'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')]('VoicePrefix,\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')]('VoicePrefix,\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);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 5170eba..7e6df93 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 _0x342e=['removeListener','register','./voicePrefix.events','save','remove'];(function(_0x29d87d,_0x23dc31){var _0x1fd84b=function(_0x4e2aa1){while(--_0x4e2aa1){_0x29d87d['push'](_0x29d87d['shift']());}};_0x1fd84b(++_0x23dc31);}(_0x342e,0xde));var _0xe342=function(_0x55c00d,_0x520cb6){_0x55c00d=_0x55c00d-0x0;var _0x254a8f=_0x342e[_0x55c00d];return _0x254a8f;};'use strict';var VoicePrefixEvents=require(_0xe342('0x0'));var events=[_0xe342('0x1'),_0xe342('0x2'),'update'];function createListener(_0x5d2113,_0x15d20f){return function(_0x4070d1){_0x15d20f['emit'](_0x5d2113,_0x4070d1);};}function removeListener(_0x509778,_0x349dc1){return function(){VoicePrefixEvents[_0xe342('0x3')](_0x509778,_0x349dc1);};}exports[_0xe342('0x4')]=function(_0x590e9){for(var _0x164e21=0x0,_0x5e643a=events['length'];_0x164e21<_0x5e643a;_0x164e21++){var _0x3457ac=events[_0x164e21];var _0x36bb18=createListener('voicePrefix:'+_0x3457ac,_0x590e9);VoicePrefixEvents['on'](_0x3457ac,_0x36bb18);}}; \ No newline at end of file +var _0x55ea=['remove','emit','removeListener','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x1ba43c,_0x5bd2e8){var _0x2f60eb=function(_0x349dff){while(--_0x349dff){_0x1ba43c['push'](_0x1ba43c['shift']());}};_0x2f60eb(++_0x5bd2e8);}(_0x55ea,0xc9));var _0xa55e=function(_0x1f78cb,_0x58e9f3){_0x1f78cb=_0x1f78cb-0x0;var _0x2cf6b8=_0x55ea[_0x1f78cb];return _0x2cf6b8;};'use strict';var VoicePrefixEvents=require(_0xa55e('0x0'));var events=[_0xa55e('0x1'),_0xa55e('0x2'),'update'];function createListener(_0x2b5bc7,_0x26b2ef){return function(_0x17dd4d){_0x26b2ef[_0xa55e('0x3')](_0x2b5bc7,_0x17dd4d);};}function removeListener(_0x95af3d,_0x54f178){return function(){VoicePrefixEvents[_0xa55e('0x4')](_0x95af3d,_0x54f178);};}exports['register']=function(_0x515646){for(var _0x588751=0x0,_0x5a009c=events[_0xa55e('0x5')];_0x588751<_0x5a009c;_0x588751++){var _0x20f2ac=events[_0x588751];var _0x30b885=createListener(_0xa55e('0x6')+_0x20f2ac,_0x515646);VoicePrefixEvents['on'](_0x20f2ac,_0x30b885);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 037923a..61e1c5c 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x1e48d3,_0x5d8c43){var _0x2852b1=function(_0x11d7b3){while(--_0x11d7b3){_0x1e48d3['push'](_0x1e48d3['shift']());}};_0x2852b1(++_0x5d8c43);}(_0xb10b,0x12a));var _0xbb10=function(_0x1dabf0,_0xd6ec46){_0x1dabf0=_0x1dabf0-0x0;var _0x197431=_0xb10b[_0x1dabf0];return _0x197431;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x387603,_0x5a2d1){var _0x55ea9e=function(_0x46c5be){while(--_0x46c5be){_0x387603['push'](_0x387603['shift']());}};_0x55ea9e(++_0x5a2d1);}(_0xb10b,0x12a));var _0xbb10=function(_0x10fd98,_0x5209db){_0x10fd98=_0x10fd98-0x0;var _0x5347d5=_0xb10b[_0x10fd98];return _0x5347d5;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 2626802..8eb4188 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 _0xfcfd=['Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\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','mandatoryDisposition','STRING','name','inbound','outbound','ENUM','ringall','leastrecent','fewestcalls','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','UNSIGNED','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)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen'];(function(_0x3efc2b,_0x30e89e){var _0x143578=function(_0x506c2d){while(--_0x506c2d){_0x3efc2b['push'](_0x3efc2b['shift']());}};_0x143578(++_0x30e89e);}(_0xfcfd,0x6b));var _0xdfcf=function(_0x4cd71a,_0x446f37){_0x4cd71a=_0x4cd71a-0x0;var _0x24602e=_0xfcfd[_0x4cd71a];return _0x24602e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdfcf('0x0')],'allowNull':![],'unique':_0xdfcf('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xdfcf('0x2'),_0xdfcf('0x3')),'allowNull':![],'defaultValue':_0xdfcf('0x2')},'musiconhold':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':''},'strategy':{'type':Sequelize[_0xdfcf('0x4')]('rr',_0xdfcf('0x5'),_0xdfcf('0x6'),_0xdfcf('0x7'),'random',_0xdfcf('0x8'),'linear',_0xdfcf('0x9'),_0xdfcf('0xa')),'allowNull':![],'defaultValue':_0xdfcf('0x5'),'set':function(_0x4a35a9){this[_0xdfcf('0xb')](_0xdfcf('0xc'),_0x4a35a9?_0x4a35a9:_0xdfcf('0x8'));},'get':function(){var _0x2b12d2=this['getDataValue']('type');var _0x18cba7=this[_0xdfcf('0xd')](_0xdfcf('0xe'));var _0xaf601f=this['getDataValue'](_0xdfcf('0xc'));if(_0x2b12d2==='outbound'){if(_0x18cba7===_0xdfcf('0xf')){return null;}if(_0x18cba7===_0xdfcf('0x10')&&![_0xdfcf('0x8'),_0xdfcf('0x11')][_0xdfcf('0x12')](_0xaf601f)){this[_0xdfcf('0xb')](_0xdfcf('0xc'),_0xdfcf('0x8'));}}return _0xaf601f;}},'servicelevel':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xdfcf('0x13')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xdfcf('0x0')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no'),'defaultValue':_0xdfcf('0x14')},'autopause':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xdfcf('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xdfcf('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xdfcf('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xdfcf('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xdfcf('0x0')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xdfcf('0x0')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xdfcf('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xdfcf('0x14')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xdfcf('0x14'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0xdfcf('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xdfcf('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xdfcf('0x0')]},'queue_youarenext':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xdfcf('0x0')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xdfcf('0x0')]},'queue_quantity1':{'type':Sequelize[_0xdfcf('0x0')]},'queue_quantity2':{'type':Sequelize[_0xdfcf('0x0')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xdfcf('0x0')]},'periodic_announce':{'type':Sequelize[_0xdfcf('0x15')],'set':function(_0x3d8a36){this['setDataValue'](_0xdfcf('0x16'),_0x3d8a36?_0x3d8a36[_0xdfcf('0x17')](','):[]);},'get':function(){return this['getDataValue'](_0xdfcf('0x16'))?this[_0xdfcf('0xd')]('periodic_announce')[_0xdfcf('0x18')](','):[];}},'joinempty':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':_0xdfcf('0x14'),'set':function(_0x493229){this[_0xdfcf('0xb')]('joinempty',_0x493229?_0x493229[_0xdfcf('0x17')](','):undefined);},'get':function(){return this[_0xdfcf('0xd')](_0xdfcf('0x19'))?this['getDataValue'](_0xdfcf('0x19'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':'no','set':function(_0x49fad2){this[_0xdfcf('0xb')](_0xdfcf('0x1a'),_0x49fad2?_0x49fad2[_0xdfcf('0x17')](','):undefined);},'get':function(){return this[_0xdfcf('0xd')](_0xdfcf('0x1a'))?this[_0xdfcf('0xd')]('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xdfcf('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xdfcf('0x0')]},'description':{'type':Sequelize[_0xdfcf('0x0')]},'acw':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':0x0,'set':function(_0x335892){this[_0xdfcf('0xb')](_0xdfcf('0x1c'),_0x335892);if(_0x335892){if(this[_0xdfcf('0xd')]('wrapuptime')<0x2){this[_0xdfcf('0xb')](_0xdfcf('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':0x0,'comment':_0xdfcf('0x1e')},'dialMethod':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0xf'),_0xdfcf('0x1f'),'power',_0xdfcf('0x20'),_0xdfcf('0x10')),'defaultValue':'progressive','comment':_0xdfcf('0x21')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xdfcf('0x22')},'dialLimitQueue':{'type':Sequelize[_0xdfcf('0x13')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xdfcf('0x23')},'dialPowerLevel':{'type':Sequelize[_0xdfcf('0x24')](0x2)[_0xdfcf('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xdfcf('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x27'),_0xdfcf('0x28')),'defaultValue':'dropRate','comment':_0xdfcf('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xdfcf('0x24')](0x2)[_0xdfcf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xdfcf('0x2a')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xdfcf('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xdfcf('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0xdfcf('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdfcf('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xdfcf('0x2d'),'comment':_0xdfcf('0x2e')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdfcf('0x2f')},'dialQueueProject':{'type':Sequelize[_0xdfcf('0x0')],'comment':_0xdfcf('0x30')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdfcf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdfcf('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdfcf('0x13')](0x5)[_0xdfcf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xdfcf('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdfcf('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xdfcf('0x13')](0x5)[_0xdfcf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdfcf('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdfcf('0x25')],'defaultValue':0x3,'comment':_0xdfcf('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdfcf('0x13')](0x5)[_0xdfcf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdfcf('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdfcf('0x36')},'dialTimezone':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xdfcf('0x37')},'dialPrefix':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x38'),_0xdfcf('0x39'),_0xdfcf('0x3a')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xdfcf('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0xdfcf('0x13')](0x9)[_0xdfcf('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xdfcf('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xdfcf('0x13')](0x9)[_0xdfcf('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdfcf('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xdfcf('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdfcf('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdfcf('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdfcf('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0xdfcf('0x13')](0x9)[_0xdfcf('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdfcf('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdfcf('0x13')](0x9)[_0xdfcf('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdfcf('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xdfcf('0x13')](0x9)[_0xdfcf('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xdfcf('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdfcf('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdfcf('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0xdfcf('0x13')](0x5)[_0xdfcf('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xdfcf('0x43')},'dialRecallInQueue':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':0x0,'comment':_0xdfcf('0x44')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xdfcf('0x45'),_0xdfcf('0x46')),'defaultValue':_0xdfcf('0x45')},'dialQueueProject2':{'type':Sequelize[_0xdfcf('0x0')],'comment':_0xdfcf('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xdfcf('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdfcf('0x47')},'dialCutDigit':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdfcf('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdfcf('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0xdfcf('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdfcf('0x4a')},'dialDropRetryFrequency':{'type':Sequelize[_0xdfcf('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdfcf('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdfcf('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdfcf('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xdfcf('0x13')](0x5)[_0xdfcf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdfcf('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdfcf('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdfcf('0x13')](0x5)[_0xdfcf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdfcf('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdfcf('0x13')],'allowNull':!![],'comment':_0xdfcf('0x50')},'mandatoryDisposition':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':![],'comment':_0xdfcf('0x51'),'set':function(_0x2c9c43){if(!_0x2c9c43)this[_0xdfcf('0xb')]('mandatoryDispositionPauseId',null);this[_0xdfcf('0xb')](_0xdfcf('0x52'),_0x2c9c43);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':![]}}; \ No newline at end of file +var _0x405f=['periodic_announce','join','joinempty','leavewhenempty','split','BOOLEAN','acw','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\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,*,*,*','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#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','exports','STRING','name','ENUM','inbound','default','ringall','leastrecent','random','rrmemory','linear','wrandom','rrordered','strategy','type','getDataValue','outbound','preview','booked','roundrobin','includes','INTEGER','yes','all','once','TEXT','setDataValue'];(function(_0xef89d,_0x287047){var _0x23d599=function(_0x20ebad){while(--_0x20ebad){_0xef89d['push'](_0xef89d['shift']());}};_0x23d599(++_0x287047);}(_0x405f,0xda));var _0xf405=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x405f[_0x59d89e];return _0x554e93;};'use strict';var Sequelize=require(_0xf405('0x0'));module[_0xf405('0x1')]={'name':{'type':Sequelize[_0xf405('0x2')],'allowNull':![],'unique':_0xf405('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf405('0x4')](_0xf405('0x5'),'outbound'),'allowNull':![],'defaultValue':_0xf405('0x5')},'musiconhold':{'type':Sequelize[_0xf405('0x2')],'defaultValue':_0xf405('0x6')},'announce':{'type':Sequelize[_0xf405('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xf405('0x4')]('rr',_0xf405('0x7'),_0xf405('0x8'),'fewestcalls',_0xf405('0x9'),_0xf405('0xa'),_0xf405('0xb'),_0xf405('0xc'),_0xf405('0xd')),'allowNull':![],'defaultValue':_0xf405('0x7'),'set':function(_0x588797){this['setDataValue'](_0xf405('0xe'),_0x588797?_0x588797:_0xf405('0xa'));},'get':function(){var _0x48bf2b=this['getDataValue'](_0xf405('0xf'));var _0x384247=this['getDataValue']('dialMethod');var _0x594bc8=this[_0xf405('0x10')](_0xf405('0xe'));if(_0x48bf2b===_0xf405('0x11')){if(_0x384247===_0xf405('0x12')){return null;}if(_0x384247===_0xf405('0x13')&&![_0xf405('0xa'),_0xf405('0x14')][_0xf405('0x15')](_0x594bc8)){this['setDataValue']('strategy',_0xf405('0xa'));}}return _0x594bc8;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xf405('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xf405('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xf405('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xf405('0x4')](_0xf405('0x17'),'no'),'defaultValue':_0xf405('0x17')},'autopause':{'type':Sequelize['ENUM'](_0xf405('0x17'),'no',_0xf405('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xf405('0x4')](_0xf405('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xf405('0x4')](_0xf405('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xf405('0x4')](_0xf405('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xf405('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xf405('0x4')](_0xf405('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xf405('0x4')](_0xf405('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xf405('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xf405('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xf405('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xf405('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xf405('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xf405('0x17'),'no'),'defaultValue':_0xf405('0x17')},'announce_holdtime':{'type':Sequelize[_0xf405('0x4')](_0xf405('0x17'),'no',_0xf405('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xf405('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0xf405('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[_0xf405('0x2')]},'queue_youarenext':{'type':Sequelize[_0xf405('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xf405('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xf405('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xf405('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xf405('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xf405('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xf405('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xf405('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xf405('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xf405('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xf405('0x2')]},'periodic_announce':{'type':Sequelize[_0xf405('0x1a')],'set':function(_0x256d9a){this[_0xf405('0x1b')](_0xf405('0x1c'),_0x256d9a?_0x256d9a[_0xf405('0x1d')](','):[]);},'get':function(){return this['getDataValue'](_0xf405('0x1c'))?this['getDataValue'](_0xf405('0x1c'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x294a21){this[_0xf405('0x1b')]('joinempty',_0x294a21?_0x294a21[_0xf405('0x1d')](','):undefined);},'get':function(){return this['getDataValue'](_0xf405('0x1e'))?this[_0xf405('0x10')](_0xf405('0x1e'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xf405('0x2')],'defaultValue':'no','set':function(_0x519942){this[_0xf405('0x1b')](_0xf405('0x1f'),_0x519942?_0x519942[_0xf405('0x1d')](','):undefined);},'get':function(){return this[_0xf405('0x10')](_0xf405('0x1f'))?this['getDataValue'](_0xf405('0x1f'))[_0xf405('0x20')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xf405('0x4')](_0xf405('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xf405('0x4')](_0xf405('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xf405('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xf405('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xf405('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xf405('0x21')],'defaultValue':0x0,'set':function(_0xa832d){this['setDataValue'](_0xf405('0x22'),_0xa832d);if(_0xa832d){if(this[_0xf405('0x10')]('wrapuptime')<0x2){this[_0xf405('0x1b')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xf405('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xf405('0x21')],'defaultValue':0x0,'comment':_0xf405('0x23')},'dialMethod':{'type':Sequelize[_0xf405('0x4')](_0xf405('0x12'),_0xf405('0x24'),_0xf405('0x25'),_0xf405('0x26'),'booked'),'defaultValue':_0xf405('0x24'),'comment':_0xf405('0x27')},'dialLimitChannel':{'type':Sequelize[_0xf405('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xf405('0x16')](0x4)[_0xf405('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf405('0x29')},'dialPowerLevel':{'type':Sequelize[_0xf405('0x2a')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xf405('0x2b')},'dialPredictiveOptimization':{'type':Sequelize[_0xf405('0x4')]('agentBusyFactor',_0xf405('0x2c')),'defaultValue':_0xf405('0x2c'),'comment':_0xf405('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xf405('0x2a')](0x2)[_0xf405('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xf405('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xf405('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf405('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xf405('0x16')](0x3)[_0xf405('0x28')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xf405('0x2f'),'comment':_0xf405('0x30')},'dialQueueTimeout':{'type':Sequelize[_0xf405('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf405('0x31')},'dialQueueProject':{'type':Sequelize[_0xf405('0x2')],'comment':_0xf405('0x32')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf405('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf405('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf405('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf405('0x34')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf405('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf405('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf405('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf405('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xf405('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xf405('0x16')](0x5)[_0xf405('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf405('0x37')},'dialGlobalMaxRetry':{'type':Sequelize[_0xf405('0x16')](0x3)[_0xf405('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xf405('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf405('0x2')],'defaultValue':_0xf405('0x38')},'dialPrefix':{'type':Sequelize[_0xf405('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xf405('0x4')]('always',_0xf405('0x39'),_0xf405('0x3a')),'defaultValue':_0xf405('0x3b')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xf405('0x3c')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf405('0x28')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xf405('0x28')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xf405('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf405('0x16')](0x9)[_0xf405('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf405('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xf405('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf405('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf405('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf405('0x16')](0x9)[_0xf405('0x28')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xf405('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf405('0x16')](0x5)[_0xf405('0x28')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xf405('0x40')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xf405('0x28')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xf405('0x41')},'dialRecallInQueue':{'type':Sequelize[_0xf405('0x21')],'defaultValue':0x0,'comment':_0xf405('0x42')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xf405('0x43')),'defaultValue':_0xf405('0x44')},'dialQueueProject2':{'type':Sequelize[_0xf405('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xf405('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xf405('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf405('0x45')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf405('0x16')](0x3)[_0xf405('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf405('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf405('0x16')](0x5)[_0xf405('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf405('0x47')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf405('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf405('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf405('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf405('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf405('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf405('0x4a')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xf405('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf405('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf405('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf405('0x16')](0x3)[_0xf405('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf405('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xf405('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf405('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xf405('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0xf405('0x21')],'defaultValue':![],'comment':_0xf405('0x4f'),'set':function(_0x370358){if(!_0x370358)this[_0xf405('0x1b')](_0xf405('0x50'),null);this[_0xf405('0x1b')](_0xf405('0x51'),_0x370358);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xf405('0x16')](0x3)[_0xf405('0x28')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xf405('0x28')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xf405('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 134660f..0971f69 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 _0x6aa7=['ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','index','VoiceQueue','rawAttributes','fieldName','getOptions','where','include','rows','show','model','keys','query','attributes','intersection','fields','length','includeAll','merge','options','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','clone','params','omit','updatedAt','createdAt','getHoppers','findOne','filters','nolimit','order','sort','pick','VoiceQueueId','filter','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','hasOwnProperty','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','compact','isEmpty','removeAgents','addAgents','spread','all','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','toString','cm_contacts','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','select'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x6aa7,0x178));var _0x76aa=function(_0x25fe8e,_0x273a3b){_0x25fe8e=_0x25fe8e-0x0;var _0x2569b0=_0x6aa7[_0x25fe8e];return _0x2569b0;};'use strict';var moment=require(_0x76aa('0x0'));var BPromise=require('bluebird');var util=require(_0x76aa('0x1'));var _=require(_0x76aa('0x2'));var squel=require(_0x76aa('0x3'));var Redis=require(_0x76aa('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x76aa('0x5'))(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x76aa('0x8')](config['redis'],{'host':_0x76aa('0x9'),'port':0x18eb});var socket=require(_0x76aa('0xa'))(new Redis(config[_0x76aa('0xb')]));require('./voiceQueue.socket')[_0x76aa('0xc')](socket);function respondWithStatusCode(_0x266bd5,_0x3a3f36){_0x3a3f36=_0x3a3f36||0xcc;return function(_0x557d69){if(_0x557d69){return _0x266bd5[_0x76aa('0xd')](_0x3a3f36);}return _0x266bd5[_0x76aa('0xe')](_0x3a3f36)[_0x76aa('0xf')]();};}function respondWithResult(_0x16cb50,_0x37f1ab){_0x37f1ab=_0x37f1ab||0xc8;return function(_0x128435){if(_0x128435){return _0x16cb50[_0x76aa('0xe')](_0x37f1ab)[_0x76aa('0x10')](_0x128435);}};}function respondWithFilteredResult(_0xd6327,_0x17a417){return function(_0x5e5f47){if(_0x5e5f47){var _0x112c39=typeof _0x17a417['offset']===_0x76aa('0x11')&&typeof _0x17a417[_0x76aa('0x12')]===_0x76aa('0x11');var _0x8e44ed=_0x5e5f47[_0x76aa('0x13')];var _0x4e309f=_0x112c39?0x0:_0x17a417['offset'];var _0x2b3b4f=_0x112c39?_0x5e5f47['count']:_0x17a417[_0x76aa('0x14')]+_0x17a417[_0x76aa('0x12')];var _0x5cf594;if(_0x2b3b4f>=_0x8e44ed){_0x2b3b4f=_0x8e44ed;_0x5cf594=0xc8;}else{_0x5cf594=0xce;}_0xd6327[_0x76aa('0xe')](_0x5cf594);return _0xd6327['set'](_0x76aa('0x15'),_0x4e309f+'-'+_0x2b3b4f+'/'+_0x8e44ed)['json'](_0x5e5f47);}return null;};}function saveUpdates(_0x1515e9){return function(_0x413cf6){if(_0x413cf6){return _0x413cf6[_0x76aa('0x16')](_0x1515e9)[_0x76aa('0x17')](function(_0xa1bc7){return _0xa1bc7;});}return null;};}function removeEntity(_0x3ead3f){return function(_0x496902){if(_0x496902){return _0x496902['destroy']()[_0x76aa('0x17')](function(){var _0x454dd3=_0x496902[_0x76aa('0x18')]({'plain':!![]});var _0x15b931=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a'),'ignore':![]},{'name':_0x76aa('0x1b'),'value':_0x76aa('0x1c'),'ignore':![]}];var _0x385157=_(_0x15b931)['filter'](_0x76aa('0x1d'))[_0x76aa('0x1e')](_0x76aa('0x1f'))['value']();if(_[_0x76aa('0x20')](_0x385157,_0x454dd3[_0x76aa('0x21')])){return;}var _0x31252f=_[_0x76aa('0x22')](_0x15b931,[_0x76aa('0x1f'),_0x454dd3[_0x76aa('0x21')]])[_0x76aa('0x23')];return db[_0x76aa('0x24')][_0x76aa('0x25')]({'where':{'type':_0x31252f,'resourceId':_0x454dd3['id']}})[_0x76aa('0x17')](function(){return _0x496902;});})[_0x76aa('0x17')](function(){_0x3ead3f[_0x76aa('0xe')](0xcc)[_0x76aa('0xf')]();});}};}function handleEntityNotFound(_0x4ef9b0){return function(_0xb5e8a9){if(!_0xb5e8a9){_0x4ef9b0[_0x76aa('0xd')](0x194);}return _0xb5e8a9;};}function handleError(_0x25c614,_0x2e7ab4){_0x2e7ab4=_0x2e7ab4||0x1f4;return function(_0xa1e6){logger[_0x76aa('0x26')](_0xa1e6[_0x76aa('0x27')]);if(_0xa1e6[_0x76aa('0x23')]){delete _0xa1e6[_0x76aa('0x23')];}_0x25c614[_0x76aa('0xe')](_0x2e7ab4)['send'](_0xa1e6);};}exports[_0x76aa('0x28')]=function(_0x5a8030,_0x994550){var _0x365ff8={};var _0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x1e')](db[_0x76aa('0x29')][_0x76aa('0x2a')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x2b')],'type':_0x3827ec[_0x76aa('0x21')]['key']};});_0x365ff8=qs[_0x76aa('0x2c')](_0x1e90b9,_0x5a8030);var _0x5532c7={'where':_0x365ff8[_0x76aa('0x2d')]};return db[_0x76aa('0x29')][_0x76aa('0x13')](_0x5532c7)[_0x76aa('0x17')](function(_0x35a705){_0x2dec94['count']=_0x35a705;_0x365ff8[_0x76aa('0x2e')]=qs[_0x76aa('0x2e')](_0x5a8030['query']);return db[_0x76aa('0x29')]['findAll'](_0x365ff8);})[_0x76aa('0x17')](function(_0x4c90b6){_0x2dec94[_0x76aa('0x2f')]=_0x4c90b6;return _0x2dec94;})['then'](respondWithFilteredResult(_0x994550,_0x365ff8))['catch'](handleError(_0x994550,null));};exports[_0x76aa('0x30')]=function(_0x282c56,_0x198fcb){var _0x37dfab={'raw':![],'where':{'id':_0x282c56['params']['id']}},_0x595a0f={};_0x595a0f[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')][_0x76aa('0x2a')]);_0x595a0f[_0x76aa('0x33')]=_['keys'](_0x282c56[_0x76aa('0x33')]);_0x595a0f['filters']=_['intersection'](_0x595a0f[_0x76aa('0x31')],_0x595a0f[_0x76aa('0x33')]);_0x37dfab[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x595a0f['model'],qs[_0x76aa('0x36')](_0x282c56[_0x76aa('0x33')][_0x76aa('0x36')]));_0x37dfab['attributes']=_0x37dfab[_0x76aa('0x34')][_0x76aa('0x37')]?_0x37dfab[_0x76aa('0x34')]:_0x595a0f[_0x76aa('0x31')];if(_0x282c56[_0x76aa('0x33')][_0x76aa('0x38')]){_0x37dfab[_0x76aa('0x2e')]=[{'all':!![]}];}_0x37dfab=_[_0x76aa('0x39')]({},_0x37dfab,_0x282c56[_0x76aa('0x3a')]);return db['VoiceQueue'][_0x76aa('0x22')](_0x37dfab)[_0x76aa('0x17')](handleEntityNotFound(_0x198fcb,null))[_0x76aa('0x17')](respondWithResult(_0x198fcb,null))[_0x76aa('0x3b')](handleError(_0x198fcb,null));};exports[_0x76aa('0x3c')]=function(_0x2957aa,_0x572fdb){return db['VoiceQueue'][_0x76aa('0x3c')](_0x2957aa[_0x76aa('0x3d')],{})[_0x76aa('0x17')](function(_0x365612){var _0x50599f=_0x2957aa[_0x76aa('0x3e')][_0x76aa('0x18')]({'plain':!![]});if(!_0x50599f)throw new Error(_0x76aa('0x3f'));if(_0x50599f[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x4aa2f3=_0x365612[_0x76aa('0x18')]({'plain':!![]});var _0x556f59=[{'name':_0x76aa('0x19'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x144f0a=_['find'](_0x556f59,['value',_0x4aa2f3['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x144f0a,'userProfileId':_0x50599f[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0x47b0c8){if(_0x47b0c8&&_0x47b0c8[_0x76aa('0x43')]===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x4aa2f3[_0x76aa('0x23')],'resourceId':_0x4aa2f3['id'],'type':_0x47b0c8[_0x76aa('0x23')],'sectionId':_0x47b0c8['id']},{})['then'](function(){return _0x365612;});}else{return _0x365612;}})[_0x76aa('0x3b')](function(_0x1c62a9){logger['error'](_0x76aa('0x44'),_0x1c62a9);throw _0x1c62a9;});}return _0x365612;})['then'](respondWithResult(_0x572fdb,0xc9))[_0x76aa('0x3b')](handleError(_0x572fdb,null));};exports[_0x76aa('0x45')]=function(_0x31930b,_0x18fd3e){var _0x2d0bc4={'where':{'id':_0x31930b[_0x76aa('0x46')]['id']}},_0x3e0315={};_0x3e0315[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')]['rawAttributes']);_0x2d0bc4[_0x76aa('0x34')]=_['intersection'](_0x3e0315[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x31930b[_0x76aa('0x33')][_0x76aa('0x36')]));_0x2d0bc4['attributes']=_0x2d0bc4['attributes'][_0x76aa('0x37')]?_0x2d0bc4['attributes']:_0x3e0315[_0x76aa('0x31')];if(_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]){_0x2d0bc4[_0x76aa('0x2e')]=[{'all':!![]}];}_0x2d0bc4=_[_0x76aa('0x39')]({},_0x2d0bc4,_0x31930b[_0x76aa('0x3a')]);return db['VoiceQueue']['find'](_0x2d0bc4)[_0x76aa('0x17')](handleEntityNotFound(_0x18fd3e,null))[_0x76aa('0x17')](function(_0x1708d4){if(_0x1708d4){var _0x40e8ff=_0x1708d4[_0x76aa('0x18')]({'plain':!![]});_0x40e8ff=qs[_0x76aa('0x47')](_0x40e8ff,['id','createdAt',_0x76aa('0x48')]);_0x31930b[_0x76aa('0x3d')]=_[_0x76aa('0x47')](_0x31930b['body'],['id',_0x76aa('0x49'),'updatedAt']);return db[_0x76aa('0x29')]['create'](_[_0x76aa('0x39')](_0x40e8ff,_0x31930b[_0x76aa('0x3d')]),{'include':_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]?[{'all':!![]}]:undefined})[_0x76aa('0x17')](function(_0x316de3){var _0x953726=_0x31930b['user'][_0x76aa('0x18')]({'plain':!![]});if(!_0x953726)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x953726[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x288151=_0x316de3[_0x76aa('0x18')]({'plain':!![]});var _0x3fa7ec=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a')},{'name':'QueueCampaigns','value':_0x76aa('0x1c')}];var _0x281f73=_[_0x76aa('0x22')](_0x3fa7ec,[_0x76aa('0x1f'),_0x288151['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x281f73,'userProfileId':_0x953726[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0xf7732){if(_0xf7732&&_0xf7732['autoAssociation']===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x288151[_0x76aa('0x23')],'resourceId':_0x288151['id'],'type':_0xf7732[_0x76aa('0x23')],'sectionId':_0xf7732['id']},{})[_0x76aa('0x17')](function(){return _0x316de3;});}else{return _0x316de3;}})[_0x76aa('0x3b')](function(_0x37babe){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37babe);throw _0x37babe;});}return _0x316de3;});}})[_0x76aa('0x17')](respondWithResult(_0x18fd3e,0xc9))[_0x76aa('0x3b')](handleError(_0x18fd3e,null));};exports['update']=function(_0x3d7802,_0x1e6f3c){if(_0x3d7802['body']['id']){delete _0x3d7802[_0x76aa('0x3d')]['id'];}return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x3d7802[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1e6f3c,null))[_0x76aa('0x17')](saveUpdates(_0x3d7802[_0x76aa('0x3d')],null))[_0x76aa('0x17')](respondWithResult(_0x1e6f3c,null))[_0x76aa('0x3b')](handleError(_0x1e6f3c,null));};exports['destroy']=function(_0xd337f0,_0x49156c){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0xd337f0[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x49156c,null))[_0x76aa('0x17')](removeEntity(_0x49156c,null))[_0x76aa('0x3b')](handleError(_0x49156c,null));};exports[_0x76aa('0x4a')]=function(_0x431d1c,_0x2f1263){var _0x5eceba={'raw':![],'where':{}};var _0x267fcf={};var _0x3d4025={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x431d1c[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x2f1263,null))[_0x76aa('0x17')](function(_0x157540){if(_0x157540){_0x267fcf['model']=_[_0x76aa('0x32')](db['CmHopper'][_0x76aa('0x2a')]);_0x267fcf[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x431d1c[_0x76aa('0x33')]);_0x267fcf[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x267fcf[_0x76aa('0x31')],_0x267fcf['query']);_0x5eceba[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x267fcf['model'],qs['fields'](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x36')]));_0x5eceba['attributes']=_0x5eceba[_0x76aa('0x34')][_0x76aa('0x37')]?_0x5eceba[_0x76aa('0x34')]:_0x267fcf['model'];if(!_0x431d1c[_0x76aa('0x33')]['hasOwnProperty'](_0x76aa('0x4d'))){_0x5eceba[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x431d1c[_0x76aa('0x33')]['limit']);_0x5eceba['offset']=qs[_0x76aa('0x14')](_0x431d1c['query'][_0x76aa('0x14')]);}_0x5eceba[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x5eceba[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x431d1c[_0x76aa('0x33')],_0x267fcf['filters']));_0x5eceba[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x157540['id'];if(_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]){_0x5eceba['where']=_['merge'](_0x5eceba['where'],{'$or':_[_0x76aa('0x1e')](_0x5eceba['attributes'],function(_0xb61e5){var _0x256195={};_0x256195[_0xb61e5]={'$like':'%'+_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x256195;})});}_0x5eceba=_['merge']({},_0x5eceba,_0x431d1c[_0x76aa('0x3a')]);return db['CmHopper'][_0x76aa('0x13')]({'where':_0x5eceba[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x11d602){_0x3d4025[_0x76aa('0x13')]=_0x11d602;if(_0x431d1c['query'][_0x76aa('0x38')]){_0x5eceba[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x53')][_0x76aa('0x54')](_0x5eceba);})[_0x76aa('0x17')](function(_0x22432d){_0x3d4025[_0x76aa('0x2f')]=_0x22432d;return _0x3d4025;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x2f1263,_0x5eceba))['catch'](handleError(_0x2f1263,null));};exports[_0x76aa('0x55')]=function(_0x381f44,_0x48136a){var _0x3c1b98={'raw':!![],'where':{}};var _0x215463={};var _0x325487={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x381f44[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x48136a,null))['then'](function(_0xdb821b){if(_0xdb821b){_0x215463['model']=_['keys'](db[_0x76aa('0x56')][_0x76aa('0x2a')]);_0x215463['query']=_['keys'](_0x381f44[_0x76aa('0x33')]);_0x215463[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x215463['model'],_0x215463['query']);_0x3c1b98[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x215463[_0x76aa('0x31')],qs['fields'](_0x381f44[_0x76aa('0x33')]['fields']));_0x3c1b98[_0x76aa('0x34')]=_0x3c1b98[_0x76aa('0x34')][_0x76aa('0x37')]?_0x3c1b98[_0x76aa('0x34')]:_0x215463[_0x76aa('0x31')];if(!_0x381f44['query']['hasOwnProperty'](_0x76aa('0x4d'))){_0x3c1b98[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x381f44['query'][_0x76aa('0x12')]);_0x3c1b98[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x381f44[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x3c1b98['order']=qs[_0x76aa('0x4f')](_0x381f44['query'][_0x76aa('0x4f')]);_0x3c1b98[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x381f44[_0x76aa('0x33')],_0x215463[_0x76aa('0x4c')]));_0x3c1b98['where']['VoiceQueueId']=_0xdb821b['id'];if(_0x381f44['query']['filter']){_0x3c1b98['where']=_[_0x76aa('0x39')](_0x3c1b98[_0x76aa('0x2d')],{'$or':_['map'](_0x3c1b98['attributes'],function(_0x4f01e9){var _0x3a6326={};_0x3a6326[_0x4f01e9]={'$like':'%'+_0x381f44[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x3a6326;})});}_0x3c1b98=_['merge']({},_0x3c1b98,_0x381f44['options']);return db[_0x76aa('0x56')][_0x76aa('0x13')]({'where':_0x3c1b98[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x354c7b){_0x325487['count']=_0x354c7b;if(_0x381f44['query'][_0x76aa('0x38')]){_0x3c1b98['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x3c1b98);})[_0x76aa('0x17')](function(_0xbb1ccd){_0x325487['rows']=_0xbb1ccd;return _0x325487;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x48136a,_0x3c1b98))[_0x76aa('0x3b')](handleError(_0x48136a,null));};exports['getHopperFinals']=function(_0x22063f,_0x24331a){var _0x11d91f={'raw':!![],'where':{}};var _0x258e5a={};var _0x1fa86b={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x22063f[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x24331a,null))['then'](function(_0x84bc91){if(_0x84bc91){_0x258e5a[_0x76aa('0x31')]=_['keys'](db[_0x76aa('0x57')][_0x76aa('0x2a')]);_0x258e5a[_0x76aa('0x33')]=_['keys'](_0x22063f[_0x76aa('0x33')]);_0x258e5a[_0x76aa('0x4c')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],_0x258e5a[_0x76aa('0x33')]);_0x11d91f[_0x76aa('0x34')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x22063f['query']['fields']));_0x11d91f['attributes']=_0x11d91f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x11d91f[_0x76aa('0x34')]:_0x258e5a[_0x76aa('0x31')];if(!_0x22063f['query']['hasOwnProperty']('nolimit')){_0x11d91f[_0x76aa('0x12')]=qs['limit'](_0x22063f[_0x76aa('0x33')][_0x76aa('0x12')]);_0x11d91f['offset']=qs[_0x76aa('0x14')](_0x22063f[_0x76aa('0x33')]['offset']);}_0x11d91f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x22063f[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x11d91f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x22063f[_0x76aa('0x33')],_0x258e5a['filters']));_0x11d91f['where']['VoiceQueueId']=_0x84bc91['id'];if(_0x22063f['query']['filter']){_0x11d91f[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x11d91f[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x11d91f['attributes'],function(_0x447103){var _0x2192ed={};_0x2192ed[_0x447103]={'$like':'%'+_0x22063f[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2192ed;})});}_0x11d91f=_[_0x76aa('0x39')]({},_0x11d91f,_0x22063f['options']);return db[_0x76aa('0x57')][_0x76aa('0x13')]({'where':_0x11d91f[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x13be70){_0x1fa86b[_0x76aa('0x13')]=_0x13be70;if(_0x22063f[_0x76aa('0x33')]['includeAll']){_0x11d91f[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x57')]['findAll'](_0x11d91f);})['then'](function(_0x216e87){_0x1fa86b[_0x76aa('0x2f')]=_0x216e87;return _0x1fa86b;});}})['then'](respondWithFilteredResult(_0x24331a,_0x11d91f))[_0x76aa('0x3b')](handleError(_0x24331a,null));};exports['getHopperBlacks']=function(_0x28ec11,_0x5cc005){var _0x28b439={'raw':!![],'where':{}};var _0x583924={};var _0x45227e={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x28ec11['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x5cc005,null))['then'](function(_0x1af32e){if(_0x1af32e){_0x583924[_0x76aa('0x31')]=_['keys'](db['CmHopperBlack'][_0x76aa('0x2a')]);_0x583924[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x28ec11[_0x76aa('0x33')]);_0x583924['filters']=_['intersection'](_0x583924[_0x76aa('0x31')],_0x583924['query']);_0x28b439[_0x76aa('0x34')]=_['intersection'](_0x583924[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x28ec11['query'][_0x76aa('0x36')]));_0x28b439['attributes']=_0x28b439['attributes'][_0x76aa('0x37')]?_0x28b439[_0x76aa('0x34')]:_0x583924['model'];if(!_0x28ec11[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x28b439['limit']=qs[_0x76aa('0x12')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x12')]);_0x28b439[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x28b439[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x28b439[_0x76aa('0x2d')]=qs['filters'](_[_0x76aa('0x50')](_0x28ec11[_0x76aa('0x33')],_0x583924['filters']));_0x28b439[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x1af32e['id'];if(_0x28ec11['query']['filter']){_0x28b439[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x28b439['where'],{'$or':_[_0x76aa('0x1e')](_0x28b439[_0x76aa('0x34')],function(_0x24af48){var _0x5010c8={};_0x5010c8[_0x24af48]={'$like':'%'+_0x28ec11[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x5010c8;})});}_0x28b439=_['merge']({},_0x28b439,_0x28ec11[_0x76aa('0x3a')]);return db[_0x76aa('0x59')][_0x76aa('0x13')]({'where':_0x28b439[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x42543c){_0x45227e['count']=_0x42543c;if(_0x28ec11[_0x76aa('0x33')]['includeAll']){_0x28b439[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x59')][_0x76aa('0x54')](_0x28b439);})['then'](function(_0x4c5f54){_0x45227e[_0x76aa('0x2f')]=_0x4c5f54;return _0x45227e;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x5cc005,_0x28b439))[_0x76aa('0x3b')](handleError(_0x5cc005,null));};exports[_0x76aa('0x5a')]=function(_0x1a81fd,_0x1eb8f2){var _0x4f7dd4={};var _0x5a4c03={};var _0x2565a2;var _0x109bd3;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x1a81fd['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1eb8f2,null))['then'](function(_0x54d530){if(_0x54d530){_0x2565a2=_0x54d530;_0x5a4c03[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x5b')]['rawAttributes']);_0x5a4c03[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x1a81fd[_0x76aa('0x33')]);_0x5a4c03[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],_0x5a4c03[_0x76aa('0x33')]);_0x4f7dd4['attributes']=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x36')]));_0x4f7dd4[_0x76aa('0x34')]=_0x4f7dd4['attributes'][_0x76aa('0x37')]?_0x4f7dd4[_0x76aa('0x34')]:_0x5a4c03[_0x76aa('0x31')];_0x4f7dd4[_0x76aa('0x4e')]=qs['sort'](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x4f7dd4[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x1a81fd['query'],_0x5a4c03[_0x76aa('0x4c')]));if(_0x1a81fd[_0x76aa('0x33')]['filter']){_0x4f7dd4['where']=_[_0x76aa('0x39')](_0x4f7dd4[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x4f7dd4[_0x76aa('0x34')],function(_0x46f098){var _0x293221={};_0x293221[_0x46f098]={'$like':'%'+_0x1a81fd['query'][_0x76aa('0x52')]+'%'};return _0x293221;})});}_0x4f7dd4=_[_0x76aa('0x39')]({},_0x4f7dd4,_0x1a81fd[_0x76aa('0x3a')]);return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x2e7bb7){if(_0x2e7bb7){_0x109bd3=_0x2e7bb7['length'];if(!_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x4f7dd4[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x1a81fd[_0x76aa('0x33')]['limit']);_0x4f7dd4[_0x76aa('0x14')]=qs['offset'](_0x1a81fd[_0x76aa('0x33')]['offset']);}return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x56d6af){if(_0x56d6af){return _0x56d6af?{'count':_0x109bd3,'rows':_0x56d6af}:null;}})[_0x76aa('0x17')](respondWithResult(_0x1eb8f2,null))[_0x76aa('0x3b')](handleError(_0x1eb8f2,null));};exports[_0x76aa('0x5c')]=function(_0x57636c,_0x3ae5e8){var _0x46c818=_0x57636c['body'][_0x76aa('0x5d')];var _0xfe926d=_[_0x76aa('0x1e')](_0x46c818,'id');return db[_0x76aa('0x5b')][_0x76aa('0x54')]({'where':{'id':_0xfe926d},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':'Agents','attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]}]})[_0x76aa('0x17')](function(_0x28e1a4){if(_0x28e1a4){var _0x8bb516=_[_0x76aa('0x62')](_0x28e1a4,function(_0xf9f670){var _0x1359f9=_0xf9f670[_0x76aa('0x18')]({'plain':!![]});_0x1359f9['Agents'][_0x76aa('0x63')](function(_0x58cd0c){_0x58cd0c[_0x76aa('0x64')]=_[_0x76aa('0x22')](_0x46c818,{'id':_0x1359f9['id']})[_0x76aa('0x64')];});return _0x1359f9[_0x76aa('0x65')];});return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x57636c['params']['id']}})[_0x76aa('0x17')](function(_0x53090c){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x2045a2){return _0x53090c['addTeams'](_0xfe926d,{'transaction':_0x2045a2})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_0x46c818,function(_0x228968){return db[_0x76aa('0x69')][_0x76aa('0x6a')]({'TeamId':_0x228968['id'],'VoiceQueueId':_0x57636c['params']['id'],'penalty':_0x228968[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})['then'](function(){return BPromise[_0x76aa('0x68')](_0x8bb516,function(_0x1bc764){return db['UserVoiceQueue'][_0x76aa('0x6b')]({'where':{'UserId':_0x1bc764['id'],'VoiceQueueId':_0x57636c[_0x76aa('0x46')]['id']},'defaults':{'penalty':_0x1bc764[_0x76aa('0x64')]},'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_[_0x76aa('0x52')](_0x8bb516,{'online':!![]}),function(_0x245af7){return db[_0x76aa('0x6c')]['upsert']({'membername':_0x245af7[_0x76aa('0x23')],'UserId':_0x245af7['id'],'queue_name':_0x53090c[_0x76aa('0x23')],'VoiceQueueId':_0x53090c['id'],'interface':_[_0x76aa('0x6d')](_0x245af7[_0x76aa('0x61')])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x245af7[_0x76aa('0x23')]):_0x245af7[_0x76aa('0x61')],'paused':_0x245af7['voicePause']||![],'penalty':_0x245af7[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){_0x8bb516[_0x76aa('0x63')](function(_0x54e450){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':_0x54e450['id'],'VoiceQueueId':_0x53090c['id']});});});});});}})[_0x76aa('0x17')](respondWithStatusCode(_0x3ae5e8,null))[_0x76aa('0x3b')](handleError(_0x3ae5e8,null));};exports[_0x76aa('0x72')]=function(_0x5db8d8,_0x21fd43){return db['Team'][_0x76aa('0x54')]({'where':{'id':_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')]},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':_0x76aa('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21fd43,null))[_0x76aa('0x17')](function(_0x4920fa){var _0x577463=_[_0x76aa('0x1e')](_0x4920fa,'id');var _0x20ba92=[];var _0x533080=[];var _0x3cd088=squel['select']();_0x3cd088[_0x76aa('0x74')](_0x76aa('0x75'))[_0x76aa('0x76')](_0x76aa('0x77'),'tq')[_0x76aa('0x78')](_0x76aa('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x5db8d8[_0x76aa('0x46')]['id']);for(var _0x3ebe91=0x0;_0x3ebe91<_0x4920fa[_0x76aa('0x37')];_0x3ebe91+=0x1){let _0x14318c=_0x4920fa[_0x3ebe91];for(var _0xbfa5f8=0x0;_0xbfa5f8<_0x14318c[_0x76aa('0x65')][_0x76aa('0x37')];_0xbfa5f8+=0x1){let _0x46772f=_0x14318c[_0x76aa('0x65')][_0xbfa5f8];var _0x40df44=_0x3cd088[_0x76aa('0x45')]();_0x40df44[_0x76aa('0x2d')](_0x76aa('0x7b'),_0x46772f['id']);_0x533080[_0x76aa('0x7c')](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x40df44['toString'](),{'type':db[_0x76aa('0x66')]['QueryTypes'][_0x76aa('0x7d')]})[_0x76aa('0x17')](function(_0x4a093b){if(_0x4a093b[_0x76aa('0x37')]===0x1){return _0x46772f['id'];}else{var _0x5305f1=_[_0x76aa('0x7e')](_[_0x76aa('0x1e')](_0x4a093b,_0x76aa('0x7f')),function(_0x5ceae2){return _[_0x76aa('0x20')](_0x577463,_0x5ceae2);});if(_0x5305f1){return _0x46772f['id'];}}}));}}return BPromise['all'](_0x533080)['then'](function(_0x3c9841){_0x20ba92=_(_0x20ba92)['union'](_0x3c9841)[_0x76aa('0x80')]()['value']();return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5db8d8[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](function(_0x3f4ded){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x434634){return _0x3f4ded[_0x76aa('0x72')](_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')],{'transaction':_0x434634})[_0x76aa('0x17')](function(){if(!_[_0x76aa('0x81')](_0x20ba92)){return _0x3f4ded[_0x76aa('0x82')](_0x20ba92,{'transaction':_0x434634})[_0x76aa('0x17')](function(){return db['UserVoiceQueueRt'][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5db8d8[_0x76aa('0x46')]['id'],'UserId':_0x20ba92},'transaction':_0x434634});});}})[_0x76aa('0x17')](function(){_0x20ba92[_0x76aa('0x63')](function(_0x540bf3){socket[_0x76aa('0x70')]('userVoiceQueue:remove',{'UserId':_0x540bf3,'VoiceQueueId':_0x3f4ded['id']});});});});});});})[_0x76aa('0x17')](respondWithStatusCode(_0x21fd43,null))['catch'](handleError(_0x21fd43,null));};exports[_0x76aa('0x83')]=function(_0x5427f0,_0x3e9153){var _0x490090,_0x31b7a8;return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5427f0[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e9153,null))[_0x76aa('0x17')](function(_0x51feca){if(_0x51feca){_0x31b7a8=_0x51feca;return _0x51feca[_0x76aa('0x83')](_0x5427f0['body'][_0x76aa('0x73')],_['omit'](_0x5427f0['body'],[_0x76aa('0x73'),'id'])||{})[_0x76aa('0x84')](function(_0x38b6aa){for(var _0x395501=0x0;_0x395501<_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')][_0x76aa('0x37')];_0x395501+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':Number(_0x5427f0[_0x76aa('0x3d')]['ids'][_0x395501]),'VoiceQueueId':Number(_0x5427f0[_0x76aa('0x46')]['id'])});}return _0x38b6aa;});}})[_0x76aa('0x17')](function(_0x3d969f){_0x490090=_0x3d969f||[];if(_0x31b7a8){return db[_0x76aa('0x5e')][_0x76aa('0x54')]({'where':{'id':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')]},'attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]});}})[_0x76aa('0x17')](function(_0x3274a9){if(!_[_0x76aa('0x81')](_0x3274a9)){var _0x5c0268=[];for(var _0x5c5a6f=0x0;_0x5c5a6f<_0x3274a9[_0x76aa('0x37')];_0x5c5a6f++){if(_0x3274a9[_0x5c5a6f][_0x76aa('0x5f')]){_0x5c0268[_0x76aa('0x7c')](db['UserVoiceQueueRt']['upsert']({'membername':_0x3274a9[_0x5c5a6f][_0x76aa('0x23')],'UserId':_0x3274a9[_0x5c5a6f]['id'],'queue_name':_0x31b7a8[_0x76aa('0x23')],'VoiceQueueId':_0x31b7a8['id'],'interface':_[_0x76aa('0x6d')](_0x3274a9[_0x5c5a6f]['interface'])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x3274a9[_0x5c5a6f]['name']):_0x3274a9[_0x5c5a6f]['interface'],'paused':_0x3274a9[_0x5c5a6f]['voicePause']||![],'penalty':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x64')]||0x0}));}}return BPromise[_0x76aa('0x85')](_0x5c0268);}})['then'](function(){return _0x490090;})[_0x76aa('0x17')](respondWithResult(_0x3e9153,null))[_0x76aa('0x3b')](handleError(_0x3e9153,null));};exports['removeAgents']=function(_0x5433dc,_0x328d1a){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x5433dc['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x328d1a,null))[_0x76aa('0x17')](function(_0x546770){if(_0x546770){return _0x546770[_0x76aa('0x82')](_0x5433dc[_0x76aa('0x33')]['ids'])[_0x76aa('0x17')](function(){if(_[_0x76aa('0x86')](_0x5433dc['query'][_0x76aa('0x73')])){for(var _0x4df504=0x0;_0x4df504<_0x5433dc['query'][_0x76aa('0x73')][_0x76aa('0x37')];_0x4df504+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')][_0x76aa('0x73')][_0x4df504]),'VoiceQueueId':Number(_0x5433dc[_0x76aa('0x46')]['id'])});}}else{socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')]['ids']),'VoiceQueueId':Number(_0x5433dc['params']['id'])});}});}})[_0x76aa('0x17')](function(_0x2726da){return db[_0x76aa('0x6c')][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5433dc[_0x76aa('0x46')]['id'],'UserId':_0x5433dc[_0x76aa('0x33')]['ids']}})[_0x76aa('0x17')](function(){return _0x2726da;});})[_0x76aa('0x17')](respondWithStatusCode(_0x328d1a,null))[_0x76aa('0x3b')](handleError(_0x328d1a,null));};exports[_0x76aa('0x88')]=function(_0x38694d,_0xf0b932){var _0x1c8cf5={};var _0x5a8d0f={};var _0x5f513d;var _0x54e70c;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x38694d[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0xf0b932,null))[_0x76aa('0x17')](function(_0x4afe13){if(_0x4afe13){_0x5f513d=_0x4afe13;_0x5a8d0f['model']=_[_0x76aa('0x32')](db[_0x76aa('0x5e')][_0x76aa('0x2a')]);_0x5a8d0f[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x38694d['query']);_0x5a8d0f[_0x76aa('0x4c')]=_['intersection'](_0x5a8d0f[_0x76aa('0x31')],_0x5a8d0f['query']);_0x1c8cf5['attributes']=_[_0x76aa('0x35')](_0x5a8d0f['model'],qs[_0x76aa('0x36')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x36')]));_0x1c8cf5[_0x76aa('0x34')]=_0x1c8cf5[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1c8cf5[_0x76aa('0x34')]:_0x5a8d0f[_0x76aa('0x31')];_0x1c8cf5['order']=qs[_0x76aa('0x4f')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1c8cf5[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x38694d[_0x76aa('0x33')],_0x5a8d0f['filters']));if(_0x38694d[_0x76aa('0x33')]['filter']){_0x1c8cf5[_0x76aa('0x2d')]=_['merge'](_0x1c8cf5[_0x76aa('0x2d')],{'$or':_['map'](_0x1c8cf5[_0x76aa('0x34')],function(_0x8b2ee1){var _0x279be2={};_0x279be2[_0x8b2ee1]={'$like':'%'+_0x38694d['query']['filter']+'%'};return _0x279be2;})});}_0x1c8cf5=_[_0x76aa('0x39')]({},_0x1c8cf5,_0x38694d['options']);return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x1b99d8){if(_0x1b99d8){_0x54e70c=_0x1b99d8['length'];if(!_0x38694d['query']['hasOwnProperty']('nolimit')){_0x1c8cf5[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1c8cf5[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x2484fd){if(_0x2484fd){return _0x2484fd?{'count':_0x54e70c,'rows':_0x2484fd}:null;}})[_0x76aa('0x17')](respondWithResult(_0xf0b932,null))[_0x76aa('0x3b')](handleError(_0xf0b932,null));};exports['getMembers']=function(_0x2b12e9,_0x4e697b){var _0x1e902d={};var _0x3a7658={};var _0x1b1f85;var _0x3fb275;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x2b12e9[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x4e697b,null))[_0x76aa('0x17')](function(_0x1bdc5c){if(_0x1bdc5c){_0x1b1f85=_0x1bdc5c;_0x3a7658[_0x76aa('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x76aa('0x2a')]);_0x3a7658[_0x76aa('0x33')]=_['keys'](_0x2b12e9[_0x76aa('0x33')]);_0x3a7658[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x3a7658[_0x76aa('0x31')],_0x3a7658[_0x76aa('0x33')]);_0x1e902d[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x3a7658['model'],qs[_0x76aa('0x36')](_0x2b12e9[_0x76aa('0x33')]['fields']));_0x1e902d['attributes']=_0x1e902d[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1e902d[_0x76aa('0x34')]:_0x3a7658[_0x76aa('0x31')];_0x1e902d[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1e902d[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x2b12e9[_0x76aa('0x33')],_0x3a7658[_0x76aa('0x4c')]));if(_0x2b12e9['query']['filter']){_0x1e902d[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x1e902d[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x1e902d['attributes'],function(_0x5f3819){var _0x2a8410={};_0x2a8410[_0x5f3819]={'$like':'%'+_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2a8410;})});}_0x1e902d=_['merge']({},_0x1e902d,_0x2b12e9['options']);return _0x1b1f85['getMembers'](_0x1e902d);}})[_0x76aa('0x17')](function(_0x4df872){if(_0x4df872){_0x3fb275=_0x4df872[_0x76aa('0x37')];if(!_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x1e902d[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1e902d[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x1b1f85[_0x76aa('0x89')](_0x1e902d);}})[_0x76aa('0x17')](function(_0x3b1f33){return _0x3b1f33?{'count':_0x3fb275,'rows':_0x3b1f33}:null;})[_0x76aa('0x17')](respondWithResult(_0x4e697b,null))['catch'](handleError(_0x4e697b,null));};exports[_0x76aa('0x8a')]=function(_0x5e8cec,_0x1a37e9){var _0x58932f={};var _0x17bd1a={};var _0x5d7a2b;var _0x363c45;return db['VoiceQueue']['findOne']({'where':{'id':_0x5e8cec[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1a37e9,null))[_0x76aa('0x17')](function(_0x44668d){if(_0x44668d){_0x5d7a2b=_0x44668d;_0x17bd1a[_0x76aa('0x31')]=_[_0x76aa('0x32')](db['CmList'][_0x76aa('0x2a')]);_0x17bd1a[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x5e8cec[_0x76aa('0x33')]);_0x17bd1a['filters']=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],_0x17bd1a[_0x76aa('0x33')]);_0x58932f[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x36')]));_0x58932f[_0x76aa('0x34')]=_0x58932f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x58932f['attributes']:_0x17bd1a['model'];_0x58932f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x58932f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x5e8cec[_0x76aa('0x33')],_0x17bd1a[_0x76aa('0x4c')]));if(_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x52')]){_0x58932f['where']=_[_0x76aa('0x39')](_0x58932f['where'],{'$or':_[_0x76aa('0x1e')](_0x58932f[_0x76aa('0x34')],function(_0x278bac){var _0x14256c={};_0x14256c[_0x278bac]={'$like':'%'+_0x5e8cec[_0x76aa('0x33')]['filter']+'%'};return _0x14256c;})});}_0x58932f=_['merge']({},_0x58932f,_0x5e8cec[_0x76aa('0x3a')]);return _0x5d7a2b['getLists'](_0x58932f);}})[_0x76aa('0x17')](function(_0xb760ca){if(_0xb760ca){_0x363c45=_0xb760ca[_0x76aa('0x37')];if(!_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x58')]('nolimit')){_0x58932f['limit']=qs[_0x76aa('0x12')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x12')]);_0x58932f[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5d7a2b[_0x76aa('0x8a')](_0x58932f);}})[_0x76aa('0x17')](function(_0x33644d){if(_0x33644d){return _0x33644d?{'count':_0x363c45,'rows':_0x33644d}:null;}})['then'](respondWithResult(_0x1a37e9,null))[_0x76aa('0x3b')](handleError(_0x1a37e9,null));};exports[_0x76aa('0x8b')]=function(_0x4830ea,_0x20638f){var _0x2b2f27=moment()[_0x76aa('0x6e')](_0x76aa('0x8c'));var _0x1a5297,_0x487c28;return db[_0x76aa('0x29')]['find']({'where':{'id':_0x4830ea[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x20638f,null))[_0x76aa('0x17')](function(_0x2f2a27){if(_0x2f2a27){_0x487c28=_0x2f2a27;return _0x2f2a27['addLists'](_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x4830ea[_0x76aa('0x3d')],[_0x76aa('0x73'),'id'])||{});}return null;})[_0x76aa('0x84')](function(_0xca12fa){var _0xb0a4e1;_0x1a5297=_0xca12fa||[];var _0x1f7f1d=[];if(_0xca12fa){for(var _0x413528=0x0;_0x413528<_0xca12fa[_0x76aa('0x37')];_0x413528+=0x1){var _0x39de41=_0xca12fa[_0x413528][_0x76aa('0x18')]({'plain':!![]});_0x487c28[_0x76aa('0x8d')]=_0x4830ea['body']['dialCheckDuplicateType']?_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x8d')]:_0x487c28['dialCheckDuplicateType'];switch(_0x487c28[_0x76aa('0x8d')]){case'always':_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),'VoiceQueueId',_0x76aa('0x49'),_0x76aa('0x48')],squel['select']()['field'](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id','ContactId')[_0x76aa('0x74')](_0x39de41['CmListId'][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x76aa('0x74')](_0x76aa('0x98'))['from'](_0x76aa('0x99'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']()))['where'](_0x76aa('0x9a'),squel['select']()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')]('VoiceQueueId\x20=\x20?',_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')]())))[_0x76aa('0x96')]();break;case _0x76aa('0x9c'):_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')](['phone',_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))['field'](_0x39de41['CmListId']['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea['params']['id'][_0x76aa('0x96')](),'VoiceQueueId')['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0'))[_0x76aa('0x2d')](_0x76aa('0x9a'),squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']())))[_0x76aa('0x96')]();break;default:_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')]('cm_hopper')[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))['field']('id',_0x76aa('0x94'))['field'](_0x39de41[_0x76aa('0x9f')]['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id']['toString'](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')]('cm_contacts')['where'](_0x76aa('0xa1'))[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')](_0x76aa('0xa0')))[_0x76aa('0x96')]();}_0x1f7f1d['push'](db['sequelize'][_0x76aa('0x33')](_0xb0a4e1));}return BPromise[_0x76aa('0x85')](_0x1f7f1d);}})[_0x76aa('0x17')](function(){var _0xbb19e4=[];var _0x226b44=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xa2'))['fromQuery']([_0x76aa('0xa3'),_0x76aa('0x92'),_0x76aa('0xa4'),'createdAt',_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')]('h.id')['field'](_0x76aa('0xa5'))['field'](_0x76aa('0xa6'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')['from'](_0x76aa('0xa7'),'ci')[_0x76aa('0x78')](_0x76aa('0x90'),'h',_0x76aa('0xa8'))[_0x76aa('0x2d')](_0x76aa('0xa9'),_0x2b2f27)['where'](_0x76aa('0xaa'),_0x76aa('0xab')))[_0x76aa('0x96')]();_0xbb19e4['push'](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x226b44));return BPromise[_0x76aa('0x85')](_0xbb19e4);})['then'](function(){return _0x1a5297;})[_0x76aa('0x17')](respondWithResult(_0x20638f,null))['catch'](handleError(_0x20638f,null));};exports['removeLists']=function(_0xef9ea7,_0x45f21f){return db[_0x76aa('0x29')]['find']({'where':{'id':_0xef9ea7[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x45f21f,null))[_0x76aa('0x17')](function(_0x113e70){if(_0x113e70){return _0x113e70['removeLists'](_0xef9ea7[_0x76aa('0x33')]['ids']);}})['then'](function(_0x583d68){if(_0x583d68){return db[_0x76aa('0x53')]['destroy']({'where':{'ListId':_0xef9ea7[_0x76aa('0x33')]['ids'],'VoiceQueueId':_0xef9ea7['params']['id']}})[_0x76aa('0x17')](function(){return _0x583d68;});}})['then'](respondWithStatusCode(_0x45f21f,null))['catch'](handleError(_0x45f21f,null));};exports[_0x76aa('0xac')]=function(_0x3b7370,_0x1c3431){var _0x865a1b={};var _0x132d60={};var _0x1a3074;var _0x3184a2;return db['VoiceQueue']['findOne']({'where':{'id':_0x3b7370[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1c3431,null))[_0x76aa('0x17')](function(_0x274356){if(_0x274356){_0x1a3074=_0x274356;_0x132d60[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0xad')][_0x76aa('0x2a')]);_0x132d60[_0x76aa('0x33')]=_['keys'](_0x3b7370['query']);_0x132d60[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x132d60[_0x76aa('0x31')],_0x132d60[_0x76aa('0x33')]);_0x865a1b['attributes']=_['intersection'](_0x132d60[_0x76aa('0x31')],qs['fields'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x36')]));_0x865a1b['attributes']=_0x865a1b[_0x76aa('0x34')][_0x76aa('0x37')]?_0x865a1b[_0x76aa('0x34')]:_0x132d60[_0x76aa('0x31')];_0x865a1b[_0x76aa('0x4e')]=qs['sort'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x865a1b['where']=qs['filters'](_[_0x76aa('0x50')](_0x3b7370[_0x76aa('0x33')],_0x132d60[_0x76aa('0x4c')]));if(_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]){_0x865a1b[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x865a1b[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x865a1b[_0x76aa('0x34')],function(_0xbb0ea3){var _0x4978dd={};_0x4978dd[_0xbb0ea3]={'$like':'%'+_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x4978dd;})});}_0x865a1b=_[_0x76aa('0x39')]({},_0x865a1b,_0x3b7370[_0x76aa('0x3a')]);return _0x1a3074['getBlackLists'](_0x865a1b);}})['then'](function(_0x4ee1d3){if(_0x4ee1d3){_0x3184a2=_0x4ee1d3['length'];if(!_0x3b7370[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x865a1b[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x12')]);_0x865a1b['offset']=qs['offset'](_0x3b7370[_0x76aa('0x33')]['offset']);}return _0x1a3074[_0x76aa('0xac')](_0x865a1b);}})[_0x76aa('0x17')](function(_0x3bc149){if(_0x3bc149){return _0x3bc149?{'count':_0x3184a2,'rows':_0x3bc149}:null;}})['then'](respondWithResult(_0x1c3431,null))[_0x76aa('0x3b')](handleError(_0x1c3431,null));};exports[_0x76aa('0xae')]=function(_0x29e112,_0x3fd683){var _0x5c2c4d;return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x29e112[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fd683,null))[_0x76aa('0x17')](function(_0xcb041d){if(_0xcb041d){return _0xcb041d[_0x76aa('0xae')](_0x29e112[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x29e112[_0x76aa('0x3d')],['ids','id'])||{});}return null;})['spread'](function(_0x72b9a){var _0x29db0f;_0x5c2c4d=_0x72b9a||[];var _0x28a212=[];if(_0x72b9a){for(var _0x242cd6=0x0;_0x242cd6<_0x72b9a[_0x76aa('0x37')];_0x242cd6+=0x1){var _0xeb428a=_0x72b9a[_0x242cd6][_0x76aa('0x18')]({'plain':!![]});_0x29db0f=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xaf'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))[_0x76aa('0x74')](_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x29e112['params']['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')](_0x76aa('0xb0'),'createdAt')[_0x76aa('0x74')](_0x76aa('0xb0'),_0x76aa('0x48'))['from'](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0')))['toString']();_0x28a212[_0x76aa('0x7c')](db['sequelize'][_0x76aa('0x33')](_0x29db0f));}return BPromise['all'](_0x28a212);}})[_0x76aa('0x17')](function(){return _0x5c2c4d;})['then'](respondWithResult(_0x3fd683,null))[_0x76aa('0x3b')](handleError(_0x3fd683,null));};exports[_0x76aa('0xb1')]=function(_0x140ee1,_0x3d9e9e){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x140ee1['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x3d9e9e,null))[_0x76aa('0x17')](function(_0x139e67){if(_0x139e67){return _0x139e67[_0x76aa('0xb1')](_0x140ee1['query'][_0x76aa('0x73')]);}})[_0x76aa('0x17')](function(_0x506cad){if(_0x506cad){return db['CmHopperBlack'][_0x76aa('0x25')]({'where':{'ListId':_0x140ee1[_0x76aa('0x33')][_0x76aa('0x73')],'VoiceQueueId':_0x140ee1[_0x76aa('0x46')]['id']}})['then'](function(){return _0x506cad;});}})['then'](respondWithStatusCode(_0x3d9e9e,null))[_0x76aa('0x3b')](handleError(_0x3d9e9e,null));}; \ No newline at end of file +var _0x6aa7=['ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','index','VoiceQueue','rawAttributes','fieldName','getOptions','where','include','rows','show','model','keys','query','attributes','intersection','fields','length','includeAll','merge','options','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','clone','params','omit','updatedAt','createdAt','getHoppers','findOne','filters','nolimit','order','sort','pick','VoiceQueueId','filter','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','hasOwnProperty','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','compact','isEmpty','removeAgents','addAgents','spread','all','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','toString','cm_contacts','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','select'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6aa7,0x178));var _0x76aa=function(_0x40a347,_0x3eac44){_0x40a347=_0x40a347-0x0;var _0x4bc8ac=_0x6aa7[_0x40a347];return _0x4bc8ac;};'use strict';var moment=require(_0x76aa('0x0'));var BPromise=require('bluebird');var util=require(_0x76aa('0x1'));var _=require(_0x76aa('0x2'));var squel=require(_0x76aa('0x3'));var Redis=require(_0x76aa('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x76aa('0x5'))(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x76aa('0x8')](config['redis'],{'host':_0x76aa('0x9'),'port':0x18eb});var socket=require(_0x76aa('0xa'))(new Redis(config[_0x76aa('0xb')]));require('./voiceQueue.socket')[_0x76aa('0xc')](socket);function respondWithStatusCode(_0x266bd5,_0x3a3f36){_0x3a3f36=_0x3a3f36||0xcc;return function(_0x557d69){if(_0x557d69){return _0x266bd5[_0x76aa('0xd')](_0x3a3f36);}return _0x266bd5[_0x76aa('0xe')](_0x3a3f36)[_0x76aa('0xf')]();};}function respondWithResult(_0x16cb50,_0x37f1ab){_0x37f1ab=_0x37f1ab||0xc8;return function(_0x128435){if(_0x128435){return _0x16cb50[_0x76aa('0xe')](_0x37f1ab)[_0x76aa('0x10')](_0x128435);}};}function respondWithFilteredResult(_0xd6327,_0x17a417){return function(_0x5e5f47){if(_0x5e5f47){var _0x112c39=typeof _0x17a417['offset']===_0x76aa('0x11')&&typeof _0x17a417[_0x76aa('0x12')]===_0x76aa('0x11');var _0x8e44ed=_0x5e5f47[_0x76aa('0x13')];var _0x4e309f=_0x112c39?0x0:_0x17a417['offset'];var _0x2b3b4f=_0x112c39?_0x5e5f47['count']:_0x17a417[_0x76aa('0x14')]+_0x17a417[_0x76aa('0x12')];var _0x5cf594;if(_0x2b3b4f>=_0x8e44ed){_0x2b3b4f=_0x8e44ed;_0x5cf594=0xc8;}else{_0x5cf594=0xce;}_0xd6327[_0x76aa('0xe')](_0x5cf594);return _0xd6327['set'](_0x76aa('0x15'),_0x4e309f+'-'+_0x2b3b4f+'/'+_0x8e44ed)['json'](_0x5e5f47);}return null;};}function saveUpdates(_0x1515e9){return function(_0x413cf6){if(_0x413cf6){return _0x413cf6[_0x76aa('0x16')](_0x1515e9)[_0x76aa('0x17')](function(_0xa1bc7){return _0xa1bc7;});}return null;};}function removeEntity(_0x3ead3f){return function(_0x496902){if(_0x496902){return _0x496902['destroy']()[_0x76aa('0x17')](function(){var _0x454dd3=_0x496902[_0x76aa('0x18')]({'plain':!![]});var _0x15b931=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a'),'ignore':![]},{'name':_0x76aa('0x1b'),'value':_0x76aa('0x1c'),'ignore':![]}];var _0x385157=_(_0x15b931)['filter'](_0x76aa('0x1d'))[_0x76aa('0x1e')](_0x76aa('0x1f'))['value']();if(_[_0x76aa('0x20')](_0x385157,_0x454dd3[_0x76aa('0x21')])){return;}var _0x31252f=_[_0x76aa('0x22')](_0x15b931,[_0x76aa('0x1f'),_0x454dd3[_0x76aa('0x21')]])[_0x76aa('0x23')];return db[_0x76aa('0x24')][_0x76aa('0x25')]({'where':{'type':_0x31252f,'resourceId':_0x454dd3['id']}})[_0x76aa('0x17')](function(){return _0x496902;});})[_0x76aa('0x17')](function(){_0x3ead3f[_0x76aa('0xe')](0xcc)[_0x76aa('0xf')]();});}};}function handleEntityNotFound(_0x4ef9b0){return function(_0xb5e8a9){if(!_0xb5e8a9){_0x4ef9b0[_0x76aa('0xd')](0x194);}return _0xb5e8a9;};}function handleError(_0x25c614,_0x2e7ab4){_0x2e7ab4=_0x2e7ab4||0x1f4;return function(_0xa1e6){logger[_0x76aa('0x26')](_0xa1e6[_0x76aa('0x27')]);if(_0xa1e6[_0x76aa('0x23')]){delete _0xa1e6[_0x76aa('0x23')];}_0x25c614[_0x76aa('0xe')](_0x2e7ab4)['send'](_0xa1e6);};}exports[_0x76aa('0x28')]=function(_0x5a8030,_0x994550){var _0x365ff8={};var _0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x1e')](db[_0x76aa('0x29')][_0x76aa('0x2a')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x2b')],'type':_0x3827ec[_0x76aa('0x21')]['key']};});_0x365ff8=qs[_0x76aa('0x2c')](_0x1e90b9,_0x5a8030);var _0x5532c7={'where':_0x365ff8[_0x76aa('0x2d')]};return db[_0x76aa('0x29')][_0x76aa('0x13')](_0x5532c7)[_0x76aa('0x17')](function(_0x35a705){_0x2dec94['count']=_0x35a705;_0x365ff8[_0x76aa('0x2e')]=qs[_0x76aa('0x2e')](_0x5a8030['query']);return db[_0x76aa('0x29')]['findAll'](_0x365ff8);})[_0x76aa('0x17')](function(_0x4c90b6){_0x2dec94[_0x76aa('0x2f')]=_0x4c90b6;return _0x2dec94;})['then'](respondWithFilteredResult(_0x994550,_0x365ff8))['catch'](handleError(_0x994550,null));};exports[_0x76aa('0x30')]=function(_0x282c56,_0x198fcb){var _0x37dfab={'raw':![],'where':{'id':_0x282c56['params']['id']}},_0x595a0f={};_0x595a0f[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')][_0x76aa('0x2a')]);_0x595a0f[_0x76aa('0x33')]=_['keys'](_0x282c56[_0x76aa('0x33')]);_0x595a0f['filters']=_['intersection'](_0x595a0f[_0x76aa('0x31')],_0x595a0f[_0x76aa('0x33')]);_0x37dfab[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x595a0f['model'],qs[_0x76aa('0x36')](_0x282c56[_0x76aa('0x33')][_0x76aa('0x36')]));_0x37dfab['attributes']=_0x37dfab[_0x76aa('0x34')][_0x76aa('0x37')]?_0x37dfab[_0x76aa('0x34')]:_0x595a0f[_0x76aa('0x31')];if(_0x282c56[_0x76aa('0x33')][_0x76aa('0x38')]){_0x37dfab[_0x76aa('0x2e')]=[{'all':!![]}];}_0x37dfab=_[_0x76aa('0x39')]({},_0x37dfab,_0x282c56[_0x76aa('0x3a')]);return db['VoiceQueue'][_0x76aa('0x22')](_0x37dfab)[_0x76aa('0x17')](handleEntityNotFound(_0x198fcb,null))[_0x76aa('0x17')](respondWithResult(_0x198fcb,null))[_0x76aa('0x3b')](handleError(_0x198fcb,null));};exports[_0x76aa('0x3c')]=function(_0x2957aa,_0x572fdb){return db['VoiceQueue'][_0x76aa('0x3c')](_0x2957aa[_0x76aa('0x3d')],{})[_0x76aa('0x17')](function(_0x365612){var _0x50599f=_0x2957aa[_0x76aa('0x3e')][_0x76aa('0x18')]({'plain':!![]});if(!_0x50599f)throw new Error(_0x76aa('0x3f'));if(_0x50599f[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x4aa2f3=_0x365612[_0x76aa('0x18')]({'plain':!![]});var _0x556f59=[{'name':_0x76aa('0x19'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x144f0a=_['find'](_0x556f59,['value',_0x4aa2f3['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x144f0a,'userProfileId':_0x50599f[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0x47b0c8){if(_0x47b0c8&&_0x47b0c8[_0x76aa('0x43')]===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x4aa2f3[_0x76aa('0x23')],'resourceId':_0x4aa2f3['id'],'type':_0x47b0c8[_0x76aa('0x23')],'sectionId':_0x47b0c8['id']},{})['then'](function(){return _0x365612;});}else{return _0x365612;}})[_0x76aa('0x3b')](function(_0x1c62a9){logger['error'](_0x76aa('0x44'),_0x1c62a9);throw _0x1c62a9;});}return _0x365612;})['then'](respondWithResult(_0x572fdb,0xc9))[_0x76aa('0x3b')](handleError(_0x572fdb,null));};exports[_0x76aa('0x45')]=function(_0x31930b,_0x18fd3e){var _0x2d0bc4={'where':{'id':_0x31930b[_0x76aa('0x46')]['id']}},_0x3e0315={};_0x3e0315[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')]['rawAttributes']);_0x2d0bc4[_0x76aa('0x34')]=_['intersection'](_0x3e0315[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x31930b[_0x76aa('0x33')][_0x76aa('0x36')]));_0x2d0bc4['attributes']=_0x2d0bc4['attributes'][_0x76aa('0x37')]?_0x2d0bc4['attributes']:_0x3e0315[_0x76aa('0x31')];if(_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]){_0x2d0bc4[_0x76aa('0x2e')]=[{'all':!![]}];}_0x2d0bc4=_[_0x76aa('0x39')]({},_0x2d0bc4,_0x31930b[_0x76aa('0x3a')]);return db['VoiceQueue']['find'](_0x2d0bc4)[_0x76aa('0x17')](handleEntityNotFound(_0x18fd3e,null))[_0x76aa('0x17')](function(_0x1708d4){if(_0x1708d4){var _0x40e8ff=_0x1708d4[_0x76aa('0x18')]({'plain':!![]});_0x40e8ff=qs[_0x76aa('0x47')](_0x40e8ff,['id','createdAt',_0x76aa('0x48')]);_0x31930b[_0x76aa('0x3d')]=_[_0x76aa('0x47')](_0x31930b['body'],['id',_0x76aa('0x49'),'updatedAt']);return db[_0x76aa('0x29')]['create'](_[_0x76aa('0x39')](_0x40e8ff,_0x31930b[_0x76aa('0x3d')]),{'include':_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]?[{'all':!![]}]:undefined})[_0x76aa('0x17')](function(_0x316de3){var _0x953726=_0x31930b['user'][_0x76aa('0x18')]({'plain':!![]});if(!_0x953726)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x953726[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x288151=_0x316de3[_0x76aa('0x18')]({'plain':!![]});var _0x3fa7ec=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a')},{'name':'QueueCampaigns','value':_0x76aa('0x1c')}];var _0x281f73=_[_0x76aa('0x22')](_0x3fa7ec,[_0x76aa('0x1f'),_0x288151['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x281f73,'userProfileId':_0x953726[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0xf7732){if(_0xf7732&&_0xf7732['autoAssociation']===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x288151[_0x76aa('0x23')],'resourceId':_0x288151['id'],'type':_0xf7732[_0x76aa('0x23')],'sectionId':_0xf7732['id']},{})[_0x76aa('0x17')](function(){return _0x316de3;});}else{return _0x316de3;}})[_0x76aa('0x3b')](function(_0x37babe){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37babe);throw _0x37babe;});}return _0x316de3;});}})[_0x76aa('0x17')](respondWithResult(_0x18fd3e,0xc9))[_0x76aa('0x3b')](handleError(_0x18fd3e,null));};exports['update']=function(_0x3d7802,_0x1e6f3c){if(_0x3d7802['body']['id']){delete _0x3d7802[_0x76aa('0x3d')]['id'];}return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x3d7802[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1e6f3c,null))[_0x76aa('0x17')](saveUpdates(_0x3d7802[_0x76aa('0x3d')],null))[_0x76aa('0x17')](respondWithResult(_0x1e6f3c,null))[_0x76aa('0x3b')](handleError(_0x1e6f3c,null));};exports['destroy']=function(_0xd337f0,_0x49156c){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0xd337f0[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x49156c,null))[_0x76aa('0x17')](removeEntity(_0x49156c,null))[_0x76aa('0x3b')](handleError(_0x49156c,null));};exports[_0x76aa('0x4a')]=function(_0x431d1c,_0x2f1263){var _0x5eceba={'raw':![],'where':{}};var _0x267fcf={};var _0x3d4025={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x431d1c[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x2f1263,null))[_0x76aa('0x17')](function(_0x157540){if(_0x157540){_0x267fcf['model']=_[_0x76aa('0x32')](db['CmHopper'][_0x76aa('0x2a')]);_0x267fcf[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x431d1c[_0x76aa('0x33')]);_0x267fcf[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x267fcf[_0x76aa('0x31')],_0x267fcf['query']);_0x5eceba[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x267fcf['model'],qs['fields'](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x36')]));_0x5eceba['attributes']=_0x5eceba[_0x76aa('0x34')][_0x76aa('0x37')]?_0x5eceba[_0x76aa('0x34')]:_0x267fcf['model'];if(!_0x431d1c[_0x76aa('0x33')]['hasOwnProperty'](_0x76aa('0x4d'))){_0x5eceba[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x431d1c[_0x76aa('0x33')]['limit']);_0x5eceba['offset']=qs[_0x76aa('0x14')](_0x431d1c['query'][_0x76aa('0x14')]);}_0x5eceba[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x5eceba[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x431d1c[_0x76aa('0x33')],_0x267fcf['filters']));_0x5eceba[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x157540['id'];if(_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]){_0x5eceba['where']=_['merge'](_0x5eceba['where'],{'$or':_[_0x76aa('0x1e')](_0x5eceba['attributes'],function(_0xb61e5){var _0x256195={};_0x256195[_0xb61e5]={'$like':'%'+_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x256195;})});}_0x5eceba=_['merge']({},_0x5eceba,_0x431d1c[_0x76aa('0x3a')]);return db['CmHopper'][_0x76aa('0x13')]({'where':_0x5eceba[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x11d602){_0x3d4025[_0x76aa('0x13')]=_0x11d602;if(_0x431d1c['query'][_0x76aa('0x38')]){_0x5eceba[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x53')][_0x76aa('0x54')](_0x5eceba);})[_0x76aa('0x17')](function(_0x22432d){_0x3d4025[_0x76aa('0x2f')]=_0x22432d;return _0x3d4025;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x2f1263,_0x5eceba))['catch'](handleError(_0x2f1263,null));};exports[_0x76aa('0x55')]=function(_0x381f44,_0x48136a){var _0x3c1b98={'raw':!![],'where':{}};var _0x215463={};var _0x325487={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x381f44[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x48136a,null))['then'](function(_0xdb821b){if(_0xdb821b){_0x215463['model']=_['keys'](db[_0x76aa('0x56')][_0x76aa('0x2a')]);_0x215463['query']=_['keys'](_0x381f44[_0x76aa('0x33')]);_0x215463[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x215463['model'],_0x215463['query']);_0x3c1b98[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x215463[_0x76aa('0x31')],qs['fields'](_0x381f44[_0x76aa('0x33')]['fields']));_0x3c1b98[_0x76aa('0x34')]=_0x3c1b98[_0x76aa('0x34')][_0x76aa('0x37')]?_0x3c1b98[_0x76aa('0x34')]:_0x215463[_0x76aa('0x31')];if(!_0x381f44['query']['hasOwnProperty'](_0x76aa('0x4d'))){_0x3c1b98[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x381f44['query'][_0x76aa('0x12')]);_0x3c1b98[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x381f44[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x3c1b98['order']=qs[_0x76aa('0x4f')](_0x381f44['query'][_0x76aa('0x4f')]);_0x3c1b98[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x381f44[_0x76aa('0x33')],_0x215463[_0x76aa('0x4c')]));_0x3c1b98['where']['VoiceQueueId']=_0xdb821b['id'];if(_0x381f44['query']['filter']){_0x3c1b98['where']=_[_0x76aa('0x39')](_0x3c1b98[_0x76aa('0x2d')],{'$or':_['map'](_0x3c1b98['attributes'],function(_0x4f01e9){var _0x3a6326={};_0x3a6326[_0x4f01e9]={'$like':'%'+_0x381f44[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x3a6326;})});}_0x3c1b98=_['merge']({},_0x3c1b98,_0x381f44['options']);return db[_0x76aa('0x56')][_0x76aa('0x13')]({'where':_0x3c1b98[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x354c7b){_0x325487['count']=_0x354c7b;if(_0x381f44['query'][_0x76aa('0x38')]){_0x3c1b98['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x3c1b98);})[_0x76aa('0x17')](function(_0xbb1ccd){_0x325487['rows']=_0xbb1ccd;return _0x325487;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x48136a,_0x3c1b98))[_0x76aa('0x3b')](handleError(_0x48136a,null));};exports['getHopperFinals']=function(_0x22063f,_0x24331a){var _0x11d91f={'raw':!![],'where':{}};var _0x258e5a={};var _0x1fa86b={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x22063f[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x24331a,null))['then'](function(_0x84bc91){if(_0x84bc91){_0x258e5a[_0x76aa('0x31')]=_['keys'](db[_0x76aa('0x57')][_0x76aa('0x2a')]);_0x258e5a[_0x76aa('0x33')]=_['keys'](_0x22063f[_0x76aa('0x33')]);_0x258e5a[_0x76aa('0x4c')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],_0x258e5a[_0x76aa('0x33')]);_0x11d91f[_0x76aa('0x34')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x22063f['query']['fields']));_0x11d91f['attributes']=_0x11d91f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x11d91f[_0x76aa('0x34')]:_0x258e5a[_0x76aa('0x31')];if(!_0x22063f['query']['hasOwnProperty']('nolimit')){_0x11d91f[_0x76aa('0x12')]=qs['limit'](_0x22063f[_0x76aa('0x33')][_0x76aa('0x12')]);_0x11d91f['offset']=qs[_0x76aa('0x14')](_0x22063f[_0x76aa('0x33')]['offset']);}_0x11d91f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x22063f[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x11d91f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x22063f[_0x76aa('0x33')],_0x258e5a['filters']));_0x11d91f['where']['VoiceQueueId']=_0x84bc91['id'];if(_0x22063f['query']['filter']){_0x11d91f[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x11d91f[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x11d91f['attributes'],function(_0x447103){var _0x2192ed={};_0x2192ed[_0x447103]={'$like':'%'+_0x22063f[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2192ed;})});}_0x11d91f=_[_0x76aa('0x39')]({},_0x11d91f,_0x22063f['options']);return db[_0x76aa('0x57')][_0x76aa('0x13')]({'where':_0x11d91f[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x13be70){_0x1fa86b[_0x76aa('0x13')]=_0x13be70;if(_0x22063f[_0x76aa('0x33')]['includeAll']){_0x11d91f[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x57')]['findAll'](_0x11d91f);})['then'](function(_0x216e87){_0x1fa86b[_0x76aa('0x2f')]=_0x216e87;return _0x1fa86b;});}})['then'](respondWithFilteredResult(_0x24331a,_0x11d91f))[_0x76aa('0x3b')](handleError(_0x24331a,null));};exports['getHopperBlacks']=function(_0x28ec11,_0x5cc005){var _0x28b439={'raw':!![],'where':{}};var _0x583924={};var _0x45227e={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x28ec11['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x5cc005,null))['then'](function(_0x1af32e){if(_0x1af32e){_0x583924[_0x76aa('0x31')]=_['keys'](db['CmHopperBlack'][_0x76aa('0x2a')]);_0x583924[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x28ec11[_0x76aa('0x33')]);_0x583924['filters']=_['intersection'](_0x583924[_0x76aa('0x31')],_0x583924['query']);_0x28b439[_0x76aa('0x34')]=_['intersection'](_0x583924[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x28ec11['query'][_0x76aa('0x36')]));_0x28b439['attributes']=_0x28b439['attributes'][_0x76aa('0x37')]?_0x28b439[_0x76aa('0x34')]:_0x583924['model'];if(!_0x28ec11[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x28b439['limit']=qs[_0x76aa('0x12')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x12')]);_0x28b439[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x28b439[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x28b439[_0x76aa('0x2d')]=qs['filters'](_[_0x76aa('0x50')](_0x28ec11[_0x76aa('0x33')],_0x583924['filters']));_0x28b439[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x1af32e['id'];if(_0x28ec11['query']['filter']){_0x28b439[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x28b439['where'],{'$or':_[_0x76aa('0x1e')](_0x28b439[_0x76aa('0x34')],function(_0x24af48){var _0x5010c8={};_0x5010c8[_0x24af48]={'$like':'%'+_0x28ec11[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x5010c8;})});}_0x28b439=_['merge']({},_0x28b439,_0x28ec11[_0x76aa('0x3a')]);return db[_0x76aa('0x59')][_0x76aa('0x13')]({'where':_0x28b439[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x42543c){_0x45227e['count']=_0x42543c;if(_0x28ec11[_0x76aa('0x33')]['includeAll']){_0x28b439[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x59')][_0x76aa('0x54')](_0x28b439);})['then'](function(_0x4c5f54){_0x45227e[_0x76aa('0x2f')]=_0x4c5f54;return _0x45227e;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x5cc005,_0x28b439))[_0x76aa('0x3b')](handleError(_0x5cc005,null));};exports[_0x76aa('0x5a')]=function(_0x1a81fd,_0x1eb8f2){var _0x4f7dd4={};var _0x5a4c03={};var _0x2565a2;var _0x109bd3;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x1a81fd['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1eb8f2,null))['then'](function(_0x54d530){if(_0x54d530){_0x2565a2=_0x54d530;_0x5a4c03[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x5b')]['rawAttributes']);_0x5a4c03[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x1a81fd[_0x76aa('0x33')]);_0x5a4c03[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],_0x5a4c03[_0x76aa('0x33')]);_0x4f7dd4['attributes']=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x36')]));_0x4f7dd4[_0x76aa('0x34')]=_0x4f7dd4['attributes'][_0x76aa('0x37')]?_0x4f7dd4[_0x76aa('0x34')]:_0x5a4c03[_0x76aa('0x31')];_0x4f7dd4[_0x76aa('0x4e')]=qs['sort'](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x4f7dd4[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x1a81fd['query'],_0x5a4c03[_0x76aa('0x4c')]));if(_0x1a81fd[_0x76aa('0x33')]['filter']){_0x4f7dd4['where']=_[_0x76aa('0x39')](_0x4f7dd4[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x4f7dd4[_0x76aa('0x34')],function(_0x46f098){var _0x293221={};_0x293221[_0x46f098]={'$like':'%'+_0x1a81fd['query'][_0x76aa('0x52')]+'%'};return _0x293221;})});}_0x4f7dd4=_[_0x76aa('0x39')]({},_0x4f7dd4,_0x1a81fd[_0x76aa('0x3a')]);return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x2e7bb7){if(_0x2e7bb7){_0x109bd3=_0x2e7bb7['length'];if(!_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x4f7dd4[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x1a81fd[_0x76aa('0x33')]['limit']);_0x4f7dd4[_0x76aa('0x14')]=qs['offset'](_0x1a81fd[_0x76aa('0x33')]['offset']);}return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x56d6af){if(_0x56d6af){return _0x56d6af?{'count':_0x109bd3,'rows':_0x56d6af}:null;}})[_0x76aa('0x17')](respondWithResult(_0x1eb8f2,null))[_0x76aa('0x3b')](handleError(_0x1eb8f2,null));};exports[_0x76aa('0x5c')]=function(_0x57636c,_0x3ae5e8){var _0x46c818=_0x57636c['body'][_0x76aa('0x5d')];var _0xfe926d=_[_0x76aa('0x1e')](_0x46c818,'id');return db[_0x76aa('0x5b')][_0x76aa('0x54')]({'where':{'id':_0xfe926d},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':'Agents','attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]}]})[_0x76aa('0x17')](function(_0x28e1a4){if(_0x28e1a4){var _0x8bb516=_[_0x76aa('0x62')](_0x28e1a4,function(_0xf9f670){var _0x1359f9=_0xf9f670[_0x76aa('0x18')]({'plain':!![]});_0x1359f9['Agents'][_0x76aa('0x63')](function(_0x58cd0c){_0x58cd0c[_0x76aa('0x64')]=_[_0x76aa('0x22')](_0x46c818,{'id':_0x1359f9['id']})[_0x76aa('0x64')];});return _0x1359f9[_0x76aa('0x65')];});return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x57636c['params']['id']}})[_0x76aa('0x17')](function(_0x53090c){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x2045a2){return _0x53090c['addTeams'](_0xfe926d,{'transaction':_0x2045a2})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_0x46c818,function(_0x228968){return db[_0x76aa('0x69')][_0x76aa('0x6a')]({'TeamId':_0x228968['id'],'VoiceQueueId':_0x57636c['params']['id'],'penalty':_0x228968[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})['then'](function(){return BPromise[_0x76aa('0x68')](_0x8bb516,function(_0x1bc764){return db['UserVoiceQueue'][_0x76aa('0x6b')]({'where':{'UserId':_0x1bc764['id'],'VoiceQueueId':_0x57636c[_0x76aa('0x46')]['id']},'defaults':{'penalty':_0x1bc764[_0x76aa('0x64')]},'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_[_0x76aa('0x52')](_0x8bb516,{'online':!![]}),function(_0x245af7){return db[_0x76aa('0x6c')]['upsert']({'membername':_0x245af7[_0x76aa('0x23')],'UserId':_0x245af7['id'],'queue_name':_0x53090c[_0x76aa('0x23')],'VoiceQueueId':_0x53090c['id'],'interface':_[_0x76aa('0x6d')](_0x245af7[_0x76aa('0x61')])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x245af7[_0x76aa('0x23')]):_0x245af7[_0x76aa('0x61')],'paused':_0x245af7['voicePause']||![],'penalty':_0x245af7[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){_0x8bb516[_0x76aa('0x63')](function(_0x54e450){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':_0x54e450['id'],'VoiceQueueId':_0x53090c['id']});});});});});}})[_0x76aa('0x17')](respondWithStatusCode(_0x3ae5e8,null))[_0x76aa('0x3b')](handleError(_0x3ae5e8,null));};exports[_0x76aa('0x72')]=function(_0x5db8d8,_0x21fd43){return db['Team'][_0x76aa('0x54')]({'where':{'id':_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')]},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':_0x76aa('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21fd43,null))[_0x76aa('0x17')](function(_0x4920fa){var _0x577463=_[_0x76aa('0x1e')](_0x4920fa,'id');var _0x20ba92=[];var _0x533080=[];var _0x3cd088=squel['select']();_0x3cd088[_0x76aa('0x74')](_0x76aa('0x75'))[_0x76aa('0x76')](_0x76aa('0x77'),'tq')[_0x76aa('0x78')](_0x76aa('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x5db8d8[_0x76aa('0x46')]['id']);for(var _0x3ebe91=0x0;_0x3ebe91<_0x4920fa[_0x76aa('0x37')];_0x3ebe91+=0x1){let _0x14318c=_0x4920fa[_0x3ebe91];for(var _0xbfa5f8=0x0;_0xbfa5f8<_0x14318c[_0x76aa('0x65')][_0x76aa('0x37')];_0xbfa5f8+=0x1){let _0x46772f=_0x14318c[_0x76aa('0x65')][_0xbfa5f8];var _0x40df44=_0x3cd088[_0x76aa('0x45')]();_0x40df44[_0x76aa('0x2d')](_0x76aa('0x7b'),_0x46772f['id']);_0x533080[_0x76aa('0x7c')](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x40df44['toString'](),{'type':db[_0x76aa('0x66')]['QueryTypes'][_0x76aa('0x7d')]})[_0x76aa('0x17')](function(_0x4a093b){if(_0x4a093b[_0x76aa('0x37')]===0x1){return _0x46772f['id'];}else{var _0x5305f1=_[_0x76aa('0x7e')](_[_0x76aa('0x1e')](_0x4a093b,_0x76aa('0x7f')),function(_0x5ceae2){return _[_0x76aa('0x20')](_0x577463,_0x5ceae2);});if(_0x5305f1){return _0x46772f['id'];}}}));}}return BPromise['all'](_0x533080)['then'](function(_0x3c9841){_0x20ba92=_(_0x20ba92)['union'](_0x3c9841)[_0x76aa('0x80')]()['value']();return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5db8d8[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](function(_0x3f4ded){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x434634){return _0x3f4ded[_0x76aa('0x72')](_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')],{'transaction':_0x434634})[_0x76aa('0x17')](function(){if(!_[_0x76aa('0x81')](_0x20ba92)){return _0x3f4ded[_0x76aa('0x82')](_0x20ba92,{'transaction':_0x434634})[_0x76aa('0x17')](function(){return db['UserVoiceQueueRt'][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5db8d8[_0x76aa('0x46')]['id'],'UserId':_0x20ba92},'transaction':_0x434634});});}})[_0x76aa('0x17')](function(){_0x20ba92[_0x76aa('0x63')](function(_0x540bf3){socket[_0x76aa('0x70')]('userVoiceQueue:remove',{'UserId':_0x540bf3,'VoiceQueueId':_0x3f4ded['id']});});});});});});})[_0x76aa('0x17')](respondWithStatusCode(_0x21fd43,null))['catch'](handleError(_0x21fd43,null));};exports[_0x76aa('0x83')]=function(_0x5427f0,_0x3e9153){var _0x490090,_0x31b7a8;return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5427f0[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e9153,null))[_0x76aa('0x17')](function(_0x51feca){if(_0x51feca){_0x31b7a8=_0x51feca;return _0x51feca[_0x76aa('0x83')](_0x5427f0['body'][_0x76aa('0x73')],_['omit'](_0x5427f0['body'],[_0x76aa('0x73'),'id'])||{})[_0x76aa('0x84')](function(_0x38b6aa){for(var _0x395501=0x0;_0x395501<_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')][_0x76aa('0x37')];_0x395501+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':Number(_0x5427f0[_0x76aa('0x3d')]['ids'][_0x395501]),'VoiceQueueId':Number(_0x5427f0[_0x76aa('0x46')]['id'])});}return _0x38b6aa;});}})[_0x76aa('0x17')](function(_0x3d969f){_0x490090=_0x3d969f||[];if(_0x31b7a8){return db[_0x76aa('0x5e')][_0x76aa('0x54')]({'where':{'id':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')]},'attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]});}})[_0x76aa('0x17')](function(_0x3274a9){if(!_[_0x76aa('0x81')](_0x3274a9)){var _0x5c0268=[];for(var _0x5c5a6f=0x0;_0x5c5a6f<_0x3274a9[_0x76aa('0x37')];_0x5c5a6f++){if(_0x3274a9[_0x5c5a6f][_0x76aa('0x5f')]){_0x5c0268[_0x76aa('0x7c')](db['UserVoiceQueueRt']['upsert']({'membername':_0x3274a9[_0x5c5a6f][_0x76aa('0x23')],'UserId':_0x3274a9[_0x5c5a6f]['id'],'queue_name':_0x31b7a8[_0x76aa('0x23')],'VoiceQueueId':_0x31b7a8['id'],'interface':_[_0x76aa('0x6d')](_0x3274a9[_0x5c5a6f]['interface'])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x3274a9[_0x5c5a6f]['name']):_0x3274a9[_0x5c5a6f]['interface'],'paused':_0x3274a9[_0x5c5a6f]['voicePause']||![],'penalty':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x64')]||0x0}));}}return BPromise[_0x76aa('0x85')](_0x5c0268);}})['then'](function(){return _0x490090;})[_0x76aa('0x17')](respondWithResult(_0x3e9153,null))[_0x76aa('0x3b')](handleError(_0x3e9153,null));};exports['removeAgents']=function(_0x5433dc,_0x328d1a){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x5433dc['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x328d1a,null))[_0x76aa('0x17')](function(_0x546770){if(_0x546770){return _0x546770[_0x76aa('0x82')](_0x5433dc[_0x76aa('0x33')]['ids'])[_0x76aa('0x17')](function(){if(_[_0x76aa('0x86')](_0x5433dc['query'][_0x76aa('0x73')])){for(var _0x4df504=0x0;_0x4df504<_0x5433dc['query'][_0x76aa('0x73')][_0x76aa('0x37')];_0x4df504+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')][_0x76aa('0x73')][_0x4df504]),'VoiceQueueId':Number(_0x5433dc[_0x76aa('0x46')]['id'])});}}else{socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')]['ids']),'VoiceQueueId':Number(_0x5433dc['params']['id'])});}});}})[_0x76aa('0x17')](function(_0x2726da){return db[_0x76aa('0x6c')][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5433dc[_0x76aa('0x46')]['id'],'UserId':_0x5433dc[_0x76aa('0x33')]['ids']}})[_0x76aa('0x17')](function(){return _0x2726da;});})[_0x76aa('0x17')](respondWithStatusCode(_0x328d1a,null))[_0x76aa('0x3b')](handleError(_0x328d1a,null));};exports[_0x76aa('0x88')]=function(_0x38694d,_0xf0b932){var _0x1c8cf5={};var _0x5a8d0f={};var _0x5f513d;var _0x54e70c;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x38694d[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0xf0b932,null))[_0x76aa('0x17')](function(_0x4afe13){if(_0x4afe13){_0x5f513d=_0x4afe13;_0x5a8d0f['model']=_[_0x76aa('0x32')](db[_0x76aa('0x5e')][_0x76aa('0x2a')]);_0x5a8d0f[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x38694d['query']);_0x5a8d0f[_0x76aa('0x4c')]=_['intersection'](_0x5a8d0f[_0x76aa('0x31')],_0x5a8d0f['query']);_0x1c8cf5['attributes']=_[_0x76aa('0x35')](_0x5a8d0f['model'],qs[_0x76aa('0x36')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x36')]));_0x1c8cf5[_0x76aa('0x34')]=_0x1c8cf5[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1c8cf5[_0x76aa('0x34')]:_0x5a8d0f[_0x76aa('0x31')];_0x1c8cf5['order']=qs[_0x76aa('0x4f')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1c8cf5[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x38694d[_0x76aa('0x33')],_0x5a8d0f['filters']));if(_0x38694d[_0x76aa('0x33')]['filter']){_0x1c8cf5[_0x76aa('0x2d')]=_['merge'](_0x1c8cf5[_0x76aa('0x2d')],{'$or':_['map'](_0x1c8cf5[_0x76aa('0x34')],function(_0x8b2ee1){var _0x279be2={};_0x279be2[_0x8b2ee1]={'$like':'%'+_0x38694d['query']['filter']+'%'};return _0x279be2;})});}_0x1c8cf5=_[_0x76aa('0x39')]({},_0x1c8cf5,_0x38694d['options']);return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x1b99d8){if(_0x1b99d8){_0x54e70c=_0x1b99d8['length'];if(!_0x38694d['query']['hasOwnProperty']('nolimit')){_0x1c8cf5[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1c8cf5[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x2484fd){if(_0x2484fd){return _0x2484fd?{'count':_0x54e70c,'rows':_0x2484fd}:null;}})[_0x76aa('0x17')](respondWithResult(_0xf0b932,null))[_0x76aa('0x3b')](handleError(_0xf0b932,null));};exports['getMembers']=function(_0x2b12e9,_0x4e697b){var _0x1e902d={};var _0x3a7658={};var _0x1b1f85;var _0x3fb275;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x2b12e9[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x4e697b,null))[_0x76aa('0x17')](function(_0x1bdc5c){if(_0x1bdc5c){_0x1b1f85=_0x1bdc5c;_0x3a7658[_0x76aa('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x76aa('0x2a')]);_0x3a7658[_0x76aa('0x33')]=_['keys'](_0x2b12e9[_0x76aa('0x33')]);_0x3a7658[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x3a7658[_0x76aa('0x31')],_0x3a7658[_0x76aa('0x33')]);_0x1e902d[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x3a7658['model'],qs[_0x76aa('0x36')](_0x2b12e9[_0x76aa('0x33')]['fields']));_0x1e902d['attributes']=_0x1e902d[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1e902d[_0x76aa('0x34')]:_0x3a7658[_0x76aa('0x31')];_0x1e902d[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1e902d[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x2b12e9[_0x76aa('0x33')],_0x3a7658[_0x76aa('0x4c')]));if(_0x2b12e9['query']['filter']){_0x1e902d[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x1e902d[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x1e902d['attributes'],function(_0x5f3819){var _0x2a8410={};_0x2a8410[_0x5f3819]={'$like':'%'+_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2a8410;})});}_0x1e902d=_['merge']({},_0x1e902d,_0x2b12e9['options']);return _0x1b1f85['getMembers'](_0x1e902d);}})[_0x76aa('0x17')](function(_0x4df872){if(_0x4df872){_0x3fb275=_0x4df872[_0x76aa('0x37')];if(!_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x1e902d[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1e902d[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x1b1f85[_0x76aa('0x89')](_0x1e902d);}})[_0x76aa('0x17')](function(_0x3b1f33){return _0x3b1f33?{'count':_0x3fb275,'rows':_0x3b1f33}:null;})[_0x76aa('0x17')](respondWithResult(_0x4e697b,null))['catch'](handleError(_0x4e697b,null));};exports[_0x76aa('0x8a')]=function(_0x5e8cec,_0x1a37e9){var _0x58932f={};var _0x17bd1a={};var _0x5d7a2b;var _0x363c45;return db['VoiceQueue']['findOne']({'where':{'id':_0x5e8cec[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1a37e9,null))[_0x76aa('0x17')](function(_0x44668d){if(_0x44668d){_0x5d7a2b=_0x44668d;_0x17bd1a[_0x76aa('0x31')]=_[_0x76aa('0x32')](db['CmList'][_0x76aa('0x2a')]);_0x17bd1a[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x5e8cec[_0x76aa('0x33')]);_0x17bd1a['filters']=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],_0x17bd1a[_0x76aa('0x33')]);_0x58932f[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x36')]));_0x58932f[_0x76aa('0x34')]=_0x58932f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x58932f['attributes']:_0x17bd1a['model'];_0x58932f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x58932f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x5e8cec[_0x76aa('0x33')],_0x17bd1a[_0x76aa('0x4c')]));if(_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x52')]){_0x58932f['where']=_[_0x76aa('0x39')](_0x58932f['where'],{'$or':_[_0x76aa('0x1e')](_0x58932f[_0x76aa('0x34')],function(_0x278bac){var _0x14256c={};_0x14256c[_0x278bac]={'$like':'%'+_0x5e8cec[_0x76aa('0x33')]['filter']+'%'};return _0x14256c;})});}_0x58932f=_['merge']({},_0x58932f,_0x5e8cec[_0x76aa('0x3a')]);return _0x5d7a2b['getLists'](_0x58932f);}})[_0x76aa('0x17')](function(_0xb760ca){if(_0xb760ca){_0x363c45=_0xb760ca[_0x76aa('0x37')];if(!_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x58')]('nolimit')){_0x58932f['limit']=qs[_0x76aa('0x12')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x12')]);_0x58932f[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5d7a2b[_0x76aa('0x8a')](_0x58932f);}})[_0x76aa('0x17')](function(_0x33644d){if(_0x33644d){return _0x33644d?{'count':_0x363c45,'rows':_0x33644d}:null;}})['then'](respondWithResult(_0x1a37e9,null))[_0x76aa('0x3b')](handleError(_0x1a37e9,null));};exports[_0x76aa('0x8b')]=function(_0x4830ea,_0x20638f){var _0x2b2f27=moment()[_0x76aa('0x6e')](_0x76aa('0x8c'));var _0x1a5297,_0x487c28;return db[_0x76aa('0x29')]['find']({'where':{'id':_0x4830ea[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x20638f,null))[_0x76aa('0x17')](function(_0x2f2a27){if(_0x2f2a27){_0x487c28=_0x2f2a27;return _0x2f2a27['addLists'](_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x4830ea[_0x76aa('0x3d')],[_0x76aa('0x73'),'id'])||{});}return null;})[_0x76aa('0x84')](function(_0xca12fa){var _0xb0a4e1;_0x1a5297=_0xca12fa||[];var _0x1f7f1d=[];if(_0xca12fa){for(var _0x413528=0x0;_0x413528<_0xca12fa[_0x76aa('0x37')];_0x413528+=0x1){var _0x39de41=_0xca12fa[_0x413528][_0x76aa('0x18')]({'plain':!![]});_0x487c28[_0x76aa('0x8d')]=_0x4830ea['body']['dialCheckDuplicateType']?_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x8d')]:_0x487c28['dialCheckDuplicateType'];switch(_0x487c28[_0x76aa('0x8d')]){case'always':_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),'VoiceQueueId',_0x76aa('0x49'),_0x76aa('0x48')],squel['select']()['field'](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id','ContactId')[_0x76aa('0x74')](_0x39de41['CmListId'][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x76aa('0x74')](_0x76aa('0x98'))['from'](_0x76aa('0x99'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']()))['where'](_0x76aa('0x9a'),squel['select']()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')]('VoiceQueueId\x20=\x20?',_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')]())))[_0x76aa('0x96')]();break;case _0x76aa('0x9c'):_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')](['phone',_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))['field'](_0x39de41['CmListId']['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea['params']['id'][_0x76aa('0x96')](),'VoiceQueueId')['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0'))[_0x76aa('0x2d')](_0x76aa('0x9a'),squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']())))[_0x76aa('0x96')]();break;default:_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')]('cm_hopper')[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))['field']('id',_0x76aa('0x94'))['field'](_0x39de41[_0x76aa('0x9f')]['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id']['toString'](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')]('cm_contacts')['where'](_0x76aa('0xa1'))[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')](_0x76aa('0xa0')))[_0x76aa('0x96')]();}_0x1f7f1d['push'](db['sequelize'][_0x76aa('0x33')](_0xb0a4e1));}return BPromise[_0x76aa('0x85')](_0x1f7f1d);}})[_0x76aa('0x17')](function(){var _0xbb19e4=[];var _0x226b44=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xa2'))['fromQuery']([_0x76aa('0xa3'),_0x76aa('0x92'),_0x76aa('0xa4'),'createdAt',_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')]('h.id')['field'](_0x76aa('0xa5'))['field'](_0x76aa('0xa6'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')['from'](_0x76aa('0xa7'),'ci')[_0x76aa('0x78')](_0x76aa('0x90'),'h',_0x76aa('0xa8'))[_0x76aa('0x2d')](_0x76aa('0xa9'),_0x2b2f27)['where'](_0x76aa('0xaa'),_0x76aa('0xab')))[_0x76aa('0x96')]();_0xbb19e4['push'](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x226b44));return BPromise[_0x76aa('0x85')](_0xbb19e4);})['then'](function(){return _0x1a5297;})[_0x76aa('0x17')](respondWithResult(_0x20638f,null))['catch'](handleError(_0x20638f,null));};exports['removeLists']=function(_0xef9ea7,_0x45f21f){return db[_0x76aa('0x29')]['find']({'where':{'id':_0xef9ea7[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x45f21f,null))[_0x76aa('0x17')](function(_0x113e70){if(_0x113e70){return _0x113e70['removeLists'](_0xef9ea7[_0x76aa('0x33')]['ids']);}})['then'](function(_0x583d68){if(_0x583d68){return db[_0x76aa('0x53')]['destroy']({'where':{'ListId':_0xef9ea7[_0x76aa('0x33')]['ids'],'VoiceQueueId':_0xef9ea7['params']['id']}})[_0x76aa('0x17')](function(){return _0x583d68;});}})['then'](respondWithStatusCode(_0x45f21f,null))['catch'](handleError(_0x45f21f,null));};exports[_0x76aa('0xac')]=function(_0x3b7370,_0x1c3431){var _0x865a1b={};var _0x132d60={};var _0x1a3074;var _0x3184a2;return db['VoiceQueue']['findOne']({'where':{'id':_0x3b7370[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1c3431,null))[_0x76aa('0x17')](function(_0x274356){if(_0x274356){_0x1a3074=_0x274356;_0x132d60[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0xad')][_0x76aa('0x2a')]);_0x132d60[_0x76aa('0x33')]=_['keys'](_0x3b7370['query']);_0x132d60[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x132d60[_0x76aa('0x31')],_0x132d60[_0x76aa('0x33')]);_0x865a1b['attributes']=_['intersection'](_0x132d60[_0x76aa('0x31')],qs['fields'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x36')]));_0x865a1b['attributes']=_0x865a1b[_0x76aa('0x34')][_0x76aa('0x37')]?_0x865a1b[_0x76aa('0x34')]:_0x132d60[_0x76aa('0x31')];_0x865a1b[_0x76aa('0x4e')]=qs['sort'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x865a1b['where']=qs['filters'](_[_0x76aa('0x50')](_0x3b7370[_0x76aa('0x33')],_0x132d60[_0x76aa('0x4c')]));if(_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]){_0x865a1b[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x865a1b[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x865a1b[_0x76aa('0x34')],function(_0xbb0ea3){var _0x4978dd={};_0x4978dd[_0xbb0ea3]={'$like':'%'+_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x4978dd;})});}_0x865a1b=_[_0x76aa('0x39')]({},_0x865a1b,_0x3b7370[_0x76aa('0x3a')]);return _0x1a3074['getBlackLists'](_0x865a1b);}})['then'](function(_0x4ee1d3){if(_0x4ee1d3){_0x3184a2=_0x4ee1d3['length'];if(!_0x3b7370[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x865a1b[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x12')]);_0x865a1b['offset']=qs['offset'](_0x3b7370[_0x76aa('0x33')]['offset']);}return _0x1a3074[_0x76aa('0xac')](_0x865a1b);}})[_0x76aa('0x17')](function(_0x3bc149){if(_0x3bc149){return _0x3bc149?{'count':_0x3184a2,'rows':_0x3bc149}:null;}})['then'](respondWithResult(_0x1c3431,null))[_0x76aa('0x3b')](handleError(_0x1c3431,null));};exports[_0x76aa('0xae')]=function(_0x29e112,_0x3fd683){var _0x5c2c4d;return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x29e112[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fd683,null))[_0x76aa('0x17')](function(_0xcb041d){if(_0xcb041d){return _0xcb041d[_0x76aa('0xae')](_0x29e112[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x29e112[_0x76aa('0x3d')],['ids','id'])||{});}return null;})['spread'](function(_0x72b9a){var _0x29db0f;_0x5c2c4d=_0x72b9a||[];var _0x28a212=[];if(_0x72b9a){for(var _0x242cd6=0x0;_0x242cd6<_0x72b9a[_0x76aa('0x37')];_0x242cd6+=0x1){var _0xeb428a=_0x72b9a[_0x242cd6][_0x76aa('0x18')]({'plain':!![]});_0x29db0f=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xaf'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))[_0x76aa('0x74')](_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x29e112['params']['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')](_0x76aa('0xb0'),'createdAt')[_0x76aa('0x74')](_0x76aa('0xb0'),_0x76aa('0x48'))['from'](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0')))['toString']();_0x28a212[_0x76aa('0x7c')](db['sequelize'][_0x76aa('0x33')](_0x29db0f));}return BPromise['all'](_0x28a212);}})[_0x76aa('0x17')](function(){return _0x5c2c4d;})['then'](respondWithResult(_0x3fd683,null))[_0x76aa('0x3b')](handleError(_0x3fd683,null));};exports[_0x76aa('0xb1')]=function(_0x140ee1,_0x3d9e9e){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x140ee1['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x3d9e9e,null))[_0x76aa('0x17')](function(_0x139e67){if(_0x139e67){return _0x139e67[_0x76aa('0xb1')](_0x140ee1['query'][_0x76aa('0x73')]);}})[_0x76aa('0x17')](function(_0x506cad){if(_0x506cad){return db['CmHopperBlack'][_0x76aa('0x25')]({'where':{'ListId':_0x140ee1[_0x76aa('0x33')][_0x76aa('0x73')],'VoiceQueueId':_0x140ee1[_0x76aa('0x46')]['id']}})['then'](function(){return _0x506cad;});}})['then'](respondWithStatusCode(_0x3d9e9e,null))[_0x76aa('0x3b')](handleError(_0x3d9e9e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 09c4c08..4918bd8 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 _0x335d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x335d,0x166));var _0xd335=function(_0x10a0ab,_0x37b227){_0x10a0ab=_0x10a0ab-0x0;var _0x35f4c3=_0x335d[_0x10a0ab];return _0x35f4c3;};'use strict';var EventEmitter=require(_0xd335('0x0'));var VoiceQueue=require(_0xd335('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xd335('0x2')](0x0);var events={'afterCreate':_0xd335('0x3'),'afterUpdate':_0xd335('0x4'),'afterDestroy':_0xd335('0x5')};function emitEvent(_0x2ed622){return function(_0x5b42e1,_0x26eadd,_0x1d213a){VoiceQueueEvents[_0xd335('0x6')](_0x2ed622+':'+_0x5b42e1['id'],_0x5b42e1);VoiceQueueEvents['emit'](_0x2ed622,_0x5b42e1);_0x1d213a(null);};}for(var e in events){if(events[_0xd335('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xd335('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xd58c=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1ae653,_0x2e7af3){var _0x3d36e5=function(_0x2cd8b2){while(--_0x2cd8b2){_0x1ae653['push'](_0x1ae653['shift']());}};_0x3d36e5(++_0x2e7af3);}(_0xd58c,0xb0));var _0xcd58=function(_0x480e53,_0x5c8da4){_0x480e53=_0x480e53-0x0;var _0x12c12f=_0xd58c[_0x480e53];return _0x12c12f;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xcd58('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcd58('0x1'),'afterUpdate':_0xcd58('0x2'),'afterDestroy':_0xcd58('0x3')};function emitEvent(_0x3645cb){return function(_0x173b00,_0x263b20,_0x40080d){VoiceQueueEvents['emit'](_0x3645cb+':'+_0x173b00['id'],_0x173b00);VoiceQueueEvents[_0xcd58('0x4')](_0x3645cb,_0x173b00);_0x40080d(null);};}for(var e in events){if(events[_0xcd58('0x5')](e)){var event=events[e];VoiceQueue[_0xcd58('0x6')](e,emitEvent(event));}}module[_0xcd58('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index e7875f2..55b95aa 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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x137d9b,_0x2c01bc){var _0x1ed789=function(_0xc52068){while(--_0xc52068){_0x137d9b['push'](_0x137d9b['shift']());}};_0x1ed789(++_0x2c01bc);}(_0x34e8,0x12c));var _0x834e=function(_0x38e3cb,_0x3e09fd){_0x38e3cb=_0x38e3cb-0x0;var _0x17d975=_0x34e8[_0x38e3cb];return _0x17d975;};'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 +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x5878ee,_0x406ff5){var _0x2068a0=function(_0x345719){while(--_0x345719){_0x5878ee['push'](_0x5878ee['shift']());}};_0x2068a0(++_0x406ff5);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'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 36bf19c..726944d 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 _0x5b93=['map','model','ShowVoiceQueue','then','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./voiceQueue.socket','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x238cd6,_0x260c10){var _0x5216c1=function(_0x3f646f){while(--_0x3f646f){_0x238cd6['push'](_0x238cd6['shift']());}};_0x5216c1(++_0x260c10);}(_0x5b93,0x148));var _0x35b9=function(_0xc66538,_0x3d40b4){_0xc66538=_0xc66538-0x0;var _0x5bdd01=_0x5b93[_0xc66538];return _0x5bdd01;};'use strict';var _=require('lodash');var util=require(_0x35b9('0x0'));var moment=require(_0x35b9('0x1'));var BPromise=require('bluebird');var rs=require(_0x35b9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35b9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x35b9('0x4'))(_0x35b9('0x5'));var config=require(_0x35b9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x35b9('0x7')]['http']({'port':0x232a});config[_0x35b9('0x8')]=_['defaults'](config[_0x35b9('0x8')],{'host':_0x35b9('0x9'),'port':0x18eb});var socket=require(_0x35b9('0xa'))(new Redis(config[_0x35b9('0x8')]));require(_0x35b9('0xb'))['register'](socket);function respondWithRpcPromise(_0x11c157,_0x1b4b7a,_0x47cae5){return new BPromise(function(_0x30145e,_0x140073){return client[_0x35b9('0xc')](_0x11c157,_0x47cae5)['then'](function(_0x4f1ac3){logger[_0x35b9('0xd')](_0x35b9('0xe'),_0x1b4b7a,_0x35b9('0xf'));logger[_0x35b9('0x10')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x1b4b7a,'request\x20sent',JSON[_0x35b9('0x11')](_0x4f1ac3));if(_0x4f1ac3[_0x35b9('0x12')]){if(_0x4f1ac3[_0x35b9('0x12')][_0x35b9('0x13')]===0x1f4){logger[_0x35b9('0x12')](_0x35b9('0xe'),_0x1b4b7a,_0x4f1ac3['error'][_0x35b9('0x14')]);return _0x140073(_0x4f1ac3[_0x35b9('0x12')][_0x35b9('0x14')]);}logger[_0x35b9('0x12')](_0x35b9('0xe'),_0x1b4b7a,_0x4f1ac3[_0x35b9('0x12')]['message']);return _0x30145e(_0x4f1ac3[_0x35b9('0x12')][_0x35b9('0x14')]);}else{logger[_0x35b9('0xd')](_0x35b9('0xe'),_0x1b4b7a,'request\x20sent');_0x30145e(_0x4f1ac3[_0x35b9('0x15')][_0x35b9('0x14')]);}})[_0x35b9('0x16')](function(_0x426b29){logger[_0x35b9('0x12')](_0x35b9('0xe'),_0x1b4b7a,_0x426b29);_0x140073(_0x426b29);});});}exports[_0x35b9('0x17')]=function(_0x35ffde){var _0x3c7b5c=this;return new Promise(function(_0x5d763c,_0xaff629){return db[_0x35b9('0x18')][_0x35b9('0x19')]({'raw':_0x35ffde[_0x35b9('0x1a')]?_0x35ffde[_0x35b9('0x1a')][_0x35b9('0x1b')]===undefined?!![]:![]:!![],'where':_0x35ffde[_0x35b9('0x1a')]?_0x35ffde['options'][_0x35b9('0x1c')]||null:null,'attributes':_0x35ffde['options']?_0x35ffde[_0x35b9('0x1a')][_0x35b9('0x1d')]||null:null,'limit':_0x35ffde[_0x35b9('0x1a')]?_0x35ffde['options'][_0x35b9('0x1e')]||null:null,'include':_0x35ffde[_0x35b9('0x1a')]?_0x35ffde[_0x35b9('0x1a')][_0x35b9('0x1f')]?_[_0x35b9('0x20')](_0x35ffde[_0x35b9('0x1a')][_0x35b9('0x1f')],function(_0xf468df){return{'model':db[_0xf468df[_0x35b9('0x21')]],'as':_0xf468df['as'],'attributes':_0xf468df[_0x35b9('0x1d')],'include':_0xf468df[_0x35b9('0x1f')]?_[_0x35b9('0x20')](_0xf468df[_0x35b9('0x1f')],function(_0x20e617){return{'model':db[_0x20e617[_0x35b9('0x21')]],'as':_0x20e617['as'],'attributes':_0x20e617[_0x35b9('0x1d')],'include':_0x20e617[_0x35b9('0x1f')]?_['map'](_0x20e617['include'],function(_0x2689a4){return{'model':db[_0x2689a4[_0x35b9('0x21')]],'as':_0x2689a4['as'],'attributes':_0x2689a4[_0x35b9('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fb061){logger[_0x35b9('0xd')](_0x35b9('0x17'),_0x35ffde);logger[_0x35b9('0x10')](_0x35b9('0x17'),_0x35ffde,JSON['stringify'](_0x3fb061));_0x5d763c(_0x3fb061);})[_0x35b9('0x16')](function(_0x278d7b){logger[_0x35b9('0x12')]('GetVoiceQueue',_0x278d7b[_0x35b9('0x14')],_0x35ffde);_0xaff629(_0x3c7b5c['error'](0x1f4,_0x278d7b[_0x35b9('0x14')]));});});};exports[_0x35b9('0x22')]=function(_0x5cf039){var _0x5f09e0=this;return new Promise(function(_0x1a3993,_0x28fc50){return db[_0x35b9('0x18')]['find']({'raw':_0x5cf039[_0x35b9('0x1a')]?_0x5cf039[_0x35b9('0x1a')][_0x35b9('0x1b')]===undefined?!![]:![]:!![],'where':_0x5cf039[_0x35b9('0x1a')]?_0x5cf039[_0x35b9('0x1a')][_0x35b9('0x1c')]||null:null,'attributes':_0x5cf039[_0x35b9('0x1a')]?_0x5cf039[_0x35b9('0x1a')][_0x35b9('0x1d')]||null:null,'include':_0x5cf039[_0x35b9('0x1a')]?_0x5cf039['options'][_0x35b9('0x1f')]?_['map'](_0x5cf039['options'][_0x35b9('0x1f')],function(_0x14a7cc){return{'model':db[_0x14a7cc[_0x35b9('0x21')]],'as':_0x14a7cc['as'],'attributes':_0x14a7cc[_0x35b9('0x1d')],'include':_0x14a7cc[_0x35b9('0x1f')]?_[_0x35b9('0x20')](_0x14a7cc[_0x35b9('0x1f')],function(_0x445ae7){return{'model':db[_0x445ae7['model']],'as':_0x445ae7['as'],'attributes':_0x445ae7[_0x35b9('0x1d')],'include':_0x445ae7[_0x35b9('0x1f')]?_[_0x35b9('0x20')](_0x445ae7[_0x35b9('0x1f')],function(_0x5103a9){return{'model':db[_0x5103a9[_0x35b9('0x21')]],'as':_0x5103a9['as'],'attributes':_0x5103a9[_0x35b9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x35b9('0x23')](function(_0xc432f5){logger['info']('ShowVoiceQueue',_0x5cf039);logger[_0x35b9('0x10')](_0x35b9('0x22'),_0x5cf039,JSON['stringify'](_0xc432f5));_0x1a3993(_0xc432f5);})[_0x35b9('0x16')](function(_0x598645){logger[_0x35b9('0x12')](_0x35b9('0x22'),_0x598645['message'],_0x5cf039);_0x28fc50(_0x5f09e0[_0x35b9('0x12')](0x1f4,_0x598645[_0x35b9('0x14')]));});});}; \ No newline at end of file +var _0x0180=['ShowVoiceQueue','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','VoiceQueue','find'];(function(_0x3c803b,_0x2da4cb){var _0x2e84b5=function(_0x1f97f9){while(--_0x1f97f9){_0x3c803b['push'](_0x3c803b['shift']());}};_0x2e84b5(++_0x2da4cb);}(_0x0180,0x14e));var _0x0018=function(_0x56a0d2,_0x5e573d){_0x56a0d2=_0x56a0d2-0x0;var _0x3b58c5=_0x0180[_0x56a0d2];return _0x3b58c5;};'use strict';var _=require(_0x0018('0x0'));var util=require(_0x0018('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0018('0x2'));var fs=require('fs');var Redis=require(_0x0018('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0018('0x4'))(_0x0018('0x5'));var config=require(_0x0018('0x6'));var jayson=require(_0x0018('0x7'));var client=jayson['client'][_0x0018('0x8')]({'port':0x232a});config[_0x0018('0x9')]=_[_0x0018('0xa')](config['redis'],{'host':_0x0018('0xb'),'port':0x18eb});var socket=require(_0x0018('0xc'))(new Redis(config['redis']));require(_0x0018('0xd'))[_0x0018('0xe')](socket);function respondWithRpcPromise(_0x53a07d,_0xa8550d,_0x451bcd){return new BPromise(function(_0x2ec22b,_0x46bd85){return client['request'](_0x53a07d,_0x451bcd)[_0x0018('0xf')](function(_0x404574){logger[_0x0018('0x10')](_0x0018('0x11'),_0xa8550d,'request\x20sent');logger[_0x0018('0x12')](_0x0018('0x13'),_0xa8550d,'request\x20sent',JSON[_0x0018('0x14')](_0x404574));if(_0x404574['error']){if(_0x404574[_0x0018('0x15')]['code']===0x1f4){logger['error'](_0x0018('0x11'),_0xa8550d,_0x404574[_0x0018('0x15')][_0x0018('0x16')]);return _0x46bd85(_0x404574[_0x0018('0x15')]['message']);}logger[_0x0018('0x15')](_0x0018('0x11'),_0xa8550d,_0x404574[_0x0018('0x15')]['message']);return _0x2ec22b(_0x404574[_0x0018('0x15')][_0x0018('0x16')]);}else{logger['info'](_0x0018('0x11'),_0xa8550d,'request\x20sent');_0x2ec22b(_0x404574['result']['message']);}})[_0x0018('0x17')](function(_0x4226bf){logger['error'](_0x0018('0x11'),_0xa8550d,_0x4226bf);_0x46bd85(_0x4226bf);});});}exports[_0x0018('0x18')]=function(_0x1d5937){var _0x322a3a=this;return new Promise(function(_0x1a8ad8,_0x2c1f30){return db['VoiceQueue'][_0x0018('0x19')]({'raw':_0x1d5937[_0x0018('0x1a')]?_0x1d5937[_0x0018('0x1a')][_0x0018('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d5937['options']?_0x1d5937[_0x0018('0x1a')][_0x0018('0x1c')]||null:null,'attributes':_0x1d5937[_0x0018('0x1a')]?_0x1d5937['options'][_0x0018('0x1d')]||null:null,'limit':_0x1d5937['options']?_0x1d5937['options'][_0x0018('0x1e')]||null:null,'include':_0x1d5937[_0x0018('0x1a')]?_0x1d5937[_0x0018('0x1a')]['include']?_['map'](_0x1d5937['options'][_0x0018('0x1f')],function(_0x240a15){return{'model':db[_0x240a15[_0x0018('0x20')]],'as':_0x240a15['as'],'attributes':_0x240a15['attributes'],'include':_0x240a15[_0x0018('0x1f')]?_[_0x0018('0x21')](_0x240a15[_0x0018('0x1f')],function(_0xfdf65b){return{'model':db[_0xfdf65b[_0x0018('0x20')]],'as':_0xfdf65b['as'],'attributes':_0xfdf65b[_0x0018('0x1d')],'include':_0xfdf65b['include']?_['map'](_0xfdf65b['include'],function(_0x1d7c8b){return{'model':db[_0x1d7c8b[_0x0018('0x20')]],'as':_0x1d7c8b['as'],'attributes':_0x1d7c8b[_0x0018('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0018('0xf')](function(_0x550648){logger['info'](_0x0018('0x18'),_0x1d5937);logger[_0x0018('0x12')]('GetVoiceQueue',_0x1d5937,JSON[_0x0018('0x14')](_0x550648));_0x1a8ad8(_0x550648);})[_0x0018('0x17')](function(_0x3781e5){logger[_0x0018('0x15')](_0x0018('0x18'),_0x3781e5[_0x0018('0x16')],_0x1d5937);_0x2c1f30(_0x322a3a[_0x0018('0x15')](0x1f4,_0x3781e5['message']));});});};exports['ShowVoiceQueue']=function(_0x4f1ff3){var _0x1c818d=this;return new Promise(function(_0x3976b6,_0x105410){return db[_0x0018('0x22')][_0x0018('0x23')]({'raw':_0x4f1ff3[_0x0018('0x1a')]?_0x4f1ff3[_0x0018('0x1a')][_0x0018('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f1ff3[_0x0018('0x1a')]?_0x4f1ff3['options'][_0x0018('0x1c')]||null:null,'attributes':_0x4f1ff3[_0x0018('0x1a')]?_0x4f1ff3[_0x0018('0x1a')][_0x0018('0x1d')]||null:null,'include':_0x4f1ff3[_0x0018('0x1a')]?_0x4f1ff3[_0x0018('0x1a')][_0x0018('0x1f')]?_[_0x0018('0x21')](_0x4f1ff3[_0x0018('0x1a')][_0x0018('0x1f')],function(_0x57babc){return{'model':db[_0x57babc['model']],'as':_0x57babc['as'],'attributes':_0x57babc['attributes'],'include':_0x57babc['include']?_['map'](_0x57babc['include'],function(_0x4f0389){return{'model':db[_0x4f0389[_0x0018('0x20')]],'as':_0x4f0389['as'],'attributes':_0x4f0389[_0x0018('0x1d')],'include':_0x4f0389[_0x0018('0x1f')]?_['map'](_0x4f0389[_0x0018('0x1f')],function(_0x50c609){return{'model':db[_0x50c609[_0x0018('0x20')]],'as':_0x50c609['as'],'attributes':_0x50c609['attributes']};}):[]};}):[]};}):[]:[]})[_0x0018('0xf')](function(_0x20627f){logger[_0x0018('0x10')]('ShowVoiceQueue',_0x4f1ff3);logger[_0x0018('0x12')]('ShowVoiceQueue',_0x4f1ff3,JSON['stringify'](_0x20627f));_0x3976b6(_0x20627f);})[_0x0018('0x17')](function(_0x466908){logger[_0x0018('0x15')](_0x0018('0x24'),_0x466908[_0x0018('0x16')],_0x4f1ff3);_0x105410(_0x1c818d['error'](0x1f4,_0x466908[_0x0018('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 655466c..6be7aaf 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 _0xcb67=['remove','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xcb67,0x8e));var _0x7cb6=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0xcb67[_0x587fb5];return _0x551105;};'use strict';var VoiceQueueEvents=require(_0x7cb6('0x0'));var events=[_0x7cb6('0x1'),_0x7cb6('0x2'),'update'];function createListener(_0x437fb4,_0x2cb19a){return function(_0x3c752c){_0x2cb19a[_0x7cb6('0x3')](_0x437fb4,_0x3c752c);};}function removeListener(_0x2bab5d,_0x2f4b25){return function(){VoiceQueueEvents[_0x7cb6('0x4')](_0x2bab5d,_0x2f4b25);};}exports[_0x7cb6('0x5')]=function(_0x21be0a){for(var _0x5d7ed8=0x0,_0x216e58=events[_0x7cb6('0x6')];_0x5d7ed8<_0x216e58;_0x5d7ed8++){var _0x441f05=events[_0x5d7ed8];var _0x3b97a3=createListener(_0x7cb6('0x7')+_0x441f05,_0x21be0a);VoiceQueueEvents['on'](_0x441f05,_0x3b97a3);}}; \ No newline at end of file +var _0x4dc2=['removeListener','register','length','voiceQueue:','./voiceQueue.events','save','remove','emit'];(function(_0x54d49e,_0x5d9911){var _0x4af0f1=function(_0xf117b3){while(--_0xf117b3){_0x54d49e['push'](_0x54d49e['shift']());}};_0x4af0f1(++_0x5d9911);}(_0x4dc2,0xf4));var _0x24dc=function(_0x4fe5d0,_0x43682e){_0x4fe5d0=_0x4fe5d0-0x0;var _0x280803=_0x4dc2[_0x4fe5d0];return _0x280803;};'use strict';var VoiceQueueEvents=require(_0x24dc('0x0'));var events=[_0x24dc('0x1'),_0x24dc('0x2'),'update'];function createListener(_0x3c5645,_0x25d79d){return function(_0x3fa6fb){_0x25d79d[_0x24dc('0x3')](_0x3c5645,_0x3fa6fb);};}function removeListener(_0x1d0974,_0x472ade){return function(){VoiceQueueEvents[_0x24dc('0x4')](_0x1d0974,_0x472ade);};}exports[_0x24dc('0x5')]=function(_0x40c936){for(var _0x91429e=0x0,_0x22a97a=events[_0x24dc('0x6')];_0x91429e<_0x22a97a;_0x91429e++){var _0x739ba4=events[_0x91429e];var _0x5a413d=createListener(_0x24dc('0x7')+_0x739ba4,_0x40c936);VoiceQueueEvents['on'](_0x739ba4,_0x5a413d);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 02b5731..bf01b7c 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 _0x73fa=['express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','describe','/index','/:id','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5b6a3e,_0xcf20dd){var _0x272448=function(_0x115bfa){while(--_0x115bfa){_0x5b6a3e['push'](_0x5b6a3e['shift']());}};_0x272448(++_0xcf20dd);}(_0x73fa,0x153));var _0xa73f=function(_0x4d525c,_0x277dac){_0x4d525c=_0x4d525c-0x0;var _0x3f0655=_0x73fa[_0x4d525c];return _0x3f0655;};'use strict';var multer=require(_0xa73f('0x0'));var util=require(_0xa73f('0x1'));var path=require(_0xa73f('0x2'));var timeout=require('connect-timeout');var express=require(_0xa73f('0x3'));var router=express[_0xa73f('0x4')]();var fs_extra=require(_0xa73f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa73f('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xa73f('0x7')]('/',auth[_0xa73f('0x8')](),controller[_0xa73f('0x9')]);router[_0xa73f('0x7')]('/describe',auth[_0xa73f('0x8')](),controller[_0xa73f('0xa')]);router[_0xa73f('0x7')](_0xa73f('0xb'),auth[_0xa73f('0x8')](),controller['getVoiceQueuesReport']);router[_0xa73f('0x7')](_0xa73f('0xc'),auth[_0xa73f('0x8')](),controller['show']);router['post']('/',auth[_0xa73f('0x8')](),controller[_0xa73f('0xd')]);router[_0xa73f('0xe')](_0xa73f('0xc'),auth['isAuthenticated'](),controller[_0xa73f('0xf')]);router[_0xa73f('0x10')](_0xa73f('0xc'),auth[_0xa73f('0x8')](),controller[_0xa73f('0x11')]);module[_0xa73f('0x12')]=router; \ No newline at end of file +var _0x995e=['update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','show','post','create','put','/:id'];(function(_0x35cd20,_0x3591fb){var _0xa7dbcc=function(_0x38bdcb){while(--_0x38bdcb){_0x35cd20['push'](_0x35cd20['shift']());}};_0xa7dbcc(++_0x3591fb);}(_0x995e,0xe8));var _0xe995=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x995e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe995('0x0'));var util=require(_0xe995('0x1'));var path=require(_0xe995('0x2'));var timeout=require('connect-timeout');var express=require(_0xe995('0x3'));var router=express[_0xe995('0x4')]();var fs_extra=require(_0xe995('0x5'));var auth=require(_0xe995('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe995('0x7'));var controller=require(_0xe995('0x8'));router[_0xe995('0x9')]('/',auth[_0xe995('0xa')](),controller[_0xe995('0xb')]);router[_0xe995('0x9')](_0xe995('0xc'),auth[_0xe995('0xa')](),controller[_0xe995('0xd')]);router[_0xe995('0x9')](_0xe995('0xe'),auth[_0xe995('0xa')](),controller[_0xe995('0xf')]);router[_0xe995('0x9')]('/:id',auth[_0xe995('0xa')](),controller[_0xe995('0x10')]);router[_0xe995('0x11')]('/',auth[_0xe995('0xa')](),controller[_0xe995('0x12')]);router[_0xe995('0x13')](_0xe995('0x14'),auth[_0xe995('0xa')](),controller[_0xe995('0x15')]);router['delete']('/:id',auth[_0xe995('0xa')](),controller[_0xe995('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 9aba696..9946f7d 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 _0x0266=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x1e2eac,_0x26dddf){var _0x7a4e81=function(_0x341ed5){while(--_0x341ed5){_0x1e2eac['push'](_0x1e2eac['shift']());}};_0x7a4e81(++_0x26dddf);}(_0x0266,0xe5));var _0x6026=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x0266[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0x6026('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x6026('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6026('0x1')]},'calleridname':{'type':Sequelize[_0x6026('0x1')]},'queue':{'type':Sequelize[_0x6026('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x6026('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x6026('0x2')],'set':function(_0x944084){var _0x19b10c=moment(_0x944084);var _0x4a7f41=moment(this[_0x6026('0x3')](_0x6026('0x4')))[_0x6026('0x5')](_0x6026('0x6'));var _0x114cfb=_0x19b10c[_0x6026('0x7')](_0x4a7f41,_0x6026('0x8'));this[_0x6026('0x9')]('queuecallerleaveAt',_0x944084);this[_0x6026('0x9')]('holdtime',_0x114cfb||null);}},'position':{'type':Sequelize[_0x6026('0xa')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6026('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x6026('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6026('0x2')]},'queuecallerexit':{'type':Sequelize[_0x6026('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x6026('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x6026('0x1')]},'connectedlinenum':{'type':Sequelize[_0x6026('0x1')]},'connectedlinename':{'type':Sequelize[_0x6026('0x1')]},'accountcode':{'type':Sequelize[_0x6026('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6026('0x1')]},'priority':{'type':Sequelize[_0x6026('0x1')]},'holdtime':{'type':Sequelize[_0x6026('0xa')]},'mohtime':{'type':Sequelize[_0x6026('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6026('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6026('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6026('0x1')],'comment':_0x6026('0xc')},'transferexten':{'type':Sequelize[_0x6026('0x1')]},'transferuniqueid':{'type':Sequelize[_0x6026('0x1')]},'disposition':{'type':Sequelize[_0x6026('0x1')]},'secondDisposition':{'type':Sequelize[_0x6026('0x1')]},'thirdDisposition':{'type':Sequelize[_0x6026('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x6026('0xa')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd3d5=['exports','STRING','DATE','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd3d5,0x1a2));var _0x5d3d=function(_0x4ef461,_0x49fb0a){_0x4ef461=_0x4ef461-0x0;var _0x6fa6b3=_0xd3d5[_0x4ef461];return _0x6fa6b3;};'use strict';var Sequelize=require(_0x5d3d('0x0'));var moment=require(_0x5d3d('0x1'));module[_0x5d3d('0x2')]={'type':{'type':Sequelize[_0x5d3d('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x5d3d('0x3')]},'calleridname':{'type':Sequelize[_0x5d3d('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x5d3d('0x4')],'set':function(_0x3b53af){var _0x535f96=moment(_0x3b53af);var _0x294cd6=moment(this['getDataValue'](_0x5d3d('0x5')))['format'](_0x5d3d('0x6'));var _0x450f2a=_0x535f96[_0x5d3d('0x7')](_0x294cd6,_0x5d3d('0x8'));this['setDataValue'](_0x5d3d('0x9'),_0x3b53af);this[_0x5d3d('0xa')]('holdtime',_0x450f2a||null);}},'position':{'type':Sequelize[_0x5d3d('0xb')]},'count':{'type':Sequelize[_0x5d3d('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x5d3d('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x5d3d('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x5d3d('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x5d3d('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x5d3d('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x5d3d('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x5d3d('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x5d3d('0x3')]},'connectedlinename':{'type':Sequelize[_0x5d3d('0x3')]},'accountcode':{'type':Sequelize[_0x5d3d('0x3')]},'context':{'type':Sequelize[_0x5d3d('0x3')]},'exten':{'type':Sequelize[_0x5d3d('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x5d3d('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5d3d('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x5d3d('0x3')]},'transfer':{'type':Sequelize[_0x5d3d('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x5d3d('0x3')],'comment':_0x5d3d('0xd')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x5d3d('0x3')]},'disposition':{'type':Sequelize[_0x5d3d('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5d3d('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 23be812..dad5933 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 _0xc5ef=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','redis','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','getVoiceQueuesReport','hasOwnProperty'];(function(_0x2f31f7,_0x3a0fc4){var _0x4023b0=function(_0x325787){while(--_0x325787){_0x2f31f7['push'](_0x2f31f7['shift']());}};_0x4023b0(++_0x3a0fc4);}(_0xc5ef,0xa2));var _0xfc5e=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xc5ef[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require(_0xfc5e('0x0'));var rimraf=require(_0xfc5e('0x1'));var zipdir=require(_0xfc5e('0x2'));var jsonpatch=require(_0xfc5e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc5e('0x4'));var Mustache=require(_0xfc5e('0x5'));var util=require(_0xfc5e('0x6'));var path=require(_0xfc5e('0x7'));var sox=require(_0xfc5e('0x8'));var csv=require('to-csv');var ejs=require(_0xfc5e('0x9'));var fs=require('fs');var fs_extra=require(_0xfc5e('0xa'));var _=require(_0xfc5e('0xb'));var squel=require(_0xfc5e('0xc'));var crypto=require(_0xfc5e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfc5e('0xe'));var toCsv=require(_0xfc5e('0xf'));var querystring=require(_0xfc5e('0x10'));var Papa=require('papaparse');var Redis=require(_0xfc5e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfc5e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc5e('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc5e('0x14'));var db=require(_0xfc5e('0x15'))['db'];config[_0xfc5e('0x16')]=_['defaults'](config[_0xfc5e('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc5e('0x16')]));require(_0xfc5e('0x17'))[_0xfc5e('0x18')](socket);function respondWithStatusCode(_0x26e3bb,_0x57c04a){_0x57c04a=_0x57c04a||0xcc;return function(_0x48dcb3){if(_0x48dcb3){return _0x26e3bb[_0xfc5e('0x19')](_0x57c04a);}return _0x26e3bb[_0xfc5e('0x1a')](_0x57c04a)[_0xfc5e('0x1b')]();};}function respondWithResult(_0x4aca98,_0x3a6ff7){_0x3a6ff7=_0x3a6ff7||0xc8;return function(_0x4b3a45){if(_0x4b3a45){return _0x4aca98['status'](_0x3a6ff7)[_0xfc5e('0x1c')](_0x4b3a45);}};}function respondWithFilteredResult(_0x520174,_0xacded1){return function(_0x13b64b){if(_0x13b64b){var _0x572169=typeof _0xacded1[_0xfc5e('0x1d')]===_0xfc5e('0x1e')&&typeof _0xacded1[_0xfc5e('0x1f')]==='undefined';var _0x11cf55=_0x13b64b[_0xfc5e('0x20')];var _0x18ff32=_0x572169?0x0:_0xacded1[_0xfc5e('0x1d')];var _0x5a2cf9=_0x572169?_0x13b64b[_0xfc5e('0x20')]:_0xacded1[_0xfc5e('0x1d')]+_0xacded1[_0xfc5e('0x1f')];var _0x1d91b3;if(_0x5a2cf9>=_0x11cf55){_0x5a2cf9=_0x11cf55;_0x1d91b3=0xc8;}else{_0x1d91b3=0xce;}_0x520174[_0xfc5e('0x1a')](_0x1d91b3);return _0x520174[_0xfc5e('0x21')]('Content-Range',_0x18ff32+'-'+_0x5a2cf9+'/'+_0x11cf55)[_0xfc5e('0x1c')](_0x13b64b);}return null;};}function patchUpdates(_0x1836f0){return function(_0x1370c6){try{jsonpatch[_0xfc5e('0x22')](_0x1370c6,_0x1836f0,!![]);}catch(_0x3cee04){return BPromise[_0xfc5e('0x23')](_0x3cee04);}return _0x1370c6[_0xfc5e('0x24')]();};}function saveUpdates(_0x10ee7d,_0x4511a7){return function(_0x1ff706){if(_0x1ff706){return _0x1ff706[_0xfc5e('0x25')](_0x10ee7d)[_0xfc5e('0x26')](function(_0x5ec35e){return _0x5ec35e;});}return null;};}function removeEntity(_0x566f68,_0x274a77){return function(_0x236ad0){if(_0x236ad0){return _0x236ad0['destroy']()['then'](function(){_0x566f68[_0xfc5e('0x1a')](0xcc)[_0xfc5e('0x1b')]();});}};}function handleEntityNotFound(_0x3e8e7b,_0x4caf2f){return function(_0x2df413){if(!_0x2df413){_0x3e8e7b[_0xfc5e('0x19')](0x194);}return _0x2df413;};}function handleError(_0x2ded36,_0x544ad2){_0x544ad2=_0x544ad2||0x1f4;return function(_0x14ae69){logger[_0xfc5e('0x27')](_0x14ae69[_0xfc5e('0x28')]);if(_0x14ae69[_0xfc5e('0x29')]){delete _0x14ae69['name'];}_0x2ded36[_0xfc5e('0x1a')](_0x544ad2)[_0xfc5e('0x2a')](_0x14ae69);};}exports[_0xfc5e('0x2b')]=function(_0x19e5cd,_0x1c2d4a){var _0x4074f0={},_0x2791b0={},_0xb3888={'count':0x0,'rows':[]};var _0x1f9416=_['map'](db['VoiceQueueReport'][_0xfc5e('0x2c')],function(_0x454df8){return{'name':_0x454df8[_0xfc5e('0x2d')],'type':_0x454df8[_0xfc5e('0x2e')][_0xfc5e('0x2f')]};});_0x2791b0[_0xfc5e('0x30')]=_[_0xfc5e('0x31')](_0x1f9416,'name');_0x2791b0[_0xfc5e('0x32')]=_[_0xfc5e('0x33')](_0x19e5cd[_0xfc5e('0x32')]);_0x2791b0[_0xfc5e('0x34')]=_['intersection'](_0x2791b0['model'],_0x2791b0[_0xfc5e('0x32')]);_0x4074f0[_0xfc5e('0x35')]=_[_0xfc5e('0x36')](_0x2791b0[_0xfc5e('0x30')],qs[_0xfc5e('0x37')](_0x19e5cd[_0xfc5e('0x32')]['fields']));_0x4074f0[_0xfc5e('0x35')]=_0x4074f0[_0xfc5e('0x35')][_0xfc5e('0x38')]?_0x4074f0[_0xfc5e('0x35')]:_0x2791b0[_0xfc5e('0x30')];if(!_0x19e5cd[_0xfc5e('0x32')]['hasOwnProperty'](_0xfc5e('0x39'))){_0x4074f0[_0xfc5e('0x1f')]=qs[_0xfc5e('0x1f')](_0x19e5cd[_0xfc5e('0x32')][_0xfc5e('0x1f')]);_0x4074f0[_0xfc5e('0x1d')]=qs[_0xfc5e('0x1d')](_0x19e5cd['query'][_0xfc5e('0x1d')]);}_0x4074f0[_0xfc5e('0x3a')]=qs[_0xfc5e('0x3b')](_0x19e5cd[_0xfc5e('0x32')][_0xfc5e('0x3b')]);_0x4074f0[_0xfc5e('0x3c')]=qs[_0xfc5e('0x34')](_[_0xfc5e('0x3d')](_0x19e5cd['query'],_0x2791b0[_0xfc5e('0x34')]),_0x1f9416);if(_0x19e5cd[_0xfc5e('0x32')]['filter']){_0x4074f0[_0xfc5e('0x3c')]=_[_0xfc5e('0x3e')](_0x4074f0[_0xfc5e('0x3c')],{'$or':_[_0xfc5e('0x31')](_0x1f9416,function(_0x8bd247){if(_0x8bd247[_0xfc5e('0x2e')]!==_0xfc5e('0x3f')){var _0x559d2d={};_0x559d2d[_0x8bd247[_0xfc5e('0x29')]]={'$like':'%'+_0x19e5cd['query'][_0xfc5e('0x40')]+'%'};return _0x559d2d;}})});}_0x4074f0=_[_0xfc5e('0x3e')]({},_0x4074f0,_0x19e5cd[_0xfc5e('0x41')]);var _0x4295e3={'where':_0x4074f0[_0xfc5e('0x3c')]};return db[_0xfc5e('0x42')][_0xfc5e('0x20')](_0x4295e3)['then'](function(_0x5cf487){_0xb3888[_0xfc5e('0x20')]=_0x5cf487;if(_0x19e5cd[_0xfc5e('0x32')][_0xfc5e('0x43')]){_0x4074f0[_0xfc5e('0x44')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xfc5e('0x45')](_0x4074f0);})[_0xfc5e('0x26')](function(_0x4a4076){_0xb3888[_0xfc5e('0x46')]=_0x4a4076;return _0xb3888;})['then'](respondWithFilteredResult(_0x1c2d4a,_0x4074f0))[_0xfc5e('0x47')](handleError(_0x1c2d4a,null));};exports[_0xfc5e('0x48')]=function(_0x58fc61,_0x36ab98){var _0x49cba0={'raw':![],'where':{'id':_0x58fc61[_0xfc5e('0x49')]['id']}},_0x3822ba={};_0x3822ba[_0xfc5e('0x30')]=_[_0xfc5e('0x33')](db['VoiceQueueReport'][_0xfc5e('0x2c')]);_0x3822ba[_0xfc5e('0x32')]=_[_0xfc5e('0x33')](_0x58fc61['query']);_0x3822ba[_0xfc5e('0x34')]=_[_0xfc5e('0x36')](_0x3822ba[_0xfc5e('0x30')],_0x3822ba[_0xfc5e('0x32')]);_0x49cba0['attributes']=_['intersection'](_0x3822ba[_0xfc5e('0x30')],qs[_0xfc5e('0x37')](_0x58fc61['query']['fields']));_0x49cba0[_0xfc5e('0x35')]=_0x49cba0['attributes'][_0xfc5e('0x38')]?_0x49cba0[_0xfc5e('0x35')]:_0x3822ba[_0xfc5e('0x30')];if(_0x58fc61[_0xfc5e('0x32')]['includeAll']){_0x49cba0[_0xfc5e('0x44')]=[{'all':!![]}];}_0x49cba0=_['merge']({},_0x49cba0,_0x58fc61[_0xfc5e('0x41')]);return db[_0xfc5e('0x42')]['find'](_0x49cba0)[_0xfc5e('0x26')](handleEntityNotFound(_0x36ab98,null))[_0xfc5e('0x26')](respondWithResult(_0x36ab98,null))[_0xfc5e('0x47')](handleError(_0x36ab98,null));};exports[_0xfc5e('0x4a')]=function(_0xf43965,_0x1c6345){return db[_0xfc5e('0x42')][_0xfc5e('0x4a')](_0xf43965[_0xfc5e('0x4b')],{})['then'](respondWithResult(_0x1c6345,0xc9))['catch'](handleError(_0x1c6345,null));};exports[_0xfc5e('0x25')]=function(_0x1c1e2b,_0x201c03){if(_0x1c1e2b[_0xfc5e('0x4b')]['id']){delete _0x1c1e2b[_0xfc5e('0x4b')]['id'];}return db[_0xfc5e('0x42')][_0xfc5e('0x4c')]({'where':{'id':_0x1c1e2b[_0xfc5e('0x49')]['id']}})[_0xfc5e('0x26')](handleEntityNotFound(_0x201c03,null))[_0xfc5e('0x26')](saveUpdates(_0x1c1e2b[_0xfc5e('0x4b')],null))[_0xfc5e('0x26')](respondWithResult(_0x201c03,null))['catch'](handleError(_0x201c03,null));};exports[_0xfc5e('0x4d')]=function(_0xf73310,_0x313003){return db['VoiceQueueReport']['find']({'where':{'id':_0xf73310[_0xfc5e('0x49')]['id']}})[_0xfc5e('0x26')](handleEntityNotFound(_0x313003,null))['then'](removeEntity(_0x313003,null))[_0xfc5e('0x47')](handleError(_0x313003,null));};exports[_0xfc5e('0x4e')]=function(_0x153da1,_0x3449ed){return db['VoiceQueueReport']['describe']()[_0xfc5e('0x26')](respondWithResult(_0x3449ed,null))[_0xfc5e('0x47')](handleError(_0x3449ed,null));};exports[_0xfc5e('0x4f')]=function(_0xe18fba,_0x35b534){var _0x41a931={},_0x264496={},_0x4ea2a4={'count':0x0,'rows':[]};_0x264496[_0xfc5e('0x30')]=_[_0xfc5e('0x33')](db[_0xfc5e('0x42')]['rawAttributes']);_0x264496[_0xfc5e('0x32')]=_[_0xfc5e('0x33')](_0xe18fba[_0xfc5e('0x32')]);_0x264496[_0xfc5e('0x34')]=_[_0xfc5e('0x36')](_0x264496[_0xfc5e('0x30')],_0x264496[_0xfc5e('0x32')]);_0x41a931[_0xfc5e('0x35')]=_[_0xfc5e('0x36')](_0x264496['model'],qs[_0xfc5e('0x37')](_0xe18fba[_0xfc5e('0x32')][_0xfc5e('0x37')]));_0x41a931[_0xfc5e('0x35')]=_0x41a931[_0xfc5e('0x35')][_0xfc5e('0x38')]?_0x41a931[_0xfc5e('0x35')]:_0x264496[_0xfc5e('0x30')];if(!_0xe18fba[_0xfc5e('0x32')][_0xfc5e('0x50')](_0xfc5e('0x39'))){_0x41a931[_0xfc5e('0x1f')]=qs[_0xfc5e('0x1f')](_0xe18fba['query'][_0xfc5e('0x1f')]);_0x41a931[_0xfc5e('0x1d')]=qs['offset'](_0xe18fba[_0xfc5e('0x32')]['offset']);}_0x41a931[_0xfc5e('0x3a')]=qs[_0xfc5e('0x3b')](_0xe18fba['query'][_0xfc5e('0x3b')]);_0x41a931[_0xfc5e('0x3c')]=qs[_0xfc5e('0x34')](_[_0xfc5e('0x3d')](_0xe18fba[_0xfc5e('0x32')],_0x264496[_0xfc5e('0x34')]));if(_0xe18fba[_0xfc5e('0x32')][_0xfc5e('0x40')]){_0x41a931[_0xfc5e('0x3c')]=_[_0xfc5e('0x3e')](_0x41a931[_0xfc5e('0x3c')],{'$or':_[_0xfc5e('0x31')](_0x41a931[_0xfc5e('0x35')],function(_0x198998){var _0x519a68={};_0x519a68[_0x198998]={'$like':'%'+_0xe18fba[_0xfc5e('0x32')]['filter']+'%'};return _0x519a68;})});}_0x41a931=_[_0xfc5e('0x3e')]({},_0x41a931,_0xe18fba[_0xfc5e('0x41')]);var _0x4c3638={'where':_0x41a931[_0xfc5e('0x3c')]};return db['VoiceQueueReport'][_0xfc5e('0x20')](_0x4c3638)[_0xfc5e('0x26')](function(_0x11ff67){_0x4ea2a4[_0xfc5e('0x20')]=_0x11ff67;if(_0xe18fba[_0xfc5e('0x32')][_0xfc5e('0x43')]){_0x41a931[_0xfc5e('0x44')]=[{'all':!![]}];}return db[_0xfc5e('0x42')][_0xfc5e('0x45')](_0x41a931);})['then'](function(_0x5ac64c){_0x4ea2a4[_0xfc5e('0x46')]=_0x5ac64c;return _0x4ea2a4;})[_0xfc5e('0x26')](respondWithFilteredResult(_0x35b534,_0x41a931,_0xfc5e('0x4f')))[_0xfc5e('0x47')](handleError(_0x35b534,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x5c0d=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','create','body','find','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash'];(function(_0x5a2322,_0x5315c1){var _0x5b7ba1=function(_0x170d10){while(--_0x170d10){_0x5a2322['push'](_0x5a2322['shift']());}};_0x5b7ba1(++_0x5315c1);}(_0x5c0d,0x9b));var _0xd5c0=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0x5c0d[_0x555b2f];return _0x81c0a6;};'use strict';var emlformat=require(_0xd5c0('0x0'));var rimraf=require(_0xd5c0('0x1'));var zipdir=require(_0xd5c0('0x2'));var jsonpatch=require(_0xd5c0('0x3'));var rp=require(_0xd5c0('0x4'));var moment=require(_0xd5c0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd5c0('0x6'));var path=require('path');var sox=require(_0xd5c0('0x7'));var csv=require(_0xd5c0('0x8'));var ejs=require(_0xd5c0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5c0('0xa'));var squel=require(_0xd5c0('0xb'));var crypto=require(_0xd5c0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd5c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd5c0('0xe'));var Papa=require(_0xd5c0('0xf'));var Redis=require(_0xd5c0('0x10'));var authService=require(_0xd5c0('0x11'));var qs=require(_0xd5c0('0x12'));var as=require(_0xd5c0('0x13'));var hardwareService=require(_0xd5c0('0x14'));var logger=require(_0xd5c0('0x15'))(_0xd5c0('0x16'));var utils=require(_0xd5c0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd5c0('0x18'));var db=require(_0xd5c0('0x19'))['db'];config[_0xd5c0('0x1a')]=_[_0xd5c0('0x1b')](config[_0xd5c0('0x1a')],{'host':_0xd5c0('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xd5c0('0x1d')](socket);function respondWithStatusCode(_0x29d584,_0x21e6fd){_0x21e6fd=_0x21e6fd||0xcc;return function(_0x49d008){if(_0x49d008){return _0x29d584[_0xd5c0('0x1e')](_0x21e6fd);}return _0x29d584[_0xd5c0('0x1f')](_0x21e6fd)[_0xd5c0('0x20')]();};}function respondWithResult(_0x197964,_0x4e7347){_0x4e7347=_0x4e7347||0xc8;return function(_0x152b8e){if(_0x152b8e){return _0x197964[_0xd5c0('0x1f')](_0x4e7347)[_0xd5c0('0x21')](_0x152b8e);}};}function respondWithFilteredResult(_0x1bef23,_0x46b883){return function(_0x28f3cc){if(_0x28f3cc){var _0x1a574b=typeof _0x46b883[_0xd5c0('0x22')]==='undefined'&&typeof _0x46b883[_0xd5c0('0x23')]===_0xd5c0('0x24');var _0x546673=_0x28f3cc[_0xd5c0('0x25')];var _0x21f3e7=_0x1a574b?0x0:_0x46b883['offset'];var _0x42e530=_0x1a574b?_0x28f3cc['count']:_0x46b883[_0xd5c0('0x22')]+_0x46b883[_0xd5c0('0x23')];var _0x466b1e;if(_0x42e530>=_0x546673){_0x42e530=_0x546673;_0x466b1e=0xc8;}else{_0x466b1e=0xce;}_0x1bef23['status'](_0x466b1e);return _0x1bef23[_0xd5c0('0x26')](_0xd5c0('0x27'),_0x21f3e7+'-'+_0x42e530+'/'+_0x546673)[_0xd5c0('0x21')](_0x28f3cc);}return null;};}function patchUpdates(_0x25a415){return function(_0xe36a36){try{jsonpatch['apply'](_0xe36a36,_0x25a415,!![]);}catch(_0x1cc041){return BPromise[_0xd5c0('0x28')](_0x1cc041);}return _0xe36a36['save']();};}function saveUpdates(_0x46bc80,_0x392504){return function(_0x4ade70){if(_0x4ade70){return _0x4ade70[_0xd5c0('0x29')](_0x46bc80)[_0xd5c0('0x2a')](function(_0x1eb17c){return _0x1eb17c;});}return null;};}function removeEntity(_0x41309f,_0x1f3d48){return function(_0x446dd1){if(_0x446dd1){return _0x446dd1[_0xd5c0('0x2b')]()[_0xd5c0('0x2a')](function(){_0x41309f[_0xd5c0('0x1f')](0xcc)[_0xd5c0('0x20')]();});}};}function handleEntityNotFound(_0x37becd,_0x3d3fd8){return function(_0x349fec){if(!_0x349fec){_0x37becd['sendStatus'](0x194);}return _0x349fec;};}function handleError(_0x8ce4ba,_0xcd9003){_0xcd9003=_0xcd9003||0x1f4;return function(_0x36035e){logger[_0xd5c0('0x2c')](_0x36035e[_0xd5c0('0x2d')]);if(_0x36035e['name']){delete _0x36035e[_0xd5c0('0x2e')];}_0x8ce4ba[_0xd5c0('0x1f')](_0xcd9003)[_0xd5c0('0x2f')](_0x36035e);};}exports[_0xd5c0('0x30')]=function(_0x159ead,_0x5b234b){var _0x177195={},_0x2d427a={},_0x745cfb={'count':0x0,'rows':[]};var _0x58d628=_[_0xd5c0('0x31')](db[_0xd5c0('0x32')][_0xd5c0('0x33')],function(_0x314713){return{'name':_0x314713['fieldName'],'type':_0x314713[_0xd5c0('0x34')][_0xd5c0('0x35')]};});_0x2d427a[_0xd5c0('0x36')]=_[_0xd5c0('0x31')](_0x58d628,_0xd5c0('0x2e'));_0x2d427a[_0xd5c0('0x37')]=_[_0xd5c0('0x38')](_0x159ead[_0xd5c0('0x37')]);_0x2d427a['filters']=_['intersection'](_0x2d427a['model'],_0x2d427a[_0xd5c0('0x37')]);_0x177195[_0xd5c0('0x39')]=_[_0xd5c0('0x3a')](_0x2d427a[_0xd5c0('0x36')],qs['fields'](_0x159ead[_0xd5c0('0x37')][_0xd5c0('0x3b')]));_0x177195[_0xd5c0('0x39')]=_0x177195['attributes'][_0xd5c0('0x3c')]?_0x177195[_0xd5c0('0x39')]:_0x2d427a[_0xd5c0('0x36')];if(!_0x159ead[_0xd5c0('0x37')][_0xd5c0('0x3d')](_0xd5c0('0x3e'))){_0x177195['limit']=qs['limit'](_0x159ead['query']['limit']);_0x177195[_0xd5c0('0x22')]=qs[_0xd5c0('0x22')](_0x159ead['query']['offset']);}_0x177195[_0xd5c0('0x3f')]=qs[_0xd5c0('0x40')](_0x159ead[_0xd5c0('0x37')][_0xd5c0('0x40')]);_0x177195[_0xd5c0('0x41')]=qs[_0xd5c0('0x42')](_[_0xd5c0('0x43')](_0x159ead['query'],_0x2d427a[_0xd5c0('0x42')]),_0x58d628);if(_0x159ead[_0xd5c0('0x37')][_0xd5c0('0x44')]){_0x177195[_0xd5c0('0x41')]=_[_0xd5c0('0x45')](_0x177195[_0xd5c0('0x41')],{'$or':_[_0xd5c0('0x31')](_0x58d628,function(_0x339329){if(_0x339329[_0xd5c0('0x34')]!==_0xd5c0('0x46')){var _0x79bf0d={};_0x79bf0d[_0x339329[_0xd5c0('0x2e')]]={'$like':'%'+_0x159ead[_0xd5c0('0x37')][_0xd5c0('0x44')]+'%'};return _0x79bf0d;}})});}_0x177195=_[_0xd5c0('0x45')]({},_0x177195,_0x159ead['options']);var _0x11dd29={'where':_0x177195['where']};return db[_0xd5c0('0x32')][_0xd5c0('0x25')](_0x11dd29)[_0xd5c0('0x2a')](function(_0x491d66){_0x745cfb[_0xd5c0('0x25')]=_0x491d66;if(_0x159ead[_0xd5c0('0x37')][_0xd5c0('0x47')]){_0x177195[_0xd5c0('0x48')]=[{'all':!![]}];}return db[_0xd5c0('0x32')][_0xd5c0('0x49')](_0x177195);})[_0xd5c0('0x2a')](function(_0x189f49){_0x745cfb[_0xd5c0('0x4a')]=_0x189f49;return _0x745cfb;})[_0xd5c0('0x2a')](respondWithFilteredResult(_0x5b234b,_0x177195))[_0xd5c0('0x4b')](handleError(_0x5b234b,null));};exports['show']=function(_0x4c1f2d,_0x45b81f){var _0x24e095={'raw':![],'where':{'id':_0x4c1f2d[_0xd5c0('0x4c')]['id']}},_0x49dcee={};_0x49dcee[_0xd5c0('0x36')]=_['keys'](db['VoiceQueueReport'][_0xd5c0('0x33')]);_0x49dcee[_0xd5c0('0x37')]=_['keys'](_0x4c1f2d[_0xd5c0('0x37')]);_0x49dcee[_0xd5c0('0x42')]=_[_0xd5c0('0x3a')](_0x49dcee[_0xd5c0('0x36')],_0x49dcee['query']);_0x24e095[_0xd5c0('0x39')]=_[_0xd5c0('0x3a')](_0x49dcee[_0xd5c0('0x36')],qs[_0xd5c0('0x3b')](_0x4c1f2d[_0xd5c0('0x37')][_0xd5c0('0x3b')]));_0x24e095['attributes']=_0x24e095[_0xd5c0('0x39')][_0xd5c0('0x3c')]?_0x24e095[_0xd5c0('0x39')]:_0x49dcee[_0xd5c0('0x36')];if(_0x4c1f2d['query'][_0xd5c0('0x47')]){_0x24e095[_0xd5c0('0x48')]=[{'all':!![]}];}_0x24e095=_[_0xd5c0('0x45')]({},_0x24e095,_0x4c1f2d[_0xd5c0('0x4d')]);return db[_0xd5c0('0x32')]['find'](_0x24e095)[_0xd5c0('0x2a')](handleEntityNotFound(_0x45b81f,null))[_0xd5c0('0x2a')](respondWithResult(_0x45b81f,null))[_0xd5c0('0x4b')](handleError(_0x45b81f,null));};exports[_0xd5c0('0x4e')]=function(_0x4b4772,_0x469de7){return db[_0xd5c0('0x32')]['create'](_0x4b4772['body'],{})[_0xd5c0('0x2a')](respondWithResult(_0x469de7,0xc9))[_0xd5c0('0x4b')](handleError(_0x469de7,null));};exports['update']=function(_0x51dacc,_0x79c175){if(_0x51dacc[_0xd5c0('0x4f')]['id']){delete _0x51dacc['body']['id'];}return db[_0xd5c0('0x32')][_0xd5c0('0x50')]({'where':{'id':_0x51dacc[_0xd5c0('0x4c')]['id']}})[_0xd5c0('0x2a')](handleEntityNotFound(_0x79c175,null))[_0xd5c0('0x2a')](saveUpdates(_0x51dacc[_0xd5c0('0x4f')],null))[_0xd5c0('0x2a')](respondWithResult(_0x79c175,null))['catch'](handleError(_0x79c175,null));};exports[_0xd5c0('0x2b')]=function(_0x456bdd,_0x22dcf5){return db[_0xd5c0('0x32')][_0xd5c0('0x50')]({'where':{'id':_0x456bdd['params']['id']}})[_0xd5c0('0x2a')](handleEntityNotFound(_0x22dcf5,null))['then'](removeEntity(_0x22dcf5,null))[_0xd5c0('0x4b')](handleError(_0x22dcf5,null));};exports[_0xd5c0('0x51')]=function(_0x4fbc89,_0x535dac){return db[_0xd5c0('0x32')][_0xd5c0('0x51')]()['then'](respondWithResult(_0x535dac,null))[_0xd5c0('0x4b')](handleError(_0x535dac,null));};exports[_0xd5c0('0x52')]=function(_0x31f629,_0x3a4587){var _0x19da69={},_0x5c96e6={},_0x299171={'count':0x0,'rows':[]};_0x5c96e6[_0xd5c0('0x36')]=_[_0xd5c0('0x38')](db[_0xd5c0('0x32')]['rawAttributes']);_0x5c96e6[_0xd5c0('0x37')]=_[_0xd5c0('0x38')](_0x31f629[_0xd5c0('0x37')]);_0x5c96e6[_0xd5c0('0x42')]=_[_0xd5c0('0x3a')](_0x5c96e6['model'],_0x5c96e6['query']);_0x19da69[_0xd5c0('0x39')]=_[_0xd5c0('0x3a')](_0x5c96e6[_0xd5c0('0x36')],qs[_0xd5c0('0x3b')](_0x31f629[_0xd5c0('0x37')][_0xd5c0('0x3b')]));_0x19da69[_0xd5c0('0x39')]=_0x19da69[_0xd5c0('0x39')]['length']?_0x19da69[_0xd5c0('0x39')]:_0x5c96e6[_0xd5c0('0x36')];if(!_0x31f629['query']['hasOwnProperty'](_0xd5c0('0x3e'))){_0x19da69[_0xd5c0('0x23')]=qs['limit'](_0x31f629[_0xd5c0('0x37')][_0xd5c0('0x23')]);_0x19da69[_0xd5c0('0x22')]=qs[_0xd5c0('0x22')](_0x31f629[_0xd5c0('0x37')][_0xd5c0('0x22')]);}_0x19da69[_0xd5c0('0x3f')]=qs['sort'](_0x31f629['query'][_0xd5c0('0x40')]);_0x19da69[_0xd5c0('0x41')]=qs[_0xd5c0('0x42')](_[_0xd5c0('0x43')](_0x31f629[_0xd5c0('0x37')],_0x5c96e6[_0xd5c0('0x42')]));if(_0x31f629[_0xd5c0('0x37')][_0xd5c0('0x44')]){_0x19da69[_0xd5c0('0x41')]=_[_0xd5c0('0x45')](_0x19da69[_0xd5c0('0x41')],{'$or':_[_0xd5c0('0x31')](_0x19da69[_0xd5c0('0x39')],function(_0x1ded9c){var _0x55c4e3={};_0x55c4e3[_0x1ded9c]={'$like':'%'+_0x31f629['query'][_0xd5c0('0x44')]+'%'};return _0x55c4e3;})});}_0x19da69=_[_0xd5c0('0x45')]({},_0x19da69,_0x31f629['options']);var _0x5b8791={'where':_0x19da69[_0xd5c0('0x41')]};return db[_0xd5c0('0x32')][_0xd5c0('0x25')](_0x5b8791)['then'](function(_0x347064){_0x299171[_0xd5c0('0x25')]=_0x347064;if(_0x31f629[_0xd5c0('0x37')]['includeAll']){_0x19da69[_0xd5c0('0x48')]=[{'all':!![]}];}return db[_0xd5c0('0x32')]['findAll'](_0x19da69);})[_0xd5c0('0x2a')](function(_0x11c90b){_0x299171[_0xd5c0('0x4a')]=_0x11c90b;return _0x299171;})['then'](respondWithFilteredResult(_0x3a4587,_0x19da69,_0xd5c0('0x52')))['catch'](handleError(_0x3a4587,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 5edeef1..f90463c 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 _0xaa9e=['save','emit','exports','events','VoiceQueueReport'];(function(_0x5cec4a,_0x2cb41e){var _0x2d64f4=function(_0x287b5e){while(--_0x287b5e){_0x5cec4a['push'](_0x5cec4a['shift']());}};_0x2d64f4(++_0x2cb41e);}(_0xaa9e,0x1ed));var _0xeaa9=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xaa9e[_0x55d8c5];return _0x225ae5;};'use strict';var EventEmitter=require(_0xeaa9('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xeaa9('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeaa9('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x7630e8){return function(_0x224528,_0x4219af,_0x119f7e){VoiceQueueReportEvents[_0xeaa9('0x3')](_0x7630e8+':'+_0x224528['id'],_0x224528);VoiceQueueReportEvents[_0xeaa9('0x3')](_0x7630e8,_0x224528);_0x119f7e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xeaa9('0x4')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x9ed0=['VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x53b2ef,_0x2f8de5){var _0x17e2dc=function(_0x15f424){while(--_0x15f424){_0x53b2ef['push'](_0x53b2ef['shift']());}};_0x17e2dc(++_0x2f8de5);}(_0x9ed0,0x98));var _0x09ed=function(_0x28b83a,_0x401d6f){_0x28b83a=_0x28b83a-0x0;var _0x5985d9=_0x9ed0[_0x28b83a];return _0x5985d9;};'use strict';var EventEmitter=require(_0x09ed('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x09ed('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x09ed('0x2')](0x0);var events={'afterCreate':_0x09ed('0x3'),'afterUpdate':'update','afterDestroy':_0x09ed('0x4')};function emitEvent(_0x3dc31a){return function(_0x1fe64b,_0x58b6c7,_0x1c9fa3){VoiceQueueReportEvents[_0x09ed('0x5')](_0x3dc31a+':'+_0x1fe64b['id'],_0x1fe64b);VoiceQueueReportEvents[_0x09ed('0x5')](_0x3dc31a,_0x1fe64b);_0x1c9fa3(null);};}for(var e in events){if(events[_0x09ed('0x6')](e)){var event=events[e];VoiceQueueReport[_0x09ed('0x7')](e,emitEvent(event));}}module[_0x09ed('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 1fa9237..b1e119c 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 _0x01a3=['./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14efed,_0x16f631){var _0x3599c3=function(_0x385c31){while(--_0x385c31){_0x14efed['push'](_0x14efed['shift']());}};_0x3599c3(++_0x16f631);}(_0x01a3,0x13a));var _0x301a=function(_0x5440c1,_0x4efa2b){_0x5440c1=_0x5440c1-0x0;var _0x125394=_0x01a3[_0x5440c1];return _0x125394;};'use strict';var _=require(_0x301a('0x0'));var util=require(_0x301a('0x1'));var logger=require(_0x301a('0x2'))(_0x301a('0x3'));var moment=require(_0x301a('0x4'));var BPromise=require(_0x301a('0x5'));var rp=require(_0x301a('0x6'));var fs=require('fs');var path=require(_0x301a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x301a('0x8'));module[_0x301a('0x9')]=function(_0x33c685,_0x506808){return _0x33c685[_0x301a('0xa')]('VoiceQueueReport',attributes,{'tableName':_0x301a('0xb'),'paranoid':![],'indexes':[{'fields':[_0x301a('0xc')]},{'fields':[_0x301a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabf8=['path','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','calleridnum','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x311f34,_0xf0697f){var _0xcc2d4e=function(_0x49caa1){while(--_0x49caa1){_0x311f34['push'](_0x311f34['shift']());}};_0xcc2d4e(++_0xf0697f);}(_0xabf8,0x6f));var _0x8abf=function(_0x4642ca,_0xf83e61){_0x4642ca=_0x4642ca-0x0;var _0x45f89c=_0xabf8[_0x4642ca];return _0x45f89c;};'use strict';var _=require(_0x8abf('0x0'));var util=require(_0x8abf('0x1'));var logger=require(_0x8abf('0x2'))('api');var moment=require(_0x8abf('0x3'));var BPromise=require(_0x8abf('0x4'));var rp=require(_0x8abf('0x5'));var fs=require('fs');var path=require(_0x8abf('0x6'));var rimraf=require('rimraf');var config=require(_0x8abf('0x7'));var attributes=require(_0x8abf('0x8'));module['exports']=function(_0x45ed77,_0x4a6ef8){return _0x45ed77[_0x8abf('0x9')](_0x8abf('0xa'),attributes,{'tableName':_0x8abf('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x8abf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index b48f856..770dc09 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 _0x1266=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceQueueReport.socket','register','request','then','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','map','CreateVoiceQueueReport','create','body','debug','UpdateVoiceQueueReport','lodash','util','moment'];(function(_0x41da69,_0x4751df){var _0x44fe91=function(_0x2930e3){while(--_0x2930e3){_0x41da69['push'](_0x41da69['shift']());}};_0x44fe91(++_0x4751df);}(_0x1266,0xd4));var _0x6126=function(_0xf2193a,_0x1c7dbf){_0xf2193a=_0xf2193a-0x0;var _0xf18f1d=_0x1266[_0xf2193a];return _0xf18f1d;};'use strict';var _=require(_0x6126('0x0'));var util=require(_0x6126('0x1'));var moment=require(_0x6126('0x2'));var BPromise=require('bluebird');var rs=require(_0x6126('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6126('0x4'))['db'];var utils=require(_0x6126('0x5'));var logger=require('../../config/logger')(_0x6126('0x6'));var config=require(_0x6126('0x7'));var jayson=require(_0x6126('0x8'));var client=jayson[_0x6126('0x9')]['http']({'port':0x232a});config[_0x6126('0xa')]=_[_0x6126('0xb')](config[_0x6126('0xa')],{'host':_0x6126('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6126('0xd'))[_0x6126('0xe')](socket);function respondWithRpcPromise(_0x2e3648,_0x41098f,_0x35fb25){return new BPromise(function(_0x545b8e,_0x35fbbe){return client[_0x6126('0xf')](_0x2e3648,_0x35fb25)[_0x6126('0x10')](function(_0xa05d6d){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x41098f,_0x6126('0x11'));logger['debug'](_0x6126('0x12'),_0x41098f,_0x6126('0x11'),JSON[_0x6126('0x13')](_0xa05d6d));if(_0xa05d6d[_0x6126('0x14')]){if(_0xa05d6d['error'][_0x6126('0x15')]===0x1f4){logger[_0x6126('0x14')](_0x6126('0x16'),_0x41098f,_0xa05d6d['error'][_0x6126('0x17')]);return _0x35fbbe(_0xa05d6d['error'][_0x6126('0x17')]);}logger[_0x6126('0x14')](_0x6126('0x16'),_0x41098f,_0xa05d6d['error'][_0x6126('0x17')]);return _0x545b8e(_0xa05d6d['error'][_0x6126('0x17')]);}else{logger[_0x6126('0x18')](_0x6126('0x16'),_0x41098f,'request\x20sent');_0x545b8e(_0xa05d6d[_0x6126('0x19')][_0x6126('0x17')]);}})[_0x6126('0x1a')](function(_0xac2bb7){logger[_0x6126('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x41098f,_0xac2bb7);_0x35fbbe(_0xac2bb7);});});}exports[_0x6126('0x1b')]=function(_0x907f88){var _0x1afff2=this;return new Promise(function(_0x818e2e,_0x83dfdd){return db[_0x6126('0x1c')][_0x6126('0x1d')]({'raw':_0x907f88[_0x6126('0x1e')]?_0x907f88['options'][_0x6126('0x1f')]===undefined?!![]:![]:!![],'where':_0x907f88['options']?_0x907f88['options'][_0x6126('0x20')]||null:null,'attributes':_0x907f88[_0x6126('0x1e')]?_0x907f88[_0x6126('0x1e')][_0x6126('0x21')]||null:null,'limit':_0x907f88[_0x6126('0x1e')]?_0x907f88['options'][_0x6126('0x22')]||null:null,'include':_0x907f88[_0x6126('0x1e')]?_0x907f88['options']['include']?_['map'](_0x907f88[_0x6126('0x1e')][_0x6126('0x23')],function(_0x4a710d){return{'model':db[_0x4a710d[_0x6126('0x24')]],'as':_0x4a710d['as'],'attributes':_0x4a710d[_0x6126('0x21')],'include':_0x4a710d['include']?_['map'](_0x4a710d['include'],function(_0x3b82f3){return{'model':db[_0x3b82f3[_0x6126('0x24')]],'as':_0x3b82f3['as'],'attributes':_0x3b82f3['attributes'],'include':_0x3b82f3[_0x6126('0x23')]?_[_0x6126('0x25')](_0x3b82f3[_0x6126('0x23')],function(_0x2639c2){return{'model':db[_0x2639c2[_0x6126('0x24')]],'as':_0x2639c2['as'],'attributes':_0x2639c2[_0x6126('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6126('0x10')](function(_0x52af37){logger[_0x6126('0x18')]('GetVoiceQueueReport',_0x907f88);logger['debug'](_0x6126('0x1b'),_0x907f88,JSON[_0x6126('0x13')](_0x52af37));_0x818e2e(_0x52af37);})[_0x6126('0x1a')](function(_0x460bd3){logger['error'](_0x6126('0x1b'),_0x460bd3[_0x6126('0x17')],_0x907f88);_0x83dfdd(_0x1afff2[_0x6126('0x14')](0x1f4,_0x460bd3[_0x6126('0x17')]));});});};exports[_0x6126('0x26')]=function(_0x3e2313){var _0x13fa6f=this;return new Promise(function(_0x50f3d2,_0x3a4a06){return db[_0x6126('0x1c')][_0x6126('0x27')](_0x3e2313[_0x6126('0x28')],{'raw':_0x3e2313[_0x6126('0x1e')]?_0x3e2313['options'][_0x6126('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x12d05b){logger[_0x6126('0x18')](_0x6126('0x26'),_0x3e2313);logger[_0x6126('0x29')](_0x6126('0x26'),_0x3e2313,JSON[_0x6126('0x13')](_0x12d05b));_0x50f3d2(_0x12d05b);})['catch'](function(_0x172483){logger[_0x6126('0x14')](_0x6126('0x26'),_0x172483['message'],_0x3e2313);_0x3a4a06(_0x13fa6f[_0x6126('0x14')](0x1f4,_0x172483['message']));});});};exports[_0x6126('0x2a')]=function(_0x5964dd){var _0xad8a10=this;return new Promise(function(_0x50398f,_0x4759f6){return db[_0x6126('0x1c')]['update'](_0x5964dd['body'],{'raw':_0x5964dd[_0x6126('0x1e')]?_0x5964dd[_0x6126('0x1e')][_0x6126('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5964dd[_0x6126('0x1e')]?_0x5964dd[_0x6126('0x1e')]['where']||null:null,'attributes':_0x5964dd[_0x6126('0x1e')]?_0x5964dd['options'][_0x6126('0x21')]||null:null,'limit':_0x5964dd['options']?_0x5964dd[_0x6126('0x1e')][_0x6126('0x22')]||null:null})[_0x6126('0x10')](function(_0x2ce2dd){logger[_0x6126('0x18')](_0x6126('0x2a'),_0x5964dd);logger[_0x6126('0x29')]('UpdateVoiceQueueReport',_0x5964dd,JSON[_0x6126('0x13')](_0x2ce2dd));_0x50398f(_0x2ce2dd);})['catch'](function(_0x2c1529){logger[_0x6126('0x14')](_0x6126('0x2a'),_0x2c1529['message'],_0x5964dd);_0x4759f6(_0xad8a10[_0x6126('0x14')](0x1f4,_0x2c1529['message']));});});}; \ No newline at end of file +var _0x369b=['GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','stringify','catch','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','body','where','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./voiceQueueReport.socket','register','then','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x369b,0x89));var _0xb369=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x369b[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0xb369('0x0'));var util=require(_0xb369('0x1'));var moment=require(_0xb369('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb369('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb369('0x4'));var logger=require(_0xb369('0x5'))(_0xb369('0x6'));var config=require('../../config/environment');var jayson=require(_0xb369('0x7'));var client=jayson[_0xb369('0x8')][_0xb369('0x9')]({'port':0x232a});config[_0xb369('0xa')]=_[_0xb369('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb369('0xa')]));require(_0xb369('0xc'))[_0xb369('0xd')](socket);function respondWithRpcPromise(_0x54e1ed,_0x99659b,_0x350a97){return new BPromise(function(_0x1ba53a,_0xc93f7d){return client['request'](_0x54e1ed,_0x350a97)[_0xb369('0xe')](function(_0x2db5eb){logger['info'](_0xb369('0xf'),_0x99659b,'request\x20sent');logger[_0xb369('0x10')](_0xb369('0x11'),_0x99659b,_0xb369('0x12'),JSON['stringify'](_0x2db5eb));if(_0x2db5eb[_0xb369('0x13')]){if(_0x2db5eb[_0xb369('0x13')][_0xb369('0x14')]===0x1f4){logger[_0xb369('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x99659b,_0x2db5eb['error']['message']);return _0xc93f7d(_0x2db5eb[_0xb369('0x13')][_0xb369('0x15')]);}logger[_0xb369('0x13')](_0xb369('0xf'),_0x99659b,_0x2db5eb[_0xb369('0x13')][_0xb369('0x15')]);return _0x1ba53a(_0x2db5eb[_0xb369('0x13')]['message']);}else{logger[_0xb369('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x99659b,_0xb369('0x12'));_0x1ba53a(_0x2db5eb['result']['message']);}})['catch'](function(_0x127031){logger[_0xb369('0x13')](_0xb369('0xf'),_0x99659b,_0x127031);_0xc93f7d(_0x127031);});});}exports[_0xb369('0x17')]=function(_0x53002b){var _0x409e16=this;return new Promise(function(_0x50541f,_0x4aa5c9){return db[_0xb369('0x18')][_0xb369('0x19')]({'raw':_0x53002b[_0xb369('0x1a')]?_0x53002b[_0xb369('0x1a')][_0xb369('0x1b')]===undefined?!![]:![]:!![],'where':_0x53002b[_0xb369('0x1a')]?_0x53002b['options']['where']||null:null,'attributes':_0x53002b[_0xb369('0x1a')]?_0x53002b[_0xb369('0x1a')][_0xb369('0x1c')]||null:null,'limit':_0x53002b[_0xb369('0x1a')]?_0x53002b[_0xb369('0x1a')][_0xb369('0x1d')]||null:null,'include':_0x53002b[_0xb369('0x1a')]?_0x53002b[_0xb369('0x1a')][_0xb369('0x1e')]?_[_0xb369('0x1f')](_0x53002b[_0xb369('0x1a')]['include'],function(_0x444592){return{'model':db[_0x444592['model']],'as':_0x444592['as'],'attributes':_0x444592['attributes'],'include':_0x444592[_0xb369('0x1e')]?_[_0xb369('0x1f')](_0x444592[_0xb369('0x1e')],function(_0x5009ea){return{'model':db[_0x5009ea[_0xb369('0x20')]],'as':_0x5009ea['as'],'attributes':_0x5009ea[_0xb369('0x1c')],'include':_0x5009ea[_0xb369('0x1e')]?_[_0xb369('0x1f')](_0x5009ea['include'],function(_0x47bb8e){return{'model':db[_0x47bb8e[_0xb369('0x20')]],'as':_0x47bb8e['as'],'attributes':_0x47bb8e[_0xb369('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb369('0xe')](function(_0x18bc08){logger['info']('GetVoiceQueueReport',_0x53002b);logger[_0xb369('0x10')]('GetVoiceQueueReport',_0x53002b,JSON[_0xb369('0x21')](_0x18bc08));_0x50541f(_0x18bc08);})[_0xb369('0x22')](function(_0x3fb46c){logger[_0xb369('0x13')](_0xb369('0x17'),_0x3fb46c[_0xb369('0x15')],_0x53002b);_0x4aa5c9(_0x409e16[_0xb369('0x13')](0x1f4,_0x3fb46c[_0xb369('0x15')]));});});};exports[_0xb369('0x23')]=function(_0x8b0c03){var _0x429f04=this;return new Promise(function(_0x3ac9de,_0xcfa183){return db[_0xb369('0x18')]['create'](_0x8b0c03['body'],{'raw':_0x8b0c03['options']?_0x8b0c03[_0xb369('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xb369('0xe')](function(_0x5b47fa){logger['info'](_0xb369('0x23'),_0x8b0c03);logger[_0xb369('0x10')]('CreateVoiceQueueReport',_0x8b0c03,JSON[_0xb369('0x21')](_0x5b47fa));_0x3ac9de(_0x5b47fa);})['catch'](function(_0xd86dd6){logger[_0xb369('0x13')](_0xb369('0x23'),_0xd86dd6[_0xb369('0x15')],_0x8b0c03);_0xcfa183(_0x429f04[_0xb369('0x13')](0x1f4,_0xd86dd6[_0xb369('0x15')]));});});};exports[_0xb369('0x24')]=function(_0x199840){var _0x5cbc6e=this;return new Promise(function(_0x5ce69f,_0x2bbb96){return db[_0xb369('0x18')][_0xb369('0x25')](_0x199840[_0xb369('0x26')],{'raw':_0x199840['options']?_0x199840['options'][_0xb369('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x199840[_0xb369('0x1a')]?_0x199840[_0xb369('0x1a')][_0xb369('0x27')]||null:null,'attributes':_0x199840[_0xb369('0x1a')]?_0x199840[_0xb369('0x1a')]['attributes']||null:null,'limit':_0x199840[_0xb369('0x1a')]?_0x199840[_0xb369('0x1a')][_0xb369('0x1d')]||null:null})[_0xb369('0xe')](function(_0x50a869){logger['info'](_0xb369('0x24'),_0x199840);logger[_0xb369('0x10')](_0xb369('0x24'),_0x199840,JSON['stringify'](_0x50a869));_0x5ce69f(_0x50a869);})['catch'](function(_0x53b0df){logger['error'](_0xb369('0x24'),_0x53b0df[_0xb369('0x15')],_0x199840);_0x2bbb96(_0x5cbc6e['error'](0x1f4,_0x53b0df[_0xb369('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 9d1e68f..a430aa2 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 _0x872a=['removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit'];(function(_0x3c3f14,_0x43b666){var _0x7068cd=function(_0x3db43c){while(--_0x3db43c){_0x3c3f14['push'](_0x3c3f14['shift']());}};_0x7068cd(++_0x43b666);}(_0x872a,0x100));var _0xa872=function(_0x450087,_0x7cae40){_0x450087=_0x450087-0x0;var _0x420929=_0x872a[_0x450087];return _0x420929;};'use strict';var VoiceQueueReportEvents=require(_0xa872('0x0'));var events=[_0xa872('0x1'),_0xa872('0x2'),_0xa872('0x3')];function createListener(_0x4a2170,_0x48294d){return function(_0x4c6509){_0x48294d[_0xa872('0x4')](_0x4a2170,_0x4c6509);};}function removeListener(_0x58715a,_0x2854a7){return function(){VoiceQueueReportEvents[_0xa872('0x5')](_0x58715a,_0x2854a7);};}exports[_0xa872('0x6')]=function(_0x1c8d2f){for(var _0x3e3cd4=0x0,_0x4aab9d=events[_0xa872('0x7')];_0x3e3cd4<_0x4aab9d;_0x3e3cd4++){var _0x1b87b7=events[_0x3e3cd4];var _0x1e0c05=createListener(_0xa872('0x8')+_0x1b87b7,_0x1c8d2f);VoiceQueueReportEvents['on'](_0x1b87b7,_0x1e0c05);}}; \ No newline at end of file +var _0xd8af=['length','./voiceQueueReport.events','save','remove','update','removeListener'];(function(_0x57f23e,_0x4ccbe4){var _0x3b409f=function(_0xdd74d){while(--_0xdd74d){_0x57f23e['push'](_0x57f23e['shift']());}};_0x3b409f(++_0x4ccbe4);}(_0xd8af,0x18d));var _0xfd8a=function(_0x130507,_0x437e17){_0x130507=_0x130507-0x0;var _0x936631=_0xd8af[_0x130507];return _0x936631;};'use strict';var VoiceQueueReportEvents=require(_0xfd8a('0x0'));var events=[_0xfd8a('0x1'),_0xfd8a('0x2'),_0xfd8a('0x3')];function createListener(_0xe6bc6c,_0x58728d){return function(_0x307508){_0x58728d['emit'](_0xe6bc6c,_0x307508);};}function removeListener(_0x1252b1,_0x151b88){return function(){VoiceQueueReportEvents[_0xfd8a('0x4')](_0x1252b1,_0x151b88);};}exports['register']=function(_0x44c7ed){for(var _0x4c7603=0x0,_0x8b725c=events[_0xfd8a('0x5')];_0x4c7603<_0x8b725c;_0x4c7603++){var _0x31fdfc=events[_0x4c7603];var _0x1d1fb4=createListener('voiceQueueReport:'+_0x31fdfc,_0x44c7ed);VoiceQueueReportEvents['on'](_0x31fdfc,_0x1d1fb4);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index cdcc6ac..79bfa72 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 _0x4ef1=['/:id','show','post','create','put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated'];(function(_0x30cb58,_0x560b63){var _0x1ea023=function(_0x111f7b){while(--_0x111f7b){_0x30cb58['push'](_0x30cb58['shift']());}};_0x1ea023(++_0x560b63);}(_0x4ef1,0xeb));var _0x14ef=function(_0xb65f0c,_0xe60c57){_0xb65f0c=_0xb65f0c-0x0;var _0x2ff246=_0x4ef1[_0xb65f0c];return _0x2ff246;};'use strict';var multer=require(_0x14ef('0x0'));var util=require(_0x14ef('0x1'));var path=require('path');var timeout=require(_0x14ef('0x2'));var express=require(_0x14ef('0x3'));var router=express[_0x14ef('0x4')]();var fs_extra=require(_0x14ef('0x5'));var auth=require(_0x14ef('0x6'));var interaction=require(_0x14ef('0x7'));var config=require(_0x14ef('0x8'));var controller=require(_0x14ef('0x9'));router[_0x14ef('0xa')]('/',auth[_0x14ef('0xb')](),controller['index']);router[_0x14ef('0xa')](_0x14ef('0xc'),auth['isAuthenticated'](),controller[_0x14ef('0xd')]);router[_0x14ef('0xe')]('/',auth[_0x14ef('0xb')](),controller[_0x14ef('0xf')]);router[_0x14ef('0x10')]('/:id',auth[_0x14ef('0xb')](),controller['update']);router[_0x14ef('0x11')](_0x14ef('0xc'),auth[_0x14ef('0xb')](),controller[_0x14ef('0x12')]);module['exports']=router; \ No newline at end of file +var _0xab04=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xab04,0x194));var _0x4ab0=function(_0x18d3d2,_0x48809e){_0x18d3d2=_0x18d3d2-0x0;var _0x582ee2=_0xab04[_0x18d3d2];return _0x582ee2;};'use strict';var multer=require(_0x4ab0('0x0'));var util=require(_0x4ab0('0x1'));var path=require(_0x4ab0('0x2'));var timeout=require(_0x4ab0('0x3'));var express=require(_0x4ab0('0x4'));var router=express[_0x4ab0('0x5')]();var fs_extra=require(_0x4ab0('0x6'));var auth=require(_0x4ab0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x4ab0('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0x4ab0('0x9')]('/',auth['isAuthenticated'](),controller[_0x4ab0('0xa')]);router[_0x4ab0('0x9')](_0x4ab0('0xb'),auth[_0x4ab0('0xc')](),controller['show']);router[_0x4ab0('0xd')]('/',auth[_0x4ab0('0xc')](),controller['create']);router['put'](_0x4ab0('0xb'),auth[_0x4ab0('0xc')](),controller['update']);router[_0x4ab0('0xe')](_0x4ab0('0xb'),auth[_0x4ab0('0xc')](),controller[_0x4ab0('0xf')]);module[_0x4ab0('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 3662580..f60dfaf 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 _0xf2be=['STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports'];(function(_0x1b3224,_0x3351d9){var _0x5dae4f=function(_0x22894a){while(--_0x22894a){_0x1b3224['push'](_0x1b3224['shift']());}};_0x5dae4f(++_0x3351d9);}(_0xf2be,0x1d2));var _0xef2b=function(_0x352c54,_0x52c1f6){_0x352c54=_0x352c54-0x0;var _0x1f134d=_0xf2be[_0x352c54];return _0x1f134d;};'use strict';var Sequelize=require(_0xef2b('0x0'));var moment=require(_0xef2b('0x1'));module[_0xef2b('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xef2b('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xef2b('0x5')](_0xef2b('0x6'))}}; \ No newline at end of file +var _0xe963=['sequelize','moment','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x20918a,_0x371842){var _0x535adc=function(_0x17f138){while(--_0x17f138){_0x20918a['push'](_0x20918a['shift']());}};_0x535adc(++_0x371842);}(_0xe963,0x10e));var _0x3e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe963[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3e96('0x0'));var moment=require(_0x3e96('0x1'));module['exports']={'time':{'type':Sequelize[_0x3e96('0x2')]},'callid':{'type':Sequelize[_0x3e96('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x3e96('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x3e96('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x3e96('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x3e96('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x3e96('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x3e96('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x3e96('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x3e96('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x3e96('0x4')](_0x3e96('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index aac1661..7fef24c 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 _0x98e2=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','VoiceQueuesLog','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','include','findAll','catch','rawAttributes','options','find','create','body','params','destroy','eml-format','rimraf','zip-dir'];(function(_0x413944,_0x1f8ba4){var _0x35f812=function(_0x4495eb){while(--_0x4495eb){_0x413944['push'](_0x413944['shift']());}};_0x35f812(++_0x1f8ba4);}(_0x98e2,0xdb));var _0x298e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x98e2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x298e('0x0'));var rimraf=require(_0x298e('0x1'));var zipdir=require(_0x298e('0x2'));var jsonpatch=require(_0x298e('0x3'));var rp=require(_0x298e('0x4'));var moment=require(_0x298e('0x5'));var BPromise=require(_0x298e('0x6'));var Mustache=require(_0x298e('0x7'));var util=require(_0x298e('0x8'));var path=require(_0x298e('0x9'));var sox=require(_0x298e('0xa'));var csv=require(_0x298e('0xb'));var ejs=require(_0x298e('0xc'));var fs=require('fs');var fs_extra=require(_0x298e('0xd'));var _=require(_0x298e('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x298e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x298e('0xb'));var querystring=require('querystring');var Papa=require(_0x298e('0x10'));var Redis=require(_0x298e('0x11'));var authService=require(_0x298e('0x12'));var qs=require(_0x298e('0x13'));var as=require(_0x298e('0x14'));var hardwareService=require(_0x298e('0x15'));var logger=require(_0x298e('0x16'))(_0x298e('0x17'));var utils=require(_0x298e('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x298e('0x19'))['db'];function respondWithStatusCode(_0x203d55,_0x54950a){_0x54950a=_0x54950a||0xcc;return function(_0x46fde2){if(_0x46fde2){return _0x203d55[_0x298e('0x1a')](_0x54950a);}return _0x203d55[_0x298e('0x1b')](_0x54950a)[_0x298e('0x1c')]();};}function respondWithResult(_0xbb56a5,_0x2906f9){_0x2906f9=_0x2906f9||0xc8;return function(_0x134a2b){if(_0x134a2b){return _0xbb56a5[_0x298e('0x1b')](_0x2906f9)[_0x298e('0x1d')](_0x134a2b);}};}function respondWithFilteredResult(_0x4906b2,_0x28f115){return function(_0x3775d7){if(_0x3775d7){var _0x4e6fe9=typeof _0x28f115[_0x298e('0x1e')]===_0x298e('0x1f')&&typeof _0x28f115[_0x298e('0x20')]===_0x298e('0x1f');var _0x35b8ae=_0x3775d7[_0x298e('0x21')];var _0x45dd99=_0x4e6fe9?0x0:_0x28f115['offset'];var _0x51b2b7=_0x4e6fe9?_0x3775d7[_0x298e('0x21')]:_0x28f115[_0x298e('0x1e')]+_0x28f115[_0x298e('0x20')];var _0x37ce3b;if(_0x51b2b7>=_0x35b8ae){_0x51b2b7=_0x35b8ae;_0x37ce3b=0xc8;}else{_0x37ce3b=0xce;}_0x4906b2[_0x298e('0x1b')](_0x37ce3b);return _0x4906b2[_0x298e('0x22')](_0x298e('0x23'),_0x45dd99+'-'+_0x51b2b7+'/'+_0x35b8ae)['json'](_0x3775d7);}return null;};}function patchUpdates(_0x5cba98){return function(_0x34ec32){try{jsonpatch[_0x298e('0x24')](_0x34ec32,_0x5cba98,!![]);}catch(_0x1a5870){return BPromise[_0x298e('0x25')](_0x1a5870);}return _0x34ec32[_0x298e('0x26')]();};}function saveUpdates(_0x11b756,_0x599782){return function(_0x49c204){if(_0x49c204){return _0x49c204[_0x298e('0x27')](_0x11b756)[_0x298e('0x28')](function(_0x9f0ad6){return _0x9f0ad6;});}return null;};}function removeEntity(_0x58c9da,_0x444955){return function(_0x134499){if(_0x134499){return _0x134499['destroy']()[_0x298e('0x28')](function(){_0x58c9da['status'](0xcc)[_0x298e('0x1c')]();});}};}function handleEntityNotFound(_0x56faf0,_0x269b40){return function(_0x7fa78a){if(!_0x7fa78a){_0x56faf0[_0x298e('0x1a')](0x194);}return _0x7fa78a;};}function handleError(_0x27919e,_0x3c9083){_0x3c9083=_0x3c9083||0x1f4;return function(_0x431d5a){logger[_0x298e('0x29')](_0x431d5a['stack']);if(_0x431d5a[_0x298e('0x2a')]){delete _0x431d5a[_0x298e('0x2a')];}_0x27919e[_0x298e('0x1b')](_0x3c9083)[_0x298e('0x2b')](_0x431d5a);};}exports[_0x298e('0x2c')]=function(_0x207155,_0x557811){var _0x1053bd={},_0x2c32d7={},_0x523cc1={'count':0x0,'rows':[]};var _0x47493c=_[_0x298e('0x2d')](db[_0x298e('0x2e')]['rawAttributes'],function(_0x2825a0){return{'name':_0x2825a0[_0x298e('0x2f')],'type':_0x2825a0['type'][_0x298e('0x30')]};});_0x2c32d7[_0x298e('0x31')]=_['map'](_0x47493c,_0x298e('0x2a'));_0x2c32d7[_0x298e('0x32')]=_[_0x298e('0x33')](_0x207155[_0x298e('0x32')]);_0x2c32d7[_0x298e('0x34')]=_['intersection'](_0x2c32d7[_0x298e('0x31')],_0x2c32d7[_0x298e('0x32')]);_0x1053bd[_0x298e('0x35')]=_[_0x298e('0x36')](_0x2c32d7['model'],qs['fields'](_0x207155[_0x298e('0x32')][_0x298e('0x37')]));_0x1053bd[_0x298e('0x35')]=_0x1053bd['attributes'][_0x298e('0x38')]?_0x1053bd[_0x298e('0x35')]:_0x2c32d7[_0x298e('0x31')];if(!_0x207155['query'][_0x298e('0x39')]('nolimit')){_0x1053bd['limit']=qs[_0x298e('0x20')](_0x207155['query'][_0x298e('0x20')]);_0x1053bd[_0x298e('0x1e')]=qs[_0x298e('0x1e')](_0x207155[_0x298e('0x32')]['offset']);}_0x1053bd['order']=qs[_0x298e('0x3a')](_0x207155[_0x298e('0x32')][_0x298e('0x3a')]);_0x1053bd[_0x298e('0x3b')]=qs['filters'](_[_0x298e('0x3c')](_0x207155[_0x298e('0x32')],_0x2c32d7[_0x298e('0x34')]),_0x47493c);if(_0x207155[_0x298e('0x32')][_0x298e('0x3d')]){_0x1053bd[_0x298e('0x3b')]=_[_0x298e('0x3e')](_0x1053bd[_0x298e('0x3b')],{'$or':_[_0x298e('0x2d')](_0x47493c,function(_0x523c31){if(_0x523c31[_0x298e('0x3f')]!=='VIRTUAL'){var _0xe1d59d={};_0xe1d59d[_0x523c31[_0x298e('0x2a')]]={'$like':'%'+_0x207155[_0x298e('0x32')][_0x298e('0x3d')]+'%'};return _0xe1d59d;}})});}_0x1053bd=_[_0x298e('0x3e')]({},_0x1053bd,_0x207155['options']);var _0x3f6bcd={'where':_0x1053bd[_0x298e('0x3b')]};return db[_0x298e('0x2e')][_0x298e('0x21')](_0x3f6bcd)[_0x298e('0x28')](function(_0x1a1676){_0x523cc1[_0x298e('0x21')]=_0x1a1676;if(_0x207155[_0x298e('0x32')]['includeAll']){_0x1053bd[_0x298e('0x40')]=[{'all':!![]}];}return db[_0x298e('0x2e')][_0x298e('0x41')](_0x1053bd);})[_0x298e('0x28')](function(_0x5d492d){_0x523cc1['rows']=_0x5d492d;return _0x523cc1;})[_0x298e('0x28')](respondWithFilteredResult(_0x557811,_0x1053bd))[_0x298e('0x42')](handleError(_0x557811,null));};exports['show']=function(_0x275a61,_0x4e3468){var _0x40cc80={'raw':!![],'where':{'id':_0x275a61['params']['id']}},_0x563040={};_0x563040[_0x298e('0x31')]=_[_0x298e('0x33')](db['VoiceQueuesLog'][_0x298e('0x43')]);_0x563040[_0x298e('0x32')]=_[_0x298e('0x33')](_0x275a61[_0x298e('0x32')]);_0x563040['filters']=_[_0x298e('0x36')](_0x563040['model'],_0x563040['query']);_0x40cc80[_0x298e('0x35')]=_[_0x298e('0x36')](_0x563040[_0x298e('0x31')],qs['fields'](_0x275a61[_0x298e('0x32')][_0x298e('0x37')]));_0x40cc80['attributes']=_0x40cc80[_0x298e('0x35')][_0x298e('0x38')]?_0x40cc80['attributes']:_0x563040[_0x298e('0x31')];if(_0x275a61[_0x298e('0x32')]['includeAll']){_0x40cc80['include']=[{'all':!![]}];}_0x40cc80=_['merge']({},_0x40cc80,_0x275a61[_0x298e('0x44')]);return db['VoiceQueuesLog'][_0x298e('0x45')](_0x40cc80)[_0x298e('0x28')](handleEntityNotFound(_0x4e3468,null))['then'](respondWithResult(_0x4e3468,null))['catch'](handleError(_0x4e3468,null));};exports[_0x298e('0x46')]=function(_0x432c99,_0x11fe68){return db[_0x298e('0x2e')][_0x298e('0x46')](_0x432c99[_0x298e('0x47')],{})[_0x298e('0x28')](respondWithResult(_0x11fe68,0xc9))[_0x298e('0x42')](handleError(_0x11fe68,null));};exports[_0x298e('0x27')]=function(_0x2e0c42,_0x5ab72e){if(_0x2e0c42[_0x298e('0x47')]['id']){delete _0x2e0c42[_0x298e('0x47')]['id'];}return db['VoiceQueuesLog'][_0x298e('0x45')]({'where':{'id':_0x2e0c42[_0x298e('0x48')]['id']}})[_0x298e('0x28')](handleEntityNotFound(_0x5ab72e,null))[_0x298e('0x28')](saveUpdates(_0x2e0c42[_0x298e('0x47')],null))['then'](respondWithResult(_0x5ab72e,null))[_0x298e('0x42')](handleError(_0x5ab72e,null));};exports[_0x298e('0x49')]=function(_0x177a00,_0x53488f){return db[_0x298e('0x2e')]['find']({'where':{'id':_0x177a00['params']['id']}})[_0x298e('0x28')](handleEntityNotFound(_0x53488f,null))['then'](removeEntity(_0x53488f,null))[_0x298e('0x42')](handleError(_0x53488f,null));}; \ No newline at end of file +var _0x009b=['set','Content-Range','save','update','destroy','then','error','stack','name','index','map','VoiceQueuesLog','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','type','filter','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x009b,0x114));var _0xb009=function(_0x5a5dd3,_0x559080){_0x5a5dd3=_0x5a5dd3-0x0;var _0x841d56=_0x009b[_0x5a5dd3];return _0x841d56;};'use strict';var emlformat=require(_0xb009('0x0'));var rimraf=require(_0xb009('0x1'));var zipdir=require(_0xb009('0x2'));var jsonpatch=require(_0xb009('0x3'));var rp=require(_0xb009('0x4'));var moment=require(_0xb009('0x5'));var BPromise=require(_0xb009('0x6'));var Mustache=require('mustache');var util=require(_0xb009('0x7'));var path=require(_0xb009('0x8'));var sox=require(_0xb009('0x9'));var csv=require('to-csv');var ejs=require(_0xb009('0xa'));var fs=require('fs');var fs_extra=require(_0xb009('0xb'));var _=require(_0xb009('0xc'));var squel=require(_0xb009('0xd'));var crypto=require(_0xb009('0xe'));var jsforce=require(_0xb009('0xf'));var deskjs=require(_0xb009('0x10'));var toCsv=require(_0xb009('0x11'));var querystring=require(_0xb009('0x12'));var Papa=require(_0xb009('0x13'));var Redis=require(_0xb009('0x14'));var authService=require(_0xb009('0x15'));var qs=require(_0xb009('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb009('0x17'))(_0xb009('0x18'));var utils=require(_0xb009('0x19'));var config=require(_0xb009('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xb009('0x1b'))['db'];function respondWithStatusCode(_0x2278e5,_0x8b3f4e){_0x8b3f4e=_0x8b3f4e||0xcc;return function(_0x2a318e){if(_0x2a318e){return _0x2278e5[_0xb009('0x1c')](_0x8b3f4e);}return _0x2278e5[_0xb009('0x1d')](_0x8b3f4e)[_0xb009('0x1e')]();};}function respondWithResult(_0x3038ed,_0x6277e7){_0x6277e7=_0x6277e7||0xc8;return function(_0x45567b){if(_0x45567b){return _0x3038ed[_0xb009('0x1d')](_0x6277e7)[_0xb009('0x1f')](_0x45567b);}};}function respondWithFilteredResult(_0x352714,_0x2efe99){return function(_0x171e81){if(_0x171e81){var _0x10455c=typeof _0x2efe99[_0xb009('0x20')]===_0xb009('0x21')&&typeof _0x2efe99[_0xb009('0x22')]===_0xb009('0x21');var _0x1aea5c=_0x171e81[_0xb009('0x23')];var _0x1801d5=_0x10455c?0x0:_0x2efe99[_0xb009('0x20')];var _0x59fb41=_0x10455c?_0x171e81[_0xb009('0x23')]:_0x2efe99['offset']+_0x2efe99[_0xb009('0x22')];var _0x9437f0;if(_0x59fb41>=_0x1aea5c){_0x59fb41=_0x1aea5c;_0x9437f0=0xc8;}else{_0x9437f0=0xce;}_0x352714[_0xb009('0x1d')](_0x9437f0);return _0x352714[_0xb009('0x24')](_0xb009('0x25'),_0x1801d5+'-'+_0x59fb41+'/'+_0x1aea5c)[_0xb009('0x1f')](_0x171e81);}return null;};}function patchUpdates(_0x2add4c){return function(_0x4017e1){try{jsonpatch['apply'](_0x4017e1,_0x2add4c,!![]);}catch(_0x3a4be9){return BPromise['reject'](_0x3a4be9);}return _0x4017e1[_0xb009('0x26')]();};}function saveUpdates(_0x3ef843,_0x376861){return function(_0x736914){if(_0x736914){return _0x736914[_0xb009('0x27')](_0x3ef843)['then'](function(_0x8b3ef1){return _0x8b3ef1;});}return null;};}function removeEntity(_0x847b36,_0x31d6a0){return function(_0x3a3141){if(_0x3a3141){return _0x3a3141[_0xb009('0x28')]()[_0xb009('0x29')](function(){_0x847b36[_0xb009('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x497c21,_0x564daf){return function(_0x2d99ca){if(!_0x2d99ca){_0x497c21[_0xb009('0x1c')](0x194);}return _0x2d99ca;};}function handleError(_0x5d97e8,_0x3b85e6){_0x3b85e6=_0x3b85e6||0x1f4;return function(_0xf15a9a){logger[_0xb009('0x2a')](_0xf15a9a[_0xb009('0x2b')]);if(_0xf15a9a[_0xb009('0x2c')]){delete _0xf15a9a[_0xb009('0x2c')];}_0x5d97e8[_0xb009('0x1d')](_0x3b85e6)['send'](_0xf15a9a);};}exports[_0xb009('0x2d')]=function(_0xb246b0,_0x5dfa48){var _0x8aa8cf={},_0x2965d0={},_0x3e727b={'count':0x0,'rows':[]};var _0x487330=_[_0xb009('0x2e')](db[_0xb009('0x2f')]['rawAttributes'],function(_0x393b1c){return{'name':_0x393b1c[_0xb009('0x30')],'type':_0x393b1c['type'][_0xb009('0x31')]};});_0x2965d0['model']=_[_0xb009('0x2e')](_0x487330,_0xb009('0x2c'));_0x2965d0[_0xb009('0x32')]=_[_0xb009('0x33')](_0xb246b0[_0xb009('0x32')]);_0x2965d0[_0xb009('0x34')]=_[_0xb009('0x35')](_0x2965d0[_0xb009('0x36')],_0x2965d0['query']);_0x8aa8cf[_0xb009('0x37')]=_[_0xb009('0x35')](_0x2965d0[_0xb009('0x36')],qs[_0xb009('0x38')](_0xb246b0[_0xb009('0x32')][_0xb009('0x38')]));_0x8aa8cf[_0xb009('0x37')]=_0x8aa8cf[_0xb009('0x37')][_0xb009('0x39')]?_0x8aa8cf['attributes']:_0x2965d0[_0xb009('0x36')];if(!_0xb246b0[_0xb009('0x32')][_0xb009('0x3a')](_0xb009('0x3b'))){_0x8aa8cf['limit']=qs[_0xb009('0x22')](_0xb246b0['query'][_0xb009('0x22')]);_0x8aa8cf[_0xb009('0x20')]=qs[_0xb009('0x20')](_0xb246b0['query'][_0xb009('0x20')]);}_0x8aa8cf[_0xb009('0x3c')]=qs['sort'](_0xb246b0[_0xb009('0x32')]['sort']);_0x8aa8cf[_0xb009('0x3d')]=qs[_0xb009('0x34')](_[_0xb009('0x3e')](_0xb246b0[_0xb009('0x32')],_0x2965d0[_0xb009('0x34')]),_0x487330);if(_0xb246b0['query']['filter']){_0x8aa8cf['where']=_[_0xb009('0x3f')](_0x8aa8cf[_0xb009('0x3d')],{'$or':_['map'](_0x487330,function(_0x1d5bd2){if(_0x1d5bd2[_0xb009('0x40')]!=='VIRTUAL'){var _0x4d79a1={};_0x4d79a1[_0x1d5bd2[_0xb009('0x2c')]]={'$like':'%'+_0xb246b0[_0xb009('0x32')][_0xb009('0x41')]+'%'};return _0x4d79a1;}})});}_0x8aa8cf=_['merge']({},_0x8aa8cf,_0xb246b0[_0xb009('0x42')]);var _0xd10bf6={'where':_0x8aa8cf[_0xb009('0x3d')]};return db[_0xb009('0x2f')][_0xb009('0x23')](_0xd10bf6)[_0xb009('0x29')](function(_0x217b29){_0x3e727b['count']=_0x217b29;if(_0xb246b0['query']['includeAll']){_0x8aa8cf[_0xb009('0x43')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xb009('0x44')](_0x8aa8cf);})[_0xb009('0x29')](function(_0x5c03be){_0x3e727b[_0xb009('0x45')]=_0x5c03be;return _0x3e727b;})['then'](respondWithFilteredResult(_0x5dfa48,_0x8aa8cf))[_0xb009('0x46')](handleError(_0x5dfa48,null));};exports[_0xb009('0x47')]=function(_0x3b1ad7,_0x3dc901){var _0x2a4c3d={'raw':!![],'where':{'id':_0x3b1ad7[_0xb009('0x48')]['id']}},_0x4f3a50={};_0x4f3a50[_0xb009('0x36')]=_[_0xb009('0x33')](db[_0xb009('0x2f')][_0xb009('0x49')]);_0x4f3a50[_0xb009('0x32')]=_[_0xb009('0x33')](_0x3b1ad7[_0xb009('0x32')]);_0x4f3a50[_0xb009('0x34')]=_['intersection'](_0x4f3a50[_0xb009('0x36')],_0x4f3a50[_0xb009('0x32')]);_0x2a4c3d[_0xb009('0x37')]=_[_0xb009('0x35')](_0x4f3a50['model'],qs['fields'](_0x3b1ad7['query'][_0xb009('0x38')]));_0x2a4c3d[_0xb009('0x37')]=_0x2a4c3d[_0xb009('0x37')][_0xb009('0x39')]?_0x2a4c3d['attributes']:_0x4f3a50[_0xb009('0x36')];if(_0x3b1ad7[_0xb009('0x32')][_0xb009('0x4a')]){_0x2a4c3d[_0xb009('0x43')]=[{'all':!![]}];}_0x2a4c3d=_['merge']({},_0x2a4c3d,_0x3b1ad7['options']);return db[_0xb009('0x2f')][_0xb009('0x4b')](_0x2a4c3d)[_0xb009('0x29')](handleEntityNotFound(_0x3dc901,null))[_0xb009('0x29')](respondWithResult(_0x3dc901,null))[_0xb009('0x46')](handleError(_0x3dc901,null));};exports[_0xb009('0x4c')]=function(_0x47b686,_0x2c72da){return db['VoiceQueuesLog'][_0xb009('0x4c')](_0x47b686[_0xb009('0x4d')],{})[_0xb009('0x29')](respondWithResult(_0x2c72da,0xc9))[_0xb009('0x46')](handleError(_0x2c72da,null));};exports[_0xb009('0x27')]=function(_0x3bc7ec,_0x4f37d0){if(_0x3bc7ec[_0xb009('0x4d')]['id']){delete _0x3bc7ec['body']['id'];}return db[_0xb009('0x2f')][_0xb009('0x4b')]({'where':{'id':_0x3bc7ec['params']['id']}})['then'](handleEntityNotFound(_0x4f37d0,null))[_0xb009('0x29')](saveUpdates(_0x3bc7ec['body'],null))[_0xb009('0x29')](respondWithResult(_0x4f37d0,null))[_0xb009('0x46')](handleError(_0x4f37d0,null));};exports[_0xb009('0x28')]=function(_0xeb8df4,_0x1da233){return db[_0xb009('0x2f')][_0xb009('0x4b')]({'where':{'id':_0xeb8df4[_0xb009('0x48')]['id']}})[_0xb009('0x29')](handleEntityNotFound(_0x1da233,null))[_0xb009('0x29')](removeEntity(_0x1da233,null))['catch'](handleError(_0x1da233,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 5897385..a7ed0a0 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 _0x79c6=['voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog'];(function(_0xa4a02b,_0x4bc67b){var _0x179ce2=function(_0x481edd){while(--_0x481edd){_0xa4a02b['push'](_0xa4a02b['shift']());}};_0x179ce2(++_0x4bc67b);}(_0x79c6,0x158));var _0x679c=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0x79c6[_0x3e6729];return _0x535bcd;};'use strict';var _=require(_0x679c('0x0'));var util=require(_0x679c('0x1'));var logger=require(_0x679c('0x2'))('api');var moment=require(_0x679c('0x3'));var BPromise=require(_0x679c('0x4'));var rp=require(_0x679c('0x5'));var fs=require('fs');var path=require(_0x679c('0x6'));var rimraf=require(_0x679c('0x7'));var config=require(_0x679c('0x8'));var attributes=require(_0x679c('0x9'));module[_0x679c('0xa')]=function(_0xc5407,_0x41b4b1){return _0xc5407[_0x679c('0xb')](_0x679c('0xc'),attributes,{'tableName':_0x679c('0xd'),'paranoid':![],'indexes':[{'name':_0x679c('0xe'),'fields':[_0x679c('0xf'),_0x679c('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0xcc8d=['define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports'];(function(_0x28d448,_0x427452){var _0xa4e860=function(_0x4201bd){while(--_0x4201bd){_0x28d448['push'](_0x28d448['shift']());}};_0xa4e860(++_0x427452);}(_0xcc8d,0xbb));var _0xdcc8=function(_0x5161fc,_0x37c5f6){_0x5161fc=_0x5161fc-0x0;var _0x38490b=_0xcc8d[_0x5161fc];return _0x38490b;};'use strict';var _=require('lodash');var util=require(_0xdcc8('0x0'));var logger=require(_0xdcc8('0x1'))('api');var moment=require('moment');var BPromise=require(_0xdcc8('0x2'));var rp=require(_0xdcc8('0x3'));var fs=require('fs');var path=require(_0xdcc8('0x4'));var rimraf=require(_0xdcc8('0x5'));var config=require(_0xdcc8('0x6'));var attributes=require(_0xdcc8('0x7'));module[_0xdcc8('0x8')]=function(_0x47b30e,_0x44e0b0){return _0x47b30e[_0xdcc8('0x9')](_0xdcc8('0xa'),attributes,{'tableName':_0xdcc8('0xb'),'paranoid':![],'indexes':[{'name':_0xdcc8('0xc'),'fields':['event',_0xdcc8('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index bfbc8ec..c4b9e02 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 _0xba78=['message','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x34ae53,_0x382394){var _0x4d6fd8=function(_0x3ba293){while(--_0x3ba293){_0x34ae53['push'](_0x34ae53['shift']());}};_0x4d6fd8(++_0x382394);}(_0xba78,0x159));var _0x8ba7=function(_0x4e2bbb,_0x407e05){_0x4e2bbb=_0x4e2bbb-0x0;var _0x4b6e8c=_0xba78[_0x4e2bbb];return _0x4b6e8c;};'use strict';var _=require(_0x8ba7('0x0'));var util=require('util');var moment=require(_0x8ba7('0x1'));var BPromise=require(_0x8ba7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ba7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8ba7('0x4'))(_0x8ba7('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8ba7('0x6')][_0x8ba7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d310e,_0x2c0180,_0x1e33fb){return new BPromise(function(_0x276d74,_0x429d6b){return client[_0x8ba7('0x8')](_0x5d310e,_0x1e33fb)['then'](function(_0xdafa31){logger[_0x8ba7('0x9')](_0x8ba7('0xa'),_0x2c0180,_0x8ba7('0xb'));logger[_0x8ba7('0xc')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2c0180,_0x8ba7('0xb'),JSON['stringify'](_0xdafa31));if(_0xdafa31[_0x8ba7('0xd')]){if(_0xdafa31[_0x8ba7('0xd')][_0x8ba7('0xe')]===0x1f4){logger[_0x8ba7('0xd')](_0x8ba7('0xa'),_0x2c0180,_0xdafa31[_0x8ba7('0xd')][_0x8ba7('0xf')]);return _0x429d6b(_0xdafa31['error'][_0x8ba7('0xf')]);}logger[_0x8ba7('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2c0180,_0xdafa31['error'][_0x8ba7('0xf')]);return _0x276d74(_0xdafa31[_0x8ba7('0xd')][_0x8ba7('0xf')]);}else{logger['info'](_0x8ba7('0xa'),_0x2c0180,_0x8ba7('0xb'));_0x276d74(_0xdafa31[_0x8ba7('0x10')][_0x8ba7('0xf')]);}})[_0x8ba7('0x11')](function(_0x554991){logger[_0x8ba7('0xd')](_0x8ba7('0xa'),_0x2c0180,_0x554991);_0x429d6b(_0x554991);});});} \ No newline at end of file +var _0x24cf=['info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x214747,_0x36dfed){var _0x4a5980=function(_0x15f619){while(--_0x15f619){_0x214747['push'](_0x214747['shift']());}};_0x4a5980(++_0x36dfed);}(_0x24cf,0x1d5));var _0xf24c=function(_0x5e5fa5,_0x38eff8){_0x5e5fa5=_0x5e5fa5-0x0;var _0x4721e2=_0x24cf[_0x5e5fa5];return _0x4721e2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf24c('0x0'));var BPromise=require(_0xf24c('0x1'));var rs=require(_0xf24c('0x2'));var fs=require('fs');var Redis=require(_0xf24c('0x3'));var db=require(_0xf24c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf24c('0x5'))(_0xf24c('0x6'));var config=require(_0xf24c('0x7'));var jayson=require(_0xf24c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5104bd,_0x272d25,_0x596e81){return new BPromise(function(_0x3b7cf1,_0x13163e){return client[_0xf24c('0x9')](_0x5104bd,_0x596e81)[_0xf24c('0xa')](function(_0x4b3ea3){logger[_0xf24c('0xb')](_0xf24c('0xc'),_0x272d25,_0xf24c('0xd'));logger[_0xf24c('0xe')](_0xf24c('0xf'),_0x272d25,_0xf24c('0xd'),JSON['stringify'](_0x4b3ea3));if(_0x4b3ea3[_0xf24c('0x10')]){if(_0x4b3ea3[_0xf24c('0x10')][_0xf24c('0x11')]===0x1f4){logger['error'](_0xf24c('0xc'),_0x272d25,_0x4b3ea3[_0xf24c('0x10')]['message']);return _0x13163e(_0x4b3ea3['error'][_0xf24c('0x12')]);}logger['error'](_0xf24c('0xc'),_0x272d25,_0x4b3ea3[_0xf24c('0x10')]['message']);return _0x3b7cf1(_0x4b3ea3[_0xf24c('0x10')][_0xf24c('0x12')]);}else{logger[_0xf24c('0xb')](_0xf24c('0xc'),_0x272d25,_0xf24c('0xd'));_0x3b7cf1(_0x4b3ea3['result']['message']);}})[_0xf24c('0x13')](function(_0x462801){logger['error'](_0xf24c('0xc'),_0x272d25,_0x462801);_0x13163e(_0x462801);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 59d56de..d674507 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 _0xfed6=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','/:id','util'];(function(_0x270f18,_0x8155e9){var _0x39d745=function(_0x294bdd){while(--_0x294bdd){_0x270f18['push'](_0x270f18['shift']());}};_0x39d745(++_0x8155e9);}(_0xfed6,0x18b));var _0x6fed=function(_0x30ebbd,_0x3f51d8){_0x30ebbd=_0x30ebbd-0x0;var _0xc3b968=_0xfed6[_0x30ebbd];return _0xc3b968;};'use strict';var multer=require('multer');var util=require(_0x6fed('0x0'));var path=require(_0x6fed('0x1'));var timeout=require(_0x6fed('0x2'));var express=require(_0x6fed('0x3'));var router=express['Router']();var fs_extra=require(_0x6fed('0x4'));var auth=require(_0x6fed('0x5'));var interaction=require(_0x6fed('0x6'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x6fed('0x7')]('/',auth[_0x6fed('0x8')](),controller[_0x6fed('0x9')]);router[_0x6fed('0x7')](_0x6fed('0xa'),auth['isAuthenticated'](),controller[_0x6fed('0xb')]);router[_0x6fed('0x7')]('/:id',auth[_0x6fed('0x8')](),controller[_0x6fed('0xc')]);router[_0x6fed('0x7')](_0x6fed('0xd'),auth[_0x6fed('0x8')](),controller[_0x6fed('0xe')]);router[_0x6fed('0x7')]('/:id/downloads',controller[_0x6fed('0xf')]);router[_0x6fed('0x7')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x6fed('0x10')]);router[_0x6fed('0x11')]('/',auth['isAuthenticated'](),controller[_0x6fed('0x12')]);router['post'](_0x6fed('0x13'),auth[_0x6fed('0x8')](),controller[_0x6fed('0x14')]);router['put'](_0x6fed('0x15'),auth[_0x6fed('0x8')](),controller['update']);router['delete'](_0x6fed('0x15'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7622=['/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe','download','/:id/downloads','downloads'];(function(_0x2370e4,_0x1beb51){var _0x5b8561=function(_0x55cc12){while(--_0x55cc12){_0x2370e4['push'](_0x2370e4['shift']());}};_0x5b8561(++_0x1beb51);}(_0x7622,0x190));var _0x2762=function(_0x5b65f7,_0x5b663b){_0x5b65f7=_0x5b65f7-0x0;var _0x59b84f=_0x7622[_0x5b65f7];return _0x59b84f;};'use strict';var multer=require(_0x2762('0x0'));var util=require(_0x2762('0x1'));var path=require(_0x2762('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2762('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2762('0x4'));var interaction=require(_0x2762('0x5'));var config=require(_0x2762('0x6'));var controller=require(_0x2762('0x7'));router[_0x2762('0x8')]('/',auth['isAuthenticated'](),controller[_0x2762('0x9')]);router['get'](_0x2762('0xa'),auth[_0x2762('0xb')](),controller[_0x2762('0xc')]);router[_0x2762('0x8')]('/:id',auth[_0x2762('0xb')](),controller['show']);router[_0x2762('0x8')]('/:id/download',auth[_0x2762('0xb')](),controller[_0x2762('0xd')]);router[_0x2762('0x8')](_0x2762('0xe'),controller[_0x2762('0xf')]);router[_0x2762('0x8')](_0x2762('0x10'),auth['isAuthenticated'](),controller[_0x2762('0x11')]);router[_0x2762('0x12')]('/',auth[_0x2762('0xb')](),controller[_0x2762('0x13')]);router[_0x2762('0x12')](_0x2762('0x10'),auth['isAuthenticated'](),controller[_0x2762('0x14')]);router[_0x2762('0x15')](_0x2762('0x16'),auth[_0x2762('0xb')](),controller[_0x2762('0x17')]);router[_0x2762('0x18')](_0x2762('0x16'),auth[_0x2762('0xb')](),controller['destroy']);module[_0x2762('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index ea4918d..b276c09 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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 6a8093a..767dfcb 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 _0x2097=['nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','ValidationError','filename','extname','unlink','Not\x20found','downloads','sequelize','col','push','$and','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','basename','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','%s.cypher','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','NEW','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','json','reject','update','destroy','then','end','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','model','differenceBy','format','query','filters','intersection','attributes','fields','length'];(function(_0x5e7979,_0x4175c0){var _0x50f569=function(_0x184fa4){while(--_0x184fa4){_0x5e7979['push'](_0x5e7979['shift']());}};_0x50f569(++_0x4175c0);}(_0x2097,0xee));var _0x7209=function(_0x5ff328,_0x57f784){_0x5ff328=_0x5ff328-0x0;var _0xd2cdbb=_0x2097[_0x5ff328];return _0xd2cdbb;};'use strict';var emlformat=require(_0x7209('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7209('0x1'));var jsonpatch=require(_0x7209('0x2'));var rp=require(_0x7209('0x3'));var moment=require(_0x7209('0x4'));var BPromise=require(_0x7209('0x5'));var Mustache=require(_0x7209('0x6'));var util=require('util');var path=require(_0x7209('0x7'));var sox=require(_0x7209('0x8'));var csv=require(_0x7209('0x9'));var ejs=require(_0x7209('0xa'));var fs=require('fs');var fs_extra=require(_0x7209('0xb'));var _=require(_0x7209('0xc'));var squel=require(_0x7209('0xd'));var crypto=require(_0x7209('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7209('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7209('0x10'));var Papa=require(_0x7209('0x11'));var AWS=require(_0x7209('0x12'));var uuidv4=require(_0x7209('0x13'));var Redis=require(_0x7209('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x7209('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7209('0x16'));var logger=require(_0x7209('0x17'))(_0x7209('0x18'));var utils=require('../../config/utils');var config=require(_0x7209('0x19'));var licenseUtil=require(_0x7209('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43b3ad,_0x2d32eb){_0x2d32eb=_0x2d32eb||0xcc;return function(_0x5f04a5){if(_0x5f04a5){return _0x43b3ad[_0x7209('0x1b')](_0x2d32eb);}return _0x43b3ad[_0x7209('0x1c')](_0x2d32eb)['end']();};}function respondWithResult(_0x4f9b1e,_0x1b39be){_0x1b39be=_0x1b39be||0xc8;return function(_0x58cc2c){if(_0x58cc2c){return _0x4f9b1e[_0x7209('0x1c')](_0x1b39be)['json'](_0x58cc2c);}};}function respondWithFilteredResult(_0x449a03,_0x4b370e){return function(_0x29e446){if(_0x29e446){var _0x20375e=typeof _0x4b370e[_0x7209('0x1d')]===_0x7209('0x1e')&&typeof _0x4b370e[_0x7209('0x1f')]===_0x7209('0x1e');var _0x49adee=_0x29e446[_0x7209('0x20')];var _0x53c3ce=_0x20375e?0x0:_0x4b370e[_0x7209('0x1d')];var _0x4bff17=_0x20375e?_0x29e446[_0x7209('0x20')]:_0x4b370e[_0x7209('0x1d')]+_0x4b370e[_0x7209('0x1f')];var _0x4ac8ba;if(_0x4bff17>=_0x49adee){_0x4bff17=_0x49adee;_0x4ac8ba=0xc8;}else{_0x4ac8ba=0xce;}_0x449a03['status'](_0x4ac8ba);return _0x449a03[_0x7209('0x21')]('Content-Range',_0x53c3ce+'-'+_0x4bff17+'/'+_0x49adee)[_0x7209('0x22')](_0x29e446);}return null;};}function patchUpdates(_0x28ff1d){return function(_0x495233){try{jsonpatch['apply'](_0x495233,_0x28ff1d,!![]);}catch(_0x2f196f){return BPromise[_0x7209('0x23')](_0x2f196f);}return _0x495233['save']();};}function saveUpdates(_0x3ab99d,_0x41996b){return function(_0x4fb337){if(_0x4fb337){return _0x4fb337[_0x7209('0x24')](_0x3ab99d)['then'](function(_0x2522c6){return _0x2522c6;});}return null;};}function removeEntity(_0x4345f5,_0x4e5e3c){return function(_0x16be2c){if(_0x16be2c){return _0x16be2c[_0x7209('0x25')]()[_0x7209('0x26')](function(){_0x4345f5[_0x7209('0x1c')](0xcc)[_0x7209('0x27')]();});}};}function handleEntityNotFound(_0x46d5ad,_0x3dd36e){return function(_0x585c31){if(!_0x585c31){_0x46d5ad[_0x7209('0x1b')](0x194);}return _0x585c31;};}function handleError(_0x1f6718,_0x84ebc1){_0x84ebc1=_0x84ebc1||0x1f4;return function(_0x458d25){logger[_0x7209('0x28')](_0x458d25[_0x7209('0x29')]);if(_0x458d25[_0x7209('0x2a')]){delete _0x458d25[_0x7209('0x2a')];}_0x1f6718['status'](_0x84ebc1)[_0x7209('0x2b')](_0x458d25);};}exports[_0x7209('0x2c')]=function(_0x4b53a7,_0x28503b){var _0x186b92={},_0x49091e={},_0x53d685={'count':0x0,'rows':[]};var _0xb1c90c=_[_0x7209('0x2d')](db[_0x7209('0x2e')][_0x7209('0x2f')],function(_0x332e06){return{'name':_0x332e06[_0x7209('0x30')],'type':_0x332e06['type']['key']};});_0x49091e[_0x7209('0x31')]=_[_0x7209('0x32')](_[_0x7209('0x2d')](_0xb1c90c,_0x7209('0x2a')),[_0x7209('0x33')]);_0x49091e[_0x7209('0x34')]=_['keys'](_0x4b53a7[_0x7209('0x34')]);_0x49091e[_0x7209('0x35')]=_[_0x7209('0x36')](_0x49091e[_0x7209('0x31')],_0x49091e[_0x7209('0x34')]);_0x186b92[_0x7209('0x37')]=_['intersection'](_0x49091e[_0x7209('0x31')],qs[_0x7209('0x38')](_0x4b53a7[_0x7209('0x34')]['fields']));_0x186b92['attributes']=_0x186b92[_0x7209('0x37')][_0x7209('0x39')]?_0x186b92[_0x7209('0x37')]:_0x49091e[_0x7209('0x31')];if(!_0x4b53a7[_0x7209('0x34')]['hasOwnProperty'](_0x7209('0x3a'))){_0x186b92[_0x7209('0x1f')]=qs['limit'](_0x4b53a7['query'][_0x7209('0x1f')]);_0x186b92[_0x7209('0x1d')]=qs[_0x7209('0x1d')](_0x4b53a7[_0x7209('0x34')][_0x7209('0x1d')]);}_0x186b92[_0x7209('0x3b')]=qs[_0x7209('0x3c')](_0x4b53a7[_0x7209('0x34')][_0x7209('0x3c')]);_0x186b92[_0x7209('0x3d')]=qs[_0x7209('0x35')](_[_0x7209('0x3e')](_0x4b53a7[_0x7209('0x34')],_0x49091e[_0x7209('0x35')]),_0xb1c90c);if(_0x4b53a7[_0x7209('0x34')][_0x7209('0x3f')]){_0x186b92['where']=_['merge'](_0x186b92[_0x7209('0x3d')],{'$or':_[_0x7209('0x2d')](_0xb1c90c,function(_0x244b4a){if(_0x244b4a[_0x7209('0x40')]!==_0x7209('0x41')){var _0x534271={};_0x534271[_0x244b4a[_0x7209('0x2a')]]={'$like':'%'+_0x4b53a7[_0x7209('0x34')][_0x7209('0x3f')]+'%'};return _0x534271;}})});}_0x186b92=_[_0x7209('0x42')]({},_0x186b92,_0x4b53a7[_0x7209('0x43')]);var _0xaa5702={'where':_0x186b92[_0x7209('0x3d')]};return db['VoiceRecording'][_0x7209('0x20')](_0xaa5702)['then'](function(_0x2275b0){_0x53d685[_0x7209('0x20')]=_0x2275b0;if(_0x4b53a7[_0x7209('0x34')][_0x7209('0x44')]){_0x186b92[_0x7209('0x45')]=[{'all':!![]}];}return db[_0x7209('0x2e')][_0x7209('0x46')](_0x186b92);})[_0x7209('0x26')](function(_0x259f79){_0x53d685[_0x7209('0x47')]=_0x259f79;return _0x53d685;})[_0x7209('0x26')](respondWithFilteredResult(_0x28503b,_0x186b92))[_0x7209('0x48')](handleError(_0x28503b,null));};exports[_0x7209('0x49')]=function(_0x437e65,_0x322358){var _0x23732b={'raw':![],'where':{'id':_0x437e65[_0x7209('0x4a')]['id']}},_0x51edc5={};_0x51edc5[_0x7209('0x31')]=_[_0x7209('0x4b')](db[_0x7209('0x2e')][_0x7209('0x2f')]);_0x51edc5[_0x7209('0x34')]=_[_0x7209('0x4b')](_0x437e65[_0x7209('0x34')]);_0x51edc5[_0x7209('0x35')]=_[_0x7209('0x36')](_0x51edc5[_0x7209('0x31')],_0x51edc5[_0x7209('0x34')]);_0x23732b[_0x7209('0x37')]=_[_0x7209('0x36')](_0x51edc5['model'],qs[_0x7209('0x38')](_0x437e65[_0x7209('0x34')][_0x7209('0x38')]));_0x23732b[_0x7209('0x37')]=_0x23732b[_0x7209('0x37')][_0x7209('0x39')]?_0x23732b['attributes']:_0x51edc5[_0x7209('0x31')];if(_0x437e65[_0x7209('0x34')][_0x7209('0x44')]){_0x23732b[_0x7209('0x45')]=[{'all':!![]}];}_0x23732b=_[_0x7209('0x42')]({},_0x23732b,_0x437e65[_0x7209('0x43')]);return db[_0x7209('0x2e')]['find'](_0x23732b)[_0x7209('0x26')](handleEntityNotFound(_0x322358,null))[_0x7209('0x26')](respondWithResult(_0x322358,null))[_0x7209('0x48')](handleError(_0x322358,null));};exports[_0x7209('0x4c')]=function(_0x569700,_0x47eebc){return db[_0x7209('0x2e')][_0x7209('0x4c')](_0x569700['body'],{})[_0x7209('0x26')](respondWithResult(_0x47eebc,0xc9))[_0x7209('0x48')](handleError(_0x47eebc,null));};exports[_0x7209('0x24')]=function(_0x488040,_0x59d975){if(_0x488040[_0x7209('0x4d')]['id']){delete _0x488040[_0x7209('0x4d')]['id'];}return db['VoiceRecording'][_0x7209('0x4e')]({'where':{'id':_0x488040[_0x7209('0x4a')]['id']}})[_0x7209('0x26')](handleEntityNotFound(_0x59d975,null))[_0x7209('0x26')](saveUpdates(_0x488040[_0x7209('0x4d')],null))[_0x7209('0x26')](respondWithResult(_0x59d975,null))['catch'](handleError(_0x59d975,null));};exports[_0x7209('0x4f')]=function(_0xb5eebc,_0x1bc916){return db[_0x7209('0x2e')][_0x7209('0x4f')]()[_0x7209('0x26')](respondWithResult(_0x1bc916,null))[_0x7209('0x48')](handleError(_0x1bc916,null));};exports[_0x7209('0x50')]=function(_0x32f274,_0x343ec1,_0x26c6bf){var _0x5e8402=require(_0x7209('0x51'));var _0x139fb5=![];var _0x5a7ca4={};if(_0x32f274[_0x7209('0x34')]['type']&&_0x32f274['query'][_0x7209('0x40')]===_0x7209('0x52')){_0x5a7ca4[_0x7209('0x52')]=_0x32f274[_0x7209('0x4a')]['id'];}else{_0x5a7ca4['id']=_0x32f274[_0x7209('0x4a')]['id'];}return db[_0x7209('0x2e')]['find']({'where':_0x5a7ca4,'attributes':['id','value'],'raw':!![]})[_0x7209('0x26')](handleEntityNotFound(_0x343ec1,null))[_0x7209('0x26')](function(_0x23e8af){if(_0x23e8af){var _0x5d2370=_0x23e8af[_0x7209('0x53')];var _0x5cb17d=util[_0x7209('0x33')]('%s.cypher',_0x5d2370);if(fs[_0x7209('0x54')](_0x5cb17d)){_0x139fb5=!![];return _0x5e8402[_0x7209('0x55')](_0x5cb17d,_0x5d2370,config['secrets']['recording'])[_0x7209('0x26')](function(){return _0x23e8af;});}return _0x23e8af;}})['then'](function(_0x3e1bb6){if(_0x3e1bb6){var _0x5c5f8a=_0x3e1bb6[_0x7209('0x53')];if(!fs[_0x7209('0x54')](_0x5c5f8a)){throw new db['Sequelize'][(_0x7209('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x3e1bb6[_0x7209('0x57')]){return _0x343ec1[_0x7209('0x50')](_0x5c5f8a,_0x3e1bb6[_0x7209('0x57')]+path[_0x7209('0x58')](_0x5c5f8a),function(){if(_0x139fb5){fs[_0x7209('0x59')](_0x5c5f8a);}});}else{return _0x343ec1['download'](_0x5c5f8a,function(_0x3d72ca){if(_0x139fb5){fs['unlink'](_0x5c5f8a);}});}}})['catch'](function(_0x4904d2){if(_0x4904d2['message']==='VoiceRecording\x20not\x20found'){_0x343ec1[_0x7209('0x1c')](0x194)[_0x7209('0x2b')](_0x7209('0x5a'));}else{return handleError(_0x343ec1,null);}});};exports[_0x7209('0x5b')]=function(_0x5c3fe8,_0x33c08a,_0x55b6d8){var _0x4efd2f=require(_0x7209('0x51'));var _0x4a39c7=![];var _0x2a56b8={'$and':[db['sequelize'][_0x7209('0x3d')](db['sequelize']['fn']('MD5',db[_0x7209('0x5c')][_0x7209('0x5d')](_0x7209('0x52'))),_0x5c3fe8[_0x7209('0x34')]['token'])]};if(_0x5c3fe8[_0x7209('0x34')][_0x7209('0x40')]&&_0x5c3fe8[_0x7209('0x34')][_0x7209('0x40')]===_0x7209('0x52')){_0x2a56b8['$and'][_0x7209('0x5e')]({'uniqueid':_0x5c3fe8[_0x7209('0x4a')]['id']});}else{_0x2a56b8[_0x7209('0x5f')][_0x7209('0x5e')]({'id':_0x5c3fe8[_0x7209('0x4a')]['id']});}return db[_0x7209('0x2e')][_0x7209('0x4e')]({'where':_0x2a56b8,'attributes':['id',_0x7209('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x33c08a,null))[_0x7209('0x26')](function(_0x1bfefe){if(_0x1bfefe){var _0x1fb1ba=util['format']('%s.cypher',_0x1bfefe['value']);if(fs['existsSync'](_0x1fb1ba)){_0x4a39c7=!![];return _0x4efd2f[_0x7209('0x55')](_0x1fb1ba,_0x1bfefe[_0x7209('0x53')],config[_0x7209('0x60')][_0x7209('0x61')])['then'](function(){return _0x1bfefe;});}return _0x1bfefe;}})['then'](function(_0x352d47){if(_0x352d47){if(!fs['existsSync'](_0x352d47['value'])){throw new db[(_0x7209('0x62'))][(_0x7209('0x56'))](_0x7209('0x63'));}if(_0x352d47[_0x7209('0x57')]){return _0x33c08a[_0x7209('0x50')](_0x352d47['value'],_0x352d47['filename']+path[_0x7209('0x58')](_0x352d47['value']),function(){if(_0x4a39c7){fs[_0x7209('0x59')](_0x352d47[_0x7209('0x53')]);}});}else{return _0x33c08a[_0x7209('0x50')](_0x352d47[_0x7209('0x53')],function(_0x53250b){if(_0x4a39c7){fs['unlink'](_0x352d47[_0x7209('0x53')]);}});}}})[_0x7209('0x48')](handleError(_0x33c08a,null));};exports[_0x7209('0x25')]=function(_0x4afe22,_0x5b34e2){return db[_0x7209('0x2e')][_0x7209('0x4e')]({'where':{'id':_0x4afe22[_0x7209('0x4a')]['id']}})[_0x7209('0x26')](function(_0x1f2a5f){if(_['isNil'](_0x1f2a5f)){throw new ReferenceError(_0x7209('0x64'));}return _0x1f2a5f;})[_0x7209('0x26')](function(_0x32f404){var _0x1487ca=_0x32f404[_0x7209('0x53')];logger['info'](_0x7209('0x65'),_0x1487ca);if(!_[_0x7209('0x66')](_0x32f404['value'])&&fs[_0x7209('0x54')](_0x1487ca)){logger[_0x7209('0x67')](_0x7209('0x68')+_0x1487ca+_0x7209('0x69'));fs[_0x7209('0x6a')](_0x1487ca);}_0x1487ca=_0x1487ca+_0x7209('0x6b');if(!_['isNil'](_0x32f404[_0x7209('0x53')])&&fs[_0x7209('0x54')](_0x1487ca)){logger['info']('File:\x20\x22'+_0x1487ca+_0x7209('0x69'));fs['unlinkSync'](_0x1487ca);}return _0x32f404;})[_0x7209('0x26')](function(_0xe99187){if(!_0xe99187)throw new InternalError();return _0xe99187['destroy']();})[_0x7209('0x26')](function(){_0x5b34e2['status'](0xcc)[_0x7209('0x27')]();})['catch'](handleError(_0x5b34e2,null));};function getBucketslist(_0x36e878,_0x236ca4,_0x220e76){return new Promise(function(_0x5e2a76,_0x4cbe69){var _0x4ce024=new AWS['S3']({'accessKeyId':_0x236ca4,'secretAccessKey':_0x36e878,'region':_0x220e76});_0x4ce024[_0x7209('0x6c')]({},function(_0x571551,_0x3d5463){if(_0x571551){return _0x4cbe69(_0x571551);}else{return _0x5e2a76(_0x3d5463);}});});}function createBucket(_0x223b96,_0x5847dc,_0x530d83,_0x15f9fb){return new Promise(function(_0x5cf6b2,_0x37735e){var _0x2fa5c9=new AWS['S3']({'accessKeyId':_0x5847dc,'secretAccessKey':_0x223b96,'region':_0x530d83});_0x2fa5c9[_0x7209('0x6d')]({'Bucket':_0x15f9fb},function(_0x145ff3,_0x2bc397){if(_0x145ff3){return _0x37735e(_0x145ff3);}else{return _0x5cf6b2(_0x2bc397);}});});}function uploadFile(_0x2962e2,_0x3c9524,_0x3fb9f6,_0x419500,_0x1368ba,_0x451f61){return new Promise(function(_0x119ce2,_0x550ad9){var _0x486e17=new AWS['S3']({'accessKeyId':_0x3c9524,'secretAccessKey':_0x2962e2,'region':_0x3fb9f6});_0x486e17['upload']({'Bucket':_0x419500,'Key':_0x1368ba,'Body':_0x451f61},function(_0x5273f6,_0x478b88){if(_0x5273f6){return _0x550ad9(_0x5273f6);}else{return _0x119ce2(_0x478b88);}});});}function startTranscribe(_0x5f45d3,_0x525291,_0x2c482f,_0x4c45a4,_0x8b8039,_0x7f1f6a){return new Promise(function(_0x36ea65,_0x284a6a){var _0xfe7a10=new AWS[(_0x7209('0x6e'))]({'accessKeyId':_0x525291,'secretAccessKey':_0x5f45d3,'region':_0x2c482f});_0xfe7a10['startTranscriptionJob']({'TranscriptionJobName':_0x4c45a4,'LanguageCode':_0x8b8039,'Media':{'MediaFileUri':_0x7f1f6a}},function(_0x5ca7e7,_0x15fe5c){if(_0x5ca7e7){return _0x284a6a(_0x5ca7e7);}else{return _0x36ea65(_0x15fe5c);}});});}function transcribe(_0x2f381e,_0x4eea57,_0x42db2b,_0x5613ca,_0xe37e40,_0x342fe8,_0x1f7259){return new Promise(function(_0x287d3d,_0x2fc2f6){var _0x3b5605={};logger[_0x7209('0x67')](util[_0x7209('0x33')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x2f381e,_0xe37e40));return uploadFile(_0x4eea57,_0x42db2b,_0x5613ca,_0xe37e40,path[_0x7209('0x6f')](_0x342fe8),fs['readFileSync'](_0x342fe8))[_0x7209('0x26')](function(_0x325ce2){logger[_0x7209('0x67')](util[_0x7209('0x33')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x2f381e,_0xe37e40,_0x325ce2[_0x7209('0x70')]));_0x3b5605[_0x7209('0x71')]=_0x325ce2['Bucket'];_0x3b5605['location']=_0x325ce2[_0x7209('0x70')];logger[_0x7209('0x67')](util[_0x7209('0x33')](_0x7209('0x72'),_0x2f381e));return startTranscribe(_0x4eea57,_0x42db2b,_0x5613ca,uuidv4(),_0x1f7259,_0x325ce2[_0x7209('0x70')]);})[_0x7209('0x26')](function(_0x362ff0){logger[_0x7209('0x67')](util[_0x7209('0x33')](_0x7209('0x73'),_0x2f381e,_0x362ff0[_0x7209('0x74')]['TranscriptionJobName']));_0x3b5605[_0x7209('0x75')]=_0x362ff0[_0x7209('0x74')]['TranscriptionJobName'];_0x3b5605['transcribeStatus']=_0x362ff0['TranscriptionJob'][_0x7209('0x76')];return _0x287d3d(_0x3b5605);})[_0x7209('0x48')](function(_0x31ce45){return _0x2fc2f6(_0x31ce45);});});}exports[_0x7209('0x77')]=function(_0x47e909,_0xbd0726,_0x6bfd27){var _0xce2fd;var _0x2bf1fd;var _0x44d42d;var _0x14d0fd=require(_0x7209('0x51'));return db[_0x7209('0x2e')][_0x7209('0x78')]({'where':{'id':_0x47e909['params']['id']}})[_0x7209('0x26')](function(_0x4a586e){if(_0x4a586e){var _0x2026da=util[_0x7209('0x33')](_0x7209('0x79'),_0x4a586e[_0x7209('0x53')]);if(fs['existsSync'](_0x2026da)){cypher=!![];return _0x14d0fd['decryptFile'](_0x2026da,_0x4a586e[_0x7209('0x53')],config[_0x7209('0x60')][_0x7209('0x61')])[_0x7209('0x26')](function(){return _0x4a586e;});}return _0x4a586e;}})[_0x7209('0x26')](function(_0x10e095){if(!_0x10e095){throw new db[(_0x7209('0x62'))][(_0x7209('0x56'))](_0x7209('0x7a'));}_0x2bf1fd=_0x10e095;return db[_0x7209('0x7b')][_0x7209('0x78')]({'where':{'id':0x1}});})[_0x7209('0x26')](handleEntityNotFound(_0xbd0726,null))[_0x7209('0x26')](function(_0x49ce63){if(_0x49ce63){_0xce2fd=_0x49ce63;if(!_0xce2fd[_0x7209('0x7c')]||!_0xce2fd[_0x7209('0x7d')]||!_0xce2fd[_0x7209('0x7e')]||!_0xce2fd[_0x7209('0x7f')]||!_0xce2fd['bucket']){throw new db[(_0x7209('0x62'))]['ValidationError'](_0x7209('0x80'));}if(_0x47e909[_0x7209('0x4d')]['runSentiment']&&(!_0xce2fd[_0x7209('0x81')]||!_0xce2fd[_0x7209('0x82')]||!_0xce2fd[_0x7209('0x83')]||!_0xce2fd[_0x7209('0x7f')]||!_0xce2fd[_0x7209('0x71')])){throw new db[(_0x7209('0x62'))][(_0x7209('0x56'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x7209('0x84')][_0x7209('0x78')]({'where':{'id':_0xce2fd['transcribeAccountId']}});}})[_0x7209('0x26')](function(_0x5da2a9){if(!_0x5da2a9){throw new db[(_0x7209('0x62'))][(_0x7209('0x56'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5da2a9[_0x7209('0x85')]||!_0x5da2a9[_0x7209('0x86')]){throw new db[(_0x7209('0x62'))][(_0x7209('0x56'))](_0x7209('0x87'));}_0x44d42d=_0x5da2a9;return getBucketslist(_0x44d42d[_0x7209('0x85')],_0x44d42d[_0x7209('0x86')],_0xce2fd[_0x7209('0x7e')]);})['then'](function(_0x15629c){if(_0x15629c&&_0x15629c['Buckets']){var _0x4ec07d=_['find'](_0x15629c[_0x7209('0x88')],function(_0x14425f){return _0x14425f[_0x7209('0x89')]===_0xce2fd[_0x7209('0x71')];});if(!_0x4ec07d){logger[_0x7209('0x67')](util[_0x7209('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x47e909['params']['id'],_0xce2fd['bucket']));return createBucket(_0x44d42d[_0x7209('0x85')],_0x44d42d[_0x7209('0x86')],_0xce2fd[_0x7209('0x7e')],_0xce2fd['bucket']);}logger[_0x7209('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x47e909[_0x7209('0x4a')]['id'],_0xce2fd['bucket']));return;}})['then'](function(_0x58b34b){if(_0x2bf1fd['transcribeStatus']===_0x7209('0x8a')){return transcribe(_0x47e909['params']['id'],_0x44d42d[_0x7209('0x85')],_0x44d42d[_0x7209('0x86')],_0xce2fd[_0x7209('0x7e')],_0xce2fd[_0x7209('0x71')],_0x2bf1fd['value'],_0xce2fd[_0x7209('0x7f')]);}else{logger[_0x7209('0x67')](util[_0x7209('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x47e909['params']['id']));return{'transcribeStatus':_0x7209('0x8b')};}})[_0x7209('0x26')](function(_0x81c895){if(_0x81c895){_0x81c895[_0x7209('0x8c')]=_0x47e909[_0x7209('0x4d')][_0x7209('0x8d')];return _0x2bf1fd[_0x7209('0x8e')](_0x81c895);}})['then'](respondWithResult(_0xbd0726,null))['catch'](handleError(_0xbd0726,null));};function writeFile(_0x4742d2,_0x337121){return new Promise(function(_0x6376ac,_0x3ea637){fs[_0x7209('0x8f')](_0x337121,_0x4742d2,function(_0x27e88d,_0x4b7382){if(_0x27e88d){return _0x3ea637(_0x27e88d);}else{return _0x6376ac(_0x4b7382);}});});}exports[_0x7209('0x90')]=function(_0x510a5a,_0x18c0a1,_0xc954c4){return db[_0x7209('0x2e')][_0x7209('0x78')]({'where':{'id':_0x510a5a['params']['id']}})[_0x7209('0x26')](handleEntityNotFound(_0x18c0a1))[_0x7209('0x26')](function(_0x527daf){if(_0x527daf&&_0x527daf[_0x7209('0x91')]){var _0x8bc39b=_0x527daf[_0x7209('0x91')];var _0x1651bf=config[_0x7209('0x92')]+'/server/files/transcribes/transcribe_'+_0x527daf['id']+_0x7209('0x93');if(fs[_0x7209('0x54')](_0x1651bf)){return _0x1651bf;}return writeFile(_0x8bc39b,_0x1651bf)['then'](function(){return _0x1651bf;});}else{throw new db[(_0x7209('0x62'))][(_0x7209('0x56'))]('Transcript\x20not\x20available');}})[_0x7209('0x26')](function(_0x3de7cc){return _0x18c0a1[_0x7209('0x50')](_0x3de7cc);})[_0x7209('0x48')](handleError(_0x18c0a1));}; \ No newline at end of file +var _0x8cd3=['MD5','col','push','$and','destroy','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','language','Sequelize','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','stack','name','index','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','download','../../components/encryptor','type','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','send','Not\x20found','downloads','sequelize'];(function(_0x1d8a69,_0x5eee8a){var _0x275297=function(_0x52771c){while(--_0x52771c){_0x1d8a69['push'](_0x1d8a69['shift']());}};_0x275297(++_0x5eee8a);}(_0x8cd3,0x168));var _0x38cd=function(_0x467fc7,_0x30674a){_0x467fc7=_0x467fc7-0x0;var _0x15bcd3=_0x8cd3[_0x467fc7];return _0x15bcd3;};'use strict';var emlformat=require(_0x38cd('0x0'));var rimraf=require(_0x38cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x38cd('0x2'));var BPromise=require(_0x38cd('0x3'));var Mustache=require(_0x38cd('0x4'));var util=require(_0x38cd('0x5'));var path=require(_0x38cd('0x6'));var sox=require(_0x38cd('0x7'));var csv=require(_0x38cd('0x8'));var ejs=require(_0x38cd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x38cd('0xa'));var crypto=require(_0x38cd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x38cd('0xc'));var toCsv=require(_0x38cd('0x8'));var querystring=require(_0x38cd('0xd'));var Papa=require(_0x38cd('0xe'));var AWS=require(_0x38cd('0xf'));var uuidv4=require(_0x38cd('0x10'));var Redis=require('ioredis');var authService=require(_0x38cd('0x11'));var qs=require(_0x38cd('0x12'));var as=require(_0x38cd('0x13'));var hardwareService=require(_0x38cd('0x14'));var logger=require(_0x38cd('0x15'))(_0x38cd('0x16'));var utils=require(_0x38cd('0x17'));var config=require(_0x38cd('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x38cd('0x19'))['db'];function respondWithStatusCode(_0x179353,_0x20bb23){_0x20bb23=_0x20bb23||0xcc;return function(_0x5636ff){if(_0x5636ff){return _0x179353[_0x38cd('0x1a')](_0x20bb23);}return _0x179353[_0x38cd('0x1b')](_0x20bb23)[_0x38cd('0x1c')]();};}function respondWithResult(_0x111d0d,_0x47ccf6){_0x47ccf6=_0x47ccf6||0xc8;return function(_0x3698df){if(_0x3698df){return _0x111d0d['status'](_0x47ccf6)['json'](_0x3698df);}};}function respondWithFilteredResult(_0x2072a9,_0x3a4640){return function(_0x4d016c){if(_0x4d016c){var _0x2b2d01=typeof _0x3a4640[_0x38cd('0x1d')]===_0x38cd('0x1e')&&typeof _0x3a4640[_0x38cd('0x1f')]===_0x38cd('0x1e');var _0x15e21b=_0x4d016c[_0x38cd('0x20')];var _0x295053=_0x2b2d01?0x0:_0x3a4640[_0x38cd('0x1d')];var _0x285775=_0x2b2d01?_0x4d016c[_0x38cd('0x20')]:_0x3a4640[_0x38cd('0x1d')]+_0x3a4640['limit'];var _0x4a9f08;if(_0x285775>=_0x15e21b){_0x285775=_0x15e21b;_0x4a9f08=0xc8;}else{_0x4a9f08=0xce;}_0x2072a9[_0x38cd('0x1b')](_0x4a9f08);return _0x2072a9[_0x38cd('0x21')](_0x38cd('0x22'),_0x295053+'-'+_0x285775+'/'+_0x15e21b)[_0x38cd('0x23')](_0x4d016c);}return null;};}function patchUpdates(_0x5c63cc){return function(_0x34f35c){try{jsonpatch[_0x38cd('0x24')](_0x34f35c,_0x5c63cc,!![]);}catch(_0x5a3916){return BPromise['reject'](_0x5a3916);}return _0x34f35c[_0x38cd('0x25')]();};}function saveUpdates(_0x342d18,_0x3c9958){return function(_0x37ba6f){if(_0x37ba6f){return _0x37ba6f[_0x38cd('0x26')](_0x342d18)[_0x38cd('0x27')](function(_0x456777){return _0x456777;});}return null;};}function removeEntity(_0x549caf,_0x3f23b8){return function(_0x2f48ff){if(_0x2f48ff){return _0x2f48ff['destroy']()[_0x38cd('0x27')](function(){_0x549caf[_0x38cd('0x1b')](0xcc)[_0x38cd('0x1c')]();});}};}function handleEntityNotFound(_0x115f9e,_0x505606){return function(_0x515ff5){if(!_0x515ff5){_0x115f9e['sendStatus'](0x194);}return _0x515ff5;};}function handleError(_0x1a8818,_0x17d5c4){_0x17d5c4=_0x17d5c4||0x1f4;return function(_0x4e464f){logger['error'](_0x4e464f[_0x38cd('0x28')]);if(_0x4e464f[_0x38cd('0x29')]){delete _0x4e464f['name'];}_0x1a8818[_0x38cd('0x1b')](_0x17d5c4)['send'](_0x4e464f);};}exports[_0x38cd('0x2a')]=function(_0x563f80,_0x385098){var _0x44600c={},_0xff3ef9={},_0x2fe41e={'count':0x0,'rows':[]};var _0x55d49c=_['map'](db[_0x38cd('0x2b')][_0x38cd('0x2c')],function(_0x19f7d5){return{'name':_0x19f7d5[_0x38cd('0x2d')],'type':_0x19f7d5['type'][_0x38cd('0x2e')]};});_0xff3ef9[_0x38cd('0x2f')]=_[_0x38cd('0x30')](_[_0x38cd('0x31')](_0x55d49c,'name'),['format']);_0xff3ef9[_0x38cd('0x32')]=_[_0x38cd('0x33')](_0x563f80['query']);_0xff3ef9[_0x38cd('0x34')]=_[_0x38cd('0x35')](_0xff3ef9[_0x38cd('0x2f')],_0xff3ef9[_0x38cd('0x32')]);_0x44600c[_0x38cd('0x36')]=_[_0x38cd('0x35')](_0xff3ef9[_0x38cd('0x2f')],qs[_0x38cd('0x37')](_0x563f80[_0x38cd('0x32')][_0x38cd('0x37')]));_0x44600c[_0x38cd('0x36')]=_0x44600c[_0x38cd('0x36')][_0x38cd('0x38')]?_0x44600c[_0x38cd('0x36')]:_0xff3ef9['model'];if(!_0x563f80['query']['hasOwnProperty']('nolimit')){_0x44600c[_0x38cd('0x1f')]=qs['limit'](_0x563f80[_0x38cd('0x32')]['limit']);_0x44600c[_0x38cd('0x1d')]=qs['offset'](_0x563f80[_0x38cd('0x32')]['offset']);}_0x44600c[_0x38cd('0x39')]=qs['sort'](_0x563f80[_0x38cd('0x32')][_0x38cd('0x3a')]);_0x44600c['where']=qs[_0x38cd('0x34')](_[_0x38cd('0x3b')](_0x563f80[_0x38cd('0x32')],_0xff3ef9['filters']),_0x55d49c);if(_0x563f80[_0x38cd('0x32')][_0x38cd('0x3c')]){_0x44600c['where']=_['merge'](_0x44600c[_0x38cd('0x3d')],{'$or':_[_0x38cd('0x31')](_0x55d49c,function(_0x3926ef){if(_0x3926ef['type']!==_0x38cd('0x3e')){var _0x54d573={};_0x54d573[_0x3926ef[_0x38cd('0x29')]]={'$like':'%'+_0x563f80[_0x38cd('0x32')][_0x38cd('0x3c')]+'%'};return _0x54d573;}})});}_0x44600c=_[_0x38cd('0x3f')]({},_0x44600c,_0x563f80[_0x38cd('0x40')]);var _0xf5146c={'where':_0x44600c[_0x38cd('0x3d')]};return db[_0x38cd('0x2b')]['count'](_0xf5146c)[_0x38cd('0x27')](function(_0x2a0fe8){_0x2fe41e[_0x38cd('0x20')]=_0x2a0fe8;if(_0x563f80['query']['includeAll']){_0x44600c[_0x38cd('0x41')]=[{'all':!![]}];}return db[_0x38cd('0x2b')][_0x38cd('0x42')](_0x44600c);})[_0x38cd('0x27')](function(_0x4785d5){_0x2fe41e[_0x38cd('0x43')]=_0x4785d5;return _0x2fe41e;})['then'](respondWithFilteredResult(_0x385098,_0x44600c))[_0x38cd('0x44')](handleError(_0x385098,null));};exports[_0x38cd('0x45')]=function(_0x18df5d,_0x4f94d7){var _0x23d800={'raw':![],'where':{'id':_0x18df5d['params']['id']}},_0x5ebd1f={};_0x5ebd1f['model']=_[_0x38cd('0x33')](db[_0x38cd('0x2b')]['rawAttributes']);_0x5ebd1f[_0x38cd('0x32')]=_[_0x38cd('0x33')](_0x18df5d[_0x38cd('0x32')]);_0x5ebd1f[_0x38cd('0x34')]=_[_0x38cd('0x35')](_0x5ebd1f[_0x38cd('0x2f')],_0x5ebd1f[_0x38cd('0x32')]);_0x23d800[_0x38cd('0x36')]=_[_0x38cd('0x35')](_0x5ebd1f[_0x38cd('0x2f')],qs[_0x38cd('0x37')](_0x18df5d[_0x38cd('0x32')][_0x38cd('0x37')]));_0x23d800[_0x38cd('0x36')]=_0x23d800[_0x38cd('0x36')][_0x38cd('0x38')]?_0x23d800['attributes']:_0x5ebd1f[_0x38cd('0x2f')];if(_0x18df5d[_0x38cd('0x32')][_0x38cd('0x46')]){_0x23d800[_0x38cd('0x41')]=[{'all':!![]}];}_0x23d800=_[_0x38cd('0x3f')]({},_0x23d800,_0x18df5d[_0x38cd('0x40')]);return db['VoiceRecording'][_0x38cd('0x47')](_0x23d800)[_0x38cd('0x27')](handleEntityNotFound(_0x4f94d7,null))[_0x38cd('0x27')](respondWithResult(_0x4f94d7,null))['catch'](handleError(_0x4f94d7,null));};exports['create']=function(_0x544573,_0x4fbb9a){return db['VoiceRecording'][_0x38cd('0x48')](_0x544573[_0x38cd('0x49')],{})[_0x38cd('0x27')](respondWithResult(_0x4fbb9a,0xc9))[_0x38cd('0x44')](handleError(_0x4fbb9a,null));};exports[_0x38cd('0x26')]=function(_0x4768b2,_0x918ef8){if(_0x4768b2[_0x38cd('0x49')]['id']){delete _0x4768b2['body']['id'];}return db[_0x38cd('0x2b')]['find']({'where':{'id':_0x4768b2[_0x38cd('0x4a')]['id']}})[_0x38cd('0x27')](handleEntityNotFound(_0x918ef8,null))['then'](saveUpdates(_0x4768b2['body'],null))[_0x38cd('0x27')](respondWithResult(_0x918ef8,null))[_0x38cd('0x44')](handleError(_0x918ef8,null));};exports[_0x38cd('0x4b')]=function(_0x3e6ce0,_0x5ef02d){return db[_0x38cd('0x2b')][_0x38cd('0x4b')]()[_0x38cd('0x27')](respondWithResult(_0x5ef02d,null))['catch'](handleError(_0x5ef02d,null));};exports[_0x38cd('0x4c')]=function(_0x1c1bd7,_0x3a38c9,_0x43c59b){var _0xa988fd=require(_0x38cd('0x4d'));var _0x3de62b=![];var _0x15860b={};if(_0x1c1bd7[_0x38cd('0x32')][_0x38cd('0x4e')]&&_0x1c1bd7['query'][_0x38cd('0x4e')]===_0x38cd('0x4f')){_0x15860b[_0x38cd('0x4f')]=_0x1c1bd7[_0x38cd('0x4a')]['id'];}else{_0x15860b['id']=_0x1c1bd7[_0x38cd('0x4a')]['id'];}return db['VoiceRecording'][_0x38cd('0x47')]({'where':_0x15860b,'attributes':['id',_0x38cd('0x50')],'raw':!![]})[_0x38cd('0x27')](handleEntityNotFound(_0x3a38c9,null))[_0x38cd('0x27')](function(_0x3514b7){if(_0x3514b7){var _0x2e4a22=_0x3514b7[_0x38cd('0x50')];var _0xbfc1d8=util[_0x38cd('0x51')](_0x38cd('0x52'),_0x2e4a22);if(fs[_0x38cd('0x53')](_0xbfc1d8)){_0x3de62b=!![];return _0xa988fd[_0x38cd('0x54')](_0xbfc1d8,_0x2e4a22,config[_0x38cd('0x55')][_0x38cd('0x56')])[_0x38cd('0x27')](function(){return _0x3514b7;});}return _0x3514b7;}})[_0x38cd('0x27')](function(_0x3fbdd7){if(_0x3fbdd7){var _0x42c1f8=_0x3fbdd7['value'];if(!fs[_0x38cd('0x53')](_0x42c1f8)){throw new db['Sequelize'][(_0x38cd('0x57'))](_0x38cd('0x58'));}if(_0x3fbdd7[_0x38cd('0x59')]){return _0x3a38c9[_0x38cd('0x4c')](_0x42c1f8,_0x3fbdd7[_0x38cd('0x59')]+path[_0x38cd('0x5a')](_0x42c1f8),function(){if(_0x3de62b){fs[_0x38cd('0x5b')](_0x42c1f8);}});}else{return _0x3a38c9[_0x38cd('0x4c')](_0x42c1f8,function(_0x3a5b53){if(_0x3de62b){fs[_0x38cd('0x5b')](_0x42c1f8);}});}}})[_0x38cd('0x44')](function(_0x23f92c){if(_0x23f92c['message']==='VoiceRecording\x20not\x20found'){_0x3a38c9['status'](0x194)[_0x38cd('0x5c')](_0x38cd('0x5d'));}else{return handleError(_0x3a38c9,null);}});};exports[_0x38cd('0x5e')]=function(_0x204769,_0x310fa5,_0x340504){var _0x3a5d43=require('../../components/encryptor');var _0x2a27f4=![];var _0x507603={'$and':[db[_0x38cd('0x5f')]['where'](db[_0x38cd('0x5f')]['fn'](_0x38cd('0x60'),db[_0x38cd('0x5f')][_0x38cd('0x61')]('uniqueid')),_0x204769[_0x38cd('0x32')]['token'])]};if(_0x204769[_0x38cd('0x32')]['type']&&_0x204769[_0x38cd('0x32')][_0x38cd('0x4e')]===_0x38cd('0x4f')){_0x507603['$and'][_0x38cd('0x62')]({'uniqueid':_0x204769[_0x38cd('0x4a')]['id']});}else{_0x507603[_0x38cd('0x63')][_0x38cd('0x62')]({'id':_0x204769['params']['id']});}return db['VoiceRecording'][_0x38cd('0x47')]({'where':_0x507603,'attributes':['id',_0x38cd('0x50')],'raw':!![]})[_0x38cd('0x27')](handleEntityNotFound(_0x310fa5,null))[_0x38cd('0x27')](function(_0x514116){if(_0x514116){var _0xa45564=util[_0x38cd('0x51')]('%s.cypher',_0x514116[_0x38cd('0x50')]);if(fs[_0x38cd('0x53')](_0xa45564)){_0x2a27f4=!![];return _0x3a5d43[_0x38cd('0x54')](_0xa45564,_0x514116[_0x38cd('0x50')],config[_0x38cd('0x55')]['recording'])[_0x38cd('0x27')](function(){return _0x514116;});}return _0x514116;}})[_0x38cd('0x27')](function(_0x298613){if(_0x298613){if(!fs[_0x38cd('0x53')](_0x298613[_0x38cd('0x50')])){throw new db['Sequelize'][(_0x38cd('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x298613[_0x38cd('0x59')]){return _0x310fa5[_0x38cd('0x4c')](_0x298613[_0x38cd('0x50')],_0x298613['filename']+path['extname'](_0x298613[_0x38cd('0x50')]),function(){if(_0x2a27f4){fs[_0x38cd('0x5b')](_0x298613['value']);}});}else{return _0x310fa5[_0x38cd('0x4c')](_0x298613[_0x38cd('0x50')],function(_0x1884a4){if(_0x2a27f4){fs[_0x38cd('0x5b')](_0x298613[_0x38cd('0x50')]);}});}}})[_0x38cd('0x44')](handleError(_0x310fa5,null));};exports[_0x38cd('0x64')]=function(_0x4fd11b,_0x3f4b8d){return db[_0x38cd('0x2b')][_0x38cd('0x47')]({'where':{'id':_0x4fd11b[_0x38cd('0x4a')]['id']}})[_0x38cd('0x27')](function(_0x2fd6f2){if(_['isNil'](_0x2fd6f2)){throw new ReferenceError(_0x38cd('0x65'));}return _0x2fd6f2;})['then'](function(_0x2a15ff){var _0x315c86=_0x2a15ff[_0x38cd('0x50')];logger[_0x38cd('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0x315c86);if(!_[_0x38cd('0x67')](_0x2a15ff['value'])&&fs[_0x38cd('0x53')](_0x315c86)){logger[_0x38cd('0x66')](_0x38cd('0x68')+_0x315c86+_0x38cd('0x69'));fs['unlinkSync'](_0x315c86);}_0x315c86=_0x315c86+_0x38cd('0x6a');if(!_['isNil'](_0x2a15ff['value'])&&fs[_0x38cd('0x53')](_0x315c86)){logger[_0x38cd('0x66')](_0x38cd('0x68')+_0x315c86+_0x38cd('0x69'));fs[_0x38cd('0x6b')](_0x315c86);}return _0x2a15ff;})[_0x38cd('0x27')](function(_0x55ad2e){if(!_0x55ad2e)throw new InternalError();return _0x55ad2e[_0x38cd('0x64')]();})['then'](function(){_0x3f4b8d[_0x38cd('0x1b')](0xcc)[_0x38cd('0x1c')]();})[_0x38cd('0x44')](handleError(_0x3f4b8d,null));};function getBucketslist(_0x3b0cbd,_0x46b4ba,_0x22e629){return new Promise(function(_0xd509d7,_0x22df05){var _0x5b3c55=new AWS['S3']({'accessKeyId':_0x46b4ba,'secretAccessKey':_0x3b0cbd,'region':_0x22e629});_0x5b3c55[_0x38cd('0x6c')]({},function(_0x4486ce,_0x4dff86){if(_0x4486ce){return _0x22df05(_0x4486ce);}else{return _0xd509d7(_0x4dff86);}});});}function createBucket(_0x41fca1,_0x96bba8,_0x308d58,_0x1ee56e){return new Promise(function(_0x24b12f,_0x2e218e){var _0x532370=new AWS['S3']({'accessKeyId':_0x96bba8,'secretAccessKey':_0x41fca1,'region':_0x308d58});_0x532370[_0x38cd('0x6d')]({'Bucket':_0x1ee56e},function(_0x3cdc84,_0x2367e7){if(_0x3cdc84){return _0x2e218e(_0x3cdc84);}else{return _0x24b12f(_0x2367e7);}});});}function uploadFile(_0x3de556,_0x5e4201,_0x95a7a9,_0x3c2ad9,_0x63056e,_0x45c870){return new Promise(function(_0x4cbe2a,_0x34ce40){var _0x2c4196=new AWS['S3']({'accessKeyId':_0x5e4201,'secretAccessKey':_0x3de556,'region':_0x95a7a9});_0x2c4196[_0x38cd('0x6e')]({'Bucket':_0x3c2ad9,'Key':_0x63056e,'Body':_0x45c870},function(_0x1e3d69,_0x100695){if(_0x1e3d69){return _0x34ce40(_0x1e3d69);}else{return _0x4cbe2a(_0x100695);}});});}function startTranscribe(_0x3f0105,_0x289a80,_0x5ee9cb,_0x456ee3,_0x6dfefa,_0x53d6fa){return new Promise(function(_0x30cbe8,_0x293e71){var _0x57e92c=new AWS[(_0x38cd('0x6f'))]({'accessKeyId':_0x289a80,'secretAccessKey':_0x3f0105,'region':_0x5ee9cb});_0x57e92c[_0x38cd('0x70')]({'TranscriptionJobName':_0x456ee3,'LanguageCode':_0x6dfefa,'Media':{'MediaFileUri':_0x53d6fa}},function(_0x44d64c,_0x132200){if(_0x44d64c){return _0x293e71(_0x44d64c);}else{return _0x30cbe8(_0x132200);}});});}function transcribe(_0x219b22,_0x225d2e,_0xc84e0c,_0x25ae87,_0x1c6471,_0xec0b36,_0x591d9c){return new Promise(function(_0x3204cf,_0x8bd41c){var _0xca59a9={};logger['info'](util[_0x38cd('0x51')](_0x38cd('0x71'),_0x219b22,_0x1c6471));return uploadFile(_0x225d2e,_0xc84e0c,_0x25ae87,_0x1c6471,path['basename'](_0xec0b36),fs['readFileSync'](_0xec0b36))[_0x38cd('0x27')](function(_0xcb41e3){logger[_0x38cd('0x66')](util[_0x38cd('0x51')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x219b22,_0x1c6471,_0xcb41e3['Location']));_0xca59a9[_0x38cd('0x72')]=_0xcb41e3['Bucket'];_0xca59a9[_0x38cd('0x73')]=_0xcb41e3['Location'];logger['info'](util[_0x38cd('0x51')](_0x38cd('0x74'),_0x219b22));return startTranscribe(_0x225d2e,_0xc84e0c,_0x25ae87,uuidv4(),_0x591d9c,_0xcb41e3[_0x38cd('0x75')]);})[_0x38cd('0x27')](function(_0x293657){logger[_0x38cd('0x66')](util[_0x38cd('0x51')](_0x38cd('0x76'),_0x219b22,_0x293657[_0x38cd('0x77')][_0x38cd('0x78')]));_0xca59a9[_0x38cd('0x79')]=_0x293657[_0x38cd('0x77')][_0x38cd('0x78')];_0xca59a9[_0x38cd('0x7a')]=_0x293657[_0x38cd('0x77')]['TranscriptionJobStatus'];return _0x3204cf(_0xca59a9);})['catch'](function(_0x1cb31b){return _0x8bd41c(_0x1cb31b);});});}exports['runTranscribe']=function(_0x3b2d83,_0x216f70,_0x374c5d){var _0x4ff1d8;var _0x1280c9;var _0x550a44;var _0xca77ec=require(_0x38cd('0x4d'));return db[_0x38cd('0x2b')][_0x38cd('0x7b')]({'where':{'id':_0x3b2d83[_0x38cd('0x4a')]['id']}})['then'](function(_0x2de5df){if(_0x2de5df){var _0x10a447=util['format']('%s.cypher',_0x2de5df[_0x38cd('0x50')]);if(fs[_0x38cd('0x53')](_0x10a447)){cypher=!![];return _0xca77ec[_0x38cd('0x54')](_0x10a447,_0x2de5df[_0x38cd('0x50')],config['secrets']['recording'])[_0x38cd('0x27')](function(){return _0x2de5df;});}return _0x2de5df;}})[_0x38cd('0x27')](function(_0x3dae9e){if(!_0x3dae9e){throw new db['Sequelize']['ValidationError'](_0x38cd('0x7c'));}_0x1280c9=_0x3dae9e;return db[_0x38cd('0x7d')][_0x38cd('0x7b')]({'where':{'id':0x1}});})[_0x38cd('0x27')](handleEntityNotFound(_0x216f70,null))[_0x38cd('0x27')](function(_0x55e26a){if(_0x55e26a){_0x4ff1d8=_0x55e26a;if(!_0x4ff1d8['transcribe']||!_0x4ff1d8['transcribeAccountId']||!_0x4ff1d8[_0x38cd('0x7e')]||!_0x4ff1d8[_0x38cd('0x7f')]||!_0x4ff1d8[_0x38cd('0x72')]){throw new db[(_0x38cd('0x80'))]['ValidationError'](_0x38cd('0x81'));}if(_0x3b2d83[_0x38cd('0x49')][_0x38cd('0x82')]&&(!_0x4ff1d8[_0x38cd('0x83')]||!_0x4ff1d8[_0x38cd('0x84')]||!_0x4ff1d8[_0x38cd('0x85')]||!_0x4ff1d8[_0x38cd('0x7f')]||!_0x4ff1d8[_0x38cd('0x72')])){throw new db[(_0x38cd('0x80'))][(_0x38cd('0x57'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x38cd('0x86')][_0x38cd('0x7b')]({'where':{'id':_0x4ff1d8[_0x38cd('0x87')]}});}})[_0x38cd('0x27')](function(_0x3ee7ec){if(!_0x3ee7ec){throw new db[(_0x38cd('0x80'))][(_0x38cd('0x57'))](_0x38cd('0x88'));}if(!_0x3ee7ec[_0x38cd('0x89')]||!_0x3ee7ec[_0x38cd('0x8a')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x550a44=_0x3ee7ec;return getBucketslist(_0x550a44[_0x38cd('0x89')],_0x550a44[_0x38cd('0x8a')],_0x4ff1d8[_0x38cd('0x7e')]);})[_0x38cd('0x27')](function(_0x16678d){if(_0x16678d&&_0x16678d[_0x38cd('0x8b')]){var _0x77366e=_[_0x38cd('0x47')](_0x16678d['Buckets'],function(_0xfcfc40){return _0xfcfc40[_0x38cd('0x8c')]===_0x4ff1d8[_0x38cd('0x72')];});if(!_0x77366e){logger[_0x38cd('0x66')](util[_0x38cd('0x51')](_0x38cd('0x8d'),_0x3b2d83[_0x38cd('0x4a')]['id'],_0x4ff1d8[_0x38cd('0x72')]));return createBucket(_0x550a44[_0x38cd('0x89')],_0x550a44[_0x38cd('0x8a')],_0x4ff1d8[_0x38cd('0x7e')],_0x4ff1d8[_0x38cd('0x72')]);}logger[_0x38cd('0x66')](util['format'](_0x38cd('0x8e'),_0x3b2d83['params']['id'],_0x4ff1d8['bucket']));return;}})[_0x38cd('0x27')](function(_0x2e39c0){if(_0x1280c9['transcribeStatus']==='NEW'){return transcribe(_0x3b2d83[_0x38cd('0x4a')]['id'],_0x550a44[_0x38cd('0x89')],_0x550a44[_0x38cd('0x8a')],_0x4ff1d8[_0x38cd('0x7e')],_0x4ff1d8[_0x38cd('0x72')],_0x1280c9['value'],_0x4ff1d8[_0x38cd('0x7f')]);}else{logger[_0x38cd('0x66')](util['format'](_0x38cd('0x8f'),_0x3b2d83[_0x38cd('0x4a')]['id']));return{'transcribeStatus':_0x38cd('0x90')};}})[_0x38cd('0x27')](function(_0x162aef){if(_0x162aef){_0x162aef[_0x38cd('0x91')]=_0x3b2d83['body'][_0x38cd('0x82')];return _0x1280c9[_0x38cd('0x92')](_0x162aef);}})[_0x38cd('0x27')](respondWithResult(_0x216f70,null))['catch'](handleError(_0x216f70,null));};function writeFile(_0x1c5f6e,_0x4a8ec7){return new Promise(function(_0x12f900,_0x4c2126){fs[_0x38cd('0x93')](_0x4a8ec7,_0x1c5f6e,function(_0x24f228,_0x50c972){if(_0x24f228){return _0x4c2126(_0x24f228);}else{return _0x12f900(_0x50c972);}});});}exports['downloadTranscribe']=function(_0x3f6131,_0x4ea596,_0x2bf598){return db[_0x38cd('0x2b')]['findOne']({'where':{'id':_0x3f6131[_0x38cd('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4ea596))['then'](function(_0x2a7557){if(_0x2a7557&&_0x2a7557['fileText']){var _0xd5df35=_0x2a7557[_0x38cd('0x94')];var _0x48a5fb=config[_0x38cd('0x95')]+_0x38cd('0x96')+_0x2a7557['id']+'.txt';if(fs[_0x38cd('0x53')](_0x48a5fb)){return _0x48a5fb;}return writeFile(_0xd5df35,_0x48a5fb)[_0x38cd('0x27')](function(){return _0x48a5fb;});}else{throw new db[(_0x38cd('0x80'))]['ValidationError'](_0x38cd('0x97'));}})[_0x38cd('0x27')](function(_0x4de53e){return _0x4ea596[_0x38cd('0x4c')](_0x4de53e);})[_0x38cd('0x44')](handleError(_0x4ea596));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index b2a0fac..01063bf 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 _0xa631=['exports','VoiceRecording','uniqueid','transcribeStatus'];(function(_0x25fbc8,_0x44a334){var _0x4eed32=function(_0x2fca9e){while(--_0x2fca9e){_0x25fbc8['push'](_0x25fbc8['shift']());}};_0x4eed32(++_0x44a334);}(_0xa631,0xe4));var _0x1a63=function(_0x289c9d,_0x5ced78){_0x289c9d=_0x289c9d-0x0;var _0x2e135=_0xa631[_0x289c9d];return _0x2e135;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x1a63('0x0')]=function(_0x1e771b,_0x17d7a7){return _0x1e771b['define'](_0x1a63('0x1'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1a63('0x2')]},{'name':_0x1a63('0x3'),'fields':[_0x1a63('0x3')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4abf=['uniqueid','./voiceRecording.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4abf,0xac));var _0xf4ab=function(_0x3393d1,_0x39976d){_0x3393d1=_0x3393d1-0x0;var _0x322d08=_0x4abf[_0x3393d1];return _0x322d08;};'use strict';var attributes=require(_0xf4ab('0x0'));module[_0xf4ab('0x1')]=function(_0x5cddfe,_0x321a54){return _0x5cddfe['define']('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xf4ab('0x2'),'fields':[_0xf4ab('0x2')]},{'name':'transcribeStatus','fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 86769a4..958a4a1 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 _0xd824=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','then','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash'];(function(_0x3b1a51,_0x14f19e){var _0x136c1f=function(_0x4d3af4){while(--_0x4d3af4){_0x3b1a51['push'](_0x3b1a51['shift']());}};_0x136c1f(++_0x14f19e);}(_0xd824,0xc2));var _0x4d82=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd824[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('VoiceRecording,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});}exports[_0x4d82('0x12')]=function(_0x258c59){var _0x217b72=this;return new Promise(function(_0x2f2127,_0x5ef783){return db[_0x4d82('0x13')][_0x4d82('0x14')](_0x258c59[_0x4d82('0x15')],{'raw':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x18')]||null:null,'attributes':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')]['attributes']||null:null,'limit':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')]['limit']||null:null})[_0x4d82('0x19')](function(_0x41f194){logger[_0x4d82('0xa')](_0x4d82('0x12'),_0x258c59);logger[_0x4d82('0x1a')](_0x4d82('0x12'),_0x258c59,JSON[_0x4d82('0xe')](_0x41f194));_0x2f2127(_0x41f194);})[_0x4d82('0x11')](function(_0x12feab){logger[_0x4d82('0xf')](_0x4d82('0x12'),_0x12feab[_0x4d82('0x10')],_0x258c59);_0x5ef783(_0x217b72[_0x4d82('0xf')](0x1f4,_0x12feab[_0x4d82('0x10')]));});});};exports[_0x4d82('0x1b')]=function(_0x4af6da){var _0x5e0b03=this;return new Promise(function(_0x3dcb0f,_0x2548de){var _0x2a0572=require(_0x4d82('0x1c'));var _0x5cbd7e;return db[_0x4d82('0x1d')][_0x4d82('0x1e')]({'attributes':['id',_0x4d82('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x4d82('0x19')](function(_0x5ce98b){_0x5cbd7e=_0x5ce98b;return db[_0x4d82('0x13')]['create'](_0x4af6da['body']);})['then'](function(_0x52533b){if(_0x5cbd7e[_0x4d82('0x1f')]&&fs[_0x4d82('0x20')](_0x52533b[_0x4d82('0x21')])){var _0x52e320=util[_0x4d82('0x22')](_0x4d82('0x23'),_0x52533b['value']);return _0x2a0572['encryptFile'](_0x52533b[_0x4d82('0x21')],_0x52e320,config[_0x4d82('0x24')][_0x4d82('0x25')])[_0x4d82('0x19')](function(){fs['unlink'](_0x52533b[_0x4d82('0x21')]);logger['info'](_0x4d82('0x26'));return _0x52533b;});}return _0x52533b;})[_0x4d82('0x19')](function(_0x4a2a45){logger['info'](_0x4d82('0x1b'),_0x4af6da);logger[_0x4d82('0x1a')](_0x4d82('0x1b'),_0x4af6da,JSON[_0x4d82('0xe')](_0x4a2a45));_0x3dcb0f(_0x4a2a45);})[_0x4d82('0x11')](function(_0x420b28){logger[_0x4d82('0xf')](_0x4d82('0x1b'),_0x420b28[_0x4d82('0x10')],_0x4af6da);_0x2548de(_0x5e0b03[_0x4d82('0xf')](0x1f4,_0x420b28['message']));});});}; \ No newline at end of file +var _0x5430=['info','request\x20sent','debug','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','UpdateVoiceRecording','VoiceRecording','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','format','%s.cypher','value','encryptFile','secrets','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x10c68c,_0x383ddc){var _0x216ecf=function(_0x299bbd){while(--_0x299bbd){_0x10c68c['push'](_0x10c68c['shift']());}};_0x216ecf(++_0x383ddc);}(_0x5430,0x10c));var _0x0543=function(_0x5a2287,_0x26a26f){_0x5a2287=_0x5a2287-0x0;var _0x4ae918=_0x5430[_0x5a2287];return _0x4ae918;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['update'](_0x20b396['body'],{'raw':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b396['options']?_0x20b396[_0x0543('0x17')]['where']||null:null,'attributes':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')]['attributes']||null:null,'limit':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x19')]||null:null})[_0x0543('0xb')](function(_0x37347e){logger[_0x0543('0xc')]('UpdateVoiceRecording',_0x20b396);logger['debug']('UpdateVoiceRecording',_0x20b396,JSON[_0x0543('0xf')](_0x37347e));_0x577cf0(_0x37347e);})[_0x0543('0x1a')](function(_0x15ebeb){logger[_0x0543('0x10')](_0x0543('0x15'),_0x15ebeb[_0x0543('0x13')],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x15ebeb[_0x0543('0x13')]));});});};exports[_0x0543('0x1b')]=function(_0xf1eccf){var _0x40a261=this;return new Promise(function(_0x21fc63,_0x547a88){var _0x25e6f1=require(_0x0543('0x1c'));var _0x30ad9e;return db['Setting'][_0x0543('0x1d')]({'attributes':['id',_0x0543('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0543('0xb')](function(_0x10b881){_0x30ad9e=_0x10b881;return db['VoiceRecording'][_0x0543('0x1f')](_0xf1eccf[_0x0543('0x20')]);})['then'](function(_0x576084){if(_0x30ad9e[_0x0543('0x1e')]&&fs[_0x0543('0x21')](_0x576084['value'])){var _0x3b879b=util[_0x0543('0x22')](_0x0543('0x23'),_0x576084[_0x0543('0x24')]);return _0x25e6f1[_0x0543('0x25')](_0x576084[_0x0543('0x24')],_0x3b879b,config[_0x0543('0x26')]['recording'])[_0x0543('0xb')](function(){fs['unlink'](_0x576084[_0x0543('0x24')]);logger[_0x0543('0xc')](_0x0543('0x27'));return _0x576084;});}return _0x576084;})[_0x0543('0xb')](function(_0x28307f){logger['info'](_0x0543('0x1b'),_0xf1eccf);logger['debug'](_0x0543('0x1b'),_0xf1eccf,JSON[_0x0543('0xf')](_0x28307f));_0x21fc63(_0x28307f);})[_0x0543('0x1a')](function(_0x327027){logger['error'](_0x0543('0x1b'),_0x327027['message'],_0xf1eccf);_0x547a88(_0x40a261[_0x0543('0x10')](0x1f4,_0x327027[_0x0543('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 5c3d41a..c700ca7 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 _0x51a3=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','destroy'];(function(_0x13893b,_0x510a2b){var _0x4d0949=function(_0x32d6a7){while(--_0x32d6a7){_0x13893b['push'](_0x13893b['shift']());}};_0x4d0949(++_0x510a2b);}(_0x51a3,0x110));var _0x351a=function(_0x373408,_0x6d5db){_0x373408=_0x373408-0x0;var _0x523114=_0x51a3[_0x373408];return _0x523114;};'use strict';var multer=require(_0x351a('0x0'));var util=require(_0x351a('0x1'));var path=require(_0x351a('0x2'));var timeout=require(_0x351a('0x3'));var express=require('express');var router=express[_0x351a('0x4')]();var fs_extra=require(_0x351a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x351a('0x6'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0x351a('0x7')](),controller['index']);router[_0x351a('0x8')](_0x351a('0x9'),auth[_0x351a('0x7')](),controller[_0x351a('0xa')]);router['get'](_0x351a('0xb'),auth['isAuthenticated'](),controller[_0x351a('0xc')]);router['post']('/',auth[_0x351a('0x7')](),controller[_0x351a('0xd')]);router[_0x351a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x351a('0xf')]);router['delete'](_0x351a('0xb'),auth[_0x351a('0x7')](),controller[_0x351a('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe6d5=['/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','/describe','get','show','post','create','put'];(function(_0x2f9c16,_0x8143ef){var _0x429b15=function(_0x565c5a){while(--_0x565c5a){_0x2f9c16['push'](_0x2f9c16['shift']());}};_0x429b15(++_0x8143ef);}(_0xe6d5,0x1a4));var _0x5e6d=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0xe6d5[_0x561f25];return _0x150e4c;};'use strict';var multer=require(_0x5e6d('0x0'));var util=require(_0x5e6d('0x1'));var path=require(_0x5e6d('0x2'));var timeout=require(_0x5e6d('0x3'));var express=require(_0x5e6d('0x4'));var router=express[_0x5e6d('0x5')]();var fs_extra=require(_0x5e6d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5e6d('0x7'));var config=require(_0x5e6d('0x8'));var controller=require(_0x5e6d('0x9'));router['get']('/',auth[_0x5e6d('0xa')](),controller['index']);router['get'](_0x5e6d('0xb'),auth[_0x5e6d('0xa')](),controller['describe']);router[_0x5e6d('0xc')]('/:id',auth[_0x5e6d('0xa')](),controller[_0x5e6d('0xd')]);router[_0x5e6d('0xe')]('/',auth[_0x5e6d('0xa')](),controller[_0x5e6d('0xf')]);router[_0x5e6d('0x10')](_0x5e6d('0x11'),auth[_0x5e6d('0xa')](),controller['update']);router['delete'](_0x5e6d('0x11'),auth[_0x5e6d('0xa')](),controller['destroy']);module[_0x5e6d('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index b38c668..44f3b96 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 _0xc067=['exports','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x553bd0,_0x3a06e9){var _0x305023=function(_0x45d089){while(--_0x45d089){_0x553bd0['push'](_0x553bd0['shift']());}};_0x305023(++_0x3a06e9);}(_0xc067,0xad));var _0x7c06=function(_0x26a4ea,_0xa72fb8){_0x26a4ea=_0x26a4ea-0x0;var _0x1b669e=_0xc067[_0x26a4ea];return _0x1b669e;};'use strict';var Sequelize=require(_0x7c06('0x0'));var moment=require(_0x7c06('0x1'));module[_0x7c06('0x2')]={'type':{'type':Sequelize['ENUM'](_0x7c06('0x3'),_0x7c06('0x4'))},'result':{'type':Sequelize[_0x7c06('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x7c06('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x7c06('0x5')]},'transferercontext':{'type':Sequelize[_0x7c06('0x5')]},'transfererexten':{'type':Sequelize[_0x7c06('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x7c06('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x7c06('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x7c06('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x7c06('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x7c06('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x7c06('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x7c06('0x6'),'No')},'context':{'type':Sequelize[_0x7c06('0x5')]},'extension':{'type':Sequelize[_0x7c06('0x5')]}}; \ No newline at end of file +var _0xffe4=['moment','exports','ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x33f822,_0x2a515f){var _0x49caf2=function(_0x5de9d3){while(--_0x5de9d3){_0x33f822['push'](_0x33f822['shift']());}};_0x49caf2(++_0x2a515f);}(_0xffe4,0xdf));var _0x4ffe=function(_0x577a6f,_0x624de8){_0x577a6f=_0x577a6f-0x0;var _0x4ebf23=_0xffe4[_0x577a6f];return _0x4ebf23;};'use strict';var Sequelize=require(_0x4ffe('0x0'));var moment=require(_0x4ffe('0x1'));module[_0x4ffe('0x2')]={'type':{'type':Sequelize[_0x4ffe('0x3')](_0x4ffe('0x4'),_0x4ffe('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x4ffe('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x4ffe('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x4ffe('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x4ffe('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x4ffe('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x4ffe('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x4ffe('0x6')]},'transfereechannel':{'type':Sequelize[_0x4ffe('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x4ffe('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x4ffe('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x4ffe('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x4ffe('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x4ffe('0x6')]},'transfereecontext':{'type':Sequelize[_0x4ffe('0x6')]},'transfereeexten':{'type':Sequelize[_0x4ffe('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x4ffe('0x3')](_0x4ffe('0x7'),'No')},'context':{'type':Sequelize[_0x4ffe('0x6')]},'extension':{'type':Sequelize[_0x4ffe('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 7d078ec..5c14be2 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 _0x33ff=['length','hasOwnProperty','limit','order','sort','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','keys','create','body','params','find','describe','rimraf','zip-dir','request-promise','moment','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/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields'];(function(_0x2d339c,_0x253cc8){var _0x5b72d3=function(_0x4a03ae){while(--_0x4a03ae){_0x2d339c['push'](_0x2d339c['shift']());}};_0x5b72d3(++_0x253cc8);}(_0x33ff,0xf9));var _0xf33f=function(_0x2f92d8,_0x2ef7f4){_0x2f92d8=_0x2f92d8-0x0;var _0x200ef1=_0x33ff[_0x2f92d8];return _0x200ef1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33f('0x0'));var zipdir=require(_0xf33f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf33f('0x2'));var moment=require(_0xf33f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf33f('0x4'));var util=require(_0xf33f('0x5'));var path=require(_0xf33f('0x6'));var sox=require(_0xf33f('0x7'));var csv=require(_0xf33f('0x8'));var ejs=require(_0xf33f('0x9'));var fs=require('fs');var fs_extra=require(_0xf33f('0xa'));var _=require(_0xf33f('0xb'));var squel=require(_0xf33f('0xc'));var crypto=require(_0xf33f('0xd'));var jsforce=require(_0xf33f('0xe'));var deskjs=require(_0xf33f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf33f('0x10'));var Papa=require(_0xf33f('0x11'));var Redis=require(_0xf33f('0x12'));var authService=require(_0xf33f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf33f('0x14'));var hardwareService=require(_0xf33f('0x15'));var logger=require(_0xf33f('0x16'))('api');var utils=require(_0xf33f('0x17'));var config=require(_0xf33f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf33f('0x19'))['db'];function respondWithStatusCode(_0x4dc871,_0x33313d){_0x33313d=_0x33313d||0xcc;return function(_0x178b87){if(_0x178b87){return _0x4dc871['sendStatus'](_0x33313d);}return _0x4dc871[_0xf33f('0x1a')](_0x33313d)['end']();};}function respondWithResult(_0x14d8b1,_0x4d71ac){_0x4d71ac=_0x4d71ac||0xc8;return function(_0x3cc556){if(_0x3cc556){return _0x14d8b1[_0xf33f('0x1a')](_0x4d71ac)['json'](_0x3cc556);}};}function respondWithFilteredResult(_0x3ea5fd,_0x64e122){return function(_0x493c0d){if(_0x493c0d){var _0x259b6d=typeof _0x64e122[_0xf33f('0x1b')]===_0xf33f('0x1c')&&typeof _0x64e122['limit']===_0xf33f('0x1c');var _0x56bae8=_0x493c0d['count'];var _0x252bdf=_0x259b6d?0x0:_0x64e122['offset'];var _0x2720df=_0x259b6d?_0x493c0d[_0xf33f('0x1d')]:_0x64e122[_0xf33f('0x1b')]+_0x64e122['limit'];var _0x57a24b;if(_0x2720df>=_0x56bae8){_0x2720df=_0x56bae8;_0x57a24b=0xc8;}else{_0x57a24b=0xce;}_0x3ea5fd[_0xf33f('0x1a')](_0x57a24b);return _0x3ea5fd[_0xf33f('0x1e')](_0xf33f('0x1f'),_0x252bdf+'-'+_0x2720df+'/'+_0x56bae8)[_0xf33f('0x20')](_0x493c0d);}return null;};}function patchUpdates(_0x1af2b7){return function(_0x2c2f09){try{jsonpatch['apply'](_0x2c2f09,_0x1af2b7,!![]);}catch(_0x547278){return BPromise[_0xf33f('0x21')](_0x547278);}return _0x2c2f09[_0xf33f('0x22')]();};}function saveUpdates(_0xfcb2f9,_0x2836e1){return function(_0x1664b4){if(_0x1664b4){return _0x1664b4[_0xf33f('0x23')](_0xfcb2f9)[_0xf33f('0x24')](function(_0x3dbf9f){return _0x3dbf9f;});}return null;};}function removeEntity(_0xcff6fc,_0x45c122){return function(_0x2c04a8){if(_0x2c04a8){return _0x2c04a8[_0xf33f('0x25')]()[_0xf33f('0x24')](function(){_0xcff6fc[_0xf33f('0x1a')](0xcc)[_0xf33f('0x26')]();});}};}function handleEntityNotFound(_0x324e6f,_0x119811){return function(_0x408b93){if(!_0x408b93){_0x324e6f[_0xf33f('0x27')](0x194);}return _0x408b93;};}function handleError(_0x267df7,_0x57b3ba){_0x57b3ba=_0x57b3ba||0x1f4;return function(_0x45a2b2){logger[_0xf33f('0x28')](_0x45a2b2['stack']);if(_0x45a2b2[_0xf33f('0x29')]){delete _0x45a2b2['name'];}_0x267df7[_0xf33f('0x1a')](_0x57b3ba)[_0xf33f('0x2a')](_0x45a2b2);};}exports[_0xf33f('0x2b')]=function(_0x41d1c5,_0xe9daea){var _0xf32339={},_0x457227={},_0x53d504={'count':0x0,'rows':[]};var _0x425913=_[_0xf33f('0x2c')](db[_0xf33f('0x2d')][_0xf33f('0x2e')],function(_0x4c4913){return{'name':_0x4c4913[_0xf33f('0x2f')],'type':_0x4c4913['type'][_0xf33f('0x30')]};});_0x457227['model']=_[_0xf33f('0x2c')](_0x425913,_0xf33f('0x29'));_0x457227[_0xf33f('0x31')]=_['keys'](_0x41d1c5['query']);_0x457227[_0xf33f('0x32')]=_[_0xf33f('0x33')](_0x457227[_0xf33f('0x34')],_0x457227[_0xf33f('0x31')]);_0xf32339[_0xf33f('0x35')]=_[_0xf33f('0x33')](_0x457227[_0xf33f('0x34')],qs[_0xf33f('0x36')](_0x41d1c5[_0xf33f('0x31')][_0xf33f('0x36')]));_0xf32339[_0xf33f('0x35')]=_0xf32339['attributes'][_0xf33f('0x37')]?_0xf32339['attributes']:_0x457227[_0xf33f('0x34')];if(!_0x41d1c5['query'][_0xf33f('0x38')]('nolimit')){_0xf32339[_0xf33f('0x39')]=qs[_0xf33f('0x39')](_0x41d1c5[_0xf33f('0x31')][_0xf33f('0x39')]);_0xf32339[_0xf33f('0x1b')]=qs['offset'](_0x41d1c5['query']['offset']);}_0xf32339[_0xf33f('0x3a')]=qs[_0xf33f('0x3b')](_0x41d1c5[_0xf33f('0x31')][_0xf33f('0x3b')]);_0xf32339['where']=qs[_0xf33f('0x32')](_['pick'](_0x41d1c5['query'],_0x457227[_0xf33f('0x32')]),_0x425913);if(_0x41d1c5[_0xf33f('0x31')][_0xf33f('0x3c')]){_0xf32339['where']=_[_0xf33f('0x3d')](_0xf32339['where'],{'$or':_[_0xf33f('0x2c')](_0x425913,function(_0xfd3e1b){if(_0xfd3e1b['type']!==_0xf33f('0x3e')){var _0xabf3c9={};_0xabf3c9[_0xfd3e1b[_0xf33f('0x29')]]={'$like':'%'+_0x41d1c5[_0xf33f('0x31')][_0xf33f('0x3c')]+'%'};return _0xabf3c9;}})});}_0xf32339=_[_0xf33f('0x3d')]({},_0xf32339,_0x41d1c5[_0xf33f('0x3f')]);var _0x591d5={'where':_0xf32339[_0xf33f('0x40')]};return db[_0xf33f('0x2d')][_0xf33f('0x1d')](_0x591d5)['then'](function(_0x46054d){_0x53d504[_0xf33f('0x1d')]=_0x46054d;if(_0x41d1c5[_0xf33f('0x31')]['includeAll']){_0xf32339[_0xf33f('0x41')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xf33f('0x42')](_0xf32339);})['then'](function(_0x373601){_0x53d504[_0xf33f('0x43')]=_0x373601;return _0x53d504;})[_0xf33f('0x24')](respondWithFilteredResult(_0xe9daea,_0xf32339))[_0xf33f('0x44')](handleError(_0xe9daea,null));};exports[_0xf33f('0x45')]=function(_0x8c31d0,_0x247ad7){var _0x97224e={'raw':!![],'where':{'id':_0x8c31d0['params']['id']}},_0xa2a8b6={};_0xa2a8b6[_0xf33f('0x34')]=_[_0xf33f('0x46')](db[_0xf33f('0x2d')][_0xf33f('0x2e')]);_0xa2a8b6['query']=_['keys'](_0x8c31d0[_0xf33f('0x31')]);_0xa2a8b6['filters']=_[_0xf33f('0x33')](_0xa2a8b6['model'],_0xa2a8b6[_0xf33f('0x31')]);_0x97224e[_0xf33f('0x35')]=_['intersection'](_0xa2a8b6['model'],qs['fields'](_0x8c31d0[_0xf33f('0x31')][_0xf33f('0x36')]));_0x97224e[_0xf33f('0x35')]=_0x97224e[_0xf33f('0x35')][_0xf33f('0x37')]?_0x97224e[_0xf33f('0x35')]:_0xa2a8b6[_0xf33f('0x34')];if(_0x8c31d0[_0xf33f('0x31')]['includeAll']){_0x97224e[_0xf33f('0x41')]=[{'all':!![]}];}_0x97224e=_[_0xf33f('0x3d')]({},_0x97224e,_0x8c31d0[_0xf33f('0x3f')]);return db[_0xf33f('0x2d')]['find'](_0x97224e)[_0xf33f('0x24')](handleEntityNotFound(_0x247ad7,null))[_0xf33f('0x24')](respondWithResult(_0x247ad7,null))[_0xf33f('0x44')](handleError(_0x247ad7,null));};exports[_0xf33f('0x47')]=function(_0x4438df,_0x485c34){return db[_0xf33f('0x2d')]['create'](_0x4438df[_0xf33f('0x48')],{})[_0xf33f('0x24')](respondWithResult(_0x485c34,0xc9))[_0xf33f('0x44')](handleError(_0x485c34,null));};exports[_0xf33f('0x23')]=function(_0x4d9d95,_0x340dda){if(_0x4d9d95[_0xf33f('0x48')]['id']){delete _0x4d9d95['body']['id'];}return db[_0xf33f('0x2d')]['find']({'where':{'id':_0x4d9d95[_0xf33f('0x49')]['id']}})['then'](handleEntityNotFound(_0x340dda,null))[_0xf33f('0x24')](saveUpdates(_0x4d9d95[_0xf33f('0x48')],null))[_0xf33f('0x24')](respondWithResult(_0x340dda,null))[_0xf33f('0x44')](handleError(_0x340dda,null));};exports[_0xf33f('0x25')]=function(_0x35bfa0,_0x159912){return db[_0xf33f('0x2d')][_0xf33f('0x4a')]({'where':{'id':_0x35bfa0[_0xf33f('0x49')]['id']}})[_0xf33f('0x24')](handleEntityNotFound(_0x159912,null))[_0xf33f('0x24')](removeEntity(_0x159912,null))[_0xf33f('0x44')](handleError(_0x159912,null));};exports['describe']=function(_0x3ba719,_0x40e4fb){return db[_0xf33f('0x2d')][_0xf33f('0x4b')]()[_0xf33f('0x24')](respondWithResult(_0x40e4fb,null))[_0xf33f('0x44')](handleError(_0x40e4fb,null));}; \ No newline at end of file +var _0xe17b=['filters','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','count','offset','apply','reject','update','destroy','then','stack','name','status','send','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0xb379b2,_0x133424){var _0x5a3b85=function(_0x4d623d){while(--_0x4d623d){_0xb379b2['push'](_0xb379b2['shift']());}};_0x5a3b85(++_0x133424);}(_0xe17b,0xf5));var _0xbe17=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0xe17b[_0x3ec122];return _0x4ecf41;};'use strict';var emlformat=require(_0xbe17('0x0'));var rimraf=require(_0xbe17('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe17('0x2'));var rp=require(_0xbe17('0x3'));var moment=require(_0xbe17('0x4'));var BPromise=require(_0xbe17('0x5'));var Mustache=require(_0xbe17('0x6'));var util=require(_0xbe17('0x7'));var path=require('path');var sox=require(_0xbe17('0x8'));var csv=require(_0xbe17('0x9'));var ejs=require(_0xbe17('0xa'));var fs=require('fs');var fs_extra=require(_0xbe17('0xb'));var _=require(_0xbe17('0xc'));var squel=require(_0xbe17('0xd'));var crypto=require(_0xbe17('0xe'));var jsforce=require(_0xbe17('0xf'));var deskjs=require(_0xbe17('0x10'));var toCsv=require(_0xbe17('0x9'));var querystring=require(_0xbe17('0x11'));var Papa=require(_0xbe17('0x12'));var Redis=require(_0xbe17('0x13'));var authService=require(_0xbe17('0x14'));var qs=require(_0xbe17('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe17('0x16'))('api');var utils=require(_0xbe17('0x17'));var config=require(_0xbe17('0x18'));var licenseUtil=require(_0xbe17('0x19'));var db=require(_0xbe17('0x1a'))['db'];function respondWithStatusCode(_0x46ac1e,_0x193ef8){_0x193ef8=_0x193ef8||0xcc;return function(_0x42d235){if(_0x42d235){return _0x46ac1e[_0xbe17('0x1b')](_0x193ef8);}return _0x46ac1e['status'](_0x193ef8)['end']();};}function respondWithResult(_0x447ee7,_0x28cb7b){_0x28cb7b=_0x28cb7b||0xc8;return function(_0x51e5d7){if(_0x51e5d7){return _0x447ee7['status'](_0x28cb7b)[_0xbe17('0x1c')](_0x51e5d7);}};}function respondWithFilteredResult(_0x434c7f,_0x2732f5){return function(_0x10bc37){if(_0x10bc37){var _0x1f9a5b=typeof _0x2732f5['offset']==='undefined'&&typeof _0x2732f5['limit']===_0xbe17('0x1d');var _0x4289a9=_0x10bc37[_0xbe17('0x1e')];var _0xbff9e1=_0x1f9a5b?0x0:_0x2732f5[_0xbe17('0x1f')];var _0x3f4479=_0x1f9a5b?_0x10bc37[_0xbe17('0x1e')]:_0x2732f5['offset']+_0x2732f5['limit'];var _0x5e95ec;if(_0x3f4479>=_0x4289a9){_0x3f4479=_0x4289a9;_0x5e95ec=0xc8;}else{_0x5e95ec=0xce;}_0x434c7f['status'](_0x5e95ec);return _0x434c7f['set']('Content-Range',_0xbff9e1+'-'+_0x3f4479+'/'+_0x4289a9)[_0xbe17('0x1c')](_0x10bc37);}return null;};}function patchUpdates(_0x2eb03c){return function(_0x5dcbf1){try{jsonpatch[_0xbe17('0x20')](_0x5dcbf1,_0x2eb03c,!![]);}catch(_0x67fdfa){return BPromise[_0xbe17('0x21')](_0x67fdfa);}return _0x5dcbf1['save']();};}function saveUpdates(_0x3d135e,_0x13417f){return function(_0x2afb2c){if(_0x2afb2c){return _0x2afb2c[_0xbe17('0x22')](_0x3d135e)['then'](function(_0x2bee87){return _0x2bee87;});}return null;};}function removeEntity(_0x614eaa,_0x42bab8){return function(_0xcecf68){if(_0xcecf68){return _0xcecf68[_0xbe17('0x23')]()[_0xbe17('0x24')](function(){_0x614eaa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e4f87,_0x54079c){return function(_0x31be07){if(!_0x31be07){_0x5e4f87['sendStatus'](0x194);}return _0x31be07;};}function handleError(_0x4b9fd8,_0x1caf1c){_0x1caf1c=_0x1caf1c||0x1f4;return function(_0x2955a8){logger['error'](_0x2955a8[_0xbe17('0x25')]);if(_0x2955a8['name']){delete _0x2955a8[_0xbe17('0x26')];}_0x4b9fd8[_0xbe17('0x27')](_0x1caf1c)[_0xbe17('0x28')](_0x2955a8);};}exports['index']=function(_0x367abc,_0x27249e){var _0x2aa106={},_0x2421ab={},_0x512510={'count':0x0,'rows':[]};var _0x303920=_[_0xbe17('0x29')](db[_0xbe17('0x2a')][_0xbe17('0x2b')],function(_0x927380){return{'name':_0x927380[_0xbe17('0x2c')],'type':_0x927380[_0xbe17('0x2d')][_0xbe17('0x2e')]};});_0x2421ab[_0xbe17('0x2f')]=_[_0xbe17('0x29')](_0x303920,_0xbe17('0x26'));_0x2421ab[_0xbe17('0x30')]=_['keys'](_0x367abc[_0xbe17('0x30')]);_0x2421ab['filters']=_['intersection'](_0x2421ab[_0xbe17('0x2f')],_0x2421ab[_0xbe17('0x30')]);_0x2aa106[_0xbe17('0x31')]=_[_0xbe17('0x32')](_0x2421ab[_0xbe17('0x2f')],qs[_0xbe17('0x33')](_0x367abc['query'][_0xbe17('0x33')]));_0x2aa106[_0xbe17('0x31')]=_0x2aa106['attributes'][_0xbe17('0x34')]?_0x2aa106['attributes']:_0x2421ab[_0xbe17('0x2f')];if(!_0x367abc['query'][_0xbe17('0x35')](_0xbe17('0x36'))){_0x2aa106[_0xbe17('0x37')]=qs['limit'](_0x367abc[_0xbe17('0x30')][_0xbe17('0x37')]);_0x2aa106['offset']=qs[_0xbe17('0x1f')](_0x367abc[_0xbe17('0x30')][_0xbe17('0x1f')]);}_0x2aa106[_0xbe17('0x38')]=qs[_0xbe17('0x39')](_0x367abc[_0xbe17('0x30')][_0xbe17('0x39')]);_0x2aa106[_0xbe17('0x3a')]=qs[_0xbe17('0x3b')](_[_0xbe17('0x3c')](_0x367abc[_0xbe17('0x30')],_0x2421ab[_0xbe17('0x3b')]),_0x303920);if(_0x367abc[_0xbe17('0x30')]['filter']){_0x2aa106[_0xbe17('0x3a')]=_['merge'](_0x2aa106[_0xbe17('0x3a')],{'$or':_[_0xbe17('0x29')](_0x303920,function(_0xabe75d){if(_0xabe75d[_0xbe17('0x2d')]!==_0xbe17('0x3d')){var _0x1e737c={};_0x1e737c[_0xabe75d['name']]={'$like':'%'+_0x367abc['query']['filter']+'%'};return _0x1e737c;}})});}_0x2aa106=_[_0xbe17('0x3e')]({},_0x2aa106,_0x367abc[_0xbe17('0x3f')]);var _0x612885={'where':_0x2aa106['where']};return db['VoiceTransferReport'][_0xbe17('0x1e')](_0x612885)['then'](function(_0x8bf7c6){_0x512510[_0xbe17('0x1e')]=_0x8bf7c6;if(_0x367abc[_0xbe17('0x30')][_0xbe17('0x40')]){_0x2aa106[_0xbe17('0x41')]=[{'all':!![]}];}return db[_0xbe17('0x2a')][_0xbe17('0x42')](_0x2aa106);})[_0xbe17('0x24')](function(_0x648aca){_0x512510[_0xbe17('0x43')]=_0x648aca;return _0x512510;})[_0xbe17('0x24')](respondWithFilteredResult(_0x27249e,_0x2aa106))[_0xbe17('0x44')](handleError(_0x27249e,null));};exports[_0xbe17('0x45')]=function(_0x4d78e1,_0x1dfdc2){var _0x51e710={'raw':!![],'where':{'id':_0x4d78e1[_0xbe17('0x46')]['id']}},_0x646b5e={};_0x646b5e[_0xbe17('0x2f')]=_['keys'](db['VoiceTransferReport'][_0xbe17('0x2b')]);_0x646b5e[_0xbe17('0x30')]=_[_0xbe17('0x47')](_0x4d78e1[_0xbe17('0x30')]);_0x646b5e['filters']=_[_0xbe17('0x32')](_0x646b5e[_0xbe17('0x2f')],_0x646b5e[_0xbe17('0x30')]);_0x51e710[_0xbe17('0x31')]=_[_0xbe17('0x32')](_0x646b5e[_0xbe17('0x2f')],qs['fields'](_0x4d78e1[_0xbe17('0x30')][_0xbe17('0x33')]));_0x51e710[_0xbe17('0x31')]=_0x51e710['attributes']['length']?_0x51e710[_0xbe17('0x31')]:_0x646b5e[_0xbe17('0x2f')];if(_0x4d78e1['query']['includeAll']){_0x51e710[_0xbe17('0x41')]=[{'all':!![]}];}_0x51e710=_['merge']({},_0x51e710,_0x4d78e1[_0xbe17('0x3f')]);return db['VoiceTransferReport'][_0xbe17('0x48')](_0x51e710)['then'](handleEntityNotFound(_0x1dfdc2,null))[_0xbe17('0x24')](respondWithResult(_0x1dfdc2,null))[_0xbe17('0x44')](handleError(_0x1dfdc2,null));};exports['create']=function(_0x495465,_0x47836e){return db['VoiceTransferReport'][_0xbe17('0x49')](_0x495465[_0xbe17('0x4a')],{})[_0xbe17('0x24')](respondWithResult(_0x47836e,0xc9))[_0xbe17('0x44')](handleError(_0x47836e,null));};exports[_0xbe17('0x22')]=function(_0xac3908,_0x1fab28){if(_0xac3908[_0xbe17('0x4a')]['id']){delete _0xac3908[_0xbe17('0x4a')]['id'];}return db[_0xbe17('0x2a')]['find']({'where':{'id':_0xac3908['params']['id']}})[_0xbe17('0x24')](handleEntityNotFound(_0x1fab28,null))[_0xbe17('0x24')](saveUpdates(_0xac3908[_0xbe17('0x4a')],null))[_0xbe17('0x24')](respondWithResult(_0x1fab28,null))[_0xbe17('0x44')](handleError(_0x1fab28,null));};exports[_0xbe17('0x23')]=function(_0xd128f2,_0x32d51b){return db['VoiceTransferReport'][_0xbe17('0x48')]({'where':{'id':_0xd128f2[_0xbe17('0x46')]['id']}})[_0xbe17('0x24')](handleEntityNotFound(_0x32d51b,null))['then'](removeEntity(_0x32d51b,null))[_0xbe17('0x44')](handleError(_0x32d51b,null));};exports['describe']=function(_0x1d3fa7,_0x4396e6){return db[_0xbe17('0x2a')][_0xbe17('0x4b')]()['then'](respondWithResult(_0x4396e6,null))[_0xbe17('0x44')](handleError(_0x4396e6,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d0b3585..660c1fa 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 _0x50e7=['moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','lodash','../../config/logger','api'];(function(_0x430b4a,_0x3053f6){var _0x23bd67=function(_0x30bc98){while(--_0x30bc98){_0x430b4a['push'](_0x430b4a['shift']());}};_0x23bd67(++_0x3053f6);}(_0x50e7,0x152));var _0x750e=function(_0x34bda3,_0x5774bf){_0x34bda3=_0x34bda3-0x0;var _0x474d5b=_0x50e7[_0x34bda3];return _0x474d5b;};'use strict';var _=require(_0x750e('0x0'));var util=require('util');var logger=require(_0x750e('0x1'))(_0x750e('0x2'));var moment=require(_0x750e('0x3'));var BPromise=require(_0x750e('0x4'));var rp=require(_0x750e('0x5'));var fs=require('fs');var path=require(_0x750e('0x6'));var rimraf=require('rimraf');var config=require(_0x750e('0x7'));var attributes=require(_0x750e('0x8'));module[_0x750e('0x9')]=function(_0x7f9d09,_0x5bac0b){return _0x7f9d09[_0x750e('0xa')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa332=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport'];(function(_0x58dc03,_0x1c0b28){var _0x2f14bb=function(_0x29e209){while(--_0x29e209){_0x58dc03['push'](_0x58dc03['shift']());}};_0x2f14bb(++_0x1c0b28);}(_0xa332,0x18c));var _0x2a33=function(_0x4c8de1,_0x11f4fe){_0x4c8de1=_0x4c8de1-0x0;var _0x25acd1=_0xa332[_0x4c8de1];return _0x25acd1;};'use strict';var _=require(_0x2a33('0x0'));var util=require(_0x2a33('0x1'));var logger=require(_0x2a33('0x2'))(_0x2a33('0x3'));var moment=require(_0x2a33('0x4'));var BPromise=require(_0x2a33('0x5'));var rp=require(_0x2a33('0x6'));var fs=require('fs');var path=require(_0x2a33('0x7'));var rimraf=require('rimraf');var config=require(_0x2a33('0x8'));var attributes=require(_0x2a33('0x9'));module['exports']=function(_0x1c4845,_0x5b3c2b){return _0x1c4845[_0x2a33('0xa')](_0x2a33('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 4be9f7e..b90b161 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 _0xdc83=['../../config/logger','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','VoiceTransferReport','body','options','raw','then','CreateVoiceTransferReport','lodash','util','randomstring','../../mysqldb'];(function(_0x581481,_0x190792){var _0x4dfd79=function(_0x3be3ad){while(--_0x3be3ad){_0x581481['push'](_0x581481['shift']());}};_0x4dfd79(++_0x190792);}(_0xdc83,0x14c));var _0x3dc8=function(_0x49709b,_0xfe162e){_0x49709b=_0x49709b-0x0;var _0x4867d2=_0xdc83[_0x49709b];return _0x4867d2;};'use strict';var _=require(_0x3dc8('0x0'));var util=require(_0x3dc8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3dc8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3dc8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3dc8('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3dc8('0x5'));var client=jayson[_0x3dc8('0x6')][_0x3dc8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1bf16c,_0x1a656a,_0x5ebb29){return new BPromise(function(_0x10982b,_0x45918d){return client[_0x3dc8('0x8')](_0x1bf16c,_0x5ebb29)['then'](function(_0x4de363){logger[_0x3dc8('0x9')](_0x3dc8('0xa'),_0x1a656a,_0x3dc8('0xb'));logger[_0x3dc8('0xc')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x1a656a,_0x3dc8('0xb'),JSON[_0x3dc8('0xd')](_0x4de363));if(_0x4de363[_0x3dc8('0xe')]){if(_0x4de363['error'][_0x3dc8('0xf')]===0x1f4){logger[_0x3dc8('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x1a656a,_0x4de363[_0x3dc8('0xe')][_0x3dc8('0x10')]);return _0x45918d(_0x4de363[_0x3dc8('0xe')]['message']);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x1a656a,_0x4de363[_0x3dc8('0xe')][_0x3dc8('0x10')]);return _0x10982b(_0x4de363['error'][_0x3dc8('0x10')]);}else{logger[_0x3dc8('0x9')](_0x3dc8('0xa'),_0x1a656a,'request\x20sent');_0x10982b(_0x4de363['result'][_0x3dc8('0x10')]);}})[_0x3dc8('0x11')](function(_0x44c2a7){logger[_0x3dc8('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x1a656a,_0x44c2a7);_0x45918d(_0x44c2a7);});});}exports['CreateVoiceTransferReport']=function(_0x59bfc7){var _0x264d95=this;return new Promise(function(_0x3d20e8,_0x87a7aa){return db[_0x3dc8('0x12')]['create'](_0x59bfc7[_0x3dc8('0x13')],{'raw':_0x59bfc7[_0x3dc8('0x14')]?_0x59bfc7[_0x3dc8('0x14')][_0x3dc8('0x15')]===undefined?!![]:![]:!![]})[_0x3dc8('0x16')](function(_0x4b343b){logger[_0x3dc8('0x9')](_0x3dc8('0x17'),_0x59bfc7);logger['debug'](_0x3dc8('0x17'),_0x59bfc7,JSON[_0x3dc8('0xd')](_0x4b343b));_0x3d20e8(_0x4b343b);})[_0x3dc8('0x11')](function(_0x58b881){logger[_0x3dc8('0xe')](_0x3dc8('0x17'),_0x58b881[_0x3dc8('0x10')],_0x59bfc7);_0x87a7aa(_0x264d95['error'](0x1f4,_0x58b881[_0x3dc8('0x10')]));});});}; \ No newline at end of file +var _0x684d=['info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','options','raw','CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','http','request'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x684d,0x18e));var _0xd684=function(_0x4f3e8b,_0x50bfa0){_0x4f3e8b=_0x4f3e8b-0x0;var _0x901862=_0x684d[_0x4f3e8b];return _0x901862;};'use strict';var _=require(_0xd684('0x0'));var util=require(_0xd684('0x1'));var moment=require(_0xd684('0x2'));var BPromise=require(_0xd684('0x3'));var rs=require(_0xd684('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd684('0x5'));var logger=require('../../config/logger')(_0xd684('0x6'));var config=require(_0xd684('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd684('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb205da,_0x191fb6,_0x6eaa7c){return new BPromise(function(_0x424dc2,_0x476c62){return client[_0xd684('0x9')](_0xb205da,_0x6eaa7c)['then'](function(_0x13e622){logger[_0xd684('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x191fb6,_0xd684('0xb'));logger[_0xd684('0xc')](_0xd684('0xd'),_0x191fb6,_0xd684('0xb'),JSON[_0xd684('0xe')](_0x13e622));if(_0x13e622[_0xd684('0xf')]){if(_0x13e622[_0xd684('0xf')][_0xd684('0x10')]===0x1f4){logger[_0xd684('0xf')](_0xd684('0x11'),_0x191fb6,_0x13e622[_0xd684('0xf')][_0xd684('0x12')]);return _0x476c62(_0x13e622[_0xd684('0xf')][_0xd684('0x12')]);}logger[_0xd684('0xf')](_0xd684('0x11'),_0x191fb6,_0x13e622['error'][_0xd684('0x12')]);return _0x424dc2(_0x13e622['error'][_0xd684('0x12')]);}else{logger[_0xd684('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x191fb6,_0xd684('0xb'));_0x424dc2(_0x13e622[_0xd684('0x13')][_0xd684('0x12')]);}})[_0xd684('0x14')](function(_0x3b2c7a){logger['error'](_0xd684('0x11'),_0x191fb6,_0x3b2c7a);_0x476c62(_0x3b2c7a);});});}exports['CreateVoiceTransferReport']=function(_0x2cb248){var _0xfc74c5=this;return new Promise(function(_0x390cad,_0x475531){return db['VoiceTransferReport']['create'](_0x2cb248['body'],{'raw':_0x2cb248[_0xd684('0x15')]?_0x2cb248[_0xd684('0x15')][_0xd684('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x5f19b1){logger[_0xd684('0xa')]('CreateVoiceTransferReport',_0x2cb248);logger[_0xd684('0xc')](_0xd684('0x17'),_0x2cb248,JSON['stringify'](_0x5f19b1));_0x390cad(_0x5f19b1);})[_0xd684('0x14')](function(_0x413f4a){logger[_0xd684('0xf')]('CreateVoiceTransferReport',_0x413f4a[_0xd684('0x12')],_0x2cb248);_0x475531(_0xfc74c5[_0xd684('0xf')](0x1f4,_0x413f4a[_0xd684('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 0a139d4..83a226f 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 _0x91a7=['/originate','isWebrtcLicence','/hangup','isAuthenticated','hangup','/answer','answer','post','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x586fa2,_0x1a45bc){var _0x515be9=function(_0x4e90d5){while(--_0x4e90d5){_0x586fa2['push'](_0x586fa2['shift']());}};_0x515be9(++_0x1a45bc);}(_0x91a7,0xe7));var _0x791a=function(_0x183c17,_0x330723){_0x183c17=_0x183c17-0x0;var _0x3b7e11=_0x91a7[_0x183c17];return _0x3b7e11;};'use strict';var express=require('express');var router=express[_0x791a('0x0')]();var auth=require(_0x791a('0x1'));var controller=require(_0x791a('0x2'));router['post'](_0x791a('0x3'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller['originate']);router['post'](_0x791a('0x5'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x7')]);router['post'](_0x791a('0x8'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x9')]);router[_0x791a('0xa')](_0x791a('0xb'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['hold']);router[_0x791a('0xa')](_0x791a('0xc'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller[_0x791a('0xd')]);router[_0x791a('0xa')](_0x791a('0xe'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['calls']);router['post'](_0x791a('0xf'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x10')]);module[_0x791a('0x11')]=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(_0x1239f0,_0x5b39d8){var _0x16dd18=function(_0x3b55f6){while(--_0x3b55f6){_0x1239f0['push'](_0x1239f0['shift']());}};_0x16dd18(++_0x5b39d8);}(_0x0bb5,0x148));var _0x50bb=function(_0x3fb804,_0x1264c1){_0x3fb804=_0x3fb804-0x0;var _0x5206b3=_0x0bb5[_0x3fb804];return _0x5206b3;};'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 9d35a38..37d72f1 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 _0x00b3=['webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','jayson/promise','http','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','name','status','send','NotFound','then','code','message','catch','User','VoiceChannels','all','rows','UserId','sessionId','sessionId\x20','body','json','userId','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','validate','length','format','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:'];(function(_0x4214da,_0x586705){var _0x64da0=function(_0x273e00){while(--_0x273e00){_0x4214da['push'](_0x4214da['shift']());}};_0x64da0(++_0x586705);}(_0x00b3,0x17a));var _0x300b=function(_0x8997b8,_0x28a408){_0x8997b8=_0x8997b8-0x0;var _0x421870=_0x00b3[_0x8997b8];return _0x421870;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x300b('0x0'));var db=require(_0x300b('0x1'))['db'];var config=require(_0x300b('0x2'));var util=require(_0x300b('0x3'));var BPromise=require('bluebird');var jayson=require(_0x300b('0x4'));var amiClient=jayson['client'][_0x300b('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x300b('0x6'));var Redis=require(_0x300b('0x7'));config[_0x300b('0x8')]=_[_0x300b('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x300b('0xa'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x300b('0xb'),'required':[!![],_0x300b('0xc')]},'callNumber':{'type':_0x300b('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x300b('0xd')},'callbackUrl':{'type':_0x300b('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x300b('0xb'),'required':[!![],_0x300b('0xc')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x300b('0xb'),'required':[!![],_0x300b('0xc')]},'sessionId':{'type':_0x300b('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x300b('0xc')]},'sessionId':{'type':_0x300b('0xd'),'required':[!![],_0x300b('0xe')]},'transferNumber':{'type':_0x300b('0xd'),'required':[!![],_0x300b('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x300b('0xb'),'required':[!![],_0x300b('0xc')]},'sessionId':{'type':_0x300b('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x300b('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x300b('0xb'),'required':[!![],_0x300b('0xc')]}});function emit(_0xd252fa,_0x51186d,_0x509089){logger[_0x300b('0x10')](_0xd252fa,_0x51186d,JSON[_0x300b('0x11')](_0x509089));io['to'](_0xd252fa)[_0x300b('0x12')](_0x51186d,_0x509089);}function handleError(_0xae48d2){return function(_0x4d2024){console[_0x300b('0x13')](_0x300b('0x14'),_0x4d2024,_0x4d2024 instanceof RangeError);logger[_0x300b('0x15')](_0x4d2024['stack']);if(_0x4d2024 instanceof RangeError){if(_0x4d2024[_0x300b('0x16')]){delete _0x4d2024[_0x300b('0x16')];}_0xae48d2[_0x300b('0x17')](0x194)[_0x300b('0x18')](_0x4d2024);}else{if(_0x4d2024['name']){delete _0x4d2024[_0x300b('0x16')];}_0xae48d2[_0x300b('0x17')](0x1f4)[_0x300b('0x18')](_0x4d2024);}};}function checkError(){return function(_0x4a5f75){if(!_0x4a5f75){throw new RangeError(_0x300b('0x19'));}return _0x4a5f75;};}function respondWithRpcPromise(_0x38dedb,_0x30a057){return new BPromise(function(_0x502c5f,_0x26913f){var _0x5b14ed=amiClient;return _0x5b14ed['request'](_0x38dedb,_0x30a057)[_0x300b('0x1a')](function(_0xad0fb){if(_0xad0fb[_0x300b('0x15')]){if(_0xad0fb[_0x300b('0x15')][_0x300b('0x1b')]===0x1f4){return _0x26913f(_0xad0fb[_0x300b('0x15')][_0x300b('0x1c')]);}return _0x502c5f(_0xad0fb[_0x300b('0x15')][_0x300b('0x1c')]);}else{_0x502c5f(_0xad0fb['result']);}})[_0x300b('0x1d')](function(_0x152048){_0x26913f(_0x152048);});});}function getAgent(_0x260bdc){return db[_0x300b('0x1e')]['findOne']({'where':{'id':_0x260bdc,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x39794a,_0x4a1300){return new BPromise(function(_0x1241c7,_0x2496e0){var _0x60bb0c=respondWithRpcPromise(_0x300b('0x1f'));var _0x2d2ea7=getAgent(_0x39794a);Promise[_0x300b('0x20')]([_0x60bb0c,_0x2d2ea7])[_0x300b('0x1a')](function(_0x159b63){var _0x1cdc8b=_0x159b63[0x0];var _0x3210cd=_0x159b63[0x1];var _0x485952=_['filter'](_0x1cdc8b[_0x300b('0x21')],function(_0x2a7604){return _0x2a7604[_0x300b('0x22')]==_0x3210cd['id']&&_0x2a7604[_0x300b('0x23')]==_0x4a1300;});if(_0x485952['length']==0x1){_0x1241c7(_0x3210cd);}else{_0x2496e0(new RangeError(_0x300b('0x24')+_0x4a1300+'\x20not\x20found!'));}});});}exports['originate']=function(_0x53ed0c,_0x27d2de){logger[_0x300b('0x10')]('originate\x20fired:',_0x53ed0c[_0x300b('0x25')]);var _0x39007c=originateValidation['validate'](_0x53ed0c[_0x300b('0x25')]);if(_0x39007c['length']>0x0){return _0x27d2de[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x39007c);}var _0xdad35f=_0x53ed0c[_0x300b('0x25')][_0x300b('0x27')];var _0x46a0e3=_0x53ed0c[_0x300b('0x25')]['callNumber'];var _0x4b00e6=_0x53ed0c['body'][_0x300b('0x28')];var _0x32e326=_0x53ed0c['body'][_0x300b('0x29')];return getAgent(_0xdad35f)[_0x300b('0x1a')](function(_0x5a5aba){logger[_0x300b('0x10')](_0x300b('0x2a'),_0x5a5aba[_0x300b('0x16')]);emit(util['format'](_0x300b('0x2b'),_0x5a5aba[_0x300b('0x16')]),_0x300b('0x2c'),{'callNumber':_0x46a0e3,'callerId':_0x4b00e6,'callbackUrl':_0x32e326});return _0x27d2de[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':_0x300b('0x2d')});})[_0x300b('0x1d')](handleError(_0x27d2de));};exports['hangup']=function(_0x2da2e3,_0x30b72){logger['info'](_0x300b('0x2e'),_0x2da2e3['body']);var _0x5987da=hangupValidation[_0x300b('0x2f')](_0x2da2e3[_0x300b('0x25')]);if(_0x5987da[_0x300b('0x30')]>0x0){return _0x30b72[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x5987da);}var _0x510ad8=_0x2da2e3[_0x300b('0x25')][_0x300b('0x27')];var _0x55b4da=_0x2da2e3[_0x300b('0x25')]['sessionId'];return getAgent(_0x510ad8)[_0x300b('0x1a')](function(_0x262ddb){logger[_0x300b('0x10')](_0x300b('0x2a'),_0x262ddb[_0x300b('0x16')]);emit(util[_0x300b('0x31')](_0x300b('0x2b'),_0x262ddb[_0x300b('0x16')]),_0x300b('0x32'),{'sessionId':_0x55b4da});return _0x30b72[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x30b72));};exports[_0x300b('0x33')]=function(_0x566af2,_0x5a08f7){logger[_0x300b('0x10')](_0x300b('0x34'),_0x566af2[_0x300b('0x25')]);var _0x5ef864=answerValidation[_0x300b('0x2f')](_0x566af2['body']);if(_0x5ef864['length']>0x0){return _0x5a08f7[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x5ef864);}var _0x5f0fd1=_0x566af2[_0x300b('0x25')][_0x300b('0x27')];var _0x54bdc9=_0x566af2[_0x300b('0x25')][_0x300b('0x23')];return getAgent(_0x5f0fd1)['then'](function(_0x3b1432){logger[_0x300b('0x10')](_0x300b('0x2a'),_0x3b1432[_0x300b('0x16')]);emit(util[_0x300b('0x31')](_0x300b('0x2b'),_0x3b1432[_0x300b('0x16')]),_0x300b('0x35'),{'sessionId':_0x54bdc9});return _0x5a08f7['status'](0xc8)['json']({'error':![],'message':_0x300b('0x36')});})['catch'](handleError(_0x5a08f7));};exports['hold']=function(_0x3379cb,_0x3028c0){logger[_0x300b('0x10')](_0x300b('0x37'),_0x3379cb[_0x300b('0x25')]);var _0x33f978=holdValidation['validate'](_0x3379cb[_0x300b('0x25')]);if(_0x33f978['length']>0x0){return _0x3028c0['status'](0x190)[_0x300b('0x26')](_0x33f978);}var _0x44d1b4=_0x3379cb['body'][_0x300b('0x27')];var _0x290942=_0x3379cb[_0x300b('0x25')][_0x300b('0x23')];return getAgent(_0x44d1b4)['then'](function(_0x389256){logger[_0x300b('0x10')]('entityFound:',_0x389256[_0x300b('0x16')]);emit(util[_0x300b('0x31')](_0x300b('0x2b'),_0x389256['name']),_0x300b('0x38'),{'sessionId':_0x290942});return _0x3028c0[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':_0x300b('0x39')});})[_0x300b('0x1d')](handleError(_0x3028c0));};exports[_0x300b('0x3a')]=function(_0x418ac3,_0x3dd25c){logger[_0x300b('0x10')](_0x300b('0x3b'),_0x418ac3[_0x300b('0x25')]);var _0x377ca8=unholdValidation[_0x300b('0x2f')](_0x418ac3['body']);if(_0x377ca8['length']>0x0){return _0x3dd25c[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x377ca8);}var _0x124229=_0x418ac3['body'][_0x300b('0x27')];var _0x543035=_0x418ac3[_0x300b('0x25')][_0x300b('0x23')];return getAgent(_0x124229)['then'](function(_0x31aba8){logger[_0x300b('0x10')](_0x300b('0x2a'),_0x31aba8[_0x300b('0x16')]);emit(util['format'](_0x300b('0x2b'),_0x31aba8['name']),_0x300b('0x3c'),{'sessionId':_0x543035});return _0x3dd25c[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':_0x300b('0x3d')});})[_0x300b('0x1d')](handleError(_0x3dd25c));};exports[_0x300b('0x3e')]=function(_0x69d6dd,_0x178f82){logger[_0x300b('0x10')](_0x300b('0x3f'),_0x178f82[_0x300b('0x25')]);var _0x1d6672=callsValidation[_0x300b('0x2f')](_0x69d6dd[_0x300b('0x25')]);if(_0x1d6672['length']>0x0){return _0x178f82[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x1d6672);}var _0x488715=_0x69d6dd['body'][_0x300b('0x27')];var _0x23e11e=respondWithRpcPromise(_0x300b('0x1f'));var _0xb9eb0a=getAgent(_0x488715);return Promise[_0x300b('0x20')]([_0x23e11e,_0xb9eb0a])[_0x300b('0x1a')](function(_0x18d5d2){var _0x487c2e=_0x18d5d2[0x0];var _0xff003a=_0x18d5d2[0x1];var _0x37ed9f=_['filter'](_0x487c2e[_0x300b('0x21')],function(_0x555f86){return _0x555f86[_0x300b('0x22')]==_0xff003a['id'];});return _0x178f82[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'count':_0x37ed9f['length'],'rows':_0x37ed9f});})[_0x300b('0x1d')](handleError(_0x178f82));};exports[_0x300b('0x40')]=function(_0x371396,_0x34c962){logger['info'](_0x300b('0x41'),_0x371396['body']);var _0x18b763=conferenceValidation[_0x300b('0x2f')](_0x371396['body']);if(_0x18b763[_0x300b('0x30')]>0x0){return _0x34c962[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x18b763);}var _0x4f8881=_0x371396[_0x300b('0x25')][_0x300b('0x27')];return getAgent(_0x4f8881)['then'](function(_0x158b08){logger['info'](_0x300b('0x2a'),_0x158b08[_0x300b('0x16')]);emit(util[_0x300b('0x31')](_0x300b('0x2b'),_0x158b08[_0x300b('0x16')]),_0x300b('0x42'));return _0x34c962[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':_0x300b('0x43')});})[_0x300b('0x1d')](handleError(_0x34c962));};exports[_0x300b('0x44')]=function(_0x3768f6,_0x464aa6){logger[_0x300b('0x10')](_0x300b('0x45'),_0x3768f6[_0x300b('0x25')]);var _0x3069c0=transferValidation[_0x300b('0x2f')](_0x3768f6[_0x300b('0x25')]);if(_0x3069c0[_0x300b('0x30')]>0x0){return _0x464aa6[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x3069c0);}var _0x3a7470=_0x3768f6['body'][_0x300b('0x27')];var _0x5022d5=_0x3768f6[_0x300b('0x25')][_0x300b('0x23')];var _0x2680e0=_0x3768f6[_0x300b('0x25')][_0x300b('0x46')];return getAgent(_0x3a7470)[_0x300b('0x1a')](function(_0x2f0113){logger[_0x300b('0x10')]('entityFound:',_0x2f0113[_0x300b('0x16')]);emit(util['format']('user:%s',_0x2f0113[_0x300b('0x16')]),_0x300b('0x47'),{'sessionId':_0x5022d5,'transferNumber':_0x2680e0});return _0x464aa6[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':_0x300b('0x48')});})['catch'](handleError(_0x464aa6));}; \ No newline at end of file +var _0xac55=['stack','name','status','send','NotFound','request','then','error','message','catch','User','findOne','agent','VoiceChannels','filter','UserId','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','json','user:%s','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','format','webbar:unhold','unhold\x20executed!','calls','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:'];(function(_0x3ccdea,_0x40c1b8){var _0x39ac3c=function(_0x37e87f){while(--_0x37e87f){_0x3ccdea['push'](_0x3ccdea['shift']());}};_0x39ac3c(++_0x40c1b8);}(_0xac55,0x1c8));var _0x5ac5=function(_0x226945,_0x54b1b8){_0x226945=_0x226945-0x0;var _0x22281c=_0xac55[_0x226945];return _0x22281c;};'use strict';var path=require(_0x5ac5('0x0'));var fs=require('fs');var _=require(_0x5ac5('0x1'));var db=require(_0x5ac5('0x2'))['db'];var config=require(_0x5ac5('0x3'));var util=require('util');var BPromise=require(_0x5ac5('0x4'));var jayson=require(_0x5ac5('0x5'));var amiClient=jayson[_0x5ac5('0x6')][_0x5ac5('0x7')]({'port':0x232a});var logger=require(_0x5ac5('0x8'))(_0x5ac5('0x9'));var Redis=require(_0x5ac5('0xa'));config['redis']=_['defaults'](config[_0x5ac5('0xb')],{'host':_0x5ac5('0xc'),'port':0x18eb});var io=require(_0x5ac5('0xd'))(new Redis(config[_0x5ac5('0xb')]));var Schema=require(_0x5ac5('0xe'));var originateValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],_0x5ac5('0x10')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x5ac5('0x11')},'callbackUrl':{'type':_0x5ac5('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':_0x5ac5('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':_0x5ac5('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':_0x5ac5('0x11'),'required':[!![],_0x5ac5('0x12')]},'transferNumber':{'type':_0x5ac5('0x11'),'required':[!![],_0x5ac5('0x13')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],_0x5ac5('0x10')]}});function emit(_0x30244d,_0x1282be,_0x34a95e){logger[_0x5ac5('0x14')](_0x30244d,_0x1282be,JSON[_0x5ac5('0x15')](_0x34a95e));io['to'](_0x30244d)['emit'](_0x1282be,_0x34a95e);}function handleError(_0x4e186a){return function(_0x5364a6){console[_0x5ac5('0x16')](_0x5ac5('0x17'),_0x5364a6,_0x5364a6 instanceof RangeError);logger['error'](_0x5364a6[_0x5ac5('0x18')]);if(_0x5364a6 instanceof RangeError){if(_0x5364a6['name']){delete _0x5364a6[_0x5ac5('0x19')];}_0x4e186a['status'](0x194)['send'](_0x5364a6);}else{if(_0x5364a6[_0x5ac5('0x19')]){delete _0x5364a6['name'];}_0x4e186a[_0x5ac5('0x1a')](0x1f4)[_0x5ac5('0x1b')](_0x5364a6);}};}function checkError(){return function(_0x5c21d8){if(!_0x5c21d8){throw new RangeError(_0x5ac5('0x1c'));}return _0x5c21d8;};}function respondWithRpcPromise(_0x4ac526,_0x29a44c){return new BPromise(function(_0x40bdbc,_0x47993e){var _0x47a898=amiClient;return _0x47a898[_0x5ac5('0x1d')](_0x4ac526,_0x29a44c)[_0x5ac5('0x1e')](function(_0x400308){if(_0x400308[_0x5ac5('0x1f')]){if(_0x400308[_0x5ac5('0x1f')]['code']===0x1f4){return _0x47993e(_0x400308[_0x5ac5('0x1f')][_0x5ac5('0x20')]);}return _0x40bdbc(_0x400308[_0x5ac5('0x1f')][_0x5ac5('0x20')]);}else{_0x40bdbc(_0x400308['result']);}})[_0x5ac5('0x21')](function(_0x4eda97){_0x47993e(_0x4eda97);});});}function getAgent(_0x17c507){return db[_0x5ac5('0x22')][_0x5ac5('0x23')]({'where':{'id':_0x17c507,'role':_0x5ac5('0x24')}})[_0x5ac5('0x1e')](checkError());}function getAgentCheckSession(_0x3b3ec0,_0x5ce67c){return new BPromise(function(_0x31f9cc,_0x4a5f4d){var _0x24e8c7=respondWithRpcPromise(_0x5ac5('0x25'));var _0x35535f=getAgent(_0x3b3ec0);Promise['all']([_0x24e8c7,_0x35535f])[_0x5ac5('0x1e')](function(_0x229941){var _0x21df31=_0x229941[0x0];var _0x21307c=_0x229941[0x1];var _0x4eafa1=_[_0x5ac5('0x26')](_0x21df31['rows'],function(_0x3414ba){return _0x3414ba[_0x5ac5('0x27')]==_0x21307c['id']&&_0x3414ba[_0x5ac5('0x28')]==_0x5ce67c;});if(_0x4eafa1[_0x5ac5('0x29')]==0x1){_0x31f9cc(_0x21307c);}else{_0x4a5f4d(new RangeError(_0x5ac5('0x2a')+_0x5ce67c+'\x20not\x20found!'));}});});}exports[_0x5ac5('0x2b')]=function(_0x21116,_0x36285d){logger['info'](_0x5ac5('0x2c'),_0x21116['body']);var _0x472782=originateValidation[_0x5ac5('0xe')](_0x21116[_0x5ac5('0x2d')]);if(_0x472782[_0x5ac5('0x29')]>0x0){return _0x36285d[_0x5ac5('0x1a')](0x190)['json'](_0x472782);}var _0x39a895=_0x21116['body'][_0x5ac5('0x2e')];var _0x5ae4af=_0x21116[_0x5ac5('0x2d')][_0x5ac5('0x2f')];var _0x47a5d8=_0x21116[_0x5ac5('0x2d')][_0x5ac5('0x30')];var _0x585e4b=_0x21116['body'][_0x5ac5('0x31')];return getAgent(_0x39a895)[_0x5ac5('0x1e')](function(_0x243204){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x243204[_0x5ac5('0x19')]);emit(util['format']('user:%s',_0x243204['name']),_0x5ac5('0x33'),{'callNumber':_0x5ae4af,'callerId':_0x47a5d8,'callbackUrl':_0x585e4b});return _0x36285d[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':_0x5ac5('0x34')});})[_0x5ac5('0x21')](handleError(_0x36285d));};exports[_0x5ac5('0x35')]=function(_0x38667d,_0x46290f){logger[_0x5ac5('0x14')](_0x5ac5('0x36'),_0x38667d[_0x5ac5('0x2d')]);var _0x2d726e=hangupValidation['validate'](_0x38667d[_0x5ac5('0x2d')]);if(_0x2d726e['length']>0x0){return _0x46290f[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x2d726e);}var _0x1ca0f0=_0x38667d[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x1ec79a=_0x38667d[_0x5ac5('0x2d')][_0x5ac5('0x28')];return getAgent(_0x1ca0f0)[_0x5ac5('0x1e')](function(_0x5105fc){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x5105fc['name']);emit(util['format'](_0x5ac5('0x38'),_0x5105fc['name']),_0x5ac5('0x39'),{'sessionId':_0x1ec79a});return _0x46290f[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0x5ac5('0x21')](handleError(_0x46290f));};exports[_0x5ac5('0x3a')]=function(_0x32cc92,_0x1475b0){logger[_0x5ac5('0x14')](_0x5ac5('0x3b'),_0x32cc92[_0x5ac5('0x2d')]);var _0x5a86a0=answerValidation[_0x5ac5('0xe')](_0x32cc92[_0x5ac5('0x2d')]);if(_0x5a86a0[_0x5ac5('0x29')]>0x0){return _0x1475b0[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x5a86a0);}var _0x3abf39=_0x32cc92['body'][_0x5ac5('0x2e')];var _0x24657d=_0x32cc92[_0x5ac5('0x2d')][_0x5ac5('0x28')];return getAgent(_0x3abf39)['then'](function(_0x228179){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x228179['name']);emit(util['format'](_0x5ac5('0x38'),_0x228179[_0x5ac5('0x19')]),_0x5ac5('0x3c'),{'sessionId':_0x24657d});return _0x1475b0[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':_0x5ac5('0x3d')});})['catch'](handleError(_0x1475b0));};exports[_0x5ac5('0x3e')]=function(_0x3dfeba,_0x4d90cf){logger[_0x5ac5('0x14')]('hold\x20fired:',_0x3dfeba[_0x5ac5('0x2d')]);var _0x3f26e0=holdValidation[_0x5ac5('0xe')](_0x3dfeba['body']);if(_0x3f26e0['length']>0x0){return _0x4d90cf[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x3f26e0);}var _0xd6ae55=_0x3dfeba[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x3534ce=_0x3dfeba[_0x5ac5('0x2d')][_0x5ac5('0x28')];return getAgent(_0xd6ae55)[_0x5ac5('0x1e')](function(_0x536765){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x536765[_0x5ac5('0x19')]);emit(util['format']('user:%s',_0x536765[_0x5ac5('0x19')]),_0x5ac5('0x3f'),{'sessionId':_0x3534ce});return _0x4d90cf[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':_0x5ac5('0x40')});})[_0x5ac5('0x21')](handleError(_0x4d90cf));};exports[_0x5ac5('0x41')]=function(_0x2a3396,_0x326f60){logger[_0x5ac5('0x14')](_0x5ac5('0x42'),_0x2a3396['body']);var _0x5ac4e3=unholdValidation['validate'](_0x2a3396[_0x5ac5('0x2d')]);if(_0x5ac4e3[_0x5ac5('0x29')]>0x0){return _0x326f60[_0x5ac5('0x1a')](0x190)['json'](_0x5ac4e3);}var _0x1973f6=_0x2a3396[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x286304=_0x2a3396[_0x5ac5('0x2d')]['sessionId'];return getAgent(_0x1973f6)['then'](function(_0x516ffd){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x516ffd[_0x5ac5('0x19')]);emit(util[_0x5ac5('0x43')](_0x5ac5('0x38'),_0x516ffd[_0x5ac5('0x19')]),_0x5ac5('0x44'),{'sessionId':_0x286304});return _0x326f60[_0x5ac5('0x1a')](0xc8)[_0x5ac5('0x37')]({'error':![],'message':_0x5ac5('0x45')});})[_0x5ac5('0x21')](handleError(_0x326f60));};exports[_0x5ac5('0x46')]=function(_0x447603,_0x252030){logger[_0x5ac5('0x14')]('calls\x20fired:',_0x252030[_0x5ac5('0x2d')]);var _0x360fb8=callsValidation['validate'](_0x447603[_0x5ac5('0x2d')]);if(_0x360fb8[_0x5ac5('0x29')]>0x0){return _0x252030[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x360fb8);}var _0x316af1=_0x447603[_0x5ac5('0x2d')]['userId'];var _0x2b5329=respondWithRpcPromise(_0x5ac5('0x25'));var _0x424bed=getAgent(_0x316af1);return Promise['all']([_0x2b5329,_0x424bed])[_0x5ac5('0x1e')](function(_0x44e349){var _0x4dd8be=_0x44e349[0x0];var _0x1a6428=_0x44e349[0x1];var _0x3227dc=_['filter'](_0x4dd8be['rows'],function(_0x4d1346){return _0x4d1346[_0x5ac5('0x27')]==_0x1a6428['id'];});return _0x252030[_0x5ac5('0x1a')](0xc8)[_0x5ac5('0x37')]({'count':_0x3227dc[_0x5ac5('0x29')],'rows':_0x3227dc});})[_0x5ac5('0x21')](handleError(_0x252030));};exports[_0x5ac5('0x47')]=function(_0x4ee231,_0x75ca64){logger[_0x5ac5('0x14')](_0x5ac5('0x48'),_0x4ee231[_0x5ac5('0x2d')]);var _0x1f9b9b=conferenceValidation['validate'](_0x4ee231['body']);if(_0x1f9b9b['length']>0x0){return _0x75ca64[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x1f9b9b);}var _0x334a1c=_0x4ee231[_0x5ac5('0x2d')]['userId'];return getAgent(_0x334a1c)[_0x5ac5('0x1e')](function(_0x38b128){logger[_0x5ac5('0x14')]('entityFound:',_0x38b128['name']);emit(util['format'](_0x5ac5('0x38'),_0x38b128[_0x5ac5('0x19')]),_0x5ac5('0x49'));return _0x75ca64[_0x5ac5('0x1a')](0xc8)[_0x5ac5('0x37')]({'error':![],'message':_0x5ac5('0x4a')});})['catch'](handleError(_0x75ca64));};exports[_0x5ac5('0x4b')]=function(_0x5532d6,_0x492179){logger[_0x5ac5('0x14')](_0x5ac5('0x4c'),_0x5532d6[_0x5ac5('0x2d')]);var _0x324ec9=transferValidation[_0x5ac5('0xe')](_0x5532d6[_0x5ac5('0x2d')]);if(_0x324ec9[_0x5ac5('0x29')]>0x0){return _0x492179[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x324ec9);}var _0x130c67=_0x5532d6[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x299b02=_0x5532d6[_0x5ac5('0x2d')][_0x5ac5('0x28')];var _0x46315b=_0x5532d6[_0x5ac5('0x2d')][_0x5ac5('0x4d')];return getAgent(_0x130c67)[_0x5ac5('0x1e')](function(_0xc95ae5){logger[_0x5ac5('0x14')]('entityFound:',_0xc95ae5[_0x5ac5('0x19')]);emit(util['format'](_0x5ac5('0x38'),_0xc95ae5['name']),_0x5ac5('0x4e'),{'sessionId':_0x299b02,'transferNumber':_0x46315b});return _0x492179['status'](0xc8)['json']({'error':![],'message':_0x5ac5('0x4f')});})['catch'](handleError(_0x492179));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index a2dd428..89d7114 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 _0x6268=['removeAgents','exports','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send','put','update','delete','destroy','removeDispositions'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x6268,0xbc));var _0x8626=function(_0x62e12d,_0x10a0c7){_0x62e12d=_0x62e12d-0x0;var _0x121c4b=_0x6268[_0x62e12d];return _0x121c4b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8626('0x0')]();var fs_extra=require(_0x8626('0x1'));var auth=require(_0x8626('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x8626('0x3'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0x8626('0x4')](),controller[_0x8626('0x5')]);router[_0x8626('0x6')](_0x8626('0x7'),auth['isAuthenticated'](),controller[_0x8626('0x8')]);router[_0x8626('0x6')](_0x8626('0x9'),auth[_0x8626('0x4')](),controller[_0x8626('0xa')]);router['get'](_0x8626('0xb'),auth[_0x8626('0x4')](),controller[_0x8626('0xc')]);router[_0x8626('0x6')]('/:id/canned_answers',auth[_0x8626('0x4')](),controller[_0x8626('0xd')]);router[_0x8626('0x6')](_0x8626('0xe'),auth[_0x8626('0x4')](),controller[_0x8626('0xf')]);router[_0x8626('0x6')](_0x8626('0x10'),auth[_0x8626('0x4')](),controller['getApplications']);router[_0x8626('0x11')]('/',auth[_0x8626('0x4')](),controller[_0x8626('0x12')]);router[_0x8626('0x11')]('/:id/dispositions',auth[_0x8626('0x4')](),controller[_0x8626('0x13')]);router[_0x8626('0x11')](_0x8626('0x14'),auth[_0x8626('0x4')](),controller[_0x8626('0x15')]);router[_0x8626('0x11')](_0x8626('0xe'),auth[_0x8626('0x4')](),controller['addAgents']);router[_0x8626('0x11')](_0x8626('0x10'),auth[_0x8626('0x4')](),controller[_0x8626('0x16')]);router['post']('/:id/notify',controller['notify']);router[_0x8626('0x11')](_0x8626('0x17'),auth[_0x8626('0x4')](),controller['send']);router[_0x8626('0x18')]('/:id',auth[_0x8626('0x4')](),controller[_0x8626('0x19')]);router[_0x8626('0x1a')](_0x8626('0x9'),auth['isAuthenticated'](),controller[_0x8626('0x1b')]);router[_0x8626('0x1a')](_0x8626('0xb'),auth[_0x8626('0x4')](),controller[_0x8626('0x1c')]);router[_0x8626('0x1a')](_0x8626('0x14'),auth[_0x8626('0x4')](),controller['removeAnswers']);router['delete'](_0x8626('0xe'),auth['isAuthenticated'](),controller[_0x8626('0x1d')]);module[_0x8626('0x1e')]=router; \ No newline at end of file +var _0x1daa=['describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','addAgents','notify','send','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','get','/describe'];(function(_0x248238,_0xe31996){var _0xb93bc4=function(_0xa7489e){while(--_0xa7489e){_0x248238['push'](_0x248238['shift']());}};_0xb93bc4(++_0xe31996);}(_0x1daa,0x9e));var _0xa1da=function(_0x45dd0e,_0x28e603){_0x45dd0e=_0x45dd0e-0x0;var _0x50e5ca=_0x1daa[_0x45dd0e];return _0x50e5ca;};'use strict';var multer=require('multer');var util=require(_0xa1da('0x0'));var path=require('path');var timeout=require(_0xa1da('0x1'));var express=require(_0xa1da('0x2'));var router=express[_0xa1da('0x3')]();var fs_extra=require(_0xa1da('0x4'));var auth=require(_0xa1da('0x5'));var interaction=require(_0xa1da('0x6'));var config=require(_0xa1da('0x7'));var controller=require(_0xa1da('0x8'));router['get']('/',auth[_0xa1da('0x9')](),controller['index']);router[_0xa1da('0xa')](_0xa1da('0xb'),auth[_0xa1da('0x9')](),controller[_0xa1da('0xc')]);router['get'](_0xa1da('0xd'),auth[_0xa1da('0x9')](),controller[_0xa1da('0xe')]);router[_0xa1da('0xa')](_0xa1da('0xf'),auth[_0xa1da('0x9')](),controller['getDispositions']);router[_0xa1da('0xa')](_0xa1da('0x10'),auth[_0xa1da('0x9')](),controller[_0xa1da('0x11')]);router[_0xa1da('0xa')](_0xa1da('0x12'),auth['isAuthenticated'](),controller[_0xa1da('0x13')]);router[_0xa1da('0xa')](_0xa1da('0x14'),auth[_0xa1da('0x9')](),controller[_0xa1da('0x15')]);router[_0xa1da('0x16')]('/',auth[_0xa1da('0x9')](),controller['create']);router['post']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xa1da('0x17')]);router['post']('/:id/canned_answers',auth[_0xa1da('0x9')](),controller[_0xa1da('0x18')]);router[_0xa1da('0x16')](_0xa1da('0x12'),auth[_0xa1da('0x9')](),controller[_0xa1da('0x19')]);router[_0xa1da('0x16')](_0xa1da('0x14'),auth[_0xa1da('0x9')](),controller['addApplications']);router[_0xa1da('0x16')]('/:id/notify',controller[_0xa1da('0x1a')]);router[_0xa1da('0x16')]('/:id/send',auth[_0xa1da('0x9')](),controller[_0xa1da('0x1b')]);router['put'](_0xa1da('0xd'),auth['isAuthenticated'](),controller[_0xa1da('0x1c')]);router[_0xa1da('0x1d')](_0xa1da('0xd'),auth[_0xa1da('0x9')](),controller['destroy']);router['delete'](_0xa1da('0xf'),auth[_0xa1da('0x9')](),controller[_0xa1da('0x1e')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xa1da('0x1f')]);router[_0xa1da('0x1d')](_0xa1da('0x12'),auth[_0xa1da('0x9')](),controller[_0xa1da('0x20')]);module[_0xa1da('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 775f95b..3cfaa15 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 _0x30a9=['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','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate','ENUM','twilio','sinch'];(function(_0x1f0fc7,_0x452257){var _0x47592f=function(_0x5c26e5){while(--_0x5c26e5){_0x1f0fc7['push'](_0x1f0fc7['shift']());}};_0x47592f(++_0x452257);}(_0x30a9,0x169));var _0x930a=function(_0x250af7,_0x388398){_0x250af7=_0x250af7-0x0;var _0x5e217f=_0x30a9[_0x250af7];return _0x5e217f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x930a('0x0'));module[_0x930a('0x1')]={'name':{'type':Sequelize[_0x930a('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x930a('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x930a('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x930a('0x2')],'defaultValue':function(){return rs[_0x930a('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x930a('0x4')](_0x930a('0x5'),_0x930a('0x6'))},'accountSid':{'type':Sequelize[_0x930a('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x930a('0x2')]},'notificationTemplate':{'type':Sequelize[_0x930a('0x7')],'defaultValue':function(){return _0x930a('0x8');}},'notificationSound':{'type':Sequelize[_0x930a('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x930a('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x930a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x930a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x930a('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x930a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x930a('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x930a('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x930a('0x9')],'defaultValue':![],'comment':_0x930a('0xc'),'set':function(_0xc36bd){if(!_0xc36bd){this[_0x930a('0xd')](_0x930a('0xe'),null);}this[_0x930a('0xd')](_0x930a('0xf'),_0xc36bd);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc1ba=['mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc1ba,0x18d));var _0xac1b=function(_0x1405e9,_0x23d988){_0x1405e9=_0x1405e9-0x0;var _0x124ed4=_0xc1ba[_0x1405e9];return _0x124ed4;};'use strict';var Sequelize=require(_0xac1b('0x0'));var rs=require(_0xac1b('0x1'));module[_0xac1b('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xac1b('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xac1b('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xac1b('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('twilio',_0xac1b('0x4'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xac1b('0x3')]},'notificationTemplate':{'type':Sequelize[_0xac1b('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xac1b('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xac1b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xac1b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xac1b('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xac1b('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xac1b('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xac1b('0x7')],'comment':_0xac1b('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xac1b('0x6')],'defaultValue':![],'comment':_0xac1b('0x9'),'set':function(_0x306aa8){if(!_0x306aa8){this[_0xac1b('0xa')](_0xac1b('0xb'),null);}this['setDataValue']('mandatoryDisposition',_0x306aa8);}},'description':{'type':Sequelize[_0xac1b('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8048560..1107aa6 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 _0x22d5=['Disposition','findOne','pick','include','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','contact','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','Content-Type','to\x20is\x20mandatory','List','WhatsappInteraction','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappAccount.socket','jayson/promise','client','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','WhatsappAccounts','UserProfileResource','then','stack','name','send','index','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','findAll','rows','show','length','includeAll','find','catch','create','get','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','params','describe','WhatsappAccountId'];(function(_0x1ad74b,_0x21708e){var _0x5f0992=function(_0x24d37d){while(--_0x24d37d){_0x1ad74b['push'](_0x1ad74b['shift']());}};_0x5f0992(++_0x21708e);}(_0x22d5,0x1e1));var _0x522d=function(_0x3c2c2a,_0x2bce72){_0x3c2c2a=_0x3c2c2a-0x0;var _0xf1156b=_0x22d5[_0x3c2c2a];return _0xf1156b;};'use strict';var emlformat=require(_0x522d('0x0'));var rimraf=require(_0x522d('0x1'));var zipdir=require(_0x522d('0x2'));var jsonpatch=require(_0x522d('0x3'));var rp=require('request-promise');var moment=require(_0x522d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x522d('0x5'));var util=require(_0x522d('0x6'));var path=require(_0x522d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x522d('0x8'));var fs=require('fs');var fs_extra=require(_0x522d('0x9'));var _=require(_0x522d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x522d('0xb'));var toCsv=require(_0x522d('0xc'));var querystring=require('querystring');var Papa=require(_0x522d('0xd'));var Redis=require(_0x522d('0xe'));var authService=require(_0x522d('0xf'));var qs=require(_0x522d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x522d('0x11'));var logger=require(_0x522d('0x12'))(_0x522d('0x13'));var utils=require('../../config/utils');var config=require(_0x522d('0x14'));var licenseUtil=require(_0x522d('0x15'));var db=require(_0x522d('0x16'))['db'];config['redis']=_[_0x522d('0x17')](config[_0x522d('0x18')],{'host':_0x522d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x522d('0x18')]));require(_0x522d('0x1a'))['register'](socket);var jayson=require(_0x522d('0x1b'));var client=jayson[_0x522d('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0x188d19,_0xb69956,_0x4339b9,_0x2073e2){return new BPromise(function(_0x14afcd,_0x1becdb){var _0x311abd=_0x2073e2||client;return _0x311abd[_0x522d('0x1d')](_0x188d19,_0x4339b9)['then'](function(_0x38679f){logger['info'](_0x522d('0x1e'),_0xb69956,_0x522d('0x1f'));logger[_0x522d('0x20')](_0x522d('0x21'),_0xb69956,_0x522d('0x1f'),JSON[_0x522d('0x22')](_0x38679f));if(_0x38679f[_0x522d('0x23')]){if(_0x38679f[_0x522d('0x23')][_0x522d('0x24')]===0x1f4){logger[_0x522d('0x23')](_0x522d('0x1e'),_0xb69956,_0x38679f[_0x522d('0x23')]['message']);return _0x1becdb(_0x38679f[_0x522d('0x23')]['message']);}logger[_0x522d('0x23')](_0x522d('0x1e'),_0xb69956,_0x38679f['error'][_0x522d('0x25')]);return _0x14afcd(_0x38679f[_0x522d('0x23')][_0x522d('0x25')]);}else{logger[_0x522d('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0xb69956,_0x522d('0x1f'));_0x14afcd(_0x38679f['result'][_0x522d('0x25')]);}})['catch'](function(_0x3896e5){logger[_0x522d('0x23')](_0x522d('0x1e'),_0xb69956,_0x3896e5);_0x1becdb(_0x3896e5);});});}function respondWithStatusCode(_0x3393d5,_0x39b0de){_0x39b0de=_0x39b0de||0xcc;return function(_0xeb72b6){if(_0xeb72b6){return _0x3393d5[_0x522d('0x27')](_0x39b0de);}return _0x3393d5[_0x522d('0x28')](_0x39b0de)[_0x522d('0x29')]();};}function respondWithResult(_0x4bf368,_0x28024c){_0x28024c=_0x28024c||0xc8;return function(_0x5b2a31){if(_0x5b2a31){return _0x4bf368[_0x522d('0x28')](_0x28024c)[_0x522d('0x2a')](_0x5b2a31);}};}function respondWithFilteredResult(_0x8de694,_0x1e2cef){return function(_0x4c22d5){if(_0x4c22d5){var _0x4f11d8=typeof _0x1e2cef[_0x522d('0x2b')]===_0x522d('0x2c')&&typeof _0x1e2cef['limit']==='undefined';var _0x4ed1a5=_0x4c22d5['count'];var _0x1a70aa=_0x4f11d8?0x0:_0x1e2cef[_0x522d('0x2b')];var _0x1cbb1a=_0x4f11d8?_0x4c22d5[_0x522d('0x2d')]:_0x1e2cef[_0x522d('0x2b')]+_0x1e2cef[_0x522d('0x2e')];var _0x55d922;if(_0x1cbb1a>=_0x4ed1a5){_0x1cbb1a=_0x4ed1a5;_0x55d922=0xc8;}else{_0x55d922=0xce;}_0x8de694[_0x522d('0x28')](_0x55d922);return _0x8de694[_0x522d('0x2f')](_0x522d('0x30'),_0x1a70aa+'-'+_0x1cbb1a+'/'+_0x4ed1a5)['json'](_0x4c22d5);}return null;};}function patchUpdates(_0xb0f930){return function(_0x20dd6e){try{jsonpatch[_0x522d('0x31')](_0x20dd6e,_0xb0f930,!![]);}catch(_0x1ec034){return BPromise[_0x522d('0x32')](_0x1ec034);}return _0x20dd6e['save']();};}function saveUpdates(_0x1aa5ec,_0x1241ce){return function(_0x2e04b5){if(_0x2e04b5){return _0x2e04b5[_0x522d('0x33')](_0x1aa5ec)['then'](function(_0x47fd8f){return _0x47fd8f;});}return null;};}function removeEntity(_0x3148bd,_0x2237df){return function(_0x24718c){if(_0x24718c){return _0x24718c[_0x522d('0x34')]()['then'](function(){var _0x1f3931=_0x24718c['get']({'plain':!![]});var _0xf93bab=_0x522d('0x35');return db[_0x522d('0x36')][_0x522d('0x34')]({'where':{'type':_0xf93bab,'resourceId':_0x1f3931['id']}})[_0x522d('0x37')](function(){return _0x24718c;});})[_0x522d('0x37')](function(){_0x3148bd[_0x522d('0x28')](0xcc)[_0x522d('0x29')]();});}};}function handleEntityNotFound(_0x50006e,_0x30720b){return function(_0xc612d){if(!_0xc612d){_0x50006e[_0x522d('0x27')](0x194);}return _0xc612d;};}function handleError(_0x2b30ee,_0x2b4c9f){_0x2b4c9f=_0x2b4c9f||0x1f4;return function(_0x4a795e){logger[_0x522d('0x23')](_0x4a795e[_0x522d('0x38')]);if(_0x4a795e[_0x522d('0x39')]){delete _0x4a795e['name'];}_0x2b30ee[_0x522d('0x28')](_0x2b4c9f)[_0x522d('0x3a')](_0x4a795e);};}exports[_0x522d('0x3b')]=function(_0x82f47c,_0x49949e){var _0x3b4a9e={'include':[{'model':db['Pause'],'as':_0x522d('0x3c')}]},_0x1a5702={},_0x2c245b={'count':0x0,'rows':[]};var _0x3288f3=_['map'](db[_0x522d('0x3d')][_0x522d('0x3e')],function(_0x46bae1){return{'name':_0x46bae1[_0x522d('0x3f')],'type':_0x46bae1[_0x522d('0x40')][_0x522d('0x41')]};});_0x1a5702['model']=_[_0x522d('0x42')](_0x3288f3,_0x522d('0x39'));_0x1a5702[_0x522d('0x43')]=_[_0x522d('0x44')](_0x82f47c[_0x522d('0x43')]);_0x1a5702[_0x522d('0x45')]=_['intersection'](_0x1a5702[_0x522d('0x46')],_0x1a5702[_0x522d('0x43')]);_0x3b4a9e[_0x522d('0x47')]=_[_0x522d('0x48')](_0x1a5702[_0x522d('0x46')],qs[_0x522d('0x49')](_0x82f47c['query']['fields']));_0x3b4a9e[_0x522d('0x47')]=_0x3b4a9e[_0x522d('0x47')]['length']?_0x3b4a9e['attributes']:_0x1a5702['model'];if(!_0x82f47c['query'][_0x522d('0x4a')](_0x522d('0x4b'))){_0x3b4a9e[_0x522d('0x2e')]=qs[_0x522d('0x2e')](_0x82f47c[_0x522d('0x43')]['limit']);_0x3b4a9e[_0x522d('0x2b')]=qs[_0x522d('0x2b')](_0x82f47c['query']['offset']);}_0x3b4a9e[_0x522d('0x4c')]=qs[_0x522d('0x4d')](_0x82f47c[_0x522d('0x43')]['sort']);_0x3b4a9e['where']=qs['filters'](_['pick'](_0x82f47c[_0x522d('0x43')],_0x1a5702[_0x522d('0x45')]),_0x3288f3);if(_0x82f47c['query'][_0x522d('0x4e')]){_0x3b4a9e[_0x522d('0x4f')]=_[_0x522d('0x50')](_0x3b4a9e[_0x522d('0x4f')],{'$or':_['map'](_0x3288f3,function(_0x3437b7){if(_0x3437b7[_0x522d('0x40')]!=='VIRTUAL'){var _0x4bf26c={};_0x4bf26c[_0x3437b7[_0x522d('0x39')]]={'$like':'%'+_0x82f47c[_0x522d('0x43')][_0x522d('0x4e')]+'%'};return _0x4bf26c;}})});}_0x3b4a9e=_['merge']({},_0x3b4a9e,_0x82f47c[_0x522d('0x51')]);var _0x369cea={'where':_0x3b4a9e[_0x522d('0x4f')]};return db[_0x522d('0x3d')][_0x522d('0x2d')](_0x369cea)[_0x522d('0x37')](function(_0x4b1991){_0x2c245b['count']=_0x4b1991;if(_0x82f47c[_0x522d('0x43')]['includeAll']){_0x3b4a9e['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x522d('0x52')](_0x3b4a9e);})['then'](function(_0xe0bb19){_0x2c245b[_0x522d('0x53')]=_0xe0bb19;return _0x2c245b;})[_0x522d('0x37')](respondWithFilteredResult(_0x49949e,_0x3b4a9e))['catch'](handleError(_0x49949e,null));};exports[_0x522d('0x54')]=function(_0x56bf27,_0x2c6539){var _0x52e406={'raw':![],'where':{'id':_0x56bf27['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x23985a={};_0x23985a[_0x522d('0x46')]=_[_0x522d('0x44')](db[_0x522d('0x3d')][_0x522d('0x3e')]);_0x23985a['query']=_['keys'](_0x56bf27['query']);_0x23985a[_0x522d('0x45')]=_['intersection'](_0x23985a['model'],_0x23985a[_0x522d('0x43')]);_0x52e406[_0x522d('0x47')]=_['intersection'](_0x23985a[_0x522d('0x46')],qs[_0x522d('0x49')](_0x56bf27['query'][_0x522d('0x49')]));_0x52e406['attributes']=_0x52e406[_0x522d('0x47')][_0x522d('0x55')]?_0x52e406[_0x522d('0x47')]:_0x23985a[_0x522d('0x46')];if(_0x56bf27[_0x522d('0x43')][_0x522d('0x56')]){_0x52e406['include']=[{'all':!![]}];}_0x52e406=_[_0x522d('0x50')]({},_0x52e406,_0x56bf27[_0x522d('0x51')]);return db[_0x522d('0x3d')][_0x522d('0x57')](_0x52e406)['then'](handleEntityNotFound(_0x2c6539,null))[_0x522d('0x37')](respondWithResult(_0x2c6539,null))[_0x522d('0x58')](handleError(_0x2c6539,null));};exports[_0x522d('0x59')]=function(_0x3ccc67,_0x290231){return db[_0x522d('0x3d')][_0x522d('0x59')](_0x3ccc67['body'],{})[_0x522d('0x37')](function(_0x4444df){var _0x155f10=_0x3ccc67['user'][_0x522d('0x5a')]({'plain':!![]});if(!_0x155f10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x155f10[_0x522d('0x5b')]===_0x522d('0x5c')){var _0x358089=_0x4444df[_0x522d('0x5a')]({'plain':!![]});var _0x40802a='WhatsappAccounts';return db[_0x522d('0x5d')][_0x522d('0x57')]({'where':{'name':_0x40802a,'userProfileId':_0x155f10['userProfileId']},'raw':!![]})[_0x522d('0x37')](function(_0x27652c){if(_0x27652c&&_0x27652c[_0x522d('0x5e')]===0x0){return db[_0x522d('0x36')][_0x522d('0x59')]({'name':_0x358089[_0x522d('0x39')],'resourceId':_0x358089['id'],'type':_0x27652c[_0x522d('0x39')],'sectionId':_0x27652c['id']},{})[_0x522d('0x37')](function(){return _0x4444df;});}else{return _0x4444df;}})[_0x522d('0x58')](function(_0x42edd9){logger['error'](_0x522d('0x5f'),_0x42edd9);throw _0x42edd9;});}return _0x4444df;})[_0x522d('0x37')](respondWithResult(_0x290231,0xc9))[_0x522d('0x58')](handleError(_0x290231,null));};exports[_0x522d('0x33')]=function(_0x4c9607,_0x357055){if(_0x4c9607['body']['id']){delete _0x4c9607[_0x522d('0x60')]['id'];}return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x4c9607['params']['id']},'include':[{'model':db[_0x522d('0x61')],'as':'mandatoryDispositionPause'}]})[_0x522d('0x37')](handleEntityNotFound(_0x357055,null))[_0x522d('0x37')](saveUpdates(_0x4c9607[_0x522d('0x60')],null))[_0x522d('0x37')](respondWithResult(_0x357055,null))[_0x522d('0x58')](handleError(_0x357055,null));};exports[_0x522d('0x34')]=function(_0x3394f9,_0xb4acb5){return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x3394f9[_0x522d('0x62')]['id']}})[_0x522d('0x37')](handleEntityNotFound(_0xb4acb5,null))[_0x522d('0x37')](removeEntity(_0xb4acb5,null))['catch'](handleError(_0xb4acb5,null));};exports['describe']=function(_0x42d601,_0x507b89){return db[_0x522d('0x3d')][_0x522d('0x63')]()[_0x522d('0x37')](respondWithResult(_0x507b89,null))['catch'](handleError(_0x507b89,null));};exports['addDisposition']=function(_0x1907f4,_0x238617,_0x3d20f7){if(_0x1907f4[_0x522d('0x60')]['id']){delete _0x1907f4[_0x522d('0x60')]['id'];}return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x1907f4[_0x522d('0x62')]['id']}})['then'](handleEntityNotFound(_0x238617,null))[_0x522d('0x37')](function(_0x83425a){if(_0x83425a){_0x1907f4[_0x522d('0x60')][_0x522d('0x64')]=_0x83425a['id'];return db[_0x522d('0x65')][_0x522d('0x59')](_0x1907f4['body']);}})[_0x522d('0x37')](respondWithResult(_0x238617,null))['catch'](handleError(_0x238617,null));};exports['getDispositions']=function(_0x6fc387,_0x1fb6b5,_0x210ac6){var _0x53d494={'raw':![],'where':{}};var _0x328da={};var _0x4670f2={'count':0x0,'rows':[]};return db[_0x522d('0x3d')][_0x522d('0x66')]({'where':{'id':_0x6fc387[_0x522d('0x62')]['id']}})[_0x522d('0x37')](handleEntityNotFound(_0x1fb6b5,null))[_0x522d('0x37')](function(_0x31309d){if(_0x31309d){_0x328da[_0x522d('0x46')]=_['keys'](db['Disposition'][_0x522d('0x3e')]);_0x328da['query']=_['keys'](_0x6fc387[_0x522d('0x43')]);_0x328da[_0x522d('0x45')]=_[_0x522d('0x48')](_0x328da[_0x522d('0x46')],_0x328da[_0x522d('0x43')]);_0x53d494['attributes']=_[_0x522d('0x48')](_0x328da['model'],qs[_0x522d('0x49')](_0x6fc387[_0x522d('0x43')][_0x522d('0x49')]));_0x53d494[_0x522d('0x47')]=_0x53d494[_0x522d('0x47')][_0x522d('0x55')]?_0x53d494['attributes']:_0x328da['model'];if(!_0x6fc387[_0x522d('0x43')][_0x522d('0x4a')](_0x522d('0x4b'))){_0x53d494[_0x522d('0x2e')]=qs['limit'](_0x6fc387['query'][_0x522d('0x2e')]);_0x53d494['offset']=qs[_0x522d('0x2b')](_0x6fc387[_0x522d('0x43')]['offset']);}_0x53d494['order']=qs['sort'](_0x6fc387[_0x522d('0x43')][_0x522d('0x4d')]);_0x53d494[_0x522d('0x4f')]=qs[_0x522d('0x45')](_[_0x522d('0x67')](_0x6fc387['query'],_0x328da[_0x522d('0x45')]));_0x53d494[_0x522d('0x4f')][_0x522d('0x64')]=_0x31309d['id'];if(_0x6fc387['query'][_0x522d('0x4e')]){_0x53d494[_0x522d('0x4f')]=_[_0x522d('0x50')](_0x53d494[_0x522d('0x4f')],{'$or':_[_0x522d('0x42')](_0x53d494[_0x522d('0x47')],function(_0x24e0d7){var _0x5dfa50={};_0x5dfa50[_0x24e0d7]={'$like':'%'+_0x6fc387[_0x522d('0x43')][_0x522d('0x4e')]+'%'};return _0x5dfa50;})});}_0x53d494=_[_0x522d('0x50')]({},_0x53d494,_0x6fc387['options']);return db[_0x522d('0x65')]['count']({'where':_0x53d494[_0x522d('0x4f')]})[_0x522d('0x37')](function(_0x4832dc){_0x4670f2[_0x522d('0x2d')]=_0x4832dc;if(_0x6fc387[_0x522d('0x43')][_0x522d('0x56')]){_0x53d494[_0x522d('0x68')]=[{'all':!![]}];}return db['Disposition'][_0x522d('0x52')](_0x53d494);})[_0x522d('0x37')](function(_0x255531){_0x4670f2[_0x522d('0x53')]=_0x255531;return _0x4670f2;});}})['then'](respondWithFilteredResult(_0x1fb6b5,_0x53d494))[_0x522d('0x58')](handleError(_0x1fb6b5,null));};exports[_0x522d('0x69')]=function(_0x1692b8,_0x44e685,_0x39fb49){return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x1692b8[_0x522d('0x62')]['id']}})[_0x522d('0x37')](handleEntityNotFound(_0x44e685,null))['then'](function(_0x7078b7){if(_0x7078b7){return _0x7078b7[_0x522d('0x69')](_0x1692b8[_0x522d('0x43')][_0x522d('0x6a')]);}})[_0x522d('0x37')](respondWithStatusCode(_0x44e685,null))[_0x522d('0x58')](handleError(_0x44e685,null));};exports['addAnswer']=function(_0x2fd544,_0x466ccc,_0x995b64){if(_0x2fd544[_0x522d('0x60')]['id']){delete _0x2fd544['body']['id'];}return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x2fd544[_0x522d('0x62')]['id']}})[_0x522d('0x37')](handleEntityNotFound(_0x466ccc,null))[_0x522d('0x37')](function(_0x13eb7c){if(_0x13eb7c){_0x2fd544[_0x522d('0x60')]['WhatsappAccountId']=_0x13eb7c['id'];return db['CannedAnswer'][_0x522d('0x59')](_0x2fd544[_0x522d('0x60')]);}})[_0x522d('0x37')](respondWithResult(_0x466ccc,null))['catch'](handleError(_0x466ccc,null));};exports[_0x522d('0x6b')]=function(_0xd80b5d,_0x728fa9,_0x512b7c){var _0x50171f={'raw':![],'where':{}};var _0x189527={};var _0xea6ad={'count':0x0,'rows':[]};return db[_0x522d('0x3d')][_0x522d('0x66')]({'where':{'id':_0xd80b5d[_0x522d('0x62')]['id']}})['then'](handleEntityNotFound(_0x728fa9,null))[_0x522d('0x37')](function(_0x145e09){if(_0x145e09){_0x189527[_0x522d('0x46')]=_['keys'](db[_0x522d('0x6c')][_0x522d('0x3e')]);_0x189527['query']=_[_0x522d('0x44')](_0xd80b5d[_0x522d('0x43')]);_0x189527[_0x522d('0x45')]=_['intersection'](_0x189527[_0x522d('0x46')],_0x189527['query']);_0x50171f[_0x522d('0x47')]=_[_0x522d('0x48')](_0x189527[_0x522d('0x46')],qs[_0x522d('0x49')](_0xd80b5d['query'][_0x522d('0x49')]));_0x50171f['attributes']=_0x50171f[_0x522d('0x47')][_0x522d('0x55')]?_0x50171f[_0x522d('0x47')]:_0x189527[_0x522d('0x46')];if(!_0xd80b5d['query'][_0x522d('0x4a')](_0x522d('0x4b'))){_0x50171f[_0x522d('0x2e')]=qs[_0x522d('0x2e')](_0xd80b5d[_0x522d('0x43')][_0x522d('0x2e')]);_0x50171f[_0x522d('0x2b')]=qs[_0x522d('0x2b')](_0xd80b5d[_0x522d('0x43')][_0x522d('0x2b')]);}_0x50171f[_0x522d('0x4c')]=qs[_0x522d('0x4d')](_0xd80b5d[_0x522d('0x43')][_0x522d('0x4d')]);_0x50171f['where']=qs[_0x522d('0x45')](_[_0x522d('0x67')](_0xd80b5d[_0x522d('0x43')],_0x189527[_0x522d('0x45')]));_0x50171f['where']['WhatsappAccountId']=_0x145e09['id'];if(_0xd80b5d['query']['filter']){_0x50171f['where']=_[_0x522d('0x50')](_0x50171f[_0x522d('0x4f')],{'$or':_[_0x522d('0x42')](_0x50171f[_0x522d('0x47')],function(_0x559ea2){var _0x5620ec={};_0x5620ec[_0x559ea2]={'$like':'%'+_0xd80b5d[_0x522d('0x43')][_0x522d('0x4e')]+'%'};return _0x5620ec;})});}_0x50171f=_[_0x522d('0x50')]({},_0x50171f,_0xd80b5d[_0x522d('0x51')]);return db[_0x522d('0x6c')][_0x522d('0x2d')]({'where':_0x50171f['where']})[_0x522d('0x37')](function(_0x1a2878){_0xea6ad['count']=_0x1a2878;if(_0xd80b5d[_0x522d('0x43')][_0x522d('0x56')]){_0x50171f['include']=[{'all':!![]}];}return db[_0x522d('0x6c')]['findAll'](_0x50171f);})[_0x522d('0x37')](function(_0x12b9ad){_0xea6ad[_0x522d('0x53')]=_0x12b9ad;return _0xea6ad;});}})['then'](respondWithFilteredResult(_0x728fa9,_0x50171f))['catch'](handleError(_0x728fa9,null));};exports[_0x522d('0x6d')]=function(_0x2a83c3,_0x19498c,_0x1b0c08){return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x2a83c3[_0x522d('0x62')]['id']}})[_0x522d('0x37')](handleEntityNotFound(_0x19498c,null))[_0x522d('0x37')](function(_0x3e6516){if(_0x3e6516){return _0x3e6516['removeAnswers'](_0x2a83c3[_0x522d('0x43')][_0x522d('0x6a')]);}})[_0x522d('0x37')](respondWithStatusCode(_0x19498c,null))[_0x522d('0x58')](handleError(_0x19498c,null));};exports[_0x522d('0x6e')]=function(_0x5419e7,_0x347ed0,_0xc33770){return db[_0x522d('0x3d')]['find']({'where':{'id':_0x5419e7[_0x522d('0x62')]['id']}})[_0x522d('0x37')](handleEntityNotFound(_0x347ed0,null))['then'](function(_0x1270b4){if(_0x1270b4){return _0x1270b4[_0x522d('0x6e')](_0x5419e7[_0x522d('0x60')][_0x522d('0x6a')],_[_0x522d('0x6f')](_0x5419e7[_0x522d('0x60')],[_0x522d('0x6a'),'id'])||{})[_0x522d('0x70')](function(_0x34b11f){for(var _0x429d72=0x0;_0x429d72<_0x5419e7[_0x522d('0x60')][_0x522d('0x6a')][_0x522d('0x55')];_0x429d72+=0x1){socket[_0x522d('0x71')](_0x522d('0x72'),{'UserId':Number(_0x5419e7['body']['ids'][_0x429d72]),'WhatsappAccountId':Number(_0x5419e7[_0x522d('0x62')]['id'])});}return _0x34b11f;});}})[_0x522d('0x37')](respondWithResult(_0x347ed0,null))['catch'](handleError(_0x347ed0,null));};exports['removeAgents']=function(_0x1d1272,_0x390ba3,_0x1a2248){return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x1d1272[_0x522d('0x62')]['id']}})[_0x522d('0x37')](handleEntityNotFound(_0x390ba3,null))[_0x522d('0x37')](function(_0x2971b9){if(_0x2971b9){return _0x2971b9['removeAgents'](_0x1d1272[_0x522d('0x43')][_0x522d('0x6a')])[_0x522d('0x37')](function(){if(_[_0x522d('0x73')](_0x1d1272[_0x522d('0x43')][_0x522d('0x6a')])){for(var _0x1fcb0d=0x0;_0x1fcb0d<_0x1d1272[_0x522d('0x43')][_0x522d('0x6a')]['length'];_0x1fcb0d+=0x1){socket[_0x522d('0x71')](_0x522d('0x74'),{'UserId':Number(_0x1d1272[_0x522d('0x43')]['ids'][_0x1fcb0d]),'WhatsappAccountId':Number(_0x1d1272[_0x522d('0x62')]['id'])});}}else{socket[_0x522d('0x71')](_0x522d('0x74'),{'UserId':Number(_0x1d1272['query'][_0x522d('0x6a')]),'WhatsappAccountId':Number(_0x1d1272[_0x522d('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x390ba3,null))[_0x522d('0x58')](handleError(_0x390ba3,null));};exports[_0x522d('0x75')]=function(_0x5311e6,_0x2c3795,_0x33720d){var _0x52b62d={};var _0x55bbc9={};var _0x21cbc1;var _0x30fd9e;return db['WhatsappAccount'][_0x522d('0x66')]({'where':{'id':_0x5311e6['params']['id']}})[_0x522d('0x37')](handleEntityNotFound(_0x2c3795,null))[_0x522d('0x37')](function(_0x55a803){if(_0x55a803){_0x21cbc1=_0x55a803;_0x55bbc9[_0x522d('0x46')]=_[_0x522d('0x44')](db[_0x522d('0x76')][_0x522d('0x3e')]);_0x55bbc9[_0x522d('0x43')]=_[_0x522d('0x44')](_0x5311e6[_0x522d('0x43')]);_0x55bbc9[_0x522d('0x45')]=_[_0x522d('0x48')](_0x55bbc9['model'],_0x55bbc9[_0x522d('0x43')]);_0x52b62d[_0x522d('0x47')]=_['intersection'](_0x55bbc9[_0x522d('0x46')],qs[_0x522d('0x49')](_0x5311e6[_0x522d('0x43')]['fields']));_0x52b62d['attributes']=_0x52b62d[_0x522d('0x47')][_0x522d('0x55')]?_0x52b62d[_0x522d('0x47')]:_0x55bbc9[_0x522d('0x46')];_0x52b62d['order']=qs['sort'](_0x5311e6[_0x522d('0x43')]['sort']);_0x52b62d[_0x522d('0x4f')]=qs['filters'](_[_0x522d('0x67')](_0x5311e6[_0x522d('0x43')],_0x55bbc9[_0x522d('0x45')]));if(_0x5311e6[_0x522d('0x43')]['filter']){_0x52b62d['where']=_[_0x522d('0x50')](_0x52b62d[_0x522d('0x4f')],{'$or':_[_0x522d('0x42')](_0x52b62d['attributes'],function(_0x49808a){var _0x5e7b85={};_0x5e7b85[_0x49808a]={'$like':'%'+_0x5311e6[_0x522d('0x43')][_0x522d('0x4e')]+'%'};return _0x5e7b85;})});}_0x52b62d=_[_0x522d('0x50')]({},_0x52b62d,_0x5311e6[_0x522d('0x51')]);return _0x21cbc1['getAgents'](_0x52b62d);}})[_0x522d('0x37')](function(_0x18200b){if(_0x18200b){_0x30fd9e=_0x18200b[_0x522d('0x55')];if(!_0x5311e6['query'][_0x522d('0x4a')](_0x522d('0x4b'))){_0x52b62d['limit']=qs[_0x522d('0x2e')](_0x5311e6[_0x522d('0x43')][_0x522d('0x2e')]);_0x52b62d['offset']=qs['offset'](_0x5311e6['query'][_0x522d('0x2b')]);}return _0x21cbc1[_0x522d('0x75')](_0x52b62d);}})['then'](function(_0x241c83){if(_0x241c83){return _0x241c83?{'count':_0x30fd9e,'rows':_0x241c83}:null;}})['then'](respondWithResult(_0x2c3795,null))[_0x522d('0x58')](handleError(_0x2c3795,null));};exports[_0x522d('0x77')]=function(_0x546c27,_0xf78b19){var _0x535bd8=_0x546c27[_0x522d('0x62')]['id'];var _0x1d1be5=_0x546c27['body'];var _0x3e5001=0xc8;var _0x27bd1a=null;return db[_0x522d('0x78')]['transaction']({'isolationLevel':db['sequelize'][_0x522d('0x79')][_0x522d('0x7a')][_0x522d('0x7b')]},function(_0x2b2dc2){return db[_0x522d('0x3d')]['findOne']({'where':{'id':_0x535bd8},'transaction':_0x2b2dc2})['then'](function(_0x71242){if(_0x71242){return db[_0x522d('0x7c')][_0x522d('0x34')]({'where':{'WhatsappAccountId':_0x535bd8},'transaction':_0x2b2dc2})[_0x522d('0x37')](function(){var _0xcbf6cf=_[_0x522d('0x42')](_0x1d1be5,function(_0x3eb3d1){_0x3eb3d1['WhatsappAccountId']=_0x535bd8;return _0x3eb3d1;});return db['WhatsappApplication'][_0x522d('0x7d')](_0xcbf6cf,{'transaction':_0x2b2dc2});});}else{_0x3e5001=0x194;_0x27bd1a=[];}});})[_0x522d('0x37')](function(){if(_0x3e5001!==0x194){return db[_0x522d('0x7c')][_0x522d('0x7e')]({'where':{'WhatsappAccountId':_0x535bd8},'order':'priority'})[_0x522d('0x37')](function(_0x18d414){_0x27bd1a=_0x18d414;});}})['catch'](function(_0x5b5856){_0x3e5001=0x1f4;logger[_0x522d('0x23')](_0x5b5856[_0x522d('0x38')]);if(_0x5b5856[_0x522d('0x39')]){delete _0x5b5856[_0x522d('0x39')];}_0x27bd1a=_0x5b5856;})[_0x522d('0x7f')](function(){if(_0x27bd1a===null){_0xf78b19[_0x522d('0x27')](_0x3e5001);}else{if(_0x3e5001===0x1f4){_0xf78b19[_0x522d('0x28')](_0x3e5001)[_0x522d('0x3a')](_0x27bd1a);}else{_0xf78b19['status'](_0x3e5001)[_0x522d('0x2a')](_0x27bd1a);}}});};exports[_0x522d('0x80')]=function(_0x3200a4,_0x262bc6,_0x2c27bd){var _0x5f10b4={};var _0x16fa92={};var _0x31c089;var _0x5c015d;return db[_0x522d('0x3d')][_0x522d('0x66')]({'where':{'id':_0x3200a4[_0x522d('0x62')]['id']}})['then'](handleEntityNotFound(_0x262bc6,null))[_0x522d('0x37')](function(_0x2cb076){if(_0x2cb076){_0x31c089=_0x2cb076;_0x16fa92[_0x522d('0x46')]=_['keys'](db[_0x522d('0x7c')]['rawAttributes']);_0x16fa92['query']=_[_0x522d('0x44')](_0x3200a4[_0x522d('0x43')]);_0x16fa92[_0x522d('0x45')]=_['intersection'](_0x16fa92['model'],_0x16fa92[_0x522d('0x43')]);_0x5f10b4['attributes']=_['intersection'](_0x16fa92[_0x522d('0x46')],qs[_0x522d('0x49')](_0x3200a4['query'][_0x522d('0x49')]));_0x5f10b4[_0x522d('0x47')]=_0x5f10b4['attributes'][_0x522d('0x55')]?_0x5f10b4[_0x522d('0x47')]:_0x16fa92[_0x522d('0x46')];_0x5f10b4['order']=qs[_0x522d('0x4d')](_0x3200a4[_0x522d('0x43')][_0x522d('0x4d')]);_0x5f10b4[_0x522d('0x4f')]=qs[_0x522d('0x45')](_['pick'](_0x3200a4[_0x522d('0x43')],_0x16fa92[_0x522d('0x45')]));if(_0x3200a4[_0x522d('0x43')][_0x522d('0x4e')]){_0x5f10b4[_0x522d('0x4f')]=_[_0x522d('0x50')](_0x5f10b4[_0x522d('0x4f')],{'$or':_[_0x522d('0x42')](_0x5f10b4[_0x522d('0x47')],function(_0x147efc){var _0x4c0e6e={};_0x4c0e6e[_0x147efc]={'$like':'%'+_0x3200a4[_0x522d('0x43')][_0x522d('0x4e')]+'%'};return _0x4c0e6e;})});}_0x5f10b4=_[_0x522d('0x50')]({},_0x5f10b4,_0x3200a4[_0x522d('0x51')]);return _0x31c089[_0x522d('0x80')](_0x5f10b4);}})[_0x522d('0x37')](function(_0x21ee34){if(_0x21ee34){_0x5c015d=_0x21ee34[_0x522d('0x55')];if(!_0x3200a4[_0x522d('0x43')][_0x522d('0x4a')](_0x522d('0x4b'))){_0x5f10b4[_0x522d('0x2e')]=qs['limit'](_0x3200a4[_0x522d('0x43')][_0x522d('0x2e')]);_0x5f10b4['offset']=qs[_0x522d('0x2b')](_0x3200a4[_0x522d('0x43')][_0x522d('0x2b')]);}return _0x31c089[_0x522d('0x80')](_0x5f10b4);}})[_0x522d('0x37')](function(_0x3618a6){if(_0x3618a6){return _0x3618a6?{'count':_0x5c015d,'rows':_0x3618a6}:null;}})[_0x522d('0x37')](respondWithResult(_0x262bc6,null))[_0x522d('0x58')](handleError(_0x262bc6,null));};exports[_0x522d('0x81')]=function(_0x40d2f3,_0x563763,_0x360236){var _0x374471={'channel':_0x522d('0x82')};var _0xb099d5=[];var _0x22870c=[];var _0x43cc76={};return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x40d2f3[_0x522d('0x62')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x522d('0x83')}]})[_0x522d('0x37')](handleEntityNotFound(_0x563763,null))['then'](function(_0x1c3d3b){_0x374471['account']=_0x1c3d3b;if(_0x374471[_0x522d('0x84')]&&_0x374471['account'][_0x522d('0x40')]===_0x522d('0x85')&&_0x40d2f3['body'][_0x522d('0x86')]){if(_0x40d2f3[_0x522d('0x60')][_0x522d('0x86')]['length']===0x0)return;if(_0x40d2f3[_0x522d('0x60')][_0x522d('0x86')][0x0][_0x522d('0x87')]!==_0x522d('0x88'))return;return db[_0x522d('0x89')][_0x522d('0x33')]({'read':!![],'readAt':_0x40d2f3[_0x522d('0x60')][_0x522d('0x86')][0x0][_0x522d('0x8a')]},{'where':{'messageId':_0x40d2f3[_0x522d('0x60')][_0x522d('0x86')][0x0][_0x522d('0x8b')]},'individualHooks':!![]})[_0x522d('0x37')](function(_0x33a3ce){return _0x563763['status'](0xc8)['json'](_0x33a3ce);});}_0x374471[_0x522d('0x8c')]=_[_0x522d('0x8d')](_0x1c3d3b[_0x522d('0x83')],[_0x522d('0x8e')],[_0x522d('0x8f')]);if(_0x374471[_0x522d('0x84')][_0x522d('0x83')]){delete _0x374471[_0x522d('0x84')]['Applications'];}return db[_0x522d('0x90')]['describe']()[_0x522d('0x37')](function(_0x6816d9){if(!_0x6816d9){throw new db[(_0x522d('0x91'))][(_0x522d('0x92'))](_0x522d('0x93'));}_0xb099d5=_['difference'](_[_0x522d('0x44')](_0x6816d9),['createdAt',_0x522d('0x94')]);_0x22870c=_['difference'](_[_0x522d('0x44')](_0x6816d9),['createdAt',_0x522d('0x94'),_0x522d('0x95'),_0x522d('0x96')]);_0x374471[_0x522d('0x60')]={'mapKey':_0x522d('0x97')};if(_0x374471[_0x522d('0x84')]&&_0x374471[_0x522d('0x84')]['type']===_0x522d('0x98')){_0x374471['body'][_0x522d('0x99')]=_0x40d2f3['body']['From'][_0x522d('0x9a')](_0x522d('0x9b'),'');_0x374471[_0x522d('0x60')][_0x522d('0x60')]=_0x40d2f3[_0x522d('0x60')][_0x522d('0x9c')];_0x374471['body'][_0x522d('0x9d')]=_0x40d2f3[_0x522d('0x60')][_0x522d('0x9e')];}if(_0x374471[_0x522d('0x84')]&&_0x374471[_0x522d('0x84')][_0x522d('0x40')]===_0x522d('0x85')){_0x374471[_0x522d('0x60')][_0x522d('0x99')]=_0x40d2f3[_0x522d('0x60')][_0x522d('0x9f')][0x0][_0x522d('0x99')];_0x374471[_0x522d('0x60')][_0x522d('0x60')]=_0x40d2f3['body'][_0x522d('0x9f')][0x0]['message'][_0x522d('0x60')];_0x374471[_0x522d('0x60')][_0x522d('0x9d')]=_0x40d2f3[_0x522d('0x60')][_0x522d('0x9f')][0x0][_0x522d('0x8b')];}if(_0x374471[_0x522d('0x60')]['id']){delete _0x374471[_0x522d('0x60')]['id'];}if(_[_0x522d('0xa0')](_0x374471['body'][_0x522d('0x99')])){throw new db['Sequelize'][(_0x522d('0x92'))]('from\x20is\x20mandatory');}if(_[_0x522d('0xa0')](_0x374471['body'][_0x522d('0x60')])||_0x374471[_0x522d('0x60')][_0x522d('0x60')]===''){throw new db[(_0x522d('0x91'))][(_0x522d('0x92'))](_0x522d('0xa1'));}if(_[_0x522d('0xa0')](_0x374471['body'][_0x522d('0xa2')])){throw new db[(_0x522d('0x91'))][(_0x522d('0x92'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x22870c);}if(!_['includes'](_0x22870c,_0x374471[_0x522d('0x60')][_0x522d('0xa2')])){throw new db[(_0x522d('0x91'))][(_0x522d('0x92'))](_0x522d('0xa3')+_0x22870c);}_0x43cc76[_0x374471[_0x522d('0x60')]['mapKey']]=_0x374471[_0x522d('0x60')][_0x522d('0x99')];return db[_0x522d('0xa4')][_0x522d('0x57')]({'where':{'id':_0x374471[_0x522d('0x84')][_0x522d('0x96')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x43cc76,'limit':0x1,'order':[[_0x522d('0x94'),_0x522d('0xa5')]]}]});})[_0x522d('0x37')](handleEntityNotFound(_0x563763,null))['then'](function(_0x43330b){if(_0x43330b){_0x374471[_0x522d('0xa6')]=_['omit'](_0x43330b,[_0x522d('0xa7')]);if(_0x43330b[_0x522d('0xa7')][_0x522d('0x55')]){return _0x43330b[_0x522d('0xa7')][0x0];}var _0x37043b=_[_0x522d('0x17')](_0x374471['body'],{'firstName':_0x374471[_0x522d('0x60')]['from'],'ListId':_0x43330b['id']});_0x37043b[_0x374471[_0x522d('0x60')][_0x522d('0xa2')]]=_0x374471[_0x522d('0x60')][_0x522d('0x99')];return db['CmContact']['create'](_0x37043b,{'fields':_0xb099d5,'raw':!![]});}})['then'](handleEntityNotFound(_0x563763,null))['then'](function(_0x728715){if(_0x728715){_0x374471[_0x522d('0xa8')]=_0x728715;var _0x59b091={'ContactId':_0x728715['id'],'phone':_0x374471[_0x522d('0x60')][_0x522d('0x99')],'WhatsappAccountId':_0x40d2f3['params']['id']};var _0x214736={'ContactId':_0x728715['id'],'WhatsappAccountId':_0x40d2f3[_0x522d('0x62')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x522d('0x57')]({'where':_0x214736})['then'](function(_0x2b25ca){if(_0x2b25ca){return[_0x2b25ca,![]];}return db['WhatsappInteraction'][_0x522d('0x59')](_0x59b091)[_0x522d('0x37')](function(_0x20339e){return[_0x20339e,!![]];});});}})['spread'](function(_0x1dbdee,_0x21bc89){_0x374471[_0x522d('0xa9')]=_0x1dbdee[_0x522d('0x5a')]({'plain':!![]});_0x374471[_0x522d('0xa9')][_0x522d('0xaa')]=![];if(_0x21bc89){if(_0x374471[_0x522d('0x84')][_0x522d('0xab')]){_0x374471['applications'][_0x522d('0xac')]({'id':0x0,'priority':_0x374471[_0x522d('0x8c')][_0x522d('0x55')]+0x1,'app':_0x522d('0xad'),'appdata':_0x522d('0xae'),'interval':_0x522d('0xaf')});}_0x374471[_0x522d('0xa9')][_0x522d('0xaa')]=!![];}return db[_0x522d('0x89')][_0x522d('0x59')]({'phone':_0x374471[_0x522d('0x60')]['from'],'messageId':_0x374471[_0x522d('0x60')][_0x522d('0x9d')],'body':_0x374471[_0x522d('0x60')][_0x522d('0x60')],'WhatsappAccountId':_0x40d2f3['params']['id'],'WhatsappInteractionId':_0x1dbdee['id'],'direction':'in','ContactId':_0x1dbdee[_0x522d('0xb0')],'AttachmentId':_0x374471['body'][_0x522d('0xb1')]});})[_0x522d('0x37')](function(_0x5e3b7d){_0x374471['message']=_0x5e3b7d;if(!_0x374471[_0x522d('0xa9')]['UserId'])return;return db[_0x522d('0x76')][_0x522d('0x57')]({'attributes':['id',_0x522d('0x39')],'where':{'id':_0x374471['interaction']['UserId']}});})[_0x522d('0x37')](function(_0x58a72b){if(_0x58a72b){_0x374471[_0x522d('0x8c')][_0x522d('0xb2')]({'id':0x0,'priority':0x0,'app':_0x522d('0xb3'),'appdata':_0x58a72b['name']+','+(_0x374471[_0x522d('0x84')][_0x522d('0xb4')]||0xa),'interval':_0x522d('0xaf')});}if(!_0x374471[_0x522d('0xa9')][_0x522d('0xb5')])return;return db['WhatsappQueue']['find']({'attributes':['id',_0x522d('0x39')],'where':{'id':_0x374471[_0x522d('0xa9')][_0x522d('0xb5')]}});})['then'](function(_0x4a2698){if(_0x4a2698){_0x374471[_0x522d('0x8c')][_0x522d('0xb2')]({'id':0x0,'priority':0x1,'app':_0x522d('0xb6'),'appdata':_0x4a2698['name']+','+(_0x374471[_0x522d('0x84')][_0x522d('0xb7')]||0x12c),'interval':_0x522d('0xaf')});}return respondWithRpcPromise(_0x522d('0xb8'),'startRouting',_0x374471);})['then'](function(_0x3ace1a){if(_0x3ace1a){var _0x4dc787=0xc8;var _0x5bf9f6=_0x522d('0xb9');logger['info'](_0x522d('0x21'),_0x5bf9f6,_0x4dc787,_0x522d('0xba'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5bf9f6,_0x4dc787,'entity\x20found',JSON[_0x522d('0x22')](_0x3ace1a));if(_0x374471['account'][_0x522d('0x40')]==='twilio'){return _0x563763[_0x522d('0x28')](_0x4dc787)[_0x522d('0x2f')](_0x522d('0xbb'),'text/xml')[_0x522d('0x3a')]('\x0a');}else{return _0x563763[_0x522d('0x28')](_0x4dc787)['json'](_0x3ace1a);}}});})[_0x522d('0x58')](handleError(_0x563763,null));};exports[_0x522d('0x3a')]=function(_0x3d87c8,_0x489b4f,_0x5168c3){var _0x560ac3,_0x388bdc,_0x1873e7;if(_['isNil'](_0x3d87c8[_0x522d('0x60')][_0x522d('0x60')])||_0x3d87c8[_0x522d('0x60')][_0x522d('0x60')]===''){throw new db[(_0x522d('0x91'))][(_0x522d('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x522d('0xa0')](_0x3d87c8[_0x522d('0x60')]['to'])){throw new db[(_0x522d('0x91'))][(_0x522d('0x92'))](_0x522d('0xbc'));}_0x560ac3=_0x3d87c8[_0x522d('0x60')]['to'];return db['WhatsappAccount'][_0x522d('0x57')]({'where':{'id':_0x3d87c8[_0x522d('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0x522d('0xbd'),'include':[{'model':db[_0x522d('0x90')],'as':_0x522d('0xa7'),'where':{'mobile':_0x560ac3},'limit':0x1,'order':[[_0x522d('0x94'),'DESC']]}]}]})[_0x522d('0x37')](handleEntityNotFound(_0x489b4f,null))['then'](function(_0x3d5955){if(_0x3d5955&&_0x3d5955[_0x522d('0xbd')]){_0x388bdc=_0x3d5955['get']({'plain':!![]});if(_0x388bdc[_0x522d('0xbd')]&&_0x388bdc[_0x522d('0xbd')][_0x522d('0xa7')][_0x522d('0x55')]){return _0x388bdc[_0x522d('0xbd')][_0x522d('0xa7')][0x0];}return db[_0x522d('0x90')][_0x522d('0x59')](_[_0x522d('0x17')](_0x3d87c8['body'],{'firstName':_0x560ac3,'mobile':_0x560ac3,'phone':_0x560ac3,'ListId':_0x388bdc[_0x522d('0x96')]}));}})[_0x522d('0x37')](handleEntityNotFound(_0x489b4f,null))['then'](function(_0x579e38){if(_0x579e38){_0x1873e7=_0x579e38;return db['WhatsappInteraction'][_0x522d('0x57')]({'where':{'ContactId':_0x1873e7['id'],'closed':![],'WhatsappAccountId':_0x388bdc['id']}})[_0x522d('0x37')](function(_0x42113e){if(_0x42113e){return[_0x42113e,![]];}return db[_0x522d('0xbe')][_0x522d('0x59')]({'UserId':_0x3d87c8[_0x522d('0x5c')]['id'],'ContactId':_0x1873e7['id'],'WhatsappAccountId':_0x388bdc['id'],'phone':_0x560ac3,'firstMsgDirection':_0x522d('0xbf'),'Messages':[_[_0x522d('0x50')](_0x3d87c8[_0x522d('0x60')],{'read':![],'body':_0x3d87c8[_0x522d('0x60')]['body'],'phone':_0x560ac3,'WhatsappAccountId':_0x388bdc['id'],'UserId':_0x3d87c8[_0x522d('0x5c')]['id'],'ContactId':_0x1873e7['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x522d('0xc0')}]})[_0x522d('0x37')](function(_0x4bd303){return[_0x4bd303,!![]];});});}})[_0x522d('0x70')](function(_0x47c740,_0x2ddc31){if(_0x2ddc31){return _0x47c740;}return db[_0x522d('0x89')][_0x522d('0x59')](_['merge'](_0x3d87c8['body'],{'read':![],'body':_0x3d87c8[_0x522d('0x60')][_0x522d('0x60')],'phone':_0x560ac3,'WhatsappAccountId':_0x388bdc['id'],'WhatsappInteractionId':_0x47c740['id'],'UserId':_0x3d87c8[_0x522d('0x5c')]['id'],'ContactId':_0x1873e7['id']}))['then'](function(_0x5302fd){_0x47c740[_0x522d('0xc1')]['Messages']=[];_0x47c740[_0x522d('0xc1')][_0x522d('0xc0')]['push'](_0x5302fd[_0x522d('0xc1')]);return _0x47c740;});})[_0x522d('0x37')](respondWithResult(_0x489b4f,null))[_0x522d('0x58')](handleError(_0x489b4f,null));}; \ No newline at end of file +var _0x6a14=['user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','findOne','pick','WhatsappAccountId','options','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','nolimit','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','sinch','statuses','read','WhatsappMessage','timestamp','message_id','applications','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','Body','messageId','from','notifications','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','text/xml','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','show','params','length','find','create','body'];(function(_0x86eec7,_0xb62ed5){var _0x4b8534=function(_0x2e96dc){while(--_0x2e96dc){_0x86eec7['push'](_0x86eec7['shift']());}};_0x4b8534(++_0xb62ed5);}(_0x6a14,0x13c));var _0x46a1=function(_0x3d4b81,_0x5defb7){_0x3d4b81=_0x3d4b81-0x0;var _0x282334=_0x6a14[_0x3d4b81];return _0x282334;};'use strict';var emlformat=require(_0x46a1('0x0'));var rimraf=require(_0x46a1('0x1'));var zipdir=require(_0x46a1('0x2'));var jsonpatch=require(_0x46a1('0x3'));var rp=require(_0x46a1('0x4'));var moment=require('moment');var BPromise=require(_0x46a1('0x5'));var Mustache=require(_0x46a1('0x6'));var util=require(_0x46a1('0x7'));var path=require(_0x46a1('0x8'));var sox=require(_0x46a1('0x9'));var csv=require(_0x46a1('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46a1('0xb'));var squel=require(_0x46a1('0xc'));var crypto=require(_0x46a1('0xd'));var jsforce=require(_0x46a1('0xe'));var deskjs=require(_0x46a1('0xf'));var toCsv=require(_0x46a1('0xa'));var querystring=require(_0x46a1('0x10'));var Papa=require(_0x46a1('0x11'));var Redis=require(_0x46a1('0x12'));var authService=require(_0x46a1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x46a1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46a1('0x15'))(_0x46a1('0x16'));var utils=require(_0x46a1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x46a1('0x18'));var db=require('../../mysqldb')['db'];config[_0x46a1('0x19')]=_[_0x46a1('0x1a')](config[_0x46a1('0x19')],{'host':_0x46a1('0x1b'),'port':0x18eb});var socket=require(_0x46a1('0x1c'))(new Redis(config[_0x46a1('0x19')]));require(_0x46a1('0x1d'))[_0x46a1('0x1e')](socket);var jayson=require(_0x46a1('0x1f'));var client=jayson[_0x46a1('0x20')][_0x46a1('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x3b5be8,_0x5c529f,_0x158c73,_0x11ea07){return new BPromise(function(_0x434893,_0xe6666d){var _0x54037f=_0x11ea07||client;return _0x54037f[_0x46a1('0x22')](_0x3b5be8,_0x158c73)[_0x46a1('0x23')](function(_0x242f16){logger['info'](_0x46a1('0x24'),_0x5c529f,_0x46a1('0x25'));logger[_0x46a1('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5c529f,_0x46a1('0x25'),JSON['stringify'](_0x242f16));if(_0x242f16['error']){if(_0x242f16[_0x46a1('0x27')][_0x46a1('0x28')]===0x1f4){logger[_0x46a1('0x27')](_0x46a1('0x24'),_0x5c529f,_0x242f16[_0x46a1('0x27')][_0x46a1('0x29')]);return _0xe6666d(_0x242f16[_0x46a1('0x27')][_0x46a1('0x29')]);}logger['error'](_0x46a1('0x24'),_0x5c529f,_0x242f16['error'][_0x46a1('0x29')]);return _0x434893(_0x242f16[_0x46a1('0x27')][_0x46a1('0x29')]);}else{logger[_0x46a1('0x2a')](_0x46a1('0x24'),_0x5c529f,_0x46a1('0x25'));_0x434893(_0x242f16[_0x46a1('0x2b')][_0x46a1('0x29')]);}})[_0x46a1('0x2c')](function(_0x57275f){logger[_0x46a1('0x27')](_0x46a1('0x24'),_0x5c529f,_0x57275f);_0xe6666d(_0x57275f);});});}function respondWithStatusCode(_0x449a12,_0x3992d8){_0x3992d8=_0x3992d8||0xcc;return function(_0x1c9837){if(_0x1c9837){return _0x449a12[_0x46a1('0x2d')](_0x3992d8);}return _0x449a12[_0x46a1('0x2e')](_0x3992d8)[_0x46a1('0x2f')]();};}function respondWithResult(_0x19c4c6,_0x245851){_0x245851=_0x245851||0xc8;return function(_0xf574a){if(_0xf574a){return _0x19c4c6[_0x46a1('0x2e')](_0x245851)[_0x46a1('0x30')](_0xf574a);}};}function respondWithFilteredResult(_0x52a02b,_0x1549cc){return function(_0x353867){if(_0x353867){var _0x3295cf=typeof _0x1549cc['offset']==='undefined'&&typeof _0x1549cc[_0x46a1('0x31')]===_0x46a1('0x32');var _0x1b23f8=_0x353867[_0x46a1('0x33')];var _0x5513f1=_0x3295cf?0x0:_0x1549cc[_0x46a1('0x34')];var _0x2a135=_0x3295cf?_0x353867['count']:_0x1549cc[_0x46a1('0x34')]+_0x1549cc[_0x46a1('0x31')];var _0x4ca363;if(_0x2a135>=_0x1b23f8){_0x2a135=_0x1b23f8;_0x4ca363=0xc8;}else{_0x4ca363=0xce;}_0x52a02b[_0x46a1('0x2e')](_0x4ca363);return _0x52a02b['set'](_0x46a1('0x35'),_0x5513f1+'-'+_0x2a135+'/'+_0x1b23f8)['json'](_0x353867);}return null;};}function patchUpdates(_0x509816){return function(_0x13080e){try{jsonpatch[_0x46a1('0x36')](_0x13080e,_0x509816,!![]);}catch(_0x55bd26){return BPromise[_0x46a1('0x37')](_0x55bd26);}return _0x13080e[_0x46a1('0x38')]();};}function saveUpdates(_0x5a1740,_0x2b4704){return function(_0xfce163){if(_0xfce163){return _0xfce163[_0x46a1('0x39')](_0x5a1740)[_0x46a1('0x23')](function(_0x35b7f3){return _0x35b7f3;});}return null;};}function removeEntity(_0x297807,_0x17b087){return function(_0xc98610){if(_0xc98610){return _0xc98610[_0x46a1('0x3a')]()[_0x46a1('0x23')](function(){var _0x560958=_0xc98610[_0x46a1('0x3b')]({'plain':!![]});var _0x1c16f4=_0x46a1('0x3c');return db['UserProfileResource'][_0x46a1('0x3a')]({'where':{'type':_0x1c16f4,'resourceId':_0x560958['id']}})[_0x46a1('0x23')](function(){return _0xc98610;});})[_0x46a1('0x23')](function(){_0x297807['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16afb1,_0x4d0be2){return function(_0x518256){if(!_0x518256){_0x16afb1['sendStatus'](0x194);}return _0x518256;};}function handleError(_0x3615c3,_0x21d294){_0x21d294=_0x21d294||0x1f4;return function(_0x2926f7){logger[_0x46a1('0x27')](_0x2926f7[_0x46a1('0x3d')]);if(_0x2926f7[_0x46a1('0x3e')]){delete _0x2926f7[_0x46a1('0x3e')];}_0x3615c3[_0x46a1('0x2e')](_0x21d294)[_0x46a1('0x3f')](_0x2926f7);};}exports[_0x46a1('0x40')]=function(_0x24c286,_0x40ee93){var _0x47a294={'include':[{'model':db[_0x46a1('0x41')],'as':_0x46a1('0x42')}]},_0x4211a7={},_0xa0f819={'count':0x0,'rows':[]};var _0x413270=_['map'](db[_0x46a1('0x43')][_0x46a1('0x44')],function(_0x32461d){return{'name':_0x32461d[_0x46a1('0x45')],'type':_0x32461d[_0x46a1('0x46')][_0x46a1('0x47')]};});_0x4211a7['model']=_['map'](_0x413270,_0x46a1('0x3e'));_0x4211a7[_0x46a1('0x48')]=_[_0x46a1('0x49')](_0x24c286[_0x46a1('0x48')]);_0x4211a7[_0x46a1('0x4a')]=_[_0x46a1('0x4b')](_0x4211a7[_0x46a1('0x4c')],_0x4211a7['query']);_0x47a294[_0x46a1('0x4d')]=_[_0x46a1('0x4b')](_0x4211a7[_0x46a1('0x4c')],qs[_0x46a1('0x4e')](_0x24c286[_0x46a1('0x48')][_0x46a1('0x4e')]));_0x47a294[_0x46a1('0x4d')]=_0x47a294[_0x46a1('0x4d')]['length']?_0x47a294[_0x46a1('0x4d')]:_0x4211a7['model'];if(!_0x24c286[_0x46a1('0x48')]['hasOwnProperty']('nolimit')){_0x47a294[_0x46a1('0x31')]=qs['limit'](_0x24c286[_0x46a1('0x48')][_0x46a1('0x31')]);_0x47a294[_0x46a1('0x34')]=qs[_0x46a1('0x34')](_0x24c286['query'][_0x46a1('0x34')]);}_0x47a294[_0x46a1('0x4f')]=qs['sort'](_0x24c286[_0x46a1('0x48')][_0x46a1('0x50')]);_0x47a294[_0x46a1('0x51')]=qs[_0x46a1('0x4a')](_['pick'](_0x24c286[_0x46a1('0x48')],_0x4211a7[_0x46a1('0x4a')]),_0x413270);if(_0x24c286[_0x46a1('0x48')][_0x46a1('0x52')]){_0x47a294[_0x46a1('0x51')]=_[_0x46a1('0x53')](_0x47a294['where'],{'$or':_[_0x46a1('0x54')](_0x413270,function(_0x3b4e9b){if(_0x3b4e9b[_0x46a1('0x46')]!==_0x46a1('0x55')){var _0x49523c={};_0x49523c[_0x3b4e9b['name']]={'$like':'%'+_0x24c286[_0x46a1('0x48')][_0x46a1('0x52')]+'%'};return _0x49523c;}})});}_0x47a294=_['merge']({},_0x47a294,_0x24c286['options']);var _0x433226={'where':_0x47a294[_0x46a1('0x51')]};return db['WhatsappAccount'][_0x46a1('0x33')](_0x433226)[_0x46a1('0x23')](function(_0x14663e){_0xa0f819[_0x46a1('0x33')]=_0x14663e;if(_0x24c286['query'][_0x46a1('0x56')]){_0x47a294[_0x46a1('0x57')]=[{'all':!![]}];}return db[_0x46a1('0x43')][_0x46a1('0x58')](_0x47a294);})[_0x46a1('0x23')](function(_0x361506){_0xa0f819[_0x46a1('0x59')]=_0x361506;return _0xa0f819;})[_0x46a1('0x23')](respondWithFilteredResult(_0x40ee93,_0x47a294))[_0x46a1('0x2c')](handleError(_0x40ee93,null));};exports[_0x46a1('0x5a')]=function(_0x1095e0,_0x4ec89d){var _0x3dd1e3={'raw':![],'where':{'id':_0x1095e0[_0x46a1('0x5b')]['id']},'include':[{'model':db[_0x46a1('0x41')],'as':_0x46a1('0x42')}]},_0x1747d5={};_0x1747d5[_0x46a1('0x4c')]=_[_0x46a1('0x49')](db[_0x46a1('0x43')][_0x46a1('0x44')]);_0x1747d5[_0x46a1('0x48')]=_[_0x46a1('0x49')](_0x1095e0[_0x46a1('0x48')]);_0x1747d5[_0x46a1('0x4a')]=_[_0x46a1('0x4b')](_0x1747d5[_0x46a1('0x4c')],_0x1747d5[_0x46a1('0x48')]);_0x3dd1e3['attributes']=_[_0x46a1('0x4b')](_0x1747d5['model'],qs[_0x46a1('0x4e')](_0x1095e0[_0x46a1('0x48')][_0x46a1('0x4e')]));_0x3dd1e3[_0x46a1('0x4d')]=_0x3dd1e3[_0x46a1('0x4d')][_0x46a1('0x5c')]?_0x3dd1e3[_0x46a1('0x4d')]:_0x1747d5[_0x46a1('0x4c')];if(_0x1095e0[_0x46a1('0x48')][_0x46a1('0x56')]){_0x3dd1e3['include']=[{'all':!![]}];}_0x3dd1e3=_[_0x46a1('0x53')]({},_0x3dd1e3,_0x1095e0['options']);return db['WhatsappAccount'][_0x46a1('0x5d')](_0x3dd1e3)[_0x46a1('0x23')](handleEntityNotFound(_0x4ec89d,null))[_0x46a1('0x23')](respondWithResult(_0x4ec89d,null))[_0x46a1('0x2c')](handleError(_0x4ec89d,null));};exports['create']=function(_0xce809a,_0x216d47){return db[_0x46a1('0x43')][_0x46a1('0x5e')](_0xce809a[_0x46a1('0x5f')],{})[_0x46a1('0x23')](function(_0x551ff1){var _0x400301=_0xce809a[_0x46a1('0x60')][_0x46a1('0x3b')]({'plain':!![]});if(!_0x400301)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x400301['role']==='user'){var _0x3d3234=_0x551ff1['get']({'plain':!![]});var _0x1f2e44=_0x46a1('0x3c');return db[_0x46a1('0x61')][_0x46a1('0x5d')]({'where':{'name':_0x1f2e44,'userProfileId':_0x400301[_0x46a1('0x62')]},'raw':!![]})[_0x46a1('0x23')](function(_0x2f9c38){if(_0x2f9c38&&_0x2f9c38['autoAssociation']===0x0){return db['UserProfileResource'][_0x46a1('0x5e')]({'name':_0x3d3234[_0x46a1('0x3e')],'resourceId':_0x3d3234['id'],'type':_0x2f9c38['name'],'sectionId':_0x2f9c38['id']},{})[_0x46a1('0x23')](function(){return _0x551ff1;});}else{return _0x551ff1;}})['catch'](function(_0x3810b6){logger[_0x46a1('0x27')](_0x46a1('0x63'),_0x3810b6);throw _0x3810b6;});}return _0x551ff1;})[_0x46a1('0x23')](respondWithResult(_0x216d47,0xc9))[_0x46a1('0x2c')](handleError(_0x216d47,null));};exports[_0x46a1('0x39')]=function(_0x1c5732,_0x73e2c4){if(_0x1c5732['body']['id']){delete _0x1c5732[_0x46a1('0x5f')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x1c5732[_0x46a1('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x46a1('0x23')](handleEntityNotFound(_0x73e2c4,null))[_0x46a1('0x23')](saveUpdates(_0x1c5732[_0x46a1('0x5f')],null))[_0x46a1('0x23')](respondWithResult(_0x73e2c4,null))['catch'](handleError(_0x73e2c4,null));};exports[_0x46a1('0x3a')]=function(_0x5b34ac,_0x4f2f1d){return db[_0x46a1('0x43')][_0x46a1('0x5d')]({'where':{'id':_0x5b34ac['params']['id']}})['then'](handleEntityNotFound(_0x4f2f1d,null))[_0x46a1('0x23')](removeEntity(_0x4f2f1d,null))[_0x46a1('0x2c')](handleError(_0x4f2f1d,null));};exports[_0x46a1('0x64')]=function(_0x190095,_0x1ff433){return db[_0x46a1('0x43')][_0x46a1('0x64')]()[_0x46a1('0x23')](respondWithResult(_0x1ff433,null))[_0x46a1('0x2c')](handleError(_0x1ff433,null));};exports[_0x46a1('0x65')]=function(_0x58745,_0x3944fb,_0x2625d3){if(_0x58745[_0x46a1('0x5f')]['id']){delete _0x58745[_0x46a1('0x5f')]['id'];}return db[_0x46a1('0x43')][_0x46a1('0x5d')]({'where':{'id':_0x58745[_0x46a1('0x5b')]['id']}})[_0x46a1('0x23')](handleEntityNotFound(_0x3944fb,null))[_0x46a1('0x23')](function(_0x3cc554){if(_0x3cc554){_0x58745[_0x46a1('0x5f')]['WhatsappAccountId']=_0x3cc554['id'];return db['Disposition']['create'](_0x58745['body']);}})['then'](respondWithResult(_0x3944fb,null))[_0x46a1('0x2c')](handleError(_0x3944fb,null));};exports[_0x46a1('0x66')]=function(_0x1e688a,_0x181b00,_0x113b47){var _0x1c3137={'raw':![],'where':{}};var _0x58a585={};var _0x17586c={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x46a1('0x67')]({'where':{'id':_0x1e688a[_0x46a1('0x5b')]['id']}})[_0x46a1('0x23')](handleEntityNotFound(_0x181b00,null))['then'](function(_0x14005d){if(_0x14005d){_0x58a585[_0x46a1('0x4c')]=_['keys'](db['Disposition'][_0x46a1('0x44')]);_0x58a585[_0x46a1('0x48')]=_[_0x46a1('0x49')](_0x1e688a[_0x46a1('0x48')]);_0x58a585['filters']=_[_0x46a1('0x4b')](_0x58a585[_0x46a1('0x4c')],_0x58a585[_0x46a1('0x48')]);_0x1c3137['attributes']=_['intersection'](_0x58a585[_0x46a1('0x4c')],qs['fields'](_0x1e688a[_0x46a1('0x48')][_0x46a1('0x4e')]));_0x1c3137['attributes']=_0x1c3137[_0x46a1('0x4d')][_0x46a1('0x5c')]?_0x1c3137['attributes']:_0x58a585[_0x46a1('0x4c')];if(!_0x1e688a[_0x46a1('0x48')]['hasOwnProperty']('nolimit')){_0x1c3137['limit']=qs[_0x46a1('0x31')](_0x1e688a[_0x46a1('0x48')][_0x46a1('0x31')]);_0x1c3137['offset']=qs['offset'](_0x1e688a['query'][_0x46a1('0x34')]);}_0x1c3137['order']=qs[_0x46a1('0x50')](_0x1e688a['query']['sort']);_0x1c3137[_0x46a1('0x51')]=qs[_0x46a1('0x4a')](_[_0x46a1('0x68')](_0x1e688a[_0x46a1('0x48')],_0x58a585[_0x46a1('0x4a')]));_0x1c3137['where'][_0x46a1('0x69')]=_0x14005d['id'];if(_0x1e688a[_0x46a1('0x48')][_0x46a1('0x52')]){_0x1c3137[_0x46a1('0x51')]=_['merge'](_0x1c3137[_0x46a1('0x51')],{'$or':_['map'](_0x1c3137['attributes'],function(_0x1cf646){var _0x18c93a={};_0x18c93a[_0x1cf646]={'$like':'%'+_0x1e688a[_0x46a1('0x48')][_0x46a1('0x52')]+'%'};return _0x18c93a;})});}_0x1c3137=_['merge']({},_0x1c3137,_0x1e688a[_0x46a1('0x6a')]);return db[_0x46a1('0x6b')][_0x46a1('0x33')]({'where':_0x1c3137[_0x46a1('0x51')]})[_0x46a1('0x23')](function(_0x50ce5b){_0x17586c['count']=_0x50ce5b;if(_0x1e688a[_0x46a1('0x48')][_0x46a1('0x56')]){_0x1c3137['include']=[{'all':!![]}];}return db[_0x46a1('0x6b')][_0x46a1('0x58')](_0x1c3137);})['then'](function(_0x1e0247){_0x17586c[_0x46a1('0x59')]=_0x1e0247;return _0x17586c;});}})[_0x46a1('0x23')](respondWithFilteredResult(_0x181b00,_0x1c3137))['catch'](handleError(_0x181b00,null));};exports[_0x46a1('0x6c')]=function(_0x4924ba,_0x4ac964,_0x51421d){return db['WhatsappAccount'][_0x46a1('0x5d')]({'where':{'id':_0x4924ba[_0x46a1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4ac964,null))['then'](function(_0x41f3e7){if(_0x41f3e7){return _0x41f3e7[_0x46a1('0x6c')](_0x4924ba[_0x46a1('0x48')][_0x46a1('0x6d')]);}})[_0x46a1('0x23')](respondWithStatusCode(_0x4ac964,null))[_0x46a1('0x2c')](handleError(_0x4ac964,null));};exports['addAnswer']=function(_0x42f8ff,_0x43792d,_0x3b3716){if(_0x42f8ff['body']['id']){delete _0x42f8ff['body']['id'];}return db[_0x46a1('0x43')]['find']({'where':{'id':_0x42f8ff[_0x46a1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x43792d,null))['then'](function(_0xe4684e){if(_0xe4684e){_0x42f8ff['body'][_0x46a1('0x69')]=_0xe4684e['id'];return db[_0x46a1('0x6e')]['create'](_0x42f8ff[_0x46a1('0x5f')]);}})[_0x46a1('0x23')](respondWithResult(_0x43792d,null))[_0x46a1('0x2c')](handleError(_0x43792d,null));};exports[_0x46a1('0x6f')]=function(_0x4cf79f,_0x197579,_0x577633){var _0x796f2d={'raw':![],'where':{}};var _0x270826={};var _0x1cfe6c={'count':0x0,'rows':[]};return db[_0x46a1('0x43')]['findOne']({'where':{'id':_0x4cf79f[_0x46a1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x197579,null))[_0x46a1('0x23')](function(_0x595dc6){if(_0x595dc6){_0x270826[_0x46a1('0x4c')]=_[_0x46a1('0x49')](db[_0x46a1('0x6e')]['rawAttributes']);_0x270826[_0x46a1('0x48')]=_[_0x46a1('0x49')](_0x4cf79f[_0x46a1('0x48')]);_0x270826[_0x46a1('0x4a')]=_['intersection'](_0x270826[_0x46a1('0x4c')],_0x270826[_0x46a1('0x48')]);_0x796f2d[_0x46a1('0x4d')]=_[_0x46a1('0x4b')](_0x270826['model'],qs[_0x46a1('0x4e')](_0x4cf79f[_0x46a1('0x48')][_0x46a1('0x4e')]));_0x796f2d[_0x46a1('0x4d')]=_0x796f2d['attributes'][_0x46a1('0x5c')]?_0x796f2d[_0x46a1('0x4d')]:_0x270826[_0x46a1('0x4c')];if(!_0x4cf79f[_0x46a1('0x48')][_0x46a1('0x70')](_0x46a1('0x71'))){_0x796f2d[_0x46a1('0x31')]=qs['limit'](_0x4cf79f['query'][_0x46a1('0x31')]);_0x796f2d[_0x46a1('0x34')]=qs['offset'](_0x4cf79f[_0x46a1('0x48')]['offset']);}_0x796f2d[_0x46a1('0x4f')]=qs['sort'](_0x4cf79f['query']['sort']);_0x796f2d[_0x46a1('0x51')]=qs[_0x46a1('0x4a')](_[_0x46a1('0x68')](_0x4cf79f[_0x46a1('0x48')],_0x270826['filters']));_0x796f2d[_0x46a1('0x51')][_0x46a1('0x69')]=_0x595dc6['id'];if(_0x4cf79f[_0x46a1('0x48')][_0x46a1('0x52')]){_0x796f2d[_0x46a1('0x51')]=_['merge'](_0x796f2d[_0x46a1('0x51')],{'$or':_[_0x46a1('0x54')](_0x796f2d['attributes'],function(_0x59267f){var _0x1991c2={};_0x1991c2[_0x59267f]={'$like':'%'+_0x4cf79f[_0x46a1('0x48')][_0x46a1('0x52')]+'%'};return _0x1991c2;})});}_0x796f2d=_[_0x46a1('0x53')]({},_0x796f2d,_0x4cf79f[_0x46a1('0x6a')]);return db[_0x46a1('0x6e')]['count']({'where':_0x796f2d['where']})[_0x46a1('0x23')](function(_0x1d6006){_0x1cfe6c[_0x46a1('0x33')]=_0x1d6006;if(_0x4cf79f[_0x46a1('0x48')][_0x46a1('0x56')]){_0x796f2d['include']=[{'all':!![]}];}return db[_0x46a1('0x6e')]['findAll'](_0x796f2d);})[_0x46a1('0x23')](function(_0x504373){_0x1cfe6c[_0x46a1('0x59')]=_0x504373;return _0x1cfe6c;});}})['then'](respondWithFilteredResult(_0x197579,_0x796f2d))[_0x46a1('0x2c')](handleError(_0x197579,null));};exports['removeAnswers']=function(_0x5bcf7a,_0x2514ce,_0x3ee4d0){return db[_0x46a1('0x43')][_0x46a1('0x5d')]({'where':{'id':_0x5bcf7a[_0x46a1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2514ce,null))[_0x46a1('0x23')](function(_0x42e4f3){if(_0x42e4f3){return _0x42e4f3[_0x46a1('0x72')](_0x5bcf7a[_0x46a1('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x2514ce,null))[_0x46a1('0x2c')](handleError(_0x2514ce,null));};exports[_0x46a1('0x73')]=function(_0x24d6da,_0x29f30f,_0x12231c){return db['WhatsappAccount']['find']({'where':{'id':_0x24d6da[_0x46a1('0x5b')]['id']}})['then'](handleEntityNotFound(_0x29f30f,null))[_0x46a1('0x23')](function(_0x3c72c3){if(_0x3c72c3){return _0x3c72c3['addAgents'](_0x24d6da[_0x46a1('0x5f')][_0x46a1('0x6d')],_[_0x46a1('0x74')](_0x24d6da['body'],[_0x46a1('0x6d'),'id'])||{})[_0x46a1('0x75')](function(_0x58a144){for(var _0x1d67d9=0x0;_0x1d67d9<_0x24d6da[_0x46a1('0x5f')][_0x46a1('0x6d')][_0x46a1('0x5c')];_0x1d67d9+=0x1){socket[_0x46a1('0x76')](_0x46a1('0x77'),{'UserId':Number(_0x24d6da[_0x46a1('0x5f')][_0x46a1('0x6d')][_0x1d67d9]),'WhatsappAccountId':Number(_0x24d6da[_0x46a1('0x5b')]['id'])});}return _0x58a144;});}})[_0x46a1('0x23')](respondWithResult(_0x29f30f,null))[_0x46a1('0x2c')](handleError(_0x29f30f,null));};exports[_0x46a1('0x78')]=function(_0xe6f625,_0x17c339,_0x56e0c4){return db[_0x46a1('0x43')][_0x46a1('0x5d')]({'where':{'id':_0xe6f625[_0x46a1('0x5b')]['id']}})[_0x46a1('0x23')](handleEntityNotFound(_0x17c339,null))[_0x46a1('0x23')](function(_0x305c91){if(_0x305c91){return _0x305c91['removeAgents'](_0xe6f625[_0x46a1('0x48')][_0x46a1('0x6d')])[_0x46a1('0x23')](function(){if(_[_0x46a1('0x79')](_0xe6f625[_0x46a1('0x48')]['ids'])){for(var _0x534461=0x0;_0x534461<_0xe6f625[_0x46a1('0x48')][_0x46a1('0x6d')][_0x46a1('0x5c')];_0x534461+=0x1){socket[_0x46a1('0x76')](_0x46a1('0x7a'),{'UserId':Number(_0xe6f625['query']['ids'][_0x534461]),'WhatsappAccountId':Number(_0xe6f625[_0x46a1('0x5b')]['id'])});}}else{socket[_0x46a1('0x76')](_0x46a1('0x7a'),{'UserId':Number(_0xe6f625['query'][_0x46a1('0x6d')]),'WhatsappAccountId':Number(_0xe6f625[_0x46a1('0x5b')]['id'])});}});}})[_0x46a1('0x23')](respondWithStatusCode(_0x17c339,null))[_0x46a1('0x2c')](handleError(_0x17c339,null));};exports['getAgents']=function(_0x53bd28,_0x5555ee,_0x2d3078){var _0x1ec296={};var _0x2e6284={};var _0x327efc;var _0x519c4b;return db[_0x46a1('0x43')][_0x46a1('0x67')]({'where':{'id':_0x53bd28['params']['id']}})[_0x46a1('0x23')](handleEntityNotFound(_0x5555ee,null))[_0x46a1('0x23')](function(_0x226c52){if(_0x226c52){_0x327efc=_0x226c52;_0x2e6284[_0x46a1('0x4c')]=_[_0x46a1('0x49')](db[_0x46a1('0x7b')][_0x46a1('0x44')]);_0x2e6284[_0x46a1('0x48')]=_['keys'](_0x53bd28[_0x46a1('0x48')]);_0x2e6284[_0x46a1('0x4a')]=_['intersection'](_0x2e6284[_0x46a1('0x4c')],_0x2e6284[_0x46a1('0x48')]);_0x1ec296[_0x46a1('0x4d')]=_[_0x46a1('0x4b')](_0x2e6284[_0x46a1('0x4c')],qs[_0x46a1('0x4e')](_0x53bd28[_0x46a1('0x48')][_0x46a1('0x4e')]));_0x1ec296[_0x46a1('0x4d')]=_0x1ec296[_0x46a1('0x4d')][_0x46a1('0x5c')]?_0x1ec296[_0x46a1('0x4d')]:_0x2e6284[_0x46a1('0x4c')];_0x1ec296[_0x46a1('0x4f')]=qs[_0x46a1('0x50')](_0x53bd28['query'][_0x46a1('0x50')]);_0x1ec296[_0x46a1('0x51')]=qs[_0x46a1('0x4a')](_[_0x46a1('0x68')](_0x53bd28[_0x46a1('0x48')],_0x2e6284[_0x46a1('0x4a')]));if(_0x53bd28[_0x46a1('0x48')][_0x46a1('0x52')]){_0x1ec296[_0x46a1('0x51')]=_[_0x46a1('0x53')](_0x1ec296[_0x46a1('0x51')],{'$or':_[_0x46a1('0x54')](_0x1ec296[_0x46a1('0x4d')],function(_0x43c844){var _0x362cbc={};_0x362cbc[_0x43c844]={'$like':'%'+_0x53bd28['query'][_0x46a1('0x52')]+'%'};return _0x362cbc;})});}_0x1ec296=_[_0x46a1('0x53')]({},_0x1ec296,_0x53bd28['options']);return _0x327efc[_0x46a1('0x7c')](_0x1ec296);}})[_0x46a1('0x23')](function(_0x8957ad){if(_0x8957ad){_0x519c4b=_0x8957ad[_0x46a1('0x5c')];if(!_0x53bd28[_0x46a1('0x48')]['hasOwnProperty'](_0x46a1('0x71'))){_0x1ec296['limit']=qs[_0x46a1('0x31')](_0x53bd28[_0x46a1('0x48')]['limit']);_0x1ec296[_0x46a1('0x34')]=qs['offset'](_0x53bd28['query'][_0x46a1('0x34')]);}return _0x327efc[_0x46a1('0x7c')](_0x1ec296);}})[_0x46a1('0x23')](function(_0x42d013){if(_0x42d013){return _0x42d013?{'count':_0x519c4b,'rows':_0x42d013}:null;}})[_0x46a1('0x23')](respondWithResult(_0x5555ee,null))['catch'](handleError(_0x5555ee,null));};exports[_0x46a1('0x7d')]=function(_0x2d0d93,_0x32701c){var _0xdbd7a7=_0x2d0d93[_0x46a1('0x5b')]['id'];var _0x30bed5=_0x2d0d93[_0x46a1('0x5f')];var _0x1af7e1=0xc8;var _0x442583=null;return db[_0x46a1('0x7e')][_0x46a1('0x7f')]({'isolationLevel':db['sequelize'][_0x46a1('0x80')][_0x46a1('0x81')][_0x46a1('0x82')]},function(_0x2ac5cf){return db[_0x46a1('0x43')][_0x46a1('0x67')]({'where':{'id':_0xdbd7a7},'transaction':_0x2ac5cf})[_0x46a1('0x23')](function(_0x1508a2){if(_0x1508a2){return db[_0x46a1('0x83')]['destroy']({'where':{'WhatsappAccountId':_0xdbd7a7},'transaction':_0x2ac5cf})[_0x46a1('0x23')](function(){var _0x7886bd=_[_0x46a1('0x54')](_0x30bed5,function(_0x416bfb){_0x416bfb[_0x46a1('0x69')]=_0xdbd7a7;return _0x416bfb;});return db['WhatsappApplication']['bulkCreate'](_0x7886bd,{'transaction':_0x2ac5cf});});}else{_0x1af7e1=0x194;_0x442583=[];}});})[_0x46a1('0x23')](function(){if(_0x1af7e1!==0x194){return db[_0x46a1('0x83')][_0x46a1('0x84')]({'where':{'WhatsappAccountId':_0xdbd7a7},'order':_0x46a1('0x85')})[_0x46a1('0x23')](function(_0x3b5b79){_0x442583=_0x3b5b79;});}})[_0x46a1('0x2c')](function(_0x3f2ad0){_0x1af7e1=0x1f4;logger[_0x46a1('0x27')](_0x3f2ad0[_0x46a1('0x3d')]);if(_0x3f2ad0[_0x46a1('0x3e')]){delete _0x3f2ad0[_0x46a1('0x3e')];}_0x442583=_0x3f2ad0;})[_0x46a1('0x86')](function(){if(_0x442583===null){_0x32701c[_0x46a1('0x2d')](_0x1af7e1);}else{if(_0x1af7e1===0x1f4){_0x32701c[_0x46a1('0x2e')](_0x1af7e1)[_0x46a1('0x3f')](_0x442583);}else{_0x32701c[_0x46a1('0x2e')](_0x1af7e1)['json'](_0x442583);}}});};exports['getApplications']=function(_0x18c376,_0x447c5b,_0x1ff89b){var _0x187f6c={};var _0x5f5077={};var _0x3bca34;var _0x2e7279;return db[_0x46a1('0x43')][_0x46a1('0x67')]({'where':{'id':_0x18c376[_0x46a1('0x5b')]['id']}})[_0x46a1('0x23')](handleEntityNotFound(_0x447c5b,null))[_0x46a1('0x23')](function(_0x47bfab){if(_0x47bfab){_0x3bca34=_0x47bfab;_0x5f5077[_0x46a1('0x4c')]=_['keys'](db[_0x46a1('0x83')]['rawAttributes']);_0x5f5077[_0x46a1('0x48')]=_['keys'](_0x18c376['query']);_0x5f5077['filters']=_[_0x46a1('0x4b')](_0x5f5077['model'],_0x5f5077[_0x46a1('0x48')]);_0x187f6c[_0x46a1('0x4d')]=_['intersection'](_0x5f5077[_0x46a1('0x4c')],qs[_0x46a1('0x4e')](_0x18c376[_0x46a1('0x48')][_0x46a1('0x4e')]));_0x187f6c[_0x46a1('0x4d')]=_0x187f6c['attributes'][_0x46a1('0x5c')]?_0x187f6c[_0x46a1('0x4d')]:_0x5f5077[_0x46a1('0x4c')];_0x187f6c['order']=qs[_0x46a1('0x50')](_0x18c376[_0x46a1('0x48')][_0x46a1('0x50')]);_0x187f6c[_0x46a1('0x51')]=qs[_0x46a1('0x4a')](_[_0x46a1('0x68')](_0x18c376['query'],_0x5f5077['filters']));if(_0x18c376['query'][_0x46a1('0x52')]){_0x187f6c[_0x46a1('0x51')]=_[_0x46a1('0x53')](_0x187f6c[_0x46a1('0x51')],{'$or':_['map'](_0x187f6c['attributes'],function(_0x3689dc){var _0x2363bb={};_0x2363bb[_0x3689dc]={'$like':'%'+_0x18c376[_0x46a1('0x48')][_0x46a1('0x52')]+'%'};return _0x2363bb;})});}_0x187f6c=_['merge']({},_0x187f6c,_0x18c376[_0x46a1('0x6a')]);return _0x3bca34[_0x46a1('0x87')](_0x187f6c);}})[_0x46a1('0x23')](function(_0x146076){if(_0x146076){_0x2e7279=_0x146076[_0x46a1('0x5c')];if(!_0x18c376['query'][_0x46a1('0x70')]('nolimit')){_0x187f6c[_0x46a1('0x31')]=qs[_0x46a1('0x31')](_0x18c376[_0x46a1('0x48')]['limit']);_0x187f6c['offset']=qs[_0x46a1('0x34')](_0x18c376[_0x46a1('0x48')][_0x46a1('0x34')]);}return _0x3bca34[_0x46a1('0x87')](_0x187f6c);}})['then'](function(_0x53287d){if(_0x53287d){return _0x53287d?{'count':_0x2e7279,'rows':_0x53287d}:null;}})['then'](respondWithResult(_0x447c5b,null))[_0x46a1('0x2c')](handleError(_0x447c5b,null));};exports[_0x46a1('0x88')]=function(_0x35358a,_0x5e6f2c,_0x12499b){var _0x2a6741={'channel':_0x46a1('0x89')};var _0x451c1c=[];var _0x474e1e=[];var _0x367661={};return db[_0x46a1('0x43')][_0x46a1('0x5d')]({'where':{'id':_0x35358a[_0x46a1('0x5b')]['id']},'include':[{'model':db[_0x46a1('0x83')],'as':'Applications'}]})[_0x46a1('0x23')](handleEntityNotFound(_0x5e6f2c,null))['then'](function(_0x456571){_0x2a6741['account']=_0x456571;if(_0x2a6741[_0x46a1('0x8a')]&&_0x2a6741[_0x46a1('0x8a')][_0x46a1('0x46')]===_0x46a1('0x8b')&&_0x35358a['body'][_0x46a1('0x8c')]){if(_0x35358a[_0x46a1('0x5f')][_0x46a1('0x8c')]['length']===0x0)return;if(_0x35358a[_0x46a1('0x5f')][_0x46a1('0x8c')][0x0]['state']!==_0x46a1('0x8d'))return;return db[_0x46a1('0x8e')][_0x46a1('0x39')]({'read':!![],'readAt':_0x35358a[_0x46a1('0x5f')][_0x46a1('0x8c')][0x0][_0x46a1('0x8f')]},{'where':{'messageId':_0x35358a[_0x46a1('0x5f')][_0x46a1('0x8c')][0x0][_0x46a1('0x90')]},'individualHooks':!![]})[_0x46a1('0x23')](function(_0x178c67){return _0x5e6f2c[_0x46a1('0x2e')](0xc8)[_0x46a1('0x30')](_0x178c67);});}_0x2a6741[_0x46a1('0x91')]=_[_0x46a1('0x92')](_0x456571[_0x46a1('0x93')],[_0x46a1('0x85')],[_0x46a1('0x94')]);if(_0x2a6741[_0x46a1('0x8a')][_0x46a1('0x93')]){delete _0x2a6741['account'][_0x46a1('0x93')];}return db[_0x46a1('0x95')][_0x46a1('0x64')]()['then'](function(_0x33c8ff){if(!_0x33c8ff){throw new db[(_0x46a1('0x96'))][(_0x46a1('0x97'))]('no\x20available\x20attributes');}_0x451c1c=_['difference'](_['keys'](_0x33c8ff),[_0x46a1('0x98'),_0x46a1('0x99')]);_0x474e1e=_[_0x46a1('0x9a')](_[_0x46a1('0x49')](_0x33c8ff),[_0x46a1('0x98'),_0x46a1('0x99'),_0x46a1('0x9b'),_0x46a1('0x9c')]);_0x2a6741[_0x46a1('0x5f')]={'mapKey':_0x46a1('0x9d')};if(_0x2a6741[_0x46a1('0x8a')]&&_0x2a6741[_0x46a1('0x8a')]['type']===_0x46a1('0x9e')){_0x2a6741[_0x46a1('0x5f')]['from']=_0x35358a['body'][_0x46a1('0x9f')][_0x46a1('0xa0')](_0x46a1('0xa1'),'');_0x2a6741['body'][_0x46a1('0x5f')]=_0x35358a[_0x46a1('0x5f')][_0x46a1('0xa2')];_0x2a6741['body'][_0x46a1('0xa3')]=_0x35358a[_0x46a1('0x5f')]['MessageSid'];}if(_0x2a6741[_0x46a1('0x8a')]&&_0x2a6741[_0x46a1('0x8a')]['type']===_0x46a1('0x8b')){_0x2a6741[_0x46a1('0x5f')]['from']=_0x35358a[_0x46a1('0x5f')]['notifications'][0x0][_0x46a1('0xa4')];_0x2a6741[_0x46a1('0x5f')][_0x46a1('0x5f')]=_0x35358a[_0x46a1('0x5f')]['notifications'][0x0]['message']['body'];_0x2a6741['body'][_0x46a1('0xa3')]=_0x35358a[_0x46a1('0x5f')][_0x46a1('0xa5')][0x0][_0x46a1('0x90')];}if(_0x2a6741[_0x46a1('0x5f')]['id']){delete _0x2a6741[_0x46a1('0x5f')]['id'];}if(_['isNil'](_0x2a6741[_0x46a1('0x5f')][_0x46a1('0xa4')])){throw new db[(_0x46a1('0x96'))]['ValidationError'](_0x46a1('0xa6'));}if(_['isNil'](_0x2a6741[_0x46a1('0x5f')]['body'])||_0x2a6741[_0x46a1('0x5f')][_0x46a1('0x5f')]===''){throw new db['Sequelize'][(_0x46a1('0x97'))](_0x46a1('0xa7'));}if(_[_0x46a1('0xa8')](_0x2a6741[_0x46a1('0x5f')]['mapKey'])){throw new db[(_0x46a1('0x96'))][(_0x46a1('0x97'))](_0x46a1('0xa9')+_0x474e1e);}if(!_[_0x46a1('0xaa')](_0x474e1e,_0x2a6741[_0x46a1('0x5f')][_0x46a1('0xab')])){throw new db[(_0x46a1('0x96'))][(_0x46a1('0x97'))](_0x46a1('0xac')+_0x474e1e);}_0x367661[_0x2a6741[_0x46a1('0x5f')]['mapKey']]=_0x2a6741[_0x46a1('0x5f')][_0x46a1('0xa4')];return db[_0x46a1('0xad')][_0x46a1('0x5d')]({'where':{'id':_0x2a6741[_0x46a1('0x8a')][_0x46a1('0x9c')]},'include':[{'model':db[_0x46a1('0x95')],'as':_0x46a1('0xae'),'where':_0x367661,'limit':0x1,'order':[[_0x46a1('0x99'),_0x46a1('0xaf')]]}]});})[_0x46a1('0x23')](handleEntityNotFound(_0x5e6f2c,null))[_0x46a1('0x23')](function(_0x546488){if(_0x546488){_0x2a6741[_0x46a1('0xb0')]=_[_0x46a1('0x74')](_0x546488,[_0x46a1('0xae')]);if(_0x546488[_0x46a1('0xae')][_0x46a1('0x5c')]){return _0x546488[_0x46a1('0xae')][0x0];}var _0x2ddea6=_[_0x46a1('0x1a')](_0x2a6741[_0x46a1('0x5f')],{'firstName':_0x2a6741[_0x46a1('0x5f')]['from'],'ListId':_0x546488['id']});_0x2ddea6[_0x2a6741[_0x46a1('0x5f')][_0x46a1('0xab')]]=_0x2a6741[_0x46a1('0x5f')][_0x46a1('0xa4')];return db[_0x46a1('0x95')][_0x46a1('0x5e')](_0x2ddea6,{'fields':_0x451c1c,'raw':!![]});}})[_0x46a1('0x23')](handleEntityNotFound(_0x5e6f2c,null))[_0x46a1('0x23')](function(_0x4fb027){if(_0x4fb027){_0x2a6741[_0x46a1('0xb1')]=_0x4fb027;var _0x4b411c={'ContactId':_0x4fb027['id'],'phone':_0x2a6741[_0x46a1('0x5f')][_0x46a1('0xa4')],'WhatsappAccountId':_0x35358a['params']['id']};var _0x194ac9={'ContactId':_0x4fb027['id'],'WhatsappAccountId':_0x35358a[_0x46a1('0x5b')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x46a1('0x5d')]({'where':_0x194ac9})[_0x46a1('0x23')](function(_0x415f0e){if(_0x415f0e){return[_0x415f0e,![]];}return db[_0x46a1('0xb2')]['create'](_0x4b411c)[_0x46a1('0x23')](function(_0x16cc09){return[_0x16cc09,!![]];});});}})[_0x46a1('0x75')](function(_0x1167ac,_0x11a26e){_0x2a6741['interaction']=_0x1167ac[_0x46a1('0x3b')]({'plain':!![]});_0x2a6741[_0x46a1('0xb3')]['created']=![];if(_0x11a26e){if(_0x2a6741['account'][_0x46a1('0xb4')]){_0x2a6741[_0x46a1('0x91')][_0x46a1('0xb5')]({'id':0x0,'priority':_0x2a6741[_0x46a1('0x91')][_0x46a1('0x5c')]+0x1,'app':_0x46a1('0xb6'),'appdata':_0x46a1('0xb7'),'interval':_0x46a1('0xb8')});}_0x2a6741[_0x46a1('0xb3')]['created']=!![];}return db['WhatsappMessage'][_0x46a1('0x5e')]({'phone':_0x2a6741[_0x46a1('0x5f')][_0x46a1('0xa4')],'messageId':_0x2a6741['body'][_0x46a1('0xa3')],'body':_0x2a6741['body']['body'],'WhatsappAccountId':_0x35358a['params']['id'],'WhatsappInteractionId':_0x1167ac['id'],'direction':'in','ContactId':_0x1167ac['ContactId'],'AttachmentId':_0x2a6741[_0x46a1('0x5f')]['AttachmentId']});})[_0x46a1('0x23')](function(_0x3c323a){_0x2a6741[_0x46a1('0x29')]=_0x3c323a;if(!_0x2a6741[_0x46a1('0xb3')][_0x46a1('0xb9')])return;return db[_0x46a1('0x7b')][_0x46a1('0x5d')]({'attributes':['id','name'],'where':{'id':_0x2a6741['interaction'][_0x46a1('0xb9')]}});})['then'](function(_0x4991b7){if(_0x4991b7){_0x2a6741[_0x46a1('0x91')][_0x46a1('0xba')]({'id':0x0,'priority':0x0,'app':_0x46a1('0xbb'),'appdata':_0x4991b7[_0x46a1('0x3e')]+','+(_0x2a6741['account'][_0x46a1('0xbc')]||0xa),'interval':'*,*,*,*'});}if(!_0x2a6741['interaction'][_0x46a1('0xbd')])return;return db[_0x46a1('0xbe')][_0x46a1('0x5d')]({'attributes':['id',_0x46a1('0x3e')],'where':{'id':_0x2a6741[_0x46a1('0xb3')][_0x46a1('0xbd')]}});})[_0x46a1('0x23')](function(_0x46b94b){if(_0x46b94b){_0x2a6741[_0x46a1('0x91')]['unshift']({'id':0x0,'priority':0x1,'app':_0x46a1('0xbf'),'appdata':_0x46b94b[_0x46a1('0x3e')]+','+(_0x2a6741[_0x46a1('0x8a')][_0x46a1('0xc0')]||0x12c),'interval':_0x46a1('0xb8')});}return respondWithRpcPromise(_0x46a1('0xc1'),_0x46a1('0xc2'),_0x2a6741);})[_0x46a1('0x23')](function(_0x1d3366){if(_0x1d3366){var _0x46aef9=0xc8;var _0x308ddd='receiveMessage';logger['info'](_0x46a1('0xc3'),_0x308ddd,_0x46aef9,'entity\x20found');logger[_0x46a1('0x26')](_0x46a1('0xc4'),_0x308ddd,_0x46aef9,'entity\x20found',JSON[_0x46a1('0xc5')](_0x1d3366));if(_0x2a6741[_0x46a1('0x8a')]['type']===_0x46a1('0x9e')){return _0x5e6f2c[_0x46a1('0x2e')](_0x46aef9)[_0x46a1('0xc6')](_0x46a1('0xc7'),_0x46a1('0xc8'))[_0x46a1('0x3f')]('\x0a');}else{return _0x5e6f2c[_0x46a1('0x2e')](_0x46aef9)[_0x46a1('0x30')](_0x1d3366);}}});})[_0x46a1('0x2c')](handleError(_0x5e6f2c,null));};exports['send']=function(_0x790e79,_0x2e4053,_0x2cd5fd){var _0x221998,_0xbfa20b,_0x1462ff;if(_[_0x46a1('0xa8')](_0x790e79['body'][_0x46a1('0x5f')])||_0x790e79[_0x46a1('0x5f')][_0x46a1('0x5f')]===''){throw new db['Sequelize']['ValidationError'](_0x46a1('0xa7'));}if(_[_0x46a1('0xa8')](_0x790e79[_0x46a1('0x5f')]['to'])){throw new db[(_0x46a1('0x96'))][(_0x46a1('0x97'))](_0x46a1('0xc9'));}_0x221998=_0x790e79[_0x46a1('0x5f')]['to'];return db[_0x46a1('0x43')]['find']({'where':{'id':_0x790e79['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x221998},'limit':0x1,'order':[[_0x46a1('0x99'),_0x46a1('0xaf')]]}]}]})[_0x46a1('0x23')](handleEntityNotFound(_0x2e4053,null))['then'](function(_0x2cabb8){if(_0x2cabb8&&_0x2cabb8[_0x46a1('0xca')]){_0xbfa20b=_0x2cabb8[_0x46a1('0x3b')]({'plain':!![]});if(_0xbfa20b[_0x46a1('0xca')]&&_0xbfa20b[_0x46a1('0xca')][_0x46a1('0xae')]['length']){return _0xbfa20b[_0x46a1('0xca')][_0x46a1('0xae')][0x0];}return db['CmContact'][_0x46a1('0x5e')](_[_0x46a1('0x1a')](_0x790e79[_0x46a1('0x5f')],{'firstName':_0x221998,'mobile':_0x221998,'phone':_0x221998,'ListId':_0xbfa20b[_0x46a1('0x9c')]}));}})[_0x46a1('0x23')](handleEntityNotFound(_0x2e4053,null))[_0x46a1('0x23')](function(_0x254225){if(_0x254225){_0x1462ff=_0x254225;return db[_0x46a1('0xb2')][_0x46a1('0x5d')]({'where':{'ContactId':_0x1462ff['id'],'closed':![],'WhatsappAccountId':_0xbfa20b['id']}})[_0x46a1('0x23')](function(_0x495659){if(_0x495659){return[_0x495659,![]];}return db[_0x46a1('0xb2')][_0x46a1('0x5e')]({'UserId':_0x790e79[_0x46a1('0x60')]['id'],'ContactId':_0x1462ff['id'],'WhatsappAccountId':_0xbfa20b['id'],'phone':_0x221998,'firstMsgDirection':_0x46a1('0xcb'),'Messages':[_[_0x46a1('0x53')](_0x790e79[_0x46a1('0x5f')],{'read':![],'body':_0x790e79[_0x46a1('0x5f')]['body'],'phone':_0x221998,'WhatsappAccountId':_0xbfa20b['id'],'UserId':_0x790e79['user']['id'],'ContactId':_0x1462ff['id']})]},{'include':[{'model':db[_0x46a1('0x8e')],'as':_0x46a1('0xcc')}]})['then'](function(_0x45e19c){return[_0x45e19c,!![]];});});}})[_0x46a1('0x75')](function(_0x420131,_0x446107){if(_0x446107){return _0x420131;}return db['WhatsappMessage'][_0x46a1('0x5e')](_['merge'](_0x790e79[_0x46a1('0x5f')],{'read':![],'body':_0x790e79[_0x46a1('0x5f')][_0x46a1('0x5f')],'phone':_0x221998,'WhatsappAccountId':_0xbfa20b['id'],'WhatsappInteractionId':_0x420131['id'],'UserId':_0x790e79['user']['id'],'ContactId':_0x1462ff['id']}))[_0x46a1('0x23')](function(_0x557f8e){_0x420131[_0x46a1('0xcd')][_0x46a1('0xcc')]=[];_0x420131[_0x46a1('0xcd')][_0x46a1('0xcc')][_0x46a1('0xb5')](_0x557f8e[_0x46a1('0xcd')]);return _0x420131;});})[_0x46a1('0x23')](respondWithResult(_0x2e4053,null))['catch'](handleError(_0x2e4053,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 29fe64e..19e2015 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 _0x8848=['hook','events','../../mysqldb','WhatsappAccount','save','remove','emit'];(function(_0x29cb19,_0x547bf1){var _0x21d133=function(_0x4d5246){while(--_0x4d5246){_0x29cb19['push'](_0x29cb19['shift']());}};_0x21d133(++_0x547bf1);}(_0x8848,0x1eb));var _0x8884=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x8848[_0x2a67fe];return _0x57e726;};'use strict';var EventEmitter=require(_0x8884('0x0'));var WhatsappAccount=require(_0x8884('0x1'))['db'][_0x8884('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8884('0x3'),'afterUpdate':'update','afterDestroy':_0x8884('0x4')};function emitEvent(_0x31bcac){return function(_0x3a3410,_0x1fad3c,_0x5e40e6){WhatsappAccountEvents[_0x8884('0x5')](_0x31bcac+':'+_0x3a3410['id'],_0x3a3410);WhatsappAccountEvents[_0x8884('0x5')](_0x31bcac,_0x3a3410);_0x5e40e6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x8884('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x383e=['hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','remove','emit'];(function(_0x1b2be5,_0x4be283){var _0x4fd221=function(_0x13fb18){while(--_0x13fb18){_0x1b2be5['push'](_0x1b2be5['shift']());}};_0x4fd221(++_0x4be283);}(_0x383e,0x1f2));var _0xe383=function(_0x405b56,_0x57f6c0){_0x405b56=_0x405b56-0x0;var _0x9ed66f=_0x383e[_0x405b56];return _0x9ed66f;};'use strict';var EventEmitter=require(_0xe383('0x0'));var WhatsappAccount=require(_0xe383('0x1'))['db'][_0xe383('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe383('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe383('0x4')};function emitEvent(_0x2cbb3c){return function(_0x1a4e20,_0x25ba58,_0x4aaa27){WhatsappAccountEvents['emit'](_0x2cbb3c+':'+_0x1a4e20['id'],_0x1a4e20);WhatsappAccountEvents[_0xe383('0x5')](_0x2cbb3c,_0x1a4e20);_0x4aaa27(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xe383('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 4c79437..b6d46b1 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 _0x6578=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','whatsapp_accounts','api'];(function(_0x30dea6,_0x45559f){var _0x1a70bd=function(_0x52a805){while(--_0x52a805){_0x30dea6['push'](_0x30dea6['shift']());}};_0x1a70bd(++_0x45559f);}(_0x6578,0x1e5));var _0x8657=function(_0x269b2e,_0x171faf){_0x269b2e=_0x269b2e-0x0;var _0x2b01af=_0x6578[_0x269b2e];return _0x2b01af;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8657('0x0'));var moment=require('moment');var BPromise=require(_0x8657('0x1'));var rp=require(_0x8657('0x2'));var fs=require('fs');var path=require(_0x8657('0x3'));var rimraf=require(_0x8657('0x4'));var config=require(_0x8657('0x5'));var attributes=require(_0x8657('0x6'));module[_0x8657('0x7')]=function(_0x2ac5ac,_0x1abd0a){return _0x2ac5ac['define']('WhatsappAccount',attributes,{'tableName':_0x8657('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb322=['lodash','api','moment','rimraf','./whatsappAccount.attributes','exports','define','whatsapp_accounts'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0xb322,0x130));var _0x2b32=function(_0x5ecc83,_0x40e4b1){_0x5ecc83=_0x5ecc83-0x0;var _0xca1e8f=_0xb322[_0x5ecc83];return _0xca1e8f;};'use strict';var _=require(_0x2b32('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2b32('0x1'));var moment=require(_0x2b32('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2b32('0x3'));var config=require('../../config/environment');var attributes=require(_0x2b32('0x4'));module[_0x2b32('0x5')]=function(_0xabc01f,_0x311335){return _0xabc01f[_0x2b32('0x6')]('WhatsappAccount',attributes,{'tableName':_0x2b32('0x7'),'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 c1792b5..a0bfd7b 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 _0x8d41=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash','util','moment'];(function(_0x2f0f28,_0x37df9c){var _0x13b38e=function(_0x2602ae){while(--_0x2602ae){_0x2f0f28['push'](_0x2f0f28['shift']());}};_0x13b38e(++_0x37df9c);}(_0x8d41,0x1aa));var _0x18d4=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x8d41[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x18d4('0x0'));var util=require(_0x18d4('0x1'));var moment=require(_0x18d4('0x2'));var BPromise=require(_0x18d4('0x3'));var rs=require(_0x18d4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18d4('0x5'))['db'];var utils=require(_0x18d4('0x6'));var logger=require(_0x18d4('0x7'))(_0x18d4('0x8'));var config=require(_0x18d4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x18d4('0xa')][_0x18d4('0xb')]({'port':0x232a});config[_0x18d4('0xc')]=_[_0x18d4('0xd')](config['redis'],{'host':_0x18d4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x18d4('0xc')]));require(_0x18d4('0xf'))[_0x18d4('0x10')](socket);function respondWithRpcPromise(_0x188068,_0x27c70d,_0x174b6c){return new BPromise(function(_0x1f8814,_0x56e294){return client[_0x18d4('0x11')](_0x188068,_0x174b6c)[_0x18d4('0x12')](function(_0x1c4391){logger[_0x18d4('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x27c70d,_0x18d4('0x14'));logger[_0x18d4('0x15')](_0x18d4('0x16'),_0x27c70d,_0x18d4('0x14'),JSON[_0x18d4('0x17')](_0x1c4391));if(_0x1c4391[_0x18d4('0x18')]){if(_0x1c4391[_0x18d4('0x18')]['code']===0x1f4){logger[_0x18d4('0x18')](_0x18d4('0x19'),_0x27c70d,_0x1c4391[_0x18d4('0x18')][_0x18d4('0x1a')]);return _0x56e294(_0x1c4391[_0x18d4('0x18')][_0x18d4('0x1a')]);}logger[_0x18d4('0x18')](_0x18d4('0x19'),_0x27c70d,_0x1c4391[_0x18d4('0x18')]['message']);return _0x1f8814(_0x1c4391['error'][_0x18d4('0x1a')]);}else{logger['info'](_0x18d4('0x19'),_0x27c70d,_0x18d4('0x14'));_0x1f8814(_0x1c4391[_0x18d4('0x1b')][_0x18d4('0x1a')]);}})[_0x18d4('0x1c')](function(_0x3f8fae){logger[_0x18d4('0x18')](_0x18d4('0x19'),_0x27c70d,_0x3f8fae);_0x56e294(_0x3f8fae);});});}exports[_0x18d4('0x1d')]=function(_0x3e74ff){var _0x393d99=this;return new Promise(function(_0xb619d4,_0x4be1dc){return db[_0x18d4('0x1e')][_0x18d4('0x1f')]({'raw':_0x3e74ff['options']?_0x3e74ff[_0x18d4('0x20')][_0x18d4('0x21')]===undefined?!![]:![]:!![],'where':_0x3e74ff[_0x18d4('0x20')]?_0x3e74ff[_0x18d4('0x20')][_0x18d4('0x22')]||null:null,'attributes':_0x3e74ff[_0x18d4('0x20')]?_0x3e74ff[_0x18d4('0x20')][_0x18d4('0x23')]||null:null,'include':_0x3e74ff[_0x18d4('0x20')]?_0x3e74ff['options'][_0x18d4('0x24')]?_[_0x18d4('0x25')](_0x3e74ff[_0x18d4('0x20')][_0x18d4('0x24')],function(_0x2081f7){return{'model':db[_0x2081f7['model']],'as':_0x2081f7['as'],'attributes':_0x2081f7[_0x18d4('0x23')],'include':_0x2081f7[_0x18d4('0x24')]?_[_0x18d4('0x25')](_0x2081f7['include'],function(_0x587ee3){return{'model':db[_0x587ee3[_0x18d4('0x26')]],'as':_0x587ee3['as'],'attributes':_0x587ee3[_0x18d4('0x23')],'include':_0x587ee3['include']?_['map'](_0x587ee3[_0x18d4('0x24')],function(_0x50762b){return{'model':db[_0x50762b[_0x18d4('0x26')]],'as':_0x50762b['as'],'attributes':_0x50762b[_0x18d4('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ff33a){logger[_0x18d4('0x13')](_0x18d4('0x1d'),_0x3e74ff);logger['debug'](_0x18d4('0x1d'),_0x3e74ff,JSON[_0x18d4('0x17')](_0x1ff33a));_0xb619d4(_0x1ff33a);})['catch'](function(_0xc3f7d8){logger[_0x18d4('0x18')](_0x18d4('0x1d'),_0xc3f7d8['message'],_0x3e74ff);_0x4be1dc(_0x393d99[_0x18d4('0x18')](0x1f4,_0xc3f7d8[_0x18d4('0x1a')]));});});}; \ No newline at end of file +var _0x90fc=['request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model','info','lodash','util','moment','bluebird','randomstring','../../config/utils','jayson/promise','client','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x90fc,0xe1));var _0xc90f=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x90fc[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xc90f('0x0'));var util=require(_0xc90f('0x1'));var moment=require(_0xc90f('0x2'));var BPromise=require(_0xc90f('0x3'));var rs=require(_0xc90f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc90f('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc90f('0x6'));var client=jayson[_0xc90f('0x7')]['http']({'port':0x232a});config[_0xc90f('0x8')]=_[_0xc90f('0x9')](config[_0xc90f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xc90f('0xa'))(new Redis(config[_0xc90f('0x8')]));require(_0xc90f('0xb'))[_0xc90f('0xc')](socket);function respondWithRpcPromise(_0xbf9aed,_0x31768c,_0x4b4cc5){return new BPromise(function(_0x113b7c,_0x4956b5){return client[_0xc90f('0xd')](_0xbf9aed,_0x4b4cc5)[_0xc90f('0xe')](function(_0x4c49c2){logger['info'](_0xc90f('0xf'),_0x31768c,_0xc90f('0x10'));logger[_0xc90f('0x11')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x31768c,'request\x20sent',JSON[_0xc90f('0x12')](_0x4c49c2));if(_0x4c49c2[_0xc90f('0x13')]){if(_0x4c49c2[_0xc90f('0x13')][_0xc90f('0x14')]===0x1f4){logger['error'](_0xc90f('0xf'),_0x31768c,_0x4c49c2[_0xc90f('0x13')][_0xc90f('0x15')]);return _0x4956b5(_0x4c49c2[_0xc90f('0x13')][_0xc90f('0x15')]);}logger[_0xc90f('0x13')](_0xc90f('0xf'),_0x31768c,_0x4c49c2['error'][_0xc90f('0x15')]);return _0x113b7c(_0x4c49c2[_0xc90f('0x13')][_0xc90f('0x15')]);}else{logger['info'](_0xc90f('0xf'),_0x31768c,_0xc90f('0x10'));_0x113b7c(_0x4c49c2[_0xc90f('0x16')]['message']);}})[_0xc90f('0x17')](function(_0x563fa6){logger[_0xc90f('0x13')](_0xc90f('0xf'),_0x31768c,_0x563fa6);_0x4956b5(_0x563fa6);});});}exports[_0xc90f('0x18')]=function(_0x4356ab){var _0x48bcbb=this;return new Promise(function(_0x452ab9,_0x4eec34){return db[_0xc90f('0x19')]['find']({'raw':_0x4356ab[_0xc90f('0x1a')]?_0x4356ab['options'][_0xc90f('0x1b')]===undefined?!![]:![]:!![],'where':_0x4356ab[_0xc90f('0x1a')]?_0x4356ab['options'][_0xc90f('0x1c')]||null:null,'attributes':_0x4356ab[_0xc90f('0x1a')]?_0x4356ab[_0xc90f('0x1a')][_0xc90f('0x1d')]||null:null,'include':_0x4356ab[_0xc90f('0x1a')]?_0x4356ab[_0xc90f('0x1a')][_0xc90f('0x1e')]?_[_0xc90f('0x1f')](_0x4356ab[_0xc90f('0x1a')][_0xc90f('0x1e')],function(_0x33342d){return{'model':db[_0x33342d[_0xc90f('0x20')]],'as':_0x33342d['as'],'attributes':_0x33342d[_0xc90f('0x1d')],'include':_0x33342d['include']?_[_0xc90f('0x1f')](_0x33342d[_0xc90f('0x1e')],function(_0x4af887){return{'model':db[_0x4af887[_0xc90f('0x20')]],'as':_0x4af887['as'],'attributes':_0x4af887[_0xc90f('0x1d')],'include':_0x4af887[_0xc90f('0x1e')]?_[_0xc90f('0x1f')](_0x4af887[_0xc90f('0x1e')],function(_0xbbcec5){return{'model':db[_0xbbcec5[_0xc90f('0x20')]],'as':_0xbbcec5['as'],'attributes':_0xbbcec5[_0xc90f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc90f('0xe')](function(_0x12be33){logger[_0xc90f('0x21')](_0xc90f('0x18'),_0x4356ab);logger[_0xc90f('0x11')](_0xc90f('0x18'),_0x4356ab,JSON[_0xc90f('0x12')](_0x12be33));_0x452ab9(_0x12be33);})[_0xc90f('0x17')](function(_0x4253c1){logger[_0xc90f('0x13')](_0xc90f('0x18'),_0x4253c1[_0xc90f('0x15')],_0x4356ab);_0x4eec34(_0x48bcbb[_0xc90f('0x13')](0x1f4,_0x4253c1[_0xc90f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b77ac0f..b493596 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 _0x2ea3=['emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update'];(function(_0x47b922,_0x2cd2c2){var _0x307b3c=function(_0x4846f6){while(--_0x4846f6){_0x47b922['push'](_0x47b922['shift']());}};_0x307b3c(++_0x2cd2c2);}(_0x2ea3,0x1d9));var _0x32ea=function(_0x11625f,_0x4e70b1){_0x11625f=_0x11625f-0x0;var _0x2ed309=_0x2ea3[_0x11625f];return _0x2ed309;};'use strict';var WhatsappAccountEvents=require(_0x32ea('0x0'));var events=[_0x32ea('0x1'),_0x32ea('0x2'),_0x32ea('0x3')];function createListener(_0x5d7600,_0x180dd7){return function(_0x10dbd1){_0x180dd7[_0x32ea('0x4')](_0x5d7600,_0x10dbd1);};}function removeListener(_0x206590,_0x4daf4e){return function(){WhatsappAccountEvents[_0x32ea('0x5')](_0x206590,_0x4daf4e);};}exports[_0x32ea('0x6')]=function(_0x5ef0ae){for(var _0x4d3ce6=0x0,_0x1ac971=events[_0x32ea('0x7')];_0x4d3ce6<_0x1ac971;_0x4d3ce6++){var _0x1e3dbd=events[_0x4d3ce6];var _0x182bb6=createListener(_0x32ea('0x8')+_0x1e3dbd,_0x5ef0ae);WhatsappAccountEvents['on'](_0x1e3dbd,_0x182bb6);}}; \ No newline at end of file +var _0x0c92=['emit','removeListener','register','length','whatsappAccount:','save','remove','update'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0x0c92,0xbd));var _0x20c9=function(_0x5ba549,_0x425afd){_0x5ba549=_0x5ba549-0x0;var _0x36e3a1=_0x0c92[_0x5ba549];return _0x36e3a1;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x20c9('0x0'),_0x20c9('0x1'),_0x20c9('0x2')];function createListener(_0x2b69c5,_0x406246){return function(_0x2bbc0f){_0x406246[_0x20c9('0x3')](_0x2b69c5,_0x2bbc0f);};}function removeListener(_0x3f4e0f,_0x4cd3e7){return function(){WhatsappAccountEvents[_0x20c9('0x4')](_0x3f4e0f,_0x4cd3e7);};}exports[_0x20c9('0x5')]=function(_0x33f697){for(var _0x3b8f3a=0x0,_0x2dabf1=events[_0x20c9('0x6')];_0x3b8f3a<_0x2dabf1;_0x3b8f3a++){var _0x141199=events[_0x3b8f3a];var _0x6c8e90=createListener(_0x20c9('0x7')+_0x141199,_0x33f697);WhatsappAccountEvents['on'](_0x141199,_0x6c8e90);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 41a8817..533073d 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 _0x9780=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','show','post','create','put','delete'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9780,0xf1));var _0x0978=function(_0x32be62,_0x22e6fd){_0x32be62=_0x32be62-0x0;var _0x1a37e9=_0x9780[_0x32be62];return _0x1a37e9;};'use strict';var multer=require(_0x0978('0x0'));var util=require(_0x0978('0x1'));var path=require(_0x0978('0x2'));var timeout=require(_0x0978('0x3'));var express=require('express');var router=express[_0x0978('0x4')]();var fs_extra=require(_0x0978('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0978('0x6'));var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x0978('0x7')](),controller[_0x0978('0x8')]);router[_0x0978('0x9')]('/:id',auth[_0x0978('0x7')](),controller[_0x0978('0xa')]);router[_0x0978('0xb')]('/',auth[_0x0978('0x7')](),controller[_0x0978('0xc')]);router[_0x0978('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0978('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0978('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7c6c=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7c6c,0xd6));var _0xc7c6=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x7c6c[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xc7c6('0x0'));var util=require(_0xc7c6('0x1'));var path=require(_0xc7c6('0x2'));var timeout=require(_0xc7c6('0x3'));var express=require('express');var router=express[_0xc7c6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc7c6('0x5'));var interaction=require(_0xc7c6('0x6'));var config=require(_0xc7c6('0x7'));var controller=require('./whatsappApplication.controller');router[_0xc7c6('0x8')]('/',auth[_0xc7c6('0x9')](),controller['index']);router[_0xc7c6('0x8')]('/:id',auth[_0xc7c6('0x9')](),controller[_0xc7c6('0xa')]);router[_0xc7c6('0xb')]('/',auth[_0xc7c6('0x9')](),controller[_0xc7c6('0xc')]);router['put'](_0xc7c6('0xd'),auth[_0xc7c6('0x9')](),controller[_0xc7c6('0xe')]);router[_0xc7c6('0xf')](_0xc7c6('0xd'),auth['isAuthenticated'](),controller[_0xc7c6('0x10')]);module[_0xc7c6('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index e0f8625..ef809d3 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 _0xd157=['INTEGER','STRING','noop','*,*,*,*'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0xd157,0x188));var _0x7d15=function(_0x13b61b,_0x2c1d82){_0x13b61b=_0x13b61b-0x0;var _0x52b4ef=_0xd157[_0x13b61b];return _0x52b4ef;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x7d15('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x7d15('0x1')],'allowNull':![],'defaultValue':_0x7d15('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7d15('0x1')]},'interval':{'type':Sequelize[_0x7d15('0x1')],'defaultValue':_0x7d15('0x3')}}; \ No newline at end of file +var _0x3100=['STRING','*,*,*,*','sequelize','exports','noop'];(function(_0x2291cb,_0x3d2b79){var _0x53b5d2=function(_0x300c99){while(--_0x300c99){_0x2291cb['push'](_0x2291cb['shift']());}};_0x53b5d2(++_0x3d2b79);}(_0x3100,0x13d));var _0x0310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3100[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0310('0x0'));module[_0x0310('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0310('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0310('0x3')]},'interval':{'type':Sequelize[_0x0310('0x3')],'defaultValue':_0x0310('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 942799a..160e347 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 _0x6ca3=['Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','WhatsappApplication','includeAll','findAll','rows','show','params','options','find','catch','create','body','destroy','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x788fa0,_0x644ff4){var _0x4f16c7=function(_0x20feb5){while(--_0x20feb5){_0x788fa0['push'](_0x788fa0['shift']());}};_0x4f16c7(++_0x644ff4);}(_0x6ca3,0xba));var _0x36ca=function(_0x34190e,_0x50ecc7){_0x34190e=_0x34190e-0x0;var _0x41a4e6=_0x6ca3[_0x34190e];return _0x41a4e6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x36ca('0x0'));var jsonpatch=require(_0x36ca('0x1'));var rp=require('request-promise');var moment=require(_0x36ca('0x2'));var BPromise=require(_0x36ca('0x3'));var Mustache=require('mustache');var util=require(_0x36ca('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x36ca('0x5'));var ejs=require(_0x36ca('0x6'));var fs=require('fs');var fs_extra=require(_0x36ca('0x7'));var _=require(_0x36ca('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x36ca('0x9'));var deskjs=require(_0x36ca('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x36ca('0xb'));var Redis=require(_0x36ca('0xc'));var authService=require(_0x36ca('0xd'));var qs=require(_0x36ca('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x36ca('0xf'));var logger=require('../../config/logger')(_0x36ca('0x10'));var utils=require(_0x36ca('0x11'));var config=require(_0x36ca('0x12'));var licenseUtil=require(_0x36ca('0x13'));var db=require(_0x36ca('0x14'))['db'];function respondWithStatusCode(_0x58ec1a,_0x13d0f4){_0x13d0f4=_0x13d0f4||0xcc;return function(_0x3b0852){if(_0x3b0852){return _0x58ec1a[_0x36ca('0x15')](_0x13d0f4);}return _0x58ec1a['status'](_0x13d0f4)[_0x36ca('0x16')]();};}function respondWithResult(_0x21262a,_0x156111){_0x156111=_0x156111||0xc8;return function(_0x420122){if(_0x420122){return _0x21262a[_0x36ca('0x17')](_0x156111)[_0x36ca('0x18')](_0x420122);}};}function respondWithFilteredResult(_0x3184b3,_0x2b886e){return function(_0x104822){if(_0x104822){var _0x5395d8=typeof _0x2b886e[_0x36ca('0x19')]===_0x36ca('0x1a')&&typeof _0x2b886e[_0x36ca('0x1b')]===_0x36ca('0x1a');var _0x394353=_0x104822['count'];var _0x4d136c=_0x5395d8?0x0:_0x2b886e[_0x36ca('0x19')];var _0xd39461=_0x5395d8?_0x104822[_0x36ca('0x1c')]:_0x2b886e[_0x36ca('0x19')]+_0x2b886e[_0x36ca('0x1b')];var _0x5a7096;if(_0xd39461>=_0x394353){_0xd39461=_0x394353;_0x5a7096=0xc8;}else{_0x5a7096=0xce;}_0x3184b3[_0x36ca('0x17')](_0x5a7096);return _0x3184b3[_0x36ca('0x1d')](_0x36ca('0x1e'),_0x4d136c+'-'+_0xd39461+'/'+_0x394353)[_0x36ca('0x18')](_0x104822);}return null;};}function patchUpdates(_0x5ef372){return function(_0x2937cd){try{jsonpatch[_0x36ca('0x1f')](_0x2937cd,_0x5ef372,!![]);}catch(_0x1a50af){return BPromise['reject'](_0x1a50af);}return _0x2937cd[_0x36ca('0x20')]();};}function saveUpdates(_0x5889a7,_0x1b6134){return function(_0x1b1e87){if(_0x1b1e87){return _0x1b1e87[_0x36ca('0x21')](_0x5889a7)[_0x36ca('0x22')](function(_0x48d3ea){return _0x48d3ea;});}return null;};}function removeEntity(_0x538ce5,_0x136dd3){return function(_0x3507ab){if(_0x3507ab){return _0x3507ab['destroy']()[_0x36ca('0x22')](function(){_0x538ce5[_0x36ca('0x17')](0xcc)[_0x36ca('0x16')]();});}};}function handleEntityNotFound(_0x93430f,_0x137b2e){return function(_0x5d3f35){if(!_0x5d3f35){_0x93430f[_0x36ca('0x15')](0x194);}return _0x5d3f35;};}function handleError(_0x82732d,_0x13870b){_0x13870b=_0x13870b||0x1f4;return function(_0x4a792e){logger[_0x36ca('0x23')](_0x4a792e[_0x36ca('0x24')]);if(_0x4a792e[_0x36ca('0x25')]){delete _0x4a792e[_0x36ca('0x25')];}_0x82732d[_0x36ca('0x17')](_0x13870b)[_0x36ca('0x26')](_0x4a792e);};}exports[_0x36ca('0x27')]=function(_0x291293,_0x51c42b){var _0x2b54ef={},_0x46782f={},_0x2c415e={'count':0x0,'rows':[]};var _0x20f7ae=_[_0x36ca('0x28')](db['WhatsappApplication'][_0x36ca('0x29')],function(_0x2e4dae){return{'name':_0x2e4dae['fieldName'],'type':_0x2e4dae[_0x36ca('0x2a')][_0x36ca('0x2b')]};});_0x46782f[_0x36ca('0x2c')]=_[_0x36ca('0x28')](_0x20f7ae,_0x36ca('0x25'));_0x46782f[_0x36ca('0x2d')]=_[_0x36ca('0x2e')](_0x291293['query']);_0x46782f[_0x36ca('0x2f')]=_[_0x36ca('0x30')](_0x46782f[_0x36ca('0x2c')],_0x46782f[_0x36ca('0x2d')]);_0x2b54ef['attributes']=_['intersection'](_0x46782f['model'],qs[_0x36ca('0x31')](_0x291293[_0x36ca('0x2d')][_0x36ca('0x31')]));_0x2b54ef[_0x36ca('0x32')]=_0x2b54ef[_0x36ca('0x32')][_0x36ca('0x33')]?_0x2b54ef[_0x36ca('0x32')]:_0x46782f[_0x36ca('0x2c')];if(!_0x291293[_0x36ca('0x2d')][_0x36ca('0x34')]('nolimit')){_0x2b54ef[_0x36ca('0x1b')]=qs['limit'](_0x291293[_0x36ca('0x2d')][_0x36ca('0x1b')]);_0x2b54ef[_0x36ca('0x19')]=qs[_0x36ca('0x19')](_0x291293[_0x36ca('0x2d')][_0x36ca('0x19')]);}_0x2b54ef[_0x36ca('0x35')]=qs[_0x36ca('0x36')](_0x291293[_0x36ca('0x2d')]['sort']);_0x2b54ef[_0x36ca('0x37')]=qs['filters'](_[_0x36ca('0x38')](_0x291293[_0x36ca('0x2d')],_0x46782f['filters']),_0x20f7ae);if(_0x291293['query'][_0x36ca('0x39')]){_0x2b54ef['where']=_[_0x36ca('0x3a')](_0x2b54ef[_0x36ca('0x37')],{'$or':_[_0x36ca('0x28')](_0x20f7ae,function(_0x13fdd3){if(_0x13fdd3[_0x36ca('0x2a')]!==_0x36ca('0x3b')){var _0x1020b9={};_0x1020b9[_0x13fdd3[_0x36ca('0x25')]]={'$like':'%'+_0x291293['query'][_0x36ca('0x39')]+'%'};return _0x1020b9;}})});}_0x2b54ef=_[_0x36ca('0x3a')]({},_0x2b54ef,_0x291293['options']);var _0x2b6f4b={'where':_0x2b54ef[_0x36ca('0x37')]};return db[_0x36ca('0x3c')][_0x36ca('0x1c')](_0x2b6f4b)['then'](function(_0x2c3347){_0x2c415e[_0x36ca('0x1c')]=_0x2c3347;if(_0x291293['query'][_0x36ca('0x3d')]){_0x2b54ef['include']=[{'all':!![]}];}return db[_0x36ca('0x3c')][_0x36ca('0x3e')](_0x2b54ef);})[_0x36ca('0x22')](function(_0x2b6198){_0x2c415e[_0x36ca('0x3f')]=_0x2b6198;return _0x2c415e;})[_0x36ca('0x22')](respondWithFilteredResult(_0x51c42b,_0x2b54ef))['catch'](handleError(_0x51c42b,null));};exports[_0x36ca('0x40')]=function(_0x107291,_0x3680cc){var _0x2f6c59={'raw':!![],'where':{'id':_0x107291[_0x36ca('0x41')]['id']}},_0x2df096={};_0x2df096['model']=_[_0x36ca('0x2e')](db[_0x36ca('0x3c')][_0x36ca('0x29')]);_0x2df096[_0x36ca('0x2d')]=_[_0x36ca('0x2e')](_0x107291[_0x36ca('0x2d')]);_0x2df096['filters']=_[_0x36ca('0x30')](_0x2df096[_0x36ca('0x2c')],_0x2df096['query']);_0x2f6c59[_0x36ca('0x32')]=_['intersection'](_0x2df096[_0x36ca('0x2c')],qs['fields'](_0x107291[_0x36ca('0x2d')][_0x36ca('0x31')]));_0x2f6c59[_0x36ca('0x32')]=_0x2f6c59[_0x36ca('0x32')]['length']?_0x2f6c59[_0x36ca('0x32')]:_0x2df096[_0x36ca('0x2c')];if(_0x107291['query'][_0x36ca('0x3d')]){_0x2f6c59['include']=[{'all':!![]}];}_0x2f6c59=_['merge']({},_0x2f6c59,_0x107291[_0x36ca('0x42')]);return db[_0x36ca('0x3c')][_0x36ca('0x43')](_0x2f6c59)[_0x36ca('0x22')](handleEntityNotFound(_0x3680cc,null))['then'](respondWithResult(_0x3680cc,null))[_0x36ca('0x44')](handleError(_0x3680cc,null));};exports[_0x36ca('0x45')]=function(_0x4f322d,_0x20a6ce){return db[_0x36ca('0x3c')][_0x36ca('0x45')](_0x4f322d[_0x36ca('0x46')],{})['then'](respondWithResult(_0x20a6ce,0xc9))[_0x36ca('0x44')](handleError(_0x20a6ce,null));};exports[_0x36ca('0x21')]=function(_0x46bb01,_0x3f0514){if(_0x46bb01[_0x36ca('0x46')]['id']){delete _0x46bb01[_0x36ca('0x46')]['id'];}return db[_0x36ca('0x3c')][_0x36ca('0x43')]({'where':{'id':_0x46bb01[_0x36ca('0x41')]['id']}})[_0x36ca('0x22')](handleEntityNotFound(_0x3f0514,null))[_0x36ca('0x22')](saveUpdates(_0x46bb01[_0x36ca('0x46')],null))[_0x36ca('0x22')](respondWithResult(_0x3f0514,null))[_0x36ca('0x44')](handleError(_0x3f0514,null));};exports[_0x36ca('0x47')]=function(_0x2bcb2e,_0x17ef72){return db[_0x36ca('0x3c')]['find']({'where':{'id':_0x2bcb2e[_0x36ca('0x41')]['id']}})['then'](handleEntityNotFound(_0x17ef72,null))['then'](removeEntity(_0x17ef72,null))[_0x36ca('0x44')](handleError(_0x17ef72,null));}; \ No newline at end of file +var _0xaafc=['find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','merge','filter','options','WhatsappApplication','include','findAll','rows','catch','show','params','includeAll'];(function(_0x58bb6f,_0x56c2f8){var _0x454c6f=function(_0x3aa39d){while(--_0x3aa39d){_0x58bb6f['push'](_0x58bb6f['shift']());}};_0x454c6f(++_0x56c2f8);}(_0xaafc,0x176));var _0xcaaf=function(_0x3c4e5b,_0x335326){_0x3c4e5b=_0x3c4e5b-0x0;var _0x28e061=_0xaafc[_0x3c4e5b];return _0x28e061;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaaf('0x0'));var zipdir=require(_0xcaaf('0x1'));var jsonpatch=require(_0xcaaf('0x2'));var rp=require(_0xcaaf('0x3'));var moment=require('moment');var BPromise=require(_0xcaaf('0x4'));var Mustache=require(_0xcaaf('0x5'));var util=require('util');var path=require('path');var sox=require(_0xcaaf('0x6'));var csv=require('to-csv');var ejs=require(_0xcaaf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcaaf('0x8'));var squel=require(_0xcaaf('0x9'));var crypto=require(_0xcaaf('0xa'));var jsforce=require(_0xcaaf('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcaaf('0xc'));var querystring=require('querystring');var Papa=require(_0xcaaf('0xd'));var Redis=require('ioredis');var authService=require(_0xcaaf('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xcaaf('0xf'));var hardwareService=require(_0xcaaf('0x10'));var logger=require(_0xcaaf('0x11'))(_0xcaaf('0x12'));var utils=require(_0xcaaf('0x13'));var config=require(_0xcaaf('0x14'));var licenseUtil=require(_0xcaaf('0x15'));var db=require(_0xcaaf('0x16'))['db'];function respondWithStatusCode(_0x27a940,_0x4b6dcf){_0x4b6dcf=_0x4b6dcf||0xcc;return function(_0x3b70a3){if(_0x3b70a3){return _0x27a940[_0xcaaf('0x17')](_0x4b6dcf);}return _0x27a940[_0xcaaf('0x18')](_0x4b6dcf)[_0xcaaf('0x19')]();};}function respondWithResult(_0x215949,_0x35d596){_0x35d596=_0x35d596||0xc8;return function(_0x6afc3){if(_0x6afc3){return _0x215949[_0xcaaf('0x18')](_0x35d596)[_0xcaaf('0x1a')](_0x6afc3);}};}function respondWithFilteredResult(_0x168550,_0x953779){return function(_0x552cf1){if(_0x552cf1){var _0x301344=typeof _0x953779[_0xcaaf('0x1b')]===_0xcaaf('0x1c')&&typeof _0x953779[_0xcaaf('0x1d')]===_0xcaaf('0x1c');var _0x360078=_0x552cf1['count'];var _0xf8e303=_0x301344?0x0:_0x953779[_0xcaaf('0x1b')];var _0x534598=_0x301344?_0x552cf1[_0xcaaf('0x1e')]:_0x953779[_0xcaaf('0x1b')]+_0x953779[_0xcaaf('0x1d')];var _0x43631b;if(_0x534598>=_0x360078){_0x534598=_0x360078;_0x43631b=0xc8;}else{_0x43631b=0xce;}_0x168550[_0xcaaf('0x18')](_0x43631b);return _0x168550[_0xcaaf('0x1f')](_0xcaaf('0x20'),_0xf8e303+'-'+_0x534598+'/'+_0x360078)[_0xcaaf('0x1a')](_0x552cf1);}return null;};}function patchUpdates(_0xbc6023){return function(_0x39e277){try{jsonpatch[_0xcaaf('0x21')](_0x39e277,_0xbc6023,!![]);}catch(_0x5bdc7a){return BPromise[_0xcaaf('0x22')](_0x5bdc7a);}return _0x39e277[_0xcaaf('0x23')]();};}function saveUpdates(_0x33914f,_0x110974){return function(_0x359339){if(_0x359339){return _0x359339[_0xcaaf('0x24')](_0x33914f)[_0xcaaf('0x25')](function(_0x5e0463){return _0x5e0463;});}return null;};}function removeEntity(_0xd6706f,_0x2c565f){return function(_0x3f62c8){if(_0x3f62c8){return _0x3f62c8['destroy']()[_0xcaaf('0x25')](function(){_0xd6706f[_0xcaaf('0x18')](0xcc)[_0xcaaf('0x19')]();});}};}function handleEntityNotFound(_0x3dac7d,_0x2a6d15){return function(_0x4346e2){if(!_0x4346e2){_0x3dac7d[_0xcaaf('0x17')](0x194);}return _0x4346e2;};}function handleError(_0x4ffbab,_0x387319){_0x387319=_0x387319||0x1f4;return function(_0x52145b){logger['error'](_0x52145b['stack']);if(_0x52145b[_0xcaaf('0x26')]){delete _0x52145b[_0xcaaf('0x26')];}_0x4ffbab[_0xcaaf('0x18')](_0x387319)[_0xcaaf('0x27')](_0x52145b);};}exports[_0xcaaf('0x28')]=function(_0x35e500,_0x20be72){var _0x34019c={},_0x1523bc={},_0x4c75a9={'count':0x0,'rows':[]};var _0x4cacf9=_[_0xcaaf('0x29')](db['WhatsappApplication'][_0xcaaf('0x2a')],function(_0x58c170){return{'name':_0x58c170[_0xcaaf('0x2b')],'type':_0x58c170[_0xcaaf('0x2c')][_0xcaaf('0x2d')]};});_0x1523bc[_0xcaaf('0x2e')]=_['map'](_0x4cacf9,_0xcaaf('0x26'));_0x1523bc[_0xcaaf('0x2f')]=_[_0xcaaf('0x30')](_0x35e500['query']);_0x1523bc['filters']=_[_0xcaaf('0x31')](_0x1523bc[_0xcaaf('0x2e')],_0x1523bc['query']);_0x34019c[_0xcaaf('0x32')]=_[_0xcaaf('0x31')](_0x1523bc[_0xcaaf('0x2e')],qs[_0xcaaf('0x33')](_0x35e500[_0xcaaf('0x2f')][_0xcaaf('0x33')]));_0x34019c[_0xcaaf('0x32')]=_0x34019c[_0xcaaf('0x32')][_0xcaaf('0x34')]?_0x34019c['attributes']:_0x1523bc['model'];if(!_0x35e500[_0xcaaf('0x2f')]['hasOwnProperty'](_0xcaaf('0x35'))){_0x34019c[_0xcaaf('0x1d')]=qs[_0xcaaf('0x1d')](_0x35e500['query']['limit']);_0x34019c[_0xcaaf('0x1b')]=qs[_0xcaaf('0x1b')](_0x35e500['query']['offset']);}_0x34019c[_0xcaaf('0x36')]=qs[_0xcaaf('0x37')](_0x35e500[_0xcaaf('0x2f')]['sort']);_0x34019c[_0xcaaf('0x38')]=qs['filters'](_[_0xcaaf('0x39')](_0x35e500['query'],_0x1523bc[_0xcaaf('0x3a')]),_0x4cacf9);if(_0x35e500[_0xcaaf('0x2f')]['filter']){_0x34019c['where']=_[_0xcaaf('0x3b')](_0x34019c[_0xcaaf('0x38')],{'$or':_['map'](_0x4cacf9,function(_0x28e58e){if(_0x28e58e[_0xcaaf('0x2c')]!=='VIRTUAL'){var _0x210268={};_0x210268[_0x28e58e['name']]={'$like':'%'+_0x35e500[_0xcaaf('0x2f')][_0xcaaf('0x3c')]+'%'};return _0x210268;}})});}_0x34019c=_[_0xcaaf('0x3b')]({},_0x34019c,_0x35e500[_0xcaaf('0x3d')]);var _0x136a1f={'where':_0x34019c[_0xcaaf('0x38')]};return db[_0xcaaf('0x3e')][_0xcaaf('0x1e')](_0x136a1f)[_0xcaaf('0x25')](function(_0x48a598){_0x4c75a9['count']=_0x48a598;if(_0x35e500[_0xcaaf('0x2f')]['includeAll']){_0x34019c[_0xcaaf('0x3f')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xcaaf('0x40')](_0x34019c);})[_0xcaaf('0x25')](function(_0x11c09b){_0x4c75a9[_0xcaaf('0x41')]=_0x11c09b;return _0x4c75a9;})['then'](respondWithFilteredResult(_0x20be72,_0x34019c))[_0xcaaf('0x42')](handleError(_0x20be72,null));};exports[_0xcaaf('0x43')]=function(_0x5db97f,_0x16d607){var _0x2ee9d4={'raw':!![],'where':{'id':_0x5db97f[_0xcaaf('0x44')]['id']}},_0x7b63bb={};_0x7b63bb[_0xcaaf('0x2e')]=_[_0xcaaf('0x30')](db[_0xcaaf('0x3e')][_0xcaaf('0x2a')]);_0x7b63bb[_0xcaaf('0x2f')]=_[_0xcaaf('0x30')](_0x5db97f[_0xcaaf('0x2f')]);_0x7b63bb[_0xcaaf('0x3a')]=_[_0xcaaf('0x31')](_0x7b63bb[_0xcaaf('0x2e')],_0x7b63bb[_0xcaaf('0x2f')]);_0x2ee9d4[_0xcaaf('0x32')]=_['intersection'](_0x7b63bb['model'],qs['fields'](_0x5db97f['query'][_0xcaaf('0x33')]));_0x2ee9d4[_0xcaaf('0x32')]=_0x2ee9d4[_0xcaaf('0x32')][_0xcaaf('0x34')]?_0x2ee9d4['attributes']:_0x7b63bb['model'];if(_0x5db97f['query'][_0xcaaf('0x45')]){_0x2ee9d4[_0xcaaf('0x3f')]=[{'all':!![]}];}_0x2ee9d4=_[_0xcaaf('0x3b')]({},_0x2ee9d4,_0x5db97f[_0xcaaf('0x3d')]);return db[_0xcaaf('0x3e')][_0xcaaf('0x46')](_0x2ee9d4)[_0xcaaf('0x25')](handleEntityNotFound(_0x16d607,null))['then'](respondWithResult(_0x16d607,null))[_0xcaaf('0x42')](handleError(_0x16d607,null));};exports[_0xcaaf('0x47')]=function(_0x5a61bc,_0x5962eb){return db['WhatsappApplication'][_0xcaaf('0x47')](_0x5a61bc[_0xcaaf('0x48')],{})['then'](respondWithResult(_0x5962eb,0xc9))[_0xcaaf('0x42')](handleError(_0x5962eb,null));};exports['update']=function(_0x510324,_0x409f6b){if(_0x510324[_0xcaaf('0x48')]['id']){delete _0x510324[_0xcaaf('0x48')]['id'];}return db[_0xcaaf('0x3e')][_0xcaaf('0x46')]({'where':{'id':_0x510324[_0xcaaf('0x44')]['id']}})[_0xcaaf('0x25')](handleEntityNotFound(_0x409f6b,null))['then'](saveUpdates(_0x510324[_0xcaaf('0x48')],null))['then'](respondWithResult(_0x409f6b,null))[_0xcaaf('0x42')](handleError(_0x409f6b,null));};exports[_0xcaaf('0x49')]=function(_0x17676b,_0x24e40e){return db['WhatsappApplication'][_0xcaaf('0x46')]({'where':{'id':_0x17676b['params']['id']}})[_0xcaaf('0x25')](handleEntityNotFound(_0x24e40e,null))[_0xcaaf('0x25')](removeEntity(_0x24e40e,null))[_0xcaaf('0x42')](handleError(_0x24e40e,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index b05fee4..ea44fc4 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 _0x7250=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','WhatsappApplication','whatsapp_applications'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7250,0x1b1));var _0x0725=function(_0x536b5a,_0x4c714a){_0x536b5a=_0x536b5a-0x0;var _0x5040ed=_0x7250[_0x536b5a];return _0x5040ed;};'use strict';var _=require(_0x0725('0x0'));var util=require(_0x0725('0x1'));var logger=require('../../config/logger')(_0x0725('0x2'));var moment=require(_0x0725('0x3'));var BPromise=require(_0x0725('0x4'));var rp=require(_0x0725('0x5'));var fs=require('fs');var path=require(_0x0725('0x6'));var rimraf=require(_0x0725('0x7'));var config=require('../../config/environment');var attributes=require(_0x0725('0x8'));module['exports']=function(_0x4e8c6c,_0xa32c3f){return _0x4e8c6c['define'](_0x0725('0x9'),attributes,{'tableName':_0x0725('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0725('0xb')});}; \ No newline at end of file +var _0xf185=['exports','define','WhatsappApplication','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes'];(function(_0x49027a,_0x352e6f){var _0x190fbb=function(_0x58fc49){while(--_0x58fc49){_0x49027a['push'](_0x49027a['shift']());}};_0x190fbb(++_0x352e6f);}(_0xf185,0x1be));var _0x5f18=function(_0x289bde,_0x2fabfd){_0x289bde=_0x289bde-0x0;var _0x330bba=_0xf185[_0x289bde];return _0x330bba;};'use strict';var _=require(_0x5f18('0x0'));var util=require('util');var logger=require(_0x5f18('0x1'))(_0x5f18('0x2'));var moment=require(_0x5f18('0x3'));var BPromise=require(_0x5f18('0x4'));var rp=require(_0x5f18('0x5'));var fs=require('fs');var path=require(_0x5f18('0x6'));var rimraf=require('rimraf');var config=require(_0x5f18('0x7'));var attributes=require(_0x5f18('0x8'));module[_0x5f18('0x9')]=function(_0x1cac08,_0x5b7cc5){return _0x1cac08[_0x5f18('0xa')](_0x5f18('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5f18('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index e7734de..5556d00 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 _0x17ba=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x482f97,_0xf56b1d){var _0x17b823=function(_0x4629fa){while(--_0x4629fa){_0x482f97['push'](_0x482f97['shift']());}};_0x17b823(++_0xf56b1d);}(_0x17ba,0xab));var _0xa17b=function(_0x29dd3d,_0x3bad82){_0x29dd3d=_0x29dd3d-0x0;var _0xe2483c=_0x17ba[_0x29dd3d];return _0xe2483c;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e3d43,_0x1957be,_0x57f9cd){return new BPromise(function(_0x2ca4d3,_0x17d1d2){return client[_0xa17b('0xd')](_0x2e3d43,_0x57f9cd)[_0xa17b('0xe')](function(_0x15bdfc){logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));logger[_0xa17b('0x11')](_0xa17b('0x12'),_0x1957be,_0xa17b('0x10'),JSON[_0xa17b('0x13')](_0x15bdfc));if(_0x15bdfc[_0xa17b('0x14')]){if(_0x15bdfc['error'][_0xa17b('0x15')]===0x1f4){logger[_0xa17b('0x14')](_0xa17b('0xf'),_0x1957be,_0x15bdfc['error'][_0xa17b('0x16')]);return _0x17d1d2(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}logger[_0xa17b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x1957be,_0x15bdfc[_0xa17b('0x14')]['message']);return _0x2ca4d3(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}else{logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));_0x2ca4d3(_0x15bdfc[_0xa17b('0x17')][_0xa17b('0x16')]);}})['catch'](function(_0x98a295){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x1957be,_0x98a295);_0x17d1d2(_0x98a295);});});} \ No newline at end of file +var _0x2d17=['WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4f53d2,_0x373000){var _0x1587db=function(_0x4d2c4c){while(--_0x4d2c4c){_0x4f53d2['push'](_0x4f53d2['shift']());}};_0x1587db(++_0x373000);}(_0x2d17,0x17e));var _0x72d1=function(_0x16c594,_0x5dc1d5){_0x16c594=_0x16c594-0x0;var _0x469bb3=_0x2d17[_0x16c594];return _0x469bb3;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){return client['request'](_0x239d1f,_0x477264)[_0x72d1('0x9')](function(_0x288362){logger[_0x72d1('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x5b40a9,_0x72d1('0xb'));logger[_0x72d1('0xc')](_0x72d1('0xd'),_0x5b40a9,_0x72d1('0xb'),JSON[_0x72d1('0xe')](_0x288362));if(_0x288362[_0x72d1('0xf')]){if(_0x288362[_0x72d1('0xf')][_0x72d1('0x10')]===0x1f4){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362['error'][_0x72d1('0x12')]);return _0x19e248(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);return _0x422f5a(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}else{logger[_0x72d1('0xa')](_0x72d1('0x11'),_0x5b40a9,_0x72d1('0xb'));_0x422f5a(_0x288362[_0x72d1('0x13')]['message']);}})[_0x72d1('0x14')](function(_0x5262b0){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x5262b0);_0x19e248(_0x5262b0);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index f303e2b..a6c8d37 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 _0xafdd=['download','post','addMessage','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0xafdd,0x19a));var _0xdafd=function(_0x5e43d3,_0x4ac566){_0x5e43d3=_0x5e43d3-0x0;var _0x374f2e=_0xafdd[_0x5e43d3];return _0x374f2e;};'use strict';var multer=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var path=require(_0xdafd('0x2'));var timeout=require(_0xdafd('0x3'));var express=require(_0xdafd('0x4'));var router=express[_0xdafd('0x5')]();var fs_extra=require(_0xdafd('0x6'));var auth=require(_0xdafd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdafd('0x8'));var controller=require(_0xdafd('0x9'));router[_0xdafd('0xa')]('/',auth[_0xdafd('0xb')](),controller[_0xdafd('0xc')]);router[_0xdafd('0xa')](_0xdafd('0xd'),auth['isAuthenticated'](),controller[_0xdafd('0xe')]);router[_0xdafd('0xa')](_0xdafd('0xf'),auth['isAuthenticated'](),controller[_0xdafd('0x10')]);router[_0xdafd('0xa')](_0xdafd('0x11'),auth[_0xdafd('0xb')](),controller['getMessages']);router[_0xdafd('0xa')](_0xdafd('0x12'),auth[_0xdafd('0xb')](),controller[_0xdafd('0x13')]);router[_0xdafd('0x14')]('/',auth[_0xdafd('0xb')](),controller['create']);router[_0xdafd('0x14')]('/:id/messages',auth['isAuthenticated'](),controller[_0xdafd('0x15')]);router[_0xdafd('0x14')]('/:id/tags',auth[_0xdafd('0xb')](),interaction['tracked']('whatsapp',_0xdafd('0x16')),controller[_0xdafd('0x17')]);router[_0xdafd('0x18')](_0xdafd('0xf'),auth[_0xdafd('0xb')](),interaction['tracked'](_0xdafd('0x19'),_0xdafd('0x1a')),controller[_0xdafd('0x1b')]);router['delete'](_0xdafd('0xf'),auth[_0xdafd('0xb')](),interaction['tracked']('whatsapp',_0xdafd('0x1c')),controller['destroy']);router[_0xdafd('0x1d')](_0xdafd('0x1e'),auth[_0xdafd('0xb')](),controller[_0xdafd('0x1f')]);module[_0xdafd('0x20')]=router; \ No newline at end of file +var _0x3248=['/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy'];(function(_0xa2cbef,_0x5372f0){var _0x3b5835=function(_0x113298){while(--_0x113298){_0xa2cbef['push'](_0xa2cbef['shift']());}};_0x3b5835(++_0x5372f0);}(_0x3248,0x1b0));var _0x8324=function(_0x195af5,_0x47c2fb){_0x195af5=_0x195af5-0x0;var _0x27adc3=_0x3248[_0x195af5];return _0x27adc3;};'use strict';var multer=require(_0x8324('0x0'));var util=require(_0x8324('0x1'));var path=require(_0x8324('0x2'));var timeout=require(_0x8324('0x3'));var express=require(_0x8324('0x4'));var router=express[_0x8324('0x5')]();var fs_extra=require(_0x8324('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8324('0x7'));var controller=require(_0x8324('0x8'));router['get']('/',auth[_0x8324('0x9')](),controller[_0x8324('0xa')]);router[_0x8324('0xb')](_0x8324('0xc'),auth[_0x8324('0x9')](),controller['describe']);router[_0x8324('0xb')](_0x8324('0xd'),auth[_0x8324('0x9')](),controller['show']);router['get'](_0x8324('0xe'),auth[_0x8324('0x9')](),controller[_0x8324('0xf')]);router['get'](_0x8324('0x10'),auth[_0x8324('0x9')](),controller[_0x8324('0x11')]);router[_0x8324('0x12')]('/',auth[_0x8324('0x9')](),controller[_0x8324('0x13')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0x8324('0x14')]);router['post']('/:id/tags',auth[_0x8324('0x9')](),interaction[_0x8324('0x15')](_0x8324('0x16'),'whatsappinteraction:addtags'),controller[_0x8324('0x17')]);router[_0x8324('0x18')](_0x8324('0xd'),auth['isAuthenticated'](),interaction[_0x8324('0x15')](_0x8324('0x16'),_0x8324('0x19')),controller[_0x8324('0x1a')]);router[_0x8324('0x1b')](_0x8324('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0x8324('0x16'),_0x8324('0x1c')),controller[_0x8324('0x1d')]);router['delete'](_0x8324('0x1e'),auth[_0x8324('0x9')](),controller[_0x8324('0x1f')]);module[_0x8324('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 5831605..4d5611c 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 _0xd1ca=['STRING','out','DATE','ENUM','BOOLEAN','sequelize','moment'];(function(_0x3a909c,_0x4ca5c8){var _0x23e38f=function(_0x19abf2){while(--_0x19abf2){_0x3a909c['push'](_0x3a909c['shift']());}};_0x23e38f(++_0x4ca5c8);}(_0xd1ca,0x140));var _0xad1c=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xd1ca[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0xad1c('0x0'));var moment=require(_0xad1c('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xad1c('0x2')]},'secondDisposition':{'type':Sequelize[_0xad1c('0x2')]},'thirdDisposition':{'type':Sequelize[_0xad1c('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xad1c('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xad1c('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xad1c('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xad1c('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xad1c('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbe9d=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x3e2180,_0x49e872){var _0x142d9a=function(_0x56ae87){while(--_0x56ae87){_0x3e2180['push'](_0x3e2180['shift']());}};_0x142d9a(++_0x49e872);}(_0xbe9d,0x99));var _0xdbe9=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xbe9d[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0xdbe9('0x0'));var moment=require(_0xdbe9('0x1'));module[_0xdbe9('0x2')]={'closed':{'type':Sequelize[_0xdbe9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdbe9('0x4')]},'disposition':{'type':Sequelize[_0xdbe9('0x5')]},'secondDisposition':{'type':Sequelize[_0xdbe9('0x5')]},'thirdDisposition':{'type':Sequelize[_0xdbe9('0x5')]},'note':{'type':Sequelize[_0xdbe9('0x5')]},'phone':{'type':Sequelize[_0xdbe9('0x5')]},'read1stAt':{'type':Sequelize[_0xdbe9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xdbe9('0x6')]('in',_0xdbe9('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xdbe9('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xdbe9('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index ff5ead9..5da2c78 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 _0x19f8=['out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','api','../../mysqldb','redis','defaults','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','error','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','include','merge','options','create','body','find','WhatsappMessage','addMessage','omit','ids','getMessages','findOne','length','nolimit','order','sort','where','pick','WhatsappInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','setTags','spread','emit','removeTags','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','Account','get','mkdirSync','Owner','createdAt','closed','disposition','filter','basename','existsSync','createReadStream','pipe','createWriteStream','System'];(function(_0x3851a0,_0x547dfe){var _0x525651=function(_0x136edb){while(--_0x136edb){_0x3851a0['push'](_0x3851a0['shift']());}};_0x525651(++_0x547dfe);}(_0x19f8,0x186));var _0x819f=function(_0x2fc6cf,_0x2bb133){_0x2fc6cf=_0x2fc6cf-0x0;var _0xf2ade3=_0x19f8[_0x2fc6cf];return _0xf2ade3;};'use strict';var rimraf=require(_0x819f('0x0'));var zipdir=require(_0x819f('0x1'));var moment=require(_0x819f('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x819f('0x3'));var ejs=require(_0x819f('0x4'));var fs=require('fs');var _=require(_0x819f('0x5'));var Redis=require(_0x819f('0x6'));var interaction=require(_0x819f('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x819f('0x8'));var logger=require('../../config/logger')(_0x819f('0x9'));var config=require('../../config/environment');var db=require(_0x819f('0xa'))['db'];config[_0x819f('0xb')]=_[_0x819f('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x819f('0xb')]));require(_0x819f('0xd'))[_0x819f('0xe')](socket);function respondWithStatusCode(_0xedc2f,_0x5a7a9f){_0x5a7a9f=_0x5a7a9f||0xcc;return function(_0xd65b32){if(_0xd65b32){return _0xedc2f[_0x819f('0xf')](_0x5a7a9f);}return _0xedc2f[_0x819f('0x10')](_0x5a7a9f)['end']();};}function respondWithResult(_0x360ba1,_0x4ff1a0){_0x4ff1a0=_0x4ff1a0||0xc8;return function(_0x4ea492){if(_0x4ea492){return _0x360ba1['status'](_0x4ff1a0)[_0x819f('0x11')](_0x4ea492);}};}function respondWithFilteredResult(_0x394a56,_0xe3bb46){return function(_0x1f4fc4){if(_0x1f4fc4){var _0x5e89a1=typeof _0xe3bb46[_0x819f('0x12')]===_0x819f('0x13')&&typeof _0xe3bb46[_0x819f('0x14')]===_0x819f('0x13');var _0x3fa077=_0x1f4fc4[_0x819f('0x15')];var _0x424255=_0x5e89a1?0x0:_0xe3bb46[_0x819f('0x12')];var _0x2b80d4=_0x5e89a1?_0x1f4fc4['count']:_0xe3bb46['offset']+_0xe3bb46[_0x819f('0x14')];var _0x4e35bb;if(_0x2b80d4>=_0x3fa077){_0x2b80d4=_0x3fa077;_0x4e35bb=0xc8;}else{_0x4e35bb=0xce;}_0x394a56[_0x819f('0x10')](_0x4e35bb);return _0x394a56['set'](_0x819f('0x16'),_0x424255+'-'+_0x2b80d4+'/'+_0x3fa077)[_0x819f('0x11')](_0x1f4fc4);}return null;};}function saveUpdates(_0x874a9c){return function(_0x1338a7){if(_0x1338a7){return _0x1338a7[_0x819f('0x17')](_0x874a9c)[_0x819f('0x18')](function(_0x446d2f){return _0x446d2f;});}return null;};}function removeEntity(_0x166aaa){return function(_0x1f9c6b){if(_0x1f9c6b){return _0x1f9c6b[_0x819f('0x19')]()[_0x819f('0x18')](function(){_0x166aaa['status'](0xcc)[_0x819f('0x1a')]();});}};}function handleEntityNotFound(_0x4a88df){return function(_0x45ef9e){if(!_0x45ef9e){_0x4a88df[_0x819f('0xf')](0x194);}return _0x45ef9e;};}function handleError(_0x16b4b4,_0x1284fa){_0x1284fa=_0x1284fa||0x1f4;return function(_0x2742b1){logger[_0x819f('0x1b')](_0x2742b1['stack']);if(_0x2742b1[_0x819f('0x1c')]){delete _0x2742b1[_0x819f('0x1c')];}_0x16b4b4[_0x819f('0x10')](_0x1284fa)[_0x819f('0x1d')](_0x2742b1);};}exports[_0x819f('0x1e')]=function(_0x4fafe3,_0x230890){var _0x32f07f={};var _0x291a61=_[_0x819f('0x1f')](db[_0x819f('0x20')][_0x819f('0x21')],function(_0x331c0d){return{'name':_0x331c0d[_0x819f('0x22')],'type':_0x331c0d['type'][_0x819f('0x23')]};});_0x32f07f=qs[_0x819f('0x24')](_0x291a61,_0x4fafe3);return interaction[_0x819f('0x25')](_0x819f('0x26'),_0x4fafe3[_0x819f('0x27')],_0x4fafe3[_0x819f('0x28')],_0x32f07f,_0x291a61)[_0x819f('0x18')](respondWithFilteredResult(_0x230890,_0x32f07f))[_0x819f('0x29')](handleError(_0x230890,null));};exports[_0x819f('0x2a')]=function(_0x5f0784,_0x582940){var _0x92b7eb={'raw':![],'where':{'id':_0x5f0784[_0x819f('0x2b')]['id']}},_0x148f13={};_0x148f13[_0x819f('0x2c')]=_[_0x819f('0x2d')](db[_0x819f('0x20')][_0x819f('0x21')]);_0x148f13[_0x819f('0x27')]=_['keys'](_0x5f0784[_0x819f('0x27')]);_0x148f13[_0x819f('0x2e')]=_[_0x819f('0x2f')](_0x148f13[_0x819f('0x2c')],_0x148f13[_0x819f('0x27')]);_0x92b7eb[_0x819f('0x30')]=_[_0x819f('0x2f')](_0x148f13[_0x819f('0x2c')],qs[_0x819f('0x31')](_0x5f0784['query'][_0x819f('0x31')]));_0x92b7eb['attributes']=_0x92b7eb['attributes']['length']?_0x92b7eb[_0x819f('0x30')]:_0x148f13[_0x819f('0x2c')];if(_0x5f0784[_0x819f('0x27')]['includeAll']){_0x92b7eb[_0x819f('0x32')]=[{'all':!![]}];}_0x92b7eb=_[_0x819f('0x33')]({},_0x92b7eb,_0x5f0784[_0x819f('0x34')]);return db[_0x819f('0x20')]['find'](_0x92b7eb)['then'](handleEntityNotFound(_0x582940,null))[_0x819f('0x18')](respondWithResult(_0x582940,null))[_0x819f('0x29')](handleError(_0x582940,null));};exports[_0x819f('0x35')]=function(_0x2b82b7,_0x1658a5){return db[_0x819f('0x20')][_0x819f('0x35')](_0x2b82b7['body'],{})[_0x819f('0x18')](respondWithResult(_0x1658a5,0xc9))[_0x819f('0x29')](handleError(_0x1658a5,null));};exports[_0x819f('0x17')]=function(_0x373244,_0x15f559){if(_0x373244[_0x819f('0x36')]['id']){delete _0x373244['body']['id'];}return db[_0x819f('0x20')][_0x819f('0x37')]({'where':{'id':_0x373244[_0x819f('0x2b')]['id']}})[_0x819f('0x18')](handleEntityNotFound(_0x15f559,null))[_0x819f('0x18')](saveUpdates(_0x373244['body'],null))[_0x819f('0x18')](respondWithResult(_0x15f559,null))['catch'](handleError(_0x15f559,null));};exports['destroy']=function(_0x3ebad8,_0x5d1053){return db['WhatsappInteraction']['find']({'where':{'id':_0x3ebad8[_0x819f('0x2b')]['id']}})[_0x819f('0x18')](handleEntityNotFound(_0x5d1053,null))['then'](removeEntity(_0x5d1053,null))[_0x819f('0x29')](handleError(_0x5d1053,null));};exports['describe']=function(_0x16d835,_0x48b5f4){return db[_0x819f('0x20')]['describe']()['then'](respondWithResult(_0x48b5f4,null))[_0x819f('0x29')](handleError(_0x48b5f4,null));};exports['addMessage']=function(_0x308408,_0x49eede){return db[_0x819f('0x38')][_0x819f('0x37')]({'where':{'id':_0x308408[_0x819f('0x2b')]['id']}})[_0x819f('0x18')](handleEntityNotFound(_0x49eede,null))['then'](function(_0x1cdd7b){if(_0x1cdd7b){return _0x1cdd7b[_0x819f('0x39')](_0x308408[_0x819f('0x36')]['ids'],_[_0x819f('0x3a')](_0x308408['body'],[_0x819f('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x49eede,null))[_0x819f('0x29')](handleError(_0x49eede,null));};exports[_0x819f('0x3c')]=function(_0x3324d3,_0x7c4644){var _0x33a1da={'raw':![],'where':{}};var _0xe8eade={};var _0x50fb23={'count':0x0,'rows':[]};return db[_0x819f('0x20')][_0x819f('0x3d')]({'where':{'id':_0x3324d3[_0x819f('0x2b')]['id']}})['then'](handleEntityNotFound(_0x7c4644,null))[_0x819f('0x18')](function(_0x58aef4){if(_0x58aef4){_0xe8eade[_0x819f('0x2c')]=_[_0x819f('0x2d')](db[_0x819f('0x38')]['rawAttributes']);_0xe8eade[_0x819f('0x27')]=_['keys'](_0x3324d3[_0x819f('0x27')]);_0xe8eade['filters']=_[_0x819f('0x2f')](_0xe8eade[_0x819f('0x2c')],_0xe8eade[_0x819f('0x27')]);_0x33a1da[_0x819f('0x30')]=_[_0x819f('0x2f')](_0xe8eade[_0x819f('0x2c')],qs['fields'](_0x3324d3['query']['fields']));_0x33a1da[_0x819f('0x30')]=_0x33a1da[_0x819f('0x30')][_0x819f('0x3e')]?_0x33a1da[_0x819f('0x30')]:_0xe8eade[_0x819f('0x2c')];if(!_0x3324d3[_0x819f('0x27')]['hasOwnProperty'](_0x819f('0x3f'))){_0x33a1da[_0x819f('0x14')]=qs['limit'](_0x3324d3[_0x819f('0x27')][_0x819f('0x14')]);_0x33a1da['offset']=qs[_0x819f('0x12')](_0x3324d3[_0x819f('0x27')]['offset']);}_0x33a1da[_0x819f('0x40')]=qs[_0x819f('0x41')](_0x3324d3[_0x819f('0x27')][_0x819f('0x41')]);_0x33a1da[_0x819f('0x42')]=qs['filters'](_[_0x819f('0x43')](_0x3324d3['query'],_0xe8eade['filters']));_0x33a1da[_0x819f('0x42')][_0x819f('0x44')]=_0x58aef4['id'];if(_0x3324d3['query']['filter']){_0x33a1da[_0x819f('0x42')]=_[_0x819f('0x33')](_0x33a1da[_0x819f('0x42')],{'$or':_[_0x819f('0x1f')](_0x33a1da['attributes'],function(_0x3e6d06){var _0x3b0258={};_0x3b0258[_0x3e6d06]={'$like':'%'+_0x3324d3[_0x819f('0x27')]['filter']+'%'};return _0x3b0258;})});}if(_0x3324d3[_0x819f('0x27')]['$gte']){var _0x16d246=_0x3324d3[_0x819f('0x27')][_0x819f('0x45')][_0x819f('0x46')](',');var _0x7dfcc3={};_0x7dfcc3[_0x16d246[0x0]]={'$gte':moment(_0x16d246[0x1])[_0x819f('0x47')](_0x819f('0x48'))};_0x33a1da['where']=_[_0x819f('0x33')](_0x33a1da[_0x819f('0x42')],_0x7dfcc3);}_0x33a1da=_[_0x819f('0x33')]({},_0x33a1da,_0x3324d3[_0x819f('0x34')]);return db[_0x819f('0x38')][_0x819f('0x15')]({'where':_0x33a1da['where']})[_0x819f('0x18')](function(_0x309485){_0x50fb23['count']=_0x309485;if(_0x3324d3[_0x819f('0x27')][_0x819f('0x49')]){_0x33a1da[_0x819f('0x32')]=[{'all':!![]}];}return db[_0x819f('0x38')][_0x819f('0x25')](_0x33a1da);})['then'](function(_0x510924){_0x50fb23[_0x819f('0x4a')]=_0x510924;return _0x50fb23;});}})[_0x819f('0x18')](respondWithFilteredResult(_0x7c4644,_0x33a1da))['catch'](handleError(_0x7c4644,null));};exports['addTags']=function(_0xd36ec0,_0x5adf97){return db[_0x819f('0x20')][_0x819f('0x37')]({'where':{'id':_0xd36ec0[_0x819f('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5adf97,null))[_0x819f('0x18')](function(_0x17f2b5){if(_0x17f2b5){return _0x17f2b5[_0x819f('0x4b')](_0xd36ec0[_0x819f('0x36')][_0x819f('0x3b')],_[_0x819f('0x3a')](_0xd36ec0['body'],['ids','id'])||{})[_0x819f('0x4c')](function(){return db['Tag'][_0x819f('0x25')]({'attributes':['id','name','color'],'where':{'id':_0xd36ec0['body'][_0x819f('0x3b')]}});})['then'](function(_0x394eb5){socket[_0x819f('0x4d')]('whatsappInteractionTags:save',{'id':Number(_0xd36ec0['params']['id']),'tags':_0x394eb5||[]});return{'id':Number(_0xd36ec0[_0x819f('0x2b')]['id']),'tags':_0x394eb5||[]};});}})[_0x819f('0x18')](respondWithResult(_0x5adf97,null))['catch'](handleError(_0x5adf97,null));};exports[_0x819f('0x4e')]=function(_0x461240,_0x5b2e08){return db[_0x819f('0x20')]['find']({'where':{'id':_0x461240[_0x819f('0x2b')]['id']}})[_0x819f('0x18')](handleEntityNotFound(_0x5b2e08,null))[_0x819f('0x18')](function(_0x2422fe){if(_0x2422fe){return _0x2422fe['removeTags'](_0x461240[_0x819f('0x27')][_0x819f('0x3b')]);}})[_0x819f('0x18')](respondWithStatusCode(_0x5b2e08,null))[_0x819f('0x29')](handleError(_0x5b2e08,null));};exports[_0x819f('0x4f')]=function(_0x2ced09,_0x27c8b1){var _0x3f1894=moment()['unix']()[_0x819f('0x50')]();var _0x150851=path[_0x819f('0x51')](config[_0x819f('0x52')],_0x819f('0x53'),_0x819f('0x54'),_0x819f('0x55'));var _0x25028d=path[_0x819f('0x51')](config[_0x819f('0x52')],_0x819f('0x53'),_0x819f('0x54'),_0x819f('0x56'));var _0x2f54ea=path['join'](_0x150851,_0x3f1894);var _0x336981=util[_0x819f('0x47')](_0x819f('0x57'),_0x2ced09[_0x819f('0x2b')]['id'],_0x3f1894);var _0x3f891c=path['join'](_0x150851,_0x336981);var _0x5a53d7=[];_0x5a53d7[_0x819f('0x58')]({'model':db[_0x819f('0x59')],'as':'User','attributes':['id',_0x819f('0x5a')],'raw':!![]});_0x5a53d7[_0x819f('0x58')]({'model':db[_0x819f('0x5b')],'as':_0x819f('0x5c'),'attributes':['id',_0x819f('0x5d'),_0x819f('0x5e')],'raw':!![]});if(_0x2ced09['query'][_0x819f('0x56')]){_0x5a53d7['push']({'model':db[_0x819f('0x5f')],'as':_0x819f('0x5f'),'raw':!![]});}var _0x4008b5=[{'model':db[_0x819f('0x38')],'as':_0x819f('0x60'),'attributes':['id','body','createdAt',_0x819f('0x61'),_0x819f('0x62'),_0x819f('0x63')],'include':_0x5a53d7}];_0x4008b5[_0x819f('0x58')]({'model':db['WhatsappAccount'],'as':_0x819f('0x64'),'attributes':['id','name']});_0x4008b5[_0x819f('0x58')]({'model':db[_0x819f('0x59')],'as':'Owner','attributes':['id',_0x819f('0x5a')]});return db[_0x819f('0x20')][_0x819f('0x37')]({'where':{'id':_0x2ced09[_0x819f('0x2b')]['id']},'include':_0x4008b5})[_0x819f('0x18')](handleEntityNotFound(_0x27c8b1,null))[_0x819f('0x18')](function(_0x5f1bf2){if(_0x5f1bf2){var _0x393e61=_0x5f1bf2[_0x819f('0x65')]({'plain':!![]});fs[_0x819f('0x66')](_0x2f54ea);var _0x250cb2={'channel':'Whatsapp','account':_0x393e61[_0x819f('0x64')][_0x819f('0x1c')],'agent':_0x393e61[_0x819f('0x67')]?_0x393e61['Owner'][_0x819f('0x5a')]:'N.A.','createdAt':moment(_0x393e61[_0x819f('0x68')])['format'](_0x819f('0x48'))[_0x819f('0x50')](),'closedAt':_0x393e61[_0x819f('0x69')]?moment(_0x393e61['closedAt'])[_0x819f('0x47')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x393e61[_0x819f('0x6a')],'messages':_(_0x393e61[_0x819f('0x60')])[_0x819f('0x6b')]({'secret':![]})[_0x819f('0x1f')](function(_0x3f4ce1){if(_0x3f4ce1[_0x819f('0x5f')]){var _0x246bb8=path[_0x819f('0x51')](_0x25028d,_0x3f4ce1[_0x819f('0x5f')][_0x819f('0x6c')]);if(fs[_0x819f('0x6d')](_0x246bb8)){fs[_0x819f('0x6e')](_0x246bb8)[_0x819f('0x6f')](fs[_0x819f('0x70')](path[_0x819f('0x51')](_0x2f54ea,_0x3f4ce1[_0x819f('0x5f')][_0x819f('0x6c')])));}}return{'date':moment(_0x3f4ce1['createdAt'])[_0x819f('0x47')](_0x819f('0x48'))[_0x819f('0x50')](),'sender':_0x3f4ce1[_0x819f('0x61')]==='out'?_0x3f4ce1[_0x819f('0x59')]?_0x3f4ce1[_0x819f('0x59')]['fullname']:_0x819f('0x71'):_0x3f4ce1[_0x819f('0x5c')]['firstName']+(_0x3f4ce1[_0x819f('0x5c')][_0x819f('0x5e')]?'\x20'+_0x3f4ce1[_0x819f('0x5c')][_0x819f('0x5e')]:''),'body':_0x3f4ce1[_0x819f('0x5f')]?_0x3f4ce1[_0x819f('0x5f')][_0x819f('0x6c')]:_0x3f4ce1[_0x819f('0x36')],'direction':_0x3f4ce1[_0x819f('0x61')]===_0x819f('0x72')?'A':'C','secret':_0x3f4ce1[_0x819f('0x62')],'read':_0x3f4ce1[_0x819f('0x63')],'attachment':_0x3f4ce1[_0x819f('0x5f')]};})[_0x819f('0x73')]()};return ejs[_0x819f('0x74')](path[_0x819f('0x51')](config[_0x819f('0x52')],_0x819f('0x53'),_0x819f('0x75'),_0x819f('0x76')),{'interaction':_0x250cb2})['then'](function(_0x2f154f){var _0x13afac=path[_0x819f('0x51')](_0x2f54ea,_0x819f('0x77')+_0x393e61['id']+'-'+_0x3f1894+_0x819f('0x78'));var _0x2c5efe={'path':_0x13afac,'channel':_0x819f('0x79'),'interactionId':_0x393e61['id']};return pdf[_0x819f('0x7a')](_0x2f154f,_0x2c5efe);})['then'](function(){return new BPromise(function(_0x44cb4c,_0x1b2452){zipdir(_0x2f54ea,{'saveTo':_0x3f891c},function(_0x287ab8,_0x368aba){if(_0x287ab8)return _0x1b2452(_0x287ab8);return _0x44cb4c(_0x368aba);});})[_0x819f('0x18')](function(){return new BPromise(function(_0x44e4e7,_0x36e059){rimraf(_0x2f54ea,function(_0x1ba9d3){if(_0x1ba9d3)_0x36e059(_0x1ba9d3);return _0x44e4e7();});});})[_0x819f('0x18')](function(){return _0x27c8b1['download'](_0x3f891c,_0x336981,function(_0x524234){if(_0x524234){console[_0x819f('0x7b')](_0x819f('0x7c'),_0x524234);}else{fs[_0x819f('0x7d')](_0x3f891c);}});});});}else{return _0x27c8b1[_0x819f('0xf')](0xc8);}})[_0x819f('0x29')](handleError(_0x27c8b1,null));}; \ No newline at end of file +var _0x053c=['createWriteStream','direction','out','value','renderFile','downloadInteraction.ejs','transcript-','Whatsapp','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/export/pdf','api','redis','defaults','localhost','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','findAll','query','catch','params','model','filters','intersection','attributes','fields','length','includeAll','include','merge','options','WhatsappInteraction','find','create','body','update','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','keys','nolimit','order','sort','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','secret','read','Account','Owner','get','mkdirSync','closedAt','disposition','basename','pipe'];(function(_0x5cc51f,_0x22c480){var _0x315a2f=function(_0x4f93bd){while(--_0x4f93bd){_0x5cc51f['push'](_0x5cc51f['shift']());}};_0x315a2f(++_0x22c480);}(_0x053c,0xfc));var _0xc053=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x053c[_0x4565bf];return _0x5610ba;};'use strict';var rimraf=require(_0xc053('0x0'));var zipdir=require(_0xc053('0x1'));var moment=require(_0xc053('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xc053('0x3'));var ejs=require(_0xc053('0x4'));var fs=require('fs');var _=require(_0xc053('0x5'));var Redis=require(_0xc053('0x6'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0xc053('0x7'));var logger=require('../../config/logger')(_0xc053('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xc053('0x9')]=_[_0xc053('0xa')](config['redis'],{'host':_0xc053('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc053('0x9')]));require(_0xc053('0xc'))['register'](socket);function respondWithStatusCode(_0xde4aa7,_0x5c19ff){_0x5c19ff=_0x5c19ff||0xcc;return function(_0x12fdc6){if(_0x12fdc6){return _0xde4aa7[_0xc053('0xd')](_0x5c19ff);}return _0xde4aa7[_0xc053('0xe')](_0x5c19ff)[_0xc053('0xf')]();};}function respondWithResult(_0x1e8c61,_0xe7e073){_0xe7e073=_0xe7e073||0xc8;return function(_0x3b26b6){if(_0x3b26b6){return _0x1e8c61[_0xc053('0xe')](_0xe7e073)[_0xc053('0x10')](_0x3b26b6);}};}function respondWithFilteredResult(_0x57f00e,_0x1a5749){return function(_0x32032e){if(_0x32032e){var _0x24f7fb=typeof _0x1a5749[_0xc053('0x11')]===_0xc053('0x12')&&typeof _0x1a5749[_0xc053('0x13')]===_0xc053('0x12');var _0x2b1854=_0x32032e['count'];var _0x181107=_0x24f7fb?0x0:_0x1a5749[_0xc053('0x11')];var _0x8a4b1b=_0x24f7fb?_0x32032e[_0xc053('0x14')]:_0x1a5749[_0xc053('0x11')]+_0x1a5749['limit'];var _0x2381ca;if(_0x8a4b1b>=_0x2b1854){_0x8a4b1b=_0x2b1854;_0x2381ca=0xc8;}else{_0x2381ca=0xce;}_0x57f00e['status'](_0x2381ca);return _0x57f00e[_0xc053('0x15')]('Content-Range',_0x181107+'-'+_0x8a4b1b+'/'+_0x2b1854)['json'](_0x32032e);}return null;};}function saveUpdates(_0x55a034){return function(_0x1468bd){if(_0x1468bd){return _0x1468bd['update'](_0x55a034)[_0xc053('0x16')](function(_0x3603ec){return _0x3603ec;});}return null;};}function removeEntity(_0xbbb661){return function(_0x23287e){if(_0x23287e){return _0x23287e[_0xc053('0x17')]()[_0xc053('0x16')](function(){_0xbbb661[_0xc053('0xe')](0xcc)[_0xc053('0xf')]();});}};}function handleEntityNotFound(_0x4af9dd){return function(_0x5ee846){if(!_0x5ee846){_0x4af9dd[_0xc053('0xd')](0x194);}return _0x5ee846;};}function handleError(_0x4d9a88,_0x3970fe){_0x3970fe=_0x3970fe||0x1f4;return function(_0x2657f8){logger[_0xc053('0x18')](_0x2657f8[_0xc053('0x19')]);if(_0x2657f8['name']){delete _0x2657f8[_0xc053('0x1a')];}_0x4d9a88[_0xc053('0xe')](_0x3970fe)[_0xc053('0x1b')](_0x2657f8);};}exports['index']=function(_0x46bf14,_0x2e93d7){var _0xf51d6b={};var _0x5bd3eb=_[_0xc053('0x1c')](db['WhatsappInteraction'][_0xc053('0x1d')],function(_0x3514c5){return{'name':_0x3514c5[_0xc053('0x1e')],'type':_0x3514c5[_0xc053('0x1f')][_0xc053('0x20')]};});_0xf51d6b=qs['getOptions'](_0x5bd3eb,_0x46bf14);return interaction[_0xc053('0x21')]('whatsapp',_0x46bf14[_0xc053('0x22')],_0x46bf14['user'],_0xf51d6b,_0x5bd3eb)[_0xc053('0x16')](respondWithFilteredResult(_0x2e93d7,_0xf51d6b))[_0xc053('0x23')](handleError(_0x2e93d7,null));};exports['show']=function(_0x1f4020,_0x259092){var _0x5d1328={'raw':![],'where':{'id':_0x1f4020[_0xc053('0x24')]['id']}},_0x20e643={};_0x20e643[_0xc053('0x25')]=_['keys'](db['WhatsappInteraction'][_0xc053('0x1d')]);_0x20e643['query']=_['keys'](_0x1f4020[_0xc053('0x22')]);_0x20e643[_0xc053('0x26')]=_[_0xc053('0x27')](_0x20e643[_0xc053('0x25')],_0x20e643['query']);_0x5d1328[_0xc053('0x28')]=_[_0xc053('0x27')](_0x20e643[_0xc053('0x25')],qs[_0xc053('0x29')](_0x1f4020[_0xc053('0x22')][_0xc053('0x29')]));_0x5d1328['attributes']=_0x5d1328['attributes'][_0xc053('0x2a')]?_0x5d1328['attributes']:_0x20e643[_0xc053('0x25')];if(_0x1f4020[_0xc053('0x22')][_0xc053('0x2b')]){_0x5d1328[_0xc053('0x2c')]=[{'all':!![]}];}_0x5d1328=_[_0xc053('0x2d')]({},_0x5d1328,_0x1f4020[_0xc053('0x2e')]);return db[_0xc053('0x2f')][_0xc053('0x30')](_0x5d1328)[_0xc053('0x16')](handleEntityNotFound(_0x259092,null))[_0xc053('0x16')](respondWithResult(_0x259092,null))[_0xc053('0x23')](handleError(_0x259092,null));};exports['create']=function(_0x472a93,_0x46af95){return db[_0xc053('0x2f')][_0xc053('0x31')](_0x472a93[_0xc053('0x32')],{})['then'](respondWithResult(_0x46af95,0xc9))[_0xc053('0x23')](handleError(_0x46af95,null));};exports[_0xc053('0x33')]=function(_0x39b94a,_0x4639d5){if(_0x39b94a[_0xc053('0x32')]['id']){delete _0x39b94a[_0xc053('0x32')]['id'];}return db[_0xc053('0x2f')][_0xc053('0x30')]({'where':{'id':_0x39b94a['params']['id']}})['then'](handleEntityNotFound(_0x4639d5,null))[_0xc053('0x16')](saveUpdates(_0x39b94a[_0xc053('0x32')],null))[_0xc053('0x16')](respondWithResult(_0x4639d5,null))[_0xc053('0x23')](handleError(_0x4639d5,null));};exports[_0xc053('0x17')]=function(_0x42a1de,_0x71abb7){return db[_0xc053('0x2f')][_0xc053('0x30')]({'where':{'id':_0x42a1de[_0xc053('0x24')]['id']}})[_0xc053('0x16')](handleEntityNotFound(_0x71abb7,null))['then'](removeEntity(_0x71abb7,null))[_0xc053('0x23')](handleError(_0x71abb7,null));};exports[_0xc053('0x34')]=function(_0x327f45,_0x1fa566){return db[_0xc053('0x2f')][_0xc053('0x34')]()[_0xc053('0x16')](respondWithResult(_0x1fa566,null))['catch'](handleError(_0x1fa566,null));};exports[_0xc053('0x35')]=function(_0x193e99,_0x44541f){return db[_0xc053('0x36')]['find']({'where':{'id':_0x193e99['params']['id']}})[_0xc053('0x16')](handleEntityNotFound(_0x44541f,null))[_0xc053('0x16')](function(_0x3b6d75){if(_0x3b6d75){return _0x3b6d75[_0xc053('0x35')](_0x193e99[_0xc053('0x32')][_0xc053('0x37')],_[_0xc053('0x38')](_0x193e99[_0xc053('0x32')],[_0xc053('0x37'),'id'])||{});}})['then'](respondWithResult(_0x44541f,null))[_0xc053('0x23')](handleError(_0x44541f,null));};exports[_0xc053('0x39')]=function(_0x4583e9,_0x1d1b3c){var _0x287131={'raw':![],'where':{}};var _0x37448e={};var _0x14436d={'count':0x0,'rows':[]};return db[_0xc053('0x2f')][_0xc053('0x3a')]({'where':{'id':_0x4583e9['params']['id']}})[_0xc053('0x16')](handleEntityNotFound(_0x1d1b3c,null))[_0xc053('0x16')](function(_0x4fbb82){if(_0x4fbb82){_0x37448e['model']=_[_0xc053('0x3b')](db[_0xc053('0x36')][_0xc053('0x1d')]);_0x37448e['query']=_['keys'](_0x4583e9['query']);_0x37448e[_0xc053('0x26')]=_[_0xc053('0x27')](_0x37448e[_0xc053('0x25')],_0x37448e[_0xc053('0x22')]);_0x287131[_0xc053('0x28')]=_[_0xc053('0x27')](_0x37448e[_0xc053('0x25')],qs[_0xc053('0x29')](_0x4583e9['query']['fields']));_0x287131[_0xc053('0x28')]=_0x287131[_0xc053('0x28')]['length']?_0x287131[_0xc053('0x28')]:_0x37448e[_0xc053('0x25')];if(!_0x4583e9[_0xc053('0x22')]['hasOwnProperty'](_0xc053('0x3c'))){_0x287131[_0xc053('0x13')]=qs[_0xc053('0x13')](_0x4583e9['query']['limit']);_0x287131['offset']=qs[_0xc053('0x11')](_0x4583e9[_0xc053('0x22')][_0xc053('0x11')]);}_0x287131[_0xc053('0x3d')]=qs[_0xc053('0x3e')](_0x4583e9['query']['sort']);_0x287131[_0xc053('0x3f')]=qs[_0xc053('0x26')](_['pick'](_0x4583e9[_0xc053('0x22')],_0x37448e['filters']));_0x287131[_0xc053('0x3f')][_0xc053('0x40')]=_0x4fbb82['id'];if(_0x4583e9['query'][_0xc053('0x41')]){_0x287131[_0xc053('0x3f')]=_[_0xc053('0x2d')](_0x287131[_0xc053('0x3f')],{'$or':_[_0xc053('0x1c')](_0x287131['attributes'],function(_0x51c7c9){var _0x38d3bc={};_0x38d3bc[_0x51c7c9]={'$like':'%'+_0x4583e9[_0xc053('0x22')]['filter']+'%'};return _0x38d3bc;})});}if(_0x4583e9[_0xc053('0x22')][_0xc053('0x42')]){var _0x29ce3e=_0x4583e9[_0xc053('0x22')]['$gte'][_0xc053('0x43')](',');var _0x1a9a88={};_0x1a9a88[_0x29ce3e[0x0]]={'$gte':moment(_0x29ce3e[0x1])[_0xc053('0x44')](_0xc053('0x45'))};_0x287131[_0xc053('0x3f')]=_[_0xc053('0x2d')](_0x287131[_0xc053('0x3f')],_0x1a9a88);}_0x287131=_[_0xc053('0x2d')]({},_0x287131,_0x4583e9[_0xc053('0x2e')]);return db['WhatsappMessage'][_0xc053('0x14')]({'where':_0x287131[_0xc053('0x3f')]})[_0xc053('0x16')](function(_0x1a1bd0){_0x14436d[_0xc053('0x14')]=_0x1a1bd0;if(_0x4583e9[_0xc053('0x22')][_0xc053('0x2b')]){_0x287131['include']=[{'all':!![]}];}return db[_0xc053('0x36')][_0xc053('0x21')](_0x287131);})[_0xc053('0x16')](function(_0xe6afec){_0x14436d[_0xc053('0x46')]=_0xe6afec;return _0x14436d;});}})[_0xc053('0x16')](respondWithFilteredResult(_0x1d1b3c,_0x287131))['catch'](handleError(_0x1d1b3c,null));};exports[_0xc053('0x47')]=function(_0x5aa4a9,_0x212ba9){return db[_0xc053('0x2f')][_0xc053('0x30')]({'where':{'id':_0x5aa4a9[_0xc053('0x24')]['id']}})[_0xc053('0x16')](handleEntityNotFound(_0x212ba9,null))[_0xc053('0x16')](function(_0x501303){if(_0x501303){return _0x501303[_0xc053('0x48')](_0x5aa4a9[_0xc053('0x32')][_0xc053('0x37')],_[_0xc053('0x38')](_0x5aa4a9[_0xc053('0x32')],[_0xc053('0x37'),'id'])||{})[_0xc053('0x49')](function(){return db[_0xc053('0x4a')][_0xc053('0x21')]({'attributes':['id','name',_0xc053('0x4b')],'where':{'id':_0x5aa4a9['body']['ids']}});})['then'](function(_0x1a90f4){socket['emit'](_0xc053('0x4c'),{'id':Number(_0x5aa4a9[_0xc053('0x24')]['id']),'tags':_0x1a90f4||[]});return{'id':Number(_0x5aa4a9[_0xc053('0x24')]['id']),'tags':_0x1a90f4||[]};});}})['then'](respondWithResult(_0x212ba9,null))[_0xc053('0x23')](handleError(_0x212ba9,null));};exports[_0xc053('0x4d')]=function(_0x1f4940,_0x20c141){return db[_0xc053('0x2f')][_0xc053('0x30')]({'where':{'id':_0x1f4940[_0xc053('0x24')]['id']}})[_0xc053('0x16')](handleEntityNotFound(_0x20c141,null))[_0xc053('0x16')](function(_0x5c54e2){if(_0x5c54e2){return _0x5c54e2[_0xc053('0x4d')](_0x1f4940[_0xc053('0x22')][_0xc053('0x37')]);}})[_0xc053('0x16')](respondWithStatusCode(_0x20c141,null))[_0xc053('0x23')](handleError(_0x20c141,null));};exports[_0xc053('0x4e')]=function(_0x1bd130,_0x10ddf0){var _0x2a0c3d=moment()[_0xc053('0x4f')]()[_0xc053('0x50')]();var _0x2721d5=path[_0xc053('0x51')](config[_0xc053('0x52')],_0xc053('0x53'),'files',_0xc053('0x54'));var _0x336e0f=path[_0xc053('0x51')](config['root'],_0xc053('0x53'),_0xc053('0x55'),_0xc053('0x56'));var _0x31a72d=path[_0xc053('0x51')](_0x2721d5,_0x2a0c3d);var _0xacc3ca=util[_0xc053('0x44')](_0xc053('0x57'),_0x1bd130[_0xc053('0x24')]['id'],_0x2a0c3d);var _0x4d3922=path['join'](_0x2721d5,_0xacc3ca);var _0x2439ed=[];_0x2439ed[_0xc053('0x58')]({'model':db[_0xc053('0x59')],'as':_0xc053('0x59'),'attributes':['id',_0xc053('0x5a')],'raw':!![]});_0x2439ed[_0xc053('0x58')]({'model':db[_0xc053('0x5b')],'as':_0xc053('0x5c'),'attributes':['id',_0xc053('0x5d'),_0xc053('0x5e')],'raw':!![]});if(_0x1bd130['query'][_0xc053('0x56')]){_0x2439ed[_0xc053('0x58')]({'model':db['Attachment'],'as':_0xc053('0x5f'),'raw':!![]});}var _0x359938=[{'model':db['WhatsappMessage'],'as':_0xc053('0x60'),'attributes':['id','body',_0xc053('0x61'),'direction',_0xc053('0x62'),_0xc053('0x63')],'include':_0x2439ed}];_0x359938['push']({'model':db['WhatsappAccount'],'as':_0xc053('0x64'),'attributes':['id',_0xc053('0x1a')]});_0x359938[_0xc053('0x58')]({'model':db[_0xc053('0x59')],'as':_0xc053('0x65'),'attributes':['id','fullname']});return db['WhatsappInteraction']['find']({'where':{'id':_0x1bd130['params']['id']},'include':_0x359938})[_0xc053('0x16')](handleEntityNotFound(_0x10ddf0,null))[_0xc053('0x16')](function(_0x3f503b){if(_0x3f503b){var _0x36e218=_0x3f503b[_0xc053('0x66')]({'plain':!![]});fs[_0xc053('0x67')](_0x31a72d);var _0x579a4f={'channel':'Whatsapp','account':_0x36e218['Account']['name'],'agent':_0x36e218[_0xc053('0x65')]?_0x36e218[_0xc053('0x65')][_0xc053('0x5a')]:'N.A.','createdAt':moment(_0x36e218['createdAt'])[_0xc053('0x44')](_0xc053('0x45'))[_0xc053('0x50')](),'closedAt':_0x36e218['closed']?moment(_0x36e218[_0xc053('0x68')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xc053('0x50')]():'','disposition':_0x36e218[_0xc053('0x69')],'messages':_(_0x36e218[_0xc053('0x60')])[_0xc053('0x41')]({'secret':![]})[_0xc053('0x1c')](function(_0x1e587a){if(_0x1e587a[_0xc053('0x5f')]){var _0x19da96=path[_0xc053('0x51')](_0x336e0f,_0x1e587a['Attachment'][_0xc053('0x6a')]);if(fs['existsSync'](_0x19da96)){fs['createReadStream'](_0x19da96)[_0xc053('0x6b')](fs[_0xc053('0x6c')](path[_0xc053('0x51')](_0x31a72d,_0x1e587a[_0xc053('0x5f')][_0xc053('0x6a')])));}}return{'date':moment(_0x1e587a[_0xc053('0x61')])[_0xc053('0x44')](_0xc053('0x45'))[_0xc053('0x50')](),'sender':_0x1e587a[_0xc053('0x6d')]===_0xc053('0x6e')?_0x1e587a[_0xc053('0x59')]?_0x1e587a['User'][_0xc053('0x5a')]:'System':_0x1e587a[_0xc053('0x5c')][_0xc053('0x5d')]+(_0x1e587a['Contact']['lastName']?'\x20'+_0x1e587a[_0xc053('0x5c')][_0xc053('0x5e')]:''),'body':_0x1e587a[_0xc053('0x5f')]?_0x1e587a['Attachment'][_0xc053('0x6a')]:_0x1e587a[_0xc053('0x32')],'direction':_0x1e587a['direction']===_0xc053('0x6e')?'A':'C','secret':_0x1e587a[_0xc053('0x62')],'read':_0x1e587a[_0xc053('0x63')],'attachment':_0x1e587a[_0xc053('0x5f')]};})[_0xc053('0x6f')]()};return ejs[_0xc053('0x70')](path[_0xc053('0x51')](config['root'],_0xc053('0x53'),'views',_0xc053('0x71')),{'interaction':_0x579a4f})[_0xc053('0x16')](function(_0xc0b6fa){var _0x455624=path[_0xc053('0x51')](_0x31a72d,_0xc053('0x72')+_0x36e218['id']+'-'+_0x2a0c3d+'.pdf');var _0x5a7b5={'path':_0x455624,'channel':_0xc053('0x73'),'interactionId':_0x36e218['id']};return pdf[_0xc053('0x74')](_0xc0b6fa,_0x5a7b5);})[_0xc053('0x16')](function(){return new BPromise(function(_0xd757c3,_0x34a5f7){zipdir(_0x31a72d,{'saveTo':_0x4d3922},function(_0x53fc14,_0x33f78a){if(_0x53fc14)return _0x34a5f7(_0x53fc14);return _0xd757c3(_0x33f78a);});})['then'](function(){return new BPromise(function(_0x1d58e7,_0x912610){rimraf(_0x31a72d,function(_0x226e83){if(_0x226e83)_0x912610(_0x226e83);return _0x1d58e7();});});})[_0xc053('0x16')](function(){return _0x10ddf0[_0xc053('0x4e')](_0x4d3922,_0xacc3ca,function(_0x498fbd){if(_0x498fbd){console[_0xc053('0x75')](_0xc053('0x76'),_0x498fbd);}else{fs[_0xc053('0x77')](_0x4d3922);}});});});}else{return _0x10ddf0[_0xc053('0xd')](0xc8);}})[_0xc053('0x23')](handleError(_0x10ddf0,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 0b74236..ca446e8 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 _0xee5b=['setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','findAll'];(function(_0x38fcc2,_0x2de700){var _0x423172=function(_0x275565){while(--_0x275565){_0x38fcc2['push'](_0x38fcc2['shift']());}};_0x423172(++_0x2de700);}(_0xee5b,0x1f4));var _0xbee5=function(_0x2e1598,_0x468e99){_0x2e1598=_0x2e1598-0x0;var _0xe93b75=_0xee5b[_0x2e1598];return _0xe93b75;};'use strict';var EventEmitter=require(_0xbee5('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xbee5('0x1')];var WhatsappMessage=require(_0xbee5('0x2'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbee5('0x3')](0x0);var events={'afterCreate':_0xbee5('0x4'),'afterUpdate':_0xbee5('0x5'),'afterDestroy':_0xbee5('0x6')};function emitEvent(_0x4bd202){return function(_0x5200b1,_0x2e8127,_0x2c0bde){_0x5200b1[_0xbee5('0x7')]({'attributes':['id'],'raw':!![]})[_0xbee5('0x8')](function(_0x4f5065){_0x5200b1['setDataValue']('Users',_0x4f5065['map'](function(_0x5536bd){return{'id':_0x5536bd['id']};}));return WhatsappMessage[_0xbee5('0x9')]({'where':{'WhatsappInteractionId':_0x5200b1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbee5('0x8')](function(_0x45c2c7){_0x5200b1[_0xbee5('0xa')]('unreadMessages',_0x45c2c7[_0xbee5('0xb')]);WhatsappInteractionEvents[_0xbee5('0xc')](_0x4bd202+':'+_0x5200b1['id'],_0x5200b1);WhatsappInteractionEvents[_0xbee5('0xc')](_0x4bd202,_0x5200b1);_0x2c0bde(null);})[_0xbee5('0xd')](_0x2c0bde(null));};}for(var e in events){if(events[_0xbee5('0xe')](e)){var event=events[e];WhatsappInteraction[_0xbee5('0xf')](e,emitEvent(event));}}module[_0xbee5('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xd0a4=['setMaxListeners','save','update','remove','getUsers','setDataValue','Users','findAll','unreadMessages','length','emit','hook','exports','events','../../mysqldb'];(function(_0xc8a11,_0x347a33){var _0x55a500=function(_0x288d05){while(--_0x288d05){_0xc8a11['push'](_0xc8a11['shift']());}};_0x55a500(++_0x347a33);}(_0xd0a4,0x166));var _0x4d0a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd0a4[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x4d0a('0x0'));var WhatsappInteraction=require(_0x4d0a('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4d0a('0x2')](0x0);var events={'afterCreate':_0x4d0a('0x3'),'afterUpdate':_0x4d0a('0x4'),'afterDestroy':_0x4d0a('0x5')};function emitEvent(_0x27ba10){return function(_0x1c0396,_0xa134c5,_0x25dfae){_0x1c0396[_0x4d0a('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x59fe32){_0x1c0396[_0x4d0a('0x7')](_0x4d0a('0x8'),_0x59fe32['map'](function(_0x9b2dbd){return{'id':_0x9b2dbd['id']};}));return WhatsappMessage[_0x4d0a('0x9')]({'where':{'WhatsappInteractionId':_0x1c0396['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xd0dd55){_0x1c0396[_0x4d0a('0x7')](_0x4d0a('0xa'),_0xd0dd55[_0x4d0a('0xb')]);WhatsappInteractionEvents[_0x4d0a('0xc')](_0x27ba10+':'+_0x1c0396['id'],_0x1c0396);WhatsappInteractionEvents['emit'](_0x27ba10,_0x1c0396);_0x25dfae(null);})['catch'](_0x25dfae(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x4d0a('0xd')](e,emitEvent(event));}}module[_0x4d0a('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index d15843d..e3b6ff9 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 _0x44da=['define','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','path','rimraf','./whatsappInteraction.attributes','exports'];(function(_0x1d95ca,_0x13c6fb){var _0x4040b3=function(_0x268dff){while(--_0x268dff){_0x1d95ca['push'](_0x1d95ca['shift']());}};_0x4040b3(++_0x13c6fb);}(_0x44da,0xf4));var _0xa44d=function(_0x1aa9ec,_0x2150b8){_0x1aa9ec=_0x1aa9ec-0x0;var _0x476a99=_0x44da[_0x1aa9ec];return _0x476a99;};'use strict';var _=require('lodash');var util=require(_0xa44d('0x0'));var logger=require(_0xa44d('0x1'))('api');var moment=require(_0xa44d('0x2'));var BPromise=require(_0xa44d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa44d('0x4'));var rimraf=require(_0xa44d('0x5'));var config=require('../../config/environment');var attributes=require(_0xa44d('0x6'));module[_0xa44d('0x7')]=function(_0x213345,_0x10e615){return _0x213345[_0xa44d('0x8')]('WhatsappInteraction',attributes,{'tableName':_0xa44d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x168cec,_0x32ac50,_0x5e6f67){if(_0x168cec[_0xa44d('0xa')]('closed')){_0x168cec[_0xa44d('0xb')]=moment()[_0xa44d('0xc')](_0xa44d('0xd'));}_0x5e6f67(null,_0x168cec);}}});}; \ No newline at end of file +var _0x77cb=['../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x5c399e,_0x220678){var _0x16219c=function(_0x9ae378){while(--_0x9ae378){_0x5c399e['push'](_0x5c399e['shift']());}};_0x16219c(++_0x220678);}(_0x77cb,0x1b2));var _0xb77c=function(_0x5a90a0,_0x1d7582){_0x5a90a0=_0x5a90a0-0x0;var _0x20af9c=_0x77cb[_0x5a90a0];return _0x20af9c;};'use strict';var _=require(_0xb77c('0x0'));var util=require(_0xb77c('0x1'));var logger=require(_0xb77c('0x2'))(_0xb77c('0x3'));var moment=require(_0xb77c('0x4'));var BPromise=require(_0xb77c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb77c('0x6'));var rimraf=require(_0xb77c('0x7'));var config=require(_0xb77c('0x8'));var attributes=require(_0xb77c('0x9'));module[_0xb77c('0xa')]=function(_0x3708df,_0x60b4b8){return _0x3708df[_0xb77c('0xb')](_0xb77c('0xc'),attributes,{'tableName':_0xb77c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2c60c2,_0xd77fdd,_0x1af0f6){if(_0x2c60c2['changed']('closed')){_0x2c60c2[_0xb77c('0xe')]=moment()[_0xb77c('0xf')](_0xb77c('0x10'));}_0x1af0f6(null,_0x2c60c2);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index efe1a7a..2e91a93 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 _0x9336=['body','options','raw','where','attributes','limit','debug','stringify','catch','AddTagsToWhatsappInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9336,0x19b));var _0x6933=function(_0x3c1b5f,_0x2295f0){_0x3c1b5f=_0x3c1b5f-0x0;var _0x523918=_0x9336[_0x3c1b5f];return _0x523918;};'use strict';var _=require(_0x6933('0x0'));var util=require(_0x6933('0x1'));var moment=require(_0x6933('0x2'));var BPromise=require(_0x6933('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6933('0x4'));var db=require(_0x6933('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6933('0x6'))(_0x6933('0x7'));var config=require('../../config/environment');var jayson=require(_0x6933('0x8'));var client=jayson[_0x6933('0x9')][_0x6933('0xa')]({'port':0x232a});config[_0x6933('0xb')]=_[_0x6933('0xc')](config['redis'],{'host':_0x6933('0xd'),'port':0x18eb});var socket=require(_0x6933('0xe'))(new Redis(config[_0x6933('0xb')]));require('./whatsappInteraction.socket')[_0x6933('0xf')](socket);function respondWithRpcPromise(_0x13879f,_0x5209e7,_0x38ba76){return new BPromise(function(_0x376da6,_0x1d783d){return client[_0x6933('0x10')](_0x13879f,_0x38ba76)[_0x6933('0x11')](function(_0x154f81){logger[_0x6933('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x5209e7,_0x6933('0x13'));logger['debug'](_0x6933('0x14'),_0x5209e7,'request\x20sent',JSON['stringify'](_0x154f81));if(_0x154f81[_0x6933('0x15')]){if(_0x154f81[_0x6933('0x15')][_0x6933('0x16')]===0x1f4){logger[_0x6933('0x15')](_0x6933('0x17'),_0x5209e7,_0x154f81[_0x6933('0x15')]['message']);return _0x1d783d(_0x154f81[_0x6933('0x15')][_0x6933('0x18')]);}logger[_0x6933('0x15')](_0x6933('0x17'),_0x5209e7,_0x154f81['error'][_0x6933('0x18')]);return _0x376da6(_0x154f81[_0x6933('0x15')][_0x6933('0x18')]);}else{logger[_0x6933('0x12')](_0x6933('0x17'),_0x5209e7,_0x6933('0x13'));_0x376da6(_0x154f81[_0x6933('0x19')][_0x6933('0x18')]);}})['catch'](function(_0x2951a6){logger['error'](_0x6933('0x17'),_0x5209e7,_0x2951a6);_0x1d783d(_0x2951a6);});});}exports[_0x6933('0x1a')]=function(_0x4a26e9){var _0x1bfa47=this;return new Promise(function(_0xc277fc,_0xfd353e){return db[_0x6933('0x1b')][_0x6933('0x1c')](_0x4a26e9[_0x6933('0x1d')],{'raw':_0x4a26e9[_0x6933('0x1e')]?_0x4a26e9[_0x6933('0x1e')][_0x6933('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a26e9[_0x6933('0x1e')]?_0x4a26e9[_0x6933('0x1e')][_0x6933('0x20')]||null:null,'attributes':_0x4a26e9[_0x6933('0x1e')]?_0x4a26e9[_0x6933('0x1e')][_0x6933('0x21')]||null:null,'limit':_0x4a26e9['options']?_0x4a26e9[_0x6933('0x1e')][_0x6933('0x22')]||null:null})['then'](function(_0x49e7a7){logger[_0x6933('0x12')](_0x6933('0x1a'),_0x4a26e9);logger[_0x6933('0x23')](_0x6933('0x1a'),_0x4a26e9,JSON[_0x6933('0x24')](_0x49e7a7));_0xc277fc(_0x49e7a7);})[_0x6933('0x25')](function(_0xd2065e){logger[_0x6933('0x15')](_0x6933('0x1a'),_0xd2065e[_0x6933('0x18')],_0x4a26e9);_0xfd353e(_0x1bfa47['error'](0x1f4,_0xd2065e[_0x6933('0x18')]));});});};exports[_0x6933('0x26')]=function(_0x1ce9d4){return new Promise(function(_0x391a2a,_0x5e7339){return db[_0x6933('0x1b')]['find']({'where':_0x1ce9d4[_0x6933('0x1e')]?_0x1ce9d4['options'][_0x6933('0x20')]||null:null})[_0x6933('0x11')](function(_0x36e06d){if(_0x36e06d){return _0x36e06d[_0x6933('0x27')](_0x1ce9d4[_0x6933('0x1d')][_0x6933('0x28')],_[_0x6933('0x29')](_0x1ce9d4[_0x6933('0x1d')],[_0x6933('0x28'),'id'])||{});}})[_0x6933('0x2a')](function(_0x5da64b){logger[_0x6933('0x12')](_0x6933('0x2b'),_0x1ce9d4);logger['debug'](_0x6933('0x2b'),_0x1ce9d4,JSON[_0x6933('0x24')](_0x5da64b));_0x391a2a(_0x5da64b);})['catch'](function(_0x205ef6){logger[_0x6933('0x15')](_0x6933('0x2b'),_0x205ef6[_0x6933('0x18')],_0x1ce9d4);_0x5e7339(_this[_0x6933('0x15')](0x1f4,_0x205ef6[_0x6933('0x18')]));});});}; \ No newline at end of file +var _0xb447=['result','catch','UpdateWhatsappInteraction','update','body','options','raw','limit','AddTagsToWhatsappInteraction','find','then','addTags','ids','omit','spread','AddTags','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb447,0x12f));var _0x7b44=function(_0x4aae8e,_0x47f62c){_0x4aae8e=_0x4aae8e-0x0;var _0x320487=_0xb447[_0x4aae8e];return _0x320487;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7b44('0x0'));var BPromise=require('bluebird');var rs=require(_0x7b44('0x1'));var fs=require('fs');var Redis=require(_0x7b44('0x2'));var db=require(_0x7b44('0x3'))['db'];var utils=require(_0x7b44('0x4'));var logger=require(_0x7b44('0x5'))(_0x7b44('0x6'));var config=require(_0x7b44('0x7'));var jayson=require(_0x7b44('0x8'));var client=jayson[_0x7b44('0x9')][_0x7b44('0xa')]({'port':0x232a});config[_0x7b44('0xb')]=_[_0x7b44('0xc')](config[_0x7b44('0xb')],{'host':_0x7b44('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b44('0xb')]));require(_0x7b44('0xe'))[_0x7b44('0xf')](socket);function respondWithRpcPromise(_0x338c9f,_0x3f4969,_0x1ef6cc){return new BPromise(function(_0x4c40c0,_0x112b99){return client['request'](_0x338c9f,_0x1ef6cc)['then'](function(_0x1c191c){logger[_0x7b44('0x10')](_0x7b44('0x11'),_0x3f4969,_0x7b44('0x12'));logger[_0x7b44('0x13')](_0x7b44('0x14'),_0x3f4969,'request\x20sent',JSON[_0x7b44('0x15')](_0x1c191c));if(_0x1c191c[_0x7b44('0x16')]){if(_0x1c191c[_0x7b44('0x16')][_0x7b44('0x17')]===0x1f4){logger[_0x7b44('0x16')](_0x7b44('0x11'),_0x3f4969,_0x1c191c[_0x7b44('0x16')][_0x7b44('0x18')]);return _0x112b99(_0x1c191c['error'][_0x7b44('0x18')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x3f4969,_0x1c191c[_0x7b44('0x16')][_0x7b44('0x18')]);return _0x4c40c0(_0x1c191c[_0x7b44('0x16')]['message']);}else{logger['info'](_0x7b44('0x11'),_0x3f4969,_0x7b44('0x12'));_0x4c40c0(_0x1c191c[_0x7b44('0x19')][_0x7b44('0x18')]);}})[_0x7b44('0x1a')](function(_0x2deee2){logger[_0x7b44('0x16')](_0x7b44('0x11'),_0x3f4969,_0x2deee2);_0x112b99(_0x2deee2);});});}exports[_0x7b44('0x1b')]=function(_0x57e6f1){var _0x2151d7=this;return new Promise(function(_0x2c187f,_0x40e924){return db['WhatsappInteraction'][_0x7b44('0x1c')](_0x57e6f1[_0x7b44('0x1d')],{'raw':_0x57e6f1['options']?_0x57e6f1[_0x7b44('0x1e')][_0x7b44('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57e6f1['options']?_0x57e6f1['options']['where']||null:null,'attributes':_0x57e6f1[_0x7b44('0x1e')]?_0x57e6f1['options']['attributes']||null:null,'limit':_0x57e6f1[_0x7b44('0x1e')]?_0x57e6f1[_0x7b44('0x1e')][_0x7b44('0x20')]||null:null})['then'](function(_0x19651d){logger[_0x7b44('0x10')](_0x7b44('0x1b'),_0x57e6f1);logger[_0x7b44('0x13')](_0x7b44('0x1b'),_0x57e6f1,JSON['stringify'](_0x19651d));_0x2c187f(_0x19651d);})[_0x7b44('0x1a')](function(_0x1bc061){logger[_0x7b44('0x16')](_0x7b44('0x1b'),_0x1bc061['message'],_0x57e6f1);_0x40e924(_0x2151d7[_0x7b44('0x16')](0x1f4,_0x1bc061[_0x7b44('0x18')]));});});};exports[_0x7b44('0x21')]=function(_0x34b7a7){return new Promise(function(_0x522f74,_0x396dbc){return db['WhatsappInteraction'][_0x7b44('0x22')]({'where':_0x34b7a7[_0x7b44('0x1e')]?_0x34b7a7[_0x7b44('0x1e')]['where']||null:null})[_0x7b44('0x23')](function(_0x16cedd){if(_0x16cedd){return _0x16cedd[_0x7b44('0x24')](_0x34b7a7['body'][_0x7b44('0x25')],_[_0x7b44('0x26')](_0x34b7a7[_0x7b44('0x1d')],[_0x7b44('0x25'),'id'])||{});}})[_0x7b44('0x27')](function(_0x90b0df){logger[_0x7b44('0x10')](_0x7b44('0x28'),_0x34b7a7);logger[_0x7b44('0x13')](_0x7b44('0x28'),_0x34b7a7,JSON[_0x7b44('0x15')](_0x90b0df));_0x522f74(_0x90b0df);})[_0x7b44('0x1a')](function(_0x495973){logger[_0x7b44('0x16')](_0x7b44('0x28'),_0x495973['message'],_0x34b7a7);_0x396dbc(_this['error'](0x1f4,_0x495973[_0x7b44('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index bc88660..15b1ce4 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 _0xa896=['removeListener','register','whatsappInteraction:','./whatsappInteraction.events','save','remove','emit'];(function(_0x136ed6,_0x1df16d){var _0x3bbfb9=function(_0xfc4332){while(--_0xfc4332){_0x136ed6['push'](_0x136ed6['shift']());}};_0x3bbfb9(++_0x1df16d);}(_0xa896,0xe3));var _0x6a89=function(_0x5810c0,_0x33634c){_0x5810c0=_0x5810c0-0x0;var _0x469eeb=_0xa896[_0x5810c0];return _0x469eeb;};'use strict';var WhatsappInteractionEvents=require(_0x6a89('0x0'));var events=[_0x6a89('0x1'),_0x6a89('0x2'),'update'];function createListener(_0x413423,_0x3fb46d){return function(_0x5e25cb){_0x3fb46d[_0x6a89('0x3')](_0x413423,_0x5e25cb);};}function removeListener(_0x337efb,_0x5e0cf6){return function(){WhatsappInteractionEvents[_0x6a89('0x4')](_0x337efb,_0x5e0cf6);};}exports[_0x6a89('0x5')]=function(_0x4cadfc){for(var _0x42fd97=0x0,_0x13700a=events['length'];_0x42fd97<_0x13700a;_0x42fd97++){var _0x5cb10a=events[_0x42fd97];var _0x1feaef=createListener(_0x6a89('0x6')+_0x5cb10a,_0x4cadfc);WhatsappInteractionEvents['on'](_0x5cb10a,_0x1feaef);}}; \ No newline at end of file +var _0x1f5a=['register','length','remove'];(function(_0x214a03,_0x2e4061){var _0xda476a=function(_0x1c46b2){while(--_0x1c46b2){_0x214a03['push'](_0x214a03['shift']());}};_0xda476a(++_0x2e4061);}(_0x1f5a,0x19d));var _0xa1f5=function(_0x3ddb24,_0x1cbb34){_0x3ddb24=_0x3ddb24-0x0;var _0x2184b4=_0x1f5a[_0x3ddb24];return _0x2184b4;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0xa1f5('0x0'),'update'];function createListener(_0x4d342c,_0x2f6e76){return function(_0x306da0){_0x2f6e76['emit'](_0x4d342c,_0x306da0);};}function removeListener(_0x50b0e9,_0x3b40ed){return function(){WhatsappInteractionEvents['removeListener'](_0x50b0e9,_0x3b40ed);};}exports[_0xa1f5('0x1')]=function(_0x306034){for(var _0x2ebe6c=0x0,_0x5cccc4=events[_0xa1f5('0x2')];_0x2ebe6c<_0x5cccc4;_0x2ebe6c++){var _0x1f5123=events[_0x2ebe6c];var _0x3e9b3b=createListener('whatsappInteraction:'+_0x1f5123,_0x306034);WhatsappInteractionEvents['on'](_0x1f5123,_0x3e9b3b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 111abb5..2159a35 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 _0x5fa6=['delete','/:id','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id/accept','/:id/reject','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fa6,0xa5));var _0x65fa=function(_0x36ba80,_0x284c26){_0x36ba80=_0x36ba80-0x0;var _0x135582=_0x5fa6[_0x36ba80];return _0x135582;};'use strict';var multer=require('multer');var util=require(_0x65fa('0x0'));var path=require(_0x65fa('0x1'));var timeout=require(_0x65fa('0x2'));var express=require('express');var router=express[_0x65fa('0x3')]();var fs_extra=require(_0x65fa('0x4'));var auth=require(_0x65fa('0x5'));var interaction=require(_0x65fa('0x6'));var config=require('../../config/environment');var controller=require(_0x65fa('0x7'));router[_0x65fa('0x8')]('/',auth[_0x65fa('0x9')](),controller[_0x65fa('0xa')]);router[_0x65fa('0x8')](_0x65fa('0xb'),auth[_0x65fa('0x9')](),controller[_0x65fa('0xc')]);router[_0x65fa('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x65fa('0xd')]('/',auth[_0x65fa('0x9')](),interaction[_0x65fa('0xe')](_0x65fa('0xf'),_0x65fa('0x10')),controller[_0x65fa('0x11')]);router[_0x65fa('0xd')](_0x65fa('0x12'),controller[_0x65fa('0x13')]);router[_0x65fa('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x65fa('0x14')](_0x65fa('0x15'),auth[_0x65fa('0x9')](),controller['accept']);router['put'](_0x65fa('0x16'),auth[_0x65fa('0x9')](),controller[_0x65fa('0x17')]);router[_0x65fa('0x18')](_0x65fa('0x19'),auth[_0x65fa('0x9')](),controller['destroy']);module[_0x65fa('0x1a')]=router; \ No newline at end of file +var _0x7c57=['create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','show','post','whatsapp'];(function(_0x5e5d41,_0x208901){var _0xbb31ba=function(_0x699284){while(--_0x699284){_0x5e5d41['push'](_0x5e5d41['shift']());}};_0xbb31ba(++_0x208901);}(_0x7c57,0xc8));var _0x77c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c57[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x77c5('0x0'));var util=require('util');var path=require(_0x77c5('0x1'));var timeout=require(_0x77c5('0x2'));var express=require(_0x77c5('0x3'));var router=express[_0x77c5('0x4')]();var fs_extra=require(_0x77c5('0x5'));var auth=require(_0x77c5('0x6'));var interaction=require(_0x77c5('0x7'));var config=require(_0x77c5('0x8'));var controller=require(_0x77c5('0x9'));router[_0x77c5('0xa')]('/',auth[_0x77c5('0xb')](),controller[_0x77c5('0xc')]);router[_0x77c5('0xa')]('/describe',auth[_0x77c5('0xb')](),controller['describe']);router[_0x77c5('0xa')]('/:id',auth[_0x77c5('0xb')](),controller[_0x77c5('0xd')]);router[_0x77c5('0xe')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x77c5('0xf'),'whatsappmessage:create'),controller[_0x77c5('0x10')]);router[_0x77c5('0xe')]('/:id/status',controller['status']);router[_0x77c5('0x11')](_0x77c5('0x12'),auth[_0x77c5('0xb')](),controller[_0x77c5('0x13')]);router[_0x77c5('0x11')](_0x77c5('0x14'),auth[_0x77c5('0xb')](),controller[_0x77c5('0x15')]);router[_0x77c5('0x11')](_0x77c5('0x16'),auth[_0x77c5('0xb')](),controller[_0x77c5('0x17')]);router[_0x77c5('0x18')](_0x77c5('0x12'),auth[_0x77c5('0xb')](),controller[_0x77c5('0x19')]);module[_0x77c5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 7f32437..fe26f76 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 _0xd6ec=['medium','BOOLEAN','ENUM','out','STRING','DATE','exports','TEXT'];(function(_0x582dc0,_0x2a7700){var _0x1a8848=function(_0x2792f6){while(--_0x2792f6){_0x582dc0['push'](_0x582dc0['shift']());}};_0x1a8848(++_0x2a7700);}(_0xd6ec,0x6e));var _0xcd6e=function(_0x3b46e6,_0xe959e0){_0x3b46e6=_0x3b46e6-0x0;var _0x24db7a=_0xd6ec[_0x3b46e6];return _0x24db7a;};'use strict';var Sequelize=require('sequelize');module[_0xcd6e('0x0')]={'body':{'type':Sequelize[_0xcd6e('0x1')](_0xcd6e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcd6e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcd6e('0x4')]('in',_0xcd6e('0x5')),'defaultValue':_0xcd6e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xcd6e('0x6')](0xbe)},'phone':{'type':Sequelize[_0xcd6e('0x6')]},'readAt':{'type':Sequelize[_0xcd6e('0x7')]},'secret':{'type':Sequelize[_0xcd6e('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcd6e('0x6')]},'providerResponse':{'type':Sequelize[_0xcd6e('0x1')]}}; \ No newline at end of file +var _0x0040=['DATE','exports','medium','BOOLEAN','out','STRING'];(function(_0x45b93d,_0x4b4ace){var _0x495647=function(_0x37865b){while(--_0x37865b){_0x45b93d['push'](_0x45b93d['shift']());}};_0x495647(++_0x4b4ace);}(_0x0040,0x157));var _0x0004=function(_0x2c5009,_0x63505f){_0x2c5009=_0x2c5009-0x0;var _0x40b7f9=_0x0040[_0x2c5009];return _0x40b7f9;};'use strict';var Sequelize=require('sequelize');module[_0x0004('0x0')]={'body':{'type':Sequelize['TEXT'](_0x0004('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x0004('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x0004('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0004('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x0004('0x5')]},'secret':{'type':Sequelize[_0x0004('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index f4bd5c6..e664af7 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 _0x9362=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','http','client','request','then','info','request\x20sent','debug','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','end','stack','name','status','send','index','WhatsappMessage','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','filter','options','include','findAll','rows','show','length','includeAll','catch','create','body','params','find','describe','whatsapp-interactions','accept','whatsapp','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','manual','format','SIP/%s','channel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','email','motionChannel','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x66786b,_0x32ca57){var _0x1be62a=function(_0x12880d){while(--_0x12880d){_0x66786b['push'](_0x66786b['shift']());}};_0x1be62a(++_0x32ca57);}(_0x9362,0x7b));var _0x2936=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9362[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x2936('0x0'));var rimraf=require(_0x2936('0x1'));var zipdir=require(_0x2936('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2936('0x3'));var moment=require(_0x2936('0x4'));var BPromise=require(_0x2936('0x5'));var Mustache=require(_0x2936('0x6'));var util=require(_0x2936('0x7'));var path=require(_0x2936('0x8'));var sox=require(_0x2936('0x9'));var csv=require(_0x2936('0xa'));var ejs=require(_0x2936('0xb'));var fs=require('fs');var fs_extra=require(_0x2936('0xc'));var _=require(_0x2936('0xd'));var squel=require(_0x2936('0xe'));var crypto=require(_0x2936('0xf'));var jsforce=require(_0x2936('0x10'));var deskjs=require(_0x2936('0x11'));var toCsv=require(_0x2936('0xa'));var querystring=require(_0x2936('0x12'));var Papa=require('papaparse');var Redis=require(_0x2936('0x13'));var authService=require(_0x2936('0x14'));var qs=require(_0x2936('0x15'));var as=require(_0x2936('0x16'));var hardwareService=require(_0x2936('0x17'));var logger=require(_0x2936('0x18'))(_0x2936('0x19'));var utils=require(_0x2936('0x1a'));var config=require(_0x2936('0x1b'));var licenseUtil=require(_0x2936('0x1c'));var db=require(_0x2936('0x1d'))['db'];config['redis']=_[_0x2936('0x1e')](config[_0x2936('0x1f')],{'host':_0x2936('0x20'),'port':0x18eb});var socket=require(_0x2936('0x21'))(new Redis(config[_0x2936('0x1f')]));require(_0x2936('0x22'))['register'](socket);var jayson=require(_0x2936('0x23'));var client=jayson['client'][_0x2936('0x24')]({'port':0x232c});var client9002=jayson[_0x2936('0x25')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a2a14,_0x281931,_0xa596a2,_0x15af02){return new BPromise(function(_0x561306,_0x5ba5a4){var _0x3701d4=_0x15af02||client;return _0x3701d4[_0x2936('0x26')](_0x3a2a14,_0xa596a2)[_0x2936('0x27')](function(_0x2d7ed1){logger[_0x2936('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x281931,_0x2936('0x29'));logger[_0x2936('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x281931,_0x2936('0x29'),JSON[_0x2936('0x2b')](_0x2d7ed1));if(_0x2d7ed1[_0x2936('0x2c')]){if(_0x2d7ed1['error']['code']===0x1f4){logger[_0x2936('0x2c')](_0x2936('0x2d'),_0x281931,_0x2d7ed1[_0x2936('0x2c')][_0x2936('0x2e')]);return _0x5ba5a4(_0x2d7ed1[_0x2936('0x2c')][_0x2936('0x2e')]);}logger[_0x2936('0x2c')]('WhatsappMessage,\x20%s,\x20%s',_0x281931,_0x2d7ed1[_0x2936('0x2c')]['message']);return _0x561306(_0x2d7ed1['error'][_0x2936('0x2e')]);}else{logger[_0x2936('0x28')](_0x2936('0x2d'),_0x281931,_0x2936('0x29'));_0x561306(_0x2d7ed1[_0x2936('0x2f')][_0x2936('0x2e')]);}})['catch'](function(_0x96a077){logger[_0x2936('0x2c')]('WhatsappMessage,\x20%s,\x20%s',_0x281931,_0x96a077);_0x5ba5a4(_0x96a077);});});}function respondWithStatusCode(_0x3e5584,_0x1c954b){_0x1c954b=_0x1c954b||0xcc;return function(_0x37d754){if(_0x37d754){return _0x3e5584[_0x2936('0x30')](_0x1c954b);}return _0x3e5584['status'](_0x1c954b)['end']();};}function respondWithResult(_0x5da6f7,_0xcc33e7){_0xcc33e7=_0xcc33e7||0xc8;return function(_0x109d83){if(_0x109d83){return _0x5da6f7['status'](_0xcc33e7)[_0x2936('0x31')](_0x109d83);}};}function respondWithFilteredResult(_0x4faa9b,_0x8faec0){return function(_0x3cf8f5){if(_0x3cf8f5){var _0x1a739b=typeof _0x8faec0[_0x2936('0x32')]===_0x2936('0x33')&&typeof _0x8faec0[_0x2936('0x34')]===_0x2936('0x33');var _0x587774=_0x3cf8f5[_0x2936('0x35')];var _0x3266d6=_0x1a739b?0x0:_0x8faec0[_0x2936('0x32')];var _0x49422d=_0x1a739b?_0x3cf8f5[_0x2936('0x35')]:_0x8faec0[_0x2936('0x32')]+_0x8faec0[_0x2936('0x34')];var _0x53a509;if(_0x49422d>=_0x587774){_0x49422d=_0x587774;_0x53a509=0xc8;}else{_0x53a509=0xce;}_0x4faa9b['status'](_0x53a509);return _0x4faa9b[_0x2936('0x36')](_0x2936('0x37'),_0x3266d6+'-'+_0x49422d+'/'+_0x587774)[_0x2936('0x31')](_0x3cf8f5);}return null;};}function patchUpdates(_0x5cd974){return function(_0x2748a2){try{jsonpatch[_0x2936('0x38')](_0x2748a2,_0x5cd974,!![]);}catch(_0x29aef1){return BPromise['reject'](_0x29aef1);}return _0x2748a2[_0x2936('0x39')]();};}function saveUpdates(_0xacafca,_0x5e09dd){return function(_0x330f8b){if(_0x330f8b){return _0x330f8b[_0x2936('0x3a')](_0xacafca)[_0x2936('0x27')](function(_0x37dbf4){return _0x37dbf4;});}return null;};}function removeEntity(_0x3181c7,_0x555736){return function(_0x109160){if(_0x109160){return _0x109160[_0x2936('0x3b')]()[_0x2936('0x27')](function(){_0x3181c7['status'](0xcc)[_0x2936('0x3c')]();});}};}function handleEntityNotFound(_0x1c4abc,_0x22c5a3){return function(_0x1317e9){if(!_0x1317e9){_0x1c4abc[_0x2936('0x30')](0x194);}return _0x1317e9;};}function handleError(_0x5409a5,_0x464679){_0x464679=_0x464679||0x1f4;return function(_0xd9d01){logger[_0x2936('0x2c')](_0xd9d01[_0x2936('0x3d')]);if(_0xd9d01['name']){delete _0xd9d01[_0x2936('0x3e')];}_0x5409a5[_0x2936('0x3f')](_0x464679)[_0x2936('0x40')](_0xd9d01);};}exports[_0x2936('0x41')]=function(_0x47d4ce,_0x54f9f8){var _0x2b55bf={},_0x384600={},_0x20d9c4={'count':0x0,'rows':[]};var _0xa88762=_['map'](db[_0x2936('0x42')]['rawAttributes'],function(_0x447d4f){return{'name':_0x447d4f[_0x2936('0x43')],'type':_0x447d4f['type'][_0x2936('0x44')]};});_0x384600[_0x2936('0x45')]=_['map'](_0xa88762,_0x2936('0x3e'));_0x384600[_0x2936('0x46')]=_[_0x2936('0x47')](_0x47d4ce[_0x2936('0x46')]);_0x384600[_0x2936('0x48')]=_['intersection'](_0x384600[_0x2936('0x45')],_0x384600[_0x2936('0x46')]);_0x2b55bf[_0x2936('0x49')]=_[_0x2936('0x4a')](_0x384600['model'],qs[_0x2936('0x4b')](_0x47d4ce[_0x2936('0x46')][_0x2936('0x4b')]));_0x2b55bf[_0x2936('0x49')]=_0x2b55bf[_0x2936('0x49')]['length']?_0x2b55bf[_0x2936('0x49')]:_0x384600[_0x2936('0x45')];if(!_0x47d4ce[_0x2936('0x46')][_0x2936('0x4c')](_0x2936('0x4d'))){_0x2b55bf[_0x2936('0x34')]=qs['limit'](_0x47d4ce['query']['limit']);_0x2b55bf[_0x2936('0x32')]=qs['offset'](_0x47d4ce[_0x2936('0x46')]['offset']);}_0x2b55bf[_0x2936('0x4e')]=qs['sort'](_0x47d4ce[_0x2936('0x46')][_0x2936('0x4f')]);_0x2b55bf[_0x2936('0x50')]=qs['filters'](_[_0x2936('0x51')](_0x47d4ce[_0x2936('0x46')],_0x384600[_0x2936('0x48')]),_0xa88762);if(_0x47d4ce[_0x2936('0x46')]['filter']){_0x2b55bf[_0x2936('0x50')]=_[_0x2936('0x52')](_0x2b55bf[_0x2936('0x50')],{'$or':_[_0x2936('0x53')](_0xa88762,function(_0x5c30e8){if(_0x5c30e8[_0x2936('0x54')]!==_0x2936('0x55')){var _0x118f77={};_0x118f77[_0x5c30e8[_0x2936('0x3e')]]={'$like':'%'+_0x47d4ce['query'][_0x2936('0x56')]+'%'};return _0x118f77;}})});}_0x2b55bf=_[_0x2936('0x52')]({},_0x2b55bf,_0x47d4ce[_0x2936('0x57')]);var _0x2343ef={'where':_0x2b55bf[_0x2936('0x50')]};return db[_0x2936('0x42')][_0x2936('0x35')](_0x2343ef)['then'](function(_0xb1ee28){_0x20d9c4[_0x2936('0x35')]=_0xb1ee28;if(_0x47d4ce[_0x2936('0x46')]['includeAll']){_0x2b55bf[_0x2936('0x58')]=[{'all':!![]}];}return db[_0x2936('0x42')][_0x2936('0x59')](_0x2b55bf);})['then'](function(_0x49bd01){_0x20d9c4[_0x2936('0x5a')]=_0x49bd01;return _0x20d9c4;})[_0x2936('0x27')](respondWithFilteredResult(_0x54f9f8,_0x2b55bf))['catch'](handleError(_0x54f9f8,null));};exports[_0x2936('0x5b')]=function(_0x11ffca,_0x5b630f){var _0x567112={'raw':!![],'where':{'id':_0x11ffca['params']['id']}},_0x4eb266={};_0x4eb266[_0x2936('0x45')]=_[_0x2936('0x47')](db[_0x2936('0x42')]['rawAttributes']);_0x4eb266[_0x2936('0x46')]=_[_0x2936('0x47')](_0x11ffca[_0x2936('0x46')]);_0x4eb266['filters']=_[_0x2936('0x4a')](_0x4eb266[_0x2936('0x45')],_0x4eb266['query']);_0x567112[_0x2936('0x49')]=_[_0x2936('0x4a')](_0x4eb266[_0x2936('0x45')],qs[_0x2936('0x4b')](_0x11ffca[_0x2936('0x46')][_0x2936('0x4b')]));_0x567112[_0x2936('0x49')]=_0x567112[_0x2936('0x49')][_0x2936('0x5c')]?_0x567112[_0x2936('0x49')]:_0x4eb266[_0x2936('0x45')];if(_0x11ffca['query'][_0x2936('0x5d')]){_0x567112[_0x2936('0x58')]=[{'all':!![]}];}_0x567112=_[_0x2936('0x52')]({},_0x567112,_0x11ffca[_0x2936('0x57')]);return db[_0x2936('0x42')]['find'](_0x567112)[_0x2936('0x27')](handleEntityNotFound(_0x5b630f,null))[_0x2936('0x27')](respondWithResult(_0x5b630f,null))[_0x2936('0x5e')](handleError(_0x5b630f,null));};exports[_0x2936('0x5f')]=function(_0x232828,_0x215eb4){return db[_0x2936('0x42')]['create'](_0x232828[_0x2936('0x60')],{})[_0x2936('0x27')](respondWithResult(_0x215eb4,0xc9))[_0x2936('0x5e')](handleError(_0x215eb4,null));};exports[_0x2936('0x3a')]=function(_0xd48230,_0x44be9a){if(_0xd48230['body']['id']){delete _0xd48230[_0x2936('0x60')]['id'];}return db[_0x2936('0x42')]['find']({'where':{'id':_0xd48230[_0x2936('0x61')]['id']}})[_0x2936('0x27')](handleEntityNotFound(_0x44be9a,null))['then'](saveUpdates(_0xd48230['body'],null))[_0x2936('0x27')](respondWithResult(_0x44be9a,null))[_0x2936('0x5e')](handleError(_0x44be9a,null));};exports[_0x2936('0x3b')]=function(_0x4f6494,_0x3b9410){return db[_0x2936('0x42')][_0x2936('0x62')]({'where':{'id':_0x4f6494[_0x2936('0x61')]['id']}})[_0x2936('0x27')](handleEntityNotFound(_0x3b9410,null))[_0x2936('0x27')](removeEntity(_0x3b9410,null))[_0x2936('0x5e')](handleError(_0x3b9410,null));};exports[_0x2936('0x63')]=function(_0x27b138,_0x38056b){return db['WhatsappMessage']['describe']()[_0x2936('0x27')](respondWithResult(_0x38056b,null))[_0x2936('0x5e')](handleError(_0x38056b,null));};var interaction_log=require(_0x2936('0x18'))(_0x2936('0x64'));exports[_0x2936('0x65')]=function(_0x31d085,_0x334496,_0x10f28e){var _0x4c3861={'agent':{},'channel':_0x2936('0x66')};if(_0x31d085[_0x2936('0x60')]['id']){delete _0x31d085[_0x2936('0x60')]['id'];}_0x31d085[_0x2936('0x60')][_0x2936('0x67')]=!![];_0x31d085[_0x2936('0x60')]['readAt']=moment()['format'](_0x2936('0x68'));_0x31d085[_0x2936('0x60')][_0x2936('0x69')]=_0x31d085[_0x2936('0x60')][_0x2936('0x69')]||_0x31d085[_0x2936('0x6a')]['id'];_0x4c3861[_0x2936('0x6b')]['id']=_0x31d085[_0x2936('0x60')][_0x2936('0x69')];return db['WhatsappMessage'][_0x2936('0x62')]({'where':{'id':_0x31d085['params']['id'],'UserId':null}})[_0x2936('0x27')](handleEntityNotFound(_0x334496,null))[_0x2936('0x27')](saveUpdates(_0x31d085[_0x2936('0x60')],null))[_0x2936('0x27')](function(_0x372836){if(_0x372836){_0x4c3861[_0x2936('0x2e')]=_0x372836[_0x2936('0x6c')]({'plain':!![]});return db[_0x2936('0x6d')][_0x2936('0x62')]({'where':{'id':_0x372836[_0x2936('0x6e')]}});}return null;})[_0x2936('0x27')](handleEntityNotFound(_0x334496,null))[_0x2936('0x27')](function(_0x296a91){if(_0x296a91){return _0x296a91[_0x2936('0x3a')]({'UserId':_0x31d085[_0x2936('0x60')]['UserId'],'read1stAt':_[_0x2936('0x6f')](_0x296a91[_0x2936('0x70')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2936('0x27')](function(_0x4364ee){if(_0x4364ee){_0x4c3861['interaction']=_0x4364ee[_0x2936('0x6c')]({'plain':!![]});interaction_log[_0x2936('0x28')](_0x2936('0x71'),_0x31d085[_0x2936('0x6a')]['id'],_0x31d085['user']['name'],_0x31d085[_0x2936('0x6a')][_0x2936('0x72')],_0x4c3861[_0x2936('0x73')]['id'],_0x31d085[_0x2936('0x60')]?JSON[_0x2936('0x2b')](_0x31d085[_0x2936('0x60')]):_0x2936('0x74'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x4c3861);}return null;})[_0x2936('0x27')](function(_0x565a4d){var _0x26797f=_0x2936('0x75')+_0x565a4d['message'][_0x2936('0x76')];return db['sequelize']['query'](_0x26797f,{'type':db[_0x2936('0x77')][_0x2936('0x78')][_0x2936('0x79')],'raw':!![]})[_0x2936('0x27')](function(_0x28f3e5){return _0x28f3e5;});})[_0x2936('0x27')](function(_0x455dfb){if(_0x455dfb){_0x4c3861[_0x2936('0x2e')][_0x2936('0x7a')]=_0x455dfb[0x0];if(!_0x31d085['body'][_0x2936('0x69')])return;return db[_0x2936('0x7b')][_0x2936('0x62')]({'where':{'id':_0x31d085[_0x2936('0x60')][_0x2936('0x69')],'role':_0x2936('0x6b')},'attributes':['id','name',_0x2936('0x7c'),'email','internal'],'raw':!![]});}return null;})[_0x2936('0x27')](function(_0x2c7d64){if(!_0x2c7d64)return null;_0x4c3861[_0x2936('0x2e')][_0x2936('0x6b')]=_0x2c7d64;return _0x4c3861;})[_0x2936('0x27')](function(_0x298ed9){if(_0x298ed9){if(_0x31d085[_0x2936('0x60')][_0x2936('0x7d')]){_0x4c3861[_0x2936('0x2e')]['interface']=util[_0x2936('0x7e')](_0x2936('0x7f'),_0x31d085[_0x2936('0x6a')][_0x2936('0x3e')]);_0x4c3861[_0x2936('0x2e')]['channel']=_0x4c3861[_0x2936('0x80')];_0x4c3861[_0x2936('0x2e')]['motionChannel']=_0x4c3861['channel'];_0x4c3861['message'][_0x2936('0x81')]=_0x2936('0x65');return respondWithRpcPromise(_0x2936('0x82'),_0x2936('0x82'),{'event':_0x2936('0x83'),'message':_0x4c3861['message']},client9002)[_0x2936('0x27')](function(){return _0x4c3861;});}return _0x4c3861;}return null;})[_0x2936('0x27')](respondWithResult(_0x334496,null))[_0x2936('0x5e')](handleError(_0x334496,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports['reject']=function(_0x43f7b4,_0x216e32,_0x166d97){var _0x5698f7={'agent':{},'channel':_0x2936('0x66')};if(_0x43f7b4['body']['id']){delete _0x43f7b4['body']['id'];}_0x43f7b4['body'][_0x2936('0x69')]=_0x43f7b4['body'][_0x2936('0x69')]||_0x43f7b4[_0x2936('0x6a')]['id'];_0x5698f7['agent']['id']=_0x43f7b4[_0x2936('0x60')][_0x2936('0x69')];return db[_0x2936('0x42')][_0x2936('0x62')]({'where':{'id':_0x43f7b4['params']['id'],'UserId':null}})[_0x2936('0x27')](handleEntityNotFound(_0x216e32,null))['then'](function(_0x259d6f){if(_0x259d6f){_0x5698f7['message']=_0x259d6f[_0x2936('0x6c')]({'plain':!![]});return db[_0x2936('0x6d')][_0x2936('0x62')]({'where':{'id':_0x259d6f[_0x2936('0x6e')]}});}return null;})[_0x2936('0x27')](handleEntityNotFound(_0x216e32,null))[_0x2936('0x27')](function(_0x4a81c8){if(_0x4a81c8){_0x5698f7[_0x2936('0x73')]=_0x4a81c8[_0x2936('0x6c')]({'plain':!![]});interaction_log[_0x2936('0x28')](_0x2936('0x84'),_0x43f7b4[_0x2936('0x6a')]['id'],_0x43f7b4[_0x2936('0x6a')]['name'],_0x43f7b4['user']['role'],_0x5698f7[_0x2936('0x73')]['id'],_0x43f7b4[_0x2936('0x60')]?JSON[_0x2936('0x2b')](_0x43f7b4[_0x2936('0x60')]):'null');return respondWithRpcPromise(_0x2936('0x85'),_0x2936('0x86'),_0x5698f7);}return null;})['then'](function(_0x179335){var _0x1bdc98=_0x2936('0x75')+_0x179335[_0x2936('0x2e')][_0x2936('0x76')];return db[_0x2936('0x87')][_0x2936('0x46')](_0x1bdc98,{'type':db[_0x2936('0x77')]['QueryTypes'][_0x2936('0x79')],'raw':!![]})[_0x2936('0x27')](function(_0x540205){return _0x540205;});})['then'](function(_0x27584e){if(_0x27584e){_0x5698f7[_0x2936('0x2e')]['contact']=_0x27584e[0x0];if(!_0x43f7b4[_0x2936('0x60')][_0x2936('0x69')])return;return db[_0x2936('0x7b')][_0x2936('0x62')]({'where':{'id':_0x43f7b4[_0x2936('0x60')][_0x2936('0x69')],'role':_0x2936('0x6b')},'attributes':['id',_0x2936('0x3e'),_0x2936('0x7c'),_0x2936('0x88'),'internal'],'raw':!![]});}return null;})['then'](function(_0x30de64){if(!_0x30de64)return null;_0x5698f7[_0x2936('0x2e')][_0x2936('0x6b')]=_0x30de64;return _0x5698f7;})[_0x2936('0x27')](function(_0x397efa){if(_0x397efa){_0x397efa[_0x2936('0x2e')]['interface']=util[_0x2936('0x7e')](_0x2936('0x7f'),_0x43f7b4[_0x2936('0x6a')]['name']);_0x397efa[_0x2936('0x2e')][_0x2936('0x80')]=_0x5698f7[_0x2936('0x80')];_0x397efa[_0x2936('0x2e')][_0x2936('0x89')]=_0x5698f7['channel'];_0x397efa[_0x2936('0x2e')]['event']='reject';respondWithRpcPromise(_0x2936('0x82'),_0x2936('0x82'),{'event':_0x2936('0x8a'),'message':_0x397efa['message']},client9002);return _0x5698f7;}return null;})[_0x2936('0x27')](respondWithResult(_0x216e32,null))[_0x2936('0x5e')](handleError(_0x216e32,null));};exports[_0x2936('0x3f')]=function(_0x2cb119,_0xcbdd0f,_0x5a6a0c){if(_0x2cb119[_0x2936('0x60')]['id']){delete _0x2cb119['body']['id'];}var _0xab36cb;return db[_0x2936('0x42')][_0x2936('0x62')]({'where':{'id':_0x2cb119[_0x2936('0x61')]['id']}})[_0x2936('0x27')](handleEntityNotFound(_0xcbdd0f,null))[_0x2936('0x27')](function(_0x30563a){if(_0x30563a){_0xab36cb=_0x30563a;return db['WhatsappAccount'][_0x2936('0x62')]({'where':{'id':_0x30563a[_0x2936('0x8b')]}});}})['then'](handleEntityNotFound(_0xcbdd0f,null))[_0x2936('0x27')](function(_0x2b0842){if(_0x2b0842){logger[_0x2936('0x2a')](_0x2936('0x8c'),_0x2936('0x3f'),'received\x20delivery\x20report\x20from',_0x2b0842['type'],util['inspect'](_0x2cb119[_0x2936('0x60')],{'showHidden':![],'depth':null}));switch(_0x2b0842[_0x2936('0x54')]){case _0x2936('0x8d'):if(_0x2cb119[_0x2936('0x60')][_0x2936('0x8e')]&&_0x2cb119[_0x2936('0x60')][_0x2936('0x8e')]===_0xab36cb[_0x2936('0x8f')]&&_0x2cb119['body']['MessageStatus']&&_0x2cb119[_0x2936('0x60')][_0x2936('0x90')]===_0x2936('0x67')){return _0xab36cb[_0x2936('0x3a')]({'read':!![]});}else{logger['error'](_0x2936('0x91'),_0x2936('0x3f'),_0x2936('0x8d'),util[_0x2936('0x92')](_0x2cb119[_0x2936('0x60')],{'showHidden':![],'depth':null}));}break;}return _0xab36cb;}})[_0x2936('0x27')](respondWithResult(_0xcbdd0f,null))[_0x2936('0x5e')](handleError(_0xcbdd0f,null));}; \ No newline at end of file +var _0xd46b=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','nolimit','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','ContactId','sequelize','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','reject','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','internal','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','messageId','MessageStatus','twilio','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','crypto','jsforce','querystring'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd46b,0x186));var _0xbd46=function(_0x3ef8a9,_0x59a7c2){_0x3ef8a9=_0x3ef8a9-0x0;var _0x424f63=_0xd46b[_0x3ef8a9];return _0x424f63;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbd46('0x0'));var jsonpatch=require(_0xbd46('0x1'));var rp=require(_0xbd46('0x2'));var moment=require(_0xbd46('0x3'));var BPromise=require(_0xbd46('0x4'));var Mustache=require(_0xbd46('0x5'));var util=require('util');var path=require(_0xbd46('0x6'));var sox=require(_0xbd46('0x7'));var csv=require(_0xbd46('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbd46('0x9'));var jsforce=require(_0xbd46('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xbd46('0x8'));var querystring=require(_0xbd46('0xb'));var Papa=require('papaparse');var Redis=require(_0xbd46('0xc'));var authService=require(_0xbd46('0xd'));var qs=require(_0xbd46('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd46('0xf'))('api');var utils=require(_0xbd46('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xbd46('0x11'));var db=require('../../mysqldb')['db'];config[_0xbd46('0x12')]=_[_0xbd46('0x13')](config['redis'],{'host':_0xbd46('0x14'),'port':0x18eb});var socket=require(_0xbd46('0x15'))(new Redis(config[_0xbd46('0x12')]));require(_0xbd46('0x16'))[_0xbd46('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbd46('0x18')][_0xbd46('0x19')]({'port':0x232c});var client9002=jayson[_0xbd46('0x18')][_0xbd46('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5d6dc1,_0x502abb,_0x2e62c6,_0x2f9066){return new BPromise(function(_0x3a6072,_0x1d5ea7){var _0x35c02a=_0x2f9066||client;return _0x35c02a[_0xbd46('0x1a')](_0x5d6dc1,_0x2e62c6)[_0xbd46('0x1b')](function(_0x45605d){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x502abb,_0xbd46('0x1c'));logger['debug'](_0xbd46('0x1d'),_0x502abb,_0xbd46('0x1c'),JSON[_0xbd46('0x1e')](_0x45605d));if(_0x45605d[_0xbd46('0x1f')]){if(_0x45605d['error'][_0xbd46('0x20')]===0x1f4){logger[_0xbd46('0x1f')](_0xbd46('0x21'),_0x502abb,_0x45605d[_0xbd46('0x1f')]['message']);return _0x1d5ea7(_0x45605d[_0xbd46('0x1f')][_0xbd46('0x22')]);}logger[_0xbd46('0x1f')](_0xbd46('0x21'),_0x502abb,_0x45605d[_0xbd46('0x1f')]['message']);return _0x3a6072(_0x45605d[_0xbd46('0x1f')]['message']);}else{logger[_0xbd46('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x502abb,'request\x20sent');_0x3a6072(_0x45605d[_0xbd46('0x24')][_0xbd46('0x22')]);}})['catch'](function(_0x49b252){logger[_0xbd46('0x1f')](_0xbd46('0x21'),_0x502abb,_0x49b252);_0x1d5ea7(_0x49b252);});});}function respondWithStatusCode(_0x1c4df4,_0x26656a){_0x26656a=_0x26656a||0xcc;return function(_0x2282b2){if(_0x2282b2){return _0x1c4df4[_0xbd46('0x25')](_0x26656a);}return _0x1c4df4[_0xbd46('0x26')](_0x26656a)[_0xbd46('0x27')]();};}function respondWithResult(_0x1459df,_0x508649){_0x508649=_0x508649||0xc8;return function(_0x7a9018){if(_0x7a9018){return _0x1459df[_0xbd46('0x26')](_0x508649)[_0xbd46('0x28')](_0x7a9018);}};}function respondWithFilteredResult(_0x10c498,_0x270eb6){return function(_0x5a0af8){if(_0x5a0af8){var _0x4ca6af=typeof _0x270eb6[_0xbd46('0x29')]==='undefined'&&typeof _0x270eb6[_0xbd46('0x2a')]===_0xbd46('0x2b');var _0x4b3152=_0x5a0af8['count'];var _0x148f8d=_0x4ca6af?0x0:_0x270eb6['offset'];var _0x4fbcc9=_0x4ca6af?_0x5a0af8[_0xbd46('0x2c')]:_0x270eb6['offset']+_0x270eb6[_0xbd46('0x2a')];var _0xb8517;if(_0x4fbcc9>=_0x4b3152){_0x4fbcc9=_0x4b3152;_0xb8517=0xc8;}else{_0xb8517=0xce;}_0x10c498['status'](_0xb8517);return _0x10c498[_0xbd46('0x2d')](_0xbd46('0x2e'),_0x148f8d+'-'+_0x4fbcc9+'/'+_0x4b3152)['json'](_0x5a0af8);}return null;};}function patchUpdates(_0x3a2304){return function(_0x38417d){try{jsonpatch[_0xbd46('0x2f')](_0x38417d,_0x3a2304,!![]);}catch(_0x47f17a){return BPromise['reject'](_0x47f17a);}return _0x38417d[_0xbd46('0x30')]();};}function saveUpdates(_0x414191,_0x28b0da){return function(_0x233655){if(_0x233655){return _0x233655[_0xbd46('0x31')](_0x414191)[_0xbd46('0x1b')](function(_0x36955a){return _0x36955a;});}return null;};}function removeEntity(_0x30264b,_0x2708d2){return function(_0x31e2d3){if(_0x31e2d3){return _0x31e2d3[_0xbd46('0x32')]()[_0xbd46('0x1b')](function(){_0x30264b['status'](0xcc)[_0xbd46('0x27')]();});}};}function handleEntityNotFound(_0x3f02bb,_0x54570a){return function(_0x745052){if(!_0x745052){_0x3f02bb[_0xbd46('0x25')](0x194);}return _0x745052;};}function handleError(_0x338b37,_0x30b6d6){_0x30b6d6=_0x30b6d6||0x1f4;return function(_0x56fd99){logger[_0xbd46('0x1f')](_0x56fd99[_0xbd46('0x33')]);if(_0x56fd99[_0xbd46('0x34')]){delete _0x56fd99[_0xbd46('0x34')];}_0x338b37[_0xbd46('0x26')](_0x30b6d6)[_0xbd46('0x35')](_0x56fd99);};}exports[_0xbd46('0x36')]=function(_0x3c8dce,_0x3065e9){var _0x35a6fe={},_0x1173db={},_0x5e2bf3={'count':0x0,'rows':[]};var _0x2e9ffb=_[_0xbd46('0x37')](db[_0xbd46('0x38')][_0xbd46('0x39')],function(_0x2be7a9){return{'name':_0x2be7a9[_0xbd46('0x3a')],'type':_0x2be7a9[_0xbd46('0x3b')][_0xbd46('0x3c')]};});_0x1173db[_0xbd46('0x3d')]=_[_0xbd46('0x37')](_0x2e9ffb,_0xbd46('0x34'));_0x1173db['query']=_[_0xbd46('0x3e')](_0x3c8dce['query']);_0x1173db[_0xbd46('0x3f')]=_['intersection'](_0x1173db['model'],_0x1173db[_0xbd46('0x40')]);_0x35a6fe[_0xbd46('0x41')]=_[_0xbd46('0x42')](_0x1173db[_0xbd46('0x3d')],qs[_0xbd46('0x43')](_0x3c8dce[_0xbd46('0x40')][_0xbd46('0x43')]));_0x35a6fe[_0xbd46('0x41')]=_0x35a6fe[_0xbd46('0x41')][_0xbd46('0x44')]?_0x35a6fe[_0xbd46('0x41')]:_0x1173db[_0xbd46('0x3d')];if(!_0x3c8dce[_0xbd46('0x40')]['hasOwnProperty'](_0xbd46('0x45'))){_0x35a6fe[_0xbd46('0x2a')]=qs[_0xbd46('0x2a')](_0x3c8dce[_0xbd46('0x40')][_0xbd46('0x2a')]);_0x35a6fe[_0xbd46('0x29')]=qs['offset'](_0x3c8dce[_0xbd46('0x40')][_0xbd46('0x29')]);}_0x35a6fe['order']=qs['sort'](_0x3c8dce['query']['sort']);_0x35a6fe[_0xbd46('0x46')]=qs[_0xbd46('0x3f')](_['pick'](_0x3c8dce[_0xbd46('0x40')],_0x1173db[_0xbd46('0x3f')]),_0x2e9ffb);if(_0x3c8dce[_0xbd46('0x40')][_0xbd46('0x47')]){_0x35a6fe['where']=_[_0xbd46('0x48')](_0x35a6fe[_0xbd46('0x46')],{'$or':_[_0xbd46('0x37')](_0x2e9ffb,function(_0x2de936){if(_0x2de936[_0xbd46('0x3b')]!==_0xbd46('0x49')){var _0x3ce153={};_0x3ce153[_0x2de936['name']]={'$like':'%'+_0x3c8dce['query'][_0xbd46('0x47')]+'%'};return _0x3ce153;}})});}_0x35a6fe=_[_0xbd46('0x48')]({},_0x35a6fe,_0x3c8dce[_0xbd46('0x4a')]);var _0x55f666={'where':_0x35a6fe['where']};return db[_0xbd46('0x38')][_0xbd46('0x2c')](_0x55f666)[_0xbd46('0x1b')](function(_0x4bea1b){_0x5e2bf3['count']=_0x4bea1b;if(_0x3c8dce[_0xbd46('0x40')]['includeAll']){_0x35a6fe[_0xbd46('0x4b')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xbd46('0x4c')](_0x35a6fe);})[_0xbd46('0x1b')](function(_0x653beb){_0x5e2bf3[_0xbd46('0x4d')]=_0x653beb;return _0x5e2bf3;})[_0xbd46('0x1b')](respondWithFilteredResult(_0x3065e9,_0x35a6fe))[_0xbd46('0x4e')](handleError(_0x3065e9,null));};exports['show']=function(_0x41c4c6,_0x4e6a85){var _0x6345c3={'raw':!![],'where':{'id':_0x41c4c6[_0xbd46('0x4f')]['id']}},_0x289cad={};_0x289cad[_0xbd46('0x3d')]=_['keys'](db[_0xbd46('0x38')][_0xbd46('0x39')]);_0x289cad['query']=_['keys'](_0x41c4c6[_0xbd46('0x40')]);_0x289cad['filters']=_[_0xbd46('0x42')](_0x289cad[_0xbd46('0x3d')],_0x289cad[_0xbd46('0x40')]);_0x6345c3[_0xbd46('0x41')]=_['intersection'](_0x289cad[_0xbd46('0x3d')],qs[_0xbd46('0x43')](_0x41c4c6[_0xbd46('0x40')][_0xbd46('0x43')]));_0x6345c3['attributes']=_0x6345c3[_0xbd46('0x41')][_0xbd46('0x44')]?_0x6345c3[_0xbd46('0x41')]:_0x289cad[_0xbd46('0x3d')];if(_0x41c4c6[_0xbd46('0x40')][_0xbd46('0x50')]){_0x6345c3[_0xbd46('0x4b')]=[{'all':!![]}];}_0x6345c3=_['merge']({},_0x6345c3,_0x41c4c6[_0xbd46('0x4a')]);return db[_0xbd46('0x38')]['find'](_0x6345c3)[_0xbd46('0x1b')](handleEntityNotFound(_0x4e6a85,null))[_0xbd46('0x1b')](respondWithResult(_0x4e6a85,null))[_0xbd46('0x4e')](handleError(_0x4e6a85,null));};exports[_0xbd46('0x51')]=function(_0x13bb33,_0x45f74c){return db[_0xbd46('0x38')][_0xbd46('0x51')](_0x13bb33[_0xbd46('0x52')],{})[_0xbd46('0x1b')](respondWithResult(_0x45f74c,0xc9))['catch'](handleError(_0x45f74c,null));};exports[_0xbd46('0x31')]=function(_0x4ca378,_0x25503b){if(_0x4ca378['body']['id']){delete _0x4ca378[_0xbd46('0x52')]['id'];}return db[_0xbd46('0x38')][_0xbd46('0x53')]({'where':{'id':_0x4ca378[_0xbd46('0x4f')]['id']}})['then'](handleEntityNotFound(_0x25503b,null))['then'](saveUpdates(_0x4ca378[_0xbd46('0x52')],null))[_0xbd46('0x1b')](respondWithResult(_0x25503b,null))['catch'](handleError(_0x25503b,null));};exports[_0xbd46('0x32')]=function(_0x58c22b,_0x5c0d6d){return db[_0xbd46('0x38')]['find']({'where':{'id':_0x58c22b[_0xbd46('0x4f')]['id']}})[_0xbd46('0x1b')](handleEntityNotFound(_0x5c0d6d,null))[_0xbd46('0x1b')](removeEntity(_0x5c0d6d,null))['catch'](handleError(_0x5c0d6d,null));};exports[_0xbd46('0x54')]=function(_0x14361b,_0x3574cf){return db[_0xbd46('0x38')][_0xbd46('0x54')]()[_0xbd46('0x1b')](respondWithResult(_0x3574cf,null))[_0xbd46('0x4e')](handleError(_0x3574cf,null));};var interaction_log=require(_0xbd46('0xf'))(_0xbd46('0x55'));exports[_0xbd46('0x56')]=function(_0x86385,_0x5a45a7,_0x13b38e){var _0x4ab0fa={'agent':{},'channel':_0xbd46('0x57')};if(_0x86385[_0xbd46('0x52')]['id']){delete _0x86385['body']['id'];}_0x86385[_0xbd46('0x52')][_0xbd46('0x58')]=!![];_0x86385['body'][_0xbd46('0x59')]=moment()[_0xbd46('0x5a')](_0xbd46('0x5b'));_0x86385[_0xbd46('0x52')][_0xbd46('0x5c')]=_0x86385['body'][_0xbd46('0x5c')]||_0x86385[_0xbd46('0x5d')]['id'];_0x4ab0fa[_0xbd46('0x5e')]['id']=_0x86385[_0xbd46('0x52')][_0xbd46('0x5c')];return db['WhatsappMessage']['find']({'where':{'id':_0x86385['params']['id'],'UserId':null}})[_0xbd46('0x1b')](handleEntityNotFound(_0x5a45a7,null))[_0xbd46('0x1b')](saveUpdates(_0x86385[_0xbd46('0x52')],null))['then'](function(_0x7c94d){if(_0x7c94d){_0x4ab0fa['message']=_0x7c94d[_0xbd46('0x5f')]({'plain':!![]});return db[_0xbd46('0x60')][_0xbd46('0x53')]({'where':{'id':_0x7c94d[_0xbd46('0x61')]}});}return null;})[_0xbd46('0x1b')](handleEntityNotFound(_0x5a45a7,null))[_0xbd46('0x1b')](function(_0x4895b7){if(_0x4895b7){return _0x4895b7[_0xbd46('0x31')]({'UserId':_0x86385['body'][_0xbd46('0x5c')],'read1stAt':_[_0xbd46('0x62')](_0x4895b7['read1stAt'])?moment()[_0xbd46('0x5a')](_0xbd46('0x5b')):undefined});}return null;})[_0xbd46('0x1b')](function(_0x5bee43){if(_0x5bee43){_0x4ab0fa[_0xbd46('0x63')]=_0x5bee43[_0xbd46('0x5f')]({'plain':!![]});interaction_log[_0xbd46('0x23')](_0xbd46('0x64'),_0x86385[_0xbd46('0x5d')]['id'],_0x86385['user'][_0xbd46('0x34')],_0x86385[_0xbd46('0x5d')][_0xbd46('0x65')],_0x4ab0fa[_0xbd46('0x63')]['id'],_0x86385['body']?JSON[_0xbd46('0x1e')](_0x86385[_0xbd46('0x52')]):_0xbd46('0x66'));return respondWithRpcPromise('AcceptMessage',_0xbd46('0x67'),_0x4ab0fa);}return null;})[_0xbd46('0x1b')](function(_0x2a7e49){var _0x454a49='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2a7e49[_0xbd46('0x22')][_0xbd46('0x68')];return db[_0xbd46('0x69')]['query'](_0x454a49,{'type':db['Sequelize']['QueryTypes'][_0xbd46('0x6a')],'raw':!![]})[_0xbd46('0x1b')](function(_0x26e4db){return _0x26e4db;});})[_0xbd46('0x1b')](function(_0x508593){if(_0x508593){_0x4ab0fa[_0xbd46('0x22')][_0xbd46('0x6b')]=_0x508593[0x0];if(!_0x86385[_0xbd46('0x52')][_0xbd46('0x5c')])return;return db[_0xbd46('0x6c')][_0xbd46('0x53')]({'where':{'id':_0x86385['body'][_0xbd46('0x5c')],'role':_0xbd46('0x5e')},'attributes':['id',_0xbd46('0x34'),_0xbd46('0x6d'),_0xbd46('0x6e'),'internal'],'raw':!![]});}return null;})[_0xbd46('0x1b')](function(_0x10ab6a){if(!_0x10ab6a)return null;_0x4ab0fa[_0xbd46('0x22')][_0xbd46('0x5e')]=_0x10ab6a;return _0x4ab0fa;})[_0xbd46('0x1b')](function(_0x9e20ae){if(_0x9e20ae){if(_0x86385['body'][_0xbd46('0x6f')]){_0x4ab0fa['message'][_0xbd46('0x70')]=util[_0xbd46('0x5a')](_0xbd46('0x71'),_0x86385['user'][_0xbd46('0x34')]);_0x4ab0fa[_0xbd46('0x22')][_0xbd46('0x72')]=_0x4ab0fa[_0xbd46('0x72')];_0x4ab0fa['message'][_0xbd46('0x73')]=_0x4ab0fa[_0xbd46('0x72')];_0x4ab0fa[_0xbd46('0x22')][_0xbd46('0x74')]=_0xbd46('0x56');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x4ab0fa['message']},client9002)['then'](function(){return _0x4ab0fa;});}return _0x4ab0fa;}return null;})[_0xbd46('0x1b')](respondWithResult(_0x5a45a7,null))[_0xbd46('0x4e')](handleError(_0x5a45a7,null));};var interaction_log=require(_0xbd46('0xf'))(_0xbd46('0x55'));exports[_0xbd46('0x75')]=function(_0x241051,_0x39897d,_0x2bf37a){var _0x4ac1de={'agent':{},'channel':_0xbd46('0x57')};if(_0x241051[_0xbd46('0x52')]['id']){delete _0x241051[_0xbd46('0x52')]['id'];}_0x241051[_0xbd46('0x52')][_0xbd46('0x5c')]=_0x241051[_0xbd46('0x52')][_0xbd46('0x5c')]||_0x241051['user']['id'];_0x4ac1de[_0xbd46('0x5e')]['id']=_0x241051['body'][_0xbd46('0x5c')];return db['WhatsappMessage'][_0xbd46('0x53')]({'where':{'id':_0x241051[_0xbd46('0x4f')]['id'],'UserId':null}})[_0xbd46('0x1b')](handleEntityNotFound(_0x39897d,null))['then'](function(_0x16378f){if(_0x16378f){_0x4ac1de['message']=_0x16378f[_0xbd46('0x5f')]({'plain':!![]});return db[_0xbd46('0x60')]['find']({'where':{'id':_0x16378f[_0xbd46('0x61')]}});}return null;})[_0xbd46('0x1b')](handleEntityNotFound(_0x39897d,null))[_0xbd46('0x1b')](function(_0x1d8767){if(_0x1d8767){_0x4ac1de[_0xbd46('0x63')]=_0x1d8767[_0xbd46('0x5f')]({'plain':!![]});interaction_log[_0xbd46('0x23')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x241051[_0xbd46('0x5d')]['id'],_0x241051[_0xbd46('0x5d')][_0xbd46('0x34')],_0x241051[_0xbd46('0x5d')][_0xbd46('0x65')],_0x4ac1de['interaction']['id'],_0x241051[_0xbd46('0x52')]?JSON[_0xbd46('0x1e')](_0x241051[_0xbd46('0x52')]):_0xbd46('0x66'));return respondWithRpcPromise(_0xbd46('0x76'),_0xbd46('0x77'),_0x4ac1de);}return null;})[_0xbd46('0x1b')](function(_0x57cf82){var _0x31db73=_0xbd46('0x78')+_0x57cf82[_0xbd46('0x22')]['ContactId'];return db['sequelize'][_0xbd46('0x40')](_0x31db73,{'type':db[_0xbd46('0x79')]['QueryTypes'][_0xbd46('0x6a')],'raw':!![]})[_0xbd46('0x1b')](function(_0x5eb107){return _0x5eb107;});})['then'](function(_0x3f1a9b){if(_0x3f1a9b){_0x4ac1de[_0xbd46('0x22')][_0xbd46('0x6b')]=_0x3f1a9b[0x0];if(!_0x241051[_0xbd46('0x52')][_0xbd46('0x5c')])return;return db[_0xbd46('0x6c')][_0xbd46('0x53')]({'where':{'id':_0x241051[_0xbd46('0x52')][_0xbd46('0x5c')],'role':_0xbd46('0x5e')},'attributes':['id','name',_0xbd46('0x6d'),_0xbd46('0x6e'),_0xbd46('0x7a')],'raw':!![]});}return null;})[_0xbd46('0x1b')](function(_0x45330e){if(!_0x45330e)return null;_0x4ac1de['message'][_0xbd46('0x5e')]=_0x45330e;return _0x4ac1de;})[_0xbd46('0x1b')](function(_0x14b182){if(_0x14b182){_0x14b182[_0xbd46('0x22')]['interface']=util[_0xbd46('0x5a')](_0xbd46('0x71'),_0x241051['user'][_0xbd46('0x34')]);_0x14b182[_0xbd46('0x22')][_0xbd46('0x72')]=_0x4ac1de['channel'];_0x14b182['message']['motionChannel']=_0x4ac1de[_0xbd46('0x72')];_0x14b182[_0xbd46('0x22')][_0xbd46('0x74')]=_0xbd46('0x75');respondWithRpcPromise('EventManager',_0xbd46('0x7b'),{'event':_0xbd46('0x7c'),'message':_0x14b182[_0xbd46('0x22')]},client9002);return _0x4ac1de;}return null;})[_0xbd46('0x1b')](respondWithResult(_0x39897d,null))[_0xbd46('0x4e')](handleError(_0x39897d,null));};exports[_0xbd46('0x26')]=function(_0x5ab0a9,_0x5da39f,_0x3c4c60){if(_0x5ab0a9[_0xbd46('0x52')]['id']){delete _0x5ab0a9[_0xbd46('0x52')]['id'];}var _0x36be1b;return db[_0xbd46('0x38')][_0xbd46('0x53')]({'where':{'id':_0x5ab0a9[_0xbd46('0x4f')]['id']}})[_0xbd46('0x1b')](handleEntityNotFound(_0x5da39f,null))[_0xbd46('0x1b')](function(_0x3a50bc){if(_0x3a50bc){_0x36be1b=_0x3a50bc;return db[_0xbd46('0x7d')][_0xbd46('0x53')]({'where':{'id':_0x3a50bc[_0xbd46('0x7e')]}});}})[_0xbd46('0x1b')](handleEntityNotFound(_0x5da39f,null))['then'](function(_0x23d8bd){if(_0x23d8bd){logger[_0xbd46('0x7f')](_0xbd46('0x80'),_0xbd46('0x26'),'received\x20delivery\x20report\x20from',_0x23d8bd[_0xbd46('0x3b')],util[_0xbd46('0x81')](_0x5ab0a9['body'],{'showHidden':![],'depth':null}));switch(_0x23d8bd[_0xbd46('0x3b')]){case'twilio':if(_0x5ab0a9[_0xbd46('0x52')][_0xbd46('0x82')]&&_0x5ab0a9[_0xbd46('0x52')][_0xbd46('0x82')]===_0x36be1b[_0xbd46('0x83')]&&_0x5ab0a9['body'][_0xbd46('0x84')]&&_0x5ab0a9[_0xbd46('0x52')][_0xbd46('0x84')]===_0xbd46('0x58')){return _0x36be1b[_0xbd46('0x31')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0xbd46('0x85'),util['inspect'](_0x5ab0a9['body'],{'showHidden':![],'depth':null}));}break;}return _0x36be1b;}})['then'](respondWithResult(_0x5da39f,null))['catch'](handleError(_0x5da39f,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 66b7bf0..cbd15e1 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 _0x4483=['../../mysqldb','WhatsappMessage','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4483,0x1a3));var _0x3448=function(_0x350c42,_0x4e554c){_0x350c42=_0x350c42-0x0;var _0x3bc033=_0x4483[_0x350c42];return _0x3bc033;};'use strict';var EventEmitter=require(_0x3448('0x0'));var WhatsappMessage=require(_0x3448('0x1'))['db'][_0x3448('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3448('0x3'),'afterUpdate':_0x3448('0x4'),'afterDestroy':_0x3448('0x5')};function emitEvent(_0x3a7178){return function(_0xef1a93,_0x5f5163,_0xeb5b8){WhatsappMessageEvents[_0x3448('0x6')](_0x3a7178+':'+_0xef1a93['id'],_0xef1a93);WhatsappMessageEvents[_0x3448('0x6')](_0x3a7178,_0xef1a93);_0xeb5b8(null);};}for(var e in events){if(events[_0x3448('0x7')](e)){var event=events[e];WhatsappMessage[_0x3448('0x8')](e,emitEvent(event));}}module[_0x3448('0x9')]=WhatsappMessageEvents; \ No newline at end of file +var _0x4b0f=['exports','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x3b9368,_0x52be6f){_0x3b9368=_0x3b9368-0x0;var _0x27290d=_0x4b0f[_0x3b9368];return _0x27290d;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xf4b0('0x0'))['db'][_0xf4b0('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf4b0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf4b0('0x3'),'afterDestroy':_0xf4b0('0x4')};function emitEvent(_0x141c87){return function(_0x28be5f,_0x2a08dc,_0x354cb3){WhatsappMessageEvents[_0xf4b0('0x5')](_0x141c87+':'+_0x28be5f['id'],_0x28be5f);WhatsappMessageEvents[_0xf4b0('0x5')](_0x141c87,_0x28be5f);_0x354cb3(null);};}for(var e in events){if(events[_0xf4b0('0x6')](e)){var event=events[e];WhatsappMessage[_0xf4b0('0x7')](e,emitEvent(event));}}module[_0xf4b0('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index ba54d00..1ce6e00 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 _0x56db=['phone','messages','create','whatsapp:','remote','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','body','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','moment','bluebird','node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','secret','WhatsappAccount','find','type','twilio','accountSid','authToken'];(function(_0x4d3de7,_0x186573){var _0x2a5500=function(_0x5113d5){while(--_0x5113d5){_0x4d3de7['push'](_0x4d3de7['shift']());}};_0x2a5500(++_0x186573);}(_0x56db,0x92));var _0xb56d=function(_0x40bfc2,_0x538e26){_0x40bfc2=_0x40bfc2-0x0;var _0x14d1db=_0x56db[_0x40bfc2];return _0x14d1db;};'use strict';var _=require(_0xb56d('0x0'));var util=require(_0xb56d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb56d('0x2'));var BPromise=require(_0xb56d('0x3'));var rp=require('request-promise');var fetch=require(_0xb56d('0x4'));var fs=require('fs');var path=require(_0xb56d('0x5'));var rimraf=require(_0xb56d('0x6'));var config=require(_0xb56d('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0xb56d('0x8')]=function(_0x39a633,_0x3d4dde){return _0x39a633[_0xb56d('0x9')](_0xb56d('0xa'),attributes,{'tableName':_0xb56d('0xb'),'paranoid':![],'indexes':[{'name':_0xb56d('0xc'),'fields':[_0xb56d('0xc')]},{'name':_0xb56d('0xd'),'fields':['body'],'type':_0xb56d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a1fe8,_0x30a77d,_0x4878b8){var _0xbdfae0=_0x39a633[_0xb56d('0xf')];var _0x91b8c0=_0x5a1fe8[_0xb56d('0x10')]({'plain':!![]});if(_0x91b8c0[_0xb56d('0x11')]['toLowerCase']()==='in'||_0x91b8c0['direction'][_0xb56d('0x12')]()===_0xb56d('0x13')&&!_0x91b8c0['secret']&&!_[_0xb56d('0x14')](_0x91b8c0[_0xb56d('0x15')])){_0xbdfae0[_0xb56d('0x16')][_0xb56d('0x17')]({'where':{'id':_0x91b8c0[_0xb56d('0x18')]}})[_0xb56d('0x19')](function(_0x3175b7){if(_0x3175b7){_0x3175b7[_0xb56d('0x1a')]({'lastMsgAt':_0x91b8c0[_0xb56d('0x1b')],'lastMsgDirection':_0x91b8c0['direction'][_0xb56d('0x12')]()});}})[_0xb56d('0x1c')](function(_0x58315f){console[_0xb56d('0x1d')](_0x58315f);});}if(_0x91b8c0['direction']===_0xb56d('0x13')&&!_0x91b8c0[_0xb56d('0x1e')]){var _0x3ae501;_0xbdfae0[_0xb56d('0x1f')][_0xb56d('0x20')]({'where':{'id':_0x91b8c0['WhatsappAccountId']},'raw':!![]})[_0xb56d('0x19')](function(_0x8e013a){_0x3ae501=_0x8e013a;if(_0x3ae501&&_0x3ae501[_0xb56d('0x21')]){switch(_0x3ae501[_0xb56d('0x21')]){case'twilio':var _0x57a24c=require(_0xb56d('0x22'));if(_0x3ae501[_0xb56d('0x23')]&&_0x3ae501[_0xb56d('0x24')]&&_0x3ae501[_0xb56d('0x25')]){var _0x496db4=new _0x57a24c(_0x3ae501['accountSid'],_0x3ae501[_0xb56d('0x24')]);_0x496db4[_0xb56d('0x26')][_0xb56d('0x27')]({'body':_0x91b8c0['body'],'to':_0xb56d('0x28')+_0x91b8c0[_0xb56d('0x25')],'from':_0xb56d('0x28')+_0x3ae501[_0xb56d('0x25')],'statusCallback':_0x3ae501[_0xb56d('0x29')]+'/api/whatsapp/messages/'+_0x91b8c0['id']+'/status?token='+_0x3ae501[_0xb56d('0x2a')]})[_0xb56d('0x19')](function(_0x4cdf19){if(_0x4cdf19['sid']){return _0x5a1fe8[_0xb56d('0x1a')]({'messageId':_0x4cdf19[_0xb56d('0x2b')]});}})[_0xb56d('0x1c')](function(_0x220375){logger[_0xb56d('0x1d')](_0xb56d('0x2c'),_0xb56d('0x2d'),_0xb56d('0x22'),util['inspect'](_0x220375,{'showHidden':![],'depth':null}));});}else{logger[_0xb56d('0x1d')](_0xb56d('0x2c'),'afterCreate',_0xb56d('0x22'),_0xb56d('0x2e'));}break;case _0xb56d('0x2f'):var _0x3964be=_0x3ae501[_0xb56d('0x23')];var _0x1ac577=_0x3ae501[_0xb56d('0x24')];var _0x59878a=_0x3ae501[_0xb56d('0x30')]+_0xb56d('0x31')+_0x3964be+_0xb56d('0x32');var _0x2bf73c={'to':[_0x91b8c0['phone']],'message':{'type':_0xb56d('0x33'),'text':_0x91b8c0[_0xb56d('0x34')]}};var _0x33de0b={'method':_0xb56d('0x35'),'uri':_0x59878a,'headers':{'Authorization':_0xb56d('0x36')+_0x1ac577,'Content-Type':'application/json'},'body':_0x2bf73c,'json':!![]};rp(_0x33de0b)[_0xb56d('0x19')](function(_0x3f723c){if(_0x3f723c[_0xb56d('0x37')][0x0][_0xb56d('0x38')]){return _0x5a1fe8['update']({'messageId':_0x3f723c['statuses'][0x0]['message_id']});}})['catch'](function(_0x35e5de){logger[_0xb56d('0x39')](_0xb56d('0x3a'),_0x35e5de);});break;}}})[_0xb56d('0x3b')](function(){_0x4878b8();});}else{_0x4878b8();}}},'charset':'utf8mb4','collate':_0xb56d('0x3c')});}; \ No newline at end of file +var _0xe6ed=['isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','catch','WhatsappAccount','find','type','accountSid','authToken','phone','messages','create','remote','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','body','POST','message_id','statuses','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','models','direction','toLowerCase','out','secret'];(function(_0x1aaa8b,_0x19a688){var _0xa12273=function(_0x4a20b9){while(--_0x4a20b9){_0x1aaa8b['push'](_0x1aaa8b['shift']());}};_0xa12273(++_0x19a688);}(_0xe6ed,0x107));var _0xde6e=function(_0x13ccc1,_0x3d6de3){_0x13ccc1=_0x13ccc1-0x0;var _0x531ca3=_0xe6ed[_0x13ccc1];return _0x531ca3;};'use strict';var _=require(_0xde6e('0x0'));var util=require(_0xde6e('0x1'));var logger=require(_0xde6e('0x2'))(_0xde6e('0x3'));var moment=require(_0xde6e('0x4'));var BPromise=require(_0xde6e('0x5'));var rp=require(_0xde6e('0x6'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xde6e('0x7'));var rimraf=require(_0xde6e('0x8'));var config=require(_0xde6e('0x9'));var attributes=require(_0xde6e('0xa'));module[_0xde6e('0xb')]=function(_0x236fdd,_0x420423){return _0x236fdd[_0xde6e('0xc')](_0xde6e('0xd'),attributes,{'tableName':_0xde6e('0xe'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xde6e('0xf')]},{'name':_0xde6e('0x10'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f8377,_0x3ba890,_0x1499d8){var _0x4e323f=_0x236fdd[_0xde6e('0x11')];var _0x25f4b0=_0x3f8377['get']({'plain':!![]});if(_0x25f4b0[_0xde6e('0x12')]['toLowerCase']()==='in'||_0x25f4b0[_0xde6e('0x12')][_0xde6e('0x13')]()===_0xde6e('0x14')&&!_0x25f4b0[_0xde6e('0x15')]&&!_[_0xde6e('0x16')](_0x25f4b0['UserId'])){_0x4e323f[_0xde6e('0x17')][_0xde6e('0x18')]({'where':{'id':_0x25f4b0[_0xde6e('0x19')]}})[_0xde6e('0x1a')](function(_0xccdcea){if(_0xccdcea){_0xccdcea['update']({'lastMsgAt':_0x25f4b0['createdAt'],'lastMsgDirection':_0x25f4b0[_0xde6e('0x12')][_0xde6e('0x13')]()});}})[_0xde6e('0x1b')](function(_0xc6c388){console['error'](_0xc6c388);});}if(_0x25f4b0[_0xde6e('0x12')]==='out'&&!_0x25f4b0[_0xde6e('0x15')]){var _0xe0bd4e;_0x4e323f[_0xde6e('0x1c')][_0xde6e('0x1d')]({'where':{'id':_0x25f4b0['WhatsappAccountId']},'raw':!![]})[_0xde6e('0x1a')](function(_0x35149a){_0xe0bd4e=_0x35149a;if(_0xe0bd4e&&_0xe0bd4e['type']){switch(_0xe0bd4e[_0xde6e('0x1e')]){case'twilio':var _0x458322=require('twilio');if(_0xe0bd4e[_0xde6e('0x1f')]&&_0xe0bd4e[_0xde6e('0x20')]&&_0xe0bd4e[_0xde6e('0x21')]){var _0x6cd0e5=new _0x458322(_0xe0bd4e['accountSid'],_0xe0bd4e['authToken']);_0x6cd0e5[_0xde6e('0x22')][_0xde6e('0x23')]({'body':_0x25f4b0['body'],'to':'whatsapp:'+_0x25f4b0[_0xde6e('0x21')],'from':'whatsapp:'+_0xe0bd4e[_0xde6e('0x21')],'statusCallback':_0xe0bd4e[_0xde6e('0x24')]+'/api/whatsapp/messages/'+_0x25f4b0['id']+'/status?token='+_0xe0bd4e[_0xde6e('0x25')]})[_0xde6e('0x1a')](function(_0xab8854){if(_0xab8854[_0xde6e('0x26')]){return _0x3f8377[_0xde6e('0x27')]({'messageId':_0xab8854[_0xde6e('0x26')]});}})['catch'](function(_0x562f7c){logger['error'](_0xde6e('0x28'),_0xde6e('0x29'),_0xde6e('0x2a'),util['inspect'](_0x562f7c,{'showHidden':![],'depth':null}));});}else{logger[_0xde6e('0x2b')](_0xde6e('0x28'),'afterCreate',_0xde6e('0x2a'),_0xde6e('0x2c'));}break;case _0xde6e('0x2d'):var _0x42c67a=_0xe0bd4e[_0xde6e('0x1f')];var _0x29a8e6=_0xe0bd4e['authToken'];var _0x3d90eb=_0xe0bd4e[_0xde6e('0x2e')]+_0xde6e('0x2f')+_0x42c67a+_0xde6e('0x30');var _0x4cc338={'to':[_0x25f4b0['phone']],'message':{'type':'text','text':_0x25f4b0[_0xde6e('0x31')]}};var _0x118383={'method':_0xde6e('0x32'),'uri':_0x3d90eb,'headers':{'Authorization':'Bearer\x20'+_0x29a8e6,'Content-Type':'application/json'},'body':_0x4cc338,'json':!![]};rp(_0x118383)[_0xde6e('0x1a')](function(_0x68a90b){if(_0x68a90b['statuses'][0x0][_0xde6e('0x33')]){return _0x3f8377[_0xde6e('0x27')]({'messageId':_0x68a90b[_0xde6e('0x34')][0x0][_0xde6e('0x33')]});}})[_0xde6e('0x1b')](function(_0x238a84){logger['err'](_0xde6e('0x35'),_0x238a84);});break;}}})[_0xde6e('0x36')](function(){_0x1499d8();});}else{_0x1499d8();}}},'charset':_0xde6e('0x37'),'collate':_0xde6e('0x38')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index de62c62..800b233 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 _0x062b=['socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','create','body','options','raw','CreateWhatsappMessage','stringify','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis'];(function(_0x503185,_0x20d261){var _0xb29eff=function(_0x15e65e){while(--_0x15e65e){_0x503185['push'](_0x503185['shift']());}};_0xb29eff(++_0x20d261);}(_0x062b,0xb5));var _0xb062=function(_0x509084,_0x43b872){_0x509084=_0x509084-0x0;var _0x29174c=_0x062b[_0x509084];return _0x29174c;};'use strict';var _=require('lodash');var util=require(_0xb062('0x0'));var moment=require('moment');var BPromise=require(_0xb062('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb062('0x2'));var db=require(_0xb062('0x3'))['db'];var utils=require(_0xb062('0x4'));var logger=require(_0xb062('0x5'))(_0xb062('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb062('0x7')][_0xb062('0x8')]({'port':0x232a});config['redis']=_[_0xb062('0x9')](config[_0xb062('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb062('0xb'))(new Redis(config[_0xb062('0xa')]));require(_0xb062('0xc'))[_0xb062('0xd')](socket);function respondWithRpcPromise(_0x1f244a,_0x2cebae,_0x2c4f3d){return new BPromise(function(_0x29481b,_0xd04086){return client[_0xb062('0xe')](_0x1f244a,_0x2c4f3d)[_0xb062('0xf')](function(_0xeaef2d){logger[_0xb062('0x10')](_0xb062('0x11'),_0x2cebae,'request\x20sent');logger[_0xb062('0x12')](_0xb062('0x13'),_0x2cebae,_0xb062('0x14'),JSON['stringify'](_0xeaef2d));if(_0xeaef2d['error']){if(_0xeaef2d[_0xb062('0x15')][_0xb062('0x16')]===0x1f4){logger['error'](_0xb062('0x11'),_0x2cebae,_0xeaef2d[_0xb062('0x15')]['message']);return _0xd04086(_0xeaef2d[_0xb062('0x15')]['message']);}logger[_0xb062('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x2cebae,_0xeaef2d[_0xb062('0x15')][_0xb062('0x17')]);return _0x29481b(_0xeaef2d['error'][_0xb062('0x17')]);}else{logger['info'](_0xb062('0x11'),_0x2cebae,_0xb062('0x14'));_0x29481b(_0xeaef2d[_0xb062('0x18')]['message']);}})[_0xb062('0x19')](function(_0x25e675){logger['error'](_0xb062('0x11'),_0x2cebae,_0x25e675);_0xd04086(_0x25e675);});});}exports['CreateWhatsappMessage']=function(_0x33b4b0){var _0xca3dbb=this;return new Promise(function(_0x2a5a9e,_0x407d81){return db['WhatsappMessage'][_0xb062('0x1a')](_0x33b4b0[_0xb062('0x1b')],{'raw':_0x33b4b0[_0xb062('0x1c')]?_0x33b4b0['options'][_0xb062('0x1d')]===undefined?!![]:![]:!![]})[_0xb062('0xf')](function(_0x5ae4e9){logger[_0xb062('0x10')](_0xb062('0x1e'),_0x33b4b0);logger[_0xb062('0x12')](_0xb062('0x1e'),_0x33b4b0,JSON[_0xb062('0x1f')](_0x5ae4e9));_0x2a5a9e(_0x5ae4e9);})[_0xb062('0x19')](function(_0x39ce38){logger[_0xb062('0x15')](_0xb062('0x1e'),_0x39ce38[_0xb062('0x17')],_0x33b4b0);_0x407d81(_0xca3dbb[_0xb062('0x15')](0x1f4,_0x39ce38[_0xb062('0x17')]));});});}; \ No newline at end of file +var _0xfc0f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','WhatsappMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateWhatsappMessage','create','options','raw','info','stringify','lodash','util','moment','bluebird','randomstring'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0xfc0f,0xd3));var _0xffc0=function(_0x46b09c,_0x48472f){_0x46b09c=_0x46b09c-0x0;var _0x527090=_0xfc0f[_0x46b09c];return _0x527090;};'use strict';var _=require(_0xffc0('0x0'));var util=require(_0xffc0('0x1'));var moment=require(_0xffc0('0x2'));var BPromise=require(_0xffc0('0x3'));var rs=require(_0xffc0('0x4'));var fs=require('fs');var Redis=require(_0xffc0('0x5'));var db=require(_0xffc0('0x6'))['db'];var utils=require(_0xffc0('0x7'));var logger=require(_0xffc0('0x8'))(_0xffc0('0x9'));var config=require('../../config/environment');var jayson=require(_0xffc0('0xa'));var client=jayson[_0xffc0('0xb')][_0xffc0('0xc')]({'port':0x232a});config['redis']=_[_0xffc0('0xd')](config[_0xffc0('0xe')],{'host':_0xffc0('0xf'),'port':0x18eb});var socket=require(_0xffc0('0x10'))(new Redis(config['redis']));require(_0xffc0('0x11'))[_0xffc0('0x12')](socket);function respondWithRpcPromise(_0x553196,_0x31d55e,_0x1d0938){return new BPromise(function(_0x382644,_0x31e0d8){return client[_0xffc0('0x13')](_0x553196,_0x1d0938)[_0xffc0('0x14')](function(_0x1d0356){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x31d55e,'request\x20sent');logger[_0xffc0('0x15')](_0xffc0('0x16'),_0x31d55e,'request\x20sent',JSON['stringify'](_0x1d0356));if(_0x1d0356[_0xffc0('0x17')]){if(_0x1d0356[_0xffc0('0x17')][_0xffc0('0x18')]===0x1f4){logger[_0xffc0('0x17')](_0xffc0('0x19'),_0x31d55e,_0x1d0356[_0xffc0('0x17')][_0xffc0('0x1a')]);return _0x31e0d8(_0x1d0356[_0xffc0('0x17')][_0xffc0('0x1a')]);}logger['error'](_0xffc0('0x19'),_0x31d55e,_0x1d0356[_0xffc0('0x17')][_0xffc0('0x1a')]);return _0x382644(_0x1d0356[_0xffc0('0x17')]['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x31d55e,_0xffc0('0x1b'));_0x382644(_0x1d0356[_0xffc0('0x1c')][_0xffc0('0x1a')]);}})[_0xffc0('0x1d')](function(_0x1338ad){logger['error'](_0xffc0('0x19'),_0x31d55e,_0x1338ad);_0x31e0d8(_0x1338ad);});});}exports[_0xffc0('0x1e')]=function(_0x47fdfa){var _0x2d2c89=this;return new Promise(function(_0x5c97d0,_0x3e8c48){return db['WhatsappMessage'][_0xffc0('0x1f')](_0x47fdfa['body'],{'raw':_0x47fdfa[_0xffc0('0x20')]?_0x47fdfa[_0xffc0('0x20')][_0xffc0('0x21')]===undefined?!![]:![]:!![]})[_0xffc0('0x14')](function(_0x458baa){logger[_0xffc0('0x22')](_0xffc0('0x1e'),_0x47fdfa);logger[_0xffc0('0x15')]('CreateWhatsappMessage',_0x47fdfa,JSON[_0xffc0('0x23')](_0x458baa));_0x5c97d0(_0x458baa);})[_0xffc0('0x1d')](function(_0x57b18f){logger['error'](_0xffc0('0x1e'),_0x57b18f[_0xffc0('0x1a')],_0x47fdfa);_0x3e8c48(_0x2d2c89['error'](0x1f4,_0x57b18f[_0xffc0('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 6f379f5..89ac5e1 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 _0x218d=['removeListener','register','whatsappMessage:','./whatsappMessage.events','remove','update'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x218d,0x141));var _0xd218=function(_0x46ceb5,_0x4be9d7){_0x46ceb5=_0x46ceb5-0x0;var _0x10adbd=_0x218d[_0x46ceb5];return _0x10adbd;};'use strict';var WhatsappMessageEvents=require(_0xd218('0x0'));var events=['save',_0xd218('0x1'),_0xd218('0x2')];function createListener(_0x460d53,_0x52165b){return function(_0x4aae4f){_0x52165b['emit'](_0x460d53,_0x4aae4f);};}function removeListener(_0x360a8c,_0x4238ad){return function(){WhatsappMessageEvents[_0xd218('0x3')](_0x360a8c,_0x4238ad);};}exports[_0xd218('0x4')]=function(_0xeaf1f9){for(var _0x32adb1=0x0,_0x4364bd=events['length'];_0x32adb1<_0x4364bd;_0x32adb1++){var _0x4c080a=events[_0x32adb1];var _0x33a473=createListener(_0xd218('0x5')+_0x4c080a,_0xeaf1f9);WhatsappMessageEvents['on'](_0x4c080a,_0x33a473);}}; \ No newline at end of file +var _0x3a75=['removeListener','register','whatsappMessage:','save','remove'];(function(_0x433239,_0x20b0e6){var _0x46b526=function(_0x5a0246){while(--_0x5a0246){_0x433239['push'](_0x433239['shift']());}};_0x46b526(++_0x20b0e6);}(_0x3a75,0x1e3));var _0x53a7=function(_0x3d1398,_0x4ba2dd){_0x3d1398=_0x3d1398-0x0;var _0x1c3921=_0x3a75[_0x3d1398];return _0x1c3921;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x53a7('0x0'),_0x53a7('0x1'),'update'];function createListener(_0x2a45b0,_0x1a534e){return function(_0x43ad57){_0x1a534e['emit'](_0x2a45b0,_0x43ad57);};}function removeListener(_0x1041b1,_0x24db6e){return function(){WhatsappMessageEvents[_0x53a7('0x2')](_0x1041b1,_0x24db6e);};}exports[_0x53a7('0x3')]=function(_0x21fa76){for(var _0x2e02b9=0x0,_0x414fce=events['length'];_0x2e02b9<_0x414fce;_0x2e02b9++){var _0x4d2b37=events[_0x2e02b9];var _0x1b22d7=createListener(_0x53a7('0x4')+_0x4d2b37,_0x21fa76);WhatsappMessageEvents['on'](_0x4d2b37,_0x1b22d7);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index a4cca64..f3eb7e9 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 _0x2713=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','update','delete','/:id','destroy','removeTeams','exports','multer','util','path','connect-timeout'];(function(_0xbd6da,_0x45f40a){var _0x2d63f2=function(_0x366e50){while(--_0x366e50){_0xbd6da['push'](_0xbd6da['shift']());}};_0x2d63f2(++_0x45f40a);}(_0x2713,0x164));var _0x3271=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2713[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x3271('0x0'));var util=require(_0x3271('0x1'));var path=require(_0x3271('0x2'));var timeout=require(_0x3271('0x3'));var express=require(_0x3271('0x4'));var router=express[_0x3271('0x5')]();var fs_extra=require(_0x3271('0x6'));var auth=require(_0x3271('0x7'));var interaction=require(_0x3271('0x8'));var config=require(_0x3271('0x9'));var controller=require(_0x3271('0xa'));router[_0x3271('0xb')]('/',auth[_0x3271('0xc')](),controller[_0x3271('0xd')]);router[_0x3271('0xb')](_0x3271('0xe'),auth[_0x3271('0xc')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3271('0xb')](_0x3271('0xf'),auth[_0x3271('0xc')](),controller[_0x3271('0x10')]);router[_0x3271('0xb')](_0x3271('0x11'),auth[_0x3271('0xc')](),controller[_0x3271('0x12')]);router[_0x3271('0xb')](_0x3271('0x13'),auth[_0x3271('0xc')](),controller[_0x3271('0x14')]);router[_0x3271('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3271('0x15')]('/:id/teams',auth[_0x3271('0xc')](),controller[_0x3271('0x16')]);router[_0x3271('0x15')]('/:id/users',auth[_0x3271('0xc')](),controller['addAgents']);router[_0x3271('0x17')]('/:id',auth[_0x3271('0xc')](),controller[_0x3271('0x18')]);router[_0x3271('0x19')](_0x3271('0x1a'),auth['isAuthenticated'](),controller[_0x3271('0x1b')]);router[_0x3271('0x19')](_0x3271('0x11'),auth['isAuthenticated'](),controller[_0x3271('0x1c')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x3271('0x1d')]=router; \ No newline at end of file +var _0x68c3=['getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members'];(function(_0x3938ef,_0x52536b){var _0x4e473d=function(_0x170a15){while(--_0x170a15){_0x3938ef['push'](_0x3938ef['shift']());}};_0x4e473d(++_0x52536b);}(_0x68c3,0x8b));var _0x368c=function(_0x5c3a6a,_0x5e567a){_0x5c3a6a=_0x5c3a6a-0x0;var _0x68d5d6=_0x68c3[_0x5c3a6a];return _0x68d5d6;};'use strict';var multer=require(_0x368c('0x0'));var util=require('util');var path=require(_0x368c('0x1'));var timeout=require(_0x368c('0x2'));var express=require(_0x368c('0x3'));var router=express[_0x368c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x368c('0x5'));var interaction=require(_0x368c('0x6'));var config=require(_0x368c('0x7'));var controller=require(_0x368c('0x8'));router[_0x368c('0x9')]('/',auth[_0x368c('0xa')](),controller[_0x368c('0xb')]);router[_0x368c('0x9')](_0x368c('0xc'),auth['isAuthenticated'](),controller[_0x368c('0xd')]);router[_0x368c('0x9')](_0x368c('0xe'),auth[_0x368c('0xa')](),controller['show']);router[_0x368c('0x9')](_0x368c('0xf'),auth['isAuthenticated'](),controller[_0x368c('0x10')]);router['get'](_0x368c('0x11'),auth[_0x368c('0xa')](),controller['getTeams']);router['get'](_0x368c('0x12'),auth[_0x368c('0xa')](),controller[_0x368c('0x13')]);router[_0x368c('0x14')]('/',auth[_0x368c('0xa')](),controller[_0x368c('0x15')]);router['post'](_0x368c('0x11'),auth[_0x368c('0xa')](),controller[_0x368c('0x16')]);router['post'](_0x368c('0x12'),auth[_0x368c('0xa')](),controller[_0x368c('0x17')]);router[_0x368c('0x18')](_0x368c('0xe'),auth[_0x368c('0xa')](),controller[_0x368c('0x19')]);router['delete']('/:id',auth[_0x368c('0xa')](),controller[_0x368c('0x1a')]);router[_0x368c('0x1b')](_0x368c('0x11'),auth['isAuthenticated'](),controller[_0x368c('0x1c')]);router[_0x368c('0x1b')](_0x368c('0x12'),auth[_0x368c('0xa')](),controller[_0x368c('0x1d')]);module[_0x368c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index b5c3937..45155aa 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 _0xb010=['STRING','exports','name','ENUM','beepall','roundrobin'];(function(_0x4394e3,_0x36d68b){var _0x3e039a=function(_0x184c8f){while(--_0x184c8f){_0x4394e3['push'](_0x4394e3['shift']());}};_0x3e039a(++_0x36d68b);}(_0xb010,0x8b));var _0x0b01=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb010[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x0b01('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x0b01('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0b01('0x2')]('rrmemory',_0x0b01('0x3'),_0x0b01('0x4'))},'description':{'type':Sequelize[_0x0b01('0x5')]}}; \ No newline at end of file +var _0xac65=['STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0xac65,0x11d));var _0x5ac6=function(_0x3be48f,_0x5b2678){_0x3be48f=_0x3be48f-0x0;var _0x3c4abb=_0xac65[_0x3be48f];return _0x3c4abb;};'use strict';var Sequelize=require(_0x5ac6('0x0'));module[_0x5ac6('0x1')]={'name':{'type':Sequelize[_0x5ac6('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5ac6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5ac6('0x4')](_0x5ac6('0x5'),'beepall',_0x5ac6('0x6'))},'description':{'type':Sequelize[_0x5ac6('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 72f95a1..1ece8e1 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 _0xa197=['sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','emit','isArray','getAgents','bluebird','util','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','sendStatus','status','json','offset','undefined','limit','set','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','error','stack','name','send','map','rawAttributes','type','key','getOptions','where','count','include','WhatsappQueue','catch','show','params','model','query','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','order','pick','WhatsappQueueId','filter','UserWhatsappQueue','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','whatsappPause','Team','sort','nolimit','getTeams','addTeams','ids','Agents','online','voicePause','interface'];(function(_0xf28721,_0x4b11b1){var _0x3bd163=function(_0x55f43c){while(--_0x55f43c){_0xf28721['push'](_0xf28721['shift']());}};_0x3bd163(++_0x4b11b1);}(_0xa197,0x18f));var _0x7a19=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xa197[_0x1eda20];return _0x31b953;};'use strict';var BPromise=require(_0x7a19('0x0'));var util=require(_0x7a19('0x1'));var _=require(_0x7a19('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x7a19('0x3'));var logger=require(_0x7a19('0x4'))(_0x7a19('0x5'));var config=require(_0x7a19('0x6'));var db=require(_0x7a19('0x7'))['db'];config[_0x7a19('0x8')]=_[_0x7a19('0x9')](config[_0x7a19('0x8')],{'host':_0x7a19('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7a19('0xb'))['register'](socket);function respondWithStatusCode(_0x296afe,_0x28fef4){_0x28fef4=_0x28fef4||0xcc;return function(_0x4f0b2f){if(_0x4f0b2f){return _0x296afe[_0x7a19('0xc')](_0x28fef4);}return _0x296afe[_0x7a19('0xd')](_0x28fef4)['end']();};}function respondWithResult(_0x18e11f,_0x5c475a){_0x5c475a=_0x5c475a||0xc8;return function(_0x2934b8){if(_0x2934b8){return _0x18e11f[_0x7a19('0xd')](_0x5c475a)[_0x7a19('0xe')](_0x2934b8);}};}function respondWithFilteredResult(_0x438cee,_0x256844){return function(_0x3adaa8){if(_0x3adaa8){var _0x59ed25=typeof _0x256844[_0x7a19('0xf')]===_0x7a19('0x10')&&typeof _0x256844[_0x7a19('0x11')]===_0x7a19('0x10');var _0x22e136=_0x3adaa8['count'];var _0x85c54c=_0x59ed25?0x0:_0x256844[_0x7a19('0xf')];var _0x1fda28=_0x59ed25?_0x3adaa8['count']:_0x256844[_0x7a19('0xf')]+_0x256844[_0x7a19('0x11')];var _0x5c6329;if(_0x1fda28>=_0x22e136){_0x1fda28=_0x22e136;_0x5c6329=0xc8;}else{_0x5c6329=0xce;}_0x438cee[_0x7a19('0xd')](_0x5c6329);return _0x438cee[_0x7a19('0x12')](_0x7a19('0x13'),_0x85c54c+'-'+_0x1fda28+'/'+_0x22e136)[_0x7a19('0xe')](_0x3adaa8);}return null;};}function saveUpdates(_0xfe8827){return function(_0x1c07fa){if(_0x1c07fa){return _0x1c07fa[_0x7a19('0x14')](_0xfe8827)[_0x7a19('0x15')](function(_0x4bf0ce){return _0x4bf0ce;});}return null;};}function removeEntity(_0x5250fa){return function(_0x520c29){if(_0x520c29){return _0x520c29[_0x7a19('0x16')]()[_0x7a19('0x15')](function(){var _0x42e413=_0x520c29[_0x7a19('0x17')]({'plain':!![]});var _0x56fb61=_0x7a19('0x18');return db[_0x7a19('0x19')][_0x7a19('0x16')]({'where':{'type':_0x56fb61,'resourceId':_0x42e413['id']}})[_0x7a19('0x15')](function(){return _0x520c29;});})[_0x7a19('0x15')](function(){_0x5250fa[_0x7a19('0xd')](0xcc)[_0x7a19('0x1a')]();});}};}function handleEntityNotFound(_0x1a8c19){return function(_0x1ba6a3){if(!_0x1ba6a3){_0x1a8c19[_0x7a19('0xc')](0x194);}return _0x1ba6a3;};}function handleError(_0x206e43,_0x45e78d){_0x45e78d=_0x45e78d||0x1f4;return function(_0x345cdf){logger[_0x7a19('0x1b')](_0x345cdf[_0x7a19('0x1c')]);if(_0x345cdf['name']){delete _0x345cdf[_0x7a19('0x1d')];}_0x206e43[_0x7a19('0xd')](_0x45e78d)[_0x7a19('0x1e')](_0x345cdf);};}exports['index']=function(_0x1b7896,_0x4b86a1){var _0x419e33={};var _0x58b840={'count':0x0,'rows':[]};var _0x1037f8=_[_0x7a19('0x1f')](db['WhatsappQueue'][_0x7a19('0x20')],function(_0x110c2c){return{'name':_0x110c2c['fieldName'],'type':_0x110c2c[_0x7a19('0x21')][_0x7a19('0x22')]};});_0x419e33=qs[_0x7a19('0x23')](_0x1037f8,_0x1b7896);var _0x2f5f94={'where':_0x419e33[_0x7a19('0x24')]};return db['WhatsappQueue'][_0x7a19('0x25')](_0x2f5f94)[_0x7a19('0x15')](function(_0x4f0c9b){_0x58b840[_0x7a19('0x25')]=_0x4f0c9b;_0x419e33[_0x7a19('0x26')]=qs[_0x7a19('0x26')](_0x1b7896['query']);return db[_0x7a19('0x27')]['findAll'](_0x419e33);})[_0x7a19('0x15')](function(_0xcffa0a){_0x58b840['rows']=_0xcffa0a;return _0x58b840;})[_0x7a19('0x15')](respondWithFilteredResult(_0x4b86a1,_0x419e33))[_0x7a19('0x28')](handleError(_0x4b86a1,null));};exports[_0x7a19('0x29')]=function(_0x120957,_0x56b262){var _0x2e10af={'raw':!![],'where':{'id':_0x120957[_0x7a19('0x2a')]['id']}},_0x4021fc={};_0x4021fc[_0x7a19('0x2b')]=_['keys'](db['WhatsappQueue'][_0x7a19('0x20')]);_0x4021fc[_0x7a19('0x2c')]=_[_0x7a19('0x2d')](_0x120957[_0x7a19('0x2c')]);_0x4021fc[_0x7a19('0x2e')]=_[_0x7a19('0x2f')](_0x4021fc[_0x7a19('0x2b')],_0x4021fc[_0x7a19('0x2c')]);_0x2e10af[_0x7a19('0x30')]=_['intersection'](_0x4021fc[_0x7a19('0x2b')],qs[_0x7a19('0x31')](_0x120957[_0x7a19('0x2c')][_0x7a19('0x31')]));_0x2e10af[_0x7a19('0x30')]=_0x2e10af['attributes'][_0x7a19('0x32')]?_0x2e10af[_0x7a19('0x30')]:_0x4021fc[_0x7a19('0x2b')];if(_0x120957[_0x7a19('0x2c')][_0x7a19('0x33')]){_0x2e10af[_0x7a19('0x26')]=[{'all':!![]}];}_0x2e10af=_[_0x7a19('0x34')]({},_0x2e10af,_0x120957[_0x7a19('0x35')]);return db[_0x7a19('0x27')][_0x7a19('0x36')](_0x2e10af)[_0x7a19('0x15')](handleEntityNotFound(_0x56b262,null))[_0x7a19('0x15')](respondWithResult(_0x56b262,null))[_0x7a19('0x28')](handleError(_0x56b262,null));};exports[_0x7a19('0x37')]=function(_0x4f1b20,_0x48256c){return db[_0x7a19('0x27')][_0x7a19('0x37')](_0x4f1b20[_0x7a19('0x38')],{})['then'](function(_0x4d4e19){var _0x360082=_0x4f1b20[_0x7a19('0x39')][_0x7a19('0x17')]({'plain':!![]});if(!_0x360082)throw new Error(_0x7a19('0x3a'));if(_0x360082['role']===_0x7a19('0x39')){var _0x28fbc0=_0x4d4e19[_0x7a19('0x17')]({'plain':!![]});var _0x468611=_0x7a19('0x18');return db[_0x7a19('0x3b')][_0x7a19('0x36')]({'where':{'name':_0x468611,'userProfileId':_0x360082[_0x7a19('0x3c')]},'raw':!![]})[_0x7a19('0x15')](function(_0x41e8cc){if(_0x41e8cc&&_0x41e8cc['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x28fbc0['name'],'resourceId':_0x28fbc0['id'],'type':_0x41e8cc[_0x7a19('0x1d')],'sectionId':_0x41e8cc['id']},{})[_0x7a19('0x15')](function(){return _0x4d4e19;});}else{return _0x4d4e19;}})[_0x7a19('0x28')](function(_0x2da5c2){logger[_0x7a19('0x1b')](_0x7a19('0x3d'),_0x2da5c2);throw _0x2da5c2;});}return _0x4d4e19;})[_0x7a19('0x15')](respondWithResult(_0x48256c,0xc9))[_0x7a19('0x28')](handleError(_0x48256c,null));};exports[_0x7a19('0x14')]=function(_0x5586f3,_0x40217e){if(_0x5586f3[_0x7a19('0x38')]['id']){delete _0x5586f3[_0x7a19('0x38')]['id'];}return db[_0x7a19('0x27')]['find']({'where':{'id':_0x5586f3[_0x7a19('0x2a')]['id']}})['then'](handleEntityNotFound(_0x40217e,null))[_0x7a19('0x15')](saveUpdates(_0x5586f3['body'],null))['then'](respondWithResult(_0x40217e,null))[_0x7a19('0x28')](handleError(_0x40217e,null));};exports[_0x7a19('0x16')]=function(_0x93de4e,_0xb7786e){return db[_0x7a19('0x27')][_0x7a19('0x36')]({'where':{'id':_0x93de4e['params']['id']}})[_0x7a19('0x15')](handleEntityNotFound(_0xb7786e,null))['then'](removeEntity(_0xb7786e,null))['catch'](handleError(_0xb7786e,null));};exports[_0x7a19('0x3e')]=function(_0x1065ac,_0x34cd21){return db['WhatsappQueue'][_0x7a19('0x3e')]()['then'](respondWithResult(_0x34cd21,null))[_0x7a19('0x28')](handleError(_0x34cd21,null));};exports[_0x7a19('0x3f')]=function(_0x4289b3,_0x1beafc){var _0x382757={'raw':!![],'where':{}},_0xb0edb3={},_0x13d664;return db[_0x7a19('0x27')][_0x7a19('0x40')]({'where':{'id':_0x4289b3['params']['id']}})['then'](handleEntityNotFound(_0x1beafc,null))[_0x7a19('0x15')](function(_0xf01be6){if(_0xf01be6){_0x13d664=_0xf01be6['get']({'plain':!![]});_0xb0edb3[_0x7a19('0x2b')]=_['keys'](db['UserWhatsappQueue'][_0x7a19('0x20')]);_0xb0edb3[_0x7a19('0x2c')]=_['keys'](_0x4289b3[_0x7a19('0x2c')]);_0xb0edb3['filters']=_[_0x7a19('0x2f')](_0xb0edb3[_0x7a19('0x2b')],_0xb0edb3[_0x7a19('0x2c')]);_0x382757[_0x7a19('0x30')]=_['intersection'](_0xb0edb3['model'],qs[_0x7a19('0x31')](_0x4289b3[_0x7a19('0x2c')][_0x7a19('0x31')]));_0x382757[_0x7a19('0x30')]=_0x382757[_0x7a19('0x30')][_0x7a19('0x32')]?_0x382757['attributes']:_0xb0edb3[_0x7a19('0x2b')];if(!_0x4289b3[_0x7a19('0x2c')][_0x7a19('0x41')]('nolimit')){_0x382757[_0x7a19('0x11')]=qs[_0x7a19('0x11')](_0x4289b3[_0x7a19('0x2c')][_0x7a19('0x11')]);_0x382757[_0x7a19('0xf')]=qs[_0x7a19('0xf')](_0x4289b3[_0x7a19('0x2c')][_0x7a19('0xf')]);}_0x382757[_0x7a19('0x42')]=qs['sort'](_0x4289b3[_0x7a19('0x2c')]['sort']);_0x382757[_0x7a19('0x24')]=qs[_0x7a19('0x2e')](_[_0x7a19('0x43')](_0x4289b3['query'],_0xb0edb3[_0x7a19('0x2e')]));_0x382757['where'][_0x7a19('0x44')]=_0xf01be6['id'];if(_0x4289b3[_0x7a19('0x2c')][_0x7a19('0x45')]){_0x382757['where']=_[_0x7a19('0x34')](_0x382757[_0x7a19('0x24')],{'$or':_[_0x7a19('0x1f')](_0x382757['attributes'],function(_0x47ab93){var _0x5d6c7d={};_0x5d6c7d[_0x47ab93]={'$like':'%'+_0x4289b3[_0x7a19('0x2c')][_0x7a19('0x45')]+'%'};return _0x5d6c7d;})});}_0x382757=_[_0x7a19('0x34')]({},_0x382757,_0x4289b3['options']);return db[_0x7a19('0x46')][_0x7a19('0x47')](_0x382757);}})[_0x7a19('0x15')](function(_0x7f017f){if(_0x7f017f){return db[_0x7a19('0x48')][_0x7a19('0x49')]({'where':{'id':_['map'](_0x7f017f,_0x7a19('0x4a')),'role':_0x7a19('0x4b')},'attributes':['id',_0x7a19('0x1d'),'whatsappPause',_0x7a19('0x4c'),_0x7a19('0x4d')]});}})['then'](function(_0xf24db2){if(_0xf24db2){return{'count':_0xf24db2['count'],'rows':_['map'](_0xf24db2[_0x7a19('0x4e')],function(_0x44797a){return{'membername':_0x44797a[_0x7a19('0x1d')],'UserId':_0x44797a['id'],'queue_name':_0x13d664['name'],'WhatsappQueueId':_0x13d664['id'],'interface':util[_0x7a19('0x4f')](_0x7a19('0x50'),_0x7a19('0x51'),_0x44797a[_0x7a19('0x1d')]),'penalty':0x0,'paused':_0x44797a[_0x7a19('0x52')],'createdAt':_0x44797a[_0x7a19('0x4d')],'updatedAt':_0x44797a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7a19('0x15')](respondWithFilteredResult(_0x1beafc,_0x382757))[_0x7a19('0x28')](handleError(_0x1beafc,null));};exports['getTeams']=function(_0x255461,_0x1f4b80){var _0x1e963f={};var _0x101478={};var _0x493562;var _0x19f065;return db[_0x7a19('0x27')][_0x7a19('0x40')]({'where':{'id':_0x255461[_0x7a19('0x2a')]['id']}})[_0x7a19('0x15')](handleEntityNotFound(_0x1f4b80,null))[_0x7a19('0x15')](function(_0x318531){if(_0x318531){_0x493562=_0x318531;_0x101478[_0x7a19('0x2b')]=_[_0x7a19('0x2d')](db[_0x7a19('0x53')][_0x7a19('0x20')]);_0x101478['query']=_[_0x7a19('0x2d')](_0x255461[_0x7a19('0x2c')]);_0x101478[_0x7a19('0x2e')]=_[_0x7a19('0x2f')](_0x101478['model'],_0x101478[_0x7a19('0x2c')]);_0x1e963f[_0x7a19('0x30')]=_['intersection'](_0x101478[_0x7a19('0x2b')],qs[_0x7a19('0x31')](_0x255461['query'][_0x7a19('0x31')]));_0x1e963f[_0x7a19('0x30')]=_0x1e963f['attributes'][_0x7a19('0x32')]?_0x1e963f[_0x7a19('0x30')]:_0x101478[_0x7a19('0x2b')];_0x1e963f[_0x7a19('0x42')]=qs[_0x7a19('0x54')](_0x255461[_0x7a19('0x2c')]['sort']);_0x1e963f[_0x7a19('0x24')]=qs[_0x7a19('0x2e')](_['pick'](_0x255461[_0x7a19('0x2c')],_0x101478[_0x7a19('0x2e')]));if(_0x255461[_0x7a19('0x2c')]['filter']){_0x1e963f[_0x7a19('0x24')]=_[_0x7a19('0x34')](_0x1e963f[_0x7a19('0x24')],{'$or':_[_0x7a19('0x1f')](_0x1e963f[_0x7a19('0x30')],function(_0x338211){var _0x3da3a2={};_0x3da3a2[_0x338211]={'$like':'%'+_0x255461[_0x7a19('0x2c')][_0x7a19('0x45')]+'%'};return _0x3da3a2;})});}_0x1e963f=_['merge']({},_0x1e963f,_0x255461[_0x7a19('0x35')]);return _0x493562['getTeams'](_0x1e963f);}})['then'](function(_0x624040){if(_0x624040){_0x19f065=_0x624040[_0x7a19('0x32')];if(!_0x255461[_0x7a19('0x2c')]['hasOwnProperty'](_0x7a19('0x55'))){_0x1e963f[_0x7a19('0x11')]=qs['limit'](_0x255461['query'][_0x7a19('0x11')]);_0x1e963f[_0x7a19('0xf')]=qs[_0x7a19('0xf')](_0x255461[_0x7a19('0x2c')]['offset']);}return _0x493562[_0x7a19('0x56')](_0x1e963f);}})[_0x7a19('0x15')](function(_0x420257){if(_0x420257){return _0x420257?{'count':_0x19f065,'rows':_0x420257}:null;}})['then'](respondWithResult(_0x1f4b80,null))[_0x7a19('0x28')](handleError(_0x1f4b80,null));};exports[_0x7a19('0x57')]=function(_0x83d0f1,_0x42ea2e){var _0x4cb76d=_0x83d0f1[_0x7a19('0x38')][_0x7a19('0x58')];return db[_0x7a19('0x53')][_0x7a19('0x47')]({'where':{'id':_0x4cb76d},'attributes':['id'],'include':[{'model':db[_0x7a19('0x48')],'as':_0x7a19('0x59'),'attributes':['id',_0x7a19('0x1d'),_0x7a19('0x5a'),_0x7a19('0x5b'),_0x7a19('0x5c')],'raw':!![]}]})[_0x7a19('0x15')](function(_0x321c08){if(_0x321c08){var _0x45a280=_['flatMap'](_0x321c08,function(_0x18589c){var _0x53e334=_0x18589c['get']({'plain':!![]});return _0x53e334['Agents'];});return db['WhatsappQueue'][_0x7a19('0x36')]({'where':{'id':_0x83d0f1[_0x7a19('0x2a')]['id']}})['then'](function(_0x1cf2a2){return db[_0x7a19('0x5d')][_0x7a19('0x5e')](function(_0x53a337){return _0x1cf2a2[_0x7a19('0x57')](_0x4cb76d,{'transaction':_0x53a337})[_0x7a19('0x15')](function(){return BPromise[_0x7a19('0x5f')](_0x45a280,function(_0x712930){return db['UserWhatsappQueue'][_0x7a19('0x60')]({'where':{'UserId':_0x712930['id'],'WhatsappQueueId':_0x83d0f1['params']['id']},'transaction':_0x53a337});});})[_0x7a19('0x15')](function(){_0x45a280[_0x7a19('0x61')](function(_0x1d37e9){socket['emit'](_0x7a19('0x62'),{'UserId':_0x1d37e9['id'],'WhatsappQueueId':_0x1cf2a2['id']});});});});});}})[_0x7a19('0x15')](respondWithStatusCode(_0x42ea2e,null))[_0x7a19('0x28')](handleError(_0x42ea2e,null));};exports[_0x7a19('0x63')]=function(_0x1b240d,_0x4a782a){return db[_0x7a19('0x53')][_0x7a19('0x47')]({'where':{'id':_0x1b240d['query'][_0x7a19('0x58')]},'attributes':['id'],'include':[{'model':db[_0x7a19('0x48')],'as':_0x7a19('0x59'),'attributes':['id'],'raw':!![]}]})[_0x7a19('0x15')](handleEntityNotFound(_0x4a782a,null))[_0x7a19('0x15')](function(_0x15d0ce){var _0x66c80e=_[_0x7a19('0x1f')](_0x15d0ce,'id');var _0x398c64=[];var _0x423224=[];var _0x2c7172=squel[_0x7a19('0x64')]();_0x2c7172[_0x7a19('0x65')]('tq.TeamId')[_0x7a19('0x66')](_0x7a19('0x67'),'tq')['join']('user_has_teams','ut',_0x7a19('0x68'))['where'](_0x7a19('0x69'),_0x1b240d['params']['id']);for(var _0x533706=0x0;_0x533706<_0x15d0ce[_0x7a19('0x32')];_0x533706+=0x1){let _0x5ca6a3=_0x15d0ce[_0x533706];for(var _0x1f3961=0x0;_0x1f3961<_0x5ca6a3[_0x7a19('0x59')][_0x7a19('0x32')];_0x1f3961+=0x1){let _0x44a200=_0x5ca6a3['Agents'][_0x1f3961];var _0x56c3a3=_0x2c7172[_0x7a19('0x6a')]();_0x56c3a3['where'](_0x7a19('0x6b'),_0x44a200['id']);_0x423224[_0x7a19('0x6c')](db[_0x7a19('0x5d')][_0x7a19('0x2c')](_0x56c3a3['toString'](),{'type':db['sequelize']['QueryTypes'][_0x7a19('0x6d')]})[_0x7a19('0x15')](function(_0x1c058c){if(_0x1c058c[_0x7a19('0x32')]===0x1){return _0x44a200['id'];}else{var _0x1d241a=_[_0x7a19('0x6e')](_[_0x7a19('0x1f')](_0x1c058c,_0x7a19('0x6f')),function(_0xde064e){return _['includes'](_0x66c80e,_0xde064e);});if(_0x1d241a){return _0x44a200['id'];}}}));}}return BPromise['all'](_0x423224)[_0x7a19('0x15')](function(_0x2d70cd){_0x398c64=_(_0x398c64)[_0x7a19('0x70')](_0x2d70cd)[_0x7a19('0x71')]()[_0x7a19('0x72')]();return db[_0x7a19('0x27')][_0x7a19('0x36')]({'where':{'id':_0x1b240d[_0x7a19('0x2a')]['id']}})['then'](function(_0x47e24c){return db[_0x7a19('0x5d')][_0x7a19('0x5e')](function(_0xb36a55){return _0x47e24c['removeTeams'](_0x1b240d['query']['ids'],{'transaction':_0xb36a55})['then'](function(){if(!_[_0x7a19('0x73')](_0x398c64)){return _0x47e24c[_0x7a19('0x74')](_0x398c64,{'transaction':_0xb36a55});}})[_0x7a19('0x15')](function(){_0x398c64[_0x7a19('0x61')](function(_0x28d094){socket['emit'](_0x7a19('0x75'),{'UserId':_0x28d094,'WhatsappQueueId':_0x47e24c['id']});});});});});});})[_0x7a19('0x15')](respondWithStatusCode(_0x4a782a,null))[_0x7a19('0x28')](handleError(_0x4a782a,null));};exports[_0x7a19('0x76')]=function(_0xe85a5b,_0x22be46){return db[_0x7a19('0x27')][_0x7a19('0x36')]({'where':{'id':_0xe85a5b[_0x7a19('0x2a')]['id']}})[_0x7a19('0x15')](handleEntityNotFound(_0x22be46,null))[_0x7a19('0x15')](function(_0x40c811){if(_0x40c811){return _0x40c811[_0x7a19('0x76')](_0xe85a5b['body']['ids'],_['omit'](_0xe85a5b[_0x7a19('0x38')],[_0x7a19('0x58'),'id'])||{})[_0x7a19('0x77')](function(_0x52ea35){for(var _0x17d09b=0x0;_0x17d09b<_0xe85a5b['body'][_0x7a19('0x58')]['length'];_0x17d09b+=0x1){socket[_0x7a19('0x78')](_0x7a19('0x62'),{'UserId':Number(_0xe85a5b[_0x7a19('0x38')][_0x7a19('0x58')][_0x17d09b]),'WhatsappQueueId':Number(_0xe85a5b[_0x7a19('0x2a')]['id'])});}return _0x52ea35;});}})['then'](respondWithResult(_0x22be46,null))['catch'](handleError(_0x22be46,null));};exports[_0x7a19('0x74')]=function(_0x4339ec,_0x15bc09){return db[_0x7a19('0x27')][_0x7a19('0x36')]({'where':{'id':_0x4339ec['params']['id']}})[_0x7a19('0x15')](handleEntityNotFound(_0x15bc09,null))[_0x7a19('0x15')](function(_0x58de18){if(_0x58de18){return _0x58de18[_0x7a19('0x74')](_0x4339ec[_0x7a19('0x2c')][_0x7a19('0x58')])['then'](function(){if(_[_0x7a19('0x79')](_0x4339ec[_0x7a19('0x2c')][_0x7a19('0x58')])){for(var _0x39b09e=0x0;_0x39b09e<_0x4339ec[_0x7a19('0x2c')][_0x7a19('0x58')][_0x7a19('0x32')];_0x39b09e+=0x1){socket[_0x7a19('0x78')]('userWhatsappQueue:remove',{'UserId':Number(_0x4339ec[_0x7a19('0x2c')]['ids'][_0x39b09e]),'WhatsappQueueId':Number(_0x4339ec['params']['id'])});}}else{socket['emit'](_0x7a19('0x75'),{'UserId':Number(_0x4339ec['query'][_0x7a19('0x58')]),'WhatsappQueueId':Number(_0x4339ec[_0x7a19('0x2a')]['id'])});}});}})[_0x7a19('0x15')](respondWithStatusCode(_0x15bc09,null))[_0x7a19('0x28')](handleError(_0x15bc09,null));};exports[_0x7a19('0x7a')]=function(_0x416591,_0x53f860){var _0x4da407={};var _0x4e2b74={};var _0x4d92d2;var _0x35a9d9;return db['WhatsappQueue']['findOne']({'where':{'id':_0x416591[_0x7a19('0x2a')]['id']}})[_0x7a19('0x15')](handleEntityNotFound(_0x53f860,null))[_0x7a19('0x15')](function(_0x2e9dae){if(_0x2e9dae){_0x4d92d2=_0x2e9dae;_0x4e2b74[_0x7a19('0x2b')]=_['keys'](db[_0x7a19('0x48')][_0x7a19('0x20')]);_0x4e2b74[_0x7a19('0x2c')]=_['keys'](_0x416591['query']);_0x4e2b74['filters']=_[_0x7a19('0x2f')](_0x4e2b74[_0x7a19('0x2b')],_0x4e2b74['query']);_0x4da407[_0x7a19('0x30')]=_[_0x7a19('0x2f')](_0x4e2b74[_0x7a19('0x2b')],qs['fields'](_0x416591[_0x7a19('0x2c')][_0x7a19('0x31')]));_0x4da407[_0x7a19('0x30')]=_0x4da407[_0x7a19('0x30')]['length']?_0x4da407['attributes']:_0x4e2b74['model'];_0x4da407['order']=qs[_0x7a19('0x54')](_0x416591[_0x7a19('0x2c')]['sort']);_0x4da407[_0x7a19('0x24')]=qs[_0x7a19('0x2e')](_[_0x7a19('0x43')](_0x416591['query'],_0x4e2b74[_0x7a19('0x2e')]));if(_0x416591[_0x7a19('0x2c')][_0x7a19('0x45')]){_0x4da407[_0x7a19('0x24')]=_[_0x7a19('0x34')](_0x4da407[_0x7a19('0x24')],{'$or':_['map'](_0x4da407[_0x7a19('0x30')],function(_0x2a7f22){var _0x2d5f71={};_0x2d5f71[_0x2a7f22]={'$like':'%'+_0x416591[_0x7a19('0x2c')][_0x7a19('0x45')]+'%'};return _0x2d5f71;})});}_0x4da407=_['merge']({},_0x4da407,_0x416591[_0x7a19('0x35')]);return _0x4d92d2[_0x7a19('0x7a')](_0x4da407);}})['then'](function(_0x581725){if(_0x581725){_0x35a9d9=_0x581725[_0x7a19('0x32')];if(!_0x416591[_0x7a19('0x2c')][_0x7a19('0x41')](_0x7a19('0x55'))){_0x4da407[_0x7a19('0x11')]=qs['limit'](_0x416591['query'][_0x7a19('0x11')]);_0x4da407['offset']=qs[_0x7a19('0xf')](_0x416591[_0x7a19('0x2c')][_0x7a19('0xf')]);}return _0x4d92d2[_0x7a19('0x7a')](_0x4da407);}})[_0x7a19('0x15')](function(_0x2e2ccf){if(_0x2e2ccf){return _0x2e2ccf?{'count':_0x35a9d9,'rows':_0x2e2ccf}:null;}})[_0x7a19('0x15')](respondWithResult(_0x53f860,null))['catch'](handleError(_0x53f860,null));}; \ No newline at end of file +var _0x9f50=['describe','findOne','UserWhatsappQueue','length','nolimit','order','sort','pick','filter','merge','map','User','agent','updatedAt','createdAt','SIP','whatsappPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','util','lodash','squel','ioredis','../../config/logger','api','../../mysqldb','defaults','redis','localhost','./whatsappQueue.socket','register','sendStatus','status','end','undefined','limit','count','offset','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','index','WhatsappQueue','fieldName','type','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','rawAttributes','filters','intersection','fields','attributes','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId'];(function(_0x17b2c4,_0x566d41){var _0x493031=function(_0x55aa70){while(--_0x55aa70){_0x17b2c4['push'](_0x17b2c4['shift']());}};_0x493031(++_0x566d41);}(_0x9f50,0xb3));var _0x09f5=function(_0x2211ed,_0x1bca0b){_0x2211ed=_0x2211ed-0x0;var _0x4d78cc=_0x9f50[_0x2211ed];return _0x4d78cc;};'use strict';var BPromise=require('bluebird');var util=require(_0x09f5('0x0'));var _=require(_0x09f5('0x1'));var squel=require(_0x09f5('0x2'));var Redis=require(_0x09f5('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x09f5('0x4'))(_0x09f5('0x5'));var config=require('../../config/environment');var db=require(_0x09f5('0x6'))['db'];config['redis']=_[_0x09f5('0x7')](config[_0x09f5('0x8')],{'host':_0x09f5('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x09f5('0x8')]));require(_0x09f5('0xa'))[_0x09f5('0xb')](socket);function respondWithStatusCode(_0x555009,_0x57a24c){_0x57a24c=_0x57a24c||0xcc;return function(_0x36fa6a){if(_0x36fa6a){return _0x555009[_0x09f5('0xc')](_0x57a24c);}return _0x555009[_0x09f5('0xd')](_0x57a24c)[_0x09f5('0xe')]();};}function respondWithResult(_0x4df573,_0x1cd687){_0x1cd687=_0x1cd687||0xc8;return function(_0x460db5){if(_0x460db5){return _0x4df573['status'](_0x1cd687)['json'](_0x460db5);}};}function respondWithFilteredResult(_0x3c0b10,_0x157eb6){return function(_0x151a0b){if(_0x151a0b){var _0x698c54=typeof _0x157eb6['offset']===_0x09f5('0xf')&&typeof _0x157eb6[_0x09f5('0x10')]===_0x09f5('0xf');var _0x2ca87b=_0x151a0b[_0x09f5('0x11')];var _0x207166=_0x698c54?0x0:_0x157eb6[_0x09f5('0x12')];var _0x49ed2f=_0x698c54?_0x151a0b[_0x09f5('0x11')]:_0x157eb6['offset']+_0x157eb6[_0x09f5('0x10')];var _0x3a83a1;if(_0x49ed2f>=_0x2ca87b){_0x49ed2f=_0x2ca87b;_0x3a83a1=0xc8;}else{_0x3a83a1=0xce;}_0x3c0b10[_0x09f5('0xd')](_0x3a83a1);return _0x3c0b10['set'](_0x09f5('0x13'),_0x207166+'-'+_0x49ed2f+'/'+_0x2ca87b)['json'](_0x151a0b);}return null;};}function saveUpdates(_0xa5a06b){return function(_0x4570a3){if(_0x4570a3){return _0x4570a3[_0x09f5('0x14')](_0xa5a06b)[_0x09f5('0x15')](function(_0xbff25c){return _0xbff25c;});}return null;};}function removeEntity(_0x25c3c0){return function(_0x252871){if(_0x252871){return _0x252871[_0x09f5('0x16')]()[_0x09f5('0x15')](function(){var _0x2dba7f=_0x252871[_0x09f5('0x17')]({'plain':!![]});var _0xbda0a3=_0x09f5('0x18');return db[_0x09f5('0x19')][_0x09f5('0x16')]({'where':{'type':_0xbda0a3,'resourceId':_0x2dba7f['id']}})[_0x09f5('0x15')](function(){return _0x252871;});})['then'](function(){_0x25c3c0[_0x09f5('0xd')](0xcc)[_0x09f5('0xe')]();});}};}function handleEntityNotFound(_0x3d2687){return function(_0x37346d){if(!_0x37346d){_0x3d2687[_0x09f5('0xc')](0x194);}return _0x37346d;};}function handleError(_0x4478ec,_0x5a545d){_0x5a545d=_0x5a545d||0x1f4;return function(_0x47305c){logger[_0x09f5('0x1a')](_0x47305c[_0x09f5('0x1b')]);if(_0x47305c[_0x09f5('0x1c')]){delete _0x47305c[_0x09f5('0x1c')];}_0x4478ec[_0x09f5('0xd')](_0x5a545d)['send'](_0x47305c);};}exports[_0x09f5('0x1d')]=function(_0x359a0b,_0x57efb2){var _0x3e842d={};var _0x2685f5={'count':0x0,'rows':[]};var _0x41cf5c=_['map'](db[_0x09f5('0x1e')]['rawAttributes'],function(_0x19833f){return{'name':_0x19833f[_0x09f5('0x1f')],'type':_0x19833f[_0x09f5('0x20')]['key']};});_0x3e842d=qs[_0x09f5('0x21')](_0x41cf5c,_0x359a0b);var _0x1352d7={'where':_0x3e842d[_0x09f5('0x22')]};return db['WhatsappQueue'][_0x09f5('0x11')](_0x1352d7)[_0x09f5('0x15')](function(_0x52baf7){_0x2685f5[_0x09f5('0x11')]=_0x52baf7;_0x3e842d[_0x09f5('0x23')]=qs[_0x09f5('0x23')](_0x359a0b[_0x09f5('0x24')]);return db['WhatsappQueue'][_0x09f5('0x25')](_0x3e842d);})['then'](function(_0x516427){_0x2685f5[_0x09f5('0x26')]=_0x516427;return _0x2685f5;})[_0x09f5('0x15')](respondWithFilteredResult(_0x57efb2,_0x3e842d))[_0x09f5('0x27')](handleError(_0x57efb2,null));};exports[_0x09f5('0x28')]=function(_0x33a4fd,_0x506b68){var _0x1cb4d7={'raw':!![],'where':{'id':_0x33a4fd[_0x09f5('0x29')]['id']}},_0x5c5318={};_0x5c5318[_0x09f5('0x2a')]=_[_0x09f5('0x2b')](db[_0x09f5('0x1e')][_0x09f5('0x2c')]);_0x5c5318[_0x09f5('0x24')]=_[_0x09f5('0x2b')](_0x33a4fd['query']);_0x5c5318[_0x09f5('0x2d')]=_[_0x09f5('0x2e')](_0x5c5318[_0x09f5('0x2a')],_0x5c5318[_0x09f5('0x24')]);_0x1cb4d7['attributes']=_[_0x09f5('0x2e')](_0x5c5318['model'],qs[_0x09f5('0x2f')](_0x33a4fd['query'][_0x09f5('0x2f')]));_0x1cb4d7['attributes']=_0x1cb4d7[_0x09f5('0x30')]['length']?_0x1cb4d7[_0x09f5('0x30')]:_0x5c5318[_0x09f5('0x2a')];if(_0x33a4fd[_0x09f5('0x24')][_0x09f5('0x31')]){_0x1cb4d7[_0x09f5('0x23')]=[{'all':!![]}];}_0x1cb4d7=_['merge']({},_0x1cb4d7,_0x33a4fd[_0x09f5('0x32')]);return db[_0x09f5('0x1e')][_0x09f5('0x33')](_0x1cb4d7)[_0x09f5('0x15')](handleEntityNotFound(_0x506b68,null))[_0x09f5('0x15')](respondWithResult(_0x506b68,null))[_0x09f5('0x27')](handleError(_0x506b68,null));};exports['create']=function(_0x18a9a2,_0x15b5de){return db[_0x09f5('0x1e')][_0x09f5('0x34')](_0x18a9a2[_0x09f5('0x35')],{})[_0x09f5('0x15')](function(_0x5e1df8){var _0x59c6a2=_0x18a9a2['user']['get']({'plain':!![]});if(!_0x59c6a2)throw new Error(_0x09f5('0x36'));if(_0x59c6a2[_0x09f5('0x37')]===_0x09f5('0x38')){var _0x5a4e0b=_0x5e1df8[_0x09f5('0x17')]({'plain':!![]});var _0x1c7963=_0x09f5('0x18');return db[_0x09f5('0x39')][_0x09f5('0x33')]({'where':{'name':_0x1c7963,'userProfileId':_0x59c6a2[_0x09f5('0x3a')]},'raw':!![]})[_0x09f5('0x15')](function(_0x1a581c){if(_0x1a581c&&_0x1a581c['autoAssociation']===0x0){return db[_0x09f5('0x19')][_0x09f5('0x34')]({'name':_0x5a4e0b[_0x09f5('0x1c')],'resourceId':_0x5a4e0b['id'],'type':_0x1a581c[_0x09f5('0x1c')],'sectionId':_0x1a581c['id']},{})[_0x09f5('0x15')](function(){return _0x5e1df8;});}else{return _0x5e1df8;}})[_0x09f5('0x27')](function(_0x501373){logger[_0x09f5('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x501373);throw _0x501373;});}return _0x5e1df8;})[_0x09f5('0x15')](respondWithResult(_0x15b5de,0xc9))[_0x09f5('0x27')](handleError(_0x15b5de,null));};exports['update']=function(_0x322907,_0x1d126c){if(_0x322907['body']['id']){delete _0x322907[_0x09f5('0x35')]['id'];}return db['WhatsappQueue'][_0x09f5('0x33')]({'where':{'id':_0x322907[_0x09f5('0x29')]['id']}})[_0x09f5('0x15')](handleEntityNotFound(_0x1d126c,null))[_0x09f5('0x15')](saveUpdates(_0x322907[_0x09f5('0x35')],null))[_0x09f5('0x15')](respondWithResult(_0x1d126c,null))[_0x09f5('0x27')](handleError(_0x1d126c,null));};exports[_0x09f5('0x16')]=function(_0x4562a5,_0x5dfcf5){return db[_0x09f5('0x1e')][_0x09f5('0x33')]({'where':{'id':_0x4562a5[_0x09f5('0x29')]['id']}})[_0x09f5('0x15')](handleEntityNotFound(_0x5dfcf5,null))[_0x09f5('0x15')](removeEntity(_0x5dfcf5,null))[_0x09f5('0x27')](handleError(_0x5dfcf5,null));};exports['describe']=function(_0x3d69b1,_0x273648){return db[_0x09f5('0x1e')][_0x09f5('0x3b')]()[_0x09f5('0x15')](respondWithResult(_0x273648,null))[_0x09f5('0x27')](handleError(_0x273648,null));};exports['getMembers']=function(_0x199a37,_0x2f07c6){var _0x1413fa={'raw':!![],'where':{}},_0x3b780a={},_0x4ed0f7;return db['WhatsappQueue'][_0x09f5('0x3c')]({'where':{'id':_0x199a37[_0x09f5('0x29')]['id']}})['then'](handleEntityNotFound(_0x2f07c6,null))[_0x09f5('0x15')](function(_0x5b7caf){if(_0x5b7caf){_0x4ed0f7=_0x5b7caf[_0x09f5('0x17')]({'plain':!![]});_0x3b780a[_0x09f5('0x2a')]=_[_0x09f5('0x2b')](db[_0x09f5('0x3d')]['rawAttributes']);_0x3b780a[_0x09f5('0x24')]=_[_0x09f5('0x2b')](_0x199a37['query']);_0x3b780a['filters']=_['intersection'](_0x3b780a[_0x09f5('0x2a')],_0x3b780a['query']);_0x1413fa[_0x09f5('0x30')]=_[_0x09f5('0x2e')](_0x3b780a[_0x09f5('0x2a')],qs[_0x09f5('0x2f')](_0x199a37[_0x09f5('0x24')][_0x09f5('0x2f')]));_0x1413fa['attributes']=_0x1413fa[_0x09f5('0x30')][_0x09f5('0x3e')]?_0x1413fa[_0x09f5('0x30')]:_0x3b780a[_0x09f5('0x2a')];if(!_0x199a37[_0x09f5('0x24')]['hasOwnProperty'](_0x09f5('0x3f'))){_0x1413fa[_0x09f5('0x10')]=qs[_0x09f5('0x10')](_0x199a37[_0x09f5('0x24')][_0x09f5('0x10')]);_0x1413fa[_0x09f5('0x12')]=qs[_0x09f5('0x12')](_0x199a37['query'][_0x09f5('0x12')]);}_0x1413fa[_0x09f5('0x40')]=qs[_0x09f5('0x41')](_0x199a37[_0x09f5('0x24')][_0x09f5('0x41')]);_0x1413fa['where']=qs['filters'](_[_0x09f5('0x42')](_0x199a37[_0x09f5('0x24')],_0x3b780a['filters']));_0x1413fa['where']['WhatsappQueueId']=_0x5b7caf['id'];if(_0x199a37[_0x09f5('0x24')][_0x09f5('0x43')]){_0x1413fa[_0x09f5('0x22')]=_[_0x09f5('0x44')](_0x1413fa[_0x09f5('0x22')],{'$or':_[_0x09f5('0x45')](_0x1413fa['attributes'],function(_0x2129a9){var _0x30e021={};_0x30e021[_0x2129a9]={'$like':'%'+_0x199a37[_0x09f5('0x24')][_0x09f5('0x43')]+'%'};return _0x30e021;})});}_0x1413fa=_[_0x09f5('0x44')]({},_0x1413fa,_0x199a37['options']);return db[_0x09f5('0x3d')]['findAll'](_0x1413fa);}})['then'](function(_0x250b06){if(_0x250b06){return db[_0x09f5('0x46')]['findAndCountAll']({'where':{'id':_[_0x09f5('0x45')](_0x250b06,'UserId'),'role':_0x09f5('0x47')},'attributes':['id',_0x09f5('0x1c'),'whatsappPause',_0x09f5('0x48'),_0x09f5('0x49')]});}})[_0x09f5('0x15')](function(_0x2f78ef){if(_0x2f78ef){return{'count':_0x2f78ef['count'],'rows':_[_0x09f5('0x45')](_0x2f78ef[_0x09f5('0x26')],function(_0x1a61a8){return{'membername':_0x1a61a8[_0x09f5('0x1c')],'UserId':_0x1a61a8['id'],'queue_name':_0x4ed0f7[_0x09f5('0x1c')],'WhatsappQueueId':_0x4ed0f7['id'],'interface':util['format']('%s/%s',_0x09f5('0x4a'),_0x1a61a8[_0x09f5('0x1c')]),'penalty':0x0,'paused':_0x1a61a8[_0x09f5('0x4b')],'createdAt':_0x1a61a8[_0x09f5('0x49')],'updatedAt':_0x1a61a8['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x09f5('0x15')](respondWithFilteredResult(_0x2f07c6,_0x1413fa))[_0x09f5('0x27')](handleError(_0x2f07c6,null));};exports[_0x09f5('0x4c')]=function(_0x44913c,_0x3e3315){var _0x3d56dd={};var _0x1a5bc3={};var _0x519621;var _0xdd3bd9;return db[_0x09f5('0x1e')][_0x09f5('0x3c')]({'where':{'id':_0x44913c[_0x09f5('0x29')]['id']}})[_0x09f5('0x15')](handleEntityNotFound(_0x3e3315,null))[_0x09f5('0x15')](function(_0xf69c61){if(_0xf69c61){_0x519621=_0xf69c61;_0x1a5bc3[_0x09f5('0x2a')]=_['keys'](db[_0x09f5('0x4d')]['rawAttributes']);_0x1a5bc3[_0x09f5('0x24')]=_['keys'](_0x44913c[_0x09f5('0x24')]);_0x1a5bc3['filters']=_[_0x09f5('0x2e')](_0x1a5bc3[_0x09f5('0x2a')],_0x1a5bc3[_0x09f5('0x24')]);_0x3d56dd[_0x09f5('0x30')]=_[_0x09f5('0x2e')](_0x1a5bc3['model'],qs['fields'](_0x44913c[_0x09f5('0x24')][_0x09f5('0x2f')]));_0x3d56dd[_0x09f5('0x30')]=_0x3d56dd[_0x09f5('0x30')]['length']?_0x3d56dd[_0x09f5('0x30')]:_0x1a5bc3[_0x09f5('0x2a')];_0x3d56dd[_0x09f5('0x40')]=qs[_0x09f5('0x41')](_0x44913c[_0x09f5('0x24')][_0x09f5('0x41')]);_0x3d56dd[_0x09f5('0x22')]=qs[_0x09f5('0x2d')](_['pick'](_0x44913c[_0x09f5('0x24')],_0x1a5bc3[_0x09f5('0x2d')]));if(_0x44913c[_0x09f5('0x24')][_0x09f5('0x43')]){_0x3d56dd[_0x09f5('0x22')]=_[_0x09f5('0x44')](_0x3d56dd[_0x09f5('0x22')],{'$or':_[_0x09f5('0x45')](_0x3d56dd['attributes'],function(_0x3b3a3c){var _0x44f900={};_0x44f900[_0x3b3a3c]={'$like':'%'+_0x44913c[_0x09f5('0x24')][_0x09f5('0x43')]+'%'};return _0x44f900;})});}_0x3d56dd=_[_0x09f5('0x44')]({},_0x3d56dd,_0x44913c[_0x09f5('0x32')]);return _0x519621['getTeams'](_0x3d56dd);}})[_0x09f5('0x15')](function(_0x55581d){if(_0x55581d){_0xdd3bd9=_0x55581d[_0x09f5('0x3e')];if(!_0x44913c['query']['hasOwnProperty'](_0x09f5('0x3f'))){_0x3d56dd['limit']=qs['limit'](_0x44913c[_0x09f5('0x24')][_0x09f5('0x10')]);_0x3d56dd[_0x09f5('0x12')]=qs[_0x09f5('0x12')](_0x44913c[_0x09f5('0x24')][_0x09f5('0x12')]);}return _0x519621['getTeams'](_0x3d56dd);}})[_0x09f5('0x15')](function(_0x255880){if(_0x255880){return _0x255880?{'count':_0xdd3bd9,'rows':_0x255880}:null;}})['then'](respondWithResult(_0x3e3315,null))[_0x09f5('0x27')](handleError(_0x3e3315,null));};exports[_0x09f5('0x4e')]=function(_0x3a0ebb,_0x4f075f){var _0x2b6e0e=_0x3a0ebb[_0x09f5('0x35')][_0x09f5('0x4f')];return db[_0x09f5('0x4d')][_0x09f5('0x25')]({'where':{'id':_0x2b6e0e},'attributes':['id'],'include':[{'model':db[_0x09f5('0x46')],'as':_0x09f5('0x50'),'attributes':['id',_0x09f5('0x1c'),_0x09f5('0x51'),_0x09f5('0x52'),_0x09f5('0x53')],'raw':!![]}]})[_0x09f5('0x15')](function(_0xf624d5){if(_0xf624d5){var _0x70cf09=_['flatMap'](_0xf624d5,function(_0x4008bb){var _0x75c2c3=_0x4008bb[_0x09f5('0x17')]({'plain':!![]});return _0x75c2c3[_0x09f5('0x50')];});return db['WhatsappQueue'][_0x09f5('0x33')]({'where':{'id':_0x3a0ebb[_0x09f5('0x29')]['id']}})[_0x09f5('0x15')](function(_0x503cce){return db['sequelize']['transaction'](function(_0x2f417f){return _0x503cce[_0x09f5('0x4e')](_0x2b6e0e,{'transaction':_0x2f417f})[_0x09f5('0x15')](function(){return BPromise['each'](_0x70cf09,function(_0x267754){return db[_0x09f5('0x3d')][_0x09f5('0x54')]({'where':{'UserId':_0x267754['id'],'WhatsappQueueId':_0x3a0ebb['params']['id']},'transaction':_0x2f417f});});})[_0x09f5('0x15')](function(){_0x70cf09[_0x09f5('0x55')](function(_0x510e1d){socket['emit'](_0x09f5('0x56'),{'UserId':_0x510e1d['id'],'WhatsappQueueId':_0x503cce['id']});});});});});}})[_0x09f5('0x15')](respondWithStatusCode(_0x4f075f,null))['catch'](handleError(_0x4f075f,null));};exports[_0x09f5('0x57')]=function(_0x52db19,_0x46d771){return db['Team'][_0x09f5('0x25')]({'where':{'id':_0x52db19['query'][_0x09f5('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x09f5('0x46')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x46d771,null))[_0x09f5('0x15')](function(_0x18198d){var _0x472c69=_['map'](_0x18198d,'id');var _0x521d8e=[];var _0xd7962e=[];var _0x2025aa=squel[_0x09f5('0x58')]();_0x2025aa[_0x09f5('0x59')](_0x09f5('0x5a'))[_0x09f5('0x5b')](_0x09f5('0x5c'),'tq')[_0x09f5('0x5d')](_0x09f5('0x5e'),'ut',_0x09f5('0x5f'))[_0x09f5('0x22')](_0x09f5('0x60'),_0x52db19[_0x09f5('0x29')]['id']);for(var _0x31f0fd=0x0;_0x31f0fd<_0x18198d['length'];_0x31f0fd+=0x1){let _0x2130b4=_0x18198d[_0x31f0fd];for(var _0x17e693=0x0;_0x17e693<_0x2130b4[_0x09f5('0x50')]['length'];_0x17e693+=0x1){let _0x183318=_0x2130b4[_0x09f5('0x50')][_0x17e693];var _0x54b57d=_0x2025aa[_0x09f5('0x61')]();_0x54b57d[_0x09f5('0x22')](_0x09f5('0x62'),_0x183318['id']);_0xd7962e['push'](db[_0x09f5('0x63')][_0x09f5('0x24')](_0x54b57d['toString'](),{'type':db[_0x09f5('0x63')][_0x09f5('0x64')][_0x09f5('0x65')]})[_0x09f5('0x15')](function(_0x4b347e){if(_0x4b347e[_0x09f5('0x3e')]===0x1){return _0x183318['id'];}else{var _0x279e53=_[_0x09f5('0x66')](_[_0x09f5('0x45')](_0x4b347e,_0x09f5('0x67')),function(_0x3942e8){return _[_0x09f5('0x68')](_0x472c69,_0x3942e8);});if(_0x279e53){return _0x183318['id'];}}}));}}return BPromise[_0x09f5('0x69')](_0xd7962e)[_0x09f5('0x15')](function(_0xddbcc0){_0x521d8e=_(_0x521d8e)[_0x09f5('0x6a')](_0xddbcc0)[_0x09f5('0x6b')]()[_0x09f5('0x6c')]();return db['WhatsappQueue'][_0x09f5('0x33')]({'where':{'id':_0x52db19[_0x09f5('0x29')]['id']}})[_0x09f5('0x15')](function(_0x588afd){return db[_0x09f5('0x63')][_0x09f5('0x6d')](function(_0x76baea){return _0x588afd['removeTeams'](_0x52db19[_0x09f5('0x24')][_0x09f5('0x4f')],{'transaction':_0x76baea})[_0x09f5('0x15')](function(){if(!_[_0x09f5('0x6e')](_0x521d8e)){return _0x588afd[_0x09f5('0x6f')](_0x521d8e,{'transaction':_0x76baea});}})[_0x09f5('0x15')](function(){_0x521d8e[_0x09f5('0x55')](function(_0x58ff96){socket['emit'](_0x09f5('0x70'),{'UserId':_0x58ff96,'WhatsappQueueId':_0x588afd['id']});});});});});});})[_0x09f5('0x15')](respondWithStatusCode(_0x46d771,null))['catch'](handleError(_0x46d771,null));};exports[_0x09f5('0x71')]=function(_0xdcb34,_0x2578cd){return db['WhatsappQueue']['find']({'where':{'id':_0xdcb34['params']['id']}})[_0x09f5('0x15')](handleEntityNotFound(_0x2578cd,null))[_0x09f5('0x15')](function(_0x5ef805){if(_0x5ef805){return _0x5ef805[_0x09f5('0x71')](_0xdcb34[_0x09f5('0x35')][_0x09f5('0x4f')],_[_0x09f5('0x72')](_0xdcb34[_0x09f5('0x35')],[_0x09f5('0x4f'),'id'])||{})[_0x09f5('0x73')](function(_0x5e6d02){for(var _0x285fdf=0x0;_0x285fdf<_0xdcb34['body'][_0x09f5('0x4f')][_0x09f5('0x3e')];_0x285fdf+=0x1){socket[_0x09f5('0x74')]('userWhatsappQueue:save',{'UserId':Number(_0xdcb34['body'][_0x09f5('0x4f')][_0x285fdf]),'WhatsappQueueId':Number(_0xdcb34['params']['id'])});}return _0x5e6d02;});}})[_0x09f5('0x15')](respondWithResult(_0x2578cd,null))['catch'](handleError(_0x2578cd,null));};exports[_0x09f5('0x6f')]=function(_0xa432ac,_0x461d3f){return db['WhatsappQueue'][_0x09f5('0x33')]({'where':{'id':_0xa432ac[_0x09f5('0x29')]['id']}})[_0x09f5('0x15')](handleEntityNotFound(_0x461d3f,null))['then'](function(_0x8afca2){if(_0x8afca2){return _0x8afca2[_0x09f5('0x6f')](_0xa432ac[_0x09f5('0x24')]['ids'])[_0x09f5('0x15')](function(){if(_[_0x09f5('0x75')](_0xa432ac[_0x09f5('0x24')][_0x09f5('0x4f')])){for(var _0x3996d7=0x0;_0x3996d7<_0xa432ac['query']['ids'][_0x09f5('0x3e')];_0x3996d7+=0x1){socket[_0x09f5('0x74')](_0x09f5('0x70'),{'UserId':Number(_0xa432ac['query'][_0x09f5('0x4f')][_0x3996d7]),'WhatsappQueueId':Number(_0xa432ac[_0x09f5('0x29')]['id'])});}}else{socket[_0x09f5('0x74')](_0x09f5('0x70'),{'UserId':Number(_0xa432ac[_0x09f5('0x24')]['ids']),'WhatsappQueueId':Number(_0xa432ac[_0x09f5('0x29')]['id'])});}});}})[_0x09f5('0x15')](respondWithStatusCode(_0x461d3f,null))[_0x09f5('0x27')](handleError(_0x461d3f,null));};exports['getAgents']=function(_0x24ca15,_0x590fe0){var _0x54afea={};var _0x9cb7e={};var _0x4f6cc6;var _0x29248c;return db[_0x09f5('0x1e')][_0x09f5('0x3c')]({'where':{'id':_0x24ca15[_0x09f5('0x29')]['id']}})[_0x09f5('0x15')](handleEntityNotFound(_0x590fe0,null))[_0x09f5('0x15')](function(_0x4bef78){if(_0x4bef78){_0x4f6cc6=_0x4bef78;_0x9cb7e[_0x09f5('0x2a')]=_[_0x09f5('0x2b')](db[_0x09f5('0x46')][_0x09f5('0x2c')]);_0x9cb7e[_0x09f5('0x24')]=_[_0x09f5('0x2b')](_0x24ca15[_0x09f5('0x24')]);_0x9cb7e[_0x09f5('0x2d')]=_[_0x09f5('0x2e')](_0x9cb7e[_0x09f5('0x2a')],_0x9cb7e[_0x09f5('0x24')]);_0x54afea[_0x09f5('0x30')]=_[_0x09f5('0x2e')](_0x9cb7e[_0x09f5('0x2a')],qs[_0x09f5('0x2f')](_0x24ca15[_0x09f5('0x24')][_0x09f5('0x2f')]));_0x54afea['attributes']=_0x54afea[_0x09f5('0x30')][_0x09f5('0x3e')]?_0x54afea[_0x09f5('0x30')]:_0x9cb7e[_0x09f5('0x2a')];_0x54afea[_0x09f5('0x40')]=qs[_0x09f5('0x41')](_0x24ca15[_0x09f5('0x24')][_0x09f5('0x41')]);_0x54afea[_0x09f5('0x22')]=qs[_0x09f5('0x2d')](_[_0x09f5('0x42')](_0x24ca15[_0x09f5('0x24')],_0x9cb7e['filters']));if(_0x24ca15[_0x09f5('0x24')][_0x09f5('0x43')]){_0x54afea[_0x09f5('0x22')]=_[_0x09f5('0x44')](_0x54afea[_0x09f5('0x22')],{'$or':_['map'](_0x54afea[_0x09f5('0x30')],function(_0xbd0e90){var _0xb63277={};_0xb63277[_0xbd0e90]={'$like':'%'+_0x24ca15[_0x09f5('0x24')][_0x09f5('0x43')]+'%'};return _0xb63277;})});}_0x54afea=_[_0x09f5('0x44')]({},_0x54afea,_0x24ca15['options']);return _0x4f6cc6[_0x09f5('0x76')](_0x54afea);}})[_0x09f5('0x15')](function(_0x575239){if(_0x575239){_0x29248c=_0x575239[_0x09f5('0x3e')];if(!_0x24ca15['query']['hasOwnProperty'](_0x09f5('0x3f'))){_0x54afea[_0x09f5('0x10')]=qs[_0x09f5('0x10')](_0x24ca15[_0x09f5('0x24')][_0x09f5('0x10')]);_0x54afea[_0x09f5('0x12')]=qs[_0x09f5('0x12')](_0x24ca15[_0x09f5('0x24')][_0x09f5('0x12')]);}return _0x4f6cc6[_0x09f5('0x76')](_0x54afea);}})[_0x09f5('0x15')](function(_0x567bfc){if(_0x567bfc){return _0x567bfc?{'count':_0x29248c,'rows':_0x567bfc}:null;}})['then'](respondWithResult(_0x590fe0,null))[_0x09f5('0x27')](handleError(_0x590fe0,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index b194141..d93ddf1 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 _0x8bd2=['exports','../../mysqldb','WhatsappQueue','update','remove','emit','hasOwnProperty'];(function(_0x437b0e,_0x250c23){var _0x386f5e=function(_0x679307){while(--_0x679307){_0x437b0e['push'](_0x437b0e['shift']());}};_0x386f5e(++_0x250c23);}(_0x8bd2,0x135));var _0x28bd=function(_0x51d129,_0x175d7d){_0x51d129=_0x51d129-0x0;var _0x44c377=_0x8bd2[_0x51d129];return _0x44c377;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x28bd('0x0'))['db'][_0x28bd('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x28bd('0x2'),'afterDestroy':_0x28bd('0x3')};function emitEvent(_0x13fd78){return function(_0x5a124b,_0xaf8b78,_0x1554bc){WhatsappQueueEvents[_0x28bd('0x4')](_0x13fd78+':'+_0x5a124b['id'],_0x5a124b);WhatsappQueueEvents[_0x28bd('0x4')](_0x13fd78,_0x5a124b);_0x1554bc(null);};}for(var e in events){if(events[_0x28bd('0x5')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x28bd('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0xed6f=['save','update','remove','emit','hasOwnProperty','exports','events','WhatsappQueue','setMaxListeners'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xed6f,0x10b));var _0xfed6=function(_0x56c822,_0x464ecd){_0x56c822=_0x56c822-0x0;var _0x6e3f5a=_0xed6f[_0x56c822];return _0x6e3f5a;};'use strict';var EventEmitter=require(_0xfed6('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xfed6('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xfed6('0x2')](0x0);var events={'afterCreate':_0xfed6('0x3'),'afterUpdate':_0xfed6('0x4'),'afterDestroy':_0xfed6('0x5')};function emitEvent(_0x1e1a34){return function(_0x2cb055,_0x15457b,_0x508a72){WhatsappQueueEvents['emit'](_0x1e1a34+':'+_0x2cb055['id'],_0x2cb055);WhatsappQueueEvents[_0xfed6('0x6')](_0x1e1a34,_0x2cb055);_0x508a72(null);};}for(var e in events){if(events[_0xfed6('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xfed6('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 56f317c..7a368b3 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 _0x9003=['./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x48b313,_0x2f5f42){var _0x27e91a=function(_0xd866f0){while(--_0xd866f0){_0x48b313['push'](_0x48b313['shift']());}};_0x27e91a(++_0x2f5f42);}(_0x9003,0xf4));var _0x3900=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x9003[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x3900('0x0'));var util=require('util');var logger=require(_0x3900('0x1'))(_0x3900('0x2'));var moment=require(_0x3900('0x3'));var BPromise=require(_0x3900('0x4'));var rp=require(_0x3900('0x5'));var fs=require('fs');var path=require(_0x3900('0x6'));var rimraf=require(_0x3900('0x7'));var config=require('../../config/environment');var attributes=require(_0x3900('0x8'));module[_0x3900('0x9')]=function(_0x6b0089,_0x535ebd){return _0x6b0089[_0x3900('0xa')]('WhatsappQueue',attributes,{'tableName':_0x3900('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2aee=['whatsapp_queues','../../config/logger','api','moment','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue'];(function(_0x338581,_0x85c756){var _0x306123=function(_0x127017){while(--_0x127017){_0x338581['push'](_0x338581['shift']());}};_0x306123(++_0x85c756);}(_0x2aee,0x169));var _0xe2ae=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x2aee[_0x467488];return _0x56107f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe2ae('0x0'))(_0xe2ae('0x1'));var moment=require(_0xe2ae('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2ae('0x3'));var rimraf=require(_0xe2ae('0x4'));var config=require(_0xe2ae('0x5'));var attributes=require(_0xe2ae('0x6'));module[_0xe2ae('0x7')]=function(_0x553893,_0x8c9a1a){return _0x553893['define'](_0xe2ae('0x8'),attributes,{'tableName':_0xe2ae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 0882f16..56b807f 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 _0x7a44=['map','then','GetWhatsappQueue','ShowWhatsappQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','model','include'];(function(_0x7c734d,_0x3be458){var _0x4d176b=function(_0x5afffb){while(--_0x5afffb){_0x7c734d['push'](_0x7c734d['shift']());}};_0x4d176b(++_0x3be458);}(_0x7a44,0x195));var _0x47a4=function(_0x5ca3ec,_0x333666){_0x5ca3ec=_0x5ca3ec-0x0;var _0x5dfe63=_0x7a44[_0x5ca3ec];return _0x5dfe63;};'use strict';var _=require(_0x47a4('0x0'));var util=require(_0x47a4('0x1'));var moment=require('moment');var BPromise=require(_0x47a4('0x2'));var rs=require(_0x47a4('0x3'));var fs=require('fs');var Redis=require(_0x47a4('0x4'));var db=require(_0x47a4('0x5'))['db'];var utils=require(_0x47a4('0x6'));var logger=require(_0x47a4('0x7'))(_0x47a4('0x8'));var config=require('../../config/environment');var jayson=require(_0x47a4('0x9'));var client=jayson[_0x47a4('0xa')][_0x47a4('0xb')]({'port':0x232a});config[_0x47a4('0xc')]=_[_0x47a4('0xd')](config[_0x47a4('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a4('0xe'))(new Redis(config[_0x47a4('0xc')]));require('./whatsappQueue.socket')[_0x47a4('0xf')](socket);function respondWithRpcPromise(_0x3898c7,_0x4150c1,_0x5da80f){return new BPromise(function(_0x9314f5,_0x5d9458){return client['request'](_0x3898c7,_0x5da80f)['then'](function(_0x4fa61d){logger[_0x47a4('0x10')](_0x47a4('0x11'),_0x4150c1,_0x47a4('0x12'));logger[_0x47a4('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4150c1,_0x47a4('0x12'),JSON[_0x47a4('0x14')](_0x4fa61d));if(_0x4fa61d['error']){if(_0x4fa61d[_0x47a4('0x15')][_0x47a4('0x16')]===0x1f4){logger[_0x47a4('0x15')](_0x47a4('0x11'),_0x4150c1,_0x4fa61d[_0x47a4('0x15')][_0x47a4('0x17')]);return _0x5d9458(_0x4fa61d[_0x47a4('0x15')][_0x47a4('0x17')]);}logger[_0x47a4('0x15')](_0x47a4('0x11'),_0x4150c1,_0x4fa61d[_0x47a4('0x15')]['message']);return _0x9314f5(_0x4fa61d[_0x47a4('0x15')]['message']);}else{logger[_0x47a4('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x4150c1,_0x47a4('0x12'));_0x9314f5(_0x4fa61d[_0x47a4('0x18')][_0x47a4('0x17')]);}})[_0x47a4('0x19')](function(_0x4bb8d){logger[_0x47a4('0x15')](_0x47a4('0x11'),_0x4150c1,_0x4bb8d);_0x5d9458(_0x4bb8d);});});}exports['GetWhatsappQueue']=function(_0x4d6551){var _0x34b214=this;return new Promise(function(_0x22132d,_0x11bf84){return db[_0x47a4('0x1a')][_0x47a4('0x1b')]({'raw':_0x4d6551[_0x47a4('0x1c')]?_0x4d6551[_0x47a4('0x1c')][_0x47a4('0x1d')]===undefined?!![]:![]:!![],'where':_0x4d6551[_0x47a4('0x1c')]?_0x4d6551[_0x47a4('0x1c')][_0x47a4('0x1e')]||null:null,'attributes':_0x4d6551[_0x47a4('0x1c')]?_0x4d6551[_0x47a4('0x1c')][_0x47a4('0x1f')]||null:null,'limit':_0x4d6551[_0x47a4('0x1c')]?_0x4d6551[_0x47a4('0x1c')][_0x47a4('0x20')]||null:null,'include':_0x4d6551[_0x47a4('0x1c')]?_0x4d6551['options']['include']?_['map'](_0x4d6551[_0x47a4('0x1c')]['include'],function(_0x10f33e){return{'model':db[_0x10f33e[_0x47a4('0x21')]],'as':_0x10f33e['as'],'attributes':_0x10f33e[_0x47a4('0x1f')],'include':_0x10f33e['include']?_['map'](_0x10f33e[_0x47a4('0x22')],function(_0x201f1b){return{'model':db[_0x201f1b[_0x47a4('0x21')]],'as':_0x201f1b['as'],'attributes':_0x201f1b[_0x47a4('0x1f')],'include':_0x201f1b[_0x47a4('0x22')]?_[_0x47a4('0x23')](_0x201f1b[_0x47a4('0x22')],function(_0x2a69fb){return{'model':db[_0x2a69fb['model']],'as':_0x2a69fb['as'],'attributes':_0x2a69fb['attributes']};}):[]};}):[]};}):[]:[]})[_0x47a4('0x24')](function(_0x5107fc){logger[_0x47a4('0x10')](_0x47a4('0x25'),_0x4d6551);logger[_0x47a4('0x13')]('GetWhatsappQueue',_0x4d6551,JSON[_0x47a4('0x14')](_0x5107fc));_0x22132d(_0x5107fc);})['catch'](function(_0x3a8f86){logger[_0x47a4('0x15')](_0x47a4('0x25'),_0x3a8f86['message'],_0x4d6551);_0x11bf84(_0x34b214[_0x47a4('0x15')](0x1f4,_0x3a8f86['message']));});});};exports[_0x47a4('0x26')]=function(_0x3c074d){var _0x52467a=this;return new Promise(function(_0x3a066f,_0x172c55){return db['WhatsappQueue'][_0x47a4('0x27')]({'raw':_0x3c074d['options']?_0x3c074d[_0x47a4('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3c074d['options']?_0x3c074d[_0x47a4('0x1c')][_0x47a4('0x1e')]||null:null,'attributes':_0x3c074d['options']?_0x3c074d[_0x47a4('0x1c')]['attributes']||null:null,'include':_0x3c074d['options']?_0x3c074d[_0x47a4('0x1c')]['include']?_[_0x47a4('0x23')](_0x3c074d[_0x47a4('0x1c')][_0x47a4('0x22')],function(_0x4c7083){return{'model':db[_0x4c7083[_0x47a4('0x21')]],'as':_0x4c7083['as'],'attributes':_0x4c7083[_0x47a4('0x1f')],'include':_0x4c7083['include']?_[_0x47a4('0x23')](_0x4c7083[_0x47a4('0x22')],function(_0x37263){return{'model':db[_0x37263[_0x47a4('0x21')]],'as':_0x37263['as'],'attributes':_0x37263[_0x47a4('0x1f')],'include':_0x37263[_0x47a4('0x22')]?_[_0x47a4('0x23')](_0x37263[_0x47a4('0x22')],function(_0xbd5b57){return{'model':db[_0xbd5b57['model']],'as':_0xbd5b57['as'],'attributes':_0xbd5b57[_0x47a4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x98380d){logger[_0x47a4('0x10')](_0x47a4('0x26'),_0x3c074d);logger[_0x47a4('0x13')](_0x47a4('0x26'),_0x3c074d,JSON[_0x47a4('0x14')](_0x98380d));_0x3a066f(_0x98380d);})[_0x47a4('0x19')](function(_0x4235f4){logger[_0x47a4('0x15')](_0x47a4('0x26'),_0x4235f4[_0x47a4('0x17')],_0x3c074d);_0x172c55(_0x52467a['error'](0x1f4,_0x4235f4[_0x47a4('0x17')]));});});}; \ No newline at end of file +var _0x5685=['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','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','GetWhatsappQueue','catch','find','ShowWhatsappQueue','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost'];(function(_0x2f6c00,_0xa3b210){var _0x1202b=function(_0x424f78){while(--_0x424f78){_0x2f6c00['push'](_0x2f6c00['shift']());}};_0x1202b(++_0xa3b210);}(_0x5685,0x6d));var _0x5568=function(_0x3a8fb6,_0x52dad8){_0x3a8fb6=_0x3a8fb6-0x0;var _0xe77179=_0x5685[_0x3a8fb6];return _0xe77179;};'use strict';var _=require(_0x5568('0x0'));var util=require(_0x5568('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5568('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5568('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5568('0x4'))(_0x5568('0x5'));var config=require(_0x5568('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5568('0x7')][_0x5568('0x8')]({'port':0x232a});config[_0x5568('0x9')]=_['defaults'](config[_0x5568('0x9')],{'host':_0x5568('0xa'),'port':0x18eb});var socket=require(_0x5568('0xb'))(new Redis(config['redis']));require(_0x5568('0xc'))[_0x5568('0xd')](socket);function respondWithRpcPromise(_0x2cea14,_0x1c743c,_0x4a93e0){return new BPromise(function(_0x6c08d9,_0x516fb0){return client[_0x5568('0xe')](_0x2cea14,_0x4a93e0)[_0x5568('0xf')](function(_0x3dd140){logger[_0x5568('0x10')](_0x5568('0x11'),_0x1c743c,_0x5568('0x12'));logger[_0x5568('0x13')](_0x5568('0x14'),_0x1c743c,_0x5568('0x12'),JSON[_0x5568('0x15')](_0x3dd140));if(_0x3dd140[_0x5568('0x16')]){if(_0x3dd140[_0x5568('0x16')][_0x5568('0x17')]===0x1f4){logger[_0x5568('0x16')](_0x5568('0x11'),_0x1c743c,_0x3dd140[_0x5568('0x16')]['message']);return _0x516fb0(_0x3dd140[_0x5568('0x16')][_0x5568('0x18')]);}logger[_0x5568('0x16')](_0x5568('0x11'),_0x1c743c,_0x3dd140[_0x5568('0x16')][_0x5568('0x18')]);return _0x6c08d9(_0x3dd140[_0x5568('0x16')][_0x5568('0x18')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x1c743c,'request\x20sent');_0x6c08d9(_0x3dd140[_0x5568('0x19')][_0x5568('0x18')]);}})['catch'](function(_0x47f83a){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1c743c,_0x47f83a);_0x516fb0(_0x47f83a);});});}exports['GetWhatsappQueue']=function(_0x32a9ad){var _0x32c1b9=this;return new Promise(function(_0x26fe41,_0x4b61bf){return db[_0x5568('0x1a')][_0x5568('0x1b')]({'raw':_0x32a9ad[_0x5568('0x1c')]?_0x32a9ad[_0x5568('0x1c')][_0x5568('0x1d')]===undefined?!![]:![]:!![],'where':_0x32a9ad[_0x5568('0x1c')]?_0x32a9ad[_0x5568('0x1c')][_0x5568('0x1e')]||null:null,'attributes':_0x32a9ad[_0x5568('0x1c')]?_0x32a9ad['options'][_0x5568('0x1f')]||null:null,'limit':_0x32a9ad[_0x5568('0x1c')]?_0x32a9ad['options'][_0x5568('0x20')]||null:null,'include':_0x32a9ad[_0x5568('0x1c')]?_0x32a9ad[_0x5568('0x1c')][_0x5568('0x21')]?_['map'](_0x32a9ad[_0x5568('0x1c')][_0x5568('0x21')],function(_0x495ee6){return{'model':db[_0x495ee6[_0x5568('0x22')]],'as':_0x495ee6['as'],'attributes':_0x495ee6['attributes'],'include':_0x495ee6[_0x5568('0x21')]?_[_0x5568('0x23')](_0x495ee6[_0x5568('0x21')],function(_0x1588a0){return{'model':db[_0x1588a0[_0x5568('0x22')]],'as':_0x1588a0['as'],'attributes':_0x1588a0[_0x5568('0x1f')],'include':_0x1588a0[_0x5568('0x21')]?_['map'](_0x1588a0[_0x5568('0x21')],function(_0x17a681){return{'model':db[_0x17a681[_0x5568('0x22')]],'as':_0x17a681['as'],'attributes':_0x17a681[_0x5568('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x290a63){logger[_0x5568('0x10')](_0x5568('0x24'),_0x32a9ad);logger[_0x5568('0x13')](_0x5568('0x24'),_0x32a9ad,JSON['stringify'](_0x290a63));_0x26fe41(_0x290a63);})[_0x5568('0x25')](function(_0x2714ff){logger[_0x5568('0x16')]('GetWhatsappQueue',_0x2714ff['message'],_0x32a9ad);_0x4b61bf(_0x32c1b9[_0x5568('0x16')](0x1f4,_0x2714ff[_0x5568('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0x30e507){var _0x4538b6=this;return new Promise(function(_0x3ca54b,_0x1b1fbe){return db[_0x5568('0x1a')][_0x5568('0x26')]({'raw':_0x30e507[_0x5568('0x1c')]?_0x30e507['options'][_0x5568('0x1d')]===undefined?!![]:![]:!![],'where':_0x30e507[_0x5568('0x1c')]?_0x30e507['options'][_0x5568('0x1e')]||null:null,'attributes':_0x30e507[_0x5568('0x1c')]?_0x30e507['options']['attributes']||null:null,'include':_0x30e507[_0x5568('0x1c')]?_0x30e507[_0x5568('0x1c')][_0x5568('0x21')]?_[_0x5568('0x23')](_0x30e507[_0x5568('0x1c')]['include'],function(_0x41d506){return{'model':db[_0x41d506['model']],'as':_0x41d506['as'],'attributes':_0x41d506[_0x5568('0x1f')],'include':_0x41d506[_0x5568('0x21')]?_['map'](_0x41d506[_0x5568('0x21')],function(_0x205e53){return{'model':db[_0x205e53[_0x5568('0x22')]],'as':_0x205e53['as'],'attributes':_0x205e53[_0x5568('0x1f')],'include':_0x205e53[_0x5568('0x21')]?_[_0x5568('0x23')](_0x205e53[_0x5568('0x21')],function(_0x2ffbe8){return{'model':db[_0x2ffbe8[_0x5568('0x22')]],'as':_0x2ffbe8['as'],'attributes':_0x2ffbe8[_0x5568('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5568('0xf')](function(_0xc7a8f6){logger[_0x5568('0x10')](_0x5568('0x27'),_0x30e507);logger[_0x5568('0x13')](_0x5568('0x27'),_0x30e507,JSON['stringify'](_0xc7a8f6));_0x3ca54b(_0xc7a8f6);})[_0x5568('0x25')](function(_0x5363d2){logger[_0x5568('0x16')](_0x5568('0x27'),_0x5363d2[_0x5568('0x18')],_0x30e507);_0x1b1fbe(_0x4538b6['error'](0x1f4,_0x5363d2['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index c844b4a..07648a9 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 _0x1d15=['length','whatsappQueue:','save','update','emit','removeListener'];(function(_0xfa9738,_0x5386e4){var _0x54cd58=function(_0x593c7a){while(--_0x593c7a){_0xfa9738['push'](_0xfa9738['shift']());}};_0x54cd58(++_0x5386e4);}(_0x1d15,0x122));var _0x51d1=function(_0x1a7a83,_0xaa70b1){_0x1a7a83=_0x1a7a83-0x0;var _0x10d11c=_0x1d15[_0x1a7a83];return _0x10d11c;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x51d1('0x0'),'remove',_0x51d1('0x1')];function createListener(_0x4c982f,_0x4d6b83){return function(_0x129387){_0x4d6b83[_0x51d1('0x2')](_0x4c982f,_0x129387);};}function removeListener(_0x134212,_0x1f318e){return function(){WhatsappQueueEvents[_0x51d1('0x3')](_0x134212,_0x1f318e);};}exports['register']=function(_0x4b2281){for(var _0x55bb00=0x0,_0x38e781=events[_0x51d1('0x4')];_0x55bb00<_0x38e781;_0x55bb00++){var _0x3d759a=events[_0x55bb00];var _0x3f97e7=createListener(_0x51d1('0x5')+_0x3d759a,_0x4b2281);WhatsappQueueEvents['on'](_0x3d759a,_0x3f97e7);}}; \ No newline at end of file +var _0xd29a=['./whatsappQueue.events','save','remove','update','emit','removeListener','whatsappQueue:'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xd29a,0xbd));var _0xad29=function(_0x19e1ef,_0x27fc9f){_0x19e1ef=_0x19e1ef-0x0;var _0x4946d5=_0xd29a[_0x19e1ef];return _0x4946d5;};'use strict';var WhatsappQueueEvents=require(_0xad29('0x0'));var events=[_0xad29('0x1'),_0xad29('0x2'),_0xad29('0x3')];function createListener(_0x35c9c6,_0x206d34){return function(_0x1c3bc9){_0x206d34[_0xad29('0x4')](_0x35c9c6,_0x1c3bc9);};}function removeListener(_0x250f54,_0x3088b9){return function(){WhatsappQueueEvents[_0xad29('0x5')](_0x250f54,_0x3088b9);};}exports['register']=function(_0x567662){for(var _0x431918=0x0,_0xb8506c=events['length'];_0x431918<_0xb8506c;_0x431918++){var _0x834622=events[_0x431918];var _0x40e1f6=createListener(_0xad29('0x6')+_0x834622,_0x567662);WhatsappQueueEvents['on'](_0x834622,_0x40e1f6);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 319bc11..4b1d9bb 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 _0x8bba=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','put','destroy','exports'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x8bba,0xdd));var _0xa8bb=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x8bba[_0x5c9307];return _0x373e29;};'use strict';var multer=require('multer');var util=require(_0xa8bb('0x0'));var path=require(_0xa8bb('0x1'));var timeout=require('connect-timeout');var express=require(_0xa8bb('0x2'));var router=express['Router']();var fs_extra=require(_0xa8bb('0x3'));var auth=require(_0xa8bb('0x4'));var interaction=require(_0xa8bb('0x5'));var config=require(_0xa8bb('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0xa8bb('0x7')]('/',auth[_0xa8bb('0x8')](),controller[_0xa8bb('0x9')]);router[_0xa8bb('0x7')](_0xa8bb('0xa'),auth[_0xa8bb('0x8')](),controller['describe']);router[_0xa8bb('0x7')](_0xa8bb('0xb'),auth[_0xa8bb('0x8')](),controller[_0xa8bb('0xc')]);router[_0xa8bb('0xd')]('/',auth[_0xa8bb('0x8')](),controller['create']);router[_0xa8bb('0xe')](_0xa8bb('0xb'),auth[_0xa8bb('0x8')](),controller['update']);router['delete'](_0xa8bb('0xb'),auth[_0xa8bb('0x8')](),controller[_0xa8bb('0xf')]);module[_0xa8bb('0x10')]=router; \ No newline at end of file +var _0xe84b=['/:id','show','create','put','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1af6de,_0x190e66){var _0x450a9e=function(_0x53f494){while(--_0x53f494){_0x1af6de['push'](_0x1af6de['shift']());}};_0x450a9e(++_0x190e66);}(_0xe84b,0x1ab));var _0xbe84=function(_0x12af8a,_0x23c7ab){_0x12af8a=_0x12af8a-0x0;var _0x300e09=_0xe84b[_0x12af8a];return _0x300e09;};'use strict';var multer=require(_0xbe84('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbe84('0x1'));var express=require(_0xbe84('0x2'));var router=express[_0xbe84('0x3')]();var fs_extra=require(_0xbe84('0x4'));var auth=require(_0xbe84('0x5'));var interaction=require(_0xbe84('0x6'));var config=require('../../config/environment');var controller=require(_0xbe84('0x7'));router[_0xbe84('0x8')]('/',auth[_0xbe84('0x9')](),controller[_0xbe84('0xa')]);router[_0xbe84('0x8')](_0xbe84('0xb'),auth[_0xbe84('0x9')](),controller[_0xbe84('0xc')]);router['get'](_0xbe84('0xd'),auth['isAuthenticated'](),controller[_0xbe84('0xe')]);router['post']('/',auth[_0xbe84('0x9')](),controller[_0xbe84('0xf')]);router[_0xbe84('0x10')](_0xbe84('0xd'),auth['isAuthenticated'](),controller[_0xbe84('0x11')]);router['delete'](_0xbe84('0xd'),auth[_0xbe84('0x9')](),controller[_0xbe84('0x12')]);module[_0xbe84('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 2189101..b2a8d84 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x2dfd06,_0x1a856b){var _0x2750d4=function(_0x205467){while(--_0x205467){_0x2dfd06['push'](_0x2dfd06['shift']());}};_0x2750d4(++_0x1a856b);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x273944,_0x461b47){var _0x2c242b=function(_0x2b62b2){while(--_0x2b62b2){_0x273944['push'](_0x273944['shift']());}};_0x2c242b(++_0x461b47);}(_0x7a54,0x106));var _0x47a5=function(_0x45d125,_0x1a49ae){_0x45d125=_0x45d125-0x0;var _0x58ab14=_0x7a54[_0x45d125];return _0x58ab14;};'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 19e873f..3bf91ac 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 _0x373d=['order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','show','rawAttributes','includeAll','options','catch','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x51bd27,_0x44a315){var _0x5740a0=function(_0x3ce69d){while(--_0x3ce69d){_0x51bd27['push'](_0x51bd27['shift']());}};_0x5740a0(++_0x44a315);}(_0x373d,0x1e2));var _0xd373=function(_0x4bfb87,_0x2ed356){_0x4bfb87=_0x4bfb87-0x0;var _0x2b4e25=_0x373d[_0x4bfb87];return _0x2b4e25;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7f91,_0x5ab89c){_0x5ab89c=_0x5ab89c||0xcc;return function(_0xcd9b8c){if(_0xcd9b8c){return _0x4c7f91[_0xd373('0x15')](_0x5ab89c);}return _0x4c7f91['status'](_0x5ab89c)[_0xd373('0x16')]();};}function respondWithResult(_0x129475,_0x27c161){_0x27c161=_0x27c161||0xc8;return function(_0x23ed86){if(_0x23ed86){return _0x129475[_0xd373('0x17')](_0x27c161)[_0xd373('0x18')](_0x23ed86);}};}function respondWithFilteredResult(_0x20aca5,_0x2eacb1){return function(_0x5a286a){if(_0x5a286a){var _0x2c5854=typeof _0x2eacb1[_0xd373('0x19')]===_0xd373('0x1a')&&typeof _0x2eacb1[_0xd373('0x1b')]==='undefined';var _0x1e26cf=_0x5a286a['count'];var _0x460259=_0x2c5854?0x0:_0x2eacb1[_0xd373('0x19')];var _0x55c5c7=_0x2c5854?_0x5a286a[_0xd373('0x1c')]:_0x2eacb1['offset']+_0x2eacb1['limit'];var _0x23fada;if(_0x55c5c7>=_0x1e26cf){_0x55c5c7=_0x1e26cf;_0x23fada=0xc8;}else{_0x23fada=0xce;}_0x20aca5[_0xd373('0x17')](_0x23fada);return _0x20aca5[_0xd373('0x1d')](_0xd373('0x1e'),_0x460259+'-'+_0x55c5c7+'/'+_0x1e26cf)[_0xd373('0x18')](_0x5a286a);}return null;};}function patchUpdates(_0x181eb2){return function(_0x4ba510){try{jsonpatch[_0xd373('0x1f')](_0x4ba510,_0x181eb2,!![]);}catch(_0xd808f8){return BPromise[_0xd373('0x20')](_0xd808f8);}return _0x4ba510[_0xd373('0x21')]();};}function saveUpdates(_0x165e21,_0x3aa1c5){return function(_0x4f64bd){if(_0x4f64bd){return _0x4f64bd[_0xd373('0x22')](_0x165e21)[_0xd373('0x23')](function(_0x157f81){return _0x157f81;});}return null;};}function removeEntity(_0x209ca7,_0x217ee7){return function(_0x238ffd){if(_0x238ffd){return _0x238ffd[_0xd373('0x24')]()[_0xd373('0x23')](function(){_0x209ca7[_0xd373('0x17')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x437110,_0x34f05a){return function(_0x388182){if(!_0x388182){_0x437110[_0xd373('0x15')](0x194);}return _0x388182;};}function handleError(_0x18d7ab,_0x38ba50){_0x38ba50=_0x38ba50||0x1f4;return function(_0x50b987){logger[_0xd373('0x25')](_0x50b987[_0xd373('0x26')]);if(_0x50b987[_0xd373('0x27')]){delete _0x50b987[_0xd373('0x27')];}_0x18d7ab[_0xd373('0x17')](_0x38ba50)[_0xd373('0x28')](_0x50b987);};}exports[_0xd373('0x29')]=function(_0xf85ca8,_0x2869e5){var _0x158825={},_0xbc420b={},_0x2ee37c={'count':0x0,'rows':[]};var _0x7dad3e=_['map'](db[_0xd373('0x2a')]['rawAttributes'],function(_0x498aaa){return{'name':_0x498aaa[_0xd373('0x2b')],'type':_0x498aaa[_0xd373('0x2c')][_0xd373('0x2d')]};});_0xbc420b[_0xd373('0x2e')]=_[_0xd373('0x2f')](_0x7dad3e,'name');_0xbc420b[_0xd373('0x30')]=_[_0xd373('0x31')](_0xf85ca8['query']);_0xbc420b[_0xd373('0x32')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],_0xbc420b[_0xd373('0x30')]);_0x158825[_0xd373('0x34')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],qs[_0xd373('0x35')](_0xf85ca8[_0xd373('0x30')]['fields']));_0x158825[_0xd373('0x34')]=_0x158825[_0xd373('0x34')][_0xd373('0x36')]?_0x158825[_0xd373('0x34')]:_0xbc420b[_0xd373('0x2e')];if(!_0xf85ca8[_0xd373('0x30')][_0xd373('0x37')](_0xd373('0x38'))){_0x158825[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x1b')]);_0x158825[_0xd373('0x19')]=qs[_0xd373('0x19')](_0xf85ca8[_0xd373('0x30')]['offset']);}_0x158825[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x3a')]);_0x158825['where']=qs[_0xd373('0x32')](_[_0xd373('0x3b')](_0xf85ca8[_0xd373('0x30')],_0xbc420b[_0xd373('0x32')]),_0x7dad3e);if(_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]){_0x158825['where']=_['merge'](_0x158825[_0xd373('0x3d')],{'$or':_['map'](_0x7dad3e,function(_0x37c97e){if(_0x37c97e[_0xd373('0x2c')]!==_0xd373('0x3e')){var _0x51ba69={};_0x51ba69[_0x37c97e[_0xd373('0x27')]]={'$like':'%'+_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]+'%'};return _0x51ba69;}})});}_0x158825=_[_0xd373('0x3f')]({},_0x158825,_0xf85ca8['options']);var _0x513038={'where':_0x158825['where']};return db[_0xd373('0x2a')]['count'](_0x513038)[_0xd373('0x23')](function(_0x2fa6c4){_0x2ee37c['count']=_0x2fa6c4;if(_0xf85ca8['query']['includeAll']){_0x158825[_0xd373('0x40')]=[{'all':!![]}];}return db[_0xd373('0x2a')][_0xd373('0x41')](_0x158825);})['then'](function(_0x5c3b22){_0x2ee37c[_0xd373('0x42')]=_0x5c3b22;return _0x2ee37c;})[_0xd373('0x23')](respondWithFilteredResult(_0x2869e5,_0x158825))['catch'](handleError(_0x2869e5,null));};exports[_0xd373('0x43')]=function(_0x2ee75f,_0x1e3de1){var _0x9989e4={'raw':!![],'where':{'id':_0x2ee75f['params']['id']}},_0x2d8c7d={};_0x2d8c7d['model']=_[_0xd373('0x31')](db[_0xd373('0x2a')][_0xd373('0x44')]);_0x2d8c7d[_0xd373('0x30')]=_['keys'](_0x2ee75f[_0xd373('0x30')]);_0x2d8c7d['filters']=_[_0xd373('0x33')](_0x2d8c7d[_0xd373('0x2e')],_0x2d8c7d[_0xd373('0x30')]);_0x9989e4[_0xd373('0x34')]=_[_0xd373('0x33')](_0x2d8c7d['model'],qs[_0xd373('0x35')](_0x2ee75f[_0xd373('0x30')]['fields']));_0x9989e4[_0xd373('0x34')]=_0x9989e4[_0xd373('0x34')][_0xd373('0x36')]?_0x9989e4[_0xd373('0x34')]:_0x2d8c7d[_0xd373('0x2e')];if(_0x2ee75f[_0xd373('0x30')][_0xd373('0x45')]){_0x9989e4[_0xd373('0x40')]=[{'all':!![]}];}_0x9989e4=_[_0xd373('0x3f')]({},_0x9989e4,_0x2ee75f[_0xd373('0x46')]);return db['WhatsappQueueReport']['find'](_0x9989e4)[_0xd373('0x23')](handleEntityNotFound(_0x1e3de1,null))['then'](respondWithResult(_0x1e3de1,null))[_0xd373('0x47')](handleError(_0x1e3de1,null));};exports['create']=function(_0x5e5279,_0x5cbc16){return db[_0xd373('0x2a')][_0xd373('0x48')](_0x5e5279[_0xd373('0x49')],{})[_0xd373('0x23')](respondWithResult(_0x5cbc16,0xc9))[_0xd373('0x47')](handleError(_0x5cbc16,null));};exports[_0xd373('0x22')]=function(_0x1855aa,_0x4d1088){if(_0x1855aa[_0xd373('0x49')]['id']){delete _0x1855aa['body']['id'];}return db[_0xd373('0x2a')][_0xd373('0x4a')]({'where':{'id':_0x1855aa['params']['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4d1088,null))['then'](saveUpdates(_0x1855aa[_0xd373('0x49')],null))[_0xd373('0x23')](respondWithResult(_0x4d1088,null))[_0xd373('0x47')](handleError(_0x4d1088,null));};exports[_0xd373('0x24')]=function(_0xe22cbd,_0x4bc631){return db['WhatsappQueueReport']['find']({'where':{'id':_0xe22cbd[_0xd373('0x4b')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4bc631,null))['then'](removeEntity(_0x4bc631,null))[_0xd373('0x47')](handleError(_0x4bc631,null));};exports[_0xd373('0x4c')]=function(_0x4d7020,_0xae7067){return db[_0xd373('0x2a')][_0xd373('0x4c')]()[_0xd373('0x23')](respondWithResult(_0xae7067,null))[_0xd373('0x47')](handleError(_0xae7067,null));}; \ No newline at end of file +var _0x5eb8=['rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','includeAll','include','catch','show','params','keys','options','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','WhatsappQueueReport'];(function(_0x3319a1,_0x347b3c){var _0x27f27c=function(_0x27ab35){while(--_0x27ab35){_0x3319a1['push'](_0x3319a1['shift']());}};_0x27f27c(++_0x347b3c);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1269c6,_0x1c8942){_0x1269c6=_0x1269c6-0x0;var _0x4868c7=_0x5eb8[_0x1269c6];return _0x4868c7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];function respondWithStatusCode(_0x784583,_0x2f42ba){_0x2f42ba=_0x2f42ba||0xcc;return function(_0x259f72){if(_0x259f72){return _0x784583['sendStatus'](_0x2f42ba);}return _0x784583['status'](_0x2f42ba)[_0x85eb('0x19')]();};}function respondWithResult(_0x5c760a,_0x18ca53){_0x18ca53=_0x18ca53||0xc8;return function(_0x23a82a){if(_0x23a82a){return _0x5c760a[_0x85eb('0x1a')](_0x18ca53)[_0x85eb('0x1b')](_0x23a82a);}};}function respondWithFilteredResult(_0x183b0c,_0x49efdf){return function(_0x2e5c0a){if(_0x2e5c0a){var _0x59237b=typeof _0x49efdf[_0x85eb('0x1c')]===_0x85eb('0x1d')&&typeof _0x49efdf[_0x85eb('0x1e')]===_0x85eb('0x1d');var _0x5dbeda=_0x2e5c0a['count'];var _0x50d2a8=_0x59237b?0x0:_0x49efdf[_0x85eb('0x1c')];var _0x39ca96=_0x59237b?_0x2e5c0a[_0x85eb('0x1f')]:_0x49efdf[_0x85eb('0x1c')]+_0x49efdf[_0x85eb('0x1e')];var _0x34f875;if(_0x39ca96>=_0x5dbeda){_0x39ca96=_0x5dbeda;_0x34f875=0xc8;}else{_0x34f875=0xce;}_0x183b0c['status'](_0x34f875);return _0x183b0c[_0x85eb('0x20')](_0x85eb('0x21'),_0x50d2a8+'-'+_0x39ca96+'/'+_0x5dbeda)[_0x85eb('0x1b')](_0x2e5c0a);}return null;};}function patchUpdates(_0x4e8041){return function(_0x4b4b38){try{jsonpatch['apply'](_0x4b4b38,_0x4e8041,!![]);}catch(_0x55b9e4){return BPromise[_0x85eb('0x22')](_0x55b9e4);}return _0x4b4b38[_0x85eb('0x23')]();};}function saveUpdates(_0x329fc5,_0x255ca7){return function(_0x465c74){if(_0x465c74){return _0x465c74[_0x85eb('0x24')](_0x329fc5)['then'](function(_0x5491d5){return _0x5491d5;});}return null;};}function removeEntity(_0x5b48d9,_0x298e84){return function(_0x1426c8){if(_0x1426c8){return _0x1426c8[_0x85eb('0x25')]()[_0x85eb('0x26')](function(){_0x5b48d9[_0x85eb('0x1a')](0xcc)[_0x85eb('0x19')]();});}};}function handleEntityNotFound(_0x5dfc96,_0x39d3fe){return function(_0x3453cd){if(!_0x3453cd){_0x5dfc96[_0x85eb('0x27')](0x194);}return _0x3453cd;};}function handleError(_0x30e766,_0x3e2326){_0x3e2326=_0x3e2326||0x1f4;return function(_0x57a03c){logger[_0x85eb('0x28')](_0x57a03c[_0x85eb('0x29')]);if(_0x57a03c[_0x85eb('0x2a')]){delete _0x57a03c[_0x85eb('0x2a')];}_0x30e766[_0x85eb('0x1a')](_0x3e2326)[_0x85eb('0x2b')](_0x57a03c);};}exports['index']=function(_0x562792,_0x37515c){var _0x585f2a={},_0xa9b14f={},_0x5255eb={'count':0x0,'rows':[]};var _0x4229e9=_[_0x85eb('0x2c')](db[_0x85eb('0x2d')][_0x85eb('0x2e')],function(_0xa67e1c){return{'name':_0xa67e1c[_0x85eb('0x2f')],'type':_0xa67e1c[_0x85eb('0x30')]['key']};});_0xa9b14f[_0x85eb('0x31')]=_[_0x85eb('0x2c')](_0x4229e9,'name');_0xa9b14f[_0x85eb('0x32')]=_['keys'](_0x562792['query']);_0xa9b14f[_0x85eb('0x33')]=_[_0x85eb('0x34')](_0xa9b14f[_0x85eb('0x31')],_0xa9b14f[_0x85eb('0x32')]);_0x585f2a[_0x85eb('0x35')]=_[_0x85eb('0x34')](_0xa9b14f[_0x85eb('0x31')],qs[_0x85eb('0x36')](_0x562792[_0x85eb('0x32')][_0x85eb('0x36')]));_0x585f2a['attributes']=_0x585f2a[_0x85eb('0x35')][_0x85eb('0x37')]?_0x585f2a['attributes']:_0xa9b14f['model'];if(!_0x562792[_0x85eb('0x32')][_0x85eb('0x38')](_0x85eb('0x39'))){_0x585f2a[_0x85eb('0x1e')]=qs[_0x85eb('0x1e')](_0x562792[_0x85eb('0x32')][_0x85eb('0x1e')]);_0x585f2a[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x562792[_0x85eb('0x32')][_0x85eb('0x1c')]);}_0x585f2a[_0x85eb('0x3a')]=qs[_0x85eb('0x3b')](_0x562792[_0x85eb('0x32')]['sort']);_0x585f2a[_0x85eb('0x3c')]=qs[_0x85eb('0x33')](_['pick'](_0x562792['query'],_0xa9b14f[_0x85eb('0x33')]),_0x4229e9);if(_0x562792[_0x85eb('0x32')]['filter']){_0x585f2a[_0x85eb('0x3c')]=_['merge'](_0x585f2a[_0x85eb('0x3c')],{'$or':_['map'](_0x4229e9,function(_0xaa27ca){if(_0xaa27ca['type']!==_0x85eb('0x3d')){var _0x5c618a={};_0x5c618a[_0xaa27ca[_0x85eb('0x2a')]]={'$like':'%'+_0x562792[_0x85eb('0x32')]['filter']+'%'};return _0x5c618a;}})});}_0x585f2a=_[_0x85eb('0x3e')]({},_0x585f2a,_0x562792['options']);var _0x2a6baa={'where':_0x585f2a[_0x85eb('0x3c')]};return db['WhatsappQueueReport'][_0x85eb('0x1f')](_0x2a6baa)['then'](function(_0x5495cf){_0x5255eb[_0x85eb('0x1f')]=_0x5495cf;if(_0x562792['query'][_0x85eb('0x3f')]){_0x585f2a[_0x85eb('0x40')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x585f2a);})[_0x85eb('0x26')](function(_0x422ec3){_0x5255eb['rows']=_0x422ec3;return _0x5255eb;})['then'](respondWithFilteredResult(_0x37515c,_0x585f2a))[_0x85eb('0x41')](handleError(_0x37515c,null));};exports[_0x85eb('0x42')]=function(_0x2211f9,_0x202681){var _0x3be961={'raw':!![],'where':{'id':_0x2211f9[_0x85eb('0x43')]['id']}},_0x5b7411={};_0x5b7411[_0x85eb('0x31')]=_[_0x85eb('0x44')](db[_0x85eb('0x2d')][_0x85eb('0x2e')]);_0x5b7411[_0x85eb('0x32')]=_[_0x85eb('0x44')](_0x2211f9[_0x85eb('0x32')]);_0x5b7411[_0x85eb('0x33')]=_['intersection'](_0x5b7411[_0x85eb('0x31')],_0x5b7411[_0x85eb('0x32')]);_0x3be961['attributes']=_[_0x85eb('0x34')](_0x5b7411[_0x85eb('0x31')],qs[_0x85eb('0x36')](_0x2211f9[_0x85eb('0x32')][_0x85eb('0x36')]));_0x3be961[_0x85eb('0x35')]=_0x3be961['attributes'][_0x85eb('0x37')]?_0x3be961[_0x85eb('0x35')]:_0x5b7411[_0x85eb('0x31')];if(_0x2211f9[_0x85eb('0x32')][_0x85eb('0x3f')]){_0x3be961[_0x85eb('0x40')]=[{'all':!![]}];}_0x3be961=_[_0x85eb('0x3e')]({},_0x3be961,_0x2211f9[_0x85eb('0x45')]);return db['WhatsappQueueReport'][_0x85eb('0x46')](_0x3be961)[_0x85eb('0x26')](handleEntityNotFound(_0x202681,null))[_0x85eb('0x26')](respondWithResult(_0x202681,null))[_0x85eb('0x41')](handleError(_0x202681,null));};exports[_0x85eb('0x47')]=function(_0x1a19c2,_0x3c387a){return db[_0x85eb('0x2d')][_0x85eb('0x47')](_0x1a19c2[_0x85eb('0x48')],{})[_0x85eb('0x26')](respondWithResult(_0x3c387a,0xc9))[_0x85eb('0x41')](handleError(_0x3c387a,null));};exports['update']=function(_0x11da79,_0x2c951b){if(_0x11da79[_0x85eb('0x48')]['id']){delete _0x11da79['body']['id'];}return db[_0x85eb('0x2d')][_0x85eb('0x46')]({'where':{'id':_0x11da79[_0x85eb('0x43')]['id']}})[_0x85eb('0x26')](handleEntityNotFound(_0x2c951b,null))[_0x85eb('0x26')](saveUpdates(_0x11da79['body'],null))[_0x85eb('0x26')](respondWithResult(_0x2c951b,null))[_0x85eb('0x41')](handleError(_0x2c951b,null));};exports[_0x85eb('0x25')]=function(_0x50e264,_0xc5cb43){return db[_0x85eb('0x2d')][_0x85eb('0x46')]({'where':{'id':_0x50e264['params']['id']}})['then'](handleEntityNotFound(_0xc5cb43,null))[_0x85eb('0x26')](removeEntity(_0xc5cb43,null))['catch'](handleError(_0xc5cb43,null));};exports['describe']=function(_0x3f0b0c,_0x593723){return db[_0x85eb('0x2d')][_0x85eb('0x49')]()['then'](respondWithResult(_0x593723,null))['catch'](handleError(_0x593723,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 3ee88f4..4278010 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 _0xded4=['request-promise','path','exports','report_whatsapp_queue','uniqueid','lodash','util','api','bluebird'];(function(_0x279754,_0x408a10){var _0x58cc79=function(_0x3df6c1){while(--_0x3df6c1){_0x279754['push'](_0x279754['shift']());}};_0x58cc79(++_0x408a10);}(_0xded4,0xe6));var _0x4ded=function(_0x3c29ab,_0x314ec4){_0x3c29ab=_0x3c29ab-0x0;var _0x52693a=_0xded4[_0x3c29ab];return _0x52693a;};'use strict';var _=require(_0x4ded('0x0'));var util=require(_0x4ded('0x1'));var logger=require('../../config/logger')(_0x4ded('0x2'));var moment=require('moment');var BPromise=require(_0x4ded('0x3'));var rp=require(_0x4ded('0x4'));var fs=require('fs');var path=require(_0x4ded('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0x4ded('0x6')]=function(_0x331f1e,_0xbb3c73){return _0x331f1e['define']('WhatsappQueueReport',attributes,{'tableName':_0x4ded('0x7'),'paranoid':![],'indexes':[{'name':_0x4ded('0x8'),'fields':[_0x4ded('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x51d3=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x51d3,0xc8));var _0x351d=function(_0x418ce4,_0x3c1f2d){_0x418ce4=_0x418ce4-0x0;var _0x2ce9ff=_0x51d3[_0x418ce4];return _0x2ce9ff;};'use strict';var _=require(_0x351d('0x0'));var util=require(_0x351d('0x1'));var logger=require(_0x351d('0x2'))('api');var moment=require(_0x351d('0x3'));var BPromise=require(_0x351d('0x4'));var rp=require(_0x351d('0x5'));var fs=require('fs');var path=require(_0x351d('0x6'));var rimraf=require(_0x351d('0x7'));var config=require(_0x351d('0x8'));var attributes=require(_0x351d('0x9'));module[_0x351d('0xa')]=function(_0x4b9119,_0x134be5){return _0x4b9119[_0x351d('0xb')](_0x351d('0xc'),attributes,{'tableName':_0x351d('0xd'),'paranoid':![],'indexes':[{'name':_0x351d('0xe'),'fields':[_0x351d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index c4d1e78..ce629eb 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 _0xd1f0=['where','attributes','limit','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','update'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd1f0,0x1b5));var _0x0d1f=function(_0x569c95,_0x54f839){_0x569c95=_0x569c95-0x0;var _0x2749b5=_0xd1f0[_0x569c95];return _0x2749b5;};'use strict';var _=require('lodash');var util=require(_0x0d1f('0x0'));var moment=require('moment');var BPromise=require(_0x0d1f('0x1'));var rs=require(_0x0d1f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d1f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d1f('0x4'))(_0x0d1f('0x5'));var config=require(_0x0d1f('0x6'));var jayson=require(_0x0d1f('0x7'));var client=jayson['client'][_0x0d1f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44d2aa,_0xd8ea52,_0x4f27c1){return new BPromise(function(_0x1e0d7c,_0x43e35d){return client[_0x0d1f('0x9')](_0x44d2aa,_0x4f27c1)[_0x0d1f('0xa')](function(_0x294d19){logger[_0x0d1f('0xb')](_0x0d1f('0xc'),_0xd8ea52,_0x0d1f('0xd'));logger[_0x0d1f('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0xd8ea52,'request\x20sent',JSON[_0x0d1f('0xf')](_0x294d19));if(_0x294d19[_0x0d1f('0x10')]){if(_0x294d19[_0x0d1f('0x10')][_0x0d1f('0x11')]===0x1f4){logger[_0x0d1f('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0xd8ea52,_0x294d19[_0x0d1f('0x10')][_0x0d1f('0x12')]);return _0x43e35d(_0x294d19[_0x0d1f('0x10')][_0x0d1f('0x12')]);}logger[_0x0d1f('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0xd8ea52,_0x294d19['error']['message']);return _0x1e0d7c(_0x294d19[_0x0d1f('0x10')][_0x0d1f('0x12')]);}else{logger['info'](_0x0d1f('0xc'),_0xd8ea52,'request\x20sent');_0x1e0d7c(_0x294d19[_0x0d1f('0x13')]['message']);}})[_0x0d1f('0x14')](function(_0x50baef){logger[_0x0d1f('0x10')](_0x0d1f('0xc'),_0xd8ea52,_0x50baef);_0x43e35d(_0x50baef);});});}exports[_0x0d1f('0x15')]=function(_0x12b737){var _0x32facb=this;return new Promise(function(_0x28f91a,_0x3f90d2){return db[_0x0d1f('0x16')]['create'](_0x12b737[_0x0d1f('0x17')],{'raw':_0x12b737[_0x0d1f('0x18')]?_0x12b737['options'][_0x0d1f('0x19')]===undefined?!![]:![]:!![]})[_0x0d1f('0xa')](function(_0x50d775){logger[_0x0d1f('0xb')]('CreateWhatsappQueueReport',_0x12b737);logger[_0x0d1f('0xe')](_0x0d1f('0x15'),_0x12b737,JSON[_0x0d1f('0xf')](_0x50d775));_0x28f91a(_0x50d775);})[_0x0d1f('0x14')](function(_0x5ce26b){logger[_0x0d1f('0x10')](_0x0d1f('0x15'),_0x5ce26b[_0x0d1f('0x12')],_0x12b737);_0x3f90d2(_0x32facb[_0x0d1f('0x10')](0x1f4,_0x5ce26b['message']));});});};exports[_0x0d1f('0x1a')]=function(_0x5670f8){var _0x349580=this;return new Promise(function(_0x135a72,_0x499650){return db[_0x0d1f('0x16')][_0x0d1f('0x1b')](_0x5670f8[_0x0d1f('0x17')],{'raw':_0x5670f8['options']?_0x5670f8[_0x0d1f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5670f8[_0x0d1f('0x18')]?_0x5670f8[_0x0d1f('0x18')][_0x0d1f('0x1c')]||null:null,'attributes':_0x5670f8[_0x0d1f('0x18')]?_0x5670f8[_0x0d1f('0x18')][_0x0d1f('0x1d')]||null:null,'limit':_0x5670f8['options']?_0x5670f8['options'][_0x0d1f('0x1e')]||null:null})[_0x0d1f('0xa')](function(_0x1db9db){logger[_0x0d1f('0xb')](_0x0d1f('0x1a'),_0x5670f8);logger[_0x0d1f('0xe')]('UpdateWhatsappQueueReport',_0x5670f8,JSON['stringify'](_0x1db9db));_0x135a72(_0x1db9db);})[_0x0d1f('0x14')](function(_0x1aa6b3){logger[_0x0d1f('0x10')](_0x0d1f('0x1a'),_0x1aa6b3[_0x0d1f('0x12')],_0x5670f8);_0x499650(_0x349580[_0x0d1f('0x10')](0x1f4,_0x1aa6b3[_0x0d1f('0x12')]));});});}; \ No newline at end of file +var _0xd3e9=['WhatsappQueueReport','create','body','options','raw','debug','UpdateWhatsappQueueReport','update','attributes','limit','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport'];(function(_0x3f4c70,_0x1b6b7d){var _0x4eb3fd=function(_0x9f2492){while(--_0x9f2492){_0x3f4c70['push'](_0x3f4c70['shift']());}};_0x4eb3fd(++_0x1b6b7d);}(_0xd3e9,0x16a));var _0x9d3e=function(_0x9a8162,_0x1f8f04){_0x9a8162=_0x9a8162-0x0;var _0x317d88=_0xd3e9[_0x9a8162];return _0x317d88;};'use strict';var _=require('lodash');var util=require(_0x9d3e('0x0'));var moment=require(_0x9d3e('0x1'));var BPromise=require('bluebird');var rs=require(_0x9d3e('0x2'));var fs=require('fs');var Redis=require(_0x9d3e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9d3e('0x4'))(_0x9d3e('0x5'));var config=require(_0x9d3e('0x6'));var jayson=require(_0x9d3e('0x7'));var client=jayson[_0x9d3e('0x8')][_0x9d3e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fb6e0,_0x59a434,_0xf47b29){return new BPromise(function(_0x26da0f,_0x200c3f){return client[_0x9d3e('0xa')](_0x1fb6e0,_0xf47b29)[_0x9d3e('0xb')](function(_0xc5f420){logger['info'](_0x9d3e('0xc'),_0x59a434,_0x9d3e('0xd'));logger['debug'](_0x9d3e('0xe'),_0x59a434,_0x9d3e('0xd'),JSON[_0x9d3e('0xf')](_0xc5f420));if(_0xc5f420[_0x9d3e('0x10')]){if(_0xc5f420[_0x9d3e('0x10')][_0x9d3e('0x11')]===0x1f4){logger[_0x9d3e('0x10')](_0x9d3e('0xc'),_0x59a434,_0xc5f420[_0x9d3e('0x10')]['message']);return _0x200c3f(_0xc5f420['error']['message']);}logger[_0x9d3e('0x10')](_0x9d3e('0xc'),_0x59a434,_0xc5f420['error']['message']);return _0x26da0f(_0xc5f420[_0x9d3e('0x10')][_0x9d3e('0x12')]);}else{logger['info'](_0x9d3e('0xc'),_0x59a434,_0x9d3e('0xd'));_0x26da0f(_0xc5f420[_0x9d3e('0x13')]['message']);}})[_0x9d3e('0x14')](function(_0x317aff){logger[_0x9d3e('0x10')](_0x9d3e('0xc'),_0x59a434,_0x317aff);_0x200c3f(_0x317aff);});});}exports[_0x9d3e('0x15')]=function(_0x3f5a18){var _0x3cb3a2=this;return new Promise(function(_0xdbbb0b,_0x132e87){return db[_0x9d3e('0x16')][_0x9d3e('0x17')](_0x3f5a18[_0x9d3e('0x18')],{'raw':_0x3f5a18[_0x9d3e('0x19')]?_0x3f5a18[_0x9d3e('0x19')][_0x9d3e('0x1a')]===undefined?!![]:![]:!![]})[_0x9d3e('0xb')](function(_0x19c130){logger['info']('CreateWhatsappQueueReport',_0x3f5a18);logger[_0x9d3e('0x1b')](_0x9d3e('0x15'),_0x3f5a18,JSON[_0x9d3e('0xf')](_0x19c130));_0xdbbb0b(_0x19c130);})['catch'](function(_0x163b9d){logger[_0x9d3e('0x10')]('CreateWhatsappQueueReport',_0x163b9d[_0x9d3e('0x12')],_0x3f5a18);_0x132e87(_0x3cb3a2['error'](0x1f4,_0x163b9d[_0x9d3e('0x12')]));});});};exports[_0x9d3e('0x1c')]=function(_0x24d012){var _0x782833=this;return new Promise(function(_0x5cb81a,_0x4ffe94){return db[_0x9d3e('0x16')][_0x9d3e('0x1d')](_0x24d012[_0x9d3e('0x18')],{'raw':_0x24d012['options']?_0x24d012[_0x9d3e('0x19')][_0x9d3e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24d012[_0x9d3e('0x19')]?_0x24d012[_0x9d3e('0x19')]['where']||null:null,'attributes':_0x24d012[_0x9d3e('0x19')]?_0x24d012[_0x9d3e('0x19')][_0x9d3e('0x1e')]||null:null,'limit':_0x24d012[_0x9d3e('0x19')]?_0x24d012['options'][_0x9d3e('0x1f')]||null:null})['then'](function(_0x547d94){logger['info'](_0x9d3e('0x1c'),_0x24d012);logger[_0x9d3e('0x1b')](_0x9d3e('0x1c'),_0x24d012,JSON[_0x9d3e('0xf')](_0x547d94));_0x5cb81a(_0x547d94);})[_0x9d3e('0x14')](function(_0x5d99ab){logger[_0x9d3e('0x10')](_0x9d3e('0x1c'),_0x5d99ab[_0x9d3e('0x12')],_0x24d012);_0x4ffe94(_0x782833[_0x9d3e('0x10')](0x1f4,_0x5d99ab[_0x9d3e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index c9a8d51..149f605 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 _0x923a=['show','post','create','put','/:id','update','delete','destroy','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x585526,_0x5887b6){var _0x2e9639=function(_0x20ac27){while(--_0x20ac27){_0x585526['push'](_0x585526['shift']());}};_0x2e9639(++_0x5887b6);}(_0x923a,0x184));var _0xa923=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x923a[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0xa923('0x0'));var util=require(_0xa923('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa923('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa923('0x3'));var interaction=require(_0xa923('0x4'));var config=require(_0xa923('0x5'));var controller=require('./whatsappTransferReport.controller');router[_0xa923('0x6')]('/',auth[_0xa923('0x7')](),controller[_0xa923('0x8')]);router[_0xa923('0x6')](_0xa923('0x9'),auth[_0xa923('0x7')](),controller[_0xa923('0xa')]);router[_0xa923('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xa923('0xb')]);router[_0xa923('0xc')]('/',auth[_0xa923('0x7')](),controller[_0xa923('0xd')]);router[_0xa923('0xe')](_0xa923('0xf'),auth[_0xa923('0x7')](),controller[_0xa923('0x10')]);router[_0xa923('0x11')](_0xa923('0xf'),auth[_0xa923('0x7')](),controller[_0xa923('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc40e=['../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','post','create','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x395914,_0x27b648){var _0x37a793=function(_0x3543de){while(--_0x3543de){_0x395914['push'](_0x395914['shift']());}};_0x37a793(++_0x27b648);}(_0xc40e,0x1af));var _0xec40=function(_0x4fdb2c,_0x5de99e){_0x4fdb2c=_0x4fdb2c-0x0;var _0x4f9222=_0xc40e[_0x4fdb2c];return _0x4f9222;};'use strict';var multer=require(_0xec40('0x0'));var util=require(_0xec40('0x1'));var path=require(_0xec40('0x2'));var timeout=require(_0xec40('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xec40('0x4'));var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0xec40('0x5')](),controller['index']);router[_0xec40('0x6')](_0xec40('0x7'),auth[_0xec40('0x5')](),controller[_0xec40('0x8')]);router['get'](_0xec40('0x9'),auth[_0xec40('0x5')](),controller['show']);router[_0xec40('0xa')]('/',auth['isAuthenticated'](),controller[_0xec40('0xb')]);router[_0xec40('0xc')](_0xec40('0x9'),auth['isAuthenticated'](),controller[_0xec40('0xd')]);router['delete']('/:id',auth[_0xec40('0x5')](),controller[_0xec40('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index d3b315b..ccecbbb 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 _0x5eed=['queue','DATE','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x5508db,_0x22ecbe){var _0x54ce94=function(_0x389047){while(--_0x389047){_0x5508db['push'](_0x5508db['shift']());}};_0x54ce94(++_0x22ecbe);}(_0x5eed,0x10a));var _0xd5ee=function(_0x3ee438,_0x586213){_0x3ee438=_0x3ee438-0x0;var _0x4ddc00=_0x5eed[_0x3ee438];return _0x4ddc00;};'use strict';var Sequelize=require(_0xd5ee('0x0'));module[_0xd5ee('0x1')]={'uniqueid':{'type':Sequelize[_0xd5ee('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd5ee('0x3')](_0xd5ee('0x4'),_0xd5ee('0x5'),_0xd5ee('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xd5ee('0x7')]}}; \ No newline at end of file +var _0x2b4f=['account','agent','queue','DATE','exports','ENUM'];(function(_0x4cce65,_0x40021e){var _0x4d1b45=function(_0x54d290){while(--_0x54d290){_0x4cce65['push'](_0x4cce65['shift']());}};_0x4d1b45(++_0x40021e);}(_0x2b4f,0x142));var _0xf2b4=function(_0x20c74c,_0x39fd99){_0x20c74c=_0x20c74c-0x0;var _0x446549=_0x2b4f[_0x20c74c];return _0x446549;};'use strict';var Sequelize=require('sequelize');module[_0xf2b4('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf2b4('0x1')](_0xf2b4('0x2'),_0xf2b4('0x3'),_0xf2b4('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf2b4('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 503c720..06f7032 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 _0xbb68=['sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','filters','fields','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','name','index','map','WhatsappTransferReport','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x4c19a1,_0x15197f){var _0x58ac50=function(_0x7c08c1){while(--_0x7c08c1){_0x4c19a1['push'](_0x4c19a1['shift']());}};_0x58ac50(++_0x15197f);}(_0xbb68,0xad));var _0x8bb6=function(_0x4afc24,_0x143a6a){_0x4afc24=_0x4afc24-0x0;var _0x31bcd7=_0xbb68[_0x4afc24];return _0x31bcd7;};'use strict';var emlformat=require(_0x8bb6('0x0'));var rimraf=require(_0x8bb6('0x1'));var zipdir=require(_0x8bb6('0x2'));var jsonpatch=require(_0x8bb6('0x3'));var rp=require(_0x8bb6('0x4'));var moment=require('moment');var BPromise=require(_0x8bb6('0x5'));var Mustache=require(_0x8bb6('0x6'));var util=require(_0x8bb6('0x7'));var path=require('path');var sox=require(_0x8bb6('0x8'));var csv=require('to-csv');var ejs=require(_0x8bb6('0x9'));var fs=require('fs');var fs_extra=require(_0x8bb6('0xa'));var _=require(_0x8bb6('0xb'));var squel=require(_0x8bb6('0xc'));var crypto=require(_0x8bb6('0xd'));var jsforce=require(_0x8bb6('0xe'));var deskjs=require(_0x8bb6('0xf'));var toCsv=require(_0x8bb6('0x10'));var querystring=require(_0x8bb6('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8bb6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8bb6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bb6('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8bb6('0x15'));var licenseUtil=require(_0x8bb6('0x16'));var db=require(_0x8bb6('0x17'))['db'];function respondWithStatusCode(_0x2394d2,_0x21985a){_0x21985a=_0x21985a||0xcc;return function(_0x92b2f){if(_0x92b2f){return _0x2394d2[_0x8bb6('0x18')](_0x21985a);}return _0x2394d2[_0x8bb6('0x19')](_0x21985a)[_0x8bb6('0x1a')]();};}function respondWithResult(_0x599eee,_0x25d1af){_0x25d1af=_0x25d1af||0xc8;return function(_0x4090df){if(_0x4090df){return _0x599eee[_0x8bb6('0x19')](_0x25d1af)[_0x8bb6('0x1b')](_0x4090df);}};}function respondWithFilteredResult(_0xf2a78d,_0x9ca8dd){return function(_0x16e982){if(_0x16e982){var _0x3b2a15=typeof _0x9ca8dd[_0x8bb6('0x1c')]===_0x8bb6('0x1d')&&typeof _0x9ca8dd[_0x8bb6('0x1e')]===_0x8bb6('0x1d');var _0x1e6f71=_0x16e982[_0x8bb6('0x1f')];var _0xd2b8a3=_0x3b2a15?0x0:_0x9ca8dd[_0x8bb6('0x1c')];var _0x379e22=_0x3b2a15?_0x16e982[_0x8bb6('0x1f')]:_0x9ca8dd[_0x8bb6('0x1c')]+_0x9ca8dd[_0x8bb6('0x1e')];var _0x4ed248;if(_0x379e22>=_0x1e6f71){_0x379e22=_0x1e6f71;_0x4ed248=0xc8;}else{_0x4ed248=0xce;}_0xf2a78d[_0x8bb6('0x19')](_0x4ed248);return _0xf2a78d[_0x8bb6('0x20')](_0x8bb6('0x21'),_0xd2b8a3+'-'+_0x379e22+'/'+_0x1e6f71)[_0x8bb6('0x1b')](_0x16e982);}return null;};}function patchUpdates(_0x2b5743){return function(_0x310bc1){try{jsonpatch[_0x8bb6('0x22')](_0x310bc1,_0x2b5743,!![]);}catch(_0x13bbaf){return BPromise[_0x8bb6('0x23')](_0x13bbaf);}return _0x310bc1['save']();};}function saveUpdates(_0x16a395,_0x4d75f8){return function(_0x432d37){if(_0x432d37){return _0x432d37[_0x8bb6('0x24')](_0x16a395)['then'](function(_0xeae0d0){return _0xeae0d0;});}return null;};}function removeEntity(_0x49b72e,_0x334d3b){return function(_0x3818de){if(_0x3818de){return _0x3818de[_0x8bb6('0x25')]()[_0x8bb6('0x26')](function(){_0x49b72e[_0x8bb6('0x19')](0xcc)[_0x8bb6('0x1a')]();});}};}function handleEntityNotFound(_0x5420f5,_0x3e87c5){return function(_0x1f3bd1){if(!_0x1f3bd1){_0x5420f5[_0x8bb6('0x18')](0x194);}return _0x1f3bd1;};}function handleError(_0x3e73b9,_0x39d8bf){_0x39d8bf=_0x39d8bf||0x1f4;return function(_0x1ccdac){logger[_0x8bb6('0x27')](_0x1ccdac['stack']);if(_0x1ccdac[_0x8bb6('0x28')]){delete _0x1ccdac['name'];}_0x3e73b9['status'](_0x39d8bf)['send'](_0x1ccdac);};}exports[_0x8bb6('0x29')]=function(_0x1dcf3b,_0x116d81){var _0x1fa0f2={},_0x2df9d7={},_0x468cb9={'count':0x0,'rows':[]};var _0x3934c0=_[_0x8bb6('0x2a')](db[_0x8bb6('0x2b')]['rawAttributes'],function(_0x29dffb){return{'name':_0x29dffb[_0x8bb6('0x2c')],'type':_0x29dffb['type'][_0x8bb6('0x2d')]};});_0x2df9d7[_0x8bb6('0x2e')]=_['map'](_0x3934c0,'name');_0x2df9d7[_0x8bb6('0x2f')]=_[_0x8bb6('0x30')](_0x1dcf3b[_0x8bb6('0x2f')]);_0x2df9d7['filters']=_[_0x8bb6('0x31')](_0x2df9d7[_0x8bb6('0x2e')],_0x2df9d7[_0x8bb6('0x2f')]);_0x1fa0f2[_0x8bb6('0x32')]=_[_0x8bb6('0x31')](_0x2df9d7['model'],qs['fields'](_0x1dcf3b[_0x8bb6('0x2f')]['fields']));_0x1fa0f2[_0x8bb6('0x32')]=_0x1fa0f2[_0x8bb6('0x32')][_0x8bb6('0x33')]?_0x1fa0f2[_0x8bb6('0x32')]:_0x2df9d7[_0x8bb6('0x2e')];if(!_0x1dcf3b['query'][_0x8bb6('0x34')](_0x8bb6('0x35'))){_0x1fa0f2[_0x8bb6('0x1e')]=qs[_0x8bb6('0x1e')](_0x1dcf3b[_0x8bb6('0x2f')]['limit']);_0x1fa0f2['offset']=qs['offset'](_0x1dcf3b['query'][_0x8bb6('0x1c')]);}_0x1fa0f2[_0x8bb6('0x36')]=qs['sort'](_0x1dcf3b[_0x8bb6('0x2f')][_0x8bb6('0x37')]);_0x1fa0f2['where']=qs['filters'](_[_0x8bb6('0x38')](_0x1dcf3b[_0x8bb6('0x2f')],_0x2df9d7['filters']),_0x3934c0);if(_0x1dcf3b[_0x8bb6('0x2f')][_0x8bb6('0x39')]){_0x1fa0f2[_0x8bb6('0x3a')]=_[_0x8bb6('0x3b')](_0x1fa0f2[_0x8bb6('0x3a')],{'$or':_[_0x8bb6('0x2a')](_0x3934c0,function(_0x5ae4ee){if(_0x5ae4ee[_0x8bb6('0x3c')]!==_0x8bb6('0x3d')){var _0x1f722c={};_0x1f722c[_0x5ae4ee['name']]={'$like':'%'+_0x1dcf3b[_0x8bb6('0x2f')][_0x8bb6('0x39')]+'%'};return _0x1f722c;}})});}_0x1fa0f2=_[_0x8bb6('0x3b')]({},_0x1fa0f2,_0x1dcf3b[_0x8bb6('0x3e')]);var _0x38dfe4={'where':_0x1fa0f2[_0x8bb6('0x3a')]};return db[_0x8bb6('0x2b')][_0x8bb6('0x1f')](_0x38dfe4)[_0x8bb6('0x26')](function(_0x521fbb){_0x468cb9[_0x8bb6('0x1f')]=_0x521fbb;if(_0x1dcf3b[_0x8bb6('0x2f')]['includeAll']){_0x1fa0f2[_0x8bb6('0x3f')]=[{'all':!![]}];}return db[_0x8bb6('0x2b')][_0x8bb6('0x40')](_0x1fa0f2);})[_0x8bb6('0x26')](function(_0x50c4e3){_0x468cb9[_0x8bb6('0x41')]=_0x50c4e3;return _0x468cb9;})[_0x8bb6('0x26')](respondWithFilteredResult(_0x116d81,_0x1fa0f2))[_0x8bb6('0x42')](handleError(_0x116d81,null));};exports[_0x8bb6('0x43')]=function(_0x1eeed1,_0x11128f){var _0x1906d={'raw':!![],'where':{'id':_0x1eeed1['params']['id']}},_0x19d5fc={};_0x19d5fc[_0x8bb6('0x2e')]=_['keys'](db[_0x8bb6('0x2b')][_0x8bb6('0x44')]);_0x19d5fc[_0x8bb6('0x2f')]=_[_0x8bb6('0x30')](_0x1eeed1[_0x8bb6('0x2f')]);_0x19d5fc[_0x8bb6('0x45')]=_[_0x8bb6('0x31')](_0x19d5fc[_0x8bb6('0x2e')],_0x19d5fc['query']);_0x1906d['attributes']=_[_0x8bb6('0x31')](_0x19d5fc[_0x8bb6('0x2e')],qs[_0x8bb6('0x46')](_0x1eeed1[_0x8bb6('0x2f')]['fields']));_0x1906d[_0x8bb6('0x32')]=_0x1906d[_0x8bb6('0x32')][_0x8bb6('0x33')]?_0x1906d[_0x8bb6('0x32')]:_0x19d5fc[_0x8bb6('0x2e')];if(_0x1eeed1['query'][_0x8bb6('0x47')]){_0x1906d[_0x8bb6('0x3f')]=[{'all':!![]}];}_0x1906d=_[_0x8bb6('0x3b')]({},_0x1906d,_0x1eeed1[_0x8bb6('0x3e')]);return db['WhatsappTransferReport'][_0x8bb6('0x48')](_0x1906d)[_0x8bb6('0x26')](handleEntityNotFound(_0x11128f,null))['then'](respondWithResult(_0x11128f,null))[_0x8bb6('0x42')](handleError(_0x11128f,null));};exports[_0x8bb6('0x49')]=function(_0xf77a1b,_0x77a32a){return db[_0x8bb6('0x2b')][_0x8bb6('0x49')](_0xf77a1b[_0x8bb6('0x4a')],{})[_0x8bb6('0x26')](respondWithResult(_0x77a32a,0xc9))[_0x8bb6('0x42')](handleError(_0x77a32a,null));};exports[_0x8bb6('0x24')]=function(_0x47d98d,_0x30f9c9){if(_0x47d98d['body']['id']){delete _0x47d98d[_0x8bb6('0x4a')]['id'];}return db[_0x8bb6('0x2b')][_0x8bb6('0x48')]({'where':{'id':_0x47d98d['params']['id']}})[_0x8bb6('0x26')](handleEntityNotFound(_0x30f9c9,null))[_0x8bb6('0x26')](saveUpdates(_0x47d98d[_0x8bb6('0x4a')],null))[_0x8bb6('0x26')](respondWithResult(_0x30f9c9,null))['catch'](handleError(_0x30f9c9,null));};exports[_0x8bb6('0x25')]=function(_0x42c5a3,_0x3f99f3){return db[_0x8bb6('0x2b')][_0x8bb6('0x48')]({'where':{'id':_0x42c5a3['params']['id']}})[_0x8bb6('0x26')](handleEntityNotFound(_0x3f99f3,null))['then'](removeEntity(_0x3f99f3,null))[_0x8bb6('0x42')](handleError(_0x3f99f3,null));};exports['describe']=function(_0x520378,_0x4a4c20){return db[_0x8bb6('0x2b')][_0x8bb6('0x4b')]()[_0x8bb6('0x26')](respondWithResult(_0x4a4c20,null))['catch'](handleError(_0x4a4c20,null));}; \ No newline at end of file +var _0x25e7=['params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','WhatsappTransferReport','findAll','rows','catch','show','fields','create','body','update','find'];(function(_0x16aa33,_0x215942){var _0x54fb25=function(_0x121b5a){while(--_0x121b5a){_0x16aa33['push'](_0x16aa33['shift']());}};_0x54fb25(++_0x215942);}(_0x25e7,0x1d6));var _0x725e=function(_0x357633,_0x254610){_0x357633=_0x357633-0x0;var _0x261faf=_0x25e7[_0x357633];return _0x261faf;};'use strict';var emlformat=require(_0x725e('0x0'));var rimraf=require(_0x725e('0x1'));var zipdir=require(_0x725e('0x2'));var jsonpatch=require(_0x725e('0x3'));var rp=require(_0x725e('0x4'));var moment=require(_0x725e('0x5'));var BPromise=require(_0x725e('0x6'));var Mustache=require(_0x725e('0x7'));var util=require(_0x725e('0x8'));var path=require(_0x725e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x725e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x725e('0xb'));var crypto=require(_0x725e('0xc'));var jsforce=require(_0x725e('0xd'));var deskjs=require(_0x725e('0xe'));var toCsv=require(_0x725e('0xf'));var querystring=require(_0x725e('0x10'));var Papa=require(_0x725e('0x11'));var Redis=require(_0x725e('0x12'));var authService=require(_0x725e('0x13'));var qs=require(_0x725e('0x14'));var as=require(_0x725e('0x15'));var hardwareService=require(_0x725e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x725e('0x17'));var config=require(_0x725e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11916d,_0x14218e){_0x14218e=_0x14218e||0xcc;return function(_0x5c5e44){if(_0x5c5e44){return _0x11916d[_0x725e('0x19')](_0x14218e);}return _0x11916d[_0x725e('0x1a')](_0x14218e)[_0x725e('0x1b')]();};}function respondWithResult(_0x4e0515,_0x3f8052){_0x3f8052=_0x3f8052||0xc8;return function(_0x221e02){if(_0x221e02){return _0x4e0515[_0x725e('0x1a')](_0x3f8052)[_0x725e('0x1c')](_0x221e02);}};}function respondWithFilteredResult(_0x24c3c1,_0x13fbfe){return function(_0x523422){if(_0x523422){var _0x156b99=typeof _0x13fbfe[_0x725e('0x1d')]===_0x725e('0x1e')&&typeof _0x13fbfe['limit']===_0x725e('0x1e');var _0x125fef=_0x523422[_0x725e('0x1f')];var _0x397e33=_0x156b99?0x0:_0x13fbfe[_0x725e('0x1d')];var _0x2811e7=_0x156b99?_0x523422['count']:_0x13fbfe[_0x725e('0x1d')]+_0x13fbfe[_0x725e('0x20')];var _0x1b8879;if(_0x2811e7>=_0x125fef){_0x2811e7=_0x125fef;_0x1b8879=0xc8;}else{_0x1b8879=0xce;}_0x24c3c1[_0x725e('0x1a')](_0x1b8879);return _0x24c3c1[_0x725e('0x21')](_0x725e('0x22'),_0x397e33+'-'+_0x2811e7+'/'+_0x125fef)['json'](_0x523422);}return null;};}function patchUpdates(_0x2fc416){return function(_0xd30de9){try{jsonpatch[_0x725e('0x23')](_0xd30de9,_0x2fc416,!![]);}catch(_0x40c21b){return BPromise[_0x725e('0x24')](_0x40c21b);}return _0xd30de9[_0x725e('0x25')]();};}function saveUpdates(_0x127c99,_0x262b01){return function(_0x7d0792){if(_0x7d0792){return _0x7d0792['update'](_0x127c99)[_0x725e('0x26')](function(_0x36cbab){return _0x36cbab;});}return null;};}function removeEntity(_0x389668,_0x3facae){return function(_0x5a8191){if(_0x5a8191){return _0x5a8191[_0x725e('0x27')]()['then'](function(){_0x389668['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aad7b,_0x1cbaae){return function(_0x2d3c55){if(!_0x2d3c55){_0x2aad7b['sendStatus'](0x194);}return _0x2d3c55;};}function handleError(_0xab6cfd,_0x8a138f){_0x8a138f=_0x8a138f||0x1f4;return function(_0x5a5bef){logger[_0x725e('0x28')](_0x5a5bef[_0x725e('0x29')]);if(_0x5a5bef['name']){delete _0x5a5bef[_0x725e('0x2a')];}_0xab6cfd['status'](_0x8a138f)['send'](_0x5a5bef);};}exports[_0x725e('0x2b')]=function(_0x5b8dec,_0x3b42bd){var _0x4cc4ad={},_0x4de2e0={},_0x9b5b7f={'count':0x0,'rows':[]};var _0x31a8ff=_[_0x725e('0x2c')](db['WhatsappTransferReport'][_0x725e('0x2d')],function(_0x5b03d9){return{'name':_0x5b03d9[_0x725e('0x2e')],'type':_0x5b03d9[_0x725e('0x2f')][_0x725e('0x30')]};});_0x4de2e0[_0x725e('0x31')]=_[_0x725e('0x2c')](_0x31a8ff,_0x725e('0x2a'));_0x4de2e0[_0x725e('0x32')]=_[_0x725e('0x33')](_0x5b8dec[_0x725e('0x32')]);_0x4de2e0[_0x725e('0x34')]=_[_0x725e('0x35')](_0x4de2e0['model'],_0x4de2e0[_0x725e('0x32')]);_0x4cc4ad[_0x725e('0x36')]=_['intersection'](_0x4de2e0[_0x725e('0x31')],qs['fields'](_0x5b8dec[_0x725e('0x32')]['fields']));_0x4cc4ad[_0x725e('0x36')]=_0x4cc4ad[_0x725e('0x36')][_0x725e('0x37')]?_0x4cc4ad[_0x725e('0x36')]:_0x4de2e0[_0x725e('0x31')];if(!_0x5b8dec[_0x725e('0x32')]['hasOwnProperty']('nolimit')){_0x4cc4ad[_0x725e('0x20')]=qs[_0x725e('0x20')](_0x5b8dec[_0x725e('0x32')]['limit']);_0x4cc4ad[_0x725e('0x1d')]=qs['offset'](_0x5b8dec[_0x725e('0x32')][_0x725e('0x1d')]);}_0x4cc4ad[_0x725e('0x38')]=qs[_0x725e('0x39')](_0x5b8dec['query']['sort']);_0x4cc4ad[_0x725e('0x3a')]=qs[_0x725e('0x34')](_[_0x725e('0x3b')](_0x5b8dec['query'],_0x4de2e0[_0x725e('0x34')]),_0x31a8ff);if(_0x5b8dec[_0x725e('0x32')][_0x725e('0x3c')]){_0x4cc4ad['where']=_[_0x725e('0x3d')](_0x4cc4ad['where'],{'$or':_[_0x725e('0x2c')](_0x31a8ff,function(_0x462dac){if(_0x462dac[_0x725e('0x2f')]!==_0x725e('0x3e')){var _0x46eaa0={};_0x46eaa0[_0x462dac['name']]={'$like':'%'+_0x5b8dec['query'][_0x725e('0x3c')]+'%'};return _0x46eaa0;}})});}_0x4cc4ad=_[_0x725e('0x3d')]({},_0x4cc4ad,_0x5b8dec[_0x725e('0x3f')]);var _0x5dd1d1={'where':_0x4cc4ad[_0x725e('0x3a')]};return db['WhatsappTransferReport'][_0x725e('0x1f')](_0x5dd1d1)[_0x725e('0x26')](function(_0x337e53){_0x9b5b7f[_0x725e('0x1f')]=_0x337e53;if(_0x5b8dec['query'][_0x725e('0x40')]){_0x4cc4ad[_0x725e('0x41')]=[{'all':!![]}];}return db[_0x725e('0x42')][_0x725e('0x43')](_0x4cc4ad);})[_0x725e('0x26')](function(_0x19ed0a){_0x9b5b7f[_0x725e('0x44')]=_0x19ed0a;return _0x9b5b7f;})['then'](respondWithFilteredResult(_0x3b42bd,_0x4cc4ad))[_0x725e('0x45')](handleError(_0x3b42bd,null));};exports[_0x725e('0x46')]=function(_0x58ebe3,_0x2200ad){var _0x3b7a87={'raw':!![],'where':{'id':_0x58ebe3['params']['id']}},_0x5e719e={};_0x5e719e['model']=_['keys'](db[_0x725e('0x42')][_0x725e('0x2d')]);_0x5e719e[_0x725e('0x32')]=_['keys'](_0x58ebe3[_0x725e('0x32')]);_0x5e719e['filters']=_['intersection'](_0x5e719e[_0x725e('0x31')],_0x5e719e[_0x725e('0x32')]);_0x3b7a87[_0x725e('0x36')]=_[_0x725e('0x35')](_0x5e719e[_0x725e('0x31')],qs[_0x725e('0x47')](_0x58ebe3['query'][_0x725e('0x47')]));_0x3b7a87['attributes']=_0x3b7a87[_0x725e('0x36')][_0x725e('0x37')]?_0x3b7a87['attributes']:_0x5e719e[_0x725e('0x31')];if(_0x58ebe3['query'][_0x725e('0x40')]){_0x3b7a87[_0x725e('0x41')]=[{'all':!![]}];}_0x3b7a87=_['merge']({},_0x3b7a87,_0x58ebe3['options']);return db[_0x725e('0x42')]['find'](_0x3b7a87)[_0x725e('0x26')](handleEntityNotFound(_0x2200ad,null))['then'](respondWithResult(_0x2200ad,null))['catch'](handleError(_0x2200ad,null));};exports['create']=function(_0x118ef5,_0x38a81f){return db['WhatsappTransferReport'][_0x725e('0x48')](_0x118ef5[_0x725e('0x49')],{})['then'](respondWithResult(_0x38a81f,0xc9))[_0x725e('0x45')](handleError(_0x38a81f,null));};exports[_0x725e('0x4a')]=function(_0x4d5415,_0x19f524){if(_0x4d5415[_0x725e('0x49')]['id']){delete _0x4d5415[_0x725e('0x49')]['id'];}return db[_0x725e('0x42')][_0x725e('0x4b')]({'where':{'id':_0x4d5415[_0x725e('0x4c')]['id']}})[_0x725e('0x26')](handleEntityNotFound(_0x19f524,null))[_0x725e('0x26')](saveUpdates(_0x4d5415[_0x725e('0x49')],null))[_0x725e('0x26')](respondWithResult(_0x19f524,null))['catch'](handleError(_0x19f524,null));};exports[_0x725e('0x27')]=function(_0x5e3678,_0x11e2f7){return db[_0x725e('0x42')][_0x725e('0x4b')]({'where':{'id':_0x5e3678[_0x725e('0x4c')]['id']}})[_0x725e('0x26')](handleEntityNotFound(_0x11e2f7,null))[_0x725e('0x26')](removeEntity(_0x11e2f7,null))[_0x725e('0x45')](handleError(_0x11e2f7,null));};exports[_0x725e('0x4d')]=function(_0x1f3097,_0xd366b9){return db[_0x725e('0x42')][_0x725e('0x4d')]()[_0x725e('0x26')](respondWithResult(_0xd366b9,null))[_0x725e('0x45')](handleError(_0xd366b9,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 5133d4a..08b0bd4 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 _0x9895=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','uniqueid','lodash'];(function(_0x4d349a,_0x3a4436){var _0x1e6feb=function(_0x251125){while(--_0x251125){_0x4d349a['push'](_0x4d349a['shift']());}};_0x1e6feb(++_0x3a4436);}(_0x9895,0x143));var _0x5989=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9895[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x5989('0x0'));var util=require(_0x5989('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5989('0x2'));var BPromise=require(_0x5989('0x3'));var rp=require(_0x5989('0x4'));var fs=require('fs');var path=require(_0x5989('0x5'));var rimraf=require(_0x5989('0x6'));var config=require(_0x5989('0x7'));var attributes=require(_0x5989('0x8'));module[_0x5989('0x9')]=function(_0x50c37f,_0x34613){return _0x50c37f['define'](_0x5989('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5989('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb99=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x2e8d17,_0x53fe1a){var _0x1e7193=function(_0x293828){while(--_0x293828){_0x2e8d17['push'](_0x2e8d17['shift']());}};_0x1e7193(++_0x53fe1a);}(_0xbb99,0x1ea));var _0x9bb9=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xbb99[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x9bb9('0x0'));var util=require(_0x9bb9('0x1'));var logger=require(_0x9bb9('0x2'))(_0x9bb9('0x3'));var moment=require(_0x9bb9('0x4'));var BPromise=require('bluebird');var rp=require(_0x9bb9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9bb9('0x6'));var config=require(_0x9bb9('0x7'));var attributes=require(_0x9bb9('0x8'));module[_0x9bb9('0x9')]=function(_0x1db273,_0x3dc6c3){return _0x1db273[_0x9bb9('0xa')](_0x9bb9('0xb'),attributes,{'tableName':_0x9bb9('0xc'),'paranoid':![],'indexes':[{'name':_0x9bb9('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 3f62ec7..d9f8ba2 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 _0x4331=['message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x4331,0x1b2));var _0x1433=function(_0x5f36cd,_0x37d4c9){_0x5f36cd=_0x5f36cd-0x0;var _0x49832a=_0x4331[_0x5f36cd];return _0x49832a;};'use strict';var _=require(_0x1433('0x0'));var util=require(_0x1433('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1433('0x2'));var fs=require('fs');var Redis=require(_0x1433('0x3'));var db=require(_0x1433('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1433('0x5'))(_0x1433('0x6'));var config=require(_0x1433('0x7'));var jayson=require(_0x1433('0x8'));var client=jayson['client'][_0x1433('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c19fd,_0x1815a7,_0x217f3e){return new BPromise(function(_0x11a55a,_0x238360){return client[_0x1433('0xa')](_0x2c19fd,_0x217f3e)['then'](function(_0x46524c){logger['info'](_0x1433('0xb'),_0x1815a7,_0x1433('0xc'));logger['debug'](_0x1433('0xd'),_0x1815a7,_0x1433('0xc'),JSON['stringify'](_0x46524c));if(_0x46524c[_0x1433('0xe')]){if(_0x46524c[_0x1433('0xe')][_0x1433('0xf')]===0x1f4){logger[_0x1433('0xe')](_0x1433('0xb'),_0x1815a7,_0x46524c[_0x1433('0xe')][_0x1433('0x10')]);return _0x238360(_0x46524c[_0x1433('0xe')][_0x1433('0x10')]);}logger[_0x1433('0xe')](_0x1433('0xb'),_0x1815a7,_0x46524c[_0x1433('0xe')][_0x1433('0x10')]);return _0x11a55a(_0x46524c['error']['message']);}else{logger['info'](_0x1433('0xb'),_0x1815a7,_0x1433('0xc'));_0x11a55a(_0x46524c['result'][_0x1433('0x10')]);}})[_0x1433('0x11')](function(_0x150b25){logger[_0x1433('0xe')](_0x1433('0xb'),_0x1815a7,_0x150b25);_0x238360(_0x150b25);});});} \ No newline at end of file +var _0x4ac7=['code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x12f44b,_0x4afed7){var _0x593d23=function(_0x22153b){while(--_0x22153b){_0x12f44b['push'](_0x12f44b['shift']());}};_0x593d23(++_0x4afed7);}(_0x4ac7,0x16c));var _0x74ac=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x4ac7[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require('lodash');var util=require(_0x74ac('0x0'));var moment=require(_0x74ac('0x1'));var BPromise=require(_0x74ac('0x2'));var rs=require(_0x74ac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x74ac('0x4'));var logger=require(_0x74ac('0x5'))('rpc');var config=require(_0x74ac('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x74ac('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d8ea9,_0x2ea448,_0x1a6eea){return new BPromise(function(_0x842c2a,_0x527a00){return client['request'](_0x3d8ea9,_0x1a6eea)[_0x74ac('0x8')](function(_0x1b5141){logger[_0x74ac('0x9')](_0x74ac('0xa'),_0x2ea448,_0x74ac('0xb'));logger[_0x74ac('0xc')](_0x74ac('0xd'),_0x2ea448,'request\x20sent',JSON[_0x74ac('0xe')](_0x1b5141));if(_0x1b5141['error']){if(_0x1b5141[_0x74ac('0xf')][_0x74ac('0x10')]===0x1f4){logger[_0x74ac('0xf')](_0x74ac('0xa'),_0x2ea448,_0x1b5141[_0x74ac('0xf')][_0x74ac('0x11')]);return _0x527a00(_0x1b5141[_0x74ac('0xf')]['message']);}logger[_0x74ac('0xf')](_0x74ac('0xa'),_0x2ea448,_0x1b5141['error'][_0x74ac('0x11')]);return _0x842c2a(_0x1b5141[_0x74ac('0xf')][_0x74ac('0x11')]);}else{logger[_0x74ac('0x9')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2ea448,'request\x20sent');_0x842c2a(_0x1b5141[_0x74ac('0x12')][_0x74ac('0x11')]);}})[_0x74ac('0x13')](function(_0x4f7177){logger[_0x74ac('0xf')](_0x74ac('0xa'),_0x2ea448,_0x4f7177);_0x527a00(_0x4f7177);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index baeba26..57921f7 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2e3b=['./config/schedule/cloud-provider','sync','then','default','listen','start','info','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','name','Online\x20apps:','map','online','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe'];(function(_0x36f066,_0x589ef4){var _0x1f04bd=function(_0x42964d){while(--_0x42964d){_0x36f066['push'](_0x36f066['shift']());}};_0x1f04bd(++_0x589ef4);}(_0x2e3b,0x81));var _0xb2e3=function(_0x37cb5a,_0x40533d){_0x37cb5a=_0x37cb5a-0x0;var _0x444171=_0x2e3b[_0x37cb5a];return _0x444171;};'use strict';var _=require('lodash');var db=require(_0xb2e3('0x0'))['db'];var seedDb=require(_0xb2e3('0x1'));var checkLicense=require(_0xb2e3('0x2'));var rpc=require(_0xb2e3('0x3'));var config=require(_0xb2e3('0x4'));var logger=require(_0xb2e3('0x5'))(_0xb2e3('0x6'));var pm2=require(_0xb2e3('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xb2e3('0x8'));var chat=require(_0xb2e3('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xb2e3('0xa'));var provider=require(_0xb2e3('0xb'));function main(){return db['sequelize'][_0xb2e3('0xc')]()[_0xb2e3('0xd')](function(){if(config['seedDB']){return seedDb[_0xb2e3('0xe')]();}})[_0xb2e3('0xd')](function(){return checkLicense[_0xb2e3('0xe')]();})[_0xb2e3('0xd')](function(){return rpc[_0xb2e3('0xf')]();})['then'](function(_0x146c29){logger['info'](_0x146c29);return chat[_0xb2e3('0x10')]();})[_0xb2e3('0xd')](function(){return whatsapp[_0xb2e3('0x10')]();})[_0xb2e3('0xd')](function(){return schedule[_0xb2e3('0x10')]();})[_0xb2e3('0xd')](function(){return transcribe[_0xb2e3('0x10')]();})['then'](function(){return provider['start']();})['then'](function(_0x3061ac){logger[_0xb2e3('0x11')](_0x3061ac);return pm2[_0xb2e3('0x10')](pm2Config);})[_0xb2e3('0xd')](function(_0x51e55b){var _0x312210=_0x51e55b[_0xb2e3('0x12')](function(_0x2f40ed){return typeof _0x2f40ed[_0xb2e3('0x13')]===_0xb2e3('0x14')&&_0x2f40ed[_0xb2e3('0x13')]>=0x0;});if(_0x312210[_0xb2e3('0x15')]>0x0){throw new Error(_0x312210[_0xb2e3('0x15')]+_0xb2e3('0x16')+_['map'](_0x312210,function(_0x5e10a9){return'\x22'+_0x5e10a9['pm2_env'][_0xb2e3('0x17')]+'\x22';}));}logger[_0xb2e3('0x11')](_0xb2e3('0x18'),_[_0xb2e3('0x19')](_[_0xb2e3('0x12')](_0x51e55b,{'status':_0xb2e3('0x1a')}),_0xb2e3('0x17'))['join']());logger[_0xb2e3('0x11')]('Offline\x20apps:',_[_0xb2e3('0x19')](_[_0xb2e3('0x12')](_0x51e55b,function(_0x101d96){return _0x101d96[_0xb2e3('0x1b')]!=='online';}),_0xb2e3('0x17'))['join']()||_0xb2e3('0x1c'));console[_0xb2e3('0x1d')](_0xb2e3('0x1e'));})[_0xb2e3('0x1f')](function(_0x59e4a4){console[_0xb2e3('0x1d')](_0xb2e3('0x20'),_0x59e4a4);logger[_0xb2e3('0x21')](_0xb2e3('0x22'),_0x59e4a4);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x1928=['name','Offline\x20apps:','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','filter','online'];(function(_0x8b47c9,_0x2730ae){var _0xfd93a5=function(_0x45ecf0){while(--_0x45ecf0){_0x8b47c9['push'](_0x8b47c9['shift']());}};_0xfd93a5(++_0x2730ae);}(_0x1928,0x138));var _0x8192=function(_0x35011c,_0x111320){_0x35011c=_0x35011c-0x0;var _0x4fa58d=_0x1928[_0x35011c];return _0x4fa58d;};'use strict';var _=require(_0x8192('0x0'));var db=require(_0x8192('0x1'))['db'];var seedDb=require(_0x8192('0x2'));var checkLicense=require('./config/license');var rpc=require(_0x8192('0x3'));var config=require(_0x8192('0x4'));var logger=require(_0x8192('0x5'))(_0x8192('0x6'));var pm2=require(_0x8192('0x7'));var pm2Config=require(_0x8192('0x8'));var schedule=require(_0x8192('0x9'));var chat=require(_0x8192('0xa'));var whatsapp=require(_0x8192('0xb'));var transcribe=require(_0x8192('0xc'));var provider=require(_0x8192('0xd'));function main(){return db[_0x8192('0xe')][_0x8192('0xf')]()[_0x8192('0x10')](function(){if(config['seedDB']){return seedDb[_0x8192('0x11')]();}})['then'](function(){return checkLicense[_0x8192('0x11')]();})[_0x8192('0x10')](function(){return rpc[_0x8192('0x12')]();})[_0x8192('0x10')](function(_0x4b69eb){logger[_0x8192('0x13')](_0x4b69eb);return chat[_0x8192('0x14')]();})[_0x8192('0x10')](function(){return whatsapp[_0x8192('0x14')]();})[_0x8192('0x10')](function(){return schedule['start']();})[_0x8192('0x10')](function(){return transcribe[_0x8192('0x14')]();})[_0x8192('0x10')](function(){return provider[_0x8192('0x14')]();})[_0x8192('0x10')](function(_0x45ad9d){logger[_0x8192('0x13')](_0x45ad9d);return pm2[_0x8192('0x14')](pm2Config);})[_0x8192('0x10')](function(_0x103d7e){var _0x31509d=_0x103d7e['filter'](function(_0x406b4b){return typeof _0x406b4b[_0x8192('0x15')]===_0x8192('0x16')&&_0x406b4b[_0x8192('0x15')]>=0x0;});if(_0x31509d['length']>0x0){throw new Error(_0x31509d[_0x8192('0x17')]+_0x8192('0x18')+_[_0x8192('0x19')](_0x31509d,function(_0x5c3593){return'\x22'+_0x5c3593[_0x8192('0x1a')]['name']+'\x22';}));}logger[_0x8192('0x13')](_0x8192('0x1b'),_[_0x8192('0x19')](_[_0x8192('0x1c')](_0x103d7e,{'status':_0x8192('0x1d')}),_0x8192('0x1e'))['join']());logger[_0x8192('0x13')](_0x8192('0x1f'),_[_0x8192('0x19')](_[_0x8192('0x1c')](_0x103d7e,function(_0x401aeb){return _0x401aeb['status']!==_0x8192('0x1d');}),_0x8192('0x1e'))['join']()||'None');console[_0x8192('0x20')](_0x8192('0x21'));})['catch'](function(_0x3816bc){console[_0x8192('0x20')](_0x8192('0x22'),_0x3816bc);logger[_0x8192('0x23')](_0x8192('0x24'),_0x3816bc);process[_0x8192('0x25')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 96e5bb7..28d443f 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 _0xf4f4=['isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','catch','headers','authorization','User','find','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','payload','promisify','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','bluebird','util','moment','secrets','session','role','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification'];(function(_0x25d3d0,_0x1bd7f9){var _0x5d6c1f=function(_0x524dd6){while(--_0x524dd6){_0x25d3d0['push'](_0x25d3d0['shift']());}};_0x5d6c1f(++_0x1bd7f9);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x19bfc5,_0x54a988){_0x19bfc5=_0x19bfc5-0x0;var _0x38ebd2=_0xf4f4[_0x19bfc5];return _0x38ebd2;};'use strict';var db=require(_0x4f4f('0x0'))['db'];var config=require(_0x4f4f('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x4f4f('0x2'));var encryptor=require(_0x4f4f('0x3'));var _=require(_0x4f4f('0x4'));var jwt=require(_0x4f4f('0x5'));var expressJwt=require(_0x4f4f('0x6'));var compose=require('composable-middleware');var basicAuth=require(_0x4f4f('0x7'));var crypto=require('crypto');var BPromise=require(_0x4f4f('0x8'));var util=require(_0x4f4f('0x9'));var moment=require(_0x4f4f('0xa'));var validateJwt=expressJwt({'secret':config[_0x4f4f('0xb')][_0x4f4f('0xc')]});var userAttributes=['id',_0x4f4f('0xd'),_0x4f4f('0xe'),_0x4f4f('0xf'),'internal',_0x4f4f('0x10'),_0x4f4f('0x11'),_0x4f4f('0x12'),_0x4f4f('0x13'),_0x4f4f('0x14'),_0x4f4f('0x15'),_0x4f4f('0x16'),_0x4f4f('0x17'),'smsPause','openchannelPause',_0x4f4f('0x18'),_0x4f4f('0x19'),_0x4f4f('0x1a'),_0x4f4f('0x1b'),_0x4f4f('0x1c'),_0x4f4f('0x1d'),'passwordResetAt',_0x4f4f('0x1e'),'phoneBarAutoAnswer',_0x4f4f('0x1f'),_0x4f4f('0x20'),_0x4f4f('0x21'),_0x4f4f('0x22'),'phoneBarEnableSettings',_0x4f4f('0x23'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0x4f4f('0x24'),_0x4f4f('0x25'),_0x4f4f('0x26'),_0x4f4f('0x27'),_0x4f4f('0x28'),_0x4f4f('0x29'),_0x4f4f('0x2a'),_0x4f4f('0x2b'),_0x4f4f('0x2c'),_0x4f4f('0x2d'),_0x4f4f('0x2e'),_0x4f4f('0x2f'),'chatAutoanswerDelay',_0x4f4f('0x30'),_0x4f4f('0x31'),_0x4f4f('0x32'),_0x4f4f('0x33'),_0x4f4f('0x34'),_0x4f4f('0x35'),_0x4f4f('0x36'),_0x4f4f('0x37'),_0x4f4f('0x38'),_0x4f4f('0x39'),_0x4f4f('0x3a')];exports[_0x4f4f('0x3b')]=function(){return this[_0x4f4f('0x3c')](!![])[_0x4f4f('0x3d')](function(_0x5bda88,_0x4f7261,_0x525529){if(_0x5bda88[_0x4f4f('0x3e')]){_0x525529();}else{return db[_0x4f4f('0x3f')]['findOne']({'where':{'id':_0x5bda88[_0x4f4f('0x40')]['id']},'attributes':['id',_0x4f4f('0x41'),_0x4f4f('0x42')],'raw':!![]})[_0x4f4f('0x43')](function(_0x113ff7){if(_0x113ff7&&_0x113ff7[_0x4f4f('0x41')]){return _0x4f7261[_0x4f4f('0x44')](_0x113ff7['disposition']===_0x4f4f('0x45')?0x195:0x193)[_0x4f4f('0x46')]({'message':_0x113ff7[_0x4f4f('0x42')]===_0x4f4f('0x45')?_0x4f4f('0x47'):'Forbidden.'});}else{_0x525529();}})[_0x4f4f('0x48')](function(_0xaf3de1){_0x525529(_0xaf3de1);});}});};exports[_0x4f4f('0x3c')]=function isAuthenticated(_0x5deda9){return compose()['use'](function(_0x4c2490,_0x73b8bb,_0x5b4f6a){var _0x354266;if(_0x4c2490[_0x4f4f('0x49')][_0x4f4f('0x4a')]){if(_['startsWith'](_0x4c2490[_0x4f4f('0x49')][_0x4f4f('0x4a')],'Basic')){var _0x413b71=basicAuth(_0x4c2490);db[_0x4f4f('0x4b')][_0x4f4f('0x4c')]({'where':{'name':_0x413b71['name']}})[_0x4f4f('0x43')](function(_0x343c75){if(!_0x343c75||!_0x343c75['authenticate'](_0x413b71['pass'])){return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x4d')});}_0x4c2490[_0x4f4f('0x3e')]={'id':_0x343c75['id']};_0x5b4f6a();})[_0x4f4f('0x48')](function(_0x8d0f53){_0x5b4f6a(_0x8d0f53);});}else if(_[_0x4f4f('0x4e')](_0x4c2490[_0x4f4f('0x49')][_0x4f4f('0x4a')],_0x4f4f('0x4f'))){validateJwt(_0x4c2490,_0x73b8bb,_0x5b4f6a);}else{if(_0x5deda9){_0x5b4f6a();}else{return _0x73b8bb['status'](0x193)['json']({'message':_0x4f4f('0x50')});}}}else if(_0x4c2490['query'][_0x4f4f('0x51')]){try{var _0x423c89={'audience':hardwareConf[_0x4f4f('0x52')](),'issuer':hardwareConf[_0x4f4f('0x52')]()};verifyJwt(_0x4c2490[_0x4f4f('0x53')][_0x4f4f('0x51')],_0x423c89)[_0x4f4f('0x43')](function(_0x24834a){return db[_0x4f4f('0x4b')][_0x4f4f('0x4c')]({'where':{'id':_0x24834a[_0x4f4f('0x54')]}})[_0x4f4f('0x43')](function(_0x492fac){_0x354266=_0x492fac;return db[_0x4f4f('0x55')][_0x4f4f('0x56')]({'where':{'id':0x1},'attributes':[_0x4f4f('0x57'),_0x4f4f('0x58')],'raw':!![]});})[_0x4f4f('0x43')](function(_0x34fe84){if(!_0x354266||!_[_0x4f4f('0x59')](_0x354266[_0x4f4f('0x5a')],_0x24834a[_0x4f4f('0x5b')])){return _0x73b8bb['status'](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x5c')});}if(_0x354266[_0x4f4f('0x5d')]){return _0x73b8bb['status'](0x191)['json']({'message':_0x4f4f('0x5e')});}if(_0x354266[_0x4f4f('0x5f')]){if(_0x34fe84[_0x4f4f('0x58')]>0x0){if(moment(_0x354266[_0x4f4f('0x60')])[_0x4f4f('0x61')](_0x34fe84[_0x4f4f('0x58')],_0x4f4f('0x62'))>moment()){return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x5e')});}}else{return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x4c2490[_0x4f4f('0x3e')]={'id':_0x354266['id']};_0x5b4f6a();});})[_0x4f4f('0x48')](function(){return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x5e')});});}catch(_0x598d65){_0x5b4f6a(_0x598d65);}}else if(_0x5deda9){_0x5b4f6a();}else{return _0x73b8bb['status'](0x193)[_0x4f4f('0x46')]({'message':_0x4f4f('0x50')});}})[_0x4f4f('0x3d')](function(_0xa8f1a5,_0x4a4184,_0x1aaf2c){if(_0xa8f1a5['user']){db[_0x4f4f('0x4b')]['find']({'where':{'id':_0xa8f1a5['user']['id']},'attributes':userAttributes})[_0x4f4f('0x43')](function(_0x4f3a0f){if(!_0x4f3a0f){return _0x4a4184[_0x4f4f('0x44')](0x194)[_0x4f4f('0x46')]({'message':'User\x20not\x20found.'});}_0xa8f1a5[_0x4f4f('0x3e')]=_0x4f3a0f;_0x1aaf2c();})[_0x4f4f('0x48')](function(_0x4e782c){_0x1aaf2c(_0x4e782c);});}else if(_0x5deda9){_0x1aaf2c();}else{return _0x4a4184[_0x4f4f('0x44')](0x194)[_0x4f4f('0x46')]({'message':_0x4f4f('0x63')});}});};exports[_0x4f4f('0x64')]=function canUpdate(){return compose()[_0x4f4f('0x3d')](function(_0x62b468,_0xb0d1b2,_0x15f0a1){return licenseUtil[_0x4f4f('0x65')]()[_0x4f4f('0x43')](function(_0x475969){if(_0x475969[_0x4f4f('0x66')]){_0x15f0a1();}else{return _0xb0d1b2[_0x4f4f('0x44')](0x193)[_0x4f4f('0x46')]({'message':_0x4f4f('0x67')});}})['catch'](function(_0x636b63){_0x15f0a1(_0x636b63);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x31349a,_0x4363c9,_0x5cf4da){return licenseUtil[_0x4f4f('0x65')]()[_0x4f4f('0x43')](function(_0xea9617){if(_0xea9617[_0x4f4f('0x68')]){_0x5cf4da();}else{return _0x4363c9[_0x4f4f('0x44')](0x193)['json']({'message':_0x4f4f('0x67')});}})[_0x4f4f('0x48')](function(_0x30674f){_0x5cf4da(_0x30674f);});});};exports[_0x4f4f('0x69')]=function(_0x196426,_0x433787,_0x29314b){_0x196426[_0x4f4f('0x69')]=!![];return _0x29314b();};exports[_0x4f4f('0x6a')]=function signToken(_0x540b3c){return signJwt(_0x540b3c);};exports[_0x4f4f('0x6b')]=function(_0xd3b763,_0x4b33a5){if(!_0xd3b763['user']){return _0x4b33a5['status'](0x194)[_0x4f4f('0x46')]({'message':_0x4f4f('0x6c')});}var _0x3a2ae3={'payload':{'id':_0xd3b763['user']['id'],'role':_0xd3b763[_0x4f4f('0x3e')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3a2ae3)[_0x4f4f('0x43')](function(_0x1c181e){_0x4b33a5[_0x4f4f('0x6d')](_0x4f4f('0x6e'),_0x1c181e);_0x4b33a5[_0x4f4f('0x6f')](_0x4f4f('0x70'));})[_0x4f4f('0x48')](function(_0x88054a){return _0x4b33a5[_0x4f4f('0x44')](0x1f4)['send'](_0x88054a);});};exports['retrieveApiKey']=function(_0x36cfcf){if(_[_0x4f4f('0x71')](_0x36cfcf['apiKeyNonce'])||_['isNil'](_0x36cfcf[_0x4f4f('0x72')])){return null;}else{return createJwt(_0x36cfcf);}};exports[_0x4f4f('0x73')]=function(_0x15fd73){_0x15fd73['apiKeyNonce']=generateNonce();_0x15fd73['apiKeyIat']=generateIssuedAt();return createJwt(_0x15fd73);};exports[_0x4f4f('0x74')]=function(_0x3205ef,_0x179998){var _0x3bd569=_0x3205ef[_0x4f4f('0x53')][_0x4f4f('0x51')];if(_0x3bd569){var _0xe66fc={'nonce':_0x179998[_0x4f4f('0x5a')],'iat':_0x179998[_0x4f4f('0x72')],'audience':hardwareConf[_0x4f4f('0x52')](),'issuer':hardwareConf[_0x4f4f('0x52')]()};return verifyJwt(_0x3bd569,_0xe66fc)['then'](function(){return generateApiKey(_0x179998);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x4f4f('0x75')]=function(_0x136d83){var _0x161943=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x161943[_0x4f4f('0x76')](_0x136d83))throw new db['Sequelize'][(_0x4f4f('0x77'))]('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[_0x4f4f('0x78')]=function(_0x3f57c2,_0x1c6489,_0x4901f5){var _0x550342=encryptor[_0x4f4f('0x79')](_0x1c6489)[_0x4f4f('0x7a')](',');for(var _0x4f26af=0x0;_0x4f26af<_0x4901f5;_0x4f26af++){if(!_0x550342[_0x4f26af])break;if(_0x3f57c2[_0x4f4f('0x7b')]()===_0x550342[_0x4f26af][_0x4f4f('0x7b')]()){var _0x1d48fb=util['format'](_0x4f4f('0x7c'),_0x4901f5);if(_0x4901f5===0x1){_0x1d48fb=_0x4f4f('0x7d');}throw new db[(_0x4f4f('0x7e'))]['ValidationError'](_0x1d48fb);}}return;};exports[_0x4f4f('0x7f')]=function(_0x5418cd,_0x35701d){var _0x3b637d=_0x35701d?encryptor[_0x4f4f('0x79')](_0x35701d)[_0x4f4f('0x7a')](','):[];if(_0x3b637d[_0x4f4f('0x80')]===0x5){_0x3b637d[_0x4f4f('0x81')](-0x1,0x1);}_0x3b637d[_0x4f4f('0x82')](_0x5418cd);return encryptor[_0x4f4f('0x83')](_0x3b637d[_0x4f4f('0x84')](','));};function signJwt(_0x36f369){var _0x269e0d=BPromise['promisify'](jwt[_0x4f4f('0x85')],{'context':jwt});var _0x297c9c=_0x36f369[_0x4f4f('0x86')]||config['secrets'][_0x4f4f('0xc')];return new BPromise(function(_0x43908e,_0x151c75){_0x269e0d(_0x36f369[_0x4f4f('0x87')],_0x297c9c,_0x36f369['options'])[_0x4f4f('0x43')](function(_0x213163){_0x43908e(_0x213163);})[_0x4f4f('0x48')](function(_0x24928a){_0x151c75(_0x24928a);});});}function verifyJwt(_0x157af6,_0x5e2ef4,_0xe105e9){var _0x484ae2=BPromise[_0x4f4f('0x88')](jwt[_0x4f4f('0x89')],{'context':jwt});var _0x2da4ea=_0xe105e9||config[_0x4f4f('0xb')][_0x4f4f('0xc')];return new BPromise(function(_0x23366b,_0x4bbbf6){_0x484ae2(_0x157af6,_0x2da4ea,_0x5e2ef4)['then'](function(_0x15c86f){_0x23366b(_0x15c86f);})['catch'](function(_0x4252fa){_0x4bbbf6(_0x4252fa);});});}function generateNonce(){return crypto[_0x4f4f('0x8a')](0x10)[_0x4f4f('0x8b')](_0x4f4f('0x8c'));}function generateIssuedAt(){return Math[_0x4f4f('0x8d')](Date[_0x4f4f('0x8e')]()/0x3e8)[_0x4f4f('0x8b')]();}function createJwt(_0x346ebb){var _0x356224={'payload':{'iat':_0x346ebb[_0x4f4f('0x72')],'nonce':_0x346ebb[_0x4f4f('0x5a')]},'options':{'algorithm':'HS512','subject':_0x346ebb['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x4f4f('0x52')]()}};return signJwt(_0x356224)[_0x4f4f('0x43')](function(_0x49c7c4){return{'iat':_0x346ebb[_0x4f4f('0x72')],'nonce':_0x346ebb[_0x4f4f('0x5a')],'token':_0x49c7c4};});} \ No newline at end of file +var _0xb7e7=['join','promisify','secret','payload','options','verify','hex','now','HS512','../../mysqldb','../../config/license/hardware','../encryptor','jsonwebtoken','composable-middleware','basic-auth','crypto','moment','secrets','session','fullname','name','internal','email','userpic','permissions','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','params','closed','disposition','status','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','Basic','User','authenticate','pass','Wrong\x20credentials.','user','startsWith','Bearer','query','apikey','getUuid','then','find','sub','Setting','findOne','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','catch','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','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~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','splice','unshift'];(function(_0x20fbe7,_0x37da5b){var _0x5f535c=function(_0x49b130){while(--_0x49b130){_0x20fbe7['push'](_0x20fbe7['shift']());}};_0x5f535c(++_0x37da5b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xb7e7[_0x4b7b62];return _0x2280df;};'use strict';var db=require(_0x7b7e('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x7b7e('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x7b7e('0x2'));var _=require('lodash');var jwt=require(_0x7b7e('0x3'));var expressJwt=require('express-jwt');var compose=require(_0x7b7e('0x4'));var basicAuth=require(_0x7b7e('0x5'));var crypto=require(_0x7b7e('0x6'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0x7b7e('0x7'));var validateJwt=expressJwt({'secret':config[_0x7b7e('0x8')][_0x7b7e('0x9')]});var userAttributes=['id','role',_0x7b7e('0xa'),_0x7b7e('0xb'),_0x7b7e('0xc'),_0x7b7e('0xd'),_0x7b7e('0xe'),_0x7b7e('0xf'),_0x7b7e('0x10'),'voicePause',_0x7b7e('0x11'),_0x7b7e('0x12'),_0x7b7e('0x13'),_0x7b7e('0x14'),_0x7b7e('0x15'),_0x7b7e('0x16'),_0x7b7e('0x17'),_0x7b7e('0x18'),_0x7b7e('0x19'),'crudPermissions',_0x7b7e('0x1a'),_0x7b7e('0x1b'),'alias',_0x7b7e('0x1c'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0x7b7e('0x1d'),_0x7b7e('0x1e'),_0x7b7e('0x1f'),_0x7b7e('0x20'),_0x7b7e('0x21'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0x7b7e('0x22'),_0x7b7e('0x23'),_0x7b7e('0x24'),_0x7b7e('0x25'),_0x7b7e('0x26'),_0x7b7e('0x27'),_0x7b7e('0x28'),_0x7b7e('0x29'),_0x7b7e('0x2a'),_0x7b7e('0x2b'),_0x7b7e('0x2c'),_0x7b7e('0x2d'),_0x7b7e('0x2e'),_0x7b7e('0x2f'),_0x7b7e('0x30'),_0x7b7e('0x31'),_0x7b7e('0x32'),'openchannelAutoanswer',_0x7b7e('0x33'),_0x7b7e('0x34'),_0x7b7e('0x35'),'whatsappAutoanswer',_0x7b7e('0x36'),_0x7b7e('0x37')];exports[_0x7b7e('0x38')]=function(){return this[_0x7b7e('0x39')](!![])[_0x7b7e('0x3a')](function(_0x303d8c,_0x28bf43,_0x10a66a){if(_0x303d8c['user']){_0x10a66a();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x303d8c[_0x7b7e('0x3b')]['id']},'attributes':['id',_0x7b7e('0x3c'),_0x7b7e('0x3d')],'raw':!![]})['then'](function(_0x51d3b1){if(_0x51d3b1&&_0x51d3b1['closed']){return _0x28bf43[_0x7b7e('0x3e')](_0x51d3b1[_0x7b7e('0x3d')]===_0x7b7e('0x3f')?0x195:0x193)[_0x7b7e('0x40')]({'message':_0x51d3b1[_0x7b7e('0x3d')]==='unmanaged'?_0x7b7e('0x41'):_0x7b7e('0x42')});}else{_0x10a66a();}})['catch'](function(_0x57b9da){_0x10a66a(_0x57b9da);});}});};exports['isAuthenticated']=function isAuthenticated(_0x12ef0b){return compose()[_0x7b7e('0x3a')](function(_0x503625,_0x3db8c4,_0x51d4b5){var _0x1b4341;if(_0x503625[_0x7b7e('0x43')][_0x7b7e('0x44')]){if(_['startsWith'](_0x503625[_0x7b7e('0x43')][_0x7b7e('0x44')],_0x7b7e('0x45'))){var _0x326dd2=basicAuth(_0x503625);db[_0x7b7e('0x46')]['find']({'where':{'name':_0x326dd2[_0x7b7e('0xb')]}})['then'](function(_0x23a453){if(!_0x23a453||!_0x23a453[_0x7b7e('0x47')](_0x326dd2[_0x7b7e('0x48')])){return _0x3db8c4[_0x7b7e('0x3e')](0x191)[_0x7b7e('0x40')]({'message':_0x7b7e('0x49')});}_0x503625[_0x7b7e('0x4a')]={'id':_0x23a453['id']};_0x51d4b5();})['catch'](function(_0x5227a7){_0x51d4b5(_0x5227a7);});}else if(_[_0x7b7e('0x4b')](_0x503625[_0x7b7e('0x43')]['authorization'],_0x7b7e('0x4c'))){validateJwt(_0x503625,_0x3db8c4,_0x51d4b5);}else{if(_0x12ef0b){_0x51d4b5();}else{return _0x3db8c4[_0x7b7e('0x3e')](0x193)[_0x7b7e('0x40')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x503625[_0x7b7e('0x4d')][_0x7b7e('0x4e')]){try{var _0x187184={'audience':hardwareConf[_0x7b7e('0x4f')](),'issuer':hardwareConf[_0x7b7e('0x4f')]()};verifyJwt(_0x503625[_0x7b7e('0x4d')][_0x7b7e('0x4e')],_0x187184)[_0x7b7e('0x50')](function(_0x44497c){return db[_0x7b7e('0x46')][_0x7b7e('0x51')]({'where':{'id':_0x44497c[_0x7b7e('0x52')]}})[_0x7b7e('0x50')](function(_0xdcb8ef){_0x1b4341=_0xdcb8ef;return db[_0x7b7e('0x53')][_0x7b7e('0x54')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x7b7e('0x55')],'raw':!![]});})[_0x7b7e('0x50')](function(_0xb20532){if(!_0x1b4341||!_[_0x7b7e('0x56')](_0x1b4341[_0x7b7e('0x57')],_0x44497c[_0x7b7e('0x58')])){return _0x3db8c4[_0x7b7e('0x3e')](0x191)[_0x7b7e('0x40')]({'message':_0x7b7e('0x59')});}if(_0x1b4341[_0x7b7e('0x5a')]){return _0x3db8c4['status'](0x191)[_0x7b7e('0x40')]({'message':_0x7b7e('0x5b')});}if(_0x1b4341[_0x7b7e('0x5c')]){if(_0xb20532[_0x7b7e('0x55')]>0x0){if(moment(_0x1b4341['blockedAt'])[_0x7b7e('0x5d')](_0xb20532[_0x7b7e('0x55')],_0x7b7e('0x5e'))>moment()){return _0x3db8c4['status'](0x191)['json']({'message':_0x7b7e('0x5b')});}}else{return _0x3db8c4['status'](0x191)[_0x7b7e('0x40')]({'message':_0x7b7e('0x5b')});}}_0x503625['user']={'id':_0x1b4341['id']};_0x51d4b5();});})[_0x7b7e('0x5f')](function(){return _0x3db8c4[_0x7b7e('0x3e')](0x191)[_0x7b7e('0x40')]({'message':_0x7b7e('0x5b')});});}catch(_0x38d32f){_0x51d4b5(_0x38d32f);}}else if(_0x12ef0b){_0x51d4b5();}else{return _0x3db8c4[_0x7b7e('0x3e')](0x193)[_0x7b7e('0x40')]({'message':_0x7b7e('0x60')});}})[_0x7b7e('0x3a')](function(_0x525a74,_0x5d61c1,_0x25b41e){if(_0x525a74['user']){db[_0x7b7e('0x46')]['find']({'where':{'id':_0x525a74['user']['id']},'attributes':userAttributes})[_0x7b7e('0x50')](function(_0x48252a){if(!_0x48252a){return _0x5d61c1[_0x7b7e('0x3e')](0x194)['json']({'message':_0x7b7e('0x61')});}_0x525a74[_0x7b7e('0x4a')]=_0x48252a;_0x25b41e();})[_0x7b7e('0x5f')](function(_0x231fdf){_0x25b41e(_0x231fdf);});}else if(_0x12ef0b){_0x25b41e();}else{return _0x5d61c1['status'](0x194)[_0x7b7e('0x40')]({'message':_0x7b7e('0x62')});}});};exports[_0x7b7e('0x63')]=function canUpdate(){return compose()[_0x7b7e('0x3a')](function(_0x3e4f21,_0xccdfc7,_0x5e8572){return licenseUtil['getLicense']()['then'](function(_0xc5280c){if(_0xc5280c[_0x7b7e('0x64')]){_0x5e8572();}else{return _0xccdfc7[_0x7b7e('0x3e')](0x193)[_0x7b7e('0x40')]({'message':_0x7b7e('0x65')});}})[_0x7b7e('0x5f')](function(_0x57380f){_0x5e8572(_0x57380f);});});};exports[_0x7b7e('0x66')]=function isWebrtcLicence(){return compose()[_0x7b7e('0x3a')](function(_0x5a0832,_0x5efcb8,_0x1dcb88){return licenseUtil[_0x7b7e('0x67')]()[_0x7b7e('0x50')](function(_0x378a29){if(_0x378a29[_0x7b7e('0x68')]){_0x1dcb88();}else{return _0x5efcb8[_0x7b7e('0x3e')](0x193)['json']({'message':_0x7b7e('0x65')});}})['catch'](function(_0x402793){_0x1dcb88(_0x402793);});});};exports[_0x7b7e('0x69')]=function(_0x2ea2b2,_0x5874e2,_0x58e4e6){_0x2ea2b2[_0x7b7e('0x69')]=!![];return _0x58e4e6();};exports[_0x7b7e('0x6a')]=function signToken(_0x45e0cf){return signJwt(_0x45e0cf);};exports[_0x7b7e('0x6b')]=function(_0x1f9d0f,_0x5cce7c){if(!_0x1f9d0f[_0x7b7e('0x4a')]){return _0x5cce7c[_0x7b7e('0x3e')](0x194)[_0x7b7e('0x40')]({'message':_0x7b7e('0x6c')});}var _0x4767f0={'payload':{'id':_0x1f9d0f['user']['id'],'role':_0x1f9d0f[_0x7b7e('0x4a')][_0x7b7e('0x6d')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4767f0)[_0x7b7e('0x50')](function(_0x3280fa){_0x5cce7c[_0x7b7e('0x6e')](_0x7b7e('0x6f'),_0x3280fa);_0x5cce7c[_0x7b7e('0x70')]('/dashboards/general');})[_0x7b7e('0x5f')](function(_0x5d7c89){return _0x5cce7c[_0x7b7e('0x3e')](0x1f4)[_0x7b7e('0x71')](_0x5d7c89);});};exports['retrieveApiKey']=function(_0x36f1be){if(_[_0x7b7e('0x72')](_0x36f1be[_0x7b7e('0x57')])||_[_0x7b7e('0x72')](_0x36f1be[_0x7b7e('0x73')])){return null;}else{return createJwt(_0x36f1be);}};exports[_0x7b7e('0x74')]=function(_0x337d06){_0x337d06['apiKeyNonce']=generateNonce();_0x337d06[_0x7b7e('0x73')]=generateIssuedAt();return createJwt(_0x337d06);};exports[_0x7b7e('0x75')]=function(_0x96752e,_0x24481a){var _0x5b9ab5=_0x96752e['query']['apikey'];if(_0x5b9ab5){var _0x2471ad={'nonce':_0x24481a[_0x7b7e('0x57')],'iat':_0x24481a[_0x7b7e('0x73')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x5b9ab5,_0x2471ad)[_0x7b7e('0x50')](function(){return generateApiKey(_0x24481a);});}else{throw{'message':_0x7b7e('0x76')};}};exports['validatePasswordPattern']=function(_0xf54f87){var _0xbe02ed=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xbe02ed[_0x7b7e('0x77')](_0xf54f87))throw new db['Sequelize'][(_0x7b7e('0x78'))](_0x7b7e('0x79'));return;};exports['validatePasswordHistory']=function(_0x25c933,_0x441c3c,_0x1d7db1){var _0x267aef=encryptor[_0x7b7e('0x7a')](_0x441c3c)[_0x7b7e('0x7b')](',');for(var _0x39eaf8=0x0;_0x39eaf8<_0x1d7db1;_0x39eaf8++){if(!_0x267aef[_0x39eaf8])break;if(_0x25c933[_0x7b7e('0x7c')]()===_0x267aef[_0x39eaf8][_0x7b7e('0x7c')]()){var _0x5509ad=util[_0x7b7e('0x7d')](_0x7b7e('0x7e'),_0x1d7db1);if(_0x1d7db1===0x1){_0x5509ad='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x7b7e('0x7f'))][(_0x7b7e('0x78'))](_0x5509ad);}}return;};exports[_0x7b7e('0x80')]=function(_0x59f2df,_0x1729e0){var _0x4fc349=_0x1729e0?encryptor[_0x7b7e('0x7a')](_0x1729e0)[_0x7b7e('0x7b')](','):[];if(_0x4fc349['length']===0x5){_0x4fc349[_0x7b7e('0x81')](-0x1,0x1);}_0x4fc349[_0x7b7e('0x82')](_0x59f2df);return encryptor['encryptString'](_0x4fc349[_0x7b7e('0x83')](','));};function signJwt(_0x369103){var _0x1d43af=BPromise[_0x7b7e('0x84')](jwt['sign'],{'context':jwt});var _0x101896=_0x369103[_0x7b7e('0x85')]||config[_0x7b7e('0x8')][_0x7b7e('0x9')];return new BPromise(function(_0x2dc7ad,_0x1b97d6){_0x1d43af(_0x369103[_0x7b7e('0x86')],_0x101896,_0x369103[_0x7b7e('0x87')])[_0x7b7e('0x50')](function(_0x13c676){_0x2dc7ad(_0x13c676);})['catch'](function(_0x191179){_0x1b97d6(_0x191179);});});}function verifyJwt(_0x5dde68,_0x53e2f7,_0x2b105a){var _0x7cbe6c=BPromise[_0x7b7e('0x84')](jwt[_0x7b7e('0x88')],{'context':jwt});var _0x5cd4ae=_0x2b105a||config[_0x7b7e('0x8')][_0x7b7e('0x9')];return new BPromise(function(_0x3f2825,_0x3d4b2d){_0x7cbe6c(_0x5dde68,_0x5cd4ae,_0x53e2f7)[_0x7b7e('0x50')](function(_0x2b2afd){_0x3f2825(_0x2b2afd);})['catch'](function(_0x1ebd58){_0x3d4b2d(_0x1ebd58);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x7b7e('0x89'));}function generateIssuedAt(){return Math['floor'](Date[_0x7b7e('0x8a')]()/0x3e8)['toString']();}function createJwt(_0x3c3d29){var _0x148dde={'payload':{'iat':_0x3c3d29['apiKeyIat'],'nonce':_0x3c3d29[_0x7b7e('0x57')]},'options':{'algorithm':_0x7b7e('0x8b'),'subject':_0x3c3d29['id']['toString'](),'issuer':hardwareConf[_0x7b7e('0x4f')](),'audience':hardwareConf[_0x7b7e('0x4f')]()}};return signJwt(_0x148dde)[_0x7b7e('0x50')](function(_0x430033){return{'iat':_0x3c3d29[_0x7b7e('0x73')],'nonce':_0x3c3d29[_0x7b7e('0x57')],'token':_0x430033};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 763a196..f518b7f 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 _0xdf01=['buildContactsQuery','fields','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','CmCustomField','findOne','slice','all','length','fieldType','type','map','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseQueryParameters','where','default','filter','clause','tags','user','skip','checkListsRestrictions','ids','tag','count'];(function(_0x38082b,_0x2a434e){var _0x5a76ff=function(_0x2e00b4){while(--_0x2e00b4){_0x38082b['push'](_0x38082b['shift']());}};_0x5a76ff(++_0x2a434e);}(_0xdf01,0xcb));var _0x1df0=function(_0x51b043,_0x1c2931){_0x51b043=_0x51b043-0x0;var _0x1ab4b9=_0xdf01[_0x51b043];return _0x1ab4b9;};'use strict';var _=require('lodash');var sqlUtils=require(_0x1df0('0x0'));var db=require(_0x1df0('0x1'))['db'];exports['findAll']=function(_0x1320c5,_0x2c1f5a,_0xd66c35,_0x4a0495){var _0x25fa25={'count':0x0,'rows':[]};var _0x452b9d=sqlUtils[_0x1df0('0x2')](_0x2c1f5a,_0x1320c5);if(_0x452b9d){return Promise[_0x1df0('0x3')](_0x25fa25);}var _0x3ba12f=sqlUtils[_0x1df0('0x4')]();var _0x2bd60f={};var _0x81421f=![];var _0x50b037=![];return Promise[_0x1df0('0x3')]()[_0x1df0('0x5')](function(){if(_0x1320c5[_0x1df0('0x6')]){return sqlUtils['parseAdvancedSearchFilter'](_0x1320c5['search'],_0x4a0495);}else{return sqlUtils[_0x1df0('0x7')](_0x1320c5,_0x4a0495);}})[_0x1df0('0x5')](function(_0x2a20d3){_0x3ba12f[_0x1df0('0x8')](_0x2a20d3[_0x1df0('0x9')]);_0x3ba12f[_0x1df0('0x8')](_0x2a20d3['fields']);_0x3ba12f[_0x1df0('0x8')](_0x2a20d3[_0x1df0('0xa')]);_0x3ba12f[_0x1df0('0x8')](_0x2a20d3['user'][_0x1df0('0xb')]);_0x2bd60f=_0x2a20d3[_0x1df0('0xc')];_0x50b037=_0x2a20d3[_0x1df0('0xd')][_0x1df0('0xe')];return sqlUtils[_0x1df0('0xf')](_0x2c1f5a,_0x1320c5,_0x50b037);})['then'](function(_0x141972){_0x3ba12f[_0x1df0('0x8')](_0x141972);var _0x4f9188=_0x1320c5[_0x1df0('0x6')]?_0x2bd60f[_0x1df0('0x10')]:_0x1320c5[_0x1df0('0x11')];_0x81421f=_0x4f9188?!![]:![];return sqlUtils['countFilteredContacts'](_0x3ba12f,_0x4f9188);})[_0x1df0('0x5')](function(_0x33003b){_0x25fa25['count']=_0x33003b;if(_0x25fa25[_0x1df0('0x12')]===0x0){return;}if(_0x1320c5['User']){_0x50b037=!![];}return sqlUtils[_0x1df0('0x13')](_0x3ba12f,_0x1320c5[_0x1df0('0x14')],_0xd66c35,_0x81421f,_0x2bd60f[_0x1df0('0xb')],_0x50b037);})[_0x1df0('0x5')](function(_0x5b3877){if(!_0x5b3877){return[];}return sqlUtils[_0x1df0('0x15')](_0x5b3877,_0x1320c5,_0xd66c35);})[_0x1df0('0x5')](function(_0x3edb69){_0x25fa25[_0x1df0('0x16')]=_0x3edb69;return _0x25fa25;})[_0x1df0('0x17')](function(_0x1b87ab){throw _0x1b87ab;});};exports[_0x1df0('0x18')]=function(){var _0x9dd5bb={};var _0x281e14=[];return db[_0x1df0('0x19')][_0x1df0('0x18')]()[_0x1df0('0x5')](function(_0x46d9f7){_0x9dd5bb=_0x46d9f7;var _0x51b782=Object[_0x1df0('0x1a')](_0x9dd5bb)[_0x1df0('0xa')](function(_0x21dfa4){return _[_0x1df0('0x1b')](_0x21dfa4,_0x1df0('0x1c'))?_0x21dfa4:undefined;});var _0x44185a=_0x51b782['map'](function(_0x5dabf0){return db[_0x1df0('0x1d')][_0x1df0('0x1e')]({'where':{'id':_0x5dabf0[_0x1df0('0x1f')](0x3)},'raw':!![]});});return Promise[_0x1df0('0x20')](_0x44185a);})[_0x1df0('0x5')](function(_0x11fa8c){for(var _0x382040=0x0;_0x382040<_0x11fa8c[_0x1df0('0x21')];_0x382040++){if(_0x11fa8c[_0x382040]){var _0xfbc720=_0x1df0('0x1c')+_0x11fa8c[_0x382040]['id'];_0x9dd5bb[_0xfbc720][_0x1df0('0x22')]=_0x11fa8c[_0x382040][_0x1df0('0x23')];}}_0x281e14=_[_0x1df0('0x24')](Object[_0x1df0('0x1a')](_0x9dd5bb),function(_0x505ee2){return{'name':_0x505ee2,'type':_0x9dd5bb[_0x505ee2][_0x1df0('0x23')]};});return _0x281e14;})[_0x1df0('0x17')](function(_0x2add43){throw _0x2add43;});}; \ No newline at end of file +var _0xbfde=['startsWith','findOne','slice','all','length','cf_','fieldType','type','map','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','fields','filter','user','clause','tags','skip','ids','tag','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys'];(function(_0x2222e2,_0x783ed6){var _0x2f8892=function(_0x5b9aaf){while(--_0x5b9aaf){_0x2222e2['push'](_0x2222e2['shift']());}};_0x2f8892(++_0x783ed6);}(_0xbfde,0xf3));var _0xebfd=function(_0x3bddfc,_0x57b0d2){_0x3bddfc=_0x3bddfc-0x0;var _0x12dde4=_0xbfde[_0x3bddfc];return _0x12dde4;};'use strict';var _=require(_0xebfd('0x0'));var sqlUtils=require(_0xebfd('0x1'));var db=require(_0xebfd('0x2'))['db'];exports[_0xebfd('0x3')]=function(_0x5d9858,_0x5f39ee,_0x4ada75,_0x4b3f1b){var _0x38e54e={'count':0x0,'rows':[]};var _0x228453=sqlUtils[_0xebfd('0x4')](_0x5f39ee,_0x5d9858);if(_0x228453){return Promise[_0xebfd('0x5')](_0x38e54e);}var _0x2eee70=sqlUtils['getContactsSubquery']();var _0x493c00={};var _0xda6b12=![];var _0x309420=![];return Promise['resolve']()[_0xebfd('0x6')](function(){if(_0x5d9858['search']){return sqlUtils[_0xebfd('0x7')](_0x5d9858[_0xebfd('0x8')],_0x4b3f1b);}else{return sqlUtils[_0xebfd('0x9')](_0x5d9858,_0x4b3f1b);}})[_0xebfd('0x6')](function(_0x2f996f){_0x2eee70[_0xebfd('0xa')](_0x2f996f[_0xebfd('0xb')]);_0x2eee70[_0xebfd('0xa')](_0x2f996f[_0xebfd('0xc')]);_0x2eee70[_0xebfd('0xa')](_0x2f996f[_0xebfd('0xd')]);_0x2eee70[_0xebfd('0xa')](_0x2f996f[_0xebfd('0xe')][_0xebfd('0xf')]);_0x493c00=_0x2f996f[_0xebfd('0x10')];_0x309420=_0x2f996f['user'][_0xebfd('0x11')];return sqlUtils['checkListsRestrictions'](_0x5f39ee,_0x5d9858,_0x309420);})[_0xebfd('0x6')](function(_0x50024a){_0x2eee70[_0xebfd('0xa')](_0x50024a);var _0x444a51=_0x5d9858[_0xebfd('0x8')]?_0x493c00[_0xebfd('0x12')]:_0x5d9858[_0xebfd('0x13')];_0xda6b12=_0x444a51?!![]:![];return sqlUtils[_0xebfd('0x14')](_0x2eee70,_0x444a51);})[_0xebfd('0x6')](function(_0xba39ee){_0x38e54e[_0xebfd('0x15')]=_0xba39ee;if(_0x38e54e['count']===0x0){return;}if(_0x5d9858[_0xebfd('0x16')]){_0x309420=!![];}return sqlUtils[_0xebfd('0x17')](_0x2eee70,_0x5d9858[_0xebfd('0xc')],_0x4ada75,_0xda6b12,_0x493c00[_0xebfd('0xf')],_0x309420);})[_0xebfd('0x6')](function(_0x593a77){if(!_0x593a77){return[];}return sqlUtils[_0xebfd('0x18')](_0x593a77,_0x5d9858,_0x4ada75);})[_0xebfd('0x6')](function(_0xfe51e6){_0x38e54e[_0xebfd('0x19')]=_0xfe51e6;return _0x38e54e;})[_0xebfd('0x1a')](function(_0x1055c8){throw _0x1055c8;});};exports[_0xebfd('0x1b')]=function(){var _0x342f6e={};var _0x4a78b4=[];return db[_0xebfd('0x1c')][_0xebfd('0x1b')]()[_0xebfd('0x6')](function(_0x22df3e){_0x342f6e=_0x22df3e;var _0x207a4e=Object[_0xebfd('0x1d')](_0x342f6e)[_0xebfd('0xd')](function(_0x5af778){return _[_0xebfd('0x1e')](_0x5af778,'cf_')?_0x5af778:undefined;});var _0x308d37=_0x207a4e['map'](function(_0x3edab4){return db['CmCustomField'][_0xebfd('0x1f')]({'where':{'id':_0x3edab4[_0xebfd('0x20')](0x3)},'raw':!![]});});return Promise[_0xebfd('0x21')](_0x308d37);})[_0xebfd('0x6')](function(_0x52dd97){for(var _0x1cfecf=0x0;_0x1cfecf<_0x52dd97[_0xebfd('0x22')];_0x1cfecf++){if(_0x52dd97[_0x1cfecf]){var _0x4f97b1=_0xebfd('0x23')+_0x52dd97[_0x1cfecf]['id'];_0x342f6e[_0x4f97b1][_0xebfd('0x24')]=_0x52dd97[_0x1cfecf][_0xebfd('0x25')];}}_0x4a78b4=_[_0xebfd('0x26')](Object[_0xebfd('0x1d')](_0x342f6e),function(_0x486c09){return{'name':_0x486c09,'type':_0x342f6e[_0x486c09]['type']};});return _0x4a78b4;})[_0xebfd('0x1a')](function(_0x3f2a14){throw _0x3f2a14;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index d3c58a6..ecf6a4e 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 _0x57e2=['Tag','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','map','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','filter','resolve','agent','getLists','attributes','c.id','limit','offset','subqry.id','having','DESC','order','subqry.','from','findAll','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','group','isEmpty','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','search','ListId','autocomplete','true','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','uc.CmContactId\x20=\x20','left_join','ct.CmContactId\x20=\x20','.id','firstName','phone','mobile','fax','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','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)','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','DATE','type','text','value','end'];(function(_0x5ab63e,_0xbede61){var _0x1366a2=function(_0x3e0083){while(--_0x3e0083){_0x5ab63e['push'](_0x5ab63e['shift']());}};_0x1366a2(++_0xbede61);}(_0x57e2,0x1ce));var _0x257e=function(_0x3f55b2,_0x38357b){_0x3f55b2=_0x3f55b2-0x0;var _0x24767b=_0x57e2[_0x3f55b2];return _0x24767b;};'use strict';var _=require(_0x257e('0x0'));var squel=require(_0x257e('0x1'));var as=require(_0x257e('0x2'));var qs=require(_0x257e('0x3'));var utils=require(_0x257e('0x4'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x2d4430,_0x49eb34){var _0x2d5169=![];if(_0x2d4430[_0x257e('0x5')]==='agent'&&!_0x49eb34[_0x257e('0x6')]&&!_0x49eb34[_0x257e('0x7')]&&_0x49eb34[_0x257e('0x8')]!==_0x257e('0x9')){_0x2d5169=!![];}return _0x2d5169;}function getContactsSubquery(){return squel[_0x257e('0xa')]()['from'](_0x257e('0xb'),'c')[_0x257e('0xc')](_0x257e('0xd'));}function applyJoinClauses(_0x1c110e,_0x34b7bd){var _0x4273ad=_0x34b7bd?'c':_0x257e('0xe');_0x1c110e['left_join']('cm_user_has_contacts','uc',_0x257e('0xf')+_0x4273ad+'.id')[_0x257e('0x10')]('cm_contact_has_tags','ct',_0x257e('0x11')+_0x4273ad+_0x257e('0x12'))[_0x257e('0x10')]('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x1c110e;}function addFieldsToQuery(_0x571ae2,_0xe1f7f9,_0x2d368c,_0x5c2bb8,_0x4ca42d){var _0x1d11d5=_0x4ca42d?'c':_0x257e('0xe');if(!_0xe1f7f9){_0xe1f7f9=['id',_0x257e('0x13'),'lastName',_0x257e('0x14'),_0x257e('0x15'),_0x257e('0x16'),'email',_0x257e('0x7'),_0x257e('0x17'),_0x257e('0x18'),_0x257e('0x19'),_0x257e('0x1a'),_0x257e('0x1b')];}else if(!_0xe1f7f9[_0x257e('0x1c')]('id')){_0xe1f7f9[_0x257e('0x1d')]('id');}var _0x30acc7=_0x2d368c&&_0x4ca42d||!_0x2d368c&&!_0x4ca42d;if(_0x5c2bb8){_0x30acc7=_0x5c2bb8&&_0x4ca42d||!_0x5c2bb8&&!_0x4ca42d;}_0xe1f7f9[_0x257e('0x1e')](function(_0x2e86ab){if(_0x2e86ab===_0x257e('0x1b')){if(_0x30acc7){_0x571ae2[_0x257e('0x1f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2e86ab);}else if(_0x2d368c||_0x5c2bb8){_0x571ae2['field'](_0x1d11d5+'.'+_0x2e86ab);}}else{_0x571ae2[_0x257e('0x1f')](_0x1d11d5+'.'+_0x2e86ab);}});return _0x571ae2;}function getSqlClauses(){var _0x269053={'default':squel[_0x257e('0x20')](),'fields':squel['expr'](),'filter':squel[_0x257e('0x20')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x257e('0x20')](),'skip':![]}};return _0x269053;}function parseTagParameter(_0xeb1a77){var _0x2a95d9=squel[_0x257e('0x20')]();if(_0xeb1a77){var _0x3f9907=utils[_0x257e('0x21')](_0xeb1a77);_0x3f9907[_0x257e('0x1e')](function(_0x3a6c80){_0x2a95d9['or'](_0x257e('0x22'),'%,'+_0x3a6c80+',%');});}return _0x2a95d9;}function parseSearchFilter(_0x3505bd){var _0x240dea=squel[_0x257e('0x20')]();if(_0x3505bd){var _0x30ae40=_0x3505bd[_0x257e('0x23')]('\x5c','\x5c\x5c')[_0x257e('0x23')](/'/g,'\x27\x27');if(_0x30ae40[_0x257e('0x24')]('\x20')[_0x257e('0x25')]>0x1){_0x240dea['or'](_0x257e('0x26'),qs['getFullTextValue'](_0x30ae40,!![]),null);}else{if(qs[_0x257e('0x27')](_0x30ae40)){_0x240dea['or'](_0x257e('0x28'),_0x30ae40+'%');_0x240dea['or']('c.phone\x20LIKE\x20?',_0x30ae40+'%');_0x240dea['or'](_0x257e('0x29'),_0x30ae40+'%');_0x240dea['or'](_0x257e('0x2a'),_0x30ae40+'%');}else if(qs['isEmail'](_0x30ae40)){_0x240dea['or']('c.email\x20LIKE\x20?',_0x30ae40+'%');}else{_0x240dea['or']('c.firstName\x20LIKE\x20?','%'+_0x30ae40+'%');_0x240dea['or'](_0x257e('0x2b'),'%'+_0x30ae40+'%');_0x240dea['or'](_0x257e('0x2c'),'%'+_0x30ae40+'%');}}}return _0x240dea;}function parseAdvancedSearchFilter(_0x1c0594,_0x1ab054){var _0x180b87=getSqlClauses();var _0x88285f=as[_0x257e('0x2d')](_0x1c0594);var _0x478f00=_0x88285f[_0x257e('0x2e')];for(var _0x2fd003=0x0;_0x2fd003<_0x88285f['conditions'][_0x257e('0x25')];_0x2fd003++){var _0x1b94a4=_0x88285f[_0x257e('0x2f')][_0x2fd003];var _0x4d6f9a='c';var _0x12731f=_[_0x257e('0x30')](_0x1ab054,[_0x257e('0x31'),_0x1b94a4['field']]);if(_0x12731f){if(_0x1b94a4[_0x257e('0x1f')]===_0x257e('0x32')||_0x12731f[_0x257e('0x33')]===_0x257e('0x34')){_0x1b94a4['castTo']=_0x257e('0x35');}var _0x3715f1=as['buildExpression'](_0x4d6f9a,_0x12731f[_0x257e('0x36')],_0x1b94a4);_0x180b87['default'][_0x478f00](_0x3715f1[_0x257e('0x37')],_0x3715f1[_0x257e('0x38')]['start'],_0x3715f1['value'][_0x257e('0x39')]);}else{if(_0x1b94a4[_0x257e('0x1f')]===_0x257e('0x3a')){var _0x5c5c5a=_0x1b94a4['value'][_0x257e('0x24')](',')['map'](function(_0x2d794c){return Number(_0x2d794c);});var _0x4a3c74=parseTagParameter(_0x5c5c5a);_0x180b87[_0x257e('0x3b')][_0x257e('0x3c')][_0x257e('0x3d')](_0x4a3c74);_0x180b87[_0x257e('0x3b')][_0x257e('0x3e')]=_0x5c5c5a;}else if(_0x1b94a4[_0x257e('0x1f')]===_0x257e('0x3f')){_0x180b87[_0x257e('0x40')]['clause']['and'](_0x257e('0x41'),_0x1b94a4[_0x257e('0x38')]);_0x180b87[_0x257e('0x40')][_0x257e('0x42')]=!![];}}}return _0x180b87;}function parseModelFields(_0x31a0ad,_0x19467d){var _0x2f4902=squel['expr']();var _0x286ae9=_(_0x31a0ad)['keys']()[_0x257e('0x43')](function(_0x2d7a79){return _[_0x257e('0x44')](_0x19467d,[_0x257e('0x31'),_0x2d7a79])?_0x2d7a79:undefined;})[_0x257e('0x45')]()[_0x257e('0x38')]();if(_0x31a0ad[_0x257e('0x46')]){_0x286ae9[_0x257e('0x1d')]('Contact');}if(_0x31a0ad[_0x257e('0x3f')]){_0x286ae9[_0x257e('0x1d')](_0x257e('0x3f'));}if(_0x286ae9[_0x257e('0x25')]>0x0){_0x286ae9[_0x257e('0x1e')](function(_0x379b8d){if(_0x379b8d===_0x257e('0x7')){_0x2f4902[_0x257e('0x3d')](_0x257e('0x47'),[][_0x257e('0x48')](_0x31a0ad[_0x379b8d]));}else if(_0x379b8d==='Contact'){var _0x6c86e3='%'+_0x31a0ad[_0x379b8d]+'%';_0x2f4902['and'](_0x257e('0x49'),_0x6c86e3);}else if(_0x379b8d==='User'){_0x2f4902[_0x257e('0x3d')](_0x257e('0x41'),_0x31a0ad[_0x379b8d]);}else{_0x2f4902[_0x257e('0x3d')]('c.'+_0x379b8d+_0x257e('0x4a'),_0x31a0ad[_0x379b8d]);}});}return _0x2f4902;}function parseQueryParameters(_0x10d48c,_0x2afb4f){var _0x126ad0=getSqlClauses();return Promise['resolve']()[_0x257e('0x4b')](function(){return parseModelFields(_0x10d48c,_0x2afb4f);})[_0x257e('0x4b')](function(_0x1f4b10){_0x126ad0[_0x257e('0x4c')][_0x257e('0x3d')](_0x1f4b10);return parseTagParameter(_0x10d48c['tag']);})[_0x257e('0x4b')](function(_0x130bee){_0x126ad0[_0x257e('0x3b')][_0x257e('0x3c')][_0x257e('0x3d')](_0x130bee);return parseSearchFilter(_0x10d48c[_0x257e('0x4d')]);})['then'](function(_0x5850e2){_0x126ad0[_0x257e('0x4d')]=_0x5850e2;return _0x126ad0;});}function checkListsRestrictions(_0xb57a28,_0x2f5c4b,_0x42ae99){var _0xe75213=squel[_0x257e('0x20')]();return Promise[_0x257e('0x4e')]()['then'](function(){if(_0x2f5c4b[_0x257e('0x6')]&&_0xb57a28[_0x257e('0x5')]===_0x257e('0x4f')&&!_0x42ae99){return _0xb57a28[_0x257e('0x50')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0xbb574a){if(_0xbb574a){if(_0xbb574a[_0x257e('0x25')]===0x0){_0xe75213['and']('c.ListId\x20IS\x20NULL');}else{_0xe75213[_0x257e('0x3d')](_0x257e('0x47'),_[_0x257e('0x43')](_0xbb574a,'id'));}}})[_0x257e('0x4b')](function(){return _0xe75213;});}function buildContactsQuery(_0x96047e,_0x4e0795,_0x3fcc23,_0x2fa8c1,_0xad8283,_0x4723f6){if(_0x4e0795){_0x4e0795=_0x3fcc23[_0x257e('0x51')];}_0x96047e=addFieldsToQuery(_0x96047e,_0x4e0795,_0x2fa8c1,_0x4723f6,!![]);var _0x5b0dc6=squel['select']();_0x5b0dc6=addFieldsToQuery(_0x5b0dc6,_0x4e0795,_0x2fa8c1,_0x4723f6,![]);if(_0x2fa8c1||_0x4723f6){_0x96047e=applyJoinClauses(_0x96047e,!![]);_0x96047e['group'](_0x257e('0x52'));if(_0x3fcc23['limit']){_0x5b0dc6['limit'](_0x3fcc23[_0x257e('0x53')]);}if(_0x3fcc23[_0x257e('0x54')]){_0x5b0dc6[_0x257e('0x54')](_0x3fcc23[_0x257e('0x54')]);}}else{_0x5b0dc6=applyJoinClauses(_0x5b0dc6,![]);_0x5b0dc6['group'](_0x257e('0x55'));if(_0x3fcc23[_0x257e('0x53')]){_0x96047e[_0x257e('0x53')](_0x3fcc23['limit']);}if(_0x3fcc23['offset']){_0x96047e[_0x257e('0x54')](_0x3fcc23[_0x257e('0x54')]);}}_0x5b0dc6[_0x257e('0x56')](_0xad8283);if(_0x3fcc23['order']){_0x3fcc23['order']['forEach'](function(_0x484d69){_0x96047e['order']('c.'+_0x484d69[0x0],_0x484d69[0x1]===_0x257e('0x57')?![]:!![]);_0x5b0dc6[_0x257e('0x58')](_0x257e('0x59')+_0x484d69[0x0],_0x484d69[0x1]===_0x257e('0x57')?![]:!![]);});}_0x5b0dc6[_0x257e('0x5a')](_0x96047e,_0x257e('0xe'));return _0x5b0dc6;}function getFilteredContacts(_0x592f2a){var _0x4f9247=[];return db[_0x257e('0x3a')][_0x257e('0x5b')]({'attributes':['id',_0x257e('0x31'),'color'],'raw':!![]})[_0x257e('0x4b')](function(_0xa4c2b2){_0x4f9247=_['keyBy'](_0xa4c2b2,'id');var _0x4de7a1={'type':db[_0x257e('0x5c')][_0x257e('0x5d')][_0x257e('0x5e')],'model':db[_0x257e('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x257e('0x60')][_0x257e('0x61')](_0x592f2a[_0x257e('0x62')](),_0x4de7a1);})['then'](function(_0x2c520a){_0x2c520a['forEach'](function(_0x3baf72){if(_0x3baf72['TagIds']){_0x3baf72[_0x257e('0x63')]=[];_0x3baf72[_0x257e('0x1b')][_0x257e('0x24')](',')[_0x257e('0x1e')](function(_0x1b3f1e){_0x3baf72[_0x257e('0x63')][_0x257e('0x1d')](_0x4f9247[_0x1b3f1e]);});}delete _0x3baf72['TagIds'];});return _0x2c520a;});}function countFilteredContacts(_0x4b6943,_0x512ab6){var _0x3ae89d=_0x4b6943[_0x257e('0x64')]();_0x3ae89d[_0x257e('0x1f')](_0x257e('0x65'));_0x3ae89d=applyJoinClauses(_0x3ae89d,!![]);_0x4b6943[_0x257e('0x66')](_0x257e('0x52'));var _0x1f5ff7=utils[_0x257e('0x21')](_0x512ab6);if(!_[_0x257e('0x67')](_0x1f5ff7)){_0x3ae89d[_0x257e('0xc')]('t.id\x20IN\x20?',_0x1f5ff7);}var _0x11c261={'type':db[_0x257e('0x5c')][_0x257e('0x5d')]['SELECT'],'raw':!![]};return db[_0x257e('0x60')][_0x257e('0x61')](_0x3ae89d[_0x257e('0x62')](),_0x11c261)[_0x257e('0x4b')](function(_0x3df872){return _0x3df872[0x0][_0x257e('0x65')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x0bb6=['exports','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','ListId','autocomplete','true','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','subqry','lastName','mobile','fax','email','CompanyId','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','text','value','end','Tag','split','and','tags','User','skip','keys','map','some','compact','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','filter','role','c.ListId\x20IN\x20?','attributes','select','limit','offset','group','subqry.id','having','order','from','keyBy','Sequelize','SELECT','sequelize','query','toString','Tags','clone','getSelectedTags','isEmpty','t.id\x20IN\x20?','COUNT(*)'];(function(_0x35387d,_0x1ba72f){var _0x3aba56=function(_0x42cd08){while(--_0x42cd08){_0x35387d['push'](_0x35387d['shift']());}};_0x3aba56(++_0x1ba72f);}(_0x0bb6,0xc9));var _0x60bb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bb6[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var squel=require(_0x60bb('0x0'));var as=require(_0x60bb('0x1'));var qs=require(_0x60bb('0x2'));var utils=require(_0x60bb('0x3'));var db=require(_0x60bb('0x4'))['db'];function skipContactsQuery(_0x42f9f8,_0x263f5a){var _0x1ebd7d=![];if(_0x42f9f8['role']===_0x60bb('0x5')&&!_0x263f5a[_0x60bb('0x6')]&&!_0x263f5a[_0x60bb('0x7')]&&_0x263f5a[_0x60bb('0x8')]!==_0x60bb('0x9')){_0x1ebd7d=!![];}return _0x1ebd7d;}function getContactsSubquery(){return squel['select']()['from'](_0x60bb('0xa'),'c')[_0x60bb('0xb')](_0x60bb('0xc'));}function applyJoinClauses(_0x2c6ae1,_0x1eddf9){var _0x4049b9=_0x1eddf9?'c':'subqry';_0x2c6ae1[_0x60bb('0xd')](_0x60bb('0xe'),'uc',_0x60bb('0xf')+_0x4049b9+_0x60bb('0x10'))[_0x60bb('0xd')]('cm_contact_has_tags','ct',_0x60bb('0x11')+_0x4049b9+_0x60bb('0x10'))[_0x60bb('0xd')]('tools_tags','t',_0x60bb('0x12'));return _0x2c6ae1;}function addFieldsToQuery(_0x56205a,_0x4ea8ed,_0x3efc6a,_0x51a9d8,_0x4ceab9){var _0x20d138=_0x4ceab9?'c':_0x60bb('0x13');if(!_0x4ea8ed){_0x4ea8ed=['id','firstName',_0x60bb('0x14'),'phone',_0x60bb('0x15'),_0x60bb('0x16'),_0x60bb('0x17'),_0x60bb('0x7'),_0x60bb('0x18'),'createdAt',_0x60bb('0x19'),_0x60bb('0x1a'),_0x60bb('0x1b')];}else if(!_0x4ea8ed[_0x60bb('0x1c')]('id')){_0x4ea8ed[_0x60bb('0x1d')]('id');}var _0x418117=_0x3efc6a&&_0x4ceab9||!_0x3efc6a&&!_0x4ceab9;if(_0x51a9d8){_0x418117=_0x51a9d8&&_0x4ceab9||!_0x51a9d8&&!_0x4ceab9;}_0x4ea8ed[_0x60bb('0x1e')](function(_0x4eaa6c){if(_0x4eaa6c===_0x60bb('0x1b')){if(_0x418117){_0x56205a[_0x60bb('0x1f')](_0x60bb('0x20'),_0x4eaa6c);}else if(_0x3efc6a||_0x51a9d8){_0x56205a[_0x60bb('0x1f')](_0x20d138+'.'+_0x4eaa6c);}}else{_0x56205a[_0x60bb('0x1f')](_0x20d138+'.'+_0x4eaa6c);}});return _0x56205a;}function getSqlClauses(){var _0x351ec5={'default':squel[_0x60bb('0x21')](),'fields':squel[_0x60bb('0x21')](),'filter':squel[_0x60bb('0x21')](),'tags':{'clause':squel[_0x60bb('0x21')](),'ids':null},'user':{'clause':squel[_0x60bb('0x21')](),'skip':![]}};return _0x351ec5;}function parseTagParameter(_0x239dff){var _0xb26ddc=squel[_0x60bb('0x21')]();if(_0x239dff){var _0xbc537e=utils['getSelectedTags'](_0x239dff);_0xbc537e[_0x60bb('0x1e')](function(_0x110068){_0xb26ddc['or'](_0x60bb('0x22'),'%,'+_0x110068+',%');});}return _0xb26ddc;}function parseSearchFilter(_0x2b9ced){var _0xbfa710=squel[_0x60bb('0x21')]();if(_0x2b9ced){var _0x48cdd8=_0x2b9ced['replace']('\x5c','\x5c\x5c')[_0x60bb('0x23')](/'/g,'\x27\x27');if(_0x48cdd8['split']('\x20')[_0x60bb('0x24')]>0x1){_0xbfa710['or'](_0x60bb('0x25'),qs[_0x60bb('0x26')](_0x48cdd8,!![]),null);}else{if(qs['isNumeric'](_0x48cdd8)){_0xbfa710['or'](_0x60bb('0x27'),_0x48cdd8+'%');_0xbfa710['or'](_0x60bb('0x28'),_0x48cdd8+'%');_0xbfa710['or'](_0x60bb('0x29'),_0x48cdd8+'%');_0xbfa710['or'](_0x60bb('0x2a'),_0x48cdd8+'%');}else if(qs[_0x60bb('0x2b')](_0x48cdd8)){_0xbfa710['or'](_0x60bb('0x2c'),_0x48cdd8+'%');}else{_0xbfa710['or']('c.firstName\x20LIKE\x20?','%'+_0x48cdd8+'%');_0xbfa710['or'](_0x60bb('0x2d'),'%'+_0x48cdd8+'%');_0xbfa710['or'](_0x60bb('0x2c'),'%'+_0x48cdd8+'%');}}}return _0xbfa710;}function parseAdvancedSearchFilter(_0x353bc2,_0x4c4ee7){var _0x1aa78e=getSqlClauses();var _0x30cf8e=as['parseSearch'](_0x353bc2);var _0x1ffc71=_0x30cf8e[_0x60bb('0x2e')];for(var _0x2bc151=0x0;_0x2bc151<_0x30cf8e['conditions'][_0x60bb('0x24')];_0x2bc151++){var _0x4ae717=_0x30cf8e['conditions'][_0x2bc151];var _0x3e9740='c';var _0x41977d=_['find'](_0x4c4ee7,[_0x60bb('0x2f'),_0x4ae717[_0x60bb('0x1f')]]);if(_0x41977d){if(_0x4ae717['field']===_0x60bb('0x30')||_0x41977d[_0x60bb('0x31')]===_0x60bb('0x32')){_0x4ae717[_0x60bb('0x33')]=_0x60bb('0x34');}var _0x2189cf=as[_0x60bb('0x35')](_0x3e9740,_0x41977d[_0x60bb('0x36')],_0x4ae717);_0x1aa78e['default'][_0x1ffc71](_0x2189cf[_0x60bb('0x37')],_0x2189cf[_0x60bb('0x38')]['start'],_0x2189cf[_0x60bb('0x38')][_0x60bb('0x39')]);}else{if(_0x4ae717[_0x60bb('0x1f')]===_0x60bb('0x3a')){var _0x39e32d=_0x4ae717[_0x60bb('0x38')][_0x60bb('0x3b')](',')['map'](function(_0x145af8){return Number(_0x145af8);});var _0x3bcd42=parseTagParameter(_0x39e32d);_0x1aa78e['tags']['clause'][_0x60bb('0x3c')](_0x3bcd42);_0x1aa78e[_0x60bb('0x3d')]['ids']=_0x39e32d;}else if(_0x4ae717['field']===_0x60bb('0x3e')){_0x1aa78e['user']['clause'][_0x60bb('0x3c')]('uc.UserId\x20=\x20?',_0x4ae717[_0x60bb('0x38')]);_0x1aa78e['user'][_0x60bb('0x3f')]=!![];}}}return _0x1aa78e;}function parseModelFields(_0x37ce80,_0x18e9bb){var _0x5ec96c=squel[_0x60bb('0x21')]();var _0x3b670d=_(_0x37ce80)[_0x60bb('0x40')]()[_0x60bb('0x41')](function(_0x28912f){return _[_0x60bb('0x42')](_0x18e9bb,[_0x60bb('0x2f'),_0x28912f])?_0x28912f:undefined;})[_0x60bb('0x43')]()[_0x60bb('0x38')]();if(_0x37ce80[_0x60bb('0x44')]){_0x3b670d[_0x60bb('0x1d')](_0x60bb('0x44'));}if(_0x37ce80['User']){_0x3b670d[_0x60bb('0x1d')]('User');}if(_0x3b670d[_0x60bb('0x24')]>0x0){_0x3b670d[_0x60bb('0x1e')](function(_0x47baea){if(_0x47baea===_0x60bb('0x7')){_0x5ec96c['and']('c.ListId\x20IN\x20?',[][_0x60bb('0x45')](_0x37ce80[_0x47baea]));}else if(_0x47baea===_0x60bb('0x44')){var _0x54ef3e='%'+_0x37ce80[_0x47baea]+'%';_0x5ec96c[_0x60bb('0x3c')](_0x60bb('0x46'),_0x54ef3e);}else if(_0x47baea==='User'){_0x5ec96c['and']('uc.UserId\x20=\x20?',_0x37ce80[_0x47baea]);}else{_0x5ec96c[_0x60bb('0x3c')]('c.'+_0x47baea+_0x60bb('0x47'),_0x37ce80[_0x47baea]);}});}return _0x5ec96c;}function parseQueryParameters(_0x1c821b,_0x5ca52e){var _0x1daa75=getSqlClauses();return Promise[_0x60bb('0x48')]()['then'](function(){return parseModelFields(_0x1c821b,_0x5ca52e);})[_0x60bb('0x49')](function(_0x450ccc){_0x1daa75[_0x60bb('0x4a')][_0x60bb('0x3c')](_0x450ccc);return parseTagParameter(_0x1c821b['tag']);})[_0x60bb('0x49')](function(_0x1c04be){_0x1daa75[_0x60bb('0x3d')]['clause']['and'](_0x1c04be);return parseSearchFilter(_0x1c821b[_0x60bb('0x4b')]);})[_0x60bb('0x49')](function(_0x79dafe){_0x1daa75[_0x60bb('0x4b')]=_0x79dafe;return _0x1daa75;});}function checkListsRestrictions(_0x10d8ad,_0x57a971,_0x1e645d){var _0x2714be=squel[_0x60bb('0x21')]();return Promise[_0x60bb('0x48')]()[_0x60bb('0x49')](function(){if(_0x57a971[_0x60bb('0x6')]&&_0x10d8ad[_0x60bb('0x4c')]===_0x60bb('0x5')&&!_0x1e645d){return _0x10d8ad['getLists']({'attributes':['id'],'raw':!![]});}})['then'](function(_0x575f1f){if(_0x575f1f){if(_0x575f1f[_0x60bb('0x24')]===0x0){_0x2714be[_0x60bb('0x3c')]('c.ListId\x20IS\x20NULL');}else{_0x2714be[_0x60bb('0x3c')](_0x60bb('0x4d'),_[_0x60bb('0x41')](_0x575f1f,'id'));}}})[_0x60bb('0x49')](function(){return _0x2714be;});}function buildContactsQuery(_0x4ad795,_0x146d72,_0x5e1200,_0x1bc63c,_0x4b532a,_0x1b283f){if(_0x146d72){_0x146d72=_0x5e1200[_0x60bb('0x4e')];}_0x4ad795=addFieldsToQuery(_0x4ad795,_0x146d72,_0x1bc63c,_0x1b283f,!![]);var _0x5e4f9b=squel[_0x60bb('0x4f')]();_0x5e4f9b=addFieldsToQuery(_0x5e4f9b,_0x146d72,_0x1bc63c,_0x1b283f,![]);if(_0x1bc63c||_0x1b283f){_0x4ad795=applyJoinClauses(_0x4ad795,!![]);_0x4ad795['group']('c.id');if(_0x5e1200[_0x60bb('0x50')]){_0x5e4f9b[_0x60bb('0x50')](_0x5e1200['limit']);}if(_0x5e1200['offset']){_0x5e4f9b[_0x60bb('0x51')](_0x5e1200[_0x60bb('0x51')]);}}else{_0x5e4f9b=applyJoinClauses(_0x5e4f9b,![]);_0x5e4f9b[_0x60bb('0x52')](_0x60bb('0x53'));if(_0x5e1200[_0x60bb('0x50')]){_0x4ad795[_0x60bb('0x50')](_0x5e1200[_0x60bb('0x50')]);}if(_0x5e1200['offset']){_0x4ad795[_0x60bb('0x51')](_0x5e1200[_0x60bb('0x51')]);}}_0x5e4f9b[_0x60bb('0x54')](_0x4b532a);if(_0x5e1200['order']){_0x5e1200['order'][_0x60bb('0x1e')](function(_0x15071d){_0x4ad795[_0x60bb('0x55')]('c.'+_0x15071d[0x0],_0x15071d[0x1]==='DESC'?![]:!![]);_0x5e4f9b[_0x60bb('0x55')]('subqry.'+_0x15071d[0x0],_0x15071d[0x1]==='DESC'?![]:!![]);});}_0x5e4f9b[_0x60bb('0x56')](_0x4ad795,_0x60bb('0x13'));return _0x5e4f9b;}function getFilteredContacts(_0x4d7acb){var _0x502621=[];return db[_0x60bb('0x3a')]['findAll']({'attributes':['id','name','color'],'raw':!![]})[_0x60bb('0x49')](function(_0x40b30e){_0x502621=_[_0x60bb('0x57')](_0x40b30e,'id');var _0x2e425f={'type':db[_0x60bb('0x58')]['QueryTypes'][_0x60bb('0x59')],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x60bb('0x5a')][_0x60bb('0x5b')](_0x4d7acb[_0x60bb('0x5c')](),_0x2e425f);})[_0x60bb('0x49')](function(_0x44a0c8){_0x44a0c8[_0x60bb('0x1e')](function(_0x3574da){if(_0x3574da[_0x60bb('0x1b')]){_0x3574da['Tags']=[];_0x3574da[_0x60bb('0x1b')]['split'](',')[_0x60bb('0x1e')](function(_0x33cfe0){_0x3574da[_0x60bb('0x5d')][_0x60bb('0x1d')](_0x502621[_0x33cfe0]);});}delete _0x3574da[_0x60bb('0x1b')];});return _0x44a0c8;});}function countFilteredContacts(_0x579f18,_0x23bc8a){var _0x52265d=_0x579f18[_0x60bb('0x5e')]();_0x52265d[_0x60bb('0x1f')]('COUNT(*)');_0x52265d=applyJoinClauses(_0x52265d,!![]);_0x579f18[_0x60bb('0x52')]('c.id');var _0x500d4b=utils[_0x60bb('0x5f')](_0x23bc8a);if(!_[_0x60bb('0x60')](_0x500d4b)){_0x52265d[_0x60bb('0xb')](_0x60bb('0x61'),_0x500d4b);}var _0x3f4fc3={'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]};return db['sequelize']['query'](_0x52265d['toString'](),_0x3f4fc3)[_0x60bb('0x49')](function(_0x566bf2){return _0x566bf2[0x0][_0x60bb('0x62')];});}module[_0x60bb('0x63')]={'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 b165a2e..3af72c0 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 _0x4f17=['lodash','../../config/environment','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','binary','end','final','write','unlink','decryptFile','createDecipher','data','update','encryptString','secret','utf8','base64','crypto','bluebird'];(function(_0x1f0679,_0x53d43c){var _0x3dc3a4=function(_0x49ba8f){while(--_0x49ba8f){_0x1f0679['push'](_0x1f0679['shift']());}};_0x3dc3a4(++_0x53d43c);}(_0x4f17,0xa3));var _0x74f1=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x4f17[_0x673722];return _0x21249c;};'use strict';var crypto=require(_0x74f1('0x0'));var fs=require('fs');var BPromise=require(_0x74f1('0x1'));var _=require(_0x74f1('0x2'));var config=require(_0x74f1('0x3'));var logger=require('../../config/logger')(_0x74f1('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x74f1('0x5')]['session'],'algorithm':_0x74f1('0x6')};const fileOptions={'algorithm':_0x74f1('0x7')};if(config[_0x74f1('0x8')]&&config[_0x74f1('0x8')][_0x74f1('0x9')]){var isSupported=isAlgorithmSupported(config[_0x74f1('0x8')][_0x74f1('0x9')]);if(isSupported){fileOptions[_0x74f1('0x9')]=config[_0x74f1('0x8')][_0x74f1('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x74f1('0xa')](',\x20');logger[_0x74f1('0xb')](config[_0x74f1('0x8')]['algorithm'],_0x74f1('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x2004d8){return AES_SUPPORTED_RX['test'](_0x2004d8);}function getSupportedCiphers(){return crypto[_0x74f1('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x18ec6e){return getSupportedCiphers()[_0x74f1('0xe')](_0x18ec6e)>-0x1;}function combineOptions(_0x26a42f){var _0x18b76f={};for(var _0xa1696c in fileOptions){if(fileOptions[_0x74f1('0xf')](_0xa1696c)){_0x18b76f[_0xa1696c]=fileOptions[_0xa1696c];}}if(_0x26a42f){for(var _0x25852b in _0x26a42f){if(_0x26a42f[_0x74f1('0xf')](_0x25852b)){_0x18b76f[_0x25852b]=_0x26a42f[_0x25852b];}}}return _0x18b76f;}exports[_0x74f1('0x10')]=function(_0x3fab8e,_0x2241aa,_0x4a7be8,_0x1cad80){return new BPromise(function(_0x3b261c,_0x1e6bf8){_0x1cad80=combineOptions(_0x1cad80);var _0x4f284a=new Buffer(_0x4a7be8);var _0x49f5b4=fs[_0x74f1('0x11')](_0x3fab8e);var _0x530fa2=fs[_0x74f1('0x12')](_0x2241aa);var _0x1d69ad=crypto[_0x74f1('0x13')](_0x1cad80['algorithm'],_0x4f284a);_0x49f5b4['on']('data',function(_0x45c84b){var _0x3d8381=new Buffer(_0x1d69ad['update'](_0x45c84b),_0x74f1('0x14'));_0x530fa2['write'](_0x3d8381);});_0x49f5b4['on'](_0x74f1('0x15'),function(){try{var _0x39247c=new Buffer(_0x1d69ad[_0x74f1('0x16')](_0x74f1('0x14')),_0x74f1('0x14'));_0x530fa2[_0x74f1('0x17')](_0x39247c);_0x530fa2[_0x74f1('0x15')]();_0x530fa2['on']('close',function(){return _0x3b261c(_0x2241aa);});}catch(_0x26bc1a){fs[_0x74f1('0x18')](_0x2241aa);return _0x1e6bf8(_0x26bc1a);}});});};exports[_0x74f1('0x19')]=function(_0x11ecb,_0x118026,_0x17cbd4,_0x4c99d5){return new BPromise(function(_0x38dc22,_0x44467d){_0x4c99d5=combineOptions(_0x4c99d5);var _0x2b195e=new Buffer(_0x17cbd4);var _0x3948c2=fs[_0x74f1('0x11')](_0x11ecb);var _0x16ccc0=fs[_0x74f1('0x12')](_0x118026);var _0x3af566=crypto[_0x74f1('0x1a')](_0x4c99d5['algorithm'],_0x2b195e);_0x3948c2['on'](_0x74f1('0x1b'),function(_0x24cf21){var _0x170953=new Buffer(_0x3af566[_0x74f1('0x1c')](_0x24cf21),'binary');_0x16ccc0[_0x74f1('0x17')](_0x170953);});_0x3948c2['on'](_0x74f1('0x15'),function(){try{var _0x520ea3=new Buffer(_0x3af566['final'](_0x74f1('0x14')),_0x74f1('0x14'));_0x16ccc0[_0x74f1('0x17')](_0x520ea3);_0x16ccc0['end']();_0x16ccc0['on']('close',function(){return _0x38dc22(_0x118026);});}catch(_0x2de12b){fs['unlink'](_0x118026);return _0x44467d(_0x2de12b);}});});};exports[_0x74f1('0x1d')]=function(_0x4c8955,_0x32d0ad,_0xd1f523){var _0x255d5e=_0xd1f523||stringOptions['algorithm'];var _0x5a3718=_0x32d0ad||stringOptions[_0x74f1('0x1e')];var _0x41cc85=crypto['createCipher'](_0x255d5e,_0x5a3718);var _0x109bd5=_0x41cc85[_0x74f1('0x1c')](_0x4c8955,_0x74f1('0x1f'),'base64');_0x109bd5+=_0x41cc85['final'](_0x74f1('0x20'));return _0x109bd5;};exports['decryptString']=function(_0x1c691b,_0x32dd4c,_0x37e81f){var _0x294aac=_0x37e81f||stringOptions[_0x74f1('0x9')];var _0x490138=_0x32dd4c||stringOptions[_0x74f1('0x1e')];var _0x1d1e4f=crypto[_0x74f1('0x1a')](_0x294aac,_0x490138);var _0x2bec3d=_0x1d1e4f[_0x74f1('0x1c')](_0x1c691b,_0x74f1('0x20'),_0x74f1('0x1f'));_0x2bec3d+=_0x1d1e4f['final']('utf8');return _0x2bec3d;}; \ No newline at end of file +var _0x0f96=['base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','close','decryptFile','createDecipher','final','unlink','encryptString','secret','utf8'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0f96,0x96));var _0x60f9=function(_0x1b981b,_0x53d732){_0x1b981b=_0x1b981b-0x0;var _0x3489d7=_0x0f96[_0x1b981b];return _0x3489d7;};'use strict';var crypto=require(_0x60f9('0x0'));var fs=require('fs');var BPromise=require(_0x60f9('0x1'));var _=require(_0x60f9('0x2'));var config=require(_0x60f9('0x3'));var logger=require(_0x60f9('0x4'))(_0x60f9('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x60f9('0x6')][_0x60f9('0x7')],'algorithm':_0x60f9('0x8')};const fileOptions={'algorithm':_0x60f9('0x9')};if(config[_0x60f9('0xa')]&&config[_0x60f9('0xa')][_0x60f9('0xb')]){var isSupported=isAlgorithmSupported(config[_0x60f9('0xa')][_0x60f9('0xb')]);if(isSupported){fileOptions[_0x60f9('0xb')]=config[_0x60f9('0xa')][_0x60f9('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x60f9('0xc')](',\x20');logger[_0x60f9('0xd')](config[_0x60f9('0xa')][_0x60f9('0xb')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x450ea0){return AES_SUPPORTED_RX[_0x60f9('0xe')](_0x450ea0);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x60f9('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x13ca20){return getSupportedCiphers()[_0x60f9('0x10')](_0x13ca20)>-0x1;}function combineOptions(_0x1c710d){var _0xac2f9b={};for(var _0x1e1e57 in fileOptions){if(fileOptions[_0x60f9('0x11')](_0x1e1e57)){_0xac2f9b[_0x1e1e57]=fileOptions[_0x1e1e57];}}if(_0x1c710d){for(var _0x315092 in _0x1c710d){if(_0x1c710d[_0x60f9('0x11')](_0x315092)){_0xac2f9b[_0x315092]=_0x1c710d[_0x315092];}}}return _0xac2f9b;}exports[_0x60f9('0x12')]=function(_0x4d1d97,_0x2179c0,_0x8cab8d,_0x211bb4){return new BPromise(function(_0x4f5b44,_0x13031a){_0x211bb4=combineOptions(_0x211bb4);var _0x182184=new Buffer(_0x8cab8d);var _0x98029c=fs[_0x60f9('0x13')](_0x4d1d97);var _0x5ec5e7=fs[_0x60f9('0x14')](_0x2179c0);var _0x2ac843=crypto[_0x60f9('0x15')](_0x211bb4[_0x60f9('0xb')],_0x182184);_0x98029c['on'](_0x60f9('0x16'),function(_0x2edff3){var _0x1141f6=new Buffer(_0x2ac843[_0x60f9('0x17')](_0x2edff3),_0x60f9('0x18'));_0x5ec5e7[_0x60f9('0x19')](_0x1141f6);});_0x98029c['on'](_0x60f9('0x1a'),function(){try{var _0x542415=new Buffer(_0x2ac843['final'](_0x60f9('0x18')),_0x60f9('0x18'));_0x5ec5e7[_0x60f9('0x19')](_0x542415);_0x5ec5e7[_0x60f9('0x1a')]();_0x5ec5e7['on'](_0x60f9('0x1b'),function(){return _0x4f5b44(_0x2179c0);});}catch(_0x1b5b05){fs['unlink'](_0x2179c0);return _0x13031a(_0x1b5b05);}});});};exports[_0x60f9('0x1c')]=function(_0xd607c4,_0x310246,_0x1ed973,_0x1d90fc){return new BPromise(function(_0x4c0710,_0x37b064){_0x1d90fc=combineOptions(_0x1d90fc);var _0x2495fa=new Buffer(_0x1ed973);var _0x436a06=fs[_0x60f9('0x13')](_0xd607c4);var _0x4cbeff=fs[_0x60f9('0x14')](_0x310246);var _0x3d3c1f=crypto[_0x60f9('0x1d')](_0x1d90fc['algorithm'],_0x2495fa);_0x436a06['on'](_0x60f9('0x16'),function(_0x2ad717){var _0x20141c=new Buffer(_0x3d3c1f[_0x60f9('0x17')](_0x2ad717),_0x60f9('0x18'));_0x4cbeff[_0x60f9('0x19')](_0x20141c);});_0x436a06['on'](_0x60f9('0x1a'),function(){try{var _0x403dea=new Buffer(_0x3d3c1f[_0x60f9('0x1e')](_0x60f9('0x18')),_0x60f9('0x18'));_0x4cbeff['write'](_0x403dea);_0x4cbeff[_0x60f9('0x1a')]();_0x4cbeff['on']('close',function(){return _0x4c0710(_0x310246);});}catch(_0xf65a6e){fs[_0x60f9('0x1f')](_0x310246);return _0x37b064(_0xf65a6e);}});});};exports[_0x60f9('0x20')]=function(_0x40a015,_0x43d181,_0x1a6ba4){var _0x11bdf3=_0x1a6ba4||stringOptions['algorithm'];var _0x1c7741=_0x43d181||stringOptions[_0x60f9('0x21')];var _0x3f2c57=crypto[_0x60f9('0x15')](_0x11bdf3,_0x1c7741);var _0x1ead4f=_0x3f2c57['update'](_0x40a015,_0x60f9('0x22'),_0x60f9('0x23'));_0x1ead4f+=_0x3f2c57['final'](_0x60f9('0x23'));return _0x1ead4f;};exports[_0x60f9('0x24')]=function(_0x19d9df,_0x205f4e,_0x789a82){var _0x18e6a7=_0x789a82||stringOptions[_0x60f9('0xb')];var _0x21b8db=_0x205f4e||stringOptions['secret'];var _0x5d7a6b=crypto[_0x60f9('0x1d')](_0x18e6a7,_0x21b8db);var _0x12d471=_0x5d7a6b[_0x60f9('0x17')](_0x19d9df,_0x60f9('0x23'),_0x60f9('0x22'));_0x12d471+=_0x5d7a6b['final'](_0x60f9('0x22'));return _0x12d471;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 7700729..0060562 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 _0xaedf=['analytics','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','forEach','format','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','existsSync','join','mkdirSync','each','csv','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger'];(function(_0x31e742,_0x40530f){var _0x5fc6bb=function(_0xf0f5ca){while(--_0xf0f5ca){_0x31e742['push'](_0x31e742['shift']());}};_0x5fc6bb(++_0x40530f);}(_0xaedf,0x156));var _0xfaed=function(_0x177cc4,_0x510867){_0x177cc4=_0x177cc4-0x0;var _0x4cb1fe=_0xaedf[_0x177cc4];return _0x4cb1fe;};'use strict';var util=require('util');var path=require(_0xfaed('0x0'));var _=require(_0xfaed('0x1'));var csv=require(_0xfaed('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xfaed('0x3'));var rimraf=require(_0xfaed('0x4'));var db=require(_0xfaed('0x5'))['db'];var dbH=require(_0xfaed('0x5'))[_0xfaed('0x6')];var logger=require(_0xfaed('0x7'))(_0xfaed('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xfaed('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1b0445,_0x2f1453){var _0x5a40b0={'status':_0x1b0445};var _0x2ef046={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2f1453){_0x5a40b0[_0xfaed('0xa')]=_0x2f1453;}return db[_0xfaed('0xb')][_0xfaed('0xc')](_0x5a40b0,_0x2ef046);}function main(){var _0x313794=0x1388;var _0x43d18e;logger['info'](util['format'](_0xfaed('0xd'),EXTRACTED_REPORT_ID,_0xfaed('0xe')));return db[_0xfaed('0xf')][_0xfaed('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfaed('0x11'),_0xfaed('0x12')]})['then'](function(_0x4cba47){if(_0x4cba47){_0x43d18e=_0x4cba47;_0x313794=_0x43d18e[_0xfaed('0x12')]||0x1388;}})[_0xfaed('0x13')](function(){return dbH[_0xfaed('0x14')][_0xfaed('0x15')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xfaed('0x14')][_0xfaed('0x16')][_0xfaed('0x17')]});})[_0xfaed('0x13')](function(_0x216f13){if(!_0x216f13[0x0][_0xfaed('0x18')]){return analyticExtractedReport(_0xfaed('0x19'));}var _0x41a928=[];var _0x34b390=0x0;if(_0x43d18e['split']){if(_0x216f13&&_0x216f13[_0xfaed('0x1a')]){var _0x1fb2e0=_['range'](_0x216f13[0x0][_0xfaed('0x18')]/_0x313794);var _0x34d115=Number['isInteger'](_0x216f13[0x0][_0xfaed('0x18')]/_0x313794)?_0x216f13[0x0]['num']%_0x313794:0x0;_0x1fb2e0[_0xfaed('0x1b')](function(_0x3f281b){if(_0x3f281b>0x0){_0x34b390+=_0x313794;}_0x41a928['push'](dbH[_0xfaed('0x14')]['query'](util[_0xfaed('0x1c')](_0xfaed('0x1d'),QUERY,_0x313794,_0x34b390),{'type':dbH[_0xfaed('0x14')][_0xfaed('0x16')][_0xfaed('0x17')]}));});if(_0x34d115>0x0){_0x34b390+=_0x313794;_0x41a928[_0xfaed('0x1e')](dbH[_0xfaed('0x14')][_0xfaed('0x15')](util[_0xfaed('0x1c')](_0xfaed('0x1d'),QUERY,_0x34d115,_0x34b390),{'type':dbH[_0xfaed('0x14')][_0xfaed('0x16')][_0xfaed('0x17')]}));}}}else{_0x41a928[_0xfaed('0x1e')](dbH['sequelize'][_0xfaed('0x15')](QUERY,{'type':dbH[_0xfaed('0x14')]['QueryTypes'][_0xfaed('0x17')]}));}var _0x556821=path[_0xfaed('0x1f')](PATH);var _0x5d1011=path[_0xfaed('0x20')](PATH,_0xfaed('0x21'));var _0x39d72e=_0x43d18e['split']&&_0x41a928[_0xfaed('0x1a')]>0x1;var _0x41fd24=[];if(!fs[_0xfaed('0x22')](path[_0xfaed('0x23')](_0x556821,_0x5d1011))&&_0x39d72e){fs[_0xfaed('0x24')](path['join'](_0x556821,_0x5d1011));}return BPromise[_0xfaed('0x25')](_0x41a928,function(_0x2360c4){_0x41fd24[_0xfaed('0x1e')](_0x2360c4);})[_0xfaed('0x13')](function(){for(var _0xff3b38=0x0;_0xff3b38<_0x41fd24[_0xfaed('0x1a')];_0xff3b38+=0x1){var _0x5f70e1;var _0x4ff344=_0x41fd24[_0xff3b38];if(_0x39d72e){_0x5f70e1=path[_0xfaed('0x23')](_0x556821,_0x5d1011,util[_0xfaed('0x1c')]('%s%d.%s',_0x5d1011,_0xff3b38,_0xfaed('0x26')));}else{_0x5f70e1=path[_0xfaed('0x23')](_0x556821,util[_0xfaed('0x1c')](_0xfaed('0x27'),_0x5d1011,_0xfaed('0x26')));}fs['writeFileSync'](_0x5f70e1,csv(_0x4ff344));}})[_0xfaed('0x13')](function(){if(_0x39d72e){return new Promise(function(_0x372506){zipdir(path['join'](_0x556821,_0x5d1011),{'saveTo':path['join'](_0x556821,util['format'](_0xfaed('0x27'),_0x5d1011,_0xfaed('0x28')))},function(_0x27254b,_0x107e38){rimraf(path[_0xfaed('0x23')](_0x556821,_0x5d1011),function(){});_0x372506(_0xfaed('0x29'));});});}})[_0xfaed('0x13')](function(){logger[_0xfaed('0x2a')](util[_0xfaed('0x1c')](_0xfaed('0x2b'),EXTRACTED_REPORT_ID,_0xfaed('0xe')));return analyticExtractedReport(_0xfaed('0x2c'),_0x39d72e?util[_0xfaed('0x1c')](_0xfaed('0x27'),_0x5d1011,_0x39d72e?_0xfaed('0x28'):_0xfaed('0x26')):null);});})[_0xfaed('0x2d')](function(_0x1f8f38){logger[_0xfaed('0x2a')](util['format'](_0xfaed('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util[_0xfaed('0x2f')](_0x1f8f38,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfaed('0x30'));})[_0xfaed('0x31')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x85cc=['SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.csv','existsSync','mkdirSync','join','each','csv','%s.%s','writeFileSync','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','Failed','exit','util','path','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','then','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x85cc,0x1d4));var _0xc85c=function(_0x301f2d,_0x132fc4){_0x301f2d=_0x301f2d-0x0;var _0x4de66f=_0x85cc[_0x301f2d];return _0x4de66f;};'use strict';var util=require(_0xc85c('0x0'));var path=require(_0xc85c('0x1'));var _=require('lodash');var csv=require(_0xc85c('0x2'));var fs=require('fs');var BPromise=require(_0xc85c('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xc85c('0x4'));var db=require(_0xc85c('0x5'))['db'];var dbH=require('../../mysqldb')[_0xc85c('0x6')];var logger=require(_0xc85c('0x7'))(_0xc85c('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xc85c('0x9')][0x3];var PATH=process[_0xc85c('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x562cba,_0x534213){var _0x3d84ae={'status':_0x562cba};var _0x304702={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x534213){_0x3d84ae['savename']=_0x534213;}return db[_0xc85c('0xa')]['update'](_0x3d84ae,_0x304702);}function main(){var _0x1bdc4f=0x1388;var _0x2f0b22;logger[_0xc85c('0xb')](util[_0xc85c('0xc')](_0xc85c('0xd'),EXTRACTED_REPORT_ID,_0xc85c('0xe')));return db['Setting'][_0xc85c('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc85c('0x10'),'splitSizeCsv']})[_0xc85c('0x11')](function(_0x2c4e66){if(_0x2c4e66){_0x2f0b22=_0x2c4e66;_0x1bdc4f=_0x2f0b22[_0xc85c('0x12')]||0x1388;}})[_0xc85c('0x11')](function(){return dbH[_0xc85c('0x13')][_0xc85c('0x14')](util[_0xc85c('0xc')](_0xc85c('0x15'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xc85c('0x16')]});})[_0xc85c('0x11')](function(_0x26caa3){if(!_0x26caa3[0x0][_0xc85c('0x17')]){return analyticExtractedReport(_0xc85c('0x18'));}var _0x243b92=[];var _0x5f01d1=0x0;if(_0x2f0b22['split']){if(_0x26caa3&&_0x26caa3[_0xc85c('0x19')]){var _0x42cf99=_[_0xc85c('0x1a')](_0x26caa3[0x0]['num']/_0x1bdc4f);var _0xf34ae4=Number[_0xc85c('0x1b')](_0x26caa3[0x0][_0xc85c('0x17')]/_0x1bdc4f)?_0x26caa3[0x0]['num']%_0x1bdc4f:0x0;_0x42cf99[_0xc85c('0x1c')](function(_0x27df71){if(_0x27df71>0x0){_0x5f01d1+=_0x1bdc4f;}_0x243b92[_0xc85c('0x1d')](dbH[_0xc85c('0x13')]['query'](util[_0xc85c('0xc')](_0xc85c('0x1e'),QUERY,_0x1bdc4f,_0x5f01d1),{'type':dbH['sequelize'][_0xc85c('0x1f')][_0xc85c('0x16')]}));});if(_0xf34ae4>0x0){_0x5f01d1+=_0x1bdc4f;_0x243b92[_0xc85c('0x1d')](dbH['sequelize']['query'](util['format'](_0xc85c('0x1e'),QUERY,_0xf34ae4,_0x5f01d1),{'type':dbH['sequelize']['QueryTypes'][_0xc85c('0x16')]}));}}}else{_0x243b92[_0xc85c('0x1d')](dbH[_0xc85c('0x13')]['query'](QUERY,{'type':dbH[_0xc85c('0x13')][_0xc85c('0x1f')]['SELECT']}));}var _0x359496=path['dirname'](PATH);var _0x4169b3=path[_0xc85c('0x20')](PATH,_0xc85c('0x21'));var _0x41c5fe=_0x2f0b22[_0xc85c('0x10')]&&_0x243b92[_0xc85c('0x19')]>0x1;var _0x3c8842=[];if(!fs[_0xc85c('0x22')](path['join'](_0x359496,_0x4169b3))&&_0x41c5fe){fs[_0xc85c('0x23')](path[_0xc85c('0x24')](_0x359496,_0x4169b3));}return BPromise[_0xc85c('0x25')](_0x243b92,function(_0x20ba76){_0x3c8842['push'](_0x20ba76);})[_0xc85c('0x11')](function(){for(var _0x184404=0x0;_0x184404<_0x3c8842['length'];_0x184404+=0x1){var _0x4c6e88;var _0x516bd5=_0x3c8842[_0x184404];if(_0x41c5fe){_0x4c6e88=path[_0xc85c('0x24')](_0x359496,_0x4169b3,util[_0xc85c('0xc')]('%s%d.%s',_0x4169b3,_0x184404,_0xc85c('0x26')));}else{_0x4c6e88=path['join'](_0x359496,util[_0xc85c('0xc')](_0xc85c('0x27'),_0x4169b3,'csv'));}fs[_0xc85c('0x28')](_0x4c6e88,csv(_0x516bd5));}})[_0xc85c('0x11')](function(){if(_0x41c5fe){return new Promise(function(_0x58e6e8){zipdir(path[_0xc85c('0x24')](_0x359496,_0x4169b3),{'saveTo':path[_0xc85c('0x24')](_0x359496,util[_0xc85c('0xc')](_0xc85c('0x27'),_0x4169b3,_0xc85c('0x29')))},function(_0x18e672,_0x34ad14){rimraf(path[_0xc85c('0x24')](_0x359496,_0x4169b3),function(){});_0x58e6e8('zip\x20finished');});});}})[_0xc85c('0x11')](function(){logger[_0xc85c('0xb')](util[_0xc85c('0xc')](_0xc85c('0x2a'),EXTRACTED_REPORT_ID,_0xc85c('0xe')));return analyticExtractedReport(_0xc85c('0x2b'),_0x41c5fe?util[_0xc85c('0xc')]('%s.%s',_0x4169b3,_0x41c5fe?_0xc85c('0x29'):_0xc85c('0x26')):null);});})[_0xc85c('0x2c')](function(_0x5543e9){logger[_0xc85c('0xb')](util[_0xc85c('0xc')](_0xc85c('0x2d'),EXTRACTED_REPORT_ID,'CSV'),util[_0xc85c('0x2e')](_0x5543e9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc85c('0x2f'));})['finally'](function(){process[_0xc85c('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index c0a931c..540698b 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 _0x1adc=['pick','toString','value','fill','length','body','push','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','pageBreak','before','margin','footer','right','num','Empty','Setting','split','splitSizePdf','then','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','inspect','exit','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','error','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x1adc,0xef));var _0xc1ad=function(_0x38305a,_0xe0994b){_0x38305a=_0x38305a-0x0;var _0x48b3a5=_0x1adc[_0x38305a];return _0x48b3a5;};'use strict';var _=require(_0xc1ad('0x0'));var fs=require('fs');var util=require(_0xc1ad('0x1'));var path=require(_0xc1ad('0x2'));var moment=require(_0xc1ad('0x3'));var htmlToPdfmake=require(_0xc1ad('0x4'));var PdfPrinter=require(_0xc1ad('0x5'));var zipdir=require(_0xc1ad('0x6'));var rimraf=require(_0xc1ad('0x7'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0xc1ad('0x8')];var BPromise=require(_0xc1ad('0x9'));var db=require(_0xc1ad('0xa'))['db'];var dbH=require('../../mysqldb')[_0xc1ad('0xb')];var logger=require(_0xc1ad('0xc'))(_0xc1ad('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xc1ad('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xc1ad('0xe')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1539b6,_0x1f29cc){var _0x1e6a73={'status':_0x1539b6};var _0x6f1cf4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1f29cc){_0x1e6a73[_0xc1ad('0xf')]=_0x1f29cc;}return db[_0xc1ad('0x10')][_0xc1ad('0x11')](_0x1e6a73,_0x6f1cf4);}function getHeaders(_0x1ad921){return _[_0xc1ad('0x12')](_0x1ad921,function(_0x3ac347){return{'text':_0x3ac347,'style':'tableHeader'};});}function getRows(_0x320971,_0x134d8c){return _[_0xc1ad('0x12')](_0x134d8c,function(_0x4b28a4){return _(_0x4b28a4)[_0xc1ad('0x13')](_0x320971)[_0xc1ad('0x12')](function(_0x3ad9c8){return _0x3ad9c8?_[_0xc1ad('0x14')](_0x3ad9c8):'';})[_0xc1ad('0x15')]();});}function createTable(_0x10c9d1,_0x3dc6e4){var _0x3af6c2={'widths':_[_0xc1ad('0x16')](Array(_0x10c9d1[_0xc1ad('0x17')]),0x91),'heights':function(_0x1c5464){return _0x1c5464===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x485411=getHeaders(_0x10c9d1);_0x3af6c2[_0xc1ad('0x18')][_0xc1ad('0x19')](_0x485411);var _0x10d504=getRows(_0x10c9d1,_0x3dc6e4);_0x3af6c2[_0xc1ad('0x18')]=_0x3af6c2[_0xc1ad('0x18')][_0xc1ad('0x1a')](_0x10d504);return _0x3af6c2;}function createTables(_0x13a09d){var _0x3941b6=[];var _0xf99a29=_[_0xc1ad('0x1b')](Object['keys'](_0x13a09d[0x0]),0x5);_0xf99a29[_0xc1ad('0x1c')](function(_0x190e74){_0x3941b6[_0xc1ad('0x19')](createTable(_0x190e74,_0x13a09d));});return _0x3941b6;}function getPDFDocDefinition(_0x4b9bf5){var _0x36cf0a=util[_0xc1ad('0x1d')](_0xc1ad('0x1e'),NAME,EXTRACTED_REPORT[_0xc1ad('0x1f')],moment(EXTRACTED_REPORT['startDate'])[_0xc1ad('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0xc1ad('0x20')])['format'](FORMAT));var _0x1edc88=[];for(var _0x2c4972=0x0;_0x2c4972<_0x4b9bf5[_0xc1ad('0x17')];_0x2c4972++){var _0x181e95=[];if(_0x2c4972===0x0){_0x181e95['push']({'text':_0x36cf0a,'style':_0xc1ad('0x21')});}var _0xc662b9={'table':_0x4b9bf5[_0x2c4972]};if(_0x2c4972>0x0){_0xc662b9[_0xc1ad('0x22')]=_0xc1ad('0x23');_0xc662b9[_0xc1ad('0x24')]=[0x0,0x46,0x0,0x0];}_0x181e95[_0xc1ad('0x19')](_0xc662b9);_0x1edc88['push'](_0x181e95);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x1edc88,'footer':function(_0x1aba85,_0x27c70e){return{'text':_0x1aba85['toString']()+'\x20/\x20'+_0x27c70e,'style':_0xc1ad('0x25')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xc1ad('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x352e5d){var _0x4363e1=0x1388;var _0x5ee213;if(!_0x352e5d[0x0][_0xc1ad('0x27')]){return analyticExtractedReport(_0xc1ad('0x28'));}return db[_0xc1ad('0x29')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc1ad('0x2a'),_0xc1ad('0x2b')]})['then'](function(_0x2623af){if(_0x2623af){_0x5ee213=_0x2623af;_0x4363e1=_0x5ee213[_0xc1ad('0x2b')]||0x3e8;}})[_0xc1ad('0x2c')](function(){var _0x2d4c74=[];var _0x530d1b=0x0;if(_0x5ee213[_0xc1ad('0x2a')]){if(_0x352e5d&&_0x352e5d[_0xc1ad('0x17')]){var _0x25732c=_[_0xc1ad('0x2d')](_0x352e5d[0x0][_0xc1ad('0x27')]/_0x4363e1);var _0x33b89c=Number[_0xc1ad('0x2e')](_0x352e5d[0x0][_0xc1ad('0x27')]/_0x4363e1)?_0x352e5d[0x0][_0xc1ad('0x27')]%_0x4363e1:0x0;_0x25732c['forEach'](function(_0x4b2b04){if(_0x4b2b04>0x0){_0x530d1b+=_0x4363e1;}_0x2d4c74['push'](dbH['sequelize'][_0xc1ad('0x2f')](util[_0xc1ad('0x1d')](_0xc1ad('0x30'),QUERY,_0x4363e1,_0x530d1b),{'type':dbH[_0xc1ad('0x31')][_0xc1ad('0x32')][_0xc1ad('0x33')]}));});if(_0x33b89c>0x0){_0x530d1b+=_0x4363e1;_0x2d4c74[_0xc1ad('0x19')](dbH[_0xc1ad('0x31')][_0xc1ad('0x2f')](util[_0xc1ad('0x1d')](_0xc1ad('0x30'),QUERY,_0x33b89c,_0x530d1b),{'type':dbH[_0xc1ad('0x31')][_0xc1ad('0x32')][_0xc1ad('0x33')]}));}}}else{_0x2d4c74['push'](dbH[_0xc1ad('0x31')]['query'](QUERY,{'type':dbH[_0xc1ad('0x31')][_0xc1ad('0x32')][_0xc1ad('0x33')]}));}var _0x22a005=path[_0xc1ad('0x34')](PATH);var _0xe0ae65=path[_0xc1ad('0x35')](PATH,_0xc1ad('0x36'));var _0x3ef4f7=_0x5ee213[_0xc1ad('0x2a')]&&_0x2d4c74[_0xc1ad('0x17')]>0x1;var _0x2cd40b=[];if(!fs[_0xc1ad('0x37')](path[_0xc1ad('0x38')](_0x22a005,_0xe0ae65))&&_0x3ef4f7){fs[_0xc1ad('0x39')](path[_0xc1ad('0x38')](_0x22a005,_0xe0ae65));}return BPromise['each'](_0x2d4c74,function(_0x59ed8f){_0x2cd40b[_0xc1ad('0x19')](_0x59ed8f);})[_0xc1ad('0x2c')](function(){var _0x2b0046=[];for(var _0x2b8d6c=0x0;_0x2b8d6c<_0x2cd40b[_0xc1ad('0x17')];_0x2b8d6c+=0x1){var _0x2f13c0=_0x2cd40b[_0x2b8d6c];var _0x400f73=createTables(_['flatten'](_0x2f13c0));var _0x1bb21d;var _0x19fe55=getPDFDocDefinition(_0x400f73);var _0x1a5317=getPDFPrinter();var _0x130caa=_0x1a5317['createPdfKitDocument'](_0x19fe55);if(_0x3ef4f7){_0x1bb21d=path['join'](_0x22a005,_0xe0ae65,util[_0xc1ad('0x1d')](_0xc1ad('0x3a'),_0xe0ae65,_0x2b8d6c,_0xc1ad('0x3b')));}else{_0x1bb21d=path['join'](_0x22a005,util[_0xc1ad('0x1d')](_0xc1ad('0x3c'),_0xe0ae65,_0xc1ad('0x3b')));}_0x2b0046[_0xc1ad('0x19')](writePDFDocument(_0x130caa,_0x1bb21d));}return Promise['all'](_0x2b0046);})[_0xc1ad('0x2c')](function(){if(_0x3ef4f7){return new Promise(function(_0x232282){zipdir(path[_0xc1ad('0x38')](_0x22a005,_0xe0ae65),{'saveTo':path[_0xc1ad('0x38')](_0x22a005,util[_0xc1ad('0x1d')]('%s.%s',_0xe0ae65,_0xc1ad('0x3d')))},function(){rimraf(path[_0xc1ad('0x38')](_0x22a005,_0xe0ae65),function(){});_0x232282(_0xc1ad('0x3e'));});});}})[_0xc1ad('0x2c')](function(){if(!_0x3ef4f7)return;rimraf(path['join'](_0x22a005,_0xe0ae65),function(){});})[_0xc1ad('0x2c')](function(){logger['info'](util['format'](_0xc1ad('0x3f'),EXTRACTED_REPORT_ID,_0xc1ad('0x40')));return analyticExtractedReport(_0xc1ad('0x41'),_0x3ef4f7?util[_0xc1ad('0x1d')](_0xc1ad('0x3c'),_0xe0ae65,_0x3ef4f7?_0xc1ad('0x3d'):_0xc1ad('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xc1ad('0x42')](util[_0xc1ad('0x1d')](_0xc1ad('0x43'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0xc1ad('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xc1ad('0x2c')](function(_0x4c00c5){EXTRACTED_REPORT=_0x4c00c5;return dbH['sequelize'][_0xc1ad('0x2f')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xc1ad('0x31')][_0xc1ad('0x32')][_0xc1ad('0x33')]});})[_0xc1ad('0x2c')](extractReport)[_0xc1ad('0x45')](function(_0x455eda){logger[_0xc1ad('0x42')](util[_0xc1ad('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc1ad('0x40')),util[_0xc1ad('0x46')](_0x455eda,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xc1ad('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5b678c=new PdfPrinter({'Arial':{'normal':__dirname+_0xc1ad('0x48'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xc1ad('0x49')}});return _0x5b678c;}function getPDFDocDefinitionFromHTML(_0x47d03b,_0x2640e8){var _0x337a9f=util[_0xc1ad('0x1d')](_0xc1ad('0x4a'),_0x2640e8[_0xc1ad('0x4b')],_0x2640e8[_0xc1ad('0x4c')]);var _0x21f374=moment()[_0xc1ad('0x1d')]('YYYY-MM-DD')['toString']();var _0x46b220=htmlToPdfmake(_0x47d03b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x46b220],'defaultStyle':{'font':_0xc1ad('0x4d')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xc1ad('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xc1ad('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xc1ad('0x4e')}},'header':function(){return[{'text':_0xc1ad('0x4f'),'style':_0xc1ad('0x21')}];},'footer':function(_0x3572fe,_0x21a3e1){return[{'text':util['format'](_0xc1ad('0x50'),_0x337a9f,_0x3572fe,_0x21a3e1,_0x21f374),'style':'footer'}];}};}function writePDFDocument(_0x452810,_0x9f263b){return new Promise(function(_0x2d2889,_0x21d551){var _0x91a7ad=_0x452810[_0xc1ad('0x51')](fs[_0xc1ad('0x52')](_0x9f263b));_0x91a7ad['on']('finish',function(){_0x2d2889('finish');});_0x91a7ad['on'](_0xc1ad('0x53'),function(_0x21a321){_0x21d551(_0x21a321);});_0x452810['end']();});}exports[_0xc1ad('0x54')]=function(_0x464297,_0x185863){var _0x510536=getPDFPrinter();var _0x2c6133=getPDFDocDefinitionFromHTML(_0x464297,_0x185863);var _0x34e70b=_0x510536[_0xc1ad('0x55')](_0x2c6133);return writePDFDocument(_0x34e70b,_0x185863[_0xc1ad('0x2')])['catch'](function(_0x4a510b){throw _0x4a510b;});}; \ No newline at end of file +var _0x3746=['info','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','tableHeader','map','pick','value','fill','length','auto','body','push','concat','chunk','keys','format','name','startDate','endDate','header','before','landscape','toString','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','range','forEach','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','existsSync','join','mkdirSync','createPdfKitDocument','pdf','%s.%s','all'];(function(_0x1757c8,_0x4aa781){var _0x3059f1=function(_0xb9d7f){while(--_0xb9d7f){_0x1757c8['push'](_0x1757c8['shift']());}};_0x3059f1(++_0x4aa781);}(_0x3746,0x18a));var _0x6374=function(_0x51872e,_0x9d2f96){_0x51872e=_0x51872e-0x0;var _0xecc14a=_0x3746[_0x51872e];return _0xecc14a;};'use strict';var _=require(_0x6374('0x0'));var fs=require('fs');var util=require(_0x6374('0x1'));var path=require(_0x6374('0x2'));var moment=require(_0x6374('0x3'));var htmlToPdfmake=require(_0x6374('0x4'));var PdfPrinter=require(_0x6374('0x5'));var zipdir=require(_0x6374('0x6'));var rimraf=require(_0x6374('0x7'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0x6374('0x8')];var BPromise=require(_0x6374('0x9'));var db=require(_0x6374('0xa'))['db'];var dbH=require('../../mysqldb')[_0x6374('0xb')];var logger=require(_0x6374('0xc'))(_0x6374('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x6374('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6374('0xe')][0x4];var NAME=process[_0x6374('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4d3b86,_0x50af57){var _0x45844a={'status':_0x4d3b86};var _0x211213={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x50af57){_0x45844a['savename']=_0x50af57;}return db[_0x6374('0xf')][_0x6374('0x10')](_0x45844a,_0x211213);}function getHeaders(_0x4d15e3){return _['map'](_0x4d15e3,function(_0x44005d){return{'text':_0x44005d,'style':_0x6374('0x11')};});}function getRows(_0x22f965,_0x40c566){return _[_0x6374('0x12')](_0x40c566,function(_0x37b555){return _(_0x37b555)[_0x6374('0x13')](_0x22f965)[_0x6374('0x12')](function(_0x290ede){return _0x290ede?_['toString'](_0x290ede):'';})[_0x6374('0x14')]();});}function createTable(_0x275388,_0x16e15c){var _0x345638={'widths':_[_0x6374('0x15')](Array(_0x275388[_0x6374('0x16')]),0x91),'heights':function(_0x49f2af){return _0x49f2af===0x0?_0x6374('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xda9b0c=getHeaders(_0x275388);_0x345638[_0x6374('0x18')][_0x6374('0x19')](_0xda9b0c);var _0x7d7e6b=getRows(_0x275388,_0x16e15c);_0x345638[_0x6374('0x18')]=_0x345638[_0x6374('0x18')][_0x6374('0x1a')](_0x7d7e6b);return _0x345638;}function createTables(_0x5ca7e7){var _0x5bb220=[];var _0x220a0c=_[_0x6374('0x1b')](Object[_0x6374('0x1c')](_0x5ca7e7[0x0]),0x5);_0x220a0c['forEach'](function(_0x5d55d3){_0x5bb220[_0x6374('0x19')](createTable(_0x5d55d3,_0x5ca7e7));});return _0x5bb220;}function getPDFDocDefinition(_0x4176e6){var _0x4bf69e=util[_0x6374('0x1d')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x6374('0x1e')],moment(EXTRACTED_REPORT[_0x6374('0x1f')])[_0x6374('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x6374('0x20')])[_0x6374('0x1d')](FORMAT));var _0x30b30b=[];for(var _0x33f28a=0x0;_0x33f28a<_0x4176e6[_0x6374('0x16')];_0x33f28a++){var _0x107b44=[];if(_0x33f28a===0x0){_0x107b44[_0x6374('0x19')]({'text':_0x4bf69e,'style':_0x6374('0x21')});}var _0x560021={'table':_0x4176e6[_0x33f28a]};if(_0x33f28a>0x0){_0x560021['pageBreak']=_0x6374('0x22');_0x560021['margin']=[0x0,0x46,0x0,0x0];}_0x107b44[_0x6374('0x19')](_0x560021);_0x30b30b[_0x6374('0x19')](_0x107b44);}return{'pageSize':'A4','pageOrientation':_0x6374('0x23'),'content':_0x30b30b,'footer':function(_0x241732,_0xfd052a){return{'text':_0x241732[_0x6374('0x24')]()+_0x6374('0x25')+_0xfd052a,'style':_0x6374('0x26')};},'defaultStyle':{'font':_0x6374('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x6374('0x28')},'footer':{'alignment':_0x6374('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4c0d5d){var _0x2b7fc3=0x1388;var _0x4964fe;if(!_0x4c0d5d[0x0][_0x6374('0x2a')]){return analyticExtractedReport(_0x6374('0x2b'));}return db[_0x6374('0x2c')][_0x6374('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6374('0x2e'),_0x6374('0x2f')]})[_0x6374('0x30')](function(_0x2adea5){if(_0x2adea5){_0x4964fe=_0x2adea5;_0x2b7fc3=_0x4964fe[_0x6374('0x2f')]||0x3e8;}})[_0x6374('0x30')](function(){var _0x162ea9=[];var _0x25ac7e=0x0;if(_0x4964fe['split']){if(_0x4c0d5d&&_0x4c0d5d['length']){var _0x5ceefd=_[_0x6374('0x31')](_0x4c0d5d[0x0][_0x6374('0x2a')]/_0x2b7fc3);var _0x5eb289=Number['isInteger'](_0x4c0d5d[0x0][_0x6374('0x2a')]/_0x2b7fc3)?_0x4c0d5d[0x0][_0x6374('0x2a')]%_0x2b7fc3:0x0;_0x5ceefd[_0x6374('0x32')](function(_0x33c9fa){if(_0x33c9fa>0x0){_0x25ac7e+=_0x2b7fc3;}_0x162ea9[_0x6374('0x19')](dbH[_0x6374('0x33')][_0x6374('0x34')](util[_0x6374('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2b7fc3,_0x25ac7e),{'type':dbH[_0x6374('0x33')][_0x6374('0x35')][_0x6374('0x36')]}));});if(_0x5eb289>0x0){_0x25ac7e+=_0x2b7fc3;_0x162ea9['push'](dbH['sequelize'][_0x6374('0x34')](util[_0x6374('0x1d')](_0x6374('0x37'),QUERY,_0x5eb289,_0x25ac7e),{'type':dbH[_0x6374('0x33')]['QueryTypes'][_0x6374('0x36')]}));}}}else{_0x162ea9[_0x6374('0x19')](dbH['sequelize'][_0x6374('0x34')](QUERY,{'type':dbH[_0x6374('0x33')]['QueryTypes'][_0x6374('0x36')]}));}var _0x433a0d=path[_0x6374('0x38')](PATH);var _0x277bb5=path[_0x6374('0x39')](PATH,_0x6374('0x3a'));var _0x5962f0=_0x4964fe['split']&&_0x162ea9[_0x6374('0x16')]>0x1;var _0x16e28b=[];if(!fs[_0x6374('0x3b')](path[_0x6374('0x3c')](_0x433a0d,_0x277bb5))&&_0x5962f0){fs[_0x6374('0x3d')](path[_0x6374('0x3c')](_0x433a0d,_0x277bb5));}return BPromise['each'](_0x162ea9,function(_0xc2439c){_0x16e28b[_0x6374('0x19')](_0xc2439c);})[_0x6374('0x30')](function(){var _0x4578ac=[];for(var _0x1256ab=0x0;_0x1256ab<_0x16e28b[_0x6374('0x16')];_0x1256ab+=0x1){var _0x4dc16c=_0x16e28b[_0x1256ab];var _0x23d9f1=createTables(_['flatten'](_0x4dc16c));var _0x30b4f8;var _0x33402b=getPDFDocDefinition(_0x23d9f1);var _0x56c7be=getPDFPrinter();var _0x3d5358=_0x56c7be[_0x6374('0x3e')](_0x33402b);if(_0x5962f0){_0x30b4f8=path[_0x6374('0x3c')](_0x433a0d,_0x277bb5,util[_0x6374('0x1d')]('%s%d.%s',_0x277bb5,_0x1256ab,_0x6374('0x3f')));}else{_0x30b4f8=path[_0x6374('0x3c')](_0x433a0d,util['format'](_0x6374('0x40'),_0x277bb5,'pdf'));}_0x4578ac[_0x6374('0x19')](writePDFDocument(_0x3d5358,_0x30b4f8));}return Promise[_0x6374('0x41')](_0x4578ac);})[_0x6374('0x30')](function(){if(_0x5962f0){return new Promise(function(_0x4ed465){zipdir(path[_0x6374('0x3c')](_0x433a0d,_0x277bb5),{'saveTo':path['join'](_0x433a0d,util[_0x6374('0x1d')](_0x6374('0x40'),_0x277bb5,'zip'))},function(){rimraf(path[_0x6374('0x3c')](_0x433a0d,_0x277bb5),function(){});_0x4ed465('zip\x20finished');});});}})[_0x6374('0x30')](function(){if(!_0x5962f0)return;rimraf(path['join'](_0x433a0d,_0x277bb5),function(){});})['then'](function(){logger[_0x6374('0x42')](util[_0x6374('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x6374('0x43'),_0x5962f0?util[_0x6374('0x1d')](_0x6374('0x40'),_0x277bb5,_0x5962f0?_0x6374('0x44'):_0x6374('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x6374('0x42')](util[_0x6374('0x1d')](_0x6374('0x45'),EXTRACTED_REPORT_ID,_0x6374('0x46')));return db[_0x6374('0xf')][_0x6374('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x6374('0x30')](function(_0x5e0854){EXTRACTED_REPORT=_0x5e0854;return dbH['sequelize'][_0x6374('0x34')](util[_0x6374('0x1d')](_0x6374('0x48'),QUERY),{'type':dbH['sequelize'][_0x6374('0x35')][_0x6374('0x36')]});})['then'](extractReport)['catch'](function(_0x6d0998){logger[_0x6374('0x42')](util[_0x6374('0x1d')](_0x6374('0x49'),EXTRACTED_REPORT_ID,'PDF'),util[_0x6374('0x4a')](_0x6d0998,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6374('0x4b'));})['finally'](function(){process[_0x6374('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x454e8c=new PdfPrinter({'Arial':{'normal':__dirname+_0x6374('0x4d'),'bold':__dirname+_0x6374('0x4e'),'italics':__dirname+_0x6374('0x4f'),'bolditalics':__dirname+_0x6374('0x50')}});return _0x454e8c;}function getPDFDocDefinitionFromHTML(_0x18b571,_0x53eae4){var _0x365191=util[_0x6374('0x1d')](_0x6374('0x51'),_0x53eae4[_0x6374('0x52')],_0x53eae4[_0x6374('0x53')]);var _0x5df6fd=moment()[_0x6374('0x1d')](_0x6374('0x54'))[_0x6374('0x24')]();var _0x107524=htmlToPdfmake(_0x18b571,{'window':window,'tableAutoSize':!![]});return{'content':[_0x107524],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x6374('0x55'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x6374('0x55')}},'header':function(){return[{'text':_0x6374('0x56'),'style':'header'}];},'footer':function(_0x3c9a18,_0x149fca){return[{'text':util['format'](_0x6374('0x57'),_0x365191,_0x3c9a18,_0x149fca,_0x5df6fd),'style':_0x6374('0x26')}];}};}function writePDFDocument(_0x392096,_0x17fc64){return new Promise(function(_0x4663b6,_0x3124fe){var _0x4aeea4=_0x392096[_0x6374('0x58')](fs['createWriteStream'](_0x17fc64));_0x4aeea4['on'](_0x6374('0x59'),function(){_0x4663b6(_0x6374('0x59'));});_0x4aeea4['on']('error',function(_0x55583c){_0x3124fe(_0x55583c);});_0x392096[_0x6374('0x5a')]();});}exports[_0x6374('0x5b')]=function(_0x305d33,_0x21f67e){var _0x46baff=getPDFPrinter();var _0x4bf71e=getPDFDocDefinitionFromHTML(_0x305d33,_0x21f67e);var _0x22cfb3=_0x46baff[_0x6374('0x3e')](_0x4bf71e);return writePDFDocument(_0x22cfb3,_0x21f67e[_0x6374('0x2')])['catch'](function(_0x1938ad){throw _0x1938ad;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index fc60064..12a9e5d 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 _0xce5b=['forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','dirname','basename','existsSync','join','mkdirSync','each','length','%s%d.%s','xlsx','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','argv','update','format','XLSX','find','split','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','Empty','range','num','isInteger'];(function(_0x38591a,_0x57e091){var _0x27a59a=function(_0xc7f6f5){while(--_0xc7f6f5){_0x38591a['push'](_0x38591a['shift']());}};_0x27a59a(++_0x57e091);}(_0xce5b,0x76));var _0xbce5=function(_0x28cb97,_0x47ad16){_0x28cb97=_0x28cb97-0x0;var _0x2d7486=_0xce5b[_0x28cb97];return _0x2d7486;};'use strict';var util=require(_0xbce5('0x0'));var path=require(_0xbce5('0x1'));var _=require(_0xbce5('0x2'));var fs=require('fs');var json2xls=require(_0xbce5('0x3'));var BPromise=require(_0xbce5('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xbce5('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xbce5('0x6'))[_0xbce5('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbce5('0x8')][0x2]);var QUERY=process[_0xbce5('0x8')][0x3];var PATH=process[_0xbce5('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2e2d25,_0xbf3f37){var _0x48dabf={'status':_0x2e2d25};var _0x529566={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xbf3f37){_0x48dabf['savename']=_0xbf3f37;}return db['AnalyticExtractedReport'][_0xbce5('0x9')](_0x48dabf,_0x529566);}function main(){var _0x1bc3ef=0x1388;var _0x88194a;logger['info'](util[_0xbce5('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbce5('0xb')));return db['Setting'][_0xbce5('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbce5('0xd'),_0xbce5('0xe')]})[_0xbce5('0xf')](function(_0x1b6e71){if(_0x1b6e71){_0x88194a=_0x1b6e71;_0x1bc3ef=_0x88194a[_0xbce5('0xe')]||0x1388;}})[_0xbce5('0xf')](function(){return dbH['sequelize']['query'](util[_0xbce5('0xa')](_0xbce5('0x10'),QUERY),{'type':dbH[_0xbce5('0x11')]['QueryTypes'][_0xbce5('0x12')]});})[_0xbce5('0xf')](function(_0x134207){if(!_0x134207[0x0]['num']){return analyticExtractedReport(_0xbce5('0x13'));}var _0x191e08=[];var _0x251170=0x0;if(_0x88194a['split']){if(_0x134207&&_0x134207['length']){var _0x4a6049=_[_0xbce5('0x14')](_0x134207[0x0][_0xbce5('0x15')]/_0x1bc3ef);var _0x310b51=Number[_0xbce5('0x16')](_0x134207[0x0]['num']/_0x1bc3ef)?_0x134207[0x0][_0xbce5('0x15')]%_0x1bc3ef:0x0;_0x4a6049[_0xbce5('0x17')](function(_0x234d5a){if(_0x234d5a>0x0){_0x251170+=_0x1bc3ef;}_0x191e08[_0xbce5('0x18')](dbH['sequelize']['query'](util[_0xbce5('0xa')](_0xbce5('0x19'),QUERY,_0x1bc3ef,_0x251170),{'type':dbH[_0xbce5('0x11')][_0xbce5('0x1a')][_0xbce5('0x12')]}));});if(_0x310b51>0x0){_0x251170+=_0x1bc3ef;_0x191e08['push'](dbH[_0xbce5('0x11')]['query'](util['format'](_0xbce5('0x19'),QUERY,_0x310b51,_0x251170),{'type':dbH[_0xbce5('0x11')][_0xbce5('0x1a')][_0xbce5('0x12')]}));}}}else{_0x191e08[_0xbce5('0x18')](dbH[_0xbce5('0x11')][_0xbce5('0x1b')](QUERY,{'type':dbH[_0xbce5('0x11')][_0xbce5('0x1a')][_0xbce5('0x12')]}));}var _0x18c7bd=path[_0xbce5('0x1c')](PATH);var _0x13f048=path[_0xbce5('0x1d')](PATH,'.xlsx');var _0x25ce2e=_0x88194a[_0xbce5('0xd')]&&_0x191e08['length']>0x1;var _0xdc2518=[];if(!fs[_0xbce5('0x1e')](path[_0xbce5('0x1f')](_0x18c7bd,_0x13f048))&&_0x25ce2e){fs[_0xbce5('0x20')](path[_0xbce5('0x1f')](_0x18c7bd,_0x13f048));}return BPromise[_0xbce5('0x21')](_0x191e08,function(_0x57a3e1){_0xdc2518[_0xbce5('0x18')](_0x57a3e1);})['then'](function(){for(var _0x2d8747=0x0;_0x2d8747<_0xdc2518[_0xbce5('0x22')];_0x2d8747+=0x1){var _0x74ddff;var _0x3f2be=_0xdc2518[_0x2d8747];if(_0x25ce2e){_0x74ddff=path[_0xbce5('0x1f')](_0x18c7bd,_0x13f048,util[_0xbce5('0xa')](_0xbce5('0x23'),_0x13f048,_0x2d8747,_0xbce5('0x24')));}else{_0x74ddff=path[_0xbce5('0x1f')](_0x18c7bd,util[_0xbce5('0xa')](_0xbce5('0x25'),_0x13f048,'xlsx'));}fs['writeFileSync'](_0x74ddff,json2xls(_0x3f2be),'binary');}})['then'](function(){if(_0x25ce2e){return new Promise(function(_0x4168dd){zipdir(path[_0xbce5('0x1f')](_0x18c7bd,_0x13f048),{'saveTo':path[_0xbce5('0x1f')](_0x18c7bd,util['format']('%s.%s',_0x13f048,_0xbce5('0x26')))},function(_0x5e084d,_0x338015){rimraf(path[_0xbce5('0x1f')](_0x18c7bd,_0x13f048),function(){});_0x4168dd(_0xbce5('0x27'));});});}})[_0xbce5('0xf')](function(){logger[_0xbce5('0x28')](util[_0xbce5('0xa')](_0xbce5('0x29'),EXTRACTED_REPORT_ID,_0xbce5('0xb')));return analyticExtractedReport(_0xbce5('0x2a'),_0x25ce2e?util[_0xbce5('0xa')]('%s.%s',_0x13f048,_0x25ce2e?_0xbce5('0x26'):'xlsx'):null);});})['catch'](function(_0x290ceb){logger['info'](util['format'](_0xbce5('0x2b'),EXTRACTED_REPORT_ID,_0xbce5('0xb')),util[_0xbce5('0x2c')](_0x290ceb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xbce5('0x2d')](function(){process[_0xbce5('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3f76=['range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','existsSync','join','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','catch','inspect','finally','exit','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x3f76,0x1a4));var _0x63f7=function(_0xd222f5,_0x3d4507){_0xd222f5=_0xd222f5-0x0;var _0x45fa1d=_0x3f76[_0xd222f5];return _0x45fa1d;};'use strict';var util=require(_0x63f7('0x0'));var path=require(_0x63f7('0x1'));var _=require(_0x63f7('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x63f7('0x3'));var zipdir=require(_0x63f7('0x4'));var rimraf=require(_0x63f7('0x5'));var db=require(_0x63f7('0x6'))['db'];var dbH=require(_0x63f7('0x6'))[_0x63f7('0x7')];var logger=require('../../config/logger')(_0x63f7('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x63f7('0x9')][0x3];var PATH=process[_0x63f7('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2ccd67,_0x17a01d){var _0x26c2ce={'status':_0x2ccd67};var _0x3297e0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x17a01d){_0x26c2ce[_0x63f7('0xa')]=_0x17a01d;}return db[_0x63f7('0xb')][_0x63f7('0xc')](_0x26c2ce,_0x3297e0);}function main(){var _0x35692d=0x1388;var _0x4d38f8;logger[_0x63f7('0xd')](util[_0x63f7('0xe')](_0x63f7('0xf'),EXTRACTED_REPORT_ID,_0x63f7('0x10')));return db[_0x63f7('0x11')][_0x63f7('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x63f7('0x13'),_0x63f7('0x14')]})[_0x63f7('0x15')](function(_0x1131ff){if(_0x1131ff){_0x4d38f8=_0x1131ff;_0x35692d=_0x4d38f8[_0x63f7('0x14')]||0x1388;}})['then'](function(){return dbH[_0x63f7('0x16')][_0x63f7('0x17')](util[_0x63f7('0xe')](_0x63f7('0x18'),QUERY),{'type':dbH['sequelize'][_0x63f7('0x19')][_0x63f7('0x1a')]});})[_0x63f7('0x15')](function(_0x400e2d){if(!_0x400e2d[0x0][_0x63f7('0x1b')]){return analyticExtractedReport(_0x63f7('0x1c'));}var _0x594edf=[];var _0x1af469=0x0;if(_0x4d38f8['split']){if(_0x400e2d&&_0x400e2d[_0x63f7('0x1d')]){var _0x1d232c=_[_0x63f7('0x1e')](_0x400e2d[0x0]['num']/_0x35692d);var _0x13be4a=Number[_0x63f7('0x1f')](_0x400e2d[0x0][_0x63f7('0x1b')]/_0x35692d)?_0x400e2d[0x0][_0x63f7('0x1b')]%_0x35692d:0x0;_0x1d232c['forEach'](function(_0x1d83e0){if(_0x1d83e0>0x0){_0x1af469+=_0x35692d;}_0x594edf['push'](dbH['sequelize'][_0x63f7('0x17')](util[_0x63f7('0xe')](_0x63f7('0x20'),QUERY,_0x35692d,_0x1af469),{'type':dbH['sequelize'][_0x63f7('0x19')]['SELECT']}));});if(_0x13be4a>0x0){_0x1af469+=_0x35692d;_0x594edf[_0x63f7('0x21')](dbH[_0x63f7('0x16')][_0x63f7('0x17')](util[_0x63f7('0xe')](_0x63f7('0x20'),QUERY,_0x13be4a,_0x1af469),{'type':dbH['sequelize']['QueryTypes'][_0x63f7('0x1a')]}));}}}else{_0x594edf['push'](dbH[_0x63f7('0x16')][_0x63f7('0x17')](QUERY,{'type':dbH[_0x63f7('0x16')]['QueryTypes']['SELECT']}));}var _0x495310=path[_0x63f7('0x22')](PATH);var _0x7badda=path[_0x63f7('0x23')](PATH,_0x63f7('0x24'));var _0x299d3d=_0x4d38f8[_0x63f7('0x13')]&&_0x594edf[_0x63f7('0x1d')]>0x1;var _0x6a3ffe=[];if(!fs[_0x63f7('0x25')](path[_0x63f7('0x26')](_0x495310,_0x7badda))&&_0x299d3d){fs['mkdirSync'](path[_0x63f7('0x26')](_0x495310,_0x7badda));}return BPromise['each'](_0x594edf,function(_0x27bb88){_0x6a3ffe['push'](_0x27bb88);})['then'](function(){for(var _0x2b3528=0x0;_0x2b3528<_0x6a3ffe[_0x63f7('0x1d')];_0x2b3528+=0x1){var _0x5b8b85;var _0x215c14=_0x6a3ffe[_0x2b3528];if(_0x299d3d){_0x5b8b85=path[_0x63f7('0x26')](_0x495310,_0x7badda,util[_0x63f7('0xe')](_0x63f7('0x27'),_0x7badda,_0x2b3528,'xlsx'));}else{_0x5b8b85=path['join'](_0x495310,util[_0x63f7('0xe')](_0x63f7('0x28'),_0x7badda,_0x63f7('0x29')));}fs[_0x63f7('0x2a')](_0x5b8b85,json2xls(_0x215c14),_0x63f7('0x2b'));}})[_0x63f7('0x15')](function(){if(_0x299d3d){return new Promise(function(_0x4d8fa2){zipdir(path[_0x63f7('0x26')](_0x495310,_0x7badda),{'saveTo':path[_0x63f7('0x26')](_0x495310,util['format']('%s.%s',_0x7badda,_0x63f7('0x2c')))},function(_0xd85f7b,_0x4a1631){rimraf(path[_0x63f7('0x26')](_0x495310,_0x7badda),function(){});_0x4d8fa2(_0x63f7('0x2d'));});});}})[_0x63f7('0x15')](function(){logger[_0x63f7('0xd')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x63f7('0x10')));return analyticExtractedReport('Completed',_0x299d3d?util[_0x63f7('0xe')]('%s.%s',_0x7badda,_0x299d3d?_0x63f7('0x2c'):'xlsx'):null);});})[_0x63f7('0x2e')](function(_0x29fc13){logger[_0x63f7('0xd')](util[_0x63f7('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x63f7('0x2f')](_0x29fc13,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x63f7('0x30')](function(){process[_0x63f7('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 2f90ed4..7c061cf 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 _0x5448=['playback','hasOwnProperty','extension','find','extensions','push','type','Set','CDR(type)=%s','context','priority','inbound','CDR(routeid)=','VoiceExtensionId','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','MONITOR_OPTIONS=ab','updatedAt','interval','intervals','tag','CDR(tag)=','length','$[${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','toLowerCase','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','rewrite','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy'];(function(_0x4ffa03,_0x363a82){var _0x30d661=function(_0x36ba86){while(--_0x36ba86){_0x4ffa03['push'](_0x4ffa03['shift']());}};_0x30d661(++_0x363a82);}(_0x5448,0x1eb));var _0x8544=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5448[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0x8544('0x0'));function rewrite(_0x317d5f,_0x2fb900){var _0x29cbd1=this;return _0x317d5f[_0x8544('0x1')][_0x8544('0x2')][_0x8544('0x3')]({'raw':!![]})[_0x8544('0x4')](function(_0x3dc670){_0x29cbd1['intervals']=_0x3dc670;return _0x317d5f[_0x8544('0x1')][_0x8544('0x5')][_0x8544('0x3')]({'where':{'IntervalId':_0x2fb900[_0x8544('0x6')]},'raw':!![]});})[_0x8544('0x4')](function(_0x3f7ccf){return _0x317d5f[_0x8544('0x1')][_0x8544('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x8544('0x7')](_[_0x8544('0x8')](_0x3f7ccf,_0x8544('0x9')))}},'order':[{'raw':_0x8544('0xa')}],'raw':!![]});})['then'](function(_0x9e59f3){var _0x5e77f1=_[_0x8544('0xb')](_0x9e59f3,{'priority':'1'});var _0x33460e=_[_0x8544('0xb')](_0x9e59f3,{'isApp':0x1});var _0x4a846a=_[_0x8544('0xc')](_0x33460e,_0x8544('0x9'));var _0x10fbb2=['queue',_0x8544('0xd')];var _0x36c18c=[];var _0x24bf89=[];for(var _0x1acfb5 in _0x4a846a){if(_0x4a846a[_0x8544('0xe')](_0x1acfb5)){_0x29cbd1['priority']=0x2;_0x29cbd1['extensions']=[];_0x29cbd1[_0x8544('0xf')]=_[_0x8544('0x10')](_0x5e77f1,{'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')]});_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')],'app':_0x8544('0x14'),'appdata':util['format'](_0x8544('0x15'),_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')]),'context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0]['exten'],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0]['VoiceExtensionId']});if(_0x4a846a[_0x1acfb5][0x0]['type']===_0x8544('0x18')){_0x29cbd1[_0x8544('0x11')]['push']({'type':_0x4a846a[_0x1acfb5][0x0]['type'],'app':_0x8544('0x14'),'appdata':_0x8544('0x19')+_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')],'context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x29cbd1['priority']++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});}else if(_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')]===_0x8544('0x1b')){if(_0x29cbd1[_0x8544('0xf')]){_0x29cbd1[_0x8544('0x11')]['push']({'type':_0x4a846a[_0x1acfb5][0x0]['type'],'app':_0x8544('0x14'),'appdata':'CDR(destination)='+(_0x29cbd1[_0x8544('0xf')][_0x8544('0x1c')]?_0x8544('0x1d')+_0x29cbd1[_0x8544('0xf')]['cutdigits']+'}':_0x8544('0x1e')),'context':_0x4a846a[_0x1acfb5][0x0]['context'],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});}_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0]['type'],'app':_0x8544('0x14'),'appdata':'CDR(routeid)='+_0x4a846a[_0x1acfb5][0x0]['VoiceExtensionId'],'context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});var _0x3fec94=_0x29cbd1['priority']++;_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')],'app':_0x8544('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3fec94+0x2)+'):Goto('+(_0x3fec94+0x1)+')','context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x3fec94,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});if(_0x29cbd1[_0x8544('0xf')]){_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')],'app':_0x8544('0x14'),'appdata':_0x29cbd1[_0x8544('0xf')]['cutdigits']?_0x8544('0x20')+_0x29cbd1[_0x8544('0xf')][_0x8544('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});}_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')],'app':_0x8544('0x14'),'appdata':_0x8544('0x21')+_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')],'context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0]['exten'],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});if(_0x29cbd1[_0x8544('0xf')]&&_0x29cbd1['extension'][_0x8544('0xe')](_0x8544('0x22'))&&_0x29cbd1[_0x8544('0xf')][_0x8544('0x22')]!=='none'){_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0]['type'],'app':_0x8544('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4a846a[_0x1acfb5][0x0]['context'],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x29cbd1['priority']++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});_0x29cbd1[_0x8544('0x11')]['push']({'type':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')],'app':_0x8544('0x14'),'appdata':_0x8544('0x23')+_0x29cbd1['extension'][_0x8544('0x22')]||_0x8544('0x24'),'context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0]['VoiceExtensionId']});}}_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0]['type'],'app':_0x8544('0x14'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0]['exten'],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')],'app':_0x8544('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4a846a[_0x1acfb5][0x0]['context'],'exten':_0x4a846a[_0x1acfb5][0x0]['exten'],'priority':_0x29cbd1['priority']++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0]['type'],'app':_0x8544('0x14'),'appdata':_0x8544('0x25'),'context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});for(var _0xfa1f2f=0x0,_0x214b6a=0x0;_0xfa1f2f<_0x4a846a[_0x1acfb5]['length'];_0xfa1f2f+=0x1,_0x214b6a=0x0){var _0x93477d=_0x4a846a[_0x1acfb5][_0xfa1f2f];if(_0x93477d['type']){_0x93477d['type']=_0x93477d[_0x8544('0x13')]['toLowerCase']();}var _0x22317c=[];var _0x39004b=[];delete _0x93477d['id'];delete _0x93477d['createdAt'];delete _0x93477d[_0x8544('0x26')];var _0x55e103=_0x93477d[_0x8544('0x27')]!=='*,*,*,*'?[_0x93477d[_0x8544('0x27')]]:_0x93477d[_0x8544('0x6')]?_[_0x8544('0x8')](_[_0x8544('0xb')](_0x29cbd1[_0x8544('0x28')],{'IntervalId':_0x93477d['IntervalId']}),_0x8544('0x27')):[];if(_0x93477d[_0x8544('0xe')](_0x8544('0x29'))){if(_0x93477d['tag']&&_0x93477d['tag']!=='--'){_0x22317c[_0x8544('0x12')]({'type':_0x93477d[_0x8544('0x13')],'app':'Set','appdata':_0x8544('0x2a')+_0x93477d[_0x8544('0x29')],'context':_0x93477d['context'],'exten':_0x93477d[_0x8544('0x9')],'priority':_0x55e103[_0x8544('0x2b')]+_0x29cbd1[_0x8544('0x17')]+_0x214b6a++,'VoiceExtensionId':_0x93477d['VoiceExtensionId']});}}if(_0x93477d[_0x8544('0x13')]==='outbound'&&_0x93477d[_0x8544('0xe')]('callerID')){if(_0x93477d['callerID']){_0x22317c[_0x8544('0x12')]({'type':_0x93477d['type'],'app':_0x8544('0x1f'),'appdata':_0x8544('0x2c')+_0x93477d['callerID']+')','context':_0x93477d['context'],'exten':_0x93477d[_0x8544('0x9')],'priority':_0x55e103[_0x8544('0x2b')]+_0x29cbd1['priority']+_0x214b6a++,'VoiceExtensionId':_0x93477d[_0x8544('0x1a')]});}else{_0x22317c[_0x8544('0x12')]({'type':_0x93477d[_0x8544('0x13')],'app':_0x8544('0x1f'),'appdata':_0x8544('0x2d'),'context':_0x93477d['context'],'exten':_0x93477d[_0x8544('0x9')],'priority':_0x55e103['length']+_0x29cbd1['priority']+_0x214b6a++,'VoiceExtensionId':_0x93477d[_0x8544('0x1a')]});}}if(_0x93477d[_0x8544('0xe')](_0x8544('0x2e'))){if(_0x10fbb2[_0x8544('0x2f')](_0x93477d['app'][_0x8544('0x30')]())>=0x0&&_0x93477d['appType']!==_0x8544('0x31')){if(_0x93477d[_0x8544('0x2e')]){_0x22317c[_0x8544('0x12')]({'type':_0x93477d['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x93477d[_0x8544('0x16')],'exten':_0x93477d['exten'],'priority':_0x55e103['length']+_0x29cbd1[_0x8544('0x17')]+_0x214b6a++,'VoiceExtensionId':_0x93477d[_0x8544('0x1a')]});_0x22317c[_0x8544('0x12')]({'type':_0x93477d[_0x8544('0x13')],'app':_0x8544('0x14'),'appdata':_0x8544('0x32'),'context':_0x93477d['context'],'exten':_0x93477d['exten'],'priority':_0x55e103[_0x8544('0x2b')]+_0x29cbd1[_0x8544('0x17')]+_0x214b6a++,'VoiceExtensionId':_0x93477d[_0x8544('0x1a')]});}else{_0x22317c[_0x8544('0x12')]({'type':_0x93477d[_0x8544('0x13')],'app':_0x8544('0x1f'),'appdata':_0x8544('0x33'),'context':_0x93477d[_0x8544('0x16')],'exten':_0x93477d[_0x8544('0x9')],'priority':_0x55e103[_0x8544('0x2b')]+_0x29cbd1[_0x8544('0x17')]+_0x214b6a++,'VoiceExtensionId':_0x93477d[_0x8544('0x1a')]});_0x22317c['push']({'type':_0x93477d[_0x8544('0x13')],'app':'Set','appdata':_0x8544('0x34'),'context':_0x93477d['context'],'exten':_0x93477d[_0x8544('0x9')],'priority':_0x55e103['length']+_0x29cbd1[_0x8544('0x17')]+_0x214b6a++,'VoiceExtensionId':_0x93477d[_0x8544('0x1a')]});}}}for(var _0x1ed2c8=0x0;_0x1ed2c8<_0x55e103[_0x8544('0x2b')];_0x1ed2c8+=0x1){var _0x7ae7db=_0x29cbd1[_0x8544('0x17')]+_0x55e103[_0x8544('0x2b')];var _0x5d0089=_0x1ed2c8===_0x55e103[_0x8544('0x2b')]-0x1?_0x29cbd1[_0x8544('0x17')]+_0x22317c['length']+_0x39004b['length']+0x2:_0x29cbd1[_0x8544('0x17')]+_0x1ed2c8+0x1;_0x22317c[_0x8544('0x35')](_0x1ed2c8,0x0,{'type':_0x93477d[_0x8544('0x13')],'app':'GotoIfTime','appdata':_0x55e103[_0x1ed2c8]+'?'+_0x93477d[_0x8544('0x16')]+_0x8544('0x36')+_0x7ae7db+':'+_0x93477d[_0x8544('0x16')]+_0x8544('0x36')+_0x5d0089,'exten':_0x93477d['exten'],'context':_0x93477d[_0x8544('0x16')],'priority':_0x29cbd1[_0x8544('0x17')]+_0x1ed2c8,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});}_0x93477d[_0x8544('0x17')]=_0x22317c[_0x8544('0x2b')]?_['last'](_0x22317c)[_0x8544('0x17')]+0x1:_0x29cbd1[_0x8544('0x17')];_0x29cbd1[_0x8544('0x17')]=(_0x39004b[_0x8544('0x2b')]?_[_0x8544('0x37')](_0x39004b)['priority']:_0x93477d[_0x8544('0x17')])+0x1;_0x29cbd1[_0x8544('0x11')]=_[_0x8544('0x38')](_0x29cbd1[_0x8544('0x11')],_0x22317c,[_0x93477d],_0x39004b);}_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0]['type'],'app':'Hangup','exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'context':_0x4a846a[_0x1acfb5][0x0]['context'],'priority':_0x29cbd1[_0x8544('0x17')],'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});_0x36c18c[_0x8544('0x12')](_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]);_0x24bf89=_[_0x8544('0x38')](_0x24bf89,_0x29cbd1[_0x8544('0x11')]);}}return _0x317d5f[_0x8544('0x39')](function(_0x5dd4ee){return _0x317d5f['models'][_0x8544('0x5')][_0x8544('0x3a')]({'where':{'VoiceExtensionId':{'$in':_0x36c18c}},'transaction':_0x5dd4ee})['then'](function(_0x4b262d){return _0x317d5f[_0x8544('0x1')]['VoiceExtension'][_0x8544('0x3b')](_[_0x8544('0x3c')](_0x24bf89,_0x8544('0x17')),{'transaction':_0x5dd4ee});});});})[_0x8544('0x3d')](function(_0x4c9840){console['error'](_0x4c9840);});}exports[_0x8544('0x3e')]=rewrite; \ No newline at end of file +var _0x9487=['exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','find','type','Set','format','CDR(type)=%s','VoiceExtensionId','push','CDR(routeid)=','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','context','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','appType','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map'];(function(_0x2d9f53,_0xf2ef0b){var _0x17ead9=function(_0x437656){while(--_0x437656){_0x2d9f53['push'](_0x2d9f53['shift']());}};_0x17ead9(++_0xf2ef0b);}(_0x9487,0x1f4));var _0x7948=function(_0xd1f691,_0x1d56d2){_0xd1f691=_0xd1f691-0x0;var _0x524963=_0x9487[_0xd1f691];return _0x524963;};'use strict';var _=require(_0x7948('0x0'));var util=require(_0x7948('0x1'));function rewrite(_0x3eff4d,_0x430d50){var _0x27f3c8=this;return _0x3eff4d[_0x7948('0x2')][_0x7948('0x3')][_0x7948('0x4')]({'raw':!![]})[_0x7948('0x5')](function(_0x34db36){_0x27f3c8[_0x7948('0x6')]=_0x34db36;return _0x3eff4d[_0x7948('0x2')][_0x7948('0x7')][_0x7948('0x4')]({'where':{'IntervalId':_0x430d50[_0x7948('0x8')]},'raw':!![]});})[_0x7948('0x5')](function(_0x3960de){return _0x3eff4d[_0x7948('0x2')][_0x7948('0x7')][_0x7948('0x4')]({'where':{'exten':{'$in':_[_0x7948('0x9')](_[_0x7948('0xa')](_0x3960de,_0x7948('0xb')))}},'order':[{'raw':_0x7948('0xc')}],'raw':!![]});})['then'](function(_0x44cec8){var _0x595e96=_[_0x7948('0xd')](_0x44cec8,{'priority':'1'});var _0x1cecc7=_[_0x7948('0xd')](_0x44cec8,{'isApp':0x1});var _0x10ee50=_[_0x7948('0xe')](_0x1cecc7,_0x7948('0xb'));var _0xa06596=[_0x7948('0xf'),_0x7948('0x10')];var _0x5dd600=[];var _0x321a23=[];for(var _0x2f4797 in _0x10ee50){if(_0x10ee50['hasOwnProperty'](_0x2f4797)){_0x27f3c8[_0x7948('0x11')]=0x2;_0x27f3c8[_0x7948('0x12')]=[];_0x27f3c8['extension']=_[_0x7948('0x13')](_0x595e96,{'exten':_0x10ee50[_0x2f4797][0x0][_0x7948('0xb')]});_0x27f3c8[_0x7948('0x12')]['push']({'type':_0x10ee50[_0x2f4797][0x0][_0x7948('0x14')],'app':_0x7948('0x15'),'appdata':util[_0x7948('0x16')](_0x7948('0x17'),_0x10ee50[_0x2f4797][0x0][_0x7948('0x14')]),'context':_0x10ee50[_0x2f4797][0x0]['context'],'exten':_0x10ee50[_0x2f4797][0x0][_0x7948('0xb')],'priority':_0x27f3c8['priority']++,'VoiceExtensionId':_0x10ee50[_0x2f4797][0x0][_0x7948('0x18')]});if(_0x10ee50[_0x2f4797][0x0][_0x7948('0x14')]==='inbound'){_0x27f3c8[_0x7948('0x12')][_0x7948('0x19')]({'type':_0x10ee50[_0x2f4797][0x0]['type'],'app':'Set','appdata':_0x7948('0x1a')+_0x10ee50[_0x2f4797][0x0]['VoiceExtensionId'],'context':_0x10ee50[_0x2f4797][0x0]['context'],'exten':_0x10ee50[_0x2f4797][0x0][_0x7948('0xb')],'priority':_0x27f3c8['priority']++,'VoiceExtensionId':_0x10ee50[_0x2f4797][0x0][_0x7948('0x18')]});}else if(_0x10ee50[_0x2f4797][0x0][_0x7948('0x14')]===_0x7948('0x1b')){if(_0x27f3c8[_0x7948('0x1c')]){_0x27f3c8[_0x7948('0x12')]['push']({'type':_0x10ee50[_0x2f4797][0x0][_0x7948('0x14')],'app':_0x7948('0x15'),'appdata':_0x7948('0x1d')+(_0x27f3c8[_0x7948('0x1c')][_0x7948('0x1e')]?_0x7948('0x1f')+_0x27f3c8[_0x7948('0x1c')][_0x7948('0x1e')]+'}':_0x7948('0x20')),'context':_0x10ee50[_0x2f4797][0x0][_0x7948('0x21')],'exten':_0x10ee50[_0x2f4797][0x0]['exten'],'priority':_0x27f3c8[_0x7948('0x11')]++,'VoiceExtensionId':_0x10ee50[_0x2f4797][0x0]['VoiceExtensionId']});}_0x27f3c8[_0x7948('0x12')][_0x7948('0x19')]({'type':_0x10ee50[_0x2f4797][0x0]['type'],'app':_0x7948('0x15'),'appdata':_0x7948('0x1a')+_0x10ee50[_0x2f4797][0x0][_0x7948('0x18')],'context':_0x10ee50[_0x2f4797][0x0][_0x7948('0x21')],'exten':_0x10ee50[_0x2f4797][0x0][_0x7948('0xb')],'priority':_0x27f3c8[_0x7948('0x11')]++,'VoiceExtensionId':_0x10ee50[_0x2f4797][0x0]['VoiceExtensionId']});var _0x1e1a41=_0x27f3c8[_0x7948('0x11')]++;_0x27f3c8['extensions'][_0x7948('0x19')]({'type':_0x10ee50[_0x2f4797][0x0][_0x7948('0x14')],'app':_0x7948('0x22'),'appdata':_0x7948('0x23')+(_0x1e1a41+0x2)+_0x7948('0x24')+(_0x1e1a41+0x1)+')','context':_0x10ee50[_0x2f4797][0x0][_0x7948('0x21')],'exten':_0x10ee50[_0x2f4797][0x0][_0x7948('0xb')],'priority':_0x1e1a41,'VoiceExtensionId':_0x10ee50[_0x2f4797][0x0]['VoiceExtensionId']});if(_0x27f3c8[_0x7948('0x1c')]){_0x27f3c8[_0x7948('0x12')][_0x7948('0x19')]({'type':_0x10ee50[_0x2f4797][0x0][_0x7948('0x14')],'app':'Set','appdata':_0x27f3c8[_0x7948('0x1c')][_0x7948('0x1e')]?_0x7948('0x25')+_0x27f3c8[_0x7948('0x1c')][_0x7948('0x1e')]+'}':_0x7948('0x26'),'context':_0x10ee50[_0x2f4797][0x0][_0x7948('0x21')],'exten':_0x10ee50[_0x2f4797][0x0][_0x7948('0xb')],'priority':_0x27f3c8[_0x7948('0x11')]++,'VoiceExtensionId':_0x10ee50[_0x2f4797][0x0]['VoiceExtensionId']});}_0x27f3c8[_0x7948('0x12')]['push']({'type':_0x10ee50[_0x2f4797][0x0][_0x7948('0x14')],'app':'Set','appdata':_0x7948('0x27')+_0x10ee50[_0x2f4797][0x0]['VoiceExtensionId'],'context':_0x10ee50[_0x2f4797][0x0][_0x7948('0x21')],'exten':_0x10ee50[_0x2f4797][0x0]['exten'],'priority':_0x27f3c8[_0x7948('0x11')]++,'VoiceExtensionId':_0x10ee50[_0x2f4797][0x0][_0x7948('0x18')]});if(_0x27f3c8['extension']&&_0x27f3c8['extension'][_0x7948('0x28')](_0x7948('0x29'))&&_0x27f3c8[_0x7948('0x1c')][_0x7948('0x29')]!=='none'){_0x27f3c8['extensions']['push']({'type':_0x10ee50[_0x2f4797][0x0][_0x7948('0x14')],'app':_0x7948('0x15'),'appdata':_0x7948('0x2a'),'context':_0x10ee50[_0x2f4797][0x0][_0x7948('0x21')],'exten':_0x10ee50[_0x2f4797][0x0][_0x7948('0xb')],'priority':_0x27f3c8[_0x7948('0x11')]++,'VoiceExtensionId':_0x10ee50[_0x2f4797][0x0][_0x7948('0x18')]});_0x27f3c8['extensions'][_0x7948('0x19')]({'type':_0x10ee50[_0x2f4797][0x0]['type'],'app':_0x7948('0x15'),'appdata':_0x7948('0x2b')+_0x27f3c8['extension'][_0x7948('0x29')]||_0x7948('0x2c'),'context':_0x10ee50[_0x2f4797][0x0][_0x7948('0x21')],'exten':_0x10ee50[_0x2f4797][0x0][_0x7948('0xb')],'priority':_0x27f3c8[_0x7948('0x11')]++,'VoiceExtensionId':_0x10ee50[_0x2f4797][0x0][_0x7948('0x18')]});}}_0x27f3c8[_0x7948('0x12')][_0x7948('0x19')]({'type':_0x10ee50[_0x2f4797][0x0][_0x7948('0x14')],'app':_0x7948('0x15'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x10ee50[_0x2f4797][0x0]['context'],'exten':_0x10ee50[_0x2f4797][0x0][_0x7948('0xb')],'priority':_0x27f3c8[_0x7948('0x11')]++,'VoiceExtensionId':_0x10ee50[_0x2f4797][0x0][_0x7948('0x18')]});_0x27f3c8['extensions'][_0x7948('0x19')]({'type':_0x10ee50[_0x2f4797][0x0][_0x7948('0x14')],'app':_0x7948('0x15'),'appdata':_0x7948('0x2d'),'context':_0x10ee50[_0x2f4797][0x0][_0x7948('0x21')],'exten':_0x10ee50[_0x2f4797][0x0][_0x7948('0xb')],'priority':_0x27f3c8[_0x7948('0x11')]++,'VoiceExtensionId':_0x10ee50[_0x2f4797][0x0][_0x7948('0x18')]});_0x27f3c8[_0x7948('0x12')][_0x7948('0x19')]({'type':_0x10ee50[_0x2f4797][0x0][_0x7948('0x14')],'app':'Set','appdata':_0x7948('0x2e'),'context':_0x10ee50[_0x2f4797][0x0][_0x7948('0x21')],'exten':_0x10ee50[_0x2f4797][0x0]['exten'],'priority':_0x27f3c8['priority']++,'VoiceExtensionId':_0x10ee50[_0x2f4797][0x0][_0x7948('0x18')]});for(var _0xac3909=0x0,_0x54b678=0x0;_0xac3909<_0x10ee50[_0x2f4797][_0x7948('0x2f')];_0xac3909+=0x1,_0x54b678=0x0){var _0x5eb17f=_0x10ee50[_0x2f4797][_0xac3909];if(_0x5eb17f[_0x7948('0x14')]){_0x5eb17f[_0x7948('0x14')]=_0x5eb17f['type'][_0x7948('0x30')]();}var _0x29d546=[];var _0xe66bcf=[];delete _0x5eb17f['id'];delete _0x5eb17f[_0x7948('0x31')];delete _0x5eb17f[_0x7948('0x32')];var _0x49069a=_0x5eb17f[_0x7948('0x33')]!==_0x7948('0x34')?[_0x5eb17f[_0x7948('0x33')]]:_0x5eb17f[_0x7948('0x8')]?_[_0x7948('0xa')](_['filter'](_0x27f3c8[_0x7948('0x6')],{'IntervalId':_0x5eb17f[_0x7948('0x8')]}),_0x7948('0x33')):[];if(_0x5eb17f[_0x7948('0x28')](_0x7948('0x35'))){if(_0x5eb17f[_0x7948('0x35')]&&_0x5eb17f[_0x7948('0x35')]!=='--'){_0x29d546['push']({'type':_0x5eb17f[_0x7948('0x14')],'app':_0x7948('0x15'),'appdata':_0x7948('0x36')+_0x5eb17f[_0x7948('0x35')],'context':_0x5eb17f[_0x7948('0x21')],'exten':_0x5eb17f[_0x7948('0xb')],'priority':_0x49069a[_0x7948('0x2f')]+_0x27f3c8['priority']+_0x54b678++,'VoiceExtensionId':_0x5eb17f['VoiceExtensionId']});}}if(_0x5eb17f['type']===_0x7948('0x1b')&&_0x5eb17f[_0x7948('0x28')](_0x7948('0x37'))){if(_0x5eb17f[_0x7948('0x37')]){_0x29d546[_0x7948('0x19')]({'type':_0x5eb17f[_0x7948('0x14')],'app':_0x7948('0x22'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x5eb17f[_0x7948('0x37')]+')','context':_0x5eb17f[_0x7948('0x21')],'exten':_0x5eb17f[_0x7948('0xb')],'priority':_0x49069a[_0x7948('0x2f')]+_0x27f3c8['priority']+_0x54b678++,'VoiceExtensionId':_0x5eb17f[_0x7948('0x18')]});}else{_0x29d546['push']({'type':_0x5eb17f[_0x7948('0x14')],'app':_0x7948('0x22'),'appdata':_0x7948('0x38'),'context':_0x5eb17f[_0x7948('0x21')],'exten':_0x5eb17f[_0x7948('0xb')],'priority':_0x49069a[_0x7948('0x2f')]+_0x27f3c8[_0x7948('0x11')]+_0x54b678++,'VoiceExtensionId':_0x5eb17f[_0x7948('0x18')]});}}if(_0x5eb17f[_0x7948('0x28')]('answer')){if(_0xa06596[_0x7948('0x39')](_0x5eb17f['app']['toLowerCase']())>=0x0&&_0x5eb17f[_0x7948('0x3a')]!==_0x7948('0x3b')){if(_0x5eb17f[_0x7948('0x3c')]){_0x29d546[_0x7948('0x19')]({'type':_0x5eb17f[_0x7948('0x14')],'app':_0x7948('0x22'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5eb17f[_0x7948('0x21')],'exten':_0x5eb17f[_0x7948('0xb')],'priority':_0x49069a[_0x7948('0x2f')]+_0x27f3c8['priority']+_0x54b678++,'VoiceExtensionId':_0x5eb17f['VoiceExtensionId']});_0x29d546[_0x7948('0x19')]({'type':_0x5eb17f['type'],'app':_0x7948('0x15'),'appdata':_0x7948('0x3d'),'context':_0x5eb17f['context'],'exten':_0x5eb17f[_0x7948('0xb')],'priority':_0x49069a['length']+_0x27f3c8[_0x7948('0x11')]+_0x54b678++,'VoiceExtensionId':_0x5eb17f['VoiceExtensionId']});}else{_0x29d546[_0x7948('0x19')]({'type':_0x5eb17f['type'],'app':_0x7948('0x22'),'appdata':_0x7948('0x3e'),'context':_0x5eb17f['context'],'exten':_0x5eb17f[_0x7948('0xb')],'priority':_0x49069a[_0x7948('0x2f')]+_0x27f3c8['priority']+_0x54b678++,'VoiceExtensionId':_0x5eb17f[_0x7948('0x18')]});_0x29d546[_0x7948('0x19')]({'type':_0x5eb17f[_0x7948('0x14')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5eb17f['context'],'exten':_0x5eb17f[_0x7948('0xb')],'priority':_0x49069a[_0x7948('0x2f')]+_0x27f3c8['priority']+_0x54b678++,'VoiceExtensionId':_0x5eb17f['VoiceExtensionId']});}}}for(var _0x472050=0x0;_0x472050<_0x49069a[_0x7948('0x2f')];_0x472050+=0x1){var _0x50cd25=_0x27f3c8['priority']+_0x49069a[_0x7948('0x2f')];var _0x76ecae=_0x472050===_0x49069a[_0x7948('0x2f')]-0x1?_0x27f3c8[_0x7948('0x11')]+_0x29d546['length']+_0xe66bcf[_0x7948('0x2f')]+0x2:_0x27f3c8['priority']+_0x472050+0x1;_0x29d546['splice'](_0x472050,0x0,{'type':_0x5eb17f[_0x7948('0x14')],'app':_0x7948('0x3f'),'appdata':_0x49069a[_0x472050]+'?'+_0x5eb17f[_0x7948('0x21')]+_0x7948('0x40')+_0x50cd25+':'+_0x5eb17f[_0x7948('0x21')]+_0x7948('0x40')+_0x76ecae,'exten':_0x5eb17f[_0x7948('0xb')],'context':_0x5eb17f['context'],'priority':_0x27f3c8[_0x7948('0x11')]+_0x472050,'VoiceExtensionId':_0x10ee50[_0x2f4797][0x0]['VoiceExtensionId']});}_0x5eb17f[_0x7948('0x11')]=_0x29d546[_0x7948('0x2f')]?_[_0x7948('0x41')](_0x29d546)[_0x7948('0x11')]+0x1:_0x27f3c8['priority'];_0x27f3c8[_0x7948('0x11')]=(_0xe66bcf[_0x7948('0x2f')]?_[_0x7948('0x41')](_0xe66bcf)[_0x7948('0x11')]:_0x5eb17f[_0x7948('0x11')])+0x1;_0x27f3c8[_0x7948('0x12')]=_[_0x7948('0x42')](_0x27f3c8[_0x7948('0x12')],_0x29d546,[_0x5eb17f],_0xe66bcf);}_0x27f3c8[_0x7948('0x12')][_0x7948('0x19')]({'type':_0x10ee50[_0x2f4797][0x0][_0x7948('0x14')],'app':_0x7948('0x43'),'exten':_0x10ee50[_0x2f4797][0x0][_0x7948('0xb')],'context':_0x10ee50[_0x2f4797][0x0][_0x7948('0x21')],'priority':_0x27f3c8[_0x7948('0x11')],'VoiceExtensionId':_0x10ee50[_0x2f4797][0x0][_0x7948('0x18')]});_0x5dd600[_0x7948('0x19')](_0x10ee50[_0x2f4797][0x0]['VoiceExtensionId']);_0x321a23=_[_0x7948('0x42')](_0x321a23,_0x27f3c8[_0x7948('0x12')]);}}return _0x3eff4d[_0x7948('0x44')](function(_0x212996){return _0x3eff4d[_0x7948('0x2')][_0x7948('0x7')][_0x7948('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x5dd600}},'transaction':_0x212996})[_0x7948('0x5')](function(_0x4f2fa5){return _0x3eff4d[_0x7948('0x2')][_0x7948('0x7')][_0x7948('0x46')](_[_0x7948('0x47')](_0x321a23,_0x7948('0x11')),{'transaction':_0x212996});});});})['catch'](function(_0x1575c8){console['error'](_0x1575c8);});}exports[_0x7948('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index fb20001..71a1cb2 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 _0x8a5e=['outbound','CmList','Lists','get','dialCheckDuplicateType','always','push','sequelize','VoiceQueueId','all','BlackLists','query','Campaign','CampaignId','onlyIfOpen','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','undefined','argv','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','duplicate','Duplicate\x20Contact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','toString','NOW()','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','from','cm_hopper','\x20=\x20?','into','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','deletedAt\x20IS\x20NULL','VoiceQueue','findAll'];(function(_0xa8d84f,_0x512e08){var _0x220939=function(_0x496f6d){while(--_0x496f6d){_0xa8d84f['push'](_0xa8d84f['shift']());}};_0x220939(++_0x512e08);}(_0x8a5e,0x1ed));var _0xe8a5=function(_0x330187,_0x2f1165){_0x330187=_0x330187-0x0;var _0x440c63=_0x8a5e[_0x330187];return _0x440c63;};'use strict';var BPromise=require(_0xe8a5('0x0'));var util=require(_0xe8a5('0x1'));var _=require(_0xe8a5('0x2'));var fs=require('fs');var squel=require(_0xe8a5('0x3'));var Papa=require('papaparse');var Redis=require(_0xe8a5('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xe8a5('0x5'));var logger=require(_0xe8a5('0x6'))(_0xe8a5('0x7'));config[_0xe8a5('0x8')]=_[_0xe8a5('0x9')](config[_0xe8a5('0x8')],{'host':_0xe8a5('0xa'),'port':0x18eb});var socket=require(_0xe8a5('0xb'))(new Redis(config['redis']));require(_0xe8a5('0xc'))[_0xe8a5('0xd')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0xe8a5('0xe')||process[_0xe8a5('0xf')][0x2]==='null'){throw new Error(_0xe8a5('0x10'));}var FILEPATH=process[_0xe8a5('0xf')][0x2];if(!process[_0xe8a5('0xf')][0x3]||process[_0xe8a5('0xf')][0x3]===_0xe8a5('0xe')||process[_0xe8a5('0xf')][0x3]===_0xe8a5('0x11')||!process['argv'][0x4]||process['argv'][0x4]===_0xe8a5('0xe')||process['argv'][0x4]===_0xe8a5('0x11')){throw new Error(_0xe8a5('0x12'));}var FIELDS=_[_0xe8a5('0x13')](process[_0xe8a5('0xf')][0x3][_0xe8a5('0x14')](','),process[_0xe8a5('0xf')][0x4]['split'](','));if(!process[_0xe8a5('0xf')][0x5]||process[_0xe8a5('0xf')][0x5]===_0xe8a5('0xe')||process[_0xe8a5('0xf')][0x5]===_0xe8a5('0x11')){throw new Error(_0xe8a5('0x15'));}var LISTID=process[_0xe8a5('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xe8a5('0xf')][0x6]!==_0xe8a5('0xe')&&process[_0xe8a5('0xf')][0x6]!==_0xe8a5('0x11')?process[_0xe8a5('0xf')][0x6]:null;var DUPLICATES=process[_0xe8a5('0xf')][0x7]&&process[_0xe8a5('0xf')][0x7]!==_0xe8a5('0xe')&&process[_0xe8a5('0xf')][0x7]!==_0xe8a5('0x11')?process[_0xe8a5('0xf')][0x7]:null;if(!process[_0xe8a5('0xf')][0x8]||process[_0xe8a5('0xf')][0x8]===_0xe8a5('0xe')||process[_0xe8a5('0xf')][0x8]===_0xe8a5('0x11')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x321659){logger[_0xe8a5('0x16')](_0x321659);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(_0x23ccef,_0x49ec72,_0xed69aa,_0x4c9025){var _0x445c91={'message':_0x49ec72};_0x445c91[_0x23ccef]=!![];if(_0xed69aa){_0x445c91[_0xe8a5('0x17')]=_0xed69aa;}if(_0x4c9025){_0x445c91[_0xe8a5('0x18')]=_0x4c9025;}return _0x445c91;}function isEmail(_0xbe2fd1){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))*$/[_0xe8a5('0x19')](_0xbe2fd1);}function checkRow(_0x2a8a25,_0x51c5b5,_0x1728dc){return new BPromise(function(_0x25449a,_0x2b3e13){if(_[_0xe8a5('0x1a')](_0x2a8a25)){return _0x2b3e13(handleCheckRowError(_0xe8a5('0x16'),_0xe8a5('0x1b'),null,_0x1728dc));}if(_0x2a8a25[_0xe8a5('0x1c')]&&_0x2a8a25[_0xe8a5('0x1c')][_0xe8a5('0x1d')]){var _0x3b856f=_[_0xe8a5('0x1e')](_0x2a8a25[_0xe8a5('0x1c')],_0xe8a5('0x1f'))[_0xe8a5('0x20')](';');return _0x2b3e13(handleCheckRowError(_0xe8a5('0x16'),_0x3b856f,null,_0x1728dc));}var _0x31708b={};for(var _0x1b1d86 in FIELDS){if(FIELDS[_0xe8a5('0x21')](_0x1b1d86)&&FIELDS[_0x1b1d86]){_0x31708b[_0x1b1d86]=_0x2a8a25[_0xe8a5('0x22')][0x0][FIELDS[_0x1b1d86]]||_0x2a8a25['data'][0x0]['\ufeff'+FIELDS[_0x1b1d86]];}}if(!_0x31708b[_0xe8a5('0x23')]){return _0x2b3e13(handleCheckRowError('error',_0xe8a5('0x24'),null,_0x1728dc));}if(!_0x31708b[_0xe8a5('0x25')]){return _0x2b3e13(handleCheckRowError(_0xe8a5('0x16'),_0xe8a5('0x26'),null,_0x1728dc));}if(_0x31708b[_0xe8a5('0x27')]){var _0x5b8336=moment(_0x31708b['birthDate'],_0xe8a5('0x28'));if(!_0x5b8336[_0xe8a5('0x29')]()){return _0x2b3e13(handleCheckRowError(_0xe8a5('0x16'),_0xe8a5('0x2a'),null,_0x1728dc));}}if(_0x31708b[_0xe8a5('0x2b')]){if(!isEmail(_0x31708b[_0xe8a5('0x2b')])){return _0x2b3e13(handleCheckRowError(_0xe8a5('0x16'),_0xe8a5('0x2c'),null,_0x1728dc));}}_0x31708b[_0xe8a5('0x2d')]=LISTID;_0x31708b['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xe8a5('0x1d')]&&_0x51c5b5){var _0x3acc8e={};for(var _0x392414=0x0,_0x2f832b=DUPLICATES[_0xe8a5('0x1d')];_0x392414<_0x2f832b;_0x392414+=0x1){_0x3acc8e[DUPLICATES[_0x392414]]=_0x31708b[DUPLICATES[_0x392414]];}var _0x12d508=_['find'](_0x51c5b5,_0x3acc8e);if(_0x12d508){return _0x2b3e13(handleCheckRowError(_0xe8a5('0x2e'),_0xe8a5('0x2f'),_0x12d508,_0x1728dc));}}return db['CmContact'][_0xe8a5('0x30')](_0x31708b,{'raw':!![],'hooks':![],'fields':_[_0xe8a5('0x31')](_0x31708b)})[_0xe8a5('0x32')](function(_0x9a7ff4){if(DUPLICATES&&DUPLICATES[_0xe8a5('0x1d')]&&_0x51c5b5){_0x51c5b5['push'](_[_0xe8a5('0x33')](_0x31708b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x9a7ff4['id'];return _0x25449a();})[_0xe8a5('0x34')](function(_0x2aad8f){return _0x2b3e13(handleCheckRowError(_0xe8a5('0x16'),_0xe8a5('0x35')+(_0x2aad8f[_0xe8a5('0x1f')]||JSON[_0xe8a5('0x36')](_0x2aad8f)),null,_0x1728dc));});});}function checkHopper(){function _0x5a5bf2(){return function(_0xce2f6f){logger[_0xe8a5('0x16')](_0xe8a5('0x37'),_0xe8a5('0x38'),util['inspect'](_0xce2f6f,{'showHidden':![],'depth':null}));};}var _0x146176=function(_0x1d804c,_0x2a536d){var _0x53ff80=squel[_0xe8a5('0x39')]()['into']('cm_hopper')[_0xe8a5('0x3a')](['phone',_0xe8a5('0x3b'),_0xe8a5('0x3c'),_0xe8a5('0x2d'),_0x2a536d,_0xe8a5('0x3d'),_0xe8a5('0x3e')],squel['select']()[_0xe8a5('0x3f')](_0xe8a5('0x25'),_0xe8a5('0x25'))[_0xe8a5('0x3f')]('NOW()','scheduledAt')[_0xe8a5('0x3f')]('id',_0xe8a5('0x3c'))[_0xe8a5('0x3f')](LISTID[_0xe8a5('0x40')](),_0xe8a5('0x2d'))[_0xe8a5('0x3f')](_0x1d804c['id'][_0xe8a5('0x40')](),_0x2a536d)['field'](_0xe8a5('0x41'),'createdAt')[_0xe8a5('0x3f')](_0xe8a5('0x41'),'updatedAt')['from']('cm_contacts')[_0xe8a5('0x42')]('deletedAt\x20IS\x20NULL')[_0xe8a5('0x42')](_0xe8a5('0x43'),LISTID[_0xe8a5('0x40')]())[_0xe8a5('0x42')](_0xe8a5('0x44'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xe8a5('0x45')]()[_0xe8a5('0x3f')](_0xe8a5('0x25'))[_0xe8a5('0x46')](_0xe8a5('0x47'))[_0xe8a5('0x42')](_0x2a536d+_0xe8a5('0x48'),_0x1d804c['id'][_0xe8a5('0x40')]())))[_0xe8a5('0x40')]();return _0x53ff80;};var _0x53b4af=function(_0x5046b4,_0xe97d75){var _0x296be1=squel[_0xe8a5('0x39')]()[_0xe8a5('0x49')](_0xe8a5('0x47'))['fromQuery']([_0xe8a5('0x25'),_0xe8a5('0x3b'),_0xe8a5('0x3c'),_0xe8a5('0x2d'),_0xe97d75,_0xe8a5('0x3d'),_0xe8a5('0x3e')],squel['select']()['field'](_0xe8a5('0x25'),_0xe8a5('0x25'))[_0xe8a5('0x3f')](_0xe8a5('0x41'),_0xe8a5('0x3b'))[_0xe8a5('0x3f')]('id',_0xe8a5('0x3c'))['field'](LISTID[_0xe8a5('0x40')](),_0xe8a5('0x2d'))['field'](_0x5046b4['id'][_0xe8a5('0x40')](),_0xe97d75)[_0xe8a5('0x3f')](_0xe8a5('0x41'),_0xe8a5('0x3d'))[_0xe8a5('0x3f')](_0xe8a5('0x41'),_0xe8a5('0x3e'))['from']('cm_contacts')[_0xe8a5('0x42')]('deletedAt\x20IS\x20NULL')[_0xe8a5('0x42')]('ListId\x20=\x20?',LISTID[_0xe8a5('0x40')]())[_0xe8a5('0x42')](_0xe8a5('0x4a'),squel[_0xe8a5('0x4b')](hopperContacts))[_0xe8a5('0x42')](_0xe8a5('0x44'))['where'](_0xe8a5('0x4c'),squel[_0xe8a5('0x45')]()[_0xe8a5('0x3f')](_0xe8a5('0x4d'))['from'](_0xe8a5('0x4e'))[_0xe8a5('0x42')](_0xe97d75+'\x20=\x20?',_0x5046b4['id'][_0xe8a5('0x40')]()))[_0xe8a5('0x42')](_0xe8a5('0x4c'),squel['select']()[_0xe8a5('0x3f')](_0xe8a5('0x25'))[_0xe8a5('0x46')](_0xe8a5('0x47'))[_0xe8a5('0x42')](_0xe97d75+_0xe8a5('0x48'),_0x5046b4['id'][_0xe8a5('0x40')]())))[_0xe8a5('0x40')]();return _0x296be1;};function _0x3055b1(_0x8e9740,_0x1e65ec){var _0x4d0789=squel['insert']()['into'](_0xe8a5('0x47'))[_0xe8a5('0x3a')]([_0xe8a5('0x25'),_0xe8a5('0x3b'),_0xe8a5('0x3c'),_0xe8a5('0x2d'),_0x1e65ec,_0xe8a5('0x3d'),_0xe8a5('0x3e')],squel[_0xe8a5('0x45')]()[_0xe8a5('0x3f')](_0xe8a5('0x25'),_0xe8a5('0x25'))[_0xe8a5('0x3f')](_0xe8a5('0x41'),_0xe8a5('0x3b'))['field']('id',_0xe8a5('0x3c'))[_0xe8a5('0x3f')](LISTID[_0xe8a5('0x40')](),_0xe8a5('0x2d'))[_0xe8a5('0x3f')](_0x8e9740['id'][_0xe8a5('0x40')](),_0x1e65ec)[_0xe8a5('0x3f')](_0xe8a5('0x41'),_0xe8a5('0x3d'))[_0xe8a5('0x3f')](_0xe8a5('0x41'),_0xe8a5('0x3e'))[_0xe8a5('0x46')]('cm_contacts')[_0xe8a5('0x42')](_0xe8a5('0x4f'))['where'](_0xe8a5('0x43'),LISTID[_0xe8a5('0x40')]())[_0xe8a5('0x42')](_0xe8a5('0x4a'),squel[_0xe8a5('0x4b')](hopperContacts))[_0xe8a5('0x42')](_0xe8a5('0x44')))[_0xe8a5('0x40')]();return _0x4d0789;}function _0x76faaa(_0x2b0783,_0x36abc7){var _0x397cc5=squel[_0xe8a5('0x39')]()['into']('cm_hopper_black')[_0xe8a5('0x3a')]([_0xe8a5('0x25'),'ContactId','ListId',_0x36abc7,_0xe8a5('0x3d'),_0xe8a5('0x3e')],squel[_0xe8a5('0x45')]()[_0xe8a5('0x3f')](_0xe8a5('0x25'),'phone')['field']('id',_0xe8a5('0x3c'))[_0xe8a5('0x3f')](LISTID[_0xe8a5('0x40')](),'ListId')['field'](_0x2b0783['id']['toString'](),_0x36abc7)['field'](_0xe8a5('0x41'),'createdAt')[_0xe8a5('0x3f')](_0xe8a5('0x41'),_0xe8a5('0x3e'))[_0xe8a5('0x46')]('cm_contacts')[_0xe8a5('0x42')](_0xe8a5('0x4f'))[_0xe8a5('0x42')](_0xe8a5('0x43'),LISTID[_0xe8a5('0x40')]())[_0xe8a5('0x42')]('id\x20IN\x20?',squel[_0xe8a5('0x4b')](hopperContacts))['where'](_0xe8a5('0x44')))[_0xe8a5('0x40')]();return _0x397cc5;}return db[_0xe8a5('0x50')][_0xe8a5('0x51')]({'where':{'type':_0xe8a5('0x52')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xe8a5('0x53')],'as':_0xe8a5('0x54'),'where':{'id':LISTID}}]})[_0xe8a5('0x32')](function(_0x1660a6){var _0xa1f01e=[];if(_0x1660a6){var _0x1a374b;for(var _0x3c1fee=0x0,_0x169f07;_0x3c1fee<_0x1660a6[_0xe8a5('0x1d')];_0x3c1fee+=0x1){_0x169f07=_0x1660a6[_0x3c1fee][_0xe8a5('0x55')]({'plain':!![]});switch(_0x169f07[_0xe8a5('0x56')]){case _0xe8a5('0x57'):_0xa1f01e[_0xe8a5('0x58')](db[_0xe8a5('0x59')]['query'](_0x53b4af(_0x169f07,_0xe8a5('0x5a')))[_0xe8a5('0x32')](function(){})[_0xe8a5('0x34')](_0x5a5bf2()));break;case'onlyIfOpen':_0xa1f01e[_0xe8a5('0x58')](db['sequelize']['query'](_0x146176(_0x169f07,'VoiceQueueId'))[_0xe8a5('0x32')](function(){})['catch'](_0x5a5bf2()));break;default:_0xa1f01e[_0xe8a5('0x58')](db[_0xe8a5('0x59')]['query'](_0x3055b1(_0x169f07,_0xe8a5('0x5a')))['then'](function(){})[_0xe8a5('0x34')](_0x5a5bf2()));}}}return _0xa1f01e;})[_0xe8a5('0x5b')]()['then'](function(){return db[_0xe8a5('0x50')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xe8a5('0x53')],'as':_0xe8a5('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x5228f0){var _0x11870f=[];if(_0x5228f0){var _0x2e6a9c;for(var _0x280b70=0x0,_0x43645c;_0x280b70<_0x5228f0[_0xe8a5('0x1d')];_0x280b70+=0x1){_0x43645c=_0x5228f0[_0x280b70]['get']({'plain':!![]});_0x11870f[_0xe8a5('0x58')](db[_0xe8a5('0x59')][_0xe8a5('0x5d')](_0x76faaa(_0x43645c,_0xe8a5('0x5a')))['then'](function(){})['catch'](_0x5a5bf2()));}}return _0x11870f;})[_0xe8a5('0x5b')]();})['then'](function(){return db[_0xe8a5('0x5e')][_0xe8a5('0x51')]({'attributes':['id',_0xe8a5('0x56')],'include':[{'model':db['CmList'],'as':_0xe8a5('0x54'),'where':{'id':LISTID}}]})['then'](function(_0x1c7d6b){var _0x41b502=[];if(_0x1c7d6b){for(var _0x167297=0x0,_0x3ef7db;_0x167297<_0x1c7d6b[_0xe8a5('0x1d')];_0x167297+=0x1){_0x3ef7db=_0x1c7d6b[_0x167297][_0xe8a5('0x55')]({'plain':!![]});switch(_0x3ef7db['dialCheckDuplicateType']){case _0xe8a5('0x57'):_0x41b502[_0xe8a5('0x58')](db[_0xe8a5('0x59')][_0xe8a5('0x5d')](_0x53b4af(_0x3ef7db,_0xe8a5('0x5f')))[_0xe8a5('0x32')](function(){})['catch'](_0x5a5bf2()));break;case _0xe8a5('0x60'):_0x41b502[_0xe8a5('0x58')](db[_0xe8a5('0x59')][_0xe8a5('0x5d')](_0x146176(_0x3ef7db,_0xe8a5('0x5f')))['then'](function(){})[_0xe8a5('0x34')](_0x5a5bf2()));break;default:_0x41b502['push'](db[_0xe8a5('0x59')]['query'](_0x3055b1(_0x3ef7db,_0xe8a5('0x5f')))[_0xe8a5('0x32')](function(){})[_0xe8a5('0x34')](_0x5a5bf2()));}}}return _0x41b502;})[_0xe8a5('0x5b')]();})[_0xe8a5('0x32')](function(){return db[_0xe8a5('0x5e')][_0xe8a5('0x51')]({'attributes':['id'],'include':[{'model':db[_0xe8a5('0x53')],'as':_0xe8a5('0x5c'),'where':{'id':LISTID}}]})[_0xe8a5('0x32')](function(_0xa34be3){var _0x41f309=[];if(_0xa34be3){for(var _0x1682d1=0x0,_0x5d3fbe;_0x1682d1<_0xa34be3[_0xe8a5('0x1d')];_0x1682d1+=0x1){_0x5d3fbe=_0xa34be3[_0x1682d1][_0xe8a5('0x55')]({'plain':!![]});_0x41f309['push'](db[_0xe8a5('0x59')][_0xe8a5('0x5d')](_0x76faaa(_0x5d3fbe,_0xe8a5('0x5f')))[_0xe8a5('0x32')](function(){})['catch'](_0x5a5bf2()));}}return _0x41f309;})[_0xe8a5('0x5b')]();})[_0xe8a5('0x34')](function(_0x13f0a5){logger[_0xe8a5('0x16')]('cmContact,\x20%s,\x20%s',_0xe8a5('0x61'),_0x13f0a5[_0xe8a5('0x1f')]);});}var processPromises=function(_0x528bd8){return BPromise['all'](promises)[_0xe8a5('0x32')](function(_0x56d10f){})['catch'](function(_0xfce70a){logger[_0xe8a5('0x16')](_0xe8a5('0x62'),JSON['stringify'](_0xfce70a));})[_0xe8a5('0x63')](function(){socket[_0xe8a5('0x64')](_0xe8a5('0x65')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x528bd8){return _0x528bd8[_0xe8a5('0x66')]();}});};var endCsv=function(){return BPromise[_0xe8a5('0x67')]()[_0xe8a5('0x32')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xe8a5('0x64')](_0xe8a5('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe8a5('0x68')](FILEPATH);}catch(_0x538525){logger[_0xe8a5('0x16')](_0xe8a5('0x69'),JSON['stringify'](_0x538525));}finally{process['exit'](0x0);}});};process['on'](_0xe8a5('0x6a'),function(){logger[_0xe8a5('0x6b')](_0xe8a5('0x6c'));endCsv();});function main(){return BPromise[_0xe8a5('0x67')]()[_0xe8a5('0x32')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xe8a5('0x14')](',');return db[_0xe8a5('0x6d')][_0xe8a5('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xe8a5('0x32')](function(_0x224a31){var _0x18f58a=fs[_0xe8a5('0x6e')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xe8a5('0x6f')](_0x18f58a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1ebf1d,_0x4ff4b5){total+=0x1;var _0x2c2820=total;promises[_0xe8a5('0x58')](checkRow(_0x1ebf1d,_0x224a31,_0x2c2820)[_0xe8a5('0x32')](function(){success+=0x1;})[_0xe8a5('0x34')](function(_0x191b53){if(_0x191b53[_0xe8a5('0x16')]){errors+=0x1;delete _0x191b53['error'];}else if(_0x191b53['duplicate']){duplicates+=0x1;delete _0x191b53[_0xe8a5('0x2e')];}rows['push'](_0x191b53);}));if(total%0xc8===0x0){_0x4ff4b5[_0xe8a5('0x70')]();return processPromises(_0x4ff4b5);}},'complete':function(){return processPromises()[_0xe8a5('0x32')](function(){logger[_0xe8a5('0x6b')](_0xe8a5('0x71'));endCsv();});},'error':function(_0x282338,_0x2aa62c){logger[_0xe8a5('0x6b')](_0xe8a5('0x72'),JSON[_0xe8a5('0x36')](_0x282338));endCsv();}});})['catch'](function(_0x42eb16){logger[_0xe8a5('0x16')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xe8a5('0x36')](_0x42eb16));});}main(); \ No newline at end of file +var _0x8d9f=['CampaignId','onlyIfOpen','BlackLists','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','bluebird','lodash','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','length','find','Duplicate\x20Contact','CmContact','create','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','scheduledAt','ContactId','createdAt','updatedAt','select','field','toString','NOW()','from','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','fromQuery','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','str','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','get','always','sequelize','VoiceQueueId','query','then','all','CmList','Campaign'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x8d9f,0x76));var _0xf8d9=function(_0x4f80eb,_0x4ffe81){_0x4f80eb=_0x4f80eb-0x0;var _0xfa6c3c=_0x8d9f[_0x4f80eb];return _0xfa6c3c;};'use strict';var BPromise=require(_0xf8d9('0x0'));var util=require('util');var _=require(_0xf8d9('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require('ioredis');var db=require(_0xf8d9('0x2'))['db'];var config=require(_0xf8d9('0x3'));var logger=require(_0xf8d9('0x4'))(_0xf8d9('0x5'));config['redis']=_[_0xf8d9('0x6')](config[_0xf8d9('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf8d9('0x8'))[_0xf8d9('0x9')](socket);try{if(!process['argv'][0x2]||process[_0xf8d9('0xa')][0x2]===_0xf8d9('0xb')||process[_0xf8d9('0xa')][0x2]===_0xf8d9('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0xf8d9('0xa')][0x3]===_0xf8d9('0xb')||process[_0xf8d9('0xa')][0x3]===_0xf8d9('0xc')||!process[_0xf8d9('0xa')][0x4]||process['argv'][0x4]===_0xf8d9('0xb')||process[_0xf8d9('0xa')][0x4]===_0xf8d9('0xc')){throw new Error(_0xf8d9('0xd'));}var FIELDS=_[_0xf8d9('0xe')](process[_0xf8d9('0xa')][0x3]['split'](','),process[_0xf8d9('0xa')][0x4][_0xf8d9('0xf')](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0xf8d9('0xb')||process['argv'][0x5]===_0xf8d9('0xc')){throw new Error(_0xf8d9('0x10'));}var LISTID=process[_0xf8d9('0xa')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xf8d9('0xa')][0x6]!==_0xf8d9('0xb')&&process[_0xf8d9('0xa')][0x6]!==_0xf8d9('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0xf8d9('0xa')][0x7]&&process[_0xf8d9('0xa')][0x7]!==_0xf8d9('0xb')&&process[_0xf8d9('0xa')][0x7]!==_0xf8d9('0xc')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0xf8d9('0xa')][0x8]===_0xf8d9('0xb')||process[_0xf8d9('0xa')][0x8]===_0xf8d9('0xc')){throw new Error(_0xf8d9('0x11'));}var SOCKET_TIMESTAMP=process[_0xf8d9('0xa')][0x8];}catch(_0x3f9735){logger[_0xf8d9('0x12')](_0x3f9735);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(_0x343bcc,_0x452beb,_0x2b1f9f,_0x2a611d){var _0x2ed175={'message':_0x452beb};_0x2ed175[_0x343bcc]=!![];if(_0x2b1f9f){_0x2ed175['contact']=_0x2b1f9f;}if(_0x2a611d){_0x2ed175[_0xf8d9('0x13')]=_0x2a611d;}return _0x2ed175;}function isEmail(_0x349080){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))*$/[_0xf8d9('0x14')](_0x349080);}function checkRow(_0x760527,_0x4f846a,_0x2746d7){return new BPromise(function(_0x5f3bde,_0x499426){if(_[_0xf8d9('0x15')](_0x760527)){return _0x499426(handleCheckRowError('error',_0xf8d9('0x16'),null,_0x2746d7));}if(_0x760527[_0xf8d9('0x17')]&&_0x760527[_0xf8d9('0x17')]['length']){var _0x1abf1c=_[_0xf8d9('0x18')](_0x760527[_0xf8d9('0x17')],_0xf8d9('0x19'))['join'](';');return _0x499426(handleCheckRowError(_0xf8d9('0x12'),_0x1abf1c,null,_0x2746d7));}var _0x55bfa9={};for(var _0x32f7ad in FIELDS){if(FIELDS[_0xf8d9('0x1a')](_0x32f7ad)&&FIELDS[_0x32f7ad]){_0x55bfa9[_0x32f7ad]=_0x760527[_0xf8d9('0x1b')][0x0][FIELDS[_0x32f7ad]]||_0x760527[_0xf8d9('0x1b')][0x0]['\ufeff'+FIELDS[_0x32f7ad]];}}if(!_0x55bfa9['firstName']){return _0x499426(handleCheckRowError(_0xf8d9('0x12'),_0xf8d9('0x1c'),null,_0x2746d7));}if(!_0x55bfa9[_0xf8d9('0x1d')]){return _0x499426(handleCheckRowError(_0xf8d9('0x12'),_0xf8d9('0x1e'),null,_0x2746d7));}if(_0x55bfa9[_0xf8d9('0x1f')]){var _0x24e889=moment(_0x55bfa9[_0xf8d9('0x1f')],_0xf8d9('0x20'));if(!_0x24e889['isValid']()){return _0x499426(handleCheckRowError('error',_0xf8d9('0x21'),null,_0x2746d7));}}if(_0x55bfa9['email']){if(!isEmail(_0x55bfa9[_0xf8d9('0x22')])){return _0x499426(handleCheckRowError(_0xf8d9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x2746d7));}}_0x55bfa9[_0xf8d9('0x23')]=LISTID;_0x55bfa9[_0xf8d9('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x4f846a){var _0x2e97d9={};for(var _0x44ba11=0x0,_0x2f8d56=DUPLICATES[_0xf8d9('0x25')];_0x44ba11<_0x2f8d56;_0x44ba11+=0x1){_0x2e97d9[DUPLICATES[_0x44ba11]]=_0x55bfa9[DUPLICATES[_0x44ba11]];}var _0x5d5bbc=_[_0xf8d9('0x26')](_0x4f846a,_0x2e97d9);if(_0x5d5bbc){return _0x499426(handleCheckRowError('duplicate',_0xf8d9('0x27'),_0x5d5bbc,_0x2746d7));}}return db[_0xf8d9('0x28')][_0xf8d9('0x29')](_0x55bfa9,{'raw':!![],'hooks':![],'fields':_['keys'](_0x55bfa9)})['then'](function(_0x297c72){if(DUPLICATES&&DUPLICATES[_0xf8d9('0x25')]&&_0x4f846a){_0x4f846a[_0xf8d9('0x2a')](_['pick'](_0x55bfa9,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x297c72['id'];return _0x5f3bde();})[_0xf8d9('0x2b')](function(_0x281e27){return _0x499426(handleCheckRowError(_0xf8d9('0x12'),_0xf8d9('0x2c')+(_0x281e27['message']||JSON[_0xf8d9('0x2d')](_0x281e27)),null,_0x2746d7));});});}function checkHopper(){function _0x19cc81(){return function(_0x487a9f){logger[_0xf8d9('0x12')]('cmContact',_0xf8d9('0x2e'),util[_0xf8d9('0x2f')](_0x487a9f,{'showHidden':![],'depth':null}));};}var _0x1c715d=function(_0x23db89,_0x55fc58){var _0x2bfa70=squel[_0xf8d9('0x30')]()[_0xf8d9('0x31')]('cm_hopper')['fromQuery'](['phone',_0xf8d9('0x32'),_0xf8d9('0x33'),_0xf8d9('0x23'),_0x55fc58,_0xf8d9('0x34'),_0xf8d9('0x35')],squel[_0xf8d9('0x36')]()[_0xf8d9('0x37')](_0xf8d9('0x1d'),_0xf8d9('0x1d'))[_0xf8d9('0x37')]('NOW()',_0xf8d9('0x32'))[_0xf8d9('0x37')]('id','ContactId')[_0xf8d9('0x37')](LISTID[_0xf8d9('0x38')](),_0xf8d9('0x23'))[_0xf8d9('0x37')](_0x23db89['id'][_0xf8d9('0x38')](),_0x55fc58)[_0xf8d9('0x37')](_0xf8d9('0x39'),'createdAt')[_0xf8d9('0x37')](_0xf8d9('0x39'),_0xf8d9('0x35'))[_0xf8d9('0x3a')]('cm_contacts')[_0xf8d9('0x3b')](_0xf8d9('0x3c'))['where']('ListId\x20=\x20?',LISTID['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0xf8d9('0x3b')](_0xf8d9('0x3d'),squel['select']()[_0xf8d9('0x37')](_0xf8d9('0x1d'))['from'](_0xf8d9('0x3e'))[_0xf8d9('0x3b')](_0x55fc58+'\x20=\x20?',_0x23db89['id'][_0xf8d9('0x38')]())))[_0xf8d9('0x38')]();return _0x2bfa70;};var _0x250903=function(_0x14e70f,_0x2003cd){var _0x2e323c=squel[_0xf8d9('0x30')]()[_0xf8d9('0x31')](_0xf8d9('0x3e'))[_0xf8d9('0x3f')]([_0xf8d9('0x1d'),'scheduledAt','ContactId',_0xf8d9('0x23'),_0x2003cd,_0xf8d9('0x34'),_0xf8d9('0x35')],squel[_0xf8d9('0x36')]()['field'](_0xf8d9('0x1d'),'phone')['field']('NOW()',_0xf8d9('0x32'))['field']('id',_0xf8d9('0x33'))['field'](LISTID[_0xf8d9('0x38')](),_0xf8d9('0x23'))[_0xf8d9('0x37')](_0x14e70f['id'][_0xf8d9('0x38')](),_0x2003cd)[_0xf8d9('0x37')](_0xf8d9('0x39'),'createdAt')[_0xf8d9('0x37')](_0xf8d9('0x39'),_0xf8d9('0x35'))['from']('cm_contacts')[_0xf8d9('0x3b')](_0xf8d9('0x3c'))['where'](_0xf8d9('0x40'),LISTID[_0xf8d9('0x38')]())[_0xf8d9('0x3b')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0xf8d9('0x3b')](_0xf8d9('0x41'))[_0xf8d9('0x3b')](_0xf8d9('0x3d'),squel['select']()[_0xf8d9('0x37')](_0xf8d9('0x42'))[_0xf8d9('0x3a')](_0xf8d9('0x43'))['where'](_0x2003cd+_0xf8d9('0x44'),_0x14e70f['id']['toString']()))[_0xf8d9('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf8d9('0x36')]()['field'](_0xf8d9('0x1d'))['from'](_0xf8d9('0x3e'))[_0xf8d9('0x3b')](_0x2003cd+_0xf8d9('0x44'),_0x14e70f['id'][_0xf8d9('0x38')]())))[_0xf8d9('0x38')]();return _0x2e323c;};function _0x27c5e2(_0x37596c,_0x2bf0dc){var _0x4e9191=squel[_0xf8d9('0x30')]()[_0xf8d9('0x31')](_0xf8d9('0x3e'))['fromQuery']([_0xf8d9('0x1d'),_0xf8d9('0x32'),_0xf8d9('0x33'),_0xf8d9('0x23'),_0x2bf0dc,_0xf8d9('0x34'),_0xf8d9('0x35')],squel[_0xf8d9('0x36')]()[_0xf8d9('0x37')]('phone',_0xf8d9('0x1d'))[_0xf8d9('0x37')]('NOW()',_0xf8d9('0x32'))[_0xf8d9('0x37')]('id',_0xf8d9('0x33'))[_0xf8d9('0x37')](LISTID[_0xf8d9('0x38')](),'ListId')[_0xf8d9('0x37')](_0x37596c['id']['toString'](),_0x2bf0dc)['field'](_0xf8d9('0x39'),_0xf8d9('0x34'))['field'](_0xf8d9('0x39'),_0xf8d9('0x35'))[_0xf8d9('0x3a')]('cm_contacts')[_0xf8d9('0x3b')](_0xf8d9('0x3c'))['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0xf8d9('0x45'),squel[_0xf8d9('0x46')](hopperContacts))[_0xf8d9('0x3b')](_0xf8d9('0x41')))[_0xf8d9('0x38')]();return _0x4e9191;}function _0x453c4(_0x3ade1e,_0x5900f3){var _0x533977=squel['insert']()[_0xf8d9('0x31')](_0xf8d9('0x47'))[_0xf8d9('0x3f')]([_0xf8d9('0x1d'),_0xf8d9('0x33'),_0xf8d9('0x23'),_0x5900f3,_0xf8d9('0x34'),_0xf8d9('0x35')],squel[_0xf8d9('0x36')]()[_0xf8d9('0x37')](_0xf8d9('0x1d'),'phone')[_0xf8d9('0x37')]('id',_0xf8d9('0x33'))[_0xf8d9('0x37')](LISTID[_0xf8d9('0x38')](),_0xf8d9('0x23'))['field'](_0x3ade1e['id'][_0xf8d9('0x38')](),_0x5900f3)[_0xf8d9('0x37')]('NOW()',_0xf8d9('0x34'))[_0xf8d9('0x37')](_0xf8d9('0x39'),_0xf8d9('0x35'))['from'](_0xf8d9('0x48'))[_0xf8d9('0x3b')]('deletedAt\x20IS\x20NULL')[_0xf8d9('0x3b')](_0xf8d9('0x40'),LISTID['toString']())[_0xf8d9('0x3b')](_0xf8d9('0x45'),squel['str'](hopperContacts))[_0xf8d9('0x3b')](_0xf8d9('0x41')))[_0xf8d9('0x38')]();return _0x533977;}return db[_0xf8d9('0x49')][_0xf8d9('0x4a')]({'where':{'type':_0xf8d9('0x4b')},'attributes':['id',_0xf8d9('0x4c')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x19b312){var _0x375791=[];if(_0x19b312){var _0x24755d;for(var _0x37c413=0x0,_0x3a3d53;_0x37c413<_0x19b312[_0xf8d9('0x25')];_0x37c413+=0x1){_0x3a3d53=_0x19b312[_0x37c413][_0xf8d9('0x4d')]({'plain':!![]});switch(_0x3a3d53[_0xf8d9('0x4c')]){case _0xf8d9('0x4e'):_0x375791[_0xf8d9('0x2a')](db[_0xf8d9('0x4f')]['query'](_0x250903(_0x3a3d53,_0xf8d9('0x50')))['then'](function(){})[_0xf8d9('0x2b')](_0x19cc81()));break;case'onlyIfOpen':_0x375791[_0xf8d9('0x2a')](db[_0xf8d9('0x4f')][_0xf8d9('0x51')](_0x1c715d(_0x3a3d53,_0xf8d9('0x50')))[_0xf8d9('0x52')](function(){})['catch'](_0x19cc81()));break;default:_0x375791[_0xf8d9('0x2a')](db['sequelize'][_0xf8d9('0x51')](_0x27c5e2(_0x3a3d53,_0xf8d9('0x50')))['then'](function(){})[_0xf8d9('0x2b')](_0x19cc81()));}}}return _0x375791;})[_0xf8d9('0x53')]()['then'](function(){return db[_0xf8d9('0x49')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xf8d9('0x54')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xf8d9('0x52')](function(_0x4db1a5){var _0x42660e=[];if(_0x4db1a5){var _0x7c1c32;for(var _0x61562f=0x0,_0x103d5b;_0x61562f<_0x4db1a5[_0xf8d9('0x25')];_0x61562f+=0x1){_0x103d5b=_0x4db1a5[_0x61562f]['get']({'plain':!![]});_0x42660e[_0xf8d9('0x2a')](db['sequelize']['query'](_0x453c4(_0x103d5b,'VoiceQueueId'))['then'](function(){})[_0xf8d9('0x2b')](_0x19cc81()));}}return _0x42660e;})[_0xf8d9('0x53')]();})[_0xf8d9('0x52')](function(){return db[_0xf8d9('0x55')][_0xf8d9('0x4a')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xf8d9('0x54')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x391046){var _0x39488c=[];if(_0x391046){for(var _0x4cbab9=0x0,_0x54006d;_0x4cbab9<_0x391046[_0xf8d9('0x25')];_0x4cbab9+=0x1){_0x54006d=_0x391046[_0x4cbab9][_0xf8d9('0x4d')]({'plain':!![]});switch(_0x54006d['dialCheckDuplicateType']){case _0xf8d9('0x4e'):_0x39488c[_0xf8d9('0x2a')](db[_0xf8d9('0x4f')][_0xf8d9('0x51')](_0x250903(_0x54006d,_0xf8d9('0x56')))['then'](function(){})[_0xf8d9('0x2b')](_0x19cc81()));break;case _0xf8d9('0x57'):_0x39488c[_0xf8d9('0x2a')](db['sequelize'][_0xf8d9('0x51')](_0x1c715d(_0x54006d,_0xf8d9('0x56')))[_0xf8d9('0x52')](function(){})[_0xf8d9('0x2b')](_0x19cc81()));break;default:_0x39488c[_0xf8d9('0x2a')](db[_0xf8d9('0x4f')][_0xf8d9('0x51')](_0x27c5e2(_0x54006d,'CampaignId'))[_0xf8d9('0x52')](function(){})[_0xf8d9('0x2b')](_0x19cc81()));}}}return _0x39488c;})[_0xf8d9('0x53')]();})[_0xf8d9('0x52')](function(){return db[_0xf8d9('0x55')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xf8d9('0x54')],'as':_0xf8d9('0x58'),'where':{'id':LISTID}}]})[_0xf8d9('0x52')](function(_0x3725bf){var _0x3787f7=[];if(_0x3725bf){for(var _0x2bc67a=0x0,_0x101b92;_0x2bc67a<_0x3725bf[_0xf8d9('0x25')];_0x2bc67a+=0x1){_0x101b92=_0x3725bf[_0x2bc67a]['get']({'plain':!![]});_0x3787f7[_0xf8d9('0x2a')](db[_0xf8d9('0x4f')]['query'](_0x453c4(_0x101b92,_0xf8d9('0x56')))[_0xf8d9('0x52')](function(){})['catch'](_0x19cc81()));}}return _0x3787f7;})[_0xf8d9('0x53')]();})['catch'](function(_0x5c9e53){logger[_0xf8d9('0x12')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x5c9e53[_0xf8d9('0x19')]);});}var processPromises=function(_0x3d0a3c){return BPromise[_0xf8d9('0x53')](promises)[_0xf8d9('0x52')](function(_0x39e9b4){})[_0xf8d9('0x2b')](function(_0x2aea8f){logger[_0xf8d9('0x12')]('Error\x20processing\x20rows\x20block:',JSON[_0xf8d9('0x2d')](_0x2aea8f));})[_0xf8d9('0x59')](function(){socket[_0xf8d9('0x5a')](_0xf8d9('0x5b')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3d0a3c){return _0x3d0a3c[_0xf8d9('0x5c')]();}});};var endCsv=function(){return BPromise[_0xf8d9('0x5d')]()[_0xf8d9('0x52')](function(){if(hopperContacts){return checkHopper();}})[_0xf8d9('0x52')](function(){socket[_0xf8d9('0x5a')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xf8d9('0x5e')](FILEPATH);}catch(_0x5f02f5){logger[_0xf8d9('0x12')](_0xf8d9('0x5f'),JSON[_0xf8d9('0x2d')](_0x5f02f5));}finally{process[_0xf8d9('0x60')](0x0);}});};process['on'](_0xf8d9('0x61'),function(){logger['info'](_0xf8d9('0x62'));endCsv();});function main(){return BPromise[_0xf8d9('0x5d')]()[_0xf8d9('0x52')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xf8d9('0xf')](',');return db['CmContact'][_0xf8d9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x57b8c9){var _0x4ac80b=fs[_0xf8d9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xf8d9('0x64')](_0x4ac80b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5a7ec3,_0x48b629){total+=0x1;var _0x2219ad=total;promises[_0xf8d9('0x2a')](checkRow(_0x5a7ec3,_0x57b8c9,_0x2219ad)[_0xf8d9('0x52')](function(){success+=0x1;})[_0xf8d9('0x2b')](function(_0xe63525){if(_0xe63525[_0xf8d9('0x12')]){errors+=0x1;delete _0xe63525[_0xf8d9('0x12')];}else if(_0xe63525[_0xf8d9('0x65')]){duplicates+=0x1;delete _0xe63525['duplicate'];}rows['push'](_0xe63525);}));if(total%0xc8===0x0){_0x48b629['pause']();return processPromises(_0x48b629);}},'complete':function(){return processPromises()[_0xf8d9('0x52')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x457d8b,_0x569703){logger['info']('CSV\x20parse\x20error',JSON['stringify'](_0x457d8b));endCsv();}});})[_0xf8d9('0x2b')](function(_0x31af2b){logger[_0xf8d9('0x12')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xf8d9('0x2d')](_0x31af2b));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index b46fed5..6d106b7 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 _0x0750=['findOne','CmContactHasItem','update','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.id','cm_contacts.updatedAt','cm_hopper_black','from','cm_contacts','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.ListId','cm_contacts.ListId\x20=\x20','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','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','errors','code','message','sequelize','query','spread','catch','campaigns.id','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','start','binding','clone','root','server/files/tmp','.csv','keys','includes','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','rows','find','trim','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','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','DROP\x20TABLE\x20','contactId','contactTypeId','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','CampaignId','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','push','all','split','length','isNil'];(function(_0x129d38,_0x33eb62){var _0x1e7227=function(_0x44f024){while(--_0x44f024){_0x129d38['push'](_0x129d38['shift']());}};_0x1e7227(++_0x33eb62);}(_0x0750,0x9b));var _0x0075=function(_0x24bcfd,_0x5dec4a){_0x24bcfd=_0x24bcfd-0x0;var _0x2ea592=_0x0750[_0x24bcfd];return _0x2ea592;};'use strict';var fs=require('fs');var path=require(_0x0075('0x0'));var _=require(_0x0075('0x1'));var Papa=require('papaparse');var util=require(_0x0075('0x2'));var BPromise=require(_0x0075('0x3'));var moment=require(_0x0075('0x4'));var squel=require(_0x0075('0x5'));var Redis=require(_0x0075('0x6'));var db=require(_0x0075('0x7'))['db'];var config=require(_0x0075('0x8'));var shared=require('../../../config/environment/shared');var logger=require(_0x0075('0x9'))(_0x0075('0xa'));config[_0x0075('0xb')]=_[_0x0075('0xc')](config[_0x0075('0xb')],{'host':_0x0075('0xd'),'port':0x18eb});var socket=require(_0x0075('0xe'))(new Redis(config[_0x0075('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x0075('0xf')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x0075('0xf')](_0x0075('0x10'));function isEmail(_0x51c8a7){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))*$/[_0x0075('0x11')](_0x51c8a7);}function selectNotIn(_0x16c298,_0x1ac156,_0x16dc19,_0x261d6e,_0x562fc8){return squel['select']()[_0x0075('0x12')](_0x0075('0x13'))['from'](_0x261d6e)[_0x0075('0x14')](_0x1ac156,null,_0x1ac156+_0x0075('0x15')+_0x261d6e+'.'+_0x16dc19)[_0x0075('0x16')](_0x261d6e+'.'+_0x16dc19+_0x0075('0x17')+_0x16c298+'.'+_0x16dc19)[_0x0075('0x16')](_0x1ac156+_0x0075('0x18')+_0x562fc8[_0x0075('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x529a29,_0xeab4de){promisesAdditionalPhones=[];return db['CmContact'][_0x0075('0x19')]({'raw':!![],'attributes':['id',_0x0075('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x0075('0x1b')](function(_0x2e2822){if(_0x2e2822!==null){var _0x23312e=[];for(var _0xf4fbaf=0x0;_0xf4fbaf<_0x2e2822['length'];_0xf4fbaf++){var _0x5e2703=_0x2e2822[_0xf4fbaf];_0x23312e[_0x0075('0x1c')](insertAdditionalPhones(_0x5e2703));}}Promise[_0x0075('0x1d')](_0x23312e)[_0x0075('0x1b')](function(){_0x529a29({'val':0x1});});});});}function insertAdditionalPhones(_0x4f647){return new Promise(function(_0x4478c6,_0x2849ca){var _0x372375=_0x4f647[_0x0075('0x1a')];var _0x189821=_0x372375[_0x0075('0x1e')](';');var _0x15340a=[];orderBy=0x0;for(var _0x2cb1d5=0x0;_0x2cb1d5<_0x189821[_0x0075('0x1f')];_0x2cb1d5++){_0x15340a[_0x0075('0x1c')](splitAdditionalPhone(_0x4f647['id'],_0x189821[_0x2cb1d5]));}Promise[_0x0075('0x1d')](_0x15340a)['then'](function(){_0x4478c6({'val':_0x189821[_0x0075('0x1f')]});});});}function splitAdditionalPhone(_0x57a1df,_0x204f59){return new Promise(function(_0x2d4fc4,_0x1b6267){var _0x464000=_0x204f59[_0x0075('0x1e')](':');var _0x338279=_0x464000[0x0];var _0x313113=_0x464000[0x1];if(!_[_0x0075('0x20')](_0x313113)){var _0x336e4b=_0x313113[_0x0075('0x1e')]('|');var _0x33e973=[];for(var _0x596e20=0x0;_0x596e20<_0x336e4b[_0x0075('0x1f')];_0x596e20++){if(_0x336e4b[_0x596e20]!==''){var _0x53f7f8=_['filter'](promisesAdditionalPhones,{'contactId':_0x57a1df,'phone':_0x336e4b[_0x596e20]});if(_0x53f7f8['length']==0x0){orderBy++;promisesAdditionalPhones[_0x0075('0x1c')]({'contactId':_0x57a1df,'contactTypeId':_0x338279,'phone':_0x336e4b[_0x596e20],'orderBy':orderBy});}}}_0x2d4fc4({'ok':0x1});}else _0x2d4fc4({'res':0x0});});}function createAdditionalPhone(_0x582842,_0xa3a74,_0x359592,_0x5db35a){var _0x433b16='';var _0x5f339b='';var _0x1bf1b3=_0x359592[_0x0075('0x1e')]('§');_0x433b16=_0x1bf1b3[0x0];if(_0x1bf1b3[_0x0075('0x1f')]==0x2)_0x5f339b=_0x1bf1b3[0x1];return new Promise(function(_0x12a54b,_0x557503){return db['CmContactHasItem'][_0x0075('0x21')]({'where':{'CmContactId':_0x582842,'item':_0x433b16}})[_0x0075('0x1b')](function(_0x5c860e){if(_0x5c860e){return db[_0x0075('0x22')][_0x0075('0x23')]({'ItemTypeId':_0xa3a74,'description':_0x5f339b,'OrderBy':_0x5db35a},{'where':{'CmContactId':_0x582842,'item':_0x433b16}})['then'](function(_0x56717c){_0x12a54b({'res':'updated'});});}else{return db[_0x0075('0x22')][_0x0075('0x24')]({'CmContactId':_0x582842,'item':_0x433b16,'description':_0x5f339b,'ItemTypeId':_0xa3a74,'OrderBy':_0x5db35a,'ItemClass':'PHONE'})[_0x0075('0x1b')](function(_0x24f4ce){_0x12a54b({'res':_0x0075('0x25')});});}});});}function insertCmHopper(_0x5d7742,_0x9de254,_0x15d2aa,_0x2decb3,_0x5b916e){var _0x5e9915=[_0x0075('0x26'),_0x0075('0x27'),'cm_contacts.id','cm_contacts.ListId',_0x9de254+'.'+_0x2decb3,_0x0075('0x28'),'cm_contacts.updatedAt',_0x0075('0x29'),_0x0075('0x2a'),'\x22'+_0x5b916e+'\x22'];return squel[_0x0075('0x2b')]()[_0x0075('0x2c')](_0x0075('0x2d'))[_0x0075('0x2e')]([_0x0075('0x13'),_0x0075('0x2f'),_0x0075('0x30'),_0x0075('0x31'),_0x2decb3,_0x0075('0x32'),_0x0075('0x33'),_0x0075('0x34'),_0x0075('0x35'),_0x0075('0x36')],squel[_0x0075('0x37')]()[_0x0075('0x38')](_0x5e9915)['from'](_0x9de254)[_0x0075('0x14')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x9de254+_0x0075('0x39'))[_0x0075('0x14')](_0x15d2aa,null,_0x15d2aa+_0x0075('0x15')+_0x9de254+'.'+_0x2decb3)[_0x0075('0x16')](_0x9de254+_0x0075('0x3a'),_0x5d7742)[_0x0075('0x16')](_0x0075('0x3b'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x9de254,_0x15d2aa,_0x2decb3,_0x0075('0x2d'),[_0x0075('0x3c'),_0x0075('0x3d')]))[_0x0075('0x16')](_0x0075('0x3e'),selectNotIn(_0x9de254,_0x15d2aa,_0x2decb3,'cm_hopper',[_0x0075('0x3c')])))[_0x0075('0x3f')]();}function insertCmHopperBlack(_0x371419,_0x892163,_0x2fc247,_0x130880){var _0x4ad8e5=[_0x0075('0x26'),_0x0075('0x40'),'cm_contacts.ListId',_0x892163+'.'+_0x130880,_0x0075('0x28'),_0x0075('0x41')];return squel['insert']()[_0x0075('0x2c')](_0x0075('0x42'))[_0x0075('0x2e')]([_0x0075('0x13'),_0x0075('0x30'),_0x0075('0x31'),_0x130880,'createdAt',_0x0075('0x33')],squel[_0x0075('0x37')]()[_0x0075('0x38')](_0x4ad8e5)[_0x0075('0x43')](_0x892163)[_0x0075('0x14')](_0x0075('0x44'),null,'cm_contacts.ListId\x20=\x20'+_0x892163+_0x0075('0x39'))[_0x0075('0x14')](_0x2fc247,null,_0x2fc247+_0x0075('0x15')+_0x892163+'.'+_0x130880)[_0x0075('0x16')](_0x892163+_0x0075('0x3a'),_0x371419)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0075('0x16')](_0x0075('0x3e'),squel['select']()[_0x0075('0x12')](_0x0075('0x13'))[_0x0075('0x43')](_0x0075('0x42'))['where'](_0x0075('0x45'),_0x371419)[_0x0075('0x16')](_0x130880+_0x0075('0x17')+_0x892163+'.'+_0x130880)))[_0x0075('0x3f')]();}function insertTzCmHopper(_0x3183b5,_0x4f7dfa,_0x1f2f6a,_0x71def6,_0x137013,_0x48f729){var _0x3cce0e=[_0x0075('0x26'),_0x0075('0x46')+_0x48f729+_0x0075('0x47'),_0x0075('0x40'),_0x0075('0x48'),_0x4f7dfa+'.'+_0x71def6,_0x0075('0x28'),'cm_contacts.updatedAt',_0x0075('0x29'),'cm_contacts.UserId','\x22'+_0x137013+'\x22'];var _0x5beb7c=squel[_0x0075('0x2b')]()[_0x0075('0x2c')](_0x0075('0x2d'))[_0x0075('0x2e')](['phone','scheduledat',_0x0075('0x30'),_0x0075('0x31'),_0x71def6,_0x0075('0x32'),_0x0075('0x33'),_0x0075('0x34'),_0x0075('0x35'),_0x0075('0x36')],squel[_0x0075('0x37')]()[_0x0075('0x38')](_0x3cce0e)[_0x0075('0x43')](_0x4f7dfa)[_0x0075('0x14')]('cm_contacts',null,_0x0075('0x49')+_0x4f7dfa+_0x0075('0x39'))['join'](_0x1f2f6a,null,_0x1f2f6a+_0x0075('0x15')+_0x4f7dfa+'.'+_0x71def6)['join'](_0x48f729,null,_0x48f729+'.id\x20=\x20'+_0x4f7dfa+'.'+_0x71def6)[_0x0075('0x16')](_0x4f7dfa+_0x0075('0x3a'),_0x3183b5)[_0x0075('0x16')](_0x0075('0x3b'),NOW)[_0x0075('0x16')](_0x0075('0x3e'),selectNotIn(_0x4f7dfa,_0x1f2f6a,_0x71def6,'cm_hopper',[_0x0075('0x3c'),_0x0075('0x3d')]))[_0x0075('0x16')](_0x0075('0x3e'),selectNotIn(_0x4f7dfa,_0x1f2f6a,_0x71def6,_0x0075('0x2d'),[_0x0075('0x3c')])))[_0x0075('0x3f')]();return _0x5beb7c;}function insertTzCmHopperBlack(_0x2a7f5b,_0x599779,_0x3aa889,_0x1ac556){var _0x10c903=[_0x0075('0x26'),'cm_contacts.id',_0x0075('0x48'),_0x599779+'.'+_0x1ac556,'cm_contacts.createdAt',_0x0075('0x41')];return squel['insert']()[_0x0075('0x2c')]('cm_hopper_black')[_0x0075('0x2e')]([_0x0075('0x13'),_0x0075('0x30'),'ListId',_0x1ac556,'createdAt',_0x0075('0x33')],squel['select']()[_0x0075('0x38')](_0x10c903)['from'](_0x599779)[_0x0075('0x14')](_0x0075('0x44'),null,'cm_contacts.ListId\x20=\x20'+_0x599779+'.CmListId')['join'](_0x3aa889,null,_0x3aa889+_0x0075('0x15')+_0x599779+'.'+_0x1ac556)['where'](_0x599779+_0x0075('0x3a'),_0x2a7f5b)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0075('0x16')](_0x0075('0x3e'),squel[_0x0075('0x37')]()['field'](_0x0075('0x13'))[_0x0075('0x43')](_0x0075('0x42'))[_0x0075('0x16')](_0x0075('0x45'),_0x2a7f5b)[_0x0075('0x16')](_0x1ac556+_0x0075('0x17')+_0x599779+'.'+_0x1ac556)))[_0x0075('0x3f')]();}function insertCmHopperAdditionalPhones(_0x162af1){var _0x40517f=[_0x0075('0x4a'),_0x0075('0x4b'),_0x0075('0x4c'),_0x0075('0x4d'),_0x0075('0x4e')];return squel[_0x0075('0x2b')]()[_0x0075('0x2c')](_0x0075('0x4f'))['fromQuery']([_0x0075('0x50'),_0x0075('0x13'),_0x0075('0x51'),_0x0075('0x32'),_0x0075('0x33')],squel[_0x0075('0x37')]()['fields'](_0x40517f)[_0x0075('0x43')](_0x0075('0x2d'))[_0x0075('0x14')](_0x0075('0x44'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x0075('0x14')](_0x0075('0x52'),null,_0x0075('0x53'))[_0x0075('0x16')]('cm_hopper.ListId\x20=\x20?',_0x162af1)[_0x0075('0x16')](_0x0075('0x3b'),NOW))[_0x0075('0x3f')]();}function insertCmContact(_0x3af9e7,_0x364d20,_0x1d5f74,_0x3d7def){var _0x435ecc=_[_0x0075('0x54')](_['keys'](_0x3d7def),['ListId',_0x0075('0x55'),_0x0075('0x32'),_0x0075('0x33'),_0x0075('0x56')]);return squel[_0x0075('0x2b')]()[_0x0075('0x2c')](_0x0075('0x44'))[_0x0075('0x2e')](_0x435ecc,squel[_0x0075('0x37')]()[_0x0075('0x38')](_0x435ecc)[_0x0075('0x43')](_0x364d20)[_0x0075('0x16')]('('+_0x1d5f74['join'](',')+_0x0075('0x57'),squel['select']()[_0x0075('0x38')](_0x1d5f74)[_0x0075('0x43')](_0x0075('0x44'))['where'](_0x0075('0x45'),_0x3af9e7)[_0x0075('0x16')](_0x0075('0x58')))[_0x0075('0x16')](_0x0075('0x59'),squel[_0x0075('0x37')]()[_0x0075('0x12')](_0x0075('0x5a'),_0x0075('0x5b'))[_0x0075('0x43')](_0x364d20)[_0x0075('0x5c')](_0x1d5f74[_0x0075('0x14')](','))))[_0x0075('0x3f')]();}function handleStop(){logger[_0x0075('0x5d')](_0x0075('0x5e'));stopped=!![];}function handleUncaughtException(_0x5be699){logger[_0x0075('0x5f')](_0x5be699['message']);process[_0x0075('0x60')](0x1);}function handleError(_0x38fabb,_0x1331eb){stats[_0x0075('0x61')][_0x0075('0x1c')]({'name':_0x1331eb[_0x0075('0x62')],'message':_0x1331eb[_0x0075('0x63')],'row':_0x38fabb});}function handleQuery(_0xf4e460){logger[_0x0075('0x5d')](_0xf4e460);return db[_0x0075('0x64')][_0x0075('0x65')](_0xf4e460)[_0x0075('0x66')](function(_0x43447c){results[_0x0075('0x1c')](_0x43447c);})[_0x0075('0x67')](function(_0x37fb48){logger[_0x0075('0x5f')](_0x37fb48[_0x0075('0x63')]);});}function updateTzCampaigns(_0x1f538b){return new Promise(function(_0x42cc3a,_0x23c69d){var _0x128991=squel[_0x0075('0x37')]()[_0x0075('0x38')]([_0x0075('0x68'),'campaigns.dialTimezone'])[_0x0075('0x43')](_0x0075('0x69'))['join']('campaigns_has_cm_lists',null,_0x0075('0x6a'))[_0x0075('0x16')](_0x0075('0x6b')+_0x1f538b);db[_0x0075('0x64')]['query'](_0x128991[_0x0075('0x3f')]())[_0x0075('0x66')](function(_0x3eee59){var _0x57e441=[];for(var _0x56fff2=0x0;_0x56fff2<_0x3eee59['length'];_0x56fff2++){_0x57e441['push'](getTimezoneData(_0x3eee59[_0x56fff2],tmp_campaigns));}BPromise[_0x0075('0x1d')](_0x57e441)[_0x0075('0x1b')](function(){_0x42cc3a({'val':0x1});});})[_0x0075('0x67')](function(_0x369a96){logger[_0x0075('0x5f')](_0x369a96['message']);_0x42cc3a({'val':0x0});});});}function updateTzVoiceQueues(_0xd6b88e){return new Promise(function(_0x2ad588,_0x443ced){var _0xed6366=squel['select']()[_0x0075('0x38')]([_0x0075('0x6c'),_0x0075('0x6d')])[_0x0075('0x43')](_0x0075('0x6e'))[_0x0075('0x14')](_0x0075('0x6f'),null,_0x0075('0x70'))[_0x0075('0x16')]('voice_queues_has_cm_lists.CmListId='+_0xd6b88e);db[_0x0075('0x64')][_0x0075('0x65')](_0xed6366['toString']())[_0x0075('0x66')](function(_0x2d45c7){var _0x3b1d66=[];for(var _0x5e6af6=0x0;_0x5e6af6<_0x2d45c7[_0x0075('0x1f')];_0x5e6af6++){_0x3b1d66[_0x0075('0x1c')](getTimezoneData(_0x2d45c7[_0x5e6af6],tmp_voice_queues));}BPromise[_0x0075('0x1d')](_0x3b1d66)[_0x0075('0x1b')](function(){_0x2ad588({'val':0x1});});})['catch'](function(_0x361746){logger[_0x0075('0x5f')](_0x361746[_0x0075('0x63')]);_0x2ad588({'val':0x0});});});}function getTimezoneData(_0x247d24,_0x2e0d1b){return new Promise(function(_0xd98150,_0x2b6bd0){var _0x54e02e=shared[_0x0075('0x71')];var _0x8c9b28=_0x54e02e[_0x247d24[_0x0075('0x72')]];if(_[_0x0075('0x20')](_0x8c9b28)){_0xd98150({'ret':0x1});}else{var _0x16c115=_0x8c9b28[_0x0075('0x73')];var _0x588daf=squel[_0x0075('0x2b')]()[_0x0075('0x2c')](_0x2e0d1b)[_0x0075('0x74')]('id',_0x247d24['id'])['set'](_0x0075('0x75'),_0x16c115)[_0x0075('0x74')]('dialTimezone',_0x247d24[_0x0075('0x72')])[_0x0075('0x3f')]();return db['sequelize']['query'](_0x588daf)[_0x0075('0x66')](function(_0x359e3c){_0xd98150({'ret':0x1});})['catch'](function(_0x5ca46c){logger[_0x0075('0x5f')](_0x5ca46c[_0x0075('0x63')]);_0x2b6bd0({'ret':0x1});});}});}function handleTZQuery(_0x242828){logger['info'](_0x242828);return db[_0x0075('0x64')][_0x0075('0x65')](_0x242828)['spread'](function(_0x98db27){})[_0x0075('0x67')](function(_0x4393c2){logger[_0x0075('0x5f')](_0x4393c2[_0x0075('0x63')]);});}function main(_0x479410,_0x390072,_0x3382ea,_0x491510){logger[_0x0075('0x5d')](_0x0075('0x76'),_0x479410,JSON[_0x0075('0x77')](_0x390072));process[_0x0075('0x78')](_0x0075('0x79'));var _0xd14d5b=_0x390072[_0x0075('0x7a')];var _0x5c42c1=_[_0x0075('0x7b')](_0xd14d5b);var _0xb0d1ce=_0x390072['socket_timestamp'];var _0x2b4eee=path['join'](config[_0x0075('0x7c')],_0x0075('0x7d'),_0xb0d1ce+_0x0075('0x7e'));hasTZ=_[_0x0075('0x7f')](_0xd14d5b)[_0x0075('0x80')](_0x0075('0x72'));var _0x2d8377=_['keys'](_0xd14d5b)[_0x0075('0x14')]();logger[_0x0075('0x5d')]('header',_0x2d8377);db[_0x0075('0x81')]['findAll']({'raw':!![],'attributes':['id','name']})['then'](function(_0x24c269){for(var _0x2efecd=0x0;_0x2efecd<_0x24c269['length'];_0x2efecd++){if(_0x24c269[_0x2efecd][_0x0075('0x82')]in _0xd14d5b){contactItemTypes[_0x0075('0x1c')](_0x24c269[_0x2efecd]);delete _0x5c42c1[_0x24c269[_0x2efecd][_0x0075('0x82')]];hasAdditionalPhones=!![];}for(var _0x49faa4 in _0xd14d5b){if(_0x24c269[_0x2efecd][_0x0075('0x82')]+_0x0075('0x83')===_0x49faa4){phoneDescriptions[_0x0075('0x1c')]({'itemTypeId':_0x24c269[_0x2efecd]['id'],'description':_0x49faa4});delete _0x5c42c1[_0x49faa4];}}}if(hasAdditionalPhones)_0x5c42c1['AdditionalPhones']='';var _0x58e81c=_[_0x0075('0x7f')](_0x5c42c1)[_0x0075('0x14')]();logger[_0x0075('0x5d')]('header',_0x58e81c);fs[_0x0075('0x84')](_0x2b4eee,_0x58e81c+'\x0a');Papa[_0x0075('0x85')](fs[_0x0075('0x86')](_0x479410),{'header':!![],'skipEmptyLines':!![],'step':function(_0x219e07,_0x52c0a1){try{for(var _0x4843cd=0x0,_0x50eaac=[];_0x4843cd<_0x219e07[_0x0075('0x87')]['length'];_0x4843cd++){stats[_0x0075('0x88')]+=0x1;if(_0x219e07['errors'][_0x4843cd]){handleError(_0x219e07['data'][_0x4843cd],_0x219e07[_0x0075('0x61')][_0x4843cd]);}else{var _0x2d9fde=[];var _0x53151c=[];var _0x166172={};for(var _0x27052a in _0xd14d5b){let _0x437310=contactItemTypes[_0x0075('0x89')](_0x485e1c=>_0x485e1c[_0x0075('0x82')]===_0x27052a);let _0x2029c3=contactItemTypes[_0x0075('0x89')](_0x1ca6f8=>_0x1ca6f8[_0x0075('0x82')]+_0x0075('0x83')===_0x27052a);if(_['isNil'](_0x437310)&&_[_0x0075('0x20')](_0x2029c3)){if(_0xd14d5b['hasOwnProperty'](_0x27052a)){if(_0x219e07['data'][_0x4843cd][_0xd14d5b[_0x27052a]]){var _0x2bc268=_[_0x0075('0x8a')](_0x219e07['data'][_0x4843cd][_0xd14d5b[_0x27052a]][_0x0075('0x8b')](/"/g,'\x27'));switch(_0x27052a){case _0x0075('0x2f'):var _0x2a5611=moment(_0x2bc268,_0x0075('0x10'),!![]);if(_0x2a5611[_0x0075('0x8c')]()){_0x50eaac['push']('\x22'+_0x2bc268+'\x22');}else{_0x2d9fde[_0x0075('0x1c')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x0075('0x34'):var _0x496cad=parseInt(_0x2bc268);_0x2bc268=_[_0x0075('0x8d')](_0x496cad)||_0x496cad<0x0||_0x496cad>0x4?_0x491510?0x3:0x2:_0x496cad;_0x50eaac[_0x0075('0x1c')]('\x22'+_0x2bc268+'\x22');break;case'UserId':var _0x57185c=parseInt(_0x2bc268);if(_[_0x0075('0x8e')](_0x57185c)&&_[_0x0075('0x80')](_0x3382ea,_0x57185c)){_0x50eaac[_0x0075('0x1c')]('\x22'+_0x57185c+'\x22');}else{_0x2d9fde[_0x0075('0x1c')](_0x0075('0x8f'));}break;case _0x0075('0x90'):if(isEmail(_0x2bc268)){_0x50eaac[_0x0075('0x1c')]('\x22'+_0x2bc268+'\x22');}else{_0x2d9fde['push'](_0x0075('0x91'));}break;case _0x0075('0x92'):var _0x926316=moment(_0x2bc268,_0x0075('0x93'),!![]);if(_0x926316[_0x0075('0x8c')]()){_0x50eaac[_0x0075('0x1c')]('\x22'+_0x2bc268+'\x22');}else{_0x2d9fde[_0x0075('0x1c')](_0x0075('0x94'));}break;case _0x0075('0x72'):var _0x3cd1b4=shared[_0x0075('0x71')];var _0x2c4c71=_0x3cd1b4[_0x2bc268];if(!_[_0x0075('0x20')](_0x2c4c71)){var _0x37426d=_0x2c4c71[_0x0075('0x73')];_0x50eaac[_0x0075('0x1c')]('\x22'+_0x2bc268+'\x22');_0x50eaac[_0x0075('0x1c')]('\x22'+_0x37426d+'\x22');}break;default:_0x50eaac['push']('\x22'+_0x2bc268+'\x22');}}else{switch(_0x27052a){case _0x0075('0x95'):case _0x0075('0x13'):_0x2d9fde[_0x0075('0x1c')](_0x27052a+'\x20not\x20specified');break;default:_0x50eaac[_0x0075('0x1c')]('\x22\x22');}}}}else{var _0x110aa8='';if(!_[_0x0075('0x20')](_0x437310)){if(!_0x166172['hasOwnProperty'](_0x437310['id'])){if(!_[_0x0075('0x20')](_0x219e07['data'][_0x4843cd][_0xd14d5b[_0x27052a]])){var _0x2bc268=_['trim'](_0x219e07['data'][_0x4843cd][_0xd14d5b[_0x27052a]][_0x0075('0x8b')](/"/g,'\x27'));var _0x5009c0=phoneDescriptions[_0x0075('0x89')](_0x5f5ac4=>_0x5f5ac4[_0x0075('0x96')]===_0x437310['id']);if(!_['isNil'](_0x5009c0)){var _0x135e66=_['trim'](_0x219e07[_0x0075('0x87')][_0x4843cd][_0xd14d5b[_0x5009c0[_0x0075('0x97')]]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x135e66))_0x2bc268=_0x2bc268+'§'+_0x135e66;}if(_0x110aa8=='')_0x110aa8=_0x2bc268;else _0x110aa8+='|'+_0x2bc268;}_0x53151c[_0x0075('0x1c')](_0x437310['id']+':'+_0x110aa8);_0x166172[_0x437310['id']]=0x1;}}}}if(hasAdditionalPhones){_0x50eaac[_0x0075('0x1c')]('\x22'+_0x53151c[_0x0075('0x14')](';')+'\x22');}if(_0x2d9fde[_0x0075('0x1f')]){handleError(_0x219e07[_0x0075('0x87')][_0x4843cd],{'code':_0x0075('0x98'),'message':_0x2d9fde[_0x0075('0x14')]()});}else{fs[_0x0075('0x99')](_0x2b4eee,_0x50eaac[_0x0075('0x14')]()+'\x0a');}_0x50eaac=[];}if(!(stats['rows']%0xc8)){socket[_0x0075('0x9a')](_0x0075('0x9b')+_0xb0d1ce,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x0075('0x9c'));_0x52c0a1[_0x0075('0x9d')]();}}catch(_0x5a06fe){handleError(_0x219e07[_0x0075('0x87')][_0x4843cd],{'code':_0x0075('0x9e'),'message':_0x5a06fe[_0x0075('0x63')]});logger[_0x0075('0x5f')](_0x0075('0x9f'),_0x5a06fe[_0x0075('0x63')]);}},'complete':function(){try{var _0x3b3977=[];var _0xfd2f46=[];var _0x57936b=_0x0075('0x44');if(_0x390072[_0x0075('0xa0')]&&_0x390072[_0x0075('0xa0')][_0x0075('0x1f')]){_0x57936b='cm_contacts_'+_0xb0d1ce;_0x3b3977[_0x0075('0x1c')](_0x0075('0xa1')+_0x57936b+_0x0075('0xa2'));}tmp_campaigns=_0x0075('0xa3')+_0xb0d1ce;tmp_voice_queues=_0x0075('0xa4')+_0xb0d1ce;_0xfd2f46[_0x0075('0x1c')](_0x0075('0xa1')+tmp_campaigns+_0x0075('0xa5'));_0xfd2f46['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x0075('0xa6')](_0xfd2f46,handleTZQuery)[_0x0075('0x1b')](function(_0x5de4ee){updateTzCampaigns(_0x390072[_0x0075('0x31')])['then'](function(_0x27cd3f){updateTzVoiceQueues(_0x390072[_0x0075('0x31')])['then'](function(_0x153e7b){if(hasTZ)_0x58e81c=_0x58e81c['replace']('dialTimezone','dialTimezone,utcOffset');var _0x41dd9f=util[_0x0075('0xf')](_0x0075('0xa7'),_0x2b4eee,_0x57936b,_0x58e81c,_0x390072[_0x0075('0x31')],_0x390072[_0x0075('0x55')]||null,NOW,NOW);if(_[_0x0075('0x20')](_0xd14d5b[_0x0075('0x2f')])){_0x41dd9f+=',\x20scheduledAt\x20=\x20NOW()';}_0x3b3977[_0x0075('0x1c')](_0x41dd9f);if(_0x390072[_0x0075('0xa0')]&&_0x390072['duplicates'][_0x0075('0x1f')]){_0x3b3977[_0x0075('0x1c')](insertCmContact(_0x390072['ListId'],_0x57936b,_0x390072[_0x0075('0xa0')],_0xd14d5b));_0x3b3977['push'](_0x0075('0xa8')+_0x57936b+';');}BPromise[_0x0075('0xa6')](_0x3b3977,handleQuery)[_0x0075('0x1b')](function(_0x4a7ed6){BPromise[_0x0075('0x1d')]([handleAdditionalPhones()])[_0x0075('0x1b')](function(){_0x3b3977=[];for(var _0x52d8a0=0x0;_0x52d8a0\x20\x20','server/files/tmp','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','path','lodash','util','bluebird','moment','squel','ioredis','../../../config/environment/shared','../../../config/logger','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','phone','from','join','.id\x20=\x20','where','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','findOne','CmContactHasItem','update','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ListId','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','into','ContactId','updatedAt','select','ListId\x20=\x20?','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','insert','cm_hopper_black','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones'];(function(_0xa9ad47,_0x1bdb00){var _0x57975f=function(_0x4e8d94){while(--_0x4e8d94){_0xa9ad47['push'](_0xa9ad47['shift']());}};_0x57975f(++_0x1bdb00);}(_0x9b76,0x1cd));var _0x69b7=function(_0x29b566,_0x3000cf){_0x29b566=_0x29b566-0x0;var _0x5ac45f=_0x9b76[_0x29b566];return _0x5ac45f;};'use strict';var fs=require('fs');var path=require(_0x69b7('0x0'));var _=require(_0x69b7('0x1'));var Papa=require('papaparse');var util=require(_0x69b7('0x2'));var BPromise=require(_0x69b7('0x3'));var moment=require(_0x69b7('0x4'));var squel=require(_0x69b7('0x5'));var Redis=require(_0x69b7('0x6'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0x69b7('0x7'));var logger=require(_0x69b7('0x8'))('import');config['redis']=_['defaults'](config[_0x69b7('0x9')],{'host':_0x69b7('0xa'),'port':0x18eb});var socket=require(_0x69b7('0xb'))(new Redis(config[_0x69b7('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x69b7('0xc')](_0x69b7('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x69b7('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x4321ea){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'](_0x4321ea);}function selectNotIn(_0x4c2f43,_0x414eba,_0x222b10,_0x34a96c,_0x5324cb){return squel['select']()[_0x69b7('0xe')](_0x69b7('0xf'))[_0x69b7('0x10')](_0x34a96c)[_0x69b7('0x11')](_0x414eba,null,_0x414eba+_0x69b7('0x12')+_0x34a96c+'.'+_0x222b10)[_0x69b7('0x13')](_0x34a96c+'.'+_0x222b10+'\x20=\x20'+_0x4c2f43+'.'+_0x222b10)[_0x69b7('0x13')](_0x414eba+'.dialCheckDuplicateType\x20IN\x20('+_0x5324cb[_0x69b7('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x26898f,_0x5f1d68){promisesAdditionalPhones=[];return db[_0x69b7('0x14')][_0x69b7('0x15')]({'raw':!![],'attributes':['id',_0x69b7('0x16')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x69b7('0x17')](function(_0x13f6ac){if(_0x13f6ac!==null){var _0x5dec63=[];for(var _0x5d36ee=0x0;_0x5d36ee<_0x13f6ac[_0x69b7('0x18')];_0x5d36ee++){var _0xe09b90=_0x13f6ac[_0x5d36ee];_0x5dec63[_0x69b7('0x19')](insertAdditionalPhones(_0xe09b90));}}Promise[_0x69b7('0x1a')](_0x5dec63)[_0x69b7('0x17')](function(){_0x26898f({'val':0x1});});});});}function insertAdditionalPhones(_0x577d86){return new Promise(function(_0x42fe07,_0x5e6254){var _0x94b760=_0x577d86[_0x69b7('0x16')];var _0x3ab3c6=_0x94b760[_0x69b7('0x1b')](';');var _0x1d5059=[];orderBy=0x0;for(var _0x46bde8=0x0;_0x46bde8<_0x3ab3c6['length'];_0x46bde8++){_0x1d5059['push'](splitAdditionalPhone(_0x577d86['id'],_0x3ab3c6[_0x46bde8]));}Promise[_0x69b7('0x1a')](_0x1d5059)[_0x69b7('0x17')](function(){_0x42fe07({'val':_0x3ab3c6['length']});});});}function splitAdditionalPhone(_0xb76f8d,_0x4e09f3){return new Promise(function(_0x304908,_0x2ab0fa){var _0x25a3a2=_0x4e09f3[_0x69b7('0x1b')](':');var _0x59b84a=_0x25a3a2[0x0];var _0x36c697=_0x25a3a2[0x1];if(!_[_0x69b7('0x1c')](_0x36c697)){var _0x54e897=_0x36c697[_0x69b7('0x1b')]('|');var _0x5c2c05=[];for(var _0x4fe7f9=0x0;_0x4fe7f9<_0x54e897['length'];_0x4fe7f9++){if(_0x54e897[_0x4fe7f9]!==''){var _0x3dec01=_['filter'](promisesAdditionalPhones,{'contactId':_0xb76f8d,'phone':_0x54e897[_0x4fe7f9]});if(_0x3dec01[_0x69b7('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0xb76f8d,'contactTypeId':_0x59b84a,'phone':_0x54e897[_0x4fe7f9],'orderBy':orderBy});}}}_0x304908({'ok':0x1});}else _0x304908({'res':0x0});});}function createAdditionalPhone(_0x47dbbb,_0x53ed97,_0x2a22de,_0x473bf9){var _0x31da44='';var _0x3ea65b='';var _0x596401=_0x2a22de[_0x69b7('0x1b')]('§');_0x31da44=_0x596401[0x0];if(_0x596401[_0x69b7('0x18')]==0x2)_0x3ea65b=_0x596401[0x1];return new Promise(function(_0x182da8,_0x4a0cfc){return db['CmContactHasItem'][_0x69b7('0x1d')]({'where':{'CmContactId':_0x47dbbb,'item':_0x31da44}})[_0x69b7('0x17')](function(_0x280c66){if(_0x280c66){return db[_0x69b7('0x1e')][_0x69b7('0x1f')]({'ItemTypeId':_0x53ed97,'description':_0x3ea65b,'OrderBy':_0x473bf9},{'where':{'CmContactId':_0x47dbbb,'item':_0x31da44}})[_0x69b7('0x17')](function(_0x1ebe1d){_0x182da8({'res':'updated'});});}else{return db[_0x69b7('0x1e')]['create']({'CmContactId':_0x47dbbb,'item':_0x31da44,'description':_0x3ea65b,'ItemTypeId':_0x53ed97,'OrderBy':_0x473bf9,'ItemClass':'PHONE'})[_0x69b7('0x17')](function(_0x226d86){_0x182da8({'res':_0x69b7('0x20')});});}});});}function insertCmHopper(_0x48dc1b,_0x2947a1,_0x160b3c,_0x323e0d,_0x8daba8){var _0x2a032e=[_0x69b7('0x21'),_0x69b7('0x22'),_0x69b7('0x23'),_0x69b7('0x24'),_0x2947a1+'.'+_0x323e0d,_0x69b7('0x25'),_0x69b7('0x26'),'cm_contacts.priority',_0x69b7('0x27'),'\x22'+_0x8daba8+'\x22'];return squel['insert']()['into'](_0x69b7('0x28'))[_0x69b7('0x29')](['phone',_0x69b7('0x2a'),'ContactId',_0x69b7('0x2b'),_0x323e0d,_0x69b7('0x2c'),'updatedAt',_0x69b7('0x2d'),_0x69b7('0x2e'),_0x69b7('0x2f')],squel['select']()[_0x69b7('0x30')](_0x2a032e)['from'](_0x2947a1)['join'](_0x69b7('0x31'),null,_0x69b7('0x32')+_0x2947a1+_0x69b7('0x33'))[_0x69b7('0x11')](_0x160b3c,null,_0x160b3c+'.id\x20=\x20'+_0x2947a1+'.'+_0x323e0d)[_0x69b7('0x13')](_0x2947a1+_0x69b7('0x34'),_0x48dc1b)[_0x69b7('0x13')](_0x69b7('0x35'),NOW)['where'](_0x69b7('0x36'),selectNotIn(_0x2947a1,_0x160b3c,_0x323e0d,'cm_hopper',['\x22always\x22',_0x69b7('0x37')]))[_0x69b7('0x13')](_0x69b7('0x36'),selectNotIn(_0x2947a1,_0x160b3c,_0x323e0d,_0x69b7('0x28'),[_0x69b7('0x38')])))[_0x69b7('0x39')]();}function insertCmHopperBlack(_0x26d0df,_0x41183a,_0x2b6e97,_0x3583bc){var _0x4451e1=[_0x69b7('0x21'),_0x69b7('0x23'),_0x69b7('0x24'),_0x41183a+'.'+_0x3583bc,_0x69b7('0x25'),_0x69b7('0x26')];return squel['insert']()[_0x69b7('0x3a')]('cm_hopper_black')[_0x69b7('0x29')]([_0x69b7('0xf'),_0x69b7('0x3b'),_0x69b7('0x2b'),_0x3583bc,_0x69b7('0x2c'),_0x69b7('0x3c')],squel[_0x69b7('0x3d')]()['fields'](_0x4451e1)[_0x69b7('0x10')](_0x41183a)[_0x69b7('0x11')](_0x69b7('0x31'),null,_0x69b7('0x32')+_0x41183a+_0x69b7('0x33'))[_0x69b7('0x11')](_0x2b6e97,null,_0x2b6e97+_0x69b7('0x12')+_0x41183a+'.'+_0x3583bc)['where'](_0x41183a+_0x69b7('0x34'),_0x26d0df)['where'](_0x69b7('0x35'),NOW)[_0x69b7('0x13')](_0x69b7('0x36'),squel['select']()[_0x69b7('0xe')](_0x69b7('0xf'))[_0x69b7('0x10')]('cm_hopper_black')[_0x69b7('0x13')](_0x69b7('0x3e'),_0x26d0df)[_0x69b7('0x13')](_0x3583bc+_0x69b7('0x3f')+_0x41183a+'.'+_0x3583bc)))[_0x69b7('0x39')]();}function insertTzCmHopper(_0x59672d,_0x30ca09,_0x4013d1,_0x4ed3f0,_0x34dc3a,_0x5f1536){var _0x49020d=[_0x69b7('0x21'),_0x69b7('0x40')+_0x5f1536+_0x69b7('0x41'),'cm_contacts.id',_0x69b7('0x24'),_0x30ca09+'.'+_0x4ed3f0,_0x69b7('0x25'),'cm_contacts.updatedAt',_0x69b7('0x42'),_0x69b7('0x27'),'\x22'+_0x34dc3a+'\x22'];var _0x4d004a=squel[_0x69b7('0x43')]()[_0x69b7('0x3a')]('cm_hopper')['fromQuery']([_0x69b7('0xf'),'scheduledat',_0x69b7('0x3b'),_0x69b7('0x2b'),_0x4ed3f0,'createdAt','updatedAt',_0x69b7('0x2d'),_0x69b7('0x2e'),_0x69b7('0x2f')],squel['select']()[_0x69b7('0x30')](_0x49020d)[_0x69b7('0x10')](_0x30ca09)['join'](_0x69b7('0x31'),null,_0x69b7('0x32')+_0x30ca09+_0x69b7('0x33'))[_0x69b7('0x11')](_0x4013d1,null,_0x4013d1+'.id\x20=\x20'+_0x30ca09+'.'+_0x4ed3f0)[_0x69b7('0x11')](_0x5f1536,null,_0x5f1536+_0x69b7('0x12')+_0x30ca09+'.'+_0x4ed3f0)['where'](_0x30ca09+_0x69b7('0x34'),_0x59672d)[_0x69b7('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x69b7('0x13')](_0x69b7('0x36'),selectNotIn(_0x30ca09,_0x4013d1,_0x4ed3f0,_0x69b7('0x28'),[_0x69b7('0x38'),_0x69b7('0x37')]))[_0x69b7('0x13')](_0x69b7('0x36'),selectNotIn(_0x30ca09,_0x4013d1,_0x4ed3f0,'cm_hopper',[_0x69b7('0x38')])))['toString']();return _0x4d004a;}function insertTzCmHopperBlack(_0x16aef0,_0x5f1c5b,_0x39d845,_0x4142da){var _0x4e444e=[_0x69b7('0x21'),_0x69b7('0x23'),_0x69b7('0x24'),_0x5f1c5b+'.'+_0x4142da,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel['insert']()[_0x69b7('0x3a')](_0x69b7('0x44'))['fromQuery']([_0x69b7('0xf'),_0x69b7('0x3b'),_0x69b7('0x2b'),_0x4142da,_0x69b7('0x2c'),_0x69b7('0x3c')],squel[_0x69b7('0x3d')]()[_0x69b7('0x30')](_0x4e444e)[_0x69b7('0x10')](_0x5f1c5b)[_0x69b7('0x11')](_0x69b7('0x31'),null,_0x69b7('0x32')+_0x5f1c5b+_0x69b7('0x33'))[_0x69b7('0x11')](_0x39d845,null,_0x39d845+_0x69b7('0x12')+_0x5f1c5b+'.'+_0x4142da)['where'](_0x5f1c5b+'.CmListId\x20=\x20?',_0x16aef0)['where'](_0x69b7('0x35'),NOW)[_0x69b7('0x13')](_0x69b7('0x36'),squel['select']()[_0x69b7('0xe')](_0x69b7('0xf'))['from'](_0x69b7('0x44'))[_0x69b7('0x13')](_0x69b7('0x3e'),_0x16aef0)[_0x69b7('0x13')](_0x4142da+'\x20=\x20'+_0x5f1c5b+'.'+_0x4142da)))[_0x69b7('0x39')]();}function insertCmHopperAdditionalPhones(_0x1088ba){var _0x184226=['cm_hopper.id',_0x69b7('0x45'),'cm_contact_has_items.OrderBy',_0x69b7('0x46'),_0x69b7('0x47')];return squel[_0x69b7('0x43')]()[_0x69b7('0x3a')](_0x69b7('0x48'))['fromQuery'](['CmHopperId','phone',_0x69b7('0x49'),_0x69b7('0x2c'),'updatedAt'],squel[_0x69b7('0x3d')]()[_0x69b7('0x30')](_0x184226)[_0x69b7('0x10')](_0x69b7('0x28'))['join'](_0x69b7('0x31'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join'](_0x69b7('0x4a'),null,_0x69b7('0x4b'))['where'](_0x69b7('0x4c'),_0x1088ba)[_0x69b7('0x13')](_0x69b7('0x35'),NOW))['toString']();}function insertCmContact(_0xbe501d,_0x493cea,_0x2732d0,_0x471617){var _0x21ae82=_[_0x69b7('0x4d')](_[_0x69b7('0x4e')](_0x471617),[_0x69b7('0x2b'),_0x69b7('0x4f'),_0x69b7('0x2c'),'updatedAt',_0x69b7('0x50')]);return squel[_0x69b7('0x43')]()[_0x69b7('0x3a')](_0x69b7('0x31'))['fromQuery'](_0x21ae82,squel['select']()[_0x69b7('0x30')](_0x21ae82)[_0x69b7('0x10')](_0x493cea)['where']('('+_0x2732d0['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x69b7('0x3d')]()['fields'](_0x2732d0)[_0x69b7('0x10')](_0x69b7('0x31'))[_0x69b7('0x13')]('ListId\x20=\x20?',_0xbe501d)[_0x69b7('0x13')]('deletedAt\x20IS\x20NULL'))['where']('id\x20IN\x20?',squel[_0x69b7('0x3d')]()[_0x69b7('0xe')](_0x69b7('0x51'),_0x69b7('0x52'))['from'](_0x493cea)[_0x69b7('0x53')](_0x2732d0[_0x69b7('0x11')](','))))['toString']();}function handleStop(){logger[_0x69b7('0x54')](_0x69b7('0x55'));stopped=!![];}function handleUncaughtException(_0x3300db){logger[_0x69b7('0x56')](_0x3300db[_0x69b7('0x57')]);process['exit'](0x1);}function handleError(_0x19dec5,_0x41968c){stats['errors'][_0x69b7('0x19')]({'name':_0x41968c['code'],'message':_0x41968c[_0x69b7('0x57')],'row':_0x19dec5});}function handleQuery(_0x1f831e){logger[_0x69b7('0x54')](_0x1f831e);return db['sequelize'][_0x69b7('0x58')](_0x1f831e)[_0x69b7('0x59')](function(_0x1a97f2){results[_0x69b7('0x19')](_0x1a97f2);})[_0x69b7('0x5a')](function(_0x3c94a7){logger[_0x69b7('0x56')](_0x3c94a7[_0x69b7('0x57')]);});}function updateTzCampaigns(_0x4f65cb){return new Promise(function(_0x3fccef,_0x4a3c53){var _0x577259=squel['select']()[_0x69b7('0x30')]([_0x69b7('0x5b'),_0x69b7('0x5c')])['from'](_0x69b7('0x5d'))[_0x69b7('0x11')]('campaigns_has_cm_lists',null,_0x69b7('0x5e'))[_0x69b7('0x13')](_0x69b7('0x5f')+_0x4f65cb);db[_0x69b7('0x60')][_0x69b7('0x58')](_0x577259[_0x69b7('0x39')]())['spread'](function(_0x265039){var _0x263a30=[];for(var _0x558267=0x0;_0x558267<_0x265039[_0x69b7('0x18')];_0x558267++){_0x263a30[_0x69b7('0x19')](getTimezoneData(_0x265039[_0x558267],tmp_campaigns));}BPromise['all'](_0x263a30)[_0x69b7('0x17')](function(){_0x3fccef({'val':0x1});});})[_0x69b7('0x5a')](function(_0x5a5a83){logger[_0x69b7('0x56')](_0x5a5a83[_0x69b7('0x57')]);_0x3fccef({'val':0x0});});});}function updateTzVoiceQueues(_0x522bf0){return new Promise(function(_0x3ca0e3,_0x557aeb){var _0x3dbd8c=squel['select']()[_0x69b7('0x30')]([_0x69b7('0x61'),_0x69b7('0x62')])[_0x69b7('0x10')](_0x69b7('0x63'))[_0x69b7('0x11')]('voice_queues_has_cm_lists',null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where']('voice_queues_has_cm_lists.CmListId='+_0x522bf0);db['sequelize'][_0x69b7('0x58')](_0x3dbd8c[_0x69b7('0x39')]())[_0x69b7('0x59')](function(_0x309b26){var _0x2962d4=[];for(var _0x51f91a=0x0;_0x51f91a<_0x309b26[_0x69b7('0x18')];_0x51f91a++){_0x2962d4[_0x69b7('0x19')](getTimezoneData(_0x309b26[_0x51f91a],tmp_voice_queues));}BPromise[_0x69b7('0x1a')](_0x2962d4)['then'](function(){_0x3ca0e3({'val':0x1});});})['catch'](function(_0x4d0b21){logger[_0x69b7('0x56')](_0x4d0b21['message']);_0x3ca0e3({'val':0x0});});});}function getTimezoneData(_0x2968a5,_0x48d510){return new Promise(function(_0x3f08da,_0x3f5412){var _0x3763c5=shared[_0x69b7('0x64')];var _0x44a3fc=_0x3763c5[_0x2968a5[_0x69b7('0x65')]];if(_[_0x69b7('0x1c')](_0x44a3fc)){_0x3f08da({'ret':0x1});}else{var _0x45ff0f=_0x44a3fc['utcOffset'];var _0x23c8aa=squel[_0x69b7('0x43')]()[_0x69b7('0x3a')](_0x48d510)[_0x69b7('0x66')]('id',_0x2968a5['id'])[_0x69b7('0x66')](_0x69b7('0x67'),_0x45ff0f)['set'](_0x69b7('0x65'),_0x2968a5[_0x69b7('0x65')])[_0x69b7('0x39')]();return db['sequelize'][_0x69b7('0x58')](_0x23c8aa)['spread'](function(_0x1d4e25){_0x3f08da({'ret':0x1});})[_0x69b7('0x5a')](function(_0x59db3e){logger[_0x69b7('0x56')](_0x59db3e[_0x69b7('0x57')]);_0x3f5412({'ret':0x1});});}});}function handleTZQuery(_0x4946e0){logger[_0x69b7('0x54')](_0x4946e0);return db['sequelize'][_0x69b7('0x58')](_0x4946e0)[_0x69b7('0x59')](function(_0x25b3af){})['catch'](function(_0x357044){logger[_0x69b7('0x56')](_0x357044[_0x69b7('0x57')]);});}function main(_0x50e724,_0x26351e,_0x191ce4,_0x16225d){logger[_0x69b7('0x54')](_0x69b7('0x68'),_0x50e724,JSON[_0x69b7('0x69')](_0x26351e));process[_0x69b7('0x6a')](_0x69b7('0x6b'));var _0x271f3c=_0x26351e[_0x69b7('0x6c')];var _0x3c0832=_[_0x69b7('0x6d')](_0x271f3c);var _0x50d916=_0x26351e[_0x69b7('0x6e')];var _0x5c8277=path[_0x69b7('0x11')](config[_0x69b7('0x6f')],'server/files/tmp',_0x50d916+_0x69b7('0x70'));hasTZ=_['keys'](_0x271f3c)[_0x69b7('0x71')](_0x69b7('0x65'));var _0x19252a=_[_0x69b7('0x4e')](_0x271f3c)['join']();logger[_0x69b7('0x54')]('header',_0x19252a);db['ContactItemType'][_0x69b7('0x15')]({'raw':!![],'attributes':['id',_0x69b7('0x72')]})['then'](function(_0x22304b){for(var _0x47dc01=0x0;_0x47dc01<_0x22304b[_0x69b7('0x18')];_0x47dc01++){if(_0x22304b[_0x47dc01]['name']in _0x271f3c){contactItemTypes[_0x69b7('0x19')](_0x22304b[_0x47dc01]);delete _0x3c0832[_0x22304b[_0x47dc01]['name']];hasAdditionalPhones=!![];}for(var _0x5b10fe in _0x271f3c){if(_0x22304b[_0x47dc01][_0x69b7('0x72')]+_0x69b7('0x73')===_0x5b10fe){phoneDescriptions[_0x69b7('0x19')]({'itemTypeId':_0x22304b[_0x47dc01]['id'],'description':_0x5b10fe});delete _0x3c0832[_0x5b10fe];}}}if(hasAdditionalPhones)_0x3c0832[_0x69b7('0x16')]='';var _0x224ac5=_[_0x69b7('0x4e')](_0x3c0832)[_0x69b7('0x11')]();logger[_0x69b7('0x54')](_0x69b7('0x74'),_0x224ac5);fs[_0x69b7('0x75')](_0x5c8277,_0x224ac5+'\x0a');Papa[_0x69b7('0x76')](fs[_0x69b7('0x77')](_0x50e724),{'header':!![],'skipEmptyLines':!![],'step':function(_0xf7be9d,_0x27a262){try{for(var _0x405a0a=0x0,_0x21bfe3=[];_0x405a0a<_0xf7be9d[_0x69b7('0x78')]['length'];_0x405a0a++){stats[_0x69b7('0x79')]+=0x1;if(_0xf7be9d[_0x69b7('0x7a')][_0x405a0a]){handleError(_0xf7be9d['data'][_0x405a0a],_0xf7be9d[_0x69b7('0x7a')][_0x405a0a]);}else{var _0x3a0514=[];var _0x5284ab=[];var _0x21595d={};for(var _0x1b6265 in _0x271f3c){let _0x58325b=contactItemTypes[_0x69b7('0x7b')](_0x5c2f30=>_0x5c2f30[_0x69b7('0x72')]===_0x1b6265);let _0x16e15f=contactItemTypes[_0x69b7('0x7b')](_0x4c3e11=>_0x4c3e11['name']+_0x69b7('0x73')===_0x1b6265);if(_[_0x69b7('0x1c')](_0x58325b)&&_[_0x69b7('0x1c')](_0x16e15f)){if(_0x271f3c[_0x69b7('0x7c')](_0x1b6265)){if(_0xf7be9d[_0x69b7('0x78')][_0x405a0a][_0x271f3c[_0x1b6265]]){var _0x263544=_[_0x69b7('0x7d')](_0xf7be9d['data'][_0x405a0a][_0x271f3c[_0x1b6265]][_0x69b7('0x7e')](/"/g,'\x27'));switch(_0x1b6265){case _0x69b7('0x2a'):var _0x4ed1f3=moment(_0x263544,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x4ed1f3[_0x69b7('0x7f')]()){_0x21bfe3['push']('\x22'+_0x263544+'\x22');}else{_0x3a0514[_0x69b7('0x19')](_0x69b7('0x80'));}break;case _0x69b7('0x2d'):var _0x1ddaa4=parseInt(_0x263544);_0x263544=_[_0x69b7('0x81')](_0x1ddaa4)||_0x1ddaa4<0x0||_0x1ddaa4>0x4?_0x16225d?0x3:0x2:_0x1ddaa4;_0x21bfe3[_0x69b7('0x19')]('\x22'+_0x263544+'\x22');break;case _0x69b7('0x2e'):var _0x2e67f5=parseInt(_0x263544);if(_[_0x69b7('0x82')](_0x2e67f5)&&_[_0x69b7('0x71')](_0x191ce4,_0x2e67f5)){_0x21bfe3[_0x69b7('0x19')]('\x22'+_0x2e67f5+'\x22');}else{_0x3a0514[_0x69b7('0x19')](_0x69b7('0x83'));}break;case _0x69b7('0x84'):if(isEmail(_0x263544)){_0x21bfe3['push']('\x22'+_0x263544+'\x22');}else{_0x3a0514[_0x69b7('0x19')](_0x69b7('0x85'));}break;case _0x69b7('0x86'):var _0x208462=moment(_0x263544,_0x69b7('0x87'),!![]);if(_0x208462[_0x69b7('0x7f')]()){_0x21bfe3[_0x69b7('0x19')]('\x22'+_0x263544+'\x22');}else{_0x3a0514[_0x69b7('0x19')](_0x69b7('0x88'));}break;case'dialTimezone':var _0x3bdcb4=shared['timezones'];var _0x1e091e=_0x3bdcb4[_0x263544];if(!_[_0x69b7('0x1c')](_0x1e091e)){var _0x3cd75b=_0x1e091e[_0x69b7('0x89')];_0x21bfe3[_0x69b7('0x19')]('\x22'+_0x263544+'\x22');_0x21bfe3[_0x69b7('0x19')]('\x22'+_0x3cd75b+'\x22');}break;default:_0x21bfe3['push']('\x22'+_0x263544+'\x22');}}else{switch(_0x1b6265){case _0x69b7('0x8a'):case _0x69b7('0xf'):_0x3a0514[_0x69b7('0x19')](_0x1b6265+'\x20not\x20specified');break;default:_0x21bfe3[_0x69b7('0x19')]('\x22\x22');}}}}else{var _0x46c19f='';if(!_[_0x69b7('0x1c')](_0x58325b)){if(!_0x21595d['hasOwnProperty'](_0x58325b['id'])){if(!_[_0x69b7('0x1c')](_0xf7be9d[_0x69b7('0x78')][_0x405a0a][_0x271f3c[_0x1b6265]])){var _0x263544=_[_0x69b7('0x7d')](_0xf7be9d[_0x69b7('0x78')][_0x405a0a][_0x271f3c[_0x1b6265]][_0x69b7('0x7e')](/"/g,'\x27'));var _0x3d21af=phoneDescriptions[_0x69b7('0x7b')](_0x4e63f8=>_0x4e63f8['itemTypeId']===_0x58325b['id']);if(!_[_0x69b7('0x1c')](_0x3d21af)){var _0x2d52e3=_['trim'](_0xf7be9d['data'][_0x405a0a][_0x271f3c[_0x3d21af[_0x69b7('0x8b')]]][_0x69b7('0x7e')](/"/g,'\x27'));if(!_['isNil'](_0x2d52e3))_0x263544=_0x263544+'§'+_0x2d52e3;}if(_0x46c19f=='')_0x46c19f=_0x263544;else _0x46c19f+='|'+_0x263544;}_0x5284ab[_0x69b7('0x19')](_0x58325b['id']+':'+_0x46c19f);_0x21595d[_0x58325b['id']]=0x1;}}}}if(hasAdditionalPhones){_0x21bfe3[_0x69b7('0x19')]('\x22'+_0x5284ab[_0x69b7('0x11')](';')+'\x22');}if(_0x3a0514[_0x69b7('0x18')]){handleError(_0xf7be9d[_0x69b7('0x78')][_0x405a0a],{'code':_0x69b7('0x8c'),'message':_0x3a0514['join']()});}else{fs[_0x69b7('0x8d')](_0x5c8277,_0x21bfe3[_0x69b7('0x11')]()+'\x0a');}_0x21bfe3=[];}if(!(stats[_0x69b7('0x79')]%0xc8)){socket[_0x69b7('0x8e')]('contact:import:'+_0x50d916,stats);stats['errors']=[];}}if(stopped){logger['info']('Abort\x20parser');_0x27a262['abort']();}}catch(_0x229887){handleError(_0xf7be9d[_0x69b7('0x78')][_0x405a0a],{'code':_0x69b7('0x8f'),'message':_0x229887['message']});logger[_0x69b7('0x56')](_0x69b7('0x90'),_0x229887[_0x69b7('0x57')]);}},'complete':function(){try{var _0x1077f7=[];var _0x76cebf=[];var _0x45b194=_0x69b7('0x31');if(_0x26351e[_0x69b7('0x91')]&&_0x26351e[_0x69b7('0x91')][_0x69b7('0x18')]){_0x45b194='cm_contacts_'+_0x50d916;_0x1077f7[_0x69b7('0x19')](_0x69b7('0x92')+_0x45b194+_0x69b7('0x93'));}tmp_campaigns=_0x69b7('0x94')+_0x50d916;tmp_voice_queues=_0x69b7('0x95')+_0x50d916;_0x76cebf[_0x69b7('0x19')](_0x69b7('0x92')+tmp_campaigns+_0x69b7('0x96'));_0x76cebf[_0x69b7('0x19')](_0x69b7('0x92')+tmp_voice_queues+_0x69b7('0x96'));BPromise[_0x69b7('0x97')](_0x76cebf,handleTZQuery)[_0x69b7('0x17')](function(_0x5098f7){updateTzCampaigns(_0x26351e['ListId'])[_0x69b7('0x17')](function(_0x5f3bba){updateTzVoiceQueues(_0x26351e['ListId'])[_0x69b7('0x17')](function(_0x1c9087){if(hasTZ)_0x224ac5=_0x224ac5[_0x69b7('0x7e')]('dialTimezone','dialTimezone,utcOffset');var _0x5d1c1f=util[_0x69b7('0xc')](_0x69b7('0x98'),_0x5c8277,_0x45b194,_0x224ac5,_0x26351e[_0x69b7('0x2b')],_0x26351e[_0x69b7('0x4f')]||null,NOW,NOW);if(_['isNil'](_0x271f3c[_0x69b7('0x2a')])){_0x5d1c1f+=_0x69b7('0x99');}_0x1077f7[_0x69b7('0x19')](_0x5d1c1f);if(_0x26351e[_0x69b7('0x91')]&&_0x26351e[_0x69b7('0x91')][_0x69b7('0x18')]){_0x1077f7[_0x69b7('0x19')](insertCmContact(_0x26351e[_0x69b7('0x2b')],_0x45b194,_0x26351e[_0x69b7('0x91')],_0x271f3c));_0x1077f7['push'](_0x69b7('0x9a')+_0x45b194+';');}BPromise[_0x69b7('0x97')](_0x1077f7,handleQuery)[_0x69b7('0x17')](function(_0x5f281d){BPromise[_0x69b7('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x1077f7=[];for(var _0x171380=0x0;_0x171380_0x2aed0a['name']===_0xc8eb88);let _0x2568cf=contactItemTypes[_0xb416('0x74')](_0x1bd0f4=>_0x1bd0f4[_0xb416('0x6c')]+_0xb416('0x6d')===_0xc8eb88);if(_[_0xb416('0x1d')](_0x4d8867)&&_[_0xb416('0x1d')](_0x2568cf)){if(_0x3d1767[_0xb416('0x75')](_0xc8eb88)){if(_0x202db3[_0xb416('0x71')][_0x2dec1b][_0x3d1767[_0xc8eb88]]){var _0x4eed1d=_[_0xb416('0x76')](_0x202db3[_0xb416('0x71')][_0x2dec1b][_0x3d1767[_0xc8eb88]]['replace'](/"/g,'\x27'));switch(_0xc8eb88){case _0xb416('0x37'):var _0x3fbf63=moment(_0x4eed1d,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3fbf63['isValid']()){_0x40927d[_0xb416('0x24')]('\x22'+_0x4eed1d+'\x22');}else{_0x3a411c[_0xb416('0x24')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x156c1a=parseInt(_0x4eed1d);_0x4eed1d=_[_0xb416('0x77')](_0x156c1a)||_0x156c1a<0x0||_0x156c1a>0x4?_0x302757?0x3:0x2:_0x156c1a;_0x40927d['push']('\x22'+_0x4eed1d+'\x22');break;case _0xb416('0x3b'):var _0x39fcf0=parseInt(_0x4eed1d);if(_[_0xb416('0x78')](_0x39fcf0)&&_[_0xb416('0x79')](_0x429695,_0x39fcf0)){_0x40927d[_0xb416('0x24')]('\x22'+_0x39fcf0+'\x22');}else{_0x3a411c[_0xb416('0x24')](_0xb416('0x7a'));}break;case'email':if(isEmail(_0x4eed1d)){_0x40927d[_0xb416('0x24')]('\x22'+_0x4eed1d+'\x22');}else{_0x3a411c[_0xb416('0x24')](_0xb416('0x7b'));}break;case _0xb416('0x7c'):var _0x4a45b8=moment(_0x4eed1d,'YYYY-MM-DD',!![]);if(_0x4a45b8['isValid']()){_0x40927d[_0xb416('0x24')]('\x22'+_0x4eed1d+'\x22');}else{_0x3a411c[_0xb416('0x24')](_0xb416('0x7d'));}break;default:_0x40927d[_0xb416('0x24')]('\x22'+_0x4eed1d+'\x22');}}else{switch(_0xc8eb88){case _0xb416('0x7e'):case'phone':_0x3a411c[_0xb416('0x24')](_0xc8eb88+_0xb416('0x7f'));break;default:_0x40927d[_0xb416('0x24')]('\x22\x22');}}}}else{var _0xa584a9='';if(!_[_0xb416('0x1d')](_0x4d8867)){if(!_0x5c79a8[_0xb416('0x75')](_0x4d8867['id'])){for(var _0x3d655a=0x0;_0x3d655a<_0x3d1767[_0xc8eb88][_0xb416('0x1c')];_0x3d655a++){var _0x4eed1d=_[_0xb416('0x76')](_0x202db3[_0xb416('0x71')][_0x2dec1b][_0x3d1767[_0xc8eb88][_0x3d655a]][_0xb416('0x80')](/"/g,'\x27'));var _0x43ee66=phoneDescriptions[_0xb416('0x74')](_0xb9d40=>_0xb9d40[_0xb416('0x81')]===_0x4d8867['id']);if(!_[_0xb416('0x1d')](_0x43ee66)){var _0x14a181=_[_0xb416('0x76')](_0x202db3[_0xb416('0x71')][_0x2dec1b][_0x3d1767[_0x43ee66[_0xb416('0x82')]][0x0]][_0xb416('0x80')](/"/g,'\x27'));if(!_['isNil'](_0x14a181))_0x4eed1d=_0x4eed1d+'§'+_0x14a181;}if(_0xa584a9=='')_0xa584a9=_0x4eed1d;else _0xa584a9+='|'+_0x4eed1d;}_0x520e02[_0xb416('0x24')](_0x4d8867['id']+':'+_0xa584a9);_0x5c79a8[_0x4d8867['id']]=0x1;}}}}if(hasAdditionalPhones){_0x40927d[_0xb416('0x24')]('\x22'+_0x520e02[_0xb416('0x18')](';')+'\x22');}if(_0x3a411c[_0xb416('0x1c')]){handleError(_0x202db3[_0xb416('0x71')][_0x2dec1b],{'code':_0xb416('0x83'),'message':_0x3a411c['join']()});}else{fs['appendFileSync'](_0x9e5a7b,_0x40927d[_0xb416('0x18')]()+'\x0a');}_0x40927d=[];}if(!(stats[_0xb416('0x72')]%0xc8)){socket[_0xb416('0x84')]('contact:import:'+_0x43df24,stats);stats['errors']=[];}}if(stopped){logger[_0xb416('0x5c')](_0xb416('0x85'));_0x6ca368[_0xb416('0x86')]();}}catch(_0x31f5be){handleError(_0x202db3[_0xb416('0x71')][_0x2dec1b],{'code':'SystemError','message':_0x31f5be[_0xb416('0x60')]});logger['error'](_0xb416('0x87'),_0x31f5be[_0xb416('0x60')]);}},'complete':function(){try{var _0x4c5d98=[];var _0x1c241c=tempTableName;_0x4c5d98[_0xb416('0x24')](_0xb416('0x88')+_0x1c241c+_0xb416('0x89'));logger[_0xb416('0x5c')](_0xb416('0x8a'),contactItemTypes[_0xb416('0x1c')]);var _0x2744c6=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',_0x9e5a7b,_0x1c241c,_0x30da67,_0x93b30f[_0xb416('0x8b')],_0x93b30f[_0xb416('0x57')]||null,NOW,NOW);if(_['isNil'](_0x3d1767[_0xb416('0x37')])){_0x2744c6+=_0xb416('0x8c');}_0x4c5d98[_0xb416('0x24')](_0x2744c6);BPromise['each'](_0x4c5d98,handleQuery)[_0xb416('0x1f')](function(_0x42dcdd){BPromise[_0xb416('0x1e')]([handleAdditionalPhones()])[_0xb416('0x1f')](function(){_0x4c5d98=[];for(var _0x819df4=0x0;_0x819df4\x20\x20');}var _0xf42d9f=path[_0xb416('0x18')](config[_0xb416('0x66')],_0xb416('0x67'),process['argv'][0x2]);if(!fs[_0xb416('0x98')](_0xf42d9f)){throw new Error(_0xb416('0x99'));}var _0x411c33={};try{_0x411c33=JSON[_0xb416('0x70')](process[_0xb416('0x97')][0x3]);if(!_0x411c33['binding']){throw new Error(_0xb416('0x9a'));}var _0x45fefc=0x0;if(_0x411c33[_0xb416('0x64')][_0xb416('0x3b')]){_0x45fefc=0x1;}if(!_0x411c33['ListId']){throw new Error(_0xb416('0x9b'));}}catch(_0x417ad2){throw new Error(_0xb416('0x9c'));}var _0x1e3d90=[];try{_0x1e3d90=_['map'](JSON[_0xb416('0x70')](process['argv'][0x4]),'id');}catch(_0x47eb2f){logger['info']('No\x20agent\x20available');}main(_0xf42d9f,_0x411c33,_0x1e3d90,_0x45fefc);}validate();process['on'](_0xb416('0x9d'),handleStop);process['on'](_0xb416('0x9e'),handleUncaughtException); \ No newline at end of file +var _0xc936=['scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','itemTypeId','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','finish','emit','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','binding\x20doesn\x27t\x20exists','UserId','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','lodash','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','join','.id\x20=\x20','where','sequelize','query','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','then','catch','error','message','all','split','filter','CmContactHasItem','update','updated','create','phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','priority','recallme','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone','cm_contacts.id','into','cm_hopper_black','ListId','fields','ListId\x20=\x20?','\x20=\x20?','toString','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','insert','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','exit','errors','spread','stringify','send','start','binding','clone','socket_timestamp','root','.csv','body','ContactItemType','findAll','name','_description','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','replace'];(function(_0x4b244d,_0x6fe6a3){var _0x7629ae=function(_0x3a7493){while(--_0x3a7493){_0x4b244d['push'](_0x4b244d['shift']());}};_0x7629ae(++_0x6fe6a3);}(_0xc936,0x153));var _0x6c93=function(_0x2347a2,_0x454d90){_0x2347a2=_0x2347a2-0x0;var _0x437f16=_0xc936[_0x2347a2];return _0x437f16;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x6c93('0x0'));var Papa=require('papaparse');var util=require(_0x6c93('0x1'));var BPromise=require(_0x6c93('0x2'));var moment=require(_0x6c93('0x3'));var squel=require('squel');var Redis=require(_0x6c93('0x4'));var db=require(_0x6c93('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x6c93('0x6'))(_0x6c93('0x7'));config['redis']=_['defaults'](config[_0x6c93('0x8')],{'host':_0x6c93('0x9'),'port':0x18eb});var socket=require(_0x6c93('0xa'))(new Redis(config[_0x6c93('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x6c93('0xb')](_0x6c93('0xc'));var tempTableName=_0x6c93('0xd')+moment()['format'](_0x6c93('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x255563){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'](_0x255563);}function selectNotIn(_0x52acbc,_0x19493b,_0x1d17af,_0x53487e,_0x32fde3){return squel[_0x6c93('0xf')]()[_0x6c93('0x10')]('phone')['from'](_0x53487e)[_0x6c93('0x11')](_0x19493b,null,_0x19493b+_0x6c93('0x12')+_0x53487e+'.'+_0x1d17af)[_0x6c93('0x13')](_0x53487e+'.'+_0x1d17af+'\x20=\x20'+_0x52acbc+'.'+_0x1d17af)[_0x6c93('0x13')](_0x19493b+'.dialCheckDuplicateType\x20IN\x20('+_0x32fde3[_0x6c93('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5b92d9,_0x2a7a1f){promisesAdditionalPhones=[];promisesContact=[];return db[_0x6c93('0x14')][_0x6c93('0x15')](_0x6c93('0x16')+tempTableName)['spread'](function(_0x539a18){if(_0x539a18!==null){var _0x40f32e=[];for(var _0x521195=0x0;_0x521195<_0x539a18[_0x6c93('0x17')];_0x521195++){var _0x33f020=_0x539a18[_0x521195];if(!_[_0x6c93('0x18')](_0x33f020['phone'])){if(!_[_0x6c93('0x18')](_0x33f020[_0x6c93('0x19')]))_0x40f32e[_0x6c93('0x1a')](insertAdditionalPhones(_0x33f020));promisesContact['push']({'contact':_0x33f020});}}}Promise['all'](_0x40f32e)[_0x6c93('0x1b')](function(){_0x5b92d9({'val':0x1});});})[_0x6c93('0x1c')](function(_0x3384f4){logger[_0x6c93('0x1d')](_0x3384f4[_0x6c93('0x1e')]);});});}function insertAdditionalPhones(_0x431aca){return new Promise(function(_0x442630,_0x236234){var _0x7be340=_0x431aca[_0x6c93('0x19')];if(_[_0x6c93('0x18')](_0x7be340))_0x236234({'val':0x0});else{var _0xd3d046=_0x7be340['split'](';');var _0x2423e4=[];orderBy=0x0;for(var _0x5a18b8=0x0;_0x5a18b8<_0xd3d046['length'];_0x5a18b8++){_0x2423e4[_0x6c93('0x1a')](splitAdditionalPhone(_0x431aca['id'],_0xd3d046[_0x5a18b8]));}Promise[_0x6c93('0x1f')](_0x2423e4)['then'](function(){_0x442630({'val':_0xd3d046[_0x6c93('0x17')]});});}});}function splitAdditionalPhone(_0x55d5f8,_0x3d8186){return new Promise(function(_0x187d7d,_0x3728a5){var _0x1e56a6=_0x3d8186['split'](':');var _0x111a74=_0x1e56a6[0x0];var _0x31918a=_0x1e56a6[0x1];if(_0x31918a!==''){var _0x593d7a=_0x31918a[_0x6c93('0x20')]('|');var _0x30882d=[];for(var _0x397fdc=0x0;_0x397fdc<_0x593d7a[_0x6c93('0x17')];_0x397fdc++){if(_0x593d7a[_0x397fdc]!==''){var _0x3727b7=_[_0x6c93('0x21')](promisesAdditionalPhones,{'contactId':_0x55d5f8,'phone':_0x593d7a[_0x397fdc]});if(_0x3727b7[_0x6c93('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0x6c93('0x1a')]({'contactId':_0x55d5f8,'contactTypeId':_0x111a74,'phone':_0x593d7a[_0x397fdc],'orderBy':orderBy});}}}_0x187d7d({'ok':0x1});}else _0x187d7d({'res':0x0});});}function createAdditionalPhone(_0x1a3b9c,_0x4e7b91,_0x47f0e9,_0x8ff998){var _0x39bff0='';var _0x3450e0='';var _0x6663b2=_0x47f0e9[_0x6c93('0x20')]('§');_0x39bff0=_0x6663b2[0x0];if(_0x6663b2['length']==0x2)_0x3450e0=_0x6663b2[0x1];return new Promise(function(_0x27b087,_0x1b6623){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x1a3b9c,'item':_0x39bff0}})['then'](function(_0x480752){if(_0x480752){return db[_0x6c93('0x22')][_0x6c93('0x23')]({'ItemTypeId':_0x4e7b91,'description':_0x3450e0,'OrderBy':_0x8ff998},{'where':{'CmContactId':_0x1a3b9c,'item':_0x39bff0}})[_0x6c93('0x1b')](function(_0xf10da){_0x27b087({'res':_0x6c93('0x24')});});}else{return db[_0x6c93('0x22')][_0x6c93('0x25')]({'CmContactId':_0x1a3b9c,'item':_0x39bff0,'ItemTypeId':_0x4e7b91,'description':_0x3450e0,'OrderBy':_0x8ff998,'ItemClass':'PHONE'})[_0x6c93('0x1b')](function(_0x68aeee){_0x27b087({'res':'inserted'});});}});});}function updateContact(_0x2558f7){return new Promise(function(_0x1c019e,_0x339073){var _0x323483=_0x2558f7['id'];delete _0x2558f7['id'];return db['CmContact'][_0x6c93('0x23')](_0x2558f7,{'where':{'id':_0x323483}})[_0x6c93('0x1b')](function(_0x291607){updatedRows+=0x1;return db['CmHopper'][_0x6c93('0x23')]({'phone':_0x2558f7[_0x6c93('0x26')]},{'where':{'ContactId':_0x323483}})[_0x6c93('0x1b')](function(_0x576c3a){_0x1c019e({'ret':'OK'});});});});}function insertCmHopper(_0x3bc52b,_0x3f4de3,_0x3702b2,_0x274d4e,_0x52f2f3){var _0x474b9c=['cm_contacts.phone',_0x6c93('0x27'),'cm_contacts.id',_0x6c93('0x28'),_0x3f4de3+'.'+_0x274d4e,_0x6c93('0x29'),_0x6c93('0x2a'),'cm_contacts.priority',_0x6c93('0x2b'),'\x22'+_0x52f2f3+'\x22'];return squel['insert']()['into'](_0x6c93('0x2c'))[_0x6c93('0x2d')]([_0x6c93('0x26'),_0x6c93('0x2e'),_0x6c93('0x2f'),'ListId',_0x274d4e,_0x6c93('0x30'),_0x6c93('0x31'),_0x6c93('0x32'),'UserId',_0x6c93('0x33')],squel[_0x6c93('0xf')]()['fields'](_0x474b9c)[_0x6c93('0x34')](_0x3f4de3)[_0x6c93('0x11')](_0x6c93('0x35'),null,_0x6c93('0x36')+_0x3f4de3+'.CmListId')[_0x6c93('0x11')](_0x3702b2,null,_0x3702b2+_0x6c93('0x12')+_0x3f4de3+'.'+_0x274d4e)['where'](_0x3f4de3+_0x6c93('0x37'),_0x3bc52b)[_0x6c93('0x13')](_0x6c93('0x38'),NOW)[_0x6c93('0x13')](_0x6c93('0x39'),selectNotIn(_0x3f4de3,_0x3702b2,_0x274d4e,_0x6c93('0x2c'),[_0x6c93('0x3a'),_0x6c93('0x3b')]))[_0x6c93('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3f4de3,_0x3702b2,_0x274d4e,_0x6c93('0x2c'),[_0x6c93('0x3a')])))['toString']();}function insertCmHopperBlack(_0x4771aa,_0x34d855,_0x573863,_0x1f628b){var _0xdf2bbe=[_0x6c93('0x3c'),_0x6c93('0x3d'),'cm_contacts.ListId',_0x34d855+'.'+_0x1f628b,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel['insert']()[_0x6c93('0x3e')](_0x6c93('0x3f'))[_0x6c93('0x2d')]([_0x6c93('0x26'),_0x6c93('0x2f'),_0x6c93('0x40'),_0x1f628b,_0x6c93('0x30'),_0x6c93('0x31')],squel['select']()[_0x6c93('0x41')](_0xdf2bbe)[_0x6c93('0x34')](_0x34d855)[_0x6c93('0x11')](_0x6c93('0x35'),null,_0x6c93('0x36')+_0x34d855+'.CmListId')[_0x6c93('0x11')](_0x573863,null,_0x573863+_0x6c93('0x12')+_0x34d855+'.'+_0x1f628b)[_0x6c93('0x13')](_0x34d855+'.CmListId\x20=\x20?',_0x4771aa)['where'](_0x6c93('0x38'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6c93('0xf')]()[_0x6c93('0x10')](_0x6c93('0x26'))[_0x6c93('0x34')]('cm_hopper_black')[_0x6c93('0x13')](_0x6c93('0x42'),_0x4771aa)[_0x6c93('0x13')](_0x1f628b+_0x6c93('0x43'),_0x34d855+'.'+_0x1f628b)))[_0x6c93('0x44')]();}function insertCmHopperAdditionalPhones(_0x561501){var _0x5b2eb0=['cm_hopper.id',_0x6c93('0x45'),_0x6c93('0x46'),_0x6c93('0x47'),_0x6c93('0x48')];return squel[_0x6c93('0x49')]()[_0x6c93('0x3e')]('cm_hopper_additional_phones')[_0x6c93('0x2d')](['CmHopperId',_0x6c93('0x26'),'OrderBy',_0x6c93('0x30'),_0x6c93('0x31')],squel[_0x6c93('0xf')]()[_0x6c93('0x41')](_0x5b2eb0)[_0x6c93('0x34')](_0x6c93('0x2c'))[_0x6c93('0x11')](_0x6c93('0x35'),null,_0x6c93('0x4a'))['join'](_0x6c93('0x4b'),null,_0x6c93('0x4c'))[_0x6c93('0x13')]('cm_hopper.ListId\x20=\x20?',_0x561501)[_0x6c93('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x6c93('0x44')]();}function insertCmContact(_0x345c76,_0x527115,_0x2c285b,_0xe746b){var _0x2f4ef7=_[_0x6c93('0x4d')](_[_0x6c93('0x4e')](_0xe746b),[_0x6c93('0x40'),_0x6c93('0x4f'),'createdAt',_0x6c93('0x31')]);return squel['insert']()[_0x6c93('0x3e')]('cm_contacts')[_0x6c93('0x2d')](_0x2f4ef7,squel[_0x6c93('0xf')]()[_0x6c93('0x41')](_0x2f4ef7)[_0x6c93('0x34')](_0x527115)[_0x6c93('0x13')]('('+_0x2c285b['join'](',')+_0x6c93('0x50'),squel[_0x6c93('0xf')]()[_0x6c93('0x41')](_0x2c285b)[_0x6c93('0x34')](_0x6c93('0x35'))['where'](_0x6c93('0x42'),_0x345c76))[_0x6c93('0x13')](_0x6c93('0x51'),squel[_0x6c93('0xf')]()[_0x6c93('0x10')](_0x6c93('0x52'),'min_id')[_0x6c93('0x34')](_0x527115)[_0x6c93('0x53')](_0x2c285b[_0x6c93('0x11')](','))))[_0x6c93('0x44')]();}function handleStop(){logger[_0x6c93('0x54')](_0x6c93('0x55'));stopped=!![];}function handleUncaughtException(_0x1a2481){logger[_0x6c93('0x1d')](_0x1a2481[_0x6c93('0x1e')]);process[_0x6c93('0x56')](0x1);}function handleError(_0x48b347,_0x2367ce){stats[_0x6c93('0x57')][_0x6c93('0x1a')]({'name':_0x2367ce['code'],'message':_0x2367ce[_0x6c93('0x1e')],'row':_0x48b347});}function handleQuery(_0x49ee7d){logger[_0x6c93('0x54')](_0x49ee7d);return db['sequelize'][_0x6c93('0x15')](_0x49ee7d)[_0x6c93('0x58')](function(_0x1cbeba){results['push'](_0x1cbeba);})['catch'](function(_0x294d1e){logger['error'](_0x294d1e['message']);});}function main(_0x5119f0,_0xe83553,_0x4c0cd5,_0x291aea){logger[_0x6c93('0x54')]('main',_0x5119f0,JSON[_0x6c93('0x59')](_0xe83553));process[_0x6c93('0x5a')](_0x6c93('0x5b'));var _0xa1612c=_0xe83553[_0x6c93('0x5c')];var _0x595eff=_[_0x6c93('0x5d')](_0xa1612c);var _0x5e2c3c=_0xe83553[_0x6c93('0x5e')];var _0x165403=path['join'](config[_0x6c93('0x5f')],'server/files/tmp',_0x5e2c3c+_0x6c93('0x60'));logger['info'](_0x6c93('0x61'),_0xe83553);db[_0x6c93('0x62')][_0x6c93('0x63')]({'raw':!![],'attributes':['id',_0x6c93('0x64')]})[_0x6c93('0x1b')](function(_0x214a63){for(var _0x2296b4=0x0;_0x2296b4<_0x214a63[_0x6c93('0x17')];_0x2296b4++){if(_0x214a63[_0x2296b4]['name']in _0xa1612c){contactItemTypes[_0x6c93('0x1a')](_0x214a63[_0x2296b4]);delete _0x595eff[_0x214a63[_0x2296b4][_0x6c93('0x64')]];hasAdditionalPhones=!![];}for(var _0x4fb584 in _0xa1612c){if(_0x214a63[_0x2296b4]['name']+_0x6c93('0x65')===_0x4fb584){phoneDescriptions[_0x6c93('0x1a')]({'itemTypeId':_0x214a63[_0x2296b4]['id'],'description':_0x4fb584});delete _0x595eff[_0x4fb584];}}}if(hasAdditionalPhones)_0x595eff[_0x6c93('0x19')]='';var _0x2ebb50=_[_0x6c93('0x4e')](_0x595eff)[_0x6c93('0x11')]();logger[_0x6c93('0x54')](_0x6c93('0x66'),_0x2ebb50);fs[_0x6c93('0x67')](_0x165403,_0x2ebb50+'\x0a');Papa[_0x6c93('0x68')](fs[_0x6c93('0x69')](_0x5119f0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x116fcc,_0x5c98ed){try{for(var _0x49d0fe=0x0,_0x56fbb4=[];_0x49d0fe<_0x116fcc[_0x6c93('0x6a')][_0x6c93('0x17')];_0x49d0fe++){stats[_0x6c93('0x6b')]+=0x1;if(_0x116fcc['errors'][_0x49d0fe]){handleError(_0x116fcc[_0x6c93('0x6a')][_0x49d0fe],_0x116fcc[_0x6c93('0x57')][_0x49d0fe]);}else{var _0x6b7ef0=[];var _0x1e9a9c=[];var _0x184b80={};for(var _0x3f47de in _0xa1612c){let _0x235ab6=contactItemTypes['find'](_0x13dd2e=>_0x13dd2e[_0x6c93('0x64')]===_0x3f47de);let _0x186784=contactItemTypes[_0x6c93('0x6c')](_0xec48c7=>_0xec48c7['name']+_0x6c93('0x65')===_0x3f47de);if(_['isNil'](_0x235ab6)&&_[_0x6c93('0x18')](_0x186784)){if(_0xa1612c[_0x6c93('0x6d')](_0x3f47de)){if(_0x116fcc['data'][_0x49d0fe][_0xa1612c[_0x3f47de]]){var _0x2b9c54=_['trim'](_0x116fcc[_0x6c93('0x6a')][_0x49d0fe][_0xa1612c[_0x3f47de]][_0x6c93('0x6e')](/"/g,'\x27'));switch(_0x3f47de){case'scheduledat':var _0x181545=moment(_0x2b9c54,_0x6c93('0xc'),!![]);if(_0x181545['isValid']()){_0x56fbb4[_0x6c93('0x1a')]('\x22'+_0x2b9c54+'\x22');}else{_0x6b7ef0[_0x6c93('0x1a')](_0x6c93('0x6f'));}break;case'priority':var _0x311e53=parseInt(_0x2b9c54);_0x2b9c54=_[_0x6c93('0x70')](_0x311e53)||_0x311e53<0x0||_0x311e53>0x4?_0x291aea?0x3:0x2:_0x311e53;_0x56fbb4[_0x6c93('0x1a')]('\x22'+_0x2b9c54+'\x22');break;case'UserId':var _0x19bc04=parseInt(_0x2b9c54);if(_[_0x6c93('0x71')](_0x19bc04)&&_[_0x6c93('0x72')](_0x4c0cd5,_0x19bc04)){_0x56fbb4['push']('\x22'+_0x19bc04+'\x22');}else{_0x6b7ef0['push'](_0x6c93('0x73'));}break;case _0x6c93('0x74'):if(isEmail(_0x2b9c54)){_0x56fbb4[_0x6c93('0x1a')]('\x22'+_0x2b9c54+'\x22');}else{_0x6b7ef0[_0x6c93('0x1a')](_0x6c93('0x75'));}break;case'dateOfBirth':var _0x203eb9=moment(_0x2b9c54,'YYYY-MM-DD',!![]);if(_0x203eb9[_0x6c93('0x76')]()){_0x56fbb4['push']('\x22'+_0x2b9c54+'\x22');}else{_0x6b7ef0[_0x6c93('0x1a')](_0x6c93('0x77'));}break;default:_0x56fbb4[_0x6c93('0x1a')]('\x22'+_0x2b9c54+'\x22');}}else{switch(_0x3f47de){case _0x6c93('0x78'):case _0x6c93('0x26'):_0x6b7ef0['push'](_0x3f47de+_0x6c93('0x79'));break;default:_0x56fbb4['push']('\x22\x22');}}}}else{var _0x192f0a='';if(!_[_0x6c93('0x18')](_0x235ab6)){if(!_0x184b80['hasOwnProperty'](_0x235ab6['id'])){for(var _0x376aa9=0x0;_0x376aa9<_0xa1612c[_0x3f47de][_0x6c93('0x17')];_0x376aa9++){var _0x2b9c54=_[_0x6c93('0x7a')](_0x116fcc[_0x6c93('0x6a')][_0x49d0fe][_0xa1612c[_0x3f47de][_0x376aa9]][_0x6c93('0x6e')](/"/g,'\x27'));var _0xbceaf7=phoneDescriptions[_0x6c93('0x6c')](_0x204448=>_0x204448[_0x6c93('0x7b')]===_0x235ab6['id']);if(!_[_0x6c93('0x18')](_0xbceaf7)){var _0x42a71d=_[_0x6c93('0x7a')](_0x116fcc[_0x6c93('0x6a')][_0x49d0fe][_0xa1612c[_0xbceaf7[_0x6c93('0x7c')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x6c93('0x18')](_0x42a71d))_0x2b9c54=_0x2b9c54+'§'+_0x42a71d;}if(_0x192f0a=='')_0x192f0a=_0x2b9c54;else _0x192f0a+='|'+_0x2b9c54;}_0x1e9a9c[_0x6c93('0x1a')](_0x235ab6['id']+':'+_0x192f0a);_0x184b80[_0x235ab6['id']]=0x1;}}}}if(hasAdditionalPhones){_0x56fbb4[_0x6c93('0x1a')]('\x22'+_0x1e9a9c[_0x6c93('0x11')](';')+'\x22');}if(_0x6b7ef0[_0x6c93('0x17')]){handleError(_0x116fcc[_0x6c93('0x6a')][_0x49d0fe],{'code':_0x6c93('0x7d'),'message':_0x6b7ef0[_0x6c93('0x11')]()});}else{fs[_0x6c93('0x7e')](_0x165403,_0x56fbb4[_0x6c93('0x11')]()+'\x0a');}_0x56fbb4=[];}if(!(stats[_0x6c93('0x6b')]%0xc8)){socket['emit'](_0x6c93('0x7f')+_0x5e2c3c,stats);stats[_0x6c93('0x57')]=[];}}if(stopped){logger[_0x6c93('0x54')](_0x6c93('0x80'));_0x5c98ed['abort']();}}catch(_0x2af5ac){handleError(_0x116fcc['data'][_0x49d0fe],{'code':'SystemError','message':_0x2af5ac['message']});logger[_0x6c93('0x1d')]('step',_0x2af5ac[_0x6c93('0x1e')]);}},'complete':function(){try{var _0x80581=[];var _0x3259a3=tempTableName;_0x80581[_0x6c93('0x1a')]('CREATE\x20TABLE\x20'+_0x3259a3+'\x20LIKE\x20cm_contacts;');logger[_0x6c93('0x54')](_0x6c93('0x81'),contactItemTypes['length']);var _0xaa31da=util[_0x6c93('0xb')](_0x6c93('0x82'),_0x165403,_0x3259a3,_0x2ebb50,_0xe83553['ListId'],_0xe83553[_0x6c93('0x4f')]||null,NOW,NOW);if(_['isNil'](_0xa1612c['scheduledat'])){_0xaa31da+=_0x6c93('0x83');}_0x80581[_0x6c93('0x1a')](_0xaa31da);BPromise[_0x6c93('0x84')](_0x80581,handleQuery)['then'](function(_0x1dd289){BPromise['all']([handleAdditionalPhones()])[_0x6c93('0x1b')](function(){_0x80581=[];for(var _0x448cba=0x0;_0x448cba\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.substatus','i.to','i.ContactId','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','contactName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','groupBy','Setting','enableEmailPreview','all','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','\x20IN\x20?','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','me.','interactionsTags','it.','\x20=\x20i.id','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','includes','i.phone\x20LIKE\x20?','fax','openchannel','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','type','default','text','value','end','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','map','tags','clause','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','some','compact','forEach','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1141,0x199));var _0x1114=function(_0x1fc82b,_0x5150a6){_0x1fc82b=_0x1fc82b-0x0;var _0x4c6679=_0x1141[_0x1fc82b];return _0x4c6679;};'use strict';var _=require(_0x1114('0x0'));var squel=require('squel');var as=require(_0x1114('0x1'));var qs=require(_0x1114('0x2'));var updateInteraction=require(_0x1114('0x3'))[_0x1114('0x4')];var utils=require(_0x1114('0x5'));var db=require(_0x1114('0x6'))['db'];function skipInteractionsQuery(_0x3900d7,_0x4a0d8e,_0x57a333){var _0x414f9e=![];var _0x5ba94b=utils[_0x1114('0x7')](_0x3900d7);if(_0x4a0d8e[_0x1114('0x8')]===_0x1114('0x9')&&!_0x57a333['search']&&!_0x57a333[_0x5ba94b]){_0x414f9e=!![];}return _0x414f9e;}function getTagsQuery(){return squel[_0x1114('0xa')]()[_0x1114('0xb')]('id')['field'](_0x1114('0xc'))['field'](_0x1114('0xd'))[_0x1114('0xe')](_0x1114('0xf'));}function getUsersQuery(_0x13ca06,_0x1a1d96){var _0x599960=utils[_0x1114('0x10')](_0x13ca06);var _0x43ac68=_0x1114('0x11')+_0x13ca06+_0x1114('0x12');var _0x12537c=squel['select']()[_0x1114('0xb')](_0x1114('0x13'))[_0x1114('0xb')]('u.fullname')[_0x1114('0xb')](_0x1114('0x14')+_0x599960)[_0x1114('0xe')](_0x43ac68,'ui')[_0x1114('0x15')](_0x1114('0x16'),'u',_0x1114('0x17'));if(_0x1a1d96[_0x1114('0x18')]>0x0){_0x12537c['where'](_0x1114('0x14')+_0x599960+_0x1114('0x19'),_['map'](_0x1a1d96,'id'));}return _0x12537c;}function getInteractionsQuery(_0x5b6f6){var _0x5621a2=utils['getInteractionsTables'](_0x5b6f6);var _0xe410e4=utils[_0x1114('0x7')](_0x5b6f6);var _0x44fa1f=utils[_0x1114('0x10')](_0x5b6f6);return squel[_0x1114('0xa')]()[_0x1114('0xe')](_0x5621a2['interactions'],'i')['left_join'](_0x1114('0x1a'),'c',_0x1114('0x1b'))['left_join'](_0x1114('0x16'),'o',_0x1114('0x1c'))[_0x1114('0x15')](_0x5621a2[_0x1114('0x1d')],'a',_0x1114('0x1e')+_0xe410e4)[_0x1114('0x15')](_0x5621a2['messages'],'me',_0x1114('0x1f')+_0x44fa1f+'\x20=\x20i.id')['left_join'](_0x5621a2[_0x1114('0x20')],'it',_0x1114('0x21')+_0x44fa1f+_0x1114('0x22'))[_0x1114('0x15')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x1e23ad={'body':squel[_0x1114('0x23')](),'contact':squel[_0x1114('0x23')](),'default':squel['expr'](),'fields':squel[_0x1114('0x23')](),'filter':squel[_0x1114('0x23')](),'read':squel[_0x1114('0x23')](),'tags':{'clause':squel[_0x1114('0x23')](),'ids':null},'user':squel[_0x1114('0x23')]()};return _0x1e23ad;}function parseTagParameter(_0x390743){var _0x369789=squel[_0x1114('0x23')]();if(_0x390743){var _0x57ae2f=utils[_0x1114('0x24')](_0x390743);_0x57ae2f['forEach'](function(_0xdae53f){_0x369789['or'](_0x1114('0x25'),'%,'+_0xdae53f+',%');});}return _0x369789;}function parseReadParameter(_0xd6b70d){var _0x211c3a='';if(_0xd6b70d){_0x211c3a='unreadMessages\x20{OPERATOR}\x200';if(_0xd6b70d==='1'){_0x211c3a=_0x211c3a[_0x1114('0x26')](_0x1114('0x27'),'=');}else{_0x211c3a=_0x211c3a[_0x1114('0x26')]('{OPERATOR}','>');}}return _0x211c3a;}function parseSearchFilter(_0x446c23,_0x34d101){var _0x10170c=squel[_0x1114('0x23')]();if(_0x34d101){var _0xb09d31=_0x34d101[_0x1114('0x26')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x1114('0x28')](_0xb09d31)){_0x10170c['or'](_0x1114('0x29'),_0xb09d31+'%');if(['sms','whatsapp'][_0x1114('0x2a')](_0x446c23)){_0x10170c['or'](_0x1114('0x2b'),_0xb09d31+'%');}else if(_0x446c23===_0x1114('0x2c')){_0x10170c['or']('i.fax\x20LIKE\x20?',_0xb09d31+'%');}else if(_0x446c23===_0x1114('0x2d')){_0x10170c['or']('i.from\x20LIKE\x20?',_0xb09d31+'%');}}else if(_0x446c23===_0x1114('0x2e')&&qs[_0x1114('0x2f')](_0xb09d31)){_0x10170c['or'](_0x1114('0x30'),_0xb09d31+'%');}else{if(_0x446c23===_0x1114('0x2e')){_0x10170c['or'](_0x1114('0x31'),qs[_0x1114('0x32')](_0xb09d31,!![]))['or'](_0x1114('0x33'),qs['getFullTextValue'](_0xb09d31));}else if(_0x446c23!=='fax'){_0x10170c['or'](_0x1114('0x34'),qs['getFullTextValue'](_0xb09d31));}_0x10170c['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1114('0x32')](_0xb09d31,!![]),null);}}return _0x10170c;}function parseAdvancedSearchFilter(_0x5091b4,_0x38bcf3){var _0x477cc3=getSqlClauses();var _0x123a3a=as[_0x1114('0x35')](_0x5091b4);var _0xca2d76=_0x123a3a[_0x1114('0x36')];for(var _0x3832ca=0x0;_0x3832ca<_0x123a3a['conditions'][_0x1114('0x18')];_0x3832ca++){var _0x244f7d=_0x123a3a[_0x1114('0x37')][_0x3832ca];var _0x316029='i';var _0x41f92c=_[_0x1114('0x38')](_0x38bcf3,[_0x1114('0xc'),_0x244f7d[_0x1114('0xb')]]);if(_0x41f92c){var _0x3f74e5=as['buildExpression'](_0x316029,_0x41f92c[_0x1114('0x39')],_0x244f7d);_0x477cc3[_0x1114('0x3a')][_0xca2d76](_0x3f74e5[_0x1114('0x3b')],_0x3f74e5[_0x1114('0x3c')]['start'],_0x3f74e5[_0x1114('0x3c')][_0x1114('0x3d')]);}else{switch(_0x244f7d[_0x1114('0xb')]){case'unreadMessages':var _0x3bd930=parseReadParameter(_0x244f7d[_0x1114('0x3c')]);_0x477cc3['read'][_0x1114('0x3e')](_0x3bd930);break;case _0x1114('0x3f'):if(_0x244f7d[_0x1114('0x40')]===_0x1114('0x41')){if(_0x244f7d[_0x1114('0x3c')][_0x1114('0x42')]('\x20')[_0x1114('0x18')]>0x1){_0x477cc3[_0x1114('0x43')][_0xca2d76]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x244f7d[_0x1114('0x3c')],!![]),null);}else{var _0x192c7c='%'+_0x244f7d[_0x1114('0x3c')]+'%';_0x477cc3['contact'][_0xca2d76](_0x1114('0x44'),_0x192c7c,_0x192c7c,_0x192c7c);}}else{_0x41f92c=_[_0x1114('0x38')](_0x38bcf3,[_0x1114('0xc'),_0x1114('0x45')]);_0x244f7d['field']=_0x1114('0x45');_0x3f74e5=as[_0x1114('0x46')](_0x316029,_0x41f92c['type'],_0x244f7d);_0x477cc3[_0x1114('0x43')][_0xca2d76](_0x3f74e5[_0x1114('0x3b')],_0x3f74e5[_0x1114('0x3c')][_0x1114('0x47')],_0x3f74e5['value'][_0x1114('0x3d')]);}break;case'Tag':var _0x51758f=_0x244f7d[_0x1114('0x3c')][_0x1114('0x42')](',')[_0x1114('0x48')](function(_0x4c8584){return Number(_0x4c8584);});var _0x11dfd2=parseTagParameter(_0x51758f);_0x477cc3[_0x1114('0x49')][_0x1114('0x4a')]['and'](_0x11dfd2);_0x477cc3[_0x1114('0x49')]['ids']=_0x51758f;break;case _0x1114('0x4b'):if(_0x244f7d[_0x1114('0x40')]===_0x1114('0x41')){_0x477cc3[_0x1114('0x4c')][_0xca2d76](_0x1114('0x4d'),'%'+_0x244f7d['value']+'%',null);}else{_0x41f92c=_[_0x1114('0x38')](_0x38bcf3,[_0x1114('0xc'),_0x1114('0x4e')]);_0x244f7d[_0x1114('0xb')]=_0x1114('0x4e');_0x3f74e5=as['buildExpression'](_0x316029,_0x41f92c[_0x1114('0x39')],_0x244f7d);_0x477cc3[_0x1114('0x4c')][_0xca2d76](_0x3f74e5[_0x1114('0x3b')],_0x3f74e5[_0x1114('0x3c')]['start'],_0x3f74e5['value'][_0x1114('0x3d')]);}break;case _0x1114('0x4f'):case _0x1114('0x50'):_0x3f74e5=as['buildExpression']('me',null,_0x244f7d);_0x477cc3[_0x1114('0x4f')][_0xca2d76](_0x3f74e5[_0x1114('0x3b')],_0x3f74e5[_0x1114('0x3c')][_0x1114('0x47')],_0x3f74e5['value']['end']);break;}}}return _0x477cc3;}function parseModelFields(_0x54df23,_0x98cec7,_0x343ce5){var _0x98d8fc=utils[_0x1114('0x7')](_0x54df23);var _0x57d3ec=squel[_0x1114('0x23')]();var _0x586227=_(_0x98cec7)[_0x1114('0x51')]()['map'](function(_0x222827){return _[_0x1114('0x52')](_0x343ce5,[_0x1114('0xc'),_0x222827])?_0x222827:undefined;})[_0x1114('0x53')]()[_0x1114('0x3c')]();if(_0x586227['length']>0x0){_0x586227[_0x1114('0x54')](function(_0x1846f5){if(_0x1846f5===_0x98d8fc){_0x57d3ec[_0x1114('0x3e')]('i.'+_0x98d8fc+'\x20IN\x20?',[][_0x1114('0x55')](_0x98cec7[_0x1846f5]));}else if(_0x1846f5===_0x1114('0x56')){var _0x22e3b0=JSON[_0x1114('0x57')](_0x98cec7[_0x1846f5])[_0x1114('0x58')];var _0x41a26f=JSON[_0x1114('0x57')](_0x98cec7[_0x1846f5])[_0x1114('0x59')];_0x57d3ec['and'](_0x1114('0x5a'),_0x22e3b0,_0x41a26f);}else{if(_0x98cec7[_0x1846f5]===_0x1114('0x5b')){_0x57d3ec[_0x1114('0x3e')]('i.'+_0x1846f5+'\x20IS\x20NULL');}else{_0x57d3ec[_0x1114('0x3e')]('i.'+_0x1846f5+'\x20=\x20?',_0x98cec7[_0x1846f5]);}}});}return _0x57d3ec;}function parseQueryParameters(_0x29f001,_0x2f7301,_0x2c15f2){var _0x33c54c=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x29f001,_0x2f7301,_0x2c15f2);})[_0x1114('0x5c')](function(_0x53b951){_0x33c54c[_0x1114('0x5d')][_0x1114('0x3e')](_0x53b951);return parseReadParameter(_0x2f7301[_0x1114('0x5e')]);})[_0x1114('0x5c')](function(_0x3ed611){_0x33c54c[_0x1114('0x5e')][_0x1114('0x3e')](_0x3ed611);return parseTagParameter(_0x2f7301[_0x1114('0x5f')]);})[_0x1114('0x5c')](function(_0x4136de){_0x33c54c[_0x1114('0x49')][_0x1114('0x4a')][_0x1114('0x3e')](_0x4136de);return parseSearchFilter(_0x29f001,_0x2f7301[_0x1114('0x60')]);})['then'](function(_0x2fd442){_0x33c54c['filter']=_0x2fd442;return _0x33c54c;});}function checkAccountsRestrictions(_0x1adbb7,_0x40fd96,_0xe54343){var _0x318a7b=utils[_0x1114('0x7')](_0x1adbb7);var _0x5bf367=_0x1114('0x61')+_[_0x1114('0x62')](_0x1adbb7)+(_0x1adbb7===_0x1114('0x63')?_0x1114('0x64'):_0x1114('0x65'));var _0x438990=squel[_0x1114('0x23')]();return Promise[_0x1114('0x66')]()[_0x1114('0x5c')](function(){if(_0xe54343[_0x1114('0x67')]&&_0x40fd96[_0x1114('0x8')]===_0x1114('0x9')){return _0x40fd96[_0x5bf367]({'attributes':['id'],'raw':!![]});}})[_0x1114('0x5c')](function(_0x3dc4f0){if(_0x3dc4f0){if(_0x3dc4f0['length']===0x0){_0x438990['and']('i.'+_0x318a7b+_0x1114('0x68'));}else{_0x438990['and']('i.'+_0x318a7b+_0x1114('0x19'),_[_0x1114('0x48')](_0x3dc4f0,'id'));}}else if(!_0xe54343[_0x318a7b]){_0x438990[_0x1114('0x3e')]('i.'+_0x318a7b+_0x1114('0x69'));}})[_0x1114('0x5c')](function(){return _0x438990;});}function getClosedOrderClause(_0x1a1ca4,_0x2ea628){var _0x4f9f55='';var _0x41fc07=[_0x1114('0x6a'),_0x1114('0x6b'),_0x1114('0x6c')];if(_0x1a1ca4===_0x1114('0x2e')){_0x41fc07[_0x1114('0x6d')]('i.substatus');}if(_0x2ea628['closed']==='0'&&_0x1a1ca4===_0x1114('0x2e')){_0x4f9f55='i.substatus';}else{if(_0x2ea628[_0x1114('0x6e')]==='1'){_0x41fc07[_0x1114('0x6f')]();}_0x4f9f55=_0x1114('0x70')+_0x41fc07[_0x1114('0x71')](',\x20')+')';}return _0x4f9f55;}function getFilteredInteractions(_0x24346c,_0x1d3adc,_0x3e7eea,_0x593856){var _0x1f4c5f=utils['getInteractionFK'](_0x24346c);var _0x3c2d61=_[_0x1114('0x62')](_0x24346c)+_0x1114('0x72');var _0x3c5c53=[];var _0xc5c9fd=getTagsQuery();var _0x16ac7a={'type':db[_0x1114('0x73')][_0x1114('0x74')][_0x1114('0x75')],'raw':!![]};var _0x202a4e=[];var _0x4fe035=[];return db[_0x1114('0x76')][_0x1114('0x77')](_0xc5c9fd[_0x1114('0x78')](),_0x16ac7a)[_0x1114('0x5c')](function(_0x31afea){_0x3c5c53=_[_0x1114('0x79')](_0x31afea,'id');_0x16ac7a=_[_0x1114('0x7a')](_0x16ac7a,{'model':db[_0x3c2d61],'mapToModel':!![],'nest':!![]});if(_0x3e7eea['fields']){_0x593856['attributes'][_0x1114('0x54')](function(_0x36de19){_0x1d3adc[_0x1114('0xb')]('i.'+_0x36de19);});}else{_0x1d3adc[_0x1114('0xb')](_0x1114('0x7b'),_0x1114('0x7c'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x7d'),_0x1114('0x7e'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x7f'),_0x1114('0x80'));if(_0x24346c===_0x1114('0x2e')){_0x1d3adc['field'](_0x1114('0x81'),_0x1114('0x82'));_0x1d3adc['field'](_0x1114('0x83'),'contactName');_0x1d3adc['field'](_0x1114('0x84'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x85'));_0x1d3adc['field'](_0x1114('0x86'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x87'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x88'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x89'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x8a'));_0x1d3adc['field'](_0x1114('0x8b'));_0x1d3adc[_0x1114('0xb')]('i.subject');_0x1d3adc[_0x1114('0xb')](_0x1114('0x6c'));_0x1d3adc['field'](_0x1114('0x6b'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x6a'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x8c'));_0x1d3adc['field'](_0x1114('0x8d'));_0x1d3adc['field'](_0x1114('0x8e'));_0x1d3adc['field']('i.MailAccountId');_0x1d3adc[_0x1114('0xb')]('i.UserId');}else if(_0x24346c===_0x1114('0x2d')){_0x1d3adc[_0x1114('0xb')](_0x1114('0x8f'),'contactName');}else{_0x1d3adc[_0x1114('0xb')](_0x1114('0x90'),_0x1114('0x91'));}if(_0x24346c!==_0x1114('0x2e')){_0x1d3adc[_0x1114('0xb')]('i.*');}_0x1d3adc[_0x1114('0xb')]('c.firstName','Contact.firstName');_0x1d3adc[_0x1114('0xb')](_0x1114('0x92'),'Contact.lastName');_0x1d3adc[_0x1114('0xb')](_0x1114('0x93'),_0x1114('0x94'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x95'),_0x1114('0x96'));_0x1d3adc[_0x1114('0xb')]('c.mobile','Contact.mobile');_0x1d3adc[_0x1114('0xb')]('c.fax','Contact.fax');_0x1d3adc[_0x1114('0xb')](_0x1114('0x97'),_0x1114('0x98'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x99'),_0x1114('0x9a'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x9b'),'TagIds');}if(_0x593856[_0x1114('0x9c')]){_0x1d3adc['limit'](_0x593856[_0x1114('0x9c')]);}if(_0x593856['offset']){_0x1d3adc[_0x1114('0x9d')](_0x593856[_0x1114('0x9d')]);}return db[_0x1114('0x76')][_0x1114('0x77')](_0x1d3adc[_0x1114('0x78')](),_0x16ac7a);})[_0x1114('0x5c')](function(_0x38fbd0){_0x202a4e=_0x38fbd0;var _0x2b9a77=getUsersQuery(_0x24346c,_0x202a4e);return db['sequelize'][_0x1114('0x77')](_0x2b9a77['toString'](),_0x16ac7a);})[_0x1114('0x5c')](function(_0x4fe0bb){_0x4fe035=_[_0x1114('0x9e')](_0x4fe0bb,_0x1f4c5f);if(_0x24346c===_0x1114('0x2e')){return db[_0x1114('0x9f')]['findOne']({'attributes':[_0x1114('0xa0')],'raw':!![]});}})[_0x1114('0x5c')](function(_0x284ca1){var _0x19ef37=_0x284ca1?_0x284ca1[_0x1114('0xa0')]:undefined;var _0x4bd10a=_0x202a4e[_0x1114('0x48')](function(_0x5a1562){return updateInteraction(_0x5a1562,_0x3c5c53,_0x4fe035,_0x19ef37);});return Promise[_0x1114('0xa1')](_0x4bd10a);});}function countFilteredInteractions(_0x362fe3,_0x18e845){var _0x1bb9c6=_0x362fe3[_0x1114('0xa2')]();_0x1bb9c6['field'](_0x1114('0xa3'));_0x1bb9c6[_0x1114('0xb')](_0x1114('0x7b'),_0x1114('0x7c'));var _0x26cbcf=utils[_0x1114('0x24')](_0x18e845);if(!_[_0x1114('0xa4')](_0x26cbcf)){_0x1bb9c6[_0x1114('0xa5')](_0x1114('0xa6'),_0x26cbcf);}var _0x311912={'type':db[_0x1114('0x73')][_0x1114('0x74')][_0x1114('0x75')],'raw':!![]};return db[_0x1114('0x76')]['query'](_0x1bb9c6[_0x1114('0x78')](),_0x311912);}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 _0xc3e8=['TagIds','limit','offset','sequelize','query','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','t.id\x20IN\x20?','Sequelize','exports','lodash','squel','../parsers/advancedSearch','./update-interaction','updateInteraction','../../mysqldb','role','agent','search','select','field','name','color','tools_tags','_interactions','u.id','ui.','from','users','u.id\x20=\x20ui.UserId','length','\x20IN\x20?','map','getInteractionsTables','getAccountFK','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','sms','whatsapp','includes','fax','openchannel','i.from\x20LIKE\x20?','mail','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','default','text','start','unreadMessages','and','Contact','operator','value','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','contact','Tag','tags','clause','User','user','UserId','end','body','plainBody','compact','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','resolve','then','read','tag','filter','get','capitalize','chat','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.disposition','unshift','i.substatus','closed','shift','join','getInteractionFK','Interaction','QueryTypes','SELECT','toString','keyBy','merge','fields','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','contactName','i.id','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.secondDisposition','i.thirdDisposition','i.to','i.ContactId','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','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal'];(function(_0x589589,_0x484d80){var _0x1ae411=function(_0x193408){while(--_0x193408){_0x589589['push'](_0x589589['shift']());}};_0x1ae411(++_0x484d80);}(_0xc3e8,0xb3));var _0x8c3e=function(_0x458ecc,_0x51d25){_0x458ecc=_0x458ecc-0x0;var _0x2dab38=_0xc3e8[_0x458ecc];return _0x2dab38;};'use strict';var _=require(_0x8c3e('0x0'));var squel=require(_0x8c3e('0x1'));var as=require(_0x8c3e('0x2'));var qs=require('../parsers/qs');var updateInteraction=require(_0x8c3e('0x3'))[_0x8c3e('0x4')];var utils=require('./utils');var db=require(_0x8c3e('0x5'))['db'];function skipInteractionsQuery(_0x36d011,_0x6f34b9,_0x13804d){var _0x403dd8=![];var _0x270c2a=utils['getAccountFK'](_0x36d011);if(_0x6f34b9[_0x8c3e('0x6')]===_0x8c3e('0x7')&&!_0x13804d[_0x8c3e('0x8')]&&!_0x13804d[_0x270c2a]){_0x403dd8=!![];}return _0x403dd8;}function getTagsQuery(){return squel[_0x8c3e('0x9')]()[_0x8c3e('0xa')]('id')['field'](_0x8c3e('0xb'))['field'](_0x8c3e('0xc'))['from'](_0x8c3e('0xd'));}function getUsersQuery(_0x2781a8,_0x5252c4){var _0x24ef63=utils['getInteractionFK'](_0x2781a8);var _0x240e27='user_has_'+_0x2781a8+_0x8c3e('0xe');var _0x30542d=squel[_0x8c3e('0x9')]()['field'](_0x8c3e('0xf'))[_0x8c3e('0xa')]('u.fullname')['field'](_0x8c3e('0x10')+_0x24ef63)[_0x8c3e('0x11')](_0x240e27,'ui')['left_join'](_0x8c3e('0x12'),'u',_0x8c3e('0x13'));if(_0x5252c4[_0x8c3e('0x14')]>0x0){_0x30542d['where'](_0x8c3e('0x10')+_0x24ef63+_0x8c3e('0x15'),_[_0x8c3e('0x16')](_0x5252c4,'id'));}return _0x30542d;}function getInteractionsQuery(_0x5337c3){var _0x5b0626=utils[_0x8c3e('0x17')](_0x5337c3);var _0x21e9d5=utils[_0x8c3e('0x18')](_0x5337c3);var _0x1a51b6=utils['getInteractionFK'](_0x5337c3);return squel[_0x8c3e('0x9')]()[_0x8c3e('0x11')](_0x5b0626['interactions'],'i')[_0x8c3e('0x19')](_0x8c3e('0x1a'),'c',_0x8c3e('0x1b'))['left_join'](_0x8c3e('0x12'),'o',_0x8c3e('0x1c'))['left_join'](_0x5b0626[_0x8c3e('0x1d')],'a',_0x8c3e('0x1e')+_0x21e9d5)[_0x8c3e('0x19')](_0x5b0626[_0x8c3e('0x1f')],'me',_0x8c3e('0x20')+_0x1a51b6+'\x20=\x20i.id')[_0x8c3e('0x19')](_0x5b0626[_0x8c3e('0x21')],'it',_0x8c3e('0x22')+_0x1a51b6+'\x20=\x20i.id')[_0x8c3e('0x19')](_0x8c3e('0xd'),'t',_0x8c3e('0x23'));}function getSqlClauses(){var _0x4fcc2f={'body':squel[_0x8c3e('0x24')](),'contact':squel[_0x8c3e('0x24')](),'default':squel[_0x8c3e('0x24')](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel['expr'](),'tags':{'clause':squel[_0x8c3e('0x24')](),'ids':null},'user':squel['expr']()};return _0x4fcc2f;}function parseTagParameter(_0x191ad9){var _0xc58c7=squel[_0x8c3e('0x24')]();if(_0x191ad9){var _0x4b7fa1=utils[_0x8c3e('0x25')](_0x191ad9);_0x4b7fa1[_0x8c3e('0x26')](function(_0x4ee18d){_0xc58c7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4ee18d+',%');});}return _0xc58c7;}function parseReadParameter(_0xf587eb){var _0x5dcfd0='';if(_0xf587eb){_0x5dcfd0=_0x8c3e('0x27');if(_0xf587eb==='1'){_0x5dcfd0=_0x5dcfd0[_0x8c3e('0x28')](_0x8c3e('0x29'),'=');}else{_0x5dcfd0=_0x5dcfd0[_0x8c3e('0x28')](_0x8c3e('0x29'),'>');}}return _0x5dcfd0;}function parseSearchFilter(_0x5efc54,_0x42856d){var _0x6486e3=squel[_0x8c3e('0x24')]();if(_0x42856d){var _0x3ecf75=_0x42856d[_0x8c3e('0x28')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8c3e('0x2a')](_0x3ecf75)){_0x6486e3['or']('i.id\x20LIKE\x20?',_0x3ecf75+'%');if([_0x8c3e('0x2b'),_0x8c3e('0x2c')][_0x8c3e('0x2d')](_0x5efc54)){_0x6486e3['or']('i.phone\x20LIKE\x20?',_0x3ecf75+'%');}else if(_0x5efc54===_0x8c3e('0x2e')){_0x6486e3['or']('i.fax\x20LIKE\x20?',_0x3ecf75+'%');}else if(_0x5efc54===_0x8c3e('0x2f')){_0x6486e3['or'](_0x8c3e('0x30'),_0x3ecf75+'%');}}else if(_0x5efc54===_0x8c3e('0x31')&&qs[_0x8c3e('0x32')](_0x3ecf75)){_0x6486e3['or']('c.email\x20LIKE\x20?',_0x3ecf75+'%');}else{if(_0x5efc54===_0x8c3e('0x31')){_0x6486e3['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3ecf75,!![]))['or'](_0x8c3e('0x33'),qs[_0x8c3e('0x34')](_0x3ecf75));}else if(_0x5efc54!==_0x8c3e('0x2e')){_0x6486e3['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3ecf75));}_0x6486e3['or'](_0x8c3e('0x35'),qs[_0x8c3e('0x34')](_0x3ecf75,!![]),null);}}return _0x6486e3;}function parseAdvancedSearchFilter(_0x237500,_0x12c398){var _0x1d27fc=getSqlClauses();var _0x3a35e0=as[_0x8c3e('0x36')](_0x237500);var _0x376098=_0x3a35e0[_0x8c3e('0x37')];for(var _0x25d6c6=0x0;_0x25d6c6<_0x3a35e0[_0x8c3e('0x38')][_0x8c3e('0x14')];_0x25d6c6++){var _0x20def1=_0x3a35e0[_0x8c3e('0x38')][_0x25d6c6];var _0x14d7cc='i';var _0x5e507b=_[_0x8c3e('0x39')](_0x12c398,[_0x8c3e('0xb'),_0x20def1[_0x8c3e('0xa')]]);if(_0x5e507b){var _0x3ab428=as[_0x8c3e('0x3a')](_0x14d7cc,_0x5e507b[_0x8c3e('0x3b')],_0x20def1);_0x1d27fc[_0x8c3e('0x3c')][_0x376098](_0x3ab428[_0x8c3e('0x3d')],_0x3ab428['value'][_0x8c3e('0x3e')],_0x3ab428['value']['end']);}else{switch(_0x20def1[_0x8c3e('0xa')]){case _0x8c3e('0x3f'):var _0xf037b8=parseReadParameter(_0x20def1['value']);_0x1d27fc['read'][_0x8c3e('0x40')](_0xf037b8);break;case _0x8c3e('0x41'):if(_0x20def1[_0x8c3e('0x42')]==='$substring'){if(_0x20def1[_0x8c3e('0x43')][_0x8c3e('0x44')]('\x20')['length']>0x1){_0x1d27fc['contact'][_0x376098](_0x8c3e('0x35'),qs[_0x8c3e('0x34')](_0x20def1[_0x8c3e('0x43')],!![]),null);}else{var _0x5baa30='%'+_0x20def1['value']+'%';_0x1d27fc['contact'][_0x376098](_0x8c3e('0x45'),_0x5baa30,_0x5baa30,_0x5baa30);}}else{_0x5e507b=_[_0x8c3e('0x39')](_0x12c398,[_0x8c3e('0xb'),_0x8c3e('0x46')]);_0x20def1['field']=_0x8c3e('0x46');_0x3ab428=as[_0x8c3e('0x3a')](_0x14d7cc,_0x5e507b['type'],_0x20def1);_0x1d27fc[_0x8c3e('0x47')][_0x376098](_0x3ab428[_0x8c3e('0x3d')],_0x3ab428[_0x8c3e('0x43')]['start'],_0x3ab428[_0x8c3e('0x43')]['end']);}break;case _0x8c3e('0x48'):var _0x497032=_0x20def1['value']['split'](',')['map'](function(_0x260465){return Number(_0x260465);});var _0x5c0f25=parseTagParameter(_0x497032);_0x1d27fc[_0x8c3e('0x49')][_0x8c3e('0x4a')][_0x8c3e('0x40')](_0x5c0f25);_0x1d27fc['tags']['ids']=_0x497032;break;case _0x8c3e('0x4b'):if(_0x20def1[_0x8c3e('0x42')]==='$substring'){_0x1d27fc[_0x8c3e('0x4c')][_0x376098]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x20def1[_0x8c3e('0x43')]+'%',null);}else{_0x5e507b=_[_0x8c3e('0x39')](_0x12c398,[_0x8c3e('0xb'),_0x8c3e('0x4d')]);_0x20def1['field']='UserId';_0x3ab428=as[_0x8c3e('0x3a')](_0x14d7cc,_0x5e507b[_0x8c3e('0x3b')],_0x20def1);_0x1d27fc[_0x8c3e('0x4c')][_0x376098](_0x3ab428[_0x8c3e('0x3d')],_0x3ab428[_0x8c3e('0x43')][_0x8c3e('0x3e')],_0x3ab428['value'][_0x8c3e('0x4e')]);}break;case _0x8c3e('0x4f'):case _0x8c3e('0x50'):_0x3ab428=as[_0x8c3e('0x3a')]('me',null,_0x20def1);_0x1d27fc[_0x8c3e('0x4f')][_0x376098](_0x3ab428['text'],_0x3ab428[_0x8c3e('0x43')][_0x8c3e('0x3e')],_0x3ab428[_0x8c3e('0x43')][_0x8c3e('0x4e')]);break;}}}return _0x1d27fc;}function parseModelFields(_0x5b734a,_0x249c7a,_0x42c1d2){var _0xe4d1f7=utils['getAccountFK'](_0x5b734a);var _0x2a732c=squel[_0x8c3e('0x24')]();var _0x63d10a=_(_0x249c7a)['keys']()['map'](function(_0x44370a){return _['some'](_0x42c1d2,['name',_0x44370a])?_0x44370a:undefined;})[_0x8c3e('0x51')]()[_0x8c3e('0x43')]();if(_0x63d10a[_0x8c3e('0x14')]>0x0){_0x63d10a[_0x8c3e('0x26')](function(_0x5a8357){if(_0x5a8357===_0xe4d1f7){_0x2a732c[_0x8c3e('0x40')]('i.'+_0xe4d1f7+_0x8c3e('0x15'),[]['concat'](_0x249c7a[_0x5a8357]));}else if(_0x5a8357==='createdAt'){var _0x35dcac=JSON[_0x8c3e('0x52')](_0x249c7a[_0x5a8357])['$gte'];var _0x2e4e6b=JSON[_0x8c3e('0x52')](_0x249c7a[_0x5a8357])[_0x8c3e('0x53')];_0x2a732c[_0x8c3e('0x40')](_0x8c3e('0x54'),_0x35dcac,_0x2e4e6b);}else{if(_0x249c7a[_0x5a8357]===_0x8c3e('0x55')){_0x2a732c[_0x8c3e('0x40')]('i.'+_0x5a8357+_0x8c3e('0x56'));}else{_0x2a732c[_0x8c3e('0x40')]('i.'+_0x5a8357+'\x20=\x20?',_0x249c7a[_0x5a8357]);}}});}return _0x2a732c;}function parseQueryParameters(_0x41633b,_0x532605,_0x506545){var _0x1535b8=getSqlClauses();return Promise[_0x8c3e('0x57')]()['then'](function(){return parseModelFields(_0x41633b,_0x532605,_0x506545);})[_0x8c3e('0x58')](function(_0xb63c84){_0x1535b8['fields']['and'](_0xb63c84);return parseReadParameter(_0x532605[_0x8c3e('0x59')]);})[_0x8c3e('0x58')](function(_0x2afff5){_0x1535b8[_0x8c3e('0x59')][_0x8c3e('0x40')](_0x2afff5);return parseTagParameter(_0x532605[_0x8c3e('0x5a')]);})[_0x8c3e('0x58')](function(_0x3a6150){_0x1535b8['tags'][_0x8c3e('0x4a')][_0x8c3e('0x40')](_0x3a6150);return parseSearchFilter(_0x41633b,_0x532605['filter']);})[_0x8c3e('0x58')](function(_0x21a1d5){_0x1535b8[_0x8c3e('0x5b')]=_0x21a1d5;return _0x1535b8;});}function checkAccountsRestrictions(_0x51cecc,_0x5c1360,_0x3bfa53){var _0x45520a=utils[_0x8c3e('0x18')](_0x51cecc);var _0x4dc443=_0x8c3e('0x5c')+_[_0x8c3e('0x5d')](_0x51cecc)+(_0x51cecc===_0x8c3e('0x5e')?_0x8c3e('0x5f'):_0x8c3e('0x60'));var _0x33d922=squel[_0x8c3e('0x24')]();return Promise[_0x8c3e('0x57')]()[_0x8c3e('0x58')](function(){if(_0x3bfa53[_0x8c3e('0x8')]&&_0x5c1360[_0x8c3e('0x6')]==='agent'){return _0x5c1360[_0x4dc443]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x1ac7db){if(_0x1ac7db){if(_0x1ac7db['length']===0x0){_0x33d922[_0x8c3e('0x40')]('i.'+_0x45520a+_0x8c3e('0x56'));}else{_0x33d922[_0x8c3e('0x40')]('i.'+_0x45520a+_0x8c3e('0x15'),_[_0x8c3e('0x16')](_0x1ac7db,'id'));}}else if(!_0x3bfa53[_0x45520a]){_0x33d922[_0x8c3e('0x40')]('i.'+_0x45520a+_0x8c3e('0x61'));}})['then'](function(){return _0x33d922;});}function getClosedOrderClause(_0x123103,_0x283a11){var _0x56e0a4='';var _0x1414eb=['i.thirdDisposition','i.secondDisposition',_0x8c3e('0x62')];if(_0x123103==='mail'){_0x1414eb[_0x8c3e('0x63')](_0x8c3e('0x64'));}if(_0x283a11[_0x8c3e('0x65')]==='0'&&_0x123103==='mail'){_0x56e0a4=_0x8c3e('0x64');}else{if(_0x283a11[_0x8c3e('0x65')]==='1'){_0x1414eb[_0x8c3e('0x66')]();}_0x56e0a4='CONCAT_WS(\x27\x27,\x20'+_0x1414eb[_0x8c3e('0x67')](',\x20')+')';}return _0x56e0a4;}function getFilteredInteractions(_0x4801bd,_0x2d8e93,_0xb74d63,_0x5bf41b){var _0xcd5ec7=utils[_0x8c3e('0x68')](_0x4801bd);var _0x143ce5=_[_0x8c3e('0x5d')](_0x4801bd)+_0x8c3e('0x69');var _0x2f039d=[];var _0x39963e=getTagsQuery();var _0x1afc09={'type':db['Sequelize'][_0x8c3e('0x6a')][_0x8c3e('0x6b')],'raw':!![]};var _0x27b5eb=[];var _0x3107e5=[];return db['sequelize']['query'](_0x39963e[_0x8c3e('0x6c')](),_0x1afc09)[_0x8c3e('0x58')](function(_0x5212f3){_0x2f039d=_[_0x8c3e('0x6d')](_0x5212f3,'id');_0x1afc09=_[_0x8c3e('0x6e')](_0x1afc09,{'model':db[_0x143ce5],'mapToModel':!![],'nest':!![]});if(_0xb74d63[_0x8c3e('0x6f')]){_0x5bf41b[_0x8c3e('0x70')][_0x8c3e('0x26')](function(_0x195f32){_0x2d8e93[_0x8c3e('0xa')]('i.'+_0x195f32);});}else{_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x71'),_0x8c3e('0x3f'));_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x72'),_0x8c3e('0x73'));_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x74'),_0x8c3e('0x75'));if(_0x4801bd===_0x8c3e('0x31')){_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x76'),'Account.email');_0x2d8e93[_0x8c3e('0xa')]('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',_0x8c3e('0x77'));_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x78'));_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x79'));_0x2d8e93['field'](_0x8c3e('0x7a'));_0x2d8e93[_0x8c3e('0xa')]('i.closed');_0x2d8e93['field'](_0x8c3e('0x7b'));_0x2d8e93['field'](_0x8c3e('0x7c'));_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x7d'));_0x2d8e93[_0x8c3e('0xa')]('i.lastMsgDirection');_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x7e'));_0x2d8e93[_0x8c3e('0xa')]('i.disposition');_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x7f'));_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x80'));_0x2d8e93[_0x8c3e('0xa')]('i.substatus');_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x81'));_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x82'));_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x83'));_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x84'));}else if(_0x4801bd===_0x8c3e('0x2f')){_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x85'),'contactName');}else{_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x86'),_0x8c3e('0x77'));}if(_0x4801bd!=='mail'){_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x87'));}_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x88'),_0x8c3e('0x89'));_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x8a'),_0x8c3e('0x8b'));_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x8c'),_0x8c3e('0x8d'));_0x2d8e93[_0x8c3e('0xa')]('c.phone','Contact.phone');_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x8e'),_0x8c3e('0x8f'));_0x2d8e93['field'](_0x8c3e('0x90'),_0x8c3e('0x91'));_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x92'),_0x8c3e('0x93'));_0x2d8e93[_0x8c3e('0xa')](_0x8c3e('0x94'),'Owner.internal');_0x2d8e93[_0x8c3e('0xa')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8c3e('0x95'));}if(_0x5bf41b[_0x8c3e('0x96')]){_0x2d8e93['limit'](_0x5bf41b[_0x8c3e('0x96')]);}if(_0x5bf41b['offset']){_0x2d8e93[_0x8c3e('0x97')](_0x5bf41b[_0x8c3e('0x97')]);}return db[_0x8c3e('0x98')][_0x8c3e('0x99')](_0x2d8e93[_0x8c3e('0x6c')](),_0x1afc09);})[_0x8c3e('0x58')](function(_0x2dc947){_0x27b5eb=_0x2dc947;var _0x27f4f0=getUsersQuery(_0x4801bd,_0x27b5eb);return db[_0x8c3e('0x98')][_0x8c3e('0x99')](_0x27f4f0[_0x8c3e('0x6c')](),_0x1afc09);})[_0x8c3e('0x58')](function(_0x260650){_0x3107e5=_[_0x8c3e('0x9a')](_0x260650,_0xcd5ec7);if(_0x4801bd===_0x8c3e('0x31')){return db[_0x8c3e('0x9b')][_0x8c3e('0x9c')]({'attributes':[_0x8c3e('0x9d')],'raw':!![]});}})[_0x8c3e('0x58')](function(_0x1ef9cd){var _0x3ad122=_0x1ef9cd?_0x1ef9cd['enableEmailPreview']:undefined;var _0x206574=_0x27b5eb['map'](function(_0x524ebf){return updateInteraction(_0x524ebf,_0x2f039d,_0x3107e5,_0x3ad122);});return Promise[_0x8c3e('0x9e')](_0x206574);});}function countFilteredInteractions(_0x167816,_0x235f82){var _0x45adc3=_0x167816[_0x8c3e('0x9f')]();_0x45adc3[_0x8c3e('0xa')](_0x8c3e('0xa0'));_0x45adc3[_0x8c3e('0xa')](_0x8c3e('0x71'),_0x8c3e('0x3f'));var _0xd7facd=utils['getSelectedTags'](_0x235f82);if(!_['isEmpty'](_0xd7facd)){_0x45adc3['where'](_0x8c3e('0xa1'),_0xd7facd);}var _0x1bcde3={'type':db[_0x8c3e('0xa2')]['QueryTypes'][_0x8c3e('0x6b')],'raw':!![]};return db[_0x8c3e('0x98')][_0x8c3e('0x99')](_0x45adc3[_0x8c3e('0x6c')](),_0x1bcde3);}module[_0x8c3e('0xa3')]={'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 1e697b9..b08ecdd 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 _0x27d6=['abandoned','UserId','out','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','Tags','lodash','../../mysqldb','map','fullname','split','push','waiting','talking','answered','unmanaged','total','closed','disposition'];(function(_0x18bdb2,_0x35073d){var _0x127f4e=function(_0x3f3340){while(--_0x3f3340){_0x18bdb2['push'](_0x18bdb2['shift']());}};_0x127f4e(++_0x35073d);}(_0x27d6,0xa2));var _0x627d=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x27d6[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x627d('0x0'));var db=require(_0x627d('0x1'))['db'];function getInteractionUsers(_0x39e33a,_0x5433e2){return new Promise(function(_0x3e18b3,_0x580dbf){try{var _0xaaa24f=[];if(_0x5433e2[_0x39e33a]){_0xaaa24f=_0x5433e2[_0x39e33a][_0x627d('0x2')](function(_0x565e75){return{'id':_0x565e75['id'],'fullname':_0x565e75[_0x627d('0x3')]};});}return _0x3e18b3(_0xaaa24f);}catch(_0x271ba8){_0x580dbf(_0x271ba8);}});}function getInteractionTags(_0x39af5f,_0x46b1af){var _0x18d5ee=[];if(_0x39af5f){_0x39af5f[_0x627d('0x4')](',')['forEach'](function(_0x1f7ba4){_0x18d5ee[_0x627d('0x5')](_0x46b1af[_0x1f7ba4]);});}return _0x18d5ee;}function updateWaitingCounter(_0x365907){if(_0x365907['waiting']){_0x365907[_0x627d('0x6')]-=0x1;}}function updateInteractionCounters(_0x127cbe){_0x127cbe['waiting']=0x0;_0x127cbe[_0x627d('0x7')]=0x0;_0x127cbe[_0x627d('0x8')]=0x0;_0x127cbe[_0x627d('0x9')]=0x0;_0x127cbe['abandoned']=0x0;_0x127cbe[_0x627d('0xa')]=0x0;if(_0x127cbe[_0x627d('0xb')]){if(_0x127cbe[_0x627d('0xc')]===_0x627d('0xd')){_0x127cbe[_0x627d('0xd')]+=0x1;updateWaitingCounter(_0x127cbe);}if(_0x127cbe[_0x627d('0xe')]){_0x127cbe['answered']+=0x1;if(_0x127cbe[_0x627d('0x7')]){_0x127cbe[_0x627d('0x7')]-=0x1;}}else{if(_0x127cbe[_0x627d('0xc')]){_0x127cbe[_0x627d('0x9')]+=0x1;updateWaitingCounter(_0x127cbe);}}}else{if(!_0x127cbe['UserId']){_0x127cbe[_0x627d('0x6')]+=0x1;}if(_0x127cbe[_0x627d('0xe')]){_0x127cbe['talking']+=0x1;updateWaitingCounter(_0x127cbe);}}_0x127cbe[_0x627d('0xa')]+=0x1;return _0x127cbe;}function getLastMessageText(_0x26b454){return db['MailMessage']['findOne']({'where':{'$and':[{'MailInteractionId':_0x26b454['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x627d('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x627d('0x10')],'order':_0x627d('0x11'),'raw':!![]})[_0x627d('0x12')](function(_0x319164){if(_0x319164&&_0x319164[_0x627d('0x10')]){_0x26b454[_0x627d('0x13')]=_[_0x627d('0x14')](_0x319164[_0x627d('0x10')]);}return _0x26b454;})[_0x627d('0x15')](function(_0x41ce7b){throw _0x41ce7b;});}exports[_0x627d('0x16')]=function(_0x46384a,_0x44ff94,_0x4fee6c,_0x251aa8){return new Promise(function(_0x21f643,_0x4d46d1){return getInteractionUsers(_0x46384a['id'],_0x4fee6c)['then'](function(_0xb4c5df){_0x46384a[_0x627d('0x17')]=_0xb4c5df;return getInteractionTags(_0x46384a['TagIds'],_0x44ff94);})[_0x627d('0x12')](function(_0xf3fd57){_0x46384a[_0x627d('0x18')]=_0xf3fd57;delete _0x46384a['TagIds'];return updateInteractionCounters(_0x46384a);})[_0x627d('0x12')](function(_0x4ba84c){if(_0x251aa8){return getLastMessageText(_0x4ba84c);}else{return _0x4ba84c;}})[_0x627d('0x12')](function(_0x477833){_0x21f643(_0x477833);})[_0x627d('0x15')](function(_0x3fca9c){_0x4d46d1(_0x3fca9c);});});}; \ No newline at end of file +var _0xbd91=['unmanaged','abandoned','total','closed','disposition','UserId','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','catch','TagIds','Tags','lodash','fullname','split','forEach','push','waiting','talking','answered'];(function(_0x3e81aa,_0x2bdbc9){var _0x2a2226=function(_0x384029){while(--_0x384029){_0x3e81aa['push'](_0x3e81aa['shift']());}};_0x2a2226(++_0x2bdbc9);}(_0xbd91,0x178));var _0x1bd9=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xbd91[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0x1bd9('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x423f6e,_0x1f3767){return new Promise(function(_0x2868c8,_0x4f0b7c){try{var _0x545a62=[];if(_0x1f3767[_0x423f6e]){_0x545a62=_0x1f3767[_0x423f6e]['map'](function(_0xe0c9ad){return{'id':_0xe0c9ad['id'],'fullname':_0xe0c9ad[_0x1bd9('0x1')]};});}return _0x2868c8(_0x545a62);}catch(_0x384e61){_0x4f0b7c(_0x384e61);}});}function getInteractionTags(_0x8ffb28,_0x7d4d7d){var _0x23e25e=[];if(_0x8ffb28){_0x8ffb28[_0x1bd9('0x2')](',')[_0x1bd9('0x3')](function(_0x575383){_0x23e25e[_0x1bd9('0x4')](_0x7d4d7d[_0x575383]);});}return _0x23e25e;}function updateWaitingCounter(_0x79bb15){if(_0x79bb15['waiting']){_0x79bb15['waiting']-=0x1;}}function updateInteractionCounters(_0x3f0091){_0x3f0091[_0x1bd9('0x5')]=0x0;_0x3f0091[_0x1bd9('0x6')]=0x0;_0x3f0091[_0x1bd9('0x7')]=0x0;_0x3f0091[_0x1bd9('0x8')]=0x0;_0x3f0091[_0x1bd9('0x9')]=0x0;_0x3f0091[_0x1bd9('0xa')]=0x0;if(_0x3f0091[_0x1bd9('0xb')]){if(_0x3f0091['disposition']===_0x1bd9('0x9')){_0x3f0091[_0x1bd9('0x9')]+=0x1;updateWaitingCounter(_0x3f0091);}if(_0x3f0091['UserId']){_0x3f0091['answered']+=0x1;if(_0x3f0091[_0x1bd9('0x6')]){_0x3f0091[_0x1bd9('0x6')]-=0x1;}}else{if(_0x3f0091[_0x1bd9('0xc')]){_0x3f0091[_0x1bd9('0x8')]+=0x1;updateWaitingCounter(_0x3f0091);}}}else{if(!_0x3f0091[_0x1bd9('0xd')]){_0x3f0091[_0x1bd9('0x5')]+=0x1;}if(_0x3f0091[_0x1bd9('0xd')]){_0x3f0091[_0x1bd9('0x6')]+=0x1;updateWaitingCounter(_0x3f0091);}}_0x3f0091[_0x1bd9('0xa')]+=0x1;return _0x3f0091;}function getLastMessageText(_0x3901c9){return db[_0x1bd9('0xe')][_0x1bd9('0xf')]({'where':{'$and':[{'MailInteractionId':_0x3901c9['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1bd9('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x1bd9('0x11')],'order':_0x1bd9('0x12'),'raw':!![]})[_0x1bd9('0x13')](function(_0x5ca4e3){if(_0x5ca4e3&&_0x5ca4e3[_0x1bd9('0x11')]){_0x3901c9[_0x1bd9('0x14')]=_['trimStart'](_0x5ca4e3['plainBody']);}return _0x3901c9;})[_0x1bd9('0x15')](function(_0x49a9ca){throw _0x49a9ca;});}exports['updateInteraction']=function(_0x1bf38d,_0x4b020b,_0x5cf327,_0x266d37){return new Promise(function(_0x128ca6,_0x23fb48){return getInteractionUsers(_0x1bf38d['id'],_0x5cf327)[_0x1bd9('0x13')](function(_0x4a680b){_0x1bf38d['Users']=_0x4a680b;return getInteractionTags(_0x1bf38d[_0x1bd9('0x16')],_0x4b020b);})['then'](function(_0x1a24b1){_0x1bf38d[_0x1bd9('0x17')]=_0x1a24b1;delete _0x1bf38d[_0x1bd9('0x16')];return updateInteractionCounters(_0x1bf38d);})[_0x1bd9('0x13')](function(_0x4d0180){if(_0x266d37){return getLastMessageText(_0x4d0180);}else{return _0x4d0180;}})[_0x1bd9('0x13')](function(_0x498177){_0x128ca6(_0x498177);})[_0x1bd9('0x15')](function(_0x1d96b7){_0x23fb48(_0x1d96b7);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index dc65bfa..a482dca 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 _0x5ccc=['websites','_interactions','_interaction_has_tags','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','Interaction','findOne','then','catch','exports','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','chat-interactions','whatsapp-interactions','chat','Website','Account','capitalize','InteractionId','upperFirst','unknown'];(function(_0x3a8ae5,_0x15d936){var _0x4176cf=function(_0x535bdf){while(--_0x535bdf){_0x3a8ae5['push'](_0x3a8ae5['shift']());}};_0x4176cf(++_0x15d936);}(_0x5ccc,0x127));var _0xc5cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ccc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var db=require(_0xc5cc('0x0'))['db'];var loggers={'openchannel':require(_0xc5cc('0x1'))(_0xc5cc('0x2')),'mail':require('../../config/logger')('mail-interactions'),'fax':require('../../config/logger')(_0xc5cc('0x3')),'sms':require(_0xc5cc('0x1'))('sms-interactions'),'chat':require(_0xc5cc('0x1'))(_0xc5cc('0x4')),'whatsapp':require('../../config/logger')(_0xc5cc('0x5'))};function getAccountFK(_0x126d90){return _['capitalize'](_0x126d90)+(_0x126d90===_0xc5cc('0x6')?_0xc5cc('0x7'):_0xc5cc('0x8'))+'Id';}function getInteractionFK(_0x1ec38b){return _[_0xc5cc('0x9')](_0x1ec38b)+_0xc5cc('0xa');}function getInteractionId(_0x27c32c,_0x1e18d7,_0x3d12e5){if(_0x27c32c&&_0x27c32c[_['upperFirst'](_0x3d12e5)+_0xc5cc('0xa')]){return _0x27c32c[_[_0xc5cc('0xb')](_0x3d12e5)+_0xc5cc('0xa')];}else if(_0x27c32c&&_0x27c32c['id']){return _0x27c32c['id'];}else if(_0x1e18d7&&_0x1e18d7['id']){return _0x1e18d7['id'];}else{return _0xc5cc('0xc');}}function getInteractionsTables(_0x520f6e){return{'accounts':_0x520f6e+'_'+(_0x520f6e===_0xc5cc('0x6')?_0xc5cc('0xd'):'accounts'),'interactions':_0x520f6e+_0xc5cc('0xe'),'interactionsTags':_0x520f6e+_0xc5cc('0xf'),'messages':_0x520f6e+'_messages','userInteractions':_0xc5cc('0x10')+_0x520f6e+'_interactions'};}function getSelectedTags(_0x3acb7a){var _0x1f31f4=[];if(_0x3acb7a){_0x1f31f4=Array['isArray'](_0x3acb7a)?_0x3acb7a:[_0x3acb7a];}return _0x1f31f4;}function log(_0x49d561,_0x4ad1db,_0x2189ad,_0x2ee52f,_0x1332a4,_0x472c39){loggers[_0x1332a4[_0xc5cc('0x11')]()][_0x49d561](_0xc5cc('0x12'),_0x472c39[_0xc5cc('0x13')](),_0x4ad1db?_0x4ad1db['id']:null,_0x4ad1db?_0x4ad1db[_0xc5cc('0x14')]:null,_0x4ad1db?_0x4ad1db['role']:null,getInteractionId(_0x2189ad,_0x2ee52f,_0x1332a4),_0x2189ad?JSON[_0xc5cc('0x15')](_0x2189ad):_0xc5cc('0x16'));}function updateUser(_0x31c655,_0x5e4071,_0x1a77c4,_0x585a86,_0x49b7b1){db[_[_0xc5cc('0xb')](_0x585a86)+_0xc5cc('0x17')][_0xc5cc('0x18')]({'where':{'id':getInteractionId(_0x5e4071,_0x1a77c4,_0x585a86)}})[_0xc5cc('0x19')](function(_0x4c8cbb){if(_0x4c8cbb){return _0x4c8cbb['update']({'UserId':_0x31c655?_0x31c655['id']:null});}})[_0xc5cc('0x19')](function(_0x19ed33){if(_0x19ed33){log('info',_0x31c655,_0x5e4071,_0x1a77c4,_0x585a86,_0x49b7b1);}})[_0xc5cc('0x1a')](function(){log('error',_0x31c655,_0x5e4071,_0x1a77c4,_0x585a86,_0x49b7b1);});}module[_0xc5cc('0x1b')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xffca=['chat-interactions','chat','Website','Account','capitalize','InteractionId','upperFirst','websites','accounts','_interactions','_interaction_has_tags','_messages','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','findOne','then','update','catch','error','exports','../../mysqldb','openchannel-interactions','../../config/logger','fax-interactions','sms-interactions'];(function(_0x54fbed,_0x3c77a7){var _0x333bbc=function(_0x53c015){while(--_0x53c015){_0x54fbed['push'](_0x54fbed['shift']());}};_0x333bbc(++_0x3c77a7);}(_0xffca,0x112));var _0xaffc=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xffca[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var db=require(_0xaffc('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xaffc('0x1')),'mail':require('../../config/logger')('mail-interactions'),'fax':require(_0xaffc('0x2'))(_0xaffc('0x3')),'sms':require('../../config/logger')(_0xaffc('0x4')),'chat':require('../../config/logger')(_0xaffc('0x5')),'whatsapp':require(_0xaffc('0x2'))('whatsapp-interactions')};function getAccountFK(_0x2b1777){return _['capitalize'](_0x2b1777)+(_0x2b1777===_0xaffc('0x6')?_0xaffc('0x7'):_0xaffc('0x8'))+'Id';}function getInteractionFK(_0x3f1dd2){return _[_0xaffc('0x9')](_0x3f1dd2)+_0xaffc('0xa');}function getInteractionId(_0x31c959,_0x27d26b,_0x3be7b5){if(_0x31c959&&_0x31c959[_[_0xaffc('0xb')](_0x3be7b5)+_0xaffc('0xa')]){return _0x31c959[_[_0xaffc('0xb')](_0x3be7b5)+_0xaffc('0xa')];}else if(_0x31c959&&_0x31c959['id']){return _0x31c959['id'];}else if(_0x27d26b&&_0x27d26b['id']){return _0x27d26b['id'];}else{return'unknown';}}function getInteractionsTables(_0x5ae15b){return{'accounts':_0x5ae15b+'_'+(_0x5ae15b===_0xaffc('0x6')?_0xaffc('0xc'):_0xaffc('0xd')),'interactions':_0x5ae15b+_0xaffc('0xe'),'interactionsTags':_0x5ae15b+_0xaffc('0xf'),'messages':_0x5ae15b+_0xaffc('0x10'),'userInteractions':'user_has_'+_0x5ae15b+_0xaffc('0xe')};}function getSelectedTags(_0x1074b2){var _0x2d6c57=[];if(_0x1074b2){_0x2d6c57=Array[_0xaffc('0x11')](_0x1074b2)?_0x1074b2:[_0x1074b2];}return _0x2d6c57;}function log(_0x26788c,_0x35e015,_0x569a14,_0x39fba0,_0x27e8e3,_0x2a0775){loggers[_0x27e8e3[_0xaffc('0x12')]()][_0x26788c](_0xaffc('0x13'),_0x2a0775[_0xaffc('0x14')](),_0x35e015?_0x35e015['id']:null,_0x35e015?_0x35e015[_0xaffc('0x15')]:null,_0x35e015?_0x35e015[_0xaffc('0x16')]:null,getInteractionId(_0x569a14,_0x39fba0,_0x27e8e3),_0x569a14?JSON[_0xaffc('0x17')](_0x569a14):_0xaffc('0x18'));}function updateUser(_0x4e0037,_0x3ab36c,_0x427ecb,_0xf3a793,_0x430dcc){db[_[_0xaffc('0xb')](_0xf3a793)+'Interaction'][_0xaffc('0x19')]({'where':{'id':getInteractionId(_0x3ab36c,_0x427ecb,_0xf3a793)}})[_0xaffc('0x1a')](function(_0x4938c7){if(_0x4938c7){return _0x4938c7[_0xaffc('0x1b')]({'UserId':_0x4e0037?_0x4e0037['id']:null});}})[_0xaffc('0x1a')](function(_0x2ca1a8){if(_0x2ca1a8){log('info',_0x4e0037,_0x3ab36c,_0x427ecb,_0xf3a793,_0x430dcc);}})[_0xaffc('0x1c')](function(){log(_0xaffc('0x1d'),_0x4e0037,_0x3ab36c,_0x427ecb,_0xf3a793,_0x430dcc);});}module[_0xaffc('0x1e')]={'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 1c44658..805aab4 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 _0x538f=['../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','isUserLimit','crypto','composable-middleware','../../mysqldb'];(function(_0x55c059,_0x190a59){var _0x5cdcd3=function(_0xc978d7){while(--_0xc978d7){_0x55c059['push'](_0x55c059['shift']());}};_0x5cdcd3(++_0x190a59);}(_0x538f,0x1c8));var _0xf538=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x538f[_0x321bb2];return _0x9c12ed;};'use strict';var crypto=require(_0xf538('0x0'));var util=require('util');var compose=require(_0xf538('0x1'));var db=require(_0xf538('0x2'))['db'];var config=require(_0xf538('0x3'));function getValueFromLicense(_0x5d69bd,_0x4179fd){if(_0x5d69bd&&_0x4179fd){if(_0x4179fd[_0xf538('0x4')]&&_0x4179fd[_0xf538('0x5')]){var _0x76d653=_0x4179fd[_0xf538('0x4')];var _0x36c49e=_0x4179fd[_0xf538('0x5')];var _0xc3d68f=_0x76d653[_0xf538('0x6')]('-')[0x4];var _0x1b2cda=_0x76d653[_0xf538('0x6')]('-')[0x0];var _0x259901=crypto['createDecipher'](_0xf538('0x7'),util[_0xf538('0x8')](_0xf538('0x9'),_0xc3d68f,_0x76d653,_0x1b2cda));var _0x275c5d=_0x259901[_0xf538('0xa')](_0x36c49e,_0xf538('0xb'),_0xf538('0xc'));_0x275c5d+=_0x259901[_0xf538('0xd')](_0xf538('0xc'));var _0x526f5=JSON[_0xf538('0xe')](_0x275c5d);return _0x526f5[_0xf538('0xf')](_0x5d69bd)?_0x526f5[_0x5d69bd]:null;}}return null;}function isLimit(_0x5e3037,_0x1bf1bf,_0x2c644e,_0x4105d6){var _0x29bb86=_0x1bf1bf;return compose()[_0xf538('0x10')](function(_0x3ed845,_0x33b9e6,_0x30664a){return db['License'][_0xf538('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1125d6){var _0x558f28=getValueFromLicense(_0x5e3037,_0x1125d6);return _0x558f28?_0x558f28:_0x29bb86;})[_0xf538('0x12')](function(_0x4290c3){_0x29bb86=_0x4290c3;return _0x2c644e[_0xf538('0x13')](_0x4105d6);})['then'](function(_0x50c7df){if(_0x50c7df>=_0x29bb86){return _0x33b9e6[_0xf538('0x14')](0x193)[_0xf538('0x15')]({'message':util[_0xf538('0x8')](_0xf538('0x16'),_0x5e3037)});}_0x30664a();})[_0xf538('0x17')](function(_0x4921a1){_0x30664a(_0x4921a1);});});}function isUserLimit(){return isLimit(_0xf538('0x18'),0x1,db[_0xf538('0x19')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0xf538('0x1a')]=isUserLimit; \ No newline at end of file +var _0xcd91=['then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','update','base64','utf8','final','parse','use','License','findOne'];(function(_0x36ded3,_0x596ff6){var _0x1756d9=function(_0x31996c){while(--_0x31996c){_0x36ded3['push'](_0x36ded3['shift']());}};_0x1756d9(++_0x596ff6);}(_0xcd91,0xfd));var _0x1cd9=function(_0x577ed7,_0x32d991){_0x577ed7=_0x577ed7-0x0;var _0x22cffd=_0xcd91[_0x577ed7];return _0x22cffd;};'use strict';var crypto=require('crypto');var util=require(_0x1cd9('0x0'));var compose=require(_0x1cd9('0x1'));var db=require(_0x1cd9('0x2'))['db'];var config=require(_0x1cd9('0x3'));function getValueFromLicense(_0x3554f0,_0xa2ce2e){if(_0x3554f0&&_0xa2ce2e){if(_0xa2ce2e[_0x1cd9('0x4')]&&_0xa2ce2e[_0x1cd9('0x5')]){var _0x13787e=_0xa2ce2e[_0x1cd9('0x4')];var _0x54571a=_0xa2ce2e[_0x1cd9('0x5')];var _0x2f147d=_0x13787e[_0x1cd9('0x6')]('-')[0x4];var _0x10a90a=_0x13787e[_0x1cd9('0x6')]('-')[0x0];var _0x27681d=crypto['createDecipher'](_0x1cd9('0x7'),util[_0x1cd9('0x8')]('%s:%s:%s',_0x2f147d,_0x13787e,_0x10a90a));var _0x3096b3=_0x27681d[_0x1cd9('0x9')](_0x54571a,_0x1cd9('0xa'),_0x1cd9('0xb'));_0x3096b3+=_0x27681d[_0x1cd9('0xc')](_0x1cd9('0xb'));var _0x49d832=JSON[_0x1cd9('0xd')](_0x3096b3);return _0x49d832['hasOwnProperty'](_0x3554f0)?_0x49d832[_0x3554f0]:null;}}return null;}function isLimit(_0x59a430,_0x26a5db,_0x5d3e14,_0x5f37bf){var _0x135eb2=_0x26a5db;return compose()[_0x1cd9('0xe')](function(_0x1f6597,_0x47173a,_0x5b0fa7){return db[_0x1cd9('0xf')][_0x1cd9('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x1cd9('0x11')](function(_0x4c9679){var _0x2b0c56=getValueFromLicense(_0x59a430,_0x4c9679);return _0x2b0c56?_0x2b0c56:_0x135eb2;})[_0x1cd9('0x11')](function(_0x1769c2){_0x135eb2=_0x1769c2;return _0x5d3e14[_0x1cd9('0x12')](_0x5f37bf);})['then'](function(_0x447baa){if(_0x447baa>=_0x135eb2){return _0x47173a[_0x1cd9('0x13')](0x193)[_0x1cd9('0x14')]({'message':util[_0x1cd9('0x8')](_0x1cd9('0x15'),_0x59a430)});}_0x5b0fa7();})[_0x1cd9('0x16')](function(_0x41b1e4){_0x5b0fa7(_0x41b1e4);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x1cd9('0x17')],{'where':{'$or':[{'role':_0x1cd9('0x18')},{'role':_0x1cd9('0x19')}]}});}exports[_0x1cd9('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 2c7bdf4..7cad036 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 _0x866a=['lodash','moment','and','[$and]','replace','[$or]','length','split','shift','match','filter','map','push','operator','$eq','$between','value','includes','$lte','add','days','castTo','text','field','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','start','pop','utcOffset','format'];(function(_0x396616,_0x27bb9b){var _0x5de688=function(_0x5103bd){while(--_0x5103bd){_0x396616['push'](_0x396616['shift']());}};_0x5de688(++_0x27bb9b);}(_0x866a,0x7e));var _0xa866=function(_0x4d8b8e,_0x12fb10){_0x4d8b8e=_0x4d8b8e-0x0;var _0x3103ba=_0x866a[_0x4d8b8e];return _0x3103ba;};'use strict';var _=require(_0xa866('0x0'));var moment=require(_0xa866('0x1'));exports['parseSearch']=function(_0xea14b8){var _0x36ce81={'conditions':[]};_0x36ce81['sqlOperator']=_['startsWith'](_0xea14b8,'[$or]')?'or':_0xa866('0x2');var _0x38aca4=_0xea14b8['replace'](_0xa866('0x3'),'')[_0xa866('0x4')](_0xa866('0x5'),'')['split']('||');for(var _0x23d494=0x0;_0x23d494<_0x38aca4[_0xa866('0x6')];_0x23d494++){var _0x4abb7c=_0x38aca4[_0x23d494][_0xa866('0x7')](':=');var _0x50c1e4=_0x4abb7c[0x0];var _0x2c93a4=_0x4abb7c['slice'](0x1);_0x2c93a4['forEach'](function(_0x36f2c0){var _0x24bbfe=_0x36f2c0[_0xa866('0x7')]('[')[_0xa866('0x8')]();var _0x7875b0=_0x36f2c0[_0xa866('0x9')](/\[(.*?)\]/g);_0x7875b0['forEach'](function(_0x22768d){var _0x3b5925=_0x22768d[_0xa866('0x7')]('[')[_0xa866('0xa')](function(_0x1324e0){return _0x1324e0['indexOf'](']')>-0x1;})[_0xa866('0xb')](function(_0x391cb6){return _0x391cb6[_0xa866('0x7')](']')[0x0];})[0x0];_0x36ce81['conditions'][_0xa866('0xc')]({'field':_0x50c1e4,'operator':_0x24bbfe,'value':_0x3b5925});});});}return _0x36ce81;};exports['buildExpression']=function(_0x58bebd,_0x5cb5b7,_0x3e4ac4){var _0x899e1a={};if(_0x5cb5b7==='DATE'){if(_0x3e4ac4[_0xa866('0xd')]===_0xa866('0xe')){_0x3e4ac4[_0xa866('0xd')]=_0xa866('0xf');_0x3e4ac4['value']+=','+_0x3e4ac4[_0xa866('0x10')];}else if(_[_0xa866('0x11')](['$gt',_0xa866('0x12')],_0x3e4ac4['operator'])){_0x3e4ac4[_0xa866('0x10')]=moment(_0x3e4ac4[_0xa866('0x10')])[_0xa866('0x13')](0x1,_0xa866('0x14'))['format']('YYYY-MM-DD');}}if(_0x3e4ac4[_0xa866('0x15')]){_0x5cb5b7=_0x3e4ac4[_0xa866('0x15')];_0x899e1a[_0xa866('0x16')]='CAST('+_0x58bebd+'.'+_0x3e4ac4[_0xa866('0x17')]+'\x20AS\x20'+_0x3e4ac4[_0xa866('0x15')]+')\x20'+parseOperator(_0x3e4ac4[_0xa866('0xd')]);}else{_0x899e1a[_0xa866('0x16')]=_0x58bebd+'.'+_0x3e4ac4[_0xa866('0x17')]+'\x20'+parseOperator(_0x3e4ac4[_0xa866('0xd')]);}if(_[_0xa866('0x11')]([_0xa866('0x18'),_0xa866('0x19')],_0x3e4ac4['operator']))_0x899e1a['text']='('+_0x899e1a[_0xa866('0x16')]+'\x20OR\x20'+_0x58bebd+'.'+_0x3e4ac4[_0xa866('0x17')]+_0xa866('0x1a');_0x899e1a[_0xa866('0x10')]=parseValue(_0x5cb5b7,_0x3e4ac4[_0xa866('0xd')],_0x3e4ac4[_0xa866('0x10')]);return _0x899e1a;};function parseOperator(_0x5041c9){var _0x158537;switch(_0x5041c9){case _0xa866('0x1b'):_0x158537=_0xa866('0x1c');break;case _0xa866('0x19'):_0x158537='NOT\x20IN\x20?';break;case'$eq':_0x158537=_0xa866('0x1d');break;case'$ne':_0x158537=_0xa866('0x1e');break;case'$substring':case'$startsWith':case _0xa866('0x1f'):_0x158537=_0xa866('0x20');break;case _0xa866('0x21'):_0x158537=_0xa866('0x22');break;case'$gt':_0x158537=_0xa866('0x23');break;case'$lte':_0x158537=_0xa866('0x24');break;case'$gte':_0x158537=_0xa866('0x25');break;case _0xa866('0xf'):_0x158537='BETWEEN\x20?\x20AND\x20?';break;}return _0x158537;}function parseValue(_0x24873c,_0x4c3d67,_0x5110d8){var _0xe33e1a={'start':undefined,'end':undefined};switch(_0x4c3d67){case'$in':case _0xa866('0x19'):_0xe33e1a['start']=_0x5110d8['split'](',');break;case'$substring':_0xe33e1a['start']='%'+_0x5110d8+'%';break;case'$startsWith':_0xe33e1a['start']=_0x5110d8+'%';break;case _0xa866('0x1f'):_0xe33e1a[_0xa866('0x26')]='%'+_0x5110d8;break;case'$between':var _0x4a5f3f=_0x5110d8['split'](',');var _0x5110d8=_0x4a5f3f[_0xa866('0x8')]();var _0x1628ac=_0x4a5f3f[_0xa866('0x27')]();if(_0x24873c==='DATE'){_0x5110d8=moment(_0x5110d8)[_0xa866('0x28')](0x0,!![])[_0xa866('0x29')]();_0x1628ac=moment(_0x1628ac)['utcOffset'](0x0,!![])[_0xa866('0x13')](0x17,'hours')[_0xa866('0x13')](0x3b,'minutes')[_0xa866('0x13')](0x3b,'seconds')[_0xa866('0x29')]();}_0xe33e1a={'start':_0x5110d8,'end':_0x1628ac};break;default:_0xe33e1a[_0xa866('0x26')]=_0x5110d8;break;}return _0xe33e1a;} \ No newline at end of file +var _0x40c0=['castTo','CAST(','\x20AS\x20','field','$ne','$notIn','text','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','utcOffset','seconds','moment','parseSearch','sqlOperator','startsWith','and','replace','[$and]','split','length','slice','shift','match','forEach','filter','map','conditions','push','operator','$eq','value','includes','$gt','$lte','add','format','YYYY-MM-DD'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x40c0,0x1d5));var _0x040c=function(_0x43c6ae,_0x31e9ec){_0x43c6ae=_0x43c6ae-0x0;var _0x129ec5=_0x40c0[_0x43c6ae];return _0x129ec5;};'use strict';var _=require('lodash');var moment=require(_0x040c('0x0'));exports[_0x040c('0x1')]=function(_0x23f5b2){var _0x21a369={'conditions':[]};_0x21a369[_0x040c('0x2')]=_[_0x040c('0x3')](_0x23f5b2,'[$or]')?'or':_0x040c('0x4');var _0x50eb9c=_0x23f5b2[_0x040c('0x5')](_0x040c('0x6'),'')['replace']('[$or]','')[_0x040c('0x7')]('||');for(var _0x4734d0=0x0;_0x4734d0<_0x50eb9c[_0x040c('0x8')];_0x4734d0++){var _0x3c1deb=_0x50eb9c[_0x4734d0][_0x040c('0x7')](':=');var _0x43c51a=_0x3c1deb[0x0];var _0x57d913=_0x3c1deb[_0x040c('0x9')](0x1);_0x57d913['forEach'](function(_0x4b5fdf){var _0x3a7e8b=_0x4b5fdf[_0x040c('0x7')]('[')[_0x040c('0xa')]();var _0x355bcf=_0x4b5fdf[_0x040c('0xb')](/\[(.*?)\]/g);_0x355bcf[_0x040c('0xc')](function(_0xe91fe6){var _0x23ba0a=_0xe91fe6[_0x040c('0x7')]('[')[_0x040c('0xd')](function(_0x198172){return _0x198172['indexOf'](']')>-0x1;})[_0x040c('0xe')](function(_0x20ab62){return _0x20ab62[_0x040c('0x7')](']')[0x0];})[0x0];_0x21a369[_0x040c('0xf')][_0x040c('0x10')]({'field':_0x43c51a,'operator':_0x3a7e8b,'value':_0x23ba0a});});});}return _0x21a369;};exports['buildExpression']=function(_0x589d59,_0x10a0e5,_0x21bd2f){var _0x1d7017={};if(_0x10a0e5==='DATE'){if(_0x21bd2f[_0x040c('0x11')]===_0x040c('0x12')){_0x21bd2f['operator']='$between';_0x21bd2f[_0x040c('0x13')]+=','+_0x21bd2f[_0x040c('0x13')];}else if(_[_0x040c('0x14')]([_0x040c('0x15'),_0x040c('0x16')],_0x21bd2f['operator'])){_0x21bd2f[_0x040c('0x13')]=moment(_0x21bd2f[_0x040c('0x13')])[_0x040c('0x17')](0x1,'days')[_0x040c('0x18')](_0x040c('0x19'));}}if(_0x21bd2f[_0x040c('0x1a')]){_0x10a0e5=_0x21bd2f['castTo'];_0x1d7017['text']=_0x040c('0x1b')+_0x589d59+'.'+_0x21bd2f['field']+_0x040c('0x1c')+_0x21bd2f['castTo']+')\x20'+parseOperator(_0x21bd2f['operator']);}else{_0x1d7017['text']=_0x589d59+'.'+_0x21bd2f[_0x040c('0x1d')]+'\x20'+parseOperator(_0x21bd2f['operator']);}if(_[_0x040c('0x14')]([_0x040c('0x1e'),_0x040c('0x1f')],_0x21bd2f['operator']))_0x1d7017['text']='('+_0x1d7017[_0x040c('0x20')]+_0x040c('0x21')+_0x589d59+'.'+_0x21bd2f['field']+_0x040c('0x22');_0x1d7017['value']=parseValue(_0x10a0e5,_0x21bd2f[_0x040c('0x11')],_0x21bd2f[_0x040c('0x13')]);return _0x1d7017;};function parseOperator(_0x406388){var _0x3ff8d0;switch(_0x406388){case _0x040c('0x23'):_0x3ff8d0=_0x040c('0x24');break;case _0x040c('0x1f'):_0x3ff8d0=_0x040c('0x25');break;case _0x040c('0x12'):_0x3ff8d0=_0x040c('0x26');break;case _0x040c('0x1e'):_0x3ff8d0=_0x040c('0x27');break;case _0x040c('0x28'):case _0x040c('0x29'):case _0x040c('0x2a'):_0x3ff8d0=_0x040c('0x2b');break;case _0x040c('0x2c'):_0x3ff8d0=_0x040c('0x2d');break;case _0x040c('0x15'):_0x3ff8d0=_0x040c('0x2e');break;case _0x040c('0x16'):_0x3ff8d0=_0x040c('0x2f');break;case _0x040c('0x30'):_0x3ff8d0=_0x040c('0x31');break;case _0x040c('0x32'):_0x3ff8d0=_0x040c('0x33');break;}return _0x3ff8d0;}function parseValue(_0x5c54ad,_0x3af5cb,_0x21a7a0){var _0x38598a={'start':undefined,'end':undefined};switch(_0x3af5cb){case'$in':case _0x040c('0x1f'):_0x38598a[_0x040c('0x34')]=_0x21a7a0[_0x040c('0x7')](',');break;case _0x040c('0x28'):_0x38598a[_0x040c('0x34')]='%'+_0x21a7a0+'%';break;case _0x040c('0x29'):_0x38598a[_0x040c('0x34')]=_0x21a7a0+'%';break;case'$endsWith':_0x38598a[_0x040c('0x34')]='%'+_0x21a7a0;break;case'$between':var _0x541187=_0x21a7a0[_0x040c('0x7')](',');var _0x21a7a0=_0x541187[_0x040c('0xa')]();var _0x52b995=_0x541187['pop']();if(_0x5c54ad==='DATE'){_0x21a7a0=moment(_0x21a7a0)['utcOffset'](0x0,!![])[_0x040c('0x18')]();_0x52b995=moment(_0x52b995)[_0x040c('0x35')](0x0,!![])[_0x040c('0x17')](0x17,'hours')[_0x040c('0x17')](0x3b,'minutes')['add'](0x3b,_0x040c('0x36'))[_0x040c('0x18')]();}_0x38598a={'start':_0x21a7a0,'end':_0x52b995};break;default:_0x38598a[_0x040c('0x34')]=_0x21a7a0;break;}return _0x38598a;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 1dfe8da..6122cdd 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 _0xc818=['model','alias','fields','raw','split','filters','isEmpty','forOwn','find','type','$gte','format','YYYY-MM-DD','$lte','utc','isArray','limit','sort','indexOf','priority','col','unsigned','substr','DESC','cast','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','push','join','getOptions','query','$id','map','name','intersection','attributes','nolimit','offset','where','pick','filter','object','columns','value','VIRTUAL','lower','merge','options','include','includeAll','lodash','sequelize','moment','../../mysqldb','parse','keys','includes'];(function(_0x5bdf4d,_0x28351d){var _0x586487=function(_0x1ff8cd){while(--_0x1ff8cd){_0x5bdf4d['push'](_0x5bdf4d['shift']());}};_0x586487(++_0x28351d);}(_0xc818,0x1e3));var _0x8c81=function(_0x23fd1b,_0x469cab){_0x23fd1b=_0x23fd1b-0x0;var _0x304e83=_0xc818[_0x23fd1b];return _0x304e83;};'use strict';var _=require(_0x8c81('0x0'));var sequelize=require(_0x8c81('0x1'));var moment=require(_0x8c81('0x2'));var db=require(_0x8c81('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5e6597){var _0x461c5f=['ne'];try{var _0x7a8137=JSON[_0x8c81('0x4')](_0x5e6597);var _0x7e329f=Object[_0x8c81('0x5')](_0x7a8137)[0x0];return _0x461c5f[_0x8c81('0x6')](_0x7e329f);}catch(_0x377b23){return![];}}function getOperatorValue(_0x4a6e65){var _0x2c5966=JSON[_0x8c81('0x4')](_0x4a6e65);var _0x32cf31=Object[_0x8c81('0x5')](_0x2c5966)[0x0];var _0x501240=_0x2c5966[_0x32cf31];return{['$'+_0x32cf31]:_0x501240};}function parseIncludeModel(_0x1173cf){var _0x448af6=JSON[_0x8c81('0x4')](_0x1173cf);return{'model':db[_0x448af6[_0x8c81('0x7')]],'as':_0x448af6[_0x8c81('0x8')],'attributes':_0x448af6[_0x8c81('0x9')],'raw':_0x448af6[_0x8c81('0xa')]};}exports['fields']=function(_0x3de91f){var _0x37dbb4=null;if(_0x3de91f){_0x37dbb4=_0x3de91f[_0x8c81('0xb')](',');}return _0x37dbb4;};exports[_0x8c81('0xc')]=function(_0x5d7fb6,_0x5a2d9e){var _0x3cdd27={};if(!_[_0x8c81('0xd')](_0x5d7fb6)){_[_0x8c81('0xe')](_0x5d7fb6,function(_0x2a945d,_0x112be6){try{if(_0x5a2d9e){var _0x1b7b1b=_[_0x8c81('0xf')](_0x5a2d9e,{'name':_0x112be6})||{};if(hasSequelizeOperator(_0x2a945d)){_0x3cdd27[_0x112be6]=getOperatorValue(_0x2a945d);}else if(_0x1b7b1b[_0x8c81('0x10')]==='DATE'&&_['isPlainObject'](_0x2a945d)){var _0x1db769=JSON[_0x8c81('0x4')](_0x2a945d);var _0x238ce5={'$gte':moment(moment(_0x1db769[_0x8c81('0x11')])[_0x8c81('0x12')](_0x8c81('0x13')))['utc']()[_0x8c81('0x12')](),'$lte':moment(moment(_0x1db769[_0x8c81('0x14')])[_0x8c81('0x12')](_0x8c81('0x13')))[_0x8c81('0x15')]()['subtract'](0x1,'s')[_0x8c81('0x12')]()};_0x3cdd27[_0x112be6]=_0x238ce5;}else if(_0x1b7b1b['name']==='uniqueid'){_0x3cdd27[_0x112be6]=_0x2a945d;}else{_0x3cdd27[_0x112be6]=_['isArray'](_0x2a945d)?_0x2a945d:JSON[_0x8c81('0x4')](_0x2a945d);}}else{_0x3cdd27[_0x112be6]=_[_0x8c81('0x16')](_0x2a945d)?_0x2a945d:JSON[_0x8c81('0x4')](_0x2a945d);}}catch(_0x4f4014){_0x3cdd27[_0x112be6]=_0x2a945d[_0x8c81('0xb')](',');}});}return _0x3cdd27;};exports[_0x8c81('0x17')]=function(_0x348d79){_0x348d79=parseInt(_0x348d79,0xa);if(!_0x348d79||_0x348d79<0x0){_0x348d79=LIMIT_VALUE;}return _0x348d79;};exports['offset']=function(_0x261832){_0x261832=parseInt(_0x261832,0xa);if(!_0x261832||_0x261832<0x0){_0x261832=0x0;}return _0x261832;};exports[_0x8c81('0x18')]=function(_0x56ca80){var _0x35d61a,_0x31c4a2=null;if(_0x56ca80){_0x35d61a=_0x56ca80['split'](',');_0x31c4a2=_['map'](_0x35d61a,function(_0x39fc0e){if(_0x39fc0e[_0x8c81('0x19')]('-')===0x0){return[_0x39fc0e===_0x8c81('0x1a')?sequelize['cast'](sequelize[_0x8c81('0x1b')](_0x8c81('0x1a')),_0x8c81('0x1c')):_0x39fc0e[_0x8c81('0x1d')](0x1),_0x8c81('0x1e')];}else{return[_0x39fc0e===_0x8c81('0x1a')?sequelize[_0x8c81('0x1f')](sequelize[_0x8c81('0x1b')]('priority'),'unsigned'):_0x39fc0e,_0x8c81('0x20')];}});}return _0x31c4a2;};exports[_0x8c81('0x21')]=function(_0x2b9df6,_0x21bf77){if(_[_0x8c81('0xd')](_0x2b9df6)){return _0x2b9df6;}if(_[_0x8c81('0x16')](_0x2b9df6)){for(var _0x2e7ba2=0x0;_0x2e7ba2<_0x2b9df6[_0x8c81('0x22')];_0x2e7ba2+=0x1){_0x2b9df6[_0x2e7ba2]=this[_0x8c81('0x21')](_0x2b9df6[_0x2e7ba2],_0x21bf77);}return _0x2b9df6;}if(!_[_0x8c81('0x23')](_0x2b9df6)){return _0x2b9df6;}if(_[_0x8c81('0x24')](_0x21bf77)){_0x21bf77=[_0x21bf77];}if(!_[_0x8c81('0x16')](_0x21bf77)){return _0x2b9df6;}for(var _0x34dd6b=0x0;_0x34dd6b<_0x21bf77['length'];_0x34dd6b+=0x1){_[_0x8c81('0x25')](_0x2b9df6,_0x21bf77[_0x34dd6b]);}for(var _0xc9de87 in _0x2b9df6){if(_0x2b9df6[_0x8c81('0x26')](_0xc9de87)){_0x2b9df6[_0xc9de87]=this[_0x8c81('0x21')](_0x2b9df6[_0xc9de87],_0x21bf77);}}return _0x2b9df6;};exports[_0x8c81('0x27')]=function(_0x3b9527){return _0x3b9527[_0x8c81('0x28')](RegExp(_0x8c81('0x29')))?!![]:![];};exports[_0x8c81('0x2a')]=function(_0x54ca62){return _0x54ca62[_0x8c81('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x8c81('0x2b')]=function(_0x23c0be,_0x25654d){var _0x1d931f=[];var _0x551f0b=/[ `!@#$%^&*()_\-?~]/;var _0x1497f2=_0x25654d?_0x8c81('0x2c'):_0x8c81('0x2d');_0x23c0be[_0x8c81('0xb')](/[ ,]+/)[_0x8c81('0x2e')](function(_0x48622f){_0x48622f=_0x48622f['replace'](/([^:]")"+/g,'$1');_0x48622f='+'+_0x48622f+'*';var _0x1da1f1=_0x48622f[_0x8c81('0x28')](_0x551f0b);if(_0x1da1f1){_0x48622f='\x22'+_0x48622f+'\x22';}_0x1d931f[_0x8c81('0x2f')](_0x48622f);});_0x1497f2=_0x1497f2['replace'](_0x8c81('0x2d'),_0x1d931f[_0x8c81('0x30')]('\x20'));return _0x1497f2;};exports[_0x8c81('0x31')]=function(_0x1fce32,_0x56160f,_0x3addb9){var _0x32dfaa={},_0x543310={};if(_0x56160f[_0x8c81('0x32')]['$id']){_0x56160f['query']['id']=_0x56160f[_0x8c81('0x32')][_0x8c81('0x33')];delete _0x56160f[_0x8c81('0x32')][_0x8c81('0x33')];}_0x32dfaa['model']=_[_0x8c81('0x34')](_0x1fce32,_0x8c81('0x35'));_0x32dfaa[_0x8c81('0x32')]=_['keys'](_0x56160f['query']);_0x32dfaa[_0x8c81('0xc')]=_[_0x8c81('0x36')](_0x32dfaa[_0x8c81('0x7')],_0x32dfaa['query']);_0x543310[_0x8c81('0x37')]=_['intersection'](_0x32dfaa['model'],this['fields'](_0x56160f[_0x8c81('0x32')]['fields']));_0x543310[_0x8c81('0x37')]=_0x543310['attributes']['length']?_0x543310[_0x8c81('0x37')]:_0x32dfaa[_0x8c81('0x7')];if(!_0x56160f[_0x8c81('0x32')][_0x8c81('0x26')](_0x8c81('0x38'))){_0x543310[_0x8c81('0x17')]=this[_0x8c81('0x17')](_0x56160f['query'][_0x8c81('0x17')]);_0x543310[_0x8c81('0x39')]=this[_0x8c81('0x39')](_0x56160f[_0x8c81('0x32')][_0x8c81('0x39')]);}_0x543310['order']=this[_0x8c81('0x18')](_0x56160f[_0x8c81('0x32')][_0x8c81('0x18')]);_0x543310[_0x8c81('0x3a')]=this[_0x8c81('0xc')](_[_0x8c81('0x3b')](_0x56160f[_0x8c81('0x32')],_0x32dfaa[_0x8c81('0xc')]),_0x1fce32);if(_0x56160f[_0x8c81('0x32')][_0x8c81('0x3c')]){var _0xae952a=_0x1fce32;var _0xc7871=_0x56160f['query']['filter'];if(typeof _0xc7871===_0x8c81('0x3d')){_0xae952a=_[_0x8c81('0x3c')](_0x1fce32,function(_0x9ebabc){return _[_0x8c81('0x6')](_0xc7871[_0x8c81('0x3e')],_0x9ebabc[_0x8c81('0x35')]);});_0xc7871=_0xc7871[_0x8c81('0x3f')];}_0x543310['where']=_['merge'](_0x543310[_0x8c81('0x3a')],{'$or':_[_0x8c81('0x34')](_0xae952a,function(_0x3fe95f){if(_0x3fe95f[_0x8c81('0x10')]!==_0x8c81('0x40')){if(_0x3addb9){return sequelize[_0x8c81('0x3a')](sequelize['fn'](_0x8c81('0x41'),sequelize['col'](_0x3fe95f[_0x8c81('0x35')])),{'$like':sequelize['fn'](_0x8c81('0x41'),'%'+_0x56160f[_0x8c81('0x32')][_0x8c81('0x3c')]+'%')});}else{var _0x4d0093={};_0x4d0093[_0x3fe95f['name']]={'$like':'%'+_0x56160f[_0x8c81('0x32')][_0x8c81('0x3c')]+'%'};return _0x4d0093;}}})});}_0x543310=_[_0x8c81('0x42')]({},_0x543310,_0x56160f[_0x8c81('0x43')]);return _0x543310;};exports[_0x8c81('0x44')]=function(_0x26365f){var _0x192cc2=[];if(_0x26365f[_0x8c81('0x45')]){_0x192cc2[_0x8c81('0x2f')]({'all':!![]});}else if(_0x26365f[_0x8c81('0x44')]){if(Array[_0x8c81('0x16')](_0x26365f[_0x8c81('0x44')])){_0x192cc2=Object[_0x8c81('0x5')](_0x26365f[_0x8c81('0x44')])[_0x8c81('0x34')](function(_0x3ac081){return parseIncludeModel(_0x26365f[_0x8c81('0x44')][_0x3ac081]);});}else{var _0x25b569=parseIncludeModel(_0x26365f[_0x8c81('0x44')]);_0x192cc2[_0x8c81('0x2f')](_0x25b569);}}return _0x192cc2;}; \ No newline at end of file +var _0x238d=['offset','sort','priority','cast','col','unsigned','DESC','ASC','length','isObject','isString','omit','match','^[+]?[0-9]*$','isEmail','{EXPR}','replace','join','getOptions','query','$id','intersection','attributes','hasOwnProperty','nolimit','limit','order','where','pick','filter','columns','merge','map','type','lower','options','include','includeAll','push','lodash','sequelize','moment','../../mysqldb','parse','keys','includes','model','fields','raw','filters','isEmpty','forOwn','DATE','isPlainObject','$gte','format','utc','YYYY-MM-DD','subtract','name','uniqueid','isArray','split'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0x238d,0x123));var _0xd238=function(_0x81c69e,_0x57cc47){_0x81c69e=_0x81c69e-0x0;var _0x57c102=_0x238d[_0x81c69e];return _0x57c102;};'use strict';var _=require(_0xd238('0x0'));var sequelize=require(_0xd238('0x1'));var moment=require(_0xd238('0x2'));var db=require(_0xd238('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x530414){var _0x4f67=['ne'];try{var _0x4cd923=JSON[_0xd238('0x4')](_0x530414);var _0x581af6=Object[_0xd238('0x5')](_0x4cd923)[0x0];return _0x4f67[_0xd238('0x6')](_0x581af6);}catch(_0x128f2a){return![];}}function getOperatorValue(_0x4ec170){var _0x15de7b=JSON[_0xd238('0x4')](_0x4ec170);var _0x3757b1=Object[_0xd238('0x5')](_0x15de7b)[0x0];var _0x5ea23b=_0x15de7b[_0x3757b1];return{['$'+_0x3757b1]:_0x5ea23b};}function parseIncludeModel(_0x5b66ca){var _0x2e8eaf=JSON[_0xd238('0x4')](_0x5b66ca);return{'model':db[_0x2e8eaf[_0xd238('0x7')]],'as':_0x2e8eaf['alias'],'attributes':_0x2e8eaf[_0xd238('0x8')],'raw':_0x2e8eaf[_0xd238('0x9')]};}exports['fields']=function(_0x245f3b){var _0x70132f=null;if(_0x245f3b){_0x70132f=_0x245f3b['split'](',');}return _0x70132f;};exports[_0xd238('0xa')]=function(_0x23a4de,_0xcbf762){var _0x597183={};if(!_[_0xd238('0xb')](_0x23a4de)){_[_0xd238('0xc')](_0x23a4de,function(_0x520060,_0x3b35ea){try{if(_0xcbf762){var _0x42ec37=_['find'](_0xcbf762,{'name':_0x3b35ea})||{};if(hasSequelizeOperator(_0x520060)){_0x597183[_0x3b35ea]=getOperatorValue(_0x520060);}else if(_0x42ec37['type']===_0xd238('0xd')&&_[_0xd238('0xe')](_0x520060)){var _0x359064=JSON[_0xd238('0x4')](_0x520060);var _0x14a9d3={'$gte':moment(moment(_0x359064[_0xd238('0xf')])[_0xd238('0x10')]('YYYY-MM-DD'))[_0xd238('0x11')]()[_0xd238('0x10')](),'$lte':moment(moment(_0x359064['$lte'])[_0xd238('0x10')](_0xd238('0x12')))[_0xd238('0x11')]()[_0xd238('0x13')](0x1,'s')[_0xd238('0x10')]()};_0x597183[_0x3b35ea]=_0x14a9d3;}else if(_0x42ec37[_0xd238('0x14')]===_0xd238('0x15')){_0x597183[_0x3b35ea]=_0x520060;}else{_0x597183[_0x3b35ea]=_[_0xd238('0x16')](_0x520060)?_0x520060:JSON[_0xd238('0x4')](_0x520060);}}else{_0x597183[_0x3b35ea]=_[_0xd238('0x16')](_0x520060)?_0x520060:JSON[_0xd238('0x4')](_0x520060);}}catch(_0xb5dd23){_0x597183[_0x3b35ea]=_0x520060[_0xd238('0x17')](',');}});}return _0x597183;};exports['limit']=function(_0xd905e2){_0xd905e2=parseInt(_0xd905e2,0xa);if(!_0xd905e2||_0xd905e2<0x0){_0xd905e2=LIMIT_VALUE;}return _0xd905e2;};exports[_0xd238('0x18')]=function(_0x1a4478){_0x1a4478=parseInt(_0x1a4478,0xa);if(!_0x1a4478||_0x1a4478<0x0){_0x1a4478=0x0;}return _0x1a4478;};exports[_0xd238('0x19')]=function(_0x155b71){var _0xd3fe87,_0x589036=null;if(_0x155b71){_0xd3fe87=_0x155b71[_0xd238('0x17')](',');_0x589036=_['map'](_0xd3fe87,function(_0x16429d){if(_0x16429d['indexOf']('-')===0x0){return[_0x16429d===_0xd238('0x1a')?sequelize[_0xd238('0x1b')](sequelize[_0xd238('0x1c')](_0xd238('0x1a')),_0xd238('0x1d')):_0x16429d['substr'](0x1),_0xd238('0x1e')];}else{return[_0x16429d===_0xd238('0x1a')?sequelize[_0xd238('0x1b')](sequelize['col'](_0xd238('0x1a')),'unsigned'):_0x16429d,_0xd238('0x1f')];}});}return _0x589036;};exports['omit']=function(_0x2f3748,_0x5bb122){if(_['isEmpty'](_0x2f3748)){return _0x2f3748;}if(_[_0xd238('0x16')](_0x2f3748)){for(var _0x58d39d=0x0;_0x58d39d<_0x2f3748[_0xd238('0x20')];_0x58d39d+=0x1){_0x2f3748[_0x58d39d]=this['omit'](_0x2f3748[_0x58d39d],_0x5bb122);}return _0x2f3748;}if(!_[_0xd238('0x21')](_0x2f3748)){return _0x2f3748;}if(_[_0xd238('0x22')](_0x5bb122)){_0x5bb122=[_0x5bb122];}if(!_[_0xd238('0x16')](_0x5bb122)){return _0x2f3748;}for(var _0x3465a9=0x0;_0x3465a9<_0x5bb122['length'];_0x3465a9+=0x1){_['unset'](_0x2f3748,_0x5bb122[_0x3465a9]);}for(var _0x358961 in _0x2f3748){if(_0x2f3748['hasOwnProperty'](_0x358961)){_0x2f3748[_0x358961]=this[_0xd238('0x23')](_0x2f3748[_0x358961],_0x5bb122);}}return _0x2f3748;};exports['isNumeric']=function(_0x189fbd){return _0x189fbd[_0xd238('0x24')](RegExp(_0xd238('0x25')))?!![]:![];};exports[_0xd238('0x26')]=function(_0x453cf9){return _0x453cf9[_0xd238('0x24')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x4f4dd4,_0x1c68ea){var _0x345335=[];var _0x3391cb=/[ `!@#$%^&*()_\-?~]/;var _0x21d692=_0x1c68ea?'\x22{EXPR}\x22':_0xd238('0x27');_0x4f4dd4[_0xd238('0x17')](/[ ,]+/)['forEach'](function(_0x1a5d69){_0x1a5d69=_0x1a5d69[_0xd238('0x28')](/([^:]")"+/g,'$1');_0x1a5d69='+'+_0x1a5d69+'*';var _0x6b5c8b=_0x1a5d69['match'](_0x3391cb);if(_0x6b5c8b){_0x1a5d69='\x22'+_0x1a5d69+'\x22';}_0x345335['push'](_0x1a5d69);});_0x21d692=_0x21d692[_0xd238('0x28')](_0xd238('0x27'),_0x345335[_0xd238('0x29')]('\x20'));return _0x21d692;};exports[_0xd238('0x2a')]=function(_0x30c8a0,_0xbe8589,_0x18a2d2){var _0x2bf834={},_0x1b8e74={};if(_0xbe8589[_0xd238('0x2b')][_0xd238('0x2c')]){_0xbe8589[_0xd238('0x2b')]['id']=_0xbe8589[_0xd238('0x2b')][_0xd238('0x2c')];delete _0xbe8589[_0xd238('0x2b')][_0xd238('0x2c')];}_0x2bf834[_0xd238('0x7')]=_['map'](_0x30c8a0,_0xd238('0x14'));_0x2bf834[_0xd238('0x2b')]=_[_0xd238('0x5')](_0xbe8589[_0xd238('0x2b')]);_0x2bf834[_0xd238('0xa')]=_[_0xd238('0x2d')](_0x2bf834[_0xd238('0x7')],_0x2bf834['query']);_0x1b8e74[_0xd238('0x2e')]=_[_0xd238('0x2d')](_0x2bf834[_0xd238('0x7')],this['fields'](_0xbe8589[_0xd238('0x2b')][_0xd238('0x8')]));_0x1b8e74[_0xd238('0x2e')]=_0x1b8e74[_0xd238('0x2e')][_0xd238('0x20')]?_0x1b8e74['attributes']:_0x2bf834[_0xd238('0x7')];if(!_0xbe8589[_0xd238('0x2b')][_0xd238('0x2f')](_0xd238('0x30'))){_0x1b8e74['limit']=this[_0xd238('0x31')](_0xbe8589[_0xd238('0x2b')]['limit']);_0x1b8e74[_0xd238('0x18')]=this[_0xd238('0x18')](_0xbe8589[_0xd238('0x2b')][_0xd238('0x18')]);}_0x1b8e74[_0xd238('0x32')]=this[_0xd238('0x19')](_0xbe8589[_0xd238('0x2b')][_0xd238('0x19')]);_0x1b8e74[_0xd238('0x33')]=this[_0xd238('0xa')](_[_0xd238('0x34')](_0xbe8589[_0xd238('0x2b')],_0x2bf834['filters']),_0x30c8a0);if(_0xbe8589[_0xd238('0x2b')][_0xd238('0x35')]){var _0x49a641=_0x30c8a0;var _0x172434=_0xbe8589['query'][_0xd238('0x35')];if(typeof _0x172434==='object'){_0x49a641=_[_0xd238('0x35')](_0x30c8a0,function(_0x49cbf8){return _['includes'](_0x172434[_0xd238('0x36')],_0x49cbf8['name']);});_0x172434=_0x172434['value'];}_0x1b8e74[_0xd238('0x33')]=_[_0xd238('0x37')](_0x1b8e74[_0xd238('0x33')],{'$or':_[_0xd238('0x38')](_0x49a641,function(_0x369f43){if(_0x369f43[_0xd238('0x39')]!=='VIRTUAL'){if(_0x18a2d2){return sequelize[_0xd238('0x33')](sequelize['fn'](_0xd238('0x3a'),sequelize[_0xd238('0x1c')](_0x369f43['name'])),{'$like':sequelize['fn'](_0xd238('0x3a'),'%'+_0xbe8589[_0xd238('0x2b')][_0xd238('0x35')]+'%')});}else{var _0x580c21={};_0x580c21[_0x369f43['name']]={'$like':'%'+_0xbe8589[_0xd238('0x2b')][_0xd238('0x35')]+'%'};return _0x580c21;}}})});}_0x1b8e74=_['merge']({},_0x1b8e74,_0xbe8589[_0xd238('0x3b')]);return _0x1b8e74;};exports[_0xd238('0x3c')]=function(_0xbd5ae0){var _0x3ad6f7=[];if(_0xbd5ae0[_0xd238('0x3d')]){_0x3ad6f7[_0xd238('0x3e')]({'all':!![]});}else if(_0xbd5ae0[_0xd238('0x3c')]){if(Array[_0xd238('0x16')](_0xbd5ae0[_0xd238('0x3c')])){_0x3ad6f7=Object['keys'](_0xbd5ae0[_0xd238('0x3c')])[_0xd238('0x38')](function(_0x4674d2){return parseIncludeModel(_0xbd5ae0[_0xd238('0x3c')][_0x4674d2]);});}else{var _0x4881d1=parseIncludeModel(_0xbd5ae0[_0xd238('0x3c')]);_0x3ad6f7[_0xd238('0x3e')](_0x4881d1);}}return _0x3ad6f7;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index e38cf7f..07fa395 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 _0x9957=['sort','toLowerCase','userpic','online','lastPauseAt','address','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','pick','value','filterAgentAttributes','name','role','lastLoginAt','whatsappPause','mailStatus','chatStatusTime','openchannelStatusTime','whatsappStatusTime','chatCapacity','mailCapacity','whatsappCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','every','length','idle','unknown','unavailable','isNil','voiceStatus','pause','chatStatus','faxStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','busy','getAgentStatus','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','getAgentIdsByQueues','filter','getAgentIdsByStatus','includes','User','findAll','fullname','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var db=require(_0x7995('0x2'))['db'];var amiClient=jayson[_0x7995('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0x7995('0x3')][_0x7995('0x4')]({'port':0x232c});function isAgentPaused(_0x1902b4,_0x462a03){var _0x576d89=[_0x1902b4[_0x7995('0x5')],_0x1902b4[_0x7995('0x6')],_0x1902b4[_0x7995('0x7')],_0x1902b4[_0x7995('0x8')],_0x1902b4[_0x7995('0x9')],_0x1902b4[_0x7995('0xa')],_0x1902b4['whatsappPause']];if(!_0x462a03)return _[_0x7995('0xb')](_0x576d89);var _0x1cad37=_['filter'](_0x576d89);return _0x1cad37[_0x7995('0xc')]>0x0&&_0x1cad37[_0x7995('0xc')]<_0x576d89[_0x7995('0xc')]?!![]:![];}function isIdle(_0x35b5fe){return _0x35b5fe===_0x7995('0xd')||_0x35b5fe===_0x7995('0xe')||_0x35b5fe===_0x7995('0xf')||_0x35b5fe==='ringing'||_[_0x7995('0x10')](_0x35b5fe);}function isAgentIdle(_0x41c652){if(_0x41c652['voiceStatus']!==_0x7995('0xd')&&_0x41c652[_0x7995('0xa')]){_0x41c652[_0x7995('0x11')]=_0x7995('0x12');return![];}return _[_0x7995('0xb')]([_0x41c652[_0x7995('0x13')],_0x41c652[_0x7995('0x14')],_0x41c652['mailStatus'],_0x41c652['openchannelStatus'],_0x41c652[_0x7995('0x15')],_0x41c652[_0x7995('0x11')],_0x41c652[_0x7995('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x7995('0x17')](_0x7995('0x18'),{})[_0x7995('0x19')](function(_0x2202ce){if(_0x2202ce[_0x7995('0x1a')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x2eeacc=_0x2202ce['result'];return routingClient[_0x7995('0x17')](_0x7995('0x18'),{})[_0x7995('0x19')](function(_0x291317){if(_0x291317[_0x7995('0x1a')]){throw new Error(_0x7995('0x1b'));}var _0x4faa60=_0x291317['result'];return _[_0x7995('0x1c')]({},_0x2eeacc,_0x4faa60);});})['catch'](function(_0x555f74){throw _0x555f74;});}exports[_0x7995('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x3d463e){var _0x4cbe10=_0x7995('0xe');if(isAgentPaused(_0x3d463e))_0x4cbe10='pause';else if(isAgentPaused(_0x3d463e,!![]))_0x4cbe10='*pause';else if(isAgentIdle(_0x3d463e))_0x4cbe10=_0x7995('0xd');else _0x4cbe10=_0x7995('0x1e');return _0x4cbe10;}exports[_0x7995('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x1a8568,_0x460924){var _0x1c278a=_['isArray'](_0x1a8568)?_0x1a8568:[_0x1a8568];var _0x32a09a=_[_0x7995('0x20')](_0x460924)+_0x7995('0x21');var _0x285437=_[_0x7995('0x22')](_0x1c278a,function(_0x13bc35){return db[_0x32a09a][_0x7995('0x23')]({'where':{'id':_0x13bc35}})[_0x7995('0x19')](function(_0x59405a){if(!_0x59405a)return[];return _0x59405a[_0x7995('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x7995('0x25')](_0x285437)[_0x7995('0x19')](function(_0x268ce7){var _0x3a3fcf=_(_0x268ce7)[_0x7995('0x26')]()['map']('id')[_0x7995('0x27')]()['value']();return _0x3a3fcf;});}exports[_0x7995('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x49bc7e,_0xf16cc2,_0x132a42){try{if(_0xf16cc2[_0x7995('0xc')]>0x0){_0x49bc7e=_0x49bc7e['filter'](function(_0x9b2a15){return _0xf16cc2['includes'](_0x9b2a15['id']);});}var _0x456a28=_0x49bc7e[_0x7995('0x29')](function(_0x4253e5){var _0x574574='busy';if(isAgentIdle(_0x4253e5)){_0x574574='idle';}return _0x574574===_0x132a42;});return _[_0x7995('0x22')](_0x456a28,'id');}catch(_0xe6b0b3){throw _0xe6b0b3;}}exports[_0x7995('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2b874d,_0x2e3493,_0x1ca460){return Promise['resolve']()['then'](function(){if(_0x2e3493[_0x7995('0xc')]>0x0){_0x2b874d=_0x2b874d['filter'](function(_0x553671){return _0x2e3493[_0x7995('0x2b')](_0x553671['id']);});}return _0x2b874d;})[_0x7995('0x19')](function(){return db[_0x7995('0x2c')][_0x7995('0x2d')]({'attributes':['id','name',_0x7995('0x2e'),_0x7995('0x5'),'faxPause','mailPause','openchannelPause',_0x7995('0x9'),_0x7995('0xa'),'whatsappPause',_0x7995('0x2f')],'where':{'id':{'$in':_['map'](_0x2b874d,'id')}},'raw':!![]});})[_0x7995('0x19')](function(_0x1cb058){return _0x1cb058[_0x7995('0x22')](function(_0x5014d2){var _0x52d76d=_[_0x7995('0x30')](_0x2b874d,['id',_0x5014d2['id']]);var _0x5e67fe=filterAgentAttributes(_0x52d76d);_['merge'](_0x5014d2,_0x5e67fe);_0x5014d2[_0x7995('0x31')]=getAgentStatus(_0x5014d2);return _0x5014d2;});})[_0x7995('0x19')](function(_0x5212ff){var _0x1baa15=sortAgentsByStatus(_0x5212ff,_0x1ca460);return _[_0x7995('0x22')](_0x1baa15,'id');})[_0x7995('0x32')](function(_0x18667c){throw _0x18667c;});}exports[_0x7995('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x53002a){var _0x2d4285={'fields':[],'order':null};var _0x242713=_0x53002a[_0x7995('0x34')](',');_0x2d4285[_0x7995('0x35')]=_['filter'](_0x242713,function(_0x2be2c0){if(!_0x2be2c0[_0x7995('0x2b')](_0x7995('0x31'))){return!![];}_0x2d4285[_0x7995('0x36')]=_[_0x7995('0x37')](_0x2be2c0,'-')?_0x7995('0x38'):'ASC';return![];});return _0x2d4285;}exports[_0x7995('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x3be298){if(!_0x3be298){_0x3be298=_0x7995('0x3a');}if(_0x3be298[_0x7995('0x2b')](_0x7995('0x2e'))&&!_0x3be298[_0x7995('0x2b')](_0x7995('0x3b'))){var _0x270c0e=_0x3be298[_0x7995('0x3c')](0x0,_0x3be298[_0x7995('0x3d')](_0x7995('0x2e')));_0x3be298+=','+_0x270c0e+_0x7995('0x3b');}return _0x3be298;}exports[_0x7995('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x53cda2,_0x50a98e){var _0x334dff=_0x53cda2[_0x7995('0x3f')](function(_0x58523e,_0x4b0855){if(_0x58523e[_0x7995('0x31')]===_0x4b0855['globalStatus']){if(_0x58523e['globalStatus']===_0x7995('0x12')){if(_0x50a98e===_0x7995('0x38')){return(_0x58523e[_0x7995('0x2f')]||'')<(_0x4b0855['pauseType']||'')||_0x58523e[_0x7995('0x2e')]['toLowerCase']()>_0x4b0855[_0x7995('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return(_0x58523e['pauseType']||'')<(_0x4b0855[_0x7995('0x2f')]||'')||_0x58523e[_0x7995('0x2e')][_0x7995('0x40')]()>_0x4b0855[_0x7995('0x2e')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x50a98e===_0x7995('0x38')){return _0x58523e[_0x7995('0x2e')][_0x7995('0x40')]()<_0x4b0855[_0x7995('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return _0x58523e['fullname'][_0x7995('0x40')]()<_0x4b0855['fullname'][_0x7995('0x40')]()?-0x1:0x1;}}}else{if(_0x50a98e==='DESC'){return _0x58523e[_0x7995('0x31')]<_0x4b0855['globalStatus']?0x1:-0x1;}else{return _0x58523e[_0x7995('0x31')]<_0x4b0855[_0x7995('0x31')]?-0x1:0x1;}}});return _0x334dff;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x3e9e62){var _0x336ff2=[_0x7995('0x41'),_0x7995('0x42'),'lastLoginAt',_0x7995('0x43'),_0x7995('0x2f'),_0x7995('0x43'),'internal',_0x7995('0x44'),_0x7995('0x5'),_0x7995('0x8'),_0x7995('0x7'),_0x7995('0x9'),'whatsappPause',_0x7995('0x6'),_0x7995('0xa'),'chatCapacity',_0x7995('0x45'),'mailCapacity',_0x7995('0x46'),_0x7995('0x47'),_0x7995('0x48'),_0x7995('0x49'),_0x7995('0x4a'),_0x7995('0x4b'),_0x7995('0x4c'),'whatsappCurrentCapacity',_0x7995('0x4d'),_0x7995('0x13'),_0x7995('0x4e'),'mailStatus',_0x7995('0x15'),_0x7995('0x16'),_0x7995('0x14'),'voiceStatus','chatStatusTime','openchannelStatusTime',_0x7995('0x4f'),_0x7995('0x50'),'whatsappStatusTime',_0x7995('0x51'),_0x7995('0x52'),_0x7995('0x53'),_0x7995('0x54'),_0x7995('0x55'),'phoneBarEnableScreenRecordingByAgent',_0x7995('0x56'),'routealias'];var _0x14fe7f=[_0x7995('0x5'),_0x7995('0x8'),'mailPause','smsPause','whatsappPause','faxPause',_0x7995('0xa'),_0x7995('0x42')];var _0x1a861c=_(_0x3e9e62)[_0x7995('0x57')](_0x14fe7f)[_0x7995('0x58')](_0x336ff2)[_0x7995('0x59')]();return _0x1a861c;}exports[_0x7995('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x7995('0x5b'),_0x7995('0x2e'),_0x7995('0x5c'),_0x7995('0x3b'),_0x7995('0x42'),_0x7995('0x31'),_0x7995('0x41'),_0x7995('0x5d'),_0x7995('0x2f'),_0x7995('0x43'),_0x7995('0x6'),_0x7995('0x5'),'mailPause',_0x7995('0x8'),_0x7995('0x9'),_0x7995('0xa'),_0x7995('0x5e'),'chatStatus','faxStatus',_0x7995('0x5f'),_0x7995('0x4e'),_0x7995('0x15'),_0x7995('0x11'),'whatsappStatus',_0x7995('0x60'),_0x7995('0x51'),_0x7995('0x4f'),_0x7995('0x61'),'smsStatusTime','voiceStatusTime',_0x7995('0x62'),_0x7995('0x63'),_0x7995('0x48'),_0x7995('0x64'),_0x7995('0x45'),_0x7995('0x46'),_0x7995('0x47'),_0x7995('0x49'),_0x7995('0x4d'),'mailCurrentCapacity',_0x7995('0x4a'),_0x7995('0x4c'),_0x7995('0x65'),_0x7995('0x66'),'phoneBarEnableAutomaticScreenRecording','destconnectedlinenum',_0x7995('0x67'),_0x7995('0x53'),'routealias',_0x7995('0x55')];}exports[_0x7995('0x68')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x326f=['faxStatusTime','voiceStatusTime','queue','phoneBarEnableScreenRecordingByAgent','routealias','omit','pick','filterAgentAttributes','role','chatStatusTime','whatsappStatusTime','openchannelCurrentCapacity','phoneBarEnableAutomaticScreenRecording','destconnectedlinenum','onhold','screenrecording','getRealtimeAgentsQueryFields','lodash','client','http','chatPause','faxPause','mailPause','smsPause','voicePause','whatsappPause','every','length','idle','unknown','ringing','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','getRealtimeAgents','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','all','flatten','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','findAll','name','fullname','openchannelPause','pauseType','find','merge','getSortedAgentsIdsByStatus','split','filter','globalStatus','startsWith','DESC','ASC','getUpdatedSortOptions','validateSortParameter','toLowerCase','userpic','lastLoginAt','lastPauseAt','internal','address','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','smsStatus','whatsappStatus','openchannelStatusTime','mailStatusTime','smsStatusTime'];(function(_0x57770c,_0x419139){var _0x599abd=function(_0x1409c6){while(--_0x1409c6){_0x57770c['push'](_0x57770c['shift']());}};_0x599abd(++_0x419139);}(_0x326f,0xd1));var _0xf326=function(_0x2a280e,_0x416de2){_0x2a280e=_0x2a280e-0x0;var _0x3780e3=_0x326f[_0x2a280e];return _0x3780e3;};'use strict';var _=require(_0xf326('0x0'));var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xf326('0x1')][_0xf326('0x2')]({'port':0x232a});var routingClient=jayson[_0xf326('0x1')][_0xf326('0x2')]({'port':0x232c});function isAgentPaused(_0x27e8d7,_0x120a26){var _0x9445c6=[_0x27e8d7[_0xf326('0x3')],_0x27e8d7[_0xf326('0x4')],_0x27e8d7[_0xf326('0x5')],_0x27e8d7['openchannelPause'],_0x27e8d7[_0xf326('0x6')],_0x27e8d7[_0xf326('0x7')],_0x27e8d7[_0xf326('0x8')]];if(!_0x120a26)return _[_0xf326('0x9')](_0x9445c6);var _0x515bfa=_['filter'](_0x9445c6);return _0x515bfa['length']>0x0&&_0x515bfa[_0xf326('0xa')]<_0x9445c6[_0xf326('0xa')]?!![]:![];}function isIdle(_0x163416){return _0x163416===_0xf326('0xb')||_0x163416===_0xf326('0xc')||_0x163416==='unavailable'||_0x163416===_0xf326('0xd')||_['isNil'](_0x163416);}function isAgentIdle(_0x1cf441){if(_0x1cf441['voiceStatus']!==_0xf326('0xb')&&_0x1cf441['voicePause']){_0x1cf441[_0xf326('0xe')]=_0xf326('0xf');return![];}return _['every']([_0x1cf441[_0xf326('0x10')],_0x1cf441[_0xf326('0x11')],_0x1cf441[_0xf326('0x12')],_0x1cf441[_0xf326('0x13')],_0x1cf441['smsStatus'],_0x1cf441[_0xf326('0xe')],_0x1cf441['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xf326('0x14'),{})[_0xf326('0x15')](function(_0x1f2e5a){if(_0x1f2e5a[_0xf326('0x16')]){throw new Error(_0xf326('0x17'));}var _0x287a2a=_0x1f2e5a[_0xf326('0x18')];return routingClient[_0xf326('0x19')]('Agents',{})[_0xf326('0x15')](function(_0x453100){if(_0x453100[_0xf326('0x16')]){throw new Error(_0xf326('0x1a'));}var _0xcef2b5=_0x453100[_0xf326('0x18')];return _['merge']({},_0x287a2a,_0xcef2b5);});})['catch'](function(_0x56ad41){throw _0x56ad41;});}exports[_0xf326('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x289f4b){var _0x484cbe='unknown';if(isAgentPaused(_0x289f4b))_0x484cbe=_0xf326('0xf');else if(isAgentPaused(_0x289f4b,!![]))_0x484cbe='*pause';else if(isAgentIdle(_0x289f4b))_0x484cbe='idle';else _0x484cbe=_0xf326('0x1c');return _0x484cbe;}exports[_0xf326('0x1d')]=getAgentStatus;function getAgentIdsByQueues(_0x549b46,_0x5aa184){var _0x19b8ba=_[_0xf326('0x1e')](_0x549b46)?_0x549b46:[_0x549b46];var _0x5f21a2=_[_0xf326('0x1f')](_0x5aa184)+_0xf326('0x20');var _0x43c53e=_[_0xf326('0x21')](_0x19b8ba,function(_0x17c157){return db[_0x5f21a2][_0xf326('0x22')]({'where':{'id':_0x17c157}})['then'](function(_0x55b9f4){if(!_0x55b9f4)return[];return _0x55b9f4['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xf326('0x23')](_0x43c53e)[_0xf326('0x15')](function(_0x2cd45a){var _0x1ff2b5=_(_0x2cd45a)[_0xf326('0x24')]()[_0xf326('0x21')]('id')['uniq']()[_0xf326('0x25')]();return _0x1ff2b5;});}exports[_0xf326('0x26')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x212d5d,_0x581531,_0x1617d2){try{if(_0x581531['length']>0x0){_0x212d5d=_0x212d5d['filter'](function(_0x6a8e89){return _0x581531[_0xf326('0x27')](_0x6a8e89['id']);});}var _0x2fa28e=_0x212d5d['filter'](function(_0xc115d9){var _0x292500='busy';if(isAgentIdle(_0xc115d9)){_0x292500=_0xf326('0xb');}return _0x292500===_0x1617d2;});return _[_0xf326('0x21')](_0x2fa28e,'id');}catch(_0xd77aba){throw _0xd77aba;}}exports[_0xf326('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xa80156,_0x269be9,_0x161143){return Promise[_0xf326('0x29')]()[_0xf326('0x15')](function(){if(_0x269be9[_0xf326('0xa')]>0x0){_0xa80156=_0xa80156['filter'](function(_0x1035ed){return _0x269be9[_0xf326('0x27')](_0x1035ed['id']);});}return _0xa80156;})[_0xf326('0x15')](function(){return db['User'][_0xf326('0x2a')]({'attributes':['id',_0xf326('0x2b'),_0xf326('0x2c'),'chatPause','faxPause',_0xf326('0x5'),_0xf326('0x2d'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x2e')],'where':{'id':{'$in':_[_0xf326('0x21')](_0xa80156,'id')}},'raw':!![]});})[_0xf326('0x15')](function(_0x580374){return _0x580374[_0xf326('0x21')](function(_0x1981bc){var _0x51207a=_[_0xf326('0x2f')](_0xa80156,['id',_0x1981bc['id']]);var _0x4e5d7c=filterAgentAttributes(_0x51207a);_[_0xf326('0x30')](_0x1981bc,_0x4e5d7c);_0x1981bc['globalStatus']=getAgentStatus(_0x1981bc);return _0x1981bc;});})['then'](function(_0xadb020){var _0x4d8eac=sortAgentsByStatus(_0xadb020,_0x161143);return _[_0xf326('0x21')](_0x4d8eac,'id');})['catch'](function(_0x310dbb){throw _0x310dbb;});}exports[_0xf326('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x2750ae){var _0x529cbb={'fields':[],'order':null};var _0x3dcc7e=_0x2750ae[_0xf326('0x32')](',');_0x529cbb['fields']=_[_0xf326('0x33')](_0x3dcc7e,function(_0xf64dd0){if(!_0xf64dd0[_0xf326('0x27')](_0xf326('0x34'))){return!![];}_0x529cbb['order']=_[_0xf326('0x35')](_0xf64dd0,'-')?_0xf326('0x36'):_0xf326('0x37');return![];});return _0x529cbb;}exports[_0xf326('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x1d88ed){if(!_0x1d88ed){_0x1d88ed='fullname,internal';}if(_0x1d88ed[_0xf326('0x27')](_0xf326('0x2c'))&&!_0x1d88ed['includes']('internal')){var _0x40564e=_0x1d88ed['substring'](0x0,_0x1d88ed['indexOf'](_0xf326('0x2c')));_0x1d88ed+=','+_0x40564e+'internal';}return _0x1d88ed;}exports[_0xf326('0x39')]=validateSortParameter;function sortAgentsByStatus(_0x37a95b,_0x2c1e7f){var _0x39611e=_0x37a95b['sort'](function(_0x9dda89,_0x45d344){if(_0x9dda89[_0xf326('0x34')]===_0x45d344[_0xf326('0x34')]){if(_0x9dda89[_0xf326('0x34')]===_0xf326('0xf')){if(_0x2c1e7f===_0xf326('0x36')){return(_0x9dda89[_0xf326('0x2e')]||'')<(_0x45d344[_0xf326('0x2e')]||'')||_0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()>_0x45d344[_0xf326('0x2c')]['toLowerCase']()?0x1:-0x1;}else{return(_0x9dda89[_0xf326('0x2e')]||'')<(_0x45d344[_0xf326('0x2e')]||'')||_0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()>_0x45d344[_0xf326('0x2c')][_0xf326('0x3a')]()?-0x1:0x1;}}else{if(_0x2c1e7f==='DESC'){return _0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()<_0x45d344['fullname'][_0xf326('0x3a')]()?0x1:-0x1;}else{return _0x9dda89[_0xf326('0x2c')][_0xf326('0x3a')]()<_0x45d344[_0xf326('0x2c')][_0xf326('0x3a')]()?-0x1:0x1;}}}else{if(_0x2c1e7f==='DESC'){return _0x9dda89['globalStatus']<_0x45d344[_0xf326('0x34')]?0x1:-0x1;}else{return _0x9dda89[_0xf326('0x34')]<_0x45d344['globalStatus']?-0x1:0x1;}}});return _0x39611e;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x8e318d){var _0x269e89=[_0xf326('0x3b'),'online',_0xf326('0x3c'),_0xf326('0x3d'),_0xf326('0x2e'),_0xf326('0x3d'),_0xf326('0x3e'),_0xf326('0x3f'),_0xf326('0x3'),_0xf326('0x2d'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x8'),_0xf326('0x4'),_0xf326('0x7'),_0xf326('0x40'),_0xf326('0x41'),'mailCapacity',_0xf326('0x42'),_0xf326('0x43'),_0xf326('0x44'),_0xf326('0x45'),'openchannelCurrentCapacity',_0xf326('0x46'),_0xf326('0x47'),_0xf326('0x48'),_0xf326('0x49'),'chatStatus',_0xf326('0x13'),_0xf326('0x12'),_0xf326('0x4a'),_0xf326('0x4b'),_0xf326('0x11'),'voiceStatus','chatStatusTime',_0xf326('0x4c'),_0xf326('0x4d'),_0xf326('0x4e'),'whatsappStatusTime',_0xf326('0x4f'),_0xf326('0x50'),_0xf326('0x51'),'destconnectedlinenum','screenrecording',_0xf326('0x52'),'phoneBarEnableAutomaticScreenRecording',_0xf326('0x53')];var _0x554277=[_0xf326('0x3'),_0xf326('0x2d'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x8'),_0xf326('0x4'),_0xf326('0x7'),'online'];var _0xcdaf3f=_(_0x8e318d)[_0xf326('0x54')](_0x554277)[_0xf326('0x55')](_0x269e89)['value']();return _0xcdaf3f;}exports[_0xf326('0x56')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xf326('0x2b'),_0xf326('0x2c'),_0xf326('0x57'),_0xf326('0x3e'),'online',_0xf326('0x34'),_0xf326('0x3b'),_0xf326('0x3c'),_0xf326('0x2e'),'lastPauseAt',_0xf326('0x4'),_0xf326('0x3'),_0xf326('0x5'),_0xf326('0x2d'),'smsPause','voicePause',_0xf326('0x8'),_0xf326('0x10'),'faxStatus',_0xf326('0x12'),_0xf326('0x13'),_0xf326('0x4a'),_0xf326('0xe'),'whatsappStatus',_0xf326('0x58'),'faxStatusTime','mailStatusTime',_0xf326('0x4c'),'smsStatusTime',_0xf326('0x50'),_0xf326('0x59'),_0xf326('0x40'),'faxCapacity','mailCapacity',_0xf326('0x41'),_0xf326('0x42'),_0xf326('0x43'),'chatCurrentCapacity',_0xf326('0x49'),'mailCurrentCapacity',_0xf326('0x5a'),_0xf326('0x47'),_0xf326('0x48'),_0xf326('0x52'),_0xf326('0x5b'),_0xf326('0x5c'),_0xf326('0x5d'),_0xf326('0x51'),_0xf326('0x53'),_0xf326('0x5e')];}exports[_0xf326('0x5f')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 9809778..87e2001 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 _0x6f73=['message','dialActive','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','concat','outbound','map','find','merge','pick','initializeQueues','lodash','util','client','http','available','loggedIn','paused','waiting','busy','invalid','loggedInDb','ringing','ringInUse','talking','unknown','pTalking','originated'];(function(_0x20a6c5,_0x4aa7ca){var _0x5968e8=function(_0x1c981c){while(--_0x1c981c){_0x20a6c5['push'](_0x20a6c5['shift']());}};_0x5968e8(++_0x4aa7ca);}(_0x6f73,0x109));var _0x36f7=function(_0x29f9d4,_0x3724e4){_0x29f9d4=_0x29f9d4-0x0;var _0x45f9b6=_0x6f73[_0x29f9d4];return _0x45f9b6;};'use strict';var _=require(_0x36f7('0x0'));var jayson=require('jayson/promise');var util=require(_0x36f7('0x1'));var amiClient=jayson[_0x36f7('0x2')][_0x36f7('0x3')]({'port':0x232a});var routingClient=jayson[_0x36f7('0x2')][_0x36f7('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x36f7('0x4'),_0x36f7('0x5'),_0x36f7('0x6'),_0x36f7('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x36f7('0x8'),'inUse',_0x36f7('0x9'),_0x36f7('0xa'),'notInUse','onHold',_0x36f7('0xb'),_0x36f7('0xc'),_0x36f7('0xd'),'unavailable',_0x36f7('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x36f7('0xf'),_0x36f7('0x10'),_0x36f7('0x11'),'statusMessage',_0x36f7('0x12'),'dialMethod',_0x36f7('0x13'),'startPredictive',_0x36f7('0x14'),_0x36f7('0x15'),_0x36f7('0x16'),'erlangAbandonmentRate',_0x36f7('0x17'),_0x36f7('0x18'),_0x36f7('0x19'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0x36f7('0x1a'),_0x36f7('0x1b'),_0x36f7('0x1c'),'predictiveIntervalDroppedCallsCallersExit',_0x36f7('0x1d'),_0x36f7('0x1e')];function getRealtimeQueues(_0x2ffe42,_0x5554ae){var _0x118406=_0x5554ae===_0x36f7('0x1f')?amiClient:routingClient;return _0x118406['request'](_[_0x36f7('0x20')](_0x5554ae)+'Queues',_0x2ffe42)[_0x36f7('0x21')](function(_0x28c874){if(_0x28c874[_0x36f7('0x22')])throw new Error(util[_0x36f7('0x23')](_0x36f7('0x24'),_0x5554ae));return _0x28c874[_0x36f7('0x25')];})['catch'](function(_0x32dd63){throw _0x32dd63;});}exports[_0x36f7('0x26')]=getRealtimeQueues;function initializeQueues(_0x2f9f6b,_0x2c7212,_0x50b18d,_0x30fa0f){var _0x110c9b=DEFAULT_QUEUE_ATTRIBUTES;if(_0x50b18d==='voice'){if(_0x30fa0f===_0x36f7('0x27')){_0x110c9b=_0x110c9b[_0x36f7('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x30fa0f===_0x36f7('0x29')){_0x110c9b=_0x110c9b[_0x36f7('0x28')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2f9f6b[_0x36f7('0x2a')](function(_0x51b53b){var _0x13bcd1=_0x51b53b['get']({'plain':!![]});_0x13bcd1[_0x36f7('0x6')]=0x0;_0x13bcd1[_0x36f7('0xa')]=0x0;_0x13bcd1[_0x36f7('0x5')]=0x0;_0x13bcd1[_0x36f7('0x4')]=0x0;_0x13bcd1[_0x36f7('0x7')]=0x0;if(_0x50b18d===_0x36f7('0x1f')){_0x13bcd1[_0x36f7('0xd')]=0x0;_0x13bcd1[_0x36f7('0x8')]=0x0;if(_0x30fa0f==='outbound'){_0x13bcd1[_0x36f7('0xf')]=0x0;_0x13bcd1['originated']=0x0;}}var _0x51abc1=_[_0x36f7('0x2b')](_0x2c7212,['id',_0x13bcd1['id']]);if(_0x51abc1){_[_0x36f7('0x2c')](_0x13bcd1,_[_0x36f7('0x2d')](_0x51abc1,_0x110c9b));}return _0x13bcd1;});}exports[_0x36f7('0x2e')]=initializeQueues; \ No newline at end of file +var _0x8164=['waiting','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringInUse','talking','unavailable','unknown','originated','message','statusMessage','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','request','Queues','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','voice','inbound','concat','outbound','map','get','pTalking','find','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused'];(function(_0x2f5e4d,_0x193fd2){var _0x4a922a=function(_0x4b53ee){while(--_0x4b53ee){_0x2f5e4d['push'](_0x2f5e4d['shift']());}};_0x4a922a(++_0x193fd2);}(_0x8164,0x130));var _0x4816=function(_0x12cdee,_0x546dba){_0x12cdee=_0x12cdee-0x0;var _0x5840fd=_0x8164[_0x12cdee];return _0x5840fd;};'use strict';var _=require(_0x4816('0x0'));var jayson=require(_0x4816('0x1'));var util=require(_0x4816('0x2'));var amiClient=jayson[_0x4816('0x3')][_0x4816('0x4')]({'port':0x232a});var routingClient=jayson[_0x4816('0x3')][_0x4816('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x4816('0x5'),_0x4816('0x6'),_0x4816('0x7'),_0x4816('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0x4816('0x9'),_0x4816('0xa'),_0x4816('0xb'),_0x4816('0xc'),_0x4816('0xd'),_0x4816('0xe'),'ringing',_0x4816('0xf'),_0x4816('0x10'),_0x4816('0x11'),_0x4816('0x12')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0x4816('0x13'),_0x4816('0x14'),_0x4816('0x15'),_0x4816('0x16'),'dialMethod',_0x4816('0x17'),_0x4816('0x18'),_0x4816('0x19'),_0x4816('0x1a'),_0x4816('0x1b'),_0x4816('0x1c'),'erlangBusyFactor','dialPredictiveInterval',_0x4816('0x1d'),_0x4816('0x1e'),'predictiveIntervalAvailable',_0x4816('0x1f'),_0x4816('0x20'),'predictiveIntervalDroppedCallsTimeout',_0x4816('0x21'),'predictiveIntervalAvgHoldtime',_0x4816('0x22')];function getRealtimeQueues(_0x5209de,_0x263bdb){var _0x3f925e=_0x263bdb==='voice'?amiClient:routingClient;return _0x3f925e[_0x4816('0x23')](_['startCase'](_0x263bdb)+_0x4816('0x24'),_0x5209de)[_0x4816('0x25')](function(_0x49d245){if(_0x49d245[_0x4816('0x26')])throw new Error(util['format'](_0x4816('0x27'),_0x263bdb));return _0x49d245[_0x4816('0x28')];})['catch'](function(_0x1c76dc){throw _0x1c76dc;});}exports[_0x4816('0x29')]=getRealtimeQueues;function initializeQueues(_0x1c91f1,_0x2c0cd9,_0x40cb7b,_0x3353cd){var _0xd0d15f=DEFAULT_QUEUE_ATTRIBUTES;if(_0x40cb7b===_0x4816('0x2a')){if(_0x3353cd===_0x4816('0x2b')){_0xd0d15f=_0xd0d15f[_0x4816('0x2c')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x3353cd===_0x4816('0x2d')){_0xd0d15f=_0xd0d15f[_0x4816('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1c91f1[_0x4816('0x2e')](function(_0x39838b){var _0x5e7b09=_0x39838b[_0x4816('0x2f')]({'plain':!![]});_0x5e7b09[_0x4816('0x7')]=0x0;_0x5e7b09['loggedInDb']=0x0;_0x5e7b09[_0x4816('0x6')]=0x0;_0x5e7b09[_0x4816('0x5')]=0x0;_0x5e7b09['waiting']=0x0;if(_0x40cb7b==='voice'){_0x5e7b09['talking']=0x0;_0x5e7b09['busy']=0x0;if(_0x3353cd===_0x4816('0x2d')){_0x5e7b09[_0x4816('0x30')]=0x0;_0x5e7b09['originated']=0x0;}}var _0x28da9c=_[_0x4816('0x31')](_0x2c0cd9,['id',_0x5e7b09['id']]);if(_0x28da9c){_['merge'](_0x5e7b09,_[_0x4816('0x32')](_0x28da9c,_0xd0d15f));}return _0x5e7b09;});}exports[_0x4816('0x33')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 5ca394e..22a00c2 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 8ca1e99..40933f8 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 _0x0f13=['md5','update','digest','getUuid','platform','licenseToken','utf8','hostname','macAddress','ipAddress','substring','lodash','child_process','../environment','networkInterfaces','orderBy','keys','filter','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash'];(function(_0x5ee507,_0x1cfc9f){var _0x4b2e3b=function(_0x44101b){while(--_0x44101b){_0x5ee507['push'](_0x5ee507['shift']());}};_0x4b2e3b(++_0x1cfc9f);}(_0x0f13,0x12d));var _0x30f1=function(_0x4b4e59,_0xfa9f52){_0x4b4e59=_0x4b4e59-0x0;var _0x2d1e85=_0x0f13[_0x4b4e59];return _0x2d1e85;};'use strict';var _=require(_0x30f1('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x30f1('0x1'))['execSync'];var config=require(_0x30f1('0x2'));function getInterfaces(){var _0x152abc=[];var _0x59f998=os[_0x30f1('0x3')]();var _0x4d8edb=_[_0x30f1('0x4')](_[_0x30f1('0x5')](_0x59f998));for(var _0x3800cd=0x0;_0x3800cd<_0x4d8edb['length'];_0x3800cd++){var _0xd3ec28=_0x59f998[_0x4d8edb[_0x3800cd]][_0x30f1('0x6')](function(_0x304f9b){return _0x304f9b['family']==='IPv4'&&_0x304f9b['internal']===![];});_0x152abc=_0x152abc[_0x30f1('0x7')](_0xd3ec28);}return _0x152abc;}function getFirstInterface(){var _0x1e4912=_[_0x30f1('0x8')](getInterfaces());return{'macAddress':_0x1e4912&&_0x1e4912[_0x30f1('0x9')]?_0x1e4912[_0x30f1('0x9')]:_0x30f1('0xa'),'ipAddress':_0x1e4912&&_0x1e4912[_0x30f1('0xb')]?_0x1e4912['address']:_0x30f1('0xc')};}exports[_0x30f1('0xd')]=getFirstInterface;function getCPUhash(){var _0x43521a=_[_0x30f1('0x4')](os[_0x30f1('0xe')]()['map'](function(_0x49cde2){return _0x49cde2[_0x30f1('0xf')];}))[_0x30f1('0x10')](':');return crypto[_0x30f1('0x11')](_0x30f1('0x12'))[_0x30f1('0x13')](_0x43521a)[_0x30f1('0x14')]('hex');}exports[_0x30f1('0x15')]=function(){var _0x1b590d=os[_0x30f1('0x16')]();var _0x2ec931=/[0-9a-f-]{36}/;if(config[_0x30f1('0x17')]&&_0x2ec931['test'](config[_0x30f1('0x17')])){return config[_0x30f1('0x17')];}else if(_0x1b590d==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x30f1('0x18')})['replace']('\x0d\x0a','');}else{var _0x24b524=getFirstInterface();var _0x44ca27=getCPUhash();var _0x310be0=_0x44ca27+'|'+os[_0x30f1('0x19')]()+'|'+_0x24b524[_0x30f1('0x1a')]+'|'+_0x24b524[_0x30f1('0x1b')];var _0xbff3fa=crypto['createHash'](_0x30f1('0x12'))[_0x30f1('0x13')](_0x310be0)[_0x30f1('0x14')]('hex');return _0xbff3fa[_0x30f1('0x1c')](0x0,0x8)+'-'+_0xbff3fa[_0x30f1('0x1c')](0x8,0xc)+'-'+_0xbff3fa[_0x30f1('0x1c')](0xc,0x10)+'-'+_0xbff3fa[_0x30f1('0x1c')](0x10,0x14)+'-'+_0xbff3fa[_0x30f1('0x1c')](0x14);}}; \ No newline at end of file +var _0x5ef6=['test','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','substring','lodash','crypto','execSync','../environment','networkInterfaces','orderBy','keys','filter','family','IPv4','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','digest','hex','getUuid','platform','licenseToken'];(function(_0xc58324,_0x28ec63){var _0x34e989=function(_0x9b8a7d){while(--_0x9b8a7d){_0xc58324['push'](_0xc58324['shift']());}};_0x34e989(++_0x28ec63);}(_0x5ef6,0x1f1));var _0x65ef=function(_0x3d9dc2,_0x4d0f69){_0x3d9dc2=_0x3d9dc2-0x0;var _0x9f75a0=_0x5ef6[_0x3d9dc2];return _0x9f75a0;};'use strict';var _=require(_0x65ef('0x0'));var os=require('os');var crypto=require(_0x65ef('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0x65ef('0x2')];var config=require(_0x65ef('0x3'));function getInterfaces(){var _0x326120=[];var _0x1e3e20=os[_0x65ef('0x4')]();var _0x5d6453=_[_0x65ef('0x5')](_[_0x65ef('0x6')](_0x1e3e20));for(var _0xad8117=0x0;_0xad8117<_0x5d6453['length'];_0xad8117++){var _0x554cb8=_0x1e3e20[_0x5d6453[_0xad8117]][_0x65ef('0x7')](function(_0x5cf006){return _0x5cf006[_0x65ef('0x8')]===_0x65ef('0x9')&&_0x5cf006[_0x65ef('0xa')]===![];});_0x326120=_0x326120[_0x65ef('0xb')](_0x554cb8);}return _0x326120;}function getFirstInterface(){var _0x5cadf5=_[_0x65ef('0xc')](getInterfaces());return{'macAddress':_0x5cadf5&&_0x5cadf5[_0x65ef('0xd')]?_0x5cadf5[_0x65ef('0xd')]:'00:00:00:00:00:00','ipAddress':_0x5cadf5&&_0x5cadf5[_0x65ef('0xe')]?_0x5cadf5['address']:_0x65ef('0xf')};}exports[_0x65ef('0x10')]=getFirstInterface;function getCPUhash(){var _0xeaa91a=_[_0x65ef('0x5')](os[_0x65ef('0x11')]()[_0x65ef('0x12')](function(_0x59cbc9){return _0x59cbc9[_0x65ef('0x13')];}))[_0x65ef('0x14')](':');return crypto[_0x65ef('0x15')](_0x65ef('0x16'))['update'](_0xeaa91a)[_0x65ef('0x17')](_0x65ef('0x18'));}exports[_0x65ef('0x19')]=function(){var _0x2111e1=os[_0x65ef('0x1a')]();var _0x307216=/[0-9a-f-]{36}/;if(config[_0x65ef('0x1b')]&&_0x307216[_0x65ef('0x1c')](config['licenseToken'])){return config[_0x65ef('0x1b')];}else if(_0x2111e1==='win32'){return exec(_0x65ef('0x1d'),{'encoding':_0x65ef('0x1e')})['replace']('\x0d\x0a','');}else{var _0xf850b7=getFirstInterface();var _0x3e7ab4=getCPUhash();var _0x2b7842=_0x3e7ab4+'|'+os[_0x65ef('0x1f')]()+'|'+_0xf850b7[_0x65ef('0x20')]+'|'+_0xf850b7[_0x65ef('0x21')];var _0xa0197=crypto['createHash'](_0x65ef('0x16'))['update'](_0x2b7842)[_0x65ef('0x17')](_0x65ef('0x18'));return _0xa0197[_0x65ef('0x22')](0x0,0x8)+'-'+_0xa0197['substring'](0x8,0xc)+'-'+_0xa0197[_0x65ef('0x22')](0xc,0x10)+'-'+_0xa0197[_0x65ef('0x22')](0x10,0x14)+'-'+_0xa0197[_0x65ef('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 0086fb9..157ed46 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 _0xbcac=['../logger','license','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data2','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','findOrCreate','spread','default','util','moment','request-promise','bluebird','../../mysqldb','../../components/encryptor','./hardware'];(function(_0x18f8c1,_0x509d75){var _0x16b26b=function(_0x172330){while(--_0x172330){_0x18f8c1['push'](_0x18f8c1['shift']());}};_0x16b26b(++_0x509d75);}(_0xbcac,0x9d));var _0xcbca=function(_0x39de31,_0x1ff3e1){_0x39de31=_0x39de31-0x0;var _0x9708f=_0xbcac[_0x39de31];return _0x9708f;};'use strict';var util=require(_0xcbca('0x0'));var moment=require(_0xcbca('0x1'));var rp=require(_0xcbca('0x2'));var BPromise=require(_0xcbca('0x3'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0xcbca('0x4'))['db'];var encryptor=require(_0xcbca('0x5'));var hardware=require(_0xcbca('0x6'));var logger=require(_0xcbca('0x7'))(_0xcbca('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3e500b){return new BPromise(function(_0x5ce83d,_0x50dae4){var _0x83fbb1=util[_0xcbca('0x9')](_0xcbca('0xa'),HOST,_0x3e500b,module[_0xcbca('0xb')][_0xcbca('0xc')]);if(oldToken){_0x83fbb1=util[_0xcbca('0x9')](_0xcbca('0xd'),HOST,_0x3e500b,module['exports']['version'],oldToken);}var _0x126ab7={'uri':_0x83fbb1,'method':_0xcbca('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x126ab7)[_0xcbca('0xf')](function(_0x2baad5){_0x5ce83d(_0x2baad5);})[_0xcbca('0x10')](function(_0x47595c){_0x50dae4(_0x47595c);});});}function manageLicense(_0x372ae7,_0xbc910b){var _0x5381dd=_0xbc910b['get']({'plain':!![]});if(!isOldTokenSent&&_0x5381dd[_0xcbca('0x11')]!==_0x372ae7&&!_0x5381dd['data2']){oldToken=_0x5381dd[_0xcbca('0x11')];}httpRequest(_0x372ae7)[_0xcbca('0xf')](function(_0xfa9cb1){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xfa9cb1[_0xcbca('0x12')]){isOldTokenSent=![];if(!_0x5381dd[_0xcbca('0x8')]&&_0x5381dd[_0xcbca('0x8')]!=_0xfa9cb1[_0xcbca('0x8')]||_0x5381dd[_0xcbca('0x8')]&&_0x5381dd['data2']){logger[_0xcbca('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x5381dd['license']&&!_0x5381dd['data2']&&_0x5381dd[_0xcbca('0x8')]!=_0xfa9cb1[_0xcbca('0x8')]){logger[_0xcbca('0x13')](_0xcbca('0x14'));}if(_0x5381dd[_0xcbca('0x8')]&&!_0x5381dd[_0xcbca('0x15')]&&_0x5381dd[_0xcbca('0x8')]==_0xfa9cb1[_0xcbca('0x8')]){return _0xbc910b;}return _0xbc910b[_0xcbca('0x16')]({'data1':_0x372ae7,'data2':null,'license':_0xfa9cb1[_0xcbca('0x8')]});}else{if(_0xfa9cb1['license']||_0x5381dd[_0xcbca('0x8')]){if(!_0x5381dd[_0xcbca('0x15')]){if(_0x5381dd['data1']==_0x372ae7){GRAY_PERIOD_REASON='Disabled';logger[_0xcbca('0x13')](_0xcbca('0x17'));}else{GRAY_PERIOD_REASON=_0xcbca('0x18');logger['info'](_0xcbca('0x19'),_0x5381dd[_0xcbca('0x11')],_0x372ae7);}logger[_0xcbca('0x13')](_0xcbca('0x1a'),GRAY_PERIOD_REASON[_0xcbca('0x1b')](),moment()['format'](_0xcbca('0x1c')));return _0xbc910b[_0xcbca('0x16')]({'data2':encryptor[_0xcbca('0x1d')](moment()[_0xcbca('0x9')](_0xcbca('0x1c')))});}else{if(moment()[_0xcbca('0x1e')](encryptor[_0xcbca('0x1f')](_0x5381dd[_0xcbca('0x15')]),_0xcbca('0x20'))>DAYS){logger[_0xcbca('0x13')](_0xcbca('0x21'),moment()['format'](_0xcbca('0x1c')));isOldTokenSent=![];return _0xbc910b['update']({'data1':_0x372ae7,'data2':null,'license':null});}}}else{if(_0x5381dd[_0xcbca('0x11')]!=_0x372ae7){logger[_0xcbca('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5381dd[_0xcbca('0x11')],_0x372ae7);return _0xbc910b[_0xcbca('0x16')]({'data1':_0x372ae7,'data2':null,'license':null});}}}return _0xbc910b;})[_0xcbca('0xf')](function(_0x5e5183){_0xbc910b=_0x5e5183;})[_0xcbca('0x10')](function(_0x29bce0){logger[_0xcbca('0x22')](_0x29bce0[_0xcbca('0x23')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xcbca('0x24')](),_0xbc910b);},TIME);});}function defaultLicense(){var _0x425122=hardware[_0xcbca('0x24')]();if(_0x425122){return db[_0xcbca('0x25')][_0xcbca('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x425122}})[_0xcbca('0x27')](function(_0x9e08fa,_0x574ad3){logger[_0xcbca('0x13')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x425122);manageLicense(_0x425122,_0x9e08fa);})[_0xcbca('0x10')](function(_0x1fa2e6){logger[_0xcbca('0x22')](_0x1fa2e6['message']);});}}exports[_0xcbca('0x28')]=defaultLicense; \ No newline at end of file +var _0x8b37=['pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','then','catch','get','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','util','bluebird'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x8b37,0xe8));var _0x78b3=function(_0x4d217b,_0x57b380){_0x4d217b=_0x4d217b-0x0;var _0x12da8f=_0x8b37[_0x4d217b];return _0x12da8f;};'use strict';var util=require(_0x78b3('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0x78b3('0x1'));var pkginfo=require(_0x78b3('0x2'))(module,_0x78b3('0x3'));var db=require(_0x78b3('0x4'))['db'];var encryptor=require(_0x78b3('0x5'));var hardware=require(_0x78b3('0x6'));var logger=require(_0x78b3('0x7'))(_0x78b3('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xeceb72){return new BPromise(function(_0x4b46ae,_0x33f1cb){var _0x1c6dc3=util[_0x78b3('0x9')](_0x78b3('0xa'),HOST,_0xeceb72,module['exports'][_0x78b3('0x3')]);if(oldToken){_0x1c6dc3=util[_0x78b3('0x9')](_0x78b3('0xb'),HOST,_0xeceb72,module[_0x78b3('0xc')]['version'],oldToken);}var _0x21a8cd={'uri':_0x1c6dc3,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x21a8cd)[_0x78b3('0xd')](function(_0xfdfaec){_0x4b46ae(_0xfdfaec);})[_0x78b3('0xe')](function(_0x3b8a7e){_0x33f1cb(_0x3b8a7e);});});}function manageLicense(_0x10f91c,_0x253f67){var _0x2740a0=_0x253f67[_0x78b3('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x2740a0[_0x78b3('0x10')]!==_0x10f91c&&!_0x2740a0['data2']){oldToken=_0x2740a0[_0x78b3('0x10')];}httpRequest(_0x10f91c)['then'](function(_0x25429b){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x25429b[_0x78b3('0x11')]){isOldTokenSent=![];if(!_0x2740a0[_0x78b3('0x8')]&&_0x2740a0['license']!=_0x25429b[_0x78b3('0x8')]||_0x2740a0[_0x78b3('0x8')]&&_0x2740a0['data2']){logger[_0x78b3('0x12')](_0x78b3('0x13'));}if(_0x2740a0[_0x78b3('0x8')]&&!_0x2740a0['data2']&&_0x2740a0[_0x78b3('0x8')]!=_0x25429b['license']){logger[_0x78b3('0x12')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x2740a0['license']&&!_0x2740a0[_0x78b3('0x14')]&&_0x2740a0[_0x78b3('0x8')]==_0x25429b['license']){return _0x253f67;}return _0x253f67[_0x78b3('0x15')]({'data1':_0x10f91c,'data2':null,'license':_0x25429b['license']});}else{if(_0x25429b[_0x78b3('0x8')]||_0x2740a0[_0x78b3('0x8')]){if(!_0x2740a0[_0x78b3('0x14')]){if(_0x2740a0[_0x78b3('0x10')]==_0x10f91c){GRAY_PERIOD_REASON='Disabled';logger[_0x78b3('0x12')](_0x78b3('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x78b3('0x12')](_0x78b3('0x17'),_0x2740a0[_0x78b3('0x10')],_0x10f91c);}logger['info'](_0x78b3('0x18'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x78b3('0x9')](_0x78b3('0x19')));return _0x253f67[_0x78b3('0x15')]({'data2':encryptor[_0x78b3('0x1a')](moment()['format'](_0x78b3('0x19')))});}else{if(moment()[_0x78b3('0x1b')](encryptor[_0x78b3('0x1c')](_0x2740a0[_0x78b3('0x14')]),_0x78b3('0x1d'))>DAYS){logger['info'](_0x78b3('0x1e'),moment()[_0x78b3('0x9')](_0x78b3('0x19')));isOldTokenSent=![];return _0x253f67[_0x78b3('0x15')]({'data1':_0x10f91c,'data2':null,'license':null});}}}else{if(_0x2740a0['data1']!=_0x10f91c){logger['info'](_0x78b3('0x17'),_0x2740a0['data1'],_0x10f91c);return _0x253f67['update']({'data1':_0x10f91c,'data2':null,'license':null});}}}return _0x253f67;})[_0x78b3('0xd')](function(_0x4f6c07){_0x253f67=_0x4f6c07;})[_0x78b3('0xe')](function(_0x3081e7){logger[_0x78b3('0x1f')](_0x3081e7['message']);})[_0x78b3('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x78b3('0x21')](),_0x253f67);},TIME);});}function defaultLicense(){var _0x30b1c0=hardware[_0x78b3('0x21')]();if(_0x30b1c0){return db[_0x78b3('0x22')][_0x78b3('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x30b1c0}})[_0x78b3('0x24')](function(_0x101016,_0x32a19d){logger['info'](_0x78b3('0x25'),_0x30b1c0);manageLicense(_0x30b1c0,_0x101016);})[_0x78b3('0xe')](function(_0x201897){logger[_0x78b3('0x1f')](_0x201897[_0x78b3('0x26')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 63cac8f..c0492e6 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 _0x92f9=['%s:%s:%s','parse','uuid','machineUuid','gray','add','format','changed','disabled','message','User','findAll','role','sequelize','COUNT','count','user','telephone','users','telephones','forEach','admin','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x92f9,0x135));var _0x992f=function(_0x3832f9,_0x59c443){_0x3832f9=_0x3832f9-0x0;var _0x37418c=_0x92f9[_0x3832f9];return _0x37418c;};'use strict';var util=require('util');var _=require(_0x992f('0x0'));var moment=require(_0x992f('0x1'));var BPromise=require(_0x992f('0x2'));var hardware=require(_0x992f('0x3'));var encryptor=require(_0x992f('0x4'));var db=require(_0x992f('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x992f('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x992f('0x7'),'machineUuid':hardware[_0x992f('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x992f('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x992f('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xb08b54){return new BPromise(function(_0x215c9c,_0x3cc1d0){return db['License'][_0x992f('0xa')](_['defaults'](_0xb08b54,{'raw':!![],'where':{'id':0x1}}))[_0x992f('0xb')](function(_0x17790b){return checkLicense(_0x17790b,null);})[_0x992f('0xb')](function(_0x557878){_0x215c9c(_0x557878);return;})[_0x992f('0xc')](function(_0x4c995c){_0x3cc1d0(_0x4c995c);});});}function checkLicense(_0x7ea38a,_0x1f2860){if(!_0x7ea38a){demoLicense['uuid']=_0x7ea38a[_0x992f('0xd')];return demoLicense;}try{var _0x352f4e=_0x1f2860||_0x7ea38a[_0x992f('0xe')];if(_[_0x992f('0xf')](_0x352f4e)){throw new Error(_0x992f('0x10'));}var _0x39f75e=_0x7ea38a[_0x992f('0xd')];var _0x3b78dc=_0x7ea38a[_0x992f('0x11')];var _0x2c220d=_0x39f75e[_0x992f('0x12')]('-')[0x4];var _0x4d2c42=_0x39f75e[_0x992f('0x12')]('-')[0x0];var _0xe44ca9=encryptor[_0x992f('0x13')](_0x352f4e,util['format'](_0x992f('0x14'),_0x2c220d,_0x39f75e,_0x4d2c42));var _0x238d59=JSON[_0x992f('0x15')](_0xe44ca9);_0x238d59['demo']=![];_0x238d59[_0x992f('0x16')]=_0x39f75e;_0x238d59[_0x992f('0x17')]=hardware[_0x992f('0x8')]();if(_0x3b78dc){var _0x454d9b=encryptor['decryptString'](_0x3b78dc);_0x238d59[_0x992f('0x18')]=_0x454d9b;_0x238d59['deadline']=moment(_0x454d9b)[_0x992f('0x19')](0x7,'days')[_0x992f('0x1a')]();_0x238d59['grayReason']=_0x238d59['uuid']!=_0x238d59['machineUuid']?_0x992f('0x1b'):_0x992f('0x1c');}return _0x238d59;}catch(_0x1e2663){breakingLicense[_0x992f('0x16')]=_0x7ea38a[_0x992f('0xd')];breakingLicense[_0x992f('0x1d')]=_0x1e2663[_0x992f('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x55fcf8,_0x493f7c){getLicense()['then'](function(_0x255022){return db[_0x992f('0x1e')][_0x992f('0x1f')]({'attributes':[_0x992f('0x20'),[db[_0x992f('0x21')]['fn'](_0x992f('0x22'),db[_0x992f('0x21')]['col'](_0x992f('0x20'))),_0x992f('0x23')]],'group':_0x992f('0x20'),'where':{'role':{'$or':['admin',_0x992f('0x24'),_0x992f('0x25')]}},'raw':!![]})[_0x992f('0xb')](function(_0xca1ad9){var _0x2bd945={'user':_0x255022[_0x992f('0x26')]||0x0,'telephone':_0x255022[_0x992f('0x27')]||0x0};_0xca1ad9[_0x992f('0x28')](function(_0x975b57){var _0x535949=_0x975b57['role']===_0x992f('0x29')?_0x992f('0x24'):_0x975b57[_0x992f('0x20')];_0x2bd945[_0x535949]-=_0x975b57[_0x992f('0x23')];if(_0x2bd945[_0x535949]<0x0)_0x2bd945[_0x535949]=0x0;});_0x55fcf8(_0x2bd945);return;});})['catch'](function(_0x59969e){_0x493f7c(_0x59969e);});});}function checkUserLimits(_0x57d438){return new BPromise(function(_0x443bde,_0xa7de56){getLimits()[_0x992f('0xb')](function(_0x2e28fd){var _0x180480=_[_0x992f('0x2a')](_[_0x992f('0x2b')](_0x57d438,_0x992f('0x20')),[_0x992f('0x29'),'user',_0x992f('0x25')]);var _0x38ef35=(_0x180480['admin']||0x0)+(_0x180480[_0x992f('0x24')]||0x0);var _0x1105fc=_0x180480['telephone']||0x0;if(_0x38ef35>_0x2e28fd[_0x992f('0x24')])return _0xa7de56(_0x992f('0x2c'));if(_0x1105fc>_0x2e28fd[_0x992f('0x25')])return _0xa7de56(_0x992f('0x2d'));return _0x443bde();})[_0x992f('0xc')](function(_0x1e3ee6){_0xa7de56(_0x1e3ee6);});});}module[_0x992f('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x80dc=['find','defaults','then','catch','uuid','license','isEmpty','data1','split','format','parse','machineUuid','decryptString','days','changed','disabled','message','User','role','sequelize','COUNT','count','admin','user','users','telephones','forEach','countBy','telephone','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license'];(function(_0x347ed9,_0x51fc0b){var _0x5d01f0=function(_0x442fcb){while(--_0x442fcb){_0x347ed9['push'](_0x347ed9['shift']());}};_0x5d01f0(++_0x51fc0b);}(_0x80dc,0x12f));var _0xc80d=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x80dc[_0x173441];return _0x2423a8;};'use strict';var util=require(_0xc80d('0x0'));var _=require(_0xc80d('0x1'));var moment=require(_0xc80d('0x2'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0xc80d('0x3'));var db=require(_0xc80d('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc80d('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc80d('0x6'),'machineUuid':hardware[_0xc80d('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'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':![],'update':![],'description':_0xc80d('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x39bd88){return new BPromise(function(_0x4095fe,_0x42961e){return db['License'][_0xc80d('0x9')](_[_0xc80d('0xa')](_0x39bd88,{'raw':!![],'where':{'id':0x1}}))[_0xc80d('0xb')](function(_0x406e9d){return checkLicense(_0x406e9d,null);})[_0xc80d('0xb')](function(_0x1d2079){_0x4095fe(_0x1d2079);return;})[_0xc80d('0xc')](function(_0x29c5d6){_0x42961e(_0x29c5d6);});});}function checkLicense(_0x32b78d,_0x487400){if(!_0x32b78d){demoLicense[_0xc80d('0xd')]=_0x32b78d['data1'];return demoLicense;}try{var _0x50c982=_0x487400||_0x32b78d[_0xc80d('0xe')];if(_[_0xc80d('0xf')](_0x50c982)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x4d7441=_0x32b78d[_0xc80d('0x10')];var _0x55a27f=_0x32b78d['data2'];var _0x30d080=_0x4d7441[_0xc80d('0x11')]('-')[0x4];var _0x3277ef=_0x4d7441['split']('-')[0x0];var _0x14b34f=encryptor['decryptString'](_0x50c982,util[_0xc80d('0x12')]('%s:%s:%s',_0x30d080,_0x4d7441,_0x3277ef));var _0x264bfe=JSON[_0xc80d('0x13')](_0x14b34f);_0x264bfe['demo']=![];_0x264bfe[_0xc80d('0xd')]=_0x4d7441;_0x264bfe[_0xc80d('0x14')]=hardware[_0xc80d('0x7')]();if(_0x55a27f){var _0x1b47af=encryptor[_0xc80d('0x15')](_0x55a27f);_0x264bfe['gray']=_0x1b47af;_0x264bfe['deadline']=moment(_0x1b47af)['add'](0x7,_0xc80d('0x16'))[_0xc80d('0x12')]();_0x264bfe['grayReason']=_0x264bfe['uuid']!=_0x264bfe[_0xc80d('0x14')]?_0xc80d('0x17'):_0xc80d('0x18');}return _0x264bfe;}catch(_0xd95a82){breakingLicense[_0xc80d('0xd')]=_0x32b78d[_0xc80d('0x10')];breakingLicense[_0xc80d('0x19')]=_0xd95a82[_0xc80d('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1cfe93,_0x4ab50b){getLicense()[_0xc80d('0xb')](function(_0x46347d){return db[_0xc80d('0x1a')]['findAll']({'attributes':[_0xc80d('0x1b'),[db[_0xc80d('0x1c')]['fn'](_0xc80d('0x1d'),db[_0xc80d('0x1c')]['col'](_0xc80d('0x1b'))),_0xc80d('0x1e')]],'group':_0xc80d('0x1b'),'where':{'role':{'$or':[_0xc80d('0x1f'),_0xc80d('0x20'),'telephone']}},'raw':!![]})[_0xc80d('0xb')](function(_0x522296){var _0x34e54c={'user':_0x46347d[_0xc80d('0x21')]||0x0,'telephone':_0x46347d[_0xc80d('0x22')]||0x0};_0x522296[_0xc80d('0x23')](function(_0x5359f5){var _0x2f4a2a=_0x5359f5[_0xc80d('0x1b')]===_0xc80d('0x1f')?'user':_0x5359f5[_0xc80d('0x1b')];_0x34e54c[_0x2f4a2a]-=_0x5359f5['count'];if(_0x34e54c[_0x2f4a2a]<0x0)_0x34e54c[_0x2f4a2a]=0x0;});_0x1cfe93(_0x34e54c);return;});})['catch'](function(_0x1c7e06){_0x4ab50b(_0x1c7e06);});});}function checkUserLimits(_0xbdffbc){return new BPromise(function(_0x8ec97a,_0x414f3d){getLimits()[_0xc80d('0xb')](function(_0x4366d7){var _0x5a87e5=_['pick'](_[_0xc80d('0x24')](_0xbdffbc,'role'),[_0xc80d('0x1f'),_0xc80d('0x20'),_0xc80d('0x25')]);var _0x423ba9=(_0x5a87e5[_0xc80d('0x1f')]||0x0)+(_0x5a87e5[_0xc80d('0x20')]||0x0);var _0x247e4a=_0x5a87e5[_0xc80d('0x25')]||0x0;if(_0x423ba9>_0x4366d7[_0xc80d('0x20')])return _0x414f3d('License\x20limit\x20reached\x20for\x20users');if(_0x247e4a>_0x4366d7[_0xc80d('0x25')])return _0x414f3d(_0xc80d('0x26'));return _0x8ec97a();})[_0xc80d('0xc')](function(_0x3c8725){_0x414f3d(_0x3c8725);});});}module['exports']={'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 b21a12a..1fa5a07 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 _0xda2d=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x5f34f8,_0xb4230b){var _0x28e804=function(_0x416994){while(--_0x416994){_0x5f34f8['push'](_0x5f34f8['shift']());}};_0x28e804(++_0xb4230b);}(_0xda2d,0x102));var _0xdda2=function(_0x3bc0ef,_0x4857bc){_0x3bc0ef=_0x3bc0ef-0x0;var _0x5df446=_0xda2d[_0x3bc0ef];return _0x5df446;};'use strict';module['exports']={'DOMAIN':_0xdda2('0x0'),'SESSION_SECRET':_0xdda2('0x1'),'GOOGLE_ID':_0xdda2('0x2'),'GOOGLE_SECRET':_0xdda2('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x0120=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x2b0b28,_0x4f42e3){var _0x349055=function(_0x19792a){while(--_0x19792a){_0x2b0b28['push'](_0x2b0b28['shift']());}};_0x349055(++_0x4f42e3);}(_0x0120,0x6f));var _0x0012=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x0120[_0x4154a6];return _0x3b2786;};'use strict';module[_0x0012('0x0')]={'DOMAIN':_0x0012('0x1'),'SESSION_SECRET':_0x0012('0x2'),'GOOGLE_ID':_0x0012('0x3'),'GOOGLE_SECRET':_0x0012('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 943de67..a7ddd88 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x112d=['fileLogger','exports','../utils/loggers'];(function(_0x16ca23,_0x3a2513){var _0x36dc6c=function(_0x41ff95){while(--_0x41ff95){_0x16ca23['push'](_0x16ca23['shift']());}};_0x36dc6c(++_0x3a2513);}(_0x112d,0x16d));var _0xd112=function(_0x8c71d2,_0x429f91){_0x8c71d2=_0x8c71d2-0x0;var _0x3c1bd2=_0x112d[_0x8c71d2];return _0x3c1bd2;};'use strict';var fileLogger=require(_0xd112('0x0'))[_0xd112('0x1')];module[_0xd112('0x2')]=fileLogger; \ No newline at end of file +var _0x7d5e=['../utils/loggers','fileLogger','exports'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x7d5e,0x123));var _0xe7d5=function(_0x56912e,_0x1918c6){_0x56912e=_0x56912e-0x0;var _0x23d776=_0x7d5e[_0x56912e];return _0x23d776;};'use strict';var fileLogger=require(_0xe7d5('0x0'))[_0xe7d5('0x1')];module[_0xe7d5('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 3ea4c59..322f694 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 _0x9b31=['../../config/environment','resolve','root','legacy-libs','express','join','ami','agi','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','path'];(function(_0x25dcec,_0x250318){var _0x3340c7=function(_0x248127){while(--_0x248127){_0x25dcec['push'](_0x25dcec['shift']());}};_0x3340c7(++_0x250318);}(_0x9b31,0x14f));var _0x19b3=function(_0x1583bb,_0x290e29){_0x1583bb=_0x1583bb-0x0;var _0x3a9ceb=_0x9b31[_0x1583bb];return _0x3a9ceb;};'use strict';var path=require(_0x19b3('0x0'));var cfg=require(_0x19b3('0x1'));var env={'NODE_PATH':path[_0x19b3('0x2')](path['join'](cfg[_0x19b3('0x3')],_0x19b3('0x4')))};var pm2config={'apps':[{'name':_0x19b3('0x5'),'script':path[_0x19b3('0x6')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x19b3('0x7'),'script':path[_0x19b3('0x6')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x19b3('0x8'),'script':path[_0x19b3('0x6')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x19b3('0x9'),'script':path[_0x19b3('0x6')](__dirname,_0x19b3('0xa')),'env':env},{'name':'routing','script':path[_0x19b3('0x6')](__dirname,_0x19b3('0xb')),'env':env},{'name':_0x19b3('0xc'),'script':path[_0x19b3('0x6')](__dirname,_0x19b3('0xd')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x8cbe=['../../services/xdr/index.js','exports','resolve','join','root','legacy-libs','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr'];(function(_0x29ed3d,_0x3527d7){var _0x35d272=function(_0x12971d){while(--_0x12971d){_0x29ed3d['push'](_0x29ed3d['shift']());}};_0x35d272(++_0x3527d7);}(_0x8cbe,0x179));var _0xe8cb=function(_0x5abe05,_0x2432c3){_0x5abe05=_0x5abe05-0x0;var _0x1d4294=_0x8cbe[_0x5abe05];return _0x1d4294;};'use strict';var path=require('path');var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0xe8cb('0x0')](path[_0xe8cb('0x1')](cfg[_0xe8cb('0x2')],_0xe8cb('0x3')))};var pm2config={'apps':[{'name':'express','script':path[_0xe8cb('0x1')](__dirname,_0xe8cb('0x4')),'env':env},{'name':_0xe8cb('0x5'),'script':path[_0xe8cb('0x1')](__dirname,_0xe8cb('0x6')),'env':env},{'name':_0xe8cb('0x7'),'script':path[_0xe8cb('0x1')](__dirname,_0xe8cb('0x8')),'env':env},{'name':_0xe8cb('0x9'),'script':path[_0xe8cb('0x1')](__dirname,_0xe8cb('0xa')),'env':env},{'name':_0xe8cb('0xb'),'script':path['join'](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0xe8cb('0xc'),'script':path[_0xe8cb('0x1')](__dirname,_0xe8cb('0xd')),'env':env}]};module[_0xe8cb('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 83cb733..80eefed 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 _0xbb44=['stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected','then','start','disconnect'];(function(_0x350b1c,_0x2534dd){var _0x3f59a5=function(_0x39efa8){while(--_0x39efa8){_0x350b1c['push'](_0x350b1c['shift']());}};_0x3f59a5(++_0x2534dd);}(_0xbb44,0xe8));var _0x4bb4=function(_0xde846f,_0x53c934){_0xde846f=_0xde846f-0x0;var _0x1f743f=_0xbb44[_0xde846f];return _0x1f743f;};'use strict';var pm2=require(_0x4bb4('0x0'));var BPromise=require(_0x4bb4('0x1'));var config=require(_0x4bb4('0x2'));function connect(){return new BPromise(function(_0x1b554a,_0x493fcd){return pm2[_0x4bb4('0x3')](function(_0x5a0280){if(_0x5a0280){return _0x493fcd(_0x5a0280);}return _0x1b554a(_0x4bb4('0x4'));});});};exports['start']=function(_0x4cb05d){return connect()[_0x4bb4('0x5')](function(){return new BPromise(function(_0x4e96c7,_0x5e727f){return pm2[_0x4bb4('0x6')](_0x4cb05d,function(_0x1dd86b,_0x135f33){if(_0x1dd86b){return _0x5e727f(_0x1dd86b);}pm2[_0x4bb4('0x7')]();return _0x4e96c7(_0x135f33);});});});};exports[_0x4bb4('0x8')]=function(_0x24f61c){return connect()[_0x4bb4('0x5')](function(){return new BPromise(function(_0x39ce8e,_0x2b8730){return pm2[_0x4bb4('0x8')](_0x24f61c,function(_0x3be200,_0x3fa25d){if(_0x3be200){return _0x2b8730(_0x3be200);}pm2[_0x4bb4('0x7')]();return _0x39ce8e(_0x3fa25d);});});});};exports[_0x4bb4('0x9')]=function(_0x18a918){return connect()['then'](function(){return new BPromise(function(_0x4406eb,_0x26ee3f){return pm2[_0x4bb4('0x9')](_0x18a918,function(_0xf3314,_0x5b13a3){if(_0xf3314){return _0x26ee3f(_0xf3314);}pm2[_0x4bb4('0x7')]();return _0x4406eb(_0x5b13a3);});});});};exports[_0x4bb4('0xa')]=function(){return connect()[_0x4bb4('0x5')](function(){return new BPromise(function(_0x4a0bd2,_0x4b5946){return pm2['list'](function(_0x7f997f,_0x34a323){if(_0x7f997f){return _0x4b5946(_0x7f997f);}pm2['disconnect']();return _0x4a0bd2(_0x34a323);});});});};exports['describe']=function(_0x4e7361){return connect()[_0x4bb4('0x5')](function(){return new BPromise(function(_0x4964d4,_0x2af597){return pm2[_0x4bb4('0xb')](_0x4e7361,function(_0x5605b4,_0x28816c){if(_0x5605b4){return _0x2af597(_0x5605b4);}pm2[_0x4bb4('0x7')]();return _0x4964d4(_0x28816c);});});});};exports[_0x4bb4('0xc')]=function(_0x24ea1e){return connect()['then'](function(){return new BPromise(function(_0x21596a,_0x190eed){return pm2[_0x4bb4('0xc')](_0x24ea1e,function(_0x4ff1c9,_0x5781f9){if(_0x4ff1c9){return _0x190eed(_0x4ff1c9);}pm2['disconnect']();return _0x21596a(_0x5781f9);});});});};exports['dump']=function(){return connect()[_0x4bb4('0x5')](function(){return new BPromise(function(_0x53e0f8,_0x4949b5){return pm2[_0x4bb4('0xd')](function(_0x56015d){if(_0x56015d){return _0x4949b5(_0x56015d);}return _0x53e0f8(_0x4bb4('0xe'));});});});}; \ No newline at end of file +var _0x179e=['then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','start'];(function(_0xa987c8,_0x1d435f){var _0x17f643=function(_0x481747){while(--_0x481747){_0xa987c8['push'](_0xa987c8['shift']());}};_0x17f643(++_0x1d435f);}(_0x179e,0x95));var _0xe179=function(_0xc1a4cf,_0x17141b){_0xc1a4cf=_0xc1a4cf-0x0;var _0x2930d1=_0x179e[_0xc1a4cf];return _0x2930d1;};'use strict';var pm2=require(_0xe179('0x0'));var BPromise=require(_0xe179('0x1'));var config=require(_0xe179('0x2'));function connect(){return new BPromise(function(_0x5942fe,_0x1000f9){return pm2[_0xe179('0x3')](function(_0x4c1a46){if(_0x4c1a46){return _0x1000f9(_0x4c1a46);}return _0x5942fe('connected');});});};exports[_0xe179('0x4')]=function(_0x4a459e){return connect()[_0xe179('0x5')](function(){return new BPromise(function(_0x159e50,_0x12abb0){return pm2[_0xe179('0x4')](_0x4a459e,function(_0x3dd6e4,_0x4f43df){if(_0x3dd6e4){return _0x12abb0(_0x3dd6e4);}pm2[_0xe179('0x6')]();return _0x159e50(_0x4f43df);});});});};exports[_0xe179('0x7')]=function(_0x338f24){return connect()['then'](function(){return new BPromise(function(_0x5c7c82,_0x25b1ea){return pm2[_0xe179('0x7')](_0x338f24,function(_0x4e0fdb,_0x27dfe9){if(_0x4e0fdb){return _0x25b1ea(_0x4e0fdb);}pm2[_0xe179('0x6')]();return _0x5c7c82(_0x27dfe9);});});});};exports[_0xe179('0x8')]=function(_0x56a6a7){return connect()[_0xe179('0x5')](function(){return new BPromise(function(_0x205fa0,_0x13765d){return pm2[_0xe179('0x8')](_0x56a6a7,function(_0x6979af,_0x4fd18d){if(_0x6979af){return _0x13765d(_0x6979af);}pm2[_0xe179('0x6')]();return _0x205fa0(_0x4fd18d);});});});};exports[_0xe179('0x9')]=function(){return connect()[_0xe179('0x5')](function(){return new BPromise(function(_0x5ce078,_0x519e3d){return pm2[_0xe179('0x9')](function(_0xf2a78b,_0x4ec4c4){if(_0xf2a78b){return _0x519e3d(_0xf2a78b);}pm2[_0xe179('0x6')]();return _0x5ce078(_0x4ec4c4);});});});};exports[_0xe179('0xa')]=function(_0x5ea67b){return connect()[_0xe179('0x5')](function(){return new BPromise(function(_0x10a9d2,_0x4d1408){return pm2[_0xe179('0xa')](_0x5ea67b,function(_0x51471a,_0x4a98ec){if(_0x51471a){return _0x4d1408(_0x51471a);}pm2[_0xe179('0x6')]();return _0x10a9d2(_0x4a98ec);});});});};exports[_0xe179('0xb')]=function(_0x200d1f){return connect()[_0xe179('0x5')](function(){return new BPromise(function(_0x3d0f7a,_0x201550){return pm2[_0xe179('0xb')](_0x200d1f,function(_0x18f040,_0x6b1c7a){if(_0x18f040){return _0x201550(_0x18f040);}pm2[_0xe179('0x6')]();return _0x3d0f7a(_0x6b1c7a);});});});};exports[_0xe179('0xc')]=function(){return connect()[_0xe179('0x5')](function(){return new BPromise(function(_0x59ac57,_0x25aa52){return pm2[_0xe179('0xc')](function(_0x140313){if(_0x140313){return _0x25aa52(_0x140313);}return _0x59ac57(_0xe179('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 8acbf09..0880924 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 _0xe76b=['moment','../../config/environment','../../mysqldb','../logger','schedule','defaults','localhost','socket.io-emitter','redis','Setting','find','chatTimeout','then','ChatInteraction','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','[CHAT]\x20Error\x20closing\x20interactions','inspect'];(function(_0x15fe66,_0x3622ea){var _0x52003e=function(_0x20257a){while(--_0x20257a){_0x15fe66['push'](_0x15fe66['shift']());}};_0x52003e(++_0x3622ea);}(_0xe76b,0xfa));var _0xbe76=function(_0x1116ac,_0xcbe059){_0x1116ac=_0x1116ac-0x0;var _0x3e806b=_0xe76b[_0x1116ac];return _0x3e806b;};'use strict';var _=require('lodash');var moment=require(_0xbe76('0x0'));var Redis=require('ioredis');var util=require('util');var config=require(_0xbe76('0x1'));var db=require(_0xbe76('0x2'))['db'];var logger=require(_0xbe76('0x3'))(_0xbe76('0x4'));config['redis']=_[_0xbe76('0x5')](config['redis'],{'host':_0xbe76('0x6'),'port':0x18eb});var io=require(_0xbe76('0x7'))(new Redis(config[_0xbe76('0x8')]));function closeInteractions(){var _0x11935b=0x0;var _0x30704b=[];return db[_0xbe76('0x9')][_0xbe76('0xa')]({'raw':!![],'attributes':['id',_0xbe76('0xb')],'where':{'id':0x1}})[_0xbe76('0xc')](function(_0x54cc1d){_0x11935b=_0x54cc1d[_0xbe76('0xb')];if(_0x11935b){return db[_0xbe76('0xd')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x54cc1d[_0xbe76('0xb')],'minutes')}}});}else{return[];}})[_0xbe76('0xc')](function(_0x37dc78){if(_0x37dc78&&_0x37dc78[_0xbe76('0xe')]){_0x30704b=_['map'](_0x37dc78||[],'id');logger[_0xbe76('0xf')](_0xbe76('0x10'),_0x30704b[_0xbe76('0x11')]());return db[_0xbe76('0xd')][_0xbe76('0x12')]({'closeReason':'system','disposition':_0xbe76('0x13'),'closed':!![],'closedAt':moment()[_0xbe76('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x30704b}});}})[_0xbe76('0xc')](function(){if(_0x30704b&&_0x30704b['length']){logger[_0xbe76('0xf')](_0xbe76('0x15'),_0x30704b[_0xbe76('0x11')]());for(var _0x223960=0x0;_0x223960<_0x30704b[_0xbe76('0xe')];_0x223960++){io[_0xbe76('0x16')]('chatInteraction:update',{'id':_0x30704b[_0x223960],'closed':!![]});}}})['catch'](function(_0x5104a4){logger['error'](_0xbe76('0x17'),_0x5104a4?util[_0xbe76('0x18')](_0x5104a4,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x842c=['subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','format','YYYY-MM-DD\x20HH:mm:ss','chatInteraction:update','catch','inspect','start','lodash','ioredis','../../config/environment','../logger','schedule','defaults','redis','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt'];(function(_0x35751f,_0x51e318){var _0x5d821a=function(_0x220a5c){while(--_0x220a5c){_0x35751f['push'](_0x35751f['shift']());}};_0x5d821a(++_0x51e318);}(_0x842c,0x66));var _0xc842=function(_0x3d68fe,_0x54fccd){_0x3d68fe=_0x3d68fe-0x0;var _0x30e059=_0x842c[_0x3d68fe];return _0x30e059;};'use strict';var _=require(_0xc842('0x0'));var moment=require('moment');var Redis=require(_0xc842('0x1'));var util=require('util');var config=require(_0xc842('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xc842('0x3'))(_0xc842('0x4'));config['redis']=_[_0xc842('0x5')](config[_0xc842('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xc842('0x7'))(new Redis(config[_0xc842('0x6')]));function closeInteractions(){var _0xe4ee92=0x0;var _0x5b93eb=[];return db[_0xc842('0x8')][_0xc842('0x9')]({'raw':!![],'attributes':['id',_0xc842('0xa')],'where':{'id':0x1}})[_0xc842('0xb')](function(_0x55282a){_0xe4ee92=_0x55282a[_0xc842('0xa')];if(_0xe4ee92){return db['ChatInteraction'][_0xc842('0xc')]({'raw':!![],'attributes':['id',_0xc842('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc842('0xe')](_0x55282a[_0xc842('0xa')],_0xc842('0xf'))}}});}else{return[];}})[_0xc842('0xb')](function(_0x5802f7){if(_0x5802f7&&_0x5802f7[_0xc842('0x10')]){_0x5b93eb=_['map'](_0x5802f7||[],'id');logger[_0xc842('0x11')](_0xc842('0x12'),_0x5b93eb[_0xc842('0x13')]());return db[_0xc842('0x14')][_0xc842('0x15')]({'closeReason':_0xc842('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xc842('0x17')](_0xc842('0x18'))},{'where':{'id':_0x5b93eb}});}})['then'](function(){if(_0x5b93eb&&_0x5b93eb['length']){logger[_0xc842('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x5b93eb['join']());for(var _0x377c13=0x0;_0x377c13<_0x5b93eb[_0xc842('0x10')];_0x377c13++){io['emit'](_0xc842('0x19'),{'id':_0x5b93eb[_0x377c13],'closed':!![]});}}})[_0xc842('0x1a')](function(_0x30a462){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x30a462?util[_0xc842('0x1b')](_0x30a462,{'showHidden':![],'depth':null}):'');});}exports[_0xc842('0x1c')]=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 9a93139..d1887d2 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 _0xd574=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x4af6a4,_0x35f4d9){var _0x1fed3c=function(_0x142025){while(--_0x142025){_0x4af6a4['push'](_0x4af6a4['shift']());}};_0x1fed3c(++_0x35f4d9);}(_0xd574,0x1e8));var _0x4d57=function(_0x1b0e86,_0x33ec39){_0x1b0e86=_0x1b0e86-0x0;var _0xd85844=_0xd574[_0x1b0e86];return _0xd85844;};'use strict';function start(){var _0x157d70=require(_0x4d57('0x0'));return _0x157d70[_0x4d57('0x1')]();}module[_0x4d57('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x543d=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x460666,_0x24bfa0){var _0x555cbf=function(_0x3b4743){while(--_0x3b4743){_0x460666['push'](_0x460666['shift']());}};_0x555cbf(++_0x24bfa0);}(_0x543d,0x12d));var _0xd543=function(_0x2517ae,_0x2f5c62){_0x2517ae=_0x2517ae-0x0;var _0x152f2b=_0x543d[_0x2517ae];return _0x152f2b;};'use strict';function start(){var _0x1379a6=require(_0xd543('0x0'));return _0x1379a6[_0xd543('0x1')]();}module[_0xd543('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 92c65b1..3329815 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 _0x2b06=['MailAccount','\x22%s\x22\x20<%s>','email','Smtp','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','savename','%s.%s','basename','extname','zip','join','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','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','stringify','email\x20sent','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','map','keyBy','toString','difference','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','startAt','endAt','add','add\x20cron','stop\x20cron','cron','active','update','update\x20cron','run','start','util','path','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info'];(function(_0x2d8e64,_0x4327e8){var _0x38bd9b=function(_0x3e2587){while(--_0x3e2587){_0x2d8e64['push'](_0x2d8e64['shift']());}};_0x38bd9b(++_0x4327e8);}(_0x2b06,0xf8));var _0x62b0=function(_0x540160,_0x24c6b6){_0x540160=_0x540160-0x0;var _0x476120=_0x2b06[_0x540160];return _0x476120;};'use strict';var fs=require('fs');var util=require(_0x62b0('0x0'));var path=require(_0x62b0('0x1'));var _=require(_0x62b0('0x2'));var moment=require(_0x62b0('0x3'));var CronJobManager=require(_0x62b0('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0x62b0('0x5'));var logger=require(_0x62b0('0x6'))(_0x62b0('0x7'));var db=require(_0x62b0('0x8'))['db'];var analyticCustomReportController=require(_0x62b0('0x9'));var analyticDefaultReportController=require(_0x62b0('0xa'));var client=jayson[_0x62b0('0xb')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4527f1,_0x35197b){return function(){logger[_0x62b0('0xc')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x4527f1['email']);var _0x3ebac3=!![];var _0x180b69=_0x4527f1[_0x62b0('0xd')]['getSmtpOptions']();var _0x5276ed={'account':_0x180b69,'message':{'from':util['format'](_0x62b0('0xe'),_0x4527f1['MailAccount']['name'],_0x4527f1['MailAccount'][_0x62b0('0xf')]||_0x4527f1['MailAccount'][_0x62b0('0x10')]['user']),'to':_0x4527f1[_0x62b0('0xf')],'cc':_0x4527f1['cc'],'bcc':_0x4527f1['bcc'],'subject':util[_0x62b0('0x11')](_0x62b0('0x12'),_0x35197b[_0x62b0('0x13')],_0x4527f1[_0x62b0('0x14')],_0x4527f1[_0x62b0('0x15')])}};var _0x466ea5=path['join'](__dirname,'../../files/reports');var _0x3310c8=_0x35197b[_0x62b0('0x16')];var _0x5a614f=util[_0x62b0('0x11')](_0x62b0('0x17'),path[_0x62b0('0x18')](_0x35197b[_0x62b0('0x16')],path[_0x62b0('0x19')](_0x35197b['savename'])),_0x62b0('0x1a'));var _0x3fdd2e=path[_0x62b0('0x1b')](_0x466ea5,_0x3310c8);var _0x3f94c1=path[_0x62b0('0x1b')](_0x466ea5,_0x5a614f);if(fs[_0x62b0('0x1c')](_0x3fdd2e)){_0x35197b[_0x62b0('0x1d')]=_0x62b0('0x1e');_0x5276ed[_0x62b0('0x1f')][_0x62b0('0x20')]=[{'filename':_0x3310c8,'path':_0x3fdd2e}];_0x5276ed[_0x62b0('0x1f')][_0x62b0('0x21')]=util[_0x62b0('0x11')](_0x62b0('0x22'),JSON['stringify'](_0x35197b,null,0x2));}else if(fs[_0x62b0('0x1c')](_0x3f94c1)){_0x35197b[_0x62b0('0x1d')]=_0x62b0('0x1e');_0x5276ed[_0x62b0('0x1f')][_0x62b0('0x20')]=[{'filename':_0x5a614f,'path':_0x3f94c1}];}else{_0x5276ed[_0x62b0('0x1f')]['text']=_0x62b0('0x23');if(!_0x4527f1[_0x62b0('0x24')]){_0x3ebac3=![];logger[_0x62b0('0xc')](_0x62b0('0x25'));}}if(_0x3ebac3){return client['request'](_0x62b0('0x26'),_0x5276ed)[_0x62b0('0x27')](function(_0x1cbf9c){if(_0x1cbf9c[_0x62b0('0x28')]){return logger[_0x62b0('0x28')](_0x62b0('0x29'),JSON[_0x62b0('0x2a')](_0x1cbf9c));}return logger[_0x62b0('0xc')](_0x62b0('0x2b'));})['catch'](function(_0x39895f){return logger[_0x62b0('0x28')](_0x62b0('0x29'),JSON[_0x62b0('0x2a')](_0x39895f));});}};}function handleError(){return function(_0x12ac0e){return logger[_0x62b0('0x28')](JSON[_0x62b0('0x2a')](_0x12ac0e));};}function handleResult(_0x3b985d){return function(_0x4d7c9d){logger['info'](_0x62b0('0x2c'),JSON[_0x62b0('0x2a')](_0x4d7c9d));if(_0x3b985d[_0x62b0('0xd')]&&_0x3b985d[_0x62b0('0xd')][_0x62b0('0x10')]&&!_[_0x62b0('0x2d')](_0x3b985d[_0x62b0('0xf')])){setTimeout(handleSendEmail(_0x3b985d,_0x4d7c9d),0x3c*0x3e8);}};}function handleJob(_0x597dd3){return function(){try{if(_[_0x62b0('0x2d')](_0x597dd3[_0x62b0('0x14')])){return logger[_0x62b0('0xc')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x62b0('0x2d')](_0x597dd3['subtractUnit'])){return logger[_0x62b0('0xc')](_0x62b0('0x2e'));}var _0x4fd546={'startDate':moment()[_0x62b0('0x2f')](_0x597dd3[_0x62b0('0x14')],_0x597dd3[_0x62b0('0x15')])[_0x62b0('0x11')](_0x62b0('0x30')),'endDate':moment()[_0x62b0('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x62b0('0x31'),'output':_0x597dd3[_0x62b0('0x32')],'name':_0x597dd3['name']};if(!_[_0x62b0('0x2d')](_0x597dd3[_0x62b0('0x33')])){logger[_0x62b0('0xc')](_0x62b0('0x34'),_0x597dd3[_0x62b0('0x33')]);return analyticDefaultReportController[_0x62b0('0x35')]({'id':_0x597dd3['DefaultReportId']},_0x4fd546)['then'](handleResult(_0x597dd3))[_0x62b0('0x36')](handleError());}if(!_[_0x62b0('0x2d')](_0x597dd3[_0x62b0('0x37')])){logger[_0x62b0('0xc')](_0x62b0('0x38'),_0x597dd3[_0x62b0('0x37')]);return analyticCustomReportController[_0x62b0('0x35')]({'id':_0x597dd3['CustomReportId']},_0x4fd546)[_0x62b0('0x27')](handleResult(_0x597dd3))[_0x62b0('0x36')](handleError());}}catch(_0x34b97a){logger['error'](JSON[_0x62b0('0x2a')](_0x34b97a));}return logger[_0x62b0('0xc')](_0x62b0('0x39'));};}function getJobs(_0x3801b8){var _0x2a1d24={};if(_0x3801b8){_0x2a1d24['id']=_0x3801b8;}return db[_0x62b0('0x3a')]['findAll']({'where':_0x2a1d24,'include':[{'model':db[_0x62b0('0xd')],'attributes':['id',_0x62b0('0x13'),'email'],'include':[{'model':db[_0x62b0('0x3b')],'as':_0x62b0('0x10'),'include':[{'model':db[_0x62b0('0x3c')],'as':_0x62b0('0x3c')}]}]}]})[_0x62b0('0x27')](function(_0x22f797){var _0x43d88b=_[_0x62b0('0x3d')](manager['jobs']);var _0x5c06bb=_[_0x62b0('0x3e')](_0x22f797,function(_0x3c6e6f){return _0x3c6e6f['id']['toString']();});var _0x2beffc=_[_0x62b0('0x3f')](_0x22f797,function(_0x1acaa5){return _0x1acaa5['id'][_0x62b0('0x40')]();});var _0x21f034=_0x3801b8?_0x5c06bb:_[_0x62b0('0x41')](_0x5c06bb,_0x43d88b);var _0x3388e8=_['intersection'](_0x5c06bb,_0x43d88b);var _0x167331=_[_0x62b0('0x41')](_0x43d88b,_0x5c06bb);var _0x5a4f90;var _0x1035b0;for(_0x5a4f90=0x0;_0x5a4f90<_0x167331['length']&&!_0x3801b8;_0x5a4f90+=0x1){_0x1035b0=_0x167331[_0x5a4f90]['toString']();if(manager[_0x62b0('0x42')](_0x1035b0)){manager[_0x62b0('0x43')](_0x1035b0);manager[_0x62b0('0x44')](_0x1035b0);logger[_0x62b0('0xc')](_0x62b0('0x45'),_0x1035b0);}}logger[_0x62b0('0xc')](_0x62b0('0x46'),JSON['stringify'](_0x21f034));for(_0x5a4f90=0x0;_0x5a4f90<_0x21f034[_0x62b0('0x47')];_0x5a4f90+=0x1){_0x1035b0=_0x21f034[_0x5a4f90][_0x62b0('0x40')]();logger[_0x62b0('0xc')](_0x62b0('0x48'),_0x1035b0);if(_0x3801b8){logger[_0x62b0('0xc')](_0x62b0('0x49'),_0x3801b8);logger[_0x62b0('0xc')](JSON[_0x62b0('0x2a')](_0x2beffc[_0x1035b0]));BPromise[_0x62b0('0x4a')]()[_0x62b0('0x27')](handleJob(_0x2beffc[_0x1035b0]));logger[_0x62b0('0xc')](_0x62b0('0x4b'),_0x2beffc[_0x1035b0][_0x62b0('0x13')],_0x2beffc[_0x1035b0]['cron']);}else if(_0x2beffc[_0x1035b0]['cron']&&_0x2beffc[_0x1035b0]['active']&&moment()['isBetween'](_0x2beffc[_0x1035b0][_0x62b0('0x4c')],_0x2beffc[_0x1035b0][_0x62b0('0x4d')])){manager[_0x62b0('0x4e')](_0x1035b0,_0x2beffc[_0x1035b0]['cron'],handleJob(_0x2beffc[_0x1035b0]));manager['start'](_0x1035b0);logger[_0x62b0('0xc')](_0x62b0('0x4f'),_0x2beffc[_0x1035b0]['name'],_0x2beffc[_0x1035b0]['cron']);}else if(manager[_0x62b0('0x42')](_0x1035b0)){manager['stop'](_0x1035b0);manager[_0x62b0('0x44')](_0x1035b0);logger[_0x62b0('0xc')](_0x62b0('0x50'),_0x2beffc[_0x1035b0][_0x62b0('0x13')],_0x2beffc[_0x1035b0][_0x62b0('0x51')]);}}for(_0x5a4f90=0x0,_0x1035b0;_0x5a4f90<_0x3388e8[_0x62b0('0x47')]&&!_0x3801b8;_0x5a4f90+=0x1){_0x1035b0=_0x3388e8[_0x5a4f90][_0x62b0('0x40')]();if(manager[_0x62b0('0x42')](_0x1035b0)){if(_0x2beffc[_0x1035b0][_0x62b0('0x51')]&&_0x2beffc[_0x1035b0][_0x62b0('0x52')]&&moment()['isBetween'](_0x2beffc[_0x1035b0][_0x62b0('0x4c')],_0x2beffc[_0x1035b0][_0x62b0('0x4d')])){manager[_0x62b0('0x53')](_0x1035b0,_0x2beffc[_0x1035b0][_0x62b0('0x51')],handleJob(_0x2beffc[_0x1035b0]));logger[_0x62b0('0xc')](_0x62b0('0x54'),_0x2beffc[_0x1035b0][_0x62b0('0x13')],_0x2beffc[_0x1035b0]['cron']);}else{manager[_0x62b0('0x43')](_0x1035b0);manager[_0x62b0('0x44')](_0x1035b0);logger['info'](_0x62b0('0x50'),_0x2beffc[_0x1035b0]['name'],_0x2beffc[_0x1035b0][_0x62b0('0x51')]);}}}})[_0x62b0('0x36')](function(_0x1da8a2){logger[_0x62b0('0x28')](JSON['stringify'](_0x1da8a2));});}exports[_0x62b0('0x55')]=function(_0x284aed){return getJobs(_0x284aed);};exports[_0x62b0('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xc2db=['index','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add\x20cron','exists','stop\x20cron','update\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','user','email','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','extname','zip','join','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','existsSync','text','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','stringify','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','exec\x20custom\x20report\x20id:%s','CustomReportId','runReport','CloudProvider','keys','jobs','map','keyBy','toString','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun'];(function(_0x456f6c,_0x44e3cc){var _0x5f2030=function(_0x1142e2){while(--_0x1142e2){_0x456f6c['push'](_0x456f6c['shift']());}};_0x5f2030(++_0x44e3cc);}(_0xc2db,0x100));var _0xbc2d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc2db[_0x1facfa];return _0x9ec701;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xbc2d('0x0'));var _=require(_0xbc2d('0x1'));var moment=require(_0xbc2d('0x2'));var CronJobManager=require(_0xbc2d('0x3'));var jayson=require(_0xbc2d('0x4'));var BPromise=require(_0xbc2d('0x5'));var logger=require(_0xbc2d('0x6'))('schedule');var db=require(_0xbc2d('0x7'))['db'];var analyticCustomReportController=require(_0xbc2d('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xbc2d('0x9')][_0xbc2d('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x49f460,_0x10f964){return function(){logger[_0xbc2d('0xb')](_0xbc2d('0xc'),_0x49f460['email']);var _0x69a888=!![];var _0x4e68bb=_0x49f460[_0xbc2d('0xd')]['getSmtpOptions']();var _0x296dbc={'account':_0x4e68bb,'message':{'from':util[_0xbc2d('0xe')](_0xbc2d('0xf'),_0x49f460[_0xbc2d('0xd')][_0xbc2d('0x10')],_0x49f460[_0xbc2d('0xd')]['email']||_0x49f460['MailAccount'][_0xbc2d('0x11')][_0xbc2d('0x12')]),'to':_0x49f460[_0xbc2d('0x13')],'cc':_0x49f460['cc'],'bcc':_0x49f460['bcc'],'subject':util['format'](_0xbc2d('0x14'),_0x10f964['name'],_0x49f460[_0xbc2d('0x15')],_0x49f460[_0xbc2d('0x16')])}};var _0x2a8bd9=path['join'](__dirname,_0xbc2d('0x17'));var _0x14a8b8=_0x10f964[_0xbc2d('0x18')];var _0x44f25f=util[_0xbc2d('0xe')](_0xbc2d('0x19'),path['basename'](_0x10f964[_0xbc2d('0x18')],path[_0xbc2d('0x1a')](_0x10f964['savename'])),_0xbc2d('0x1b'));var _0x27b63c=path[_0xbc2d('0x1c')](_0x2a8bd9,_0x14a8b8);var _0xfd7690=path[_0xbc2d('0x1c')](_0x2a8bd9,_0x44f25f);if(fs['existsSync'](_0x27b63c)){_0x10f964[_0xbc2d('0x1d')]=_0xbc2d('0x1e');_0x296dbc[_0xbc2d('0x1f')][_0xbc2d('0x20')]=[{'filename':_0x14a8b8,'path':_0x27b63c}];_0x296dbc[_0xbc2d('0x1f')]['text']=util['format'](_0xbc2d('0x21'),JSON['stringify'](_0x10f964,null,0x2));}else if(fs[_0xbc2d('0x22')](_0xfd7690)){_0x10f964[_0xbc2d('0x1d')]=_0xbc2d('0x1e');_0x296dbc[_0xbc2d('0x1f')][_0xbc2d('0x20')]=[{'filename':_0x44f25f,'path':_0xfd7690}];}else{_0x296dbc[_0xbc2d('0x1f')][_0xbc2d('0x23')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x49f460[_0xbc2d('0x24')]){_0x69a888=![];logger[_0xbc2d('0xb')](_0xbc2d('0x25'));}}if(_0x69a888){return client[_0xbc2d('0x26')](_0xbc2d('0x27'),_0x296dbc)[_0xbc2d('0x28')](function(_0x4aa0f4){if(_0x4aa0f4[_0xbc2d('0x29')]){return logger[_0xbc2d('0x29')]('error\x20mail',JSON[_0xbc2d('0x2a')](_0x4aa0f4));}return logger[_0xbc2d('0xb')](_0xbc2d('0x2b'));})[_0xbc2d('0x2c')](function(_0x22fdfb){return logger[_0xbc2d('0x29')]('error\x20mail',JSON[_0xbc2d('0x2a')](_0x22fdfb));});}};}function handleError(){return function(_0x126edf){return logger[_0xbc2d('0x29')](JSON['stringify'](_0x126edf));};}function handleResult(_0x13c899){return function(_0xff915f){logger[_0xbc2d('0xb')]('data',JSON[_0xbc2d('0x2a')](_0xff915f));if(_0x13c899[_0xbc2d('0xd')]&&_0x13c899[_0xbc2d('0xd')][_0xbc2d('0x11')]&&!_[_0xbc2d('0x2d')](_0x13c899[_0xbc2d('0x13')])){setTimeout(handleSendEmail(_0x13c899,_0xff915f),0x3c*0x3e8);}};}function handleJob(_0x541789){return function(){try{if(_[_0xbc2d('0x2d')](_0x541789[_0xbc2d('0x15')])){return logger[_0xbc2d('0xb')](_0xbc2d('0x2e'));}if(_[_0xbc2d('0x2d')](_0x541789[_0xbc2d('0x16')])){return logger[_0xbc2d('0xb')](_0xbc2d('0x2f'));}var _0x157968={'startDate':moment()[_0xbc2d('0x30')](_0x541789[_0xbc2d('0x15')],_0x541789[_0xbc2d('0x16')])[_0xbc2d('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0xbc2d('0x31')),'type':_0xbc2d('0x32'),'output':_0x541789['output'],'name':_0x541789[_0xbc2d('0x10')]};if(!_['isNil'](_0x541789['DefaultReportId'])){logger[_0xbc2d('0xb')](_0xbc2d('0x33'),_0x541789['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x541789['DefaultReportId']},_0x157968)[_0xbc2d('0x28')](handleResult(_0x541789))[_0xbc2d('0x2c')](handleError());}if(!_[_0xbc2d('0x2d')](_0x541789['CustomReportId'])){logger['info'](_0xbc2d('0x34'),_0x541789[_0xbc2d('0x35')]);return analyticCustomReportController[_0xbc2d('0x36')]({'id':_0x541789[_0xbc2d('0x35')]},_0x157968)[_0xbc2d('0x28')](handleResult(_0x541789))[_0xbc2d('0x2c')](handleError());}}catch(_0x37f3e8){logger['error'](JSON[_0xbc2d('0x2a')](_0x37f3e8));}return logger[_0xbc2d('0xb')]('no\x20report\x20id');};}function getJobs(_0x35a089){var _0xc120bc={};if(_0x35a089){_0xc120bc['id']=_0x35a089;}return db['Schedule']['findAll']({'where':_0xc120bc,'include':[{'model':db['MailAccount'],'attributes':['id','name',_0xbc2d('0x13')],'include':[{'model':db['MailServerOut'],'as':_0xbc2d('0x11'),'include':[{'model':db['CloudProvider'],'as':_0xbc2d('0x37')}]}]}]})[_0xbc2d('0x28')](function(_0x2bb386){var _0xf0aa3c=_[_0xbc2d('0x38')](manager[_0xbc2d('0x39')]);var _0x25bb28=_[_0xbc2d('0x3a')](_0x2bb386,function(_0x5254dd){return _0x5254dd['id']['toString']();});var _0x458b12=_[_0xbc2d('0x3b')](_0x2bb386,function(_0x35ead7){return _0x35ead7['id'][_0xbc2d('0x3c')]();});var _0x4f1d61=_0x35a089?_0x25bb28:_[_0xbc2d('0x3d')](_0x25bb28,_0xf0aa3c);var _0x176fd2=_[_0xbc2d('0x3e')](_0x25bb28,_0xf0aa3c);var _0x4d088c=_[_0xbc2d('0x3d')](_0xf0aa3c,_0x25bb28);var _0x59a6a9;var _0x4e97e4;for(_0x59a6a9=0x0;_0x59a6a9<_0x4d088c[_0xbc2d('0x3f')]&&!_0x35a089;_0x59a6a9+=0x1){_0x4e97e4=_0x4d088c[_0x59a6a9]['toString']();if(manager['exists'](_0x4e97e4)){manager[_0xbc2d('0x40')](_0x4e97e4);manager[_0xbc2d('0x41')](_0x4e97e4);logger[_0xbc2d('0xb')](_0xbc2d('0x42'),_0x4e97e4);}}logger['info'](_0xbc2d('0x43'),JSON[_0xbc2d('0x2a')](_0x4f1d61));for(_0x59a6a9=0x0;_0x59a6a9<_0x4f1d61['length'];_0x59a6a9+=0x1){_0x4e97e4=_0x4f1d61[_0x59a6a9][_0xbc2d('0x3c')]();logger['info'](_0xbc2d('0x44'),_0x4e97e4);if(_0x35a089){logger[_0xbc2d('0xb')]('my\x20id',_0x35a089);logger[_0xbc2d('0xb')](JSON[_0xbc2d('0x2a')](_0x458b12[_0x4e97e4]));BPromise[_0xbc2d('0x45')]()['then'](handleJob(_0x458b12[_0x4e97e4]));logger[_0xbc2d('0xb')](_0xbc2d('0x46'),_0x458b12[_0x4e97e4][_0xbc2d('0x10')],_0x458b12[_0x4e97e4][_0xbc2d('0x47')]);}else if(_0x458b12[_0x4e97e4][_0xbc2d('0x47')]&&_0x458b12[_0x4e97e4][_0xbc2d('0x48')]&&moment()[_0xbc2d('0x49')](_0x458b12[_0x4e97e4][_0xbc2d('0x4a')],_0x458b12[_0x4e97e4][_0xbc2d('0x4b')])){manager['add'](_0x4e97e4,_0x458b12[_0x4e97e4][_0xbc2d('0x47')],handleJob(_0x458b12[_0x4e97e4]));manager['start'](_0x4e97e4);logger[_0xbc2d('0xb')](_0xbc2d('0x4c'),_0x458b12[_0x4e97e4]['name'],_0x458b12[_0x4e97e4][_0xbc2d('0x47')]);}else if(manager[_0xbc2d('0x4d')](_0x4e97e4)){manager[_0xbc2d('0x40')](_0x4e97e4);manager[_0xbc2d('0x41')](_0x4e97e4);logger[_0xbc2d('0xb')](_0xbc2d('0x4e'),_0x458b12[_0x4e97e4][_0xbc2d('0x10')],_0x458b12[_0x4e97e4]['cron']);}}for(_0x59a6a9=0x0,_0x4e97e4;_0x59a6a9<_0x176fd2[_0xbc2d('0x3f')]&&!_0x35a089;_0x59a6a9+=0x1){_0x4e97e4=_0x176fd2[_0x59a6a9][_0xbc2d('0x3c')]();if(manager[_0xbc2d('0x4d')](_0x4e97e4)){if(_0x458b12[_0x4e97e4][_0xbc2d('0x47')]&&_0x458b12[_0x4e97e4][_0xbc2d('0x48')]&&moment()[_0xbc2d('0x49')](_0x458b12[_0x4e97e4]['startAt'],_0x458b12[_0x4e97e4][_0xbc2d('0x4b')])){manager['update'](_0x4e97e4,_0x458b12[_0x4e97e4][_0xbc2d('0x47')],handleJob(_0x458b12[_0x4e97e4]));logger[_0xbc2d('0xb')](_0xbc2d('0x4f'),_0x458b12[_0x4e97e4][_0xbc2d('0x10')],_0x458b12[_0x4e97e4]['cron']);}else{manager[_0xbc2d('0x40')](_0x4e97e4);manager[_0xbc2d('0x41')](_0x4e97e4);logger['info']('stop\x20cron',_0x458b12[_0x4e97e4][_0xbc2d('0x10')],_0x458b12[_0x4e97e4][_0xbc2d('0x47')]);}}}})[_0xbc2d('0x2c')](function(_0x11b4b6){logger[_0xbc2d('0x29')](JSON[_0xbc2d('0x2a')](_0x11b4b6));});}exports[_0xbc2d('0x50')]=function(_0x271fea){return getJobs(_0x271fea);};exports['start']=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 eaf0651..621c0a5 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 _0x30d3=['inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','catch','start','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','Transcript','TranscriptFileUri','info','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','fileText','length','transcript','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','update','Sentiment','SentimentScore','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Negative','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30d3,0x9f));var _0x330d=function(_0x3db43e,_0x25c9b9){_0x3db43e=_0x3db43e-0x0;var _0x2d7e82=_0x30d3[_0x3db43e];return _0x2d7e82;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x330d('0x0'));var util=require(_0x330d('0x1'));var BPromise=require(_0x330d('0x2'));var db=require(_0x330d('0x3'))['db'];var logger=require(_0x330d('0x4'))(_0x330d('0x5'));function getTranscriptionJob(_0x447dbb,_0x51cee8,_0x37fe02,_0x3b3165){return new Promise(function(_0xd8503,_0x2a330f){var _0x5ee451=new AWS['TranscribeService']({'accessKeyId':_0x51cee8,'secretAccessKey':_0x447dbb,'region':_0x37fe02});_0x5ee451[_0x330d('0x6')]({'TranscriptionJobName':_0x3b3165},function(_0x410a37,_0x1342e7){if(_0x410a37){return _0x2a330f(_0x410a37);}else{return _0xd8503(_0x1342e7);}});});}function sentiment(_0x432840,_0x53bc72,_0x5f137f,_0x22a8ba,_0x151f9a){return new Promise(function(_0x39d171,_0x340980){var _0x2eb0bc=new AWS[(_0x330d('0x7'))]({'accessKeyId':_0x53bc72,'secretAccessKey':_0x432840,'region':_0x5f137f});_0x2eb0bc[_0x330d('0x8')]({'Text':_0x22a8ba,'LanguageCode':_0x151f9a['substring'](0x0,0x2)},function(_0x3b8feb,_0x548353){if(_0x3b8feb){return _0x340980(_0x3b8feb);}else{return _0x39d171(_0x548353);}});});}function checkTranscribeJob(_0x1ad0ee,_0x55eb0e,_0x416b93){var _0xb093cd;return new BPromise(function(_0x3a0f89,_0x20c90f){logger['info'](util[_0x330d('0x9')](_0x330d('0xa'),_0x1ad0ee['id'],_0x1ad0ee['transcribeName']));return getTranscriptionJob(_0x416b93[_0x330d('0xb')],_0x416b93['data2'],_0x55eb0e[_0x330d('0xc')],_0x1ad0ee[_0x330d('0xd')])[_0x330d('0xe')](function(_0x5e5baf){logger['info'](util[_0x330d('0x9')](_0x330d('0xf'),_0x1ad0ee['id'],_0x1ad0ee[_0x330d('0xd')],_0x5e5baf['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x1ad0ee['fileText']){switch(_0x5e5baf[_0x330d('0x10')]['TranscriptionJobStatus']){case'COMPLETED':var _0x435083={'transcribeStatus':_0x5e5baf[_0x330d('0x10')]['TranscriptionJobStatus'],'fileUri':_0x5e5baf[_0x330d('0x10')][_0x330d('0x11')][_0x330d('0x12')]};logger[_0x330d('0x13')](util[_0x330d('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x1ad0ee['id']));return rp({'uri':_0x5e5baf['TranscriptionJob'][_0x330d('0x11')]['TranscriptFileUri'],'json':!![]})[_0x330d('0xe')](function(_0x2e876b){logger[_0x330d('0x13')](util['format'](_0x330d('0x14'),_0x1ad0ee['id']));if(_0x2e876b&&_0x2e876b[_0x330d('0x15')]&&_0x2e876b['results']['transcripts']&&_0x2e876b[_0x330d('0x15')][_0x330d('0x16')]['length']){_0x435083[_0x330d('0x17')]='';for(var _0x19c2f2=0x0;_0x19c2f2<_0x2e876b['results']['transcripts'][_0x330d('0x18')];_0x19c2f2++){_0x435083[_0x330d('0x17')]+=_0x2e876b[_0x330d('0x15')][_0x330d('0x16')][_0x19c2f2][_0x330d('0x19')]+'';}}return _0x1ad0ee['update'](_0x435083);})['then'](function(){logger[_0x330d('0x13')](util[_0x330d('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1ad0ee['id']));if(!_0x1ad0ee[_0x330d('0x1a')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x1d'));}if(!_0x55eb0e[_0x330d('0x1e')]||!_0x55eb0e[_0x330d('0x1f')]||!_0x55eb0e['sentimentRegion']||!_0x55eb0e[_0x330d('0x20')]||!_0x55eb0e['bucket']){throw new db['Sequelize'][(_0x330d('0x1c'))](_0x330d('0x21'));}if(!_0x435083[_0x330d('0x17')]){throw new Error(_0x330d('0x22'));}if(_0x55eb0e[_0x330d('0x1f')]===_0x416b93['id']){return _0x416b93;}else{return db[_0x330d('0x23')][_0x330d('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x330d('0xe')](function(_0xe071ff){if(!_0xe071ff){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x25'));}if(!_0xe071ff[_0x330d('0xb')]||!_0xe071ff[_0x330d('0x26')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x27'));}_0xb093cd=_0xe071ff;logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x28'),_0x1ad0ee['id']));return sentiment(_0xb093cd['data1'],_0xb093cd['data2'],_0x55eb0e[_0x330d('0x29')],_0x435083[_0x330d('0x17')],_0x55eb0e[_0x330d('0x20')]);})[_0x330d('0xe')](function(_0x456431){logger[_0x330d('0x13')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1ad0ee['id']));return _0x1ad0ee[_0x330d('0x2a')]({'sentiment':_0x456431[_0x330d('0x2b')],'sPositive':_0x456431[_0x330d('0x2c')]['Positive'],'sNegative':_0x456431[_0x330d('0x2c')]['Negative'],'sMixed':_0x456431[_0x330d('0x2c')][_0x330d('0x2d')],'sNeutral':_0x456431[_0x330d('0x2c')][_0x330d('0x2e')]});})[_0x330d('0xe')](function(){logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x2f'),_0x1ad0ee['id']));_0x3a0f89();});case _0x330d('0x30'):return _0x1ad0ee[_0x330d('0x2a')]({'transcribeStatus':_0x330d('0x30'),'failureReason':_0x5e5baf[_0x330d('0x10')]['FailureReason']})['then'](function(){logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x2f'),_0x1ad0ee['id']));_0x3a0f89();});default:logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x31'),_0x1ad0ee['id']));break;}}else{return BPromise[_0x330d('0x32')]()[_0x330d('0xe')](function(){if(!_0x1ad0ee['tempSentiment']){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x55eb0e[_0x330d('0x1e')]||!_0x55eb0e[_0x330d('0x1f')]||!_0x55eb0e[_0x330d('0x29')]||!_0x55eb0e[_0x330d('0x20')]||!_0x55eb0e[_0x330d('0x33')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x21'));}if(!_0x1ad0ee[_0x330d('0x17')]){throw new Error(_0x330d('0x22'));}if(_0x55eb0e[_0x330d('0x1f')]===_0x416b93['id']){return _0x416b93;}else{return db[_0x330d('0x23')][_0x330d('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0xd0af59){if(!_0xd0af59){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x25'));}if(!_0xd0af59[_0x330d('0xb')]||!_0xd0af59[_0x330d('0x26')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x27'));}_0xb093cd=_0xd0af59;logger['info'](util['format'](_0x330d('0x28'),_0x1ad0ee['id']));return sentiment(_0xb093cd[_0x330d('0xb')],_0xb093cd[_0x330d('0x26')],_0x55eb0e[_0x330d('0x29')],_0x1ad0ee[_0x330d('0x17')],_0x55eb0e[_0x330d('0x20')]);})[_0x330d('0xe')](function(_0x5dab16){logger['info'](util[_0x330d('0x9')](_0x330d('0x34'),_0x1ad0ee['id']));return _0x1ad0ee['update']({'sentiment':_0x5dab16[_0x330d('0x2b')],'sPositive':_0x5dab16[_0x330d('0x2c')][_0x330d('0x35')],'sNegative':_0x5dab16[_0x330d('0x2c')][_0x330d('0x36')],'sMixed':_0x5dab16['SentimentScore'][_0x330d('0x2d')],'sNeutral':_0x5dab16[_0x330d('0x2c')][_0x330d('0x2e')],'transcribeStatus':_0x330d('0x37')});})[_0x330d('0xe')](function(){logger['info'](util[_0x330d('0x9')](_0x330d('0x2f'),_0x1ad0ee['id']));_0x3a0f89();});}})['catch'](function(_0x3264d0){if(_0x3264d0){if(!_0x3264d0['name']||_0x3264d0[_0x330d('0x38')]!==_0x330d('0x39')){logger[_0x330d('0x3a')](util[_0x330d('0x9')](_0x330d('0x3b'),_0x1ad0ee['id']),util[_0x330d('0x3c')](_0x3264d0,{'showHidden':![],'depth':null}));}}_0x3a0f89();});});}function checkTranscribe(){var _0xa802b7;var _0x36393b;var _0x460ec4;return db[_0x330d('0x3d')][_0x330d('0x3e')]({'where':{'transcribeStatus':_0x330d('0x3f')}})[_0x330d('0xe')](function(_0xadbd06){if(!_0xadbd06||!_0xadbd06[_0x330d('0x18')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x40'));}_0xa802b7=_0xadbd06;return db[_0x330d('0x41')][_0x330d('0x24')]({'where':{'id':0x1}});})[_0x330d('0xe')](function(_0x46de6d){if(!_0x46de6d){throw new db[(_0x330d('0x1b'))]['ValidationError']('Settings\x20not\x20available');}_0x36393b=_0x46de6d;if(!_0x36393b[_0x330d('0x5')]||!_0x36393b['transcribeAccountId']||!_0x36393b[_0x330d('0xc')]||!_0x36393b[_0x330d('0x20')]||!_0x36393b['bucket']){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x42'));}return db['CloudProvider'][_0x330d('0x24')]({'where':{'id':_0x36393b[_0x330d('0x43')]}});})[_0x330d('0xe')](function(_0x47dc86){if(!_0x47dc86){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x25'));}if(!_0x47dc86[_0x330d('0xb')]||!_0x47dc86[_0x330d('0x26')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x27'));}_0x460ec4=_0x47dc86;var _0xc00ee8=[];_0xa802b7[_0x330d('0x44')](function(_0x438d23){_0xc00ee8[_0x330d('0x45')](checkTranscribeJob(_0x438d23,_0x36393b,_0x460ec4));});return BPromise[_0x330d('0x46')](_0xc00ee8);})[_0x330d('0x47')](function(_0x4e1998){if(_0x4e1998){if(!_0x4e1998['name']||_0x4e1998['name']!==_0x330d('0x39')){logger[_0x330d('0x3a')](util[_0x330d('0x3c')](_0x4e1998,{'showHidden':![],'depth':null}));}}});}exports[_0x330d('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xa571=['COMPLETED','info','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','sentiment','sentimentAccountId','language','bucket','Sequelize','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','resolve','Sentiment\x20Analysis\x20not\x20requested','Sentiment\x20Analysis\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','findOne','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob'];(function(_0x3190bb,_0xe7c617){var _0x128439=function(_0x47deff){while(--_0x47deff){_0x3190bb['push'](_0x3190bb['shift']());}};_0x128439(++_0xe7c617);}(_0xa571,0x107));var _0x1a57=function(_0x264960,_0x36a3f2){_0x264960=_0x264960-0x0;var _0x580987=_0xa571[_0x264960];return _0x580987;};var _=require(_0x1a57('0x0'));var AWS=require(_0x1a57('0x1'));var rp=require(_0x1a57('0x2'));var util=require(_0x1a57('0x3'));var BPromise=require('bluebird');var db=require(_0x1a57('0x4'))['db'];var logger=require(_0x1a57('0x5'))('transcribe');function getTranscriptionJob(_0x5ec815,_0x1f2c44,_0x5067fa,_0xa58922){return new Promise(function(_0xd97a33,_0x22ca20){var _0x3c5352=new AWS[(_0x1a57('0x6'))]({'accessKeyId':_0x1f2c44,'secretAccessKey':_0x5ec815,'region':_0x5067fa});_0x3c5352[_0x1a57('0x7')]({'TranscriptionJobName':_0xa58922},function(_0x5d9f45,_0x3edb40){if(_0x5d9f45){return _0x22ca20(_0x5d9f45);}else{return _0xd97a33(_0x3edb40);}});});}function sentiment(_0x3d5770,_0x3631d6,_0x58e266,_0x3c8182,_0x1f7086){return new Promise(function(_0x4740ef,_0x289dc0){var _0x831937=new AWS[(_0x1a57('0x8'))]({'accessKeyId':_0x3631d6,'secretAccessKey':_0x3d5770,'region':_0x58e266});_0x831937[_0x1a57('0x9')]({'Text':_0x3c8182,'LanguageCode':_0x1f7086[_0x1a57('0xa')](0x0,0x2)},function(_0x571607,_0x562fa4){if(_0x571607){return _0x289dc0(_0x571607);}else{return _0x4740ef(_0x562fa4);}});});}function checkTranscribeJob(_0x2256af,_0x1911b2,_0x202d9a){var _0x5ae643;return new BPromise(function(_0x3de36a,_0x18eec5){logger['info'](util[_0x1a57('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x2256af['id'],_0x2256af[_0x1a57('0xc')]));return getTranscriptionJob(_0x202d9a[_0x1a57('0xd')],_0x202d9a[_0x1a57('0xe')],_0x1911b2[_0x1a57('0xf')],_0x2256af['transcribeName'])[_0x1a57('0x10')](function(_0x53c61f){logger['info'](util[_0x1a57('0xb')](_0x1a57('0x11'),_0x2256af['id'],_0x2256af[_0x1a57('0xc')],_0x53c61f['TranscriptionJob'][_0x1a57('0x12')]));if(!_0x2256af[_0x1a57('0x13')]){switch(_0x53c61f[_0x1a57('0x14')]['TranscriptionJobStatus']){case _0x1a57('0x15'):var _0x4262c8={'transcribeStatus':_0x53c61f[_0x1a57('0x14')][_0x1a57('0x12')],'fileUri':_0x53c61f[_0x1a57('0x14')]['Transcript']['TranscriptFileUri']};logger[_0x1a57('0x16')](util[_0x1a57('0xb')](_0x1a57('0x17'),_0x2256af['id']));return rp({'uri':_0x53c61f['TranscriptionJob']['Transcript']['TranscriptFileUri'],'json':!![]})[_0x1a57('0x10')](function(_0x113ad4){logger[_0x1a57('0x16')](util[_0x1a57('0xb')](_0x1a57('0x18'),_0x2256af['id']));if(_0x113ad4&&_0x113ad4[_0x1a57('0x19')]&&_0x113ad4[_0x1a57('0x19')][_0x1a57('0x1a')]&&_0x113ad4[_0x1a57('0x19')][_0x1a57('0x1a')][_0x1a57('0x1b')]){_0x4262c8[_0x1a57('0x13')]='';for(var _0x26cdd3=0x0;_0x26cdd3<_0x113ad4[_0x1a57('0x19')][_0x1a57('0x1a')][_0x1a57('0x1b')];_0x26cdd3++){_0x4262c8[_0x1a57('0x13')]+=_0x113ad4[_0x1a57('0x19')][_0x1a57('0x1a')][_0x26cdd3][_0x1a57('0x1c')]+'';}}return _0x2256af[_0x1a57('0x1d')](_0x4262c8);})[_0x1a57('0x10')](function(){logger['info'](util['format'](_0x1a57('0x1e'),_0x2256af['id']));if(!_0x2256af[_0x1a57('0x1f')]){throw new db['Sequelize'][(_0x1a57('0x20'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1911b2[_0x1a57('0x21')]||!_0x1911b2[_0x1a57('0x22')]||!_0x1911b2['sentimentRegion']||!_0x1911b2[_0x1a57('0x23')]||!_0x1911b2[_0x1a57('0x24')]){throw new db[(_0x1a57('0x25'))][(_0x1a57('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4262c8[_0x1a57('0x13')]){throw new Error(_0x1a57('0x26'));}if(_0x1911b2[_0x1a57('0x22')]===_0x202d9a['id']){return _0x202d9a;}else{return db[_0x1a57('0x27')]['findOne']({'where':{'id':_settings[_0x1a57('0x22')]}});}})[_0x1a57('0x10')](function(_0x139fc9){if(!_0x139fc9){throw new db[(_0x1a57('0x25'))][(_0x1a57('0x20'))](_0x1a57('0x28'));}if(!_0x139fc9[_0x1a57('0xd')]||!_0x139fc9[_0x1a57('0xe')]){throw new db[(_0x1a57('0x25'))]['ValidationError'](_0x1a57('0x29'));}_0x5ae643=_0x139fc9;logger[_0x1a57('0x16')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2256af['id']));return sentiment(_0x5ae643[_0x1a57('0xd')],_0x5ae643[_0x1a57('0xe')],_0x1911b2[_0x1a57('0x2a')],_0x4262c8[_0x1a57('0x13')],_0x1911b2[_0x1a57('0x23')]);})[_0x1a57('0x10')](function(_0xe80d94){logger[_0x1a57('0x16')](util[_0x1a57('0xb')](_0x1a57('0x2b'),_0x2256af['id']));return _0x2256af[_0x1a57('0x1d')]({'sentiment':_0xe80d94[_0x1a57('0x2c')],'sPositive':_0xe80d94[_0x1a57('0x2d')][_0x1a57('0x2e')],'sNegative':_0xe80d94[_0x1a57('0x2d')][_0x1a57('0x2f')],'sMixed':_0xe80d94[_0x1a57('0x2d')][_0x1a57('0x30')],'sNeutral':_0xe80d94['SentimentScore'][_0x1a57('0x31')]});})[_0x1a57('0x10')](function(){logger[_0x1a57('0x16')](util[_0x1a57('0xb')](_0x1a57('0x1e'),_0x2256af['id']));_0x3de36a();});case _0x1a57('0x32'):return _0x2256af[_0x1a57('0x1d')]({'transcribeStatus':_0x1a57('0x32'),'failureReason':_0x53c61f[_0x1a57('0x14')]['FailureReason']})['then'](function(){logger['info'](util['format'](_0x1a57('0x1e'),_0x2256af['id']));_0x3de36a();});default:logger[_0x1a57('0x16')](util[_0x1a57('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x2256af['id']));break;}}else{return BPromise[_0x1a57('0x33')]()[_0x1a57('0x10')](function(){if(!_0x2256af[_0x1a57('0x1f')]){throw new db[(_0x1a57('0x25'))]['ValidationError'](_0x1a57('0x34'));}if(!_0x1911b2['sentiment']||!_0x1911b2[_0x1a57('0x22')]||!_0x1911b2[_0x1a57('0x2a')]||!_0x1911b2[_0x1a57('0x23')]||!_0x1911b2['bucket']){throw new db[(_0x1a57('0x25'))][(_0x1a57('0x20'))](_0x1a57('0x35'));}if(!_0x2256af[_0x1a57('0x13')]){throw new Error(_0x1a57('0x26'));}if(_0x1911b2['sentimentAccountId']===_0x202d9a['id']){return _0x202d9a;}else{return db[_0x1a57('0x27')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0x1a57('0x10')](function(_0x5b42bd){if(!_0x5b42bd){throw new db[(_0x1a57('0x25'))][(_0x1a57('0x20'))](_0x1a57('0x28'));}if(!_0x5b42bd['data1']||!_0x5b42bd[_0x1a57('0xe')]){throw new db[(_0x1a57('0x25'))][(_0x1a57('0x20'))](_0x1a57('0x29'));}_0x5ae643=_0x5b42bd;logger['info'](util[_0x1a57('0xb')](_0x1a57('0x36'),_0x2256af['id']));return sentiment(_0x5ae643['data1'],_0x5ae643[_0x1a57('0xe')],_0x1911b2['sentimentRegion'],_0x2256af['fileText'],_0x1911b2[_0x1a57('0x23')]);})[_0x1a57('0x10')](function(_0x3248d5){logger[_0x1a57('0x16')](util['format'](_0x1a57('0x2b'),_0x2256af['id']));return _0x2256af[_0x1a57('0x1d')]({'sentiment':_0x3248d5[_0x1a57('0x2c')],'sPositive':_0x3248d5[_0x1a57('0x2d')][_0x1a57('0x2e')],'sNegative':_0x3248d5['SentimentScore'][_0x1a57('0x2f')],'sMixed':_0x3248d5[_0x1a57('0x2d')][_0x1a57('0x30')],'sNeutral':_0x3248d5[_0x1a57('0x2d')]['Neutral'],'transcribeStatus':_0x1a57('0x15')});})['then'](function(){logger[_0x1a57('0x16')](util[_0x1a57('0xb')](_0x1a57('0x1e'),_0x2256af['id']));_0x3de36a();});}})[_0x1a57('0x37')](function(_0x574313){if(_0x574313){if(!_0x574313[_0x1a57('0x38')]||_0x574313[_0x1a57('0x38')]!==_0x1a57('0x39')){logger[_0x1a57('0x3a')](util[_0x1a57('0xb')](_0x1a57('0x3b'),_0x2256af['id']),util[_0x1a57('0x3c')](_0x574313,{'showHidden':![],'depth':null}));}}_0x3de36a();});});}function checkTranscribe(){var _0x475088;var _0x47f9da;var _0xf4d056;return db[_0x1a57('0x3d')][_0x1a57('0x3e')]({'where':{'transcribeStatus':_0x1a57('0x3f')}})[_0x1a57('0x10')](function(_0x28ebdd){if(!_0x28ebdd||!_0x28ebdd[_0x1a57('0x1b')]){throw new db[(_0x1a57('0x25'))][(_0x1a57('0x20'))](_0x1a57('0x40'));}_0x475088=_0x28ebdd;return db[_0x1a57('0x41')]['findOne']({'where':{'id':0x1}});})[_0x1a57('0x10')](function(_0x439a42){if(!_0x439a42){throw new db['Sequelize'][(_0x1a57('0x20'))](_0x1a57('0x42'));}_0x47f9da=_0x439a42;if(!_0x47f9da['transcribe']||!_0x47f9da[_0x1a57('0x43')]||!_0x47f9da[_0x1a57('0xf')]||!_0x47f9da['language']||!_0x47f9da['bucket']){throw new db['Sequelize'][(_0x1a57('0x20'))](_0x1a57('0x44'));}return db['CloudProvider'][_0x1a57('0x45')]({'where':{'id':_0x47f9da[_0x1a57('0x43')]}});})['then'](function(_0x5e510e){if(!_0x5e510e){throw new db['Sequelize'][(_0x1a57('0x20'))](_0x1a57('0x28'));}if(!_0x5e510e[_0x1a57('0xd')]||!_0x5e510e[_0x1a57('0xe')]){throw new db[(_0x1a57('0x25'))][(_0x1a57('0x20'))](_0x1a57('0x29'));}_0xf4d056=_0x5e510e;var _0x1f705b=[];_0x475088['forEach'](function(_0x5473cb){_0x1f705b['push'](checkTranscribeJob(_0x5473cb,_0x47f9da,_0xf4d056));});return BPromise['all'](_0x1f705b);})['catch'](function(_0xd0261c){if(_0xd0261c){if(!_0xd0261c[_0x1a57('0x38')]||_0xd0261c[_0x1a57('0x38')]!==_0x1a57('0x39')){logger[_0x1a57('0x3a')](util[_0x1a57('0x3c')](_0xd0261c,{'showHidden':![],'depth':null}));}}});}exports[_0x1a57('0x46')]=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 c9045c6..3d8b900 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 _0x7d4e=['../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','lastMsgAt','subtract','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','format','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d4e,0xbb));var _0xe7d4=function(_0x1d5d89,_0x37ea8d){_0x1d5d89=_0x1d5d89-0x0;var _0x5d2ab9=_0x7d4e[_0x1d5d89];return _0x5d2ab9;};'use strict';var _=require(_0xe7d4('0x0'));var moment=require('moment');var Redis=require(_0xe7d4('0x1'));var util=require('util');var config=require(_0xe7d4('0x2'));var db=require(_0xe7d4('0x3'))['db'];var logger=require(_0xe7d4('0x4'))(_0xe7d4('0x5'));config[_0xe7d4('0x6')]=_['defaults'](config['redis'],{'host':_0xe7d4('0x7'),'port':0x18eb});var io=require(_0xe7d4('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0xd4e124=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0xe7d4('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xe7d4('0xa')](0x18,'hours')}}})[_0xe7d4('0xb')](function(_0x3a0206){if(_0x3a0206&&_0x3a0206[_0xe7d4('0xc')]){_0xd4e124=_[_0xe7d4('0xd')](_0x3a0206||[],'id');logger['info'](_0xe7d4('0xe'),_0xd4e124[_0xe7d4('0xf')]());return db[_0xe7d4('0x10')][_0xe7d4('0x11')]({'closeReason':_0xe7d4('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xe7d4('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xd4e124}});}})['then'](function(){if(_0xd4e124&&_0xd4e124['length']){logger[_0xe7d4('0x14')](_0xe7d4('0x15'),_0xd4e124[_0xe7d4('0xf')]());for(var _0x56f17b=0x0;_0x56f17b<_0xd4e124[_0xe7d4('0xc')];_0x56f17b++){io[_0xe7d4('0x16')](_0xe7d4('0x17'),{'id':_0xd4e124[_0x56f17b],'closed':!![]});}}})[_0xe7d4('0x18')](function(_0x162162){logger['error'](_0xe7d4('0x19'),_0x162162?util['inspect'](_0x162162,{'showHidden':![],'depth':null}):'');});}exports[_0xe7d4('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf52c=['timeout','format','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch','inspect','lodash','moment','ioredis','../../config/environment','../../mysqldb','schedule','defaults','localhost','socket.io-emitter','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','WhatsappInteraction','update','system'];(function(_0x329aa4,_0x46af07){var _0x3836b2=function(_0x463943){while(--_0x463943){_0x329aa4['push'](_0x329aa4['shift']());}};_0x3836b2(++_0x46af07);}(_0xf52c,0xb1));var _0xcf52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf52c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf52('0x0'));var moment=require(_0xcf52('0x1'));var Redis=require(_0xcf52('0x2'));var util=require('util');var config=require(_0xcf52('0x3'));var db=require(_0xcf52('0x4'))['db'];var logger=require('../logger')(_0xcf52('0x5'));config['redis']=_[_0xcf52('0x6')](config['redis'],{'host':_0xcf52('0x7'),'port':0x18eb});var io=require(_0xcf52('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x503728=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0xcf52('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xcf52('0xa')](0x18,_0xcf52('0xb'))}}})['then'](function(_0x2aa261){if(_0x2aa261&&_0x2aa261[_0xcf52('0xc')]){_0x503728=_[_0xcf52('0xd')](_0x2aa261||[],'id');logger[_0xcf52('0xe')](_0xcf52('0xf'),_0x503728['join']());return db[_0xcf52('0x10')][_0xcf52('0x11')]({'closeReason':_0xcf52('0x12'),'disposition':_0xcf52('0x13'),'closed':!![],'closedAt':moment()[_0xcf52('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x503728}});}})[_0xcf52('0x15')](function(){if(_0x503728&&_0x503728[_0xcf52('0xc')]){logger[_0xcf52('0xe')](_0xcf52('0x16'),_0x503728[_0xcf52('0x17')]());for(var _0x204404=0x0;_0x204404<_0x503728['length'];_0x204404++){io[_0xcf52('0x18')](_0xcf52('0x19'),{'id':_0x503728[_0x204404],'closed':!![]});}}})[_0xcf52('0x1a')](function(_0x4ffff5){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x4ffff5?util[_0xcf52('0x1b')](_0x4ffff5,{'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/seedContact.js b/server/config/seedContact.js index 8a69f1b..0e4e7ab 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9304=['catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','destroy','CmContact','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper'];(function(_0x410d42,_0x4eb035){var _0x25064b=function(_0x4cd53b){while(--_0x4cd53b){_0x410d42['push'](_0x410d42['shift']());}};_0x25064b(++_0x4eb035);}(_0x9304,0x199));var _0x4930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9304[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x4930('0x0'));var db=require(_0x4930('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x4930('0x2')+i,'lastName':_0x4930('0x3')+i,'phone':0xf879fb460+i,'email':_0x4930('0x4')+i+_0x4930('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4930('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x4930('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x4930('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4930('0x6')]({'id':i,'firstName':_0x4930('0x2')+i,'lastName':_0x4930('0x3')+i,'phone':0xf879fb460+i,'email':_0x4930('0x4')+i+_0x4930('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4930('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4930('0x7')](),'updatedAt':Date[_0x4930('0x7')]()});}db['CmContact'][_0x4930('0x8')]({'where':{}})['then'](function(){return db[_0x4930('0x9')][_0x4930('0xa')](contacts);})[_0x4930('0xb')](function(){console[_0x4930('0xc')](_0x4930('0xd'),_0x4930('0xe'));return db[_0x4930('0xf')][_0x4930('0x8')]({'where':{}});})[_0x4930('0xb')](function(){return db[_0x4930('0xf')][_0x4930('0xa')](hopper);})['then'](function(){console[_0x4930('0xc')](_0x4930('0xd'),'hopper1');return db['CmContact']['bulkCreate'](contacts2);})[_0x4930('0xb')](function(){console[_0x4930('0xc')](_0x4930('0xd'),'contacts2');return db[_0x4930('0xf')]['bulkCreate'](hopper2);})[_0x4930('0xb')](function(){console[_0x4930('0xc')](_0x4930('0xd'),'hopper2');})[_0x4930('0x10')](function(_0xb88845){console[_0x4930('0xc')](_0xb88845);}); \ No newline at end of file +var _0x25f1=['CmHopper','destroy','hopper1','hopper2','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com','now','CmContact','then','bulkCreate','log','contacts1'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x25f1,0x164));var _0x125f=function(_0x5da048,_0xca5c85){_0x5da048=_0x5da048-0x0;var _0x13dfc5=_0x25f1[_0x5da048];return _0x13dfc5;};'use strict';var util=require(_0x125f('0x0'));var db=require(_0x125f('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x125f('0x2')]({'id':i,'firstName':_0x125f('0x3')+i,'lastName':_0x125f('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x125f('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x125f('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x125f('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x125f('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x125f('0x2')]({'id':i,'firstName':_0x125f('0x3')+i,'lastName':_0x125f('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x125f('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x125f('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x125f('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x125f('0x6')](),'updatedAt':Date[_0x125f('0x6')]()});}db[_0x125f('0x7')]['destroy']({'where':{}})[_0x125f('0x8')](function(){return db[_0x125f('0x7')][_0x125f('0x9')](contacts);})[_0x125f('0x8')](function(){console[_0x125f('0xa')]('finished\x20populating',_0x125f('0xb'));return db[_0x125f('0xc')][_0x125f('0xd')]({'where':{}});})[_0x125f('0x8')](function(){return db[_0x125f('0xc')][_0x125f('0x9')](hopper);})[_0x125f('0x8')](function(){console['log']('finished\x20populating',_0x125f('0xe'));return db[_0x125f('0x7')][_0x125f('0x9')](contacts2);})[_0x125f('0x8')](function(){console[_0x125f('0xa')]('finished\x20populating','contacts2');return db[_0x125f('0xc')][_0x125f('0x9')](hopper2);})['then'](function(){console[_0x125f('0xa')]('finished\x20populating',_0x125f('0xf'));})['catch'](function(_0xfb7dbe){console[_0x125f('0xa')](_0xfb7dbe);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 633cecb..c0d460d 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf462=['%s%s','format','agent','%s%s@xcally.com','friend','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','bulkCreate','then','log','add\x20user','../mysqldb','push'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xf462,0x86));var _0x2f46=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0xf462[_0x52096b];return _0x2b1cc7;};'use strict';var util=require('util');var db=require(_0x2f46('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2f46('0x1')]({'name':util['format'](_0x2f46('0x2'),'agent',i),'fullname':util[_0x2f46('0x3')](_0x2f46('0x2'),_0x2f46('0x4'),i),'email':util[_0x2f46('0x3')](_0x2f46('0x5'),'agent',i),'role':_0x2f46('0x4'),'password':'password','internal':0xfa0+i,'type':_0x2f46('0x6'),'transport':['udp','ws',_0x2f46('0x7')],'disallow':[_0x2f46('0x8')],'allow':[_0x2f46('0x9')],'defaultuser':util[_0x2f46('0x3')](_0x2f46('0x2'),_0x2f46('0x4'),i),'encryption':_0x2f46('0xa'),'avpf':'yes','force_avp':'yes','icesupport':_0x2f46('0xa'),'dtlsenable':_0x2f46('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x2f46('0xb'),'dtlssetup':_0x2f46('0xc'),'callerid':util[_0x2f46('0x3')]('\x22%s\x22\x20<%s>',util[_0x2f46('0x3')](_0x2f46('0x2'),_0x2f46('0x4'),i),0xfa0+i)});}db['User'][_0x2f46('0xd')](users)[_0x2f46('0xe')](function(){console[_0x2f46('0xf')](_0x2f46('0x10'));})['catch'](function(_0x4f5824){console[_0x2f46('0xf')](_0x4f5824);}); \ No newline at end of file +var _0x234f=['/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','../mysqldb','push','%s%s','agent','format','%s%s@xcally.com','password','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt'];(function(_0x2c27d3,_0xf15e77){var _0x25926f=function(_0x22779f){while(--_0x22779f){_0x2c27d3['push'](_0x2c27d3['shift']());}};_0x25926f(++_0xf15e77);}(_0x234f,0x80));var _0xf234=function(_0x24b6a5,_0x3d0e55){_0x24b6a5=_0x24b6a5-0x0;var _0xd6fd4a=_0x234f[_0x24b6a5];return _0xd6fd4a;};'use strict';var util=require('util');var db=require(_0xf234('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf234('0x1')]({'name':util['format'](_0xf234('0x2'),_0xf234('0x3'),i),'fullname':util[_0xf234('0x4')]('%s%s',_0xf234('0x3'),i),'email':util[_0xf234('0x4')](_0xf234('0x5'),_0xf234('0x3'),i),'role':_0xf234('0x3'),'password':_0xf234('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0xf234('0x7'),'ws',_0xf234('0x8')],'disallow':['all'],'allow':[_0xf234('0x9')],'defaultuser':util[_0xf234('0x4')](_0xf234('0x2'),_0xf234('0x3'),i),'encryption':'yes','avpf':_0xf234('0xa'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0xf234('0xa'),'dtlsverify':'no','dtlscertfile':_0xf234('0xb'),'dtlsprivatekey':_0xf234('0xc'),'dtlssetup':'actpass','callerid':util['format'](_0xf234('0xd'),util['format']('%s%s',_0xf234('0x3'),i),0xfa0+i)});}db[_0xf234('0xe')][_0xf234('0xf')](users)[_0xf234('0x10')](function(){console[_0xf234('0x11')](_0xf234('0x12'));})[_0xf234('0x13')](function(_0x6f883){console[_0xf234('0x11')](_0x6f883);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 7225213..2ff4fc7 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6050=['disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','role','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','telephone','Campaign','format','%s:queue:%s','Agents','length','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','user:%s','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','agent','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','map','removeChatInteractions','emit','leave','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','nsp'];(function(_0x216428,_0x5d20ea){var _0x313dd4=function(_0x447e0d){while(--_0x447e0d){_0x216428['push'](_0x216428['shift']());}};_0x313dd4(++_0x5d20ea);}(_0x6050,0x196));var _0x0605=function(_0x4a56e5,_0x175b1c){_0x4a56e5=_0x4a56e5-0x0;var _0x367cc9=_0x6050[_0x4a56e5];return _0x367cc9;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var BPromise=require(_0x0605('0x2'));var db=require(_0x0605('0x3'))['db'];var config=require(_0x0605('0x4'));var queryQueues={'attributes':['id',_0x0605('0x5')],'include':[{'as':'Agents','model':db[_0x0605('0x6')],'attributes':['id',_0x0605('0x5'),_0x0605('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x0605('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x0605('0x8')],'where':{'type':_0x0605('0x9')}};function getAssociatedResources(_0xa08eca,_0x5bb96,_0x44fdd3){return db['UserProfileSection'][_0x0605('0xa')]({'where':{'name':_0xa08eca,'userProfileId':_0x5bb96},'raw':!![]})[_0x0605('0xb')](function(_0xe54b22){if(_0xe54b22){if(_0xe54b22[_0x0605('0xc')]){switch(_0xa08eca){case _0x0605('0xd'):case _0x0605('0xe'):case _0x0605('0xf'):case _0x0605('0x10'):case _0x0605('0x11'):case _0x0605('0x12'):case _0x0605('0x13'):return db[_0x44fdd3][_0x0605('0x14')](queryQueues);case _0x0605('0x15'):return db[_0x44fdd3][_0x0605('0x14')](queryTelephones);case _0x0605('0x16'):return db[_0x44fdd3][_0x0605('0x14')](queryTrunks);case _0x0605('0x17'):return db[_0x44fdd3][_0x0605('0x14')](queryCampaigns);}}else{return db[_0x0605('0x18')]['findAll']({'attributes':[_0x0605('0x19')],'where':{'sectionId':_0xe54b22['id']},'raw':!![]})[_0x0605('0xb')](function(_0x4993ab){if(_0x4993ab){var _0x5ce56a={'where':{'id':_['map'](_0x4993ab,_0x0605('0x19'))},'raw':!![]};switch(_0x44fdd3){case _0x0605('0x6'):_0x5ce56a[_0x0605('0x1a')][_0x0605('0x7')]=_0x0605('0x1b');break;case _0x0605('0x1c'):_0x5ce56a[_0x0605('0x1a')][_0x0605('0x8')]=_0x0605('0x9');break;}return db[_0x44fdd3][_0x0605('0x14')](_0x5ce56a);}else{return[];}});}}else{return[];}})[_0x0605('0xb')](function(_0x2fa77e){return _0x2fa77e;});}function joinOrLeaveQueues(_0x2e2204,_0x103952,_0x59bc87,_0x254020){_0x2e2204[_0x103952](util[_0x0605('0x1d')](_0x0605('0x1e'),_0x59bc87,_0x254020[_0x0605('0x5')]));if(_0x254020[_0x0605('0x1f')]){for(var _0x90b2e1=0x0;_0x90b2e1<_0x254020[_0x0605('0x1f')][_0x0605('0x20')];_0x90b2e1+=0x1){_0x2e2204[_0x103952](util[_0x0605('0x1d')]('user:%s',_0x254020[_0x0605('0x1f')][_0x90b2e1]['name']));}}}function joinOrLeave(_0x3efc38,_0x118e9c,_0x110098){var _0xf182c4;if(_0x3efc38[_0x0605('0x21')][_0x0605('0x22')]['id']){db[_0x0605('0x6')][_0x0605('0x23')]({'attributes':['id',_0x0605('0x5'),_0x0605('0x7'),_0x0605('0x24')],'where':{'id':_0x3efc38[_0x0605('0x21')]['query']['id']},'include':[{'model':db[_0x0605('0x25')],'as':_0x0605('0x26'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x0605('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x0605('0x28')],'as':_0x0605('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x0605('0x2a')],'as':_0x0605('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x0605('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x0605('0xb')](function(_0x5daef6){if(_0x5daef6){_0xf182c4=_0x5daef6;_0x3efc38[_0x118e9c](util[_0x0605('0x1d')](_0x0605('0x2d'),_0x5daef6[_0x0605('0x5')]));var _0x9f2980=[];switch(_0x5daef6[_0x0605('0x7')]){case _0x0605('0x2e'):_0x3efc38[_0x118e9c]('voice:inbound');_0x3efc38[_0x118e9c](_0x0605('0x2f'));if(queryQueues[_0x0605('0x30')](_0x0605('0x31'))){delete queryQueues[_0x0605('0x31')];}_0x9f2980[_0x0605('0x32')](db[_0x0605('0x33')][_0x0605('0x14')](queryQueues));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x34')][_0x0605('0x14')](queryQueues));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x35')][_0x0605('0x14')](queryQueues));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x36')][_0x0605('0x14')](queryQueues));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x37')][_0x0605('0x14')](queryQueues));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x38')][_0x0605('0x14')](queryQueues));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x39')][_0x0605('0x14')](queryQueues));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x6')]['findAll'](queryTelephones));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x3a')]['findAll'](queryTrunks));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x1c')]['findAll'](queryCampaigns));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x6')][_0x0605('0x14')](queryAgents));break;case _0x0605('0x3b'):_0x3efc38[_0x118e9c](_0x0605('0x3c'));_0x3efc38[_0x118e9c](_0x0605('0x2f'));_0x9f2980['push'](getAssociatedResources('VoiceQueues',_0x5daef6[_0x0605('0x24')],_0x0605('0x33')));_0x9f2980[_0x0605('0x32')](getAssociatedResources('ChatQueues',_0x5daef6[_0x0605('0x24')],'ChatQueue'));_0x9f2980[_0x0605('0x32')](getAssociatedResources(_0x0605('0xf'),_0x5daef6[_0x0605('0x24')],_0x0605('0x35')));_0x9f2980[_0x0605('0x32')](getAssociatedResources(_0x0605('0x10'),_0x5daef6[_0x0605('0x24')],_0x0605('0x36')));_0x9f2980[_0x0605('0x32')](getAssociatedResources(_0x0605('0x11'),_0x5daef6['userProfileId'],_0x0605('0x37')));_0x9f2980['push'](getAssociatedResources(_0x0605('0x12'),_0x5daef6[_0x0605('0x24')],_0x0605('0x38')));_0x9f2980['push'](getAssociatedResources('WhatsappQueues',_0x5daef6[_0x0605('0x24')],'WhatsappQueue'));_0x9f2980[_0x0605('0x32')](getAssociatedResources(_0x0605('0x15'),_0x5daef6[_0x0605('0x24')],_0x0605('0x6')));_0x9f2980[_0x0605('0x32')](getAssociatedResources(_0x0605('0x16'),_0x5daef6[_0x0605('0x24')],_0x0605('0x3a')));_0x9f2980[_0x0605('0x32')](getAssociatedResources(_0x0605('0x17'),_0x5daef6[_0x0605('0x24')],_0x0605('0x1c')));_0x9f2980[_0x0605('0x32')](db['User']['findAll'](queryAgents));break;case _0x0605('0x3d'):_0x3efc38[_0x118e9c]('voice:inbound');_0x3efc38[_0x118e9c](_0x0605('0x2f'));_0x9f2980[_0x0605('0x32')](_0x5daef6['getVoiceQueues']({'attributes':['id',_0x0605('0x5')]}));_0x9f2980[_0x0605('0x32')](_0x5daef6['getChatQueues']({'attributes':['id',_0x0605('0x5')]}));_0x9f2980[_0x0605('0x32')](_0x5daef6['getFaxQueues']({'attributes':['id',_0x0605('0x5')]}));_0x9f2980[_0x0605('0x32')](_0x5daef6['getSmsQueues']({'attributes':['id',_0x0605('0x5')]}));_0x9f2980['push'](_0x5daef6['getMailQueues']({'attributes':['id',_0x0605('0x5')]}));_0x9f2980[_0x0605('0x32')](_0x5daef6[_0x0605('0x3e')]({'attributes':['id',_0x0605('0x5')]}));_0x9f2980[_0x0605('0x32')](_0x5daef6[_0x0605('0x3f')]({'attributes':['id',_0x0605('0x5')]}));break;}return BPromise[_0x0605('0x40')](_0x9f2980);}})['then'](function(_0x337f79){if(_0x337f79&&_0x337f79[_0x0605('0x20')]){for(var _0xbecbe5=0x0;_0xbecbe5<_0x337f79['length'];_0xbecbe5+=0x1){for(var _0x433d4c=0x0;_0x433d4c<_0x337f79[_0xbecbe5][_0x0605('0x20')];_0x433d4c+=0x1){switch(_0xbecbe5){case 0x0:joinOrLeaveQueues(_0x3efc38,_0x118e9c,_0x0605('0x41'),_0x337f79[_0xbecbe5][_0x433d4c]);break;case 0x1:joinOrLeaveQueues(_0x3efc38,_0x118e9c,_0x0605('0x42'),_0x337f79[_0xbecbe5][_0x433d4c]);break;case 0x2:joinOrLeaveQueues(_0x3efc38,_0x118e9c,_0x0605('0x43'),_0x337f79[_0xbecbe5][_0x433d4c]);break;case 0x3:joinOrLeaveQueues(_0x3efc38,_0x118e9c,_0x0605('0x44'),_0x337f79[_0xbecbe5][_0x433d4c]);break;case 0x4:joinOrLeaveQueues(_0x3efc38,_0x118e9c,_0x0605('0x45'),_0x337f79[_0xbecbe5][_0x433d4c]);break;case 0x5:joinOrLeaveQueues(_0x3efc38,_0x118e9c,_0x0605('0x46'),_0x337f79[_0xbecbe5][_0x433d4c]);break;case 0x6:joinOrLeaveQueues(_0x3efc38,_0x118e9c,_0x0605('0x47'),_0x337f79[_0xbecbe5][_0x433d4c]);break;case 0x7:if(_0xf182c4['role']!==_0x0605('0x3d'))_0x3efc38[_0x118e9c](util[_0x0605('0x1d')](_0x0605('0x48'),_0x337f79[_0xbecbe5][_0x433d4c][_0x0605('0x5')]));break;case 0x8:if(_0xf182c4[_0x0605('0x7')]!==_0x0605('0x3d'))_0x3efc38[_0x118e9c](util[_0x0605('0x1d')](_0x0605('0x49'),_0x337f79[_0xbecbe5][_0x433d4c][_0x0605('0x5')]));break;case 0x9:if(_0xf182c4[_0x0605('0x7')]!=='agent')_0x3efc38[_0x118e9c](util['format']('campaign:%s:%s',_0x337f79[_0xbecbe5][_0x433d4c][_0x0605('0x8')],_0x337f79[_0xbecbe5][_0x433d4c][_0x0605('0x5')]));break;case 0xa:_0x3efc38[_0x118e9c](util[_0x0605('0x1d')](_0x0605('0x2d'),_0x337f79[_0xbecbe5][_0x433d4c][_0x0605('0x5')]));break;}}}}})[_0x0605('0xb')](function(){if(_0x118e9c==='leave'){var _0x37d689=_[_0x0605('0x4a')](_0xf182c4[_0x0605('0x26')],'id');return _0xf182c4[_0x0605('0x4b')](_0x37d689)['then'](function(){for(var _0x2c5709=0x0;_0x2c5709<_0x37d689[_0x0605('0x20')];_0x2c5709+=0x1){_0x110098[_0x0605('0x4c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x37d689[_0x2c5709]),'UserId':Number(_0xf182c4['id'])});}});}})['then'](function(){if(_0x118e9c===_0x0605('0x4d')){var _0x1a735c=_[_0x0605('0x4a')](_0xf182c4['MailInteractions'],'id');return _0xf182c4['removeMailInteractions'](_0x1a735c)[_0x0605('0xb')](function(){for(var _0x5c817e=0x0;_0x5c817e<_0x1a735c[_0x0605('0x20')];_0x5c817e+=0x1){_0x110098[_0x0605('0x4c')](_0x0605('0x4e'),{'MailInteractionId':Number(_0x1a735c[_0x5c817e]),'UserId':Number(_0xf182c4['id'])});}});}})[_0x0605('0xb')](function(){if(_0x118e9c===_0x0605('0x4d')){var _0x3c4b88=_[_0x0605('0x4a')](_0xf182c4['FaxInteractions'],'id');return _0xf182c4[_0x0605('0x4f')](_0x3c4b88)['then'](function(){for(var _0x40dd01=0x0;_0x40dd01<_0x3c4b88['length'];_0x40dd01+=0x1){_0x110098[_0x0605('0x4c')](_0x0605('0x50'),{'FaxInteractionId':Number(_0x3c4b88[_0x40dd01]),'UserId':Number(_0xf182c4['id'])});}});}})[_0x0605('0xb')](function(){if(_0x118e9c===_0x0605('0x4d')){var _0x48be2f=_['map'](_0xf182c4[_0x0605('0x29')],'id');return _0xf182c4[_0x0605('0x51')](_0x48be2f)['then'](function(){for(var _0x51d295=0x0;_0x51d295<_0x48be2f['length'];_0x51d295+=0x1){_0x110098[_0x0605('0x4c')](_0x0605('0x52'),{'SmsInteractionId':Number(_0x48be2f[_0x51d295]),'UserId':Number(_0xf182c4['id'])});}});}})[_0x0605('0xb')](function(){if(_0x118e9c===_0x0605('0x4d')){var _0x3af2ad=_[_0x0605('0x4a')](_0xf182c4['OpenchannelInteractions'],'id');return _0xf182c4[_0x0605('0x53')](_0x3af2ad)[_0x0605('0xb')](function(){for(var _0x3edced=0x0;_0x3edced<_0x3af2ad[_0x0605('0x20')];_0x3edced+=0x1){_0x110098[_0x0605('0x4c')](_0x0605('0x54'),{'OpenchannelInteractionId':Number(_0x3af2ad[_0x3edced]),'UserId':Number(_0xf182c4['id'])});}});}})[_0x0605('0xb')](function(){if(_0x118e9c===_0x0605('0x4d')){var _0x533a9c=_['map'](_0xf182c4['WhatsappInteractions'],'id');return _0xf182c4[_0x0605('0x55')](_0x533a9c)[_0x0605('0xb')](function(){for(var _0xe53cb6=0x0;_0xe53cb6<_0x533a9c['length'];_0xe53cb6+=0x1){_0x110098['emit'](_0x0605('0x56'),{'WhatsappInteractionId':Number(_0x533a9c[_0xe53cb6]),'UserId':Number(_0xf182c4['id'])});}});}})[_0x0605('0x57')](function(_0x8ae474){_0x3efc38[_0x0605('0x58')](_0x8ae474);});}}function onDisconnect(_0x14cc4c,_0x437c90){joinOrLeave(_0x14cc4c,_0x0605('0x4d'),_0x437c90);}function onConnect(_0x19b55e){joinOrLeave(_0x19b55e,_0x0605('0x59'));}exports[_0x0605('0x5a')]=function(_0xac4a33){_0xac4a33['on'](_0x0605('0x5b'),function(_0x5d4e9a){_0x5d4e9a[_0x0605('0x5c')](0x0);_0x5d4e9a[_0x0605('0x5d')]=_0x5d4e9a[_0x0605('0x5e')][_0x0605('0x5b')][_0x0605('0x5f')]+':'+_0x5d4e9a[_0x0605('0x5e')]['connection'][_0x0605('0x60')];_0x5d4e9a['connectedAt']=new Date();_0x5d4e9a['log']=function(_0x3d2414){console[_0x0605('0x58')](_0x0605('0x61')+_0x5d4e9a[_0x0605('0x62')][_0x0605('0x5')]+'['+_0x5d4e9a[_0x0605('0x5d')]+']',_0x3d2414);};_0x5d4e9a['on'](_0x0605('0x63'),function(){onDisconnect(_0x5d4e9a,_0xac4a33);_0x5d4e9a[_0x0605('0x58')](_0x0605('0x64'));});onConnect(_0x5d4e9a);_0x5d4e9a[_0x0605('0x58')]('CONNECTED');});}; \ No newline at end of file +var _0x4f00=['Agents','User','agent','telephone','name','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','Campaign','where','type','format','%s:queue:%s','length','handshake','query','find','role','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','userProfileId','getVoiceQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','all','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','emit','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment'];(function(_0x3d724f,_0x29d602){var _0x47551c=function(_0x250940){while(--_0x250940){_0x3d724f['push'](_0x3d724f['shift']());}};_0x47551c(++_0x29d602);}(_0x4f00,0x1ea));var _0x04f0=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x4f00[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x04f0('0x0'));var util=require(_0x04f0('0x1'));var BPromise=require(_0x04f0('0x2'));var db=require(_0x04f0('0x3'))['db'];var config=require(_0x04f0('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x04f0('0x5'),'model':db[_0x04f0('0x6')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0x04f0('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x04f0('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x04f0('0x9')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x04f0('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x04f0('0x9'),'type'],'where':{'type':_0x04f0('0xa')}};function getAssociatedResources(_0x5d4335,_0x15de72,_0x1db999){return db[_0x04f0('0xb')][_0x04f0('0xc')]({'where':{'name':_0x5d4335,'userProfileId':_0x15de72},'raw':!![]})[_0x04f0('0xd')](function(_0x139b3d){if(_0x139b3d){if(_0x139b3d[_0x04f0('0xe')]){switch(_0x5d4335){case'VoiceQueues':case _0x04f0('0xf'):case _0x04f0('0x10'):case _0x04f0('0x11'):case _0x04f0('0x12'):case _0x04f0('0x13'):case _0x04f0('0x14'):return db[_0x1db999][_0x04f0('0x15')](queryQueues);case _0x04f0('0x16'):return db[_0x1db999]['findAll'](queryTelephones);case _0x04f0('0x17'):return db[_0x1db999][_0x04f0('0x15')](queryTrunks);case _0x04f0('0x18'):return db[_0x1db999][_0x04f0('0x15')](queryCampaigns);}}else{return db['UserProfileResource'][_0x04f0('0x15')]({'attributes':[_0x04f0('0x19')],'where':{'sectionId':_0x139b3d['id']},'raw':!![]})[_0x04f0('0xd')](function(_0x1b7f23){if(_0x1b7f23){var _0xb69d29={'where':{'id':_[_0x04f0('0x1a')](_0x1b7f23,_0x04f0('0x19'))},'raw':!![]};switch(_0x1db999){case _0x04f0('0x6'):_0xb69d29['where']['role']=_0x04f0('0x8');break;case _0x04f0('0x1b'):_0xb69d29[_0x04f0('0x1c')][_0x04f0('0x1d')]=_0x04f0('0xa');break;}return db[_0x1db999][_0x04f0('0x15')](_0xb69d29);}else{return[];}});}}else{return[];}})[_0x04f0('0xd')](function(_0x43cd57){return _0x43cd57;});}function joinOrLeaveQueues(_0x507899,_0x43e831,_0x5c6ce6,_0x12f2a7){_0x507899[_0x43e831](util[_0x04f0('0x1e')](_0x04f0('0x1f'),_0x5c6ce6,_0x12f2a7['name']));if(_0x12f2a7[_0x04f0('0x5')]){for(var _0x4cb7fb=0x0;_0x4cb7fb<_0x12f2a7[_0x04f0('0x5')][_0x04f0('0x20')];_0x4cb7fb+=0x1){_0x507899[_0x43e831](util[_0x04f0('0x1e')]('user:%s',_0x12f2a7[_0x04f0('0x5')][_0x4cb7fb][_0x04f0('0x9')]));}}}function joinOrLeave(_0x2a398c,_0x3e054e,_0x1a6232){var _0x49d265;if(_0x2a398c[_0x04f0('0x21')][_0x04f0('0x22')]['id']){db[_0x04f0('0x6')][_0x04f0('0x23')]({'attributes':['id',_0x04f0('0x9'),_0x04f0('0x24'),'userProfileId'],'where':{'id':_0x2a398c['handshake'][_0x04f0('0x22')]['id']},'include':[{'model':db[_0x04f0('0x25')],'as':_0x04f0('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x04f0('0x27')],'as':_0x04f0('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x04f0('0x29')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x04f0('0x2a')],'as':_0x04f0('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x04f0('0x2c'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x04f0('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x04f0('0xd')](function(_0x27a618){if(_0x27a618){_0x49d265=_0x27a618;_0x2a398c[_0x3e054e](util[_0x04f0('0x1e')](_0x04f0('0x2e'),_0x27a618['name']));var _0x571978=[];switch(_0x27a618[_0x04f0('0x24')]){case _0x04f0('0x2f'):_0x2a398c[_0x3e054e](_0x04f0('0x30'));_0x2a398c[_0x3e054e](_0x04f0('0x31'));if(queryQueues['hasOwnProperty'](_0x04f0('0x32'))){delete queryQueues[_0x04f0('0x32')];}_0x571978[_0x04f0('0x33')](db[_0x04f0('0x34')][_0x04f0('0x15')](queryQueues));_0x571978['push'](db['ChatQueue']['findAll'](queryQueues));_0x571978[_0x04f0('0x33')](db[_0x04f0('0x35')][_0x04f0('0x15')](queryQueues));_0x571978['push'](db[_0x04f0('0x36')][_0x04f0('0x15')](queryQueues));_0x571978[_0x04f0('0x33')](db[_0x04f0('0x37')][_0x04f0('0x15')](queryQueues));_0x571978[_0x04f0('0x33')](db[_0x04f0('0x38')][_0x04f0('0x15')](queryQueues));_0x571978[_0x04f0('0x33')](db[_0x04f0('0x39')][_0x04f0('0x15')](queryQueues));_0x571978[_0x04f0('0x33')](db[_0x04f0('0x6')][_0x04f0('0x15')](queryTelephones));_0x571978[_0x04f0('0x33')](db[_0x04f0('0x3a')][_0x04f0('0x15')](queryTrunks));_0x571978[_0x04f0('0x33')](db['Campaign'][_0x04f0('0x15')](queryCampaigns));_0x571978[_0x04f0('0x33')](db[_0x04f0('0x6')][_0x04f0('0x15')](queryAgents));break;case _0x04f0('0x3b'):_0x2a398c[_0x3e054e]('voice:inbound');_0x2a398c[_0x3e054e](_0x04f0('0x31'));_0x571978[_0x04f0('0x33')](getAssociatedResources(_0x04f0('0x3c'),_0x27a618[_0x04f0('0x3d')],_0x04f0('0x34')));_0x571978['push'](getAssociatedResources(_0x04f0('0xf'),_0x27a618[_0x04f0('0x3d')],'ChatQueue'));_0x571978[_0x04f0('0x33')](getAssociatedResources(_0x04f0('0x10'),_0x27a618[_0x04f0('0x3d')],_0x04f0('0x35')));_0x571978[_0x04f0('0x33')](getAssociatedResources(_0x04f0('0x11'),_0x27a618[_0x04f0('0x3d')],_0x04f0('0x36')));_0x571978[_0x04f0('0x33')](getAssociatedResources(_0x04f0('0x12'),_0x27a618[_0x04f0('0x3d')],_0x04f0('0x37')));_0x571978['push'](getAssociatedResources(_0x04f0('0x13'),_0x27a618[_0x04f0('0x3d')],'OpenchannelQueue'));_0x571978[_0x04f0('0x33')](getAssociatedResources(_0x04f0('0x14'),_0x27a618[_0x04f0('0x3d')],_0x04f0('0x39')));_0x571978['push'](getAssociatedResources(_0x04f0('0x16'),_0x27a618[_0x04f0('0x3d')],'User'));_0x571978[_0x04f0('0x33')](getAssociatedResources(_0x04f0('0x17'),_0x27a618['userProfileId'],'Trunk'));_0x571978[_0x04f0('0x33')](getAssociatedResources(_0x04f0('0x18'),_0x27a618[_0x04f0('0x3d')],'Campaign'));_0x571978[_0x04f0('0x33')](db[_0x04f0('0x6')][_0x04f0('0x15')](queryAgents));break;case _0x04f0('0x7'):_0x2a398c[_0x3e054e](_0x04f0('0x30'));_0x2a398c[_0x3e054e](_0x04f0('0x31'));_0x571978[_0x04f0('0x33')](_0x27a618[_0x04f0('0x3e')]({'attributes':['id',_0x04f0('0x9')]}));_0x571978['push'](_0x27a618['getChatQueues']({'attributes':['id',_0x04f0('0x9')]}));_0x571978[_0x04f0('0x33')](_0x27a618[_0x04f0('0x3f')]({'attributes':['id',_0x04f0('0x9')]}));_0x571978[_0x04f0('0x33')](_0x27a618[_0x04f0('0x40')]({'attributes':['id',_0x04f0('0x9')]}));_0x571978[_0x04f0('0x33')](_0x27a618['getMailQueues']({'attributes':['id',_0x04f0('0x9')]}));_0x571978[_0x04f0('0x33')](_0x27a618[_0x04f0('0x41')]({'attributes':['id',_0x04f0('0x9')]}));_0x571978[_0x04f0('0x33')](_0x27a618['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x04f0('0x42')](_0x571978);}})[_0x04f0('0xd')](function(_0x404b1a){if(_0x404b1a&&_0x404b1a[_0x04f0('0x20')]){for(var _0x349921=0x0;_0x349921<_0x404b1a[_0x04f0('0x20')];_0x349921+=0x1){for(var _0x570638=0x0;_0x570638<_0x404b1a[_0x349921]['length'];_0x570638+=0x1){switch(_0x349921){case 0x0:joinOrLeaveQueues(_0x2a398c,_0x3e054e,'voice',_0x404b1a[_0x349921][_0x570638]);break;case 0x1:joinOrLeaveQueues(_0x2a398c,_0x3e054e,'chat',_0x404b1a[_0x349921][_0x570638]);break;case 0x2:joinOrLeaveQueues(_0x2a398c,_0x3e054e,_0x04f0('0x43'),_0x404b1a[_0x349921][_0x570638]);break;case 0x3:joinOrLeaveQueues(_0x2a398c,_0x3e054e,_0x04f0('0x44'),_0x404b1a[_0x349921][_0x570638]);break;case 0x4:joinOrLeaveQueues(_0x2a398c,_0x3e054e,_0x04f0('0x45'),_0x404b1a[_0x349921][_0x570638]);break;case 0x5:joinOrLeaveQueues(_0x2a398c,_0x3e054e,_0x04f0('0x46'),_0x404b1a[_0x349921][_0x570638]);break;case 0x6:joinOrLeaveQueues(_0x2a398c,_0x3e054e,_0x04f0('0x47'),_0x404b1a[_0x349921][_0x570638]);break;case 0x7:if(_0x49d265[_0x04f0('0x24')]!=='agent')_0x2a398c[_0x3e054e](util[_0x04f0('0x1e')](_0x04f0('0x48'),_0x404b1a[_0x349921][_0x570638]['name']));break;case 0x8:if(_0x49d265[_0x04f0('0x24')]!==_0x04f0('0x7'))_0x2a398c[_0x3e054e](util['format'](_0x04f0('0x49'),_0x404b1a[_0x349921][_0x570638][_0x04f0('0x9')]));break;case 0x9:if(_0x49d265['role']!==_0x04f0('0x7'))_0x2a398c[_0x3e054e](util['format'](_0x04f0('0x4a'),_0x404b1a[_0x349921][_0x570638][_0x04f0('0x1d')],_0x404b1a[_0x349921][_0x570638][_0x04f0('0x9')]));break;case 0xa:_0x2a398c[_0x3e054e](util[_0x04f0('0x1e')](_0x04f0('0x2e'),_0x404b1a[_0x349921][_0x570638][_0x04f0('0x9')]));break;}}}}})['then'](function(){if(_0x3e054e==='leave'){var _0x9062dd=_['map'](_0x49d265[_0x04f0('0x26')],'id');return _0x49d265['removeChatInteractions'](_0x9062dd)[_0x04f0('0xd')](function(){for(var _0x5bfd13=0x0;_0x5bfd13<_0x9062dd['length'];_0x5bfd13+=0x1){_0x1a6232['emit'](_0x04f0('0x4b'),{'ChatInteractionId':Number(_0x9062dd[_0x5bfd13]),'UserId':Number(_0x49d265['id'])});}});}})[_0x04f0('0xd')](function(){if(_0x3e054e===_0x04f0('0x4c')){var _0x1b5123=_['map'](_0x49d265[_0x04f0('0x28')],'id');return _0x49d265[_0x04f0('0x4d')](_0x1b5123)[_0x04f0('0xd')](function(){for(var _0x3f2f46=0x0;_0x3f2f46<_0x1b5123[_0x04f0('0x20')];_0x3f2f46+=0x1){_0x1a6232['emit'](_0x04f0('0x4e'),{'MailInteractionId':Number(_0x1b5123[_0x3f2f46]),'UserId':Number(_0x49d265['id'])});}});}})['then'](function(){if(_0x3e054e===_0x04f0('0x4c')){var _0x158bd3=_['map'](_0x49d265[_0x04f0('0x4f')],'id');return _0x49d265['removeFaxInteractions'](_0x158bd3)[_0x04f0('0xd')](function(){for(var _0x3d97e4=0x0;_0x3d97e4<_0x158bd3[_0x04f0('0x20')];_0x3d97e4+=0x1){_0x1a6232[_0x04f0('0x50')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x158bd3[_0x3d97e4]),'UserId':Number(_0x49d265['id'])});}});}})[_0x04f0('0xd')](function(){if(_0x3e054e===_0x04f0('0x4c')){var _0x162c9e=_[_0x04f0('0x1a')](_0x49d265[_0x04f0('0x2b')],'id');return _0x49d265['removeSmsInteractions'](_0x162c9e)[_0x04f0('0xd')](function(){for(var _0x17c259=0x0;_0x17c259<_0x162c9e['length'];_0x17c259+=0x1){_0x1a6232[_0x04f0('0x50')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x162c9e[_0x17c259]),'UserId':Number(_0x49d265['id'])});}});}})[_0x04f0('0xd')](function(){if(_0x3e054e===_0x04f0('0x4c')){var _0x35864d=_[_0x04f0('0x1a')](_0x49d265[_0x04f0('0x2c')],'id');return _0x49d265[_0x04f0('0x51')](_0x35864d)[_0x04f0('0xd')](function(){for(var _0x872c54=0x0;_0x872c54<_0x35864d[_0x04f0('0x20')];_0x872c54+=0x1){_0x1a6232['emit'](_0x04f0('0x52'),{'OpenchannelInteractionId':Number(_0x35864d[_0x872c54]),'UserId':Number(_0x49d265['id'])});}});}})['then'](function(){if(_0x3e054e===_0x04f0('0x4c')){var _0x59b203=_[_0x04f0('0x1a')](_0x49d265['WhatsappInteractions'],'id');return _0x49d265[_0x04f0('0x53')](_0x59b203)['then'](function(){for(var _0x18ded1=0x0;_0x18ded1<_0x59b203[_0x04f0('0x20')];_0x18ded1+=0x1){_0x1a6232['emit'](_0x04f0('0x54'),{'WhatsappInteractionId':Number(_0x59b203[_0x18ded1]),'UserId':Number(_0x49d265['id'])});}});}})[_0x04f0('0x55')](function(_0x4c7ffa){_0x2a398c[_0x04f0('0x56')](_0x4c7ffa);});}}function onDisconnect(_0x37bff0,_0x2e9d7e){joinOrLeave(_0x37bff0,_0x04f0('0x4c'),_0x2e9d7e);}function onConnect(_0x3ce4c6){joinOrLeave(_0x3ce4c6,_0x04f0('0x57'));}exports[_0x04f0('0x58')]=function(_0x1792fd){_0x1792fd['on'](_0x04f0('0x59'),function(_0xb2781){_0xb2781[_0x04f0('0x5a')](0x0);_0xb2781[_0x04f0('0x5b')]=_0xb2781[_0x04f0('0x5c')][_0x04f0('0x59')][_0x04f0('0x5d')]+':'+_0xb2781[_0x04f0('0x5c')][_0x04f0('0x59')][_0x04f0('0x5e')];_0xb2781[_0x04f0('0x5f')]=new Date();_0xb2781[_0x04f0('0x56')]=function(_0x3b90fd){console[_0x04f0('0x56')]('SocketIO\x20'+_0xb2781[_0x04f0('0x60')][_0x04f0('0x9')]+'['+_0xb2781[_0x04f0('0x5b')]+']',_0x3b90fd);};_0xb2781['on']('disconnect',function(){onDisconnect(_0xb2781,_0x1792fd);_0xb2781['log'](_0x04f0('0x61'));});onConnect(_0xb2781);_0xb2781['log'](_0x04f0('0x62'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 5b58b05..c5205c9 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 _0xe73c=['closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','error','code','Trigger,\x20%s','catch','get','channel','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','then','contact','UserId','interface','format','SIP/%s','agent','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened','query','SELECT','AfterCreate','closed','substatus','QueryTypes','name','AfterUpdate','User','fullname','internal','default','length','hasOwnProperty','model','hook','toLowerCase','condition','../../mysqldb','jayson/promise','../logger','client','http','afterCreate','newinteraction','Chat','ChatInteraction','afterUpdate'];(function(_0xf20c6b,_0x581f61){var _0x471eb1=function(_0x2190e4){while(--_0x2190e4){_0xf20c6b['push'](_0xf20c6b['shift']());}};_0x471eb1(++_0x581f61);}(_0xe73c,0xda));var _0xce73=function(_0x27bec4,_0x25d069){_0x27bec4=_0x27bec4-0x0;var _0x28299b=_0xe73c[_0x27bec4];return _0x28299b;};'use strict';var util=require('util');var db=require(_0xce73('0x0'))['db'];var jayson=require(_0xce73('0x1'));var logger=require(_0xce73('0x2'))('triggers');var client=jayson[_0xce73('0x3')][_0xce73('0x4')]({'port':0x232a});var triggers=[{'channel':'Chat','model':'ChatInteraction','event':_0xce73('0x5'),'condition':_0xce73('0x6'),'callback':afterCreate},{'channel':_0xce73('0x7'),'model':_0xce73('0x8'),'event':_0xce73('0x9'),'condition':_0xce73('0xa'),'callback':afterUpdate},{'channel':'Chat','model':_0xce73('0xb'),'event':'afterCreate','condition':_0xce73('0xc'),'callback':afterCreateMessage},{'channel':_0xce73('0x7'),'model':_0xce73('0xd'),'event':_0xce73('0x5'),'condition':_0xce73('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0xce73('0xe'),'model':_0xce73('0xf'),'event':_0xce73('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xce73('0xe'),'model':_0xce73('0xf'),'event':_0xce73('0x9'),'condition':_0xce73('0xa'),'callback':afterUpdate},{'channel':_0xce73('0xe'),'model':_0xce73('0x10'),'event':_0xce73('0x5'),'condition':_0xce73('0xc'),'callback':afterCreateMessage},{'channel':_0xce73('0x11'),'model':_0xce73('0x12'),'event':'afterCreate','condition':_0xce73('0x6'),'callback':afterCreate},{'channel':_0xce73('0x11'),'model':_0xce73('0x12'),'event':_0xce73('0x9'),'condition':_0xce73('0xa'),'callback':afterUpdate},{'channel':_0xce73('0x11'),'model':_0xce73('0x13'),'event':_0xce73('0x5'),'condition':_0xce73('0xc'),'callback':afterCreateMessage},{'channel':_0xce73('0x14'),'model':_0xce73('0x15'),'event':_0xce73('0x5'),'condition':_0xce73('0x6'),'callback':afterCreate},{'channel':_0xce73('0x14'),'model':_0xce73('0x15'),'event':_0xce73('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xce73('0x14'),'model':_0xce73('0x16'),'event':_0xce73('0x5'),'condition':_0xce73('0xc'),'callback':afterCreateMessage},{'channel':'Mail','model':_0xce73('0x17'),'event':_0xce73('0x5'),'condition':_0xce73('0x6'),'callback':afterCreate},{'channel':_0xce73('0x18'),'model':_0xce73('0x17'),'event':_0xce73('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xce73('0x18'),'model':'MailMessage','event':_0xce73('0x5'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xce73('0x19'),'model':_0xce73('0x1a'),'event':'afterCreate','condition':_0xce73('0x6'),'callback':afterCreate},{'channel':'Openchannel','model':_0xce73('0x1a'),'event':_0xce73('0x9'),'condition':_0xce73('0xa'),'callback':afterUpdate},{'channel':_0xce73('0x19'),'model':_0xce73('0x1b'),'event':_0xce73('0x5'),'condition':_0xce73('0xc'),'callback':afterCreateMessage}];function request(_0x5bbdfa){return client[_0xce73('0x1c')](_0xce73('0x1d'),_0x5bbdfa)['then'](function(_0x38acd0){logger[_0xce73('0x1e')]('Trigger,\x20%s',_0xce73('0x1d'),_0x38acd0);if(_0x38acd0[_0xce73('0x1f')]){if(_0x38acd0[_0xce73('0x1f')][_0xce73('0x20')]===0x1f4){logger['error'](_0xce73('0x21'),_0xce73('0x1d'),_0x38acd0['error']);}}})[_0xce73('0x22')](function(_0x4a9639){logger[_0xce73('0x1f')](_0xce73('0x21'),_0xce73('0x1d'),_0x4a9639);});}function afterCreateMessage(_0x4cd0e3){return function(_0x306e5e){_0x306e5e=_0x306e5e[_0xce73('0x23')]({'plain':!![]});_0x306e5e[_0xce73('0x24')]=_0x4cd0e3;_0x306e5e[_0xce73('0x25')]=_0x4cd0e3;_0x306e5e[_0xce73('0x26')]=_0x306e5e[_0xce73('0x27')];Promise[_0xce73('0x28')]()['then'](function(){if(typeof _0x306e5e[_0xce73('0x29')]===_0xce73('0x2a'))return null;var _0xf708ba=_0xce73('0x2b')+_0x306e5e[_0xce73('0x29')];return db[_0xce73('0x2c')]['query'](_0xf708ba,{'type':db[_0xce73('0x2d')]['QueryTypes']['SELECT'],'raw':!![]});})[_0xce73('0x2e')](function(_0x3a3e32){if(_0x3a3e32){_0x306e5e[_0xce73('0x2f')]=_0x3a3e32[0x0];}if(typeof _0x306e5e['UserId']===_0xce73('0x2a'))return;return getAgent(_0x306e5e[_0xce73('0x30')]);})[_0xce73('0x2e')](function(_0xbb9de0){if(_0xbb9de0){_0x306e5e[_0xce73('0x31')]=util[_0xce73('0x32')](_0xce73('0x33'),_0xbb9de0['name']);_0x306e5e[_0xce73('0x34')]=_0xbb9de0;_0x306e5e[_0xce73('0x24')]=_0x4cd0e3;return request({'event':_0xce73('0x35'),'message':_0x306e5e});}else{return request({'event':_0xce73('0x36'),'message':_0x306e5e});}})[_0xce73('0x22')](function(_0x493280){logger['error'](_0xce73('0x21'),_0xce73('0x37'),_0x493280);});};}function afterCreateOfflineMessage(_0x34fa0b){return function(_0x5ac873){_0x5ac873=_0x5ac873[_0xce73('0x23')]({'plain':!![]});_0x5ac873[_0xce73('0x24')]=_0x34fa0b;_0x5ac873['motionChannel']=_0x34fa0b;_0x5ac873[_0xce73('0x26')]=_0xce73('0x38');return request({'event':_0x5ac873[_0xce73('0x26')],'message':_0x5ac873});};}function afterCreate(_0x3f535d,_0x13898b){return function(_0x54e35d){_0x54e35d=_0x54e35d['get']({'plain':!![]});_0x54e35d[_0xce73('0x24')]=_0x3f535d;_0x54e35d[_0xce73('0x25')]=_0x3f535d;_0x54e35d['event']=_0xce73('0x39');Promise[_0xce73('0x28')]()['then'](function(){var _0x45873d=_0xce73('0x2b')+_0x54e35d[_0xce73('0x29')];return db['sequelize'][_0xce73('0x3a')](_0x45873d,{'type':db['Sequelize']['QueryTypes'][_0xce73('0x3b')],'raw':!![]});})[_0xce73('0x2e')](function(_0x24e184){if(_0x24e184){_0x54e35d[_0xce73('0x2f')]=_0x24e184[0x0];}if(typeof _0x54e35d[_0xce73('0x30')]===_0xce73('0x2a'))return;return getAgent(_0x54e35d['UserId']);})[_0xce73('0x2e')](function(_0x3c0b97){if(_0x3c0b97){_0x54e35d[_0xce73('0x31')]=util[_0xce73('0x32')](_0xce73('0x33'),_0x3c0b97['name']);_0x54e35d[_0xce73('0x34')]=_0x3c0b97;}return request({'event':_0x13898b,'message':_0x54e35d});})['catch'](function(_0x12f533){logger[_0xce73('0x1f')](_0xce73('0x21'),_0xce73('0x3c'),_0x12f533);});};}function afterUpdate(_0x2aa955){return function(_0x5c9f05){var _0x698a4e=_0x5c9f05['changed'](_0xce73('0x3d'))&&_0x5c9f05[_0xce73('0x3d')];var _0xe7535c=_0x5c9f05['changed'](_0xce73('0x3e'));if(_0x698a4e||_0xe7535c){var _0x2e0cf6=_0x698a4e?_0xce73('0xa'):'substatus';var _0xe284fc=_0x5c9f05[_0xce73('0x23')]({'plain':!![]});_0xe284fc['channel']=_0x2aa955;_0xe284fc[_0xce73('0x25')]=_0x2aa955;_0xe284fc[_0xce73('0x26')]=_0x698a4e?'closed':_0xce73('0x3e');var _0x3c8d93=_0xce73('0x2b')+_0xe284fc[_0xce73('0x29')];return db[_0xce73('0x2c')]['query'](_0x3c8d93,{'type':db['Sequelize'][_0xce73('0x3f')][_0xce73('0x3b')],'raw':!![]})[_0xce73('0x2e')](function(_0x2ad862){if(_0x2ad862){_0xe284fc[_0xce73('0x2f')]=_0x2ad862[0x0];}if(typeof _0xe284fc[_0xce73('0x30')]===_0xce73('0x2a'))return;return getAgent(_0xe284fc['UserId']);})[_0xce73('0x2e')](function(_0x4f9db4){if(_0x4f9db4){_0xe284fc['interface']=util[_0xce73('0x32')](_0xce73('0x33'),_0x4f9db4[_0xce73('0x40')]);_0xe284fc[_0xce73('0x34')]=_0x4f9db4;}return request({'event':_0x2e0cf6,'message':_0xe284fc});})[_0xce73('0x22')](function(_0x1ad5bd){logger[_0xce73('0x1f')]('Trigger,\x20%s',_0xce73('0x41'),_0x1ad5bd);});}};}function getAgent(_0x54091a){return db[_0xce73('0x42')]['find']({'where':{'id':_0x54091a},'attributes':['id',_0xce73('0x40'),_0xce73('0x43'),'email',_0xce73('0x44')],'raw':!![]})['then'](function(_0x5c0b48){return _0x5c0b48;});}exports[_0xce73('0x45')]=function(){for(var _0x44de5d=0x0;_0x44de5d=_0x44d54c['agents']){throw Error(_0x9d31('0x15'));}_0x52deb3(_0x277e25);})[_0x9d31('0x16')](function(_0x4436d2){_0x2890d4(_0x4436d2);});});}; \ No newline at end of file +var _0x64b0=['getLicense','role','User','count','then','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','voice','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','isUndefined','blockedAt','updateAttributes'];(function(_0x1f34d3,_0x3e2bb7){var _0x42313a=function(_0x582bf8){while(--_0x582bf8){_0x1f34d3['push'](_0x1f34d3['shift']());}};_0x42313a(++_0x3e2bb7);}(_0x64b0,0x1ea));var _0x064b=function(_0x509ca2,_0x98bbea){_0x509ca2=_0x509ca2-0x0;var _0x583487=_0x64b0[_0x509ca2];return _0x583487;};'use strict';var _=require(_0x064b('0x0'));var BPromise=require(_0x064b('0x1'));var db=require(_0x064b('0x2'))['db'];var util=require('./license/util');var channels=[_0x064b('0x3'),'mail','chat',_0x064b('0x4'),_0x064b('0x5'),_0x064b('0x6'),_0x064b('0x7')];exports[_0x064b('0x8')]=function(){return channels;};exports[_0x064b('0x9')]=function(_0x2a9b4b){_0x2a9b4b=_0x2a9b4b[_0x064b('0xa')]();return _['includes'](channels,_0x2a9b4b);};exports['clearBlockUser']=function(_0x2c7eba,_0x1e44f5,_0x122545,_0x34fdec){var _0x17a27d={'loginAttempts':_0x1e44f5,'blocked':_0x122545};if(!_[_0x064b('0xb')](_0x34fdec)){_0x17a27d[_0x064b('0xc')]=_0x34fdec;}return _0x2c7eba[_0x064b('0xd')](_0x17a27d);};exports[_0x064b('0xe')]=function(_0x3c8129){return new BPromise(function(_0x2b81f0,_0x5781fc){var _0x329d2c=0x0;if(_0x3c8129[_0x064b('0xf')]!=='agent'){_0x2b81f0(_0x3c8129);}db[_0x064b('0x10')][_0x064b('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x3c8129['id']}}})[_0x064b('0x12')](function(_0x5ee001){_0x329d2c=_0x5ee001;return util[_0x064b('0xe')]();})[_0x064b('0x12')](function(_0x678a80){if(_0x678a80&&_0x678a80['agents']&&_0x329d2c>=_0x678a80['agents']){throw Error(_0x064b('0x13'));}_0x2b81f0(_0x3c8129);})[_0x064b('0x14')](function(_0x1beee){_0x5781fc(_0x1beee);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index a458ec0..1563320 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['stack','statusMessage','status','exports','util','../config/logger','api','message','inherits','Bad\x20Request','name','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error'];(function(_0x3fc589,_0x1e16b6){var _0x59c8b5=function(_0x573bb6){while(--_0x573bb6){_0x3fc589['push'](_0x3fc589['shift']());}};_0x59c8b5(++_0x1e16b6);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var APIError=function(_0x351dd5,_0x275161){this[_0xac4a('0x3')]=_0x351dd5||'Internal\x20Server\x20Error';this['name']=_0x275161||'Error';util[_0xac4a('0x4')](APIError,Error);};var APIBadRequestError=function(_0x15b967){this[_0xac4a('0x3')]=_0x15b967||_0xac4a('0x5');this[_0xac4a('0x6')]=_0xac4a('0x5');util[_0xac4a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x10525b){this['message']=_0x10525b||'Entity\x20not\x20found';this[_0xac4a('0x6')]=_0xac4a('0x7');util[_0xac4a('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4f4146){this[_0xac4a('0x3')]=_0x4f4146||_0xac4a('0x8');this[_0xac4a('0x6')]='Out\x20Of\x20Interval';util[_0xac4a('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x488e3c){switch(_0x488e3c){case _0xac4a('0x5'):return 0x190;case'Forbidden',_0xac4a('0x9'):return 0x193;case _0xac4a('0x7'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x24291d){if(_0x24291d==='Out\x20Of\x20Interval')return _0x24291d;return null;}function handleError(_0x21a79){return function(_0x68424a){logger[_0xac4a('0xa')](_0x68424a[_0xac4a('0xb')]);var _0x1b4313=getStatusCode(_0x68424a[_0xac4a('0x6')]);var _0x34bc01=getCustomStatusMessage(_0x68424a[_0xac4a('0x6')]);if(_0x68424a[_0xac4a('0x6')])delete _0x68424a[_0xac4a('0x6')];if(_0x34bc01)_0x21a79[_0xac4a('0xc')]=_0x34bc01;return _0x21a79[_0xac4a('0xd')](_0x1b4313)['send'](_0x68424a);};}module[_0xac4a('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xadb5=['Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','statusMessage','status','send','exports','../config/logger','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found'];(function(_0x16bfc4,_0x4a10c1){var _0x1d0a74=function(_0x10b27a){while(--_0x10b27a){_0x16bfc4['push'](_0x16bfc4['shift']());}};_0x1d0a74(++_0x4a10c1);}(_0xadb5,0xad));var _0x5adb=function(_0x4f8917,_0x49b129){_0x4f8917=_0x4f8917-0x0;var _0x4d3264=_0xadb5[_0x4f8917];return _0x4d3264;};'use strict';var util=require('util');var logger=require(_0x5adb('0x0'))('api');var APIError=function(_0x3d6340,_0x38f67f){this[_0x5adb('0x1')]=_0x3d6340||'Internal\x20Server\x20Error';this[_0x5adb('0x2')]=_0x38f67f||_0x5adb('0x3');util[_0x5adb('0x4')](APIError,Error);};var APIBadRequestError=function(_0x4cb1d1){this[_0x5adb('0x1')]=_0x4cb1d1||_0x5adb('0x5');this[_0x5adb('0x2')]=_0x5adb('0x5');util[_0x5adb('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x353885){this[_0x5adb('0x1')]=_0x353885||_0x5adb('0x6');this[_0x5adb('0x2')]=_0x5adb('0x7');util[_0x5adb('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x336bad){this[_0x5adb('0x1')]=_0x336bad||_0x5adb('0x8');this['name']='Out\x20Of\x20Interval';util[_0x5adb('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1ea238){switch(_0x1ea238){case _0x5adb('0x5'):return 0x190;case'Forbidden',_0x5adb('0x9'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x2a0b70){if(_0x2a0b70==='Out\x20Of\x20Interval')return _0x2a0b70;return null;}function handleError(_0x8cfcc6){return function(_0x39a0b3){logger[_0x5adb('0xa')](_0x39a0b3['stack']);var _0x2a545b=getStatusCode(_0x39a0b3[_0x5adb('0x2')]);var _0xf82f72=getCustomStatusMessage(_0x39a0b3['name']);if(_0x39a0b3[_0x5adb('0x2')])delete _0x39a0b3['name'];if(_0xf82f72)_0x8cfcc6[_0x5adb('0xb')]=_0xf82f72;return _0x8cfcc6[_0x5adb('0xc')](_0x2a545b)[_0x5adb('0xd')](_0x39a0b3);};}module[_0x5adb('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index fbd50fe..949922a 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5da6=['render','send','exports','404','status'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0x5da6,0x1ec));var _0x65da=function(_0x3ef025,_0x31f409){_0x3ef025=_0x3ef025-0x0;var _0x32f8aa=_0x5da6[_0x3ef025];return _0x32f8aa;};'use strict';module[_0x65da('0x0')][0x194]=function pageNotFound(_0x2be4f5,_0x446881){var _0x561375=_0x65da('0x1');var _0x125e39=0x194;var _0x549bee={'status':_0x125e39};_0x446881[_0x65da('0x2')](_0x549bee[_0x65da('0x2')]);_0x446881[_0x65da('0x3')](_0x561375,{},function(_0x310b82,_0x56ee19){if(_0x310b82){return _0x446881['status'](_0x549bee[_0x65da('0x2')])['json'](_0x549bee);}_0x446881[_0x65da('0x4')](_0x56ee19);});}; \ No newline at end of file +var _0x4273=['json','exports','404','status'];(function(_0x36f538,_0x5ba014){var _0x442943=function(_0x4ea975){while(--_0x4ea975){_0x36f538['push'](_0x36f538['shift']());}};_0x442943(++_0x5ba014);}(_0x4273,0xc5));var _0x3427=function(_0x2e57df,_0x338459){_0x2e57df=_0x2e57df-0x0;var _0x42d49b=_0x4273[_0x2e57df];return _0x42d49b;};'use strict';module[_0x3427('0x0')][0x194]=function pageNotFound(_0x323cc2,_0x287d01){var _0x47a3ec=_0x3427('0x1');var _0x12c06c=0x194;var _0x62fe43={'status':_0x12c06c};_0x287d01['status'](_0x62fe43['status']);_0x287d01['render'](_0x47a3ec,{},function(_0x5c833c,_0x385b8d){if(_0x5c833c){return _0x287d01[_0x3427('0x2')](_0x62fe43['status'])[_0x3427('0x3')](_0x62fe43);}_0x287d01['send'](_0x385b8d);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 00ae539..685efbc 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x4226d6,_0x3864ca){var _0x19655b=function(_0x1d43a1){while(--_0x1d43a1){_0x4226d6['push'](_0x4226d6['shift']());}};_0x19655b(++_0x3864ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index d31dc8a..1e07531 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57d4=['/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/auth/local','./api/authLocal','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','express','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','/api/trunks','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/interactions','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/interactions','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/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'];(function(_0x17e957,_0x21605a){var _0x5b9136=function(_0x175510){while(--_0x175510){_0x17e957['push'](_0x17e957['shift']());}};_0x5b9136(++_0x21605a);}(_0x57d4,0x78));var _0x457d=function(_0x53a90b,_0x25afdc){_0x53a90b=_0x53a90b-0x0;var _0x250c62=_0x57d4[_0x53a90b];return _0x250c62;};'use strict';var path=require(_0x457d('0x0'));var express=require(_0x457d('0x1'));var errors=require('./errors');var config=require(_0x457d('0x2'));var setupLoggers=require(_0x457d('0x3'))[_0x457d('0x4')];var clientSideLogs=require(_0x457d('0x5'));exports[_0x457d('0x6')]=function(_0x3c89b2){return setupLoggers(_0x3c89b2)[_0x457d('0x7')](function(){_0x3c89b2[_0x457d('0x8')](_0x457d('0x9'),require(_0x457d('0xa')));_0x3c89b2[_0x457d('0x8')]('/api/voice/chanspy',require(_0x457d('0xb')));_0x3c89b2[_0x457d('0x8')]('/api/voice/contexts',require('./api/voiceContext'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xc'),require(_0x457d('0xd')));_0x3c89b2['use']('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xe'),require(_0x457d('0xf')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x10'),require(_0x457d('0x11')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x12'),require(_0x457d('0x13')));_0x3c89b2['use'](_0x457d('0x14'),require(_0x457d('0x15')));_0x3c89b2['use']('/api/voice/mails/messages',require(_0x457d('0x16')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x17'),require(_0x457d('0x18')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x19'),require(_0x457d('0x1a')));_0x3c89b2[_0x457d('0x8')]('/api/voice/agents/reports',require(_0x457d('0x1b')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x1c'),require('./api/voiceQueueReport'));_0x3c89b2['use'](_0x457d('0x1d'),require('./api/memberReport'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x1e'),require('./api/trunk'));_0x3c89b2[_0x457d('0x8')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x1f'),require(_0x457d('0x20')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x21'),require(_0x457d('0x22')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x23'),require(_0x457d('0x24')));_0x3c89b2[_0x457d('0x8')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x3c89b2['use'](_0x457d('0x25'),require('./api/mailInteraction'));_0x3c89b2['use']('/api/mail/messages',require(_0x457d('0x26')));_0x3c89b2[_0x457d('0x8')]('/api/mail/applications',require(_0x457d('0x27')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x28'),require(_0x457d('0x29')));_0x3c89b2['use']('/api/dashboards',require(_0x457d('0x2a')));_0x3c89b2['use'](_0x457d('0x2b'),require(_0x457d('0x2c')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x2d'),require('./api/faxAccount'));_0x3c89b2[_0x457d('0x8')]('/api/fax/applications',require('./api/faxApplication'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x2e'),require('./api/faxInteraction'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x2f'),require('./api/faxMessage'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x30'),require(_0x457d('0x31')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x32'),require(_0x457d('0x33')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x34'),require(_0x457d('0x35')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x36'),require(_0x457d('0x37')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x38'),require(_0x457d('0x39')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x3a'),require(_0x457d('0x3b')));_0x3c89b2['use'](_0x457d('0x3c'),require(_0x457d('0x3d')));_0x3c89b2['use']('/api/openchannel/accounts',require(_0x457d('0x3e')));_0x3c89b2[_0x457d('0x8')]('/api/openchannel/applications',require(_0x457d('0x3f')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x40'),require(_0x457d('0x41')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x42'),require(_0x457d('0x43')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x44'),require(_0x457d('0x45')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x46'),require(_0x457d('0x47')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x48'),require('./api/openchannelQueueReport'));_0x3c89b2[_0x457d('0x8')]('/api/chat/applications',require('./api/chatApplication'));_0x3c89b2['use'](_0x457d('0x49'),require('./api/chatInteraction'));_0x3c89b2[_0x457d('0x8')]('/api/chat/messages',require('./api/chatMessage'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x4a'),require(_0x457d('0x4b')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x4c'),require(_0x457d('0x4d')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x4e'),require(_0x457d('0x4f')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x50'),require(_0x457d('0x51')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x52'),require(_0x457d('0x53')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x54'),require('./api/cmContact'));_0x3c89b2[_0x457d('0x8')]('/api/cm/hopper',require(_0x457d('0x55')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x56'),require(_0x457d('0x57')));_0x3c89b2[_0x457d('0x8')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x3c89b2[_0x457d('0x8')]('/api/cm/hopper_history',require(_0x457d('0x58')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x59'),require('./api/cmCustomField'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x5a'),require(_0x457d('0x5b')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x5c'),require(_0x457d('0x5d')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x5e'),require(_0x457d('0x5f')));_0x3c89b2['use']('/api/dispositions',require(_0x457d('0x60')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x61'),require(_0x457d('0x62')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x63'),require('./api/interval'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x64'),require(_0x457d('0x65')));_0x3c89b2['use'](_0x457d('0x66'),require(_0x457d('0x67')));_0x3c89b2[_0x457d('0x8')]('/api/voiceQueuesLog',require(_0x457d('0x68')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x69'),require(_0x457d('0x6a')));_0x3c89b2['use'](_0x457d('0x6b'),require(_0x457d('0x6c')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x6d'),require(_0x457d('0x6e')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x6f'),require(_0x457d('0x70')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x71'),require('./api/cmContactHasItem'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x72'),require(_0x457d('0x73')));_0x3c89b2[_0x457d('0x8')]('/api/templates',require(_0x457d('0x74')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x75'),require(_0x457d('0x76')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x77'),require(_0x457d('0x78')));_0x3c89b2[_0x457d('0x8')]('/api/integrations',require('./api/integration'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x79'),require(_0x457d('0x7a')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x7b'),require(_0x457d('0x7c')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x7d'),require(_0x457d('0x7e')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x7f'),require(_0x457d('0x80')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x81'),require('./api/analyticMetric'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x82'),require(_0x457d('0x83')));_0x3c89b2[_0x457d('0x8')]('/api/analytics/tree_reports',require(_0x457d('0x84')));_0x3c89b2[_0x457d('0x8')]('/api/integrations/salesforce/accounts',require(_0x457d('0x85')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x86'),require('./api/intSalesforceConfiguration'));_0x3c89b2['use'](_0x457d('0x87'),require('./api/intSalesforceField'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x88'),require(_0x457d('0x89')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x8a'),require(_0x457d('0x8b')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x8c'),require(_0x457d('0x8d')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x8e'),require(_0x457d('0x8f')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x90'),require('./api/intDeskConfiguration'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x91'),require('./api/intDeskField'));_0x3c89b2[_0x457d('0x8')]('/api/integrations/zoho/accounts',require(_0x457d('0x92')));_0x3c89b2[_0x457d('0x8')]('/api/integrations/zoho/configurations',require(_0x457d('0x93')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x94'),require(_0x457d('0x95')));_0x3c89b2['use'](_0x457d('0x96'),require('./api/intZendeskAccount'));_0x3c89b2[_0x457d('0x8')]('/api/integrations/zendesk/configurations',require(_0x457d('0x97')));_0x3c89b2[_0x457d('0x8')]('/api/integrations/zendesk/fields',require(_0x457d('0x98')));_0x3c89b2['use']('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x99'),require('./api/intFreshdeskConfiguration'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x9a'),require(_0x457d('0x9b')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x9c'),require(_0x457d('0x9d')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x9e'),require(_0x457d('0x9f')));_0x3c89b2['use']('/api/integrations/vtiger/fields',require(_0x457d('0xa0')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xa1'),require(_0x457d('0xa2')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xa3'),require(_0x457d('0xa4')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xa5'),require(_0x457d('0xa6')));_0x3c89b2['use']('/api/integrations/dynamics365/accounts',require(_0x457d('0xa7')));_0x3c89b2['use'](_0x457d('0xa8'),require('./api/intDynamics365Configuration'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xa9'),require(_0x457d('0xaa')));_0x3c89b2['use']('/api/integrations/freshsales/accounts',require(_0x457d('0xab')));_0x3c89b2[_0x457d('0x8')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xac'),require('./api/intFreshsalesField'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xad'),require(_0x457d('0xae')));_0x3c89b2[_0x457d('0x8')]('/api/chat/reports/queue',require(_0x457d('0xaf')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xb0'),require(_0x457d('0xb1')));_0x3c89b2[_0x457d('0x8')]('/api/jscripty/answers/reports',require(_0x457d('0xb2')));_0x3c89b2[_0x457d('0x8')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xb3'),require(_0x457d('0xb4')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xb5'),require(_0x457d('0xb6')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xb7'),require('./api/squareReport'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xb8'),require(_0x457d('0xb9')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xba'),require('./api/jscriptyProject'));_0x3c89b2['use'](_0x457d('0xbb'),require('./api/setting'));_0x3c89b2['use'](_0x457d('0xbc'),require(_0x457d('0xbd')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xbe'),require(_0x457d('0xbf')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xc0'),require(_0x457d('0xc1')));_0x3c89b2['use']('/api/square/messages',require(_0x457d('0xc2')));_0x3c89b2['use'](_0x457d('0xc3'),require(_0x457d('0xc4')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xc5'),require('./api/license'));_0x3c89b2[_0x457d('0x8')]('/api/campaigns',require('./api/campaign'));_0x3c89b2[_0x457d('0x8')]('/api/migrations',require(_0x457d('0xc6')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xc7'),require(_0x457d('0xc8')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xc9'),require(_0x457d('0xca')));_0x3c89b2[_0x457d('0x8')]('/api/mail/reports/transfer',require(_0x457d('0xcb')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xcc'),require(_0x457d('0xcd')));_0x3c89b2['use']('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x3c89b2['use'](_0x457d('0xce'),require('./api/openchannelTransferReport'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xcf'),require(_0x457d('0xd0')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xd1'),require(_0x457d('0xd2')));_0x3c89b2[_0x457d('0x8')]('/api/voice/prefixes',require(_0x457d('0xd3')));_0x3c89b2[_0x457d('0x8')]('/api/userProfiles',require('./api/userProfile'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xd4'),require(_0x457d('0xd5')));_0x3c89b2['use'](_0x457d('0xd6'),require(_0x457d('0xd7')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xd8'),require(_0x457d('0xd9')));_0x3c89b2['use'](_0x457d('0xda'),require('./api/whatsappAccount'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xdb'),require(_0x457d('0xdc')));_0x3c89b2['use'](_0x457d('0xdd'),require(_0x457d('0xde')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xdf'),require('./api/whatsappMessage'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xe0'),require(_0x457d('0xe1')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xe2'),require(_0x457d('0xe3')));_0x3c89b2[_0x457d('0x8')]('/api/whatsapp/queues',require(_0x457d('0xe4')));_0x3c89b2['use'](_0x457d('0xe5'),require(_0x457d('0xe6')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xe7'),require(_0x457d('0xe8')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xe9'),require('./api/user-setting'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xea'),require(_0x457d('0xeb')));_0x3c89b2[_0x457d('0x8')]('/api/auth/google',require('./api/authGoogle'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xec'),require(_0x457d('0xed')));_0x3c89b2['use']('/api/jira',require(_0x457d('0xee')));_0x3c89b2['use'](_0x457d('0xef'),require(_0x457d('0xf0')));_0x3c89b2[_0x457d('0x8')]('/api/version',require(_0x457d('0xf1')));_0x3c89b2['use'](_0x457d('0xf2'),require(_0x457d('0xf3')));_0x3c89b2['use'](_0x457d('0xf4'),require(_0x457d('0xf5')));_0x3c89b2[_0x457d('0x8')]('/api/webbar',require(_0x457d('0xf6')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xf7'),clientSideLogs);_0x3c89b2[_0x457d('0x8')](_0x457d('0xf8'),express[_0x457d('0xf9')](path[_0x457d('0xfa')](config[_0x457d('0xfb')],'/apidoc')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xfc'),express[_0x457d('0xf9')](path[_0x457d('0xfa')](config[_0x457d('0xfb')],_0x457d('0xfc'))));_0x3c89b2[_0x457d('0x8')](_0x457d('0xfd'),express[_0x457d('0xf9')](path[_0x457d('0xfa')](config[_0x457d('0xfb')],_0x457d('0xfd'))));_0x3c89b2['use'](_0x457d('0xfe'),express[_0x457d('0xf9')](path['join'](config[_0x457d('0xfb')],_0x457d('0xff'),'3.5.0')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x100'),express[_0x457d('0xf9')](path['join'](config['root'],_0x457d('0x101'))));_0x3c89b2[_0x457d('0x102')](_0x457d('0x103'))[_0x457d('0x104')](errors[0x194]);_0x3c89b2[_0x457d('0x102')]('/*')[_0x457d('0x104')](function(_0x8d8653,_0x116cd5){_0x116cd5[_0x457d('0x105')](path[_0x457d('0x106')](_0x3c89b2['get']('appPath')+_0x457d('0x107')));});return _0x3c89b2;});}; \ No newline at end of file +var _0x195e=['/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./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/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./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/cmCustomField','/api/automations','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/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/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/networks','./api/network','/api/chat/reports/queue','./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/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','/api/plugins','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','/www','/demo','/snippet','snippet','3.5.0','/plugins','root','route','/:url(api|auth|components|app|bower_components|assets)/*','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/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport'];(function(_0x3ab3a1,_0x120662){var _0x53174c=function(_0x2e6385){while(--_0x2e6385){_0x3ab3a1['push'](_0x3ab3a1['shift']());}};_0x53174c(++_0x120662);}(_0x195e,0xfb));var _0xe195=function(_0x235ac3,_0x1ec247){_0x235ac3=_0x235ac3-0x0;var _0x4a3eb6=_0x195e[_0x235ac3];return _0x4a3eb6;};'use strict';var path=require(_0xe195('0x0'));var express=require(_0xe195('0x1'));var errors=require(_0xe195('0x2'));var config=require(_0xe195('0x3'));var setupLoggers=require(_0xe195('0x4'))[_0xe195('0x5')];var clientSideLogs=require(_0xe195('0x6'));exports[_0xe195('0x7')]=function(_0x2243e9){return setupLoggers(_0x2243e9)[_0xe195('0x8')](function(){_0x2243e9[_0xe195('0x9')](_0xe195('0xa'),require(_0xe195('0xb')));_0x2243e9['use'](_0xe195('0xc'),require(_0xe195('0xd')));_0x2243e9[_0xe195('0x9')](_0xe195('0xe'),require(_0xe195('0xf')));_0x2243e9['use']('/api/voice/extensions',require('./api/voiceExtension'));_0x2243e9[_0xe195('0x9')](_0xe195('0x10'),require(_0xe195('0x11')));_0x2243e9[_0xe195('0x9')]('/api/voice/queues',require(_0xe195('0x12')));_0x2243e9[_0xe195('0x9')](_0xe195('0x13'),require('./api/voiceRecording'));_0x2243e9[_0xe195('0x9')](_0xe195('0x14'),require('./api/screenRecording'));_0x2243e9[_0xe195('0x9')](_0xe195('0x15'),require(_0xe195('0x16')));_0x2243e9[_0xe195('0x9')]('/api/voice/mails/messages',require(_0xe195('0x17')));_0x2243e9[_0xe195('0x9')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x2243e9[_0xe195('0x9')]('/api/voice/dials/reports',require(_0xe195('0x18')));_0x2243e9['use']('/api/voice/agents/reports',require(_0xe195('0x19')));_0x2243e9[_0xe195('0x9')](_0xe195('0x1a'),require(_0xe195('0x1b')));_0x2243e9[_0xe195('0x9')](_0xe195('0x1c'),require(_0xe195('0x1d')));_0x2243e9[_0xe195('0x9')](_0xe195('0x1e'),require(_0xe195('0x1f')));_0x2243e9['use'](_0xe195('0x20'),require(_0xe195('0x21')));_0x2243e9[_0xe195('0x9')](_0xe195('0x22'),require(_0xe195('0x23')));_0x2243e9[_0xe195('0x9')]('/api/mail/accounts',require(_0xe195('0x24')));_0x2243e9[_0xe195('0x9')](_0xe195('0x25'),require(_0xe195('0x26')));_0x2243e9['use']('/api/mail/substatuses',require('./api/mailSubstatus'));_0x2243e9[_0xe195('0x9')](_0xe195('0x27'),require(_0xe195('0x28')));_0x2243e9[_0xe195('0x9')](_0xe195('0x29'),require(_0xe195('0x2a')));_0x2243e9[_0xe195('0x9')](_0xe195('0x2b'),require(_0xe195('0x2c')));_0x2243e9[_0xe195('0x9')](_0xe195('0x2d'),require(_0xe195('0x2e')));_0x2243e9[_0xe195('0x9')]('/api/dashboards',require(_0xe195('0x2f')));_0x2243e9[_0xe195('0x9')](_0xe195('0x30'),require(_0xe195('0x31')));_0x2243e9[_0xe195('0x9')](_0xe195('0x32'),require(_0xe195('0x33')));_0x2243e9[_0xe195('0x9')](_0xe195('0x34'),require(_0xe195('0x35')));_0x2243e9['use'](_0xe195('0x36'),require(_0xe195('0x37')));_0x2243e9[_0xe195('0x9')](_0xe195('0x38'),require(_0xe195('0x39')));_0x2243e9['use']('/api/fax/queues',require(_0xe195('0x3a')));_0x2243e9[_0xe195('0x9')](_0xe195('0x3b'),require(_0xe195('0x3c')));_0x2243e9[_0xe195('0x9')](_0xe195('0x3d'),require('./api/smsAccount'));_0x2243e9[_0xe195('0x9')](_0xe195('0x3e'),require(_0xe195('0x3f')));_0x2243e9['use'](_0xe195('0x40'),require('./api/smsInteraction'));_0x2243e9[_0xe195('0x9')](_0xe195('0x41'),require('./api/smsMessage'));_0x2243e9[_0xe195('0x9')](_0xe195('0x42'),require(_0xe195('0x43')));_0x2243e9['use'](_0xe195('0x44'),require(_0xe195('0x45')));_0x2243e9[_0xe195('0x9')](_0xe195('0x46'),require(_0xe195('0x47')));_0x2243e9[_0xe195('0x9')]('/api/openchannel/interactions',require(_0xe195('0x48')));_0x2243e9[_0xe195('0x9')](_0xe195('0x49'),require(_0xe195('0x4a')));_0x2243e9[_0xe195('0x9')](_0xe195('0x4b'),require(_0xe195('0x4c')));_0x2243e9['use'](_0xe195('0x4d'),require(_0xe195('0x4e')));_0x2243e9['use'](_0xe195('0x4f'),require(_0xe195('0x50')));_0x2243e9['use'](_0xe195('0x51'),require('./api/chatApplication'));_0x2243e9[_0xe195('0x9')](_0xe195('0x52'),require(_0xe195('0x53')));_0x2243e9[_0xe195('0x9')](_0xe195('0x54'),require(_0xe195('0x55')));_0x2243e9['use'](_0xe195('0x56'),require(_0xe195('0x57')));_0x2243e9[_0xe195('0x9')]('/api/chat/queues',require(_0xe195('0x58')));_0x2243e9[_0xe195('0x9')]('/api/chat/groups',require(_0xe195('0x59')));_0x2243e9[_0xe195('0x9')]('/api/chat/proactive_actions',require(_0xe195('0x5a')));_0x2243e9[_0xe195('0x9')](_0xe195('0x5b'),require('./api/cmCompany'));_0x2243e9[_0xe195('0x9')](_0xe195('0x5c'),require(_0xe195('0x5d')));_0x2243e9[_0xe195('0x9')](_0xe195('0x5e'),require(_0xe195('0x5f')));_0x2243e9[_0xe195('0x9')](_0xe195('0x60'),require(_0xe195('0x61')));_0x2243e9[_0xe195('0x9')](_0xe195('0x62'),require(_0xe195('0x63')));_0x2243e9['use'](_0xe195('0x64'),require(_0xe195('0x65')));_0x2243e9[_0xe195('0x9')](_0xe195('0x66'),require(_0xe195('0x67')));_0x2243e9['use']('/api/actions',require('./api/action'));_0x2243e9['use'](_0xe195('0x68'),require('./api/automation'));_0x2243e9[_0xe195('0x9')]('/api/canned_answers',require('./api/cannedAnswer'));_0x2243e9[_0xe195('0x9')](_0xe195('0x69'),require(_0xe195('0x6a')));_0x2243e9[_0xe195('0x9')](_0xe195('0x6b'),require(_0xe195('0x6c')));_0x2243e9[_0xe195('0x9')](_0xe195('0x6d'),require('./api/interval'));_0x2243e9['use'](_0xe195('0x6e'),require(_0xe195('0x6f')));_0x2243e9['use'](_0xe195('0x70'),require(_0xe195('0x71')));_0x2243e9[_0xe195('0x9')](_0xe195('0x72'),require(_0xe195('0x73')));_0x2243e9[_0xe195('0x9')](_0xe195('0x74'),require(_0xe195('0x75')));_0x2243e9[_0xe195('0x9')](_0xe195('0x76'),require(_0xe195('0x77')));_0x2243e9[_0xe195('0x9')]('/api/tags',require(_0xe195('0x78')));_0x2243e9[_0xe195('0x9')](_0xe195('0x79'),require(_0xe195('0x7a')));_0x2243e9[_0xe195('0x9')](_0xe195('0x7b'),require(_0xe195('0x7c')));_0x2243e9[_0xe195('0x9')](_0xe195('0x7d'),require(_0xe195('0x7e')));_0x2243e9[_0xe195('0x9')]('/api/templates',require(_0xe195('0x7f')));_0x2243e9['use'](_0xe195('0x80'),require(_0xe195('0x81')));_0x2243e9[_0xe195('0x9')]('/api/variables',require('./api/variable'));_0x2243e9[_0xe195('0x9')](_0xe195('0x82'),require(_0xe195('0x83')));_0x2243e9[_0xe195('0x9')](_0xe195('0x84'),require(_0xe195('0x85')));_0x2243e9[_0xe195('0x9')](_0xe195('0x86'),require(_0xe195('0x87')));_0x2243e9[_0xe195('0x9')](_0xe195('0x88'),require(_0xe195('0x89')));_0x2243e9[_0xe195('0x9')](_0xe195('0x8a'),require(_0xe195('0x8b')));_0x2243e9[_0xe195('0x9')](_0xe195('0x8c'),require(_0xe195('0x8d')));_0x2243e9[_0xe195('0x9')]('/api/analytics/field_reports',require(_0xe195('0x8e')));_0x2243e9[_0xe195('0x9')](_0xe195('0x8f'),require(_0xe195('0x90')));_0x2243e9[_0xe195('0x9')](_0xe195('0x91'),require('./api/intSalesforceAccount'));_0x2243e9['use'](_0xe195('0x92'),require(_0xe195('0x93')));_0x2243e9[_0xe195('0x9')]('/api/integrations/salesforce/fields',require(_0xe195('0x94')));_0x2243e9[_0xe195('0x9')]('/api/integrations/sugarcrm/accounts',require(_0xe195('0x95')));_0x2243e9[_0xe195('0x9')]('/api/integrations/sugarcrm/configurations',require(_0xe195('0x96')));_0x2243e9['use'](_0xe195('0x97'),require(_0xe195('0x98')));_0x2243e9[_0xe195('0x9')](_0xe195('0x99'),require(_0xe195('0x9a')));_0x2243e9[_0xe195('0x9')](_0xe195('0x9b'),require('./api/intDeskConfiguration'));_0x2243e9[_0xe195('0x9')](_0xe195('0x9c'),require(_0xe195('0x9d')));_0x2243e9[_0xe195('0x9')](_0xe195('0x9e'),require(_0xe195('0x9f')));_0x2243e9[_0xe195('0x9')](_0xe195('0xa0'),require(_0xe195('0xa1')));_0x2243e9[_0xe195('0x9')](_0xe195('0xa2'),require(_0xe195('0xa3')));_0x2243e9[_0xe195('0x9')](_0xe195('0xa4'),require(_0xe195('0xa5')));_0x2243e9['use'](_0xe195('0xa6'),require(_0xe195('0xa7')));_0x2243e9[_0xe195('0x9')](_0xe195('0xa8'),require(_0xe195('0xa9')));_0x2243e9['use'](_0xe195('0xaa'),require(_0xe195('0xab')));_0x2243e9[_0xe195('0x9')](_0xe195('0xac'),require(_0xe195('0xad')));_0x2243e9[_0xe195('0x9')](_0xe195('0xae'),require(_0xe195('0xaf')));_0x2243e9[_0xe195('0x9')](_0xe195('0xb0'),require(_0xe195('0xb1')));_0x2243e9[_0xe195('0x9')](_0xe195('0xb2'),require(_0xe195('0xb3')));_0x2243e9['use'](_0xe195('0xb4'),require('./api/intVtigerField'));_0x2243e9[_0xe195('0x9')]('/api/integrations/servicenow/accounts',require(_0xe195('0xb5')));_0x2243e9[_0xe195('0x9')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x2243e9[_0xe195('0x9')](_0xe195('0xb6'),require('./api/intServicenowField'));_0x2243e9[_0xe195('0x9')](_0xe195('0xb7'),require('./api/intDynamics365Account'));_0x2243e9[_0xe195('0x9')](_0xe195('0xb8'),require(_0xe195('0xb9')));_0x2243e9[_0xe195('0x9')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x2243e9['use'](_0xe195('0xba'),require('./api/intFreshsalesAccount'));_0x2243e9['use'](_0xe195('0xbb'),require(_0xe195('0xbc')));_0x2243e9[_0xe195('0x9')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x2243e9[_0xe195('0x9')](_0xe195('0xbd'),require(_0xe195('0xbe')));_0x2243e9['use'](_0xe195('0xbf'),require(_0xe195('0xc0')));_0x2243e9[_0xe195('0x9')](_0xe195('0xc1'),require(_0xe195('0xc2')));_0x2243e9[_0xe195('0x9')](_0xe195('0xc3'),require(_0xe195('0xc4')));_0x2243e9[_0xe195('0x9')](_0xe195('0xc5'),require('./api/jscriptyQuestionReport'));_0x2243e9[_0xe195('0x9')](_0xe195('0xc6'),require(_0xe195('0xc7')));_0x2243e9[_0xe195('0x9')]('/api/sms/reports/queue',require(_0xe195('0xc8')));_0x2243e9[_0xe195('0x9')](_0xe195('0xc9'),require(_0xe195('0xca')));_0x2243e9[_0xe195('0x9')](_0xe195('0xcb'),require(_0xe195('0xcc')));_0x2243e9['use'](_0xe195('0xcd'),require(_0xe195('0xce')));_0x2243e9[_0xe195('0x9')](_0xe195('0xcf'),require('./api/setting'));_0x2243e9['use'](_0xe195('0xd0'),require(_0xe195('0xd1')));_0x2243e9[_0xe195('0x9')](_0xe195('0xd2'),require(_0xe195('0xd3')));_0x2243e9[_0xe195('0x9')]('/api/square/recordings',require('./api/squareRecording'));_0x2243e9[_0xe195('0x9')](_0xe195('0xd4'),require(_0xe195('0xd5')));_0x2243e9[_0xe195('0x9')](_0xe195('0xd6'),require(_0xe195('0xd7')));_0x2243e9[_0xe195('0x9')](_0xe195('0xd8'),require('./api/license'));_0x2243e9[_0xe195('0x9')](_0xe195('0xd9'),require(_0xe195('0xda')));_0x2243e9[_0xe195('0x9')](_0xe195('0xdb'),require('./api/migration'));_0x2243e9[_0xe195('0x9')](_0xe195('0xdc'),require('./api/attachment'));_0x2243e9[_0xe195('0x9')](_0xe195('0xdd'),require('./api/plugin'));_0x2243e9[_0xe195('0x9')](_0xe195('0xde'),require('./api/mailTransferReport'));_0x2243e9[_0xe195('0x9')](_0xe195('0xdf'),require(_0xe195('0xe0')));_0x2243e9[_0xe195('0x9')](_0xe195('0xe1'),require(_0xe195('0xe2')));_0x2243e9[_0xe195('0x9')](_0xe195('0xe3'),require(_0xe195('0xe4')));_0x2243e9[_0xe195('0x9')]('/api/sms/reports/transfer',require(_0xe195('0xe5')));_0x2243e9['use'](_0xe195('0xe6'),require('./api/cmList'));_0x2243e9['use'](_0xe195('0xe7'),require(_0xe195('0xe8')));_0x2243e9[_0xe195('0x9')]('/api/userProfiles',require(_0xe195('0xe9')));_0x2243e9[_0xe195('0x9')](_0xe195('0xea'),require(_0xe195('0xeb')));_0x2243e9[_0xe195('0x9')](_0xe195('0xec'),require(_0xe195('0xed')));_0x2243e9[_0xe195('0x9')](_0xe195('0xee'),require(_0xe195('0xef')));_0x2243e9[_0xe195('0x9')](_0xe195('0xf0'),require('./api/whatsappAccount'));_0x2243e9[_0xe195('0x9')]('/api/whatsapp/applications',require(_0xe195('0xf1')));_0x2243e9[_0xe195('0x9')](_0xe195('0xf2'),require(_0xe195('0xf3')));_0x2243e9[_0xe195('0x9')](_0xe195('0xf4'),require(_0xe195('0xf5')));_0x2243e9[_0xe195('0x9')](_0xe195('0xf6'),require('./api/whatsappQueueReport'));_0x2243e9[_0xe195('0x9')](_0xe195('0xf7'),require(_0xe195('0xf8')));_0x2243e9[_0xe195('0x9')](_0xe195('0xf9'),require(_0xe195('0xfa')));_0x2243e9[_0xe195('0x9')](_0xe195('0xfb'),require('./api/cloudProvider'));_0x2243e9[_0xe195('0x9')](_0xe195('0xfc'),require('./api/realtime'));_0x2243e9[_0xe195('0x9')]('/api/user-settings',require(_0xe195('0xfd')));_0x2243e9['use'](_0xe195('0xfe'),require('./api/authLocal'));_0x2243e9[_0xe195('0x9')](_0xe195('0xff'),require(_0xe195('0x100')));_0x2243e9[_0xe195('0x9')]('/api/auth/activedirectory',require(_0xe195('0x101')));_0x2243e9[_0xe195('0x9')](_0xe195('0x102'),require(_0xe195('0x103')));_0x2243e9[_0xe195('0x9')](_0xe195('0x104'),require(_0xe195('0x105')));_0x2243e9[_0xe195('0x9')](_0xe195('0x106'),require(_0xe195('0x107')));_0x2243e9['use']('/api/system',require(_0xe195('0x108')));_0x2243e9['use'](_0xe195('0x109'),require('./api/pm2'));_0x2243e9[_0xe195('0x9')](_0xe195('0x10a'),require(_0xe195('0x10b')));_0x2243e9[_0xe195('0x9')](_0xe195('0x10c'),clientSideLogs);_0x2243e9['use'](_0xe195('0x10d'),express[_0xe195('0x10e')](path[_0xe195('0x10f')](config['root'],_0xe195('0x10d'))));_0x2243e9[_0xe195('0x9')](_0xe195('0x110'),express[_0xe195('0x10e')](path['join'](config['root'],_0xe195('0x110'))));_0x2243e9['use'](_0xe195('0x111'),express[_0xe195('0x10e')](path[_0xe195('0x10f')](config['root'],_0xe195('0x111'))));_0x2243e9[_0xe195('0x9')](_0xe195('0x112'),express['static'](path['join'](config['root'],_0xe195('0x113'),_0xe195('0x114'))));_0x2243e9['use'](_0xe195('0x115'),express[_0xe195('0x10e')](path[_0xe195('0x10f')](config[_0xe195('0x116')],'/server/files/plugins')));_0x2243e9[_0xe195('0x117')](_0xe195('0x118'))[_0xe195('0x119')](errors[0x194]);_0x2243e9['route']('/*')[_0xe195('0x119')](function(_0x426c9d,_0x1aa68a){_0x1aa68a[_0xe195('0x11a')](path[_0xe195('0x11b')](_0x2243e9[_0xe195('0x119')](_0xe195('0x11c'))+'/index.html'));});return _0x2243e9;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 314d524..5bf5f7d 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb54=['../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.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/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.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/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!'];(function(_0x24b53b,_0x57c20d){var _0x3b5c00=function(_0xed1211){while(--_0xed1211){_0x24b53b['push'](_0x24b53b['shift']());}};_0x3b5c00(++_0x57c20d);}(_0xeb54,0x13f));var _0x4eb5=function(_0x22ae68,_0x5c9a00){_0x22ae68=_0x22ae68-0x0;var _0x5555db=_0xeb54[_0x22ae68];return _0x5555db;};'use strict';var jayson=require(_0x4eb5('0x0'));var _=require(_0x4eb5('0x1'));var config=require(_0x4eb5('0x2'));exports[_0x4eb5('0x3')]=function(){return new Promise(function(_0x2e347f,_0x25780c){var _0x5e6c71={};_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x5')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x6')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x7')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x8')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x9')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0xa')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0xb')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0xc')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0xd')));_0x5e6c71=_['merge'](_0x5e6c71,require('../api/trunk/trunk.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0xe')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0xf')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x10')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x11')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x12')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/mailMessage/mailMessage.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x13')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x14')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x15')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x16')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x17')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/faxMessage/faxMessage.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x18')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x19')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x1a')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/smsInteraction/smsInteraction.rpc'));_0x5e6c71=_['merge'](_0x5e6c71,require('../api/smsMessage/smsMessage.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/smsQueue/smsQueue.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x1b')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x1c')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x1d')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x1e')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x1f')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x20')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x21')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x22')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x23')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x24')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x25')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x26')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x27')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x28')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x29')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/template/template.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x2a')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x2b')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x2c')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x2d')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x2e')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x2f')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x30')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x31')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x32')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x33')));_0x5e6c71=_['merge'](_0x5e6c71,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x34')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x35')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x36')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x37')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x38')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x39')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x3a')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/squareRecording/squareRecording.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x3b')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x3c')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x3d')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x3e')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x3f')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x40')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x41')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x42')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x43')));var _0x77bab5=jayson[_0x4eb5('0x44')](_0x5e6c71)[_0x4eb5('0x45')]();var _0x4d64d2=config[_0x4eb5('0x46')][_0x4eb5('0x47')]||config[_0x4eb5('0x47')]+0x1;var _0x39513f=config[_0x4eb5('0x46')]['ip']||_0x4eb5('0x48');_0x77bab5['on'](_0x4eb5('0x49'),function(_0x185d6f){return _0x25780c(_0x185d6f);});_0x77bab5[_0x4eb5('0x3')](_0x4d64d2,_0x39513f,function(){console[_0x4eb5('0x4a')](_0x4eb5('0x4b'),_0x39513f,_0x4d64d2);require(_0x4eb5('0x4c'))[_0x4eb5('0x4d')]();return _0x2e347f(_0x4eb5('0x4e')+_0x39513f+':'+_0x4d64d2);});});}; \ No newline at end of file +var _0x37c5=['../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.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','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','port','rpc','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x37c5,0xa7));var _0x537c=function(_0x1f3c9a,_0x52dafe){_0x1f3c9a=_0x1f3c9a-0x0;var _0x139c45=_0x37c5[_0x1f3c9a];return _0x139c45;};'use strict';var jayson=require('jayson/promise');var _=require(_0x537c('0x0'));var config=require(_0x537c('0x1'));exports[_0x537c('0x2')]=function(){return new Promise(function(_0x11f076,_0x1c5b5f){var _0x183b59={};_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x4')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x5')));_0x183b59=_['merge'](_0x183b59,require(_0x537c('0x6')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x7')));_0x183b59=_['merge'](_0x183b59,require(_0x537c('0x8')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x9')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0xa')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/memberReport/memberReport.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/trunk/trunk.rpc'));_0x183b59=_['merge'](_0x183b59,require(_0x537c('0xb')));_0x183b59=_['merge'](_0x183b59,require(_0x537c('0xc')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0xd')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0xe')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0xf')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x10')));_0x183b59=_['merge'](_0x183b59,require(_0x537c('0x11')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x12')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x13')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x14')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x15')));_0x183b59=_['merge'](_0x183b59,require(_0x537c('0x16')));_0x183b59=_['merge'](_0x183b59,require('../api/faxMessage/faxMessage.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x17')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x18')));_0x183b59=_['merge'](_0x183b59,require('../api/smsInteraction/smsInteraction.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/smsMessage/smsMessage.rpc'));_0x183b59=_['merge'](_0x183b59,require(_0x537c('0x19')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x1a')));_0x183b59=_['merge'](_0x183b59,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x183b59=_['merge'](_0x183b59,require(_0x537c('0x1b')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x1c')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x1d')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/chatQueue/chatQueue.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x1e')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x1f')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x183b59=_['merge'](_0x183b59,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x20')));_0x183b59=_['merge'](_0x183b59,require(_0x537c('0x21')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x22')));_0x183b59=_['merge'](_0x183b59,require('../api/pause/pause.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x23')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x24')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/template/template.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x25')));_0x183b59=_['merge'](_0x183b59,require('../api/variable/variable.rpc'));_0x183b59=_['merge'](_0x183b59,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x26')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x27')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x28')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x183b59=_['merge'](_0x183b59,require(_0x537c('0x29')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x2a')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x2b')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x2c')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x183b59=_['merge'](_0x183b59,require(_0x537c('0x2d')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x2e')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x2f')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/squareProject/squareProject.rpc'));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/squareRecording/squareRecording.rpc'));_0x183b59=_['merge'](_0x183b59,require('../api/squareMessage/squareMessage.rpc'));_0x183b59=_['merge'](_0x183b59,require(_0x537c('0x30')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x31')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x32')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x33')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x34')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x35')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require(_0x537c('0x36')));_0x183b59=_[_0x537c('0x3')](_0x183b59,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x42ff20=jayson['server'](_0x183b59)[_0x537c('0x37')]();var _0x2e7fb7=config['rpc'][_0x537c('0x38')]||config[_0x537c('0x38')]+0x1;var _0x4352de=config[_0x537c('0x39')]['ip']||'localhost';_0x42ff20['on'](_0x537c('0x3a'),function(_0x189924){return _0x1c5b5f(_0x189924);});_0x42ff20[_0x537c('0x2')](_0x2e7fb7,_0x4352de,function(){console['log'](_0x537c('0x3b'),_0x4352de,_0x2e7fb7);require(_0x537c('0x3c'))[_0x537c('0x3d')]();return _0x11f076(_0x537c('0x3e')+_0x4352de+':'+_0x2e7fb7);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 7ddaf70..2c74b77 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 _0x50e5=['setPriority','SET\x20PRIORITY\x20%s','setVariable','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','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','wait','WAIT','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','startsWith','length','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','command','sync','answer','sendRequest','ANSWER','getData','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s'];(function(_0x587b63,_0x383922){var _0x571ad3=function(_0x1916b7){while(--_0x1916b7){_0x587b63['push'](_0x587b63['shift']());}};_0x571ad3(++_0x383922);}(_0x50e5,0xb7));var _0x550e=function(_0x49efba,_0x3a8e9b){_0x49efba=_0x49efba-0x0;var _0x1d394d=_0x50e5[_0x49efba];return _0x1d394d;};'use strict';var util=require(_0x550e('0x0'));var _=require(_0x550e('0x1'));var EventEmitter=require('events')[_0x550e('0x2')];var AGIReply=require(_0x550e('0x3'));var AGIError=require(_0x550e('0x4'));function AGIChannel(_0x88d4bb){var _0x40aee6=this,_0x3f3a13=new AGIReply(),_0x78e6c5=![],_0xafede5={};EventEmitter[_0x550e('0x5')](_0x40aee6);_0x88d4bb[_0x550e('0x6')](_0x550e('0x7'));_0x88d4bb[_0x550e('0x8')](0x8*0x3c*0x3c*0x3e8);_0x3f3a13['setEncoding'](_0x550e('0x7'));_0x3f3a13['on'](_0x550e('0x9'),function(_0x51318e){for(var _0xebedae in _0x51318e){_0x40aee6[_0xebedae]=_0x51318e[_0xebedae];}_0x40aee6[_0x550e('0xa')](_0x550e('0xb'));});_0x3f3a13['on']('line',function(_0x1a1e3e){if(_0x1a1e3e['toLowerCase']()=='hangup'){_0x40aee6[_0x550e('0xa')](_0x550e('0xc'));return;}if(_0x1a1e3e['substring'](0x0,0xb)==_0x550e('0xd')){_0x78e6c5=!![];}if(_0x78e6c5){_0xafede5['rx']+=_0x1a1e3e+'\x0a';if(_0x1a1e3e[_0x550e('0xe')](_0x550e('0xf'))!=-0x1){_0x78e6c5=![];}}else{_0xafede5['rx']=_0x1a1e3e;}if(_0x78e6c5){return;}if(typeof _0xafede5['cb']==_0x550e('0x10')){var _0x518cad=_0xafede5['rx'][_0x550e('0x11')](0x0,0x3),_0x335cba=null,_0x57214a=null;_0x518cad=parseInt(_0x518cad);if(isNaN(_0x518cad)){_0xafede5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x518cad!=0xc8){_0xafede5['cb'](null,{'code':_0x518cad,'result':-0x1,'extra':'KO'});return;}_0x335cba=_0xafede5['rx'][_0x550e('0x11')](0x4)[_0x550e('0x12')](_0x550e('0x13'),'');if(_0x335cba[_0x550e('0x14')]('\x20')!=-0x1){_0x335cba=_0x335cba[_0x550e('0x15')](0x0,_0x335cba['indexOf']('\x20'));}if(_[_0x550e('0x16')](_0x335cba,'-1')){_0x335cba=parseInt(_0x335cba);}_0x57214a=_0xafede5['rx']['split']('\x20');if(_0x57214a[_0x550e('0x17')]==0x3){_0x57214a=_0x57214a[0x2]['substring'](0x1,_0x57214a[0x2]['length']-0x1);}else if(_0x57214a[_0x550e('0x17')]>0x3){var _0xabb30d=/\((.+)\)/;var _0x557d20=_0xafede5['rx']['match'](_0xabb30d);if(_0x557d20){_0x57214a=_0x557d20[0x1];}else{_0x57214a=null;}}else{_0x57214a=null;}_0xafede5['cb'](null,{'code':_0x518cad,'result':_0x335cba,'extra':_0x57214a});}});_0x88d4bb['on']('error',function(_0x22c264){_0x40aee6['emit']('error',new AGIError(_0x550e('0x18'),_0x22c264[_0x550e('0x19')]));});_0x88d4bb['on'](_0x550e('0x1a'),function(){_0x40aee6[_0x550e('0xa')](_0x550e('0x1a'),new AGIError(_0x550e('0x1b')));});_0x88d4bb['on'](_0x550e('0x1c'),function(){_0x40aee6[_0x550e('0xa')](_0x550e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x88d4bb[_0x550e('0x1d')]();});_0x88d4bb[_0x550e('0x1e')](_0x3f3a13);this['command']=function(_0x4f70bd,_0x3e9822){var _0x4f70bd=_0x4f70bd||'',_0x3e9822=typeof _0x3e9822==_0x550e('0x10')?_0x3e9822:new Function();_0xafede5={'tx':_0x4f70bd,'rx':'','cb':_0x3e9822};_0x88d4bb[_0x550e('0x1f')](_0x4f70bd+'\x0a');},this[_0x550e('0x1a')]=function(){_0x88d4bb[_0x550e('0x1d')]();};}util[_0x550e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x550e('0x21')]['sendRequest']=function(_0x707f72){return this[_0x550e('0x22')][_0x550e('0x23')](this,_0x707f72);};AGIChannel[_0x550e('0x21')][_0x550e('0x24')]=function(){return this[_0x550e('0x25')](_0x550e('0x26'));};AGIChannel[_0x550e('0x21')][_0x550e('0x27')]=function(_0x136beb,_0x130bc2,_0x362d21){_0x136beb=_0x136beb===undefined?'beep':_0x136beb;_0x130bc2=_0x130bc2===undefined?'5':_0x130bc2;_0x362d21=_0x362d21===undefined?'1':_0x362d21;return this[_0x550e('0x25')](util[_0x550e('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x136beb,_0x130bc2*0x3e8,_0x362d21));};AGIChannel[_0x550e('0x21')][_0x550e('0x29')]=function(_0x7ae242){_0x7ae242=_0x7ae242||_0x550e('0x2a');return this[_0x550e('0x25')](util[_0x550e('0x28')](_0x550e('0x2b'),_0x7ae242));};AGIChannel[_0x550e('0x21')][_0x550e('0x2c')]=function(_0x43f7b2,_0x25c40a){if(_[_0x550e('0x2d')](_0x25c40a)){return this[_0x550e('0x25')](util[_0x550e('0x28')]('EXEC\x20%s\x20%s',_0x43f7b2,_0x25c40a[_0x550e('0x2e')](',')));}return this[_0x550e('0x25')](util['format'](_0x550e('0x2f'),_0x43f7b2,_0x25c40a));};AGIChannel[_0x550e('0x21')]['setContext']=function(_0x3dd5b1){return this[_0x550e('0x25')](util[_0x550e('0x28')](_0x550e('0x30'),_0x3dd5b1));};AGIChannel[_0x550e('0x21')][_0x550e('0x31')]=function(_0x6fd332){return this[_0x550e('0x25')](util['format'](_0x550e('0x32'),_0x6fd332));};AGIChannel['prototype'][_0x550e('0x33')]=function(_0x1d94cd){return this['sendRequest'](util[_0x550e('0x28')](_0x550e('0x34'),_0x1d94cd));};AGIChannel['prototype']['hangup']=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0x550e('0x21')][_0x550e('0x35')]=function(_0x6c42c6,_0x57b1b8){var _0x4d6def=_['isBoolean'](_0x57b1b8)||_[_0x550e('0x36')](_0x57b1b8)?_0x57b1b8[_0x550e('0x37')]():_0x57b1b8;return this['sendRequest'](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x6c42c6,_0x4d6def?_0x4d6def[_0x550e('0x37')]()[_0x550e('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x550e('0x21')]['sayNumber']=function(_0x535185,_0x33a720){return this[_0x550e('0x25')](util[_0x550e('0x28')](_0x550e('0x38'),_0x535185,_0x33a720));};AGIChannel['prototype'][_0x550e('0x39')]=function(_0x1973ef,_0x4cfde4){return this['sendRequest'](util[_0x550e('0x28')](_0x550e('0x3a'),_0x1973ef,_0x4cfde4));};AGIChannel[_0x550e('0x21')][_0x550e('0x3b')]=function(_0x5badca,_0xb3c314){return this[_0x550e('0x25')](util[_0x550e('0x28')](_0x550e('0x3c'),_0x5badca,_0xb3c314));};AGIChannel['prototype'][_0x550e('0x3d')]=function(_0x24532e,_0x1e3010,_0x459ca8){_0x1e3010=_0x1e3010||this[_0x550e('0x3e')];_0x459ca8=_0x459ca8||0x1;this[_0x550e('0x3f')](_0x24532e);this['setExtension'](_0x1e3010);this[_0x550e('0x33')](_0x459ca8);return this[_0x550e('0x29')](util[_0x550e('0x28')](_0x550e('0x40'),_0x24532e,_0x1e3010,_0x459ca8));};AGIChannel[_0x550e('0x21')]['getVariable']=function(_0x10f18f){return this[_0x550e('0x25')](util['format'](_0x550e('0x41'),_0x10f18f));};AGIChannel[_0x550e('0x21')][_0x550e('0x42')]=function(_0x5ae528,_0x4c26b4,_0xa5e4e2,_0x254444,_0x50e580,_0x2aa776){_0x4c26b4=_0x4c26b4||_0x550e('0x43');_0xa5e4e2=_0xa5e4e2||'';_0x254444=_0x254444===undefined?-0x1:_0x254444==='-1'?-0x1:_0x254444*0x3e8;_0x50e580=_0x50e580===undefined?'':'s='+_0x50e580;_0x2aa776=_0x2aa776?'BEEP':'';return this[_0x550e('0x25')](util[_0x550e('0x28')](_0x550e('0x44'),_0x5ae528,_0x4c26b4,_0xa5e4e2,_0x254444,_0x2aa776,_0x50e580));};AGIChannel[_0x550e('0x21')][_0x550e('0x45')]=function(_0xff7a68,_0x57e123){_0x57e123=_0x57e123||'';return this[_0x550e('0x25')](util['format'](_0x550e('0x46'),_0xff7a68,_0x57e123));};AGIChannel[_0x550e('0x21')]['agi']=function(_0x1c9d04){return this[_0x550e('0x2c')](_0x550e('0x47'),_0x1c9d04);};AGIChannel[_0x550e('0x21')][_0x550e('0x48')]=function(_0x35881f){return this['exec'](_0x550e('0x49'),_0x35881f);};AGIChannel[_0x550e('0x21')][_0x550e('0x4a')]=function(_0x444c23,_0x5a9ef5){this[_0x550e('0x29')](util[_0x550e('0x28')](_0x550e('0x4b'),_0x444c23['id'],_0x444c23[_0x550e('0x4c')],_0x5a9ef5));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x550e('0x4d')]=AGIChannel; \ No newline at end of file +var _0x7a4b=['agi','exec','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','result=','indexOf','startsWith','length','substring','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','destroy','command','write','inherits','prototype','sendRequest','sync','answer','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22'];(function(_0x4b484a,_0x84c660){var _0x158e87=function(_0x7fe241){while(--_0x7fe241){_0x4b484a['push'](_0x4b484a['shift']());}};_0x158e87(++_0x84c660);}(_0x7a4b,0x18d));var _0xb7a4=function(_0x2a8acc,_0x1c5304){_0x2a8acc=_0x2a8acc-0x0;var _0x4fa4d1=_0x7a4b[_0x2a8acc];return _0x4fa4d1;};'use strict';var util=require(_0xb7a4('0x0'));var _=require('lodash');var EventEmitter=require(_0xb7a4('0x1'))[_0xb7a4('0x2')];var AGIReply=require(_0xb7a4('0x3'));var AGIError=require(_0xb7a4('0x4'));function AGIChannel(_0x4d221a){var _0x4e28ac=this,_0x34ba1c=new AGIReply(),_0x44d111=![],_0x559208={};EventEmitter[_0xb7a4('0x5')](_0x4e28ac);_0x4d221a['setEncoding'](_0xb7a4('0x6'));_0x4d221a[_0xb7a4('0x7')](0x8*0x3c*0x3c*0x3e8);_0x34ba1c[_0xb7a4('0x8')](_0xb7a4('0x6'));_0x34ba1c['on'](_0xb7a4('0x9'),function(_0x54128b){for(var _0x32d8ec in _0x54128b){_0x4e28ac[_0x32d8ec]=_0x54128b[_0x32d8ec];}_0x4e28ac[_0xb7a4('0xa')](_0xb7a4('0xb'));});_0x34ba1c['on'](_0xb7a4('0xc'),function(_0x30d595){if(_0x30d595[_0xb7a4('0xd')]()==_0xb7a4('0xe')){_0x4e28ac['emit'](_0xb7a4('0xe'));return;}if(_0x30d595['substring'](0x0,0xb)==_0xb7a4('0xf')){_0x44d111=!![];}if(_0x44d111){_0x559208['rx']+=_0x30d595+'\x0a';if(_0x30d595[_0xb7a4('0x10')](_0xb7a4('0x11'))!=-0x1){_0x44d111=![];}}else{_0x559208['rx']=_0x30d595;}if(_0x44d111){return;}if(typeof _0x559208['cb']==_0xb7a4('0x12')){var _0x32cb7e=_0x559208['rx']['substring'](0x0,0x3),_0x57a8cf=null,_0xfd1e28=null;_0x32cb7e=parseInt(_0x32cb7e);if(isNaN(_0x32cb7e)){_0x559208['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xb7a4('0x13')});return;}if(_0x32cb7e!=0xc8){_0x559208['cb'](null,{'code':_0x32cb7e,'result':-0x1,'extra':'KO'});return;}_0x57a8cf=_0x559208['rx']['substring'](0x4)['replace'](_0xb7a4('0x14'),'');if(_0x57a8cf[_0xb7a4('0x15')]('\x20')!=-0x1){_0x57a8cf=_0x57a8cf['substr'](0x0,_0x57a8cf[_0xb7a4('0x15')]('\x20'));}if(_[_0xb7a4('0x16')](_0x57a8cf,'-1')){_0x57a8cf=parseInt(_0x57a8cf);}_0xfd1e28=_0x559208['rx']['split']('\x20');if(_0xfd1e28[_0xb7a4('0x17')]==0x3){_0xfd1e28=_0xfd1e28[0x2][_0xb7a4('0x18')](0x1,_0xfd1e28[0x2][_0xb7a4('0x17')]-0x1);}else if(_0xfd1e28[_0xb7a4('0x17')]>0x3){var _0x39d62d=/\((.+)\)/;var _0x45573e=_0x559208['rx']['match'](_0x39d62d);if(_0x45573e){_0xfd1e28=_0x45573e[0x1];}else{_0xfd1e28=null;}}else{_0xfd1e28=null;}_0x559208['cb'](null,{'code':_0x32cb7e,'result':_0x57a8cf,'extra':_0xfd1e28});}});_0x4d221a['on'](_0xb7a4('0x19'),function(_0x2d6de7){_0x4e28ac[_0xb7a4('0xa')](_0xb7a4('0x19'),new AGIError(_0xb7a4('0x1a'),_0x2d6de7[_0xb7a4('0x1b')]));});_0x4d221a['on']('close',function(){_0x4e28ac[_0xb7a4('0xa')]('close',new AGIError(_0xb7a4('0x1c')));});_0x4d221a['on'](_0xb7a4('0x1d'),function(){_0x4e28ac[_0xb7a4('0xa')](_0xb7a4('0x1d'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4d221a[_0xb7a4('0x1e')]();});_0x4d221a['pipe'](_0x34ba1c);this[_0xb7a4('0x1f')]=function(_0xf4c312,_0x329192){var _0xf4c312=_0xf4c312||'',_0x329192=typeof _0x329192=='function'?_0x329192:new Function();_0x559208={'tx':_0xf4c312,'rx':'','cb':_0x329192};_0x4d221a[_0xb7a4('0x20')](_0xf4c312+'\x0a');},this['close']=function(){_0x4d221a[_0xb7a4('0x1e')]();};}util[_0xb7a4('0x21')](AGIChannel,EventEmitter);AGIChannel[_0xb7a4('0x22')][_0xb7a4('0x23')]=function(_0x2f3e5c){return this['command'][_0xb7a4('0x24')](this,_0x2f3e5c);};AGIChannel[_0xb7a4('0x22')][_0xb7a4('0x25')]=function(){return this[_0xb7a4('0x23')]('ANSWER');};AGIChannel['prototype']['getData']=function(_0x11b73e,_0x254672,_0x1d9bf2){_0x11b73e=_0x11b73e===undefined?_0xb7a4('0x26'):_0x11b73e;_0x254672=_0x254672===undefined?'5':_0x254672;_0x1d9bf2=_0x1d9bf2===undefined?'1':_0x1d9bf2;return this[_0xb7a4('0x23')](util[_0xb7a4('0x27')](_0xb7a4('0x28'),_0x11b73e,_0x254672*0x3e8,_0x1d9bf2));};AGIChannel[_0xb7a4('0x22')][_0xb7a4('0x29')]=function(_0x44b667){_0x44b667=_0x44b667||_0xb7a4('0x2a');return this[_0xb7a4('0x23')](util[_0xb7a4('0x27')](_0xb7a4('0x2b'),_0x44b667));};AGIChannel[_0xb7a4('0x22')]['exec']=function(_0x443d82,_0x550878){if(_[_0xb7a4('0x2c')](_0x550878)){return this[_0xb7a4('0x23')](util['format'](_0xb7a4('0x2d'),_0x443d82,_0x550878['join'](',')));}return this[_0xb7a4('0x23')](util[_0xb7a4('0x27')](_0xb7a4('0x2d'),_0x443d82,_0x550878));};AGIChannel[_0xb7a4('0x22')][_0xb7a4('0x2e')]=function(_0x399515){return this['sendRequest'](util[_0xb7a4('0x27')](_0xb7a4('0x2f'),_0x399515));};AGIChannel[_0xb7a4('0x22')][_0xb7a4('0x30')]=function(_0x1e8b73){return this[_0xb7a4('0x23')](util['format']('SET\x20EXTENSION\x20%s',_0x1e8b73));};AGIChannel['prototype'][_0xb7a4('0x31')]=function(_0x429988){return this[_0xb7a4('0x23')](util[_0xb7a4('0x27')](_0xb7a4('0x32'),_0x429988));};AGIChannel[_0xb7a4('0x22')][_0xb7a4('0xe')]=function(){return this[_0xb7a4('0x23')]('HANGUP');};AGIChannel[_0xb7a4('0x22')][_0xb7a4('0x33')]=function(_0x3388cd,_0x979a82){var _0x1bf977=_[_0xb7a4('0x34')](_0x979a82)||_[_0xb7a4('0x35')](_0x979a82)?_0x979a82[_0xb7a4('0x36')]():_0x979a82;return this['sendRequest'](util[_0xb7a4('0x27')](_0xb7a4('0x37'),_0x3388cd,_0x1bf977?_0x1bf977['toString']()[_0xb7a4('0x38')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xb7a4('0x22')][_0xb7a4('0x39')]=function(_0x15db33,_0x3dc6f7){return this[_0xb7a4('0x23')](util['format'](_0xb7a4('0x3a'),_0x15db33,_0x3dc6f7));};AGIChannel[_0xb7a4('0x22')][_0xb7a4('0x3b')]=function(_0x55aa37,_0x4f6280){return this[_0xb7a4('0x23')](util[_0xb7a4('0x27')](_0xb7a4('0x3c'),_0x55aa37,_0x4f6280));};AGIChannel[_0xb7a4('0x22')][_0xb7a4('0x3d')]=function(_0x3cdec9,_0x48d189){return this['sendRequest'](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x3cdec9,_0x48d189));};AGIChannel['prototype'][_0xb7a4('0x3e')]=function(_0x526ab4,_0x33aad4,_0x505945){_0x33aad4=_0x33aad4||this[_0xb7a4('0x3f')];_0x505945=_0x505945||0x1;this[_0xb7a4('0x2e')](_0x526ab4);this[_0xb7a4('0x30')](_0x33aad4);this[_0xb7a4('0x31')](_0x505945);return this[_0xb7a4('0x29')](util['format'](_0xb7a4('0x40'),_0x526ab4,_0x33aad4,_0x505945));};AGIChannel[_0xb7a4('0x22')][_0xb7a4('0x41')]=function(_0x544893){return this[_0xb7a4('0x23')](util['format'](_0xb7a4('0x42'),_0x544893));};AGIChannel[_0xb7a4('0x22')][_0xb7a4('0x43')]=function(_0x32446e,_0x2b79f2,_0x2495a1,_0x4b591f,_0x2a549c,_0x17d580){_0x2b79f2=_0x2b79f2||_0xb7a4('0x44');_0x2495a1=_0x2495a1||'';_0x4b591f=_0x4b591f===undefined?-0x1:_0x4b591f==='-1'?-0x1:_0x4b591f*0x3e8;_0x2a549c=_0x2a549c===undefined?'':'s='+_0x2a549c;_0x17d580=_0x17d580?_0xb7a4('0x45'):'';return this['sendRequest'](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x32446e,_0x2b79f2,_0x2495a1,_0x4b591f,_0x17d580,_0x2a549c));};AGIChannel[_0xb7a4('0x22')]['streamFile']=function(_0x5bbde7,_0x3f8322){_0x3f8322=_0x3f8322||'';return this['sendRequest'](util['format'](_0xb7a4('0x46'),_0x5bbde7,_0x3f8322));};AGIChannel['prototype'][_0xb7a4('0x47')]=function(_0x2d5c21){return this[_0xb7a4('0x48')](_0xb7a4('0x49'),_0x2d5c21);};AGIChannel[_0xb7a4('0x22')][_0xb7a4('0x4a')]=function(_0x48880d){return this[_0xb7a4('0x48')]('WAIT',_0x48880d);};AGIChannel[_0xb7a4('0x22')][_0xb7a4('0x19')]=function(_0x4fb3c8,_0x4a4120){this['noop'](util['format'](_0xb7a4('0x4b'),_0x4fb3c8['id'],_0x4fb3c8[_0xb7a4('0x4c')],_0x4a4120));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xb7a4('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 675bc3a..1c50cd8 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 _0xadeb=['push','format','apply','message','name','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','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(_0x44c4d1,_0x53c452){var _0x46fdc1=function(_0xc65c17){while(--_0xc65c17){_0x44c4d1['push'](_0x44c4d1['shift']());}};_0x46fdc1(++_0x53c452);}(_0xadeb,0xd5));var _0xbade=function(_0x1ff5e8,_0x3a5609){_0x1ff5e8=_0x1ff5e8-0x0;var _0x1e7046=_0xadeb[_0x1ff5e8];return _0x1e7046;};'use strict';var util=require(_0xbade('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xbade('0x1'),'E_AGI_SERVER_ERROR':_0xbade('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xbade('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xbade('0x4'),'E_AGI_SOCKET_CLOSE':_0xbade('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xbade('0x6'),'E_AGI_COMMAND_EMPTY':_0xbade('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xbade('0x8'),'E_AGI_IVR_ENTRY':_0xbade('0x9')};function AGIError(_0x24f8f9){var _0x24f8f9=_0x24f8f9||null,_0x502867=_0x502867||[],_0xd8cc73=0x1,_0x297a99='';if(!error[_0x24f8f9]){_0x24f8f9=_0xbade('0xa');}_0x502867[_0xbade('0xb')](error[_0x24f8f9]);while(arguments[_0xd8cc73]){_0x502867['push'](arguments[_0xd8cc73]);_0xd8cc73++;}_0x297a99=util[_0xbade('0xc')][_0xbade('0xd')](util,_0x502867);this[_0xbade('0xe')]=_0x297a99;this[_0xbade('0xf')]=_0x24f8f9;}module['exports']=AGIError; \ No newline at end of file +var _0x9276=['Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x335606,_0x208ad5){var _0x250210=function(_0x1c32d8){while(--_0x1c32d8){_0x335606['push'](_0x335606['shift']());}};_0x250210(++_0x208ad5);}(_0x9276,0x14d));var _0x6927=function(_0x3af034,_0xa7a424){_0x3af034=_0x3af034-0x0;var _0x5b9460=_0x9276[_0x3af034];return _0x5b9460;};'use strict';var util=require(_0x6927('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x6927('0x1'),'E_AGI_SERVER_ERROR':_0x6927('0x2'),'E_AGI_SERVER_CLOSE':_0x6927('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x6927('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x6927('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6927('0x6'),'E_AGI_IVR_ENTRY':_0x6927('0x7')};function AGIError(_0x2b1fe0){var _0x2b1fe0=_0x2b1fe0||null,_0x8e4ed9=_0x8e4ed9||[],_0x5a00d5=0x1,_0x236daf='';if(!error[_0x2b1fe0]){_0x2b1fe0=_0x6927('0x8');}_0x8e4ed9[_0x6927('0x9')](error[_0x2b1fe0]);while(arguments[_0x5a00d5]){_0x8e4ed9[_0x6927('0x9')](arguments[_0x5a00d5]);_0x5a00d5++;}_0x236daf=util[_0x6927('0xa')][_0x6927('0xb')](util,_0x8e4ed9);this[_0x6927('0xc')]=_0x236daf;this['name']=_0x2b1fe0;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 60d2b9b..abcc65c 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 _0x37ad=['redis','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','agi','parse','projectUpdate','lodash','EventEmitter','ioredis','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37ad,0x1ca));var _0xd37a=function(_0x531d04,_0x5646c3){_0x531d04=_0x531d04-0x0;var _0x326a11=_0x37ad[_0x531d04];return _0x326a11;};'use strict';var _=require(_0xd37a('0x0'));var EventEmitter=require('events')[_0xd37a('0x1')];var Redis=require(_0xd37a('0x2'));var AGIError=require('./error');var config=require('../../config/environment');config['redis']=_[_0xd37a('0x3')](config[_0xd37a('0x4')],{'host':_0xd37a('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xd37a('0x4')]);sub[_0xd37a('0x6')]('agi',function(_0x323796){if(_0x323796)return eventEmitter[_0xd37a('0x7')](_0xd37a('0x8'),new AGIError(_0xd37a('0x9'),_0x323796));});sub['on'](_0xd37a('0xa'),function(_0x827e1a,_0xf6cea5){if(_0x827e1a!==_0xd37a('0xb'))return;try{var _0x18909f=JSON[_0xd37a('0xc')](_0xf6cea5);eventEmitter[_0xd37a('0x7')](_0xd37a('0xd'),_0x18909f);}catch(_0x2aa581){eventEmitter[_0xd37a('0x7')](_0xd37a('0x8'),new AGIError(_0xd37a('0x9'),_0x2aa581));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x8882=['../../config/environment','localhost','emit','error','E_AGI_SERVER_ERROR','agi','parse','projectUpdate','lodash','events','EventEmitter','./error'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x8882,0x1e8));var _0x2888=function(_0x34e47c,_0x2b0659){_0x34e47c=_0x34e47c-0x0;var _0x272ca9=_0x8882[_0x34e47c];return _0x272ca9;};'use strict';var _=require(_0x2888('0x0'));var EventEmitter=require(_0x2888('0x1'))[_0x2888('0x2')];var Redis=require('ioredis');var AGIError=require(_0x2888('0x3'));var config=require(_0x2888('0x4'));config['redis']=_['defaults'](config['redis'],{'host':_0x2888('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub['subscribe']('agi',function(_0x3b727a){if(_0x3b727a)return eventEmitter[_0x2888('0x6')](_0x2888('0x7'),new AGIError(_0x2888('0x8'),_0x3b727a));});sub['on']('message',function(_0x160eb4,_0x43d89a){if(_0x160eb4!==_0x2888('0x9'))return;try{var _0x561677=JSON[_0x2888('0xa')](_0x43d89a);eventEmitter['emit'](_0x2888('0xb'),_0x561677);}catch(_0x5554d7){eventEmitter['emit'](_0x2888('0x7'),new AGIError(_0x2888('0x8'),_0x5554d7));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index fdaf204..3c774cc 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 _0xd317=['size','relations','getVertex','no\x20vertex\x20found','info','length','no\x20edge/s\x20available','split','vswitch','target','agicommand','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','addEdge','push'];(function(_0x3509d8,_0x5074b5){var _0x4dcedb=function(_0x164ac4){while(--_0x164ac4){_0x3509d8['push'](_0x3509d8['shift']());}};_0x4dcedb(++_0x5074b5);}(_0xd317,0x1ec));var _0x7d31=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xd317[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var logger=require(_0x7d31('0x0'))(_0x7d31('0x1'));var verticesWithRetry=[_0x7d31('0x2'),_0x7d31('0x3'),_0x7d31('0x4')];var Graph=function(){this[_0x7d31('0x5')]={};this['edges']={};this[_0x7d31('0x6')]=0x0;};Graph[_0x7d31('0x7')][_0x7d31('0x8')]=function(_0x5cd665){this[_0x7d31('0x5')][_0x5cd665['id']]=_0x5cd665;this[_0x7d31('0x9')][_0x5cd665['id']]=[];};Graph[_0x7d31('0x7')][_0x7d31('0xa')]=function(_0x4b45a3,_0x42392c,_0x21baa4){this[_0x7d31('0x9')][_0x4b45a3][_0x7d31('0xb')]({'target':_0x42392c,'condition':_0x21baa4});this[_0x7d31('0x6')]+=0x1;};Graph[_0x7d31('0x7')]['size']=function(){return _[_0x7d31('0xc')](this[_0x7d31('0x5')]);};Graph['prototype'][_0x7d31('0xd')]=function(){return this[_0x7d31('0x6')];};Graph[_0x7d31('0x7')][_0x7d31('0xe')]=function(_0x448fca){return this[_0x7d31('0x5')][_0x448fca];};Graph['prototype']['traverseBFS']=function(_0x4df2ca,_0x3ec220){if(!this[_0x7d31('0x5')][_0x4df2ca]){return logger['info'](_0x7d31('0xf'));}var _0x25e5e2=_0x3ec220(this[_0x7d31('0x5')][_0x4df2ca]);if(!_0x25e5e2){return logger[_0x7d31('0x10')]('stop\x20traverse');}if(this['edges'][_0x4df2ca][_0x7d31('0x11')]===0x0){return logger['info'](_0x7d31('0x12'));}for(var _0x3ac6d4=0x0,_0x35fcb6=[],_0x4f6296=![];_0x3ac6d4\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','debug','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','agi','../../config/license/util','./project','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','deleted','splice','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0x0d49,0xcc));var _0x90d4=function(_0x14f3f4,_0x38ec0a){_0x14f3f4=_0x14f3f4-0x0;var _0x557da0=_0x0d49[_0x14f3f4];return _0x557da0;};'use strict';var _=require(_0x90d4('0x0'));var syncho=require(_0x90d4('0x1'));var util=require(_0x90d4('0x2'));var config=require(_0x90d4('0x3'));var logger=require('../../config/logger')(_0x90d4('0x4'));var utilLicense=require(_0x90d4('0x5'));var rpc=require('./rpc');var Project=require(_0x90d4('0x6'));var AGIEmitter=require('./events')[_0x90d4('0x7')];var projects=[];config[_0x90d4('0x4')]=_[_0x90d4('0x8')](config[_0x90d4('0x4')],{'ip':_0x90d4('0x9'),'port':0x11dd});AGIEmitter['on'](_0x90d4('0xa'),projectUpdateHandler);function connectionHandler(_0x5525fe){process[_0x90d4('0xb')](function(){syncho(function(){try{setChannelVariables(_0x5525fe);agiHandler(_0x5525fe);}catch(_0x430d97){logger[_0x90d4('0xc')](_0x430d97[_0x90d4('0xd')]);}});});}function projectUpdateHandler(_0x470d17){try{var _0x1928ff=_['findIndex'](projects,['id',_0x470d17['id']]);if(_0x1928ff>-0x1){if(_0x470d17[_0x90d4('0xe')]===!![]){projects[_0x90d4('0xf')](_0x1928ff,0x1);}else{projects[_0x1928ff]=_0x470d17;}}else{projects['push'](_0x470d17);}}catch(_0x8bca10){logger[_0x90d4('0xc')](_0x8bca10['stack']);}}function listeningHandler(){console['log'](_0x90d4('0x10'),config[_0x90d4('0x4')]['port']);logger[_0x90d4('0x11')](util['format'](_0x90d4('0x12'),config[_0x90d4('0x4')]['ip'],config[_0x90d4('0x4')]['port']));}function errorHandler(_0x1697d7){if(_0x1697d7&&_0x1697d7[_0x90d4('0x13')]&&_0x1697d7[_0x90d4('0x14')]){logger[_0x90d4('0xc')](util[_0x90d4('0x15')](_0x90d4('0x16'),_0x1697d7[_0x90d4('0x13')],_0x1697d7[_0x90d4('0x14')]));}else{logger[_0x90d4('0xc')](util['format'](_0x90d4('0x17'),_0x1697d7[_0x90d4('0xd')]));}}function closeHandler(){logger[_0x90d4('0x11')](util[_0x90d4('0x15')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x90d4('0x18')],this[_0x90d4('0x19')],this[_0x90d4('0x1a')],this[_0x90d4('0x1b')],this[_0x90d4('0x1c')]));try{createSquareReport(this);}catch(_0x3683f3){logger['error'](_0x3683f3[_0x90d4('0xd')]);}}function timeoutHandler(){logger[_0x90d4('0x11')](util[_0x90d4('0x15')](_0x90d4('0x1d'),this['arg_1'],this[_0x90d4('0x19')],this[_0x90d4('0x1a')],this[_0x90d4('0x1b')],this[_0x90d4('0x1c')]));}function hangupHandler(){logger['info'](util[_0x90d4('0x15')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x90d4('0x18')],this['calleridname'],this['callerid'],this[_0x90d4('0x1b')],this['uniqueid']));this[_0x90d4('0x1e')]=!![];}function createSquareReport(_0xdf6e59,_0x28c694){rpc[_0x90d4('0x1f')](_0xdf6e59)[_0x90d4('0x20')](function(_0x104a53){if(_0x28c694){_0x28c694(null,_0x104a53);}})[_0x90d4('0x21')](function(_0x56c970){if(_0x28c694){_0x28c694(null,_0x56c970);}});}function setChannelVariables(_0x59d407){for(var _0x10a282 in _0x59d407){if(_0x59d407[_0x90d4('0x22')](_0x10a282)){if(_0x10a282['indexOf'](_0x90d4('0x23'))===0x0){_0x59d407[_0x10a282['substring'](0x4)]=_0x59d407[_0x10a282];delete _0x59d407[_0x10a282];}}}}function agiHandler(_0x3c4e50){logger[_0x90d4('0x24')]('variables',JSON['stringify'](_0x3c4e50,null,0x2));logger['info'](util[_0x90d4('0x15')](_0x90d4('0x25'),_0x3c4e50['arg_1'],_0x3c4e50[_0x90d4('0x19')],_0x3c4e50[_0x90d4('0x1a')],_0x3c4e50[_0x90d4('0x1b')],_0x3c4e50['uniqueid']));_0x3c4e50['on'](_0x90d4('0xc'),errorHandler);_0x3c4e50['on'](_0x90d4('0x26'),closeHandler);_0x3c4e50['on'](_0x90d4('0x27'),timeoutHandler);_0x3c4e50[_0x90d4('0x1e')]=![];_0x3c4e50['on'](_0x90d4('0x28'),hangupHandler);var _0x3069c5=_[_0x90d4('0x29')](projects,[_0x90d4('0x13'),_0x3c4e50[_0x90d4('0x18')]]);if(!_0x3069c5)return Project[_0x90d4('0x2a')](_0x3c4e50);if(!_0x3069c5[_0x90d4('0x2b')])return Project[_0x90d4('0x2c')](_0x3c4e50);return Project[_0x90d4('0x2d')](_0x3069c5,_0x3c4e50);}function main(){var _0x166eb6;return utilLicense[_0x90d4('0x2e')]()[_0x90d4('0x20')](function(_0x25b50e){if(!_0x25b50e)return;if(_0x25b50e[_0x90d4('0x2f')]){if(_0x25b50e[_0x90d4('0x30')]&&_0x25b50e['callysquare']>0x0){logger[_0x90d4('0x11')](util[_0x90d4('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x25b50e[_0x90d4('0x30')]));_0x166eb6=_0x25b50e[_0x90d4('0x30')];}else{logger[_0x90d4('0x11')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0x90d4('0x31'));_0x166eb6=-0x1;}})['then'](function(){return Project[_0x90d4('0x32')]();})[_0x90d4('0x20')](function(_0x1f0b36){projects=_0x1f0b36;return;})[_0x90d4('0x21')](function(_0x133e8d){logger[_0x90d4('0xc')](_0x90d4('0x33'),_0x133e8d[_0x90d4('0xd')]);})[_0x90d4('0x34')](function(){var _0x5a8122=require(_0x90d4('0x35'))(config[_0x90d4('0x4')]['port'],config[_0x90d4('0x4')]['ip'],_0x166eb6);_0x5a8122['on'](_0x90d4('0xc'),errorHandler);_0x5a8122['on'](_0x90d4('0x36'),listeningHandler);_0x5a8122['on'](_0x90d4('0x37'),connectionHandler);_0x5a8122['on'](_0x90d4('0x26'),closeHandler);});}main(); \ No newline at end of file +var _0x4327=['./server','connection','close','lodash','syncho','util','../../config/environment','../../config/logger','agi','./rpc','./project','./events','EventEmitter','defaults','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[%s]\x20%s','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','evtHangup','createSquareReport','catch','hasOwnProperty','indexOf','agi_','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','find','production','initialize','getLicense','then','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4327,0x1a0));var _0x7432=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x4327[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x7432('0x0'));var syncho=require(_0x7432('0x1'));var util=require(_0x7432('0x2'));var config=require(_0x7432('0x3'));var logger=require(_0x7432('0x4'))(_0x7432('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0x7432('0x6'));var Project=require(_0x7432('0x7'));var AGIEmitter=require(_0x7432('0x8'))[_0x7432('0x9')];var projects=[];config[_0x7432('0x5')]=_[_0x7432('0xa')](config[_0x7432('0x5')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x7432('0xb'),projectUpdateHandler);function connectionHandler(_0x116d05){process[_0x7432('0xc')](function(){syncho(function(){try{setChannelVariables(_0x116d05);agiHandler(_0x116d05);}catch(_0x2866f1){logger[_0x7432('0xd')](_0x2866f1[_0x7432('0xe')]);}});});}function projectUpdateHandler(_0x54a42c){try{var _0x113e0b=_[_0x7432('0xf')](projects,['id',_0x54a42c['id']]);if(_0x113e0b>-0x1){if(_0x54a42c[_0x7432('0x10')]===!![]){projects[_0x7432('0x11')](_0x113e0b,0x1);}else{projects[_0x113e0b]=_0x54a42c;}}else{projects['push'](_0x54a42c);}}catch(_0x45ca09){logger[_0x7432('0xd')](_0x45ca09[_0x7432('0xe')]);}}function listeningHandler(){console[_0x7432('0x12')](_0x7432('0x13'),config['agi']['port']);logger['info'](util[_0x7432('0x14')](_0x7432('0x15'),config[_0x7432('0x5')]['ip'],config[_0x7432('0x5')][_0x7432('0x16')]));}function errorHandler(_0xe0ce0c){if(_0xe0ce0c&&_0xe0ce0c[_0x7432('0x17')]&&_0xe0ce0c[_0x7432('0x18')]){logger[_0x7432('0xd')](util[_0x7432('0x14')](_0x7432('0x19'),_0xe0ce0c[_0x7432('0x17')],_0xe0ce0c[_0x7432('0x18')]));}else{logger[_0x7432('0xd')](util[_0x7432('0x14')](_0x7432('0x1a'),_0xe0ce0c['stack']));}}function closeHandler(){logger[_0x7432('0x1b')](util[_0x7432('0x14')](_0x7432('0x1c'),this['arg_1'],this['calleridname'],this[_0x7432('0x1d')],this[_0x7432('0x1e')],this[_0x7432('0x1f')]));try{createSquareReport(this);}catch(_0x5411e9){logger[_0x7432('0xd')](_0x5411e9['stack']);}}function timeoutHandler(){logger['info'](util[_0x7432('0x14')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x7432('0x20')],this[_0x7432('0x1d')],this[_0x7432('0x1e')],this[_0x7432('0x1f')]));}function hangupHandler(){logger[_0x7432('0x1b')](util[_0x7432('0x14')](_0x7432('0x21'),this[_0x7432('0x22')],this[_0x7432('0x20')],this[_0x7432('0x1d')],this['dnid'],this[_0x7432('0x1f')]));this[_0x7432('0x23')]=!![];}function createSquareReport(_0x51b015,_0x3aa317){rpc[_0x7432('0x24')](_0x51b015)['then'](function(_0x285892){if(_0x3aa317){_0x3aa317(null,_0x285892);}})[_0x7432('0x25')](function(_0x480532){if(_0x3aa317){_0x3aa317(null,_0x480532);}});}function setChannelVariables(_0x370221){for(var _0x25aa53 in _0x370221){if(_0x370221[_0x7432('0x26')](_0x25aa53)){if(_0x25aa53[_0x7432('0x27')](_0x7432('0x28'))===0x0){_0x370221[_0x25aa53['substring'](0x4)]=_0x370221[_0x25aa53];delete _0x370221[_0x25aa53];}}}}function agiHandler(_0x35e63f){logger[_0x7432('0x29')]('variables',JSON[_0x7432('0x2a')](_0x35e63f,null,0x2));logger[_0x7432('0x1b')](util[_0x7432('0x14')](_0x7432('0x2b'),_0x35e63f['arg_1'],_0x35e63f['calleridname'],_0x35e63f['callerid'],_0x35e63f['dnid'],_0x35e63f[_0x7432('0x1f')]));_0x35e63f['on']('error',errorHandler);_0x35e63f['on']('close',closeHandler);_0x35e63f['on'](_0x7432('0x2c'),timeoutHandler);_0x35e63f[_0x7432('0x23')]=![];_0x35e63f['on'](_0x7432('0x2d'),hangupHandler);var _0x40427e=_[_0x7432('0x2e')](projects,[_0x7432('0x17'),_0x35e63f['arg_1']]);if(!_0x40427e)return Project['handleNotFound'](_0x35e63f);if(!_0x40427e[_0x7432('0x2f')])return Project['handleUnpublished'](_0x35e63f);return Project[_0x7432('0x30')](_0x40427e,_0x35e63f);}function main(){var _0x4789e3;return utilLicense[_0x7432('0x31')]()[_0x7432('0x32')](function(_0x2d542b){if(!_0x2d542b)return;if(_0x2d542b['voice']){if(_0x2d542b[_0x7432('0x33')]&&_0x2d542b['callysquare']>0x0){logger[_0x7432('0x1b')](util[_0x7432('0x14')](_0x7432('0x34'),_0x2d542b[_0x7432('0x33')]));_0x4789e3=_0x2d542b[_0x7432('0x33')];}else{logger[_0x7432('0x1b')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x7432('0x1b')](_0x7432('0x35'));_0x4789e3=-0x1;}})[_0x7432('0x32')](function(){return Project[_0x7432('0x36')]();})['then'](function(_0x3ae2c2){projects=_0x3ae2c2;return;})[_0x7432('0x25')](function(_0x2f77a){logger[_0x7432('0xd')]('[LICENSE]',_0x2f77a[_0x7432('0xe')]);})[_0x7432('0x37')](function(){var _0x43e9f5=require(_0x7432('0x38'))(config['agi'][_0x7432('0x16')],config[_0x7432('0x5')]['ip'],_0x4789e3);_0x43e9f5['on'](_0x7432('0xd'),errorHandler);_0x43e9f5['on']('listening',listeningHandler);_0x43e9f5['on'](_0x7432('0x39'),connectionHandler);_0x43e9f5['on'](_0x7432('0x3a'),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 5cfdb2c..730b7d4 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 _0xbc9e=['http','then','error','message','result','catch','bluebird','jayson/promise','client'];(function(_0x5a38ce,_0x2b0029){var _0x77f1c9=function(_0x3dae32){while(--_0x3dae32){_0x5a38ce['push'](_0x5a38ce['shift']());}};_0x77f1c9(++_0x2b0029);}(_0xbc9e,0xcc));var _0xebc9=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xbc9e[_0x1969a7];return _0x3d665f;};'use strict';var BPromise=require(_0xebc9('0x0'));var jayson=require(_0xebc9('0x1'));var client=jayson[_0xebc9('0x2')][_0xebc9('0x3')]({'port':0x232b});function request(_0x33742f,_0x58a71d){return new BPromise(function(_0x299f25,_0x45af82){return client['request'](_0x33742f,_0x58a71d)[_0xebc9('0x4')](function(_0x14970a){if(_0x14970a[_0xebc9('0x5')]){return _0x45af82(_0x14970a[_0xebc9('0x5')][_0xebc9('0x6')]);}else{return _0x299f25(_0x14970a[_0xebc9('0x7')]);}})[_0xebc9('0x8')](function(_0x5473a8){return _0x45af82(_0x5473a8);});});}exports['sendMailMessage']=function(_0xe325a4,_0x104980){return request('SendMail',{'account':_0xe325a4,'message':_0x104980});}; \ No newline at end of file +var _0xbf10=['then','error','result','catch','sendMailMessage','SendMail','jayson/promise','client','http','request'];(function(_0x1103c4,_0x562d1d){var _0x1c19ab=function(_0x10e254){while(--_0x10e254){_0x1103c4['push'](_0x1103c4['shift']());}};_0x1c19ab(++_0x562d1d);}(_0xbf10,0x16e));var _0x0bf1=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xbf10[_0x40ac5e];return _0x2839d6;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x0bf1('0x0'));var client=jayson[_0x0bf1('0x1')][_0x0bf1('0x2')]({'port':0x232b});function request(_0x224acd,_0x29f792){return new BPromise(function(_0x883fbb,_0x1fe38b){return client[_0x0bf1('0x3')](_0x224acd,_0x29f792)[_0x0bf1('0x4')](function(_0x4c7de9){if(_0x4c7de9[_0x0bf1('0x5')]){return _0x1fe38b(_0x4c7de9[_0x0bf1('0x5')]['message']);}else{return _0x883fbb(_0x4c7de9[_0x0bf1('0x6')]);}})[_0x0bf1('0x7')](function(_0x2867fb){return _0x1fe38b(_0x2867fb);});});}exports[_0x0bf1('0x8')]=function(_0x509979,_0x410936){return request(_0x0bf1('0x9'),{'account':_0x509979,'message':_0x410936});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 330675d..6c99628 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 _0xe07f=['retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','inspect','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[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','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','response','code','evtHangup','result','toString','agicommand\x20not\x20found','traverseBFS','finally','clear','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','extension','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','close','xml2json','util','agi','./rpc','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty'];(function(_0x3aeada,_0x454e90){var _0x5abcec=function(_0x5d248f){while(--_0x5d248f){_0x3aeada['push'](_0x3aeada['shift']());}};_0x5abcec(++_0x454e90);}(_0xe07f,0x19e));var _0xfe07=function(_0x28c04c,_0x50ba77){_0x28c04c=_0x28c04c-0x0;var _0x2ada6b=_0xe07f[_0x28c04c];return _0x2ada6b;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0xfe07('0x0'));var util=require(_0xfe07('0x1'));var logger=require('../../config/logger')(_0xfe07('0x2'));var rpc=require(_0xfe07('0x3'));var mailRpc=require(_0xfe07('0x4'));var Graph=require(_0xfe07('0x5'));var Vertices=require(_0xfe07('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xfe07('0x7')](function(_0x476554){logger[_0xfe07('0x8')](_0xfe07('0x9'),_0x476554[_0xfe07('0xa')]);return[];});}function addVertex(_0x1e0be7,_0x492002,_0x51ec69){_0x492002[_0xfe07('0xb')]=_0x51ec69;if(_0x492002[_0xfe07('0xc')](_0xfe07('0xd'))){_0x492002[_0xfe07('0xe')]=parseInt(_0x492002[_0xfe07('0xd')],0xa);}_0x1e0be7[_0xfe07('0xf')](_[_0xfe07('0x10')](_0x492002,_0xfe07('0x11')));}function initGraph(_0x56cc4c,_0x69b187){var _0x218de3=new Graph();for(var _0x1611bd in _0x56cc4c){if(_0x56cc4c['hasOwnProperty'](_0x1611bd)){if(_[_0xfe07('0x12')](_0x56cc4c[_0x1611bd])){for(var _0x4480cd=0x0;_0x4480cd<_0x56cc4c[_0x1611bd][_0xfe07('0x13')];_0x4480cd+=0x1){addVertex(_0x218de3,_0x56cc4c[_0x1611bd][_0x4480cd],_0x1611bd);}}else{addVertex(_0x218de3,_0x56cc4c[_0x1611bd],_0x1611bd);}}}for(var _0x135f23=0x0;_0x135f23<_0x69b187['length'];_0x135f23+=0x1){if(_0x69b187[_0x135f23][_0xfe07('0x14')]&&_0x69b187[_0x135f23][_0xfe07('0x15')]){_0x218de3[_0xfe07('0x16')](_0x69b187[_0x135f23]['source'],_0x69b187[_0x135f23]['target'],_0x69b187[_0x135f23][_0xfe07('0x17')]);}}return _0x218de3;}function getRoot(_0x2478cb){return parser[_0xfe07('0x18')](_0x2478cb,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x32a389){return util[_0xfe07('0x19')](_0x32a389,{'showHidden':![],'depth':null});}function initialize(_0x29a2b1,_0x5e9594){var _0x3c62e7=getRoot(_0x29a2b1[_0xfe07('0x1a')]);if(!_0x3c62e7||!_0x3c62e7[_0xfe07('0x1b')])return;var _0x364a9c,_0x4ce9d9,_0x334962;logger[_0xfe07('0x1c')]('root',JSON[_0xfe07('0x1d')](_0x3c62e7,null,0x2));_0x5e9594[_0xfe07('0x1e')]=moment()['format'](_0xfe07('0x1f'));_0x364a9c=initGraph(_[_0xfe07('0x10')](_0x3c62e7,_0xfe07('0x11')),_0x3c62e7['mxCell']);_0x4ce9d9=new Vertices(_0x5e9594,rpc,mailRpc);logger[_0xfe07('0x20')](util[_0xfe07('0x21')](_0xfe07('0x22'),_0x5e9594[_0xfe07('0x23')],_0x5e9594[_0xfe07('0x24')],_0x5e9594[_0xfe07('0x25')],_0x5e9594[_0xfe07('0x26')],_0x5e9594[_0xfe07('0x27')]));_0x364a9c['traverseBFS'](_0x3c62e7[_0xfe07('0x1b')]['id'],function(_0x575f8b){try{_0x575f8b=_0x4ce9d9['clear'](_0x575f8b);logger[_0xfe07('0x1c')](_0xfe07('0x28'),JSON[_0xfe07('0x1d')](_0x575f8b,null,0x2));if(_0x575f8b[_0xfe07('0xb')]===_0xfe07('0x29')){logger[_0xfe07('0x20')](_0xfe07('0x2a'));_0x5e9594[_0xfe07('0x2b')]=_0x575f8b['context']||_0x5e9594[_0xfe07('0x2b')];_0x5e9594['extension']=_0x575f8b['extension'];_0x5e9594[_0xfe07('0x2c')]=_0x575f8b['priority']?_0x575f8b[_0xfe07('0x2c')]-0x1:0x1;return null;}else if(_0x575f8b&&_0x4ce9d9[_0x575f8b[_0xfe07('0xb')]]){_0x334962=_0x4ce9d9[_0x575f8b['agicommand']](_0x575f8b);logger[_0xfe07('0x20')](_0xfe07('0x2d'),JSON[_0xfe07('0x1d')](_0x334962,null,0x2));if(_0x334962&&_0x334962[_0xfe07('0x2e')]===AGI_CODE_SUCCESS&&_0x334962['result']!==AGI_RESULT_ERROR&&!_0x5e9594[_0xfe07('0x2f')]){logger[_0xfe07('0x1c')]('response',inspect(_0x334962));return _['isUndefined'](_0x334962[_0xfe07('0x30')])?null:_0x334962[_0xfe07('0x30')][_0xfe07('0x31')]();}else{logger[_0xfe07('0x8')]('response',inspect(_0x334962));return null;}}else{logger[_0xfe07('0x8')](_0xfe07('0x32'));return null;}}catch(_0x3f73e4){logger[_0xfe07('0x8')](_0x3f73e4[_0xfe07('0xa')]);return null;}});if(_0x3c62e7['finally']){logger[_0xfe07('0x20')](util[_0xfe07('0x21')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5e9594[_0xfe07('0x23')],_0x5e9594[_0xfe07('0x24')],_0x5e9594[_0xfe07('0x25')],_0x5e9594[_0xfe07('0x26')],_0x5e9594[_0xfe07('0x27')]));_0x364a9c[_0xfe07('0x33')](_0x3c62e7[_0xfe07('0x34')]['id'],function(_0xe05ff3){try{_0xe05ff3=_0x4ce9d9[_0xfe07('0x35')](_0xe05ff3);logger['debug'](_0xfe07('0x28'),JSON['stringify'](_0xe05ff3,null,0x2));if(_0xe05ff3&&_0x4ce9d9[_0xe05ff3[_0xfe07('0xb')]]){_0x334962=_0x4ce9d9[_0xe05ff3[_0xfe07('0xb')]](_0xe05ff3);if(_0x334962){logger[_0xfe07('0x1c')](_0xfe07('0x2d'),inspect(_0x334962));return _[_0xfe07('0x36')](_0x334962[_0xfe07('0x30')])?null:_0x334962[_0xfe07('0x30')]['toString']();}else{logger[_0xfe07('0x8')](_0xfe07('0x2d'),inspect(_0x334962));return null;}}else{logger[_0xfe07('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x1f1be0){logger[_0xfe07('0x8')](_0x1f1be0[_0xfe07('0xa')]);return null;}});}logger[_0xfe07('0x20')](util[_0xfe07('0x21')](_0xfe07('0x37'),_0x5e9594['arg_1'],_0x5e9594['calleridname'],_0x5e9594[_0xfe07('0x25')],_0x5e9594[_0xfe07('0x26')],_0x5e9594[_0xfe07('0x27')]));logger[_0xfe07('0x20')](util[_0xfe07('0x21')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5e9594[_0xfe07('0x2b')],_0x5e9594[_0xfe07('0x38')],parseInt(_0x5e9594[_0xfe07('0x2c')],0xa)+0x1));_0x5e9594['continueAt'](_0x5e9594['context'],_0x5e9594[_0xfe07('0x38')],parseInt(_0x5e9594[_0xfe07('0x2c')],0xa)+0x1);_0x5e9594['close']();}function handleNotFound(_0x8469a){logger[_0xfe07('0x8')](util[_0xfe07('0x21')](_0xfe07('0x39'),_0x8469a[_0xfe07('0x23')]));_0x8469a[_0xfe07('0x3a')](_0x8469a[_0xfe07('0x2b')],_0x8469a[_0xfe07('0x38')],parseInt(_0x8469a[_0xfe07('0x2c')],0xa)+0x1);_0x8469a['close']();}function handleUnpublished(_0xc5e707){logger[_0xfe07('0x8')](util[_0xfe07('0x21')](_0xfe07('0x3b'),_0xc5e707[_0xfe07('0x23')]));_0xc5e707['continueAt'](_0xc5e707[_0xfe07('0x2b')],_0xc5e707[_0xfe07('0x38')],parseInt(_0xc5e707[_0xfe07('0x2c')],0xa)+0x1);_0xc5e707[_0xfe07('0x3c')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x2418=['xml2json','util','../../config/logger','agi','./mailRpc','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','length','target','source','value','mxGraphModel','root','inspect','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','clear','vertex','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','evtHangup','response','isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x2418,0xb0));var _0x8241=function(_0x2a02c8,_0x3c3b32){_0x2a02c8=_0x2a02c8-0x0;var _0x38bf31=_0x2418[_0x2a02c8];return _0x38bf31;};'use strict';var _=require(_0x8241('0x0'));var moment=require('moment');var parser=require(_0x8241('0x1'));var util=require(_0x8241('0x2'));var logger=require(_0x8241('0x3'))(_0x8241('0x4'));var rpc=require('./rpc');var mailRpc=require(_0x8241('0x5'));var Graph=require('./graph');var Vertices=require(_0x8241('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x8241('0x7')]()['catch'](function(_0x47f51e){logger[_0x8241('0x8')](_0x8241('0x9'),_0x47f51e[_0x8241('0xa')]);return[];});}function addVertex(_0x1a2ee5,_0x24b1a5,_0x15d616){_0x24b1a5[_0x8241('0xb')]=_0x15d616;if(_0x24b1a5[_0x8241('0xc')](_0x8241('0xd'))){_0x24b1a5[_0x8241('0xe')]=parseInt(_0x24b1a5[_0x8241('0xd')],0xa);}_0x1a2ee5[_0x8241('0xf')](_['omit'](_0x24b1a5,_0x8241('0x10')));}function initGraph(_0x27980e,_0x6bc2e0){var _0x53257e=new Graph();for(var _0x32a009 in _0x27980e){if(_0x27980e[_0x8241('0xc')](_0x32a009)){if(_['isArray'](_0x27980e[_0x32a009])){for(var _0x46709d=0x0;_0x46709d<_0x27980e[_0x32a009]['length'];_0x46709d+=0x1){addVertex(_0x53257e,_0x27980e[_0x32a009][_0x46709d],_0x32a009);}}else{addVertex(_0x53257e,_0x27980e[_0x32a009],_0x32a009);}}}for(var _0x87a521=0x0;_0x87a521<_0x6bc2e0[_0x8241('0x11')];_0x87a521+=0x1){if(_0x6bc2e0[_0x87a521]['source']&&_0x6bc2e0[_0x87a521][_0x8241('0x12')]){_0x53257e['addEdge'](_0x6bc2e0[_0x87a521][_0x8241('0x13')],_0x6bc2e0[_0x87a521]['target'],_0x6bc2e0[_0x87a521][_0x8241('0x14')]);}}return _0x53257e;}function getRoot(_0x45e8aa){return parser['toJson'](_0x45e8aa,{'object':!![]})[_0x8241('0x15')][_0x8241('0x16')];}function inspect(_0x49917e){return util[_0x8241('0x17')](_0x49917e,{'showHidden':![],'depth':null});}function initialize(_0x151ec5,_0x344a0d){var _0x2f7fdd=getRoot(_0x151ec5['production']);if(!_0x2f7fdd||!_0x2f7fdd[_0x8241('0x18')])return;var _0x28df4c,_0x21e8fc,_0x60f0ee;logger[_0x8241('0x19')](_0x8241('0x16'),JSON[_0x8241('0x1a')](_0x2f7fdd,null,0x2));_0x344a0d[_0x8241('0x1b')]=moment()[_0x8241('0x1c')](_0x8241('0x1d'));_0x28df4c=initGraph(_[_0x8241('0x1e')](_0x2f7fdd,_0x8241('0x10')),_0x2f7fdd[_0x8241('0x10')]);_0x21e8fc=new Vertices(_0x344a0d,rpc,mailRpc);logger['info'](util[_0x8241('0x1c')](_0x8241('0x1f'),_0x344a0d['arg_1'],_0x344a0d[_0x8241('0x20')],_0x344a0d[_0x8241('0x21')],_0x344a0d[_0x8241('0x22')],_0x344a0d[_0x8241('0x23')]));_0x28df4c['traverseBFS'](_0x2f7fdd[_0x8241('0x18')]['id'],function(_0x549600){try{_0x549600=_0x21e8fc[_0x8241('0x24')](_0x549600);logger[_0x8241('0x19')](_0x8241('0x25'),JSON['stringify'](_0x549600,null,0x2));if(_0x549600[_0x8241('0xb')]==='gotoc'){logger[_0x8241('0x26')](_0x8241('0x27'));_0x344a0d[_0x8241('0x28')]=_0x549600[_0x8241('0x28')]||_0x344a0d['context'];_0x344a0d[_0x8241('0x29')]=_0x549600[_0x8241('0x29')];_0x344a0d[_0x8241('0x2a')]=_0x549600[_0x8241('0x2a')]?_0x549600[_0x8241('0x2a')]-0x1:0x1;return null;}else if(_0x549600&&_0x21e8fc[_0x549600[_0x8241('0xb')]]){_0x60f0ee=_0x21e8fc[_0x549600[_0x8241('0xb')]](_0x549600);logger[_0x8241('0x26')]('response',JSON[_0x8241('0x1a')](_0x60f0ee,null,0x2));if(_0x60f0ee&&_0x60f0ee['code']===AGI_CODE_SUCCESS&&_0x60f0ee['result']!==AGI_RESULT_ERROR&&!_0x344a0d[_0x8241('0x2b')]){logger[_0x8241('0x19')](_0x8241('0x2c'),inspect(_0x60f0ee));return _[_0x8241('0x2d')](_0x60f0ee[_0x8241('0x2e')])?null:_0x60f0ee[_0x8241('0x2e')][_0x8241('0x2f')]();}else{logger[_0x8241('0x8')](_0x8241('0x2c'),inspect(_0x60f0ee));return null;}}else{logger[_0x8241('0x8')](_0x8241('0x30'));return null;}}catch(_0x47b043){logger[_0x8241('0x8')](_0x47b043[_0x8241('0xa')]);return null;}});if(_0x2f7fdd[_0x8241('0x31')]){logger[_0x8241('0x26')](util[_0x8241('0x1c')](_0x8241('0x32'),_0x344a0d[_0x8241('0x33')],_0x344a0d[_0x8241('0x20')],_0x344a0d['callerid'],_0x344a0d[_0x8241('0x22')],_0x344a0d[_0x8241('0x23')]));_0x28df4c[_0x8241('0x34')](_0x2f7fdd[_0x8241('0x31')]['id'],function(_0x44508a){try{_0x44508a=_0x21e8fc['clear'](_0x44508a);logger[_0x8241('0x19')](_0x8241('0x25'),JSON[_0x8241('0x1a')](_0x44508a,null,0x2));if(_0x44508a&&_0x21e8fc[_0x44508a[_0x8241('0xb')]]){_0x60f0ee=_0x21e8fc[_0x44508a[_0x8241('0xb')]](_0x44508a);if(_0x60f0ee){logger[_0x8241('0x19')](_0x8241('0x2c'),inspect(_0x60f0ee));return _['isUndefined'](_0x60f0ee[_0x8241('0x2e')])?null:_0x60f0ee[_0x8241('0x2e')][_0x8241('0x2f')]();}else{logger[_0x8241('0x8')](_0x8241('0x2c'),inspect(_0x60f0ee));return null;}}else{logger[_0x8241('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x5d6f23){logger['error'](_0x5d6f23[_0x8241('0xa')]);return null;}});}logger[_0x8241('0x26')](util['format'](_0x8241('0x35'),_0x344a0d[_0x8241('0x33')],_0x344a0d[_0x8241('0x20')],_0x344a0d[_0x8241('0x21')],_0x344a0d[_0x8241('0x22')],_0x344a0d['uniqueid']));logger['info'](util['format'](_0x8241('0x36'),_0x344a0d[_0x8241('0x28')],_0x344a0d[_0x8241('0x29')],parseInt(_0x344a0d[_0x8241('0x2a')],0xa)+0x1));_0x344a0d[_0x8241('0x37')](_0x344a0d[_0x8241('0x28')],_0x344a0d[_0x8241('0x29')],parseInt(_0x344a0d['priority'],0xa)+0x1);_0x344a0d['close']();}function handleNotFound(_0x40a70d){logger[_0x8241('0x8')](util[_0x8241('0x1c')](_0x8241('0x38'),_0x40a70d[_0x8241('0x33')]));_0x40a70d[_0x8241('0x37')](_0x40a70d[_0x8241('0x28')],_0x40a70d[_0x8241('0x29')],parseInt(_0x40a70d[_0x8241('0x2a')],0xa)+0x1);_0x40a70d['close']();}function handleUnpublished(_0x3e26c5){logger[_0x8241('0x8')](util[_0x8241('0x1c')](_0x8241('0x39'),_0x3e26c5['arg_1']));_0x3e26c5['continueAt'](_0x3e26c5[_0x8241('0x28')],_0x3e26c5[_0x8241('0x29')],parseInt(_0x3e26c5[_0x8241('0x2a')],0xa)+0x1);_0x3e26c5['close']();}module[_0x8241('0x3a')]={'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 62c6f69..0cf197d 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 _0x4f6f=['toString','indexOf','substring','length','slice','trim','emit','util','stream','Transform','call','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','_localBuffer'];(function(_0x4f95d9,_0x516d40){var _0x4a14e9=function(_0x81f869){while(--_0x81f869){_0x4f95d9['push'](_0x4f95d9['shift']());}};_0x4a14e9(++_0x516d40);}(_0x4f6f,0x157));var _0xf4f6=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0x4f6f[_0xf4666e];return _0x1853f1;};'use strict';var util=require(_0xf4f6('0x0'));var Transform=require(_0xf4f6('0x1'))[_0xf4f6('0x2')];function AGIReply(_0x4b6f0f){Transform[_0xf4f6('0x3')](this,_0x4b6f0f);this['_localBuffer']='';this[_0xf4f6('0x4')]=![];}util[_0xf4f6('0x5')](AGIReply,Transform);AGIReply['prototype'][_0xf4f6('0x6')]=function(_0x1a5edc,_0x4eeeb1,_0x31ecb6){var _0x1172a6='\x0a',_0x2dc7b9=['\x0a\x0a',_0xf4f6('0x7')],_0x4fa106=-0x1,_0x106455=-0x1,_0x592fa6='',_0x483c82=0x0,_0x26f82b='',_0x167822='';this[_0xf4f6('0x8')]+=_0x1a5edc[_0xf4f6('0x9')]();_0x26f82b=this[_0xf4f6('0x8')];if(!this['_inBody']){_0x483c82=0x0;while(_0x2dc7b9[_0x483c82]){while((_0x106455=_0x26f82b[_0xf4f6('0xa')](_0x2dc7b9[_0x483c82]))!=-0x1){_0x592fa6=_0x2dc7b9[_0x483c82];_0x167822=_0x26f82b[_0xf4f6('0xb')](0x0,_0x106455);_0x26f82b=_0x26f82b[_0xf4f6('0xb')](_0x106455+_0x592fa6[_0xf4f6('0xc')]);var _0x4450f9=_0x167822['split'](_0x1172a6),_0x9275e3=0x0,_0x4ba77d={},_0x5ea38b='',_0x107046='',_0x4976f5=-0x1;while(_0x4450f9[_0x9275e3]){_0x4976f5=_0x4450f9[_0x9275e3][_0xf4f6('0xa')](':');if(_0x4976f5!=-0x1){_0x5ea38b=_0x4450f9[_0x9275e3][_0xf4f6('0xd')](0x0,_0x4976f5)[_0xf4f6('0xe')]();_0x107046=_0x4450f9[_0x9275e3]['slice'](_0x4976f5+0x1)[_0xf4f6('0xe')]();if(_0x5ea38b[_0xf4f6('0xc')]>0x0){_0x4ba77d[_0x5ea38b]=_0x107046;}}else{}_0x9275e3++;}this[_0xf4f6('0xf')]('headers',_0x4ba77d);this[_0xf4f6('0x4')]=!![];}_0x483c82++;}this['_localBuffer']=_0x26f82b;}else{while((_0x4fa106=_0x26f82b[_0xf4f6('0xa')](_0x1172a6))!=-0x1){_0x167822=_0x26f82b[_0xf4f6('0xb')](0x0,_0x4fa106);this[_0xf4f6('0xf')]('line',_0x167822);_0x26f82b=_0x26f82b[_0xf4f6('0xb')](_0x4fa106+_0x1172a6[_0xf4f6('0xc')]);}this[_0xf4f6('0x8')]=_0x26f82b;}_0x31ecb6();};module['exports']=AGIReply; \ No newline at end of file +var _0xbf5c=['emit','line','length','exports','util','stream','Transform','call','_localBuffer','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','slice','trim'];(function(_0x39b55d,_0x3b1c22){var _0xdd052f=function(_0x4c9181){while(--_0x4c9181){_0x39b55d['push'](_0x39b55d['shift']());}};_0xdd052f(++_0x3b1c22);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x5ac83b,_0x418926){_0x5ac83b=_0x5ac83b-0x0;var _0x4251c9=_0xbf5c[_0x5ac83b];return _0x4251c9;};'use strict';var util=require(_0xcbf5('0x0'));var Transform=require(_0xcbf5('0x1'))[_0xcbf5('0x2')];function AGIReply(_0x5a5002){Transform[_0xcbf5('0x3')](this,_0x5a5002);this[_0xcbf5('0x4')]='';this[_0xcbf5('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xcbf5('0x6')][_0xcbf5('0x7')]=function(_0x575db8,_0x3457d0,_0x39f7c3){var _0x43f28d='\x0a',_0x522014=['\x0a\x0a',_0xcbf5('0x8')],_0x4504dd=-0x1,_0x31b6d1=-0x1,_0x54d2d4='',_0x52f784=0x0,_0x36c122='',_0x2f10f5='';this['_localBuffer']+=_0x575db8[_0xcbf5('0x9')]();_0x36c122=this[_0xcbf5('0x4')];if(!this[_0xcbf5('0x5')]){_0x52f784=0x0;while(_0x522014[_0x52f784]){while((_0x31b6d1=_0x36c122[_0xcbf5('0xa')](_0x522014[_0x52f784]))!=-0x1){_0x54d2d4=_0x522014[_0x52f784];_0x2f10f5=_0x36c122[_0xcbf5('0xb')](0x0,_0x31b6d1);_0x36c122=_0x36c122[_0xcbf5('0xb')](_0x31b6d1+_0x54d2d4['length']);var _0x22f7fa=_0x2f10f5['split'](_0x43f28d),_0x36a41a=0x0,_0x210407={},_0x4a894b='',_0x5e5307='',_0x18c2fe=-0x1;while(_0x22f7fa[_0x36a41a]){_0x18c2fe=_0x22f7fa[_0x36a41a][_0xcbf5('0xa')](':');if(_0x18c2fe!=-0x1){_0x4a894b=_0x22f7fa[_0x36a41a][_0xcbf5('0xc')](0x0,_0x18c2fe)[_0xcbf5('0xd')]();_0x5e5307=_0x22f7fa[_0x36a41a][_0xcbf5('0xc')](_0x18c2fe+0x1)['trim']();if(_0x4a894b['length']>0x0){_0x210407[_0x4a894b]=_0x5e5307;}}else{}_0x36a41a++;}this[_0xcbf5('0xe')]('headers',_0x210407);this[_0xcbf5('0x5')]=!![];}_0x52f784++;}this['_localBuffer']=_0x36c122;}else{while((_0x4504dd=_0x36c122['indexOf'](_0x43f28d))!=-0x1){_0x2f10f5=_0x36c122[_0xcbf5('0xb')](0x0,_0x4504dd);this[_0xcbf5('0xe')](_0xcbf5('0xf'),_0x2f10f5);_0x36c122=_0x36c122[_0xcbf5('0xb')](_0x4504dd+_0x43f28d[_0xcbf5('0x10')]);}this[_0xcbf5('0x4')]=_0x36c122;}_0x39f7c3();};module[_0xcbf5('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index e0661d2..4f61d0f 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 _0x40b5=['getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','lodash','moment','jayson/promise','client','http','request','then','error','message','result','catch','GetSquareProjects','production','ShowMailAccount','MailServerOut','CloudProvider','name','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact'];(function(_0x2861e1,_0x12df10){var _0x5e54d3=function(_0x3f2fc4){while(--_0x3f2fc4){_0x2861e1['push'](_0x2861e1['shift']());}};_0x5e54d3(++_0x12df10);}(_0x40b5,0x1d7));var _0x540b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40b5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x540b('0x0'));var moment=require(_0x540b('0x1'));var jayson=require(_0x540b('0x2'));var client=jayson[_0x540b('0x3')][_0x540b('0x4')]({'port':0x2329});function request(_0x273ac6,_0x424c68){return new Promise(function(_0x4bfe55,_0x39da2c){return client[_0x540b('0x5')](_0x273ac6,_0x424c68)[_0x540b('0x6')](function(_0x239467){if(_0x239467[_0x540b('0x7')]){return _0x39da2c(_0x239467['error'][_0x540b('0x8')]);}else{return _0x4bfe55(_0x239467[_0x540b('0x9')]);}})[_0x540b('0xa')](function(_0x5aeb5f){return _0x39da2c(_0x5aeb5f);});});}exports['getSquareProjects']=function(){return request(_0x540b('0xb'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports['getSquareProject']=function(_0x13dc02){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x13dc02},'attributes':[_0x540b('0xc')]}});};exports['getMailAccountById']=function(_0x5f23ae){return request(_0x540b('0xd'),{'options':{'raw':![],'where':{'id':_0x5f23ae},'include':[{'model':_0x540b('0xe'),'as':'Smtp','include':[{'model':_0x540b('0xf'),'as':_0x540b('0xf')}]}],'attributes':['id',_0x540b('0x10'),_0x540b('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0xdf0923){return request(_0x540b('0x12'),{'options':{'where':{'id':_0xdf0923},'attributes':[_0x540b('0x10')]}});};exports[_0x540b('0x13')]=function(_0x498616){return request(_0x540b('0x14'),{'options':{'where':{'id':_0x498616},'attributes':['name']}});};exports['getVariableById']=function(_0x2ab462){return request(_0x540b('0x15'),{'options':{'where':{'id':_0x2ab462},'attributes':[_0x540b('0x10')]}});};exports[_0x540b('0x16')]=function(_0x1efac9){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1efac9},'attributes':[_0x540b('0x17')]}});};exports[_0x540b('0x18')]=function(_0x118e5d){return request(_0x540b('0x19'),{'options':{'where':{'id':_0x118e5d},'attributes':[_0x540b('0x10')]}});};exports[_0x540b('0x1a')]=function(_0x2a3265){return request(_0x540b('0x1b'),{'options':{'where':{'phone':_0x2a3265[_0x540b('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x1b9401){return request(_0x540b('0x1d'),{'options':{'where':{'id':_0x1b9401},'attributes':['name']}});};exports[_0x540b('0x1e')]=function(_0x4b3ec6){return request(_0x540b('0x1f'),{'options':{'where':{'id':_0x4b3ec6},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x17674c){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x17674c},'include':[{'model':_0x540b('0x20'),'as':_0x540b('0x21')}]}});};exports[_0x540b('0x22')]=function(_0x4d7422){return request(_0x540b('0x23'),{'options':{'where':{'id':_0x4d7422},'attributes':['id',_0x540b('0x10')]}});};exports[_0x540b('0x24')]=function(_0x1f69d4){return request(_0x540b('0x25'),{'body':_0x1f69d4});};exports[_0x540b('0x26')]=function(_0x3acfef){return request(_0x540b('0x27'),{'body':_0x3acfef});};exports[_0x540b('0x28')]=function(_0xc967f6){return request('CreateSquareReport',{'body':_[_0x540b('0x29')](_0xc967f6,{'project_name':_0xc967f6[_0x540b('0x2a')],'prev_project_name':_0xc967f6['arg_2']||'','is_subproject':_0xc967f6['arg_2']?!![]:![],'leaveAt':moment()[_0x540b('0x2b')](_0x540b('0x2c'))})});};exports[_0x540b('0x2d')]=function(_0x341b22){return request('CreateSquareRecording',{'body':_0x341b22});};exports[_0x540b('0x2e')]=function(_0x399a6e){return request(_0x540b('0x2f'),{'body':_0x399a6e});};exports[_0x540b('0x30')]=function(_0xd3f5f6){return request(_0x540b('0x31'),{'options':{'raw':![],'where':{'phone':_0xd3f5f6[_0x540b('0x1c')],'ListId':_0xd3f5f6['ListId']}}})['then'](function(_0x491eca){if(_0x491eca){return _0x491eca;}return request(_0x540b('0x32'),{'body':_0xd3f5f6});});};exports[_0x540b('0x33')]=function(_0x3eb220){return request('ShowPause',{'options':{'where':{'id':_0x3eb220},'attributes':['name']}});};exports[_0x540b('0x34')]=function(_0x3a9fe4,_0x541b72){return request(_0x540b('0x35'),{'body':{'interface':_0x541b72},'options':{'where':_0x3a9fe4}});};exports[_0x540b('0x36')]=function(_0x2d4922,_0x3179bb,_0x3735ca){return request(_0x540b('0x37'),{'body':{'type':_0x3179bb,'uniqueid':_0x3735ca},'options':{'where':_0x2d4922}});};exports[_0x540b('0x38')]=function(_0x113a93){return request(_0x540b('0x39'),{'body':{},'options':{'where':_0x113a93}});};exports['agentLogout']=function(_0x45a054){return request('LogoutUser',{'body':{},'options':{'where':_0x45a054}});}; \ No newline at end of file +var _0xb8ca=['save_name','getIntervalById','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','then','error','message','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb8ca,0x89));var _0xab8c=function(_0x266d26,_0x51d5e5){_0x266d26=_0x266d26-0x0;var _0x4469b5=_0xb8ca[_0x266d26];return _0x4469b5;};'use strict';var _=require(_0xab8c('0x0'));var moment=require(_0xab8c('0x1'));var jayson=require(_0xab8c('0x2'));var client=jayson['client'][_0xab8c('0x3')]({'port':0x2329});function request(_0x1a2b0a,_0x534d74){return new Promise(function(_0x4bf8af,_0x40c0b4){return client[_0xab8c('0x4')](_0x1a2b0a,_0x534d74)[_0xab8c('0x5')](function(_0x4534b4){if(_0x4534b4[_0xab8c('0x6')]){return _0x40c0b4(_0x4534b4[_0xab8c('0x6')][_0xab8c('0x7')]);}else{return _0x4bf8af(_0x4534b4['result']);}})[_0xab8c('0x8')](function(_0x56f6ac){return _0x40c0b4(_0x56f6ac);});});}exports[_0xab8c('0x9')]=function(){return request(_0xab8c('0xa'),{'options':{'raw':![],'attributes':['id',_0xab8c('0xb'),_0xab8c('0xc')]}});};exports[_0xab8c('0xd')]=function(_0x5ba1df){return request(_0xab8c('0xe'),{'options':{'raw':![],'where':{'name':_0x5ba1df},'attributes':['production']}});};exports['getMailAccountById']=function(_0x56d0b6){return request(_0xab8c('0xf'),{'options':{'raw':![],'where':{'id':_0x56d0b6},'include':[{'model':_0xab8c('0x10'),'as':_0xab8c('0x11'),'include':[{'model':_0xab8c('0x12'),'as':_0xab8c('0x12')}]}],'attributes':['id',_0xab8c('0xb'),_0xab8c('0x13')],'smtp':!![]}});};exports[_0xab8c('0x14')]=function(_0x3567cb){return request(_0xab8c('0xe'),{'options':{'where':{'id':_0x3567cb},'attributes':[_0xab8c('0xb')]}});};exports[_0xab8c('0x15')]=function(_0x2cbc8e){return request(_0xab8c('0x16'),{'options':{'where':{'id':_0x2cbc8e},'attributes':[_0xab8c('0xb')]}});};exports['getVariableById']=function(_0x5e796b){return request(_0xab8c('0x17'),{'options':{'where':{'id':_0x5e796b},'attributes':[_0xab8c('0xb')]}});};exports['getSquareOdbcById']=function(_0x239560){return request(_0xab8c('0x18'),{'options':{'where':{'id':_0x239560},'attributes':[_0xab8c('0x19')]}});};exports[_0xab8c('0x1a')]=function(_0x1ead6f){return request(_0xab8c('0x1b'),{'options':{'where':{'id':_0x1ead6f},'attributes':[_0xab8c('0xb')]}});};exports[_0xab8c('0x1c')]=function(_0x427b1c){return request('GetContactByPhone',{'options':{'where':{'phone':_0x427b1c[_0xab8c('0x1d')]},'attributes':['id']}});};exports[_0xab8c('0x1e')]=function(_0x1a0625){return request(_0xab8c('0x1f'),{'options':{'where':{'id':_0x1a0625},'attributes':[_0xab8c('0xb')]}});};exports[_0xab8c('0x20')]=function(_0x52f380){return request(_0xab8c('0x21'),{'options':{'where':{'id':_0x52f380},'attributes':[_0xab8c('0x22')]}});};exports[_0xab8c('0x23')]=function(_0x101abc){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x101abc},'include':[{'model':'Interval','as':_0xab8c('0x24')}]}});};exports['getSmsAccountById']=function(_0x315acd){return request(_0xab8c('0x25'),{'options':{'where':{'id':_0x315acd},'attributes':['id',_0xab8c('0xb')]}});};exports[_0xab8c('0x26')]=function(_0x554507){return request('CreateSmsMessage',{'body':_0x554507});};exports[_0xab8c('0x27')]=function(_0x18b38c){return request(_0xab8c('0x28'),{'body':_0x18b38c});};exports[_0xab8c('0x29')]=function(_0x36a779){return request('CreateSquareReport',{'body':_['merge'](_0x36a779,{'project_name':_0x36a779[_0xab8c('0x2a')],'prev_project_name':_0x36a779[_0xab8c('0x2b')]||'','is_subproject':_0x36a779[_0xab8c('0x2b')]?!![]:![],'leaveAt':moment()['format'](_0xab8c('0x2c'))})});};exports['createSquareRecording']=function(_0x193d32){return request(_0xab8c('0x2d'),{'body':_0x193d32});};exports[_0xab8c('0x2e')]=function(_0x5d674b){return request(_0xab8c('0x2f'),{'body':_0x5d674b});};exports['createCmContact']=function(_0x315ed2){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x315ed2[_0xab8c('0x1d')],'ListId':_0x315ed2['ListId']}}})[_0xab8c('0x5')](function(_0x27971f){if(_0x27971f){return _0x27971f;}return request(_0xab8c('0x30'),{'body':_0x315ed2});});};exports[_0xab8c('0x31')]=function(_0x3e5c56){return request(_0xab8c('0x32'),{'options':{'where':{'id':_0x3e5c56},'attributes':[_0xab8c('0xb')]}});};exports[_0xab8c('0x33')]=function(_0x3298ed,_0x335b18){return request(_0xab8c('0x34'),{'body':{'interface':_0x335b18},'options':{'where':_0x3298ed}});};exports['agentPause']=function(_0x4fe986,_0x28a7c7,_0x253a19){return request(_0xab8c('0x35'),{'body':{'type':_0x28a7c7,'uniqueid':_0x253a19},'options':{'where':_0x4fe986}});};exports['agentUnpause']=function(_0x1021fd){return request(_0xab8c('0x36'),{'body':{},'options':{'where':_0x1021fd}});};exports[_0xab8c('0x37')]=function(_0x46cf39){return request(_0xab8c('0x38'),{'body':{},'options':{'where':_0x46cf39}});}; \ 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 31e1167..fba4108 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 _0xb5dd=['exports','./polly','./lex'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0xb5dd,0xd9));var _0xdb5d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb5dd[_0x4b369d];return _0x571a98;};var polly=require(_0xdb5d('0x0'));var lex=require(_0xdb5d('0x1'));module[_0xdb5d('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x71ad=['./polly','./lex'];(function(_0x19cb81,_0x5eb97e){var _0xf9c3b=function(_0x20d38b){while(--_0x20d38b){_0x19cb81['push'](_0x19cb81['shift']());}};_0xf9c3b(++_0x5eb97e);}(_0x71ad,0xee));var _0xd71a=function(_0x2e3a64,_0x3ad54e){_0x2e3a64=_0x2e3a64-0x0;var _0x1470af=_0x71ad[_0x2e3a64];return _0x1470af;};var polly=require(_0xd71a('0x0'));var lex=require(_0xd71a('0x1'));module['exports']={'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 5d9137c..8461dac 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4){return lex(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4);}; \ No newline at end of file +var _0x6c76=['./lib/api','exports'];(function(_0x40cd2b,_0x5843ce){var _0x3ea05d=function(_0x360a2a){while(--_0x360a2a){_0x40cd2b['push'](_0x40cd2b['shift']());}};_0x3ea05d(++_0x5843ce);}(_0x6c76,0x184));var _0x66c7=function(_0x315812,_0x252a78){_0x315812=_0x315812-0x0;var _0x2c8d37=_0x6c76[_0x315812];return _0x2c8d37;};'use strict';var lex=require(_0x66c7('0x0'));module[_0x66c7('0x1')]=function(_0x10a050,_0x55604c,_0x203e75,_0xd49f21,_0x519756,_0x572a2b){return lex(_0x10a050,_0x55604c,_0x203e75,_0xd49f21,_0x519756,_0x572a2b);}; \ 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 d150bc1..c62e9d8 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(_0xeb8b1d,_0x58daaa){var _0x5327ba=function(_0x18cad3){while(--_0x18cad3){_0xeb8b1d['push'](_0xeb8b1d['shift']());}};_0x5327ba(++_0x58daaa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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(_0x65e787,_0x4664c2){var _0x53ee70=function(_0x4d16b3){while(--_0x4d16b3){_0x65e787['push'](_0x65e787['shift']());}};_0x53ee70(++_0x4664c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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 5186ab5..aa0ad8f 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 _0x7a8a=['exports','./lib/api'];(function(_0x2356d3,_0x45c28a){var _0x5b6ec2=function(_0x4e0efb){while(--_0x4e0efb){_0x2356d3['push'](_0x2356d3['shift']());}};_0x5b6ec2(++_0x45c28a);}(_0x7a8a,0xc1));var _0xa7a8=function(_0x59e64f,_0x514b23){_0x59e64f=_0x59e64f-0x0;var _0x17d075=_0x7a8a[_0x59e64f];return _0x17d075;};'use strict';var polly=require(_0xa7a8('0x0'));module[_0xa7a8('0x1')]=function(_0x55e148,_0xb6f278,_0x10444e,_0x38a8cd,_0x15a7d3,_0x44eb39,_0x2e43cc){return polly(_0x55e148,_0xb6f278,_0x10444e,_0x38a8cd,_0x15a7d3,_0x44eb39,_0x2e43cc);}; \ No newline at end of file +var _0x0970=['exports'];(function(_0x3039d1,_0x1e8cfa){var _0x2d802b=function(_0x285d0f){while(--_0x285d0f){_0x3039d1['push'](_0x3039d1['shift']());}};_0x2d802b(++_0x1e8cfa);}(_0x0970,0x197));var _0x0097=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0970[_0x4a9fb1];return _0x348672;};'use strict';var polly=require('./lib/api');module[_0x0097('0x0')]=function(_0x474497,_0x28fd47,_0x61c7db,_0x21847a,_0x1ee0dd,_0x3853b6,_0x24e248){return polly(_0x474497,_0x28fd47,_0x61c7db,_0x21847a,_0x1ee0dd,_0x3853b6,_0x24e248);}; \ 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 39af1bc..4d54945 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 _0x5555=['Polly','text','mp3','randomstring','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x5555,0x11a));var _0x5555=function(_0x344e20,_0x127989){_0x344e20=_0x344e20-0x0;var _0x53784b=_0x5555[_0x344e20];return _0x53784b;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x5555('0x0'));var AWS=require(_0x5555('0x1'));function pollyResult(_0x2b0a62,_0x3e64f6,_0x4aa95d){return new BPromise(function(_0x1db0c4,_0x141088){_0x2b0a62['synthesizeSpeech'](_0x3e64f6,function(_0x58372a,_0x6492ae){if(_0x58372a){_0x141088(_0x58372a);}else if(_0x6492ae){if(_0x6492ae[_0x5555('0x2')]instanceof Buffer){fs[_0x5555('0x3')](_0x4aa95d,_0x6492ae[_0x5555('0x2')],function(_0x2e248c){if(_0x2e248c){_0x141088(_0x2e248c);}else{_0x1db0c4();}});}else{_0x141088(new Error(_0x5555('0x4')));}}else{_0x141088(new Error(_0x5555('0x5')));}});});}module['exports']=function(_0xafbc4f,_0x5f5924,_0x3acb79,_0x3686b5,_0xf4ef7d,_0x53cf35,_0x2d1617){var _0x3bb562=new AWS[(_0x5555('0x6'))]({'accessKeyId':_0xafbc4f,'secretAccessKey':_0x5f5924,'region':_0x3acb79});var _0x488245={'Text':_0xf4ef7d,'TextType':_0x53cf35||_0x5555('0x7'),'OutputFormat':_0x5555('0x8'),'VoiceId':_0x3686b5};return pollyResult(_0x3bb562,_0x488245,_0x2d1617);}; \ No newline at end of file +var _0x9d38=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','aws-sdk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d38,0x17e));var _0x89d3=function(_0x52556a,_0x47f617){_0x52556a=_0x52556a-0x0;var _0x341662=_0x9d38[_0x52556a];return _0x341662;};'use strict';var fs=require('fs');var path=require(_0x89d3('0x0'));var BPromise=require(_0x89d3('0x1'));var rs=require('randomstring');var AWS=require(_0x89d3('0x2'));function pollyResult(_0x1b152c,_0x3640e5,_0x20988b){return new BPromise(function(_0x1ec824,_0xfd552){_0x1b152c[_0x89d3('0x3')](_0x3640e5,function(_0x476fe8,_0x439baf){if(_0x476fe8){_0xfd552(_0x476fe8);}else if(_0x439baf){if(_0x439baf[_0x89d3('0x4')]instanceof Buffer){fs[_0x89d3('0x5')](_0x20988b,_0x439baf[_0x89d3('0x4')],function(_0x196197){if(_0x196197){_0xfd552(_0x196197);}else{_0x1ec824();}});}else{_0xfd552(new Error(_0x89d3('0x6')));}}else{_0xfd552(new Error(_0x89d3('0x7')));}});});}module[_0x89d3('0x8')]=function(_0x347bf3,_0x44141f,_0x59c6b3,_0x482db8,_0x243ee3,_0x3229cb,_0x5997f6){var _0x4e88e7=new AWS['Polly']({'accessKeyId':_0x347bf3,'secretAccessKey':_0x44141f,'region':_0x59c6b3});var _0x49dc5d={'Text':_0x243ee3,'TextType':_0x3229cb||_0x89d3('0x9'),'OutputFormat':_0x89d3('0xa'),'VoiceId':_0x482db8};return pollyResult(_0x4e88e7,_0x49dc5d,_0x5997f6);}; \ 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 2531560..78686a1 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 _0x738b=['./lib/api','exports'];(function(_0x5b9a71,_0xc56ff7){var _0x3fec24=function(_0xb6468f){while(--_0xb6468f){_0x5b9a71['push'](_0x5b9a71['shift']());}};_0x3fec24(++_0xc56ff7);}(_0x738b,0x1ba));var _0xb738=function(_0x210574,_0x243237){_0x210574=_0x210574-0x0;var _0x123ad9=_0x738b[_0x210574];return _0x123ad9;};'use strict';var asr=require(_0xb738('0x0'));module[_0xb738('0x1')]=function(_0x1bbc65,_0x39a3f1,_0x48a53d,_0x2ce1fb){return asr(_0x1bbc65,_0x39a3f1,_0x48a53d);}; \ No newline at end of file +var _0xcfdb=['exports','./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcfdb,0x113));var _0xbcfd=function(_0x1123bb,_0x54472a){_0x1123bb=_0x1123bb-0x0;var _0xdeb602=_0xcfdb[_0x1123bb];return _0xdeb602;};'use strict';var asr=require(_0xbcfd('0x0'));module[_0xbcfd('0x1')]=function(_0x51b8da,_0x2808c0,_0x5aa01b,_0x2f2b16){return asr(_0x51b8da,_0x2808c0,_0x5aa01b);}; \ 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 26360c9..32472cf 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 _0xaf1d=['/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','readFileSync','toString','base64'];(function(_0x5ae70c,_0x524d9c){var _0xedba92=function(_0x37c669){while(--_0x37c669){_0x5ae70c['push'](_0x5ae70c['shift']());}};_0xedba92(++_0x524d9c);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x44e28f,_0xa22820){_0x44e28f=_0x44e28f-0x0;var _0x1047b9=_0xaf1d[_0x44e28f];return _0x1047b9;};'use strict';var url=require(_0xdaf1('0x0'));var BPromise=require(_0xdaf1('0x1'));var fs=require('fs');var host=_0xdaf1('0x2');module[_0xdaf1('0x3')]=function(_0x5da77c,_0x30f9b1,_0x258708){return new BPromise(function(_0x5e2ffc,_0x159ded){var _0x38059d;if(typeof _0x5da77c!==_0xdaf1('0x4')||_0x5da77c[_0xdaf1('0x5')]===0x0){return _0x159ded(_0xdaf1('0x6'));}if(typeof _0x30f9b1!==_0xdaf1('0x4')||_0x30f9b1['length']===0x0){return _0x159ded('key\x20should\x20be\x20a\x20string');}if(typeof _0x258708!=='undefined'&&(typeof _0x258708!==_0xdaf1('0x4')||_0x258708['length']===0x0)){return _0x159ded('lang\x20should\x20be\x20a\x20string');}try{_0x38059d=fs[_0xdaf1('0x7')](_0x5da77c)[_0xdaf1('0x8')](_0xdaf1('0x9'));}catch(_0x2b42d7){return _0x159ded(_0x2b42d7);}return _0x5e2ffc({'method':'POST','uri':host+_0xdaf1('0xa')+_0x30f9b1,'body':{'config':{'encoding':_0xdaf1('0xb'),'sampleRateHertz':_0xdaf1('0xc'),'languageCode':_0x258708},'audio':{'content':_0x38059d}},'json':!![]});});}; \ No newline at end of file +var _0x1948=['POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','base64'];(function(_0x27ca82,_0x1bcedb){var _0x31294c=function(_0xc40158){while(--_0xc40158){_0x27ca82['push'](_0x27ca82['shift']());}};_0x31294c(++_0x1bcedb);}(_0x1948,0x145));var _0x8194=function(_0x47fe3d,_0x228bcd){_0x47fe3d=_0x47fe3d-0x0;var _0x1535f7=_0x1948[_0x47fe3d];return _0x1535f7;};'use strict';var url=require(_0x8194('0x0'));var BPromise=require(_0x8194('0x1'));var fs=require('fs');var host=_0x8194('0x2');module[_0x8194('0x3')]=function(_0x196370,_0x4d5815,_0x14a887){return new BPromise(function(_0x1ea186,_0x152b72){var _0x332d2f;if(typeof _0x196370!==_0x8194('0x4')||_0x196370[_0x8194('0x5')]===0x0){return _0x152b72(_0x8194('0x6'));}if(typeof _0x4d5815!==_0x8194('0x4')||_0x4d5815['length']===0x0){return _0x152b72(_0x8194('0x7'));}if(typeof _0x14a887!==_0x8194('0x8')&&(typeof _0x14a887!=='string'||_0x14a887[_0x8194('0x5')]===0x0)){return _0x152b72(_0x8194('0x9'));}try{_0x332d2f=fs['readFileSync'](_0x196370)['toString'](_0x8194('0xa'));}catch(_0x2fadc0){return _0x152b72(_0x2fadc0);}return _0x1ea186({'method':_0x8194('0xb'),'uri':host+_0x8194('0xc')+_0x4d5815,'body':{'config':{'encoding':_0x8194('0xd'),'sampleRateHertz':'8000','languageCode':_0x14a887},'audio':{'content':_0x332d2f}},'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 cf1b7e8..952cad5 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 _0xdf41=['exports','./asr'];(function(_0x1499c4,_0x57c5c3){var _0x3cf45a=function(_0x4bb7cb){while(--_0x4bb7cb){_0x1499c4['push'](_0x1499c4['shift']());}};_0x3cf45a(++_0x57c5c3);}(_0xdf41,0xeb));var _0x1df4=function(_0x43389e,_0x75efb4){_0x43389e=_0x43389e-0x0;var _0x48e6ca=_0xdf41[_0x43389e];return _0x48e6ca;};var asr=require(_0x1df4('0x0'));module[_0x1df4('0x1')]={'asr':asr}; \ No newline at end of file +var _0xae5f=['./asr'];(function(_0x2419e3,_0x44f70c){var _0x428ad9=function(_0x1e1d29){while(--_0x1e1d29){_0x2419e3['push'](_0x2419e3['shift']());}};_0x428ad9(++_0x44f70c);}(_0xae5f,0xd6));var _0xfae5=function(_0x922d17,_0x148583){_0x922d17=_0x922d17-0x0;var _0x3e7007=_0xae5f[_0x922d17];return _0x3e7007;};var asr=require(_0xfae5('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 66b23b8..cd513db 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 _0x2c6a=['.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','generic','parse\x20response\x20failed:\x0a','data','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','status','code','endConversation','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','action','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','https','path','request-promise','randomstring','google-tts-api','url','util','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','error','unlink','pipe','end','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST'];(function(_0x2558ee,_0x2a2574){var _0x431306=function(_0x32cb67){while(--_0x32cb67){_0x2558ee['push'](_0x2558ee['shift']());}};_0x431306(++_0x2a2574);}(_0x2c6a,0xd5));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var apiai=require(_0xa2c6('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xa2c6('0x1'));var fs=require('fs');var http=require('http');var https=require(_0xa2c6('0x2'));var md5=require('md5');var path=require(_0xa2c6('0x3'));var querystring=require('querystring');var rp=require(_0xa2c6('0x4'));var rs=require(_0xa2c6('0x5'));var sox=require('sox');var tts=require(_0xa2c6('0x6'));var urlParse=require(_0xa2c6('0x7'))['parse'];var util=require(_0xa2c6('0x8'));var aws=require(_0xa2c6('0x9'));var google=require(_0xa2c6('0xa'));var sestek=require(_0xa2c6('0xb'));var tilde=require(_0xa2c6('0xc'));var logger=require('../../../config/logger')(_0xa2c6('0xd'));var ISPEECH_API=_0xa2c6('0xe');function downloadFile(_0x338e55,_0x54f261){return new BPromise(function(_0x40ff56,_0xc13f8d){var _0x4116c1=urlParse(_0x338e55);var _0x3ac288=_0x4116c1[_0xa2c6('0xf')]===_0xa2c6('0x10')?https:http;var _0x5c7436={'host':_0x4116c1[_0xa2c6('0x11')],'path':_0x4116c1[_0xa2c6('0x3')],'headers':{'user-agent':_0xa2c6('0x12')}};_0x3ac288[_0xa2c6('0x13')](_0x5c7436,function(_0x53aa05){if(_0x53aa05[_0xa2c6('0x14')]!==0xc8){logger['error'](_0xa2c6('0x15')+_0x338e55+_0xa2c6('0x16')+_0x53aa05['statusCode']+'\x20('+_0x53aa05[_0xa2c6('0x17')]+')');_0xc13f8d(new Error('request\x20to\x20'+_0x338e55+_0xa2c6('0x16')+_0x53aa05['statusCode']+'\x20('+_0x53aa05[_0xa2c6('0x17')]+')'));return;}var _0x4dd0af=fs[_0xa2c6('0x18')](_0x54f261);_0x4dd0af['on'](_0xa2c6('0x19'),function(){logger['info'](_0xa2c6('0x1a'));_0x4dd0af[_0xa2c6('0x1b')](_0x40ff56);});_0x4dd0af['on'](_0xa2c6('0x1c'),function(_0x562a2c){fs[_0xa2c6('0x1d')](_0x54f261);logger[_0xa2c6('0x1c')]('download\x20error',_0x562a2c);_0xc13f8d(_0x562a2c);});_0x53aa05[_0xa2c6('0x1e')](_0x4dd0af);})['on']('error',function(_0x74afc2){logger[_0xa2c6('0x1c')](_0x74afc2);_0xc13f8d(_0x74afc2);})[_0xa2c6('0x1f')]();});}function uploadFile(_0x44f224){return new BPromise(function(_0x51b0b3,_0x33e5a8){var _0x4702be=urlParse(_0x44f224);var _0x2d95bc=_0x4702be[_0xa2c6('0xf')]===_0xa2c6('0x10')?https:http;var _0x565a6c={'host':_0x4702be['host'],'path':_0x4702be[_0xa2c6('0x3')],'headers':{'user-agent':_0xa2c6('0x12')}};_0x2d95bc[_0xa2c6('0x13')](_0x565a6c,function(_0x3e65b){if(_0x3e65b[_0xa2c6('0x14')]!==0xc8){_0x33e5a8(new Error('request\x20to\x20'+_0x44f224+_0xa2c6('0x16')+_0x3e65b[_0xa2c6('0x14')]+'\x20('+_0x3e65b[_0xa2c6('0x17')]+')'));return;}var _0x1cd77e='';_0x3e65b['on']('data',function(_0x471c3d){_0x1cd77e+=_0x471c3d;});_0x3e65b['on'](_0xa2c6('0x1f'),function(){_0x51b0b3(_0x1cd77e);});})['on'](_0xa2c6('0x1c'),function(_0x4dc1b9){_0x33e5a8(_0x4dc1b9);})[_0xa2c6('0x1f')]();});}function convertFile(_0x3842b1,_0x5cc3f3){return new BPromise(function(_0x559276,_0x435a30){var _0x5cf642=sox['transcode'](_0x3842b1,_0x5cc3f3,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5cf642['on'](_0xa2c6('0x1c'),function(_0x2d62dd){logger[_0xa2c6('0x1c')](_0xa2c6('0x20'),_0x2d62dd);_0x435a30(_0x2d62dd);});_0x5cf642['on'](_0xa2c6('0x1f'),function(){logger[_0xa2c6('0x21')](_0xa2c6('0x22'));_0x559276();});_0x5cf642[_0xa2c6('0x23')]();});}function base64Decode(_0x1e58b5,_0x4362e7){var _0xbb47c9=path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs[_0xa2c6('0x26')](0x4)+_0xa2c6('0x27'));fs[_0xa2c6('0x28')](_0xbb47c9,_0x1e58b5,_0xa2c6('0x29'));return convertFile(_0xbb47c9,_0x4362e7)[_0xa2c6('0x2a')](function(){try{fs[_0xa2c6('0x1d')](_0xbb47c9);fs[_0xa2c6('0x2b')](_0x4362e7,_0xa2c6('0x2c'));}catch(_0x2040bb){logger[_0xa2c6('0x1c')](_0x2040bb);}return _0x4362e7[_0xa2c6('0x2d')]('.')[0x0];});}function base64Encode(_0x1e7fcc){var _0x2925d3=fs[_0xa2c6('0x2e')](_0x1e7fcc);return new Buffer(_0x2925d3)[_0xa2c6('0x2f')](_0xa2c6('0x29'));}exports[_0xa2c6('0x30')]=function(_0x4b3d68,_0x3f4828,_0x1d745,_0xbca0db,_0x283a5c,_0x26e02b){var _0x163fe5,_0x4ffbb8;var _0x403522='https://texttospeech.googleapis.com/v1/';var _0x35db03=_0xa2c6('0x31')+_0x4b3d68;var _0x3fb233={};if(_0x3f4828===_0xa2c6('0x32')){_0x3fb233['input']={'ssml':_0x1d745};}else{_0x3fb233[_0xa2c6('0x33')]={'text':_0x1d745};};_0x3fb233[_0xa2c6('0x34')]={'languageCode':_0xbca0db,'ssmlGender':_0x283a5c};_0x3fb233[_0xa2c6('0x35')]={'audioEncoding':_0xa2c6('0x36'),'sampleRateHertz':0x1f40};var _0xcf8bc2={'url':_0x403522+_0xa2c6('0x37')+_0x35db03,'method':_0xa2c6('0x38'),'json':!![],'body':_0x3fb233};return rp(_0xcf8bc2)[_0xa2c6('0x2a')](function(_0x5bb1be){return new BPromise(function(_0x275945,_0x13e824){_0x163fe5=path[_0xa2c6('0x24')](__dirname,'tmp',rs[_0xa2c6('0x26')](0x4)+_0xa2c6('0x39'));var _0x13acb9=Buffer['from'](_0x5bb1be[_0xa2c6('0x3a')],_0xa2c6('0x29'));return fs[_0xa2c6('0x3b')](_0x163fe5,_0x13acb9,function(_0x13f62f){_0x13e824(_0x13f62f);},function(_0x128b05){fs[_0xa2c6('0x2b')](_0x163fe5,_0xa2c6('0x2c'));_0x275945(_0x128b05);});});})[_0xa2c6('0x2a')](function(_0x1a0a05){_0x4ffbb8=path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs['generate'](0x4)+_0xa2c6('0x27'));return convertFile(_0x163fe5,_0x4ffbb8);})['then'](function(){try{fs[_0xa2c6('0x1d')](_0x163fe5);fs['chmodSync'](_0x4ffbb8,_0xa2c6('0x2c'));}catch(_0x3b6094){logger[_0xa2c6('0x1c')](_0x3b6094);}logger[_0xa2c6('0x21')](_0xa2c6('0x3c'),_0x4ffbb8[_0xa2c6('0x2d')]('.')[0x0]);return _0x4ffbb8[_0xa2c6('0x2d')]('.')[0x0];});};exports[_0xa2c6('0x3d')]=function(_0x5f3c52,_0xee81bf){var _0x473c52=_0xa2c6('0x3e');var _0x15fba4,_0x490a8c;var _0x44c2af;var _0x4cb29f={'encoding':_0xa2c6('0x3f'),'method':'POST','timeout':0x2710,'url':_0x473c52,'headers':{'Content-Type':_0xa2c6('0x40')},'body':_0xa2c6('0x41')+encodeURIComponent(JSON['stringify']([[[_0xa2c6('0x42'),JSON[_0xa2c6('0x43')]([_0x5f3c52,_0xee81bf||'en',![],'null']),null,_0xa2c6('0x44')]]]))};return rp(_0x4cb29f)[_0xa2c6('0x2a')](function(_0x5ef490){try{_0x44c2af=eval(_0x5ef490['slice'](0x5))[0x0][0x2];}catch(_0x34e656){throw new Error(_0xa2c6('0x45')+_0x5ef490[_0xa2c6('0x46')]);}if(!_0x44c2af){if(_0x5f3c52['length']>0xc8){throw new Error(_0xa2c6('0x47'));}else{throw new Error('lang\x20\x22'+_0xee81bf+_0xa2c6('0x48'));}}try{_0x44c2af=eval(_0x44c2af)[0x0];}catch(_0x529e8c){throw new Error(_0xa2c6('0x45')+res['data']);}const _0x215f4c=_0x44c2af;_0x15fba4=path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs[_0xa2c6('0x26')](0x4)+_0xa2c6('0x39'));fs['writeFileSync'](_0x15fba4,_0x44c2af,{'encoding':_0xa2c6('0x29')});_0x490a8c=path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs[_0xa2c6('0x26')](0x4)+_0xa2c6('0x27'));return convertFile(_0x15fba4,_0x490a8c);})[_0xa2c6('0x2a')](function(){try{fs['unlink'](_0x15fba4);fs['chmodSync'](_0x490a8c,_0xa2c6('0x2c'));}catch(_0x4d43e8){logger[_0xa2c6('0x1c')](_0x4d43e8);}logger[_0xa2c6('0x21')](_0xa2c6('0x49'),_0x490a8c[_0xa2c6('0x2d')]('.')[0x0]);return _0x490a8c['split']('.')[0x0];});};exports[_0xa2c6('0x4a')]=function(_0x3f2926,_0x52cd8f,_0xbd18b8){return google[_0xa2c6('0x4b')](_0x3f2926,_0x52cd8f,_0xbd18b8)[_0xa2c6('0x2a')](function(_0x505e84){logger[_0xa2c6('0x21')](_0x505e84[_0xa2c6('0x4c')]);return rp(_0x505e84);})[_0xa2c6('0x2a')](function(_0x1d5ffa){var _0x5e5d98='';var _0x2d09a1=0x0;try{fs['unlink'](_0x3f2926);}catch(_0x107340){logger[_0xa2c6('0x1c')](_0x107340);}if(_0x1d5ffa&&_0x1d5ffa[_0xa2c6('0x4d')]){_0x5e5d98=_0x1d5ffa[_0xa2c6('0x4d')][_0xa2c6('0x4e')](function(_0xbc75f8){return _0xbc75f8&&_0xbc75f8[_0xa2c6('0x4f')][0x0]&&_0xbc75f8[_0xa2c6('0x4f')][0x0][_0xa2c6('0x50')]?_0xbc75f8[_0xa2c6('0x4f')][0x0]['transcript']:'';})[_0xa2c6('0x51')]('\x0a');_0x2d09a1=_0x1d5ffa[_0xa2c6('0x4d')][_0xa2c6('0x4e')](function(_0x2d3965){return _0x2d3965&&_0x2d3965['alternatives'][0x0]&&_0x2d3965['alternatives'][0x0]['confidence']?_0x2d3965[_0xa2c6('0x4f')][0x0][_0xa2c6('0x52')]:0x0;})[_0xa2c6('0x51')]('\x0a');}logger[_0xa2c6('0x21')](_0xa2c6('0x53'),_0x5e5d98);logger[_0xa2c6('0x21')]('googleASR\x20confidence',_0x2d09a1);return{'transcript':_0x5e5d98,'confidence':_0x2d09a1};})[_0xa2c6('0x54')](function(_0x20b160){logger['error'](_0xa2c6('0x55'),_0x20b160[_0xa2c6('0x14')],_0x20b160[_0xa2c6('0x56')],_0x20b160[_0xa2c6('0x57')]);});};exports['googleDialogflow']=function(_0x44f986,_0x4dd56d,_0x15498f,_0x5f2b90){var _0x1c8f54=apiai(_0x4dd56d,{'language':_0x5f2b90||'en'});return _0x1c8f54[_0xa2c6('0x58')](_0x15498f,{'sessionId':md5(_0x44f986)})[_0xa2c6('0x2a')](function(_0x525000){logger[_0xa2c6('0x21')](JSON['stringify'](_0x525000));return{'source':_0x525000[_0xa2c6('0x59')][_0xa2c6('0x5a')],'resolvedQuery':_0x525000[_0xa2c6('0x59')][_0xa2c6('0x5b')],'action':_0x525000[_0xa2c6('0x59')]['action'],'actionIncomplete':_0x525000['result'][_0xa2c6('0x5c')],'speech':_0x525000[_0xa2c6('0x59')][_0xa2c6('0x5d')][_0xa2c6('0x5e')],'score':_0x525000['result']['score'],'statusCode':_0x525000[_0xa2c6('0x5f')][_0xa2c6('0x60')],'endConversation':_0x525000['result']['metadata'][_0xa2c6('0x61')]||![],'isFallbackIntent':_0x525000[_0xa2c6('0x59')][_0xa2c6('0x62')][_0xa2c6('0x63')]};});};exports['googleDialogflowV2']=function(_0x4135cd,_0x47f4ff,_0x4271b7,_0x1d0241,_0x1c152a,_0x25b1fd){var _0x21e505=_0x1d0241[_0xa2c6('0x64')](/\\n/g,'\x0a');var _0x112f62={'credentials':{'private_key':_0x21e505,'client_email':_0x4271b7}};var _0x31d558=new dialogflow[(_0xa2c6('0x65'))](_0x112f62);var _0x1ffb4b=_0x31d558[_0xa2c6('0x66')](_0x47f4ff,md5(_0x4135cd));var _0x391ade={'session':_0x1ffb4b,'queryInput':{'text':{'text':_0x1c152a,'languageCode':_0x25b1fd}}};return _0x31d558['detectIntent'](_0x391ade)['then'](function(_0xb96a19){if(_0xb96a19&&_0xb96a19['length']){logger[_0xa2c6('0x21')](_0xa2c6('0x67'),JSON['stringify'](_0xb96a19));var _0x123dfb=_0xb96a19[0x0];if(_0x123dfb){var _0x13fd54={'action':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x69')],'allRequiredParamsPresent':_0x123dfb[_0xa2c6('0x68')]['allRequiredParamsPresent'],'endConversation':_0x123dfb['queryResult'][_0xa2c6('0x6a')]&&_0x123dfb['queryResult'][_0xa2c6('0x6a')][_0xa2c6('0x6b')]?_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x6a')][_0xa2c6('0x6b')][_0xa2c6('0x6c')][_0xa2c6('0x6d')]:![],'fulfillmentText':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x6e')],'intentName':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x6f')]['name'],'intentDisplayName':_0x123dfb['queryResult'][_0xa2c6('0x6f')][_0xa2c6('0x70')],'isFallbackIntent':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x6f')]['isFallback'],'languageCode':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x71')],'queryText':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x72')],'responseId':_0x123dfb[_0xa2c6('0x73')],'score':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x74')],'speech':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x6e')],'providerResponse':JSON[_0xa2c6('0x43')](_0xb96a19)};return _0x13fd54;}}});};exports['tildeASR']=function(_0x388bb9,_0x196332,_0x5966a2,_0x2c1541){return tilde[_0xa2c6('0x4b')](_0x388bb9,_0x196332,_0x5966a2,_0x2c1541)[_0xa2c6('0x2a')](function(_0x3aa606){try{fs[_0xa2c6('0x1d')](_0x388bb9);}catch(_0x4f1bcb){logger[_0xa2c6('0x1c')](_0x4f1bcb);}logger['info'](_0xa2c6('0x75'),_0x3aa606[_0xa2c6('0x50')]);logger[_0xa2c6('0x21')](_0xa2c6('0x76'),_0x3aa606[_0xa2c6('0x52')]);return _0x3aa606;});};exports['awsPolly']=function(_0x207ed8,_0x29510b,_0x1a47fe,_0xa12d1,_0x5bc744,_0x492c8d){var _0x104051=path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs[_0xa2c6('0x26')](0x4)+_0xa2c6('0x39'));var _0x1bb1b4;return aws[_0xa2c6('0x77')](_0x207ed8,_0x29510b,_0x1a47fe,_0xa12d1,_0x5bc744,_0x492c8d,_0x104051)[_0xa2c6('0x2a')](function(){_0x1bb1b4=path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs[_0xa2c6('0x26')](0x4)+_0xa2c6('0x27'));return convertFile(_0x104051,_0x1bb1b4);})[_0xa2c6('0x2a')](function(){try{fs[_0xa2c6('0x1d')](_0x104051);fs[_0xa2c6('0x2b')](_0x1bb1b4,_0xa2c6('0x2c'));}catch(_0x188b04){logger[_0xa2c6('0x1c')](_0x188b04);}return _0x1bb1b4[_0xa2c6('0x2d')]('.')[0x0];});};exports[_0xa2c6('0x78')]=function(_0xccb995,_0x38cb44,_0x2e6303,_0x2cdd4c,_0x108fbf,_0x38086f){return aws[_0xa2c6('0x79')](_0xccb995,_0x38cb44,_0x2e6303,_0x2cdd4c,_0x108fbf,_0x38086f)['then'](function(_0xf68566){logger[_0xa2c6('0x21')](JSON['stringify'](_0xf68566));return _0xf68566;});};exports['ispeechTTS']=function(_0x2915ff,_0x2dca2,_0x5f142a,_0x1ad634){var _0x487f57=util[_0xa2c6('0x7a')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x2915ff,encodeURIComponent(_0x2dca2),_0x5f142a,_0x1ad634);var _0x21e10c=path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs[_0xa2c6('0x26')](0x4)+'.mp3');var _0x145ac9;return downloadFile(_0x487f57,_0x21e10c)['then'](function(){_0x145ac9=path['resolve'](__dirname,_0xa2c6('0x25'),rs[_0xa2c6('0x26')](0x4)+_0xa2c6('0x27'));return convertFile(_0x21e10c,_0x145ac9);})[_0xa2c6('0x2a')](function(){try{fs[_0xa2c6('0x1d')](_0x21e10c);fs[_0xa2c6('0x2b')](_0x145ac9,_0xa2c6('0x2c'));}catch(_0x2ac3e0){logger[_0xa2c6('0x1c')](_0x2ac3e0);}return _0x145ac9[_0xa2c6('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x5d3b09,_0x3b8f6c,_0x1027c9,_0x1aadd7){var _0x310f55=util['format'](_0xa2c6('0x7b'),ISPEECH_API,_0x3b8f6c,_0x1027c9,base64Encode(_0x5d3b09),_0x1aadd7?util[_0xa2c6('0x7a')](_0xa2c6('0x7c'),encodeURIComponent(_0x1aadd7)):_0xa2c6('0x7d'));return uploadFile(_0x310f55)[_0xa2c6('0x2a')](function(_0x5d68a8){return querystring[_0xa2c6('0x7e')](_0x5d68a8);});};exports['sestekNDA']=function(_0x3c6fee,_0x1926cb){return sestek[_0xa2c6('0x7f')](_0x3c6fee,_0x1926cb)[_0xa2c6('0x2a')](function(_0x444551){logger[_0xa2c6('0x21')](JSON[_0xa2c6('0x43')](_0x444551));var _0x4efc4b={'speech':_0x444551[_0xa2c6('0x80')],'action':_0x444551[_0xa2c6('0x81')]?_0x444551[_0xa2c6('0x81')][_0xa2c6('0x82')]:undefined,'actiondata':_0x444551['channelData']?_0x444551[_0xa2c6('0x81')]['CustomActionData']:undefined};if(_0x444551[_0xa2c6('0x81')]&&_0x444551[_0xa2c6('0x81')][_0xa2c6('0x83')]){return base64Decode(_0x444551['channelData'][_0xa2c6('0x83')][_0xa2c6('0x84')],path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs['generate'](0x4)+_0xa2c6('0x27')))['then'](function(_0x5a4e5a){_0x4efc4b[_0xa2c6('0x85')]=_0x5a4e5a;return _0x4efc4b;});}return _0x4efc4b;});};exports[_0xa2c6('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0x0213=['\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','get','data','transcode','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','chmodSync','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','text:synthesize','POST','then','.mp3','from','audioContent','777','googleCloudTTS\x20path','googleTTS','application/x-www-form-urlencoded','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','writeFileSync','base64','.wav','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','detectIntent','length','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','awsLex','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','apiai-promise','bluebird','dialogflow','http','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','error','request\x20to\x20'];(function(_0x175f4a,_0xfae959){var _0x5d4653=function(_0x33710b){while(--_0x33710b){_0x175f4a['push'](_0x175f4a['shift']());}};_0x5d4653(++_0xfae959);}(_0x0213,0x70));var _0x3021=function(_0xa2b098,_0x461a08){_0xa2b098=_0xa2b098-0x0;var _0x29502e=_0x0213[_0xa2b098];return _0x29502e;};'use strict';var apiai=require(_0x3021('0x0'));var BPromise=require(_0x3021('0x1'));var dialogflow=require(_0x3021('0x2'));var fs=require('fs');var http=require(_0x3021('0x3'));var https=require('https');var md5=require(_0x3021('0x4'));var path=require(_0x3021('0x5'));var querystring=require(_0x3021('0x6'));var rp=require('request-promise');var rs=require(_0x3021('0x7'));var sox=require(_0x3021('0x8'));var tts=require(_0x3021('0x9'));var urlParse=require(_0x3021('0xa'))[_0x3021('0xb')];var util=require(_0x3021('0xc'));var aws=require(_0x3021('0xd'));var google=require(_0x3021('0xe'));var sestek=require(_0x3021('0xf'));var tilde=require(_0x3021('0x10'));var logger=require(_0x3021('0x11'))(_0x3021('0x12'));var ISPEECH_API=_0x3021('0x13');function downloadFile(_0x332db9,_0x30f7b8){return new BPromise(function(_0x173207,_0x26f06e){var _0x43b6d4=urlParse(_0x332db9);var _0x1290ee=_0x43b6d4[_0x3021('0x14')]===_0x3021('0x15')?https:http;var _0x3bd8f9={'host':_0x43b6d4[_0x3021('0x16')],'path':_0x43b6d4['path'],'headers':{'user-agent':_0x3021('0x17')}};_0x1290ee['get'](_0x3bd8f9,function(_0x5bfd6f){if(_0x5bfd6f[_0x3021('0x18')]!==0xc8){logger[_0x3021('0x19')](_0x3021('0x1a')+_0x332db9+_0x3021('0x1b')+_0x5bfd6f['statusCode']+'\x20('+_0x5bfd6f[_0x3021('0x1c')]+')');_0x26f06e(new Error(_0x3021('0x1a')+_0x332db9+'\x20failed,\x20status\x20code\x20=\x20'+_0x5bfd6f['statusCode']+'\x20('+_0x5bfd6f[_0x3021('0x1c')]+')'));return;}var _0x93b2b1=fs[_0x3021('0x1d')](_0x30f7b8);_0x93b2b1['on'](_0x3021('0x1e'),function(){logger['info'](_0x3021('0x1f'));_0x93b2b1[_0x3021('0x20')](_0x173207);});_0x93b2b1['on'](_0x3021('0x19'),function(_0x4c6ea8){fs[_0x3021('0x21')](_0x30f7b8);logger[_0x3021('0x19')](_0x3021('0x22'),_0x4c6ea8);_0x26f06e(_0x4c6ea8);});_0x5bfd6f[_0x3021('0x23')](_0x93b2b1);})['on']('error',function(_0x310051){logger[_0x3021('0x19')](_0x310051);_0x26f06e(_0x310051);})[_0x3021('0x24')]();});}function uploadFile(_0x4d6f8b){return new BPromise(function(_0x52f0d3,_0x39a890){var _0x2a3949=urlParse(_0x4d6f8b);var _0x13ec4b=_0x2a3949[_0x3021('0x14')]===_0x3021('0x15')?https:http;var _0x304d3d={'host':_0x2a3949['host'],'path':_0x2a3949[_0x3021('0x5')],'headers':{'user-agent':_0x3021('0x17')}};_0x13ec4b[_0x3021('0x25')](_0x304d3d,function(_0x12e37c){if(_0x12e37c['statusCode']!==0xc8){_0x39a890(new Error(_0x3021('0x1a')+_0x4d6f8b+'\x20failed,\x20status\x20code\x20=\x20'+_0x12e37c[_0x3021('0x18')]+'\x20('+_0x12e37c[_0x3021('0x1c')]+')'));return;}var _0x2c0d6c='';_0x12e37c['on'](_0x3021('0x26'),function(_0x4c44a0){_0x2c0d6c+=_0x4c44a0;});_0x12e37c['on'](_0x3021('0x24'),function(){_0x52f0d3(_0x2c0d6c);});})['on']('error',function(_0x1ceb69){_0x39a890(_0x1ceb69);})['end']();});}function convertFile(_0x33513a,_0x4fa76e){return new BPromise(function(_0x629dcd,_0xffcff0){var _0x4d699f=sox[_0x3021('0x27')](_0x33513a,_0x4fa76e,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4d699f['on'](_0x3021('0x19'),function(_0x2c800b){logger[_0x3021('0x19')](_0x3021('0x28'),_0x2c800b);_0xffcff0(_0x2c800b);});_0x4d699f['on'](_0x3021('0x24'),function(){logger[_0x3021('0x29')](_0x3021('0x2a'));_0x629dcd();});_0x4d699f[_0x3021('0x2b')]();});}function base64Decode(_0x27c679,_0x44cd54){var _0x3e4dd5=path[_0x3021('0x2c')](__dirname,_0x3021('0x2d'),rs[_0x3021('0x2e')](0x4)+'.wav');fs['writeFileSync'](_0x3e4dd5,_0x27c679,'base64');return convertFile(_0x3e4dd5,_0x44cd54)['then'](function(){try{fs[_0x3021('0x21')](_0x3e4dd5);fs[_0x3021('0x2f')](_0x44cd54,'777');}catch(_0x2a0af3){logger['error'](_0x2a0af3);}return _0x44cd54[_0x3021('0x30')]('.')[0x0];});}function base64Encode(_0xc68fe){var _0x46bd61=fs[_0x3021('0x31')](_0xc68fe);return new Buffer(_0x46bd61)[_0x3021('0x32')]('base64');}exports['googleCloudTTS']=function(_0x1e70e9,_0x2a636f,_0x4bef70,_0x65a3b1,_0x28ed33,_0x419eb0){var _0x55e584,_0x5ea99c;var _0x245095=_0x3021('0x33');var _0x4b7f72=_0x3021('0x34')+_0x1e70e9;var _0x2d6a16={};if(_0x2a636f===_0x3021('0x35')){_0x2d6a16[_0x3021('0x36')]={'ssml':_0x4bef70};}else{_0x2d6a16[_0x3021('0x36')]={'text':_0x4bef70};};_0x2d6a16['voice']={'languageCode':_0x65a3b1,'ssmlGender':_0x28ed33};_0x2d6a16[_0x3021('0x37')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x16abca={'url':_0x245095+_0x3021('0x38')+_0x4b7f72,'method':_0x3021('0x39'),'json':!![],'body':_0x2d6a16};return rp(_0x16abca)[_0x3021('0x3a')](function(_0x22011c){return new BPromise(function(_0x166a20,_0x33c88a){_0x55e584=path[_0x3021('0x2c')](__dirname,'tmp',rs[_0x3021('0x2e')](0x4)+_0x3021('0x3b'));var _0x44761b=Buffer[_0x3021('0x3c')](_0x22011c[_0x3021('0x3d')],'base64');return fs['writeFile'](_0x55e584,_0x44761b,function(_0x23d6f4){_0x33c88a(_0x23d6f4);},function(_0x1cf4c6){fs[_0x3021('0x2f')](_0x55e584,_0x3021('0x3e'));_0x166a20(_0x1cf4c6);});});})[_0x3021('0x3a')](function(_0x491af9){_0x5ea99c=path[_0x3021('0x2c')](__dirname,'tmp',rs[_0x3021('0x2e')](0x4)+'.wav');return convertFile(_0x55e584,_0x5ea99c);})[_0x3021('0x3a')](function(){try{fs[_0x3021('0x21')](_0x55e584);fs[_0x3021('0x2f')](_0x5ea99c,'777');}catch(_0x542989){logger['error'](_0x542989);}logger[_0x3021('0x29')](_0x3021('0x3f'),_0x5ea99c[_0x3021('0x30')]('.')[0x0]);return _0x5ea99c['split']('.')[0x0];});};exports[_0x3021('0x40')]=function(_0x1c7061,_0x490bcf){var _0x3c1fa5='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x5b9666,_0x145110;var _0x1c0252;var _0x161186={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x3c1fa5,'headers':{'Content-Type':_0x3021('0x41')},'body':'f.req='+encodeURIComponent(JSON[_0x3021('0x42')]([[['jQ1olc',JSON[_0x3021('0x42')]([_0x1c7061,_0x490bcf||'en',![],_0x3021('0x43')]),null,_0x3021('0x44')]]]))};return rp(_0x161186)['then'](function(_0x59b066){try{_0x1c0252=eval(_0x59b066[_0x3021('0x45')](0x5))[0x0][0x2];}catch(_0x2b6a61){throw new Error(_0x3021('0x46')+_0x59b066[_0x3021('0x26')]);}if(!_0x1c0252){if(_0x1c7061['length']>0xc8){throw new Error(_0x3021('0x47'));}else{throw new Error('lang\x20\x22'+_0x490bcf+_0x3021('0x48'));}}try{_0x1c0252=eval(_0x1c0252)[0x0];}catch(_0xb6b93f){throw new Error(_0x3021('0x46')+res[_0x3021('0x26')]);}const _0x178f5c=_0x1c0252;_0x5b9666=path[_0x3021('0x2c')](__dirname,_0x3021('0x2d'),rs['generate'](0x4)+_0x3021('0x3b'));fs[_0x3021('0x49')](_0x5b9666,_0x1c0252,{'encoding':_0x3021('0x4a')});_0x145110=path['resolve'](__dirname,_0x3021('0x2d'),rs['generate'](0x4)+_0x3021('0x4b'));return convertFile(_0x5b9666,_0x145110);})[_0x3021('0x3a')](function(){try{fs['unlink'](_0x5b9666);fs['chmodSync'](_0x145110,_0x3021('0x3e'));}catch(_0x2a4b6a){logger[_0x3021('0x19')](_0x2a4b6a);}logger[_0x3021('0x29')](_0x3021('0x4c'),_0x145110['split']('.')[0x0]);return _0x145110[_0x3021('0x30')]('.')[0x0];});};exports[_0x3021('0x4d')]=function(_0x28e4ca,_0x14e392,_0x2eaab4){return google[_0x3021('0x4e')](_0x28e4ca,_0x14e392,_0x2eaab4)[_0x3021('0x3a')](function(_0x48251f){logger[_0x3021('0x29')](_0x48251f[_0x3021('0x4f')]);return rp(_0x48251f);})[_0x3021('0x3a')](function(_0x5bb824){var _0x17e396='';var _0xc52139=0x0;try{fs[_0x3021('0x21')](_0x28e4ca);}catch(_0x159283){logger[_0x3021('0x19')](_0x159283);}if(_0x5bb824&&_0x5bb824[_0x3021('0x50')]){_0x17e396=_0x5bb824[_0x3021('0x50')][_0x3021('0x51')](function(_0x55b2b5){return _0x55b2b5&&_0x55b2b5[_0x3021('0x52')][0x0]&&_0x55b2b5[_0x3021('0x52')][0x0]['transcript']?_0x55b2b5[_0x3021('0x52')][0x0][_0x3021('0x53')]:'';})[_0x3021('0x54')]('\x0a');_0xc52139=_0x5bb824['results'][_0x3021('0x51')](function(_0x2a87af){return _0x2a87af&&_0x2a87af[_0x3021('0x52')][0x0]&&_0x2a87af[_0x3021('0x52')][0x0][_0x3021('0x55')]?_0x2a87af[_0x3021('0x52')][0x0][_0x3021('0x55')]:0x0;})[_0x3021('0x54')]('\x0a');}logger[_0x3021('0x29')](_0x3021('0x56'),_0x17e396);logger[_0x3021('0x29')](_0x3021('0x57'),_0xc52139);return{'transcript':_0x17e396,'confidence':_0xc52139};})[_0x3021('0x58')](function(_0x43cb35){logger[_0x3021('0x19')](_0x3021('0x59'),_0x43cb35[_0x3021('0x18')],_0x43cb35[_0x3021('0x5a')],_0x43cb35[_0x3021('0x5b')]);});};exports['googleDialogflow']=function(_0x5efac2,_0xaca46a,_0x5a8e7b,_0x461898){var _0x5bf727=apiai(_0xaca46a,{'language':_0x461898||'en'});return _0x5bf727[_0x3021('0x5c')](_0x5a8e7b,{'sessionId':md5(_0x5efac2)})[_0x3021('0x3a')](function(_0x16f080){logger[_0x3021('0x29')](JSON[_0x3021('0x42')](_0x16f080));return{'source':_0x16f080[_0x3021('0x5d')][_0x3021('0x5e')],'resolvedQuery':_0x16f080[_0x3021('0x5d')][_0x3021('0x5f')],'action':_0x16f080[_0x3021('0x5d')]['action'],'actionIncomplete':_0x16f080[_0x3021('0x5d')][_0x3021('0x60')],'speech':_0x16f080[_0x3021('0x5d')][_0x3021('0x61')][_0x3021('0x62')],'score':_0x16f080[_0x3021('0x5d')][_0x3021('0x63')],'statusCode':_0x16f080[_0x3021('0x64')][_0x3021('0x65')],'endConversation':_0x16f080[_0x3021('0x5d')][_0x3021('0x66')][_0x3021('0x67')]||![],'isFallbackIntent':_0x16f080[_0x3021('0x5d')]['metadata'][_0x3021('0x68')]};});};exports[_0x3021('0x69')]=function(_0x5d3589,_0x3eb368,_0x577404,_0x15b0fc,_0x44f15c,_0x4e7d5d){var _0xd3c343=_0x15b0fc['replace'](/\\n/g,'\x0a');var _0x4bae9f={'credentials':{'private_key':_0xd3c343,'client_email':_0x577404}};var _0x436ede=new dialogflow[(_0x3021('0x6a'))](_0x4bae9f);var _0x4dbede=_0x436ede['sessionPath'](_0x3eb368,md5(_0x5d3589));var _0x316836={'session':_0x4dbede,'queryInput':{'text':{'text':_0x44f15c,'languageCode':_0x4e7d5d}}};return _0x436ede[_0x3021('0x6b')](_0x316836)[_0x3021('0x3a')](function(_0x5d15ff){if(_0x5d15ff&&_0x5d15ff[_0x3021('0x6c')]){logger[_0x3021('0x29')]('Dialogflow\x20V2\x20response:',JSON[_0x3021('0x42')](_0x5d15ff));var _0x5cd444=_0x5d15ff[0x0];if(_0x5cd444){var _0x4775c2={'action':_0x5cd444[_0x3021('0x6d')]['action'],'allRequiredParamsPresent':_0x5cd444['queryResult'][_0x3021('0x6e')],'endConversation':_0x5cd444[_0x3021('0x6d')]['diagnosticInfo']&&_0x5cd444['queryResult'][_0x3021('0x6f')][_0x3021('0x70')]?_0x5cd444['queryResult'][_0x3021('0x6f')][_0x3021('0x70')][_0x3021('0x71')][_0x3021('0x72')]:![],'fulfillmentText':_0x5cd444[_0x3021('0x6d')][_0x3021('0x73')],'intentName':_0x5cd444[_0x3021('0x6d')]['intent'][_0x3021('0x5a')],'intentDisplayName':_0x5cd444[_0x3021('0x6d')][_0x3021('0x74')][_0x3021('0x75')],'isFallbackIntent':_0x5cd444[_0x3021('0x6d')][_0x3021('0x74')][_0x3021('0x76')],'languageCode':_0x5cd444[_0x3021('0x6d')][_0x3021('0x77')],'queryText':_0x5cd444[_0x3021('0x6d')]['queryText'],'responseId':_0x5cd444[_0x3021('0x78')],'score':_0x5cd444['queryResult'][_0x3021('0x79')],'speech':_0x5cd444['queryResult'][_0x3021('0x73')],'providerResponse':JSON[_0x3021('0x42')](_0x5d15ff)};return _0x4775c2;}}});};exports[_0x3021('0x7a')]=function(_0x23d1fb,_0x1acf80,_0x423827,_0x37e1e6){return tilde['asr'](_0x23d1fb,_0x1acf80,_0x423827,_0x37e1e6)[_0x3021('0x3a')](function(_0x58a04f){try{fs[_0x3021('0x21')](_0x23d1fb);}catch(_0x129c16){logger['error'](_0x129c16);}logger[_0x3021('0x29')]('Tilde\x20ASR\x20transcription',_0x58a04f['transcript']);logger[_0x3021('0x29')](_0x3021('0x7b'),_0x58a04f['confidence']);return _0x58a04f;});};exports[_0x3021('0x7c')]=function(_0x500e0b,_0x1b3b38,_0x36556e,_0x3438fc,_0x84e6e3,_0x3f508a){var _0x491b34=path[_0x3021('0x2c')](__dirname,'tmp',rs[_0x3021('0x2e')](0x4)+_0x3021('0x3b'));var _0x1e0b41;return aws['polly'](_0x500e0b,_0x1b3b38,_0x36556e,_0x3438fc,_0x84e6e3,_0x3f508a,_0x491b34)[_0x3021('0x3a')](function(){_0x1e0b41=path[_0x3021('0x2c')](__dirname,_0x3021('0x2d'),rs[_0x3021('0x2e')](0x4)+_0x3021('0x4b'));return convertFile(_0x491b34,_0x1e0b41);})[_0x3021('0x3a')](function(){try{fs[_0x3021('0x21')](_0x491b34);fs[_0x3021('0x2f')](_0x1e0b41,'777');}catch(_0x5b8f21){logger[_0x3021('0x19')](_0x5b8f21);}return _0x1e0b41[_0x3021('0x30')]('.')[0x0];});};exports[_0x3021('0x7d')]=function(_0x390f8c,_0x6d38f5,_0x2c5620,_0x262d24,_0x3a8a95,_0x213318){return aws['lex'](_0x390f8c,_0x6d38f5,_0x2c5620,_0x262d24,_0x3a8a95,_0x213318)[_0x3021('0x3a')](function(_0x3a661d){logger['info'](JSON[_0x3021('0x42')](_0x3a661d));return _0x3a661d;});};exports['ispeechTTS']=function(_0x1538a2,_0x326689,_0x4cf1f9,_0x4b5d7a){var _0x31bf3d=util[_0x3021('0x7e')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x1538a2,encodeURIComponent(_0x326689),_0x4cf1f9,_0x4b5d7a);var _0x5d3d91=path[_0x3021('0x2c')](__dirname,_0x3021('0x2d'),rs[_0x3021('0x2e')](0x4)+_0x3021('0x3b'));var _0x321fce;return downloadFile(_0x31bf3d,_0x5d3d91)[_0x3021('0x3a')](function(){_0x321fce=path[_0x3021('0x2c')](__dirname,_0x3021('0x2d'),rs[_0x3021('0x2e')](0x4)+_0x3021('0x4b'));return convertFile(_0x5d3d91,_0x321fce);})[_0x3021('0x3a')](function(){try{fs[_0x3021('0x21')](_0x5d3d91);fs[_0x3021('0x2f')](_0x321fce,_0x3021('0x3e'));}catch(_0x33b642){logger[_0x3021('0x19')](_0x33b642);}return _0x321fce[_0x3021('0x30')]('.')[0x0];});};exports[_0x3021('0x7f')]=function(_0x2147a4,_0x28f80e,_0x489633,_0x44fe27){var _0x35863e=util[_0x3021('0x7e')](_0x3021('0x80'),ISPEECH_API,_0x28f80e,_0x489633,base64Encode(_0x2147a4),_0x44fe27?util[_0x3021('0x7e')](_0x3021('0x81'),encodeURIComponent(_0x44fe27)):_0x3021('0x82'));return uploadFile(_0x35863e)[_0x3021('0x3a')](function(_0x3d6173){return querystring[_0x3021('0xb')](_0x3d6173);});};exports[_0x3021('0x83')]=function(_0x470211,_0x4ce430){return sestek[_0x3021('0x84')](_0x470211,_0x4ce430)[_0x3021('0x3a')](function(_0x1605b9){logger[_0x3021('0x29')](JSON['stringify'](_0x1605b9));var _0x1d384c={'speech':_0x1605b9[_0x3021('0x85')],'action':_0x1605b9['channelData']?_0x1605b9[_0x3021('0x86')][_0x3021('0x87')]:undefined,'actiondata':_0x1605b9[_0x3021('0x86')]?_0x1605b9[_0x3021('0x86')][_0x3021('0x88')]:undefined};if(_0x1605b9[_0x3021('0x86')]&&_0x1605b9[_0x3021('0x86')][_0x3021('0x89')]){return base64Decode(_0x1605b9['channelData'][_0x3021('0x89')]['Data'],path[_0x3021('0x2c')](__dirname,_0x3021('0x2d'),rs[_0x3021('0x2e')](0x4)+'.wav'))[_0x3021('0x3a')](function(_0x45a453){_0x1d384c[_0x3021('0x8a')]=_0x45a453;return _0x1d384c;});}return _0x1d384c;});};exports['dirName']=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 ac9b1f2..893e2de 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 _0xda1a=['./nda'];(function(_0x503790,_0x525c78){var _0x388092=function(_0x2ab2b8){while(--_0x2ab2b8){_0x503790['push'](_0x503790['shift']());}};_0x388092(++_0x525c78);}(_0xda1a,0x1ea));var _0xada1=function(_0x1841b7,_0x27bf28){_0x1841b7=_0x1841b7-0x0;var _0x530efc=_0xda1a[_0x1841b7];return _0x530efc;};var nda=require(_0xada1('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x3820=['exports','./nda'];(function(_0x38ecda,_0x3b551e){var _0x3fa8f3=function(_0x4e196c){while(--_0x4e196c){_0x38ecda['push'](_0x38ecda['shift']());}};_0x3fa8f3(++_0x3b551e);}(_0x3820,0x6d));var _0x0382=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x3820[_0x13ce0c];return _0x4388fb;};var nda=require(_0x0382('0x0'));module[_0x0382('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 79d0743..b78a5e4 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 _0x94dc=['POST','resolve','ndauth_url','/token','password','username','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','ProjectName','project','ndagenerate_audio','body','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','request-promise','../../../../../config/logger','exports'];(function(_0x294747,_0x379ea7){var _0x1a4b30=function(_0xac96e8){while(--_0xac96e8){_0x294747['push'](_0x294747['shift']());}};_0x1a4b30(++_0x379ea7);}(_0x94dc,0xb1));var _0xc94d=function(_0x1d8008,_0x40c7dd){_0x1d8008=_0x1d8008-0x0;var _0x57e0ac=_0x94dc[_0x1d8008];return _0x57e0ac;};'use strict';var rp=require(_0xc94d('0x0'));var url=require('url');var logger=require(_0xc94d('0x1'))('agi');module[_0xc94d('0x2')]=function(_0x1b2070,_0x40e7d8){var _0x4b2dcc={'method':_0xc94d('0x3'),'uri':url[_0xc94d('0x4')](_0x40e7d8[_0xc94d('0x5')],_0xc94d('0x6')),'form':{'grant_type':_0xc94d('0x7'),'username':_0x40e7d8[_0xc94d('0x8')],'password':_0x40e7d8[_0xc94d('0x7')]},'json':!![]};return rp(_0x4b2dcc)['then'](function(_0x2f9757){var _0xbe5904={'method':_0xc94d('0x3'),'uri':url[_0xc94d('0x4')](_0x40e7d8[_0xc94d('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x40e7d8[_0xc94d('0xa')]||_0xc94d('0xb'),'channelId':_0xc94d('0xc'),'conversation':{'id':_0x1b2070[_0xc94d('0xd')]},'from':{'id':_0x1b2070[_0xc94d('0xe')],'name':_0x1b2070[_0xc94d('0xf')]},'recipient':{'id':_0x1b2070['dnid'],'name':_0x1b2070[_0xc94d('0x10')]},'text':_0x40e7d8[_0xc94d('0x11')],'channelData':{}},'headers':{'Authorization':_0xc94d('0x12')+_0x2f9757[_0xc94d('0x13')]},'json':!![]};if(_0x40e7d8['project']){_0xbe5904['body']['channelData'][_0xc94d('0x14')]=_0x40e7d8[_0xc94d('0x15')];}if(_0x40e7d8[_0xc94d('0x16')]=='1'){_0xbe5904[_0xc94d('0x17')][_0xc94d('0x18')][_0xc94d('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc94d('0x1a')};}if(_0x40e7d8[_0xc94d('0x1b')]){_0xbe5904[_0xc94d('0x17')][_0xc94d('0x18')][_0xc94d('0x1c')]=_0x40e7d8[_0xc94d('0x1b')];if(_0x40e7d8[_0xc94d('0x1d')]){_0xbe5904[_0xc94d('0x17')][_0xc94d('0x18')]['CustomActionData']=_0x40e7d8['custom_action_data'];}}logger['info'](JSON['stringify'](_0xbe5904));return rp(_0xbe5904);});}; \ No newline at end of file +var _0x8fcf=['Bearer\x20','access_token','project','channelData','ProjectName','ndagenerate_audio','custom_action','body','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','dnid','extension','text'];(function(_0x248011,_0x2aaade){var _0x56d86d=function(_0x3a4659){while(--_0x3a4659){_0x248011['push'](_0x248011['shift']());}};_0x56d86d(++_0x2aaade);}(_0x8fcf,0x1db));var _0xf8fc=function(_0x4ef5ef,_0x2be21b){_0x4ef5ef=_0x4ef5ef-0x0;var _0x5b5cc0=_0x8fcf[_0x4ef5ef];return _0x5b5cc0;};'use strict';var rp=require(_0xf8fc('0x0'));var url=require(_0xf8fc('0x1'));var logger=require(_0xf8fc('0x2'))('agi');module[_0xf8fc('0x3')]=function(_0x5ac9b3,_0x5d623e){var _0x5a5263={'method':_0xf8fc('0x4'),'uri':url[_0xf8fc('0x5')](_0x5d623e[_0xf8fc('0x6')],_0xf8fc('0x7')),'form':{'grant_type':_0xf8fc('0x8'),'username':_0x5d623e[_0xf8fc('0x9')],'password':_0x5d623e[_0xf8fc('0x8')]},'json':!![]};return rp(_0x5a5263)[_0xf8fc('0xa')](function(_0x59c401){var _0x13c2a7={'method':'POST','uri':url[_0xf8fc('0x5')](_0x5d623e[_0xf8fc('0xb')],_0xf8fc('0xc')),'body':{'type':_0x5d623e[_0xf8fc('0xd')]||_0xf8fc('0xe'),'channelId':'Nda','conversation':{'id':_0x5ac9b3[_0xf8fc('0xf')]},'from':{'id':_0x5ac9b3[_0xf8fc('0x10')],'name':_0x5ac9b3['calleridname']},'recipient':{'id':_0x5ac9b3[_0xf8fc('0x11')],'name':_0x5ac9b3[_0xf8fc('0x12')]},'text':_0x5d623e[_0xf8fc('0x13')],'channelData':{}},'headers':{'Authorization':_0xf8fc('0x14')+_0x59c401[_0xf8fc('0x15')]},'json':!![]};if(_0x5d623e[_0xf8fc('0x16')]){_0x13c2a7['body'][_0xf8fc('0x17')][_0xf8fc('0x18')]=_0x5d623e[_0xf8fc('0x16')];}if(_0x5d623e[_0xf8fc('0x19')]=='1'){_0x13c2a7['body']['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5d623e[_0xf8fc('0x1a')]){_0x13c2a7[_0xf8fc('0x1b')][_0xf8fc('0x17')][_0xf8fc('0x1c')]=_0x5d623e[_0xf8fc('0x1a')];if(_0x5d623e['custom_action_data']){_0x13c2a7[_0xf8fc('0x1b')][_0xf8fc('0x17')][_0xf8fc('0x1d')]=_0x5d623e[_0xf8fc('0x1e')];}}logger[_0xf8fc('0x1f')](JSON[_0xf8fc('0x20')](_0x13c2a7));return rp(_0x13c2a7);});}; \ 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 227d3ee..5d1d0a6 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 _0xeb68=['exports','./lib/api'];(function(_0x494b5f,_0x2a0249){var _0x5eae5e=function(_0x250b5d){while(--_0x250b5d){_0x494b5f['push'](_0x494b5f['shift']());}};_0x5eae5e(++_0x2a0249);}(_0xeb68,0x91));var _0x8eb6=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xeb68[_0x5f3f88];return _0xd08119;};'use strict';var asr=require(_0x8eb6('0x0'));module[_0x8eb6('0x1')]=function(_0x141984,_0x1902a8,_0x5603a7,_0x1c354f){return asr(_0x141984,_0x1902a8,_0x5603a7,_0x1c354f);}; \ No newline at end of file +var _0x7771=['./lib/api','exports'];(function(_0x3351ff,_0x300f79){var _0x1dc8cf=function(_0x3c982a){while(--_0x3c982a){_0x3351ff['push'](_0x3351ff['shift']());}};_0x1dc8cf(++_0x300f79);}(_0x7771,0x1b0));var _0x1777=function(_0x208bc9,_0x4f36f6){_0x208bc9=_0x208bc9-0x0;var _0x2675a8=_0x7771[_0x208bc9];return _0x2675a8;};'use strict';var asr=require(_0x1777('0x0'));module[_0x1777('0x1')]=function(_0x1aac25,_0x5f2f3d,_0x268788,_0x285ea2){return asr(_0x1aac25,_0x5f2f3d,_0x268788,_0x285ea2);}; \ 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 710ee70..8d6eefc 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 _0xf4d3=['Tilde\x20ASR\x20hypoteses','hypotheses','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.','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final'];(function(_0x2c6ec2,_0x13dacf){var _0x581c79=function(_0x57823a){while(--_0x57823a){_0x2c6ec2['push'](_0x2c6ec2['shift']());}};_0x581c79(++_0x13dacf);}(_0xf4d3,0x147));var _0x3f4d=function(_0x543f1a,_0x1dd96a){_0x543f1a=_0x543f1a-0x0;var _0x4d9305=_0xf4d3[_0x543f1a];return _0x4d9305;};'use strict';var BPromise=require('bluebird');var _=require(_0x3f4d('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x3f4d('0x1'));var logger=require(_0x3f4d('0x2'))(_0x3f4d('0x3'));module[_0x3f4d('0x4')]=function(_0x1c3fa5,_0x442550,_0x7acfcf,_0x3e9438){return new BPromise(function(_0x409d5a,_0x35f353){logger[_0x3f4d('0x5')](_0x3f4d('0x6'),_0x3e9438||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x298391=new WebSocket(_0x3e9438||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x24703b='';var _0x4fc3c0='0';var _0x57a131='1';var _0x152acc=_0x3f4d('0x7');function _0x20a867(_0x375fcc){var _0x3fd32a=crypto[_0x3f4d('0x8')](_0x3f4d('0x9'));_0x3fd32a['update'](_0x375fcc);return _0x3fd32a[_0x3f4d('0xa')]('hex');}function _0x37ec9e(){try{logger[_0x3f4d('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x59bb8a=moment()['unix']();var _0x33bde6=_0x20a867(_0x59bb8a+_0x442550+_0x7acfcf);_0x298391[_0x3f4d('0xb')](JSON[_0x3f4d('0xc')]({'appID':_0x442550,'timestamp':_0x59bb8a,'appKey':_0x33bde6}));var _0x53ec11=fs[_0x3f4d('0xd')](_0x1c3fa5);_0x53ec11['on']('data',function(_0x3f3b3f){_0x298391[_0x3f4d('0xb')](_0x3f3b3f);});_0x53ec11['on'](_0x3f4d('0xe'),function(){_0x298391[_0x3f4d('0xb')](_0x3f4d('0xf'));});}catch(_0x50b4bd){logger[_0x3f4d('0x10')](_0x3f4d('0x11'),JSON[_0x3f4d('0xc')](_0x50b4bd));_0x298391[_0x3f4d('0x12')]();}}function _0x4d3b2f(_0x3a8cf7){try{if(_0x3a8cf7){var _0x2f8d1c=JSON[_0x3f4d('0x13')](_0x3a8cf7);switch(_0x2f8d1c[_0x3f4d('0x14')]){case 0x0:if(_0x2f8d1c[_0x3f4d('0x15')]){if(_0x2f8d1c[_0x3f4d('0x15')][_0x3f4d('0x16')]){logger['info'](_0x3f4d('0x17'),JSON[_0x3f4d('0xc')](_0x2f8d1c[_0x3f4d('0x15')][_0x3f4d('0x18')]));_0x24703b=_0x2f8d1c[_0x3f4d('0x15')][_0x3f4d('0x18')][0x0]['transcript'];_0x4fc3c0=_0x2f8d1c['result'][_0x3f4d('0x18')][0x0]['likelihood'];_0x57a131='0';_0x152acc=_0x3f4d('0x19');_0x298391['terminate']();}}break;case 0x1:logger['info'](_0x3f4d('0x7'));_0x57a131='1';_0x152acc=_0x3f4d('0x7');break;case 0x2:logger[_0x3f4d('0x5')](_0x3f4d('0x1a'));_0x57a131='2';_0x152acc='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x3f4d('0x5')](_0x3f4d('0x1b'));_0x57a131='9';_0x152acc=_0x3f4d('0x1b');break;case 0xa:logger[_0x3f4d('0x5')]('Authentication\x20failed.');_0x57a131='10';_0x152acc=_0x3f4d('0x1c');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x57a131='11';_0x152acc=_0x3f4d('0x1d');}}}catch(_0x399e7d){logger[_0x3f4d('0x10')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x3f4d('0xc')](_0x399e7d));_0x298391[_0x3f4d('0x12')]();}}function _0x375ef1(){logger[_0x3f4d('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x409d5a({'transcript':_0x24703b,'confidence':_0x4fc3c0,'status':_0x57a131,'status_message':_0x152acc});}function _0x1854bb(_0x526b07){logger['error'](_0x3f4d('0x1e'));if(!_[_0x3f4d('0x1f')](_0x526b07)){logger['error'](_[_0x3f4d('0x20')](_0x526b07)?JSON['stringify'](_0x526b07):_0x526b07);}}_0x298391['on'](_0x3f4d('0x21'),_0x37ec9e);_0x298391['on'](_0x3f4d('0x22'),_0x4d3b2f);_0x298391['on'](_0x3f4d('0xe'),_0x375ef1);_0x298391['on'](_0x3f4d('0x10'),_0x1854bb);});}; \ No newline at end of file +var _0x58ff=['digest','hex','info','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','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.','Tilde\x20ASR\x20parse\x20error','isNil','isObject','bluebird','moment','crypto','../../../../../../config/logger','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update'];(function(_0xc77c92,_0x8a9f1){var _0x51319b=function(_0x45b041){while(--_0x45b041){_0xc77c92['push'](_0xc77c92['shift']());}};_0x51319b(++_0x8a9f1);}(_0x58ff,0x116));var _0xf58f=function(_0x5df641,_0x4bcaab){_0x5df641=_0x5df641-0x0;var _0x868740=_0x58ff[_0x5df641];return _0x868740;};'use strict';var BPromise=require(_0xf58f('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xf58f('0x1'));var crypto=require(_0xf58f('0x2'));var logger=require(_0xf58f('0x3'))('agi');module[_0xf58f('0x4')]=function(_0x4561a8,_0x4ce734,_0x2e0878,_0x36792a){return new BPromise(function(_0x2b198c,_0x47f032){logger['info'](_0xf58f('0x5'),_0x36792a||_0xf58f('0x6'));var _0x1d8f4d=new WebSocket(_0x36792a||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x3daf38='';var _0x268b50='0';var _0x33b8b9='1';var _0x4c4150=_0xf58f('0x7');function _0xc4b8dd(_0x9a06f0){var _0x44c629=crypto[_0xf58f('0x8')]('sha1');_0x44c629[_0xf58f('0x9')](_0x9a06f0);return _0x44c629[_0xf58f('0xa')](_0xf58f('0xb'));}function _0x209465(){try{logger[_0xf58f('0xc')](_0xf58f('0xd'));var _0x2845c6=moment()['unix']();var _0x3dce16=_0xc4b8dd(_0x2845c6+_0x4ce734+_0x2e0878);_0x1d8f4d[_0xf58f('0xe')](JSON[_0xf58f('0xf')]({'appID':_0x4ce734,'timestamp':_0x2845c6,'appKey':_0x3dce16}));var _0x5e342d=fs[_0xf58f('0x10')](_0x4561a8);_0x5e342d['on'](_0xf58f('0x11'),function(_0x4cf931){_0x1d8f4d[_0xf58f('0xe')](_0x4cf931);});_0x5e342d['on'](_0xf58f('0x12'),function(){_0x1d8f4d[_0xf58f('0xe')](_0xf58f('0x13'));});}catch(_0x3e5324){logger[_0xf58f('0x14')](_0xf58f('0x15'),JSON['stringify'](_0x3e5324));_0x1d8f4d[_0xf58f('0x16')]();}}function _0x38a005(_0x342fed){try{if(_0x342fed){var _0x59b3a1=JSON['parse'](_0x342fed);switch(_0x59b3a1[_0xf58f('0x17')]){case 0x0:if(_0x59b3a1[_0xf58f('0x18')]){if(_0x59b3a1[_0xf58f('0x18')]['final']){logger[_0xf58f('0xc')](_0xf58f('0x19'),JSON[_0xf58f('0xf')](_0x59b3a1[_0xf58f('0x18')][_0xf58f('0x1a')]));_0x3daf38=_0x59b3a1[_0xf58f('0x18')][_0xf58f('0x1a')][0x0]['transcript'];_0x268b50=_0x59b3a1['result'][_0xf58f('0x1a')][0x0][_0xf58f('0x1b')];_0x33b8b9='0';_0x4c4150=_0xf58f('0x1c');_0x1d8f4d[_0xf58f('0x16')]();}}break;case 0x1:logger[_0xf58f('0xc')](_0xf58f('0x7'));_0x33b8b9='1';_0x4c4150=_0xf58f('0x7');break;case 0x2:logger[_0xf58f('0xc')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x33b8b9='2';_0x4c4150=_0xf58f('0x1d');break;case 0x9:logger['info'](_0xf58f('0x1e'));_0x33b8b9='9';_0x4c4150=_0xf58f('0x1e');break;case 0xa:logger[_0xf58f('0xc')]('Authentication\x20failed.');_0x33b8b9='10';_0x4c4150=_0xf58f('0x1f');break;case 0xb:logger['info'](_0xf58f('0x20'));_0x33b8b9='11';_0x4c4150=_0xf58f('0x20');}}}catch(_0x14a9fc){logger['error'](_0xf58f('0x21'),JSON[_0xf58f('0xf')](_0x14a9fc));_0x1d8f4d[_0xf58f('0x16')]();}}function _0xc8c78d(){logger[_0xf58f('0xc')]('Close\x20Tilde\x20ASR\x20socket');_0x2b198c({'transcript':_0x3daf38,'confidence':_0x268b50,'status':_0x33b8b9,'status_message':_0x4c4150});}function _0x397bbb(_0x41abdc){logger[_0xf58f('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xf58f('0x22')](_0x41abdc)){logger['error'](_[_0xf58f('0x23')](_0x41abdc)?JSON[_0xf58f('0xf')](_0x41abdc):_0x41abdc);}}_0x1d8f4d['on']('open',_0x209465);_0x1d8f4d['on']('message',_0x38a005);_0x1d8f4d['on']('close',_0xc8c78d);_0x1d8f4d['on'](_0xf58f('0x14'),_0x397bbb);});}; \ 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 d23e6fc..6841176 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 _0x08f7=['exports'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x08f7,0x1b4));var _0x708f=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x08f7[_0x4226d6];return _0x19655b;};var asr=require('./asr');module[_0x708f('0x0')]={'asr':asr}; \ No newline at end of file +var _0x57c1=['exports','./asr'];(function(_0x331c51,_0x544eda){var _0xf7f299=function(_0x59f7ab){while(--_0x59f7ab){_0x331c51['push'](_0x331c51['shift']());}};_0xf7f299(++_0x544eda);}(_0x57c1,0x19f));var _0x157c=function(_0x4cb5f0,_0x56bc98){_0x4cb5f0=_0x4cb5f0-0x0;var _0x4afc65=_0x57c1[_0x4cb5f0];return _0x4afc65;};var asr=require(_0x157c('0x0'));module[_0x157c('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e0f9f60..dd1e960 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 _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x9842c1,_0x1edf79){var _0x5ba376=function(_0x4b88ed){while(--_0x4b88ed){_0x9842c1['push'](_0x9842c1['shift']());}};_0x5ba376(++_0x1edf79);}(_0x34e8,0x12c));var _0x834e=function(_0x3664d8,_0x4b47a0){_0x3664d8=_0x3664d8-0x0;var _0x43ba51=_0x34e8[_0x3664d8];return _0x43ba51;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index d1c5639..6b4af50 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 _0x885a=['createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','includes','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','computedVariables','uri','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','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_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getAndSetVariable','result','extra','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','delay','minutes','sync','phone','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','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','no\x20user\x20selected','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','DIAL','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','maxdigit','test','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','.wav','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','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','beep','NOBEEP','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','recordFile','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','context','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','getVoiceQueue','indexOf','toLowerCase','macro','gosub','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','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','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','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','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','lodash','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','extension','dnid','file','createSquareMessage'];(function(_0x47491d,_0x1b05d0){var _0x1af5d4=function(_0x51f93c){while(--_0x51f93c){_0x47491d['push'](_0x47491d['shift']());}};_0x1af5d4(++_0x1b05d0);}(_0x885a,0x180));var _0xa885=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x885a[_0x178e48];return _0x440d7e;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xa885('0x0'));var sh=require(_0xa885('0x1'));var odbc=require(_0xa885('0x2'))();var rs=require(_0xa885('0x3'));var moment=require('moment');var Mustache=require(_0xa885('0x4'));var rp=require(_0xa885('0x5'));var logger=require(_0xa885('0x6'))(_0xa885('0x7'));var config=require(_0xa885('0x8'));var scripts=require(_0xa885('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xa885('0xa'),_0xa885('0xb')];var verticesWithRetry=[_0xa885('0xc'),'getdigits',_0xa885('0xd')];var AGIVertices=function(_0x2b7916,_0x38df93,_0x5e49d0){this[_0xa885('0xe')]=_0x2b7916;this[_0xa885('0xf')]=_0x38df93;this[_0xa885('0x10')]=_0x5e49d0;};AGIVertices[_0xa885('0x11')][_0xa885('0x12')]=function(_0x11c544,_0xcf5f96){this['rpc'][_0xa885('0x13')](_0x11c544)[_0xa885('0x14')](function(_0x1fb769){_0xcf5f96(null,_0x1fb769?_0x1fb769[_0xa885('0x15')]:![]);})[_0xa885('0x16')](function(_0x3e9c7a){_0xcf5f96(_0x3e9c7a);});};AGIVertices[_0xa885('0x11')]['getVoiceQueue']=function(_0x3a310b,_0x1d789f){this[_0xa885('0xf')][_0xa885('0x17')](_0x3a310b)[_0xa885('0x14')](function(_0x5bdb0c){_0x1d789f(null,_0x5bdb0c?_0x5bdb0c[_0xa885('0x15')]:![]);})[_0xa885('0x16')](function(_0x5296e6){_0x1d789f(_0x5296e6);});};AGIVertices[_0xa885('0x11')][_0xa885('0x18')]=function(_0x4e5ae5,_0x6c6a0b){this[_0xa885('0xf')]['getSquareProjectById'](_0x4e5ae5)[_0xa885('0x14')](function(_0x543e7a){_0x6c6a0b(null,_0x543e7a?_0x543e7a[_0xa885('0x15')]:![]);})[_0xa885('0x16')](function(_0x8c26c){_0x6c6a0b(_0x8c26c);});};AGIVertices['prototype'][_0xa885('0x19')]=function(_0x56a614,_0x127a86){this[_0xa885('0xf')][_0xa885('0x1a')](_0x56a614)['then'](function(_0xbbf56e){_0x127a86(null,_0xbbf56e?_0xbbf56e[_0xa885('0x1b')]:![]);})[_0xa885('0x16')](function(_0x4de770){_0x127a86(_0x4de770);});};AGIVertices[_0xa885('0x11')][_0xa885('0x1c')]=function(_0x94fcac,_0x4ad909){this[_0xa885('0xf')]['getUserById'](_0x94fcac)[_0xa885('0x14')](function(_0x299553){_0x4ad909(null,_0x299553?_0x299553['name']:![]);})[_0xa885('0x16')](function(_0x190a57){_0x4ad909(_0x190a57);});};AGIVertices[_0xa885('0x11')]['getTrunk']=function(_0x35d4c4,_0x14aed1){this['rpc'][_0xa885('0x1d')](_0x35d4c4)['then'](function(_0x15ff4d){_0x14aed1(null,_0x15ff4d?_0x15ff4d['name']:![]);})[_0xa885('0x16')](function(_0x110e63){_0x14aed1(_0x110e63);});};AGIVertices[_0xa885('0x11')][_0xa885('0x1e')]=function(_0x1e0177,_0x410968){var _0x1e13d5=this;this[_0xa885('0xf')]['getSoundById'](_0x1e0177)['then'](function(_0x5c4ca7){_0x410968(null,_0x5c4ca7?_0x1e13d5['getSoundPath'](_0x5c4ca7[_0xa885('0x1f')]):![]);})[_0xa885('0x16')](function(_0x3af5d9){_0x410968(_0x3af5d9);});};AGIVertices[_0xa885('0x11')][_0xa885('0x20')]=function(_0x44f006,_0x5ac39f){this[_0xa885('0xf')]['getMailAccountById'](_0x44f006)[_0xa885('0x14')](function(_0x4a1e54){_0x5ac39f(null,_0x4a1e54?_0x4a1e54:![]);})[_0xa885('0x16')](function(_0x528a71){_0x5ac39f(_0x528a71);});};AGIVertices[_0xa885('0x11')][_0xa885('0x21')]=function(_0x14eb7e,_0x5d62c2,_0x15f3a){this[_0xa885('0x10')]['sendMailMessage'](_0x14eb7e,_0x5d62c2)[_0xa885('0x14')](function(){_0x15f3a(null);})['catch'](function(_0x24365e){_0x15f3a(_0x24365e);});};AGIVertices[_0xa885('0x11')][_0xa885('0x22')]=function(_0x504091,_0xf34189){this[_0xa885('0xf')][_0xa885('0x23')](_0x504091)['then'](function(_0x40150e){if(_0x40150e){if(_0x40150e[_0xa885('0x24')]){_0xf34189(null,[_0x40150e[_0xa885('0x25')]]);}else{_0xf34189(null,_[_0xa885('0x26')](_0x40150e[_0xa885('0x27')],_0xa885('0x25')));}}else{_0xf34189(null,![]);}})[_0xa885('0x16')](function(_0x457b97){_0xf34189(_0x457b97);});};AGIVertices['prototype']['getSoundPath']=function(_0x1a1379){return util[_0xa885('0x28')](_0xa885('0x29'),FILES_PATH,_0x1a1379);};AGIVertices[_0xa885('0x11')][_0xa885('0x2a')]=function(_0x18d083,_0x404afc,_0x337e55){odbc[_0xa885('0x2b')](_0x18d083,function(_0x5a2a27){if(_0x5a2a27){logger['error'](_0xa885('0x2c'),_0x5a2a27);_0x337e55(_0x5a2a27);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0xa885('0x2d')](_0x404afc,function(_0x5e82a6,_0x110f75){if(_0x5e82a6){logger[_0xa885('0x2e')](_0xa885('0x2f'),_0x404afc);_0x337e55(_0x5e82a6);}else{logger[_0xa885('0x2e')](_0xa885('0x30'),_0x404afc);odbc[_0xa885('0x31')](function(_0x113298){if(_0x113298){logger[_0xa885('0x32')](_0xa885('0x33'),_0x113298);}_0x337e55(null,_0x110f75);});}});}});};AGIVertices[_0xa885('0x11')]['getSmsAccount']=function(_0x30759d,_0x4012b3){this[_0xa885('0xf')][_0xa885('0x34')](_0x30759d)[_0xa885('0x14')](function(_0x5e327f){_0x4012b3(null,_0x5e327f?_0x5e327f:![]);})['catch'](function(_0x3afe38){_0x4012b3(_0x3afe38);});};AGIVertices[_0xa885('0x11')][_0xa885('0x35')]=function(_0x2a1e90,_0x1cfe71){this['rpc'][_0xa885('0x35')](_0x2a1e90)[_0xa885('0x14')](function(_0x5dced9){_0x1cfe71(null,_0x5dced9);})['catch'](function(_0x113679){_0x1cfe71(_0x113679);});};AGIVertices[_0xa885('0x11')]['createSquareDetailsReport']=function(_0x561bf0,_0x1089e5,_0x12c35f){this[_0xa885('0xf')][_0xa885('0x36')]({'uniqueid':this[_0xa885('0xe')][_0xa885('0x37')],'node':_0x561bf0[_0xa885('0x38')],'application':_0x561bf0[_0xa885('0x39')],'data':_0x1089e5||null,'project_name':this[_0xa885('0xe')][_0xa885('0x3a')],'callerid':this[_0xa885('0xe')]['callerid']})[_0xa885('0x14')](function(_0x1cf063){if(_0x12c35f){_0x12c35f(null,_0x1cf063);}})[_0xa885('0x16')](function(_0x49c6a7){if(_0x12c35f){_0x12c35f(_0x49c6a7);}});};AGIVertices[_0xa885('0x11')][_0xa885('0x3b')]=function(_0x28d79d,_0x3d19f1,_0x5e33be,_0xdb7929){this['rpc'][_0xa885('0x3b')]({'uniqueid':this[_0xa885('0xe')]['uniqueid'],'callerid':this[_0xa885('0xe')][_0xa885('0x3c')],'calleridname':this[_0xa885('0xe')][_0xa885('0x3d')],'context':this[_0xa885('0xe')]['context'],'extension':this[_0xa885('0xe')][_0xa885('0x3e')],'priority':this[_0xa885('0xe')]['priority'],'accountcode':this['channel']['accountcode'],'dnid':this[_0xa885('0xe')][_0xa885('0x3f')],'projectName':this[_0xa885('0xe')][_0xa885('0x3a')],'saveName':_0x3d19f1,'filename':_0x28d79d[_0xa885('0x40')]||_0x3d19f1,'savePath':_0x5e33be})[_0xa885('0x14')](function(_0x43245c){_0xdb7929(null,_0x43245c);})[_0xa885('0x16')](function(_0x4397d6){_0xdb7929(_0x4397d6);});};AGIVertices[_0xa885('0x11')][_0xa885('0x41')]=function(_0x560a27,_0x5f4856,_0x5c6840,_0x11a272,_0x289716){this[_0xa885('0xf')][_0xa885('0x41')]({'uniqueid':this[_0xa885('0xe')][_0xa885('0x37')],'body':_0x560a27,'direction':_0x5f4856,'providerName':_0x5c6840,'providerResponse':_0x11a272})[_0xa885('0x14')](function(_0x574641){if(_0x289716){_0x289716(null,_0x574641);}})[_0xa885('0x16')](function(_0x40923e){if(_0x289716){_0x289716(_0x40923e);}});};AGIVertices[_0xa885('0x11')][_0xa885('0x42')]=function(_0x8d9479,_0x1bd3a2){this[_0xa885('0xf')]['createCmContact']({'firstName':_[_0xa885('0x43')](_0x8d9479[_0xa885('0x15')])||_[_0xa885('0x44')](_0x8d9479['name'])?_0xa885('0x45')+Math[_0xa885('0x46')]():_0x8d9479[_0xa885('0x15')],'lastName':_[_0xa885('0x43')](_0x8d9479[_0xa885('0x47')])||_[_0xa885('0x44')](_0x8d9479[_0xa885('0x47')])?null:_0x8d9479[_0xa885('0x47')],'phone':_0x8d9479['phone'],'ListId':_0x8d9479[_0xa885('0x48')],'scheduledat':_0x8d9479[_0xa885('0x49')],'callbackUniqueid':this[_0xa885('0xe')]['uniqueid'],'tags':_0xa885('0x4a'),'description':_0xa885('0x4b')+_0x8d9479[_0xa885('0x49')][_0xa885('0x4c')](),'priority':_0x8d9479[_0xa885('0x4d')]})[_0xa885('0x14')](function(_0x5b78d6){_0x1bd3a2(null,_0x5b78d6);})[_0xa885('0x16')](function(_0x2800e8){_0x1bd3a2(_0x2800e8);});};AGIVertices[_0xa885('0x11')]['getPause']=function(_0x1d555f,_0x251323){this[_0xa885('0xf')][_0xa885('0x4e')](_0x1d555f)[_0xa885('0x14')](function(_0x2ee5eb){_0x251323(null,_0x2ee5eb?_0x2ee5eb[_0xa885('0x15')]:![]);})[_0xa885('0x16')](function(_0x3b7805){_0x251323(_0x3b7805);});};AGIVertices['prototype'][_0xa885('0x4f')]=function(_0x333502,_0x5514bb,_0x4dc788){var _0x1bfacb={'role':_0xa885('0x50')};_0x1bfacb[_0x333502]=this['channel'][_0xa885('0x3c')];this[_0xa885('0xf')][_0xa885('0x4f')](_0x1bfacb,_0x5514bb,this[_0xa885('0xe')][_0xa885('0x37')])[_0xa885('0x14')](function(_0x1101c3){_0x4dc788(null,_['isNil'](_0x1101c3)?![]:!![]);})[_0xa885('0x16')](function(_0x318565){logger['error'](_0x318565);_0x4dc788(null,![]);});};AGIVertices[_0xa885('0x11')]['agentUnpause']=function(_0x117cfe,_0x5698d6){var _0x3f5e8f={'role':_0xa885('0x50')};_0x3f5e8f[_0x117cfe]=this[_0xa885('0xe')][_0xa885('0x3c')];this['rpc'][_0xa885('0x51')](_0x3f5e8f)[_0xa885('0x14')](function(_0x2f89df){_0x5698d6(null,_['isNil'](_0x2f89df)?![]:!![]);})[_0xa885('0x16')](function(_0x564029){logger[_0xa885('0x32')](_0x564029);_0x5698d6(null,![]);});};AGIVertices[_0xa885('0x11')]['agentLogout']=function(_0x108ff1,_0x5e4335){var _0x36c7ba={'role':_0xa885('0x50')};_0x36c7ba[_0x108ff1]=this['channel'][_0xa885('0x3c')];this[_0xa885('0xf')][_0xa885('0x52')](_0x36c7ba)[_0xa885('0x14')](function(_0x4d428a){_0x5e4335(null,_['isNil'](_0x4d428a)?![]:!![]);})[_0xa885('0x16')](function(_0x2c23bd){logger['error'](_0x2c23bd);_0x5e4335(null,![]);});};AGIVertices['prototype'][_0xa885('0x53')]=function(_0x214082,_0xe2c8f7){var _0x262a0c={'role':_0xa885('0x50')};_0x262a0c[_0x214082]=this[_0xa885('0xe')][_0xa885('0x3c')];var _0x257632=_0x214082!=_0xa885('0x54')?util[_0xa885('0x28')](_0xa885('0x55'),'LOCAL',this[_0xa885('0xe')][_0xa885('0x3c')]):undefined;this[_0xa885('0xf')][_0xa885('0x53')](_0x262a0c,_0x257632)[_0xa885('0x14')](function(_0x5cc2cf){_0xe2c8f7(null,_[_0xa885('0x44')](_0x5cc2cf)?![]:!![]);})['catch'](function(_0x5d5fba){logger[_0xa885('0x32')](_0x5d5fba);_0xe2c8f7(null,![]);});};AGIVertices[_0xa885('0x11')]['shellCommand']=function(_0x55813c,_0xed114e){sh[_0xa885('0x56')](_[_0xa885('0x57')](_0x55813c),function(_0x5b5684,_0x56f0ef){var _0x2444f2=_0x56f0ef[_0xa885('0x58')](/(\r\n|\n|\r)/gm,'');_0xed114e(null,_0x2444f2);});};AGIVertices[_0xa885('0x11')][_0xa885('0x59')]=function(_0x5ef85e,_0x313c45){scripts[_0xa885('0x59')](_0x5ef85e[_0xa885('0x5a')],_0x5ef85e['google_cloud_tts_text_type']||'text',_0x5ef85e[_0xa885('0x5b')],_0x5ef85e[_0xa885('0x5c')]||_0xa885('0x5d'),_0x5ef85e['ssmlGender']||_0xa885('0x5e'),_0x5ef85e[_0xa885('0x5f')]||_0xa885('0x60'))[_0xa885('0x14')](function(_0x50c4ad){_0x313c45(null,_0x50c4ad);})[_0xa885('0x16')](function(_0x1d7082){_0x313c45(_0x1d7082);});};AGIVertices['prototype'][_0xa885('0x61')]=function(_0x206b22,_0x5a7bde){scripts[_0xa885('0x61')](_0x206b22['text'],_0x206b22[_0xa885('0x62')]||'en',0x1)[_0xa885('0x14')](function(_0x1cb988){_0x5a7bde(null,_0x1cb988);})[_0xa885('0x16')](function(_0x1195d1){_0x5a7bde(_0x1195d1);});};AGIVertices[_0xa885('0x11')][_0xa885('0x63')]=function(_0x3aa8bc,_0x490d15){var _0x55413d={'uri':_0x3aa8bc[_0xa885('0x64')],'method':_0x3aa8bc[_0xa885('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3aa8bc['timeout'])===_0xa885('0x66')&&parseInt(_0x3aa8bc[_0xa885('0x67')])>=0x1?parseInt(_0x3aa8bc['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xa885('0x68')](['POST',_0xa885('0x69')],_0x55413d[_0xa885('0x65')][_0xa885('0x6a')]())){try{_0x55413d[_0xa885('0x6b')]=_0x3aa8bc['rawBody']?JSON['parse'](_0x3aa8bc[_0xa885('0xb')]):{};}catch(_0x2c98e4){logger[_0xa885('0x32')](_0xa885('0x6c'),_0x2c98e4);}}try{_0x55413d[_0xa885('0x6d')]=_0x3aa8bc[_0xa885('0xa')]?JSON[_0xa885('0x6e')](_0x3aa8bc[_0xa885('0xa')]):{};}catch(_0x51e961){logger[_0xa885('0x32')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x51e961);}if(_0x3aa8bc[_0xa885('0x6f')]){try{var _0x39e520=require(_0x3aa8bc[_0xa885('0x6f')])['sync'](this,_0x55413d);_0x55413d[_0xa885('0x70')]=Mustache[_0xa885('0x71')](_0x3aa8bc['url'],_0x39e520,{},['$$','$$']);if(_0x55413d['headers']){_0x55413d[_0xa885('0x6d')]=JSON[_0xa885('0x6e')](Mustache[_0xa885('0x71')](JSON[_0xa885('0x72')](_0x55413d[_0xa885('0x6d')]),_0x39e520,{},['$$','$$']));}if(_0x55413d['body']){_0x55413d['body']=JSON[_0xa885('0x6e')](Mustache[_0xa885('0x71')](JSON[_0xa885('0x72')](_0x55413d[_0xa885('0x6b')]),_0x39e520,{},['$$','$$']));}}catch(_0x56bd37){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x56bd37);}}rp(_0x55413d)[_0xa885('0x14')](function(_0x389008){var _0x3a4342={'statusCode':_0x389008[_0xa885('0x73')]||0xc8,'statusMessage':_0x389008[_0xa885('0x74')]||'OK','headers':_0x389008[_0xa885('0x6d')]||{},'body':_0x389008[_0xa885('0x6b')]||{}};_0x490d15(null,_0x3a4342);})['catch'](function(_0x5b0dc2){var _0x34f6cb={'statusCode':_0x5b0dc2['statusCode']||0x1f4,'statusMessage':_0x5b0dc2[_0xa885('0x75')]||_0xa885('0x76'),'headers':_0x5b0dc2[_0xa885('0x77')][_0xa885('0x6d')]||{},'body':_0x5b0dc2['options'][_0xa885('0x6b')]||{}};_0x490d15(null,_0x34f6cb);});};AGIVertices[_0xa885('0x11')][_0xa885('0x78')]=function(_0x5a6f1f,_0xe5881c){scripts[_0xa885('0x78')](this[_0xa885('0xe')]['uniqueid'],_0x5a6f1f[_0xa885('0x79')],_0x5a6f1f[_0xa885('0x5b')],_0x5a6f1f[_0xa885('0x7a')]||'en')[_0xa885('0x14')](function(_0x3b763e){_0xe5881c(null,_0x3b763e);})[_0xa885('0x16')](function(_0x581ef7){_0xe5881c(_0x581ef7);});};AGIVertices[_0xa885('0x11')][_0xa885('0x7b')]=function(_0x3be76a,_0x1689c8){scripts['googleDialogflowV2'](this[_0xa885('0xe')][_0xa885('0x37')],_0x3be76a[_0xa885('0x7c')],_0x3be76a[_0xa885('0x7d')],_0x3be76a[_0xa885('0x7e')],_0x3be76a[_0xa885('0x5b')],_0x3be76a[_0xa885('0x7f')]||'en')[_0xa885('0x14')](function(_0x4902e6){_0x1689c8(null,_0x4902e6);})[_0xa885('0x16')](function(_0x3dd30f){_0x1689c8(_0x3dd30f);});};AGIVertices['prototype'][_0xa885('0x80')]=function(_0x54faa5,_0x454841){scripts[_0xa885('0x80')](this['channel'],_0x54faa5)[_0xa885('0x14')](function(_0x54f651){_0x454841(null,_0x54f651);})[_0xa885('0x16')](function(_0x5a2122){_0x454841(_0x5a2122);});};AGIVertices[_0xa885('0x11')]['ispeechTTS']=function(_0x20c68b,_0x2119c2){scripts[_0xa885('0x81')](_0x20c68b[_0xa885('0x79')],_0x20c68b['text'],_0x20c68b[_0xa885('0x82')]||_0xa885('0x5d'),_0x20c68b[_0xa885('0x83')])['then'](function(_0x144f1b){_0x2119c2(null,_0x144f1b);})[_0xa885('0x16')](function(_0x7eca56){_0x2119c2(_0x7eca56);});};AGIVertices['prototype'][_0xa885('0x84')]=function(_0x1915bd,_0x534151,_0x59eecb){scripts[_0xa885('0x84')](_0x534151,_0x1915bd[_0xa885('0x79')],_0x1915bd[_0xa885('0x85')]||'en-US',this[_0xa885('0x86')](_0x1915bd[_0xa885('0x87')])?_0x1915bd[_0xa885('0x87')]:undefined)[_0xa885('0x14')](function(_0x4060c0){_0x59eecb(null,_0x4060c0);})[_0xa885('0x16')](function(_0x11b660){_0x59eecb(_0x11b660);});};AGIVertices[_0xa885('0x11')][_0xa885('0x88')]=function(_0x41797f,_0x5ecf82){scripts['awsPolly'](_0x41797f[_0xa885('0x89')],_0x41797f['aws_secret_access_key'],_0x41797f[_0xa885('0x8a')],_0x41797f[_0xa885('0x8b')]||_0xa885('0x8c'),_0x41797f['text'],_0x41797f[_0xa885('0x8d')]||_0xa885('0x5b'))[_0xa885('0x14')](function(_0x203cf4){_0x5ecf82(null,_0x203cf4);})[_0xa885('0x16')](function(_0x74a9){_0x5ecf82(_0x74a9);});};AGIVertices[_0xa885('0x11')]['awsLex']=function(_0x1a32cc,_0x15998b){scripts[_0xa885('0x8e')](this[_0xa885('0xe')]['uniqueid'],_0x1a32cc[_0xa885('0x89')],_0x1a32cc[_0xa885('0x8f')],_0x1a32cc['aws_lex_region'],_0x1a32cc['text'],_0x1a32cc[_0xa885('0x90')])[_0xa885('0x14')](function(_0x2197be){_0x15998b(null,_0x2197be);})[_0xa885('0x16')](function(_0x27478a){_0x15998b(_0x27478a);});};AGIVertices[_0xa885('0x11')][_0xa885('0x91')]=function(_0x28faa6,_0x4b1e4e,_0x39cb1d){scripts['googleASR'](_0x4b1e4e,_0x28faa6[_0xa885('0x79')],_0x28faa6[_0xa885('0x92')]||_0xa885('0x5d'))[_0xa885('0x14')](function(_0x4eed26){_0x39cb1d(null,_0x4eed26);})[_0xa885('0x16')](function(_0x14668d){_0x39cb1d(_0x14668d);});};AGIVertices[_0xa885('0x11')][_0xa885('0x93')]=function(_0x48dbb8,_0x452b87,_0x553556){scripts[_0xa885('0x93')](_0x452b87,_0x48dbb8['appid'],_0x48dbb8[_0xa885('0x94')],_0x48dbb8[_0xa885('0x70')])[_0xa885('0x14')](function(_0x52bb2c){_0x553556(null,_0x52bb2c);})[_0xa885('0x16')](function(_0x223a94){_0x553556(_0x223a94);});};AGIVertices[_0xa885('0x11')][_0xa885('0x95')]=function(_0x9adf59){var _0x19ffd5=_[_0xa885('0x68')](verticesWithRetry,_0x9adf59[_0xa885('0x39')])?_0x9adf59:_[_0xa885('0x96')](_0x9adf59);for(var _0x920fda in _0x19ffd5){if(_0x19ffd5[_0xa885('0x97')](_0x920fda)){if(_0x19ffd5[_0x920fda]&&_[_0xa885('0x98')](_0x19ffd5[_0x920fda])){if(_[_0xa885('0x68')](recursiveMapAttributes,_0x920fda)){_0x19ffd5[_0x920fda]=this[_0xa885('0x99')](_0x19ffd5[_0x920fda]);}else{_0x19ffd5[_0x920fda]=this['replaceAllVariables'](_0x19ffd5[_0x920fda]);}}}}return _0x19ffd5;};AGIVertices[_0xa885('0x11')][_0xa885('0x9a')]=function(_0x2fcca4){for(var _0x15ccce in _0x2fcca4){if(_0x2fcca4['hasOwnProperty'](_0x15ccce)){if(_[_0xa885('0x9b')](_0x2fcca4[_0x15ccce])){this[_0xa885('0x9a')](_0x2fcca4[_0x15ccce]);}else if(_[_0xa885('0x9c')](_0x2fcca4[_0x15ccce])){for(var _0x4142a0=0x0;_0x4142a0<_0x2fcca4[_0x15ccce][_0xa885('0x9d')];_0x4142a0++){this[_0xa885('0x9a')](_0x2fcca4[_0x15ccce][_0x4142a0]);}}else if(_[_0xa885('0x98')](_0x2fcca4[_0x15ccce])){_0x2fcca4[_0x15ccce]=this[_0xa885('0x9e')](_0x2fcca4[_0x15ccce]);}}}};AGIVertices[_0xa885('0x11')]['saveRestApiResult']=function(_0x59f79f,_0x43f8a2){for(var _0x3a2bda in _0x59f79f){if(_0x59f79f[_0xa885('0x97')](_0x3a2bda)){if(_[_0xa885('0x9b')](_0x59f79f[_0x3a2bda])){if(!_[_0xa885('0x43')](_0x59f79f[_0x3a2bda])){this[_0xa885('0x9f')](_0x59f79f[_0x3a2bda],util[_0xa885('0x28')](_0xa885('0xa0'),_0x43f8a2,_0x3a2bda));}}else if(_[_0xa885('0x9c')](_0x59f79f[_0x3a2bda])){for(var _0x2473eb=0x0;_0x2473eb<_0x59f79f[_0x3a2bda][_0xa885('0x9d')];_0x2473eb++){this['saveRestApiResult'](_0x59f79f[_0x3a2bda][_0x2473eb],util[_0xa885('0x28')](_0xa885('0xa0'),_0x43f8a2,_0x3a2bda+'['+_0x2473eb+']'));}}else{if(!_[_0xa885('0x44')](_0x59f79f[_0x3a2bda])){this[_0xa885('0xe')][_0xa885('0xa1')](util['format'](_0xa885('0xa0'),_0x43f8a2,_0x3a2bda),_0x59f79f[_0x3a2bda]);}}}}};AGIVertices[_0xa885('0x11')][_0xa885('0x99')]=function(_0x4a0b1d){try{var _0x2b291d=JSON[_0xa885('0x6e')](_0x4a0b1d);this[_0xa885('0x9a')](_0x2b291d);return JSON[_0xa885('0x72')](_0x2b291d);}catch(_0xeeb6f9){return this[_0xa885('0x9e')](_0x4a0b1d);}};AGIVertices[_0xa885('0x11')]['replaceAllVariables']=function(_0x3a5640){var _0x45908a=_0x3a5640[_0xa885('0xa2')]('{');for(var _0x325225=0x1;_0x325225<_0x45908a['length'];_0x325225+=0x1){var _0x49d544=_0x45908a[_0x325225][_0xa885('0xa2')]('}');if(_0x49d544[_0xa885('0x9d')]>0x1){_0x3a5640=_0x3a5640[_0xa885('0xa3')]('{'+_0x49d544[0x0]+'}',this[_0xa885('0xe')][_0xa885('0x12')](_0x49d544[0x0])['extra']||_0x49d544[0x0]);}}if(_0x45908a[_0xa885('0x9d')]===0x1){return _0x3a5640[_0xa885('0x4c')]();}return this[_0xa885('0x9e')](_0x3a5640);};AGIVertices[_0xa885('0x11')][_0xa885('0xa4')]=function(_0x30005a,_0x5c3fd2){var _0x376274=this['channel']['getVariable'](_0x30005a);if(_0x376274[_0xa885('0xa5')]===-0x1){return _0x376274;}logger['info'](util[_0xa885('0x28')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5c3fd2,_0x376274[_0xa885('0xa6')]));return this[_0xa885('0xe')][_0xa885('0xa1')](_0x5c3fd2,_0x376274[_0xa885('0xa6')]);};AGIVertices[_0xa885('0x11')][_0xa885('0x86')]=function(_0x323741){return _0x323741&&_0x323741!=='0'&&_0x323741!=='-1'&&_0x323741!=='';};AGIVertices[_0xa885('0x11')][_0xa885('0xa7')]=function(_0x226cf1){this[_0xa885('0x36')]['sync'](this,_0x226cf1,'-');_0x226cf1[_0xa885('0xa8')]=_0x226cf1[_0xa885('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa885('0x11')]['mrcpsynth']=function(_0x464787){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0xa9'),_0x464787[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x464787['text'])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xab'));}var _0x1a829e='\x22'+_0x464787['text']+'\x22';if(this['isConfigured'](_0x464787[_0xa885('0x77')])){_0x1a829e+=','+_0x464787[_0xa885('0x77')];}var _0x2e7e25=this['channel']['exec'](_0xa885('0xac'),_0x1a829e);if(_0x2e7e25[_0xa885('0xa5')]===-0x1){return _0x2e7e25;}return this[_0xa885('0xe')][_0xa885('0xaa')](util['format'](_0xa885('0xad'),_0x1a829e));};AGIVertices[_0xa885('0x11')]['mrcprecog']=function(_0x5cf609){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x5cf609[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x5cf609[_0xa885('0xae')])){return this[_0xa885('0xe')][_0xa885('0xaa')]('no\x20grammar\x20configured');}var _0x5dfa9a=_0x5cf609[_0xa885('0xae')];if(this[_0xa885('0x86')](_0x5cf609['options'])){_0x5dfa9a+=','+_0x5cf609[_0xa885('0x77')];}var _0x3dacf0=this['channel'][_0xa885('0x56')](_0xa885('0xaf'),_0x5dfa9a);if(_0x3dacf0[_0xa885('0xa5')]===-0x1){return _0x3dacf0;}var _0x47e3d7=this[_0xa885('0xa4')](_0xa885('0xb0'),_0xa885('0xb1'));if(_0x47e3d7['result']===-0x1){return _0x47e3d7;}var _0x274f9d=this[_0xa885('0xa4')](_0xa885('0xb2'),'MRCP_RECOG_TRANSCRIPT');if(_0x274f9d[_0xa885('0xa5')]===-0x1){return _0x274f9d;}var _0x2dfcad=this[_0xa885('0xa4')](_0xa885('0xb3'),'MRCP_RECOG_INSTANCE');if(_0x2dfcad['result']===-0x1){return _0x2dfcad;}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5dfa9a));};AGIVertices[_0xa885('0x11')][_0xa885('0x7')]=function(_0x5a4b0c){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0xb4'),_0x5a4b0c[_0xa885('0x38')]));return this[_0xa885('0xe')][_0xa885('0x7')]([_0x5a4b0c[_0xa885('0xb5')],_0x5a4b0c[_0xa885('0xb6')]]);};AGIVertices[_0xa885('0x11')][_0xa885('0xb7')]=function(_0x5664d0){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x5664d0['label']));if(this['isConfigured'](_0x5664d0[_0xa885('0x67')])){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0xb8'),_0x5664d0[_0xa885('0x67')]));var _0x5b4ae6=this[_0xa885('0xe')][_0xa885('0xb9')](_0x5664d0[_0xa885('0x67')]);if(_0x5b4ae6[_0xa885('0xa5')]===-0x1){return _0x5b4ae6;}}return this[_0xa885('0xe')][_0xa885('0xb7')]();};AGIVertices['prototype'][_0xa885('0x4a')]=function(_0x81dbb7){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x81dbb7[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x81dbb7[_0xa885('0x48')])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x81dbb7,'no\x20list\x20selected');}_0x81dbb7['scheduledAt']=moment();if(this[_0xa885('0x86')](_0x81dbb7[_0xa885('0xba')])){_0x81dbb7[_0xa885('0x49')]=moment()['add'](_0x81dbb7[_0xa885('0xba')],_0xa885('0xbb'));}if(!this['isConfigured'](_0x81dbb7[_0xa885('0x4d')])){_0x81dbb7['callback_priority']=0x2;}this[_0xa885('0x42')][_0xa885('0xbc')](this,_0x81dbb7);return this[_0xa885('0xe')]['noop'](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x81dbb7[_0xa885('0xbd')],_0x81dbb7[_0xa885('0x48')],_0x81dbb7[_0xa885('0x49')]));};AGIVertices['prototype']['custom_app']=function(_0x3710d7){logger[_0xa885('0x2e')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x3710d7[_0xa885('0x38')]));var _0x1a9c6a=this[_0xa885('0xe')][_0xa885('0x56')](_0x3710d7[_0xa885('0xbe')],_0x3710d7['options']);if(_0x1a9c6a[_0xa885('0xa5')]===-0x1){return _0x1a9c6a;}return this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xbf'),_0x3710d7[_0xa885('0xbe')],_0x3710d7[_0xa885('0x77')]));};AGIVertices[_0xa885('0x11')][_0xa885('0xc0')]=function(_0x1340b6){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1340b6[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x1340b6[_0xa885('0x5b')])){return this[_0xa885('0xe')][_0xa885('0xaa')]('no\x20text\x20configured');}var _0xcdd785='\x22'+_0x1340b6[_0xa885('0x5b')]+'\x22';if(this['isConfigured'](_0x1340b6['options'])){_0xcdd785+=','+_0x1340b6[_0xa885('0x77')];}var _0x4ea4aa=this[_0xa885('0xe')][_0xa885('0x56')](_0xa885('0xac'),_0xcdd785);if(_0x4ea4aa['result']===-0x1){return _0x4ea4aa;}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0xcdd785));};AGIVertices[_0xa885('0x11')][_0xa885('0xc1')]=function(_0x49a24f){logger['info'](util[_0xa885('0x28')](_0xa885('0xc2'),_0x49a24f[_0xa885('0x38')]));if(!this['isConfigured'](_0x49a24f[_0xa885('0x5b')])){return this['channel']['noop'](_0xa885('0xab'));}var _0x1d5f01='\x22'+_0x49a24f[_0xa885('0x5b')]+'\x22';if(this[_0xa885('0x86')](_0x49a24f[_0xa885('0x77')])){_0x1d5f01+=','+_0x49a24f['options'];}var _0x5d888f=this[_0xa885('0xe')]['exec'](_0xa885('0xac'),_0x1d5f01);if(_0x5d888f[_0xa885('0xa5')]===-0x1){return _0x5d888f;}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1d5f01));};AGIVertices[_0xa885('0x11')][_0xa885('0xc3')]=function(_0x4d8913){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0xc4'),_0x4d8913['label']));if(!this[_0xa885('0x86')](_0x4d8913[_0xa885('0xae')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xc5'));}var _0x3a8b87=_0x4d8913[_0xa885('0xae')];if(this['isConfigured'](_0x4d8913[_0xa885('0x77')])){_0x3a8b87+=','+_0x4d8913[_0xa885('0x77')];}var _0x35ebaf=this[_0xa885('0xe')][_0xa885('0x56')](_0xa885('0xaf'),_0x3a8b87);if(_0x35ebaf[_0xa885('0xa5')]===-0x1){return _0x35ebaf;}var _0x5973dd=this[_0xa885('0xa4')](_0xa885('0xb0'),_0xa885('0xc6'));if(_0x5973dd[_0xa885('0xa5')]===-0x1){return _0x5973dd;}var _0xa4a02b=this[_0xa885('0xa4')](_0xa885('0xb2'),_0xa885('0xc7'));if(_0xa4a02b[_0xa885('0xa5')]===-0x1){return _0xa4a02b;}var _0x25017e=this['getAndSetVariable'](_0xa885('0xb3'),'LUMENVOX_ASR_INSTANCE');if(_0x25017e[_0xa885('0xa5')]===-0x1){return _0x25017e;}return this[_0xa885('0xe')][_0xa885('0xaa')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x3a8b87));};AGIVertices[_0xa885('0x11')][_0xa885('0xc8')]=function(_0x128ca3){logger['info'](util[_0xa885('0x28')](_0xa885('0xc9'),_0x128ca3['label']));if(!this[_0xa885('0x86')](_0x128ca3[_0xa885('0xae')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xc5'));}var _0x403c6b=_0x128ca3[_0xa885('0xae')];if(this[_0xa885('0x86')](_0x128ca3[_0xa885('0x77')])){_0x403c6b+=','+_0x128ca3[_0xa885('0x77')];}var _0x5e398a=this['channel'][_0xa885('0x56')](_0xa885('0xaf'),_0x403c6b);if(_0x5e398a['result']===-0x1){return _0x5e398a;}var _0x31f0bd=this[_0xa885('0xa4')](_0xa885('0xb0'),'SESTEK_ASR_CONFIDENCE');if(_0x31f0bd['result']===-0x1){return _0x31f0bd;}var _0x1bd43f=this[_0xa885('0xa4')](_0xa885('0xb2'),_0xa885('0xca'));if(_0x1bd43f[_0xa885('0xa5')]===-0x1){return _0x1bd43f;}var _0x5263ed=this['getAndSetVariable'](_0xa885('0xb3'),_0xa885('0xcb'));if(_0x5263ed[_0xa885('0xa5')]===-0x1){return _0x5263ed;}return this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xcc'),_0x403c6b));};AGIVertices['prototype'][_0xa885('0xcd')]=function(_0x261673){logger[_0xa885('0x2e')](util['format'](_0xa885('0xce'),_0x261673[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x261673['odbc_id'])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x261673,_0xa885('0xcf'));}var _0x3c4f4b=this[_0xa885('0x19')][_0xa885('0xbc')](this,_0x261673[_0xa885('0xd0')]);if(!_0x3c4f4b){return this[_0xa885('0xe')]['error'](_0x261673,_0xa885('0xd1'));}if(!this[_0xa885('0x86')](_0x261673[_0xa885('0x2d')])){return this[_0xa885('0xe')]['error'](_0x261673,_0xa885('0xd2'));}var _0x38f2a7=_0x261673[_0xa885('0x2d')][_0xa885('0x58')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xd3'),_0x38f2a7));var _0x5de8ce=this['getQueryOdbc'][_0xa885('0xbc')](this,_0x3c4f4b,_0x38f2a7);this[_0xa885('0x36')]['sync'](this,_0x261673,_0x38f2a7);if(!this['isConfigured'](_0x261673[_0xa885('0xd4')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xd5'));}var _0x1b88e9=this[_0xa885('0x12')][_0xa885('0xbc')](this,_0x261673['variable_id']);if(!_0x1b88e9){return this[_0xa885('0xe')][_0xa885('0x32')](_0x261673,_0xa885('0xd6'));}var _0x2cc267=this;_0x5de8ce[_0xa885('0xd7')](function(_0x20b580,_0xbf3b76){Object[_0xa885('0xd8')](_0x20b580)[_0xa885('0xd7')](function(_0x53d7cd){_0x2cc267['channel'][_0xa885('0xa1')](util[_0xa885('0x28')](_0xa885('0xd9'),_0x1b88e9,_0xbf3b76,_0x53d7cd),_0x20b580[_0x53d7cd]);});});this['channel'][_0xa885('0xa1')](util['format'](_0xa885('0xda'),_0x1b88e9),_0x5de8ce['length']);return this[_0xa885('0xe')]['noop'](util[_0xa885('0x28')](_0xa885('0xdb'),_0x1b88e9));};AGIVertices[_0xa885('0x11')][_0xa885('0xdc')]=function(_0x1bfb49){logger[_0xa885('0xdd')](util[_0xa885('0x28')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x1bfb49[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x1bfb49['sip_id'])){return this['channel'][_0xa885('0x32')](_0x1bfb49,_0xa885('0xde'));}var _0x47b3bc=this['getUser'][_0xa885('0xbc')](this,_0x1bfb49[_0xa885('0xdf')]);if(!_0x47b3bc){return this['channel'][_0xa885('0x32')](_0x1bfb49,_0xa885('0xe0'));}var _0x33e5dc=this['channel']['exec']('DIAL',[util[_0xa885('0x28')](_0xa885('0xe1'),_0x47b3bc),_0x1bfb49[_0xa885('0x67')],_0x1bfb49[_0xa885('0xe2')],_0x1bfb49['url']]);if(_0x33e5dc[_0xa885('0xa5')]===-0x1){return _0x33e5dc;}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xe3'),'DIAL'));};AGIVertices[_0xa885('0x11')][_0xa885('0xe4')]=function(_0x41da7f){logger['info'](util[_0xa885('0x28')](_0xa885('0xe5'),_0x41da7f[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x41da7f['key'])){return this['channel'][_0xa885('0xaa')](_0xa885('0xe6'));}if(!this[_0xa885('0x86')](_0x41da7f[_0xa885('0x5b')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xab'));}this[_0xa885('0xe')]['bot']=!![];this[_0xa885('0x36')](_0x41da7f);this[_0xa885('0x41')](_0x41da7f['text'],'in','','');this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('Trying\x20Dialogflow:\x20%s',_0x41da7f[_0xa885('0x5b')]));var _0x41a9d9=this[_0xa885('0x78')]['sync'](this,_0x41da7f);if(_0x41a9d9){for(var _0x1543e7 in _0x41a9d9){if(_0x41a9d9['hasOwnProperty'](_0x1543e7)){this['channel'][_0xa885('0xa1')](util[_0xa885('0x28')](_0xa885('0xe7'),_0x1543e7[_0xa885('0x6a')]()),_0x41a9d9[_0x1543e7]);}}this[_0xa885('0x41')](_0x41a9d9[_0xa885('0xe8')],_0xa885('0xe9'),_0xa885('0xe4'),'');return this[_0xa885('0xe')]['noop'](util[_0xa885('0x28')](_0xa885('0xea'),_0x41a9d9['speech']));}return this[_0xa885('0xe')][_0xa885('0x32')](_0x41da7f,_0xa885('0xeb'));};AGIVertices[_0xa885('0x11')][_0xa885('0xec')]=function(_0x163c7e){logger['info'](util[_0xa885('0x28')](_0xa885('0xed'),_0x163c7e['label']));if(!this['isConfigured'](_0x163c7e[_0xa885('0x7c')])){return this[_0xa885('0xe')]['noop']('no\x20project_id\x20configured');}if(!this[_0xa885('0x86')](_0x163c7e['client_email'])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xee'));}if(!this[_0xa885('0x86')](_0x163c7e[_0xa885('0x7e')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xef'));}if(!this[_0xa885('0x86')](_0x163c7e[_0xa885('0x7f')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xf0'));}if(!this[_0xa885('0x86')](_0x163c7e[_0xa885('0x5b')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xab'));}this[_0xa885('0xe')][_0xa885('0xf1')]=!![];this[_0xa885('0x36')](_0x163c7e);this['createSquareMessage'](_0x163c7e[_0xa885('0x5b')],'in','','');this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xf2'),_0x163c7e['text']));var _0x10a6ad=this[_0xa885('0x7b')][_0xa885('0xbc')](this,_0x163c7e);if(_0x10a6ad){for(var _0xc2242e in _0x10a6ad){if(_0x10a6ad[_0xa885('0x97')](_0xc2242e)){if(_0xc2242e!==_0xa885('0xf3')){this[_0xa885('0xe')]['setVariable'](util[_0xa885('0x28')](_0xa885('0xe7'),_0xc2242e[_0xa885('0x6a')]()),_0x10a6ad[_0xc2242e]);}}}this['createSquareMessage'](_0x10a6ad[_0xa885('0xe8')],_0xa885('0xe9'),'dialogflowV2',_0x10a6ad[_0xa885('0xf3')]);return this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xf4'),_0x10a6ad[_0xa885('0xe8')]));}return this[_0xa885('0xe')][_0xa885('0x32')](_0x163c7e,_0xa885('0xf5'));};AGIVertices[_0xa885('0x11')]['sesteknda']=function(_0x353284){logger[_0xa885('0x2e')](util['format'](_0xa885('0xf6'),_0x353284[_0xa885('0x38')]));if(!this['isConfigured'](_0x353284[_0xa885('0xf7')])){return this[_0xa885('0xe')]['noop'](_0xa885('0xf8'));}if(!this[_0xa885('0x86')](_0x353284[_0xa885('0xf9')])){return this[_0xa885('0xe')][_0xa885('0xaa')]('no\x20username\x20configured');}if(!this[_0xa885('0x86')](_0x353284['password'])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xfa'));}if(!this[_0xa885('0x86')](_0x353284[_0xa885('0xfb')])){return this['channel'][_0xa885('0xaa')](_0xa885('0xab'));}this[_0xa885('0xe')][_0xa885('0xf1')]=!![];this[_0xa885('0x36')](_0x353284);this[_0xa885('0x41')](_0x353284[_0xa885('0x5b')],'in','','');this[_0xa885('0xe')][_0xa885('0xaa')](util['format'](_0xa885('0xfc'),_0x353284['text']));var _0x179430=this[_0xa885('0x80')][_0xa885('0xbc')](this,_0x353284);if(_0x179430){for(var _0x439c48 in _0x179430){if(_0x179430[_0xa885('0x97')](_0x439c48)){this[_0xa885('0xe')]['setVariable'](util['format'](_0xa885('0xfd'),_0x439c48[_0xa885('0x6a')]()),_0x179430[_0x439c48]);}}this[_0xa885('0x41')](_0x179430[_0xa885('0xe8')],_0xa885('0xe9'),_0xa885('0xfe'),'');if(_0x179430[_0xa885('0xff')]){this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x179430[_0xa885('0xff')]));var _0x1fd0e4=this['channel'][_0xa885('0x100')](_0x179430['audiofile']);try{fs[_0xa885('0x101')](_0x179430[_0xa885('0xff')]+'.wav');}catch(_0x2128f6){logger[_0xa885('0x32')](_0x2128f6);}return _0x1fd0e4;}else{return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x102'),_0x179430[_0xa885('0xe8')]));}}return this[_0xa885('0xe')][_0xa885('0x32')](_0x353284,_0xa885('0x103'));};AGIVertices[_0xa885('0x11')]['end']=function(_0x2f91cc){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x104'),_0x2f91cc[_0xa885('0x38')]));return this['channel'][_0xa885('0xaa')]('end');};AGIVertices[_0xa885('0x11')]['ext_dial']=function(_0x482fc1){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x105'),_0x482fc1[_0xa885('0x38')]));var _0x45fcfd='';if(_0x482fc1[_0xa885('0x106')]){if(!this[_0xa885('0x86')](_0x482fc1['trunk_id'])){return this['channel'][_0xa885('0x32')](_0x482fc1,_0xa885('0x107'));}else{var _0x4ef239=parseInt(_0x482fc1[_0xa885('0x106')],0xa);if(isNaN(_0x4ef239)){_0x45fcfd=_0x482fc1[_0xa885('0x106')];}else{_0x45fcfd=this['getTrunk'][_0xa885('0xbc')](this,_0x482fc1['trunk_id']);if(!_0x45fcfd){return this[_0xa885('0xe')][_0xa885('0x32')](_0x482fc1,'no\x20trunk\x20found');}}}}else if(_0x482fc1[_0xa885('0x108')]){_0x45fcfd=_0x482fc1[_0xa885('0x108')];}else{return this[_0xa885('0xe')][_0xa885('0x32')](_0x482fc1,'no\x20trunk\x20selected');}var _0x4fd90a=this[_0xa885('0xe')][_0xa885('0x56')]('DIAL',[util[_0xa885('0x28')]('SIP/%s/%s',_0x45fcfd,_0x482fc1['phone']),_0x482fc1[_0xa885('0x67')],_0x482fc1[_0xa885('0xe2')],_0x482fc1[_0xa885('0x64')]]);if(_0x4fd90a['result']===-0x1){return _0x4fd90a;}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xe3'),_0xa885('0x109')));};AGIVertices[_0xa885('0x11')][_0xa885('0x10a')]=function(_0x1a9544){logger[_0xa885('0x2e')](util['format'](_0xa885('0x10b'),_0x1a9544[_0xa885('0x38')]));return this['channel'][_0xa885('0xaa')]('finally');};AGIVertices[_0xa885('0x11')][_0xa885('0x10c')]=function(_0x9c2cba){logger['info'](util[_0xa885('0x28')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x9c2cba[_0xa885('0x38')]));if(_0x9c2cba[_0xa885('0xa8')]===0x0){return this[_0xa885('0xa7')](_0x9c2cba);}_0x9c2cba[_0xa885('0xa8')]-=0x1;if(!this[_0xa885('0x86')](_0x9c2cba['file_id'])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x9c2cba,_0xa885('0x10d'));}var _0x150c2e=this[_0xa885('0x1e')][_0xa885('0xbc')](this,_0x9c2cba[_0xa885('0x10e')]);if(!_0x150c2e){return this['channel']['error'](_0x9c2cba,_0xa885('0x10f'));}if(!this[_0xa885('0x86')](_0x9c2cba['variable_id'])){return this[_0xa885('0xe')][_0xa885('0x32')](_0xa885('0xd5'));}var _0x340206=this['channel'][_0xa885('0x110')](_0x150c2e,_0x9c2cba['response'],_0x9c2cba[_0xa885('0x111')]);var _0xfb4761=_0x340206[_0xa885('0xa5')]?_0x340206['result'][_0xa885('0x4c')]():'';logger[_0xa885('0x2e')](_0xa885('0x112'),JSON['stringify'](_0x340206));if(_0x340206[_0xa885('0xa5')]===-0x1){this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x9c2cba,_0xfb4761);return _0x340206;}else if(_0x340206['extra']===_0xa885('0x67')){_0x340206[_0xa885('0xa5')]=_0xfb4761[_0xa885('0x9d')]>=parseInt(_0x9c2cba['mindigit'])?'x':'i';}else{_0x340206[_0xa885('0xa5')]=_0xfb4761[_0xa885('0x9d')]>=parseInt(_0x9c2cba['mindigit'])&&_0xfb4761[_0xa885('0x9d')]<=parseInt(_0x9c2cba[_0xa885('0x111')])?'x':'i';}var _0x47c35b=this[_0xa885('0x12')][_0xa885('0xbc')](this,_0x9c2cba[_0xa885('0xd4')]);if(!_0x47c35b){return this[_0xa885('0xe')][_0xa885('0x32')](_0x9c2cba,'no\x20variable\x20found');}this[_0xa885('0xe')]['setVariable'](_0x47c35b,_0xfb4761);if(this[_0xa885('0x86')](_0x9c2cba[_0xa885('0x113')])){var _0x5450ab=parseInt(_0x9c2cba['hiddendigitsnum'],0xa);var _0x13d60d=rs[_0xa885('0x114')]({'charset':'*','length':_0x5450ab});var _0xd72c6a=_0xfb4761[_0xa885('0x9d')];if(_0xd72c6a>0x0){if(_0xd72c6a>_0x5450ab){this[_0xa885('0x36')]['sync'](this,_0x9c2cba,_0x9c2cba[_0xa885('0x115')]==='first'?_0x13d60d+_0xfb4761[_0xa885('0x116')](_0x5450ab):_0xfb4761[_0xa885('0x116')](0x0,_0xd72c6a-_0x5450ab)+_0x13d60d);}else{this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x9c2cba,rs[_0xa885('0x114')]({'charset':'*','length':_0xd72c6a}));}}else{this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x9c2cba,'');}}else{this['createSquareDetailsReport'][_0xa885('0xbc')](this,_0x9c2cba,_0xfb4761);}return _0x340206;};AGIVertices[_0xa885('0x11')][_0xa885('0xd')]=function(_0x554539){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x117'),_0x554539[_0xa885('0x38')]));return this[_0xa885('0x10c')](_0x554539);};AGIVertices[_0xa885('0x11')][_0xa885('0x118')]=function(_0x24fb3c){logger['info'](util[_0xa885('0x28')](_0xa885('0x119'),_0x24fb3c[_0xa885('0x38')]));this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x24fb3c,_0x24fb3c['goalname']);return this[_0xa885('0xe')][_0xa885('0xaa')](util['format'](_0xa885('0x11a'),_0x24fb3c[_0xa885('0x11b')]));};AGIVertices[_0xa885('0x11')][_0xa885('0x11c')]=function(_0x326213){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x11d'),_0x326213['label']));if(!this[_0xa885('0x86')](_0x326213[_0xa885('0x89')])||!this[_0xa885('0x86')](_0x326213[_0xa885('0x8f')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0x11e'));}if(!this['isConfigured'](_0x326213['text'])){return this['channel'][_0xa885('0xaa')]('no\x20text\x20configured');}this[_0xa885('0xe')][_0xa885('0xaa')](util['format'](_0xa885('0x11f'),_0x326213[_0xa885('0x5b')]));var _0x1f96c9=this['awsPolly']['sync'](this,_0x326213);if(_0x1f96c9){this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0x1f96c9));var _0x439113=this[_0xa885('0xe')][_0xa885('0x100')](_0x1f96c9);try{fs['unlink'](_0x1f96c9+_0xa885('0x120'));}catch(_0x194401){logger['error'](_0x194401);}return _0x439113;}return this[_0xa885('0xe')][_0xa885('0x32')](_0x326213,_0xa885('0x121'));};AGIVertices[_0xa885('0x11')]['awslex']=function(_0x226b6e){logger['info'](util[_0xa885('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x226b6e[_0xa885('0x38')]));if(!this['isConfigured'](_0x226b6e[_0xa885('0x89')])||!this[_0xa885('0x86')](_0x226b6e[_0xa885('0x8f')])){return this[_0xa885('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x226b6e[_0xa885('0x90')])){return this[_0xa885('0xe')]['noop'](_0xa885('0x122'));}if(!this[_0xa885('0x86')](_0x226b6e[_0xa885('0x5b')])){return this[_0xa885('0xe')]['noop'](_0xa885('0xab'));}this[_0xa885('0xe')][_0xa885('0xf1')]=!![];this[_0xa885('0x36')](_0x226b6e);this[_0xa885('0x41')](_0x226b6e[_0xa885('0x5b')],'in','','');this[_0xa885('0xe')]['noop'](util['format'](_0xa885('0x123'),_0x226b6e[_0xa885('0x5b')]));var _0x2cd69b=this['awsLex'][_0xa885('0xbc')](this,_0x226b6e);if(_0x2cd69b){for(var _0x2db613 in _0x2cd69b){if(_0x2cd69b[_0xa885('0x97')](_0x2db613)&&_[_0xa885('0x98')](_0x2cd69b[_0x2db613])){this['channel'][_0xa885('0xa1')](util[_0xa885('0x28')](_0xa885('0x124'),_0x2db613[_0xa885('0x6a')]()),_0x2cd69b[_0x2db613]);}}if(_['isNil'](_0x2cd69b[_0xa885('0x75')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0x125'));}else{this[_0xa885('0x41')](_0x2cd69b[_0xa885('0x75')],'out',_0xa885('0x126'),'');return this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x127'),_0x2cd69b[_0xa885('0x75')]));}}return this[_0xa885('0xe')][_0xa885('0x32')](_0x226b6e,_0xa885('0x128'));};AGIVertices[_0xa885('0x11')][_0xa885('0x129')]=function(_0x5931f3){logger[_0xa885('0x2e')](util['format'](_0xa885('0x12a'),_0x5931f3[_0xa885('0x38')],_0x5931f3[_0xa885('0x67')]));if(!this[_0xa885('0x86')](_0x5931f3[_0xa885('0x79')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xe6'));}var _0x4a319d=_0xa885('0x12b');var _0xc92468=util[_0xa885('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0xa885('0x114')](0x4));var _0x169b34=util[_0xa885('0x28')](_0xa885('0xa0'),_0xc92468,_0x4a319d);var _0x207855=!![];if(_0x5931f3[_0xa885('0x12c')]===_0xa885('0x12d')){_0x207855=![];}var _0x302950=this[_0xa885('0xe')]['recordFile'](_0xc92468,_0x4a319d,_0x5931f3['intKey'],_0x5931f3['timeout'],undefined,_0x207855);if(_0x302950[_0xa885('0xa5')]!==-0x1){this[_0xa885('0xe')]['noop'](util[_0xa885('0x28')](_0xa885('0x12e'),_0x169b34));var _0x218f90=this['googleASR'][_0xa885('0xbc')](this,_0x5931f3,_0x169b34);if(_0x218f90){for(var _0x4bb25e in _0x218f90){if(_0x218f90[_0xa885('0x97')](_0x4bb25e)){this['channel']['setVariable'](util[_0xa885('0x28')](_0xa885('0x12f'),_0x4bb25e['toUpperCase']()),_0x218f90[_0x4bb25e]);}}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x130'),JSON[_0xa885('0x72')](_0x218f90)));}}return _0x302950;};AGIVertices[_0xa885('0x11')][_0xa885('0x131')]=function(_0x1ed1bb){logger['info'](util[_0xa885('0x28')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x1ed1bb['label']));if(!this[_0xa885('0x86')](_0x1ed1bb[_0xa885('0x132')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0x133'));}if(!this[_0xa885('0x86')](_0x1ed1bb[_0xa885('0x94')])){return this['channel']['noop'](_0xa885('0x134'));}var _0x2014ae=_0xa885('0x12b');var _0x400d9d=util[_0xa885('0x28')](_0xa885('0x135'),FILES_PATH,rs['generate'](0x4));var _0x56c0b2=util[_0xa885('0x28')](_0xa885('0xa0'),_0x400d9d,_0x2014ae);var _0x2a2464=!![];if(_0x1ed1bb[_0xa885('0x12c')]===_0xa885('0x12d')){_0x2a2464=![];}var _0x311bff=this[_0xa885('0xe')][_0xa885('0x136')](_0x400d9d,_0x2014ae,_0x1ed1bb[_0xa885('0x137')],_0x1ed1bb['timeout'],undefined,_0x2a2464);if(_0x311bff[_0xa885('0xa5')]!==-0x1){this['channel']['noop'](util['format'](_0xa885('0x138'),_0x56c0b2));var _0x3defe3=this[_0xa885('0x93')][_0xa885('0xbc')](this,_0x1ed1bb,_0x56c0b2);if(_0x3defe3){for(var _0x3851ed in _0x3defe3){if(_0x3defe3[_0xa885('0x97')](_0x3851ed)){this[_0xa885('0xe')][_0xa885('0xa1')](util[_0xa885('0x28')](_0xa885('0x139'),_0x3851ed[_0xa885('0x6a')]()),_0x3defe3[_0x3851ed]);}}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x13a'),JSON[_0xa885('0x72')](_0x3defe3)));}}return _0x311bff;};AGIVertices[_0xa885('0x11')][_0xa885('0x13b')]=function(_0x1578bd){logger[_0xa885('0x2e')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x1578bd['label']));return this['channel'][_0xa885('0x13c')](_0x1578bd[_0xa885('0x13d')],_0x1578bd['extension'],_0x1578bd[_0xa885('0x13e')]);};AGIVertices[_0xa885('0x11')][_0xa885('0x13f')]=function(_0x433aea){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x140'),_0x433aea[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x433aea['condition'])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x433aea,_0xa885('0x141'));}try{var _0x450c36=eval(_0x433aea['condition'])?_0xa885('0x142'):_0xa885('0x143');this['channel'][_0xa885('0xaa')](util['format'](_0xa885('0x144'),_0x433aea[_0xa885('0x145')],_0x450c36));return{'code':0xc8,'result':_0x450c36};}catch(_0x47bacc){return{'code':0xc8,'result':_0xa885('0x143')};}};AGIVertices[_0xa885('0x11')][_0xa885('0x146')]=function(_0x164651){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x147'),_0x164651['label']));if(!this[_0xa885('0x86')](_0x164651['interval_id'])){return this['channel']['error'](_0x164651,_0xa885('0x148'));}var _0x576d4e=this[_0xa885('0x22')][_0xa885('0xbc')](this,_0x164651['interval_id']);if(!_0x576d4e){return this[_0xa885('0xe')]['error'](_0x164651,'no\x20intervals\x20found');}for(var _0x5f5561=0x0;_0x5f5561<_0x576d4e[_0xa885('0x9d')];_0x5f5561+=0x1){var _0x1869b1=this[_0xa885('0xe')][_0xa885('0x12')](util[_0xa885('0x28')](_0xa885('0x149'),_0x576d4e[_0x5f5561]));if(_0x1869b1['result']===-0x1){return _0x1869b1;}logger['info'](util['format'](_0xa885('0x14a'),_0x576d4e[_0x5f5561],_0x1869b1['extra']));if(_0x1869b1[_0xa885('0xa6')]===_0xa885('0x142')){logger[_0xa885('0x2e')](util['format'](_0xa885('0x14a'),_0x576d4e[_0x5f5561],_0xa885('0x142')));this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('IFTIME\x20%s\x20%s',_0x576d4e[_0x5f5561],_0xa885('0x142')));return{'code':0xc8,'result':_0xa885('0x142')};}else{logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x14a'),_0x576d4e[_0x5f5561],'false'));this[_0xa885('0xe')]['noop'](util[_0xa885('0x28')]('IFTIME\x20%s\x20%s',_0x576d4e[_0x5f5561],_0xa885('0x143')));}}return{'code':0xc8,'result':_0xa885('0x143')};};AGIVertices[_0xa885('0x11')]['hangup']=function(_0xa0e024){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0xa0e024[_0xa885('0x38')]));return this['channel']['hangup']();};AGIVertices['prototype']['ispeechasr']=function(_0x3e9ae9){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x14b'),_0x3e9ae9[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x3e9ae9[_0xa885('0x79')])){return this['channel']['noop'](_0xa885('0xe6'));}var _0x5dae57=_0xa885('0x12b');var _0x11b6cd=util['format'](_0xa885('0x135'),FILES_PATH,rs[_0xa885('0x114')](0x4));var _0x3372a0=util[_0xa885('0x28')](_0xa885('0xa0'),_0x11b6cd,_0x5dae57);var _0x4d21ac=!![];if(_0x3e9ae9[_0xa885('0x12c')]===_0xa885('0x12d')){_0x4d21ac=![];}var _0x39539d=this[_0xa885('0xe')]['recordFile'](_0x11b6cd,_0x5dae57,_0x3e9ae9[_0xa885('0x137')],_0x3e9ae9[_0xa885('0x67')],undefined,_0x4d21ac);if(_0x39539d['result']!==-0x1){this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x14c'),_0x3372a0));var _0x1b3c66=this[_0xa885('0x84')]['sync'](this,_0x3e9ae9,_0x3372a0);if(_0x1b3c66){for(var _0x120d96 in _0x1b3c66){if(_0x1b3c66[_0xa885('0x97')](_0x120d96)){this['channel'][_0xa885('0xa1')](util[_0xa885('0x28')](_0xa885('0x14d'),_0x120d96[_0xa885('0x6a')]()),_0x1b3c66[_0x120d96]);}}return this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x14e'),JSON[_0xa885('0x72')](_0x1b3c66)));}}return _0x39539d;};AGIVertices['prototype']['ispeechtts']=function(_0x1fadfe){logger['info'](util[_0xa885('0x28')](_0xa885('0x14f'),_0x1fadfe[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x1fadfe['key'])){return this[_0xa885('0xe')][_0xa885('0xaa')]('no\x20key\x20configured');}if(!this[_0xa885('0x86')](_0x1fadfe['text'])){return this[_0xa885('0xe')]['noop'](_0xa885('0xab'));}this[_0xa885('0xe')]['noop'](util['format'](_0xa885('0x150'),_0x1fadfe[_0xa885('0x5b')]));var _0x35f504=this[_0xa885('0x81')][_0xa885('0xbc')](this,_0x1fadfe);if(_0x35f504){this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x14c'),_0x35f504));var _0x49a98f=this['channel'][_0xa885('0x100')](_0x35f504,_0x1fadfe['intKey']);try{fs['unlink'](_0x35f504+_0xa885('0x120'));}catch(_0x25f341){logger[_0xa885('0x32')](_0x25f341);}return _0x49a98f;}return this[_0xa885('0xe')][_0xa885('0x32')](_0x1fadfe,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xa885('0x11')]['login']=function(_0x223916){logger['info'](util[_0xa885('0x28')](_0xa885('0x151'),_0x223916[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x223916[_0xa885('0x152')])){return this['channel'][_0xa885('0x32')](_0x223916,'no\x20find\x20by\x20configured');}logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x153'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x223916['findBy']));var _0x55440b=this[_0xa885('0x53')]['sync'](this,_0x223916[_0xa885('0x152')]);if(_0x55440b){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa885('0xe')][_0xa885('0x3c')],_0x223916['findBy']));this[_0xa885('0xe')][_0xa885('0xaa')](util['format'](_0xa885('0x154'),this['channel'][_0xa885('0x3c')],_0x223916[_0xa885('0x152')]));return{'code':0xc8,'result':_0xa885('0x155')};}else{logger['info'](util[_0xa885('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa885('0xe')][_0xa885('0x3c')],_0x223916['findBy']));this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x156'),this['channel']['callerid'],_0x223916[_0xa885('0x152')]));return{'code':0xc8,'result':_0xa885('0x157')};}};AGIVertices[_0xa885('0x11')][_0xa885('0x158')]=function(_0x376a9e){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x159'),_0x376a9e[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x376a9e[_0xa885('0x152')])){return this['channel']['error'](_0x376a9e,_0xa885('0x15a'));}logger['info'](util[_0xa885('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa885('0xe')][_0xa885('0x3c')],_0x376a9e[_0xa885('0x152')]));var _0x4d3474=this[_0xa885('0x52')]['sync'](this,_0x376a9e[_0xa885('0x152')]);if(_0x4d3474){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x154'),this['channel'][_0xa885('0x3c')],_0x376a9e[_0xa885('0x152')]));this[_0xa885('0xe')]['noop'](util[_0xa885('0x28')](_0xa885('0x154'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x376a9e[_0xa885('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa885('0x2e')](util[_0xa885('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa885('0xe')][_0xa885('0x3c')],_0x376a9e[_0xa885('0x152')]));this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x156'),this[_0xa885('0xe')]['callerid'],_0x376a9e[_0xa885('0x152')]));return{'code':0xc8,'result':_0xa885('0x157')};}};AGIVertices[_0xa885('0x11')][_0xa885('0x15b')]=function(_0x4fddc4){logger['info'](util[_0xa885('0x28')](_0xa885('0x15c'),_0x4fddc4['label']));if(!this['isConfigured'](_0x4fddc4[_0xa885('0x15d')])){return this['channel'][_0xa885('0x32')](_0x4fddc4,_0xa885('0x15e'));}this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x15f'),_0x4fddc4['operation']));var _0xce578b=eval(_0x4fddc4[_0xa885('0x15d')]);if(!this[_0xa885('0x86')](_0x4fddc4[_0xa885('0xd4')])){return this['channel'][_0xa885('0xaa')](_0xa885('0xd5'));}var _0x3c95f9=this[_0xa885('0x12')][_0xa885('0xbc')](this,_0x4fddc4['variable_id']);if(!_0x3c95f9){return this['channel'][_0xa885('0x32')](_0x4fddc4,'no\x20variable\x20found');}if(_[_0xa885('0x9c')](_0xce578b)){var _0x45143a=this;_0xce578b[_0xa885('0xd7')](function(_0xc825d4,_0x2e2775){_0x45143a[_0xa885('0xe')]['setVariable'](util[_0xa885('0x28')](_0xa885('0x160'),_0x3c95f9,_0x2e2775),_0xc825d4);});return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x161'),_0x3c95f9));}else{return this['channel'][_0xa885('0xa1')](_0x3c95f9,_0xce578b);}};AGIVertices[_0xa885('0x11')][_0xa885('0xc')]=function(_0x19332c){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x162'),_0x19332c['label']));if(_0x19332c[_0xa885('0xa8')]===0x0){return this[_0xa885('0xa7')](_0x19332c);}_0x19332c[_0xa885('0xa8')]-=0x1;if(!this[_0xa885('0x86')](_0x19332c[_0xa885('0x10e')])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x19332c,_0xa885('0x10d'));}var _0x204939=this['getSound']['sync'](this,_0x19332c[_0xa885('0x10e')]);if(!_0x204939){return this[_0xa885('0xe')][_0xa885('0x32')](_0x19332c,_0xa885('0x10f'));}var _0x3d34ae=this[_0xa885('0xe')][_0xa885('0x110')](_0x204939,_0x19332c[_0xa885('0x163')],_0x19332c[_0xa885('0x164')]);var _0x36b7e4=_0x3d34ae[_0xa885('0xa5')];if(_0x3d34ae['result']===-0x1){this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x19332c,'-1');return _0x3d34ae;}else if(_0x3d34ae[_0xa885('0xa6')]===_0xa885('0x67')){_0x3d34ae['result']=_0x3d34ae[_0xa885('0xa5')][_0xa885('0x9d')]>0x0?_0x3d34ae[_0xa885('0xa5')]:'t';}else if(_['isEmpty'](_0x3d34ae[_0xa885('0xa5')])){_0x3d34ae[_0xa885('0xa5')]='#';_0x36b7e4='#';}if(!this[_0xa885('0x86')](_0x19332c[_0xa885('0xd4')])){this['channel'][_0xa885('0xaa')](_0xa885('0xd5'));}else{var _0x134098=this[_0xa885('0x12')][_0xa885('0xbc')](this,_0x19332c[_0xa885('0xd4')]);if(!_0x134098){return this[_0xa885('0xe')][_0xa885('0x32')](_0x19332c,'no\x20variable\x20found');}this[_0xa885('0xe')][_0xa885('0xa1')](_0x134098,_0x36b7e4);}this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x19332c,_0x36b7e4);return _0x3d34ae;};AGIVertices['prototype'][_0xa885('0xaa')]=function(_0xd6fac2){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0xd6fac2['label']));return this[_0xa885('0xe')][_0xa885('0xaa')](_0xd6fac2[_0xa885('0x165')]||_0xd6fac2[_0xa885('0x38')]);};AGIVertices[_0xa885('0x11')][_0xa885('0x166')]=function(_0x206881){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x167'),_0x206881[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x206881[_0xa885('0x152')])){return this[_0xa885('0xe')]['error'](_0x206881,_0xa885('0x15a'));}logger[_0xa885('0x2e')](util['format'](_0xa885('0x153'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x206881['findBy']));var _0x584e1e=this['getPause'][_0xa885('0xbc')](this,_0x206881[_0xa885('0x168')]);var _0x3efcba=this[_0xa885('0x4f')]['sync'](this,_0x206881[_0xa885('0x152')],_0x584e1e);if(_0x3efcba){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x154'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x206881[_0xa885('0x152')]));this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x154'),this['channel']['callerid'],_0x206881[_0xa885('0x152')]));return{'code':0xc8,'result':_0xa885('0x155')};}else{logger['info'](util[_0xa885('0x28')](_0xa885('0x156'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x206881[_0xa885('0x152')]));this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x154'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x206881[_0xa885('0x152')]));return{'code':0xc8,'result':_0xa885('0x157')};}};AGIVertices[_0xa885('0x11')][_0xa885('0x169')]=function(_0x228210){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x16a'),_0x228210[_0xa885('0x38')]));if(!this['isConfigured'](_0x228210[_0xa885('0x10e')])){return this['channel'][_0xa885('0x32')](_0x228210,'no\x20file\x20audio\x20selected');}var _0x13fcc4=this[_0xa885('0x1e')][_0xa885('0xbc')](this,_0x228210['file_id']);if(!_0x13fcc4){return this['channel']['error'](_0x228210,_0xa885('0x10f'));}var _0x3791a9=this[_0xa885('0xe')]['exec']('PLAYBACK',[_0x13fcc4,_0x228210[_0xa885('0xe2')]]);if(_0x3791a9[_0xa885('0xa5')]===-0x1){return _0x3791a9;}return this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x13fcc4));};AGIVertices[_0xa885('0x11')][_0xa885('0x16b')]=function(_0x597325){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x16c'),_0x597325[_0xa885('0x38')]));if(!this['isConfigured'](_0x597325[_0xa885('0x16d')])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x597325,'no\x20queue\x20selected');}var _0x48d2ff='';var _0x175aee=parseInt(_0x597325['queue_id'],0xa);if(isNaN(_0x175aee)){_0x48d2ff=_0x597325['queue_id'];}else{_0x48d2ff=this[_0xa885('0x16e')]['sync'](this,_0x597325[_0xa885('0x16d')]);if(!_0x48d2ff){return this[_0xa885('0xe')][_0xa885('0x32')](_0x597325,'no\x20queue\x20found');}}var _0x5642dc='';if(this[_0xa885('0x86')](_0x597325[_0xa885('0x10e')])){var _0x24ac56=this[_0xa885('0x1e')][_0xa885('0xbc')](this,_0x597325[_0xa885('0x10e')]);if(_0x24ac56){_0x5642dc=_0x24ac56;}}this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x597325,_0x48d2ff);if(_0x597325[_0xa885('0xe2')][_0xa885('0x16f')]('x')<0x0){_0x597325[_0xa885('0xe2')]+='x';}if(_0x597325['opts']['indexOf']('X')<0x0){_0x597325['opts']+='X';}this[_0xa885('0xe')]['setVariable']('XMCS-QUEUE',_0x48d2ff?_0x48d2ff[_0xa885('0x170')]():'');var _0x524465=this[_0xa885('0xe')][_0xa885('0x56')]('QUEUE',[_0x48d2ff,_0x597325[_0xa885('0xe2')],_0x597325['url'],_0x5642dc,_0x597325['timeout'],_0x597325['agi'],_0x597325[_0xa885('0x171')],_0x597325[_0xa885('0x172')],'',_0x597325[_0xa885('0x173')]]);if(_0x524465[_0xa885('0xa5')]===-0x1){return _0x524465;}return this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xbf'),_0xa885('0x174'),_0x48d2ff));};AGIVertices[_0xa885('0x11')]['record']=function(_0x16d6fd){logger[_0xa885('0x2e')](util['format'](_0xa885('0x175'),_0x16d6fd[_0xa885('0x38')]));var _0x4ce84f=_0x16d6fd[_0xa885('0x176')]||_0xa885('0x12b');var _0x30fb34=util[_0xa885('0x28')]('%s_%s',this[_0xa885('0xe')][_0xa885('0x37')],rs[_0xa885('0x114')](0x5));var _0x14bca3=util[_0xa885('0x28')](_0xa885('0x177'),FILES_PATH,_0x30fb34,_0x4ce84f);var _0x19e05a=util[_0xa885('0x28')](_0xa885('0x135'),FILES_PATH,_0x30fb34);this[_0xa885('0x3b')]['sync'](this,_0x16d6fd,_0x30fb34,_0x14bca3);this[_0xa885('0xe')][_0xa885('0xa1')](_0xa885('0x178'),_0x30fb34);logger['info'](_0xa885('0x179'),_0x19e05a,_0x4ce84f,_0x16d6fd[_0xa885('0x17a')],_0x16d6fd[_0xa885('0x67')]);return this[_0xa885('0xe')][_0xa885('0x136')](_0x19e05a,_0x4ce84f,_0x16d6fd[_0xa885('0x17a')],_0x16d6fd[_0xa885('0x67')],undefined,!![]);};AGIVertices[_0xa885('0x11')][_0xa885('0x17b')]=function(_0x2dcfcc){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x17c'),_0x2dcfcc[_0xa885('0x38')]));if(!this['isConfigured'](_0x2dcfcc[_0xa885('0x64')])){return this[_0xa885('0xe')]['noop'](_0xa885('0x17d'));}var _0x168da3=this[_0xa885('0x63')][_0xa885('0xbc')](this,_0x2dcfcc);logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Response:',util[_0xa885('0x17e')](_0x168da3,{'showHidden':![],'depth':null})));if(!this[_0xa885('0x86')](_0x2dcfcc[_0xa885('0xd4')])){return this[_0xa885('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x262842=this[_0xa885('0x12')][_0xa885('0xbc')](this,_0x2dcfcc[_0xa885('0xd4')]);if(!_0x262842){return this[_0xa885('0xe')][_0xa885('0x32')](_0x2dcfcc,_0xa885('0xd6'));}this[_0xa885('0xe')]['setVariable'](util[_0xa885('0x28')](_0xa885('0x17f'),_0x262842),_0x168da3[_0xa885('0x73')]?_0x168da3['statusCode']:_0xa885('0x180'));this[_0xa885('0xe')][_0xa885('0xa1')](util[_0xa885('0x28')](_0xa885('0x181'),_0x262842),_0x168da3[_0xa885('0x74')]?_0x168da3[_0xa885('0x74')]:'OK');if(_0x168da3[_0xa885('0x6b')]){try{this[_0xa885('0x9f')](_0x168da3['body'],_0x262842);}catch(_0x4b31e7){logger[_0xa885('0x32')](util[_0xa885('0x28')](_0xa885('0x182'),_0x262842));}}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('variable\x20%s\x20set',_0x262842));};AGIVertices['prototype']['saydigits']=function(_0x2d19e0){logger['info'](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2d19e0[_0xa885('0x38')]));return this[_0xa885('0xe')][_0xa885('0x183')](_0x2d19e0['digits'][_0xa885('0x58')](/\s+/g,''),_0x2d19e0[_0xa885('0x17a')]);};AGIVertices[_0xa885('0x11')]['saynumber']=function(_0x32f562){logger[_0xa885('0x2e')](util['format'](_0xa885('0x184'),_0x32f562['label']));return this['channel'][_0xa885('0x185')](_0x32f562[_0xa885('0x66')]['replace'](/\s+/g,''),_0x32f562[_0xa885('0x17a')]);};AGIVertices['prototype'][_0xa885('0x186')]=function(_0x34776b){logger['info'](util[_0xa885('0x28')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x34776b[_0xa885('0x38')]));return this[_0xa885('0xe')][_0xa885('0x187')](_0x34776b[_0xa885('0x5b')],_0x34776b[_0xa885('0x17a')]);};AGIVertices[_0xa885('0x11')]['sendMail']=function(_0x11feac){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x11feac[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x11feac['account_id'])){return this[_0xa885('0xe')]['noop'](_0xa885('0x188'));}var _0x507050=this[_0xa885('0x20')][_0xa885('0xbc')](this,_0x11feac[_0xa885('0x189')]);if(!_0x507050||!_0x507050[_0xa885('0x18a')]){return this[_0xa885('0xe')][_0xa885('0x32')](_0x11feac,_0xa885('0x18b'));}var _0x2f5acb={'from':util[_0xa885('0x28')]('\x22%s\x22\x20<%s>',_0x507050[_0xa885('0x15')],_0x507050['email']||_0x507050[_0xa885('0x18a')][_0xa885('0x18c')]),'to':_0x11feac['to']||'','cc':_0x11feac['cc']||'','bcc':_0x11feac[_0xa885('0x18d')]||'','subject':_0x11feac[_0xa885('0x18e')],'html':_0x11feac[_0xa885('0x5b')],'text':_0x11feac[_0xa885('0x5b')]};if(this[_0xa885('0x86')](_0x11feac['template_id'])){}logger['debug'](_0xa885('0x18f'),JSON[_0xa885('0x72')](_0x2f5acb));this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x11feac,_0x11feac['account_id']);this[_0xa885('0xe')]['noop'](util['format'](_0xa885('0x190'),_0x507050['name']));this[_0xa885('0x21')][_0xa885('0xbc')](this,_0x507050[_0xa885('0x191')],_0x2f5acb);return this['channel'][_0xa885('0xaa')](_0xa885('0x192'));};AGIVertices['prototype'][_0xa885('0x193')]=function(_0x17f981){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x194'),_0x17f981[_0xa885('0x38')]));return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0x195'));};AGIVertices[_0xa885('0x11')][_0xa885('0x196')]=function(_0x25e0a6){logger['info'](util[_0xa885('0x28')](_0xa885('0x197'),_0x25e0a6[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x25e0a6['sms_account_id'])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0x198'));}var _0x91a816=this[_0xa885('0x199')][_0xa885('0xbc')](this,_0x25e0a6[_0xa885('0x19a')]);if(!_0x91a816){return this['channel'][_0xa885('0x32')](_0x25e0a6,_0xa885('0x19b'));}var _0x48091f={'body':_0x25e0a6[_0xa885('0x19c')],'phone':_0x25e0a6['to']||'','SmsAccountId':_0x91a816['id']};logger[_0xa885('0xdd')]('sendSMS\x20message',JSON['stringify'](_0x48091f));this[_0xa885('0x36')]['sync'](this,_0x25e0a6,_0x25e0a6['sms_account_id']);this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x19d'),_0x91a816[_0xa885('0x15')]));this[_0xa885('0x35')][_0xa885('0xbc')](this,_0x48091f);return this[_0xa885('0xe')]['noop'](_0xa885('0x19e'));};AGIVertices['prototype'][_0xa885('0x19f')]=function(_0x41d1a4){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x1a0'),_0x41d1a4['label']));if(!this[_0xa885('0x86')](_0x41d1a4[_0xa885('0xd4')])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x41d1a4,_0xa885('0x1a1'));}var _0xb72ff2=this[_0xa885('0x12')]['sync'](this,_0x41d1a4['variable_id']);if(!_0xb72ff2){return this['channel']['error'](_0x41d1a4,_0xa885('0xd6'));}return this[_0xa885('0xe')][_0xa885('0xa1')](_0xb72ff2,_0x41d1a4['variable_value']);};AGIVertices[_0xa885('0x11')][_0xa885('0x1a2')]=function(_0x1e129a){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20START\x20(%s)\x20block',_0x1e129a['label']));this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0x1a3'));var _0x506d86=this[_0xa885('0xe')][_0xa885('0x12')](_0xa885('0x1a4'));if(!_[_0xa885('0x43')](_0x506d86[_0xa885('0xa6')])){this[_0xa885('0xe')][_0xa885('0x37')]=_0x506d86['extra'];}if(_0x1e129a[_0xa885('0xb7')]===_0xa885('0x1a5')){this[_0xa885('0xe')][_0xa885('0xaa')]('Answer');return this[_0xa885('0xe')]['answer']();}return this[_0xa885('0xe')][_0xa885('0xaa')]('Skipped\x20Answer');};AGIVertices[_0xa885('0x11')]['subproject']=function(_0x90fe5c){logger['info'](util[_0xa885('0x28')](_0xa885('0x1a6'),_0x90fe5c[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x90fe5c[_0xa885('0x1a7')])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x90fe5c,_0xa885('0x1a8'));}var _0x207da6=this['getSquareProject'][_0xa885('0xbc')](this,_0x90fe5c['project_id']);if(!this[_0xa885('0x86')](_0x207da6)){return this['channel'][_0xa885('0x32')](_0x90fe5c,util[_0xa885('0x28')](_0xa885('0x1a9'),_0x90fe5c[_0xa885('0x1a7')]));}if(_0x207da6===this['channel'][_0xa885('0x3a')]){return this['channel'][_0xa885('0x32')](_0x90fe5c,_0xa885('0x1aa'));}this['createSquareDetailsReport'][_0xa885('0xbc')](this,_0x90fe5c,_0x207da6);var _0xd4477a=this['channel'][_0xa885('0x56')](_0xa885('0x1ab'),util[_0xa885('0x28')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xa885('0x7')][_0xa885('0x1ac')]||_0xa885('0x1ad'),_0x207da6,this[_0xa885('0xe')][_0xa885('0x3a')]));if(_0xd4477a[_0xa885('0xa5')]===-0x1){return _0xd4477a;}return this[_0xa885('0xe')]['noop'](util['format'](_0xa885('0xbf'),_0xa885('0x1ab'),_0x207da6));};AGIVertices['prototype'][_0xa885('0x1ae')]=function(_0x39df7){logger['info'](util[_0xa885('0x28')](_0xa885('0x1af'),_0x39df7[_0xa885('0x38')]));var _0x220638=this[_0xa885('0x1b0')][_0xa885('0xbc')](this,_0x39df7['command']);this['createSquareDetailsReport'][_0xa885('0xbc')](this,_0x39df7,_0x39df7['command']);if(this[_0xa885('0x86')](_0x39df7[_0xa885('0xd4')])){var _0x6579e9=this[_0xa885('0x12')]['sync'](this,_0x39df7[_0xa885('0xd4')]);if(_0x6579e9){this['channel'][_0xa885('0xa1')](_0x6579e9,_0x220638);return this[_0xa885('0xe')][_0xa885('0xaa')](util['format'](_0xa885('0x1b1'),_0x39df7[_0xa885('0xb5')],_0x6579e9));}}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x1b2'),_0x39df7['command']));};AGIVertices[_0xa885('0x11')]['google_cloud_tts']=function(_0x186a99){logger[_0xa885('0x2e')](util['format'](_0xa885('0x1b3'),_0x186a99[_0xa885('0x38')]));_0x186a99['text']=_0x186a99[_0xa885('0x5b')][_0xa885('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa885('0x86')](_0x186a99['apiKey'])){return this[_0xa885('0xe')]['noop'](_0xa885('0x1b4'));}if(!this[_0xa885('0x86')](_0x186a99[_0xa885('0x5b')])){return this[_0xa885('0xe')]['noop'](_0xa885('0xab'));}this[_0xa885('0xe')]['noop'](util[_0xa885('0x28')](_0xa885('0x1b5'),_0x186a99[_0xa885('0x5b')]));var _0x41c384=this['googleCloudTTS'][_0xa885('0xbc')](this,_0x186a99);if(_0x41c384){this[_0xa885('0xe')][_0xa885('0xaa')](util['format'](_0xa885('0x1b6'),_0x41c384));var _0x434059=this['channel']['streamFile'](_0x41c384);try{fs[_0xa885('0x101')](_0x41c384+'.wav');}catch(_0x5d80ea){logger[_0xa885('0x32')](_0x5d80ea);}return _0x434059;}return this[_0xa885('0xe')]['error'](_0x186a99,_0xa885('0x1b7'));};AGIVertices[_0xa885('0x11')][_0xa885('0x1b8')]=function(_0x50226d){logger['info'](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x50226d['label']));_0x50226d[_0xa885('0x5b')]=_0x50226d[_0xa885('0x5b')][_0xa885('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa885('0x86')](_0x50226d[_0xa885('0x5b')])){return this['channel'][_0xa885('0xaa')](_0xa885('0xab'));}this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x1b9'),_0x50226d[_0xa885('0x5b')]));var _0x42ae93=this[_0xa885('0x61')][_0xa885('0xbc')](this,_0x50226d);if(_0x42ae93){this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('Google\x20TTS\x20%s\x20file\x20created',_0x42ae93));var _0x13fda9=this['channel'][_0xa885('0x100')](_0x42ae93);try{fs[_0xa885('0x101')](_0x42ae93+_0xa885('0x120'));}catch(_0x3faff4){logger['error'](_0x3faff4);}return _0x13fda9;}return this[_0xa885('0xe')]['error'](_0x50226d,_0xa885('0x1ba'));};AGIVertices[_0xa885('0x11')]['unpause']=function(_0x58aaba){logger['info'](util[_0xa885('0x28')](_0xa885('0x1bb'),_0x58aaba[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x58aaba[_0xa885('0x152')])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x58aaba,_0xa885('0x15a'));}logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x153'),this['channel'][_0xa885('0x3c')],_0x58aaba[_0xa885('0x152')]));var _0x4a5ab6=this[_0xa885('0x51')][_0xa885('0xbc')](this,_0x58aaba['findBy']);if(_0x4a5ab6){logger['info'](util[_0xa885('0x28')](_0xa885('0x154'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x58aaba[_0xa885('0x152')]));this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x154'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x58aaba[_0xa885('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x156'),this[_0xa885('0xe')]['callerid'],_0x58aaba[_0xa885('0x152')]));this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa885('0xe')][_0xa885('0x3c')],_0x58aaba['findBy']));return{'code':0xc8,'result':_0xa885('0x157')};}};AGIVertices[_0xa885('0x11')][_0xa885('0x1bc')]=function(_0x218a5d){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x1bd'),_0x218a5d[_0xa885('0x38')]));var _0x4570ed=this[_0xa885('0xe')][_0xa885('0x56')]('VOICEMAIL',[_0x218a5d[_0xa885('0x1be')],_0x218a5d[_0xa885('0x77')]]);if(_0x4570ed[_0xa885('0xa5')]===-0x1){return _0x4570ed;}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xbf'),_0xa885('0x1bf'),_0x218a5d[_0xa885('0x1be')]));};AGIVertices[_0xa885('0x11')]['vswitch']=function(_0x39852c){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x1c0'),_0x39852c[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x39852c[_0xa885('0xd4')])){return this[_0xa885('0xe')]['error'](_0x39852c,_0xa885('0x1a1'));}var _0xb2a6af=this[_0xa885('0x12')][_0xa885('0xbc')](this,_0x39852c[_0xa885('0xd4')]);if(!_0xb2a6af){return this[_0xa885('0xe')][_0xa885('0x32')](_0x39852c,_0xa885('0xd6'));}var _0x59fc85=this[_0xa885('0xe')][_0xa885('0x12')](_0xb2a6af);return{'code':0xc8,'result':_0x59fc85[_0xa885('0xa6')]?_0x59fc85[_0xa885('0xa6')]:'-'};};String[_0xa885('0x11')][_0xa885('0xa3')]=function(_0x467539,_0x721d79){return this[_0xa885('0xa2')](_0x467539)[_0xa885('0x1c1')](_0x721d79);};module['exports']=AGIVertices; \ No newline at end of file +var _0x84ab=['isArray','length','saveRestApiResult','%s.%s','format','setVariable','replaceObjectAllVariables','split','replaceAll','extra','getVariable','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','getAndSetVariable','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','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','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','sip_id','no\x20user\x20selected','getUser','opts','url','DIAL','no\x20key\x20configured','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','ndauth_url','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','Executed\x20command\x20%s','finally','getdigits','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','mindigit','maxdigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','priority','gotoif','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','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','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','vswitch','join','exports','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','agi','../../config/environment','./scripts','menu','getsecretdigits','rpc','mailRpc','prototype','getVariableById','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','getIntervalById','IntervalId','interval','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','accountcode','dnid','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','phone','list_id','scheduledAt','toString','callback_priority','getPause','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','method','timeout','includes','POST','PUT','toUpperCase','body','rawBody','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','render','stringify','statusCode','statusMessage','message','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','isConfigured','model','aws_access_key_id','aws_polly_region','Amy','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clone','hasOwnProperty','replaceAllVariables','recursiveNodeIndex','isPlainObject'];(function(_0x525708,_0x27e02a){var _0xa4d64c=function(_0x4d3976){while(--_0x4d3976){_0x525708['push'](_0x525708['shift']());}};_0xa4d64c(++_0x27e02a);}(_0x84ab,0x12f));var _0xb84a=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x84ab[_0xc67528];return _0x38e26d;};'use strict';var fs=require('fs');var util=require(_0xb84a('0x0'));var _=require(_0xb84a('0x1'));var sh=require(_0xb84a('0x2'));var odbc=require(_0xb84a('0x3'))();var rs=require(_0xb84a('0x4'));var moment=require('moment');var Mustache=require(_0xb84a('0x5'));var rp=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var scripts=require(_0xb84a('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0xb84a('0xa'),'getdigits',_0xb84a('0xb')];var AGIVertices=function(_0x8d9dbe,_0x4d9321,_0x181c87){this['channel']=_0x8d9dbe;this[_0xb84a('0xc')]=_0x4d9321;this[_0xb84a('0xd')]=_0x181c87;};AGIVertices[_0xb84a('0xe')]['getVariable']=function(_0x5a34f7,_0x591de9){this[_0xb84a('0xc')][_0xb84a('0xf')](_0x5a34f7)[_0xb84a('0x10')](function(_0x35c6c5){_0x591de9(null,_0x35c6c5?_0x35c6c5[_0xb84a('0x11')]:![]);})['catch'](function(_0x83444e){_0x591de9(_0x83444e);});};AGIVertices[_0xb84a('0xe')][_0xb84a('0x12')]=function(_0x3c161c,_0x44b26b){this[_0xb84a('0xc')][_0xb84a('0x13')](_0x3c161c)[_0xb84a('0x10')](function(_0x3113a2){_0x44b26b(null,_0x3113a2?_0x3113a2[_0xb84a('0x11')]:![]);})[_0xb84a('0x14')](function(_0x1251ec){_0x44b26b(_0x1251ec);});};AGIVertices['prototype'][_0xb84a('0x15')]=function(_0x4a691d,_0xb65e5a){this[_0xb84a('0xc')][_0xb84a('0x16')](_0x4a691d)[_0xb84a('0x10')](function(_0x3b717e){_0xb65e5a(null,_0x3b717e?_0x3b717e[_0xb84a('0x11')]:![]);})[_0xb84a('0x14')](function(_0x3f7437){_0xb65e5a(_0x3f7437);});};AGIVertices[_0xb84a('0xe')][_0xb84a('0x17')]=function(_0x306d08,_0x200289){this['rpc'][_0xb84a('0x18')](_0x306d08)[_0xb84a('0x10')](function(_0x55a633){_0x200289(null,_0x55a633?_0x55a633[_0xb84a('0x19')]:![]);})[_0xb84a('0x14')](function(_0x42c788){_0x200289(_0x42c788);});};AGIVertices[_0xb84a('0xe')]['getUser']=function(_0x4ac5f8,_0x1466ae){this[_0xb84a('0xc')][_0xb84a('0x1a')](_0x4ac5f8)[_0xb84a('0x10')](function(_0x1e2fd4){_0x1466ae(null,_0x1e2fd4?_0x1e2fd4[_0xb84a('0x11')]:![]);})[_0xb84a('0x14')](function(_0x21d0d3){_0x1466ae(_0x21d0d3);});};AGIVertices[_0xb84a('0xe')][_0xb84a('0x1b')]=function(_0x10d860,_0x1aab7d){this[_0xb84a('0xc')][_0xb84a('0x1c')](_0x10d860)[_0xb84a('0x10')](function(_0x3258a9){_0x1aab7d(null,_0x3258a9?_0x3258a9[_0xb84a('0x11')]:![]);})[_0xb84a('0x14')](function(_0x3b6805){_0x1aab7d(_0x3b6805);});};AGIVertices[_0xb84a('0xe')][_0xb84a('0x1d')]=function(_0x1db72c,_0x2fe40d){var _0x35d1f7=this;this[_0xb84a('0xc')][_0xb84a('0x1e')](_0x1db72c)['then'](function(_0x582954){_0x2fe40d(null,_0x582954?_0x35d1f7[_0xb84a('0x1f')](_0x582954[_0xb84a('0x20')]):![]);})['catch'](function(_0x1f690a){_0x2fe40d(_0x1f690a);});};AGIVertices[_0xb84a('0xe')]['getMailAccount']=function(_0x4fc638,_0x28f2e7){this[_0xb84a('0xc')]['getMailAccountById'](_0x4fc638)[_0xb84a('0x10')](function(_0xba1147){_0x28f2e7(null,_0xba1147?_0xba1147:![]);})[_0xb84a('0x14')](function(_0x44a405){_0x28f2e7(_0x44a405);});};AGIVertices[_0xb84a('0xe')][_0xb84a('0x21')]=function(_0x34b212,_0xac214f,_0x54ec50){this[_0xb84a('0xd')]['sendMailMessage'](_0x34b212,_0xac214f)['then'](function(){_0x54ec50(null);})[_0xb84a('0x14')](function(_0x3b4515){_0x54ec50(_0x3b4515);});};AGIVertices['prototype']['getIntervals']=function(_0x218481,_0x13c167){this[_0xb84a('0xc')][_0xb84a('0x22')](_0x218481)[_0xb84a('0x10')](function(_0x1d7ef1){if(_0x1d7ef1){if(_0x1d7ef1[_0xb84a('0x23')]){_0x13c167(null,[_0x1d7ef1[_0xb84a('0x24')]]);}else{_0x13c167(null,_['map'](_0x1d7ef1[_0xb84a('0x25')],_0xb84a('0x24')));}}else{_0x13c167(null,![]);}})[_0xb84a('0x14')](function(_0xf894a6){_0x13c167(_0xf894a6);});};AGIVertices[_0xb84a('0xe')][_0xb84a('0x1f')]=function(_0x2a5130){return util['format'](_0xb84a('0x26'),FILES_PATH,_0x2a5130);};AGIVertices['prototype'][_0xb84a('0x27')]=function(_0xb93cca,_0x2f7e6c,_0x4d04fb){odbc['open'](_0xb93cca,function(_0x102936){if(_0x102936){logger[_0xb84a('0x28')](_0xb84a('0x29'),_0x102936);_0x4d04fb(_0x102936);}else{logger[_0xb84a('0x2a')](_0xb84a('0x2b'));odbc['query'](_0x2f7e6c,function(_0x19aa4c,_0x2d7216){if(_0x19aa4c){logger['info'](_0xb84a('0x2c'),_0x2f7e6c);_0x4d04fb(_0x19aa4c);}else{logger[_0xb84a('0x2a')](_0xb84a('0x2d'),_0x2f7e6c);odbc[_0xb84a('0x2e')](function(_0x5675a8){if(_0x5675a8){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x5675a8);}_0x4d04fb(null,_0x2d7216);});}});}});};AGIVertices[_0xb84a('0xe')][_0xb84a('0x2f')]=function(_0x43a071,_0xe38dbf){this['rpc'][_0xb84a('0x30')](_0x43a071)['then'](function(_0x3081b4){_0xe38dbf(null,_0x3081b4?_0x3081b4:![]);})['catch'](function(_0x48db18){_0xe38dbf(_0x48db18);});};AGIVertices['prototype'][_0xb84a('0x31')]=function(_0x22791f,_0xa06d2f){this[_0xb84a('0xc')]['createSmsMessage'](_0x22791f)[_0xb84a('0x10')](function(_0x42f0b6){_0xa06d2f(null,_0x42f0b6);})[_0xb84a('0x14')](function(_0xf616f6){_0xa06d2f(_0xf616f6);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x15a621,_0x1f3e04,_0x541cc4){this[_0xb84a('0xc')][_0xb84a('0x32')]({'uniqueid':this[_0xb84a('0x33')][_0xb84a('0x34')],'node':_0x15a621[_0xb84a('0x35')],'application':_0x15a621[_0xb84a('0x36')],'data':_0x1f3e04||null,'project_name':this[_0xb84a('0x33')][_0xb84a('0x37')],'callerid':this[_0xb84a('0x33')][_0xb84a('0x38')]})[_0xb84a('0x10')](function(_0x120770){if(_0x541cc4){_0x541cc4(null,_0x120770);}})[_0xb84a('0x14')](function(_0x33df6a){if(_0x541cc4){_0x541cc4(_0x33df6a);}});};AGIVertices[_0xb84a('0xe')]['createSquareRecording']=function(_0x49299e,_0x366fcd,_0x2ccc57,_0x46ee5c){this[_0xb84a('0xc')][_0xb84a('0x39')]({'uniqueid':this['channel'][_0xb84a('0x34')],'callerid':this['channel'][_0xb84a('0x38')],'calleridname':this[_0xb84a('0x33')][_0xb84a('0x3a')],'context':this[_0xb84a('0x33')]['context'],'extension':this[_0xb84a('0x33')][_0xb84a('0x3b')],'priority':this[_0xb84a('0x33')]['priority'],'accountcode':this['channel'][_0xb84a('0x3c')],'dnid':this[_0xb84a('0x33')][_0xb84a('0x3d')],'projectName':this['channel']['arg_1'],'saveName':_0x366fcd,'filename':_0x49299e['file']||_0x366fcd,'savePath':_0x2ccc57})[_0xb84a('0x10')](function(_0x384a0d){_0x46ee5c(null,_0x384a0d);})[_0xb84a('0x14')](function(_0x4476bc){_0x46ee5c(_0x4476bc);});};AGIVertices[_0xb84a('0xe')]['createSquareMessage']=function(_0x4b40fe,_0x5b853a,_0x53d4d6,_0x421ba0,_0xd094be){this['rpc'][_0xb84a('0x3e')]({'uniqueid':this[_0xb84a('0x33')][_0xb84a('0x34')],'body':_0x4b40fe,'direction':_0x5b853a,'providerName':_0x53d4d6,'providerResponse':_0x421ba0})[_0xb84a('0x10')](function(_0xb515cb){if(_0xd094be){_0xd094be(null,_0xb515cb);}})[_0xb84a('0x14')](function(_0x5a07d2){if(_0xd094be){_0xd094be(_0x5a07d2);}});};AGIVertices['prototype'][_0xb84a('0x3f')]=function(_0x50172a,_0x1e4efc){this['rpc']['createCmContact']({'firstName':_['isEmpty'](_0x50172a[_0xb84a('0x11')])||_[_0xb84a('0x40')](_0x50172a[_0xb84a('0x11')])?_0xb84a('0x41')+Math[_0xb84a('0x42')]():_0x50172a[_0xb84a('0x11')],'lastName':_[_0xb84a('0x43')](_0x50172a[_0xb84a('0x44')])||_['isNil'](_0x50172a['lastName'])?null:_0x50172a['lastName'],'phone':_0x50172a[_0xb84a('0x45')],'ListId':_0x50172a[_0xb84a('0x46')],'scheduledat':_0x50172a['scheduledAt'],'callbackUniqueid':this[_0xb84a('0x33')]['uniqueid'],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x50172a[_0xb84a('0x47')][_0xb84a('0x48')](),'priority':_0x50172a[_0xb84a('0x49')]})['then'](function(_0x5f757e){_0x1e4efc(null,_0x5f757e);})[_0xb84a('0x14')](function(_0x136d61){_0x1e4efc(_0x136d61);});};AGIVertices['prototype'][_0xb84a('0x4a')]=function(_0x4c1307,_0x5cf7fd){this[_0xb84a('0xc')]['getPauseById'](_0x4c1307)[_0xb84a('0x10')](function(_0x540742){_0x5cf7fd(null,_0x540742?_0x540742[_0xb84a('0x11')]:![]);})[_0xb84a('0x14')](function(_0x42f71f){_0x5cf7fd(_0x42f71f);});};AGIVertices[_0xb84a('0xe')]['agentPause']=function(_0x50a514,_0x4fc998,_0x40b392){var _0x2bebb6={'role':'agent'};_0x2bebb6[_0x50a514]=this['channel'][_0xb84a('0x38')];this[_0xb84a('0xc')][_0xb84a('0x4b')](_0x2bebb6,_0x4fc998,this['channel'][_0xb84a('0x34')])[_0xb84a('0x10')](function(_0x5297e4){_0x40b392(null,_[_0xb84a('0x40')](_0x5297e4)?![]:!![]);})[_0xb84a('0x14')](function(_0xdfa8bb){logger[_0xb84a('0x28')](_0xdfa8bb);_0x40b392(null,![]);});};AGIVertices[_0xb84a('0xe')][_0xb84a('0x4c')]=function(_0x119a3f,_0x47c27f){var _0x408e94={'role':_0xb84a('0x4d')};_0x408e94[_0x119a3f]=this['channel'][_0xb84a('0x38')];this[_0xb84a('0xc')][_0xb84a('0x4c')](_0x408e94)[_0xb84a('0x10')](function(_0x347998){_0x47c27f(null,_[_0xb84a('0x40')](_0x347998)?![]:!![]);})[_0xb84a('0x14')](function(_0x1b6b82){logger[_0xb84a('0x28')](_0x1b6b82);_0x47c27f(null,![]);});};AGIVertices['prototype'][_0xb84a('0x4e')]=function(_0x5dad01,_0x5a2d44){var _0x19d635={'role':'agent'};_0x19d635[_0x5dad01]=this[_0xb84a('0x33')]['callerid'];this[_0xb84a('0xc')][_0xb84a('0x4e')](_0x19d635)['then'](function(_0x1262e9){_0x5a2d44(null,_[_0xb84a('0x40')](_0x1262e9)?![]:!![]);})[_0xb84a('0x14')](function(_0x1dd409){logger[_0xb84a('0x28')](_0x1dd409);_0x5a2d44(null,![]);});};AGIVertices[_0xb84a('0xe')][_0xb84a('0x4f')]=function(_0x5411dc,_0x37d214){var _0x4a97e8={'role':'agent'};_0x4a97e8[_0x5411dc]=this[_0xb84a('0x33')][_0xb84a('0x38')];var _0x2ee241=_0x5411dc!=_0xb84a('0x50')?util['format']('%s/%s@from-sip/n',_0xb84a('0x51'),this[_0xb84a('0x33')][_0xb84a('0x38')]):undefined;this[_0xb84a('0xc')]['agentLogin'](_0x4a97e8,_0x2ee241)[_0xb84a('0x10')](function(_0x5eced1){_0x37d214(null,_[_0xb84a('0x40')](_0x5eced1)?![]:!![]);})['catch'](function(_0x2d579d){logger['error'](_0x2d579d);_0x37d214(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x23fd4c,_0xf936f1){sh[_0xb84a('0x52')](_[_0xb84a('0x53')](_0x23fd4c),function(_0x5a2c96,_0x1161b2){var _0x382469=_0x1161b2[_0xb84a('0x54')](/(\r\n|\n|\r)/gm,'');_0xf936f1(null,_0x382469);});};AGIVertices[_0xb84a('0xe')][_0xb84a('0x55')]=function(_0x27a37b,_0x436c25){scripts['googleCloudTTS'](_0x27a37b[_0xb84a('0x56')],_0x27a37b[_0xb84a('0x57')]||_0xb84a('0x58'),_0x27a37b[_0xb84a('0x58')],_0x27a37b[_0xb84a('0x59')]||_0xb84a('0x5a'),_0x27a37b['ssmlGender']||_0xb84a('0x5b'),_0x27a37b[_0xb84a('0x5c')]||_0xb84a('0x5d'))[_0xb84a('0x10')](function(_0x2daa02){_0x436c25(null,_0x2daa02);})['catch'](function(_0x34a1bc){_0x436c25(_0x34a1bc);});};AGIVertices['prototype'][_0xb84a('0x5e')]=function(_0x593c7c,_0x381169){scripts[_0xb84a('0x5e')](_0x593c7c[_0xb84a('0x58')],_0x593c7c['google_tts_language']||'en',0x1)[_0xb84a('0x10')](function(_0xb7e077){_0x381169(null,_0xb7e077);})[_0xb84a('0x14')](function(_0xb79e0f){_0x381169(_0xb79e0f);});};AGIVertices[_0xb84a('0xe')]['restAPI']=function(_0x37bfe4,_0x330a9b){var _0x287d25={'uri':_0x37bfe4['url'],'method':_0x37bfe4[_0xb84a('0x5f')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x37bfe4['timeout'])==='number'&&parseInt(_0x37bfe4[_0xb84a('0x60')])>=0x1?parseInt(_0x37bfe4[_0xb84a('0x60')])*0x3e8:0x5*0x3e8};if(_[_0xb84a('0x61')]([_0xb84a('0x62'),_0xb84a('0x63')],_0x287d25[_0xb84a('0x5f')][_0xb84a('0x64')]())){try{_0x287d25[_0xb84a('0x65')]=_0x37bfe4[_0xb84a('0x66')]?JSON[_0xb84a('0x67')](_0x37bfe4[_0xb84a('0x66')]):{};}catch(_0x429d5e){logger[_0xb84a('0x28')](_0xb84a('0x68'),_0x429d5e);}}try{_0x287d25[_0xb84a('0x69')]=_0x37bfe4[_0xb84a('0x6a')]?JSON[_0xb84a('0x67')](_0x37bfe4[_0xb84a('0x6a')]):{};}catch(_0x5b9ad7){logger[_0xb84a('0x28')](_0xb84a('0x6b'),_0x5b9ad7);}if(_0x37bfe4['computedVariables']){try{var _0x44b5bb=require(_0x37bfe4['computedVariables'])[_0xb84a('0x6c')](this,_0x287d25);_0x287d25['uri']=Mustache[_0xb84a('0x6d')](_0x37bfe4['url'],_0x44b5bb,{},['$$','$$']);if(_0x287d25['headers']){_0x287d25[_0xb84a('0x69')]=JSON[_0xb84a('0x67')](Mustache['render'](JSON[_0xb84a('0x6e')](_0x287d25[_0xb84a('0x69')]),_0x44b5bb,{},['$$','$$']));}if(_0x287d25[_0xb84a('0x65')]){_0x287d25[_0xb84a('0x65')]=JSON[_0xb84a('0x67')](Mustache['render'](JSON[_0xb84a('0x6e')](_0x287d25[_0xb84a('0x65')]),_0x44b5bb,{},['$$','$$']));}}catch(_0x3ab655){logger[_0xb84a('0x28')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3ab655);}}rp(_0x287d25)[_0xb84a('0x10')](function(_0x55cb95){var _0x14118c={'statusCode':_0x55cb95[_0xb84a('0x6f')]||0xc8,'statusMessage':_0x55cb95[_0xb84a('0x70')]||'OK','headers':_0x55cb95[_0xb84a('0x69')]||{},'body':_0x55cb95[_0xb84a('0x65')]||{}};_0x330a9b(null,_0x14118c);})[_0xb84a('0x14')](function(_0x5ca723){var _0x53715d={'statusCode':_0x5ca723[_0xb84a('0x6f')]||0x1f4,'statusMessage':_0x5ca723[_0xb84a('0x71')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x5ca723[_0xb84a('0x72')]['headers']||{},'body':_0x5ca723[_0xb84a('0x72')]['body']||{}};_0x330a9b(null,_0x53715d);});};AGIVertices['prototype'][_0xb84a('0x73')]=function(_0x11c6cf,_0xac353){scripts[_0xb84a('0x73')](this[_0xb84a('0x33')]['uniqueid'],_0x11c6cf['key'],_0x11c6cf[_0xb84a('0x58')],_0x11c6cf[_0xb84a('0x74')]||'en')['then'](function(_0x305b67){_0xac353(null,_0x305b67);})[_0xb84a('0x14')](function(_0x385a05){_0xac353(_0x385a05);});};AGIVertices[_0xb84a('0xe')]['googleDialogflowV2']=function(_0x20173d,_0x5cfc2c){scripts[_0xb84a('0x75')](this[_0xb84a('0x33')][_0xb84a('0x34')],_0x20173d[_0xb84a('0x76')],_0x20173d[_0xb84a('0x77')],_0x20173d[_0xb84a('0x78')],_0x20173d[_0xb84a('0x58')],_0x20173d[_0xb84a('0x79')]||'en')[_0xb84a('0x10')](function(_0x79ab88){_0x5cfc2c(null,_0x79ab88);})[_0xb84a('0x14')](function(_0x3fe7a5){_0x5cfc2c(_0x3fe7a5);});};AGIVertices['prototype'][_0xb84a('0x7a')]=function(_0x19301a,_0x15ded2){scripts[_0xb84a('0x7a')](this[_0xb84a('0x33')],_0x19301a)[_0xb84a('0x10')](function(_0x428d60){_0x15ded2(null,_0x428d60);})['catch'](function(_0x15ab18){_0x15ded2(_0x15ab18);});};AGIVertices[_0xb84a('0xe')][_0xb84a('0x7b')]=function(_0x5aab76,_0x9f9a80){scripts[_0xb84a('0x7b')](_0x5aab76[_0xb84a('0x7c')],_0x5aab76['text'],_0x5aab76[_0xb84a('0x7d')]||_0xb84a('0x5a'),_0x5aab76[_0xb84a('0x7e')])[_0xb84a('0x10')](function(_0x1d8f8a){_0x9f9a80(null,_0x1d8f8a);})[_0xb84a('0x14')](function(_0x588435){_0x9f9a80(_0x588435);});};AGIVertices[_0xb84a('0xe')][_0xb84a('0x7f')]=function(_0x538e12,_0x432a01,_0x157d19){scripts[_0xb84a('0x7f')](_0x432a01,_0x538e12[_0xb84a('0x7c')],_0x538e12['ispeech_asr_language']||_0xb84a('0x5a'),this[_0xb84a('0x80')](_0x538e12[_0xb84a('0x81')])?_0x538e12[_0xb84a('0x81')]:undefined)['then'](function(_0x36edac){_0x157d19(null,_0x36edac);})['catch'](function(_0x4802fd){_0x157d19(_0x4802fd);});};AGIVertices[_0xb84a('0xe')]['awsPolly']=function(_0x416c32,_0x45808c){scripts['awsPolly'](_0x416c32[_0xb84a('0x82')],_0x416c32['aws_secret_access_key'],_0x416c32[_0xb84a('0x83')],_0x416c32['aws_polly_voice']||_0xb84a('0x84'),_0x416c32[_0xb84a('0x58')],_0x416c32['aws_text_type']||_0xb84a('0x58'))[_0xb84a('0x10')](function(_0xbba541){_0x45808c(null,_0xbba541);})[_0xb84a('0x14')](function(_0x568e0c){_0x45808c(_0x568e0c);});};AGIVertices[_0xb84a('0xe')][_0xb84a('0x85')]=function(_0x1c39ce,_0x3f701a){scripts[_0xb84a('0x85')](this[_0xb84a('0x33')][_0xb84a('0x34')],_0x1c39ce[_0xb84a('0x82')],_0x1c39ce[_0xb84a('0x86')],_0x1c39ce[_0xb84a('0x87')],_0x1c39ce[_0xb84a('0x58')],_0x1c39ce[_0xb84a('0x88')])[_0xb84a('0x10')](function(_0x136b11){_0x3f701a(null,_0x136b11);})[_0xb84a('0x14')](function(_0xd579d7){_0x3f701a(_0xd579d7);});};AGIVertices[_0xb84a('0xe')]['googleASR']=function(_0x1eb3df,_0x36b88a,_0x52339e){scripts[_0xb84a('0x89')](_0x36b88a,_0x1eb3df['key'],_0x1eb3df[_0xb84a('0x8a')]||'en-US')[_0xb84a('0x10')](function(_0x57fe57){_0x52339e(null,_0x57fe57);})['catch'](function(_0x388cc6){_0x52339e(_0x388cc6);});};AGIVertices[_0xb84a('0xe')][_0xb84a('0x8b')]=function(_0x15489d,_0x2ab6bc,_0x37517c){scripts[_0xb84a('0x8b')](_0x2ab6bc,_0x15489d['appid'],_0x15489d[_0xb84a('0x8c')],_0x15489d['uri'])[_0xb84a('0x10')](function(_0x3cacc3){_0x37517c(null,_0x3cacc3);})[_0xb84a('0x14')](function(_0xe8634){_0x37517c(_0xe8634);});};AGIVertices['prototype']['clear']=function(_0x4ebd70){var _0x589181=_[_0xb84a('0x61')](verticesWithRetry,_0x4ebd70[_0xb84a('0x36')])?_0x4ebd70:_[_0xb84a('0x8d')](_0x4ebd70);for(var _0x2698b9 in _0x589181){if(_0x589181[_0xb84a('0x8e')](_0x2698b9)){if(_0x589181[_0x2698b9]&&_['isString'](_0x589181[_0x2698b9])){if(_[_0xb84a('0x61')](recursiveMapAttributes,_0x2698b9)){_0x589181[_0x2698b9]=this['replaceObjectAllVariables'](_0x589181[_0x2698b9]);}else{_0x589181[_0x2698b9]=this[_0xb84a('0x8f')](_0x589181[_0x2698b9]);}}}}return _0x589181;};AGIVertices[_0xb84a('0xe')][_0xb84a('0x90')]=function(_0x1adff4){for(var _0x2c4296 in _0x1adff4){if(_0x1adff4['hasOwnProperty'](_0x2c4296)){if(_[_0xb84a('0x91')](_0x1adff4[_0x2c4296])){this[_0xb84a('0x90')](_0x1adff4[_0x2c4296]);}else if(_[_0xb84a('0x92')](_0x1adff4[_0x2c4296])){for(var _0x150857=0x0;_0x150857<_0x1adff4[_0x2c4296][_0xb84a('0x93')];_0x150857++){this[_0xb84a('0x90')](_0x1adff4[_0x2c4296][_0x150857]);}}else if(_['isString'](_0x1adff4[_0x2c4296])){_0x1adff4[_0x2c4296]=this[_0xb84a('0x8f')](_0x1adff4[_0x2c4296]);}}}};AGIVertices['prototype'][_0xb84a('0x94')]=function(_0x291018,_0xaf616e){for(var _0x141ac6 in _0x291018){if(_0x291018[_0xb84a('0x8e')](_0x141ac6)){if(_[_0xb84a('0x91')](_0x291018[_0x141ac6])){if(!_['isEmpty'](_0x291018[_0x141ac6])){this['saveRestApiResult'](_0x291018[_0x141ac6],util['format'](_0xb84a('0x95'),_0xaf616e,_0x141ac6));}}else if(_[_0xb84a('0x92')](_0x291018[_0x141ac6])){for(var _0x463a19=0x0;_0x463a19<_0x291018[_0x141ac6]['length'];_0x463a19++){this['saveRestApiResult'](_0x291018[_0x141ac6][_0x463a19],util[_0xb84a('0x96')](_0xb84a('0x95'),_0xaf616e,_0x141ac6+'['+_0x463a19+']'));}}else{if(!_[_0xb84a('0x40')](_0x291018[_0x141ac6])){this[_0xb84a('0x33')][_0xb84a('0x97')](util[_0xb84a('0x96')](_0xb84a('0x95'),_0xaf616e,_0x141ac6),_0x291018[_0x141ac6]);}}}}};AGIVertices[_0xb84a('0xe')][_0xb84a('0x98')]=function(_0x3c942b){try{var _0x26871f=JSON[_0xb84a('0x67')](_0x3c942b);this[_0xb84a('0x90')](_0x26871f);return JSON[_0xb84a('0x6e')](_0x26871f);}catch(_0xdd6c91){return this[_0xb84a('0x8f')](_0x3c942b);}};AGIVertices[_0xb84a('0xe')][_0xb84a('0x8f')]=function(_0x5d4098){var _0xb11c17=_0x5d4098[_0xb84a('0x99')]('{');for(var _0x6882a1=0x1;_0x6882a1<_0xb11c17[_0xb84a('0x93')];_0x6882a1+=0x1){var _0x5a024e=_0xb11c17[_0x6882a1][_0xb84a('0x99')]('}');if(_0x5a024e['length']>0x1){_0x5d4098=_0x5d4098[_0xb84a('0x9a')]('{'+_0x5a024e[0x0]+'}',this[_0xb84a('0x33')]['getVariable'](_0x5a024e[0x0])[_0xb84a('0x9b')]||_0x5a024e[0x0]);}}if(_0xb11c17[_0xb84a('0x93')]===0x1){return _0x5d4098[_0xb84a('0x48')]();}return this[_0xb84a('0x8f')](_0x5d4098);};AGIVertices[_0xb84a('0xe')]['getAndSetVariable']=function(_0x134445,_0x53d8a6){var _0x160e2d=this['channel'][_0xb84a('0x9c')](_0x134445);if(_0x160e2d['result']===-0x1){return _0x160e2d;}logger[_0xb84a('0x2a')](util[_0xb84a('0x96')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x53d8a6,_0x160e2d[_0xb84a('0x9b')]));return this[_0xb84a('0x33')]['setVariable'](_0x53d8a6,_0x160e2d['extra']);};AGIVertices[_0xb84a('0xe')][_0xb84a('0x80')]=function(_0x7fe95b){return _0x7fe95b&&_0x7fe95b!=='0'&&_0x7fe95b!=='-1'&&_0x7fe95b!=='';};AGIVertices[_0xb84a('0xe')][_0xb84a('0x9d')]=function(_0x5e3b1f){this['createSquareDetailsReport'][_0xb84a('0x6c')](this,_0x5e3b1f,'-');_0x5e3b1f['retry']=_0x5e3b1f[_0xb84a('0x9d')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xb84a('0x9e')]=function(_0x341d61){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x9f'),_0x341d61[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x341d61[_0xb84a('0x58')])){return this[_0xb84a('0x33')]['noop'](_0xb84a('0xa0'));}var _0xcc570a='\x22'+_0x341d61[_0xb84a('0x58')]+'\x22';if(this['isConfigured'](_0x341d61[_0xb84a('0x72')])){_0xcc570a+=','+_0x341d61['options'];}var _0x271d3d=this[_0xb84a('0x33')][_0xb84a('0x52')](_0xb84a('0xa1'),_0xcc570a);if(_0x271d3d[_0xb84a('0xa2')]===-0x1){return _0x271d3d;}return this[_0xb84a('0x33')][_0xb84a('0xa3')](util['format'](_0xb84a('0xa4'),_0xcc570a));};AGIVertices[_0xb84a('0xe')]['mrcprecog']=function(_0x5d1cf5){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0xa5'),_0x5d1cf5[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x5d1cf5[_0xb84a('0xa6')])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0xa7'));}var _0x1e1bed=_0x5d1cf5[_0xb84a('0xa6')];if(this[_0xb84a('0x80')](_0x5d1cf5[_0xb84a('0x72')])){_0x1e1bed+=','+_0x5d1cf5[_0xb84a('0x72')];}var _0x151983=this[_0xb84a('0x33')][_0xb84a('0x52')](_0xb84a('0xa8'),_0x1e1bed);if(_0x151983[_0xb84a('0xa2')]===-0x1){return _0x151983;}var _0x2d51f2=this['getAndSetVariable'](_0xb84a('0xa9'),'MRCP_RECOG_CONFIDENCE');if(_0x2d51f2[_0xb84a('0xa2')]===-0x1){return _0x2d51f2;}var _0x2f9a69=this[_0xb84a('0xaa')](_0xb84a('0xab'),_0xb84a('0xac'));if(_0x2f9a69[_0xb84a('0xa2')]===-0x1){return _0x2f9a69;}var _0x4c9cd1=this[_0xb84a('0xaa')]('RECOG_INSTANCE()',_0xb84a('0xad'));if(_0x4c9cd1[_0xb84a('0xa2')]===-0x1){return _0x4c9cd1;}return this['channel'][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0xae'),_0x1e1bed));};AGIVertices[_0xb84a('0xe')]['agi']=function(_0x400940){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0xaf'),_0x400940[_0xb84a('0x35')]));return this['channel'][_0xb84a('0x7')]([_0x400940[_0xb84a('0xb0')],_0x400940['args']]);};AGIVertices[_0xb84a('0xe')]['answer']=function(_0x77b0fd){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0xb1'),_0x77b0fd['label']));if(this[_0xb84a('0x80')](_0x77b0fd[_0xb84a('0x60')])){logger['info'](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x77b0fd[_0xb84a('0x60')]));var _0x28e6ed=this['channel']['wait'](_0x77b0fd[_0xb84a('0x60')]);if(_0x28e6ed['result']===-0x1){return _0x28e6ed;}}return this[_0xb84a('0x33')][_0xb84a('0xb2')]();};AGIVertices[_0xb84a('0xe')]['callback']=function(_0x53064e){logger[_0xb84a('0x2a')](util['format'](_0xb84a('0xb3'),_0x53064e[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x53064e[_0xb84a('0x46')])){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x53064e,'no\x20list\x20selected');}_0x53064e[_0xb84a('0x47')]=moment();if(this[_0xb84a('0x80')](_0x53064e[_0xb84a('0xb4')])){_0x53064e[_0xb84a('0x47')]=moment()[_0xb84a('0xb5')](_0x53064e[_0xb84a('0xb4')],_0xb84a('0xb6'));}if(!this[_0xb84a('0x80')](_0x53064e[_0xb84a('0x49')])){_0x53064e[_0xb84a('0x49')]=0x2;}this[_0xb84a('0x3f')][_0xb84a('0x6c')](this,_0x53064e);return this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x53064e[_0xb84a('0x45')],_0x53064e[_0xb84a('0x46')],_0x53064e[_0xb84a('0x47')]));};AGIVertices[_0xb84a('0xe')][_0xb84a('0xb7')]=function(_0x513137){logger['info'](util['format'](_0xb84a('0xb8'),_0x513137[_0xb84a('0x35')]));var _0x6c08f8=this['channel']['exec'](_0x513137[_0xb84a('0xb9')],_0x513137[_0xb84a('0x72')]);if(_0x6c08f8['result']===-0x1){return _0x6c08f8;}return this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0xba'),_0x513137['application'],_0x513137[_0xb84a('0x72')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x30d956){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0xbb'),_0x30d956[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x30d956[_0xb84a('0x58')])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0xa0'));}var _0x455f98='\x22'+_0x30d956[_0xb84a('0x58')]+'\x22';if(this[_0xb84a('0x80')](_0x30d956[_0xb84a('0x72')])){_0x455f98+=','+_0x30d956['options'];}var _0x1f0d2c=this[_0xb84a('0x33')][_0xb84a('0x52')](_0xb84a('0xa1'),_0x455f98);if(_0x1f0d2c[_0xb84a('0xa2')]===-0x1){return _0x1f0d2c;}return this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0xa4'),_0x455f98));};AGIVertices['prototype'][_0xb84a('0xbc')]=function(_0x2e6701){logger['info'](util['format'](_0xb84a('0xbd'),_0x2e6701[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x2e6701[_0xb84a('0x58')])){return this[_0xb84a('0x33')][_0xb84a('0xa3')]('no\x20text\x20configured');}var _0x4167d='\x22'+_0x2e6701[_0xb84a('0x58')]+'\x22';if(this[_0xb84a('0x80')](_0x2e6701[_0xb84a('0x72')])){_0x4167d+=','+_0x2e6701[_0xb84a('0x72')];}var _0x148b95=this[_0xb84a('0x33')][_0xb84a('0x52')](_0xb84a('0xa1'),_0x4167d);if(_0x148b95['result']===-0x1){return _0x148b95;}return this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0xa4'),_0x4167d));};AGIVertices[_0xb84a('0xe')][_0xb84a('0xbe')]=function(_0x59d7c4){logger['info'](util[_0xb84a('0x96')](_0xb84a('0xbf'),_0x59d7c4['label']));if(!this[_0xb84a('0x80')](_0x59d7c4['grammar'])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0xa7'));}var _0x2304c3=_0x59d7c4[_0xb84a('0xa6')];if(this['isConfigured'](_0x59d7c4[_0xb84a('0x72')])){_0x2304c3+=','+_0x59d7c4[_0xb84a('0x72')];}var _0x2702ad=this[_0xb84a('0x33')][_0xb84a('0x52')](_0xb84a('0xa8'),_0x2304c3);if(_0x2702ad[_0xb84a('0xa2')]===-0x1){return _0x2702ad;}var _0x496931=this[_0xb84a('0xaa')]('RECOG_CONFIDENCE()',_0xb84a('0xc0'));if(_0x496931[_0xb84a('0xa2')]===-0x1){return _0x496931;}var _0x183fb5=this[_0xb84a('0xaa')](_0xb84a('0xab'),_0xb84a('0xc1'));if(_0x183fb5[_0xb84a('0xa2')]===-0x1){return _0x183fb5;}var _0x18b910=this[_0xb84a('0xaa')]('RECOG_INSTANCE()',_0xb84a('0xc2'));if(_0x18b910[_0xb84a('0xa2')]===-0x1){return _0x18b910;}return this[_0xb84a('0x33')]['noop'](util['format'](_0xb84a('0xae'),_0x2304c3));};AGIVertices[_0xb84a('0xe')]['sestekasr']=function(_0x27d56a){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0xc3'),_0x27d56a['label']));if(!this[_0xb84a('0x80')](_0x27d56a[_0xb84a('0xa6')])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0xa7'));}var _0x41ceb2=_0x27d56a[_0xb84a('0xa6')];if(this[_0xb84a('0x80')](_0x27d56a['options'])){_0x41ceb2+=','+_0x27d56a['options'];}var _0xb83cb2=this[_0xb84a('0x33')][_0xb84a('0x52')]('MRCPRecog',_0x41ceb2);if(_0xb83cb2[_0xb84a('0xa2')]===-0x1){return _0xb83cb2;}var _0x4c85c2=this[_0xb84a('0xaa')]('RECOG_CONFIDENCE()',_0xb84a('0xc4'));if(_0x4c85c2[_0xb84a('0xa2')]===-0x1){return _0x4c85c2;}var _0x561f5a=this[_0xb84a('0xaa')](_0xb84a('0xab'),_0xb84a('0xc5'));if(_0x561f5a[_0xb84a('0xa2')]===-0x1){return _0x561f5a;}var _0x60d501=this[_0xb84a('0xaa')]('RECOG_INSTANCE()',_0xb84a('0xc6'));if(_0x60d501[_0xb84a('0xa2')]===-0x1){return _0x60d501;}return this['channel']['noop'](util[_0xb84a('0x96')]('Executed\x20command\x20MRCPRecog\x20%s',_0x41ceb2));};AGIVertices[_0xb84a('0xe')][_0xb84a('0xc7')]=function(_0x4eebad){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0xc8'),_0x4eebad[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x4eebad['odbc_id'])){return this['channel']['error'](_0x4eebad,_0xb84a('0xc9'));}var _0x5dc8c5=this[_0xb84a('0x17')][_0xb84a('0x6c')](this,_0x4eebad[_0xb84a('0xca')]);if(!_0x5dc8c5){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x4eebad,_0xb84a('0xcb'));}if(!this[_0xb84a('0x80')](_0x4eebad[_0xb84a('0xcc')])){return this[_0xb84a('0x33')]['error'](_0x4eebad,_0xb84a('0xcd'));}var _0x11b29a=_0x4eebad[_0xb84a('0xcc')][_0xb84a('0x54')](/(\r\n|\n|\r)/gm,'\x20');this[_0xb84a('0x33')]['noop'](util[_0xb84a('0x96')](_0xb84a('0xce'),_0x11b29a));var _0x42a323=this[_0xb84a('0x27')]['sync'](this,_0x5dc8c5,_0x11b29a);this['createSquareDetailsReport']['sync'](this,_0x4eebad,_0x11b29a);if(!this[_0xb84a('0x80')](_0x4eebad[_0xb84a('0xcf')])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0xd0'));}var _0x31ef5c=this[_0xb84a('0x9c')]['sync'](this,_0x4eebad[_0xb84a('0xcf')]);if(!_0x31ef5c){return this['channel'][_0xb84a('0x28')](_0x4eebad,_0xb84a('0xd1'));}var _0x532249=this;_0x42a323[_0xb84a('0xd2')](function(_0x5f2288,_0x43d584){Object[_0xb84a('0xd3')](_0x5f2288)[_0xb84a('0xd2')](function(_0x3a012f){_0x532249[_0xb84a('0x33')][_0xb84a('0x97')](util[_0xb84a('0x96')](_0xb84a('0xd4'),_0x31ef5c,_0x43d584,_0x3a012f),_0x5f2288[_0x3a012f]);});});this[_0xb84a('0x33')]['setVariable'](util[_0xb84a('0x96')](_0xb84a('0xd5'),_0x31ef5c),_0x42a323[_0xb84a('0x93')]);return this['channel']['noop'](util[_0xb84a('0x96')](_0xb84a('0xd6'),_0x31ef5c));};AGIVertices['prototype']['dial']=function(_0x13a9f1){logger[_0xb84a('0xd7')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x13a9f1['label']));if(!this['isConfigured'](_0x13a9f1[_0xb84a('0xd8')])){return this[_0xb84a('0x33')]['error'](_0x13a9f1,_0xb84a('0xd9'));}var _0x3f460f=this[_0xb84a('0xda')][_0xb84a('0x6c')](this,_0x13a9f1[_0xb84a('0xd8')]);if(!_0x3f460f){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x13a9f1,'no\x20user\x20found');}var _0x42da4b=this['channel'][_0xb84a('0x52')]('DIAL',[util[_0xb84a('0x96')]('SIP/%s',_0x3f460f),_0x13a9f1['timeout'],_0x13a9f1[_0xb84a('0xdb')],_0x13a9f1[_0xb84a('0xdc')]]);if(_0x42da4b[_0xb84a('0xa2')]===-0x1){return _0x42da4b;}return this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')]('Executed\x20command\x20%s',_0xb84a('0xdd')));};AGIVertices[_0xb84a('0xe')]['dialogflow']=function(_0x55505c){logger['info'](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x55505c[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x55505c[_0xb84a('0x7c')])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0xde'));}if(!this[_0xb84a('0x80')](_0x55505c['text'])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0xa0'));}this[_0xb84a('0x33')]['bot']=!![];this[_0xb84a('0x32')](_0x55505c);this[_0xb84a('0x3e')](_0x55505c[_0xb84a('0x58')],'in','','');this[_0xb84a('0x33')]['noop'](util['format']('Trying\x20Dialogflow:\x20%s',_0x55505c[_0xb84a('0x58')]));var _0x4b8913=this[_0xb84a('0x73')][_0xb84a('0x6c')](this,_0x55505c);if(_0x4b8913){for(var _0x31b6c2 in _0x4b8913){if(_0x4b8913[_0xb84a('0x8e')](_0x31b6c2)){this[_0xb84a('0x33')][_0xb84a('0x97')](util[_0xb84a('0x96')](_0xb84a('0xdf'),_0x31b6c2[_0xb84a('0x64')]()),_0x4b8913[_0x31b6c2]);}}this[_0xb84a('0x3e')](_0x4b8913[_0xb84a('0xe0')],_0xb84a('0xe1'),_0xb84a('0xe2'),'');return this['channel'][_0xb84a('0xa3')](util['format'](_0xb84a('0xe3'),_0x4b8913[_0xb84a('0xe0')]));}return this['channel'][_0xb84a('0x28')](_0x55505c,_0xb84a('0xe4'));};AGIVertices['prototype'][_0xb84a('0xe5')]=function(_0x45f9d9){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0xe6'),_0x45f9d9[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x45f9d9['dialogflowV2_project_id'])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0xe7'));}if(!this[_0xb84a('0x80')](_0x45f9d9[_0xb84a('0x77')])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0xe8'));}if(!this[_0xb84a('0x80')](_0x45f9d9[_0xb84a('0x78')])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0xe9'));}if(!this[_0xb84a('0x80')](_0x45f9d9[_0xb84a('0x79')])){return this['channel'][_0xb84a('0xa3')](_0xb84a('0xea'));}if(!this[_0xb84a('0x80')](_0x45f9d9['text'])){return this['channel']['noop'](_0xb84a('0xa0'));}this[_0xb84a('0x33')][_0xb84a('0xeb')]=!![];this[_0xb84a('0x32')](_0x45f9d9);this[_0xb84a('0x3e')](_0x45f9d9[_0xb84a('0x58')],'in','','');this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0xec'),_0x45f9d9[_0xb84a('0x58')]));var _0x48eae8=this[_0xb84a('0x75')]['sync'](this,_0x45f9d9);if(_0x48eae8){for(var _0x59cdc5 in _0x48eae8){if(_0x48eae8[_0xb84a('0x8e')](_0x59cdc5)){if(_0x59cdc5!=='providerResponse'){this[_0xb84a('0x33')]['setVariable'](util[_0xb84a('0x96')](_0xb84a('0xdf'),_0x59cdc5[_0xb84a('0x64')]()),_0x48eae8[_0x59cdc5]);}}}this['createSquareMessage'](_0x48eae8[_0xb84a('0xe0')],_0xb84a('0xe1'),_0xb84a('0xe5'),_0x48eae8[_0xb84a('0xed')]);return this[_0xb84a('0x33')]['noop'](util[_0xb84a('0x96')](_0xb84a('0xee'),_0x48eae8[_0xb84a('0xe0')]));}return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x45f9d9,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xb84a('0xe')][_0xb84a('0xef')]=function(_0x4eeee1){logger['info'](util[_0xb84a('0x96')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x4eeee1[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x4eeee1[_0xb84a('0xf0')])){return this[_0xb84a('0x33')][_0xb84a('0xa3')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xb84a('0x80')](_0x4eeee1['username'])){return this[_0xb84a('0x33')][_0xb84a('0xa3')]('no\x20username\x20configured');}if(!this[_0xb84a('0x80')](_0x4eeee1[_0xb84a('0xf1')])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0xf2'));}if(!this['isConfigured'](_0x4eeee1[_0xb84a('0xf3')])){return this[_0xb84a('0x33')]['noop'](_0xb84a('0xa0'));}this[_0xb84a('0x33')][_0xb84a('0xeb')]=!![];this[_0xb84a('0x32')](_0x4eeee1);this[_0xb84a('0x3e')](_0x4eeee1[_0xb84a('0x58')],'in','','');this[_0xb84a('0x33')][_0xb84a('0xa3')](util['format']('Trying\x20SestekNDA:\x20%s',_0x4eeee1['text']));var _0x147206=this[_0xb84a('0x7a')][_0xb84a('0x6c')](this,_0x4eeee1);if(_0x147206){for(var _0x2c5f63 in _0x147206){if(_0x147206[_0xb84a('0x8e')](_0x2c5f63)){this[_0xb84a('0x33')][_0xb84a('0x97')](util[_0xb84a('0x96')](_0xb84a('0xf4'),_0x2c5f63[_0xb84a('0x64')]()),_0x147206[_0x2c5f63]);}}this[_0xb84a('0x3e')](_0x147206[_0xb84a('0xe0')],_0xb84a('0xe1'),_0xb84a('0xef'),'');if(_0x147206[_0xb84a('0xf5')]){this[_0xb84a('0x33')][_0xb84a('0xa3')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x147206[_0xb84a('0xf5')]));var _0x502848=this['channel'][_0xb84a('0xf6')](_0x147206[_0xb84a('0xf5')]);try{fs[_0xb84a('0xf7')](_0x147206[_0xb84a('0xf5')]+_0xb84a('0xf8'));}catch(_0x130a54){logger[_0xb84a('0x28')](_0x130a54);}return _0x502848;}else{return this['channel'][_0xb84a('0xa3')](util[_0xb84a('0x96')]('SestekNDA\x20Result\x20%s',_0x147206[_0xb84a('0xe0')]));}}return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x4eeee1,_0xb84a('0xf9'));};AGIVertices[_0xb84a('0xe')]['end']=function(_0xf3bc0){logger[_0xb84a('0x2a')](util['format'](_0xb84a('0xfa'),_0xf3bc0['label']));return this[_0xb84a('0x33')][_0xb84a('0xa3')]('end');};AGIVertices['prototype'][_0xb84a('0xfb')]=function(_0x417626){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x417626[_0xb84a('0x35')]));var _0x5b6684='';if(_0x417626[_0xb84a('0xfc')]){if(!this[_0xb84a('0x80')](_0x417626[_0xb84a('0xfc')])){return this[_0xb84a('0x33')]['error'](_0x417626,_0xb84a('0xfd'));}else{var _0x199a24=parseInt(_0x417626[_0xb84a('0xfc')],0xa);if(isNaN(_0x199a24)){_0x5b6684=_0x417626[_0xb84a('0xfc')];}else{_0x5b6684=this['getTrunk'][_0xb84a('0x6c')](this,_0x417626[_0xb84a('0xfc')]);if(!_0x5b6684){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x417626,_0xb84a('0xfe'));}}}}else if(_0x417626[_0xb84a('0xff')]){_0x5b6684=_0x417626[_0xb84a('0xff')];}else{return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x417626,_0xb84a('0xfd'));}var _0x2705e5=this['channel'][_0xb84a('0x52')]('DIAL',[util[_0xb84a('0x96')]('SIP/%s/%s',_0x5b6684,_0x417626['phone']),_0x417626[_0xb84a('0x60')],_0x417626['opts'],_0x417626['url']]);if(_0x2705e5[_0xb84a('0xa2')]===-0x1){return _0x2705e5;}return this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x100'),_0xb84a('0xdd')));};AGIVertices['prototype'][_0xb84a('0x101')]=function(_0x296df2){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x296df2['label']));return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0x101'));};AGIVertices[_0xb84a('0xe')][_0xb84a('0x102')]=function(_0x23d230){logger[_0xb84a('0x2a')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x23d230['label']));if(_0x23d230['retry']===0x0){return this['maxRetry'](_0x23d230);}_0x23d230[_0xb84a('0x103')]-=0x1;if(!this[_0xb84a('0x80')](_0x23d230[_0xb84a('0x104')])){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x23d230,_0xb84a('0x105'));}var _0x2650b4=this['getSound'][_0xb84a('0x6c')](this,_0x23d230[_0xb84a('0x104')]);if(!_0x2650b4){return this['channel'][_0xb84a('0x28')](_0x23d230,_0xb84a('0x106'));}if(!this['isConfigured'](_0x23d230[_0xb84a('0xcf')])){return this['channel']['error'](_0xb84a('0xd0'));}var _0x15045d=this[_0xb84a('0x33')][_0xb84a('0x107')](_0x2650b4,_0x23d230['response'],_0x23d230['maxdigit']);var _0x367cbb=_0x15045d[_0xb84a('0xa2')]?_0x15045d[_0xb84a('0xa2')][_0xb84a('0x48')]():'';logger['info']('test',JSON[_0xb84a('0x6e')](_0x15045d));if(_0x15045d['result']===-0x1){this[_0xb84a('0x32')][_0xb84a('0x6c')](this,_0x23d230,_0x367cbb);return _0x15045d;}else if(_0x15045d['extra']===_0xb84a('0x60')){_0x15045d[_0xb84a('0xa2')]=_0x367cbb[_0xb84a('0x93')]>=parseInt(_0x23d230[_0xb84a('0x108')])?'x':'i';}else{_0x15045d[_0xb84a('0xa2')]=_0x367cbb[_0xb84a('0x93')]>=parseInt(_0x23d230['mindigit'])&&_0x367cbb['length']<=parseInt(_0x23d230[_0xb84a('0x109')])?'x':'i';}var _0x169feb=this[_0xb84a('0x9c')]['sync'](this,_0x23d230[_0xb84a('0xcf')]);if(!_0x169feb){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x23d230,_0xb84a('0xd1'));}this[_0xb84a('0x33')][_0xb84a('0x97')](_0x169feb,_0x367cbb);if(this[_0xb84a('0x80')](_0x23d230[_0xb84a('0x10a')])){var _0x3490dc=parseInt(_0x23d230[_0xb84a('0x10a')],0xa);var _0x1ee95d=rs[_0xb84a('0x10b')]({'charset':'*','length':_0x3490dc});var _0x18240c=_0x367cbb['length'];if(_0x18240c>0x0){if(_0x18240c>_0x3490dc){this[_0xb84a('0x32')][_0xb84a('0x6c')](this,_0x23d230,_0x23d230['hiddendigitspos']===_0xb84a('0x10c')?_0x1ee95d+_0x367cbb[_0xb84a('0x10d')](_0x3490dc):_0x367cbb[_0xb84a('0x10d')](0x0,_0x18240c-_0x3490dc)+_0x1ee95d);}else{this['createSquareDetailsReport'][_0xb84a('0x6c')](this,_0x23d230,rs[_0xb84a('0x10b')]({'charset':'*','length':_0x18240c}));}}else{this['createSquareDetailsReport'][_0xb84a('0x6c')](this,_0x23d230,'');}}else{this[_0xb84a('0x32')][_0xb84a('0x6c')](this,_0x23d230,_0x367cbb);}return _0x15045d;};AGIVertices[_0xb84a('0xe')]['getsecretdigits']=function(_0x30569a){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x10e'),_0x30569a['label']));return this['getdigits'](_0x30569a);};AGIVertices[_0xb84a('0xe')][_0xb84a('0x10f')]=function(_0x375811){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x375811[_0xb84a('0x35')]));this[_0xb84a('0x32')][_0xb84a('0x6c')](this,_0x375811,_0x375811[_0xb84a('0x110')]);return this['channel'][_0xb84a('0xa3')](util['format'](_0xb84a('0x111'),_0x375811[_0xb84a('0x110')]));};AGIVertices[_0xb84a('0xe')]['awspolly']=function(_0x4e2acf){logger['info'](util[_0xb84a('0x96')](_0xb84a('0x112'),_0x4e2acf['label']));if(!this['isConfigured'](_0x4e2acf[_0xb84a('0x82')])||!this[_0xb84a('0x80')](_0x4e2acf[_0xb84a('0x86')])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0x113'));}if(!this[_0xb84a('0x80')](_0x4e2acf['text'])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0xa0'));}this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x114'),_0x4e2acf['text']));var _0x59fecf=this['awsPolly'][_0xb84a('0x6c')](this,_0x4e2acf);if(_0x59fecf){this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x115'),_0x59fecf));var _0x564ea9=this[_0xb84a('0x33')]['streamFile'](_0x59fecf);try{fs[_0xb84a('0xf7')](_0x59fecf+_0xb84a('0xf8'));}catch(_0x5cf38c){logger[_0xb84a('0x28')](_0x5cf38c);}return _0x564ea9;}return this['channel'][_0xb84a('0x28')](_0x4e2acf,_0xb84a('0x116'));};AGIVertices[_0xb84a('0xe')][_0xb84a('0x117')]=function(_0x59a01d){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x118'),_0x59a01d[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x59a01d[_0xb84a('0x82')])||!this[_0xb84a('0x80')](_0x59a01d[_0xb84a('0x86')])){return this[_0xb84a('0x33')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xb84a('0x80')](_0x59a01d[_0xb84a('0x88')])){return this[_0xb84a('0x33')]['noop']('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x59a01d[_0xb84a('0x58')])){return this['channel'][_0xb84a('0xa3')](_0xb84a('0xa0'));}this['channel'][_0xb84a('0xeb')]=!![];this[_0xb84a('0x32')](_0x59a01d);this['createSquareMessage'](_0x59a01d[_0xb84a('0x58')],'in','','');this[_0xb84a('0x33')]['noop'](util[_0xb84a('0x96')](_0xb84a('0x119'),_0x59a01d[_0xb84a('0x58')]));var _0x235871=this['awsLex'][_0xb84a('0x6c')](this,_0x59a01d);if(_0x235871){for(var _0x26e41e in _0x235871){if(_0x235871[_0xb84a('0x8e')](_0x26e41e)&&_['isString'](_0x235871[_0x26e41e])){this[_0xb84a('0x33')][_0xb84a('0x97')](util[_0xb84a('0x96')](_0xb84a('0x11a'),_0x26e41e[_0xb84a('0x64')]()),_0x235871[_0x26e41e]);}}if(_[_0xb84a('0x40')](_0x235871['message'])){return this['channel'][_0xb84a('0xa3')](_0xb84a('0x11b'));}else{this[_0xb84a('0x3e')](_0x235871['message'],_0xb84a('0xe1'),'amazonlex','');return this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x11c'),_0x235871['message']));}}return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x59a01d,_0xb84a('0x11d'));};AGIVertices[_0xb84a('0xe')][_0xb84a('0x11e')]=function(_0x65a0c1){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x65a0c1[_0xb84a('0x35')],_0x65a0c1[_0xb84a('0x60')]));if(!this['isConfigured'](_0x65a0c1['key'])){return this['channel'][_0xb84a('0xa3')](_0xb84a('0xde'));}var _0x5a38ab=_0xb84a('0x11f');var _0x1932cf=util[_0xb84a('0x96')](_0xb84a('0x120'),FILES_PATH,rs['generate'](0x4));var _0x36537b=util['format'](_0xb84a('0x95'),_0x1932cf,_0x5a38ab);var _0x359956=!![];if(_0x65a0c1[_0xb84a('0x121')]==='NOBEEP'){_0x359956=![];}var _0x2e09d6=this[_0xb84a('0x33')][_0xb84a('0x122')](_0x1932cf,_0x5a38ab,_0x65a0c1[_0xb84a('0x123')],_0x65a0c1[_0xb84a('0x60')],undefined,_0x359956);if(_0x2e09d6[_0xb84a('0xa2')]!==-0x1){this['channel']['noop'](util[_0xb84a('0x96')](_0xb84a('0x124'),_0x36537b));var _0x53f20b=this['googleASR']['sync'](this,_0x65a0c1,_0x36537b);if(_0x53f20b){for(var _0x3dd5d2 in _0x53f20b){if(_0x53f20b[_0xb84a('0x8e')](_0x3dd5d2)){this['channel'][_0xb84a('0x97')](util[_0xb84a('0x96')]('GOOGLE_ASR_%s',_0x3dd5d2[_0xb84a('0x64')]()),_0x53f20b[_0x3dd5d2]);}}return this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x125'),JSON[_0xb84a('0x6e')](_0x53f20b)));}}return _0x2e09d6;};AGIVertices[_0xb84a('0xe')][_0xb84a('0x126')]=function(_0x34ee04){logger['info'](util[_0xb84a('0x96')](_0xb84a('0x127'),_0x34ee04[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x34ee04[_0xb84a('0x128')])){return this['channel'][_0xb84a('0xa3')](_0xb84a('0x129'));}if(!this[_0xb84a('0x80')](_0x34ee04[_0xb84a('0x8c')])){return this[_0xb84a('0x33')]['noop']('no\x20appsecret\x20configured');}var _0x3a9b8e=_0xb84a('0x11f');var _0x26d497=util['format'](_0xb84a('0x120'),FILES_PATH,rs[_0xb84a('0x10b')](0x4));var _0x252644=util[_0xb84a('0x96')]('%s.%s',_0x26d497,_0x3a9b8e);var _0x5ec79a=!![];if(_0x34ee04[_0xb84a('0x121')]===_0xb84a('0x12a')){_0x5ec79a=![];}var _0x30660a=this['channel'][_0xb84a('0x122')](_0x26d497,_0x3a9b8e,_0x34ee04[_0xb84a('0x123')],_0x34ee04[_0xb84a('0x60')],undefined,_0x5ec79a);if(_0x30660a[_0xb84a('0xa2')]!==-0x1){this['channel'][_0xb84a('0xa3')](util['format'](_0xb84a('0x12b'),_0x252644));var _0x289d90=this[_0xb84a('0x8b')][_0xb84a('0x6c')](this,_0x34ee04,_0x252644);if(_0x289d90){for(var _0x3d5947 in _0x289d90){if(_0x289d90[_0xb84a('0x8e')](_0x3d5947)){this[_0xb84a('0x33')]['setVariable'](util[_0xb84a('0x96')](_0xb84a('0x12c'),_0x3d5947['toUpperCase']()),_0x289d90[_0x3d5947]);}}return this[_0xb84a('0x33')]['noop'](util['format']('TildeASR\x20Result\x20%s',JSON[_0xb84a('0x6e')](_0x289d90)));}}return _0x30660a;};AGIVertices[_0xb84a('0xe')][_0xb84a('0x12d')]=function(_0x322774){logger['info'](util[_0xb84a('0x96')](_0xb84a('0x12e'),_0x322774[_0xb84a('0x35')]));return this['channel'][_0xb84a('0x12f')](_0x322774[_0xb84a('0x130')],_0x322774[_0xb84a('0x3b')],_0x322774[_0xb84a('0x131')]);};AGIVertices[_0xb84a('0xe')][_0xb84a('0x132')]=function(_0x2b09d9){logger['info'](util[_0xb84a('0x96')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2b09d9['label']));if(!this['isConfigured'](_0x2b09d9[_0xb84a('0x133')])){return this['channel'][_0xb84a('0x28')](_0x2b09d9,_0xb84a('0x134'));}try{var _0xde2d2b=eval(_0x2b09d9[_0xb84a('0x133')])?_0xb84a('0x135'):_0xb84a('0x136');this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')]('EVAL\x20CONDITION\x20%s\x20%s',_0x2b09d9[_0xb84a('0x133')],_0xde2d2b));return{'code':0xc8,'result':_0xde2d2b};}catch(_0x2fac11){return{'code':0xc8,'result':_0xb84a('0x136')};}};AGIVertices[_0xb84a('0xe')][_0xb84a('0x137')]=function(_0x5815c3){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x138'),_0x5815c3[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x5815c3[_0xb84a('0x139')])){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x5815c3,_0xb84a('0x13a'));}var _0x467bfa=this[_0xb84a('0x13b')][_0xb84a('0x6c')](this,_0x5815c3[_0xb84a('0x139')]);if(!_0x467bfa){return this[_0xb84a('0x33')]['error'](_0x5815c3,_0xb84a('0x13c'));}for(var _0x4a083d=0x0;_0x4a083d<_0x467bfa[_0xb84a('0x93')];_0x4a083d+=0x1){var _0x598988=this['channel']['getVariable'](util[_0xb84a('0x96')](_0xb84a('0x13d'),_0x467bfa[_0x4a083d]));if(_0x598988['result']===-0x1){return _0x598988;}logger['info'](util[_0xb84a('0x96')](_0xb84a('0x13e'),_0x467bfa[_0x4a083d],_0x598988[_0xb84a('0x9b')]));if(_0x598988[_0xb84a('0x9b')]==='true'){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x13e'),_0x467bfa[_0x4a083d],_0xb84a('0x135')));this['channel'][_0xb84a('0xa3')](util[_0xb84a('0x96')]('IFTIME\x20%s\x20%s',_0x467bfa[_0x4a083d],_0xb84a('0x135')));return{'code':0xc8,'result':_0xb84a('0x135')};}else{logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x13e'),_0x467bfa[_0x4a083d],_0xb84a('0x136')));this[_0xb84a('0x33')][_0xb84a('0xa3')](util['format']('IFTIME\x20%s\x20%s',_0x467bfa[_0x4a083d],_0xb84a('0x136')));}}return{'code':0xc8,'result':_0xb84a('0x136')};};AGIVertices['prototype']['hangup']=function(_0x2e90ad){logger[_0xb84a('0x2a')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x2e90ad[_0xb84a('0x35')]));return this[_0xb84a('0x33')]['hangup']();};AGIVertices[_0xb84a('0xe')][_0xb84a('0x13f')]=function(_0x455fb9){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x140'),_0x455fb9[_0xb84a('0x35')]));if(!this['isConfigured'](_0x455fb9[_0xb84a('0x7c')])){return this[_0xb84a('0x33')]['noop']('no\x20key\x20configured');}var _0x37bc47=_0xb84a('0x11f');var _0xbfc725=util[_0xb84a('0x96')](_0xb84a('0x120'),FILES_PATH,rs[_0xb84a('0x10b')](0x4));var _0x25793c=util[_0xb84a('0x96')]('%s.%s',_0xbfc725,_0x37bc47);var _0x1e7b7a=!![];if(_0x455fb9[_0xb84a('0x121')]===_0xb84a('0x12a')){_0x1e7b7a=![];}var _0x1abe77=this['channel'][_0xb84a('0x122')](_0xbfc725,_0x37bc47,_0x455fb9[_0xb84a('0x123')],_0x455fb9[_0xb84a('0x60')],undefined,_0x1e7b7a);if(_0x1abe77[_0xb84a('0xa2')]!==-0x1){this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x141'),_0x25793c));var _0x5a373f=this[_0xb84a('0x7f')]['sync'](this,_0x455fb9,_0x25793c);if(_0x5a373f){for(var _0x32f040 in _0x5a373f){if(_0x5a373f[_0xb84a('0x8e')](_0x32f040)){this[_0xb84a('0x33')][_0xb84a('0x97')](util[_0xb84a('0x96')]('ISPEECH_ASR_%s',_0x32f040['toUpperCase']()),_0x5a373f[_0x32f040]);}}return this['channel'][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x142'),JSON[_0xb84a('0x6e')](_0x5a373f)));}}return _0x1abe77;};AGIVertices[_0xb84a('0xe')]['ispeechtts']=function(_0x523e08){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x143'),_0x523e08['label']));if(!this[_0xb84a('0x80')](_0x523e08[_0xb84a('0x7c')])){return this[_0xb84a('0x33')]['noop']('no\x20key\x20configured');}if(!this[_0xb84a('0x80')](_0x523e08[_0xb84a('0x58')])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0xa0'));}this[_0xb84a('0x33')][_0xb84a('0xa3')](util['format'](_0xb84a('0x144'),_0x523e08[_0xb84a('0x58')]));var _0x3551dd=this[_0xb84a('0x7b')][_0xb84a('0x6c')](this,_0x523e08);if(_0x3551dd){this['channel'][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x141'),_0x3551dd));var _0xc56f23=this[_0xb84a('0x33')][_0xb84a('0xf6')](_0x3551dd,_0x523e08[_0xb84a('0x123')]);try{fs[_0xb84a('0xf7')](_0x3551dd+_0xb84a('0xf8'));}catch(_0x38fc63){logger[_0xb84a('0x28')](_0x38fc63);}return _0xc56f23;}return this['channel'][_0xb84a('0x28')](_0x523e08,_0xb84a('0x145'));};AGIVertices[_0xb84a('0xe')]['login']=function(_0x5036ad){logger['info'](util[_0xb84a('0x96')](_0xb84a('0x146'),_0x5036ad[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x5036ad[_0xb84a('0x147')])){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x5036ad,_0xb84a('0x148'));}logger[_0xb84a('0x2a')](util[_0xb84a('0x96')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xb84a('0x33')][_0xb84a('0x38')],_0x5036ad[_0xb84a('0x147')]));var _0x5c4add=this[_0xb84a('0x4f')][_0xb84a('0x6c')](this,_0x5036ad[_0xb84a('0x147')]);if(_0x5c4add){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x149'),this[_0xb84a('0x33')]['callerid'],_0x5036ad[_0xb84a('0x147')]));this['channel']['noop'](util['format'](_0xb84a('0x149'),this[_0xb84a('0x33')][_0xb84a('0x38')],_0x5036ad[_0xb84a('0x147')]));return{'code':0xc8,'result':_0xb84a('0x14a')};}else{logger['info'](util[_0xb84a('0x96')](_0xb84a('0x14b'),this[_0xb84a('0x33')]['callerid'],_0x5036ad[_0xb84a('0x147')]));this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x14b'),this[_0xb84a('0x33')]['callerid'],_0x5036ad['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xb84a('0x14c')]=function(_0x344dce){logger['info'](util[_0xb84a('0x96')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x344dce[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x344dce[_0xb84a('0x147')])){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x344dce,_0xb84a('0x148'));}logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x14d'),this[_0xb84a('0x33')][_0xb84a('0x38')],_0x344dce[_0xb84a('0x147')]));var _0x307c39=this[_0xb84a('0x4e')][_0xb84a('0x6c')](this,_0x344dce['findBy']);if(_0x307c39){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x344dce[_0xb84a('0x147')]));this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb84a('0x33')]['callerid'],_0x344dce['findBy']));return{'code':0xc8,'result':_0xb84a('0x14a')};}else{logger['info'](util[_0xb84a('0x96')](_0xb84a('0x14b'),this[_0xb84a('0x33')]['callerid'],_0x344dce[_0xb84a('0x147')]));this['channel'][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x14b'),this[_0xb84a('0x33')]['callerid'],_0x344dce[_0xb84a('0x147')]));return{'code':0xc8,'result':_0xb84a('0x14e')};}};AGIVertices['prototype'][_0xb84a('0x14f')]=function(_0x34fa09){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x150'),_0x34fa09['label']));if(!this[_0xb84a('0x80')](_0x34fa09['operation'])){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x34fa09,_0xb84a('0x151'));}this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x152'),_0x34fa09[_0xb84a('0x153')]));var _0x280e82=eval(_0x34fa09[_0xb84a('0x153')]);if(!this[_0xb84a('0x80')](_0x34fa09['variable_id'])){return this[_0xb84a('0x33')]['noop'](_0xb84a('0xd0'));}var _0x325995=this[_0xb84a('0x9c')][_0xb84a('0x6c')](this,_0x34fa09[_0xb84a('0xcf')]);if(!_0x325995){return this[_0xb84a('0x33')]['error'](_0x34fa09,'no\x20variable\x20found');}if(_[_0xb84a('0x92')](_0x280e82)){var _0x5d3c8b=this;_0x280e82[_0xb84a('0xd2')](function(_0x49858b,_0x460a29){_0x5d3c8b['channel'][_0xb84a('0x97')](util[_0xb84a('0x96')](_0xb84a('0x154'),_0x325995,_0x460a29),_0x49858b);});return this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x155'),_0x325995));}else{return this[_0xb84a('0x33')][_0xb84a('0x97')](_0x325995,_0x280e82);}};AGIVertices[_0xb84a('0xe')]['menu']=function(_0x19a35a){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x156'),_0x19a35a[_0xb84a('0x35')]));if(_0x19a35a[_0xb84a('0x103')]===0x0){return this[_0xb84a('0x9d')](_0x19a35a);}_0x19a35a['retry']-=0x1;if(!this[_0xb84a('0x80')](_0x19a35a[_0xb84a('0x104')])){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x19a35a,_0xb84a('0x105'));}var _0x2b58a4=this[_0xb84a('0x1d')][_0xb84a('0x6c')](this,_0x19a35a[_0xb84a('0x104')]);if(!_0x2b58a4){return this['channel']['error'](_0x19a35a,_0xb84a('0x106'));}var _0x37794c=this[_0xb84a('0x33')][_0xb84a('0x107')](_0x2b58a4,_0x19a35a[_0xb84a('0x157')],_0x19a35a['digit']);var _0xe1a56=_0x37794c['result'];if(_0x37794c[_0xb84a('0xa2')]===-0x1){this[_0xb84a('0x32')][_0xb84a('0x6c')](this,_0x19a35a,'-1');return _0x37794c;}else if(_0x37794c['extra']==='timeout'){_0x37794c[_0xb84a('0xa2')]=_0x37794c[_0xb84a('0xa2')][_0xb84a('0x93')]>0x0?_0x37794c[_0xb84a('0xa2')]:'t';}else if(_[_0xb84a('0x43')](_0x37794c['result'])){_0x37794c[_0xb84a('0xa2')]='#';_0xe1a56='#';}if(!this[_0xb84a('0x80')](_0x19a35a[_0xb84a('0xcf')])){this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0xd0'));}else{var _0x2e10c0=this[_0xb84a('0x9c')][_0xb84a('0x6c')](this,_0x19a35a[_0xb84a('0xcf')]);if(!_0x2e10c0){return this[_0xb84a('0x33')]['error'](_0x19a35a,_0xb84a('0xd1'));}this[_0xb84a('0x33')][_0xb84a('0x97')](_0x2e10c0,_0xe1a56);}this[_0xb84a('0x32')]['sync'](this,_0x19a35a,_0xe1a56);return _0x37794c;};AGIVertices['prototype']['noop']=function(_0x41fba0){logger[_0xb84a('0x2a')](util['format'](_0xb84a('0x158'),_0x41fba0[_0xb84a('0x35')]));return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0x41fba0['output']||_0x41fba0[_0xb84a('0x35')]);};AGIVertices[_0xb84a('0xe')][_0xb84a('0x159')]=function(_0x4656f9){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x15a'),_0x4656f9[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x4656f9[_0xb84a('0x147')])){return this['channel'][_0xb84a('0x28')](_0x4656f9,_0xb84a('0x148'));}logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x14d'),this[_0xb84a('0x33')]['callerid'],_0x4656f9[_0xb84a('0x147')]));var _0x6625cf=this['getPause'][_0xb84a('0x6c')](this,_0x4656f9[_0xb84a('0x15b')]);var _0x14f4b6=this['agentPause']['sync'](this,_0x4656f9[_0xb84a('0x147')],_0x6625cf);if(_0x14f4b6){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xb84a('0x33')][_0xb84a('0x38')],_0x4656f9[_0xb84a('0x147')]));this[_0xb84a('0x33')][_0xb84a('0xa3')](util['format'](_0xb84a('0x149'),this[_0xb84a('0x33')][_0xb84a('0x38')],_0x4656f9[_0xb84a('0x147')]));return{'code':0xc8,'result':'success'};}else{logger[_0xb84a('0x2a')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xb84a('0x33')]['callerid'],_0x4656f9[_0xb84a('0x147')]));this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xb84a('0x38')],_0x4656f9[_0xb84a('0x147')]));return{'code':0xc8,'result':_0xb84a('0x14e')};}};AGIVertices['prototype'][_0xb84a('0x15c')]=function(_0x1d0d33){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x15d'),_0x1d0d33[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x1d0d33[_0xb84a('0x104')])){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x1d0d33,_0xb84a('0x105'));}var _0x2a31ae=this[_0xb84a('0x1d')][_0xb84a('0x6c')](this,_0x1d0d33[_0xb84a('0x104')]);if(!_0x2a31ae){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x1d0d33,_0xb84a('0x106'));}var _0x24fd28=this[_0xb84a('0x33')][_0xb84a('0x52')](_0xb84a('0x15e'),[_0x2a31ae,_0x1d0d33['opts']]);if(_0x24fd28[_0xb84a('0xa2')]===-0x1){return _0x24fd28;}return this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0xba'),'PLAYBACK',_0x2a31ae));};AGIVertices[_0xb84a('0xe')][_0xb84a('0x15f')]=function(_0x463e6c){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x160'),_0x463e6c[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x463e6c[_0xb84a('0x161')])){return this['channel'][_0xb84a('0x28')](_0x463e6c,_0xb84a('0x162'));}var _0x488030='';var _0x1456e8=parseInt(_0x463e6c[_0xb84a('0x161')],0xa);if(isNaN(_0x1456e8)){_0x488030=_0x463e6c[_0xb84a('0x161')];}else{_0x488030=this[_0xb84a('0x12')][_0xb84a('0x6c')](this,_0x463e6c[_0xb84a('0x161')]);if(!_0x488030){return this['channel'][_0xb84a('0x28')](_0x463e6c,_0xb84a('0x163'));}}var _0x13a79f='';if(this[_0xb84a('0x80')](_0x463e6c[_0xb84a('0x104')])){var _0x2a8649=this[_0xb84a('0x1d')][_0xb84a('0x6c')](this,_0x463e6c['file_id']);if(_0x2a8649){_0x13a79f=_0x2a8649;}}this[_0xb84a('0x32')][_0xb84a('0x6c')](this,_0x463e6c,_0x488030);if(_0x463e6c['opts'][_0xb84a('0x164')]('x')<0x0){_0x463e6c[_0xb84a('0xdb')]+='x';}if(_0x463e6c[_0xb84a('0xdb')][_0xb84a('0x164')]('X')<0x0){_0x463e6c[_0xb84a('0xdb')]+='X';}this[_0xb84a('0x33')][_0xb84a('0x97')]('XMCS-QUEUE',_0x488030?_0x488030[_0xb84a('0x165')]():'');var _0x49dcf9=this[_0xb84a('0x33')][_0xb84a('0x52')](_0xb84a('0x166'),[_0x488030,_0x463e6c['opts'],_0x463e6c[_0xb84a('0xdc')],_0x13a79f,_0x463e6c['timeout'],_0x463e6c[_0xb84a('0x7')],_0x463e6c[_0xb84a('0x167')],_0x463e6c[_0xb84a('0x168')],'',_0x463e6c[_0xb84a('0x169')]]);if(_0x49dcf9[_0xb84a('0xa2')]===-0x1){return _0x49dcf9;}return this[_0xb84a('0x33')][_0xb84a('0xa3')](util['format'](_0xb84a('0xba'),_0xb84a('0x166'),_0x488030));};AGIVertices[_0xb84a('0xe')][_0xb84a('0x16a')]=function(_0x2b3616){logger[_0xb84a('0x2a')](util['format'](_0xb84a('0x16b'),_0x2b3616[_0xb84a('0x35')]));var _0x4f1ad0=_0x2b3616[_0xb84a('0x16c')]||_0xb84a('0x11f');var _0x16dc93=util[_0xb84a('0x96')](_0xb84a('0x16d'),this[_0xb84a('0x33')][_0xb84a('0x34')],rs['generate'](0x5));var _0x239a83=util['format'](_0xb84a('0x16e'),FILES_PATH,_0x16dc93,_0x4f1ad0);var _0x1a4fcc=util[_0xb84a('0x96')](_0xb84a('0x120'),FILES_PATH,_0x16dc93);this[_0xb84a('0x39')][_0xb84a('0x6c')](this,_0x2b3616,_0x16dc93,_0x239a83);this[_0xb84a('0x33')]['setVariable'](_0xb84a('0x16f'),_0x16dc93);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x1a4fcc,_0x4f1ad0,_0x2b3616[_0xb84a('0x170')],_0x2b3616[_0xb84a('0x60')]);return this[_0xb84a('0x33')][_0xb84a('0x122')](_0x1a4fcc,_0x4f1ad0,_0x2b3616['escape_digits'],_0x2b3616[_0xb84a('0x60')],undefined,!![]);};AGIVertices[_0xb84a('0xe')][_0xb84a('0x171')]=function(_0x4c2a4d){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x172'),_0x4c2a4d['label']));if(!this[_0xb84a('0x80')](_0x4c2a4d[_0xb84a('0xdc')])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0x173'));}var _0x5a0558=this[_0xb84a('0x174')][_0xb84a('0x6c')](this,_0x4c2a4d);logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x175'),util[_0xb84a('0x176')](_0x5a0558,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x4c2a4d[_0xb84a('0xcf')])){return this[_0xb84a('0x33')][_0xb84a('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x4eee5e=this[_0xb84a('0x9c')][_0xb84a('0x6c')](this,_0x4c2a4d[_0xb84a('0xcf')]);if(!_0x4eee5e){return this[_0xb84a('0x33')]['error'](_0x4c2a4d,'no\x20variable\x20found');}this[_0xb84a('0x33')][_0xb84a('0x97')](util[_0xb84a('0x96')](_0xb84a('0x177'),_0x4eee5e),_0x5a0558['statusCode']?_0x5a0558['statusCode']:_0xb84a('0x178'));this[_0xb84a('0x33')]['setVariable'](util[_0xb84a('0x96')]('%s_STATUS_MESSAGE',_0x4eee5e),_0x5a0558['statusMessage']?_0x5a0558[_0xb84a('0x70')]:'OK');if(_0x5a0558[_0xb84a('0x65')]){try{this[_0xb84a('0x94')](_0x5a0558[_0xb84a('0x65')],_0x4eee5e);}catch(_0x4c9c56){logger[_0xb84a('0x28')](util[_0xb84a('0x96')](_0xb84a('0x179'),_0x4eee5e));}}return this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')]('variable\x20%s\x20set',_0x4eee5e));};AGIVertices[_0xb84a('0xe')][_0xb84a('0x17a')]=function(_0x4f4003){logger[_0xb84a('0x2a')](util['format'](_0xb84a('0x17b'),_0x4f4003[_0xb84a('0x35')]));return this[_0xb84a('0x33')][_0xb84a('0x17c')](_0x4f4003['digits'][_0xb84a('0x54')](/\s+/g,''),_0x4f4003[_0xb84a('0x170')]);};AGIVertices[_0xb84a('0xe')][_0xb84a('0x17d')]=function(_0x1ccfeb){logger[_0xb84a('0x2a')](util['format'](_0xb84a('0x17e'),_0x1ccfeb[_0xb84a('0x35')]));return this[_0xb84a('0x33')][_0xb84a('0x17f')](_0x1ccfeb[_0xb84a('0x180')][_0xb84a('0x54')](/\s+/g,''),_0x1ccfeb[_0xb84a('0x170')]);};AGIVertices[_0xb84a('0xe')][_0xb84a('0x181')]=function(_0x2d37eb){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x182'),_0x2d37eb[_0xb84a('0x35')]));return this[_0xb84a('0x33')]['sayPhonetic'](_0x2d37eb[_0xb84a('0x58')],_0x2d37eb[_0xb84a('0x170')]);};AGIVertices[_0xb84a('0xe')][_0xb84a('0x183')]=function(_0x32d3f9){logger['info'](util[_0xb84a('0x96')](_0xb84a('0x184'),_0x32d3f9[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x32d3f9[_0xb84a('0x185')])){return this['channel']['noop'](_0xb84a('0x186'));}var _0x37c02b=this[_0xb84a('0x187')][_0xb84a('0x6c')](this,_0x32d3f9[_0xb84a('0x185')]);if(!_0x37c02b||!_0x37c02b[_0xb84a('0x188')]){return this['channel'][_0xb84a('0x28')](_0x32d3f9,_0xb84a('0x189'));}var _0x3ff7f0={'from':util['format'](_0xb84a('0x18a'),_0x37c02b[_0xb84a('0x11')],_0x37c02b['email']||_0x37c02b[_0xb84a('0x188')][_0xb84a('0x18b')]),'to':_0x32d3f9['to']||'','cc':_0x32d3f9['cc']||'','bcc':_0x32d3f9[_0xb84a('0x18c')]||'','subject':_0x32d3f9[_0xb84a('0x18d')],'html':_0x32d3f9[_0xb84a('0x58')],'text':_0x32d3f9['text']};if(this['isConfigured'](_0x32d3f9[_0xb84a('0x18e')])){}logger[_0xb84a('0xd7')](_0xb84a('0x18f'),JSON[_0xb84a('0x6e')](_0x3ff7f0));this['createSquareDetailsReport'][_0xb84a('0x6c')](this,_0x32d3f9,_0x32d3f9['account_id']);this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x190'),_0x37c02b[_0xb84a('0x11')]));this[_0xb84a('0x21')][_0xb84a('0x6c')](this,_0x37c02b[_0xb84a('0x191')],_0x3ff7f0);return this[_0xb84a('0x33')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xb84a('0xe')][_0xb84a('0x192')]=function(_0x23a779){logger[_0xb84a('0x2a')](util['format'](_0xb84a('0x193'),_0x23a779['label']));return this['channel']['noop'](_0xb84a('0x194'));};AGIVertices[_0xb84a('0xe')][_0xb84a('0x195')]=function(_0xcc10bc){logger['info'](util[_0xb84a('0x96')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0xcc10bc[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0xcc10bc[_0xb84a('0x196')])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0x197'));}var _0x2c7a19=this[_0xb84a('0x2f')][_0xb84a('0x6c')](this,_0xcc10bc[_0xb84a('0x196')]);if(!_0x2c7a19){return this['channel'][_0xb84a('0x28')](_0xcc10bc,_0xb84a('0x198'));}var _0x56f67c={'body':_0xcc10bc[_0xb84a('0x199')],'phone':_0xcc10bc['to']||'','SmsAccountId':_0x2c7a19['id']};logger[_0xb84a('0xd7')](_0xb84a('0x19a'),JSON[_0xb84a('0x6e')](_0x56f67c));this[_0xb84a('0x32')][_0xb84a('0x6c')](this,_0xcc10bc,_0xcc10bc[_0xb84a('0x196')]);this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x2c7a19['name']));this['createSmsMessage'][_0xb84a('0x6c')](this,_0x56f67c);return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0x19b'));};AGIVertices[_0xb84a('0xe')][_0xb84a('0x19c')]=function(_0x514709){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x19d'),_0x514709[_0xb84a('0x35')]));if(!this['isConfigured'](_0x514709['variable_id'])){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x514709,_0xb84a('0x19e'));}var _0x49121d=this[_0xb84a('0x9c')][_0xb84a('0x6c')](this,_0x514709[_0xb84a('0xcf')]);if(!_0x49121d){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x514709,_0xb84a('0xd1'));}return this[_0xb84a('0x33')][_0xb84a('0x97')](_0x49121d,_0x514709[_0xb84a('0x19f')]);};AGIVertices['prototype'][_0xb84a('0x1a0')]=function(_0x3452ad){logger['info'](util['format'](_0xb84a('0x1a1'),_0x3452ad[_0xb84a('0x35')]));this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0x1a2'));var _0x279cf1=this[_0xb84a('0x33')]['getVariable']('XMCS-UNIQUEID');if(!_[_0xb84a('0x43')](_0x279cf1['extra'])){this[_0xb84a('0x33')][_0xb84a('0x34')]=_0x279cf1[_0xb84a('0x9b')];}if(_0x3452ad['answer']===_0xb84a('0x1a3')){this[_0xb84a('0x33')]['noop'](_0xb84a('0x1a4'));return this['channel'][_0xb84a('0xb2')]();}return this[_0xb84a('0x33')]['noop'](_0xb84a('0x1a5'));};AGIVertices[_0xb84a('0xe')][_0xb84a('0x1a6')]=function(_0x550e17){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x1a7'),_0x550e17[_0xb84a('0x35')]));if(!this[_0xb84a('0x80')](_0x550e17['project_id'])){return this[_0xb84a('0x33')]['error'](_0x550e17,_0xb84a('0x1a8'));}var _0x19770e=this[_0xb84a('0x15')][_0xb84a('0x6c')](this,_0x550e17['project_id']);if(!this[_0xb84a('0x80')](_0x19770e)){return this['channel'][_0xb84a('0x28')](_0x550e17,util[_0xb84a('0x96')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x550e17[_0xb84a('0x1a9')]));}if(_0x19770e===this['channel']['arg_1']){return this[_0xb84a('0x33')]['error'](_0x550e17,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xb84a('0x32')][_0xb84a('0x6c')](this,_0x550e17,_0x19770e);var _0x38cd6a=this[_0xb84a('0x33')]['exec'](_0xb84a('0x1aa'),util[_0xb84a('0x96')](_0xb84a('0x1ab'),config[_0xb84a('0x7')][_0xb84a('0x1ac')]||'127.0.0.1',_0x19770e,this['channel'][_0xb84a('0x37')]));if(_0x38cd6a['result']===-0x1){return _0x38cd6a;}return this[_0xb84a('0x33')]['noop'](util[_0xb84a('0x96')](_0xb84a('0xba'),'AGI',_0x19770e));};AGIVertices[_0xb84a('0xe')]['system']=function(_0x351460){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x351460[_0xb84a('0x35')]));var _0x253998=this[_0xb84a('0x1ad')][_0xb84a('0x6c')](this,_0x351460['command']);this[_0xb84a('0x32')]['sync'](this,_0x351460,_0x351460[_0xb84a('0xb0')]);if(this['isConfigured'](_0x351460['variable_id'])){var _0x2a2545=this[_0xb84a('0x9c')]['sync'](this,_0x351460[_0xb84a('0xcf')]);if(_0x2a2545){this['channel'][_0xb84a('0x97')](_0x2a2545,_0x253998);return this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x1ae'),_0x351460[_0xb84a('0xb0')],_0x2a2545));}}return this['channel']['noop'](util[_0xb84a('0x96')](_0xb84a('0x1af'),_0x351460[_0xb84a('0xb0')]));};AGIVertices[_0xb84a('0xe')][_0xb84a('0x1b0')]=function(_0x489721){logger['info'](util[_0xb84a('0x96')](_0xb84a('0x1b1'),_0x489721[_0xb84a('0x35')]));_0x489721[_0xb84a('0x58')]=_0x489721['text'][_0xb84a('0x54')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb84a('0x80')](_0x489721[_0xb84a('0x56')])){return this['channel'][_0xb84a('0xa3')](_0xb84a('0x1b2'));}if(!this[_0xb84a('0x80')](_0x489721['text'])){return this[_0xb84a('0x33')][_0xb84a('0xa3')](_0xb84a('0xa0'));}this[_0xb84a('0x33')][_0xb84a('0xa3')](util['format'](_0xb84a('0x1b3'),_0x489721[_0xb84a('0x58')]));var _0xaf0de6=this[_0xb84a('0x55')][_0xb84a('0x6c')](this,_0x489721);if(_0xaf0de6){this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x1b4'),_0xaf0de6));var _0x440613=this[_0xb84a('0x33')]['streamFile'](_0xaf0de6);try{fs['unlink'](_0xaf0de6+'.wav');}catch(_0x2c6266){logger[_0xb84a('0x28')](_0x2c6266);}return _0x440613;}return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x489721,_0xb84a('0x1b5'));};AGIVertices[_0xb84a('0xe')][_0xb84a('0x1b6')]=function(_0x4b335e){logger[_0xb84a('0x2a')](util['format'](_0xb84a('0x1b7'),_0x4b335e['label']));_0x4b335e['text']=_0x4b335e[_0xb84a('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4b335e['text'])){return this[_0xb84a('0x33')]['noop'](_0xb84a('0xa0'));}this['channel'][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x1b8'),_0x4b335e[_0xb84a('0x58')]));var _0x4bf8a5=this[_0xb84a('0x5e')][_0xb84a('0x6c')](this,_0x4b335e);if(_0x4bf8a5){this[_0xb84a('0x33')]['noop'](util[_0xb84a('0x96')]('Google\x20TTS\x20%s\x20file\x20created',_0x4bf8a5));var _0x2302d5=this[_0xb84a('0x33')][_0xb84a('0xf6')](_0x4bf8a5);try{fs[_0xb84a('0xf7')](_0x4bf8a5+_0xb84a('0xf8'));}catch(_0x477865){logger['error'](_0x477865);}return _0x2302d5;}return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x4b335e,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xb84a('0x1b9')]=function(_0x22800e){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x1ba'),_0x22800e['label']));if(!this[_0xb84a('0x80')](_0x22800e[_0xb84a('0x147')])){return this['channel']['error'](_0x22800e,'no\x20find\x20by\x20configured');}logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x14d'),this[_0xb84a('0x33')][_0xb84a('0x38')],_0x22800e[_0xb84a('0x147')]));var _0x5a597c=this[_0xb84a('0x4c')][_0xb84a('0x6c')](this,_0x22800e[_0xb84a('0x147')]);if(_0x5a597c){logger[_0xb84a('0x2a')](util['format'](_0xb84a('0x149'),this[_0xb84a('0x33')][_0xb84a('0x38')],_0x22800e[_0xb84a('0x147')]));this[_0xb84a('0x33')]['noop'](util[_0xb84a('0x96')](_0xb84a('0x149'),this['channel'][_0xb84a('0x38')],_0x22800e[_0xb84a('0x147')]));return{'code':0xc8,'result':'success'};}else{logger[_0xb84a('0x2a')](util[_0xb84a('0x96')](_0xb84a('0x14b'),this[_0xb84a('0x33')][_0xb84a('0x38')],_0x22800e[_0xb84a('0x147')]));this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0x14b'),this['channel'][_0xb84a('0x38')],_0x22800e['findBy']));return{'code':0xc8,'result':_0xb84a('0x14e')};}};AGIVertices['prototype'][_0xb84a('0x1bb')]=function(_0x24ee3c){logger['info'](util['format']('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x24ee3c[_0xb84a('0x35')]));var _0x47f829=this['channel']['exec']('VOICEMAIL',[_0x24ee3c[_0xb84a('0x1bc')],_0x24ee3c['options']]);if(_0x47f829[_0xb84a('0xa2')]===-0x1){return _0x47f829;}return this[_0xb84a('0x33')][_0xb84a('0xa3')](util[_0xb84a('0x96')](_0xb84a('0xba'),_0xb84a('0x1bd'),_0x24ee3c[_0xb84a('0x1bc')]));};AGIVertices[_0xb84a('0xe')][_0xb84a('0x1be')]=function(_0x370a6a){logger[_0xb84a('0x2a')](util[_0xb84a('0x96')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x370a6a['label']));if(!this[_0xb84a('0x80')](_0x370a6a[_0xb84a('0xcf')])){return this[_0xb84a('0x33')]['error'](_0x370a6a,_0xb84a('0x19e'));}var _0xd54914=this[_0xb84a('0x9c')][_0xb84a('0x6c')](this,_0x370a6a[_0xb84a('0xcf')]);if(!_0xd54914){return this[_0xb84a('0x33')][_0xb84a('0x28')](_0x370a6a,_0xb84a('0xd1'));}var _0x1f82fb=this['channel'][_0xb84a('0x9c')](_0xd54914);return{'code':0xc8,'result':_0x1f82fb[_0xb84a('0x9b')]?_0x1f82fb[_0xb84a('0x9b')]:'-'};};String[_0xb84a('0xe')][_0xb84a('0x9a')]=function(_0x5d77a6,_0xba3c9f){return this[_0xb84a('0x99')](_0x5d77a6)[_0xb84a('0x1bf')](_0xba3c9f);};module[_0xb84a('0x1c0')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 0bac53f..e8991dc 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 _0x0627=['[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','then','info','catch','error','[%s][UPDATE][ERRORS:%s]','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','uniqueid','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','getAgent','pauseType','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0x0627,0x11b));var _0x7062=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x0627[_0x432fca];return _0x3adba4;};'use strict';var _=require('lodash');var moment=require(_0x7062('0x0'));var ami=require(_0x7062('0x1'));var logger=require(_0x7062('0x2'))('acw');var RpcUser=require(_0x7062('0x3'));var RpcVoiceAgentReport=require(_0x7062('0x4'));function Acw(_0x5f2538){this[_0x7062('0x5')]=_0x5f2538['voiceQueues'];this[_0x7062('0x6')]=_0x5f2538[_0x7062('0x6')];this['timers']=_0x5f2538[_0x7062('0x7')];this[_0x7062('0x8')]={};ami['on'](_0x7062('0x9'),this[_0x7062('0xa')][_0x7062('0xb')](this));ami['on']('hanguprequest',this[_0x7062('0xc')][_0x7062('0xb')](this));ami['on'](_0x7062('0xd'),this[_0x7062('0xe')]['bind'](this));ami['on'](_0x7062('0xf'),this[_0x7062('0x10')][_0x7062('0xb')](this));ami['on'](_0x7062('0x11'),this['syncAttendedTransfer'][_0x7062('0xb')](this));ami['on'](_0x7062('0x12'),this['syncBlindTransfer']['bind'](this));ami['on'](_0x7062('0x13'),this['syncAgentConnectPreview'][_0x7062('0xb')](this));}function getDiff(_0xfb42b2){var _0x564995=moment()[_0x7062('0x14')](0x0);var _0x5cfaeb=moment(_0xfb42b2)[_0x7062('0x14')](0x0);return _0x564995[_0x7062('0x15')](_0x5cfaeb,_0x7062('0x16'));}Acw[_0x7062('0x17')][_0x7062('0x18')]=function(_0x369f61,_0x4fdff1){var _0x218ed1=this;var _0x1baff6=getDiff(_0x218ed1[_0x7062('0x7')][_0x369f61][_0x7062('0x19')]);clearTimeout(_0x218ed1['timers'][_0x369f61][_0x7062('0x1a')]);_0x218ed1[_0x7062('0x7')][_0x369f61]['timer']=![];return RpcVoiceAgentReport[_0x7062('0x1b')]({'acwtime':_0x1baff6},_0x218ed1[_0x7062('0x7')][_0x369f61]['uniqueid'],_0x369f61)[_0x7062('0x1c')](function(_0x103019){logger[_0x7062('0x1d')]('[%s][UPDATE][ACWTIME:%s]',_0x4fdff1,_0x1baff6,_0x103019);})[_0x7062('0x1e')](function(_0x9c5ab9){logger[_0x7062('0x1f')](_0x7062('0x20'),_0x4fdff1,_0x9c5ab9);})['finally'](function(){delete _0x218ed1[_0x7062('0x7')][_0x369f61];});};Acw['prototype']['startAcw']=function(_0x262c4b){try{var _0x513d2d=this;var _0xd305fe=this['channels'][_0x262c4b]['interface'];var _0x252c95=this[_0x7062('0x8')][_0x262c4b][_0x7062('0x21')];var _0x3394cc=this[_0x7062('0x5')][_0x252c95];var _0x1aea1b=![];var _0x57fe2b=_0x7062('0x22');if(_0x3394cc[_0x7062('0x23')]&&_0x3394cc['mandatoryDispositionPause']['name']){_0x1aea1b=!![];_0x57fe2b=_0x3394cc[_0x7062('0x24')][_0x7062('0x25')];}if(!_0x513d2d[_0x7062('0x6')][_0xd305fe]){return Promise[_0x7062('0x26')]();}return RpcUser['getAgent'](_0x513d2d['agents'][_0xd305fe]['id'])[_0x7062('0x1c')](function(_0x404a2c){if(!_0x404a2c||_0x404a2c[_0x7062('0x27')]){logger[_0x7062('0x1d')](_0x7062('0x28'),_0x262c4b,_0xd305fe,_0x252c95);return;}logger[_0x7062('0x1d')](_0x7062('0x29'),_0x262c4b,_0xd305fe,_0x252c95);var _0x1da1fb=_0x513d2d[_0x7062('0x8')][_0x262c4b]['attended']&&_0x513d2d['channels'][_0x262c4b][_0x7062('0x2a')]?_0x513d2d[_0x7062('0x8')][_0x262c4b][_0x7062('0x2a')]:_0x262c4b;return RpcUser[_0x7062('0x2b')](_0x513d2d[_0x7062('0x6')][_0xd305fe],_0x57fe2b,_0x1da1fb)[_0x7062('0x1c')](function(_0x2cc35c){_0x513d2d[_0x7062('0x5')][_0x252c95][_0x7062('0x2c')]-=0x1;_0x513d2d[_0x7062('0x5')][_0x252c95][_0x7062('0x2d')]+=0x1;return _0x2cc35c;});})[_0x7062('0x1c')](function(_0x35ddd3){if(_0x1aea1b||!_0x35ddd3){return;}_0x513d2d[_0x7062('0x7')][_0xd305fe]={};logger[_0x7062('0x1d')](_0x7062('0x2e'),_0x262c4b,_0x513d2d[_0x7062('0x5')][_0x252c95][_0x7062('0x2f')],_0xd305fe,_0x252c95);_0x513d2d['timers'][_0xd305fe][_0x7062('0x1a')]=setTimeout(_0x513d2d[_0x7062('0x30')][_0x7062('0xb')](_0x513d2d,_0xd305fe),_0x513d2d[_0x7062('0x5')][_0x252c95][_0x7062('0x2f')]*0x3e8);_0x513d2d[_0x7062('0x7')][_0xd305fe]['lastPauseAt']=moment()[_0x7062('0x31')]('YYYY-MM-DD\x20HH:mm:ss');_0x513d2d[_0x7062('0x7')][_0xd305fe][_0x7062('0x32')]=_0x262c4b;_0x513d2d['timers'][_0xd305fe][_0x7062('0x21')]=_0x252c95;_0x513d2d[_0x7062('0x7')][_0xd305fe]['updateAcw']=_0x513d2d[_0x7062('0x18')][_0x7062('0xb')](_0x513d2d,_0xd305fe,_0x262c4b);})[_0x7062('0x1e')](function(){logger[_0x7062('0x1f')](_0x7062('0x2e'),_0x262c4b,_0x513d2d[_0x7062('0x5')][_0x252c95][_0x7062('0x2f')],_0xd305fe,_0x252c95);})['finally'](function(){delete _0x513d2d[_0x7062('0x8')][_0x262c4b];});}catch(_0x54f0af){logger[_0x7062('0x1f')](_0x7062('0x33'),_0x54f0af[_0x7062('0x34')]);}};Acw[_0x7062('0x17')][_0x7062('0x30')]=function(_0x369ebf){try{var _0x1a4d97=this;if(_0x1a4d97[_0x7062('0x7')][_0x369ebf]){_0x1a4d97[_0x7062('0x7')][_0x369ebf][_0x7062('0x1a')]=![];var _0x533ec7=_0x1a4d97[_0x7062('0x7')][_0x369ebf][_0x7062('0x32')];var _0x188891=_0x1a4d97[_0x7062('0x7')][_0x369ebf][_0x7062('0x21')];var _0x234dd3=_0x1a4d97['voiceQueues'][_0x188891][_0x7062('0x2f')];logger[_0x7062('0x1d')](_0x7062('0x35'),_0x533ec7,_0x369ebf);RpcUser[_0x7062('0x36')](this['agents'][_0x369ebf]['id'])[_0x7062('0x1c')](function(_0x2500b6){if(_0x2500b6[_0x7062('0x37')]===_0x7062('0x22')){return RpcUser['saveUnpause'](_0x1a4d97[_0x7062('0x6')][_0x369ebf]);}});RpcVoiceAgentReport[_0x7062('0x1b')]({'acwtime':_0x234dd3,'agentacw':!![]},_0x533ec7,_0x369ebf)['then'](function(_0x287e5f){logger[_0x7062('0x1d')](_0x7062('0x38'),_0x533ec7,_0x234dd3,_0x287e5f);})['catch'](function(_0x23cf4c){logger[_0x7062('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x533ec7,_0x23cf4c);});}else{logger[_0x7062('0x1f')](_0x7062('0x39'),_0x369ebf);if(_0x1a4d97[_0x7062('0x7')]){logger['info'](_0x7062('0x3a'),JSON[_0x7062('0x3b')](_0x1a4d97['timers']));}}}catch(_0x241df2){logger[_0x7062('0x1f')](_0x7062('0x3c'),_0x241df2[_0x7062('0x34')]);}};Acw[_0x7062('0x17')]['syncAgentConnect']=function(_0x50bfbc){try{if(this[_0x7062('0x5')][_0x50bfbc['queue']]&&(this['voiceQueues'][_0x50bfbc[_0x7062('0x21')]][_0x7062('0x3d')]||this[_0x7062('0x5')][_0x50bfbc[_0x7062('0x21')]][_0x7062('0x23')])){if(this['agents'][_0x50bfbc[_0x7062('0x3e')]]){this[_0x7062('0x8')][_0x50bfbc[_0x7062('0x32')]]={'queue':_0x50bfbc['queue'],'interface':_0x50bfbc['interface'],'destlinkedid':_0x50bfbc[_0x7062('0x2a')]};}}}catch(_0x22b74c){logger[_0x7062('0x1f')](_0x7062('0x3f'),_0x22b74c[_0x7062('0x34')]);}};Acw[_0x7062('0x17')][_0x7062('0x40')]=function(_0x2fe4d4){try{if(this[_0x7062('0x5')][_0x2fe4d4[_0x7062('0x21')]]&&(this[_0x7062('0x5')][_0x2fe4d4[_0x7062('0x21')]][_0x7062('0x3d')]||this[_0x7062('0x5')][_0x2fe4d4['queue']][_0x7062('0x23')])){if(this[_0x7062('0x6')][_0x2fe4d4[_0x7062('0x3e')]]){this['channels'][_0x2fe4d4['uniqueid']]={'queue':_0x2fe4d4[_0x7062('0x21')],'interface':_0x2fe4d4['interface']};}}}catch(_0x11671e){logger[_0x7062('0x1f')]('[ACW][syncAgentConnectPreview]\x20%s',_0x11671e[_0x7062('0x34')]);}};Acw[_0x7062('0x17')][_0x7062('0xc')]=function(_0x1a8658){try{if(this[_0x7062('0x8')][_0x1a8658[_0x7062('0x32')]]&&_[_0x7062('0x41')](this[_0x7062('0x8')][_0x1a8658[_0x7062('0x32')]]['attended'])){logger[_0x7062('0x1d')](_0x7062('0x42'),_0x1a8658[_0x7062('0x32')]);this[_0x7062('0x43')](_0x1a8658[_0x7062('0x32')]);}else if(this[_0x7062('0x8')][_0x1a8658[_0x7062('0x44')]]&&_['isUndefined'](this[_0x7062('0x8')][_0x1a8658[_0x7062('0x44')]][_0x7062('0x45')])){logger[_0x7062('0x1d')](_0x7062('0x46'),_0x1a8658[_0x7062('0x44')]);this[_0x7062('0x43')](_0x1a8658[_0x7062('0x44')]);}}catch(_0x22cf21){logger[_0x7062('0x1f')](_0x7062('0x47'),_0x22cf21[_0x7062('0x34')]);}};Acw[_0x7062('0x17')][_0x7062('0xe')]=function(_0x197a62){try{if(this['channels'][_0x197a62[_0x7062('0x32')]]&&this[_0x7062('0x8')][_0x197a62[_0x7062('0x32')]]['attended']){logger[_0x7062('0x1d')](_0x7062('0x48'),_0x197a62[_0x7062('0x32')]);this[_0x7062('0x43')](_0x197a62[_0x7062('0x32')]);}else if(this['channels'][_0x197a62[_0x7062('0x44')]]&&this[_0x7062('0x8')][_0x197a62['linkedid']][_0x7062('0x45')]){logger[_0x7062('0x1d')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x197a62['linkedid']);this[_0x7062('0x43')](_0x197a62[_0x7062('0x44')]);}}catch(_0x3e0a2b){logger['error'](_0x7062('0x49'),_0x3e0a2b[_0x7062('0x34')]);}};Acw[_0x7062('0x17')]['syncAttendedTransfer']=function(_0x2223e7){try{if(!_[_0x7062('0x4a')](this[_0x7062('0x8')][_0x2223e7[_0x7062('0x4b')]])){this['startAcw'](_0x2223e7[_0x7062('0x4b')]);if(this['channels'][_0x2223e7[_0x7062('0x4c')]]){this[_0x7062('0x8')][_0x2223e7[_0x7062('0x4c')]][_0x7062('0x45')]=!![];this[_0x7062('0x8')][_0x2223e7[_0x7062('0x4d')]]=this['channels'][_0x2223e7[_0x7062('0x4c')]];delete this[_0x7062('0x8')][_0x2223e7[_0x7062('0x4c')]];}}else if(!_[_0x7062('0x4a')](this[_0x7062('0x8')][_0x2223e7['transfertargetuniqueid']])){this[_0x7062('0x43')](_0x2223e7['transfertargetuniqueid']);if(this[_0x7062('0x8')][_0x2223e7[_0x7062('0x4e')]]){this[_0x7062('0x8')][_0x2223e7[_0x7062('0x4e')]][_0x7062('0x45')]=!![];this['channels'][_0x2223e7[_0x7062('0x4b')]]=this[_0x7062('0x8')][_0x2223e7[_0x7062('0x4e')]];delete this['channels'][_0x2223e7['origtransfereruniqueid']];}}}catch(_0x46a018){logger[_0x7062('0x1f')](_0x7062('0x4f'),_0x46a018['message']);}};Acw[_0x7062('0x17')]['syncBlindTransfer']=function(_0x48c74e){try{if(this[_0x7062('0x8')][_0x48c74e[_0x7062('0x50')]]){logger[_0x7062('0x1d')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x7062('0x3b')](_0x48c74e[_0x7062('0x50')]));this['startAcw'](_0x48c74e[_0x7062('0x50')]);}else if(this['channels'][_0x48c74e['transfererlinkedid']]){logger['info'](_0x7062('0x51'),JSON[_0x7062('0x3b')](_0x48c74e['transfererlinkedid']));this[_0x7062('0x43')](_0x48c74e[_0x7062('0x52')]);}}catch(_0x10b64f){logger[_0x7062('0x1f')](_0x7062('0x53'),_0x10b64f['message']);}};Acw[_0x7062('0x17')][_0x7062('0x10')]=function(_0x522d04){try{if(this[_0x7062('0x5')][_0x522d04['queue']]&&this['voiceQueues'][_0x522d04['queue']][_0x7062('0x54')]===_0x7062('0x55')){if(this[_0x7062('0x6')][_0x522d04[_0x7062('0x3e')]]){logger['info'](_0x7062('0x56'),_0x522d04[_0x7062('0x32')],_0x522d04[_0x7062('0x3e')],_0x522d04['queue']);return RpcUser[_0x7062('0x2b')](this['agents'][_0x522d04['interface']],_0x7062('0x57'),_0x522d04[_0x7062('0x32')]);}}}catch(_0x35df9d){logger[_0x7062('0x1f')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x35df9d[_0x7062('0x34')]);}};module[_0x7062('0x58')]=Acw; \ No newline at end of file +var _0xdace=['acwTimeout','timer','catch','finally','[ACW][START]\x20%s','message','stopAcw','pauseType','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','acw','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','syncAttendedTransfer','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid','transfererlinkedid','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','diff','seconds','prototype','updateAcw','lastPauseAt','update','uniqueid','info','error','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','getAgent','then','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdace,0xc9));var _0xedac=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0xdace[_0x5a7d5f];return _0x5dcded;};'use strict';var _=require(_0xedac('0x0'));var moment=require(_0xedac('0x1'));var ami=require(_0xedac('0x2'));var logger=require('../../../config/logger')('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xedac('0x3'));function Acw(_0x102aa2){this[_0xedac('0x4')]=_0x102aa2[_0xedac('0x4')];this['agents']=_0x102aa2[_0xedac('0x5')];this[_0xedac('0x6')]=_0x102aa2[_0xedac('0x6')];this[_0xedac('0x7')]={};ami['on'](_0xedac('0x8'),this['syncAgentConnect'][_0xedac('0x9')](this));ami['on'](_0xedac('0xa'),this[_0xedac('0xb')]['bind'](this));ami['on'](_0xedac('0xc'),this[_0xedac('0xd')][_0xedac('0x9')](this));ami['on'](_0xedac('0xe'),this[_0xedac('0xf')][_0xedac('0x9')](this));ami['on'](_0xedac('0x10'),this['syncAttendedTransfer'][_0xedac('0x9')](this));ami['on'](_0xedac('0x11'),this['syncBlindTransfer']['bind'](this));ami['on'](_0xedac('0x12'),this[_0xedac('0x13')][_0xedac('0x9')](this));}function getDiff(_0x440adf){var _0x20374a=moment()['milliseconds'](0x0);var _0x22f19c=moment(_0x440adf)['milliseconds'](0x0);return _0x20374a[_0xedac('0x14')](_0x22f19c,_0xedac('0x15'));}Acw[_0xedac('0x16')][_0xedac('0x17')]=function(_0x3d6990,_0x5c3589){var _0xc19bd5=this;var _0x483c6d=getDiff(_0xc19bd5[_0xedac('0x6')][_0x3d6990][_0xedac('0x18')]);clearTimeout(_0xc19bd5[_0xedac('0x6')][_0x3d6990]['timer']);_0xc19bd5[_0xedac('0x6')][_0x3d6990]['timer']=![];return RpcVoiceAgentReport[_0xedac('0x19')]({'acwtime':_0x483c6d},_0xc19bd5[_0xedac('0x6')][_0x3d6990][_0xedac('0x1a')],_0x3d6990)['then'](function(_0x10b4be){logger[_0xedac('0x1b')]('[%s][UPDATE][ACWTIME:%s]',_0x5c3589,_0x483c6d,_0x10b4be);})['catch'](function(_0x3970b0){logger[_0xedac('0x1c')]('[%s][UPDATE][ERRORS:%s]',_0x5c3589,_0x3970b0);})['finally'](function(){delete _0xc19bd5[_0xedac('0x6')][_0x3d6990];});};Acw['prototype'][_0xedac('0x1d')]=function(_0x682697){try{var _0x1037dd=this;var _0x39e445=this[_0xedac('0x7')][_0x682697]['interface'];var _0x552e05=this[_0xedac('0x7')][_0x682697][_0xedac('0x1e')];var _0x32c8b7=this[_0xedac('0x4')][_0x552e05];var _0x1b0c49=![];var _0x1d89f8=_0xedac('0x1f');if(_0x32c8b7[_0xedac('0x20')]&&_0x32c8b7[_0xedac('0x21')][_0xedac('0x22')]){_0x1b0c49=!![];_0x1d89f8=_0x32c8b7['mandatoryDispositionPause'][_0xedac('0x22')];}if(!_0x1037dd[_0xedac('0x5')][_0x39e445]){return Promise[_0xedac('0x23')]();}return RpcUser[_0xedac('0x24')](_0x1037dd['agents'][_0x39e445]['id'])[_0xedac('0x25')](function(_0x4b298b){if(!_0x4b298b||_0x4b298b['voicePause']){logger[_0xedac('0x1b')](_0xedac('0x26'),_0x682697,_0x39e445,_0x552e05);return;}logger[_0xedac('0x1b')](_0xedac('0x27'),_0x682697,_0x39e445,_0x552e05);var _0x1afe48=_0x1037dd[_0xedac('0x7')][_0x682697][_0xedac('0x28')]&&_0x1037dd[_0xedac('0x7')][_0x682697][_0xedac('0x29')]?_0x1037dd['channels'][_0x682697][_0xedac('0x29')]:_0x682697;return RpcUser[_0xedac('0x2a')](_0x1037dd[_0xedac('0x5')][_0x39e445],_0x1d89f8,_0x1afe48)[_0xedac('0x25')](function(_0x46e576){_0x1037dd[_0xedac('0x4')][_0x552e05][_0xedac('0x2b')]-=0x1;_0x1037dd[_0xedac('0x4')][_0x552e05]['paused']+=0x1;return _0x46e576;});})['then'](function(_0x1b05a9){if(_0x1b0c49||!_0x1b05a9){return;}_0x1037dd[_0xedac('0x6')][_0x39e445]={};logger['info'](_0xedac('0x2c'),_0x682697,_0x1037dd['voiceQueues'][_0x552e05][_0xedac('0x2d')],_0x39e445,_0x552e05);_0x1037dd[_0xedac('0x6')][_0x39e445][_0xedac('0x2e')]=setTimeout(_0x1037dd['stopAcw'][_0xedac('0x9')](_0x1037dd,_0x39e445),_0x1037dd[_0xedac('0x4')][_0x552e05]['acwTimeout']*0x3e8);_0x1037dd[_0xedac('0x6')][_0x39e445][_0xedac('0x18')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1037dd[_0xedac('0x6')][_0x39e445]['uniqueid']=_0x682697;_0x1037dd[_0xedac('0x6')][_0x39e445]['queue']=_0x552e05;_0x1037dd[_0xedac('0x6')][_0x39e445][_0xedac('0x17')]=_0x1037dd[_0xedac('0x17')][_0xedac('0x9')](_0x1037dd,_0x39e445,_0x682697);})[_0xedac('0x2f')](function(){logger[_0xedac('0x1c')](_0xedac('0x2c'),_0x682697,_0x1037dd[_0xedac('0x4')][_0x552e05][_0xedac('0x2d')],_0x39e445,_0x552e05);})[_0xedac('0x30')](function(){delete _0x1037dd[_0xedac('0x7')][_0x682697];});}catch(_0x392af2){logger[_0xedac('0x1c')](_0xedac('0x31'),_0x392af2[_0xedac('0x32')]);}};Acw[_0xedac('0x16')][_0xedac('0x33')]=function(_0x2c8d87){try{var _0x132506=this;if(_0x132506[_0xedac('0x6')][_0x2c8d87]){_0x132506[_0xedac('0x6')][_0x2c8d87][_0xedac('0x2e')]=![];var _0x2fa48d=_0x132506[_0xedac('0x6')][_0x2c8d87]['uniqueid'];var _0x5a6e5f=_0x132506[_0xedac('0x6')][_0x2c8d87][_0xedac('0x1e')];var _0x4851b8=_0x132506[_0xedac('0x4')][_0x5a6e5f]['acwTimeout'];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x2fa48d,_0x2c8d87);RpcUser[_0xedac('0x24')](this[_0xedac('0x5')][_0x2c8d87]['id'])['then'](function(_0x2fe91a){if(_0x2fe91a[_0xedac('0x34')]===_0xedac('0x1f')){return RpcUser['saveUnpause'](_0x132506['agents'][_0x2c8d87]);}});RpcVoiceAgentReport[_0xedac('0x19')]({'acwtime':_0x4851b8,'agentacw':!![]},_0x2fa48d,_0x2c8d87)['then'](function(_0x6d79ad){logger[_0xedac('0x1b')](_0xedac('0x35'),_0x2fa48d,_0x4851b8,_0x6d79ad);})[_0xedac('0x2f')](function(_0x77198f){logger[_0xedac('0x1c')](_0xedac('0x36'),_0x2fa48d,_0x77198f);});}else{logger[_0xedac('0x1c')](_0xedac('0x37'),_0x2c8d87);if(_0x132506['timers']){logger[_0xedac('0x1b')]('[ACW][TIMERS]',JSON[_0xedac('0x38')](_0x132506[_0xedac('0x6')]));}}}catch(_0x500895){logger['error'](_0xedac('0x39'),_0x500895['message']);}};Acw['prototype']['syncAgentConnect']=function(_0x549137){try{if(this[_0xedac('0x4')][_0x549137[_0xedac('0x1e')]]&&(this[_0xedac('0x4')][_0x549137[_0xedac('0x1e')]]['acw']||this[_0xedac('0x4')][_0x549137[_0xedac('0x1e')]][_0xedac('0x20')])){if(this[_0xedac('0x5')][_0x549137['interface']]){this[_0xedac('0x7')][_0x549137[_0xedac('0x1a')]]={'queue':_0x549137['queue'],'interface':_0x549137[_0xedac('0x3a')],'destlinkedid':_0x549137[_0xedac('0x29')]};}}}catch(_0x48a186){logger[_0xedac('0x1c')](_0xedac('0x3b'),_0x48a186[_0xedac('0x32')]);}};Acw[_0xedac('0x16')][_0xedac('0x13')]=function(_0x104a40){try{if(this[_0xedac('0x4')][_0x104a40[_0xedac('0x1e')]]&&(this[_0xedac('0x4')][_0x104a40[_0xedac('0x1e')]][_0xedac('0x3c')]||this[_0xedac('0x4')][_0x104a40['queue']][_0xedac('0x20')])){if(this['agents'][_0x104a40[_0xedac('0x3a')]]){this[_0xedac('0x7')][_0x104a40[_0xedac('0x1a')]]={'queue':_0x104a40['queue'],'interface':_0x104a40['interface']};}}}catch(_0xf8e571){logger[_0xedac('0x1c')](_0xedac('0x3d'),_0xf8e571[_0xedac('0x32')]);}};Acw[_0xedac('0x16')][_0xedac('0xb')]=function(_0x2bd8d5){try{if(this[_0xedac('0x7')][_0x2bd8d5['uniqueid']]&&_[_0xedac('0x3e')](this[_0xedac('0x7')][_0x2bd8d5[_0xedac('0x1a')]][_0xedac('0x28')])){logger[_0xedac('0x1b')](_0xedac('0x3f'),_0x2bd8d5['uniqueid']);this['startAcw'](_0x2bd8d5[_0xedac('0x1a')]);}else if(this[_0xedac('0x7')][_0x2bd8d5[_0xedac('0x40')]]&&_[_0xedac('0x3e')](this[_0xedac('0x7')][_0x2bd8d5[_0xedac('0x40')]]['attended'])){logger['info'](_0xedac('0x41'),_0x2bd8d5[_0xedac('0x40')]);this['startAcw'](_0x2bd8d5[_0xedac('0x40')]);}}catch(_0x2d1a60){logger[_0xedac('0x1c')](_0xedac('0x42'),_0x2d1a60['message']);}};Acw[_0xedac('0x16')][_0xedac('0xd')]=function(_0x284b30){try{if(this[_0xedac('0x7')][_0x284b30['uniqueid']]&&this[_0xedac('0x7')][_0x284b30[_0xedac('0x1a')]][_0xedac('0x28')]){logger['info'](_0xedac('0x43'),_0x284b30['uniqueid']);this[_0xedac('0x1d')](_0x284b30[_0xedac('0x1a')]);}else if(this[_0xedac('0x7')][_0x284b30[_0xedac('0x40')]]&&this[_0xedac('0x7')][_0x284b30[_0xedac('0x40')]]['attended']){logger[_0xedac('0x1b')](_0xedac('0x44'),_0x284b30[_0xedac('0x40')]);this['startAcw'](_0x284b30[_0xedac('0x40')]);}}catch(_0x31e3e0){logger[_0xedac('0x1c')]('[ACW][syncHangup]\x20%s',_0x31e3e0[_0xedac('0x32')]);}};Acw[_0xedac('0x16')][_0xedac('0x45')]=function(_0x3c7d70){try{if(!_[_0xedac('0x46')](this[_0xedac('0x7')][_0x3c7d70[_0xedac('0x47')]])){this[_0xedac('0x1d')](_0x3c7d70[_0xedac('0x47')]);if(this[_0xedac('0x7')][_0x3c7d70[_0xedac('0x48')]]){this[_0xedac('0x7')][_0x3c7d70[_0xedac('0x48')]]['attended']=!![];this['channels'][_0x3c7d70[_0xedac('0x49')]]=this[_0xedac('0x7')][_0x3c7d70[_0xedac('0x48')]];delete this[_0xedac('0x7')][_0x3c7d70['secondtransfereruniqueid']];}}else if(!_[_0xedac('0x46')](this['channels'][_0x3c7d70['transfertargetuniqueid']])){this[_0xedac('0x1d')](_0x3c7d70[_0xedac('0x49')]);if(this[_0xedac('0x7')][_0x3c7d70['origtransfereruniqueid']]){this[_0xedac('0x7')][_0x3c7d70[_0xedac('0x4a')]][_0xedac('0x28')]=!![];this['channels'][_0x3c7d70[_0xedac('0x47')]]=this[_0xedac('0x7')][_0x3c7d70[_0xedac('0x4a')]];delete this[_0xedac('0x7')][_0x3c7d70[_0xedac('0x4a')]];}}}catch(_0x893d07){logger[_0xedac('0x1c')]('[ACW][syncAttendedTransfer]\x20%s',_0x893d07[_0xedac('0x32')]);}};Acw[_0xedac('0x16')][_0xedac('0x4b')]=function(_0x1eaa92){try{if(this[_0xedac('0x7')][_0x1eaa92['transfereruniqueid']]){logger[_0xedac('0x1b')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xedac('0x38')](_0x1eaa92[_0xedac('0x4c')]));this[_0xedac('0x1d')](_0x1eaa92[_0xedac('0x4c')]);}else if(this[_0xedac('0x7')][_0x1eaa92['transfererlinkedid']]){logger[_0xedac('0x1b')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xedac('0x38')](_0x1eaa92['transfererlinkedid']));this['startAcw'](_0x1eaa92[_0xedac('0x4d')]);}}catch(_0x3b3dcc){logger[_0xedac('0x1c')]('[ACW][syncBlindTransfer]\x20%s',_0x3b3dcc[_0xedac('0x32')]);}};Acw[_0xedac('0x16')][_0xedac('0xf')]=function(_0x44dca0){try{if(this[_0xedac('0x4')][_0x44dca0[_0xedac('0x1e')]]&&this[_0xedac('0x4')][_0x44dca0[_0xedac('0x1e')]][_0xedac('0x4e')]==='all'){if(this['agents'][_0x44dca0[_0xedac('0x3a')]]){logger[_0xedac('0x1b')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x44dca0[_0xedac('0x1a')],_0x44dca0[_0xedac('0x3a')],_0x44dca0[_0xedac('0x1e')]);return RpcUser[_0xedac('0x2a')](this[_0xedac('0x5')][_0x44dca0[_0xedac('0x3a')]],_0xedac('0x4f'),_0x44dca0[_0xedac('0x1a')]);}}}catch(_0x1bdec8){logger[_0xedac('0x1c')](_0xedac('0x50'),_0x1bdec8['message']);}};module[_0xedac('0x51')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 7dc0a33..f0ba210 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 _0x2e8b=['action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','exports','asterisk-manager','util','../../config/logger','../../config/environment','asterisk','port','username','password','Action'];(function(_0x51085f,_0x1cb2f0){var _0x455c86=function(_0x1eae65){while(--_0x1eae65){_0x51085f['push'](_0x51085f['shift']());}};_0x455c86(++_0x1cb2f0);}(_0x2e8b,0x117));var _0xb2e8=function(_0x17d678,_0x826d42){_0x17d678=_0x17d678-0x0;var _0x8f7971=_0x2e8b[_0x17d678];return _0x8f7971;};'use strict';var Manager=require(_0xb2e8('0x0'));var BPromise=require('bluebird');var util=require(_0xb2e8('0x1'));var logger=require(_0xb2e8('0x2'))('ami');var config=require(_0xb2e8('0x3'));var ami=new Manager(config[_0xb2e8('0x4')][_0xb2e8('0x5')],config[_0xb2e8('0x4')]['ip'],config[_0xb2e8('0x4')][_0xb2e8('0x6')],config[_0xb2e8('0x4')][_0xb2e8('0x7')],!![]);ami['keepConnected']();ami[_0xb2e8('0x8')]=BPromise['promisify'](ami[_0xb2e8('0x9')]);function error(_0x5de337){logger['error'](util[_0xb2e8('0xa')](_0xb2e8('0xb'),config[_0xb2e8('0x4')][_0xb2e8('0x6')],config[_0xb2e8('0x4')]['ip'],config[_0xb2e8('0x4')][_0xb2e8('0x5')],util[_0xb2e8('0xc')](_0x5de337,![],null)));}function close(){logger[_0xb2e8('0xd')](util[_0xb2e8('0xa')](_0xb2e8('0xe'),config[_0xb2e8('0x4')][_0xb2e8('0x6')],config[_0xb2e8('0x4')]['ip'],config[_0xb2e8('0x4')][_0xb2e8('0x5')]));}ami[_0xb2e8('0xf')]=function(){return function(){return ami[_0xb2e8('0x8')]({'action':_0xb2e8('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0xb2e8('0x11')});};};ami[_0xb2e8('0x12')]=function(){return function(){return ami[_0xb2e8('0x8')]({'action':_0xb2e8('0x13')});};};ami[_0xb2e8('0x14')]=function(){return function(){return ami[_0xb2e8('0x8')]({'action':_0xb2e8('0x15')});};};ami[_0xb2e8('0x16')]=function(){return function(){return ami[_0xb2e8('0x8')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util['format'](_0xb2e8('0x17'),config['asterisk'][_0xb2e8('0x6')],config[_0xb2e8('0x4')]['ip'],config[_0xb2e8('0x4')][_0xb2e8('0x5')]));ami['once']('error',error);ami[_0xb2e8('0x18')](_0xb2e8('0x19'),close);}ami['on'](_0xb2e8('0x1a'),connect);ami['on'](_0xb2e8('0x1b'),function(_0x24f3d2){logger['info'](util[_0xb2e8('0xa')](_0xb2e8('0x1c'),config[_0xb2e8('0x4')]['username'],config['asterisk']['ip'],config[_0xb2e8('0x4')][_0xb2e8('0x5')],util['inspect'](_0x24f3d2,![],null)));});ami['on'](_0xb2e8('0x1d'),function(){logger[_0xb2e8('0x1e')](util[_0xb2e8('0xa')](_0xb2e8('0x1f'),config[_0xb2e8('0x4')][_0xb2e8('0x6')],config['asterisk']['ip'],config['asterisk'][_0xb2e8('0x5')]));return Promise[_0xb2e8('0x20')]()[_0xb2e8('0x21')](ami[_0xb2e8('0xf')]())[_0xb2e8('0x21')](ami[_0xb2e8('0x22')]())['then'](ami['actionSipPeerStatus']())['then'](ami['actionQueueSummary']())[_0xb2e8('0x21')](ami[_0xb2e8('0x16')]())['catch'](function(_0x182abd){logger['error']('[ami.js][fullybooted]',util[_0xb2e8('0xc')](_0x182abd,{'showHidden':![],'depth':null}));});});ami[_0xb2e8('0x18')](_0xb2e8('0xd'),error);ami[_0xb2e8('0x18')](_0xb2e8('0x19'),close);module[_0xb2e8('0x23')]=ami; \ No newline at end of file +var _0xd62f=['once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','then','catch','[ami.js][fullybooted]','close','asterisk-manager','bluebird','ami','../../config/environment','asterisk','username','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','port','actionSipShowRegistry','Action','sipshowregistry','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info'];(function(_0x20ae13,_0x2a0c8e){var _0x533fd5=function(_0x3bb746){while(--_0x3bb746){_0x20ae13['push'](_0x20ae13['shift']());}};_0x533fd5(++_0x2a0c8e);}(_0xd62f,0x11f));var _0xfd62=function(_0x2964af,_0x1530c6){_0x2964af=_0x2964af-0x0;var _0x4efef4=_0xd62f[_0x2964af];return _0x4efef4;};'use strict';var Manager=require(_0xfd62('0x0'));var BPromise=require(_0xfd62('0x1'));var util=require('util');var logger=require('../../config/logger')(_0xfd62('0x2'));var config=require(_0xfd62('0x3'));var ami=new Manager(config[_0xfd62('0x4')]['port'],config['asterisk']['ip'],config[_0xfd62('0x4')][_0xfd62('0x5')],config[_0xfd62('0x4')][_0xfd62('0x6')],!![]);ami[_0xfd62('0x7')]();ami['Action']=BPromise[_0xfd62('0x8')](ami[_0xfd62('0x9')]);function error(_0x2c09ec){logger[_0xfd62('0xa')](util[_0xfd62('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xfd62('0x5')],config[_0xfd62('0x4')]['ip'],config[_0xfd62('0x4')]['port'],util['inspect'](_0x2c09ec,![],null)));}function close(){logger[_0xfd62('0xa')](util[_0xfd62('0xb')](_0xfd62('0xc'),config[_0xfd62('0x4')][_0xfd62('0x5')],config[_0xfd62('0x4')]['ip'],config['asterisk'][_0xfd62('0xd')]));}ami[_0xfd62('0xe')]=function(){return function(){return ami[_0xfd62('0xf')]({'action':_0xfd62('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xfd62('0xf')]({'action':'devicestatelist'});};};ami[_0xfd62('0x11')]=function(){return function(){return ami[_0xfd62('0xf')]({'action':'sippeerstatus'});};};ami[_0xfd62('0x12')]=function(){return function(){return ami[_0xfd62('0xf')]({'action':_0xfd62('0x13')});};};ami[_0xfd62('0x14')]=function(){return function(){return ami['Action']({'action':_0xfd62('0x15')});};};function connect(){logger[_0xfd62('0x16')](util[_0xfd62('0xb')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xfd62('0x4')][_0xfd62('0x5')],config[_0xfd62('0x4')]['ip'],config[_0xfd62('0x4')][_0xfd62('0xd')]));ami[_0xfd62('0x17')]('error',error);ami[_0xfd62('0x17')]('close',close);}ami['on']('connect',connect);ami['on'](_0xfd62('0x18'),function(_0x155632){logger['info'](util['format'](_0xfd62('0x19'),config[_0xfd62('0x4')][_0xfd62('0x5')],config[_0xfd62('0x4')]['ip'],config['asterisk'][_0xfd62('0xd')],util[_0xfd62('0x1a')](_0x155632,![],null)));});ami['on']('fullybooted',function(){logger[_0xfd62('0x16')](util[_0xfd62('0xb')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xfd62('0x4')][_0xfd62('0x5')],config[_0xfd62('0x4')]['ip'],config[_0xfd62('0x4')][_0xfd62('0xd')]));return Promise['resolve']()[_0xfd62('0x1b')](ami[_0xfd62('0xe')]())[_0xfd62('0x1b')](ami['actionDeviceStateList']())['then'](ami[_0xfd62('0x11')]())['then'](ami[_0xfd62('0x12')]())[_0xfd62('0x1b')](ami[_0xfd62('0x14')]())[_0xfd62('0x1c')](function(_0x526b1c){logger[_0xfd62('0xa')](_0xfd62('0x1d'),util[_0xfd62('0x1a')](_0x526b1c,{'showHidden':![],'depth':null}));});});ami['once']('error',error);ami[_0xfd62('0x17')](_0xfd62('0x1e'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 474adff..5b5d7a9 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 _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x70e0,0x17b));var _0x070e=function(_0x2367f3,_0x1fe93f){_0x2367f3=_0x2367f3-0x0;var _0x1edd68=_0x70e0[_0x2367f3];return _0x1edd68;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file +var _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x3fd455,_0x1f7c5b){var _0x1c259f=function(_0x2da88a){while(--_0x2da88a){_0x3fd455['push'](_0x3fd455['shift']());}};_0x1c259f(++_0x1f7c5b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('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 c8324c1..a38c752 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 _0xc3c9=['syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','emit','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\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','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive','startPredictive','debug','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','\x20INTERVAL_IS_NULL','Interval','NULL_INTERVAL','isEmpty','isIVRCampaignActive','INACTIVE','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','format','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','timezones','UNKNOWN_TIMEZONE','isArray','length','push','command','iftime\x20%s,%s','interval','content','true','catch','indexOf','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaign','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','Intervals','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','uniqueid','ivr','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','outboundDropCallsDayTimeout','Drop','TIMEOUT','agiafterat','countdropretry','countglobal','verifyAdditionalPhones','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','VoiceQueueId','CampaignId','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','countabandonedretry','voiceQueue','dialAbandonedMaxRetry','ListId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','roundrobin','locked','paused','stateinterface','isNil','queueBooked','strategy','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[actions]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','variables','Action','dialPrefix','trim','dialCutDigit','substring','from-sip','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][Drop]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','callAdditionalPhoneAfterMin','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','talking','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','predictiveIntervalErlangCallsDroppedCalls','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(','predictiveIntervalAnsweredCalls','dialPredictiveOptimizationPercentage','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getVoiceQueueRtPauses','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','predictiveIntervalHitRate','check\x20failure','erlangCallToSecond','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','RUNNING','checkIsBlackList','[actionOriginate]\x20','tryOriginatePredictive','getContactDialer','dialOrderByScheduledAt','[getContactDialerPredictive]','--------\x20Drop\x20Rate\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','Ts\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','./utils','../preview/util/util','../../../config/logger','predictive','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete'];(function(_0x2140f2,_0x33255f){var _0x590c84=function(_0x3a48dc){while(--_0x3a48dc){_0x2140f2['push'](_0x2140f2['shift']());}};_0x590c84(++_0x33255f);}(_0xc3c9,0x1e6));var _0x9c3c=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0xc3c9[_0xf73c09];return _0xa8923c;};'use strict';var util=require(_0x9c3c('0x0'));var _=require(_0x9c3c('0x1'));var uuid=require(_0x9c3c('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x9c3c('0x3'));var utils=require(_0x9c3c('0x4'));var hopperUtils=require('./utils/hopper');var ut=require(_0x9c3c('0x5'));var config=require('../../../config/environment/');var logger=require(_0x9c3c('0x6'))('dialer');var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0x9c3c('0x6'))(_0x9c3c('0x7'));var loggerPredictiveCalls=require(_0x9c3c('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x9c3c('0x6'))(_0x9c3c('0x8'));var ami=require(_0x9c3c('0x9'));config[_0x9c3c('0xa')]=_['defaults'](config[_0x9c3c('0xa')],{'host':_0x9c3c('0xb'),'port':0x18eb});var io=require(_0x9c3c('0xc'))(new Redis(config[_0x9c3c('0xa')]));var cmHopper=require(_0x9c3c('0xd'));var voiceQueueRt=require(_0x9c3c('0xe'));var RpcSetting=require(_0x9c3c('0xf'));var Interval=require(_0x9c3c('0x10'));var Action=require(_0x9c3c('0x11'));var History=require(_0x9c3c('0x12'));var Final=require(_0x9c3c('0x13'));var AgentComplete=require(_0x9c3c('0x14'));var QueueCallerAbandon=require(_0x9c3c('0x15'));var Hangup=require(_0x9c3c('0x16'));var ipAgi=process[_0x9c3c('0x17')][_0x9c3c('0x18')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x9c3c('0x19')][_0x9c3c('0x1a')]=function(_0x167390){this['tail']=this[_0x9c3c('0x1b')]?this[_0x9c3c('0x1b')][_0x9c3c('0x1c')](_0x167390):_0x167390();};function Dialer(_0x2babb8,_0x5aca8b){this['sequence']=new Sequence();this[_0x9c3c('0x1d')]=_0x5aca8b;this['voiceQueues']=_0x2babb8[_0x9c3c('0x1e')];this[_0x9c3c('0x1f')]=_0x2babb8[_0x9c3c('0x1f')];this[_0x9c3c('0x20')]=_0x2babb8['agents'];this['trunks']=_0x2babb8[_0x9c3c('0x21')];this['maxNumberOriginate']=config[_0x9c3c('0x22')]||0x2;this[_0x9c3c('0x23')]={};this[_0x9c3c('0x24')]={};this['contactsId']={};this[_0x9c3c('0x25')]={};this[_0x9c3c('0x26')]={};this['startPredictive']={};this['startProgressive']={};this[_0x9c3c('0x27')]={};this['queueBooked']={};this[_0x9c3c('0x28')]={};this[_0x9c3c('0x29')]={};ami['on'](_0x9c3c('0x2a'),this[_0x9c3c('0x2b')][_0x9c3c('0x2c')](this));ami['on'](_0x9c3c('0x2d'),this[_0x9c3c('0x2e')][_0x9c3c('0x2c')](this));ami['on'](_0x9c3c('0x2f'),this['syncOriginateResponse'][_0x9c3c('0x2c')](this));ami['on'](_0x9c3c('0x30'),this[_0x9c3c('0x31')]['bind'](this));ami['on'](_0x9c3c('0x32'),this['syncQueueSummary'][_0x9c3c('0x2c')](this));ami['on'](_0x9c3c('0x33'),this[_0x9c3c('0x34')][_0x9c3c('0x2c')](this));ami['on'](_0x9c3c('0x35'),this[_0x9c3c('0x36')]['bind'](this));ami['on'](_0x9c3c('0x37'),this[_0x9c3c('0x38')][_0x9c3c('0x2c')](this));ami['on']('varset',this[_0x9c3c('0x39')][_0x9c3c('0x2c')](this));ami['on'](_0x9c3c('0x3a'),this[_0x9c3c('0x3b')]['bind'](this));ami['on'](_0x9c3c('0x3c'),this[_0x9c3c('0x3d')][_0x9c3c('0x2c')](this));this[_0x9c3c('0x3e')]();this[_0x9c3c('0x3f')]();RpcSetting['getSettings']()[_0x9c3c('0x40')](function(_0x5ea58d){previewRecallmeReminderInterval=_0x5ea58d[_0x9c3c('0x41')];});}function isNotNull(_0x46e41e){return _0x46e41e!==null&&!_[_0x9c3c('0x42')](_0x46e41e);}function msgResponse(_0x2e6743,_0x4f0be2,_0x189b71){return{'action':_0x2e6743,'response':_0x4f0be2,'message':_0x189b71,'stack':_0x189b71};}function emit(_0x4f14ac,_0x6f8f56,_0x164e84){io['to'](_0x4f14ac)[_0x9c3c('0x43')](_0x6f8f56,_0x164e84);}function emitOutboundVoiceQueueSummary(_0x1f5067){if(_0x1f5067[_0x9c3c('0x44')]==='outbound'){logger['debug'](_0x9c3c('0x45'),util[_0x9c3c('0x46')](_0x1f5067,{'showHidden':![],'depth':null}));emit(util['format'](_0x9c3c('0x47'),_0x1f5067[_0x9c3c('0x48')]),_0x9c3c('0x49'),_0x1f5067);}}function checkGetDataPredictive(_0x4ceb82){if(isNotNull(_0x4ceb82)&&!_['isEmpty'](_0x4ceb82)){loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x4b'));loggerPredictive[_0x9c3c('0x4a')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4ceb82[_0x9c3c('0x4c')]);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x4d'),_0x4ceb82['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x9c3c('0x4a')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4ceb82[_0x9c3c('0x4e')]);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x4f'),_0x4ceb82['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4ceb82[_0x9c3c('0x50')]);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x51'),_0x4ceb82[_0x9c3c('0x52')]);loggerPredictive['info'](_0x9c3c('0x53'));if(_0x4ceb82[_0x9c3c('0x4c')]>0x0){if(!_[_0x9c3c('0x42')](_0x4ceb82['predictiveIntervalAvgTalktime'])&&_0x4ceb82[_0x9c3c('0x52')]>0x0){return!![];}loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x54'));if(!_['isUndefined'](_0x4ceb82[_0x9c3c('0x50')])&&_0x4ceb82[_0x9c3c('0x50')]>0x0){return!![];}loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x55'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x9c3c('0x56'));}return![];}function mergeDataErlangB(_0x2b600e){return function(_0x1590a5){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x57'),_0x1590a5[_0x9c3c('0x58')]);loggerPredictive['info'](_0x9c3c('0x59'),_0x1590a5['erlangCallToSecond']);loggerPredictive['info'](_0x9c3c('0x5a'),_0x1590a5[_0x9c3c('0x5b')]);loggerPredictive['info'](_0x9c3c('0x5c'),_0x1590a5['erlangBusyFactor']);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x5a'),_0x1590a5['erlangAbandonmentRate']);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x53'));_[_0x9c3c('0x5d')](_0x2b600e,_0x1590a5);};}function ifInterval(_0x4c5ae3,_0x1829af){if(_[_0x9c3c('0x42')](_0x1829af)){return![];}return utils[_0x9c3c('0x5e')](undefined,_0x1829af)<_0x4c5ae3*0x3c;}function clearPredictiveAttributes(_0x479ca6){if(_0x479ca6[_0x9c3c('0x5f')]){_0x479ca6['startProgressive']=undefined;loggerPredictive['debug'](_0x479ca6[_0x9c3c('0x48')],'startProgressive\x20value\x20cleared');}if(_0x479ca6[_0x9c3c('0x60')]){_0x479ca6[_0x9c3c('0x60')]=undefined;loggerPredictive[_0x9c3c('0x61')](_0x479ca6[_0x9c3c('0x48')],'startPredictive\x20value\x20cleared');}if(_0x479ca6[_0x9c3c('0x62')]){clearInterval(_0x479ca6[_0x9c3c('0x62')]);_0x479ca6[_0x9c3c('0x62')]=undefined;loggerPredictive[_0x9c3c('0x61')](_0x479ca6[_0x9c3c('0x48')],_0x9c3c('0x63'));}}function loggerCatchPredictive(_0x47ff09,_0x4b8d1a){return function(_0x530e38){loggerPredictive[_0x9c3c('0x64')](_0x4b8d1a[_0x9c3c('0x48')],_0x47ff09);loggerPredictive[_0x9c3c('0x64')](_0x530e38[_0x9c3c('0x65')]);clearPredictiveAttributes(_0x4b8d1a);};}function loggerCatch(_0x5153e8){return function(_0x295912){logger[_0x9c3c('0x64')](_0x5153e8,util[_0x9c3c('0x46')](_0x295912,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x3c71ba,_0x38a3e4,_0x79a107){return function(_0x7d5c23){utils[_0x9c3c('0x66')](_0x38a3e4,_0x79a107,0x0);_0x38a3e4[_0x9c3c('0x67')]=0x0;logger[_0x9c3c('0x64')](_0x3c71ba,util[_0x9c3c('0x46')](_0x7d5c23,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5b7d5e){return function(_0x2a3f62){if(isNotNull(_0x2a3f62)&&isNotNull(_0x2a3f62[0x0])){if(_0x2a3f62[0x0][_0x9c3c('0x68')]>0x0){_0x5b7d5e[_0x9c3c('0x69')]=utils['CAMPAIGN_STATUS']['CONTACTS_RESCHEDULED'];logger[_0x9c3c('0x4a')](_0x9c3c('0x6a')+_0x5b7d5e[_0x9c3c('0x48')],_0x2a3f62[0x0]['contactsRescheduled'],_0x9c3c('0x6b'));}else{_0x5b7d5e[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')][_0x9c3c('0x6d')];logger[_0x9c3c('0x4a')](_0x9c3c('0x6e')+_0x5b7d5e[_0x9c3c('0x48')]);}}};}function createObjHistory(_0x382844,_0x5ba2cc,_0x279c5a,_0x2e5488,_0x51dcf2){_0x382844[_0x9c3c('0x69')]=_0x279c5a;var _0x1aa831=new Action(_0x382844,_0x5ba2cc);var _0x3b32cd=new History(_0x1aa831);_0x3b32cd[_0x9c3c('0x6f')]=_0x2e5488;_0x3b32cd[_0x9c3c('0x70')]=_0x51dcf2;_0x3b32cd[_0x9c3c('0x71')]=_0x1aa831['starttime'];return _0x3b32cd;}function unlockQueueStatus(_0x5c1005,_0xc7d0c5){setTimeout(function(){if(_[_0x9c3c('0x42')](_0x5c1005[_0x9c3c('0x72')])){loggerBooked['error'](_0x9c3c('0x73'),_0xc7d0c5);}_0x5c1005['queueStatusComplete']=!![];loggerBooked[_0x9c3c('0x4a')](_0x9c3c('0x74'),_0xc7d0c5,JSON[_0x9c3c('0x75')](_[_0x9c3c('0x76')](_0x5c1005,[_0x9c3c('0x48'),_0x9c3c('0x72')])));},0x1f3);}function checkInterval(_0x1f8c87){return function(){if(!isNotNull(_0x1f8c87['Interval'])){_0x1f8c87[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')]['NULL_INTERVAL'];throw _0x1f8c87[_0x9c3c('0x48')]+_0x9c3c('0x77');}if(!isNotNull(_0x1f8c87[_0x9c3c('0x78')]['Intervals'])){_0x1f8c87[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')][_0x9c3c('0x79')];throw _0x1f8c87[_0x9c3c('0x48')]+_0x9c3c('0x77');}if(!isNotNull(_[_0x9c3c('0x7a')](_0x1f8c87['Interval']['Intervals']))){_0x1f8c87[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')]['NULL_INTERVAL'];throw _0x1f8c87['name']+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x5959af){return function(){if(!utils[_0x9c3c('0x7b')](_0x5959af)){_0x5959af[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')][_0x9c3c('0x7c')];throw _0x5959af['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x36ec8f){if(utils['isIVRCampaign'](_0x36ec8f)){emit(util['format'](_0x9c3c('0x7d'),_0x36ec8f[_0x9c3c('0x48')]),_0x9c3c('0x7e'),_0x36ec8f);}}function loggerCatchQueueSummary(_0x772003,_0x20d652){return function(_0xfee7ba){clearPredictiveAttributes(_0x20d652);emitCampaignSummary(_0x20d652);loggerSyncQueueSummary[_0x9c3c('0x61')](_0x772003,util[_0x9c3c('0x46')](_0xfee7ba,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x52f499){if(_0x52f499['sendMessageOneNotActive']){if(_0x52f499[_0x9c3c('0x7f')]===0x0){_0x52f499[_0x9c3c('0x80')]=![];_0x52f499[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')][_0x9c3c('0x7c')];loggerSyncQueueSummary['debug'](_0x9c3c('0x81'),_0x52f499['name'],'is\x20not\x20active');}else{_0x52f499['message']=utils['CAMPAIGN_STATUS'][_0x9c3c('0x82')];loggerSyncQueueSummary[_0x9c3c('0x61')](_0x9c3c('0x81'),_0x52f499[_0x9c3c('0x48')],_0x9c3c('0x83'));}emitCampaignSummary(_0x52f499);}}function myreject(_0x20cd46){return function(_0x5e2727){return _0x20cd46(msgResponse(_0x9c3c('0x84'),_0x9c3c('0x85'),JSON[_0x9c3c('0x75')](_0x5e2727)));};}Dialer[_0x9c3c('0x19')][_0x9c3c('0x86')]=function(_0x39d67b){return!_[_0x9c3c('0x42')](_0x39d67b)&&_0x39d67b&&!_[_0x9c3c('0x42')](_0x39d67b[_0x9c3c('0x48')])&&!_[_0x9c3c('0x42')](_0x39d67b['active'])&&_0x39d67b[_0x9c3c('0x87')]&&(this['trunks'][util[_0x9c3c('0x88')](_0x9c3c('0x89'),_0x39d67b[_0x9c3c('0x48')])][_0x9c3c('0x8a')]===_0x9c3c('0x8b')||this[_0x9c3c('0x21')][util['format']('SIP/%s',_0x39d67b[_0x9c3c('0x48')])][_0x9c3c('0x8a')]===_0x9c3c('0x8c'));};Dialer['prototype'][_0x9c3c('0x8d')]=function(_0x58ff1c){var _0x192b0a=this;return function(){if(!_0x192b0a['isTrunkReachable'](_0x58ff1c[_0x9c3c('0x8e')])){if(!_0x192b0a[_0x9c3c('0x86')](_0x58ff1c[_0x9c3c('0x8f')])){_0x58ff1c[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')]['TRUNK_NOT_REACHABLE'];throw _0x58ff1c[_0x9c3c('0x48')]+_0x9c3c('0x90');}}};};Dialer['prototype'][_0x9c3c('0x91')]=function(_0x483752,_0x12eb1e,_0x124c32,_0x37af47){var _0x291860=this;return function(){var _0x3f89f5=!![];return _0x291860[_0x9c3c('0x92')](_0x483752,_0x12eb1e,_0x124c32,_0x37af47,_0x3f89f5);};};Dialer[_0x9c3c('0x19')][_0x9c3c('0x93')]=function(_0x16ce5a,_0x1ad5d9,_0x12e1e6,_0x2491e1){var _0x14794f=this;return function(){var _0x3dd43e=![];return _0x14794f[_0x9c3c('0x92')](_0x16ce5a['Intervals'],_0x1ad5d9,_0x12e1e6,_0x2491e1,_0x3dd43e);};};Dialer[_0x9c3c('0x19')]['ifTimeIvr']=function(_0x4c9886,_0x17e04e,_0x332ded,_0x14dcd6,_0xca4cd6){var _0x796e12=[];return new Promise(function(_0x28d3ef,_0x521b10){if(!isNotNull(_0x4c9886)){_0x14dcd6[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')][_0x9c3c('0x79')];return _0x521b10(msgResponse(_0x9c3c('0x94'),_0x9c3c('0x95'),_0x332ded+_0x9c3c('0x96')));}if(_[_0x9c3c('0x7a')](_0x4c9886)){_0x14dcd6['message']=utils['CAMPAIGN_STATUS']['EMPTY_INTERVAL'];return _0x521b10(msgResponse(_0x9c3c('0x94'),_0x9c3c('0x95'),_0x332ded+'\x20Intervals\x20is\x20empty\x20'));}if(_0x17e04e&&_[_0x9c3c('0x42')](config[_0x9c3c('0x97')][_0x17e04e])){_0x14dcd6[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')][_0x9c3c('0x98')];return _0x521b10(msgResponse(_0x9c3c('0x94'),_0x9c3c('0x95'),_0x332ded+'\x20Timezone\x20unknow\x20'+_0x17e04e));}if(_[_0x9c3c('0x99')](_0x4c9886)){for(var _0x51be34=0x0;_0x51be34<_0x4c9886[_0x9c3c('0x9a')];_0x51be34+=0x1){_0x796e12[_0x9c3c('0x9b')](ami['Action']({'action':_0x9c3c('0x9c'),'command':util[_0x9c3c('0x88')](_0x9c3c('0x9d'),_0x4c9886[_0x51be34][_0x9c3c('0x9e')],!_[_0x9c3c('0x42')](config[_0x9c3c('0x97')][_0x17e04e])?_0x17e04e:'')})[_0x9c3c('0x40')](function(_0x1f4d3e){return _0x1f4d3e[_0x9c3c('0x9f')]['indexOf'](_0x9c3c('0xa0'))>=0x0;})[_0x9c3c('0xa1')](myreject(_0x521b10)));}}else{_0x796e12['push'](ami['Action']({'action':'command','command':util[_0x9c3c('0x88')](_0x9c3c('0x9d'),_0x4c9886,!_[_0x9c3c('0x42')](config[_0x9c3c('0x97')][_0x17e04e])?_0x17e04e:'')})[_0x9c3c('0x40')](function(_0x4c3209){return _0x4c3209[_0x9c3c('0x9f')][_0x9c3c('0xa2')](_0x9c3c('0xa0'))>=0x0;})[_0x9c3c('0xa1')](myreject(_0x521b10)));}Promise[_0x9c3c('0xa3')](_0x796e12)[_0x9c3c('0x40')](function(_0xe80ddd){var _0x505c92=_[_0x9c3c('0xa4')](_0xe80ddd);if(_0x505c92){return _0x28d3ef(_0x505c92);}else{_0x14dcd6[_0x9c3c('0x69')]=_0xca4cd6?utils[_0x9c3c('0x6c')][_0x9c3c('0xa5')]:utils[_0x9c3c('0x6c')][_0x9c3c('0xa6')];return _0x521b10(msgResponse(_0x9c3c('0xa7'),'Failure',_0x9c3c('0xa8')+_0xca4cd6+'\x20'+_0x332ded+_0x9c3c('0xa9')+util[_0x9c3c('0x46')](_0x4c9886,{'showHidden':![],'depth':null})+_0x9c3c('0xaa')+_0x17e04e));}})[_0x9c3c('0xa1')](function(_0x205e6b){return _0x521b10(msgResponse('ifTime',_0x9c3c('0x95'),JSON[_0x9c3c('0x75')](_0x205e6b)));});});};Dialer[_0x9c3c('0x19')][_0x9c3c('0x3e')]=function(){var _0x36c5a0=this;return cmHopper[_0x9c3c('0xab')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x36c5a0[_0x9c3c('0xac')]();},0x3e8);});};Dialer[_0x9c3c('0x19')]['syncCampaigns']=function(){var _0x2aa24e=this;var _0x532941;for(var _0x3e5eb6 in this[_0x9c3c('0x1f')]){if(typeof this['campaigns'][_0x3e5eb6]!==_0x9c3c('0xad')){_0x532941=this['campaigns'][_0x3e5eb6];if(utils[_0x9c3c('0xae')](_0x532941)&&utils['isIVRCampaignActive'](_0x532941)){_0x532941[_0x9c3c('0x80')]=!![];Promise[_0x9c3c('0xaf')]()['then'](checkIsIVRCampaignActive(_0x532941))[_0x9c3c('0x40')](checkInterval(_0x532941))[_0x9c3c('0x40')](_0x2aa24e['checkIsTrunkReachable'](_0x532941))[_0x9c3c('0x40')](_0x2aa24e['checkIfTime'](_0x532941[_0x9c3c('0xb0')],_0x532941['dialTimezone'],_0x532941['name'],_0x532941))[_0x9c3c('0x40')](_0x2aa24e['checkIfTimeIntervals'](_0x532941[_0x9c3c('0x78')],_0x532941[_0x9c3c('0xb1')],_0x532941[_0x9c3c('0x48')],_0x532941))[_0x9c3c('0x40')](_0x2aa24e[_0x9c3c('0xb2')](_0x532941))[_0x9c3c('0xa1')](loggerCatchQueueSummary(_0x9c3c('0xb3'),_0x532941));}else{notSendMessagesCampaign(_0x532941);}}}};Dialer[_0x9c3c('0x19')][_0x9c3c('0xb4')]=function(_0x5b5709){if(_0x5b5709[_0x9c3c('0xb5')]!==_0x9c3c('0x7')){clearPredictiveAttributes(_0x5b5709);}switch(_0x5b5709['dialMethod']){case _0x9c3c('0xb6'):this['handlePower'](_0x5b5709,0x1);break;case'power':this[_0x9c3c('0xb7')](_0x5b5709,_0x5b5709[_0x9c3c('0xb8')]);break;case _0x9c3c('0x7'):this[_0x9c3c('0x7')](_0x5b5709);break;case _0x9c3c('0xb9'):this[_0x9c3c('0xb7')](_0x5b5709,0x1);break;default:logger[_0x9c3c('0x64')](_0x9c3c('0xba'),_0x5b5709['name'],_0x9c3c('0xbb'));}};Dialer[_0x9c3c('0x19')]['ifTime']=function(_0x2b1b85,_0x4c9cbf){var _0x186c9f=_0x2b1b85[_0x9c3c('0xb1')];var _0x17c5c4=_0x4c9cbf?_0x2b1b85[_0x9c3c('0xb0')]:_0x2b1b85[_0x9c3c('0x78')][_0x9c3c('0xbc')];logger[_0x9c3c('0xbd')](_0x9c3c('0xbe'),_0x17c5c4,_0x186c9f,_0x2b1b85['name'],util[_0x9c3c('0x88')](_0x9c3c('0xbf'),_0x2b1b85[_0x9c3c('0x48')],_0x2b1b85['id']));var _0xd039e0=null;return Interval[_0x9c3c('0xc0')](_0x17c5c4,_0x186c9f)[_0x9c3c('0x40')](function(_0x331f86){if(_0x331f86===!![]){return _0x331f86;}else{_0x2b1b85[_0x9c3c('0x69')]=_0x4c9cbf?utils[_0x9c3c('0x6c')][_0x9c3c('0xa5')]:utils[_0x9c3c('0x6c')][_0x9c3c('0xa6')];_0xd039e0=msgResponse(_0x9c3c('0xa7'),'Failure',_0x9c3c('0xa8')+_0x4c9cbf+'\x20'+_0x2b1b85[_0x9c3c('0x48')]+_0x9c3c('0xa9')+util['inspect'](_0x17c5c4,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x186c9f);}if(_0xd039e0!==null){logger[_0x9c3c('0xbd')](_0x9c3c('0xc1'),_0xd039e0);_0xd039e0[_0x9c3c('0xc2')]=_0x4c9cbf;throw _0xd039e0;}})[_0x9c3c('0xa1')](function(_0xbc33b9){logger[_0x9c3c('0x64')]('AMI\x20IfTime',_0xbc33b9);throw msgResponse('[ifTime][Action]',_0x9c3c('0x85'),util[_0x9c3c('0x46')](_0xbc33b9,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x9c3c('0x2b')]=function(_0x1a4138){if(this[_0x9c3c('0x1e')][_0x1a4138['queue']]){if(this[_0x9c3c('0x25')][_0x1a4138['uniqueid']]&&this['uniqueId'][_0x1a4138[_0x9c3c('0xc3')]][_0x9c3c('0x44')]!==_0x9c3c('0xc4')){this[_0x9c3c('0xc5')](this[_0x9c3c('0x1e')][_0x1a4138[_0x9c3c('0xc6')]]);this['uniqueId'][_0x1a4138[_0x9c3c('0xc3')]][_0x9c3c('0xc7')]=moment()[_0x9c3c('0x88')](_0x9c3c('0xc8'));}}};Dialer['prototype'][_0x9c3c('0x31')]=function(_0x31f49f){var _0x585d84=this['uniqueId'][_0x31f49f['uniqueid']];if(this[_0x9c3c('0x1e')][_0x31f49f[_0x9c3c('0xc6')]]){if(_0x585d84&&_0x585d84[_0x9c3c('0x44')]!==_0x9c3c('0xc4')){delete this['uniqueId'][_0x31f49f[_0x9c3c('0xc3')]];this[_0x9c3c('0x1e')][_0x31f49f[_0x9c3c('0xc6')]][_0x9c3c('0xc9')]+=0x1;var _0x3b13e7=new AgentComplete(_0x585d84,_0x31f49f);if(_0x31f49f['reason']==='agent'){_0x3b13e7['agiafterat']=this[_0x9c3c('0x1e')][_0x31f49f[_0x9c3c('0xc6')]][_0x9c3c('0xca')]&&this['voiceQueues'][_0x31f49f['queue']][_0x9c3c('0xcb')]?moment()[_0x9c3c('0x88')](_0x9c3c('0xc8')):undefined;}hopperUtils[_0x9c3c('0xcc')](_0x3b13e7)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0xcd')));hopperUtils[_0x9c3c('0xce')](_0x3b13e7)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0xcf')));}}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x2e')]=function(_0x2ada44){var _0x238c4a=this[_0x9c3c('0x25')][_0x2ada44[_0x9c3c('0xc3')]];var _0x307a06=this;var _0x420346=![];var _0x2f6f0e;var _0xde85e8;if(this[_0x9c3c('0x1e')][_0x2ada44['queue']]){if(_0x238c4a&&_0x238c4a[_0x9c3c('0x44')]!==_0x9c3c('0xc4')){delete this[_0x9c3c('0x25')][_0x2ada44['uniqueid']];this['updateOriginated'](this[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]]);_0x238c4a[_0x9c3c('0xd0')]=moment()[_0x9c3c('0x88')](_0x9c3c('0xc8'));var _0x52b147=new QueueCallerAbandon(_0x238c4a,_0x2ada44);if(utils[_0x9c3c('0x5e')](_0x238c4a['droptime'],_0x238c4a[_0x9c3c('0xd1')])>=_0x238c4a['dialQueueTimeout']){this['voiceQueues'][_0x2ada44[_0x9c3c('0xc6')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x2ada44[_0x9c3c('0xc6')]][_0x9c3c('0xd2')]+=0x1;this[_0x9c3c('0x1e')][_0x2ada44['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x52b147[_0x9c3c('0x6f')]=0xa;_0x52b147[_0x9c3c('0x70')]=_0x9c3c('0xd3');_0x52b147['dropreason']=_0x9c3c('0xd4');_0x52b147[_0x9c3c('0xd5')]=this[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]][_0x9c3c('0xca')]?moment()[_0x9c3c('0x88')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x52b147[_0x9c3c('0xd6')]+=0x1;_0x52b147[_0x9c3c('0xd7')]+=0x1;_0x2f6f0e=this[_0x9c3c('0x1e')][_0x2ada44['queue']]['dialDropRetryFrequency'];_0xde85e8=this[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x9c3c('0xd8')](_0x52b147,_0x52b147[_0x9c3c('0x6f')],_0x238c4a['voiceQueue'])[_0x9c3c('0x40')](function(_0x822166){_0x420346=_0x822166[_0x9c3c('0xd9')]==0x1;if(_0x52b147[_0x9c3c('0xd6')]>=_0x307a06[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]][_0x9c3c('0xda')]){_0x307a06[_0x9c3c('0xdb')](_0x52b147,_0x822166[_0x9c3c('0xd9')]);}else{hopperUtils[_0x9c3c('0xdc')]({'active':![],'countdropretry':_0x52b147[_0x9c3c('0xd6')],'scheduledat':moment()[_0x9c3c('0xdd')](_0x307a06[_0x9c3c('0x1e')][_0x2ada44['queue']]['dialDropRetryFrequency'],_0x9c3c('0xde'))[_0x9c3c('0x88')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x238c4a[_0x9c3c('0xdf')],'ListId':_0x238c4a['ListId'],'VoiceQueueId':_0x238c4a[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x238c4a[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch('[rescheduleContact][Drop]'));var _0x338efe=new History(_0x52b147);_0x338efe[_0x9c3c('0x6f')]=0xa;_0x338efe[_0x9c3c('0x70')]=_0x9c3c('0xd3');_0x338efe[_0x9c3c('0xe2')]=moment()[_0x9c3c('0x88')]('YYYY-MM-DD\x20HH:mm:ss');_0x338efe[_0x9c3c('0x71')]=_0x338efe[_0x9c3c('0xe2')];_0x338efe[_0x9c3c('0xe3')]=_0x52b147['calleridname'];_0x338efe[_0x9c3c('0xe4')]=_0x52b147['calleridnum'];hopperUtils[_0x9c3c('0xcc')](_0x338efe)['catch'](loggerCatch(_0x9c3c('0xe5')));}})[_0x9c3c('0x40')](function(){if(_0x420346)hopperUtils[_0x9c3c('0xe6')](_0x52b147,_0x2f6f0e,_0xde85e8)[_0x9c3c('0x40')](function(){return 0x1;});});}else{this[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]][_0x9c3c('0xe7')]+=0x1;this[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]][_0x9c3c('0xe8')]+=0x1;_0x52b147[_0x9c3c('0x6f')]=0xb;_0x52b147[_0x9c3c('0x70')]='Abandoned';_0x52b147['dropreason']='CALLEREXIT';_0x52b147[_0x9c3c('0xe9')]+=0x1;_0x52b147[_0x9c3c('0xd7')]+=0x1;_0x2f6f0e=this[_0x9c3c('0x1e')][_0x2ada44['queue']]['dialAbandonedRetryFrequency'];_0xde85e8=this[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x9c3c('0xd8')](_0x52b147,_0x52b147[_0x9c3c('0x6f')],_0x238c4a[_0x9c3c('0xea')])[_0x9c3c('0x40')](function(_0xe75da6){if(_0x52b147[_0x9c3c('0xe9')]>=_0x307a06[_0x9c3c('0x1e')][_0x2ada44['queue']][_0x9c3c('0xeb')]){_0x307a06[_0x9c3c('0xdb')](_0x52b147,_0xe75da6[_0x9c3c('0xd9')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x52b147[_0x9c3c('0xe9')],'scheduledat':moment()[_0x9c3c('0xdd')](_0x307a06[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]]['dialAbandonedRetryFrequency'],'minutes')[_0x9c3c('0x88')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x238c4a['ContactId'],'ListId':_0x238c4a[_0x9c3c('0xec')],'VoiceQueueId':_0x238c4a[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x238c4a[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0xed')));var _0x1d0e31=new History(_0x52b147);_0x1d0e31[_0x9c3c('0x6f')]=0xb;_0x1d0e31[_0x9c3c('0x70')]='Abandoned';_0x1d0e31[_0x9c3c('0xe2')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1d0e31[_0x9c3c('0x71')]=_0x1d0e31['starttime'];_0x1d0e31[_0x9c3c('0xe3')]=_0x52b147[_0x9c3c('0xe3')];_0x1d0e31[_0x9c3c('0xe4')]=_0x52b147[_0x9c3c('0xe4')];hopperUtils[_0x9c3c('0xcc')](_0x1d0e31)['catch'](loggerCatch(_0x9c3c('0xee')));}})[_0x9c3c('0x40')](function(){if(_0x420346)hopperUtils['swapAdditionalPhones'](_0x52b147,_0x2f6f0e,_0xde85e8)[_0x9c3c('0x40')](function(){return 0x1;});});}}}};Dialer[_0x9c3c('0x19')]['syncNewExten']=function(_0x1e0a3f){if(this[_0x9c3c('0x24')][_0x1e0a3f[_0x9c3c('0xc3')]]){this['actions'][_0x1e0a3f['uniqueid']][_0x9c3c('0xef')]=_0x1e0a3f[_0x9c3c('0xef')];}if(this[_0x9c3c('0x25')][_0x1e0a3f['uniqueid']]){this['uniqueId'][_0x1e0a3f[_0x9c3c('0xc3')]][_0x9c3c('0xef')]=_0x1e0a3f[_0x9c3c('0xef')];}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x3b')]=function(_0x2a1f2d){if(!this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]]){return;}var _0xa709c4=this[_0x9c3c('0x1e')][this[_0x9c3c('0x24')][_0x2a1f2d['actionid']][_0x9c3c('0xc6')]]['strategy']||_0x9c3c('0xf1');if(_0xa709c4===_0x9c3c('0xf2')){if(this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]]&&_['isNil'](this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]][_0x9c3c('0xf3')])&&_0x2a1f2d[_0x9c3c('0x8a')]==='1'&&_0x2a1f2d[_0x9c3c('0xf4')]==='0'){if(this[_0x9c3c('0x20')][_0x2a1f2d['stateinterface']]){if(!this[_0x9c3c('0x20')][_0x2a1f2d[_0x9c3c('0xf5')]][_0x9c3c('0xf3')]){this['agents'][_0x2a1f2d[_0x9c3c('0xf5')]][_0x9c3c('0xf3')]=!![];this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]][_0x9c3c('0xf3')]=!![];this[_0x9c3c('0x24')][_0x2a1f2d['actionid']][_0x9c3c('0xf5')]=_0x2a1f2d[_0x9c3c('0xf5')];}}}}else if(_0xa709c4===_0x9c3c('0xf1')){if(this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]]){if(this[_0x9c3c('0x20')][_0x2a1f2d[_0x9c3c('0xf5')]]){this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]][_0x9c3c('0xf5')]=_0x2a1f2d[_0x9c3c('0xf5')];if(_[_0x9c3c('0xf6')](this['queueBooked'][this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]])){this[_0x9c3c('0xf7')][this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]]=[];}this[_0x9c3c('0xf7')][this['actions'][_0x2a1f2d[_0x9c3c('0xf0')]]['queue']][_0x9c3c('0x9b')](_[_0x9c3c('0x5d')](_[_0x9c3c('0x76')](this[_0x9c3c('0x24')][_0x2a1f2d['actionid']],['idHopper','stateinterface']),{'status':_0x2a1f2d[_0x9c3c('0x8a')],'paused':_0x2a1f2d[_0x9c3c('0xf4')]}));}}}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x3d')]=function(_0x3ee790){if(!this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]]){return;}var _0x215d0a=this;var _0x13dc1f=this[_0x9c3c('0x1e')][this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]];var _0x18cddb=_0x13dc1f[_0x9c3c('0xf8')]||'rrmemory';if(_0x18cddb===_0x9c3c('0xf2')){if(this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]]&&this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xf5')]){this['preview']['run'](this['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xf9')],this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xf5')])['catch'](function(_0x30a900){logger[_0x9c3c('0x64')](_0x9c3c('0xfa'),util['inspect'](_0x30a900,{'showHidden':![],'depth':null}));})[_0x9c3c('0x1c')](function(){_0x215d0a[_0x9c3c('0xc5')](_0x215d0a[_0x9c3c('0x1e')][_0x215d0a['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]]);_0x215d0a['agents'][_0x215d0a[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xf5')]]['locked']=![];delete _0x215d0a[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]];unlockQueueStatus(_0x13dc1f);});}else{this['updateOriginated'](this[_0x9c3c('0x1e')][this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]]);hopperUtils[_0x9c3c('0xdc')]({'active':![],'ContactId':this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]]['ContactId'],'ListId':this['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xec')],'VoiceQueueId':this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xe0')]||undefined,'CampaignId':this[_0x9c3c('0x24')][_0x3ee790['actionid']][_0x9c3c('0xe1')]||undefined})['catch'](loggerCatch(_0x9c3c('0xfb')));delete this['actions'][_0x3ee790['actionid']];unlockQueueStatus(_0x13dc1f);}}else if(_0x18cddb===_0x9c3c('0xf1')){var _0x4b9f11;if(this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]]&&!_[_0x9c3c('0x7a')](this['queueBooked'][this[_0x9c3c('0x24')][_0x3ee790['actionid']][_0x9c3c('0xc6')]])){if(this[_0x9c3c('0x28')][_0x215d0a['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]]){this[_0x9c3c('0x28')][_0x215d0a[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]]=this[_0x9c3c('0x28')][this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]]['queue']]?this[_0x9c3c('0x28')][this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]]['queue']]:this['queueBooked'][this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]]?this[_0x9c3c('0xf7')][this['actions'][_0x3ee790['actionid']][_0x9c3c('0xc6')]]['_rr']||0x0:0x0;}this[_0x9c3c('0xf7')][this['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]][_0x9c3c('0xfc')]=this[_0x9c3c('0x28')][this['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]];for(var _0x566dfb=0x0;_0x566dfb=_0x50200d['dialGlobalMaxRetry']){_0x2fcd21[_0x9c3c('0x120')](_0x4ad14f,_0x2bfab4,_0x5dd2cb,_0x9c3c('0x121'));}else{if(_0x4ad14f['countmachineretry']>=_0x50200d[_0x9c3c('0x122')]){_0x2fcd21[_0x9c3c('0x123')](_0x4ad14f,_0x2bfab4,_0x5dd2cb,_0x9c3c('0x124'));}else{hopperUtils[_0x9c3c('0xdc')]({'active':![],'countmachineretry':_0x4ad14f[_0x9c3c('0x119')],'scheduledat':moment()[_0x9c3c('0xdd')](_0x50200d[_0x9c3c('0x125')],_0x9c3c('0xde'))[_0x9c3c('0x88')](_0x9c3c('0xc8')),'ContactId':_0x4ad14f['ContactId'],'ListId':_0x4ad14f['ListId'],'VoiceQueueId':_0x4ad14f[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x4ad14f[_0x9c3c('0xe1')]||undefined})['catch'](loggerCatch(_0x9c3c('0x126')));_0x2bfab4({'reschedule':0x1});}}});}if(_0x49096b[_0x9c3c('0x44')]==='ivr'&&this[_0x9c3c('0x1f')][_0x49096b[_0x9c3c('0xc6')]][_0x9c3c('0x10d')]&&_0x1a57f8['value']===_0x9c3c('0x10f')){delete this[_0x9c3c('0x25')][_0x1a57f8['uniqueid']];this['updateOriginated'](this[_0x9c3c('0x1f')][_0x49096b['queue']]);_0x199b07=new Hangup(_0x49096b,_0x1a57f8);_0x199b07['state']=0x12;_0x199b07[_0x9c3c('0x70')]=_0x9c3c('0x127');_0x199b07[_0x9c3c('0x111')]=_0x9c3c('0x112');ami[_0x9c3c('0x43')](_0x9c3c('0x11a'),ut['buildObj'](_0x199b07,'amd'));this[_0x9c3c('0x115')](_0x199b07,_0x9c3c('0x128'),_0x9c3c('0x129'));}if(_0x49096b['type']===_0x9c3c('0xc4')&&this['campaigns'][_0x49096b[_0x9c3c('0xc6')]][_0x9c3c('0x10d')]&&_0x1a57f8[_0x9c3c('0x10e')]===_0x9c3c('0x118')){return new Promise(function(_0x2007df,_0x38e99e){delete _0x2fcd21['uniqueId'][_0x1a57f8[_0x9c3c('0xc3')]];_0x2fcd21[_0x9c3c('0xc5')](_0x2fcd21[_0x9c3c('0x1f')][_0x49096b[_0x9c3c('0xc6')]]);_0x2fcd21['campaigns'][_0x49096b[_0x9c3c('0xc6')]][_0x9c3c('0xc9')]+=0x1;_0x2fcd21['campaigns'][_0x49096b[_0x9c3c('0xc6')]][_0x9c3c('0x110')]+=0x1;var _0x51a95d=_0x2fcd21[_0x9c3c('0x1f')][_0x49096b[_0x9c3c('0xc6')]];var _0x558b70=new Hangup(_0x49096b,_0x1a57f8);_0x558b70['state']=0x13;_0x558b70[_0x9c3c('0x70')]='Machine';_0x558b70[_0x9c3c('0x111')]='AMD';_0x558b70[_0x9c3c('0x119')]+=0x1;_0x558b70['countglobal']+=0x1;_0x558b70[_0x9c3c('0x114')]=!![];ami[_0x9c3c('0x43')](_0x9c3c('0x11a'),ut[_0x9c3c('0x113')](_0x558b70,_0x9c3c('0x114')));hopperUtils[_0x9c3c('0xcc')](_0x558b70)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x11b')));if(_0x558b70['countbusyretry']+_0x558b70[_0x9c3c('0x11d')]+_0x558b70['countnoanswerretry']+_0x558b70[_0x9c3c('0x11e')]+_0x558b70[_0x9c3c('0xd6')]+_0x558b70[_0x9c3c('0xe9')]+_0x558b70[_0x9c3c('0x119')]+_0x558b70[_0x9c3c('0x11f')]>=_0x51a95d[_0x9c3c('0x12a')]){_0x2fcd21[_0x9c3c('0x120')](_0x558b70,_0x2007df,_0x38e99e,_0x9c3c('0x121'));}else{if(_0x558b70[_0x9c3c('0x119')]>=_0x51a95d[_0x9c3c('0x122')]){_0x2fcd21[_0x9c3c('0x123')](_0x558b70,_0x2007df,_0x38e99e,'reason\x2019\x20machine....');}else{hopperUtils[_0x9c3c('0xdc')]({'active':![],'countmachineretry':_0x558b70[_0x9c3c('0x119')],'scheduledat':moment()[_0x9c3c('0xdd')](_0x51a95d[_0x9c3c('0x125')],_0x9c3c('0xde'))[_0x9c3c('0x88')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x558b70[_0x9c3c('0xdf')],'ListId':_0x558b70[_0x9c3c('0xec')],'VoiceQueueId':_0x558b70[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x558b70['CampaignId']||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x126')));_0x2007df({'reschedule':0x1});}}});}}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x36')]=function(_0x31ace4){var _0x30f761=this[_0x9c3c('0x25')][_0x31ace4[_0x9c3c('0xc3')]];var _0x5e62d7;if(_0x30f761&&_0x30f761[_0x9c3c('0x44')]===_0x9c3c('0xc4')){delete this['uniqueId'][_0x31ace4[_0x9c3c('0xc3')]];this['updateOriginated'](this['campaigns'][_0x30f761['queue']]);this['campaigns'][_0x30f761[_0x9c3c('0xc6')]][_0x9c3c('0x12b')]+=0x1;_0x5e62d7=new Hangup(_0x30f761,_0x31ace4);hopperUtils[_0x9c3c('0xcc')](_0x5e62d7)['catch'](loggerCatch(_0x9c3c('0x12c')));hopperUtils[_0x9c3c('0xce')](_0x5e62d7)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x12d')));}if(_0x30f761&&_0x30f761[_0x9c3c('0x44')]!==_0x9c3c('0xc4')&&isNotNull(this[_0x9c3c('0x1e')][_0x30f761[_0x9c3c('0xc6')]][_0x9c3c('0x12e')])){delete this['uniqueId'][_0x31ace4[_0x9c3c('0xc3')]];this['updateOriginated'](this['voiceQueues'][_0x30f761[_0x9c3c('0xc6')]]);this[_0x9c3c('0x1e')][_0x30f761[_0x9c3c('0xc6')]][_0x9c3c('0xc9')]+=0x1;this[_0x9c3c('0x1e')][_0x30f761['queue']][_0x9c3c('0x110')]+=0x1;_0x5e62d7=new Hangup(_0x30f761,_0x31ace4);_0x5e62d7[_0x9c3c('0x6f')]=0x10;_0x5e62d7[_0x9c3c('0x70')]=_0x9c3c('0x12f');_0x5e62d7['membername']='AGI';hopperUtils[_0x9c3c('0xcc')](_0x5e62d7)['catch'](loggerCatch(_0x9c3c('0x12c')));hopperUtils[_0x9c3c('0xce')](_0x5e62d7)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x30f761&&_0x30f761[_0x9c3c('0x44')]!=='ivr'&&!isNotNull(this[_0x9c3c('0x1e')][_0x30f761[_0x9c3c('0xc6')]][_0x9c3c('0x12e')])){delete this[_0x9c3c('0x25')][_0x31ace4[_0x9c3c('0xc3')]];this[_0x9c3c('0xc5')](this[_0x9c3c('0x1e')][_0x30f761[_0x9c3c('0xc6')]]);this[_0x9c3c('0x1e')][_0x30f761[_0x9c3c('0xc6')]][_0x9c3c('0x130')]+=0x1;_0x5e62d7=new Hangup(_0x30f761,_0x31ace4);_0x5e62d7[_0x9c3c('0x6f')]=0xc;_0x5e62d7['statedesc']=_0x31ace4[_0x9c3c('0x131')];_0x5e62d7['membername']=_0x9c3c('0x132');hopperUtils[_0x9c3c('0xcc')](_0x5e62d7)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x12c')));hopperUtils[_0x9c3c('0xce')](_0x5e62d7)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x12d')));}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x8')]=function(_0x199f31){var _0x2c3c1a=this;if(!_0x2c3c1a[_0x9c3c('0x29')][_0x199f31[_0x9c3c('0x48')]]){_0x2c3c1a[_0x9c3c('0x29')][_0x199f31[_0x9c3c('0x48')]]={'running':![]};}else if(_0x2c3c1a[_0x9c3c('0x29')][_0x199f31[_0x9c3c('0x48')]]['running']===!![]){return;}else if(_0x2c3c1a[_0x9c3c('0x29')][_0x199f31[_0x9c3c('0x48')]][_0x9c3c('0x133')]===![]){_0x2c3c1a['queuesSummary'][_0x199f31[_0x9c3c('0x48')]][_0x9c3c('0x133')]=!![];}var _0x56989a=_0x2c3c1a[_0x9c3c('0x1e')][_0x199f31[_0x9c3c('0x48')]];var _0x4bf9d5=_0x56989a[_0x9c3c('0x69')]!==utils[_0x9c3c('0x6c')]['INACTIVE'];var _0x58c50e=utils[_0x9c3c('0x134')](_0x56989a);_0x56989a[_0x9c3c('0x135')]=utils[_0x9c3c('0x136')](_0x56989a,_0x2c3c1a[_0x9c3c('0x21')]);Promise[_0x9c3c('0xaf')]()[_0x9c3c('0x40')](function(){if(_0x56989a[_0x9c3c('0x135')]===utils['CAMPAIGN_STATUS'][_0x9c3c('0x7c')]){if(_0x4bf9d5){clearPredictiveAttributes(_0x56989a);_0x199f31[_0x9c3c('0x60')]=undefined;_0x199f31[_0x9c3c('0x5f')]=undefined;}if(_0x56989a[_0x9c3c('0x135')]===utils[_0x9c3c('0x6c')][_0x9c3c('0x7c')]){_0x199f31[_0x9c3c('0x137')]=0x0;_0x199f31[_0x9c3c('0xf4')]=0x0;_0x199f31[_0x9c3c('0x138')]=0x0;_0x199f31['talking']=0x0;_0x199f31['pTalking']=0x0;}}else if(_0x56989a[_0x9c3c('0x135')]===utils[_0x9c3c('0x6c')][_0x9c3c('0x139')]&&!_0x58c50e){return _0x2c3c1a['ifTime'](_0x56989a,!![])[_0x9c3c('0x40')](function(){return _0x2c3c1a[_0x9c3c('0x94')](_0x56989a,![]);})[_0x9c3c('0x40')](function(){return _0x2c3c1a[_0x9c3c('0xb4')](_0x56989a);})[_0x9c3c('0xa1')](function(_0x5cfcf1){loggerSyncQueueSummary['debug'](_0x9c3c('0x13a'),util[_0x9c3c('0x46')](_0x5cfcf1,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x56989a);});}else{clearPredictiveAttributes(_0x56989a);}})['then'](function(){var _0x133d81=_0x199f31[_0x9c3c('0x13b')](_0x56989a);if(_0x133d81||_0x56989a['queueSummaryCountersUpdated']){_0x56989a[_0x9c3c('0x13c')]=![];_0x199f31[_0x9c3c('0x13d')](_0x56989a);Object[_0x9c3c('0x13e')](_0x56989a,_0x199f31);emitOutboundVoiceQueueSummary(_0x199f31);}_0x2c3c1a[_0x9c3c('0x29')][_0x56989a[_0x9c3c('0x48')]][_0x9c3c('0x133')]=![];})[_0x9c3c('0xa1')](function(_0x272949){logger[_0x9c3c('0x64')](_0x9c3c('0x13a'),util['inspect'](_0x272949,{'showHidden':![],'depth':null}));_0x2c3c1a[_0x9c3c('0x29')][_0x56989a[_0x9c3c('0x48')]][_0x9c3c('0x133')]=![];});};Dialer[_0x9c3c('0x19')][_0x9c3c('0x34')]=_['throttle'](function(){var _0x5cc9e1=_['filter'](this[_0x9c3c('0x1e')],function(_0x2e9e0d){return _0x2e9e0d['dialPreviewRecallmeReminder'];});var _0x56cbef=_[_0x9c3c('0x13f')](this[_0x9c3c('0x20')],function(_0xd443a4){return _0xd443a4[_0x9c3c('0x140')]&&_0xd443a4[_0x9c3c('0x8a')]===_0x9c3c('0x8b');});if(_0x5cc9e1['length']>0x0&&_0x56cbef[_0x9c3c('0x9a')]>0x0){return Promise[_0x9c3c('0xaf')]()[_0x9c3c('0x40')](cmHopper['handlePreviewRecallNotifications'](_[_0x9c3c('0x141')](_0x5cc9e1,'id'),previewRecallmeReminderInterval,_[_0x9c3c('0x141')](_0x56cbef,'id')))['then'](function(_0x5d493b){for(var _0x4c8940=0x0;_0x4c8940<_0x5d493b[_0x9c3c('0x9a')];_0x4c8940++){var _0x2e7dc0=_0x5d493b[_0x4c8940][_0x9c3c('0x142')][_0x9c3c('0x48')];if(_0x2e7dc0)io['to'](util['format'](_0x9c3c('0x143'),_0x2e7dc0))[_0x9c3c('0x43')](_0x9c3c('0x144'),{'hopper':_0x5d493b[_0x4c8940]});}})['catch'](function(_0x34d6be){logger[_0x9c3c('0x64')](_0x9c3c('0x145'),_0x34d6be);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x9c3c('0x19')][_0x9c3c('0x3f')]=function(){var _0xca0222=this;setInterval(function(){_0xca0222['clearZombieChannels'](_0xca0222[_0x9c3c('0x25')],'[uniqueid]');_0xca0222[_0x9c3c('0x146')](_0xca0222['actions'],_0x9c3c('0x147'));},0x32c8);};Dialer[_0x9c3c('0x19')][_0x9c3c('0x146')]=function(_0x410ae,_0x1ae1cc){var _0x52e12a=this;for(var _0x1a1977 in _0x410ae){if(typeof _0x410ae[_0x1a1977]!==_0x9c3c('0xad')){this['sequence'][_0x9c3c('0x1a')](function(){if(!_['isNil'](_0x410ae[_0x1a1977])){return ami['Action']({'action':_0x9c3c('0x8a'),'channel':_0x410ae[_0x1a1977][_0x9c3c('0xef')]})[_0x9c3c('0xa1')](function(_0x41d029){if(_0x41d029[_0x9c3c('0x69')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x410ae[_0x1a1977]&&_0x410ae[_0x1a1977][_0x9c3c('0x44')]!==_0x9c3c('0xc4')){_0x52e12a[_0x9c3c('0xc5')](_0x52e12a[_0x9c3c('0x1e')][_0x410ae[_0x1a1977][_0x9c3c('0xc6')]]);logger['error'](_0x9c3c('0x148'),_0x1ae1cc,_0x1a1977,_0x410ae[_0x1a1977][_0x9c3c('0xc6')]);delete _0x410ae[_0x1a1977];}if(_0x410ae[_0x1a1977]&&_0x410ae[_0x1a1977][_0x9c3c('0x44')]==='ivr'){_0x52e12a[_0x9c3c('0xc5')](_0x52e12a[_0x9c3c('0x1f')][_0x410ae[_0x1a1977][_0x9c3c('0xc6')]]);logger[_0x9c3c('0x64')](_0x9c3c('0x149'),_0x1ae1cc,_0x1a1977,_0x410ae[_0x1a1977][_0x9c3c('0xc6')]);delete _0x410ae[_0x1a1977];}},0x2328);}});}});}}};Dialer[_0x9c3c('0x19')]['getVoiceQueueRtPauses']=function(_0x3ece19){return Promise['resolve']()[_0x9c3c('0x40')](voiceQueueRt['getVoiceQueueRtPauses'](_0x3ece19))[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x14a')));};Dialer[_0x9c3c('0x19')][_0x9c3c('0xc5')]=function(_0x2cd292){if(!_[_0x9c3c('0x42')](_0x2cd292)&&_0x2cd292!==null){if(typeof _0x2cd292[_0x9c3c('0x7f')]!==_0x9c3c('0xad')){if(_0x2cd292[_0x9c3c('0x7f')]>0x0){_0x2cd292['originated']-=0x1;}else{logger[_0x9c3c('0x64')](_0x9c3c('0x14b'));}}}else{logger['error'](_0x9c3c('0x14c'));}};Dialer['prototype'][_0x9c3c('0x14d')]=function(_0x35034e,_0x3f74bb){var _0x2ac33a=this;return function(_0x4d909f){_0x2ac33a['updateOriginated'](_0x3f74bb);logger['error'](_0x35034e,util[_0x9c3c('0x46')](_0x4d909f,{'showHidden':![],'depth':null}));};};Dialer[_0x9c3c('0x19')][_0x9c3c('0x14e')]=function(_0x5e94da,_0x4e9707,_0x36415f){var _0x32a5d3={'state':0x19,'statedesc':_0x9c3c('0x14f')};this[_0x9c3c('0xc5')](_0x4e9707);this[_0x9c3c('0x115')](_[_0x9c3c('0x5d')](_0x32a5d3,_[_0x9c3c('0x76')](_0x36415f,[_0x9c3c('0xdf'),_0x9c3c('0xec'),_0x9c3c('0x150'),'VoiceQueueId',_0x9c3c('0xe1')])),'[emptyContact][createHistory]',_0x9c3c('0x151'));logger[_0x9c3c('0x64')](_0x5e94da);};Dialer[_0x9c3c('0x19')][_0x9c3c('0x115')]=function(_0xc79748,_0x1cd9bb,_0x3f2830){hopperUtils[_0x9c3c('0xcc')](_0xc79748)['catch'](loggerCatch(_0x1cd9bb));hopperUtils['moveContactManagedDialer'](_0xc79748)[_0x9c3c('0xa1')](loggerCatch(_0x3f2830));};Dialer[_0x9c3c('0x19')]['queueCallerAbandonCreateState']=function(_0x56ccf9,_0x2aa9b6){hopperUtils[_0x9c3c('0xcc')](_0x56ccf9)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0xcd')));if(_0x2aa9b6==0x0){hopperUtils[_0x9c3c('0xce')](_0x56ccf9)['catch'](loggerCatch(_0x9c3c('0x152')));}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x145')]=function(_0x54067a){return Promise[_0x9c3c('0xaf')]()['then'](cmHopper['handlePreviewRecallNotifications'](_0x54067a['id'],previewRecallmeReminderInterval))[_0x9c3c('0x40')](function(_0x1506f2){for(var _0x2a2c0d=0x0;_0x2a2c0d<_0x1506f2[_0x9c3c('0x9a')];_0x2a2c0d++){var _0x299e53=_0x1506f2[_0x2a2c0d]['Agent'][_0x9c3c('0x48')];if(_0x299e53)io['to'](util['format'](_0x9c3c('0x143'),_0x299e53))[_0x9c3c('0x43')](_0x9c3c('0x144'),{'hopper':_0x1506f2[_0x2a2c0d]});}})[_0x9c3c('0xa1')](function(){});};Dialer[_0x9c3c('0x19')][_0x9c3c('0xb2')]=function(_0x8923bb){var _0x1def57=this;return function(){_0x1def57['handleIvr'](_0x8923bb);};};Dialer['prototype'][_0x9c3c('0x153')]=function(_0x26bdd7,_0x1c8683){var _0x56b4d9=this;var _0x428627=uuid['v4']();this[_0x9c3c('0x24')][_0x428627]=new Action(_0x26bdd7,_0x1c8683,_0x428627);return new Promise(function(_0xfdb539,_0x14a661){if(_[_0x9c3c('0x42')](_0x26bdd7)&&typeof _0x26bdd7!==_0x9c3c('0x154')){return _0x14a661(msgResponse('originate',_0x9c3c('0x95'),_0x9c3c('0x155')));}if(_[_0x9c3c('0x42')](_0x1c8683[_0x9c3c('0x156')])||_0x1c8683[_0x9c3c('0x156')]===null){return _0x14a661(msgResponse(_0x9c3c('0x157'),_0x9c3c('0x95'),_0x9c3c('0x158')));}var _0x55649b={'XMD-CALLERID':_0x56b4d9[_0x9c3c('0x24')][_0x428627][_0x9c3c('0x159')](),'XMD-AGI':_0x26bdd7[_0x9c3c('0x12e')]?util[_0x9c3c('0x88')](_0x9c3c('0x15a'),ipAgi,_0x26bdd7[_0x9c3c('0x12e')]):_0x9c3c('0x15b'),'XMD-AGIAFTER':_0x26bdd7['dialQueueProject2']?util[_0x9c3c('0x88')](_0x9c3c('0x15a'),ipAgi,_0x26bdd7[_0x9c3c('0xca')]):_0x9c3c('0x15b'),'XMD-QUEUE':utils[_0x9c3c('0x15c')](_0x26bdd7)?util[_0x9c3c('0x88')](_0x9c3c('0x15d'),_0x26bdd7['name'],_0x26bdd7['dialQueueOptions']||'',_0x26bdd7['dialAgiAfterHangupAgent']?'c':'',_0x26bdd7['dialQueueTimeout']||0x3):_0x9c3c('0x15b'),'XMD-CONTACTID':_0x1c8683[_0x9c3c('0xdf')],'XMD-CDRTYPE':_0x9c3c('0x15e'),'CALLERID(all)':_0x56b4d9['actions'][_0x428627][_0x9c3c('0x159')](),'XMD-AMD':_0x26bdd7[_0x9c3c('0x10d')]?_0x9c3c('0x139'):_0x9c3c('0x15b'),'XMD-DESTINATION':_0x9c3c('0x10c')};if(_0x26bdd7[_0x9c3c('0x10d')]){_0x55649b[_0x9c3c('0x15f')]=_0x26bdd7[_0x9c3c('0x160')]||0x9c4;_0x55649b[_0x9c3c('0x161')]=_0x26bdd7['dialAMDGreeting']||0x5dc;_0x55649b[_0x9c3c('0x162')]=_0x26bdd7[_0x9c3c('0x163')]||0x320;_0x55649b[_0x9c3c('0x164')]=_0x26bdd7[_0x9c3c('0x165')]||0x1388;_0x55649b[_0x9c3c('0x166')]=_0x26bdd7[_0x9c3c('0x167')]||0x64;_0x55649b[_0x9c3c('0x168')]=_0x26bdd7[_0x9c3c('0x169')]||0x32;_0x55649b[_0x9c3c('0x16a')]=_0x26bdd7[_0x9c3c('0x16b')]||0x3;_0x55649b[_0x9c3c('0x16c')]=_0x26bdd7[_0x9c3c('0x16d')]||0x100;_0x55649b[_0x9c3c('0x16e')]=_0x26bdd7[_0x9c3c('0x16f')]||0x1388;}if(utils[_0x9c3c('0x15c')](_0x26bdd7)){_0x55649b[_0x9c3c('0x170')]=_0x1c8683[_0x9c3c('0xe0')];}else{_0x55649b[_0x9c3c('0x171')]=_0x1c8683[_0x9c3c('0xe1')];}var _0x38a6d2=utils[_0x9c3c('0x172')](_0x1c8683[_0x9c3c('0x173')]);Object[_0x9c3c('0x13e')](_0x55649b,_0x38a6d2);var _0x5c6b81=_0x56b4d9['isTrunkReachable'](_0x26bdd7[_0x9c3c('0x8e')])?utils[_0x9c3c('0x174')](_0x26bdd7['Trunk']['callerid'],_0x26bdd7[_0x9c3c('0x175')],_0x26bdd7[_0x9c3c('0x176')]>0x0?utils['getCallerIdRandom'](_0x26bdd7[_0x9c3c('0x177')],_0x26bdd7['dialRandomLastDigitCallerIdNumber']):_0x26bdd7['dialOriginateCallerIdNumber']):utils[_0x9c3c('0x174')](_[_0x9c3c('0xf6')](_0x26bdd7[_0x9c3c('0x8f')])?_0x26bdd7['Trunk'][_0x9c3c('0x178')]:_0x26bdd7[_0x9c3c('0x8f')][_0x9c3c('0x178')],_0x26bdd7[_0x9c3c('0x175')],_0x26bdd7[_0x9c3c('0x176')]>0x0?utils['getCallerIdRandom'](_0x26bdd7[_0x9c3c('0x177')],_0x26bdd7[_0x9c3c('0x176')]):_0x26bdd7[_0x9c3c('0x177')]);if(_0x5c6b81){_0x55649b[_0x9c3c('0x179')]=_0x56b4d9[_0x9c3c('0x24')][_0x428627]['originatecalleridname']=utils['extractCalleridName'](_0x5c6b81);_0x55649b['XMD-ORIGINATECALLERIDNUM']=_0x1c8683[_0x9c3c('0x156')];}_0x26bdd7[_0x9c3c('0x17a')]=_0x55649b;return ami[_0x9c3c('0x17b')]({'actionid':_0x428627,'action':'originate','channel':_0x56b4d9[_0x9c3c('0x86')](_0x26bdd7[_0x9c3c('0x8e')])?util[_0x9c3c('0x88')]('SIP/%s/%s%s',_0x26bdd7[_0x9c3c('0x8e')][_0x9c3c('0x48')],isNotNull(_0x26bdd7[_0x9c3c('0x17c')])?_0x26bdd7[_0x9c3c('0x17c')][_0x9c3c('0x17d')]()||'':'',_0x26bdd7[_0x9c3c('0x17e')]>0x0?_0x1c8683[_0x9c3c('0x156')]['substring'](_0x26bdd7['dialCutDigit']):_0x1c8683[_0x9c3c('0x156')]):util['format']('SIP/%s/%s%s',_['isNil'](_0x26bdd7[_0x9c3c('0x8f')])?_0x26bdd7['Trunk']['name']:_0x26bdd7[_0x9c3c('0x8f')][_0x9c3c('0x48')],isNotNull(_0x26bdd7[_0x9c3c('0x17c')])?_0x26bdd7['dialPrefix'][_0x9c3c('0x17d')]()||'':'',_0x26bdd7[_0x9c3c('0x17e')]>0x0?_0x1c8683[_0x9c3c('0x156')][_0x9c3c('0x17f')](_0x26bdd7[_0x9c3c('0x17e')]):_0x1c8683['phone']),'callerid':_0x5c6b81,'Exten':'xcally-motion-dialer','Context':_0x9c3c('0x180'),'Priority':'1','variable':_0x55649b,'timeout':(_0x26bdd7['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x428627})['then'](function(_0x5934e3){return _0xfdb539(_0x5934e3);})[_0x9c3c('0xa1')](function(_0x1d90f0){_0x26bdd7['outboundOriginateFailureCallsDay']+=0x1;var _0x3553f8=new History(_0x56b4d9[_0x9c3c('0x24')][_0x428627]);logger[_0x9c3c('0x64')](util['format']('[originateError]:\x20%s',JSON['stringify'](_0x1d90f0)));_0x3553f8[_0x9c3c('0x6f')]=0xe;_0x3553f8[_0x9c3c('0x70')]='OriginateError';_0x3553f8[_0x9c3c('0xe2')]=moment()['format'](_0x9c3c('0xc8'));_0x3553f8[_0x9c3c('0x71')]=_0x3553f8[_0x9c3c('0xe2')];hopperUtils[_0x9c3c('0xcc')](_0x3553f8)['catch'](loggerCatch('[originate][error]'));_0x56b4d9[_0x9c3c('0xce')](_0x3553f8)['catch'](loggerCatch('[originate][error]'))[_0x9c3c('0x1c')](function(){delete _0x56b4d9[_0x9c3c('0x24')][_0x428627];return _0x14a661(msgResponse(_0x9c3c('0x157'),_0x9c3c('0x85'),'originate\x20action\x20Error'));});});});};Dialer[_0x9c3c('0x19')][_0x9c3c('0x181')]=function(_0x110a31,_0x2d567a,_0x2e2292){var _0x257d27=new History(_0x2d567a);if(_0x257d27['countbusyretry']+_0x257d27[_0x9c3c('0x11d')]+_0x257d27[_0x9c3c('0x182')]+_0x257d27[_0x9c3c('0x11e')]+_0x257d27['countdropretry']+_0x257d27[_0x9c3c('0xe9')]+_0x257d27[_0x9c3c('0x119')]+_0x257d27[_0x9c3c('0x11f')]>=_0x2e2292['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x110a31){case 0x3:if(_0x257d27[_0x9c3c('0x182')]>=_0x2e2292[_0x9c3c('0x183')]-0x1){return!![];}hopperUtils[_0x9c3c('0xdc')]({'active':![],'countnoanswerretry':_0x257d27[_0x9c3c('0x182')]+=0x1,'scheduledat':moment()[_0x9c3c('0xdd')](_0x2e2292[_0x9c3c('0x184')],_0x9c3c('0xde'))['format'](_0x9c3c('0xc8')),'ContactId':_0x257d27['ContactId'],'ListId':_0x257d27[_0x9c3c('0xec')],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x185')));break;case 0x5:if(_0x257d27[_0x9c3c('0x11c')]>=_0x2e2292['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x9c3c('0xdc')]({'active':![],'countbusyretry':_0x257d27[_0x9c3c('0x11c')]+=0x1,'scheduledat':moment()[_0x9c3c('0xdd')](_0x2e2292[_0x9c3c('0x186')],_0x9c3c('0xde'))['format'](_0x9c3c('0xc8')),'ContactId':_0x257d27[_0x9c3c('0xdf')],'ListId':_0x257d27[_0x9c3c('0xec')],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x187')));break;case 0x8:if(_0x257d27['countcongestionretry']>=_0x2e2292[_0x9c3c('0x188')]-0x1){return!![];}hopperUtils[_0x9c3c('0xdc')]({'active':![],'countcongestionretry':_0x257d27['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x2e2292[_0x9c3c('0x189')],'minutes')['format'](_0x9c3c('0xc8')),'ContactId':_0x257d27['ContactId'],'ListId':_0x257d27[_0x9c3c('0xec')],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27['CampaignId']||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x18a')));break;case 0x0:if(_0x257d27['countnosuchnumberretry']>=_0x2e2292[_0x9c3c('0x18b')]-0x1){return!![];}else{hopperUtils[_0x9c3c('0xdc')]({'active':![],'countnosuchnumberretry':_0x257d27[_0x9c3c('0x11e')]+=0x1,'scheduledat':moment()['add'](_0x2e2292['dialNoSuchNumberRetryFrequency'],_0x9c3c('0xde'))['format'](_0x9c3c('0xc8')),'ContactId':_0x257d27[_0x9c3c('0xdf')],'ListId':_0x257d27[_0x9c3c('0xec')],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x257d27[_0x9c3c('0xd6')]>=_0x2e2292['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x9c3c('0xdc')]({'active':![],'countdropretry':_0x257d27[_0x9c3c('0xd6')]+=0x1,'scheduledat':moment()[_0x9c3c('0xdd')](_0x2e2292['dialDropRetryFrequency'],_0x9c3c('0xde'))[_0x9c3c('0x88')](_0x9c3c('0xc8')),'ContactId':_0x257d27[_0x9c3c('0xdf')],'ListId':_0x257d27[_0x9c3c('0xec')],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27[_0x9c3c('0xe1')]||undefined})['catch'](loggerCatch(_0x9c3c('0x18c')));break;case 0xb:if(_0x257d27[_0x9c3c('0xe9')]>=_0x2e2292[_0x9c3c('0xeb')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x257d27[_0x9c3c('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x2e2292[_0x9c3c('0x18d')],_0x9c3c('0xde'))[_0x9c3c('0x88')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x257d27[_0x9c3c('0xdf')],'ListId':_0x257d27['ListId'],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0xed')));break;case 0x13:if(_0x257d27[_0x9c3c('0x119')]>=_0x2e2292['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x257d27[_0x9c3c('0x119')]+=0x1,'scheduledat':moment()[_0x9c3c('0xdd')](_0x2e2292[_0x9c3c('0x125')],_0x9c3c('0xde'))[_0x9c3c('0x88')](_0x9c3c('0xc8')),'ContactId':_0x257d27[_0x9c3c('0xdf')],'ListId':_0x257d27['ListId'],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x126')));break;case 0x14:if(_0x257d27[_0x9c3c('0x11f')]>=_0x2e2292[_0x9c3c('0x18e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x257d27[_0x9c3c('0x11f')]+=0x1,'scheduledat':moment()[_0x9c3c('0xdd')](_0x2e2292[_0x9c3c('0x18f')],_0x9c3c('0xde'))[_0x9c3c('0x88')](_0x9c3c('0xc8')),'ContactId':_0x257d27[_0x9c3c('0xdf')],'ListId':_0x257d27['ListId'],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x190')));break;default:return!![];}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x108')]=function(_0x5724ec,_0x31113f,_0x521f6d){var _0x2940fe=this;var _0x23ab3e=new History(_0x5724ec);var _0x45a4a5=![];var _0x40166f;var _0x544565;return new Promise(function(_0x306148,_0x38727b){if(_[_0x9c3c('0x42')](_0x31113f)&&typeof _0x31113f!==_0x9c3c('0x154')){return _0x38727b(msgResponse(_0x9c3c('0x191'),'Failure',_0x9c3c('0x192')));}if(_[_0x9c3c('0x42')](_0x521f6d)&&typeof _0x521f6d!==_0x9c3c('0x154')){return _0x38727b(msgResponse('[callProgressDetecting]',_0x9c3c('0x95'),_0x9c3c('0x193')));}hopperUtils[_0x9c3c('0xd8')](_0x23ab3e,_0x521f6d[_0x9c3c('0x194')],_0x31113f)['then'](function(_0x525fc9){if(_0x525fc9[_0x9c3c('0xd9')]==0x1)_0x45a4a5=!![];switch(_0x521f6d[_0x9c3c('0x194')]){case'0':_0x31113f[_0x9c3c('0x195')]+=0x1;_0x23ab3e['state']=0x0;_0x23ab3e['statedesc']=_0x9c3c('0x196');_0x23ab3e[_0x9c3c('0x11e')]+=0x1;_0x23ab3e[_0x9c3c('0xd7')]+=0x1;ami[_0x9c3c('0x43')](_0x9c3c('0x197'),ut[_0x9c3c('0x113')](_0x5724ec,_0x9c3c('0x198')));_0x40166f=_0x31113f['dialNoSuchNumberRetryFrequency'];_0x544565=_0x31113f[_0x9c3c('0x199')];hopperUtils[_0x9c3c('0xcc')](_0x23ab3e)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x11b')));if(_0x2940fe[_0x9c3c('0x181')](0x0,_0x5724ec,_0x31113f)&&!_0x45a4a5){if(_0x23ab3e[_0x9c3c('0x11e')]>=_0x31113f[_0x9c3c('0x18b')]){_0x2940fe['createStateFinal'](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x19a'));}else{_0x2940fe[_0x9c3c('0x120')](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x19a'));}}break;case'3':_0x31113f[_0x9c3c('0x19b')]+=0x1;_0x23ab3e['state']=0x3;_0x23ab3e['statedesc']=_0x9c3c('0x19c');_0x23ab3e[_0x9c3c('0x182')]+=0x1;_0x23ab3e[_0x9c3c('0xd7')]+=0x1;var _0x507576=ut[_0x9c3c('0x19d')](_0x5724ec,_0x31113f);ami['emit']('custom:agentnoanswer',_0x507576);_0x40166f=_0x31113f[_0x9c3c('0x184')];_0x544565=_0x31113f[_0x9c3c('0x199')];hopperUtils[_0x9c3c('0xcc')](_0x23ab3e)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x19e')));if(_0x2940fe[_0x9c3c('0x181')](0x3,_0x5724ec,_0x31113f)&&!_0x45a4a5){if(_0x23ab3e[_0x9c3c('0x182')]>=_0x31113f[_0x9c3c('0x183')]){_0x2940fe[_0x9c3c('0x123')](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x19f'));}else{_0x2940fe[_0x9c3c('0x120')](_0x23ab3e,_0x306148,_0x38727b,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x31113f[_0x9c3c('0x1a0')]+=0x1;_0x23ab3e[_0x9c3c('0x6f')]=0x5;_0x23ab3e['statedesc']='Busy';_0x23ab3e[_0x9c3c('0x11c')]+=0x1;_0x23ab3e['countglobal']+=0x1;ami[_0x9c3c('0x43')](_0x9c3c('0x1a1'),ut[_0x9c3c('0x113')](_0x5724ec,'busy'));_0x40166f=_0x31113f[_0x9c3c('0x186')];_0x544565=_0x31113f[_0x9c3c('0x199')];hopperUtils[_0x9c3c('0xcc')](_0x23ab3e)[_0x9c3c('0xa1')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2940fe[_0x9c3c('0x181')](0x5,_0x5724ec,_0x31113f)&&!_0x45a4a5){if(_0x23ab3e[_0x9c3c('0x11c')]>=_0x31113f[_0x9c3c('0x1a2')]){_0x2940fe[_0x9c3c('0x123')](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x1a3'));}else{_0x2940fe[_0x9c3c('0x120')](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x1a3'));}}break;case'8':_0x31113f[_0x9c3c('0x1a4')]+=0x1;_0x23ab3e[_0x9c3c('0x6f')]=0x8;_0x23ab3e[_0x9c3c('0x70')]=_0x9c3c('0x1a5');_0x23ab3e[_0x9c3c('0x11d')]+=0x1;_0x23ab3e[_0x9c3c('0xd7')]+=0x1;_0x40166f=_0x31113f['dialCongestionRetryFrequency'];_0x544565=_0x31113f['callAdditionalPhoneAfterMin'];ami[_0x9c3c('0x43')](_0x9c3c('0x1a6'),ut[_0x9c3c('0x113')](_0x5724ec,_0x9c3c('0x1a7')));hopperUtils['createHistory'](_0x23ab3e)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x1a8')));if(_0x2940fe[_0x9c3c('0x181')](0x8,_0x5724ec,_0x31113f)&&!_0x45a4a5){if(_0x23ab3e['countcongestionretry']>=_0x31113f[_0x9c3c('0x188')]){_0x2940fe[_0x9c3c('0x123')](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x1a9'));}else{_0x2940fe['stateGlobal'](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x1a9'));}}break;case'11':_0x31113f[_0x9c3c('0x1aa')]+=0x1;_0x23ab3e['state']=0xb;_0x23ab3e[_0x9c3c('0x70')]='Abandoned';_0x23ab3e['countabandonedretry']+=0x1;_0x23ab3e['countglobal']+=0x1;_0x40166f=_0x31113f['dialAbandonedRetryFrequency'];_0x544565=_0x31113f[_0x9c3c('0x199')];hopperUtils[_0x9c3c('0xcc')](_0x23ab3e)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x2940fe[_0x9c3c('0x181')](0xb,_0x5724ec,_0x31113f)&&!_0x45a4a5){if(_0x23ab3e[_0x9c3c('0xe9')]>=_0x31113f[_0x9c3c('0xeb')]){_0x2940fe[_0x9c3c('0x123')](_0x23ab3e,_0x306148,_0x38727b,'reason\x2011\x20abandoned');}else{_0x2940fe[_0x9c3c('0x120')](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x1ab'));}}break;case'20':_0x31113f[_0x9c3c('0x1ac')]+=0x1;_0x23ab3e[_0x9c3c('0x6f')]=0x14;_0x23ab3e[_0x9c3c('0x70')]=_0x9c3c('0x1ad');_0x23ab3e[_0x9c3c('0x11f')]+=0x1;_0x23ab3e[_0x9c3c('0xd7')]+=0x1;_0x40166f=_0x31113f[_0x9c3c('0x18f')];_0x544565=_0x31113f[_0x9c3c('0x199')];ami[_0x9c3c('0x43')](_0x9c3c('0x1ae'),ut['buildObj'](_0x5724ec,_0x9c3c('0x1af')));hopperUtils['createHistory'](_0x23ab3e)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x1b0')));if(_0x2940fe[_0x9c3c('0x181')](0x14,_0x5724ec,_0x31113f)&&!_0x45a4a5){if(_0x23ab3e[_0x9c3c('0x11f')]>=_0x31113f['dialAgentRejectMaxRetry']){_0x2940fe['createStateFinal'](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x1b1'));}else{_0x2940fe['stateGlobal'](_0x23ab3e,_0x306148,_0x38727b,'reason\x2020\x20agentreject');}}break;default:_0x31113f[_0x9c3c('0x130')]+=0x1;_0x23ab3e['state']=0xc;_0x23ab3e[_0x9c3c('0x70')]=_0x521f6d['reason'];_0x40166f=_0x31113f[_0x9c3c('0x18f')];_0x544565=_0x31113f[_0x9c3c('0x199')];hopperUtils[_0x9c3c('0xcc')](_0x23ab3e)['catch'](loggerCatch(_0x9c3c('0x1b2')));if(_0x2940fe[_0x9c3c('0x181')](_0x521f6d['reason'],_0x5724ec,_0x31113f)&&!_0x45a4a5){if(_0x23ab3e['countbusyretry']+_0x23ab3e[_0x9c3c('0x11d')]+_0x23ab3e[_0x9c3c('0x182')]+_0x23ab3e[_0x9c3c('0x11e')]+_0x23ab3e['countdropretry']+_0x23ab3e['countabandonedretry']+_0x23ab3e[_0x9c3c('0x119')]+_0x23ab3e[_0x9c3c('0x11f')]>=_0x31113f[_0x9c3c('0x12a')]){_0x2940fe['stateGlobal'](_0x23ab3e,_0x306148,_0x38727b,_0x521f6d['reason']);}else{_0x2940fe['createStateFinal'](_0x23ab3e,_0x306148,_0x38727b,_0x521f6d['reason']);}}}})[_0x9c3c('0x40')](function(){if(_0x45a4a5){hopperUtils[_0x9c3c('0xe6')](_0x23ab3e,_0x40166f,_0x544565)[_0x9c3c('0x40')](function(){return _0x306148(0x1);});}});});};Dialer[_0x9c3c('0x19')][_0x9c3c('0x120')]=function(_0x574965,_0x8976dd,_0x169e9f,_0x1b8d1c){var _0x1fb7a2=new Final(_0x574965);_0x1fb7a2['state']=0xf;_0x1fb7a2[_0x9c3c('0x70')]=_0x9c3c('0x1b3');this['createStateFinal'](_0x1fb7a2,_0x8976dd,_0x169e9f,_0x1b8d1c);};Dialer['prototype'][_0x9c3c('0x123')]=function(_0x53a147,_0x7bb5b0,_0x4ca96a,_0x141082){hopperUtils[_0x9c3c('0xce')](_0x53a147)[_0x9c3c('0x40')](function(){return _0x7bb5b0(msgResponse('[callProgressDetecting]',_0x9c3c('0x107'),_0x141082));})['catch'](function(){return _0x4ca96a(msgResponse(_0x9c3c('0x1b4'),_0x9c3c('0x95'),_0x9c3c('0x1b5')));});};Dialer[_0x9c3c('0x19')][_0x9c3c('0x7')]=function(_0x5b24b9){var _0x298bc1=_0x5b24b9['dialPredictiveOptimizationPercentage']/0x64;var _0x545ec0=_0x5b24b9[_0x9c3c('0xd2')]/(_0x5b24b9[_0x9c3c('0xd2')]+_0x5b24b9['outboundAnswerCallsDay']);var _0x1c01ae=Math[_0x9c3c('0x1b6')](_0x5b24b9[_0x9c3c('0x1b7')]*(_0x5b24b9[_0x9c3c('0x1b8')]/0x64));var _0x176bbb=Math[_0x9c3c('0x1b6')](_0x5b24b9[_0x9c3c('0x1b7')]*(_0x5b24b9[_0x9c3c('0x1b9')]/0x64));var _0x156e92=_0x5b24b9[_0x9c3c('0x137')]+_0x5b24b9[_0x9c3c('0x1ba')];var _0x4ee1c4=Math[_0x9c3c('0x1bb')](_0x5b24b9[_0x9c3c('0x58')]*_0x5b24b9[_0x9c3c('0x5b')]*_0x5b24b9['predictiveIntervalHitRate']*_0x5b24b9[_0x9c3c('0x1bc')]);if(_[_0x9c3c('0x42')](_0x5b24b9[_0x9c3c('0x5f')])){if(!_[_0x9c3c('0x42')](_0x5b24b9[_0x9c3c('0x60')])){_0x5b24b9['startPredictive']=undefined;loggerPredictive[_0x9c3c('0x64')](_0x9c3c('0x1bd'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x9c3c('0x42')](_0x5b24b9[_0x9c3c('0x62')])){loggerPredictive[_0x9c3c('0x64')](_0x9c3c('0x1bd'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x5b24b9[_0x9c3c('0x62')]);_0x5b24b9[_0x9c3c('0x62')]=undefined;}_0x5b24b9[_0x9c3c('0x5f')]=moment()[_0x9c3c('0x88')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5b24b9['name'],_0x9c3c('0x1be'),_0x5b24b9['startProgressive']);this['handlePower'](_0x5b24b9,0x1);}else if(ifInterval(_0x5b24b9[_0x9c3c('0x1bf')],_0x5b24b9[_0x9c3c('0x5f')])){this[_0x9c3c('0xb7')](_0x5b24b9,0x1);loggerPredictiveCalls[_0x9c3c('0x4a')]('[startMethodPredictive][StartProgressive][Loop]',_0x5b24b9[_0x9c3c('0x5f')],_0x5b24b9[_0x9c3c('0x48')]);_0x5b24b9[_0x9c3c('0x58')]=0x0;_0x5b24b9[_0x9c3c('0x1c0')]=0x0;}else if(_0x298bc1<_0x545ec0&&_0x5b24b9[_0x9c3c('0x1c1')]===_0x9c3c('0x1c2')){clearPredictiveAttributes(_0x5b24b9);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x1c3'),_0x9c3c('0x1c4'),_0x545ec0,_0x9c3c('0x5f'),_0x5b24b9[_0x9c3c('0x48')]);}else if(_0x4ee1c4<_0x5b24b9[_0x9c3c('0x1c0')]&&_0x5b24b9['dialPredictiveOptimization']===_0x9c3c('0x1c2')){clearPredictiveAttributes(_0x5b24b9);loggerPredictive[_0x9c3c('0x4a')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x9c3c('0x1c5'),_0x4ee1c4,_0x9c3c('0x1c6'),_0x5b24b9[_0x9c3c('0x1c0')],_0x9c3c('0x5f'),_0x5b24b9[_0x9c3c('0x48')]);}else if(!ifInterval(_0x5b24b9[_0x9c3c('0x1bf')],_0x5b24b9[_0x9c3c('0x5f')])&&_[_0x9c3c('0x42')](_0x5b24b9['startPredictive'])&&!_[_0x9c3c('0x42')](_0x5b24b9['startProgressive'])){_0x5b24b9[_0x9c3c('0x60')]=moment()[_0x9c3c('0x88')](_0x9c3c('0xc8'));loggerPredictive[_0x9c3c('0x4a')](_0x5b24b9[_0x9c3c('0x48')],_0x9c3c('0x1c7'),_0x5b24b9['startPredictive']);hopperUtils[_0x9c3c('0x1c8')](_0x5b24b9[_0x9c3c('0x1bf')])['then'](this[_0x9c3c('0x1c9')](_0x5b24b9))[_0x9c3c('0x40')](mergeDataErlangB(_0x5b24b9))[_0x9c3c('0x40')](this[_0x9c3c('0x1ca')](_0x5b24b9))[_0x9c3c('0xa1')](loggerCatchPredictive(_0x9c3c('0x1cb'),_0x5b24b9));}else if(!ifInterval(_0x5b24b9[_0x9c3c('0x1bf')],_0x5b24b9[_0x9c3c('0x60')])){_0x5b24b9[_0x9c3c('0x1c0')]=0x0;_0x5b24b9[_0x9c3c('0x60')]=moment()[_0x9c3c('0x88')](_0x9c3c('0xc8'));loggerPredictive['info'](_0x5b24b9[_0x9c3c('0x48')],_0x9c3c('0x1cc'),_0x5b24b9[_0x9c3c('0x60')]);clearInterval(_0x5b24b9['handlePredictive']);_0x5b24b9[_0x9c3c('0x62')]=undefined;hopperUtils[_0x9c3c('0x1c8')](_0x5b24b9['dialPredictiveInterval'])[_0x9c3c('0x40')](this[_0x9c3c('0x1c9')](_0x5b24b9))['then'](mergeDataErlangB(_0x5b24b9))[_0x9c3c('0x40')](this['startMethodPredictive'](_0x5b24b9))['catch'](loggerCatchPredictive(_0x9c3c('0x1cd'),_0x5b24b9));}else if(_0x5b24b9[_0x9c3c('0x1b7')]&&_0x156e92<_0x5b24b9[_0x9c3c('0x1b7')]-_0x176bbb){clearPredictiveAttributes(_0x5b24b9);loggerPredictive[_0x9c3c('0x4a')](_0x5b24b9[_0x9c3c('0x48')],_0x9c3c('0x1ce'),_0x156e92,')\x20are\x20less\x20than\x20threshold\x20(',_0x5b24b9[_0x9c3c('0x1b7')],'-',_0x176bbb,'=',_0x5b24b9['predictiveIntervalAvailable']-_0x176bbb,')');}else if(_0x5b24b9['predictiveIntervalAvailable']&&_0x156e92>_0x5b24b9[_0x9c3c('0x1b7')]+_0x1c01ae){clearPredictiveAttributes(_0x5b24b9);loggerPredictive[_0x9c3c('0x4a')](_0x5b24b9[_0x9c3c('0x48')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x156e92,_0x9c3c('0x1cf'),_0x5b24b9['predictiveIntervalAvailable'],'+',_0x1c01ae,'=',_0x5b24b9[_0x9c3c('0x1b7')]+_0x1c01ae,')');}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x1c9')]=function(_0x1cd9aa){var _0xcebee0=this;return function(_0x3789e2){return new Promise(function(_0x55909d,_0x40979a){_['merge'](_0x1cd9aa,_0x3789e2[0x0]);if(checkGetDataPredictive(_0x3789e2[0x0])){var _0x4a86c1=_0x1cd9aa[_0x9c3c('0x1b7')]=_0x1cd9aa[_0x9c3c('0x1ba')]+_0x1cd9aa[_0x9c3c('0x137')];var _0x50f9d3=_0x1cd9aa[_0x9c3c('0x1bf')]*0x3c;var _0x1a9120=_0x3789e2[0x0][_0x9c3c('0x52')]+_0x3789e2[0x0][_0x9c3c('0x50')];var _0xc58333=(_0x3789e2[0x0][_0x9c3c('0x1d0')]+_0x3789e2[0x0][_0x9c3c('0x4e')]+_0x3789e2[0x0][_0x9c3c('0xe7')])/_0x3789e2[0x0]['predictiveIntervalTotalCalls'];_0x1cd9aa['predictiveIntervalHitRate']=_0xc58333>0x0?_0xc58333:0x1;switch(_0x1cd9aa[_0x9c3c('0x1c1')]){case _0x9c3c('0x1c2'):var _0x8e2acd=_0x1cd9aa[_0x9c3c('0x1d1')]/0x64;return _0xcebee0[_0x9c3c('0x1d2')](_0x4a86c1,_0x50f9d3,_0x1a9120,_0xc58333,_0x8e2acd)[_0x9c3c('0x40')](function(_0x1edb2c){return _0x55909d(_0x1edb2c);});case'agentBusyFactor':var _0xa026be=_0x1cd9aa['dialPredictiveOptimizationPercentage']/0x64;return _0xcebee0[_0x9c3c('0x1d3')](_0x4a86c1,_0x50f9d3,_0x1a9120,_0xc58333,_0xa026be)[_0x9c3c('0x40')](function(_0xfcbc7f){return _0x55909d(_0xfcbc7f);});default:return _0x40979a(msgResponse(_0x9c3c('0x1d4'),'Failure',_0x9c3c('0x1d5')));}}else{return _0x40979a(msgResponse(_0x9c3c('0x1d4'),_0x9c3c('0x95'),'check\x20failure'));}});};};Dialer[_0x9c3c('0x19')]['getDataPredictiveOld']=function(_0x75b65f){var _0x10a500=this;return function(_0x429e94){return new Promise(function(_0x423875,_0xbbcb64){_[_0x9c3c('0x5d')](_0x75b65f,_0x429e94[0x0]);if(checkGetDataPredictive(_0x429e94[0x0])){loggerPredictive['info'](JSON[_0x9c3c('0x75')](_0x429e94[0x0]));if(_0x75b65f['dialPredictiveOptimization']===_0x9c3c('0x1c2')){return _0x10a500[_0x9c3c('0x1d6')](_0x75b65f['id'])[_0x9c3c('0x40')](function(_0x13fd24){var _0x61f83c=_0x75b65f[_0x9c3c('0x1d7')]-_0x13fd24[0x0][_0x9c3c('0x1d8')];var _0x1a47ed=_0x75b65f['dialPredictiveInterval']*0x3c;var _0x258e82=_0x429e94[0x0][_0x9c3c('0x52')]+_0x429e94[0x0][_0x9c3c('0x50')];var _0x2aa56e=(_0x429e94[0x0][_0x9c3c('0x1d0')]+_0x429e94[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x429e94[0x0][_0x9c3c('0xe7')])/_0x429e94[0x0]['predictiveIntervalTotalCalls'];var _0x2e713d=_0x75b65f[_0x9c3c('0x1d1')]/0x64;_0x75b65f[_0x9c3c('0x1d9')]=_0x13fd24[0x0]['outboundQueuePauses']||0x0;_0x75b65f['predictiveIntervalHitRate']=_0x2aa56e>0x0?_0x2aa56e:0x1;return _0x10a500[_0x9c3c('0x1d2')](_0x61f83c,_0x1a47ed,_0x258e82,_0x2aa56e,_0x2e713d);})['then'](function(_0x12b841){return _0x423875(_0x12b841);})[_0x9c3c('0xa1')](function(_0x4f96ef){return _0xbbcb64(msgResponse(_0x9c3c('0x1da'),_0x9c3c('0x95'),JSON[_0x9c3c('0x75')](_0x4f96ef)));});}if(_0x75b65f[_0x9c3c('0x1c1')]===_0x9c3c('0x1db')){return _0x10a500[_0x9c3c('0x1d6')](_0x75b65f['id'])[_0x9c3c('0x40')](function(_0x533268){var _0x2ab2ab=_0x75b65f[_0x9c3c('0x1d7')]-_0x533268[0x0][_0x9c3c('0x1d8')];var _0xaed33=_0x75b65f[_0x9c3c('0x1bf')]*0x3c;var _0x35da9a=_0x429e94[0x0][_0x9c3c('0x52')]+_0x429e94[0x0][_0x9c3c('0x50')];var _0x56be27=(_0x429e94[0x0][_0x9c3c('0x1d0')]+_0x429e94[0x0][_0x9c3c('0x4e')]+_0x429e94[0x0][_0x9c3c('0xe7')])/_0x429e94[0x0][_0x9c3c('0x4c')];var _0x49b1dd=_0x75b65f['dialPredictiveOptimizationPercentage']/0x64;_0x75b65f[_0x9c3c('0x1d9')]=_0x533268[0x0][_0x9c3c('0x1d8')]||0x0;_0x75b65f[_0x9c3c('0x1dc')]=_0x56be27>0x0?_0x56be27:0x1;return _0x10a500[_0x9c3c('0x1d3')](_0x2ab2ab,_0xaed33,_0x35da9a,_0x56be27,_0x49b1dd);})['then'](function(_0x101f6b){return _0x423875(_0x101f6b);})['catch'](function(_0x263ea5){return _0xbbcb64(msgResponse('[CatchErlangB]',_0x9c3c('0x95'),JSON[_0x9c3c('0x75')](_0x263ea5)));});}}else{return _0xbbcb64(msgResponse(_0x9c3c('0x1d4'),_0x9c3c('0x95'),_0x9c3c('0x1dd')));}});};};Dialer[_0x9c3c('0x19')]['startMethodPredictive']=function(_0x5c0599){var _0xeb5d51=this;return function(){var _0x4c5795=0x0;var _0x7911f2=Math[_0x9c3c('0x1bb')](_0x5c0599[_0x9c3c('0x1de')]*0x3e8);if(_0x7911f2>0x0){_0x7911f2=_0x7911f2<0x64?0x64:_0x7911f2;loggerPredictive['info'](_0x5c0599['name'],_0x9c3c('0x1df'),_0x7911f2,_0x9c3c('0x1e0'));_0x5c0599['handlePredictive']=setInterval(function(){_0xeb5d51[_0x9c3c('0x62')](_0x5c0599);loggerPredictiveCalls['info'](_0x9c3c('0x1e1'),_0x4c5795+=0x1);},_0x7911f2);}else{loggerPredictive[_0x9c3c('0x4a')](_0x5c0599['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x9c3c('0x19')][_0x9c3c('0x1e2')]=function(_0x56e6cc,_0x407934){var _0x153795=this;return function(_0xaa7b0d){if(_[_0x9c3c('0x7a')](_0xaa7b0d)){if(_[_0x9c3c('0xf6')](_0x407934[_0x9c3c('0x150')])||!_0x407934[_0x9c3c('0x1e3')]){if(_0x56e6cc['dialMethod']===_0x9c3c('0xb9')){_0x56e6cc[_0x9c3c('0x72')]=_['isUndefined'](_0x56e6cc[_0x9c3c('0x72')])?!![]:_0x56e6cc[_0x9c3c('0x72')];var _0x32d73d=uuid['v4']();_0x153795['actions'][_0x32d73d]=new Action(_0x56e6cc,_0x407934,_0x32d73d);loggerBooked[_0x9c3c('0x4a')]('[booked][checkContactBlack]',_0x32d73d,_0x9c3c('0x1e4'),JSON['stringify'](_0x56e6cc[_0x9c3c('0x72')]),_0x9c3c('0x1e5'),_0x56e6cc[_0x9c3c('0x48')]);if(_0x56e6cc[_0x9c3c('0x72')]){_0x56e6cc[_0x9c3c('0x72')]=![];_0x153795[_0x9c3c('0xf7')][_0x153795[_0x9c3c('0x24')][_0x32d73d][_0x9c3c('0xc6')]]=[];ami[_0x9c3c('0x17b')]({'actionid':_0x32d73d,'action':_0x9c3c('0x1e6'),'queue':_0x56e6cc[_0x9c3c('0x48')]})[_0x9c3c('0xa1')](function(){_0x153795[_0x9c3c('0xc5')](_0x56e6cc);hopperUtils[_0x9c3c('0xdc')]({'active':![],'ContactId':_0x153795[_0x9c3c('0x24')][_0x32d73d][_0x9c3c('0xdf')],'ListId':_0x153795['actions'][_0x32d73d]['ListId'],'VoiceQueueId':_0x153795[_0x9c3c('0x24')][_0x32d73d][_0x9c3c('0xe0')]||undefined,'CampaignId':_0x153795[_0x9c3c('0x24')][_0x32d73d][_0x9c3c('0xe1')]||undefined})['catch'](loggerCatch(_0x9c3c('0x1e7')));delete _0x153795[_0x9c3c('0x24')][_0x32d73d];});}else{loggerBooked[_0x9c3c('0x4a')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x56e6cc['queueStatusComplete']),'Queue:\x20',_0x56e6cc[_0x9c3c('0x48')]);_0x153795[_0x9c3c('0xc5')](_0x56e6cc);hopperUtils[_0x9c3c('0xdc')]({'active':![],'ContactId':_0x153795[_0x9c3c('0x24')][_0x32d73d][_0x9c3c('0xdf')],'ListId':_0x153795[_0x9c3c('0x24')][_0x32d73d][_0x9c3c('0xec')],'VoiceQueueId':_0x153795[_0x9c3c('0x24')][_0x32d73d]['VoiceQueueId']||undefined,'CampaignId':_0x153795[_0x9c3c('0x24')][_0x32d73d]['CampaignId']||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x153795[_0x9c3c('0x24')][_0x32d73d];}}else{return _0x153795[_0x9c3c('0x153')](_0x56e6cc,_0x407934);}}else{if(utils[_0x9c3c('0x5e')](undefined,_0x407934['scheduledat'])<_0x56e6cc[_0x9c3c('0x1e8')]*0x3c){if(_0x407934[_0x9c3c('0x142')]&&!_0x407934[_0x9c3c('0x142')][_0x9c3c('0x1e9')]){_0x153795['preview'][_0x9c3c('0x100')](_0x407934['id'])[_0x9c3c('0x1c')](function(){_0x153795['updateOriginated'](_0x56e6cc);});}else{hopperUtils['unlockContact']({'active':![]},_0x407934['id'],0x1)[_0x9c3c('0x1c')](function(){_0x153795[_0x9c3c('0xc5')](_0x56e6cc);});}}else{_0x56e6cc[_0x9c3c('0x1ea')]+=0x1;_0x153795[_0x9c3c('0xc5')](_0x56e6cc);if(_0x56e6cc['dialRecallInQueue']){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x407934[_0x9c3c('0xdf')],'ListId':_0x407934['ListId'],'VoiceQueueId':_0x407934[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x407934[_0x9c3c('0xe1')]||undefined})['catch'](loggerCatch(_0x9c3c('0x1eb')));hopperUtils[_0x9c3c('0xcc')](createObjHistory(_0x56e6cc,_0x407934,utils['CAMPAIGN_STATUS'][_0x9c3c('0x1ec')],0x17,_0x9c3c('0x1ed')))['catch'](loggerCatch(_0x9c3c('0x1ee')));}else{_0x153795[_0x9c3c('0x115')](createObjHistory(_0x56e6cc,_0x407934,utils[_0x9c3c('0x6c')]['RECALL_TIMEOUT'],0x16,_0x9c3c('0x1ef')),_0x9c3c('0x1f0'),'[Originate][HistoryRecallClose]');}}}}else{_0x56e6cc[_0x9c3c('0x1f1')]+=0x1;_0x153795[_0x9c3c('0x115')](createObjHistory(_0x56e6cc,_0x407934,utils[_0x9c3c('0x6c')][_0x9c3c('0x1f2')],0xd,_0x9c3c('0x1f3')),'[Originate][historyBlacklist]',_0x9c3c('0x1f4'));throw _0x9c3c('0x1f5');}};};Dialer[_0x9c3c('0x19')][_0x9c3c('0x1f6')]=function(_0x3ebe36){var _0x39a7ee=this;var _0x3879a4=_0x3ebe36[_0x9c3c('0x1f7')]-_0x3ebe36[_0x9c3c('0x7f')];emitCampaignSummary(_0x3ebe36);if(_0x3879a4>0x0&&_0x3ebe36[_0x9c3c('0x67')]==0x0){if(_0x3879a4>this[_0x9c3c('0x22')]){_0x3879a4=this[_0x9c3c('0x22')];}_0x3ebe36[_0x9c3c('0x67')]=0x1;hopperUtils[_0x9c3c('0x1f8')](_0x3ebe36,_0x3879a4)['then'](function(_0x5b5c2b){_0x3ebe36[_0x9c3c('0x67')]=0x0;if(_0x5b5c2b){if(!utils[_0x9c3c('0x1f9')](_0x5b5c2b)){_0x3ebe36[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')][_0x9c3c('0x6d')];logger[_0x9c3c('0x4a')](_0x9c3c('0x1fa')+_0x3ebe36[_0x9c3c('0x48')]);}else{_0x3ebe36[_0x9c3c('0x7f')]+=_0x5b5c2b[_0x9c3c('0x9a')];_0x3ebe36[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')]['RUNNING'];for(var _0x2504f8=0x0;_0x2504f8<_0x5b5c2b[_0x9c3c('0x9a')];_0x2504f8+=0x1){_0x3ebe36[_0x9c3c('0x1fb')]+=0x1;if(_[_0x9c3c('0xf6')](_0x5b5c2b[_0x2504f8])||_['isNil'](_0x5b5c2b[_0x2504f8][_0x9c3c('0x173')])||_[_0x9c3c('0xf6')](_0x5b5c2b[_0x2504f8]['phone'])){_0x39a7ee[_0x9c3c('0x14e')]('[actionOriginate]\x20',_0x3ebe36,_0x5b5c2b[_0x2504f8]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x9c3c('0x76')](_0x5b5c2b[_0x2504f8],[_0x9c3c('0xe1'),_0x9c3c('0x156')]))[_0x9c3c('0x40')](_0x39a7ee[_0x9c3c('0x1e2')](_0x3ebe36,_0x5b5c2b[_0x2504f8]))[_0x9c3c('0xa1')](_0x39a7ee[_0x9c3c('0x14d')](_0x9c3c('0x1fc'),_0x3ebe36));}}}}})[_0x9c3c('0xa1')](loggerGetContactDialer(_0x9c3c('0x1fd'),_0x3ebe36,_0x3879a4));}};Dialer[_0x9c3c('0x19')]['handlePower']=function(_0xfe3600,_0x1bf203){var _0x240b60=this;var _0xc8e37f=[];if(_0x1bf203<0x1||_0xfe3600['dialMethod']==='booked'){_0x1bf203=0x1;}var _0x4474fa=Math[_0x9c3c('0x1bb')](_0xfe3600[_0x9c3c('0x137')]*_0x1bf203)-_0xfe3600[_0x9c3c('0x7f')];if(_0xfe3600[_0x9c3c('0x1fe')]>0x0){var _0x2f1a67=_0xfe3600['dialLimitQueue']-_0xfe3600['originated']-_0xfe3600['talking']-_0xfe3600['pTalking'];if(_0x4474fa>_0x2f1a67){_0x4474fa=_0x2f1a67;}}if(_0x4474fa>0x0&&_0xfe3600['temp']==0x0){if(_0xfe3600[_0x9c3c('0xb5')]==='booked'){_0x4474fa=0x1;}if(_0x4474fa>this[_0x9c3c('0x22')]){_0x4474fa=this[_0x9c3c('0x22')];}for(var _0xd51d66 in this[_0x9c3c('0x20')]){if(typeof this[_0x9c3c('0x20')][_0xd51d66]!==_0x9c3c('0xad')){if(this[_0x9c3c('0x20')][_0xd51d66][_0x9c3c('0x6f')]===_0x9c3c('0x1ff')&&this['agents'][_0xd51d66]['status']===_0x9c3c('0x8b')){_0xc8e37f['push'](this[_0x9c3c('0x20')][_0xd51d66]['id']);}}}_0xfe3600[_0x9c3c('0x67')]=0x1;hopperUtils['getContactDialer'](_0xfe3600,_0xc8e37f,_0x4474fa)[_0x9c3c('0x40')](function(_0x3a3440){_0xfe3600[_0x9c3c('0x67')]=0x0;if(_0x3a3440){if(!utils[_0x9c3c('0x1f9')](_0x3a3440)){hopperUtils[_0x9c3c('0x200')](_0xfe3600)[_0x9c3c('0x40')](sendMessageReschedule(_0xfe3600))['catch'](loggerCatch(_0x9c3c('0x201')));}else{_0xfe3600['originated']+=_0x3a3440[_0x9c3c('0x9a')];_0xfe3600[_0x9c3c('0x69')]=_0xfe3600[_0x9c3c('0xb5')]==='booked'?utils['CAMPAIGN_STATUS']['ACTIVE']:utils[_0x9c3c('0x6c')][_0x9c3c('0x202')];for(var _0x427677=0x0;_0x427677<_0x3a3440[_0x9c3c('0x9a')];_0x427677+=0x1){if(_[_0x9c3c('0xf6')](_0x3a3440[_0x427677])||_[_0x9c3c('0xf6')](_0x3a3440[_0x427677][_0x9c3c('0x173')])||_[_0x9c3c('0xf6')](_0x3a3440[_0x427677][_0x9c3c('0x156')])){_0x240b60[_0x9c3c('0x14e')]('[actionOriginate]\x20',_0xfe3600,_0x3a3440[_0x427677]);}else{hopperUtils[_0x9c3c('0x203')](_[_0x9c3c('0x76')](_0x3a3440[_0x427677],[_0x9c3c('0xe0'),_0x9c3c('0x156')]))[_0x9c3c('0x40')](_0x240b60[_0x9c3c('0x1e2')](_0xfe3600,_0x3a3440[_0x427677]))['catch'](_0x240b60[_0x9c3c('0x14d')](_0x9c3c('0x204'),_0xfe3600));}}}}})[_0x9c3c('0xa1')](loggerGetContactDialer('[getContactDialer2]',_0xfe3600,_0x4474fa));}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x62')]=function(_0x4a0259){if(_0x4a0259['dialLimitQueue']>0x0){var _0x55b598=_0x4a0259[_0x9c3c('0x1fe')]-_0x4a0259[_0x9c3c('0x7f')]-_0x4a0259[_0x9c3c('0x1ba')];if(_0x55b598>0x0&&_0x4a0259['temp']==0x0){this[_0x9c3c('0x205')](_0x4a0259);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x9c3c('0x205')](_0x4a0259);}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x205')]=function(_0x2fa9e8){var _0x3cbb5d=this;var _0x94aa78=[];_0x2fa9e8[_0x9c3c('0x7f')]+=0x1;for(var _0x51a00e in this[_0x9c3c('0x20')]){if(typeof this[_0x9c3c('0x20')][_0x51a00e]!==_0x9c3c('0xad')){if(this[_0x9c3c('0x20')][_0x51a00e][_0x9c3c('0x6f')]===_0x9c3c('0x1ff')&&this['agents'][_0x51a00e]['status']===_0x9c3c('0x8b')){_0x94aa78[_0x9c3c('0x9b')](this[_0x9c3c('0x20')][_0x51a00e]['id']);}}}_0x2fa9e8['temp']=0x1;return this[_0x9c3c('0x206')](_0x2fa9e8['id'],_0x94aa78,0x1,_0x2fa9e8[_0x9c3c('0x207')],_0x2fa9e8)[_0x9c3c('0x40')](function(_0x2fb941){_0x2fa9e8[_0x9c3c('0x67')]=0x1;if(_0x2fb941){if(!utils['checkContactEmpty'](_0x2fb941)){utils[_0x9c3c('0x66')](_0x2fa9e8,0x1,0x0);return hopperUtils[_0x9c3c('0x200')](_0x2fa9e8)[_0x9c3c('0x40')](sendMessageReschedule(_0x2fa9e8))[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x201')));}else{_0x2fa9e8['message']=utils['CAMPAIGN_STATUS'][_0x9c3c('0x202')];if(_[_0x9c3c('0xf6')](_0x2fb941[0x0])||_[_0x9c3c('0xf6')](_0x2fb941[0x0][_0x9c3c('0x173')])||_['isNil'](_0x2fb941[0x0][_0x9c3c('0x156')])){_0x3cbb5d[_0x9c3c('0x14e')](_0x9c3c('0x204'),_0x2fa9e8,_0x2fb941[0x0]);}else{return hopperUtils[_0x9c3c('0x203')](_['pick'](_0x2fb941[0x0],['VoiceQueueId',_0x9c3c('0x156')]))[_0x9c3c('0x40')](_0x3cbb5d[_0x9c3c('0x1e2')](_0x2fa9e8,_0x2fb941[0x0]))[_0x9c3c('0xa1')](_0x3cbb5d[_0x9c3c('0x14d')]('[actionOriginatePredictive]\x20',_0x2fa9e8));}}}})[_0x9c3c('0xa1')](loggerGetContactDialer(_0x9c3c('0x208'),_0x2fa9e8,0x1));};Dialer['prototype'][_0x9c3c('0x1d2')]=function(_0x5bd7c7,_0x408e2d,_0x166d64,_0x5a0581,_0x1ada05,_0x5f2a80){loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x209'));loggerPredictive[_0x9c3c('0x4a')]('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',_0x5bd7c7);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x20a'),_0x408e2d);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x20b'),_0x166d64);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x20c'),_0x5a0581);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x20d'),_0x1ada05);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x53'));return new Promise(function(_0x156ce2,_0x30127c){if(_0x5bd7c7<=0x0||isNaN(_0x5bd7c7)){return _0x30127c(msgResponse(_0x9c3c('0x20e'),_0x9c3c('0x85'),_0x9c3c('0x20f')+_0x5bd7c7));}if(_0x166d64<=0x0||isNaN(_0x166d64)){return _0x30127c(msgResponse(_0x9c3c('0x20e'),_0x9c3c('0x85'),_0x9c3c('0x210')+_0x166d64));}if(_0x5a0581<=0x0||isNaN(_0x5a0581)){return _0x30127c(msgResponse(_0x9c3c('0x20e'),_0x9c3c('0x85'),'p\x20=\x20'+_0x5a0581));}if(_0x408e2d<=0x0||isNaN(_0x408e2d)){return _0x30127c(msgResponse(_0x9c3c('0x20e'),_0x9c3c('0x85'),'interval\x20=\x20'+_0x408e2d));}if(_0x1ada05<=0x0||isNaN(_0x1ada05)){return _0x30127c(msgResponse(_0x9c3c('0x20e'),_0x9c3c('0x85'),'Amax\x20=\x20'+_0x1ada05));}_0x5f2a80=_0x5f2a80||0x0;var _0x5c2362=0x1/_0x166d64;var _0x57533f=0x0;var _0x233e80=0x0;var _0x4e1f4a=0x0;var _0x1e926b=0x0;for(var _0x3c940f=0x0;_0x4e1f4a<_0x1ada05;_0x3c940f+=0x1){_0x233e80=_0x3c940f/_0x408e2d;_0x57533f=(_0x5a0581*_0x233e80+_0x5f2a80)/_0x5c2362;_0x4e1f4a=utils['erlangb'](_0x57533f,_0x5bd7c7);_0x1e926b=_0x57533f/_0x5bd7c7*(0x1-utils[_0x9c3c('0x211')](_0x57533f,_0x5bd7c7));}return _0x156ce2({'erlangCalls':_0x3c940f,'erlangCallToSecond':_0x408e2d/_0x3c940f,'erlangAbandonmentRate':_0x4e1f4a,'erlangBusyFactor':_0x1e926b});});};Dialer['prototype'][_0x9c3c('0x1d3')]=function(_0x31b151,_0x42f075,_0x3426f5,_0x34a6b5,_0x12f526,_0x589c5b){loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x212'));loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x213'),_0x31b151);loggerPredictive[_0x9c3c('0x4a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42f075);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x20b'),_0x3426f5);loggerPredictive['info'](_0x9c3c('0x20c'),_0x34a6b5);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x214'),_0x12f526);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x53'));return new Promise(function(_0x52a22e,_0x497339){if(_0x31b151<=0x0||isNaN(_0x31b151)){return _0x497339(msgResponse(_0x9c3c('0x215'),_0x9c3c('0x85'),_0x9c3c('0x20f')+_0x31b151));}if(_0x3426f5<=0x0||isNaN(_0x3426f5)){return _0x497339(msgResponse(_0x9c3c('0x215'),_0x9c3c('0x85'),_0x9c3c('0x210')+_0x3426f5));}if(_0x34a6b5<=0x0||isNaN(_0x34a6b5)){return _0x497339(msgResponse(_0x9c3c('0x215'),_0x9c3c('0x85'),_0x9c3c('0x216')+_0x34a6b5));}if(_0x42f075<=0x0||isNaN(_0x42f075)){return _0x497339(msgResponse('[busyFactor]',_0x9c3c('0x85'),_0x9c3c('0x217')+_0x42f075));}if(_0x12f526<=0x0||isNaN(_0x12f526)){return _0x497339(msgResponse(_0x9c3c('0x215'),_0x9c3c('0x85'),_0x9c3c('0x218')+_0x12f526));}_0x589c5b=_0x589c5b||0x0;var _0x55ad01=0x1/_0x3426f5;var _0x4bda15=0x0;var _0x14309e=0x0;var _0x35257f=0x0;var _0x42bcbf=0x0;for(var _0x3bdbe9=0x0;_0x42bcbf<_0x12f526;_0x3bdbe9+=0x1){_0x14309e=_0x3bdbe9/_0x42f075;_0x4bda15=(_0x34a6b5*_0x14309e+_0x589c5b)/_0x55ad01;_0x35257f=utils[_0x9c3c('0x211')](_0x4bda15,_0x31b151);_0x42bcbf=_0x4bda15/_0x31b151*(0x1-utils[_0x9c3c('0x211')](_0x4bda15,_0x31b151));}return _0x52a22e({'erlangCalls':_0x3bdbe9,'erlangCallToSecond':_0x42f075/_0x3bdbe9,'erlangAbandonmentRate':_0x35257f,'erlangBusyFactor':_0x42bcbf});});};module[_0x9c3c('0x219')]=Dialer; \ No newline at end of file +var _0xaba8=['dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','floor','erlangAbandonmentRate','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalTotalCalls','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','loggedIn','[CatchErlangB]','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','maxNumberOriginate','getContactDialerIvr','checkContactEmpty','ivrTotalCallsDays','emptyContact','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','RUNNING','[actionOriginate]\x20','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','checkIsBlackList','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','exports','util','lodash','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','127.0.0.1','tail','sequence','preview','voiceQueues','agents','trunks','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','emit','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','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','---------------------------','merge','isUndefined','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','checkContactLowerLimitOriginate','temp','contactsRescheduled','CAMPAIGN_STATUS','contacts','message','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','prototype','isTrunkReachable','active','SIP/%s','status','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','content','indexOf','true','catch','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','stringify','loopCampaigns','syncCampaigns','campaigns','undefined','resolve','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','handlePower','power','dialPowerLevel','Dialer::ifTime()','intervalIftime','OVERTIME_INTERVAL','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','uniqueid','type','ivr','updateOriginated','queue','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','minutes','VoiceQueueId','endtime','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','rescheduleContact','add','ContactId','ListId','CampaignId','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','locked','stateinterface','isNil','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','paused','unlockRR','contactAgent-idHopper:\x20','run','finally','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','responsetime','getQueue','response','Success','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','createStateFinal','[rescheduleContact][Machine]','HangupInAMD','custom:amd','countglobal','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr]','AnswerAGI','[syncHangupIvr][createHistory]','dialQueueProject','outboundUnknownCallsDay','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','updateReportFromOutboundQueue','throttle','filter','dialPreviewRecallmeReminder','online','reachable','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','enqueue','No\x20such\x20channel','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','notFound','[emptyContact][createHistory]','[emptyContact]','handleIvr','voiceQueue\x20is\x20undefine','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','assign','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originate][error]','originate\x20action\x20Error','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','object','[callProgressDetecting]','evt\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','checkRetriveMax','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved'];(function(_0x48a9c2,_0x3275cf){var _0x4585c8=function(_0x3e5ff2){while(--_0x3e5ff2){_0x48a9c2['push'](_0x48a9c2['shift']());}};_0x4585c8(++_0x3275cf);}(_0xaba8,0x6a));var _0x8aba=function(_0x2b6407,_0x5a835d){_0x2b6407=_0x2b6407-0x0;var _0x3aa6ac=_0xaba8[_0x2b6407];return _0x3aa6ac;};'use strict';var util=require(_0x8aba('0x0'));var _=require(_0x8aba('0x1'));var uuid=require('uuid');var moment=require(_0x8aba('0x2'));var rr=require('rr');var Redis=require(_0x8aba('0x3'));var utils=require(_0x8aba('0x4'));var hopperUtils=require(_0x8aba('0x5'));var ut=require(_0x8aba('0x6'));var config=require('../../../config/environment/');var logger=require(_0x8aba('0x7'))(_0x8aba('0x8'));var loggerBooked=require(_0x8aba('0x7'))(_0x8aba('0x9'));var loggerPredictive=require(_0x8aba('0x7'))(_0x8aba('0xa'));var loggerPredictiveCalls=require(_0x8aba('0x7'))(_0x8aba('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x8aba('0xc'));var ami=require(_0x8aba('0xd'));config[_0x8aba('0xe')]=_[_0x8aba('0xf')](config['redis'],{'host':_0x8aba('0x10'),'port':0x18eb});var io=require(_0x8aba('0x11'))(new Redis(config['redis']));var cmHopper=require(_0x8aba('0x12'));var voiceQueueRt=require(_0x8aba('0x13'));var RpcSetting=require(_0x8aba('0x14'));var Interval=require(_0x8aba('0x15'));var Action=require('./models/action');var History=require('./models/history');var Final=require(_0x8aba('0x16'));var AgentComplete=require(_0x8aba('0x17'));var QueueCallerAbandon=require(_0x8aba('0x18'));var Hangup=require(_0x8aba('0x19'));var ipAgi=process[_0x8aba('0x1a')]['XCALLY_IP_AGI']||_0x8aba('0x1b');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x387568){this[_0x8aba('0x1c')]=this['tail']?this[_0x8aba('0x1c')]['finally'](_0x387568):_0x387568();};function Dialer(_0x5ab7d7,_0x11578d){this[_0x8aba('0x1d')]=new Sequence();this[_0x8aba('0x1e')]=_0x11578d;this['voiceQueues']=_0x5ab7d7[_0x8aba('0x1f')];this['campaigns']=_0x5ab7d7['campaigns'];this[_0x8aba('0x20')]=_0x5ab7d7['agents'];this[_0x8aba('0x21')]=_0x5ab7d7[_0x8aba('0x21')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0x8aba('0x22')]={};this[_0x8aba('0x23')]={};this[_0x8aba('0x24')]={};this[_0x8aba('0x25')]={};this[_0x8aba('0x26')]={};this[_0x8aba('0x27')]={};this[_0x8aba('0x28')]={};this[_0x8aba('0x29')]={};this[_0x8aba('0x2a')]={};this['queueBookedRR']={};this[_0x8aba('0x2b')]={};ami['on'](_0x8aba('0x2c'),this[_0x8aba('0x2d')][_0x8aba('0x2e')](this));ami['on'](_0x8aba('0x2f'),this[_0x8aba('0x30')][_0x8aba('0x2e')](this));ami['on'](_0x8aba('0x31'),this[_0x8aba('0x32')][_0x8aba('0x2e')](this));ami['on'](_0x8aba('0x33'),this[_0x8aba('0x34')]['bind'](this));ami['on'](_0x8aba('0x35'),this['syncQueueSummary'][_0x8aba('0x2e')](this));ami['on'](_0x8aba('0x36'),this[_0x8aba('0x37')][_0x8aba('0x2e')](this));ami['on'](_0x8aba('0x38'),this[_0x8aba('0x39')][_0x8aba('0x2e')](this));ami['on'](_0x8aba('0x3a'),this[_0x8aba('0x3b')][_0x8aba('0x2e')](this));ami['on']('varset',this[_0x8aba('0x3c')][_0x8aba('0x2e')](this));ami['on'](_0x8aba('0x3d'),this[_0x8aba('0x3e')]['bind'](this));ami['on'](_0x8aba('0x3f'),this[_0x8aba('0x40')][_0x8aba('0x2e')](this));this['loopCampaigns']();this[_0x8aba('0x41')]();RpcSetting[_0x8aba('0x42')]()[_0x8aba('0x43')](function(_0x9daab){previewRecallmeReminderInterval=_0x9daab[_0x8aba('0x44')];});}function isNotNull(_0x11ecab){return _0x11ecab!==null&&!_['isUndefined'](_0x11ecab);}function msgResponse(_0x1b19aa,_0x296601,_0x52989b){return{'action':_0x1b19aa,'response':_0x296601,'message':_0x52989b,'stack':_0x52989b};}function emit(_0x4b4fe6,_0x5753d1,_0x575d3a){io['to'](_0x4b4fe6)[_0x8aba('0x45')](_0x5753d1,_0x575d3a);}function emitOutboundVoiceQueueSummary(_0x2744e3){if(_0x2744e3['type']===_0x8aba('0x46')){logger[_0x8aba('0x47')](_0x8aba('0x48'),util[_0x8aba('0x49')](_0x2744e3,{'showHidden':![],'depth':null}));emit(util[_0x8aba('0x4a')](_0x8aba('0x4b'),_0x2744e3[_0x8aba('0x4c')]),_0x8aba('0x4d'),_0x2744e3);}}function checkGetDataPredictive(_0x200205){if(isNotNull(_0x200205)&&!_[_0x8aba('0x4e')](_0x200205)){loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x50'));loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x51'),_0x200205['predictiveIntervalTotalCalls']);loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x52'),_0x200205[_0x8aba('0x53')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x200205[_0x8aba('0x54')]);loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x55'),_0x200205[_0x8aba('0x56')]);loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x57'),_0x200205[_0x8aba('0x58')]);loggerPredictive['info'](_0x8aba('0x59'),_0x200205[_0x8aba('0x5a')]);loggerPredictive[_0x8aba('0x4f')]('---------------------------');if(_0x200205['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x200205[_0x8aba('0x5a')])&&_0x200205['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x5b'));if(!_['isUndefined'](_0x200205['predictiveIntervalAvgHoldtime'])&&_0x200205[_0x8aba('0x58')]>0x0){return!![];}loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x5c'));}else{loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x5d'));}}else{loggerPredictive['info'](_0x8aba('0x5e'));}return![];}function mergeDataErlangB(_0x1e58bc){return function(_0x7f1c0f){loggerPredictive['info'](_0x8aba('0x5f'));loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x60'),_0x7f1c0f[_0x8aba('0x61')]);loggerPredictive['info'](_0x8aba('0x62'),_0x7f1c0f[_0x8aba('0x63')]);loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x64'),_0x7f1c0f['erlangAbandonmentRate']);loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x65'),_0x7f1c0f[_0x8aba('0x66')]);loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x64'),_0x7f1c0f['erlangAbandonmentRate']);loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x67'));_[_0x8aba('0x68')](_0x1e58bc,_0x7f1c0f);};}function ifInterval(_0x5c7efb,_0x56b70a){if(_[_0x8aba('0x69')](_0x56b70a)){return![];}return utils[_0x8aba('0x6a')](undefined,_0x56b70a)<_0x5c7efb*0x3c;}function clearPredictiveAttributes(_0x480a1e){if(_0x480a1e[_0x8aba('0x28')]){_0x480a1e['startProgressive']=undefined;loggerPredictive[_0x8aba('0x47')](_0x480a1e['name'],_0x8aba('0x6b'));}if(_0x480a1e['startPredictive']){_0x480a1e[_0x8aba('0x27')]=undefined;loggerPredictive[_0x8aba('0x47')](_0x480a1e['name'],_0x8aba('0x6c'));}if(_0x480a1e['handlePredictive']){clearInterval(_0x480a1e[_0x8aba('0x6d')]);_0x480a1e['handlePredictive']=undefined;loggerPredictive[_0x8aba('0x47')](_0x480a1e['name'],_0x8aba('0x6e'));}}function loggerCatchPredictive(_0x23b904,_0x31112f){return function(_0x5a3b5e){loggerPredictive['error'](_0x31112f['name'],_0x23b904);loggerPredictive['error'](_0x5a3b5e['stack']);clearPredictiveAttributes(_0x31112f);};}function loggerCatch(_0x4161cd){return function(_0x44de78){logger[_0x8aba('0x6f')](_0x4161cd,util[_0x8aba('0x49')](_0x44de78,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x172500,_0x2245f1,_0x1685ad){return function(_0x15d62f){utils[_0x8aba('0x70')](_0x2245f1,_0x1685ad,0x0);_0x2245f1[_0x8aba('0x71')]=0x0;logger[_0x8aba('0x6f')](_0x172500,util[_0x8aba('0x49')](_0x15d62f,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2f71b8){return function(_0x37e395){if(isNotNull(_0x37e395)&&isNotNull(_0x37e395[0x0])){if(_0x37e395[0x0][_0x8aba('0x72')]>0x0){_0x2f71b8['message']=utils[_0x8aba('0x73')]['CONTACTS_RESCHEDULED'];logger[_0x8aba('0x4f')]('[getContactDialer2][ReScheduled]'+_0x2f71b8[_0x8aba('0x4c')],_0x37e395[0x0][_0x8aba('0x72')],_0x8aba('0x74'));}else{_0x2f71b8[_0x8aba('0x75')]=utils['CAMPAIGN_STATUS'][_0x8aba('0x76')];logger[_0x8aba('0x4f')](_0x8aba('0x77')+_0x2f71b8[_0x8aba('0x4c')]);}}};}function createObjHistory(_0x18dba7,_0xafcfbd,_0x37e8fd,_0x32491f,_0x228554){_0x18dba7[_0x8aba('0x75')]=_0x37e8fd;var _0x4b3b57=new Action(_0x18dba7,_0xafcfbd);var _0x558639=new History(_0x4b3b57);_0x558639[_0x8aba('0x78')]=_0x32491f;_0x558639['statedesc']=_0x228554;_0x558639['endtime']=_0x4b3b57[_0x8aba('0x79')];return _0x558639;}function unlockQueueStatus(_0x52349a,_0x22bc46){setTimeout(function(){if(_[_0x8aba('0x69')](_0x52349a[_0x8aba('0x7a')])){loggerBooked['error'](_0x8aba('0x7b'),_0x22bc46);}_0x52349a[_0x8aba('0x7a')]=!![];loggerBooked[_0x8aba('0x4f')](_0x8aba('0x7c'),_0x22bc46,JSON['stringify'](_[_0x8aba('0x7d')](_0x52349a,['name','queueStatusComplete'])));},0x1f3);}function checkInterval(_0x1594a4){return function(){if(!isNotNull(_0x1594a4[_0x8aba('0x7e')])){_0x1594a4[_0x8aba('0x75')]=utils[_0x8aba('0x73')][_0x8aba('0x7f')];throw _0x1594a4[_0x8aba('0x4c')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x1594a4['Interval'][_0x8aba('0x80')])){_0x1594a4['message']=utils['CAMPAIGN_STATUS'][_0x8aba('0x7f')];throw _0x1594a4[_0x8aba('0x4c')]+_0x8aba('0x81');}if(!isNotNull(_[_0x8aba('0x4e')](_0x1594a4['Interval'][_0x8aba('0x80')]))){_0x1594a4[_0x8aba('0x75')]=utils[_0x8aba('0x73')][_0x8aba('0x7f')];throw _0x1594a4[_0x8aba('0x4c')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x1f3399){return function(){if(!utils[_0x8aba('0x82')](_0x1f3399)){_0x1f3399[_0x8aba('0x75')]=utils['CAMPAIGN_STATUS'][_0x8aba('0x83')];throw _0x1f3399[_0x8aba('0x4c')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x11ee1e){if(utils[_0x8aba('0x84')](_0x11ee1e)){emit(util[_0x8aba('0x4a')](_0x8aba('0x85'),_0x11ee1e[_0x8aba('0x4c')]),'campaign:save',_0x11ee1e);}}function loggerCatchQueueSummary(_0x4b7553,_0x3cb0ba){return function(_0x31d003){clearPredictiveAttributes(_0x3cb0ba);emitCampaignSummary(_0x3cb0ba);loggerSyncQueueSummary[_0x8aba('0x47')](_0x4b7553,util[_0x8aba('0x49')](_0x31d003,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x259c6f){if(_0x259c6f[_0x8aba('0x86')]){if(_0x259c6f[_0x8aba('0x87')]===0x0){_0x259c6f[_0x8aba('0x86')]=![];_0x259c6f[_0x8aba('0x75')]=utils[_0x8aba('0x73')]['INACTIVE'];loggerSyncQueueSummary[_0x8aba('0x47')](_0x8aba('0x88'),_0x259c6f[_0x8aba('0x4c')],_0x8aba('0x89'));}else{_0x259c6f[_0x8aba('0x75')]=utils['CAMPAIGN_STATUS'][_0x8aba('0x8a')];loggerSyncQueueSummary[_0x8aba('0x47')](_0x8aba('0x88'),_0x259c6f[_0x8aba('0x4c')],_0x8aba('0x8b'));}emitCampaignSummary(_0x259c6f);}}function myreject(_0x379925){return function(_0x5f27f1){return _0x379925(msgResponse(_0x8aba('0x8c'),_0x8aba('0x8d'),JSON['stringify'](_0x5f27f1)));};}Dialer[_0x8aba('0x8e')][_0x8aba('0x8f')]=function(_0x3fad1b){return!_[_0x8aba('0x69')](_0x3fad1b)&&_0x3fad1b&&!_['isUndefined'](_0x3fad1b[_0x8aba('0x4c')])&&!_[_0x8aba('0x69')](_0x3fad1b[_0x8aba('0x90')])&&_0x3fad1b['active']&&(this[_0x8aba('0x21')][util[_0x8aba('0x4a')](_0x8aba('0x91'),_0x3fad1b[_0x8aba('0x4c')])][_0x8aba('0x92')]==='reachable'||this[_0x8aba('0x21')][util['format']('SIP/%s',_0x3fad1b[_0x8aba('0x4c')])][_0x8aba('0x92')]==='unmonitored');};Dialer[_0x8aba('0x8e')]['checkIsTrunkReachable']=function(_0x1f2db9){var _0x435779=this;return function(){if(!_0x435779[_0x8aba('0x8f')](_0x1f2db9[_0x8aba('0x93')])){if(!_0x435779[_0x8aba('0x8f')](_0x1f2db9[_0x8aba('0x94')])){_0x1f2db9[_0x8aba('0x75')]=utils['CAMPAIGN_STATUS'][_0x8aba('0x95')];throw _0x1f2db9[_0x8aba('0x4c')]+_0x8aba('0x96');}}};};Dialer[_0x8aba('0x8e')][_0x8aba('0x97')]=function(_0x56eb06,_0x29bce8,_0x565ff2,_0x15d7c3){var _0x40127b=this;return function(){var _0x3eb69f=!![];return _0x40127b[_0x8aba('0x98')](_0x56eb06,_0x29bce8,_0x565ff2,_0x15d7c3,_0x3eb69f);};};Dialer[_0x8aba('0x8e')][_0x8aba('0x99')]=function(_0xa80c06,_0x4eefd4,_0x1d6a06,_0x1c3847){var _0x39122b=this;return function(){var _0x275d6=![];return _0x39122b[_0x8aba('0x98')](_0xa80c06['Intervals'],_0x4eefd4,_0x1d6a06,_0x1c3847,_0x275d6);};};Dialer[_0x8aba('0x8e')]['ifTimeIvr']=function(_0x54e664,_0x82752e,_0x2d7535,_0x44d32f,_0x5ca546){var _0x119979=[];return new Promise(function(_0x4f1d66,_0x3f8b68){if(!isNotNull(_0x54e664)){_0x44d32f[_0x8aba('0x75')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];return _0x3f8b68(msgResponse(_0x8aba('0x9a'),_0x8aba('0x9b'),_0x2d7535+_0x8aba('0x9c')));}if(_[_0x8aba('0x4e')](_0x54e664)){_0x44d32f[_0x8aba('0x75')]=utils[_0x8aba('0x73')][_0x8aba('0x9d')];return _0x3f8b68(msgResponse(_0x8aba('0x9a'),_0x8aba('0x9b'),_0x2d7535+_0x8aba('0x9e')));}if(_0x82752e&&_['isUndefined'](config[_0x8aba('0x9f')][_0x82752e])){_0x44d32f[_0x8aba('0x75')]=utils['CAMPAIGN_STATUS']['UNKNOWN_TIMEZONE'];return _0x3f8b68(msgResponse(_0x8aba('0x9a'),_0x8aba('0x9b'),_0x2d7535+_0x8aba('0xa0')+_0x82752e));}if(_[_0x8aba('0xa1')](_0x54e664)){for(var _0x2db0da=0x0;_0x2db0da<_0x54e664[_0x8aba('0xa2')];_0x2db0da+=0x1){_0x119979[_0x8aba('0xa3')](ami[_0x8aba('0xa4')]({'action':_0x8aba('0xa5'),'command':util[_0x8aba('0x4a')](_0x8aba('0xa6'),_0x54e664[_0x2db0da]['interval'],!_['isUndefined'](config[_0x8aba('0x9f')][_0x82752e])?_0x82752e:'')})['then'](function(_0x5a6db7){return _0x5a6db7[_0x8aba('0xa7')][_0x8aba('0xa8')]('true')>=0x0;})['catch'](myreject(_0x3f8b68)));}}else{_0x119979[_0x8aba('0xa3')](ami[_0x8aba('0xa4')]({'action':_0x8aba('0xa5'),'command':util[_0x8aba('0x4a')](_0x8aba('0xa6'),_0x54e664,!_[_0x8aba('0x69')](config[_0x8aba('0x9f')][_0x82752e])?_0x82752e:'')})[_0x8aba('0x43')](function(_0x321c8d){return _0x321c8d['content'][_0x8aba('0xa8')](_0x8aba('0xa9'))>=0x0;})[_0x8aba('0xaa')](myreject(_0x3f8b68)));}Promise['all'](_0x119979)[_0x8aba('0x43')](function(_0x262e2e){var _0x5cdf82=_['some'](_0x262e2e);if(_0x5cdf82){return _0x4f1d66(_0x5cdf82);}else{_0x44d32f[_0x8aba('0x75')]=_0x5ca546?utils[_0x8aba('0x73')][_0x8aba('0xab')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];return _0x3f8b68(msgResponse(_0x8aba('0xac'),'Failure',_0x8aba('0xad')+_0x5ca546+'\x20'+_0x2d7535+_0x8aba('0xae')+util[_0x8aba('0x49')](_0x54e664,{'showHidden':![],'depth':null})+_0x8aba('0xaf')+_0x82752e));}})[_0x8aba('0xaa')](function(_0x3451f8){return _0x3f8b68(msgResponse(_0x8aba('0x9a'),_0x8aba('0x9b'),JSON[_0x8aba('0xb0')](_0x3451f8)));});});};Dialer[_0x8aba('0x8e')][_0x8aba('0xb1')]=function(){var _0x4b8633=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x8aba('0x43')](function(){setInterval(function(){_0x4b8633[_0x8aba('0xb2')]();},0x3e8);});};Dialer['prototype'][_0x8aba('0xb2')]=function(){var _0xc92670=this;var _0x13929b;for(var _0x25eb41 in this[_0x8aba('0xb3')]){if(typeof this[_0x8aba('0xb3')][_0x25eb41]!==_0x8aba('0xb4')){_0x13929b=this['campaigns'][_0x25eb41];if(utils['isIVRCampaign'](_0x13929b)&&utils[_0x8aba('0x82')](_0x13929b)){_0x13929b[_0x8aba('0x86')]=!![];Promise[_0x8aba('0xb5')]()[_0x8aba('0x43')](checkIsIVRCampaignActive(_0x13929b))[_0x8aba('0x43')](checkInterval(_0x13929b))[_0x8aba('0x43')](_0xc92670['checkIsTrunkReachable'](_0x13929b))[_0x8aba('0x43')](_0xc92670[_0x8aba('0x97')](_0x13929b['dialGlobalInterval'],_0x13929b[_0x8aba('0xb6')],_0x13929b[_0x8aba('0x4c')],_0x13929b))[_0x8aba('0x43')](_0xc92670['checkIfTimeIntervals'](_0x13929b[_0x8aba('0x7e')],_0x13929b[_0x8aba('0xb6')],_0x13929b[_0x8aba('0x4c')],_0x13929b))[_0x8aba('0x43')](_0xc92670[_0x8aba('0xb7')](_0x13929b))[_0x8aba('0xaa')](loggerCatchQueueSummary(_0x8aba('0xb8'),_0x13929b));}else{notSendMessagesCampaign(_0x13929b);}}}};Dialer[_0x8aba('0x8e')][_0x8aba('0xb9')]=function(_0x295de0){if(_0x295de0[_0x8aba('0xba')]!==_0x8aba('0xa')){clearPredictiveAttributes(_0x295de0);}switch(_0x295de0['dialMethod']){case'progressive':this[_0x8aba('0xbb')](_0x295de0,0x1);break;case _0x8aba('0xbc'):this[_0x8aba('0xbb')](_0x295de0,_0x295de0[_0x8aba('0xbd')]);break;case _0x8aba('0xa'):this[_0x8aba('0xa')](_0x295de0);break;case'booked':this[_0x8aba('0xbb')](_0x295de0,0x1);break;default:logger[_0x8aba('0x6f')]('Queue',_0x295de0['name'],'method\x20not\x20recognized');}};Dialer[_0x8aba('0x8e')][_0x8aba('0x9a')]=function(_0x4b55b6,_0x248b27){var _0x5d669a=_0x4b55b6[_0x8aba('0xb6')];var _0x5dc182=_0x248b27?_0x4b55b6['dialGlobalInterval']:_0x4b55b6[_0x8aba('0x7e')]['Intervals'];logger['silly'](_0x8aba('0xbe'),_0x5dc182,_0x5d669a,_0x4b55b6[_0x8aba('0x4c')],util[_0x8aba('0x4a')]('Voice\x20Queue\x20%s\x20$s',_0x4b55b6['name'],_0x4b55b6['id']));var _0x1a669c=null;return Interval[_0x8aba('0xbf')](_0x5dc182,_0x5d669a)[_0x8aba('0x43')](function(_0x385565){if(_0x385565===!![]){return _0x385565;}else{_0x4b55b6[_0x8aba('0x75')]=_0x248b27?utils[_0x8aba('0x73')][_0x8aba('0xab')]:utils['CAMPAIGN_STATUS'][_0x8aba('0xc0')];_0x1a669c=msgResponse(_0x8aba('0xac'),'Failure',_0x8aba('0xad')+_0x248b27+'\x20'+_0x4b55b6[_0x8aba('0x4c')]+_0x8aba('0xae')+util[_0x8aba('0x49')](_0x5dc182,{'showHidden':![],'depth':null})+_0x8aba('0xaf')+_0x5d669a);}if(_0x1a669c!==null){logger['silly'](_0x8aba('0xc1'),_0x1a669c);_0x1a669c[_0x8aba('0xc2')]=_0x248b27;throw _0x1a669c;}})['catch'](function(_0x1a12db){logger[_0x8aba('0x6f')](_0x8aba('0xc3'),_0x1a12db);throw msgResponse('[ifTime][Action]',_0x8aba('0x8d'),util['inspect'](_0x1a12db,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x8aba('0x2d')]=function(_0x4e4336){if(this[_0x8aba('0x1f')][_0x4e4336['queue']]){if(this[_0x8aba('0x25')][_0x4e4336['uniqueid']]&&this['uniqueId'][_0x4e4336[_0x8aba('0xc4')]][_0x8aba('0xc5')]!==_0x8aba('0xc6')){this[_0x8aba('0xc7')](this['voiceQueues'][_0x4e4336[_0x8aba('0xc8')]]);this[_0x8aba('0x25')][_0x4e4336[_0x8aba('0xc4')]]['answertime']=moment()[_0x8aba('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0x8aba('0x34')]=function(_0x5c1d8a){var _0x33e485=this[_0x8aba('0x25')][_0x5c1d8a['uniqueid']];if(this[_0x8aba('0x1f')][_0x5c1d8a[_0x8aba('0xc8')]]){if(_0x33e485&&_0x33e485[_0x8aba('0xc5')]!==_0x8aba('0xc6')){delete this[_0x8aba('0x25')][_0x5c1d8a[_0x8aba('0xc4')]];this['voiceQueues'][_0x5c1d8a[_0x8aba('0xc8')]][_0x8aba('0xc9')]+=0x1;var _0x1913da=new AgentComplete(_0x33e485,_0x5c1d8a);if(_0x5c1d8a['reason']===_0x8aba('0xca')){_0x1913da[_0x8aba('0xcb')]=this[_0x8aba('0x1f')][_0x5c1d8a[_0x8aba('0xc8')]][_0x8aba('0xcc')]&&this[_0x8aba('0x1f')][_0x5c1d8a[_0x8aba('0xc8')]][_0x8aba('0xcd')]?moment()[_0x8aba('0x4a')](_0x8aba('0xce')):undefined;}hopperUtils['createHistory'](_0x1913da)[_0x8aba('0xaa')](loggerCatch(_0x8aba('0xcf')));hopperUtils[_0x8aba('0xd0')](_0x1913da)[_0x8aba('0xaa')](loggerCatch(_0x8aba('0xd1')));}}};Dialer['prototype'][_0x8aba('0x30')]=function(_0x236605){var _0x476a8c=this[_0x8aba('0x25')][_0x236605[_0x8aba('0xc4')]];var _0x2e8f79=this;var _0x956445=![];var _0x1f36a0;var _0x2b5542;if(this[_0x8aba('0x1f')][_0x236605[_0x8aba('0xc8')]]){if(_0x476a8c&&_0x476a8c[_0x8aba('0xc5')]!==_0x8aba('0xc6')){delete this['uniqueId'][_0x236605[_0x8aba('0xc4')]];this[_0x8aba('0xc7')](this[_0x8aba('0x1f')][_0x236605['queue']]);_0x476a8c[_0x8aba('0xd2')]=moment()[_0x8aba('0x4a')](_0x8aba('0xce'));var _0x21fe17=new QueueCallerAbandon(_0x476a8c,_0x236605);if(utils[_0x8aba('0x6a')](_0x476a8c[_0x8aba('0xd2')],_0x476a8c['responsetime'])>=_0x476a8c[_0x8aba('0xd3')]){this[_0x8aba('0x1f')][_0x236605[_0x8aba('0xc8')]][_0x8aba('0x54')]+=0x1;this[_0x8aba('0x1f')][_0x236605['queue']][_0x8aba('0xd4')]+=0x1;this['voiceQueues'][_0x236605[_0x8aba('0xc8')]][_0x8aba('0xd5')]+=0x1;_0x21fe17['state']=0xa;_0x21fe17[_0x8aba('0xd6')]=_0x8aba('0xd7');_0x21fe17['dropreason']='TIMEOUT';_0x21fe17[_0x8aba('0xcb')]=this['voiceQueues'][_0x236605[_0x8aba('0xc8')]]['dialQueueProject2']?moment()[_0x8aba('0x4a')](_0x8aba('0xce')):undefined;_0x21fe17[_0x8aba('0xd8')]+=0x1;_0x21fe17['countglobal']+=0x1;_0x1f36a0=this[_0x8aba('0x1f')][_0x236605[_0x8aba('0xc8')]][_0x8aba('0xd9')];_0x2b5542=this[_0x8aba('0x1f')][_0x236605[_0x8aba('0xc8')]][_0x8aba('0xda')];hopperUtils[_0x8aba('0xdb')](_0x21fe17,_0x21fe17[_0x8aba('0x78')],_0x476a8c[_0x8aba('0xdc')])[_0x8aba('0x43')](function(_0x4554f3){_0x956445=_0x4554f3[_0x8aba('0xdd')]==0x1;if(_0x21fe17['countdropretry']>=_0x2e8f79[_0x8aba('0x1f')][_0x236605[_0x8aba('0xc8')]]['dialDropMaxRetry']){_0x2e8f79[_0x8aba('0xde')](_0x21fe17,_0x4554f3[_0x8aba('0xdd')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x21fe17[_0x8aba('0xd8')],'scheduledat':moment()['add'](_0x2e8f79[_0x8aba('0x1f')][_0x236605[_0x8aba('0xc8')]][_0x8aba('0xd9')],_0x8aba('0xdf'))[_0x8aba('0x4a')](_0x8aba('0xce')),'ContactId':_0x476a8c['ContactId'],'ListId':_0x476a8c['ListId'],'VoiceQueueId':_0x476a8c[_0x8aba('0xe0')]||undefined,'CampaignId':_0x476a8c['CampaignId']||undefined})[_0x8aba('0xaa')](loggerCatch('[rescheduleContact][Drop]'));var _0x3e52b1=new History(_0x21fe17);_0x3e52b1['state']=0xa;_0x3e52b1[_0x8aba('0xd6')]='Drop';_0x3e52b1[_0x8aba('0x79')]=moment()['format'](_0x8aba('0xce'));_0x3e52b1[_0x8aba('0xe1')]=_0x3e52b1['starttime'];_0x3e52b1[_0x8aba('0xe2')]=_0x21fe17[_0x8aba('0xe2')];_0x3e52b1['calleridnum']=_0x21fe17[_0x8aba('0xe3')];hopperUtils[_0x8aba('0xe4')](_0x3e52b1)[_0x8aba('0xaa')](loggerCatch(_0x8aba('0xe5')));}})['then'](function(){if(_0x956445)hopperUtils[_0x8aba('0xe6')](_0x21fe17,_0x1f36a0,_0x2b5542)['then'](function(){return 0x1;});});}else{this[_0x8aba('0x1f')][_0x236605['queue']][_0x8aba('0x56')]+=0x1;this['voiceQueues'][_0x236605['queue']][_0x8aba('0xe7')]+=0x1;_0x21fe17[_0x8aba('0x78')]=0xb;_0x21fe17['statedesc']='Abandoned';_0x21fe17[_0x8aba('0xe8')]=_0x8aba('0xe9');_0x21fe17[_0x8aba('0xea')]+=0x1;_0x21fe17['countglobal']+=0x1;_0x1f36a0=this[_0x8aba('0x1f')][_0x236605[_0x8aba('0xc8')]][_0x8aba('0xeb')];_0x2b5542=this[_0x8aba('0x1f')][_0x236605[_0x8aba('0xc8')]][_0x8aba('0xda')];hopperUtils[_0x8aba('0xdb')](_0x21fe17,_0x21fe17['state'],_0x476a8c[_0x8aba('0xdc')])[_0x8aba('0x43')](function(_0x264770){if(_0x21fe17[_0x8aba('0xea')]>=_0x2e8f79[_0x8aba('0x1f')][_0x236605[_0x8aba('0xc8')]][_0x8aba('0xec')]){_0x2e8f79['queueCallerAbandonCreateState'](_0x21fe17,_0x264770[_0x8aba('0xdd')]);}else{hopperUtils[_0x8aba('0xed')]({'active':![],'countabandonedretry':_0x21fe17[_0x8aba('0xea')],'scheduledat':moment()[_0x8aba('0xee')](_0x2e8f79['voiceQueues'][_0x236605[_0x8aba('0xc8')]][_0x8aba('0xeb')],_0x8aba('0xdf'))[_0x8aba('0x4a')](_0x8aba('0xce')),'ContactId':_0x476a8c[_0x8aba('0xef')],'ListId':_0x476a8c[_0x8aba('0xf0')],'VoiceQueueId':_0x476a8c[_0x8aba('0xe0')]||undefined,'CampaignId':_0x476a8c[_0x8aba('0xf1')]||undefined})[_0x8aba('0xaa')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x2a2ab4=new History(_0x21fe17);_0x2a2ab4[_0x8aba('0x78')]=0xb;_0x2a2ab4[_0x8aba('0xd6')]='Abandoned';_0x2a2ab4[_0x8aba('0x79')]=moment()[_0x8aba('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a2ab4[_0x8aba('0xe1')]=_0x2a2ab4['starttime'];_0x2a2ab4[_0x8aba('0xe2')]=_0x21fe17[_0x8aba('0xe2')];_0x2a2ab4[_0x8aba('0xe3')]=_0x21fe17['calleridnum'];hopperUtils['createHistory'](_0x2a2ab4)[_0x8aba('0xaa')](loggerCatch(_0x8aba('0xf2')));}})[_0x8aba('0x43')](function(){if(_0x956445)hopperUtils[_0x8aba('0xe6')](_0x21fe17,_0x1f36a0,_0x2b5542)[_0x8aba('0x43')](function(){return 0x1;});});}}}};Dialer[_0x8aba('0x8e')][_0x8aba('0x3b')]=function(_0x51fd0a){if(this[_0x8aba('0x23')][_0x51fd0a[_0x8aba('0xc4')]]){this[_0x8aba('0x23')][_0x51fd0a[_0x8aba('0xc4')]][_0x8aba('0xf3')]=_0x51fd0a['channel'];}if(this[_0x8aba('0x25')][_0x51fd0a['uniqueid']]){this[_0x8aba('0x25')][_0x51fd0a[_0x8aba('0xc4')]][_0x8aba('0xf3')]=_0x51fd0a[_0x8aba('0xf3')];}};Dialer[_0x8aba('0x8e')]['syncQueueMember']=function(_0x170311){if(!this['actions'][_0x170311[_0x8aba('0xf4')]]){return;}var _0x12932a=this[_0x8aba('0x1f')][this[_0x8aba('0x23')][_0x170311['actionid']][_0x8aba('0xc8')]][_0x8aba('0xf5')]||_0x8aba('0xf6');if(_0x12932a===_0x8aba('0xf7')){if(this['actions'][_0x170311[_0x8aba('0xf4')]]&&_['isNil'](this[_0x8aba('0x23')][_0x170311[_0x8aba('0xf4')]][_0x8aba('0xf8')])&&_0x170311[_0x8aba('0x92')]==='1'&&_0x170311['paused']==='0'){if(this['agents'][_0x170311[_0x8aba('0xf9')]]){if(!this[_0x8aba('0x20')][_0x170311[_0x8aba('0xf9')]][_0x8aba('0xf8')]){this['agents'][_0x170311['stateinterface']]['locked']=!![];this[_0x8aba('0x23')][_0x170311['actionid']][_0x8aba('0xf8')]=!![];this[_0x8aba('0x23')][_0x170311['actionid']][_0x8aba('0xf9')]=_0x170311[_0x8aba('0xf9')];}}}}else if(_0x12932a===_0x8aba('0xf6')){if(this[_0x8aba('0x23')][_0x170311[_0x8aba('0xf4')]]){if(this[_0x8aba('0x20')][_0x170311[_0x8aba('0xf9')]]){this[_0x8aba('0x23')][_0x170311[_0x8aba('0xf4')]][_0x8aba('0xf9')]=_0x170311[_0x8aba('0xf9')];if(_[_0x8aba('0xfa')](this['queueBooked'][this['actions'][_0x170311['actionid']][_0x8aba('0xc8')]])){this['queueBooked'][this['actions'][_0x170311[_0x8aba('0xf4')]][_0x8aba('0xc8')]]=[];}this['queueBooked'][this[_0x8aba('0x23')][_0x170311[_0x8aba('0xf4')]][_0x8aba('0xc8')]]['push'](_[_0x8aba('0x68')](_[_0x8aba('0x7d')](this['actions'][_0x170311[_0x8aba('0xf4')]],[_0x8aba('0xfb'),_0x8aba('0xf9')]),{'status':_0x170311[_0x8aba('0x92')],'paused':_0x170311['paused']}));}}}};Dialer[_0x8aba('0x8e')][_0x8aba('0x40')]=function(_0x2163b6){if(!this['actions'][_0x2163b6['actionid']]){return;}var _0x47625d=this;var _0x41f487=this[_0x8aba('0x1f')][this[_0x8aba('0x23')][_0x2163b6[_0x8aba('0xf4')]][_0x8aba('0xc8')]];var _0x18283b=_0x41f487[_0x8aba('0xf5')]||_0x8aba('0xf6');if(_0x18283b==='roundrobin'){if(this[_0x8aba('0x23')][_0x2163b6[_0x8aba('0xf4')]]&&this[_0x8aba('0x23')][_0x2163b6[_0x8aba('0xf4')]]['stateinterface']){this['preview']['run'](this['actions'][_0x2163b6[_0x8aba('0xf4')]][_0x8aba('0xfb')],this['actions'][_0x2163b6['actionid']][_0x8aba('0xf9')])[_0x8aba('0xaa')](function(_0x285d81){logger[_0x8aba('0x6f')](_0x8aba('0xfc'),util[_0x8aba('0x49')](_0x285d81,{'showHidden':![],'depth':null}));})['finally'](function(){_0x47625d['updateOriginated'](_0x47625d[_0x8aba('0x1f')][_0x47625d[_0x8aba('0x23')][_0x2163b6[_0x8aba('0xf4')]][_0x8aba('0xc8')]]);_0x47625d[_0x8aba('0x20')][_0x47625d['actions'][_0x2163b6[_0x8aba('0xf4')]][_0x8aba('0xf9')]][_0x8aba('0xf8')]=![];delete _0x47625d[_0x8aba('0x23')][_0x2163b6[_0x8aba('0xf4')]];unlockQueueStatus(_0x41f487);});}else{this['updateOriginated'](this[_0x8aba('0x1f')][this[_0x8aba('0x23')][_0x2163b6['actionid']][_0x8aba('0xc8')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x8aba('0x23')][_0x2163b6[_0x8aba('0xf4')]]['ContactId'],'ListId':this['actions'][_0x2163b6[_0x8aba('0xf4')]]['ListId'],'VoiceQueueId':this[_0x8aba('0x23')][_0x2163b6['actionid']]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x2163b6[_0x8aba('0xf4')]][_0x8aba('0xf1')]||undefined})['catch'](loggerCatch(_0x8aba('0xfd')));delete this[_0x8aba('0x23')][_0x2163b6[_0x8aba('0xf4')]];unlockQueueStatus(_0x41f487);}}else if(_0x18283b===_0x8aba('0xf6')){var _0x59d90e;if(this[_0x8aba('0x23')][_0x2163b6[_0x8aba('0xf4')]]&&!_[_0x8aba('0x4e')](this[_0x8aba('0x2a')][this[_0x8aba('0x23')][_0x2163b6[_0x8aba('0xf4')]]['queue']])){if(this['queueBookedRR'][_0x47625d[_0x8aba('0x23')][_0x2163b6['actionid']][_0x8aba('0xc8')]]){this[_0x8aba('0xfe')][_0x47625d[_0x8aba('0x23')][_0x2163b6[_0x8aba('0xf4')]]['queue']]=this[_0x8aba('0xfe')][this[_0x8aba('0x23')][_0x2163b6['actionid']][_0x8aba('0xc8')]]?this[_0x8aba('0xfe')][this['actions'][_0x2163b6[_0x8aba('0xf4')]][_0x8aba('0xc8')]]:this[_0x8aba('0x2a')][this[_0x8aba('0x23')][_0x2163b6['actionid']][_0x8aba('0xc8')]]?this[_0x8aba('0x2a')][this[_0x8aba('0x23')][_0x2163b6[_0x8aba('0xf4')]][_0x8aba('0xc8')]]['_rr']||0x0:0x0;}this[_0x8aba('0x2a')][this[_0x8aba('0x23')][_0x2163b6[_0x8aba('0xf4')]][_0x8aba('0xc8')]]['_rr']=this[_0x8aba('0xfe')][this['actions'][_0x2163b6[_0x8aba('0xf4')]][_0x8aba('0xc8')]];for(var _0x12c505=0x0;_0x12c505=_0x3f4327[_0x8aba('0x126')]){_0x4beb24[_0x8aba('0x127')](_0x369fd9,_0x3e9bed,_0x11d270,_0x8aba('0x128'));}else{if(_0x369fd9[_0x8aba('0x11f')]>=_0x3f4327['dialMachineMaxRetry']){_0x4beb24[_0x8aba('0x129')](_0x369fd9,_0x3e9bed,_0x11d270,'reason\x2019\x20machine....');}else{hopperUtils[_0x8aba('0xed')]({'active':![],'countmachineretry':_0x369fd9['countmachineretry'],'scheduledat':moment()[_0x8aba('0xee')](_0x3f4327['dialMachineRetryFrequency'],_0x8aba('0xdf'))[_0x8aba('0x4a')](_0x8aba('0xce')),'ContactId':_0x369fd9[_0x8aba('0xef')],'ListId':_0x369fd9[_0x8aba('0xf0')],'VoiceQueueId':_0x369fd9['VoiceQueueId']||undefined,'CampaignId':_0x369fd9[_0x8aba('0xf1')]||undefined})[_0x8aba('0xaa')](loggerCatch(_0x8aba('0x12a')));_0x3e9bed({'reschedule':0x1});}}});}if(_0x5edd07[_0x8aba('0xc5')]===_0x8aba('0xc6')&&this[_0x8aba('0xb3')][_0x5edd07[_0x8aba('0xc8')]]['dialAMDActive']&&_0x4cbaef[_0x8aba('0x112')]===_0x8aba('0x113')){delete this['uniqueId'][_0x4cbaef['uniqueid']];this['updateOriginated'](this[_0x8aba('0xb3')][_0x5edd07[_0x8aba('0xc8')]]);_0x1e8359=new Hangup(_0x5edd07,_0x4cbaef);_0x1e8359[_0x8aba('0x78')]=0x12;_0x1e8359[_0x8aba('0xd6')]=_0x8aba('0x12b');_0x1e8359['membername']=_0x8aba('0x116');ami[_0x8aba('0x45')](_0x8aba('0x12c'),ut[_0x8aba('0x117')](_0x1e8359,_0x8aba('0x118')));this[_0x8aba('0x119')](_0x1e8359,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x5edd07[_0x8aba('0xc5')]===_0x8aba('0xc6')&&this[_0x8aba('0xb3')][_0x5edd07[_0x8aba('0xc8')]][_0x8aba('0x11c')]&&_0x4cbaef[_0x8aba('0x112')]===_0x8aba('0x11d')){return new Promise(function(_0x1983a1,_0x4a64cd){delete _0x4beb24[_0x8aba('0x25')][_0x4cbaef[_0x8aba('0xc4')]];_0x4beb24[_0x8aba('0xc7')](_0x4beb24[_0x8aba('0xb3')][_0x5edd07['queue']]);_0x4beb24[_0x8aba('0xb3')][_0x5edd07[_0x8aba('0xc8')]]['outboundAnswerCallsDay']+=0x1;_0x4beb24[_0x8aba('0xb3')][_0x5edd07[_0x8aba('0xc8')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3f81d7=_0x4beb24[_0x8aba('0xb3')][_0x5edd07[_0x8aba('0xc8')]];var _0x20841a=new Hangup(_0x5edd07,_0x4cbaef);_0x20841a['state']=0x13;_0x20841a[_0x8aba('0xd6')]=_0x8aba('0x11e');_0x20841a[_0x8aba('0x115')]=_0x8aba('0x116');_0x20841a[_0x8aba('0x11f')]+=0x1;_0x20841a[_0x8aba('0x12d')]+=0x1;_0x20841a['amd']=!![];ami[_0x8aba('0x45')](_0x8aba('0x12c'),ut[_0x8aba('0x117')](_0x20841a,_0x8aba('0x118')));hopperUtils['createHistory'](_0x20841a)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x20841a[_0x8aba('0x121')]+_0x20841a[_0x8aba('0x122')]+_0x20841a[_0x8aba('0x123')]+_0x20841a['countnosuchnumberretry']+_0x20841a[_0x8aba('0xd8')]+_0x20841a['countabandonedretry']+_0x20841a[_0x8aba('0x11f')]+_0x20841a['countagentrejectretry']>=_0x3f81d7[_0x8aba('0x126')]){_0x4beb24['stateGlobal'](_0x20841a,_0x1983a1,_0x4a64cd,_0x8aba('0x128'));}else{if(_0x20841a[_0x8aba('0x11f')]>=_0x3f81d7['dialMachineMaxRetry']){_0x4beb24[_0x8aba('0x129')](_0x20841a,_0x1983a1,_0x4a64cd,'reason\x2019\x20machine....');}else{hopperUtils[_0x8aba('0xed')]({'active':![],'countmachineretry':_0x20841a['countmachineretry'],'scheduledat':moment()[_0x8aba('0xee')](_0x3f81d7[_0x8aba('0x12e')],_0x8aba('0xdf'))[_0x8aba('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x20841a['ContactId'],'ListId':_0x20841a[_0x8aba('0xf0')],'VoiceQueueId':_0x20841a['VoiceQueueId']||undefined,'CampaignId':_0x20841a[_0x8aba('0xf1')]||undefined})[_0x8aba('0xaa')](loggerCatch(_0x8aba('0x12a')));_0x1983a1({'reschedule':0x1});}}});}}};Dialer[_0x8aba('0x8e')][_0x8aba('0x39')]=function(_0x42b594){var _0x17243c=this[_0x8aba('0x25')][_0x42b594[_0x8aba('0xc4')]];var _0x2544bc;if(_0x17243c&&_0x17243c[_0x8aba('0xc5')]===_0x8aba('0xc6')){delete this[_0x8aba('0x25')][_0x42b594['uniqueid']];this['updateOriginated'](this[_0x8aba('0xb3')][_0x17243c[_0x8aba('0xc8')]]);this['campaigns'][_0x17243c[_0x8aba('0xc8')]][_0x8aba('0x12f')]+=0x1;_0x2544bc=new Hangup(_0x17243c,_0x42b594);hopperUtils[_0x8aba('0xe4')](_0x2544bc)[_0x8aba('0xaa')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x8aba('0xd0')](_0x2544bc)[_0x8aba('0xaa')](loggerCatch(_0x8aba('0x130')));}if(_0x17243c&&_0x17243c[_0x8aba('0xc5')]!=='ivr'&&isNotNull(this[_0x8aba('0x1f')][_0x17243c[_0x8aba('0xc8')]]['dialQueueProject'])){delete this[_0x8aba('0x25')][_0x42b594[_0x8aba('0xc4')]];this[_0x8aba('0xc7')](this[_0x8aba('0x1f')][_0x17243c[_0x8aba('0xc8')]]);this['voiceQueues'][_0x17243c['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x8aba('0x1f')][_0x17243c[_0x8aba('0xc8')]][_0x8aba('0x114')]+=0x1;_0x2544bc=new Hangup(_0x17243c,_0x42b594);_0x2544bc[_0x8aba('0x78')]=0x10;_0x2544bc[_0x8aba('0xd6')]=_0x8aba('0x131');_0x2544bc[_0x8aba('0x115')]='AGI';hopperUtils[_0x8aba('0xe4')](_0x2544bc)[_0x8aba('0xaa')](loggerCatch(_0x8aba('0x132')));hopperUtils[_0x8aba('0xd0')](_0x2544bc)[_0x8aba('0xaa')](loggerCatch(_0x8aba('0x130')));}if(_0x17243c&&_0x17243c[_0x8aba('0xc5')]!==_0x8aba('0xc6')&&!isNotNull(this[_0x8aba('0x1f')][_0x17243c[_0x8aba('0xc8')]][_0x8aba('0x133')])){delete this[_0x8aba('0x25')][_0x42b594[_0x8aba('0xc4')]];this[_0x8aba('0xc7')](this[_0x8aba('0x1f')][_0x17243c['queue']]);this[_0x8aba('0x1f')][_0x17243c[_0x8aba('0xc8')]][_0x8aba('0x134')]+=0x1;_0x2544bc=new Hangup(_0x17243c,_0x42b594);_0x2544bc[_0x8aba('0x78')]=0xc;_0x2544bc[_0x8aba('0xd6')]=_0x42b594['cause-txt'];_0x2544bc[_0x8aba('0x115')]=_0x8aba('0x135');hopperUtils[_0x8aba('0xe4')](_0x2544bc)['catch'](loggerCatch(_0x8aba('0x132')));hopperUtils[_0x8aba('0xd0')](_0x2544bc)['catch'](loggerCatch(_0x8aba('0x130')));}};Dialer[_0x8aba('0x8e')][_0x8aba('0xc')]=function(_0x13cf06){var _0x342963=this;if(!_0x342963['queuesSummary'][_0x13cf06['name']]){_0x342963[_0x8aba('0x2b')][_0x13cf06[_0x8aba('0x4c')]]={'running':![]};}else if(_0x342963[_0x8aba('0x2b')][_0x13cf06[_0x8aba('0x4c')]]['running']===!![]){return;}else if(_0x342963[_0x8aba('0x2b')][_0x13cf06[_0x8aba('0x4c')]]['running']===![]){_0x342963[_0x8aba('0x2b')][_0x13cf06[_0x8aba('0x4c')]][_0x8aba('0x136')]=!![];}var _0x212592=_0x342963[_0x8aba('0x1f')][_0x13cf06[_0x8aba('0x4c')]];var _0xeca097=_0x212592['message']!==utils['CAMPAIGN_STATUS'][_0x8aba('0x83')];var _0x2f0530=utils[_0x8aba('0x137')](_0x212592);_0x212592[_0x8aba('0x138')]=utils[_0x8aba('0x139')](_0x212592,_0x342963[_0x8aba('0x21')]);Promise[_0x8aba('0xb5')]()[_0x8aba('0x43')](function(){if(_0x212592[_0x8aba('0x138')]===utils[_0x8aba('0x73')][_0x8aba('0x83')]){if(_0xeca097){clearPredictiveAttributes(_0x212592);_0x13cf06[_0x8aba('0x27')]=undefined;_0x13cf06[_0x8aba('0x28')]=undefined;}if(_0x212592['statusMessage']===utils[_0x8aba('0x73')][_0x8aba('0x83')]){_0x13cf06['available']=0x0;_0x13cf06[_0x8aba('0x100')]=0x0;_0x13cf06[_0x8aba('0x13a')]=0x0;_0x13cf06[_0x8aba('0x13b')]=0x0;_0x13cf06[_0x8aba('0x13c')]=0x0;}}else if(_0x212592['statusMessage']===utils[_0x8aba('0x73')][_0x8aba('0x13d')]&&!_0x2f0530){return _0x342963[_0x8aba('0x9a')](_0x212592,!![])[_0x8aba('0x43')](function(){return _0x342963['ifTime'](_0x212592,![]);})[_0x8aba('0x43')](function(){return _0x342963[_0x8aba('0xb9')](_0x212592);})[_0x8aba('0xaa')](function(_0x570ab8){loggerSyncQueueSummary[_0x8aba('0x47')](_0x8aba('0x13e'),util[_0x8aba('0x49')](_0x570ab8,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x212592);});}else{clearPredictiveAttributes(_0x212592);}})[_0x8aba('0x43')](function(){var _0x32e13a=_0x13cf06['compareToOutboundQueue'](_0x212592);if(_0x32e13a||_0x212592['queueSummaryCountersUpdated']){_0x212592['queueSummaryCountersUpdated']=![];_0x13cf06[_0x8aba('0x13f')](_0x212592);Object['assign'](_0x212592,_0x13cf06);emitOutboundVoiceQueueSummary(_0x13cf06);}_0x342963[_0x8aba('0x2b')][_0x212592[_0x8aba('0x4c')]][_0x8aba('0x136')]=![];})[_0x8aba('0xaa')](function(_0x10c897){logger[_0x8aba('0x6f')](_0x8aba('0x13e'),util[_0x8aba('0x49')](_0x10c897,{'showHidden':![],'depth':null}));_0x342963[_0x8aba('0x2b')][_0x212592[_0x8aba('0x4c')]]['running']=![];});};Dialer[_0x8aba('0x8e')][_0x8aba('0x37')]=_[_0x8aba('0x140')](function(){var _0x515129=_[_0x8aba('0x141')](this[_0x8aba('0x1f')],function(_0x29f0a4){return _0x29f0a4[_0x8aba('0x142')];});var _0x30d984=_[_0x8aba('0x141')](this[_0x8aba('0x20')],function(_0x3c9685){return _0x3c9685[_0x8aba('0x143')]&&_0x3c9685[_0x8aba('0x92')]===_0x8aba('0x144');});if(_0x515129['length']>0x0&&_0x30d984[_0x8aba('0xa2')]>0x0){return Promise[_0x8aba('0xb5')]()[_0x8aba('0x43')](cmHopper[_0x8aba('0x145')](_[_0x8aba('0x146')](_0x515129,'id'),previewRecallmeReminderInterval,_[_0x8aba('0x146')](_0x30d984,'id')))[_0x8aba('0x43')](function(_0x2790b5){for(var _0x12d15=0x0;_0x12d15<_0x2790b5[_0x8aba('0xa2')];_0x12d15++){var _0x2a76bf=_0x2790b5[_0x12d15][_0x8aba('0x147')][_0x8aba('0x4c')];if(_0x2a76bf)io['to'](util[_0x8aba('0x4a')](_0x8aba('0x148'),_0x2a76bf))[_0x8aba('0x45')](_0x8aba('0x149'),{'hopper':_0x2790b5[_0x12d15]});}})['catch'](function(_0x18849e){logger[_0x8aba('0x6f')](_0x8aba('0x14a'),_0x18849e);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x8aba('0x8e')][_0x8aba('0x41')]=function(){var _0x3f6a1d=this;setInterval(function(){_0x3f6a1d[_0x8aba('0x14b')](_0x3f6a1d[_0x8aba('0x25')],_0x8aba('0x14c'));_0x3f6a1d[_0x8aba('0x14b')](_0x3f6a1d[_0x8aba('0x23')],_0x8aba('0x14d'));},0x32c8);};Dialer['prototype'][_0x8aba('0x14b')]=function(_0x2bf26b,_0x1e9cfc){var _0x2c02a1=this;for(var _0x4d9800 in _0x2bf26b){if(typeof _0x2bf26b[_0x4d9800]!==_0x8aba('0xb4')){this[_0x8aba('0x1d')][_0x8aba('0x14e')](function(){if(!_[_0x8aba('0xfa')](_0x2bf26b[_0x4d9800])){return ami[_0x8aba('0xa4')]({'action':_0x8aba('0x92'),'channel':_0x2bf26b[_0x4d9800][_0x8aba('0xf3')]})[_0x8aba('0xaa')](function(_0x1a8350){if(_0x1a8350[_0x8aba('0x75')]===_0x8aba('0x14f')){setTimeout(function(){if(_0x2bf26b[_0x4d9800]&&_0x2bf26b[_0x4d9800][_0x8aba('0xc5')]!==_0x8aba('0xc6')){_0x2c02a1[_0x8aba('0xc7')](_0x2c02a1[_0x8aba('0x1f')][_0x2bf26b[_0x4d9800][_0x8aba('0xc8')]]);logger[_0x8aba('0x6f')]('[Dialer][checkChannel]',_0x1e9cfc,_0x4d9800,_0x2bf26b[_0x4d9800]['queue']);delete _0x2bf26b[_0x4d9800];}if(_0x2bf26b[_0x4d9800]&&_0x2bf26b[_0x4d9800][_0x8aba('0xc5')]===_0x8aba('0xc6')){_0x2c02a1[_0x8aba('0xc7')](_0x2c02a1[_0x8aba('0xb3')][_0x2bf26b[_0x4d9800][_0x8aba('0xc8')]]);logger['error'](_0x8aba('0x150'),_0x1e9cfc,_0x4d9800,_0x2bf26b[_0x4d9800]['queue']);delete _0x2bf26b[_0x4d9800];}},0x2328);}});}});}}};Dialer[_0x8aba('0x8e')][_0x8aba('0x151')]=function(_0x20e7fe){return Promise[_0x8aba('0xb5')]()['then'](voiceQueueRt[_0x8aba('0x151')](_0x20e7fe))[_0x8aba('0xaa')](loggerCatch(_0x8aba('0x152')));};Dialer[_0x8aba('0x8e')]['updateOriginated']=function(_0x1b797f){if(!_['isUndefined'](_0x1b797f)&&_0x1b797f!==null){if(typeof _0x1b797f[_0x8aba('0x87')]!=='undefined'){if(_0x1b797f[_0x8aba('0x87')]>0x0){_0x1b797f[_0x8aba('0x87')]-=0x1;}else{logger['error'](_0x8aba('0x153'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x8aba('0x8e')][_0x8aba('0x154')]=function(_0x579328,_0x59d71f){var _0x4cd72a=this;return function(_0x1447af){_0x4cd72a[_0x8aba('0xc7')](_0x59d71f);logger['error'](_0x579328,util[_0x8aba('0x49')](_0x1447af,{'showHidden':![],'depth':null}));};};Dialer[_0x8aba('0x8e')]['emptyContact']=function(_0x1d68c5,_0x2f66f9,_0x45c495){var _0x48428d={'state':0x19,'statedesc':_0x8aba('0x155')};this[_0x8aba('0xc7')](_0x2f66f9);this[_0x8aba('0x119')](_[_0x8aba('0x68')](_0x48428d,_[_0x8aba('0x7d')](_0x45c495,[_0x8aba('0xef'),_0x8aba('0xf0'),'UserId','VoiceQueueId',_0x8aba('0xf1')])),_0x8aba('0x156'),_0x8aba('0x157'));logger[_0x8aba('0x6f')](_0x1d68c5);};Dialer[_0x8aba('0x8e')]['saveInDb']=function(_0x4f32e8,_0x2b5474,_0x26a7e9){hopperUtils[_0x8aba('0xe4')](_0x4f32e8)[_0x8aba('0xaa')](loggerCatch(_0x2b5474));hopperUtils[_0x8aba('0xd0')](_0x4f32e8)[_0x8aba('0xaa')](loggerCatch(_0x26a7e9));};Dialer[_0x8aba('0x8e')][_0x8aba('0xde')]=function(_0x529ace,_0x4c9bbe){hopperUtils['createHistory'](_0x529ace)[_0x8aba('0xaa')](loggerCatch(_0x8aba('0xcf')));if(_0x4c9bbe==0x0){hopperUtils[_0x8aba('0xd0')](_0x529ace)[_0x8aba('0xaa')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype'][_0x8aba('0x14a')]=function(_0x99b923){return Promise['resolve']()[_0x8aba('0x43')](cmHopper[_0x8aba('0x145')](_0x99b923['id'],previewRecallmeReminderInterval))[_0x8aba('0x43')](function(_0x386b94){for(var _0x49166c=0x0;_0x49166c<_0x386b94[_0x8aba('0xa2')];_0x49166c++){var _0x5e4ebc=_0x386b94[_0x49166c][_0x8aba('0x147')][_0x8aba('0x4c')];if(_0x5e4ebc)io['to'](util['format']('user:%s',_0x5e4ebc))[_0x8aba('0x45')](_0x8aba('0x149'),{'hopper':_0x386b94[_0x49166c]});}})[_0x8aba('0xaa')](function(){});};Dialer['prototype'][_0x8aba('0xb7')]=function(_0x174847){var _0x998d21=this;return function(){_0x998d21[_0x8aba('0x158')](_0x174847);};};Dialer[_0x8aba('0x8e')]['actionOriginate']=function(_0x3c474f,_0x151c7b){var _0x315093=this;var _0x349e25=uuid['v4']();this[_0x8aba('0x23')][_0x349e25]=new Action(_0x3c474f,_0x151c7b,_0x349e25);return new Promise(function(_0x5aedc9,_0x3c578d){if(_['isUndefined'](_0x3c474f)&&typeof _0x3c474f!=='object'){return _0x3c578d(msgResponse('originate',_0x8aba('0x9b'),_0x8aba('0x159')));}if(_['isUndefined'](_0x151c7b[_0x8aba('0x15a')])||_0x151c7b[_0x8aba('0x15a')]===null){return _0x3c578d(msgResponse(_0x8aba('0x15b'),_0x8aba('0x9b'),'contact\x20is\x20undefine'));}var _0xc73b15={'XMD-CALLERID':_0x315093['actions'][_0x349e25][_0x8aba('0x15c')](),'XMD-AGI':_0x3c474f['dialQueueProject']?util[_0x8aba('0x4a')](_0x8aba('0x15d'),ipAgi,_0x3c474f[_0x8aba('0x133')]):_0x8aba('0x15e'),'XMD-AGIAFTER':_0x3c474f[_0x8aba('0xcc')]?util[_0x8aba('0x4a')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3c474f[_0x8aba('0xcc')]):_0x8aba('0x15e'),'XMD-QUEUE':utils[_0x8aba('0x15f')](_0x3c474f)?util[_0x8aba('0x4a')]('\x22%s,%s%s,,,%s\x22',_0x3c474f[_0x8aba('0x4c')],_0x3c474f[_0x8aba('0x160')]||'',_0x3c474f['dialAgiAfterHangupAgent']?'c':'',_0x3c474f[_0x8aba('0xd3')]||0x3):_0x8aba('0x15e'),'XMD-CONTACTID':_0x151c7b['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x315093[_0x8aba('0x23')][_0x349e25]['getCaller'](),'XMD-AMD':_0x3c474f['dialAMDActive']?_0x8aba('0x13d'):'NONE','XMD-DESTINATION':'xcally-motion-dialer'};if(_0x3c474f['dialAMDActive']){_0xc73b15[_0x8aba('0x161')]=_0x3c474f[_0x8aba('0x162')]||0x9c4;_0xc73b15[_0x8aba('0x163')]=_0x3c474f['dialAMDGreeting']||0x5dc;_0xc73b15[_0x8aba('0x164')]=_0x3c474f[_0x8aba('0x165')]||0x320;_0xc73b15[_0x8aba('0x166')]=_0x3c474f[_0x8aba('0x167')]||0x1388;_0xc73b15[_0x8aba('0x168')]=_0x3c474f[_0x8aba('0x169')]||0x64;_0xc73b15[_0x8aba('0x16a')]=_0x3c474f['dialAMDBetweenWordsSilence']||0x32;_0xc73b15['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x3c474f[_0x8aba('0x16b')]||0x3;_0xc73b15[_0x8aba('0x16c')]=_0x3c474f[_0x8aba('0x16d')]||0x100;_0xc73b15[_0x8aba('0x16e')]=_0x3c474f[_0x8aba('0x16f')]||0x1388;}if(utils[_0x8aba('0x15f')](_0x3c474f)){_0xc73b15[_0x8aba('0x170')]=_0x151c7b['VoiceQueueId'];}else{_0xc73b15['XMD-CAMPAIGNID']=_0x151c7b[_0x8aba('0xf1')];}var _0x3f1dc8=utils[_0x8aba('0x171')](_0x151c7b[_0x8aba('0x172')]);Object[_0x8aba('0x173')](_0xc73b15,_0x3f1dc8);var _0x2ea4fa=_0x315093['isTrunkReachable'](_0x3c474f[_0x8aba('0x93')])?utils[_0x8aba('0x174')](_0x3c474f[_0x8aba('0x93')][_0x8aba('0x175')],_0x3c474f['dialOriginateCallerIdName'],_0x3c474f[_0x8aba('0x176')]>0x0?utils[_0x8aba('0x177')](_0x3c474f[_0x8aba('0x178')],_0x3c474f[_0x8aba('0x176')]):_0x3c474f[_0x8aba('0x178')]):utils['getCallerId'](_[_0x8aba('0xfa')](_0x3c474f[_0x8aba('0x94')])?_0x3c474f[_0x8aba('0x93')]['callerid']:_0x3c474f[_0x8aba('0x94')][_0x8aba('0x175')],_0x3c474f['dialOriginateCallerIdName'],_0x3c474f[_0x8aba('0x176')]>0x0?utils[_0x8aba('0x177')](_0x3c474f[_0x8aba('0x178')],_0x3c474f[_0x8aba('0x176')]):_0x3c474f[_0x8aba('0x178')]);if(_0x2ea4fa){_0xc73b15[_0x8aba('0x179')]=_0x315093[_0x8aba('0x23')][_0x349e25]['originatecalleridname']=utils[_0x8aba('0x17a')](_0x2ea4fa);_0xc73b15['XMD-ORIGINATECALLERIDNUM']=_0x151c7b['phone'];}_0x3c474f[_0x8aba('0x17b')]=_0xc73b15;return ami[_0x8aba('0xa4')]({'actionid':_0x349e25,'action':_0x8aba('0x15b'),'channel':_0x315093[_0x8aba('0x8f')](_0x3c474f['Trunk'])?util['format'](_0x8aba('0x17c'),_0x3c474f[_0x8aba('0x93')][_0x8aba('0x4c')],isNotNull(_0x3c474f[_0x8aba('0x17d')])?_0x3c474f['dialPrefix'][_0x8aba('0x17e')]()||'':'',_0x3c474f[_0x8aba('0x17f')]>0x0?_0x151c7b[_0x8aba('0x15a')]['substring'](_0x3c474f['dialCutDigit']):_0x151c7b[_0x8aba('0x15a')]):util['format'](_0x8aba('0x17c'),_['isNil'](_0x3c474f[_0x8aba('0x94')])?_0x3c474f[_0x8aba('0x93')][_0x8aba('0x4c')]:_0x3c474f[_0x8aba('0x94')][_0x8aba('0x4c')],isNotNull(_0x3c474f[_0x8aba('0x17d')])?_0x3c474f[_0x8aba('0x17d')][_0x8aba('0x17e')]()||'':'',_0x3c474f[_0x8aba('0x17f')]>0x0?_0x151c7b[_0x8aba('0x15a')][_0x8aba('0x180')](_0x3c474f[_0x8aba('0x17f')]):_0x151c7b[_0x8aba('0x15a')]),'callerid':_0x2ea4fa,'Exten':_0x8aba('0x111'),'Context':_0x8aba('0x181'),'Priority':'1','variable':_0xc73b15,'timeout':(_0x3c474f[_0x8aba('0x182')]||0x1e)*0x3e8,'async':!![],'channelid':_0x349e25})['then'](function(_0x4d1cc2){return _0x5aedc9(_0x4d1cc2);})[_0x8aba('0xaa')](function(_0x256cef){_0x3c474f['outboundOriginateFailureCallsDay']+=0x1;var _0x525d33=new History(_0x315093['actions'][_0x349e25]);logger['error'](util[_0x8aba('0x4a')]('[originateError]:\x20%s',JSON[_0x8aba('0xb0')](_0x256cef)));_0x525d33[_0x8aba('0x78')]=0xe;_0x525d33[_0x8aba('0xd6')]='OriginateError';_0x525d33['starttime']=moment()[_0x8aba('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');_0x525d33[_0x8aba('0xe1')]=_0x525d33[_0x8aba('0x79')];hopperUtils['createHistory'](_0x525d33)[_0x8aba('0xaa')](loggerCatch('[originate][error]'));_0x315093[_0x8aba('0xd0')](_0x525d33)['catch'](loggerCatch(_0x8aba('0x183')))[_0x8aba('0x104')](function(){delete _0x315093[_0x8aba('0x23')][_0x349e25];return _0x3c578d(msgResponse(_0x8aba('0x15b'),_0x8aba('0x8d'),_0x8aba('0x184')));});});});};Dialer[_0x8aba('0x8e')]['checkRetriveMax']=function(_0x544b3c,_0x44d776,_0x5923af){var _0x2991fb=new History(_0x44d776);if(_0x2991fb[_0x8aba('0x121')]+_0x2991fb[_0x8aba('0x122')]+_0x2991fb[_0x8aba('0x123')]+_0x2991fb['countnosuchnumberretry']+_0x2991fb['countdropretry']+_0x2991fb[_0x8aba('0xea')]+_0x2991fb[_0x8aba('0x11f')]+_0x2991fb[_0x8aba('0x125')]>=_0x5923af[_0x8aba('0x126')]-0x1){return!![];}switch(_0x544b3c){case 0x3:if(_0x2991fb[_0x8aba('0x123')]>=_0x5923af[_0x8aba('0x185')]-0x1){return!![];}hopperUtils[_0x8aba('0xed')]({'active':![],'countnoanswerretry':_0x2991fb['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x8aba('0xee')](_0x5923af['dialNoAnswerRetryFrequency'],_0x8aba('0xdf'))['format'](_0x8aba('0xce')),'ContactId':_0x2991fb[_0x8aba('0xef')],'ListId':_0x2991fb['ListId'],'VoiceQueueId':_0x2991fb['VoiceQueueId']||undefined,'CampaignId':_0x2991fb['CampaignId']||undefined})['catch'](loggerCatch(_0x8aba('0x186')));break;case 0x5:if(_0x2991fb['countbusyretry']>=_0x5923af[_0x8aba('0x187')]-0x1){return!![];}hopperUtils[_0x8aba('0xed')]({'active':![],'countbusyretry':_0x2991fb[_0x8aba('0x121')]+=0x1,'scheduledat':moment()[_0x8aba('0xee')](_0x5923af[_0x8aba('0x188')],_0x8aba('0xdf'))[_0x8aba('0x4a')](_0x8aba('0xce')),'ContactId':_0x2991fb[_0x8aba('0xef')],'ListId':_0x2991fb[_0x8aba('0xf0')],'VoiceQueueId':_0x2991fb[_0x8aba('0xe0')]||undefined,'CampaignId':_0x2991fb[_0x8aba('0xf1')]||undefined})[_0x8aba('0xaa')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x2991fb['countcongestionretry']>=_0x5923af['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x8aba('0xed')]({'active':![],'countcongestionretry':_0x2991fb[_0x8aba('0x122')]+=0x1,'scheduledat':moment()[_0x8aba('0xee')](_0x5923af[_0x8aba('0x189')],_0x8aba('0xdf'))['format'](_0x8aba('0xce')),'ContactId':_0x2991fb[_0x8aba('0xef')],'ListId':_0x2991fb[_0x8aba('0xf0')],'VoiceQueueId':_0x2991fb[_0x8aba('0xe0')]||undefined,'CampaignId':_0x2991fb[_0x8aba('0xf1')]||undefined})['catch'](loggerCatch(_0x8aba('0x18a')));break;case 0x0:if(_0x2991fb[_0x8aba('0x124')]>=_0x5923af[_0x8aba('0x18b')]-0x1){return!![];}else{hopperUtils[_0x8aba('0xed')]({'active':![],'countnosuchnumberretry':_0x2991fb[_0x8aba('0x124')]+=0x1,'scheduledat':moment()['add'](_0x5923af[_0x8aba('0x18c')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2991fb[_0x8aba('0xef')],'ListId':_0x2991fb[_0x8aba('0xf0')],'VoiceQueueId':_0x2991fb[_0x8aba('0xe0')]||undefined,'CampaignId':_0x2991fb[_0x8aba('0xf1')]||undefined})['catch'](loggerCatch(_0x8aba('0x18d')));}break;case 0xa:if(_0x2991fb[_0x8aba('0xd8')]>=_0x5923af[_0x8aba('0x18e')]-0x1){return!![];}hopperUtils[_0x8aba('0xed')]({'active':![],'countdropretry':_0x2991fb[_0x8aba('0xd8')]+=0x1,'scheduledat':moment()[_0x8aba('0xee')](_0x5923af[_0x8aba('0xd9')],_0x8aba('0xdf'))[_0x8aba('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2991fb[_0x8aba('0xef')],'ListId':_0x2991fb[_0x8aba('0xf0')],'VoiceQueueId':_0x2991fb[_0x8aba('0xe0')]||undefined,'CampaignId':_0x2991fb[_0x8aba('0xf1')]||undefined})[_0x8aba('0xaa')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x2991fb[_0x8aba('0xea')]>=_0x5923af['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x2991fb[_0x8aba('0xea')]+=0x1,'scheduledat':moment()[_0x8aba('0xee')](_0x5923af[_0x8aba('0xeb')],_0x8aba('0xdf'))[_0x8aba('0x4a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2991fb[_0x8aba('0xef')],'ListId':_0x2991fb[_0x8aba('0xf0')],'VoiceQueueId':_0x2991fb[_0x8aba('0xe0')]||undefined,'CampaignId':_0x2991fb[_0x8aba('0xf1')]||undefined})['catch'](loggerCatch(_0x8aba('0x18f')));break;case 0x13:if(_0x2991fb['countmachineretry']>=_0x5923af['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x8aba('0xed')]({'active':![],'countmachineretry':_0x2991fb[_0x8aba('0x11f')]+=0x1,'scheduledat':moment()[_0x8aba('0xee')](_0x5923af[_0x8aba('0x12e')],_0x8aba('0xdf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2991fb['ContactId'],'ListId':_0x2991fb[_0x8aba('0xf0')],'VoiceQueueId':_0x2991fb['VoiceQueueId']||undefined,'CampaignId':_0x2991fb[_0x8aba('0xf1')]||undefined})[_0x8aba('0xaa')](loggerCatch(_0x8aba('0x12a')));break;case 0x14:if(_0x2991fb[_0x8aba('0x125')]>=_0x5923af[_0x8aba('0x190')]-0x1){return!![];}hopperUtils[_0x8aba('0xed')]({'active':![],'countagentrejectretry':_0x2991fb[_0x8aba('0x125')]+=0x1,'scheduledat':moment()[_0x8aba('0xee')](_0x5923af[_0x8aba('0x191')],_0x8aba('0xdf'))[_0x8aba('0x4a')](_0x8aba('0xce')),'ContactId':_0x2991fb[_0x8aba('0xef')],'ListId':_0x2991fb[_0x8aba('0xf0')],'VoiceQueueId':_0x2991fb[_0x8aba('0xe0')]||undefined,'CampaignId':_0x2991fb[_0x8aba('0xf1')]||undefined})[_0x8aba('0xaa')](loggerCatch(_0x8aba('0x192')));break;default:return!![];}};Dialer[_0x8aba('0x8e')][_0x8aba('0x193')]=function(_0x2a5ab2,_0x5c80b8,_0x36405f){var _0xbe9c63=this;var _0x2a8140=new History(_0x2a5ab2);var _0xc46859=![];var _0x4c685f;var _0x5c1dea;return new Promise(function(_0x288748,_0x58c00d){if(_[_0x8aba('0x69')](_0x5c80b8)&&typeof _0x5c80b8!==_0x8aba('0x194')){return _0x58c00d(msgResponse(_0x8aba('0x195'),_0x8aba('0x9b'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x36405f)&&typeof _0x36405f!==_0x8aba('0x194')){return _0x58c00d(msgResponse('[callProgressDetecting]','Failure',_0x8aba('0x196')));}hopperUtils['verifyAdditionalPhones'](_0x2a8140,_0x36405f[_0x8aba('0x197')],_0x5c80b8)[_0x8aba('0x43')](function(_0x568e4c){if(_0x568e4c[_0x8aba('0xdd')]==0x1)_0xc46859=!![];switch(_0x36405f[_0x8aba('0x197')]){case'0':_0x5c80b8['outboundNoSuchCallsDay']+=0x1;_0x2a8140[_0x8aba('0x78')]=0x0;_0x2a8140[_0x8aba('0xd6')]=_0x8aba('0x198');_0x2a8140[_0x8aba('0x124')]+=0x1;_0x2a8140['countglobal']+=0x1;ami['emit'](_0x8aba('0x199'),ut['buildObj'](_0x2a5ab2,_0x8aba('0x19a')));_0x4c685f=_0x5c80b8['dialNoSuchNumberRetryFrequency'];_0x5c1dea=_0x5c80b8[_0x8aba('0xda')];hopperUtils[_0x8aba('0xe4')](_0x2a8140)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xbe9c63['checkRetriveMax'](0x0,_0x2a5ab2,_0x5c80b8)&&!_0xc46859){if(_0x2a8140[_0x8aba('0x124')]>=_0x5c80b8[_0x8aba('0x18b')]){_0xbe9c63[_0x8aba('0x129')](_0x2a8140,_0x288748,_0x58c00d,_0x8aba('0x19b'));}else{_0xbe9c63[_0x8aba('0x127')](_0x2a8140,_0x288748,_0x58c00d,_0x8aba('0x19b'));}}break;case'3':_0x5c80b8[_0x8aba('0x19c')]+=0x1;_0x2a8140[_0x8aba('0x78')]=0x3;_0x2a8140[_0x8aba('0xd6')]=_0x8aba('0x19d');_0x2a8140['countnoanswerretry']+=0x1;_0x2a8140[_0x8aba('0x12d')]+=0x1;var _0x3694ec=ut['buildNoAnswerEventPayload'](_0x2a5ab2,_0x5c80b8);ami[_0x8aba('0x45')](_0x8aba('0x19e'),_0x3694ec);_0x4c685f=_0x5c80b8[_0x8aba('0x19f')];_0x5c1dea=_0x5c80b8[_0x8aba('0xda')];hopperUtils[_0x8aba('0xe4')](_0x2a8140)[_0x8aba('0xaa')](loggerCatch(_0x8aba('0x1a0')));if(_0xbe9c63['checkRetriveMax'](0x3,_0x2a5ab2,_0x5c80b8)&&!_0xc46859){if(_0x2a8140[_0x8aba('0x123')]>=_0x5c80b8[_0x8aba('0x185')]){_0xbe9c63[_0x8aba('0x129')](_0x2a8140,_0x288748,_0x58c00d,_0x8aba('0x1a1'));}else{_0xbe9c63[_0x8aba('0x127')](_0x2a8140,_0x288748,_0x58c00d,_0x8aba('0x1a1'));}}break;case'5':_0x5c80b8[_0x8aba('0x1a2')]+=0x1;_0x2a8140[_0x8aba('0x78')]=0x5;_0x2a8140[_0x8aba('0xd6')]=_0x8aba('0x1a3');_0x2a8140[_0x8aba('0x121')]+=0x1;_0x2a8140[_0x8aba('0x12d')]+=0x1;ami['emit'](_0x8aba('0x1a4'),ut[_0x8aba('0x117')](_0x2a5ab2,_0x8aba('0x1a5')));_0x4c685f=_0x5c80b8['dialBusyRetryFrequency'];_0x5c1dea=_0x5c80b8[_0x8aba('0xda')];hopperUtils[_0x8aba('0xe4')](_0x2a8140)[_0x8aba('0xaa')](loggerCatch(_0x8aba('0x1a6')));if(_0xbe9c63[_0x8aba('0x1a7')](0x5,_0x2a5ab2,_0x5c80b8)&&!_0xc46859){if(_0x2a8140[_0x8aba('0x121')]>=_0x5c80b8[_0x8aba('0x187')]){_0xbe9c63[_0x8aba('0x129')](_0x2a8140,_0x288748,_0x58c00d,_0x8aba('0x1a8'));}else{_0xbe9c63[_0x8aba('0x127')](_0x2a8140,_0x288748,_0x58c00d,_0x8aba('0x1a8'));}}break;case'8':_0x5c80b8[_0x8aba('0x1a9')]+=0x1;_0x2a8140[_0x8aba('0x78')]=0x8;_0x2a8140[_0x8aba('0xd6')]=_0x8aba('0x1aa');_0x2a8140[_0x8aba('0x122')]+=0x1;_0x2a8140[_0x8aba('0x12d')]+=0x1;_0x4c685f=_0x5c80b8[_0x8aba('0x189')];_0x5c1dea=_0x5c80b8[_0x8aba('0xda')];ami[_0x8aba('0x45')](_0x8aba('0x1ab'),ut[_0x8aba('0x117')](_0x2a5ab2,_0x8aba('0x1ac')));hopperUtils[_0x8aba('0xe4')](_0x2a8140)[_0x8aba('0xaa')](loggerCatch(_0x8aba('0x1ad')));if(_0xbe9c63[_0x8aba('0x1a7')](0x8,_0x2a5ab2,_0x5c80b8)&&!_0xc46859){if(_0x2a8140[_0x8aba('0x122')]>=_0x5c80b8[_0x8aba('0x1ae')]){_0xbe9c63[_0x8aba('0x129')](_0x2a8140,_0x288748,_0x58c00d,_0x8aba('0x1af'));}else{_0xbe9c63['stateGlobal'](_0x2a8140,_0x288748,_0x58c00d,_0x8aba('0x1af'));}}break;case'11':_0x5c80b8[_0x8aba('0x1b0')]+=0x1;_0x2a8140[_0x8aba('0x78')]=0xb;_0x2a8140[_0x8aba('0xd6')]=_0x8aba('0x1b1');_0x2a8140[_0x8aba('0xea')]+=0x1;_0x2a8140[_0x8aba('0x12d')]+=0x1;_0x4c685f=_0x5c80b8[_0x8aba('0xeb')];_0x5c1dea=_0x5c80b8['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x2a8140)['catch'](loggerCatch(_0x8aba('0xf2')));if(_0xbe9c63['checkRetriveMax'](0xb,_0x2a5ab2,_0x5c80b8)&&!_0xc46859){if(_0x2a8140['countabandonedretry']>=_0x5c80b8[_0x8aba('0xec')]){_0xbe9c63['createStateFinal'](_0x2a8140,_0x288748,_0x58c00d,_0x8aba('0x1b2'));}else{_0xbe9c63[_0x8aba('0x127')](_0x2a8140,_0x288748,_0x58c00d,_0x8aba('0x1b2'));}}break;case'20':_0x5c80b8[_0x8aba('0x1b3')]+=0x1;_0x2a8140[_0x8aba('0x78')]=0x14;_0x2a8140[_0x8aba('0xd6')]='AgentReject';_0x2a8140[_0x8aba('0x125')]+=0x1;_0x2a8140[_0x8aba('0x12d')]+=0x1;_0x4c685f=_0x5c80b8['dialAgentRejectRetryFrequency'];_0x5c1dea=_0x5c80b8[_0x8aba('0xda')];ami['emit'](_0x8aba('0x1b4'),ut['buildObj'](_0x2a5ab2,_0x8aba('0x1b5')));hopperUtils['createHistory'](_0x2a8140)['catch'](loggerCatch(_0x8aba('0x1b6')));if(_0xbe9c63['checkRetriveMax'](0x14,_0x2a5ab2,_0x5c80b8)&&!_0xc46859){if(_0x2a8140[_0x8aba('0x125')]>=_0x5c80b8[_0x8aba('0x190')]){_0xbe9c63['createStateFinal'](_0x2a8140,_0x288748,_0x58c00d,_0x8aba('0x1b7'));}else{_0xbe9c63[_0x8aba('0x127')](_0x2a8140,_0x288748,_0x58c00d,_0x8aba('0x1b7'));}}break;default:_0x5c80b8['outboundUnknownCallsDay']+=0x1;_0x2a8140[_0x8aba('0x78')]=0xc;_0x2a8140[_0x8aba('0xd6')]=_0x36405f['reason'];_0x4c685f=_0x5c80b8[_0x8aba('0x191')];_0x5c1dea=_0x5c80b8[_0x8aba('0xda')];hopperUtils[_0x8aba('0xe4')](_0x2a8140)[_0x8aba('0xaa')](loggerCatch(_0x8aba('0x1b8')));if(_0xbe9c63[_0x8aba('0x1a7')](_0x36405f[_0x8aba('0x197')],_0x2a5ab2,_0x5c80b8)&&!_0xc46859){if(_0x2a8140['countbusyretry']+_0x2a8140[_0x8aba('0x122')]+_0x2a8140['countnoanswerretry']+_0x2a8140['countnosuchnumberretry']+_0x2a8140[_0x8aba('0xd8')]+_0x2a8140['countabandonedretry']+_0x2a8140[_0x8aba('0x11f')]+_0x2a8140['countagentrejectretry']>=_0x5c80b8[_0x8aba('0x126')]){_0xbe9c63['stateGlobal'](_0x2a8140,_0x288748,_0x58c00d,_0x36405f[_0x8aba('0x197')]);}else{_0xbe9c63[_0x8aba('0x129')](_0x2a8140,_0x288748,_0x58c00d,_0x36405f[_0x8aba('0x197')]);}}}})[_0x8aba('0x43')](function(){if(_0xc46859){hopperUtils[_0x8aba('0xe6')](_0x2a8140,_0x4c685f,_0x5c1dea)['then'](function(){return _0x288748(0x1);});}});});};Dialer[_0x8aba('0x8e')][_0x8aba('0x127')]=function(_0x35390d,_0x188af0,_0xcf8ab,_0x54584b){var _0x4ce53f=new Final(_0x35390d);_0x4ce53f[_0x8aba('0x78')]=0xf;_0x4ce53f[_0x8aba('0xd6')]=_0x8aba('0x1b9');this[_0x8aba('0x129')](_0x4ce53f,_0x188af0,_0xcf8ab,_0x54584b);};Dialer[_0x8aba('0x8e')][_0x8aba('0x129')]=function(_0x25ebd0,_0x5bb854,_0x30b36c,_0xd057a1){hopperUtils[_0x8aba('0xd0')](_0x25ebd0)['then'](function(){return _0x5bb854(msgResponse(_0x8aba('0x195'),_0x8aba('0x10d'),_0xd057a1));})['catch'](function(){return _0x30b36c(msgResponse(_0x8aba('0x1ba'),_0x8aba('0x9b'),_0x8aba('0x1bb')));});};Dialer[_0x8aba('0x8e')][_0x8aba('0xa')]=function(_0x2d63c9){var _0x157ec2=_0x2d63c9[_0x8aba('0x1bc')]/0x64;var _0x435de6=_0x2d63c9[_0x8aba('0xd4')]/(_0x2d63c9[_0x8aba('0xd4')]+_0x2d63c9[_0x8aba('0xc9')]);var _0x2749ec=Math[_0x8aba('0x1bd')](_0x2d63c9[_0x8aba('0x1be')]*(_0x2d63c9[_0x8aba('0x1bf')]/0x64));var _0x1be2cf=Math[_0x8aba('0x1bd')](_0x2d63c9[_0x8aba('0x1be')]*(_0x2d63c9[_0x8aba('0x1c0')]/0x64));var _0x1d155d=_0x2d63c9[_0x8aba('0x1c1')]+_0x2d63c9['talking'];var _0x6b3951=Math[_0x8aba('0x1c2')](_0x2d63c9[_0x8aba('0x61')]*_0x2d63c9[_0x8aba('0x1c3')]*_0x2d63c9[_0x8aba('0x1c4')]*_0x2d63c9[_0x8aba('0x1c5')]);if(_[_0x8aba('0x69')](_0x2d63c9[_0x8aba('0x28')])){if(!_[_0x8aba('0x69')](_0x2d63c9['startPredictive'])){_0x2d63c9['startPredictive']=undefined;loggerPredictive[_0x8aba('0x6f')](_0x8aba('0x1c6'),_0x8aba('0x1c7'));}if(!_[_0x8aba('0x69')](_0x2d63c9[_0x8aba('0x6d')])){loggerPredictive[_0x8aba('0x6f')]('[startMethodPredictive][StartProgressive]',_0x8aba('0x1c8'));clearInterval(_0x2d63c9[_0x8aba('0x6d')]);_0x2d63c9[_0x8aba('0x6d')]=undefined;}_0x2d63c9[_0x8aba('0x28')]=moment()[_0x8aba('0x4a')](_0x8aba('0xce'));loggerPredictive[_0x8aba('0x4f')](_0x2d63c9[_0x8aba('0x4c')],_0x8aba('0x1c9'),_0x2d63c9[_0x8aba('0x28')]);this[_0x8aba('0xbb')](_0x2d63c9,0x1);}else if(ifInterval(_0x2d63c9[_0x8aba('0x1ca')],_0x2d63c9[_0x8aba('0x28')])){this['handlePower'](_0x2d63c9,0x1);loggerPredictiveCalls[_0x8aba('0x4f')](_0x8aba('0x1cb'),_0x2d63c9[_0x8aba('0x28')],_0x2d63c9['name']);_0x2d63c9[_0x8aba('0x61')]=0x0;_0x2d63c9[_0x8aba('0xd5')]=0x0;}else if(_0x157ec2<_0x435de6&&_0x2d63c9[_0x8aba('0x1cc')]==='dropRate'){clearPredictiveAttributes(_0x2d63c9);loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x1cd'),_0x8aba('0x1ce'),_0x435de6,_0x8aba('0x28'),_0x2d63c9['name']);}else if(_0x6b3951<_0x2d63c9[_0x8aba('0xd5')]&&_0x2d63c9[_0x8aba('0x1cc')]===_0x8aba('0x1cf')){clearPredictiveAttributes(_0x2d63c9);loggerPredictive[_0x8aba('0x4f')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x8aba('0x1d0'),_0x6b3951,_0x8aba('0x1d1'),_0x2d63c9[_0x8aba('0xd5')],_0x8aba('0x28'),_0x2d63c9[_0x8aba('0x4c')]);}else if(!ifInterval(_0x2d63c9['dialPredictiveInterval'],_0x2d63c9[_0x8aba('0x28')])&&_['isUndefined'](_0x2d63c9[_0x8aba('0x27')])&&!_[_0x8aba('0x69')](_0x2d63c9[_0x8aba('0x28')])){_0x2d63c9[_0x8aba('0x27')]=moment()[_0x8aba('0x4a')](_0x8aba('0xce'));loggerPredictive[_0x8aba('0x4f')](_0x2d63c9[_0x8aba('0x4c')],_0x8aba('0x1d2'),_0x2d63c9[_0x8aba('0x27')]);hopperUtils[_0x8aba('0x1d3')](_0x2d63c9[_0x8aba('0x1ca')])['then'](this['getDataPredictive'](_0x2d63c9))['then'](mergeDataErlangB(_0x2d63c9))['then'](this[_0x8aba('0x1d4')](_0x2d63c9))[_0x8aba('0xaa')](loggerCatchPredictive(_0x8aba('0x1d5'),_0x2d63c9));}else if(!ifInterval(_0x2d63c9[_0x8aba('0x1ca')],_0x2d63c9['startPredictive'])){_0x2d63c9['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2d63c9[_0x8aba('0x27')]=moment()[_0x8aba('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x8aba('0x4f')](_0x2d63c9[_0x8aba('0x4c')],_0x8aba('0x1d6'),_0x2d63c9[_0x8aba('0x27')]);clearInterval(_0x2d63c9['handlePredictive']);_0x2d63c9['handlePredictive']=undefined;hopperUtils['avgHandleTime'](_0x2d63c9['dialPredictiveInterval'])[_0x8aba('0x43')](this[_0x8aba('0x1d7')](_0x2d63c9))[_0x8aba('0x43')](mergeDataErlangB(_0x2d63c9))[_0x8aba('0x43')](this[_0x8aba('0x1d4')](_0x2d63c9))[_0x8aba('0xaa')](loggerCatchPredictive(_0x8aba('0x1d8'),_0x2d63c9));}else if(_0x2d63c9[_0x8aba('0x1be')]&&_0x1d155d<_0x2d63c9['predictiveIntervalAvailable']-_0x1be2cf){clearPredictiveAttributes(_0x2d63c9);loggerPredictive[_0x8aba('0x4f')](_0x2d63c9['name'],_0x8aba('0x1d9'),_0x1d155d,_0x8aba('0x1da'),_0x2d63c9[_0x8aba('0x1be')],'-',_0x1be2cf,'=',_0x2d63c9[_0x8aba('0x1be')]-_0x1be2cf,')');}else if(_0x2d63c9[_0x8aba('0x1be')]&&_0x1d155d>_0x2d63c9['predictiveIntervalAvailable']+_0x2749ec){clearPredictiveAttributes(_0x2d63c9);loggerPredictive[_0x8aba('0x4f')](_0x2d63c9['name'],_0x8aba('0x1d9'),_0x1d155d,_0x8aba('0x1db'),_0x2d63c9['predictiveIntervalAvailable'],'+',_0x2749ec,'=',_0x2d63c9[_0x8aba('0x1be')]+_0x2749ec,')');}};Dialer[_0x8aba('0x8e')][_0x8aba('0x1d7')]=function(_0x2b4b85){var _0x83a134=this;return function(_0x3f9096){return new Promise(function(_0x49da6f,_0x21af22){_[_0x8aba('0x68')](_0x2b4b85,_0x3f9096[0x0]);if(checkGetDataPredictive(_0x3f9096[0x0])){var _0x5c0c35=_0x2b4b85[_0x8aba('0x1be')]=_0x2b4b85[_0x8aba('0x13b')]+_0x2b4b85[_0x8aba('0x1c1')];var _0x14b0b5=_0x2b4b85[_0x8aba('0x1ca')]*0x3c;var _0x301287=_0x3f9096[0x0][_0x8aba('0x5a')]+_0x3f9096[0x0]['predictiveIntervalAvgHoldtime'];var _0x364481=(_0x3f9096[0x0][_0x8aba('0x53')]+_0x3f9096[0x0][_0x8aba('0x54')]+_0x3f9096[0x0][_0x8aba('0x56')])/_0x3f9096[0x0][_0x8aba('0x1dc')];_0x2b4b85[_0x8aba('0x1c4')]=_0x364481>0x0?_0x364481:0x1;switch(_0x2b4b85[_0x8aba('0x1cc')]){case _0x8aba('0x1cf'):var _0x4593aa=_0x2b4b85['dialPredictiveOptimizationPercentage']/0x64;return _0x83a134[_0x8aba('0x1dd')](_0x5c0c35,_0x14b0b5,_0x301287,_0x364481,_0x4593aa)['then'](function(_0x3a20c1){return _0x49da6f(_0x3a20c1);});case _0x8aba('0x1de'):var _0x2198b2=_0x2b4b85[_0x8aba('0x1bc')]/0x64;return _0x83a134[_0x8aba('0x1df')](_0x5c0c35,_0x14b0b5,_0x301287,_0x364481,_0x2198b2)['then'](function(_0xd5e36e){return _0x49da6f(_0xd5e36e);});default:return _0x21af22(msgResponse(_0x8aba('0x1e0'),_0x8aba('0x9b'),_0x8aba('0x1e1')));}}else{return _0x21af22(msgResponse(_0x8aba('0x1e0'),'Failure',_0x8aba('0x1e2')));}});};};Dialer['prototype'][_0x8aba('0x1e3')]=function(_0x32578e){var _0x1bdd36=this;return function(_0xa47a47){return new Promise(function(_0x454664,_0x400ff7){_[_0x8aba('0x68')](_0x32578e,_0xa47a47[0x0]);if(checkGetDataPredictive(_0xa47a47[0x0])){loggerPredictive[_0x8aba('0x4f')](JSON[_0x8aba('0xb0')](_0xa47a47[0x0]));if(_0x32578e[_0x8aba('0x1cc')]===_0x8aba('0x1cf')){return _0x1bdd36[_0x8aba('0x151')](_0x32578e['id'])[_0x8aba('0x43')](function(_0x5e663d){var _0xa6c528=_0x32578e['loggedIn']-_0x5e663d[0x0][_0x8aba('0x1e4')];var _0x532664=_0x32578e[_0x8aba('0x1ca')]*0x3c;var _0x72106b=_0xa47a47[0x0][_0x8aba('0x5a')]+_0xa47a47[0x0]['predictiveIntervalAvgHoldtime'];var _0xe6f8a7=(_0xa47a47[0x0]['predictiveIntervalAnsweredCalls']+_0xa47a47[0x0][_0x8aba('0x54')]+_0xa47a47[0x0][_0x8aba('0x56')])/_0xa47a47[0x0][_0x8aba('0x1dc')];var _0x487fa8=_0x32578e[_0x8aba('0x1bc')]/0x64;_0x32578e[_0x8aba('0x1e5')]=_0x5e663d[0x0][_0x8aba('0x1e4')]||0x0;_0x32578e['predictiveIntervalHitRate']=_0xe6f8a7>0x0?_0xe6f8a7:0x1;return _0x1bdd36['abandonmentRate'](_0xa6c528,_0x532664,_0x72106b,_0xe6f8a7,_0x487fa8);})['then'](function(_0x3b3d96){return _0x454664(_0x3b3d96);})[_0x8aba('0xaa')](function(_0x1a1bed){return _0x400ff7(msgResponse('[CatchErlangB]',_0x8aba('0x9b'),JSON[_0x8aba('0xb0')](_0x1a1bed)));});}if(_0x32578e[_0x8aba('0x1cc')]===_0x8aba('0x1de')){return _0x1bdd36[_0x8aba('0x151')](_0x32578e['id'])[_0x8aba('0x43')](function(_0x10c3f8){var _0x2535e4=_0x32578e[_0x8aba('0x1e6')]-_0x10c3f8[0x0][_0x8aba('0x1e4')];var _0x3db3fe=_0x32578e['dialPredictiveInterval']*0x3c;var _0x3d48cb=_0xa47a47[0x0][_0x8aba('0x5a')]+_0xa47a47[0x0]['predictiveIntervalAvgHoldtime'];var _0x1bdd59=(_0xa47a47[0x0][_0x8aba('0x53')]+_0xa47a47[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xa47a47[0x0][_0x8aba('0x56')])/_0xa47a47[0x0][_0x8aba('0x1dc')];var _0x2207b1=_0x32578e[_0x8aba('0x1bc')]/0x64;_0x32578e[_0x8aba('0x1e5')]=_0x10c3f8[0x0][_0x8aba('0x1e4')]||0x0;_0x32578e['predictiveIntervalHitRate']=_0x1bdd59>0x0?_0x1bdd59:0x1;return _0x1bdd36[_0x8aba('0x1df')](_0x2535e4,_0x3db3fe,_0x3d48cb,_0x1bdd59,_0x2207b1);})['then'](function(_0x6a1485){return _0x454664(_0x6a1485);})[_0x8aba('0xaa')](function(_0x355812){return _0x400ff7(msgResponse(_0x8aba('0x1e7'),_0x8aba('0x9b'),JSON[_0x8aba('0xb0')](_0x355812)));});}}else{return _0x400ff7(msgResponse(_0x8aba('0x1e0'),_0x8aba('0x9b'),'check\x20failure'));}});};};Dialer[_0x8aba('0x8e')][_0x8aba('0x1d4')]=function(_0x1dca84){var _0x20f9bd=this;return function(){var _0x3e681f=0x0;var _0x54c72b=Math[_0x8aba('0x1c2')](_0x1dca84[_0x8aba('0x63')]*0x3e8);if(_0x54c72b>0x0){_0x54c72b=_0x54c72b<0x64?0x64:_0x54c72b;loggerPredictive[_0x8aba('0x4f')](_0x1dca84['name'],'one\x20call\x20every:',_0x54c72b,_0x8aba('0x1e8'));_0x1dca84[_0x8aba('0x6d')]=setInterval(function(){_0x20f9bd[_0x8aba('0x6d')](_0x1dca84);loggerPredictiveCalls[_0x8aba('0x4f')](_0x8aba('0x1e9'),_0x3e681f+=0x1);},_0x54c72b);}else{loggerPredictive['info'](_0x1dca84['name'],_0x8aba('0x1ea'));}};};Dialer[_0x8aba('0x8e')][_0x8aba('0x1eb')]=function(_0x1948ff,_0x1300e8){var _0x174bc0=this;return function(_0x15bd60){if(_[_0x8aba('0x4e')](_0x15bd60)){if(_[_0x8aba('0xfa')](_0x1300e8[_0x8aba('0x1ec')])||!_0x1300e8[_0x8aba('0x1ed')]){if(_0x1948ff[_0x8aba('0xba')]===_0x8aba('0x9')){_0x1948ff[_0x8aba('0x7a')]=_[_0x8aba('0x69')](_0x1948ff[_0x8aba('0x7a')])?!![]:_0x1948ff[_0x8aba('0x7a')];var _0x49470d=uuid['v4']();_0x174bc0[_0x8aba('0x23')][_0x49470d]=new Action(_0x1948ff,_0x1300e8,_0x49470d);loggerBooked['info']('[booked][checkContactBlack]',_0x49470d,_0x8aba('0x1ee'),JSON[_0x8aba('0xb0')](_0x1948ff[_0x8aba('0x7a')]),_0x8aba('0x1ef'),_0x1948ff[_0x8aba('0x4c')]);if(_0x1948ff[_0x8aba('0x7a')]){_0x1948ff[_0x8aba('0x7a')]=![];_0x174bc0[_0x8aba('0x2a')][_0x174bc0['actions'][_0x49470d]['queue']]=[];ami[_0x8aba('0xa4')]({'actionid':_0x49470d,'action':'queuestatus','queue':_0x1948ff[_0x8aba('0x4c')]})[_0x8aba('0xaa')](function(){_0x174bc0['updateOriginated'](_0x1948ff);hopperUtils[_0x8aba('0xed')]({'active':![],'ContactId':_0x174bc0['actions'][_0x49470d]['ContactId'],'ListId':_0x174bc0[_0x8aba('0x23')][_0x49470d][_0x8aba('0xf0')],'VoiceQueueId':_0x174bc0[_0x8aba('0x23')][_0x49470d][_0x8aba('0xe0')]||undefined,'CampaignId':_0x174bc0[_0x8aba('0x23')][_0x49470d][_0x8aba('0xf1')]||undefined})[_0x8aba('0xaa')](loggerCatch(_0x8aba('0x1f0')));delete _0x174bc0[_0x8aba('0x23')][_0x49470d];});}else{loggerBooked[_0x8aba('0x4f')](_0x8aba('0x1f1'),JSON[_0x8aba('0xb0')](_0x1948ff[_0x8aba('0x7a')]),_0x8aba('0x1ef'),_0x1948ff[_0x8aba('0x4c')]);_0x174bc0['updateOriginated'](_0x1948ff);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x174bc0['actions'][_0x49470d]['ContactId'],'ListId':_0x174bc0[_0x8aba('0x23')][_0x49470d][_0x8aba('0xf0')],'VoiceQueueId':_0x174bc0[_0x8aba('0x23')][_0x49470d][_0x8aba('0xe0')]||undefined,'CampaignId':_0x174bc0[_0x8aba('0x23')][_0x49470d][_0x8aba('0xf1')]||undefined})['catch'](loggerCatch(_0x8aba('0x1f0')));delete _0x174bc0[_0x8aba('0x23')][_0x49470d];}}else{return _0x174bc0[_0x8aba('0x1f2')](_0x1948ff,_0x1300e8);}}else{if(utils[_0x8aba('0x6a')](undefined,_0x1300e8[_0x8aba('0x1f3')])<_0x1948ff[_0x8aba('0x1f4')]*0x3c){if(_0x1300e8[_0x8aba('0x147')]&&!_0x1300e8['Agent'][_0x8aba('0x1f5')]){_0x174bc0[_0x8aba('0x1e')]['run'](_0x1300e8['id'])[_0x8aba('0x104')](function(){_0x174bc0['updateOriginated'](_0x1948ff);});}else{hopperUtils['unlockContact']({'active':![]},_0x1300e8['id'],0x1)[_0x8aba('0x104')](function(){_0x174bc0[_0x8aba('0xc7')](_0x1948ff);});}}else{_0x1948ff[_0x8aba('0x1f6')]+=0x1;_0x174bc0[_0x8aba('0xc7')](_0x1948ff);if(_0x1948ff[_0x8aba('0x1f7')]){hopperUtils[_0x8aba('0xed')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1300e8[_0x8aba('0xef')],'ListId':_0x1300e8[_0x8aba('0xf0')],'VoiceQueueId':_0x1300e8[_0x8aba('0xe0')]||undefined,'CampaignId':_0x1300e8['CampaignId']||undefined})[_0x8aba('0xaa')](loggerCatch(_0x8aba('0x1f8')));hopperUtils['createHistory'](createObjHistory(_0x1948ff,_0x1300e8,utils['CAMPAIGN_STATUS'][_0x8aba('0x1f9')],0x17,_0x8aba('0x1fa')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x174bc0[_0x8aba('0x119')](createObjHistory(_0x1948ff,_0x1300e8,utils[_0x8aba('0x73')][_0x8aba('0x1fb')],0x16,'RecallFailedTimeout'),_0x8aba('0x1fc'),_0x8aba('0x1fd'));}}}}else{_0x1948ff['outboundBlacklistCallsDay']+=0x1;_0x174bc0[_0x8aba('0x119')](createObjHistory(_0x1948ff,_0x1300e8,utils['CAMPAIGN_STATUS'][_0x8aba('0x1fe')],0xd,_0x8aba('0x1ff')),_0x8aba('0x200'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x8aba('0x8e')][_0x8aba('0x158')]=function(_0xf0ec09){var _0x12384a=this;var _0x320cb6=_0xf0ec09['limitCalls']-_0xf0ec09['originated'];emitCampaignSummary(_0xf0ec09);if(_0x320cb6>0x0&&_0xf0ec09[_0x8aba('0x71')]==0x0){if(_0x320cb6>this['maxNumberOriginate']){_0x320cb6=this[_0x8aba('0x201')];}_0xf0ec09[_0x8aba('0x71')]=0x1;hopperUtils[_0x8aba('0x202')](_0xf0ec09,_0x320cb6)[_0x8aba('0x43')](function(_0x2e3d8d){_0xf0ec09[_0x8aba('0x71')]=0x0;if(_0x2e3d8d){if(!utils[_0x8aba('0x203')](_0x2e3d8d)){_0xf0ec09[_0x8aba('0x75')]=utils[_0x8aba('0x73')][_0x8aba('0x76')];logger[_0x8aba('0x4f')]('[getContactCampaign2][Empty]'+_0xf0ec09[_0x8aba('0x4c')]);}else{_0xf0ec09[_0x8aba('0x87')]+=_0x2e3d8d[_0x8aba('0xa2')];_0xf0ec09['message']=utils[_0x8aba('0x73')]['RUNNING'];for(var _0x1ad8a3=0x0;_0x1ad8a3<_0x2e3d8d['length'];_0x1ad8a3+=0x1){_0xf0ec09[_0x8aba('0x204')]+=0x1;if(_['isNil'](_0x2e3d8d[_0x1ad8a3])||_['isNil'](_0x2e3d8d[_0x1ad8a3][_0x8aba('0x172')])||_[_0x8aba('0xfa')](_0x2e3d8d[_0x1ad8a3]['phone'])){_0x12384a[_0x8aba('0x205')]('[actionOriginate]\x20',_0xf0ec09,_0x2e3d8d[_0x1ad8a3]);}else{hopperUtils[_0x8aba('0x206')](_['pick'](_0x2e3d8d[_0x1ad8a3],[_0x8aba('0xf1'),_0x8aba('0x15a')]))[_0x8aba('0x43')](_0x12384a['checkContactBlack'](_0xf0ec09,_0x2e3d8d[_0x1ad8a3]))[_0x8aba('0xaa')](_0x12384a[_0x8aba('0x154')](_0x8aba('0x207'),_0xf0ec09));}}}}})[_0x8aba('0xaa')](loggerGetContactDialer(_0x8aba('0x208'),_0xf0ec09,_0x320cb6));}};Dialer[_0x8aba('0x8e')][_0x8aba('0xbb')]=function(_0x270a31,_0x96b785){var _0x3251d1=this;var _0x130141=[];if(_0x96b785<0x1||_0x270a31['dialMethod']==='booked'){_0x96b785=0x1;}var _0x5a6891=Math[_0x8aba('0x1c2')](_0x270a31['available']*_0x96b785)-_0x270a31[_0x8aba('0x87')];if(_0x270a31[_0x8aba('0x209')]>0x0){var _0x520d4b=_0x270a31[_0x8aba('0x209')]-_0x270a31['originated']-_0x270a31[_0x8aba('0x13b')]-_0x270a31[_0x8aba('0x13c')];if(_0x5a6891>_0x520d4b){_0x5a6891=_0x520d4b;}}if(_0x5a6891>0x0&&_0x270a31[_0x8aba('0x71')]==0x0){if(_0x270a31[_0x8aba('0xba')]==='booked'){_0x5a6891=0x1;}if(_0x5a6891>this[_0x8aba('0x201')]){_0x5a6891=this[_0x8aba('0x201')];}for(var _0x374428 in this[_0x8aba('0x20')]){if(typeof this[_0x8aba('0x20')][_0x374428]!=='undefined'){if(this[_0x8aba('0x20')][_0x374428][_0x8aba('0x78')]===_0x8aba('0x20a')&&this[_0x8aba('0x20')][_0x374428]['status']===_0x8aba('0x144')){_0x130141[_0x8aba('0xa3')](this[_0x8aba('0x20')][_0x374428]['id']);}}}_0x270a31[_0x8aba('0x71')]=0x1;hopperUtils[_0x8aba('0x20b')](_0x270a31,_0x130141,_0x5a6891)['then'](function(_0x5018a7){_0x270a31[_0x8aba('0x71')]=0x0;if(_0x5018a7){if(!utils['checkContactEmpty'](_0x5018a7)){hopperUtils[_0x8aba('0x20c')](_0x270a31)[_0x8aba('0x43')](sendMessageReschedule(_0x270a31))[_0x8aba('0xaa')](loggerCatch('[countReScheduled]\x20'));}else{_0x270a31['originated']+=_0x5018a7[_0x8aba('0xa2')];_0x270a31['message']=_0x270a31[_0x8aba('0xba')]===_0x8aba('0x9')?utils['CAMPAIGN_STATUS'][_0x8aba('0x13d')]:utils[_0x8aba('0x73')][_0x8aba('0x20d')];for(var _0x55a124=0x0;_0x55a124<_0x5018a7[_0x8aba('0xa2')];_0x55a124+=0x1){if(_[_0x8aba('0xfa')](_0x5018a7[_0x55a124])||_['isNil'](_0x5018a7[_0x55a124]['Contact'])||_[_0x8aba('0xfa')](_0x5018a7[_0x55a124][_0x8aba('0x15a')])){_0x3251d1[_0x8aba('0x205')]('[actionOriginate]\x20',_0x270a31,_0x5018a7[_0x55a124]);}else{hopperUtils['checkIsBlackList'](_[_0x8aba('0x7d')](_0x5018a7[_0x55a124],[_0x8aba('0xe0'),_0x8aba('0x15a')]))[_0x8aba('0x43')](_0x3251d1[_0x8aba('0x1eb')](_0x270a31,_0x5018a7[_0x55a124]))[_0x8aba('0xaa')](_0x3251d1['loggerHandler'](_0x8aba('0x20e'),_0x270a31));}}}}})[_0x8aba('0xaa')](loggerGetContactDialer(_0x8aba('0x20f'),_0x270a31,_0x5a6891));}};Dialer[_0x8aba('0x8e')][_0x8aba('0x6d')]=function(_0x2a4fdb){if(_0x2a4fdb['dialLimitQueue']>0x0){var _0x271055=_0x2a4fdb[_0x8aba('0x209')]-_0x2a4fdb[_0x8aba('0x87')]-_0x2a4fdb['talking'];if(_0x271055>0x0&&_0x2a4fdb['temp']==0x0){this['tryOriginatePredictive'](_0x2a4fdb);}else{loggerPredictiveCalls['info'](_0x8aba('0x210'));}}else{this[_0x8aba('0x211')](_0x2a4fdb);}};Dialer[_0x8aba('0x8e')][_0x8aba('0x211')]=function(_0x437e11){var _0x516a46=this;var _0x43d049=[];_0x437e11['originated']+=0x1;for(var _0x17eb9c in this[_0x8aba('0x20')]){if(typeof this[_0x8aba('0x20')][_0x17eb9c]!==_0x8aba('0xb4')){if(this[_0x8aba('0x20')][_0x17eb9c][_0x8aba('0x78')]===_0x8aba('0x20a')&&this['agents'][_0x17eb9c][_0x8aba('0x92')]==='reachable'){_0x43d049[_0x8aba('0xa3')](this['agents'][_0x17eb9c]['id']);}}}_0x437e11[_0x8aba('0x71')]=0x1;return this[_0x8aba('0x20b')](_0x437e11['id'],_0x43d049,0x1,_0x437e11[_0x8aba('0x212')],_0x437e11)['then'](function(_0x32ca05){_0x437e11[_0x8aba('0x71')]=0x1;if(_0x32ca05){if(!utils['checkContactEmpty'](_0x32ca05)){utils[_0x8aba('0x70')](_0x437e11,0x1,0x0);return hopperUtils[_0x8aba('0x20c')](_0x437e11)['then'](sendMessageReschedule(_0x437e11))[_0x8aba('0xaa')](loggerCatch('[countReScheduled]\x20'));}else{_0x437e11[_0x8aba('0x75')]=utils[_0x8aba('0x73')]['RUNNING'];if(_[_0x8aba('0xfa')](_0x32ca05[0x0])||_[_0x8aba('0xfa')](_0x32ca05[0x0][_0x8aba('0x172')])||_[_0x8aba('0xfa')](_0x32ca05[0x0]['phone'])){_0x516a46[_0x8aba('0x205')](_0x8aba('0x20e'),_0x437e11,_0x32ca05[0x0]);}else{return hopperUtils[_0x8aba('0x213')](_[_0x8aba('0x7d')](_0x32ca05[0x0],[_0x8aba('0xe0'),_0x8aba('0x15a')]))[_0x8aba('0x43')](_0x516a46['checkContactBlack'](_0x437e11,_0x32ca05[0x0]))[_0x8aba('0xaa')](_0x516a46[_0x8aba('0x154')](_0x8aba('0x214'),_0x437e11));}}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x437e11,0x1));};Dialer['prototype'][_0x8aba('0x1dd')]=function(_0x5e3ceb,_0x4bf985,_0x500436,_0x509a6f,_0x29c054,_0x2f34b0){loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x215'));loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x216'),_0x5e3ceb);loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x217'),_0x4bf985);loggerPredictive['info'](_0x8aba('0x218'),_0x500436);loggerPredictive[_0x8aba('0x4f')]('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',_0x509a6f);loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x219'),_0x29c054);loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x67'));return new Promise(function(_0xa82920,_0x5591c3){if(_0x5e3ceb<=0x0||isNaN(_0x5e3ceb)){return _0x5591c3(msgResponse(_0x8aba('0x21a'),_0x8aba('0x8d'),_0x8aba('0x21b')+_0x5e3ceb));}if(_0x500436<=0x0||isNaN(_0x500436)){return _0x5591c3(msgResponse(_0x8aba('0x21a'),_0x8aba('0x8d'),_0x8aba('0x21c')+_0x500436));}if(_0x509a6f<=0x0||isNaN(_0x509a6f)){return _0x5591c3(msgResponse(_0x8aba('0x21a'),_0x8aba('0x8d'),'p\x20=\x20'+_0x509a6f));}if(_0x4bf985<=0x0||isNaN(_0x4bf985)){return _0x5591c3(msgResponse(_0x8aba('0x21a'),_0x8aba('0x8d'),_0x8aba('0x21d')+_0x4bf985));}if(_0x29c054<=0x0||isNaN(_0x29c054)){return _0x5591c3(msgResponse('[abandonmentRate]','Error',_0x8aba('0x21e')+_0x29c054));}_0x2f34b0=_0x2f34b0||0x0;var _0x3fff24=0x1/_0x500436;var _0x2e852a=0x0;var _0x4a630a=0x0;var _0x2c99b3=0x0;var _0x3ab05c=0x0;for(var _0x1e9a56=0x0;_0x2c99b3<_0x29c054;_0x1e9a56+=0x1){_0x4a630a=_0x1e9a56/_0x4bf985;_0x2e852a=(_0x509a6f*_0x4a630a+_0x2f34b0)/_0x3fff24;_0x2c99b3=utils[_0x8aba('0x21f')](_0x2e852a,_0x5e3ceb);_0x3ab05c=_0x2e852a/_0x5e3ceb*(0x1-utils[_0x8aba('0x21f')](_0x2e852a,_0x5e3ceb));}return _0xa82920({'erlangCalls':_0x1e9a56,'erlangCallToSecond':_0x4bf985/_0x1e9a56,'erlangAbandonmentRate':_0x2c99b3,'erlangBusyFactor':_0x3ab05c});});};Dialer[_0x8aba('0x8e')][_0x8aba('0x1df')]=function(_0x3f05d8,_0x28fe07,_0x14c34a,_0x55ca10,_0x52aef,_0x4377d2){loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x220'));loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x216'),_0x3f05d8);loggerPredictive[_0x8aba('0x4f')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x28fe07);loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x218'),_0x14c34a);loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x221'),_0x55ca10);loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x222'),_0x52aef);loggerPredictive[_0x8aba('0x4f')](_0x8aba('0x67'));return new Promise(function(_0x24078c,_0x49a649){if(_0x3f05d8<=0x0||isNaN(_0x3f05d8)){return _0x49a649(msgResponse('[busyFactor]','Error',_0x8aba('0x21b')+_0x3f05d8));}if(_0x14c34a<=0x0||isNaN(_0x14c34a)){return _0x49a649(msgResponse('[busyFactor]',_0x8aba('0x8d'),_0x8aba('0x21c')+_0x14c34a));}if(_0x55ca10<=0x0||isNaN(_0x55ca10)){return _0x49a649(msgResponse(_0x8aba('0x223'),_0x8aba('0x8d'),_0x8aba('0x224')+_0x55ca10));}if(_0x28fe07<=0x0||isNaN(_0x28fe07)){return _0x49a649(msgResponse(_0x8aba('0x223'),'Error',_0x8aba('0x21d')+_0x28fe07));}if(_0x52aef<=0x0||isNaN(_0x52aef)){return _0x49a649(msgResponse('[busyFactor]',_0x8aba('0x8d'),'Umin\x20=\x20'+_0x52aef));}_0x4377d2=_0x4377d2||0x0;var _0x3d7501=0x1/_0x14c34a;var _0x63edb7=0x0;var _0x365263=0x0;var _0x82e1f4=0x0;var _0x16278a=0x0;for(var _0x11982c=0x0;_0x16278a<_0x52aef;_0x11982c+=0x1){_0x365263=_0x11982c/_0x28fe07;_0x63edb7=(_0x55ca10*_0x365263+_0x4377d2)/_0x3d7501;_0x82e1f4=utils[_0x8aba('0x21f')](_0x63edb7,_0x3f05d8);_0x16278a=_0x63edb7/_0x3f05d8*(0x1-utils[_0x8aba('0x21f')](_0x63edb7,_0x3f05d8));}return _0x24078c({'erlangCalls':_0x11982c,'erlangCallToSecond':_0x28fe07/_0x11982c,'erlangAbandonmentRate':_0x82e1f4,'erlangBusyFactor':_0x16278a});});};module[_0x8aba('0x225')]=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 b51f374..f866169 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 _0x2f37=['util','isNil','string','uniqueid','name','Contact','firstName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','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>','voiceQueue','dialCutDigit','substring','prototype','getQueue'];(function(_0x58bd81,_0x47675d){var _0x251f0e=function(_0x46e0f8){while(--_0x46e0f8){_0x58bd81['push'](_0x58bd81['shift']());}};_0x251f0e(++_0x47675d);}(_0x2f37,0x87));var _0x72f3=function(_0x22aa42,_0x2dd15c){_0x22aa42=_0x22aa42-0x0;var _0x2a8efb=_0x2f37[_0x22aa42];return _0x2a8efb;};'use strict';var util=require(_0x72f3('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x34e3db,_0x442ef9,_0xec3a13){var _0x134f10='';if(!_[_0x72f3('0x1')](_0x442ef9)&&_0x72f3('0x2')===typeof _0x442ef9){_0x134f10+=_0x442ef9;}if(!_[_0x72f3('0x1')](_0xec3a13)&&'string'===typeof _0xec3a13){_0x134f10+='\x20'+_0xec3a13;}if(_0x134f10!==''){return _0x134f10;}return _0x34e3db;}function Action(_0x40c433,_0x4770e1,_0x3cc020){this['voiceQueue']=_0x40c433;this[_0x72f3('0x3')]=_0x3cc020||undefined;this[_0x72f3('0x4')]=checkNameSurname(_0x4770e1[_0x72f3('0x5')]['phone'],_0x4770e1['Contact'][_0x72f3('0x6')],_0x4770e1[_0x72f3('0x5')]['lastName']);this[_0x72f3('0x7')]=_0x4770e1[_0x72f3('0x8')];this[_0x72f3('0x9')]=_0x40c433[_0x72f3('0x4')];this[_0x72f3('0xa')]=_0x4770e1[_0x72f3('0xa')]||![];this[_0x72f3('0xb')]=_0x40c433[_0x72f3('0xb')];this[_0x72f3('0xc')]=_0x40c433[_0x72f3('0xc')]||0x3;this[_0x72f3('0xd')]=_0x4770e1['scheduledat'];this['countbusyretry']=_0x4770e1[_0x72f3('0xe')];this[_0x72f3('0xf')]=_0x4770e1[_0x72f3('0xf')];this[_0x72f3('0x10')]=_0x4770e1[_0x72f3('0x10')];this[_0x72f3('0x11')]=_0x4770e1[_0x72f3('0x11')];this[_0x72f3('0x12')]=_0x4770e1[_0x72f3('0x12')];this[_0x72f3('0x13')]=_0x4770e1[_0x72f3('0x13')];this[_0x72f3('0x14')]=_0x4770e1[_0x72f3('0x14')];this[_0x72f3('0x15')]=_0x4770e1[_0x72f3('0x15')];this[_0x72f3('0x16')]=_0x4770e1[_0x72f3('0x16')];this[_0x72f3('0x17')]=_0x4770e1['ListId'];this[_0x72f3('0x18')]=_0x4770e1[_0x72f3('0x18')];this[_0x72f3('0x19')]=_0x4770e1[_0x72f3('0x19')];this[_0x72f3('0x1a')]=_0x4770e1[_0x72f3('0x1a')];this[_0x72f3('0x1b')]=_0x4770e1['id'];this[_0x72f3('0x1c')]=_0x4770e1[_0x72f3('0x5')]['firstName']||'';this[_0x72f3('0x1d')]=moment()[_0x72f3('0x1e')](_0x72f3('0x1f'));this[_0x72f3('0x20')]=_0x4770e1[_0x72f3('0x20')];this[_0x72f3('0x21')]=_0x4770e1['callbackuniqueid'];this[_0x72f3('0x22')]=_0x4770e1['callbackat'];this[_0x72f3('0x23')]=_0x4770e1[_0x72f3('0x23')];this[_0x72f3('0x24')]='';this[_0x72f3('0x25')]='';}Action['prototype'][_0x72f3('0x26')]=function(){return util[_0x72f3('0x1e')](_0x72f3('0x27'),this[_0x72f3('0x4')],this[_0x72f3('0x28')][_0x72f3('0x29')]>0x0?this[_0x72f3('0x7')][_0x72f3('0x2a')](this[_0x72f3('0x28')][_0x72f3('0x29')]):this['number']);};Action[_0x72f3('0x2b')][_0x72f3('0x2c')]=function(){return this[_0x72f3('0x9')];};module['exports']=Action; \ No newline at end of file +var _0xca67=['Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','idHopper','ContactFirstName','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','lodash','moment','isNil','string','voiceQueue','name'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0xca67,0x7b));var _0x7ca6=function(_0xaf2bab,_0xff48ad){_0xaf2bab=_0xaf2bab-0x0;var _0x232eee=_0xca67[_0xaf2bab];return _0x232eee;};'use strict';var util=require('util');var _=require(_0x7ca6('0x0'));var moment=require(_0x7ca6('0x1'));function checkNameSurname(_0x421f6d,_0x45ad46,_0x31800e){var _0x545158='';if(!_[_0x7ca6('0x2')](_0x45ad46)&&_0x7ca6('0x3')===typeof _0x45ad46){_0x545158+=_0x45ad46;}if(!_[_0x7ca6('0x2')](_0x31800e)&&_0x7ca6('0x3')===typeof _0x31800e){_0x545158+='\x20'+_0x31800e;}if(_0x545158!==''){return _0x545158;}return _0x421f6d;}function Action(_0x131a33,_0x4c4115,_0x54ce18){this[_0x7ca6('0x4')]=_0x131a33;this['uniqueid']=_0x54ce18||undefined;this[_0x7ca6('0x5')]=checkNameSurname(_0x4c4115[_0x7ca6('0x6')]['phone'],_0x4c4115[_0x7ca6('0x6')][_0x7ca6('0x7')],_0x4c4115[_0x7ca6('0x6')][_0x7ca6('0x8')]);this[_0x7ca6('0x9')]=_0x4c4115[_0x7ca6('0xa')];this[_0x7ca6('0xb')]=_0x131a33['name'];this[_0x7ca6('0xc')]=_0x4c4115[_0x7ca6('0xc')]||![];this[_0x7ca6('0xd')]=_0x131a33['type'];this[_0x7ca6('0xe')]=_0x131a33['dialQueueTimeout']||0x3;this[_0x7ca6('0xf')]=_0x4c4115[_0x7ca6('0xf')];this[_0x7ca6('0x10')]=_0x4c4115[_0x7ca6('0x10')];this[_0x7ca6('0x11')]=_0x4c4115[_0x7ca6('0x11')];this[_0x7ca6('0x12')]=_0x4c4115[_0x7ca6('0x12')];this['countnosuchnumberretry']=_0x4c4115[_0x7ca6('0x13')];this[_0x7ca6('0x14')]=_0x4c4115[_0x7ca6('0x14')];this[_0x7ca6('0x15')]=_0x4c4115[_0x7ca6('0x15')];this[_0x7ca6('0x16')]=_0x4c4115[_0x7ca6('0x16')];this[_0x7ca6('0x17')]=_0x4c4115[_0x7ca6('0x17')];this[_0x7ca6('0x18')]=_0x4c4115[_0x7ca6('0x18')];this['ListId']=_0x4c4115[_0x7ca6('0x19')];this[_0x7ca6('0x1a')]=_0x4c4115[_0x7ca6('0x1a')];this['VoiceQueueId']=_0x4c4115['VoiceQueueId'];this['CampaignId']=_0x4c4115[_0x7ca6('0x1b')];this[_0x7ca6('0x1c')]=_0x4c4115['id'];this[_0x7ca6('0x1d')]=_0x4c4115[_0x7ca6('0x6')][_0x7ca6('0x7')]||'';this['starttime']=moment()[_0x7ca6('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7ca6('0x1f')]=_0x4c4115[_0x7ca6('0x1f')];this['callbackuniqueid']=_0x4c4115[_0x7ca6('0x20')];this[_0x7ca6('0x21')]=_0x4c4115[_0x7ca6('0x21')];this[_0x7ca6('0x22')]=_0x4c4115[_0x7ca6('0x22')];this[_0x7ca6('0x23')]='';this[_0x7ca6('0x24')]='';}Action[_0x7ca6('0x25')]['getCaller']=function(){return util[_0x7ca6('0x1e')](_0x7ca6('0x26'),this[_0x7ca6('0x5')],this[_0x7ca6('0x4')][_0x7ca6('0x27')]>0x0?this[_0x7ca6('0x9')][_0x7ca6('0x28')](this['voiceQueue'][_0x7ca6('0x27')]):this[_0x7ca6('0x9')]);};Action[_0x7ca6('0x25')][_0x7ca6('0x29')]=function(){return this[_0x7ca6('0xb')];};module[_0x7ca6('0x2a')]=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 cdde824..d423abe 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 _0x2558=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','starttime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat'];(function(_0x3bef79,_0x5b843b){var _0x1b2b20=function(_0x5ac9d9){while(--_0x5ac9d9){_0x3bef79['push'](_0x3bef79['shift']());}};_0x1b2b20(++_0x5b843b);}(_0x2558,0x1a1));var _0x8255=function(_0x2bda6f,_0x2ac96c){_0x2bda6f=_0x2bda6f-0x0;var _0x139a57=_0x2558[_0x2bda6f];return _0x139a57;};'use strict';var moment=require(_0x8255('0x0'));var utils=require(_0x8255('0x1'));function AgentComplete(_0x3d9dab,_0x553b96){this[_0x8255('0x2')]=0x4;this[_0x8255('0x3')]=_0x8255('0x4');this[_0x8255('0x5')]=_0x3d9dab[_0x8255('0x5')];this[_0x8255('0x6')]=_0x3d9dab['type'];this[_0x8255('0x7')]=_0x3d9dab[_0x8255('0x6')]===_0x8255('0x8')?_0x8255('0x9'):_0x3d9dab[_0x8255('0x6')];this[_0x8255('0xa')]=_0x3d9dab[_0x8255('0xa')];this[_0x8255('0xb')]=_0x3d9dab['countcongestionretry'];this[_0x8255('0xc')]=_0x3d9dab[_0x8255('0xc')];this[_0x8255('0xd')]=_0x3d9dab['countbusyretry']+_0x3d9dab['countcongestionretry']+_0x3d9dab[_0x8255('0xc')]+_0x3d9dab[_0x8255('0xe')]+_0x3d9dab['countdropretry']+_0x3d9dab[_0x8255('0xf')]+_0x3d9dab[_0x8255('0x10')]+_0x3d9dab[_0x8255('0x11')];this['countnosuchnumberretry']=_0x3d9dab['countnosuchnumberretry'];this[_0x8255('0x12')]=_0x3d9dab[_0x8255('0x12')];this[_0x8255('0xf')]=_0x3d9dab[_0x8255('0xf')];this[_0x8255('0x10')]=_0x3d9dab['countmachineretry'];this['countagentrejectretry']=_0x3d9dab[_0x8255('0x11')];this[_0x8255('0x13')]=_0x553b96['uniqueid'];this[_0x8255('0x14')]=_0x3d9dab[_0x8255('0x15')];this[_0x8255('0x16')]=_0x3d9dab['number'];this['starttime']=_0x3d9dab[_0x8255('0x17')];this['responsetime']=_0x3d9dab['responsetime'];this['answertime']=_0x3d9dab[_0x8255('0x18')];this[_0x8255('0x19')]=moment()[_0x8255('0x1a')](_0x8255('0x1b'));this[_0x8255('0x1c')]=utils['getSeconds'](_0x3d9dab[_0x8255('0x1d')],_0x3d9dab['starttime']);this[_0x8255('0x1e')]=utils[_0x8255('0x1f')](_0x3d9dab[_0x8255('0x18')],_0x3d9dab['responsetime']);this[_0x8255('0x20')]=utils[_0x8255('0x1f')](this[_0x8255('0x19')],_0x3d9dab[_0x8255('0x18')]);this[_0x8255('0x9')]=_0x553b96[_0x8255('0x9')];this[_0x8255('0x21')]=_0x553b96[_0x8255('0x21')];this[_0x8255('0x22')]=_0x553b96[_0x8255('0x22')];this[_0x8255('0x23')]=_0x3d9dab[_0x8255('0x23')];this[_0x8255('0x24')]=_0x3d9dab[_0x8255('0x24')];this[_0x8255('0x25')]=_0x3d9dab[_0x8255('0x25')];this['recallme']=_0x3d9dab['recallme'];this[_0x8255('0x26')]=_0x3d9dab['ContactId'];this[_0x8255('0x27')]=_0x3d9dab[_0x8255('0x27')];this[_0x8255('0x28')]=_0x3d9dab[_0x8255('0x28')];this[_0x8255('0x29')]=_0x3d9dab[_0x8255('0x29')];this[_0x8255('0x2a')]=_0x3d9dab[_0x8255('0x2a')];this[_0x8255('0x2b')]=_0x3d9dab[_0x8255('0x2b')]||'';this[_0x8255('0x2c')]=_0x3d9dab[_0x8255('0x2c')]||'';this['agiafterat']=_0x3d9dab[_0x8255('0x2d')];}module[_0x8255('0x2e')]=AgentComplete; \ No newline at end of file +var _0x4950=['answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','starttime','responsetime'];(function(_0x25c128,_0x39ca54){var _0x23ce84=function(_0x312e82){while(--_0x312e82){_0x25c128['push'](_0x25c128['shift']());}};_0x23ce84(++_0x39ca54);}(_0x4950,0x14b));var _0x0495=function(_0x446b5c,_0xa7a790){_0x446b5c=_0x446b5c-0x0;var _0x23c75a=_0x4950[_0x446b5c];return _0x23c75a;};'use strict';var moment=require(_0x0495('0x0'));var utils=require(_0x0495('0x1'));function AgentComplete(_0xc073c8,_0x470160){this[_0x0495('0x2')]=0x4;this[_0x0495('0x3')]='Answer';this['scheduledat']=_0xc073c8['scheduledat'];this[_0x0495('0x4')]=_0xc073c8['type'];this[_0x0495('0x5')]=_0xc073c8['type']===_0x0495('0x6')?_0x0495('0x7'):_0xc073c8[_0x0495('0x4')];this[_0x0495('0x8')]=_0xc073c8[_0x0495('0x8')];this['countcongestionretry']=_0xc073c8['countcongestionretry'];this['countnoanswerretry']=_0xc073c8[_0x0495('0x9')];this[_0x0495('0xa')]=_0xc073c8[_0x0495('0x8')]+_0xc073c8['countcongestionretry']+_0xc073c8['countnoanswerretry']+_0xc073c8['countnosuchnumberretry']+_0xc073c8[_0x0495('0xb')]+_0xc073c8[_0x0495('0xc')]+_0xc073c8[_0x0495('0xd')]+_0xc073c8[_0x0495('0xe')];this[_0x0495('0xf')]=_0xc073c8[_0x0495('0xf')];this[_0x0495('0xb')]=_0xc073c8[_0x0495('0xb')];this[_0x0495('0xc')]=_0xc073c8['countabandonedretry'];this[_0x0495('0xd')]=_0xc073c8[_0x0495('0xd')];this[_0x0495('0xe')]=_0xc073c8[_0x0495('0xe')];this[_0x0495('0x10')]=_0x470160[_0x0495('0x10')];this[_0x0495('0x11')]=_0xc073c8[_0x0495('0x12')];this['calleridnum']=_0xc073c8['number'];this[_0x0495('0x13')]=_0xc073c8[_0x0495('0x13')];this['responsetime']=_0xc073c8[_0x0495('0x14')];this[_0x0495('0x15')]=_0xc073c8['answertime'];this[_0x0495('0x16')]=moment()[_0x0495('0x17')](_0x0495('0x18'));this[_0x0495('0x19')]=utils[_0x0495('0x1a')](_0xc073c8['responsetime'],_0xc073c8[_0x0495('0x13')]);this[_0x0495('0x1b')]=utils['getSeconds'](_0xc073c8[_0x0495('0x15')],_0xc073c8[_0x0495('0x14')]);this[_0x0495('0x1c')]=utils[_0x0495('0x1a')](this[_0x0495('0x16')],_0xc073c8[_0x0495('0x15')]);this[_0x0495('0x7')]=_0x470160[_0x0495('0x7')];this['membername']=_0x470160[_0x0495('0x1d')];this[_0x0495('0x1e')]=_0x470160[_0x0495('0x1e')];this['callback']=_0xc073c8[_0x0495('0x1f')];this[_0x0495('0x20')]=_0xc073c8[_0x0495('0x20')];this['callbackat']=_0xc073c8[_0x0495('0x21')];this[_0x0495('0x22')]=_0xc073c8[_0x0495('0x22')];this[_0x0495('0x23')]=_0xc073c8[_0x0495('0x23')];this['ListId']=_0xc073c8[_0x0495('0x24')];this['UserId']=_0xc073c8[_0x0495('0x25')];this[_0x0495('0x26')]=_0xc073c8['VoiceQueueId'];this['CampaignId']=_0xc073c8[_0x0495('0x27')];this[_0x0495('0x28')]=_0xc073c8[_0x0495('0x28')]||'';this[_0x0495('0x29')]=_0xc073c8[_0x0495('0x29')]||'';this[_0x0495('0x2a')]=_0xc073c8['agiafterat'];}module[_0x0495('0x2b')]=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 3c2a2c9..3e409ef 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 _0x2957=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','campaigntype','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId'];(function(_0x931081,_0x351467){var _0x5bf54d=function(_0x2bf2ca){while(--_0x2bf2ca){_0x931081['push'](_0x931081['shift']());}};_0x5bf54d(++_0x351467);}(_0x2957,0x1a7));var _0x7295=function(_0xd75802,_0x2145af){_0xd75802=_0xd75802-0x0;var _0x4bdfc5=_0x2957[_0xd75802];return _0x4bdfc5;};'use strict';function Final(_0x456522){this['uniqueid']=_0x456522[_0x7295('0x0')];this[_0x7295('0x1')]=_0x456522['scheduledat'];this['type']=_0x456522['type'];this[_0x7295('0x2')]=_0x456522['type']==='outbound'?_0x7295('0x3'):_0x456522[_0x7295('0x4')];this[_0x7295('0x5')]=_0x456522[_0x7295('0x5')];this[_0x7295('0x6')]=_0x456522[_0x7295('0x6')];this[_0x7295('0x7')]=_0x456522['countnoanswerretry'];this['countglobal']=_0x456522['countbusyretry']+_0x456522[_0x7295('0x6')]+_0x456522[_0x7295('0x7')]+_0x456522[_0x7295('0x8')]+_0x456522[_0x7295('0x9')]+_0x456522[_0x7295('0xa')]+_0x456522['countmachineretry']+_0x456522[_0x7295('0xb')];this[_0x7295('0x8')]=_0x456522[_0x7295('0x8')];this[_0x7295('0x9')]=_0x456522[_0x7295('0x9')];this['countabandonedretry']=_0x456522['countabandonedretry'];this[_0x7295('0xc')]=_0x456522[_0x7295('0xc')];this['countagentrejectretry']=_0x456522[_0x7295('0xb')];this[_0x7295('0x3')]=_0x456522[_0x7295('0x3')];this['calleridname']=_0x456522[_0x7295('0xd')];this['calleridnum']=_0x456522['calleridnum'];this[_0x7295('0xe')]=_0x456522['starttime'];this[_0x7295('0xf')]=_0x456522[_0x7295('0xf')];this['endtime']=_0x456522[_0x7295('0xf')];this[_0x7295('0x10')]=_0x456522[_0x7295('0x10')]||0x0;this[_0x7295('0x11')]=_0x456522[_0x7295('0x11')]||0x0;this[_0x7295('0x12')]=_0x456522['talktime']||0x0;this[_0x7295('0x13')]=_0x456522['callback'];this[_0x7295('0x14')]=_0x456522[_0x7295('0x14')];this[_0x7295('0x15')]=_0x456522[_0x7295('0x15')];this[_0x7295('0x16')]=_0x456522[_0x7295('0x16')];this['ContactId']=_0x456522['ContactId'];this[_0x7295('0x17')]=_0x456522[_0x7295('0x17')];this[_0x7295('0x18')]=_0x456522[_0x7295('0x18')];this[_0x7295('0x19')]=_0x456522[_0x7295('0x19')];this[_0x7295('0x1a')]=_0x456522['CampaignId'];this[_0x7295('0x1b')]=_0x456522['originatecalleridnum']||'';this[_0x7295('0x1c')]=_0x456522['originatecalleridname']||'';this[_0x7295('0x1d')]=_0x456522[_0x7295('0x1d')];this[_0x7295('0x1e')]=_0x456522[_0x7295('0x1e')];}module[_0x7295('0x1f')]=Final; \ No newline at end of file +var _0xfa91=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat'];(function(_0x1624f5,_0xa2f147){var _0x23b431=function(_0x5393d4){while(--_0x5393d4){_0x1624f5['push'](_0x1624f5['shift']());}};_0x23b431(++_0xa2f147);}(_0xfa91,0xb9));var _0x1fa9=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xfa91[_0x13e741];return _0x3f8bb3;};'use strict';function Final(_0x55bc09){this['uniqueid']=_0x55bc09[_0x1fa9('0x0')];this['scheduledat']=_0x55bc09[_0x1fa9('0x1')];this[_0x1fa9('0x2')]=_0x55bc09[_0x1fa9('0x2')];this[_0x1fa9('0x3')]=_0x55bc09[_0x1fa9('0x2')]===_0x1fa9('0x4')?_0x1fa9('0x5'):_0x55bc09[_0x1fa9('0x2')];this[_0x1fa9('0x6')]=_0x55bc09[_0x1fa9('0x6')];this[_0x1fa9('0x7')]=_0x55bc09[_0x1fa9('0x7')];this[_0x1fa9('0x8')]=_0x55bc09[_0x1fa9('0x8')];this[_0x1fa9('0x9')]=_0x55bc09['countbusyretry']+_0x55bc09[_0x1fa9('0x7')]+_0x55bc09['countnoanswerretry']+_0x55bc09[_0x1fa9('0xa')]+_0x55bc09[_0x1fa9('0xb')]+_0x55bc09['countabandonedretry']+_0x55bc09['countmachineretry']+_0x55bc09[_0x1fa9('0xc')];this[_0x1fa9('0xa')]=_0x55bc09[_0x1fa9('0xa')];this[_0x1fa9('0xb')]=_0x55bc09[_0x1fa9('0xb')];this['countabandonedretry']=_0x55bc09['countabandonedretry'];this[_0x1fa9('0xd')]=_0x55bc09[_0x1fa9('0xd')];this['countagentrejectretry']=_0x55bc09['countagentrejectretry'];this[_0x1fa9('0x5')]=_0x55bc09[_0x1fa9('0x5')];this[_0x1fa9('0xe')]=_0x55bc09['calleridname'];this[_0x1fa9('0xf')]=_0x55bc09[_0x1fa9('0xf')];this[_0x1fa9('0x10')]=_0x55bc09[_0x1fa9('0x10')];this[_0x1fa9('0x11')]=_0x55bc09[_0x1fa9('0x11')];this[_0x1fa9('0x12')]=_0x55bc09['responsetime'];this[_0x1fa9('0x13')]=_0x55bc09['ringtime']||0x0;this[_0x1fa9('0x14')]=_0x55bc09[_0x1fa9('0x14')]||0x0;this[_0x1fa9('0x15')]=_0x55bc09['talktime']||0x0;this[_0x1fa9('0x16')]=_0x55bc09['callback'];this[_0x1fa9('0x17')]=_0x55bc09[_0x1fa9('0x17')];this[_0x1fa9('0x18')]=_0x55bc09[_0x1fa9('0x18')];this[_0x1fa9('0x19')]=_0x55bc09['recallme'];this[_0x1fa9('0x1a')]=_0x55bc09[_0x1fa9('0x1a')];this[_0x1fa9('0x1b')]=_0x55bc09[_0x1fa9('0x1b')];this['UserId']=_0x55bc09[_0x1fa9('0x1c')];this[_0x1fa9('0x1d')]=_0x55bc09['VoiceQueueId'];this[_0x1fa9('0x1e')]=_0x55bc09[_0x1fa9('0x1e')];this[_0x1fa9('0x1f')]=_0x55bc09[_0x1fa9('0x1f')]||'';this[_0x1fa9('0x20')]=_0x55bc09[_0x1fa9('0x20')]||'';this['state']=_0x55bc09['state'];this[_0x1fa9('0x21')]=_0x55bc09['statedesc'];}module[_0x1fa9('0x22')]=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 c251fc4..e355490 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 _0x71b7=['moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','talktime','getSeconds','queue','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports'];(function(_0x4ca3b4,_0x2450bc){var _0x51ea64=function(_0x1bdfd4){while(--_0x1bdfd4){_0x4ca3b4['push'](_0x4ca3b4['shift']());}};_0x51ea64(++_0x2450bc);}(_0x71b7,0x130));var _0x771b=function(_0x4cacfc,_0x56dfe0){_0x4cacfc=_0x4cacfc-0x0;var _0xffb88c=_0x71b7[_0x4cacfc];return _0xffb88c;};'use strict';var moment=require(_0x771b('0x0'));var utils=require('../utils');function Hangup(_0x4c2029,_0xad9958){this[_0x771b('0x1')]=0x4;this[_0x771b('0x2')]=_0x771b('0x3');this[_0x771b('0x4')]=_0x4c2029[_0x771b('0x4')];this[_0x771b('0x5')]=_0x4c2029[_0x771b('0x5')];this[_0x771b('0x6')]=_0x4c2029[_0x771b('0x5')]===_0x771b('0x7')?'queue':_0x4c2029[_0x771b('0x5')];this[_0x771b('0x8')]=_0x4c2029[_0x771b('0x8')]||![];this[_0x771b('0x9')]=_0x4c2029[_0x771b('0x9')];this[_0x771b('0xa')]=_0x4c2029['countcongestionretry'];this[_0x771b('0xb')]=_0x4c2029[_0x771b('0xb')];this['countglobal']=_0x4c2029['countbusyretry']+_0x4c2029['countcongestionretry']+_0x4c2029[_0x771b('0xb')]+_0x4c2029[_0x771b('0xc')]+_0x4c2029[_0x771b('0xd')]+_0x4c2029[_0x771b('0xe')]+_0x4c2029['countmachineretry']+_0x4c2029['countagentrejectretry'];this[_0x771b('0xc')]=_0x4c2029['countnosuchnumberretry'];this['countdropretry']=_0x4c2029[_0x771b('0xd')];this[_0x771b('0xe')]=_0x4c2029[_0x771b('0xe')];this['countmachineretry']=_0x4c2029['countmachineretry'];this[_0x771b('0xf')]=_0x4c2029[_0x771b('0xf')];this['uniqueid']=_0xad9958[_0x771b('0x10')];this['calleridname']=_0x4c2029[_0x771b('0x11')];this[_0x771b('0x12')]=_0x4c2029[_0x771b('0x13')];this[_0x771b('0x14')]=_0x4c2029[_0x771b('0x14')];this[_0x771b('0x15')]=_0x4c2029['responsetime'];this[_0x771b('0x16')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils['getSeconds'](_0x4c2029[_0x771b('0x15')],_0x4c2029[_0x771b('0x14')]);this['holdtime']=0x0;this[_0x771b('0x17')]=utils[_0x771b('0x18')](this[_0x771b('0x16')],_0x4c2029[_0x771b('0x15')]);this['queue']=_0x4c2029[_0x771b('0x19')];this[_0x771b('0x1a')]=_0x771b('0x1b');this[_0x771b('0x1c')]=_0xad9958['cause-txt'];this[_0x771b('0x1d')]=_0x4c2029[_0x771b('0x1d')];this[_0x771b('0x1e')]=_0x4c2029[_0x771b('0x1e')];this[_0x771b('0x1f')]=_0x4c2029[_0x771b('0x1f')];this[_0x771b('0x20')]=_0x4c2029['recallme'];this[_0x771b('0x21')]=_0x4c2029[_0x771b('0x21')];this[_0x771b('0x22')]=_0x4c2029['ListId'];this['UserId']=_0x4c2029['UserId'];this[_0x771b('0x23')]=_0x4c2029[_0x771b('0x23')];this[_0x771b('0x24')]=_0x4c2029[_0x771b('0x24')];}module[_0x771b('0x25')]=Hangup; \ No newline at end of file +var _0x958a=['uniqueid','calleridnum','starttime','endtime','format','holdtime','talktime','getSeconds','responsetime','membername','IVR','reason','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','statedesc','Answer','scheduledat','type','campaigntype','queue','amd','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countmachineretry'];(function(_0x1b50aa,_0x39929c){var _0x15aacc=function(_0x129d86){while(--_0x129d86){_0x1b50aa['push'](_0x1b50aa['shift']());}};_0x15aacc(++_0x39929c);}(_0x958a,0x192));var _0xa958=function(_0x5e4e3b,_0x558b40){_0x5e4e3b=_0x5e4e3b-0x0;var _0x55f848=_0x958a[_0x5e4e3b];return _0x55f848;};'use strict';var moment=require('moment');var utils=require(_0xa958('0x0'));function Hangup(_0x5f158e,_0x47c760){this['state']=0x4;this[_0xa958('0x1')]=_0xa958('0x2');this[_0xa958('0x3')]=_0x5f158e['scheduledat'];this[_0xa958('0x4')]=_0x5f158e[_0xa958('0x4')];this[_0xa958('0x5')]=_0x5f158e[_0xa958('0x4')]==='outbound'?_0xa958('0x6'):_0x5f158e[_0xa958('0x4')];this[_0xa958('0x7')]=_0x5f158e['amd']||![];this['countbusyretry']=_0x5f158e[_0xa958('0x8')];this[_0xa958('0x9')]=_0x5f158e[_0xa958('0x9')];this['countnoanswerretry']=_0x5f158e['countnoanswerretry'];this[_0xa958('0xa')]=_0x5f158e['countbusyretry']+_0x5f158e['countcongestionretry']+_0x5f158e[_0xa958('0xb')]+_0x5f158e[_0xa958('0xc')]+_0x5f158e['countdropretry']+_0x5f158e[_0xa958('0xd')]+_0x5f158e['countmachineretry']+_0x5f158e[_0xa958('0xe')];this[_0xa958('0xc')]=_0x5f158e[_0xa958('0xc')];this['countdropretry']=_0x5f158e['countdropretry'];this[_0xa958('0xd')]=_0x5f158e[_0xa958('0xd')];this[_0xa958('0xf')]=_0x5f158e[_0xa958('0xf')];this[_0xa958('0xe')]=_0x5f158e[_0xa958('0xe')];this['uniqueid']=_0x47c760[_0xa958('0x10')];this['calleridname']=_0x5f158e['name'];this[_0xa958('0x11')]=_0x5f158e['number'];this[_0xa958('0x12')]=_0x5f158e[_0xa958('0x12')];this['responsetime']=_0x5f158e['responsetime'];this[_0xa958('0x13')]=moment()[_0xa958('0x14')]('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils['getSeconds'](_0x5f158e['responsetime'],_0x5f158e[_0xa958('0x12')]);this[_0xa958('0x15')]=0x0;this[_0xa958('0x16')]=utils[_0xa958('0x17')](this[_0xa958('0x13')],_0x5f158e[_0xa958('0x18')]);this[_0xa958('0x6')]=_0x5f158e[_0xa958('0x6')];this[_0xa958('0x19')]=_0xa958('0x1a');this[_0xa958('0x1b')]=_0x47c760[_0xa958('0x1c')];this[_0xa958('0x1d')]=_0x5f158e[_0xa958('0x1d')];this['callbackuniqueid']=_0x5f158e['callbackuniqueid'];this[_0xa958('0x1e')]=_0x5f158e[_0xa958('0x1e')];this[_0xa958('0x1f')]=_0x5f158e[_0xa958('0x1f')];this[_0xa958('0x20')]=_0x5f158e[_0xa958('0x20')];this[_0xa958('0x21')]=_0x5f158e['ListId'];this[_0xa958('0x22')]=_0x5f158e[_0xa958('0x22')];this[_0xa958('0x23')]=_0x5f158e[_0xa958('0x23')];this['CampaignId']=_0x5f158e[_0xa958('0x24')];}module[_0xa958('0x25')]=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 5e86355..19c6590 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 _0x46fa=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','name','calleridnum','starttime','responsetime','ringtime','getSeconds','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0xe77e80,_0x40bb60){var _0x56cf8b=function(_0x40b442){while(--_0x40b442){_0xe77e80['push'](_0xe77e80['shift']());}};_0x56cf8b(++_0x40bb60);}(_0x46fa,0x75));var _0xa46f=function(_0x1cd332,_0x4759bd){_0x1cd332=_0x1cd332-0x0;var _0x262483=_0x46fa[_0x1cd332];return _0x262483;};'use strict';var utils=require(_0xa46f('0x0'));function History(_0x3c1978){this[_0xa46f('0x1')]=_0x3c1978['uniqueid'];this[_0xa46f('0x2')]=_0x3c1978[_0xa46f('0x2')]||undefined;this[_0xa46f('0x3')]=_0x3c1978[_0xa46f('0x3')];this[_0xa46f('0x4')]=_0x3c1978['type']===_0xa46f('0x5')?'queue':_0x3c1978[_0xa46f('0x3')];this[_0xa46f('0x6')]=_0x3c1978[_0xa46f('0x6')];this[_0xa46f('0x7')]=_0x3c1978[_0xa46f('0x7')];this['countnoanswerretry']=_0x3c1978[_0xa46f('0x8')];this[_0xa46f('0x9')]=_0x3c1978['countbusyretry']+_0x3c1978[_0xa46f('0x7')]+_0x3c1978[_0xa46f('0x8')]+_0x3c1978[_0xa46f('0xa')]+_0x3c1978['countdropretry']+_0x3c1978[_0xa46f('0xb')]+_0x3c1978[_0xa46f('0xc')]+_0x3c1978[_0xa46f('0xd')];this[_0xa46f('0xa')]=_0x3c1978[_0xa46f('0xa')];this[_0xa46f('0xe')]=_0x3c1978[_0xa46f('0xe')];this['countabandonedretry']=_0x3c1978[_0xa46f('0xb')];this[_0xa46f('0xc')]=_0x3c1978[_0xa46f('0xc')];this['countagentrejectretry']=_0x3c1978[_0xa46f('0xd')];this[_0xa46f('0xf')]=_0x3c1978[_0xa46f('0xf')];this[_0xa46f('0x10')]=_0x3c1978[_0xa46f('0x11')];this[_0xa46f('0x12')]=_0x3c1978['number'];this[_0xa46f('0x13')]=_0x3c1978['starttime'];this[_0xa46f('0x14')]=_0x3c1978['responsetime'];this['endtime']=_0x3c1978[_0xa46f('0x14')];this[_0xa46f('0x15')]=utils[_0xa46f('0x16')](_0x3c1978[_0xa46f('0x14')],_0x3c1978['starttime']);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x3c1978[_0xa46f('0x17')];this['callbackuniqueid']=_0x3c1978[_0xa46f('0x18')];this[_0xa46f('0x19')]=_0x3c1978['callbackat'];this[_0xa46f('0x1a')]=_0x3c1978[_0xa46f('0x1a')];this[_0xa46f('0x1b')]=_0x3c1978[_0xa46f('0x1b')];this[_0xa46f('0x1c')]=_0x3c1978['ListId'];this[_0xa46f('0x1d')]=_0x3c1978[_0xa46f('0x1d')];this['VoiceQueueId']=_0x3c1978[_0xa46f('0x1e')];this[_0xa46f('0x1f')]=_0x3c1978['CampaignId'];this[_0xa46f('0x20')]=_0x3c1978[_0xa46f('0x20')]||'';this[_0xa46f('0x21')]=_0x3c1978[_0xa46f('0x21')]||'';this[_0xa46f('0x22')]=_0x3c1978[_0xa46f('0x22')];this[_0xa46f('0x23')]=_0x3c1978[_0xa46f('0x23')];}module[_0xa46f('0x24')]=History; \ No newline at end of file +var _0xe41e=['callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','name','number','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callback'];(function(_0xd04139,_0x47094a){var _0x2afb4a=function(_0x4ecce5){while(--_0x4ecce5){_0xd04139['push'](_0xd04139['shift']());}};_0x2afb4a(++_0x47094a);}(_0xe41e,0x100));var _0xee41=function(_0x5e38a2,_0x7c5033){_0x5e38a2=_0x5e38a2-0x0;var _0x950422=_0xe41e[_0x5e38a2];return _0x950422;};'use strict';var utils=require('../utils');function History(_0xe0de4a){this[_0xee41('0x0')]=_0xe0de4a['uniqueid'];this[_0xee41('0x1')]=_0xe0de4a[_0xee41('0x1')]||undefined;this[_0xee41('0x2')]=_0xe0de4a[_0xee41('0x2')];this[_0xee41('0x3')]=_0xe0de4a[_0xee41('0x2')]===_0xee41('0x4')?'queue':_0xe0de4a[_0xee41('0x2')];this[_0xee41('0x5')]=_0xe0de4a[_0xee41('0x5')];this['countcongestionretry']=_0xe0de4a[_0xee41('0x6')];this[_0xee41('0x7')]=_0xe0de4a[_0xee41('0x7')];this[_0xee41('0x8')]=_0xe0de4a[_0xee41('0x5')]+_0xe0de4a[_0xee41('0x6')]+_0xe0de4a['countnoanswerretry']+_0xe0de4a[_0xee41('0x9')]+_0xe0de4a[_0xee41('0xa')]+_0xe0de4a[_0xee41('0xb')]+_0xe0de4a[_0xee41('0xc')]+_0xe0de4a[_0xee41('0xd')];this[_0xee41('0x9')]=_0xe0de4a[_0xee41('0x9')];this[_0xee41('0xa')]=_0xe0de4a['countdropretry'];this[_0xee41('0xb')]=_0xe0de4a[_0xee41('0xb')];this[_0xee41('0xc')]=_0xe0de4a[_0xee41('0xc')];this[_0xee41('0xd')]=_0xe0de4a[_0xee41('0xd')];this['queue']=_0xe0de4a[_0xee41('0xe')];this['calleridname']=_0xe0de4a[_0xee41('0xf')];this['calleridnum']=_0xe0de4a[_0xee41('0x10')];this[_0xee41('0x11')]=_0xe0de4a['starttime'];this[_0xee41('0x12')]=_0xe0de4a[_0xee41('0x12')];this['endtime']=_0xe0de4a[_0xee41('0x12')];this[_0xee41('0x13')]=utils[_0xee41('0x14')](_0xe0de4a['responsetime'],_0xe0de4a[_0xee41('0x11')]);this[_0xee41('0x15')]=0x0;this[_0xee41('0x16')]=0x0;this[_0xee41('0x17')]=_0xe0de4a[_0xee41('0x17')];this[_0xee41('0x18')]=_0xe0de4a[_0xee41('0x18')];this[_0xee41('0x19')]=_0xe0de4a[_0xee41('0x19')];this[_0xee41('0x1a')]=_0xe0de4a['recallme'];this['ContactId']=_0xe0de4a['ContactId'];this[_0xee41('0x1b')]=_0xe0de4a[_0xee41('0x1b')];this['UserId']=_0xe0de4a[_0xee41('0x1c')];this[_0xee41('0x1d')]=_0xe0de4a[_0xee41('0x1d')];this[_0xee41('0x1e')]=_0xe0de4a[_0xee41('0x1e')];this[_0xee41('0x1f')]=_0xe0de4a[_0xee41('0x1f')]||'';this[_0xee41('0x20')]=_0xe0de4a[_0xee41('0x20')]||'';this[_0xee41('0x21')]=_0xe0de4a[_0xee41('0x21')];this['statedesc']=_0xe0de4a[_0xee41('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 aae6e4b..b8e39f7 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 _0xa677=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','type','outbound','queue','countbusyretry','countcongestionretry','countglobal'];(function(_0x42cf05,_0x3698a7){var _0x4ec407=function(_0x3e4e75){while(--_0x3e4e75){_0x42cf05['push'](_0x42cf05['shift']());}};_0x4ec407(++_0x3698a7);}(_0xa677,0x1f1));var _0x7a67=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0xa677[_0x564821];return _0x2b604d;};'use strict';var utils=require(_0x7a67('0x0'));function QueueCallerAbandon(_0x12a21a,_0xce093){this['scheduledat']=_0x12a21a['scheduledat'];this[_0x7a67('0x1')]=_0x12a21a[_0x7a67('0x1')];this['campaigntype']=_0x12a21a[_0x7a67('0x1')]===_0x7a67('0x2')?_0x7a67('0x3'):_0x12a21a[_0x7a67('0x1')];this[_0x7a67('0x4')]=_0x12a21a['countbusyretry'];this[_0x7a67('0x5')]=_0x12a21a[_0x7a67('0x5')];this['countnoanswerretry']=_0x12a21a['countnoanswerretry'];this[_0x7a67('0x6')]=_0x12a21a[_0x7a67('0x4')]+_0x12a21a['countcongestionretry']+_0x12a21a['countnoanswerretry']+_0x12a21a[_0x7a67('0x7')]+_0x12a21a['countdropretry']+_0x12a21a[_0x7a67('0x8')]+_0x12a21a[_0x7a67('0x9')]+_0x12a21a[_0x7a67('0xa')];this['countnosuchnumberretry']=_0x12a21a[_0x7a67('0x7')];this[_0x7a67('0xb')]=_0x12a21a[_0x7a67('0xb')];this['countabandonedretry']=_0x12a21a[_0x7a67('0x8')];this[_0x7a67('0x9')]=_0x12a21a[_0x7a67('0x9')];this['countagentrejectretry']=_0x12a21a[_0x7a67('0xa')];this[_0x7a67('0xc')]=_0xce093[_0x7a67('0xc')];this['calleridname']=_0x12a21a[_0x7a67('0xd')];this[_0x7a67('0xe')]=_0x12a21a['number'];this['starttime']=_0x12a21a[_0x7a67('0xf')];this[_0x7a67('0x10')]=_0x12a21a[_0x7a67('0x10')];this['droptime']=_0x12a21a[_0x7a67('0x11')];this[_0x7a67('0x12')]=_0x12a21a['dropreason'];this[_0x7a67('0x13')]=this[_0x7a67('0x11')];this[_0x7a67('0x14')]=utils['getSeconds'](_0x12a21a['responsetime'],_0x12a21a[_0x7a67('0xf')]);this[_0x7a67('0x15')]=utils[_0x7a67('0x16')](this[_0x7a67('0x11')],_0x12a21a[_0x7a67('0x10')]);this[_0x7a67('0x17')]=0x0;this[_0x7a67('0x3')]=_0xce093['queue'];this[_0x7a67('0x18')]=_0xce093[_0x7a67('0x19')];this[_0x7a67('0x1a')]=_0xce093[_0x7a67('0x1a')];this[_0x7a67('0x1b')]=_0x12a21a['callback'];this['callbackuniqueid']=_0x12a21a[_0x7a67('0x1c')];this[_0x7a67('0x1d')]=_0x12a21a['callbackat'];this[_0x7a67('0x1e')]=_0x12a21a[_0x7a67('0x1e')];this[_0x7a67('0x1f')]=_0x12a21a[_0x7a67('0x1f')];this[_0x7a67('0x20')]=_0x12a21a[_0x7a67('0x20')];this[_0x7a67('0x21')]=_0x12a21a[_0x7a67('0x21')];this[_0x7a67('0x22')]=_0x12a21a[_0x7a67('0x22')];this[_0x7a67('0x23')]=_0x12a21a[_0x7a67('0x23')];this['originatecalleridnum']=_0x12a21a[_0x7a67('0x24')]||'';this[_0x7a67('0x25')]=_0x12a21a[_0x7a67('0x25')]||'';this['agiafterat']=_0x12a21a[_0x7a67('0x26')];this[_0x7a67('0x27')]=_0x12a21a[_0x7a67('0x27')];this[_0x7a67('0x28')]=_0x12a21a['statedesc'];}module[_0x7a67('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x0a70=['originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0a70,0x139));var _0x00a7=function(_0x5e9914,_0xdd668f){_0x5e9914=_0x5e9914-0x0;var _0x227233=_0x0a70[_0x5e9914];return _0x227233;};'use strict';var utils=require(_0x00a7('0x0'));function QueueCallerAbandon(_0x4aeabd,_0x2c97ed){this[_0x00a7('0x1')]=_0x4aeabd['scheduledat'];this[_0x00a7('0x2')]=_0x4aeabd[_0x00a7('0x2')];this[_0x00a7('0x3')]=_0x4aeabd['type']===_0x00a7('0x4')?_0x00a7('0x5'):_0x4aeabd[_0x00a7('0x2')];this[_0x00a7('0x6')]=_0x4aeabd['countbusyretry'];this[_0x00a7('0x7')]=_0x4aeabd[_0x00a7('0x7')];this[_0x00a7('0x8')]=_0x4aeabd[_0x00a7('0x8')];this[_0x00a7('0x9')]=_0x4aeabd[_0x00a7('0x6')]+_0x4aeabd[_0x00a7('0x7')]+_0x4aeabd[_0x00a7('0x8')]+_0x4aeabd[_0x00a7('0xa')]+_0x4aeabd[_0x00a7('0xb')]+_0x4aeabd[_0x00a7('0xc')]+_0x4aeabd[_0x00a7('0xd')]+_0x4aeabd['countagentrejectretry'];this[_0x00a7('0xa')]=_0x4aeabd[_0x00a7('0xa')];this[_0x00a7('0xb')]=_0x4aeabd[_0x00a7('0xb')];this[_0x00a7('0xc')]=_0x4aeabd[_0x00a7('0xc')];this[_0x00a7('0xd')]=_0x4aeabd['countmachineretry'];this[_0x00a7('0xe')]=_0x4aeabd[_0x00a7('0xe')];this[_0x00a7('0xf')]=_0x2c97ed['uniqueid'];this['calleridname']=_0x4aeabd[_0x00a7('0x10')];this[_0x00a7('0x11')]=_0x4aeabd['number'];this[_0x00a7('0x12')]=_0x4aeabd[_0x00a7('0x12')];this['responsetime']=_0x4aeabd[_0x00a7('0x13')];this[_0x00a7('0x14')]=_0x4aeabd['droptime'];this[_0x00a7('0x15')]=_0x4aeabd['dropreason'];this[_0x00a7('0x16')]=this['droptime'];this[_0x00a7('0x17')]=utils[_0x00a7('0x18')](_0x4aeabd[_0x00a7('0x13')],_0x4aeabd[_0x00a7('0x12')]);this[_0x00a7('0x19')]=utils[_0x00a7('0x18')](this[_0x00a7('0x14')],_0x4aeabd[_0x00a7('0x13')]);this[_0x00a7('0x1a')]=0x0;this[_0x00a7('0x5')]=_0x2c97ed['queue'];this[_0x00a7('0x1b')]=_0x2c97ed[_0x00a7('0x1c')];this[_0x00a7('0x1d')]=_0x2c97ed[_0x00a7('0x1d')];this[_0x00a7('0x1e')]=_0x4aeabd['callback'];this[_0x00a7('0x1f')]=_0x4aeabd[_0x00a7('0x1f')];this[_0x00a7('0x20')]=_0x4aeabd['callbackat'];this[_0x00a7('0x21')]=_0x4aeabd[_0x00a7('0x21')];this[_0x00a7('0x22')]=_0x4aeabd[_0x00a7('0x22')];this[_0x00a7('0x23')]=_0x4aeabd['ListId'];this[_0x00a7('0x24')]=_0x4aeabd[_0x00a7('0x24')];this[_0x00a7('0x25')]=_0x4aeabd['VoiceQueueId'];this[_0x00a7('0x26')]=_0x4aeabd['CampaignId'];this[_0x00a7('0x27')]=_0x4aeabd[_0x00a7('0x27')]||'';this[_0x00a7('0x28')]=_0x4aeabd['originatecalleridname']||'';this['agiafterat']=_0x4aeabd['agiafterat'];this[_0x00a7('0x29')]=_0x4aeabd[_0x00a7('0x29')];this[_0x00a7('0x2a')]=_0x4aeabd[_0x00a7('0x2a')];}module[_0x00a7('0x2b')]=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 76da0e4..6c1437d 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 _0x2ef3=['checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','inspect','catch','temp','error','[getContactDialer]','getContactDialer','getContactDialerIvr','dialOrderByScheduledAt','[getContactDialerIvr]','countReScheduled','[countReScheduled]','[rescheduleContact]','rescheduleContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','[checkIsBlackListIvr]'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2ef3,0xba));var _0x32ef=function(_0x21e332,_0x239a2b){_0x21e332=_0x21e332-0x0;var _0x37f3de=_0x2ef3[_0x21e332];return _0x37f3de;};'use strict';var util=require(_0x32ef('0x0'));var logger=require(_0x32ef('0x1'))(_0x32ef('0x2'));var cmHopper=require(_0x32ef('0x3'));var cmHopperAdditionalPhone=require(_0x32ef('0x4'));var cmHopperBlack=require(_0x32ef('0x5'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x38f865){return util[_0x32ef('0x6')](_0x38f865,{'showHidden':![],'depth':null});}function getContactDialer(_0x524ab6,_0x402857,_0x37dd1d){return cmHopper['getContactDialer'](_0x524ab6['id'],_0x402857,_0x37dd1d,_0x524ab6['dialOrderByScheduledAt'])[_0x32ef('0x7')](function(_0x4bfcf8){_0x524ab6[_0x32ef('0x8')]=0x0;logger[_0x32ef('0x9')](_0x32ef('0xa'),inspectError(_0x4bfcf8));});}exports[_0x32ef('0xb')]=getContactDialer;function getContactDialerIvr(_0x2484a0,_0x2bbb50){return cmHopper[_0x32ef('0xc')](_0x2484a0['id'],_0x2bbb50,_0x2484a0[_0x32ef('0xd')])['catch'](function(_0x5780e9){_0x2484a0[_0x32ef('0x8')]=0x0;logger[_0x32ef('0x9')](_0x32ef('0xe'),inspectError(_0x5780e9));});}exports[_0x32ef('0xc')]=getContactDialerIvr;function countReScheduled(_0x5af651){return cmHopper[_0x32ef('0xf')](_0x5af651)['catch'](function(_0x1a5106){logger['error'](_0x32ef('0x10'),inspectError(_0x1a5106));});}exports[_0x32ef('0xf')]=countReScheduled;function rescheduleContact(_0x5c3eb9){return cmHopper['rescheduleContact'](_0x5c3eb9)[_0x32ef('0x7')](function(_0x4d8009){logger[_0x32ef('0x9')](_0x32ef('0x11'),inspectError(_0x4d8009));});}exports[_0x32ef('0x12')]=rescheduleContact;function unlockContact(_0x54c7f5,_0x57aff1,_0x55bf0b){return cmHopper['unlockContact'](_0x54c7f5,_0x57aff1,_0x55bf0b)[_0x32ef('0x7')](function(_0x3950e6){logger[_0x32ef('0x9')]('[unlockContact]',inspectError(_0x3950e6));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x1eb468){return cmHopper[_0x32ef('0x13')](_0x1eb468)[_0x32ef('0x7')](function(_0x57863c){logger[_0x32ef('0x9')](_0x32ef('0x14'),inspectError(_0x57863c));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x304505){return cmHopperBlack[_0x32ef('0x15')](_0x304505)[_0x32ef('0x7')](function(_0x251084){logger[_0x32ef('0x9')](_0x32ef('0x16'),inspectError(_0x251084));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x3c5b78){return cmHopperBlack['checkIsBlackListIvr'](_0x3c5b78)[_0x32ef('0x7')](function(_0x3a20ca){logger['error'](_0x32ef('0x17'),inspectError(_0x3a20ca));});}exports[_0x32ef('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5e8898,_0x55f7f2,_0x57f5e5){return cmHopperAdditionalPhone[_0x32ef('0x19')](_0x5e8898,_0x55f7f2,_0x57f5e5)[_0x32ef('0x7')](function(_0x225feb){logger['error']('[verifyAdditionalPhone]',inspectError(_0x225feb));});}exports[_0x32ef('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x4d584b,_0x51a412,_0x278495){return cmHopperAdditionalPhone[_0x32ef('0x1a')](_0x4d584b,_0x51a412,_0x278495)[_0x32ef('0x7')](function(_0x1dbe98){logger[_0x32ef('0x9')](_0x32ef('0x1b'),inspectError(_0x1dbe98));});}exports[_0x32ef('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x38aed5){return cmHopperHistory[_0x32ef('0x1c')](_0x38aed5)[_0x32ef('0x7')](function(_0x1335e2){logger[_0x32ef('0x9')]('[avgHandleTime]',inspectError(_0x1335e2));});}exports[_0x32ef('0x1c')]=avgHandleTime;function createHistory(_0x2f5d06){return cmHopperHistory['createHistory'](_0x2f5d06)[_0x32ef('0x7')](function(_0x3c569d){logger[_0x32ef('0x9')](_0x32ef('0x1d'),inspectError(_0x3c569d));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0x6a55=['temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','createHistory','util','../../rpc/cmHopperAdditionalPhone','getContactDialer','dialOrderByScheduledAt','catch'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x6a55,0xdb));var _0x56a5=function(_0x1c3429,_0x11d159){_0x1c3429=_0x1c3429-0x0;var _0x1609bd=_0x6a55[_0x1c3429];return _0x1609bd;};'use strict';var util=require(_0x56a5('0x0'));var logger=require('../../../../config/logger')('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x56a5('0x1'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x116199){return util['inspect'](_0x116199,{'showHidden':![],'depth':null});}function getContactDialer(_0x3ff76a,_0x5171fa,_0x28bb2b){return cmHopper[_0x56a5('0x2')](_0x3ff76a['id'],_0x5171fa,_0x28bb2b,_0x3ff76a[_0x56a5('0x3')])[_0x56a5('0x4')](function(_0x444c65){_0x3ff76a[_0x56a5('0x5')]=0x0;logger[_0x56a5('0x6')](_0x56a5('0x7'),inspectError(_0x444c65));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x1c9e7a,_0xf15490){return cmHopper[_0x56a5('0x8')](_0x1c9e7a['id'],_0xf15490,_0x1c9e7a[_0x56a5('0x3')])[_0x56a5('0x4')](function(_0x3a721d){_0x1c9e7a[_0x56a5('0x5')]=0x0;logger[_0x56a5('0x6')](_0x56a5('0x9'),inspectError(_0x3a721d));});}exports['getContactDialerIvr']=getContactDialerIvr;function countReScheduled(_0x49711d){return cmHopper[_0x56a5('0xa')](_0x49711d)[_0x56a5('0x4')](function(_0x2b9d7d){logger[_0x56a5('0x6')](_0x56a5('0xb'),inspectError(_0x2b9d7d));});}exports[_0x56a5('0xa')]=countReScheduled;function rescheduleContact(_0x4db11b){return cmHopper['rescheduleContact'](_0x4db11b)[_0x56a5('0x4')](function(_0x1e416f){logger[_0x56a5('0x6')](_0x56a5('0xc'),inspectError(_0x1e416f));});}exports[_0x56a5('0xd')]=rescheduleContact;function unlockContact(_0x2db112,_0xe3091f,_0x5c4028){return cmHopper[_0x56a5('0xe')](_0x2db112,_0xe3091f,_0x5c4028)['catch'](function(_0x41e8b6){logger['error'](_0x56a5('0xf'),inspectError(_0x41e8b6));});}exports[_0x56a5('0xe')]=unlockContact;function moveContactManagedDialer(_0x173c65){return cmHopper[_0x56a5('0x10')](_0x173c65)[_0x56a5('0x4')](function(_0x143f3d){logger[_0x56a5('0x6')]('[moveContactManagedDialer]',inspectError(_0x143f3d));});}exports[_0x56a5('0x10')]=moveContactManagedDialer;function checkIsBlackList(_0x3db687){return cmHopperBlack[_0x56a5('0x11')](_0x3db687)[_0x56a5('0x4')](function(_0x52eee2){logger[_0x56a5('0x6')](_0x56a5('0x12'),inspectError(_0x52eee2));});}exports[_0x56a5('0x11')]=checkIsBlackList;function checkIsBlackListIvr(_0x15e469){return cmHopperBlack[_0x56a5('0x13')](_0x15e469)['catch'](function(_0x55579d){logger[_0x56a5('0x6')](_0x56a5('0x14'),inspectError(_0x55579d));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x1556eb,_0x309fa5,_0x615d49){return cmHopperAdditionalPhone[_0x56a5('0x15')](_0x1556eb,_0x309fa5,_0x615d49)[_0x56a5('0x4')](function(_0x616922){logger[_0x56a5('0x6')](_0x56a5('0x16'),inspectError(_0x616922));});}exports[_0x56a5('0x15')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x2035c7,_0xcf212,_0x2f203f){return cmHopperAdditionalPhone[_0x56a5('0x17')](_0x2035c7,_0xcf212,_0x2f203f)['catch'](function(_0x5c76a7){logger[_0x56a5('0x6')](_0x56a5('0x18'),inspectError(_0x5c76a7));});}exports[_0x56a5('0x17')]=swapAdditionalPhones;function avgHandleTime(_0x43a815){return cmHopperHistory['avgHandleTime'](_0x43a815)[_0x56a5('0x4')](function(_0x54ec36){logger[_0x56a5('0x6')](_0x56a5('0x19'),inspectError(_0x54ec36));});}exports[_0x56a5('0x1a')]=avgHandleTime;function createHistory(_0x284ee5){return cmHopperHistory['createHistory'](_0x284ee5)[_0x56a5('0x4')](function(_0x1f7aeb){logger[_0x56a5('0x6')]('[createHistory]',inspectError(_0x1f7aeb));});}exports[_0x56a5('0x1b')]=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 6486243..d864209 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 _0xb677=['description','tags','updatedAt','undefined','%s%s','XMD-','lodash','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','dialMethod','preview','isPreviewCampaign','ivr','type','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','dialGlobalInterval','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','TrunkBackup','status','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','random','toString','getCallerIdRandom','error','length','checkContactEmpty','erlangb'];(function(_0x1c0e91,_0xd8625e){var _0x34322c=function(_0x5d9d51){while(--_0x5d9d51){_0x1c0e91['push'](_0x1c0e91['shift']());}};_0x34322c(++_0xd8625e);}(_0xb677,0x15e));var _0x7b67=function(_0xbc1e36,_0x43695a){_0xbc1e36=_0xbc1e36-0x0;var _0x22bb81=_0xb677[_0xbc1e36];return _0x22bb81;};'use strict';var _=require(_0x7b67('0x0'));var moment=require('moment');var util=require(_0x7b67('0x1'));var logger=require(_0x7b67('0x2'))('dialer');var timezones=require(_0x7b67('0x3'))[_0x7b67('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x7b67('0x5'),'BLACKLIST':_0x7b67('0x6'),'CONTACTS_RESCHEDULED':_0x7b67('0x7'),'DEACTIVATED':_0x7b67('0x8'),'DISACTIVED':_0x7b67('0x9'),'EMPTY_INTERVAL':_0x7b67('0xa'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x7b67('0xb'),'NO_AVAILABLE_CONTACTS':_0x7b67('0xc'),'NULL_INTERVAL':_0x7b67('0xd'),'OVERTIME_INTERVAL':_0x7b67('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0x7b67('0xf'),'QUEUE_RECALL':_0x7b67('0x10'),'RECALL_TIMEOUT':_0x7b67('0x11'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x519e1f){return _0x519e1f[_0x7b67('0x12')]===_0x7b67('0x13');}exports[_0x7b67('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x2dd500){return _0x2dd500['type']===_0x7b67('0x15');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x4bab18){return _0x4bab18[_0x7b67('0x16')]===_0x7b67('0x17');}exports[_0x7b67('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x595e60){return _0x595e60[_0x7b67('0x19')];}exports[_0x7b67('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x1020b3){return _0x1020b3[_0x7b67('0x1b')];}exports[_0x7b67('0x1c')]=isIVRCampaignActive;function getSeconds(_0x10a1cc,_0x4bf981){var _0x3b53dc=moment(_0x10a1cc)[_0x7b67('0x1d')](0x0);var _0x9319e0=moment(_0x4bf981)['milliseconds'](0x0);return _0x3b53dc[_0x7b67('0x1e')](_0x9319e0,_0x7b67('0x1f'));}exports[_0x7b67('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x5b8902,_0x890093){var _0x48114c=![];var _0x1f4fb5=_0x5b8902['dialMethod']!==_0x890093[_0x7b67('0x12')]||_0x5b8902['dialActive']!==_0x890093[_0x7b67('0x19')]||_0x5b8902['message']!==_0x890093[_0x7b67('0x21')];var _0x3c243e=_0x5b8902['available']!==_0x890093[_0x7b67('0x22')]||_0x5b8902['loggedIn']!==_0x890093[_0x7b67('0x23')]||_0x5b8902['loggedInDb']!==_0x890093[_0x7b67('0x24')]||_0x5b8902[_0x7b67('0x25')]!==_0x890093[_0x7b67('0x25')]||_0x5b8902[_0x7b67('0x26')]!==_0x890093[_0x7b67('0x26')]||_0x5b8902[_0x7b67('0x27')]!==_0x890093[_0x7b67('0x27')]||_0x5b8902[_0x7b67('0x28')]!==_0x890093['waiting']||_0x5b8902[_0x7b67('0x29')]!==_0x890093[_0x7b67('0x29')]||_0x5b8902['originated']!==_0x890093[_0x7b67('0x2a')];if(_0x5b8902[_0x7b67('0x2b')]&&_0x890093[_0x7b67('0x2b')]){_0x48114c=_0x5b8902[_0x7b67('0x2b')][_0x7b67('0x2c')]!==_0x890093[_0x7b67('0x2b')][_0x7b67('0x2c')]||_0x5b8902[_0x7b67('0x2b')]['active']!==_0x890093[_0x7b67('0x2b')][_0x7b67('0x1b')];}return _0x1f4fb5||_0x3c243e||_0x48114c;}exports[_0x7b67('0x2d')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x25d9e1){var _0xced056=null;var _0x40e3ee=_0x25d9e1[_0x7b67('0x2e')];if(_[_0x7b67('0x2f')](_0x25d9e1['dialGlobalInterval'])||_['isNil'](_0x25d9e1[_0x7b67('0x30')])||_['isNil'](_0x25d9e1[_0x7b67('0x30')][_0x7b67('0x31')])){_0xced056=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_['isEmpty'](_0x25d9e1[_0x7b67('0x32')])||_[_0x7b67('0x33')](_0x25d9e1[_0x7b67('0x30')]['Intervals'])){_0xced056=CAMPAIGN_STATUS[_0x7b67('0x34')];}else if(_0x40e3ee&&!timezones[_0x40e3ee]){_0xced056=CAMPAIGN_STATUS[_0x7b67('0x35')];}return _0xced056;}function checkAnyValidTrunk(_0x93e60b,_0x2b5101){var _0x1bcc1f=null;var _0x237a89=_0x7b67('0x36');var _0x27d1bd=['reachable',_0x7b67('0x37')];var _0x3324df=!![];if(_0x93e60b[_0x7b67('0x2b')]&&_0x93e60b[_0x7b67('0x2b')][_0x7b67('0x1b')]){_0x237a89+=_0x93e60b[_0x7b67('0x2b')][_0x7b67('0x2c')];_0x1bcc1f=_0x2b5101[_0x237a89];_0x3324df=_0x27d1bd[_0x7b67('0x38')](_0x1bcc1f['status']);}else if(_0x93e60b[_0x7b67('0x39')]&&_0x93e60b['TrunkBackup'][_0x7b67('0x1b')]){_0x237a89+=_0x93e60b[_0x7b67('0x39')][_0x7b67('0x2c')];_0x1bcc1f=_0x2b5101[_0x237a89];_0x3324df=_0x27d1bd[_0x7b67('0x38')](_0x1bcc1f[_0x7b67('0x3a')]);}return _0x3324df;}function getQueueCampaignStatusMessage(_0x454eaa,_0x215bd9){var _0x2847e4=CAMPAIGN_STATUS[_0x7b67('0x5')];var _0x4db1d7=isPreviewCampaign(_0x454eaa);if(!isQueueCampaignActive(_0x454eaa)){if(_0x4db1d7){_0x2847e4=CAMPAIGN_STATUS[_0x7b67('0x3b')];}else{if(_0x454eaa[_0x7b67('0x2a')]===0x0&&_0x454eaa[_0x7b67('0x26')]===0x0&&_0x454eaa[_0x7b67('0x28')]===0x0&&(_0x454eaa['pTalking']||0x0)===0x0){_0x2847e4=CAMPAIGN_STATUS[_0x7b67('0x3b')];}else{_0x2847e4=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x454eaa['loggedIn']===0x0){_0x2847e4=CAMPAIGN_STATUS[_0x7b67('0x3c')];}else if(!checkAnyValidTrunk(_0x454eaa,_0x215bd9)){_0x2847e4=CAMPAIGN_STATUS[_0x7b67('0x3d')];}else if(!isPreviewCampaign(_0x454eaa)){var _0x36a05c=checkAnyValidQueueCampaignInterval(_0x454eaa);if(_0x36a05c){_0x2847e4=_0x36a05c;}}return _0x2847e4;}exports[_0x7b67('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x15b8e5){var _0x1636e0=CAMPAIGN_STATUS[_0x7b67('0x3f')];if(_0x15b8e5[_0x7b67('0x2a')]===0x0&&_0x15b8e5['talking']===0x0&&_0x15b8e5[_0x7b67('0x28')]===0x0&&(_0x15b8e5[_0x7b67('0x27')]||0x0)===0x0){_0x1636e0=CAMPAIGN_STATUS[_0x7b67('0x3b')];}return _0x1636e0;}exports[_0x7b67('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x10e313){var _0x496d13=_0x10e313['match'](/"(.*?)"/);return _0x496d13?_0x496d13[0x1]:_0x10e313;}exports[_0x7b67('0x41')]=extractCalleridName;function getCallerId(_0x262b05,_0x90535a,_0x453b2f){if(!_[_0x7b67('0x42')](_0x453b2f)&&typeof _0x453b2f===_0x7b67('0x43')&&!_[_0x7b67('0x33')](_0x453b2f)){if(!_['isUndefined'](_0x90535a)&&typeof _0x90535a===_0x7b67('0x43')&&!_[_0x7b67('0x33')](_0x90535a)){return util[_0x7b67('0x44')](_0x7b67('0x45'),_0x90535a,_0x453b2f);}return util[_0x7b67('0x44')]('\x22%s\x22\x20<%s>',_0x453b2f,_0x453b2f);}if(!_[_0x7b67('0x42')](_0x262b05)&&typeof _0x262b05==='string'&&!_[_0x7b67('0x33')](_0x262b05)){return _0x262b05;}return'\x22\x22\x20<>';}exports[_0x7b67('0x46')]=getCallerId;function getCallerIdRandom(_0x371545,_0x24c5a7){var _0x1b44e3;var _0x454800;var _0x4dd57e;if(_0x24c5a7<=0x0){_0x24c5a7=0x1;}_0x1b44e3=new RegExp(_0x7b67('0x47')+_0x24c5a7+'}$');_0x454800=Math[_0x7b67('0x48')](0xa,_0x24c5a7-0x1);_0x4dd57e=Math[_0x7b67('0x48')](0xa,_0x24c5a7)-0x1;return util[_0x7b67('0x44')]('%s',_['replace'](_0x371545,_0x1b44e3,_[_0x7b67('0x49')](_0x454800,_0x4dd57e)[_0x7b67('0x4a')]()));}exports[_0x7b67('0x4b')]=getCallerIdRandom;function decrementOriginate(_0x23ae48){if(_0x23ae48[_0x7b67('0x2a')]&&_0x23ae48[_0x7b67('0x2a')]>0x0){_0x23ae48[_0x7b67('0x2a')]-=0x1;}else{logger[_0x7b67('0x4c')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x29593b){return _0x29593b&&_0x29593b[_0x7b67('0x4d')]>0x0;}exports[_0x7b67('0x4e')]=checkContactEmpty;function erlangb(_0x5ccb29,_0x1aaeea){if(_0x1aaeea===0x0){return 0x0;}var _0x1ac318=0x1;for(var _0x3501fa=0x1;_0x3501fa<=_0x1aaeea;_0x3501fa+=0x1){_0x1ac318=0x1+_0x1ac318*_0x3501fa/_0x5ccb29;}return 0x1/_0x1ac318;}exports[_0x7b67('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x18e47d,_0x193da9,_0x1cc02b){if(_0x193da9>_0x1cc02b){for(var _0x5eabcd=0x0;_0x5eabcd<_0x193da9-_0x1cc02b;_0x5eabcd+=0x1){decrementOriginate(_0x18e47d);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x3d84db){var _0x3c1005={};var _0x497247=['id','createdAt',_0x7b67('0x50'),_0x7b67('0x51'),_0x7b67('0x52')];if(_0x3d84db){for(var _0xa292af in _0x3d84db){if(typeof _0x3d84db[_0xa292af]!==_0x7b67('0x53')){if(!_[_0x7b67('0x2f')](_0x3d84db[_0xa292af])&&!_0x497247['includes'](_0xa292af)){_0x3c1005[util[_0x7b67('0x44')](_0x7b67('0x54'),_0x7b67('0x55'),_0xa292af['toUpperCase']())]=_0x3d84db[_0xa292af];}}}}return _0x3c1005;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x954c=['milliseconds','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','isUndefined','string','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','random','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','checkContactEmpty','createdAt','tags','updatedAt','undefined','XMD-','toUpperCase','setXMDContactVariables','lodash','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','IS_DISACTIVED','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','isIVRCampaignActive'];(function(_0x456b45,_0x273834){var _0xe3627d=function(_0x3a6f59){while(--_0x3a6f59){_0x456b45['push'](_0x456b45['shift']());}};_0xe3627d(++_0x273834);}(_0x954c,0x88));var _0xc954=function(_0x2078c0,_0x128f5e){_0x2078c0=_0x2078c0-0x0;var _0x4e17f6=_0x954c[_0x2078c0];return _0x4e17f6;};'use strict';var _=require(_0xc954('0x0'));var moment=require('moment');var util=require('util');var logger=require(_0xc954('0x1'))(_0xc954('0x2'));var timezones=require(_0xc954('0x3'))[_0xc954('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0xc954('0x5'),'BLACKLIST':_0xc954('0x6'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xc954('0x7'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xc954('0x8'),'NO_AVAILABLE_CONTACTS':_0xc954('0x9'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xc954('0xa'),'RUNNING':_0xc954('0xb'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xc954('0xc')};exports[_0xc954('0xd')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x55f746){return _0x55f746[_0xc954('0xe')]==='preview';}exports[_0xc954('0xf')]=isPreviewCampaign;function isIVRCampaign(_0x51ad65){return _0x51ad65[_0xc954('0x10')]===_0xc954('0x11');}exports[_0xc954('0x12')]=isIVRCampaign;function isOutboundQueue(_0xd28f09){return _0xd28f09[_0xc954('0x10')]===_0xc954('0x13');}exports[_0xc954('0x14')]=isOutboundQueue;function isQueueCampaignActive(_0x30c206){return _0x30c206[_0xc954('0x15')];}exports[_0xc954('0x16')]=isQueueCampaignActive;function isIVRCampaignActive(_0x453ddc){return _0x453ddc['active'];}exports[_0xc954('0x17')]=isIVRCampaignActive;function getSeconds(_0x35f11f,_0xf356fd){var _0x485be6=moment(_0x35f11f)[_0xc954('0x18')](0x0);var _0x1ceebb=moment(_0xf356fd)[_0xc954('0x18')](0x0);return _0x485be6['diff'](_0x1ceebb,_0xc954('0x19'));}exports[_0xc954('0x1a')]=getSeconds;function hasQueueCampaignDataChanged(_0x1d1243,_0x538f9f){var _0x22498d=![];var _0x50266d=_0x1d1243[_0xc954('0xe')]!==_0x538f9f[_0xc954('0xe')]||_0x1d1243[_0xc954('0x15')]!==_0x538f9f[_0xc954('0x15')]||_0x1d1243[_0xc954('0x1b')]!==_0x538f9f['message'];var _0x1dedb7=_0x1d1243['available']!==_0x538f9f[_0xc954('0x1c')]||_0x1d1243[_0xc954('0x1d')]!==_0x538f9f[_0xc954('0x1d')]||_0x1d1243[_0xc954('0x1e')]!==_0x538f9f['loggedInDb']||_0x1d1243['paused']!==_0x538f9f[_0xc954('0x1f')]||_0x1d1243['talking']!==_0x538f9f[_0xc954('0x20')]||_0x1d1243[_0xc954('0x21')]!==_0x538f9f[_0xc954('0x21')]||_0x1d1243[_0xc954('0x22')]!==_0x538f9f['waiting']||_0x1d1243[_0xc954('0x23')]!==_0x538f9f['inUse']||_0x1d1243[_0xc954('0x24')]!==_0x538f9f[_0xc954('0x24')];if(_0x1d1243[_0xc954('0x25')]&&_0x538f9f['Trunk']){_0x22498d=_0x1d1243[_0xc954('0x25')]['name']!==_0x538f9f[_0xc954('0x25')][_0xc954('0x26')]||_0x1d1243[_0xc954('0x25')][_0xc954('0x27')]!==_0x538f9f['Trunk'][_0xc954('0x27')];}return _0x50266d||_0x1dedb7||_0x22498d;}exports[_0xc954('0x28')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x3a9b47){var _0x1f7220=null;var _0x3faa0f=_0x3a9b47[_0xc954('0x29')];if(_[_0xc954('0x2a')](_0x3a9b47[_0xc954('0x2b')])||_['isNil'](_0x3a9b47['Interval'])||_[_0xc954('0x2a')](_0x3a9b47[_0xc954('0x2c')][_0xc954('0x2d')])){_0x1f7220=CAMPAIGN_STATUS[_0xc954('0x2e')];}else if(_['isEmpty'](_0x3a9b47[_0xc954('0x2b')])||_[_0xc954('0x2f')](_0x3a9b47['Interval'][_0xc954('0x2d')])){_0x1f7220=CAMPAIGN_STATUS[_0xc954('0x30')];}else if(_0x3faa0f&&!timezones[_0x3faa0f]){_0x1f7220=CAMPAIGN_STATUS[_0xc954('0x31')];}return _0x1f7220;}function checkAnyValidTrunk(_0x209971,_0xe8672){var _0x4549b3=null;var _0xb40162='SIP/';var _0x106236=[_0xc954('0x32'),_0xc954('0x33')];var _0x2293f5=!![];if(_0x209971[_0xc954('0x25')]&&_0x209971[_0xc954('0x25')][_0xc954('0x27')]){_0xb40162+=_0x209971[_0xc954('0x25')]['name'];_0x4549b3=_0xe8672[_0xb40162];_0x2293f5=_0x106236[_0xc954('0x34')](_0x4549b3[_0xc954('0x35')]);}else if(_0x209971[_0xc954('0x36')]&&_0x209971[_0xc954('0x36')][_0xc954('0x27')]){_0xb40162+=_0x209971[_0xc954('0x36')]['name'];_0x4549b3=_0xe8672[_0xb40162];_0x2293f5=_0x106236[_0xc954('0x34')](_0x4549b3[_0xc954('0x35')]);}return _0x2293f5;}function getQueueCampaignStatusMessage(_0xe8c06d,_0x2915cd){var _0x2636b8=CAMPAIGN_STATUS[_0xc954('0x5')];var _0x55495b=isPreviewCampaign(_0xe8c06d);if(!isQueueCampaignActive(_0xe8c06d)){if(_0x55495b){_0x2636b8=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0xe8c06d[_0xc954('0x24')]===0x0&&_0xe8c06d[_0xc954('0x20')]===0x0&&_0xe8c06d[_0xc954('0x22')]===0x0&&(_0xe8c06d[_0xc954('0x21')]||0x0)===0x0){_0x2636b8=CAMPAIGN_STATUS[_0xc954('0x37')];}else{_0x2636b8=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0xe8c06d[_0xc954('0x1d')]===0x0){_0x2636b8=CAMPAIGN_STATUS[_0xc954('0x38')];}else if(!checkAnyValidTrunk(_0xe8c06d,_0x2915cd)){_0x2636b8=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0xe8c06d)){var _0x32de31=checkAnyValidQueueCampaignInterval(_0xe8c06d);if(_0x32de31){_0x2636b8=_0x32de31;}}return _0x2636b8;}exports[_0xc954('0x39')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x7c7c58){var _0x2e8172=CAMPAIGN_STATUS[_0xc954('0x3a')];if(_0x7c7c58['originated']===0x0&&_0x7c7c58[_0xc954('0x20')]===0x0&&_0x7c7c58[_0xc954('0x22')]===0x0&&(_0x7c7c58['pTalking']||0x0)===0x0){_0x2e8172=CAMPAIGN_STATUS['INACTIVE'];}return _0x2e8172;}exports[_0xc954('0x3b')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x18b982){var _0x135e9c=_0x18b982['match'](/"(.*?)"/);return _0x135e9c?_0x135e9c[0x1]:_0x18b982;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x185308,_0x4f8f5e,_0x41cbc0){if(!_[_0xc954('0x3c')](_0x41cbc0)&&typeof _0x41cbc0==='string'&&!_['isEmpty'](_0x41cbc0)){if(!_['isUndefined'](_0x4f8f5e)&&typeof _0x4f8f5e===_0xc954('0x3d')&&!_[_0xc954('0x2f')](_0x4f8f5e)){return util['format'](_0xc954('0x3e'),_0x4f8f5e,_0x41cbc0);}return util[_0xc954('0x3f')]('\x22%s\x22\x20<%s>',_0x41cbc0,_0x41cbc0);}if(!_[_0xc954('0x3c')](_0x185308)&&typeof _0x185308==='string'&&!_[_0xc954('0x2f')](_0x185308)){return _0x185308;}return _0xc954('0x40');}exports[_0xc954('0x41')]=getCallerId;function getCallerIdRandom(_0x2a9512,_0x2b1873){var _0x33af31;var _0x2a777b;var _0x2a594a;if(_0x2b1873<=0x0){_0x2b1873=0x1;}_0x33af31=new RegExp(_0xc954('0x42')+_0x2b1873+'}$');_0x2a777b=Math[_0xc954('0x43')](0xa,_0x2b1873-0x1);_0x2a594a=Math[_0xc954('0x43')](0xa,_0x2b1873)-0x1;return util[_0xc954('0x3f')]('%s',_['replace'](_0x2a9512,_0x33af31,_[_0xc954('0x44')](_0x2a777b,_0x2a594a)['toString']()));}exports[_0xc954('0x45')]=getCallerIdRandom;function decrementOriginate(_0x4e485a){if(_0x4e485a[_0xc954('0x24')]&&_0x4e485a[_0xc954('0x24')]>0x0){_0x4e485a[_0xc954('0x24')]-=0x1;}else{logger[_0xc954('0x46')](_0xc954('0x47'));}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x5d8711){return _0x5d8711&&_0x5d8711['length']>0x0;}exports[_0xc954('0x48')]=checkContactEmpty;function erlangb(_0x3c1cd3,_0x49d188){if(_0x49d188===0x0){return 0x0;}var _0x41c9af=0x1;for(var _0x4d830b=0x1;_0x4d830b<=_0x49d188;_0x4d830b+=0x1){_0x41c9af=0x1+_0x41c9af*_0x4d830b/_0x3c1cd3;}return 0x1/_0x41c9af;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x3327bf,_0x51624c,_0x40d4b5){if(_0x51624c>_0x40d4b5){for(var _0xc1a605=0x0;_0xc1a605<_0x51624c-_0x40d4b5;_0xc1a605+=0x1){decrementOriginate(_0x3327bf);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x3b67da){var _0x4f8b15={};var _0x608dd0=['id',_0xc954('0x49'),'description',_0xc954('0x4a'),_0xc954('0x4b')];if(_0x3b67da){for(var _0x551b5f in _0x3b67da){if(typeof _0x3b67da[_0x551b5f]!==_0xc954('0x4c')){if(!_[_0xc954('0x2a')](_0x3b67da[_0x551b5f])&&!_0x608dd0['includes'](_0x551b5f)){_0x4f8b15[util[_0xc954('0x3f')]('%s%s',_0xc954('0x4d'),_0x551b5f[_0xc954('0x4e')]())]=_0x3b67da[_0x551b5f];}}}}return _0x4f8b15;}exports[_0xc954('0x4f')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 38302a6..63e35f8 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(_0x4ed451,_0x164323){var _0x204936=function(_0x28533b){while(--_0x28533b){_0x4ed451['push'](_0x4ed451['shift']());}};_0x204936(++_0x164323);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0x424eb0,_0xd5e5cb){var _0x345128=function(_0x12c56f){while(--_0x12c56f){_0x424eb0['push'](_0x424eb0['shift']());}};_0x345128(++_0xd5e5cb);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 0080fde..d7423e0 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 _0xc3ed=['%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','syncNewState','newexten','syncNewExten','faxstatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','faxAccounts','hasOwnProperty','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','info','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','isValid','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','execute'];(function(_0x4ede8b,_0x25b7a7){var _0x2c1011=function(_0x110e62){while(--_0x110e62){_0x4ede8b['push'](_0x4ede8b['shift']());}};_0x2c1011(++_0x25b7a7);}(_0xc3ed,0x18c));var _0xdc3e=function(_0xfd5ec6,_0x3c1203){_0xfd5ec6=_0xfd5ec6-0x0;var _0x4c585c=_0xc3ed[_0xfd5ec6];return _0x4c585c;};'use strict';var util=require('util');var _=require(_0xdc3e('0x0'));var BPromise=require(_0xdc3e('0x1'));var uuid=require(_0xdc3e('0x2'));var moment=require(_0xdc3e('0x3'));var path=require(_0xdc3e('0x4'));var tiff2pdf=require(_0xdc3e('0x5'));var gs=require(_0xdc3e('0x6'));var logger=require(_0xdc3e('0x7'))(_0xdc3e('0x8'));var ami=require(_0xdc3e('0x9'));var rpcDb=require(_0xdc3e('0xa'));var Channel=require(_0xdc3e('0xb'));var ut=require(_0xdc3e('0xc'));var Action=require(_0xdc3e('0xd'));var faxAccount=require(_0xdc3e('0xe'));var attachment=require(_0xdc3e('0xf'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x2a8072){this[_0xdc3e('0x10')]={};this['faxAccounts']=_0x2a8072['faxAccounts'];this['trunks']=_0x2a8072[_0xdc3e('0x11')];this[_0xdc3e('0x12')]={};ami['on'](_0xdc3e('0x13'),this[_0xdc3e('0x14')]['bind'](this));ami['on'](_0xdc3e('0x15'),this[_0xdc3e('0x16')][_0xdc3e('0x17')](this));ami['on']('newstate',this[_0xdc3e('0x18')][_0xdc3e('0x17')](this));ami['on'](_0xdc3e('0x19'),this[_0xdc3e('0x1a')]['bind'](this));ami['on'](_0xdc3e('0x1b'),this['syncFaxStatus'][_0xdc3e('0x17')](this));ami['on'](_0xdc3e('0x1c'),this['syncReceiveFax'][_0xdc3e('0x17')](this));ami['on'](_0xdc3e('0x1d'),this[_0xdc3e('0x1e')][_0xdc3e('0x17')](this));ami['on'](_0xdc3e('0x1f'),this[_0xdc3e('0x20')][_0xdc3e('0x17')](this));}Fax[_0xdc3e('0x21')][_0xdc3e('0x14')]=function(_0x531e80){if(_0x531e80['context']===_0xdc3e('0x22')){for(var _0x3c9dc2 in this['faxAccounts']){if(this[_0xdc3e('0x23')][_0xdc3e('0x24')](_0x3c9dc2)){if(_0x531e80['exten']===this['faxAccounts'][_0x3c9dc2][_0xdc3e('0x25')]){this['channels'][_0x531e80[_0xdc3e('0x26')]]={};this[_0xdc3e('0x10')][_0x531e80[_0xdc3e('0x26')]][_0xdc3e('0x27')]=_0x531e80['channel'];this['channels'][_0x531e80[_0xdc3e('0x26')]]['id']=this[_0xdc3e('0x23')][_0x3c9dc2]['id'];this[_0xdc3e('0x10')][_0x531e80[_0xdc3e('0x26')]][_0xdc3e('0x28')]=this[_0xdc3e('0x23')][_0x3c9dc2]['name'];logger['info'](_0x531e80['uniqueid'],_0xdc3e('0x29'));}}}}if(this[_0xdc3e('0x12')][_0x531e80[_0xdc3e('0x26')]]){this[_0xdc3e('0x10')][_0x531e80[_0xdc3e('0x26')]]={};this[_0xdc3e('0x10')][_0x531e80['uniqueid']][_0xdc3e('0x27')]=_0x531e80[_0xdc3e('0x27')];logger['info'](_0x531e80['uniqueid'],_0xdc3e('0x29'));}};Fax[_0xdc3e('0x21')]['syncVarSet']=function(_0x46290d){if(this[_0xdc3e('0x10')][_0x46290d[_0xdc3e('0x26')]]){for(var _0x37937b in _0x46290d[_0xdc3e('0x2a')]){if(_0x46290d['variable'][_0xdc3e('0x24')](_0x37937b)){this[_0xdc3e('0x10')][_0x46290d['uniqueid']][_0x37937b]=_0x46290d[_0xdc3e('0x2b')];}}}};Fax[_0xdc3e('0x21')][_0xdc3e('0x18')]=function(_0x16856d){if(this[_0xdc3e('0x10')][_0x16856d[_0xdc3e('0x26')]]){this[_0xdc3e('0x10')][_0x16856d[_0xdc3e('0x26')]][_0xdc3e('0x2c')]=_0x16856d[_0xdc3e('0x2c')];this[_0xdc3e('0x10')][_0x16856d[_0xdc3e('0x26')]][_0xdc3e('0x2d')]=_0x16856d[_0xdc3e('0x2d')];}};Fax['prototype'][_0xdc3e('0x1a')]=function(_0x1047f6){if(this['channels'][_0x1047f6[_0xdc3e('0x26')]]){for(var _0x3fa9a5 in _0x1047f6['variable']){if(_0x1047f6['variable']['hasOwnProperty'](_0x3fa9a5)){this[_0xdc3e('0x10')][_0x1047f6['uniqueid']][_0x3fa9a5]=_0x1047f6['value'];}}}};Fax[_0xdc3e('0x21')][_0xdc3e('0x2e')]=function(_0x12431c){if(this[_0xdc3e('0x10')][_0x12431c[_0xdc3e('0x26')]]){this[_0xdc3e('0x10')][_0x12431c[_0xdc3e('0x26')]][_0xdc3e('0x2f')]=_0x12431c[_0xdc3e('0x2f')];this[_0xdc3e('0x10')][_0x12431c[_0xdc3e('0x26')]][_0xdc3e('0x30')]=_0x12431c[_0xdc3e('0x30')];this[_0xdc3e('0x10')][_0x12431c['uniqueid']]['localstationid']=_0x12431c[_0xdc3e('0x25')];this[_0xdc3e('0x10')][_0x12431c[_0xdc3e('0x26')]][_0xdc3e('0x31')]=_0x12431c[_0xdc3e('0x31')];logger[_0xdc3e('0x32')](_0x12431c[_0xdc3e('0x26')],_0xdc3e('0x33'));}};Fax[_0xdc3e('0x21')][_0xdc3e('0x34')]=function(_0x295bed){var _0x139c4e=this;if(this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]]){var _0x55d75c=this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]]['id'];this['channels'][_0x295bed[_0xdc3e('0x26')]][_0xdc3e('0x35')]=_0x295bed[_0xdc3e('0x35')];this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]][_0xdc3e('0x36')]=_0x295bed[_0xdc3e('0x36')];this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]][_0xdc3e('0x25')]=_0x295bed[_0xdc3e('0x25')];this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]][_0xdc3e('0x37')]=_0x295bed['resolution'];this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]]['transferrate']=_0x295bed[_0xdc3e('0x38')];this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]][_0xdc3e('0x31')]=_0x295bed[_0xdc3e('0x31')];this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]][_0xdc3e('0x39')]=_0x295bed[_0xdc3e('0x39')];if(this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]]['pagestransferred']>0x0){tiff2pdf(_0x295bed[_0xdc3e('0x31')],_0xdc3e('0x3a'),function(_0x774676){logger[_0xdc3e('0x32')](_0x295bed['uniqueid'],_0xdc3e('0x3b'),_0x774676[_0xdc3e('0x3c')]);attachment[_0xdc3e('0x3d')]({'name':path[_0xdc3e('0x3e')](_0x295bed[_0xdc3e('0x31')])[_0xdc3e('0x28')],'basename':path[_0xdc3e('0x3e')](_0x295bed[_0xdc3e('0x31')])[_0xdc3e('0x28')]+_0xdc3e('0x3f'),'type':_0xdc3e('0x40')})[_0xdc3e('0x41')](function(_0xc1eb66){faxAccount[_0xdc3e('0x42')](_0x55d75c,{'from':_0x295bed[_0xdc3e('0x39')],'mapKey':'fax','body':path['parse'](_0x295bed[_0xdc3e('0x31')])[_0xdc3e('0x28')]+_0xdc3e('0x3f'),'AttachmentId':_0xc1eb66['id']})[_0xdc3e('0x43')](function(_0x5ed554){logger[_0xdc3e('0x44')](_0x295bed['uniqueid'],_0xdc3e('0x45'),JSON['stringify'](_0x5ed554));});})[_0xdc3e('0x43')](function(_0x1f393d){logger[_0xdc3e('0x44')](_0x295bed['uniqueid'],_0xdc3e('0x46'),JSON[_0xdc3e('0x47')](_0x1f393d));});});}logger[_0xdc3e('0x32')](_0x295bed[_0xdc3e('0x26')],_0xdc3e('0x46'));}};Fax[_0xdc3e('0x21')][_0xdc3e('0x20')]=function(_0x5bc97a){if(this['actions'][_0x5bc97a[_0xdc3e('0x26')]]){_[_0xdc3e('0x48')](this[_0xdc3e('0x10')][_0x5bc97a[_0xdc3e('0x26')]],_['pick'](_0x5bc97a,[_0xdc3e('0x49'),_0xdc3e('0x4a')]));}};function updateStatus(_0x375cf0){if(_0x375cf0[_0xdc3e('0x4b')]){faxMessage[_0xdc3e('0x4c')](_0x375cf0['AttachmentId'],{'failMessage':_0xdc3e('0x4d')})[_0xdc3e('0x41')](function(_0x1af654){ut[_0xdc3e('0x4e')](_0xdc3e('0x4f'),_0x1af654);})[_0xdc3e('0x43')](function(_0x1e008b){ut[_0xdc3e('0x4e')](_0xdc3e('0x50'),_0x1e008b);});}else{ut[_0xdc3e('0x4e')](_0xdc3e('0x51'));}}Fax[_0xdc3e('0x21')][_0xdc3e('0x52')]=function(_0x2d98c0,_0x2a664b,_0x2cd565){var _0x60b7a=this;var _0x2ae877={};if(_0x2a664b){_0x2ae877={'read':_0x2a664b};}else{_0x2ae877={'failMessage':_0x2cd565};}if(this[_0xdc3e('0x12')][_0x2d98c0][_0xdc3e('0x4b')]){faxMessage[_0xdc3e('0x4c')](this[_0xdc3e('0x12')][_0x2d98c0][_0xdc3e('0x4b')],_0x2ae877)[_0xdc3e('0x41')](function(_0x4f874d){ut[_0xdc3e('0x4e')]('[Fax][Message][Updated]',_0x4f874d);})[_0xdc3e('0x43')](function(_0x3b5841){ut['logger'](_0xdc3e('0x53'),_0x3b5841);})[_0xdc3e('0x54')](function(){delete _0x60b7a[_0xdc3e('0x10')][_0x2d98c0];delete _0x60b7a['actions'][_0x2d98c0];});}else{ut['logger'](_0xdc3e('0x55'));delete this[_0xdc3e('0x10')][_0x2d98c0];delete this[_0xdc3e('0x12')][_0x2d98c0];}};Fax[_0xdc3e('0x21')][_0xdc3e('0x1e')]=function(_0x196c3d){var _0xe3b913=this;if(this[_0xdc3e('0x10')][_0x196c3d['uniqueid']]){if(this['actions'][_0x196c3d[_0xdc3e('0x26')]]){this[_0xdc3e('0x10')][_0x196c3d[_0xdc3e('0x26')]]['id']=this['actions'][_0x196c3d[_0xdc3e('0x26')]]['id'];this[_0xdc3e('0x10')][_0x196c3d[_0xdc3e('0x26')]][_0xdc3e('0x28')]=this[_0xdc3e('0x12')][_0x196c3d[_0xdc3e('0x26')]][_0xdc3e('0x28')];}logger[_0xdc3e('0x32')](_0x196c3d[_0xdc3e('0x26')],this[_0xdc3e('0x12')][_0x196c3d[_0xdc3e('0x26')]]?_0xdc3e('0x56'):_0xdc3e('0x57'),JSON['stringify'](this[_0xdc3e('0x10')][_0x196c3d['uniqueid']]));if(this[_0xdc3e('0x12')][_0x196c3d[_0xdc3e('0x26')]]){if(this['channels'][_0x196c3d[_0xdc3e('0x26')]][_0xdc3e('0x58')]>0x0&&this[_0xdc3e('0x10')][_0x196c3d['uniqueid']][_0xdc3e('0x1b')]===_0xdc3e('0x59')){this[_0xdc3e('0x52')](_0x196c3d[_0xdc3e('0x26')],!![]);}else{this['updateStatus'](_0x196c3d[_0xdc3e('0x26')],![],this[_0xdc3e('0x10')][_0x196c3d[_0xdc3e('0x26')]][_0xdc3e('0x5a')]?_0xdc3e('0x5b')+this[_0xdc3e('0x10')][_0x196c3d['uniqueid']]['faxstatusstring']:_0xdc3e('0x5c'));}}}};Fax['prototype'][_0xdc3e('0x5d')]=function(_0x7e5e60){var _0xe69457=this;return new BPromise(function(_0xa5c5ec,_0x5d118b){_0xe69457[_0xdc3e('0x5e')](_0x7e5e60,_0xe69457['faxAccounts'][_0x7e5e60['FaxAccountId']])[_0xdc3e('0x41')](function(_0x5e2861){ut[_0xdc3e('0x4e')](_0xdc3e('0x5f'),_0x5e2861);_0xa5c5ec(ut[_0xdc3e('0x3c')](_0xdc3e('0x60')));})['catch'](function(_0x5c2579){ut[_0xdc3e('0x4e')](_0xdc3e('0x61'),_0x5c2579);updateStatus(_0x7e5e60);_0x5d118b(ut['message']('Fax\x20failed'));});});};Fax[_0xdc3e('0x21')]['checkAfterSend']=function(_0x4ea79){var _0x406003=this;return new BPromise(function(_0x3294d1,_0x2512e5){var _0x200301=_0x406003[_0xdc3e('0x62')](_0x406003['faxAccounts'][_0x4ea79['FaxAccountId']][_0xdc3e('0x63')],_0x4ea79);if(_0x200301[_0xdc3e('0x64')]){_0x3294d1(ut[_0xdc3e('0x3c')]('Trunk\x20Reachable'));}else{_0x2512e5(ut[_0xdc3e('0x3c')](_0x200301[_0xdc3e('0x3c')]));}});};function originate(_0x2ad726,_0x11ba29,_0x44a752){return new BPromise(function(_0x41aac6,_0x31314a){if(_0x44a752){var _0x285114=util[_0xdc3e('0x65')](_0xdc3e('0x66'),path[_0xdc3e('0x3e')](_0x2ad726['path'])[_0xdc3e('0x28')],_0x2ad726[_0xdc3e('0x4')]);gs[_0xdc3e('0x67')](_0x285114)[_0xdc3e('0x41')](function(){_0x2ad726['path']=util[_0xdc3e('0x65')](_0xdc3e('0x68'),path[_0xdc3e('0x3e')](_0x2ad726['path'])[_0xdc3e('0x69')],path[_0xdc3e('0x3e')](_0x2ad726[_0xdc3e('0x4')])['name']);_0x11ba29[_0xdc3e('0x6a')]=_0x2ad726['path'];ut['logger'](_0xdc3e('0x6b'),'');ami['Action'](ut[_0xdc3e('0x6c')](_0x2ad726,_0x11ba29))[_0xdc3e('0x41')](function(_0x36c5ea){_0x41aac6(_0x36c5ea);})['catch'](function(_0x5d9338){_0x31314a(_0x5d9338);});})[_0xdc3e('0x43')](function(_0x2b5ab6){_0x31314a(_0x2b5ab6);});}else{ami['Action'](ut['variablesAction'](_0x2ad726,_0x11ba29))[_0xdc3e('0x41')](function(_0x90c7c4){_0x41aac6(_0x90c7c4);})[_0xdc3e('0x43')](function(_0x5c4e10){_0x31314a(_0x5c4e10);});}});}Fax[_0xdc3e('0x21')][_0xdc3e('0x5e')]=function(_0x82971b,_0xe2d71a){var _0x136d15=this;return new BPromise(function(_0x5a8fa0,_0x4a1c1d){var _0x526a08=uuid['v4']();var _0x11fd7f=ut[_0xdc3e('0x6d')](_0x82971b,_0xe2d71a);_0x136d15[_0xdc3e('0x12')][_0x526a08]=new Action(_0x526a08,_0xe2d71a,_0x82971b);var _0x30215e=_0x136d15[_0xdc3e('0x12')][_0x526a08];if(path[_0xdc3e('0x3e')](_0x82971b[_0xdc3e('0x4')])[_0xdc3e('0x6e')]===_0xdc3e('0x3f')){originate(_0x30215e,_0x11fd7f,!![])[_0xdc3e('0x41')](function(_0x4eaff4){_0x5a8fa0(_0x4eaff4);})['catch'](function(_0x1a1b54){_0x4a1c1d(_0x1a1b54);});}else{originate(_0x30215e,_0x11fd7f,![])[_0xdc3e('0x41')](function(_0x2eb61f){_0x5a8fa0(_0x2eb61f);})[_0xdc3e('0x43')](function(_0x4a4d1e){_0x4a1c1d(_0x4a4d1e);});}});};Fax[_0xdc3e('0x21')][_0xdc3e('0x6f')]=function(_0x53fef5){return!_[_0xdc3e('0x70')](_0x53fef5)&&!_[_0xdc3e('0x70')](_0x53fef5[_0xdc3e('0x28')])&&!_[_0xdc3e('0x70')](_0x53fef5[_0xdc3e('0x71')])&&_0x53fef5['active']&&!_[_0xdc3e('0x70')](this['trunks'][util[_0xdc3e('0x65')]('SIP/%s',_0x53fef5[_0xdc3e('0x28')])])&&!_['isNil'](this[_0xdc3e('0x11')][util[_0xdc3e('0x65')](_0xdc3e('0x72'),_0x53fef5[_0xdc3e('0x28')])]['status'])&&(this[_0xdc3e('0x11')][util[_0xdc3e('0x65')](_0xdc3e('0x72'),_0x53fef5[_0xdc3e('0x28')])][_0xdc3e('0x30')]===_0xdc3e('0x73')||this[_0xdc3e('0x11')][util['format']('SIP/%s',_0x53fef5[_0xdc3e('0x28')])]['status']===_0xdc3e('0x74'));};Fax[_0xdc3e('0x21')][_0xdc3e('0x62')]=function(_0x214143,_0x692108){if(!this[_0xdc3e('0x6f')](_0x214143)){ut[_0xdc3e('0x4e')](_0xdc3e('0x75'),_['isNil'](_0x214143)?'':_0x214143[_0xdc3e('0x28')]+_0xdc3e('0x76'));return{'isValid':![],'message':_0xdc3e('0x77')};}if(_['isNil'](_0x692108[_0xdc3e('0x8')])){ut[_0xdc3e('0x4e')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xdc3e('0x47')](_0x692108));return{'isValid':![],'message':_0xdc3e('0x78')};}if(_[_0xdc3e('0x70')](_0x692108['path'])){ut[_0xdc3e('0x4e')](_0xdc3e('0x79'),JSON['stringify'](_0x692108));return{'isValid':![],'message':_0xdc3e('0x7a')};}return{'isValid':!![],'message':_0xdc3e('0x7b')};};module[_0xdc3e('0x7c')]=Fax; \ No newline at end of file +var _0xa0b2=['faxAccounts','trunks','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','actions','\x20syncNewchannel\x20','prototype','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','execute','format','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','path','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','channels'];(function(_0x40ed74,_0x57d61f){var _0x5d1e29=function(_0x4b9419){while(--_0x4b9419){_0x40ed74['push'](_0x40ed74['shift']());}};_0x5d1e29(++_0x57d61f);}(_0xa0b2,0x14f));var _0x2a0b=function(_0x173113,_0x316a7c){_0x173113=_0x173113-0x0;var _0x3bea89=_0xa0b2[_0x173113];return _0x3bea89;};'use strict';var util=require(_0x2a0b('0x0'));var _=require(_0x2a0b('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var path=require(_0x2a0b('0x2'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x2a0b('0x3'));var logger=require(_0x2a0b('0x4'))(_0x2a0b('0x5'));var ami=require(_0x2a0b('0x6'));var rpcDb=require(_0x2a0b('0x7'));var Channel=require(_0x2a0b('0x8'));var ut=require(_0x2a0b('0x9'));var Action=require(_0x2a0b('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x2a0b('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x3158e9){this[_0x2a0b('0xc')]={};this[_0x2a0b('0xd')]=_0x3158e9[_0x2a0b('0xd')];this[_0x2a0b('0xe')]=_0x3158e9[_0x2a0b('0xe')];this['actions']={};ami['on']('newchannel',this[_0x2a0b('0xf')][_0x2a0b('0x10')](this));ami['on'](_0x2a0b('0x11'),this[_0x2a0b('0x12')][_0x2a0b('0x10')](this));ami['on'](_0x2a0b('0x13'),this[_0x2a0b('0x14')][_0x2a0b('0x10')](this));ami['on']('newexten',this[_0x2a0b('0x15')]['bind'](this));ami['on'](_0x2a0b('0x16'),this['syncFaxStatus'][_0x2a0b('0x10')](this));ami['on'](_0x2a0b('0x17'),this[_0x2a0b('0x18')][_0x2a0b('0x10')](this));ami['on'](_0x2a0b('0x19'),this[_0x2a0b('0x1a')]['bind'](this));ami['on'](_0x2a0b('0x1b'),this['syncOriginateResponse'][_0x2a0b('0x10')](this));}Fax['prototype'][_0x2a0b('0xf')]=function(_0x3caab4){if(_0x3caab4[_0x2a0b('0x1c')]===_0x2a0b('0x1d')){for(var _0x2bea7a in this[_0x2a0b('0xd')]){if(this[_0x2a0b('0xd')][_0x2a0b('0x1e')](_0x2bea7a)){if(_0x3caab4[_0x2a0b('0x1f')]===this['faxAccounts'][_0x2bea7a]['localstationid']){this[_0x2a0b('0xc')][_0x3caab4[_0x2a0b('0x20')]]={};this['channels'][_0x3caab4[_0x2a0b('0x20')]][_0x2a0b('0x21')]=_0x3caab4[_0x2a0b('0x21')];this[_0x2a0b('0xc')][_0x3caab4[_0x2a0b('0x20')]]['id']=this[_0x2a0b('0xd')][_0x2bea7a]['id'];this[_0x2a0b('0xc')][_0x3caab4[_0x2a0b('0x20')]][_0x2a0b('0x22')]=this['faxAccounts'][_0x2bea7a][_0x2a0b('0x22')];logger[_0x2a0b('0x23')](_0x3caab4[_0x2a0b('0x20')],'\x20syncNewchannel\x20');}}}}if(this[_0x2a0b('0x24')][_0x3caab4['uniqueid']]){this[_0x2a0b('0xc')][_0x3caab4[_0x2a0b('0x20')]]={};this[_0x2a0b('0xc')][_0x3caab4['uniqueid']][_0x2a0b('0x21')]=_0x3caab4[_0x2a0b('0x21')];logger[_0x2a0b('0x23')](_0x3caab4['uniqueid'],_0x2a0b('0x25'));}};Fax[_0x2a0b('0x26')][_0x2a0b('0x12')]=function(_0x573230){if(this[_0x2a0b('0xc')][_0x573230['uniqueid']]){for(var _0x247e09 in _0x573230['variable']){if(_0x573230[_0x2a0b('0x27')]['hasOwnProperty'](_0x247e09)){this[_0x2a0b('0xc')][_0x573230[_0x2a0b('0x20')]][_0x247e09]=_0x573230[_0x2a0b('0x28')];}}}};Fax['prototype'][_0x2a0b('0x14')]=function(_0x2aab39){if(this[_0x2a0b('0xc')][_0x2aab39[_0x2a0b('0x20')]]){this[_0x2a0b('0xc')][_0x2aab39[_0x2a0b('0x20')]]['channelstate']=_0x2aab39[_0x2a0b('0x29')];this['channels'][_0x2aab39[_0x2a0b('0x20')]][_0x2a0b('0x2a')]=_0x2aab39[_0x2a0b('0x2a')];}};Fax[_0x2a0b('0x26')][_0x2a0b('0x15')]=function(_0x3a498a){if(this[_0x2a0b('0xc')][_0x3a498a[_0x2a0b('0x20')]]){for(var _0x587827 in _0x3a498a[_0x2a0b('0x27')]){if(_0x3a498a[_0x2a0b('0x27')][_0x2a0b('0x1e')](_0x587827)){this[_0x2a0b('0xc')][_0x3a498a[_0x2a0b('0x20')]][_0x587827]=_0x3a498a[_0x2a0b('0x28')];}}}};Fax[_0x2a0b('0x26')][_0x2a0b('0x2b')]=function(_0x156915){if(this['channels'][_0x156915[_0x2a0b('0x20')]]){this[_0x2a0b('0xc')][_0x156915[_0x2a0b('0x20')]]['operation']=_0x156915[_0x2a0b('0x2c')];this[_0x2a0b('0xc')][_0x156915[_0x2a0b('0x20')]][_0x2a0b('0x2d')]=_0x156915['status'];this[_0x2a0b('0xc')][_0x156915[_0x2a0b('0x20')]][_0x2a0b('0x2e')]=_0x156915[_0x2a0b('0x2e')];this[_0x2a0b('0xc')][_0x156915[_0x2a0b('0x20')]][_0x2a0b('0x2f')]=_0x156915['filename'];logger['info'](_0x156915[_0x2a0b('0x20')],_0x2a0b('0x30'));}};Fax[_0x2a0b('0x26')][_0x2a0b('0x18')]=function(_0x5b2912){var _0x640687=this;if(this[_0x2a0b('0xc')][_0x5b2912[_0x2a0b('0x20')]]){var _0x2539b6=this['channels'][_0x5b2912[_0x2a0b('0x20')]]['id'];this['channels'][_0x5b2912[_0x2a0b('0x20')]][_0x2a0b('0x31')]=_0x5b2912[_0x2a0b('0x31')];this[_0x2a0b('0xc')][_0x5b2912[_0x2a0b('0x20')]][_0x2a0b('0x32')]=_0x5b2912[_0x2a0b('0x32')];this[_0x2a0b('0xc')][_0x5b2912[_0x2a0b('0x20')]][_0x2a0b('0x2e')]=_0x5b2912[_0x2a0b('0x2e')];this[_0x2a0b('0xc')][_0x5b2912[_0x2a0b('0x20')]][_0x2a0b('0x33')]=_0x5b2912['resolution'];this[_0x2a0b('0xc')][_0x5b2912[_0x2a0b('0x20')]][_0x2a0b('0x34')]=_0x5b2912[_0x2a0b('0x34')];this[_0x2a0b('0xc')][_0x5b2912['uniqueid']]['filename']=_0x5b2912[_0x2a0b('0x2f')];this[_0x2a0b('0xc')][_0x5b2912[_0x2a0b('0x20')]]['calleridnum']=_0x5b2912[_0x2a0b('0x35')];if(this['channels'][_0x5b2912['uniqueid']][_0x2a0b('0x32')]>0x0){tiff2pdf(_0x5b2912['filename'],_0x2a0b('0x36'),function(_0x170770){logger[_0x2a0b('0x23')](_0x5b2912[_0x2a0b('0x20')],'\x20result\x20conversion\x20file\x20',_0x170770[_0x2a0b('0x37')]);attachment[_0x2a0b('0x38')]({'name':path['parse'](_0x5b2912['filename'])[_0x2a0b('0x22')],'basename':path[_0x2a0b('0x39')](_0x5b2912[_0x2a0b('0x2f')])['name']+_0x2a0b('0x3a'),'type':_0x2a0b('0x3b')})[_0x2a0b('0x3c')](function(_0x9cb0a4){faxAccount[_0x2a0b('0x3d')](_0x2539b6,{'from':_0x5b2912[_0x2a0b('0x35')],'mapKey':'fax','body':path['parse'](_0x5b2912['filename'])[_0x2a0b('0x22')]+_0x2a0b('0x3a'),'AttachmentId':_0x9cb0a4['id']})[_0x2a0b('0x3e')](function(_0x48463a){logger[_0x2a0b('0x3f')](_0x5b2912[_0x2a0b('0x20')],_0x2a0b('0x40'),JSON[_0x2a0b('0x41')](_0x48463a));});})[_0x2a0b('0x3e')](function(_0x341646){logger[_0x2a0b('0x3f')](_0x5b2912[_0x2a0b('0x20')],_0x2a0b('0x42'),JSON[_0x2a0b('0x41')](_0x341646));});});}logger[_0x2a0b('0x23')](_0x5b2912[_0x2a0b('0x20')],_0x2a0b('0x42'));}};Fax[_0x2a0b('0x26')][_0x2a0b('0x43')]=function(_0x49fd70){if(this[_0x2a0b('0x24')][_0x49fd70[_0x2a0b('0x20')]]){_[_0x2a0b('0x44')](this['channels'][_0x49fd70[_0x2a0b('0x20')]],_[_0x2a0b('0x45')](_0x49fd70,[_0x2a0b('0x46'),_0x2a0b('0x47')]));}};function updateStatus(_0x47f06a){if(_0x47f06a[_0x2a0b('0x48')]){faxMessage['update'](_0x47f06a[_0x2a0b('0x48')],{'failMessage':_0x2a0b('0x49')})[_0x2a0b('0x3c')](function(_0x4f8e06){ut[_0x2a0b('0x4a')]('[Fax][Message][Error][Updated]',_0x4f8e06);})[_0x2a0b('0x3e')](function(_0x20c45a){ut[_0x2a0b('0x4a')](_0x2a0b('0x4b'),_0x20c45a);});}else{ut[_0x2a0b('0x4a')](_0x2a0b('0x4c'));}}Fax['prototype'][_0x2a0b('0x4d')]=function(_0x441976,_0x43b32a,_0x113eaa){var _0x18fa22=this;var _0x233c9f={};if(_0x43b32a){_0x233c9f={'read':_0x43b32a};}else{_0x233c9f={'failMessage':_0x113eaa};}if(this[_0x2a0b('0x24')][_0x441976][_0x2a0b('0x48')]){faxMessage['update'](this[_0x2a0b('0x24')][_0x441976]['AttachmentId'],_0x233c9f)[_0x2a0b('0x3c')](function(_0x3284a5){ut[_0x2a0b('0x4a')]('[Fax][Message][Updated]',_0x3284a5);})[_0x2a0b('0x3e')](function(_0x55d27f){ut[_0x2a0b('0x4a')](_0x2a0b('0x4e'),_0x55d27f);})['finally'](function(){delete _0x18fa22[_0x2a0b('0xc')][_0x441976];delete _0x18fa22[_0x2a0b('0x24')][_0x441976];});}else{ut['logger'](_0x2a0b('0x4f'));delete this['channels'][_0x441976];delete this[_0x2a0b('0x24')][_0x441976];}};Fax[_0x2a0b('0x26')][_0x2a0b('0x1a')]=function(_0x54ac40){var _0x3446b9=this;if(this[_0x2a0b('0xc')][_0x54ac40['uniqueid']]){if(this[_0x2a0b('0x24')][_0x54ac40[_0x2a0b('0x20')]]){this['channels'][_0x54ac40[_0x2a0b('0x20')]]['id']=this[_0x2a0b('0x24')][_0x54ac40['uniqueid']]['id'];this[_0x2a0b('0xc')][_0x54ac40[_0x2a0b('0x20')]]['name']=this[_0x2a0b('0x24')][_0x54ac40[_0x2a0b('0x20')]][_0x2a0b('0x22')];}logger['info'](_0x54ac40[_0x2a0b('0x20')],this['actions'][_0x54ac40[_0x2a0b('0x20')]]?_0x2a0b('0x50'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0x2a0b('0xc')][_0x54ac40[_0x2a0b('0x20')]]));if(this[_0x2a0b('0x24')][_0x54ac40[_0x2a0b('0x20')]]){if(this[_0x2a0b('0xc')][_0x54ac40[_0x2a0b('0x20')]][_0x2a0b('0x51')]>0x0&&this[_0x2a0b('0xc')][_0x54ac40[_0x2a0b('0x20')]]['faxstatus']==='SUCCESS'){this['updateStatus'](_0x54ac40[_0x2a0b('0x20')],!![]);}else{this[_0x2a0b('0x4d')](_0x54ac40[_0x2a0b('0x20')],![],this['channels'][_0x54ac40['uniqueid']]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x2a0b('0xc')][_0x54ac40[_0x2a0b('0x20')]][_0x2a0b('0x52')]:'SENDING\x20FAILED');}}}};Fax[_0x2a0b('0x26')][_0x2a0b('0x53')]=function(_0x514cb0){var _0x51a23d=this;return new BPromise(function(_0x5df1d4,_0x57cb65){_0x51a23d[_0x2a0b('0x54')](_0x514cb0,_0x51a23d[_0x2a0b('0xd')][_0x514cb0[_0x2a0b('0x55')]])['then'](function(_0x4a399e){ut[_0x2a0b('0x4a')](_0x2a0b('0x56'),_0x4a399e);_0x5df1d4(ut[_0x2a0b('0x37')](_0x2a0b('0x57')));})[_0x2a0b('0x3e')](function(_0x4ca183){ut[_0x2a0b('0x4a')](_0x2a0b('0x58'),_0x4ca183);updateStatus(_0x514cb0);_0x57cb65(ut[_0x2a0b('0x37')](_0x2a0b('0x59')));});});};Fax['prototype'][_0x2a0b('0x5a')]=function(_0x283adf){var _0x54320c=this;return new BPromise(function(_0x1b0007,_0x55449b){var _0x2dbe7b=_0x54320c[_0x2a0b('0x5b')](_0x54320c[_0x2a0b('0xd')][_0x283adf['FaxAccountId']][_0x2a0b('0x5c')],_0x283adf);if(_0x2dbe7b[_0x2a0b('0x5d')]){_0x1b0007(ut[_0x2a0b('0x37')](_0x2a0b('0x5e')));}else{_0x55449b(ut[_0x2a0b('0x37')](_0x2dbe7b[_0x2a0b('0x37')]));}});};function originate(_0x2b6435,_0x4a1364,_0x446fbb){return new BPromise(function(_0x561e57,_0x57087c){if(_0x446fbb){var _0x1038ce=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x2a0b('0x39')](_0x2b6435[_0x2a0b('0x2')])[_0x2a0b('0x22')],_0x2b6435[_0x2a0b('0x2')]);gs[_0x2a0b('0x5f')](_0x1038ce)[_0x2a0b('0x3c')](function(){_0x2b6435[_0x2a0b('0x2')]=util[_0x2a0b('0x60')](_0x2a0b('0x61'),path['parse'](_0x2b6435[_0x2a0b('0x2')])[_0x2a0b('0x62')],path[_0x2a0b('0x39')](_0x2b6435[_0x2a0b('0x2')])['name']);_0x4a1364['XMF-PATH']=_0x2b6435[_0x2a0b('0x2')];ut['logger'](_0x2a0b('0x63'),'');ami[_0x2a0b('0x64')](ut[_0x2a0b('0x65')](_0x2b6435,_0x4a1364))['then'](function(_0x2b31ba){_0x561e57(_0x2b31ba);})[_0x2a0b('0x3e')](function(_0x48d44d){_0x57087c(_0x48d44d);});})[_0x2a0b('0x3e')](function(_0x22d032){_0x57087c(_0x22d032);});}else{ami['Action'](ut[_0x2a0b('0x65')](_0x2b6435,_0x4a1364))[_0x2a0b('0x3c')](function(_0x1a1e9b){_0x561e57(_0x1a1e9b);})[_0x2a0b('0x3e')](function(_0x1d8045){_0x57087c(_0x1d8045);});}});}Fax['prototype']['execOriginate']=function(_0x15731d,_0x3206a7){var _0x469a7a=this;return new BPromise(function(_0x19c066,_0x3acf73){var _0x57b3f3=uuid['v4']();var _0x4ab36e=ut[_0x2a0b('0x66')](_0x15731d,_0x3206a7);_0x469a7a[_0x2a0b('0x24')][_0x57b3f3]=new Action(_0x57b3f3,_0x3206a7,_0x15731d);var _0x451dfd=_0x469a7a['actions'][_0x57b3f3];if(path[_0x2a0b('0x39')](_0x15731d['path'])[_0x2a0b('0x67')]==='.pdf'){originate(_0x451dfd,_0x4ab36e,!![])['then'](function(_0x5b9417){_0x19c066(_0x5b9417);})[_0x2a0b('0x3e')](function(_0x3b3a90){_0x3acf73(_0x3b3a90);});}else{originate(_0x451dfd,_0x4ab36e,![])['then'](function(_0x15548b){_0x19c066(_0x15548b);})['catch'](function(_0x23f2fb){_0x3acf73(_0x23f2fb);});}});};Fax[_0x2a0b('0x26')][_0x2a0b('0x68')]=function(_0x265d5d){return!_[_0x2a0b('0x69')](_0x265d5d)&&!_[_0x2a0b('0x69')](_0x265d5d[_0x2a0b('0x22')])&&!_[_0x2a0b('0x69')](_0x265d5d[_0x2a0b('0x6a')])&&_0x265d5d['active']&&!_['isNil'](this[_0x2a0b('0xe')][util[_0x2a0b('0x60')]('SIP/%s',_0x265d5d[_0x2a0b('0x22')])])&&!_[_0x2a0b('0x69')](this['trunks'][util[_0x2a0b('0x60')](_0x2a0b('0x6b'),_0x265d5d[_0x2a0b('0x22')])]['status'])&&(this[_0x2a0b('0xe')][util[_0x2a0b('0x60')](_0x2a0b('0x6b'),_0x265d5d['name'])]['status']===_0x2a0b('0x6c')||this['trunks'][util[_0x2a0b('0x60')](_0x2a0b('0x6b'),_0x265d5d[_0x2a0b('0x22')])]['status']==='unmonitored');};Fax[_0x2a0b('0x26')]['checkTrunk']=function(_0x2953c8,_0x3e1fad){if(!this[_0x2a0b('0x68')](_0x2953c8)){ut[_0x2a0b('0x4a')](_0x2a0b('0x6d'),_['isNil'](_0x2953c8)?'':_0x2953c8[_0x2a0b('0x22')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x2a0b('0x6e')};}if(_['isNil'](_0x3e1fad[_0x2a0b('0x5')])){ut[_0x2a0b('0x4a')](_0x2a0b('0x6f'),JSON['stringify'](_0x3e1fad));return{'isValid':![],'message':_0x2a0b('0x70')};}if(_[_0x2a0b('0x69')](_0x3e1fad[_0x2a0b('0x2')])){ut[_0x2a0b('0x4a')](_0x2a0b('0x71'),JSON[_0x2a0b('0x41')](_0x3e1fad));return{'isValid':![],'message':_0x2a0b('0x72')};}return{'isValid':!![],'message':_0x2a0b('0x73')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index f6dc535..517b597 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 _0xc25d=['catch','[Notify]\x20','util','bluebird','preview','lodash','../rpc/faxAccount','notify','resolve','then'];(function(_0x2bbe0f,_0x405355){var _0x2e67e9=function(_0xcad8ed){while(--_0xcad8ed){_0x2bbe0f['push'](_0x2bbe0f['shift']());}};_0x2e67e9(++_0x405355);}(_0xc25d,0x110));var _0xdc25=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xc25d[_0x297fd3];return _0x2af381;};'use strict';var util=require(_0xdc25('0x0'));var BPromise=require(_0xdc25('0x1'));var logger=require('../../../config/logger')(_0xdc25('0x2'));var _=require(_0xdc25('0x3'));var faxAccount=require(_0xdc25('0x4'));function loggerCatch(_0x42174b){return function(_0x4409d7){logger['error'](_0x42174b,util['inspect'](_0x4409d7,{'showHidden':![],'depth':null}));};}exports[_0xdc25('0x5')]=function(_0x571fa4,_0x432d38){return BPromise[_0xdc25('0x6')]()[_0xdc25('0x7')](faxAccount[_0xdc25('0x5')](_0x571fa4,_0x432d38))[_0xdc25('0x8')](loggerCatch(_0xdc25('0x9')));}; \ No newline at end of file +var _0x9ee7=['[Notify]\x20','util','bluebird','../../../config/logger','preview','inspect','notify','resolve','then','catch'];(function(_0x40ce01,_0x1e39c8){var _0xa0f16e=function(_0x2356ad){while(--_0x2356ad){_0x40ce01['push'](_0x40ce01['shift']());}};_0xa0f16e(++_0x1e39c8);}(_0x9ee7,0xc9));var _0x79ee=function(_0x5dca60,_0x2b2eeb){_0x5dca60=_0x5dca60-0x0;var _0xb2e3a9=_0x9ee7[_0x5dca60];return _0xb2e3a9;};'use strict';var util=require(_0x79ee('0x0'));var BPromise=require(_0x79ee('0x1'));var logger=require(_0x79ee('0x2'))(_0x79ee('0x3'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0xa0308e){return function(_0x5278f9){logger['error'](_0xa0308e,util[_0x79ee('0x4')](_0x5278f9,{'showHidden':![],'depth':null}));};}exports[_0x79ee('0x5')]=function(_0x45269a,_0x354ece){return BPromise[_0x79ee('0x6')]()[_0x79ee('0x7')](faxAccount[_0x79ee('0x5')](_0x45269a,_0x354ece))[_0x79ee('0x8')](loggerCatch(_0x79ee('0x9')));}; \ 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 fa72883..bb26c62 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 _0x46a2=['inspect','util','child_process','Exec\x20gs','info','\x20Error\x20:'];(function(_0x513e60,_0x395eea){var _0x11f441=function(_0x422810){while(--_0x422810){_0x513e60['push'](_0x513e60['shift']());}};_0x11f441(++_0x395eea);}(_0x46a2,0xcd));var _0x246a=function(_0x2786ea,_0x16c3c3){_0x2786ea=_0x2786ea-0x0;var _0x5c38e5=_0x46a2[_0x2786ea];return _0x5c38e5;};'use strict';var util=require(_0x246a('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require('bluebird');var exec=require(_0x246a('0x1'))['exec'];exports['execute']=function(_0x2c0ad3){return new BPromise(function(_0x36a94f,_0x19ffd8){exec(_0x2c0ad3,function(_0x18e794,_0x2b4129,_0x26c55d){logger['info'](_0x246a('0x2'),_0x2b4129);if(_0x18e794){logger[_0x246a('0x3')](_0x246a('0x2'),_0x246a('0x4'),util[_0x246a('0x5')](_0x18e794,{'showHidden':![],'depth':null}),_0x2b4129,_0x26c55d);_0x19ffd8(_0x18e794);}_0x36a94f(_0x2b4129);});});}; \ No newline at end of file +var _0x071e=['../../../../config/logger','fax','child_process','execute','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x4e7551,_0x398ee5){var _0x2c2ae8=function(_0x31f000){while(--_0x31f000){_0x4e7551['push'](_0x4e7551['shift']());}};_0x2c2ae8(++_0x398ee5);}(_0x071e,0x1a0));var _0xe071=function(_0x21e13e,_0x353383){_0x21e13e=_0x21e13e-0x0;var _0x2a0210=_0x071e[_0x21e13e];return _0x2a0210;};'use strict';var util=require('util');var logger=require(_0xe071('0x0'))(_0xe071('0x1'));var BPromise=require('bluebird');var exec=require(_0xe071('0x2'))['exec'];exports[_0xe071('0x3')]=function(_0x24a57f){return new BPromise(function(_0x516491,_0x2a76a9){exec(_0x24a57f,function(_0x11f5e8,_0x2ece4b,_0x4a61e1){logger[_0xe071('0x4')](_0xe071('0x5'),_0x2ece4b);if(_0x11f5e8){logger[_0xe071('0x4')]('Exec\x20gs',_0xe071('0x6'),util[_0xe071('0x7')](_0x11f5e8,{'showHidden':![],'depth':null}),_0x2ece4b,_0x4a61e1);_0x2a76a9(_0x11f5e8);}_0x516491(_0x2ece4b);});});}; \ 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 83c503e..91fa369 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 _0x0475=['localstationid','util','lodash','moment','fax','info','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','path','variablesAction','uniqueid','originate','\x22%s\x22\x20<%s>'];(function(_0x44f7c8,_0x1e3fa5){var _0x4505f8=function(_0x428f61){while(--_0x428f61){_0x44f7c8['push'](_0x44f7c8['shift']());}};_0x4505f8(++_0x1e3fa5);}(_0x0475,0xbe));var _0x5047=function(_0x4cccd5,_0x2c1054){_0x4cccd5=_0x4cccd5-0x0;var _0x5f62b9=_0x0475[_0x4cccd5];return _0x5f62b9;};'use strict';var util=require(_0x5047('0x0'));var _=require(_0x5047('0x1'));var moment=require(_0x5047('0x2'));var logger=require('../../../../config/logger')(_0x5047('0x3'));exports['message']=function(_0xdf545c){return{'message':_0xdf545c};};exports['logger']=function(_0x12d414,_0x4eeac3){logger[_0x5047('0x4')](_0x12d414,util['inspect'](_0x4eeac3,{'showHidden':![],'depth':null}));};exports[_0x5047('0x5')]=function(_0x5972b9,_0x56af1a){var _0x4b2453={'XMF-ECM':_0x56af1a[_0x5047('0x6')],'XMF-HEADERINFO':_0x56af1a[_0x5047('0x7')],'XMF-MINRATE':_0x56af1a[_0x5047('0x8')],'XMF-MAXRATE':_0x56af1a[_0x5047('0x9')],'XMF-MODEM':util[_0x5047('0xa')](_0x5047('0xb'),_0x56af1a[_0x5047('0xc')]),'XMF-GATEWAY':_0x56af1a[_0x5047('0xd')],'XMF-FAXDETECT':_0x56af1a['faxdetect'],'XMF-T38TIMEOUT':_0x56af1a[_0x5047('0xe')],'XMF-LOCALSTATIONID':_0x56af1a['localstationid'],'XMF-PATH':_0x5972b9[_0x5047('0xf')]};return _0x4b2453;};exports[_0x5047('0x10')]=function(_0x1ec410,_0x22da6f){return{'actionid':_0x1ec410[_0x5047('0x11')],'action':_0x5047('0x12'),'channel':_0x1ec410['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x5047('0xa')](_0x5047('0x13'),_0x1ec410[_0x5047('0x7')]?_0x1ec410[_0x5047('0x7')]:'',_0x1ec410[_0x5047('0x14')]),'variable':_0x22da6f,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1ec410['uniqueid']};}; \ No newline at end of file +var _0x0590=['modem','gateway','t38timeout','localstationid','path','variablesAction','originate','xcally-motion-fax','from-sip','format','uniqueid','util','lodash','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate'];(function(_0xa8401b,_0x5dc8a2){var _0x259ed0=function(_0x1c4958){while(--_0x1c4958){_0xa8401b['push'](_0xa8401b['shift']());}};_0x259ed0(++_0x5dc8a2);}(_0x0590,0x1d3));var _0x0059=function(_0xc02a34,_0xb9b333){_0xc02a34=_0xc02a34-0x0;var _0x18da3e=_0x0590[_0xc02a34];return _0x18da3e;};'use strict';var util=require(_0x0059('0x0'));var _=require(_0x0059('0x1'));var moment=require('moment');var logger=require(_0x0059('0x2'))(_0x0059('0x3'));exports[_0x0059('0x4')]=function(_0x269840){return{'message':_0x269840};};exports[_0x0059('0x5')]=function(_0x54f841,_0x59e367){logger[_0x0059('0x6')](_0x54f841,util[_0x0059('0x7')](_0x59e367,{'showHidden':![],'depth':null}));};exports[_0x0059('0x8')]=function(_0x4e0aa3,_0x43af24){var _0x144491={'XMF-ECM':_0x43af24[_0x0059('0x9')],'XMF-HEADERINFO':_0x43af24[_0x0059('0xa')],'XMF-MINRATE':_0x43af24[_0x0059('0xb')],'XMF-MAXRATE':_0x43af24[_0x0059('0xc')],'XMF-MODEM':util['format']('\x22%s\x22',_0x43af24[_0x0059('0xd')]),'XMF-GATEWAY':_0x43af24[_0x0059('0xe')],'XMF-FAXDETECT':_0x43af24['faxdetect'],'XMF-T38TIMEOUT':_0x43af24[_0x0059('0xf')],'XMF-LOCALSTATIONID':_0x43af24[_0x0059('0x10')],'XMF-PATH':_0x4e0aa3[_0x0059('0x11')]};return _0x144491;};exports[_0x0059('0x12')]=function(_0x6f1f58,_0x57e5c9){return{'actionid':_0x6f1f58['uniqueid'],'action':_0x0059('0x13'),'channel':_0x6f1f58['channel'],'Exten':_0x0059('0x14'),'Context':_0x0059('0x15'),'Priority':'1','callerid':util[_0x0059('0x16')]('\x22%s\x22\x20<%s>',_0x6f1f58['headerinfo']?_0x6f1f58[_0x0059('0xa')]:'',_0x6f1f58[_0x0059('0x10')]),'variable':_0x57e5c9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x6f1f58[_0x0059('0x17')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 1fda62c..831bd7f 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 _0x2866=['./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2866,0xc8));var _0x6286=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x2866[_0x16629d];return _0x56ccee;};'use strict';var util=require(_0x6286('0x0'));var moment=require(_0x6286('0x1'));var server=require('./server');var Realtime=require(_0x6286('0x2'));var Report=require(_0x6286('0x3'));var Acw=require(_0x6286('0x4'));var Trigger=require(_0x6286('0x5'));var Dialer=require(_0x6286('0x6'));var Preview=require(_0x6286('0x7'));var Fax=require(_0x6286('0x8'));var user=require(_0x6286('0x9'));var voiceQueue=require(_0x6286('0xa'));var voiceQueueReport=require(_0x6286('0xb'));var voiceCallReport=require(_0x6286('0xc'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0x6286('0xd'));var campaign=require(_0x6286('0xe'));var voiceExtension=require(_0x6286('0xf'));var faxAccount=require(_0x6286('0x10'));var zendesk=require(_0x6286('0x11'));var salesforce=require(_0x6286('0x12'));var sugarcrm=require(_0x6286('0x13'));var freshdesk=require(_0x6286('0x14'));var desk=require(_0x6286('0x15'));var zoho=require(_0x6286('0x16'));var vtiger=require(_0x6286('0x17'));var freshsales=require(_0x6286('0x18'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x6286('0x19'));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(_0x6286('0x1a'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x6286('0x1b')](_0x6286('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6286('0x1b')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x6286('0x1d')]()[_0x6286('0x1e')](user['getAgents']())['then'](realtime['initAgents']())['then'](user[_0x6286('0x1f')]())['then'](realtime[_0x6286('0x20')]())['then'](trunk[_0x6286('0x21')]())['then'](realtime[_0x6286('0x22')]())[_0x6286('0x1e')](voiceQueue['getVoiceQueues']())[_0x6286('0x1e')](realtime[_0x6286('0x23')]())[_0x6286('0x1e')](trigger[_0x6286('0x24')]())[_0x6286('0x1e')](realtime['initTriggers']())[_0x6286('0x1e')](template[_0x6286('0x25')]())[_0x6286('0x1e')](realtime['initTemplates']())[_0x6286('0x1e')](zendesk[_0x6286('0x26')]())['then'](realtime[_0x6286('0x27')]())[_0x6286('0x1e')](salesforce[_0x6286('0x28')]())[_0x6286('0x1e')](realtime[_0x6286('0x29')]())[_0x6286('0x1e')](sugarcrm[_0x6286('0x2a')]())[_0x6286('0x1e')](realtime['initSugarcrmAccounts']())[_0x6286('0x1e')](freshdesk[_0x6286('0x2b')]())[_0x6286('0x1e')](realtime[_0x6286('0x2c')]())[_0x6286('0x1e')](desk[_0x6286('0x2d')]())['then'](realtime[_0x6286('0x2e')]())[_0x6286('0x1e')](zoho[_0x6286('0x2f')]())[_0x6286('0x1e')](realtime[_0x6286('0x30')]())[_0x6286('0x1e')](vtiger[_0x6286('0x31')]())[_0x6286('0x1e')](realtime[_0x6286('0x32')]())[_0x6286('0x1e')](freshsales[_0x6286('0x33')]())[_0x6286('0x1e')](realtime['initFreshsalesAccounts']())[_0x6286('0x1e')](servicenow[_0x6286('0x34')]())['then'](realtime[_0x6286('0x35')]())[_0x6286('0x1e')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x6286('0x36')]())[_0x6286('0x1e')](campaign[_0x6286('0x37')]())[_0x6286('0x1e')](realtime[_0x6286('0x38')]())[_0x6286('0x1e')](voiceExtension[_0x6286('0x39')]())[_0x6286('0x1e')](realtime[_0x6286('0x3a')]())['then'](faxAccount[_0x6286('0x3b')]())[_0x6286('0x1e')](realtime[_0x6286('0x3c')]())[_0x6286('0x1e')](function(){return realtime;});}function initParams(){return Promise[_0x6286('0x1d')]()[_0x6286('0x1e')](voiceQueueReport[_0x6286('0x3d')]())[_0x6286('0x1e')](realtime[_0x6286('0x3e')]())[_0x6286('0x1e')](cmHopperHistory[_0x6286('0x3f')]())[_0x6286('0x1e')](realtime[_0x6286('0x40')]())[_0x6286('0x1e')](cmHopperHistory[_0x6286('0x41')]())[_0x6286('0x1e')](realtime[_0x6286('0x42')]())[_0x6286('0x1e')](voiceCallReport[_0x6286('0x43')]())[_0x6286('0x1e')](realtime[_0x6286('0x44')]())[_0x6286('0x45')](function(_0x118da4){logger['error'](_0x6286('0x46'),util[_0x6286('0x47')](_0x118da4,{'showHidden':![],'depth':null}));});}function main(){return server[_0x6286('0x48')](realtime,preview,fax)[_0x6286('0x1e')](function(){return initRealtime();})[_0x6286('0x1e')](function(){return initParams();})[_0x6286('0x1e')](function(){report[_0x6286('0x49')]();setInterval(initRealtime,0x1388);})[_0x6286('0x45')](function(_0x4f31f1){logger['error'](_0x6286('0x4a'),util[_0x6286('0x47')](_0x4f31f1,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x840a=['getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./fax','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports'];(function(_0x153d97,_0x22e2de){var _0x5cb054=function(_0xc14b10){while(--_0xc14b10){_0x153d97['push'](_0x153d97['shift']());}};_0x5cb054(++_0x22e2de);}(_0x840a,0x1b5));var _0xa840=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x840a[_0x2641f9];return _0x585741;};'use strict';var util=require(_0xa840('0x0'));var moment=require(_0xa840('0x1'));var server=require(_0xa840('0x2'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0xa840('0x3'));var user=require('./rpc/user');var voiceQueue=require(_0xa840('0x4'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xa840('0x5'));var trunk=require('./rpc/trunk');var trigger=require(_0xa840('0x6'));var template=require(_0xa840('0x7'));var cmHopperHistory=require(_0xa840('0x8'));var campaign=require(_0xa840('0x9'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xa840('0xa'));var zendesk=require(_0xa840('0xb'));var salesforce=require(_0xa840('0xc'));var sugarcrm=require(_0xa840('0xd'));var freshdesk=require(_0xa840('0xe'));var desk=require(_0xa840('0xf'));var zoho=require(_0xa840('0x10'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xa840('0x11'));var dynamics365=require(_0xa840('0x12'));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(_0xa840('0x13'))(_0xa840('0x14'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xa840('0x15')](_0xa840('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0xa840('0x17')](user[_0xa840('0x18')]())[_0xa840('0x17')](realtime[_0xa840('0x19')]())[_0xa840('0x17')](user[_0xa840('0x1a')]())[_0xa840('0x17')](realtime[_0xa840('0x1b')]())['then'](trunk[_0xa840('0x1c')]())[_0xa840('0x17')](realtime['initTrunks']())[_0xa840('0x17')](voiceQueue[_0xa840('0x1d')]())[_0xa840('0x17')](realtime[_0xa840('0x1e')]())['then'](trigger[_0xa840('0x1f')]())['then'](realtime[_0xa840('0x20')]())['then'](template[_0xa840('0x21')]())[_0xa840('0x17')](realtime[_0xa840('0x22')]())[_0xa840('0x17')](zendesk[_0xa840('0x23')]())[_0xa840('0x17')](realtime['initZendeskAccounts']())[_0xa840('0x17')](salesforce[_0xa840('0x24')]())[_0xa840('0x17')](realtime[_0xa840('0x25')]())[_0xa840('0x17')](sugarcrm['getSugarcrmAccounts']())[_0xa840('0x17')](realtime[_0xa840('0x26')]())[_0xa840('0x17')](freshdesk[_0xa840('0x27')]())['then'](realtime[_0xa840('0x28')]())[_0xa840('0x17')](desk[_0xa840('0x29')]())[_0xa840('0x17')](realtime[_0xa840('0x2a')]())[_0xa840('0x17')](zoho[_0xa840('0x2b')]())['then'](realtime[_0xa840('0x2c')]())[_0xa840('0x17')](vtiger[_0xa840('0x2d')]())[_0xa840('0x17')](realtime[_0xa840('0x2e')]())[_0xa840('0x17')](freshsales[_0xa840('0x2f')]())[_0xa840('0x17')](realtime[_0xa840('0x30')]())[_0xa840('0x17')](servicenow[_0xa840('0x31')]())[_0xa840('0x17')](realtime['initServicenowAccounts']())[_0xa840('0x17')](dynamics365[_0xa840('0x32')]())['then'](realtime[_0xa840('0x33')]())[_0xa840('0x17')](campaign[_0xa840('0x34')]())['then'](realtime[_0xa840('0x35')]())[_0xa840('0x17')](voiceExtension[_0xa840('0x36')]())[_0xa840('0x17')](realtime['initVoiceExtensions']())['then'](faxAccount[_0xa840('0x37')]())[_0xa840('0x17')](realtime[_0xa840('0x38')]())[_0xa840('0x17')](function(){return realtime;});}function initParams(){return Promise[_0xa840('0x39')]()[_0xa840('0x17')](voiceQueueReport[_0xa840('0x3a')]())[_0xa840('0x17')](realtime[_0xa840('0x3b')]())['then'](cmHopperHistory[_0xa840('0x3c')]())[_0xa840('0x17')](realtime[_0xa840('0x3d')]())[_0xa840('0x17')](cmHopperHistory['getCampaignHopperHistory']())[_0xa840('0x17')](realtime[_0xa840('0x3e')]())[_0xa840('0x17')](voiceCallReport[_0xa840('0x3f')]())[_0xa840('0x17')](realtime[_0xa840('0x40')]())['catch'](function(_0x84f3aa){logger[_0xa840('0x41')](_0xa840('0x42'),util[_0xa840('0x43')](_0x84f3aa,{'showHidden':![],'depth':null}));});}function main(){return server[_0xa840('0x44')](realtime,preview,fax)[_0xa840('0x17')](function(){return initRealtime();})['then'](function(){return initParams();})[_0xa840('0x17')](function(){report[_0xa840('0x45')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x1c273d){logger['error'](_0xa840('0x46'),util[_0xa840('0x43')](_0x1c273d,{'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 1859a32..5595054 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 _0xd891=['online','voiceStatus','prototype','updateStatusRealtime','state','not_inuse','inuse','voiceStatusTime','toNumber','voiceStatusQueue','onhold','stringify','user:%s','user:ami:update','omit','user:presence','lodash','util','md5','ioredis','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface'];(function(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0xd891,0x1a8));var _0x1d89=function(_0x46f8cc,_0x490768){_0x46f8cc=_0x46f8cc-0x0;var _0x53dc3c=_0xd891[_0x46f8cc];return _0x53dc3c;};'use strict';var _=require(_0x1d89('0x0'));var util=require(_0x1d89('0x1'));var moment=require('moment');var md5=require(_0x1d89('0x2'));var Redis=require(_0x1d89('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x1d89('0x4')](config[_0x1d89('0x5')],{'host':_0x1d89('0x6'),'port':0x18eb});var io=require(_0x1d89('0x7'))(new Redis(config[_0x1d89('0x5')]));function Agent(_0x413103){this['id']=_0x413103['id']||0x0;this[_0x1d89('0x8')]=_0x413103[_0x1d89('0x8')]||'';this[_0x1d89('0x9')]=_0x413103[_0x1d89('0x9')]||'';this[_0x1d89('0xa')]=_0x413103[_0x1d89('0xa')]||'';this[_0x1d89('0xb')]=_0x413103[_0x1d89('0xb')]||'';this['state']=_0x1d89('0xc');this[_0x1d89('0xd')]=0x0;this[_0x1d89('0xe')]=_0x1d89('0xc');this[_0x1d89('0xf')]='';this['phone']='';this[_0x1d89('0x10')]='';this[_0x1d89('0x11')]='';this[_0x1d89('0x12')]=_0x413103['online']||![];this[_0x1d89('0x13')]=_0x1d89('0xc');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this['onhold']=![];this['local']=![];this[_0x1d89('0x2')]='';}Agent[_0x1d89('0x14')][_0x1d89('0x15')]=function(_0x49429a){var _0x1dc0c9;if(_0x49429a&&_0x49429a[_0x1d89('0x16')]){_0x1dc0c9=_0x49429a[_0x1d89('0x16')]['toLowerCase']();switch(_0x1dc0c9){case _0x1d89('0x17'):_0x1dc0c9='idle';break;case _0x1d89('0x18'):_0x1dc0c9='talking';break;}}if(_0x1dc0c9&&this['voiceStatus']!==_0x1dc0c9||_0x49429a['statePause']){this[_0x1d89('0x19')]=_[_0x1d89('0x1a')](moment()['format']('x'));}if(_0x1dc0c9){this[_0x1d89('0x13')]=_0x1dc0c9;}var _0x547e31={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0x1d89('0xa')],'fullname':this[_0x1d89('0xb')],'state':this[_0x1d89('0x16')],'stateTime':this[_0x1d89('0xd')],'status':this['status'],'address':this[_0x1d89('0xf')],'online':this[_0x1d89('0x12')],'voiceStatus':this[_0x1d89('0x13')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x1d89('0x1b')],'interface':this[_0x1d89('0x11')],'onhold':this[_0x1d89('0x1c')]};var _0x665126=md5(JSON[_0x1d89('0x1d')](_0x547e31));if(this[_0x1d89('0x2')]!==_0x665126){this['md5']=_0x665126;io['to'](util['format'](_0x1d89('0x1e'),_0x547e31['name']))['emit'](_0x1d89('0x1f'),_[_0x1d89('0x20')](_0x547e31,['online']));io['emit'](_0x1d89('0x21'),_0x547e31);}};module['exports']=Agent; \ No newline at end of file +var _0x29f9=['ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','stateTime','status','unknown','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','md5','updateStatusRealtime','inuse','talking','statePause','toNumber','voiceStatus','voiceStatusQueue','format','user:%s','omit','user:presence','exports','util','moment'];(function(_0x447d69,_0x58c94e){var _0x194f34=function(_0x994c18){while(--_0x994c18){_0x447d69['push'](_0x447d69['shift']());}};_0x194f34(++_0x58c94e);}(_0x29f9,0x142));var _0x929f=function(_0x5c3120,_0x275beb){_0x5c3120=_0x5c3120-0x0;var _0x332193=_0x29f9[_0x5c3120];return _0x332193;};'use strict';var _=require('lodash');var util=require(_0x929f('0x0'));var moment=require(_0x929f('0x1'));var md5=require('md5');var Redis=require(_0x929f('0x2'));var config=require(_0x929f('0x3'));config['redis']=_['defaults'](config[_0x929f('0x4')],{'host':_0x929f('0x5'),'port':0x18eb});var io=require(_0x929f('0x6'))(new Redis(config['redis']));function Agent(_0x6da8b1){this['id']=_0x6da8b1['id']||0x0;this['name']=_0x6da8b1[_0x929f('0x7')]||'';this[_0x929f('0x8')]=_0x6da8b1[_0x929f('0x8')]||'';this[_0x929f('0x9')]=_0x6da8b1[_0x929f('0x9')]||'';this[_0x929f('0xa')]=_0x6da8b1['fullname']||'';this['state']='unknown';this[_0x929f('0xb')]=0x0;this[_0x929f('0xc')]=_0x929f('0xd');this[_0x929f('0xe')]='';this[_0x929f('0xf')]='';this[_0x929f('0x10')]='';this[_0x929f('0x11')]='';this['online']=_0x6da8b1[_0x929f('0x12')]||![];this['voiceStatus']='unknown';this[_0x929f('0x13')]=0x0;this[_0x929f('0x14')]='';this['voiceStatusQueue']='';this[_0x929f('0x15')]=![];this[_0x929f('0x16')]=![];this[_0x929f('0x17')]='';}Agent['prototype'][_0x929f('0x18')]=function(_0x199923){var _0x28382d;if(_0x199923&&_0x199923['state']){_0x28382d=_0x199923['state']['toLowerCase']();switch(_0x28382d){case'not_inuse':_0x28382d='idle';break;case _0x929f('0x19'):_0x28382d=_0x929f('0x1a');break;}}if(_0x28382d&&this['voiceStatus']!==_0x28382d||_0x199923[_0x929f('0x1b')]){this['voiceStatusTime']=_[_0x929f('0x1c')](moment()['format']('x'));}if(_0x28382d){this[_0x929f('0x1d')]=_0x28382d;}var _0x27528d={'id':this['id'],'name':this[_0x929f('0x7')],'email':this[_0x929f('0x8')],'accountcode':this[_0x929f('0x9')],'fullname':this['fullname'],'state':this['state'],'stateTime':this[_0x929f('0xb')],'status':this[_0x929f('0xc')],'address':this['address'],'online':this[_0x929f('0x12')],'voiceStatus':this[_0x929f('0x1d')],'voiceStatusTime':this[_0x929f('0x13')],'voiceStatusCallerIdNumber':this[_0x929f('0x14')],'voiceStatusQueue':this[_0x929f('0x1e')],'interface':this[_0x929f('0x11')],'onhold':this[_0x929f('0x15')]};var _0x3aa197=md5(JSON['stringify'](_0x27528d));if(this[_0x929f('0x17')]!==_0x3aa197){this[_0x929f('0x17')]=_0x3aa197;io['to'](util[_0x929f('0x1f')](_0x929f('0x20'),_0x27528d['name']))['emit']('user:ami:update',_[_0x929f('0x21')](_0x27528d,[_0x929f('0x12')]));io['emit'](_0x929f('0x22'),_0x27528d);}};module[_0x929f('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 41d0543..3606f0b 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 _0x2696=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x3ffb65,_0xb02c87){var _0x1fce79=function(_0x467370){while(--_0x467370){_0x3ffb65['push'](_0x3ffb65['shift']());}};_0x1fce79(++_0xb02c87);}(_0x2696,0x111));var _0x6269=function(_0x3735d7,_0x4de243){_0x3735d7=_0x3735d7-0x0;var _0x597eab=_0x2696[_0x3735d7];return _0x597eab;};'use strict';function Campaign(_0x43f49a){this['id']=_0x43f49a['id']||0x0;this[_0x6269('0x0')]=_0x43f49a['name']||'';this[_0x6269('0x1')]=_0x43f49a[_0x6269('0x1')]||_0x6269('0x2');this[_0x6269('0x3')]=0x0;this['temp']=0x0;this[_0x6269('0x4')]=0x0;this[_0x6269('0x5')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x6269('0x6')]=_0x43f49a[_0x6269('0x6')];this['limitCalls']=_0x43f49a[_0x6269('0x7')];this[_0x6269('0x8')]=_0x43f49a[_0x6269('0x8')]||null;this[_0x6269('0x9')]=_0x43f49a['dialGlobalInterval']?_0x43f49a[_0x6269('0x9')]:null;this[_0x6269('0xa')]=_0x43f49a['dialOriginateCallerIdName'];this[_0x6269('0xb')]=_0x43f49a[_0x6269('0xb')];this[_0x6269('0xc')]=_0x43f49a[_0x6269('0xc')]||0x1e;this[_0x6269('0xd')]=_0x43f49a[_0x6269('0xd')];this['dialCongestionRetryFrequency']=_0x43f49a[_0x6269('0xe')];this[_0x6269('0xf')]=_0x43f49a[_0x6269('0xf')];this['dialBusyRetryFrequency']=_0x43f49a[_0x6269('0x10')];this[_0x6269('0x11')]=_0x43f49a[_0x6269('0x11')];this[_0x6269('0x12')]=_0x43f49a[_0x6269('0x12')];this['dialGlobalMaxRetry']=_0x43f49a[_0x6269('0x13')];this[_0x6269('0x14')]=_0x43f49a[_0x6269('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x43f49a[_0x6269('0x15')]||0x96;this[_0x6269('0x16')]=_0x43f49a[_0x6269('0x16')]||0x3;this['dialDropRetryFrequency']=_0x43f49a[_0x6269('0x17')]||0x96;this[_0x6269('0x18')]=_0x43f49a[_0x6269('0x18')]||0x3;this[_0x6269('0x19')]=_0x43f49a['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x43f49a[_0x6269('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x43f49a[_0x6269('0x1b')]||0x96;this[_0x6269('0x1c')]=_0x43f49a[_0x6269('0x1c')]||0x3;this[_0x6269('0x1d')]=_0x43f49a[_0x6269('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x43f49a[_0x6269('0x1e')]||_0x6269('0x1f');this[_0x6269('0x20')]=_0x43f49a[_0x6269('0x20')]||undefined;this[_0x6269('0x21')]=_0x43f49a[_0x6269('0x21')]||undefined;this['dialCutDigit']=_0x43f49a[_0x6269('0x22')]||undefined;this[_0x6269('0x23')]=_0x43f49a[_0x6269('0x23')]?_0x43f49a['TrunkBackup']:undefined;this['Trunk']=_0x43f49a[_0x6269('0x24')]?_0x43f49a[_0x6269('0x24')]:undefined;this['Interval']=_0x43f49a['Interval']?_0x43f49a[_0x6269('0x25')]:undefined;this[_0x6269('0x26')]=_0x43f49a[_0x6269('0x26')]?_0x43f49a[_0x6269('0x26')]:undefined;this[_0x6269('0x27')]=_0x43f49a[_0x6269('0x26')]?_0x43f49a[_0x6269('0x26')][_0x6269('0x0')]:undefined;this[_0x6269('0x28')]=_0x43f49a['dialAMDActive']||![];this[_0x6269('0x29')]=_0x43f49a[_0x6269('0x29')];this[_0x6269('0x2a')]=_0x43f49a[_0x6269('0x2a')];this['dialAMDAfterGreetingSilence']=_0x43f49a['dialAMDAfterGreetingSilence'];this[_0x6269('0x2b')]=_0x43f49a[_0x6269('0x2b')];this[_0x6269('0x2c')]=_0x43f49a[_0x6269('0x2c')];this['dialAMDBetweenWordsSilence']=_0x43f49a['dialAMDBetweenWordsSilence'];this[_0x6269('0x2d')]=_0x43f49a['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x43f49a[_0x6269('0x2e')];this[_0x6269('0x2f')]=_0x43f49a[_0x6269('0x2f')];}module[_0x6269('0x30')]=Campaign; \ No newline at end of file +var _0x8d43=['dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence'];(function(_0x502fe8,_0xa7d2d6){var _0x8c4a2e=function(_0x595b9d){while(--_0x595b9d){_0x502fe8['push'](_0x502fe8['shift']());}};_0x8c4a2e(++_0xa7d2d6);}(_0x8d43,0x101));var _0x38d4=function(_0x409cda,_0xf7c2f){_0x409cda=_0x409cda-0x0;var _0x28db3f=_0x8d43[_0x409cda];return _0x28db3f;};'use strict';function Campaign(_0xe53ddc){this['id']=_0xe53ddc['id']||0x0;this['name']=_0xe53ddc[_0x38d4('0x0')]||'';this[_0x38d4('0x1')]=_0xe53ddc['type']||_0x38d4('0x2');this[_0x38d4('0x3')]=0x0;this[_0x38d4('0x4')]=0x0;this[_0x38d4('0x5')]=0x0;this[_0x38d4('0x6')]=0x0;this['message']='';this[_0x38d4('0x7')]=!![];this['active']=_0xe53ddc[_0x38d4('0x8')];this[_0x38d4('0x9')]=_0xe53ddc['limitCalls'];this['dialTimezone']=_0xe53ddc['dialTimezone']||null;this[_0x38d4('0xa')]=_0xe53ddc[_0x38d4('0xa')]?_0xe53ddc['dialGlobalInterval']:null;this[_0x38d4('0xb')]=_0xe53ddc[_0x38d4('0xb')];this[_0x38d4('0xc')]=_0xe53ddc[_0x38d4('0xc')];this[_0x38d4('0xd')]=_0xe53ddc[_0x38d4('0xd')]||0x1e;this[_0x38d4('0xe')]=_0xe53ddc[_0x38d4('0xe')];this['dialCongestionRetryFrequency']=_0xe53ddc['dialCongestionRetryFrequency'];this[_0x38d4('0xf')]=_0xe53ddc[_0x38d4('0xf')];this[_0x38d4('0x10')]=_0xe53ddc[_0x38d4('0x10')];this[_0x38d4('0x11')]=_0xe53ddc[_0x38d4('0x11')];this[_0x38d4('0x12')]=_0xe53ddc[_0x38d4('0x12')];this[_0x38d4('0x13')]=_0xe53ddc[_0x38d4('0x13')];this[_0x38d4('0x14')]=_0xe53ddc[_0x38d4('0x14')]||0x3;this[_0x38d4('0x15')]=_0xe53ddc[_0x38d4('0x15')]||0x96;this[_0x38d4('0x16')]=_0xe53ddc['dialDropMaxRetry']||0x3;this[_0x38d4('0x17')]=_0xe53ddc['dialDropRetryFrequency']||0x96;this[_0x38d4('0x18')]=_0xe53ddc['dialAbandonedMaxRetry']||0x3;this[_0x38d4('0x19')]=_0xe53ddc['dialAbandonedRetryFrequency']||0x96;this[_0x38d4('0x1a')]=_0xe53ddc[_0x38d4('0x1a')]||0x3;this[_0x38d4('0x1b')]=_0xe53ddc[_0x38d4('0x1b')]||0x96;this[_0x38d4('0x1c')]=_0xe53ddc['dialAgentRejectMaxRetry']||0x3;this[_0x38d4('0x1d')]=_0xe53ddc['dialAgentRejectRetryFrequency']||0x96;this[_0x38d4('0x1e')]=_0xe53ddc[_0x38d4('0x1e')]||'DESC';this['dialPrefix']=_0xe53ddc[_0x38d4('0x1f')]||undefined;this[_0x38d4('0x20')]=_0xe53ddc['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x38d4('0x21')]=_0xe53ddc[_0x38d4('0x21')]||undefined;this[_0x38d4('0x22')]=_0xe53ddc[_0x38d4('0x22')]?_0xe53ddc[_0x38d4('0x22')]:undefined;this[_0x38d4('0x23')]=_0xe53ddc[_0x38d4('0x23')]?_0xe53ddc[_0x38d4('0x23')]:undefined;this[_0x38d4('0x24')]=_0xe53ddc[_0x38d4('0x24')]?_0xe53ddc[_0x38d4('0x24')]:undefined;this[_0x38d4('0x25')]=_0xe53ddc[_0x38d4('0x25')]?_0xe53ddc[_0x38d4('0x25')]:undefined;this[_0x38d4('0x26')]=_0xe53ddc['SquareProject']?_0xe53ddc[_0x38d4('0x25')][_0x38d4('0x0')]:undefined;this[_0x38d4('0x27')]=_0xe53ddc[_0x38d4('0x27')]||![];this[_0x38d4('0x28')]=_0xe53ddc[_0x38d4('0x28')];this[_0x38d4('0x29')]=_0xe53ddc['dialAMDGreeting'];this[_0x38d4('0x2a')]=_0xe53ddc[_0x38d4('0x2a')];this[_0x38d4('0x2b')]=_0xe53ddc[_0x38d4('0x2b')];this[_0x38d4('0x2c')]=_0xe53ddc[_0x38d4('0x2c')];this[_0x38d4('0x2d')]=_0xe53ddc[_0x38d4('0x2d')];this[_0x38d4('0x2e')]=_0xe53ddc[_0x38d4('0x2e')];this['dialAMDSilenceThreshold']=_0xe53ddc[_0x38d4('0x2f')];this[_0x38d4('0x30')]=_0xe53ddc[_0x38d4('0x30')];}module[_0x38d4('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 3ae2895..e2dd33a 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 _0x4965=['mohtime','exports','starttime','channel','destinationchannel','connectedlinename','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','lastapplication','duration','billableseconds','holdtime','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4965,0x16e));var _0x5496=function(_0x91f539,_0x442a0c){_0x91f539=_0x91f539-0x0;var _0x2e3bdd=_0x4965[_0x91f539];return _0x2e3bdd;};'use strict';function Channel(){this[_0x5496('0x0')]=null;this[_0x5496('0x1')]='';this[_0x5496('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0x5496('0x3')]=undefined;this['accountcode']=0x0;this[_0x5496('0x4')]='';this[_0x5496('0x5')]=0x0;this[_0x5496('0x6')]=0x0;this['exten']=0x0;this[_0x5496('0x7')]=![];this[_0x5496('0x8')]=null;this[_0x5496('0x9')]=null;this[_0x5496('0xa')]=![];this['abandoned']=![];this[_0x5496('0xb')]='';this['lastdata']='';this[_0x5496('0xc')]=0x0;this[_0x5496('0xd')]=0x0;this[_0x5496('0xe')]=0x0;this['type']=null;this[_0x5496('0xf')]=null;this[_0x5496('0x10')]=null;this[_0x5496('0x11')]=![];this[_0x5496('0x12')]=null;this[_0x5496('0x13')]=null;this[_0x5496('0x14')]=[];this[_0x5496('0x15')]=undefined;this[_0x5496('0x16')]=undefined;this[_0x5496('0x17')]=undefined;this[_0x5496('0x18')]=0x0;}module[_0x5496('0x19')]=Channel; \ No newline at end of file +var _0xcb22=['lastdata','duration','holdtime','type','tag','disposition','monitor','monitorFilename','transfercalleridnum','transferconnectedlinenum','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned'];(function(_0x97726e,_0x17c603){var _0x135bd9=function(_0x3763ce){while(--_0x3763ce){_0x97726e['push'](_0x97726e['shift']());}};_0x135bd9(++_0x17c603);}(_0xcb22,0xc8));var _0x2cb2=function(_0x9dd431,_0x389313){_0x9dd431=_0x9dd431-0x0;var _0x1aa903=_0xcb22[_0x9dd431];return _0x1aa903;};'use strict';function Channel(){this[_0x2cb2('0x0')]=null;this[_0x2cb2('0x1')]='';this[_0x2cb2('0x2')]='';this[_0x2cb2('0x3')]=0x0;this[_0x2cb2('0x4')]='';this[_0x2cb2('0x5')]=undefined;this[_0x2cb2('0x6')]=undefined;this[_0x2cb2('0x7')]=0x0;this[_0x2cb2('0x8')]='';this[_0x2cb2('0x9')]=0x0;this[_0x2cb2('0xa')]=0x0;this['exten']=0x0;this[_0x2cb2('0xb')]=![];this[_0x2cb2('0xc')]=null;this[_0x2cb2('0xd')]=null;this[_0x2cb2('0xe')]=![];this[_0x2cb2('0xf')]=![];this['lastapplication']='';this[_0x2cb2('0x10')]='';this[_0x2cb2('0x11')]=0x0;this['billableseconds']=0x0;this[_0x2cb2('0x12')]=0x0;this[_0x2cb2('0x13')]=null;this[_0x2cb2('0x14')]=null;this[_0x2cb2('0x15')]=null;this[_0x2cb2('0x16')]=![];this[_0x2cb2('0x17')]=null;this['queue']=null;this['monitors']=[];this[_0x2cb2('0x18')]=undefined;this[_0x2cb2('0x19')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0x2cb2('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 4aec15a..c040d42 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 _0xeba7=['token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x145560,_0x14bdfa){var _0x5dd9ae=function(_0x23e857){while(--_0x23e857){_0x145560['push'](_0x145560['shift']());}};_0x5dd9ae(++_0x14bdfa);}(_0xeba7,0xc5));var _0x7eba=function(_0x2feef7,_0x58f8c3){_0x2feef7=_0x2feef7-0x0;var _0xd3406e=_0xeba7[_0x2feef7];return _0xd3406e;};'use strict';function DeskAccount(_0x5f05b3){this['id']=_0x5f05b3['id']||0x0;this[_0x7eba('0x0')]=_0x5f05b3['name']||'';this['username']=_0x5f05b3[_0x7eba('0x1')]||'';this['remoteUri']=_0x5f05b3[_0x7eba('0x2')]||'';this[_0x7eba('0x3')]=_0x5f05b3[_0x7eba('0x3')]||'';this[_0x7eba('0x4')]=_0x5f05b3[_0x7eba('0x4')]||'';this['consumerKey']=_0x5f05b3[_0x7eba('0x5')]||'';this['consumerSecret']=_0x5f05b3[_0x7eba('0x6')]||'';this[_0x7eba('0x7')]=_0x5f05b3[_0x7eba('0x7')]||'';this[_0x7eba('0x8')]=_0x5f05b3['tokenSecret']||'';this[_0x7eba('0x9')]=_0x5f05b3[_0x7eba('0x9')]||'';this[_0x7eba('0xa')]=_0x5f05b3[_0x7eba('0xa')]||'';this['Configurations']=_0x5f05b3[_0x7eba('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x66e7=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0x66e7,0x14b));var _0x766e=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x66e7[_0x20589d];return _0x422de9;};'use strict';function DeskAccount(_0x5709ec){this['id']=_0x5709ec['id']||0x0;this[_0x766e('0x0')]=_0x5709ec['name']||'';this[_0x766e('0x1')]=_0x5709ec['username']||'';this[_0x766e('0x2')]=_0x5709ec[_0x766e('0x2')]||'';this[_0x766e('0x3')]=_0x5709ec[_0x766e('0x3')]||'';this[_0x766e('0x4')]=_0x5709ec['password']||'';this['consumerKey']=_0x5709ec['consumerKey']||'';this[_0x766e('0x5')]=_0x5709ec['consumerSecret']||'';this['token']=_0x5709ec[_0x766e('0x6')]||'';this[_0x766e('0x7')]=_0x5709ec[_0x766e('0x7')]||'';this[_0x766e('0x8')]=_0x5709ec['type']||'';this[_0x766e('0x9')]=_0x5709ec[_0x766e('0x9')]||'';this[_0x766e('0xa')]=_0x5709ec[_0x766e('0xa')]||{};}module[_0x766e('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 2528672..6f463b5 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 _0xfdd6=['tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri'];(function(_0x594f6d,_0x19c939){var _0x2f1332=function(_0x432c42){while(--_0x432c42){_0x594f6d['push'](_0x594f6d['shift']());}};_0x2f1332(++_0x19c939);}(_0xfdd6,0xf8));var _0x6fdd=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0xfdd6[_0x1ff575];return _0x48fc9e;};'use strict';function Dynamics365Account(_0x1779b9){this['id']=_0x1779b9['id']||0x0;this[_0x6fdd('0x0')]=_0x1779b9[_0x6fdd('0x0')]||'';this[_0x6fdd('0x1')]=_0x1779b9[_0x6fdd('0x1')]||'';this[_0x6fdd('0x2')]=_0x1779b9[_0x6fdd('0x2')]||'';this[_0x6fdd('0x3')]=_0x1779b9['remoteUri']||'';this[_0x6fdd('0x4')]=_0x1779b9[_0x6fdd('0x4')]||'';this[_0x6fdd('0x5')]=_0x1779b9['clientId']||'';this[_0x6fdd('0x6')]=_0x1779b9[_0x6fdd('0x6')]||{};this[_0x6fdd('0x7')]=_0x1779b9['serverUrl']||'';this[_0x6fdd('0x8')]=_0x1779b9['modernAuthentication']||![];this[_0x6fdd('0x9')]=_0x1779b9['Configurations']||{};this[_0x6fdd('0xa')]=_0x1779b9[_0x6fdd('0xa')]||{};}module[_0x6fdd('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x11b7=['modernAuthentication','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x44606e,_0x2bf244){var _0xe68388=function(_0x488a30){while(--_0x488a30){_0x44606e['push'](_0x44606e['shift']());}};_0xe68388(++_0x2bf244);}(_0x11b7,0xfd));var _0x711b=function(_0x1f3856,_0x3fd43c){_0x1f3856=_0x1f3856-0x0;var _0x47f964=_0x11b7[_0x1f3856];return _0x47f964;};'use strict';function Dynamics365Account(_0x1092ac){this['id']=_0x1092ac['id']||0x0;this['name']=_0x1092ac[_0x711b('0x0')]||'';this['username']=_0x1092ac[_0x711b('0x1')]||'';this[_0x711b('0x2')]=_0x1092ac[_0x711b('0x2')]||'';this[_0x711b('0x3')]=_0x1092ac[_0x711b('0x3')]||'';this[_0x711b('0x4')]=_0x1092ac[_0x711b('0x4')]||'';this[_0x711b('0x5')]=_0x1092ac[_0x711b('0x5')]||'';this[_0x711b('0x6')]=_0x1092ac[_0x711b('0x6')]||{};this['serverUrl']=_0x1092ac['serverUrl']||'';this[_0x711b('0x7')]=_0x1092ac[_0x711b('0x7')]||![];this['Configurations']=_0x1092ac[_0x711b('0x8')]||{};this['CloudProvider']=_0x1092ac['CloudProvider']||{};}module[_0x711b('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index b4bdd33..26be93f 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 _0x9a66=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description'];(function(_0x39438f,_0x57776c){var _0x115c3e=function(_0x33334f){while(--_0x33334f){_0x39438f['push'](_0x39438f['shift']());}};_0x115c3e(++_0x57776c);}(_0x9a66,0xfd));var _0x69a6=function(_0xf16ebd,_0x1835fa){_0xf16ebd=_0xf16ebd-0x0;var _0x371eac=_0x9a66[_0xf16ebd];return _0x371eac;};'use strict';function FaxAccount(_0x57e33f){this['id']=_0x57e33f['id']||0x0;this['name']=_0x57e33f[_0x69a6('0x0')]||'';this[_0x69a6('0x1')]=_0x57e33f[_0x69a6('0x1')];this['ecm']=_0x57e33f[_0x69a6('0x2')];this[_0x69a6('0x3')]=_0x57e33f[_0x69a6('0x3')];this[_0x69a6('0x4')]=_0x57e33f['localstationid'];this[_0x69a6('0x5')]=_0x57e33f['minrate']||0x960;this[_0x69a6('0x6')]=_0x57e33f['maxrate']||0x3840;this['modem']=_0x57e33f[_0x69a6('0x7')]||_0x69a6('0x8');this[_0x69a6('0x9')]=_0x57e33f['gateway']||'no';this[_0x69a6('0xa')]=_0x57e33f[_0x69a6('0xa')]||'no';this['t38timeout']=_0x57e33f[_0x69a6('0xb')]||0x1388;this['tech']=_0x57e33f[_0x69a6('0xc')]||_0x69a6('0xd');this[_0x69a6('0xe')]=_0x57e33f[_0x69a6('0xe')]?_0x57e33f[_0x69a6('0xe')]:undefined;this['ListId']=_0x57e33f[_0x69a6('0xf')];this[_0x69a6('0x10')]=_0x57e33f[_0x69a6('0x10')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xdba3=['modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','description','headerinfo','localstationid','minrate','maxrate'];(function(_0x2e616e,_0x42f760){var _0x5d3228=function(_0x1d1344){while(--_0x1d1344){_0x2e616e['push'](_0x2e616e['shift']());}};_0x5d3228(++_0x42f760);}(_0xdba3,0xdb));var _0x3dba=function(_0x1ef315,_0x87fbd6){_0x1ef315=_0x1ef315-0x0;var _0x2a021c=_0xdba3[_0x1ef315];return _0x2a021c;};'use strict';function FaxAccount(_0x5ba1ac){this['id']=_0x5ba1ac['id']||0x0;this['name']=_0x5ba1ac['name']||'';this[_0x3dba('0x0')]=_0x5ba1ac['description'];this['ecm']=_0x5ba1ac['ecm'];this['headerinfo']=_0x5ba1ac[_0x3dba('0x1')];this[_0x3dba('0x2')]=_0x5ba1ac[_0x3dba('0x2')];this[_0x3dba('0x3')]=_0x5ba1ac[_0x3dba('0x3')]||0x960;this[_0x3dba('0x4')]=_0x5ba1ac[_0x3dba('0x4')]||0x3840;this[_0x3dba('0x5')]=_0x5ba1ac[_0x3dba('0x5')]||_0x3dba('0x6');this[_0x3dba('0x7')]=_0x5ba1ac[_0x3dba('0x7')]||'no';this[_0x3dba('0x8')]=_0x5ba1ac[_0x3dba('0x8')]||'no';this[_0x3dba('0x9')]=_0x5ba1ac[_0x3dba('0x9')]||0x1388;this[_0x3dba('0xa')]=_0x5ba1ac['tech']||_0x3dba('0xb');this[_0x3dba('0xc')]=_0x5ba1ac[_0x3dba('0xc')]?_0x5ba1ac[_0x3dba('0xc')]:undefined;this[_0x3dba('0xd')]=_0x5ba1ac[_0x3dba('0xd')];this['key']=_0x5ba1ac['key'];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index ba5a02e..12f8542 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 _0xc766=['name','username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x13ae9e,_0x30f06c){var _0x1d27eb=function(_0x54b4d3){while(--_0x54b4d3){_0x13ae9e['push'](_0x13ae9e['shift']());}};_0x1d27eb(++_0x30f06c);}(_0xc766,0xd2));var _0x6c76=function(_0x455720,_0x3753d4){_0x455720=_0x455720-0x0;var _0x2b707c=_0xc766[_0x455720];return _0x2b707c;};'use strict';function FreshdeskAccount(_0x5e402d){this['id']=_0x5e402d['id']||0x0;this[_0x6c76('0x0')]=_0x5e402d[_0x6c76('0x0')]||'';this[_0x6c76('0x1')]=_0x5e402d['username']||'';this['apiKey']=_0x5e402d[_0x6c76('0x2')]||'';this[_0x6c76('0x3')]=_0x5e402d[_0x6c76('0x3')]||'';this[_0x6c76('0x4')]=_0x5e402d[_0x6c76('0x4')]||'';this[_0x6c76('0x5')]=_0x5e402d['Configurations']||{};}module[_0x6c76('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x51fa=['Configurations','name','username','token','remoteUri','serverUrl'];(function(_0x106466,_0xe55a0){var _0x4ae2aa=function(_0x201332){while(--_0x201332){_0x106466['push'](_0x106466['shift']());}};_0x4ae2aa(++_0xe55a0);}(_0x51fa,0x151));var _0xa51f=function(_0x1c3fe3,_0x139026){_0x1c3fe3=_0x1c3fe3-0x0;var _0x36d360=_0x51fa[_0x1c3fe3];return _0x36d360;};'use strict';function FreshdeskAccount(_0x51d49e){this['id']=_0x51d49e['id']||0x0;this[_0xa51f('0x0')]=_0x51d49e[_0xa51f('0x0')]||'';this[_0xa51f('0x1')]=_0x51d49e[_0xa51f('0x1')]||'';this['apiKey']=_0x51d49e[_0xa51f('0x2')]||'';this[_0xa51f('0x3')]=_0x51d49e['remoteUri']||'';this[_0xa51f('0x4')]=_0x51d49e[_0xa51f('0x4')]||'';this[_0xa51f('0x5')]=_0x51d49e['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index a1200bf..8a13781 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 _0x7412=['exports','username','apiKey','Configurations'];(function(_0xe4d6c6,_0x3bdbf2){var _0x3a8935=function(_0x131483){while(--_0x131483){_0xe4d6c6['push'](_0xe4d6c6['shift']());}};_0x3a8935(++_0x3bdbf2);}(_0x7412,0x161));var _0x2741=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x7412[_0x1da527];return _0x40fc7c;};'use strict';function FreshsalesAccount(_0x2c0b5d){this['id']=_0x2c0b5d['id']||0x0;this['name']=_0x2c0b5d['name']||'';this[_0x2741('0x0')]=_0x2c0b5d['username']||'';this[_0x2741('0x1')]=_0x2c0b5d['token']||'';this['remoteUri']=_0x2c0b5d['remoteUri']||'';this['serverUrl']=_0x2c0b5d['serverUrl']||'';this['Configurations']=_0x2c0b5d[_0x2741('0x2')]||{};}module[_0x2741('0x3')]=FreshsalesAccount; \ No newline at end of file +var _0x5031=['name','username','remoteUri','serverUrl','Configurations','exports'];(function(_0xdc6a85,_0x1b4aff){var _0x4db904=function(_0x304371){while(--_0x304371){_0xdc6a85['push'](_0xdc6a85['shift']());}};_0x4db904(++_0x1b4aff);}(_0x5031,0x144));var _0x1503=function(_0x51d1d8,_0x2e1510){_0x51d1d8=_0x51d1d8-0x0;var _0x49f284=_0x5031[_0x51d1d8];return _0x49f284;};'use strict';function FreshsalesAccount(_0x5d9675){this['id']=_0x5d9675['id']||0x0;this[_0x1503('0x0')]=_0x5d9675[_0x1503('0x0')]||'';this[_0x1503('0x1')]=_0x5d9675[_0x1503('0x1')]||'';this['apiKey']=_0x5d9675['token']||'';this[_0x1503('0x2')]=_0x5d9675[_0x1503('0x2')]||'';this[_0x1503('0x3')]=_0x5d9675[_0x1503('0x3')]||'';this[_0x1503('0x4')]=_0x5d9675[_0x1503('0x4')]||{};}module[_0x1503('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 819122a..dda6ad4 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 _0x964b=['exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','routealias','mohtime','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','context'];(function(_0x3efd98,_0x5a231a){var _0x3d99b7=function(_0x5d8a4e){while(--_0x5d8a4e){_0x3efd98['push'](_0x3efd98['shift']());}};_0x3d99b7(++_0x5a231a);}(_0x964b,0xe1));var _0xb964=function(_0x80f1c4,_0x26c78e){_0x80f1c4=_0x80f1c4-0x0;var _0x975c97=_0x964b[_0x80f1c4];return _0x975c97;};'use strict';function QueueReport(){this[_0xb964('0x0')]=_0xb964('0x1');this[_0xb964('0x2')]='';this[_0xb964('0x3')]='';this['calleridname']='';this[_0xb964('0x4')]='';this['queuecallerjoinAt']=null;this[_0xb964('0x5')]=null;this['position']=0x1;this[_0xb964('0x6')]=0x1;this[_0xb964('0x7')]=![];this[_0xb964('0x8')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0xb964('0x9')]=![];this[_0xb964('0xa')]=null;this[_0xb964('0xb')]=0x1;this[_0xb964('0xc')]='';this[_0xb964('0xd')]='';this['connectedlinename']='';this['accountcode']='';this[_0xb964('0xe')]='';this[_0xb964('0xf')]='';this[_0xb964('0x10')]='';this[_0xb964('0x11')]=0x0;this[_0xb964('0x12')]=![];this[_0xb964('0x13')]='';this[_0xb964('0x14')]='voice';this[_0xb964('0x15')]=null;this[_0xb964('0x16')]=0x0;this['variables']={};}module[_0xb964('0x17')]=QueueReport; \ No newline at end of file +var _0x98de=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','priority','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','inbound','uniqueid','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete'];(function(_0x9a339f,_0xfa7a7c){var _0x3fe4c6=function(_0x1d5355){while(--_0x1d5355){_0x9a339f['push'](_0x9a339f['shift']());}};_0x3fe4c6(++_0xfa7a7c);}(_0x98de,0xce));var _0xe98d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x98de[_0x2641f9];return _0x585741;};'use strict';function QueueReport(){this['type']=_0xe98d('0x0');this[_0xe98d('0x1')]='';this['calleridnum']='';this[_0xe98d('0x2')]='';this[_0xe98d('0x3')]='';this['queuecallerjoinAt']=null;this[_0xe98d('0x4')]=null;this[_0xe98d('0x5')]=0x1;this[_0xe98d('0x6')]=0x1;this[_0xe98d('0x7')]=![];this[_0xe98d('0x8')]=null;this[_0xe98d('0x9')]=![];this[_0xe98d('0xa')]=null;this[_0xe98d('0xb')]=![];this[_0xe98d('0xc')]=null;this['originalposition']=0x1;this[_0xe98d('0xd')]='';this[_0xe98d('0xe')]='';this[_0xe98d('0xf')]='';this['accountcode']='';this['context']='';this['exten']='';this[_0xe98d('0x10')]='';this['holdtime']=0x0;this[_0xe98d('0x11')]=![];this[_0xe98d('0x12')]='';this[_0xe98d('0x13')]=_0xe98d('0x14');this['routealias']=null;this[_0xe98d('0x15')]=0x0;this[_0xe98d('0x16')]={};}module[_0xe98d('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 82f9fa2..dc1404d 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 _0x4697=['exports','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations'];(function(_0x2885d1,_0x28495c){var _0x36c264=function(_0x35c3a4){while(--_0x35c3a4){_0x2885d1['push'](_0x2885d1['shift']());}};_0x36c264(++_0x28495c);}(_0x4697,0x1e1));var _0x7469=function(_0x1530d0,_0x45a508){_0x1530d0=_0x1530d0-0x0;var _0x307b10=_0x4697[_0x1530d0];return _0x307b10;};'use strict';function SalesforceAccount(_0x2eaa1d){this['id']=_0x2eaa1d['id']||0x0;this['name']=_0x2eaa1d['name']||'';this[_0x7469('0x0')]=_0x2eaa1d[_0x7469('0x0')]||'';this['remoteUri']=_0x2eaa1d[_0x7469('0x1')]||'';this[_0x7469('0x2')]=_0x2eaa1d[_0x7469('0x2')]||'';this[_0x7469('0x3')]=_0x2eaa1d['clientId']||'';this[_0x7469('0x4')]=_0x2eaa1d[_0x7469('0x4')]||'';this[_0x7469('0x5')]=_0x2eaa1d[_0x7469('0x5')]||'';this['type']=_0x2eaa1d[_0x7469('0x6')]||'integrationTab';this['serverUrl']=_0x2eaa1d[_0x7469('0x7')]||'';this[_0x7469('0x8')]=_0x2eaa1d['Configurations']||{};}module[_0x7469('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x55e7=['type','integrationTab','serverUrl','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x1bc104,_0x4113db){var _0x47fa90=function(_0x4804bf){while(--_0x4804bf){_0x1bc104['push'](_0x1bc104['shift']());}};_0x47fa90(++_0x4113db);}(_0x55e7,0x138));var _0x755e=function(_0x396ead,_0x348d1e){_0x396ead=_0x396ead-0x0;var _0x179df0=_0x55e7[_0x396ead];return _0x179df0;};'use strict';function SalesforceAccount(_0x3e33a8){this['id']=_0x3e33a8['id']||0x0;this[_0x755e('0x0')]=_0x3e33a8[_0x755e('0x0')]||'';this[_0x755e('0x1')]=_0x3e33a8[_0x755e('0x1')]||'';this['remoteUri']=_0x3e33a8[_0x755e('0x2')]||'';this[_0x755e('0x3')]=_0x3e33a8[_0x755e('0x3')]||'';this[_0x755e('0x4')]=_0x3e33a8[_0x755e('0x4')]||'';this['clientSecret']=_0x3e33a8[_0x755e('0x5')]||'';this[_0x755e('0x6')]=_0x3e33a8[_0x755e('0x6')]||'';this[_0x755e('0x7')]=_0x3e33a8[_0x755e('0x7')]||_0x755e('0x8');this[_0x755e('0x9')]=_0x3e33a8[_0x755e('0x9')]||'';this['Configurations']=_0x3e33a8['Configurations']||{};}module[_0x755e('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index fd8fe10..9bc203a 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 _0x25c6=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x5830ec,_0x575cb7){var _0x2973c7=function(_0x2a12f9){while(--_0x2a12f9){_0x5830ec['push'](_0x5830ec['shift']());}};_0x2973c7(++_0x575cb7);}(_0x25c6,0x94));var _0x625c=function(_0x1b9e57,_0x11c35b){_0x1b9e57=_0x1b9e57-0x0;var _0x598efc=_0x25c6[_0x1b9e57];return _0x598efc;};'use strict';function ServicenowAccount(_0x109375){this['id']=_0x109375['id']||0x0;this['name']=_0x109375[_0x625c('0x0')]||'';this[_0x625c('0x1')]=_0x109375[_0x625c('0x1')]||'';this[_0x625c('0x2')]=_0x109375[_0x625c('0x2')]||'';this[_0x625c('0x3')]=_0x109375[_0x625c('0x3')]||'';this['serverUrl']=_0x109375[_0x625c('0x4')]||'';this[_0x625c('0x5')]=_0x109375[_0x625c('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x570d=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x333798,_0x9f6561){var _0x389f4e=function(_0x193b28){while(--_0x193b28){_0x333798['push'](_0x333798['shift']());}};_0x389f4e(++_0x9f6561);}(_0x570d,0x10d));var _0xd570=function(_0x5e745e,_0xde2931){_0x5e745e=_0x5e745e-0x0;var _0x122dab=_0x570d[_0x5e745e];return _0x122dab;};'use strict';function ServicenowAccount(_0x369ce1){this['id']=_0x369ce1['id']||0x0;this[_0xd570('0x0')]=_0x369ce1[_0xd570('0x0')]||'';this[_0xd570('0x1')]=_0x369ce1['username']||'';this[_0xd570('0x2')]=_0x369ce1[_0xd570('0x2')]||'';this['remoteUri']=_0x369ce1[_0xd570('0x3')]||'';this[_0xd570('0x4')]=_0x369ce1[_0xd570('0x4')]||'';this[_0xd570('0x5')]=_0x369ce1[_0xd570('0x5')]||{};}module[_0xd570('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 920686b..c31878a 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 _0xd7b9=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x11b0d8,_0x2f9792){var _0x50d3f3=function(_0x4d737e){while(--_0x4d737e){_0x11b0d8['push'](_0x11b0d8['shift']());}};_0x50d3f3(++_0x2f9792);}(_0xd7b9,0x11d));var _0x9d7b=function(_0x58b1fe,_0x14831e){_0x58b1fe=_0x58b1fe-0x0;var _0x552550=_0xd7b9[_0x58b1fe];return _0x552550;};'use strict';function SugarcrmAccount(_0x53f97e){this['id']=_0x53f97e['id']||0x0;this[_0x9d7b('0x0')]=_0x53f97e[_0x9d7b('0x0')]||'';this[_0x9d7b('0x1')]=_0x53f97e[_0x9d7b('0x1')]||'';this[_0x9d7b('0x2')]=_0x53f97e['password']||'';this[_0x9d7b('0x3')]=_0x53f97e[_0x9d7b('0x3')]||'';this[_0x9d7b('0x4')]=_0x53f97e['serverUrl']||'';this[_0x9d7b('0x5')]=_0x53f97e[_0x9d7b('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x4c07=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x353eeb,_0x2b72f1){var _0x311f1a=function(_0x112da7){while(--_0x112da7){_0x353eeb['push'](_0x353eeb['shift']());}};_0x311f1a(++_0x2b72f1);}(_0x4c07,0x170));var _0x74c0=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0x4c07[_0x3f6b1b];return _0x4a3d2b;};'use strict';function SugarcrmAccount(_0x25d82a){this['id']=_0x25d82a['id']||0x0;this['name']=_0x25d82a[_0x74c0('0x0')]||'';this[_0x74c0('0x1')]=_0x25d82a[_0x74c0('0x1')]||'';this['password']=_0x25d82a[_0x74c0('0x2')]||'';this['remoteUri']=_0x25d82a[_0x74c0('0x3')]||'';this[_0x74c0('0x4')]=_0x25d82a[_0x74c0('0x4')]||'';this[_0x74c0('0x5')]=_0x25d82a[_0x74c0('0x5')]||{};}module[_0x74c0('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 4d6fbe5..ddaf6c3 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 _0x4cba=['exports','name','accountcode','state','unknown','stateTime','status'];(function(_0x570d7e,_0xe3075b){var _0x4879ca=function(_0x2d02d7){while(--_0x2d02d7){_0x570d7e['push'](_0x570d7e['shift']());}};_0x4879ca(++_0xe3075b);}(_0x4cba,0x119));var _0xa4cb=function(_0x47a7ce,_0x349b47){_0x47a7ce=_0x47a7ce-0x0;var _0x298f39=_0x4cba[_0x47a7ce];return _0x298f39;};'use strict';function Telephone(_0x107033){this['id']=_0x107033['id']||0x0;this[_0xa4cb('0x0')]=_0x107033[_0xa4cb('0x0')]||'';this['accountcode']=_0x107033[_0xa4cb('0x1')]||'';this[_0xa4cb('0x2')]=_0xa4cb('0x3');this[_0xa4cb('0x4')]=0x0;this[_0xa4cb('0x5')]=_0xa4cb('0x3');this['address']='';}module[_0xa4cb('0x6')]=Telephone; \ No newline at end of file +var _0x0187=['name','unknown','stateTime','status'];(function(_0x19efbc,_0x10b7d7){var _0x205c5e=function(_0x49daa4){while(--_0x49daa4){_0x19efbc['push'](_0x19efbc['shift']());}};_0x205c5e(++_0x10b7d7);}(_0x0187,0x158));var _0x7018=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x0187[_0x11ce46];return _0x368a1e;};'use strict';function Telephone(_0x96c4b7){this['id']=_0x96c4b7['id']||0x0;this[_0x7018('0x0')]=_0x96c4b7[_0x7018('0x0')]||'';this['accountcode']=_0x96c4b7['accountcode']||'';this['state']=_0x7018('0x1');this[_0x7018('0x2')]=0x0;this[_0x7018('0x3')]='unknown';this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 7f1c6d1..26b91c1 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 _0xb10b=['name','html'];(function(_0x414682,_0x560738){var _0x3d2eb6=function(_0x3fc0bf){while(--_0x3fc0bf){_0x414682['push'](_0x414682['shift']());}};_0x3d2eb6(++_0x560738);}(_0xb10b,0x12a));var _0xbb10=function(_0x2aaa60,_0x22258f){_0x2aaa60=_0x2aaa60-0x0;var _0x2e3fa5=_0xb10b[_0x2aaa60];return _0x2e3fa5;};'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 +var _0xb10b=['name','html'];(function(_0x37c453,_0x5db9e9){var _0xcd4356=function(_0x3eb5c1){while(--_0x3eb5c1){_0x37c453['push'](_0x37c453['shift']());}};_0xcd4356(++_0x5db9e9);}(_0xb10b,0x12a));var _0xbb10=function(_0x1bb829,_0x503e6a){_0x1bb829=_0x1bb829-0x0;var _0x235c25=_0xb10b[_0x1bb829];return _0x235c25;};'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 11f6dc6..d776a7c 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(_0xefc494,_0x214aa7){var _0x1236f9=function(_0x5b0793){while(--_0x5b0793){_0xefc494['push'](_0xefc494['shift']());}};_0x1236f9(++_0x214aa7);}(_0x4fc2,0x111));var _0x24fc=function(_0x5a7da7,_0x4f132a){_0x5a7da7=_0x5a7da7-0x0;var _0x14459e=_0x4fc2[_0x5a7da7];return _0x14459e;};'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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x277efa,_0x3d7e0e){var _0x31da57=function(_0x4574b9){while(--_0x4574b9){_0x277efa['push'](_0x277efa['shift']());}};_0x31da57(++_0x3d7e0e);}(_0x8603,0x190));var _0x3860=function(_0x8ae1c9,_0x1c61ab){_0x8ae1c9=_0x8ae1c9-0x0;var _0x18b221=_0x8603[_0x8ae1c9];return _0x18b221;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('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 d86e20a..1202de4 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 _0x7195=['stateRegistry','address','exports','active','name','unknown','stateTime','registry','indexOf','port','domain','domainport','refresh'];(function(_0x42cf52,_0x43dad0){var _0x1e1c7e=function(_0x347fca){while(--_0x347fca){_0x42cf52['push'](_0x42cf52['shift']());}};_0x1e1c7e(++_0x43dad0);}(_0x7195,0x13b));var _0x5719=function(_0x16f3ca,_0x2ee349){_0x16f3ca=_0x16f3ca-0x0;var _0xa67245=_0x7195[_0x16f3ca];return _0xa67245;};'use strict';function Trunk(_0x69dcf0){this['id']=_0x69dcf0['id']||0x0;this[_0x5719('0x0')]=_0x69dcf0['active']||![];this[_0x5719('0x1')]=_0x69dcf0[_0x5719('0x1')]||'';this['state']=_0x5719('0x2');this[_0x5719('0x3')]=0x0;this['status']=_0x5719('0x2');this[_0x5719('0x4')]=_0x69dcf0[_0x5719('0x4')]&&_0x69dcf0[_0x5719('0x4')][_0x5719('0x5')](':')?_0x69dcf0['registry']['split'](':')[0x0]:'';this['host']='';this[_0x5719('0x6')]='';this[_0x5719('0x7')]='';this[_0x5719('0x8')]='';this[_0x5719('0x9')]='';this[_0x5719('0xa')]=_0x5719('0x2');this['registrationtime']='';this[_0x5719('0xb')]='';this['defaultuser']=_0x69dcf0['defaultuser']||'';}module[_0x5719('0xc')]=Trunk; \ No newline at end of file +var _0xcc0f=['refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','registry','split','host','port','domainport'];(function(_0x1793de,_0x4d7233){var _0x4f0309=function(_0x229ee7){while(--_0x229ee7){_0x1793de['push'](_0x1793de['shift']());}};_0x4f0309(++_0x4d7233);}(_0xcc0f,0xc6));var _0xfcc0=function(_0x2f96a1,_0x42cc63){_0x2f96a1=_0x2f96a1-0x0;var _0x330a43=_0xcc0f[_0x2f96a1];return _0x330a43;};'use strict';function Trunk(_0x2bea75){this['id']=_0x2bea75['id']||0x0;this[_0xfcc0('0x0')]=_0x2bea75[_0xfcc0('0x0')]||![];this[_0xfcc0('0x1')]=_0x2bea75[_0xfcc0('0x1')]||'';this[_0xfcc0('0x2')]=_0xfcc0('0x3');this[_0xfcc0('0x4')]=0x0;this['status']='unknown';this[_0xfcc0('0x5')]=_0x2bea75['registry']&&_0x2bea75['registry']['indexOf'](':')?_0x2bea75[_0xfcc0('0x5')][_0xfcc0('0x6')](':')[0x0]:'';this[_0xfcc0('0x7')]='';this[_0xfcc0('0x8')]='';this['domain']='';this[_0xfcc0('0x9')]='';this[_0xfcc0('0xa')]='';this[_0xfcc0('0xb')]=_0xfcc0('0x3');this[_0xfcc0('0xc')]='';this[_0xfcc0('0xd')]='';this[_0xfcc0('0xe')]=_0x2bea75[_0xfcc0('0xe')]||'';}module[_0xfcc0('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 9e907ed..0ba80db 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 _0x75af=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0x75af,0xc5));var _0xf75a=function(_0x134861,_0x348061){_0x134861=_0x134861-0x0;var _0x1dccfe=_0x75af[_0x134861];return _0x1dccfe;};'use strict';function voiceExtension(_0x343bcc){this['id']=_0x343bcc['id']||0x0;this[_0xf75a('0x0')]=_0x343bcc['exten']||'';this[_0xf75a('0x1')]=_0x343bcc['recordingFormat']||_0xf75a('0x2');this['mandatoryDisposition']=_0x343bcc[_0xf75a('0x3')]||![];}module[_0xf75a('0x4')]=voiceExtension; \ No newline at end of file +var _0x3d27=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x3d27,0x7c));var _0x73d2=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0x3d27[_0x2d3ab3];return _0x321f9e;};'use strict';function voiceExtension(_0x5d67b2){this['id']=_0x5d67b2['id']||0x0;this[_0x73d2('0x0')]=_0x5d67b2['exten']||'';this[_0x73d2('0x1')]=_0x5d67b2['recordingFormat']||_0x73d2('0x2');this[_0x73d2('0x3')]=_0x5d67b2[_0x73d2('0x3')]||![];}module[_0x73d2('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index c549faa..3071ccf 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 _0x872f=['dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrmemory','wrandom','name','monitor_format','type','inbound','waiting','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','paused','ringInUse','talking','unavailable','unknown','acw','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x872f,0x143));var _0xf872=function(_0x19a173,_0x413f3a){_0x19a173=_0x19a173-0x0;var _0x197b3c=_0x872f[_0x19a173];return _0x197b3c;};'use strict';var monitorFormat={'wav':_0xf872('0x0'),'wav49':_0xf872('0x1'),'gsm':_0xf872('0x2')};var strategy={'fewestcalls':_0xf872('0x3'),'leastrecent':_0xf872('0x4'),'linear':_0xf872('0x5'),'random':_0xf872('0x6'),'ringall':_0xf872('0x7'),'rr':_0xf872('0x8'),'rrmemory':_0xf872('0x9'),'rrordered':'rrordered','wrandom':_0xf872('0xa')};function VoiceQueue(_0x51e579){this['id']=_0x51e579['id']||0x0;this[_0xf872('0xb')]=_0x51e579['name']||'';this['monitor_format']=_0x51e579[_0xf872('0xc')]||'';this[_0xf872('0xd')]=_0x51e579[_0xf872('0xd')]||_0xf872('0xe');this[_0xf872('0xf')]=0x0;this['total']=0x0;this[_0xf872('0x10')]=0x0;this[_0xf872('0x11')]=0x0;this[_0xf872('0x12')]=0x0;this[_0xf872('0x13')]=0x0;this[_0xf872('0x14')]=0x0;this[_0xf872('0x15')]=0x0;this[_0xf872('0x16')]=0x0;this[_0xf872('0x17')]=0x0;this[_0xf872('0x18')]=0x0;this[_0xf872('0x19')]=0x0;this[_0xf872('0x1a')]=0x0;this[_0xf872('0x1b')]=0x0;this['onHold']=0x0;this[_0xf872('0x1c')]=0x0;this['ringing']=0x0;this[_0xf872('0x1d')]=0x0;this[_0xf872('0x1e')]=0x0;this[_0xf872('0x1f')]=0x0;this[_0xf872('0x20')]=0x0;this['acw']=_0x51e579[_0xf872('0x21')]||![];this['acwTimeout']=_0x51e579['acwTimeout']||0xa;this[_0xf872('0x22')]=_0x51e579[_0xf872('0x22')]||'no';this[_0xf872('0x23')]=!![];this[_0xf872('0x24')]='';this[_0xf872('0x25')]='';this[_0xf872('0x26')]=0x0;this[_0xf872('0x27')]=0x0;this[_0xf872('0x28')]=_0x51e579[_0xf872('0x28')]||null;this[_0xf872('0x29')]=_0x51e579[_0xf872('0x29')]?_0x51e579[_0xf872('0x29')]:null;this['dialActive']=_0x51e579['dialActive'];this[_0xf872('0x2a')]=_0x51e579[_0xf872('0x2a')]||_0xf872('0x2b');this['dialLimitChannel']=_0x51e579[_0xf872('0x2c')]||0x0;this['dialLimitQueue']=_0x51e579[_0xf872('0x2d')]||0x0;this[_0xf872('0x2e')]=_0x51e579[_0xf872('0x2e')]||0x1;this[_0xf872('0x2f')]=_0x51e579[_0xf872('0x2f')]||_0xf872('0x30');this[_0xf872('0x31')]=_0x51e579[_0xf872('0x31')]||0.03;this['dialPredictiveInterval']=_0x51e579[_0xf872('0x32')]||0x258;this[_0xf872('0x33')]=_0x51e579[_0xf872('0x33')]||_0xf872('0x34');this[_0xf872('0x35')]=_0x51e579[_0xf872('0x35')]||_0xf872('0x34');this['dialOriginateTimeout']=_0x51e579[_0xf872('0x36')]||0x1e;this['dialQueueOptions']=_0x51e579[_0xf872('0x37')]||_0xf872('0x38');this[_0xf872('0x39')]=_0x51e579[_0xf872('0x39')]||0x3;this[_0xf872('0x3a')]=_0x51e579[_0xf872('0x3a')]||undefined;this['dialCongestionMaxRetry']=_0x51e579['dialCongestionMaxRetry']||0x3;this[_0xf872('0x3b')]=_0x51e579[_0xf872('0x3b')]||0x96;this[_0xf872('0x3c')]=_0x51e579[_0xf872('0x3c')]||0x3;this[_0xf872('0x3d')]=_0x51e579[_0xf872('0x3d')]||0x96;this['dialNoAnswerMaxRetry']=_0x51e579[_0xf872('0x3e')]||0x3;this['dialNoAnswerRetryFrequency']=_0x51e579[_0xf872('0x3f')]||0x96;this[_0xf872('0x40')]=_0x51e579[_0xf872('0x40')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x51e579[_0xf872('0x41')]||0x96;this['dialDropMaxRetry']=_0x51e579[_0xf872('0x42')]||0x3;this[_0xf872('0x43')]=_0x51e579[_0xf872('0x43')]||0x96;this[_0xf872('0x44')]=_0x51e579['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x51e579[_0xf872('0x45')]||0x96;this['dialMachineMaxRetry']=_0x51e579[_0xf872('0x46')]||0x3;this[_0xf872('0x47')]=_0x51e579[_0xf872('0x47')]||0x96;this[_0xf872('0x48')]=_0x51e579['dialAgentRejectMaxRetry']||0x3;this[_0xf872('0x49')]=_0x51e579[_0xf872('0x49')]||0x96;this['callAdditionalPhoneAfterMin']=_0x51e579['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x51e579[_0xf872('0x4a')]||0x4;this[_0xf872('0x4b')]=_0x51e579[_0xf872('0x4b')]?_0x51e579[_0xf872('0x4b')]:undefined;this[_0xf872('0x4c')]=_0x51e579[_0xf872('0x4c')]?_0x51e579['TrunkBackup']:undefined;this[_0xf872('0x4d')]=_0x51e579[_0xf872('0x4d')]||undefined;this[_0xf872('0x4e')]=_0x51e579[_0xf872('0x4e')]?_0x51e579['Interval']:undefined;this[_0xf872('0x4f')]=_0x51e579[_0xf872('0x4f')]||'DESC';this[_0xf872('0x50')]=_0x51e579[_0xf872('0x50')]||undefined;this[_0xf872('0x51')]=_0x51e579[_0xf872('0x51')]||undefined;this[_0xf872('0x52')]=strategy[_0x51e579[_0xf872('0x52')]];this[_0xf872('0x53')]=!![];this[_0xf872('0x54')]=_0x51e579[_0xf872('0x54')]||![];this[_0xf872('0x55')]=_0x51e579['dialAMDInitialSilence'];this[_0xf872('0x56')]=_0x51e579[_0xf872('0x56')];this[_0xf872('0x57')]=_0x51e579['dialAMDAfterGreetingSilence'];this[_0xf872('0x58')]=_0x51e579['dialAMDTotalAnalysisTime'];this[_0xf872('0x59')]=_0x51e579[_0xf872('0x59')];this[_0xf872('0x5a')]=_0x51e579[_0xf872('0x5a')];this['dialAMDMaximumNumberOfWords']=_0x51e579[_0xf872('0x5b')];this[_0xf872('0x5c')]=_0x51e579['dialAMDSilenceThreshold'];this[_0xf872('0x5d')]=_0x51e579[_0xf872('0x5d')];this[_0xf872('0x5e')]=0x0;this[_0xf872('0x5f')]=0x0;this['timeout']=_0x51e579[_0xf872('0x60')];this[_0xf872('0x61')]=0x0;this[_0xf872('0x62')]=0x0;this[_0xf872('0x63')]=0x0;this[_0xf872('0x64')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xf872('0x65')]=0x0;this[_0xf872('0x66')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xf872('0x67')]=0x0;this[_0xf872('0x68')]=0x0;this[_0xf872('0x69')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xf872('0x6a')]=0x0;this[_0xf872('0x6b')]=0x0;this[_0xf872('0x6c')]=undefined;this[_0xf872('0x6d')]=undefined;this[_0xf872('0x6e')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xf872('0x6f')]=0x0;this[_0xf872('0x70')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xf872('0x71')]=0x0;this[_0xf872('0x72')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xf872('0x73')]=0x0;this[_0xf872('0x74')]=_0x51e579[_0xf872('0x75')]||0x14;this['predictiveIntervalMinThreshold']=_0x51e579[_0xf872('0x75')]||0xa;this[_0xf872('0x76')]=0x0;this[_0xf872('0x77')]=0x0;this[_0xf872('0x78')]=0x1;this[_0xf872('0x79')]=0x0;this[_0xf872('0x7a')]=0x0;this[_0xf872('0x7b')]=0x0;this[_0xf872('0x7c')]=0x0;this['dialRecallMeTimeout']=_0x51e579[_0xf872('0x7d')]||0x1e;this[_0xf872('0x7e')]=_0x51e579['dialRecallInQueue']||![];this[_0xf872('0x7f')]=!!_0x51e579[_0xf872('0x7f')]||![];this[_0xf872('0x80')]=!!_0x51e579[_0xf872('0x80')]||![];this[_0xf872('0x81')]=_0x51e579['dialQueueProject2']||undefined;this[_0xf872('0x82')]=_0x51e579[_0xf872('0x82')]||![];this[_0xf872('0x83')]=_0x51e579[_0xf872('0x83')]||![];this['monitor_format']=monitorFormat[_0x51e579[_0xf872('0xc')]]?monitorFormat[_0x51e579[_0xf872('0xc')]]:undefined;this[_0xf872('0x84')]=_0x51e579[_0xf872('0x84')]||![];this['mandatoryDispositionPause']=_0x51e579[_0xf872('0x85')]?_0x51e579[_0xf872('0x85')]:undefined;this[_0xf872('0x86')]=![];}module[_0xf872('0x87')]=VoiceQueue; \ No newline at end of file +var _0x83b3=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','wrandom','name','monitor_format','type','inbound','waiting','total','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','busy','invalid','notInUse','onHold','paused','ringing','ringInUse','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0x83b3,0x147));var _0x383b=function(_0xbd102e,_0x5cdef9){_0xbd102e=_0xbd102e-0x0;var _0x5d24d3=_0x83b3[_0xbd102e];return _0x5d24d3;};'use strict';var monitorFormat={'wav':_0x383b('0x0'),'wav49':_0x383b('0x1'),'gsm':_0x383b('0x2')};var strategy={'fewestcalls':_0x383b('0x3'),'leastrecent':_0x383b('0x4'),'linear':_0x383b('0x5'),'random':_0x383b('0x6'),'ringall':_0x383b('0x7'),'rr':_0x383b('0x8'),'rrmemory':'rrmemory','rrordered':'rrordered','wrandom':_0x383b('0x9')};function VoiceQueue(_0x2e09c9){this['id']=_0x2e09c9['id']||0x0;this[_0x383b('0xa')]=_0x2e09c9[_0x383b('0xa')]||'';this[_0x383b('0xb')]=_0x2e09c9[_0x383b('0xb')]||'';this[_0x383b('0xc')]=_0x2e09c9[_0x383b('0xc')]||_0x383b('0xd');this[_0x383b('0xe')]=0x0;this[_0x383b('0xf')]=0x0;this['answered']=0x0;this[_0x383b('0x10')]=0x0;this[_0x383b('0x11')]=0x0;this[_0x383b('0x12')]=0x0;this[_0x383b('0x13')]=0x0;this[_0x383b('0x14')]=0x0;this['available']=0x0;this[_0x383b('0x15')]=0x0;this['inUse']=0x0;this[_0x383b('0x16')]=0x0;this['loggedIn']=0x0;this[_0x383b('0x17')]=0x0;this[_0x383b('0x18')]=0x0;this[_0x383b('0x19')]=0x0;this[_0x383b('0x1a')]=0x0;this[_0x383b('0x1b')]=0x0;this['talking']=0x0;this['unavailable']=0x0;this[_0x383b('0x1c')]=0x0;this[_0x383b('0x1d')]=_0x2e09c9[_0x383b('0x1d')]||![];this[_0x383b('0x1e')]=_0x2e09c9['acwTimeout']||0xa;this[_0x383b('0x1f')]=_0x2e09c9[_0x383b('0x1f')]||'no';this[_0x383b('0x20')]=!![];this[_0x383b('0x21')]='';this[_0x383b('0x22')]='';this[_0x383b('0x23')]=0x0;this[_0x383b('0x24')]=0x0;this[_0x383b('0x25')]=_0x2e09c9[_0x383b('0x25')]||null;this[_0x383b('0x26')]=_0x2e09c9[_0x383b('0x26')]?_0x2e09c9[_0x383b('0x26')]:null;this[_0x383b('0x27')]=_0x2e09c9['dialActive'];this[_0x383b('0x28')]=_0x2e09c9[_0x383b('0x28')]||_0x383b('0x29');this[_0x383b('0x2a')]=_0x2e09c9['dialLimitChannel']||0x0;this[_0x383b('0x2b')]=_0x2e09c9[_0x383b('0x2b')]||0x0;this[_0x383b('0x2c')]=_0x2e09c9[_0x383b('0x2c')]||0x1;this[_0x383b('0x2d')]=_0x2e09c9[_0x383b('0x2d')]||_0x383b('0x2e');this[_0x383b('0x2f')]=_0x2e09c9[_0x383b('0x2f')]||0.03;this[_0x383b('0x30')]=_0x2e09c9[_0x383b('0x30')]||0x258;this[_0x383b('0x31')]=_0x2e09c9[_0x383b('0x31')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x2e09c9[_0x383b('0x32')]||_0x383b('0x33');this[_0x383b('0x34')]=_0x2e09c9[_0x383b('0x34')]||0x1e;this[_0x383b('0x35')]=_0x2e09c9[_0x383b('0x35')]||_0x383b('0x36');this[_0x383b('0x37')]=_0x2e09c9[_0x383b('0x37')]||0x3;this['dialQueueProject']=_0x2e09c9[_0x383b('0x38')]||undefined;this[_0x383b('0x39')]=_0x2e09c9[_0x383b('0x39')]||0x3;this[_0x383b('0x3a')]=_0x2e09c9[_0x383b('0x3a')]||0x96;this[_0x383b('0x3b')]=_0x2e09c9[_0x383b('0x3b')]||0x3;this['dialBusyRetryFrequency']=_0x2e09c9[_0x383b('0x3c')]||0x96;this[_0x383b('0x3d')]=_0x2e09c9[_0x383b('0x3d')]||0x3;this[_0x383b('0x3e')]=_0x2e09c9[_0x383b('0x3e')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x2e09c9[_0x383b('0x3f')]||0x3;this[_0x383b('0x40')]=_0x2e09c9['dialNoSuchNumberRetryFrequency']||0x96;this[_0x383b('0x41')]=_0x2e09c9[_0x383b('0x41')]||0x3;this['dialDropRetryFrequency']=_0x2e09c9[_0x383b('0x42')]||0x96;this[_0x383b('0x43')]=_0x2e09c9[_0x383b('0x43')]||0x3;this[_0x383b('0x44')]=_0x2e09c9[_0x383b('0x44')]||0x96;this[_0x383b('0x45')]=_0x2e09c9[_0x383b('0x45')]||0x3;this[_0x383b('0x46')]=_0x2e09c9[_0x383b('0x46')]||0x96;this[_0x383b('0x47')]=_0x2e09c9[_0x383b('0x47')]||0x3;this['dialAgentRejectRetryFrequency']=_0x2e09c9[_0x383b('0x48')]||0x96;this[_0x383b('0x49')]=_0x2e09c9['callAdditionalPhoneAfterMin']||0x3;this[_0x383b('0x4a')]=_0x2e09c9[_0x383b('0x4a')]||0x4;this['Trunk']=_0x2e09c9[_0x383b('0x4b')]?_0x2e09c9[_0x383b('0x4b')]:undefined;this[_0x383b('0x4c')]=_0x2e09c9[_0x383b('0x4c')]?_0x2e09c9[_0x383b('0x4c')]:undefined;this[_0x383b('0x4d')]=_0x2e09c9[_0x383b('0x4d')]||undefined;this[_0x383b('0x4e')]=_0x2e09c9[_0x383b('0x4e')]?_0x2e09c9[_0x383b('0x4e')]:undefined;this[_0x383b('0x4f')]=_0x2e09c9[_0x383b('0x4f')]||_0x383b('0x50');this[_0x383b('0x51')]=_0x2e09c9['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x383b('0x52')]=_0x2e09c9['dialCutDigit']||undefined;this[_0x383b('0x53')]=strategy[_0x2e09c9[_0x383b('0x53')]];this[_0x383b('0x54')]=!![];this[_0x383b('0x55')]=_0x2e09c9['dialAMDActive']||![];this[_0x383b('0x56')]=_0x2e09c9[_0x383b('0x56')];this[_0x383b('0x57')]=_0x2e09c9[_0x383b('0x57')];this[_0x383b('0x58')]=_0x2e09c9['dialAMDAfterGreetingSilence'];this[_0x383b('0x59')]=_0x2e09c9['dialAMDTotalAnalysisTime'];this[_0x383b('0x5a')]=_0x2e09c9[_0x383b('0x5a')];this[_0x383b('0x5b')]=_0x2e09c9['dialAMDBetweenWordsSilence'];this[_0x383b('0x5c')]=_0x2e09c9[_0x383b('0x5c')];this['dialAMDSilenceThreshold']=_0x2e09c9[_0x383b('0x5d')];this[_0x383b('0x5e')]=_0x2e09c9[_0x383b('0x5e')];this[_0x383b('0x5f')]=0x0;this['pTalking']=0x0;this[_0x383b('0x60')]=_0x2e09c9[_0x383b('0x60')];this[_0x383b('0x61')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x383b('0x62')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x383b('0x63')]=0x0;this[_0x383b('0x64')]=0x0;this[_0x383b('0x65')]=0x0;this[_0x383b('0x66')]=0x0;this[_0x383b('0x67')]=0x0;this[_0x383b('0x68')]=0x0;this[_0x383b('0x69')]=0x0;this[_0x383b('0x6a')]=0x0;this[_0x383b('0x6b')]=0x0;this[_0x383b('0x6c')]=0x0;this[_0x383b('0x6d')]=undefined;this['startPredictive']=undefined;this[_0x383b('0x6e')]=undefined;this[_0x383b('0x6f')]=1.05;this[_0x383b('0x70')]=0x0;this[_0x383b('0x71')]=0x0;this[_0x383b('0x72')]=0x0;this[_0x383b('0x73')]=0x0;this[_0x383b('0x74')]=0x0;this[_0x383b('0x75')]=0x0;this[_0x383b('0x76')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x383b('0x77')]=_0x2e09c9[_0x383b('0x78')]||0x14;this[_0x383b('0x79')]=_0x2e09c9[_0x383b('0x78')]||0xa;this[_0x383b('0x7a')]=0x0;this[_0x383b('0x7b')]=0x0;this[_0x383b('0x7c')]=0x1;this[_0x383b('0x7d')]=0x0;this['erlangCallToSecond']=0x0;this[_0x383b('0x7e')]=0x0;this[_0x383b('0x7f')]=0x0;this[_0x383b('0x80')]=_0x2e09c9[_0x383b('0x80')]||0x1e;this[_0x383b('0x81')]=_0x2e09c9['dialRecallInQueue']||![];this[_0x383b('0x82')]=!!_0x2e09c9[_0x383b('0x82')]||![];this[_0x383b('0x83')]=!!_0x2e09c9[_0x383b('0x83')]||![];this[_0x383b('0x84')]=_0x2e09c9[_0x383b('0x84')]||undefined;this[_0x383b('0x85')]=_0x2e09c9[_0x383b('0x85')]||![];this[_0x383b('0x86')]=_0x2e09c9[_0x383b('0x86')]||![];this[_0x383b('0xb')]=monitorFormat[_0x2e09c9[_0x383b('0xb')]]?monitorFormat[_0x2e09c9[_0x383b('0xb')]]:undefined;this[_0x383b('0x87')]=_0x2e09c9[_0x383b('0x87')]||![];this[_0x383b('0x88')]=_0x2e09c9['mandatoryDispositionPause']?_0x2e09c9[_0x383b('0x88')]:undefined;this[_0x383b('0x89')]=![];}module[_0x383b('0x8a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 7a6391f..f016e4f 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 _0x56e7=['predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','createReport','invalid','loggedin','callers','length','name','online','includes','booked','keys','dialer','xcally-motion-preview','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','loggedIn','loggedInDb','ringing','talking','waiting','available','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','strategy','abandoned','busy','onHold','notInUse','paused','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x56e7,0x7b));var _0x756e=function(_0x137c02,_0x2a2175){_0x137c02=_0x137c02-0x0;var _0x6ee5bc=_0x56e7[_0x137c02];return _0x6ee5bc;};'use strict';var INBOUND_COUNTERS=['available',_0x756e('0x0'),_0x756e('0x1'),'paused',_0x756e('0x2'),_0x756e('0x3'),_0x756e('0x4')];var OUTBOUND_COUNTERS=[_0x756e('0x5'),_0x756e('0x6'),_0x756e('0x7'),_0x756e('0x0'),'loggedInDb',_0x756e('0x8'),_0x756e('0x9'),_0x756e('0xa'),_0x756e('0xb'),'outboundBusyCallsDay',_0x756e('0xc'),'outboundNoAnswerCallsDay',_0x756e('0xd'),_0x756e('0xe'),_0x756e('0xf'),_0x756e('0x10'),'paused','pTalking',_0x756e('0x3'),_0x756e('0x11'),_0x756e('0x12'),'total',_0x756e('0x4')];function VoiceQueueSummary(_0x100d3f){this['id']=_0x100d3f['id'];this['name']=_0x100d3f['name'];this[_0x756e('0x13')]=_0x100d3f['strategy'];this[_0x756e('0x14')]=_0x100d3f[_0x756e('0x14')]||0x0;this[_0x756e('0x6')]=_0x100d3f[_0x756e('0x6')]||0x0;this[_0x756e('0x5')]=_0x100d3f['available']||0x0;this['busy']=_0x100d3f[_0x756e('0x15')]||0x0;this[_0x756e('0x7')]=_0x100d3f[_0x756e('0x7')]||0x0;this['invalid']=_0x100d3f['invalid']||0x0;this[_0x756e('0x0')]=_0x100d3f[_0x756e('0x0')]||0x0;this[_0x756e('0x1')]=_0x100d3f[_0x756e('0x1')]||0x0;this[_0x756e('0x16')]=_0x100d3f[_0x756e('0x16')]||0x0;this[_0x756e('0x17')]=_0x100d3f[_0x756e('0x17')]||0x0;this[_0x756e('0x18')]=_0x100d3f['paused']||0x0;this[_0x756e('0x2')]=_0x100d3f['ringing']||0x0;this['ringInUse']=_0x100d3f[_0x756e('0x19')];this[_0x756e('0x11')]=_0x100d3f[_0x756e('0x11')];this[_0x756e('0x12')]=_0x100d3f[_0x756e('0x12')];this[_0x756e('0x1a')]=_0x100d3f[_0x756e('0x1a')]||0x0;this[_0x756e('0x3')]=_0x100d3f[_0x756e('0x3')]||0x0;this[_0x756e('0x1b')]=_0x100d3f[_0x756e('0x1b')]||0x0;this[_0x756e('0x1c')]=_0x100d3f[_0x756e('0x1c')];this[_0x756e('0x1d')]=_0x100d3f[_0x756e('0x1d')]||0x0;this[_0x756e('0x1e')]=_0x100d3f['unknown']||0x0;this[_0x756e('0x1f')]=_0x100d3f['unmanaged']||0x0;this[_0x756e('0x4')]=_0x100d3f[_0x756e('0x4')]||0x0;if(_0x100d3f[_0x756e('0x1c')]===_0x756e('0x20')){this['pTalking']=_0x100d3f[_0x756e('0x21')]||0x0;this[_0x756e('0x22')]=_0x100d3f[_0x756e('0x22')];this['dialMethod']=_0x100d3f[_0x756e('0x23')];this[_0x756e('0x24')]=_0x100d3f[_0x756e('0x24')];this['dialOriginateCallerIdNumber']=_0x100d3f[_0x756e('0x25')];this[_0x756e('0x26')]=_0x100d3f['dialOriginateTimeout'];this[_0x756e('0x27')]=_0x100d3f[_0x756e('0x27')];this[_0x756e('0x28')]=_0x100d3f['temp'];this[_0x756e('0x29')]=_0x100d3f[_0x756e('0x29')];this['outboundAnswerCallsDay']=_0x100d3f[_0x756e('0xa')];this[_0x756e('0xb')]=_0x100d3f['outboundBlacklistCallsDay'];this[_0x756e('0x2a')]=_0x100d3f[_0x756e('0x2a')];this[_0x756e('0xc')]=_0x100d3f[_0x756e('0xc')];this[_0x756e('0x2b')]=_0x100d3f['outboundDropCallsDayACS'];this[_0x756e('0x2c')]=_0x100d3f['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0x100d3f[_0x756e('0x2d')];this['outboundNoAnswerCallsDay']=_0x100d3f[_0x756e('0x2e')];this[_0x756e('0xd')]=_0x100d3f[_0x756e('0xd')];this[_0x756e('0x2f')]=_0x100d3f[_0x756e('0x2f')];this[_0x756e('0xe')]=_0x100d3f[_0x756e('0xe')];this[_0x756e('0xf')]=_0x100d3f[_0x756e('0xf')];this[_0x756e('0x10')]=_0x100d3f[_0x756e('0x10')];this[_0x756e('0x30')]=_0x100d3f['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x100d3f[_0x756e('0x31')];this[_0x756e('0x32')]=_0x100d3f[_0x756e('0x32')];this[_0x756e('0x33')]=_0x100d3f[_0x756e('0x33')];this[_0x756e('0x34')]=_0x100d3f[_0x756e('0x34')];this['predictiveIntervalErlangCalls']=_0x100d3f['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x100d3f[_0x756e('0x35')];this[_0x756e('0x36')]=_0x100d3f[_0x756e('0x36')];this['predictiveIntervalMultiplicativeFactor']=_0x100d3f[_0x756e('0x37')];this[_0x756e('0x38')]=_0x100d3f['predictiveIntervalPauses'];this[_0x756e('0x39')]=_0x100d3f[_0x756e('0x39')];this[_0x756e('0x3a')]=_0x100d3f[_0x756e('0x3a')];this[_0x756e('0x8')]=_0x100d3f[_0x756e('0x8')];this[_0x756e('0x3b')]=_0x100d3f[_0x756e('0x3b')];this['erlangCallToSecond']=_0x100d3f[_0x756e('0x3c')];this[_0x756e('0x3d')]=_0x100d3f[_0x756e('0x3d')];this[_0x756e('0x3e')]=_0x100d3f[_0x756e('0x3e')];this[_0x756e('0x3f')]=_0x100d3f[_0x756e('0x3f')];this[_0x756e('0x40')]=_0x100d3f[_0x756e('0x40')];this[_0x756e('0x41')]=_0x100d3f['message'];this[_0x756e('0x42')]=_0x100d3f[_0x756e('0x42')];}if(_0x100d3f['Trunk']){this[_0x756e('0x43')]={'id':_0x100d3f[_0x756e('0x43')]['id'],'name':_0x100d3f[_0x756e('0x43')]['name'],'active':_0x100d3f[_0x756e('0x43')][_0x756e('0x44')],'callerid':_0x100d3f[_0x756e('0x43')]['callerid']};}}VoiceQueueSummary[_0x756e('0x45')][_0x756e('0x46')]=function(_0x5856f,_0x1fc45c,_0x3eece7,_0x252757){this['loggedInDb']=0x0;this[_0x756e('0x3')]=0x0;this[_0x756e('0x18')]=0x0;this['unknown']=0x0;this[_0x756e('0x17')]=0x0;this[_0x756e('0x7')]=0x0;this[_0x756e('0x15')]=0x0;this[_0x756e('0x47')]=0x0;this[_0x756e('0x1d')]=0x0;this[_0x756e('0x2')]=0x0;this[_0x756e('0x19')]=0x0;this[_0x756e('0x16')]=0x0;if(_0x3eece7){if(_0x3eece7[_0x756e('0x5')]){this['available']=Number(_0x3eece7[_0x756e('0x5')]);}if(_0x3eece7['loggedin']){this[_0x756e('0x0')]=Number(_0x3eece7[_0x756e('0x48')]);}if(_0x3eece7[_0x756e('0x49')]){this['waiting']=Number(_0x3eece7[_0x756e('0x49')]);}}for(var _0x184823=0x0;_0x184823<_0x5856f[_0x756e('0x4a')];_0x184823++){var _0x527a62=_0x1fc45c['SIP/'+_0x5856f[_0x184823][_0x756e('0x4b')]];if(_0x527a62&&_0x527a62[_0x756e('0x4c')]){this['loggedInDb']+=0x1;}if(_0x5856f[_0x184823]['incall']==='1'){this[_0x756e('0x3')]+=0x1;}if(_0x5856f[_0x184823][_0x756e('0x18')]==='1'&&!['2','7','8'][_0x756e('0x4d')](_0x5856f[_0x184823]['status'])){this[_0x756e('0x18')]+=0x1;}switch(_0x5856f[_0x184823]['status']){case'0':this[_0x756e('0x1e')]+=0x1;break;case'1':this[_0x756e('0x17')]+=0x1;break;case'2':this[_0x756e('0x7')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0x756e('0x47')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x756e('0x19')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x756e('0x23')]===_0x756e('0x4e')){var _0xd6ee1b=Object[_0x756e('0x4f')](_0x252757);for(var _0x95061c=0x0;_0x95061c<_0xd6ee1b[_0x756e('0x4a')];_0x95061c++){var _0x50b86e=_0xd6ee1b[_0x95061c];var _0x42a498=_0x252757[_0x50b86e];if(_0x42a498['queue']===this[_0x756e('0x4b')]&&_0x42a498['type']===_0x756e('0x50')&&_0x42a498['exten']===_0x756e('0x51')){this['talking']+=0x1;}}if(this[_0x756e('0x3')]>this[_0x756e('0x7')]){this[_0x756e('0x3')]=this['inUse'];}this[_0x756e('0x21')]=0x0;}return this;};VoiceQueueSummary[_0x756e('0x45')]['compareToInboundQueue']=function(_0x5768f9){var _0x149a22=![];if(_0x5768f9){_0x149a22=INBOUND_COUNTERS[_0x756e('0x52')](function(_0x34a556){return this[_0x34a556]!==_0x5768f9[_0x34a556];},this);}return _0x149a22;};VoiceQueueSummary[_0x756e('0x45')][_0x756e('0x53')]=function(_0x2197ec){var _0x435729=![];var _0x9e8559=![];var _0x33f923=![];if(_0x2197ec){_0x435729=this['dialMethod']!==_0x2197ec[_0x756e('0x23')]||this[_0x756e('0x22')]!==_0x2197ec[_0x756e('0x22')]||this[_0x756e('0x41')]!==_0x2197ec[_0x756e('0x41')]||this[_0x756e('0x42')]!==_0x2197ec[_0x756e('0x42')];_0x9e8559=OUTBOUND_COUNTERS[_0x756e('0x52')](function(_0x4da157){return this[_0x4da157]!==_0x2197ec[_0x4da157];},this);if(this[_0x756e('0x43')]&&_0x2197ec[_0x756e('0x43')]){_0x33f923=this['Trunk'][_0x756e('0x4b')]!==_0x2197ec['Trunk'][_0x756e('0x4b')]||this[_0x756e('0x43')][_0x756e('0x44')]!==_0x2197ec['Trunk'][_0x756e('0x44')];}}return _0x435729||_0x9e8559||_0x33f923;};VoiceQueueSummary[_0x756e('0x45')][_0x756e('0x54')]=function(_0x571794){this[_0x756e('0x6')]=_0x571794['answered'];this[_0x756e('0x41')]=_0x571794[_0x756e('0x41')];this[_0x756e('0x42')]=_0x571794[_0x756e('0x42')];this[_0x756e('0x8')]=_0x571794[_0x756e('0x8')];this[_0x756e('0x9')]=_0x571794[_0x756e('0x9')];this['outboundAnswerCallsDay']=_0x571794[_0x756e('0xa')];this[_0x756e('0xb')]=_0x571794[_0x756e('0xb')];this[_0x756e('0x2a')]=_0x571794[_0x756e('0x2a')];this[_0x756e('0xc')]=_0x571794[_0x756e('0xc')];this[_0x756e('0x2e')]=_0x571794[_0x756e('0x2e')];this[_0x756e('0xd')]=_0x571794[_0x756e('0xd')];this[_0x756e('0xe')]=_0x571794[_0x756e('0xe')];this[_0x756e('0xf')]=_0x571794['outboundRejectCallsDay'];this[_0x756e('0x10')]=_0x571794[_0x756e('0x10')];this[_0x756e('0x11')]=_0x571794[_0x756e('0x11')];this[_0x756e('0x12')]=_0x571794[_0x756e('0x12')];this['total']=_0x571794[_0x756e('0x1b')];if(this[_0x756e('0x23')]===_0x756e('0x55')){this[_0x756e('0x21')]=_0x571794['pTalking'];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x19da=['total','name','abandoned','available','busy','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','queue','exten','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','exports','loggedIn','paused','talking','waiting','answered','inUse','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration'];(function(_0x2ea88b,_0x2cc023){var _0x525311=function(_0x5b1841){while(--_0x5b1841){_0x2ea88b['push'](_0x2ea88b['shift']());}};_0x525311(++_0x2cc023);}(_0x19da,0x9f));var _0xa19d=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0x19da[_0x213518];return _0x1baf75;};'use strict';var INBOUND_COUNTERS=['available',_0xa19d('0x0'),'loggedInDb',_0xa19d('0x1'),'ringing',_0xa19d('0x2'),_0xa19d('0x3')];var OUTBOUND_COUNTERS=['available',_0xa19d('0x4'),_0xa19d('0x5'),'loggedIn',_0xa19d('0x6'),_0xa19d('0x7'),_0xa19d('0x8'),_0xa19d('0x9'),_0xa19d('0xa'),_0xa19d('0xb'),_0xa19d('0xc'),'outboundNoAnswerCallsDay',_0xa19d('0xd'),_0xa19d('0xe'),_0xa19d('0xf'),'outboundUnknownCallsDay',_0xa19d('0x1'),_0xa19d('0x10'),_0xa19d('0x2'),_0xa19d('0x11'),_0xa19d('0x12'),_0xa19d('0x13'),'waiting'];function VoiceQueueSummary(_0x547799){this['id']=_0x547799['id'];this[_0xa19d('0x14')]=_0x547799[_0xa19d('0x14')];this['strategy']=_0x547799['strategy'];this[_0xa19d('0x15')]=_0x547799[_0xa19d('0x15')]||0x0;this['answered']=_0x547799[_0xa19d('0x4')]||0x0;this[_0xa19d('0x16')]=_0x547799[_0xa19d('0x16')]||0x0;this['busy']=_0x547799[_0xa19d('0x17')]||0x0;this['inUse']=_0x547799[_0xa19d('0x5')]||0x0;this[_0xa19d('0x18')]=_0x547799[_0xa19d('0x18')]||0x0;this[_0xa19d('0x0')]=_0x547799[_0xa19d('0x0')]||0x0;this[_0xa19d('0x6')]=_0x547799[_0xa19d('0x6')]||0x0;this[_0xa19d('0x19')]=_0x547799['onHold']||0x0;this[_0xa19d('0x1a')]=_0x547799['notInUse']||0x0;this[_0xa19d('0x1')]=_0x547799[_0xa19d('0x1')]||0x0;this[_0xa19d('0x1b')]=_0x547799[_0xa19d('0x1b')]||0x0;this[_0xa19d('0x1c')]=_0x547799[_0xa19d('0x1c')];this[_0xa19d('0x11')]=_0x547799['sumBillable'];this[_0xa19d('0x12')]=_0x547799[_0xa19d('0x12')];this[_0xa19d('0x1d')]=_0x547799[_0xa19d('0x1d')]||0x0;this[_0xa19d('0x2')]=_0x547799[_0xa19d('0x2')]||0x0;this[_0xa19d('0x13')]=_0x547799[_0xa19d('0x13')]||0x0;this[_0xa19d('0x1e')]=_0x547799['type'];this[_0xa19d('0x1f')]=_0x547799['unavailable']||0x0;this[_0xa19d('0x20')]=_0x547799[_0xa19d('0x20')]||0x0;this[_0xa19d('0x21')]=_0x547799[_0xa19d('0x21')]||0x0;this[_0xa19d('0x3')]=_0x547799[_0xa19d('0x3')]||0x0;if(_0x547799[_0xa19d('0x1e')]===_0xa19d('0x22')){this[_0xa19d('0x10')]=_0x547799[_0xa19d('0x10')]||0x0;this[_0xa19d('0x23')]=_0x547799[_0xa19d('0x23')];this[_0xa19d('0x24')]=_0x547799[_0xa19d('0x24')];this[_0xa19d('0x25')]=_0x547799[_0xa19d('0x25')];this[_0xa19d('0x26')]=_0x547799[_0xa19d('0x26')];this[_0xa19d('0x27')]=_0x547799[_0xa19d('0x27')];this[_0xa19d('0x28')]=_0x547799['dialPrefix'];this['temp']=_0x547799['temp'];this[_0xa19d('0x29')]=_0x547799[_0xa19d('0x29')];this[_0xa19d('0x9')]=_0x547799[_0xa19d('0x9')];this[_0xa19d('0xa')]=_0x547799['outboundBlacklistCallsDay'];this[_0xa19d('0xb')]=_0x547799[_0xa19d('0xb')];this[_0xa19d('0xc')]=_0x547799[_0xa19d('0xc')];this['outboundDropCallsDayACS']=_0x547799[_0xa19d('0x2a')];this[_0xa19d('0x2b')]=_0x547799[_0xa19d('0x2b')];this['outboundDropCallsDayTimeout']=_0x547799['outboundDropCallsDayTimeout'];this[_0xa19d('0x2c')]=_0x547799[_0xa19d('0x2c')];this['outboundNoSuchCallsDay']=_0x547799[_0xa19d('0xd')];this[_0xa19d('0x2d')]=_0x547799['outboundOriginateFailureCallsDay'];this[_0xa19d('0xe')]=_0x547799[_0xa19d('0xe')];this[_0xa19d('0xf')]=_0x547799[_0xa19d('0xf')];this[_0xa19d('0x2e')]=_0x547799['outboundUnknownCallsDay'];this[_0xa19d('0x2f')]=_0x547799[_0xa19d('0x2f')];this[_0xa19d('0x30')]=_0x547799[_0xa19d('0x30')];this[_0xa19d('0x31')]=_0x547799['predictiveIntervalAvgTalktime'];this[_0xa19d('0x32')]=_0x547799[_0xa19d('0x32')];this[_0xa19d('0x33')]=_0x547799[_0xa19d('0x33')];this[_0xa19d('0x34')]=_0x547799[_0xa19d('0x34')];this[_0xa19d('0x35')]=_0x547799[_0xa19d('0x35')];this['predictiveIntervalHitRate']=_0x547799['predictiveIntervalHitRate'];this[_0xa19d('0x36')]=_0x547799['predictiveIntervalMultiplicativeFactor'];this[_0xa19d('0x37')]=_0x547799[_0xa19d('0x37')];this['predictiveIntervalAvailable']=_0x547799[_0xa19d('0x38')];this[_0xa19d('0x39')]=_0x547799[_0xa19d('0x39')];this['originated']=_0x547799[_0xa19d('0x7')];this[_0xa19d('0x3a')]=_0x547799[_0xa19d('0x3a')];this['erlangCallToSecond']=_0x547799[_0xa19d('0x3b')];this[_0xa19d('0x3c')]=_0x547799[_0xa19d('0x3c')];this[_0xa19d('0x3d')]=_0x547799[_0xa19d('0x3d')];this[_0xa19d('0x3e')]=_0x547799[_0xa19d('0x3e')];this[_0xa19d('0x3f')]=_0x547799[_0xa19d('0x3f')];this[_0xa19d('0x40')]=_0x547799[_0xa19d('0x40')];this['statusMessage']=_0x547799[_0xa19d('0x41')];}if(_0x547799[_0xa19d('0x42')]){this['Trunk']={'id':_0x547799[_0xa19d('0x42')]['id'],'name':_0x547799[_0xa19d('0x42')][_0xa19d('0x14')],'active':_0x547799[_0xa19d('0x42')][_0xa19d('0x43')],'callerid':_0x547799[_0xa19d('0x42')][_0xa19d('0x44')]};}}VoiceQueueSummary[_0xa19d('0x45')][_0xa19d('0x46')]=function(_0x23d917,_0x5157e6,_0x32711c,_0xf561b1){this[_0xa19d('0x6')]=0x0;this[_0xa19d('0x2')]=0x0;this[_0xa19d('0x1')]=0x0;this[_0xa19d('0x20')]=0x0;this[_0xa19d('0x1a')]=0x0;this['inUse']=0x0;this['busy']=0x0;this['invalid']=0x0;this['unavailable']=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this[_0xa19d('0x19')]=0x0;if(_0x32711c){if(_0x32711c['available']){this[_0xa19d('0x16')]=Number(_0x32711c[_0xa19d('0x16')]);}if(_0x32711c['loggedin']){this[_0xa19d('0x0')]=Number(_0x32711c[_0xa19d('0x47')]);}if(_0x32711c['callers']){this[_0xa19d('0x3')]=Number(_0x32711c[_0xa19d('0x48')]);}}for(var _0x2c3d44=0x0;_0x2c3d44<_0x23d917[_0xa19d('0x49')];_0x2c3d44++){var _0x484491=_0x5157e6[_0xa19d('0x4a')+_0x23d917[_0x2c3d44]['name']];if(_0x484491&&_0x484491[_0xa19d('0x4b')]){this['loggedInDb']+=0x1;}if(_0x23d917[_0x2c3d44][_0xa19d('0x4c')]==='1'){this[_0xa19d('0x2')]+=0x1;}if(_0x23d917[_0x2c3d44][_0xa19d('0x1')]==='1'&&!['2','7','8'][_0xa19d('0x4d')](_0x23d917[_0x2c3d44][_0xa19d('0x4e')])){this['paused']+=0x1;}switch(_0x23d917[_0x2c3d44][_0xa19d('0x4e')]){case'0':this[_0xa19d('0x20')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0xa19d('0x5')]+=0x1;break;case'3':this[_0xa19d('0x17')]+=0x1;break;case'4':this[_0xa19d('0x18')]+=0x1;break;case'5':this[_0xa19d('0x1f')]+=0x1;break;case'6':this[_0xa19d('0x1b')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0xa19d('0x19')]+=0x1;break;}}if(this[_0xa19d('0x24')]===_0xa19d('0x4f')){var _0x391d7c=Object[_0xa19d('0x50')](_0xf561b1);for(var _0x15904f=0x0;_0x15904f<_0x391d7c[_0xa19d('0x49')];_0x15904f++){var _0x1430cd=_0x391d7c[_0x15904f];var _0x1a95a8=_0xf561b1[_0x1430cd];if(_0x1a95a8[_0xa19d('0x51')]===this[_0xa19d('0x14')]&&_0x1a95a8['type']==='dialer'&&_0x1a95a8[_0xa19d('0x52')]==='xcally-motion-preview'){this[_0xa19d('0x2')]+=0x1;}}if(this[_0xa19d('0x2')]>this['inUse']){this[_0xa19d('0x2')]=this[_0xa19d('0x5')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0xa19d('0x45')][_0xa19d('0x53')]=function(_0x491896){var _0x2f5c2b=![];if(_0x491896){_0x2f5c2b=INBOUND_COUNTERS[_0xa19d('0x54')](function(_0x5c646e){return this[_0x5c646e]!==_0x491896[_0x5c646e];},this);}return _0x2f5c2b;};VoiceQueueSummary[_0xa19d('0x45')][_0xa19d('0x55')]=function(_0x13a2b5){var _0x6d2418=![];var _0xdbd087=![];var _0x28e948=![];if(_0x13a2b5){_0x6d2418=this[_0xa19d('0x24')]!==_0x13a2b5['dialMethod']||this[_0xa19d('0x23')]!==_0x13a2b5[_0xa19d('0x23')]||this[_0xa19d('0x40')]!==_0x13a2b5[_0xa19d('0x40')]||this[_0xa19d('0x41')]!==_0x13a2b5[_0xa19d('0x41')];_0xdbd087=OUTBOUND_COUNTERS[_0xa19d('0x54')](function(_0x14ef63){return this[_0x14ef63]!==_0x13a2b5[_0x14ef63];},this);if(this[_0xa19d('0x42')]&&_0x13a2b5[_0xa19d('0x42')]){_0x28e948=this[_0xa19d('0x42')][_0xa19d('0x14')]!==_0x13a2b5['Trunk'][_0xa19d('0x14')]||this['Trunk'][_0xa19d('0x43')]!==_0x13a2b5[_0xa19d('0x42')][_0xa19d('0x43')];}}return _0x6d2418||_0xdbd087||_0x28e948;};VoiceQueueSummary[_0xa19d('0x45')][_0xa19d('0x56')]=function(_0xe6d631){this[_0xa19d('0x4')]=_0xe6d631[_0xa19d('0x4')];this['message']=_0xe6d631[_0xa19d('0x40')];this[_0xa19d('0x41')]=_0xe6d631[_0xa19d('0x41')];this[_0xa19d('0x7')]=_0xe6d631[_0xa19d('0x7')];this[_0xa19d('0x8')]=_0xe6d631[_0xa19d('0x8')];this[_0xa19d('0x9')]=_0xe6d631[_0xa19d('0x9')];this[_0xa19d('0xa')]=_0xe6d631[_0xa19d('0xa')];this[_0xa19d('0xb')]=_0xe6d631[_0xa19d('0xb')];this['outboundCongestionCallsDay']=_0xe6d631[_0xa19d('0xc')];this[_0xa19d('0x2c')]=_0xe6d631[_0xa19d('0x2c')];this[_0xa19d('0xd')]=_0xe6d631[_0xa19d('0xd')];this[_0xa19d('0xe')]=_0xe6d631['outboundReCallsDay'];this[_0xa19d('0xf')]=_0xe6d631[_0xa19d('0xf')];this[_0xa19d('0x2e')]=_0xe6d631[_0xa19d('0x2e')];this[_0xa19d('0x11')]=_0xe6d631[_0xa19d('0x11')];this[_0xa19d('0x12')]=_0xe6d631[_0xa19d('0x12')];this['total']=_0xe6d631[_0xa19d('0x13')];if(this[_0xa19d('0x24')]===_0xa19d('0x57')){this['pTalking']=_0xe6d631[_0xa19d('0x10')];}};module[_0xa19d('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 ea782a2..ed52251 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 _0xad23=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x2d937b,_0x1e652b){var _0x3628da=function(_0x467a01){while(--_0x467a01){_0x2d937b['push'](_0x2d937b['shift']());}};_0x3628da(++_0x1e652b);}(_0xad23,0x1a5));var _0x3ad2=function(_0x18f340,_0x293a65){_0x18f340=_0x18f340-0x0;var _0x1597a3=_0xad23[_0x18f340];return _0x1597a3;};'use strict';function VtigerAccount(_0x30f68e){this['id']=_0x30f68e['id']||0x0;this[_0x3ad2('0x0')]=_0x30f68e['name']||'';this['username']=_0x30f68e[_0x3ad2('0x1')]||'';this[_0x3ad2('0x2')]=_0x30f68e[_0x3ad2('0x2')]||'';this[_0x3ad2('0x3')]=_0x30f68e['remoteUri']||'';this['serverUrl']=_0x30f68e[_0x3ad2('0x4')]||'';this[_0x3ad2('0x5')]=_0x30f68e[_0x3ad2('0x5')]||{};}module[_0x3ad2('0x6')]=VtigerAccount; \ No newline at end of file +var _0x18a2=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x103d56,_0xd563c7){var _0x6cb838=function(_0x4adbf2){while(--_0x4adbf2){_0x103d56['push'](_0x103d56['shift']());}};_0x6cb838(++_0xd563c7);}(_0x18a2,0xf5));var _0x218a=function(_0x45576c,_0x31c6ae){_0x45576c=_0x45576c-0x0;var _0x25b63e=_0x18a2[_0x45576c];return _0x25b63e;};'use strict';function VtigerAccount(_0x149c08){this['id']=_0x149c08['id']||0x0;this[_0x218a('0x0')]=_0x149c08[_0x218a('0x0')]||'';this[_0x218a('0x1')]=_0x149c08[_0x218a('0x1')]||'';this['accessKey']=_0x149c08[_0x218a('0x2')]||'';this[_0x218a('0x3')]=_0x149c08[_0x218a('0x3')]||'';this['serverUrl']=_0x149c08[_0x218a('0x4')]||'';this['Configurations']=_0x149c08[_0x218a('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index fcf8cda..b9b595f 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 _0xa395=['username','password','remoteUri','authType','serverUrl','Configurations','exports','name'];(function(_0x2b0d88,_0x5b5ef2){var _0x1c9256=function(_0x1ea041){while(--_0x1ea041){_0x2b0d88['push'](_0x2b0d88['shift']());}};_0x1c9256(++_0x5b5ef2);}(_0xa395,0xef));var _0x5a39=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa395[_0x311c35];return _0x5cc50c;};'use strict';function ZendeskAccount(_0x37f0d8){this['id']=_0x37f0d8['id']||0x0;this[_0x5a39('0x0')]=_0x37f0d8['name']||'';this[_0x5a39('0x1')]=_0x37f0d8['username']||'';this[_0x5a39('0x2')]=_0x37f0d8[_0x5a39('0x2')]||'';this['token']=_0x37f0d8['token']||'';this[_0x5a39('0x3')]=_0x37f0d8[_0x5a39('0x3')]||'';this[_0x5a39('0x4')]=_0x37f0d8[_0x5a39('0x4')]||'';this['type']=_0x37f0d8['type']||'integrationTab';this[_0x5a39('0x5')]=_0x37f0d8[_0x5a39('0x5')]||'';this[_0x5a39('0x6')]=_0x37f0d8[_0x5a39('0x6')]||{};}module[_0x5a39('0x7')]=ZendeskAccount; \ No newline at end of file +var _0x32d0=['password','token','remoteUri','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x32d0,0x18e));var _0x032d=function(_0x2101b8,_0x38734e){_0x2101b8=_0x2101b8-0x0;var _0x6b64fe=_0x32d0[_0x2101b8];return _0x6b64fe;};'use strict';function ZendeskAccount(_0x4ab85c){this['id']=_0x4ab85c['id']||0x0;this[_0x032d('0x0')]=_0x4ab85c['name']||'';this['username']=_0x4ab85c[_0x032d('0x1')]||'';this['password']=_0x4ab85c[_0x032d('0x2')]||'';this[_0x032d('0x3')]=_0x4ab85c['token']||'';this[_0x032d('0x4')]=_0x4ab85c['remoteUri']||'';this['authType']=_0x4ab85c['authType']||'';this[_0x032d('0x5')]=_0x4ab85c[_0x032d('0x5')]||_0x032d('0x6');this[_0x032d('0x7')]=_0x4ab85c['serverUrl']||'';this[_0x032d('0x8')]=_0x4ab85c[_0x032d('0x8')]||{};}module[_0x032d('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 77299b4..244bc47 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 _0xa632=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','serverUrl'];(function(_0xd0ce9c,_0x44df5b){var _0x1647bc=function(_0x19c16f){while(--_0x19c16f){_0xd0ce9c['push'](_0xd0ce9c['shift']());}};_0x1647bc(++_0x44df5b);}(_0xa632,0x13a));var _0x2a63=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa632[_0x55f8b4];return _0x2475f9;};'use strict';function ZohoAccount(_0x3a5ea5){this['id']=_0x3a5ea5['id']||0x0;this[_0x2a63('0x0')]=_0x3a5ea5[_0x2a63('0x0')]||'';this[_0x2a63('0x1')]=_0x3a5ea5['description']||'';this[_0x2a63('0x2')]=_0x3a5ea5[_0x2a63('0x2')]||'';this[_0x2a63('0x3')]=_0x3a5ea5['zone']||'';this[_0x2a63('0x4')]=_0x3a5ea5[_0x2a63('0x4')]||'';this['clientSecret']=_0x3a5ea5['clientSecret']||'';this[_0x2a63('0x5')]=_0x3a5ea5[_0x2a63('0x5')]||'';this[_0x2a63('0x6')]=_0x3a5ea5['code']||'';this[_0x2a63('0x7')]=_0x3a5ea5[_0x2a63('0x7')]||'';this[_0x2a63('0x8')]=_0x3a5ea5[_0x2a63('0x8')]||{};}module[_0x2a63('0x9')]=ZohoAccount; \ No newline at end of file +var _0x9c7d=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','description','host','zone'];(function(_0x137f91,_0x2aa530){var _0x5845de=function(_0x11f088){while(--_0x11f088){_0x137f91['push'](_0x137f91['shift']());}};_0x5845de(++_0x2aa530);}(_0x9c7d,0x165));var _0xd9c7=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x9c7d[_0x2c1dcd];return _0x158ce5;};'use strict';function ZohoAccount(_0x459aaf){this['id']=_0x459aaf['id']||0x0;this['name']=_0x459aaf['name']||'';this[_0xd9c7('0x0')]=_0x459aaf['description']||'';this[_0xd9c7('0x1')]=_0x459aaf['host']||'';this[_0xd9c7('0x2')]=_0x459aaf[_0xd9c7('0x2')]||'';this[_0xd9c7('0x3')]=_0x459aaf[_0xd9c7('0x3')]||'';this['clientSecret']=_0x459aaf[_0xd9c7('0x4')]||'';this[_0xd9c7('0x5')]=_0x459aaf[_0xd9c7('0x5')]||'';this[_0xd9c7('0x6')]=_0x459aaf[_0xd9c7('0x6')]||'';this[_0xd9c7('0x7')]=_0x459aaf[_0xd9c7('0x7')]||'';this[_0xd9c7('0x8')]=_0x459aaf[_0xd9c7('0x8')]||{};}module[_0xd9c7('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 66a36bf..48dc7c0 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 _0x5eb8=['callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','moment','isNil','string','uniqueid','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry'];(function(_0x424497,_0x3a557c){var _0x14a13a=function(_0x45c9fc){while(--_0x45c9fc){_0x424497['push'](_0x424497['shift']());}};_0x14a13a(++_0x3a557c);}(_0x5eb8,0xb0));var _0x85eb=function(_0x188905,_0x398fac){_0x188905=_0x188905-0x0;var _0x2bf735=_0x5eb8[_0x188905];return _0x2bf735;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x85eb('0x0'));function checkNameSurname(_0x2598be,_0x393a8a,_0xd2f5dc){var _0x7e3c0='';if(!_[_0x85eb('0x1')](_0x393a8a)&&_0x85eb('0x2')===typeof _0x393a8a){_0x7e3c0+=_0x393a8a;}if(!_[_0x85eb('0x1')](_0xd2f5dc)&&_0x85eb('0x2')===typeof _0xd2f5dc){_0x7e3c0+='\x20'+_0xd2f5dc;}if(_0x7e3c0!==''){return _0x7e3c0;}return _0x2598be;}function Action(_0x1fde1a,_0x2bf83c,_0x1ba1d8,_0x4a8814,_0x16d7b9){this[_0x85eb('0x3')]=_0x1ba1d8||undefined;this[_0x85eb('0x4')]=_0x1fde1a['id'];this['queue']=_0x2bf83c[_0x85eb('0x5')];this['type']=_0x2bf83c[_0x85eb('0x6')];this[_0x85eb('0x7')]=_0x85eb('0x8');this[_0x85eb('0x9')]=![];this[_0x85eb('0xa')]=_[_0x85eb('0x1')](_0x1fde1a[_0x85eb('0xb')])?undefined:_0x1fde1a['Agent'][_0x85eb('0x5')];this[_0x85eb('0xc')]=this['membername']?util[_0x85eb('0xd')](_0x85eb('0xe'),this[_0x85eb('0xa')]):_0x4a8814||undefined;this[_0x85eb('0xf')]=checkNameSurname(_0x1fde1a['Contact']['phone'],_0x1fde1a[_0x85eb('0x10')]['firstName'],_0x1fde1a[_0x85eb('0x10')][_0x85eb('0x11')]);this[_0x85eb('0x12')]=_0x1fde1a[_0x85eb('0x12')]||![];this[_0x85eb('0x13')]=_0x1fde1a['phone'];this[_0x85eb('0x14')]=_0x1fde1a['scheduledat'];this[_0x85eb('0x15')]=_0x1fde1a[_0x85eb('0x15')]||0x0;this[_0x85eb('0x16')]=_0x1fde1a[_0x85eb('0x16')]||0x0;this['countnoanswerretry']=_0x1fde1a['countnoanswerretry']||0x0;this['countglobal']=(_0x1fde1a[_0x85eb('0x15')]||0x0)+(_0x1fde1a[_0x85eb('0x16')]||0x0)+(_0x1fde1a[_0x85eb('0x17')]||0x0)+(_0x1fde1a[_0x85eb('0x18')]||0x0)+(_0x1fde1a[_0x85eb('0x19')]||0x0)+(_0x1fde1a[_0x85eb('0x1a')]||0x0)+(_0x1fde1a['countmachineretry']||0x0)+(_0x1fde1a[_0x85eb('0x1b')]||0x0);this[_0x85eb('0x18')]=_0x1fde1a[_0x85eb('0x18')]||0x0;this['countdropretry']=_0x1fde1a['countdropretry']||0x0;this['countabandonedretry']=_0x1fde1a['countabandonedretry']||0x0;this[_0x85eb('0x1c')]=_0x1fde1a[_0x85eb('0x1c')]||0x0;this[_0x85eb('0x1b')]=_0x1fde1a[_0x85eb('0x1b')]||0x0;this[_0x85eb('0x1d')]=_0x1fde1a[_0x85eb('0x1d')];this['callbackuniqueid']=_0x1fde1a['callbackuniqueid'];this['callbackat']=_0x1fde1a[_0x85eb('0x1e')];this[_0x85eb('0x1f')]=_0x1fde1a[_0x85eb('0x1f')];this[_0x85eb('0x20')]=_0x1fde1a[_0x85eb('0x20')];this[_0x85eb('0x21')]=_0x1fde1a['ListId'];this[_0x85eb('0x22')]=_[_0x85eb('0x1')](_0x1fde1a[_0x85eb('0xb')])?_0x1fde1a[_0x85eb('0x22')]:_0x1fde1a[_0x85eb('0xb')]['id'];this['VoiceQueueId']=_0x1fde1a[_0x85eb('0x23')];this[_0x85eb('0x24')]='';this[_0x85eb('0x25')]='';}Action[_0x85eb('0x26')][_0x85eb('0x27')]=function(){return util[_0x85eb('0xd')]('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x85eb('0x28')]);};module['exports']=Action; \ No newline at end of file +var _0x8f4c=['lodash','moment','isNil','string','idContact','queue','name','type','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util'];(function(_0x34f903,_0x30cee3){var _0x29e775=function(_0x2fe25f){while(--_0x2fe25f){_0x34f903['push'](_0x34f903['shift']());}};_0x29e775(++_0x30cee3);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3585fb,_0x5df075){_0x3585fb=_0x3585fb-0x0;var _0x48fb79=_0x8f4c[_0x3585fb];return _0x48fb79;};'use strict';var util=require(_0xc8f4('0x0'));var _=require(_0xc8f4('0x1'));var moment=require(_0xc8f4('0x2'));function checkNameSurname(_0x43926b,_0x19893b,_0x134d73){var _0x580083='';if(!_[_0xc8f4('0x3')](_0x19893b)&&_0xc8f4('0x4')===typeof _0x19893b){_0x580083+=_0x19893b;}if(!_[_0xc8f4('0x3')](_0x134d73)&&'string'===typeof _0x134d73){_0x580083+='\x20'+_0x134d73;}if(_0x580083!==''){return _0x580083;}return _0x43926b;}function Action(_0x32cd80,_0x5208da,_0x4c86f8,_0x520063,_0x373506){this['uniqueid']=_0x4c86f8||undefined;this[_0xc8f4('0x5')]=_0x32cd80['id'];this[_0xc8f4('0x6')]=_0x5208da[_0xc8f4('0x7')];this[_0xc8f4('0x8')]=_0x5208da[_0xc8f4('0x8')];this['campaigntype']=_0xc8f4('0x6');this[_0xc8f4('0x9')]=![];this[_0xc8f4('0xa')]=_[_0xc8f4('0x3')](_0x32cd80['Agent'])?undefined:_0x32cd80[_0xc8f4('0xb')]['name'];this[_0xc8f4('0xc')]=this[_0xc8f4('0xa')]?util[_0xc8f4('0xd')](_0xc8f4('0xe'),this[_0xc8f4('0xa')]):_0x520063||undefined;this['calleridname']=checkNameSurname(_0x32cd80[_0xc8f4('0xf')][_0xc8f4('0x10')],_0x32cd80[_0xc8f4('0xf')][_0xc8f4('0x11')],_0x32cd80[_0xc8f4('0xf')][_0xc8f4('0x12')]);this['active']=_0x32cd80[_0xc8f4('0x13')]||![];this[_0xc8f4('0x14')]=_0x32cd80[_0xc8f4('0x10')];this[_0xc8f4('0x15')]=_0x32cd80[_0xc8f4('0x15')];this['countbusyretry']=_0x32cd80[_0xc8f4('0x16')]||0x0;this['countcongestionretry']=_0x32cd80['countcongestionretry']||0x0;this[_0xc8f4('0x17')]=_0x32cd80[_0xc8f4('0x17')]||0x0;this[_0xc8f4('0x18')]=(_0x32cd80[_0xc8f4('0x16')]||0x0)+(_0x32cd80[_0xc8f4('0x19')]||0x0)+(_0x32cd80[_0xc8f4('0x17')]||0x0)+(_0x32cd80[_0xc8f4('0x1a')]||0x0)+(_0x32cd80[_0xc8f4('0x1b')]||0x0)+(_0x32cd80[_0xc8f4('0x1c')]||0x0)+(_0x32cd80[_0xc8f4('0x1d')]||0x0)+(_0x32cd80[_0xc8f4('0x1e')]||0x0);this[_0xc8f4('0x1a')]=_0x32cd80[_0xc8f4('0x1a')]||0x0;this['countdropretry']=_0x32cd80[_0xc8f4('0x1b')]||0x0;this[_0xc8f4('0x1c')]=_0x32cd80[_0xc8f4('0x1c')]||0x0;this[_0xc8f4('0x1d')]=_0x32cd80[_0xc8f4('0x1d')]||0x0;this[_0xc8f4('0x1e')]=_0x32cd80[_0xc8f4('0x1e')]||0x0;this[_0xc8f4('0x1f')]=_0x32cd80['callback'];this[_0xc8f4('0x20')]=_0x32cd80[_0xc8f4('0x20')];this[_0xc8f4('0x21')]=_0x32cd80[_0xc8f4('0x21')];this['recallme']=_0x32cd80[_0xc8f4('0x22')];this['ContactId']=_0x32cd80[_0xc8f4('0x23')];this['ListId']=_0x32cd80[_0xc8f4('0x24')];this[_0xc8f4('0x25')]=_['isNil'](_0x32cd80[_0xc8f4('0xb')])?_0x32cd80[_0xc8f4('0x25')]:_0x32cd80[_0xc8f4('0xb')]['id'];this[_0xc8f4('0x26')]=_0x32cd80['VoiceQueueId'];this[_0xc8f4('0x27')]='';this[_0xc8f4('0x28')]='';}Action['prototype'][_0xc8f4('0x29')]=function(){return util[_0xc8f4('0xd')](_0xc8f4('0x2a'),this[_0xc8f4('0x2b')],this[_0xc8f4('0x2c')]);};module[_0xc8f4('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index ae80150..7c002e9 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(_0x4b6393,_0x16a365){var _0x28f412=function(_0x393192){while(--_0x393192){_0x4b6393['push'](_0x4b6393['shift']());}};_0x28f412(++_0x16a365);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x49d730,_0x89416d){var _0x426d64=function(_0x11f5ce){while(--_0x11f5ce){_0x49d730['push'](_0x49d730['shift']());}};_0x426d64(++_0x89416d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 e94ba1d..35decd6 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 _0xef06=['[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','endtime','connectedlinename','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','bluebird','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact'];(function(_0x51beba,_0x202d19){var _0x167ee0=function(_0x2d5b21){while(--_0x2d5b21){_0x51beba['push'](_0x51beba['shift']());}};_0x167ee0(++_0x202d19);}(_0xef06,0x17f));var _0x6ef0=function(_0x375325,_0x57a850){_0x375325=_0x375325-0x0;var _0x228f57=_0xef06[_0x375325];return _0x228f57;};'use strict';var util=require('util');var BPromise=require(_0x6ef0('0x0'));var logger=require('../../../config/logger')('preview');var cmHopper=require(_0x6ef0('0x1'));var cmHopperHistory=require(_0x6ef0('0x2'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x6ef0('0x3'));function loggerCatch(_0x5adb12){return function(_0x5e3644){logger[_0x6ef0('0x4')](_0x5adb12,util[_0x6ef0('0x5')](_0x5e3644,{'showHidden':![],'depth':null}));};}function create(_0x4d5da6){return cmHopperHistory['createHistory'](_0x4d5da6)[_0x6ef0('0x6')](loggerCatch(_0x6ef0('0x7')));}function createAgent(_0x1e3958){return BPromise[_0x6ef0('0x8')]()[_0x6ef0('0x9')](agentReportPreview[_0x6ef0('0xa')](_0x1e3958))[_0x6ef0('0x6')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x165484){return cmHopper[_0x6ef0('0xb')](_0x165484,!![])[_0x6ef0('0x6')](loggerCatch(_0x6ef0('0xc')));}exports[_0x6ef0('0xd')]=function(_0x219a63){return cmHopperBlack[_0x6ef0('0xd')](_0x219a63)['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x6ef0('0xe')]=function(_0xd59874){return BPromise[_0x6ef0('0x8')]()[_0x6ef0('0x9')](cmHopper[_0x6ef0('0xe')](_0xd59874))[_0x6ef0('0x6')](loggerCatch('[getContactPreview]\x20'));};exports[_0x6ef0('0xa')]=function(_0x1c700d,_0xc5644f){create(_0x1c700d)[_0x6ef0('0x6')](loggerCatch(_0xc5644f));moveContact(_0x1c700d)[_0x6ef0('0x6')](loggerCatch(_0xc5644f));};exports[_0x6ef0('0xf')]=function(_0x411793,_0x2b8cd5){createAgent(_0x411793)['catch'](loggerCatch(_0x2b8cd5));};exports[_0x6ef0('0x10')]=function(_0x43076b,_0x27a882){create(_0x43076b)[_0x6ef0('0x6')](loggerCatch(_0x27a882));};exports[_0x6ef0('0x11')]=function(_0x39072b,_0x7eb6fc){moveContact(_0x39072b)[_0x6ef0('0x6')](loggerCatch(_0x7eb6fc));};exports[_0x6ef0('0x12')]=function(_0x54763d,_0x4c31aa,_0x892cc7){if(_0x4c31aa){_0x54763d[_0x6ef0('0x13')]=null;}if(_0x892cc7){_0x54763d[_0x6ef0('0x14')]=![];}return cmHopper[_0x6ef0('0x12')](_0x54763d)[_0x6ef0('0x6')](loggerCatch(_0x6ef0('0x15')));};exports['countReScheduled']=function(_0x396a72){return cmHopper[_0x6ef0('0x16')](_0x396a72)[_0x6ef0('0x6')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x1f9809){return cmHopper[_0x6ef0('0x17')]({'UserId':null},_0x1f9809,0x1)[_0x6ef0('0x6')](loggerCatch('[unlockContact]\x20'));};exports[_0x6ef0('0x18')]=function(_0x5d8b50){return cmHopper[_0x6ef0('0x17')]({'active':![]},_0x5d8b50,0x1)[_0x6ef0('0x6')](loggerCatch(_0x6ef0('0x19')));};exports[_0x6ef0('0x1a')]=function(_0x26140d){var _0x56af1d={};_0x56af1d[_0x6ef0('0x1b')]=_0x26140d[_0x6ef0('0x1b')];_0x56af1d['uniqueid']=_0x26140d[_0x6ef0('0x1c')];_0x56af1d[_0x6ef0('0x1d')]=_0x26140d[_0x6ef0('0x1d')];_0x56af1d['calleridname']=_0x26140d[_0x6ef0('0x1e')];_0x56af1d[_0x6ef0('0x1f')]=_0x26140d[_0x6ef0('0x1f')];_0x56af1d[_0x6ef0('0x20')]=_0x26140d['answertime'];_0x56af1d['queuecallerleaveAt']=_0x26140d[_0x6ef0('0x21')];_0x56af1d[_0x6ef0('0x22')]=0x1;_0x56af1d['queuecallercompleteAt']=_0x26140d[_0x6ef0('0x23')];_0x56af1d[_0x6ef0('0x24')]=_0x26140d['membername'];_0x56af1d[_0x6ef0('0x25')]=_0x6ef0('0x26');_0x56af1d['exten']=_0x6ef0('0x27');_0x56af1d[_0x6ef0('0x28')]=0x0;_0x56af1d[_0x6ef0('0x29')]=0x1;_0x56af1d[_0x6ef0('0x2a')]=_0x26140d[_0x6ef0('0x2b')];_0x56af1d[_0x6ef0('0x2c')]=_0x6ef0('0x2d');return BPromise[_0x6ef0('0x8')]()[_0x6ef0('0x9')](voiceQueueReport[_0x6ef0('0x2e')](_0x56af1d))[_0x6ef0('0x6')](loggerCatch(_0x6ef0('0x2f')));};exports[_0x6ef0('0x30')]=function(_0x2ff1ec,_0x120833){return BPromise[_0x6ef0('0x8')]()[_0x6ef0('0x9')](cmHopper[_0x6ef0('0x30')](_0x2ff1ec,_0x120833))[_0x6ef0('0x6')](loggerCatch(_0x6ef0('0x31')));};exports['rescheduleContactInQueue']=function(_0x4c2c3d){return cmHopper[_0x6ef0('0x12')](_0x4c2c3d,!![],!![])[_0x6ef0('0x6')](loggerCatch(_0x6ef0('0x32')));}; \ No newline at end of file +var _0x0e11=['../rpc/voiceQueueReport','error','inspect','[createHistory]\x20','resolve','then','createHistory','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory'];(function(_0x149b9a,_0x4a3f2d){var _0x3307eb=function(_0x1ad3b3){while(--_0x1ad3b3){_0x149b9a['push'](_0x149b9a['shift']());}};_0x3307eb(++_0x4a3f2d);}(_0x0e11,0xc7));var _0x10e1=function(_0x277258,_0x458ebc){_0x277258=_0x277258-0x0;var _0x390d4d=_0x0e11[_0x277258];return _0x390d4d;};'use strict';var util=require(_0x10e1('0x0'));var BPromise=require(_0x10e1('0x1'));var logger=require('../../../config/logger')(_0x10e1('0x2'));var cmHopper=require(_0x10e1('0x3'));var cmHopperHistory=require(_0x10e1('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x10e1('0x5'));function loggerCatch(_0x1505f9){return function(_0x550774){logger[_0x10e1('0x6')](_0x1505f9,util[_0x10e1('0x7')](_0x550774,{'showHidden':![],'depth':null}));};}function create(_0x180a5c){return cmHopperHistory['createHistory'](_0x180a5c)['catch'](loggerCatch(_0x10e1('0x8')));}function createAgent(_0x4e9f60){return BPromise[_0x10e1('0x9')]()[_0x10e1('0xa')](agentReportPreview[_0x10e1('0xb')](_0x4e9f60))[_0x10e1('0xc')](loggerCatch(_0x10e1('0x8')));}function moveContact(_0x208c89){return cmHopper['moveContactManagedDialer'](_0x208c89,!![])[_0x10e1('0xc')](loggerCatch(_0x10e1('0xd')));}exports['checkIsBlackList']=function(_0x4bc203){return cmHopperBlack[_0x10e1('0xe')](_0x4bc203)[_0x10e1('0xc')](loggerCatch(_0x10e1('0xf')));};exports[_0x10e1('0x10')]=function(_0x2ac68){return BPromise[_0x10e1('0x9')]()[_0x10e1('0xa')](cmHopper[_0x10e1('0x10')](_0x2ac68))['catch'](loggerCatch(_0x10e1('0x11')));};exports['createHistory']=function(_0x59e80b,_0x2d176c){create(_0x59e80b)[_0x10e1('0xc')](loggerCatch(_0x2d176c));moveContact(_0x59e80b)[_0x10e1('0xc')](loggerCatch(_0x2d176c));};exports['createAgentHistory']=function(_0x48aa8b,_0x150e58){createAgent(_0x48aa8b)[_0x10e1('0xc')](loggerCatch(_0x150e58));};exports['createCustomerHistory']=function(_0x36bc29,_0x272b85){create(_0x36bc29)[_0x10e1('0xc')](loggerCatch(_0x272b85));};exports[_0x10e1('0x12')]=function(_0x1a17e4,_0x39ffc5){moveContact(_0x1a17e4)['catch'](loggerCatch(_0x39ffc5));};exports[_0x10e1('0x13')]=function(_0x5b6c65,_0x378114,_0x41b560){if(_0x378114){_0x5b6c65['UserId']=null;}if(_0x41b560){_0x5b6c65[_0x10e1('0x14')]=![];}return cmHopper[_0x10e1('0x13')](_0x5b6c65)[_0x10e1('0xc')](loggerCatch(_0x10e1('0x15')));};exports[_0x10e1('0x16')]=function(_0x1388f5){return cmHopper['countReScheduled'](_0x1388f5)[_0x10e1('0xc')](loggerCatch(_0x10e1('0x17')));};exports[_0x10e1('0x18')]=function(_0x4a6aae){return cmHopper[_0x10e1('0x18')]({'UserId':null},_0x4a6aae,0x1)[_0x10e1('0xc')](loggerCatch(_0x10e1('0x19')));};exports[_0x10e1('0x1a')]=function(_0x2bcb4c){return cmHopper[_0x10e1('0x18')]({'active':![]},_0x2bcb4c,0x1)[_0x10e1('0xc')](loggerCatch(_0x10e1('0x1b')));};exports[_0x10e1('0x1c')]=function(_0x252c7b){var _0x2dbe5e={};_0x2dbe5e[_0x10e1('0x1d')]=_0x252c7b[_0x10e1('0x1d')];_0x2dbe5e[_0x10e1('0x1e')]=_0x252c7b['uniqueid'];_0x2dbe5e[_0x10e1('0x1f')]=_0x252c7b['calleridnum'];_0x2dbe5e[_0x10e1('0x20')]=_0x252c7b[_0x10e1('0x20')];_0x2dbe5e[_0x10e1('0x21')]=_0x252c7b['queue'];_0x2dbe5e[_0x10e1('0x22')]=_0x252c7b[_0x10e1('0x23')];_0x2dbe5e[_0x10e1('0x24')]=_0x252c7b[_0x10e1('0x23')];_0x2dbe5e['queuecallercomplete']=0x1;_0x2dbe5e['queuecallercompleteAt']=_0x252c7b[_0x10e1('0x25')];_0x2dbe5e[_0x10e1('0x26')]=_0x252c7b[_0x10e1('0x27')];_0x2dbe5e[_0x10e1('0x28')]=_0x10e1('0x29');_0x2dbe5e[_0x10e1('0x2a')]='xcally-motion-preview';_0x2dbe5e[_0x10e1('0x2b')]=0x0;_0x2dbe5e[_0x10e1('0x2c')]=0x1;_0x2dbe5e[_0x10e1('0x2d')]=_0x252c7b[_0x10e1('0x27')];_0x2dbe5e['queuecallerexitreason']=_0x10e1('0x2e');return BPromise[_0x10e1('0x9')]()[_0x10e1('0xa')](voiceQueueReport[_0x10e1('0x2f')](_0x2dbe5e))['catch'](loggerCatch(_0x10e1('0x30')));};exports[_0x10e1('0x31')]=function(_0x55960c,_0x357d5e){return BPromise['resolve']()[_0x10e1('0xa')](cmHopper[_0x10e1('0x31')](_0x55960c,_0x357d5e))[_0x10e1('0xc')](loggerCatch(_0x10e1('0x32')));};exports['rescheduleContactInQueue']=function(_0x48443e){return cmHopper['rescheduleContact'](_0x48443e,!![],!![])['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ 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 cfac30e..5308bac 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 _0x7840=['monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','Global','active','scheduledat','add','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','motionChannel','voice','reachable','getDiff','milliseconds','diff','createBody','CampaignId','filterKey','idContact','queue','type','dialAnswer','countnoanswerretry','callback','callbackuniqueid','recallme','ListId','sipcallid','xmd-voicequeueid','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosloss','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','extractCalleridNumber','match','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','error','logger','inspect','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22'];(function(_0x221569,_0x411757){var _0x1f6056=function(_0x107dc0){while(--_0x107dc0){_0x221569['push'](_0x221569['shift']());}};_0x1f6056(++_0x411757);}(_0x7840,0x1e4));var _0x0784=function(_0x23ccd6,_0x20225a){_0x23ccd6=_0x23ccd6-0x0;var _0x59e6a7=_0x7840[_0x23ccd6];return _0x59e6a7;};'use strict';var util=require(_0x0784('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x0784('0x1'))('preview');var ipAgi=process[_0x0784('0x2')][_0x0784('0x3')]||_0x0784('0x4');var utils=require(_0x0784('0x5'));exports['loggerCatch']=function(_0x356730){return function(_0x3163df){logger[_0x0784('0x6')](_0x356730,util['inspect'](_0x3163df,{'showHidden':![],'depth':null}));};};exports[_0x0784('0x7')]=function(_0x4c6ec2,_0x470352){logger['info'](_0x4c6ec2,util[_0x0784('0x8')](_0x470352,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4d651d,_0x4a34a7){logger[_0x0784('0x6')](_0x4d651d,util[_0x0784('0x8')](_0x4a34a7,{'showHidden':![],'depth':null}));};exports[_0x0784('0x9')]=function(_0xbde239){return function(_0x30cb9b){logger['info'](_0xbde239,util['inspect'](_0x30cb9b,{'showHidden':![],'depth':null}));};};exports[_0x0784('0xa')]=function(_0x4cebd0,_0x50c2bb,_0x4f0328){return{'message':_0x4cebd0,'unlock':_0x50c2bb,'active':_0x4f0328};};exports[_0x0784('0xb')]=function(_0x3849eb,_0x1b17ac,_0x54307d){if(!_[_0x0784('0xc')](_0x54307d)&&'string'===typeof _0x54307d&&!_['isEmpty'](_0x54307d)){if(!_[_0x0784('0xc')](_0x1b17ac)&&_0x0784('0xd')===typeof _0x1b17ac&&!_[_0x0784('0xe')](_0x1b17ac)){return util[_0x0784('0xf')](_0x0784('0x10'),_0x1b17ac,_0x54307d);}return util['format'](_0x0784('0x10'),_0x54307d,_0x54307d);}if(!_[_0x0784('0xc')](_0x3849eb)&&_0x0784('0xd')===typeof _0x3849eb&&!_[_0x0784('0xe')](_0x3849eb)){return _0x3849eb;}return'\x22\x22\x20<>';};exports[_0x0784('0x11')]=function(_0x1f9b2c){if(_[_0x0784('0x12')](_0x1f9b2c)){return![];}return _0x1f9b2c;};exports[_0x0784('0x13')]=function(_0x39f3ef,_0x48e65d,_0xcad0f2,_0x23a9e4,_0x213faa,_0x412ee4){var _0x20f05b={'XMD-QUEUE':_0x48e65d[_0x0784('0x14')]?_0x48e65d[_0x0784('0x14')]['name']:'','XMD-CALLERID':_0x23a9e4,'XMD-CALLERID-PREVIEW':_0x412ee4?util[_0x0784('0xf')](_0x0784('0x10'),_0x412ee4[_0x0784('0x15')],_0x412ee4[_0x0784('0x16')]):_0x23a9e4,'XMD-DIALID':_0x213faa,'XMD-CONTACTID':_0x48e65d[_0x0784('0x17')],'XMD-CDRTYPE':_0x0784('0x18'),'CALLERID(all)':_0x23a9e4,'XMD-VOICEQUEUEID':_0x48e65d[_0x0784('0x19')],'XMD-DIALCHANNEL':_0xcad0f2,'XMD-DIALTIMEOUT':_0x39f3ef[_0x0784('0x1a')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x0784('0x1b'),_0x39f3ef['dialQueueProject2']?'g':'',_['isEmpty'](_0x39f3ef[_0x0784('0x1c')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x39f3ef[_0x0784('0x1d')]||'','XMD-AGI':_0x39f3ef[_0x0784('0x1e')]?util[_0x0784('0xf')](_0x0784('0x1f'),ipAgi,_0x39f3ef['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x39f3ef[_0x0784('0x20')]?util[_0x0784('0xf')](_0x0784('0x1f'),ipAgi,_0x39f3ef[_0x0784('0x20')]):_0x0784('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x412ee4?_0x412ee4[_0x0784('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x412ee4?_0x412ee4[_0x0784('0x23')]:'','XMD-DESTINATION':_0x0784('0x24'),'SIPADDHEADER':_0x0784('0x25')};if(!_[_0x0784('0xe')](_0x39f3ef[_0x0784('0x1c')])){_0x20f05b[util['format']('%s',_0x0784('0x26'))]=_0x39f3ef[_0x0784('0x1c')];_0x20f05b[util[_0x0784('0xf')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x213faa;}return _0x20f05b;};exports['toLowerVariables']=function(_0x2b8b2e){var _0xa1bf01={};for(var _0x3e4d7e in _0x2b8b2e){if(_0x2b8b2e[_0x0784('0x27')](_0x3e4d7e)){_0xa1bf01[util['format']('%s',_['toLower'](_0x3e4d7e))]=_0x2b8b2e[_0x3e4d7e];}}return{'variables':_0xa1bf01};};exports[_0x0784('0x28')]=function(_0x385cec,_0x2ff9e7){if(!_[_0x0784('0x12')](_0x385cec)){if(_0x385cec[_0x0784('0x27')](_0x0784('0x29'))){if(_0x385cec[_0x0784('0x29')]>0x0){_0x385cec['originated']-=0x1;}else{logger[_0x0784('0x6')](_0x0784('0x2a'),_0x2ff9e7);}}}else{logger[_0x0784('0x6')](_0x0784('0x2b'),_0x2ff9e7);}};exports['logBlacklist']=function(_0x12a6c2){var _0x344b3c=moment()[_0x0784('0xf')](_0x0784('0x2c'));_0x12a6c2[_0x0784('0x2d')]=0xd;_0x12a6c2[_0x0784('0x2e')]='Blacklist';_0x12a6c2[_0x0784('0x2f')]=_0x344b3c;_0x12a6c2[_0x0784('0x30')]=_0x344b3c;_0x12a6c2[_0x0784('0x31')]=_0x344b3c;};exports[_0x0784('0x32')]=function(_0x4862ec,_0x40e08a,_0x1ecbfc){var _0x3ff862=moment()[_0x0784('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x4862ec[_0x0784('0x2d')]=_0x40e08a;_0x4862ec[_0x0784('0x2e')]=_0x1ecbfc;_0x4862ec[_0x0784('0x30')]=_0x3ff862;_0x4862ec[_0x0784('0x33')]=utils[_0x0784('0x34')](_0x4862ec['responsetime'],_0x4862ec[_0x0784('0x2f')]);};exports[_0x0784('0x35')]=function(_0x148628,_0xa9393f,_0x49853b){_0x148628[_0x0784('0x36')]=_0xa9393f;_0x148628[_0x0784('0x37')]=_0x49853b;};exports[_0x0784('0x38')]=function(_0x371ed2,_0x1b69bb,_0x12aef7){var _0x5daee7=moment()[_0x0784('0xf')](_0x0784('0x2c'));_0x371ed2[_0x0784('0x2d')]=_0x1b69bb;_0x371ed2[_0x0784('0x2e')]=_0x12aef7;_0x371ed2[_0x0784('0x30')]=_0x371ed2[_0x0784('0x30')]?_0x371ed2[_0x0784('0x30')]:_0x5daee7;_0x371ed2['endtime']=_0x371ed2[_0x0784('0x31')]?_0x371ed2['endtime']:_0x5daee7;_0x371ed2[_0x0784('0x33')]=utils['getSeconds'](_0x371ed2['responsetime']||0x0,_0x371ed2['starttime']||0x0);_0x371ed2[_0x0784('0x39')]=_0x371ed2[_0x0784('0x3a')]?utils[_0x0784('0x34')](_0x371ed2[_0x0784('0x31')],_0x371ed2[_0x0784('0x3a')]):0x0;};exports[_0x0784('0x3b')]=function(_0x2da444){return _0x2da444===_0x0784('0x3c');};exports[_0x0784('0x3d')]=function(_0x2574ac,_0x391ae5,_0x27a092,_0x57eee2,_0x357208){var _0x2d52ec=_0x57eee2?'RECALL':_0x2574ac[_0x0784('0x15')];_0x2d52ec=_0x357208?_0x0784('0x3e'):_0x2d52ec;return{'actionid':_0x2574ac[_0x0784('0x3f')],'action':_0x0784('0x40'),'channel':_0x2574ac[_0x0784('0x41')],'callerid':util[_0x0784('0xf')](_0x0784('0x10'),_0x2d52ec,_0x2574ac[_0x0784('0x16')]),'Exten':_0x0784('0x24'),'Context':_0x0784('0x42'),'Priority':'1','variable':_0x27a092,'timeout':(_0x391ae5[_0x0784('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2574ac[_0x0784('0x3f')]};};exports['totalGlobal']=function(_0x308f13){return _0x308f13[_0x0784('0x44')]+_0x308f13[_0x0784('0x45')]+_0x308f13['countnoanswerretry']+_0x308f13['countagentrejectretry']+_0x308f13[_0x0784('0x46')];};exports[_0x0784('0x47')]=function(_0x1d580d){var _0x41fe5b=_['clone'](_0x1d580d);_0x41fe5b['state']=0xf;_0x41fe5b['statedesc']=_0x0784('0x48');return _0x41fe5b;};exports['scheduledAt']=function(_0x24f980,_0x4fa2e4,_0x4ed8b7){var _0x45bdb6={};_0x45bdb6[_0x4fa2e4]=_0x24f980[_0x4fa2e4];_0x45bdb6[_0x0784('0x49')]=![];_0x45bdb6[_0x0784('0x4a')]=moment()[_0x0784('0x4b')](_0x4ed8b7,'minutes')[_0x0784('0xf')](_0x0784('0x2c'));_0x45bdb6['ContactId']=_0x24f980['ContactId'];_0x45bdb6['ListId']=_0x24f980['ListId'];_0x45bdb6[_0x0784('0x19')]=_0x24f980['VoiceQueueId']||undefined;return _0x45bdb6;};exports['decrementTalkink']=function(_0xb0292a,_0x15c1b8){if(!_[_0x0784('0x12')](_0xb0292a)){if(_0xb0292a['pTalking']>0x0){_0xb0292a[_0x0784('0x4c')]-=0x1;}else{logger[_0x0784('0x6')](_0x15c1b8,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x15c1b8,_0x0784('0x4d'));}};exports[_0x0784('0x4e')]=function(_0x3636a3){if(_0x3636a3<=0x0){return!![];}return![];};function buildObj(_0x3229a8,_0x5a5523,_0x37b682){_0x3229a8[_0x0784('0x4f')]=_0x5a5523;_0x3229a8[_0x0784('0x50')]=_0x3229a8['queue'];_0x3229a8['interface']=_0x3229a8[_0x0784('0x41')];_0x3229a8[_0x0784('0x51')]=_0x0784('0x52');if(_0x37b682){_0x3229a8['mandatoryDisposition']=_0x37b682['mandatoryDisposition'];}return _0x3229a8;}exports['buildObj']=buildObj;exports['agentReadyId']=function(_0x400aaa){var _0x111e63=[];for(var _0x414602 in _0x400aaa){if(_0x400aaa[_0x0784('0x27')](_0x414602)){if(!_[_0x0784('0x12')](_0x400aaa[_0x414602])&&_0x400aaa[_0x414602][_0x0784('0x2d')]==='not_inuse'&&_0x400aaa[_0x414602]['status']===_0x0784('0x53')){_0x111e63['push'](_0x400aaa[_0x414602]['id']);}}}return _0x111e63;};exports[_0x0784('0x54')]=function(_0x5c856f){var _0x3377c9=moment()[_0x0784('0x55')](0x0);var _0x6f81a4=moment(_0x5c856f)[_0x0784('0x55')](0x0);return _0x3377c9[_0x0784('0x56')](_0x6f81a4,'seconds');};exports[_0x0784('0x57')]=function(_0x1fba24){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1fba24[_0x0784('0x17')],'ListId':_0x1fba24['ListId'],'VoiceQueueId':_0x1fba24[_0x0784('0x19')]||undefined,'CampaignId':_0x1fba24[_0x0784('0x58')]||undefined};};exports[_0x0784('0x59')]=function(_0x1710e8){if(_0x1710e8===_0x0784('0x3f')||_0x1710e8===_0x0784('0x5a')||_0x1710e8===_0x0784('0x5b')||_0x1710e8===_0x0784('0x5c')||_0x1710e8==='campaigntype'||_0x1710e8===_0x0784('0x5d')||_0x1710e8===_0x0784('0x36')||_0x1710e8==='channelAgent'||_0x1710e8===_0x0784('0x15')||_0x1710e8==='active'||_0x1710e8===_0x0784('0x16')||_0x1710e8===_0x0784('0x4a')||_0x1710e8===_0x0784('0x44')||_0x1710e8===_0x0784('0x45')||_0x1710e8===_0x0784('0x5e')||_0x1710e8==='countglobal'||_0x1710e8===_0x0784('0x5f')||_0x1710e8===_0x0784('0x60')||_0x1710e8==='callbackat'||_0x1710e8===_0x0784('0x61')||_0x1710e8==='ContactId'||_0x1710e8===_0x0784('0x62')||_0x1710e8==='UserId'||_0x1710e8===_0x0784('0x19')||_0x1710e8===_0x0784('0x63')||_0x1710e8===_0x0784('0x64')||_0x1710e8==='xmd-queue'||_0x1710e8==='xmd-phone'||_0x1710e8===_0x0784('0x65')||_0x1710e8===_0x0784('0x66')||_0x1710e8===_0x0784('0x67')||_0x1710e8===_0x0784('0x68')||_0x1710e8===_0x0784('0x69')||_0x1710e8==='xmd-dialchannel'||_0x1710e8===_0x0784('0x6a')||_0x1710e8==='xmd-cdrtype'||_0x1710e8==='xmd-callerid'||_0x1710e8===_0x0784('0x6b')||_0x1710e8==='xmd-agi'||_0x1710e8===_0x0784('0x6c')||_0x1710e8===_0x0784('0x6d')||_0x1710e8===_0x0784('0x6e')||_0x1710e8===_0x0784('0x6f')||_0x1710e8==='rtpaudioqosloss'||_0x1710e8===_0x0784('0x70')||_0x1710e8===_0x0784('0x71')||_0x1710e8==='rtpaudioqosrttbridged'||_0x1710e8===_0x0784('0x6c')||_0x1710e8===_0x0784('0x6d')||_0x1710e8===_0x0784('0x6e')||_0x1710e8===_0x0784('0x6f')||_0x1710e8===_0x0784('0x72')||_0x1710e8===_0x0784('0x70')||_0x1710e8==='rtpaudioqosrtt'||_0x1710e8==='rtpaudioqosrttbridged'||_0x1710e8===_0x0784('0x73')||_0x1710e8===_0x0784('0x74')||_0x1710e8===_0x0784('0x2d')||_0x1710e8===_0x0784('0x2e')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x587e53,_0x4e09c2){var _0x50d9fd,_0x2a0d1e,_0x4a9e94;if(_0x4e09c2<=0x0){_0x4e09c2=0x1;}_0x50d9fd=new RegExp(_0x0784('0x75')+_0x4e09c2+'}$');_0x2a0d1e=Math[_0x0784('0x76')](0xa,_0x4e09c2-0x1);_0x4a9e94=Math[_0x0784('0x76')](0xa,_0x4e09c2)-0x1;return util['format']('%s',_[_0x0784('0x77')](_0x587e53,_0x50d9fd,_['random'](_0x2a0d1e,_0x4a9e94)));};exports[_0x0784('0x78')]=function(_0x425b1c){var _0x48eb91=_0x425b1c['match'](/"(.*?)"/);return _0x48eb91?_0x48eb91[0x1]:_0x425b1c;};exports[_0x0784('0x79')]=function(_0x50e355){var _0x2a5d0e=_0x50e355[_0x0784('0x7a')](/<(.*?)>/);return _0x2a5d0e?_0x2a5d0e[0x1]:_0x50e355;};function buildNoAnswerEventPayload(_0xf529d3,_0x2f5396){var _0x25a26d=buildObj(_0xf529d3,_0x0784('0x7b'));if(!_[_0x0784('0xe')](_0x2f5396[_0x0784('0x7c')])){Object['keys'](_0x2f5396['variables'])[_0x0784('0x7d')](function(_0x279800){_0x25a26d[_0x279800[_0x0784('0x7e')]()]=_0x2f5396[_0x0784('0x7c')][_0x279800];});}return _0x25a26d;}exports[_0x0784('0x7f')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x589f=['ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','reachable','push','milliseconds','diff','CampaignId','filterKey','idContact','campaigntype','countglobal','callback','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','inspect','error','info','getCallerId','isUndefined','isEmpty','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','ContactId','VoiceQueueId','dialOriginateTimeout','format','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','Blacklist','starttime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','ringtime','getSeconds','logLookAgent','UserId','logCustomer','statedesc','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes'];(function(_0x418193,_0x10b336){var _0x244f00=function(_0x4319c0){while(--_0x4319c0){_0x418193['push'](_0x418193['shift']());}};_0x244f00(++_0x10b336);}(_0x589f,0x1df));var _0xf589=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0x589f[_0x516ffb];return _0x319667;};'use strict';var util=require(_0xf589('0x0'));var _=require(_0xf589('0x1'));var moment=require(_0xf589('0x2'));var logger=require(_0xf589('0x3'))(_0xf589('0x4'));var ipAgi=process[_0xf589('0x5')][_0xf589('0x6')]||'127.0.0.1';var utils=require(_0xf589('0x7'));exports[_0xf589('0x8')]=function(_0x23a580){return function(_0x3a626b){logger['error'](_0x23a580,util[_0xf589('0x9')](_0x3a626b,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x521075,_0x2da3d6){logger['info'](_0x521075,util['inspect'](_0x2da3d6,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4e6543,_0x3f6163){logger[_0xf589('0xa')](_0x4e6543,util[_0xf589('0x9')](_0x3f6163,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0xf74f3d){return function(_0x31479d){logger[_0xf589('0xb')](_0xf74f3d,util[_0xf589('0x9')](_0x31479d,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x22c1f2,_0x182d19,_0x62f949){return{'message':_0x22c1f2,'unlock':_0x182d19,'active':_0x62f949};};exports[_0xf589('0xc')]=function(_0x4d25eb,_0x4b856d,_0x5dc384){if(!_[_0xf589('0xd')](_0x5dc384)&&'string'===typeof _0x5dc384&&!_[_0xf589('0xe')](_0x5dc384)){if(!_[_0xf589('0xd')](_0x4b856d)&&_0xf589('0xf')===typeof _0x4b856d&&!_[_0xf589('0xe')](_0x4b856d)){return util['format'](_0xf589('0x10'),_0x4b856d,_0x5dc384);}return util['format'](_0xf589('0x10'),_0x5dc384,_0x5dc384);}if(!_[_0xf589('0xd')](_0x4d25eb)&&'string'===typeof _0x4d25eb&&!_[_0xf589('0xe')](_0x4d25eb)){return _0x4d25eb;}return _0xf589('0x11');};exports['isActive']=function(_0x5d7796){if(_[_0xf589('0x12')](_0x5d7796)){return![];}return _0x5d7796;};exports[_0xf589('0x13')]=function(_0x5e52af,_0x1d29e8,_0x395931,_0x29397b,_0xe1875f,_0x31baeb){var _0x1c4053={'XMD-QUEUE':_0x1d29e8[_0xf589('0x14')]?_0x1d29e8[_0xf589('0x14')][_0xf589('0x15')]:'','XMD-CALLERID':_0x29397b,'XMD-CALLERID-PREVIEW':_0x31baeb?util['format'](_0xf589('0x10'),_0x31baeb[_0xf589('0x16')],_0x31baeb['calleridnum']):_0x29397b,'XMD-DIALID':_0xe1875f,'XMD-CONTACTID':_0x1d29e8[_0xf589('0x17')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x29397b,'XMD-VOICEQUEUEID':_0x1d29e8[_0xf589('0x18')],'XMD-DIALCHANNEL':_0x395931,'XMD-DIALTIMEOUT':_0x5e52af[_0xf589('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0xf589('0x1a')]('\x22rtTxX%s%s\x22',_0x5e52af[_0xf589('0x1b')]?'g':'',_[_0xf589('0xe')](_0x5e52af['monitor_format'])?'':_0xf589('0x1c')),'XMD-DIALURL':_0x5e52af[_0xf589('0x1d')]||'','XMD-AGI':_0x5e52af['dialQueueProject']?util['format'](_0xf589('0x1e'),ipAgi,_0x5e52af[_0xf589('0x1f')]):'NONE','XMD-AGIAFTER':_0x5e52af['dialQueueProject2']?util[_0xf589('0x1a')](_0xf589('0x1e'),ipAgi,_0x5e52af[_0xf589('0x1b')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x31baeb?_0x31baeb['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x31baeb?_0x31baeb[_0xf589('0x20')]:'','XMD-DESTINATION':_0xf589('0x21'),'SIPADDHEADER':_0xf589('0x22')};if(!_[_0xf589('0xe')](_0x5e52af['monitor_format'])){_0x1c4053[util[_0xf589('0x1a')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x5e52af['monitor_format'];_0x1c4053[util[_0xf589('0x1a')]('%s',_0xf589('0x23'))]=_0xe1875f;}return _0x1c4053;};exports[_0xf589('0x24')]=function(_0x323c89){var _0xbcb3ca={};for(var _0x66a432 in _0x323c89){if(_0x323c89[_0xf589('0x25')](_0x66a432)){_0xbcb3ca[util[_0xf589('0x1a')]('%s',_[_0xf589('0x26')](_0x66a432))]=_0x323c89[_0x66a432];}}return{'variables':_0xbcb3ca};};exports[_0xf589('0x27')]=function(_0x4d69a9,_0x2d24cf){if(!_['isNil'](_0x4d69a9)){if(_0x4d69a9[_0xf589('0x25')](_0xf589('0x28'))){if(_0x4d69a9[_0xf589('0x28')]>0x0){_0x4d69a9[_0xf589('0x28')]-=0x1;}else{logger['error'](_0xf589('0x29'),_0x2d24cf);}}}else{logger[_0xf589('0xa')](_0xf589('0x2a'),_0x2d24cf);}};exports[_0xf589('0x2b')]=function(_0x3a1121){var _0x4107c8=moment()[_0xf589('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a1121[_0xf589('0x2c')]=0xd;_0x3a1121['statedesc']=_0xf589('0x2d');_0x3a1121[_0xf589('0x2e')]=_0x4107c8;_0x3a1121['responsetime']=_0x4107c8;_0x3a1121[_0xf589('0x2f')]=_0x4107c8;};exports[_0xf589('0x30')]=function(_0xeaaa62,_0x570a6c,_0x124bbd){var _0x3fa051=moment()['format'](_0xf589('0x31'));_0xeaaa62[_0xf589('0x2c')]=_0x570a6c;_0xeaaa62['statedesc']=_0x124bbd;_0xeaaa62[_0xf589('0x32')]=_0x3fa051;_0xeaaa62[_0xf589('0x33')]=utils[_0xf589('0x34')](_0xeaaa62[_0xf589('0x32')],_0xeaaa62[_0xf589('0x2e')]);};exports[_0xf589('0x35')]=function(_0x333831,_0x37650f,_0x2653d1){_0x333831['membername']=_0x37650f;_0x333831[_0xf589('0x36')]=_0x2653d1;};exports[_0xf589('0x37')]=function(_0x145c61,_0x584ea7,_0x409947){var _0x41fc39=moment()[_0xf589('0x1a')](_0xf589('0x31'));_0x145c61['state']=_0x584ea7;_0x145c61[_0xf589('0x38')]=_0x409947;_0x145c61[_0xf589('0x32')]=_0x145c61[_0xf589('0x32')]?_0x145c61[_0xf589('0x32')]:_0x41fc39;_0x145c61[_0xf589('0x2f')]=_0x145c61[_0xf589('0x2f')]?_0x145c61[_0xf589('0x2f')]:_0x41fc39;_0x145c61[_0xf589('0x33')]=utils['getSeconds'](_0x145c61[_0xf589('0x32')]||0x0,_0x145c61[_0xf589('0x2e')]||0x0);_0x145c61[_0xf589('0x39')]=_0x145c61[_0xf589('0x3a')]?utils[_0xf589('0x34')](_0x145c61[_0xf589('0x2f')],_0x145c61[_0xf589('0x3a')]):0x0;};exports[_0xf589('0x3b')]=function(_0x219c95){return _0x219c95===_0xf589('0x3c');};exports['variablesAction']=function(_0x5de7c9,_0x75de3a,_0x8f493a,_0x532fea,_0x2da7ad){var _0x3aedb7=_0x532fea?_0xf589('0x3d'):_0x5de7c9[_0xf589('0x16')];_0x3aedb7=_0x2da7ad?_0xf589('0x3e'):_0x3aedb7;return{'actionid':_0x5de7c9[_0xf589('0x3f')],'action':_0xf589('0x40'),'channel':_0x5de7c9[_0xf589('0x41')],'callerid':util[_0xf589('0x1a')](_0xf589('0x10'),_0x3aedb7,_0x5de7c9[_0xf589('0x42')]),'Exten':_0xf589('0x21'),'Context':_0xf589('0x43'),'Priority':'1','variable':_0x8f493a,'timeout':(_0x75de3a['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5de7c9[_0xf589('0x3f')]};};exports['totalGlobal']=function(_0x5807f8){return _0x5807f8[_0xf589('0x44')]+_0x5807f8[_0xf589('0x45')]+_0x5807f8[_0xf589('0x46')]+_0x5807f8[_0xf589('0x47')]+_0x5807f8[_0xf589('0x48')];};exports[_0xf589('0x49')]=function(_0x5b4499){var _0x12f9dc=_[_0xf589('0x4a')](_0x5b4499);_0x12f9dc[_0xf589('0x2c')]=0xf;_0x12f9dc[_0xf589('0x38')]=_0xf589('0x4b');return _0x12f9dc;};exports[_0xf589('0x4c')]=function(_0x33763e,_0x2a0fb4,_0x4c5dab){var _0x200d63={};_0x200d63[_0x2a0fb4]=_0x33763e[_0x2a0fb4];_0x200d63[_0xf589('0x4d')]=![];_0x200d63[_0xf589('0x4e')]=moment()[_0xf589('0x4f')](_0x4c5dab,_0xf589('0x50'))[_0xf589('0x1a')](_0xf589('0x31'));_0x200d63['ContactId']=_0x33763e[_0xf589('0x17')];_0x200d63[_0xf589('0x51')]=_0x33763e['ListId'];_0x200d63[_0xf589('0x18')]=_0x33763e[_0xf589('0x18')]||undefined;return _0x200d63;};exports['decrementTalkink']=function(_0x24ca10,_0x5e1e74){if(!_[_0xf589('0x12')](_0x24ca10)){if(_0x24ca10[_0xf589('0x52')]>0x0){_0x24ca10[_0xf589('0x52')]-=0x1;}else{logger[_0xf589('0xa')](_0x5e1e74,_0xf589('0x53'));}}else{logger['error'](_0x5e1e74,_0xf589('0x54'));}};exports['IsNotLoggedIn']=function(_0x2af0dd){if(_0x2af0dd<=0x0){return!![];}return![];};function buildObj(_0x29c523,_0x14edf9,_0x1453d4){_0x29c523[_0xf589('0x55')]=_0x14edf9;_0x29c523[_0xf589('0x15')]=_0x29c523[_0xf589('0x56')];_0x29c523[_0xf589('0x57')]=_0x29c523[_0xf589('0x41')];_0x29c523[_0xf589('0x58')]=_0xf589('0x59');if(_0x1453d4){_0x29c523['mandatoryDisposition']=_0x1453d4[_0xf589('0x5a')];}return _0x29c523;}exports[_0xf589('0x5b')]=buildObj;exports[_0xf589('0x5c')]=function(_0x3e992d){var _0x10b403=[];for(var _0x2c518e in _0x3e992d){if(_0x3e992d[_0xf589('0x25')](_0x2c518e)){if(!_[_0xf589('0x12')](_0x3e992d[_0x2c518e])&&_0x3e992d[_0x2c518e]['state']===_0xf589('0x5d')&&_0x3e992d[_0x2c518e]['status']===_0xf589('0x5e')){_0x10b403[_0xf589('0x5f')](_0x3e992d[_0x2c518e]['id']);}}}return _0x10b403;};exports['getDiff']=function(_0x11edb8){var _0x1db11c=moment()[_0xf589('0x60')](0x0);var _0x4e003c=moment(_0x11edb8)['milliseconds'](0x0);return _0x1db11c[_0xf589('0x61')](_0x4e003c,'seconds');};exports['createBody']=function(_0x117a5c){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x117a5c[_0xf589('0x17')],'ListId':_0x117a5c[_0xf589('0x51')],'VoiceQueueId':_0x117a5c[_0xf589('0x18')]||undefined,'CampaignId':_0x117a5c[_0xf589('0x62')]||undefined};};exports[_0xf589('0x63')]=function(_0x2bf1db){if(_0x2bf1db===_0xf589('0x3f')||_0x2bf1db===_0xf589('0x64')||_0x2bf1db==='queue'||_0x2bf1db==='type'||_0x2bf1db===_0xf589('0x65')||_0x2bf1db==='dialAnswer'||_0x2bf1db==='membername'||_0x2bf1db==='channelAgent'||_0x2bf1db===_0xf589('0x16')||_0x2bf1db===_0xf589('0x4d')||_0x2bf1db===_0xf589('0x42')||_0x2bf1db===_0xf589('0x4e')||_0x2bf1db===_0xf589('0x44')||_0x2bf1db===_0xf589('0x45')||_0x2bf1db==='countnoanswerretry'||_0x2bf1db===_0xf589('0x66')||_0x2bf1db===_0xf589('0x67')||_0x2bf1db==='callbackuniqueid'||_0x2bf1db==='callbackat'||_0x2bf1db===_0xf589('0x68')||_0x2bf1db===_0xf589('0x17')||_0x2bf1db===_0xf589('0x51')||_0x2bf1db===_0xf589('0x36')||_0x2bf1db===_0xf589('0x18')||_0x2bf1db===_0xf589('0x69')||_0x2bf1db===_0xf589('0x6a')||_0x2bf1db===_0xf589('0x6b')||_0x2bf1db===_0xf589('0x6c')||_0x2bf1db==='xmd-listid'||_0x2bf1db===_0xf589('0x6d')||_0x2bf1db===_0xf589('0x6e')||_0x2bf1db===_0xf589('0x6f')||_0x2bf1db===_0xf589('0x70')||_0x2bf1db===_0xf589('0x71')||_0x2bf1db===_0xf589('0x72')||_0x2bf1db===_0xf589('0x73')||_0x2bf1db==='xmd-callerid'||_0x2bf1db===_0xf589('0x74')||_0x2bf1db===_0xf589('0x75')||_0x2bf1db==='rtpaudioqos'||_0x2bf1db===_0xf589('0x76')||_0x2bf1db===_0xf589('0x77')||_0x2bf1db===_0xf589('0x78')||_0x2bf1db==='rtpaudioqosloss'||_0x2bf1db==='rtpaudioqoslossbridged'||_0x2bf1db===_0xf589('0x79')||_0x2bf1db===_0xf589('0x7a')||_0x2bf1db===_0xf589('0x7b')||_0x2bf1db==='rtpaudioqosbridged'||_0x2bf1db===_0xf589('0x77')||_0x2bf1db===_0xf589('0x78')||_0x2bf1db===_0xf589('0x7c')||_0x2bf1db===_0xf589('0x7d')||_0x2bf1db===_0xf589('0x79')||_0x2bf1db==='rtpaudioqosrttbridged'||_0x2bf1db===_0xf589('0x7e')||_0x2bf1db===_0xf589('0x7f')||_0x2bf1db===_0xf589('0x2c')||_0x2bf1db===_0xf589('0x38')){return![];}return!![];};exports[_0xf589('0x80')]=function(_0x466ba8,_0x556d85){var _0x1ef2a7,_0x1a954f,_0xeeb841;if(_0x556d85<=0x0){_0x556d85=0x1;}_0x1ef2a7=new RegExp('\x5cw{0,'+_0x556d85+'}$');_0x1a954f=Math[_0xf589('0x81')](0xa,_0x556d85-0x1);_0xeeb841=Math['pow'](0xa,_0x556d85)-0x1;return util[_0xf589('0x1a')]('%s',_[_0xf589('0x82')](_0x466ba8,_0x1ef2a7,_['random'](_0x1a954f,_0xeeb841)));};exports[_0xf589('0x83')]=function(_0x48e3c0){var _0x5e15d3=_0x48e3c0[_0xf589('0x84')](/"(.*?)"/);return _0x5e15d3?_0x5e15d3[0x1]:_0x48e3c0;};exports[_0xf589('0x85')]=function(_0x393a15){var _0x39d2c3=_0x393a15[_0xf589('0x84')](/<(.*?)>/);return _0x39d2c3?_0x39d2c3[0x1]:_0x393a15;};function buildNoAnswerEventPayload(_0x5bc50e,_0xd77395){var _0x4e41b2=buildObj(_0x5bc50e,_0xf589('0x86'));if(!_[_0xf589('0xe')](_0xd77395[_0xf589('0x87')])){Object[_0xf589('0x88')](_0xd77395[_0xf589('0x87')])[_0xf589('0x89')](function(_0x336646){_0x4e41b2[_0x336646[_0xf589('0x8a')]()]=_0xd77395[_0xf589('0x87')][_0x336646];});}return _0x4e41b2;}exports[_0xf589('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index f512833..53a0aa5 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 _0xaa09=['boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xaa09,0x105));var _0x9aa0=function(_0x4efc7c,_0x3d0c73){_0x4efc7c=_0x4efc7c-0x0;var _0x4db5f8=_0xaa09[_0x4efc7c];return _0x4db5f8;};'use strict';exports[_0x9aa0('0x0')]={'queue':{'type':_0x9aa0('0x1'),'required':!![]},'interface':{'type':_0x9aa0('0x1'),'required':!![]},'membername':{'type':_0x9aa0('0x1'),'required':!![]},'penalty':{'type':_0x9aa0('0x2'),'required':![]},'paused':{'type':_0x9aa0('0x3'),'required':![]}};exports[_0x9aa0('0x4')]={'queue':{'type':_0x9aa0('0x1'),'required':!![]},'interface':{'type':_0x9aa0('0x1'),'required':!![]}};exports[_0x9aa0('0x5')]={'interface':{'type':_0x9aa0('0x1'),'required':!![]},'paused':{'type':_0x9aa0('0x3')},'reason':{'type':_0x9aa0('0x1'),'required':![]}};exports[_0x9aa0('0x6')]={'module':{'type':_0x9aa0('0x1'),'required':![]}};exports[_0x9aa0('0x7')]={'uniqueid':{'type':_0x9aa0('0x1'),'required':!![]}};exports[_0x9aa0('0x8')]={'uniqueid':{'type':_0x9aa0('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x9aa0('0x1')},'mixmonitorid':{'type':_0x9aa0('0x1')}};exports[_0x9aa0('0x9')]={'uniqueid':{'type':_0x9aa0('0x1'),'required':!![]}};exports[_0x9aa0('0xa')]={'uniqueid':{'type':_0x9aa0('0x1'),'required':!![]},'exten':{'type':_0x9aa0('0x1'),'required':!![]},'context':{'type':_0x9aa0('0x1')}}; \ No newline at end of file +var _0x3ccf=['boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number'];(function(_0x1b8d87,_0x4168fb){var _0x182b74=function(_0x12b570){while(--_0x12b570){_0x1b8d87['push'](_0x1b8d87['shift']());}};_0x182b74(++_0x4168fb);}(_0x3ccf,0x66));var _0xf3cc=function(_0x2f0707,_0xc263d6){_0x2f0707=_0x2f0707-0x0;var _0x2b4a2d=_0x3ccf[_0x2f0707];return _0x2b4a2d;};'use strict';exports['queueadd']={'queue':{'type':_0xf3cc('0x0'),'required':!![]},'interface':{'type':_0xf3cc('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xf3cc('0x1'),'required':![]},'paused':{'type':_0xf3cc('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0xf3cc('0x0'),'required':!![]},'interface':{'type':_0xf3cc('0x0'),'required':!![]}};exports[_0xf3cc('0x3')]={'interface':{'type':_0xf3cc('0x0'),'required':!![]},'paused':{'type':_0xf3cc('0x2')},'reason':{'type':_0xf3cc('0x0'),'required':![]}};exports[_0xf3cc('0x4')]={'module':{'type':'string','required':![]}};exports[_0xf3cc('0x5')]={'uniqueid':{'type':_0xf3cc('0x0'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':_0xf3cc('0x0')},'mixmonitorid':{'type':'string'}};exports[_0xf3cc('0x6')]={'uniqueid':{'type':_0xf3cc('0x0'),'required':!![]}};exports[_0xf3cc('0x7')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xf3cc('0x0'),'required':!![]},'context':{'type':_0xf3cc('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index c784e90..e881f81 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 _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x160df3,_0x3b1589){var _0x3ebadc=function(_0x474b8d){while(--_0x474b8d){_0x160df3['push'](_0x160df3['shift']());}};_0x3ebadc(++_0x3b1589);}(_0xadb5,0xad));var _0x5adb=function(_0x1b5ef0,_0x486b19){_0x1b5ef0=_0x1b5ef0-0x0;var _0x3d25f3=_0xadb5[_0x1b5ef0];return _0x3d25f3;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file +var _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x3ebdfe,_0x2a1999){var _0x193891=function(_0x1d4838){while(--_0x1d4838){_0x3ebdfe['push'](_0x3ebdfe['shift']());}};_0x193891(++_0x2a1999);}(_0xadb5,0xad));var _0x5adb=function(_0xcc8c16,_0x4e3f63){_0xcc8c16=_0xcc8c16-0x0;var _0x2f3c3a=_0xadb5[_0xcc8c16];return _0x2f3c3a;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 16299ce..29aeea9 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 _0x6df7=['assign','hasOwnProperty'];(function(_0x155ecb,_0x3b700c){var _0x5af94f=function(_0x123d8e){while(--_0x123d8e){_0x155ecb['push'](_0x155ecb['shift']());}};_0x5af94f(++_0x3b700c);}(_0x6df7,0x154));var _0x76df=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6df7[_0x502c7d];return _0x30b7ed;};'use strict';function mergeDBDataToRealtime(_0x4dc23b,_0x54a990){var _0x5b077d=Object[_0x76df('0x0')]({},_0x4dc23b);for(var _0x3047ca in _0x54a990){if(_0x5b077d[_0x76df('0x1')](_0x3047ca)){_0x5b077d[_0x3047ca]=_0x54a990[_0x3047ca];}}return _0x5b077d;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x20af=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x493523,_0x266929){var _0x14fa52=function(_0x14da38){while(--_0x14da38){_0x493523['push'](_0x493523['shift']());}};_0x14fa52(++_0x266929);}(_0x20af,0x110));var _0xf20a=function(_0x1e7fb7,_0xf9ac6f){_0x1e7fb7=_0x1e7fb7-0x0;var _0x3a63e3=_0x20af[_0x1e7fb7];return _0x3a63e3;};'use strict';function mergeDBDataToRealtime(_0x44d423,_0x29743b){var _0x29dc05=Object[_0xf20a('0x0')]({},_0x44d423);for(var _0x5a2a07 in _0x29743b){if(_0x29dc05[_0xf20a('0x1')](_0x5a2a07)){_0x29dc05[_0x5a2a07]=_0x29743b[_0x5a2a07];}}return _0x29dc05;}exports[_0xf20a('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index cbcb59f..f0da981 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 _0xd606=['originatecalleridnum','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','UserId','monitor','monitors','monitorFilename','filename','connectedlinename','membername','xcally-motion-dialer','forEach','startsWith','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','./voiceQueueReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','attendedtransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','interface','SIP/%s','length','assigned','format','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','channel','callerid'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0xd606,0x178));var _0x6d60=function(_0x7da0db,_0x1f1eac){_0x7da0db=_0x7da0db-0x0;var _0xaecdd5=_0xd606[_0x7da0db];return _0xaecdd5;};'use strict';var _=require(_0x6d60('0x0'));var moment=require(_0x6d60('0x1'));var util=require(_0x6d60('0x2'));var config=require('../../../config/environment');var ami=require(_0x6d60('0x3'));var RpcVoiceAgentReport=require(_0x6d60('0x4'));var RpcVoiceCallReport=require(_0x6d60('0x5'));var RpcVoiceDialReport=require(_0x6d60('0x6'));var RpcMemberReport=require(_0x6d60('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x6d60('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x6d60('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x6d60('0xa'));var UserReport=require(_0x6d60('0xb'));function Report(_0x4acf3e){this[_0x6d60('0xc')]=_0x4acf3e;this[_0x6d60('0xd')]=_0x4acf3e['agents'];this['telephones']=_0x4acf3e[_0x6d60('0xe')];}Report[_0x6d60('0xf')]['sync']=function(_0x23fd9e){var _0x5952a9=new VoiceQueueReport(this[_0x6d60('0xc')]);var _0x5a67aa=new VoiceAgentReport(this[_0x6d60('0xc')]);var _0x3bbb92=new VoiceDialReport(this['realtime']);var _0x57f464=new VoiceCallReport(this[_0x6d60('0xc')]);var _0x2da41b=new UserReport(this['realtime']);if(config[_0x6d60('0x10')]&&config['xdr'][_0x6d60('0x11')]){ami['on'](_0x6d60('0x12'),this[_0x6d60('0x13')]['bind'](this));ami['on'](_0x6d60('0x14'),this[_0x6d60('0x15')][_0x6d60('0x16')](this));ami['on'](_0x6d60('0x17'),this[_0x6d60('0x18')][_0x6d60('0x16')](this));ami['on'](_0x6d60('0x19'),this[_0x6d60('0x1a')][_0x6d60('0x16')](this));ami['on']('blindtransfer',this['blindTransfer'][_0x6d60('0x16')](this));ami['on'](_0x6d60('0x1b'),this[_0x6d60('0x1c')][_0x6d60('0x16')](this));}};Report[_0x6d60('0xf')][_0x6d60('0x1d')]=function(_0xd3a492){var _0x458f88;_0x458f88=_[_0x6d60('0x1e')](this[_0x6d60('0xd')],function(_0x15fea7){return _0x15fea7['accountcode']==_0xd3a492||_0x15fea7[_0x6d60('0x1f')]==_0xd3a492;});if(_[_0x6d60('0x20')](_0x458f88)){var _0x913e79=_[_0x6d60('0x1e')](this[_0x6d60('0xe')],function(_0xba43bf){return _0xba43bf[_0x6d60('0x21')]==_0xd3a492||_0xba43bf['name']==_0xd3a492;});if(_0x913e79){_0x458f88=_[_0x6d60('0x1e')](this[_0x6d60('0xd')],function(_0x418481){return _0x418481[_0x6d60('0x22')]==util['format'](_0x6d60('0x23'),_0x913e79[_0x6d60('0x1f')]);});}}return _0x458f88;};Report[_0x6d60('0xf')]['voiceQueueReport']=function(_0x2b8237){for(var _0x522144=0x0;_0x522144<_0x2b8237[_0x6d60('0x24')];_0x522144+=0x1){var _0x1a3a44=this[_0x6d60('0x1d')](_0x2b8237[_0x522144]['connectedlinenum']);if(_0x1a3a44){_0x2b8237[_0x522144]['accountcode']=_0x1a3a44['accountcode'];_0x2b8237[_0x522144][_0x6d60('0x25')]=!![];_0x2b8237[_0x522144]['lastAssignedTo']=_0x1a3a44[_0x6d60('0x1f')];_0x2b8237[_0x522144][_0x6d60('0x22')]=_['isNil'](_0x1a3a44[_0x6d60('0x22')])?util[_0x6d60('0x26')](_0x6d60('0x23'),_0x1a3a44[_0x6d60('0x1f')]):_0x1a3a44[_0x6d60('0x22')];if(_0x2b8237[_0x522144][_0x6d60('0x27')]){_0x2b8237[_0x522144]['queuecallercompleteAt']=moment()[_0x6d60('0x26')](_0x6d60('0x28'));}if(_0x2b8237[_0x522144][_0x6d60('0x29')]){_0x2b8237[_0x522144][_0x6d60('0x2a')]=moment()[_0x6d60('0x26')](_0x6d60('0x28'));}RpcMemberReport[_0x6d60('0x13')](_0x2b8237[_0x522144]);}RpcVoiceQueueReport[_0x6d60('0x2b')](_0x2b8237[_0x522144]);}};function extractCalleridNumber(_0x501e25){var _0x4a7e4f=_0x501e25[_0x6d60('0x2c')](/<(.*?)>/);return _0x4a7e4f?_0x4a7e4f[0x1]:_0x501e25;}Report[_0x6d60('0xf')][_0x6d60('0x2d')]=function(_0x309ca8){for(var _0x20882c=0x0;_0x20882c','calleridname','linkedid','transfers','transfereelinkedid','type','UserId','membername','monitor','monitorFilename','monitors','filename','createdAt','exten','connectedlinename','isArray','forEach','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceCallReport','voiceCallReport','voiceAgentReport','bind','voiceDialReport','blindtransfer','blindTransfer','findAgent','find','accountcode','name','isNil','interface','voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','format','SIP/%s','queuecallercompleteAt','queuecallerexit','queuecallerexitAt'];(function(_0x494136,_0x489cf6){var _0x94dcc2=function(_0x4428c3){while(--_0x4428c3){_0x494136['push'](_0x494136['shift']());}};_0x94dcc2(++_0x489cf6);}(_0x171b,0x13d));var _0xb171=function(_0x370c6b,_0x1f50a7){_0x370c6b=_0x370c6b-0x0;var _0x37b430=_0x171b[_0x370c6b];return _0x37b430;};'use strict';var _=require(_0xb171('0x0'));var moment=require(_0xb171('0x1'));var util=require(_0xb171('0x2'));var config=require(_0xb171('0x3'));var ami=require(_0xb171('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xb171('0x5'));var RpcVoiceQueueReport=require(_0xb171('0x6'));var RpcVoiceRecording=require(_0xb171('0x7'));var RpcVoiceTransferReport=require(_0xb171('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xb171('0x9'));var VoiceAgentReport=require(_0xb171('0xa'));var VoiceDialReport=require(_0xb171('0xb'));var UserReport=require(_0xb171('0xc'));function Report(_0x5f0eb6){this['realtime']=_0x5f0eb6;this[_0xb171('0xd')]=_0x5f0eb6[_0xb171('0xd')];this[_0xb171('0xe')]=_0x5f0eb6[_0xb171('0xe')];}Report[_0xb171('0xf')][_0xb171('0x10')]=function(_0x17faa0){var _0x462814=new VoiceQueueReport(this[_0xb171('0x11')]);var _0x4b1dcd=new VoiceAgentReport(this[_0xb171('0x11')]);var _0x24b622=new VoiceDialReport(this[_0xb171('0x11')]);var _0x421a83=new VoiceCallReport(this['realtime']);var _0x4568cc=new UserReport(this[_0xb171('0x11')]);if(config[_0xb171('0x12')]&&config[_0xb171('0x12')][_0xb171('0x13')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport']['bind'](this));ami['on'](_0xb171('0x14'),this[_0xb171('0x15')]['bind'](this));ami['on']('custom:voiceAgentReport',this[_0xb171('0x16')][_0xb171('0x17')](this));ami['on']('custom:voiceDialReport',this[_0xb171('0x18')][_0xb171('0x17')](this));ami['on'](_0xb171('0x19'),this[_0xb171('0x1a')][_0xb171('0x17')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0xb171('0x17')](this));}};Report[_0xb171('0xf')][_0xb171('0x1b')]=function(_0x5bde9a){var _0x46e5c1;_0x46e5c1=_[_0xb171('0x1c')](this['agents'],function(_0x1fa317){return _0x1fa317[_0xb171('0x1d')]==_0x5bde9a||_0x1fa317[_0xb171('0x1e')]==_0x5bde9a;});if(_[_0xb171('0x1f')](_0x46e5c1)){var _0x1ef437=_[_0xb171('0x1c')](this[_0xb171('0xe')],function(_0x59c0f5){return _0x59c0f5['accountcode']==_0x5bde9a||_0x59c0f5[_0xb171('0x1e')]==_0x5bde9a;});if(_0x1ef437){_0x46e5c1=_['find'](this[_0xb171('0xd')],function(_0x1bd26c){return _0x1bd26c[_0xb171('0x20')]==util['format']('SIP/%s',_0x1ef437[_0xb171('0x1e')]);});}}return _0x46e5c1;};Report[_0xb171('0xf')][_0xb171('0x21')]=function(_0x291965){for(var _0x1f3c25=0x0;_0x1f3c25<_0x291965[_0xb171('0x22')];_0x1f3c25+=0x1){var _0x4a2959=this[_0xb171('0x1b')](_0x291965[_0x1f3c25][_0xb171('0x23')]);if(_0x4a2959){_0x291965[_0x1f3c25][_0xb171('0x1d')]=_0x4a2959[_0xb171('0x1d')];_0x291965[_0x1f3c25][_0xb171('0x24')]=!![];_0x291965[_0x1f3c25][_0xb171('0x25')]=_0x4a2959[_0xb171('0x1e')];_0x291965[_0x1f3c25][_0xb171('0x20')]=_[_0xb171('0x1f')](_0x4a2959[_0xb171('0x20')])?util[_0xb171('0x26')](_0xb171('0x27'),_0x4a2959[_0xb171('0x1e')]):_0x4a2959['interface'];if(_0x291965[_0x1f3c25]['queuecallercomplete']){_0x291965[_0x1f3c25][_0xb171('0x28')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x291965[_0x1f3c25][_0xb171('0x29')]){_0x291965[_0x1f3c25][_0xb171('0x2a')]=moment()[_0xb171('0x26')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xb171('0x21')](_0x291965[_0x1f3c25]);}RpcVoiceQueueReport[_0xb171('0x2b')](_0x291965[_0x1f3c25]);}};function extractCalleridNumber(_0x17c2bf){var _0x2fbd43=_0x17c2bf[_0xb171('0x2c')](/<(.*?)>/);return _0x2fbd43?_0x2fbd43[0x1]:_0x17c2bf;}Report[_0xb171('0xf')][_0xb171('0x2d')]=function(_0x33c973){for(var _0x18ecfc=0x0;_0x18ecfc0x0?!![]:![];if(!_0x54aa96){return this[_0xd5e0('0x1a')](this[_0xd5e0('0x46')][_0xd5e0('0x6a')]);}};VoiceQueueReport['prototype'][_0xd5e0('0x6b')]=function(_0x5c05f0){var _0x4f8640=this[_0xd5e0('0x46')]['id'];if(this[_0xd5e0('0x46')]['queuestatus'][_0x4f8640]&&this['summary'][_0xd5e0('0x5e')][_0x4f8640][_0x5c05f0[_0xd5e0('0x5d')]]){this[_0xd5e0('0x46')][_0xd5e0('0x5e')][_0x4f8640][_0x5c05f0[_0xd5e0('0x5d')]][_0xd5e0('0x11')]['push'](_0x5c05f0);}};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0x18')]=function(_0x4fd7ec){var _0x236f90=this;try{if(this['isNotNull'](_0x4fd7ec)&&this[_0xd5e0('0x58')](_0x4fd7ec['queue'])){logger[_0xd5e0('0x49')](_0xd5e0('0x6c'),util[_0xd5e0('0x42')](_0x4fd7ec,{'showHidden':![],'depth':null}));var _0x2b62b3=this['voiceQueues'][_0x4fd7ec[_0xd5e0('0x4d')]];if(_0x2b62b3){logger[_0xd5e0('0x49')](_0xd5e0('0x6d'),_0x2b62b3[_0xd5e0('0x56')]);this['summary'][_0xd5e0('0x60')][_0x2b62b3[_0xd5e0('0x56')]]={'summaryEvent':_0x4fd7ec};this['summary'][_0xd5e0('0x69')]+=0x1;return ami[_0xd5e0('0x3c')]({'action':_0xd5e0('0x5e'),'queue':_0x2b62b3[_0xd5e0('0x56')]})[_0xd5e0('0x5c')](function(_0x588ff4){if(!_0x236f90[_0xd5e0('0x46')][_0xd5e0('0x5e')][_0x4fd7ec[_0xd5e0('0x5d')]]){_0x236f90['summary'][_0xd5e0('0x5e')][_0x4fd7ec[_0xd5e0('0x5d')]]={};}_0x236f90[_0xd5e0('0x46')]['queuestatus'][_0x4fd7ec[_0xd5e0('0x5d')]][_0x588ff4[_0xd5e0('0x5d')]]={'queue':_0x2b62b3[_0xd5e0('0x56')],'agents':[]};})[_0xd5e0('0x5a')](function(_0x4ced76){throw _0x4ced76;});}}}catch(_0x12c254){logger['error'](_0xd5e0('0x5f'),util['inspect'](_0x12c254,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0xbd1fe6){if(this[_0xd5e0('0x46')][_0xd5e0('0x69')]>0x0){this[_0xd5e0('0x46')][_0xd5e0('0x6a')]=_0xbd1fe6;return;}logger[_0xd5e0('0x49')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0xbd1fe6,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0xd5e0('0x48')](_0xd5e0('0x6e'),{});};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0x1f')]=function(_0x4118a2){try{if(this[_0xd5e0('0x58')](_0x4118a2)){logger[_0xd5e0('0x49')](_0xd5e0('0x6f'),_0x4118a2[_0xd5e0('0x70')],util[_0xd5e0('0x42')](_0x4118a2,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xd5e0('0xf')][_0x4118a2[_0xd5e0('0x70')]])){this[_0xd5e0('0xf')][_0x4118a2[_0xd5e0('0x70')]]=[];}if(_['isUndefined'](this[_0xd5e0('0x12')][_0x4118a2[_0xd5e0('0x70')]])){this[_0xd5e0('0x12')][_0x4118a2[_0xd5e0('0x70')]]={};}var _0x40f7d7=new QueueReport();_0x40f7d7[_0xd5e0('0x4d')]=_0x4118a2[_0xd5e0('0x4d')];_0x40f7d7[_0xd5e0('0x66')]=this[_0xd5e0('0x14')][_0x40f7d7[_0xd5e0('0x4d')]]&&this[_0xd5e0('0x14')][_0x40f7d7[_0xd5e0('0x4d')]][_0xd5e0('0x66')]?this[_0xd5e0('0x14')][_0x40f7d7[_0xd5e0('0x4d')]][_0xd5e0('0x66')]||_0xd5e0('0x54'):_0xd5e0('0x54');_0x40f7d7[_0xd5e0('0x71')]=moment()['format'](_0xd5e0('0x72'));_0x40f7d7['position']=_0x4118a2[_0xd5e0('0x73')];_0x40f7d7[_0xd5e0('0x74')]=_0x4118a2[_0xd5e0('0x74')];_0x40f7d7[_0xd5e0('0x70')]=_0x4118a2['uniqueid'];_0x40f7d7[_0xd5e0('0x75')]=this[_0xd5e0('0x12')][_0x4118a2[_0xd5e0('0x70')]][_0xd5e0('0x75')];logger[_0xd5e0('0x76')](_0xd5e0('0x77'),_0x40f7d7[_0xd5e0('0x4d')],_0x40f7d7['type']);Object[_0xd5e0('0x65')](_0x40f7d7,_[_0xd5e0('0x78')](_0x4118a2,_['keys'](_0x40f7d7)));this[_0xd5e0('0xf')][_0x4118a2[_0xd5e0('0x70')]][_0xd5e0('0x79')](_0x40f7d7);this['channels'][_0x4118a2[_0xd5e0('0x70')]]=_0x40f7d7;this[_0xd5e0('0x7a')](_0x40f7d7,_0xd5e0('0x7b'));}}catch(_0x38a87c){logger[_0xd5e0('0x41')]('[%s][voiceQueueReport][queuecallerjoin]',_0x4118a2[_0xd5e0('0x70')],util[_0xd5e0('0x42')](_0x38a87c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd5e0('0xb')]['syncQueueCallerAbandon']=function(_0x45c65b){try{if(this[_0xd5e0('0x58')](_0x45c65b)){logger[_0xd5e0('0x49')](_0xd5e0('0x7c'),_0x45c65b[_0xd5e0('0x70')],util[_0xd5e0('0x42')](_0x45c65b,{'showHidden':![],'depth':null}));if(this[_0xd5e0('0xf')][_0x45c65b[_0xd5e0('0x70')]]){var _0x1e3dea=_['last'](this[_0xd5e0('0xf')][_0x45c65b[_0xd5e0('0x70')]]);_0x1e3dea['queuecallercomplete']=![];_0x1e3dea[_0xd5e0('0x7d')]=null;_0x1e3dea[_0xd5e0('0x7e')]=_0x45c65b['holdtime'];_0x1e3dea[_0xd5e0('0x7f')]=_0x45c65b['originalposition'];_0x1e3dea['queuecallerabandon']=!![];_0x1e3dea[_0xd5e0('0x80')]=moment()['format'](_0xd5e0('0x72'));_0x1e3dea[_0xd5e0('0x51')]=_0xd5e0('0x81');_0x1e3dea[_0xd5e0('0x82')]=null;logger['info'](_0xd5e0('0x83'),_0x1e3dea[_0xd5e0('0x4d')],_0x1e3dea[_0xd5e0('0x66')]);this[_0xd5e0('0x12')][_0x45c65b[_0xd5e0('0x70')]]=_0x1e3dea;this[_0xd5e0('0x4f')](_0x1e3dea,_0xd5e0('0x20'));}}}catch(_0x423fcf){logger[_0xd5e0('0x41')](_0xd5e0('0x7c'),_0x45c65b[_0xd5e0('0x70')],util[_0xd5e0('0x42')](_0x423fcf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x367927){try{if(this[_0xd5e0('0x58')](_0x367927)){logger[_0xd5e0('0x49')](_0xd5e0('0x84'),_0x367927['uniqueid'],util[_0xd5e0('0x42')](_0x367927,{'showHidden':![],'depth':null}));if(this[_0xd5e0('0xf')][_0x367927[_0xd5e0('0x70')]]){var _0x4962af=_['last'](this[_0xd5e0('0xf')][_0x367927[_0xd5e0('0x70')]]);_0x4962af[_0xd5e0('0x85')]=moment()[_0xd5e0('0x4b')](_0xd5e0('0x72'));_0x4962af[_0xd5e0('0x86')]=_0x367927[_0xd5e0('0x86')];_0x4962af[_0xd5e0('0x87')]=_0x367927[_0xd5e0('0x87')];logger[_0xd5e0('0x76')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4962af[_0xd5e0('0x4d')],_0x4962af[_0xd5e0('0x66')],_0x367927['connectedlinenum'],_0x367927[_0xd5e0('0x87')]);this[_0xd5e0('0x12')][_0x367927[_0xd5e0('0x70')]]=_0x4962af;this[_0xd5e0('0x7a')](_0x4962af,_0xd5e0('0x88'));}}}catch(_0x35bcb9){logger[_0xd5e0('0x41')]('[%s][voiceQueueReport][queuecallerleave]',_0x367927['uniqueid'],util['inspect'](_0x35bcb9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0x89')]=function(_0x126b18){try{if(this[_0xd5e0('0x58')](_0x126b18)){logger[_0xd5e0('0x49')](_0xd5e0('0x8a'),_0x126b18[_0xd5e0('0x70')],util['inspect'](_0x126b18,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x126b18[_0xd5e0('0x70')]]){var _0x448af1=_['last'](this[_0xd5e0('0xf')][_0x126b18['uniqueid']]);_0x448af1[_0xd5e0('0x8b')]=!![];_0x448af1['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0xd5e0('0x76')](_0xd5e0('0x8c'),_0x448af1[_0xd5e0('0x4d')],_0x448af1[_0xd5e0('0x66')]);}}}catch(_0x103e1a){logger[_0xd5e0('0x41')](_0xd5e0('0x8a'),_0x126b18['uniqueid'],util['inspect'](_0x103e1a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd5e0('0x22')]=function(_0x3414a7){try{if(this[_0xd5e0('0x58')](_0x3414a7)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x3414a7[_0xd5e0('0x70')],util['inspect'](_0x3414a7,{'showHidden':![],'depth':null}));if(this[_0xd5e0('0xf')][_0x3414a7[_0xd5e0('0x70')]]){var _0xd9c05f=_[_0xd5e0('0x8d')](this['queueReports'][_0x3414a7[_0xd5e0('0x70')]]);_0xd9c05f[_0xd5e0('0x20')]=![];_0xd9c05f['queuecallerabandonAt']=null;_0xd9c05f['assigned']=!![];_0xd9c05f[_0xd5e0('0x82')]=_0x3414a7[_0xd5e0('0x8e')];_0xd9c05f['holdtime']=_0x3414a7[_0xd5e0('0x7e')];_0xd9c05f[_0xd5e0('0x8b')]=!![];_0xd9c05f[_0xd5e0('0x38')]=![];_0xd9c05f['queuecallerexitAt']=null;if(!_0xd9c05f[_0xd5e0('0x8f')]){if(_0x3414a7[_0xd5e0('0x90')]==_0xd5e0('0x8f')){_0xd9c05f[_0xd5e0('0x51')]=_0xd5e0('0x91');logger[_0xd5e0('0x76')](_0xd5e0('0x92'),_0xd9c05f[_0xd5e0('0x4d')],_0xd9c05f['type']);}else{if(_[_0xd5e0('0x93')](_0x3414a7[_0xd5e0('0x3e')][_0xd5e0('0x94')](),_0xd5e0('0x95'))){if(this[_0xd5e0('0xf')][_0x3414a7[_0xd5e0('0x96')]]){var _0x36acfd=_[_0xd5e0('0x8d')](this[_0xd5e0('0xf')][_0x3414a7[_0xd5e0('0x96')]]);_0x36acfd['queuecallercomplete']=![];_0x36acfd[_0xd5e0('0x38')]=!![];_0x36acfd[_0xd5e0('0x97')]=moment(_0xd9c05f[_0xd5e0('0x71')])['add'](_0x3414a7[_0xd5e0('0x7e')],_0xd5e0('0x98'))[_0xd5e0('0x4b')](_0xd5e0('0x72'));_0x36acfd['queuecallerexitreason']=_0xd5e0('0x99');_0x36acfd[_0xd5e0('0x8f')]=!![];_0x36acfd[_0xd5e0('0x9a')]=_0xd5e0('0x9b');_0x36acfd['transferexten']=_0x3414a7[_0xd5e0('0x9c')];_0x36acfd[_0xd5e0('0x9d')]=_0x3414a7[_0xd5e0('0x70')];logger[_0xd5e0('0x76')](_0xd5e0('0x9e'),_0x36acfd[_0xd5e0('0x4d')],_0x36acfd[_0xd5e0('0x66')]);var _0x36dd26=this[_0xd5e0('0xf')][_0x3414a7['linkedid']];this[_0xd5e0('0xf')][_0x3414a7[_0xd5e0('0x96')]]=this[_0xd5e0('0xf')][_0x3414a7[_0xd5e0('0x70')]];this['queueReports'][_0x3414a7[_0xd5e0('0x70')]]=_0x36dd26;}}else{_0xd9c05f['queuecallerexitreason']=_0xd5e0('0x9f')+_0x3414a7['reason'][_0xd5e0('0xa0')]();logger[_0xd5e0('0x76')](_0xd5e0('0xa1'),_0xd9c05f[_0xd5e0('0x4d')],_0xd9c05f[_0xd5e0('0x66')],_0xd9c05f[_0xd5e0('0x51')]);}}}this[_0xd5e0('0x12')][_0x3414a7[_0xd5e0('0x70')]]=_0xd9c05f;}}}catch(_0x53b1ba){logger['error'](_0xd5e0('0xa2'),_0x3414a7[_0xd5e0('0x70')],util['inspect'](_0x53b1ba,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0xa3')]=function(_0xb3adcc){try{if(this['isNotNull'](_0xb3adcc)){logger[_0xd5e0('0x49')](_0xd5e0('0xa4'),_0xb3adcc['uniqueid'],util[_0xd5e0('0x42')](_0xb3adcc,{'showHidden':![],'depth':null}));this['addVariable'](_0xb3adcc[_0xd5e0('0x70')],_['keys'](_0xb3adcc[_0xd5e0('0xa5')])[0x0],_0xb3adcc['value']);if(this[_0xd5e0('0xf')][_0xb3adcc[_0xd5e0('0x70')]]){var _0x518072=_[_0xd5e0('0x8d')](this[_0xd5e0('0xf')][_0xb3adcc['uniqueid']]);if(_0x518072){if(this[_0xd5e0('0x58')](_0xb3adcc[_0xd5e0('0xa5')])&&this[_0xd5e0('0x58')](_0xb3adcc[_0xd5e0('0xa5')][_0xd5e0('0x5e')])){switch(_0xb3adcc['value']){case _0xd5e0('0xa6'):_0x518072[_0xd5e0('0x38')]=![];_0x518072['queuecallerexitAt']=null;break;case'TIMEOUT':_0x518072[_0xd5e0('0xa7')]=_0xd5e0('0xa8');_0x518072[_0xd5e0('0x38')]=!![];_0x518072[_0xd5e0('0x97')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x518072[_0xd5e0('0x85')]=moment()[_0xd5e0('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xd5e0('0x49')](_0xd5e0('0xa9'),_0xb3adcc['uniqueid'],util[_0xd5e0('0x42')](_0x518072,{'showHidden':![],'depth':null}));ami[_0xd5e0('0x48')](_0xd5e0('0xaa'),_0x518072);break;default:_0x518072[_0xd5e0('0x38')]=!![];_0x518072['queuecallerexitAt']=moment()[_0xd5e0('0x4b')](_0xd5e0('0x72'));_0x518072[_0xd5e0('0x85')]=moment()[_0xd5e0('0x4b')](_0xd5e0('0x72'));}_0x518072[_0xd5e0('0x20')]=![];_0x518072[_0xd5e0('0x80')]=null;_0x518072[_0xd5e0('0x51')]=_0xb3adcc[_0xd5e0('0xab')];this[_0xd5e0('0x12')][_0xb3adcc[_0xd5e0('0x70')]]=_0x518072;this[_0xd5e0('0x4f')](_0x518072,_0xd5e0('0x24'));}else if(this[_0xd5e0('0x58')](_0xb3adcc[_0xd5e0('0xa5')])&&this[_0xd5e0('0x58')](_0xb3adcc[_0xd5e0('0xa5')][_0xd5e0('0xac')])){if(!_0x518072[_0xd5e0('0x20')]){_0x518072[_0xd5e0('0x38')]=!![];_0x518072[_0xd5e0('0x97')]=moment()[_0xd5e0('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x518072['queuecallerexitreason']=_0xd5e0('0xad');_0x518072['queuecallerleaveAt']=moment()[_0xd5e0('0x4b')](_0xd5e0('0x72'));this[_0xd5e0('0x12')][_0xb3adcc[_0xd5e0('0x70')]]=_0x518072;}}logger[_0xd5e0('0x76')](_0xd5e0('0xae'),_0xb3adcc[_0xd5e0('0x70')],_0x518072[_0xd5e0('0x4d')],_0x518072[_0xd5e0('0x66')],_[_0xd5e0('0xaf')](_0xb3adcc[_0xd5e0('0xa5')])[0x0],_0xb3adcc[_0xd5e0('0xab')]);_0x518072[_0xd5e0('0x16')]=this[_0xd5e0('0x16')][_0xb3adcc['uniqueid']];}}}}catch(_0xd79872){logger[_0xd5e0('0x41')](_0xd5e0('0xa4'),_0xb3adcc[_0xd5e0('0x70')],util['inspect'](_0xd79872,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd5e0('0xb0')]=function(_0x4e33b3,_0x108b6a,_0x1c5e91){var _0x38384a=[_0xd5e0('0xb1'),_0xd5e0('0xb2'),_0xd5e0('0xb3'),_0xd5e0('0xb4'),_0xd5e0('0xb5'),_0xd5e0('0xb6'),_0xd5e0('0xb7'),'rtpaudioqosrttbridged',_0xd5e0('0xb8'),_0xd5e0('0xb9'),_0xd5e0('0xba'),_0xd5e0('0xbb'),_0xd5e0('0xbc'),_0xd5e0('0xbd'),_0xd5e0('0xbe'),'memberlastcall','membername',_0xd5e0('0xbf'),_0xd5e0('0xc0')];if(!_[_0xd5e0('0x3b')](_0x108b6a)&&!_[_0xd5e0('0xc1')](_0x38384a,_0x108b6a)){if(_[_0xd5e0('0x59')](this['variables'][_0x4e33b3])){this[_0xd5e0('0x16')][_0x4e33b3]={};}this[_0xd5e0('0x16')][_0x4e33b3][_0x108b6a]=_0x1c5e91;}};VoiceQueueReport[_0xd5e0('0xb')]['handleHangup']=function(_0x29178e,_0x4ee0db,_0x222e85){try{var _0x20f100={};if(this[_0xd5e0('0xf')][_0x29178e]){for(var _0x1de315=0x0;_0x1de3150x0?!![]:![];if(!_0x17379e){return this[_0x8647('0x17')](this[_0x8647('0x47')][_0x8647('0x6c')]);}};VoiceQueueReport[_0x8647('0xa')][_0x8647('0x6d')]=function(_0x458807){var _0x355cef=this['summary']['id'];if(this['summary']['queuestatus'][_0x355cef]&&this[_0x8647('0x47')][_0x8647('0x63')][_0x355cef][_0x458807[_0x8647('0x62')]]){this[_0x8647('0x47')][_0x8647('0x63')][_0x355cef][_0x458807['actionid']][_0x8647('0xf')][_0x8647('0x6e')](_0x458807);}};VoiceQueueReport['prototype'][_0x8647('0x15')]=function(_0x502a6b){var _0x1ce4dd=this;try{if(this[_0x8647('0x6f')](_0x502a6b)&&this[_0x8647('0x6f')](_0x502a6b['queue'])){logger[_0x8647('0x4c')](_0x8647('0x70'),util[_0x8647('0x41')](_0x502a6b,{'showHidden':![],'depth':null}));var _0x562a0f=this[_0x8647('0x11')][_0x502a6b['queue']];if(_0x562a0f){logger[_0x8647('0x4c')](_0x8647('0x71'),_0x562a0f[_0x8647('0x5c')]);this['summary'][_0x8647('0x5f')][_0x562a0f[_0x8647('0x5c')]]={'summaryEvent':_0x502a6b};this['summary'][_0x8647('0x6b')]+=0x1;return ami[_0x8647('0x3a')]({'action':_0x8647('0x63'),'queue':_0x562a0f[_0x8647('0x5c')]})[_0x8647('0x61')](function(_0xfd7ced){if(!_0x1ce4dd[_0x8647('0x47')]['queuestatus'][_0x502a6b[_0x8647('0x62')]]){_0x1ce4dd[_0x8647('0x47')][_0x8647('0x63')][_0x502a6b['actionid']]={};}_0x1ce4dd['summary'][_0x8647('0x63')][_0x502a6b[_0x8647('0x62')]][_0xfd7ced[_0x8647('0x62')]]={'queue':_0x562a0f[_0x8647('0x5c')],'agents':[]};})[_0x8647('0x3d')](function(_0x3b0a6d){throw _0x3b0a6d;});}}}catch(_0x5c3fb3){logger[_0x8647('0x43')](_0x8647('0x72'),util[_0x8647('0x41')](_0x5c3fb3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8647('0xa')][_0x8647('0x17')]=function(_0x5d0376){if(this[_0x8647('0x47')]['statusRequests']>0x0){this[_0x8647('0x47')][_0x8647('0x6c')]=_0x5d0376;return;}logger['debug'](_0x8647('0x73'),util['inspect'](_0x5d0376,{'showHidden':![],'depth':null}));this[_0x8647('0x47')]=initializeSummary();ami[_0x8647('0x4a')](_0x8647('0x74'),{});};VoiceQueueReport[_0x8647('0xa')][_0x8647('0x1b')]=function(_0x39b9b4){try{if(this[_0x8647('0x6f')](_0x39b9b4)){logger[_0x8647('0x4c')](_0x8647('0x75'),_0x39b9b4[_0x8647('0x4f')],util[_0x8647('0x41')](_0x39b9b4,{'showHidden':![],'depth':null}));if(_[_0x8647('0x5e')](this[_0x8647('0xe')][_0x39b9b4[_0x8647('0x4f')]])){this[_0x8647('0xe')][_0x39b9b4['uniqueid']]=[];}if(_[_0x8647('0x5e')](this[_0x8647('0x10')][_0x39b9b4['uniqueid']])){this['channels'][_0x39b9b4[_0x8647('0x4f')]]={};}var _0x2d49bd=new QueueReport();_0x2d49bd[_0x8647('0x51')]=_0x39b9b4[_0x8647('0x51')];_0x2d49bd[_0x8647('0x5a')]=this['voiceQueues'][_0x2d49bd[_0x8647('0x51')]]&&this[_0x8647('0x11')][_0x2d49bd[_0x8647('0x51')]]['type']?this[_0x8647('0x11')][_0x2d49bd['queue']][_0x8647('0x5a')]||_0x8647('0x5b'):'inbound';_0x2d49bd[_0x8647('0x76')]=moment()[_0x8647('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x2d49bd[_0x8647('0x77')]=_0x39b9b4[_0x8647('0x77')];_0x2d49bd[_0x8647('0x78')]=_0x39b9b4[_0x8647('0x78')];_0x2d49bd[_0x8647('0x4f')]=_0x39b9b4[_0x8647('0x4f')];_0x2d49bd['routealias']=this['channels'][_0x39b9b4['uniqueid']][_0x8647('0x79')];logger[_0x8647('0x7a')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x2d49bd[_0x8647('0x51')],_0x2d49bd[_0x8647('0x5a')]);Object['assign'](_0x2d49bd,_[_0x8647('0x7b')](_0x39b9b4,_[_0x8647('0x7c')](_0x2d49bd)));this['queueReports'][_0x39b9b4[_0x8647('0x4f')]]['push'](_0x2d49bd);this[_0x8647('0x10')][_0x39b9b4[_0x8647('0x4f')]]=_0x2d49bd;this[_0x8647('0x4b')](_0x2d49bd,_0x8647('0x1a'));}}catch(_0x44b034){logger[_0x8647('0x43')]('[%s][voiceQueueReport][queuecallerjoin]',_0x39b9b4['uniqueid'],util[_0x8647('0x41')](_0x44b034,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8647('0xa')][_0x8647('0x7d')]=function(_0x214eaa){try{if(this['isNotNull'](_0x214eaa)){logger[_0x8647('0x4c')](_0x8647('0x7e'),_0x214eaa[_0x8647('0x4f')],util['inspect'](_0x214eaa,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x214eaa[_0x8647('0x4f')]]){var _0x361d34=_[_0x8647('0x7f')](this[_0x8647('0xe')][_0x214eaa[_0x8647('0x4f')]]);_0x361d34[_0x8647('0x35')]=![];_0x361d34[_0x8647('0x80')]=null;_0x361d34[_0x8647('0x81')]=_0x214eaa[_0x8647('0x81')];_0x361d34[_0x8647('0x82')]=_0x214eaa[_0x8647('0x82')];_0x361d34[_0x8647('0x1c')]=!![];_0x361d34['queuecallerabandonAt']=moment()[_0x8647('0x56')](_0x8647('0x83'));_0x361d34[_0x8647('0x54')]=_0x8647('0x84');_0x361d34[_0x8647('0x85')]=null;logger['info'](_0x8647('0x86'),_0x361d34[_0x8647('0x51')],_0x361d34[_0x8647('0x5a')]);this[_0x8647('0x10')][_0x214eaa[_0x8647('0x4f')]]=_0x361d34;this[_0x8647('0x48')](_0x361d34,_0x8647('0x1c'));}}}catch(_0x50a827){logger[_0x8647('0x43')](_0x8647('0x7e'),_0x214eaa[_0x8647('0x4f')],util['inspect'](_0x50a827,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8647('0xa')][_0x8647('0x1e')]=function(_0x131934){try{if(this[_0x8647('0x6f')](_0x131934)){logger[_0x8647('0x4c')](_0x8647('0x87'),_0x131934[_0x8647('0x4f')],util['inspect'](_0x131934,{'showHidden':![],'depth':null}));if(this[_0x8647('0xe')][_0x131934['uniqueid']]){var _0x10d329=_['last'](this['queueReports'][_0x131934[_0x8647('0x4f')]]);_0x10d329[_0x8647('0x88')]=moment()[_0x8647('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x10d329[_0x8647('0x89')]=_0x131934[_0x8647('0x89')];_0x10d329[_0x8647('0x8a')]=_0x131934[_0x8647('0x8a')];logger[_0x8647('0x7a')](_0x8647('0x8b'),_0x10d329[_0x8647('0x51')],_0x10d329[_0x8647('0x5a')],_0x131934['connectedlinenum'],_0x131934['connectedlinename']);this[_0x8647('0x10')][_0x131934[_0x8647('0x4f')]]=_0x10d329;this[_0x8647('0x4b')](_0x10d329,_0x8647('0x1d'));}}}catch(_0x14d48b){logger[_0x8647('0x43')](_0x8647('0x87'),_0x131934[_0x8647('0x4f')],util[_0x8647('0x41')](_0x14d48b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8647('0xa')][_0x8647('0x8c')]=function(_0x9b96b){try{if(this[_0x8647('0x6f')](_0x9b96b)){logger[_0x8647('0x4c')](_0x8647('0x8d'),_0x9b96b[_0x8647('0x4f')],util[_0x8647('0x41')](_0x9b96b,{'showHidden':![],'depth':null}));if(this[_0x8647('0xe')][_0x9b96b[_0x8647('0x4f')]]){var _0x19195d=_[_0x8647('0x7f')](this[_0x8647('0xe')][_0x9b96b[_0x8647('0x4f')]]);_0x19195d[_0x8647('0x35')]=!![];_0x19195d[_0x8647('0x54')]=_0x8647('0x8e');logger[_0x8647('0x7a')](_0x8647('0x8f'),_0x19195d[_0x8647('0x51')],_0x19195d[_0x8647('0x5a')]);}}}catch(_0x4138cd){logger[_0x8647('0x43')](_0x8647('0x8d'),_0x9b96b['uniqueid'],util[_0x8647('0x41')](_0x4138cd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8647('0xa')][_0x8647('0x1f')]=function(_0x130924){try{if(this['isNotNull'](_0x130924)){logger[_0x8647('0x4c')](_0x8647('0x90'),_0x130924[_0x8647('0x4f')],util[_0x8647('0x41')](_0x130924,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x130924['uniqueid']]){var _0x4696c9=_[_0x8647('0x7f')](this[_0x8647('0xe')][_0x130924[_0x8647('0x4f')]]);_0x4696c9[_0x8647('0x1c')]=![];_0x4696c9['queuecallerabandonAt']=null;_0x4696c9[_0x8647('0x91')]=!![];_0x4696c9[_0x8647('0x85')]=_0x130924[_0x8647('0x92')];_0x4696c9['holdtime']=_0x130924[_0x8647('0x81')];_0x4696c9[_0x8647('0x35')]=!![];_0x4696c9['queuecallerexit']=![];_0x4696c9['queuecallerexitAt']=null;if(!_0x4696c9[_0x8647('0x93')]){if(_0x130924['reason']=='transfer'){_0x4696c9['queuecallerexitreason']=_0x8647('0x94');logger['info'](_0x8647('0x95'),_0x4696c9['queue'],_0x4696c9['type']);}else{if(_[_0x8647('0x96')](_0x130924['channel']['toLowerCase'](),_0x8647('0x97'))){if(this[_0x8647('0xe')][_0x130924[_0x8647('0x98')]]){var _0x295925=_[_0x8647('0x7f')](this[_0x8647('0xe')][_0x130924[_0x8647('0x98')]]);_0x295925[_0x8647('0x35')]=![];_0x295925['queuecallerexit']=!![];_0x295925[_0x8647('0x99')]=moment(_0x4696c9['queuecallerjoinAt'])['add'](_0x130924[_0x8647('0x81')],_0x8647('0x9a'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x295925['queuecallerexitreason']=_0x8647('0x9b');_0x295925[_0x8647('0x93')]=!![];_0x295925[_0x8647('0x9c')]=_0x8647('0x9d');_0x295925[_0x8647('0x9e')]=_0x130924['destexten'];_0x295925['transferuniqueid']=_0x130924[_0x8647('0x4f')];logger[_0x8647('0x7a')](_0x8647('0x9f'),_0x295925[_0x8647('0x51')],_0x295925[_0x8647('0x5a')]);var _0x3f0d9f=this['queueReports'][_0x130924[_0x8647('0x98')]];this[_0x8647('0xe')][_0x130924[_0x8647('0x98')]]=this[_0x8647('0xe')][_0x130924[_0x8647('0x4f')]];this[_0x8647('0xe')][_0x130924[_0x8647('0x4f')]]=_0x3f0d9f;}}else{_0x4696c9[_0x8647('0x54')]='COMPLETEDBY'+_0x130924[_0x8647('0xa0')]['toUpperCase']();logger[_0x8647('0x7a')](_0x8647('0xa1'),_0x4696c9[_0x8647('0x51')],_0x4696c9[_0x8647('0x5a')],_0x4696c9['queuecallerexitreason']);}}}this[_0x8647('0x10')][_0x130924['uniqueid']]=_0x4696c9;}}}catch(_0x1cf206){logger['error'](_0x8647('0x90'),_0x130924[_0x8647('0x4f')],util[_0x8647('0x41')](_0x1cf206,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8647('0xa')][_0x8647('0x20')]=function(_0x2b741f){try{if(this[_0x8647('0x6f')](_0x2b741f)){logger[_0x8647('0x4c')](_0x8647('0xa2'),_0x2b741f['uniqueid'],util[_0x8647('0x41')](_0x2b741f,{'showHidden':![],'depth':null}));this[_0x8647('0xa3')](_0x2b741f['uniqueid'],_[_0x8647('0x7c')](_0x2b741f[_0x8647('0xa4')])[0x0],_0x2b741f['value']);if(this[_0x8647('0xe')][_0x2b741f['uniqueid']]){var _0x3865fe=_[_0x8647('0x7f')](this[_0x8647('0xe')][_0x2b741f[_0x8647('0x4f')]]);if(_0x3865fe){if(this[_0x8647('0x6f')](_0x2b741f[_0x8647('0xa4')])&&this[_0x8647('0x6f')](_0x2b741f[_0x8647('0xa4')][_0x8647('0x63')])){switch(_0x2b741f[_0x8647('0xa5')]){case'CONTINUE':_0x3865fe[_0x8647('0x34')]=![];_0x3865fe[_0x8647('0x99')]=null;break;case _0x8647('0xa6'):_0x3865fe[_0x8647('0xa7')]=_0x8647('0xa8');_0x3865fe[_0x8647('0x34')]=!![];_0x3865fe[_0x8647('0x99')]=moment()[_0x8647('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x3865fe[_0x8647('0x88')]=moment()[_0x8647('0x56')](_0x8647('0x83'));logger['debug'](_0x8647('0xa9'),_0x2b741f['uniqueid'],util[_0x8647('0x41')](_0x3865fe,{'showHidden':![],'depth':null}));ami[_0x8647('0x4a')](_0x8647('0xaa'),_0x3865fe);break;default:_0x3865fe[_0x8647('0x34')]=!![];_0x3865fe[_0x8647('0x99')]=moment()['format'](_0x8647('0x83'));_0x3865fe[_0x8647('0x88')]=moment()[_0x8647('0x56')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3865fe[_0x8647('0x1c')]=![];_0x3865fe[_0x8647('0xab')]=null;_0x3865fe[_0x8647('0x54')]=_0x2b741f[_0x8647('0xa5')];this[_0x8647('0x10')][_0x2b741f['uniqueid']]=_0x3865fe;this['emitVoiceQueueChannelRemove'](_0x3865fe,'varset');}else if(this[_0x8647('0x6f')](_0x2b741f[_0x8647('0xa4')])&&this[_0x8647('0x6f')](_0x2b741f[_0x8647('0xa4')][_0x8647('0xac')])){if(!_0x3865fe['queuecallerabandon']){_0x3865fe[_0x8647('0x34')]=!![];_0x3865fe[_0x8647('0x99')]=moment()['format'](_0x8647('0x83'));_0x3865fe[_0x8647('0x54')]=_0x8647('0xad');_0x3865fe[_0x8647('0x88')]=moment()[_0x8647('0x56')](_0x8647('0x83'));this[_0x8647('0x10')][_0x2b741f['uniqueid']]=_0x3865fe;}}logger[_0x8647('0x7a')](_0x8647('0xae'),_0x2b741f[_0x8647('0x4f')],_0x3865fe[_0x8647('0x51')],_0x3865fe[_0x8647('0x5a')],_[_0x8647('0x7c')](_0x2b741f['variable'])[0x0],_0x2b741f['value']);_0x3865fe[_0x8647('0x13')]=this[_0x8647('0x13')][_0x2b741f[_0x8647('0x4f')]];}}}}catch(_0x15fa10){logger[_0x8647('0x43')](_0x8647('0xa2'),_0x2b741f[_0x8647('0x4f')],util['inspect'](_0x15fa10,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8647('0xa')]['addVariable']=function(_0x31618f,_0x2155b5,_0x34ca11){var _0x2a4c4c=[_0x8647('0xaf'),_0x8647('0xb0'),_0x8647('0xb1'),_0x8647('0xb2'),'rtpaudioqosloss',_0x8647('0xb3'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x8647('0xb4'),_0x8647('0xb5'),_0x8647('0xb6'),_0x8647('0xb7'),_0x8647('0xb8'),'memberdynamic','memberinterface','memberlastcall',_0x8647('0x92'),_0x8647('0xb9'),_0x8647('0xba')];if(!_[_0x8647('0x39')](_0x2155b5)&&!_[_0x8647('0xbb')](_0x2a4c4c,_0x2155b5)){if(_[_0x8647('0x5e')](this[_0x8647('0x13')][_0x31618f])){this['variables'][_0x31618f]={};}this[_0x8647('0x13')][_0x31618f][_0x2155b5]=_0x34ca11;}};VoiceQueueReport[_0x8647('0xa')]['handleHangup']=function(_0x53077d,_0x2d78f6,_0x5324ac){try{var _0x367004={};if(this[_0x8647('0xe')][_0x53077d]){for(var _0x2a42cd=0x0;_0x2a42cd=0x0?moment(_0x400a19[_0x9b1f('0x18')])[_0x9b1f('0xb')](_0x400a19[_0x9b1f('0x17')],_0x9b1f('0xd')):null,'data1':_0x9b1f('0x19'),'data2':_0x400a19[_0x9b1f('0x11')],'data3':_0x400a19['exten'],'data4':_0x400a19[_0x9b1f('0x1a')]||null,'role':_0x9b1f('0x10'),'internal':_0x400a19['accountcode']?_['toNumber'](_0x400a19[_0x9b1f('0x11')]):undefined,'uniqueid':_0x400a19['uniqueid']},'log':_0x9b1f('0x14')});}; \ No newline at end of file +var _0x6ba8=['lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','diff','queuecallerleaveAt','seconds','exten','queue','accountcode','membername','endtime','starttime','outbound','dialstring','toNumber','uniqueid','moment','lodash','util','voiceQueueReport','Request','CreateMemberReport','voice'];(function(_0x2b444f,_0x514176){var _0x4df690=function(_0x4f2358){while(--_0x4f2358){_0x2b444f['push'](_0x2b444f['shift']());}};_0x4df690(++_0x514176);}(_0x6ba8,0x117));var _0x86ba=function(_0x4ba686,_0x10557a){_0x4ba686=_0x4ba686-0x0;var _0x54bce3=_0x6ba8[_0x4ba686];return _0x54bce3;};'use strict';var moment=require(_0x86ba('0x0'));var _=require(_0x86ba('0x1'));var util=require(_0x86ba('0x2'));var client=require('../client');exports[_0x86ba('0x3')]=function(_0x42377d){var _0x1f3ddf=_0x42377d['queuecallercompleteAt']||_0x42377d['queuecallerexitAt'];return client[_0x86ba('0x4')](_0x86ba('0x5'),{'body':{'channel':_0x86ba('0x6'),'membername':_0x42377d[_0x86ba('0x7')],'interface':_[_0x86ba('0x8')](_0x42377d[_0x86ba('0x9')])?util[_0x86ba('0xa')](_0x86ba('0xb'),_0x42377d[_0x86ba('0x7')]):_0x42377d[_0x86ba('0x9')],'type':_0x86ba('0xc'),'enterAt':_0x42377d['queuecallerleaveAt'],'exitAt':_0x1f3ddf,'duration':moment(_0x1f3ddf)[_0x86ba('0xd')](_0x42377d[_0x86ba('0xe')],_0x86ba('0xf')),'data1':'inbound','data2':_0x42377d['calleridnum'],'data3':_0x42377d[_0x86ba('0x10')],'data4':null,'data5':_0x42377d[_0x86ba('0x11')],'role':'agent','internal':_0x42377d[_0x86ba('0x12')]?_['toNumber'](_0x42377d['accountcode']):undefined,'uniqueid':_0x42377d['uniqueid']},'log':'CreateMemberReport'});};exports['voiceDialReport']=function(_0x559330){return client['Request'](_0x86ba('0x5'),{'body':{'channel':_0x86ba('0x6'),'membername':_0x559330[_0x86ba('0x13')],'interface':_0x559330['interface'],'type':_0x86ba('0xc'),'enterAt':_0x559330['starttime'],'exitAt':_0x559330['endtime'],'duration':moment(_0x559330[_0x86ba('0x14')])[_0x86ba('0xd')](_0x559330[_0x86ba('0x15')],_0x86ba('0xf'))>=0x0?moment(_0x559330['endtime'])[_0x86ba('0xd')](_0x559330[_0x86ba('0x15')],_0x86ba('0xf')):null,'data1':_0x86ba('0x16'),'data2':_0x559330[_0x86ba('0x12')],'data3':_0x559330[_0x86ba('0x10')],'data4':_0x559330[_0x86ba('0x17')]||null,'role':'agent','internal':_0x559330['accountcode']?_[_0x86ba('0x18')](_0x559330[_0x86ba('0x12')]):undefined,'uniqueid':_0x559330[_0x86ba('0x19')]},'log':_0x86ba('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 69cf83f..e7db59b 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 _0xd10f=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','GetSettings'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0xd10f,0x198));var _0xfd10=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd10f[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0xfd10('0x0'));exports[_0xfd10('0x1')]=function(){return client[_0xfd10('0x2')](_0xfd10('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xfd10('0x4'),'previewRecallmeReminderInterval']},'log':_0xfd10('0x5')});}; \ No newline at end of file +var _0x84e5=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','getSettings','ShowSetting'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x84e5,0x111));var _0x584e=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x84e5[_0x2a67fe];return _0x57e726;};'use strict';var client=require('../client');exports[_0x584e('0x0')]=function(){return client['Request'](_0x584e('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x584e('0x2'),_0x584e('0x3')]},'log':_0x584e('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index b7062e5..2a76ae9 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 _0x2a6f=['name','html','../client','getTemplates','GetTemplate'];(function(_0x2a0bc2,_0x33f79b){var _0x840555=function(_0x1171d3){while(--_0x1171d3){_0x2a0bc2['push'](_0x2a0bc2['shift']());}};_0x840555(++_0x33f79b);}(_0x2a6f,0x15b));var _0xf2a6=function(_0x835403,_0x5849d6){_0x835403=_0x835403-0x0;var _0x4fe54e=_0x2a6f[_0x835403];return _0x4fe54e;};'use strict';var client=require(_0xf2a6('0x0'));exports[_0xf2a6('0x1')]=function(_0x34ea6d){return function(_0x33ae40){return client['Request'](_0xf2a6('0x2'),{'options':{'raw':!![],'attributes':['id',_0xf2a6('0x3'),_0xf2a6('0x4')]},'log':_0xf2a6('0x2')});};}; \ No newline at end of file +var _0x333e=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x333e,0x113));var _0xe333=function(_0x496895,_0x5a1ba5){_0x496895=_0x496895-0x0;var _0xe195f=_0x333e[_0x496895];return _0xe195f;};'use strict';var client=require(_0xe333('0x0'));exports[_0xe333('0x1')]=function(_0x540e87){return function(_0x50f991){return client[_0xe333('0x2')](_0xe333('0x3'),{'options':{'raw':!![],'attributes':['id',_0xe333('0x4'),_0xe333('0x5')]},'log':_0xe333('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index c4d86e3..a5814f9 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 _0xd892=['getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','value','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7'];(function(_0x444cbc,_0x38d135){var _0x270d6e=function(_0x3b2765){while(--_0x3b2765){_0x444cbc['push'](_0x444cbc['shift']());}};_0x270d6e(++_0x38d135);}(_0xd892,0x1f4));var _0x2d89=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xd892[_0x16d10f];return _0x50c823;};'use strict';var client=require('../client');exports[_0x2d89('0x0')]=function(_0x13527c){return function(_0x5582cb){return client[_0x2d89('0x1')](_0x2d89('0x2'),{'options':{'raw':![],'attributes':['id',_0x2d89('0x3'),_0x2d89('0x4'),'status'],'include':[{'model':_0x2d89('0x5'),'as':_0x2d89('0x6'),'attributes':['id',_0x2d89('0x7'),_0x2d89('0x8'),'value']},{'model':_0x2d89('0x5'),'as':'AnyConditions','attributes':['id',_0x2d89('0x7'),'operator',_0x2d89('0x9')]},{'model':_0x2d89('0xa'),'as':_0x2d89('0xb'),'attributes':['id',_0x2d89('0xc'),_0x2d89('0xd'),_0x2d89('0xe'),_0x2d89('0xf'),_0x2d89('0x10'),_0x2d89('0x11'),_0x2d89('0x12'),_0x2d89('0x13')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x818a=['data4','data5','data6','data7','getTriggers','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','AnyConditions','value','Actions','action','data2'];(function(_0x5827e9,_0x1e4e0d){var _0x1d459d=function(_0x3242db){while(--_0x3242db){_0x5827e9['push'](_0x5827e9['shift']());}};_0x1d459d(++_0x1e4e0d);}(_0x818a,0x136));var _0xa818=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x818a[_0x710815];return _0x5b3b89;};'use strict';var client=require('../client');exports[_0xa818('0x0')]=function(_0x5e34c7){return function(_0x191195){return client['Request'](_0xa818('0x1'),{'options':{'raw':![],'attributes':['id',_0xa818('0x2'),_0xa818('0x3'),_0xa818('0x4')],'include':[{'model':_0xa818('0x5'),'as':_0xa818('0x6'),'attributes':['id',_0xa818('0x7'),_0xa818('0x8'),'value']},{'model':_0xa818('0x5'),'as':_0xa818('0x9'),'attributes':['id',_0xa818('0x7'),_0xa818('0x8'),_0xa818('0xa')]},{'model':'Action','as':_0xa818('0xb'),'attributes':['id',_0xa818('0xc'),'data1',_0xa818('0xd'),'data3',_0xa818('0xe'),_0xa818('0xf'),_0xa818('0x10'),_0xa818('0x11')]}]},'log':_0xa818('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index c538786..37626f6 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 _0x1904=['defaultuser','../client','Request','GetTrunk','name','registry'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x1904,0x1b1));var _0x4190=function(_0x1d78a0,_0x17401a){_0x1d78a0=_0x1d78a0-0x0;var _0x5d5615=_0x1904[_0x1d78a0];return _0x5d5615;};'use strict';var client=require(_0x4190('0x0'));exports['getTrunks']=function(_0x59b961){return function(_0x526a6d){return client[_0x4190('0x1')](_0x4190('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x4190('0x3'),_0x4190('0x4'),_0x4190('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x81b6=['getTrunks','Request','GetTrunk','registry','defaultuser','../client'];(function(_0x1c3bfa,_0x547714){var _0x28890=function(_0x21e236){while(--_0x21e236){_0x1c3bfa['push'](_0x1c3bfa['shift']());}};_0x28890(++_0x547714);}(_0x81b6,0x137));var _0x681b=function(_0x77230,_0x1414c5){_0x77230=_0x77230-0x0;var _0xe155f4=_0x81b6[_0x77230];return _0xe155f4;};'use strict';var client=require(_0x681b('0x0'));exports[_0x681b('0x1')]=function(_0x5d81e0){return function(_0x590aa9){return client[_0x681b('0x2')](_0x681b('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x681b('0x4'),_0x681b('0x5')]},'log':_0x681b('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index e9be9b8..e39606c 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 _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x2c9a8e,_0x54d44c){var _0x15942b=function(_0x5b78b3){while(--_0x5b78b3){_0x2c9a8e['push'](_0x2c9a8e['shift']());}};_0x15942b(++_0x54d44c);}(_0x70e0,0x17b));var _0x070e=function(_0x3a9945,_0x5e6d27){_0x3a9945=_0x3a9945-0x0;var _0x3020a4=_0x70e0[_0x3a9945];return _0x3020a4;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x6d8c73,_0x4e86a5){var _0x13fe4e=function(_0x110479){while(--_0x110479){_0x6d8c73['push'](_0x6d8c73['shift']());}};_0x13fe4e(++_0x4e86a5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0xcb91[_0x21bfab];return _0x4db318;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 7c94e27..d60c80d 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 _0xbf6a=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create','Request'];(function(_0xd1b591,_0x3332b3){var _0x20c36f=function(_0x1560b4){while(--_0x1560b4){_0xd1b591['push'](_0xd1b591['shift']());}};_0x20c36f(++_0x3332b3);}(_0xbf6a,0x1d8));var _0xabf6=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0xbf6a[_0x54ccd7];return _0x4e667b;};'use strict';var client=require(_0xabf6('0x0'));exports[_0xabf6('0x1')]=function(_0x134aae){return client[_0xabf6('0x2')](_0xabf6('0x3'),{'body':_0x134aae,'log':_0xabf6('0x3')});};exports['update']=function(_0x586a89,_0x38db5e,_0x40b202){return client[_0xabf6('0x2')](_0xabf6('0x4'),{'body':_0x586a89,'options':{'where':{'uniqueid':_0x38db5e,'interface':_0x40b202,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x3cbc=['CreateVoiceAgentReport','Request','UpdateVoiceAgentReport','create'];(function(_0x24fba7,_0x202bd0){var _0x1ac22d=function(_0x4bd423){while(--_0x4bd423){_0x24fba7['push'](_0x24fba7['shift']());}};_0x1ac22d(++_0x202bd0);}(_0x3cbc,0x1af));var _0xc3cb=function(_0x25b725,_0x404192){_0x25b725=_0x25b725-0x0;var _0x5603cd=_0x3cbc[_0x25b725];return _0x5603cd;};'use strict';var client=require('../client');exports[_0xc3cb('0x0')]=function(_0x4d1878){return client['Request'](_0xc3cb('0x1'),{'body':_0x4d1878,'log':_0xc3cb('0x1')});};exports['update']=function(_0x342177,_0xb5fea0,_0x517725){return client[_0xc3cb('0x2')](_0xc3cb('0x3'),{'body':_0x342177,'options':{'where':{'uniqueid':_0xb5fea0,'interface':_0x517725,'agentcomplete':!![]}},'log':_0xc3cb('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index e8cce3c..cca4500 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 _0xead6=['outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','lodash','../client','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport'];(function(_0x49e684,_0x5dde79){var _0x2275bc=function(_0x256578){while(--_0x256578){_0x49e684['push'](_0x49e684['shift']());}};_0x2275bc(++_0x5dde79);}(_0xead6,0xb3));var _0x6ead=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xead6[_0x167cc1];return _0x10bc4b;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x6ead('0x0'));var client=require(_0x6ead('0x1'));exports['create']=function(_0x85180c){return client['Request'](_0x6ead('0x2'),{'body':_[_0x6ead('0x3')](_0x85180c,{'source':_0x85180c[_0x6ead('0x4')],'destinationcontext':_0x85180c[_0x6ead('0x5')],'callerid':_0x85180c['callerid'],'amaflags':_0x6ead('0x6')}),'log':_0x6ead('0x2')});};exports[_0x6ead('0x7')]=function(){return function(){return client[_0x6ead('0x8')](_0x6ead('0x9'),{'options':{'where':{'type':[_0x6ead('0xa')],'createdAt':{'$between':[moment()[_0x6ead('0xb')]('day')[_0x6ead('0xc')](_0x6ead('0xd')),moment()[_0x6ead('0xe')](_0x6ead('0xf'))['format'](_0x6ead('0xd'))]}},'attributes':[_0x6ead('0x10'),_0x6ead('0x11'),_0x6ead('0x12'),_0x6ead('0x13')]},'log':_0x6ead('0x14')});};}; \ No newline at end of file +var _0x3778=['duration','billableseconds','GetVoiceCallReports','util','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf'];(function(_0x345136,_0x33f8e5){var _0x2f7177=function(_0x332b55){while(--_0x332b55){_0x345136['push'](_0x345136['shift']());}};_0x2f7177(++_0x33f8e5);}(_0x3778,0xc9));var _0x8377=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3778[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var util=require(_0x8377('0x0'));var _=require('lodash');var client=require('../client');exports['create']=function(_0xe1224b){return client[_0x8377('0x1')](_0x8377('0x2'),{'body':_[_0x8377('0x3')](_0xe1224b,{'source':_0xe1224b['calleridnum'],'destinationcontext':_0xe1224b[_0x8377('0x4')],'callerid':_0xe1224b[_0x8377('0x5')],'amaflags':_0x8377('0x6')}),'log':'CreateVoiceCallReport'});};exports[_0x8377('0x7')]=function(){return function(){return client[_0x8377('0x1')](_0x8377('0x8'),{'options':{'where':{'type':[_0x8377('0x9')],'createdAt':{'$between':[moment()[_0x8377('0xa')](_0x8377('0xb'))[_0x8377('0xc')](_0x8377('0xd')),moment()[_0x8377('0xe')]('day')[_0x8377('0xc')](_0x8377('0xd'))]}},'attributes':['type','disposition',_0x8377('0xf'),_0x8377('0x10')]},'log':_0x8377('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 620916c..f75d35b 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 _0x8666=['CreateVoiceDialReport','../client','create','Request'];(function(_0x16d777,_0x5dc623){var _0x5b388c=function(_0x501219){while(--_0x501219){_0x16d777['push'](_0x16d777['shift']());}};_0x5b388c(++_0x5dc623);}(_0x8666,0x161));var _0x6866=function(_0x458abf,_0x371075){_0x458abf=_0x458abf-0x0;var _0x7396a7=_0x8666[_0x458abf];return _0x7396a7;};'use strict';var client=require(_0x6866('0x0'));exports[_0x6866('0x1')]=function(_0x3a6859){return client[_0x6866('0x2')](_0x6866('0x3'),{'body':_0x3a6859,'log':_0x6866('0x3')});}; \ No newline at end of file +var _0xc0a7=['../client','create','Request'];(function(_0x4f8b2b,_0x1dc8dd){var _0x2f230a=function(_0x232685){while(--_0x232685){_0x4f8b2b['push'](_0x4f8b2b['shift']());}};_0x2f230a(++_0x1dc8dd);}(_0xc0a7,0x1d7));var _0x7c0a=function(_0x1f5ce2,_0x2282a9){_0x1f5ce2=_0x1f5ce2-0x0;var _0x3e2fdd=_0xc0a7[_0x1f5ce2];return _0x3e2fdd;};'use strict';var client=require(_0x7c0a('0x0'));exports[_0x7c0a('0x1')]=function(_0x13661f){return client[_0x7c0a('0x2')]('CreateVoiceDialReport',{'body':_0x13661f,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 514a4d4..7e24cc9 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 _0xa571=['Request','GetVoiceExtension','recordingFormat','../client','getVoiceExtensions'];(function(_0x28da10,_0x29470c){var _0x298372=function(_0x4acba9){while(--_0x4acba9){_0x28da10['push'](_0x28da10['shift']());}};_0x298372(++_0x29470c);}(_0xa571,0x107));var _0x1a57=function(_0x559443,_0x4eb8b6){_0x559443=_0x559443-0x0;var _0x246c41=_0xa571[_0x559443];return _0x246c41;};'use strict';var client=require(_0x1a57('0x0'));exports[_0x1a57('0x1')]=function(){return function(){return client[_0x1a57('0x2')](_0x1a57('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0x1a57('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x1a57('0x1')});};}; \ No newline at end of file +var _0x688a=['../client','getVoiceExtensions','Request','exten'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x688a,0x124));var _0xa688=function(_0x320c5d,_0x4a87aa){_0x320c5d=_0x320c5d-0x0;var _0x41f10e=_0x688a[_0x320c5d];return _0x41f10e;};'use strict';var client=require(_0xa688('0x0'));exports[_0xa688('0x1')]=function(){return function(){return client[_0xa688('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xa688('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xa688('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index e70ec9e..7113b47 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 _0x56b8=['dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','Pause','mandatoryDispositionPause','TrunkBackup','callerid','active','Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout'];(function(_0x5e91d3,_0x5ee68b){var _0x20f6d4=function(_0x62f108){while(--_0x62f108){_0x5e91d3['push'](_0x5e91d3['shift']());}};_0x20f6d4(++_0x5ee68b);}(_0x56b8,0x1dd));var _0x856b=function(_0x1b3715,_0x426234){_0x1b3715=_0x1b3715-0x0;var _0x18bbd5=_0x56b8[_0x1b3715];return _0x18bbd5;};'use strict';var client=require(_0x856b('0x0'));exports[_0x856b('0x1')]=function(){return function(){return client['Request'](_0x856b('0x2'),{'options':{'raw':![],'attributes':['id',_0x856b('0x3'),_0x856b('0x4'),_0x856b('0x5'),'autopause',_0x856b('0x6'),_0x856b('0x7'),'dialActive',_0x856b('0x8'),'dialLimitChannel',_0x856b('0x9'),_0x856b('0xa'),_0x856b('0xb'),_0x856b('0xc'),_0x856b('0xd'),'dialOriginateCallerIdName',_0x856b('0xe'),_0x856b('0xf'),'dialQueueOptions',_0x856b('0x10'),'dialQueueProject',_0x856b('0x11'),'dialCongestionRetryFrequency',_0x856b('0x12'),_0x856b('0x13'),_0x856b('0x14'),_0x856b('0x15'),_0x856b('0x16'),_0x856b('0x17'),_0x856b('0x18'),_0x856b('0x19'),_0x856b('0x1a'),'dialAMDActive',_0x856b('0x1b'),_0x856b('0x1c'),_0x856b('0x1d'),_0x856b('0x1e'),'dialAMDMinWordLength',_0x856b('0x1f'),_0x856b('0x20'),_0x856b('0x21'),'dialAMDMaximumWordLength',_0x856b('0x22'),_0x856b('0x23'),'dialRecallInQueue',_0x856b('0x24'),'dialAgiAfterHangupAgent',_0x856b('0x25'),_0x856b('0x26'),'monitor_format',_0x856b('0x27'),_0x856b('0x28'),_0x856b('0x29'),_0x856b('0x2a'),'dialNoSuchNumberRetryFrequency',_0x856b('0x2b'),_0x856b('0x2c'),_0x856b('0x2d'),'dialAbandonedRetryFrequency',_0x856b('0x2e'),_0x856b('0x2f'),_0x856b('0x30'),_0x856b('0x31'),_0x856b('0x32'),_0x856b('0x33'),_0x856b('0x34'),_0x856b('0x35'),_0x856b('0x36')],'include':[{'model':_0x856b('0x37'),'as':_0x856b('0x37'),'attributes':['id',_0x856b('0x3'),'callerid','active']},{'model':_0x856b('0x38'),'as':_0x856b('0x39'),'attributes':['id','name']},{'model':_0x856b('0x37'),'as':_0x856b('0x3a'),'attributes':['id',_0x856b('0x3'),_0x856b('0x3b'),_0x856b('0x3c')]},{'model':_0x856b('0x3d'),'as':_0x856b('0x3d'),'attributes':['id',_0x856b('0x3')],'include':[{'model':_0x856b('0x3d'),'as':_0x856b('0x3e'),'attributes':['id','name',_0x856b('0x3f')]}]}]},'log':_0x856b('0x1')});};}; \ No newline at end of file +var _0x460a=['dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'];(function(_0x245b57,_0x420f33){var _0x1d07d9=function(_0x3cbd7b){while(--_0x3cbd7b){_0x245b57['push'](_0x245b57['shift']());}};_0x1d07d9(++_0x420f33);}(_0x460a,0x10f));var _0xa460=function(_0x1f44e4,_0x22d9fd){_0x1f44e4=_0x1f44e4-0x0;var _0x591989=_0x460a[_0x1f44e4];return _0x591989;};'use strict';var client=require('../client');exports[_0xa460('0x0')]=function(){return function(){return client[_0xa460('0x1')](_0xa460('0x2'),{'options':{'raw':![],'attributes':['id',_0xa460('0x3'),_0xa460('0x4'),'acwTimeout',_0xa460('0x5'),_0xa460('0x6'),_0xa460('0x7'),_0xa460('0x8'),_0xa460('0x9'),_0xa460('0xa'),'dialLimitQueue','dialPowerLevel','dialPredictiveOptimization',_0xa460('0xb'),'dialPredictiveInterval',_0xa460('0xc'),_0xa460('0xd'),_0xa460('0xe'),_0xa460('0xf'),_0xa460('0x10'),'dialQueueProject',_0xa460('0x11'),_0xa460('0x12'),_0xa460('0x13'),'dialBusyRetryFrequency',_0xa460('0x14'),_0xa460('0x15'),_0xa460('0x16'),_0xa460('0x17'),_0xa460('0x18'),_0xa460('0x19'),'dialCheckDuplicateType',_0xa460('0x1a'),_0xa460('0x1b'),'dialAMDGreeting',_0xa460('0x1c'),_0xa460('0x1d'),'dialAMDMinWordLength',_0xa460('0x1e'),_0xa460('0x1f'),_0xa460('0x20'),_0xa460('0x21'),_0xa460('0x22'),_0xa460('0x23'),'dialRecallInQueue',_0xa460('0x24'),_0xa460('0x25'),_0xa460('0x26'),'dialQueueProject2',_0xa460('0x6'),_0xa460('0x27'),_0xa460('0x28'),_0xa460('0x29'),_0xa460('0x2a'),_0xa460('0x2b'),_0xa460('0x2c'),_0xa460('0x2d'),'dialAbandonedMaxRetry',_0xa460('0x2e'),_0xa460('0x2f'),_0xa460('0x30'),_0xa460('0x31'),_0xa460('0x32'),_0xa460('0x33'),_0xa460('0x34'),_0xa460('0x35'),_0xa460('0x36'),_0xa460('0x37')],'include':[{'model':_0xa460('0x38'),'as':_0xa460('0x38'),'attributes':['id',_0xa460('0x3'),_0xa460('0x39'),_0xa460('0x3a')]},{'model':_0xa460('0x3b'),'as':_0xa460('0x3c'),'attributes':['id','name']},{'model':_0xa460('0x38'),'as':_0xa460('0x3d'),'attributes':['id','name','callerid','active']},{'model':_0xa460('0x3e'),'as':_0xa460('0x3e'),'attributes':['id',_0xa460('0x3')],'include':[{'model':_0xa460('0x3e'),'as':_0xa460('0x3f'),'attributes':['id',_0xa460('0x3'),_0xa460('0x40')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index d8dda73..ad059b1 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(_0x1614bc,_0x363231){var _0x582dda=function(_0x25b1d7){while(--_0x25b1d7){_0x1614bc['push'](_0x1614bc['shift']());}};_0x582dda(++_0x363231);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x3a8358,_0x2ca21d){var _0x1e9a34=function(_0x21521d){while(--_0x21521d){_0x3a8358['push'](_0x3a8358['shift']());}};_0x1e9a34(++_0x2ca21d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 37bfe24..e293424 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 _0x8fdc=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x44f959,_0x4db1f8){var _0x5f0ac5=function(_0x2beccc){while(--_0x2beccc){_0x44f959['push'](_0x44f959['shift']());}};_0x5f0ac5(++_0x4db1f8);}(_0x8fdc,0x172));var _0xc8fd=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x8fdc[_0x51c819];return _0x15c5d2;};'use strict';var client=require(_0xc8fd('0x0'));exports[_0xc8fd('0x1')]=function(_0x4fe7f9){return function(){return client[_0xc8fd('0x2')](_0xc8fd('0x3'),{'options':{'where':{'VoiceQueueId':_0x4fe7f9,'paused':!![]},'raw':!![]},'log':_0xc8fd('0x1')});};}; \ No newline at end of file +var _0x2b06=['getVoiceQueueRtPauses','Request','../client'];(function(_0xeb265d,_0x21f45c){var _0x185ac4=function(_0x236fdb){while(--_0x236fdb){_0xeb265d['push'](_0xeb265d['shift']());}};_0x185ac4(++_0x21f45c);}(_0x2b06,0x143));var _0x62b0=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0x2b06[_0x6a0266];return _0x309e00;};'use strict';var client=require(_0x62b0('0x0'));exports[_0x62b0('0x1')]=function(_0x46c760){return function(){return client[_0x62b0('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x46c760,'paused':!![]},'raw':!![]},'log':_0x62b0('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 863b57b..ff0f107 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(_0x189f6d,_0xa8b1f1){var _0x5c7994=function(_0x2ca26f){while(--_0x2ca26f){_0x189f6d['push'](_0x189f6d['shift']());}};_0x5c7994(++_0xa8b1f1);}(_0x7a54,0x106));var _0x47a5=function(_0x1b34bc,_0x4715e1){_0x1b34bc=_0x1b34bc-0x0;var _0x4f74ef=_0x7a54[_0x1b34bc];return _0x4f74ef;};'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(_0x197a2f,_0x1797fe){var _0x4e2f79=function(_0x337adb){while(--_0x337adb){_0x197a2f['push'](_0x197a2f['shift']());}};_0x4e2f79(++_0x1797fe);}(_0x7a54,0x106));var _0x47a5=function(_0x2fac86,_0x3d7e6b){_0x2fac86=_0x2fac86-0x0;var _0x1b56c7=_0x7a54[_0x2fac86];return _0x1b56c7;};'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 8451d3b..6e99471 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 _0xb47d=['origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','../client','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xb47d,0x117));var _0xdb47=function(_0x48289c,_0xc3a45a){_0x48289c=_0x48289c-0x0;var _0x4e215d=_0xb47d[_0x48289c];return _0x4e215d;};'use strict';var client=require(_0xdb47('0x0'));exports[_0xdb47('0x1')]={};exports['blindTransfer']=function(_0x270fe3){return client[_0xdb47('0x2')](_0xdb47('0x3'),{'body':{'result':_0x270fe3[_0xdb47('0x4')],'transfererchannel':_0x270fe3[_0xdb47('0x5')],'transferercalleridnum':_0x270fe3[_0xdb47('0x6')],'transferercalleridname':_0x270fe3[_0xdb47('0x7')],'transfererconnectedlinenum':_0x270fe3['transfererconnectedlinenum'],'transfererconnectedlinename':_0x270fe3[_0xdb47('0x8')],'transfereraccountcode':_0x270fe3[_0xdb47('0x9')],'transferercontext':_0x270fe3[_0xdb47('0xa')],'transfererexten':_0x270fe3['transfererexten'],'transfererlinkedid':_0x270fe3[_0xdb47('0xb')],'transfereechannel':_0x270fe3[_0xdb47('0xc')],'transfereecalleridnum':_0x270fe3[_0xdb47('0xd')],'transfereecalleridname':_0x270fe3[_0xdb47('0xe')],'transfereeconnectedlinenum':_0x270fe3['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x270fe3['transfereeconnectedlinename'],'transfereeaccountcode':_0x270fe3[_0xdb47('0xf')],'transfereecontext':_0x270fe3[_0xdb47('0x10')],'transfereeexten':_0x270fe3['transfereeexten'],'transfereelinkedid':_0x270fe3['transfereelinkedid'],'isexternal':_0x270fe3['isexternal'],'context':_0x270fe3[_0xdb47('0x11')],'extension':_0x270fe3[_0xdb47('0x12')],'type':_0xdb47('0x13')},'log':'CreateVoiceTransferReport'});};exports[_0xdb47('0x14')]=function(_0x4a03ad){return client[_0xdb47('0x2')](_0xdb47('0x3'),{'body':{'result':_0x4a03ad['result'],'transfererchannel':_0x4a03ad[_0xdb47('0x15')],'transferercalleridnum':_0x4a03ad['origtransferercalleridnum'],'transferercalleridname':_0x4a03ad[_0xdb47('0x16')],'transfererconnectedlinenum':_0x4a03ad[_0xdb47('0x17')],'transfererconnectedlinename':_0x4a03ad['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4a03ad[_0xdb47('0x18')],'transferercontext':_0x4a03ad['secondtransferercontext'],'transfererexten':_0x4a03ad['secondtransfererexten'],'transfererlinkedid':_0x4a03ad[_0xdb47('0x19')],'transfereechannel':_0x4a03ad[_0xdb47('0x1a')],'transfereecalleridnum':_0x4a03ad[_0xdb47('0x1b')],'transfereecalleridname':_0x4a03ad[_0xdb47('0x1c')],'transfereeconnectedlinenum':_0x4a03ad[_0xdb47('0x1d')],'transfereeconnectedlinename':_0x4a03ad[_0xdb47('0x1e')],'transfereeaccountcode':_0x4a03ad[_0xdb47('0x1f')],'transfereecontext':_0x4a03ad[_0xdb47('0x20')],'transfereeexten':_0x4a03ad[_0xdb47('0x21')],'transfereelinkedid':_0x4a03ad[_0xdb47('0x22')],'isexternal':_0x4a03ad[_0xdb47('0x23')],'context':_0x4a03ad[_0xdb47('0x24')],'extension':_0x4a03ad[_0xdb47('0x25')],'type':'attended'},'log':_0xdb47('0x3')});}; \ No newline at end of file +var _0x6a73=['transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','CreateVoiceTransferReport','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','origtransferercontext','../client','transfers','blindTransfer','Request','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel'];(function(_0x19929f,_0x1f9fea){var _0x54032b=function(_0x1eb030){while(--_0x1eb030){_0x19929f['push'](_0x19929f['shift']());}};_0x54032b(++_0x1f9fea);}(_0x6a73,0x170));var _0x36a7=function(_0x266ddc,_0x45aa52){_0x266ddc=_0x266ddc-0x0;var _0x39c1d7=_0x6a73[_0x266ddc];return _0x39c1d7;};'use strict';var client=require(_0x36a7('0x0'));exports[_0x36a7('0x1')]={};exports[_0x36a7('0x2')]=function(_0x265286){return client[_0x36a7('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x265286['result'],'transfererchannel':_0x265286['transfererchannel'],'transferercalleridnum':_0x265286[_0x36a7('0x4')],'transferercalleridname':_0x265286[_0x36a7('0x5')],'transfererconnectedlinenum':_0x265286[_0x36a7('0x6')],'transfererconnectedlinename':_0x265286[_0x36a7('0x7')],'transfereraccountcode':_0x265286['transfereraccountcode'],'transferercontext':_0x265286[_0x36a7('0x8')],'transfererexten':_0x265286[_0x36a7('0x9')],'transfererlinkedid':_0x265286[_0x36a7('0xa')],'transfereechannel':_0x265286[_0x36a7('0xb')],'transfereecalleridnum':_0x265286[_0x36a7('0xc')],'transfereecalleridname':_0x265286[_0x36a7('0xd')],'transfereeconnectedlinenum':_0x265286[_0x36a7('0xe')],'transfereeconnectedlinename':_0x265286[_0x36a7('0xf')],'transfereeaccountcode':_0x265286[_0x36a7('0x10')],'transfereecontext':_0x265286[_0x36a7('0x11')],'transfereeexten':_0x265286[_0x36a7('0x12')],'transfereelinkedid':_0x265286[_0x36a7('0x13')],'isexternal':_0x265286['isexternal'],'context':_0x265286['context'],'extension':_0x265286['extension'],'type':'blind'},'log':_0x36a7('0x14')});};exports[_0x36a7('0x15')]=function(_0x380ec9){return client[_0x36a7('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x380ec9[_0x36a7('0x16')],'transfererchannel':_0x380ec9[_0x36a7('0x17')],'transferercalleridnum':_0x380ec9[_0x36a7('0x18')],'transferercalleridname':_0x380ec9[_0x36a7('0x19')],'transfererconnectedlinenum':_0x380ec9[_0x36a7('0x1a')],'transfererconnectedlinename':_0x380ec9[_0x36a7('0x1b')],'transfereraccountcode':_0x380ec9[_0x36a7('0x1c')],'transferercontext':_0x380ec9[_0x36a7('0x1d')],'transfererexten':_0x380ec9[_0x36a7('0x1e')],'transfererlinkedid':_0x380ec9[_0x36a7('0x1f')],'transfereechannel':_0x380ec9[_0x36a7('0x20')],'transfereecalleridnum':_0x380ec9['transfertargetcalleridnum'],'transfereecalleridname':_0x380ec9['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x380ec9[_0x36a7('0x21')],'transfereeconnectedlinename':_0x380ec9[_0x36a7('0x22')],'transfereeaccountcode':_0x380ec9[_0x36a7('0x23')],'transfereecontext':_0x380ec9['transfertargetcontext'],'transfereeexten':_0x380ec9['transfertargetexten'],'transfereelinkedid':_0x380ec9[_0x36a7('0x24')],'isexternal':_0x380ec9['isexternal'],'context':_0x380ec9[_0x36a7('0x25')],'extension':_0x380ec9['origtransfererexten'],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 0b3bae4..53b564b 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 _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x2e807f,_0x4cd305){var _0x4817e6=function(_0x2145a3){while(--_0x2145a3){_0x2e807f['push'](_0x2e807f['shift']());}};_0x4817e6(++_0x4cd305);}(_0x7a54,0x106));var _0x47a5=function(_0x8db9c7,_0x3d2613){_0x8db9c7=_0x8db9c7-0x0;var _0x1f3bb2=_0x7a54[_0x8db9c7];return _0x1f3bb2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+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(_0x46cde5,_0x440a48){var _0x15e90a=function(_0x16a7a8){while(--_0x16a7a8){_0x46cde5['push'](_0x46cde5['shift']());}};_0x15e90a(++_0x440a48);}(_0xb10b,0x12a));var _0xbb10=function(_0x1aa3ce,_0x453b5a){_0x1aa3ce=_0x1aa3ce-0x0;var _0x3fb000=_0xb10b[_0x1aa3ce];return _0x3fb000;};'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 0bf6fbc..b729c0c 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 _0xac0d=['merge','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','createdAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','','user:%s','name','format','trigger:%s','action','toLowerCase'];(function(_0x342981,_0x30d3c1){var _0x2a0445=function(_0x43d7ee){while(--_0x43d7ee){_0x342981['push'](_0x342981['shift']());}};_0x2a0445(++_0x30d3c1);}(_0xac0d,0xb2));var _0xdac0=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xac0d[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xdac0('0x0'));var BPromise=require(_0xdac0('0x1'));var Redis=require(_0xdac0('0x2'));var util=require('util');var config=require(_0xdac0('0x3'));var logger=require(_0xdac0('0x4'))(_0xdac0('0x5'));var cmContactRpc=require(_0xdac0('0x6'));config[_0xdac0('0x7')]=_[_0xdac0('0x8')](config[_0xdac0('0x7')],{'host':_0xdac0('0x9'),'port':0x18eb});var io=require(_0xdac0('0xa'))(new Redis(config[_0xdac0('0x7')]));function emit(_0xe6cb03,_0x1be30f,_0x154e08,_0x51098d,_0xfc6fa7){logger[_0xdac0('0xb')](_0xdac0('0xc'),_0xe6cb03,_0x1be30f['id'],_0x154e08,_0x51098d,JSON['stringify'](_0xfc6fa7));io['to'](_0x154e08)[_0xdac0('0xd')](_0x51098d,_0xfc6fa7);}exports[_0xdac0('0xe')]=function(_0x4fcc01,_0x21be7f,_0x1d12ee,_0x383db9){var _0x44ba61,_0x5e47a8;var _0x22c80b={};var _0x48c47e;var _0x461948=Number(_0x1d12ee[_0xdac0('0xf')]);var _0x4f2dc7=_0x1d12ee[_0xdac0('0x10')]?Boolean(Number(_0x1d12ee[_0xdac0('0x10')])):![];var _0xbb1cd3;var _0x41c39d=![];if(!_[_0xdac0('0x11')](_0x1d12ee['data5'])){if(_0x1d12ee[_0xdac0('0x12')]=='1')_0x41c39d=!![];}if(!_0x41c39d){if(_0x383db9['xmd-contactid']){_0x22c80b['id']=_0x383db9[_0xdac0('0x13')];}}if(!_0x22c80b['id']){_0x22c80b[_0xdac0('0x14')]=_0x461948;_0xbb1cd3=_0x1d12ee[_0xdac0('0x15')]&&_0x1d12ee[_0xdac0('0x15')]!=='0'?_0x1d12ee[_0xdac0('0x15')][_0xdac0('0x16')](','):[_0xdac0('0x17')];_0x22c80b[_0xdac0('0x18')]=_[_0xdac0('0x19')](_0xbb1cd3,function(_0x42f19a){var _0x5a2b5d={};_0x5a2b5d[_0x42f19a]=_0x383db9[_0xdac0('0x1a')]?_0x383db9[_0xdac0('0x1b')]:_0x383db9[_0xdac0('0x1c')];return _0x5a2b5d;});_0x48c47e=_0x383db9['routeId']?_0x383db9['destcalleridnum']:_0x383db9[_0xdac0('0x1c')];}var _0x4d7901=['id','firstName',_0xdac0('0x1d'),_0xdac0('0x17'),_0xdac0('0x1e'),'fax',_0xdac0('0x14'),_0xdac0('0x1f'),'scheduledAt',_0xdac0('0x20')];var _0x496880=_[_0xdac0('0x21')](_0x4d7901,_0xbb1cd3);BPromise[_0xdac0('0x22')]()[_0xdac0('0x23')](cmContactRpc[_0xdac0('0x24')]({'attributes':_0x496880,'where':_0x22c80b,'phone':_0x48c47e}))[_0xdac0('0x23')](function(_0x51482c){_0x5e47a8=_0x51482c;if(!_[_0xdac0('0x25')](_0x5e47a8)){if(_0x5e47a8[_0xdac0('0x26')]===0x1){_0x44ba61=_0x5e47a8[0x0];logger[_0xdac0('0xb')](_0xdac0('0x27'),_0x383db9['uniqueid'],_0x21be7f['id'],_0x44ba61['id']);}else{logger['info'](_0xdac0('0x28'),_0x383db9['uniqueid'],_0x21be7f['id'],_[_0xdac0('0x19')](_0x5e47a8,'id')['join'](','));}return;}else{logger[_0xdac0('0xb')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x383db9[_0xdac0('0x29')],_0x21be7f['id']);var _0x56990a={'ListId':_0x461948};var _0x3052f1=_0x1d12ee[_0xdac0('0x2a')]&&_0x1d12ee[_0xdac0('0x2a')]!=='0'?_0x1d12ee[_0xdac0('0x2a')]:'phone';if(_0x4f2dc7){logger[_0xdac0('0xb')](_0xdac0('0x2b'),_0x383db9[_0xdac0('0x29')],_0x21be7f['id']);_0x56990a[_0x3052f1]=_['isNil'](_0x383db9[_0xdac0('0x1a')])?_0x383db9[_0xdac0('0x1c')]:_0x383db9[_0xdac0('0x1b')];if(_[_0xdac0('0x11')](_0x383db9[_0xdac0('0x1a')])){_0x56990a[_0xdac0('0x2c')]=_0x383db9[_0xdac0('0x2d')]&&_0x383db9['calleridname']!==''?_0x383db9['calleridname']:_0xdac0('0x2e');}else{_0x56990a[_0xdac0('0x2c')]=_0x383db9[_0xdac0('0x2f')]&&_0x383db9[_0xdac0('0x2f')]!==''?_0x383db9['destcalleridname']:_0xdac0('0x2e');}return BPromise['resolve']()['then'](cmContactRpc[_0xdac0('0x30')](_0x56990a))['then'](function(_0x4b48e4){_0x44ba61=_0x4b48e4;_0x5e47a8[_0xdac0('0x31')](_0x4b48e4);if(_0x44ba61){logger[_0xdac0('0xb')](_0xdac0('0x32'),_0x383db9[_0xdac0('0x29')],_0x21be7f['id'],_0x44ba61['id']);}return;});}else{logger[_0xdac0('0xb')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x383db9[_0xdac0('0x29')],_0x21be7f['id']);_0x56990a[_0x3052f1]=_[_0xdac0('0x11')](_0x383db9[_0xdac0('0x1a')])?_0x383db9['calleridnum']:_0x383db9[_0xdac0('0x1b')];if(_['isNil'](_0x383db9[_0xdac0('0x1a')])){_0x56990a[_0xdac0('0x2c')]=_0x383db9['calleridname']&&_0x383db9['calleridname']!==''?_0x383db9[_0xdac0('0x2d')]:_0xdac0('0x2e');}else{_0x56990a[_0xdac0('0x2c')]=_0x383db9[_0xdac0('0x2f')]&&_0x383db9[_0xdac0('0x2f')]!==_0xdac0('0x33')?_0x383db9[_0xdac0('0x2f')]:_0xdac0('0x2e');}_0x44ba61=_0x56990a;_0x5e47a8[_0xdac0('0x31')](_0x56990a);return;}}})[_0xdac0('0x23')](function(){if(_0x4fcc01){emit(_0x383db9[_0xdac0('0x29')],_0x21be7f,util['format'](_0xdac0('0x34'),_0x4fcc01[_0xdac0('0x35')]),util[_0xdac0('0x36')](_0xdac0('0x37'),_0x1d12ee[_0xdac0('0x38')][_0xdac0('0x39')]()),{'evt':_[_0xdac0('0x3a')](_0x383db9,{'autoCreate':_0x4f2dc7}),'contact':_0x44ba61===undefined?{}:_0x44ba61,'contacts':_0x5e47a8[_0xdac0('0x26')]===0x0?undefined:_0x5e47a8});}});}; \ No newline at end of file +var _0x1de5=['destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','socket.io-emitter','info','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1de5,0x13d));var _0x51de=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x1de5[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0x51de('0x0'));var BPromise=require(_0x51de('0x1'));var Redis=require(_0x51de('0x2'));var util=require(_0x51de('0x3'));var config=require(_0x51de('0x4'));var logger=require(_0x51de('0x5'))('trigger');var cmContactRpc=require(_0x51de('0x6'));config['redis']=_['defaults'](config[_0x51de('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x51de('0x8'))(new Redis(config[_0x51de('0x7')]));function emit(_0xfc787a,_0x2d1559,_0x242352,_0x3e57ef,_0xd44509){logger[_0x51de('0x9')]('[CM][%s][%s]',_0xfc787a,_0x2d1559['id'],_0x242352,_0x3e57ef,JSON[_0x51de('0xa')](_0xd44509));io['to'](_0x242352)[_0x51de('0xb')](_0x3e57ef,_0xd44509);}exports[_0x51de('0xc')]=function(_0x411a75,_0x3cf7b1,_0x3f216f,_0x5b6e8d){var _0xdd81f8,_0x1e84f9;var _0x52441c={};var _0x1cc835;var _0x1a502c=Number(_0x3f216f[_0x51de('0xd')]);var _0x416594=_0x3f216f[_0x51de('0xe')]?Boolean(Number(_0x3f216f['data2'])):![];var _0x7a9a1d;var _0x5112b6=![];if(!_[_0x51de('0xf')](_0x3f216f[_0x51de('0x10')])){if(_0x3f216f[_0x51de('0x10')]=='1')_0x5112b6=!![];}if(!_0x5112b6){if(_0x5b6e8d['xmd-contactid']){_0x52441c['id']=_0x5b6e8d[_0x51de('0x11')];}}if(!_0x52441c['id']){_0x52441c[_0x51de('0x12')]=_0x1a502c;_0x7a9a1d=_0x3f216f[_0x51de('0x13')]&&_0x3f216f[_0x51de('0x13')]!=='0'?_0x3f216f[_0x51de('0x13')][_0x51de('0x14')](','):[_0x51de('0x15')];_0x52441c[_0x51de('0x16')]=_[_0x51de('0x17')](_0x7a9a1d,function(_0x203f25){var _0x108139={};_0x108139[_0x203f25]=_0x5b6e8d[_0x51de('0x18')]?_0x5b6e8d[_0x51de('0x19')]:_0x5b6e8d['calleridnum'];return _0x108139;});_0x1cc835=_0x5b6e8d[_0x51de('0x18')]?_0x5b6e8d[_0x51de('0x19')]:_0x5b6e8d[_0x51de('0x1a')];}var _0x4cff35=['id',_0x51de('0x1b'),_0x51de('0x1c'),_0x51de('0x15'),_0x51de('0x1d'),'fax',_0x51de('0x12'),_0x51de('0x1e'),_0x51de('0x1f'),_0x51de('0x20')];var _0x1651d7=_[_0x51de('0x21')](_0x4cff35,_0x7a9a1d);BPromise[_0x51de('0x22')]()[_0x51de('0x23')](cmContactRpc[_0x51de('0x24')]({'attributes':_0x1651d7,'where':_0x52441c,'phone':_0x1cc835}))[_0x51de('0x23')](function(_0x5b0190){_0x1e84f9=_0x5b0190;if(!_[_0x51de('0x25')](_0x1e84f9)){if(_0x1e84f9[_0x51de('0x26')]===0x1){_0xdd81f8=_0x1e84f9[0x0];logger[_0x51de('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x5b6e8d[_0x51de('0x27')],_0x3cf7b1['id'],_0xdd81f8['id']);}else{logger[_0x51de('0x9')](_0x51de('0x28'),_0x5b6e8d[_0x51de('0x27')],_0x3cf7b1['id'],_[_0x51de('0x17')](_0x1e84f9,'id')['join'](','));}return;}else{logger[_0x51de('0x9')](_0x51de('0x29'),_0x5b6e8d[_0x51de('0x27')],_0x3cf7b1['id']);var _0x45dadc={'ListId':_0x1a502c};var _0x3ca12d=_0x3f216f['data4']&&_0x3f216f[_0x51de('0x2a')]!=='0'?_0x3f216f[_0x51de('0x2a')]:_0x51de('0x15');if(_0x416594){logger[_0x51de('0x9')](_0x51de('0x2b'),_0x5b6e8d[_0x51de('0x27')],_0x3cf7b1['id']);_0x45dadc[_0x3ca12d]=_['isNil'](_0x5b6e8d['routeId'])?_0x5b6e8d[_0x51de('0x1a')]:_0x5b6e8d[_0x51de('0x19')];if(_[_0x51de('0xf')](_0x5b6e8d[_0x51de('0x18')])){_0x45dadc['firstName']=_0x5b6e8d[_0x51de('0x2c')]&&_0x5b6e8d[_0x51de('0x2c')]!==_0x51de('0x2d')?_0x5b6e8d[_0x51de('0x2c')]:_0x51de('0x2e');}else{_0x45dadc[_0x51de('0x1b')]=_0x5b6e8d[_0x51de('0x2f')]&&_0x5b6e8d['destcalleridname']!==_0x51de('0x2d')?_0x5b6e8d[_0x51de('0x2f')]:_0x51de('0x2e');}return BPromise[_0x51de('0x22')]()[_0x51de('0x23')](cmContactRpc['createContact'](_0x45dadc))[_0x51de('0x23')](function(_0x8b4b9a){_0xdd81f8=_0x8b4b9a;_0x1e84f9[_0x51de('0x30')](_0x8b4b9a);if(_0xdd81f8){logger[_0x51de('0x9')](_0x51de('0x31'),_0x5b6e8d[_0x51de('0x27')],_0x3cf7b1['id'],_0xdd81f8['id']);}return;});}else{logger[_0x51de('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x5b6e8d['uniqueid'],_0x3cf7b1['id']);_0x45dadc[_0x3ca12d]=_['isNil'](_0x5b6e8d['routeId'])?_0x5b6e8d[_0x51de('0x1a')]:_0x5b6e8d['destcalleridnum'];if(_[_0x51de('0xf')](_0x5b6e8d[_0x51de('0x18')])){_0x45dadc[_0x51de('0x1b')]=_0x5b6e8d['calleridname']&&_0x5b6e8d[_0x51de('0x2c')]!==''?_0x5b6e8d[_0x51de('0x2c')]:'Unknown';}else{_0x45dadc[_0x51de('0x1b')]=_0x5b6e8d['destcalleridname']&&_0x5b6e8d[_0x51de('0x2f')]!==_0x51de('0x2d')?_0x5b6e8d['destcalleridname']:_0x51de('0x2e');}_0xdd81f8=_0x45dadc;_0x1e84f9[_0x51de('0x30')](_0x45dadc);return;}}})[_0x51de('0x23')](function(){if(_0x411a75){emit(_0x5b6e8d[_0x51de('0x27')],_0x3cf7b1,util[_0x51de('0x32')](_0x51de('0x33'),_0x411a75[_0x51de('0x34')]),util[_0x51de('0x32')](_0x51de('0x35'),_0x3f216f[_0x51de('0x36')][_0x51de('0x37')]()),{'evt':_[_0x51de('0x38')](_0x5b6e8d,{'autoCreate':_0x416594}),'contact':_0xdd81f8===undefined?{}:_0xdd81f8,'contacts':_0x1e84f9['length']===0x0?undefined:_0x1e84f9});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 6bac010..6616c1b 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 _0x2a2d=['length','interface','contactmanager','motionbar','browser','data1','popup','TemplateId','data2','render','html','template\x20not\x20found','uri','buildUri','data3','isNil','data4','location','windowWidth','windowHeight','data6','winApplication','winArguments','format','user:%s','merge','trigger:%s','action','toLowerCase','name','exec','integration','queue','script','parse','search','channel','AllConditions','every','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','evt','account','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','message','event','agent','membername','lastevent','routeId','mailSubstatus','null','substatus','offlineMessage','created','equals','exports','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','sugarcrmAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:newinteraction','custom:substatus','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','clone','undefined','motionChannel','voice','debug','inspect','checkTriggers','status','checkTrigger','Actions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a2d,0x1c7));var _0xd2a2=function(_0x10548e,_0x80eaff){_0x10548e=_0x10548e-0x0;var _0x540aa4=_0x2a2d[_0x10548e];return _0x540aa4;};'use strict';var util=require('util');var _=require(_0xd2a2('0x0'));var url=require(_0xd2a2('0x1'));var Mustache=require(_0xd2a2('0x2'));var Redis=require(_0xd2a2('0x3'));var urlforward=require(_0xd2a2('0x4'));var integration=require(_0xd2a2('0x5'));var cmContact=require(_0xd2a2('0x6'));var script=require(_0xd2a2('0x7'));var config=require(_0xd2a2('0x8'));var logger=require(_0xd2a2('0x9'))(_0xd2a2('0xa'));var ami=require(_0xd2a2('0xb'));config[_0xd2a2('0xc')]=_[_0xd2a2('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd2a2('0xe'))(new Redis(config[_0xd2a2('0xc')]));var operators={'equals':function(_0x3cd3cf,_0x1d7bef){return _0x3cd3cf==_0x1d7bef;},'not_equals':function(_0x4d4eba,_0x36e934){return _0x4d4eba!=_0x36e934;}};var barAndWebActions=['popup',_0xd2a2('0x1'),_0xd2a2('0xf')];function Trigger(_0x2d5d56){this[_0xd2a2('0x10')]=_0x2d5d56[_0xd2a2('0x10')];this[_0xd2a2('0x11')]=_0x2d5d56[_0xd2a2('0x11')];this[_0xd2a2('0x12')]=_0x2d5d56['voiceQueues'];this['templates']=_0x2d5d56[_0xd2a2('0x13')];this['voiceExtensions']=_0x2d5d56[_0xd2a2('0x14')];this[_0xd2a2('0x15')]=_0x2d5d56[_0xd2a2('0x15')];this[_0xd2a2('0x16')]=_0x2d5d56['freshdeskAccounts'];this[_0xd2a2('0x17')]=_0x2d5d56['salesforceAccounts'];this['sugarcrmAccounts']=_0x2d5d56['sugarcrmAccounts'];this[_0xd2a2('0x18')]=_0x2d5d56[_0xd2a2('0x18')];this[_0xd2a2('0x19')]=_0x2d5d56[_0xd2a2('0x19')];this[_0xd2a2('0x1a')]=_0x2d5d56[_0xd2a2('0x1a')];this[_0xd2a2('0x1b')]=_0x2d5d56['servicenowAccounts'];this[_0xd2a2('0x1c')]=_0x2d5d56[_0xd2a2('0x1c')];this[_0xd2a2('0x1d')]=_0x2d5d56[_0xd2a2('0x1d')];this[_0xd2a2('0x1e')]={'zendesk':this[_0xd2a2('0x15')],'salesforce':this[_0xd2a2('0x17')],'freshdesk':this[_0xd2a2('0x16')],'sugarcrm':this[_0xd2a2('0x1f')],'zoho':this['zohoAccounts'],'desk':this[_0xd2a2('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xd2a2('0x1c')],'freshsales':this[_0xd2a2('0x1d')],'servicenow':this[_0xd2a2('0x1b')]};ami['on'](_0xd2a2('0x20'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x23'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x24'),this[_0xd2a2('0x21')]['bind'](this));ami['on'](_0xd2a2('0x25'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x26'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x27'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x28'),this['syncCustomEvent'][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x29'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x2a'),this['syncCustomEvent'][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x2b'),this['syncCustomEvent'][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x2c'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x2d'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x2e'),this[_0xd2a2('0x2f')][_0xd2a2('0x22')](this));ami['on']('custom:dialconnect',this[_0xd2a2('0x2f')][_0xd2a2('0x22')](this));ami['on']('custom:dialend',this[_0xd2a2('0x2f')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x30'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on']('custom:closedinteraction',this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x31'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0xd2a2('0x22')](this));ami['on']('custom:outgoingmessage',this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on']('custom:acceptmessage',this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x32'),this['syncCustomEvent'][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x33'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));}Trigger[_0xd2a2('0x34')][_0xd2a2('0x35')]=function(_0x3e3ca9,_0x36f278,_0x2c4f5b){logger[_0xd2a2('0x36')](_0x3e3ca9,_0x36f278,JSON['stringify'](_0x2c4f5b));io['to'](_0x3e3ca9)[_0xd2a2('0x35')](_0x36f278,_0x2c4f5b);};Trigger[_0xd2a2('0x34')][_0xd2a2('0x21')]=function(_0x31334d){var _0x2acad7=_[_0xd2a2('0x37')](_0x31334d);if(typeof _0x2acad7['motionChannel']===_0xd2a2('0x38')){_0x2acad7[_0xd2a2('0x39')]=_0xd2a2('0x3a');}logger[_0xd2a2('0x3b')](_0xd2a2('0x21'),util[_0xd2a2('0x3c')](_0x2acad7,{'showHidden':!![],'depth':null}));this[_0xd2a2('0x3d')](_0x2acad7);};Trigger[_0xd2a2('0x34')][_0xd2a2('0x2f')]=function(_0x4ba779){if(this['agents'][_0x4ba779['interface']]){this[_0xd2a2('0x21')](_0x4ba779);}};Trigger['prototype']['checkTriggers']=function(_0x2ea424){var _0x4da2ef;for(var _0x262dd1 in this[_0xd2a2('0x10')]){if(this['triggers']['hasOwnProperty'](_0x262dd1)){if(this[_0xd2a2('0x10')][_0x262dd1][_0xd2a2('0x3e')]){_0x4da2ef=this[_0xd2a2('0x3f')](this['triggers'][_0x262dd1],_0x2ea424);if(_0x4da2ef){_['merge'](_0x2ea424,_0x2ea424['variables']);for(var _0x15a747=0x0,_0x4c381e,_0x5a79b9,_0x461449;_0x15a7470x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x58d7cd,_0x63a0b){var _0x2b5b91=function(_0x2f4346){while(--_0x2f4346){_0x58d7cd['push'](_0x58d7cd['shift']());}};_0x2b5b91(++_0x63a0b);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 7622ac8..26cbe02 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 _0x1f44=['length','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','outbound','destcalleridnum','calleridnum','POST','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','telephone1','contacts?$select=','%2b','contactid','nothing',']\x20Enduser\x20created!','forEach','string','customField','idField','incident','incidents','assign','Descriptions','/contacts(','Fields','ticketType','phonecall','queue','callDirection','getString','Subjects','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','modernAuthentication','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','remoteUri','CloudProvider','data2','resolve','data5','clientId','username','password','then','access_token','catch','error','message','GET','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail'];(function(_0x480d03,_0x32060d){var _0x235a96=function(_0xd5826e){while(--_0xd5826e){_0x480d03['push'](_0x480d03['shift']());}};_0x235a96(++_0x32060d);}(_0x1f44,0xba));var _0x41f4=function(_0x13e2a4,_0x245fa6){_0x13e2a4=_0x13e2a4-0x0;var _0x4baa21=_0x1f44[_0x13e2a4];return _0x4baa21;};'use strict';var _=require(_0x41f4('0x0'));var rp=require(_0x41f4('0x1'));var util=require('util');var intUtil=require(_0x41f4('0x2'));var md5=require(_0x41f4('0x3'));var Redis=require(_0x41f4('0x4'));var logger=require(_0x41f4('0x5'))('dynamics365');var config=require(_0x41f4('0x6'));config[_0x41f4('0x7')]=_[_0x41f4('0x8')](config[_0x41f4('0x7')],{'host':_0x41f4('0x9'),'port':0x18eb});var io=require(_0x41f4('0xa'))(new Redis(config[_0x41f4('0x7')]));function getAuthToken(_0x41b3f0,_0x204ad2,_0x15ff9f){if(_0x41b3f0['modernAuthentication']){_0x41b3f0[_0x41f4('0xb')]=_0x41b3f0[_0x41f4('0xc')]['data7'];_0x41b3f0['tenantId']=_0x41b3f0['CloudProvider'][_0x41f4('0xd')];return Promise[_0x41f4('0xe')](_0x41b3f0[_0x41f4('0xc')][_0x41f4('0xf')]);}var _0x1087b1={'method':'POST','uri':_0x204ad2,'form':{'client_id':_0x41b3f0[_0x41f4('0x10')],'resource':_0x41b3f0[_0x41f4('0xb')],'username':_0x41b3f0[_0x41f4('0x11')],'password':_0x41b3f0[_0x41f4('0x12')],'grant_type':'password','client_secret':_0x41b3f0['clientSecret']},'json':!![]};return rp(_0x1087b1)[_0x41f4('0x13')](function(_0x45b860){return _0x45b860[_0x41f4('0x14')];})[_0x41f4('0x15')](function(_0x295194){logger[_0x41f4('0x16')]('['+[_0x15ff9f['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x295194[_0x41f4('0x17')];});}function getUser(_0x2a6e01,_0x51dc93,_0x268fd8,_0x4f680c,_0x253882,_0x496f06){return new Promise(function(_0x52564e,_0x200983){return getAuthToken(_0x51dc93,_0x4f680c,_0x496f06)[_0x41f4('0x13')](function(_0x68f641){var _0x597d4f={'method':_0x41f4('0x18'),'uri':_0x253882+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x41f4('0x19')+_0x68f641,'OData-Version':_0x41f4('0x1a')},'json':!![]};return rp(_0x597d4f);})[_0x41f4('0x13')](function(_0x5b0391){var _0x39da32=_0x5b0391[_0x41f4('0x1b')];var _0x2c84b4=![];var _0x4b7f5f=null;if(!_[_0x41f4('0x1c')](_0x268fd8)){if(intUtil[_0x41f4('0x1d')](_0x268fd8[_0x41f4('0x1e')])){_0x2a6e01[_0x41f4('0x1f')]=_0x268fd8[_0x41f4('0x1e')];for(_0x4b7f5f=0x0;_0x4b7f5f<_0x39da32[_0x41f4('0x20')];_0x4b7f5f++){if(_0x39da32[_0x4b7f5f][_0x41f4('0x21')]===_0x268fd8[_0x41f4('0x1e')]&&!_0x39da32[_0x4b7f5f]['isdisabled']){_0x2c84b4=!![];logger[_0x41f4('0x22')]('['+[_0x496f06[_0x41f4('0x23')]()]+_0x41f4('0x24')+_0x39da32[_0x4b7f5f][_0x41f4('0x25')]+'!');_0x2a6e01[_0x41f4('0x26')]=_0x39da32[_0x4b7f5f]['systemuserid'];}}}}if(!_0x2c84b4){logger[_0x41f4('0x22')]('['+[_0x496f06[_0x41f4('0x23')]()]+_0x41f4('0x27'));_0x2a6e01['userEmail']=_0x51dc93[_0x41f4('0x11')];for(_0x4b7f5f=0x0;_0x4b7f5f<_0x39da32[_0x41f4('0x20')];_0x4b7f5f++){if(_0x39da32[_0x4b7f5f][_0x41f4('0x21')]===_0x51dc93['username']){_0x2a6e01['userId']=_0x39da32[_0x4b7f5f]['systemuserid'];}}}_0x52564e(_0x2a6e01);})[_0x41f4('0x15')](function(_0x41918c){_0x200983(_0x41918c[_0x41f4('0x17')]);});});}function createEndUser(_0x445259,_0x2797ff,_0xdfc8c6,_0x56f86c,_0x17e3c3,_0x1b7b3f,_0x52925a){return new Promise(function(_0x46e5de,_0xd5b160){return getAuthToken(_0x2797ff,_0xdfc8c6,_0x1b7b3f)[_0x41f4('0x13')](function(_0x12970d){var _0x411d3c=_0x1b7b3f['toLowerCase']()===_0x41f4('0x28')?_0x17e3c3[_0x41f4('0x29')]:_0x17e3c3[_0x41f4('0x2a')];var _0x304058={'method':_0x41f4('0x2b'),'uri':_0x56f86c+'contacts','body':{'fullname':_0x411d3c,'firstname':_0x411d3c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x41f4('0x2c')+_0x445259[_0x41f4('0x26')]+')'},'headers':{'Authorization':_0x41f4('0x19')+_0x12970d,'OData-Version':_0x41f4('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x304058[_0x41f4('0x2d')][_0x52925a]=_0x411d3c;return rp(_0x304058);})[_0x41f4('0x13')](function(_0x27f87b){var _0x23fbe5=_0x27f87b[_0x41f4('0x2e')][_0x41f4('0x2f')];var _0x4ca921=_0x23fbe5[_0x41f4('0x30')](_0x23fbe5[_0x41f4('0x31')]('(')+0x1,_0x23fbe5['lastIndexOf'](')'));_0x445259[_0x41f4('0x32')]=_0x4ca921;_0x46e5de(_0x445259);})[_0x41f4('0x15')](function(_0xee3b6c){_0xd5b160(_0xee3b6c[_0x41f4('0x17')]);});});}function getEndUser(_0xd9ebf7,_0x5c2930,_0x235a85,_0x4ddb3c,_0x2f7438,_0x3bdd3d,_0x362fb2,_0x3f70c4){var _0x37fe4a=_0x3bdd3d[_0x41f4('0x33')]()===_0x41f4('0x28')?_0x2f7438[_0x41f4('0x29')]:_0x2f7438[_0x41f4('0x2a')];return getAuthToken(_0x5c2930,_0x235a85,_0x3bdd3d)[_0x41f4('0x13')](function(_0x431629){_0x3f70c4=_0x3f70c4?_0x3f70c4:_0x41f4('0x34');var _0x4e59be={'method':_0x41f4('0x18'),'uri':_0x4ddb3c+_0x41f4('0x35')+_0x3f70c4+'&$filter='+_0x3f70c4+'\x20eq\x20\x27'+_0x37fe4a['replace']('+',_0x41f4('0x36'))+'\x27','headers':{'Authorization':_0x41f4('0x19')+_0x431629,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4e59be);})['then'](function(_0x238516){var _0x293d95=![];if(!_0x238516)return _0x293d95;var _0x24548e=_0x238516['value'];for(var _0x14089a=0x0;_0x14089a<_0x24548e['length'];_0x14089a++){if(_0x24548e[_0x14089a][_0x3f70c4]===_0x37fe4a){_0x293d95=!![];_0xd9ebf7[_0x41f4('0x32')]=_0x24548e[_0x14089a][_0x41f4('0x37')];}}return _0x293d95;})[_0x41f4('0x13')](function(_0x4d29ec){if(_0x4d29ec)return _0xd9ebf7;if(_0x362fb2===_0x41f4('0x38')){logger['info']('['+[_0x3bdd3d['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0xd9ebf7;}return createEndUser(_0xd9ebf7,_0x5c2930,_0x235a85,_0x4ddb3c,_0x2f7438,_0x3bdd3d,_0x3f70c4)[_0x41f4('0x13')](function(_0xda6893){logger[_0x41f4('0x22')]('['+[_0x3bdd3d[_0x41f4('0x23')]()]+_0x41f4('0x39'),_0xda6893['enduserId']);return _0xda6893;});});}function getCustomFields(_0x3d818e,_0x11abce,_0x2a8cf0){var _0x4449c0={};if(_0x3d818e['length']>0x0){_[_0x41f4('0x3a')](_0x3d818e,function(_0x3a560a){if(_['includes']([_0x41f4('0x3b'),'picklist'],_0x3a560a['type'])&&_0x3a560a['nameField']&&!_0x3a560a[_0x41f4('0x3c')]){var _0x2bcf8e=_0x3a560a[_0x41f4('0x3d')][_0x41f4('0x33')]();var _0x474011=_0x2bcf8e['substring'](0x0,_0x2bcf8e['indexOf']('_'));var _0x3c3cd4=_0x2bcf8e[_0x41f4('0x30')](_0x2bcf8e['indexOf']('_')+0x1);if(_0x474011===_0x2a8cf0){_0x4449c0[_0x3c3cd4]=_0x3a560a['content'];}}});}return _0x4449c0;}function getTicket(_0x32afd5,_0x12a6b7,_0x3c1aa9,_0x28b27d,_0x2edbf7,_0x1c138c,_0x2d882b){return new Promise(function(_0x572a8e,_0x5614e9){var _0x430ed5;return getAuthToken(_0x12a6b7,_0x3c1aa9,_0x2d882b)[_0x41f4('0x13')](function(_0x256811){if(_0x1c138c['ticketType']===_0x41f4('0x3e')){_0x430ed5={'method':_0x41f4('0x2b'),'uri':_0x28b27d+_0x41f4('0x3f'),'body':Object[_0x41f4('0x40')]({},{'title':intUtil['getString'](_0x1c138c['Subjects'],_0x2edbf7,'\x20'),'description':intUtil['getString'](_0x1c138c[_0x41f4('0x41')],_0x2edbf7,'\x0a'),'customerid_contact@odata.bind':_0x32afd5[_0x41f4('0x32')]?_0x41f4('0x42')+_0x32afd5['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x32afd5[_0x41f4('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x1c138c[_0x41f4('0x43')],_0x2edbf7,_0x1c138c[_0x41f4('0x44')])),'headers':{'Authorization':_0x41f4('0x19')+_0x256811,'OData-Version':_0x41f4('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1c138c[_0x41f4('0x44')]===_0x41f4('0x45')){var _0x4a0b7e=_0x32afd5[_0x41f4('0x32')]?[{'partyid_systemuser@odata.bind':_0x41f4('0x2c')+_0x32afd5[_0x41f4('0x26')]+')','participationtypemask':_0x32afd5['callDirection']===_0x41f4('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x41f4('0x42')+_0x32afd5[_0x41f4('0x32')]+')','participationtypemask':_0x32afd5[_0x41f4('0x47')]===_0x41f4('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x41f4('0x2c')+_0x32afd5[_0x41f4('0x26')]+')','participationtypemask':_0x32afd5[_0x41f4('0x47')]===_0x41f4('0x46')?0x2:0x1}];_0x430ed5={'method':_0x41f4('0x2b'),'uri':_0x28b27d+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x41f4('0x48')](_0x1c138c[_0x41f4('0x49')],_0x2edbf7,'\x20'),'phonenumber':String(_0x2edbf7[_0x41f4('0x2a')]),'description':intUtil[_0x41f4('0x48')](_0x1c138c[_0x41f4('0x41')],_0x2edbf7,'\x0a'),'regardingobjectid_contact@odata.bind':_0x32afd5['enduserId']?_0x41f4('0x42')+_0x32afd5[_0x41f4('0x32')]+')':undefined,'ownerid@odata.bind':_0x41f4('0x2c')+_0x32afd5[_0x41f4('0x26')]+')','directioncode':_0x32afd5['callDirection']===_0x41f4('0x46')?![]:!![],'phonecall_activity_parties':_0x4a0b7e},getCustomFields(_0x1c138c[_0x41f4('0x43')],_0x2edbf7,_0x1c138c[_0x41f4('0x44')])),'headers':{'Authorization':_0x41f4('0x19')+_0x256811,'OData-Version':_0x41f4('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x430ed5);})[_0x41f4('0x13')](function(_0x1bc618){var _0x533cea=_0x1bc618[_0x41f4('0x2e')]['odata-entityid'];var _0x2beec7=_0x533cea[_0x41f4('0x30')](_0x533cea[_0x41f4('0x31')]('(')+0x1,_0x533cea['lastIndexOf'](')'));_0x32afd5[_0x41f4('0x4a')]=_0x2beec7;_0x572a8e(_0x32afd5);})[_0x41f4('0x15')](function(_0x35f3b5){_0x5614e9(_0x35f3b5['message']);});});}function emit(_0x526ce9,_0x5ba63a,_0x417f56,_0x57e308){var _0x47bd9c={'uri':util[_0x41f4('0x4b')](_0x41f4('0x4c'),_0x526ce9,_0x417f56,_0x57e308)};io['to'](util['format'](_0x41f4('0x4d'),_0x5ba63a))['emit'](_0x41f4('0x4e'),_0x47bd9c);}exports['cs']=function(_0x2954fb,_0x4a628d,_0x49e06b,_0xf09952,_0x8db9b6,_0x38e481,_0x7b1e69,_0x2523bd){var _0x11fa4e={};_0x38e481[_0x41f4('0xb')]=_0x38e481[_0x41f4('0x4f')]?intUtil[_0x41f4('0x50')](_0x38e481['CloudProvider'][_0x41f4('0x51')]):intUtil['stripTrailingSlash'](_0x38e481['remoteUri']);_0x38e481['serverUrl']=intUtil[_0x41f4('0x50')](_0x38e481[_0x41f4('0x52')]);_0x11fa4e[_0x41f4('0x47')]=_0x2523bd==='queue'||_0x2523bd===_0x41f4('0x53')?_0x41f4('0x46'):_0x41f4('0x28');var _0x5eff9a=_0x38e481['modernAuthentication']?util[_0x41f4('0x4b')](_0x41f4('0x54'),_0x38e481['CloudProvider']['data7']):util[_0x41f4('0x4b')](_0x41f4('0x54'),_0x38e481[_0x41f4('0xb')]);var _0x2cb9f8=util[_0x41f4('0x4b')](_0x41f4('0x55'),_0x38e481[_0x41f4('0x56')]);var _0x3455e8=util[_0x41f4('0x4b')](_0x41f4('0x57'),_0x38e481['serverUrl'],_0x4a628d['uniqueid'],md5(_0x4a628d[_0x41f4('0x58')]));if(_0x8db9b6&&_0x8db9b6[_0x41f4('0x59')]){logger[_0x41f4('0x22')](_0x41f4('0x5a'),_0x41f4('0x5b'));_0x4a628d['recordingURL']=_0x3455e8;}else if(_0x7b1e69&&_0x7b1e69['recordingFormat']&&_0x7b1e69[_0x41f4('0x5c')]!==_0x41f4('0x5d')){logger['info'](_0x41f4('0x5e'),_0x41f4('0x5b'));_0x4a628d[_0x41f4('0x5f')]=_0x3455e8;}else{_0x4a628d['recordingURL']='';}return getUser(_0x11fa4e,_0x38e481,_0xf09952,_0x2cb9f8,_0x5eff9a,_0x2523bd)[_0x41f4('0x13')](function(_0xcff57a){logger['info']('['+_0x2523bd[_0x41f4('0x23')]()+_0x41f4('0x60'),_0xcff57a[_0x41f4('0x26')]);logger[_0x41f4('0x22')]('['+_0x2523bd[_0x41f4('0x23')]()+_0x41f4('0x61'),_0xcff57a['userEmail']);return getEndUser(_0xcff57a,_0x38e481,_0x2cb9f8,_0x5eff9a,_0x4a628d,_0x2523bd,_0x49e06b[_0x41f4('0x62')],_0x49e06b[_0x41f4('0x63')]);})['then'](function(_0x337d3d){logger[_0x41f4('0x22')]('['+_0x2523bd[_0x41f4('0x23')]()+_0x41f4('0x64'),_0x337d3d['enduserId']);logger[_0x41f4('0x22')]('['+_0x2523bd[_0x41f4('0x23')]()+_0x41f4('0x65'),_0x4a628d['calleridnum']);return getTicket(_0x337d3d,_0x38e481,_0x2cb9f8,_0x5eff9a,_0x4a628d,_0x49e06b,_0x2523bd);})[_0x41f4('0x13')](function(_0xe29ba3){logger[_0x41f4('0x22')](util[_0x41f4('0x4b')]('['+_0x2523bd[_0x41f4('0x23')]()+_0x41f4('0x66'),_0x49e06b['ticketType'],_0xe29ba3[_0x41f4('0x4a')]));logger[_0x41f4('0x22')](util[_0x41f4('0x4b')]('['+_0x2523bd[_0x41f4('0x23')]()+_0x41f4('0x67'),_0x2523bd));if(_0x2523bd!==_0x41f4('0x53')&&_0x49e06b[_0x41f4('0x68')]){logger[_0x41f4('0x22')]('['+_0x2523bd[_0x41f4('0x23')]()+']',_0x41f4('0x69'));emit(_0x38e481[_0x41f4('0xb')],_0xf09952[_0x41f4('0x6a')],_0x49e06b[_0x41f4('0x44')],_0xe29ba3[_0x41f4('0x4a')]);}})['catch'](function(_0x2e8201){logger[_0x41f4('0x16')]('['+_0x2523bd[_0x41f4('0x23')]()+_0x41f4('0x6b'),_0x2e8201[_0x41f4('0x17')]);console[_0x41f4('0x16')](_0x41f4('0x6c'),_0x2e8201);});}; \ No newline at end of file +var _0x75d3=['trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','defaults','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','data5','POST','username','password','clientSecret','access_token','catch','error',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','internalemailaddress','isdisabled','info','systemuserid','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','length','userId','toLowerCase','destcalleridnum','contacts','/systemusers(','body','odata-entityid','lastIndexOf','calleridnum','telephone1','contacts?$select=','&$filter=','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','enduserId','includes','string','picklist','type','nameField','customField','idField','substring','indexOf','ticketType','incident','getString','Subjects','Descriptions','Fields','phonecall','callDirection','queue','phonecalls','assign','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit'];(function(_0x1ef141,_0x5a0494){var _0x5e8679=function(_0x5c8d5f){while(--_0x5c8d5f){_0x1ef141['push'](_0x1ef141['shift']());}};_0x5e8679(++_0x5a0494);}(_0x75d3,0x1c1));var _0x375d=function(_0x47df99,_0x4c4398){_0x47df99=_0x47df99-0x0;var _0x153038=_0x75d3[_0x47df99];return _0x153038;};'use strict';var _=require('lodash');var rp=require(_0x375d('0x0'));var util=require(_0x375d('0x1'));var intUtil=require('./util');var md5=require(_0x375d('0x2'));var Redis=require(_0x375d('0x3'));var logger=require(_0x375d('0x4'))(_0x375d('0x5'));var config=require('../../../../config/environment');config['redis']=_[_0x375d('0x6')](config[_0x375d('0x7')],{'host':_0x375d('0x8'),'port':0x18eb});var io=require(_0x375d('0x9'))(new Redis(config[_0x375d('0x7')]));function getAuthToken(_0x242632,_0x37cead,_0x406073){if(_0x242632[_0x375d('0xa')]){_0x242632[_0x375d('0xb')]=_0x242632[_0x375d('0xc')][_0x375d('0xd')];_0x242632[_0x375d('0xe')]=_0x242632[_0x375d('0xc')][_0x375d('0xf')];return Promise['resolve'](_0x242632[_0x375d('0xc')][_0x375d('0x10')]);}var _0x383204={'method':_0x375d('0x11'),'uri':_0x37cead,'form':{'client_id':_0x242632['clientId'],'resource':_0x242632[_0x375d('0xb')],'username':_0x242632[_0x375d('0x12')],'password':_0x242632['password'],'grant_type':_0x375d('0x13'),'client_secret':_0x242632[_0x375d('0x14')]},'json':!![]};return rp(_0x383204)['then'](function(_0x3f005b){return _0x3f005b[_0x375d('0x15')];})[_0x375d('0x16')](function(_0x356761){logger[_0x375d('0x17')]('['+[_0x406073['toUpperCase']()]+_0x375d('0x18'));return _0x356761[_0x375d('0x19')];});}function getUser(_0x3ae2cb,_0x5dae33,_0x2571f8,_0x5e2576,_0xc7f9c9,_0x2b6b3c){return new Promise(function(_0x548edd,_0xbade3f){return getAuthToken(_0x5dae33,_0x5e2576,_0x2b6b3c)[_0x375d('0x1a')](function(_0xc1825f){var _0xe22e0e={'method':_0x375d('0x1b'),'uri':_0xc7f9c9+_0x375d('0x1c'),'headers':{'Authorization':_0x375d('0x1d')+_0xc1825f,'OData-Version':_0x375d('0x1e')},'json':!![]};return rp(_0xe22e0e);})[_0x375d('0x1a')](function(_0x8d72b){var _0x26acb4=_0x8d72b[_0x375d('0x1f')];var _0xbaa9ac=![];var _0x41ae8a=null;if(!_['isNil'](_0x2571f8)){if(intUtil[_0x375d('0x20')](_0x2571f8[_0x375d('0x21')])){_0x3ae2cb['userEmail']=_0x2571f8['email'];for(_0x41ae8a=0x0;_0x41ae8a<_0x26acb4['length'];_0x41ae8a++){if(_0x26acb4[_0x41ae8a][_0x375d('0x22')]===_0x2571f8[_0x375d('0x21')]&&!_0x26acb4[_0x41ae8a][_0x375d('0x23')]){_0xbaa9ac=!![];logger[_0x375d('0x24')]('['+[_0x2b6b3c['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x26acb4[_0x41ae8a][_0x375d('0x25')]+'!');_0x3ae2cb['userId']=_0x26acb4[_0x41ae8a][_0x375d('0x25')];}}}}if(!_0xbaa9ac){logger[_0x375d('0x24')]('['+[_0x2b6b3c[_0x375d('0x26')]()]+_0x375d('0x27'));_0x3ae2cb[_0x375d('0x28')]=_0x5dae33[_0x375d('0x12')];for(_0x41ae8a=0x0;_0x41ae8a<_0x26acb4[_0x375d('0x29')];_0x41ae8a++){if(_0x26acb4[_0x41ae8a][_0x375d('0x22')]===_0x5dae33[_0x375d('0x12')]){_0x3ae2cb[_0x375d('0x2a')]=_0x26acb4[_0x41ae8a][_0x375d('0x25')];}}}_0x548edd(_0x3ae2cb);})[_0x375d('0x16')](function(_0x1bc149){_0xbade3f(_0x1bc149[_0x375d('0x19')]);});});}function createEndUser(_0x4f5429,_0x59e807,_0x447345,_0x42555b,_0x880b6e,_0x1fd3ea,_0x2f2888){return new Promise(function(_0x3ab95e,_0x8e5b67){return getAuthToken(_0x59e807,_0x447345,_0x1fd3ea)['then'](function(_0x5cab82){var _0x16b627=_0x1fd3ea[_0x375d('0x2b')]()==='outbound'?_0x880b6e[_0x375d('0x2c')]:_0x880b6e['calleridnum'];var _0x19ff3f={'method':_0x375d('0x11'),'uri':_0x42555b+_0x375d('0x2d'),'body':{'fullname':_0x16b627,'firstname':_0x16b627,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x375d('0x2e')+_0x4f5429[_0x375d('0x2a')]+')'},'headers':{'Authorization':_0x375d('0x1d')+_0x5cab82,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x19ff3f[_0x375d('0x2f')][_0x2f2888]=_0x16b627;return rp(_0x19ff3f);})['then'](function(_0x4f5ec5){var _0x344e7f=_0x4f5ec5['headers'][_0x375d('0x30')];var _0x2acf76=_0x344e7f['substring'](_0x344e7f[_0x375d('0x31')]('(')+0x1,_0x344e7f[_0x375d('0x31')](')'));_0x4f5429['enduserId']=_0x2acf76;_0x3ab95e(_0x4f5429);})[_0x375d('0x16')](function(_0x56dc55){_0x8e5b67(_0x56dc55['message']);});});}function getEndUser(_0x5b4123,_0x5b820c,_0x268a72,_0x151cdd,_0xfbd6d9,_0x28f51e,_0xe819e8,_0x29c378){var _0x4cff06=_0x28f51e[_0x375d('0x2b')]()==='outbound'?_0xfbd6d9[_0x375d('0x2c')]:_0xfbd6d9[_0x375d('0x32')];return getAuthToken(_0x5b820c,_0x268a72,_0x28f51e)[_0x375d('0x1a')](function(_0x5c2489){_0x29c378=_0x29c378?_0x29c378:_0x375d('0x33');var _0x2a5590={'method':_0x375d('0x1b'),'uri':_0x151cdd+_0x375d('0x34')+_0x29c378+_0x375d('0x35')+_0x29c378+'\x20eq\x20\x27'+_0x4cff06[_0x375d('0x36')]('+',_0x375d('0x37'))+'\x27','headers':{'Authorization':_0x375d('0x1d')+_0x5c2489,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2a5590);})[_0x375d('0x1a')](function(_0x1dbe0f){var _0x5d0497=![];if(!_0x1dbe0f)return _0x5d0497;var _0x14fa89=_0x1dbe0f[_0x375d('0x1f')];for(var _0x21cd41=0x0;_0x21cd41<_0x14fa89[_0x375d('0x29')];_0x21cd41++){if(_0x14fa89[_0x21cd41][_0x29c378]===_0x4cff06){_0x5d0497=!![];_0x5b4123['enduserId']=_0x14fa89[_0x21cd41][_0x375d('0x38')];}}return _0x5d0497;})[_0x375d('0x1a')](function(_0xec0796){if(_0xec0796)return _0x5b4123;if(_0xe819e8===_0x375d('0x39')){logger[_0x375d('0x24')]('['+[_0x28f51e[_0x375d('0x26')]()]+_0x375d('0x3a'));return _0x5b4123;}return createEndUser(_0x5b4123,_0x5b820c,_0x268a72,_0x151cdd,_0xfbd6d9,_0x28f51e,_0x29c378)['then'](function(_0x21b41d){logger[_0x375d('0x24')]('['+[_0x28f51e[_0x375d('0x26')]()]+']\x20Enduser\x20created!',_0x21b41d[_0x375d('0x3b')]);return _0x21b41d;});});}function getCustomFields(_0x33c837,_0x3c89ad,_0xff4576){var _0x150ff3={};if(_0x33c837[_0x375d('0x29')]>0x0){_['forEach'](_0x33c837,function(_0x268ce9){if(_[_0x375d('0x3c')]([_0x375d('0x3d'),_0x375d('0x3e')],_0x268ce9[_0x375d('0x3f')])&&_0x268ce9[_0x375d('0x40')]&&!_0x268ce9[_0x375d('0x41')]){var _0x389b1=_0x268ce9[_0x375d('0x42')][_0x375d('0x2b')]();var _0x2059ba=_0x389b1[_0x375d('0x43')](0x0,_0x389b1['indexOf']('_'));var _0x21109b=_0x389b1[_0x375d('0x43')](_0x389b1[_0x375d('0x44')]('_')+0x1);if(_0x2059ba===_0xff4576){_0x150ff3[_0x21109b]=_0x268ce9['content'];}}});}return _0x150ff3;}function getTicket(_0x51a851,_0xe34c59,_0x3dad04,_0x44067f,_0x11e28b,_0x5d73fd,_0x6bc1aa){return new Promise(function(_0x47f969,_0x29e487){var _0x482d52;return getAuthToken(_0xe34c59,_0x3dad04,_0x6bc1aa)['then'](function(_0x180309){if(_0x5d73fd[_0x375d('0x45')]===_0x375d('0x46')){_0x482d52={'method':'POST','uri':_0x44067f+'incidents','body':Object['assign']({},{'title':intUtil[_0x375d('0x47')](_0x5d73fd[_0x375d('0x48')],_0x11e28b,'\x20'),'description':intUtil['getString'](_0x5d73fd[_0x375d('0x49')],_0x11e28b,'\x0a'),'customerid_contact@odata.bind':_0x51a851[_0x375d('0x3b')]?'/contacts('+_0x51a851[_0x375d('0x3b')]+')':undefined,'ownerid@odata.bind':_0x375d('0x2e')+_0x51a851[_0x375d('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x5d73fd[_0x375d('0x4a')],_0x11e28b,_0x5d73fd[_0x375d('0x45')])),'headers':{'Authorization':_0x375d('0x1d')+_0x180309,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5d73fd['ticketType']===_0x375d('0x4b')){var _0x23013a=_0x51a851['enduserId']?[{'partyid_systemuser@odata.bind':_0x375d('0x2e')+_0x51a851['userId']+')','participationtypemask':_0x51a851[_0x375d('0x4c')]===_0x375d('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x51a851['enduserId']+')','participationtypemask':_0x51a851[_0x375d('0x4c')]===_0x375d('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x51a851[_0x375d('0x2a')]+')','participationtypemask':_0x51a851[_0x375d('0x4c')]===_0x375d('0x4d')?0x2:0x1}];_0x482d52={'method':'POST','uri':_0x44067f+_0x375d('0x4e'),'body':Object[_0x375d('0x4f')]({},{'subject':intUtil[_0x375d('0x47')](_0x5d73fd[_0x375d('0x48')],_0x11e28b,'\x20'),'phonenumber':String(_0x11e28b[_0x375d('0x32')]),'description':intUtil[_0x375d('0x47')](_0x5d73fd[_0x375d('0x49')],_0x11e28b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x51a851[_0x375d('0x3b')]?'/contacts('+_0x51a851[_0x375d('0x3b')]+')':undefined,'ownerid@odata.bind':_0x375d('0x2e')+_0x51a851['userId']+')','directioncode':_0x51a851[_0x375d('0x4c')]===_0x375d('0x4d')?![]:!![],'phonecall_activity_parties':_0x23013a},getCustomFields(_0x5d73fd[_0x375d('0x4a')],_0x11e28b,_0x5d73fd[_0x375d('0x45')])),'headers':{'Authorization':'Bearer\x20'+_0x180309,'OData-Version':_0x375d('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x482d52);})[_0x375d('0x1a')](function(_0x34b976){var _0x929dda=_0x34b976[_0x375d('0x50')][_0x375d('0x30')];var _0x303fec=_0x929dda[_0x375d('0x43')](_0x929dda[_0x375d('0x31')]('(')+0x1,_0x929dda[_0x375d('0x31')](')'));_0x51a851[_0x375d('0x51')]=_0x303fec;_0x47f969(_0x51a851);})['catch'](function(_0xab1b03){_0x29e487(_0xab1b03['message']);});});}function emit(_0x1c4eb2,_0x1ad7d6,_0x3020d9,_0x50a6af){var _0x4d2d9c={'uri':util[_0x375d('0x52')](_0x375d('0x53'),_0x1c4eb2,_0x3020d9,_0x50a6af)};io['to'](util['format'](_0x375d('0x54'),_0x1ad7d6))[_0x375d('0x55')](_0x375d('0x56'),_0x4d2d9c);}exports['cs']=function(_0x32f240,_0x46aab1,_0x499686,_0x4499d1,_0x23e0cf,_0x5ac573,_0x99a851,_0x52b659){var _0x355950={};_0x5ac573[_0x375d('0xb')]=_0x5ac573[_0x375d('0xa')]?intUtil[_0x375d('0x57')](_0x5ac573[_0x375d('0xc')]['data7']):intUtil['stripTrailingSlash'](_0x5ac573['remoteUri']);_0x5ac573['serverUrl']=intUtil[_0x375d('0x57')](_0x5ac573[_0x375d('0x58')]);_0x355950[_0x375d('0x4c')]=_0x52b659===_0x375d('0x4d')||_0x52b659==='unmanaged'?_0x375d('0x4d'):'outbound';var _0x152a03=_0x5ac573[_0x375d('0xa')]?util['format'](_0x375d('0x59'),_0x5ac573[_0x375d('0xc')][_0x375d('0xd')]):util['format']('%s/api/data/v9.0/',_0x5ac573[_0x375d('0xb')]);var _0x24d35d=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x5ac573[_0x375d('0xe')]);var _0x344aa2=util[_0x375d('0x52')](_0x375d('0x5a'),_0x5ac573[_0x375d('0x58')],_0x46aab1[_0x375d('0x5b')],md5(_0x46aab1[_0x375d('0x5b')]));if(_0x23e0cf&&_0x23e0cf['monitor_format']){logger[_0x375d('0x24')](_0x375d('0x5c'),_0x375d('0x5d'));_0x46aab1[_0x375d('0x5e')]=_0x344aa2;}else if(_0x99a851&&_0x99a851[_0x375d('0x5f')]&&_0x99a851[_0x375d('0x5f')]!==_0x375d('0x60')){logger[_0x375d('0x24')]('[OUTBOUND]',_0x375d('0x5d'));_0x46aab1['recordingURL']=_0x344aa2;}else{_0x46aab1[_0x375d('0x5e')]='';}return getUser(_0x355950,_0x5ac573,_0x4499d1,_0x24d35d,_0x152a03,_0x52b659)['then'](function(_0x23407d){logger['info']('['+_0x52b659[_0x375d('0x26')]()+_0x375d('0x61'),_0x23407d['userId']);logger['info']('['+_0x52b659[_0x375d('0x26')]()+_0x375d('0x62'),_0x23407d['userEmail']);return getEndUser(_0x23407d,_0x5ac573,_0x24d35d,_0x152a03,_0x46aab1,_0x52b659,_0x499686[_0x375d('0x63')],_0x499686[_0x375d('0x64')]);})[_0x375d('0x1a')](function(_0x10754f){logger['info']('['+_0x52b659[_0x375d('0x26')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x10754f['enduserId']);logger[_0x375d('0x24')]('['+_0x52b659[_0x375d('0x26')]()+_0x375d('0x65'),_0x46aab1['calleridnum']);return getTicket(_0x10754f,_0x5ac573,_0x24d35d,_0x152a03,_0x46aab1,_0x499686,_0x52b659);})['then'](function(_0x45b5a3){logger[_0x375d('0x24')](util[_0x375d('0x52')]('['+_0x52b659[_0x375d('0x26')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x499686[_0x375d('0x45')],_0x45b5a3[_0x375d('0x51')]));logger['info'](util[_0x375d('0x52')]('['+_0x52b659[_0x375d('0x26')]()+_0x375d('0x66'),_0x52b659));if(_0x52b659!==_0x375d('0x67')&&_0x499686[_0x375d('0x68')]){logger[_0x375d('0x24')]('['+_0x52b659[_0x375d('0x26')]()+']',_0x375d('0x69'));emit(_0x5ac573[_0x375d('0xb')],_0x4499d1[_0x375d('0x6a')],_0x499686[_0x375d('0x45')],_0x45b5a3[_0x375d('0x51')]);}})[_0x375d('0x16')](function(_0x414872){logger[_0x375d('0x17')]('['+_0x52b659[_0x375d('0x26')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x414872[_0x375d('0x19')]);console[_0x375d('0x17')]('Error\x20running\x20Dynamics365\x20integration',_0x414872);});}; \ 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 1e5611b..dfe928d 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 _0x61f9=['Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','apiKey','toString','debug','[HTTP]','GET','includes','picklist','type','nameField','customField','toLowerCase','idField','content','variable','variableName','customVariable','Variable','push','queue','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','stripTrailingSlash','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','unmanaged','lastevent','toUpperCase','lodash','md5','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','merge','format','calleridname','calleridnum','getString','Subjects','
','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.'];(function(_0x439894,_0xc0f818){var _0x27be8c=function(_0x5a1ff7){while(--_0x5a1ff7){_0x439894['push'](_0x439894['shift']());}};_0x27be8c(++_0xc0f818);}(_0x61f9,0x18c));var _0x961f=function(_0x30cfb6,_0x48b8e6){_0x30cfb6=_0x30cfb6-0x0;var _0x294e46=_0x61f9[_0x30cfb6];return _0x294e46;};'use strict';var _=require(_0x961f('0x0'));var rp=require('request-promise');var md5=require(_0x961f('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x961f('0x2'));var config=require(_0x961f('0x3'));var logger=require(_0x961f('0x4'))(_0x961f('0x5'));config[_0x961f('0x6')]=_[_0x961f('0x7')](config[_0x961f('0x6')],{'host':_0x961f('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x961f('0x9'),'Accept':_0x961f('0x9')};function emit(_0x5a45f3,_0x25e0a0,_0x33547a){io['to'](_0x5a45f3)[_0x961f('0xa')](_0x25e0a0,_0x33547a);}function getTicket(_0x5e8d7e,_0x18d371,_0x97dc25,_0x32bfd3,_0x491317){logger[_0x961f('0xb')]('Creating\x20new\x20ticket...');var _0x309ade=_[_0x961f('0xc')]({'responder_id':_0x18d371['id'],'requester_id':_0x97dc25['id'],'name':util[_0x961f('0xd')]('Caller\x20-\x20%s',_0x491317[_0x961f('0xe')]),'phone':_0x491317[_0x961f('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x961f('0x10')](_0x32bfd3[_0x961f('0x11')],_0x491317,'\x20'),'description':intUtil[_0x961f('0x10')](_0x32bfd3['Descriptions'],_0x491317,_0x961f('0x12')),'tags':getTags(_0x32bfd3['Tags'],_0x961f('0x13'))},getCustomFields(_0x32bfd3[_0x961f('0x14')],_0x491317));_0x309ade[_0x961f('0x15')]=_[_0x961f('0x16')](_[_0x961f('0x17')](_0x309ade[_0x961f('0x15')],'id'),_0x961f('0x18'));return request({'uri':util[_0x961f('0xd')](_0x961f('0x19'),_0x5e8d7e[_0x961f('0x1a')]),'method':_0x961f('0x1b'),'body':_0x309ade})[_0x961f('0x1c')](function(_0x19f797){logger[_0x961f('0xb')](_0x961f('0x1d'));return _0x19f797;});}function getUser(_0xfa8464,_0x2d9a0e){if(intUtil[_0x961f('0x1e')](_0x2d9a0e)){return request({'uri':util[_0x961f('0xd')](_0x961f('0x1f'),_0xfa8464[_0x961f('0x1a')]),'qs':{'email':_0x2d9a0e}})[_0x961f('0x1c')](function(_0xb7304a){if(_0xb7304a[_0x961f('0x20')]){logger[_0x961f('0xb')](_0x961f('0x21'));return _['find'](_0xb7304a,function(_0x56a36d){return _0x56a36d[_0x961f('0x22')][_0x961f('0x23')]===_0x2d9a0e;});}else{logger[_0x961f('0xb')](_0x961f('0x24'));return request({'uri':util['format'](_0x961f('0x25'),_0xfa8464['remoteUri'])})[_0x961f('0x1c')](function(_0x36872c){logger['info']('Admin\x20account\x20selected.');return _0x36872c;});}});}else{logger[_0x961f('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x961f('0xd')](_0x961f('0x25'),_0xfa8464['remoteUri'])})['then'](function(_0x48be35){logger['info'](_0x961f('0x26'));return _0x48be35;});}}function getEndUser(_0xfd605a,_0x365eb5,_0x557902){logger['info']('Searching\x20enduser\x20with\x20phone',_0x557902);return request({'uri':util[_0x961f('0xd')]('%s/api/v2/contacts',_0xfd605a['remoteUri']),'qs':{'phone':_0x557902}})[_0x961f('0x1c')](function(_0x4a2a95){if(_0x4a2a95['length']){logger[_0x961f('0xb')](_0x961f('0x27'));return _[_0x961f('0x28')](_0x4a2a95,{'phone':_0x557902});}else{logger[_0x961f('0xb')](_0x961f('0x29'));return request({'uri':util[_0x961f('0xd')](_0x961f('0x2a'),_0xfd605a[_0x961f('0x1a')]),'method':_0x961f('0x1b'),'body':{'name':_0x365eb5,'phone':_0x557902}})[_0x961f('0x1c')](function(_0x360209){logger[_0x961f('0xb')]('Enduser\x20created.');return _0x360209;});}});}function getAuth(_0x2d3138){return util[_0x961f('0xd')](_0x961f('0x2b'),new Buffer(_0x2d3138[_0x961f('0x2c')]+':X')[_0x961f('0x2d')]('base64'));}function request(_0x18cc29){logger[_0x961f('0x2e')](_0x961f('0x2f'),JSON['stringify'](_0x18cc29));return rp(_['defaults'](_0x18cc29,{'method':_0x961f('0x30'),'headers':headers,'json':!![]}));}function getTags(_0xe7cf61,_0x20379a){var _0x10629f=[];if(_0xe7cf61&&_0xe7cf61[_0x961f('0x20')]>0x0){_0x10629f=_['map'](_0xe7cf61,_0x20379a);}return _0x10629f;}function getCustomFields(_0xf9030e,_0x10f968){var _0x400385=[];var _0x56f3e8={'custom_fields':[]};if(_0xf9030e['length']>0x0){_['forEach'](_0xf9030e,function(_0x116c00){if(_[_0x961f('0x31')](['string',_0x961f('0x32')],_0x116c00[_0x961f('0x33')])&&_0x116c00[_0x961f('0x34')]&&!_0x116c00[_0x961f('0x35')]){_0x56f3e8[_0x116c00[_0x961f('0x34')][_0x961f('0x36')]()]=_0x116c00['content'][_0x961f('0x2d')]();}else if(_[_0x961f('0x31')](['string','picklist'],_0x116c00[_0x961f('0x33')])&&_0x116c00['idField']&&_0x116c00['customField']){_0x56f3e8[_0x961f('0x15')]['push']({'id':_0x116c00[_0x961f('0x37')],'value':_0x116c00[_0x961f('0x38')][_0x961f('0x2d')]()});}else if(_0x116c00['type']===_0x961f('0x39')&&_0x116c00[_0x961f('0x3a')]&&_0x116c00[_0x961f('0x37')]&&_0x116c00[_0x961f('0x35')]){_0x10f968[_0x116c00['variableName']]&&_0x56f3e8[_0x961f('0x15')]['push']({'id':_0x116c00[_0x961f('0x37')],'value':_0x10f968[_0x116c00[_0x961f('0x3a')]][_0x961f('0x2d')]()});}else if(_0x116c00[_0x961f('0x33')]===_0x961f('0x3b')&&_0x116c00[_0x961f('0x3c')]&&_0x116c00['Variable'][_0x961f('0x13')]&&_0x116c00[_0x961f('0x37')]&&_0x116c00[_0x961f('0x35')]){_0x10f968[_0x116c00['Variable'][_0x961f('0x13')][_0x961f('0x36')]()]&&_0x56f3e8[_0x961f('0x15')][_0x961f('0x3d')]({'id':_0x116c00[_0x961f('0x37')],'value':_0x10f968[_0x116c00[_0x961f('0x3c')][_0x961f('0x13')][_0x961f('0x36')]()][_0x961f('0x2d')]()});}});}return _0x56f3e8;}exports[_0x961f('0x3e')]=function(_0x56369d,_0x9c3fba,_0x565e57,_0x2e3e75,_0x5ec970,_0x36267b){var _0x2b14f8,_0x8c29d5;_0x36267b[_0x961f('0x1a')]=intUtil['stripTrailingSlash'](_0x36267b[_0x961f('0x1a')]);_0x36267b[_0x961f('0x3f')]=intUtil['stripTrailingSlash'](_0x36267b[_0x961f('0x3f')]);if(_0x5ec970&&_0x5ec970[_0x961f('0x40')]){logger[_0x961f('0xb')](_0x961f('0x41'),'Recording\x20is\x20enabled!');_0x9c3fba[_0x961f('0x42')]=util['format'](_0x961f('0x43'),_0x36267b['serverUrl'],_0x9c3fba[_0x961f('0x44')],md5(_0x9c3fba[_0x961f('0x44')]));}else{_0x9c3fba[_0x961f('0x42')]='';}headers[_0x961f('0x45')]=getAuth(_0x36267b);return getUser(_0x36267b,_0x2e3e75[_0x961f('0x23')])[_0x961f('0x1c')](function(_0x15a5c4){_0x2b14f8=_0x15a5c4;logger[_0x961f('0xb')]('The\x20User\x20ID\x20is:',_0x2b14f8['id']);return getEndUser(_0x36267b,_0x9c3fba['calleridname'],_0x9c3fba[_0x961f('0xf')]);})[_0x961f('0x1c')](function(_0x1ef2d7){_0x8c29d5=_0x1ef2d7;logger[_0x961f('0xb')](_0x961f('0x46'),_0x8c29d5['id']);return getTicket(_0x36267b,_0x2b14f8,_0x8c29d5,_0x565e57,_0x9c3fba);})[_0x961f('0x1c')](function(_0x4ac3c2){if(_0x4ac3c2&&_0x4ac3c2['id']){logger[_0x961f('0xb')](_0x961f('0x1d'));logger[_0x961f('0xb')](_0x961f('0x47'),_0x4ac3c2['id']);logger[_0x961f('0xb')](_0x961f('0x41'),_0x961f('0x48'));emit(util[_0x961f('0xd')](_0x961f('0x49'),_0x2e3e75[_0x961f('0x13')]),_0x961f('0x4a'),{'uri':util['format'](_0x961f('0x4b'),_0x36267b[_0x961f('0x1a')],_0x4ac3c2['id'])});}})[_0x961f('0x4c')](function(_0x191114){logger[_0x961f('0x4d')](_0x961f('0x41'),JSON[_0x961f('0x4e')](_0x191114));});};exports['outbound']=function(_0x1d9e59,_0x5e7455,_0x322dc5,_0x51cee3,_0x4afcc8,_0x3eb052,_0x12746b){var _0x1ac223,_0x30787b;_0x3eb052[_0x961f('0x1a')]=intUtil[_0x961f('0x4f')](_0x3eb052[_0x961f('0x1a')]);_0x3eb052['serverUrl']=intUtil[_0x961f('0x4f')](_0x3eb052[_0x961f('0x3f')]);if(_0x12746b&&_0x12746b[_0x961f('0x50')]&&_0x12746b[_0x961f('0x50')]!=='none'){logger[_0x961f('0xb')](_0x961f('0x51'),'Recording\x20is\x20enabled!');_0x5e7455[_0x961f('0x42')]=util[_0x961f('0xd')](_0x961f('0x43'),_0x3eb052['serverUrl'],_0x5e7455[_0x961f('0x44')],md5(_0x5e7455[_0x961f('0x44')]));}headers[_0x961f('0x45')]=getAuth(_0x3eb052);return getUser(_0x3eb052,_0x51cee3[_0x961f('0x23')])['then'](function(_0x1b0ffe){_0x1ac223=_0x1b0ffe;logger[_0x961f('0xb')](_0x961f('0x52'),_0x1ac223['id']);return getEndUser(_0x3eb052,_0x5e7455[_0x961f('0x53')],_0x5e7455['destcalleridnum']);})[_0x961f('0x1c')](function(_0x758193){_0x30787b=_0x758193;logger[_0x961f('0xb')](_0x961f('0x46'),_0x30787b['id']);return getTicket(_0x3eb052,_0x1ac223,_0x30787b,_0x322dc5,_0x5e7455);})['then'](function(_0x409720){if(_0x409720&&_0x409720['id']){logger[_0x961f('0xb')](_0x961f('0x1d'));logger[_0x961f('0xb')](_0x961f('0x47'),_0x409720['id']);logger[_0x961f('0xb')]('[OUTBOUND]',_0x961f('0x48'));emit(util['format'](_0x961f('0x49'),_0x51cee3[_0x961f('0x13')]),_0x961f('0x4a'),{'uri':util[_0x961f('0xd')](_0x961f('0x4b'),_0x3eb052[_0x961f('0x1a')],_0x409720['id'])});}})[_0x961f('0x4c')](function(_0x52aef7){logger['error']('[OUTBOUND]',JSON[_0x961f('0x4e')](_0x52aef7));});};exports[_0x961f('0x54')]=function(_0x5ae361,_0x3087c0,_0x1aba4e,_0x349344,_0x44f128,_0x3dbdd0){var _0x311a66,_0x283092;_0x3dbdd0[_0x961f('0x1a')]=intUtil['stripTrailingSlash'](_0x3dbdd0[_0x961f('0x1a')]);_0x3dbdd0[_0x961f('0x3f')]=intUtil[_0x961f('0x4f')](_0x3dbdd0[_0x961f('0x3f')]);if(_0x44f128&&_0x44f128[_0x961f('0x40')]){logger['info']('['+_0x3087c0[_0x961f('0x55')][_0x961f('0x56')]()+']','Recording\x20is\x20enabled!');_0x3087c0[_0x961f('0x42')]=util[_0x961f('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3dbdd0[_0x961f('0x3f')],_0x3087c0[_0x961f('0x44')],md5(_0x3087c0[_0x961f('0x44')]));}else{_0x3087c0[_0x961f('0x42')]='';}headers[_0x961f('0x45')]=getAuth(_0x3dbdd0);return getUser(_0x3dbdd0,'')[_0x961f('0x1c')](function(_0x5598c6){_0x311a66=_0x5598c6;logger[_0x961f('0xb')](_0x961f('0x52'),_0x311a66['id']);return getEndUser(_0x3dbdd0,_0x3087c0[_0x961f('0xe')],_0x3087c0[_0x961f('0xf')]);})[_0x961f('0x1c')](function(_0x4fc697){_0x283092=_0x4fc697;logger[_0x961f('0xb')](_0x961f('0x46'),_0x283092['id']);return getTicket(_0x3dbdd0,_0x311a66,_0x283092,_0x1aba4e,_0x3087c0);})[_0x961f('0x1c')](function(_0x26ef6f){if(_0x26ef6f){logger[_0x961f('0xb')](_0x961f('0x1d'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x26ef6f['id']);}})[_0x961f('0x4c')](function(_0x20e327){logger[_0x961f('0x4d')]('['+_0x3087c0[_0x961f('0x55')]['toUpperCase']()+']',JSON[_0x961f('0x4e')](_0x20e327));});}; \ No newline at end of file +var _0x02cf=['value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','format','%s/api/v2/agents','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','defaults','GET','forEach','includes','string','picklist','type','nameField','customField','content','push','variable','variableName','idField','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','unmanaged','lastevent','toUpperCase','lodash','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','Subjects','getString','Descriptions','Tags','name','Fields','custom_fields','mapValues'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x02cf,0x16a));var _0xf02c=function(_0x3f98d8,_0x1a5355){_0x3f98d8=_0x3f98d8-0x0;var _0x10e3ef=_0x02cf[_0x3f98d8];return _0x10e3ef;};'use strict';var _=require(_0xf02c('0x0'));var rp=require('request-promise');var md5=require(_0xf02c('0x1'));var util=require(_0xf02c('0x2'));var Redis=require('ioredis');var intUtil=require(_0xf02c('0x3'));var config=require(_0xf02c('0x4'));var logger=require(_0xf02c('0x5'))(_0xf02c('0x6'));config[_0xf02c('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf02c('0x8'))(new Redis(config[_0xf02c('0x7')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x3464f8,_0x3c7ea4,_0xe9e8c8){io['to'](_0x3464f8)[_0xf02c('0x9')](_0x3c7ea4,_0xe9e8c8);}function getTicket(_0x484375,_0x1ad95d,_0x26bcec,_0x550960,_0x405b6f){logger[_0xf02c('0xa')](_0xf02c('0xb'));var _0x9d33c7=_[_0xf02c('0xc')]({'responder_id':_0x1ad95d['id'],'requester_id':_0x26bcec['id'],'name':util['format'](_0xf02c('0xd'),_0x405b6f['calleridname']),'phone':_0x405b6f['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x550960[_0xf02c('0xe')],_0x405b6f,'\x20'),'description':intUtil[_0xf02c('0xf')](_0x550960[_0xf02c('0x10')],_0x405b6f,'
'),'tags':getTags(_0x550960[_0xf02c('0x11')],_0xf02c('0x12'))},getCustomFields(_0x550960[_0xf02c('0x13')],_0x405b6f));_0x9d33c7[_0xf02c('0x14')]=_[_0xf02c('0x15')](_['keyBy'](_0x9d33c7[_0xf02c('0x14')],'id'),_0xf02c('0x16'));return request({'uri':util['format'](_0xf02c('0x17'),_0x484375[_0xf02c('0x18')]),'method':_0xf02c('0x19'),'body':_0x9d33c7})[_0xf02c('0x1a')](function(_0x3cfb70){logger[_0xf02c('0xa')](_0xf02c('0x1b'));return _0x3cfb70;});}function getUser(_0x568a45,_0x1bddb8){if(intUtil[_0xf02c('0x1c')](_0x1bddb8)){return request({'uri':util[_0xf02c('0x1d')](_0xf02c('0x1e'),_0x568a45[_0xf02c('0x18')]),'qs':{'email':_0x1bddb8}})['then'](function(_0x3383f6){if(_0x3383f6[_0xf02c('0x1f')]){logger[_0xf02c('0xa')]('Agent\x20found!');return _[_0xf02c('0x20')](_0x3383f6,function(_0x135f94){return _0x135f94[_0xf02c('0x21')][_0xf02c('0x22')]===_0x1bddb8;});}else{logger[_0xf02c('0xa')](_0xf02c('0x23'));return request({'uri':util[_0xf02c('0x1d')](_0xf02c('0x24'),_0x568a45[_0xf02c('0x18')])})['then'](function(_0x3d8aa0){logger[_0xf02c('0xa')](_0xf02c('0x25'));return _0x3d8aa0;});}});}else{logger[_0xf02c('0xa')](_0xf02c('0x26'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x568a45[_0xf02c('0x18')])})[_0xf02c('0x1a')](function(_0x5182c9){logger[_0xf02c('0xa')]('Admin\x20account\x20selected.');return _0x5182c9;});}}function getEndUser(_0x161745,_0x2a22b9,_0x18a8a5){logger['info'](_0xf02c('0x27'),_0x18a8a5);return request({'uri':util[_0xf02c('0x1d')]('%s/api/v2/contacts',_0x161745[_0xf02c('0x18')]),'qs':{'phone':_0x18a8a5}})['then'](function(_0x1784b4){if(_0x1784b4['length']){logger['info'](_0xf02c('0x28'));return _[_0xf02c('0x20')](_0x1784b4,{'phone':_0x18a8a5});}else{logger['info'](_0xf02c('0x29'));return request({'uri':util[_0xf02c('0x1d')](_0xf02c('0x2a'),_0x161745[_0xf02c('0x18')]),'method':_0xf02c('0x19'),'body':{'name':_0x2a22b9,'phone':_0x18a8a5}})[_0xf02c('0x1a')](function(_0x3b1529){logger[_0xf02c('0xa')](_0xf02c('0x2b'));return _0x3b1529;});}});}function getAuth(_0x3893f5){return util[_0xf02c('0x1d')]('Basic\x20%s',new Buffer(_0x3893f5[_0xf02c('0x2c')]+':X')[_0xf02c('0x2d')](_0xf02c('0x2e')));}function request(_0x80503f){logger[_0xf02c('0x2f')](_0xf02c('0x30'),JSON['stringify'](_0x80503f));return rp(_[_0xf02c('0x31')](_0x80503f,{'method':_0xf02c('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x418f2d,_0x5768e5){var _0x2ce5a8=[];if(_0x418f2d&&_0x418f2d[_0xf02c('0x1f')]>0x0){_0x2ce5a8=_['map'](_0x418f2d,_0x5768e5);}return _0x2ce5a8;}function getCustomFields(_0x41bf39,_0x2e6a05){var _0x3a8c66=[];var _0x52db27={'custom_fields':[]};if(_0x41bf39[_0xf02c('0x1f')]>0x0){_[_0xf02c('0x33')](_0x41bf39,function(_0x3de0e0){if(_[_0xf02c('0x34')]([_0xf02c('0x35'),_0xf02c('0x36')],_0x3de0e0[_0xf02c('0x37')])&&_0x3de0e0[_0xf02c('0x38')]&&!_0x3de0e0[_0xf02c('0x39')]){_0x52db27[_0x3de0e0['nameField']['toLowerCase']()]=_0x3de0e0[_0xf02c('0x3a')]['toString']();}else if(_[_0xf02c('0x34')](['string',_0xf02c('0x36')],_0x3de0e0[_0xf02c('0x37')])&&_0x3de0e0['idField']&&_0x3de0e0[_0xf02c('0x39')]){_0x52db27['custom_fields'][_0xf02c('0x3b')]({'id':_0x3de0e0['idField'],'value':_0x3de0e0[_0xf02c('0x3a')][_0xf02c('0x2d')]()});}else if(_0x3de0e0[_0xf02c('0x37')]===_0xf02c('0x3c')&&_0x3de0e0[_0xf02c('0x3d')]&&_0x3de0e0[_0xf02c('0x3e')]&&_0x3de0e0[_0xf02c('0x39')]){_0x2e6a05[_0x3de0e0[_0xf02c('0x3d')]]&&_0x52db27[_0xf02c('0x14')][_0xf02c('0x3b')]({'id':_0x3de0e0['idField'],'value':_0x2e6a05[_0x3de0e0[_0xf02c('0x3d')]][_0xf02c('0x2d')]()});}else if(_0x3de0e0[_0xf02c('0x37')]===_0xf02c('0x3f')&&_0x3de0e0[_0xf02c('0x40')]&&_0x3de0e0[_0xf02c('0x40')][_0xf02c('0x12')]&&_0x3de0e0[_0xf02c('0x3e')]&&_0x3de0e0[_0xf02c('0x39')]){_0x2e6a05[_0x3de0e0['Variable'][_0xf02c('0x12')][_0xf02c('0x41')]()]&&_0x52db27[_0xf02c('0x14')][_0xf02c('0x3b')]({'id':_0x3de0e0[_0xf02c('0x3e')],'value':_0x2e6a05[_0x3de0e0[_0xf02c('0x40')]['name'][_0xf02c('0x41')]()][_0xf02c('0x2d')]()});}});}return _0x52db27;}exports[_0xf02c('0x42')]=function(_0x1dab8e,_0x41ffe9,_0x50a777,_0x39e804,_0x5bb3a0,_0x4c4513){var _0x88263b,_0x444982;_0x4c4513[_0xf02c('0x18')]=intUtil[_0xf02c('0x43')](_0x4c4513['remoteUri']);_0x4c4513['serverUrl']=intUtil[_0xf02c('0x43')](_0x4c4513[_0xf02c('0x44')]);if(_0x5bb3a0&&_0x5bb3a0[_0xf02c('0x45')]){logger[_0xf02c('0xa')](_0xf02c('0x46'),'Recording\x20is\x20enabled!');_0x41ffe9[_0xf02c('0x47')]=util[_0xf02c('0x1d')](_0xf02c('0x48'),_0x4c4513['serverUrl'],_0x41ffe9[_0xf02c('0x49')],md5(_0x41ffe9[_0xf02c('0x49')]));}else{_0x41ffe9[_0xf02c('0x47')]='';}headers[_0xf02c('0x4a')]=getAuth(_0x4c4513);return getUser(_0x4c4513,_0x39e804[_0xf02c('0x22')])[_0xf02c('0x1a')](function(_0x225fd4){_0x88263b=_0x225fd4;logger[_0xf02c('0xa')](_0xf02c('0x4b'),_0x88263b['id']);return getEndUser(_0x4c4513,_0x41ffe9[_0xf02c('0x4c')],_0x41ffe9[_0xf02c('0x4d')]);})[_0xf02c('0x1a')](function(_0xb27134){_0x444982=_0xb27134;logger[_0xf02c('0xa')](_0xf02c('0x4e'),_0x444982['id']);return getTicket(_0x4c4513,_0x88263b,_0x444982,_0x50a777,_0x41ffe9);})['then'](function(_0x2ca386){if(_0x2ca386&&_0x2ca386['id']){logger[_0xf02c('0xa')](_0xf02c('0x1b'));logger[_0xf02c('0xa')](_0xf02c('0x4f'),_0x2ca386['id']);logger[_0xf02c('0xa')](_0xf02c('0x46'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xf02c('0x50'),_0x39e804[_0xf02c('0x12')]),_0xf02c('0x51'),{'uri':util[_0xf02c('0x1d')]('%s/helpdesk/tickets/%d',_0x4c4513[_0xf02c('0x18')],_0x2ca386['id'])});}})[_0xf02c('0x52')](function(_0x67acf2){logger[_0xf02c('0x53')](_0xf02c('0x46'),JSON[_0xf02c('0x54')](_0x67acf2));});};exports[_0xf02c('0x55')]=function(_0x571121,_0x5963a6,_0x4636a9,_0x4c0f42,_0x24d05c,_0x267c3e,_0x2bb10f){var _0x1bca4c,_0x3cb3ed;_0x267c3e['remoteUri']=intUtil[_0xf02c('0x43')](_0x267c3e[_0xf02c('0x18')]);_0x267c3e[_0xf02c('0x44')]=intUtil[_0xf02c('0x43')](_0x267c3e['serverUrl']);if(_0x2bb10f&&_0x2bb10f[_0xf02c('0x56')]&&_0x2bb10f[_0xf02c('0x56')]!==_0xf02c('0x57')){logger[_0xf02c('0xa')](_0xf02c('0x58'),_0xf02c('0x59'));_0x5963a6[_0xf02c('0x47')]=util[_0xf02c('0x1d')](_0xf02c('0x48'),_0x267c3e['serverUrl'],_0x5963a6[_0xf02c('0x49')],md5(_0x5963a6[_0xf02c('0x49')]));}headers[_0xf02c('0x4a')]=getAuth(_0x267c3e);return getUser(_0x267c3e,_0x4c0f42[_0xf02c('0x22')])[_0xf02c('0x1a')](function(_0x346f62){_0x1bca4c=_0x346f62;logger[_0xf02c('0xa')]('The\x20User\x20ID\x20is:',_0x1bca4c['id']);return getEndUser(_0x267c3e,_0x5963a6['destcalleridname'],_0x5963a6[_0xf02c('0x5a')]);})[_0xf02c('0x1a')](function(_0x585e2a){_0x3cb3ed=_0x585e2a;logger[_0xf02c('0xa')](_0xf02c('0x4e'),_0x3cb3ed['id']);return getTicket(_0x267c3e,_0x1bca4c,_0x3cb3ed,_0x4636a9,_0x5963a6);})['then'](function(_0x5595f8){if(_0x5595f8&&_0x5595f8['id']){logger[_0xf02c('0xa')](_0xf02c('0x1b'));logger[_0xf02c('0xa')](_0xf02c('0x4f'),_0x5595f8['id']);logger[_0xf02c('0xa')](_0xf02c('0x58'),_0xf02c('0x5b'));emit(util[_0xf02c('0x1d')](_0xf02c('0x50'),_0x4c0f42[_0xf02c('0x12')]),_0xf02c('0x51'),{'uri':util[_0xf02c('0x1d')](_0xf02c('0x5c'),_0x267c3e[_0xf02c('0x18')],_0x5595f8['id'])});}})['catch'](function(_0x1b6765){logger[_0xf02c('0x53')](_0xf02c('0x58'),JSON[_0xf02c('0x54')](_0x1b6765));});};exports[_0xf02c('0x5d')]=function(_0x1fa010,_0x44ca41,_0x17962a,_0x567849,_0x375d8e,_0x149177){var _0x5adb9c,_0x2ac53f;_0x149177[_0xf02c('0x18')]=intUtil[_0xf02c('0x43')](_0x149177[_0xf02c('0x18')]);_0x149177[_0xf02c('0x44')]=intUtil[_0xf02c('0x43')](_0x149177[_0xf02c('0x44')]);if(_0x375d8e&&_0x375d8e[_0xf02c('0x45')]){logger[_0xf02c('0xa')]('['+_0x44ca41[_0xf02c('0x5e')]['toUpperCase']()+']',_0xf02c('0x59'));_0x44ca41[_0xf02c('0x47')]=util[_0xf02c('0x1d')](_0xf02c('0x48'),_0x149177[_0xf02c('0x44')],_0x44ca41[_0xf02c('0x49')],md5(_0x44ca41[_0xf02c('0x49')]));}else{_0x44ca41[_0xf02c('0x47')]='';}headers[_0xf02c('0x4a')]=getAuth(_0x149177);return getUser(_0x149177,'')['then'](function(_0x47038a){_0x5adb9c=_0x47038a;logger['info']('The\x20User\x20ID\x20is:',_0x5adb9c['id']);return getEndUser(_0x149177,_0x44ca41[_0xf02c('0x4c')],_0x44ca41[_0xf02c('0x4d')]);})[_0xf02c('0x1a')](function(_0x3731a2){_0x2ac53f=_0x3731a2;logger[_0xf02c('0xa')](_0xf02c('0x4e'),_0x2ac53f['id']);return getTicket(_0x149177,_0x5adb9c,_0x2ac53f,_0x17962a,_0x44ca41);})[_0xf02c('0x1a')](function(_0x3fdf19){if(_0x3fdf19){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x3fdf19['id']);}})[_0xf02c('0x52')](function(_0x583e71){logger['error']('['+_0x44ca41[_0xf02c('0x5e')][_0xf02c('0x5f')]()+']',JSON[_0xf02c('0x54')](_0x583e71));});}; \ 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 870c43f..42212b2 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 _0xb099=['remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','lodash','util','moment','bluebird','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','Admin\x20found:','catch','message','/api/selector/owners','users','Getting\x20user\x20with\x20email','userEmail','agentEmail','userId','User\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','add','ticketId','/contacts/','user:%s','emit','Token\x20token=','apiKey'];(function(_0x5c78d4,_0x48a719){var _0x39ef49=function(_0x459e2a){while(--_0x459e2a){_0x5c78d4['push'](_0x5c78d4['shift']());}};_0x39ef49(++_0x48a719);}(_0xb099,0x166));var _0x9b09=function(_0x38b1ea,_0x287c70){_0x38b1ea=_0x38b1ea-0x0;var _0x212a2a=_0xb099[_0x38b1ea];return _0x212a2a;};'use strict';var _=require(_0x9b09('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x9b09('0x1'));var moment=require(_0x9b09('0x2'));var Promise=require(_0x9b09('0x3'));var Redis=require(_0x9b09('0x4'));var intUtil=require('./util');var config=require(_0x9b09('0x5'));var logger=require('../../../../config/logger')('freshsales');config[_0x9b09('0x6')]=_[_0x9b09('0x7')](config['redis'],{'host':_0x9b09('0x8'),'port':0x18eb});var io=require(_0x9b09('0x9'))(new Redis(config[_0x9b09('0x6')]));function getAdminId(_0x2ba3ca,_0x23a25a,_0x3f76df,_0x3442c2){return new Promise(function(_0x51c020,_0x332e96){var _0x7ebe01=![];var _0x20e8c5={'method':_0x9b09('0xa'),'uri':_0x3442c2+'/api/selector/owners','json':!![]};_0x20e8c5[_0x9b09('0xb')]=_0x3f76df;logger[_0x9b09('0xc')](_0x9b09('0xd'));return rp(_0x20e8c5)[_0x9b09('0xe')](function(_0x4f6fc5){if(_0x4f6fc5){var _0x100410=_0x4f6fc5['users'];var _0x5e26cb=null;for(_0x5e26cb=0x0;_0x5e26cb<_0x100410[_0x9b09('0xf')];_0x5e26cb++){if(_0x100410[_0x5e26cb][_0x9b09('0x10')]===_0x2ba3ca[_0x9b09('0x11')]){_0x2ba3ca[_0x9b09('0x12')]=_0x100410[_0x5e26cb]['id'];_0x7ebe01=!![];}}if(_0x7ebe01){logger['info'](_0x9b09('0x13'),_0x2ba3ca['adminId']);_0x51c020(_0x2ba3ca);}else{_0x332e96({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x332e96({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x9b09('0x14')](function(_0x57f449){logger['error']('['+[_0x23a25a['toUpperCase']()]+']',_0x57f449[_0x9b09('0x15')]);_0x332e96(_0x57f449);});});}function getUser(_0x5bc468,_0x62e220,_0x150aa2){return function(_0x5355a4){return new Promise(function(_0x202806,_0x15fd85){var _0x21ea0d={'method':_0x9b09('0xa'),'uri':_0x150aa2+_0x9b09('0x16'),'json':!![]};_0x21ea0d[_0x9b09('0xb')]=_0x62e220;logger['info']('Getting\x20user\x20list');return rp(_0x21ea0d)[_0x9b09('0xe')](function(_0x5cf860){if(_0x5cf860){var _0x49ebbe=_0x5cf860[_0x9b09('0x17')];var _0x128f36=![];var _0x4f85ec=null;if(_0x5355a4['agentEmail']!==null){logger[_0x9b09('0xc')](_0x9b09('0x18'),_0x5355a4['agentEmail']);_0x5355a4[_0x9b09('0x19')]=_0x5355a4['agentEmail'];for(_0x4f85ec=0x0;_0x4f85ec<_0x49ebbe['length'];_0x4f85ec++){if(_0x49ebbe[_0x4f85ec][_0x9b09('0x10')]===_0x5355a4[_0x9b09('0x1a')]){_0x128f36=!![];_0x5355a4[_0x9b09('0x1b')]=_0x49ebbe[_0x4f85ec]['id'];logger['info'](_0x9b09('0x1c'),_0x5355a4[_0x9b09('0x1b')]);}}}if(!_0x128f36){logger[_0x9b09('0xc')]('Admin\x20selected');_0x5355a4[_0x9b09('0x19')]=_0x5355a4[_0x9b09('0x11')];_0x5355a4[_0x9b09('0x1b')]=_0x5355a4[_0x9b09('0x12')];_0x128f36=!![];}if(_0x128f36){_0x202806(_0x5355a4);}else{_0x15fd85({'statusCode':0x194,'message':_0x9b09('0x1d')});}}else{_0x15fd85({'statusCode':0x194,'message':_0x9b09('0x1d')});}})[_0x9b09('0x14')](function(_0x4bec2e){logger[_0x9b09('0x1e')]('['+[_0x5bc468[_0x9b09('0x1f')]()]+']',_0x4bec2e[_0x9b09('0x15')]);_0x15fd85(_0x4bec2e);});});};}function searchContact(_0x346f04,_0x363687,_0x261555,_0x55f26f){return new Promise(function(_0x3e9f97,_0x381e87){var _0x462887={'method':_0x9b09('0xa'),'headers':_0x363687,'uri':_0x346f04+_0x9b09('0x20')+_0x55f26f+_0x9b09('0x21')+_0x261555+_0x9b09('0x22'),'json':!![]};rp(_0x462887)[_0x9b09('0xe')](function(_0x3316a8){var _0x530bb1=_[_0x9b09('0x23')](_0x3316a8[_0x9b09('0x24')][_0x9b09('0x24')],[_0x261555,_0x55f26f]);_0x3e9f97(_0x530bb1);})[_0x9b09('0x14')](function(_0x16fb6a){_0x381e87(_0x16fb6a);});});}function getEndUser(_0x557db0,_0x5f32c5,_0xafd28b){return function(_0x37aa50){return new Promise(function(_0x202a24,_0x4541e1){logger[_0x9b09('0xc')](util['format'](_0x9b09('0x25'),_0x37aa50[_0x9b09('0x26')]));searchContact(_0xafd28b,_0x5f32c5,_0x9b09('0x27'),_0x37aa50[_0x9b09('0x26')])['then'](function(_0xb4a9e9){if(_0xb4a9e9){_0x37aa50[_0x9b09('0x28')]=_0xb4a9e9['id'];logger[_0x9b09('0xc')](_0x9b09('0x29'),_0x37aa50['endUserId']);return _0x202a24(_0x37aa50);}searchContact(_0xafd28b,_0x5f32c5,_0x9b09('0x2a'),_0x37aa50['contactNumber'])['then'](function(_0x536312){if(_0x536312){_0x37aa50[_0x9b09('0x28')]=_0x536312['id'];logger['info'](_0x9b09('0x2b'),_0x37aa50[_0x9b09('0x28')]);return _0x202a24(_0x37aa50);}createEndUser(_0x37aa50,_0x557db0,_0x5f32c5,_0xafd28b)[_0x9b09('0xe')](function(_0x4545ad){logger[_0x9b09('0xc')](_0x9b09('0x2c'),_0x4545ad[_0x9b09('0x28')]);return _0x202a24(_0x4545ad);});});})[_0x9b09('0x14')](function(_0x319586){_0x4541e1(_0x319586);});});};}function createEndUser(_0x101796,_0x6b61bb,_0x244058,_0x5f176a){return new Promise(function(_0x459074,_0x3b5791){var _0x70640d=moment();var _0x1f5812={'method':_0x9b09('0x2d'),'uri':_0x5f176a+_0x9b09('0x2e'),'body':{'contact':{'last_name':_0x101796['contactNumber'],'work_number':_0x101796[_0x9b09('0x26')],'mobile_number':_0x101796[_0x9b09('0x26')],'owner_id':_0x101796[_0x9b09('0x1b')],'created_at':_0x70640d[_0x9b09('0x2f')](_0x9b09('0x30'))}},'json':!![]};_0x1f5812[_0x9b09('0xb')]=_0x244058;logger['info'](_0x9b09('0x31'));return rp(_0x1f5812)['then'](function(_0x46d9b8){_0x101796[_0x9b09('0x28')]=_0x46d9b8[_0x9b09('0x32')]['id'];_0x459074(_0x101796);})[_0x9b09('0x14')](function(_0x24bdc0){logger[_0x9b09('0x1e')]('['+[_0x6b61bb[_0x9b09('0x1f')]()]+']',_0x24bdc0[_0x9b09('0x15')]);_0x3b5791(_0x24bdc0[_0x9b09('0x15')]);});});}function getTicket(_0x250166,_0x5877c3,_0x42e329,_0x555a8d,_0x2e2118){return function(_0xa1d568){logger[_0x9b09('0xc')](_0x9b09('0x33'));return new Promise(function(_0x5090a1,_0x264f64){var _0x38edb5=moment();var _0x5c1e8b={'method':_0x9b09('0x2d'),'uri':_0x42e329+_0x9b09('0x34'),'body':{'title':intUtil[_0x9b09('0x35')](_0x555a8d[_0x9b09('0x36')],_0x2e2118,'\x20'),'description':intUtil[_0x9b09('0x35')](_0x555a8d['Descriptions'],_0x2e2118,'\x0a'),'owner_id':_0xa1d568[_0x9b09('0x1b')],'creater_id':_0xa1d568[_0x9b09('0x12')],'targetable_id':_0xa1d568[_0x9b09('0x28')],'targetable_type':'Contact','created_at':_0x38edb5['format'](_0x9b09('0x30')),'due_date':_0x38edb5[_0x9b09('0x37')](0x1e,'m')[_0x9b09('0x2f')](_0x9b09('0x30'))},'json':!![]};_0x5c1e8b[_0x9b09('0xb')]=_0x5877c3;return rp(_0x5c1e8b)[_0x9b09('0xe')](function(_0x110907){_0xa1d568[_0x9b09('0x38')]=_0x110907['task']['id'];logger[_0x9b09('0xc')]('Task\x20created:',_0xa1d568['ticketId']);_0x5090a1(_0xa1d568);})[_0x9b09('0x14')](function(_0xff122e){logger[_0x9b09('0x1e')]('['+[_0x250166[_0x9b09('0x1f')]()]+']',_0xff122e['message']);_0x264f64(_0xff122e[_0x9b09('0x15')]);});});};}function emit(_0xa3ed64,_0xc860f2,_0x19e06d){var _0x54f4f3={'uri':_0xa3ed64+_0x9b09('0x39')+_0x19e06d};io['to'](util[_0x9b09('0x2f')](_0x9b09('0x3a'),_0xc860f2))[_0x9b09('0x3b')]('trigger:browser:url',_0x54f4f3);}exports['cs']=function(_0x317e2c,_0x2f7b96,_0xcbd9f7,_0x26c382,_0x324deb,_0x22c1b0,_0x5a31e8,_0x2437e0){var _0x542eef={};var _0x4993bc={'Authorization':_0x9b09('0x3c')+_0x22c1b0[_0x9b09('0x3d')]};_0x22c1b0[_0x9b09('0x3e')]=intUtil[_0x9b09('0x3f')](_0x22c1b0[_0x9b09('0x3e')]);_0x22c1b0[_0x9b09('0x40')]=intUtil[_0x9b09('0x3f')](_0x22c1b0['serverUrl']);var _0x43bbbe=_0x22c1b0['remoteUri'];_0x542eef[_0x9b09('0x11')]=_0x22c1b0[_0x9b09('0x41')];_0x542eef[_0x9b09('0x26')]=_0x2437e0[_0x9b09('0x42')]()===_0x9b09('0x43')?_0x2f7b96[_0x9b09('0x44')]:_0x2f7b96[_0x9b09('0x45')];_0x542eef[_0x9b09('0x46')]=_0x2437e0==='queue'||_0x2437e0==='unmanaged'?_0x9b09('0x47'):_0x9b09('0x43');if(_0x26c382){_0x542eef['agentEmail']=_0x26c382[_0x9b09('0x10')];}var _0x388d19=util[_0x9b09('0x2f')](_0x9b09('0x48'),_0x22c1b0[_0x9b09('0x40')],_0x2f7b96['uniqueid'],md5(_0x2f7b96[_0x9b09('0x49')]));if(_0x324deb&&_0x324deb[_0x9b09('0x4a')]){logger[_0x9b09('0xc')](_0x9b09('0x4b'),_0x9b09('0x4c'));_0x2f7b96['recordingURL']=_0x388d19;}else if(_0x5a31e8&&_0x5a31e8[_0x9b09('0x4d')]&&_0x5a31e8[_0x9b09('0x4d')]!==_0x9b09('0x4e')){logger[_0x9b09('0xc')](_0x9b09('0x4f'),_0x9b09('0x4c'));_0x2f7b96[_0x9b09('0x50')]=_0x388d19;}else{_0x2f7b96[_0x9b09('0x50')]='';}return getAdminId(_0x542eef,_0x2437e0,_0x4993bc,_0x43bbbe)[_0x9b09('0xe')](getUser(_0x2437e0,_0x4993bc,_0x43bbbe))[_0x9b09('0xe')](getEndUser(_0x2437e0,_0x4993bc,_0x43bbbe))[_0x9b09('0xe')](getTicket(_0x2437e0,_0x4993bc,_0x43bbbe,_0xcbd9f7,_0x2f7b96))[_0x9b09('0xe')](function(_0x4bff01){logger[_0x9b09('0xc')](util[_0x9b09('0x2f')](_0x9b09('0x51'),_0x4bff01[_0x9b09('0x38')]));if(_0x2437e0!=='unmanaged'){logger['info']('['+[_0x2437e0[_0x9b09('0x1f')]()]+']',_0x9b09('0x52'));emit(_0x43bbbe,_0x26c382[_0x9b09('0x53')],_0x4bff01[_0x9b09('0x28')]);}})[_0x9b09('0x14')](function(_0x2de786){logger[_0x9b09('0x1e')]('['+[_0x2437e0[_0x9b09('0x1f')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x2de786,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9cd1=['queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','util','bluebird','../../../../config/environment','freshsales','defaults','redis','/api/selector/owners','headers','Getting\x20admin\x20information','then','email','adminEmail','adminId','info','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','GET','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','catch','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','user:%s','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection'];(function(_0x464948,_0x49299a){var _0x4b9898=function(_0x296b3b){while(--_0x296b3b){_0x464948['push'](_0x464948['shift']());}};_0x4b9898(++_0x49299a);}(_0x9cd1,0x1e3));var _0x19cd=function(_0x2056b6,_0x20d4f8){_0x2056b6=_0x2056b6-0x0;var _0x3bcff2=_0x9cd1[_0x2056b6];return _0x3bcff2;};'use strict';var _=require('lodash');var rp=require(_0x19cd('0x0'));var md5=require('md5');var util=require(_0x19cd('0x1'));var moment=require('moment');var Promise=require(_0x19cd('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x19cd('0x3'));var logger=require('../../../../config/logger')(_0x19cd('0x4'));config['redis']=_[_0x19cd('0x5')](config[_0x19cd('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x19cd('0x6')]));function getAdminId(_0x1e1fe2,_0x291a61,_0x118edd,_0x1a22eb){return new Promise(function(_0x241b93,_0xfeb3fa){var _0x39866=![];var _0x4bc5a5={'method':'GET','uri':_0x1a22eb+_0x19cd('0x7'),'json':!![]};_0x4bc5a5[_0x19cd('0x8')]=_0x118edd;logger['info'](_0x19cd('0x9'));return rp(_0x4bc5a5)[_0x19cd('0xa')](function(_0x448ad5){if(_0x448ad5){var _0x38e11b=_0x448ad5['users'];var _0x53b5f6=null;for(_0x53b5f6=0x0;_0x53b5f6<_0x38e11b['length'];_0x53b5f6++){if(_0x38e11b[_0x53b5f6][_0x19cd('0xb')]===_0x1e1fe2[_0x19cd('0xc')]){_0x1e1fe2[_0x19cd('0xd')]=_0x38e11b[_0x53b5f6]['id'];_0x39866=!![];}}if(_0x39866){logger[_0x19cd('0xe')]('Admin\x20found:',_0x1e1fe2[_0x19cd('0xd')]);_0x241b93(_0x1e1fe2);}else{_0xfeb3fa({'statusCode':0x194,'message':_0x19cd('0xf')});}}else{_0xfeb3fa({'statusCode':0x194,'message':_0x19cd('0xf')});}})['catch'](function(_0x452386){logger[_0x19cd('0x10')]('['+[_0x291a61[_0x19cd('0x11')]()]+']',_0x452386[_0x19cd('0x12')]);_0xfeb3fa(_0x452386);});});}function getUser(_0x504f51,_0x5a615c,_0x5d510e){return function(_0x5e599){return new Promise(function(_0x12c4c3,_0xd95fa1){var _0x3253e0={'method':_0x19cd('0x13'),'uri':_0x5d510e+_0x19cd('0x7'),'json':!![]};_0x3253e0['headers']=_0x5a615c;logger[_0x19cd('0xe')](_0x19cd('0x14'));return rp(_0x3253e0)[_0x19cd('0xa')](function(_0x467a90){if(_0x467a90){var _0x29092d=_0x467a90[_0x19cd('0x15')];var _0x47d71f=![];var _0x582a9e=null;if(_0x5e599[_0x19cd('0x16')]!==null){logger[_0x19cd('0xe')](_0x19cd('0x17'),_0x5e599[_0x19cd('0x16')]);_0x5e599[_0x19cd('0x18')]=_0x5e599[_0x19cd('0x16')];for(_0x582a9e=0x0;_0x582a9e<_0x29092d[_0x19cd('0x19')];_0x582a9e++){if(_0x29092d[_0x582a9e][_0x19cd('0xb')]===_0x5e599[_0x19cd('0x16')]){_0x47d71f=!![];_0x5e599['userId']=_0x29092d[_0x582a9e]['id'];logger['info']('User\x20found:',_0x5e599[_0x19cd('0x1a')]);}}}if(!_0x47d71f){logger[_0x19cd('0xe')]('Admin\x20selected');_0x5e599[_0x19cd('0x18')]=_0x5e599[_0x19cd('0xc')];_0x5e599[_0x19cd('0x1a')]=_0x5e599[_0x19cd('0xd')];_0x47d71f=!![];}if(_0x47d71f){_0x12c4c3(_0x5e599);}else{_0xd95fa1({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xd95fa1({'statusCode':0x194,'message':_0x19cd('0xf')});}})[_0x19cd('0x1b')](function(_0x627bce){logger[_0x19cd('0x10')]('['+[_0x504f51['toUpperCase']()]+']',_0x627bce[_0x19cd('0x12')]);_0xd95fa1(_0x627bce);});});};}function searchContact(_0x5004fe,_0x56db5d,_0x53c9e9,_0x2b87c3){return new Promise(function(_0x3ec70f,_0x145647){var _0x42981b={'method':'GET','headers':_0x56db5d,'uri':_0x5004fe+'/api/lookup?q='+_0x2b87c3+_0x19cd('0x1c')+_0x53c9e9+_0x19cd('0x1d'),'json':!![]};rp(_0x42981b)['then'](function(_0x3a8690){var _0x573449=_[_0x19cd('0x1e')](_0x3a8690[_0x19cd('0x1f')][_0x19cd('0x1f')],[_0x53c9e9,_0x2b87c3]);_0x3ec70f(_0x573449);})[_0x19cd('0x1b')](function(_0x72f6bd){_0x145647(_0x72f6bd);});});}function getEndUser(_0x2a279a,_0x54e3d7,_0x32c2c1){return function(_0x38e930){return new Promise(function(_0xde73f1,_0x141e3a){logger['info'](util[_0x19cd('0x20')](_0x19cd('0x21'),_0x38e930[_0x19cd('0x22')]));searchContact(_0x32c2c1,_0x54e3d7,_0x19cd('0x23'),_0x38e930[_0x19cd('0x22')])[_0x19cd('0xa')](function(_0x5ac673){if(_0x5ac673){_0x38e930[_0x19cd('0x24')]=_0x5ac673['id'];logger[_0x19cd('0xe')](_0x19cd('0x25'),_0x38e930[_0x19cd('0x24')]);return _0xde73f1(_0x38e930);}searchContact(_0x32c2c1,_0x54e3d7,_0x19cd('0x26'),_0x38e930[_0x19cd('0x22')])[_0x19cd('0xa')](function(_0xb2dc0){if(_0xb2dc0){_0x38e930[_0x19cd('0x24')]=_0xb2dc0['id'];logger[_0x19cd('0xe')](_0x19cd('0x27'),_0x38e930[_0x19cd('0x24')]);return _0xde73f1(_0x38e930);}createEndUser(_0x38e930,_0x2a279a,_0x54e3d7,_0x32c2c1)['then'](function(_0x22bc53){logger[_0x19cd('0xe')](_0x19cd('0x28'),_0x22bc53[_0x19cd('0x24')]);return _0xde73f1(_0x22bc53);});});})['catch'](function(_0x4a38e0){_0x141e3a(_0x4a38e0);});});};}function createEndUser(_0x2793ff,_0x4bf29f,_0x2451e3,_0x4e63f9){return new Promise(function(_0x1273a4,_0x2f069b){var _0x2db67c=moment();var _0x2b3c07={'method':_0x19cd('0x29'),'uri':_0x4e63f9+_0x19cd('0x2a'),'body':{'contact':{'last_name':_0x2793ff['contactNumber'],'work_number':_0x2793ff[_0x19cd('0x22')],'mobile_number':_0x2793ff[_0x19cd('0x22')],'owner_id':_0x2793ff[_0x19cd('0x1a')],'created_at':_0x2db67c[_0x19cd('0x20')](_0x19cd('0x2b'))}},'json':!![]};_0x2b3c07[_0x19cd('0x8')]=_0x2451e3;logger[_0x19cd('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x2b3c07)[_0x19cd('0xa')](function(_0x4fd80f){_0x2793ff['endUserId']=_0x4fd80f['contact']['id'];_0x1273a4(_0x2793ff);})[_0x19cd('0x1b')](function(_0x52d067){logger['error']('['+[_0x4bf29f[_0x19cd('0x11')]()]+']',_0x52d067[_0x19cd('0x12')]);_0x2f069b(_0x52d067[_0x19cd('0x12')]);});});}function getTicket(_0x3c7f15,_0x2b9061,_0x102d3d,_0x13eb65,_0x593676){return function(_0x462013){logger[_0x19cd('0xe')](_0x19cd('0x2c'));return new Promise(function(_0x3fce43,_0x4aebcf){var _0x418310=moment();var _0xbcb68e={'method':_0x19cd('0x29'),'uri':_0x102d3d+'/api/tasks','body':{'title':intUtil[_0x19cd('0x2d')](_0x13eb65[_0x19cd('0x2e')],_0x593676,'\x20'),'description':intUtil['getString'](_0x13eb65[_0x19cd('0x2f')],_0x593676,'\x0a'),'owner_id':_0x462013[_0x19cd('0x1a')],'creater_id':_0x462013[_0x19cd('0xd')],'targetable_id':_0x462013[_0x19cd('0x24')],'targetable_type':'Contact','created_at':_0x418310[_0x19cd('0x20')](_0x19cd('0x2b')),'due_date':_0x418310[_0x19cd('0x30')](0x1e,'m')['format'](_0x19cd('0x2b'))},'json':!![]};_0xbcb68e[_0x19cd('0x8')]=_0x2b9061;return rp(_0xbcb68e)[_0x19cd('0xa')](function(_0x327045){_0x462013[_0x19cd('0x31')]=_0x327045[_0x19cd('0x32')]['id'];logger['info'](_0x19cd('0x33'),_0x462013['ticketId']);_0x3fce43(_0x462013);})[_0x19cd('0x1b')](function(_0x27a3e3){logger[_0x19cd('0x10')]('['+[_0x3c7f15[_0x19cd('0x11')]()]+']',_0x27a3e3[_0x19cd('0x12')]);_0x4aebcf(_0x27a3e3[_0x19cd('0x12')]);});});};}function emit(_0x1aa55f,_0xc06ef0,_0x381251){var _0x5a6fdf={'uri':_0x1aa55f+'/contacts/'+_0x381251};io['to'](util['format'](_0x19cd('0x34'),_0xc06ef0))['emit'](_0x19cd('0x35'),_0x5a6fdf);}exports['cs']=function(_0x22936c,_0x340218,_0x17859d,_0x16454e,_0x1651c3,_0x33ff7c,_0x3ee47b,_0x34f1d8){var _0x375a16={};var _0x577a3c={'Authorization':'Token\x20token='+_0x33ff7c['apiKey']};_0x33ff7c[_0x19cd('0x36')]=intUtil['stripTrailingSlash'](_0x33ff7c[_0x19cd('0x36')]);_0x33ff7c['serverUrl']=intUtil[_0x19cd('0x37')](_0x33ff7c[_0x19cd('0x38')]);var _0x21a37a=_0x33ff7c[_0x19cd('0x36')];_0x375a16['adminEmail']=_0x33ff7c[_0x19cd('0x39')];_0x375a16[_0x19cd('0x22')]=_0x34f1d8[_0x19cd('0x3a')]()===_0x19cd('0x3b')?_0x340218[_0x19cd('0x3c')]:_0x340218[_0x19cd('0x3d')];_0x375a16[_0x19cd('0x3e')]=_0x34f1d8==='queue'||_0x34f1d8==='unmanaged'?_0x19cd('0x3f'):'outbound';if(_0x16454e){_0x375a16[_0x19cd('0x16')]=_0x16454e[_0x19cd('0xb')];}var _0x33d92d=util['format'](_0x19cd('0x40'),_0x33ff7c['serverUrl'],_0x340218['uniqueid'],md5(_0x340218[_0x19cd('0x41')]));if(_0x1651c3&&_0x1651c3[_0x19cd('0x42')]){logger[_0x19cd('0xe')](_0x19cd('0x43'),_0x19cd('0x44'));_0x340218[_0x19cd('0x45')]=_0x33d92d;}else if(_0x3ee47b&&_0x3ee47b['recordingFormat']&&_0x3ee47b[_0x19cd('0x46')]!==_0x19cd('0x47')){logger[_0x19cd('0xe')](_0x19cd('0x48'),_0x19cd('0x44'));_0x340218[_0x19cd('0x45')]=_0x33d92d;}else{_0x340218[_0x19cd('0x45')]='';}return getAdminId(_0x375a16,_0x34f1d8,_0x577a3c,_0x21a37a)['then'](getUser(_0x34f1d8,_0x577a3c,_0x21a37a))['then'](getEndUser(_0x34f1d8,_0x577a3c,_0x21a37a))[_0x19cd('0xa')](getTicket(_0x34f1d8,_0x577a3c,_0x21a37a,_0x17859d,_0x340218))['then'](function(_0x171c2d){logger[_0x19cd('0xe')](util[_0x19cd('0x20')]('The\x20ticket\x20ID\x20is:\x20%s',_0x171c2d['ticketId']));if(_0x34f1d8!==_0x19cd('0x49')){logger[_0x19cd('0xe')]('['+[_0x34f1d8[_0x19cd('0x11')]()]+']',_0x19cd('0x4a'));emit(_0x21a37a,_0x16454e[_0x19cd('0x4b')],_0x171c2d[_0x19cd('0x24')]);}})['catch'](function(_0xfa9751){logger[_0x19cd('0x10')]('['+[_0x34f1d8[_0x19cd('0x11')]()]+_0x19cd('0x4c'),util[_0x19cd('0x4d')](_0xfa9751,{'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 28970ce..95d0ca9 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 _0x4dd2=['[EXEC]','format','data3','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','desk','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','queue','outbound','unmanaged','zoho','vtiger','dynamics365','unknown\x20integration','error'];(function(_0x2d9dae,_0x591a01){var _0x45ef28=function(_0x175b1a){while(--_0x175b1a){_0x2d9dae['push'](_0x2d9dae['shift']());}};_0x45ef28(++_0x591a01);}(_0x4dd2,0x19d));var _0x24dd=function(_0x4990d5,_0xe2c486){_0x4990d5=_0x4990d5-0x0;var _0x275e25=_0x4dd2[_0x4990d5];return _0x275e25;};'use strict';var _=require(_0x24dd('0x0'));var util=require(_0x24dd('0x1'));var zendesk=require(_0x24dd('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x24dd('0x3'));var freshdesk=require(_0x24dd('0x4'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x24dd('0x5'));var dynamics365=require(_0x24dd('0x6'));var freshsales=require(_0x24dd('0x7'));var integrations=[_0x24dd('0x8'),_0x24dd('0x9'),'sugarcrm',_0x24dd('0xa'),'zoho',_0x24dd('0xb'),'vtiger','dynamics365',_0x24dd('0xc'),_0x24dd('0xd')];exports[_0x24dd('0xe')]=function(_0x36801e,_0x5dc1c1,_0x150dbe,_0x214a4f,_0x16287c,_0x1f4220){if(_0x150dbe){if(_[_0x24dd('0xf')](integrations,_0x36801e[_0x24dd('0x10')][_0x24dd('0x11')]())){try{var _0x3e8360=null;var _0x46deb7='';var _0x1cd1b0=_0x150dbe[_0x36801e[_0x24dd('0x10')]['toLowerCase']()];if(_0x1cd1b0){var _0xf00d85=_0x1cd1b0[_0x36801e[_0x24dd('0x12')]];if(_0xf00d85){var _0x5e4289=_[_0x24dd('0x13')](_0xf00d85[_0x24dd('0x14')],{'id':parseInt(_0x36801e['data3'],0xa)});if(_0x5e4289){if(_0x214a4f){if(_0x16287c&&_0x5dc1c1[_0x24dd('0x15')]){_0x46deb7=_0x24dd('0x15');}else if(_0x5dc1c1['routeId']){_0x46deb7=_0x24dd('0x16');}else{console['log']('EVENT\x20UNKNOWN',_0x5dc1c1);}}else{_0x46deb7=_0x24dd('0x17');}switch(_0x36801e['data1'][_0x24dd('0x11')]()){case'zendesk':zendesk[_0x46deb7](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220);break;case _0x24dd('0x9'):salesforce[_0x46deb7](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220);break;case'sugarcrm':sugarcrm[_0x46deb7](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220);break;case'freshdesk':freshdesk[_0x46deb7](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220);break;case _0x24dd('0x18'):zoho[_0x46deb7](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220);break;case'desk':desk[_0x46deb7](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220);break;case _0x24dd('0x19'):vtiger[_0x46deb7](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220);break;case _0x24dd('0xc'):freshsales['cs'](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220,_0x46deb7);break;case'servicenow':servicenow['cs'](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220,_0x46deb7);break;case _0x24dd('0x1a'):dynamics365['cs'](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220,_0x46deb7);break;default:console['log'](_0x24dd('0x1b'));}}else{_0x3e8360=require('../../../../config/logger')(_0x36801e[_0x24dd('0x10')][_0x24dd('0x11')]());_0x3e8360[_0x24dd('0x1c')](_0x24dd('0x1d'),util[_0x24dd('0x1e')]('%s\x20configuration\x20#%s\x20not\x20found',_0x36801e[_0x24dd('0x10')]['toLowerCase'](),_0x36801e[_0x24dd('0x1f')]));}}else{_0x3e8360=require(_0x24dd('0x20'))(_0x36801e[_0x24dd('0x10')][_0x24dd('0x11')]());_0x3e8360['error']('[EXEC]',util[_0x24dd('0x1e')](_0x24dd('0x21'),_0x36801e[_0x24dd('0x10')][_0x24dd('0x11')](),_0x36801e['data2']));}}else{}}catch(_0x4857b4){console[_0x24dd('0x1c')](_0x4857b4);}}}}; \ No newline at end of file +var _0xb9bc=['desk','vtiger','dynamics365','freshsales','servicenow','exec','toLowerCase','data2','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','data1','freshdesk','unknown\x20integration','../../../../config/logger','%s\x20configuration\x20#%s\x20not\x20found','error','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','zoho'];(function(_0x427f69,_0x347e40){var _0x4a4085=function(_0x206721){while(--_0x206721){_0x427f69['push'](_0x427f69['shift']());}};_0x4a4085(++_0x347e40);}(_0xb9bc,0x137));var _0xcb9b=function(_0x318dda,_0x1aa800){_0x318dda=_0x318dda-0x0;var _0x3f97ca=_0xb9bc[_0x318dda];return _0x3f97ca;};'use strict';var _=require(_0xcb9b('0x0'));var util=require(_0xcb9b('0x1'));var zendesk=require(_0xcb9b('0x2'));var salesforce=require(_0xcb9b('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0xcb9b('0x4'));var desk=require(_0xcb9b('0x5'));var vtiger=require(_0xcb9b('0x6'));var servicenow=require(_0xcb9b('0x7'));var dynamics365=require(_0xcb9b('0x8'));var freshsales=require('./freshsales');var integrations=[_0xcb9b('0x9'),_0xcb9b('0xa'),_0xcb9b('0xb'),'freshdesk',_0xcb9b('0xc'),_0xcb9b('0xd'),_0xcb9b('0xe'),_0xcb9b('0xf'),_0xcb9b('0x10'),_0xcb9b('0x11')];exports[_0xcb9b('0x12')]=function(_0x18f41a,_0x2a8389,_0x460880,_0x2966dd,_0x3f8669,_0x5e58c5){if(_0x460880){if(_['includes'](integrations,_0x18f41a['data1'][_0xcb9b('0x13')]())){try{var _0x5976cd=null;var _0x4ab5ad='';var _0x5d3371=_0x460880[_0x18f41a['data1'][_0xcb9b('0x13')]()];if(_0x5d3371){var _0x31111c=_0x5d3371[_0x18f41a[_0xcb9b('0x14')]];if(_0x31111c){var _0x1d44fb=_['find'](_0x31111c[_0xcb9b('0x15')],{'id':parseInt(_0x18f41a[_0xcb9b('0x16')],0xa)});if(_0x1d44fb){if(_0x2966dd){if(_0x3f8669&&_0x2a8389[_0xcb9b('0x17')]){_0x4ab5ad=_0xcb9b('0x17');}else if(_0x2a8389[_0xcb9b('0x18')]){_0x4ab5ad=_0xcb9b('0x19');}else{console[_0xcb9b('0x1a')](_0xcb9b('0x1b'),_0x2a8389);}}else{_0x4ab5ad='unmanaged';}switch(_0x18f41a[_0xcb9b('0x1c')][_0xcb9b('0x13')]()){case'zendesk':zendesk[_0x4ab5ad](_0x18f41a,_0x2a8389,_0x1d44fb,_0x2966dd,_0x3f8669,_0x31111c,_0x5e58c5);break;case'salesforce':salesforce[_0x4ab5ad](_0x18f41a,_0x2a8389,_0x1d44fb,_0x2966dd,_0x3f8669,_0x31111c,_0x5e58c5);break;case'sugarcrm':sugarcrm[_0x4ab5ad](_0x18f41a,_0x2a8389,_0x1d44fb,_0x2966dd,_0x3f8669,_0x31111c,_0x5e58c5);break;case _0xcb9b('0x1d'):freshdesk[_0x4ab5ad](_0x18f41a,_0x2a8389,_0x1d44fb,_0x2966dd,_0x3f8669,_0x31111c,_0x5e58c5);break;case _0xcb9b('0xc'):zoho[_0x4ab5ad](_0x18f41a,_0x2a8389,_0x1d44fb,_0x2966dd,_0x3f8669,_0x31111c,_0x5e58c5);break;case _0xcb9b('0xd'):desk[_0x4ab5ad](_0x18f41a,_0x2a8389,_0x1d44fb,_0x2966dd,_0x3f8669,_0x31111c,_0x5e58c5);break;case _0xcb9b('0xe'):vtiger[_0x4ab5ad](_0x18f41a,_0x2a8389,_0x1d44fb,_0x2966dd,_0x3f8669,_0x31111c,_0x5e58c5);break;case _0xcb9b('0x10'):freshsales['cs'](_0x18f41a,_0x2a8389,_0x1d44fb,_0x2966dd,_0x3f8669,_0x31111c,_0x5e58c5,_0x4ab5ad);break;case _0xcb9b('0x11'):servicenow['cs'](_0x18f41a,_0x2a8389,_0x1d44fb,_0x2966dd,_0x3f8669,_0x31111c,_0x5e58c5,_0x4ab5ad);break;case _0xcb9b('0xf'):dynamics365['cs'](_0x18f41a,_0x2a8389,_0x1d44fb,_0x2966dd,_0x3f8669,_0x31111c,_0x5e58c5,_0x4ab5ad);break;default:console[_0xcb9b('0x1a')](_0xcb9b('0x1e'));}}else{_0x5976cd=require(_0xcb9b('0x1f'))(_0x18f41a[_0xcb9b('0x1c')][_0xcb9b('0x13')]());_0x5976cd['error']('[EXEC]',util['format'](_0xcb9b('0x20'),_0x18f41a[_0xcb9b('0x1c')][_0xcb9b('0x13')](),_0x18f41a['data3']));}}else{_0x5976cd=require('../../../../config/logger')(_0x18f41a[_0xcb9b('0x1c')]['toLowerCase']());_0x5976cd[_0xcb9b('0x21')](_0xcb9b('0x22'),util['format'](_0xcb9b('0x23'),_0x18f41a[_0xcb9b('0x1c')][_0xcb9b('0x13')](),_0x18f41a[_0xcb9b('0x14')]));}}else{}}catch(_0xc72619){console[_0xcb9b('0x21')](_0xc72619);}}}}; \ 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 0c01811..658a923 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 _0xbdc7=['Contact','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','first','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','','format','Caller\x20-\x20%s','LastName','Company','No\x20Company','forEach','includes','string','picklist','idField','toString','variable','variableName','customVariable','Variable','name','password','concat','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','endUserType','WhoId','account','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','execute','then','find','Email','Agent\x20%s\x20found.','resolve','Name','identity','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or'];(function(_0x215a50,_0x1297b7){var _0x4baf0c=function(_0x1b2858){while(--_0x1b2858){_0x215a50['push'](_0x215a50['shift']());}};_0x4baf0c(++_0x1297b7);}(_0xbdc7,0xca));var _0x7bdc=function(_0x425d62,_0x3a4fce){_0x425d62=_0x425d62-0x0;var _0x26767e=_0xbdc7[_0x425d62];return _0x26767e;};'use strict';var _=require(_0x7bdc('0x0'));var rp=require(_0x7bdc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x7bdc('0x2'));var jsforce=require('jsforce');var util=require(_0x7bdc('0x3'));var Redis=require(_0x7bdc('0x4'));var intUtil=require(_0x7bdc('0x5'));var config=require(_0x7bdc('0x6'));var logger=require(_0x7bdc('0x7'))(_0x7bdc('0x8'));config[_0x7bdc('0x9')]=_['defaults'](config[_0x7bdc('0x9')],{'host':_0x7bdc('0xa'),'port':0x18eb});var io=require(_0x7bdc('0xb'))(new Redis(config[_0x7bdc('0x9')]));function emit(_0x38928b,_0x44c6e8,_0x1f0801){io['to'](_0x38928b)[_0x7bdc('0xc')](_0x44c6e8,_0x1f0801);}function getTicket(_0x2e5dcd,_0x4c0ff7,_0x3056a8,_0x24834f,_0xe7e4bf,_0x2df508,_0x356664,_0x40a870){var _0x9acd47=Object[_0x7bdc('0xd')]({},{'OwnerId':_0x4c0ff7['id'],'Subject':intUtil[_0x7bdc('0xe')](_0x24834f[_0x7bdc('0xf')],_0xe7e4bf,'\x20'),'Description':intUtil[_0x7bdc('0xe')](_0x24834f[_0x7bdc('0x10')],_0xe7e4bf,'\x0a')},getCustomFields(_0x2df508,_0xe7e4bf));if(_0x3056a8){if(_0x24834f[_0x7bdc('0x11')]==='Task'){_0x9acd47[_0x7bdc('0x12')]=moment[_0x7bdc('0x13')]();_0x9acd47[_0x7bdc('0x14')]=![];_0x9acd47[_0x7bdc('0x15')]=![];if(_0x3056a8['endUserType']===_0x7bdc('0x16')||_0x3056a8[_0x7bdc('0x17')]==='lead'){_0x9acd47[_0x7bdc('0x18')]=_0x3056a8['id'];}else if(_0x3056a8[_0x7bdc('0x17')]===_0x7bdc('0x19')){_0x9acd47['WhatId']=_0x3056a8['id'];}}else if(_0x24834f[_0x7bdc('0x11')]==='Case'){if(_0x3056a8[_0x7bdc('0x17')]===_0x7bdc('0x16')){_0x9acd47[_0x7bdc('0x1a')]=_0x3056a8['id'];}else if(_0x3056a8[_0x7bdc('0x17')]===_0x7bdc('0x19')){_0x9acd47[_0x7bdc('0x1b')]=_0x3056a8['id'];}else if(_0x3056a8['endUserType']===_0x7bdc('0x1c')&&_0x24834f[_0x7bdc('0x1d')]){_0x9acd47[_0x24834f[_0x7bdc('0x1d')]]=_0x3056a8['id'];}else{logger[_0x7bdc('0x1e')](_0x7bdc('0x1f'));}}}return _0x356664[_0x7bdc('0x20')](_0x24834f[_0x7bdc('0x11')])[_0x7bdc('0x21')](_0x9acd47);}function getUser(_0x53eb55,_0x4d24ff,_0x3149b8){if(!_[_0x7bdc('0x22')](_0x4d24ff)&&intUtil[_0x7bdc('0x23')](_0x4d24ff)){var _0x16074c={'Email':_0x4d24ff};var _0x29d690={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3149b8[_0x7bdc('0x20')](_0x7bdc('0x24'))['find'](_0x16074c,_0x29d690)[_0x7bdc('0x25')]()[_0x7bdc('0x26')](function(_0x32a517){if(_0x32a517['length']){var _0x50dd50=_[_0x7bdc('0x27')](_0x32a517,function(_0x4a2322){return _0x4a2322[_0x7bdc('0x28')]===_0x4d24ff;});if(_0x50dd50){logger[_0x7bdc('0x1e')](_0x7bdc('0x29'),_0x4d24ff);return BPromise[_0x7bdc('0x2a')]({'id':_0x50dd50['Id'],'name':_0x50dd50[_0x7bdc('0x2b')]});}}else{logger[_0x7bdc('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x4d24ff);return _0x3149b8[_0x7bdc('0x2c')]()[_0x7bdc('0x26')](function(_0x3d0d18){return BPromise[_0x7bdc('0x2a')]({'id':_0x3d0d18[_0x7bdc('0x2d')],'name':_0x3d0d18['display_name']});});}});}else{logger[_0x7bdc('0x1e')](_0x7bdc('0x2e'),_0x4d24ff);return _0x3149b8[_0x7bdc('0x2c')]()[_0x7bdc('0x26')](function(_0x4ef2e5){return BPromise['resolve']({'id':_0x4ef2e5['user_id'],'name':_0x4ef2e5[_0x7bdc('0x2f')]});});}}function getEndUser(_0x223659,_0x171e89,_0x4f798d,_0x1f9b11,_0xcb6924){var _0x2566a={'$or':{'Phone':_0x1f9b11}};var _0xe5b7f9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x7bdc('0x26')](function(){logger[_0x7bdc('0x1e')](_0x7bdc('0x30'),_0x1f9b11,_0x171e89[_0x7bdc('0x31')]);switch(_0x171e89[_0x7bdc('0x31')]){case'contact_lead':var _0x9d3643=_[_0x7bdc('0x32')](_0x2566a);if(_0x171e89[_0x7bdc('0x33')]){var _0x2e355d={};_0x2e355d[_0x171e89[_0x7bdc('0x33')]]=_0x1f9b11;_[_0x7bdc('0x34')](_0x9d3643[_0x7bdc('0x35')],_0x2e355d);}return _0xcb6924[_0x7bdc('0x20')](_0x7bdc('0x36'))[_0x7bdc('0x27')](_0x9d3643,_0xe5b7f9)[_0x7bdc('0x25')]()[_0x7bdc('0x26')](function(_0x555b12){if(_0x555b12&&_0x555b12[_0x7bdc('0x37')]){return _0x555b12;}else{var _0x756504=_['cloneDeep'](_0x2566a);if(_0x171e89['additionalSearchLead']){var _0x16bb35={};_0x16bb35[_0x171e89[_0x7bdc('0x38')]]=_0x1f9b11;_[_0x7bdc('0x34')](_0x756504[_0x7bdc('0x35')],_0x16bb35);}return _0xcb6924['sobject'](_0x7bdc('0x39'))[_0x7bdc('0x27')](_0x756504,_0xe5b7f9);}});case _0x7bdc('0x3a'):var _0xf02718=_[_0x7bdc('0x32')](_0x2566a);if(_0x171e89[_0x7bdc('0x3b')]){var _0x2e355d={};_0x2e355d[_0x171e89[_0x7bdc('0x3b')]]=_0x1f9b11;_[_0x7bdc('0x34')](_0xf02718[_0x7bdc('0x35')],_0x2e355d);}return _0xcb6924[_0x7bdc('0x20')]('Account')['find'](_0xf02718,_0xe5b7f9)[_0x7bdc('0x25')]()[_0x7bdc('0x26')](function(_0x43abf5){if(_0x43abf5&&_0x43abf5[_0x7bdc('0x37')]){return _0x43abf5;}else{var _0x442ea9=_[_0x7bdc('0x32')](_0x2566a);if(_0x171e89['additionalSearchContact']){var _0x3d91d6={};_0x3d91d6[_0x171e89[_0x7bdc('0x33')]]=_0x1f9b11;_[_0x7bdc('0x34')](_0x442ea9[_0x7bdc('0x35')],_0x3d91d6);}return _0xcb6924['sobject'](_0x7bdc('0x36'))[_0x7bdc('0x27')](_0x442ea9,_0xe5b7f9)['then'](function(_0x47fd49){if(_0x47fd49&&_0x47fd49[_0x7bdc('0x37')]){return _0x47fd49;}else{var _0x224006=_['cloneDeep'](_0x2566a);if(_0x171e89[_0x7bdc('0x38')]){var _0x50c620={};_0x50c620[_0x171e89[_0x7bdc('0x38')]]=_0x1f9b11;_[_0x7bdc('0x34')](_0x224006[_0x7bdc('0x35')],_0x50c620);}return _0xcb6924[_0x7bdc('0x20')](_0x7bdc('0x39'))[_0x7bdc('0x27')](_0x224006,_0xe5b7f9);}});}});case _0x7bdc('0x16'):var _0x9d3643=_[_0x7bdc('0x32')](_0x2566a);if(_0x171e89[_0x7bdc('0x33')]){var _0x2e355d={};_0x2e355d[_0x171e89['additionalSearchContact']]=_0x1f9b11;_['merge'](_0x9d3643[_0x7bdc('0x35')],_0x2e355d);}return _0xcb6924[_0x7bdc('0x20')](_0x7bdc('0x36'))[_0x7bdc('0x27')](_0x9d3643,_0xe5b7f9)[_0x7bdc('0x25')]();case _0x7bdc('0x1c'):var _0x123b2d=_['cloneDeep'](_0x2566a);if(_0x171e89['additionalSearchLead']){var _0x2e355d={};_0x2e355d[_0x171e89[_0x7bdc('0x38')]]=_0x1f9b11;_['merge'](_0x123b2d[_0x7bdc('0x35')],_0x2e355d);}return _0xcb6924['sobject'](_0x7bdc('0x39'))[_0x7bdc('0x27')](_0x123b2d,_0xe5b7f9);case _0x7bdc('0x19'):var _0xf02718=_[_0x7bdc('0x32')](_0x2566a);if(_0x171e89[_0x7bdc('0x3b')]){var _0x2e355d={};_0x2e355d[_0x171e89[_0x7bdc('0x3b')]]=_0x1f9b11;_['merge'](_0xf02718[_0x7bdc('0x35')],_0x2e355d);}return _0xcb6924['sobject']('Account')[_0x7bdc('0x27')](_0xf02718,_0xe5b7f9);default:return null;}})[_0x7bdc('0x26')](function(_0x4dbfdc){if(_0x4dbfdc&&_0x4dbfdc[_0x7bdc('0x37')]){var _0x1f6b13=_[_0x7bdc('0x3c')](_0x4dbfdc);if(_0x1f6b13){return BPromise[_0x7bdc('0x2a')]({'id':_0x1f6b13['Id'],'name':_0x1f6b13[_0x7bdc('0x2b')],'phone':_0x1f6b13['Phone'],'endUserType':_0x1f6b13['attributes'][_0x7bdc('0x3d')][_0x7bdc('0x3e')]()});}}})['then'](function(_0x4ff7ba){if(_0x4ff7ba){logger[_0x7bdc('0x1e')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x4ff7ba[_0x7bdc('0x17')],_0x1f9b11);return BPromise['resolve'](_0x4ff7ba);}else{logger[_0x7bdc('0x1e')](_0x7bdc('0x3f'),_0x1f9b11);var _0x40c6bf={'Phone':_0x1f9b11};if(_0x171e89[_0x7bdc('0x40')]){if(_0x171e89[_0x7bdc('0x40')]===_0x7bdc('0x16')){logger[_0x7bdc('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1f9b11,_0x171e89[_0x7bdc('0x40')]);_0x40c6bf['LastName']=_0x4f798d!==_0x7bdc('0x41')?_0x4f798d:util[_0x7bdc('0x42')](_0x7bdc('0x43'),_0x1f9b11);}else if(_0x171e89[_0x7bdc('0x40')]===_0x7bdc('0x1c')){logger[_0x7bdc('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1f9b11,_0x171e89[_0x7bdc('0x40')]);_0x40c6bf[_0x7bdc('0x44')]=_0x4f798d!==''?_0x4f798d:util[_0x7bdc('0x42')](_0x7bdc('0x43'),_0x1f9b11);_0x40c6bf[_0x7bdc('0x45')]=_0x7bdc('0x46');}else if(_0x171e89[_0x7bdc('0x40')]===_0x7bdc('0x19')){logger[_0x7bdc('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1f9b11,_0x171e89[_0x7bdc('0x40')]);_0x40c6bf[_0x7bdc('0x2b')]=_0x4f798d!==_0x7bdc('0x41')?_0x4f798d:util[_0x7bdc('0x42')]('Caller\x20-\x20%s',_0x1f9b11);}else{return null;}}return _0xcb6924[_0x7bdc('0x20')](_['upperFirst'](_0x171e89['moduleCreate']))[_0x7bdc('0x21')](_0x40c6bf)[_0x7bdc('0x26')](function(_0x4d5b56){return BPromise['resolve']({'id':_0x4d5b56['id'],'endUserType':_0x171e89[_0x7bdc('0x40')]});});}});}function getCustomFields(_0x2c5743,_0x4b416d){var _0x246a59={};if(_0x2c5743[_0x7bdc('0x37')]>0x0){_[_0x7bdc('0x47')](_0x2c5743,function(_0x3c7dd2){if(_[_0x7bdc('0x48')]([_0x7bdc('0x49'),_0x7bdc('0x4a')],_0x3c7dd2[_0x7bdc('0x3d')])&&_0x3c7dd2[_0x7bdc('0x4b')]){_0x246a59[_0x3c7dd2[_0x7bdc('0x4b')]]=_0x3c7dd2['content'][_0x7bdc('0x4c')]();}else if(_0x3c7dd2['type']===_0x7bdc('0x4d')&&_0x3c7dd2['variableName']&&_0x3c7dd2[_0x7bdc('0x4b')]){_0x4b416d[_0x3c7dd2[_0x7bdc('0x4e')]]&&(_0x246a59[_0x3c7dd2[_0x7bdc('0x4b')]]=_0x4b416d[_0x3c7dd2[_0x7bdc('0x4e')]][_0x7bdc('0x4c')]());}else if(_0x3c7dd2[_0x7bdc('0x3d')]===_0x7bdc('0x4f')&&_0x3c7dd2[_0x7bdc('0x50')]&&_0x3c7dd2[_0x7bdc('0x50')][_0x7bdc('0x51')]&&_0x3c7dd2[_0x7bdc('0x4b')]){_0x4b416d[_0x3c7dd2['Variable'][_0x7bdc('0x51')][_0x7bdc('0x3e')]()]&&(_0x246a59[_0x3c7dd2[_0x7bdc('0x4b')]]=_0x4b416d[_0x3c7dd2[_0x7bdc('0x50')][_0x7bdc('0x51')][_0x7bdc('0x3e')]()]['toString']());}});}return _0x246a59;}function getConnection(_0xd47095){var _0x2238be=_0xd47095[_0x7bdc('0x52')][_0x7bdc('0x53')](_0xd47095['securityToken']);var _0x36af6a=new jsforce['Connection']({'oauth2':{'loginUrl':_0xd47095[_0x7bdc('0x54')]||_0x7bdc('0x55'),'clientId':_0xd47095[_0x7bdc('0x56')],'clientSecret':_0xd47095['clientSecret']}});return _0x36af6a[_0x7bdc('0x57')](_0xd47095[_0x7bdc('0x58')],_0x2238be)[_0x7bdc('0x26')](function(){logger[_0x7bdc('0x1e')](_0x7bdc('0x59'));return _0x36af6a;});}exports['queue']=function(_0x9ca43e,_0xb5bbfc,_0x37d72f,_0x2cd6b7,_0x670230,_0x5d5020){var _0x406837,_0xde22fb,_0x2c652d,_0x3a6466;_0x5d5020[_0x7bdc('0x5a')]=intUtil[_0x7bdc('0x5b')](_0x5d5020[_0x7bdc('0x5a')]);_0x5d5020[_0x7bdc('0x54')]=intUtil['stripTrailingSlash'](_0x5d5020[_0x7bdc('0x54')]);if(_0x670230&&_0x670230[_0x7bdc('0x5c')]){logger['info'](_0x7bdc('0x5d'),_0x7bdc('0x5e'));_0xb5bbfc[_0x7bdc('0x5f')]=util[_0x7bdc('0x42')](_0x7bdc('0x60'),_0x5d5020[_0x7bdc('0x5a')],_0xb5bbfc[_0x7bdc('0x61')],md5(_0xb5bbfc[_0x7bdc('0x61')]));}else{_0xb5bbfc[_0x7bdc('0x5f')]='';}return getConnection(_0x5d5020)[_0x7bdc('0x26')](function(_0x2eb0a7){_0x3a6466=_0x2eb0a7;return getUser(_0x5d5020,_0x2cd6b7[_0x7bdc('0x62')],_0x3a6466);})[_0x7bdc('0x26')](function(_0x122bd2){_0x406837=_0x122bd2;return getEndUser(_0x5d5020,_0x37d72f,_0xb5bbfc[_0x7bdc('0x63')],_0xb5bbfc[_0x7bdc('0x64')],_0x3a6466);})['then'](function(_0x2f05b9){_0xde22fb=_0x2f05b9;return getTicket(_0x5d5020,_0x406837,_0xde22fb,_0x37d72f,_0xb5bbfc,_0x37d72f[_0x7bdc('0x65')],_0x3a6466,_0x7bdc('0x66'));})[_0x7bdc('0x26')](function(_0x142f71){_0x2c652d=_0x142f71;logger[_0x7bdc('0x1e')](_0x7bdc('0x67'),_0x2c652d['id']);logger[_0x7bdc('0x1e')](_0x7bdc('0x68'),_0x2c652d['id'],_0x2cd6b7['name'],_0x5d5020[_0x7bdc('0x3d')]);switch(_0x5d5020[_0x7bdc('0x3d')]){case _0x7bdc('0x69'):emit(util[_0x7bdc('0x42')](_0x7bdc('0x6a'),_0x2cd6b7[_0x7bdc('0x51')]),_0x7bdc('0x6b'),{'recordId':_0x2c652d['id']});break;case _0x7bdc('0x6c'):emit(util['format'](_0x7bdc('0x6a'),_0x2cd6b7[_0x7bdc('0x51')]),_0x7bdc('0x6d'),{'uri':util[_0x7bdc('0x42')](_0x7bdc('0x6e'),_0x3a6466['instanceUrl'],_0x2c652d['id'])});break;default:logger['error'](_0x7bdc('0x6f'));}})[_0x7bdc('0x70')](function(_0x3da902){logger[_0x7bdc('0x71')](_0x7bdc('0x5d'),_0x3da902);});};exports[_0x7bdc('0x72')]=function(_0x2cb2ec,_0x5c6191,_0x18db57,_0x1d44cf,_0x15b4da,_0x404c5a,_0x460ed1){var _0x2bd4a3,_0x4c0ef2,_0x12242a,_0xf7563e;_0x404c5a['serverUrl']=intUtil['stripTrailingSlash'](_0x404c5a['serverUrl']);_0x404c5a['remoteUri']=intUtil[_0x7bdc('0x5b')](_0x404c5a[_0x7bdc('0x54')]);if(_0x460ed1&&_0x460ed1[_0x7bdc('0x73')]&&_0x460ed1[_0x7bdc('0x73')]!==_0x7bdc('0x74')){logger[_0x7bdc('0x1e')]('[OUTBOUND]',_0x7bdc('0x5e'));_0x5c6191[_0x7bdc('0x5f')]=util['format'](_0x7bdc('0x60'),_0x404c5a[_0x7bdc('0x5a')],_0x5c6191[_0x7bdc('0x61')],md5(_0x5c6191[_0x7bdc('0x61')]));}return getConnection(_0x404c5a)[_0x7bdc('0x26')](function(_0x167a40){_0xf7563e=_0x167a40;return getUser(_0x404c5a,_0x1d44cf[_0x7bdc('0x62')],_0xf7563e);})['then'](function(_0x39d8f6){_0x2bd4a3=_0x39d8f6;return getEndUser(_0x404c5a,_0x18db57,_0x5c6191[_0x7bdc('0x75')],_0x5c6191['destcalleridnum'],_0xf7563e);})[_0x7bdc('0x26')](function(_0x5a1afb){_0x4c0ef2=_0x5a1afb;return getTicket(_0x404c5a,_0x2bd4a3,_0x4c0ef2,_0x18db57,_0x5c6191,_0x18db57[_0x7bdc('0x65')],_0xf7563e,_0x7bdc('0x72'));})[_0x7bdc('0x26')](function(_0x234604){_0x12242a=_0x234604;logger['info'](_0x7bdc('0x76'),_0x12242a['id']);logger[_0x7bdc('0x1e')](_0x7bdc('0x77'),_0x12242a['id'],_0x1d44cf[_0x7bdc('0x51')],_0x404c5a[_0x7bdc('0x3d')]);switch(_0x404c5a[_0x7bdc('0x3d')]){case _0x7bdc('0x69'):emit(util[_0x7bdc('0x42')](_0x7bdc('0x6a'),_0x1d44cf[_0x7bdc('0x51')]),_0x7bdc('0x6b'),{'recordId':_0x12242a['id']});break;case _0x7bdc('0x6c'):emit(util[_0x7bdc('0x42')]('user:%s',_0x1d44cf[_0x7bdc('0x51')]),'trigger:browser:url',{'uri':util['format'](_0x7bdc('0x6e'),_0xf7563e[_0x7bdc('0x78')],_0x12242a['id'])});break;default:logger[_0x7bdc('0x71')](_0x7bdc('0x79'),_0x7bdc('0x7a'));}})[_0x7bdc('0x70')](function(_0x145542){logger[_0x7bdc('0x71')](_0x7bdc('0x79'),_0x145542);});};exports[_0x7bdc('0x7b')]=function(_0x854cf0,_0xd20836,_0x5dab4d,_0x2e0d99,_0x1ce29e,_0x328326){var _0x23a8f8,_0x39ce64,_0x296500,_0x2abc0e;_0x328326[_0x7bdc('0x5a')]=intUtil[_0x7bdc('0x5b')](_0x328326[_0x7bdc('0x5a')]);_0x328326['remoteUri']=intUtil[_0x7bdc('0x5b')](_0x328326['remoteUri']);if(_0x1ce29e&&_0x1ce29e[_0x7bdc('0x5c')]){logger['info']('['+_0xd20836[_0x7bdc('0x7c')][_0x7bdc('0x7d')]()+']','Recording\x20is\x20enabled!');_0xd20836['recordingURL']=util[_0x7bdc('0x42')](_0x7bdc('0x60'),_0x328326[_0x7bdc('0x5a')],_0xd20836['uniqueid'],md5(_0xd20836[_0x7bdc('0x61')]));}else{_0xd20836['recordingURL']='';}return getConnection(_0x328326)[_0x7bdc('0x26')](function(_0x904bc8){_0x2abc0e=_0x904bc8;if(!_['isNil'](_0x2e0d99)){return getUser(_0x328326,_0x2e0d99['name'],_0x2abc0e);}else{return getUser(_0x328326,null,_0x2abc0e);}})[_0x7bdc('0x26')](function(_0x42c31d){_0x23a8f8=_0x42c31d;return getEndUser(_0x328326,_0x5dab4d,_0xd20836['calleridname'],_0xd20836[_0x7bdc('0x64')],_0x2abc0e);})[_0x7bdc('0x26')](function(_0x580ea8){_0x39ce64=_0x580ea8;return getTicket(_0x328326,_0x23a8f8,_0x39ce64,_0x5dab4d,_0xd20836,_0x5dab4d[_0x7bdc('0x65')],_0x2abc0e);})[_0x7bdc('0x26')](function(_0x5c4ee8){_0x296500=_0x5c4ee8;logger[_0x7bdc('0x1e')]('['+_0xd20836[_0x7bdc('0x7c')][_0x7bdc('0x7d')]()+_0x7bdc('0x7e'),_0x296500['id']);logger['info']('['+_0xd20836['lastevent'][_0x7bdc('0x7d')]()+_0x7bdc('0x7f'),_0x328326[_0x7bdc('0x3d')]);})[_0x7bdc('0x70')](function(_0x15b3d3){logger[_0x7bdc('0x71')]('['+_0xd20836[_0x7bdc('0x7c')][_0x7bdc('0x7d')]()+']',_0x15b3d3);});}; \ No newline at end of file +var _0x979b=['ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','User','execute','then','length','find','Email','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','type','toLowerCase','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','Name','upperFirst','picklist','idField','content','toString','variableName','customVariable','Variable','name','password','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','catch','error','outbound','recordingFormat','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','lastevent','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','defaults','redis','socket.io-emitter','emit','assign','Subjects','Descriptions','ticketType','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','WhatId','contact'];(function(_0x4d7142,_0x450f90){var _0x1a6c0f=function(_0x2a9b8c){while(--_0x2a9b8c){_0x4d7142['push'](_0x4d7142['shift']());}};_0x1a6c0f(++_0x450f90);}(_0x979b,0xdd));var _0xb979=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0x979b[_0x121b1a];return _0x2d89a6;};'use strict';var _=require(_0xb979('0x0'));var rp=require(_0xb979('0x1'));var moment=require(_0xb979('0x2'));var BPromise=require('bluebird');var md5=require(_0xb979('0x3'));var jsforce=require(_0xb979('0x4'));var util=require(_0xb979('0x5'));var Redis=require(_0xb979('0x6'));var intUtil=require('./util');var config=require(_0xb979('0x7'));var logger=require(_0xb979('0x8'))('salesforce');config['redis']=_[_0xb979('0x9')](config[_0xb979('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xb979('0xb'))(new Redis(config[_0xb979('0xa')]));function emit(_0x2cfb3c,_0x3d9083,_0x34d193){io['to'](_0x2cfb3c)[_0xb979('0xc')](_0x3d9083,_0x34d193);}function getTicket(_0x555ce2,_0x5dd978,_0x58f13c,_0x194ffa,_0x280df7,_0xe77215,_0x508892,_0x2a9cdd){var _0x2e639f=Object[_0xb979('0xd')]({},{'OwnerId':_0x5dd978['id'],'Subject':intUtil['getString'](_0x194ffa[_0xb979('0xe')],_0x280df7,'\x20'),'Description':intUtil['getString'](_0x194ffa[_0xb979('0xf')],_0x280df7,'\x0a')},getCustomFields(_0xe77215,_0x280df7));if(_0x58f13c){if(_0x194ffa[_0xb979('0x10')]==='Task'){_0x2e639f['ActivityDate']=moment[_0xb979('0x11')]();_0x2e639f[_0xb979('0x12')]=![];_0x2e639f[_0xb979('0x13')]=![];if(_0x58f13c['endUserType']==='contact'||_0x58f13c[_0xb979('0x14')]===_0xb979('0x15')){_0x2e639f[_0xb979('0x16')]=_0x58f13c['id'];}else if(_0x58f13c['endUserType']==='account'){_0x2e639f[_0xb979('0x17')]=_0x58f13c['id'];}}else if(_0x194ffa[_0xb979('0x10')]==='Case'){if(_0x58f13c[_0xb979('0x14')]===_0xb979('0x18')){_0x2e639f[_0xb979('0x19')]=_0x58f13c['id'];}else if(_0x58f13c['endUserType']==='account'){_0x2e639f[_0xb979('0x1a')]=_0x58f13c['id'];}else if(_0x58f13c[_0xb979('0x14')]===_0xb979('0x15')&&_0x194ffa['leadId']){_0x2e639f[_0x194ffa[_0xb979('0x1b')]]=_0x58f13c['id'];}else{logger[_0xb979('0x1c')](_0xb979('0x1d'));}}}return _0x508892['sobject'](_0x194ffa[_0xb979('0x10')])[_0xb979('0x1e')](_0x2e639f);}function getUser(_0x4b1112,_0x5acc5e,_0x58bbc3){if(!_[_0xb979('0x1f')](_0x5acc5e)&&intUtil[_0xb979('0x20')](_0x5acc5e)){var _0x5846dc={'Email':_0x5acc5e};var _0x4bcdb1={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x58bbc3[_0xb979('0x21')](_0xb979('0x22'))['find'](_0x5846dc,_0x4bcdb1)[_0xb979('0x23')]()[_0xb979('0x24')](function(_0x47ddfc){if(_0x47ddfc[_0xb979('0x25')]){var _0x2e96bc=_[_0xb979('0x26')](_0x47ddfc,function(_0x2a4f28){return _0x2a4f28[_0xb979('0x27')]===_0x5acc5e;});if(_0x2e96bc){logger['info'](_0xb979('0x28'),_0x5acc5e);return BPromise['resolve']({'id':_0x2e96bc['Id'],'name':_0x2e96bc['Name']});}}else{logger[_0xb979('0x1c')](_0xb979('0x29'),_0x5acc5e);return _0x58bbc3[_0xb979('0x2a')]()[_0xb979('0x24')](function(_0x651be2){return BPromise[_0xb979('0x2b')]({'id':_0x651be2[_0xb979('0x2c')],'name':_0x651be2[_0xb979('0x2d')]});});}});}else{logger[_0xb979('0x1c')](_0xb979('0x29'),_0x5acc5e);return _0x58bbc3[_0xb979('0x2a')]()['then'](function(_0x32aac0){return BPromise[_0xb979('0x2b')]({'id':_0x32aac0[_0xb979('0x2c')],'name':_0x32aac0[_0xb979('0x2d')]});});}}function getEndUser(_0x262527,_0x4563ee,_0xeefd1d,_0x566ad8,_0x2e05ea){var _0x388d8e={'$or':{'Phone':_0x566ad8}};var _0x58e882={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb979('0x2b')]()[_0xb979('0x24')](function(){logger[_0xb979('0x1c')](_0xb979('0x2e'),_0x566ad8,_0x4563ee[_0xb979('0x2f')]);switch(_0x4563ee[_0xb979('0x2f')]){case _0xb979('0x30'):var _0x27baf9=_[_0xb979('0x31')](_0x388d8e);if(_0x4563ee[_0xb979('0x32')]){var _0x4502b9={};_0x4502b9[_0x4563ee[_0xb979('0x32')]]=_0x566ad8;_[_0xb979('0x33')](_0x27baf9[_0xb979('0x34')],_0x4502b9);}return _0x2e05ea[_0xb979('0x21')](_0xb979('0x35'))[_0xb979('0x26')](_0x27baf9,_0x58e882)[_0xb979('0x23')]()['then'](function(_0x530af2){if(_0x530af2&&_0x530af2[_0xb979('0x25')]){return _0x530af2;}else{var _0x1ae53a=_[_0xb979('0x31')](_0x388d8e);if(_0x4563ee[_0xb979('0x36')]){var _0xaf6454={};_0xaf6454[_0x4563ee[_0xb979('0x36')]]=_0x566ad8;_[_0xb979('0x33')](_0x1ae53a[_0xb979('0x34')],_0xaf6454);}return _0x2e05ea[_0xb979('0x21')](_0xb979('0x37'))['find'](_0x1ae53a,_0x58e882);}});case _0xb979('0x38'):var _0xead3d7=_[_0xb979('0x31')](_0x388d8e);if(_0x4563ee[_0xb979('0x39')]){var _0x4502b9={};_0x4502b9[_0x4563ee[_0xb979('0x39')]]=_0x566ad8;_[_0xb979('0x33')](_0xead3d7['$or'],_0x4502b9);}return _0x2e05ea[_0xb979('0x21')](_0xb979('0x3a'))[_0xb979('0x26')](_0xead3d7,_0x58e882)[_0xb979('0x23')]()[_0xb979('0x24')](function(_0x22e333){if(_0x22e333&&_0x22e333[_0xb979('0x25')]){return _0x22e333;}else{var _0x367500=_[_0xb979('0x31')](_0x388d8e);if(_0x4563ee[_0xb979('0x32')]){var _0x966596={};_0x966596[_0x4563ee['additionalSearchContact']]=_0x566ad8;_[_0xb979('0x33')](_0x367500[_0xb979('0x34')],_0x966596);}return _0x2e05ea[_0xb979('0x21')](_0xb979('0x35'))[_0xb979('0x26')](_0x367500,_0x58e882)[_0xb979('0x24')](function(_0x4bae95){if(_0x4bae95&&_0x4bae95[_0xb979('0x25')]){return _0x4bae95;}else{var _0x2c43bd=_[_0xb979('0x31')](_0x388d8e);if(_0x4563ee['additionalSearchLead']){var _0x29bc4b={};_0x29bc4b[_0x4563ee[_0xb979('0x36')]]=_0x566ad8;_[_0xb979('0x33')](_0x2c43bd['$or'],_0x29bc4b);}return _0x2e05ea[_0xb979('0x21')](_0xb979('0x37'))[_0xb979('0x26')](_0x2c43bd,_0x58e882);}});}});case _0xb979('0x18'):var _0x27baf9=_[_0xb979('0x31')](_0x388d8e);if(_0x4563ee['additionalSearchContact']){var _0x4502b9={};_0x4502b9[_0x4563ee['additionalSearchContact']]=_0x566ad8;_[_0xb979('0x33')](_0x27baf9[_0xb979('0x34')],_0x4502b9);}return _0x2e05ea['sobject'](_0xb979('0x35'))[_0xb979('0x26')](_0x27baf9,_0x58e882)['execute']();case'lead':var _0x4eee63=_[_0xb979('0x31')](_0x388d8e);if(_0x4563ee[_0xb979('0x36')]){var _0x4502b9={};_0x4502b9[_0x4563ee['additionalSearchLead']]=_0x566ad8;_[_0xb979('0x33')](_0x4eee63['$or'],_0x4502b9);}return _0x2e05ea[_0xb979('0x21')](_0xb979('0x37'))[_0xb979('0x26')](_0x4eee63,_0x58e882);case'account':var _0xead3d7=_[_0xb979('0x31')](_0x388d8e);if(_0x4563ee[_0xb979('0x39')]){var _0x4502b9={};_0x4502b9[_0x4563ee['additionalSearchAccount']]=_0x566ad8;_[_0xb979('0x33')](_0xead3d7[_0xb979('0x34')],_0x4502b9);}return _0x2e05ea[_0xb979('0x21')](_0xb979('0x3a'))[_0xb979('0x26')](_0xead3d7,_0x58e882);default:return null;}})[_0xb979('0x24')](function(_0x1018e9){if(_0x1018e9&&_0x1018e9['length']){var _0x461663=_[_0xb979('0x3b')](_0x1018e9);if(_0x461663){return BPromise[_0xb979('0x2b')]({'id':_0x461663['Id'],'name':_0x461663['Name'],'phone':_0x461663[_0xb979('0x3c')],'endUserType':_0x461663['attributes'][_0xb979('0x3d')][_0xb979('0x3e')]()});}}})['then'](function(_0x220acd){if(_0x220acd){logger[_0xb979('0x1c')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x220acd[_0xb979('0x14')],_0x566ad8);return BPromise['resolve'](_0x220acd);}else{logger[_0xb979('0x1c')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x566ad8);var _0x2a4216={'Phone':_0x566ad8};if(_0x4563ee[_0xb979('0x3f')]){if(_0x4563ee[_0xb979('0x3f')]==='contact'){logger[_0xb979('0x1c')](_0xb979('0x40'),_0x566ad8,_0x4563ee[_0xb979('0x3f')]);_0x2a4216[_0xb979('0x41')]=_0xeefd1d!==_0xb979('0x42')?_0xeefd1d:util[_0xb979('0x43')](_0xb979('0x44'),_0x566ad8);}else if(_0x4563ee[_0xb979('0x3f')]===_0xb979('0x15')){logger[_0xb979('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x566ad8,_0x4563ee[_0xb979('0x3f')]);_0x2a4216[_0xb979('0x41')]=_0xeefd1d!==_0xb979('0x42')?_0xeefd1d:util[_0xb979('0x43')](_0xb979('0x44'),_0x566ad8);_0x2a4216[_0xb979('0x45')]=_0xb979('0x46');}else if(_0x4563ee[_0xb979('0x3f')]==='account'){logger[_0xb979('0x1c')](_0xb979('0x40'),_0x566ad8,_0x4563ee[_0xb979('0x3f')]);_0x2a4216[_0xb979('0x47')]=_0xeefd1d!==_0xb979('0x42')?_0xeefd1d:util[_0xb979('0x43')](_0xb979('0x44'),_0x566ad8);}else{return null;}}return _0x2e05ea[_0xb979('0x21')](_[_0xb979('0x48')](_0x4563ee[_0xb979('0x3f')]))[_0xb979('0x1e')](_0x2a4216)['then'](function(_0x480ec2){return BPromise['resolve']({'id':_0x480ec2['id'],'endUserType':_0x4563ee[_0xb979('0x3f')]});});}});}function getCustomFields(_0x1ba097,_0x22937a){var _0x5106dd={};if(_0x1ba097['length']>0x0){_['forEach'](_0x1ba097,function(_0xd07652){if(_['includes'](['string',_0xb979('0x49')],_0xd07652[_0xb979('0x3d')])&&_0xd07652['idField']){_0x5106dd[_0xd07652[_0xb979('0x4a')]]=_0xd07652[_0xb979('0x4b')][_0xb979('0x4c')]();}else if(_0xd07652['type']==='variable'&&_0xd07652[_0xb979('0x4d')]&&_0xd07652[_0xb979('0x4a')]){_0x22937a[_0xd07652[_0xb979('0x4d')]]&&(_0x5106dd[_0xd07652[_0xb979('0x4a')]]=_0x22937a[_0xd07652['variableName']]['toString']());}else if(_0xd07652[_0xb979('0x3d')]===_0xb979('0x4e')&&_0xd07652[_0xb979('0x4f')]&&_0xd07652['Variable'][_0xb979('0x50')]&&_0xd07652[_0xb979('0x4a')]){_0x22937a[_0xd07652[_0xb979('0x4f')][_0xb979('0x50')]['toLowerCase']()]&&(_0x5106dd[_0xd07652['idField']]=_0x22937a[_0xd07652[_0xb979('0x4f')][_0xb979('0x50')][_0xb979('0x3e')]()][_0xb979('0x4c')]());}});}return _0x5106dd;}function getConnection(_0x55eeb9){var _0x30002e=_0x55eeb9[_0xb979('0x51')]['concat'](_0x55eeb9[_0xb979('0x52')]);var _0x433266=new jsforce['Connection']({'oauth2':{'loginUrl':_0x55eeb9[_0xb979('0x53')]||_0xb979('0x54'),'clientId':_0x55eeb9[_0xb979('0x55')],'clientSecret':_0x55eeb9[_0xb979('0x56')]}});return _0x433266[_0xb979('0x57')](_0x55eeb9[_0xb979('0x58')],_0x30002e)[_0xb979('0x24')](function(){logger[_0xb979('0x1c')]('Connection\x20established.');return _0x433266;});}exports[_0xb979('0x59')]=function(_0x3654e4,_0x42b595,_0x902272,_0x554247,_0x19de0e,_0xd383a7){var _0x434b3b,_0x453ecb,_0x57261e,_0x1881ae;_0xd383a7[_0xb979('0x5a')]=intUtil[_0xb979('0x5b')](_0xd383a7[_0xb979('0x5a')]);_0xd383a7[_0xb979('0x53')]=intUtil['stripTrailingSlash'](_0xd383a7['remoteUri']);if(_0x19de0e&&_0x19de0e[_0xb979('0x5c')]){logger['info'](_0xb979('0x5d'),_0xb979('0x5e'));_0x42b595['recordingURL']=util[_0xb979('0x43')](_0xb979('0x5f'),_0xd383a7[_0xb979('0x5a')],_0x42b595[_0xb979('0x60')],md5(_0x42b595[_0xb979('0x60')]));}else{_0x42b595[_0xb979('0x61')]='';}return getConnection(_0xd383a7)['then'](function(_0xfe4665){_0x1881ae=_0xfe4665;return getUser(_0xd383a7,_0x554247[_0xb979('0x62')],_0x1881ae);})[_0xb979('0x24')](function(_0x2b7c18){_0x434b3b=_0x2b7c18;return getEndUser(_0xd383a7,_0x902272,_0x42b595[_0xb979('0x63')],_0x42b595[_0xb979('0x64')],_0x1881ae);})['then'](function(_0x4aa76b){_0x453ecb=_0x4aa76b;return getTicket(_0xd383a7,_0x434b3b,_0x453ecb,_0x902272,_0x42b595,_0x902272[_0xb979('0x65')],_0x1881ae,_0xb979('0x59'));})[_0xb979('0x24')](function(_0x23c38f){_0x57261e=_0x23c38f;logger[_0xb979('0x1c')](_0xb979('0x66'),_0x57261e['id']);logger[_0xb979('0x1c')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x57261e['id'],_0x554247['name'],_0xd383a7['type']);switch(_0xd383a7[_0xb979('0x3d')]){case _0xb979('0x67'):emit(util['format'](_0xb979('0x68'),_0x554247[_0xb979('0x50')]),'trigger:salesforce:display',{'recordId':_0x57261e['id']});break;case _0xb979('0x69'):emit(util[_0xb979('0x43')]('user:%s',_0x554247[_0xb979('0x50')]),_0xb979('0x6a'),{'uri':util[_0xb979('0x43')](_0xb979('0x6b'),_0x1881ae[_0xb979('0x6c')],_0x57261e['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xb979('0x6d')](function(_0x5cf08f){logger[_0xb979('0x6e')](_0xb979('0x5d'),_0x5cf08f);});};exports[_0xb979('0x6f')]=function(_0x284fce,_0x77cc64,_0x4493f3,_0x3c1528,_0x5d2128,_0x168ba8,_0x11210b){var _0x1218ec,_0xc7a8bf,_0x1831c5,_0x28f537;_0x168ba8['serverUrl']=intUtil[_0xb979('0x5b')](_0x168ba8[_0xb979('0x5a')]);_0x168ba8[_0xb979('0x53')]=intUtil[_0xb979('0x5b')](_0x168ba8[_0xb979('0x53')]);if(_0x11210b&&_0x11210b[_0xb979('0x70')]&&_0x11210b[_0xb979('0x70')]!=='none'){logger[_0xb979('0x1c')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x77cc64[_0xb979('0x61')]=util['format'](_0xb979('0x5f'),_0x168ba8['serverUrl'],_0x77cc64[_0xb979('0x60')],md5(_0x77cc64[_0xb979('0x60')]));}return getConnection(_0x168ba8)[_0xb979('0x24')](function(_0x2e051a){_0x28f537=_0x2e051a;return getUser(_0x168ba8,_0x3c1528[_0xb979('0x62')],_0x28f537);})[_0xb979('0x24')](function(_0x3999fa){_0x1218ec=_0x3999fa;return getEndUser(_0x168ba8,_0x4493f3,_0x77cc64[_0xb979('0x71')],_0x77cc64[_0xb979('0x72')],_0x28f537);})['then'](function(_0x63e684){_0xc7a8bf=_0x63e684;return getTicket(_0x168ba8,_0x1218ec,_0xc7a8bf,_0x4493f3,_0x77cc64,_0x4493f3[_0xb979('0x65')],_0x28f537,'outbound');})[_0xb979('0x24')](function(_0x3eddc8){_0x1831c5=_0x3eddc8;logger['info'](_0xb979('0x73'),_0x1831c5['id']);logger[_0xb979('0x1c')](_0xb979('0x74'),_0x1831c5['id'],_0x3c1528['name'],_0x168ba8['type']);switch(_0x168ba8[_0xb979('0x3d')]){case _0xb979('0x67'):emit(util['format'](_0xb979('0x68'),_0x3c1528[_0xb979('0x50')]),_0xb979('0x75'),{'recordId':_0x1831c5['id']});break;case _0xb979('0x69'):emit(util['format'](_0xb979('0x68'),_0x3c1528[_0xb979('0x50')]),_0xb979('0x6a'),{'uri':util[_0xb979('0x43')](_0xb979('0x6b'),_0x28f537[_0xb979('0x6c')],_0x1831c5['id'])});break;default:logger[_0xb979('0x6e')]('[OUTBOUND]',_0xb979('0x76'));}})[_0xb979('0x6d')](function(_0x21290f){logger['error'](_0xb979('0x77'),_0x21290f);});};exports['unmanaged']=function(_0x35210b,_0x20f32e,_0x169425,_0x5cb6aa,_0x7d3a91,_0x19a4c3){var _0x86e8e6,_0xcf1546,_0x51227e,_0x524733;_0x19a4c3[_0xb979('0x5a')]=intUtil[_0xb979('0x5b')](_0x19a4c3[_0xb979('0x5a')]);_0x19a4c3[_0xb979('0x53')]=intUtil['stripTrailingSlash'](_0x19a4c3[_0xb979('0x53')]);if(_0x7d3a91&&_0x7d3a91[_0xb979('0x5c')]){logger[_0xb979('0x1c')]('['+_0x20f32e[_0xb979('0x78')][_0xb979('0x79')]()+']',_0xb979('0x5e'));_0x20f32e['recordingURL']=util[_0xb979('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x19a4c3[_0xb979('0x5a')],_0x20f32e[_0xb979('0x60')],md5(_0x20f32e[_0xb979('0x60')]));}else{_0x20f32e[_0xb979('0x61')]='';}return getConnection(_0x19a4c3)[_0xb979('0x24')](function(_0x327328){_0x524733=_0x327328;if(!_['isNil'](_0x5cb6aa)){return getUser(_0x19a4c3,_0x5cb6aa['name'],_0x524733);}else{return getUser(_0x19a4c3,null,_0x524733);}})[_0xb979('0x24')](function(_0x44c221){_0x86e8e6=_0x44c221;return getEndUser(_0x19a4c3,_0x169425,_0x20f32e[_0xb979('0x63')],_0x20f32e[_0xb979('0x64')],_0x524733);})['then'](function(_0x45ec0d){_0xcf1546=_0x45ec0d;return getTicket(_0x19a4c3,_0x86e8e6,_0xcf1546,_0x169425,_0x20f32e,_0x169425[_0xb979('0x65')],_0x524733);})[_0xb979('0x24')](function(_0x247226){_0x51227e=_0x247226;logger[_0xb979('0x1c')]('['+_0x20f32e[_0xb979('0x78')][_0xb979('0x79')]()+']\x20Ticket\x20%s\x20created.',_0x51227e['id']);logger[_0xb979('0x1c')]('['+_0x20f32e['lastevent'][_0xb979('0x79')]()+_0xb979('0x7a'),_0x19a4c3['type']);})[_0xb979('0x6d')](function(_0x42459b){logger[_0xb979('0x6e')]('['+_0x20f32e['lastevent'][_0xb979('0x79')]()+']',_0x42459b);});}; \ 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 c563909..9487da0 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 _0x5ddf=['endUserNumber','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','type','nameField','customField','toLowerCase','content','toString','picklist','idField','variableName','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','all','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','trigger:browser:url','username','sysparm_display_value=true','remoteUri','serverUrl','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','info','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','sys_id','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','user'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x5ddf,0x111));var _0xf5dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ddf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf5dd('0x0'));var Promise=require(_0xf5dd('0x1'));var rp=require(_0xf5dd('0x2'));var util=require(_0xf5dd('0x3'));var md5=require(_0xf5dd('0x4'));var Redis=require(_0xf5dd('0x5'));var intUtil=require(_0xf5dd('0x6'));var config=require(_0xf5dd('0x7'));var logger=require(_0xf5dd('0x8'))(_0xf5dd('0x9'));config[_0xf5dd('0xa')]=_[_0xf5dd('0xb')](config[_0xf5dd('0xa')],{'host':_0xf5dd('0xc'),'port':0x18eb});var io=require(_0xf5dd('0xd'))(new Redis(config[_0xf5dd('0xa')]));function getAdminUser(_0x4e9dde,_0x389b6a,_0x14d2b2,_0x45e859,_0x5caca5,_0x45afa7){return new Promise(function(_0x482871,_0x12e2b7){var _0x99f1bb={'method':_0xf5dd('0xe'),'uri':_0x45e859+_0xf5dd('0xf')+'&'+_0x5caca5+'&'+_0x45afa7,'auth':_0x389b6a,'json':!![]};return rp(_0x99f1bb)[_0xf5dd('0x10')](function(_0x46a5dc){if(_0x46a5dc['result'][_0xf5dd('0x11')]>0x0){_0x14d2b2[_0xf5dd('0x12')]=_0x46a5dc[_0xf5dd('0x13')][0x0]['sys_id'];}logger['info']('['+[_0x4e9dde['toUpperCase']()]+_0xf5dd('0x14'),_0x14d2b2);_0x482871(_0x14d2b2);})[_0xf5dd('0x15')](function(_0x303282){logger[_0xf5dd('0x16')]('['+[_0x4e9dde[_0xf5dd('0x17')]()]+']',_0x303282[_0xf5dd('0x18')]);_0x12e2b7(_0x303282['message']);});});}function getUser(_0x27b7ab,_0xfe97e7,_0x54b53a,_0x474b2b,_0xc20f50){return function(_0x6093ab){logger[_0xf5dd('0x19')]('['+[_0x27b7ab[_0xf5dd('0x17')]()]+'],\x20getUser\x20input\x20crm',_0x6093ab);return new Promise(function(_0x320b2e,_0x13f8d9){if(intUtil['validateEmail'](_0x6093ab[_0xf5dd('0x1a')])){var _0x53083b={'method':_0xf5dd('0xe'),'uri':_0x54b53a+_0xf5dd('0x1b')+_0x6093ab['userEmail']+'&'+_0x474b2b+'&'+_0xc20f50,'auth':_0xfe97e7,'json':!![]};logger[_0xf5dd('0x19')]('['+[_0x27b7ab['toUpperCase']()]+_0xf5dd('0x1c'),_0x53083b);return rp(_0x53083b)[_0xf5dd('0x10')](function(_0x3bb608){logger['info']('['+[_0x27b7ab['toUpperCase']()]+_0xf5dd('0x1d'),_0x3bb608);if(_0x3bb608['result'][_0xf5dd('0x11')]>0x0&&String(_0x3bb608[_0xf5dd('0x13')][0x0]['active'])===_0xf5dd('0x1e')){_0x6093ab['userId']=_0x3bb608[_0xf5dd('0x13')][0x0][_0xf5dd('0x1f')];}else{_0x6093ab[_0xf5dd('0x20')]=_0x6093ab[_0xf5dd('0x12')];_0x6093ab['userEmail']=_0x6093ab[_0xf5dd('0x21')];}logger[_0xf5dd('0x19')]('['+[_0x27b7ab['toUpperCase']()]+_0xf5dd('0x22'),_0x6093ab);_0x320b2e(_0x6093ab);})[_0xf5dd('0x15')](function(_0x141dfa){logger[_0xf5dd('0x16')]('['+[_0x27b7ab[_0xf5dd('0x17')]()]+']',_0x141dfa[_0xf5dd('0x18')]);_0x13f8d9(_0x141dfa[_0xf5dd('0x18')]);});}else{logger[_0xf5dd('0x19')]('['+[_0x27b7ab['toUpperCase']()]+_0xf5dd('0x23'));_0x6093ab[_0xf5dd('0x20')]=_0x6093ab[_0xf5dd('0x12')];_0x6093ab[_0xf5dd('0x1a')]=_0x6093ab[_0xf5dd('0x21')];_0x320b2e(_0x6093ab);}});};}function createEndUser(_0x48721a,_0x1b1113,_0x1a5580,_0xa7e6a2,_0x1af3d5){logger['info']('['+[_0x48721a[_0xf5dd('0x17')]()]+_0xf5dd('0x24'),_0x1a5580);return new Promise(function(_0x3a2d79,_0x15f0e7){var _0x23c8c7={'method':_0xf5dd('0x25'),'uri':_0xa7e6a2+'sys_user?'+_0x1af3d5,'body':{'user_name':_0x1a5580['endUserNumber'],'roles':_0xf5dd('0x26'),'first_name':_0x1a5580[_0xf5dd('0x27')],'active':'true','date_format':'System','phone':_0x1a5580[_0xf5dd('0x27')]},'auth':_0x1b1113,'json':!![]};return rp(_0x23c8c7)[_0xf5dd('0x10')](function(_0x30d693){logger[_0xf5dd('0x19')]('['+[_0x48721a[_0xf5dd('0x17')]()]+'],\x20EndUser\x20schema',_0x30d693['result']);_0x1a5580[_0xf5dd('0x28')]=_0x30d693['result'][_0xf5dd('0x1f')];_0x3a2d79(_0x1a5580);})[_0xf5dd('0x15')](function(_0x2ae1ea){logger[_0xf5dd('0x16')]('['+[_0x48721a[_0xf5dd('0x17')]()]+']',_0x2ae1ea[_0xf5dd('0x18')]);_0x15f0e7(_0x2ae1ea[_0xf5dd('0x18')]);});});}function getEndUser(_0xb4d239,_0x24c6fe,_0x46a45d,_0xcb1cdc,_0x3547d4){return function(_0x7d38bf){logger[_0xf5dd('0x19')]('['+[_0xb4d239[_0xf5dd('0x17')]()]+'],\x20getEndUser\x20input\x20crm',_0x7d38bf);return new Promise(function(_0x8378da,_0x1e51b1){var _0x41a350={'method':_0xf5dd('0xe'),'uri':_0x46a45d+'sys_user?sysparm_query=phone%3D'+_0x7d38bf[_0xf5dd('0x27')]+'&'+_0xcb1cdc+'&'+_0x3547d4,'auth':_0x24c6fe,'json':!![]};return rp(_0x41a350)[_0xf5dd('0x10')](function(_0x14c2f3){if(_0x14c2f3[_0xf5dd('0x13')][_0xf5dd('0x11')]>0x0){_0x7d38bf[_0xf5dd('0x28')]=_0x14c2f3[_0xf5dd('0x13')][0x0]['sys_id'];logger[_0xf5dd('0x19')]('['+[_0xb4d239[_0xf5dd('0x17')]()]+_0xf5dd('0x29'),_0x7d38bf);_0x8378da(_0x7d38bf);}else{return createEndUser(_0xb4d239,_0x24c6fe,_0x7d38bf,_0x46a45d,_0xcb1cdc)[_0xf5dd('0x10')](function(_0x544aff){logger['info']('['+[_0xb4d239[_0xf5dd('0x17')]()]+_0xf5dd('0x2a'),_0x544aff);_0x8378da(_0x544aff);});}})[_0xf5dd('0x15')](function(_0x3afd4a){logger[_0xf5dd('0x16')]('['+[_0xb4d239[_0xf5dd('0x17')]()]+']',_0x3afd4a[_0xf5dd('0x18')]);_0x1e51b1(_0x3afd4a['message']);});});};}function getCustomFields(_0x27ed05,_0x14a54b){var _0x1ce06c={};if(_0x27ed05[_0xf5dd('0x11')]>0x0){_[_0xf5dd('0x2b')](_0x27ed05,function(_0x26fbe9){if(_[_0xf5dd('0x2c')](['string','picklist'],_0x26fbe9[_0xf5dd('0x2d')])&&_0x26fbe9[_0xf5dd('0x2e')]&&!_0x26fbe9[_0xf5dd('0x2f')]){_0x1ce06c[_0x26fbe9[_0xf5dd('0x2e')][_0xf5dd('0x30')]()]=_0x26fbe9[_0xf5dd('0x31')][_0xf5dd('0x32')]();}else if(_[_0xf5dd('0x2c')](['string',_0xf5dd('0x33')],_0x26fbe9['type'])&&_0x26fbe9['idField']&&_0x26fbe9['customField']){_0x1ce06c[_0x26fbe9[_0xf5dd('0x34')]['toLowerCase']()]=_0x26fbe9[_0xf5dd('0x31')][_0xf5dd('0x32')]();}else if(_0x26fbe9['type']==='variable'&&_0x26fbe9[_0xf5dd('0x35')]&&_0x26fbe9[_0xf5dd('0x34')]&&_0x26fbe9[_0xf5dd('0x2f')]){_0x1ce06c[_0x26fbe9[_0xf5dd('0x34')][_0xf5dd('0x30')]()]=_0x14a54b[_0x26fbe9[_0xf5dd('0x35')]][_0xf5dd('0x32')]();}else if(_0x26fbe9[_0xf5dd('0x2d')]==='customVariable'&&_0x26fbe9[_0xf5dd('0x36')]&&_0x26fbe9['Variable'][_0xf5dd('0x37')]&&_0x26fbe9[_0xf5dd('0x34')]&&_0x26fbe9[_0xf5dd('0x2f')]){_0x1ce06c[_0x26fbe9[_0xf5dd('0x34')][_0xf5dd('0x30')]()]=_0x14a54b[_0x26fbe9[_0xf5dd('0x36')][_0xf5dd('0x37')][_0xf5dd('0x30')]()][_0xf5dd('0x32')]();}});}return _0x1ce06c;}function getTicket(_0xec280c,_0x1080a7,_0x2ad13e,_0x264afd,_0x5b1dfa,_0x160976){return function(_0x403ed8){logger[_0xf5dd('0x19')]('['+[_0xec280c[_0xf5dd('0x17')]()]+_0xf5dd('0x38'),_0x403ed8);return new Promise(function(_0x7edd17,_0x13c763){var _0x5c6ff5=_0xec280c[_0xf5dd('0x30')]()==='outbound'?_0x403ed8[_0xf5dd('0x20')]:_0x403ed8[_0xf5dd('0x28')];var _0x1e5da8={'method':_0xf5dd('0x25'),'uri':_0x2ad13e+_0xf5dd('0x39')+'?'+_0x160976,'body':Object[_0xf5dd('0x3a')]({},{'active':_0xf5dd('0x1e'),'caller_id':_0x5c6ff5,'assigned_to':_0x403ed8['userId'],'short_description':intUtil[_0xf5dd('0x3b')](_0x264afd['Subjects'],_0x5b1dfa,'\x20'),'description':intUtil['getString'](_0x264afd[_0xf5dd('0x3c')],_0x5b1dfa,'\x0a')},getCustomFields(_0x264afd[_0xf5dd('0x3d')],_0x5b1dfa)),'auth':_0x1080a7,'json':!![]};return rp(_0x1e5da8)[_0xf5dd('0x10')](function(_0x5b09c7){logger[_0xf5dd('0x19')]('['+[_0xec280c[_0xf5dd('0x17')]()]+_0xf5dd('0x3e'),_0x5b09c7[_0xf5dd('0x13')]);_0x403ed8[_0xf5dd('0x3f')]=_0x5b09c7[_0xf5dd('0x13')][_0xf5dd('0x1f')];_0x403ed8['ticketNumber']=_0x5b09c7[_0xf5dd('0x13')]['number'];logger[_0xf5dd('0x19')]('['+[_0xec280c[_0xf5dd('0x17')]()]+_0xf5dd('0x40'),_0x403ed8);_0x7edd17(_0x403ed8);})[_0xf5dd('0x15')](function(_0x217a46){logger[_0xf5dd('0x16')]('['+[_0xec280c[_0xf5dd('0x17')]()]+']',_0x217a46['message']);_0x13c763(_0x217a46[_0xf5dd('0x18')]);});});};}function createRemoteTag(_0x6c8f4b,_0x3044a0,_0x48e897,_0x338b85){return new Promise(function(_0x299189,_0x32fd9c){var _0x3f9c4c={'method':'POST','uri':_0x48e897+_0xf5dd('0x41')+'?'+_0x338b85,'body':{'short_description':_0x6c8f4b,'global':!![],'active':!![],'name':_0x6c8f4b},'auth':_0x3044a0,'json':!![]};return rp(_0x3f9c4c)[_0xf5dd('0x10')](function(_0x243b3a){var _0x37b209=_0x243b3a[_0xf5dd('0x13')][_0xf5dd('0x1f')];_0x299189(_0x37b209);});});}function getRemoteTag(_0x346917,_0x32092f,_0x3ac898,_0x497fef,_0x522ab9){return new Promise(function(_0x43ae20,_0x20dcf2){var _0x15dcf7={'method':_0xf5dd('0xe'),'uri':_0x3ac898+_0xf5dd('0x41')+_0xf5dd('0x42')+_0x346917+'&'+_0x497fef,'auth':_0x32092f,'json':!![]};return rp(_0x15dcf7)[_0xf5dd('0x10')](function(_0x47ebdd){if(_0x47ebdd[_0xf5dd('0x13')][_0xf5dd('0x11')]>0x0){var _0x55eda0=_0x47ebdd[_0xf5dd('0x13')][0x0]['sys_id'];_0x43ae20(_0x55eda0);}else{return createRemoteTag(_0x346917,_0x32092f,_0x3ac898,_0x497fef)['then'](function(_0x365bfe){_0x43ae20(_0x365bfe);});}});});}function assignTagToIncident(_0x448cb3,_0x5e0e45,_0x12ee45,_0xfc44a,_0x28be1e){return new Promise(function(_0xf256b,_0x5c609d){var _0x40484a={'method':_0xf5dd('0x25'),'uri':_0x12ee45+_0xf5dd('0x43')+'?'+_0x28be1e,'body':{'label':_0x448cb3,'table':'incident','id_type':_0xf5dd('0x44'),'table_key':_0xfc44a['ticketId'],'title':_0xf5dd('0x45')+_0xfc44a[_0xf5dd('0x46')],'id_display':_0xfc44a[_0xf5dd('0x46')]},'auth':_0x5e0e45,'json':!![]};return rp(_0x40484a)[_0xf5dd('0x10')](function(_0x5013e7){_0xf256b();})[_0xf5dd('0x15')](function(){_0xf256b();});});}function manageTags(_0x13bc4f,_0x5347f0,_0x1ad28e,_0x4f80a1,_0x624c14,_0x2eff65,_0x1d6006){return new Promise(function(_0x41b3e8,_0x426418){var _0x4b9aea=[];_0x5347f0[_0xf5dd('0x2b')](function(_0x11ef06){_0x4b9aea['push'](getRemoteTag(_0x11ef06,_0x1ad28e,_0x4f80a1,_0x2eff65,_0x1d6006));});return Promise[_0xf5dd('0x47')](_0x4b9aea)['then'](function(_0x146e14){if(_0x146e14[_0xf5dd('0x11')]){logger['info']('['+[_0x13bc4f[_0xf5dd('0x17')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x146e14);var _0xae43ca=[];_0x146e14['forEach'](function(_0x3df0b5){_0xae43ca[_0xf5dd('0x48')](assignTagToIncident(_0x3df0b5,_0x1ad28e,_0x4f80a1,_0x624c14,_0x2eff65));});return Promise[_0xf5dd('0x47')](_0xae43ca)[_0xf5dd('0x10')](function(){_0x41b3e8();})['catch'](function(){_0x41b3e8();});}else{_0x41b3e8();}});});}function getTags(_0x459b47,_0x5b1cdd,_0x17b908,_0x25935c,_0x1ae267,_0x32ab7f){return function(_0x5b179a){return new Promise(function(_0x5f534b,_0x4d664b){var _0x1be3e8=[];var _0x2b6a05=_0x25935c[_0xf5dd('0x49')];if(_0x2b6a05&&_0x2b6a05[_0xf5dd('0x11')]>0x0){_0x1be3e8=_[_0xf5dd('0x4a')](_0x2b6a05,_0xf5dd('0x37'));}if(_0x1be3e8[_0xf5dd('0x11')]>0x0){return manageTags(_0x459b47,_0x1be3e8,_0x5b1cdd,_0x17b908,_0x5b179a,_0x1ae267,_0x32ab7f)[_0xf5dd('0x10')](function(){_0x5f534b(_0x5b179a);});}else{_0x5f534b(_0x5b179a);}});};}function emit(_0x4b4c7e,_0x2d8bb5,_0x30112b){var _0xf6719=_0xf5dd('0x4b')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xf5dd('0x4c')+_0xf5dd('0x4d');var _0xe260b7={'uri':_0x4b4c7e+_0xf5dd('0x4e')+_0x30112b+_0xf6719};io['to'](util['format'](_0xf5dd('0x4f'),_0x2d8bb5))['emit'](_0xf5dd('0x50'),_0xe260b7);}exports['cs']=function(_0xce808f,_0x3ebb62,_0x18880d,_0x24b171,_0x533a7c,_0x4927da,_0xf8e246,_0x4f2090){var _0x3bfa46={};var _0x436022={'user':_0x4927da[_0xf5dd('0x51')],'pass':_0x4927da['password']};var _0x22ff93='sysparm_limit=1';var _0x469d7c=_0xf5dd('0x52');_0x4927da['remoteUri']=intUtil['stripTrailingSlash'](_0x4927da[_0xf5dd('0x53')]);_0x4927da[_0xf5dd('0x54')]=intUtil['stripTrailingSlash'](_0x4927da[_0xf5dd('0x54')]);var _0x1b1161=util['format']('%s/api/now/table/',_0x4927da[_0xf5dd('0x53')]);_0x3bfa46[_0xf5dd('0x1a')]=!_[_0xf5dd('0x55')](_0x24b171)?_0x24b171[_0xf5dd('0x56')]:null;_0x3bfa46['adminEmail']=_0x4927da[_0xf5dd('0x56')];_0x3bfa46[_0xf5dd('0x27')]=_0x4f2090['toLowerCase']()===_0xf5dd('0x57')?_0x3ebb62[_0xf5dd('0x58')]:_0x3ebb62[_0xf5dd('0x59')];_0x3bfa46[_0xf5dd('0x5a')]=_0x4f2090===_0xf5dd('0x5b')||_0x4f2090==='unmanaged'?'queue':_0xf5dd('0x57');var _0x5dafba=util[_0xf5dd('0x5c')](_0xf5dd('0x5d'),_0x4927da[_0xf5dd('0x54')],_0x3ebb62[_0xf5dd('0x5e')],md5(_0x3ebb62[_0xf5dd('0x5e')]));if(_0x533a7c&&_0x533a7c['monitor_format']){logger[_0xf5dd('0x19')](_0xf5dd('0x5f'),_0xf5dd('0x60'));_0x3ebb62[_0xf5dd('0x61')]=_0x5dafba;}else if(_0xf8e246&&_0xf8e246['recordingFormat']&&_0xf8e246[_0xf5dd('0x62')]!=='none'){logger[_0xf5dd('0x19')](_0xf5dd('0x63'),_0xf5dd('0x60'));_0x3ebb62['recordingURL']=_0x5dafba;}else{_0x3ebb62[_0xf5dd('0x61')]='';}return getAdminUser(_0x4f2090,_0x436022,_0x3bfa46,_0x1b1161,_0x469d7c,_0x22ff93)[_0xf5dd('0x10')](getUser(_0x4f2090,_0x436022,_0x1b1161,_0x469d7c,_0x22ff93))['then'](getEndUser(_0x4f2090,_0x436022,_0x1b1161,_0x469d7c,_0x22ff93))[_0xf5dd('0x10')](getTicket(_0x4f2090,_0x436022,_0x1b1161,_0x18880d,_0x3ebb62,_0x469d7c))[_0xf5dd('0x10')](function(_0x3c67f7){logger[_0xf5dd('0x19')](util[_0xf5dd('0x5c')](_0xf5dd('0x64'),_0x3c67f7['ticketId']));logger[_0xf5dd('0x19')](util[_0xf5dd('0x5c')]('call\x20direction:\x20%s',_0x4f2090));if(_0x4f2090!==_0xf5dd('0x65')){logger[_0xf5dd('0x19')]('['+[_0x4f2090[_0xf5dd('0x17')]()]+']',_0xf5dd('0x66'));emit(_0x4927da['remoteUri'],_0x24b171['name'],_0x3c67f7[_0xf5dd('0x3f')]);}})[_0xf5dd('0x15')](function(_0x46ff0d){logger[_0xf5dd('0x16')]('['+[_0x4f2090[_0xf5dd('0x17')]()]+_0xf5dd('0x67'),util['inspect'](_0x46ff0d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9a29=['],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','picklist','type','nameField','customField','toLowerCase','content','toString','includes','string','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','all','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','localhost','socket.io-emitter','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','adminId','adminEmail'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x9a29,0x12b));var _0x99a2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9a29[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var Promise=require(_0x99a2('0x0'));var rp=require('request-promise');var util=require(_0x99a2('0x1'));var md5=require(_0x99a2('0x2'));var Redis=require('ioredis');var intUtil=require(_0x99a2('0x3'));var config=require(_0x99a2('0x4'));var logger=require(_0x99a2('0x5'))(_0x99a2('0x6'));config['redis']=_[_0x99a2('0x7')](config['redis'],{'host':_0x99a2('0x8'),'port':0x18eb});var io=require(_0x99a2('0x9'))(new Redis(config[_0x99a2('0xa')]));function getAdminUser(_0x76cf87,_0x2b2dd9,_0x1a12f4,_0x3400e4,_0x1639d9,_0x134ea2){return new Promise(function(_0x470900,_0x19846f){var _0x1337fd={'method':_0x99a2('0xb'),'uri':_0x3400e4+_0x99a2('0xc')+'&'+_0x1639d9+'&'+_0x134ea2,'auth':_0x2b2dd9,'json':!![]};return rp(_0x1337fd)[_0x99a2('0xd')](function(_0x18933d){if(_0x18933d[_0x99a2('0xe')][_0x99a2('0xf')]>0x0){_0x1a12f4['adminId']=_0x18933d[_0x99a2('0xe')][0x0][_0x99a2('0x10')];}logger[_0x99a2('0x11')]('['+[_0x76cf87[_0x99a2('0x12')]()]+_0x99a2('0x13'),_0x1a12f4);_0x470900(_0x1a12f4);})[_0x99a2('0x14')](function(_0x1a7991){logger[_0x99a2('0x15')]('['+[_0x76cf87[_0x99a2('0x12')]()]+']',_0x1a7991[_0x99a2('0x16')]);_0x19846f(_0x1a7991['message']);});});}function getUser(_0x334b13,_0x494fbb,_0xbfd5,_0x2576cf,_0x55167d){return function(_0x14ecad){logger[_0x99a2('0x11')]('['+[_0x334b13[_0x99a2('0x12')]()]+_0x99a2('0x17'),_0x14ecad);return new Promise(function(_0x55a0c1,_0x1d583b){if(intUtil['validateEmail'](_0x14ecad[_0x99a2('0x18')])){var _0x55c957={'method':_0x99a2('0xb'),'uri':_0xbfd5+_0x99a2('0x19')+_0x14ecad['userEmail']+'&'+_0x2576cf+'&'+_0x55167d,'auth':_0x494fbb,'json':!![]};logger[_0x99a2('0x11')]('['+[_0x334b13['toUpperCase']()]+_0x99a2('0x1a'),_0x55c957);return rp(_0x55c957)['then'](function(_0x2f6aff){logger[_0x99a2('0x11')]('['+[_0x334b13[_0x99a2('0x12')]()]+'],\x20getUser\x20entity',_0x2f6aff);if(_0x2f6aff[_0x99a2('0xe')]['length']>0x0&&String(_0x2f6aff[_0x99a2('0xe')][0x0][_0x99a2('0x1b')])===_0x99a2('0x1c')){_0x14ecad['userId']=_0x2f6aff[_0x99a2('0xe')][0x0][_0x99a2('0x10')];}else{_0x14ecad['userId']=_0x14ecad[_0x99a2('0x1d')];_0x14ecad['userEmail']=_0x14ecad[_0x99a2('0x1e')];}logger[_0x99a2('0x11')]('['+[_0x334b13['toUpperCase']()]+_0x99a2('0x1f'),_0x14ecad);_0x55a0c1(_0x14ecad);})[_0x99a2('0x14')](function(_0xc7ed5d){logger[_0x99a2('0x15')]('['+[_0x334b13[_0x99a2('0x12')]()]+']',_0xc7ed5d[_0x99a2('0x16')]);_0x1d583b(_0xc7ed5d[_0x99a2('0x16')]);});}else{logger[_0x99a2('0x11')]('['+[_0x334b13[_0x99a2('0x12')]()]+_0x99a2('0x20'));_0x14ecad[_0x99a2('0x21')]=_0x14ecad[_0x99a2('0x1d')];_0x14ecad[_0x99a2('0x18')]=_0x14ecad[_0x99a2('0x1e')];_0x55a0c1(_0x14ecad);}});};}function createEndUser(_0x1ae519,_0x3610c9,_0x300f2f,_0x259226,_0x4fcf0f){logger[_0x99a2('0x11')]('['+[_0x1ae519['toUpperCase']()]+_0x99a2('0x22'),_0x300f2f);return new Promise(function(_0x1640af,_0x347214){var _0x5bbbf8={'method':_0x99a2('0x23'),'uri':_0x259226+'sys_user?'+_0x4fcf0f,'body':{'user_name':_0x300f2f[_0x99a2('0x24')],'roles':_0x99a2('0x25'),'first_name':_0x300f2f[_0x99a2('0x24')],'active':_0x99a2('0x1c'),'date_format':'System','phone':_0x300f2f[_0x99a2('0x24')]},'auth':_0x3610c9,'json':!![]};return rp(_0x5bbbf8)[_0x99a2('0xd')](function(_0x3aa737){logger[_0x99a2('0x11')]('['+[_0x1ae519[_0x99a2('0x12')]()]+_0x99a2('0x26'),_0x3aa737[_0x99a2('0xe')]);_0x300f2f['endUserId']=_0x3aa737[_0x99a2('0xe')][_0x99a2('0x10')];_0x1640af(_0x300f2f);})[_0x99a2('0x14')](function(_0x3cfa51){logger['error']('['+[_0x1ae519[_0x99a2('0x12')]()]+']',_0x3cfa51[_0x99a2('0x16')]);_0x347214(_0x3cfa51['message']);});});}function getEndUser(_0x546e92,_0x345ea7,_0x263ab8,_0x25f74d,_0x4c8957){return function(_0x550b93){logger[_0x99a2('0x11')]('['+[_0x546e92[_0x99a2('0x12')]()]+_0x99a2('0x27'),_0x550b93);return new Promise(function(_0x77b3d5,_0x528272){var _0x5146ab={'method':_0x99a2('0xb'),'uri':_0x263ab8+'sys_user?sysparm_query=phone%3D'+_0x550b93['endUserNumber']+'&'+_0x25f74d+'&'+_0x4c8957,'auth':_0x345ea7,'json':!![]};return rp(_0x5146ab)[_0x99a2('0xd')](function(_0x2d2785){if(_0x2d2785[_0x99a2('0xe')][_0x99a2('0xf')]>0x0){_0x550b93[_0x99a2('0x28')]=_0x2d2785[_0x99a2('0xe')][0x0]['sys_id'];logger[_0x99a2('0x11')]('['+[_0x546e92[_0x99a2('0x12')]()]+_0x99a2('0x29'),_0x550b93);_0x77b3d5(_0x550b93);}else{return createEndUser(_0x546e92,_0x345ea7,_0x550b93,_0x263ab8,_0x25f74d)[_0x99a2('0xd')](function(_0x2130cb){logger[_0x99a2('0x11')]('['+[_0x546e92[_0x99a2('0x12')]()]+_0x99a2('0x2a'),_0x2130cb);_0x77b3d5(_0x2130cb);});}})[_0x99a2('0x14')](function(_0x410a99){logger[_0x99a2('0x15')]('['+[_0x546e92['toUpperCase']()]+']',_0x410a99[_0x99a2('0x16')]);_0x528272(_0x410a99[_0x99a2('0x16')]);});});};}function getCustomFields(_0x5a3597,_0x5fa445){var _0x5418c0={};if(_0x5a3597['length']>0x0){_[_0x99a2('0x2b')](_0x5a3597,function(_0x127dac){if(_['includes'](['string',_0x99a2('0x2c')],_0x127dac[_0x99a2('0x2d')])&&_0x127dac[_0x99a2('0x2e')]&&!_0x127dac[_0x99a2('0x2f')]){_0x5418c0[_0x127dac['nameField'][_0x99a2('0x30')]()]=_0x127dac[_0x99a2('0x31')][_0x99a2('0x32')]();}else if(_[_0x99a2('0x33')]([_0x99a2('0x34'),_0x99a2('0x2c')],_0x127dac[_0x99a2('0x2d')])&&_0x127dac[_0x99a2('0x35')]&&_0x127dac['customField']){_0x5418c0[_0x127dac['idField'][_0x99a2('0x30')]()]=_0x127dac['content'][_0x99a2('0x32')]();}else if(_0x127dac[_0x99a2('0x2d')]===_0x99a2('0x36')&&_0x127dac[_0x99a2('0x37')]&&_0x127dac[_0x99a2('0x35')]&&_0x127dac[_0x99a2('0x2f')]){_0x5418c0[_0x127dac[_0x99a2('0x35')][_0x99a2('0x30')]()]=_0x5fa445[_0x127dac['variableName']]['toString']();}else if(_0x127dac[_0x99a2('0x2d')]===_0x99a2('0x38')&&_0x127dac[_0x99a2('0x39')]&&_0x127dac['Variable'][_0x99a2('0x3a')]&&_0x127dac[_0x99a2('0x35')]&&_0x127dac[_0x99a2('0x2f')]){_0x5418c0[_0x127dac[_0x99a2('0x35')][_0x99a2('0x30')]()]=_0x5fa445[_0x127dac['Variable'][_0x99a2('0x3a')][_0x99a2('0x30')]()]['toString']();}});}return _0x5418c0;}function getTicket(_0x40b2f4,_0xa1f8af,_0x16230f,_0x50ccf2,_0x237ff4,_0x651e7a){return function(_0x3a2cad){logger[_0x99a2('0x11')]('['+[_0x40b2f4[_0x99a2('0x12')]()]+_0x99a2('0x3b'),_0x3a2cad);return new Promise(function(_0x3fb3c9,_0x5c7c8e){var _0x4e935d=_0x40b2f4[_0x99a2('0x30')]()===_0x99a2('0x3c')?_0x3a2cad[_0x99a2('0x21')]:_0x3a2cad[_0x99a2('0x28')];var _0x3b226a={'method':_0x99a2('0x23'),'uri':_0x16230f+'incident'+'?'+_0x651e7a,'body':Object['assign']({},{'active':_0x99a2('0x1c'),'caller_id':_0x4e935d,'assigned_to':_0x3a2cad['userId'],'short_description':intUtil[_0x99a2('0x3d')](_0x50ccf2[_0x99a2('0x3e')],_0x237ff4,'\x20'),'description':intUtil[_0x99a2('0x3d')](_0x50ccf2['Descriptions'],_0x237ff4,'\x0a')},getCustomFields(_0x50ccf2[_0x99a2('0x3f')],_0x237ff4)),'auth':_0xa1f8af,'json':!![]};return rp(_0x3b226a)['then'](function(_0x5cedd1){logger['info']('['+[_0x40b2f4['toUpperCase']()]+_0x99a2('0x40'),_0x5cedd1['result']);_0x3a2cad[_0x99a2('0x41')]=_0x5cedd1[_0x99a2('0xe')][_0x99a2('0x10')];_0x3a2cad[_0x99a2('0x42')]=_0x5cedd1['result'][_0x99a2('0x43')];logger[_0x99a2('0x11')]('['+[_0x40b2f4['toUpperCase']()]+_0x99a2('0x44'),_0x3a2cad);_0x3fb3c9(_0x3a2cad);})['catch'](function(_0x1693fe){logger[_0x99a2('0x15')]('['+[_0x40b2f4[_0x99a2('0x12')]()]+']',_0x1693fe[_0x99a2('0x16')]);_0x5c7c8e(_0x1693fe['message']);});});};}function createRemoteTag(_0x5488aa,_0x4f1c57,_0x29d739,_0x154a9b){return new Promise(function(_0x153525,_0x29f60c){var _0x5d5e7a={'method':_0x99a2('0x23'),'uri':_0x29d739+_0x99a2('0x45')+'?'+_0x154a9b,'body':{'short_description':_0x5488aa,'global':!![],'active':!![],'name':_0x5488aa},'auth':_0x4f1c57,'json':!![]};return rp(_0x5d5e7a)[_0x99a2('0xd')](function(_0xf43a6a){var _0x2e9d3a=_0xf43a6a[_0x99a2('0xe')][_0x99a2('0x10')];_0x153525(_0x2e9d3a);});});}function getRemoteTag(_0x56f7c6,_0x24c1ee,_0x9f1b69,_0x37fb8e,_0xb7073){return new Promise(function(_0x4a9cba,_0x4ee0b2){var _0x5a3e04={'method':_0x99a2('0xb'),'uri':_0x9f1b69+_0x99a2('0x45')+'?sysparm_query=name%3D'+_0x56f7c6+'&'+_0x37fb8e,'auth':_0x24c1ee,'json':!![]};return rp(_0x5a3e04)['then'](function(_0x1658d1){if(_0x1658d1[_0x99a2('0xe')]['length']>0x0){var _0x53748e=_0x1658d1[_0x99a2('0xe')][0x0][_0x99a2('0x10')];_0x4a9cba(_0x53748e);}else{return createRemoteTag(_0x56f7c6,_0x24c1ee,_0x9f1b69,_0x37fb8e)[_0x99a2('0xd')](function(_0x215af2){_0x4a9cba(_0x215af2);});}});});}function assignTagToIncident(_0x4d28d6,_0x41355b,_0x188713,_0x51e2de,_0x50f31c){return new Promise(function(_0x19a039,_0x202713){var _0x4b415f={'method':_0x99a2('0x23'),'uri':_0x188713+_0x99a2('0x46')+'?'+_0x50f31c,'body':{'label':_0x4d28d6,'table':_0x99a2('0x47'),'id_type':_0x99a2('0x48'),'table_key':_0x51e2de[_0x99a2('0x41')],'title':_0x99a2('0x49')+_0x51e2de[_0x99a2('0x42')],'id_display':_0x51e2de[_0x99a2('0x42')]},'auth':_0x41355b,'json':!![]};return rp(_0x4b415f)[_0x99a2('0xd')](function(_0x4961a8){_0x19a039();})[_0x99a2('0x14')](function(){_0x19a039();});});}function manageTags(_0xa0bdb9,_0x26277e,_0x40918e,_0x534d88,_0x23bc89,_0x1b4a30,_0x1254d8){return new Promise(function(_0x2392e5,_0x36fea2){var _0x25afbf=[];_0x26277e[_0x99a2('0x2b')](function(_0x5625f1){_0x25afbf['push'](getRemoteTag(_0x5625f1,_0x40918e,_0x534d88,_0x1b4a30,_0x1254d8));});return Promise[_0x99a2('0x4a')](_0x25afbf)[_0x99a2('0xd')](function(_0x11f6f4){if(_0x11f6f4['length']){logger[_0x99a2('0x11')]('['+[_0xa0bdb9[_0x99a2('0x12')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x11f6f4);var _0xd15e36=[];_0x11f6f4[_0x99a2('0x2b')](function(_0x8f21ff){_0xd15e36[_0x99a2('0x4b')](assignTagToIncident(_0x8f21ff,_0x40918e,_0x534d88,_0x23bc89,_0x1b4a30));});return Promise[_0x99a2('0x4a')](_0xd15e36)['then'](function(){_0x2392e5();})['catch'](function(){_0x2392e5();});}else{_0x2392e5();}});});}function getTags(_0x5398e0,_0x3ad1d4,_0x150205,_0x4f8548,_0x318e28,_0x46a693){return function(_0x22febd){return new Promise(function(_0x3c99e0,_0x4982ec){var _0x13f846=[];var _0x192f8f=_0x4f8548[_0x99a2('0x4c')];if(_0x192f8f&&_0x192f8f[_0x99a2('0xf')]>0x0){_0x13f846=_[_0x99a2('0x4d')](_0x192f8f,_0x99a2('0x3a'));}if(_0x13f846['length']>0x0){return manageTags(_0x5398e0,_0x13f846,_0x3ad1d4,_0x150205,_0x22febd,_0x318e28,_0x46a693)[_0x99a2('0xd')](function(){_0x3c99e0(_0x22febd);});}else{_0x3c99e0(_0x22febd);}});};}function emit(_0x20eabc,_0x47a6f9,_0xb06a53){var _0x18f5fd=_0x99a2('0x4e')+_0x99a2('0x4f')+_0x99a2('0x50')+_0x99a2('0x51');var _0x5e2b3a={'uri':_0x20eabc+_0x99a2('0x52')+_0xb06a53+_0x18f5fd};io['to'](util['format']('user:%s',_0x47a6f9))[_0x99a2('0x53')](_0x99a2('0x54'),_0x5e2b3a);}exports['cs']=function(_0x3bd32f,_0x2cc52a,_0x26e5cb,_0x567b39,_0xf53cce,_0x5a86d2,_0x2c428f,_0x177146){var _0x463698={};var _0x27a0a2={'user':_0x5a86d2['username'],'pass':_0x5a86d2['password']};var _0x4ff53e='sysparm_limit=1';var _0x45d9d3=_0x99a2('0x55');_0x5a86d2[_0x99a2('0x56')]=intUtil[_0x99a2('0x57')](_0x5a86d2[_0x99a2('0x56')]);_0x5a86d2['serverUrl']=intUtil[_0x99a2('0x57')](_0x5a86d2[_0x99a2('0x58')]);var _0x4587f1=util[_0x99a2('0x59')](_0x99a2('0x5a'),_0x5a86d2[_0x99a2('0x56')]);_0x463698['userEmail']=!_[_0x99a2('0x5b')](_0x567b39)?_0x567b39[_0x99a2('0x5c')]:null;_0x463698['adminEmail']=_0x5a86d2[_0x99a2('0x5c')];_0x463698[_0x99a2('0x24')]=_0x177146[_0x99a2('0x30')]()===_0x99a2('0x3c')?_0x2cc52a[_0x99a2('0x5d')]:_0x2cc52a[_0x99a2('0x5e')];_0x463698[_0x99a2('0x5f')]=_0x177146===_0x99a2('0x60')||_0x177146==='unmanaged'?_0x99a2('0x60'):_0x99a2('0x3c');var _0x4a2ab4=util[_0x99a2('0x59')](_0x99a2('0x61'),_0x5a86d2[_0x99a2('0x58')],_0x2cc52a[_0x99a2('0x62')],md5(_0x2cc52a[_0x99a2('0x62')]));if(_0xf53cce&&_0xf53cce['monitor_format']){logger[_0x99a2('0x11')]('[QUEUE]',_0x99a2('0x63'));_0x2cc52a[_0x99a2('0x64')]=_0x4a2ab4;}else if(_0x2c428f&&_0x2c428f['recordingFormat']&&_0x2c428f[_0x99a2('0x65')]!==_0x99a2('0x66')){logger[_0x99a2('0x11')](_0x99a2('0x67'),'Recording\x20is\x20enabled!');_0x2cc52a[_0x99a2('0x64')]=_0x4a2ab4;}else{_0x2cc52a[_0x99a2('0x64')]='';}return getAdminUser(_0x177146,_0x27a0a2,_0x463698,_0x4587f1,_0x45d9d3,_0x4ff53e)['then'](getUser(_0x177146,_0x27a0a2,_0x4587f1,_0x45d9d3,_0x4ff53e))['then'](getEndUser(_0x177146,_0x27a0a2,_0x4587f1,_0x45d9d3,_0x4ff53e))[_0x99a2('0xd')](getTicket(_0x177146,_0x27a0a2,_0x4587f1,_0x26e5cb,_0x2cc52a,_0x45d9d3))[_0x99a2('0xd')](function(_0x516afb){logger[_0x99a2('0x11')](util[_0x99a2('0x59')](_0x99a2('0x68'),_0x516afb[_0x99a2('0x41')]));logger[_0x99a2('0x11')](util[_0x99a2('0x59')](_0x99a2('0x69'),_0x177146));if(_0x177146!==_0x99a2('0x6a')){logger[_0x99a2('0x11')]('['+[_0x177146[_0x99a2('0x12')]()]+']',_0x99a2('0x6b'));emit(_0x5a86d2[_0x99a2('0x56')],_0x567b39['name'],_0x516afb['ticketId']);}})[_0x99a2('0x14')](function(_0x5da439){logger[_0x99a2('0x15')]('['+[_0x177146[_0x99a2('0x12')]()]+_0x99a2('0x6c'),util[_0x99a2('0x6d')](_0x5da439,{'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 e8bf79d..601dfde 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 _0x5474=['getString','Subjects','created_by','description','date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','set_entry','JSON','stringify','format','Basic\x20%s','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','entry_list','name_value_list','user_name','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Enduser\x20created.','debug','[HTTP]','merge','type','nameField','customField','toLowerCase','string','idField','custom_fields','customVariable','Variable','login','username','password','PLAIN','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','users','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','error','unmanaged','lastevent','calleridname','catch','toUpperCase','lodash','request-promise','md5','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','name'];(function(_0x2ec4bf,_0x402cff){var _0x5b965f=function(_0x2c62d6){while(--_0x2c62d6){_0x2ec4bf['push'](_0x2ec4bf['shift']());}};_0x5b965f(++_0x402cff);}(_0x5474,0x1ce));var _0x4547=function(_0x59c4e0,_0x5c4520){_0x59c4e0=_0x59c4e0-0x0;var _0x418d9b=_0x5474[_0x59c4e0];return _0x418d9b;};'use strict';var _=require(_0x4547('0x0'));var rp=require(_0x4547('0x1'));var BPromise=require('bluebird');var md5=require(_0x4547('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x4547('0x3'));var config=require(_0x4547('0x4'));var logger=require('../../../../config/logger')(_0x4547('0x5'));config[_0x4547('0x6')]=_[_0x4547('0x7')](config[_0x4547('0x6')],{'host':_0x4547('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4547('0x6')]));var def={'method':_0x4547('0x9'),'json':!![]};function emit(_0x26017a,_0x38e048,_0x3dfa3d){io['to'](_0x26017a)[_0x4547('0xa')](_0x38e048,_0x3dfa3d);}function getTicket(_0xddd869,_0x26816e,_0x19f9db,_0x4c06f9,_0x5daa91,_0x34dfbd,_0x1c4638,_0xe07bd2){logger[_0x4547('0xb')](_0x4547('0xc'));var _0x5a90d5=new Date();var _0x25f541=[{'name':_0x4547('0xd'),'value':intUtil[_0x4547('0xe')](_0x4c06f9[_0x4547('0xf')],_0x5daa91,'\x20')},{'name':'assigned_user_id','value':_0x26816e['id']},{'name':_0x4547('0x10'),'value':_0x26816e['id']},{'name':_0x4547('0x11'),'value':intUtil['getString'](_0x4c06f9['Descriptions'],_0x5daa91,'\x0a')},{'name':_0x4547('0x12'),'value':_0x5a90d5[_0x4547('0x13')]()[_0x4547('0x14')](0x0,0x13)[_0x4547('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x4547('0x16'),'value':'15'},{'name':_0x4547('0x17'),'value':_0x19f9db['id']},{'name':_0x4547('0x18'),'value':_0x4547('0x19')},{'name':_0x4547('0x1a'),'value':_0x19f9db['name']},{'name':_0x4547('0x1b'),'value':_0xe07bd2}];if(_0x34dfbd[_0x4547('0x1c')]){_[_0x4547('0x1d')](_0x34dfbd,function(_0x30d7be){if(_0x5daa91[_0x30d7be[_0x4547('0x1e')]]){_0x25f541[_0x4547('0x1f')]({'name':_0x30d7be['idField'],'value':_0x5daa91[_0x30d7be['variableName']]});}});}return request({'form':{'method':_0x4547('0x20'),'input_type':_0x4547('0x21'),'response_type':_0x4547('0x21'),'rest_data':JSON[_0x4547('0x22')]({'session':_0x1c4638['id'],'module_name':'Calls','name_value_list':_0x25f541})}});}function getAuth(_0xed3e32){return util[_0x4547('0x23')](_0x4547('0x24'),new Buffer(_0xed3e32[_0x4547('0x25')]+':X')[_0x4547('0x26')](_0x4547('0x27')));}function getServerInfo(_0x498576){return request({'form':{'method':_0x4547('0x28'),'input_type':_0x4547('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x498576['id']})}});}function getUser(_0x666f4a,_0x24485d,_0x12e3d){if(!_[_0x4547('0x29')](_0x24485d)){logger[_0x4547('0xb')](_0x4547('0x2a'),_0x24485d);return request({'form':{'method':_0x4547('0x2b'),'input_type':_0x4547('0x21'),'response_type':_0x4547('0x21'),'rest_data':JSON[_0x4547('0x22')]({'session':_0x12e3d['id'],'module_name':'Employees','query':util[_0x4547('0x23')](_0x4547('0x2c'),_0x24485d),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4a753d){if(_0x4a753d['entry_list'][_0x4547('0x1c')]){var _0x220eb2=_['find'](_0x4a753d[_0x4547('0x2d')],function(_0x4c7603){return _0x4c7603[_0x4547('0x2e')][_0x4547('0x2f')][_0x4547('0x30')]===_0x24485d;});if(_0x220eb2){logger[_0x4547('0xb')]('Agent\x20found!');return BPromise[_0x4547('0x31')]({'id':_0x220eb2[_0x4547('0x2e')]['id']['value'],'name':_0x220eb2[_0x4547('0x2e')][_0x4547('0xd')][_0x4547('0x30')]});}}logger[_0x4547('0xb')](_0x4547('0x32'));return BPromise['resolve']({'id':_0x12e3d[_0x4547('0x2e')][_0x4547('0x33')][_0x4547('0x30')],'name':_0x12e3d[_0x4547('0x2e')][_0x4547('0x2f')][_0x4547('0x30')]});});}else{logger[_0x4547('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x4547('0x31')]({'id':_0x12e3d[_0x4547('0x2e')][_0x4547('0x33')][_0x4547('0x30')],'name':_0x12e3d[_0x4547('0x2e')]['user_name'][_0x4547('0x30')]});}}function getEndUser(_0x29d313,_0x43e7e5,_0x3e03d5,_0x5f5c34){logger[_0x4547('0xb')](_0x4547('0x34'),_0x3e03d5);return request({'form':{'method':_0x4547('0x2b'),'input_type':'JSON','response_type':_0x4547('0x21'),'rest_data':JSON[_0x4547('0x22')]({'session':_0x5f5c34['id'],'module_name':_0x4547('0x19'),'query':util[_0x4547('0x23')](_0x4547('0x35'),_0x3e03d5),'order_by':'','offset':'0','select_fields':['id',_0x4547('0xd'),_0x4547('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4547('0x37')](function(_0x1eead0){if(_0x1eead0[_0x4547('0x2d')]['length']){var _0x16056a=_[_0x4547('0x38')](_0x1eead0[_0x4547('0x2d')],function(_0x51dff0){return _0x51dff0[_0x4547('0x2e')]['phone_home'][_0x4547('0x30')]===_0x3e03d5;});if(_0x16056a){logger[_0x4547('0xb')](_0x4547('0x39'));return BPromise[_0x4547('0x31')]({'id':_0x16056a[_0x4547('0x2e')]['id'][_0x4547('0x30')],'name':_0x16056a[_0x4547('0x2e')]['name'][_0x4547('0x30')],'phone':_0x16056a[_0x4547('0x2e')][_0x4547('0x36')][_0x4547('0x30')]});}}else{logger['info'](_0x4547('0x3a'));return request({'form':{'method':_0x4547('0x20'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x5f5c34['id'],'module_name':_0x4547('0x19'),'name_value_list':[{'name':_0x4547('0x3b'),'value':_0x43e7e5!==''?_0x43e7e5:util[_0x4547('0x23')]('Caller\x20-\x20%s',_0x3e03d5)},{'name':_0x4547('0x36'),'value':_0x3e03d5}]})}})[_0x4547('0x37')](function(_0x1ba81d){logger[_0x4547('0xb')](_0x4547('0x3c'));return BPromise[_0x4547('0x31')]({'id':_0x1ba81d['id'],'name':_0x1ba81d['entry_list'][_0x4547('0x3b')][_0x4547('0x30')],'phone':_0x1ba81d[_0x4547('0x2d')]['phone_home'][_0x4547('0x30')]});});}});}function request(_0x16dd17){logger[_0x4547('0x3d')](_0x4547('0x3e'),JSON[_0x4547('0x22')](_0x16dd17));return rp(_[_0x4547('0x3f')](def,_0x16dd17));}function getTags(_0x3ad3aa,_0x125bdf){var _0x53f523=[];if(_0x3ad3aa&&_0x3ad3aa[_0x4547('0x1c')]>0x0){_0x53f523=_['map'](_0x3ad3aa,_0x125bdf);}return _0x53f523;}function getCustomFields(_0x1d1eec,_0x2f5a2d){var _0x2e9e70=[];var _0x1b8f34={'custom_fields':[]};if(_0x1d1eec[_0x4547('0x1c')]>0x0){_[_0x4547('0x1d')](_0x1d1eec,function(_0x44598b){if(_0x44598b[_0x4547('0x40')]==='string'&&_0x44598b[_0x4547('0x41')]&&!_0x44598b[_0x4547('0x42')]){_0x1b8f34[_0x44598b[_0x4547('0x41')][_0x4547('0x43')]()]=_0x44598b['content'][_0x4547('0x26')]();}else if(_0x44598b['type']===_0x4547('0x44')&&_0x44598b[_0x4547('0x45')]&&_0x44598b['customField']){_0x1b8f34[_0x4547('0x46')][_0x4547('0x1f')]({'id':_0x44598b[_0x4547('0x45')],'value':_0x44598b['content'][_0x4547('0x26')]()});}else if(_0x44598b[_0x4547('0x40')]==='variable'&&_0x44598b['variableName']&&_0x44598b['idField']&&_0x44598b[_0x4547('0x42')]){_0x2f5a2d[_0x44598b[_0x4547('0x1e')]]&&_0x1b8f34[_0x4547('0x46')]['push']({'id':_0x44598b['idField'],'value':_0x2f5a2d[_0x44598b[_0x4547('0x1e')]]['toString']()});}else if(_0x44598b[_0x4547('0x40')]===_0x4547('0x47')&&_0x44598b[_0x4547('0x48')]&&_0x44598b[_0x4547('0x48')]['name']&&_0x44598b[_0x4547('0x45')]&&_0x44598b['customField']){_0x2f5a2d[_0x44598b[_0x4547('0x48')][_0x4547('0xd')][_0x4547('0x43')]()]&&_0x1b8f34[_0x4547('0x46')]['push']({'id':_0x44598b[_0x4547('0x45')],'value':_0x2f5a2d[_0x44598b[_0x4547('0x48')][_0x4547('0xd')]['toLowerCase']()][_0x4547('0x26')]()});}});}return _0x1b8f34;}function getConnection(_0x18a0ce){return request({'method':_0x4547('0x9'),'form':{'method':_0x4547('0x49'),'input_type':_0x4547('0x21'),'response_type':_0x4547('0x21'),'rest_data':JSON[_0x4547('0x22')]({'user_auth':{'user_name':_0x18a0ce[_0x4547('0x4a')],'password':_0x18a0ce[_0x4547('0x4b')],'encryption':_0x4547('0x4c')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x5d33c4){var _0x42a689=_0x5d33c4;if(_0x42a689['id']){def['sessionID']=_0x42a689['id'];return BPromise[_0x4547('0x31')](_0x42a689);}else{throw new Error(util['format'](_0x4547('0x4d'),_0x18a0ce['id']));}});}function setRelationship(_0x3fa950,_0x1cdd26,_0x487a0d,_0x36e297){return request({'form':{'method':_0x4547('0x4e'),'input_type':'JSON','response_type':_0x4547('0x21'),'rest_data':JSON['stringify']({'session':_0x3fa950['id'],'module_name':_0x4547('0x4f'),'module_id':_0x487a0d['id'],'link_field_name':_0x36e297,'related_ids':[_0x1cdd26['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4547('0x50')]=function(_0xc51d62,_0x9fd303,_0x2eac63,_0x5be536,_0x1a10af,_0x422e9e){var _0x56d244,_0x4b5e23,_0x11baa3,_0x169b3c;_0x422e9e[_0x4547('0x51')]=intUtil['stripTrailingSlash'](_0x422e9e['remoteUri']);_0x422e9e['serverUrl']=intUtil[_0x4547('0x52')](_0x422e9e[_0x4547('0x53')]);def[_0x4547('0x54')]=util['format'](_0x4547('0x55'),_0x422e9e[_0x4547('0x51')]);if(_0x1a10af&&_0x1a10af[_0x4547('0x56')]){logger['info'](_0x4547('0x57'),_0x4547('0x58'));_0x9fd303[_0x4547('0x59')]=util[_0x4547('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x422e9e[_0x4547('0x53')],_0x9fd303[_0x4547('0x5a')],md5(_0x9fd303[_0x4547('0x5a')]));}else{_0x9fd303[_0x4547('0x59')]='';}return getConnection(_0x422e9e)[_0x4547('0x37')](function(_0x277704){_0x169b3c=_0x277704;return getUser(_0x422e9e,_0x5be536[_0x4547('0xd')],_0x169b3c);})['then'](function(_0x4b0f1c){_0x56d244=_0x4b0f1c;logger[_0x4547('0xb')](_0x4547('0x5b'),_0x56d244['id']);return getEndUser(_0x422e9e,_0x9fd303['calleridname'],_0x9fd303[_0x4547('0x5c')],_0x169b3c);})[_0x4547('0x37')](function(_0x50857f){_0x4b5e23=_0x50857f;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4b5e23['id']);return getTicket(_0x422e9e,_0x56d244,_0x4b5e23,_0x2eac63,_0x9fd303,_0x2eac63[_0x4547('0x5d')],_0x169b3c,_0x4547('0x5e'));})[_0x4547('0x37')](function(_0x27d76d){_0x11baa3=_0x27d76d;logger[_0x4547('0xb')](_0x4547('0x5f'));logger['info'](_0x4547('0x60'),_0x11baa3['id']);return setRelationship(_0x169b3c,_0x56d244,_0x11baa3,'users');})['then'](function(){return setRelationship(_0x169b3c,_0x4b5e23,_0x11baa3,_0x4547('0x61'));})[_0x4547('0x37')](function(){return getServerInfo(_0x169b3c);})[_0x4547('0x37')](function(_0x3b41bb){var _0x40b7c5=parseInt(_0x3b41bb[_0x4547('0x62')][_0x4547('0x63')](0x0));var _0x15b031=util[_0x4547('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x422e9e[_0x4547('0x51')],_0x11baa3['id']);if(_0x40b7c5>0x6){_0x15b031=util[_0x4547('0x23')](_0x4547('0x64'),_0x422e9e[_0x4547('0x51')],_0x11baa3['id']);}logger[_0x4547('0xb')](_0x4547('0x57'),_0x4547('0x65'));emit(util[_0x4547('0x23')]('user:%s',_0x5be536[_0x4547('0xd')]),_0x4547('0x66'),{'uri':_0x15b031});})['catch'](function(_0xac3f2e){logger['error']('[QUEUE]',JSON['stringify'](_0xac3f2e));});};exports[_0x4547('0x67')]=function(_0x5e04c0,_0x1c44a5,_0x5d38d6,_0x4f17a3,_0x2907db,_0x20eea0,_0x207807){var _0x5ad2e8,_0x58c4ec,_0x5ab21f,_0x1731bb;_0x20eea0[_0x4547('0x51')]=intUtil['stripTrailingSlash'](_0x20eea0[_0x4547('0x51')]);_0x20eea0[_0x4547('0x53')]=intUtil[_0x4547('0x52')](_0x20eea0[_0x4547('0x53')]);def[_0x4547('0x54')]=util['format'](_0x4547('0x55'),_0x20eea0[_0x4547('0x51')]);if(_0x207807&&_0x207807[_0x4547('0x68')]&&_0x207807['recordingFormat']!==_0x4547('0x69')){logger['info'](_0x4547('0x6a'),_0x4547('0x58'));_0x1c44a5[_0x4547('0x59')]=util[_0x4547('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20eea0[_0x4547('0x53')],_0x1c44a5['uniqueid'],md5(_0x1c44a5[_0x4547('0x5a')]));}return getConnection(_0x20eea0)[_0x4547('0x37')](function(_0x194a09){_0x1731bb=_0x194a09;return getUser(_0x20eea0,_0x4f17a3[_0x4547('0xd')],_0x1731bb);})['then'](function(_0xd5e9d0){_0x5ad2e8=_0xd5e9d0;logger[_0x4547('0xb')](_0x4547('0x5b'),_0x5ad2e8['id']);return getEndUser(_0x20eea0,_0x1c44a5[_0x4547('0x6b')],_0x1c44a5[_0x4547('0x6c')],_0x1731bb);})[_0x4547('0x37')](function(_0x3fb407){_0x58c4ec=_0x3fb407;logger[_0x4547('0xb')](_0x4547('0x6d'),_0x58c4ec['id']);return getTicket(_0x20eea0,_0x5ad2e8,_0x58c4ec,_0x5d38d6,_0x1c44a5,_0x5d38d6[_0x4547('0x5d')],_0x1731bb,'Outbound');})[_0x4547('0x37')](function(_0x3551d0){_0x5ab21f=_0x3551d0;logger[_0x4547('0xb')](_0x4547('0x5f'));logger['info'](_0x4547('0x60'),_0x5ab21f['id']);return setRelationship(_0x1731bb,_0x5ad2e8,_0x5ab21f,_0x4547('0x6e'));})[_0x4547('0x37')](function(){return setRelationship(_0x1731bb,_0x58c4ec,_0x5ab21f,_0x4547('0x61'));})['then'](function(){return getServerInfo(_0x1731bb);})[_0x4547('0x37')](function(_0xbb4b31){var _0x509123=parseInt(_0xbb4b31['version'][_0x4547('0x63')](0x0));var _0x54c130=util[_0x4547('0x23')](_0x4547('0x6f'),_0x20eea0['remoteUri'],_0x5ab21f['id']);if(_0x509123>0x6){_0x54c130=util[_0x4547('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x20eea0[_0x4547('0x51')],_0x5ab21f['id']);}logger['info'](_0x4547('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x4547('0x70'),_0x4f17a3[_0x4547('0xd')]),_0x4547('0x66'),{'uri':_0x54c130});})['catch'](function(_0x5e5c4b){logger[_0x4547('0x71')](_0x4547('0x6a'),JSON[_0x4547('0x22')](_0x5e5c4b));});};exports[_0x4547('0x72')]=function(_0x3bdbae,_0x10835c,_0xa45abf,_0x4eb2c4,_0x458097,_0x42fcd1){var _0x4f7fee,_0x8124bb,_0x5b176e,_0x1ca8af;_0x42fcd1[_0x4547('0x51')]=intUtil[_0x4547('0x52')](_0x42fcd1[_0x4547('0x51')]);_0x42fcd1[_0x4547('0x53')]=intUtil[_0x4547('0x52')](_0x42fcd1[_0x4547('0x53')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x42fcd1[_0x4547('0x51')]);if(_0x458097&&_0x458097[_0x4547('0x56')]){logger[_0x4547('0xb')]('['+_0x10835c[_0x4547('0x73')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x10835c[_0x4547('0x59')]=util[_0x4547('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x42fcd1['serverUrl'],_0x10835c[_0x4547('0x5a')],md5(_0x10835c['uniqueid']));}else{_0x10835c['recordingURL']='';}return getConnection(_0x42fcd1)[_0x4547('0x37')](function(_0x2a9449){_0x1ca8af=_0x2a9449;if(!_['isNil'](_0x4eb2c4)){return getUser(_0x42fcd1,_0x4eb2c4['name'],_0x1ca8af);}else{return getUser(_0x42fcd1,null,_0x1ca8af);}})[_0x4547('0x37')](function(_0xc24c56){_0x4f7fee=_0xc24c56;logger['info'](_0x4547('0x5b'),_0x4f7fee['id']);return getEndUser(_0x42fcd1,_0x10835c[_0x4547('0x74')],_0x10835c[_0x4547('0x5c')],_0x1ca8af);})[_0x4547('0x37')](function(_0x203879){_0x8124bb=_0x203879;logger[_0x4547('0xb')](_0x4547('0x6d'),_0x8124bb['id']);return getTicket(_0x42fcd1,_0x4f7fee,_0x8124bb,_0xa45abf,_0x10835c,_0xa45abf[_0x4547('0x5d')],_0x1ca8af,_0x4547('0x5e'));})[_0x4547('0x37')](function(_0x1283d1){_0x5b176e=_0x1283d1;logger[_0x4547('0xb')](_0x4547('0x5f'));logger[_0x4547('0xb')](_0x4547('0x60'),_0x5b176e['id']);return setRelationship(_0x1ca8af,_0x4f7fee,_0x5b176e,_0x4547('0x6e'));})['then'](function(){return setRelationship(_0x1ca8af,_0x8124bb,_0x5b176e,_0x4547('0x61'));})[_0x4547('0x37')](function(){return getServerInfo(_0x1ca8af);})[_0x4547('0x75')](function(_0x5578b2){logger[_0x4547('0x71')]('['+_0x10835c['lastevent'][_0x4547('0x76')]()+']',JSON[_0x4547('0x22')](_0x5578b2));});}; \ No newline at end of file +var _0xdcfc=['bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','POST','emit','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','variableName','push','idField','set_entry','stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','JSON','isNil','info','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','length','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','find','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','forEach','string','nameField','toLowerCase','content','type','custom_fields','variable','customField','customVariable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','users','trigger:browser:url','unmanaged','%s/service/v4_1/rest.php','lastevent','recordingURL','calleridnum','Inbound','toUpperCase','lodash','request-promise'];(function(_0x571c83,_0x4c97dc){var _0x2b8bd2=function(_0x1401a1){while(--_0x1401a1){_0x571c83['push'](_0x571c83['shift']());}};_0x2b8bd2(++_0x4c97dc);}(_0xdcfc,0xf8));var _0xcdcf=function(_0x36e50c,_0x2a6f89){_0x36e50c=_0x36e50c-0x0;var _0x5e11c2=_0xdcfc[_0x36e50c];return _0x5e11c2;};'use strict';var _=require(_0xcdcf('0x0'));var rp=require(_0xcdcf('0x1'));var BPromise=require(_0xcdcf('0x2'));var md5=require(_0xcdcf('0x3'));var util=require(_0xcdcf('0x4'));var Redis=require(_0xcdcf('0x5'));var intUtil=require(_0xcdcf('0x6'));var config=require(_0xcdcf('0x7'));var logger=require(_0xcdcf('0x8'))('sugarcrm');config[_0xcdcf('0x9')]=_['defaults'](config[_0xcdcf('0x9')],{'host':_0xcdcf('0xa'),'port':0x18eb});var io=require(_0xcdcf('0xb'))(new Redis(config[_0xcdcf('0x9')]));var def={'method':_0xcdcf('0xc'),'json':!![]};function emit(_0x4624a9,_0x3697b3,_0x5b3da9){io['to'](_0x4624a9)[_0xcdcf('0xd')](_0x3697b3,_0x5b3da9);}function getTicket(_0x56ce17,_0x1c267b,_0x44e22f,_0x8e1614,_0x28457e,_0x3492c7,_0x45e7f8,_0x2a9def){logger['info']('Creating\x20new\x20ticket...');var _0xafe4fc=new Date();var _0x44c05d=[{'name':_0xcdcf('0xe'),'value':intUtil[_0xcdcf('0xf')](_0x8e1614[_0xcdcf('0x10')],_0x28457e,'\x20')},{'name':_0xcdcf('0x11'),'value':_0x1c267b['id']},{'name':_0xcdcf('0x12'),'value':_0x1c267b['id']},{'name':_0xcdcf('0x13'),'value':intUtil['getString'](_0x8e1614['Descriptions'],_0x28457e,'\x0a')},{'name':_0xcdcf('0x14'),'value':_0xafe4fc[_0xcdcf('0x15')]()['slice'](0x0,0x13)[_0xcdcf('0x16')]('T','\x20')},{'name':_0xcdcf('0x17'),'value':'0'},{'name':_0xcdcf('0x18'),'value':'15'},{'name':_0xcdcf('0x19'),'value':_0x44e22f['id']},{'name':_0xcdcf('0x1a'),'value':_0xcdcf('0x1b')},{'name':_0xcdcf('0x1c'),'value':_0x44e22f[_0xcdcf('0xe')]},{'name':_0xcdcf('0x1d'),'value':_0x2a9def}];if(_0x3492c7['length']){_['forEach'](_0x3492c7,function(_0x152706){if(_0x28457e[_0x152706[_0xcdcf('0x1e')]]){_0x44c05d[_0xcdcf('0x1f')]({'name':_0x152706[_0xcdcf('0x20')],'value':_0x28457e[_0x152706[_0xcdcf('0x1e')]]});}});}return request({'form':{'method':_0xcdcf('0x21'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xcdcf('0x22')]({'session':_0x45e7f8['id'],'module_name':_0xcdcf('0x23'),'name_value_list':_0x44c05d})}});}function getAuth(_0x1d1302){return util[_0xcdcf('0x24')](_0xcdcf('0x25'),new Buffer(_0x1d1302[_0xcdcf('0x26')]+':X')[_0xcdcf('0x27')]('base64'));}function getServerInfo(_0x232ce3){return request({'form':{'method':_0xcdcf('0x28'),'input_type':_0xcdcf('0x29'),'response_type':_0xcdcf('0x29'),'rest_data':JSON[_0xcdcf('0x22')]({'session':_0x232ce3['id']})}});}function getUser(_0x2c7b31,_0x21457a,_0xb502ad){if(!_[_0xcdcf('0x2a')](_0x21457a)){logger[_0xcdcf('0x2b')]('Getting\x20agent\x20with\x20name',_0x21457a);return request({'form':{'method':_0xcdcf('0x2c'),'input_type':_0xcdcf('0x29'),'response_type':_0xcdcf('0x29'),'rest_data':JSON[_0xcdcf('0x22')]({'session':_0xb502ad['id'],'module_name':_0xcdcf('0x2d'),'query':util[_0xcdcf('0x24')](_0xcdcf('0x2e'),_0x21457a),'order_by':'','offset':'0','select_fields':['id',_0xcdcf('0xe'),_0xcdcf('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x754feb){if(_0x754feb['entry_list'][_0xcdcf('0x30')]){var _0x1626fd=_['find'](_0x754feb[_0xcdcf('0x31')],function(_0x47e934){return _0x47e934['name_value_list'][_0xcdcf('0x2f')][_0xcdcf('0x32')]===_0x21457a;});if(_0x1626fd){logger[_0xcdcf('0x2b')](_0xcdcf('0x33'));return BPromise[_0xcdcf('0x34')]({'id':_0x1626fd[_0xcdcf('0x35')]['id'][_0xcdcf('0x32')],'name':_0x1626fd[_0xcdcf('0x35')]['name']['value']});}}logger[_0xcdcf('0x2b')](_0xcdcf('0x36'));return BPromise['resolve']({'id':_0xb502ad[_0xcdcf('0x35')][_0xcdcf('0x37')][_0xcdcf('0x32')],'name':_0xb502ad[_0xcdcf('0x35')][_0xcdcf('0x2f')][_0xcdcf('0x32')]});});}else{logger['info'](_0xcdcf('0x38'));return BPromise[_0xcdcf('0x34')]({'id':_0xb502ad[_0xcdcf('0x35')]['user_id'][_0xcdcf('0x32')],'name':_0xb502ad['name_value_list'][_0xcdcf('0x2f')][_0xcdcf('0x32')]});}}function getEndUser(_0x10bfe5,_0x5902f6,_0x2b56e9,_0x45a3b9){logger[_0xcdcf('0x2b')]('Searching\x20enduser\x20with\x20phone',_0x2b56e9);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xcdcf('0x29'),'rest_data':JSON[_0xcdcf('0x22')]({'session':_0x45a3b9['id'],'module_name':_0xcdcf('0x1b'),'query':util[_0xcdcf('0x24')](_0xcdcf('0x39'),_0x2b56e9),'order_by':'','offset':'0','select_fields':['id',_0xcdcf('0xe'),_0xcdcf('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xcdcf('0x3b')](function(_0x493570){if(_0x493570[_0xcdcf('0x31')][_0xcdcf('0x30')]){var _0x46ebf7=_[_0xcdcf('0x3c')](_0x493570['entry_list'],function(_0x2f8bae){return _0x2f8bae['name_value_list'][_0xcdcf('0x3a')][_0xcdcf('0x32')]===_0x2b56e9;});if(_0x46ebf7){logger[_0xcdcf('0x2b')]('Enduser\x20found!');return BPromise[_0xcdcf('0x34')]({'id':_0x46ebf7['name_value_list']['id'][_0xcdcf('0x32')],'name':_0x46ebf7[_0xcdcf('0x35')][_0xcdcf('0xe')][_0xcdcf('0x32')],'phone':_0x46ebf7[_0xcdcf('0x35')]['phone_home']['value']});}}else{logger[_0xcdcf('0x2b')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xcdcf('0x21'),'input_type':_0xcdcf('0x29'),'response_type':_0xcdcf('0x29'),'rest_data':JSON[_0xcdcf('0x22')]({'session':_0x45a3b9['id'],'module_name':_0xcdcf('0x1b'),'name_value_list':[{'name':_0xcdcf('0x3d'),'value':_0x5902f6!==''?_0x5902f6:util[_0xcdcf('0x24')](_0xcdcf('0x3e'),_0x2b56e9)},{'name':_0xcdcf('0x3a'),'value':_0x2b56e9}]})}})[_0xcdcf('0x3b')](function(_0x507ee8){logger[_0xcdcf('0x2b')](_0xcdcf('0x3f'));return BPromise[_0xcdcf('0x34')]({'id':_0x507ee8['id'],'name':_0x507ee8['entry_list'][_0xcdcf('0x3d')][_0xcdcf('0x32')],'phone':_0x507ee8[_0xcdcf('0x31')][_0xcdcf('0x3a')][_0xcdcf('0x32')]});});}});}function request(_0x1cf709){logger['debug'](_0xcdcf('0x40'),JSON[_0xcdcf('0x22')](_0x1cf709));return rp(_[_0xcdcf('0x41')](def,_0x1cf709));}function getTags(_0x4c227e,_0x107f60){var _0x32159c=[];if(_0x4c227e&&_0x4c227e['length']>0x0){_0x32159c=_[_0xcdcf('0x42')](_0x4c227e,_0x107f60);}return _0x32159c;}function getCustomFields(_0x12f831,_0x249594){var _0x4b8bdb=[];var _0x2ffd98={'custom_fields':[]};if(_0x12f831[_0xcdcf('0x30')]>0x0){_[_0xcdcf('0x43')](_0x12f831,function(_0x4b6291){if(_0x4b6291['type']===_0xcdcf('0x44')&&_0x4b6291[_0xcdcf('0x45')]&&!_0x4b6291['customField']){_0x2ffd98[_0x4b6291[_0xcdcf('0x45')][_0xcdcf('0x46')]()]=_0x4b6291[_0xcdcf('0x47')][_0xcdcf('0x27')]();}else if(_0x4b6291[_0xcdcf('0x48')]===_0xcdcf('0x44')&&_0x4b6291['idField']&&_0x4b6291['customField']){_0x2ffd98[_0xcdcf('0x49')][_0xcdcf('0x1f')]({'id':_0x4b6291[_0xcdcf('0x20')],'value':_0x4b6291[_0xcdcf('0x47')][_0xcdcf('0x27')]()});}else if(_0x4b6291[_0xcdcf('0x48')]===_0xcdcf('0x4a')&&_0x4b6291[_0xcdcf('0x1e')]&&_0x4b6291[_0xcdcf('0x20')]&&_0x4b6291[_0xcdcf('0x4b')]){_0x249594[_0x4b6291['variableName']]&&_0x2ffd98[_0xcdcf('0x49')]['push']({'id':_0x4b6291[_0xcdcf('0x20')],'value':_0x249594[_0x4b6291[_0xcdcf('0x1e')]][_0xcdcf('0x27')]()});}else if(_0x4b6291[_0xcdcf('0x48')]===_0xcdcf('0x4c')&&_0x4b6291['Variable']&&_0x4b6291[_0xcdcf('0x4d')][_0xcdcf('0xe')]&&_0x4b6291[_0xcdcf('0x20')]&&_0x4b6291[_0xcdcf('0x4b')]){_0x249594[_0x4b6291[_0xcdcf('0x4d')][_0xcdcf('0xe')][_0xcdcf('0x46')]()]&&_0x2ffd98[_0xcdcf('0x49')][_0xcdcf('0x1f')]({'id':_0x4b6291['idField'],'value':_0x249594[_0x4b6291[_0xcdcf('0x4d')][_0xcdcf('0xe')]['toLowerCase']()][_0xcdcf('0x27')]()});}});}return _0x2ffd98;}function getConnection(_0xb3cc37){return request({'method':_0xcdcf('0xc'),'form':{'method':_0xcdcf('0x4e'),'input_type':_0xcdcf('0x29'),'response_type':_0xcdcf('0x29'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0xb3cc37[_0xcdcf('0x4f')],'password':_0xb3cc37['password'],'encryption':_0xcdcf('0x50')},'application':_0xcdcf('0x51')})}})[_0xcdcf('0x3b')](function(_0x14c6a2){var _0x56af0b=_0x14c6a2;if(_0x56af0b['id']){def[_0xcdcf('0x52')]=_0x56af0b['id'];return BPromise['resolve'](_0x56af0b);}else{throw new Error(util[_0xcdcf('0x24')](_0xcdcf('0x53'),_0xb3cc37['id']));}});}function setRelationship(_0x3bc81d,_0x56ef1a,_0x4ced21,_0x350b13){return request({'form':{'method':_0xcdcf('0x54'),'input_type':_0xcdcf('0x29'),'response_type':_0xcdcf('0x29'),'rest_data':JSON[_0xcdcf('0x22')]({'session':_0x3bc81d['id'],'module_name':_0xcdcf('0x23'),'module_id':_0x4ced21['id'],'link_field_name':_0x350b13,'related_ids':[_0x56ef1a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xcdcf('0x55')]=function(_0x1bcd68,_0x360d10,_0xa93b4c,_0x57b147,_0x1a25c4,_0x4121ab){var _0xe02d67,_0xb1039a,_0x4ab993,_0x211263;_0x4121ab[_0xcdcf('0x56')]=intUtil[_0xcdcf('0x57')](_0x4121ab[_0xcdcf('0x56')]);_0x4121ab[_0xcdcf('0x58')]=intUtil[_0xcdcf('0x57')](_0x4121ab[_0xcdcf('0x58')]);def[_0xcdcf('0x59')]=util['format']('%s/service/v4_1/rest.php',_0x4121ab[_0xcdcf('0x56')]);if(_0x1a25c4&&_0x1a25c4[_0xcdcf('0x5a')]){logger[_0xcdcf('0x2b')](_0xcdcf('0x5b'),_0xcdcf('0x5c'));_0x360d10['recordingURL']=util[_0xcdcf('0x24')](_0xcdcf('0x5d'),_0x4121ab['serverUrl'],_0x360d10['uniqueid'],md5(_0x360d10[_0xcdcf('0x5e')]));}else{_0x360d10['recordingURL']='';}return getConnection(_0x4121ab)['then'](function(_0x4abfbb){_0x211263=_0x4abfbb;return getUser(_0x4121ab,_0x57b147[_0xcdcf('0xe')],_0x211263);})['then'](function(_0x37c2ab){_0xe02d67=_0x37c2ab;logger[_0xcdcf('0x2b')](_0xcdcf('0x5f'),_0xe02d67['id']);return getEndUser(_0x4121ab,_0x360d10[_0xcdcf('0x60')],_0x360d10['calleridnum'],_0x211263);})[_0xcdcf('0x3b')](function(_0x3e3abb){_0xb1039a=_0x3e3abb;logger[_0xcdcf('0x2b')](_0xcdcf('0x61'),_0xb1039a['id']);return getTicket(_0x4121ab,_0xe02d67,_0xb1039a,_0xa93b4c,_0x360d10,_0xa93b4c[_0xcdcf('0x62')],_0x211263,'Inbound');})['then'](function(_0x24a59c){_0x4ab993=_0x24a59c;logger[_0xcdcf('0x2b')](_0xcdcf('0x63'));logger[_0xcdcf('0x2b')](_0xcdcf('0x64'),_0x4ab993['id']);return setRelationship(_0x211263,_0xe02d67,_0x4ab993,'users');})[_0xcdcf('0x3b')](function(){return setRelationship(_0x211263,_0xb1039a,_0x4ab993,_0xcdcf('0x65'));})[_0xcdcf('0x3b')](function(){return getServerInfo(_0x211263);})['then'](function(_0x27804a){var _0x352840=parseInt(_0x27804a[_0xcdcf('0x66')][_0xcdcf('0x67')](0x0));var _0x285ebf=util['format'](_0xcdcf('0x68'),_0x4121ab[_0xcdcf('0x56')],_0x4ab993['id']);if(_0x352840>0x6){_0x285ebf=util[_0xcdcf('0x24')](_0xcdcf('0x69'),_0x4121ab[_0xcdcf('0x56')],_0x4ab993['id']);}logger[_0xcdcf('0x2b')](_0xcdcf('0x5b'),_0xcdcf('0x6a'));emit(util['format'](_0xcdcf('0x6b'),_0x57b147[_0xcdcf('0xe')]),'trigger:browser:url',{'uri':_0x285ebf});})[_0xcdcf('0x6c')](function(_0x26c895){logger[_0xcdcf('0x6d')](_0xcdcf('0x5b'),JSON['stringify'](_0x26c895));});};exports[_0xcdcf('0x6e')]=function(_0x41aeb1,_0x319f90,_0x2e54ca,_0x268833,_0x3e7687,_0x1c2951,_0x5dbd9b){var _0x2a8eac,_0xb203bd,_0xf721c1,_0x3a29c5;_0x1c2951[_0xcdcf('0x56')]=intUtil[_0xcdcf('0x57')](_0x1c2951[_0xcdcf('0x56')]);_0x1c2951[_0xcdcf('0x58')]=intUtil['stripTrailingSlash'](_0x1c2951['serverUrl']);def[_0xcdcf('0x59')]=util[_0xcdcf('0x24')]('%s/service/v4_1/rest.php',_0x1c2951[_0xcdcf('0x56')]);if(_0x5dbd9b&&_0x5dbd9b['recordingFormat']&&_0x5dbd9b[_0xcdcf('0x6f')]!==_0xcdcf('0x70')){logger[_0xcdcf('0x2b')](_0xcdcf('0x71'),_0xcdcf('0x5c'));_0x319f90['recordingURL']=util[_0xcdcf('0x24')](_0xcdcf('0x5d'),_0x1c2951[_0xcdcf('0x58')],_0x319f90['uniqueid'],md5(_0x319f90[_0xcdcf('0x5e')]));}return getConnection(_0x1c2951)[_0xcdcf('0x3b')](function(_0x3f6991){_0x3a29c5=_0x3f6991;return getUser(_0x1c2951,_0x268833['name'],_0x3a29c5);})[_0xcdcf('0x3b')](function(_0x185ee6){_0x2a8eac=_0x185ee6;logger[_0xcdcf('0x2b')](_0xcdcf('0x5f'),_0x2a8eac['id']);return getEndUser(_0x1c2951,_0x319f90[_0xcdcf('0x72')],_0x319f90[_0xcdcf('0x73')],_0x3a29c5);})[_0xcdcf('0x3b')](function(_0x286fc8){_0xb203bd=_0x286fc8;logger[_0xcdcf('0x2b')](_0xcdcf('0x61'),_0xb203bd['id']);return getTicket(_0x1c2951,_0x2a8eac,_0xb203bd,_0x2e54ca,_0x319f90,_0x2e54ca[_0xcdcf('0x62')],_0x3a29c5,'Outbound');})[_0xcdcf('0x3b')](function(_0x24f9c1){_0xf721c1=_0x24f9c1;logger[_0xcdcf('0x2b')](_0xcdcf('0x63'));logger[_0xcdcf('0x2b')](_0xcdcf('0x64'),_0xf721c1['id']);return setRelationship(_0x3a29c5,_0x2a8eac,_0xf721c1,_0xcdcf('0x74'));})['then'](function(){return setRelationship(_0x3a29c5,_0xb203bd,_0xf721c1,_0xcdcf('0x65'));})[_0xcdcf('0x3b')](function(){return getServerInfo(_0x3a29c5);})[_0xcdcf('0x3b')](function(_0x810ee9){var _0x57c75e=parseInt(_0x810ee9[_0xcdcf('0x66')][_0xcdcf('0x67')](0x0));var _0x5f9953=util[_0xcdcf('0x24')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1c2951[_0xcdcf('0x56')],_0xf721c1['id']);if(_0x57c75e>0x6){_0x5f9953=util[_0xcdcf('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1c2951[_0xcdcf('0x56')],_0xf721c1['id']);}logger[_0xcdcf('0x2b')](_0xcdcf('0x71'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xcdcf('0x6b'),_0x268833['name']),_0xcdcf('0x75'),{'uri':_0x5f9953});})[_0xcdcf('0x6c')](function(_0x129383){logger['error'](_0xcdcf('0x71'),JSON[_0xcdcf('0x22')](_0x129383));});};exports[_0xcdcf('0x76')]=function(_0x316c4a,_0x5cd203,_0x300c1d,_0x298415,_0x472e39,_0x446ad2){var _0x20aba7,_0x1433b5,_0x507fe1,_0x23053f;_0x446ad2[_0xcdcf('0x56')]=intUtil[_0xcdcf('0x57')](_0x446ad2[_0xcdcf('0x56')]);_0x446ad2[_0xcdcf('0x58')]=intUtil[_0xcdcf('0x57')](_0x446ad2['serverUrl']);def[_0xcdcf('0x59')]=util[_0xcdcf('0x24')](_0xcdcf('0x77'),_0x446ad2[_0xcdcf('0x56')]);if(_0x472e39&&_0x472e39['monitor_format']){logger['info']('['+_0x5cd203[_0xcdcf('0x78')]['toUpperCase']()+']',_0xcdcf('0x5c'));_0x5cd203[_0xcdcf('0x79')]=util[_0xcdcf('0x24')](_0xcdcf('0x5d'),_0x446ad2[_0xcdcf('0x58')],_0x5cd203[_0xcdcf('0x5e')],md5(_0x5cd203['uniqueid']));}else{_0x5cd203[_0xcdcf('0x79')]='';}return getConnection(_0x446ad2)[_0xcdcf('0x3b')](function(_0xcc49a1){_0x23053f=_0xcc49a1;if(!_['isNil'](_0x298415)){return getUser(_0x446ad2,_0x298415[_0xcdcf('0xe')],_0x23053f);}else{return getUser(_0x446ad2,null,_0x23053f);}})[_0xcdcf('0x3b')](function(_0x4f180c){_0x20aba7=_0x4f180c;logger[_0xcdcf('0x2b')]('The\x20User\x20ID\x20is:',_0x20aba7['id']);return getEndUser(_0x446ad2,_0x5cd203[_0xcdcf('0x60')],_0x5cd203[_0xcdcf('0x7a')],_0x23053f);})['then'](function(_0x24e5af){_0x1433b5=_0x24e5af;logger['info'](_0xcdcf('0x61'),_0x1433b5['id']);return getTicket(_0x446ad2,_0x20aba7,_0x1433b5,_0x300c1d,_0x5cd203,_0x300c1d[_0xcdcf('0x62')],_0x23053f,_0xcdcf('0x7b'));})[_0xcdcf('0x3b')](function(_0x12f077){_0x507fe1=_0x12f077;logger[_0xcdcf('0x2b')](_0xcdcf('0x63'));logger['info'](_0xcdcf('0x64'),_0x507fe1['id']);return setRelationship(_0x23053f,_0x20aba7,_0x507fe1,_0xcdcf('0x74'));})[_0xcdcf('0x3b')](function(){return setRelationship(_0x23053f,_0x1433b5,_0x507fe1,_0xcdcf('0x65'));})['then'](function(){return getServerInfo(_0x23053f);})['catch'](function(_0x457f16){logger['error']('['+_0x5cd203[_0xcdcf('0x78')][_0xcdcf('0x7c')]()+']',JSON[_0xcdcf('0x22')](_0x457f16));});}; \ 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 74acd0c..884c61b 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 _0x3e0f=['join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash','util','getString','sortBy','length','type','string','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','variable'];(function(_0x3c150f,_0x5c6752){var _0xd5e88e=function(_0x23b91f){while(--_0x23b91f){_0x3c150f['push'](_0x3c150f['shift']());}};_0xd5e88e(++_0x5c6752);}(_0x3e0f,0x93));var _0xf3e0=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x3e0f[_0x34843e];return _0x598f7f;};'use strict';var _=require(_0xf3e0('0x0'));var util=require(_0xf3e0('0x1'));exports[_0xf3e0('0x2')]=function(_0x4df860,_0x2e6448,_0x62afcc){var _0x1ac1e1=[];if(_0x4df860['length']>0x0){var _0x28cd61=_[_0xf3e0('0x3')](_0x4df860,['id']);for(var _0x2fdc33=0x0;_0x2fdc33<_0x28cd61[_0xf3e0('0x4')];_0x2fdc33++){var _0x18d71f=_0x28cd61[_0x2fdc33];if(_0x18d71f[_0xf3e0('0x5')]===_0xf3e0('0x6')){_0x1ac1e1[_0xf3e0('0x7')](_0x18d71f[_0xf3e0('0x8')]);}else if(_0x18d71f[_0xf3e0('0x5')]==='variable'&&_0x18d71f[_0xf3e0('0x9')]){_0x2e6448[_0x18d71f[_0xf3e0('0x9')]]&&_0x1ac1e1[_0xf3e0('0x7')](_0x2e6448[_0x18d71f[_0xf3e0('0x9')]][_0xf3e0('0xa')]());}else if(_0x18d71f['type']===_0xf3e0('0xb')&&_0x18d71f[_0xf3e0('0xc')]&&_0x18d71f[_0xf3e0('0xc')][_0xf3e0('0xd')]){_0x2e6448[_0x18d71f[_0xf3e0('0xc')][_0xf3e0('0xd')][_0xf3e0('0xe')]()]&&_0x1ac1e1[_0xf3e0('0x7')](_0x2e6448[_0x18d71f['Variable'][_0xf3e0('0xd')]['toLowerCase']()][_0xf3e0('0xa')]());}else if(_0x18d71f[_0xf3e0('0x5')]==='keyValue'){if(_0x18d71f[_0xf3e0('0xf')]===_0xf3e0('0x6')&&_0x18d71f[_0xf3e0('0x10')]){_0x1ac1e1['push'](util[_0xf3e0('0x11')](_0xf3e0('0x12'),_0x18d71f[_0xf3e0('0x10')],_0x18d71f[_0xf3e0('0x13')]));}else if(_0x18d71f[_0xf3e0('0xf')]===_0xf3e0('0x14')&&_0x18d71f['variableName']&&_0x18d71f['key']){_0x2e6448[_0x18d71f[_0xf3e0('0x9')]]&&_0x1ac1e1[_0xf3e0('0x7')](util['format'](_0xf3e0('0x12'),_0x18d71f[_0xf3e0('0x10')],_0x2e6448[_0x18d71f[_0xf3e0('0x9')]]));}else if(_0x18d71f[_0xf3e0('0xf')]===_0xf3e0('0xb')&&_0x18d71f[_0xf3e0('0xc')]&&_0x18d71f[_0xf3e0('0xc')][_0xf3e0('0xd')]&&_0x18d71f['key']){_0x2e6448[_0x18d71f[_0xf3e0('0xc')][_0xf3e0('0xd')][_0xf3e0('0xe')]()]&&_0x1ac1e1[_0xf3e0('0x7')](util[_0xf3e0('0x11')](_0xf3e0('0x12'),_0x18d71f['key'],_0x2e6448[_0x18d71f['Variable']['name']['toLowerCase']()]));}}}}return _0x1ac1e1[_0xf3e0('0x15')](_0x62afcc);};exports[_0xf3e0('0x16')]=function(_0x14a792){var _0x3e7c07=_0x14a792[_0xf3e0('0x17')](-0x1);if(_0x3e7c07==='/'){_0x14a792=_0x14a792[_0xf3e0('0x18')](0x0,_0x14a792[_0xf3e0('0x19')](_0x3e7c07));}return _0x14a792;};exports[_0xf3e0('0x1a')]=function(_0x5b3ea0){if(!_['isNil'](_0x5b3ea0)&&_0x5b3ea0!==''){var _0x5bcdf0=/^(([^<>()\[\]\\.,;:\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 _0x5bcdf0[_0xf3e0('0x1b')](String(_0x5b3ea0)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x0651=['keyType','key','format','%s:\x20%s','keyContent','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','lodash','length','sortBy','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue'];(function(_0x1a2079,_0xade7a3){var _0x1d10ef=function(_0xc0fe3c){while(--_0xc0fe3c){_0x1a2079['push'](_0x1a2079['shift']());}};_0x1d10ef(++_0xade7a3);}(_0x0651,0x1e5));var _0x1065=function(_0x198778,_0x4fc4ff){_0x198778=_0x198778-0x0;var _0x32af97=_0x0651[_0x198778];return _0x32af97;};'use strict';var _=require(_0x1065('0x0'));var util=require('util');exports['getString']=function(_0x1adba9,_0x32ffed,_0x18528b){var _0x3c71f6=[];if(_0x1adba9[_0x1065('0x1')]>0x0){var _0x2b903f=_[_0x1065('0x2')](_0x1adba9,['id']);for(var _0xf5e0c7=0x0;_0xf5e0c7<_0x2b903f[_0x1065('0x1')];_0xf5e0c7++){var _0x522fcd=_0x2b903f[_0xf5e0c7];if(_0x522fcd['type']===_0x1065('0x3')){_0x3c71f6[_0x1065('0x4')](_0x522fcd[_0x1065('0x5')]);}else if(_0x522fcd[_0x1065('0x6')]===_0x1065('0x7')&&_0x522fcd[_0x1065('0x8')]){_0x32ffed[_0x522fcd['variableName']]&&_0x3c71f6['push'](_0x32ffed[_0x522fcd['variableName']][_0x1065('0x9')]());}else if(_0x522fcd['type']===_0x1065('0xa')&&_0x522fcd['Variable']&&_0x522fcd[_0x1065('0xb')][_0x1065('0xc')]){_0x32ffed[_0x522fcd[_0x1065('0xb')][_0x1065('0xc')][_0x1065('0xd')]()]&&_0x3c71f6[_0x1065('0x4')](_0x32ffed[_0x522fcd[_0x1065('0xb')][_0x1065('0xc')][_0x1065('0xd')]()][_0x1065('0x9')]());}else if(_0x522fcd[_0x1065('0x6')]===_0x1065('0xe')){if(_0x522fcd[_0x1065('0xf')]==='string'&&_0x522fcd[_0x1065('0x10')]){_0x3c71f6[_0x1065('0x4')](util[_0x1065('0x11')](_0x1065('0x12'),_0x522fcd[_0x1065('0x10')],_0x522fcd[_0x1065('0x13')]));}else if(_0x522fcd[_0x1065('0xf')]===_0x1065('0x7')&&_0x522fcd[_0x1065('0x8')]&&_0x522fcd[_0x1065('0x10')]){_0x32ffed[_0x522fcd[_0x1065('0x8')]]&&_0x3c71f6['push'](util[_0x1065('0x11')]('%s:\x20%s',_0x522fcd['key'],_0x32ffed[_0x522fcd[_0x1065('0x8')]]));}else if(_0x522fcd['keyType']===_0x1065('0xa')&&_0x522fcd[_0x1065('0xb')]&&_0x522fcd[_0x1065('0xb')]['name']&&_0x522fcd[_0x1065('0x10')]){_0x32ffed[_0x522fcd['Variable'][_0x1065('0xc')][_0x1065('0xd')]()]&&_0x3c71f6[_0x1065('0x4')](util[_0x1065('0x11')](_0x1065('0x12'),_0x522fcd[_0x1065('0x10')],_0x32ffed[_0x522fcd[_0x1065('0xb')][_0x1065('0xc')][_0x1065('0xd')]()]));}}}}return _0x3c71f6['join'](_0x18528b);};exports[_0x1065('0x14')]=function(_0x24a627){var _0x3ec475=_0x24a627['slice'](-0x1);if(_0x3ec475==='/'){_0x24a627=_0x24a627[_0x1065('0x15')](0x0,_0x24a627[_0x1065('0x16')](_0x3ec475));}return _0x24a627;};exports[_0x1065('0x17')]=function(_0x10f209){if(!_[_0x1065('0x18')](_0x10f209)&&_0x10f209!==''){var _0x24b5e7=/^(([^<>()\[\]\\.,;:\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 _0x24b5e7['test'](String(_0x10f209)['toLowerCase']());}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 6308dc8..2c7fb3f 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x49b6a3,_0x24d972){var _0x472e10=function(_0x3ce211){while(--_0x3ce211){_0x49b6a3['push'](_0x49b6a3['shift']());}};_0x472e10(++_0x24d972);}(_0x34e8,0x12c));var _0x834e=function(_0x5bc4fc,_0x2c8df3){_0x5bc4fc=_0x5bc4fc-0x0;var _0x5b0868=_0x34e8[_0x5bc4fc];return _0x5b0868;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','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','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ 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 61c84a2..073abaf 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 _0x4fca=['catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','replace','inspect','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','Subjects','getString','Descriptions','then','Ticket\x20created!','validateEmail','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','%s/search.json','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','toString','base64','debug','stringify','GET','map','forEach','includes','string','picklist','customField','toLowerCase','content','type','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','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'];(function(_0x4291e3,_0x2484d5){var _0x41e4f9=function(_0x3f0865){while(--_0x3f0865){_0x4291e3['push'](_0x4291e3['shift']());}};_0x41e4f9(++_0x2484d5);}(_0x4fca,0x7e));var _0xa4fc=function(_0x47752f,_0xa970c5){_0x47752f=_0x47752f-0x0;var _0x42c202=_0x4fca[_0x47752f];return _0x42c202;};'use strict';var _=require(_0xa4fc('0x0'));var rp=require(_0xa4fc('0x1'));var md5=require(_0xa4fc('0x2'));var util=require('util');var Redis=require(_0xa4fc('0x3'));var intUtil=require(_0xa4fc('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xa4fc('0x5'));config[_0xa4fc('0x6')]=_[_0xa4fc('0x7')](config[_0xa4fc('0x6')],{'host':_0xa4fc('0x8'),'port':0x18eb});var io=require(_0xa4fc('0x9'))(new Redis(config[_0xa4fc('0x6')]));function emit(_0x2aba9f,_0x4c9e43,_0x478ab0){io['to'](_0x2aba9f)[_0xa4fc('0xa')](_0x4c9e43,_0x478ab0);}var headers={'Content-Type':_0xa4fc('0xb'),'Accept':_0xa4fc('0xb')};function getTicket(_0x177c94,_0x4a2bb1,_0x17461e,_0x54a390,_0x2fc4e0){logger[_0xa4fc('0xc')](_0xa4fc('0xd'));return request({'uri':util['format'](_0xa4fc('0xe'),_0x177c94[_0xa4fc('0xf')]),'method':_0xa4fc('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x17461e['id'],'submitter_id':_0x4a2bb1?_0x4a2bb1['id']:undefined,'assignee_id':_0x4a2bb1?_0x4a2bb1['id']:undefined,'tags':getTags(_0x54a390[_0xa4fc('0x11')],_0xa4fc('0x12')),'subject':intUtil['getString'](_0x54a390[_0xa4fc('0x13')],_0x2fc4e0,'\x20'),'description':intUtil[_0xa4fc('0x14')](_0x54a390[_0xa4fc('0x15')],_0x2fc4e0,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa4fc('0x14')](_0x54a390[_0xa4fc('0x15')],_0x2fc4e0,'\x0a')}},getCustomFields(_0x54a390['Fields'],_0x2fc4e0))}})[_0xa4fc('0x16')](function(_0x36e870){logger['info'](_0xa4fc('0x17'));return _0x36e870['ticket'];});}function getUser(_0x307c13,_0x475f7a){if(intUtil[_0xa4fc('0x18')](_0x475f7a)){logger[_0xa4fc('0xc')]('Getting\x20agent\x20with\x20email',_0x475f7a);return request({'uri':util[_0xa4fc('0x19')]('%s/search.json',_0x307c13[_0xa4fc('0xf')]),'qs':{'query':util[_0xa4fc('0x19')](_0xa4fc('0x1a'),_0x475f7a)}})['then'](function(_0x353084){if(_0x353084[_0xa4fc('0x1b')]){logger[_0xa4fc('0xc')](_0xa4fc('0x1c'));return _[_0xa4fc('0x1d')](_0x353084[_0xa4fc('0x1e')],{'email':_0x475f7a,'role':_0xa4fc('0x1f')});}else{logger[_0xa4fc('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa4fc('0x19')]('%s/users/me.json',_0x307c13['remoteUri'])})[_0xa4fc('0x16')](function(_0x35babb){logger[_0xa4fc('0xc')](_0xa4fc('0x20'));return _0x35babb[_0xa4fc('0x21')];});}});}else{logger[_0xa4fc('0xc')](_0xa4fc('0x22'));return request({'uri':util[_0xa4fc('0x19')](_0xa4fc('0x23'),_0x307c13[_0xa4fc('0xf')])})[_0xa4fc('0x16')](function(_0x4e6935){logger[_0xa4fc('0xc')](_0xa4fc('0x20'));return _0x4e6935[_0xa4fc('0x21')];});}}function getEndUser(_0x3ab090,_0x356cc6,_0x41baee){logger[_0xa4fc('0xc')]('Searching\x20enduser\x20with\x20phone',_0x41baee);return request({'uri':util['format'](_0xa4fc('0x24'),_0x3ab090[_0xa4fc('0xf')]),'qs':{'query':util[_0xa4fc('0x19')]('type:user\x20role:end-user\x20phone:%s',_0x41baee)}})[_0xa4fc('0x16')](function(_0x351089){var _0x550bc0;if(_0x351089[_0xa4fc('0x1e')][_0xa4fc('0x25')]){_0x351089[_0xa4fc('0x1e')]=_[_0xa4fc('0x26')](_0x351089['results'],{'suspended':![],'role':'end-user'});if(_0x351089[_0xa4fc('0x1e')][_0xa4fc('0x25')]){_0x550bc0=_[_0xa4fc('0x27')](_0x351089[_0xa4fc('0x1e')]);}}if(_0x550bc0){logger[_0xa4fc('0xc')](_0xa4fc('0x28'));return _0x550bc0;}else{logger[_0xa4fc('0xc')](_0xa4fc('0x29'));return request({'uri':util['format'](_0xa4fc('0x2a'),_0x3ab090[_0xa4fc('0xf')]),'method':_0xa4fc('0x10'),'body':{'user':{'role':_0xa4fc('0x2b'),'name':util['format']('Caller\x20-\x20%s',_0x356cc6||_0x41baee),'phone':_0x41baee}}})[_0xa4fc('0x16')](function(_0x526dd4){logger[_0xa4fc('0xc')](_0xa4fc('0x2c'));return _0x526dd4[_0xa4fc('0x21')];});}});}function getAuth(_0x51e0ac){var _0x57f3e6;if(_0x51e0ac['authType']===_0xa4fc('0x2d')){_0x57f3e6=util[_0xa4fc('0x19')](_0xa4fc('0x2e'),_0x51e0ac[_0xa4fc('0x2f')],_0x51e0ac[_0xa4fc('0x2d')]);}else if(_0x51e0ac[_0xa4fc('0x30')]===_0xa4fc('0x31')){_0x57f3e6=util[_0xa4fc('0x19')](_0xa4fc('0x32'),_0x51e0ac[_0xa4fc('0x2f')],_0x51e0ac[_0xa4fc('0x31')]);}return util['format']('Basic\x20%s',new Buffer(_0x57f3e6)[_0xa4fc('0x33')](_0xa4fc('0x34')));}function request(_0x44eaef){logger[_0xa4fc('0x35')]('[HTTP]',JSON[_0xa4fc('0x36')](_0x44eaef));return rp(_[_0xa4fc('0x7')](_0x44eaef,{'method':_0xa4fc('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x487c82,_0x551c96){var _0x34ddf1=[];if(_0x487c82&&_0x487c82[_0xa4fc('0x25')]>0x0){_0x34ddf1=_[_0xa4fc('0x38')](_0x487c82,_0x551c96);}return _0x34ddf1;}function getCustomFields(_0x1a4832,_0x594bb2){var _0x157886=[];var _0x507242={'custom_fields':[]};if(_0x1a4832[_0xa4fc('0x25')]>0x0){_[_0xa4fc('0x39')](_0x1a4832,function(_0x2048d3){if(_[_0xa4fc('0x3a')]([_0xa4fc('0x3b'),_0xa4fc('0x3c')],_0x2048d3['type'])&&_0x2048d3['nameField']&&!_0x2048d3[_0xa4fc('0x3d')]){_0x507242[_0x2048d3['nameField'][_0xa4fc('0x3e')]()]=_0x2048d3[_0xa4fc('0x3f')][_0xa4fc('0x33')]();}else if(_[_0xa4fc('0x3a')]([_0xa4fc('0x3b'),'picklist'],_0x2048d3[_0xa4fc('0x40')])&&_0x2048d3[_0xa4fc('0x41')]&&_0x2048d3['customField']){_0x507242[_0xa4fc('0x42')][_0xa4fc('0x43')]({'id':_0x2048d3[_0xa4fc('0x41')],'value':_0x2048d3[_0xa4fc('0x3f')]['toString']()});}else if(_0x2048d3['type']===_0xa4fc('0x44')&&_0x2048d3[_0xa4fc('0x45')]&&_0x2048d3['idField']&&_0x2048d3[_0xa4fc('0x3d')]){_0x594bb2[_0x2048d3[_0xa4fc('0x45')]]&&_0x507242[_0xa4fc('0x42')]['push']({'id':_0x2048d3[_0xa4fc('0x41')],'value':_0x594bb2[_0x2048d3[_0xa4fc('0x45')]][_0xa4fc('0x33')]()});}else if(_0x2048d3[_0xa4fc('0x40')]===_0xa4fc('0x46')&&_0x2048d3[_0xa4fc('0x47')]&&_0x2048d3['Variable'][_0xa4fc('0x12')]&&_0x2048d3[_0xa4fc('0x41')]&&_0x2048d3[_0xa4fc('0x3d')]){_0x594bb2[_0x2048d3['Variable'][_0xa4fc('0x12')][_0xa4fc('0x3e')]()]&&_0x507242[_0xa4fc('0x42')]['push']({'id':_0x2048d3[_0xa4fc('0x41')],'value':_0x594bb2[_0x2048d3['Variable'][_0xa4fc('0x12')]['toLowerCase']()][_0xa4fc('0x33')]()});}});}return _0x507242;}exports[_0xa4fc('0x48')]=function(_0xcbf2b4,_0x4d9dc4,_0x1611b5,_0x303cee,_0x1264c1,_0x3dbc74){var _0x29096d,_0x264bf9;_0x3dbc74[_0xa4fc('0xf')]=intUtil[_0xa4fc('0x49')](_0x3dbc74[_0xa4fc('0xf')]);_0x3dbc74[_0xa4fc('0x4a')]=intUtil[_0xa4fc('0x49')](_0x3dbc74[_0xa4fc('0x4a')]);if(_0x1264c1&&_0x1264c1['monitor_format']){logger[_0xa4fc('0xc')](_0xa4fc('0x4b'),_0xa4fc('0x4c'));_0x4d9dc4['recordingURL']=util[_0xa4fc('0x19')](_0xa4fc('0x4d'),_0x3dbc74[_0xa4fc('0x4a')],_0x4d9dc4[_0xa4fc('0x4e')],md5(_0x4d9dc4[_0xa4fc('0x4e')]));}else{_0x4d9dc4[_0xa4fc('0x4f')]='';}headers['Authorization']=getAuth(_0x3dbc74);return getUser(_0x3dbc74,_0x303cee['email'])[_0xa4fc('0x16')](function(_0x555793){_0x29096d=_0x555793;logger[_0xa4fc('0xc')](_0xa4fc('0x50'),_0x29096d['id']);return getEndUser(_0x3dbc74,_0x4d9dc4[_0xa4fc('0x51')],_0x4d9dc4[_0xa4fc('0x52')]);})['then'](function(_0x37f1b9){_0x264bf9=_0x37f1b9;logger['info']('The\x20Enduser\x20ID\x20is:',_0x264bf9['id']);return getTicket(_0x3dbc74,_0x29096d,_0x264bf9,_0x1611b5,_0x4d9dc4);})[_0xa4fc('0x16')](function(_0x3b4617){if(_0x3b4617){logger['info']('The\x20Ticket\x20ID\x20is:',_0x3b4617['id']);switch(_0x3dbc74[_0xa4fc('0x40')]){case _0xa4fc('0x53'):logger['info'](_0xa4fc('0x4b'),_0xa4fc('0x54'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3dbc74['remoteUri'],_0x29096d['id'],_0x3b4617['id']),'method':_0xa4fc('0x10')});case'newTab':logger[_0xa4fc('0xc')](_0xa4fc('0x4b'),_0xa4fc('0x55'));emit(util[_0xa4fc('0x19')](_0xa4fc('0x56'),_0x303cee[_0xa4fc('0x12')]),_0xa4fc('0x57'),{'uri':util[_0xa4fc('0x19')](_0xa4fc('0x58'),_0x3dbc74[_0xa4fc('0xf')]['replace'](_0xa4fc('0x59'),''),_0x3b4617['id'])});break;default:logger[_0xa4fc('0x5a')](_0xa4fc('0x4b'),_0xa4fc('0x5b'));}}})[_0xa4fc('0x5c')](function(_0x4b6b88){logger[_0xa4fc('0x5a')](_0xa4fc('0x5d'),util['inspect'](_0x4b6b88,{'showHidden':!![],'depth':null}));});};exports[_0xa4fc('0x5e')]=function(_0x5916f7,_0xecfae4,_0x17a301,_0x34d565,_0x4dc38f,_0x3d4b1b,_0x567015){var _0x289f47,_0x1328a9;_0x3d4b1b[_0xa4fc('0xf')]=intUtil['stripTrailingSlash'](_0x3d4b1b[_0xa4fc('0xf')]);_0x3d4b1b[_0xa4fc('0x4a')]=intUtil[_0xa4fc('0x49')](_0x3d4b1b[_0xa4fc('0x4a')]);if(_0x567015&&_0x567015['recordingFormat']&&_0x567015[_0xa4fc('0x5f')]!==_0xa4fc('0x60')){logger[_0xa4fc('0xc')](_0xa4fc('0x61'),'Recording\x20is\x20enabled!');_0xecfae4[_0xa4fc('0x4f')]=util['format'](_0xa4fc('0x4d'),_0x3d4b1b[_0xa4fc('0x4a')],_0xecfae4[_0xa4fc('0x4e')],md5(_0xecfae4['uniqueid']));}headers[_0xa4fc('0x62')]=getAuth(_0x3d4b1b);return getUser(_0x3d4b1b,_0x34d565['email'])['then'](function(_0x1ddabe){_0x289f47=_0x1ddabe;logger[_0xa4fc('0xc')](_0xa4fc('0x50'),_0x289f47['id']);return getEndUser(_0x3d4b1b,_0xecfae4[_0xa4fc('0x63')],_0xecfae4[_0xa4fc('0x64')]);})[_0xa4fc('0x16')](function(_0x396ff0){_0x1328a9=_0x396ff0;logger['info'](_0xa4fc('0x65'),_0x1328a9['id']);return getTicket(_0x3d4b1b,_0x289f47,_0x1328a9,_0x17a301,_0xecfae4);})[_0xa4fc('0x16')](function(_0xe9cdf7){if(_0xe9cdf7){logger[_0xa4fc('0xc')](_0xa4fc('0x66'),_0xe9cdf7['id']);switch(_0x3d4b1b[_0xa4fc('0x40')]){case _0xa4fc('0x53'):logger[_0xa4fc('0xc')](_0xa4fc('0x61'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xa4fc('0x19')](_0xa4fc('0x67'),_0x3d4b1b[_0xa4fc('0xf')],_0x289f47['id'],_0xe9cdf7['id']),'method':'POST'});case _0xa4fc('0x68'):logger[_0xa4fc('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xa4fc('0x56'),_0x34d565['name']),'trigger:browser:url',{'uri':util[_0xa4fc('0x19')](_0xa4fc('0x58'),_0x3d4b1b['remoteUri'][_0xa4fc('0x69')](_0xa4fc('0x59'),''),_0xe9cdf7['id'])});break;default:logger[_0xa4fc('0x5a')](_0xa4fc('0x61'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xa4fc('0x5c')](function(_0x32b4ce){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xa4fc('0x6a')](_0x32b4ce,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x210ab2,_0x85bba4,_0x1fad6c,_0x5f3489,_0x564c59,_0x5e63ec){var _0x34a78d,_0x3f333e;_0x5e63ec[_0xa4fc('0xf')]=intUtil['stripTrailingSlash'](_0x5e63ec[_0xa4fc('0xf')]);_0x5e63ec[_0xa4fc('0x4a')]=intUtil['stripTrailingSlash'](_0x5e63ec[_0xa4fc('0x4a')]);if(_0x564c59&&_0x564c59['monitor_format']){logger[_0xa4fc('0xc')]('['+_0x85bba4[_0xa4fc('0x6b')][_0xa4fc('0x6c')]()+']','Recording\x20is\x20enabled!');_0x85bba4[_0xa4fc('0x4f')]=util[_0xa4fc('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5e63ec[_0xa4fc('0x4a')],_0x85bba4[_0xa4fc('0x4e')],md5(_0x85bba4[_0xa4fc('0x4e')]));}else{_0x85bba4[_0xa4fc('0x4f')]='';}headers['Authorization']=getAuth(_0x5e63ec);return getUser(_0x5e63ec)[_0xa4fc('0x16')](function(_0x30a060){_0x34a78d=_0x30a060;logger[_0xa4fc('0xc')](_0xa4fc('0x50'),_0x34a78d['id']);return getEndUser(_0x5e63ec,_0x85bba4[_0xa4fc('0x51')],_0x85bba4[_0xa4fc('0x52')]);})[_0xa4fc('0x16')](function(_0x2b883b){_0x3f333e=_0x2b883b;logger[_0xa4fc('0xc')]('The\x20Enduser\x20ID\x20is:',_0x3f333e['id']);return getTicket(_0x5e63ec,_0x34a78d,_0x3f333e,_0x1fad6c,_0x85bba4);})[_0xa4fc('0x16')](function(_0x2778ed){if(_0x2778ed){logger[_0xa4fc('0xc')](_0xa4fc('0x66'),_0x2778ed['id']);}})['catch'](function(_0x368be3){logger[_0xa4fc('0x5a')]('['+_0x85bba4[_0xa4fc('0x6b')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x368be3,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcb92=['getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','count','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','Enduser\x20found!','%s/users.json','POST','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','token','toString','base64','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variableName','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','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]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','./util','../../../../config/environment','defaults','redis','emit','application/json','info','format','%s/tickets.json','merge','Tags','name'];(function(_0x2526bb,_0x3ab4a3){var _0x3c1be8=function(_0x4f77e0){while(--_0x4f77e0){_0x2526bb['push'](_0x2526bb['shift']());}};_0x3c1be8(++_0x3ab4a3);}(_0xcb92,0x129));var _0x2cb9=function(_0x57774c,_0xab7e3d){_0x57774c=_0x57774c-0x0;var _0x32377e=_0xcb92[_0x57774c];return _0x32377e;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x2cb9('0x0'));var util=require(_0x2cb9('0x1'));var Redis=require(_0x2cb9('0x2'));var intUtil=require(_0x2cb9('0x3'));var config=require(_0x2cb9('0x4'));var logger=require('../../../../config/logger')('zendesk');config['redis']=_[_0x2cb9('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2cb9('0x6')]));function emit(_0x283922,_0xcb06d9,_0x1f2421){io['to'](_0x283922)[_0x2cb9('0x7')](_0xcb06d9,_0x1f2421);}var headers={'Content-Type':_0x2cb9('0x8'),'Accept':_0x2cb9('0x8')};function getTicket(_0x2a6099,_0x2bb22e,_0x578c50,_0x5f039a,_0x362918){logger[_0x2cb9('0x9')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x2cb9('0xa')](_0x2cb9('0xb'),_0x2a6099['remoteUri']),'method':'POST','body':{'ticket':_[_0x2cb9('0xc')]({'requester_id':_0x578c50['id'],'submitter_id':_0x2bb22e?_0x2bb22e['id']:undefined,'assignee_id':_0x2bb22e?_0x2bb22e['id']:undefined,'tags':getTags(_0x5f039a[_0x2cb9('0xd')],_0x2cb9('0xe')),'subject':intUtil[_0x2cb9('0xf')](_0x5f039a[_0x2cb9('0x10')],_0x362918,'\x20'),'description':intUtil[_0x2cb9('0xf')](_0x5f039a['Descriptions'],_0x362918,'\x0a'),'comment':{'public':![],'body':intUtil[_0x2cb9('0xf')](_0x5f039a[_0x2cb9('0x11')],_0x362918,'\x0a')}},getCustomFields(_0x5f039a[_0x2cb9('0x12')],_0x362918))}})[_0x2cb9('0x13')](function(_0xb093b1){logger[_0x2cb9('0x9')](_0x2cb9('0x14'));return _0xb093b1['ticket'];});}function getUser(_0x1936e4,_0x5b199e){if(intUtil[_0x2cb9('0x15')](_0x5b199e)){logger['info'](_0x2cb9('0x16'),_0x5b199e);return request({'uri':util[_0x2cb9('0xa')](_0x2cb9('0x17'),_0x1936e4[_0x2cb9('0x18')]),'qs':{'query':util[_0x2cb9('0xa')]('type:user\x20role:agent\x20email:%s',_0x5b199e)}})[_0x2cb9('0x13')](function(_0x2d4e16){if(_0x2d4e16[_0x2cb9('0x19')]){logger[_0x2cb9('0x9')]('Agent\x20found!');return _[_0x2cb9('0x1a')](_0x2d4e16[_0x2cb9('0x1b')],{'email':_0x5b199e,'role':'agent'});}else{logger[_0x2cb9('0x9')](_0x2cb9('0x1c'));return request({'uri':util[_0x2cb9('0xa')](_0x2cb9('0x1d'),_0x1936e4['remoteUri'])})['then'](function(_0x4bf1b7){logger[_0x2cb9('0x9')]('Admin\x20account\x20selected.');return _0x4bf1b7[_0x2cb9('0x1e')];});}});}else{logger[_0x2cb9('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x2cb9('0x1d'),_0x1936e4[_0x2cb9('0x18')])})[_0x2cb9('0x13')](function(_0x509d18){logger['info']('Admin\x20account\x20selected.');return _0x509d18[_0x2cb9('0x1e')];});}}function getEndUser(_0x3fc847,_0x764709,_0x5ad2d1){logger[_0x2cb9('0x9')](_0x2cb9('0x1f'),_0x5ad2d1);return request({'uri':util[_0x2cb9('0xa')](_0x2cb9('0x17'),_0x3fc847[_0x2cb9('0x18')]),'qs':{'query':util[_0x2cb9('0xa')](_0x2cb9('0x20'),_0x5ad2d1)}})[_0x2cb9('0x13')](function(_0x555cae){var _0x1854d5;if(_0x555cae[_0x2cb9('0x1b')][_0x2cb9('0x21')]){_0x555cae[_0x2cb9('0x1b')]=_[_0x2cb9('0x22')](_0x555cae[_0x2cb9('0x1b')],{'suspended':![],'role':'end-user'});if(_0x555cae['results']['length']){_0x1854d5=_['first'](_0x555cae['results']);}}if(_0x1854d5){logger['info'](_0x2cb9('0x23'));return _0x1854d5;}else{logger[_0x2cb9('0x9')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x2cb9('0x24'),_0x3fc847[_0x2cb9('0x18')]),'method':_0x2cb9('0x25'),'body':{'user':{'role':_0x2cb9('0x26'),'name':util[_0x2cb9('0xa')](_0x2cb9('0x27'),_0x764709||_0x5ad2d1),'phone':_0x5ad2d1}}})[_0x2cb9('0x13')](function(_0x1b7594){logger[_0x2cb9('0x9')](_0x2cb9('0x28'));return _0x1b7594['user'];});}});}function getAuth(_0x18c13d){var _0x522de5;if(_0x18c13d[_0x2cb9('0x29')]===_0x2cb9('0x2a')){_0x522de5=util[_0x2cb9('0xa')](_0x2cb9('0x2b'),_0x18c13d[_0x2cb9('0x2c')],_0x18c13d['password']);}else if(_0x18c13d['authType']==='token'){_0x522de5=util['format'](_0x2cb9('0x2d'),_0x18c13d[_0x2cb9('0x2c')],_0x18c13d[_0x2cb9('0x2e')]);}return util[_0x2cb9('0xa')]('Basic\x20%s',new Buffer(_0x522de5)[_0x2cb9('0x2f')](_0x2cb9('0x30')));}function request(_0x16f595){logger['debug']('[HTTP]',JSON[_0x2cb9('0x31')](_0x16f595));return rp(_['defaults'](_0x16f595,{'method':_0x2cb9('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x1fee70,_0x52d12c){var _0x26eb39=[];if(_0x1fee70&&_0x1fee70[_0x2cb9('0x21')]>0x0){_0x26eb39=_[_0x2cb9('0x33')](_0x1fee70,_0x52d12c);}return _0x26eb39;}function getCustomFields(_0x219604,_0x47a003){var _0x10dba2=[];var _0x1c9b12={'custom_fields':[]};if(_0x219604[_0x2cb9('0x21')]>0x0){_[_0x2cb9('0x34')](_0x219604,function(_0x471dca){if(_[_0x2cb9('0x35')]([_0x2cb9('0x36'),_0x2cb9('0x37')],_0x471dca[_0x2cb9('0x38')])&&_0x471dca[_0x2cb9('0x39')]&&!_0x471dca[_0x2cb9('0x3a')]){_0x1c9b12[_0x471dca['nameField'][_0x2cb9('0x3b')]()]=_0x471dca[_0x2cb9('0x3c')]['toString']();}else if(_[_0x2cb9('0x35')]([_0x2cb9('0x36'),'picklist'],_0x471dca['type'])&&_0x471dca[_0x2cb9('0x3d')]&&_0x471dca[_0x2cb9('0x3a')]){_0x1c9b12[_0x2cb9('0x3e')][_0x2cb9('0x3f')]({'id':_0x471dca[_0x2cb9('0x3d')],'value':_0x471dca[_0x2cb9('0x3c')][_0x2cb9('0x2f')]()});}else if(_0x471dca['type']==='variable'&&_0x471dca['variableName']&&_0x471dca['idField']&&_0x471dca[_0x2cb9('0x3a')]){_0x47a003[_0x471dca[_0x2cb9('0x40')]]&&_0x1c9b12['custom_fields']['push']({'id':_0x471dca[_0x2cb9('0x3d')],'value':_0x47a003[_0x471dca['variableName']][_0x2cb9('0x2f')]()});}else if(_0x471dca[_0x2cb9('0x38')]==='customVariable'&&_0x471dca[_0x2cb9('0x41')]&&_0x471dca[_0x2cb9('0x41')][_0x2cb9('0xe')]&&_0x471dca['idField']&&_0x471dca[_0x2cb9('0x3a')]){_0x47a003[_0x471dca[_0x2cb9('0x41')][_0x2cb9('0xe')][_0x2cb9('0x3b')]()]&&_0x1c9b12[_0x2cb9('0x3e')][_0x2cb9('0x3f')]({'id':_0x471dca[_0x2cb9('0x3d')],'value':_0x47a003[_0x471dca[_0x2cb9('0x41')][_0x2cb9('0xe')]['toLowerCase']()]['toString']()});}});}return _0x1c9b12;}exports['queue']=function(_0x84ace3,_0x11a812,_0x9fb7cd,_0x42a7d1,_0x32ba9e,_0x12d70a){var _0x2ec1bf,_0x4c83f8;_0x12d70a['remoteUri']=intUtil[_0x2cb9('0x42')](_0x12d70a[_0x2cb9('0x18')]);_0x12d70a[_0x2cb9('0x43')]=intUtil[_0x2cb9('0x42')](_0x12d70a[_0x2cb9('0x43')]);if(_0x32ba9e&&_0x32ba9e[_0x2cb9('0x44')]){logger['info'](_0x2cb9('0x45'),_0x2cb9('0x46'));_0x11a812[_0x2cb9('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x12d70a[_0x2cb9('0x43')],_0x11a812[_0x2cb9('0x48')],md5(_0x11a812[_0x2cb9('0x48')]));}else{_0x11a812[_0x2cb9('0x47')]='';}headers[_0x2cb9('0x49')]=getAuth(_0x12d70a);return getUser(_0x12d70a,_0x42a7d1[_0x2cb9('0x4a')])['then'](function(_0x1db315){_0x2ec1bf=_0x1db315;logger[_0x2cb9('0x9')](_0x2cb9('0x4b'),_0x2ec1bf['id']);return getEndUser(_0x12d70a,_0x11a812[_0x2cb9('0x4c')],_0x11a812[_0x2cb9('0x4d')]);})[_0x2cb9('0x13')](function(_0x534add){_0x4c83f8=_0x534add;logger[_0x2cb9('0x9')](_0x2cb9('0x4e'),_0x4c83f8['id']);return getTicket(_0x12d70a,_0x2ec1bf,_0x4c83f8,_0x9fb7cd,_0x11a812);})[_0x2cb9('0x13')](function(_0x3e3c45){if(_0x3e3c45){logger[_0x2cb9('0x9')](_0x2cb9('0x4f'),_0x3e3c45['id']);switch(_0x12d70a[_0x2cb9('0x38')]){case _0x2cb9('0x50'):logger[_0x2cb9('0x9')](_0x2cb9('0x45'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x12d70a['remoteUri'],_0x2ec1bf['id'],_0x3e3c45['id']),'method':_0x2cb9('0x25')});case _0x2cb9('0x51'):logger[_0x2cb9('0x9')](_0x2cb9('0x45'),_0x2cb9('0x52'));emit(util['format'](_0x2cb9('0x53'),_0x42a7d1[_0x2cb9('0xe')]),_0x2cb9('0x54'),{'uri':util[_0x2cb9('0xa')](_0x2cb9('0x55'),_0x12d70a[_0x2cb9('0x18')][_0x2cb9('0x56')](_0x2cb9('0x57'),''),_0x3e3c45['id'])});break;default:logger[_0x2cb9('0x58')]('[QUEUE]',_0x2cb9('0x59'));}}})[_0x2cb9('0x5a')](function(_0x30591e){logger[_0x2cb9('0x58')](_0x2cb9('0x5b'),util[_0x2cb9('0x5c')](_0x30591e,{'showHidden':!![],'depth':null}));});};exports[_0x2cb9('0x5d')]=function(_0x222873,_0x352a48,_0x2862a5,_0x272dc1,_0x196991,_0x517d58,_0x452bc4){var _0x275663,_0x3dde8a;_0x517d58[_0x2cb9('0x18')]=intUtil[_0x2cb9('0x42')](_0x517d58[_0x2cb9('0x18')]);_0x517d58[_0x2cb9('0x43')]=intUtil[_0x2cb9('0x42')](_0x517d58['serverUrl']);if(_0x452bc4&&_0x452bc4['recordingFormat']&&_0x452bc4[_0x2cb9('0x5e')]!=='none'){logger[_0x2cb9('0x9')](_0x2cb9('0x5f'),_0x2cb9('0x46'));_0x352a48[_0x2cb9('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x517d58[_0x2cb9('0x43')],_0x352a48[_0x2cb9('0x48')],md5(_0x352a48['uniqueid']));}headers[_0x2cb9('0x49')]=getAuth(_0x517d58);return getUser(_0x517d58,_0x272dc1[_0x2cb9('0x4a')])[_0x2cb9('0x13')](function(_0x24033a){_0x275663=_0x24033a;logger[_0x2cb9('0x9')](_0x2cb9('0x4b'),_0x275663['id']);return getEndUser(_0x517d58,_0x352a48[_0x2cb9('0x60')],_0x352a48[_0x2cb9('0x61')]);})[_0x2cb9('0x13')](function(_0x3c4996){_0x3dde8a=_0x3c4996;logger[_0x2cb9('0x9')](_0x2cb9('0x4e'),_0x3dde8a['id']);return getTicket(_0x517d58,_0x275663,_0x3dde8a,_0x2862a5,_0x352a48);})[_0x2cb9('0x13')](function(_0x3e9ef9){if(_0x3e9ef9){logger['info'](_0x2cb9('0x4f'),_0x3e9ef9['id']);switch(_0x517d58['type']){case'integrationTab':logger[_0x2cb9('0x9')](_0x2cb9('0x5f'),_0x2cb9('0x62'));return request({'uri':util[_0x2cb9('0xa')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x517d58[_0x2cb9('0x18')],_0x275663['id'],_0x3e9ef9['id']),'method':_0x2cb9('0x25')});case _0x2cb9('0x51'):logger[_0x2cb9('0x9')]('[OUTBOUND]',_0x2cb9('0x52'));emit(util['format'](_0x2cb9('0x53'),_0x272dc1[_0x2cb9('0xe')]),_0x2cb9('0x54'),{'uri':util[_0x2cb9('0xa')]('%s/agent/tickets/%s',_0x517d58[_0x2cb9('0x18')][_0x2cb9('0x56')](_0x2cb9('0x57'),''),_0x3e9ef9['id'])});break;default:logger['error'](_0x2cb9('0x5f'),_0x2cb9('0x59'));}}})[_0x2cb9('0x5a')](function(_0x219c18){logger[_0x2cb9('0x58')](_0x2cb9('0x63'),util[_0x2cb9('0x5c')](_0x219c18,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x30b113,_0x15ba28,_0x450521,_0xc5baa6,_0x1f83fb,_0x319c58){var _0x273a51,_0xc3d015;_0x319c58[_0x2cb9('0x18')]=intUtil['stripTrailingSlash'](_0x319c58[_0x2cb9('0x18')]);_0x319c58[_0x2cb9('0x43')]=intUtil[_0x2cb9('0x42')](_0x319c58[_0x2cb9('0x43')]);if(_0x1f83fb&&_0x1f83fb[_0x2cb9('0x44')]){logger['info']('['+_0x15ba28[_0x2cb9('0x64')]['toUpperCase']()+']',_0x2cb9('0x46'));_0x15ba28[_0x2cb9('0x47')]=util[_0x2cb9('0xa')](_0x2cb9('0x65'),_0x319c58['serverUrl'],_0x15ba28['uniqueid'],md5(_0x15ba28['uniqueid']));}else{_0x15ba28[_0x2cb9('0x47')]='';}headers[_0x2cb9('0x49')]=getAuth(_0x319c58);return getUser(_0x319c58)[_0x2cb9('0x13')](function(_0x47e5d3){_0x273a51=_0x47e5d3;logger['info'](_0x2cb9('0x4b'),_0x273a51['id']);return getEndUser(_0x319c58,_0x15ba28['calleridname'],_0x15ba28[_0x2cb9('0x4d')]);})[_0x2cb9('0x13')](function(_0x4fc23a){_0xc3d015=_0x4fc23a;logger[_0x2cb9('0x9')]('The\x20Enduser\x20ID\x20is:',_0xc3d015['id']);return getTicket(_0x319c58,_0x273a51,_0xc3d015,_0x450521,_0x15ba28);})['then'](function(_0x409330){if(_0x409330){logger[_0x2cb9('0x9')](_0x2cb9('0x4f'),_0x409330['id']);}})[_0x2cb9('0x5a')](function(_0x590c1e){logger[_0x2cb9('0x58')]('['+_0x15ba28[_0x2cb9('0x64')][_0x2cb9('0x66')]()+']'+_0x2cb9('0x67'),util['inspect'](_0x590c1e,{'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 1eab8b6..85078b0 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 _0xb2e3=['data','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','profile','administrator','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','toUpperCase','/api/voice/recordings/','lodash','request-promise','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','string','picklist','type','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2e3,0xf9));var _0x3b2e=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xb2e3[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x3b2e('0x0'));var rp=require(_0x3b2e('0x1'));var md5=require(_0x3b2e('0x2'));var util=require(_0x3b2e('0x3'));var intUtil=require(_0x3b2e('0x4'));var moment=require(_0x3b2e('0x5'));var Redis=require(_0x3b2e('0x6'));var BPromise=require('bluebird');var config=require(_0x3b2e('0x7'));var logger=require(_0x3b2e('0x8'))(_0x3b2e('0x9'));config[_0x3b2e('0xa')]=_[_0x3b2e('0xb')](config[_0x3b2e('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x3b2e('0xc'))(new Redis(config[_0x3b2e('0xa')]));function emit(_0x1191c4,_0x3f8b69,_0x27f4e6){io['to'](_0x1191c4)[_0x3b2e('0xd')](_0x3f8b69,_0x27f4e6);}function request(_0x37d788){logger['debug'](_0x3b2e('0xe'),JSON[_0x3b2e('0xf')](_0x37d788));return rp(_0x37d788);}function getCustomFields(_0x1b056a,_0x18cdda){var _0x355586={};if(_0x1b056a[_0x3b2e('0x10')]>0x0){_[_0x3b2e('0x11')](_0x1b056a,function(_0x1e4a16){if(_['includes']([_0x3b2e('0x12'),_0x3b2e('0x13')],_0x1e4a16[_0x3b2e('0x14')])&&_0x1e4a16[_0x3b2e('0x15')]){_0x355586[_0x1e4a16[_0x3b2e('0x15')]]=_0x1e4a16[_0x3b2e('0x16')]['toString']();}else if(_0x1e4a16[_0x3b2e('0x14')]===_0x3b2e('0x17')&&_0x1e4a16[_0x3b2e('0x18')]&&_0x1e4a16['idField']&&_0x18cdda[_0x1e4a16[_0x3b2e('0x18')]]){_0x355586[_0x1e4a16[_0x3b2e('0x15')]]=_0x18cdda[_0x1e4a16[_0x3b2e('0x18')]]['toString']();}else if(_0x1e4a16[_0x3b2e('0x14')]===_0x3b2e('0x19')&&_0x1e4a16[_0x3b2e('0x1a')]&&_0x1e4a16['Variable'][_0x3b2e('0x1b')]&&_0x1e4a16[_0x3b2e('0x15')]&&_0x18cdda[_0x1e4a16['Variable']['name']['toLowerCase']()]){_0x355586[_0x1e4a16[_0x3b2e('0x15')]]=_0x18cdda[_0x1e4a16[_0x3b2e('0x1a')]['name'][_0x3b2e('0x1c')]()]['toString']();}});}return _0x355586;}function getName(_0x3b6ecc){if(_0x3b6ecc[_0x3b2e('0x1d')]('\x20')>0x0){var _0x45d3d8=_0x3b6ecc[_0x3b2e('0x1e')](/ (.+)/);if(_0x45d3d8[0x1]){return _0x45d3d8;}}return[_0x3b6ecc,_0x3b6ecc];}var accountsTokens={};function getAccessToken(_0x2aaf28){return new Promise(function(_0x347f1d,_0x1b0ae4){if(!_[_0x3b2e('0x1f')](accountsTokens[_0x2aaf28['id']])&&!_['isNil'](accountsTokens[_0x2aaf28['id']][_0x3b2e('0x20')])){if(moment()['isBefore'](accountsTokens[_0x2aaf28['id']][_0x3b2e('0x21')])){_0x347f1d(accountsTokens[_0x2aaf28['id']][_0x3b2e('0x20')]);}}var _0x1f8831;switch(_0x2aaf28['zone']){case'US':_0x1f8831=_0x3b2e('0x22');break;case'AU':_0x1f8831=_0x3b2e('0x23');break;case'EU':_0x1f8831=_0x3b2e('0x24');break;case'IN':_0x1f8831=_0x3b2e('0x25');break;case'CN':_0x1f8831=_0x3b2e('0x26');break;default:_0x1f8831=_0x3b2e('0x24');break;}var _0x1bd421={'method':'POST','uri':_0x1f8831+_0x3b2e('0x27'),'qs':{'refresh_token':_0x2aaf28['refreshToken'],'client_id':_0x2aaf28[_0x3b2e('0x28')],'client_secret':_0x2aaf28['clientSecret'],'grant_type':_0x3b2e('0x29')},'json':!![]};return rp(_0x1bd421)[_0x3b2e('0x2a')](function(_0x2c1d27){accountsTokens[_0x2aaf28['id']]={'access_token':_0x2c1d27[_0x3b2e('0x20')],'expires_in':moment()[_0x3b2e('0x2b')](_0x2c1d27[_0x3b2e('0x21')],_0x3b2e('0x2c'))};_0x347f1d(_0x2c1d27[_0x3b2e('0x20')]);})[_0x3b2e('0x2d')](function(_0x1843e6){logger[_0x3b2e('0x2e')](_0x3b2e('0x2f'),_0x1843e6[_0x3b2e('0x30')]);_0x1b0ae4(_0x1843e6);});});}function getUser(_0xd94722,_0x4cdc90,_0x40c5e0,_0xf2a6f7){logger[_0x3b2e('0x31')](_0x3b2e('0x32'));return request({'method':_0x3b2e('0x33'),'uri':util[_0x3b2e('0x34')](_0x3b2e('0x35'),_0x4cdc90),'qs':{'type':_0x3b2e('0x36')},'headers':{'Authorization':_0x3b2e('0x37')+_0xd94722},'json':!![]})[_0x3b2e('0x2a')](function(_0x38a541){if(_0x38a541[_0x3b2e('0x38')]){var _0x20a080=-0x1;if(_['isArrayLikeObject'](_0x38a541[_0x3b2e('0x38')])){if(!_[_0x3b2e('0x1f')](_0xf2a6f7)){_0x20a080=_[_0x3b2e('0x39')](_0x38a541[_0x3b2e('0x38')],function(_0x23aa09){return _0x23aa09[_0x3b2e('0x3a')]===_0xf2a6f7;});}if(_0x20a080>=0x0){logger[_0x3b2e('0x31')](_0x3b2e('0x3b'));}else{logger[_0x3b2e('0x31')](_0x3b2e('0x3c'));_0x20a080=_[_0x3b2e('0x39')](_0x38a541[_0x3b2e('0x38')],function(_0x51c5c9){return _0x51c5c9['profile'][_0x3b2e('0x1b')]===_0x3b2e('0x3d');});}return _0x38a541[_0x3b2e('0x38')][_0x20a080];}else{if(_0x38a541[_0x3b2e('0x3e')]['profile']['name']==='Administrator'){logger[_0x3b2e('0x31')](_0x3b2e('0x3c'));user=_0x38a541[_0x3b2e('0x3e')];return user;}else{logger['error'](_0x3b2e('0x3f'),JSON[_0x3b2e('0xf')](_0x38a541));throw new Error(_0x3b2e('0x40')+JSON['stringify'](_0x38a541));}}}else{logger[_0x3b2e('0x2e')](_0x3b2e('0x3f'),JSON[_0x3b2e('0xf')](_0x38a541));throw new Error(_0x3b2e('0x40')+JSON['stringify'](_0x38a541));}})[_0x3b2e('0x2d')](function(_0x3bbb13){console['error'](_0x3bbb13);});}function getZohoUser(_0x57bf73,_0x487db1){return new BPromise(function(_0x383bd1,_0x34fadd){request(_0x57bf73)['then'](function(_0x3a281f){var _0x58f05d=null;if(_0x3a281f){_0x58f05d=_0x3a281f[_0x3b2e('0x41')][0x0];_0x58f05d['enduserType']=_0x487db1;}_0x383bd1(_0x58f05d);})[_0x3b2e('0x2d')](function(_0x899523){_0x34fadd(_0x899523);});});}function createEndUser(_0x2d8e17,_0xbb972d,_0x2c11b0,_0x18808a,_0x567fc6,_0x6946fc){var _0x2c11b0=getName(_0x2c11b0);return request({'method':_0x3b2e('0x42'),'uri':_0x3b2e('0x43')+_0xbb972d+_0x3b2e('0x44')+_[_0x3b2e('0x45')](_0x6946fc[_0x3b2e('0x46')])+'s','body':{'data':[{'Last_Name':_0x2c11b0[0x1],'First_Name':_0x2c11b0[0x0],'Phone':_0x18808a,'Owner':{'name':!_[_0x3b2e('0x1f')](_0x567fc6[_0x3b2e('0x47')][_0x3b2e('0x1b')])?_0x567fc6['role'][_0x3b2e('0x1b')]:!_['isNil'](_0x567fc6[_0x3b2e('0x48')])?_0x567fc6[_0x3b2e('0x48')]+'\x20'+_0x567fc6[_0x3b2e('0x49')]:_0x567fc6[_0x3b2e('0x49')],'id':_0x567fc6['id']}}]},'headers':{'Authorization':_0x3b2e('0x37')+_0x2d8e17},'json':!![]})[_0x3b2e('0x2a')](function(_0x3b4a48){if(_0x3b4a48&&_0x3b4a48['data'][0x0][_0x3b2e('0x4a')]===_0x3b2e('0x4b')){var _0x219bf5=_0x3b4a48[_0x3b2e('0x41')][0x0][_0x3b2e('0x4c')];_0x219bf5[_0x3b2e('0x4d')]=_['startCase'](_0x6946fc[_0x3b2e('0x46')])+'s';return _0x219bf5;}logger[_0x3b2e('0x2e')](_0x3b2e('0x3f'),JSON[_0x3b2e('0xf')](data));throw new Error(_0x3b2e('0x4e')+JSON['stringify'](data));})[_0x3b2e('0x2d')](function(_0x3d3dfa){console['log'](_0x3b2e('0x4f'),_0x3d3dfa);});}function getEndUser(_0x401b61,_0xf0f096,_0x379b8e,_0x2c2cf5,_0x56f7c1,_0x5b575f,_0x35a58d){var _0x2df30f={'method':'GET','uri':'','headers':{'Authorization':_0x3b2e('0x37')+_0x401b61},'json':!![]};switch(_0x35a58d[_0x3b2e('0x50')]){case _0x3b2e('0x51'):_0x2df30f[_0x3b2e('0x52')]=_0x3b2e('0x43')+_0xf0f096+_0x3b2e('0x53')+_0x56f7c1+'))';return getZohoUser(_0x2df30f,_0x3b2e('0x54'))[_0x3b2e('0x2a')](function(_0x5ea58c){if(_0x5ea58c)return _0x5ea58c;_0x2df30f[_0x3b2e('0x52')]=_0x3b2e('0x43')+_0xf0f096+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x56f7c1+'))';return getZohoUser(_0x2df30f,'Leads')[_0x3b2e('0x2a')](function(_0x5de99f){if(_0x5de99f)return _0x5de99f;if(_0x35a58d[_0x3b2e('0x46')]!=_0x3b2e('0x55')){return createEndUser(_0x401b61,_0xf0f096,_0x2c2cf5,_0x56f7c1,_0x5b575f,_0x35a58d);}else{return{};}});});break;case _0x3b2e('0x56'):_0x2df30f[_0x3b2e('0x52')]=_0x3b2e('0x43')+_0xf0f096+_0x3b2e('0x53')+_0x56f7c1+'))';return getZohoUser(_0x2df30f,_0x3b2e('0x54'))[_0x3b2e('0x2a')](function(_0x1b814a){if(_0x1b814a)return _0x1b814a;if(_0x35a58d['moduleCreate']!='nothing'){return createEndUser(_0x401b61,_0xf0f096,_0x2c2cf5,_0x56f7c1,_0x5b575f,_0x35a58d);}else{return{};}});break;case _0x3b2e('0x57'):_0x2df30f[_0x3b2e('0x52')]=_0x3b2e('0x43')+_0xf0f096+_0x3b2e('0x58')+_0x56f7c1+'))';return getZohoUser(_0x2df30f,_0x3b2e('0x59'))[_0x3b2e('0x2a')](function(_0x1f05b2){if(_0x1f05b2)return _0x1f05b2;if(_0x35a58d[_0x3b2e('0x46')]!=_0x3b2e('0x55')){return createEndUser(_0x401b61,_0xf0f096,_0x2c2cf5,_0x56f7c1,_0x5b575f,_0x35a58d);}else{return{};}});break;}}function getCall(_0x1eaf85,_0x53a565,_0x4a3c31,_0x3114f8,_0x12e321,_0x42ced0,_0x882b37,_0xdbfff1){logger['info'](_0x3b2e('0x5a'));var _0x16ff0f={};_0x16ff0f[_0x3b2e('0x5b')]={'name':!_[_0x3b2e('0x1f')](_0x3114f8[_0x3b2e('0x47')][_0x3b2e('0x1b')])&&!_[_0x3b2e('0x1f')](_0x3114f8[_0x3b2e('0x5c')][_0x3b2e('0x1b')])&&_0x3114f8[_0x3b2e('0x5c')][_0x3b2e('0x1b')]===_0x3b2e('0x5d')?_0x3114f8[_0x3b2e('0x47')][_0x3b2e('0x1b')]:!_[_0x3b2e('0x1f')](_0x3114f8[_0x3b2e('0x48')])?_0x3114f8['first_name']+'\x20'+_0x3114f8[_0x3b2e('0x49')]:_0x3114f8['last_name'],'id':_0x3114f8['id']};_0x16ff0f['Subject']=intUtil[_0x3b2e('0x5e')](_0x42ced0['Subjects'],_0x882b37,'\x20');_0x16ff0f[_0x3b2e('0x5f')]=intUtil[_0x3b2e('0x5e')](_0x42ced0[_0x3b2e('0x60')],_0x882b37,'\x0a');if(_0x12e321[_0x3b2e('0x4d')]===_0x3b2e('0x54')){_0x16ff0f[_0x3b2e('0x61')]={'name':!_['isNil'](_0x12e321[_0x3b2e('0x62')])?_0x12e321[_0x3b2e('0x62')]:!_[_0x3b2e('0x1f')](_0x12e321[_0x3b2e('0x63')])?_0x12e321[_0x3b2e('0x63')]+'\x20'+_0x12e321[_0x3b2e('0x64')]:_0x12e321['Last_Name'],'id':_0x12e321['id']};}if(_0x12e321['enduserType']===_0x3b2e('0x59')){_0x16ff0f[_0x3b2e('0x65')]={'name':!_[_0x3b2e('0x1f')](_0x12e321[_0x3b2e('0x62')])?_0x12e321[_0x3b2e('0x62')]:!_[_0x3b2e('0x1f')](_0x12e321[_0x3b2e('0x63')])?_0x12e321[_0x3b2e('0x63')]+'\x20'+_0x12e321[_0x3b2e('0x64')]:_0x12e321[_0x3b2e('0x64')],'id':_0x12e321['id']};_0x16ff0f[_0x3b2e('0x66')]=_[_0x3b2e('0x45')](_0x12e321['enduserType']);}if(_0x882b37[_0x3b2e('0x67')]){_0x16ff0f[_0x3b2e('0x68')]=moment[_0x3b2e('0x69')](parseInt(_0x882b37['talktime'])*0x3e8)[_0x3b2e('0x34')]('mm:ss');}else if(_0x882b37[_0x3b2e('0x6a')]&&_0x882b37[_0x3b2e('0x6b')]){_0x16ff0f[_0x3b2e('0x68')]=moment[_0x3b2e('0x69')](moment(_0x882b37['endtime'],_0x3b2e('0x6c'))[_0x3b2e('0x6d')](moment(_0x882b37['starttime'],_0x3b2e('0x6c'))))[_0x3b2e('0x34')]('mm:ss');}switch(_0x882b37[_0x3b2e('0x6e')]){case'called':_0x16ff0f[_0x3b2e('0x6f')]=_0x3b2e('0x70');break;case _0x3b2e('0x71'):case'connect':_0x16ff0f[_0x3b2e('0x6f')]=_0x3b2e('0x72');break;case _0x3b2e('0x73'):_0x16ff0f[_0x3b2e('0x6f')]=_0x3b2e('0x74');break;case _0x3b2e('0x75'):_0x16ff0f['Call_Result']='Abandoned';break;case _0x3b2e('0x76'):_0x16ff0f[_0x3b2e('0x6f')]=_0x3b2e('0x77');default:}_0x16ff0f[_0x3b2e('0x78')]=(_0xdbfff1===_0x3b2e('0x79')?moment(_0x882b37[_0x3b2e('0x7a')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x882b37[_0x3b2e('0x7b')])[_0x3b2e('0x34')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x3b2e('0x34')]('YYYY-MM-DDTHH:mm:ss');_0x16ff0f[_0x3b2e('0x7c')]=_0xdbfff1||_0x3b2e('0x7d');_0x16ff0f=_[_0x3b2e('0x7e')](_0x16ff0f,getCustomFields(_0x42ced0['Fields'],_0x882b37));return request({'method':_0x3b2e('0x42'),'uri':_0x3b2e('0x43')+_0x53a565+_0x3b2e('0x7f'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1eaf85},'body':{'data':[_0x16ff0f]},'json':!![]})[_0x3b2e('0x2a')](function(_0x3087fc){if(_0x3087fc&&_0x3087fc[_0x3b2e('0x41')][0x0][_0x3b2e('0x4a')]===_0x3b2e('0x4b')){logger[_0x3b2e('0x31')]('Call\x20created!');return{'id':_0x3087fc[_0x3b2e('0x41')][0x0][_0x3b2e('0x4c')]['id']};}})[_0x3b2e('0x2d')](function(_0x432e0b){logger[_0x3b2e('0x31')](_0x3b2e('0x80'),_0x432e0b[_0x3b2e('0x30')]);console[_0x3b2e('0x81')](_0x3b2e('0x80'),_0x432e0b);});}exports[_0x3b2e('0x82')]=function(_0x534cba,_0x3be11c,_0x4ab8e2,_0x3c5866,_0x1466be,_0x1fb31d){var _0x3fbce3,_0x45492c,_0x544547;_0x1fb31d[_0x3b2e('0x83')]=intUtil[_0x3b2e('0x84')](_0x1fb31d[_0x3b2e('0x83')]);_0x1fb31d[_0x3b2e('0x85')]=intUtil[_0x3b2e('0x84')](_0x1fb31d[_0x3b2e('0x85')]);if(_0x1466be&&_0x1466be[_0x3b2e('0x86')]){logger[_0x3b2e('0x31')]('[QUEUE]',_0x3b2e('0x87'));_0x3be11c[_0x3b2e('0x88')]=_0x1fb31d[_0x3b2e('0x85')]+'/api/voice/recordings/'+_0x3be11c['uniqueid']+_0x3b2e('0x89')+md5(_0x3be11c['uniqueid']);}else{_0x3be11c[_0x3b2e('0x88')]='';}var _0x24e102=_0x1fb31d[_0x3b2e('0x83')]===_0x3b2e('0x8a')?'eu':_0x3b2e('0x8b');return getAccessToken(_0x1fb31d)[_0x3b2e('0x2a')](function(_0x4e18e4){_0x544547=_0x4e18e4;return getUser(_0x544547,_0x24e102,_0x1fb31d,_0x3c5866[_0x3b2e('0x3a')]);})['then'](function(_0x659965){_0x3fbce3=_0x659965;logger['info'](_0x3b2e('0x8c'),_0x3fbce3['id']);return getEndUser(_0x544547,_0x24e102,_0x1fb31d,_0x3be11c[_0x3b2e('0x8d')],_0x3be11c[_0x3b2e('0x8e')],_0x3fbce3,_0x4ab8e2);})[_0x3b2e('0x2a')](function(_0x4f8e09){_0x45492c=_0x4f8e09;return getCall(_0x544547,_0x24e102,_0x1fb31d,_0x3fbce3,_0x45492c,_0x4ab8e2,_0x3be11c,_0x3b2e('0x7d'));})['then'](function(_0x2916ab){if(_0x2916ab){logger[_0x3b2e('0x31')]('The\x20Call\x20ID\x20is:',_0x2916ab['id']);logger[_0x3b2e('0x31')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x3b2e('0x8f'),_0x3c5866[_0x3b2e('0x1b')]),_0x3b2e('0x90'),{'uri':_0x3b2e('0x91')+_0x1fb31d[_0x3b2e('0x83')]+_0x3b2e('0x92')+_0x2916ab['id']});}})[_0x3b2e('0x2d')](function(_0xd21f7b){logger[_0x3b2e('0x2e')](_0x3b2e('0x93'),JSON[_0x3b2e('0xf')](_0xd21f7b));});};exports[_0x3b2e('0x79')]=function(_0xc5ee4e,_0x19e3bd,_0xca0a77,_0x2d4ecf,_0x48a767,_0x3e6770,_0x303d94){var _0x3194c9,_0x48e392,_0x2a0a5b;_0x3e6770[_0x3b2e('0x83')]=intUtil['stripTrailingSlash'](_0x3e6770['host']);_0x3e6770[_0x3b2e('0x85')]=intUtil[_0x3b2e('0x84')](_0x3e6770[_0x3b2e('0x85')]);if(_0x303d94&&_0x303d94[_0x3b2e('0x94')]&&_0x303d94[_0x3b2e('0x94')]!==_0x3b2e('0x95')){logger[_0x3b2e('0x31')](_0x3b2e('0x96'),_0x3b2e('0x87'));_0x19e3bd[_0x3b2e('0x88')]=_0x3e6770[_0x3b2e('0x85')]+'/api/voice/recordings/'+_0x19e3bd[_0x3b2e('0x97')]+_0x3b2e('0x89')+md5(_0x19e3bd[_0x3b2e('0x97')]);}var _0x3e2838=_0x3e6770['host']==='zoho.eu'?'eu':_0x3b2e('0x8b');return getAccessToken(_0x3e6770)[_0x3b2e('0x2a')](function(_0x4dca59){_0x2a0a5b=_0x4dca59;return getUser(_0x2a0a5b,_0x3e2838,_0x3e6770,_0x2d4ecf[_0x3b2e('0x3a')]);})[_0x3b2e('0x2a')](function(_0x1b07aa){_0x3194c9=_0x1b07aa;logger['info'](_0x3b2e('0x8c'),_0x3194c9['id']);return getEndUser(_0x2a0a5b,_0x3e2838,_0x3e6770,_0x19e3bd['destcalleridname'],_0x19e3bd[_0x3b2e('0x98')],_0x3194c9,_0xca0a77);})[_0x3b2e('0x2a')](function(_0x5b45d4){_0x48e392=_0x5b45d4;return getCall(_0x2a0a5b,_0x3e2838,_0x3e6770,_0x3194c9,_0x48e392,_0xca0a77,_0x19e3bd,'Outbound');})[_0x3b2e('0x2a')](function(_0x23589d){if(_0x23589d){logger[_0x3b2e('0x31')](_0x3b2e('0x99'),_0x23589d['id']);logger[_0x3b2e('0x31')](_0x3b2e('0x96'),_0x3b2e('0x9a'));emit(util[_0x3b2e('0x34')](_0x3b2e('0x8f'),_0x2d4ecf[_0x3b2e('0x1b')]),_0x3b2e('0x90'),{'uri':_0x3b2e('0x91')+_0x3e6770[_0x3b2e('0x83')]+'/crm/EntityInfo.do?module=Calls&id='+_0x23589d['id']});}})[_0x3b2e('0x2d')](function(_0x203348){logger[_0x3b2e('0x2e')]('[OUTBOUND]',JSON[_0x3b2e('0xf')](_0x203348));});};exports['unmanaged']=function(_0x478960,_0x438a42,_0x383ab7,_0x36c03a,_0x2995d8,_0x31506c){var _0x245af6,_0x3856e3,_0x3b0e3d;_0x31506c[_0x3b2e('0x83')]=intUtil[_0x3b2e('0x84')](_0x31506c[_0x3b2e('0x83')]);_0x31506c[_0x3b2e('0x85')]=intUtil[_0x3b2e('0x84')](_0x31506c['serverUrl']);if(_0x2995d8&&_0x2995d8[_0x3b2e('0x86')]){logger[_0x3b2e('0x31')]('['+_0x438a42[_0x3b2e('0x6e')][_0x3b2e('0x9b')]()+']','Recording\x20is\x20enabled!');_0x438a42[_0x3b2e('0x88')]=_0x31506c[_0x3b2e('0x85')]+_0x3b2e('0x9c')+_0x438a42['uniqueid']+_0x3b2e('0x89')+md5(_0x438a42[_0x3b2e('0x97')]);}else{_0x438a42[_0x3b2e('0x88')]='';}var _0x58c71a=_0x31506c['host']===_0x3b2e('0x8a')?'eu':_0x3b2e('0x8b');return getAccessToken(_0x31506c)[_0x3b2e('0x2a')](function(_0x5e1c07){_0x3b0e3d=_0x5e1c07;return getUser(_0x3b0e3d,_0x58c71a,_0x31506c);})[_0x3b2e('0x2a')](function(_0x428f33){_0x245af6=_0x428f33;logger['info'](_0x3b2e('0x8c'),_0x245af6['id']);return getEndUser(_0x3b0e3d,_0x58c71a,_0x31506c,_0x438a42[_0x3b2e('0x8d')],_0x438a42[_0x3b2e('0x8e')],_0x245af6,_0x383ab7);})['then'](function(_0x7ae9cd){_0x3856e3=_0x7ae9cd;return getCall(_0x3b0e3d,_0x58c71a,_0x31506c,_0x245af6,_0x3856e3,_0x383ab7,_0x438a42,'Inbound');})['then'](function(_0x2a3991){if(_0x2a3991){logger[_0x3b2e('0x31')](_0x3b2e('0x99'),_0x2a3991['id']);}})[_0x3b2e('0x2d')](function(_0x1ea0a3){logger[_0x3b2e('0x2e')]('['+_0x438a42[_0x3b2e('0x6e')]['toUpperCase']()+']',JSON[_0x3b2e('0xf')](_0x1ea0a3));});}; \ No newline at end of file +var _0x5fa1=['answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','Answered','rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','Fields','/crm/v2/Calls','details','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridnum','Outbound','https://crm.','unmanaged','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','includes','string','picklist','type','content','toString','variable','variableName','idField','customVariable','Variable','toLowerCase','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','name','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','data','code','SUCCESS','startCase','The\x20failing\x20result\x20is','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Contacts','lead','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','Call_Duration','utc','talktime'];(function(_0x293428,_0x10918d){var _0x339932=function(_0x2c2073){while(--_0x2c2073){_0x293428['push'](_0x293428['shift']());}};_0x339932(++_0x10918d);}(_0x5fa1,0xcb));var _0x15fa=function(_0x356b6e,_0x1af516){_0x356b6e=_0x356b6e-0x0;var _0x2eb2e7=_0x5fa1[_0x356b6e];return _0x2eb2e7;};'use strict';var _=require(_0x15fa('0x0'));var rp=require(_0x15fa('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0x15fa('0x2'));var moment=require(_0x15fa('0x3'));var Redis=require('ioredis');var BPromise=require(_0x15fa('0x4'));var config=require(_0x15fa('0x5'));var logger=require(_0x15fa('0x6'))(_0x15fa('0x7'));config[_0x15fa('0x8')]=_[_0x15fa('0x9')](config[_0x15fa('0x8')],{'host':_0x15fa('0xa'),'port':0x18eb});var io=require(_0x15fa('0xb'))(new Redis(config['redis']));function emit(_0x169d79,_0x109277,_0x4bffe8){io['to'](_0x169d79)[_0x15fa('0xc')](_0x109277,_0x4bffe8);}function request(_0xa6008e){logger[_0x15fa('0xd')](_0x15fa('0xe'),JSON[_0x15fa('0xf')](_0xa6008e));return rp(_0xa6008e);}function getCustomFields(_0x14e509,_0x448ed4){var _0x30f41c={};if(_0x14e509[_0x15fa('0x10')]>0x0){_['forEach'](_0x14e509,function(_0x403087){if(_[_0x15fa('0x11')]([_0x15fa('0x12'),_0x15fa('0x13')],_0x403087[_0x15fa('0x14')])&&_0x403087['idField']){_0x30f41c[_0x403087['idField']]=_0x403087[_0x15fa('0x15')][_0x15fa('0x16')]();}else if(_0x403087[_0x15fa('0x14')]===_0x15fa('0x17')&&_0x403087[_0x15fa('0x18')]&&_0x403087[_0x15fa('0x19')]&&_0x448ed4[_0x403087[_0x15fa('0x18')]]){_0x30f41c[_0x403087[_0x15fa('0x19')]]=_0x448ed4[_0x403087[_0x15fa('0x18')]]['toString']();}else if(_0x403087[_0x15fa('0x14')]===_0x15fa('0x1a')&&_0x403087[_0x15fa('0x1b')]&&_0x403087[_0x15fa('0x1b')]['name']&&_0x403087[_0x15fa('0x19')]&&_0x448ed4[_0x403087[_0x15fa('0x1b')]['name'][_0x15fa('0x1c')]()]){_0x30f41c[_0x403087[_0x15fa('0x19')]]=_0x448ed4[_0x403087[_0x15fa('0x1b')]['name'][_0x15fa('0x1c')]()]['toString']();}});}return _0x30f41c;}function getName(_0x550901){if(_0x550901['indexOf']('\x20')>0x0){var _0x524d20=_0x550901['split'](/ (.+)/);if(_0x524d20[0x1]){return _0x524d20;}}return[_0x550901,_0x550901];}var accountsTokens={};function getAccessToken(_0x4061b5){return new Promise(function(_0x31fd0a,_0x4d3f6b){if(!_[_0x15fa('0x1d')](accountsTokens[_0x4061b5['id']])&&!_[_0x15fa('0x1d')](accountsTokens[_0x4061b5['id']][_0x15fa('0x1e')])){if(moment()[_0x15fa('0x1f')](accountsTokens[_0x4061b5['id']][_0x15fa('0x20')])){_0x31fd0a(accountsTokens[_0x4061b5['id']][_0x15fa('0x1e')]);}}var _0x5985aa;switch(_0x4061b5['zone']){case'US':_0x5985aa='https://accounts.zoho.com';break;case'AU':_0x5985aa=_0x15fa('0x21');break;case'EU':_0x5985aa='https://accounts.zoho.eu';break;case'IN':_0x5985aa=_0x15fa('0x22');break;case'CN':_0x5985aa=_0x15fa('0x23');break;default:_0x5985aa=_0x15fa('0x24');break;}var _0x34e72d={'method':_0x15fa('0x25'),'uri':_0x5985aa+'/oauth/v2/token','qs':{'refresh_token':_0x4061b5[_0x15fa('0x26')],'client_id':_0x4061b5[_0x15fa('0x27')],'client_secret':_0x4061b5[_0x15fa('0x28')],'grant_type':_0x15fa('0x29')},'json':!![]};return rp(_0x34e72d)[_0x15fa('0x2a')](function(_0x4b3f73){accountsTokens[_0x4061b5['id']]={'access_token':_0x4b3f73[_0x15fa('0x1e')],'expires_in':moment()[_0x15fa('0x2b')](_0x4b3f73['expires_in'],'seconds')};_0x31fd0a(_0x4b3f73[_0x15fa('0x1e')]);})[_0x15fa('0x2c')](function(_0x566d3a){logger[_0x15fa('0x2d')]('Failing\x20creating\x20the\x20access_token',_0x566d3a[_0x15fa('0x2e')]);_0x4d3f6b(_0x566d3a);});});}function getUser(_0x47afde,_0x185d7e,_0x388894,_0x13e66f){logger[_0x15fa('0x2f')](_0x15fa('0x30'));return request({'method':_0x15fa('0x31'),'uri':util[_0x15fa('0x32')](_0x15fa('0x33'),_0x185d7e),'qs':{'type':_0x15fa('0x34')},'headers':{'Authorization':_0x15fa('0x35')+_0x47afde},'json':!![]})[_0x15fa('0x2a')](function(_0x2283fa){if(_0x2283fa['users']){var _0x197f2a=-0x1;if(_['isArrayLikeObject'](_0x2283fa[_0x15fa('0x36')])){if(!_['isNil'](_0x13e66f)){_0x197f2a=_['findIndex'](_0x2283fa['users'],function(_0x13dc2f){return _0x13dc2f[_0x15fa('0x37')]===_0x13e66f;});}if(_0x197f2a>=0x0){logger[_0x15fa('0x2f')](_0x15fa('0x38'));}else{logger[_0x15fa('0x2f')](_0x15fa('0x39'));_0x197f2a=_['findIndex'](_0x2283fa[_0x15fa('0x36')],function(_0x333c5d){return _0x333c5d[_0x15fa('0x3a')][_0x15fa('0x3b')]===_0x15fa('0x3c');});}return _0x2283fa[_0x15fa('0x36')][_0x197f2a];}else{if(_0x2283fa['user'][_0x15fa('0x3a')]['name']===_0x15fa('0x3c')){logger[_0x15fa('0x2f')](_0x15fa('0x39'));user=_0x2283fa[_0x15fa('0x3d')];return user;}else{logger[_0x15fa('0x2d')]('The\x20failing\x20result\x20is',JSON[_0x15fa('0xf')](_0x2283fa));throw new Error(_0x15fa('0x3e')+JSON[_0x15fa('0xf')](_0x2283fa));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x15fa('0xf')](_0x2283fa));throw new Error(_0x15fa('0x3e')+JSON[_0x15fa('0xf')](_0x2283fa));}})[_0x15fa('0x2c')](function(_0x56cc89){console['error'](_0x56cc89);});}function getZohoUser(_0x2e3896,_0xad1140){return new BPromise(function(_0x47b9bf,_0x2e4223){request(_0x2e3896)[_0x15fa('0x2a')](function(_0x8f3c2f){var _0x5ddc1e=null;if(_0x8f3c2f){_0x5ddc1e=_0x8f3c2f['data'][0x0];_0x5ddc1e[_0x15fa('0x3f')]=_0xad1140;}_0x47b9bf(_0x5ddc1e);})[_0x15fa('0x2c')](function(_0x1fab1a){_0x2e4223(_0x1fab1a);});});}function createEndUser(_0x2956fc,_0x594af5,_0x16ac0d,_0x4be491,_0x2fa2a6,_0x45235d){var _0x16ac0d=getName(_0x16ac0d);return request({'method':_0x15fa('0x25'),'uri':_0x15fa('0x40')+_0x594af5+_0x15fa('0x41')+_['startCase'](_0x45235d[_0x15fa('0x42')])+'s','body':{'data':[{'Last_Name':_0x16ac0d[0x1],'First_Name':_0x16ac0d[0x0],'Phone':_0x4be491,'Owner':{'name':!_[_0x15fa('0x1d')](_0x2fa2a6[_0x15fa('0x43')][_0x15fa('0x3b')])?_0x2fa2a6[_0x15fa('0x43')][_0x15fa('0x3b')]:!_['isNil'](_0x2fa2a6['first_name'])?_0x2fa2a6[_0x15fa('0x44')]+'\x20'+_0x2fa2a6[_0x15fa('0x45')]:_0x2fa2a6[_0x15fa('0x45')],'id':_0x2fa2a6['id']}}]},'headers':{'Authorization':_0x15fa('0x35')+_0x2956fc},'json':!![]})['then'](function(_0x1ef2d8){if(_0x1ef2d8&&_0x1ef2d8[_0x15fa('0x46')][0x0][_0x15fa('0x47')]===_0x15fa('0x48')){var _0x413a31=_0x1ef2d8[_0x15fa('0x46')][0x0]['details'];_0x413a31['enduserType']=_[_0x15fa('0x49')](_0x45235d['moduleCreate'])+'s';return _0x413a31;}logger['error'](_0x15fa('0x4a'),JSON[_0x15fa('0xf')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})['catch'](function(_0x160b8f){console[_0x15fa('0x4b')](_0x15fa('0x4c'),_0x160b8f);});}function getEndUser(_0x3cecbf,_0x4d2b19,_0x5ab84c,_0x2bf256,_0x8ece89,_0x5d221c,_0x572bcb){var _0x2283e7={'method':_0x15fa('0x31'),'uri':'','headers':{'Authorization':_0x15fa('0x35')+_0x3cecbf},'json':!![]};switch(_0x572bcb[_0x15fa('0x4d')]){case _0x15fa('0x4e'):_0x2283e7[_0x15fa('0x4f')]=_0x15fa('0x40')+_0x4d2b19+_0x15fa('0x50')+_0x8ece89+'))';return getZohoUser(_0x2283e7,'Contacts')['then'](function(_0x1c5464){if(_0x1c5464)return _0x1c5464;_0x2283e7[_0x15fa('0x4f')]=_0x15fa('0x40')+_0x4d2b19+_0x15fa('0x51')+_0x8ece89+'))';return getZohoUser(_0x2283e7,_0x15fa('0x52'))[_0x15fa('0x2a')](function(_0x376aca){if(_0x376aca)return _0x376aca;if(_0x572bcb[_0x15fa('0x42')]!=_0x15fa('0x53')){return createEndUser(_0x3cecbf,_0x4d2b19,_0x2bf256,_0x8ece89,_0x5d221c,_0x572bcb);}else{return{};}});});break;case'contact':_0x2283e7[_0x15fa('0x4f')]='https://www.zohoapis.'+_0x4d2b19+_0x15fa('0x50')+_0x8ece89+'))';return getZohoUser(_0x2283e7,_0x15fa('0x54'))['then'](function(_0x3462d5){if(_0x3462d5)return _0x3462d5;if(_0x572bcb['moduleCreate']!=_0x15fa('0x53')){return createEndUser(_0x3cecbf,_0x4d2b19,_0x2bf256,_0x8ece89,_0x5d221c,_0x572bcb);}else{return{};}});break;case _0x15fa('0x55'):_0x2283e7[_0x15fa('0x4f')]='https://www.zohoapis.'+_0x4d2b19+_0x15fa('0x51')+_0x8ece89+'))';return getZohoUser(_0x2283e7,'Leads')[_0x15fa('0x2a')](function(_0x41913b){if(_0x41913b)return _0x41913b;if(_0x572bcb[_0x15fa('0x42')]!=_0x15fa('0x53')){return createEndUser(_0x3cecbf,_0x4d2b19,_0x2bf256,_0x8ece89,_0x5d221c,_0x572bcb);}else{return{};}});break;}}function getCall(_0xb2ed59,_0x8f03b1,_0x2238dd,_0x2e2c82,_0xda1d99,_0xa0f20c,_0x245d91,_0x54c664){logger[_0x15fa('0x2f')](_0x15fa('0x56'));var _0x5ab999={};_0x5ab999[_0x15fa('0x57')]={'name':!_[_0x15fa('0x1d')](_0x2e2c82[_0x15fa('0x43')]['name'])&&!_[_0x15fa('0x1d')](_0x2e2c82[_0x15fa('0x3a')][_0x15fa('0x3b')])&&_0x2e2c82[_0x15fa('0x3a')][_0x15fa('0x3b')]==='administrator'?_0x2e2c82[_0x15fa('0x43')][_0x15fa('0x3b')]:!_[_0x15fa('0x1d')](_0x2e2c82[_0x15fa('0x44')])?_0x2e2c82[_0x15fa('0x44')]+'\x20'+_0x2e2c82[_0x15fa('0x45')]:_0x2e2c82[_0x15fa('0x45')],'id':_0x2e2c82['id']};_0x5ab999[_0x15fa('0x58')]=intUtil[_0x15fa('0x59')](_0xa0f20c[_0x15fa('0x5a')],_0x245d91,'\x20');_0x5ab999[_0x15fa('0x5b')]=intUtil[_0x15fa('0x59')](_0xa0f20c[_0x15fa('0x5c')],_0x245d91,'\x0a');if(_0xda1d99[_0x15fa('0x3f')]===_0x15fa('0x54')){_0x5ab999['Who_Id']={'name':!_[_0x15fa('0x1d')](_0xda1d99[_0x15fa('0x5d')])?_0xda1d99[_0x15fa('0x5d')]:!_[_0x15fa('0x1d')](_0xda1d99['First_Name'])?_0xda1d99[_0x15fa('0x5e')]+'\x20'+_0xda1d99['Last_Name']:_0xda1d99['Last_Name'],'id':_0xda1d99['id']};}if(_0xda1d99['enduserType']===_0x15fa('0x52')){_0x5ab999['What_Id']={'name':!_[_0x15fa('0x1d')](_0xda1d99[_0x15fa('0x5d')])?_0xda1d99[_0x15fa('0x5d')]:!_['isNil'](_0xda1d99[_0x15fa('0x5e')])?_0xda1d99[_0x15fa('0x5e')]+'\x20'+_0xda1d99[_0x15fa('0x5f')]:_0xda1d99[_0x15fa('0x5f')],'id':_0xda1d99['id']};_0x5ab999['$se_module']=_['startCase'](_0xda1d99[_0x15fa('0x3f')]);}if(_0x245d91['talktime']){_0x5ab999[_0x15fa('0x60')]=moment[_0x15fa('0x61')](parseInt(_0x245d91[_0x15fa('0x62')])*0x3e8)[_0x15fa('0x32')]('mm:ss');}else if(_0x245d91[_0x15fa('0x63')]&&_0x245d91[_0x15fa('0x64')]){_0x5ab999[_0x15fa('0x60')]=moment['utc'](moment(_0x245d91[_0x15fa('0x64')],_0x15fa('0x65'))['diff'](moment(_0x245d91[_0x15fa('0x66')],_0x15fa('0x65'))))[_0x15fa('0x32')](_0x15fa('0x67'));}switch(_0x245d91[_0x15fa('0x68')]){case _0x15fa('0x69'):_0x5ab999[_0x15fa('0x6a')]=_0x15fa('0x6b');break;case _0x15fa('0x6c'):case'connect':_0x5ab999[_0x15fa('0x6a')]=_0x15fa('0x6d');break;case _0x15fa('0x6e'):_0x5ab999['Call_Result']='Rejected';break;case _0x15fa('0x6f'):_0x5ab999[_0x15fa('0x6a')]='Abandoned';break;case _0x15fa('0x70'):_0x5ab999[_0x15fa('0x6a')]=_0x15fa('0x71');default:}_0x5ab999[_0x15fa('0x72')]=(_0x54c664===_0x15fa('0x73')?moment(_0x245d91['starttime'])[_0x15fa('0x32')](_0x15fa('0x65')):moment(_0x245d91[_0x15fa('0x74')])['format']('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0x15fa('0x65'));_0x5ab999['Call_Type']=_0x54c664||_0x15fa('0x75');_0x5ab999=_['merge'](_0x5ab999,getCustomFields(_0xa0f20c[_0x15fa('0x76')],_0x245d91));return request({'method':_0x15fa('0x25'),'uri':_0x15fa('0x40')+_0x8f03b1+_0x15fa('0x77'),'headers':{'Authorization':_0x15fa('0x35')+_0xb2ed59},'body':{'data':[_0x5ab999]},'json':!![]})[_0x15fa('0x2a')](function(_0x50a46b){if(_0x50a46b&&_0x50a46b[_0x15fa('0x46')][0x0][_0x15fa('0x47')]===_0x15fa('0x48')){logger[_0x15fa('0x2f')]('Call\x20created!');return{'id':_0x50a46b[_0x15fa('0x46')][0x0][_0x15fa('0x78')]['id']};}})[_0x15fa('0x2c')](function(_0x5b1a4e){logger[_0x15fa('0x2f')](_0x15fa('0x79'),_0x5b1a4e[_0x15fa('0x2e')]);console[_0x15fa('0x4b')](_0x15fa('0x79'),_0x5b1a4e);});}exports[_0x15fa('0x7a')]=function(_0x31f116,_0x5a6782,_0x169c69,_0x5150b6,_0x18f35a,_0x121fea){var _0x1a81a6,_0xd9f601,_0x3f78e7;_0x121fea[_0x15fa('0x7b')]=intUtil[_0x15fa('0x7c')](_0x121fea['host']);_0x121fea[_0x15fa('0x7d')]=intUtil[_0x15fa('0x7c')](_0x121fea[_0x15fa('0x7d')]);if(_0x18f35a&&_0x18f35a[_0x15fa('0x7e')]){logger[_0x15fa('0x2f')](_0x15fa('0x7f'),_0x15fa('0x80'));_0x5a6782[_0x15fa('0x81')]=_0x121fea['serverUrl']+_0x15fa('0x82')+_0x5a6782['uniqueid']+_0x15fa('0x83')+md5(_0x5a6782['uniqueid']);}else{_0x5a6782[_0x15fa('0x81')]='';}var _0x332aa0=_0x121fea[_0x15fa('0x7b')]===_0x15fa('0x84')?'eu':_0x15fa('0x85');return getAccessToken(_0x121fea)[_0x15fa('0x2a')](function(_0x3ef927){_0x3f78e7=_0x3ef927;return getUser(_0x3f78e7,_0x332aa0,_0x121fea,_0x5150b6['email']);})[_0x15fa('0x2a')](function(_0x48443e){_0x1a81a6=_0x48443e;logger[_0x15fa('0x2f')]('The\x20User\x20ID\x20is:',_0x1a81a6['id']);return getEndUser(_0x3f78e7,_0x332aa0,_0x121fea,_0x5a6782[_0x15fa('0x86')],_0x5a6782[_0x15fa('0x87')],_0x1a81a6,_0x169c69);})[_0x15fa('0x2a')](function(_0x81ab33){_0xd9f601=_0x81ab33;return getCall(_0x3f78e7,_0x332aa0,_0x121fea,_0x1a81a6,_0xd9f601,_0x169c69,_0x5a6782,'Inbound');})[_0x15fa('0x2a')](function(_0x55eecf){if(_0x55eecf){logger['info'](_0x15fa('0x88'),_0x55eecf['id']);logger['info'](_0x15fa('0x7f'),_0x15fa('0x89'));emit(util['format'](_0x15fa('0x8a'),_0x5150b6[_0x15fa('0x3b')]),_0x15fa('0x8b'),{'uri':'https://crm.'+_0x121fea[_0x15fa('0x7b')]+_0x15fa('0x8c')+_0x55eecf['id']});}})[_0x15fa('0x2c')](function(_0x241d72){logger[_0x15fa('0x2d')](_0x15fa('0x7f'),JSON[_0x15fa('0xf')](_0x241d72));});};exports[_0x15fa('0x73')]=function(_0x2f3b0f,_0x3ca46e,_0x1e3d3c,_0x5a75ad,_0x21006b,_0x5d5c0b,_0x3c6ead){var _0x18707c,_0x4e8900,_0x4f183e;_0x5d5c0b[_0x15fa('0x7b')]=intUtil[_0x15fa('0x7c')](_0x5d5c0b[_0x15fa('0x7b')]);_0x5d5c0b[_0x15fa('0x7d')]=intUtil[_0x15fa('0x7c')](_0x5d5c0b[_0x15fa('0x7d')]);if(_0x3c6ead&&_0x3c6ead[_0x15fa('0x8d')]&&_0x3c6ead['recordingFormat']!==_0x15fa('0x8e')){logger['info'](_0x15fa('0x8f'),'Recording\x20is\x20enabled!');_0x3ca46e[_0x15fa('0x81')]=_0x5d5c0b[_0x15fa('0x7d')]+'/api/voice/recordings/'+_0x3ca46e[_0x15fa('0x90')]+_0x15fa('0x83')+md5(_0x3ca46e['uniqueid']);}var _0x1c13f2=_0x5d5c0b[_0x15fa('0x7b')]===_0x15fa('0x84')?'eu':_0x15fa('0x85');return getAccessToken(_0x5d5c0b)[_0x15fa('0x2a')](function(_0x500d89){_0x4f183e=_0x500d89;return getUser(_0x4f183e,_0x1c13f2,_0x5d5c0b,_0x5a75ad[_0x15fa('0x37')]);})[_0x15fa('0x2a')](function(_0x5ce4ed){_0x18707c=_0x5ce4ed;logger[_0x15fa('0x2f')]('The\x20User\x20ID\x20is:',_0x18707c['id']);return getEndUser(_0x4f183e,_0x1c13f2,_0x5d5c0b,_0x3ca46e['destcalleridname'],_0x3ca46e[_0x15fa('0x91')],_0x18707c,_0x1e3d3c);})[_0x15fa('0x2a')](function(_0x152bbc){_0x4e8900=_0x152bbc;return getCall(_0x4f183e,_0x1c13f2,_0x5d5c0b,_0x18707c,_0x4e8900,_0x1e3d3c,_0x3ca46e,_0x15fa('0x92'));})['then'](function(_0x10e845){if(_0x10e845){logger['info'](_0x15fa('0x88'),_0x10e845['id']);logger[_0x15fa('0x2f')](_0x15fa('0x8f'),_0x15fa('0x89'));emit(util[_0x15fa('0x32')](_0x15fa('0x8a'),_0x5a75ad[_0x15fa('0x3b')]),_0x15fa('0x8b'),{'uri':_0x15fa('0x93')+_0x5d5c0b[_0x15fa('0x7b')]+_0x15fa('0x8c')+_0x10e845['id']});}})[_0x15fa('0x2c')](function(_0x342089){logger[_0x15fa('0x2d')]('[OUTBOUND]',JSON[_0x15fa('0xf')](_0x342089));});};exports[_0x15fa('0x94')]=function(_0x30c654,_0x223fea,_0x428529,_0x2fa460,_0x237e66,_0x5c81ec){var _0x542a58,_0x2278d0,_0x833c7;_0x5c81ec['host']=intUtil[_0x15fa('0x7c')](_0x5c81ec[_0x15fa('0x7b')]);_0x5c81ec[_0x15fa('0x7d')]=intUtil[_0x15fa('0x7c')](_0x5c81ec[_0x15fa('0x7d')]);if(_0x237e66&&_0x237e66[_0x15fa('0x7e')]){logger['info']('['+_0x223fea[_0x15fa('0x68')][_0x15fa('0x95')]()+']',_0x15fa('0x80'));_0x223fea[_0x15fa('0x81')]=_0x5c81ec[_0x15fa('0x7d')]+_0x15fa('0x82')+_0x223fea[_0x15fa('0x90')]+_0x15fa('0x83')+md5(_0x223fea[_0x15fa('0x90')]);}else{_0x223fea['recordingURL']='';}var _0x4ffd5e=_0x5c81ec[_0x15fa('0x7b')]===_0x15fa('0x84')?'eu':_0x15fa('0x85');return getAccessToken(_0x5c81ec)['then'](function(_0x455a6f){_0x833c7=_0x455a6f;return getUser(_0x833c7,_0x4ffd5e,_0x5c81ec);})['then'](function(_0x5177b5){_0x542a58=_0x5177b5;logger[_0x15fa('0x2f')](_0x15fa('0x96'),_0x542a58['id']);return getEndUser(_0x833c7,_0x4ffd5e,_0x5c81ec,_0x223fea[_0x15fa('0x86')],_0x223fea[_0x15fa('0x87')],_0x542a58,_0x428529);})[_0x15fa('0x2a')](function(_0x35e3c5){_0x2278d0=_0x35e3c5;return getCall(_0x833c7,_0x4ffd5e,_0x5c81ec,_0x542a58,_0x2278d0,_0x428529,_0x223fea,_0x15fa('0x75'));})[_0x15fa('0x2a')](function(_0x915ea){if(_0x915ea){logger[_0x15fa('0x2f')](_0x15fa('0x88'),_0x915ea['id']);}})['catch'](function(_0x5819aa){logger[_0x15fa('0x2d')]('['+_0x223fea[_0x15fa('0x68')][_0x15fa('0x95')]()+']',JSON['stringify'](_0x5819aa));});}; \ 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 e2d1394..c0b911e 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 _0xed12=['trigger','exec','data2','data3','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'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xed12,0x142));var _0x2ed1=function(_0x4ecc8e,_0x395a7b){_0x4ecc8e=_0x4ecc8e-0x0;var _0x4300ce=_0xed12[_0x4ecc8e];return _0x4300ce;};'use strict';var util=require('util');var sh=require(_0x2ed1('0x0'));var Mustache=require(_0x2ed1('0x1'));var logger=require(_0x2ed1('0x2'))(_0x2ed1('0x3'));exports[_0x2ed1('0x4')]=function(_0x1e120b,_0x27760f){var _0x327a9e=_0x1e120b[_0x2ed1('0x5')]?_0x1e120b['data2']:'Script';var _0x480dcc=_0x1e120b[_0x2ed1('0x6')]?Mustache[_0x2ed1('0x7')](_0x1e120b['data3'],_0x27760f):_0x27760f;sh[_0x2ed1('0x4')](_0x480dcc,function(_0x543cbe,_0x2618fa,_0x446c48){if(_0x543cbe!==0x0){logger[_0x2ed1('0x8')](util[_0x2ed1('0x9')](_0x2ed1('0xa'),_0x327a9e,_0x480dcc,_0x543cbe,_0x446c48));}else{logger[_0x2ed1('0xb')](util['format'](_0x2ed1('0xc'),_0x327a9e,_0x480dcc,_0x2618fa));}});}; \ No newline at end of file +var _0x5ed2=['util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','data3','render','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0x5ed2,0x114));var _0x25ed=function(_0x7c7a41,_0x11a170){_0x7c7a41=_0x7c7a41-0x0;var _0x5c09d3=_0x5ed2[_0x7c7a41];return _0x5c09d3;};'use strict';var util=require(_0x25ed('0x0'));var sh=require(_0x25ed('0x1'));var Mustache=require(_0x25ed('0x2'));var logger=require(_0x25ed('0x3'))(_0x25ed('0x4'));exports[_0x25ed('0x5')]=function(_0x1a4402,_0x2bf728){var _0x1e192f=_0x1a4402[_0x25ed('0x6')]?_0x1a4402[_0x25ed('0x6')]:'Script';var _0x16d772=_0x1a4402[_0x25ed('0x7')]?Mustache[_0x25ed('0x8')](_0x1a4402[_0x25ed('0x7')],_0x2bf728):_0x2bf728;sh[_0x25ed('0x5')](_0x16d772,function(_0x30c5ff,_0x5dffd4,_0x2ef7d6){if(_0x30c5ff!==0x0){logger['error'](util[_0x25ed('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x1e192f,_0x16d772,_0x30c5ff,_0x2ef7d6));}else{logger[_0x25ed('0xa')](util[_0x25ed('0x9')](_0x25ed('0xb'),_0x1e192f,_0x16d772,_0x5dffd4));}});}; \ 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 cf1ce74..1a6570c 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 _0x42d6=[',\x20request\x20body:\x20','stringify','info','format','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','data1','toUpperCase','render','data2','data5','number','data6','parse','GET','DELETE','POST','data7','body','error','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil'];(function(_0x1cef3c,_0x4173c4){var _0x5decf7=function(_0x14a523){while(--_0x14a523){_0x1cef3c['push'](_0x1cef3c['shift']());}};_0x5decf7(++_0x4173c4);}(_0x42d6,0x173));var _0x642d=function(_0x2b4328,_0xf02580){_0x2b4328=_0x2b4328-0x0;var _0x2d3835=_0x42d6[_0x2b4328];return _0x2d3835;};'use strict';var rp=require(_0x642d('0x0'));var util=require(_0x642d('0x1'));var _=require(_0x642d('0x2'));var Mustache=require(_0x642d('0x3'));var logger=require(_0x642d('0x4'))(_0x642d('0x5'));exports['exec']=function(_0x4000ba,_0x52dc3e){var _0x57bb21,_0x195667;var _0x19584c={'method':_0x4000ba[_0x642d('0x6')][_0x642d('0x7')](),'uri':Mustache[_0x642d('0x8')](_0x4000ba[_0x642d('0x9')],_0x52dc3e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4000ba[_0x642d('0xa')])===_0x642d('0xb')&&parseInt(_0x4000ba[_0x642d('0xa')])>=0x1&&parseInt(_0x4000ba[_0x642d('0xa')])<=0xa?parseInt(_0x4000ba[_0x642d('0xa')])*0x3e8:0x5*0x3e8};try{_0x19584c['headers']=_0x4000ba[_0x642d('0xc')]?JSON[_0x642d('0xd')](Mustache[_0x642d('0x8')](_0x4000ba[_0x642d('0xc')],_0x52dc3e)):{};}catch(_0x29e78e){logger['error'](_0x29e78e['stack']);}switch(_0x4000ba[_0x642d('0x6')][_0x642d('0x7')]()){case _0x642d('0xe'):case _0x642d('0xf'):_0x57bb21=null;_0x19584c['qs']=_0x52dc3e;break;case _0x642d('0x10'):case'PUT':if(_0x4000ba[_0x642d('0x11')]){try{_0x57bb21=JSON['parse'](Mustache[_0x642d('0x8')](_0x4000ba[_0x642d('0x11')],_0x52dc3e));_0x19584c[_0x642d('0x12')]=_0x57bb21;}catch(_0x2412f7){logger[_0x642d('0x13')](_0x2412f7[_0x642d('0x14')]);logger[_0x642d('0x13')](_0x642d('0x15'));}}else{_0x57bb21=_0x52dc3e;_0x19584c['body']=_0x57bb21;}break;}logger['info'](util['format'](_0x642d('0x16'),_0x4000ba[_0x642d('0x6')],_0x4000ba[_0x642d('0x9')],JSON['stringify'](_0x19584c)));rp(_0x19584c)[_0x642d('0x17')](function(_0xf0dc6e){_0x57bb21=!_[_0x642d('0x18')](_0x57bb21)?_0x642d('0x19')+_0x57bb21:'';_0x195667=typeof _0xf0dc6e[_0x642d('0x12')]==='object'?JSON[_0x642d('0x1a')](_0xf0dc6e[_0x642d('0x12')]):_0xf0dc6e[_0x642d('0x12')];logger[_0x642d('0x1b')](util[_0x642d('0x1c')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x4000ba[_0x642d('0x6')],_0x4000ba['data2'],_0xf0dc6e[_0x642d('0x1d')],_0x195667));})[_0x642d('0x1e')](function(_0x51427b){logger[_0x642d('0x13')](util[_0x642d('0x1c')](_0x642d('0x1f'),_0x4000ba['data1'],_0x4000ba[_0x642d('0x9')],_0x51427b[_0x642d('0x1d')],_0x51427b['name'],_0x51427b[_0x642d('0x20')]));});}; \ No newline at end of file +var _0x85bd=['%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','request-promise','lodash','mustache','trigger','toUpperCase','render','data2','data5','number','parse','error','stack','data1','DELETE','POST','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object','stringify','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','format'];(function(_0x24e413,_0x1b3581){var _0x5df48a=function(_0x42100a){while(--_0x42100a){_0x24e413['push'](_0x24e413['shift']());}};_0x5df48a(++_0x1b3581);}(_0x85bd,0x9d));var _0xd85b=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x85bd[_0x35885a];return _0xe86249;};'use strict';var rp=require(_0xd85b('0x0'));var util=require('util');var _=require(_0xd85b('0x1'));var Mustache=require(_0xd85b('0x2'));var logger=require('../../../../config/logger')(_0xd85b('0x3'));exports['exec']=function(_0x30720b,_0x27d01e){var _0x2dfd95,_0x324079;var _0x46907f={'method':_0x30720b['data1'][_0xd85b('0x4')](),'uri':Mustache[_0xd85b('0x5')](_0x30720b[_0xd85b('0x6')],_0x27d01e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x30720b[_0xd85b('0x7')])===_0xd85b('0x8')&&parseInt(_0x30720b['data5'])>=0x1&&parseInt(_0x30720b[_0xd85b('0x7')])<=0xa?parseInt(_0x30720b['data5'])*0x3e8:0x5*0x3e8};try{_0x46907f['headers']=_0x30720b['data6']?JSON[_0xd85b('0x9')](Mustache[_0xd85b('0x5')](_0x30720b['data6'],_0x27d01e)):{};}catch(_0x96d10){logger[_0xd85b('0xa')](_0x96d10[_0xd85b('0xb')]);}switch(_0x30720b[_0xd85b('0xc')][_0xd85b('0x4')]()){case'GET':case _0xd85b('0xd'):_0x2dfd95=null;_0x46907f['qs']=_0x27d01e;break;case _0xd85b('0xe'):case'PUT':if(_0x30720b['data7']){try{_0x2dfd95=JSON[_0xd85b('0x9')](Mustache[_0xd85b('0x5')](_0x30720b[_0xd85b('0xf')],_0x27d01e));_0x46907f[_0xd85b('0x10')]=_0x2dfd95;}catch(_0x566562){logger['error'](_0x566562[_0xd85b('0xb')]);logger[_0xd85b('0xa')](_0xd85b('0x11'));}}else{_0x2dfd95=_0x27d01e;_0x46907f[_0xd85b('0x10')]=_0x2dfd95;}break;}logger['info'](util['format'](_0xd85b('0x12'),_0x30720b['data1'],_0x30720b['data2'],JSON['stringify'](_0x46907f)));rp(_0x46907f)[_0xd85b('0x13')](function(_0xd21bf2){_0x2dfd95=!_[_0xd85b('0x14')](_0x2dfd95)?_0xd85b('0x15')+_0x2dfd95:'';_0x324079=typeof _0xd21bf2[_0xd85b('0x10')]===_0xd85b('0x16')?JSON[_0xd85b('0x17')](_0xd21bf2['body']):_0xd21bf2[_0xd85b('0x10')];logger[_0xd85b('0x18')](util['format'](_0xd85b('0x19'),_0x30720b[_0xd85b('0xc')],_0x30720b[_0xd85b('0x6')],_0xd21bf2[_0xd85b('0x1a')],_0x324079));})[_0xd85b('0x1b')](function(_0x3cea0b){logger['error'](util[_0xd85b('0x1c')](_0xd85b('0x1d'),_0x30720b[_0xd85b('0xc')],_0x30720b['data2'],_0x3cea0b[_0xd85b('0x1a')],_0x3cea0b[_0xd85b('0x1e')],_0x3cea0b['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 31a561e..373ac48 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 _0xe9bc=['catch','rpc','exports','jayson/promise','bluebird','../../config/logger','routing','Request','request','then','debug','error','message','result'];(function(_0x543f87,_0x568d27){var _0x3e85ad=function(_0x1d60d1){while(--_0x1d60d1){_0x543f87['push'](_0x543f87['shift']());}};_0x3e85ad(++_0x568d27);}(_0xe9bc,0x16f));var _0xce9b=function(_0x54c655,_0x3682b7){_0x54c655=_0x54c655-0x0;var _0x2ac4d5=_0xe9bc[_0x54c655];return _0x2ac4d5;};'use strict';var jayson=require(_0xce9b('0x0'));var BPromise=require(_0xce9b('0x1'));var logger=require(_0xce9b('0x2'))(_0xce9b('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0xce9b('0x4')]=function(_0x1ae68b,_0x35734c){return new BPromise(function(_0x332915,_0x16b625){return client[_0xce9b('0x5')](_0x1ae68b,_0x35734c)[_0xce9b('0x6')](function(_0x5162c6){logger[_0xce9b('0x7')]('rpc',_0xce9b('0x3'),_0x1ae68b,_0x35734c,_0x5162c6);if(_0x5162c6[_0xce9b('0x8')]){logger[_0xce9b('0x8')]('rpc',_0xce9b('0x3'),_0x1ae68b,_0x5162c6['error'][_0xce9b('0x9')],_0x35734c);return _0x16b625(_0x5162c6[_0xce9b('0x8')][_0xce9b('0x9')]);}else{return _0x332915(_0x5162c6[_0xce9b('0xa')]);}})[_0xce9b('0xb')](function(_0x41c6c9){logger[_0xce9b('0x8')](_0xce9b('0xc'),_0xce9b('0x3'),_0x1ae68b,_0x41c6c9,_0x35734c);return _0x16b625(_0x41c6c9);});});};module[_0xce9b('0xd')]=client; \ No newline at end of file +var _0x039d=['then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request'];(function(_0x315517,_0x35a708){var _0x5328e2=function(_0x4f6a22){while(--_0x4f6a22){_0x315517['push'](_0x315517['shift']());}};_0x5328e2(++_0x35a708);}(_0x039d,0x1ac));var _0xd039=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x039d[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0xd039('0x0'));var BPromise=require(_0xd039('0x1'));var logger=require(_0xd039('0x2'))(_0xd039('0x3'));var client=jayson[_0xd039('0x4')][_0xd039('0x5')]({'port':0x2329});client[_0xd039('0x6')]=function(_0x2ceebf,_0x3109e1){return new BPromise(function(_0x8e8f11,_0x27411d){return client['request'](_0x2ceebf,_0x3109e1)[_0xd039('0x7')](function(_0x124b00){logger[_0xd039('0x8')](_0xd039('0x9'),_0xd039('0x3'),_0x2ceebf,_0x3109e1,_0x124b00);if(_0x124b00['error']){logger[_0xd039('0xa')]('rpc','routing',_0x2ceebf,_0x124b00[_0xd039('0xa')][_0xd039('0xb')],_0x3109e1);return _0x27411d(_0x124b00[_0xd039('0xa')][_0xd039('0xb')]);}else{return _0x8e8f11(_0x124b00[_0xd039('0xc')]);}})[_0xd039('0xd')](function(_0x1cb42b){logger['error']('rpc','routing',_0x2ceebf,_0x1cb42b,_0x3109e1);return _0x27411d(_0x1cb42b);});});};module[_0xd039('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 9cff47b..7f11f4e 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 _0x0846=['./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts','mailAccounts','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization'];(function(_0x30fa9d,_0x88c6ee){var _0x5ef4e8=function(_0x4bf428){while(--_0x4bf428){_0x30fa9d['push'](_0x30fa9d['shift']());}};_0x5ef4e8(++_0x88c6ee);}(_0x0846,0xff));var _0x6084=function(_0x559e55,_0xc7956e){_0x559e55=_0x559e55-0x0;var _0x3d39e9=_0x0846[_0x559e55];return _0x3d39e9;};'use strict';var server=require(_0x6084('0x0'));var Realtime=require(_0x6084('0x1'));var EmailChannel=require(_0x6084('0x2'));var mailAccount=require(_0x6084('0x3'));var setting=require(_0x6084('0x4'));var logger=require(_0x6084('0x5'))(_0x6084('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x6084('0x7')](mailAccount[_0x6084('0x8')]())[_0x6084('0x7')](realtime[_0x6084('0x9')]())[_0x6084('0x7')](function(){email['refresh'](realtime[_0x6084('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0x6084('0x7')](function(){return setting[_0x6084('0xb')]();})[_0x6084('0x7')](function(_0x5a6220){return setInterval(initRealtime,_0x5a6220[_0x6084('0xc')]*0x3e8);})[_0x6084('0xd')](function(_0x2e7167){logger['error'](_0x6084('0xe'),_0x2e7167);});}main(); \ No newline at end of file +var _0xcfbf=['listen','loginMailFrequency','error','./lib/email','./rpc/mailAccount','./rpc/setting','email','resolve','getMailAccounts','then','refresh','mailAccounts'];(function(_0x265ccb,_0x7602e0){var _0x1f114b=function(_0x350642){while(--_0x350642){_0x265ccb['push'](_0x265ccb['shift']());}};_0x1f114b(++_0x7602e0);}(_0xcfbf,0x1cb));var _0xfcfb=function(_0x16847d,_0x1f6a68){_0x16847d=_0x16847d-0x0;var _0x5d85e2=_0xcfbf[_0x16847d];return _0x5d85e2;};'use strict';var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0xfcfb('0x0'));var mailAccount=require(_0xfcfb('0x1'));var setting=require(_0xfcfb('0x2'));var logger=require('../../config/logger')(_0xfcfb('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xfcfb('0x4')]()['then'](mailAccount[_0xfcfb('0x5')]())[_0xfcfb('0x6')](realtime['initMailAccounts']())['then'](function(){email[_0xfcfb('0x7')](realtime[_0xfcfb('0x8')]);return realtime;});}function main(){return server[_0xfcfb('0x9')](realtime,email)[_0xfcfb('0x6')](function(){return initRealtime();})[_0xfcfb('0x6')](function(){return setting['getSettings']();})[_0xfcfb('0x6')](function(_0x2c6953){return setInterval(initRealtime,_0x2c6953[_0xfcfb('0xa')]*0x3e8);})['catch'](function(_0x17d7ac){logger[_0xfcfb('0xb')]('Email\x20service\x20initialization',_0x17d7ac);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index dbf9912..260527d 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 _0x3473=['../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','name','key','active','Imap','messageStatus','total','isNil','stringify','emit','hasOwnProperty','service','provider','custom','imapAccounts','box','bind','handleImapEmail','end','handleImapEnd','status','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verify','then','verified','exports','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','defaults','localhost','socket.io-emitter','redis','./imap','./smtp'];(function(_0x48a5f5,_0x4328b9){var _0x18586a=function(_0x282c43){while(--_0x282c43){_0x48a5f5['push'](_0x48a5f5['shift']());}};_0x18586a(++_0x4328b9);}(_0x3473,0x19e));var _0x3347=function(_0xd5584e,_0x251c06){_0xd5584e=_0xd5584e-0x0;var _0xdc594e=_0x3473[_0xd5584e];return _0xdc594e;};'use strict';var _=require(_0x3347('0x0'));var moment=require(_0x3347('0x1'));var BPromise=require(_0x3347('0x2'));var md5=require(_0x3347('0x3'));var Redis=require('ioredis');var config=require(_0x3347('0x4'));var logger=require(_0x3347('0x5'))(_0x3347('0x6'));config['redis']=_[_0x3347('0x7')](config['redis'],{'host':_0x3347('0x8'),'port':0x18eb});var io=require(_0x3347('0x9'))(new Redis(config[_0x3347('0xa')]));var EmailImap=require(_0x3347('0xb'));var EmailSmtp=require(_0x3347('0xc'));var mailAccount=require(_0x3347('0xd'));var md5Accounts={};function EmailChannel(_0x1cc776){logger[_0x3347('0xe')](_0x3347('0xf'));this[_0x3347('0x10')]=_0x1cc776[_0x3347('0x10')];this['imapAccounts']={};this[_0x3347('0x11')]=new EmailSmtp();}EmailChannel[_0x3347('0x12')]['emit']=function(_0x29257b){var _0x3decea=this[_0x3347('0x10')][_0x29257b];var _0x2ca0b9={'id':_0x3decea['id'],'name':_0x3decea[_0x3347('0x13')],'key':_0x3decea[_0x3347('0x14')],'active':_0x3decea[_0x3347('0x15')],'Imap':{'status':_0x3decea[_0x3347('0x16')]['status'],'messageStatus':_0x3decea[_0x3347('0x16')][_0x3347('0x17')],'total':_0x3decea[_0x3347('0x16')][_0x3347('0x18')]}};if(_[_0x3347('0x19')](md5Accounts[_0x29257b])){md5Accounts[_0x29257b]={};}var _0x530f7c=md5(JSON[_0x3347('0x1a')](_0x2ca0b9));if(md5Accounts[_0x29257b]['md5']!==_0x530f7c){md5Accounts[_0x29257b][_0x3347('0x3')]=_0x530f7c;io[_0x3347('0x1b')]('mailAccount:update',_0x2ca0b9);}};EmailChannel['prototype']['refresh']=function(_0xaab373){for(var _0x8ddbe9 in _0xaab373){if(_0xaab373[_0x3347('0x1c')](_0x8ddbe9)){if(_0xaab373[_0x8ddbe9][_0x3347('0x16')]&&_0xaab373[_0x8ddbe9][_0x3347('0x15')]){var _0x3a52f5=_0xaab373[_0x8ddbe9][_0x3347('0x16')];if(!_0x3a52f5[_0x3347('0x1d')]&&_0xaab373[_0x8ddbe9][_0x3347('0x1e')]!==_0x3347('0x1f'))_0x3a52f5[_0x3347('0x1d')]=_0xaab373[_0x8ddbe9]['provider'];if(!this[_0x3347('0x20')][_0x3347('0x1c')](_0x3a52f5['id'])){this['imapAccounts'][_0x3a52f5['id']]=new EmailImap(_0x3a52f5,_0xaab373[_0x8ddbe9][_0x3347('0x6')]);this[_0x3347('0x20')][_0x3a52f5['id']]['on'](_0x3347('0x21'),this['handleImapBox'][_0x3347('0x22')](this,_0x8ddbe9));this['imapAccounts'][_0x3a52f5['id']]['on'](_0x3347('0x6'),this[_0x3347('0x23')][_0x3347('0x22')](this,_0x8ddbe9));this['imapAccounts'][_0x3a52f5['id']]['on'](_0x3347('0x24'),this[_0x3347('0x25')][_0x3347('0x22')](this,_0x8ddbe9));this[_0x3347('0x20')][_0x3a52f5['id']]['on']('error',this['handleImapError'][_0x3347('0x22')](this,_0x8ddbe9));}}else{if(_['isNil'](this['mailAccounts'][_0x8ddbe9][_0x3347('0x16')])){this[_0x3347('0x10')][_0x8ddbe9][_0x3347('0x16')]={};}this[_0x3347('0x10')][_0x8ddbe9]['Imap'][_0x3347('0x26')]=_0x3347('0x27');this[_0x3347('0x10')][_0x8ddbe9][_0x3347('0x16')]['messageStatus']='';this[_0x3347('0x1b')](_0x8ddbe9);}}}};EmailChannel[_0x3347('0x12')][_0x3347('0x28')]=function(_0x4a1414,_0x12b24e){if(this[_0x3347('0x10')][_0x4a1414]){this[_0x3347('0x10')][_0x4a1414][_0x3347('0x16')][_0x3347('0x26')]=_0x3347('0x29');this[_0x3347('0x10')][_0x4a1414][_0x3347('0x16')][_0x3347('0x17')]=_0x12b24e['name'];if(_0x12b24e[_0x3347('0x2a')]){this[_0x3347('0x10')][_0x4a1414][_0x3347('0x16')][_0x3347('0x18')]=_0x12b24e['messages'][_0x3347('0x18')];}return this['emit'](_0x4a1414);}};EmailChannel[_0x3347('0x12')][_0x3347('0x23')]=function(_0x523bd2,_0x406ad7){logger[_0x3347('0xe')](_0x3347('0x2b'),_0x406ad7['firstName'],_0x406ad7[_0x3347('0x2c')],_0x406ad7[_0x3347('0x2d')],_0x523bd2);if(this[_0x3347('0x10')][_0x523bd2]){return mailAccount[_0x3347('0x2e')](_0x523bd2,_0x406ad7)['then'](function(_0x4f0e36){if(_0x4f0e36){logger['info'](_0x3347('0x2f'));}})[_0x3347('0x30')](function(_0x137fc9){logger[_0x3347('0x31')](_0x3347('0x32'),JSON[_0x3347('0x1a')](_0x137fc9));});}};EmailChannel[_0x3347('0x12')][_0x3347('0x25')]=function(_0x229c8e){if(this[_0x3347('0x10')][_0x229c8e]&&this[_0x3347('0x10')][_0x229c8e][_0x3347('0x16')]){if(this[_0x3347('0x20')][this[_0x3347('0x10')][_0x229c8e][_0x3347('0x16')]['id']]){delete this[_0x3347('0x20')][this['mailAccounts'][_0x229c8e][_0x3347('0x16')]['id']];}this['mailAccounts'][_0x229c8e]['Imap'][_0x3347('0x33')]=moment();this[_0x3347('0x1b')](_0x229c8e);}};EmailChannel['prototype'][_0x3347('0x34')]=function(_0x2ada0d,_0x42f5ee){if(this['mailAccounts'][_0x2ada0d]){this['mailAccounts'][_0x2ada0d][_0x3347('0x16')][_0x3347('0x26')]='error';this['mailAccounts'][_0x2ada0d]['Imap'][_0x3347('0x17')]=_0x42f5ee;return this['emit'](_0x2ada0d);}};EmailChannel[_0x3347('0x12')][_0x3347('0x35')]=function(_0x4fae28,_0x40b933){return this['smtp'][_0x3347('0x36')](_0x4fae28,_0x40b933);};EmailChannel['prototype'][_0x3347('0x37')]=function(_0x54f478){var _0x25585e=this;if(this[_0x3347('0x10')][_0x54f478['id']]){if(_[_0x3347('0x19')](this[_0x3347('0x10')][_0x54f478['id']]['Smtp'])){this[_0x3347('0x10')][_0x54f478['id']][_0x3347('0x38')]={};}this['mailAccounts'][_0x54f478['id']][_0x3347('0x38')][_0x3347('0x33')]=moment();return new BPromise(function(_0x1c1421,_0x5231ce){return _0x25585e['smtp'][_0x3347('0x39')](_0x54f478)[_0x3347('0x3a')](function(_0x21e6f0){_0x25585e[_0x3347('0x10')][_0x54f478['id']]['Smtp'][_0x3347('0x26')]=_0x3347('0x3b');_0x25585e[_0x3347('0x10')][_0x54f478['id']][_0x3347('0x38')]['messageStatus']='';_0x25585e[_0x3347('0x1b')](_0x54f478['id']);_0x1c1421(_0x21e6f0);})['catch'](function(_0x466949){_0x25585e['mailAccounts'][_0x54f478['id']][_0x3347('0x38')][_0x3347('0x26')]='error';_0x25585e[_0x3347('0x10')][_0x54f478['id']][_0x3347('0x38')][_0x3347('0x17')]=_0x466949;_0x25585e['emit'](_0x54f478['id']);_0x5231ce(_0x466949);});});}return this[_0x3347('0x11')][_0x3347('0x39')](_0x54f478);};module[_0x3347('0x3c')]=EmailChannel; \ No newline at end of file +var _0xbdd3=['smtp','prototype','emit','key','Imap','status','total','isNil','stringify','md5','refresh','hasOwnProperty','active','service','provider','custom','box','bind','end','handleImapEnd','error','disabled','messageStatus','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','info','Mail\x20accepted\x20from\x20routing','catch','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts'];(function(_0x204a88,_0x4be163){var _0x3c6d92=function(_0x2486a2){while(--_0x2486a2){_0x204a88['push'](_0x204a88['shift']());}};_0x3c6d92(++_0x4be163);}(_0xbdd3,0x65));var _0x3bdd=function(_0x3f2802,_0x552a22){_0x3f2802=_0x3f2802-0x0;var _0x2a989f=_0xbdd3[_0x3f2802];return _0x2a989f;};'use strict';var _=require(_0x3bdd('0x0'));var moment=require(_0x3bdd('0x1'));var BPromise=require(_0x3bdd('0x2'));var md5=require('md5');var Redis=require(_0x3bdd('0x3'));var config=require(_0x3bdd('0x4'));var logger=require(_0x3bdd('0x5'))(_0x3bdd('0x6'));config[_0x3bdd('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3bdd('0x8'))(new Redis(config[_0x3bdd('0x7')]));var EmailImap=require(_0x3bdd('0x9'));var EmailSmtp=require(_0x3bdd('0xa'));var mailAccount=require(_0x3bdd('0xb'));var md5Accounts={};function EmailChannel(_0x1f2191){logger['info'](_0x3bdd('0xc'));this[_0x3bdd('0xd')]=_0x1f2191[_0x3bdd('0xd')];this[_0x3bdd('0xe')]={};this[_0x3bdd('0xf')]=new EmailSmtp();}EmailChannel[_0x3bdd('0x10')][_0x3bdd('0x11')]=function(_0x30946b){var _0x48f81e=this['mailAccounts'][_0x30946b];var _0xc562ff={'id':_0x48f81e['id'],'name':_0x48f81e['name'],'key':_0x48f81e[_0x3bdd('0x12')],'active':_0x48f81e['active'],'Imap':{'status':_0x48f81e[_0x3bdd('0x13')][_0x3bdd('0x14')],'messageStatus':_0x48f81e[_0x3bdd('0x13')]['messageStatus'],'total':_0x48f81e[_0x3bdd('0x13')][_0x3bdd('0x15')]}};if(_[_0x3bdd('0x16')](md5Accounts[_0x30946b])){md5Accounts[_0x30946b]={};}var _0x34cf4d=md5(JSON[_0x3bdd('0x17')](_0xc562ff));if(md5Accounts[_0x30946b][_0x3bdd('0x18')]!==_0x34cf4d){md5Accounts[_0x30946b]['md5']=_0x34cf4d;io[_0x3bdd('0x11')]('mailAccount:update',_0xc562ff);}};EmailChannel[_0x3bdd('0x10')][_0x3bdd('0x19')]=function(_0x169b23){for(var _0x5508de in _0x169b23){if(_0x169b23[_0x3bdd('0x1a')](_0x5508de)){if(_0x169b23[_0x5508de][_0x3bdd('0x13')]&&_0x169b23[_0x5508de][_0x3bdd('0x1b')]){var _0x10af67=_0x169b23[_0x5508de][_0x3bdd('0x13')];if(!_0x10af67[_0x3bdd('0x1c')]&&_0x169b23[_0x5508de][_0x3bdd('0x1d')]!==_0x3bdd('0x1e'))_0x10af67['service']=_0x169b23[_0x5508de][_0x3bdd('0x1d')];if(!this[_0x3bdd('0xe')]['hasOwnProperty'](_0x10af67['id'])){this[_0x3bdd('0xe')][_0x10af67['id']]=new EmailImap(_0x10af67,_0x169b23[_0x5508de][_0x3bdd('0x6')]);this['imapAccounts'][_0x10af67['id']]['on'](_0x3bdd('0x1f'),this['handleImapBox'][_0x3bdd('0x20')](this,_0x5508de));this[_0x3bdd('0xe')][_0x10af67['id']]['on'](_0x3bdd('0x6'),this['handleImapEmail'][_0x3bdd('0x20')](this,_0x5508de));this['imapAccounts'][_0x10af67['id']]['on'](_0x3bdd('0x21'),this[_0x3bdd('0x22')]['bind'](this,_0x5508de));this[_0x3bdd('0xe')][_0x10af67['id']]['on'](_0x3bdd('0x23'),this['handleImapError'][_0x3bdd('0x20')](this,_0x5508de));}}else{if(_['isNil'](this['mailAccounts'][_0x5508de][_0x3bdd('0x13')])){this['mailAccounts'][_0x5508de][_0x3bdd('0x13')]={};}this[_0x3bdd('0xd')][_0x5508de]['Imap'][_0x3bdd('0x14')]=_0x3bdd('0x24');this[_0x3bdd('0xd')][_0x5508de][_0x3bdd('0x13')][_0x3bdd('0x25')]='';this[_0x3bdd('0x11')](_0x5508de);}}}};EmailChannel[_0x3bdd('0x10')]['handleImapBox']=function(_0x4f892d,_0x4cedc8){if(this[_0x3bdd('0xd')][_0x4f892d]){this[_0x3bdd('0xd')][_0x4f892d][_0x3bdd('0x13')]['status']=_0x3bdd('0x26');this[_0x3bdd('0xd')][_0x4f892d][_0x3bdd('0x13')]['messageStatus']=_0x4cedc8[_0x3bdd('0x27')];if(_0x4cedc8[_0x3bdd('0x28')]){this['mailAccounts'][_0x4f892d]['Imap'][_0x3bdd('0x15')]=_0x4cedc8[_0x3bdd('0x28')][_0x3bdd('0x15')];}return this[_0x3bdd('0x11')](_0x4f892d);}};EmailChannel['prototype']['handleImapEmail']=function(_0x1dceb0,_0x5b13e8){logger['info'](_0x3bdd('0x29'),_0x5b13e8['firstName'],_0x5b13e8[_0x3bdd('0x2a')],_0x5b13e8[_0x3bdd('0x2b')],_0x1dceb0);if(this[_0x3bdd('0xd')][_0x1dceb0]){return mailAccount[_0x3bdd('0x2c')](_0x1dceb0,_0x5b13e8)[_0x3bdd('0x2d')](function(_0x434b77){if(_0x434b77){logger[_0x3bdd('0x2e')](_0x3bdd('0x2f'));}})[_0x3bdd('0x30')](function(_0x51dcc1){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x51dcc1));});}};EmailChannel[_0x3bdd('0x10')][_0x3bdd('0x22')]=function(_0xc855e0){if(this['mailAccounts'][_0xc855e0]&&this['mailAccounts'][_0xc855e0][_0x3bdd('0x13')]){if(this[_0x3bdd('0xe')][this['mailAccounts'][_0xc855e0]['Imap']['id']]){delete this[_0x3bdd('0xe')][this[_0x3bdd('0xd')][_0xc855e0][_0x3bdd('0x13')]['id']];}this[_0x3bdd('0xd')][_0xc855e0][_0x3bdd('0x13')][_0x3bdd('0x31')]=moment();this[_0x3bdd('0x11')](_0xc855e0);}};EmailChannel[_0x3bdd('0x10')][_0x3bdd('0x32')]=function(_0x14ceb5,_0x1af227){if(this[_0x3bdd('0xd')][_0x14ceb5]){this['mailAccounts'][_0x14ceb5][_0x3bdd('0x13')][_0x3bdd('0x14')]='error';this[_0x3bdd('0xd')][_0x14ceb5][_0x3bdd('0x13')][_0x3bdd('0x25')]=_0x1af227;return this[_0x3bdd('0x11')](_0x14ceb5);}};EmailChannel[_0x3bdd('0x10')][_0x3bdd('0x33')]=function(_0x5e06e7,_0x25bc0d){return this['smtp'][_0x3bdd('0x34')](_0x5e06e7,_0x25bc0d);};EmailChannel[_0x3bdd('0x10')][_0x3bdd('0x35')]=function(_0x40e671){var _0x4af8b3=this;if(this[_0x3bdd('0xd')][_0x40e671['id']]){if(_['isNil'](this[_0x3bdd('0xd')][_0x40e671['id']][_0x3bdd('0x36')])){this[_0x3bdd('0xd')][_0x40e671['id']][_0x3bdd('0x36')]={};}this['mailAccounts'][_0x40e671['id']]['Smtp'][_0x3bdd('0x31')]=moment();return new BPromise(function(_0xb3a640,_0x537c77){return _0x4af8b3[_0x3bdd('0xf')][_0x3bdd('0x37')](_0x40e671)[_0x3bdd('0x2d')](function(_0x303361){_0x4af8b3['mailAccounts'][_0x40e671['id']][_0x3bdd('0x36')][_0x3bdd('0x14')]=_0x3bdd('0x38');_0x4af8b3[_0x3bdd('0xd')][_0x40e671['id']][_0x3bdd('0x36')][_0x3bdd('0x25')]='';_0x4af8b3['emit'](_0x40e671['id']);_0xb3a640(_0x303361);})[_0x3bdd('0x30')](function(_0x4d352f){_0x4af8b3[_0x3bdd('0xd')][_0x40e671['id']]['Smtp'][_0x3bdd('0x14')]=_0x3bdd('0x23');_0x4af8b3[_0x3bdd('0xd')][_0x40e671['id']][_0x3bdd('0x36')]['messageStatus']=_0x4d352f;_0x4af8b3[_0x3bdd('0x11')](_0x40e671['id']);_0x537c77(_0x4d352f);});});}return this[_0x3bdd('0xf')][_0x3bdd('0x37')](_0x40e671);};module[_0x3bdd('0x39')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index f8b701b..2b3131a 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 _0xba39=['handleSimpleParser','handleMessageEnd','parser','stringify','textCode','hasOwnProperty','exports','lodash','util','imap','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','handleError','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','host','tls','autotls','required','emit','box','readUnseen','handleCloseBox','search','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','error','closeBox','body','attributes','handleMessageAttributes','handleMessageBody'];(function(_0x270bda,_0x1993ed){var _0x594eb0=function(_0x35f7ea){while(--_0x35f7ea){_0x270bda['push'](_0x270bda['shift']());}};_0x594eb0(++_0x1993ed);}(_0xba39,0xfb));var _0x9ba3=function(_0x27355e,_0x33f2fa){_0x27355e=_0x27355e-0x0;var _0x3d40d8=_0xba39[_0x27355e];return _0x3d40d8;};'use strict';var _=require(_0x9ba3('0x0'));var util=require(_0x9ba3('0x1'));var Imap=require(_0x9ba3('0x2'));var simpleParser=require(_0x9ba3('0x3'))[_0x9ba3('0x4')];var Iconv=require('iconv')[_0x9ba3('0x5')];var EventEmitter=require(_0x9ba3('0x6'))[_0x9ba3('0x7')];var utils=require(_0x9ba3('0x8'));var logger=require(_0x9ba3('0x9'))('email');function EmailImap(_0x4551f6,_0x19e166){this['mailbox']=_0x4551f6[_0x9ba3('0xa')];this[_0x9ba3('0xb')]=this[_0x9ba3('0xc')](_0x4551f6,_0x19e166);this['imap']=new Imap(this[_0x9ba3('0xb')]);this[_0x9ba3('0x2')]['once'](_0x9ba3('0xd'),this[_0x9ba3('0xe')][_0x9ba3('0xf')](this));this['imap'][_0x9ba3('0x10')](_0x9ba3('0x11'),this[_0x9ba3('0x12')][_0x9ba3('0xf')](this));this['imap']['on']('error',this[_0x9ba3('0x13')][_0x9ba3('0xf')](this));this[_0x9ba3('0x2')]['connect']();}util[_0x9ba3('0x14')](EmailImap,EventEmitter);EmailImap[_0x9ba3('0x15')][_0x9ba3('0xc')]=function(_0x5ac382,_0x40c0bf){var _0x24740c={'connTimeout':_0x5ac382[_0x9ba3('0x16')]?_0x5ac382[_0x9ba3('0x16')]*0x3e8:0x2710,'authTimeout':_0x5ac382['authTimeout']?_0x5ac382[_0x9ba3('0x17')]*0x3e8:0x1388};if(_0x5ac382[_0x9ba3('0x18')]){_0x24740c[_0x9ba3('0x19')]=_0x5ac382[_0x9ba3('0x19')];if(_0x5ac382[_0x9ba3('0x1a')]){_0x24740c[_0x9ba3('0x1b')]=utils['generateXOAuth2Token'](_0x5ac382[_0x9ba3('0x1c')][_0x9ba3('0x1d')],_0x5ac382[_0x9ba3('0x19')]);}else{_0x24740c[_0x9ba3('0x1e')]=_0x5ac382[_0x9ba3('0x1e')];}}else{if(_0x5ac382[_0x9ba3('0x1f')]){_0x24740c[_0x9ba3('0x19')]=_0x5ac382[_0x9ba3('0x19')];_0x24740c[_0x9ba3('0x1e')]=_0x5ac382[_0x9ba3('0x1e')];}}_0x24740c[_0x9ba3('0x20')]=_0x40c0bf||_0x5ac382['user']||_0x9ba3('0x21');_0x24740c[_0x9ba3('0x22')]=_0x5ac382['host'];_0x24740c['port']=_0x5ac382['port']||0x3e1;if(_0x5ac382[_0x9ba3('0x23')]){_0x24740c[_0x9ba3('0x23')]=!![];}else{_0x24740c[_0x9ba3('0x23')]=![];_0x24740c[_0x9ba3('0x24')]=_0x9ba3('0x25');}return _0x24740c;};EmailImap[_0x9ba3('0x15')][_0x9ba3('0xe')]=function(){this[_0x9ba3('0x2')]['openBox'](this['mailbox'],![],this['handleOpenBox']['bind'](this));};EmailImap[_0x9ba3('0x15')]['handleOpenBox']=function(_0x36ea30,_0x167d1e){if(_0x36ea30){this[_0x9ba3('0x13')](_0x36ea30,!![]);}else{this[_0x9ba3('0x26')](_0x9ba3('0x27'),_0x167d1e);this[_0x9ba3('0x28')]();}};EmailImap['prototype'][_0x9ba3('0x29')]=function(_0x4d017b){if(_0x4d017b){this['handleError'](_0x4d017b,!![]);}else{this[_0x9ba3('0x2')][_0x9ba3('0x11')]();}};EmailImap[_0x9ba3('0x15')]['readUnseen']=function(){this[_0x9ba3('0x2')][_0x9ba3('0x2a')](['UNSEEN'],this['handleReadUnseen']['bind'](this));};EmailImap[_0x9ba3('0x15')]['handleReadUnseen']=function(_0x304951,_0x51464a){if(_0x304951){this[_0x9ba3('0x13')](_0x304951,!![]);}else{if(_0x51464a[_0x9ba3('0x2b')]){try{var _0x2a2b72=this[_0x9ba3('0x2')]['fetch'](_0x51464a,{'bodies':'','markSeen':!![]});_0x2a2b72['on'](_0x9ba3('0x2c'),this[_0x9ba3('0x2d')][_0x9ba3('0xf')](this));_0x2a2b72[_0x9ba3('0x10')]('error',this[_0x9ba3('0x2e')]['bind'](this));_0x2a2b72[_0x9ba3('0x10')](_0x9ba3('0x11'),this[_0x9ba3('0x2f')]['bind'](this));}catch(_0x239a53){logger[_0x9ba3('0x30')](_0x239a53);}}else{this['imap'][_0x9ba3('0x31')](!![],this[_0x9ba3('0x29')][_0x9ba3('0xf')](this));}}};EmailImap['prototype'][_0x9ba3('0x2d')]=function(_0x886e0c){_0x886e0c['on'](_0x9ba3('0x32'),this['handleMessageBody']['bind'](this));_0x886e0c[_0x9ba3('0x10')](_0x9ba3('0x33'),this[_0x9ba3('0x34')][_0x9ba3('0xf')](this));_0x886e0c[_0x9ba3('0x10')](_0x9ba3('0x11'),this['handleMessageEnd']['bind'](this));};EmailImap[_0x9ba3('0x15')][_0x9ba3('0x35')]=function(_0x2d4c01){simpleParser(_0x2d4c01,{'Iconv':Iconv},this[_0x9ba3('0x36')][_0x9ba3('0xf')](this));};EmailImap[_0x9ba3('0x15')][_0x9ba3('0x34')]=function(){};EmailImap['prototype'][_0x9ba3('0x37')]=function(){};EmailImap[_0x9ba3('0x15')][_0x9ba3('0x36')]=function(_0x5bb73c,_0x5a8903){if(_0x5bb73c){logger['error'](_0x5bb73c);}else{var _0x3aa197=this;utils[_0x9ba3('0x38')](this[_0x9ba3('0xb')],_0x5a8903,function(_0x5481b4){_0x3aa197[_0x9ba3('0x26')](_0x9ba3('0x20'),_0x5481b4);});}};EmailImap[_0x9ba3('0x15')]['handleFetchEnd']=function(){this[_0x9ba3('0x2')][_0x9ba3('0x31')](!![],this[_0x9ba3('0x29')][_0x9ba3('0xf')](this));};EmailImap[_0x9ba3('0x15')]['handleFetchError']=function(_0x20e12d){this[_0x9ba3('0x13')](_0x20e12d);this[_0x9ba3('0x2')][_0x9ba3('0x31')](!![],this['handleCloseBox'][_0x9ba3('0xf')](this));};EmailImap[_0x9ba3('0x15')]['handleEnd']=function(){this[_0x9ba3('0x26')](_0x9ba3('0x11'));};EmailImap[_0x9ba3('0x15')][_0x9ba3('0x13')]=function(_0x460f09,_0x1a9a0a){logger['error'](_0x9ba3('0x13'),this['account'][_0x9ba3('0x20')],JSON[_0x9ba3('0x39')](_0x460f09));var _0x5c8f29='';if(_0x460f09){if(_0x460f09[_0x9ba3('0x3a')]){_0x5c8f29=_0x460f09[_0x9ba3('0x3a')];}else{for(var _0x43a010 in _0x460f09){if(_0x460f09[_0x9ba3('0x3b')](_0x43a010)){_0x5c8f29+=_['upperFirst'](_0x43a010)+':\x20'+_0x460f09[_0x43a010]+'\x0a';}}}}if(_0x1a9a0a){this[_0x9ba3('0x2')][_0x9ba3('0x11')]();}else{this[_0x9ba3('0x26')](_0x9ba3('0x30'),_0x5c8f29);this[_0x9ba3('0x26')]('end');}};module[_0x9ba3('0x3c')]=EmailImap; \ No newline at end of file +var _0xe43d=['fetch','message','closeBox','handleFetchMessage','body','attributes','handleMessageAttributes','once','handleMessageEnd','handleSimpleParser','parser','emit','stringify','textCode','hasOwnProperty','imap','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils','email','mailbox','account','getAccount','ready','handleReady','end','handleEnd','error','connect','inherits','prototype','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','tls','autotls','openBox','handleOpenBox','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','bind','handleError','length'];(function(_0x372189,_0x718c8e){var _0x8b9904=function(_0x4bbed3){while(--_0x4bbed3){_0x372189['push'](_0x372189['shift']());}};_0x8b9904(++_0x718c8e);}(_0xe43d,0x1df));var _0xde43=function(_0x189c9e,_0x1c3b55){_0x189c9e=_0x189c9e-0x0;var _0x3f38ca=_0xe43d[_0x189c9e];return _0x3f38ca;};'use strict';var _=require('lodash');var util=require('util');var Imap=require(_0xde43('0x0'));var simpleParser=require(_0xde43('0x1'))[_0xde43('0x2')];var Iconv=require(_0xde43('0x3'))[_0xde43('0x4')];var EventEmitter=require('events')[_0xde43('0x5')];var utils=require(_0xde43('0x6'));var logger=require('../../../config/logger')(_0xde43('0x7'));function EmailImap(_0x48ee5e,_0x3dfc64){this[_0xde43('0x8')]=_0x48ee5e['mailbox'];this[_0xde43('0x9')]=this[_0xde43('0xa')](_0x48ee5e,_0x3dfc64);this[_0xde43('0x0')]=new Imap(this[_0xde43('0x9')]);this[_0xde43('0x0')]['once'](_0xde43('0xb'),this[_0xde43('0xc')]['bind'](this));this[_0xde43('0x0')]['once'](_0xde43('0xd'),this[_0xde43('0xe')]['bind'](this));this[_0xde43('0x0')]['on'](_0xde43('0xf'),this['handleError']['bind'](this));this[_0xde43('0x0')][_0xde43('0x10')]();}util[_0xde43('0x11')](EmailImap,EventEmitter);EmailImap[_0xde43('0x12')][_0xde43('0xa')]=function(_0x2c35e8,_0x412d45){var _0x3bd3d2={'connTimeout':_0x2c35e8[_0xde43('0x13')]?_0x2c35e8[_0xde43('0x13')]*0x3e8:0x2710,'authTimeout':_0x2c35e8[_0xde43('0x14')]?_0x2c35e8[_0xde43('0x14')]*0x3e8:0x1388};if(_0x2c35e8['service']){_0x3bd3d2[_0xde43('0x15')]=_0x2c35e8['user'];if(_0x2c35e8[_0xde43('0x16')]){_0x3bd3d2[_0xde43('0x17')]=utils[_0xde43('0x18')](_0x2c35e8[_0xde43('0x19')][_0xde43('0x1a')],_0x2c35e8[_0xde43('0x15')]);}else{_0x3bd3d2[_0xde43('0x1b')]=_0x2c35e8[_0xde43('0x1b')];}}else{if(_0x2c35e8[_0xde43('0x1c')]){_0x3bd3d2[_0xde43('0x15')]=_0x2c35e8[_0xde43('0x15')];_0x3bd3d2[_0xde43('0x1b')]=_0x2c35e8[_0xde43('0x1b')];}}_0x3bd3d2[_0xde43('0x7')]=_0x412d45||_0x2c35e8[_0xde43('0x15')]||'anonymous@xcally.com';_0x3bd3d2[_0xde43('0x1d')]=_0x2c35e8['host'];_0x3bd3d2['port']=_0x2c35e8['port']||0x3e1;if(_0x2c35e8[_0xde43('0x1e')]){_0x3bd3d2[_0xde43('0x1e')]=!![];}else{_0x3bd3d2[_0xde43('0x1e')]=![];_0x3bd3d2[_0xde43('0x1f')]='required';}return _0x3bd3d2;};EmailImap[_0xde43('0x12')][_0xde43('0xc')]=function(){this[_0xde43('0x0')][_0xde43('0x20')](this[_0xde43('0x8')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0xde43('0x12')][_0xde43('0x21')]=function(_0x5a957e,_0x54429a){if(_0x5a957e){this['handleError'](_0x5a957e,!![]);}else{this['emit'](_0xde43('0x22'),_0x54429a);this[_0xde43('0x23')]();}};EmailImap[_0xde43('0x12')][_0xde43('0x24')]=function(_0x2f22e8){if(_0x2f22e8){this['handleError'](_0x2f22e8,!![]);}else{this[_0xde43('0x0')][_0xde43('0xd')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0xde43('0x0')][_0xde43('0x25')]([_0xde43('0x26')],this[_0xde43('0x27')][_0xde43('0x28')](this));};EmailImap['prototype'][_0xde43('0x27')]=function(_0x524e14,_0x21dc4d){if(_0x524e14){this[_0xde43('0x29')](_0x524e14,!![]);}else{if(_0x21dc4d[_0xde43('0x2a')]){try{var _0x14dc65=this['imap'][_0xde43('0x2b')](_0x21dc4d,{'bodies':'','markSeen':!![]});_0x14dc65['on'](_0xde43('0x2c'),this['handleFetchMessage'][_0xde43('0x28')](this));_0x14dc65['once'](_0xde43('0xf'),this['handleFetchError']['bind'](this));_0x14dc65['once'](_0xde43('0xd'),this['handleFetchEnd'][_0xde43('0x28')](this));}catch(_0x2df384){logger['error'](_0x2df384);}}else{this['imap'][_0xde43('0x2d')](!![],this[_0xde43('0x24')]['bind'](this));}}};EmailImap[_0xde43('0x12')][_0xde43('0x2e')]=function(_0x559b82){_0x559b82['on'](_0xde43('0x2f'),this['handleMessageBody']['bind'](this));_0x559b82['once'](_0xde43('0x30'),this[_0xde43('0x31')][_0xde43('0x28')](this));_0x559b82[_0xde43('0x32')](_0xde43('0xd'),this['handleMessageEnd'][_0xde43('0x28')](this));};EmailImap[_0xde43('0x12')]['handleMessageBody']=function(_0xc07eee){simpleParser(_0xc07eee,{'Iconv':Iconv},this['handleSimpleParser'][_0xde43('0x28')](this));};EmailImap[_0xde43('0x12')][_0xde43('0x31')]=function(){};EmailImap[_0xde43('0x12')][_0xde43('0x33')]=function(){};EmailImap[_0xde43('0x12')][_0xde43('0x34')]=function(_0xeef03d,_0x4f80e4){if(_0xeef03d){logger[_0xde43('0xf')](_0xeef03d);}else{var _0xca46e9=this;utils[_0xde43('0x35')](this[_0xde43('0x9')],_0x4f80e4,function(_0x167fac){_0xca46e9[_0xde43('0x36')](_0xde43('0x7'),_0x167fac);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0xde43('0x0')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xde43('0x12')]['handleFetchError']=function(_0x1a32f8){this[_0xde43('0x29')](_0x1a32f8);this[_0xde43('0x0')]['closeBox'](!![],this[_0xde43('0x24')][_0xde43('0x28')](this));};EmailImap[_0xde43('0x12')][_0xde43('0xe')]=function(){this[_0xde43('0x36')](_0xde43('0xd'));};EmailImap[_0xde43('0x12')][_0xde43('0x29')]=function(_0x52c882,_0x5bd424){logger[_0xde43('0xf')](_0xde43('0x29'),this['account'][_0xde43('0x7')],JSON[_0xde43('0x37')](_0x52c882));var _0x10e4ed='';if(_0x52c882){if(_0x52c882[_0xde43('0x38')]){_0x10e4ed=_0x52c882[_0xde43('0x38')];}else{for(var _0x579999 in _0x52c882){if(_0x52c882[_0xde43('0x39')](_0x579999)){_0x10e4ed+=_['upperFirst'](_0x579999)+':\x20'+_0x52c882[_0x579999]+'\x0a';}}}}if(_0x5bd424){this[_0xde43('0x0')][_0xde43('0xd')]();}else{this['emit'](_0xde43('0xf'),_0x10e4ed);this[_0xde43('0x36')](_0xde43('0xd'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 8b74940..13197d6 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 _0xe8a7=['send','createTransport','use','compile','sendMail','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x388d01,_0x490fca){var _0x59b425=function(_0x5ccad6){while(--_0x5ccad6){_0x388d01['push'](_0x388d01['shift']());}};_0x59b425(++_0x490fca);}(_0xe8a7,0x110));var _0x7e8a=function(_0x4f6a8e,_0x2ca44b){_0x4f6a8e=_0x4f6a8e-0x0;var _0xdc60ce=_0xe8a7[_0x4f6a8e];return _0xdc60ce;};'use strict';var nodemailer=require(_0x7e8a('0x0'));var inlineBase64=require(_0x7e8a('0x1'));function EmailSmtp(){}EmailSmtp[_0x7e8a('0x2')][_0x7e8a('0x3')]=function(_0x389401,_0x3161c7){return new Promise(function(_0x38a64a,_0x489a34){var _0x2c73d5=nodemailer[_0x7e8a('0x4')](_0x389401);_0x2c73d5[_0x7e8a('0x5')](_0x7e8a('0x6'),inlineBase64());_0x2c73d5[_0x7e8a('0x7')](_0x3161c7,function(_0x287a21,_0x27c0d2){if(_0x287a21){_0x489a34(_0x287a21['toString']());}else{_0x38a64a(_0x27c0d2);}});});};EmailSmtp[_0x7e8a('0x2')]['verify']=function(_0xd528e1){return new Promise(function(_0x2baf9d,_0x5a2e90){var _0x2cd870=nodemailer['createTransport'](_0xd528e1);_0x2cd870[_0x7e8a('0x8')](function(_0x9210cc,_0x196e35){if(_0x9210cc){_0x5a2e90(_0x9210cc['toString']());}else{if(_0x196e35){_0x2baf9d(_0x196e35);}else{_0x5a2e90(_0x7e8a('0x9'));}}});});};module[_0x7e8a('0xa')]=EmailSmtp; \ No newline at end of file +var _0xf8b1=['compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x543333,_0x5e8545){var _0x110b6b=function(_0x20ed46){while(--_0x20ed46){_0x543333['push'](_0x543333['shift']());}};_0x110b6b(++_0x5e8545);}(_0xf8b1,0x192));var _0x1f8b=function(_0x2bcba1,_0x4ca700){_0x2bcba1=_0x2bcba1-0x0;var _0x318356=_0xf8b1[_0x2bcba1];return _0x318356;};'use strict';var nodemailer=require(_0x1f8b('0x0'));var inlineBase64=require(_0x1f8b('0x1'));function EmailSmtp(){}EmailSmtp[_0x1f8b('0x2')][_0x1f8b('0x3')]=function(_0x149e3f,_0x309082){return new Promise(function(_0x50aadb,_0x1ebd8e){var _0x2fb32b=nodemailer[_0x1f8b('0x4')](_0x149e3f);_0x2fb32b['use'](_0x1f8b('0x5'),inlineBase64());_0x2fb32b[_0x1f8b('0x6')](_0x309082,function(_0x5e62d7,_0x3ce552){if(_0x5e62d7){_0x1ebd8e(_0x5e62d7[_0x1f8b('0x7')]());}else{_0x50aadb(_0x3ce552);}});});};EmailSmtp[_0x1f8b('0x2')][_0x1f8b('0x8')]=function(_0x815401){return new Promise(function(_0x449b05,_0x482a95){var _0x306481=nodemailer[_0x1f8b('0x4')](_0x815401);_0x306481[_0x1f8b('0x8')](function(_0x371684,_0x12ea43){if(_0x371684){_0x482a95(_0x371684['toString']());}else{if(_0x12ea43){_0x449b05(_0x12ea43);}else{_0x482a95(_0x1f8b('0x9'));}}});});};module[_0x1f8b('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 65fb8ea..695db00 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 _0xe603=['%s-%s','root','server/files/attachments/','writeFileSync','content','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','from','subject','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Data','user=','utf-8','lodash','moment','path','node-tnef','../../../config/logger','email','../../../config/environment','value','@xcally.com','head','name','address','substring','indexOf','split','length','slice','join','Anonymous','anonymous','generate','html','replace','includes','\x20[Attachment:\x20','body','0x1?_0x323064[_0x3e60('0x10')](0x0,-0x1)[_0x3e60('0x11')]('\x20'):_0xe9d6b8[_0x3e60('0xa')];}return _0x3e60('0x12');}function getLastName(_0x41bdd6){var _0x489780=_['head'](_0x41bdd6[_0x3e60('0x7')]);if(_0x489780&&_0x489780[_0x3e60('0xa')]){var _0x317b99=_0x489780[_0x3e60('0xa')][_0x3e60('0xe')](/\s+/);return _0x317b99[_0x3e60('0xf')]>0x1?_0x317b99['pop']():'';}return'';}function getMails(_0x4dd2f0,_0x337bd5){var _0x4c3711='';for(var _0x23021b=0x0;_0x23021b<_0x337bd5['value'][_0x3e60('0xf')];_0x23021b+=0x1){if(_0x337bd5['value'][_0x23021b][_0x3e60('0xb')]!==_0x4dd2f0){if(!_['isEmpty'](_0x4c3711)){_0x4c3711+=',';}_0x4c3711+=_0x337bd5[_0x3e60('0x7')][_0x23021b][_0x3e60('0xa')]||_0x337bd5[_0x3e60('0x7')][_0x23021b][_0x3e60('0xb')]||'';_0x4c3711+='\x20<';_0x4c3711+=_0x337bd5['value'][_0x23021b][_0x3e60('0xb')]?_0x337bd5[_0x3e60('0x7')][_0x23021b][_0x3e60('0xb')]:_0x3e60('0x13')+random[_0x3e60('0x14')](0x6)+_0x3e60('0x8');_0x4c3711+='>';}}return _0x4c3711;}function parseEmail(_0x2e6133,_0x2db4cf,_0x621602){if(_0x2db4cf[_0x3e60('0x15')]){var _0xca672f=/)<[^<]*)*<\/script>/gi;while(_0xca672f['test'](_0x2db4cf[_0x3e60('0x15')])){_0x2db4cf[_0x3e60('0x15')]=_0x2db4cf[_0x3e60('0x15')][_0x3e60('0x16')](_0xca672f,'');}if(_0x2db4cf[_0x3e60('0x15')][_0x3e60('0x17')](_0x3e60('0x18'))){var _0x22a742=[];_0x2db4cf['attachments'][_0x3e60('0x19')](_0x3d3f95=>{_0x22a742['push'](_0x3d3f95[_0x3e60('0x1a')]);});var _0x215630=/]+>/g;var _0x15c33b=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x185891=_0x2db4cf[_0x3e60('0x15')][_0x3e60('0x16')](_0x15c33b,_0x3e60('0x1b'));var _0x18fa39=_0x185891[_0x3e60('0x16')](_0x215630,_0x3e60('0x1c'));for(let _0x46d6f8=0x0;_0x46d6f8<_0x22a742['length'];_0x46d6f8++){var _0x13d9c5=_0x18fa39[_0x3e60('0x16')](_0x3e60('0x1c'),_0x3e60('0x1d')+_0x22a742[_0x46d6f8]+'\x20]');_0x18fa39=_0x13d9c5;}_0x2db4cf['html']=_0x18fa39;}_0x621602[_0x3e60('0x1e')]=_0x2db4cf[_0x3e60('0x15')];}else{_0x621602['body']=_0x2db4cf['textAsHtml'];}if(_0x621602['body']){_0x621602[_0x3e60('0x1e')]=_0x621602[_0x3e60('0x1e')][_0x3e60('0x16')](/0x0){var _0x293589=['Auto-Submitted:\x20auto-replied',_0x3e60('0x2e'),_0x3e60('0x2f')];for(var _0x497a4e=0x0;_0x497a4e<_0x2db4cf['headerLines'][_0x3e60('0xf')];_0x497a4e++){var _0x140db5=_['indexOf'](_0x293589,_0x2db4cf[_0x3e60('0x2d')][_0x497a4e][_0x3e60('0x30')]);if(_0x140db5>=0x0){_0x621602[_0x3e60('0x31')]=!![];}}}return _0x621602;}exports['parser']=function(_0x5b10b9,_0x468985,_0x1949fc){var _0x10f64b={'from':getAddress(_0x468985['from']),'firstName':getFirstName(_0x468985[_0x3e60('0x32')]),'lastName':getLastName(_0x468985[_0x3e60('0x32')]),'mapKey':'email','message':{'from':getMails(_0x5b10b9[_0x3e60('0x5')],_0x468985[_0x3e60('0x32')]),'to':_0x5b10b9[_0x3e60('0x5')],'cc':'','subject':_0x468985[_0x3e60('0x33')]||'','messageId':_0x468985['messageId'],'inReplyTo':_0x468985[_0x3e60('0x34')],'sentAt':moment(_0x468985[_0x3e60('0x35')])[_0x3e60('0x27')](_0x3e60('0x36')),'attach':![],'attachments':[]}};if(!_0x468985[_0x3e60('0x15')]&&!_0x468985[_0x3e60('0x37')]){var _0x3e50b5=_['filter'](_0x468985[_0x3e60('0x25')],{'contentType':'application/ms-tnef'});if(_0x3e50b5[_0x3e60('0xf')]){logger[_0x3e60('0x38')](util['format'](_0x3e60('0x39'),_0x468985[_0x3e60('0x3a')]));tnef[_0x3e60('0x3b')](_[_0x3e60('0x3c')](_0x3e50b5)['content'],function(_0x48d176,_0x2ec321){if(_0x2ec321){_0x468985[_0x3e60('0x15')]=_0x2ec321[_0x3e60('0x3d')]||_0x3e60('0x3e');if(_0x2ec321['Attachments']){for(var _0x33b4fe=0x0;_0x33b4fe<_0x2ec321[_0x3e60('0x3f')][_0x3e60('0xf')];_0x33b4fe++){var _0xe30ed1=_0x2ec321[_0x3e60('0x3f')][_0x33b4fe];_0x10f64b[_0x3e60('0x20')][_0x3e60('0x25')]['push']({'filename':_0xe30ed1['Title'],'content':Buffer[_0x3e60('0x32')](_0xe30ed1[_0x3e60('0x40')])});}}}_0x1949fc(parseEmail(_0x5b10b9,_0x468985,_0x10f64b));});}else{_0x468985[_0x3e60('0x15')]=_0x3e60('0x3e');_0x1949fc(parseEmail(_0x5b10b9,_0x468985,_0x10f64b));}}else{_0x1949fc(parseEmail(_0x5b10b9,_0x468985,_0x10f64b));}};exports['generateXOAuth2Token']=function(_0x4c4c41,_0x58ec4b){var _0x531dc2=[_0x3e60('0x41')+(_0x58ec4b||''),'auth=Bearer\x20'+_0x4c4c41,'',''];return Buffer[_0x3e60('0x32')](_0x531dc2[_0x3e60('0x11')](''),_0x3e60('0x42'))['toString']('base64');}; \ No newline at end of file +var _0x3606=['moment','randomstring','path','util','node-tnef','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','substring','split','slice','join','Anonymous','length','pop','html','replace','includes','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','originTo','isEmpty','message','originCc','attachments','attach','type','attachment','attachment-','format','%s-%s','now','server/files/attachments/','writeFileSync','content','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','line','isAutoreply','from','subject','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','info','parseBuffer','first','

Empty\x20message

','Attachments','Title','user=','auth=Bearer\x20','utf-8','base64','lodash'];(function(_0x5bff9e,_0x39ea3a){var _0x7f42ef=function(_0x58a923){while(--_0x58a923){_0x5bff9e['push'](_0x5bff9e['shift']());}};_0x7f42ef(++_0x39ea3a);}(_0x3606,0x11b));var _0x6360=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x3606[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x6360('0x0'));var moment=require(_0x6360('0x1'));var random=require(_0x6360('0x2'));var fs=require('fs');var path=require(_0x6360('0x3'));var util=require(_0x6360('0x4'));var tnef=require(_0x6360('0x5'));var logger=require('../../../config/logger')(_0x6360('0x6'));var config=require(_0x6360('0x7'));function getAddress(_0x2dfe34){var _0x140c1f=_['head'](_0x2dfe34[_0x6360('0x8')]);return _0x140c1f&&_0x140c1f[_0x6360('0x9')]?_0x140c1f[_0x6360('0x9')]:_0x6360('0xa')+random[_0x6360('0xb')](0x6)+_0x6360('0xc');}function getFirstName(_0x50fe05){var _0xef0030=_[_0x6360('0xd')](_0x50fe05[_0x6360('0x8')]);if(_0xef0030&&_0xef0030[_0x6360('0xe')]){if(_0xef0030['name']==_0xef0030[_0x6360('0x9')]){return _0xef0030[_0x6360('0xe')][_0x6360('0xf')](0x0,_0xef0030[_0x6360('0xe')]['indexOf']('@'));}var _0x933910=_0xef0030[_0x6360('0xe')][_0x6360('0x10')](/\s+/);return _0x933910['length']>0x1?_0x933910[_0x6360('0x11')](0x0,-0x1)[_0x6360('0x12')]('\x20'):_0xef0030[_0x6360('0xe')];}return _0x6360('0x13');}function getLastName(_0x2e26c3){var _0x1c19b6=_[_0x6360('0xd')](_0x2e26c3['value']);if(_0x1c19b6&&_0x1c19b6[_0x6360('0xe')]){var _0x53b7ff=_0x1c19b6[_0x6360('0xe')][_0x6360('0x10')](/\s+/);return _0x53b7ff[_0x6360('0x14')]>0x1?_0x53b7ff[_0x6360('0x15')]():'';}return'';}function getMails(_0x47f04d,_0x244a90){var _0x2b6c0d='';for(var _0x5dd40d=0x0;_0x5dd40d<_0x244a90[_0x6360('0x8')][_0x6360('0x14')];_0x5dd40d+=0x1){if(_0x244a90[_0x6360('0x8')][_0x5dd40d][_0x6360('0x9')]!==_0x47f04d){if(!_['isEmpty'](_0x2b6c0d)){_0x2b6c0d+=',';}_0x2b6c0d+=_0x244a90[_0x6360('0x8')][_0x5dd40d]['name']||_0x244a90[_0x6360('0x8')][_0x5dd40d]['address']||'';_0x2b6c0d+='\x20<';_0x2b6c0d+=_0x244a90[_0x6360('0x8')][_0x5dd40d][_0x6360('0x9')]?_0x244a90[_0x6360('0x8')][_0x5dd40d]['address']:_0x6360('0xa')+random[_0x6360('0xb')](0x6)+'@xcally.com';_0x2b6c0d+='>';}}return _0x2b6c0d;}function parseEmail(_0x22cef4,_0x3d79b4,_0x20aceb){if(_0x3d79b4[_0x6360('0x16')]){var _0x4f720f=/)<[^<]*)*<\/script>/gi;while(_0x4f720f['test'](_0x3d79b4[_0x6360('0x16')])){_0x3d79b4[_0x6360('0x16')]=_0x3d79b4[_0x6360('0x16')][_0x6360('0x17')](_0x4f720f,'');}if(_0x3d79b4[_0x6360('0x16')][_0x6360('0x18')]('{_0x5025d5[_0x6360('0x1a')](_0x1870ef[_0x6360('0x1b')]);});var _0x5dafe1=/]+>/g;var _0x27dc6b=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2196a3=_0x3d79b4['html']['replace'](_0x27dc6b,_0x6360('0x1c'));var _0x18dfb7=_0x2196a3[_0x6360('0x17')](_0x5dafe1,_0x6360('0x1d'));for(let _0x2aa89f=0x0;_0x2aa89f<_0x5025d5[_0x6360('0x14')];_0x2aa89f++){var _0x2ebaf2=_0x18dfb7['replace'](_0x6360('0x1d'),_0x6360('0x1e')+_0x5025d5[_0x2aa89f]+_0x6360('0x1f'));_0x18dfb7=_0x2ebaf2;}_0x3d79b4[_0x6360('0x16')]=_0x18dfb7;}_0x20aceb[_0x6360('0x20')]=_0x3d79b4[_0x6360('0x16')];}else{_0x20aceb[_0x6360('0x20')]=_0x3d79b4[_0x6360('0x21')];}if(_0x20aceb[_0x6360('0x20')]){_0x20aceb['body']=_0x20aceb[_0x6360('0x20')][_0x6360('0x17')](/0x0){var _0x4daaff=['Auto-Submitted:\x20auto-replied',_0x6360('0x32'),_0x6360('0x33')];for(var _0x4c5a89=0x0;_0x4c5a89<_0x3d79b4['headerLines'][_0x6360('0x14')];_0x4c5a89++){var _0x446641=_[_0x6360('0x34')](_0x4daaff,_0x3d79b4[_0x6360('0x31')][_0x4c5a89][_0x6360('0x35')]);if(_0x446641>=0x0){_0x20aceb[_0x6360('0x36')]=!![];}}}return _0x20aceb;}exports['parser']=function(_0x12fef7,_0x5b73f4,_0x2cf6d1){var _0x5b4445={'from':getAddress(_0x5b73f4[_0x6360('0x37')]),'firstName':getFirstName(_0x5b73f4[_0x6360('0x37')]),'lastName':getLastName(_0x5b73f4[_0x6360('0x37')]),'mapKey':_0x6360('0x6'),'message':{'from':getMails(_0x12fef7[_0x6360('0x6')],_0x5b73f4[_0x6360('0x37')]),'to':_0x12fef7['email'],'cc':'','subject':_0x5b73f4[_0x6360('0x38')]||'','messageId':_0x5b73f4['messageId'],'inReplyTo':_0x5b73f4[_0x6360('0x39')],'sentAt':moment(_0x5b73f4[_0x6360('0x3a')])[_0x6360('0x2b')](_0x6360('0x3b')),'attach':![],'attachments':[]}};if(!_0x5b73f4[_0x6360('0x16')]&&!_0x5b73f4[_0x6360('0x21')]){var _0x3f84d9=_[_0x6360('0x3c')](_0x5b73f4[_0x6360('0x26')],{'contentType':'application/ms-tnef'});if(_0x3f84d9['length']){logger[_0x6360('0x3d')](util[_0x6360('0x2b')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x5b73f4['messageId']));tnef[_0x6360('0x3e')](_[_0x6360('0x3f')](_0x3f84d9)[_0x6360('0x30')],function(_0x1d94dd,_0x4bf6e3){if(_0x4bf6e3){_0x5b73f4[_0x6360('0x16')]=_0x4bf6e3['BodyHTML']||_0x6360('0x40');if(_0x4bf6e3[_0x6360('0x41')]){for(var _0x29905d=0x0;_0x29905d<_0x4bf6e3[_0x6360('0x41')][_0x6360('0x14')];_0x29905d++){var _0xdf0e24=_0x4bf6e3[_0x6360('0x41')][_0x29905d];_0x5b4445[_0x6360('0x24')][_0x6360('0x26')][_0x6360('0x1a')]({'filename':_0xdf0e24[_0x6360('0x42')],'content':Buffer[_0x6360('0x37')](_0xdf0e24['Data'])});}}}_0x2cf6d1(parseEmail(_0x12fef7,_0x5b73f4,_0x5b4445));});}else{_0x5b73f4[_0x6360('0x16')]=_0x6360('0x40');_0x2cf6d1(parseEmail(_0x12fef7,_0x5b73f4,_0x5b4445));}}else{_0x2cf6d1(parseEmail(_0x12fef7,_0x5b73f4,_0x5b4445));}};exports['generateXOAuth2Token']=function(_0x27208c,_0x697206){var _0x23c213=[_0x6360('0x43')+(_0x697206||''),_0x6360('0x44')+_0x27208c,'',''];return Buffer[_0x6360('0x37')](_0x23c213[_0x6360('0x12')](''),_0x6360('0x45'))['toString'](_0x6360('0x46'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 97c20de..72d681b 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 _0x6e13=['name','key','SERV','active','Imap','Smtp','exports'];(function(_0x28a180,_0x5bb5b0){var _0x1161d3=function(_0x2bb4cf){while(--_0x2bb4cf){_0x28a180['push'](_0x28a180['shift']());}};_0x1161d3(++_0x5bb5b0);}(_0x6e13,0x93));var _0x36e1=function(_0x4a297d,_0x388c74){_0x4a297d=_0x4a297d-0x0;var _0x3ea325=_0x6e13[_0x4a297d];return _0x3ea325;};'use strict';var _=require('lodash');function MailAccount(_0x5acbec){this['id']=_0x5acbec['id']||0x0;this[_0x36e1('0x0')]=_0x5acbec[_0x36e1('0x0')]||'Service';this[_0x36e1('0x1')]=_0x5acbec[_0x36e1('0x1')]||_0x36e1('0x2');this['active']=_0x5acbec[_0x36e1('0x3')]||![];this[_0x36e1('0x4')]=_0x5acbec['Imap']||[];this[_0x36e1('0x5')]=_0x5acbec[_0x36e1('0x5')]||[];}module[_0x36e1('0x6')]=MailAccount; \ No newline at end of file +var _0xfb73=['exports','name','Service','key','active','Imap','Smtp'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfb73,0xf6));var _0x3fb7=function(_0x3a5b38,_0x2c7d84){_0x3a5b38=_0x3a5b38-0x0;var _0x149d4f=_0xfb73[_0x3a5b38];return _0x149d4f;};'use strict';var _=require('lodash');function MailAccount(_0x17d840){this['id']=_0x17d840['id']||0x0;this[_0x3fb7('0x0')]=_0x17d840[_0x3fb7('0x0')]||_0x3fb7('0x1');this[_0x3fb7('0x2')]=_0x17d840[_0x3fb7('0x2')]||'SERV';this['active']=_0x17d840[_0x3fb7('0x3')]||![];this[_0x3fb7('0x4')]=_0x17d840[_0x3fb7('0x4')]||[];this[_0x3fb7('0x5')]=_0x17d840[_0x3fb7('0x5')]||[];}module[_0x3fb7('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index d06eb8a..0f7924e 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 _0x6931=['mergeFromDatabase','prototype','initMailAccounts','isUndefined','mailAccounts','merge','exports','lodash','../model/mailAccount','hasOwnProperty'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x6931,0x18d));var _0x1693=function(_0x54125b,_0x3a1c36){_0x54125b=_0x54125b-0x0;var _0x2a5308=_0x6931[_0x54125b];return _0x2a5308;};'use strict';var _=require(_0x1693('0x0'));var MailAccount=require(_0x1693('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x3940f0,_0x20cd25,_0x2f537b){var _0x9ee9f5=_['mapKeys'](_0x3940f0,function(_0x56e664,_0x484b20){return _0x56e664[_0x2f537b];});for(var _0x5058ba in _0x20cd25){if(_0x20cd25[_0x1693('0x2')](_0x5058ba)){if(!_0x9ee9f5[_0x5058ba]){delete _0x20cd25[_0x5058ba];}}}}Realtime['prototype'][_0x1693('0x3')]=function(_0x370439,_0x5de005){for(var _0x51d0b3 in _0x5de005){if(_0x370439['hasOwnProperty'](_0x51d0b3)){_0x370439[_0x51d0b3]=_0x5de005[_0x51d0b3];}}};Realtime[_0x1693('0x4')][_0x1693('0x5')]=function(){var _0x54439e=this;return function(_0x356af5){if(_0x356af5){freeIsNotKey(_0x356af5,_0x54439e['mailAccounts'],'id');for(var _0x5e6775=0x0,_0x8865fe={},_0x313355={};_0x5e6775<_0x356af5['length'];_0x5e6775+=0x1){_0x8865fe=_0x356af5[_0x5e6775];if(_[_0x1693('0x6')](_0x54439e[_0x1693('0x7')][_0x8865fe['id']])){_0x54439e[_0x1693('0x7')][_0x8865fe['id']]=new MailAccount(_0x8865fe);}else{_[_0x1693('0x8')](_0x54439e['mailAccounts'][_0x8865fe['id']],_0x8865fe);}}}return _0x54439e[_0x1693('0x7')];};};module[_0x1693('0x9')]=Realtime; \ No newline at end of file +var _0x5ae8=['mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports','lodash','mailAccounts'];(function(_0x3b16f6,_0x2f622e){var _0x5e9643=function(_0xa91b5a){while(--_0xa91b5a){_0x3b16f6['push'](_0x3b16f6['shift']());}};_0x5e9643(++_0x2f622e);}(_0x5ae8,0x174));var _0x85ae=function(_0x1b1aaf,_0x3275b7){_0x1b1aaf=_0x1b1aaf-0x0;var _0x1fe1ae=_0x5ae8[_0x1b1aaf];return _0x1fe1ae;};'use strict';var _=require(_0x85ae('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x85ae('0x1')]={};};function freeIsNotKey(_0x2576fd,_0x429d91,_0x3fcc37){var _0xbd0e1a=_[_0x85ae('0x2')](_0x2576fd,function(_0x5221c0,_0xf636db){return _0x5221c0[_0x3fcc37];});for(var _0x26158a in _0x429d91){if(_0x429d91[_0x85ae('0x3')](_0x26158a)){if(!_0xbd0e1a[_0x26158a]){delete _0x429d91[_0x26158a];}}}}Realtime[_0x85ae('0x4')][_0x85ae('0x5')]=function(_0x33d1ba,_0x472a7f){for(var _0x19f277 in _0x472a7f){if(_0x33d1ba[_0x85ae('0x3')](_0x19f277)){_0x33d1ba[_0x19f277]=_0x472a7f[_0x19f277];}}};Realtime['prototype'][_0x85ae('0x6')]=function(){var _0x8a0e67=this;return function(_0x1965e7){if(_0x1965e7){freeIsNotKey(_0x1965e7,_0x8a0e67[_0x85ae('0x1')],'id');for(var _0x56162c=0x0,_0x30e23b={},_0x374649={};_0x56162c<_0x1965e7[_0x85ae('0x7')];_0x56162c+=0x1){_0x30e23b=_0x1965e7[_0x56162c];if(_[_0x85ae('0x8')](_0x8a0e67[_0x85ae('0x1')][_0x30e23b['id']])){_0x8a0e67[_0x85ae('0x1')][_0x30e23b['id']]=new MailAccount(_0x30e23b);}else{_[_0x85ae('0x9')](_0x8a0e67[_0x85ae('0x1')][_0x30e23b['id']],_0x30e23b);}}}return _0x8a0e67[_0x85ae('0x1')];};};module[_0x85ae('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index b138c65..5788904 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 _0xa965=['Request','NotifyMailAccount','GetMailAccount','name','provider','service','key','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','Smtp','getMailAccount','notify'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xa965,0x172));var _0x5a96=function(_0x2170e4,_0x5b969e){_0x2170e4=_0x2170e4-0x0;var _0xec86f5=_0xa965[_0x2170e4];return _0xec86f5;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client['Request'](_0x5a96('0x0'),{'options':{'attributes':['id',_0x5a96('0x1'),_0x5a96('0x2'),_0x5a96('0x3'),'email','active',_0x5a96('0x4'),'ListId',_0x5a96('0x5')],'raw':![],'include':[{'model':_0x5a96('0x6'),'as':_0x5a96('0x7'),'include':[{'model':_0x5a96('0x8'),'attributes':['id','name',_0x5a96('0x3'),_0x5a96('0x9'),_0x5a96('0xa')],'as':_0x5a96('0x8')}]},{'model':'MailServerOut','as':_0x5a96('0xb'),'include':[{'model':_0x5a96('0x8'),'attributes':['id',_0x5a96('0x1'),'service',_0x5a96('0x9'),_0x5a96('0xa')],'as':_0x5a96('0x8')}]}]},'log':_0x5a96('0xc')});};};exports[_0x5a96('0xd')]=function(_0x37ada8,_0x33faf3){return client[_0x5a96('0xe')](_0x5a96('0xf'),{'account':{'id':_0x37ada8},'body':_0x33faf3,'log':_0x5a96('0xf')});}; \ No newline at end of file +var _0xe0dc=['NotifyMailAccount','../client','Request','GetMailAccount','provider','service','email','active','ListId','MailServerIn','Imap','CloudProvider','name','type','data5','MailServerOut','Smtp','getMailAccount','notify'];(function(_0x5595f0,_0x17ee59){var _0x423879=function(_0x166dd3){while(--_0x166dd3){_0x5595f0['push'](_0x5595f0['shift']());}};_0x423879(++_0x17ee59);}(_0xe0dc,0x190));var _0xce0d=function(_0x1b6621,_0x105c12){_0x1b6621=_0x1b6621-0x0;var _0x12cad9=_0xe0dc[_0x1b6621];return _0x12cad9;};'use strict';var client=require(_0xce0d('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xce0d('0x1')](_0xce0d('0x2'),{'options':{'attributes':['id','name',_0xce0d('0x3'),_0xce0d('0x4'),_0xce0d('0x5'),_0xce0d('0x6'),'key',_0xce0d('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0xce0d('0x8'),'as':_0xce0d('0x9'),'include':[{'model':_0xce0d('0xa'),'attributes':['id',_0xce0d('0xb'),_0xce0d('0x4'),_0xce0d('0xc'),_0xce0d('0xd')],'as':_0xce0d('0xa')}]},{'model':_0xce0d('0xe'),'as':_0xce0d('0xf'),'include':[{'model':_0xce0d('0xa'),'attributes':['id',_0xce0d('0xb'),_0xce0d('0x4'),_0xce0d('0xc'),_0xce0d('0xd')],'as':_0xce0d('0xa')}]}]},'log':_0xce0d('0x10')});};};exports[_0xce0d('0x11')]=function(_0x25bdf7,_0x4a8b96){return client[_0xce0d('0x1')](_0xce0d('0x12'),{'account':{'id':_0x25bdf7},'body':_0x4a8b96,'log':_0xce0d('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index b154e94..8d214aa 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 _0xdc7e=['Request','GetSettings','../client','getSettings'];(function(_0x2d76ce,_0x1c9756){var _0x429705=function(_0x5a6817){while(--_0x5a6817){_0x2d76ce['push'](_0x2d76ce['shift']());}};_0x429705(++_0x1c9756);}(_0xdc7e,0xbe));var _0xedc7=function(_0x277e8c,_0x1d91e7){_0x277e8c=_0x277e8c-0x0;var _0x4acc8b=_0xdc7e[_0x277e8c];return _0x4acc8b;};'use strict';var client=require(_0xedc7('0x0'));exports[_0xedc7('0x1')]=function(){return client[_0xedc7('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xedc7('0x3')});}; \ No newline at end of file +var _0x0d9b=['getSettings','Request','loginMailFrequency','GetSettings'];(function(_0x18f62d,_0x186c5a){var _0x3211a8=function(_0x458264){while(--_0x458264){_0x18f62d['push'](_0x18f62d['shift']());}};_0x3211a8(++_0x186c5a);}(_0x0d9b,0x148));var _0xb0d9=function(_0x1370e1,_0x2fbf13){_0x1370e1=_0x1370e1-0x0;var _0xf5619b=_0x0d9b[_0x1370e1];return _0xf5619b;};'use strict';var client=require('../client');exports[_0xb0d9('0x0')]=function(){return client[_0xb0d9('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb0d9('0x2')]},'log':_0xb0d9('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 271e71f..7f22856 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 82ff1b3..aa27a76 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 _0x9c05=['express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','defaults','localhost','adapter','socket.io-redis','redis','default','../../config/socketio','../../config/express','../../routes','once','listening','exports','lodash','http'];(function(_0xcb48df,_0x2760e2){var _0x52d5ff=function(_0x2e1365){while(--_0x2e1365){_0xcb48df['push'](_0xcb48df['shift']());}};_0x52d5ff(++_0x2760e2);}(_0x9c05,0x18e));var _0x59c0=function(_0xda6af4,_0x5b9b42){_0xda6af4=_0xda6af4-0x0;var _0x35a4a8=_0x9c05[_0xda6af4];return _0x35a4a8;};'use strict';var _=require(_0x59c0('0x0'));var http=require(_0x59c0('0x1'));var express=require(_0x59c0('0x2'));var sticky=require(_0x59c0('0x3'));var Redis=require(_0x59c0('0x4'));var config=require(_0x59c0('0x5'));var app=express();var server=http[_0x59c0('0x6')](app);server[_0x59c0('0x7')]=0xdbba0;if(sticky[_0x59c0('0x8')](server,config[_0x59c0('0x9')])){var socketio=require(_0x59c0('0xa'))(server,{'transports':[_0x59c0('0xb'),_0x59c0('0xc')]});config['redis']=_[_0x59c0('0xd')](config['redis'],{'host':_0x59c0('0xe'),'port':0x18eb});socketio[_0x59c0('0xf')](require(_0x59c0('0x10'))({'pubClient':new Redis(config[_0x59c0('0x11')]),'subClient':new Redis(config[_0x59c0('0x11')])}));require('../../config/triggers')[_0x59c0('0x12')]();require(_0x59c0('0x13'))['default'](socketio);require(_0x59c0('0x14'))['default'](app);require(_0x59c0('0x15'))[_0x59c0('0x12')](app);}else{server[_0x59c0('0x16')](_0x59c0('0x17'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x59c0('0x9')]);});}exports=module[_0x59c0('0x18')]=app; \ No newline at end of file +var _0xa0d9=['exports','lodash','express','sticky-session','../../config/environment','createServer','listen','port','socket.io','websocket','polling','defaults','redis','localhost','adapter','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa0d9,0x171));var _0x9a0d=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0xa0d9[_0x2c0be1];return _0x3d4bd2;};'use strict';var _=require(_0x9a0d('0x0'));var http=require('http');var express=require(_0x9a0d('0x1'));var sticky=require(_0x9a0d('0x2'));var Redis=require('ioredis');var config=require(_0x9a0d('0x3'));var app=express();var server=http[_0x9a0d('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0x9a0d('0x5')](server,config[_0x9a0d('0x6')])){var socketio=require(_0x9a0d('0x7'))(server,{'transports':[_0x9a0d('0x8'),_0x9a0d('0x9')]});config['redis']=_[_0x9a0d('0xa')](config[_0x9a0d('0xb')],{'host':_0x9a0d('0xc'),'port':0x18eb});socketio[_0x9a0d('0xd')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x9a0d('0xb')])}));require('../../config/triggers')[_0x9a0d('0xe')]();require(_0x9a0d('0xf'))[_0x9a0d('0xe')](socketio);require(_0x9a0d('0x10'))[_0x9a0d('0xe')](app);require(_0x9a0d('0x11'))[_0x9a0d('0xe')](app);}else{server[_0x9a0d('0x12')](_0x9a0d('0x13'),function(){console[_0x9a0d('0x14')](_0x9a0d('0x15'),config[_0x9a0d('0x6')]);});}exports=module[_0x9a0d('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 6644a11..7427617 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 _0x77b5=['error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','Request','request','then','debug','rpc'];(function(_0x1ec445,_0x11b1d7){var _0x435c5b=function(_0x4966b3){while(--_0x4966b3){_0x1ec445['push'](_0x1ec445['shift']());}};_0x435c5b(++_0x11b1d7);}(_0x77b5,0xaa));var _0x577b=function(_0x500cd5,_0x5ef1f9){_0x500cd5=_0x500cd5-0x0;var _0x4db92a=_0x77b5[_0x500cd5];return _0x4db92a;};'use strict';var jayson=require(_0x577b('0x0'));var BPromise=require(_0x577b('0x1'));var logger=require(_0x577b('0x2'))(_0x577b('0x3'));var client=jayson[_0x577b('0x4')]['http']({'port':0x2329});client[_0x577b('0x5')]=function(_0x9536b,_0x195f10){return new BPromise(function(_0x1fe377,_0x4eb7c5){return client[_0x577b('0x6')](_0x9536b,_0x195f10)[_0x577b('0x7')](function(_0x5da10a){logger[_0x577b('0x8')](_0x577b('0x9'),_0x577b('0x3'),_0x9536b,_0x195f10,_0x5da10a);if(_0x5da10a['error']){logger[_0x577b('0xa')](_0x577b('0x9'),_0x577b('0x3'),_0x9536b,_0x5da10a['error'][_0x577b('0xb')],_0x195f10);return _0x4eb7c5(_0x5da10a[_0x577b('0xa')][_0x577b('0xb')]);}else{return _0x1fe377(_0x5da10a[_0x577b('0xc')]);}})[_0x577b('0xd')](function(_0x2aaaa5){logger[_0x577b('0xa')](_0x577b('0x9'),_0x577b('0x3'),_0x9536b,_0x2aaaa5,_0x195f10);return _0x4eb7c5(_0x2aaaa5);});});};module[_0x577b('0xe')]=client; \ No newline at end of file +var _0x3869=['exports','jayson/promise','../../config/logger','routing','client','http','Request','request','debug','rpc','error','message'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3869,0x18d));var _0x9386=function(_0x17447b,_0x221931){_0x17447b=_0x17447b-0x0;var _0x11f89d=_0x3869[_0x17447b];return _0x11f89d;};'use strict';var jayson=require(_0x9386('0x0'));var BPromise=require('bluebird');var logger=require(_0x9386('0x1'))(_0x9386('0x2'));var client=jayson[_0x9386('0x3')][_0x9386('0x4')]({'port':0x2329});client[_0x9386('0x5')]=function(_0x29f5cf,_0x598b7e){return new BPromise(function(_0x2dc08d,_0x246c72){return client[_0x9386('0x6')](_0x29f5cf,_0x598b7e)['then'](function(_0xa2fff2){logger[_0x9386('0x7')](_0x9386('0x8'),_0x9386('0x2'),_0x29f5cf,_0x598b7e,_0xa2fff2);if(_0xa2fff2[_0x9386('0x9')]){logger[_0x9386('0x9')]('rpc',_0x9386('0x2'),_0x29f5cf,_0xa2fff2['error'][_0x9386('0xa')],_0x598b7e);return _0x246c72(_0xa2fff2[_0x9386('0x9')][_0x9386('0xa')]);}else{return _0x2dc08d(_0xa2fff2['result']);}})['catch'](function(_0x4c2453){logger[_0x9386('0x9')](_0x9386('0x8'),_0x9386('0x2'),_0x29f5cf,_0x4c2453,_0x598b7e);return _0x246c72(_0x4c2453);});});};module[_0x9386('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index b6aaf91..4d6e4e0 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 _0x51ad=['then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve'];(function(_0x3cfad3,_0x359b0e){var _0x17977c=function(_0x16b757){while(--_0x16b757){_0x3cfad3['push'](_0x3cfad3['shift']());}};_0x17977c(++_0x359b0e);}(_0x51ad,0x161));var _0xd51a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x51ad[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0xd51a('0x0'));var server=require(_0xd51a('0x1'));var Realtime=require(_0xd51a('0x2'));var user=require(_0xd51a('0x3'));var interval=require(_0xd51a('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xd51a('0x5'));var smsQueue=require(_0xd51a('0x6'));var mailQueue=require(_0xd51a('0x7'));var faxQueue=require(_0xd51a('0x8'));var whatsappQueue=require(_0xd51a('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xd51a('0xa')]()[_0xd51a('0xb')](user[_0xd51a('0xc')]())[_0xd51a('0xb')](realtime[_0xd51a('0xd')]())['then'](interval[_0xd51a('0xe')]())[_0xd51a('0xb')](realtime[_0xd51a('0xf')]())['then'](openchannelQueue[_0xd51a('0x10')]())[_0xd51a('0xb')](realtime[_0xd51a('0x11')]())[_0xd51a('0xb')](chatQueue['getChatQueues']())[_0xd51a('0xb')](realtime[_0xd51a('0x12')]())['then'](smsQueue['getSmsQueues']())[_0xd51a('0xb')](realtime['initSmsQueues']())['then'](mailQueue[_0xd51a('0x13')]())[_0xd51a('0xb')](realtime[_0xd51a('0x14')]())[_0xd51a('0xb')](faxQueue[_0xd51a('0x15')]())[_0xd51a('0xb')](realtime['initFaxQueues']())[_0xd51a('0xb')](whatsappQueue['getWhatsappQueues']())[_0xd51a('0xb')](realtime[_0xd51a('0x16')]())[_0xd51a('0xb')](function(){return realtime;});}function main(){return server[_0xd51a('0x17')](realtime)[_0xd51a('0xb')](function(_0x1b6a23){return initRealtime();})[_0xd51a('0xb')](function(_0x7cfd1f){return setInterval(initRealtime,0x1388);})[_0xd51a('0x18')](function(_0x2a0f1b){console[_0xd51a('0x19')](_0x2a0f1b);});}main(); \ No newline at end of file +var _0x7603=['./rpc/chatQueue','./rpc/smsQueue','./rpc/whatsappQueue','resolve','then','getAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue'];(function(_0x2f2e47,_0x49419e){var _0x193fa5=function(_0x36614f){while(--_0x36614f){_0x2f2e47['push'](_0x2f2e47['shift']());}};_0x193fa5(++_0x49419e);}(_0x7603,0x1bd));var _0x3760=function(_0x23001e,_0x1ffa81){_0x23001e=_0x23001e-0x0;var _0x1abbbd=_0x7603[_0x23001e];return _0x1abbbd;};'use strict';var BPromise=require(_0x3760('0x0'));var server=require('./server');var Realtime=require(_0x3760('0x1'));var user=require(_0x3760('0x2'));var interval=require(_0x3760('0x3'));var openchannelQueue=require(_0x3760('0x4'));var chatQueue=require(_0x3760('0x5'));var smsQueue=require(_0x3760('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x3760('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x3760('0x8')]()[_0x3760('0x9')](user[_0x3760('0xa')]())[_0x3760('0x9')](realtime['initAgents']())[_0x3760('0x9')](interval['getIntervals']())[_0x3760('0x9')](realtime[_0x3760('0xb')]())['then'](openchannelQueue[_0x3760('0xc')]())[_0x3760('0x9')](realtime[_0x3760('0xd')]())['then'](chatQueue['getChatQueues']())[_0x3760('0x9')](realtime['initChatQueues']())[_0x3760('0x9')](smsQueue[_0x3760('0xe')]())[_0x3760('0x9')](realtime[_0x3760('0xf')]())[_0x3760('0x9')](mailQueue[_0x3760('0x10')]())['then'](realtime[_0x3760('0x11')]())[_0x3760('0x9')](faxQueue[_0x3760('0x12')]())[_0x3760('0x9')](realtime[_0x3760('0x13')]())['then'](whatsappQueue[_0x3760('0x14')]())[_0x3760('0x9')](realtime[_0x3760('0x15')]())[_0x3760('0x9')](function(){return realtime;});}function main(){return server[_0x3760('0x16')](realtime)[_0x3760('0x9')](function(_0x1ee0e5){return initRealtime();})[_0x3760('0x9')](function(_0x149d51){return setInterval(initRealtime,0x1388);})[_0x3760('0x17')](function(_0x25992b){console[_0x3760('0x18')](_0x25992b);});}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 116249a..7267459 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(_0x23ab07,_0x2d2848){var _0x2396f1=function(_0x222612){while(--_0x222612){_0x23ab07['push'](_0x23ab07['shift']());}};_0x2396f1(++_0x2d2848);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'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 _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x1d5458,_0x3acf09){var _0x9bf6f=function(_0x8d948c){while(--_0x8d948c){_0x1d5458['push'](_0x1d5458['shift']());}};_0x9bf6f(++_0x3acf09);}(_0x326f,0xd1));var _0xf326=function(_0x42e7d1,_0x1b73d0){_0x42e7d1=_0x42e7d1-0x0;var _0x3db3ff=_0x326f[_0x42e7d1];return _0x3db3ff;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 2920e52..3c3f192 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 _0x510c=['request','then','error','message','catch','sendMailMessage','SendMail','bluebird','http'];(function(_0x59dc02,_0x120477){var _0x556178=function(_0x583273){while(--_0x583273){_0x59dc02['push'](_0x59dc02['shift']());}};_0x556178(++_0x120477);}(_0x510c,0x181));var _0xc510=function(_0x8ee164,_0x157434){_0x8ee164=_0x8ee164-0x0;var _0x56b5aa=_0x510c[_0x8ee164];return _0x56b5aa;};'use strict';var BPromise=require(_0xc510('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc510('0x1')]({'port':0x232b});function request(_0x353d90,_0x37168c){return new BPromise(function(_0x1effe5,_0x16dc48){return client[_0xc510('0x2')](_0x353d90,_0x37168c)[_0xc510('0x3')](function(_0x1c479e){if(_0x1c479e[_0xc510('0x4')]){return _0x16dc48(_0x1c479e[_0xc510('0x4')][_0xc510('0x5')]);}else{return _0x1effe5(_0x1c479e['result']);}})[_0xc510('0x6')](function(_0x519139){return _0x16dc48(_0x519139);});});}exports[_0xc510('0x7')]=function(_0x1e6b78,_0x5782fe){return request(_0xc510('0x8'),{'account':_0x1e6b78,'message':_0x5782fe});}; \ No newline at end of file +var _0x1c5c=['error','message','catch','SendMail','bluebird','jayson/promise','http','request','then'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x1c5c,0x109));var _0xc1c5=function(_0x325878,_0x35bfe4){_0x325878=_0x325878-0x0;var _0x28aa3d=_0x1c5c[_0x325878];return _0x28aa3d;};'use strict';var BPromise=require(_0xc1c5('0x0'));var jayson=require(_0xc1c5('0x1'));var client=jayson['client'][_0xc1c5('0x2')]({'port':0x232b});function request(_0x505643,_0x54b236){return new BPromise(function(_0x85b219,_0x38f49d){return client[_0xc1c5('0x3')](_0x505643,_0x54b236)[_0xc1c5('0x4')](function(_0x3bcb1d){if(_0x3bcb1d[_0xc1c5('0x5')]){return _0x38f49d(_0x3bcb1d[_0xc1c5('0x5')][_0xc1c5('0x6')]);}else{return _0x85b219(_0x3bcb1d['result']);}})[_0xc1c5('0x7')](function(_0x98c6f9){return _0x38f49d(_0x98c6f9);});});}exports['sendMailMessage']=function(_0x5f0c1d,_0x58b63a){return request(_0xc1c5('0x8'),{'account':_0x5f0c1d,'message':_0x58b63a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 5b59e1b..a80fb3d 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 _0x77d4=['toNumber','chatPause','chatStatusTime','chatCurrentCapacity','mailStatus','faxStatus','whatsappStatusTime','openchannelCurrentCapacity','stringify','user:routing:update','omit','exports','md5','ioredis','redis','defaults','socket.io-emitter','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','maxcapacity','working','idle','mail','chat','sms','whatsapp','Status','StatusTime'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x77d4,0x108));var _0x477d=function(_0x5e163f,_0x5343c8){_0x5e163f=_0x5e163f-0x0;var _0x282a35=_0x77d4[_0x5e163f];return _0x282a35;};'use strict';var _=require('lodash');var md5=require(_0x477d('0x0'));var moment=require('moment');var Redis=require(_0x477d('0x1'));var config=require('../../../config/environment');config[_0x477d('0x2')]=_[_0x477d('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x477d('0x4'))(new Redis(config[_0x477d('0x2')]));function Agent(_0x3d2f8d){this['id']=_0x3d2f8d['id']||0x0;this[_0x477d('0x5')]=_0x3d2f8d[_0x477d('0x5')]||'';this[_0x477d('0x6')]=_0x3d2f8d['online']||!![];this['voicePause']=_0x3d2f8d[_0x477d('0x7')]||![];this['chatPause']=_0x3d2f8d['chatPause']||![];this[_0x477d('0x8')]=_0x3d2f8d[_0x477d('0x8')]||![];this[_0x477d('0x9')]=_0x3d2f8d[_0x477d('0x9')]||![];this[_0x477d('0xa')]=_0x3d2f8d['smsPause']||![];this[_0x477d('0xb')]=_0x3d2f8d['openchannelPause']||![];this[_0x477d('0xc')]=_0x477d('0xd');this['chatStatusTime']=0x0;this[_0x477d('0xe')]=_0x3d2f8d[_0x477d('0xe')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x477d('0xd');this[_0x477d('0xf')]=0x0;this['mailCapacity']=_0x3d2f8d[_0x477d('0x10')]||0x0;this[_0x477d('0x11')]=0x0;this['faxStatus']='unknown';this[_0x477d('0x12')]=0x0;this['faxCapacity']=_0x3d2f8d[_0x477d('0x13')]||0x0;this[_0x477d('0x14')]=0x0;this[_0x477d('0x15')]='unknown';this[_0x477d('0x16')]=0x0;this[_0x477d('0x17')]=_0x3d2f8d[_0x477d('0x17')]||0x0;this[_0x477d('0x18')]=0x0;this['whatsappStatus']=_0x477d('0xd');this['whatsappStatusTime']=0x0;this[_0x477d('0x19')]=_0x3d2f8d[_0x477d('0x19')]||0x0;this[_0x477d('0x1a')]=0x0;this[_0x477d('0x1b')]=_0x477d('0xd');this[_0x477d('0x1c')]=0x0;this['openchannelCapacity']=_0x3d2f8d[_0x477d('0x1d')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x477d('0x1e')]=![];this[_0x477d('0x1f')]=undefined;this[_0x477d('0x0')]='';this[_0x477d('0x20')]={};this[_0x477d('0x21')]={};this[_0x477d('0x22')]={};this[_0x477d('0x23')]={};this[_0x477d('0x24')]={};this[_0x477d('0x25')]={};this[_0x477d('0x26')]();}Agent[_0x477d('0x27')][_0x477d('0x28')]=function(_0x43c845){if(this[_0x43c845+_0x477d('0x29')]>0x0){if(this[_0x43c845+'Capacity']>0x0&&this[_0x43c845+_0x477d('0x29')]>=this[_0x43c845+'Capacity']){return _0x477d('0x2a');}else{return _0x477d('0x2b');}}else{return _0x477d('0x2c');}};Agent[_0x477d('0x27')]['updateRealtime']=function(){var _0xd6dca5=[_0x477d('0x2d'),_0x477d('0x2e'),'openchannel','fax',_0x477d('0x2f'),_0x477d('0x30')];for(var _0x386df5=0x0;_0x386df5<_0xd6dca5['length'];_0x386df5+=0x1){var _0x254141=this[_0x477d('0x28')](_0xd6dca5[_0x386df5]);if(this[_0xd6dca5[_0x386df5]+_0x477d('0x31')]!==_0x254141){this[_0xd6dca5[_0x386df5]+_0x477d('0x32')]=_[_0x477d('0x33')](moment()['format']('x'));}this[_0xd6dca5[_0x386df5]+_0x477d('0x31')]=_0x254141;}var _0xeb02f5={'id':this['id'],'name':this[_0x477d('0x5')],'online':this[_0x477d('0x6')],'voicePause':this[_0x477d('0x7')],'chatPause':this[_0x477d('0x34')],'mailPause':this[_0x477d('0x8')],'smsPause':this[_0x477d('0xa')],'faxPause':this[_0x477d('0x9')],'openchannelPause':this[_0x477d('0xb')],'chatStatus':this[_0x477d('0xc')],'chatStatusTime':this[_0x477d('0x35')],'chatCapacity':this[_0x477d('0xe')],'chatCurrentCapacity':this[_0x477d('0x36')],'mailStatus':this[_0x477d('0x37')],'mailStatusTime':this[_0x477d('0xf')],'mailCapacity':this[_0x477d('0x10')],'mailCurrentCapacity':this[_0x477d('0x11')],'faxStatus':this[_0x477d('0x38')],'faxStatusTime':this[_0x477d('0x12')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x477d('0x14')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x477d('0x16')],'smsCapacity':this[_0x477d('0x17')],'smsCurrentCapacity':this[_0x477d('0x18')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x477d('0x39')],'whatsappCapacity':this[_0x477d('0x19')],'whatsappCurrentCapacity':this[_0x477d('0x1a')],'openchannelStatus':this[_0x477d('0x1b')],'openchannelStatusTime':this[_0x477d('0x1c')],'openchannelCapacity':this[_0x477d('0x1d')],'openchannelCurrentCapacity':this[_0x477d('0x3a')],'busy':this[_0x477d('0x1e')],'busyQueue':this[_0x477d('0x1f')],'chatWaitingInteractions':this[_0x477d('0x20')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x477d('0x22')],'openchannelWaitingInteractions':this[_0x477d('0x23')],'smsWaitingInteractions':this[_0x477d('0x24')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x50b3f7=md5(JSON[_0x477d('0x3b')](_0xeb02f5));if(this[_0x477d('0x0')]!==_0x50b3f7){this['md5']=_0x50b3f7;io['emit'](_0x477d('0x3c'),_[_0x477d('0x3d')](_0xeb02f5,[_0x477d('0x6')]));}};module[_0x477d('0x3e')]=Agent; \ No newline at end of file +var _0xfcf0=['smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','maxcapacity','working','idle','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','chatStatusTime','mailStatus','faxStatus','openchannelStatus','openchannelCurrentCapacity','emit','user:routing:update','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime'];(function(_0x97dcee,_0x462175){var _0x500a85=function(_0x1e8f69){while(--_0x1e8f69){_0x97dcee['push'](_0x97dcee['shift']());}};_0x500a85(++_0x462175);}(_0xfcf0,0x138));var _0x0fcf=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0xfcf0[_0x4ded65];return _0x5864fb;};'use strict';var _=require(_0x0fcf('0x0'));var md5=require(_0x0fcf('0x1'));var moment=require('moment');var Redis=require(_0x0fcf('0x2'));var config=require(_0x0fcf('0x3'));config[_0x0fcf('0x4')]=_[_0x0fcf('0x5')](config['redis'],{'host':_0x0fcf('0x6'),'port':0x18eb});var io=require(_0x0fcf('0x7'))(new Redis(config[_0x0fcf('0x4')]));function Agent(_0x3af316){this['id']=_0x3af316['id']||0x0;this[_0x0fcf('0x8')]=_0x3af316[_0x0fcf('0x8')]||'';this[_0x0fcf('0x9')]=_0x3af316[_0x0fcf('0x9')]||!![];this['voicePause']=_0x3af316[_0x0fcf('0xa')]||![];this[_0x0fcf('0xb')]=_0x3af316[_0x0fcf('0xb')]||![];this['mailPause']=_0x3af316[_0x0fcf('0xc')]||![];this[_0x0fcf('0xd')]=_0x3af316[_0x0fcf('0xd')]||![];this['smsPause']=_0x3af316[_0x0fcf('0xe')]||![];this['openchannelPause']=_0x3af316[_0x0fcf('0xf')]||![];this[_0x0fcf('0x10')]=_0x0fcf('0x11');this['chatStatusTime']=0x0;this['chatCapacity']=_0x3af316[_0x0fcf('0x12')]||0x0;this[_0x0fcf('0x13')]=0x0;this['mailStatus']=_0x0fcf('0x11');this[_0x0fcf('0x14')]=0x0;this[_0x0fcf('0x15')]=_0x3af316[_0x0fcf('0x15')]||0x0;this[_0x0fcf('0x16')]=0x0;this['faxStatus']=_0x0fcf('0x11');this[_0x0fcf('0x17')]=0x0;this[_0x0fcf('0x18')]=_0x3af316['faxCapacity']||0x0;this[_0x0fcf('0x19')]=0x0;this[_0x0fcf('0x1a')]=_0x0fcf('0x11');this[_0x0fcf('0x1b')]=0x0;this['smsCapacity']=_0x3af316[_0x0fcf('0x1c')]||0x0;this[_0x0fcf('0x1d')]=0x0;this[_0x0fcf('0x1e')]=_0x0fcf('0x11');this[_0x0fcf('0x1f')]=0x0;this['whatsappCapacity']=_0x3af316[_0x0fcf('0x20')]||0x0;this[_0x0fcf('0x21')]=0x0;this['openchannelStatus']=_0x0fcf('0x11');this[_0x0fcf('0x22')]=0x0;this['openchannelCapacity']=_0x3af316[_0x0fcf('0x23')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x0fcf('0x24')]=![];this[_0x0fcf('0x25')]=undefined;this['md5']='';this[_0x0fcf('0x26')]={};this[_0x0fcf('0x27')]={};this[_0x0fcf('0x28')]={};this['openchannelWaitingInteractions']={};this[_0x0fcf('0x29')]={};this[_0x0fcf('0x2a')]={};this[_0x0fcf('0x2b')]();}Agent[_0x0fcf('0x2c')][_0x0fcf('0x2d')]=function(_0x30e1b0){if(this[_0x30e1b0+'CurrentCapacity']>0x0){if(this[_0x30e1b0+_0x0fcf('0x2e')]>0x0&&this[_0x30e1b0+_0x0fcf('0x2f')]>=this[_0x30e1b0+_0x0fcf('0x2e')]){return _0x0fcf('0x30');}else{return _0x0fcf('0x31');}}else{return _0x0fcf('0x32');}};Agent[_0x0fcf('0x2c')][_0x0fcf('0x2b')]=function(){var _0x117510=['mail',_0x0fcf('0x33'),_0x0fcf('0x34'),_0x0fcf('0x35'),_0x0fcf('0x36'),_0x0fcf('0x37')];for(var _0x38fe0e=0x0;_0x38fe0e<_0x117510[_0x0fcf('0x38')];_0x38fe0e+=0x1){var _0x527d43=this[_0x0fcf('0x2d')](_0x117510[_0x38fe0e]);if(this[_0x117510[_0x38fe0e]+_0x0fcf('0x39')]!==_0x527d43){this[_0x117510[_0x38fe0e]+_0x0fcf('0x3a')]=_[_0x0fcf('0x3b')](moment()['format']('x'));}this[_0x117510[_0x38fe0e]+'Status']=_0x527d43;}var _0x4af80d={'id':this['id'],'name':this[_0x0fcf('0x8')],'online':this['online'],'voicePause':this[_0x0fcf('0xa')],'chatPause':this[_0x0fcf('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0x0fcf('0xe')],'faxPause':this[_0x0fcf('0xd')],'openchannelPause':this[_0x0fcf('0xf')],'chatStatus':this[_0x0fcf('0x10')],'chatStatusTime':this[_0x0fcf('0x3c')],'chatCapacity':this[_0x0fcf('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x0fcf('0x3d')],'mailStatusTime':this[_0x0fcf('0x14')],'mailCapacity':this[_0x0fcf('0x15')],'mailCurrentCapacity':this[_0x0fcf('0x16')],'faxStatus':this[_0x0fcf('0x3e')],'faxStatusTime':this[_0x0fcf('0x17')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x0fcf('0x19')],'smsStatus':this[_0x0fcf('0x1a')],'smsStatusTime':this[_0x0fcf('0x1b')],'smsCapacity':this[_0x0fcf('0x1c')],'smsCurrentCapacity':this[_0x0fcf('0x1d')],'whatsappStatus':this[_0x0fcf('0x1e')],'whatsappStatusTime':this[_0x0fcf('0x1f')],'whatsappCapacity':this[_0x0fcf('0x20')],'whatsappCurrentCapacity':this[_0x0fcf('0x21')],'openchannelStatus':this[_0x0fcf('0x3f')],'openchannelStatusTime':this[_0x0fcf('0x22')],'openchannelCapacity':this[_0x0fcf('0x23')],'openchannelCurrentCapacity':this[_0x0fcf('0x40')],'busy':this[_0x0fcf('0x24')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x0fcf('0x27')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x0fcf('0x29')],'whatsappWaitingInteractions':this[_0x0fcf('0x2a')]};var _0x3721ab=md5(JSON['stringify'](_0x4af80d));if(this['md5']!==_0x3721ab){this[_0x0fcf('0x1')]=_0x3721ab;io[_0x0fcf('0x41')](_0x0fcf('0x42'),_['omit'](_0x4af80d,[_0x0fcf('0x9')]));}};module[_0x0fcf('0x43')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index fb8c677..48ca8e6 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 _0x2c7d=['beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','paused','length','online','loggedIn','available','format','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','name','timeout','strategy'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x2c7d,0x198));var _0xd2c7=function(_0x59c015,_0x47cde5){_0x59c015=_0x59c015-0x0;var _0x40c234=_0x2c7d[_0x59c015];return _0x40c234;};'use strict';var _=require(_0xd2c7('0x0'));var md5=require('md5');var util=require(_0xd2c7('0x1'));var Redis=require(_0xd2c7('0x2'));var config=require(_0xd2c7('0x3'));config[_0xd2c7('0x4')]=_['defaults'](config[_0xd2c7('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd2c7('0x4')]));function ChatQueue(_0x29e4e2){this['id']=_0x29e4e2['id']||0x0;this[_0xd2c7('0x5')]=_0x29e4e2['name']||'';this['timeout']=_0x29e4e2[_0xd2c7('0x6')]||0xa;this[_0xd2c7('0x7')]=_0x29e4e2['strategy']||_0xd2c7('0x8');this[_0xd2c7('0x9')]=_0x29e4e2[_0xd2c7('0x9')];this['mapAgentsId']={};this[_0xd2c7('0xa')]=0x0;this[_0xd2c7('0xb')]='';this[_0xd2c7('0xc')]();this[_0xd2c7('0xd')]();}ChatQueue[_0xd2c7('0xe')][_0xd2c7('0xc')]=function(){var _0x9b91bb=this[_0xd2c7('0xf')][_0xd2c7('0x10')];this['mapAgentsId']=_['map'](this[_0xd2c7('0x9')],'id');this[_0xd2c7('0xf')][_0xd2c7('0x10')]=_0x9b91bb;};ChatQueue[_0xd2c7('0xe')][_0xd2c7('0xd')]=function(){this['loggedIn']=0x0;this[_0xd2c7('0x11')]=0x0;for(var _0x1db3ab=0x0;_0x1db3ab=0x0?this[_0xd2c7('0x15')]:0x0;var _0x36e2a5={'id':this['id'],'available':this[_0xd2c7('0x15')],'loggedIn':this[_0xd2c7('0x14')],'name':this[_0xd2c7('0x5')],'paused':this[_0xd2c7('0x11')],'waiting':this[_0xd2c7('0xa')]};var _0x467b35=md5(JSON['stringify'](_0x36e2a5));if(this[_0xd2c7('0xb')]!==_0x467b35){this[_0xd2c7('0xb')]=_0x467b35;io['to'](util[_0xd2c7('0x16')]('chat:queue:%s',_0x36e2a5[_0xd2c7('0x5')]))[_0xd2c7('0x17')](_0xd2c7('0x18'),_0x36e2a5);}};module[_0xd2c7('0x19')]=ChatQueue; \ No newline at end of file +var _0x881e=['loggedIn','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','paused','length','online'];(function(_0x4ff2df,_0x339368){var _0x17297d=function(_0xc956df){while(--_0xc956df){_0x4ff2df['push'](_0x4ff2df['shift']());}};_0x17297d(++_0x339368);}(_0x881e,0x175));var _0xe881=function(_0x1c30d6,_0xffa7d9){_0x1c30d6=_0x1c30d6-0x0;var _0x51c7c6=_0x881e[_0x1c30d6];return _0x51c7c6;};'use strict';var _=require(_0xe881('0x0'));var md5=require(_0xe881('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xe881('0x2'));config[_0xe881('0x3')]=_[_0xe881('0x4')](config[_0xe881('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xe881('0x5'))(new Redis(config[_0xe881('0x3')]));function ChatQueue(_0x30afd1){this['id']=_0x30afd1['id']||0x0;this[_0xe881('0x6')]=_0x30afd1['name']||'';this['timeout']=_0x30afd1[_0xe881('0x7')]||0xa;this[_0xe881('0x8')]=_0x30afd1['strategy']||_0xe881('0x9');this[_0xe881('0xa')]=_0x30afd1['Agents'];this[_0xe881('0xb')]={};this[_0xe881('0xc')]=0x0;this[_0xe881('0x1')]='';this[_0xe881('0xd')]();this[_0xe881('0xe')]();}ChatQueue['prototype'][_0xe881('0xd')]=function(){var _0xf2fd6d=this['mapAgentsId'][_0xe881('0xf')];this[_0xe881('0xb')]=_['map'](this[_0xe881('0xa')],'id');this['mapAgentsId'][_0xe881('0xf')]=_0xf2fd6d;};ChatQueue['prototype'][_0xe881('0xe')]=function(){this['loggedIn']=0x0;this[_0xe881('0x10')]=0x0;for(var _0x1ac239=0x0;_0x1ac239=0x0?this['available']:0x0;var _0x4facee={'id':this['id'],'available':this[_0xe881('0x15')],'loggedIn':this[_0xe881('0x13')],'name':this['name'],'paused':this[_0xe881('0x10')],'waiting':this['waiting']};var _0x223110=md5(JSON[_0xe881('0x16')](_0x4facee));if(this[_0xe881('0x1')]!==_0x223110){this['md5']=_0x223110;io['to'](util[_0xe881('0x17')](_0xe881('0x18'),_0x4facee[_0xe881('0x6')]))[_0xe881('0x19')](_0xe881('0x1a'),_0x4facee);}};module[_0xe881('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 05b379c..03abcb3 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 _0x923b=['waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','available','stringify','fax:queue:%s','emit','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x923b,0x83));var _0xb923=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x923b[_0x15ca1a];return _0x507626;};'use strict';var _=require(_0xb923('0x0'));var md5=require(_0xb923('0x1'));var util=require(_0xb923('0x2'));var Redis=require(_0xb923('0x3'));var config=require('../../../config/environment');config[_0xb923('0x4')]=_[_0xb923('0x5')](config[_0xb923('0x4')],{'host':_0xb923('0x6'),'port':0x18eb});var io=require(_0xb923('0x7'))(new Redis(config[_0xb923('0x4')]));function FaxQueue(_0xf78f30){this['id']=_0xf78f30['id']||0x0;this[_0xb923('0x8')]=_0xf78f30['name']||'';this[_0xb923('0x9')]=_0xf78f30[_0xb923('0x9')]||0xa;this[_0xb923('0xa')]=_0xf78f30[_0xb923('0xa')]||_0xb923('0xb');this['Agents']=_0xf78f30[_0xb923('0xc')];this[_0xb923('0xd')]={};this[_0xb923('0xe')]=0x0;this['md5']='';this[_0xb923('0xf')]();this[_0xb923('0x10')]();}FaxQueue['prototype'][_0xb923('0xf')]=function(){var _0x478a7c=this[_0xb923('0xd')][_0xb923('0x11')];this[_0xb923('0xd')]=_[_0xb923('0x12')](this[_0xb923('0xc')],'id');this[_0xb923('0xd')][_0xb923('0x11')]=_0x478a7c;};FaxQueue[_0xb923('0x13')][_0xb923('0x10')]=function(){this[_0xb923('0x14')]=0x0;this[_0xb923('0x15')]=0x0;for(var _0x576664=0x0;_0x576664=0x0?this[_0xb923('0x18')]:0x0;var _0x629b05={'id':this['id'],'available':this[_0xb923('0x18')],'loggedIn':this[_0xb923('0x14')],'name':this[_0xb923('0x8')],'paused':this['paused'],'waiting':this[_0xb923('0xe')]};var _0x3a8118=md5(JSON[_0xb923('0x19')](_0x629b05));if(this[_0xb923('0x1')]!==_0x3a8118){this['md5']=_0x3a8118;io['to'](util['format'](_0xb923('0x1a'),_0x629b05[_0xb923('0x8')]))[_0xb923('0x1b')]('fax_queue:save',_0x629b05);}};module[_0xb923('0x1c')]=FaxQueue; \ No newline at end of file +var _0x3aa0=['paused','length','available','format','fax:queue:%s','emit','fax_queue:save','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn'];(function(_0x4df49a,_0x3c4d66){var _0x2711ff=function(_0x26d964){while(--_0x26d964){_0x4df49a['push'](_0x4df49a['shift']());}};_0x2711ff(++_0x3c4d66);}(_0x3aa0,0x115));var _0x03aa=function(_0x23f6f5,_0x1f5a7d){_0x23f6f5=_0x23f6f5-0x0;var _0x517fd7=_0x3aa0[_0x23f6f5];return _0x517fd7;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x03aa('0x0'));var Redis=require(_0x03aa('0x1'));var config=require(_0x03aa('0x2'));config[_0x03aa('0x3')]=_[_0x03aa('0x4')](config[_0x03aa('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x03aa('0x5'))(new Redis(config[_0x03aa('0x3')]));function FaxQueue(_0x512be1){this['id']=_0x512be1['id']||0x0;this['name']=_0x512be1[_0x03aa('0x6')]||'';this['timeout']=_0x512be1[_0x03aa('0x7')]||0xa;this['strategy']=_0x512be1[_0x03aa('0x8')]||_0x03aa('0x9');this[_0x03aa('0xa')]=_0x512be1[_0x03aa('0xa')];this[_0x03aa('0xb')]={};this[_0x03aa('0xc')]=0x0;this[_0x03aa('0xd')]='';this[_0x03aa('0xe')]();this[_0x03aa('0xf')]();}FaxQueue[_0x03aa('0x10')][_0x03aa('0xe')]=function(){var _0x2edfe5=this['mapAgentsId'][_0x03aa('0x11')];this[_0x03aa('0xb')]=_[_0x03aa('0x12')](this[_0x03aa('0xa')],'id');this[_0x03aa('0xb')][_0x03aa('0x11')]=_0x2edfe5;};FaxQueue[_0x03aa('0x10')][_0x03aa('0xf')]=function(){this[_0x03aa('0x13')]=0x0;this[_0x03aa('0x14')]=0x0;for(var _0x24454b=0x0;_0x24454b=0x0?this[_0x03aa('0x16')]:0x0;var _0x2bac43={'id':this['id'],'available':this[_0x03aa('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x03aa('0x14')],'waiting':this[_0x03aa('0xc')]};var _0xfa40fe=md5(JSON['stringify'](_0x2bac43));if(this[_0x03aa('0xd')]!==_0xfa40fe){this[_0x03aa('0xd')]=_0xfa40fe;io['to'](util[_0x03aa('0x17')](_0x03aa('0x18'),_0x2bac43['name']))[_0x03aa('0x19')](_0x03aa('0x1a'),_0x2bac43);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index db9a3da..0980e49 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 _0x45da=['name','Intervals','exports'];(function(_0x183534,_0xac3e09){var _0x459384=function(_0x4bbcc5){while(--_0x4bbcc5){_0x183534['push'](_0x183534['shift']());}};_0x459384(++_0xac3e09);}(_0x45da,0x132));var _0xa45d=function(_0x283c81,_0xcc39d1){_0x283c81=_0x283c81-0x0;var _0xdc8b07=_0x45da[_0x283c81];return _0xdc8b07;};'use strict';function Interval(_0x713ec6){this['id']=_0x713ec6['id']||0x0;this[_0xa45d('0x0')]=_0x713ec6[_0xa45d('0x0')]||'';this[_0xa45d('0x1')]=_0x713ec6['Intervals']||{};}module[_0xa45d('0x2')]=Interval; \ No newline at end of file +var _0x3eb8=['exports','name','Intervals'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x3eb8,0x67));var _0x83eb=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x3eb8[_0x1203f];return _0x365f0a;};'use strict';function Interval(_0x2b7edd){this['id']=_0x2b7edd['id']||0x0;this[_0x83eb('0x0')]=_0x2b7edd[_0x83eb('0x0')]||'';this[_0x83eb('0x1')]=_0x2b7edd[_0x83eb('0x1')]||{};}module[_0x83eb('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 273da5c..683e996 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 _0xc136=['socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','available','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xc136,0x110));var _0x6c13=function(_0x23f302,_0xf2e57c){_0x23f302=_0x23f302-0x0;var _0x4df716=_0xc136[_0x23f302];return _0x4df716;};'use strict';var _=require(_0x6c13('0x0'));var md5=require(_0x6c13('0x1'));var util=require(_0x6c13('0x2'));var Redis=require(_0x6c13('0x3'));var config=require(_0x6c13('0x4'));config[_0x6c13('0x5')]=_[_0x6c13('0x6')](config['redis'],{'host':_0x6c13('0x7'),'port':0x18eb});var io=require(_0x6c13('0x8'))(new Redis(config['redis']));function MailQueue(_0x35ea15){this['id']=_0x35ea15['id']||0x0;this[_0x6c13('0x9')]=_0x35ea15[_0x6c13('0x9')]||'';this['timeout']=_0x35ea15['timeout']||0xa;this[_0x6c13('0xa')]=_0x35ea15[_0x6c13('0xa')]||_0x6c13('0xb');this[_0x6c13('0xc')]=_0x35ea15['Agents'];this[_0x6c13('0xd')]={};this[_0x6c13('0xe')]=0x0;this[_0x6c13('0x1')]='';this[_0x6c13('0xf')]();this['updateRealtime']();}MailQueue[_0x6c13('0x10')][_0x6c13('0xf')]=function(){var _0x9c2f1a=this[_0x6c13('0xd')][_0x6c13('0x11')];this[_0x6c13('0xd')]=_[_0x6c13('0x12')](this[_0x6c13('0xc')],'id');this[_0x6c13('0xd')][_0x6c13('0x11')]=_0x9c2f1a;};MailQueue[_0x6c13('0x10')][_0x6c13('0x13')]=function(){this[_0x6c13('0x14')]=0x0;this[_0x6c13('0x15')]=0x0;for(var _0x53aee7=0x0;_0x53aee7=0x0?this[_0x6c13('0x18')]:0x0;var _0xff6235={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6c13('0x14')],'name':this[_0x6c13('0x9')],'paused':this[_0x6c13('0x15')],'waiting':this['waiting']};var _0x48c006=md5(JSON['stringify'](_0xff6235));if(this[_0x6c13('0x1')]!==_0x48c006){this['md5']=_0x48c006;io['to'](util['format']('mail:queue:%s',_0xff6235[_0x6c13('0x9')]))[_0x6c13('0x19')](_0x6c13('0x1a'),_0xff6235);}};module[_0x6c13('0x1b')]=MailQueue; \ No newline at end of file +var _0xcabc=['map','prototype','paused','length','online','mailPause','available','loggedIn','format','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr'];(function(_0x1dca34,_0x3fae98){var _0x412385=function(_0x2d8bec){while(--_0x2d8bec){_0x1dca34['push'](_0x1dca34['shift']());}};_0x412385(++_0x3fae98);}(_0xcabc,0x16a));var _0xccab=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xcabc[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var md5=require(_0xccab('0x0'));var util=require(_0xccab('0x1'));var Redis=require(_0xccab('0x2'));var config=require(_0xccab('0x3'));config[_0xccab('0x4')]=_['defaults'](config[_0xccab('0x4')],{'host':_0xccab('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xccab('0x4')]));function MailQueue(_0x316f83){this['id']=_0x316f83['id']||0x0;this[_0xccab('0x6')]=_0x316f83['name']||'';this[_0xccab('0x7')]=_0x316f83[_0xccab('0x7')]||0xa;this[_0xccab('0x8')]=_0x316f83['strategy']||_0xccab('0x9');this[_0xccab('0xa')]=_0x316f83['Agents'];this[_0xccab('0xb')]={};this[_0xccab('0xc')]=0x0;this[_0xccab('0x0')]='';this[_0xccab('0xd')]();this[_0xccab('0xe')]();}MailQueue['prototype']['updateRouting']=function(){var _0x17b729=this[_0xccab('0xb')][_0xccab('0xf')];this[_0xccab('0xb')]=_[_0xccab('0x10')](this[_0xccab('0xa')],'id');this[_0xccab('0xb')]['_rr']=_0x17b729;};MailQueue[_0xccab('0x11')][_0xccab('0xe')]=function(){this['loggedIn']=0x0;this[_0xccab('0x12')]=0x0;for(var _0x4f0643=0x0;_0x4f0643=0x0?this['available']:0x0;var _0x4ba1c2={'id':this['id'],'available':this[_0xccab('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xccab('0x6')],'paused':this[_0xccab('0x12')],'waiting':this[_0xccab('0xc')]};var _0x4ab126=md5(JSON['stringify'](_0x4ba1c2));if(this[_0xccab('0x0')]!==_0x4ab126){this[_0xccab('0x0')]=_0x4ab126;io['to'](util[_0xccab('0x18')]('mail:queue:%s',_0x4ba1c2[_0xccab('0x6')]))['emit'](_0xccab('0x19'),_0x4ba1c2);}};module[_0xccab('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index f6c2821..dde4d67 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 _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(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xc4aa[_0x4792c8];return _0x35edb1;};'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 +var _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x37b1d8,_0x614312){var _0x3739e7=function(_0x15a5bb){while(--_0x15a5bb){_0x37b1d8['push'](_0x37b1d8['shift']());}};_0x3739e7(++_0x614312);}(_0xadb5,0xad));var _0x5adb=function(_0x766cae,_0x14da9a){_0x766cae=_0x766cae-0x0;var _0x418d7e=_0xadb5[_0x766cae];return _0x418d7e;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};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 66e6fa5..0528acc 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 _0x0b78=['socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','emit','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','localhost'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b78,0x1ad));var _0x80b7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0b78[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x80b7('0x0'));var md5=require(_0x80b7('0x1'));var util=require('util');var Redis=require(_0x80b7('0x2'));var config=require(_0x80b7('0x3'));config['redis']=_[_0x80b7('0x4')](config['redis'],{'host':_0x80b7('0x5'),'port':0x18eb});var io=require(_0x80b7('0x6'))(new Redis(config[_0x80b7('0x7')]));function SmsQueue(_0x5d4a96){this['id']=_0x5d4a96['id']||0x0;this['name']=_0x5d4a96[_0x80b7('0x8')]||'';this['timeout']=_0x5d4a96[_0x80b7('0x9')]||0xa;this[_0x80b7('0xa')]=_0x5d4a96[_0x80b7('0xa')]||_0x80b7('0xb');this['Agents']=_0x5d4a96[_0x80b7('0xc')];this[_0x80b7('0xd')]={};this[_0x80b7('0xe')]=0x0;this['md5']='';this[_0x80b7('0xf')]();this['updateRealtime']();}SmsQueue[_0x80b7('0x10')][_0x80b7('0xf')]=function(){var _0x3b19da=this[_0x80b7('0xd')][_0x80b7('0x11')];this[_0x80b7('0xd')]=_[_0x80b7('0x12')](this[_0x80b7('0xc')],'id');this[_0x80b7('0xd')][_0x80b7('0x11')]=_0x3b19da;};SmsQueue[_0x80b7('0x10')]['updateRealtime']=function(){this[_0x80b7('0x13')]=0x0;this[_0x80b7('0x14')]=0x0;for(var _0x527c5b=0x0;_0x527c5b=0x0?this['available']:0x0;var _0x3bb691={'id':this['id'],'available':this[_0x80b7('0x18')],'loggedIn':this[_0x80b7('0x13')],'name':this[_0x80b7('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x45be23=md5(JSON[_0x80b7('0x19')](_0x3bb691));if(this[_0x80b7('0x1')]!==_0x45be23){this[_0x80b7('0x1')]=_0x45be23;io['to'](util['format']('sms:queue:%s',_0x3bb691[_0x80b7('0x8')]))[_0x80b7('0x1a')](_0x80b7('0x1b'),_0x3bb691);}};module[_0x80b7('0x1c')]=SmsQueue; \ No newline at end of file +var _0x0f9f=['prototype','loggedIn','paused','length','online','smsPause','available','waiting','stringify','emit','sms_queue:save','exports','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map'];(function(_0x29ee74,_0x548f68){var _0x708e52=function(_0x3c86dc){while(--_0x3c86dc){_0x29ee74['push'](_0x29ee74['shift']());}};_0x708e52(++_0x548f68);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x2d6d24,_0xaf0aec){_0x2d6d24=_0x2d6d24-0x0;var _0x37607e=_0x0f9f[_0x2d6d24];return _0x37607e;};'use strict';var _=require('lodash');var md5=require(_0xf0f9('0x0'));var util=require(_0xf0f9('0x1'));var Redis=require(_0xf0f9('0x2'));var config=require('../../../config/environment');config[_0xf0f9('0x3')]=_[_0xf0f9('0x4')](config[_0xf0f9('0x3')],{'host':_0xf0f9('0x5'),'port':0x18eb});var io=require(_0xf0f9('0x6'))(new Redis(config[_0xf0f9('0x3')]));function SmsQueue(_0x192d43){this['id']=_0x192d43['id']||0x0;this[_0xf0f9('0x7')]=_0x192d43[_0xf0f9('0x7')]||'';this[_0xf0f9('0x8')]=_0x192d43['timeout']||0xa;this[_0xf0f9('0x9')]=_0x192d43[_0xf0f9('0x9')]||'beepall';this[_0xf0f9('0xa')]=_0x192d43[_0xf0f9('0xa')];this[_0xf0f9('0xb')]={};this['waiting']=0x0;this[_0xf0f9('0x0')]='';this[_0xf0f9('0xc')]();this[_0xf0f9('0xd')]();}SmsQueue['prototype']['updateRouting']=function(){var _0xfd838b=this[_0xf0f9('0xb')][_0xf0f9('0xe')];this[_0xf0f9('0xb')]=_[_0xf0f9('0xf')](this[_0xf0f9('0xa')],'id');this[_0xf0f9('0xb')]['_rr']=_0xfd838b;};SmsQueue[_0xf0f9('0x10')][_0xf0f9('0xd')]=function(){this[_0xf0f9('0x11')]=0x0;this[_0xf0f9('0x12')]=0x0;for(var _0x524169=0x0;_0x524169=0x0?this[_0xf0f9('0x16')]:0x0;var _0x3227cf={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf0f9('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xf0f9('0x17')]};var _0x3d2ef8=md5(JSON[_0xf0f9('0x18')](_0x3227cf));if(this[_0xf0f9('0x0')]!==_0x3d2ef8){this[_0xf0f9('0x0')]=_0x3d2ef8;io['to'](util['format']('sms:queue:%s',_0x3227cf['name']))[_0xf0f9('0x19')](_0xf0f9('0x1a'),_0x3227cf);}};module[_0xf0f9('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index fee840d..34769eb 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 _0xe7f2=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','online','whatsappPause','available','paused','stringify','md5','format','emit','whatsapp_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xe7f2,0x151));var _0x2e7f=function(_0x410506,_0x3410c4){_0x410506=_0x410506-0x0;var _0x5b2230=_0xe7f2[_0x410506];return _0x5b2230;};'use strict';var _=require(_0x2e7f('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x2e7f('0x1'));var config=require(_0x2e7f('0x2'));config[_0x2e7f('0x3')]=_[_0x2e7f('0x4')](config[_0x2e7f('0x3')],{'host':_0x2e7f('0x5'),'port':0x18eb});var io=require(_0x2e7f('0x6'))(new Redis(config[_0x2e7f('0x3')]));function WhatsappQueue(_0x1afea5){this['id']=_0x1afea5['id']||0x0;this[_0x2e7f('0x7')]=_0x1afea5[_0x2e7f('0x7')]||'';this[_0x2e7f('0x8')]=_0x1afea5[_0x2e7f('0x8')]||0xa;this['strategy']=_0x1afea5[_0x2e7f('0x9')]||'beepall';this[_0x2e7f('0xa')]=_0x1afea5[_0x2e7f('0xa')];this[_0x2e7f('0xb')]={};this[_0x2e7f('0xc')]=0x0;this['md5']='';this[_0x2e7f('0xd')]();this[_0x2e7f('0xe')]();}WhatsappQueue[_0x2e7f('0xf')][_0x2e7f('0xd')]=function(){var _0x7c19f8=this[_0x2e7f('0xb')][_0x2e7f('0x10')];this['mapAgentsId']=_[_0x2e7f('0x11')](this[_0x2e7f('0xa')],'id');this[_0x2e7f('0xb')][_0x2e7f('0x10')]=_0x7c19f8;};WhatsappQueue['prototype'][_0x2e7f('0xe')]=function(){this[_0x2e7f('0x12')]=0x0;this['paused']=0x0;for(var _0x26840d=0x0;_0x26840d=0x0?this[_0x2e7f('0x15')]:0x0;var _0x33e904={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2e7f('0x12')],'name':this[_0x2e7f('0x7')],'paused':this[_0x2e7f('0x16')],'waiting':this[_0x2e7f('0xc')]};var _0xdfcf1e=md5(JSON[_0x2e7f('0x17')](_0x33e904));if(this[_0x2e7f('0x18')]!==_0xdfcf1e){this[_0x2e7f('0x18')]=_0xdfcf1e;io['to'](util[_0x2e7f('0x19')]('whatsapp:queue:%s',_0x33e904[_0x2e7f('0x7')]))[_0x2e7f('0x1a')](_0x2e7f('0x1b'),_0x33e904);}};module[_0x2e7f('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x0055=['../../../config/environment','redis','name','timeout','strategy','beepall','Agents','updateRealtime','prototype','updateRouting','map','mapAgentsId','_rr','paused','length','online','loggedIn','whatsappPause','available','waiting','whatsapp:queue:%s','emit','lodash','md5','util','ioredis'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0x0055,0x1d0));var _0x5005=function(_0x1338d9,_0x1d6e0b){_0x1338d9=_0x1338d9-0x0;var _0xda74ab=_0x0055[_0x1338d9];return _0xda74ab;};'use strict';var _=require(_0x5005('0x0'));var md5=require(_0x5005('0x1'));var util=require(_0x5005('0x2'));var Redis=require(_0x5005('0x3'));var config=require(_0x5005('0x4'));config[_0x5005('0x5')]=_['defaults'](config[_0x5005('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5005('0x5')]));function WhatsappQueue(_0x78a781){this['id']=_0x78a781['id']||0x0;this[_0x5005('0x6')]=_0x78a781[_0x5005('0x6')]||'';this[_0x5005('0x7')]=_0x78a781[_0x5005('0x7')]||0xa;this[_0x5005('0x8')]=_0x78a781[_0x5005('0x8')]||_0x5005('0x9');this[_0x5005('0xa')]=_0x78a781['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x5005('0x1')]='';this['updateRouting']();this[_0x5005('0xb')]();}WhatsappQueue[_0x5005('0xc')][_0x5005('0xd')]=function(){var _0x125cdb=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x5005('0xe')](this[_0x5005('0xa')],'id');this[_0x5005('0xf')][_0x5005('0x10')]=_0x125cdb;};WhatsappQueue[_0x5005('0xc')][_0x5005('0xb')]=function(){this['loggedIn']=0x0;this[_0x5005('0x11')]=0x0;for(var _0x2c84ed=0x0;_0x2c84ed=0x0?this[_0x5005('0x16')]:0x0;var _0x1a93ab={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5005('0x14')],'name':this[_0x5005('0x6')],'paused':this[_0x5005('0x11')],'waiting':this[_0x5005('0x17')]};var _0x4f0329=md5(JSON['stringify'](_0x1a93ab));if(this[_0x5005('0x1')]!==_0x4f0329){this['md5']=_0x4f0329;io['to'](util['format'](_0x5005('0x18'),_0x1a93ab[_0x5005('0x6')]))[_0x5005('0x19')]('whatsapp_queue:save',_0x1a93ab);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 28cd7ff..fc4e380 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(_0x48a0a7,_0x27aaa3){var _0x1d2ea9=function(_0x1a41dc){while(--_0x1a41dc){_0x48a0a7['push'](_0x48a0a7['shift']());}};_0x1d2ea9(++_0x27aaa3);}(_0xb10b,0x12a));var _0xbb10=function(_0x4efdfd,_0x4a27df){_0x4efdfd=_0x4efdfd-0x0;var _0x2b413=_0xb10b[_0x4efdfd];return _0x2b413;};'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(_0x213280,_0x4ebadc){var _0x3794f5=function(_0x56a21d){while(--_0x56a21d){_0x213280['push'](_0x213280['shift']());}};_0x3794f5(++_0x4ebadc);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d386b,_0x352e3f){_0x5d386b=_0x5d386b-0x0;var _0xdfc622=_0xb10b[_0x5d386b];return _0xdfc622;};'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 b3a1196..2911d06 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 _0x55bc=['updateChatInteraction','addTags','AddTagsToChatInteraction','../client','Request'];(function(_0x41cc1f,_0x30cd37){var _0x11c2e1=function(_0x30b8c8){while(--_0x30b8c8){_0x41cc1f['push'](_0x41cc1f['shift']());}};_0x11c2e1(++_0x30cd37);}(_0x55bc,0xc1));var _0xc55b=function(_0x2a8547,_0xfe3e55){_0x2a8547=_0x2a8547-0x0;var _0x190d24=_0x55bc[_0x2a8547];return _0x190d24;};'use strict';var client=require(_0xc55b('0x0'));exports['update']=function(_0x285d19,_0x441379){return client[_0xc55b('0x1')]('UpdateChatInteraction',{'body':_0x441379,'options':{'where':{'id':_0x285d19}},'log':_0xc55b('0x2')});};exports[_0xc55b('0x3')]=function(_0x280840,_0x377430){return client[_0xc55b('0x1')](_0xc55b('0x4'),{'body':_0x377430,'options':{'where':{'id':_0x280840}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x6475=['addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x550552,_0x911116){var _0x2486df=function(_0x1a6bbc){while(--_0x1a6bbc){_0x550552['push'](_0x550552['shift']());}};_0x2486df(++_0x911116);}(_0x6475,0x133));var _0x5647=function(_0x58f363,_0x135c64){_0x58f363=_0x58f363-0x0;var _0xcb2c83=_0x6475[_0x58f363];return _0xcb2c83;};'use strict';var client=require(_0x5647('0x0'));exports[_0x5647('0x1')]=function(_0x24c683,_0x5cb6f8){return client[_0x5647('0x2')](_0x5647('0x3'),{'body':_0x5cb6f8,'options':{'where':{'id':_0x24c683}},'log':_0x5647('0x4')});};exports['addTags']=function(_0x1d3fc4,_0x2367a7){return client[_0x5647('0x2')]('AddTagsToChatInteraction',{'body':_0x2367a7,'options':{'where':{'id':_0x1d3fc4}},'log':_0x5647('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 181990b..c228361 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 _0xdaf2=['createChatMessage','../client','Request'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xdaf2,0x18d));var _0x2daf=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0xdaf2[_0xdd2bfa];return _0x55397e;};'use strict';var client=require(_0x2daf('0x0'));exports['create']=function(_0x4e2518){return client[_0x2daf('0x1')]('CreateChatMessage',{'body':_0x4e2518,'log':_0x2daf('0x2')});}; \ No newline at end of file +var _0x9027=['CreateChatMessage'];(function(_0x361e49,_0x4fa909){var _0x176d42=function(_0x3c6b64){while(--_0x3c6b64){_0x361e49['push'](_0x361e49['shift']());}};_0x176d42(++_0x4fa909);}(_0x9027,0xe0));var _0x7902=function(_0x2114f8,_0x567972){_0x2114f8=_0x2114f8-0x0;var _0x538e09=_0x9027[_0x2114f8];return _0x538e09;};'use strict';var client=require('../client');exports['create']=function(_0x89849b){return client['Request'](_0x7902('0x0'),{'body':_0x89849b,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 6b4f70c..cfb2821 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 _0x34aa=['Request','GetChatQueue','name','timeout','User','Agents','online','chatPause','getChatQueues','../client'];(function(_0x238671,_0x18f9c2){var _0x35f245=function(_0x6273cc){while(--_0x6273cc){_0x238671['push'](_0x238671['shift']());}};_0x35f245(++_0x18f9c2);}(_0x34aa,0x171));var _0xa34a=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x34aa[_0x154940];return _0x401409;};'use strict';var client=require(_0xa34a('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xa34a('0x1')](_0xa34a('0x2'),{'options':{'raw':![],'attributes':['id',_0xa34a('0x3'),_0xa34a('0x4'),'strategy'],'include':[{'model':_0xa34a('0x5'),'as':_0xa34a('0x6'),'attributes':['id',_0xa34a('0x3'),_0xa34a('0x7'),_0xa34a('0x8')]}]},'log':_0xa34a('0x9')});};}; \ No newline at end of file +var _0xeff8=['GetChatQueue','name','timeout','User','Agents','online','../client','getChatQueues'];(function(_0x26e160,_0xea71b2){var _0x17f8bc=function(_0x5b7ece){while(--_0x5b7ece){_0x26e160['push'](_0x26e160['shift']());}};_0x17f8bc(++_0xea71b2);}(_0xeff8,0x186));var _0x8eff=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0xeff8[_0x19b84f];return _0x18067b;};'use strict';var client=require(_0x8eff('0x0'));exports[_0x8eff('0x1')]=function(){return function(){return client['Request'](_0x8eff('0x2'),{'options':{'raw':![],'attributes':['id',_0x8eff('0x3'),_0x8eff('0x4'),'strategy'],'include':[{'model':_0x8eff('0x5'),'as':_0x8eff('0x6'),'attributes':['id',_0x8eff('0x3'),_0x8eff('0x7'),'chatPause']}]},'log':_0x8eff('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index be0ad87..42a5c80 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 _0xcf1c=['UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport','update'];(function(_0x5a5b0f,_0x3f9c45){var _0x5d0a93=function(_0x2b34c8){while(--_0x2b34c8){_0x5a5b0f['push'](_0x5a5b0f['shift']());}};_0x5d0a93(++_0x3f9c45);}(_0xcf1c,0x18d));var _0xccf1=function(_0x1cc8a2,_0x5dce88){_0x1cc8a2=_0x1cc8a2-0x0;var _0xadb7a6=_0xcf1c[_0x1cc8a2];return _0xadb7a6;};'use strict';var client=require(_0xccf1('0x0'));exports[_0xccf1('0x1')]=function(_0x54253e){return client[_0xccf1('0x2')](_0xccf1('0x3'),{'body':_0x54253e,'log':_0xccf1('0x3')});};exports[_0xccf1('0x4')]=function(_0x5670d0,_0x5d3e85){return client['Request'](_0xccf1('0x5'),{'body':_0x5d3e85,'options':{'where':{'uniqueid':_0x5670d0},'order':[['id','DESC']],'limit':0x1},'log':_0xccf1('0x5')});}; \ No newline at end of file +var _0x8b04=['update','UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x52c3d5,_0x153853){var _0x3ec72a=function(_0x1a5531){while(--_0x1a5531){_0x52c3d5['push'](_0x52c3d5['shift']());}};_0x3ec72a(++_0x153853);}(_0x8b04,0x130));var _0x48b0=function(_0x42aff1,_0x279acb){_0x42aff1=_0x42aff1-0x0;var _0x102349=_0x8b04[_0x42aff1];return _0x102349;};'use strict';var client=require(_0x48b0('0x0'));exports[_0x48b0('0x1')]=function(_0x53315f){return client[_0x48b0('0x2')]('CreateChatQueueReport',{'body':_0x53315f,'log':_0x48b0('0x3')});};exports[_0x48b0('0x4')]=function(_0xc0b19b,_0x468c90){return client[_0x48b0('0x2')](_0x48b0('0x5'),{'body':_0x468c90,'options':{'where':{'uniqueid':_0xc0b19b},'order':[['id',_0x48b0('0x6')]],'limit':0x1},'log':_0x48b0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index b78fdaf..8395e00 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x526770,_0x3da843){var _0x120f0e=function(_0x2737c8){while(--_0x2737c8){_0x526770['push'](_0x526770['shift']());}};_0x120f0e(++_0x3da843);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x61b3ab,_0x1fc298){var _0x57097f=function(_0x25970b){while(--_0x25970b){_0x61b3ab['push'](_0x61b3ab['shift']());}};_0x57097f(++_0x1fc298);}(_0x7a54,0x106));var _0x47a5=function(_0x50d257,_0x3c7c29){_0x50d257=_0x50d257-0x0;var _0x52e1f6=_0x7a54[_0x50d257];return _0x52e1f6;};'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 diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 90d6f2a..aa3c6e6 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 _0x300d=['CreateFaxMessage','create','Request'];(function(_0x37f2f9,_0x662e94){var _0x1b3e97=function(_0x2a1ac3){while(--_0x2a1ac3){_0x37f2f9['push'](_0x37f2f9['shift']());}};_0x1b3e97(++_0x662e94);}(_0x300d,0x100));var _0xd300=function(_0x30ae89,_0x290a8f){_0x30ae89=_0x30ae89-0x0;var _0x4ece62=_0x300d[_0x30ae89];return _0x4ece62;};'use strict';var client=require('../client');exports[_0xd300('0x0')]=function(_0x373507){return client[_0xd300('0x1')](_0xd300('0x2'),{'body':_0x373507,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xda18=['create','Request','createFaxMessage'];(function(_0x2df6c9,_0x5b0338){var _0x2ad80a=function(_0x1d1ac8){while(--_0x1d1ac8){_0x2df6c9['push'](_0x2df6c9['shift']());}};_0x2ad80a(++_0x5b0338);}(_0xda18,0x72));var _0x8da1=function(_0x392da0,_0x111998){_0x392da0=_0x392da0-0x0;var _0x52068b=_0xda18[_0x392da0];return _0x52068b;};'use strict';var client=require('../client');exports[_0x8da1('0x0')]=function(_0x7f03){return client[_0x8da1('0x1')]('CreateFaxMessage',{'body':_0x7f03,'log':_0x8da1('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index b81de70..f01839c 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 _0xf67e=['../client','getFaxQueues','Request','GetFaxQueue','timeout','User','Agents','online','faxPause'];(function(_0x476861,_0x3f4655){var _0xc8abb1=function(_0x29d04d){while(--_0x29d04d){_0x476861['push'](_0x476861['shift']());}};_0xc8abb1(++_0x3f4655);}(_0xf67e,0x129));var _0xef67=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf67e[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0xef67('0x0'));exports[_0xef67('0x1')]=function(){return function(){return client[_0xef67('0x2')](_0xef67('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xef67('0x4'),'strategy'],'include':[{'model':_0xef67('0x5'),'as':_0xef67('0x6'),'attributes':['id','name',_0xef67('0x7'),_0xef67('0x8')]}]},'log':_0xef67('0x1')});};}; \ No newline at end of file +var _0xc9e1=['strategy','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue'];(function(_0x809993,_0x32f082){var _0x3b84cc=function(_0x8fbff0){while(--_0x8fbff0){_0x809993['push'](_0x809993['shift']());}};_0x3b84cc(++_0x32f082);}(_0xc9e1,0x104));var _0x1c9e=function(_0x5c45d1,_0x12d6eb){_0x5c45d1=_0x5c45d1-0x0;var _0x2b0b1e=_0xc9e1[_0x5c45d1];return _0x2b0b1e;};'use strict';var client=require(_0x1c9e('0x0'));exports[_0x1c9e('0x1')]=function(){return function(){return client[_0x1c9e('0x2')](_0x1c9e('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x1c9e('0x4')],'include':[{'model':'User','as':_0x1c9e('0x5'),'attributes':['id','name',_0x1c9e('0x6'),_0x1c9e('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 86a542d..7215710 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 _0x8089=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','Request'];(function(_0x439248,_0xfaecf7){var _0x1d2a87=function(_0x1edfcb){while(--_0x1edfcb){_0x439248['push'](_0x439248['shift']());}};_0x1d2a87(++_0xfaecf7);}(_0x8089,0x1de));var _0x9808=function(_0x6d810c,_0x5b19b6){_0x6d810c=_0x6d810c-0x0;var _0x52baaf=_0x8089[_0x6d810c];return _0x52baaf;};'use strict';var client=require(_0x9808('0x0'));exports['create']=function(_0x5560de){return client[_0x9808('0x1')]('CreateFaxQueueReport',{'body':_0x5560de,'log':_0x9808('0x2')});};exports['update']=function(_0x15d5da,_0x31d4e1){return client['Request'](_0x9808('0x3'),{'body':_0x31d4e1,'options':{'where':{'uniqueid':_0x15d5da},'order':[['id',_0x9808('0x4')]],'limit':0x1},'log':_0x9808('0x3')});}; \ No newline at end of file +var _0x8025=['CreateFaxQueueReport','Request','DESC','UpdateFaxQueueReport','create'];(function(_0x2cbec0,_0x262fef){var _0x3d4101=function(_0x549a36){while(--_0x549a36){_0x2cbec0['push'](_0x2cbec0['shift']());}};_0x3d4101(++_0x262fef);}(_0x8025,0x158));var _0x5802=function(_0x14859f,_0x3a61c6){_0x14859f=_0x14859f-0x0;var _0x3a407a=_0x8025[_0x14859f];return _0x3a407a;};'use strict';var client=require('../client');exports[_0x5802('0x0')]=function(_0x171cb8){return client['Request'](_0x5802('0x1'),{'body':_0x171cb8,'log':_0x5802('0x1')});};exports['update']=function(_0x235dd9,_0xbd5b99){return client[_0x5802('0x2')]('UpdateFaxQueueReport',{'body':_0xbd5b99,'options':{'where':{'uniqueid':_0x235dd9},'order':[['id',_0x5802('0x3')]],'limit':0x1},'log':_0x5802('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 8f7fd9f..3f89704 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 _0x2c2d=['Request','GetInterval','name','Interval','Intervals','interval','../client','getIntervals'];(function(_0x39a400,_0x153dfd){var _0x5a159f=function(_0x386fc7){while(--_0x386fc7){_0x39a400['push'](_0x39a400['shift']());}};_0x5a159f(++_0x153dfd);}(_0x2c2d,0x1e6));var _0xd2c2=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x2c2d[_0x166742];return _0xb7814a;};'use strict';var client=require(_0xd2c2('0x0'));exports[_0xd2c2('0x1')]=function(){return function(){return client[_0xd2c2('0x2')](_0xd2c2('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xd2c2('0x4')],'include':[{'model':_0xd2c2('0x5'),'as':_0xd2c2('0x6'),'attributes':['id','name',_0xd2c2('0x7')]}]},'log':_0xd2c2('0x1')});};}; \ No newline at end of file +var _0xe19f=['getIntervals','Request','GetInterval','name','Intervals','interval','../client'];(function(_0x1a6c01,_0x5a9fa7){var _0x292e6d=function(_0x4e5037){while(--_0x4e5037){_0x1a6c01['push'](_0x1a6c01['shift']());}};_0x292e6d(++_0x5a9fa7);}(_0xe19f,0x133));var _0xfe19=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe19f[_0x3ab51d];return _0x29a04e;};'use strict';var client=require(_0xfe19('0x0'));exports[_0xfe19('0x1')]=function(){return function(){return client[_0xfe19('0x2')](_0xfe19('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xfe19('0x4')],'include':[{'model':'Interval','as':_0xfe19('0x5'),'attributes':['id',_0xfe19('0x4'),_0xfe19('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 49bb872..592c633 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 _0x5430=['Request','UpdateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5430,0x10c));var _0x0543=function(_0x3acf57,_0x1543de){_0x3acf57=_0x3acf57-0x0;var _0x3f24a6=_0x5430[_0x3acf57];return _0x3f24a6;};'use strict';var client=require(_0x0543('0x0'));exports[_0x0543('0x1')]=function(_0xa1b1a7,_0x4078bf){return client[_0x0543('0x2')](_0x0543('0x3'),{'body':_0x4078bf,'options':{'where':{'id':_0xa1b1a7}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x1c5ab7,_0x4ee416){return client['Request'](_0x0543('0x4'),{'body':_0x4ee416,'options':{'where':{'id':_0x1c5ab7}},'log':_0x0543('0x5')});}; \ No newline at end of file +var _0xfcbb=['update','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0xf46a82,_0x7002d6){var _0x5befba=function(_0x316463){while(--_0x316463){_0xf46a82['push'](_0xf46a82['shift']());}};_0x5befba(++_0x7002d6);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x20e01b,_0x474b2d){_0x20e01b=_0x20e01b-0x0;var _0x575bb9=_0xfcbb[_0x20e01b];return _0x575bb9;};'use strict';var client=require(_0xbfcb('0x0'));exports[_0xbfcb('0x1')]=function(_0x112f37,_0x5a1002){return client['Request'](_0xbfcb('0x2'),{'body':_0x5a1002,'options':{'where':{'id':_0x112f37}},'log':_0xbfcb('0x3')});};exports[_0xbfcb('0x4')]=function(_0x135741,_0x1d8b50){return client['Request']('AddTagsToMailInteraction',{'body':_0x1d8b50,'options':{'where':{'id':_0x135741}},'log':_0xbfcb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index ab6ac41..794d101 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 _0x285a=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x285a,0x1ef));var _0xa285=function(_0x554533,_0x6dc719){_0x554533=_0x554533-0x0;var _0x10f931=_0x285a[_0x554533];return _0x10f931;};'use strict';var client=require(_0xa285('0x0'));exports[_0xa285('0x1')]=function(_0x2e69c7){return client[_0xa285('0x2')](_0xa285('0x3'),{'body':_0x2e69c7,'log':_0xa285('0x4')});}; \ No newline at end of file +var _0x35ac=['CreateMailMessage','createMailMessage','../client','create'];(function(_0xa8d84f,_0x512e08){var _0x220939=function(_0x496f6d){while(--_0x496f6d){_0xa8d84f['push'](_0xa8d84f['shift']());}};_0x220939(++_0x512e08);}(_0x35ac,0x10e));var _0xc35a=function(_0x316947,_0x1aa964){_0x316947=_0x316947-0x0;var _0x5974cd=_0x35ac[_0x316947];return _0x5974cd;};'use strict';var client=require(_0xc35a('0x0'));exports[_0xc35a('0x1')]=function(_0x841616){return client['Request'](_0xc35a('0x2'),{'body':_0x841616,'log':_0xc35a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index c920cd4..919f2e6 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 _0x60a5=['../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause'];(function(_0x36d28d,_0x5a9e25){var _0x361848=function(_0x569326){while(--_0x569326){_0x36d28d['push'](_0x36d28d['shift']());}};_0x361848(++_0x5a9e25);}(_0x60a5,0x113));var _0x560a=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x60a5[_0x160c73];return _0xd9302;};'use strict';var client=require(_0x560a('0x0'));exports[_0x560a('0x1')]=function(){return function(){return client[_0x560a('0x2')](_0x560a('0x3'),{'options':{'raw':![],'attributes':['id',_0x560a('0x4'),_0x560a('0x5'),_0x560a('0x6')],'include':[{'model':_0x560a('0x7'),'as':_0x560a('0x8'),'attributes':['id',_0x560a('0x4'),_0x560a('0x9'),_0x560a('0xa')]}]},'log':_0x560a('0x1')});};}; \ No newline at end of file +var _0x3144=['online','mailPause','getMailQueues','Request','GetMailQueue','timeout','strategy','User','Agents'];(function(_0x4e1ad9,_0x37f132){var _0x2313af=function(_0x1d810a){while(--_0x1d810a){_0x4e1ad9['push'](_0x4e1ad9['shift']());}};_0x2313af(++_0x37f132);}(_0x3144,0x17c));var _0x4314=function(_0x28e04a,_0x5a80cd){_0x28e04a=_0x28e04a-0x0;var _0x378283=_0x3144[_0x28e04a];return _0x378283;};'use strict';var client=require('../client');exports[_0x4314('0x0')]=function(){return function(){return client[_0x4314('0x1')](_0x4314('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x4314('0x3'),_0x4314('0x4')],'include':[{'model':_0x4314('0x5'),'as':_0x4314('0x6'),'attributes':['id','name',_0x4314('0x7'),_0x4314('0x8')]}]},'log':_0x4314('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 263e04b..26197f2 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 _0xfd7c=['UpdateMailQueueReport','../client','Request','CreateMailQueueReport','update'];(function(_0x57549a,_0x408aee){var _0x19591b=function(_0x1cb265){while(--_0x1cb265){_0x57549a['push'](_0x57549a['shift']());}};_0x19591b(++_0x408aee);}(_0xfd7c,0xe2));var _0xcfd7=function(_0x2171c1,_0x43b7fa){_0x2171c1=_0x2171c1-0x0;var _0x32fc80=_0xfd7c[_0x2171c1];return _0x32fc80;};'use strict';var client=require(_0xcfd7('0x0'));exports['create']=function(_0x3fa9c3){return client[_0xcfd7('0x1')](_0xcfd7('0x2'),{'body':_0x3fa9c3,'log':_0xcfd7('0x2')});};exports[_0xcfd7('0x3')]=function(_0x233a66,_0x2f0709){return client[_0xcfd7('0x1')](_0xcfd7('0x4'),{'body':_0x2f0709,'options':{'where':{'uniqueid':_0x233a66},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xd213=['CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC','../client','create'];(function(_0x1c36b3,_0x26d4cd){var _0x329667=function(_0x1a233d){while(--_0x1a233d){_0x1c36b3['push'](_0x1c36b3['shift']());}};_0x329667(++_0x26d4cd);}(_0xd213,0x1cc));var _0x3d21=function(_0x116f1d,_0x11a505){_0x116f1d=_0x116f1d-0x0;var _0x124750=_0xd213[_0x116f1d];return _0x124750;};'use strict';var client=require(_0x3d21('0x0'));exports[_0x3d21('0x1')]=function(_0xcde211){return client['Request'](_0x3d21('0x2'),{'body':_0xcde211,'log':_0x3d21('0x2')});};exports[_0x3d21('0x3')]=function(_0x54a70c,_0x38573e){return client[_0x3d21('0x4')](_0x3d21('0x5'),{'body':_0x38573e,'options':{'where':{'uniqueid':_0x54a70c},'order':[['id',_0x3d21('0x6')]],'limit':0x1},'log':_0x3d21('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 1ecfb26..d327f37 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 _0x7f0a=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','addTags'];(function(_0x5d4afe,_0x523a4f){var _0x185ab8=function(_0x358e43){while(--_0x358e43){_0x5d4afe['push'](_0x5d4afe['shift']());}};_0x185ab8(++_0x523a4f);}(_0x7f0a,0xfd));var _0xa7f0=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x7f0a[_0x5bd426];return _0x23a7eb;};'use strict';var client=require(_0xa7f0('0x0'));exports[_0xa7f0('0x1')]=function(_0x1411ab,_0x544307){return client[_0xa7f0('0x2')](_0xa7f0('0x3'),{'body':_0x544307,'options':{'where':{'id':_0x1411ab}},'log':'updateOpenchannelInteraction'});};exports[_0xa7f0('0x4')]=function(_0x1a52ce,_0x26b033){return client[_0xa7f0('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x26b033,'options':{'where':{'id':_0x1a52ce}},'log':_0xa7f0('0x5')});}; \ No newline at end of file +var _0x59d3=['../client','update','Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x2e8f7f,_0x3b6389){var _0x208dcb=function(_0x3620bb){while(--_0x3620bb){_0x2e8f7f['push'](_0x2e8f7f['shift']());}};_0x208dcb(++_0x3b6389);}(_0x59d3,0x1e3));var _0x359d=function(_0x128286,_0xec49dd){_0x128286=_0x128286-0x0;var _0x21cefa=_0x59d3[_0x128286];return _0x21cefa;};'use strict';var client=require(_0x359d('0x0'));exports[_0x359d('0x1')]=function(_0x470f2c,_0x1e1186){return client[_0x359d('0x2')]('UpdateOpenchannelInteraction',{'body':_0x1e1186,'options':{'where':{'id':_0x470f2c}},'log':_0x359d('0x3')});};exports[_0x359d('0x4')]=function(_0x298a5b,_0xb7b0f7){return client['Request'](_0x359d('0x5'),{'body':_0xb7b0f7,'options':{'where':{'id':_0x298a5b}},'log':_0x359d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 31bcdd5..2b32bd3 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 _0x2eff=['CreateOpenchannelMessage','../client','create','Request'];(function(_0x2253f5,_0xf3ef1a){var _0x491cc1=function(_0x11b05a){while(--_0x11b05a){_0x2253f5['push'](_0x2253f5['shift']());}};_0x491cc1(++_0xf3ef1a);}(_0x2eff,0x15d));var _0xf2ef=function(_0x3eb578,_0x59e0af){_0x3eb578=_0x3eb578-0x0;var _0x7f3c90=_0x2eff[_0x3eb578];return _0x7f3c90;};'use strict';var client=require(_0xf2ef('0x0'));exports[_0xf2ef('0x1')]=function(_0x1c9d97){return client[_0xf2ef('0x2')](_0xf2ef('0x3'),{'body':_0x1c9d97,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x416a=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x2aa183,_0x3894f4){var _0x492ed0=function(_0x3beba2){while(--_0x3beba2){_0x2aa183['push'](_0x2aa183['shift']());}};_0x492ed0(++_0x3894f4);}(_0x416a,0xb4));var _0xa416=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x416a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa416('0x0'));exports[_0xa416('0x1')]=function(_0x53a427){return client[_0xa416('0x2')](_0xa416('0x3'),{'body':_0x53a427,'log':_0xa416('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index dadd6eb..78d0fef 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 _0x8a16=['User','Agents','name','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','timeout','strategy'];(function(_0x583ae2,_0x413a09){var _0xfaa340=function(_0xe53e6a){while(--_0xe53e6a){_0x583ae2['push'](_0x583ae2['shift']());}};_0xfaa340(++_0x413a09);}(_0x8a16,0xdc));var _0x68a1=function(_0x4e4d10,_0x30d69a){_0x4e4d10=_0x4e4d10-0x0;var _0x46285d=_0x8a16[_0x4e4d10];return _0x46285d;};'use strict';var client=require(_0x68a1('0x0'));exports[_0x68a1('0x1')]=function(){return function(){return client['Request'](_0x68a1('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x68a1('0x3'),_0x68a1('0x4')],'include':[{'model':_0x68a1('0x5'),'as':_0x68a1('0x6'),'attributes':['id',_0x68a1('0x7'),'online',_0x68a1('0x8')]}]},'log':_0x68a1('0x1')});};}; \ No newline at end of file +var _0xd5df=['strategy','User','Agents','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x180fcb,_0x208b94){var _0x515f0d=function(_0x1be895){while(--_0x1be895){_0x180fcb['push'](_0x180fcb['shift']());}};_0x515f0d(++_0x208b94);}(_0xd5df,0x136));var _0xfd5d=function(_0x335b64,_0x52e8e5){_0x335b64=_0x335b64-0x0;var _0x36b5f3=_0xd5df[_0x335b64];return _0x36b5f3;};'use strict';var client=require('../client');exports[_0xfd5d('0x0')]=function(){return function(){return client[_0xfd5d('0x1')](_0xfd5d('0x2'),{'options':{'raw':![],'attributes':['id',_0xfd5d('0x3'),_0xfd5d('0x4'),_0xfd5d('0x5')],'include':[{'model':_0xfd5d('0x6'),'as':_0xfd5d('0x7'),'attributes':['id',_0xfd5d('0x3'),'online',_0xfd5d('0x8')]}]},'log':_0xfd5d('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index f12f1e3..0f17c4b 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 _0xc2df=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client'];(function(_0x4a94b1,_0x4f2518){var _0x20949f=function(_0x1c4aa6){while(--_0x1c4aa6){_0x4a94b1['push'](_0x4a94b1['shift']());}};_0x20949f(++_0x4f2518);}(_0xc2df,0x197));var _0xfc2d=function(_0x22e4f4,_0x1ba707){_0x22e4f4=_0x22e4f4-0x0;var _0x650eaf=_0xc2df[_0x22e4f4];return _0x650eaf;};'use strict';var client=require(_0xfc2d('0x0'));exports[_0xfc2d('0x1')]=function(_0x510311){return client[_0xfc2d('0x2')](_0xfc2d('0x3'),{'body':_0x510311,'log':_0xfc2d('0x3')});};exports[_0xfc2d('0x4')]=function(_0x5ba6dd,_0x13739c){return client[_0xfc2d('0x2')](_0xfc2d('0x5'),{'body':_0x13739c,'options':{'where':{'uniqueid':_0x5ba6dd},'order':[['id','DESC']],'limit':0x1},'log':_0xfc2d('0x5')});}; \ No newline at end of file +var _0x159b=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x159b,0x181));var _0xb159=function(_0x33fff8,_0x48a283){_0x33fff8=_0x33fff8-0x0;var _0x22d90a=_0x159b[_0x33fff8];return _0x22d90a;};'use strict';var client=require(_0xb159('0x0'));exports[_0xb159('0x1')]=function(_0x133b81){return client[_0xb159('0x2')](_0xb159('0x3'),{'body':_0x133b81,'log':_0xb159('0x3')});};exports[_0xb159('0x4')]=function(_0x1f131d,_0x4bf9dc){return client[_0xb159('0x2')](_0xb159('0x5'),{'body':_0x4bf9dc,'options':{'where':{'uniqueid':_0x1f131d},'order':[['id',_0xb159('0x6')]],'limit':0x1},'log':_0xb159('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 97cd233..406471e 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 _0x1e69=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x1e69,0x85));var _0x91e6=function(_0x4be3f3,_0x20efd7){_0x4be3f3=_0x4be3f3-0x0;var _0x5278b3=_0x1e69[_0x4be3f3];return _0x5278b3;};'use strict';var client=require('../client');exports[_0x91e6('0x0')]=function(_0x28561c,_0x6605eb){return client[_0x91e6('0x1')]('UpdateSmsInteraction',{'body':_0x6605eb,'options':{'where':{'id':_0x28561c}},'log':'updateSmsInteraction'});};exports[_0x91e6('0x2')]=function(_0x351c1d,_0x2b53b6){return client[_0x91e6('0x1')](_0x91e6('0x3'),{'body':_0x2b53b6,'options':{'where':{'id':_0x351c1d}},'log':_0x91e6('0x4')});}; \ No newline at end of file +var _0xf14b=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x531a19,_0x43e019){var _0x4845d2=function(_0x4c9b62){while(--_0x4c9b62){_0x531a19['push'](_0x531a19['shift']());}};_0x4845d2(++_0x43e019);}(_0xf14b,0xdd));var _0xbf14=function(_0x430205,_0x328c94){_0x430205=_0x430205-0x0;var _0x3f5146=_0xf14b[_0x430205];return _0x3f5146;};'use strict';var client=require(_0xbf14('0x0'));exports[_0xbf14('0x1')]=function(_0x331ed9,_0x1d0b20){return client[_0xbf14('0x2')](_0xbf14('0x3'),{'body':_0x1d0b20,'options':{'where':{'id':_0x331ed9}},'log':_0xbf14('0x4')});};exports[_0xbf14('0x5')]=function(_0x1c9f49,_0x3afb15){return client['Request'](_0xbf14('0x6'),{'body':_0x3afb15,'options':{'where':{'id':_0x1c9f49}},'log':_0xbf14('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index d8d2d5a..8657745 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 _0x6d23=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x34f619,_0x38c23a){var _0x9836c8=function(_0xcc7a3c){while(--_0xcc7a3c){_0x34f619['push'](_0x34f619['shift']());}};_0x9836c8(++_0x38c23a);}(_0x6d23,0x1b8));var _0x36d2=function(_0x12ddbd,_0x58ffe4){_0x12ddbd=_0x12ddbd-0x0;var _0x53cc8a=_0x6d23[_0x12ddbd];return _0x53cc8a;};'use strict';var client=require(_0x36d2('0x0'));exports[_0x36d2('0x1')]=function(_0x370924){return client[_0x36d2('0x2')](_0x36d2('0x3'),{'body':_0x370924,'log':_0x36d2('0x4')});}; \ No newline at end of file +var _0x54e1=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x582c6e,_0x251e50){var _0xa8c5a2=function(_0x4aa95c){while(--_0x4aa95c){_0x582c6e['push'](_0x582c6e['shift']());}};_0xa8c5a2(++_0x251e50);}(_0x54e1,0x120));var _0x154e=function(_0x10278e,_0x38af86){_0x10278e=_0x10278e-0x0;var _0x3392a0=_0x54e1[_0x10278e];return _0x3392a0;};'use strict';var client=require(_0x154e('0x0'));exports[_0x154e('0x1')]=function(_0x14ce5f){return client[_0x154e('0x2')](_0x154e('0x3'),{'body':_0x14ce5f,'log':_0x154e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 015e0e4..477e6e5 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 _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x562839,_0x31e05f){var _0x568917=function(_0x4ab900){while(--_0x4ab900){_0x562839['push'](_0x562839['shift']());}};_0x568917(++_0x31e05f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x5dc2fa,_0x56279d){var _0x16eaf9=function(_0x83322){while(--_0x83322){_0x5dc2fa['push'](_0x5dc2fa['shift']());}};_0x16eaf9(++_0x56279d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index f832fcc..5ad570f 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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x6fcc6e,_0x5d1c4e){var _0x234cee=function(_0x298e0e){while(--_0x298e0e){_0x6fcc6e['push'](_0x6fcc6e['shift']());}};_0x234cee(++_0x5d1c4e);}(_0x008c,0x188));var _0xc008=function(_0x545672,_0x589128){_0x545672=_0x545672-0x0;var _0x57920d=_0x008c[_0x545672];return _0x57920d;};'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 +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x17d52d,_0x678612){var _0x3ae447=function(_0x1b0152){while(--_0x1b0152){_0x17d52d['push'](_0x17d52d['shift']());}};_0x3ae447(++_0x678612);}(_0x3e74,0x175));var _0x43e7=function(_0x18b80e,_0x55b1fc){_0x18b80e=_0x18b80e-0x0;var _0x4ba6a5=_0x3e74[_0x18b80e];return _0x4ba6a5;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index ed8dcf0..067b1a2 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(_0x3d0653,_0x158842){var _0x432596=function(_0x2dc8e4){while(--_0x2dc8e4){_0x3d0653['push'](_0x3d0653['shift']());}};_0x432596(++_0x158842);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x2cbad3,_0x34e234){var _0x51ae08=function(_0x5afa42){while(--_0x5afa42){_0x2cbad3['push'](_0x2cbad3['shift']());}};_0x51ae08(++_0x34e234);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 f54d4a8..c79e5bc 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 _0x4975=['addTags','AddTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4975,0x86));var _0x5497=function(_0x4ce892,_0x460c9f){_0x4ce892=_0x4ce892-0x0;var _0x1c4887=_0x4975[_0x4ce892];return _0x1c4887;};'use strict';var client=require(_0x5497('0x0'));exports['update']=function(_0x474989,_0x3f9e37){return client[_0x5497('0x1')](_0x5497('0x2'),{'body':_0x3f9e37,'options':{'where':{'id':_0x474989}},'log':_0x5497('0x3')});};exports[_0x5497('0x4')]=function(_0x14cecb,_0xeb31af){return client[_0x5497('0x1')](_0x5497('0x5'),{'body':_0xeb31af,'options':{'where':{'id':_0x14cecb}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x39e6=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','updateWhatsappInteraction','Request'];(function(_0x164ad3,_0x38cfe8){var _0x459389=function(_0x52f798){while(--_0x52f798){_0x164ad3['push'](_0x164ad3['shift']());}};_0x459389(++_0x38cfe8);}(_0x39e6,0x9e));var _0x639e=function(_0x15dd1e,_0x183d27){_0x15dd1e=_0x15dd1e-0x0;var _0x4c328e=_0x39e6[_0x15dd1e];return _0x4c328e;};'use strict';var client=require(_0x639e('0x0'));exports['update']=function(_0x2b265a,_0x5719fc){return client['Request'](_0x639e('0x1'),{'body':_0x5719fc,'options':{'where':{'id':_0x2b265a}},'log':_0x639e('0x2')});};exports['addTags']=function(_0x467229,_0x207d6a){return client[_0x639e('0x3')](_0x639e('0x4'),{'body':_0x207d6a,'options':{'where':{'id':_0x467229}},'log':_0x639e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b07e8b3..6e9f629 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 _0xb413=['create','../client'];(function(_0x3fcb52,_0x132fb2){var _0x17c2d6=function(_0x76732a){while(--_0x76732a){_0x3fcb52['push'](_0x3fcb52['shift']());}};_0x17c2d6(++_0x132fb2);}(_0xb413,0x9d));var _0x3b41=function(_0x2c518f,_0x28642d){_0x2c518f=_0x2c518f-0x0;var _0x1ea7ab=_0xb413[_0x2c518f];return _0x1ea7ab;};'use strict';var client=require(_0x3b41('0x0'));exports[_0x3b41('0x1')]=function(_0x10688d){return client['Request']('CreateWhatsappMessage',{'body':_0x10688d,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x5228=['Request','CreateWhatsappMessage','../client'];(function(_0x52d118,_0x487d91){var _0x34f564=function(_0x1e04f1){while(--_0x1e04f1){_0x52d118['push'](_0x52d118['shift']());}};_0x34f564(++_0x487d91);}(_0x5228,0x16d));var _0x8522=function(_0x49ab62,_0xd75180){_0x49ab62=_0x49ab62-0x0;var _0x51d749=_0x5228[_0x49ab62];return _0x51d749;};'use strict';var client=require(_0x8522('0x0'));exports['create']=function(_0x596e3d){return client[_0x8522('0x1')](_0x8522('0x2'),{'body':_0x596e3d,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index ab57315..aa04196 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 _0xa0b2=['timeout','User','Agents','online','whatsappPause','getWhatsappQueues','../client','name'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0xa0b2,0x156));var _0x2a0b=function(_0x4ea6af,_0x4aa32e){_0x4ea6af=_0x4ea6af-0x0;var _0x4cb1e6=_0xa0b2[_0x4ea6af];return _0x4cb1e6;};'use strict';var client=require(_0x2a0b('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x2a0b('0x1'),_0x2a0b('0x2'),'strategy'],'include':[{'model':_0x2a0b('0x3'),'as':_0x2a0b('0x4'),'attributes':['id','name',_0x2a0b('0x5'),_0x2a0b('0x6')]}]},'log':_0x2a0b('0x7')});};}; \ No newline at end of file +var _0x42db=['../client','getWhatsappQueues','GetWhatsappQueue','name','strategy','Agents','whatsappPause'];(function(_0x4c3420,_0x11afe5){var _0x13beaa=function(_0x533633){while(--_0x533633){_0x4c3420['push'](_0x4c3420['shift']());}};_0x13beaa(++_0x11afe5);}(_0x42db,0x13b));var _0xb42d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x42db[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xb42d('0x0'));exports[_0xb42d('0x1')]=function(){return function(){return client['Request'](_0xb42d('0x2'),{'options':{'raw':![],'attributes':['id',_0xb42d('0x3'),'timeout',_0xb42d('0x4')],'include':[{'model':'User','as':_0xb42d('0x5'),'attributes':['id','name','online',_0xb42d('0x6')]}]},'log':_0xb42d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 9cd4373..f261a7a 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 _0xa99e=['../client','create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC'];(function(_0x5443fb,_0x1ee52d){var _0x14d7dd=function(_0x37b842){while(--_0x37b842){_0x5443fb['push'](_0x5443fb['shift']());}};_0x14d7dd(++_0x1ee52d);}(_0xa99e,0x90));var _0xea99=function(_0x3de3ed,_0x13a022){_0x3de3ed=_0x3de3ed-0x0;var _0x32c6b2=_0xa99e[_0x3de3ed];return _0x32c6b2;};'use strict';var client=require(_0xea99('0x0'));exports[_0xea99('0x1')]=function(_0x44ace){return client[_0xea99('0x2')](_0xea99('0x3'),{'body':_0x44ace,'log':_0xea99('0x3')});};exports['update']=function(_0x515805,_0x2f849a){return client[_0xea99('0x2')](_0xea99('0x4'),{'body':_0x2f849a,'options':{'where':{'uniqueid':_0x515805},'order':[['id',_0xea99('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x4784=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','create','Request'];(function(_0x14c2d3,_0x156730){var _0x29c8d7=function(_0x43e5e0){while(--_0x43e5e0){_0x14c2d3['push'](_0x14c2d3['shift']());}};_0x29c8d7(++_0x156730);}(_0x4784,0x1ad));var _0x4478=function(_0x109505,_0x3214bc){_0x109505=_0x109505-0x0;var _0x25a1f7=_0x4784[_0x109505];return _0x25a1f7;};'use strict';var client=require(_0x4478('0x0'));exports[_0x4478('0x1')]=function(_0x49aca2){return client[_0x4478('0x2')]('CreateWhatsappQueueReport',{'body':_0x49aca2,'log':_0x4478('0x3')});};exports[_0x4478('0x4')]=function(_0x11eafd,_0x56cb99){return client[_0x4478('0x2')](_0x4478('0x5'),{'body':_0x56cb99,'options':{'where':{'uniqueid':_0x11eafd},'order':[['id','DESC']],'limit':0x1},'log':_0x4478('0x5')});}; \ 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 8784101..10e2197 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 _0x5687=['validate','lodash','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','join','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20END','close','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error'];(function(_0x1ce8a1,_0x360c9d){var _0x405107=function(_0x391e63){while(--_0x391e63){_0x1ce8a1['push'](_0x1ce8a1['shift']());}};_0x405107(++_0x360c9d);}(_0x5687,0x155));var _0x7568=function(_0x26f70b,_0x26b72d){_0x26f70b=_0x26f70b-0x0;var _0x39d043=_0x5687[_0x26f70b];return _0x39d043;};'use strict';var schema=require(_0x7568('0x0'));var _=require(_0x7568('0x1'));var util=require('util');var seqqueue=require(_0x7568('0x2'));var logger=require(_0x7568('0x3'))(_0x7568('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x7568('0x5'),'required':!![],'message':_0x7568('0x6')},'timeout':{'type':_0x7568('0x7'),'message':_0x7568('0x8')}});function writeLog(_0x3fc46f,_0x21138b,_0x4c45ec){return logger['info'](util[_0x7568('0x9')](_0x7568('0xa'),_0x3fc46f,_0x21138b[_0x7568('0xb')],_0x4c45ec));}function handleFindAgent(_0x33ce54){return function(_0xef438a){return _0xef438a[_0x7568('0xb')][_0x7568('0xc')]()===_0x33ce54[_0x7568('0xc')]();};}exports['consequence']=function(_0x5b0cc5,_0x411a43,_0x2cb0f1,_0x316e29){return function(_0x5eba95){try{var _0x32715c={'name':_0x411a43[0x0],'timeout':_0x411a43[0x1]};var _0x19c028=queue[_0x7568('0x0')](_0x32715c,{'typecast':!![]});if(_0x19c028[_0x7568('0xd')]){logger['error']('[%s][AGENT]\x20%s',_0x5b0cc5,_['map'](_0x19c028,'message')[_0x7568('0xe')](',\x20'));_0x5eba95[_0x7568('0xf')]();}else{var _0x4b3d48=_['find'](_0x2cb0f1[_0x7568('0x10')],handleFindAgent(_0x32715c[_0x7568('0xb')]));if(_0x4b3d48){var _0x3d4c48=(_0x32715c[_0x7568('0x11')]||0xa)*0x3e8;var _0x2248e3,_0x299095;var _0x50b7bd=seqqueue[_0x7568('0x12')](_0x3d4c48);_0x50b7bd['id']=_0x5b0cc5;_0x50b7bd[_0x7568('0x13')]=_0x3d4c48;_0x50b7bd[_0x7568('0x14')]=_0x316e29[_0x7568('0x14')];writeLog(_0x5b0cc5,_0x4b3d48,util['format'](_0x7568('0x15'),_0x3d4c48));_0x2cb0f1[_0x7568('0x16')][_0x5b0cc5]['on'](_0x7568('0x17'),function(){logger[_0x7568('0x18')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x5b0cc5);clearTimeout(_0x299095);_0x299095=undefined;_0x50b7bd['close']();if(_0x2cb0f1[_0x7568('0x16')][_0x5b0cc5]){delete _0x2cb0f1[_0x7568('0x16')][_0x5b0cc5];}_0x5eba95[_0x7568('0xf')]();});_0x2cb0f1['rules'][_0x5b0cc5]['on']('complete',function(){if(_0x2cb0f1[_0x7568('0x16')][_0x5b0cc5]){delete _0x2cb0f1[_0x7568('0x16')][_0x5b0cc5];}});_0x299095=setTimeout(function(){logger[_0x7568('0x18')](_0x7568('0x19'),_0x5b0cc5);clearTimeout(_0x299095);_0x50b7bd[_0x7568('0x1a')]();_0x5eba95['next']();},_0x3d4c48);strategy[_0x7568('0x1b')](_0x50b7bd,_0x4b3d48,_0x2cb0f1,_0x316e29);}else{logger['error'](_0x7568('0x1c'),_0x5b0cc5,_0x32715c[_0x7568('0xb')]);_0x5eba95[_0x7568('0xf')]();}}}catch(_0x39d230){console[_0x7568('0x1d')](_0x39d230);logger[_0x7568('0x1e')]('[%s][QUEUE]\x20%s',_0x5b0cc5,_0x39d230['stack']);_0x5eba95[_0x7568('0xf')]();}};}; \ No newline at end of file +var _0x6ecd=['agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','[%s][AGENT]\x20%s','message','stop','agents','timeout','createQueue','atimeout','channel','end','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6ecd,0xf3));var _0xd6ec=function(_0x5d6b80,_0x3bcc64){_0x5d6b80=_0x5d6b80-0x0;var _0x302250=_0x6ecd[_0x5d6b80];return _0x302250;};'use strict';var schema=require(_0xd6ec('0x0'));var _=require(_0xd6ec('0x1'));var util=require('util');var seqqueue=require(_0xd6ec('0x2'));var logger=require(_0xd6ec('0x3'))('routing');var strategy=require(_0xd6ec('0x4'));var queue=schema({'name':{'type':_0xd6ec('0x5'),'required':!![],'message':_0xd6ec('0x6')},'timeout':{'type':_0xd6ec('0x7'),'message':_0xd6ec('0x8')}});function writeLog(_0x949585,_0x425561,_0x17f4ce){return logger[_0xd6ec('0x9')](util[_0xd6ec('0xa')](_0xd6ec('0xb'),_0x949585,_0x425561[_0xd6ec('0xc')],_0x17f4ce));}function handleFindAgent(_0x4e789d){return function(_0x4d31e2){return _0x4d31e2[_0xd6ec('0xc')][_0xd6ec('0xd')]()===_0x4e789d[_0xd6ec('0xd')]();};}exports['consequence']=function(_0x2b6a46,_0x1005b2,_0x12e9ad,_0x534b08){return function(_0x36ee3c){try{var _0x55c37b={'name':_0x1005b2[0x0],'timeout':_0x1005b2[0x1]};var _0x45f6a5=queue['validate'](_0x55c37b,{'typecast':!![]});if(_0x45f6a5[_0xd6ec('0xe')]){logger['error'](_0xd6ec('0xf'),_0x2b6a46,_['map'](_0x45f6a5,_0xd6ec('0x10'))['join'](',\x20'));_0x36ee3c[_0xd6ec('0x11')]();}else{var _0x457fb4=_['find'](_0x12e9ad[_0xd6ec('0x12')],handleFindAgent(_0x55c37b[_0xd6ec('0xc')]));if(_0x457fb4){var _0x50766e=(_0x55c37b[_0xd6ec('0x13')]||0xa)*0x3e8;var _0x41c004,_0x15aae6;var _0x37a9c5=seqqueue[_0xd6ec('0x14')](_0x50766e);_0x37a9c5['id']=_0x2b6a46;_0x37a9c5[_0xd6ec('0x15')]=_0x50766e;_0x37a9c5[_0xd6ec('0x16')]=_0x534b08['channel'];writeLog(_0x2b6a46,_0x457fb4,util[_0xd6ec('0xa')]('START:%s',_0x50766e));_0x12e9ad['rules'][_0x2b6a46]['on'](_0xd6ec('0x17'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x2b6a46);clearTimeout(_0x15aae6);_0x15aae6=undefined;_0x37a9c5[_0xd6ec('0x18')]();if(_0x12e9ad[_0xd6ec('0x19')][_0x2b6a46]){delete _0x12e9ad[_0xd6ec('0x19')][_0x2b6a46];}_0x36ee3c[_0xd6ec('0x11')]();});_0x12e9ad['rules'][_0x2b6a46]['on'](_0xd6ec('0x1a'),function(){if(_0x12e9ad[_0xd6ec('0x19')][_0x2b6a46]){delete _0x12e9ad[_0xd6ec('0x19')][_0x2b6a46];}});_0x15aae6=setTimeout(function(){logger['info'](_0xd6ec('0x1b'),_0x2b6a46);clearTimeout(_0x15aae6);_0x37a9c5[_0xd6ec('0x18')]();_0x36ee3c[_0xd6ec('0x1c')]();},_0x50766e);strategy[_0xd6ec('0x1d')](_0x37a9c5,_0x457fb4,_0x12e9ad,_0x534b08);}else{logger[_0xd6ec('0x1e')](_0xd6ec('0x1f'),_0x2b6a46,_0x55c37b[_0xd6ec('0xc')]);_0x36ee3c[_0xd6ec('0x11')]();}}}catch(_0x3f0786){console[_0xd6ec('0x20')](_0x3f0786);logger['error'](_0xd6ec('0x21'),_0x2b6a46,_0x3f0786['stack']);_0x36ee3c['stop']();}};}; \ 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 dcd7a7d..04de58a 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 _0xe2d7=['account','upperFirst','InteractionId','isEmpty','body','create','then','catch','error','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','message','postText','amazonlex','Message','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0xe2d7,0x165));var _0x7e2d=function(_0x2a5887,_0x7afc64){_0x2a5887=_0x2a5887-0x0;var _0x5a3603=_0xe2d7[_0x2a5887];return _0x5a3603;};'use strict';var _=require(_0x7e2d('0x0'));var moment=require(_0x7e2d('0x1'));var AWS=require(_0x7e2d('0x2'));var utils=require(_0x7e2d('0x3'));var logger=require(_0x7e2d('0x4'))(_0x7e2d('0x5'));var rpc={'chatMessage':require(_0x7e2d('0x6')),'openchannelMessage':require(_0x7e2d('0x7')),'mailMessage':require(_0x7e2d('0x8')),'smsMessage':require(_0x7e2d('0x9')),'faxMessage':require(_0x7e2d('0xa')),'whatsappMessage':require(_0x7e2d('0xb'))};exports[_0x7e2d('0xc')]=function(_0x2cb807,_0x4983b5){return function(_0x289862){try{if(!_['isNil'](this['interaction'][_0x7e2d('0xd')])){logger['info'](_0x7e2d('0xe'),_0x2cb807,_0x7e2d('0xf'));return _0x289862[_0x7e2d('0x10')]();}var _0x48a420={'ContactId':this['contact']['id'],'sentAt':moment()[_0x7e2d('0x11')](_0x7e2d('0x12')),'direction':_0x7e2d('0x13')};if(this[_0x7e2d('0x14')]===_0x7e2d('0x15')||this['channel']===_0x7e2d('0x16')){_0x48a420[_0x7e2d('0x17')]=this[_0x7e2d('0x18')][_0x7e2d('0x17')];}var _0x4b5148=this[_0x7e2d('0x14')];if(_0x4b5148===_0x7e2d('0x19')){_0x48a420[_0x7e2d('0x1a')]=this[_0x7e2d('0x1b')]['id'];}else{_0x48a420[_[_0x7e2d('0x1c')](_0x4b5148)+'AccountId']=this['account']['id'];}_0x48a420[_[_0x7e2d('0x1c')](_0x4b5148)+_0x7e2d('0x1d')]=this['interaction']['id'];if(this[_0x7e2d('0x18')]['created']){var _0x212651=_0x4983b5[0x4];if(!_[_0x7e2d('0x1e')](_0x212651)){_0x48a420[_0x7e2d('0x1f')]=utils['getMustacheRender'](_0x212651,this);return rpc[_0x4b5148+'Message'][_0x7e2d('0x20')](_0x48a420)[_0x7e2d('0x21')](function(_0x51ff88){logger['info'](_0x7e2d('0xe'),_0x2cb807,_0x48a420[_0x7e2d('0x1f')]);})[_0x7e2d('0x22')](function(_0xe97bc8){logger[_0x7e2d('0x23')](_0x7e2d('0xe'),_0x2cb807,JSON[_0x7e2d('0x24')](_0xe97bc8));})[_0x7e2d('0x25')](function(){logger[_0x7e2d('0x26')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2cb807);_0x289862['stop']();});}else{logger['info'](_0x7e2d('0x27'),_0x2cb807);_0x289862[_0x7e2d('0x28')]();}}else{var _0x3b8290=this;var _0x50627e=new AWS[(_0x7e2d('0x29'))]({'accessKeyId':_0x4983b5[0x0],'secretAccessKey':_0x4983b5[0x1],'region':_0x4983b5[0x2]});var _0x32f902={'botAlias':'$LATEST','botName':_0x4983b5[0x3],'inputText':this[_0x7e2d('0x2a')][_0x7e2d('0x1f')],'userId':this[_0x7e2d('0x14')]+':'+this[_0x7e2d('0x18')]['id']['toString']()};_0x50627e[_0x7e2d('0x2b')](_0x32f902,function(_0x183470,_0x10f614){if(_0x183470){logger['error'](_0x7e2d('0xe'),_0x2cb807,_0x183470[_0x7e2d('0x2a')]);_0x289862[_0x7e2d('0x10')]();}else if(_0x10f614&&_0x10f614[_0x7e2d('0x2a')]){_0x3b8290[_0x7e2d('0x1f')][_0x7e2d('0x2c')]=_0x10f614;_0x48a420[_0x7e2d('0x1f')]=_0x10f614[_0x7e2d('0x2a')];_0x48a420['providerName']=_0x7e2d('0x2c');_0x48a420['providerResponse']=JSON[_0x7e2d('0x24')](_0x10f614);return rpc[_0x4b5148+_0x7e2d('0x2d')][_0x7e2d('0x20')](_0x48a420)[_0x7e2d('0x21')](function(_0x571190){logger[_0x7e2d('0x26')](_0x7e2d('0xe'),_0x2cb807,_0x48a420[_0x7e2d('0x1f')]);if(_0x10f614[_0x7e2d('0x2e')]==_0x7e2d('0x2f')){_0x289862[_0x7e2d('0x10')]();}else{_0x289862[_0x7e2d('0x28')]();}})[_0x7e2d('0x22')](function(_0x24fbed){logger[_0x7e2d('0x23')](_0x7e2d('0xe'),_0x2cb807,JSON['stringify'](_0x24fbed));_0x289862[_0x7e2d('0x10')]();});}else{_0x289862[_0x7e2d('0x10')]();}});}}catch(_0x2e2ee5){logger[_0x7e2d('0x23')]('[%s][AMAZONLEX]\x20%s',_0x2cb807,JSON[_0x7e2d('0x24')](_0x2e2ee5));_0x289862[_0x7e2d('0x28')]();}};}; \ No newline at end of file +var _0xb59f=['moment','./utils','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerResponse','dialogState','lodash'];(function(_0x152c94,_0x1b9c39){var _0x4c46e8=function(_0xc758f1){while(--_0xc758f1){_0x152c94['push'](_0x152c94['shift']());}};_0x4c46e8(++_0x1b9c39);}(_0xb59f,0x156));var _0xfb59=function(_0x30c46e,_0x2cb935){_0x30c46e=_0x30c46e-0x0;var _0xe042c5=_0xb59f[_0x30c46e];return _0xe042c5;};'use strict';var _=require(_0xfb59('0x0'));var moment=require(_0xfb59('0x1'));var AWS=require('aws-sdk');var utils=require(_0xfb59('0x2'));var logger=require(_0xfb59('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xfb59('0x4')),'smsMessage':require(_0xfb59('0x5')),'faxMessage':require(_0xfb59('0x6')),'whatsappMessage':require(_0xfb59('0x7'))};exports[_0xfb59('0x8')]=function(_0x34eaec,_0x2f493c){return function(_0x5871a4){try{if(!_[_0xfb59('0x9')](this[_0xfb59('0xa')][_0xfb59('0xb')])){logger[_0xfb59('0xc')](_0xfb59('0xd'),_0x34eaec,_0xfb59('0xe'));return _0x5871a4[_0xfb59('0xf')]();}var _0x48a0c5={'ContactId':this[_0xfb59('0x10')]['id'],'sentAt':moment()[_0xfb59('0x11')](_0xfb59('0x12')),'direction':_0xfb59('0x13')};if(this[_0xfb59('0x14')]==='sms'||this['channel']===_0xfb59('0x15')){_0x48a0c5['phone']=this[_0xfb59('0xa')][_0xfb59('0x16')];}var _0x3d7b3d=this[_0xfb59('0x14')];if(_0x3d7b3d==='chat'){_0x48a0c5[_0xfb59('0x17')]=this['account']['id'];}else{_0x48a0c5[_['upperFirst'](_0x3d7b3d)+_0xfb59('0x18')]=this[_0xfb59('0x19')]['id'];}_0x48a0c5[_[_0xfb59('0x1a')](_0x3d7b3d)+_0xfb59('0x1b')]=this[_0xfb59('0xa')]['id'];if(this[_0xfb59('0xa')][_0xfb59('0x1c')]){var _0x5a0116=_0x2f493c[0x4];if(!_['isEmpty'](_0x5a0116)){_0x48a0c5[_0xfb59('0x1d')]=utils[_0xfb59('0x1e')](_0x5a0116,this);return rpc[_0x3d7b3d+_0xfb59('0x1f')][_0xfb59('0x20')](_0x48a0c5)[_0xfb59('0x21')](function(_0x1ad628){logger[_0xfb59('0xc')](_0xfb59('0xd'),_0x34eaec,_0x48a0c5[_0xfb59('0x1d')]);})[_0xfb59('0x22')](function(_0x445eef){logger[_0xfb59('0x23')](_0xfb59('0xd'),_0x34eaec,JSON[_0xfb59('0x24')](_0x445eef));})[_0xfb59('0x25')](function(){logger[_0xfb59('0xc')](_0xfb59('0x26'),_0x34eaec);_0x5871a4['stop']();});}else{logger[_0xfb59('0xc')](_0xfb59('0x27'),_0x34eaec);_0x5871a4[_0xfb59('0x28')]();}}else{var _0x48bda7=this;var _0x2b581a=new AWS[(_0xfb59('0x29'))]({'accessKeyId':_0x2f493c[0x0],'secretAccessKey':_0x2f493c[0x1],'region':_0x2f493c[0x2]});var _0x4c9731={'botAlias':_0xfb59('0x2a'),'botName':_0x2f493c[0x3],'inputText':this[_0xfb59('0x2b')][_0xfb59('0x1d')],'userId':this[_0xfb59('0x14')]+':'+this[_0xfb59('0xa')]['id'][_0xfb59('0x2c')]()};_0x2b581a[_0xfb59('0x2d')](_0x4c9731,function(_0x9938d8,_0x53be6e){if(_0x9938d8){logger[_0xfb59('0x23')]('[%s][AMAZONLEX]\x20%s',_0x34eaec,_0x9938d8[_0xfb59('0x2b')]);_0x5871a4[_0xfb59('0xf')]();}else if(_0x53be6e&&_0x53be6e[_0xfb59('0x2b')]){_0x48bda7[_0xfb59('0x1d')][_0xfb59('0x2e')]=_0x53be6e;_0x48a0c5[_0xfb59('0x1d')]=_0x53be6e[_0xfb59('0x2b')];_0x48a0c5['providerName']='amazonlex';_0x48a0c5[_0xfb59('0x2f')]=JSON[_0xfb59('0x24')](_0x53be6e);return rpc[_0x3d7b3d+'Message']['create'](_0x48a0c5)[_0xfb59('0x21')](function(_0x5f594d){logger[_0xfb59('0xc')](_0xfb59('0xd'),_0x34eaec,_0x48a0c5[_0xfb59('0x1d')]);if(_0x53be6e[_0xfb59('0x30')]=='Failed'){_0x5871a4[_0xfb59('0xf')]();}else{_0x5871a4[_0xfb59('0x28')]();}})[_0xfb59('0x22')](function(_0x546224){logger[_0xfb59('0x23')](_0xfb59('0xd'),_0x34eaec,JSON['stringify'](_0x546224));_0x5871a4['next']();});}else{_0x5871a4[_0xfb59('0xf')]();}});}}catch(_0x21cfc9){logger['error'](_0xfb59('0xd'),_0x34eaec,JSON['stringify'](_0x21cfc9));_0x5871a4[_0xfb59('0x28')]();}};}; \ 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 50d26ba..f0db0d7 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 _0x1a64=['read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','inReplyTo','html','replace',''+_[_0x41a6('0x2f')](_0x2664bc[_0x41a6('0x1e')],_0x41a6('0x30'),_0x41a6('0x31'))+'';_0x2664bc[_0x41a6('0x32')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x41a6('0x33'),'Precedence':_0x41a6('0x34')};return mailRpc[_0x41a6('0x35')](this[_0x41a6('0x29')][_0x41a6('0x36')],_0x2664bc)[_0x41a6('0x37')](function(_0x233876){logger[_0x41a6('0x13')](_0x41a6('0x38'),_0x5b4c99);_0x2664bc[_0x41a6('0x39')]=_0x233876[_0x41a6('0x20')]['messageId'];return rpc[_0x43c415+'Message'][_0x41a6('0x3a')](_0x2664bc);})['then'](function(_0x43a130){logger[_0x41a6('0x13')](_0x41a6('0x14'),_0x5b4c99,JSON[_0x41a6('0x3b')](_0x43a130));})[_0x41a6('0x3c')](function(_0x14160f){logger[_0x41a6('0x3d')](_0x41a6('0x3e'),_0x5b4c99,JSON['stringify'](_0x14160f));})['finally'](function(){Promise['resolve']()['then'](function(){if(_0x1a229a[0x0]!=='2'||_0x4cdc4d[_0x41a6('0x3f')])return;return rpc[_0x43c415+_0x41a6('0x40')][_0x41a6('0x41')](_0x4cdc4d['id'],{'autoreplyExecuted':!![]})['then'](function(_0x82890b){logger[_0x41a6('0x13')](_0x41a6('0x19'),_0x5b4c99,JSON[_0x41a6('0x3b')](_0x82890b));})[_0x41a6('0x3c')](function(_0x295436){logger[_0x41a6('0x3d')](_0x41a6('0x42'),_0x5b4c99,JSON[_0x41a6('0x3b')](_0x295436));});})[_0x41a6('0x37')](function(){_0x16b411[_0x41a6('0x16')]();});});}else{return rpc[this[_0x41a6('0x22')]+_0x41a6('0x2c')][_0x41a6('0x3a')](_0x2664bc)['then'](function(){logger['info'](_0x41a6('0x14'),_0x5b4c99,_0x2664bc[_0x41a6('0x1e')]);})[_0x41a6('0x3c')](function(_0x33c8cb){logger[_0x41a6('0x3d')](_0x41a6('0x14'),_0x5b4c99,JSON[_0x41a6('0x3b')](_0x33c8cb));})['finally'](function(){Promise['resolve']()[_0x41a6('0x37')](function(){if(_0x1a229a[0x0]!=='2'||_0x4cdc4d[_0x41a6('0x3f')])return;return rpc[_0x43c415+_0x41a6('0x40')]['update'](_0x4cdc4d['id'],{'autoreplyExecuted':!![]})['then'](function(_0x140d0a){logger['info'](_0x41a6('0x19'),_0x5b4c99,JSON[_0x41a6('0x3b')](_0x140d0a));})[_0x41a6('0x3c')](function(_0x261d63){logger[_0x41a6('0x3d')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5b4c99,JSON[_0x41a6('0x3b')](_0x261d63));});})[_0x41a6('0x37')](function(){_0x16b411[_0x41a6('0x16')]();});});}}}catch(_0x4cdf23){logger[_0x41a6('0x3d')]('[%s][AUTOREPLY]\x20%s',_0x5b4c99,JSON[_0x41a6('0x3b')](_0x4cdf23));_0x16b411[_0x41a6('0x43')]();}};}; \ No newline at end of file +var _0x8df3=['replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','error','stringify','finally','resolve','then','Interaction','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','body','info','[%s][AUTOREPLY]\x20%s','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','phone','read','subject','chat','ChatWebsiteId','upperFirst','account','InteractionId','Message','inReplyTo','html',''];(function(_0x6e973,_0x69d690){var _0x277fd4=function(_0x439c80){while(--_0x439c80){_0x6e973['push'](_0x6e973['shift']());}};_0x277fd4(++_0x69d690);}(_0x8df3,0x9c));var _0x38df=function(_0xf86763,_0x447ca7){_0xf86763=_0xf86763-0x0;var _0x553716=_0x8df3[_0xf86763];return _0x553716;};'use strict';var _=require(_0x38df('0x0'));var moment=require(_0x38df('0x1'));var utils=require(_0x38df('0x2'));var logger=require('../../../../config/logger')(_0x38df('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x38df('0x4')),'mailMessage':require(_0x38df('0x5')),'smsMessage':require(_0x38df('0x6')),'faxMessage':require(_0x38df('0x7')),'whatsappMessage':require(_0x38df('0x8')),'chatInteraction':require(_0x38df('0x9')),'openchannelInteraction':require(_0x38df('0xa')),'mailInteraction':require(_0x38df('0xb')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x38df('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x38df('0xd'));exports[_0x38df('0xe')]=function(_0x19fd8b,_0x538024,_0x1771ed,_0x53c6a6){return function(_0x3d393b){try{var _0xf6f83b=this[_0x38df('0xf')];if(_0xf6f83b==='mail'&&_0x53c6a6[_0x38df('0x10')]['isAutoreply']){logger[_0x38df('0x11')](_0x38df('0x12'),_0x19fd8b,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x3d393b[_0x38df('0x13')]();}if(_0x538024[0x0]==='1'&&(_[_0x38df('0x14')](this[_0x38df('0x15')][_0x38df('0x16')])||!this[_0x38df('0x15')][_0x38df('0x16')])){logger[_0x38df('0x11')]('[%s][AUTOREPLY]\x20%s',_0x19fd8b,_0x38df('0x17'));return _0x3d393b[_0x38df('0x13')]();}if(_0x538024[0x0]==='2'&&this[_0x38df('0x15')][_0x38df('0x18')]){logger['info'](_0x38df('0x19'),_0x19fd8b,'One\x20Time\x20already\x20sent');return _0x3d393b[_0x38df('0x13')]();}var _0xafc08f={'ContactId':this[_0x38df('0x1a')]['id'],'sentAt':moment()[_0x38df('0x1b')](_0x38df('0x1c')),'direction':_0x38df('0x1d')};if(this[_0x38df('0xf')]===_0x38df('0x1e')){_0xafc08f['body']=utils[_0x38df('0x1f')](_0x538024[0x2],this);}else{_0xafc08f[_0x38df('0x10')]=utils[_0x38df('0x1f')](_0x538024[0x1],this);}if(this[_0x38df('0x20')]){_0xafc08f['to']=this[_0x38df('0x20')]['from']||'';if(this[_0x38df('0xf')]===_0x38df('0x1e')&&_0x538024[0x1]==='1'){_0xafc08f['cc']=this[_0x38df('0x20')]['cc']||'';}_0xafc08f['from']=this[_0x38df('0x20')]['to']||'';_0xafc08f[_0x38df('0x21')]=this['message'][_0x38df('0x21')]||'';_0xafc08f[_0x38df('0x22')]=!![];if(this[_0x38df('0x20')][_0x38df('0x23')]){_0xafc08f[_0x38df('0x23')]='';_0xafc08f[_0x38df('0x23')]+=_['startsWith'](this[_0x38df('0x20')][_0x38df('0x23')],'Re:')?'':'Re:\x20';_0xafc08f[_0x38df('0x23')]+=this[_0x38df('0x20')][_0x38df('0x23')];}}if(this[_0x38df('0xf')]===_0x38df('0x24')){_0xafc08f[_0x38df('0x25')]=this['account']['id'];}else{_0xafc08f[_[_0x38df('0x26')](this[_0x38df('0xf')])+'AccountId']=this[_0x38df('0x27')]['id'];}_0xafc08f[_[_0x38df('0x26')](this[_0x38df('0xf')])+_0x38df('0x28')]=this[_0x38df('0x15')]['id'];var _0x473152=this[_0x38df('0x15')];if(rpc[this[_0x38df('0xf')]+_0x38df('0x29')]){if(this[_0x38df('0xf')]===_0x38df('0x1e')){_0xafc08f[_0x38df('0x2a')]=this['message']['messageId'];_0xafc08f[_0x38df('0x2b')]=_0x38df('0x2c')+_[_0x38df('0x2d')](_0xafc08f[_0x38df('0x10')],']+(>|$)/g,''),'priorityTrue':_0x4ce05a[0x1],'priorityFalse':_0x4ce05a[0x2]};var _0x5d5c3b=gotoif['validate'](_0x332480,{'typecast':!![]});if(_0x5d5c3b['length']){logger[_0x3db6('0xd')]('[%s][GOTOIF]\x20%s',_0x4ab40a,_[_0x3db6('0xe')](_0x5d5c3b,_0x3db6('0xf'))[_0x3db6('0x10')](',\x20'));_0x56ef06[_0x3db6('0x11')]();}else{try{var _0x72e58d=eval('('+_0x332480[_0x3db6('0x12')]+')');var _0x571a30=_0x72e58d?_0x332480[_0x3db6('0x13')]:_0x332480['priorityFalse'];logger['info'](_0x3db6('0x14'),_0x4ab40a,_0x332480[_0x3db6('0x12')],_0x72e58d,_0x571a30||'next');if(_0x571a30){var _0x56b8dd=_['findIndex'](_0x56ef06['rules'](),{'p':_0x571a30});if(_0x56b8dd>=0x0){logger[_0x3db6('0x15')](_0x3db6('0x16'),_0x4ab40a,_0x571a30||_0x3db6('0x17'),_0x56b8dd);_0x56ef06['next'](_0x56b8dd);}else{logger[_0x3db6('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x4ab40a,_0x571a30||_0x3db6('0x17'));_0x56ef06[_0x3db6('0x11')]();}}else{_0x56ef06[_0x3db6('0x17')]();}}catch(_0xf09c97){logger[_0x3db6('0xd')](_0x3db6('0x18'),_0x4ab40a,_0xf09c97['message']);_0x56ef06[_0x3db6('0x11')]();}}}catch(_0x1136be){logger['error'](_0x3db6('0x19'),_0x4ab40a,JSON[_0x3db6('0x1a')](_0x1136be));_0x56ef06[_0x3db6('0x11')]();}};}; \ No newline at end of file +var _0x4fe5=['consequence','fromString','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','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'];(function(_0x2179f1,_0x21c653){var _0x176ec9=function(_0x4c4a4c){while(--_0x4c4a4c){_0x2179f1['push'](_0x2179f1['shift']());}};_0x176ec9(++_0x21c653);}(_0x4fe5,0x16c));var _0x54fe=function(_0x25be3e,_0x33d5e3){_0x25be3e=_0x25be3e-0x0;var _0x218a2a=_0x4fe5[_0x25be3e];return _0x218a2a;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0x54fe('0x0'));var utils=require('./utils');var logger=require(_0x54fe('0x1'))(_0x54fe('0x2'));var gotoif=schema({'condition':{'type':_0x54fe('0x3'),'required':!![],'message':_0x54fe('0x4')},'priorityTrue':{'type':'number','message':_0x54fe('0x5')},'priorityFalse':{'type':_0x54fe('0x6'),'message':_0x54fe('0x7')}});exports[_0x54fe('0x8')]=function(_0x56ef59,_0x4ec805){return function(_0x55b39d){try{var _0x4a973e={'condition':htmlToText[_0x54fe('0x9')](utils[_0x54fe('0xa')](_0x4ec805[0x0],this),{'wordwrap':![]})[_0x54fe('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4ec805[0x1],'priorityFalse':_0x4ec805[0x2]};var _0x5ab50a=gotoif[_0x54fe('0xc')](_0x4a973e,{'typecast':!![]});if(_0x5ab50a[_0x54fe('0xd')]){logger[_0x54fe('0xe')](_0x54fe('0xf'),_0x56ef59,_[_0x54fe('0x10')](_0x5ab50a,_0x54fe('0x11'))[_0x54fe('0x12')](',\x20'));_0x55b39d['stop']();}else{try{var _0x1b66dc=eval('('+_0x4a973e[_0x54fe('0x13')]+')');var _0x4c1a4d=_0x1b66dc?_0x4a973e[_0x54fe('0x14')]:_0x4a973e[_0x54fe('0x15')];logger['info'](_0x54fe('0x16'),_0x56ef59,_0x4a973e[_0x54fe('0x13')],_0x1b66dc,_0x4c1a4d||_0x54fe('0x17'));if(_0x4c1a4d){var _0x3341e9=_['findIndex'](_0x55b39d[_0x54fe('0x18')](),{'p':_0x4c1a4d});if(_0x3341e9>=0x0){logger[_0x54fe('0x19')](_0x54fe('0x1a'),_0x56ef59,_0x4c1a4d||_0x54fe('0x17'),_0x3341e9);_0x55b39d['next'](_0x3341e9);}else{logger['info'](_0x54fe('0x1b'),_0x56ef59,_0x4c1a4d||'next');_0x55b39d[_0x54fe('0x1c')]();}}else{_0x55b39d[_0x54fe('0x17')]();}}catch(_0x841f16){logger['error'](_0x54fe('0x1d'),_0x56ef59,_0x841f16[_0x54fe('0x11')]);_0x55b39d['stop']();}}}catch(_0x2b6f42){logger[_0x54fe('0xe')](_0x54fe('0xf'),_0x56ef59,JSON[_0x54fe('0x1e')](_0x2b6f42));_0x55b39d['stop']();}};}; \ 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 42d740b..07f8ad0 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 _0x1570=['priority','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x1570,0xd6));var _0x0157=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x1570[_0x37bd26];return _0xe83dc4;};'use strict';var schema=require(_0x0157('0x0'));var _=require(_0x0157('0x1'));var logger=require(_0x0157('0x2'))(_0x0157('0x3'));var gotop=schema({'priority':{'type':_0x0157('0x4'),'required':!![],'message':_0x0157('0x5')}});exports[_0x0157('0x6')]=function(_0x3c55d3,_0x3d4ac8){return function(_0xf5075d){try{var _0x2b128d={'priority':_0x3d4ac8[0x0]};var _0x36e5ff=gotop['validate'](_0x2b128d,{'typecast':!![]});if(_0x36e5ff[_0x0157('0x7')]){logger['error'](_0x0157('0x8'),_0x3c55d3,_[_0x0157('0x9')](_0x36e5ff,_0x0157('0xa'))['join'](',\x20'));_0xf5075d[_0x0157('0xb')]();}else{logger[_0x0157('0xc')](_0x0157('0xd'),_0x3c55d3,_0x2b128d[_0x0157('0xe')]);if(_0x2b128d[_0x0157('0xe')]){var _0xf8e1e8=_['findIndex'](_0xf5075d[_0x0157('0xf')](),{'p':_0x2b128d[_0x0157('0xe')]});if(_0xf8e1e8>=0x0){logger[_0x0157('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3c55d3,_0x2b128d[_0x0157('0xe')]||_0x0157('0x10'),_0xf8e1e8);_0xf5075d[_0x0157('0x10')](_0xf8e1e8);}else{logger['info'](_0x0157('0x11'),_0x3c55d3,_0x2b128d[_0x0157('0xe')]||_0x0157('0x10'));_0xf5075d[_0x0157('0xb')]();}}else{_0xf5075d[_0x0157('0x10')]();}}}catch(_0x4e56b7){logger[_0x0157('0x12')](_0x0157('0x8'),_0x3c55d3,JSON['stringify'](_0x4e56b7));_0xf5075d[_0x0157('0xb')]();}};}; \ No newline at end of file +var _0x1472=['message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','routing','number','consequence','[%s][GOTOP]\x20%s','map'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0x1472,0x1e7));var _0x2147=function(_0x45fe9c,_0x55e0d7){_0x45fe9c=_0x45fe9c-0x0;var _0x233d48=_0x1472[_0x45fe9c];return _0x233d48;};'use strict';var schema=require(_0x2147('0x0'));var _=require(_0x2147('0x1'));var logger=require('../../../../config/logger')(_0x2147('0x2'));var gotop=schema({'priority':{'type':_0x2147('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x2147('0x4')]=function(_0x5eb83b,_0x2e6da3){return function(_0x1248de){try{var _0x118fce={'priority':_0x2e6da3[0x0]};var _0x52d6da=gotop['validate'](_0x118fce,{'typecast':!![]});if(_0x52d6da['length']){logger['error'](_0x2147('0x5'),_0x5eb83b,_[_0x2147('0x6')](_0x52d6da,_0x2147('0x7'))['join'](',\x20'));_0x1248de[_0x2147('0x8')]();}else{logger[_0x2147('0x9')](_0x2147('0xa'),_0x5eb83b,_0x118fce[_0x2147('0xb')]);if(_0x118fce['priority']){var _0x5edfa0=_[_0x2147('0xc')](_0x1248de[_0x2147('0xd')](),{'p':_0x118fce[_0x2147('0xb')]});if(_0x5edfa0>=0x0){logger[_0x2147('0x9')](_0x2147('0xe'),_0x5eb83b,_0x118fce[_0x2147('0xb')]||_0x2147('0xf'),_0x5edfa0);_0x1248de[_0x2147('0xf')](_0x5edfa0);}else{logger[_0x2147('0x9')](_0x2147('0x10'),_0x5eb83b,_0x118fce[_0x2147('0xb')]||'next');_0x1248de[_0x2147('0x8')]();}}else{_0x1248de[_0x2147('0xf')]();}}}catch(_0x2dfc61){logger[_0x2147('0x11')](_0x2147('0x5'),_0x5eb83b,JSON[_0x2147('0x12')](_0x2dfc61));_0x1248de[_0x2147('0x8')]();}};}; \ 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 9d064f7..9eb938f 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 _0x35d4=['then','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','channel','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','create'];(function(_0x54c536,_0x17c283){var _0x5eab53=function(_0x49c94e){while(--_0x49c94e){_0x54c536['push'](_0x54c536['shift']());}};_0x5eab53(++_0x17c283);}(_0x35d4,0x1e7));var _0x435d=function(_0xd354,_0x35b31b){_0xd354=_0xd354-0x0;var _0xb82a29=_0x35d4[_0xd354];return _0xb82a29;};'use strict';var _=require(_0x435d('0x0'));var utils=require('./utils');var logger=require(_0x435d('0x1'))(_0x435d('0x2'));var rpc={'chatMessage':require(_0x435d('0x3')),'openchannelMessage':require(_0x435d('0x4')),'mailMessage':require(_0x435d('0x5')),'smsMessage':require(_0x435d('0x6')),'faxMessage':require(_0x435d('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x435d('0x8')]=function(_0x1f63d8,_0x550c5d){return function(_0x539a8d){try{var _0x2b1cc7={'body':utils['getMustacheRender'](_0x550c5d[0x0],this),'ContactId':this['contact']['id']};if(this[_0x435d('0x9')]==='chat'){_0x2b1cc7[_0x435d('0xa')]=this[_0x435d('0xb')]['id'];}else{_0x2b1cc7[_[_0x435d('0xc')](this[_0x435d('0x9')])+_0x435d('0xd')]=this[_0x435d('0xb')]['id'];}_0x2b1cc7[_[_0x435d('0xc')](this[_0x435d('0x9')])+'InteractionId']=this[_0x435d('0xe')]['id'];if(rpc[this[_0x435d('0x9')]+_0x435d('0xf')]){return rpc[this['channel']+_0x435d('0xf')][_0x435d('0x10')](_0x2b1cc7)[_0x435d('0x11')](function(_0xbc1db4){logger['info'](_0x435d('0x12'),_0x1f63d8,_0x2b1cc7['body']);_0x539a8d[_0x435d('0x13')]();})[_0x435d('0x14')](function(_0x512911){logger[_0x435d('0x15')](_0x435d('0x12'),_0x1f63d8,JSON[_0x435d('0x16')](_0x512911));_0x539a8d['stop']();});}}catch(_0x505ebe){logger['error'](_0x435d('0x12'),_0x1f63d8,JSON['stringify'](_0x505ebe));_0x539a8d[_0x435d('0x17')]();}};}; \ No newline at end of file +var _0x4f54=['catch','error','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','contact','channel','chat','account','upperFirst','InteractionId','interaction','Message','then','[%s][MESSAGE]\x20%s','body','next'];(function(_0x148f16,_0x181dcc){var _0x3ea242=function(_0x30ef95){while(--_0x30ef95){_0x148f16['push'](_0x148f16['shift']());}};_0x3ea242(++_0x181dcc);}(_0x4f54,0x123));var _0x44f5=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x4f54[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x44f5('0x0'));var utils=require(_0x44f5('0x1'));var logger=require(_0x44f5('0x2'))(_0x44f5('0x3'));var rpc={'chatMessage':require(_0x44f5('0x4')),'openchannelMessage':require(_0x44f5('0x5')),'mailMessage':require(_0x44f5('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x44f5('0x7')),'whatsappMessage':require(_0x44f5('0x8'))};exports['consequence']=function(_0x5560fa,_0x4b15c6){return function(_0x5815ed){try{var _0x269636={'body':utils['getMustacheRender'](_0x4b15c6[0x0],this),'ContactId':this[_0x44f5('0x9')]['id']};if(this[_0x44f5('0xa')]===_0x44f5('0xb')){_0x269636['ChatWebsiteId']=this[_0x44f5('0xc')]['id'];}else{_0x269636[_[_0x44f5('0xd')](this[_0x44f5('0xa')])+'AccountId']=this[_0x44f5('0xc')]['id'];}_0x269636[_[_0x44f5('0xd')](this[_0x44f5('0xa')])+_0x44f5('0xe')]=this[_0x44f5('0xf')]['id'];if(rpc[this[_0x44f5('0xa')]+_0x44f5('0x10')]){return rpc[this[_0x44f5('0xa')]+_0x44f5('0x10')]['create'](_0x269636)[_0x44f5('0x11')](function(_0x43e37a){logger['info'](_0x44f5('0x12'),_0x5560fa,_0x269636[_0x44f5('0x13')]);_0x5815ed[_0x44f5('0x14')]();})[_0x44f5('0x15')](function(_0x1ae25f){logger[_0x44f5('0x16')](_0x44f5('0x12'),_0x5560fa,JSON['stringify'](_0x1ae25f));_0x5815ed[_0x44f5('0x17')]();});}}catch(_0x26361f){logger[_0x44f5('0x16')]('[%s][MESSAGE]\x20%s',_0x5560fa,JSON['stringify'](_0x26361f));_0x5815ed['stop']();}};}; \ 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 cd0b9ef..f6520d1 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 _0x16ec=['./utils','../../../../config/logger','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop'];(function(_0x49c139,_0x8a930e){var _0x374309=function(_0x4568b9){while(--_0x4568b9){_0x49c139['push'](_0x49c139['shift']());}};_0x374309(++_0x8a930e);}(_0x16ec,0x17a));var _0xc16e=function(_0x16692e,_0x3232a5){_0x16692e=_0x16692e-0x0;var _0x5b2edd=_0x16ec[_0x16692e];return _0x5b2edd;};'use strict';var utils=require(_0xc16e('0x0'));var logger=require(_0xc16e('0x1'))('routing');exports['consequence']=function(_0x41a288,_0x354fc1){return function(_0xae536c){try{logger[_0xc16e('0x2')](_0xc16e('0x3'),_0x41a288,utils[_0xc16e('0x4')](_0x354fc1[0x0],this));_0xae536c[_0xc16e('0x5')]();}catch(_0x144af0){logger[_0xc16e('0x6')]('[%s][NOOP]\x20%s',_0x41a288,JSON[_0xc16e('0x7')](_0x144af0));_0xae536c[_0xc16e('0x8')]();}};}; \ No newline at end of file +var _0xbc48=['stringify','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','next'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbc48,0x111));var _0x8bc4=function(_0x1f2a37,_0x9fb38e){_0x1f2a37=_0x1f2a37-0x0;var _0x19ba7b=_0xbc48[_0x1f2a37];return _0x19ba7b;};'use strict';var utils=require(_0x8bc4('0x0'));var logger=require(_0x8bc4('0x1'))(_0x8bc4('0x2'));exports[_0x8bc4('0x3')]=function(_0x4ec865,_0x1a2b41){return function(_0x474bef){try{logger[_0x8bc4('0x4')](_0x8bc4('0x5'),_0x4ec865,utils['getMustacheRender'](_0x1a2b41[0x0],this));_0x474bef[_0x8bc4('0x6')]();}catch(_0x52d393){logger['error']('[%s][NOOP]\x20%s',_0x4ec865,JSON[_0x8bc4('0x7')](_0x52d393));_0x474bef['stop']();}};}; \ 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 96ba920..645a93e 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 _0x06e0=['beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','util','moment','ioredis','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue','from','joinAt','emit','account','push','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','chat','info','name','QueueReport','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','catch','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','error','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','timeout','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','complete','strategy','rrmemory'];(function(_0x114ff6,_0x19e80d){var _0x4d3a58=function(_0x351ee1){while(--_0x351ee1){_0x114ff6['push'](_0x114ff6['shift']());}};_0x4d3a58(++_0x19e80d);}(_0x06e0,0x198));var _0x006e=function(_0x3b45e8,_0x628af6){_0x3b45e8=_0x3b45e8-0x0;var _0x370099=_0x06e0[_0x3b45e8];return _0x370099;};'use strict';var schema=require('validate');var _=require(_0x006e('0x0'));var util=require(_0x006e('0x1'));var seqqueue=require('seq-queue');var moment=require(_0x006e('0x2'));var Redis=require(_0x006e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x006e('0x4'))(_0x006e('0x5'));var strategy=require('./strategy');config[_0x006e('0x6')]=_[_0x006e('0x7')](config['redis'],{'host':_0x006e('0x8'),'port':0x18eb});var io=require(_0x006e('0x9'))(new Redis(config[_0x006e('0x6')]));var attributes=['id','queue_id','account',_0x006e('0xa'),_0x006e('0xb'),_0x006e('0xc')];function emit(_0x22c4e0,_0x100d7e,_0x51484f){io['to'](_0x22c4e0)[_0x006e('0xd')](_0x100d7e,_0x51484f);}function emitChannelQueueInteraction(_0x3e74ae,_0x7c39ce,_0x4f03f2,_0x288b56,_0x3b08ed,_0xda2646,_0x6ce0d7,_0xa7b593){var _0x3fb65=_['clone'](_0x4f03f2);_0x3fb65['queue_id']=_0xa7b593;_0x3fb65[_0x006e('0xa')]=_0x7c39ce;_0x3fb65[_0x006e('0xe')]=_0x288b56;_0x3fb65['id']=_0x3b08ed;if(_0xda2646){attributes[_0x006e('0xf')](_['capitalize'](_0x3e74ae)+_0x006e('0x10'));_0x6ce0d7[util[_0x006e('0x11')](_0x006e('0x12'),_0x3e74ae)][_0x3b08ed]=_['pick'](_0x3fb65,attributes);}else{delete _0x6ce0d7[util[_0x006e('0x11')](_0x006e('0x12'),_0x3e74ae)][_0x3b08ed];}emit(util[_0x006e('0x11')](_0x006e('0x13'),_0x3e74ae,_0x7c39ce),util[_0x006e('0x11')]('%s_queue_waiting_interaction:%s',_0x3e74ae,_0xda2646?_0x006e('0x14'):_0x006e('0x15')),_[_0x006e('0x16')](_0x3fb65,attributes));}var rpc={'openchannelQueueReport':require(_0x006e('0x17')),'mailQueueReport':require(_0x006e('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x006e('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x006e('0x1a')),'chatInteraction':require(_0x006e('0x1b')),'faxInteraction':require(_0x006e('0x1c')),'mailInteraction':require(_0x006e('0x1d')),'openchannelInteraction':require(_0x006e('0x1e')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x006e('0x1f'))};var queue=schema({'name':{'type':_0x006e('0x20'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x006e('0x21'),'message':_0x006e('0x22')}});function startRouting(_0x53c435,_0x2f6223,_0x58bde7,_0x1840d8){if(_0x53c435&&_0x2f6223&&_0x58bde7){_0x2f6223[_0x006e('0x23')]+=0x1;var _0x33a166={'uniqueid':_0x53c435,'from':_0x58bde7[_0x006e('0x24')]?_0x58bde7[_0x006e('0x24')][_0x006e('0xb')]:'','joinAt':moment()['format'](_0x006e('0x25')),'ContactId':_0x58bde7[_0x006e('0x26')]?_0x58bde7[_0x006e('0x26')]['id']:null,'ListId':_0x58bde7[_0x006e('0x27')]?_0x58bde7[_0x006e('0x27')]['id']:null};_0x33a166[_[_0x006e('0x28')](_0x58bde7[_0x006e('0x29')])+_0x006e('0x2a')]=_0x2f6223['id']||null;_0x33a166[_[_0x006e('0x28')](_0x58bde7[_0x006e('0x29')])+'InteractionId']=_0x58bde7[_0x006e('0x2b')]?_0x58bde7[_0x006e('0x2b')]['id']:null;_0x33a166[_[_0x006e('0x28')](_0x58bde7['channel'])+'MessageId']=_0x58bde7[_0x006e('0x2c')]?_0x58bde7[_0x006e('0x2c')]['id']:null;_0x33a166[_[_0x006e('0x28')](_0x58bde7['channel'])+(_0x58bde7['channel']!==_0x006e('0x2d')?'AccountId':'WebsiteId')]=_0x58bde7[_0x006e('0xe')]?_0x58bde7[_0x006e('0xe')]['id']:null;logger[_0x006e('0x2e')](util[_0x006e('0x11')]('[%s][START:QUEUE][NAME:%s]',_0x53c435,_0x2f6223['name']));emitChannelQueueInteraction(_0x58bde7['channel'],_0x2f6223[_0x006e('0x2f')],_0x33a166,_0x58bde7['account'][_0x006e('0x2f')],_0x58bde7[_0x006e('0x2c')]['id'],!![],_0x1840d8,_0x2f6223['id']);if(rpc[_0x58bde7[_0x006e('0x29')]+_0x006e('0x30')]){return rpc[_0x58bde7[_0x006e('0x29')]+_0x006e('0x30')]['create'](_0x33a166)['catch'](function(_0x52a80b){logger['error'](_0x006e('0x31'),_0x52a80b);});}}}function stopRouting(_0x1dd629,_0x3f5771,_0x22bf3b,_0xc7f7f3){if(_0x1dd629&&_0x3f5771){_0x3f5771['waiting']-=0x1;var _0x5a41e6={'leaveAt':moment()[_0x006e('0x11')](_0x006e('0x25')),'acceptAt':moment()[_0x006e('0x11')](_0x006e('0x25')),'reason':_0x006e('0x32')};logger['info'](util[_0x006e('0x11')](_0x006e('0x33'),_0x1dd629,_0x3f5771[_0x006e('0x2f')]));emitChannelQueueInteraction(_0x22bf3b['channel'],_0x3f5771[_0x006e('0x2f')],_0x22bf3b[_0x006e('0x24')],_0x22bf3b[_0x006e('0xe')][_0x006e('0x2f')],_0x22bf3b[_0x006e('0x2c')]['id'],![],_0xc7f7f3,_0x3f5771['id']);return rpc[_0x22bf3b[_0x006e('0x29')]+_0x006e('0x34')][_0x006e('0x35')](_0x22bf3b[_0x006e('0x2b')]['id'],{'queueId':_0x3f5771['id']})[_0x006e('0x36')](function(){if(rpc[_0x22bf3b[_0x006e('0x29')]+_0x006e('0x30')]){return rpc[_0x22bf3b['channel']+_0x006e('0x30')][_0x006e('0x35')](_0x1dd629,_0x5a41e6)[_0x006e('0x37')](function(_0x3137c7){logger['error'](_0x006e('0x38'),_0x3137c7);});}});}}function endRouting(_0x76b316,_0x58a48b,_0x61f36c,_0x31a2bb){if(_0x76b316&&_0x58a48b){_0x58a48b['waiting']-=0x1;var _0x55035f={'leaveAt':moment()['format'](_0x006e('0x25')),'exitAt':moment()[_0x006e('0x11')](_0x006e('0x25')),'reason':'timeout'};logger['info'](util['format'](_0x006e('0x39'),_0x76b316,_0x58a48b[_0x006e('0x2f')]));emitChannelQueueInteraction(_0x61f36c[_0x006e('0x29')],_0x58a48b[_0x006e('0x2f')],_0x61f36c['body'],_0x61f36c['account'][_0x006e('0x2f')],_0x61f36c[_0x006e('0x2c')]['id'],![],_0x31a2bb);if(rpc[_0x61f36c[_0x006e('0x29')]+_0x006e('0x30')]){return rpc[_0x61f36c[_0x006e('0x29')]+_0x006e('0x30')][_0x006e('0x35')](_0x76b316,_0x55035f)[_0x006e('0x37')](function(_0x5e1752){logger[_0x006e('0x3a')](_0x006e('0x38'),_0x5e1752);});}}}function handleFindQueue(_0x54862a){return function(_0x490792){return _0x490792[_0x006e('0x2f')][_0x006e('0x3b')]()===_0x54862a['toLowerCase']();};}exports[_0x006e('0x3c')]=function(_0x2083e7,_0x227e02,_0x50190d,_0x52aed6){return function(_0x276f55){try{var _0x3277d3={'name':_0x227e02[0x0],'timeout':_0x227e02[0x1]};var _0x4ebfce=queue[_0x006e('0x3d')](_0x3277d3,{'typecast':!![]});if(_0x4ebfce[_0x006e('0x3e')]){logger['error'](_0x006e('0x3f'),_0x2083e7,_[_0x006e('0x40')](_0x4ebfce,_0x006e('0x2c'))['join'](',\x20'));_0x276f55[_0x006e('0x41')]();}else{var _0x595376=_[_0x006e('0x42')](_0x50190d[_0x52aed6[_0x006e('0x29')]+_0x006e('0x43')],handleFindQueue(_0x3277d3[_0x006e('0x2f')]));if(_0x595376){startRouting(_0x2083e7,_0x595376,_0x52aed6,_0x50190d);var _0x9b7484=(_0x595376[_0x006e('0x44')]||0xa)*0x3e8;var _0x11b678=(_0x3277d3[_0x006e('0x44')]||0x14)*0x3e8;var _0x2dc0b6;if(_0x9b7484>_0x11b678){_0x11b678=_0x9b7484;}var _0x1ac35c=seqqueue[_0x006e('0x45')](_0x9b7484);_0x1ac35c['id']=_0x2083e7;_0x1ac35c[_0x006e('0x46')]=_0x9b7484;_0x1ac35c[_0x006e('0x47')]=_0x11b678;_0x1ac35c[_0x006e('0x29')]=_0x52aed6[_0x006e('0x29')];_0x50190d['rules'][_0x2083e7]['on'](_0x006e('0x48'),function(){logger[_0x006e('0x2e')](_0x006e('0x49'),_0x2083e7);stopRouting(_0x2083e7,_0x595376,_0x52aed6,_0x50190d);clearTimeout(_0x2dc0b6);_0x2dc0b6=undefined;_0x1ac35c['close'](!![]);if(_0x50190d[_0x006e('0x4a')][_0x2083e7]){delete _0x50190d[_0x006e('0x4a')][_0x2083e7];}_0x276f55['stop']();});_0x50190d['rules'][_0x2083e7]['on'](_0x006e('0x4b'),function(){if(_0x50190d['rules'][_0x2083e7]){delete _0x50190d['rules'][_0x2083e7];}});_0x2dc0b6=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x2083e7);endRouting(_0x2083e7,_0x595376,_0x52aed6,_0x50190d);clearTimeout(_0x2dc0b6);_0x1ac35c['close'](!![]);_0x276f55['next']();},_0x11b678);switch(_0x595376[_0x006e('0x4c')]){case _0x006e('0x4d'):strategy['rrmemory'](_0x1ac35c,_0x595376,_0x50190d,_0x52aed6);break;default:strategy[_0x006e('0x4e')](_0x1ac35c,_0x595376,_0x50190d,_0x52aed6);}}else{logger[_0x006e('0x3a')](_0x006e('0x4f'),_0x2083e7,_0x3277d3[_0x006e('0x2f')]);_0x276f55[_0x006e('0x41')]();}}}catch(_0x2aac8b){logger[_0x006e('0x3a')](_0x006e('0x3f'),_0x2083e7,_0x2aac8b[_0x006e('0x50')]);_0x276f55['stop']();}};}; \ No newline at end of file +var _0xdbb2=['InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','interaction','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','stop','Queues','timeout','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','joinAt','emit','clone','capitalize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbb2,0x1c4));var _0x2dbb=function(_0x1d656c,_0x14fba4){_0x1d656c=_0x1d656c-0x0;var _0x4eeb25=_0xdbb2[_0x1d656c];return _0x4eeb25;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0x2dbb('0x0'));var Redis=require(_0x2dbb('0x1'));var config=require(_0x2dbb('0x2'));var logger=require(_0x2dbb('0x3'))(_0x2dbb('0x4'));var strategy=require('./strategy');config[_0x2dbb('0x5')]=_[_0x2dbb('0x6')](config[_0x2dbb('0x5')],{'host':_0x2dbb('0x7'),'port':0x18eb});var io=require(_0x2dbb('0x8'))(new Redis(config['redis']));var attributes=['id',_0x2dbb('0x9'),_0x2dbb('0xa'),_0x2dbb('0xb'),'from',_0x2dbb('0xc')];function emit(_0x3df380,_0x14f8f1,_0x56801f){io['to'](_0x3df380)[_0x2dbb('0xd')](_0x14f8f1,_0x56801f);}function emitChannelQueueInteraction(_0x3304dc,_0x22d31c,_0x38b6c1,_0x50cee1,_0x477a69,_0x2a2963,_0xf7f256,_0x5d16dd){var _0xf3e57e=_[_0x2dbb('0xe')](_0x38b6c1);_0xf3e57e['queue_id']=_0x5d16dd;_0xf3e57e[_0x2dbb('0xb')]=_0x22d31c;_0xf3e57e[_0x2dbb('0xa')]=_0x50cee1;_0xf3e57e['id']=_0x477a69;if(_0x2a2963){attributes['push'](_[_0x2dbb('0xf')](_0x3304dc)+_0x2dbb('0x10'));_0xf7f256[util[_0x2dbb('0x11')](_0x2dbb('0x12'),_0x3304dc)][_0x477a69]=_[_0x2dbb('0x13')](_0xf3e57e,attributes);}else{delete _0xf7f256[util[_0x2dbb('0x11')](_0x2dbb('0x12'),_0x3304dc)][_0x477a69];}emit(util[_0x2dbb('0x11')](_0x2dbb('0x14'),_0x3304dc,_0x22d31c),util[_0x2dbb('0x11')](_0x2dbb('0x15'),_0x3304dc,_0x2a2963?'save':'remove'),_[_0x2dbb('0x13')](_0xf3e57e,attributes));}var rpc={'openchannelQueueReport':require(_0x2dbb('0x16')),'mailQueueReport':require(_0x2dbb('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x2dbb('0x18')),'faxQueueReport':require(_0x2dbb('0x19')),'whatsappQueueReport':require(_0x2dbb('0x1a')),'chatInteraction':require(_0x2dbb('0x1b')),'faxInteraction':require(_0x2dbb('0x1c')),'mailInteraction':require(_0x2dbb('0x1d')),'openchannelInteraction':require(_0x2dbb('0x1e')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x2dbb('0x1f'))};var queue=schema({'name':{'type':_0x2dbb('0x20'),'required':!![],'message':_0x2dbb('0x21')},'timeout':{'type':_0x2dbb('0x22'),'message':_0x2dbb('0x23')}});function startRouting(_0x22818e,_0x2a67c0,_0x51c5b9,_0x139595){if(_0x22818e&&_0x2a67c0&&_0x51c5b9){_0x2a67c0[_0x2dbb('0x24')]+=0x1;var _0x32a862={'uniqueid':_0x22818e,'from':_0x51c5b9[_0x2dbb('0x25')]?_0x51c5b9[_0x2dbb('0x25')]['from']:'','joinAt':moment()[_0x2dbb('0x11')](_0x2dbb('0x26')),'ContactId':_0x51c5b9[_0x2dbb('0x27')]?_0x51c5b9['contact']['id']:null,'ListId':_0x51c5b9[_0x2dbb('0x28')]?_0x51c5b9[_0x2dbb('0x28')]['id']:null};_0x32a862[_['upperFirst'](_0x51c5b9[_0x2dbb('0x29')])+'QueueId']=_0x2a67c0['id']||null;_0x32a862[_['upperFirst'](_0x51c5b9[_0x2dbb('0x29')])+_0x2dbb('0x10')]=_0x51c5b9[_0x2dbb('0x2a')]?_0x51c5b9['interaction']['id']:null;_0x32a862[_['upperFirst'](_0x51c5b9[_0x2dbb('0x29')])+'MessageId']=_0x51c5b9['message']?_0x51c5b9[_0x2dbb('0x2b')]['id']:null;_0x32a862[_['upperFirst'](_0x51c5b9['channel'])+(_0x51c5b9['channel']!==_0x2dbb('0x2c')?_0x2dbb('0x2d'):_0x2dbb('0x2e'))]=_0x51c5b9[_0x2dbb('0xa')]?_0x51c5b9[_0x2dbb('0xa')]['id']:null;logger['info'](util[_0x2dbb('0x11')](_0x2dbb('0x2f'),_0x22818e,_0x2a67c0['name']));emitChannelQueueInteraction(_0x51c5b9['channel'],_0x2a67c0[_0x2dbb('0x30')],_0x32a862,_0x51c5b9['account'][_0x2dbb('0x30')],_0x51c5b9[_0x2dbb('0x2b')]['id'],!![],_0x139595,_0x2a67c0['id']);if(rpc[_0x51c5b9[_0x2dbb('0x29')]+_0x2dbb('0x31')]){return rpc[_0x51c5b9[_0x2dbb('0x29')]+_0x2dbb('0x31')][_0x2dbb('0x32')](_0x32a862)['catch'](function(_0x52637c){logger[_0x2dbb('0x33')](_0x2dbb('0x34'),_0x52637c);});}}}function stopRouting(_0x2544a4,_0x43e4ee,_0x3b84b0,_0xa856a8){if(_0x2544a4&&_0x43e4ee){_0x43e4ee['waiting']-=0x1;var _0x2c9bb9={'leaveAt':moment()[_0x2dbb('0x11')](_0x2dbb('0x26')),'acceptAt':moment()[_0x2dbb('0x11')](_0x2dbb('0x26')),'reason':'accepted'};logger[_0x2dbb('0x35')](util[_0x2dbb('0x11')](_0x2dbb('0x36'),_0x2544a4,_0x43e4ee[_0x2dbb('0x30')]));emitChannelQueueInteraction(_0x3b84b0[_0x2dbb('0x29')],_0x43e4ee['name'],_0x3b84b0[_0x2dbb('0x25')],_0x3b84b0['account']['name'],_0x3b84b0[_0x2dbb('0x2b')]['id'],![],_0xa856a8,_0x43e4ee['id']);return rpc[_0x3b84b0[_0x2dbb('0x29')]+_0x2dbb('0x37')]['update'](_0x3b84b0['interaction']['id'],{'queueId':_0x43e4ee['id']})[_0x2dbb('0x38')](function(){if(rpc[_0x3b84b0[_0x2dbb('0x29')]+_0x2dbb('0x31')]){return rpc[_0x3b84b0['channel']+'QueueReport'][_0x2dbb('0x39')](_0x2544a4,_0x2c9bb9)['catch'](function(_0x21d357){logger[_0x2dbb('0x33')](_0x2dbb('0x3a'),_0x21d357);});}});}}function endRouting(_0x57d6b9,_0x2900c0,_0x47e094,_0x2b1891){if(_0x57d6b9&&_0x2900c0){_0x2900c0['waiting']-=0x1;var _0x2797e4={'leaveAt':moment()[_0x2dbb('0x11')](_0x2dbb('0x26')),'exitAt':moment()[_0x2dbb('0x11')](_0x2dbb('0x26')),'reason':'timeout'};logger[_0x2dbb('0x35')](util[_0x2dbb('0x11')](_0x2dbb('0x3b'),_0x57d6b9,_0x2900c0[_0x2dbb('0x30')]));emitChannelQueueInteraction(_0x47e094[_0x2dbb('0x29')],_0x2900c0[_0x2dbb('0x30')],_0x47e094[_0x2dbb('0x25')],_0x47e094[_0x2dbb('0xa')][_0x2dbb('0x30')],_0x47e094[_0x2dbb('0x2b')]['id'],![],_0x2b1891);if(rpc[_0x47e094[_0x2dbb('0x29')]+_0x2dbb('0x31')]){return rpc[_0x47e094[_0x2dbb('0x29')]+_0x2dbb('0x31')][_0x2dbb('0x39')](_0x57d6b9,_0x2797e4)['catch'](function(_0x8363b){logger[_0x2dbb('0x33')](_0x2dbb('0x3a'),_0x8363b);});}}}function handleFindQueue(_0x736c24){return function(_0x22c49b){return _0x22c49b[_0x2dbb('0x30')][_0x2dbb('0x3c')]()===_0x736c24[_0x2dbb('0x3c')]();};}exports[_0x2dbb('0x3d')]=function(_0x3c2491,_0x286000,_0x21f2db,_0x299aa1){return function(_0x4ba573){try{var _0x3795cf={'name':_0x286000[0x0],'timeout':_0x286000[0x1]};var _0x39553d=queue['validate'](_0x3795cf,{'typecast':!![]});if(_0x39553d[_0x2dbb('0x3e')]){logger['error'](_0x2dbb('0x3f'),_0x3c2491,_['map'](_0x39553d,_0x2dbb('0x2b'))['join'](',\x20'));_0x4ba573[_0x2dbb('0x40')]();}else{var _0x4d3fb8=_['find'](_0x21f2db[_0x299aa1[_0x2dbb('0x29')]+_0x2dbb('0x41')],handleFindQueue(_0x3795cf[_0x2dbb('0x30')]));if(_0x4d3fb8){startRouting(_0x3c2491,_0x4d3fb8,_0x299aa1,_0x21f2db);var _0x589465=(_0x4d3fb8[_0x2dbb('0x42')]||0xa)*0x3e8;var _0x2b1bdd=(_0x3795cf[_0x2dbb('0x42')]||0x14)*0x3e8;var _0x9b8170;if(_0x589465>_0x2b1bdd){_0x2b1bdd=_0x589465;}var _0x41324e=seqqueue[_0x2dbb('0x43')](_0x589465);_0x41324e['id']=_0x3c2491;_0x41324e[_0x2dbb('0x44')]=_0x589465;_0x41324e[_0x2dbb('0x45')]=_0x2b1bdd;_0x41324e[_0x2dbb('0x29')]=_0x299aa1['channel'];_0x21f2db[_0x2dbb('0x46')][_0x3c2491]['on']('end',function(){logger[_0x2dbb('0x35')](_0x2dbb('0x47'),_0x3c2491);stopRouting(_0x3c2491,_0x4d3fb8,_0x299aa1,_0x21f2db);clearTimeout(_0x9b8170);_0x9b8170=undefined;_0x41324e['close'](!![]);if(_0x21f2db[_0x2dbb('0x46')][_0x3c2491]){delete _0x21f2db['rules'][_0x3c2491];}_0x4ba573[_0x2dbb('0x40')]();});_0x21f2db[_0x2dbb('0x46')][_0x3c2491]['on'](_0x2dbb('0x48'),function(){if(_0x21f2db[_0x2dbb('0x46')][_0x3c2491]){delete _0x21f2db[_0x2dbb('0x46')][_0x3c2491];}});_0x9b8170=setTimeout(function(){logger[_0x2dbb('0x35')](_0x2dbb('0x49'),_0x3c2491);endRouting(_0x3c2491,_0x4d3fb8,_0x299aa1,_0x21f2db);clearTimeout(_0x9b8170);_0x41324e[_0x2dbb('0x4a')](!![]);_0x4ba573[_0x2dbb('0x4b')]();},_0x2b1bdd);switch(_0x4d3fb8['strategy']){case'rrmemory':strategy['rrmemory'](_0x41324e,_0x4d3fb8,_0x21f2db,_0x299aa1);break;default:strategy[_0x2dbb('0x4c')](_0x41324e,_0x4d3fb8,_0x21f2db,_0x299aa1);}}else{logger[_0x2dbb('0x33')](_0x2dbb('0x4d'),_0x3c2491,_0x3795cf[_0x2dbb('0x30')]);_0x4ba573[_0x2dbb('0x40')]();}}}catch(_0x19c358){logger[_0x2dbb('0x33')]('[%s][QUEUE]\x20%s',_0x3c2491,_0x19c358['stack']);_0x4ba573[_0x2dbb('0x40')]();}};}; \ 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 efcb3be..cfe230f 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 _0x0fda=['lodash','./util','../../../../../config/logger','routing','agent','squeue','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busyQueue','saveWaitingNotification','showNotification','notificationId','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','busy','STOP','exports'];(function(_0x216b30,_0x10e3f3){var _0x473ad0=function(_0x44f39d){while(--_0x44f39d){_0x216b30['push'](_0x216b30['shift']());}};_0x473ad0(++_0x10e3f3);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x3b8728,_0x3e87b4){_0x3b8728=_0x3b8728-0x0;var _0x404ccd=_0x0fda[_0x3b8728];return _0x404ccd;};'use strict';var _=require(_0xa0fd('0x0'));var uuid=require('uuid');var util=require(_0xa0fd('0x1'));var logger=require(_0xa0fd('0x2'))(_0xa0fd('0x3'));var Agent=function(_0x2f71f3,_0x426242,_0xd8e73a,_0x13c734){this['notificationId']=uuid['v4']();this['squeue']=_0x2f71f3;this[_0xa0fd('0x4')]=_0x426242;this['realtime']=_0xd8e73a;this['routing']=_0x13c734;this[_0xa0fd('0x5')][_0xa0fd('0x6')](this[_0xa0fd('0x7')][_0xa0fd('0x8')](this),this['handleTimeout'][_0xa0fd('0x8')](this));this[_0xa0fd('0x5')]['on'](_0xa0fd('0x9'),this[_0xa0fd('0xa')]['bind'](this));this[_0xa0fd('0x5')]['on'](_0xa0fd('0xb'),this[_0xa0fd('0xc')]['bind'](this));};Agent[_0xa0fd('0xd')][_0xa0fd('0x6')]=function(){this[_0xa0fd('0x5')][_0xa0fd('0x6')](this[_0xa0fd('0x7')]['bind'](this),this['handleTimeout'][_0xa0fd('0x8')](this));};Agent[_0xa0fd('0xd')]['handleDrained']=function(){this[_0xa0fd('0xa')](!![]);};Agent[_0xa0fd('0xd')][_0xa0fd('0x7')]=function(){logger[_0xa0fd('0xe')](_0xa0fd('0xf'),this[_0xa0fd('0x5')]['id'],this[_0xa0fd('0x4')]['id']);if(_['isNil'](this[_0xa0fd('0x10')][_0xa0fd('0x11')][this['agent']['id']])){logger['debug'](_0xa0fd('0x12'),this[_0xa0fd('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xa0fd('0x6')][_0xa0fd('0x8')](this),0x3e8);}else{if(this[_0xa0fd('0x3')]['forcedOwnership']||util['isAgentAvailable'](this[_0xa0fd('0x5')]['id'],this['realtime'][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']],this[_0xa0fd('0x5')][_0xa0fd('0x13')],![])){this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']]['busy']=!![];this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']][_0xa0fd('0x14')]=undefined;util[_0xa0fd('0x15')](this[_0xa0fd('0x10')],this[_0xa0fd('0x3')],this[_0xa0fd('0x4')],this[_0xa0fd('0x5')][_0xa0fd('0x13')]);util[_0xa0fd('0x16')](this[_0xa0fd('0x17')],this[_0xa0fd('0x5')]['id'],this['realtime'][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']],null,this['routing']);util[_0xa0fd('0x18')](this[_0xa0fd('0x5')]['id'],this['realtime']['agents'][this[_0xa0fd('0x4')]['id']],_0xa0fd('0x19')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger['debug'](_0xa0fd('0x1a'),this['squeue']['id'],this[_0xa0fd('0x4')]['id']);setTimeout(this[_0xa0fd('0x6')][_0xa0fd('0x8')](this),0x3e8);}}};Agent['prototype'][_0xa0fd('0xa')]=function(_0x19c352){if(_[_0xa0fd('0x1b')](this[_0xa0fd('0x10')][_0xa0fd('0x11')][this['agent']['id']])){return logger[_0xa0fd('0xe')](_0xa0fd('0x12'),this[_0xa0fd('0x5')]['id'],this[_0xa0fd('0x4')]['id']);}else{logger['debug'](_0xa0fd('0x1c'),this[_0xa0fd('0x5')]['id'],this['agent']['id']);util['hideNotification'](this['notificationId'],this[_0xa0fd('0x5')]['id'],this['realtime']['agents'][this[_0xa0fd('0x4')]['id']],null,this['routing']);this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']][_0xa0fd('0x1d')]=![];this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']][_0xa0fd('0x14')]=undefined;util['removeWaitingNotification'](this[_0xa0fd('0x10')],this['routing'],this[_0xa0fd('0x4')],this['squeue']['channel']);util[_0xa0fd('0x18')](this['squeue']['id'],this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']],_0x19c352?_0xa0fd('0x1e'):'TIMEOUT');}if(!_0x19c352){setTimeout(this[_0xa0fd('0x6')][_0xa0fd('0x8')](this),0x3e8);}};function agent(_0x3b06ef,_0x3f6146,_0x2e3cfa,_0x31f1e2){return new Agent(_0x3b06ef,_0x3f6146,_0x2e3cfa,_0x31f1e2);}module[_0xa0fd('0x1f')]=agent; \ No newline at end of file +var _0x0faf=['showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','handleTimeout','bind','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','debug','forcedOwnership','channel','busy','busyQueue','saveWaitingNotification'];(function(_0x4c1a89,_0x34d271){var _0x5f0662=function(_0xf13d8d){while(--_0xf13d8d){_0x4c1a89['push'](_0x4c1a89['shift']());}};_0x5f0662(++_0x34d271);}(_0x0faf,0x132));var _0xf0fa=function(_0x4828b1,_0x5c8cf3){_0x4828b1=_0x4828b1-0x0;var _0x1fec1b=_0x0faf[_0x4828b1];return _0x1fec1b;};'use strict';var _=require(_0xf0fa('0x0'));var uuid=require('uuid');var util=require(_0xf0fa('0x1'));var logger=require(_0xf0fa('0x2'))(_0xf0fa('0x3'));var Agent=function(_0x35a260,_0xccb93e,_0xdc9ce3,_0x515b12){this[_0xf0fa('0x4')]=uuid['v4']();this[_0xf0fa('0x5')]=_0x35a260;this['agent']=_0xccb93e;this[_0xf0fa('0x6')]=_0xdc9ce3;this[_0xf0fa('0x3')]=_0x515b12;this[_0xf0fa('0x5')][_0xf0fa('0x7')](this[_0xf0fa('0x8')]['bind'](this),this[_0xf0fa('0x9')][_0xf0fa('0xa')](this));this['squeue']['on']('timeout',this[_0xf0fa('0x9')][_0xf0fa('0xa')](this));this[_0xf0fa('0x5')]['on'](_0xf0fa('0xb'),this[_0xf0fa('0xc')][_0xf0fa('0xa')](this));};Agent[_0xf0fa('0xd')][_0xf0fa('0x7')]=function(){this['squeue'][_0xf0fa('0x7')](this['handleRun'][_0xf0fa('0xa')](this),this['handleTimeout'][_0xf0fa('0xa')](this));};Agent[_0xf0fa('0xd')][_0xf0fa('0xc')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0xf0fa('0x8')]=function(){logger['debug'](_0xf0fa('0xe'),this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);if(_[_0xf0fa('0x10')](this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']])){logger[_0xf0fa('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);setTimeout(this[_0xf0fa('0x7')][_0xf0fa('0xa')](this),0x3e8);}else{if(this[_0xf0fa('0x3')][_0xf0fa('0x13')]||util['isAgentAvailable'](this['squeue']['id'],this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']],this[_0xf0fa('0x5')][_0xf0fa('0x14')],![])){this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']][_0xf0fa('0x15')]=!![];this[_0xf0fa('0x6')][_0xf0fa('0x11')][this['agent']['id']][_0xf0fa('0x16')]=undefined;util[_0xf0fa('0x17')](this[_0xf0fa('0x6')],this[_0xf0fa('0x3')],this[_0xf0fa('0xf')],this[_0xf0fa('0x5')][_0xf0fa('0x14')]);util[_0xf0fa('0x18')](this[_0xf0fa('0x4')],this['squeue']['id'],this[_0xf0fa('0x6')][_0xf0fa('0x11')][this['agent']['id']],null,this[_0xf0fa('0x3')]);util[_0xf0fa('0x19')](this[_0xf0fa('0x5')]['id'],this['realtime'][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']],_0xf0fa('0x1a')+(this[_0xf0fa('0x3')]['forcedOwnership']?':FORCED':''));}else{logger[_0xf0fa('0x12')](_0xf0fa('0x1b'),this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);setTimeout(this['push'][_0xf0fa('0xa')](this),0x3e8);}}};Agent[_0xf0fa('0xd')][_0xf0fa('0x9')]=function(_0x5a4fd3){if(_[_0xf0fa('0x10')](this['realtime'][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']])){return logger[_0xf0fa('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);}else{logger[_0xf0fa('0x12')](_0xf0fa('0x1c'),this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);util['hideNotification'](this['notificationId'],this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0x6')]['agents'][this[_0xf0fa('0xf')]['id']],null,this['routing']);this['realtime']['agents'][this[_0xf0fa('0xf')]['id']]['busy']=![];this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']][_0xf0fa('0x16')]=undefined;util[_0xf0fa('0x1d')](this[_0xf0fa('0x6')],this[_0xf0fa('0x3')],this[_0xf0fa('0xf')],this['squeue'][_0xf0fa('0x14')]);util[_0xf0fa('0x19')](this[_0xf0fa('0x5')]['id'],this['realtime'][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']],_0x5a4fd3?_0xf0fa('0x1e'):_0xf0fa('0x1f'));}if(!_0x5a4fd3){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x2a9f4b,_0x68b3fe,_0x2a6560,_0x47486f){return new Agent(_0x2a9f4b,_0x68b3fe,_0x2a6560,_0x47486f);}module[_0xf0fa('0x20')]=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 1deb0d7..f1512c5 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 _0x0f4a=['lodash','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','prototype','isNil','Agents','length','agents','debug','isAgentAvailable','channel','writeLog','busy','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','STOP','busyQueue','removeWaitingNotification','exports'];(function(_0x8abd64,_0x539570){var _0xd2511e=function(_0x9fef7d){while(--_0x9fef7d){_0x8abd64['push'](_0x8abd64['shift']());}};_0xd2511e(++_0x539570);}(_0x0f4a,0x14a));var _0xa0f4=function(_0x43b387,_0x157deb){_0x43b387=_0x43b387-0x0;var _0x147c22=_0x0f4a[_0x43b387];return _0x147c22;};'use strict';var _=require(_0xa0f4('0x0'));var uuid=require('uuid');var util=require(_0xa0f4('0x1'));var logger=require(_0xa0f4('0x2'))(_0xa0f4('0x3'));var Beepall=function(_0x11512f,_0x216e7b,_0x30df7d,_0x5b269f){this[_0xa0f4('0x4')]=uuid['v4']();this[_0xa0f4('0x5')]=_0x11512f;this[_0xa0f4('0x6')]=_0x216e7b;this[_0xa0f4('0x7')]=_0x30df7d;this['routing']=_0x5b269f;this[_0xa0f4('0x5')][_0xa0f4('0x8')](this[_0xa0f4('0x9')][_0xa0f4('0xa')](this),this[_0xa0f4('0xb')][_0xa0f4('0xa')](this));this[_0xa0f4('0x5')]['on'](_0xa0f4('0xc'),this[_0xa0f4('0xb')][_0xa0f4('0xa')](this));this[_0xa0f4('0x5')]['on'](_0xa0f4('0xd'),this['handleDrained'][_0xa0f4('0xa')](this));};Beepall[_0xa0f4('0xe')][_0xa0f4('0x8')]=function(){this['squeue'][_0xa0f4('0x8')](this['handleRun'][_0xa0f4('0xa')](this),this[_0xa0f4('0xb')][_0xa0f4('0xa')](this));};Beepall['prototype']['handleDrained']=function(){this[_0xa0f4('0xb')](!![]);};Beepall['prototype'][_0xa0f4('0x9')]=function(){var _0x4079b1=!![];if(!_[_0xa0f4('0xf')](this[_0xa0f4('0x6')])&&!_[_0xa0f4('0xf')](this[_0xa0f4('0x6')][_0xa0f4('0x10')])&&this[_0xa0f4('0x6')][_0xa0f4('0x10')][_0xa0f4('0x11')]>0x0){for(var _0x541f8e=0x0,_0xb5d8c;_0x541f8e0x0){for(var _0x11ed27=0x0,_0x28094f;_0x11ed270x0&&_0x3a8111[_0xc4b4d3+'CurrentCapacity']>=_0x3a8111[_0xc4b4d3+'Capacity']){writeLog(_0x398ddc,_0x3a8111,_0xc4b4d3[_0x2473('0x22')]()+_0x2473('0x23'));return![];}}return!![];};exports[_0x2473('0x24')]=function(_0x3c4df9,_0x2d5e60,_0x803ab8,_0x41ec99,_0x41cc48){return sendNotification(!![],_0x3c4df9,_0x2d5e60,_0x803ab8,_0x41ec99,_0x41cc48);};exports[_0x2473('0x25')]=function(_0x5d9aaf,_0x26fb45,_0x12b146,_0x4d4359,_0x2cfda0){return sendNotification(![],_0x5d9aaf,_0x26fb45,_0x12b146,_0x4d4359,_0x2cfda0);};exports[_0x2473('0x26')]=function(_0x15b311,_0x5f1896,_0x433e9d){var _0x29444d=_0x5f1896[_0x2473('0x27')]['UserId'];if(!_0x29444d&&_0x433e9d){_0x29444d=_0x433e9d['id'];}var _0x249afb=_['some'](_0x15b311[_0x5f1896[_0x2473('0x28')]+_0x2473('0x29')],function(_0x5595d6){var _0x46c595=_[_0x2473('0x2a')](_0x5f1896['channel'])+'InteractionId';return _0x5595d6[_0x46c595]===_0x5f1896[_0x2473('0x27')]['id'];});if(!_0x249afb&&_0x29444d&&_0x15b311[_0x2473('0x2b')][_0x29444d]){_0x249afb=_[_0x2473('0x2c')](_0x15b311[_0x2473('0x2b')][_0x29444d][_0x5f1896[_0x2473('0x28')]+'WaitingInteractions'],function(_0x24bc61){return _0x24bc61['id']===_0x5f1896[_0x2473('0x27')]['id'];});}return _0x249afb;};exports[_0x2473('0x2d')]=function(_0xf518b9,_0x18eb56,_0x286ce1,_0x1fffb5){if(_0x286ce1&&_0x286ce1['id']&&_0xf518b9['agents']&&_0xf518b9[_0x2473('0x2b')][_0x286ce1['id']]){_0xf518b9[_0x2473('0x2b')][_0x286ce1['id']][_0x1fffb5+_0x2473('0x2e')][_0x18eb56['message']['id']]={'id':_0x18eb56[_0x2473('0x27')]['id']};}};exports[_0x2473('0x2f')]=function(_0x3314ae,_0x5b2581,_0x2fbfa3,_0x439b57){if(_0x2fbfa3&&_0x2fbfa3['id']&&_0x3314ae[_0x2473('0x2b')]&&_0x3314ae[_0x2473('0x2b')][_0x2fbfa3['id']]){delete _0x3314ae[_0x2473('0x2b')][_0x2fbfa3['id']][_0x439b57+'WaitingInteractions'][_0x5b2581[_0x2473('0x30')]['id']];}};exports[_0x2473('0x31')]=writeLog; \ No newline at end of file +var _0x2ff5=['notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','format','user:%s','emit','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','some','WaitingInteractions','removeWaitingNotification','writeLog','util','../utils','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','socket.io-emitter','split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x44ad2e,_0x3513c9){_0x44ad2e=_0x44ad2e-0x0;var _0x10d5f2=_0x2ff5[_0x44ad2e];return _0x10d5f2;};'use strict';var _=require('lodash');var util=require(_0x52ff('0x0'));var utils=require(_0x52ff('0x1'));var Redis=require('ioredis');var config=require(_0x52ff('0x2'));var logger=require(_0x52ff('0x3'))(_0x52ff('0x4'));config[_0x52ff('0x5')]=_[_0x52ff('0x6')](config[_0x52ff('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x52ff('0x7'))(new Redis(config[_0x52ff('0x5')]));function sendNotification(_0x26906c,_0x47e375,_0x33be91,_0xbbba62,_0x3cfd13,_0x17ca0b){var _0xb498c3=_0x17ca0b||{};var _0x333611=_0x33be91[_0x52ff('0x8')]('.');var _0x16aaf4={'uniqueid':_0x47e375,'channel':_0x333611[0x0],'id':_0x333611[0x1],'title':_0x333611[0x0]+_0x52ff('0x9'),'interactionId':_0x333611[0x2],'queue':_0x3cfd13?_0x3cfd13[_0x52ff('0xa')]:null,'sound':_0xb498c3[_0x52ff('0xb')][_0x52ff('0xc')],'shake':_0xb498c3[_0x52ff('0xb')][_0x52ff('0xd')]};try{if(!_0xb498c3[_0x52ff('0xe')]){_0xb498c3['body']={};}if(_0x3cfd13){_0xb498c3['body']['queue']=_0x3cfd13;}else if(_0xb498c3['body'][_0x52ff('0xf')]){delete _0xb498c3['body'][_0x52ff('0xf')];}_0x16aaf4[_0x52ff('0x10')]=utils['getMustacheRender'](_0xb498c3[_0x52ff('0xb')][_0x52ff('0x11')],_0xb498c3);}catch(_0x3c787b){_0x16aaf4[_0x52ff('0x10')]=_0x52ff('0x12');logger[_0x52ff('0x13')](util['format'](_0x52ff('0x14'),_0x47e375,_0x3c787b[_0x52ff('0x15')]));}io['to'](util[_0x52ff('0x16')](_0x52ff('0x17'),_0xbbba62[_0x52ff('0xa')]))[_0x52ff('0x18')](util['format'](_0x52ff('0x19'),_0x26906c?_0x52ff('0x1a'):_0x52ff('0x1b')),_0x16aaf4);}function writeLog(_0x36d544,_0x5a87ac,_0x355ea4){return logger[_0x52ff('0x1c')](util[_0x52ff('0x16')](_0x52ff('0x1d'),_0x36d544,_0x5a87ac[_0x52ff('0xa')],_0x355ea4));}exports[_0x52ff('0x1e')]=function(_0x2ba460,_0x1d36c0,_0x1df213,_0x3ba538){if(_0x1d36c0[_0x52ff('0x1f')]){writeLog(_0x2ba460,_0x1d36c0,_0x52ff('0x20'));return![];}if(!_0x1d36c0[_0x52ff('0x21')]){writeLog(_0x2ba460,_0x1d36c0,_0x52ff('0x22'));return![];}if(_0x1d36c0[_0x1df213+_0x52ff('0x23')]){writeLog(_0x2ba460,_0x1d36c0,_0x52ff('0x24'));return![];}if(_0x3ba538&&_0x1d36c0[_0x52ff('0x25')](_0x1df213+_0x52ff('0x26'))&&_0x1d36c0['hasOwnProperty'](_0x1df213+_0x52ff('0x27'))){if(_0x1d36c0[_0x1df213+_0x52ff('0x26')]>0x0&&_0x1d36c0[_0x1df213+_0x52ff('0x27')]>=_0x1d36c0[_0x1df213+_0x52ff('0x26')]){writeLog(_0x2ba460,_0x1d36c0,_0x1df213['toUpperCase']()+_0x52ff('0x28'));return![];}}return!![];};exports[_0x52ff('0x29')]=function(_0x888232,_0x5a6ebc,_0x5b8905,_0x1ac770,_0x3f5e22){return sendNotification(!![],_0x888232,_0x5a6ebc,_0x5b8905,_0x1ac770,_0x3f5e22);};exports[_0x52ff('0x2a')]=function(_0x3ae377,_0x4c5d45,_0x1d9b8e,_0x25450b,_0x322260){return sendNotification(![],_0x3ae377,_0x4c5d45,_0x1d9b8e,_0x25450b,_0x322260);};exports[_0x52ff('0x2b')]=function(_0x3a049f,_0xd95637,_0x24094b){var _0x406343=_0xd95637[_0x52ff('0x2c')]['UserId'];if(!_0x406343&&_0x24094b){_0x406343=_0x24094b['id'];}var _0x140226=_['some'](_0x3a049f[_0xd95637[_0x52ff('0x2d')]+_0x52ff('0x2e')],function(_0x530abb){var _0x2d1cba=_[_0x52ff('0x2f')](_0xd95637[_0x52ff('0x2d')])+_0x52ff('0x30');return _0x530abb[_0x2d1cba]===_0xd95637['interaction']['id'];});if(!_0x140226&&_0x406343&&_0x3a049f[_0x52ff('0x31')][_0x406343]){_0x140226=_[_0x52ff('0x32')](_0x3a049f['agents'][_0x406343][_0xd95637[_0x52ff('0x2d')]+_0x52ff('0x33')],function(_0xef339d){return _0xef339d['id']===_0xd95637[_0x52ff('0x2c')]['id'];});}return _0x140226;};exports['saveWaitingNotification']=function(_0x45b2d5,_0x37067a,_0x5346dd,_0x13c704){if(_0x5346dd&&_0x5346dd['id']&&_0x45b2d5[_0x52ff('0x31')]&&_0x45b2d5[_0x52ff('0x31')][_0x5346dd['id']]){_0x45b2d5[_0x52ff('0x31')][_0x5346dd['id']][_0x13c704+'WaitingInteractions'][_0x37067a[_0x52ff('0x15')]['id']]={'id':_0x37067a['interaction']['id']};}};exports[_0x52ff('0x34')]=function(_0x23decc,_0x56988b,_0x18fb46,_0x10cfdd){if(_0x18fb46&&_0x18fb46['id']&&_0x23decc[_0x52ff('0x31')]&&_0x23decc['agents'][_0x18fb46['id']]){delete _0x23decc['agents'][_0x18fb46['id']][_0x10cfdd+_0x52ff('0x33')][_0x56988b['message']['id']];}};exports[_0x52ff('0x35')]=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 c0c080a..bc70608 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 _0x6a27=['message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map'];(function(_0x5b9c66,_0x2149db){var _0x475b71=function(_0x278b7a){while(--_0x278b7a){_0x5b9c66['push'](_0x5b9c66['shift']());}};_0x475b71(++_0x2149db);}(_0x6a27,0x152));var _0x76a2=function(_0x568177,_0x5b31dc){_0x568177=_0x568177-0x0;var _0x5c1dd0=_0x6a27[_0x568177];return _0x5c1dd0;};'use strict';var schema=require(_0x76a2('0x0'));var sh=require(_0x76a2('0x1'));var _=require(_0x76a2('0x2'));var utils=require(_0x76a2('0x3'));var logger=require(_0x76a2('0x4'))(_0x76a2('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0x76a2('0x6')}});exports[_0x76a2('0x7')]=function(_0x304ce8,_0x5c8259){return function(_0x3e4c62){try{var _0x1f9f18={'command':_0x5c8259[0x0]};var _0x52cacf=system[_0x76a2('0x0')](_0x1f9f18,{'typecast':!![]});if(_0x52cacf[_0x76a2('0x8')]){logger[_0x76a2('0x9')](_0x76a2('0xa'),_0x304ce8,_[_0x76a2('0xb')](_0x52cacf,_0x76a2('0xc'))['join'](',\x20'));logger[_0x76a2('0xd')](_0x76a2('0xe'),_0x304ce8);_0x3e4c62[_0x76a2('0xf')]();}else{var _0x4ffa31=this;var _0x302a07=utils[_0x76a2('0x10')](_0x5c8259[0x0],this);logger[_0x76a2('0xd')](_0x76a2('0x11'),_0x304ce8,_0x302a07);sh[_0x76a2('0x12')](_[_0x76a2('0x13')](_0x302a07),function(_0x2ae621,_0x413305){logger[_0x76a2('0xd')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x304ce8,_0x2ae621);if(_0x2ae621==0x0){var _0x44c923=_0x413305['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x76a2('0x14')](_0x5c8259[0x1])||_[_0x76a2('0x15')](_0x5c8259[0x1])){logger[_0x76a2('0xd')](_0x76a2('0x16'),_0x304ce8);_0x4ffa31['body'][_0x5c8259[0x1]]=_0x44c923;}else{logger['info'](_0x76a2('0x17'),_0x304ce8,_0x5c8259[0x1],_0x44c923);_0x4ffa31['body'][_0x5c8259[0x1]]=_0x44c923;}}_0x3e4c62[_0x76a2('0xf')]();});}}catch(_0x34f472){logger[_0x76a2('0x9')](_0x76a2('0xa'),_0x304ce8,_[_0x76a2('0x18')](_0x34f472)?JSON['stringify'](_0x34f472):_0x34f472);logger[_0x76a2('0xd')](_0x76a2('0xe'),_0x304ce8);_0x3e4c62[_0x76a2('0xf')]();}};}; \ No newline at end of file +var _0x84ed=['isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x84ed,0x1bc));var _0xd84e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x84ed[_0x432682];return _0x463d05;};'use strict';var schema=require(_0xd84e('0x0'));var sh=require(_0xd84e('0x1'));var _=require(_0xd84e('0x2'));var utils=require(_0xd84e('0x3'));var logger=require(_0xd84e('0x4'))(_0xd84e('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0xd84e('0x6')}});exports[_0xd84e('0x7')]=function(_0x4e3742,_0x1caf9d){return function(_0x466615){try{var _0x5dd1ba={'command':_0x1caf9d[0x0]};var _0x2dd572=system[_0xd84e('0x0')](_0x5dd1ba,{'typecast':!![]});if(_0x2dd572[_0xd84e('0x8')]){logger['error'](_0xd84e('0x9'),_0x4e3742,_[_0xd84e('0xa')](_0x2dd572,_0xd84e('0xb'))[_0xd84e('0xc')](',\x20'));logger[_0xd84e('0xd')](_0xd84e('0xe'),_0x4e3742);_0x466615[_0xd84e('0xf')]();}else{var _0x3429be=this;var _0xa4813b=utils[_0xd84e('0x10')](_0x1caf9d[0x0],this);logger[_0xd84e('0xd')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x4e3742,_0xa4813b);sh[_0xd84e('0x11')](_['trim'](_0xa4813b),function(_0x5ddf47,_0xbfac22){logger[_0xd84e('0xd')](_0xd84e('0x12'),_0x4e3742,_0x5ddf47);if(_0x5ddf47==0x0){var _0x31c22f=_0xbfac22[_0xd84e('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x1caf9d[0x1])||_[_0xd84e('0x14')](_0x1caf9d[0x1])){logger[_0xd84e('0xd')](_0xd84e('0x15'),_0x4e3742);_0x3429be['body'][_0x1caf9d[0x1]]=_0x31c22f;}else{logger['info'](_0xd84e('0x16'),_0x4e3742,_0x1caf9d[0x1],_0x31c22f);_0x3429be['body'][_0x1caf9d[0x1]]=_0x31c22f;}}_0x466615[_0xd84e('0xf')]();});}}catch(_0x3d2d30){logger[_0xd84e('0x17')](_0xd84e('0x9'),_0x4e3742,_[_0xd84e('0x18')](_0x3d2d30)?JSON[_0xd84e('0x19')](_0x3d2d30):_0x3d2d30);logger[_0xd84e('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4e3742);_0x466615[_0xd84e('0xf')]();}};}; \ 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 fe55c20..96b0fe1 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 _0xd921=['then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','message','next','Interaction','channel','addTags','interaction'];(function(_0x5eb84a,_0x13fdb2){var _0x3dea81=function(_0x15da30){while(--_0x15da30){_0x5eb84a['push'](_0x5eb84a['shift']());}};_0x3dea81(++_0x13fdb2);}(_0xd921,0x16f));var _0x1d92=function(_0xf3a17a,_0x4ce4dd){_0xf3a17a=_0xf3a17a-0x0;var _0x128a9f=_0xd921[_0xf3a17a];return _0x128a9f;};'use strict';var schema=require(_0x1d92('0x0'));var _=require(_0x1d92('0x1'));var rpc={'chatInteraction':require(_0x1d92('0x2')),'openchannelInteraction':require(_0x1d92('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x1d92('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x1d92('0x5'))};var logger=require(_0x1d92('0x6'))(_0x1d92('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x1d92('0x8')}});exports['consequence']=function(_0x31db0d,_0x220629,_0x1dc6d1,_0x2f205b){return function(_0x3846d2){try{var _0x46ced0={'tag':_0x220629[0x0]};var _0x519c25=tag[_0x1d92('0x0')](_0x46ced0,{'typecast':!![]});if(_0x519c25[_0x1d92('0x9')]){logger['error'](_0x1d92('0xa'),_0x31db0d,_['map'](_0x519c25,_0x1d92('0xb'))['join'](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x31db0d);_0x3846d2[_0x1d92('0xc')]();}else{var _0x405a82={'ids':[_0x220629[0x0]]};if(rpc[_0x2f205b['channel']+_0x1d92('0xd')]){rpc[_0x2f205b[_0x1d92('0xe')]+_0x1d92('0xd')][_0x1d92('0xf')](_0x2f205b[_0x1d92('0x10')]['id'],_0x405a82)[_0x1d92('0x11')](function(_0x50cc4e){logger[_0x1d92('0x12')](_0x1d92('0x13'),_0x31db0d,_0x220629[0x1],_0x2f205b[_0x1d92('0xe')],_0x2f205b['interaction']['id']);})[_0x1d92('0x14')](function(_0x2b3f3d){logger[_0x1d92('0x15')](_0x1d92('0xa'),_0x31db0d,JSON['stringify'](_0x2b3f3d));logger[_0x1d92('0x12')](_0x1d92('0x16'),_0x31db0d);})[_0x1d92('0x17')](function(){_0x3846d2[_0x1d92('0xc')]();});}}}catch(_0x261f3b){logger[_0x1d92('0x15')](_0x1d92('0xa'),_0x31db0d,_['isObject'](_0x261f3b)?JSON['stringify'](_0x261f3b):_0x261f3b);logger['info'](_0x1d92('0x16'),_0x31db0d);_0x3846d2[_0x1d92('0xc')]();}};}; \ No newline at end of file +var _0x7da0=['message','join','info','next','channel','Interaction','then','catch','error','stringify','isObject','validate','lodash','../../rpc/openchannelInteraction','../../../../config/logger','routing','[%s][TAG]\x20%s','map'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0x7da0,0x119));var _0x07da=function(_0x333dcf,_0xc29794){_0x333dcf=_0x333dcf-0x0;var _0x154a13=_0x7da0[_0x333dcf];return _0x154a13;};'use strict';var schema=require(_0x07da('0x0'));var _=require(_0x07da('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x07da('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x07da('0x3'))(_0x07da('0x4'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x4182a0,_0x1bcfaf,_0x52ef96,_0xb15edb){return function(_0x1e1349){try{var _0x434628={'tag':_0x1bcfaf[0x0]};var _0x13ff7a=tag[_0x07da('0x0')](_0x434628,{'typecast':!![]});if(_0x13ff7a['length']){logger['error'](_0x07da('0x5'),_0x4182a0,_[_0x07da('0x6')](_0x13ff7a,_0x07da('0x7'))[_0x07da('0x8')](',\x20'));logger[_0x07da('0x9')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4182a0);_0x1e1349[_0x07da('0xa')]();}else{var _0x26cb01={'ids':[_0x1bcfaf[0x0]]};if(rpc[_0xb15edb[_0x07da('0xb')]+_0x07da('0xc')]){rpc[_0xb15edb[_0x07da('0xb')]+_0x07da('0xc')]['addTags'](_0xb15edb['interaction']['id'],_0x26cb01)[_0x07da('0xd')](function(_0x11095f){logger[_0x07da('0x9')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x4182a0,_0x1bcfaf[0x1],_0xb15edb['channel'],_0xb15edb['interaction']['id']);})[_0x07da('0xe')](function(_0x4e0247){logger[_0x07da('0xf')](_0x07da('0x5'),_0x4182a0,JSON[_0x07da('0x10')](_0x4e0247));logger[_0x07da('0x9')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4182a0);})['finally'](function(){_0x1e1349['next']();});}}}catch(_0x4b518d){logger['error'](_0x07da('0x5'),_0x4182a0,_[_0x07da('0x11')](_0x4b518d)?JSON[_0x07da('0x10')](_0x4b518d):_0x4b518d);logger[_0x07da('0x9')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4182a0);_0x1e1349[_0x07da('0xa')]();}};}; \ 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 7fe3563..36a76cf 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 _0x63e9=['2.0','login','stringify','utf8','POST','application/json-rpc','then','parse','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','includes','push','urlOnAnswer','urlOnRing','?params=','title'];(function(_0x1ae1e3,_0x589ad0){var _0x36c712=function(_0x2cd1af){while(--_0x2cd1af){_0x1ae1e3['push'](_0x1ae1e3['shift']());}};_0x36c712(++_0x589ad0);}(_0x63e9,0xd4));var _0x963e=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0x63e9[_0x10dfdf];return _0x4d857d;};'use strict';var rp=require(_0x963e('0x0'));var logger=require(_0x963e('0x1'))(_0x963e('0x2'));var _=require(_0x963e('0x3'));var arr=[];exports[_0x963e('0x4')]=function(_0x381a76,_0x5dca71){return function(_0x358092){var _0x21dd1a=_0x5dca71[0xa];var _0x3206a7=_0x5dca71[0xb];var _0x13bfe4=_0x5dca71[0xc];var _0x5eac17=_0x5dca71[0xd];var _0x3ed7fa=_0x5dca71[0xe];var _0x1f0efe=_0x5dca71[0xf][_0x963e('0x5')](/\n/g,'\x20-\x20');var _0x3fac6a=_0x5dca71[0x10][_0x963e('0x5')](/\n/g,'\x20');if(!arr[_0x963e('0x6')](_0x3206a7)){arr[_0x963e('0x7')](_0x3206a7);var _0x35698f=_0x5dca71[0x3];var _0x7cfb91=_0x5dca71[0x4];var _0x448228=_0x5dca71[0x1];var _0x5897cc=_0x5dca71[0x0];var _0x2afaef={};_0x2afaef[_0x963e('0x8')]=_0x5dca71[0x8]+'?params='+_0x13bfe4+'|'+_0x21dd1a+'|'+_0x5eac17+'|'+_0x3206a7+'|'+_0x3ed7fa;_0x2afaef[_0x963e('0x9')]=_0x5dca71[0x7]+_0x963e('0xa')+_0x13bfe4+'|'+_0x21dd1a+'|'+_0x5eac17+'|'+_0x3206a7+'|'+_0x3ed7fa+'|'+_0x1f0efe+'|'+_0x3fac6a;_0x2afaef[_0x963e('0xb')]=_0x5dca71[0x9];var _0x2bbdad={};_0x2bbdad['jsonrpc']=_0x963e('0xc');_0x2bbdad['method']=_0x963e('0xd');var _0x3b0bbc=[];_0x3b0bbc[_0x963e('0x7')](_0x5dca71[0x2]);_0x3b0bbc[_0x963e('0x7')](_0x5dca71[0x5]);_0x3b0bbc['push'](_0x5dca71[0x6]);_0x2bbdad['params']=_0x3b0bbc;_0x2bbdad['id']=0x1;var _0x519d0c=JSON[_0x963e('0xe')](_0x2bbdad);var _0x4df400={'encoding':_0x963e('0xf'),'method':_0x963e('0x10'),'timeout':0x2710,'url':_0x35698f,'headers':{'Content-Type':_0x963e('0x11')},'body':_0x519d0c};return rp(_0x4df400)[_0x963e('0x12')](function(_0x34cf77){const _0x42e739=JSON[_0x963e('0x13')](_0x34cf77);if(!_0x42e739['result']['logged']){throw new Error(_0x963e('0x14'));}var _0x374df4=_0x3206a7;var _0x188fef=_0x963e('0x15')+_0x448228+'&serviceId='+_0x5897cc+_0x963e('0x16')+_0x374df4+_0x963e('0x17')+JSON[_0x963e('0xe')](_0x2afaef);var _0x55ab3b=_0x7cfb91+'?'+_0x188fef;return rp(_0x55ab3b);})[_0x963e('0x12')](function(_0x5df6c9){logger[_0x963e('0x18')](_0x963e('0x19'),_0x381a76,_0x5df6c9);_0x358092[_0x963e('0x1a')]();})[_0x963e('0x1b')](function(_0x437253){logger[_0x963e('0x1c')](_0x963e('0x1d'),_0x381a76,_[_0x963e('0x1e')](_0x437253)?JSON[_0x963e('0xe')](_0x437253):_0x437253);_0x358092['stop']();});}else{logger[_0x963e('0x18')](_0x963e('0x1f'),_0x381a76);_0x358092['next']();}};}; \ No newline at end of file +var _0xe309=['push','utf8','POST','application/json-rpc','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&data=','stringify','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method','login'];(function(_0x26c60d,_0xbe9b93){var _0x8ce81d=function(_0x22f448){while(--_0x22f448){_0x26c60d['push'](_0x26c60d['shift']());}};_0x8ce81d(++_0xbe9b93);}(_0xe309,0x7b));var _0x9e30=function(_0x53740d,_0x17fa12){_0x53740d=_0x53740d-0x0;var _0x35ac8a=_0xe309[_0x53740d];return _0x35ac8a;};'use strict';var rp=require(_0x9e30('0x0'));var logger=require(_0x9e30('0x1'))(_0x9e30('0x2'));var _=require(_0x9e30('0x3'));var arr=[];exports[_0x9e30('0x4')]=function(_0x40d863,_0x564edb){return function(_0xf8280e){var _0x57ed34=_0x564edb[0xa];var _0x2fae2f=_0x564edb[0xb];var _0xc7344=_0x564edb[0xc];var _0x4a52bd=_0x564edb[0xd];var _0x49d073=_0x564edb[0xe];var _0xf71bd5=_0x564edb[0xf][_0x9e30('0x5')](/\n/g,'\x20-\x20');var _0xa36195=_0x564edb[0x10][_0x9e30('0x5')](/\n/g,'\x20');if(!arr['includes'](_0x2fae2f)){arr['push'](_0x2fae2f);var _0x10acb9=_0x564edb[0x3];var _0x1a0fe6=_0x564edb[0x4];var _0x2f6716=_0x564edb[0x1];var _0x54fd6f=_0x564edb[0x0];var _0x4cd08c={};_0x4cd08c[_0x9e30('0x6')]=_0x564edb[0x8]+_0x9e30('0x7')+_0xc7344+'|'+_0x57ed34+'|'+_0x4a52bd+'|'+_0x2fae2f+'|'+_0x49d073;_0x4cd08c[_0x9e30('0x8')]=_0x564edb[0x7]+_0x9e30('0x7')+_0xc7344+'|'+_0x57ed34+'|'+_0x4a52bd+'|'+_0x2fae2f+'|'+_0x49d073+'|'+_0xf71bd5+'|'+_0xa36195;_0x4cd08c['title']=_0x564edb[0x9];var _0x44cda7={};_0x44cda7[_0x9e30('0x9')]=_0x9e30('0xa');_0x44cda7[_0x9e30('0xb')]=_0x9e30('0xc');var _0x59431c=[];_0x59431c[_0x9e30('0xd')](_0x564edb[0x2]);_0x59431c[_0x9e30('0xd')](_0x564edb[0x5]);_0x59431c[_0x9e30('0xd')](_0x564edb[0x6]);_0x44cda7['params']=_0x59431c;_0x44cda7['id']=0x1;var _0x3ee758=JSON['stringify'](_0x44cda7);var _0x3e9fbd={'encoding':_0x9e30('0xe'),'method':_0x9e30('0xf'),'timeout':0x2710,'url':_0x10acb9,'headers':{'Content-Type':_0x9e30('0x10')},'body':_0x3ee758};return rp(_0x3e9fbd)['then'](function(_0x46c609){const _0xba8842=JSON[_0x9e30('0x11')](_0x46c609);if(!_0xba8842[_0x9e30('0x12')]['logged']){throw new Error(_0x9e30('0x13'));}var _0x5c2ea9=_0x2fae2f;var _0x434f46=_0x9e30('0x14')+_0x2f6716+_0x9e30('0x15')+_0x54fd6f+'&sessionId='+_0x5c2ea9+_0x9e30('0x16')+JSON[_0x9e30('0x17')](_0x4cd08c);var _0x5f250d=_0x1a0fe6+'?'+_0x434f46;return rp(_0x5f250d);})[_0x9e30('0x18')](function(_0x550e0b){logger[_0x9e30('0x19')](_0x9e30('0x1a'),_0x40d863,_0x550e0b);_0xf8280e[_0x9e30('0x1b')]();})[_0x9e30('0x1c')](function(_0x6cc749){logger[_0x9e30('0x1d')](_0x9e30('0x1e'),_0x40d863,_[_0x9e30('0x1f')](_0x6cc749)?JSON[_0x9e30('0x17')](_0x6cc749):_0x6cc749);_0xf8280e[_0x9e30('0x1b')]();});}else{logger['info'](_0x9e30('0x20'),_0x40d863);_0xf8280e[_0x9e30('0x21')]();}};}; \ 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 c14c52d..b0ac540 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x352f20,_0x405275){var _0x3f1267=function(_0x2b6288){while(--_0x2b6288){_0x352f20['push'](_0x352f20['shift']());}};_0x3f1267(++_0x405275);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x4dbe4c,_0x59ecf2){var _0x3f61ea=function(_0x18b6ae){while(--_0x18b6ae){_0x4dbe4c['push'](_0x4dbe4c['shift']());}};_0x3f61ea(++_0x59ecf2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index c8e8ed1..08cfda0 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 _0x2b47=['tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','app','./interval','condition','./applications/','consequence','priority','info','intervals','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','error','stack','routing\x20is\x20empty','agent','agents','busy','emit','QueueReport','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','waiting','mailQueues','available','loggedIn','paused','openchannelQueues','name','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','existsSync','toLowerCase','autoreply','split','mail','push','slice','join','dialogflow','appdata','dialogflowv2','amazonlex','tag','TagId'];(function(_0x375d69,_0x276d75){var _0x40d16c=function(_0xa7dd1){while(--_0xa7dd1){_0x375d69['push'](_0x375d69['shift']());}};_0x40d16c(++_0x276d75);}(_0x2b47,0x177));var _0x72b4=function(_0x267805,_0x90b8a8){_0x267805=_0x267805-0x0;var _0x1d0a54=_0x2b47[_0x267805];return _0x1d0a54;};'use strict';var _=require(_0x72b4('0x0'));var util=require('util');var path=require(_0x72b4('0x1'));var fs=require('fs');var jayson=require(_0x72b4('0x2'));var BPromise=require(_0x72b4('0x3'));var utils=require('./applications/utils');var sUtils=require(_0x72b4('0x4'));var logger=require(_0x72b4('0x5'))(_0x72b4('0x6'));var rpc={'openchannelQueueReport':require(_0x72b4('0x7')),'mailQueueReport':require(_0x72b4('0x8')),'chatQueueReport':require(_0x72b4('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x72b4('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x72b4('0xb'));function getId(_0x1c90aa,_0xb1e42f,_0x1bdf7f){return util[_0x72b4('0xc')](_0x72b4('0xd'),_0x1c90aa,_0xb1e42f||0x0,_0x1bdf7f||0x0);}function getIntervals(_0x114a98,_0x165537){var _0x3d2504=[];if(!_[_0x72b4('0xe')](_0x165537[_0x72b4('0xf')])&&!_['isNil'](_0x114a98[_0x165537[_0x72b4('0xf')]])&&!_[_0x72b4('0xe')](_0x114a98[_0x165537[_0x72b4('0xf')]][_0x72b4('0x10')])){_0x3d2504=_[_0x72b4('0x11')](_0x114a98[_0x165537[_0x72b4('0xf')]][_0x72b4('0x10')],_0x72b4('0x12'));}else if(!_[_0x72b4('0xe')](_0x165537[_0x72b4('0x12')])){_0x3d2504=[_0x165537[_0x72b4('0x12')]];}return _0x3d2504;}exports['listen']=function(_0x3ae95d){_0x3ae95d[_0x72b4('0x13')]={};return new BPromise(function(_0x28ae3c,_0x46eb8f){var _0x5cd685={'Start':function(_0x5c6303){var _0x3eff87=this;return new Promise(function(_0x5c7c36,_0x21ff7d){if(_0x5c6303){try{var _0x2d4fd0=[];var _0x5ac4fc=getId(_0x5c6303[_0x72b4('0x14')],_0x5c6303[_0x72b4('0x15')]?_0x5c6303[_0x72b4('0x15')]['id']:0x0,_0x5c6303[_0x72b4('0x16')]?_0x5c6303[_0x72b4('0x16')]['id']:0x0);var _0x334910=sUtils[_0x72b4('0x17')](_0x3ae95d,_0x5c6303);if(_0x5c6303[_0x72b4('0x18')]||!_0x334910&&_0x5c6303[_0x72b4('0x19')]&&_['isArray'](_0x5c6303[_0x72b4('0x19')])&&_0x5c6303['applications'][_0x72b4('0x1a')]){for(var _0x161e90=0x0;_0x161e90<_0x5c6303['applications'][_0x72b4('0x1a')];_0x161e90+=0x1){var _0xc74320=_0x5c6303['applications'][_0x161e90];if(fs[_0x72b4('0x1b')](path['join'](__dirname,_0x72b4('0x19'),_0xc74320['app']+'.js'))){var _0x1f0986=[];switch(_0xc74320['app'][_0x72b4('0x1c')]()){case _0x72b4('0x1d'):var _0x1da2a5=_0xc74320['appdata'][_0x72b4('0x1e')](',');if(_0x5c6303[_0x72b4('0x14')]===_0x72b4('0x1f')){_0x1f0986['push'](_0x1da2a5[0x0]);_0x1f0986[_0x72b4('0x20')](_0x1da2a5[0x1]);_0x1f0986[_0x72b4('0x20')](_0x1da2a5[_0x72b4('0x21')](0x2,_0x1da2a5[_0x72b4('0x1a')])[_0x72b4('0x22')](','));}else{_0x1f0986[_0x72b4('0x20')](_0x1da2a5[0x0]);_0x1f0986[_0x72b4('0x20')](_0x1da2a5['slice'](0x1,_0x1da2a5[_0x72b4('0x1a')])['join'](','));}break;case _0x72b4('0x23'):var _0x20bcb0=_0xc74320[_0x72b4('0x24')][_0x72b4('0x1e')](',');_0x1f0986[_0x72b4('0x20')](_0x20bcb0[0x0]);_0x1f0986[_0x72b4('0x20')](_0x20bcb0[0x1]);_0x1f0986['push'](_0x20bcb0[_0x72b4('0x21')](0x2,_0x20bcb0[_0x72b4('0x1a')])[_0x72b4('0x22')](','));break;case _0x72b4('0x25'):var _0x2387f2=_0xc74320[_0x72b4('0x24')][_0x72b4('0x1e')](',');_0x1f0986[_0x72b4('0x20')](_0x2387f2[0x0]);_0x1f0986['push'](_0x2387f2[0x1]);_0x1f0986[_0x72b4('0x20')](_0x2387f2[0x2]);_0x1f0986[_0x72b4('0x20')](_0x2387f2[0x3]);_0x1f0986['push'](_0x2387f2[_0x72b4('0x21')](0x4,_0x2387f2[_0x72b4('0x1a')])[_0x72b4('0x22')](','));break;case _0x72b4('0x26'):var _0xdaf4fd=_0xc74320[_0x72b4('0x24')][_0x72b4('0x1e')](',');_0x1f0986[_0x72b4('0x20')](_0xdaf4fd[0x0]);_0x1f0986[_0x72b4('0x20')](_0xdaf4fd[0x1]);_0x1f0986[_0x72b4('0x20')](_0xdaf4fd[0x2]);_0x1f0986[_0x72b4('0x20')](_0xdaf4fd[0x3]);_0x1f0986[_0x72b4('0x20')](_0xdaf4fd[_0x72b4('0x21')](0x4,_0xdaf4fd[_0x72b4('0x1a')])[_0x72b4('0x22')](','));break;case _0x72b4('0x15'):_0x1f0986['push'](_0xc74320['appdata']);break;case _0x72b4('0x27'):_0x1f0986['push'](_0xc74320[_0x72b4('0x28')]);_0x1f0986['push'](_0xc74320[_0x72b4('0x24')]);break;case _0x72b4('0x29'):var _0x1b7b74=utils[_0x72b4('0x2a')](_0x5c6303['account'][_0x72b4('0x2b')],_0x5c6303);var _0xfb8f0b=_0xc74320[_0x72b4('0x24')][_0x72b4('0x1e')](',');_0x1f0986[_0x72b4('0x20')](_0xfb8f0b[0x0]);_0x1f0986[_0x72b4('0x20')](_0xfb8f0b[0x1]);_0x1f0986[_0x72b4('0x20')](_0xfb8f0b[0x2]);_0x1f0986[_0x72b4('0x20')](_0xfb8f0b[0x3]);_0x1f0986[_0x72b4('0x20')](_0xfb8f0b[0x4]);_0x1f0986['push'](_0xfb8f0b[0x5]);_0x1f0986['push'](_0xfb8f0b[0x6]);_0x1f0986[_0x72b4('0x20')](_0xfb8f0b[0x7]);_0x1f0986['push'](_0xfb8f0b[0x8]);_0x1f0986['push'](_0xfb8f0b[0x9]);_0x1f0986[_0x72b4('0x20')](_0xfb8f0b[0xa]);_0x1f0986['push'](_0x5c6303[_0x72b4('0x16')]['id']);_0x1f0986[_0x72b4('0x20')](_0x5c6303[_0x72b4('0x15')]['id']);_0x1f0986[_0x72b4('0x20')](_0xc74320[_0x72b4('0x2c')]);_0x1f0986[_0x72b4('0x20')](_0x5c6303[_0x72b4('0x16')][_0x72b4('0x2d')]);_0x1f0986[_0x72b4('0x20')](_0x5c6303[_0x72b4('0x2e')][_0x72b4('0x2e')]);_0x1f0986[_0x72b4('0x20')](_0x1b7b74);break;default:_0x1f0986=_[_0x72b4('0xe')](_0xc74320[_0x72b4('0x24')])?[]:_0xc74320['appdata'][_0x72b4('0x1e')](',');}var _0x37c40d={'id':util['format'](_0x72b4('0x2f'),_0x5ac4fc,_0xc74320['id'],_0xc74320[_0x72b4('0x30')]),'condition':require(_0x72b4('0x31'))[_0x72b4('0x32')](_0x5ac4fc,getIntervals(_0x3ae95d['intervals'],_0xc74320),_0x3ae95d),'consequence':require(_0x72b4('0x33')+_0xc74320[_0x72b4('0x30')])[_0x72b4('0x34')](_0x5ac4fc,_0x1f0986,_0x3ae95d,_0x5c6303),'p':_0xc74320[_0x72b4('0x35')]||0x0};logger[_0x72b4('0x36')]('Push\x20new\x20rule',_0x37c40d['id'],'on\x20interval',getIntervals(_0x3ae95d[_0x72b4('0x37')],_0xc74320)[_0x72b4('0x22')]('\x20|\x20'));_0x2d4fd0[_0x72b4('0x20')](_0x37c40d);}else{logger['error'](_0x72b4('0x38'),path['join'](__dirname,'applications',_0xc74320[_0x72b4('0x30')]+_0x72b4('0x39')));}}_0x3ae95d['rules'][_0x5ac4fc]=new RuleEngine(_0x2d4fd0);_0x3ae95d[_0x72b4('0x13')][_0x5ac4fc][_0x72b4('0x3a')](_0x5c6303,function(_0x5b8f8f){logger[_0x72b4('0x36')](_0x72b4('0x3b'),JSON[_0x72b4('0x3c')](_0x5b8f8f[_0x72b4('0x3d')]));if(_0x3ae95d[_0x72b4('0x13')][_0x5ac4fc]){_0x3ae95d['rules'][_0x5ac4fc]['emit'](_0x72b4('0x3e'));}});return _0x5c7c36({'code':0xc8,'message':_0x5c6303});}else{if(_0x334910){logger[_0x72b4('0x36')](util[_0x72b4('0xc')](_0x72b4('0x3f'),_0x5ac4fc));}else{logger[_0x72b4('0x36')]('No\x20applications\x20to\x20execute');}return _0x5c7c36({'code':0xc8,'message':_0x5c6303});}}catch(_0x585ac0){logger[_0x72b4('0x40')](_0x585ac0[_0x72b4('0x41')]);return _0x21ff7d(_0x3eff87[_0x72b4('0x40')](0x1f4,_0x585ac0));}}return _0x21ff7d(_0x72b4('0x42'));});},'AcceptMessage':function(_0x4caeba){var _0x35af71=this;return new Promise(function(_0x2ff377,_0x3907fe){if(_0x4caeba[_0x72b4('0x43')]&&_0x4caeba['agent']['id']){if(_0x3ae95d[_0x72b4('0x44')][_0x4caeba[_0x72b4('0x43')]['id']]){_0x3ae95d[_0x72b4('0x44')][_0x4caeba['agent']['id']][_0x72b4('0x45')]=![];_0x3ae95d[_0x72b4('0x44')][_0x4caeba[_0x72b4('0x43')]['id']]['busyQueue']=undefined;}}if(_0x4caeba['message']&&_0x4caeba[_0x72b4('0x15')]['id']){try{var _0xd374c7=getId(_0x4caeba['channel'],_0x4caeba[_0x72b4('0x15')]?_0x4caeba[_0x72b4('0x15')]['id']:0x0,_0x4caeba[_0x72b4('0x16')]?_0x4caeba[_0x72b4('0x16')]['id']:0x0);if(_0x3ae95d[_0x72b4('0x13')][_0xd374c7]){_0x3ae95d['rules'][_0xd374c7][_0x72b4('0x46')]('end');if(rpc[_0x4caeba[_0x72b4('0x14')]+'QueueReport']){rpc[_0x4caeba['channel']+_0x72b4('0x47')]['update'](_0xd374c7,{'UserId':_0x4caeba[_0x72b4('0x15')]['UserId']})[_0x72b4('0x48')](function(){logger[_0x72b4('0x40')](_0x72b4('0x49'));});}}return _0x2ff377({'code':0xc8,'message':_0x4caeba});}catch(_0x28ec6c){logger[_0x72b4('0x40')](_0x28ec6c[_0x72b4('0x41')]);return _0x3907fe(_0x35af71[_0x72b4('0x40')](0x1f4,_0x28ec6c));}}logger['error'](_0x72b4('0x4a'));return _0x3907fe(_0x35af71[_0x72b4('0x40')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x136c7d){var _0x4c76a6=this;return new Promise(function(_0x3c8438,_0x58266d){if(_0x136c7d['agent']&&_0x136c7d['agent']['id']){try{if(_0x3ae95d[_0x72b4('0x44')][_0x136c7d['agent']['id']]){_0x3ae95d[_0x72b4('0x44')][_0x136c7d['agent']['id']]['busy']=![];_0x3ae95d[_0x72b4('0x44')][_0x136c7d[_0x72b4('0x43')]['id']]['busyQueue']=undefined;}return _0x3c8438({'code':0xc8,'message':_0x136c7d});}catch(_0x3e1e21){logger[_0x72b4('0x40')](_0x3e1e21[_0x72b4('0x41')]);return _0x58266d(_0x4c76a6[_0x72b4('0x40')](0x1f4,_0x3e1e21));}}logger[_0x72b4('0x40')](_0x72b4('0x4a'));return _0x58266d(_0x4c76a6[_0x72b4('0x40')](0x1f4,_0x72b4('0x4a')));});},'AbandonInteraction':function(_0x467b8c){var _0x4705fd=this;return new Promise(function(_0x4843b2,_0x532b95){if(_0x467b8c[_0x72b4('0x14')]&&_0x467b8c[_0x72b4('0x16')]&&_0x467b8c['interaction']['id']){try{var _0x18760e=getId(_0x467b8c['channel'],_0x467b8c[_0x72b4('0x15')]?_0x467b8c[_0x72b4('0x15')]['id']:0x0,_0x467b8c[_0x72b4('0x16')]?_0x467b8c[_0x72b4('0x16')]['id']:0x0);if(_0x3ae95d[_0x72b4('0x13')][_0x18760e]){_0x3ae95d[_0x72b4('0x13')][_0x18760e]['emit'](_0x72b4('0x4b'));}return _0x4843b2({'code':0xc8,'message':_0x467b8c});}catch(_0x3cebc1){logger[_0x72b4('0x40')](_0x3cebc1[_0x72b4('0x41')]);return _0x532b95(_0x4705fd[_0x72b4('0x40')](0x1f4,_0x3cebc1));}}logger[_0x72b4('0x40')](_0x72b4('0x4a'));return _0x532b95(_0x4705fd[_0x72b4('0x40')](0x1f4,_0x72b4('0x4a')));});},'AgentCapacity':function(_0x1f48d2){var _0x148db0=this;return new Promise(function(_0x10a6ec,_0x436186){if(_0x3ae95d['agents'][_0x72b4('0x4c')](_0x1f48d2['id'])){for(var _0x50ccfb in _0x1f48d2[_0x72b4('0x4d')]){if(_0x1f48d2['capacity']['hasOwnProperty'](_0x50ccfb)){if(_0x3ae95d[_0x72b4('0x44')][_0x1f48d2['id']][_0x72b4('0x4c')](_0x50ccfb+'CurrentCapacity')){_0x3ae95d[_0x72b4('0x44')][_0x1f48d2['id']][_0x50ccfb+_0x72b4('0x4e')]=parseInt(_0x1f48d2[_0x72b4('0x4d')][_0x50ccfb],0xa);}}}_0x3ae95d[_0x72b4('0x44')][_0x1f48d2['id']][_0x72b4('0x4f')]();return _0x10a6ec({'code':0xc8,'message':_0x3ae95d[_0x72b4('0x44')][_0x1f48d2['id']]});}else{return _0x436186(_0x148db0[_0x72b4('0x40')](0x1f4,_0x72b4('0x50')));}});},'Agents':function(_0x12e558){return new Promise(function(_0x1c5480){var _0x59b499=_['values'](_0x3ae95d[_0x72b4('0x44')]);if(_0x12e558&&_0x12e558['id']){var _0x1874f2=_[_0x72b4('0x51')](_0x59b499,function(_0x309db6){return _0x309db6['id']===_0x12e558['id'];});_0x1c5480(_0x1874f2);}else{_0x1c5480({'count':_0x59b499[_0x72b4('0x1a')],'rows':_0x59b499});}});},'ChatQueues':function(){return new Promise(function(_0x3f0d2d){var _0x565783=[];for(var _0x4d2f73 in _0x3ae95d['chatQueues']){if(_0x3ae95d[_0x72b4('0x52')]['hasOwnProperty'](_0x4d2f73)){var _0x1f9f9b=_0x3ae95d[_0x72b4('0x52')][_0x4d2f73];var _0x125f93={'id':_0x1f9f9b['id'],'available':_0x1f9f9b['available'],'loggedIn':_0x1f9f9b['loggedIn'],'name':_0x1f9f9b['name'],'paused':_0x1f9f9b['paused'],'waiting':_0x1f9f9b[_0x72b4('0x53')]};_0x565783[_0x72b4('0x20')](_0x125f93);}}_0x3f0d2d({'count':_0x565783[_0x72b4('0x1a')],'rows':_0x565783});});},'MailQueues':function(){return new Promise(function(_0x4288a9){var _0xa4d969=[];for(var _0x31a90e in _0x3ae95d[_0x72b4('0x54')]){if(_0x3ae95d['mailQueues'][_0x72b4('0x4c')](_0x31a90e)){var _0x991275=_0x3ae95d[_0x72b4('0x54')][_0x31a90e];var _0x240d3a={'id':_0x991275['id'],'available':_0x991275[_0x72b4('0x55')],'loggedIn':_0x991275[_0x72b4('0x56')],'name':_0x991275['name'],'paused':_0x991275[_0x72b4('0x57')],'waiting':_0x991275[_0x72b4('0x53')]};_0xa4d969['push'](_0x240d3a);}}_0x4288a9({'count':_0xa4d969['length'],'rows':_0xa4d969});});},'OpenchannelQueues':function(){return new Promise(function(_0xe693d3){var _0x3dccba=[];for(var _0x2dbf1b in _0x3ae95d['openchannelQueues']){if(_0x3ae95d[_0x72b4('0x58')][_0x72b4('0x4c')](_0x2dbf1b)){var _0x18aa05=_0x3ae95d[_0x72b4('0x58')][_0x2dbf1b];var _0x1dd69a={'id':_0x18aa05['id'],'available':_0x18aa05['available'],'loggedIn':_0x18aa05[_0x72b4('0x56')],'name':_0x18aa05[_0x72b4('0x59')],'paused':_0x18aa05['paused'],'waiting':_0x18aa05[_0x72b4('0x53')]};_0x3dccba[_0x72b4('0x20')](_0x1dd69a);}}_0xe693d3({'count':_0x3dccba[_0x72b4('0x1a')],'rows':_0x3dccba});});},'SmsQueues':function(){return new Promise(function(_0x75c77c){var _0x2d0bd2=[];for(var _0x244b76 in _0x3ae95d[_0x72b4('0x5a')]){if(_0x3ae95d[_0x72b4('0x5a')]['hasOwnProperty'](_0x244b76)){var _0x3f69d0=_0x3ae95d[_0x72b4('0x5a')][_0x244b76];var _0x4da8be={'id':_0x3f69d0['id'],'available':_0x3f69d0[_0x72b4('0x55')],'loggedIn':_0x3f69d0[_0x72b4('0x56')],'name':_0x3f69d0['name'],'paused':_0x3f69d0[_0x72b4('0x57')],'waiting':_0x3f69d0[_0x72b4('0x53')]};_0x2d0bd2[_0x72b4('0x20')](_0x4da8be);}}_0x75c77c({'count':_0x2d0bd2[_0x72b4('0x1a')],'rows':_0x2d0bd2});});},'FaxQueues':function(){return new Promise(function(_0x51f331){var _0x2558f3=[];for(var _0x4c767d in _0x3ae95d[_0x72b4('0x5b')]){if(_0x3ae95d['faxQueues']['hasOwnProperty'](_0x4c767d)){var _0x43e064=_0x3ae95d[_0x72b4('0x5b')][_0x4c767d];var _0x2260ac={'id':_0x43e064['id'],'available':_0x43e064[_0x72b4('0x55')],'loggedIn':_0x43e064[_0x72b4('0x56')],'name':_0x43e064['name'],'paused':_0x43e064[_0x72b4('0x57')],'waiting':_0x43e064[_0x72b4('0x53')]};_0x2558f3[_0x72b4('0x20')](_0x2260ac);}}_0x51f331({'count':_0x2558f3[_0x72b4('0x1a')],'rows':_0x2558f3});});},'WhatsappQueues':function(){return new Promise(function(_0x4f6a2a){var _0x16cd2c=[];for(var _0xa1dddb in _0x3ae95d[_0x72b4('0x5c')]){if(_0x3ae95d[_0x72b4('0x5c')]['hasOwnProperty'](_0xa1dddb)){var _0x463538=_0x3ae95d[_0x72b4('0x5c')][_0xa1dddb];var _0x4d4133={'id':_0x463538['id'],'available':_0x463538[_0x72b4('0x55')],'loggedIn':_0x463538[_0x72b4('0x56')],'name':_0x463538['name'],'paused':_0x463538[_0x72b4('0x57')],'waiting':_0x463538[_0x72b4('0x53')]};_0x16cd2c[_0x72b4('0x20')](_0x4d4133);}}_0x4f6a2a({'count':_0x16cd2c[_0x72b4('0x1a')],'rows':_0x16cd2c});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xbf148c){var _0x4249ca=_['values'](_0x3ae95d['chatQueuesWaitingInteractions']);_0xbf148c({'count':_0x4249ca[_0x72b4('0x1a')],'rows':_0x4249ca});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4cdd06){var _0xcc9db6=_[_0x72b4('0x5d')](_0x3ae95d[_0x72b4('0x5e')]);_0x4cdd06({'count':_0xcc9db6[_0x72b4('0x1a')],'rows':_0xcc9db6});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xd48642){var _0x59c1fe=_[_0x72b4('0x5d')](_0x3ae95d[_0x72b4('0x5f')]);_0xd48642({'count':_0x59c1fe[_0x72b4('0x1a')],'rows':_0x59c1fe});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x38111f){var _0x405c02=_['values'](_0x3ae95d[_0x72b4('0x60')]);_0x38111f({'count':_0x405c02[_0x72b4('0x1a')],'rows':_0x405c02});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x37fab4){var _0x8e633b=_[_0x72b4('0x5d')](_0x3ae95d['faxQueuesWaitingInteractions']);_0x37fab4({'count':_0x8e633b[_0x72b4('0x1a')],'rows':_0x8e633b});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x35463d){var _0x20462b=_['values'](_0x3ae95d[_0x72b4('0x61')]);_0x35463d({'count':_0x20462b[_0x72b4('0x1a')],'rows':_0x20462b});});}};var _0x27b7c4=jayson[_0x72b4('0x62')](_0x5cd685)[_0x72b4('0x63')]();_0x27b7c4['on'](_0x72b4('0x40'),function(_0xc99cc6){logger[_0x72b4('0x40')](JSON[_0x72b4('0x3c')](_0xc99cc6));return _0x46eb8f(_0xc99cc6);});_0x27b7c4[_0x72b4('0x64')](0x232c,'127.0.0.1',function(){console[_0x72b4('0x65')](_0x72b4('0x66'),0x232c);return _0x28ae3c(_0x72b4('0x67')+0x232c);});});}; \ No newline at end of file +var _0x689f=['update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','stack','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','../../../config/logger','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','rules','message','checkWaitingNotifications','transfer','applications','length','existsSync','join','app','.js','toLowerCase','channel','mail','push','slice','dialogflow','appdata','split','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','account','interaction','body','%s:%s:%s','condition','intervals','./applications/','consequence','Push\x20new\x20rule','on\x20interval','\x20|\x20','stringify','matchPath','complete','info','Skipped\x20routing\x20for\x20%s','error','routing\x20is\x20empty','agent','agents','busyQueue','emit','end','QueueReport'];(function(_0x9795e7,_0x5ee9d0){var _0x5246e0=function(_0x2325bf){while(--_0x2325bf){_0x9795e7['push'](_0x9795e7['shift']());}};_0x5246e0(++_0x5ee9d0);}(_0x689f,0x81));var _0xf689=function(_0x5d9a72,_0x98f08){_0x5d9a72=_0x5d9a72-0x0;var _0x332393=_0x689f[_0x5d9a72];return _0x332393;};'use strict';var _=require('lodash');var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0xf689('0x0'));var BPromise=require(_0xf689('0x1'));var utils=require('./applications/utils');var sUtils=require('./applications/strategy/util');var logger=require(_0xf689('0x2'))('routing');var rpc={'openchannelQueueReport':require(_0xf689('0x3')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xf689('0x4')),'smsQueueReport':require(_0xf689('0x5')),'faxQueueReport':require(_0xf689('0x6')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xf689('0x7'));function getId(_0x3d2db9,_0x58dce7,_0x98edba){return util[_0xf689('0x8')]('%s.%s.%s',_0x3d2db9,_0x58dce7||0x0,_0x98edba||0x0);}function getIntervals(_0x3c716b,_0xc04571){var _0x27e780=[];if(!_[_0xf689('0x9')](_0xc04571[_0xf689('0xa')])&&!_[_0xf689('0x9')](_0x3c716b[_0xc04571[_0xf689('0xa')]])&&!_['isNil'](_0x3c716b[_0xc04571[_0xf689('0xa')]][_0xf689('0xb')])){_0x27e780=_[_0xf689('0xc')](_0x3c716b[_0xc04571[_0xf689('0xa')]][_0xf689('0xb')],_0xf689('0xd'));}else if(!_[_0xf689('0x9')](_0xc04571[_0xf689('0xd')])){_0x27e780=[_0xc04571[_0xf689('0xd')]];}return _0x27e780;}exports['listen']=function(_0x1ea3f2){_0x1ea3f2[_0xf689('0xe')]={};return new BPromise(function(_0x3cd379,_0x40e699){var _0x5bb578={'Start':function(_0x27e485){var _0x125b5e=this;return new Promise(function(_0xd01a52,_0x2f0c9f){if(_0x27e485){try{var _0x4ac760=[];var _0xc59d61=getId(_0x27e485['channel'],_0x27e485[_0xf689('0xf')]?_0x27e485[_0xf689('0xf')]['id']:0x0,_0x27e485['interaction']?_0x27e485['interaction']['id']:0x0);var _0x327a10=sUtils[_0xf689('0x10')](_0x1ea3f2,_0x27e485);if(_0x27e485[_0xf689('0x11')]||!_0x327a10&&_0x27e485[_0xf689('0x12')]&&_['isArray'](_0x27e485[_0xf689('0x12')])&&_0x27e485[_0xf689('0x12')][_0xf689('0x13')]){for(var _0x413979=0x0;_0x413979<_0x27e485[_0xf689('0x12')][_0xf689('0x13')];_0x413979+=0x1){var _0x5503ed=_0x27e485[_0xf689('0x12')][_0x413979];if(fs[_0xf689('0x14')](path[_0xf689('0x15')](__dirname,_0xf689('0x12'),_0x5503ed[_0xf689('0x16')]+_0xf689('0x17')))){var _0x208914=[];switch(_0x5503ed['app'][_0xf689('0x18')]()){case'autoreply':var _0x4a1758=_0x5503ed['appdata']['split'](',');if(_0x27e485[_0xf689('0x19')]===_0xf689('0x1a')){_0x208914['push'](_0x4a1758[0x0]);_0x208914[_0xf689('0x1b')](_0x4a1758[0x1]);_0x208914[_0xf689('0x1b')](_0x4a1758[_0xf689('0x1c')](0x2,_0x4a1758['length'])[_0xf689('0x15')](','));}else{_0x208914[_0xf689('0x1b')](_0x4a1758[0x0]);_0x208914[_0xf689('0x1b')](_0x4a1758[_0xf689('0x1c')](0x1,_0x4a1758[_0xf689('0x13')])[_0xf689('0x15')](','));}break;case _0xf689('0x1d'):var _0x36e645=_0x5503ed[_0xf689('0x1e')][_0xf689('0x1f')](',');_0x208914['push'](_0x36e645[0x0]);_0x208914[_0xf689('0x1b')](_0x36e645[0x1]);_0x208914[_0xf689('0x1b')](_0x36e645['slice'](0x2,_0x36e645['length'])[_0xf689('0x15')](','));break;case _0xf689('0x20'):var _0x10b3aa=_0x5503ed['appdata'][_0xf689('0x1f')](',');_0x208914['push'](_0x10b3aa[0x0]);_0x208914['push'](_0x10b3aa[0x1]);_0x208914['push'](_0x10b3aa[0x2]);_0x208914[_0xf689('0x1b')](_0x10b3aa[0x3]);_0x208914['push'](_0x10b3aa[_0xf689('0x1c')](0x4,_0x10b3aa[_0xf689('0x13')])[_0xf689('0x15')](','));break;case _0xf689('0x21'):var _0x233932=_0x5503ed[_0xf689('0x1e')][_0xf689('0x1f')](',');_0x208914[_0xf689('0x1b')](_0x233932[0x0]);_0x208914['push'](_0x233932[0x1]);_0x208914['push'](_0x233932[0x2]);_0x208914[_0xf689('0x1b')](_0x233932[0x3]);_0x208914['push'](_0x233932['slice'](0x4,_0x233932[_0xf689('0x13')])['join'](','));break;case _0xf689('0xf'):_0x208914['push'](_0x5503ed[_0xf689('0x1e')]);break;case'tag':_0x208914['push'](_0x5503ed[_0xf689('0x22')]);_0x208914[_0xf689('0x1b')](_0x5503ed[_0xf689('0x1e')]);break;case _0xf689('0x23'):var _0x5bfc3f=utils[_0xf689('0x24')](_0x27e485[_0xf689('0x25')]['notificationTemplate'],_0x27e485);var _0x35cec0=_0x5503ed[_0xf689('0x1e')][_0xf689('0x1f')](',');_0x208914['push'](_0x35cec0[0x0]);_0x208914[_0xf689('0x1b')](_0x35cec0[0x1]);_0x208914[_0xf689('0x1b')](_0x35cec0[0x2]);_0x208914[_0xf689('0x1b')](_0x35cec0[0x3]);_0x208914[_0xf689('0x1b')](_0x35cec0[0x4]);_0x208914['push'](_0x35cec0[0x5]);_0x208914['push'](_0x35cec0[0x6]);_0x208914[_0xf689('0x1b')](_0x35cec0[0x7]);_0x208914['push'](_0x35cec0[0x8]);_0x208914[_0xf689('0x1b')](_0x35cec0[0x9]);_0x208914[_0xf689('0x1b')](_0x35cec0[0xa]);_0x208914[_0xf689('0x1b')](_0x27e485[_0xf689('0x26')]['id']);_0x208914[_0xf689('0x1b')](_0x27e485[_0xf689('0xf')]['id']);_0x208914['push'](_0x5503ed['ChatWebsiteId']);_0x208914['push'](_0x27e485['interaction']['ContactId']);_0x208914[_0xf689('0x1b')](_0x27e485[_0xf689('0x27')]['body']);_0x208914[_0xf689('0x1b')](_0x5bfc3f);break;default:_0x208914=_[_0xf689('0x9')](_0x5503ed[_0xf689('0x1e')])?[]:_0x5503ed[_0xf689('0x1e')][_0xf689('0x1f')](',');}var _0x46d7ee={'id':util[_0xf689('0x8')](_0xf689('0x28'),_0xc59d61,_0x5503ed['id'],_0x5503ed[_0xf689('0x16')]),'condition':require('./interval')[_0xf689('0x29')](_0xc59d61,getIntervals(_0x1ea3f2[_0xf689('0x2a')],_0x5503ed),_0x1ea3f2),'consequence':require(_0xf689('0x2b')+_0x5503ed['app'])[_0xf689('0x2c')](_0xc59d61,_0x208914,_0x1ea3f2,_0x27e485),'p':_0x5503ed['priority']||0x0};logger['info'](_0xf689('0x2d'),_0x46d7ee['id'],_0xf689('0x2e'),getIntervals(_0x1ea3f2['intervals'],_0x5503ed)[_0xf689('0x15')](_0xf689('0x2f')));_0x4ac760[_0xf689('0x1b')](_0x46d7ee);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0xf689('0x12'),_0x5503ed[_0xf689('0x16')]+_0xf689('0x17')));}}_0x1ea3f2[_0xf689('0xe')][_0xc59d61]=new RuleEngine(_0x4ac760);_0x1ea3f2['rules'][_0xc59d61]['execute'](_0x27e485,function(_0x5750b8){logger['info']('Applications\x20executed',JSON[_0xf689('0x30')](_0x5750b8[_0xf689('0x31')]));if(_0x1ea3f2[_0xf689('0xe')][_0xc59d61]){_0x1ea3f2[_0xf689('0xe')][_0xc59d61]['emit'](_0xf689('0x32'));}});return _0xd01a52({'code':0xc8,'message':_0x27e485});}else{if(_0x327a10){logger[_0xf689('0x33')](util[_0xf689('0x8')](_0xf689('0x34'),_0xc59d61));}else{logger[_0xf689('0x33')]('No\x20applications\x20to\x20execute');}return _0xd01a52({'code':0xc8,'message':_0x27e485});}}catch(_0x449118){logger['error'](_0x449118['stack']);return _0x2f0c9f(_0x125b5e[_0xf689('0x35')](0x1f4,_0x449118));}}return _0x2f0c9f(_0xf689('0x36'));});},'AcceptMessage':function(_0x35da20){var _0x40deeb=this;return new Promise(function(_0x523dc8,_0x1fd1fe){if(_0x35da20[_0xf689('0x37')]&&_0x35da20[_0xf689('0x37')]['id']){if(_0x1ea3f2[_0xf689('0x38')][_0x35da20['agent']['id']]){_0x1ea3f2[_0xf689('0x38')][_0x35da20[_0xf689('0x37')]['id']]['busy']=![];_0x1ea3f2['agents'][_0x35da20['agent']['id']][_0xf689('0x39')]=undefined;}}if(_0x35da20['message']&&_0x35da20[_0xf689('0xf')]['id']){try{var _0x54c95e=getId(_0x35da20[_0xf689('0x19')],_0x35da20[_0xf689('0xf')]?_0x35da20['message']['id']:0x0,_0x35da20[_0xf689('0x26')]?_0x35da20[_0xf689('0x26')]['id']:0x0);if(_0x1ea3f2[_0xf689('0xe')][_0x54c95e]){_0x1ea3f2[_0xf689('0xe')][_0x54c95e][_0xf689('0x3a')](_0xf689('0x3b'));if(rpc[_0x35da20[_0xf689('0x19')]+_0xf689('0x3c')]){rpc[_0x35da20[_0xf689('0x19')]+'QueueReport'][_0xf689('0x3d')](_0x54c95e,{'UserId':_0x35da20[_0xf689('0xf')][_0xf689('0x3e')]})['catch'](function(){logger[_0xf689('0x35')](_0xf689('0x3f'));});}}return _0x523dc8({'code':0xc8,'message':_0x35da20});}catch(_0x45fe37){logger[_0xf689('0x35')](_0x45fe37['stack']);return _0x1fd1fe(_0x40deeb[_0xf689('0x35')](0x1f4,_0x45fe37));}}logger[_0xf689('0x35')](_0xf689('0x40'));return _0x1fd1fe(_0x40deeb[_0xf689('0x35')](0x1f4,_0xf689('0x40')));});},'RejectMessage':function(_0x14b253){var _0x56c5b2=this;return new Promise(function(_0x155567,_0x6d2f9e){if(_0x14b253['agent']&&_0x14b253['agent']['id']){try{if(_0x1ea3f2[_0xf689('0x38')][_0x14b253[_0xf689('0x37')]['id']]){_0x1ea3f2[_0xf689('0x38')][_0x14b253['agent']['id']][_0xf689('0x41')]=![];_0x1ea3f2[_0xf689('0x38')][_0x14b253[_0xf689('0x37')]['id']][_0xf689('0x39')]=undefined;}return _0x155567({'code':0xc8,'message':_0x14b253});}catch(_0x5e729d){logger['error'](_0x5e729d[_0xf689('0x42')]);return _0x6d2f9e(_0x56c5b2[_0xf689('0x35')](0x1f4,_0x5e729d));}}logger[_0xf689('0x35')](_0xf689('0x40'));return _0x6d2f9e(_0x56c5b2[_0xf689('0x35')](0x1f4,_0xf689('0x40')));});},'AbandonInteraction':function(_0x4f9333){var _0x5625d7=this;return new Promise(function(_0x3805e4,_0x21b282){if(_0x4f9333[_0xf689('0x19')]&&_0x4f9333[_0xf689('0x26')]&&_0x4f9333[_0xf689('0x26')]['id']){try{var _0x5d380f=getId(_0x4f9333['channel'],_0x4f9333['message']?_0x4f9333[_0xf689('0xf')]['id']:0x0,_0x4f9333[_0xf689('0x26')]?_0x4f9333[_0xf689('0x26')]['id']:0x0);if(_0x1ea3f2[_0xf689('0xe')][_0x5d380f]){_0x1ea3f2[_0xf689('0xe')][_0x5d380f][_0xf689('0x3a')](_0xf689('0x3b'));}return _0x3805e4({'code':0xc8,'message':_0x4f9333});}catch(_0x2c9407){logger['error'](_0x2c9407[_0xf689('0x42')]);return _0x21b282(_0x5625d7['error'](0x1f4,_0x2c9407));}}logger[_0xf689('0x35')](_0xf689('0x40'));return _0x21b282(_0x5625d7[_0xf689('0x35')](0x1f4,_0xf689('0x40')));});},'AgentCapacity':function(_0x98c293){var _0x3050ad=this;return new Promise(function(_0x421238,_0x6c04eb){if(_0x1ea3f2['agents'][_0xf689('0x43')](_0x98c293['id'])){for(var _0x54090b in _0x98c293[_0xf689('0x44')]){if(_0x98c293['capacity'][_0xf689('0x43')](_0x54090b)){if(_0x1ea3f2[_0xf689('0x38')][_0x98c293['id']][_0xf689('0x43')](_0x54090b+_0xf689('0x45'))){_0x1ea3f2['agents'][_0x98c293['id']][_0x54090b+_0xf689('0x45')]=parseInt(_0x98c293[_0xf689('0x44')][_0x54090b],0xa);}}}_0x1ea3f2['agents'][_0x98c293['id']][_0xf689('0x46')]();return _0x421238({'code':0xc8,'message':_0x1ea3f2[_0xf689('0x38')][_0x98c293['id']]});}else{return _0x6c04eb(_0x3050ad[_0xf689('0x35')](0x1f4,_0xf689('0x47')));}});},'Agents':function(_0x3c4860){return new Promise(function(_0x125b65){var _0x459958=_[_0xf689('0x48')](_0x1ea3f2[_0xf689('0x38')]);if(_0x3c4860&&_0x3c4860['id']){var _0x12d39a=_['find'](_0x459958,function(_0x43d975){return _0x43d975['id']===_0x3c4860['id'];});_0x125b65(_0x12d39a);}else{_0x125b65({'count':_0x459958[_0xf689('0x13')],'rows':_0x459958});}});},'ChatQueues':function(){return new Promise(function(_0x39b6c1){var _0x1c2bb0=[];for(var _0x368267 in _0x1ea3f2[_0xf689('0x49')]){if(_0x1ea3f2[_0xf689('0x49')][_0xf689('0x43')](_0x368267)){var _0x8c5b6d=_0x1ea3f2[_0xf689('0x49')][_0x368267];var _0x43112={'id':_0x8c5b6d['id'],'available':_0x8c5b6d['available'],'loggedIn':_0x8c5b6d[_0xf689('0x4a')],'name':_0x8c5b6d[_0xf689('0x4b')],'paused':_0x8c5b6d[_0xf689('0x4c')],'waiting':_0x8c5b6d[_0xf689('0x4d')]};_0x1c2bb0[_0xf689('0x1b')](_0x43112);}}_0x39b6c1({'count':_0x1c2bb0[_0xf689('0x13')],'rows':_0x1c2bb0});});},'MailQueues':function(){return new Promise(function(_0x55dbfb){var _0x19a468=[];for(var _0x126d5f in _0x1ea3f2['mailQueues']){if(_0x1ea3f2[_0xf689('0x4e')][_0xf689('0x43')](_0x126d5f)){var _0x2381ca=_0x1ea3f2[_0xf689('0x4e')][_0x126d5f];var _0x101b02={'id':_0x2381ca['id'],'available':_0x2381ca[_0xf689('0x4f')],'loggedIn':_0x2381ca[_0xf689('0x4a')],'name':_0x2381ca['name'],'paused':_0x2381ca[_0xf689('0x4c')],'waiting':_0x2381ca[_0xf689('0x4d')]};_0x19a468[_0xf689('0x1b')](_0x101b02);}}_0x55dbfb({'count':_0x19a468[_0xf689('0x13')],'rows':_0x19a468});});},'OpenchannelQueues':function(){return new Promise(function(_0x31fedd){var _0x391f88=[];for(var _0xeaa1d4 in _0x1ea3f2[_0xf689('0x50')]){if(_0x1ea3f2[_0xf689('0x50')][_0xf689('0x43')](_0xeaa1d4)){var _0x4b7060=_0x1ea3f2[_0xf689('0x50')][_0xeaa1d4];var _0x83ebfe={'id':_0x4b7060['id'],'available':_0x4b7060['available'],'loggedIn':_0x4b7060[_0xf689('0x4a')],'name':_0x4b7060[_0xf689('0x4b')],'paused':_0x4b7060['paused'],'waiting':_0x4b7060[_0xf689('0x4d')]};_0x391f88['push'](_0x83ebfe);}}_0x31fedd({'count':_0x391f88[_0xf689('0x13')],'rows':_0x391f88});});},'SmsQueues':function(){return new Promise(function(_0x515578){var _0x3ef34a=[];for(var _0xce3432 in _0x1ea3f2[_0xf689('0x51')]){if(_0x1ea3f2[_0xf689('0x51')][_0xf689('0x43')](_0xce3432)){var _0x4eb9e0=_0x1ea3f2[_0xf689('0x51')][_0xce3432];var _0x10e297={'id':_0x4eb9e0['id'],'available':_0x4eb9e0[_0xf689('0x4f')],'loggedIn':_0x4eb9e0[_0xf689('0x4a')],'name':_0x4eb9e0['name'],'paused':_0x4eb9e0[_0xf689('0x4c')],'waiting':_0x4eb9e0[_0xf689('0x4d')]};_0x3ef34a['push'](_0x10e297);}}_0x515578({'count':_0x3ef34a['length'],'rows':_0x3ef34a});});},'FaxQueues':function(){return new Promise(function(_0x1d7220){var _0xa9dcb1=[];for(var _0x7fc333 in _0x1ea3f2[_0xf689('0x52')]){if(_0x1ea3f2['faxQueues'][_0xf689('0x43')](_0x7fc333)){var _0x3a1f23=_0x1ea3f2[_0xf689('0x52')][_0x7fc333];var _0x420298={'id':_0x3a1f23['id'],'available':_0x3a1f23['available'],'loggedIn':_0x3a1f23[_0xf689('0x4a')],'name':_0x3a1f23[_0xf689('0x4b')],'paused':_0x3a1f23[_0xf689('0x4c')],'waiting':_0x3a1f23[_0xf689('0x4d')]};_0xa9dcb1[_0xf689('0x1b')](_0x420298);}}_0x1d7220({'count':_0xa9dcb1[_0xf689('0x13')],'rows':_0xa9dcb1});});},'WhatsappQueues':function(){return new Promise(function(_0x3401c0){var _0x1b52ce=[];for(var _0x33fbe1 in _0x1ea3f2['whatsappQueues']){if(_0x1ea3f2[_0xf689('0x53')][_0xf689('0x43')](_0x33fbe1)){var _0x4f4a2c=_0x1ea3f2[_0xf689('0x53')][_0x33fbe1];var _0xda3f8a={'id':_0x4f4a2c['id'],'available':_0x4f4a2c[_0xf689('0x4f')],'loggedIn':_0x4f4a2c[_0xf689('0x4a')],'name':_0x4f4a2c[_0xf689('0x4b')],'paused':_0x4f4a2c['paused'],'waiting':_0x4f4a2c[_0xf689('0x4d')]};_0x1b52ce[_0xf689('0x1b')](_0xda3f8a);}}_0x3401c0({'count':_0x1b52ce[_0xf689('0x13')],'rows':_0x1b52ce});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4396d4){var _0x55b4ec=_[_0xf689('0x48')](_0x1ea3f2[_0xf689('0x54')]);_0x4396d4({'count':_0x55b4ec[_0xf689('0x13')],'rows':_0x55b4ec});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2c122b){var _0x5f5a29=_[_0xf689('0x48')](_0x1ea3f2[_0xf689('0x55')]);_0x2c122b({'count':_0x5f5a29[_0xf689('0x13')],'rows':_0x5f5a29});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x27572d){var _0xafa4fa=_[_0xf689('0x48')](_0x1ea3f2[_0xf689('0x56')]);_0x27572d({'count':_0xafa4fa['length'],'rows':_0xafa4fa});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4893b7){var _0x2ebdd2=_['values'](_0x1ea3f2[_0xf689('0x57')]);_0x4893b7({'count':_0x2ebdd2[_0xf689('0x13')],'rows':_0x2ebdd2});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x107324){var _0x556271=_[_0xf689('0x48')](_0x1ea3f2[_0xf689('0x58')]);_0x107324({'count':_0x556271['length'],'rows':_0x556271});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xd966b4){var _0x3e1afc=_[_0xf689('0x48')](_0x1ea3f2[_0xf689('0x59')]);_0xd966b4({'count':_0x3e1afc['length'],'rows':_0x3e1afc});});}};var _0xf483a4=jayson[_0xf689('0x5a')](_0x5bb578)[_0xf689('0x5b')]();_0xf483a4['on'](_0xf689('0x35'),function(_0x172ef4){logger[_0xf689('0x35')](JSON[_0xf689('0x30')](_0x172ef4));return _0x40e699(_0x172ef4);});_0xf483a4['listen'](0x232c,'127.0.0.1',function(){console[_0xf689('0x5c')](_0xf689('0x5d'),0x232c);return _0x3cd379(_0xf689('0x5e')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index c12182c..845a9cf 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 _0xfefb=['lodash','../../../utils/iftime','iftime','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','some','join','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s'];(function(_0x60b323,_0x50cf68){var _0x434847=function(_0x3274a0){while(--_0x3274a0){_0x60b323['push'](_0x60b323['shift']());}};_0x434847(++_0x50cf68);}(_0xfefb,0x17a));var _0xbfef=function(_0x219bfb,_0x31add2){_0x219bfb=_0x219bfb-0x0;var _0x4f9949=_0xfefb[_0x219bfb];return _0x4f9949;};'use strict';var _=require(_0xbfef('0x0'));var iftime=require(_0xbfef('0x1'))[_0xbfef('0x2')];var logger=require('../../../config/logger')('routing');exports[_0xbfef('0x3')]=function(_0x9cc4f5,_0xf74375,_0x5bad5d){return function(_0xc4f580){if(_0x5bad5d['rules']&&!_0x5bad5d[_0xbfef('0x4')][_0x9cc4f5]){logger[_0xbfef('0x5')](_0xbfef('0x6'),_0x9cc4f5);return _0xc4f580[_0xbfef('0x7')]();}var _0x397e3e=_0xf74375[_0xbfef('0x8')](function(_0x2a7ab0){return iftime(_0x2a7ab0);});var _0x4c0a6b=_[_0xbfef('0x9')](_0x397e3e);if(_0x4c0a6b){logger[_0xbfef('0x5')]('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0x9cc4f5,_0xf74375[_0xbfef('0xa')](_0xbfef('0xb')),_0x4c0a6b);_0xc4f580[_0xbfef('0xc')](_0x4c0a6b);}else{logger[_0xbfef('0x5')](_0xbfef('0xd'),_0x9cc4f5,_0xf74375['join'](_0xbfef('0xb')));_0xc4f580['stop']();}};}; \ No newline at end of file +var _0x128e=['\x20|\x20','info','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','../../../utils/iftime','iftime','routing','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','some','join'];(function(_0x27c915,_0x217b29){var _0x316981=function(_0x5882d5){while(--_0x5882d5){_0x27c915['push'](_0x27c915['shift']());}};_0x316981(++_0x217b29);}(_0x128e,0x78));var _0xe128=function(_0x4b8f7a,_0x122741){_0x4b8f7a=_0x4b8f7a-0x0;var _0x1f1c3b=_0x128e[_0x4b8f7a];return _0x1f1c3b;};'use strict';var _=require('lodash');var iftime=require(_0xe128('0x0'))[_0xe128('0x1')];var logger=require('../../../config/logger')(_0xe128('0x2'));exports[_0xe128('0x3')]=function(_0x4af8b7,_0x2728c7,_0x4dc829){return function(_0x4660f4){if(_0x4dc829[_0xe128('0x4')]&&!_0x4dc829[_0xe128('0x4')][_0x4af8b7]){logger['info'](_0xe128('0x5'),_0x4af8b7);return _0x4660f4[_0xe128('0x6')]();}var _0x42a578=_0x2728c7[_0xe128('0x7')](function(_0x4cb63e){return iftime(_0x4cb63e);});var _0x54625a=_[_0xe128('0x8')](_0x42a578);if(_0x54625a){logger['info']('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0x4af8b7,_0x2728c7[_0xe128('0x9')](_0xe128('0xa')),_0x54625a);_0x4660f4['when'](_0x54625a);}else{logger[_0xe128('0xb')](_0xe128('0xc'),_0x4af8b7,_0x2728c7['join']('\x20|\x20'));_0x4660f4['stop']();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 7c9c3c4..8476016 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 _0xb49a=['[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','info','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','push','reason','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agentcomplete','agent','lodash','util','./utils','format'];(function(_0x4f05e6,_0x260d97){var _0x4f44af=function(_0x4d7f02){while(--_0x4d7f02){_0x4f05e6['push'](_0x4f05e6['shift']());}};_0x4f44af(++_0x260d97);}(_0xb49a,0xfb));var _0xab49=function(_0x1a6a4c,_0x1488f2){_0x1a6a4c=_0x1a6a4c-0x0;var _0x1b9e0f=_0xb49a[_0x1a6a4c];return _0x1b9e0f;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var utils=require(_0xab49('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1d512a,_0x8db649){utils['info'](util[_0xab49('0x3')](_0xab49('0x4'),_0x1d512a['uniqueid'],_0x1d512a['channel'],_0x1d512a[_0xab49('0x5')],_0x1d512a[_0xab49('0x6')],_0x1d512a[_0xab49('0x7')],_0x1d512a[_0xab49('0x8')],_0x1d512a[_0xab49('0x9')],_0x1d512a[_0xab49('0xa')]));if(_0x1d512a[_0xab49('0x5')]){utils['getVoiceQueueByName'](_0x1d512a[_0xab49('0x5')])[_0xab49('0xb')](function(_0xf12653){if(_0xf12653){_0x1d512a[_0xab49('0xc')]=_0xf12653[_0xab49('0xc')];_0x1d512a['agentacw']=_0x1d512a['agentcomplete']?_0xf12653[_0xab49('0xd')]:![];_0x1d512a[_0xab49('0xe')]=_0x1d512a[_0xab49('0xf')]?_0xf12653[_0xab49('0x10')]:0x0;}utils[_0xab49('0x11')]('CreateVoiceAgentReport',_0x1d512a);});}else{utils[_0xab49('0x11')](_0xab49('0x12'),_0x1d512a);}if(_0x8db649){delete transfers[_0x1d512a[_0xab49('0x13')]];}else{delete agents[_0x1d512a[_0xab49('0x14')]];}}exports[_0xab49('0x15')]=function(_0x36091a){try{utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x17'),_0x36091a[_0xab49('0x13')]),_0x36091a);agents[_0x36091a[_0xab49('0x14')]]=_0x36091a;agents[_0x36091a['destuniqueid']][_0xab49('0x18')]=utils[_0xab49('0x19')]();agents[_0x36091a[_0xab49('0x14')]][_0xab49('0xa')]=_0xab49('0x1a');agents[_0x36091a['destuniqueid']][_0xab49('0x9')]=null;agents[_0x36091a[_0xab49('0x14')]][_0xab49('0x1b')]=null;utils[_0xab49('0x1c')](util[_0xab49('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x36091a[_0xab49('0x13')],agents[_0x36091a[_0xab49('0x14')]][_0xab49('0x6')],_0x36091a['destuniqueid']));}catch(_0x4c22cd){utils[_0xab49('0x1d')](util[_0xab49('0x3')]('[%s][agents][agentcalled]',_0x36091a[_0xab49('0x13')]),_0x4c22cd);}};exports[_0xab49('0x1e')]=function(_0x49b716){try{if(!_[_0xab49('0x1f')](agents[_0x49b716['destuniqueid']])){utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][agentringnoanswer]',_0x49b716['uniqueid']),_0x49b716);utils[_0xab49('0x1c')](util['format'](_0xab49('0x20'),_0x49b716['uniqueid'],agents[_0x49b716[_0xab49('0x14')]][_0xab49('0x6')],_0x49b716[_0xab49('0x14')]));agents[_0x49b716['destuniqueid']][_0xab49('0x1e')]=!![];agents[_0x49b716['destuniqueid']][_0xab49('0x21')]=utils[_0xab49('0x19')]();agents[_0x49b716['destuniqueid']][_0xab49('0xa')]=_0xab49('0x22');agents[_0x49b716['destuniqueid']]['reason']=_0xab49('0x22');agents[_0x49b716[_0xab49('0x14')]][_0xab49('0x23')]=_0x49b716['ringtime']?parseInt(_0x49b716[_0xab49('0x24')])/0x3e8:0x0;agents[_0x49b716[_0xab49('0x14')]]['talktime']=0x0;unanswered[_0xab49('0x25')](_0x49b716[_0xab49('0x14')]);}}catch(_0x342fdf){utils['error'](util[_0xab49('0x3')]('[%s][agents][agentringnoanswer]',_0x49b716[_0xab49('0x13')]),_0x342fdf);}};exports['queuecallerabandon']=function(_0x19f094){try{_['forIn'](agents,function(_0x134a03,_0x24bd0f){if(_0x134a03[_0xab49('0x13')]==_0x19f094[_0xab49('0x13')]&&!_['includes'](unanswered,_0x134a03[_0xab49('0x14')])){utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]',_0x19f094[_0xab49('0x13')]),_0x19f094);utils['info'](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x19f094['uniqueid'],_0x134a03['membername'],_0x134a03[_0xab49('0x14')]));_0x134a03['agentringnoanswer']=!![];_0x134a03[_0xab49('0x21')]=utils[_0xab49('0x19')]();_0x134a03[_0xab49('0xa')]='abandoned';_0x134a03[_0xab49('0x26')]=_0xab49('0x27');_0x134a03[_0xab49('0x23')]=_0x19f094[_0xab49('0x23')];_0x134a03[_0xab49('0x28')]=0x0;writeDB(_0x134a03);}});}catch(_0x56b768){utils[_0xab49('0x1d')](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]',_0x19f094['uniqueid']),_0x56b768);}};exports[_0xab49('0x29')]=function(_0x29c6cf){try{if(agents[_0x29c6cf[_0xab49('0x14')]]){utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x2a'),_0x29c6cf[_0xab49('0x13')]),_0x29c6cf);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x2b'),_0x29c6cf[_0xab49('0x13')],agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x6')],_0x29c6cf['destuniqueid']));agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x2c')]=utils[_0xab49('0x19')]();agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x9')]=_0x29c6cf['connectedlinenum'];agents[_0x29c6cf[_0xab49('0x14')]]['connectedlinename']=_0x29c6cf['connectedlinename'];agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x23')]=_0x29c6cf[_0xab49('0x24')];agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0xa')]='connect';_[_0xab49('0x2d')](agents,function(_0x2cdcbf,_0x2016a9){if(_0x2cdcbf[_0xab49('0x14')]!=_0x29c6cf[_0xab49('0x14')]&&_0x2cdcbf['uniqueid']==_0x29c6cf['uniqueid']){_0x2cdcbf[_0xab49('0x28')]=0x0;_0x2cdcbf[_0xab49('0x23')]=_0x29c6cf[_0xab49('0x24')];_0x2cdcbf['agentringnoanswer']=!![];_0x2cdcbf[_0xab49('0x21')]=utils['now']();_0x2cdcbf['lastevent']='answered_elsewhere';_0x2cdcbf['reason']=_0xab49('0x2e');_0x2cdcbf[_0xab49('0x2f')]=_0x29c6cf[_0xab49('0x14')];_0x2cdcbf[_0xab49('0x30')]=_0x29c6cf[_0xab49('0x6')];writeDB(_0x2cdcbf);}});}}catch(_0x3f3776){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x2a'),_0x29c6cf[_0xab49('0x13')]),_0x3f3776);}};exports['agentcomplete']=function(_0x158042){try{if(!_[_0xab49('0x1f')](agents[_0x158042['destuniqueid']])){utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x31'),_0x158042[_0xab49('0x13')]),_0x158042);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x32'),_0x158042[_0xab49('0x13')],agents[_0x158042['destuniqueid']][_0xab49('0x6')],_0x158042[_0xab49('0x14')]));agents[_0x158042[_0xab49('0x14')]]['agentcomplete']=!![];agents[_0x158042[_0xab49('0x14')]][_0xab49('0x33')]=utils[_0xab49('0x19')]();agents[_0x158042[_0xab49('0x14')]][_0xab49('0x28')]=utils[_0xab49('0x34')](agents[_0x158042['destuniqueid']][_0xab49('0x33')],agents[_0x158042[_0xab49('0x14')]][_0xab49('0x2c')]);agents[_0x158042[_0xab49('0x14')]][_0xab49('0x26')]=_0x158042[_0xab49('0x26')];agents[_0x158042['destuniqueid']][_0xab49('0xa')]=_0xab49('0x35');writeDB(agents[_0x158042[_0xab49('0x14')]]);}}catch(_0xca56ce){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x31'),_0x158042[_0xab49('0x13')]),_0xca56ce);}};exports[_0xab49('0x36')]=function(_0xfb7d69){try{if(!_[_0xab49('0x1f')](agents[_0xfb7d69[_0xab49('0x37')]])){utils['debug'](util[_0xab49('0x3')](_0xab49('0x38'),_0xfb7d69[_0xab49('0x13')]),_0xfb7d69);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x39'),_0xfb7d69[_0xab49('0x13')],agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x6')],agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x13')]));agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x3a')]=!![];agents[_0xfb7d69[_0xab49('0x37')]]['transfertype']=_0xab49('0x3b');agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x3c')]=_0xfb7d69[_0xab49('0x3d')];agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x3e')]=agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x13')];}}catch(_0x37cf42){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x38'),_0xfb7d69[_0xab49('0x13')]),_0x37cf42);}};exports[_0xab49('0x3f')]=function(_0x235ba8){try{utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][attendedtransfer]',_0x235ba8[_0xab49('0x40')]),_0x235ba8);if(_0x235ba8[_0xab49('0x40')]==_0x235ba8[_0xab49('0x41')]){if(!_[_0xab49('0x1f')](agents[_0x235ba8[_0xab49('0x42')]])){utils['info'](util[_0xab49('0x3')](_0xab49('0x43'),_0x235ba8[_0xab49('0x40')],agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x6')]));agents[_0x235ba8[_0xab49('0x42')]]['transfer']=!![];agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x44')]=_0xab49('0x45');agents[_0x235ba8[_0xab49('0x42')]]['transferexten']=_0x235ba8['origtransfererexten'];agents[_0x235ba8[_0xab49('0x42')]]['transferuniqueid']=_0x235ba8[_0xab49('0x40')];}if(_0x235ba8[_0xab49('0x46')]&&agents[_0x235ba8[_0xab49('0x46')]]){agents[_0x235ba8[_0xab49('0x46')]][_0xab49('0x47')]=0x1;transfers[_0x235ba8[_0xab49('0x46')]]=_[_0xab49('0x48')](agents[_0x235ba8[_0xab49('0x46')]]);transfers[_0x235ba8['transfereeuniqueid']][_0xab49('0x8')]=agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x8')];transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x49')]=agents[_0x235ba8['secondtransfereruniqueid']][_0xab49('0x49')];transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x18')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x2c')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x23')]=0x0;transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x47')]=0x2;}}else if(_0x235ba8[_0xab49('0x42')]==_0x235ba8[_0xab49('0x4a')]){if(!_['isNil'](agents[_0x235ba8[_0xab49('0x40')]])){utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x43'),_0x235ba8[_0xab49('0x40')],agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x6')]));agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x3a')]=!![];agents[_0x235ba8[_0xab49('0x40')]]['transfertype']=_0xab49('0x45');agents[_0x235ba8[_0xab49('0x40')]]['transferexten']=_0x235ba8[_0xab49('0x4b')];agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x3e')]=_0x235ba8['secondtransfereruniqueid'];}if(_0x235ba8[_0xab49('0x4c')]&&agents[_0x235ba8[_0xab49('0x4c')]]){agents[_0x235ba8['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x235ba8[_0xab49('0x4c')]]=_[_0xab49('0x48')](agents[_0x235ba8[_0xab49('0x4c')]]);transfers[_0x235ba8['transfertargetuniqueid']]['calleridnum']=agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x8')];transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x49')]=agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x49')];transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x18')]=utils['now']();transfers[_0x235ba8['transfertargetuniqueid']][_0xab49('0x2c')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x23')]=0x0;transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x47')]=0x2;}}}catch(_0x108755){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x4d'),_0x235ba8['origtransfereruniqueid']),_0x108755);}};exports[_0xab49('0x4e')]=function(_0x24fb84){try{utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x4f'),_0x24fb84[_0xab49('0x13')]),_0x24fb84);if(agents[_0x24fb84[_0xab49('0x13')]]&&agents[_0x24fb84[_0xab49('0x13')]]['reason']===_0xab49('0x22')){if(_0x24fb84['cause']==='21'){agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=_0xab49('0x50');agents[_0x24fb84['uniqueid']][_0xab49('0xa')]=_0xab49('0x50');}utils['info'](util[_0xab49('0x3')](_0xab49('0x51'),_0x24fb84[_0xab49('0x13')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x6')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]));writeDB(agents[_0x24fb84[_0xab49('0x13')]]);var _0x366a3c=unanswered[_0xab49('0x52')](_0x24fb84[_0xab49('0x13')]);if(_0x366a3c>-0x1){unanswered['splice'](_0x366a3c,0x1);}}if(transfers[_0x24fb84[_0xab49('0x13')]]){transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x53')]=!![];transfers[_0x24fb84['uniqueid']][_0xab49('0x33')]=utils[_0xab49('0x19')]();transfers[_0x24fb84['uniqueid']][_0xab49('0x28')]=utils[_0xab49('0x34')](transfers[_0x24fb84['uniqueid']][_0xab49('0x33')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]);transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=_0xab49('0x54');transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]='complete';utils['info'](util[_0xab49('0x3')](_0xab49('0x51'),_0x24fb84[_0xab49('0x13')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x6')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')],transfers[_0x24fb84[_0xab49('0x13')]]['lastevent']));writeDB(transfers[_0x24fb84[_0xab49('0x13')]],!![]);}if(agents[_0x24fb84['uniqueid']]&&agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]){agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x53')]=!![];agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x33')]=utils[_0xab49('0x19')]();agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x28')]=utils[_0xab49('0x34')](agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x33')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]);agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=agents[_0x24fb84['uniqueid']]['transfer']?_0xab49('0x3a'):_0xab49('0x54');agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]=_0xab49('0x35');utils[_0xab49('0x1c')](util['format'](_0xab49('0x51'),_0x24fb84['uniqueid'],agents[_0x24fb84['uniqueid']][_0xab49('0x6')],agents[_0x24fb84['uniqueid']][_0xab49('0x26')],agents[_0x24fb84[_0xab49('0x13')]]['lastevent']));writeDB(agents[_0x24fb84[_0xab49('0x13')]]);}}catch(_0x271ee4){utils[_0xab49('0x1d')](util['format']('[%s][agents][hangup]',_0x24fb84[_0xab49('0x13')]),_0x271ee4);}}; \ No newline at end of file +var _0x41bb=['transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','transfertargetuniqueid','clone','hangup','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','complete','[%s][agents][hangup]','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','destuniqueid','lastevent','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','ringtime','talktime','push','error','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswer','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','forIn','answered_elsewhere','reason','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind'];(function(_0x367cf2,_0xd82c4){var _0x5bebe7=function(_0xd9bd88){while(--_0xd9bd88){_0x367cf2['push'](_0x367cf2['shift']());}};_0x5bebe7(++_0xd82c4);}(_0x41bb,0xc5));var _0xb41b=function(_0x554723,_0x5d673e){_0x554723=_0x554723-0x0;var _0x13971f=_0x41bb[_0x554723];return _0x13971f;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x428431,_0x4d5578){utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x4'),_0x428431[_0xb41b('0x5')],_0x428431['channel'],_0x428431[_0xb41b('0x6')],_0x428431[_0xb41b('0x7')],_0x428431[_0xb41b('0x8')],_0x428431['calleridnum'],_0x428431['connectedlinenum'],_0x428431['lastevent']));if(_0x428431[_0xb41b('0x6')]){utils[_0xb41b('0x9')](_0x428431['queue'])[_0xb41b('0xa')](function(_0x2c1a53){if(_0x2c1a53){_0x428431[_0xb41b('0xb')]=_0x2c1a53[_0xb41b('0xb')];_0x428431[_0xb41b('0xc')]=_0x428431[_0xb41b('0xd')]?_0x2c1a53[_0xb41b('0xe')]:![];_0x428431['acwtime']=_0x428431[_0xb41b('0xc')]?_0x2c1a53['acwTimeout']:0x0;}utils[_0xb41b('0xf')](_0xb41b('0x10'),_0x428431);});}else{utils[_0xb41b('0xf')](_0xb41b('0x10'),_0x428431);}if(_0x4d5578){delete transfers[_0x428431[_0xb41b('0x5')]];}else{delete agents[_0x428431['destuniqueid']];}}exports[_0xb41b('0x11')]=function(_0x2d947a){try{utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x13'),_0x2d947a['uniqueid']),_0x2d947a);agents[_0x2d947a['destuniqueid']]=_0x2d947a;agents[_0x2d947a['destuniqueid']][_0xb41b('0x14')]=utils[_0xb41b('0x15')]();agents[_0x2d947a[_0xb41b('0x16')]][_0xb41b('0x17')]=_0xb41b('0x18');agents[_0x2d947a['destuniqueid']][_0xb41b('0x19')]=null;agents[_0x2d947a[_0xb41b('0x16')]][_0xb41b('0x1a')]=null;utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x1b'),_0x2d947a[_0xb41b('0x5')],agents[_0x2d947a['destuniqueid']]['membername'],_0x2d947a['destuniqueid']));}catch(_0xf109f8){utils['error'](util[_0xb41b('0x3')](_0xb41b('0x13'),_0x2d947a[_0xb41b('0x5')]),_0xf109f8);}};exports['agentringnoanswer']=function(_0x53bc44){try{if(!_[_0xb41b('0x1c')](agents[_0x53bc44[_0xb41b('0x16')]])){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x1d'),_0x53bc44[_0xb41b('0x5')]),_0x53bc44);utils['info'](util['format'](_0xb41b('0x1e'),_0x53bc44[_0xb41b('0x5')],agents[_0x53bc44[_0xb41b('0x16')]]['membername'],_0x53bc44[_0xb41b('0x16')]));agents[_0x53bc44[_0xb41b('0x16')]]['agentringnoanswer']=!![];agents[_0x53bc44[_0xb41b('0x16')]][_0xb41b('0x1f')]=utils['now']();agents[_0x53bc44[_0xb41b('0x16')]]['lastevent']=_0xb41b('0x20');agents[_0x53bc44[_0xb41b('0x16')]]['reason']=_0xb41b('0x20');agents[_0x53bc44[_0xb41b('0x16')]]['holdtime']=_0x53bc44['ringtime']?parseInt(_0x53bc44[_0xb41b('0x21')])/0x3e8:0x0;agents[_0x53bc44[_0xb41b('0x16')]][_0xb41b('0x22')]=0x0;unanswered[_0xb41b('0x23')](_0x53bc44[_0xb41b('0x16')]);}}catch(_0x181cbd){utils[_0xb41b('0x24')](util['format'](_0xb41b('0x1d'),_0x53bc44[_0xb41b('0x5')]),_0x181cbd);}};exports['queuecallerabandon']=function(_0xe64568){try{_['forIn'](agents,function(_0x38277f,_0x31d4cd){if(_0x38277f['uniqueid']==_0xe64568[_0xb41b('0x5')]&&!_['includes'](unanswered,_0x38277f[_0xb41b('0x16')])){utils[_0xb41b('0x12')](util['format'](_0xb41b('0x25'),_0xe64568[_0xb41b('0x5')]),_0xe64568);utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x26'),_0xe64568[_0xb41b('0x5')],_0x38277f[_0xb41b('0x7')],_0x38277f[_0xb41b('0x16')]));_0x38277f[_0xb41b('0x27')]=!![];_0x38277f[_0xb41b('0x1f')]=utils['now']();_0x38277f[_0xb41b('0x17')]='abandoned';_0x38277f['reason']=_0xb41b('0x28');_0x38277f[_0xb41b('0x29')]=_0xe64568[_0xb41b('0x29')];_0x38277f[_0xb41b('0x22')]=0x0;writeDB(_0x38277f);}});}catch(_0x1b8681){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x25'),_0xe64568[_0xb41b('0x5')]),_0x1b8681);}};exports[_0xb41b('0x2a')]=function(_0x3a06a0){try{if(agents[_0x3a06a0['destuniqueid']]){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x2b'),_0x3a06a0[_0xb41b('0x5')]),_0x3a06a0);utils[_0xb41b('0x2')](util[_0xb41b('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x3a06a0['uniqueid'],agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x7')],_0x3a06a0['destuniqueid']));agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x2c')]=utils[_0xb41b('0x15')]();agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x19')]=_0x3a06a0['connectedlinenum'];agents[_0x3a06a0[_0xb41b('0x16')]]['connectedlinename']=_0x3a06a0[_0xb41b('0x1a')];agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x29')]=_0x3a06a0[_0xb41b('0x21')];agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x17')]=_0xb41b('0x2d');_[_0xb41b('0x2e')](agents,function(_0x2b0721,_0x578b67){if(_0x2b0721['destuniqueid']!=_0x3a06a0['destuniqueid']&&_0x2b0721[_0xb41b('0x5')]==_0x3a06a0['uniqueid']){_0x2b0721['talktime']=0x0;_0x2b0721[_0xb41b('0x29')]=_0x3a06a0['ringtime'];_0x2b0721[_0xb41b('0x27')]=!![];_0x2b0721[_0xb41b('0x1f')]=utils[_0xb41b('0x15')]();_0x2b0721[_0xb41b('0x17')]=_0xb41b('0x2f');_0x2b0721[_0xb41b('0x30')]=_0xb41b('0x2f');_0x2b0721['answeredelsewheredestinationuniqueid']=_0x3a06a0[_0xb41b('0x16')];_0x2b0721[_0xb41b('0x31')]=_0x3a06a0[_0xb41b('0x7')];writeDB(_0x2b0721);}});}}catch(_0x174d6c){utils['error'](util[_0xb41b('0x3')]('[%s][agents][agentconnect]',_0x3a06a0[_0xb41b('0x5')]),_0x174d6c);}};exports[_0xb41b('0xd')]=function(_0x46dbbf){try{if(!_['isNil'](agents[_0x46dbbf['destuniqueid']])){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x32'),_0x46dbbf[_0xb41b('0x5')]),_0x46dbbf);utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x33'),_0x46dbbf['uniqueid'],agents[_0x46dbbf['destuniqueid']][_0xb41b('0x7')],_0x46dbbf['destuniqueid']));agents[_0x46dbbf[_0xb41b('0x16')]]['agentcomplete']=!![];agents[_0x46dbbf[_0xb41b('0x16')]]['agentcompleteAt']=utils[_0xb41b('0x15')]();agents[_0x46dbbf['destuniqueid']][_0xb41b('0x22')]=utils[_0xb41b('0x34')](agents[_0x46dbbf[_0xb41b('0x16')]][_0xb41b('0x35')],agents[_0x46dbbf['destuniqueid']][_0xb41b('0x2c')]);agents[_0x46dbbf[_0xb41b('0x16')]]['reason']=_0x46dbbf[_0xb41b('0x30')];agents[_0x46dbbf['destuniqueid']]['lastevent']='complete';writeDB(agents[_0x46dbbf['destuniqueid']]);}}catch(_0x263d8d){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x32'),_0x46dbbf[_0xb41b('0x5')]),_0x263d8d);}};exports[_0xb41b('0x36')]=function(_0x34d076){try{if(!_[_0xb41b('0x1c')](agents[_0x34d076[_0xb41b('0x37')]])){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x38'),_0x34d076[_0xb41b('0x5')]),_0x34d076);utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x39'),_0x34d076['uniqueid'],agents[_0x34d076[_0xb41b('0x37')]]['membername'],agents[_0x34d076['transfereruniqueid']][_0xb41b('0x5')]));agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3a')]=!![];agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3b')]=_0xb41b('0x3c');agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3d')]=_0x34d076[_0xb41b('0x3e')];agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3f')]=agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x5')];}}catch(_0x3ce89e){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x38'),_0x34d076[_0xb41b('0x5')]),_0x3ce89e);}};exports[_0xb41b('0x40')]=function(_0x247ca0){try{utils[_0xb41b('0x12')](util['format'](_0xb41b('0x41'),_0x247ca0['origtransfereruniqueid']),_0x247ca0);if(_0x247ca0[_0xb41b('0x42')]==_0x247ca0[_0xb41b('0x43')]){if(!_[_0xb41b('0x1c')](agents[_0x247ca0[_0xb41b('0x44')]])){utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x45'),_0x247ca0['origtransfereruniqueid'],agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x7')]));agents[_0x247ca0[_0xb41b('0x44')]]['transfer']=!![];agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x3b')]=_0xb41b('0x46');agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x3d')]=_0x247ca0[_0xb41b('0x47')];agents[_0x247ca0[_0xb41b('0x44')]]['transferuniqueid']=_0x247ca0['origtransfereruniqueid'];}if(_0x247ca0[_0xb41b('0x48')]&&agents[_0x247ca0[_0xb41b('0x48')]]){agents[_0x247ca0['transfereeuniqueid']][_0xb41b('0x49')]=0x1;transfers[_0x247ca0[_0xb41b('0x48')]]=_['clone'](agents[_0x247ca0[_0xb41b('0x48')]]);transfers[_0x247ca0[_0xb41b('0x48')]][_0xb41b('0x4a')]=agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x4a')];transfers[_0x247ca0[_0xb41b('0x48')]][_0xb41b('0x4b')]=agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x4b')];transfers[_0x247ca0[_0xb41b('0x48')]]['agentcalledAt']=utils[_0xb41b('0x15')]();transfers[_0x247ca0[_0xb41b('0x48')]]['agentconnectAt']=utils['now']();transfers[_0x247ca0[_0xb41b('0x48')]][_0xb41b('0x29')]=0x0;transfers[_0x247ca0[_0xb41b('0x48')]]['agententerreason']=0x2;}}else if(_0x247ca0[_0xb41b('0x44')]==_0x247ca0[_0xb41b('0x4c')]){if(!_[_0xb41b('0x1c')](agents[_0x247ca0[_0xb41b('0x42')]])){utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x45'),_0x247ca0[_0xb41b('0x42')],agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x7')]));agents[_0x247ca0['origtransfereruniqueid']][_0xb41b('0x3a')]=!![];agents[_0x247ca0[_0xb41b('0x42')]]['transfertype']=_0xb41b('0x46');agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x3d')]=_0x247ca0['secondtransfererexten'];agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x3f')]=_0x247ca0[_0xb41b('0x44')];}if(_0x247ca0[_0xb41b('0x4d')]&&agents[_0x247ca0[_0xb41b('0x4d')]]){agents[_0x247ca0[_0xb41b('0x4d')]][_0xb41b('0x49')]=0x1;transfers[_0x247ca0[_0xb41b('0x4d')]]=_[_0xb41b('0x4e')](agents[_0x247ca0[_0xb41b('0x4d')]]);transfers[_0x247ca0['transfertargetuniqueid']]['calleridnum']=agents[_0x247ca0['origtransfereruniqueid']]['calleridnum'];transfers[_0x247ca0[_0xb41b('0x4d')]][_0xb41b('0x4b')]=agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x4b')];transfers[_0x247ca0[_0xb41b('0x4d')]][_0xb41b('0x14')]=utils['now']();transfers[_0x247ca0[_0xb41b('0x4d')]]['agentconnectAt']=utils[_0xb41b('0x15')]();transfers[_0x247ca0['transfertargetuniqueid']][_0xb41b('0x29')]=0x0;transfers[_0x247ca0['transfertargetuniqueid']][_0xb41b('0x49')]=0x2;}}}catch(_0xc2afd1){utils['error'](util[_0xb41b('0x3')](_0xb41b('0x41'),_0x247ca0[_0xb41b('0x42')]),_0xc2afd1);}};exports[_0xb41b('0x4f')]=function(_0x39f6ad){try{utils[_0xb41b('0x12')](util[_0xb41b('0x3')]('[%s][agents][hangup]',_0x39f6ad[_0xb41b('0x5')]),_0x39f6ad);if(agents[_0x39f6ad['uniqueid']]&&agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')]===_0xb41b('0x20')){if(_0x39f6ad['cause']==='21'){agents[_0x39f6ad['uniqueid']]['reason']='rejected';agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]=_0xb41b('0x50');}utils['info'](util['format'](_0xb41b('0x51'),_0x39f6ad[_0xb41b('0x5')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x7')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')],agents[_0x39f6ad[_0xb41b('0x5')]]['lastevent']));writeDB(agents[_0x39f6ad['uniqueid']]);var _0x303ca3=unanswered[_0xb41b('0x52')](_0x39f6ad['uniqueid']);if(_0x303ca3>-0x1){unanswered[_0xb41b('0x53')](_0x303ca3,0x1);}}if(transfers[_0x39f6ad['uniqueid']]){transfers[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0xd')]=!![];transfers[_0x39f6ad['uniqueid']][_0xb41b('0x35')]=utils[_0xb41b('0x15')]();transfers[_0x39f6ad['uniqueid']]['talktime']=utils[_0xb41b('0x34')](transfers[_0x39f6ad[_0xb41b('0x5')]]['agentcompleteAt'],transfers[_0x39f6ad[_0xb41b('0x5')]]['agentconnectAt']);transfers[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')]='agent';transfers[_0x39f6ad['uniqueid']][_0xb41b('0x17')]=_0xb41b('0x54');utils['info'](util[_0xb41b('0x3')](_0xb41b('0x51'),_0x39f6ad[_0xb41b('0x5')],transfers[_0x39f6ad['uniqueid']][_0xb41b('0x7')],transfers[_0x39f6ad['uniqueid']]['reason'],transfers[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]));writeDB(transfers[_0x39f6ad[_0xb41b('0x5')]],!![]);}if(agents[_0x39f6ad[_0xb41b('0x5')]]&&agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x2c')]){agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0xd')]=!![];agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x35')]=utils[_0xb41b('0x15')]();agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x22')]=utils['diffTime'](agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x35')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x2c')]);agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')]=agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x3a')]?'transfer':'agent';agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]=_0xb41b('0x54');utils['info'](util[_0xb41b('0x3')](_0xb41b('0x51'),_0x39f6ad['uniqueid'],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x7')],agents[_0x39f6ad['uniqueid']][_0xb41b('0x30')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]));writeDB(agents[_0x39f6ad[_0xb41b('0x5')]]);}}catch(_0x31c5c1){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x55'),_0x39f6ad[_0xb41b('0x5')]),_0x31c5c1);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index c1119af..f0c5c63 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 _0xb51f=['attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmcs-queue','xmd-queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','includes','gotoif','lastapplication','[%s][calls][newexten]','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','connectedlinenum','lastevent','accountcode','getUserByInternal','request','CreateVoiceCallReport','newchannel','debug','format','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','calleridnum','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','callerid','cause-txt','endtime','starttime','billableseconds','diffTime'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xb51f,0xfb));var _0xfb51=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0xb51f[_0x53e3fa];return _0xe8584a;};'use strict';var _=require(_0xfb51('0x0'));var util=require(_0xfb51('0x1'));var utils=require(_0xfb51('0x2'));var dispositions=[_0xfb51('0x3'),_0xfb51('0x4'),_0xfb51('0x4'),'NO\x20ANSWER',_0xfb51('0x3'),_0xfb51('0x3'),_0xfb51('0x5'),_0xfb51('0x6'),_0xfb51('0x4'),_0xfb51('0x4'),_0xfb51('0x4')];var channels={};function writeDB(_0x5c1609){utils[_0xfb51('0x7')](util['format'](_0xfb51('0x8'),_0x5c1609[_0xfb51('0x9')],_0x5c1609[_0xfb51('0xa')],_0x5c1609[_0xfb51('0xb')],_0x5c1609[_0xfb51('0xc')],_0x5c1609['interface'],_0x5c1609['calleridnum'],_0x5c1609[_0xfb51('0xd')],_0x5c1609[_0xfb51('0xe')]));if(_0x5c1609[_0xfb51('0xf')]){utils[_0xfb51('0x10')](_0x5c1609[_0xfb51('0xf')])['then'](function(_0x2a73d8){if(_0x2a73d8){_0x5c1609['UserId']=_0x2a73d8['id'];}utils[_0xfb51('0x11')](_0xfb51('0x12'),_0x5c1609);});}else{utils[_0xfb51('0x11')](_0xfb51('0x12'),_0x5c1609);}if(channels[_0x5c1609[_0xfb51('0x9')]]){delete channels[_0x5c1609['uniqueid']];}}exports[_0xfb51('0x13')]=function(_0x1c16ae){try{utils[_0xfb51('0x14')](util[_0xfb51('0x15')](_0xfb51('0x16'),_0x1c16ae['uniqueid']),_0x1c16ae);if(_0x1c16ae['uniqueid']==_0x1c16ae[_0xfb51('0x17')]&&_0x1c16ae[_0xfb51('0xa')]!='OutgoingSpoolFailed'){utils[_0xfb51('0x7')](util[_0xfb51('0x15')](_0xfb51('0x18'),_0x1c16ae[_0xfb51('0x9')],_0x1c16ae[_0xfb51('0x19')],_0x1c16ae['exten']));channels[_0x1c16ae[_0xfb51('0x9')]]={'uniqueid':_0x1c16ae[_0xfb51('0x9')],'accountcode':_0x1c16ae[_0xfb51('0xf')],'source':_0x1c16ae[_0xfb51('0x1a')],'destination':_0x1c16ae[_0xfb51('0x1b')],'destinationcontext':_0x1c16ae['context'],'channel':_0x1c16ae[_0xfb51('0xa')],'starttime':utils[_0xfb51('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xfb51('0x3'),'amaflags':_0xfb51('0x1d')};}}catch(_0x5c08d5){utils[_0xfb51('0x1e')](util[_0xfb51('0x15')]('[%s][calls][newchannel]',_0x1c16ae['uniqueid']),_0x5c08d5);}};exports['newstate']=function(_0x49feac){try{utils['debug'](util[_0xfb51('0x15')](_0xfb51('0x1f'),_0x49feac[_0xfb51('0x9')]),_0x49feac);if(!_[_0xfb51('0x20')](channels[_0x49feac['uniqueid']])&&_0x49feac[_0xfb51('0x21')]==0x6){utils[_0xfb51('0x7')](util[_0xfb51('0x15')](_0xfb51('0x22'),_0x49feac[_0xfb51('0x9')],_0x49feac[_0xfb51('0x19')],_0x49feac['channel']));if(_[_0xfb51('0x20')](channels[_0x49feac['uniqueid']][_0xfb51('0x23')])){channels[_0x49feac['uniqueid']][_0xfb51('0x23')]=utils[_0xfb51('0x1c')]();}}else if(!_['isNil'](channels[_0x49feac[_0xfb51('0x17')]])&&_0x49feac['channelstate']==0x6&&_0x49feac[_0xfb51('0x19')]!=_0xfb51('0x24')){utils[_0xfb51('0x7')](util[_0xfb51('0x15')](_0xfb51('0x25'),_0x49feac[_0xfb51('0x9')],_0x49feac[_0xfb51('0x17')],_0x49feac[_0xfb51('0x19')],_0x49feac[_0xfb51('0xa')]));channels[_0x49feac['linkedid']][_0xfb51('0xf')]=_0x49feac[_0xfb51('0xf')];channels[_0x49feac[_0xfb51('0x17')]][_0xfb51('0x26')]=_0x49feac[_0xfb51('0xa')];if(_[_0xfb51('0x20')](channels[_0x49feac[_0xfb51('0x17')]]['answertime'])){channels[_0x49feac[_0xfb51('0x17')]][_0xfb51('0x27')]=utils[_0xfb51('0x1c')]();}channels[_0x49feac[_0xfb51('0x17')]][_0xfb51('0x28')]=dispositions[_[_0xfb51('0x29')](_0x49feac[_0xfb51('0x21')])]||_0xfb51('0x5');}}catch(_0x3a326d){utils[_0xfb51('0x1e')](util[_0xfb51('0x15')](_0xfb51('0x1f'),_0x49feac[_0xfb51('0x9')]),_0x3a326d);}};exports[_0xfb51('0x2a')]=function(_0x1358ba){try{if(!_[_0xfb51('0x20')](channels[_0x1358ba[_0xfb51('0x9')]])){utils[_0xfb51('0x14')](util[_0xfb51('0x15')]('[%s][calls][hangup]',_0x1358ba[_0xfb51('0x9')]),_0x1358ba);if(_['isNil'](channels[_0x1358ba[_0xfb51('0x9')]][_0xfb51('0x2b')])){channels[_0x1358ba[_0xfb51('0x9')]][_0xfb51('0x2b')]=_0x1358ba['calleridname']+'\x20<'+_0x1358ba[_0xfb51('0x1a')]+'>';}utils[_0xfb51('0x7')](util[_0xfb51('0x15')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x1358ba[_0xfb51('0x9')],channels[_0x1358ba[_0xfb51('0x9')]]['callerid'],_0x1358ba[_0xfb51('0x2c')]));channels[_0x1358ba['uniqueid']][_0xfb51('0x2d')]=utils[_0xfb51('0x1c')]();channels[_0x1358ba['uniqueid']]['duration']=utils['diffTime'](channels[_0x1358ba[_0xfb51('0x9')]]['endtime'],channels[_0x1358ba[_0xfb51('0x9')]][_0xfb51('0x2e')]);channels[_0x1358ba[_0xfb51('0x9')]][_0xfb51('0x2f')]=channels[_0x1358ba['uniqueid']][_0xfb51('0x27')]?utils[_0xfb51('0x30')](channels[_0x1358ba[_0xfb51('0x9')]][_0xfb51('0x2d')],channels[_0x1358ba[_0xfb51('0x9')]]['answertime']):0x0;writeDB(channels[_0x1358ba[_0xfb51('0x9')]]);}}catch(_0x5b823f){utils[_0xfb51('0x1e')](util[_0xfb51('0x15')]('[%s][calls][hangup]',_0x1358ba['uniqueid']),_0x5b823f);}};exports[_0xfb51('0x31')]=function(_0x1a47ca){try{if(!_[_0xfb51('0x20')](channels[_0x1a47ca['localtwolinkedid']])){utils['debug'](util[_0xfb51('0x15')](_0xfb51('0x32'),_0x1a47ca[_0xfb51('0x33')]),_0x1a47ca);if(channels[_0x1a47ca[_0xfb51('0x34')]][_0xfb51('0xa')]==_0x1a47ca[_0xfb51('0x35')]){utils['info'](util[_0xfb51('0x15')](_0xfb51('0x36'),_0x1a47ca[_0xfb51('0x33')],_0x1a47ca[_0xfb51('0x34')],_0x1a47ca[_0xfb51('0x37')]));channels[_0x1a47ca[_0xfb51('0x34')]]['destinationchannel']=_0x1a47ca[_0xfb51('0x37')];channels[_0x1a47ca[_0xfb51('0x34')]][_0xfb51('0x38')]='_attended';}else if(channels[_0x1a47ca[_0xfb51('0x34')]][_0xfb51('0xa')]=_0x1a47ca['transfertargetchannel']){utils[_0xfb51('0x7')](util[_0xfb51('0x15')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1a47ca['origtransfereruniqueid'],_0x1a47ca['localtwolinkedid'],_0x1a47ca[_0xfb51('0x39')]));channels[_0x1a47ca[_0xfb51('0x34')]][_0xfb51('0x26')]=_0x1a47ca[_0xfb51('0x39')];channels[_0x1a47ca[_0xfb51('0x34')]][_0xfb51('0x38')]='_attended';}}}catch(_0xf2fb15){utils[_0xfb51('0x1e')](util['format'](_0xfb51('0x32'),_0x1a47ca[_0xfb51('0x33')]),_0xf2fb15);}};exports[_0xfb51('0x3a')]=function(_0x46fecf){try{if(!_[_0xfb51('0x20')](channels[_0x46fecf[_0xfb51('0x9')]])){utils[_0xfb51('0x14')](util['format'](_0xfb51('0x3b'),_0x46fecf['uniqueid']),_0x46fecf);channels[_0x46fecf[_0xfb51('0x9')]][_0xfb51('0x3c')]=utils[_0xfb51('0x1c')]();utils['info'](util[_0xfb51('0x15')](_0xfb51('0x3d'),_0x46fecf[_0xfb51('0x9')],channels[_0x46fecf[_0xfb51('0x9')]][_0xfb51('0x3c')]));}}catch(_0x267653){utils['error'](util[_0xfb51('0x15')](_0xfb51('0x3b'),_0x46fecf[_0xfb51('0x9')]),_0x267653);}};exports[_0xfb51('0x3e')]=function(_0x23aea1){try{if(!_['isNil'](channels[_0x23aea1['uniqueid']])){utils[_0xfb51('0x14')](util[_0xfb51('0x15')](_0xfb51('0x3f'),_0x23aea1['uniqueid']),_0x23aea1);if(!_[_0xfb51('0x20')](channels[_0x23aea1[_0xfb51('0x9')]][_0xfb51('0x3c')])){channels[_0x23aea1[_0xfb51('0x9')]][_0xfb51('0x40')]+=utils['diffTime'](utils[_0xfb51('0x1c')](),channels[_0x23aea1[_0xfb51('0x9')]][_0xfb51('0x3c')]);utils['info'](util[_0xfb51('0x15')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x23aea1[_0xfb51('0x9')],channels[_0x23aea1[_0xfb51('0x9')]][_0xfb51('0x40')]));delete channels[_0x23aea1[_0xfb51('0x9')]][_0xfb51('0x3c')];}}}catch(_0x18c503){utils['error'](util['format']('[%s][calls][musiconholdstop]',_0x23aea1[_0xfb51('0x9')]),_0x18c503);}};exports[_0xfb51('0x41')]=function(_0x5014a0){try{if(!_[_0xfb51('0x20')](channels[_0x5014a0[_0xfb51('0x9')]])){utils['debug'](util[_0xfb51('0x15')]('[%s][calls][varset]',_0x5014a0['uniqueid']),_0x5014a0);if(!_[_0xfb51('0x20')](_0x5014a0[_0xfb51('0x42')]['xmd-originatecalleridnum'])){utils[_0xfb51('0x7')](util[_0xfb51('0x15')](_0xfb51('0x43'),_0x5014a0['uniqueid'],_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0[_0xfb51('0x9')]][_0xfb51('0x45')]=_0x5014a0[_0xfb51('0x44')];}if(!_[_0xfb51('0x20')](_0x5014a0[_0xfb51('0x42')]['xmd-phone'])){utils[_0xfb51('0x7')](util[_0xfb51('0x15')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x5014a0[_0xfb51('0x9')],_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0[_0xfb51('0x9')]]['destination']=_0x5014a0[_0xfb51('0x44')];channels[_0x5014a0['uniqueid']]['callerid']='\x22'+_0x5014a0[_0xfb51('0x44')]+_0xfb51('0x46')+_0x5014a0[_0xfb51('0x44')]+'>';}if(!_[_0xfb51('0x20')](_0x5014a0[_0xfb51('0x42')]['xmd-callerid-preview'])||!_[_0xfb51('0x20')](_0x5014a0[_0xfb51('0x42')][_0xfb51('0x47')])){utils[_0xfb51('0x7')](util[_0xfb51('0x15')](_0xfb51('0x48'),_0x5014a0[_0xfb51('0x9')],!_[_0xfb51('0x20')](_0x5014a0['variable'][_0xfb51('0x49')])?_0xfb51('0x49'):'xmd-callerid',_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0[_0xfb51('0x9')]]['callerid']=_0x5014a0[_0xfb51('0x44')];}if(!_['isNil'](_0x5014a0['variable']['xmd-queue'])||!_[_0xfb51('0x20')](_0x5014a0[_0xfb51('0x42')][_0xfb51('0x4a')])){utils[_0xfb51('0x7')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5014a0['uniqueid'],!_[_0xfb51('0x20')](_0x5014a0[_0xfb51('0x42')][_0xfb51('0x4b')])?_0xfb51('0x4b'):'xmcs-queue',_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0['uniqueid']]['lastapplication']='Queue';channels[_0x5014a0[_0xfb51('0x9')]][_0xfb51('0x4c')]=_0x5014a0['value'];channels[_0x5014a0[_0xfb51('0x9')]][_0xfb51('0xb')]=!![];}if(!_['isNil'](_0x5014a0['variable'][_0xfb51('0x4d')])){utils[_0xfb51('0x7')](util['format'](_0xfb51('0x4e'),_0x5014a0[_0xfb51('0x9')],_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0['uniqueid']][_0xfb51('0x4f')]=_0x5014a0[_0xfb51('0x44')];}if(!_[_0xfb51('0x20')](_0x5014a0[_0xfb51('0x42')]['xmd-cdrtype'])){utils[_0xfb51('0x7')](util[_0xfb51('0x15')](_0xfb51('0x50'),_0x5014a0[_0xfb51('0x9')],_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0[_0xfb51('0x9')]][_0xfb51('0x51')]=_0x5014a0[_0xfb51('0x44')];}if(!_[_0xfb51('0x20')](_0x5014a0['variable'][_0xfb51('0x52')])){utils[_0xfb51('0x7')](util[_0xfb51('0x15')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5014a0['uniqueid'],_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0[_0xfb51('0x9')]][_0xfb51('0x53')]=_0x5014a0[_0xfb51('0x44')];}if(!_['isNil'](_0x5014a0['variable'][_0xfb51('0x54')])){utils[_0xfb51('0x7')](util[_0xfb51('0x15')](_0xfb51('0x55'),_0x5014a0[_0xfb51('0x9')],_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0[_0xfb51('0x9')]][_0xfb51('0x54')]=_0x5014a0[_0xfb51('0x44')];}}}catch(_0x486270){utils[_0xfb51('0x1e')](util[_0xfb51('0x15')]('[%s][calls][varset]',_0x5014a0[_0xfb51('0x9')]),_0x486270);}};exports[_0xfb51('0x56')]=function(_0x3e308b){try{if(!_['isNil'](channels[_0x3e308b['uniqueid']])){utils[_0xfb51('0x14')](util[_0xfb51('0x15')]('[%s][calls][newexten]',_0x3e308b['uniqueid']),_0x3e308b);utils['info'](util[_0xfb51('0x15')](_0xfb51('0x57'),_0x3e308b[_0xfb51('0x9')],_0x3e308b[_0xfb51('0x58')],_0x3e308b[_0xfb51('0x59')]));if(_0x3e308b[_0xfb51('0x58')][_0xfb51('0x5a')]()==_0xfb51('0x5b')&&_['startsWith'](_0x3e308b[_0xfb51('0x59')]['toLowerCase'](),_0xfb51('0x5c'))){var _0x1c364f=_0x3e308b[_0xfb51('0x59')][_0xfb51('0x5d')]('=');var _0x36c41b=_0x1c364f[0x0][_0xfb51('0x5e')](_0x1c364f[0x0][_0xfb51('0x5f')]('(')+0x1,_0x1c364f[0x0][_0xfb51('0x5f')](')'));var _0x2a9452=_0x1c364f[0x1];channels[_0x3e308b[_0xfb51('0x9')]][_0x36c41b]=_0x2a9452;}if(!_[_0xfb51('0x60')]([_0xfb51('0x2a'),'noop','execif',_0xfb51('0x5b'),_0xfb51('0x61')],_0x3e308b[_0xfb51('0x58')][_0xfb51('0x5a')]())){channels[_0x3e308b['uniqueid']][_0xfb51('0x62')]=_0x3e308b[_0xfb51('0x58')];channels[_0x3e308b[_0xfb51('0x9')]][_0xfb51('0x4c')]=_0x3e308b[_0xfb51('0x59')];}}}catch(_0x5975f3){utils[_0xfb51('0x1e')](util[_0xfb51('0x15')](_0xfb51('0x63'),_0x3e308b[_0xfb51('0x9')]),_0x5975f3);}}; \ No newline at end of file +var _0xc745=['context','exten','calleridnum','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','channelstate','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','callerid','calleridname','cause-txt','endtime','duration','diffTime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','destination','\x22\x20<','xmd-callerid-preview','variable','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','application','lodash','util','NO\x20ANSWER','FAILED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','interface','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s'];(function(_0x4ebe86,_0x23c417){var _0x2f895e=function(_0x1eb149){while(--_0x1eb149){_0x4ebe86['push'](_0x4ebe86['shift']());}};_0x2f895e(++_0x23c417);}(_0xc745,0xbb));var _0x5c74=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc745[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5c74('0x0'));var util=require(_0x5c74('0x1'));var utils=require('./utils');var dispositions=[_0x5c74('0x2'),_0x5c74('0x3'),_0x5c74('0x3'),_0x5c74('0x2'),'NO\x20ANSWER',_0x5c74('0x2'),'ANSWERED',_0x5c74('0x4'),'FAILED',_0x5c74('0x3'),_0x5c74('0x3')];var channels={};function writeDB(_0x169cbd){utils[_0x5c74('0x5')](util[_0x5c74('0x6')](_0x5c74('0x7'),_0x169cbd[_0x5c74('0x8')],_0x169cbd[_0x5c74('0x9')],_0x169cbd[_0x5c74('0xa')],_0x169cbd['membername'],_0x169cbd[_0x5c74('0xb')],_0x169cbd['calleridnum'],_0x169cbd['connectedlinenum'],_0x169cbd['lastevent']));if(_0x169cbd[_0x5c74('0xc')]){utils[_0x5c74('0xd')](_0x169cbd[_0x5c74('0xc')])[_0x5c74('0xe')](function(_0x5b7b2f){if(_0x5b7b2f){_0x169cbd[_0x5c74('0xf')]=_0x5b7b2f['id'];}utils[_0x5c74('0x10')]('CreateVoiceCallReport',_0x169cbd);});}else{utils[_0x5c74('0x10')](_0x5c74('0x11'),_0x169cbd);}if(channels[_0x169cbd[_0x5c74('0x8')]]){delete channels[_0x169cbd[_0x5c74('0x8')]];}}exports[_0x5c74('0x12')]=function(_0x2a3413){try{utils[_0x5c74('0x13')](util['format'](_0x5c74('0x14'),_0x2a3413[_0x5c74('0x8')]),_0x2a3413);if(_0x2a3413[_0x5c74('0x8')]==_0x2a3413['linkedid']&&_0x2a3413['channel']!=_0x5c74('0x15')){utils[_0x5c74('0x5')](util[_0x5c74('0x6')](_0x5c74('0x16'),_0x2a3413[_0x5c74('0x8')],_0x2a3413[_0x5c74('0x17')],_0x2a3413[_0x5c74('0x18')]));channels[_0x2a3413[_0x5c74('0x8')]]={'uniqueid':_0x2a3413[_0x5c74('0x8')],'accountcode':_0x2a3413[_0x5c74('0xc')],'source':_0x2a3413[_0x5c74('0x19')],'destination':_0x2a3413[_0x5c74('0x18')],'destinationcontext':_0x2a3413['context'],'channel':_0x2a3413['channel'],'starttime':utils[_0x5c74('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x5c74('0x2'),'amaflags':_0x5c74('0x1b')};}}catch(_0x283606){utils[_0x5c74('0x1c')](util[_0x5c74('0x6')](_0x5c74('0x14'),_0x2a3413[_0x5c74('0x8')]),_0x283606);}};exports['newstate']=function(_0x377ca8){try{utils[_0x5c74('0x13')](util[_0x5c74('0x6')](_0x5c74('0x1d'),_0x377ca8[_0x5c74('0x8')]),_0x377ca8);if(!_[_0x5c74('0x1e')](channels[_0x377ca8[_0x5c74('0x8')]])&&_0x377ca8[_0x5c74('0x1f')]==0x6){utils[_0x5c74('0x5')](util[_0x5c74('0x6')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x377ca8[_0x5c74('0x8')],_0x377ca8['context'],_0x377ca8['channel']));if(_[_0x5c74('0x1e')](channels[_0x377ca8[_0x5c74('0x8')]][_0x5c74('0x20')])){channels[_0x377ca8[_0x5c74('0x8')]]['systemanswertime']=utils[_0x5c74('0x1a')]();}}else if(!_[_0x5c74('0x1e')](channels[_0x377ca8[_0x5c74('0x21')]])&&_0x377ca8[_0x5c74('0x1f')]==0x6&&_0x377ca8[_0x5c74('0x17')]!=_0x5c74('0x22')){utils['info'](util[_0x5c74('0x6')](_0x5c74('0x23'),_0x377ca8[_0x5c74('0x8')],_0x377ca8[_0x5c74('0x21')],_0x377ca8['context'],_0x377ca8[_0x5c74('0x9')]));channels[_0x377ca8['linkedid']][_0x5c74('0xc')]=_0x377ca8[_0x5c74('0xc')];channels[_0x377ca8[_0x5c74('0x21')]][_0x5c74('0x24')]=_0x377ca8[_0x5c74('0x9')];if(_['isNil'](channels[_0x377ca8[_0x5c74('0x21')]][_0x5c74('0x25')])){channels[_0x377ca8[_0x5c74('0x21')]][_0x5c74('0x25')]=utils['now']();}channels[_0x377ca8[_0x5c74('0x21')]][_0x5c74('0x26')]=dispositions[_['toNumber'](_0x377ca8[_0x5c74('0x1f')])]||'ANSWERED';}}catch(_0x2868b2){utils[_0x5c74('0x1c')](util[_0x5c74('0x6')]('[%s][calls][newstate]',_0x377ca8[_0x5c74('0x8')]),_0x2868b2);}};exports['hangup']=function(_0x596e22){try{if(!_[_0x5c74('0x1e')](channels[_0x596e22[_0x5c74('0x8')]])){utils['debug'](util[_0x5c74('0x6')]('[%s][calls][hangup]',_0x596e22['uniqueid']),_0x596e22);if(_['isNil'](channels[_0x596e22[_0x5c74('0x8')]][_0x5c74('0x27')])){channels[_0x596e22['uniqueid']][_0x5c74('0x27')]=_0x596e22[_0x5c74('0x28')]+'\x20<'+_0x596e22['calleridnum']+'>';}utils['info'](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x596e22[_0x5c74('0x8')],channels[_0x596e22['uniqueid']][_0x5c74('0x27')],_0x596e22[_0x5c74('0x29')]));channels[_0x596e22[_0x5c74('0x8')]][_0x5c74('0x2a')]=utils[_0x5c74('0x1a')]();channels[_0x596e22['uniqueid']][_0x5c74('0x2b')]=utils[_0x5c74('0x2c')](channels[_0x596e22['uniqueid']]['endtime'],channels[_0x596e22['uniqueid']]['starttime']);channels[_0x596e22[_0x5c74('0x8')]][_0x5c74('0x2d')]=channels[_0x596e22[_0x5c74('0x8')]][_0x5c74('0x25')]?utils[_0x5c74('0x2c')](channels[_0x596e22[_0x5c74('0x8')]][_0x5c74('0x2a')],channels[_0x596e22[_0x5c74('0x8')]][_0x5c74('0x25')]):0x0;writeDB(channels[_0x596e22[_0x5c74('0x8')]]);}}catch(_0x4fa10){utils['error'](util[_0x5c74('0x6')](_0x5c74('0x2e'),_0x596e22[_0x5c74('0x8')]),_0x4fa10);}};exports[_0x5c74('0x2f')]=function(_0x5cf20a){try{if(!_[_0x5c74('0x1e')](channels[_0x5cf20a[_0x5c74('0x30')]])){utils['debug'](util[_0x5c74('0x6')](_0x5c74('0x31'),_0x5cf20a[_0x5c74('0x32')]),_0x5cf20a);if(channels[_0x5cf20a['localtwolinkedid']][_0x5c74('0x9')]==_0x5cf20a[_0x5c74('0x33')]){utils[_0x5c74('0x5')](util[_0x5c74('0x6')](_0x5c74('0x34'),_0x5cf20a['origtransfereruniqueid'],_0x5cf20a[_0x5c74('0x30')],_0x5cf20a[_0x5c74('0x35')]));channels[_0x5cf20a[_0x5c74('0x30')]]['destinationchannel']=_0x5cf20a[_0x5c74('0x35')];channels[_0x5cf20a[_0x5c74('0x30')]][_0x5c74('0x36')]=_0x5c74('0x37');}else if(channels[_0x5cf20a['localtwolinkedid']][_0x5c74('0x9')]=_0x5cf20a['transfertargetchannel']){utils['info'](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5cf20a['origtransfereruniqueid'],_0x5cf20a[_0x5c74('0x30')],_0x5cf20a[_0x5c74('0x38')]));channels[_0x5cf20a[_0x5c74('0x30')]]['destinationchannel']=_0x5cf20a['origtransfererchannel'];channels[_0x5cf20a[_0x5c74('0x30')]]['userfield']=_0x5c74('0x37');}}}catch(_0x838d8e){utils[_0x5c74('0x1c')](util[_0x5c74('0x6')](_0x5c74('0x31'),_0x5cf20a['origtransfereruniqueid']),_0x838d8e);}};exports[_0x5c74('0x39')]=function(_0x3d3cde){try{if(!_['isNil'](channels[_0x3d3cde[_0x5c74('0x8')]])){utils['debug'](util[_0x5c74('0x6')](_0x5c74('0x3a'),_0x3d3cde[_0x5c74('0x8')]),_0x3d3cde);channels[_0x3d3cde[_0x5c74('0x8')]][_0x5c74('0x3b')]=utils[_0x5c74('0x1a')]();utils[_0x5c74('0x5')](util[_0x5c74('0x6')](_0x5c74('0x3c'),_0x3d3cde[_0x5c74('0x8')],channels[_0x3d3cde[_0x5c74('0x8')]][_0x5c74('0x3b')]));}}catch(_0xc0ebd5){utils[_0x5c74('0x1c')](util[_0x5c74('0x6')](_0x5c74('0x3a'),_0x3d3cde[_0x5c74('0x8')]),_0xc0ebd5);}};exports[_0x5c74('0x3d')]=function(_0x258003){try{if(!_[_0x5c74('0x1e')](channels[_0x258003['uniqueid']])){utils[_0x5c74('0x13')](util[_0x5c74('0x6')](_0x5c74('0x3e'),_0x258003[_0x5c74('0x8')]),_0x258003);if(!_[_0x5c74('0x1e')](channels[_0x258003[_0x5c74('0x8')]][_0x5c74('0x3b')])){channels[_0x258003['uniqueid']][_0x5c74('0x3f')]+=utils[_0x5c74('0x2c')](utils[_0x5c74('0x1a')](),channels[_0x258003['uniqueid']][_0x5c74('0x3b')]);utils[_0x5c74('0x5')](util[_0x5c74('0x6')](_0x5c74('0x40'),_0x258003['uniqueid'],channels[_0x258003[_0x5c74('0x8')]]['mohtime']));delete channels[_0x258003[_0x5c74('0x8')]][_0x5c74('0x3b')];}}}catch(_0x1e97ea){utils[_0x5c74('0x1c')](util['format'](_0x5c74('0x3e'),_0x258003[_0x5c74('0x8')]),_0x1e97ea);}};exports[_0x5c74('0x41')]=function(_0x127673){try{if(!_[_0x5c74('0x1e')](channels[_0x127673[_0x5c74('0x8')]])){utils[_0x5c74('0x13')](util[_0x5c74('0x6')]('[%s][calls][varset]',_0x127673[_0x5c74('0x8')]),_0x127673);if(!_[_0x5c74('0x1e')](_0x127673['variable'][_0x5c74('0x42')])){utils[_0x5c74('0x5')](util[_0x5c74('0x6')](_0x5c74('0x43'),_0x127673[_0x5c74('0x8')],_0x127673['value']));channels[_0x127673[_0x5c74('0x8')]][_0x5c74('0x44')]=_0x127673['value'];}if(!_['isNil'](_0x127673['variable'][_0x5c74('0x45')])){utils[_0x5c74('0x5')](util['format'](_0x5c74('0x46'),_0x127673[_0x5c74('0x8')],_0x127673[_0x5c74('0x47')]));channels[_0x127673[_0x5c74('0x8')]][_0x5c74('0x48')]=_0x127673[_0x5c74('0x47')];channels[_0x127673[_0x5c74('0x8')]][_0x5c74('0x27')]='\x22'+_0x127673['value']+_0x5c74('0x49')+_0x127673[_0x5c74('0x47')]+'>';}if(!_[_0x5c74('0x1e')](_0x127673['variable'][_0x5c74('0x4a')])||!_[_0x5c74('0x1e')](_0x127673[_0x5c74('0x4b')][_0x5c74('0x4c')])){utils[_0x5c74('0x5')](util[_0x5c74('0x6')](_0x5c74('0x4d'),_0x127673[_0x5c74('0x8')],!_[_0x5c74('0x1e')](_0x127673[_0x5c74('0x4b')][_0x5c74('0x4a')])?_0x5c74('0x4a'):_0x5c74('0x4c'),_0x127673[_0x5c74('0x47')]));channels[_0x127673[_0x5c74('0x8')]]['callerid']=_0x127673[_0x5c74('0x47')];}if(!_['isNil'](_0x127673[_0x5c74('0x4b')]['xmd-queue'])||!_[_0x5c74('0x1e')](_0x127673[_0x5c74('0x4b')][_0x5c74('0x4e')])){utils[_0x5c74('0x5')](util[_0x5c74('0x6')](_0x5c74('0x4d'),_0x127673['uniqueid'],!_[_0x5c74('0x1e')](_0x127673[_0x5c74('0x4b')]['xmd-queue'])?_0x5c74('0x4f'):'xmcs-queue',_0x127673[_0x5c74('0x47')]));channels[_0x127673['uniqueid']][_0x5c74('0x50')]='Queue';channels[_0x127673[_0x5c74('0x8')]][_0x5c74('0x51')]=_0x127673[_0x5c74('0x47')];channels[_0x127673['uniqueid']][_0x5c74('0xa')]=!![];}if(!_[_0x5c74('0x1e')](_0x127673[_0x5c74('0x4b')][_0x5c74('0x52')])){utils[_0x5c74('0x5')](util['format'](_0x5c74('0x53'),_0x127673['uniqueid'],_0x127673[_0x5c74('0x47')]));channels[_0x127673[_0x5c74('0x8')]][_0x5c74('0x54')]=_0x127673[_0x5c74('0x47')];}if(!_[_0x5c74('0x1e')](_0x127673['variable'][_0x5c74('0x55')])){utils[_0x5c74('0x5')](util[_0x5c74('0x6')](_0x5c74('0x56'),_0x127673[_0x5c74('0x8')],_0x127673['value']));channels[_0x127673['uniqueid']][_0x5c74('0x57')]=_0x127673[_0x5c74('0x47')];}if(!_[_0x5c74('0x1e')](_0x127673[_0x5c74('0x4b')]['outboundrouteid'])){utils[_0x5c74('0x5')](util[_0x5c74('0x6')](_0x5c74('0x58'),_0x127673[_0x5c74('0x8')],_0x127673['value']));channels[_0x127673[_0x5c74('0x8')]]['routeid']=_0x127673[_0x5c74('0x47')];}if(!_[_0x5c74('0x1e')](_0x127673['variable']['sipcallid'])){utils[_0x5c74('0x5')](util[_0x5c74('0x6')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x127673[_0x5c74('0x8')],_0x127673[_0x5c74('0x47')]));channels[_0x127673['uniqueid']]['sipcallid']=_0x127673[_0x5c74('0x47')];}}}catch(_0x410da7){utils[_0x5c74('0x1c')](util[_0x5c74('0x6')](_0x5c74('0x59'),_0x127673['uniqueid']),_0x410da7);}};exports[_0x5c74('0x5a')]=function(_0xbd4d1){try{if(!_[_0x5c74('0x1e')](channels[_0xbd4d1['uniqueid']])){utils['debug'](util[_0x5c74('0x6')](_0x5c74('0x5b'),_0xbd4d1[_0x5c74('0x8')]),_0xbd4d1);utils[_0x5c74('0x5')](util['format'](_0x5c74('0x5c'),_0xbd4d1[_0x5c74('0x8')],_0xbd4d1['application'],_0xbd4d1[_0x5c74('0x5d')]));if(_0xbd4d1['application'][_0x5c74('0x5e')]()==_0x5c74('0x5f')&&_[_0x5c74('0x60')](_0xbd4d1[_0x5c74('0x5d')][_0x5c74('0x5e')](),_0x5c74('0x61'))){var _0x2ff623=_0xbd4d1[_0x5c74('0x5d')][_0x5c74('0x62')]('=');var _0x4c8636=_0x2ff623[0x0][_0x5c74('0x63')](_0x2ff623[0x0][_0x5c74('0x64')]('(')+0x1,_0x2ff623[0x0][_0x5c74('0x64')](')'));var _0x48fe72=_0x2ff623[0x1];channels[_0xbd4d1[_0x5c74('0x8')]][_0x4c8636]=_0x48fe72;}if(!_[_0x5c74('0x65')](['hangup',_0x5c74('0x66'),_0x5c74('0x67'),_0x5c74('0x5f'),'gotoif'],_0xbd4d1[_0x5c74('0x68')][_0x5c74('0x5e')]())){channels[_0xbd4d1['uniqueid']][_0x5c74('0x50')]=_0xbd4d1[_0x5c74('0x68')];channels[_0xbd4d1[_0x5c74('0x8')]]['lastdata']=_0xbd4d1[_0x5c74('0x5d')];}}}catch(_0x576b7a){utils[_0x5c74('0x1c')](util[_0x5c74('0x6')](_0x5c74('0x5b'),_0xbd4d1[_0x5c74('0x8')]),_0x576b7a);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 60d39c5..3713904 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 _0xb59f=['shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','connect','info'];(function(_0x70a7bc,_0x8cccc0){var _0x379a84=function(_0x217cdb){while(--_0x217cdb){_0x70a7bc['push'](_0x70a7bc['shift']());}};_0x379a84(++_0x8cccc0);}(_0xb59f,0x126));var _0xfb59=function(_0x280861,_0x17e5fc){_0x280861=_0x280861-0x0;var _0x22256a=_0xb59f[_0x280861];return _0x22256a;};'use strict';var utils=require('./utils');exports[_0xfb59('0x0')]=function(){utils[_0xfb59('0x1')]('[core]\x20connected');};exports[_0xfb59('0x2')]=function(){utils[_0xfb59('0x1')](_0xfb59('0x3'));};exports[_0xfb59('0x4')]=function(){utils[_0xfb59('0x1')]('[core]\x20fullybooted');};exports[_0xfb59('0x5')]=function(_0x5333b2){utils[_0xfb59('0x5')](_0xfb59('0x6'),_0x5333b2);};exports[_0xfb59('0x7')]=function(){utils[_0xfb59('0x1')]('[core]\x20close');};exports['managerevent']=function(_0x51668a){}; \ No newline at end of file +var _0x7715=['error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7715,0x101));var _0x5771=function(_0x259384,_0xf2a61e){_0x259384=_0x259384-0x0;var _0x243d3b=_0x7715[_0x259384];return _0x243d3b;};'use strict';var utils=require(_0x5771('0x0'));exports[_0x5771('0x1')]=function(){utils[_0x5771('0x2')](_0x5771('0x3'));};exports[_0x5771('0x4')]=function(){utils[_0x5771('0x2')](_0x5771('0x5'));};exports[_0x5771('0x6')]=function(){utils['info']('[core]\x20fullybooted');};exports[_0x5771('0x7')]=function(_0x5e4eab){utils[_0x5771('0x7')](_0x5771('0x8'),_0x5e4eab);};exports[_0x5771('0x9')]=function(){utils[_0x5771('0x2')](_0x5771('0xa'));};exports[_0x5771('0xb')]=function(_0x492be6){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index cf998ef..0aec71b 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 _0x0a4d=['[%s][dials][dialbegin]','assign','starttime','now','called','dialend','[%s][dials][dialend]','ANSWER','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','cause-txt','complete','diffTime','endtime','holdtime','billableseconds','lodash','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstatus','request','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','cdr(routeid)','split','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','error'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x0a4d,0xd6));var _0xd0a4=function(_0x4e29cf,_0x38f059){_0x4e29cf=_0x4e29cf-0x0;var _0x4e8941=_0x0a4d[_0x4e29cf];return _0x4e8941;};'use strict';var _=require(_0xd0a4('0x0'));var util=require('util');var utils=require(_0xd0a4('0x1'));var dials={};function writeDB(_0x2e33a){utils['info'](util[_0xd0a4('0x2')](_0xd0a4('0x3'),_0x2e33a[_0xd0a4('0x4')],_0x2e33a[_0xd0a4('0x5')],_0x2e33a['dialstring'],_0x2e33a['calleridnum'],_0x2e33a['connectedlinenum'],_0x2e33a[_0xd0a4('0x6')]));utils[_0xd0a4('0x7')]('CreateVoiceDialReport',_0x2e33a);delete dials[_0x2e33a['uniqueid']];}exports[_0xd0a4('0x8')]=function(_0x40989c){try{utils[_0xd0a4('0x9')](util[_0xd0a4('0x2')](_0xd0a4('0xa'),_0x40989c[_0xd0a4('0x4')]),_0x40989c);utils[_0xd0a4('0xb')](util['format'](_0xd0a4('0xc'),_0x40989c[_0xd0a4('0x4')],_0x40989c[_0xd0a4('0xd')],_0x40989c[_0xd0a4('0xe')]));if(_0x40989c[_0xd0a4('0xd')]['toLowerCase']()==_0xd0a4('0xf')&&_[_0xd0a4('0x10')](_0x40989c[_0xd0a4('0xe')]['toLowerCase'](),_0xd0a4('0x11'))){var _0x389e27=_0x40989c[_0xd0a4('0xe')][_0xd0a4('0x12')]('=');dials[_0x40989c['uniqueid']]={'routeId':_0x389e27[0x1]};}}catch(_0x54b297){utils['error'](util[_0xd0a4('0x2')](_0xd0a4('0xa'),_0x40989c[_0xd0a4('0x4')]),_0x54b297);}};exports[_0xd0a4('0x13')]=function(_0xc11aa7){try{utils[_0xd0a4('0x9')](util[_0xd0a4('0x2')](_0xd0a4('0x14'),_0xc11aa7['uniqueid']),_0xc11aa7);if(!_[_0xd0a4('0x15')](_0xc11aa7[_0xd0a4('0x16')][_0xd0a4('0x17')])){utils[_0xd0a4('0xb')](util[_0xd0a4('0x2')](_0xd0a4('0x18'),_0xc11aa7[_0xd0a4('0x4')],_0xc11aa7['value']));dials[_0xc11aa7['uniqueid']]={'routeId':_0xc11aa7['value']};}}catch(_0x26e72d){utils[_0xd0a4('0x19')](util[_0xd0a4('0x2')](_0xd0a4('0x14'),_0xc11aa7[_0xd0a4('0x4')]),_0x26e72d);}};exports['dialbegin']=function(_0x3b196e){try{if(!_[_0xd0a4('0x15')](dials[_0x3b196e['uniqueid']])){utils[_0xd0a4('0x9')](util[_0xd0a4('0x2')](_0xd0a4('0x1a'),_0x3b196e[_0xd0a4('0x4')]),_0x3b196e);dials[_0x3b196e['uniqueid']]=_[_0xd0a4('0x1b')](dials[_0x3b196e[_0xd0a4('0x4')]],_0x3b196e);dials[_0x3b196e[_0xd0a4('0x4')]][_0xd0a4('0x1c')]=utils[_0xd0a4('0x1d')]();dials[_0x3b196e['uniqueid']]['lastevent']=_0xd0a4('0x1e');utils[_0xd0a4('0xb')](util[_0xd0a4('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x3b196e[_0xd0a4('0x4')],dials[_0x3b196e['uniqueid']][_0xd0a4('0x1c')]));}}catch(_0x17270c){utils[_0xd0a4('0x19')](util[_0xd0a4('0x2')](_0xd0a4('0x1a'),_0x3b196e[_0xd0a4('0x4')]),_0x17270c);}};exports[_0xd0a4('0x1f')]=function(_0x5cffa1){try{if(!_[_0xd0a4('0x15')](dials[_0x5cffa1[_0xd0a4('0x4')]])){utils[_0xd0a4('0x9')](util[_0xd0a4('0x2')](_0xd0a4('0x20'),_0x5cffa1[_0xd0a4('0x4')]),_0x5cffa1);dials[_0x5cffa1[_0xd0a4('0x4')]][_0xd0a4('0x6')]=_0x5cffa1[_0xd0a4('0x6')];if(_0x5cffa1[_0xd0a4('0x6')]==_0xd0a4('0x21')){dials[_0x5cffa1['uniqueid']]=_[_0xd0a4('0x1b')](dials[_0x5cffa1[_0xd0a4('0x4')]],_0x5cffa1);dials[_0x5cffa1[_0xd0a4('0x4')]]['answertime']=utils[_0xd0a4('0x1d')]();dials[_0x5cffa1['uniqueid']][_0xd0a4('0x22')]=_0xd0a4('0x23');utils['info'](util['format'](_0xd0a4('0x24'),_0x5cffa1[_0xd0a4('0x4')],_0x5cffa1[_0xd0a4('0x6')],dials[_0x5cffa1[_0xd0a4('0x4')]][_0xd0a4('0x25')]));}else{utils[_0xd0a4('0xb')](util[_0xd0a4('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0x5cffa1[_0xd0a4('0x4')],_0x5cffa1[_0xd0a4('0x6')]));}}}catch(_0x194f0b){utils[_0xd0a4('0x19')](util[_0xd0a4('0x2')]('[%s][dials][dialend]',_0x5cffa1['uniqueid']),_0x194f0b);}};exports[_0xd0a4('0x26')]=function(_0x4d2dec){try{if(!_['isNil'](dials[_0x4d2dec[_0xd0a4('0x4')]])){utils[_0xd0a4('0x9')](util['format'](_0xd0a4('0x27'),_0x4d2dec[_0xd0a4('0x4')]),_0x4d2dec);utils[_0xd0a4('0xb')](util[_0xd0a4('0x2')](_0xd0a4('0x28'),_0x4d2dec[_0xd0a4('0x4')],_0x4d2dec[_0xd0a4('0x29')],_0x4d2dec['calleridname'],_0x4d2dec[_0xd0a4('0x2a')]));dials[_0x4d2dec[_0xd0a4('0x4')]]=_[_0xd0a4('0x1b')](dials[_0x4d2dec[_0xd0a4('0x4')]],{'endtime':utils[_0xd0a4('0x1d')](),'lastevent':_0xd0a4('0x2b')});dials[_0x4d2dec[_0xd0a4('0x4')]]['duration']=utils[_0xd0a4('0x2c')](dials[_0x4d2dec[_0xd0a4('0x4')]][_0xd0a4('0x2d')],dials[_0x4d2dec[_0xd0a4('0x4')]]['starttime']);dials[_0x4d2dec[_0xd0a4('0x4')]][_0xd0a4('0x2e')]=utils['diffTime'](dials[_0x4d2dec[_0xd0a4('0x4')]]['answertime']||dials[_0x4d2dec[_0xd0a4('0x4')]]['endtime'],dials[_0x4d2dec[_0xd0a4('0x4')]][_0xd0a4('0x1c')]);dials[_0x4d2dec[_0xd0a4('0x4')]][_0xd0a4('0x2f')]=dials[_0x4d2dec['uniqueid']]['answertime']?utils['diffTime'](dials[_0x4d2dec[_0xd0a4('0x4')]][_0xd0a4('0x2d')],dials[_0x4d2dec['uniqueid']][_0xd0a4('0x25')]):0x0;writeDB(dials[_0x4d2dec[_0xd0a4('0x4')]]);}}catch(_0x471b55){utils[_0xd0a4('0x19')](util[_0xd0a4('0x2')](_0xd0a4('0x27'),_0x4d2dec[_0xd0a4('0x4')]),_0x471b55);}}; \ No newline at end of file +var _0x9ec3=['complete','diffTime','endtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','dialstatus','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt'];(function(_0x3f8cae,_0x3a4187){var _0x55aaa5=function(_0x278fbc){while(--_0x278fbc){_0x3f8cae['push'](_0x3f8cae['shift']());}};_0x55aaa5(++_0x3a4187);}(_0x9ec3,0x99));var _0x39ec=function(_0x390dad,_0x3a3e5a){_0x390dad=_0x390dad-0x0;var _0x490148=_0x9ec3[_0x390dad];return _0x490148;};'use strict';var _=require(_0x39ec('0x0'));var util=require(_0x39ec('0x1'));var utils=require(_0x39ec('0x2'));var dials={};function writeDB(_0x483210){utils[_0x39ec('0x3')](util[_0x39ec('0x4')](_0x39ec('0x5'),_0x483210[_0x39ec('0x6')],_0x483210['channel'],_0x483210[_0x39ec('0x7')],_0x483210[_0x39ec('0x8')],_0x483210[_0x39ec('0x9')],_0x483210['dialstatus']));utils[_0x39ec('0xa')](_0x39ec('0xb'),_0x483210);delete dials[_0x483210[_0x39ec('0x6')]];}exports[_0x39ec('0xc')]=function(_0x3cab3f){try{utils[_0x39ec('0xd')](util[_0x39ec('0x4')](_0x39ec('0xe'),_0x3cab3f[_0x39ec('0x6')]),_0x3cab3f);utils[_0x39ec('0x3')](util[_0x39ec('0x4')](_0x39ec('0xf'),_0x3cab3f[_0x39ec('0x6')],_0x3cab3f[_0x39ec('0x10')],_0x3cab3f[_0x39ec('0x11')]));if(_0x3cab3f[_0x39ec('0x10')]['toLowerCase']()=='set'&&_['startsWith'](_0x3cab3f[_0x39ec('0x11')]['toLowerCase'](),_0x39ec('0x12'))){var _0x460eb3=_0x3cab3f[_0x39ec('0x11')][_0x39ec('0x13')]('=');dials[_0x3cab3f[_0x39ec('0x6')]]={'routeId':_0x460eb3[0x1]};}}catch(_0x167f1e){utils[_0x39ec('0x14')](util[_0x39ec('0x4')](_0x39ec('0xe'),_0x3cab3f[_0x39ec('0x6')]),_0x167f1e);}};exports[_0x39ec('0x15')]=function(_0x5a3ccd){try{utils[_0x39ec('0xd')](util[_0x39ec('0x4')](_0x39ec('0x16'),_0x5a3ccd[_0x39ec('0x6')]),_0x5a3ccd);if(!_['isNil'](_0x5a3ccd[_0x39ec('0x17')][_0x39ec('0x18')])){utils[_0x39ec('0x3')](util['format'](_0x39ec('0x19'),_0x5a3ccd['uniqueid'],_0x5a3ccd[_0x39ec('0x1a')]));dials[_0x5a3ccd[_0x39ec('0x6')]]={'routeId':_0x5a3ccd[_0x39ec('0x1a')]};}}catch(_0x1c2c38){utils[_0x39ec('0x14')](util[_0x39ec('0x4')](_0x39ec('0x16'),_0x5a3ccd['uniqueid']),_0x1c2c38);}};exports[_0x39ec('0x1b')]=function(_0x110278){try{if(!_[_0x39ec('0x1c')](dials[_0x110278[_0x39ec('0x6')]])){utils['debug'](util[_0x39ec('0x4')](_0x39ec('0x1d'),_0x110278[_0x39ec('0x6')]),_0x110278);dials[_0x110278['uniqueid']]=_[_0x39ec('0x1e')](dials[_0x110278[_0x39ec('0x6')]],_0x110278);dials[_0x110278['uniqueid']][_0x39ec('0x1f')]=utils[_0x39ec('0x20')]();dials[_0x110278[_0x39ec('0x6')]][_0x39ec('0x21')]=_0x39ec('0x22');utils[_0x39ec('0x3')](util[_0x39ec('0x4')](_0x39ec('0x23'),_0x110278[_0x39ec('0x6')],dials[_0x110278[_0x39ec('0x6')]]['starttime']));}}catch(_0x189fd2){utils['error'](util[_0x39ec('0x4')](_0x39ec('0x1d'),_0x110278[_0x39ec('0x6')]),_0x189fd2);}};exports['dialend']=function(_0x19b40d){try{if(!_[_0x39ec('0x1c')](dials[_0x19b40d[_0x39ec('0x6')]])){utils[_0x39ec('0xd')](util[_0x39ec('0x4')](_0x39ec('0x24'),_0x19b40d[_0x39ec('0x6')]),_0x19b40d);dials[_0x19b40d[_0x39ec('0x6')]][_0x39ec('0x25')]=_0x19b40d[_0x39ec('0x25')];if(_0x19b40d[_0x39ec('0x25')]==_0x39ec('0x26')){dials[_0x19b40d['uniqueid']]=_[_0x39ec('0x1e')](dials[_0x19b40d[_0x39ec('0x6')]],_0x19b40d);dials[_0x19b40d[_0x39ec('0x6')]][_0x39ec('0x27')]=utils['now']();dials[_0x19b40d[_0x39ec('0x6')]][_0x39ec('0x21')]=_0x39ec('0x28');utils[_0x39ec('0x3')](util[_0x39ec('0x4')](_0x39ec('0x29'),_0x19b40d['uniqueid'],_0x19b40d[_0x39ec('0x25')],dials[_0x19b40d[_0x39ec('0x6')]][_0x39ec('0x27')]));}else{utils[_0x39ec('0x3')](util['format'](_0x39ec('0x2a'),_0x19b40d[_0x39ec('0x6')],_0x19b40d['dialstatus']));}}}catch(_0x5d49bf){utils[_0x39ec('0x14')](util['format'](_0x39ec('0x24'),_0x19b40d[_0x39ec('0x6')]),_0x5d49bf);}};exports[_0x39ec('0x2b')]=function(_0x3cb9ec){try{if(!_['isNil'](dials[_0x3cb9ec['uniqueid']])){utils[_0x39ec('0xd')](util['format'](_0x39ec('0x2c'),_0x3cb9ec[_0x39ec('0x6')]),_0x3cb9ec);utils['info'](util[_0x39ec('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x3cb9ec[_0x39ec('0x6')],_0x3cb9ec['calleridnum'],_0x3cb9ec[_0x39ec('0x2d')],_0x3cb9ec[_0x39ec('0x2e')]));dials[_0x3cb9ec['uniqueid']]=_[_0x39ec('0x1e')](dials[_0x3cb9ec['uniqueid']],{'endtime':utils[_0x39ec('0x20')](),'lastevent':_0x39ec('0x2f')});dials[_0x3cb9ec['uniqueid']]['duration']=utils[_0x39ec('0x30')](dials[_0x3cb9ec[_0x39ec('0x6')]]['endtime'],dials[_0x3cb9ec['uniqueid']]['starttime']);dials[_0x3cb9ec[_0x39ec('0x6')]]['holdtime']=utils['diffTime'](dials[_0x3cb9ec[_0x39ec('0x6')]][_0x39ec('0x27')]||dials[_0x3cb9ec[_0x39ec('0x6')]][_0x39ec('0x31')],dials[_0x3cb9ec[_0x39ec('0x6')]][_0x39ec('0x1f')]);dials[_0x3cb9ec['uniqueid']]['billableseconds']=dials[_0x3cb9ec[_0x39ec('0x6')]][_0x39ec('0x27')]?utils['diffTime'](dials[_0x3cb9ec[_0x39ec('0x6')]][_0x39ec('0x31')],dials[_0x3cb9ec['uniqueid']]['answertime']):0x0;writeDB(dials[_0x3cb9ec[_0x39ec('0x6')]]);}}catch(_0x163dbf){utils[_0x39ec('0x14')](util[_0x39ec('0x4')]('[%s][dials][hangup]',_0x3cb9ec[_0x39ec('0x6')]),_0x163dbf);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 54b4d61..5d2f371 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 _0x4415=['connect','shutdown','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','env','production','local','asterisk','port','username','password','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller'];(function(_0x44c974,_0x1bcfde){var _0x5214c6=function(_0x10aad5){while(--_0x10aad5){_0x44c974['push'](_0x44c974['shift']());}};_0x5214c6(++_0x1bcfde);}(_0x4415,0x1d5));var _0x5441=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0x4415[_0x2dd390];return _0x3afe47;};var AsteriskManager=require(_0x5441('0x0'));var config=require(_0x5441('0x1'));var utils=require('./utils');var util=require(_0x5441('0x2'));var isXDREnabled=config[_0x5441('0x3')]&&config[_0x5441('0x3')][_0x5441('0x4')]?!config['xdr'][_0x5441('0x4')]:!![];var isProduction=config[_0x5441('0x5')]===_0x5441('0x6')||![];var isLocalAsterisk=config[_0x5441('0x3')]&&config[_0x5441('0x3')][_0x5441('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x5441('0x8')][_0x5441('0x9')],config[_0x5441('0x8')]['ip'],config['asterisk'][_0x5441('0xa')],config[_0x5441('0x8')][_0x5441('0xb')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x5441('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x5441('0xd')](_0x5441('0xe'));}else{var agents=require('./agents.controller');var calls=require(_0x5441('0xf'));var queues=require(_0x5441('0x10'));var recordings=require(_0x5441('0x11'));var members=require(_0x5441('0x12'));var dials=require('./dials.controller');var transfers=require(_0x5441('0x13'));var core=require(_0x5441('0x14'));ami['on'](_0x5441('0x15'),core['connect']);ami['on'](_0x5441('0x16'),core['shutdown']);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x5441('0x17'),core[_0x5441('0x17')]);ami['on'](_0x5441('0x18'),core['close']);ami['on'](_0x5441('0x19'),core[_0x5441('0x19')]);ami['on'](_0x5441('0x1a'),function(_0x4ed298){try{utils['debug'](util['format'](_0x5441('0x1b'),_0x4ed298[_0x5441('0x1c')]),_0x4ed298);members['devicestatechange'](_0x4ed298);}catch(_0xc4f6e1){utils['error'](util[_0x5441('0x1d')](_0x5441('0x1b'),_0x4ed298[_0x5441('0x1c')]),_0xc4f6e1);}});ami['on'](_0x5441('0x1e'),function(_0x5557f2){try{utils['debug'](util[_0x5441('0x1d')](_0x5441('0x1f'),_0x5557f2['uniqueid']),_0x5557f2);agents[_0x5441('0x1e')](_0x5557f2);}catch(_0xd6062f){utils[_0x5441('0x17')](util[_0x5441('0x1d')](_0x5441('0x1f'),_0x5557f2[_0x5441('0x20')]),_0xd6062f);}});ami['on'](_0x5441('0x21'),function(_0x55bff0){try{utils[_0x5441('0x22')](util['format'](_0x5441('0x23'),_0x55bff0[_0x5441('0x20')]),_0x55bff0);agents['agentringnoanswer'](_0x55bff0);}catch(_0x226353){utils['error'](util['format'](_0x5441('0x23'),_0x55bff0['uniqueid']),_0x226353);}});ami['on'](_0x5441('0x24'),function(_0x5458bb){try{utils[_0x5441('0x22')](util['format'](_0x5441('0x25'),_0x5458bb[_0x5441('0x20')]),_0x5458bb);agents['agentconnect'](_0x5458bb);queues[_0x5441('0x24')](_0x5458bb);}catch(_0x5af2e0){utils[_0x5441('0x17')](util['format'](_0x5441('0x25'),_0x5458bb['uniqueid']),_0x5af2e0);}});ami['on'](_0x5441('0x26'),function(_0x28066b){try{utils[_0x5441('0x22')](util['format'](_0x5441('0x27'),_0x28066b[_0x5441('0x20')]),_0x28066b);agents[_0x5441('0x26')](_0x28066b);queues[_0x5441('0x26')](_0x28066b);members['agentcomplete'](_0x28066b);}catch(_0x3ec093){utils[_0x5441('0x17')](util[_0x5441('0x1d')](_0x5441('0x27'),_0x28066b['uniqueid']),_0x3ec093);}});ami['on'](_0x5441('0x28'),function(_0x2ae7f4){try{utils[_0x5441('0x22')](util['format']('[%s][index][queuecallerabandon]',_0x2ae7f4[_0x5441('0x20')]),_0x2ae7f4);agents[_0x5441('0x28')](_0x2ae7f4);queues[_0x5441('0x28')](_0x2ae7f4);}catch(_0x240b76){utils['error'](util[_0x5441('0x1d')](_0x5441('0x29'),_0x2ae7f4[_0x5441('0x20')]),_0x240b76);}});ami['on'](_0x5441('0x2a'),function(_0x14ee75){try{utils['debug'](util['format']('[%s][index][queuecallerjoin]',_0x14ee75[_0x5441('0x20')]),_0x14ee75);queues[_0x5441('0x2a')](_0x14ee75);recordings[_0x5441('0x2a')](_0x14ee75);}catch(_0x579d1e){utils['error'](util[_0x5441('0x1d')]('[%s][index][queuecallerjoin]',_0x14ee75['uniqueid']),_0x579d1e);}});ami['on'](_0x5441('0x2b'),function(_0x375939){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')](_0x5441('0x2c'),_0x375939[_0x5441('0x20')]),_0x375939);queues[_0x5441('0x2b')](_0x375939);}catch(_0x473066){utils[_0x5441('0x17')](util[_0x5441('0x1d')]('[%s][index][queuecallerleave]',_0x375939[_0x5441('0x20')]),_0x473066);}});ami['on']('musiconholdstart',function(_0x202093){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')]('[%s][index][musiconholdstart]',_0x202093[_0x5441('0x20')]),_0x202093);queues[_0x5441('0x2d')](_0x202093);calls[_0x5441('0x2d')](_0x202093);}catch(_0x1c850e){utils[_0x5441('0x17')](util[_0x5441('0x1d')](_0x5441('0x2e'),_0x202093[_0x5441('0x20')]),_0x1c850e);}});ami['on'](_0x5441('0x2f'),function(_0xb50b0){try{utils['debug'](util[_0x5441('0x1d')](_0x5441('0x30'),_0xb50b0[_0x5441('0x20')]),_0xb50b0);queues[_0x5441('0x2f')](_0xb50b0);calls[_0x5441('0x2f')](_0xb50b0);}catch(_0x3d844b){utils[_0x5441('0x17')](util[_0x5441('0x1d')]('[%s][index][musiconholdstop]',_0xb50b0[_0x5441('0x20')]),_0x3d844b);}});ami['on'](_0x5441('0x31'),function(_0x39e989){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')](_0x5441('0x32'),_0x39e989[_0x5441('0x20')]),_0x39e989);calls[_0x5441('0x31')](_0x39e989);recordings['newstate'](_0x39e989);}catch(_0xe15902){utils['error'](util[_0x5441('0x1d')]('[%s][index][newstate]',_0x39e989[_0x5441('0x20')]),_0xe15902);}});ami['on'](_0x5441('0x33'),function(_0x30b283){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')](_0x5441('0x34'),_0x30b283[_0x5441('0x20')]),_0x30b283);calls[_0x5441('0x33')](_0x30b283);recordings[_0x5441('0x33')](_0x30b283);dials[_0x5441('0x33')](_0x30b283);agents[_0x5441('0x33')](_0x30b283);queues['hangup'](_0x30b283);}catch(_0x364e37){utils[_0x5441('0x17')](util[_0x5441('0x1d')](_0x5441('0x34'),_0x30b283[_0x5441('0x20')]),_0x364e37);}});ami['on']('cdr',function(_0x93c161){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')](_0x5441('0x35'),_0x93c161['uniqueid']),_0x93c161);members[_0x5441('0x36')](_0x93c161);}catch(_0x4f11f6){utils[_0x5441('0x17')](util['format'](_0x5441('0x35'),_0x93c161[_0x5441('0x20')]),_0x4f11f6);}});ami['on'](_0x5441('0x37'),function(_0x57d0e6){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')](_0x5441('0x38'),_0x57d0e6[_0x5441('0x20')]),_0x57d0e6);queues[_0x5441('0x37')](_0x57d0e6);agents[_0x5441('0x37')](_0x57d0e6);transfers[_0x5441('0x37')](_0x57d0e6);}catch(_0x2e0a17){utils[_0x5441('0x17')](util[_0x5441('0x1d')](_0x5441('0x38'),_0x57d0e6['uniqueid']),_0x2e0a17);}});ami['on']('attendedtransfer',function(_0x412723){try{utils[_0x5441('0x22')](util['format'](_0x5441('0x39'),_0x412723['origtransfereruniqueid']),_0x412723);queues['attendedtransfer'](_0x412723);transfers[_0x5441('0x3a')](_0x412723);agents[_0x5441('0x3a')](_0x412723);calls[_0x5441('0x3a')](_0x412723);}catch(_0x2eee7f){utils[_0x5441('0x17')](util['format'](_0x5441('0x39'),_0x412723[_0x5441('0x3b')]),_0x2eee7f);}});ami['on']('varset',function(_0x393b9e){try{utils[_0x5441('0x22')](util['format'](_0x5441('0x3c'),_0x393b9e[_0x5441('0x20')]),_0x393b9e);queues[_0x5441('0x3d')](_0x393b9e);recordings[_0x5441('0x3d')](_0x393b9e);calls[_0x5441('0x3d')](_0x393b9e);dials[_0x5441('0x3d')](_0x393b9e);}catch(_0x495840){utils['error'](util[_0x5441('0x1d')](_0x5441('0x3c'),_0x393b9e[_0x5441('0x20')]),_0x495840);}});ami['on']('newexten',function(_0x3ba05f){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')](_0x5441('0x3e'),_0x3ba05f[_0x5441('0x20')]),_0x3ba05f);calls['newexten'](_0x3ba05f);recordings[_0x5441('0x3f')](_0x3ba05f);dials['newexten'](_0x3ba05f);}catch(_0x276008){utils[_0x5441('0x17')](util[_0x5441('0x1d')](_0x5441('0x3e'),_0x3ba05f[_0x5441('0x20')]),_0x276008);}});ami['on'](_0x5441('0x40'),function(_0x4c4c7f){try{utils['debug'](util[_0x5441('0x1d')]('[%s][index][newchannel]',_0x4c4c7f[_0x5441('0x20')]),_0x4c4c7f);calls[_0x5441('0x40')](_0x4c4c7f);recordings[_0x5441('0x40')](_0x4c4c7f);}catch(_0x193929){utils[_0x5441('0x17')](util['format']('[%s][index][newchannel]',_0x4c4c7f[_0x5441('0x20')]),_0x193929);}});ami['on'](_0x5441('0x41'),function(_0x1944b0){try{utils['debug'](util['format'](_0x5441('0x42'),_0x1944b0[_0x5441('0x20')]),_0x1944b0);dials['dialbegin'](_0x1944b0);}catch(_0x24668e){utils[_0x5441('0x17')](util['format'](_0x5441('0x43'),_0x1944b0[_0x5441('0x20')]),_0x24668e);}});ami['on'](_0x5441('0x44'),function(_0x164791){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')](_0x5441('0x45'),_0x164791[_0x5441('0x20')]),_0x164791);dials['dialend'](_0x164791);}catch(_0x5c249f){utils['error'](util[_0x5441('0x1d')](_0x5441('0x45'),_0x164791['uniqueid']),_0x5c249f);}});} \ No newline at end of file +var _0x0178=['[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','env','asterisk','port','username','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart'];(function(_0x2a25c0,_0x531657){var _0x25a026=function(_0x3cbd04){while(--_0x3cbd04){_0x2a25c0['push'](_0x2a25c0['shift']());}};_0x25a026(++_0x531657);}(_0x0178,0x171));var _0x8017=function(_0x54fd7b,_0x4386c4){_0x54fd7b=_0x54fd7b-0x0;var _0x37bd7d=_0x0178[_0x54fd7b];return _0x37bd7d;};var AsteriskManager=require('asterisk-manager');var config=require(_0x8017('0x0'));var utils=require(_0x8017('0x1'));var util=require(_0x8017('0x2'));var isXDREnabled=config['xdr']&&config[_0x8017('0x3')][_0x8017('0x4')]?!config[_0x8017('0x3')][_0x8017('0x4')]:!![];var isProduction=config[_0x8017('0x5')]==='production'||![];var isLocalAsterisk=config[_0x8017('0x3')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x8017('0x6')][_0x8017('0x7')],config[_0x8017('0x6')]['ip'],config['asterisk'][_0x8017('0x8')],config[_0x8017('0x6')]['password'],!![]);ami[_0x8017('0x9')]();if(!isXDREnabled){utils[_0x8017('0xa')](_0x8017('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x8017('0xc'));}else{var agents=require(_0x8017('0xd'));var calls=require(_0x8017('0xe'));var queues=require(_0x8017('0xf'));var recordings=require(_0x8017('0x10'));var members=require(_0x8017('0x11'));var dials=require('./dials.controller');var transfers=require(_0x8017('0x12'));var core=require('./core.controller');ami['on'](_0x8017('0x13'),core[_0x8017('0x13')]);ami['on'](_0x8017('0x14'),core[_0x8017('0x14')]);ami['on'](_0x8017('0x15'),core[_0x8017('0x15')]);ami['on'](_0x8017('0x16'),core[_0x8017('0x16')]);ami['on'](_0x8017('0x17'),core[_0x8017('0x17')]);ami['on'](_0x8017('0x18'),core[_0x8017('0x18')]);ami['on'](_0x8017('0x19'),function(_0x15c7c4){try{utils[_0x8017('0x1a')](util[_0x8017('0x1b')](_0x8017('0x1c'),_0x15c7c4[_0x8017('0x1d')]),_0x15c7c4);members[_0x8017('0x19')](_0x15c7c4);}catch(_0x3e24a7){utils[_0x8017('0x16')](util[_0x8017('0x1b')](_0x8017('0x1c'),_0x15c7c4[_0x8017('0x1d')]),_0x3e24a7);}});ami['on']('agentcalled',function(_0x4ac69a){try{utils[_0x8017('0x1a')](util['format'](_0x8017('0x1e'),_0x4ac69a[_0x8017('0x1f')]),_0x4ac69a);agents[_0x8017('0x20')](_0x4ac69a);}catch(_0x2047f0){utils[_0x8017('0x16')](util['format'](_0x8017('0x1e'),_0x4ac69a[_0x8017('0x1f')]),_0x2047f0);}});ami['on'](_0x8017('0x21'),function(_0x549e98){try{utils['debug'](util[_0x8017('0x1b')](_0x8017('0x22'),_0x549e98['uniqueid']),_0x549e98);agents[_0x8017('0x21')](_0x549e98);}catch(_0x283c9c){utils[_0x8017('0x16')](util[_0x8017('0x1b')]('[%s][index][agentringnoanswer]',_0x549e98['uniqueid']),_0x283c9c);}});ami['on'](_0x8017('0x23'),function(_0x168dea){try{utils['debug'](util[_0x8017('0x1b')](_0x8017('0x24'),_0x168dea['uniqueid']),_0x168dea);agents[_0x8017('0x23')](_0x168dea);queues[_0x8017('0x23')](_0x168dea);}catch(_0x12034b){utils[_0x8017('0x16')](util['format'](_0x8017('0x24'),_0x168dea['uniqueid']),_0x12034b);}});ami['on'](_0x8017('0x25'),function(_0x3612e6){try{utils['debug'](util[_0x8017('0x1b')](_0x8017('0x26'),_0x3612e6[_0x8017('0x1f')]),_0x3612e6);agents[_0x8017('0x25')](_0x3612e6);queues['agentcomplete'](_0x3612e6);members['agentcomplete'](_0x3612e6);}catch(_0x867780){utils[_0x8017('0x16')](util[_0x8017('0x1b')](_0x8017('0x26'),_0x3612e6[_0x8017('0x1f')]),_0x867780);}});ami['on']('queuecallerabandon',function(_0x4c9692){try{utils['debug'](util['format'](_0x8017('0x27'),_0x4c9692[_0x8017('0x1f')]),_0x4c9692);agents[_0x8017('0x28')](_0x4c9692);queues['queuecallerabandon'](_0x4c9692);}catch(_0x57c500){utils[_0x8017('0x16')](util[_0x8017('0x1b')]('[%s][index][queuecallerabandon]',_0x4c9692[_0x8017('0x1f')]),_0x57c500);}});ami['on'](_0x8017('0x29'),function(_0x41c24a){try{utils[_0x8017('0x1a')](util['format']('[%s][index][queuecallerjoin]',_0x41c24a[_0x8017('0x1f')]),_0x41c24a);queues[_0x8017('0x29')](_0x41c24a);recordings[_0x8017('0x29')](_0x41c24a);}catch(_0x41a5c5){utils[_0x8017('0x16')](util['format']('[%s][index][queuecallerjoin]',_0x41c24a[_0x8017('0x1f')]),_0x41a5c5);}});ami['on']('queuecallerleave',function(_0x170189){try{utils[_0x8017('0x1a')](util[_0x8017('0x1b')](_0x8017('0x2a'),_0x170189[_0x8017('0x1f')]),_0x170189);queues[_0x8017('0x2b')](_0x170189);}catch(_0x4d4738){utils[_0x8017('0x16')](util['format'](_0x8017('0x2a'),_0x170189['uniqueid']),_0x4d4738);}});ami['on'](_0x8017('0x2c'),function(_0x228954){try{utils[_0x8017('0x1a')](util[_0x8017('0x1b')](_0x8017('0x2d'),_0x228954[_0x8017('0x1f')]),_0x228954);queues[_0x8017('0x2c')](_0x228954);calls[_0x8017('0x2c')](_0x228954);}catch(_0x350cb4){utils[_0x8017('0x16')](util[_0x8017('0x1b')](_0x8017('0x2d'),_0x228954[_0x8017('0x1f')]),_0x350cb4);}});ami['on']('musiconholdstop',function(_0x1a9553){try{utils['debug'](util['format'](_0x8017('0x2e'),_0x1a9553[_0x8017('0x1f')]),_0x1a9553);queues['musiconholdstop'](_0x1a9553);calls[_0x8017('0x2f')](_0x1a9553);}catch(_0x55679e){utils[_0x8017('0x16')](util['format'](_0x8017('0x2e'),_0x1a9553[_0x8017('0x1f')]),_0x55679e);}});ami['on']('newstate',function(_0x1031de){try{utils[_0x8017('0x1a')](util[_0x8017('0x1b')](_0x8017('0x30'),_0x1031de[_0x8017('0x1f')]),_0x1031de);calls[_0x8017('0x31')](_0x1031de);recordings['newstate'](_0x1031de);}catch(_0x23ad79){utils[_0x8017('0x16')](util[_0x8017('0x1b')](_0x8017('0x30'),_0x1031de[_0x8017('0x1f')]),_0x23ad79);}});ami['on']('hangup',function(_0x4a36a6){try{utils[_0x8017('0x1a')](util[_0x8017('0x1b')](_0x8017('0x32'),_0x4a36a6[_0x8017('0x1f')]),_0x4a36a6);calls[_0x8017('0x33')](_0x4a36a6);recordings['hangup'](_0x4a36a6);dials[_0x8017('0x33')](_0x4a36a6);agents[_0x8017('0x33')](_0x4a36a6);queues[_0x8017('0x33')](_0x4a36a6);}catch(_0x2b8196){utils['error'](util[_0x8017('0x1b')](_0x8017('0x32'),_0x4a36a6[_0x8017('0x1f')]),_0x2b8196);}});ami['on'](_0x8017('0x34'),function(_0x224281){try{utils['debug'](util[_0x8017('0x1b')](_0x8017('0x35'),_0x224281['uniqueid']),_0x224281);members[_0x8017('0x34')](_0x224281);}catch(_0x2c5616){utils[_0x8017('0x16')](util[_0x8017('0x1b')](_0x8017('0x35'),_0x224281[_0x8017('0x1f')]),_0x2c5616);}});ami['on'](_0x8017('0x36'),function(_0x2afe65){try{utils[_0x8017('0x1a')](util['format'](_0x8017('0x37'),_0x2afe65[_0x8017('0x1f')]),_0x2afe65);queues[_0x8017('0x36')](_0x2afe65);agents[_0x8017('0x36')](_0x2afe65);transfers[_0x8017('0x36')](_0x2afe65);}catch(_0x30de0d){utils['error'](util[_0x8017('0x1b')](_0x8017('0x37'),_0x2afe65[_0x8017('0x1f')]),_0x30de0d);}});ami['on']('attendedtransfer',function(_0x5d5a75){try{utils[_0x8017('0x1a')](util[_0x8017('0x1b')](_0x8017('0x38'),_0x5d5a75['origtransfereruniqueid']),_0x5d5a75);queues['attendedtransfer'](_0x5d5a75);transfers[_0x8017('0x39')](_0x5d5a75);agents[_0x8017('0x39')](_0x5d5a75);calls[_0x8017('0x39')](_0x5d5a75);}catch(_0x5db6bd){utils[_0x8017('0x16')](util[_0x8017('0x1b')](_0x8017('0x38'),_0x5d5a75[_0x8017('0x3a')]),_0x5db6bd);}});ami['on'](_0x8017('0x3b'),function(_0x877761){try{utils[_0x8017('0x1a')](util[_0x8017('0x1b')](_0x8017('0x3c'),_0x877761[_0x8017('0x1f')]),_0x877761);queues['varset'](_0x877761);recordings[_0x8017('0x3b')](_0x877761);calls[_0x8017('0x3b')](_0x877761);dials[_0x8017('0x3b')](_0x877761);}catch(_0x4bb564){utils['error'](util[_0x8017('0x1b')](_0x8017('0x3c'),_0x877761[_0x8017('0x1f')]),_0x4bb564);}});ami['on']('newexten',function(_0x2d262f){try{utils[_0x8017('0x1a')](util[_0x8017('0x1b')]('[%s][index][newexten]',_0x2d262f['uniqueid']),_0x2d262f);calls[_0x8017('0x3d')](_0x2d262f);recordings['newexten'](_0x2d262f);dials[_0x8017('0x3d')](_0x2d262f);}catch(_0x5b3a7e){utils[_0x8017('0x16')](util[_0x8017('0x1b')]('[%s][index][newexten]',_0x2d262f[_0x8017('0x1f')]),_0x5b3a7e);}});ami['on'](_0x8017('0x3e'),function(_0x561c2b){try{utils[_0x8017('0x1a')](util[_0x8017('0x1b')](_0x8017('0x3f'),_0x561c2b[_0x8017('0x1f')]),_0x561c2b);calls[_0x8017('0x3e')](_0x561c2b);recordings[_0x8017('0x3e')](_0x561c2b);}catch(_0x4290b0){utils[_0x8017('0x16')](util[_0x8017('0x1b')](_0x8017('0x3f'),_0x561c2b['uniqueid']),_0x4290b0);}});ami['on']('dialbegin',function(_0x3b0769){try{utils['debug'](util['format'](_0x8017('0x40'),_0x3b0769[_0x8017('0x1f')]),_0x3b0769);dials[_0x8017('0x41')](_0x3b0769);}catch(_0x4c2c4a){utils[_0x8017('0x16')](util[_0x8017('0x1b')](_0x8017('0x42'),_0x3b0769[_0x8017('0x1f')]),_0x4c2c4a);}});ami['on'](_0x8017('0x43'),function(_0x57d0a9){try{utils['debug'](util[_0x8017('0x1b')](_0x8017('0x44'),_0x57d0a9[_0x8017('0x1f')]),_0x57d0a9);dials[_0x8017('0x43')](_0x57d0a9);}catch(_0xfe9a78){utils['error'](util[_0x8017('0x1b')](_0x8017('0x44'),_0x57d0a9['uniqueid']),_0xfe9a78);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 9af9113..4042e34 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 _0xc7e9=['debug','[%s][members][cdr]','data1','data2','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','membername','type','interface','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','info','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc7e9[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x9c7e('0x0'));var util=require(_0x9c7e('0x1'));var utils=require('./utils');var members={};var exclude=[_0x9c7e('0x2'),_0x9c7e('0x3')];function writeDB(_0x2acedf){utils['info'](util[_0x9c7e('0x4')](_0x9c7e('0x5'),_0x2acedf['uniqueid'],_0x2acedf['interface'],_0x2acedf[_0x9c7e('0x6')],_0x2acedf['data2'],_0x2acedf[_0x9c7e('0x7')],_0x2acedf[_0x9c7e('0x8')]));if(_0x2acedf[_0x9c7e('0x9')]){utils[_0x9c7e('0xa')](_0x2acedf['interface'])[_0x9c7e('0xb')](function(_0x5f265d){if(_0x5f265d){_0x2acedf[_0x9c7e('0x7')]=_0x5f265d[_0x9c7e('0xc')];_0x2acedf['internal']=_0x5f265d[_0x9c7e('0xd')];utils[_0x9c7e('0xe')]('CreateMemberReport',_0x2acedf);}else{utils[_0x9c7e('0xf')](_0x2acedf['interface'][_0x9c7e('0x10')]('/')[0x1])[_0x9c7e('0xb')](function(_0x5a9657){if(_0x5a9657){_0x2acedf[_0x9c7e('0x7')]=_0x5a9657['name'];_0x2acedf[_0x9c7e('0xd')]=_0x5a9657[_0x9c7e('0xd')];utils[_0x9c7e('0xe')](_0x9c7e('0x11'),_0x2acedf);}});}})[_0x9c7e('0x12')](function(_0x5b66a8){utils[_0x9c7e('0x13')](util[_0x9c7e('0x4')](_0x9c7e('0x14'),_0x2acedf[_0x9c7e('0x15')]),_0x5b66a8);});}delete members[_0x2acedf[_0x9c7e('0x9')]];}function startsWith(_0x1dc25b,_0x4b26a8){return _[_0x9c7e('0x16')](_0x1dc25b,function(_0x161f74){return _[_0x9c7e('0x17')](_0x4b26a8,_0x161f74);});}exports[_0x9c7e('0x18')]=function(_0x26871f){try{utils['debug'](util[_0x9c7e('0x4')](_0x9c7e('0x19'),members[_0x26871f['device']]?members[_0x26871f[_0x9c7e('0x1a')]][_0x9c7e('0x15')]:_0x26871f[_0x9c7e('0x1a')]),_0x26871f);utils[_0x9c7e('0x1b')](util[_0x9c7e('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x26871f[_0x9c7e('0x1a')]]?members[_0x26871f['device']][_0x9c7e('0x15')]:_0x26871f['device'],_0x26871f['state'],_0x26871f[_0x9c7e('0x1a')]));switch(_0x26871f[_0x9c7e('0x1c')]){case _0x9c7e('0x1d'):case _0x9c7e('0x1e'):if(!startsWith(exclude,_0x26871f[_0x9c7e('0x1a')])){members[_0x26871f['device']]={'channel':_0x9c7e('0x1f'),'interface':_0x26871f[_0x9c7e('0x1a')],'type':_0x9c7e('0x20'),'enterAt':utils[_0x9c7e('0x21')](),'role':_0x9c7e('0x22')};}break;case _0x9c7e('0x23'):if(!_[_0x9c7e('0x24')](members[_0x26871f[_0x9c7e('0x1a')]])){members[_0x26871f[_0x9c7e('0x1a')]][_0x9c7e('0x25')]=utils[_0x9c7e('0x21')]();members[_0x26871f[_0x9c7e('0x1a')]]['duration']=utils[_0x9c7e('0x26')](members[_0x26871f[_0x9c7e('0x1a')]][_0x9c7e('0x25')],members[_0x26871f[_0x9c7e('0x1a')]][_0x9c7e('0x27')]);if(members[_0x26871f[_0x9c7e('0x1a')]]['uniqueid']){writeDB(members[_0x26871f['device']]);}}break;default:break;}}catch(_0x1c8736){utils[_0x9c7e('0x13')](util[_0x9c7e('0x4')](_0x9c7e('0x19'),members[_0x26871f[_0x9c7e('0x1a')]]?members[_0x26871f[_0x9c7e('0x1a')]][_0x9c7e('0x15')]:_0x26871f[_0x9c7e('0x1a')]),_0x1c8736);}};exports['agentcomplete']=function(_0x339e21){try{if(!_['isNil'](members[_0x339e21[_0x9c7e('0x9')]])){utils['debug'](util['format'](_0x9c7e('0x28'),_0x339e21[_0x9c7e('0x15')]),_0x339e21);utils[_0x9c7e('0x1b')](util[_0x9c7e('0x4')](_0x9c7e('0x29'),_0x339e21[_0x9c7e('0x15')],_0x339e21[_0x9c7e('0x9')],_0x339e21[_0x9c7e('0x2a')]));members[_0x339e21[_0x9c7e('0x9')]]=_[_0x9c7e('0x2b')](members[_0x339e21[_0x9c7e('0x9')]],{'data4':_0x339e21[_0x9c7e('0x2a')],'uniqueid':_0x339e21[_0x9c7e('0x15')]});}}catch(_0x52ed0e){utils[_0x9c7e('0x13')](util[_0x9c7e('0x4')]('[%s][members][agentcomplete]',_0x339e21[_0x9c7e('0x15')]),_0x52ed0e);}};exports[_0x9c7e('0x2c')]=function(_0x5af71b){try{utils[_0x9c7e('0x2d')](util[_0x9c7e('0x4')](_0x9c7e('0x2e'),_0x5af71b['uniqueid']),_0x5af71b);if(_0x5af71b[_0x9c7e('0x6')]){var _0x7b9649=_0x5af71b[_0x9c7e('0x6')][_0x9c7e('0x10')]('-')[0x0];if(!_[_0x9c7e('0x24')](members[_0x7b9649])){members[_0x7b9649]=_[_0x9c7e('0x2b')](members[_0x7b9649],{'data1':members[_0x7b9649][_0x9c7e('0x2f')]||_0x5af71b['type'],'data2':members[_0x7b9649][_0x9c7e('0x30')]||_0x5af71b[_0x9c7e('0x31')],'data3':members[_0x7b9649]['data3']||_0x5af71b[_0x9c7e('0x32')],'uniqueid':members[_0x7b9649]['uniqueid']||_0x5af71b[_0x9c7e('0x15')]});utils[_0x9c7e('0x1b')](util[_0x9c7e('0x4')](_0x9c7e('0x33'),_0x5af71b[_0x9c7e('0x15')],members[_0x7b9649]['data1'],members[_0x7b9649]['data2'],members[_0x7b9649][_0x9c7e('0x34')]));if(members[_0x7b9649][_0x9c7e('0x25')]){writeDB(members[_0x7b9649]);}}}if(_0x5af71b[_0x9c7e('0x35')]){var _0x342d46=_0x5af71b[_0x9c7e('0x35')]['split']('-')[0x0];if(!_['isNil'](members[_0x342d46])){members[_0x342d46]=_[_0x9c7e('0x2b')](members[_0x342d46],{'data1':members[_0x342d46][_0x9c7e('0x2f')]||_0x5af71b[_0x9c7e('0x8')],'data2':members[_0x342d46][_0x9c7e('0x30')]||_0x5af71b[_0x9c7e('0x31')],'data3':members[_0x342d46][_0x9c7e('0x34')]||_0x5af71b[_0x9c7e('0x32')],'uniqueid':members[_0x342d46]['uniqueid']||_0x5af71b['uniqueid']});utils[_0x9c7e('0x1b')](util['format'](_0x9c7e('0x33'),_0x5af71b[_0x9c7e('0x15')],members[_0x342d46][_0x9c7e('0x2f')],members[_0x342d46][_0x9c7e('0x30')],members[_0x342d46]['data3']));if(members[_0x342d46][_0x9c7e('0x25')]){writeDB(members[_0x342d46]);}}}}catch(_0x4d89b2){utils[_0x9c7e('0x13')](util[_0x9c7e('0x4')](_0x9c7e('0x2e'),_0x5af71b[_0x9c7e('0x15')]),_0x4d89b2);}}; \ No newline at end of file +var _0x2b41=['data1','type','data2','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','interface','channel','getUserByInterface','then','membername','name','request','split','internal','CreateMemberReport','catch','error','[%s][members][writeDB]','some','startsWith','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','uniqueid','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','isNil','[%s][members][agentcomplete]','queue','cdr','[%s][members][cdr]','assign'];(function(_0x2f24ad,_0x2b25e9){var _0xb32641=function(_0x29a30b){while(--_0x29a30b){_0x2f24ad['push'](_0x2f24ad['shift']());}};_0xb32641(++_0x2b25e9);}(_0x2b41,0x146));var _0x12b4=function(_0x58b04f,_0xd5ea5a){_0x58b04f=_0x58b04f-0x0;var _0x134b29=_0x2b41[_0x58b04f];return _0x134b29;};'use strict';var _=require(_0x12b4('0x0'));var util=require(_0x12b4('0x1'));var utils=require(_0x12b4('0x2'));var members={};var exclude=[_0x12b4('0x3'),_0x12b4('0x4')];function writeDB(_0x215fb9){utils[_0x12b4('0x5')](util[_0x12b4('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x215fb9['uniqueid'],_0x215fb9[_0x12b4('0x7')],_0x215fb9[_0x12b4('0x8')],_0x215fb9['data2'],_0x215fb9['membername'],_0x215fb9['type']));if(_0x215fb9[_0x12b4('0x7')]){utils[_0x12b4('0x9')](_0x215fb9[_0x12b4('0x7')])[_0x12b4('0xa')](function(_0x31001e){if(_0x31001e){_0x215fb9[_0x12b4('0xb')]=_0x31001e[_0x12b4('0xc')];_0x215fb9['internal']=_0x31001e['internal'];utils[_0x12b4('0xd')]('CreateMemberReport',_0x215fb9);}else{utils['getUserByName'](_0x215fb9[_0x12b4('0x7')][_0x12b4('0xe')]('/')[0x1])[_0x12b4('0xa')](function(_0x9b7a3f){if(_0x9b7a3f){_0x215fb9[_0x12b4('0xb')]=_0x9b7a3f[_0x12b4('0xc')];_0x215fb9[_0x12b4('0xf')]=_0x9b7a3f[_0x12b4('0xf')];utils[_0x12b4('0xd')](_0x12b4('0x10'),_0x215fb9);}});}})[_0x12b4('0x11')](function(_0x524d6a){utils[_0x12b4('0x12')](util[_0x12b4('0x6')](_0x12b4('0x13'),_0x215fb9['uniqueid']),_0x524d6a);});}delete members[_0x215fb9[_0x12b4('0x7')]];}function startsWith(_0x4def42,_0x1a8c2b){return _[_0x12b4('0x14')](_0x4def42,function(_0x1b16a4){return _[_0x12b4('0x15')](_0x1a8c2b,_0x1b16a4);});}exports['devicestatechange']=function(_0x3682ce){try{utils[_0x12b4('0x16')](util[_0x12b4('0x6')]('[%s][members][devicestatechange]',members[_0x3682ce[_0x12b4('0x17')]]?members[_0x3682ce['device']]['uniqueid']:_0x3682ce[_0x12b4('0x17')]),_0x3682ce);utils[_0x12b4('0x5')](util['format'](_0x12b4('0x18'),members[_0x3682ce['device']]?members[_0x3682ce[_0x12b4('0x17')]][_0x12b4('0x19')]:_0x3682ce[_0x12b4('0x17')],_0x3682ce[_0x12b4('0x1a')],_0x3682ce['device']));switch(_0x3682ce['state']){case _0x12b4('0x1b'):case _0x12b4('0x1c'):if(!startsWith(exclude,_0x3682ce[_0x12b4('0x17')])){members[_0x3682ce[_0x12b4('0x17')]]={'channel':_0x12b4('0x1d'),'interface':_0x3682ce['device'],'type':_0x12b4('0x1e'),'enterAt':utils[_0x12b4('0x1f')](),'role':'agent'};}break;case _0x12b4('0x20'):if(!_['isNil'](members[_0x3682ce[_0x12b4('0x17')]])){members[_0x3682ce['device']][_0x12b4('0x21')]=utils[_0x12b4('0x1f')]();members[_0x3682ce[_0x12b4('0x17')]][_0x12b4('0x22')]=utils[_0x12b4('0x23')](members[_0x3682ce['device']][_0x12b4('0x21')],members[_0x3682ce[_0x12b4('0x17')]][_0x12b4('0x24')]);if(members[_0x3682ce[_0x12b4('0x17')]][_0x12b4('0x19')]){writeDB(members[_0x3682ce[_0x12b4('0x17')]]);}}break;default:break;}}catch(_0x4c7161){utils['error'](util[_0x12b4('0x6')](_0x12b4('0x25'),members[_0x3682ce[_0x12b4('0x17')]]?members[_0x3682ce[_0x12b4('0x17')]][_0x12b4('0x19')]:_0x3682ce[_0x12b4('0x17')]),_0x4c7161);}};exports[_0x12b4('0x26')]=function(_0x2fc8c3){try{if(!_[_0x12b4('0x27')](members[_0x2fc8c3['interface']])){utils[_0x12b4('0x16')](util['format'](_0x12b4('0x28'),_0x2fc8c3[_0x12b4('0x19')]),_0x2fc8c3);utils[_0x12b4('0x5')](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x2fc8c3[_0x12b4('0x19')],_0x2fc8c3[_0x12b4('0x7')],_0x2fc8c3[_0x12b4('0x29')]));members[_0x2fc8c3['interface']]=_['assign'](members[_0x2fc8c3[_0x12b4('0x7')]],{'data4':_0x2fc8c3[_0x12b4('0x29')],'uniqueid':_0x2fc8c3[_0x12b4('0x19')]});}}catch(_0x59f2cd){utils['error'](util['format'](_0x12b4('0x28'),_0x2fc8c3[_0x12b4('0x19')]),_0x59f2cd);}};exports[_0x12b4('0x2a')]=function(_0x22fe5d){try{utils['debug'](util['format'](_0x12b4('0x2b'),_0x22fe5d[_0x12b4('0x19')]),_0x22fe5d);if(_0x22fe5d[_0x12b4('0x8')]){var _0x194d21=_0x22fe5d['channel'][_0x12b4('0xe')]('-')[0x0];if(!_[_0x12b4('0x27')](members[_0x194d21])){members[_0x194d21]=_[_0x12b4('0x2c')](members[_0x194d21],{'data1':members[_0x194d21][_0x12b4('0x2d')]||_0x22fe5d[_0x12b4('0x2e')],'data2':members[_0x194d21][_0x12b4('0x2f')]||_0x22fe5d[_0x12b4('0x30')],'data3':members[_0x194d21]['data3']||_0x22fe5d[_0x12b4('0x31')],'uniqueid':members[_0x194d21]['uniqueid']||_0x22fe5d['uniqueid']});utils[_0x12b4('0x5')](util[_0x12b4('0x6')](_0x12b4('0x32'),_0x22fe5d[_0x12b4('0x19')],members[_0x194d21][_0x12b4('0x2d')],members[_0x194d21][_0x12b4('0x2f')],members[_0x194d21][_0x12b4('0x33')]));if(members[_0x194d21][_0x12b4('0x21')]){writeDB(members[_0x194d21]);}}}if(_0x22fe5d[_0x12b4('0x34')]){var _0x11ec64=_0x22fe5d['destinationchannel'][_0x12b4('0xe')]('-')[0x0];if(!_['isNil'](members[_0x11ec64])){members[_0x11ec64]=_[_0x12b4('0x2c')](members[_0x11ec64],{'data1':members[_0x11ec64]['data1']||_0x22fe5d[_0x12b4('0x2e')],'data2':members[_0x11ec64][_0x12b4('0x2f')]||_0x22fe5d[_0x12b4('0x30')],'data3':members[_0x11ec64][_0x12b4('0x33')]||_0x22fe5d[_0x12b4('0x31')],'uniqueid':members[_0x11ec64][_0x12b4('0x19')]||_0x22fe5d[_0x12b4('0x19')]});utils[_0x12b4('0x5')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x22fe5d[_0x12b4('0x19')],members[_0x11ec64][_0x12b4('0x2d')],members[_0x11ec64][_0x12b4('0x2f')],members[_0x11ec64][_0x12b4('0x33')]));if(members[_0x11ec64][_0x12b4('0x21')]){writeDB(members[_0x11ec64]);}}}}catch(_0xf3faba){utils[_0x12b4('0x12')](util['format'](_0x12b4('0x2b'),_0x22fe5d['uniqueid']),_0xf3faba);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 3d5dd35..bc388d6 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 _0xf02e=['[%s][queues][varset]','isNil','variable','value','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','queueposition','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','accountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transferexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset'];(function(_0x1c1ae5,_0x2eaccf){var _0x15bf42=function(_0x122796){while(--_0x122796){_0x1c1ae5['push'](_0x1c1ae5['shift']());}};_0x15bf42(++_0x2eaccf);}(_0xf02e,0x113));var _0xef02=function(_0x20aedc,_0xaf0c2b){_0x20aedc=_0x20aedc-0x0;var _0x489ad6=_0xf02e[_0x20aedc];return _0x489ad6;};'use strict';var _=require(_0xef02('0x0'));var util=require(_0xef02('0x1'));var utils=require(_0xef02('0x2'));var queues={};function writeDB(_0x344268){utils[_0xef02('0x3')](util[_0xef02('0x4')](_0xef02('0x5'),_0x344268[_0xef02('0x6')],_0x344268[_0xef02('0x7')],_0x344268[_0xef02('0x8')],_0x344268[_0xef02('0x9')],_0x344268[_0xef02('0xa')],_0x344268['accountcode'],_0x344268['queuecallerexitreason']));if(_0x344268[_0xef02('0x8')]){utils['getVoiceQueueByName'](_0x344268[_0xef02('0x8')])['then'](function(_0x173b8b){if(_0x173b8b){_0x344268[_0xef02('0xb')]=_0x173b8b[_0xef02('0xb')];}utils[_0xef02('0xc')]('CreateVoiceQueueReport',_0x344268);});}else{utils[_0xef02('0xc')](_0xef02('0xd'),_0x344268);}if(_0x344268['transfereduniqueid']){delete queues[_0x344268[_0xef02('0xe')]];}else{delete queues[_0x344268['uniqueid']];}}exports[_0xef02('0xf')]=function(_0x3c4d11){try{utils[_0xef02('0x10')](util[_0xef02('0x4')]('[%s][queues][queuecallerjoin]',_0x3c4d11[_0xef02('0x6')]),_0x3c4d11);utils[_0xef02('0x3')](util[_0xef02('0x4')](_0xef02('0x11'),_0x3c4d11['uniqueid'],_0x3c4d11[_0xef02('0x8')],_0x3c4d11[_0xef02('0x12')]));queues[_0x3c4d11['uniqueid']]=_[_0xef02('0x13')](_0x3c4d11,{'originalposition':_0x3c4d11[_0xef02('0x12')],'queuecallerjoinAt':utils[_0xef02('0x14')](),'mohtime':0x0});}catch(_0x2bea22){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x16'),_0x3c4d11[_0xef02('0x6')]),_0x2bea22);}};exports[_0xef02('0x17')]=function(_0x60b3aa){try{if(!_['isNil'](queues[_0x60b3aa[_0xef02('0x6')]])){utils[_0xef02('0x10')](util[_0xef02('0x4')](_0xef02('0x18'),_0x60b3aa[_0xef02('0x6')]),_0x60b3aa);if(queues[_0x60b3aa['uniqueid']][_0xef02('0x19')]){if(!queues[_0x60b3aa['uniqueid']]['queuecallerabandon']&&!queues[_0x60b3aa[_0xef02('0x6')]][_0xef02('0x1a')]){queues[_0x60b3aa[_0xef02('0x6')]]['queuecallercomplete']=!![];queues[_0x60b3aa[_0xef02('0x6')]]['queuecallercompleteAt']=utils[_0xef02('0x14')]();queues[_0x60b3aa[_0xef02('0x6')]]['queuecallerexitreason']=_0xef02('0x1b');}utils['info'](util[_0xef02('0x4')](_0xef02('0x1c'),_0x60b3aa[_0xef02('0x6')],queues[_0x60b3aa[_0xef02('0x6')]][_0xef02('0x1d')],queues[_0x60b3aa[_0xef02('0x6')]][_0xef02('0x1e')]));writeDB(queues[_0x60b3aa[_0xef02('0x6')]]);}else if(queues[_0x60b3aa[_0xef02('0x6')]]['transfereduniqueid']){utils['info'](util[_0xef02('0x4')](_0xef02('0x1f'),_0x60b3aa[_0xef02('0x6')],queues[_0x60b3aa[_0xef02('0x6')]][_0xef02('0x1d')],queues[_0x60b3aa[_0xef02('0x6')]][_0xef02('0xe')]));queues[queues[_0x60b3aa[_0xef02('0x6')]]['transfereduniqueid']]=queues[_0x60b3aa['uniqueid']];queues[queues[_0x60b3aa['uniqueid']]['transfereduniqueid']][_0xef02('0x20')]=0x2;delete queues[_0x60b3aa[_0xef02('0x6')]];}}}catch(_0x5f25f9){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x18'),_0x60b3aa[_0xef02('0x6')]),_0x5f25f9);}};exports[_0xef02('0x21')]=function(_0x3d2310){try{utils[_0xef02('0x10')](util[_0xef02('0x4')](_0xef02('0x22'),_0x3d2310[_0xef02('0x6')]),_0x3d2310);if(!_[_0xef02('0x23')](_0x3d2310[_0xef02('0x24')]['queuestatus'])&&_0x3d2310[_0xef02('0x25')]['toUpperCase']()!==_0xef02('0x26')){if(!_[_0xef02('0x23')](queues[_0x3d2310[_0xef02('0x6')]])){queues[_0x3d2310[_0xef02('0x6')]][_0xef02('0x27')]=![];queues[_0x3d2310[_0xef02('0x6')]][_0xef02('0x28')]=null;queues[_0x3d2310['uniqueid']][_0xef02('0x1a')]=!![];queues[_0x3d2310['uniqueid']][_0xef02('0x29')]=utils[_0xef02('0x14')]();queues[_0x3d2310[_0xef02('0x6')]]['queuecallerexitreason']=_0x3d2310[_0xef02('0x25')]['toUpperCase']();utils[_0xef02('0x3')](util[_0xef02('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x3d2310[_0xef02('0x6')],queues[_0x3d2310[_0xef02('0x6')]][_0xef02('0x1d')],_0x3d2310['value'],queues[_0x3d2310[_0xef02('0x6')]][_0xef02('0x1e')]));writeDB(queues[_0x3d2310[_0xef02('0x6')]]);}}else if(!_['isNil'](_0x3d2310[_0xef02('0x24')][_0xef02('0x2a')])){if(!_['isNil'](queues[_0x3d2310[_0xef02('0x6')]])&&!queues[_0x3d2310[_0xef02('0x6')]]['queuecallerabandon']){queues[_0x3d2310[_0xef02('0x6')]]['queuecallerabandon']=![];queues[_0x3d2310['uniqueid']]['queuecallerabandonAt']=null;queues[_0x3d2310[_0xef02('0x6')]][_0xef02('0x1a')]=!![];queues[_0x3d2310[_0xef02('0x6')]][_0xef02('0x29')]=utils[_0xef02('0x14')]();queues[_0x3d2310['uniqueid']]['queuecallerexitreason']='EXITWITHKEY';utils[_0xef02('0x3')](util[_0xef02('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x3d2310[_0xef02('0x6')],queues[_0x3d2310[_0xef02('0x6')]][_0xef02('0x1d')],_0x3d2310[_0xef02('0x25')],queues[_0x3d2310[_0xef02('0x6')]]['queuecallerexitreason']));}}}catch(_0x5d6ccd){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x22'),_0x3d2310[_0xef02('0x6')]),_0x5d6ccd);}};exports[_0xef02('0x27')]=function(_0x1ba4fc){try{if(!_[_0xef02('0x23')](queues[_0x1ba4fc[_0xef02('0x6')]])){utils[_0xef02('0x10')](util[_0xef02('0x4')](_0xef02('0x2b'),_0x1ba4fc[_0xef02('0x6')]),_0x1ba4fc);queues[_0x1ba4fc[_0xef02('0x6')]][_0xef02('0x1a')]=![];queues[_0x1ba4fc['uniqueid']][_0xef02('0x29')]=null;queues[_0x1ba4fc['uniqueid']]['queuecallerabandon']=!![];queues[_0x1ba4fc['uniqueid']][_0xef02('0x28')]=utils['now']();queues[_0x1ba4fc[_0xef02('0x6')]][_0xef02('0x1e')]=_0xef02('0x2c');utils[_0xef02('0x3')](util[_0xef02('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1ba4fc[_0xef02('0x6')],queues[_0x1ba4fc['uniqueid']][_0xef02('0x1d')],queues[_0x1ba4fc[_0xef02('0x6')]][_0xef02('0x1e')]));}}catch(_0x195e98){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x2b'),_0x1ba4fc['uniqueid']),_0x195e98);}};exports[_0xef02('0x2d')]=function(_0x45d630){try{if(!_[_0xef02('0x23')](queues[_0x45d630[_0xef02('0x6')]])){utils[_0xef02('0x10')](util[_0xef02('0x4')](_0xef02('0x2e'),_0x45d630[_0xef02('0x6')]),_0x45d630);utils[_0xef02('0x3')](util['format'](_0xef02('0x2f'),_0x45d630[_0xef02('0x6')],queues[_0x45d630['uniqueid']][_0xef02('0x1d')],_0x45d630[_0xef02('0x30')],_0x45d630[_0xef02('0x31')]));queues[_0x45d630['uniqueid']][_0xef02('0x2d')]=!![];queues[_0x45d630[_0xef02('0x6')]][_0xef02('0x19')]=utils[_0xef02('0x14')]();queues[_0x45d630[_0xef02('0x6')]][_0xef02('0x32')]=utils['diffTime'](queues[_0x45d630[_0xef02('0x6')]][_0xef02('0x19')],queues[_0x45d630[_0xef02('0x6')]][_0xef02('0x33')]);queues[_0x45d630[_0xef02('0x6')]][_0xef02('0x12')]=_0x45d630[_0xef02('0x12')];queues[_0x45d630['uniqueid']][_0xef02('0x34')]=_0x45d630[_0xef02('0x34')];queues[_0x45d630[_0xef02('0x6')]][_0xef02('0x30')]=_0x45d630[_0xef02('0x30')];queues[_0x45d630[_0xef02('0x6')]][_0xef02('0x31')]=_0x45d630['connectedlinename'];}}catch(_0x550b2f){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x2e'),_0x45d630[_0xef02('0x6')]),_0x550b2f);}};exports[_0xef02('0x35')]=function(_0x2e0f4e){try{if(!_[_0xef02('0x23')](queues[_0x2e0f4e[_0xef02('0x6')]])){utils['debug'](util[_0xef02('0x4')](_0xef02('0x36'),_0x2e0f4e[_0xef02('0x6')]),_0x2e0f4e);utils[_0xef02('0x3')](util[_0xef02('0x4')](_0xef02('0x37'),_0x2e0f4e[_0xef02('0x6')],queues[_0x2e0f4e[_0xef02('0x6')]]['name'],_0x2e0f4e[_0xef02('0x38')],_0x2e0f4e[_0xef02('0x39')]));queues[_0x2e0f4e[_0xef02('0x6')]]['queuecallerabandon']=![];queues[_0x2e0f4e[_0xef02('0x6')]][_0xef02('0x27')]=![];queues[_0x2e0f4e[_0xef02('0x6')]][_0xef02('0x28')]=null;queues[_0x2e0f4e[_0xef02('0x6')]]['queuecallerexit']=![];queues[_0x2e0f4e[_0xef02('0x6')]][_0xef02('0x1e')]=null;queues[_0x2e0f4e[_0xef02('0x6')]][_0xef02('0x29')]=null;queues[_0x2e0f4e[_0xef02('0x6')]]['assigned']=!![];queues[_0x2e0f4e[_0xef02('0x6')]][_0xef02('0x3a')]=_0x2e0f4e[_0xef02('0x39')];queues[_0x2e0f4e['uniqueid']][_0xef02('0x9')]=_0x2e0f4e[_0xef02('0x38')];}}catch(_0x3c2f4e){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x36'),_0x2e0f4e['uniqueid']),_0x3c2f4e);}};exports[_0xef02('0x3b')]=function(_0x22ca06){try{if(!_[_0xef02('0x23')](queues[_0x22ca06[_0xef02('0x6')]])){if(queues[_0x22ca06[_0xef02('0x6')]][_0xef02('0x19')]){utils['debug'](util[_0xef02('0x4')](_0xef02('0x3c'),_0x22ca06['uniqueid']),_0x22ca06);queues[_0x22ca06['uniqueid']][_0xef02('0x27')]=![];queues[_0x22ca06['uniqueid']][_0xef02('0x27')]=![];queues[_0x22ca06[_0xef02('0x6')]][_0xef02('0x28')]=null;queues[_0x22ca06['uniqueid']][_0xef02('0x1a')]=![];queues[_0x22ca06[_0xef02('0x6')]]['queuecallerexitAt']=null;queues[_0x22ca06[_0xef02('0x6')]]['assigned']=!![];queues[_0x22ca06[_0xef02('0x6')]]['lastAssignedTo']=_0x22ca06[_0xef02('0x38')];queues[_0x22ca06[_0xef02('0x6')]][_0xef02('0x3d')]=!![];queues[_0x22ca06[_0xef02('0x6')]][_0xef02('0x3e')]=utils['now']();if(_0x22ca06[_0xef02('0x3f')]==_0xef02('0x40')){if(!queues[_0x22ca06[_0xef02('0x6')]][_0xef02('0x40')]){queues[_0x22ca06[_0xef02('0x6')]][_0xef02('0x1e')]=_0xef02('0x41');}}else{queues[_0x22ca06[_0xef02('0x6')]][_0xef02('0x1e')]=_0xef02('0x42')+_0x22ca06[_0xef02('0x3f')][_0xef02('0x43')]();}utils[_0xef02('0x3')](util['format'](_0xef02('0x44'),_0x22ca06[_0xef02('0x6')],queues[_0x22ca06['uniqueid']]['name'],_0x22ca06[_0xef02('0x38')],queues[_0x22ca06[_0xef02('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x22ca06[_0xef02('0x6')]]);}}}catch(_0x1305a3){utils[_0xef02('0x15')](util['format'](_0xef02('0x3c'),_0x22ca06['uniqueid']),_0x1305a3);}};exports[_0xef02('0x45')]=function(_0x1b5c9b){try{if(!_['isNil'](queues[_0x1b5c9b['transfereeuniqueid']])){utils['debug'](util[_0xef02('0x4')](_0xef02('0x46'),_0x1b5c9b[_0xef02('0x6')]),_0x1b5c9b);queues[_0x1b5c9b[_0xef02('0x47')]][_0xef02('0x40')]=!![];queues[_0x1b5c9b[_0xef02('0x47')]][_0xef02('0x48')]='BLIND';queues[_0x1b5c9b[_0xef02('0x47')]]['transferexten']=_0x1b5c9b[_0xef02('0x49')];queues[_0x1b5c9b[_0xef02('0x47')]]['transferuniqueid']=_0x1b5c9b[_0xef02('0x47')];queues[_0x1b5c9b[_0xef02('0x47')]][_0xef02('0x1e')]=_0xef02('0x4a');utils[_0xef02('0x3')](util[_0xef02('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x1b5c9b[_0xef02('0x6')],queues[_0x1b5c9b['transfereeuniqueid']][_0xef02('0x1d')],_0x1b5c9b[_0xef02('0x47')],_0x1b5c9b[_0xef02('0x49')]));}}catch(_0x1bb4e0){utils[_0xef02('0x15')](util[_0xef02('0x4')]('[%s][queues][blindtransfer]',_0x1b5c9b[_0xef02('0x6')]),_0x1bb4e0);}};exports[_0xef02('0x4b')]=function(_0x29a909){try{utils[_0xef02('0x10')](util[_0xef02('0x4')](_0xef02('0x4c'),_0x29a909[_0xef02('0x4d')]),_0x29a909);if(_0x29a909['origtransfereruniqueid']==_0x29a909[_0xef02('0x4e')]){if(!_[_0xef02('0x23')](queues[_0x29a909[_0xef02('0x4f')]])){utils[_0xef02('0x3')](util[_0xef02('0x4')](_0xef02('0x50'),_0x29a909[_0xef02('0x4d')],queues[_0x29a909[_0xef02('0x4f')]][_0xef02('0x1d')],_0x29a909[_0xef02('0x51')]));queues[_0x29a909['secondtransfererlinkedid']][_0xef02('0x40')]=!![];queues[_0x29a909[_0xef02('0x4f')]][_0xef02('0x48')]='ATTENDED';queues[_0x29a909['secondtransfererlinkedid']][_0xef02('0x52')]=_0x29a909[_0xef02('0x51')];queues[_0x29a909[_0xef02('0x4f')]][_0xef02('0x53')]=_0x29a909[_0xef02('0x4d')];queues[_0x29a909[_0xef02('0x4f')]][_0xef02('0x1e')]=_0xef02('0x54');}if(!_[_0xef02('0x23')](queues[_0x29a909[_0xef02('0x4e')]])){if(_0x29a909[_0xef02('0x55')]&&queues[_0x29a909[_0xef02('0x55')]]){queues[_0x29a909[_0xef02('0x55')]][_0xef02('0x20')]=0x1;queues[_0x29a909[_0xef02('0x47')]]=_[_0xef02('0x56')](queues[_0x29a909[_0xef02('0x55')]]);queues[_0x29a909[_0xef02('0x47')]][_0xef02('0xe')]=_0x29a909['transfertargetuniqueid'];queues[_0x29a909['transfereeuniqueid']][_0xef02('0x20')]=0x2;queues[_0x29a909[_0xef02('0x47')]][_0xef02('0xa')]=queues[_0x29a909[_0xef02('0x4f')]][_0xef02('0xa')];queues[_0x29a909[_0xef02('0x47')]][_0xef02('0x57')]=queues[_0x29a909[_0xef02('0x4f')]][_0xef02('0x57')];queues[_0x29a909[_0xef02('0x47')]][_0xef02('0x33')]=utils['now']();queues[_0x29a909[_0xef02('0x47')]]['queuecallerleaveAt']=utils[_0xef02('0x14')]();queues[_0x29a909[_0xef02('0x47')]][_0xef02('0x32')]=0x0;queues[_0x29a909[_0xef02('0x47')]][_0xef02('0x58')]=0x0;utils['info'](util[_0xef02('0x4')](_0xef02('0x59'),_0x29a909[_0xef02('0x4d')],queues[_0x29a909[_0xef02('0x47')]]['name'],queues[_0x29a909[_0xef02('0x47')]][_0xef02('0xa')],queues[_0x29a909[_0xef02('0x47')]][_0xef02('0x57')]));}else{utils['info'](util[_0xef02('0x4')](_0xef02('0x5a'),_0x29a909[_0xef02('0x4d')],queues[_0x29a909[_0xef02('0x4e')]]['name'],_0x29a909[_0xef02('0x4f')]));queues[_0x29a909[_0xef02('0x4e')]][_0xef02('0xe')]=_0x29a909[_0xef02('0x4f')];}}}else if(_0x29a909[_0xef02('0x5b')]==_0x29a909[_0xef02('0x4f')]){if(!_[_0xef02('0x23')](queues[_0x29a909[_0xef02('0x4e')]])){utils[_0xef02('0x3')](util[_0xef02('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x29a909[_0xef02('0x4d')],queues[_0x29a909['origtransfererlinkedid']][_0xef02('0x1d')],_0x29a909['secondtransfereruniqueid'],_0x29a909[_0xef02('0x5c')]));queues[_0x29a909[_0xef02('0x4e')]]['transfer']=!![];queues[_0x29a909['origtransfererlinkedid']][_0xef02('0x48')]='ATTENDED';queues[_0x29a909[_0xef02('0x4e')]]['transferexten']=_0x29a909[_0xef02('0x5c')];queues[_0x29a909[_0xef02('0x4e')]][_0xef02('0x53')]=_0x29a909[_0xef02('0x5b')];queues[_0x29a909[_0xef02('0x4e')]]['queuecallerexitreason']=_0xef02('0x54');}if(!_[_0xef02('0x23')](queues[_0x29a909['secondtransfererlinkedid']])){if(_0x29a909['transfertargetlinkedid']&&queues[_0x29a909['transfertargetlinkedid']]){queues[_0x29a909[_0xef02('0x5d')]][_0xef02('0x20')]=0x1;queues[_0x29a909['transfertargetuniqueid']]=_[_0xef02('0x56')](queues[_0x29a909[_0xef02('0x5d')]]);queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0xe')]=_0x29a909[_0xef02('0x5e')];queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0x20')]=0x2;queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0xa')]=queues[_0x29a909[_0xef02('0x4e')]][_0xef02('0xa')];queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0x57')]=queues[_0x29a909[_0xef02('0x4e')]][_0xef02('0x57')];queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0x33')]=utils[_0xef02('0x14')]();queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0x19')]=utils['now']();queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0x32')]=0x0;queues[_0x29a909[_0xef02('0x5e')]]['mohtime']=0x0;utils['info'](util[_0xef02('0x4')](_0xef02('0x5f'),_0x29a909[_0xef02('0x4d')],queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0x1d')],queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0xe')],queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0xa')],queues[_0x29a909['transfertargetuniqueid']][_0xef02('0x57')]));}else{utils[_0xef02('0x3')](util['format'](_0xef02('0x5a'),_0x29a909[_0xef02('0x4d')],queues[_0x29a909[_0xef02('0x4f')]][_0xef02('0x1d')],_0x29a909[_0xef02('0x4e')]));queues[_0x29a909['secondtransfererlinkedid']][_0xef02('0xe')]=_0x29a909[_0xef02('0x4e')];}}}}catch(_0x3735e1){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x4c'),_0x29a909[_0xef02('0x4d')]),_0x3735e1);}};exports[_0xef02('0x60')]=function(_0x500f6c){try{if(!_[_0xef02('0x23')](queues[_0x500f6c[_0xef02('0x6')]])){utils[_0xef02('0x10')](util[_0xef02('0x4')](_0xef02('0x61'),_0x500f6c[_0xef02('0x6')]),_0x500f6c);queues[_0x500f6c[_0xef02('0x6')]][_0xef02('0x62')]=utils[_0xef02('0x14')]();utils[_0xef02('0x3')](util[_0xef02('0x4')](_0xef02('0x63'),_0x500f6c[_0xef02('0x6')],queues[_0x500f6c[_0xef02('0x6')]][_0xef02('0x1d')],queues[_0x500f6c['uniqueid']][_0xef02('0x62')]));}}catch(_0x28fb4e){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x61'),_0x500f6c[_0xef02('0x6')]),_0x28fb4e);}};exports[_0xef02('0x64')]=function(_0x8ba316){try{if(!_[_0xef02('0x23')](queues[_0x8ba316[_0xef02('0x6')]])){if(!_[_0xef02('0x23')](queues[_0x8ba316[_0xef02('0x6')]][_0xef02('0x62')])){utils[_0xef02('0x10')](util[_0xef02('0x4')]('[%s][queues][musiconholdstop]',_0x8ba316[_0xef02('0x6')]),_0x8ba316);queues[_0x8ba316[_0xef02('0x6')]][_0xef02('0x58')]+=utils['diffTime'](utils[_0xef02('0x14')](),queues[_0x8ba316['uniqueid']][_0xef02('0x62')]);utils[_0xef02('0x3')](util['format'](_0xef02('0x65'),_0x8ba316[_0xef02('0x6')],queues[_0x8ba316[_0xef02('0x6')]][_0xef02('0x1d')],queues[_0x8ba316[_0xef02('0x6')]][_0xef02('0x58')]));delete queues[_0x8ba316[_0xef02('0x6')]][_0xef02('0x62')];}}}catch(_0x3a1fb9){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x66'),_0x8ba316['uniqueid']),_0x3a1fb9);}}; \ No newline at end of file +var _0xb762=['lastAssignedTo','[%s][queues][agentcomplete]','queuecallercompleteAt','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfer','BLIND','transferexten','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertype','ATTENDED','transferuniqueid','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','now','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','variable','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerexitAt','queuecallerabandonAt','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','diffTime','count','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned'];(function(_0x469c8d,_0x5ac9c7){var _0x49034e=function(_0x5681e0){while(--_0x5681e0){_0x469c8d['push'](_0x469c8d['shift']());}};_0x49034e(++_0x5ac9c7);}(_0xb762,0x85));var _0x2b76=function(_0x18dc15,_0x2de821){_0x18dc15=_0x18dc15-0x0;var _0x4e8ceb=_0xb762[_0x18dc15];return _0x4e8ceb;};'use strict';var _=require(_0x2b76('0x0'));var util=require(_0x2b76('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x2323fd){utils[_0x2b76('0x2')](util[_0x2b76('0x3')](_0x2b76('0x4'),_0x2323fd['uniqueid'],_0x2323fd['channel'],_0x2323fd[_0x2b76('0x5')],_0x2323fd['lastAssignedTo'],_0x2323fd[_0x2b76('0x6')],_0x2323fd[_0x2b76('0x7')],_0x2323fd[_0x2b76('0x8')]));if(_0x2323fd[_0x2b76('0x5')]){utils[_0x2b76('0x9')](_0x2323fd[_0x2b76('0x5')])[_0x2b76('0xa')](function(_0x136129){if(_0x136129){_0x2323fd['type']=_0x136129[_0x2b76('0xb')];}utils['request'](_0x2b76('0xc'),_0x2323fd);});}else{utils[_0x2b76('0xd')](_0x2b76('0xc'),_0x2323fd);}if(_0x2323fd[_0x2b76('0xe')]){delete queues[_0x2323fd[_0x2b76('0xe')]];}else{delete queues[_0x2323fd[_0x2b76('0xf')]];}}exports[_0x2b76('0x10')]=function(_0x24631e){try{utils[_0x2b76('0x11')](util[_0x2b76('0x3')](_0x2b76('0x12'),_0x24631e[_0x2b76('0xf')]),_0x24631e);utils[_0x2b76('0x2')](util[_0x2b76('0x3')](_0x2b76('0x13'),_0x24631e[_0x2b76('0xf')],_0x24631e[_0x2b76('0x5')],_0x24631e[_0x2b76('0x14')]));queues[_0x24631e[_0x2b76('0xf')]]=_['assign'](_0x24631e,{'originalposition':_0x24631e['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x4dd97a){utils[_0x2b76('0x15')](util[_0x2b76('0x3')]('[%s][queues][queuecallerjoin]',_0x24631e['uniqueid']),_0x4dd97a);}};exports[_0x2b76('0x16')]=function(_0x197dd6){try{if(!_[_0x2b76('0x17')](queues[_0x197dd6[_0x2b76('0xf')]])){utils[_0x2b76('0x11')](util[_0x2b76('0x3')](_0x2b76('0x18'),_0x197dd6[_0x2b76('0xf')]),_0x197dd6);if(queues[_0x197dd6[_0x2b76('0xf')]][_0x2b76('0x19')]){if(!queues[_0x197dd6['uniqueid']][_0x2b76('0x1a')]&&!queues[_0x197dd6[_0x2b76('0xf')]][_0x2b76('0x1b')]){queues[_0x197dd6[_0x2b76('0xf')]][_0x2b76('0x1c')]=!![];queues[_0x197dd6['uniqueid']]['queuecallercompleteAt']=utils[_0x2b76('0x1d')]();queues[_0x197dd6[_0x2b76('0xf')]][_0x2b76('0x8')]=_0x2b76('0x1e');}utils[_0x2b76('0x2')](util[_0x2b76('0x3')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x197dd6[_0x2b76('0xf')],queues[_0x197dd6[_0x2b76('0xf')]][_0x2b76('0x1f')],queues[_0x197dd6['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x197dd6[_0x2b76('0xf')]]);}else if(queues[_0x197dd6[_0x2b76('0xf')]][_0x2b76('0xe')]){utils[_0x2b76('0x2')](util[_0x2b76('0x3')](_0x2b76('0x20'),_0x197dd6[_0x2b76('0xf')],queues[_0x197dd6[_0x2b76('0xf')]][_0x2b76('0x1f')],queues[_0x197dd6[_0x2b76('0xf')]][_0x2b76('0xe')]));queues[queues[_0x197dd6['uniqueid']]['transfereduniqueid']]=queues[_0x197dd6[_0x2b76('0xf')]];queues[queues[_0x197dd6[_0x2b76('0xf')]][_0x2b76('0xe')]]['queuecallerenterreason']=0x2;delete queues[_0x197dd6['uniqueid']];}}}catch(_0x2f16b7){utils[_0x2b76('0x15')](util[_0x2b76('0x3')]('[%s][queues][hangup]',_0x197dd6[_0x2b76('0xf')]),_0x2f16b7);}};exports[_0x2b76('0x21')]=function(_0x481dee){try{utils[_0x2b76('0x11')](util[_0x2b76('0x3')](_0x2b76('0x22'),_0x481dee[_0x2b76('0xf')]),_0x481dee);if(!_[_0x2b76('0x17')](_0x481dee[_0x2b76('0x23')]['queuestatus'])&&_0x481dee[_0x2b76('0x24')][_0x2b76('0x25')]()!=='CONTINUE'){if(!_[_0x2b76('0x17')](queues[_0x481dee[_0x2b76('0xf')]])){queues[_0x481dee[_0x2b76('0xf')]][_0x2b76('0x1a')]=![];queues[_0x481dee[_0x2b76('0xf')]]['queuecallerabandonAt']=null;queues[_0x481dee[_0x2b76('0xf')]]['queuecallerexit']=!![];queues[_0x481dee['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x481dee['uniqueid']][_0x2b76('0x8')]=_0x481dee[_0x2b76('0x24')][_0x2b76('0x25')]();utils[_0x2b76('0x2')](util[_0x2b76('0x3')](_0x2b76('0x26'),_0x481dee['uniqueid'],queues[_0x481dee[_0x2b76('0xf')]][_0x2b76('0x1f')],_0x481dee['value'],queues[_0x481dee[_0x2b76('0xf')]][_0x2b76('0x8')]));writeDB(queues[_0x481dee[_0x2b76('0xf')]]);}}else if(!_[_0x2b76('0x17')](_0x481dee[_0x2b76('0x23')]['queueposition'])){if(!_[_0x2b76('0x17')](queues[_0x481dee[_0x2b76('0xf')]])&&!queues[_0x481dee['uniqueid']]['queuecallerabandon']){queues[_0x481dee['uniqueid']][_0x2b76('0x1a')]=![];queues[_0x481dee[_0x2b76('0xf')]]['queuecallerabandonAt']=null;queues[_0x481dee['uniqueid']]['queuecallerexit']=!![];queues[_0x481dee[_0x2b76('0xf')]]['queuecallerexitAt']=utils['now']();queues[_0x481dee[_0x2b76('0xf')]][_0x2b76('0x8')]=_0x2b76('0x27');utils['info'](util[_0x2b76('0x3')](_0x2b76('0x28'),_0x481dee[_0x2b76('0xf')],queues[_0x481dee[_0x2b76('0xf')]][_0x2b76('0x1f')],_0x481dee['value'],queues[_0x481dee[_0x2b76('0xf')]][_0x2b76('0x8')]));}}}catch(_0x4f2aa3){utils['error'](util['format']('[%s][queues][varset]',_0x481dee['uniqueid']),_0x4f2aa3);}};exports[_0x2b76('0x1a')]=function(_0x2df0e4){try{if(!_[_0x2b76('0x17')](queues[_0x2df0e4[_0x2b76('0xf')]])){utils[_0x2b76('0x11')](util[_0x2b76('0x3')](_0x2b76('0x29'),_0x2df0e4[_0x2b76('0xf')]),_0x2df0e4);queues[_0x2df0e4['uniqueid']]['queuecallerexit']=![];queues[_0x2df0e4[_0x2b76('0xf')]][_0x2b76('0x2a')]=null;queues[_0x2df0e4[_0x2b76('0xf')]][_0x2b76('0x1a')]=!![];queues[_0x2df0e4[_0x2b76('0xf')]][_0x2b76('0x2b')]=utils[_0x2b76('0x1d')]();queues[_0x2df0e4['uniqueid']]['queuecallerexitreason']='ABANDONED';utils[_0x2b76('0x2')](util[_0x2b76('0x3')](_0x2b76('0x2c'),_0x2df0e4['uniqueid'],queues[_0x2df0e4[_0x2b76('0xf')]][_0x2b76('0x1f')],queues[_0x2df0e4['uniqueid']]['queuecallerexitreason']));}}catch(_0x6b57c4){utils['error'](util[_0x2b76('0x3')](_0x2b76('0x29'),_0x2df0e4[_0x2b76('0xf')]),_0x6b57c4);}};exports[_0x2b76('0x2d')]=function(_0x3ddb90){try{if(!_[_0x2b76('0x17')](queues[_0x3ddb90['uniqueid']])){utils[_0x2b76('0x11')](util[_0x2b76('0x3')](_0x2b76('0x2e'),_0x3ddb90[_0x2b76('0xf')]),_0x3ddb90);utils[_0x2b76('0x2')](util[_0x2b76('0x3')](_0x2b76('0x2f'),_0x3ddb90['uniqueid'],queues[_0x3ddb90[_0x2b76('0xf')]][_0x2b76('0x1f')],_0x3ddb90[_0x2b76('0x30')],_0x3ddb90[_0x2b76('0x31')]));queues[_0x3ddb90[_0x2b76('0xf')]][_0x2b76('0x2d')]=!![];queues[_0x3ddb90['uniqueid']][_0x2b76('0x19')]=utils[_0x2b76('0x1d')]();queues[_0x3ddb90[_0x2b76('0xf')]]['holdtime']=utils[_0x2b76('0x32')](queues[_0x3ddb90[_0x2b76('0xf')]][_0x2b76('0x19')],queues[_0x3ddb90[_0x2b76('0xf')]]['queuecallerjoinAt']);queues[_0x3ddb90[_0x2b76('0xf')]][_0x2b76('0x14')]=_0x3ddb90[_0x2b76('0x14')];queues[_0x3ddb90[_0x2b76('0xf')]]['count']=_0x3ddb90[_0x2b76('0x33')];queues[_0x3ddb90[_0x2b76('0xf')]][_0x2b76('0x30')]=_0x3ddb90[_0x2b76('0x30')];queues[_0x3ddb90[_0x2b76('0xf')]]['connectedlinename']=_0x3ddb90['connectedlinename'];}}catch(_0x11f579){utils[_0x2b76('0x15')](util[_0x2b76('0x3')]('[%s][queues][queuecallerleave]',_0x3ddb90['uniqueid']),_0x11f579);}};exports[_0x2b76('0x34')]=function(_0x4bed52){try{if(!_[_0x2b76('0x17')](queues[_0x4bed52[_0x2b76('0xf')]])){utils[_0x2b76('0x11')](util[_0x2b76('0x3')](_0x2b76('0x35'),_0x4bed52[_0x2b76('0xf')]),_0x4bed52);utils[_0x2b76('0x2')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x4bed52[_0x2b76('0xf')],queues[_0x4bed52[_0x2b76('0xf')]][_0x2b76('0x1f')],_0x4bed52[_0x2b76('0x36')],_0x4bed52[_0x2b76('0x37')]));queues[_0x4bed52['uniqueid']][_0x2b76('0x1a')]=![];queues[_0x4bed52[_0x2b76('0xf')]]['queuecallerabandon']=![];queues[_0x4bed52['uniqueid']][_0x2b76('0x2b')]=null;queues[_0x4bed52[_0x2b76('0xf')]][_0x2b76('0x1b')]=![];queues[_0x4bed52[_0x2b76('0xf')]]['queuecallerexitreason']=null;queues[_0x4bed52['uniqueid']][_0x2b76('0x2a')]=null;queues[_0x4bed52[_0x2b76('0xf')]][_0x2b76('0x38')]=!![];queues[_0x4bed52[_0x2b76('0xf')]][_0x2b76('0x7')]=_0x4bed52[_0x2b76('0x37')];queues[_0x4bed52['uniqueid']][_0x2b76('0x39')]=_0x4bed52[_0x2b76('0x36')];}}catch(_0xb14c6a){utils['error'](util[_0x2b76('0x3')](_0x2b76('0x35'),_0x4bed52[_0x2b76('0xf')]),_0xb14c6a);}};exports['agentcomplete']=function(_0x402049){try{if(!_['isNil'](queues[_0x402049[_0x2b76('0xf')]])){if(queues[_0x402049[_0x2b76('0xf')]]['queuecallerleaveAt']){utils['debug'](util['format'](_0x2b76('0x3a'),_0x402049['uniqueid']),_0x402049);queues[_0x402049[_0x2b76('0xf')]][_0x2b76('0x1a')]=![];queues[_0x402049[_0x2b76('0xf')]][_0x2b76('0x1a')]=![];queues[_0x402049[_0x2b76('0xf')]][_0x2b76('0x2b')]=null;queues[_0x402049['uniqueid']][_0x2b76('0x1b')]=![];queues[_0x402049[_0x2b76('0xf')]][_0x2b76('0x2a')]=null;queues[_0x402049[_0x2b76('0xf')]][_0x2b76('0x38')]=!![];queues[_0x402049[_0x2b76('0xf')]]['lastAssignedTo']=_0x402049[_0x2b76('0x36')];queues[_0x402049[_0x2b76('0xf')]]['queuecallercomplete']=!![];queues[_0x402049[_0x2b76('0xf')]][_0x2b76('0x3b')]=utils[_0x2b76('0x1d')]();if(_0x402049['reason']=='transfer'){if(!queues[_0x402049[_0x2b76('0xf')]]['transfer']){queues[_0x402049[_0x2b76('0xf')]][_0x2b76('0x8')]=_0x2b76('0x3c');}}else{queues[_0x402049['uniqueid']][_0x2b76('0x8')]='COMPLETEDBY'+_0x402049['reason'][_0x2b76('0x25')]();}utils[_0x2b76('0x2')](util['format'](_0x2b76('0x3d'),_0x402049[_0x2b76('0xf')],queues[_0x402049[_0x2b76('0xf')]][_0x2b76('0x1f')],_0x402049[_0x2b76('0x36')],queues[_0x402049[_0x2b76('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x402049[_0x2b76('0xf')]]);}}}catch(_0xb9eec8){utils[_0x2b76('0x15')](util['format']('[%s][queues][agentcomplete]',_0x402049['uniqueid']),_0xb9eec8);}};exports[_0x2b76('0x3e')]=function(_0x1d4467){try{if(!_['isNil'](queues[_0x1d4467[_0x2b76('0x3f')]])){utils['debug'](util[_0x2b76('0x3')](_0x2b76('0x40'),_0x1d4467[_0x2b76('0xf')]),_0x1d4467);queues[_0x1d4467['transfereeuniqueid']][_0x2b76('0x41')]=!![];queues[_0x1d4467[_0x2b76('0x3f')]]['transfertype']=_0x2b76('0x42');queues[_0x1d4467['transfereeuniqueid']][_0x2b76('0x43')]=_0x1d4467[_0x2b76('0x44')];queues[_0x1d4467['transfereeuniqueid']]['transferuniqueid']=_0x1d4467[_0x2b76('0x3f')];queues[_0x1d4467['transfereeuniqueid']][_0x2b76('0x8')]='BLINDTRANSFER';utils[_0x2b76('0x2')](util[_0x2b76('0x3')](_0x2b76('0x45'),_0x1d4467[_0x2b76('0xf')],queues[_0x1d4467[_0x2b76('0x3f')]][_0x2b76('0x1f')],_0x1d4467[_0x2b76('0x3f')],_0x1d4467[_0x2b76('0x44')]));}}catch(_0x59ac8a){utils['error'](util[_0x2b76('0x3')](_0x2b76('0x40'),_0x1d4467[_0x2b76('0xf')]),_0x59ac8a);}};exports[_0x2b76('0x46')]=function(_0x24b271){try{utils['debug'](util[_0x2b76('0x3')](_0x2b76('0x47'),_0x24b271[_0x2b76('0x48')]),_0x24b271);if(_0x24b271[_0x2b76('0x48')]==_0x24b271[_0x2b76('0x49')]){if(!_[_0x2b76('0x17')](queues[_0x24b271[_0x2b76('0x4a')]])){utils[_0x2b76('0x2')](util[_0x2b76('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x24b271['origtransfereruniqueid'],queues[_0x24b271[_0x2b76('0x4a')]][_0x2b76('0x1f')],_0x24b271[_0x2b76('0x4b')]));queues[_0x24b271[_0x2b76('0x4a')]][_0x2b76('0x41')]=!![];queues[_0x24b271[_0x2b76('0x4a')]]['transfertype']='ATTENDED';queues[_0x24b271['secondtransfererlinkedid']][_0x2b76('0x43')]=_0x24b271[_0x2b76('0x4b')];queues[_0x24b271[_0x2b76('0x4a')]]['transferuniqueid']=_0x24b271['origtransfereruniqueid'];queues[_0x24b271[_0x2b76('0x4a')]][_0x2b76('0x8')]=_0x2b76('0x4c');}if(!_[_0x2b76('0x17')](queues[_0x24b271[_0x2b76('0x49')]])){if(_0x24b271[_0x2b76('0x4d')]&&queues[_0x24b271[_0x2b76('0x4d')]]){queues[_0x24b271[_0x2b76('0x4d')]][_0x2b76('0x4e')]=0x1;queues[_0x24b271[_0x2b76('0x3f')]]=_['clone'](queues[_0x24b271[_0x2b76('0x4d')]]);queues[_0x24b271[_0x2b76('0x3f')]][_0x2b76('0xe')]=_0x24b271[_0x2b76('0x4f')];queues[_0x24b271[_0x2b76('0x3f')]][_0x2b76('0x4e')]=0x2;queues[_0x24b271[_0x2b76('0x3f')]][_0x2b76('0x6')]=queues[_0x24b271[_0x2b76('0x4a')]][_0x2b76('0x6')];queues[_0x24b271['transfereeuniqueid']][_0x2b76('0x50')]=queues[_0x24b271[_0x2b76('0x4a')]][_0x2b76('0x50')];queues[_0x24b271[_0x2b76('0x3f')]][_0x2b76('0x51')]=utils[_0x2b76('0x1d')]();queues[_0x24b271[_0x2b76('0x3f')]][_0x2b76('0x19')]=utils['now']();queues[_0x24b271['transfereeuniqueid']]['holdtime']=0x0;queues[_0x24b271['transfereeuniqueid']]['mohtime']=0x0;utils[_0x2b76('0x2')](util[_0x2b76('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x24b271[_0x2b76('0x48')],queues[_0x24b271[_0x2b76('0x3f')]][_0x2b76('0x1f')],queues[_0x24b271[_0x2b76('0x3f')]][_0x2b76('0x6')],queues[_0x24b271[_0x2b76('0x3f')]][_0x2b76('0x50')]));}else{utils[_0x2b76('0x2')](util[_0x2b76('0x3')](_0x2b76('0x52'),_0x24b271[_0x2b76('0x48')],queues[_0x24b271['origtransfererlinkedid']][_0x2b76('0x1f')],_0x24b271[_0x2b76('0x4a')]));queues[_0x24b271[_0x2b76('0x49')]][_0x2b76('0xe')]=_0x24b271['secondtransfererlinkedid'];}}}else if(_0x24b271['secondtransfereruniqueid']==_0x24b271[_0x2b76('0x4a')]){if(!_['isNil'](queues[_0x24b271[_0x2b76('0x49')]])){utils[_0x2b76('0x2')](util[_0x2b76('0x3')](_0x2b76('0x53'),_0x24b271[_0x2b76('0x48')],queues[_0x24b271[_0x2b76('0x49')]][_0x2b76('0x1f')],_0x24b271['secondtransfereruniqueid'],_0x24b271[_0x2b76('0x54')]));queues[_0x24b271[_0x2b76('0x49')]]['transfer']=!![];queues[_0x24b271[_0x2b76('0x49')]][_0x2b76('0x55')]=_0x2b76('0x56');queues[_0x24b271[_0x2b76('0x49')]]['transferexten']=_0x24b271[_0x2b76('0x54')];queues[_0x24b271['origtransfererlinkedid']][_0x2b76('0x57')]=_0x24b271['secondtransfereruniqueid'];queues[_0x24b271['origtransfererlinkedid']][_0x2b76('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x2b76('0x17')](queues[_0x24b271[_0x2b76('0x4a')]])){if(_0x24b271[_0x2b76('0x58')]&&queues[_0x24b271[_0x2b76('0x58')]]){queues[_0x24b271['transfertargetlinkedid']]['queuecallerenterreason']=0x1;queues[_0x24b271['transfertargetuniqueid']]=_['clone'](queues[_0x24b271[_0x2b76('0x58')]]);queues[_0x24b271[_0x2b76('0x4f')]][_0x2b76('0xe')]=_0x24b271[_0x2b76('0x4f')];queues[_0x24b271[_0x2b76('0x4f')]][_0x2b76('0x4e')]=0x2;queues[_0x24b271[_0x2b76('0x4f')]][_0x2b76('0x6')]=queues[_0x24b271[_0x2b76('0x49')]][_0x2b76('0x6')];queues[_0x24b271[_0x2b76('0x4f')]][_0x2b76('0x50')]=queues[_0x24b271[_0x2b76('0x49')]][_0x2b76('0x50')];queues[_0x24b271[_0x2b76('0x4f')]][_0x2b76('0x51')]=utils[_0x2b76('0x1d')]();queues[_0x24b271[_0x2b76('0x4f')]][_0x2b76('0x19')]=utils[_0x2b76('0x1d')]();queues[_0x24b271[_0x2b76('0x4f')]]['holdtime']=0x0;queues[_0x24b271[_0x2b76('0x4f')]][_0x2b76('0x59')]=0x0;utils['info'](util[_0x2b76('0x3')](_0x2b76('0x5a'),_0x24b271[_0x2b76('0x48')],queues[_0x24b271[_0x2b76('0x4f')]][_0x2b76('0x1f')],queues[_0x24b271[_0x2b76('0x4f')]][_0x2b76('0xe')],queues[_0x24b271[_0x2b76('0x4f')]]['calleridnum'],queues[_0x24b271['transfertargetuniqueid']][_0x2b76('0x50')]));}else{utils[_0x2b76('0x2')](util[_0x2b76('0x3')](_0x2b76('0x52'),_0x24b271[_0x2b76('0x48')],queues[_0x24b271[_0x2b76('0x4a')]]['name'],_0x24b271[_0x2b76('0x49')]));queues[_0x24b271[_0x2b76('0x4a')]]['transfereduniqueid']=_0x24b271[_0x2b76('0x49')];}}}}catch(_0xb8d6ed){utils[_0x2b76('0x15')](util[_0x2b76('0x3')](_0x2b76('0x47'),_0x24b271['origtransfereruniqueid']),_0xb8d6ed);}};exports['musiconholdstart']=function(_0x513b7a){try{if(!_['isNil'](queues[_0x513b7a[_0x2b76('0xf')]])){utils[_0x2b76('0x11')](util[_0x2b76('0x3')](_0x2b76('0x5b'),_0x513b7a[_0x2b76('0xf')]),_0x513b7a);queues[_0x513b7a['uniqueid']][_0x2b76('0x5c')]=utils['now']();utils[_0x2b76('0x2')](util[_0x2b76('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x513b7a[_0x2b76('0xf')],queues[_0x513b7a[_0x2b76('0xf')]]['name'],queues[_0x513b7a[_0x2b76('0xf')]][_0x2b76('0x5c')]));}}catch(_0x29919e){utils[_0x2b76('0x15')](util[_0x2b76('0x3')](_0x2b76('0x5b'),_0x513b7a[_0x2b76('0xf')]),_0x29919e);}};exports[_0x2b76('0x5d')]=function(_0x1e780a){try{if(!_[_0x2b76('0x17')](queues[_0x1e780a[_0x2b76('0xf')]])){if(!_['isNil'](queues[_0x1e780a[_0x2b76('0xf')]][_0x2b76('0x5c')])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x1e780a[_0x2b76('0xf')]),_0x1e780a);queues[_0x1e780a['uniqueid']][_0x2b76('0x59')]+=utils[_0x2b76('0x32')](utils[_0x2b76('0x1d')](),queues[_0x1e780a['uniqueid']][_0x2b76('0x5c')]);utils[_0x2b76('0x2')](util['format'](_0x2b76('0x5e'),_0x1e780a['uniqueid'],queues[_0x1e780a[_0x2b76('0xf')]][_0x2b76('0x1f')],queues[_0x1e780a[_0x2b76('0xf')]][_0x2b76('0x59')]));delete queues[_0x1e780a['uniqueid']][_0x2b76('0x5c')];}}}catch(_0x11d3f7){utils[_0x2b76('0x15')](util[_0x2b76('0x3')]('[%s][queues][musiconholdstop]',_0x1e780a['uniqueid']),_0x11d3f7);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 49ddc6f..cf501ba 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 _0x62cc=['request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','debug','isNil','channelstate','channel','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','appdata','application','toLowerCase','set','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','name','UserId'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x62cc,0xf4));var _0xc62c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x62cc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc62c('0x0'));var util=require(_0xc62c('0x1'));var utils=require(_0xc62c('0x2'));var recordings={};function writeDB(_0x131ca5){utils[_0xc62c('0x3')](util[_0xc62c('0x4')](_0xc62c('0x5'),_0x131ca5[_0xc62c('0x6')]));if(_0x131ca5[_0xc62c('0x7')]){utils[_0xc62c('0x8')](_0x131ca5['accountcode'])[_0xc62c('0x9')](function(_0x13191d){if(_0x13191d){_0x131ca5['membername']=_0x13191d[_0xc62c('0xa')];_0x131ca5[_0xc62c('0xb')]=_0x13191d['id'];}utils[_0xc62c('0xc')](_0xc62c('0xd'),_0x131ca5);});}else{utils[_0xc62c('0xc')]('CreateVoiceRecording',_0x131ca5);}}exports[_0xc62c('0xe')]=function(_0x40d0a0){try{utils['debug'](util[_0xc62c('0x4')](_0xc62c('0xf'),_0x40d0a0[_0xc62c('0x6')]),_0x40d0a0);if(_0x40d0a0[_0xc62c('0x6')]==_0x40d0a0['linkedid']){utils[_0xc62c('0x3')](util[_0xc62c('0x4')](_0xc62c('0x10'),_0x40d0a0[_0xc62c('0x6')],_0x40d0a0[_0xc62c('0x11')],_0x40d0a0[_0xc62c('0x12')]));recordings[_0x40d0a0[_0xc62c('0x6')]]={'uniqueid':_0x40d0a0[_0xc62c('0x6')],'accountcode':_0x40d0a0[_0xc62c('0x7')],'exten':_0x40d0a0['exten'],'context':_0x40d0a0[_0xc62c('0x11')],'channel':_0x40d0a0['channel'],'monitors':[]};}}catch(_0x42f577){utils[_0xc62c('0x13')](util[_0xc62c('0x4')]('[%s][recordings][newchannel]',_0x40d0a0[_0xc62c('0x6')]),_0x42f577);}};exports['newstate']=function(_0x3b8c73){try{utils[_0xc62c('0x14')](util[_0xc62c('0x4')]('[%s][recordings][newstate]',_0x3b8c73[_0xc62c('0x6')]),_0x3b8c73);if(!_[_0xc62c('0x15')](recordings[_0x3b8c73[_0xc62c('0x6')]])&&_0x3b8c73[_0xc62c('0x16')]==0x6){utils['info'](util[_0xc62c('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x3b8c73[_0xc62c('0x6')],_0x3b8c73['context'],_0x3b8c73[_0xc62c('0x17')]));}else if(!_[_0xc62c('0x15')](recordings[_0x3b8c73[_0xc62c('0x18')]])&&_0x3b8c73['channelstate']==0x6&&_0x3b8c73['context']!=_0xc62c('0x19')){utils['info'](util[_0xc62c('0x4')](_0xc62c('0x1a'),_0x3b8c73[_0xc62c('0x6')],_0x3b8c73[_0xc62c('0x18')],_0x3b8c73['context'],_0x3b8c73['channel']));recordings[_0x3b8c73[_0xc62c('0x18')]][_0xc62c('0x7')]=_0x3b8c73[_0xc62c('0x7')];}}catch(_0x5e398f){utils['error'](util['format'](_0xc62c('0x1b'),_0x3b8c73[_0xc62c('0x6')]),_0x5e398f);}};exports['varset']=function(_0x4583f9){try{if(!_['isNil'](_0x4583f9[_0xc62c('0x1c')])&&!_[_0xc62c('0x15')](_0x4583f9['variable'][_0xc62c('0x1d')])){utils[_0xc62c('0x14')](util[_0xc62c('0x4')](_0xc62c('0x1e'),_0x4583f9[_0xc62c('0x6')]),_0x4583f9);utils[_0xc62c('0x3')](util[_0xc62c('0x4')](_0xc62c('0x1f'),_0x4583f9[_0xc62c('0x6')],_0x4583f9[_0xc62c('0x1c')],_0x4583f9[_0xc62c('0x20')]));if(_[_0xc62c('0x21')](_0x4583f9[_0xc62c('0x20')],'.wav49')){_0x4583f9[_0xc62c('0x20')]=_0x4583f9[_0xc62c('0x20')][_0xc62c('0x22')](_0xc62c('0x23'),_0xc62c('0x24'));}if(recordings[_0x4583f9[_0xc62c('0x18')]]){var _0x4343f9=_[_0xc62c('0x25')](recordings[_0x4583f9['linkedid']]['monitors'],{'value':_0x4583f9[_0xc62c('0x20')]});if(_[_0xc62c('0x15')](_0x4343f9)){recordings[_0x4583f9[_0xc62c('0x18')]][_0xc62c('0x26')]['push']({'value':_0x4583f9[_0xc62c('0x20')]});}}}}catch(_0x2184aa){utils[_0xc62c('0x13')](util['format'](_0xc62c('0x1e'),_0x4583f9[_0xc62c('0x6')]),_0x2184aa);}};exports[_0xc62c('0x27')]=function(_0x283ef1){try{if(!_[_0xc62c('0x15')](recordings[_0x283ef1[_0xc62c('0x6')]])){utils['debug'](util[_0xc62c('0x4')](_0xc62c('0x28'),_0x283ef1[_0xc62c('0x6')]),_0x283ef1);utils['info'](util['format'](_0xc62c('0x29'),_0x283ef1[_0xc62c('0x6')],_0x283ef1[_0xc62c('0x2a')],_0x283ef1[_0xc62c('0x2b')],_0x283ef1[_0xc62c('0x2c')]));recordings[_0x283ef1[_0xc62c('0x6')]][_0xc62c('0x2a')]=_0x283ef1['calleridnum'];recordings[_0x283ef1[_0xc62c('0x6')]][_0xc62c('0x2b')]=_0x283ef1[_0xc62c('0x2b')];recordings[_0x283ef1[_0xc62c('0x6')]][_0xc62c('0x2d')]=_0x283ef1[_0xc62c('0x2d')];recordings[_0x283ef1[_0xc62c('0x6')]][_0xc62c('0x2e')]=_0x283ef1['connectedlinename'];if(recordings[_0x283ef1[_0xc62c('0x6')]][_0xc62c('0x2f')]==_0xc62c('0x30')&&recordings[_0x283ef1[_0xc62c('0x6')]]['accountcode']){recordings[_0x283ef1[_0xc62c('0x6')]]['connectedlinenum']=recordings[_0x283ef1[_0xc62c('0x6')]]['accountcode'];recordings[_0x283ef1[_0xc62c('0x6')]][_0xc62c('0x2e')]='';}recordings[_0x283ef1[_0xc62c('0x6')]]['monitors'][_0xc62c('0x31')](function(_0x20c86f){var _0x8a15c8=_[_0xc62c('0x32')](recordings[_0x283ef1['uniqueid']]);_0x8a15c8[_0xc62c('0x20')]=_0x20c86f[_0xc62c('0x20')];writeDB(_0x8a15c8);});delete recordings[_0x283ef1[_0xc62c('0x6')]];}}catch(_0x1f9e13){utils[_0xc62c('0x13')](util[_0xc62c('0x4')](_0xc62c('0x28'),_0x283ef1['uniqueid']),_0x1f9e13);}};exports[_0xc62c('0x33')]=function(_0x24a4e5){try{if(!_[_0xc62c('0x15')](recordings[_0x24a4e5[_0xc62c('0x6')]])){utils[_0xc62c('0x14')](util[_0xc62c('0x4')](_0xc62c('0x34'),_0x24a4e5[_0xc62c('0x6')]),_0x24a4e5);utils[_0xc62c('0x3')](util[_0xc62c('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x24a4e5[_0xc62c('0x6')],_0x24a4e5['application'],_0x24a4e5[_0xc62c('0x35')]));if(_0x24a4e5[_0xc62c('0x36')][_0xc62c('0x37')]()==_0xc62c('0x38')&&_[_0xc62c('0x39')](_0x24a4e5[_0xc62c('0x35')][_0xc62c('0x37')](),_0xc62c('0x3a'))){var _0x2bea5a=_0x24a4e5[_0xc62c('0x35')][_0xc62c('0x3b')]('=');var _0x45b6dc=_0x2bea5a[0x0]['substring'](_0x2bea5a[0x0][_0xc62c('0x3c')]('(')+0x1,_0x2bea5a[0x0][_0xc62c('0x3c')](')'));var _0x74f803=_0x2bea5a[0x1];recordings[_0x24a4e5[_0xc62c('0x6')]][_0x45b6dc]=_0x74f803;}}}catch(_0x364383){utils[_0xc62c('0x13')](util[_0xc62c('0x4')](_0xc62c('0x34'),_0x24a4e5[_0xc62c('0x6')]),_0x364383);}};exports[_0xc62c('0x3d')]=function(_0x28b31c){try{if(!_['isNil'](recordings[_0x28b31c['uniqueid']])){utils[_0xc62c('0x14')](util[_0xc62c('0x4')](_0xc62c('0x3e'),_0x28b31c[_0xc62c('0x6')]),_0x28b31c);utils[_0xc62c('0x3')](util[_0xc62c('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x28b31c[_0xc62c('0x6')],_0x28b31c[_0xc62c('0x3f')]));recordings[_0x28b31c['uniqueid']][_0xc62c('0x3f')]=_0x28b31c[_0xc62c('0x3f')];}}catch(_0x455cfb){utils[_0xc62c('0x13')](util[_0xc62c('0x4')](_0xc62c('0x3e'),_0x28b31c[_0xc62c('0x6')]),_0x455cfb);}}; \ No newline at end of file +var _0x650d=['queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','then','name','UserId','request','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinename','type','outbound','connectedlinenum','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x650d,0xfd));var _0xd650=function(_0x36641f,_0x1de996){_0x36641f=_0x36641f-0x0;var _0x264197=_0x650d[_0x36641f];return _0x264197;};'use strict';var _=require(_0xd650('0x0'));var util=require(_0xd650('0x1'));var utils=require(_0xd650('0x2'));var recordings={};function writeDB(_0x1da7ef){utils[_0xd650('0x3')](util[_0xd650('0x4')](_0xd650('0x5'),_0x1da7ef[_0xd650('0x6')]));if(_0x1da7ef['accountcode']){utils[_0xd650('0x7')](_0x1da7ef[_0xd650('0x8')])[_0xd650('0x9')](function(_0x1fd3a3){if(_0x1fd3a3){_0x1da7ef['membername']=_0x1fd3a3[_0xd650('0xa')];_0x1da7ef[_0xd650('0xb')]=_0x1fd3a3['id'];}utils[_0xd650('0xc')]('CreateVoiceRecording',_0x1da7ef);});}else{utils[_0xd650('0xc')]('CreateVoiceRecording',_0x1da7ef);}}exports['newchannel']=function(_0x4ec9ff){try{utils[_0xd650('0xd')](util[_0xd650('0x4')](_0xd650('0xe'),_0x4ec9ff['uniqueid']),_0x4ec9ff);if(_0x4ec9ff[_0xd650('0x6')]==_0x4ec9ff[_0xd650('0xf')]){utils['info'](util['format'](_0xd650('0x10'),_0x4ec9ff[_0xd650('0x6')],_0x4ec9ff['context'],_0x4ec9ff[_0xd650('0x11')]));recordings[_0x4ec9ff['uniqueid']]={'uniqueid':_0x4ec9ff[_0xd650('0x6')],'accountcode':_0x4ec9ff['accountcode'],'exten':_0x4ec9ff['exten'],'context':_0x4ec9ff[_0xd650('0x12')],'channel':_0x4ec9ff[_0xd650('0x13')],'monitors':[]};}}catch(_0x124b0b){utils[_0xd650('0x14')](util['format'](_0xd650('0xe'),_0x4ec9ff[_0xd650('0x6')]),_0x124b0b);}};exports[_0xd650('0x15')]=function(_0x3059ec){try{utils[_0xd650('0xd')](util[_0xd650('0x4')]('[%s][recordings][newstate]',_0x3059ec[_0xd650('0x6')]),_0x3059ec);if(!_[_0xd650('0x16')](recordings[_0x3059ec[_0xd650('0x6')]])&&_0x3059ec[_0xd650('0x17')]==0x6){utils[_0xd650('0x3')](util[_0xd650('0x4')](_0xd650('0x18'),_0x3059ec['uniqueid'],_0x3059ec[_0xd650('0x12')],_0x3059ec[_0xd650('0x13')]));}else if(!_[_0xd650('0x16')](recordings[_0x3059ec[_0xd650('0xf')]])&&_0x3059ec[_0xd650('0x17')]==0x6&&_0x3059ec[_0xd650('0x12')]!=_0xd650('0x19')){utils[_0xd650('0x3')](util[_0xd650('0x4')](_0xd650('0x1a'),_0x3059ec[_0xd650('0x6')],_0x3059ec[_0xd650('0xf')],_0x3059ec[_0xd650('0x12')],_0x3059ec[_0xd650('0x13')]));recordings[_0x3059ec[_0xd650('0xf')]][_0xd650('0x8')]=_0x3059ec['accountcode'];}}catch(_0x259330){utils[_0xd650('0x14')](util[_0xd650('0x4')]('[%s][recordings][newstate]',_0x3059ec[_0xd650('0x6')]),_0x259330);}};exports[_0xd650('0x1b')]=function(_0x9b8f6b){try{if(!_[_0xd650('0x16')](_0x9b8f6b['variable'])&&!_[_0xd650('0x16')](_0x9b8f6b[_0xd650('0x1c')][_0xd650('0x1d')])){utils[_0xd650('0xd')](util['format'](_0xd650('0x1e'),_0x9b8f6b[_0xd650('0x6')]),_0x9b8f6b);utils[_0xd650('0x3')](util[_0xd650('0x4')](_0xd650('0x1f'),_0x9b8f6b[_0xd650('0x6')],_0x9b8f6b['variable'],_0x9b8f6b[_0xd650('0x20')]));if(_[_0xd650('0x21')](_0x9b8f6b['value'],'.wav49')){_0x9b8f6b['value']=_0x9b8f6b[_0xd650('0x20')][_0xd650('0x22')](_0xd650('0x23'),_0xd650('0x24'));}if(recordings[_0x9b8f6b[_0xd650('0xf')]]){var _0xe6f515=_[_0xd650('0x25')](recordings[_0x9b8f6b[_0xd650('0xf')]][_0xd650('0x26')],{'value':_0x9b8f6b[_0xd650('0x20')]});if(_[_0xd650('0x16')](_0xe6f515)){recordings[_0x9b8f6b[_0xd650('0xf')]]['monitors'][_0xd650('0x27')]({'value':_0x9b8f6b[_0xd650('0x20')]});}}}}catch(_0x166d03){utils['error'](util[_0xd650('0x4')](_0xd650('0x1e'),_0x9b8f6b['uniqueid']),_0x166d03);}};exports[_0xd650('0x28')]=function(_0x124c82){try{if(!_[_0xd650('0x16')](recordings[_0x124c82[_0xd650('0x6')]])){utils[_0xd650('0xd')](util['format'](_0xd650('0x29'),_0x124c82['uniqueid']),_0x124c82);utils['info'](util[_0xd650('0x4')](_0xd650('0x2a'),_0x124c82[_0xd650('0x6')],_0x124c82[_0xd650('0x2b')],_0x124c82['calleridname'],_0x124c82[_0xd650('0x2c')]));recordings[_0x124c82['uniqueid']][_0xd650('0x2b')]=_0x124c82[_0xd650('0x2b')];recordings[_0x124c82['uniqueid']][_0xd650('0x2d')]=_0x124c82[_0xd650('0x2d')];recordings[_0x124c82[_0xd650('0x6')]]['connectedlinenum']=_0x124c82['connectedlinenum'];recordings[_0x124c82[_0xd650('0x6')]][_0xd650('0x2e')]=_0x124c82['connectedlinename'];if(recordings[_0x124c82[_0xd650('0x6')]][_0xd650('0x2f')]==_0xd650('0x30')&&recordings[_0x124c82['uniqueid']]['accountcode']){recordings[_0x124c82[_0xd650('0x6')]][_0xd650('0x31')]=recordings[_0x124c82['uniqueid']]['accountcode'];recordings[_0x124c82[_0xd650('0x6')]][_0xd650('0x2e')]='';}recordings[_0x124c82[_0xd650('0x6')]][_0xd650('0x26')]['forEach'](function(_0x4f2fe9){var _0x44deb2=_[_0xd650('0x32')](recordings[_0x124c82[_0xd650('0x6')]]);_0x44deb2[_0xd650('0x20')]=_0x4f2fe9[_0xd650('0x20')];writeDB(_0x44deb2);});delete recordings[_0x124c82[_0xd650('0x6')]];}}catch(_0x36af45){utils[_0xd650('0x14')](util[_0xd650('0x4')](_0xd650('0x29'),_0x124c82[_0xd650('0x6')]),_0x36af45);}};exports[_0xd650('0x33')]=function(_0x236ac1){try{if(!_[_0xd650('0x16')](recordings[_0x236ac1[_0xd650('0x6')]])){utils[_0xd650('0xd')](util[_0xd650('0x4')](_0xd650('0x34'),_0x236ac1[_0xd650('0x6')]),_0x236ac1);utils[_0xd650('0x3')](util[_0xd650('0x4')](_0xd650('0x35'),_0x236ac1[_0xd650('0x6')],_0x236ac1[_0xd650('0x36')],_0x236ac1[_0xd650('0x37')]));if(_0x236ac1[_0xd650('0x36')][_0xd650('0x38')]()==_0xd650('0x39')&&_['startsWith'](_0x236ac1[_0xd650('0x37')][_0xd650('0x38')](),'cdr')){var _0x379be9=_0x236ac1[_0xd650('0x37')]['split']('=');var _0x17f47b=_0x379be9[0x0]['substring'](_0x379be9[0x0]['lastIndexOf']('(')+0x1,_0x379be9[0x0][_0xd650('0x3a')](')'));var _0x481143=_0x379be9[0x1];recordings[_0x236ac1[_0xd650('0x6')]][_0x17f47b]=_0x481143;}}}catch(_0x34cea7){utils[_0xd650('0x14')](util[_0xd650('0x4')](_0xd650('0x34'),_0x236ac1['uniqueid']),_0x34cea7);}};exports[_0xd650('0x3b')]=function(_0x370ec5){try{if(!_[_0xd650('0x16')](recordings[_0x370ec5['uniqueid']])){utils[_0xd650('0xd')](util[_0xd650('0x4')](_0xd650('0x3c'),_0x370ec5['uniqueid']),_0x370ec5);utils[_0xd650('0x3')](util['format'](_0xd650('0x3d'),_0x370ec5['uniqueid'],_0x370ec5[_0xd650('0x3e')]));recordings[_0x370ec5['uniqueid']][_0xd650('0x3e')]=_0x370ec5[_0xd650('0x3e')];}}catch(_0x133b6e){utils[_0xd650('0x14')](util['format']('[%s][recordings][queuecallerjoin]',_0x370ec5[_0xd650('0x6')]),_0x133b6e);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 7dae9d0..ebdac70 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 _0xf253=['isNil','transfereechannel','assign','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','util','./utils','info','format','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfererlinkedid','origtransferercontext','origtransfererexten'];(function(_0x936117,_0x562953){var _0xb57208=function(_0x4a1c11){while(--_0x4a1c11){_0x936117['push'](_0x936117['shift']());}};_0xb57208(++_0x562953);}(_0xf253,0x139));var _0x3f25=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0xf253[_0x4e6eb2];return _0x4e0c1c;};'use strict';var _=require('lodash');var util=require(_0x3f25('0x0'));var utils=require(_0x3f25('0x1'));function writeDB(_0x24860c){utils[_0x3f25('0x2')](util[_0x3f25('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x24860c[_0x3f25('0x4')]==='attended'?_0x24860c[_0x3f25('0x5')]:_0x24860c[_0x3f25('0x6')],_0x24860c[_0x3f25('0x4')]));utils[_0x3f25('0x7')](_0x3f25('0x8'),_0x24860c);}exports[_0x3f25('0x9')]=function(_0x3f4c8f){try{utils[_0x3f25('0xa')](util['format'](_0x3f25('0xb'),_0x3f4c8f[_0x3f25('0x6')]),_0x3f4c8f);utils[_0x3f25('0x2')](util[_0x3f25('0x3')](_0x3f25('0xc'),_0x3f4c8f[_0x3f25('0x6')],_0x3f4c8f['transferercalleridnum'],_0x3f4c8f[_0x3f25('0xd')],_0x3f4c8f[_0x3f25('0xe')],_0x3f4c8f[_0x3f25('0xf')]));_0x3f4c8f[_0x3f25('0x4')]='blind';writeDB(_0x3f4c8f);}catch(_0x22c7f8){utils[_0x3f25('0x10')](util['format'](_0x3f25('0xb'),_0x3f4c8f['uniqueid']),_0x22c7f8);}};exports[_0x3f25('0x11')]=function(_0x1d2a69){try{utils['debug'](util[_0x3f25('0x3')](_0x3f25('0x12'),_0x1d2a69[_0x3f25('0x5')]),_0x1d2a69);utils[_0x3f25('0x2')](util[_0x3f25('0x3')](_0x3f25('0x13'),_0x1d2a69['origtransfereruniqueid'],_0x1d2a69[_0x3f25('0x14')],_0x1d2a69[_0x3f25('0x15')],_0x1d2a69[_0x3f25('0x16')],_0x1d2a69['transfertargetcalleridname']));_0x1d2a69=_['assign'](_0x1d2a69,{'transfererchannel':_0x1d2a69[_0x3f25('0x17')],'transferercalleridnum':_0x1d2a69[_0x3f25('0x14')],'transferercalleridname':_0x1d2a69['origtransferercalleridname'],'transfererconnectedlinenum':_0x1d2a69[_0x3f25('0x18')],'transfererconnectedlinename':_0x1d2a69[_0x3f25('0x19')],'transfereraccountcode':_0x1d2a69['origtransfereraccountcode'],'transferercontext':_0x1d2a69['secondtransferercontext'],'transfererexten':_0x1d2a69['secondtransfererexten'],'transfererlinkedid':_0x1d2a69[_0x3f25('0x1a')],'context':_0x1d2a69[_0x3f25('0x1b')],'extension':_0x1d2a69[_0x3f25('0x1c')],'type':'attended'});if(_[_0x3f25('0x1d')](_0x1d2a69[_0x3f25('0x1e')])){_0x1d2a69=_[_0x3f25('0x1f')](_0x1d2a69,{'transfereechannel':_0x1d2a69[_0x3f25('0x20')],'transfereecalleridnum':_0x1d2a69[_0x3f25('0x16')],'transfereecalleridname':_0x1d2a69[_0x3f25('0x21')],'transfereeconnectedlinenum':_0x1d2a69[_0x3f25('0x22')],'transfereeconnectedlinename':_0x1d2a69['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1d2a69[_0x3f25('0x23')],'transfereecontext':_0x1d2a69[_0x3f25('0x24')],'transfereeexten':_0x1d2a69['transfertargetexten'],'transfereelinkedid':_0x1d2a69[_0x3f25('0x25')]});}writeDB(_0x1d2a69);}catch(_0x128820){utils[_0x3f25('0x10')](util[_0x3f25('0x3')](_0x3f25('0x12'),_0x1d2a69[_0x3f25('0x5')]),_0x128820);}}; \ No newline at end of file +var _0x980a=['transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x980a,0x91));var _0xa980=function(_0x2fd402,_0x35b65d){_0x2fd402=_0x2fd402-0x0;var _0x899cc3=_0x980a[_0x2fd402];return _0x899cc3;};'use strict';var _=require(_0xa980('0x0'));var util=require('util');var utils=require(_0xa980('0x1'));function writeDB(_0x366c67){utils[_0xa980('0x2')](util[_0xa980('0x3')](_0xa980('0x4'),_0x366c67[_0xa980('0x5')]==='attended'?_0x366c67[_0xa980('0x6')]:_0x366c67['uniqueid'],_0x366c67[_0xa980('0x5')]));utils[_0xa980('0x7')](_0xa980('0x8'),_0x366c67);}exports[_0xa980('0x9')]=function(_0xd64f16){try{utils[_0xa980('0xa')](util[_0xa980('0x3')](_0xa980('0xb'),_0xd64f16[_0xa980('0xc')]),_0xd64f16);utils[_0xa980('0x2')](util[_0xa980('0x3')](_0xa980('0xd'),_0xd64f16[_0xa980('0xc')],_0xd64f16[_0xa980('0xe')],_0xd64f16[_0xa980('0xf')],_0xd64f16[_0xa980('0x10')],_0xd64f16[_0xa980('0x11')]));_0xd64f16[_0xa980('0x5')]='blind';writeDB(_0xd64f16);}catch(_0x4f5c09){utils[_0xa980('0x12')](util[_0xa980('0x3')](_0xa980('0xb'),_0xd64f16['uniqueid']),_0x4f5c09);}};exports[_0xa980('0x13')]=function(_0x5cf285){try{utils['debug'](util[_0xa980('0x3')]('[%s][transfers][attendedtransfer]',_0x5cf285[_0xa980('0x6')]),_0x5cf285);utils[_0xa980('0x2')](util[_0xa980('0x3')](_0xa980('0x14'),_0x5cf285[_0xa980('0x6')],_0x5cf285[_0xa980('0x15')],_0x5cf285[_0xa980('0x16')],_0x5cf285[_0xa980('0x17')],_0x5cf285['transfertargetcalleridname']));_0x5cf285=_[_0xa980('0x18')](_0x5cf285,{'transfererchannel':_0x5cf285[_0xa980('0x19')],'transferercalleridnum':_0x5cf285[_0xa980('0x15')],'transferercalleridname':_0x5cf285[_0xa980('0x16')],'transfererconnectedlinenum':_0x5cf285['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5cf285[_0xa980('0x1a')],'transfereraccountcode':_0x5cf285[_0xa980('0x1b')],'transferercontext':_0x5cf285[_0xa980('0x1c')],'transfererexten':_0x5cf285[_0xa980('0x1d')],'transfererlinkedid':_0x5cf285['origtransfererlinkedid'],'context':_0x5cf285[_0xa980('0x1e')],'extension':_0x5cf285[_0xa980('0x1f')],'type':'attended'});if(_['isNil'](_0x5cf285[_0xa980('0x20')])){_0x5cf285=_[_0xa980('0x18')](_0x5cf285,{'transfereechannel':_0x5cf285[_0xa980('0x21')],'transfereecalleridnum':_0x5cf285[_0xa980('0x17')],'transfereecalleridname':_0x5cf285[_0xa980('0x22')],'transfereeconnectedlinenum':_0x5cf285['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5cf285[_0xa980('0x23')],'transfereeaccountcode':_0x5cf285[_0xa980('0x24')],'transfereecontext':_0x5cf285['transfertargetcontext'],'transfereeexten':_0x5cf285[_0xa980('0x25')],'transfereelinkedid':_0x5cf285[_0xa980('0x26')]});}writeDB(_0x5cf285);}catch(_0x30d93c){utils[_0xa980('0x12')](util[_0xa980('0x3')](_0xa980('0x27'),_0x5cf285[_0xa980('0x6')]),_0x30d93c);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index dfcb6d0..aa4e504 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 _0x29ce=['isBefore','bluebird','jayson/promise','util','client','xdr','info','inspect','error','request','then','debug','[utils][request]\x20name:%s','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','diff','now','isAfter'];(function(_0x4adb09,_0x24f71b){var _0x308abd=function(_0x4c2e7c){while(--_0x4c2e7c){_0x4adb09['push'](_0x4adb09['shift']());}};_0x308abd(++_0x24f71b);}(_0x29ce,0xec));var _0xe29c=function(_0x16e441,_0x533809){_0x16e441=_0x16e441-0x0;var _0x1be398=_0x29ce[_0x16e441];return _0x1be398;};'use strict';var BPromise=require(_0xe29c('0x0'));var jayson=require(_0xe29c('0x1'));var moment=require('moment');var util=require(_0xe29c('0x2'));var client=jayson[_0xe29c('0x3')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0xe29c('0x4'));exports[_0xe29c('0x5')]=function(_0x4cf192,_0x79200){logger[_0xe29c('0x5')](_0x4cf192,_0x79200?util[_0xe29c('0x6')](_0x79200,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x43c640,_0x254082){logger['debug'](_0x43c640,_0x254082?util[_0xe29c('0x6')](_0x254082,{'showHidden':![],'depth':null}):'');};exports[_0xe29c('0x7')]=function(_0x31462b,_0x96d90b){logger[_0xe29c('0x7')](_0x31462b,_0x96d90b?util['inspect'](_0x96d90b,{'showHidden':![],'depth':null}):'');};exports[_0xe29c('0x8')]=function(_0x5ca2bf,_0x15dd8f){return client[_0xe29c('0x8')](_0x5ca2bf,{'body':_0x15dd8f})[_0xe29c('0x9')](function(_0x1f69a5){logger[_0xe29c('0xa')](_0xe29c('0xb'),_0x5ca2bf,_0x1f69a5?util[_0xe29c('0x6')](_0x1f69a5,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x4b3c6c){logger[_0xe29c('0x7')](_0xe29c('0xb'),_0x5ca2bf,_0x4b3c6c?util['inspect'](_0x4b3c6c,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3cb306){return client['request'](_0xe29c('0xc'),{'options':{'raw':!![],'attributes':['id',_0xe29c('0xd'),'name',_0xe29c('0xe')],'where':_0x3cb306,'limit':0x1}})[_0xe29c('0x9')](function(_0x64cc0a){logger['debug'](_0xe29c('0xf'),JSON[_0xe29c('0x10')](_0x3cb306),_0x64cc0a?util[_0xe29c('0x6')](_0x64cc0a,{'showHidden':![],'depth':null}):'');return _0x64cc0a[_0xe29c('0x11')]['length']?_0x64cc0a[_0xe29c('0x11')][0x0]:null;});}exports[_0xe29c('0x12')]=function(_0x304bef){return new BPromise(function(_0x311636,_0x1fe57d){if(_0x304bef){return getUser({'internal':_0x304bef})[_0xe29c('0x9')](function(_0x4399dd){logger['info'](_0xe29c('0x13'),_0x304bef,_0x4399dd?_0xe29c('0x14'):_0xe29c('0x15'));return _0x311636(_0x4399dd);})[_0xe29c('0x16')](function(_0x579458){logger[_0xe29c('0x7')]('[utils][getUserByInternal]',_0x579458?util['inspect'](_0x579458,{'showHidden':![],'depth':null}):'');return _0x311636(null);});}return _0x311636(null);});};exports['getUserByInterface']=function(_0x49794f){return new BPromise(function(_0x4c4bf8,_0xbe026){if(_0x49794f){return getUser({'interface':_0x49794f})[_0xe29c('0x9')](function(_0x5a350c){logger[_0xe29c('0x5')](_0xe29c('0x17'),_0x49794f,_0x5a350c?_0xe29c('0x14'):'notfound');return _0x4c4bf8(_0x5a350c);})['catch'](function(_0x142ca8){logger[_0xe29c('0x7')](_0xe29c('0x18'),_0x142ca8?util[_0xe29c('0x6')](_0x142ca8,{'showHidden':![],'depth':null}):'');return _0x4c4bf8(null);});}return _0x4c4bf8(null);});};exports[_0xe29c('0x19')]=function(_0x2c9a3d){return new BPromise(function(_0x3a7632,_0x4f4066){if(_0x2c9a3d){return getUser({'name':_0x2c9a3d})[_0xe29c('0x9')](function(_0x3ef0ce){logger[_0xe29c('0x5')](_0xe29c('0x1a'),_0x2c9a3d,_0x3ef0ce?_0xe29c('0x14'):_0xe29c('0x15'));return _0x3a7632(_0x3ef0ce);})[_0xe29c('0x16')](function(_0x1c00cf){logger[_0xe29c('0x7')](_0xe29c('0x1b'),_0x1c00cf?util['inspect'](_0x1c00cf,{'showHidden':![],'depth':null}):'');return _0x3a7632(null);});}return _0x3a7632(null);});};exports[_0xe29c('0x1c')]=function(_0x832e42){return new BPromise(function(_0x4d3010,_0x4ea72c){if(_0x832e42){return client[_0xe29c('0x8')](_0xe29c('0x1d'),{'options':{'raw':!![],'attributes':['id','name',_0xe29c('0x1e'),'acw','acwTimeout'],'where':{'name':_0x832e42},'limit':0x1}})[_0xe29c('0x9')](function(_0x468042){logger['debug'](_0xe29c('0x1f'),_0x832e42,_0x468042?util[_0xe29c('0x6')](_0x468042,{'showHidden':![],'depth':null}):'');logger[_0xe29c('0x5')](_0xe29c('0x20'),_0x832e42,_0x468042?_0xe29c('0x14'):_0xe29c('0x15'));return _0x4d3010(_0x468042[_0xe29c('0x11')][_0xe29c('0x21')]?_0x468042[_0xe29c('0x11')][0x0]:null);})[_0xe29c('0x16')](function(_0x4b2082){logger[_0xe29c('0x7')](_0xe29c('0x22'),_0x4b2082?util[_0xe29c('0x6')](_0x4b2082,{'showHidden':![],'depth':null}):'');return _0x4d3010(null);});}return _0x4d3010(null);});};exports[_0xe29c('0x23')]=function(_0x5b87a0,_0x37d21c){return moment(_0x5b87a0)[_0xe29c('0x24')](_0x37d21c,'seconds')[_0xe29c('0x25')](_0xe29c('0x26'));};exports[_0xe29c('0x27')]=function(_0x5e33a0,_0x28d063){return moment(_0x5e33a0)[_0xe29c('0x28')](_0x28d063,_0xe29c('0x29'))[_0xe29c('0x25')](_0xe29c('0x26'));};exports[_0xe29c('0x2a')]=function(_0x413286,_0x555680){return moment(_0x413286)[_0xe29c('0x2b')](moment(_0x555680),_0xe29c('0x29'));};exports['sumTime']=function(_0x2058fa,_0x21f02){return parseInt(_0x2058fa,0xa)+parseInt(_0x21f02,0xa);};exports[_0xe29c('0x2c')]=function(){return moment()[_0xe29c('0x25')](_0xe29c('0x26'));};exports[_0xe29c('0x2d')]=function(_0x133ed3,_0x4f62f2){if(_0x4f62f2){return moment(_0x133ed3)[_0xe29c('0x2d')](_0x4f62f2);}return!![];};exports[_0xe29c('0x2e')]=function(_0x21c6a8,_0x4f0fa9){if(_0x4f0fa9){return moment(_0x21c6a8)[_0xe29c('0x2e')](_0x4f0fa9);}else if(_0x21c6a8){return!![];}return![];}; \ No newline at end of file +var _0x6dc0=['[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','notfound','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','catch','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','../../config/logger','xdr','inspect','debug','error','request','then','[utils][request]\x20name:%s','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','info'];(function(_0x24ba95,_0x5a11ce){var _0x32bb90=function(_0x8b011d){while(--_0x8b011d){_0x24ba95['push'](_0x24ba95['shift']());}};_0x32bb90(++_0x5a11ce);}(_0x6dc0,0xb6));var _0x06dc=function(_0x160e3c,_0x50f7cb){_0x160e3c=_0x160e3c-0x0;var _0x4aaf9c=_0x6dc0[_0x160e3c];return _0x4aaf9c;};'use strict';var BPromise=require(_0x06dc('0x0'));var jayson=require(_0x06dc('0x1'));var moment=require(_0x06dc('0x2'));var util=require('util');var client=jayson[_0x06dc('0x3')][_0x06dc('0x4')]({'port':0x2329});var logger=require(_0x06dc('0x5'))(_0x06dc('0x6'));exports['info']=function(_0x3d99ab,_0x30437f){logger['info'](_0x3d99ab,_0x30437f?util[_0x06dc('0x7')](_0x30437f,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x419534,_0x3212ca){logger[_0x06dc('0x8')](_0x419534,_0x3212ca?util[_0x06dc('0x7')](_0x3212ca,{'showHidden':![],'depth':null}):'');};exports[_0x06dc('0x9')]=function(_0x4dcdce,_0x57cde3){logger['error'](_0x4dcdce,_0x57cde3?util[_0x06dc('0x7')](_0x57cde3,{'showHidden':![],'depth':null}):'');};exports[_0x06dc('0xa')]=function(_0x4ec0aa,_0x45693d){return client[_0x06dc('0xa')](_0x4ec0aa,{'body':_0x45693d})[_0x06dc('0xb')](function(_0x46491a){logger['debug'](_0x06dc('0xc'),_0x4ec0aa,_0x46491a?util[_0x06dc('0x7')](_0x46491a,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x527806){logger['error']('[utils][request]\x20name:%s',_0x4ec0aa,_0x527806?util[_0x06dc('0x7')](_0x527806,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4d0bcb){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0x06dc('0xd'),_0x06dc('0xe'),_0x06dc('0xf')],'where':_0x4d0bcb,'limit':0x1}})['then'](function(_0x183302){logger[_0x06dc('0x8')](_0x06dc('0x10'),JSON[_0x06dc('0x11')](_0x4d0bcb),_0x183302?util['inspect'](_0x183302,{'showHidden':![],'depth':null}):'');return _0x183302[_0x06dc('0x12')][_0x06dc('0x13')]?_0x183302[_0x06dc('0x12')][0x0]:null;});}exports[_0x06dc('0x14')]=function(_0x21d87a){return new BPromise(function(_0x51df31,_0x1daaa8){if(_0x21d87a){return getUser({'internal':_0x21d87a})[_0x06dc('0xb')](function(_0x26fc62){logger[_0x06dc('0x15')](_0x06dc('0x16'),_0x21d87a,_0x26fc62?_0x06dc('0x17'):'notfound');return _0x51df31(_0x26fc62);})['catch'](function(_0x227623){logger['error'](_0x06dc('0x18'),_0x227623?util['inspect'](_0x227623,{'showHidden':![],'depth':null}):'');return _0x51df31(null);});}return _0x51df31(null);});};exports[_0x06dc('0x19')]=function(_0x369c60){return new BPromise(function(_0x444a46,_0xfa2b0c){if(_0x369c60){return getUser({'interface':_0x369c60})[_0x06dc('0xb')](function(_0x427f39){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x369c60,_0x427f39?_0x06dc('0x17'):_0x06dc('0x1a'));return _0x444a46(_0x427f39);})['catch'](function(_0x95dab2){logger['error']('[utils][getUserByInterface]',_0x95dab2?util['inspect'](_0x95dab2,{'showHidden':![],'depth':null}):'');return _0x444a46(null);});}return _0x444a46(null);});};exports['getUserByName']=function(_0x54db0e){return new BPromise(function(_0xd3e42b,_0x5edc7b){if(_0x54db0e){return getUser({'name':_0x54db0e})[_0x06dc('0xb')](function(_0x56819b){logger['info'](_0x06dc('0x1b'),_0x54db0e,_0x56819b?_0x06dc('0x17'):'notfound');return _0xd3e42b(_0x56819b);})['catch'](function(_0x263b5c){logger['error'](_0x06dc('0x1c'),_0x263b5c?util[_0x06dc('0x7')](_0x263b5c,{'showHidden':![],'depth':null}):'');return _0xd3e42b(null);});}return _0xd3e42b(null);});};exports[_0x06dc('0x1d')]=function(_0xfd5611){return new BPromise(function(_0x1d98b8,_0x31f5cd){if(_0xfd5611){return client[_0x06dc('0xa')](_0x06dc('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x06dc('0xe'),_0x06dc('0x1f'),_0x06dc('0x20'),_0x06dc('0x21')],'where':{'name':_0xfd5611},'limit':0x1}})[_0x06dc('0xb')](function(_0x560d80){logger['debug'](_0x06dc('0x22'),_0xfd5611,_0x560d80?util[_0x06dc('0x7')](_0x560d80,{'showHidden':![],'depth':null}):'');logger[_0x06dc('0x15')](_0x06dc('0x23'),_0xfd5611,_0x560d80?_0x06dc('0x17'):_0x06dc('0x1a'));return _0x1d98b8(_0x560d80[_0x06dc('0x12')][_0x06dc('0x13')]?_0x560d80[_0x06dc('0x12')][0x0]:null);})[_0x06dc('0x24')](function(_0x5eb996){logger[_0x06dc('0x9')](_0x06dc('0x25'),_0x5eb996?util[_0x06dc('0x7')](_0x5eb996,{'showHidden':![],'depth':null}):'');return _0x1d98b8(null);});}return _0x1d98b8(null);});};exports[_0x06dc('0x26')]=function(_0x237d67,_0x4acc38){return moment(_0x237d67)[_0x06dc('0x27')](_0x4acc38,_0x06dc('0x28'))[_0x06dc('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x06dc('0x2a')]=function(_0x123361,_0x5ca682){return moment(_0x123361)[_0x06dc('0x2b')](_0x5ca682,_0x06dc('0x28'))['format'](_0x06dc('0x2c'));};exports[_0x06dc('0x2d')]=function(_0x15a02c,_0x185e43){return moment(_0x15a02c)[_0x06dc('0x2e')](moment(_0x185e43),_0x06dc('0x28'));};exports[_0x06dc('0x2f')]=function(_0x47287b,_0x172c4d){return parseInt(_0x47287b,0xa)+parseInt(_0x172c4d,0xa);};exports[_0x06dc('0x30')]=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['isAfter']=function(_0x15e679,_0x291192){if(_0x291192){return moment(_0x15e679)[_0x06dc('0x31')](_0x291192);}return!![];};exports[_0x06dc('0x32')]=function(_0x511ba9,_0x51709b){if(_0x51709b){return moment(_0x511ba9)[_0x06dc('0x32')](_0x51709b);}else if(_0x511ba9){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 78fe396..76f3589 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 _0x509f=['url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','responseTime','other','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then','catch','user','data','timestamp','api','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress'];(function(_0x598713,_0x37a3b6){var _0x2aef5a=function(_0x38469f){while(--_0x38469f){_0x598713['push'](_0x598713['shift']());}};_0x2aef5a(++_0x37a3b6);}(_0x509f,0x15b));var _0xf509=function(_0x42c23b,_0x2041fe){_0x42c23b=_0x42c23b-0x0;var _0x2143d7=_0x509f[_0x42c23b];return _0x2143d7;};var fs=require(_0xf509('0x0'));var _=require(_0xf509('0x1'));var ewinston=require(_0xf509('0x2'));var path=require(_0xf509('0x3'));var util=require(_0xf509('0x4'));var fileLogger=require(_0xf509('0x5'))[_0xf509('0x6')];var safeTemplate=require('./safe-template')[_0xf509('0x7')];var maskSensitiveData=require(_0xf509('0x8'))[_0xf509('0x9')];function ClientSideLogger(){function _0x2b22a7(_0x19c525){var _0x36e1d7=path[_0xf509('0xa')](_0xf509('0xb'),_0xf509('0xc'),_0xf509('0xd'));var _0x14fd0d=path[_0xf509('0xa')](_0xf509('0xe'),_0x19c525[_0xf509('0xf')]+'-'+_0x19c525[_0xf509('0x10')]);return fs[_0xf509('0x11')](path[_0xf509('0xa')](_0x36e1d7,_0x14fd0d))[_0xf509('0x12')](function(){var _0x5c6fc0=fileLogger('client',path[_0xf509('0xa')](_0x36e1d7,_0x14fd0d));return _0x5c6fc0;})[_0xf509('0x13')](function(_0xa3bfce){throw _0xa3bfce;});}this[_0xf509('0xc')]=function(_0xf2a67f,_0x1ac618,_0x455647,_0x78108f){return _0x2b22a7(_0xf2a67f[_0xf509('0x14')])[_0xf509('0x12')](function(_0x46271c){var _0x29f462=_0x46271c[_0x1ac618];return _0x29f462;})['then'](function(_0x4f97b5){var _0x25e9c6=_0xf2a67f[_0xf509('0x14')]?_0xf2a67f[_0xf509('0x14')]['id']:'no-user';var _0x145fc7=_0x78108f[_0xf509('0x15')];var _0x29af4c=_0x78108f[_0xf509('0x16')];var _0x1a10f5=new Date(Number(_0x29af4c));return _0x4f97b5(_0x25e9c6,_0x1a10f5,_0x455647,_0x145fc7);})['catch'](function(_0x4694f3){fileLogger(_0xf509('0xe'))['error'](_0x4694f3);});};}function setupLoggers(_0x5cf945){return new Promise(function(_0xc79801){var _0x5c0982=new ClientSideLogger();var _0x42c157=fileLogger(_0xf509('0x17'));var _0x442d61=fileLogger('auth');_0x5cf945[_0xf509('0x18')](_0xf509('0x19'),_0x5c0982);_0x5cf945[_0xf509('0x1a')](ewinston[_0xf509('0x1b')]({'winstonInstance':_0x42c157,'meta':![],'statusLevels':!![],'msg':function(_0x37c8a2,_0x486a69){var _0x4583c9=_0xf509('0x1c');if(!_['isEmpty'](_0x37c8a2[_0xf509('0x1d')])){_0x4583c9+=_0xf509('0x1e');var _0x22b3cf=_0x37c8a2[_0xf509('0x1d')];maskSensitiveData(_0x22b3cf);}return safeTemplate(util[_0xf509('0x1f')](_0x4583c9,_0x37c8a2[_0xf509('0x20')],_0x37c8a2[_0xf509('0x21')][_0xf509('0x22')]?_0x37c8a2[_0xf509('0x21')]['x-forwarded-for']:_0x37c8a2[_0xf509('0x23')][_0xf509('0x24')]||_0x37c8a2['ip'],_0x37c8a2[_0xf509('0x25')],_0x486a69[_0xf509('0x26')],_0x486a69['responseTime'],_0x37c8a2['user']?_0x37c8a2[_0xf509('0x14')]['id']:null,_0x37c8a2[_0xf509('0x14')]?_0x37c8a2['user'][_0xf509('0x10')]:null,_0x37c8a2['user']?_0x37c8a2[_0xf509('0x14')]['role']:null,_0x22b3cf?util[_0xf509('0x27')](_0x22b3cf,![],null):''));}}));_0x5cf945[_0xf509('0x1a')](ewinston[_0xf509('0x1b')]({'winstonInstance':_0x442d61,'meta':![],'statusLevels':!![],'msg':function(_0x461bae,_0x15c174){var _0x2d9c98=_0xf509('0x28');if(_0x461bae[_0xf509('0x1d')]&&_0x461bae[_0xf509('0x1d')][_0xf509('0x29')]&&_0x461bae[_0xf509('0x1d')]['agent_id']){_0x2d9c98='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x2d9c98,_0x461bae[_0xf509('0x20')],_0x461bae['headers'][_0xf509('0x22')]?_0x461bae['headers'][_0xf509('0x22')]:_0x461bae['connection'][_0xf509('0x24')]||_0x461bae['ip'],_0x461bae[_0xf509('0x25')],_0x15c174[_0xf509('0x26')],_0x15c174[_0xf509('0x2a')],_0x461bae['user']?_0x461bae[_0xf509('0x14')]['id']:null,_0x461bae[_0xf509('0x14')]?_0x461bae[_0xf509('0x14')]['name']:null,_0x461bae['user']?_0x461bae['user'][_0xf509('0xf')]:null,_0x461bae['body']&&_0x461bae[_0xf509('0x1d')][_0xf509('0x29')]?_0x461bae[_0xf509('0x1d')][_0xf509('0x29')]:_0xf509('0x2b'),_0x461bae['body']&&_0x461bae[_0xf509('0x1d')]['agent_id']?_0x461bae['body'][_0xf509('0x2c')]:'',_0x461bae[_0xf509('0x1d')]&&_0x461bae[_0xf509('0x1d')][_0xf509('0x2d')]?_0x461bae[_0xf509('0x1d')][_0xf509('0x2d')]:'');},'ignoreRoute':function(_0x4c9019){var _0x3dcd12=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3dcd12[_0xf509('0x2e')](_0x4c9019['url']);}}));return _0xc79801();});}exports[_0xf509('0x2f')]=setupLoggers; \ No newline at end of file +var _0x326a=['inspect','use','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)','url','agent_name','test','setupLoggers','lodash','path','util','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','/var','log','xcally','join','client','role','name','then','user','no-user','data','timestamp','catch','api','auth','set','client-side-logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime'];(function(_0x40efda,_0x56a2e5){var _0x3d1d96=function(_0x2f9ec6){while(--_0x2f9ec6){_0x40efda['push'](_0x40efda['shift']());}};_0x3d1d96(++_0x56a2e5);}(_0x326a,0x90));var _0xa326=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x326a[_0x1ccdf7];return _0x52a0ae;};var fs=require('fs-extra');var _=require(_0xa326('0x0'));var ewinston=require('express-winston');var path=require(_0xa326('0x1'));var util=require(_0xa326('0x2'));var fileLogger=require(_0xa326('0x3'))[_0xa326('0x4')];var safeTemplate=require('./safe-template')[_0xa326('0x5')];var maskSensitiveData=require(_0xa326('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x58a7ee(_0x441c3a){var _0x17a08e=path['join'](_0xa326('0x7'),_0xa326('0x8'),_0xa326('0x9'));var _0x3e723f=path[_0xa326('0xa')](_0xa326('0xb'),_0x441c3a[_0xa326('0xc')]+'-'+_0x441c3a[_0xa326('0xd')]);return fs['ensureDir'](path[_0xa326('0xa')](_0x17a08e,_0x3e723f))[_0xa326('0xe')](function(){var _0x41fdae=fileLogger(_0xa326('0xb'),path[_0xa326('0xa')](_0x17a08e,_0x3e723f));return _0x41fdae;})['catch'](function(_0x569f35){throw _0x569f35;});}this['log']=function(_0x4642f1,_0x3039d8,_0x24dcaf,_0x52a770){return _0x58a7ee(_0x4642f1['user'])[_0xa326('0xe')](function(_0x3cf898){var _0x471ea2=_0x3cf898[_0x3039d8];return _0x471ea2;})[_0xa326('0xe')](function(_0x524d33){var _0x37038f=_0x4642f1[_0xa326('0xf')]?_0x4642f1[_0xa326('0xf')]['id']:_0xa326('0x10');var _0x31bc75=_0x52a770[_0xa326('0x11')];var _0x2d4075=_0x52a770[_0xa326('0x12')];var _0x23915a=new Date(Number(_0x2d4075));return _0x524d33(_0x37038f,_0x23915a,_0x24dcaf,_0x31bc75);})[_0xa326('0x13')](function(_0x1a3f79){fileLogger(_0xa326('0xb'))['error'](_0x1a3f79);});};}function setupLoggers(_0x33aca9){return new Promise(function(_0x4b4e61){var _0x44c720=new ClientSideLogger();var _0x3ce0bb=fileLogger(_0xa326('0x14'));var _0x5564c6=fileLogger(_0xa326('0x15'));_0x33aca9[_0xa326('0x16')](_0xa326('0x17'),_0x44c720);_0x33aca9['use'](ewinston['logger']({'winstonInstance':_0x3ce0bb,'meta':![],'statusLevels':!![],'msg':function(_0x185078,_0x58e4f9){var _0x481358=_0xa326('0x18');if(!_[_0xa326('0x19')](_0x185078[_0xa326('0x1a')])){_0x481358+=_0xa326('0x1b');var _0x7f2ad6=_0x185078[_0xa326('0x1a')];maskSensitiveData(_0x7f2ad6);}return safeTemplate(util[_0xa326('0x1c')](_0x481358,_0x185078[_0xa326('0x1d')],_0x185078[_0xa326('0x1e')][_0xa326('0x1f')]?_0x185078[_0xa326('0x1e')][_0xa326('0x1f')]:_0x185078[_0xa326('0x20')][_0xa326('0x21')]||_0x185078['ip'],_0x185078['url'],_0x58e4f9[_0xa326('0x22')],_0x58e4f9[_0xa326('0x23')],_0x185078[_0xa326('0xf')]?_0x185078['user']['id']:null,_0x185078['user']?_0x185078[_0xa326('0xf')][_0xa326('0xd')]:null,_0x185078[_0xa326('0xf')]?_0x185078[_0xa326('0xf')][_0xa326('0xc')]:null,_0x7f2ad6?util[_0xa326('0x24')](_0x7f2ad6,![],null):''));}}));_0x33aca9[_0xa326('0x25')](ewinston['logger']({'winstonInstance':_0x5564c6,'meta':![],'statusLevels':!![],'msg':function(_0x36700d,_0x125d36){var _0x1f39e5='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x36700d[_0xa326('0x1a')]&&_0x36700d['body'][_0xa326('0x26')]&&_0x36700d[_0xa326('0x1a')][_0xa326('0x27')]){_0x1f39e5=_0xa326('0x28');}return util['format'](_0x1f39e5,_0x36700d[_0xa326('0x1d')],_0x36700d[_0xa326('0x1e')]['x-forwarded-for']?_0x36700d[_0xa326('0x1e')]['x-forwarded-for']:_0x36700d[_0xa326('0x20')][_0xa326('0x21')]||_0x36700d['ip'],_0x36700d[_0xa326('0x29')],_0x125d36[_0xa326('0x22')],_0x125d36['responseTime'],_0x36700d[_0xa326('0xf')]?_0x36700d[_0xa326('0xf')]['id']:null,_0x36700d[_0xa326('0xf')]?_0x36700d[_0xa326('0xf')][_0xa326('0xd')]:null,_0x36700d[_0xa326('0xf')]?_0x36700d[_0xa326('0xf')]['role']:null,_0x36700d['body']&&_0x36700d[_0xa326('0x1a')][_0xa326('0x26')]?_0x36700d[_0xa326('0x1a')][_0xa326('0x26')]:'other',_0x36700d[_0xa326('0x1a')]&&_0x36700d[_0xa326('0x1a')][_0xa326('0x27')]?_0x36700d[_0xa326('0x1a')][_0xa326('0x27')]:'',_0x36700d['body']&&_0x36700d[_0xa326('0x1a')][_0xa326('0x2a')]?_0x36700d[_0xa326('0x1a')][_0xa326('0x2a')]:'');},'ignoreRoute':function(_0x3f4bf8){var _0x5d510e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5d510e[_0xa326('0x2b')](_0x3f4bf8[_0xa326('0x29')]);}}));return _0x4b4e61();});}exports[_0xa326('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 732d339..d4e2505 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa907=['date','daysInMonth','max','min','domCompare','format','MMM','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','join','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularMonthInterval','clone','hours','minutes','startOf','day','endOf','isBetween','timeCompare','ddd','includes'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa907,0xc7));var _0x7a90=function(_0x56f576,_0x39fa12){_0x56f576=_0x56f576-0x0;var _0x13e293=_0xa907[_0x56f576];return _0x13e293;};var _=require(_0x7a90('0x0'));var moment=require(_0x7a90('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][_0x7a90('0x2')](function(_0x3b0017){return _0x3b0017['source'];})[_0x7a90('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x16079e){if(!_0x16079e['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x5827db){var _0x2ec524=_0x5827db[_0x7a90('0x4')](':')['map'](function(_0x4dea24){return parseInt(_0x4dea24,0xa);});var _0x3bc572=_0x2ec524[0x0];var _0x360848=_0x2ec524[0x1];if(_0x3bc572<0x0||_0x3bc572>0x17||_0x360848<0x0||_0x360848>0x3b){throw new Error(EINVALID_DATE);}return[_0x3bc572,_0x360848];}function circularDoWInterval(_0x1088e7,_0xee9805){if(_0x1088e7===_0xee9805){return[_0x1088e7];}else{var _0x5f4718=moment['locale']();moment[_0x7a90('0x5')]('en');var _0x2437aa=moment[_0x7a90('0x6')]()[_0x7a90('0x2')](function(_0x582811){return _0x582811[_0x7a90('0x7')]();});moment[_0x7a90('0x5')](_0x5f4718);var _0x446e38=_0x2437aa[_0x7a90('0x8')](_0x1088e7);var _0x433baf=_0x2437aa[_0x7a90('0x8')](_0xee9805);if(_0x433baf>_0x446e38){return _0x2437aa[_0x7a90('0x9')](_0x446e38,_0x433baf+0x1);}else{var _0x4614b0=_0x2437aa[_0x7a90('0x9')](0x0,_0x433baf+0x1);var _0x5ef796=_0x2437aa[_0x7a90('0x9')](_0x446e38);return _0x5ef796[_0x7a90('0xa')](_0x4614b0);}}}module[_0x7a90('0xb')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x2b61b8,_0x6dc0f1){if(_0x2b61b8===_0x6dc0f1){return[_0x2b61b8];}else{var _0x5381d2=moment[_0x7a90('0x5')]();moment[_0x7a90('0x5')]('en');var _0x310d5c=moment['monthsShort']()['map'](function(_0xf1a1cd){return _0xf1a1cd[_0x7a90('0x7')]();});moment['locale'](_0x5381d2);var _0x38d335=_0x310d5c[_0x7a90('0x8')](_0x2b61b8);var _0x2e976a=_0x310d5c[_0x7a90('0x8')](_0x6dc0f1);if(_0x2e976a>_0x38d335){return _0x310d5c[_0x7a90('0x9')](_0x38d335,_0x2e976a+0x1);}else{var _0xb758b7=_0x310d5c['slice'](0x0,_0x2e976a+0x1);var _0x4ffd52=_0x310d5c[_0x7a90('0x9')](_0x38d335);return _0x4ffd52[_0x7a90('0xa')](_0xb758b7);}}}module[_0x7a90('0xb')][_0x7a90('0xc')]=circularMonthInterval;function parseDom(_0x147b64){var _0x3c6237=parseInt(_0x147b64,0xa);if(_0x3c6237<0x1||_0x3c6237>0x1f){throw new Error(EINVALID_DATE);}return _0x3c6237;}function timeCompare(_0x328905,_0x532d55,_0x177e21){var _0x14cafc=_0x328905[_0x7a90('0xd')]();var _0x44487a=extractTime(_0x532d55);var _0x20cc4e=_0x44487a[0x0];var _0x59ed1c=_0x44487a[0x1];var _0x2093da=_0x328905['clone']()[_0x7a90('0xe')](_0x20cc4e)['minutes'](_0x59ed1c);throwIfDateNotValid(_0x2093da);var _0x5a5215=extractTime(_0x177e21);var _0x31adea=_0x5a5215[0x0];var _0x32349d=_0x5a5215[0x1];var _0x27605f=_0x328905[_0x7a90('0xd')]()[_0x7a90('0xe')](_0x31adea)[_0x7a90('0xf')](_0x32349d);throwIfDateNotValid(_0x27605f);if(_0x27605f['isBefore'](_0x2093da)){var _0x19ceb3=_0x14cafc[_0x7a90('0xd')]()[_0x7a90('0x10')](_0x7a90('0x11'));var _0x2da31b=_0x14cafc[_0x7a90('0xd')]()[_0x7a90('0x12')](_0x7a90('0x11'));return _0x14cafc[_0x7a90('0x13')](_0x2093da,_0x2da31b,undefined,'[]')||_0x14cafc[_0x7a90('0x13')](_0x19ceb3,_0x27605f,undefined,'[]');}else{return _0x14cafc['isBetween'](_0x2093da,_0x27605f,undefined,'[]');}}module[_0x7a90('0xb')][_0x7a90('0x14')]=timeCompare;function dowCompare(_0x4d5b6c,_0x17e7e4,_0x21320d){var _0x2b2382=_0x4d5b6c[_0x7a90('0x5')]('en')['format'](_0x7a90('0x15'))[_0x7a90('0x7')]();return circularDoWInterval(_0x17e7e4,_0x21320d)[_0x7a90('0x16')](_0x2b2382);}module[_0x7a90('0xb')]['dowCompare']=dowCompare;function domCompare(_0x387cc5,_0x3a9dd3,_0xb73922){var _0x3fc15e=_0x387cc5[_0x7a90('0x17')]();if(_0x3a9dd3===_0xb73922){return _0x3fc15e===_0x3a9dd3;}else{var _0x5d9cd5=_0x387cc5[_0x7a90('0x18')]();var _0x264c55=_0x3a9dd3<_0xb73922;let _0x10c357=![];var _0x3cc05f=0x0;var _0x39756c=0x0;if(_0x264c55){_0x3cc05f=Math[_0x7a90('0x19')](0x1,_0x3a9dd3);_0x39756c=Math['min'](_0xb73922,_0x5d9cd5);_0x10c357=_0x3fc15e>=_0x3cc05f&&_0x3fc15e<=_0x39756c;}else{_0x3cc05f=Math[_0x7a90('0x1a')](_0x3a9dd3,_0x5d9cd5);_0x39756c=Math[_0x7a90('0x19')](0x1,_0xb73922);_0x10c357=_0x3fc15e>=_0x3cc05f||_0x3fc15e<=_0x39756c;}return _0x10c357;}}module[_0x7a90('0xb')][_0x7a90('0x1b')]=domCompare;function monthCompare(_0x40e570,_0x5c3301,_0x3fcd3b){var _0x198de5=_0x40e570['locale']('en')[_0x7a90('0x1c')](_0x7a90('0x1d'))[_0x7a90('0x7')]();return circularMonthInterval(_0x5c3301,_0x3fcd3b)['includes'](_0x198de5);}module[_0x7a90('0xb')][_0x7a90('0x1e')]=monthCompare;function iftime(_0x1f53ed,_0x44bd29=moment['tz'][_0x7a90('0x1f')](),_0x1fefa7=moment()){if(!validateRx[_0x7a90('0x20')](_0x1f53ed)){throw new Error(EINVALID_STRING);}else{var _0x3eb3f7=(moment[_0x7a90('0x21')](_0x1fefa7)?_0x1fefa7[_0x7a90('0xd')]():moment(_0x1fefa7))['tz'](_0x44bd29)['locale']('en');throwIfDateNotValid(_0x3eb3f7);var _0x54ab92=_0x1f53ed[_0x7a90('0x4')](',');var _0x1b5ead=_0x54ab92[0x0];var _0xca5d8b=_0x54ab92[0x1];var _0x4dcd30=_0x54ab92[0x2];var _0x23498f=_0x54ab92[0x3];let _0x4519b0=!![];if(_0x1b5ead!=='*'){var _0x52aa12=_0x1b5ead[_0x7a90('0x4')]('-');var _0x3a160a=_[_0x7a90('0x22')](_0x52aa12[0x0],0x5,'0');var _0x2a2089=_0x52aa12[_0x7a90('0x23')]===0x2?_[_0x7a90('0x22')](_0x52aa12[0x1],0x5,'0'):_0x3a160a;_0x4519b0=timeCompare(_0x3eb3f7,_0x3a160a,_0x2a2089);}let _0x55768f=!![];if(_0xca5d8b!=='*'){var _0x3635c5=_0xca5d8b[_0x7a90('0x4')]('-');var _0x3cbf39=_0x3635c5[0x0];var _0x2de5c8=_0x3635c5[_0x7a90('0x23')]===0x2?_0x3635c5[0x1]:_0x3cbf39;_0x55768f=dowCompare(_0x3eb3f7,_0x3cbf39,_0x2de5c8);}let _0x5ce94f=!![];if(_0x4dcd30!=='*'){var _0x281157=_0x4dcd30[_0x7a90('0x4')]('-');var _0x16c7b5=parseDom(_0x281157[0x0]);var _0xfb007e=_0x281157[_0x7a90('0x23')]===0x2?parseDom(_0x281157[0x1]):_0x16c7b5;_0x5ce94f=domCompare(_0x3eb3f7,_0x16c7b5,_0xfb007e);}let _0x53d85f=!![];if(_0x23498f!=='*'){var _0xc48308=_0x23498f['split']('-');var _0x35487d=_0xc48308[0x0];var _0x431293=_0xc48308[_0x7a90('0x23')]===0x2?_0xc48308[0x1]:_0xc48308[0x0];_0x53d85f=monthCompare(_0x3eb3f7,_0x35487d,_0x431293);}return _0x4519b0&&_0x55768f&&_0x5ce94f&&_0x53d85f;}}module[_0x7a90('0xb')][_0x7a90('0x24')]=iftime; \ No newline at end of file +var _0x4379=['circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','monthCompare','test','isMoment','length','padStart','lodash','moment-timezone','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','map','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports'];(function(_0x34b71e,_0x58f44d){var _0x2cb29b=function(_0x49282a){while(--_0x49282a){_0x34b71e['push'](_0x34b71e['shift']());}};_0x2cb29b(++_0x58f44d);}(_0x4379,0x121));var _0x9437=function(_0x46139c,_0x6ccf83){_0x46139c=_0x46139c-0x0;var _0x32430c=_0x4379[_0x46139c];return _0x32430c;};var _=require(_0x9437('0x0'));var moment=require(_0x9437('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]['map'](function(_0x589ac3){return _0x589ac3['source'];})[_0x9437('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x9437('0x3');var EINVALID_DATE=_0x9437('0x4');function throwIfDateNotValid(_0x397b08){if(!_0x397b08[_0x9437('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xa13c4a){var _0x1ae74f=_0xa13c4a[_0x9437('0x6')](':')[_0x9437('0x7')](function(_0x74259e){return parseInt(_0x74259e,0xa);});var _0x50ae3f=_0x1ae74f[0x0];var _0x4fda54=_0x1ae74f[0x1];if(_0x50ae3f<0x0||_0x50ae3f>0x17||_0x4fda54<0x0||_0x4fda54>0x3b){throw new Error(EINVALID_DATE);}return[_0x50ae3f,_0x4fda54];}function circularDoWInterval(_0x4889c1,_0x127b82){if(_0x4889c1===_0x127b82){return[_0x4889c1];}else{var _0x4bd8b7=moment[_0x9437('0x8')]();moment[_0x9437('0x8')]('en');var _0x2c41f7=moment[_0x9437('0x9')]()[_0x9437('0x7')](function(_0x17d8d1){return _0x17d8d1[_0x9437('0xa')]();});moment[_0x9437('0x8')](_0x4bd8b7);var _0x1c9480=_0x2c41f7[_0x9437('0xb')](_0x4889c1);var _0x13c16d=_0x2c41f7[_0x9437('0xb')](_0x127b82);if(_0x13c16d>_0x1c9480){return _0x2c41f7[_0x9437('0xc')](_0x1c9480,_0x13c16d+0x1);}else{var _0x1429e4=_0x2c41f7[_0x9437('0xc')](0x0,_0x13c16d+0x1);var _0x491c14=_0x2c41f7['slice'](_0x1c9480);return _0x491c14[_0x9437('0xd')](_0x1429e4);}}}module['exports']['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x403a1e,_0x429322){if(_0x403a1e===_0x429322){return[_0x403a1e];}else{var _0x1a0dc9=moment[_0x9437('0x8')]();moment[_0x9437('0x8')]('en');var _0x3190a9=moment['monthsShort']()[_0x9437('0x7')](function(_0x50ab5e){return _0x50ab5e[_0x9437('0xa')]();});moment[_0x9437('0x8')](_0x1a0dc9);var _0x19700e=_0x3190a9[_0x9437('0xb')](_0x403a1e);var _0x5204ca=_0x3190a9[_0x9437('0xb')](_0x429322);if(_0x5204ca>_0x19700e){return _0x3190a9['slice'](_0x19700e,_0x5204ca+0x1);}else{var _0x599281=_0x3190a9[_0x9437('0xc')](0x0,_0x5204ca+0x1);var _0x13f30f=_0x3190a9[_0x9437('0xc')](_0x19700e);return _0x13f30f['concat'](_0x599281);}}}module[_0x9437('0xe')][_0x9437('0xf')]=circularMonthInterval;function parseDom(_0x36838b){var _0x3e6d19=parseInt(_0x36838b,0xa);if(_0x3e6d19<0x1||_0x3e6d19>0x1f){throw new Error(EINVALID_DATE);}return _0x3e6d19;}function timeCompare(_0x41f249,_0x5eaaee,_0x42f862){var _0x167fd8=_0x41f249[_0x9437('0x10')]();var _0x3ad655=extractTime(_0x5eaaee);var _0x3632cc=_0x3ad655[0x0];var _0x282257=_0x3ad655[0x1];var _0x36b0c2=_0x41f249['clone']()[_0x9437('0x11')](_0x3632cc)[_0x9437('0x12')](_0x282257);throwIfDateNotValid(_0x36b0c2);var _0x675fb1=extractTime(_0x42f862);var _0x5e4d62=_0x675fb1[0x0];var _0x5c6214=_0x675fb1[0x1];var _0x23c3f6=_0x41f249[_0x9437('0x10')]()['hours'](_0x5e4d62)[_0x9437('0x12')](_0x5c6214);throwIfDateNotValid(_0x23c3f6);if(_0x23c3f6[_0x9437('0x13')](_0x36b0c2)){var _0x5d7fae=_0x167fd8['clone']()[_0x9437('0x14')](_0x9437('0x15'));var _0x7b3b82=_0x167fd8[_0x9437('0x10')]()['endOf'](_0x9437('0x15'));return _0x167fd8[_0x9437('0x16')](_0x36b0c2,_0x7b3b82,undefined,'[]')||_0x167fd8['isBetween'](_0x5d7fae,_0x23c3f6,undefined,'[]');}else{return _0x167fd8[_0x9437('0x16')](_0x36b0c2,_0x23c3f6,undefined,'[]');}}module[_0x9437('0xe')][_0x9437('0x17')]=timeCompare;function dowCompare(_0x35becc,_0x1051e0,_0x5ca418){var _0x1c6d61=_0x35becc[_0x9437('0x8')]('en')[_0x9437('0x18')](_0x9437('0x19'))[_0x9437('0xa')]();return circularDoWInterval(_0x1051e0,_0x5ca418)[_0x9437('0x1a')](_0x1c6d61);}module[_0x9437('0xe')][_0x9437('0x1b')]=dowCompare;function domCompare(_0x2a5f0e,_0x1a032a,_0x1798c0){var _0x5dccf8=_0x2a5f0e[_0x9437('0x1c')]();if(_0x1a032a===_0x1798c0){return _0x5dccf8===_0x1a032a;}else{var _0x4b531e=_0x2a5f0e[_0x9437('0x1d')]();var _0x399940=_0x1a032a<_0x1798c0;let _0x4b7dfd=![];var _0x234233=0x0;var _0x30f536=0x0;if(_0x399940){_0x234233=Math[_0x9437('0x1e')](0x1,_0x1a032a);_0x30f536=Math[_0x9437('0x1f')](_0x1798c0,_0x4b531e);_0x4b7dfd=_0x5dccf8>=_0x234233&&_0x5dccf8<=_0x30f536;}else{_0x234233=Math['min'](_0x1a032a,_0x4b531e);_0x30f536=Math[_0x9437('0x1e')](0x1,_0x1798c0);_0x4b7dfd=_0x5dccf8>=_0x234233||_0x5dccf8<=_0x30f536;}return _0x4b7dfd;}}module[_0x9437('0xe')][_0x9437('0x20')]=domCompare;function monthCompare(_0x382ce0,_0x100f57,_0x1790b3){var _0xadb5d4=_0x382ce0[_0x9437('0x8')]('en')[_0x9437('0x18')]('MMM')[_0x9437('0xa')]();return circularMonthInterval(_0x100f57,_0x1790b3)[_0x9437('0x1a')](_0xadb5d4);}module[_0x9437('0xe')][_0x9437('0x21')]=monthCompare;function iftime(_0x2f65ff,_0x6c5cab=moment['tz']['guess'](),_0x3f603b=moment()){if(!validateRx[_0x9437('0x22')](_0x2f65ff)){throw new Error(EINVALID_STRING);}else{var _0x4663c4=(moment[_0x9437('0x23')](_0x3f603b)?_0x3f603b['clone']():moment(_0x3f603b))['tz'](_0x6c5cab)['locale']('en');throwIfDateNotValid(_0x4663c4);var _0x1d7a2e=_0x2f65ff[_0x9437('0x6')](',');var _0x2db8e4=_0x1d7a2e[0x0];var _0x166978=_0x1d7a2e[0x1];var _0x1ff575=_0x1d7a2e[0x2];var _0x37a2db=_0x1d7a2e[0x3];let _0x1dff6b=!![];if(_0x2db8e4!=='*'){var _0x9d1188=_0x2db8e4[_0x9437('0x6')]('-');var _0x444f35=_['padStart'](_0x9d1188[0x0],0x5,'0');var _0x14dc16=_0x9d1188[_0x9437('0x24')]===0x2?_[_0x9437('0x25')](_0x9d1188[0x1],0x5,'0'):_0x444f35;_0x1dff6b=timeCompare(_0x4663c4,_0x444f35,_0x14dc16);}let _0x4e0f6b=!![];if(_0x166978!=='*'){var _0x28f992=_0x166978[_0x9437('0x6')]('-');var _0x5e2298=_0x28f992[0x0];var _0xbe7301=_0x28f992['length']===0x2?_0x28f992[0x1]:_0x5e2298;_0x4e0f6b=dowCompare(_0x4663c4,_0x5e2298,_0xbe7301);}let _0x242c4d=!![];if(_0x1ff575!=='*'){var _0x3da61e=_0x1ff575[_0x9437('0x6')]('-');var _0x43461b=parseDom(_0x3da61e[0x0]);var _0x2167d3=_0x3da61e['length']===0x2?parseDom(_0x3da61e[0x1]):_0x43461b;_0x242c4d=domCompare(_0x4663c4,_0x43461b,_0x2167d3);}let _0x5e2b71=!![];if(_0x37a2db!=='*'){var _0x224f84=_0x37a2db[_0x9437('0x6')]('-');var _0x10f87d=_0x224f84[0x0];var _0x513fcd=_0x224f84['length']===0x2?_0x224f84[0x1]:_0x224f84[0x0];_0x5e2b71=monthCompare(_0x4663c4,_0x10f87d,_0x513fcd);}return _0x1dff6b&&_0x4e0f6b&&_0x242c4d&&_0x5e2b71;}}module[_0x9437('0xe')]['iftime']=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 92c69b6..b0e1cf8 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x381a=['%s-%s','error','consoleLogger','fileLogger','path','util','moment','debugLevel','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','Console','warn','File'];(function(_0x146837,_0x2aa6a2){var _0x3d7e60=function(_0x1301ac){while(--_0x1301ac){_0x146837['push'](_0x146837['shift']());}};_0x3d7e60(++_0x2aa6a2);}(_0x381a,0x163));var _0xa381=function(_0x372fd9,_0x6e14cd){_0x372fd9=_0x372fd9-0x0;var _0x3b7a22=_0x381a[_0x372fd9];return _0x3b7a22;};'use strict';var path=require(_0xa381('0x0'));var util=require(_0xa381('0x1'));var moment=require(_0xa381('0x2'));var winston=require('winston');var config=require('../config/environment');var debugLevel=config[_0xa381('0x3')]?config[_0xa381('0x3')]['toLowerCase']():_0xa381('0x4');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':_0xa381('0x5'),'error':_0xa381('0x6'),'warn':_0xa381('0x7'),'info':_0xa381('0x8'),'print':_0xa381('0x9'),'success':_0xa381('0xa'),'http':_0xa381('0xb'),'verbose':_0xa381('0xc'),'debug':'bold\x20blue','silly':_0xa381('0xd')};winston[_0xa381('0xe')](XC_LOG_COLORS);function getLogFileName(_0x4ce883,_0x456553,_0x2a31ca){var _0x4d9bbf=_0x4ce883||_0xa381('0xf');return path['join'](_0x4d9bbf,util[_0xa381('0x10')](_0xa381('0x11'),_0x456553,_0x2a31ca));}function formatter(_0x1b193f,_0x4a6f27){_0x4a6f27[_0xa381('0x12')]=_0x4a6f27[_0xa381('0x12')][_0xa381('0x13')](/@@{/g,_0xa381('0x14'))[_0xa381('0x13')](/}@@/g,_0xa381('0x15'))[_0xa381('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xa381('0x10')](_0xa381('0x16'),moment()['format'](_0xa381('0x17')),_0x4a6f27[_0xa381('0x18')]['toUpperCase'](),_0x1b193f,_0x4a6f27[_0xa381('0x12')]);}function fileFormat(_0x2bdbc6,_0x26bc60){_0x26bc60[_0xa381('0x12')]=_0x26bc60[_0xa381('0x12')][_0xa381('0x13')](/@@{/g,_0xa381('0x14'))[_0xa381('0x13')](/}@@/g,_0xa381('0x15'))[_0xa381('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x2234ba=_0x26bc60[_0xa381('0x19')]&&Object['keys'](_0x26bc60[_0xa381('0x19')])[_0xa381('0x1a')]?'\x0a\x09'+JSON[_0xa381('0x1b')](_0x26bc60[_0xa381('0x19')]):'';return util[_0xa381('0x10')](_0xa381('0x1c'),moment()[_0xa381('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x26bc60['level'][_0xa381('0x1d')](),_0x2bdbc6,_0x26bc60['message'],_0x2234ba);}function consoleLogger(){var _0x11b426=new winston[(_0xa381('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa381('0x1f'))][(_0xa381('0x20'))]({'level':_0xa381('0x21'),'json':![],'formatter':function(_0x7ecece){return formatter('',_0x7ecece);}})]});return _0x11b426;}function fileLogger(_0x3d3179,_0x32a2a4){var _0x4e2c11=new winston[(_0xa381('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa381('0x1f'))][(_0xa381('0x22'))]({'name':util[_0xa381('0x10')](_0xa381('0x23'),_0x3d3179,_0xa381('0x24')),'filename':getLogFileName(_0x32a2a4,_0x3d3179,_0xa381('0x24')),'level':_0xa381('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2ae6b7){return fileFormat(_0x3d3179,_0x2ae6b7);}}),new winston['transports']['File']({'name':util[_0xa381('0x10')](_0xa381('0x23'),_0x3d3179,debugLevel),'filename':getLogFileName(_0x32a2a4,_0x3d3179,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x121e42){return fileFormat(_0x3d3179,_0x121e42);}}),new winston[(_0xa381('0x1f'))][(_0xa381('0x20'))]({'level':_0xa381('0x21'),'json':![],'formatter':function(_0xbdec4a){return fileFormat(_0x3d3179,_0xbdec4a);}})]});return _0x4e2c11;}exports[_0xa381('0x25')]=consoleLogger;exports[_0xa381('0x26')]=fileLogger; \ No newline at end of file +var _0x43f5=['redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','keys','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','warn','File','error','%s-%s','Console','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info'];(function(_0x216094,_0x27dcb5){var _0x241389=function(_0x147743){while(--_0x147743){_0x216094['push'](_0x216094['shift']());}};_0x241389(++_0x27dcb5);}(_0x43f5,0x172));var _0x543f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x43f5[_0x122ef9];return _0x42fba0;};'use strict';var path=require(_0x543f('0x0'));var util=require(_0x543f('0x1'));var moment=require(_0x543f('0x2'));var winston=require(_0x543f('0x3'));var config=require(_0x543f('0x4'));var debugLevel=config[_0x543f('0x5')]?config['debugLevel'][_0x543f('0x6')]():_0x543f('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x543f('0x8'),'error':_0x543f('0x9'),'warn':_0x543f('0xa'),'info':_0x543f('0xb'),'print':_0x543f('0xc'),'success':'bold\x20green','http':'gray','verbose':_0x543f('0xd'),'debug':_0x543f('0xe'),'silly':_0x543f('0xf')};winston[_0x543f('0x10')](XC_LOG_COLORS);function getLogFileName(_0x4798ac,_0x2414df,_0x4c9ac0){var _0x3d6c90=_0x4798ac||_0x543f('0x11');return path[_0x543f('0x12')](_0x3d6c90,util[_0x543f('0x13')](_0x543f('0x14'),_0x2414df,_0x4c9ac0));}function formatter(_0x4d068f,_0x195f75){_0x195f75['message']=_0x195f75[_0x543f('0x15')][_0x543f('0x16')](/@@{/g,'{{{')[_0x543f('0x16')](/}@@/g,_0x543f('0x17'))[_0x543f('0x16')](/@{/g,'{{')[_0x543f('0x16')](/}@/g,'}}');return util['format'](_0x543f('0x18'),moment()[_0x543f('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),_0x195f75[_0x543f('0x19')][_0x543f('0x1a')](),_0x4d068f,_0x195f75[_0x543f('0x15')]);}function fileFormat(_0x17f936,_0x5d859b){_0x5d859b['message']=_0x5d859b['message'][_0x543f('0x16')](/@@{/g,'{{{')['replace'](/}@@/g,_0x543f('0x17'))[_0x543f('0x16')](/@{/g,'{{')[_0x543f('0x16')](/}@/g,'}}');var _0x329b0d=_0x5d859b['meta']&&Object[_0x543f('0x1b')](_0x5d859b[_0x543f('0x1c')])[_0x543f('0x1d')]?'\x0a\x09'+JSON[_0x543f('0x1e')](_0x5d859b[_0x543f('0x1c')]):'';return util['format'](_0x543f('0x1f'),moment()[_0x543f('0x13')](_0x543f('0x20')),_0x5d859b[_0x543f('0x19')][_0x543f('0x1a')](),_0x17f936,_0x5d859b[_0x543f('0x15')],_0x329b0d);}function consoleLogger(){var _0x3ab27a=new winston[(_0x543f('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x543f('0x22'))]['Console']({'level':_0x543f('0x23'),'json':![],'formatter':function(_0x258fb2){return formatter('',_0x258fb2);}})]});return _0x3ab27a;}function fileLogger(_0x42edcd,_0x2b7b74){var _0x2e85d5=new winston[(_0x543f('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x543f('0x22'))][(_0x543f('0x24'))]({'name':util[_0x543f('0x13')]('%s-%s',_0x42edcd,_0x543f('0x25')),'filename':getLogFileName(_0x2b7b74,_0x42edcd,'error'),'level':_0x543f('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5a87dc){return fileFormat(_0x42edcd,_0x5a87dc);}}),new winston[(_0x543f('0x22'))][(_0x543f('0x24'))]({'name':util['format'](_0x543f('0x26'),_0x42edcd,debugLevel),'filename':getLogFileName(_0x2b7b74,_0x42edcd,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x43d568){return fileFormat(_0x42edcd,_0x43d568);}}),new winston['transports'][(_0x543f('0x27'))]({'level':_0x543f('0x23'),'json':![],'formatter':function(_0x22969b){return fileFormat(_0x42edcd,_0x22969b);}})]});return _0x2e85d5;}exports[_0x543f('0x28')]=consoleLogger;exports[_0x543f('0x29')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index e83b4ad..e8eb703 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 _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0x0295,0x1f0));var _0x5029=function(_0x54e631,_0x3b8396){_0x54e631=_0x54e631-0x0;var _0x3c6b6a=_0x0295[_0x54e631];return _0x3c6b6a;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +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(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x57ca,0x108));var _0xa57c=function(_0x2cbc99,_0x1c70b1){_0x2cbc99=_0x2cbc99-0x0;var _0x14ac47=_0x57ca[_0x2cbc99];return _0x14ac47;};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/safe-template.js b/server/utils/safe-template.js index 7130765..d3401c5 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 _0xda3f=['isPlainObject','keys','exports','safeTemplate','{\x20{\x20','string','isArray','map'];(function(_0x49237d,_0xbe0b7f){var _0x487149=function(_0x12a677){while(--_0x12a677){_0x49237d['push'](_0x49237d['shift']());}};_0x487149(++_0xbe0b7f);}(_0xda3f,0xec));var _0xfda3=function(_0x1c4450,_0x44edd4){_0x1c4450=_0x1c4450-0x0;var _0x54ab92=_0xda3f[_0x1c4450];return _0x54ab92;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x89912f){return _0x89912f==='{{'?_0xfda3('0x0'):'\x20}\x20}';}function safeTemplate(_0x5299b0){var _0x5d7071=_0x5299b0;if(typeof _0x5299b0===_0xfda3('0x1')){_0x5d7071=_0x5299b0['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfda3('0x2')](_0x5299b0)){_0x5d7071=_0x5299b0[_0xfda3('0x3')](function(_0x516500){return safeTemplate(_0x516500);});}else if(_[_0xfda3('0x4')](_0x5299b0)){_0x5d7071=Object[_0xfda3('0x5')](_0x5299b0)['reduce'](function(_0x4e72d1,_0x316792){_0x4e72d1[_0x316792]=safeTemplate(_0x5299b0[_0x316792]);return _0x4e72d1;},{});}return _0x5d7071;}module[_0xfda3('0x6')][_0xfda3('0x7')]=safeTemplate; \ No newline at end of file +var _0x1eba=['\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20'];(function(_0x4d0df6,_0x4634f3){var _0x4e2615=function(_0x5285e2){while(--_0x5285e2){_0x4d0df6['push'](_0x4d0df6['shift']());}};_0x4e2615(++_0x4634f3);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0x1eba[_0x408e38];return _0x426b0e;};var _=require(_0xa1eb('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b1355){return _0x2b1355==='{{'?_0xa1eb('0x1'):_0xa1eb('0x2');}function safeTemplate(_0x3ef7ee){var _0x5865fc=_0x3ef7ee;if(typeof _0x3ef7ee==='string'){_0x5865fc=_0x3ef7ee[_0xa1eb('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xa1eb('0x4')](_0x3ef7ee)){_0x5865fc=_0x3ef7ee[_0xa1eb('0x5')](function(_0xf9d704){return safeTemplate(_0xf9d704);});}else if(_[_0xa1eb('0x6')](_0x3ef7ee)){_0x5865fc=Object[_0xa1eb('0x7')](_0x3ef7ee)[_0xa1eb('0x8')](function(_0x2bfbb0,_0x39a5a3){_0x2bfbb0[_0x39a5a3]=safeTemplate(_0x3ef7ee[_0x39a5a3]);return _0x2bfbb0;},{});}return _0x5865fc;}module[_0xa1eb('0x9')][_0xa1eb('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 174c53c..0b433b7 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 _0xd5a1=['isArray','apps','findIndex','motion2','env','NODE_PATH','pathExists','readJSON','then','info','Updating\x20app.json','writeJSON','fs-extra','path','resolve','legacy-libs'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0xd5a1,0x11c));var _0x1d5a=function(_0x809f1e,_0x1e8d37){_0x809f1e=_0x809f1e-0x0;var _0x1afc76=_0xd5a1[_0x809f1e];return _0x1afc76;};var fs=require(_0x1d5a('0x0'));var path=require(_0x1d5a('0x1'));var config=require('../config/environment');var root=config['root'];var APP_JSON_PATH=path['resolve'](root,'server/app.json');var NODEPATH=path[_0x1d5a('0x2')](root,_0x1d5a('0x3'));function setLegacyLibsNodeEnvPath(_0x33987d){let _0x1429ab=![];if(Array[_0x1d5a('0x4')](_0x33987d[_0x1d5a('0x5')])){var _0x189437=_0x33987d[_0x1d5a('0x5')][_0x1d5a('0x6')](function(_0x366fdf){return _0x366fdf['name']===_0x1d5a('0x7');});if(_0x189437>-0x1){var _0x3fbd84=_0x33987d[_0x1d5a('0x5')][_0x189437];if(typeof _0x3fbd84[_0x1d5a('0x8')][_0x1d5a('0x9')]!=='string'){_0x3fbd84[_0x1d5a('0x8')]['NODE_PATH']=NODEPATH;_0x1429ab=!![];}}return{'appConfig':_0x33987d,'updated':_0x1429ab};}}function updateAppConfig(_0x2edee6){return fs[_0x1d5a('0xa')](APP_JSON_PATH)['then'](function(_0x3dcb11){if(_0x3dcb11){return fs[_0x1d5a('0xb')](APP_JSON_PATH)[_0x1d5a('0xc')](function(_0xefa20f){var _0x3db312=setLegacyLibsNodeEnvPath(_0xefa20f);if(_0x3db312['updated']){_0x2edee6[_0x1d5a('0xd')](_0x1d5a('0xe'));return fs[_0x1d5a('0xf')](APP_JSON_PATH,_0xefa20f,{'spaces':0x2});}else{return Promise[_0x1d5a('0x2')]();}});}else{return Promise['resolve']();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0xf36d=['name','motion2','NODE_PATH','string','pathExists','then','updated','info','writeJSON','exports','fs-extra','path','resolve','isArray','apps'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf36d,0x127));var _0xdf36=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xf36d[_0x4e1d03];return _0x362d4b;};var fs=require(_0xdf36('0x0'));var path=require(_0xdf36('0x1'));var config=require('../config/environment');var root=config['root'];var APP_JSON_PATH=path[_0xdf36('0x2')](root,'server/app.json');var NODEPATH=path['resolve'](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x4acb16){let _0x4ba2aa=![];if(Array[_0xdf36('0x3')](_0x4acb16['apps'])){var _0xc5905f=_0x4acb16[_0xdf36('0x4')]['findIndex'](function(_0x4fba5d){return _0x4fba5d[_0xdf36('0x5')]===_0xdf36('0x6');});if(_0xc5905f>-0x1){var _0x22fa34=_0x4acb16[_0xdf36('0x4')][_0xc5905f];if(typeof _0x22fa34['env'][_0xdf36('0x7')]!==_0xdf36('0x8')){_0x22fa34['env'][_0xdf36('0x7')]=NODEPATH;_0x4ba2aa=!![];}}return{'appConfig':_0x4acb16,'updated':_0x4ba2aa};}}function updateAppConfig(_0x5cf8a4){return fs[_0xdf36('0x9')](APP_JSON_PATH)[_0xdf36('0xa')](function(_0x5aa746){if(_0x5aa746){return fs['readJSON'](APP_JSON_PATH)[_0xdf36('0xa')](function(_0x5063b5){var _0x430b68=setLegacyLibsNodeEnvPath(_0x5063b5);if(_0x430b68[_0xdf36('0xb')]){_0x5cf8a4[_0xdf36('0xc')]('Updating\x20app.json');return fs[_0xdf36('0xd')](APP_JSON_PATH,_0x5063b5,{'spaces':0x2});}else{return Promise[_0xdf36('0x2')]();}});}else{return Promise[_0xdf36('0x2')]();}});}module[_0xdf36('0xe')]=updateAppConfig; \ No newline at end of file